From: support Date: Wed, 6 Apr 2022 13:31:30 +0000 (+0000) Subject: Built motion from commit 5ae82ce5.|2.6.7 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22https:/fonts.googleapis.com//%22card-image.png/%22?a=commitdiff_plain;h=134b0544a6e1a4dd0a81bb58b55b2431e6206082;p=motion2.git Built motion from commit 5ae82ce5.|2.6.7 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 0e8be12..278b492 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.6", + "version": "2.6.7", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-04T11:40:39.649Z", + "time": "2022-04-06T13:24:09.107Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 8de2432..5ccdb21 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.6", + "version": "2.6.7", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-04T11:40:39.649Z", + "time": "2022-04-06T13:24:09.107Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/package.json b/package.json index faf35dd..4868cbe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.6", + "version": "2.6.7", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 9e9853c..a8ba5c5 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 _0x9ad7=['TEXT','VIRTUAL','STRING','contactManager','integration','motionbar','jscripty','urlForward','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[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x77ae89,_0x2b65a7){var _0x19d79c=function(_0x5abc0b){while(--_0x5abc0b){_0x77ae89['push'](_0x77ae89['shift']());}};_0x19d79c(++_0x2b65a7);}(_0x9ad7,0x78));var _0x79ad=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x9ad7[_0x424a9a];return _0xa7831c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x79ad('0x0')],'get':function(_0x23d4ae){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x79ad('0x1')],'allowNull':![],'validate':{'isIn':{'args':[[_0x79ad('0x2'),_0x79ad('0x3'),_0x79ad('0x4'),_0x79ad('0x5'),_0x79ad('0x6'),'browser',_0x79ad('0x7'),_0x79ad('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x79ad('0x9')},'data1':{'type':Sequelize[_0x79ad('0x1')](0x1000),'comment':_0x79ad('0xa')},'data2':{'type':Sequelize[_0x79ad('0x1')](0x1000),'comment':_0x79ad('0xb')},'data3':{'type':Sequelize[_0x79ad('0x1')](0x1000),'comment':_0x79ad('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x79ad('0xd')},'data5':{'type':Sequelize[_0x79ad('0x1')](0x1000),'comments':_0x79ad('0xe')},'data6':{'type':Sequelize[_0x79ad('0x1')],'comments':_0x79ad('0xf')},'data7':{'type':Sequelize[_0x79ad('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x8a02=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','contactManager','integration','jscripty','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)]','STRING','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)]'];(function(_0x371f33,_0x278a69){var _0x246c96=function(_0x4f8bad){while(--_0x4f8bad){_0x371f33['push'](_0x371f33['shift']());}};_0x246c96(++_0x278a69);}(_0x8a02,0x1a9));var _0x28a0=function(_0x56d281,_0x461c77){_0x56d281=_0x56d281-0x0;var _0x5a3142=_0x8a02[_0x56d281];return _0x5a3142;};'use strict';var Sequelize=require(_0x28a0('0x0'));module[_0x28a0('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x54dd0c){return this[_0x28a0('0x2')](_0x28a0('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x28a0('0x4'),_0x28a0('0x5'),'motionbar',_0x28a0('0x6'),'urlForward',_0x28a0('0x7'),_0x28a0('0x8'),_0x28a0('0x9')]],'msg':_0x28a0('0xa')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x28a0('0xb')},'data2':{'type':Sequelize[_0x28a0('0xc')](0x1000),'comment':_0x28a0('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x28a0('0xe')},'data4':{'type':Sequelize[_0x28a0('0xc')](0x1000),'comments':_0x28a0('0xf')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x28a0('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x28a0('0x11')},'data7':{'type':Sequelize[_0x28a0('0x12')],'comments':_0x28a0('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 537a11c..025b604 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 _0x3ea3=['name','body','find','params','Action','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','stack'];(function(_0xea2fb5,_0x35090d){var _0x1385c1=function(_0x54149a){while(--_0x54149a){_0xea2fb5['push'](_0xea2fb5['shift']());}};_0x1385c1(++_0x35090d);}(_0x3ea3,0xaa));var _0x33ea=function(_0x3bf0f4,_0x4362da){_0x3bf0f4=_0x3bf0f4-0x0;var _0x459a09=_0x3ea3[_0x3bf0f4];return _0x459a09;};'use strict';var emlformat=require(_0x33ea('0x0'));var rimraf=require(_0x33ea('0x1'));var zipdir=require(_0x33ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33ea('0x3'));var moment=require(_0x33ea('0x4'));var BPromise=require(_0x33ea('0x5'));var Mustache=require(_0x33ea('0x6'));var util=require(_0x33ea('0x7'));var path=require(_0x33ea('0x8'));var sox=require(_0x33ea('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x33ea('0xa'));var jsforce=require(_0x33ea('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x33ea('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x33ea('0xd'));var qs=require(_0x33ea('0xe'));var as=require(_0x33ea('0xf'));var hardwareService=require(_0x33ea('0x10'));var logger=require('../../config/logger')(_0x33ea('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x33ea('0x12'));var db=require(_0x33ea('0x13'))['db'];function respondWithStatusCode(_0x2fed62,_0x1fba62){_0x1fba62=_0x1fba62||0xcc;return function(_0x1b70d1){if(_0x1b70d1){return _0x2fed62[_0x33ea('0x14')](_0x1fba62);}return _0x2fed62['status'](_0x1fba62)[_0x33ea('0x15')]();};}function respondWithResult(_0x4994d2,_0x18d0db){_0x18d0db=_0x18d0db||0xc8;return function(_0x4de4b6){if(_0x4de4b6){return _0x4994d2[_0x33ea('0x16')](_0x18d0db)[_0x33ea('0x17')](_0x4de4b6);}};}function respondWithFilteredResult(_0x5099f5,_0x16cc96){return function(_0x45ca78){if(_0x45ca78){var _0x1b3584=typeof _0x16cc96[_0x33ea('0x18')]===_0x33ea('0x19')&&typeof _0x16cc96[_0x33ea('0x1a')]===_0x33ea('0x19');var _0x56046b=_0x45ca78[_0x33ea('0x1b')];var _0x602e9c=_0x1b3584?0x0:_0x16cc96['offset'];var _0x13adc1=_0x1b3584?_0x45ca78[_0x33ea('0x1b')]:_0x16cc96[_0x33ea('0x18')]+_0x16cc96[_0x33ea('0x1a')];var _0x9c00f5;if(_0x13adc1>=_0x56046b){_0x13adc1=_0x56046b;_0x9c00f5=0xc8;}else{_0x9c00f5=0xce;}_0x5099f5['status'](_0x9c00f5);return _0x5099f5[_0x33ea('0x1c')](_0x33ea('0x1d'),_0x602e9c+'-'+_0x13adc1+'/'+_0x56046b)[_0x33ea('0x17')](_0x45ca78);}return null;};}function patchUpdates(_0x2ad20a){return function(_0x31780f){try{jsonpatch['apply'](_0x31780f,_0x2ad20a,!![]);}catch(_0xd1ab41){return BPromise[_0x33ea('0x1e')](_0xd1ab41);}return _0x31780f['save']();};}function saveUpdates(_0x469cad,_0x337bcb){return function(_0x4da25a){if(_0x4da25a){return _0x4da25a[_0x33ea('0x1f')](_0x469cad)[_0x33ea('0x20')](function(_0x6c01c8){return _0x6c01c8;});}return null;};}function removeEntity(_0x5bbe32,_0x51bee4){return function(_0x5aa027){if(_0x5aa027){return _0x5aa027[_0x33ea('0x21')]()[_0x33ea('0x20')](function(){_0x5bbe32['status'](0xcc)[_0x33ea('0x15')]();});}};}function handleEntityNotFound(_0x493e03,_0x49a794){return function(_0x30890e){if(!_0x30890e){_0x493e03['sendStatus'](0x194);}return _0x30890e;};}function handleError(_0x3a470c,_0x3f1cd4){_0x3f1cd4=_0x3f1cd4||0x1f4;return function(_0xdeedb9){logger['error'](_0xdeedb9[_0x33ea('0x22')]);if(_0xdeedb9['name']){delete _0xdeedb9[_0x33ea('0x23')];}_0x3a470c[_0x33ea('0x16')](_0x3f1cd4)['send'](_0xdeedb9);};}exports['update']=function(_0x1afa77,_0x104886){if(_0x1afa77[_0x33ea('0x24')]['id']){delete _0x1afa77[_0x33ea('0x24')]['id'];}return db['Action'][_0x33ea('0x25')]({'where':{'id':_0x1afa77[_0x33ea('0x26')]['id']}})[_0x33ea('0x20')](handleEntityNotFound(_0x104886,null))['then'](saveUpdates(_0x1afa77[_0x33ea('0x24')],null))[_0x33ea('0x20')](respondWithResult(_0x104886,null))['catch'](handleError(_0x104886,null));};exports[_0x33ea('0x21')]=function(_0xd4c33e,_0x57aeb){return db[_0x33ea('0x27')][_0x33ea('0x25')]({'where':{'id':_0xd4c33e[_0x33ea('0x26')]['id']}})[_0x33ea('0x20')](handleEntityNotFound(_0x57aeb,null))['then'](removeEntity(_0x57aeb,null))[_0x33ea('0x28')](handleError(_0x57aeb,null));}; \ No newline at end of file +var _0x02c9=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x31dc60,_0x805e4e){var _0x2d4cfe=function(_0x388fef){while(--_0x388fef){_0x31dc60['push'](_0x31dc60['shift']());}};_0x2d4cfe(++_0x805e4e);}(_0x02c9,0x1db));var _0x902c=function(_0x34694a,_0x3b3224){_0x34694a=_0x34694a-0x0;var _0x3ac315=_0x02c9[_0x34694a];return _0x3ac315;};'use strict';var emlformat=require(_0x902c('0x0'));var rimraf=require(_0x902c('0x1'));var zipdir=require(_0x902c('0x2'));var jsonpatch=require(_0x902c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x902c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x902c('0x5'));var sox=require(_0x902c('0x6'));var csv=require(_0x902c('0x7'));var ejs=require(_0x902c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x902c('0x9'));var squel=require(_0x902c('0xa'));var crypto=require(_0x902c('0xb'));var jsforce=require(_0x902c('0xc'));var deskjs=require(_0x902c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x902c('0xe'));var Redis=require(_0x902c('0xf'));var authService=require(_0x902c('0x10'));var qs=require(_0x902c('0x11'));var as=require(_0x902c('0x12'));var hardwareService=require(_0x902c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x902c('0x14'));var config=require(_0x902c('0x15'));var licenseUtil=require(_0x902c('0x16'));var db=require(_0x902c('0x17'))['db'];function respondWithStatusCode(_0x2a3570,_0x26c09d){_0x26c09d=_0x26c09d||0xcc;return function(_0x420b5b){if(_0x420b5b){return _0x2a3570['sendStatus'](_0x26c09d);}return _0x2a3570[_0x902c('0x18')](_0x26c09d)[_0x902c('0x19')]();};}function respondWithResult(_0x35ee8f,_0x187d04){_0x187d04=_0x187d04||0xc8;return function(_0x2d5e93){if(_0x2d5e93){return _0x35ee8f['status'](_0x187d04)[_0x902c('0x1a')](_0x2d5e93);}};}function respondWithFilteredResult(_0xbeca83,_0x22f137){return function(_0x49d445){if(_0x49d445){var _0x2edc6d=typeof _0x22f137['offset']===_0x902c('0x1b')&&typeof _0x22f137[_0x902c('0x1c')]===_0x902c('0x1b');var _0x9f601b=_0x49d445[_0x902c('0x1d')];var _0x516afc=_0x2edc6d?0x0:_0x22f137[_0x902c('0x1e')];var _0xa8f92a=_0x2edc6d?_0x49d445[_0x902c('0x1d')]:_0x22f137['offset']+_0x22f137['limit'];var _0x2f4544;if(_0xa8f92a>=_0x9f601b){_0xa8f92a=_0x9f601b;_0x2f4544=0xc8;}else{_0x2f4544=0xce;}_0xbeca83[_0x902c('0x18')](_0x2f4544);return _0xbeca83['set'](_0x902c('0x1f'),_0x516afc+'-'+_0xa8f92a+'/'+_0x9f601b)[_0x902c('0x1a')](_0x49d445);}return null;};}function patchUpdates(_0x45c363){return function(_0x1b60ab){try{jsonpatch[_0x902c('0x20')](_0x1b60ab,_0x45c363,!![]);}catch(_0x3165fd){return BPromise[_0x902c('0x21')](_0x3165fd);}return _0x1b60ab[_0x902c('0x22')]();};}function saveUpdates(_0x4bb293,_0x33e74f){return function(_0x307573){if(_0x307573){return _0x307573[_0x902c('0x23')](_0x4bb293)[_0x902c('0x24')](function(_0x1e60a4){return _0x1e60a4;});}return null;};}function removeEntity(_0x631500,_0x373caa){return function(_0x243460){if(_0x243460){return _0x243460[_0x902c('0x25')]()[_0x902c('0x24')](function(){_0x631500[_0x902c('0x18')](0xcc)[_0x902c('0x19')]();});}};}function handleEntityNotFound(_0x5953c6,_0x155a55){return function(_0x13d3cb){if(!_0x13d3cb){_0x5953c6[_0x902c('0x26')](0x194);}return _0x13d3cb;};}function handleError(_0x3ff6db,_0x2c0869){_0x2c0869=_0x2c0869||0x1f4;return function(_0x15b542){logger[_0x902c('0x27')](_0x15b542[_0x902c('0x28')]);if(_0x15b542[_0x902c('0x29')]){delete _0x15b542['name'];}_0x3ff6db[_0x902c('0x18')](_0x2c0869)[_0x902c('0x2a')](_0x15b542);};}exports[_0x902c('0x23')]=function(_0x5c3c81,_0xc9fac5){if(_0x5c3c81['body']['id']){delete _0x5c3c81[_0x902c('0x2b')]['id'];}return db[_0x902c('0x2c')][_0x902c('0x2d')]({'where':{'id':_0x5c3c81[_0x902c('0x2e')]['id']}})['then'](handleEntityNotFound(_0xc9fac5,null))[_0x902c('0x24')](saveUpdates(_0x5c3c81[_0x902c('0x2b')],null))['then'](respondWithResult(_0xc9fac5,null))[_0x902c('0x2f')](handleError(_0xc9fac5,null));};exports[_0x902c('0x25')]=function(_0x5920d1,_0x124281){return db[_0x902c('0x2c')][_0x902c('0x2d')]({'where':{'id':_0x5920d1[_0x902c('0x2e')]['id']}})['then'](handleEntityNotFound(_0x124281,null))[_0x902c('0x24')](removeEntity(_0x124281,null))[_0x902c('0x2f')](handleError(_0x124281,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index f9fcdea..a3d8a9a 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 _0x0ae5=['Action','tools_actions','lodash','util','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x28168d,_0x7acd3){var _0x2f6880=function(_0x5d8e92){while(--_0x5d8e92){_0x28168d['push'](_0x28168d['shift']());}};_0x2f6880(++_0x7acd3);}(_0x0ae5,0x16a));var _0x50ae=function(_0x12057d,_0x23e1a4){_0x12057d=_0x12057d-0x0;var _0xe37bbf=_0x0ae5[_0x12057d];return _0xe37bbf;};'use strict';var _=require(_0x50ae('0x0'));var util=require(_0x50ae('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x50ae('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x50ae('0x3'));var rimraf=require(_0x50ae('0x4'));var config=require(_0x50ae('0x5'));var attributes=require('./action.attributes');module[_0x50ae('0x6')]=function(_0x53f8d2,_0x509c19){return _0x53f8d2[_0x50ae('0x7')](_0x50ae('0x8'),attributes,{'tableName':_0x50ae('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde82=['./action.attributes','exports','define','tools_actions','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x408193,_0x388396){var _0x40e295=function(_0x318396){while(--_0x318396){_0x408193['push'](_0x408193['shift']());}};_0x40e295(++_0x388396);}(_0xde82,0xe0));var _0x2de8=function(_0xf3a154,_0x568aa0){_0xf3a154=_0xf3a154-0x0;var _0x35e9cf=_0xde82[_0xf3a154];return _0x35e9cf;};'use strict';var _=require(_0x2de8('0x0'));var util=require('util');var logger=require(_0x2de8('0x1'))(_0x2de8('0x2'));var moment=require(_0x2de8('0x3'));var BPromise=require(_0x2de8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2de8('0x5'));var rimraf=require(_0x2de8('0x6'));var config=require('../../config/environment');var attributes=require(_0x2de8('0x7'));module[_0x2de8('0x8')]=function(_0x34664e,_0x57f8eb){return _0x34664e[_0x2de8('0x9')]('Action',attributes,{'tableName':_0x2de8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index a81921a..7d30b2b 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 _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x53ec,0x192));var _0xc53e=function(_0x43ebd4,_0x3b3630){_0x43ebd4=_0x43ebd4-0x0;var _0x218876=_0x53ec[_0x43ebd4];return _0x218876;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5ad88e,_0x5d42a1){var _0x549079=function(_0x3a4d6f){while(--_0x3a4d6f){_0x5ad88e['push'](_0x5ad88e['shift']());}};_0x549079(++_0x5d42a1);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x16bfae,_0x36ed25){_0x16bfae=_0x16bfae-0x0;var _0x3870f5=_0x7fbe[_0x16bfae];return _0x3870f5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7b39b36..c7abd67 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 _0xc450=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','update','delete','isAuthenticated','exports','util','path','connect-timeout','express'];(function(_0x5272e0,_0x169ce5){var _0xa4fc96=function(_0x4f359a){while(--_0x4f359a){_0x5272e0['push'](_0x5272e0['shift']());}};_0xa4fc96(++_0x169ce5);}(_0xc450,0x137));var _0x0c45=function(_0xf64967,_0x1583ac){_0xf64967=_0xf64967-0x0;var _0x34813b=_0xc450[_0xf64967];return _0x34813b;};'use strict';var multer=require('multer');var util=require(_0x0c45('0x0'));var path=require(_0x0c45('0x1'));var timeout=require(_0x0c45('0x2'));var express=require(_0x0c45('0x3'));var router=express[_0x0c45('0x4')]();var fs_extra=require(_0x0c45('0x5'));var auth=require(_0x0c45('0x6'));var interaction=require(_0x0c45('0x7'));var config=require(_0x0c45('0x8'));var controller=require(_0x0c45('0x9'));router['put'](_0x0c45('0xa'),auth['isAuthenticated'](),controller[_0x0c45('0xb')]);router[_0x0c45('0xc')](_0x0c45('0xa'),auth[_0x0c45('0xd')](),controller['destroy']);module[_0x0c45('0xe')]=router; \ No newline at end of file +var _0x1e29=['../../components/interaction/service','put','/:id','update','destroy','multer','util','path','express','Router'];(function(_0x80a18e,_0x3d749){var _0x56f354=function(_0x68f489){while(--_0x68f489){_0x80a18e['push'](_0x80a18e['shift']());}};_0x56f354(++_0x3d749);}(_0x1e29,0xcd));var _0x91e2=function(_0x45b824,_0x38d8f1){_0x45b824=_0x45b824-0x0;var _0x52635c=_0x1e29[_0x45b824];return _0x52635c;};'use strict';var multer=require(_0x91e2('0x0'));var util=require(_0x91e2('0x1'));var path=require(_0x91e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x91e2('0x3'));var router=express[_0x91e2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x91e2('0x5'));var config=require('../../config/environment');var controller=require('./action.controller');router[_0x91e2('0x6')](_0x91e2('0x7'),auth['isAuthenticated'](),controller[_0x91e2('0x8')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x91e2('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 32a6d08..3102f4f 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 _0x33c5=['STRING','TEXT','exports'];(function(_0x303251,_0x316d2a){var _0x623982=function(_0x4f22b7){while(--_0x4f22b7){_0x303251['push'](_0x303251['shift']());}};_0x623982(++_0x316d2a);}(_0x33c5,0xe6));var _0x533c=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0x33c5[_0x46b22a];return _0x44c2e8;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','TEXT','sequelize'];(function(_0x517d65,_0x29cbc3){var _0xf911de=function(_0x1389ee){while(--_0x1389ee){_0x517d65['push'](_0x517d65['shift']());}};_0xf911de(++_0x29cbc3);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7995('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x7995('0x2')]},'conditions':{'type':Sequelize[_0x7995('0x3')]},'joins':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 33d5114..8ea72c1 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 _0x93e6=['sendStatus','status','end','json','offset','undefined','limit','set','reject','update','then','destroy','get','CustomReports','UserProfileResource','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','getFields','groupBy','web','%s-%s.%s','randomstring','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','../../components/export/','output','../../files/reports','savename','countTable','COUNT(*)','IS\x20NOT\x20NULL','eml-format','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93e6,0x11e));var _0x693e=function(_0x48cb44,_0x406b00){_0x48cb44=_0x48cb44-0x0;var _0x3cb35b=_0x93e6[_0x48cb44];return _0x3cb35b;};'use strict';var emlformat=require(_0x693e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x693e('0x1'));var rp=require('request-promise');var moment=require(_0x693e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x693e('0x3'));var util=require(_0x693e('0x4'));var path=require(_0x693e('0x5'));var sox=require('sox');var csv=require(_0x693e('0x6'));var ejs=require(_0x693e('0x7'));var fs=require('fs');var fs_extra=require(_0x693e('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x693e('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x693e('0x6'));var querystring=require(_0x693e('0xa'));var Papa=require(_0x693e('0xb'));var Redis=require('ioredis');var authService=require(_0x693e('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x693e('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x693e('0xe'))('api');var utils=require('../../config/utils');var config=require(_0x693e('0xf'));var licenseUtil=require(_0x693e('0x10'));var db=require(_0x693e('0x11'))['db'];var dbH=require(_0x693e('0x11'))['dbH'];function respondWithStatusCode(_0x256143,_0x172b79){_0x172b79=_0x172b79||0xcc;return function(_0x25c4a7){if(_0x25c4a7){return _0x256143[_0x693e('0x12')](_0x172b79);}return _0x256143[_0x693e('0x13')](_0x172b79)[_0x693e('0x14')]();};}function respondWithResult(_0x3e44ba,_0x4a7626){_0x4a7626=_0x4a7626||0xc8;return function(_0x3a696c){if(_0x3a696c){return _0x3e44ba[_0x693e('0x13')](_0x4a7626)[_0x693e('0x15')](_0x3a696c);}};}function respondWithFilteredResult(_0x54d946,_0x18b748){return function(_0x7103b1){if(_0x7103b1){var _0x32b1c0=typeof _0x18b748[_0x693e('0x16')]===_0x693e('0x17')&&typeof _0x18b748[_0x693e('0x18')]===_0x693e('0x17');var _0x4f4264=_0x7103b1['count'];var _0x5e842f=_0x32b1c0?0x0:_0x18b748[_0x693e('0x16')];var _0x11407a=_0x32b1c0?_0x7103b1['count']:_0x18b748['offset']+_0x18b748[_0x693e('0x18')];var _0x175253;if(_0x11407a>=_0x4f4264){_0x11407a=_0x4f4264;_0x175253=0xc8;}else{_0x175253=0xce;}_0x54d946[_0x693e('0x13')](_0x175253);return _0x54d946[_0x693e('0x19')]('Content-Range',_0x5e842f+'-'+_0x11407a+'/'+_0x4f4264)[_0x693e('0x15')](_0x7103b1);}return null;};}function patchUpdates(_0x40aee8){return function(_0x3ce473){try{jsonpatch['apply'](_0x3ce473,_0x40aee8,!![]);}catch(_0x37d69c){return BPromise[_0x693e('0x1a')](_0x37d69c);}return _0x3ce473['save']();};}function saveUpdates(_0x433d14,_0x1e5c04){return function(_0x5850e8){if(_0x5850e8){return _0x5850e8[_0x693e('0x1b')](_0x433d14)[_0x693e('0x1c')](function(_0x51f0f0){return _0x51f0f0;});}return null;};}function removeEntity(_0x3847be,_0x25c39e){return function(_0x1fd85){if(_0x1fd85){return _0x1fd85[_0x693e('0x1d')]()[_0x693e('0x1c')](function(){var _0x322924=_0x1fd85[_0x693e('0x1e')]({'plain':!![]});var _0x13fcb9=_0x693e('0x1f');return db[_0x693e('0x20')][_0x693e('0x1d')]({'where':{'type':_0x13fcb9,'resourceId':_0x322924['id']}})[_0x693e('0x1c')](function(){return _0x1fd85;});})[_0x693e('0x1c')](function(){_0x3847be[_0x693e('0x13')](0xcc)[_0x693e('0x14')]();});}};}function handleEntityNotFound(_0x402674,_0xc86c62){return function(_0x2cf92b){if(!_0x2cf92b){_0x402674['sendStatus'](0x194);}return _0x2cf92b;};}function handleError(_0x3b6156,_0x1c002d){_0x1c002d=_0x1c002d||0x1f4;return function(_0x1ea8e1){logger[_0x693e('0x21')](_0x1ea8e1[_0x693e('0x22')]);if(_0x1ea8e1['name']){delete _0x1ea8e1[_0x693e('0x23')];}_0x3b6156['status'](_0x1c002d)[_0x693e('0x24')](_0x1ea8e1);};}exports['index']=function(_0x279c2e,_0x19e04f){var _0x4e0a08={},_0x3f6c11={},_0x2b47e7={'count':0x0,'rows':[]};var _0x4c3bc4=_[_0x693e('0x25')](db[_0x693e('0x26')][_0x693e('0x27')],function(_0x2a4101){return{'name':_0x2a4101[_0x693e('0x28')],'type':_0x2a4101[_0x693e('0x29')][_0x693e('0x2a')]};});_0x3f6c11[_0x693e('0x2b')]=_[_0x693e('0x25')](_0x4c3bc4,_0x693e('0x23'));_0x3f6c11[_0x693e('0x2c')]=_[_0x693e('0x2d')](_0x279c2e[_0x693e('0x2c')]);_0x3f6c11[_0x693e('0x2e')]=_[_0x693e('0x2f')](_0x3f6c11[_0x693e('0x2b')],_0x3f6c11[_0x693e('0x2c')]);_0x4e0a08[_0x693e('0x30')]=_[_0x693e('0x2f')](_0x3f6c11['model'],qs[_0x693e('0x31')](_0x279c2e[_0x693e('0x2c')]['fields']));_0x4e0a08[_0x693e('0x30')]=_0x4e0a08[_0x693e('0x30')]['length']?_0x4e0a08['attributes']:_0x3f6c11[_0x693e('0x2b')];if(!_0x279c2e[_0x693e('0x2c')][_0x693e('0x32')](_0x693e('0x33'))){_0x4e0a08[_0x693e('0x18')]=qs[_0x693e('0x18')](_0x279c2e[_0x693e('0x2c')][_0x693e('0x18')]);_0x4e0a08['offset']=qs[_0x693e('0x16')](_0x279c2e[_0x693e('0x2c')]['offset']);}_0x4e0a08[_0x693e('0x34')]=qs[_0x693e('0x35')](_0x279c2e[_0x693e('0x2c')][_0x693e('0x35')]);_0x4e0a08[_0x693e('0x36')]=qs[_0x693e('0x2e')](_[_0x693e('0x37')](_0x279c2e['query'],_0x3f6c11[_0x693e('0x2e')]),_0x4c3bc4);if(_0x279c2e[_0x693e('0x2c')][_0x693e('0x38')]){_0x4e0a08['where']=_[_0x693e('0x39')](_0x4e0a08['where'],{'$or':_[_0x693e('0x25')](_0x4c3bc4,function(_0x8a2f3){if(_0x8a2f3['type']!=='VIRTUAL'){var _0x37ca16={};_0x37ca16[_0x8a2f3[_0x693e('0x23')]]={'$like':'%'+_0x279c2e[_0x693e('0x2c')][_0x693e('0x38')]+'%'};return _0x37ca16;}})});}_0x4e0a08=_[_0x693e('0x39')]({},_0x4e0a08,_0x279c2e[_0x693e('0x3a')]);var _0xa47f7c={'where':_0x4e0a08[_0x693e('0x36')]};return db[_0x693e('0x26')][_0x693e('0x3b')](_0xa47f7c)[_0x693e('0x1c')](function(_0x3cec0b){_0x2b47e7['count']=_0x3cec0b;if(_0x279c2e['query'][_0x693e('0x3c')]){_0x4e0a08[_0x693e('0x3d')]=[{'all':!![]}];}return db[_0x693e('0x26')][_0x693e('0x3e')](_0x4e0a08);})[_0x693e('0x1c')](function(_0x484850){_0x2b47e7[_0x693e('0x3f')]=_0x484850;return _0x2b47e7;})[_0x693e('0x1c')](respondWithFilteredResult(_0x19e04f,_0x4e0a08))[_0x693e('0x40')](handleError(_0x19e04f,null));};exports[_0x693e('0x41')]=function(_0x31d744,_0xc3e0c){var _0x3793eb={'raw':![],'where':{'id':_0x31d744['params']['id']}},_0x261def={};_0x261def[_0x693e('0x2b')]=_['keys'](db[_0x693e('0x26')][_0x693e('0x27')]);_0x261def['query']=_[_0x693e('0x2d')](_0x31d744[_0x693e('0x2c')]);_0x261def[_0x693e('0x2e')]=_['intersection'](_0x261def[_0x693e('0x2b')],_0x261def[_0x693e('0x2c')]);_0x3793eb[_0x693e('0x30')]=_[_0x693e('0x2f')](_0x261def[_0x693e('0x2b')],qs[_0x693e('0x31')](_0x31d744[_0x693e('0x2c')][_0x693e('0x31')]));_0x3793eb[_0x693e('0x30')]=_0x3793eb[_0x693e('0x30')]['length']?_0x3793eb['attributes']:_0x261def[_0x693e('0x2b')];if(_0x31d744[_0x693e('0x2c')][_0x693e('0x3c')]){_0x3793eb[_0x693e('0x3d')]=[{'all':!![]}];}_0x3793eb=_[_0x693e('0x39')]({},_0x3793eb,_0x31d744['options']);return db[_0x693e('0x26')][_0x693e('0x42')](_0x3793eb)[_0x693e('0x1c')](handleEntityNotFound(_0xc3e0c,null))[_0x693e('0x1c')](respondWithResult(_0xc3e0c,null))[_0x693e('0x40')](handleError(_0xc3e0c,null));};exports[_0x693e('0x43')]=function(_0x511c69,_0x1cd493){return db[_0x693e('0x26')][_0x693e('0x43')](_0x511c69[_0x693e('0x44')],{})['then'](function(_0x7fd9a4){var _0x585cd7=_0x511c69[_0x693e('0x45')][_0x693e('0x1e')]({'plain':!![]});if(!_0x585cd7)throw new Error(_0x693e('0x46'));if(_0x585cd7[_0x693e('0x47')]===_0x693e('0x45')){var _0x2085a5=_0x7fd9a4[_0x693e('0x1e')]({'plain':!![]});var _0x39503e='Reports';return db['UserProfileSection'][_0x693e('0x42')]({'where':{'name':_0x39503e,'userProfileId':_0x585cd7[_0x693e('0x48')]},'raw':!![]})[_0x693e('0x1c')](function(_0x1fc19f){if(_0x1fc19f&&_0x1fc19f[_0x693e('0x49')]===0x0){return db['UserProfileResource'][_0x693e('0x43')]({'name':_0x2085a5[_0x693e('0x23')],'resourceId':_0x2085a5['id'],'type':'CustomReports','sectionId':_0x1fc19f['id']},{})[_0x693e('0x1c')](function(){return _0x7fd9a4;});}else{return _0x7fd9a4;}})[_0x693e('0x40')](function(_0x91028f){logger[_0x693e('0x21')](_0x693e('0x4a'),_0x91028f);throw _0x91028f;});}return _0x7fd9a4;})[_0x693e('0x1c')](respondWithResult(_0x1cd493,0xc9))[_0x693e('0x40')](handleError(_0x1cd493,null));};exports[_0x693e('0x1b')]=function(_0x1390c0,_0x129a75){if(_0x1390c0[_0x693e('0x44')]['id']){delete _0x1390c0[_0x693e('0x44')]['id'];}return db[_0x693e('0x26')]['find']({'where':{'id':_0x1390c0['params']['id']}})['then'](handleEntityNotFound(_0x129a75,null))[_0x693e('0x1c')](saveUpdates(_0x1390c0[_0x693e('0x44')],null))[_0x693e('0x1c')](respondWithResult(_0x129a75,null))[_0x693e('0x40')](handleError(_0x129a75,null));};exports[_0x693e('0x1d')]=function(_0x48c6cb,_0x52e652){return db[_0x693e('0x26')][_0x693e('0x42')]({'where':{'id':_0x48c6cb[_0x693e('0x4b')]['id']}})[_0x693e('0x1c')](handleEntityNotFound(_0x52e652,null))[_0x693e('0x1c')](removeEntity(_0x52e652,null))[_0x693e('0x40')](handleError(_0x52e652,null));};exports['preview']=function(_0x34a17f,_0x6d3fb7){var _0x2f35b7=0xa;var _0x29bc09=['join','left_join',_0x693e('0x4c'),_0x693e('0x4d')];var _0x4f65fe={'SUM':_0x693e('0x4e'),'COUNT':_0x693e('0x4f'),'COUNT DISTINCT':_0x693e('0x50'),'MAX':_0x693e('0x51'),'MIN':_0x693e('0x52'),'AVG':_0x693e('0x53'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x693e('0x54')};var _0xe42978={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x693e('0x55'),'ROUND':_0x693e('0x56'),'UNIX_TIMESTAMP':_0x693e('0x57')};var _0x3c8731=function(_0x432418){return!_[_0x693e('0x58')]([_0x693e('0x59'),'IS\x20NOT\x20NULL',_0x693e('0x5a'),_0x693e('0x5b')],_0x432418);};var _0x4fbf29=function(_0x53bd7c){if(!_0x53bd7c||!_0x53bd7c[_0x693e('0x5c')][_0x693e('0x5d')]){return'';}for(var _0x525641='(',_0x9f9019=0x0;_0x9f9019<_0x53bd7c[_0x693e('0x5c')]['length'];_0x9f9019+=0x1){_0x9f9019>0x0&&(_0x525641+='\x20'+_0x53bd7c[_0x693e('0x5e')]+'\x20');_0x525641+=_0x53bd7c[_0x693e('0x5c')][_0x9f9019][_0x693e('0x5f')]?_0x4fbf29(_0x53bd7c[_0x693e('0x5c')][_0x9f9019][_0x693e('0x5f')]):_0x53bd7c[_0x693e('0x5c')][_0x9f9019][_0x693e('0x60')]+'\x20'+_0x53bd7c[_0x693e('0x5c')][_0x9f9019][_0x693e('0x61')]+(_0x3c8731(_0x53bd7c[_0x693e('0x5c')][_0x9f9019][_0x693e('0x61')])?'\x20'+_0x53bd7c[_0x693e('0x5c')][_0x9f9019][_0x693e('0x62')]:'');}return _0x525641+')';};var _0x1f3f26={'where':{'id':_0x34a17f[_0x693e('0x4b')]['id']}},_0xb7af4d,_0x3cb570,_0x380ff6,_0x3c3e57,_0xfb66da;_0x1f3f26=_['merge']({},_0x1f3f26,_0x34a17f['options']);return db[_0x693e('0x26')][_0x693e('0x42')](_0x1f3f26)[_0x693e('0x1c')](function(_0x34b546){if(_0x34b546){_0xb7af4d=_0x34b546;return _0x34b546['getFields']();}return null;})[_0x693e('0x1c')](function(_0xf33634){if(_0xf33634){if(!_0xf33634[_0x693e('0x5d')]){throw new db[(_0x693e('0x63'))][(_0x693e('0x64'))](_0x693e('0x65'),0x193);}_0x3cb570=_0xf33634;return db[_0x693e('0x66')][_0x693e('0x3e')]({'raw':!![]});}return null;})[_0x693e('0x1c')](function(_0x4d91a8){if(_0x4d91a8){_0x380ff6=_[_0x693e('0x67')](_0x4d91a8,'id');var _0x77feb4;var _0x2e7310=squel[_0x693e('0x68')]();_0x2e7310[_0x693e('0x69')](_0xb7af4d[_0x693e('0x6a')]);for(var _0x2efb85=0x0;_0x2efb85<_0x3cb570[_0x693e('0x5d')];_0x2efb85+=0x1){_0x77feb4=_0x3cb570[_0x2efb85]['MetricId']?_0x380ff6[_0x3cb570[_0x2efb85][_0x693e('0x6b')]][_0x693e('0x6c')]:_0x3cb570[_0x2efb85]['field'];_0x77feb4=_0x3cb570[_0x2efb85][_0x693e('0x6d')]?_[_0x693e('0x6e')](_0x4f65fe[_0x3cb570[_0x2efb85]['function']],'%s',_0x77feb4):_0x77feb4;_0x77feb4=_0x3cb570[_0x2efb85]['format']?_['replace'](_0xe42978[_0x3cb570[_0x2efb85][_0x693e('0x6f')]],'%s',_0x77feb4):_0x77feb4;if(_0x3cb570[_0x2efb85]['groupBy']){_0x2e7310[_0x693e('0x5f')](_0x77feb4);}_0x3cb570[_0x2efb85][_0x693e('0x70')]&&_0x2e7310['order'](_0x77feb4,_0x3cb570[_0x2efb85][_0x693e('0x70')]===_0x693e('0x71')?![]:!![]);_0x2e7310[_0x693e('0x60')](_0x77feb4,_0x3cb570[_0x2efb85][_0x693e('0x72')]||_0x77feb4);}if(_0xb7af4d[_0x693e('0x73')]){_0xb7af4d[_0x693e('0x73')]=JSON['parse'](_0xb7af4d[_0x693e('0x73')]);for(var _0x38e823=0x0;_0x38e823<_0xb7af4d[_0x693e('0x73')][_0x693e('0x5d')];_0x38e823+=0x1){if(_0xb7af4d[_0x693e('0x73')][_0x38e823][_0x693e('0x29')]&&_['includes'](_0x29bc09,_0xb7af4d['joins'][_0x38e823][_0x693e('0x29')])&&_0xb7af4d['joins'][_0x38e823][_0x693e('0x74')]&&_0xb7af4d[_0x693e('0x73')][_0x38e823][_0x693e('0x75')]&&_0xb7af4d['joins'][_0x38e823][_0x693e('0x76')]){_0x2e7310[_0xb7af4d['joins'][_0x38e823][_0x693e('0x29')]](_0xb7af4d[_0x693e('0x73')][_0x38e823]['foreignTable'],null,util[_0x693e('0x6f')](_0x693e('0x77'),_0xb7af4d[_0x693e('0x6a')],_0xb7af4d[_0x693e('0x73')][_0x38e823][_0x693e('0x74')],_0xb7af4d[_0x693e('0x73')][_0x38e823][_0x693e('0x75')],_0xb7af4d[_0x693e('0x73')][_0x38e823]['foreignKey']));}}}if(_0xb7af4d[_0x693e('0x78')]){_0xb7af4d['conditions']=JSON[_0x693e('0x79')](_0xb7af4d[_0x693e('0x78')]);_0x2e7310['where'](_0x4fbf29(_0xb7af4d['conditions'][_0x693e('0x5f')]));}_0xfb66da=_0x2e7310[_0x693e('0x7a')]();_0x2e7310[_0x693e('0x18')](_0x2f35b7);_0x2e7310['offset'](0x0);logger[_0x693e('0x7b')](_0x693e('0x7c'),_0x2e7310[_0x693e('0x7d')]());return dbH[_0x693e('0x7e')][_0x693e('0x2c')](_0x2e7310[_0x693e('0x7d')](),{'type':dbH[_0x693e('0x7e')][_0x693e('0x7f')][_0x693e('0x80')]});}})[_0x693e('0x1c')](respondWithResult(_0x6d3fb7,null))[_0x693e('0x40')](handleError(_0x6d3fb7,null));};function runReport(_0x230640,_0x1d59f0,_0x13b8c1){var _0x944b0b=_0x1d59f0[_0x693e('0x23')];var _0x32aff7=0xa;var _0x27693e=[_0x693e('0x81'),_0x693e('0x82'),_0x693e('0x4c'),_0x693e('0x4d')];var _0x5a5e5d={'SUM':_0x693e('0x4e'),'COUNT':_0x693e('0x4f'),'COUNT DISTINCT':_0x693e('0x50'),'MAX':_0x693e('0x51'),'MIN':_0x693e('0x52'),'AVG':_0x693e('0x53'),'GROUP_CONCAT':_0x693e('0x83'),'GROUP_CONCAT ASC':_0x693e('0x84'),'GROUP_CONCAT DESC':_0x693e('0x54')};var _0xda6005={'SEC_TO_TIME':_0x693e('0x85'),'DATE':'DATE(%s)','HOUR':_0x693e('0x55'),'ROUND':_0x693e('0x56'),'UNIX_TIMESTAMP':_0x693e('0x57')};var _0x82aac1=function(_0x3ffba5){return!_[_0x693e('0x58')]([_0x693e('0x59'),'IS\x20NOT\x20NULL',_0x693e('0x5a'),_0x693e('0x5b')],_0x3ffba5);};var _0x19d8a1=function(_0xccfb20){if(!_0xccfb20||!_0xccfb20[_0x693e('0x5c')][_0x693e('0x5d')]){return'';}for(var _0xcb9284='(',_0x372881=0x0;_0x372881<_0xccfb20[_0x693e('0x5c')][_0x693e('0x5d')];_0x372881+=0x1){_0x372881>0x0&&(_0xcb9284+='\x20'+_0xccfb20[_0x693e('0x5e')]+'\x20');_0xcb9284+=_0xccfb20[_0x693e('0x5c')][_0x372881][_0x693e('0x5f')]?_0x19d8a1(_0xccfb20['rules'][_0x372881][_0x693e('0x5f')]):_0xccfb20['rules'][_0x372881]['field']+'\x20'+_0xccfb20[_0x693e('0x5c')][_0x372881]['condition']+(_0x82aac1(_0xccfb20['rules'][_0x372881]['condition'])?'\x20'+_0xccfb20[_0x693e('0x5c')][_0x372881]['value']:'');}return _0xcb9284+')';};var _0x59cb8a={'where':{'id':_0x230640['id']}},_0x4d0ec7,_0x4cda2f,_0x4d48ed,_0xf3cf5,_0x1107ae;_0x59cb8a=_[_0x693e('0x39')]({},_0x59cb8a,_0x13b8c1);return db['AnalyticCustomReport'][_0x693e('0x42')](_0x59cb8a)[_0x693e('0x1c')](function(_0x452a3b){if(_0x452a3b){_0x4d0ec7=_0x452a3b;return _0x452a3b[_0x693e('0x86')]();}return null;})[_0x693e('0x1c')](function(_0x30ba6a){if(_0x30ba6a){if(!_0x30ba6a[_0x693e('0x5d')]){throw new db[(_0x693e('0x63'))]['ValidationErrorItem'](_0x693e('0x65'),0x193);}_0x4cda2f=_0x30ba6a;return db[_0x693e('0x66')][_0x693e('0x3e')]({'raw':!![]});}return null;})[_0x693e('0x1c')](function(_0x289e64){if(_0x289e64){_0x4d48ed=_['keyBy'](_0x289e64,'id');var _0x2c5f01;var _0x4bbef9=squel[_0x693e('0x68')]();_0x4bbef9[_0x693e('0x69')](_0x4d0ec7[_0x693e('0x6a')]);for(var _0x1cb990=0x0;_0x1cb990<_0x4cda2f[_0x693e('0x5d')];_0x1cb990+=0x1){_0x2c5f01=_0x4cda2f[_0x1cb990]['MetricId']?_0x4d48ed[_0x4cda2f[_0x1cb990][_0x693e('0x6b')]]['metric']:_0x4cda2f[_0x1cb990]['field'];_0x2c5f01=_0x4cda2f[_0x1cb990][_0x693e('0x6d')]?_[_0x693e('0x6e')](_0x5a5e5d[_0x4cda2f[_0x1cb990][_0x693e('0x6d')]],'%s',_0x2c5f01):_0x2c5f01;_0x2c5f01=_0x4cda2f[_0x1cb990][_0x693e('0x6f')]?_['replace'](_0xda6005[_0x4cda2f[_0x1cb990][_0x693e('0x6f')]],'%s',_0x2c5f01):_0x2c5f01;if(_0x4cda2f[_0x1cb990][_0x693e('0x87')]){_0x4bbef9[_0x693e('0x5f')](_0x2c5f01);}_0x4cda2f[_0x1cb990]['orderBy']&&_0x4bbef9[_0x693e('0x34')](_0x2c5f01,_0x4cda2f[_0x1cb990]['orderBy']==='DESC'?![]:!![]);_0x4bbef9[_0x693e('0x60')](_0x2c5f01,_0x4cda2f[_0x1cb990][_0x693e('0x72')]||_0x2c5f01);}if(_0x4d0ec7[_0x693e('0x73')]){_0x4d0ec7[_0x693e('0x73')]=JSON[_0x693e('0x79')](_0x4d0ec7[_0x693e('0x73')]);for(var _0x1f8c6c=0x0;_0x1f8c6c<_0x4d0ec7[_0x693e('0x73')][_0x693e('0x5d')];_0x1f8c6c+=0x1){if(_0x4d0ec7['joins'][_0x1f8c6c][_0x693e('0x29')]&&_['includes'](_0x27693e,_0x4d0ec7['joins'][_0x1f8c6c][_0x693e('0x29')])&&_0x4d0ec7[_0x693e('0x73')][_0x1f8c6c][_0x693e('0x74')]&&_0x4d0ec7[_0x693e('0x73')][_0x1f8c6c]['foreignTable']&&_0x4d0ec7[_0x693e('0x73')][_0x1f8c6c][_0x693e('0x76')]){_0x4bbef9[_0x4d0ec7[_0x693e('0x73')][_0x1f8c6c][_0x693e('0x29')]](_0x4d0ec7[_0x693e('0x73')][_0x1f8c6c][_0x693e('0x75')],null,util[_0x693e('0x6f')](_0x693e('0x77'),_0x4d0ec7[_0x693e('0x6a')],_0x4d0ec7[_0x693e('0x73')][_0x1f8c6c][_0x693e('0x74')],_0x4d0ec7[_0x693e('0x73')][_0x1f8c6c]['foreignTable'],_0x4d0ec7[_0x693e('0x73')][_0x1f8c6c]['foreignKey']));}}}if(_0x4d0ec7[_0x693e('0x78')]){_0x4d0ec7[_0x693e('0x78')]=JSON[_0x693e('0x79')](_0x4d0ec7[_0x693e('0x78')]);_0x4bbef9[_0x693e('0x36')](_0x19d8a1(_0x4d0ec7[_0x693e('0x78')]['group']));}_0x1107ae=_0x4bbef9[_0x693e('0x7a')]();_0x4bbef9['limit'](_0x32aff7);_0x4bbef9[_0x693e('0x16')](0x0);return;}})['then'](function(){if(_0x1d59f0['output']===_0x693e('0x88')){return null;}var _0x5ec9d6=_[_0x693e('0x39')](_0x1d59f0,{'name':_0x1d59f0['fullPath']||_0x1d59f0[_0x693e('0x23')]||_0x4d0ec7[_0x693e('0x23')],'basename':_0x944b0b,'savename':util[_0x693e('0x6f')](_0x693e('0x89'),_0x1d59f0[_0x693e('0x23')]||_0x4d0ec7[_0x693e('0x23')],require(_0x693e('0x8a'))['generate'](0x4),_0x1d59f0['output']||'csv'),'reportId':_0x4d0ec7['id'],'reportType':'custom'});return db[_0x693e('0x8b')][_0x693e('0x43')](_0x5ec9d6,{'raw':!![]});})[_0x693e('0x1c')](function(_0x8688be){if(_0x4d0ec7[_0x693e('0x6a')]==='cdr'){_0x1107ae[_0x693e('0x36')](_0x4d0ec7[_0x693e('0x6a')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1d59f0[_0x693e('0x8c')],_0x1d59f0[_0x693e('0x8d')]);}else{_0x1107ae['where'](_0x4d0ec7[_0x693e('0x6a')]+_0x693e('0x8e'),_0x1d59f0['startDate'],_0x1d59f0['endDate']);}if(_0x8688be){logger[_0x693e('0x8f')](_0x693e('0x90'),_0x1107ae[_0x693e('0x7d')]());require('child_process')['fork'](path[_0x693e('0x81')](__dirname,_0x693e('0x91'),_0x8688be[_0x693e('0x92')]),[_0x8688be['id'],_0x1107ae[_0x693e('0x7d')](),path[_0x693e('0x81')](__dirname,_0x693e('0x93'),_0x8688be[_0x693e('0x94')]),_0x944b0b]);return _0x8688be;}else{var _0x327032=squel['select']();_0x327032['from']('('+_0x1107ae['toString']()+')',_0x693e('0x95'));_0x327032[_0x693e('0x60')](_0x693e('0x96'),_0x693e('0x3b'));_0x1107ae['limit'](_0x1d59f0['limit']||_0x32aff7);_0x1107ae[_0x693e('0x16')](_0x1d59f0[_0x693e('0x16')]||0x0);return dbH[_0x693e('0x7e')]['query'](_0x327032['toString'](),{'type':dbH[_0x693e('0x7e')]['QueryTypes']['SELECT']})[_0x693e('0x1c')](function(_0x55b4ee){if(!_0x55b4ee[_0x693e('0x5d')]){_0xf3cf5=0x0;}else{_0xf3cf5=_0x55b4ee[0x0][_0x693e('0x3b')]||0x0;}return dbH['sequelize']['query'](_0x1107ae['toString'](),{'type':dbH[_0x693e('0x7e')]['QueryTypes']['SELECT']});})[_0x693e('0x1c')](function(_0x3a5c80){return{'rows':_0x3a5c80||[],'count':_0xf3cf5};});}});}exports['run']=function(_0x14395c,_0x356701){return runReport(_0x14395c[_0x693e('0x4b')],_0x14395c[_0x693e('0x2c')],_0x14395c[_0x693e('0x3a')])['then'](respondWithResult(_0x356701,null))['catch'](handleError(_0x356701,null));};exports['runReport']=runReport;exports[_0x693e('0x2c')]=function(_0x390be9,_0x4b71e7){var _0x258574=0xa;var _0x4df7b9=[_0x693e('0x81'),_0x693e('0x82'),_0x693e('0x4c'),_0x693e('0x4d')];var _0x56faa8={'SUM':_0x693e('0x4e'),'COUNT':_0x693e('0x4f'),'COUNT DISTINCT':_0x693e('0x50'),'MAX':_0x693e('0x51'),'MIN':_0x693e('0x52'),'AVG':_0x693e('0x53'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3e519b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x693e('0x56'),'UNIX_TIMESTAMP':_0x693e('0x57')};var _0x252087=function(_0x4503d3){return!_[_0x693e('0x58')]([_0x693e('0x59'),_0x693e('0x97'),_0x693e('0x5a'),_0x693e('0x5b')],_0x4503d3);};var _0x4546cc=function(_0x4e26c5){if(!_0x4e26c5||!_0x4e26c5[_0x693e('0x5c')][_0x693e('0x5d')]){return'';}for(var _0x4c5d4c='(',_0x12bd27=0x0;_0x12bd27<_0x4e26c5[_0x693e('0x5c')][_0x693e('0x5d')];_0x12bd27+=0x1){_0x12bd27>0x0&&(_0x4c5d4c+='\x20'+_0x4e26c5['operator']+'\x20');_0x4c5d4c+=_0x4e26c5[_0x693e('0x5c')][_0x12bd27][_0x693e('0x5f')]?_0x4546cc(_0x4e26c5[_0x693e('0x5c')][_0x12bd27][_0x693e('0x5f')]):_0x4e26c5['rules'][_0x12bd27]['field']+'\x20'+_0x4e26c5[_0x693e('0x5c')][_0x12bd27][_0x693e('0x61')]+(_0x252087(_0x4e26c5['rules'][_0x12bd27][_0x693e('0x61')])?'\x20'+_0x4e26c5[_0x693e('0x5c')][_0x12bd27][_0x693e('0x62')]:'');}return _0x4c5d4c+')';};var _0x11b1c4={'where':{'id':_0x390be9[_0x693e('0x4b')]['id']}},_0x4550d8,_0x439c73,_0x270a5c,_0x453d48,_0x2437e6;_0x11b1c4=_[_0x693e('0x39')]({},_0x11b1c4,_0x390be9[_0x693e('0x3a')]);return db[_0x693e('0x26')][_0x693e('0x42')](_0x11b1c4)[_0x693e('0x1c')](function(_0x2cba91){if(_0x2cba91){_0x4550d8=_0x2cba91;return _0x2cba91['getFields']();}return null;})[_0x693e('0x1c')](function(_0x1d04e4){if(_0x1d04e4){if(!_0x1d04e4[_0x693e('0x5d')]){throw new db[(_0x693e('0x63'))][(_0x693e('0x64'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x439c73=_0x1d04e4;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x693e('0x1c')](function(_0x23d5d1){if(_0x23d5d1){_0x270a5c=_['keyBy'](_0x23d5d1,'id');var _0x9c63c;var _0x5bdb45=squel[_0x693e('0x68')]();_0x5bdb45[_0x693e('0x69')](_0x4550d8[_0x693e('0x6a')]);for(var _0x3336ec=0x0;_0x3336ec<_0x439c73[_0x693e('0x5d')];_0x3336ec+=0x1){_0x9c63c=_0x439c73[_0x3336ec][_0x693e('0x6b')]?_0x270a5c[_0x439c73[_0x3336ec][_0x693e('0x6b')]][_0x693e('0x6c')]:_0x439c73[_0x3336ec][_0x693e('0x60')];_0x9c63c=_0x439c73[_0x3336ec]['function']?_[_0x693e('0x6e')](_0x56faa8[_0x439c73[_0x3336ec][_0x693e('0x6d')]],'%s',_0x9c63c):_0x9c63c;_0x9c63c=_0x439c73[_0x3336ec][_0x693e('0x6f')]?_[_0x693e('0x6e')](_0x3e519b[_0x439c73[_0x3336ec]['format']],'%s',_0x9c63c):_0x9c63c;if(_0x439c73[_0x3336ec][_0x693e('0x87')]){_0x5bdb45[_0x693e('0x5f')](_0x9c63c);}_0x439c73[_0x3336ec][_0x693e('0x70')]&&_0x5bdb45['order'](_0x9c63c,_0x439c73[_0x3336ec][_0x693e('0x70')]===_0x693e('0x71')?![]:!![]);_0x5bdb45[_0x693e('0x60')](_0x9c63c,_0x439c73[_0x3336ec]['alias']||_0x9c63c);}if(_0x4550d8[_0x693e('0x73')]){_0x4550d8[_0x693e('0x73')]=JSON[_0x693e('0x79')](_0x4550d8[_0x693e('0x73')]);for(var _0x1c0515=0x0;_0x1c0515<_0x4550d8['joins'][_0x693e('0x5d')];_0x1c0515+=0x1){if(_0x4550d8[_0x693e('0x73')][_0x1c0515][_0x693e('0x29')]&&_[_0x693e('0x58')](_0x4df7b9,_0x4550d8[_0x693e('0x73')][_0x1c0515]['type'])&&_0x4550d8[_0x693e('0x73')][_0x1c0515]['parentKey']&&_0x4550d8[_0x693e('0x73')][_0x1c0515][_0x693e('0x75')]&&_0x4550d8[_0x693e('0x73')][_0x1c0515][_0x693e('0x76')]){_0x5bdb45[_0x4550d8[_0x693e('0x73')][_0x1c0515][_0x693e('0x29')]](_0x4550d8[_0x693e('0x73')][_0x1c0515][_0x693e('0x75')],null,util[_0x693e('0x6f')]('%s.%s\x20=\x20%s.%s',_0x4550d8['table'],_0x4550d8[_0x693e('0x73')][_0x1c0515][_0x693e('0x74')],_0x4550d8['joins'][_0x1c0515][_0x693e('0x75')],_0x4550d8[_0x693e('0x73')][_0x1c0515][_0x693e('0x76')]));}}}if(_0x4550d8[_0x693e('0x78')]){_0x4550d8[_0x693e('0x78')]=JSON[_0x693e('0x79')](_0x4550d8[_0x693e('0x78')]);_0x5bdb45['where'](_0x4546cc(_0x4550d8['conditions'][_0x693e('0x5f')]));}_0x2437e6=_0x5bdb45[_0x693e('0x7a')]();_0x5bdb45[_0x693e('0x18')](_0x258574);_0x5bdb45[_0x693e('0x16')](0x0);logger['debug'](_0x693e('0x7c'),_0x5bdb45['toString']());return dbH[_0x693e('0x7e')][_0x693e('0x2c')](_0x5bdb45[_0x693e('0x7d')](),{'type':dbH['sequelize'][_0x693e('0x7f')][_0x693e('0x80')]});}})[_0x693e('0x1c')](function(){return{'sql':_0x2437e6[_0x693e('0x7d')]()};})[_0x693e('0x1c')](respondWithResult(_0x4b71e7,null))[_0x693e('0x40')](handleError(_0x4b71e7,null));}; \ No newline at end of file +var _0x8df2=['autoAssociation','UserProfileResource','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','MIN(%s)','GROUP_CONCAT(%s)','ROUND(%s)','groupBy','parse','output','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','stack','name','map','AnalyticCustomReport','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','include','findAll','rows','catch','show','rawAttributes','includeAll','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId'];(function(_0x27f7d6,_0x13fc7a){var _0x277c28=function(_0x5ac74d){while(--_0x5ac74d){_0x27f7d6['push'](_0x27f7d6['shift']());}};_0x277c28(++_0x13fc7a);}(_0x8df2,0x1b1));var _0x28df=function(_0x1c7a3c,_0x2639ac){_0x1c7a3c=_0x1c7a3c-0x0;var _0x36e66c=_0x8df2[_0x1c7a3c];return _0x36e66c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x28df('0x0'));var zipdir=require(_0x28df('0x1'));var jsonpatch=require(_0x28df('0x2'));var rp=require(_0x28df('0x3'));var moment=require('moment');var BPromise=require(_0x28df('0x4'));var Mustache=require('mustache');var util=require(_0x28df('0x5'));var path=require('path');var sox=require(_0x28df('0x6'));var csv=require(_0x28df('0x7'));var ejs=require(_0x28df('0x8'));var fs=require('fs');var fs_extra=require(_0x28df('0x9'));var _=require(_0x28df('0xa'));var squel=require(_0x28df('0xb'));var crypto=require(_0x28df('0xc'));var jsforce=require(_0x28df('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x28df('0x7'));var querystring=require(_0x28df('0xe'));var Papa=require(_0x28df('0xf'));var Redis=require(_0x28df('0x10'));var authService=require(_0x28df('0x11'));var qs=require(_0x28df('0x12'));var as=require(_0x28df('0x13'));var hardwareService=require(_0x28df('0x14'));var logger=require('../../config/logger')(_0x28df('0x15'));var utils=require(_0x28df('0x16'));var config=require(_0x28df('0x17'));var licenseUtil=require(_0x28df('0x18'));var db=require(_0x28df('0x19'))['db'];var dbH=require(_0x28df('0x19'))[_0x28df('0x1a')];function respondWithStatusCode(_0x4d5018,_0x868d34){_0x868d34=_0x868d34||0xcc;return function(_0x18fe9e){if(_0x18fe9e){return _0x4d5018[_0x28df('0x1b')](_0x868d34);}return _0x4d5018[_0x28df('0x1c')](_0x868d34)['end']();};}function respondWithResult(_0x3691bb,_0x591526){_0x591526=_0x591526||0xc8;return function(_0x27c443){if(_0x27c443){return _0x3691bb[_0x28df('0x1c')](_0x591526)[_0x28df('0x1d')](_0x27c443);}};}function respondWithFilteredResult(_0x52fa5b,_0x11a39c){return function(_0x11afb5){if(_0x11afb5){var _0x163937=typeof _0x11a39c['offset']==='undefined'&&typeof _0x11a39c[_0x28df('0x1e')]==='undefined';var _0x586bba=_0x11afb5[_0x28df('0x1f')];var _0x24af0d=_0x163937?0x0:_0x11a39c[_0x28df('0x20')];var _0x508aca=_0x163937?_0x11afb5['count']:_0x11a39c[_0x28df('0x20')]+_0x11a39c[_0x28df('0x1e')];var _0x2a066b;if(_0x508aca>=_0x586bba){_0x508aca=_0x586bba;_0x2a066b=0xc8;}else{_0x2a066b=0xce;}_0x52fa5b[_0x28df('0x1c')](_0x2a066b);return _0x52fa5b[_0x28df('0x21')](_0x28df('0x22'),_0x24af0d+'-'+_0x508aca+'/'+_0x586bba)[_0x28df('0x1d')](_0x11afb5);}return null;};}function patchUpdates(_0x3230c1){return function(_0x6d8934){try{jsonpatch[_0x28df('0x23')](_0x6d8934,_0x3230c1,!![]);}catch(_0x2d3b01){return BPromise[_0x28df('0x24')](_0x2d3b01);}return _0x6d8934[_0x28df('0x25')]();};}function saveUpdates(_0xd9facc,_0x4ee7c3){return function(_0x2c8975){if(_0x2c8975){return _0x2c8975[_0x28df('0x26')](_0xd9facc)[_0x28df('0x27')](function(_0x5d46cf){return _0x5d46cf;});}return null;};}function removeEntity(_0x239f6d,_0x950856){return function(_0x141152){if(_0x141152){return _0x141152[_0x28df('0x28')]()[_0x28df('0x27')](function(){var _0x659ed0=_0x141152[_0x28df('0x29')]({'plain':!![]});var _0x227750='CustomReports';return db['UserProfileResource'][_0x28df('0x28')]({'where':{'type':_0x227750,'resourceId':_0x659ed0['id']}})[_0x28df('0x27')](function(){return _0x141152;});})[_0x28df('0x27')](function(){_0x239f6d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc04899,_0x680ca6){return function(_0x2489a5){if(!_0x2489a5){_0xc04899[_0x28df('0x1b')](0x194);}return _0x2489a5;};}function handleError(_0x205c95,_0x3b6328){_0x3b6328=_0x3b6328||0x1f4;return function(_0x289a12){logger['error'](_0x289a12[_0x28df('0x2a')]);if(_0x289a12[_0x28df('0x2b')]){delete _0x289a12[_0x28df('0x2b')];}_0x205c95['status'](_0x3b6328)['send'](_0x289a12);};}exports['index']=function(_0x171e12,_0x3f8748){var _0xca07d0={},_0x47fc26={},_0x472074={'count':0x0,'rows':[]};var _0x3493d2=_[_0x28df('0x2c')](db[_0x28df('0x2d')]['rawAttributes'],function(_0x384ac6){return{'name':_0x384ac6[_0x28df('0x2e')],'type':_0x384ac6[_0x28df('0x2f')][_0x28df('0x30')]};});_0x47fc26['model']=_[_0x28df('0x2c')](_0x3493d2,_0x28df('0x2b'));_0x47fc26[_0x28df('0x31')]=_[_0x28df('0x32')](_0x171e12[_0x28df('0x31')]);_0x47fc26['filters']=_['intersection'](_0x47fc26[_0x28df('0x33')],_0x47fc26[_0x28df('0x31')]);_0xca07d0[_0x28df('0x34')]=_[_0x28df('0x35')](_0x47fc26[_0x28df('0x33')],qs[_0x28df('0x36')](_0x171e12[_0x28df('0x31')][_0x28df('0x36')]));_0xca07d0['attributes']=_0xca07d0[_0x28df('0x34')][_0x28df('0x37')]?_0xca07d0['attributes']:_0x47fc26['model'];if(!_0x171e12[_0x28df('0x31')][_0x28df('0x38')](_0x28df('0x39'))){_0xca07d0[_0x28df('0x1e')]=qs['limit'](_0x171e12[_0x28df('0x31')]['limit']);_0xca07d0[_0x28df('0x20')]=qs[_0x28df('0x20')](_0x171e12[_0x28df('0x31')][_0x28df('0x20')]);}_0xca07d0[_0x28df('0x3a')]=qs[_0x28df('0x3b')](_0x171e12[_0x28df('0x31')][_0x28df('0x3b')]);_0xca07d0[_0x28df('0x3c')]=qs[_0x28df('0x3d')](_['pick'](_0x171e12[_0x28df('0x31')],_0x47fc26[_0x28df('0x3d')]),_0x3493d2);if(_0x171e12[_0x28df('0x31')][_0x28df('0x3e')]){_0xca07d0[_0x28df('0x3c')]=_['merge'](_0xca07d0[_0x28df('0x3c')],{'$or':_['map'](_0x3493d2,function(_0x12fb78){if(_0x12fb78['type']!==_0x28df('0x3f')){var _0x36b38b={};_0x36b38b[_0x12fb78[_0x28df('0x2b')]]={'$like':'%'+_0x171e12[_0x28df('0x31')][_0x28df('0x3e')]+'%'};return _0x36b38b;}})});}_0xca07d0=_['merge']({},_0xca07d0,_0x171e12['options']);var _0x29f573={'where':_0xca07d0[_0x28df('0x3c')]};return db[_0x28df('0x2d')]['count'](_0x29f573)[_0x28df('0x27')](function(_0x4dd28d){_0x472074[_0x28df('0x1f')]=_0x4dd28d;if(_0x171e12[_0x28df('0x31')]['includeAll']){_0xca07d0[_0x28df('0x40')]=[{'all':!![]}];}return db[_0x28df('0x2d')][_0x28df('0x41')](_0xca07d0);})[_0x28df('0x27')](function(_0x2cc300){_0x472074[_0x28df('0x42')]=_0x2cc300;return _0x472074;})[_0x28df('0x27')](respondWithFilteredResult(_0x3f8748,_0xca07d0))[_0x28df('0x43')](handleError(_0x3f8748,null));};exports[_0x28df('0x44')]=function(_0x45b268,_0x5edef1){var _0xc257ca={'raw':![],'where':{'id':_0x45b268['params']['id']}},_0x175344={};_0x175344['model']=_[_0x28df('0x32')](db[_0x28df('0x2d')][_0x28df('0x45')]);_0x175344[_0x28df('0x31')]=_[_0x28df('0x32')](_0x45b268[_0x28df('0x31')]);_0x175344['filters']=_['intersection'](_0x175344[_0x28df('0x33')],_0x175344[_0x28df('0x31')]);_0xc257ca['attributes']=_[_0x28df('0x35')](_0x175344['model'],qs[_0x28df('0x36')](_0x45b268[_0x28df('0x31')][_0x28df('0x36')]));_0xc257ca['attributes']=_0xc257ca[_0x28df('0x34')][_0x28df('0x37')]?_0xc257ca[_0x28df('0x34')]:_0x175344['model'];if(_0x45b268[_0x28df('0x31')][_0x28df('0x46')]){_0xc257ca[_0x28df('0x40')]=[{'all':!![]}];}_0xc257ca=_['merge']({},_0xc257ca,_0x45b268[_0x28df('0x47')]);return db[_0x28df('0x2d')][_0x28df('0x48')](_0xc257ca)[_0x28df('0x27')](handleEntityNotFound(_0x5edef1,null))[_0x28df('0x27')](respondWithResult(_0x5edef1,null))[_0x28df('0x43')](handleError(_0x5edef1,null));};exports[_0x28df('0x49')]=function(_0x14eca4,_0x39647a){return db['AnalyticCustomReport'][_0x28df('0x49')](_0x14eca4['body'],{})[_0x28df('0x27')](function(_0x10aced){var _0x3e8ea5=_0x14eca4[_0x28df('0x4a')][_0x28df('0x29')]({'plain':!![]});if(!_0x3e8ea5)throw new Error(_0x28df('0x4b'));if(_0x3e8ea5[_0x28df('0x4c')]===_0x28df('0x4a')){var _0x2e2782=_0x10aced[_0x28df('0x29')]({'plain':!![]});var _0x4ffb0b=_0x28df('0x4d');return db[_0x28df('0x4e')][_0x28df('0x48')]({'where':{'name':_0x4ffb0b,'userProfileId':_0x3e8ea5[_0x28df('0x4f')]},'raw':!![]})[_0x28df('0x27')](function(_0x740dc8){if(_0x740dc8&&_0x740dc8[_0x28df('0x50')]===0x0){return db[_0x28df('0x51')][_0x28df('0x49')]({'name':_0x2e2782[_0x28df('0x2b')],'resourceId':_0x2e2782['id'],'type':_0x28df('0x52'),'sectionId':_0x740dc8['id']},{})[_0x28df('0x27')](function(){return _0x10aced;});}else{return _0x10aced;}})[_0x28df('0x43')](function(_0x4285ce){logger[_0x28df('0x53')](_0x28df('0x54'),_0x4285ce);throw _0x4285ce;});}return _0x10aced;})['then'](respondWithResult(_0x39647a,0xc9))[_0x28df('0x43')](handleError(_0x39647a,null));};exports[_0x28df('0x26')]=function(_0x20acdc,_0x130cf0){if(_0x20acdc[_0x28df('0x55')]['id']){delete _0x20acdc[_0x28df('0x55')]['id'];}return db[_0x28df('0x2d')][_0x28df('0x48')]({'where':{'id':_0x20acdc[_0x28df('0x56')]['id']}})[_0x28df('0x27')](handleEntityNotFound(_0x130cf0,null))[_0x28df('0x27')](saveUpdates(_0x20acdc[_0x28df('0x55')],null))['then'](respondWithResult(_0x130cf0,null))[_0x28df('0x43')](handleError(_0x130cf0,null));};exports[_0x28df('0x28')]=function(_0x588a8c,_0x37ecac){return db[_0x28df('0x2d')][_0x28df('0x48')]({'where':{'id':_0x588a8c[_0x28df('0x56')]['id']}})[_0x28df('0x27')](handleEntityNotFound(_0x37ecac,null))['then'](removeEntity(_0x37ecac,null))[_0x28df('0x43')](handleError(_0x37ecac,null));};exports[_0x28df('0x57')]=function(_0x15d5dc,_0x13740e){var _0x1a5577=0xa;var _0x55e472=[_0x28df('0x58'),_0x28df('0x59'),_0x28df('0x5a'),_0x28df('0x5b')];var _0x494c8f={'SUM':_0x28df('0x5c'),'COUNT':_0x28df('0x5d'),'COUNT DISTINCT':_0x28df('0x5e'),'MAX':_0x28df('0x5f'),'MIN':'MIN(%s)','AVG':_0x28df('0x60'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x28df('0x61')};var _0x4068b5={'SEC_TO_TIME':_0x28df('0x62'),'DATE':_0x28df('0x63'),'HOUR':_0x28df('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x28df('0x65')};var _0x57cb04=function(_0x500a0f){return!_[_0x28df('0x66')]([_0x28df('0x67'),_0x28df('0x68'),_0x28df('0x69'),_0x28df('0x6a')],_0x500a0f);};var _0xce011a=function(_0x2f7e6a){if(!_0x2f7e6a||!_0x2f7e6a[_0x28df('0x6b')][_0x28df('0x37')]){return'';}for(var _0x315039='(',_0x10db1e=0x0;_0x10db1e<_0x2f7e6a[_0x28df('0x6b')]['length'];_0x10db1e+=0x1){_0x10db1e>0x0&&(_0x315039+='\x20'+_0x2f7e6a[_0x28df('0x6c')]+'\x20');_0x315039+=_0x2f7e6a[_0x28df('0x6b')][_0x10db1e]['group']?_0xce011a(_0x2f7e6a[_0x28df('0x6b')][_0x10db1e][_0x28df('0x6d')]):_0x2f7e6a[_0x28df('0x6b')][_0x10db1e][_0x28df('0x6e')]+'\x20'+_0x2f7e6a[_0x28df('0x6b')][_0x10db1e]['condition']+(_0x57cb04(_0x2f7e6a[_0x28df('0x6b')][_0x10db1e][_0x28df('0x6f')])?'\x20'+_0x2f7e6a[_0x28df('0x6b')][_0x10db1e][_0x28df('0x70')]:'');}return _0x315039+')';};var _0x34b224={'where':{'id':_0x15d5dc[_0x28df('0x56')]['id']}},_0x1fc504,_0x2bf6af,_0x273f7e,_0x5c743d,_0x10ce25;_0x34b224=_[_0x28df('0x71')]({},_0x34b224,_0x15d5dc[_0x28df('0x47')]);return db[_0x28df('0x2d')][_0x28df('0x48')](_0x34b224)[_0x28df('0x27')](function(_0x32e654){if(_0x32e654){_0x1fc504=_0x32e654;return _0x32e654[_0x28df('0x72')]();}return null;})[_0x28df('0x27')](function(_0x482414){if(_0x482414){if(!_0x482414['length']){throw new db[(_0x28df('0x73'))][(_0x28df('0x74'))](_0x28df('0x75'),0x193);}_0x2bf6af=_0x482414;return db[_0x28df('0x76')][_0x28df('0x41')]({'raw':!![]});}return null;})[_0x28df('0x27')](function(_0x33fa17){if(_0x33fa17){_0x273f7e=_[_0x28df('0x77')](_0x33fa17,'id');var _0x5cebcb;var _0x4416ed=squel[_0x28df('0x78')]();_0x4416ed[_0x28df('0x79')](_0x1fc504[_0x28df('0x7a')]);for(var _0x254945=0x0;_0x254945<_0x2bf6af[_0x28df('0x37')];_0x254945+=0x1){_0x5cebcb=_0x2bf6af[_0x254945][_0x28df('0x7b')]?_0x273f7e[_0x2bf6af[_0x254945][_0x28df('0x7b')]][_0x28df('0x7c')]:_0x2bf6af[_0x254945][_0x28df('0x6e')];_0x5cebcb=_0x2bf6af[_0x254945][_0x28df('0x7d')]?_[_0x28df('0x7e')](_0x494c8f[_0x2bf6af[_0x254945]['function']],'%s',_0x5cebcb):_0x5cebcb;_0x5cebcb=_0x2bf6af[_0x254945][_0x28df('0x7f')]?_[_0x28df('0x7e')](_0x4068b5[_0x2bf6af[_0x254945]['format']],'%s',_0x5cebcb):_0x5cebcb;if(_0x2bf6af[_0x254945]['groupBy']){_0x4416ed[_0x28df('0x6d')](_0x5cebcb);}_0x2bf6af[_0x254945][_0x28df('0x80')]&&_0x4416ed[_0x28df('0x3a')](_0x5cebcb,_0x2bf6af[_0x254945]['orderBy']===_0x28df('0x81')?![]:!![]);_0x4416ed[_0x28df('0x6e')](_0x5cebcb,_0x2bf6af[_0x254945][_0x28df('0x82')]||_0x5cebcb);}if(_0x1fc504[_0x28df('0x83')]){_0x1fc504['joins']=JSON['parse'](_0x1fc504[_0x28df('0x83')]);for(var _0x266f89=0x0;_0x266f89<_0x1fc504[_0x28df('0x83')][_0x28df('0x37')];_0x266f89+=0x1){if(_0x1fc504[_0x28df('0x83')][_0x266f89]['type']&&_[_0x28df('0x66')](_0x55e472,_0x1fc504[_0x28df('0x83')][_0x266f89][_0x28df('0x2f')])&&_0x1fc504[_0x28df('0x83')][_0x266f89]['parentKey']&&_0x1fc504[_0x28df('0x83')][_0x266f89][_0x28df('0x84')]&&_0x1fc504['joins'][_0x266f89][_0x28df('0x85')]){_0x4416ed[_0x1fc504[_0x28df('0x83')][_0x266f89]['type']](_0x1fc504[_0x28df('0x83')][_0x266f89]['foreignTable'],null,util['format'](_0x28df('0x86'),_0x1fc504[_0x28df('0x7a')],_0x1fc504[_0x28df('0x83')][_0x266f89][_0x28df('0x87')],_0x1fc504['joins'][_0x266f89][_0x28df('0x84')],_0x1fc504[_0x28df('0x83')][_0x266f89][_0x28df('0x85')]));}}}if(_0x1fc504[_0x28df('0x88')]){_0x1fc504[_0x28df('0x88')]=JSON['parse'](_0x1fc504[_0x28df('0x88')]);_0x4416ed[_0x28df('0x3c')](_0xce011a(_0x1fc504[_0x28df('0x88')]['group']));}_0x10ce25=_0x4416ed[_0x28df('0x89')]();_0x4416ed[_0x28df('0x1e')](_0x1a5577);_0x4416ed['offset'](0x0);logger[_0x28df('0x8a')](_0x28df('0x8b'),_0x4416ed['toString']());return dbH['sequelize'][_0x28df('0x31')](_0x4416ed['toString'](),{'type':dbH[_0x28df('0x8c')][_0x28df('0x8d')][_0x28df('0x8e')]});}})[_0x28df('0x27')](respondWithResult(_0x13740e,null))[_0x28df('0x43')](handleError(_0x13740e,null));};function runReport(_0x54c2d3,_0x48d0d2,_0x1ef0d2){var _0xa6f466=_0x48d0d2['name'];var _0xff79de=0xa;var _0x36e98d=['join',_0x28df('0x59'),_0x28df('0x5a'),_0x28df('0x5b')];var _0x4e97fa={'SUM':'SUM(%s)','COUNT':_0x28df('0x5d'),'COUNT DISTINCT':_0x28df('0x5e'),'MAX':'MAX(%s)','MIN':_0x28df('0x8f'),'AVG':_0x28df('0x60'),'GROUP_CONCAT':_0x28df('0x90'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x28df('0x61')};var _0x4a84c9={'SEC_TO_TIME':_0x28df('0x62'),'DATE':_0x28df('0x63'),'HOUR':_0x28df('0x64'),'ROUND':_0x28df('0x91'),'UNIX_TIMESTAMP':_0x28df('0x65')};var _0x496862=function(_0x2724e0){return!_['includes'](['IS\x20NULL',_0x28df('0x68'),_0x28df('0x69'),_0x28df('0x6a')],_0x2724e0);};var _0x5cdede=function(_0x4df21a){if(!_0x4df21a||!_0x4df21a['rules'][_0x28df('0x37')]){return'';}for(var _0x3bef0b='(',_0x3bf87d=0x0;_0x3bf87d<_0x4df21a['rules'][_0x28df('0x37')];_0x3bf87d+=0x1){_0x3bf87d>0x0&&(_0x3bef0b+='\x20'+_0x4df21a['operator']+'\x20');_0x3bef0b+=_0x4df21a['rules'][_0x3bf87d][_0x28df('0x6d')]?_0x5cdede(_0x4df21a[_0x28df('0x6b')][_0x3bf87d][_0x28df('0x6d')]):_0x4df21a[_0x28df('0x6b')][_0x3bf87d][_0x28df('0x6e')]+'\x20'+_0x4df21a[_0x28df('0x6b')][_0x3bf87d]['condition']+(_0x496862(_0x4df21a['rules'][_0x3bf87d][_0x28df('0x6f')])?'\x20'+_0x4df21a[_0x28df('0x6b')][_0x3bf87d]['value']:'');}return _0x3bef0b+')';};var _0x42b864={'where':{'id':_0x54c2d3['id']}},_0x4cdd56,_0x314bcb,_0x2aa012,_0x2d5a06,_0x2591fd;_0x42b864=_[_0x28df('0x71')]({},_0x42b864,_0x1ef0d2);return db[_0x28df('0x2d')][_0x28df('0x48')](_0x42b864)[_0x28df('0x27')](function(_0x2ee437){if(_0x2ee437){_0x4cdd56=_0x2ee437;return _0x2ee437[_0x28df('0x72')]();}return null;})[_0x28df('0x27')](function(_0x3e099a){if(_0x3e099a){if(!_0x3e099a[_0x28df('0x37')]){throw new db[(_0x28df('0x73'))][(_0x28df('0x74'))](_0x28df('0x75'),0x193);}_0x314bcb=_0x3e099a;return db[_0x28df('0x76')]['findAll']({'raw':!![]});}return null;})[_0x28df('0x27')](function(_0x249262){if(_0x249262){_0x2aa012=_[_0x28df('0x77')](_0x249262,'id');var _0x190863;var _0x2aedc3=squel[_0x28df('0x78')]();_0x2aedc3[_0x28df('0x79')](_0x4cdd56[_0x28df('0x7a')]);for(var _0x3189bd=0x0;_0x3189bd<_0x314bcb['length'];_0x3189bd+=0x1){_0x190863=_0x314bcb[_0x3189bd][_0x28df('0x7b')]?_0x2aa012[_0x314bcb[_0x3189bd][_0x28df('0x7b')]][_0x28df('0x7c')]:_0x314bcb[_0x3189bd][_0x28df('0x6e')];_0x190863=_0x314bcb[_0x3189bd][_0x28df('0x7d')]?_[_0x28df('0x7e')](_0x4e97fa[_0x314bcb[_0x3189bd]['function']],'%s',_0x190863):_0x190863;_0x190863=_0x314bcb[_0x3189bd][_0x28df('0x7f')]?_[_0x28df('0x7e')](_0x4a84c9[_0x314bcb[_0x3189bd][_0x28df('0x7f')]],'%s',_0x190863):_0x190863;if(_0x314bcb[_0x3189bd][_0x28df('0x92')]){_0x2aedc3[_0x28df('0x6d')](_0x190863);}_0x314bcb[_0x3189bd][_0x28df('0x80')]&&_0x2aedc3[_0x28df('0x3a')](_0x190863,_0x314bcb[_0x3189bd][_0x28df('0x80')]==='DESC'?![]:!![]);_0x2aedc3[_0x28df('0x6e')](_0x190863,_0x314bcb[_0x3189bd]['alias']||_0x190863);}if(_0x4cdd56[_0x28df('0x83')]){_0x4cdd56[_0x28df('0x83')]=JSON[_0x28df('0x93')](_0x4cdd56['joins']);for(var _0x5c76a5=0x0;_0x5c76a5<_0x4cdd56[_0x28df('0x83')][_0x28df('0x37')];_0x5c76a5+=0x1){if(_0x4cdd56['joins'][_0x5c76a5][_0x28df('0x2f')]&&_[_0x28df('0x66')](_0x36e98d,_0x4cdd56[_0x28df('0x83')][_0x5c76a5][_0x28df('0x2f')])&&_0x4cdd56[_0x28df('0x83')][_0x5c76a5][_0x28df('0x87')]&&_0x4cdd56['joins'][_0x5c76a5][_0x28df('0x84')]&&_0x4cdd56[_0x28df('0x83')][_0x5c76a5][_0x28df('0x85')]){_0x2aedc3[_0x4cdd56['joins'][_0x5c76a5][_0x28df('0x2f')]](_0x4cdd56['joins'][_0x5c76a5]['foreignTable'],null,util[_0x28df('0x7f')](_0x28df('0x86'),_0x4cdd56[_0x28df('0x7a')],_0x4cdd56['joins'][_0x5c76a5][_0x28df('0x87')],_0x4cdd56[_0x28df('0x83')][_0x5c76a5]['foreignTable'],_0x4cdd56['joins'][_0x5c76a5][_0x28df('0x85')]));}}}if(_0x4cdd56['conditions']){_0x4cdd56[_0x28df('0x88')]=JSON[_0x28df('0x93')](_0x4cdd56[_0x28df('0x88')]);_0x2aedc3['where'](_0x5cdede(_0x4cdd56[_0x28df('0x88')][_0x28df('0x6d')]));}_0x2591fd=_0x2aedc3[_0x28df('0x89')]();_0x2aedc3[_0x28df('0x1e')](_0xff79de);_0x2aedc3[_0x28df('0x20')](0x0);return;}})['then'](function(){if(_0x48d0d2[_0x28df('0x94')]==='web'){return null;}var _0x568860=_[_0x28df('0x71')](_0x48d0d2,{'name':_0x48d0d2['fullPath']||_0x48d0d2[_0x28df('0x2b')]||_0x4cdd56[_0x28df('0x2b')],'basename':_0xa6f466,'savename':util['format'](_0x28df('0x95'),_0x48d0d2[_0x28df('0x2b')]||_0x4cdd56['name'],require(_0x28df('0x96'))[_0x28df('0x97')](0x4),_0x48d0d2['output']||_0x28df('0x98')),'reportId':_0x4cdd56['id'],'reportType':_0x28df('0x99')});return db['AnalyticExtractedReport'][_0x28df('0x49')](_0x568860,{'raw':!![]});})[_0x28df('0x27')](function(_0x3e490b){if(_0x4cdd56[_0x28df('0x7a')]===_0x28df('0x9a')){_0x2591fd['where'](_0x4cdd56['table']+_0x28df('0x9b'),_0x48d0d2[_0x28df('0x9c')],_0x48d0d2[_0x28df('0x9d')]);}else{_0x2591fd[_0x28df('0x3c')](_0x4cdd56['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x48d0d2['startDate'],_0x48d0d2[_0x28df('0x9d')]);}if(_0x3e490b){logger[_0x28df('0x9e')](_0x28df('0x9f'),_0x2591fd[_0x28df('0xa0')]());require(_0x28df('0xa1'))[_0x28df('0xa2')](path['join'](__dirname,_0x28df('0xa3'),_0x3e490b[_0x28df('0x94')]),[_0x3e490b['id'],_0x2591fd[_0x28df('0xa0')](),path[_0x28df('0x58')](__dirname,_0x28df('0xa4'),_0x3e490b[_0x28df('0xa5')]),_0xa6f466]);return _0x3e490b;}else{var _0x4c8663=squel[_0x28df('0x78')]();_0x4c8663[_0x28df('0x79')]('('+_0x2591fd[_0x28df('0xa0')]()+')',_0x28df('0xa6'));_0x4c8663[_0x28df('0x6e')](_0x28df('0xa7'),_0x28df('0x1f'));_0x2591fd[_0x28df('0x1e')](_0x48d0d2[_0x28df('0x1e')]||_0xff79de);_0x2591fd[_0x28df('0x20')](_0x48d0d2[_0x28df('0x20')]||0x0);return dbH['sequelize'][_0x28df('0x31')](_0x4c8663['toString'](),{'type':dbH[_0x28df('0x8c')][_0x28df('0x8d')]['SELECT']})[_0x28df('0x27')](function(_0x4afb26){if(!_0x4afb26[_0x28df('0x37')]){_0x2d5a06=0x0;}else{_0x2d5a06=_0x4afb26[0x0][_0x28df('0x1f')]||0x0;}return dbH[_0x28df('0x8c')][_0x28df('0x31')](_0x2591fd[_0x28df('0xa0')](),{'type':dbH[_0x28df('0x8c')][_0x28df('0x8d')][_0x28df('0x8e')]});})['then'](function(_0x23414b){return{'rows':_0x23414b||[],'count':_0x2d5a06};});}});}exports[_0x28df('0xa8')]=function(_0xc2c98e,_0x4fc20a){return runReport(_0xc2c98e[_0x28df('0x56')],_0xc2c98e[_0x28df('0x31')],_0xc2c98e[_0x28df('0x47')])['then'](respondWithResult(_0x4fc20a,null))[_0x28df('0x43')](handleError(_0x4fc20a,null));};exports[_0x28df('0xa9')]=runReport;exports['query']=function(_0x142729,_0x548575){var _0x510e70=0xa;var _0xe552=[_0x28df('0x58'),_0x28df('0x59'),_0x28df('0x5a'),_0x28df('0x5b')];var _0x54b711={'SUM':_0x28df('0x5c'),'COUNT':_0x28df('0x5d'),'COUNT DISTINCT':_0x28df('0x5e'),'MAX':_0x28df('0x5f'),'MIN':_0x28df('0x8f'),'AVG':_0x28df('0x60'),'GROUP_CONCAT':_0x28df('0x90'),'GROUP_CONCAT ASC':_0x28df('0xaa'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x412642={'SEC_TO_TIME':_0x28df('0x62'),'DATE':_0x28df('0x63'),'HOUR':_0x28df('0x64'),'ROUND':_0x28df('0x91'),'UNIX_TIMESTAMP':_0x28df('0x65')};var _0x5b66ec=function(_0x2d35df){return!_['includes']([_0x28df('0x67'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x28df('0x6a')],_0x2d35df);};var _0xba2728=function(_0x2dbd90){if(!_0x2dbd90||!_0x2dbd90[_0x28df('0x6b')][_0x28df('0x37')]){return'';}for(var _0x1a66be='(',_0x4381f6=0x0;_0x4381f6<_0x2dbd90['rules'][_0x28df('0x37')];_0x4381f6+=0x1){_0x4381f6>0x0&&(_0x1a66be+='\x20'+_0x2dbd90[_0x28df('0x6c')]+'\x20');_0x1a66be+=_0x2dbd90[_0x28df('0x6b')][_0x4381f6]['group']?_0xba2728(_0x2dbd90[_0x28df('0x6b')][_0x4381f6][_0x28df('0x6d')]):_0x2dbd90[_0x28df('0x6b')][_0x4381f6][_0x28df('0x6e')]+'\x20'+_0x2dbd90[_0x28df('0x6b')][_0x4381f6][_0x28df('0x6f')]+(_0x5b66ec(_0x2dbd90[_0x28df('0x6b')][_0x4381f6][_0x28df('0x6f')])?'\x20'+_0x2dbd90[_0x28df('0x6b')][_0x4381f6][_0x28df('0x70')]:'');}return _0x1a66be+')';};var _0x483180={'where':{'id':_0x142729['params']['id']}},_0x2ceae9,_0x32909f,_0x32b8e1,_0x3f581c,_0x218c71;_0x483180=_[_0x28df('0x71')]({},_0x483180,_0x142729[_0x28df('0x47')]);return db['AnalyticCustomReport'][_0x28df('0x48')](_0x483180)['then'](function(_0x2cd16a){if(_0x2cd16a){_0x2ceae9=_0x2cd16a;return _0x2cd16a[_0x28df('0x72')]();}return null;})[_0x28df('0x27')](function(_0x29dac9){if(_0x29dac9){if(!_0x29dac9[_0x28df('0x37')]){throw new db['Sequelize'][(_0x28df('0x74'))](_0x28df('0x75'),0x193);}_0x32909f=_0x29dac9;return db[_0x28df('0x76')][_0x28df('0x41')]({'raw':!![]});}return null;})[_0x28df('0x27')](function(_0x4559d7){if(_0x4559d7){_0x32b8e1=_[_0x28df('0x77')](_0x4559d7,'id');var _0x99f4d0;var _0x2d90d0=squel[_0x28df('0x78')]();_0x2d90d0[_0x28df('0x79')](_0x2ceae9['table']);for(var _0x446a49=0x0;_0x446a49<_0x32909f[_0x28df('0x37')];_0x446a49+=0x1){_0x99f4d0=_0x32909f[_0x446a49][_0x28df('0x7b')]?_0x32b8e1[_0x32909f[_0x446a49][_0x28df('0x7b')]]['metric']:_0x32909f[_0x446a49][_0x28df('0x6e')];_0x99f4d0=_0x32909f[_0x446a49][_0x28df('0x7d')]?_[_0x28df('0x7e')](_0x54b711[_0x32909f[_0x446a49][_0x28df('0x7d')]],'%s',_0x99f4d0):_0x99f4d0;_0x99f4d0=_0x32909f[_0x446a49]['format']?_['replace'](_0x412642[_0x32909f[_0x446a49][_0x28df('0x7f')]],'%s',_0x99f4d0):_0x99f4d0;if(_0x32909f[_0x446a49]['groupBy']){_0x2d90d0[_0x28df('0x6d')](_0x99f4d0);}_0x32909f[_0x446a49][_0x28df('0x80')]&&_0x2d90d0[_0x28df('0x3a')](_0x99f4d0,_0x32909f[_0x446a49]['orderBy']===_0x28df('0x81')?![]:!![]);_0x2d90d0[_0x28df('0x6e')](_0x99f4d0,_0x32909f[_0x446a49][_0x28df('0x82')]||_0x99f4d0);}if(_0x2ceae9[_0x28df('0x83')]){_0x2ceae9[_0x28df('0x83')]=JSON[_0x28df('0x93')](_0x2ceae9[_0x28df('0x83')]);for(var _0x428030=0x0;_0x428030<_0x2ceae9['joins'][_0x28df('0x37')];_0x428030+=0x1){if(_0x2ceae9['joins'][_0x428030][_0x28df('0x2f')]&&_[_0x28df('0x66')](_0xe552,_0x2ceae9[_0x28df('0x83')][_0x428030][_0x28df('0x2f')])&&_0x2ceae9['joins'][_0x428030][_0x28df('0x87')]&&_0x2ceae9['joins'][_0x428030][_0x28df('0x84')]&&_0x2ceae9['joins'][_0x428030][_0x28df('0x85')]){_0x2d90d0[_0x2ceae9['joins'][_0x428030][_0x28df('0x2f')]](_0x2ceae9['joins'][_0x428030][_0x28df('0x84')],null,util[_0x28df('0x7f')](_0x28df('0x86'),_0x2ceae9['table'],_0x2ceae9[_0x28df('0x83')][_0x428030]['parentKey'],_0x2ceae9[_0x28df('0x83')][_0x428030]['foreignTable'],_0x2ceae9[_0x28df('0x83')][_0x428030][_0x28df('0x85')]));}}}if(_0x2ceae9[_0x28df('0x88')]){_0x2ceae9[_0x28df('0x88')]=JSON[_0x28df('0x93')](_0x2ceae9[_0x28df('0x88')]);_0x2d90d0[_0x28df('0x3c')](_0xba2728(_0x2ceae9[_0x28df('0x88')][_0x28df('0x6d')]));}_0x218c71=_0x2d90d0[_0x28df('0x89')]();_0x2d90d0[_0x28df('0x1e')](_0x510e70);_0x2d90d0[_0x28df('0x20')](0x0);logger['debug'](_0x28df('0x8b'),_0x2d90d0['toString']());return dbH['sequelize'][_0x28df('0x31')](_0x2d90d0['toString'](),{'type':dbH[_0x28df('0x8c')][_0x28df('0x8d')][_0x28df('0x8e')]});}})[_0x28df('0x27')](function(){return{'sql':_0x218c71[_0x28df('0xa0')]()};})[_0x28df('0x27')](respondWithResult(_0x548575,null))[_0x28df('0x43')](handleError(_0x548575,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 7c0dd26..c693945 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 _0x2954=['define','AnalyticCustomReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2954,0xab));var _0x4295=function(_0x3ceb54,_0x5bddfd){_0x3ceb54=_0x3ceb54-0x0;var _0x26d8a6=_0x2954[_0x3ceb54];return _0x26d8a6;};'use strict';var _=require(_0x4295('0x0'));var util=require(_0x4295('0x1'));var logger=require('../../config/logger')(_0x4295('0x2'));var moment=require(_0x4295('0x3'));var BPromise=require(_0x4295('0x4'));var rp=require(_0x4295('0x5'));var fs=require('fs');var path=require(_0x4295('0x6'));var rimraf=require(_0x4295('0x7'));var config=require(_0x4295('0x8'));var attributes=require(_0x4295('0x9'));module[_0x4295('0xa')]=function(_0x1f626c,_0x22c005){return _0x1f626c[_0x4295('0xb')](_0x4295('0xc'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba89=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment','request-promise'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xba89,0x193));var _0x9ba8=function(_0x3f017a,_0x24ba1f){_0x3f017a=_0x3f017a-0x0;var _0x172281=_0xba89[_0x3f017a];return _0x172281;};'use strict';var _=require(_0x9ba8('0x0'));var util=require(_0x9ba8('0x1'));var logger=require('../../config/logger')(_0x9ba8('0x2'));var moment=require(_0x9ba8('0x3'));var BPromise=require('bluebird');var rp=require(_0x9ba8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ba8('0x5'));var config=require(_0x9ba8('0x6'));var attributes=require(_0x9ba8('0x7'));module[_0x9ba8('0x8')]=function(_0x97113f,_0x35950b){return _0x97113f[_0x9ba8('0x9')](_0x9ba8('0xa'),attributes,{'tableName':_0x9ba8('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index df5c7db..96250fd 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 _0x5940=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util'];(function(_0x4b5c84,_0x10f9e0){var _0x46bb23=function(_0x24f329){while(--_0x24f329){_0x4b5c84['push'](_0x4b5c84['shift']());}};_0x46bb23(++_0x10f9e0);}(_0x5940,0x14f));var _0x0594=function(_0x80c82f,_0x3a403d){_0x80c82f=_0x80c82f-0x0;var _0x42eaaa=_0x5940[_0x80c82f];return _0x42eaaa;};'use strict';var _=require('lodash');var util=require(_0x0594('0x0'));var moment=require(_0x0594('0x1'));var BPromise=require(_0x0594('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0594('0x3'));var db=require(_0x0594('0x4'))['db'];var utils=require(_0x0594('0x5'));var logger=require(_0x0594('0x6'))(_0x0594('0x7'));var config=require(_0x0594('0x8'));var jayson=require(_0x0594('0x9'));var client=jayson[_0x0594('0xa')][_0x0594('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4134c7,_0x41c7cc,_0x2e683b){return new BPromise(function(_0x1c38cc,_0x9d0262){return client['request'](_0x4134c7,_0x2e683b)['then'](function(_0x474aca){logger[_0x0594('0xc')](_0x0594('0xd'),_0x41c7cc,_0x0594('0xe'));logger[_0x0594('0xf')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x41c7cc,_0x0594('0xe'),JSON[_0x0594('0x10')](_0x474aca));if(_0x474aca[_0x0594('0x11')]){if(_0x474aca['error'][_0x0594('0x12')]===0x1f4){logger[_0x0594('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x41c7cc,_0x474aca[_0x0594('0x11')][_0x0594('0x13')]);return _0x9d0262(_0x474aca['error'][_0x0594('0x13')]);}logger['error'](_0x0594('0xd'),_0x41c7cc,_0x474aca['error']['message']);return _0x1c38cc(_0x474aca[_0x0594('0x11')]['message']);}else{logger[_0x0594('0xc')](_0x0594('0xd'),_0x41c7cc,_0x0594('0xe'));_0x1c38cc(_0x474aca[_0x0594('0x14')][_0x0594('0x13')]);}})['catch'](function(_0x19d632){logger['error'](_0x0594('0xd'),_0x41c7cc,_0x19d632);_0x9d0262(_0x19d632);});});} \ No newline at end of file +var _0xa45b=['http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa45b,0x19d));var _0xba45=function(_0x37de20,_0x742c09){_0x37de20=_0x37de20-0x0;var _0xa5b52e=_0xa45b[_0x37de20];return _0xa5b52e;};'use strict';var _=require(_0xba45('0x0'));var util=require(_0xba45('0x1'));var moment=require(_0xba45('0x2'));var BPromise=require(_0xba45('0x3'));var rs=require(_0xba45('0x4'));var fs=require('fs');var Redis=require(_0xba45('0x5'));var db=require(_0xba45('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xba45('0x7'))(_0xba45('0x8'));var config=require(_0xba45('0x9'));var jayson=require(_0xba45('0xa'));var client=jayson[_0xba45('0xb')][_0xba45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb3fac4,_0x3c9ed3,_0x1a9974){return new BPromise(function(_0x352984,_0x1b7936){return client[_0xba45('0xd')](_0xb3fac4,_0x1a9974)[_0xba45('0xe')](function(_0x3594ef){logger[_0xba45('0xf')](_0xba45('0x10'),_0x3c9ed3,_0xba45('0x11'));logger[_0xba45('0x12')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3c9ed3,_0xba45('0x11'),JSON[_0xba45('0x13')](_0x3594ef));if(_0x3594ef[_0xba45('0x14')]){if(_0x3594ef['error'][_0xba45('0x15')]===0x1f4){logger[_0xba45('0x14')](_0xba45('0x10'),_0x3c9ed3,_0x3594ef[_0xba45('0x14')]['message']);return _0x1b7936(_0x3594ef[_0xba45('0x14')][_0xba45('0x16')]);}logger['error'](_0xba45('0x10'),_0x3c9ed3,_0x3594ef[_0xba45('0x14')][_0xba45('0x16')]);return _0x352984(_0x3594ef[_0xba45('0x14')]['message']);}else{logger[_0xba45('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3c9ed3,_0xba45('0x11'));_0x352984(_0x3594ef[_0xba45('0x17')][_0xba45('0x16')]);}})[_0xba45('0x18')](function(_0x516c16){logger[_0xba45('0x14')](_0xba45('0x10'),_0x3c9ed3,_0x516c16);_0x1b7936(_0x516c16);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index e71b4e9..c952df5 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 _0x5459=['query','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/run','run','/:id/query'];(function(_0x584e45,_0x1d4e17){var _0x3fbeb1=function(_0xdab686){while(--_0xdab686){_0x584e45['push'](_0x584e45['shift']());}};_0x3fbeb1(++_0x1d4e17);}(_0x5459,0xd7));var _0x9545=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5459[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x9545('0x0'));var path=require(_0x9545('0x1'));var timeout=require(_0x9545('0x2'));var express=require(_0x9545('0x3'));var router=express['Router']();var fs_extra=require(_0x9545('0x4'));var auth=require(_0x9545('0x5'));var interaction=require(_0x9545('0x6'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x9545('0x7')]('/',auth['isAuthenticated'](),controller[_0x9545('0x8')]);router['get'](_0x9545('0x9'),auth[_0x9545('0xa')](),controller[_0x9545('0xb')]);router['get']('/:id/preview',auth[_0x9545('0xa')](),controller['preview']);router['get'](_0x9545('0xc'),auth[_0x9545('0xa')](),controller[_0x9545('0xd')]);router[_0x9545('0x7')](_0x9545('0xe'),auth[_0x9545('0xa')](),controller[_0x9545('0xf')]);router[_0x9545('0x10')]('/',auth['isAuthenticated'](),controller[_0x9545('0x11')]);router[_0x9545('0x12')](_0x9545('0x9'),auth['isAuthenticated'](),controller[_0x9545('0x13')]);router[_0x9545('0x14')](_0x9545('0x9'),auth['isAuthenticated'](),controller[_0x9545('0x15')]);module[_0x9545('0x16')]=router; \ No newline at end of file +var _0xd37c=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','run','post','create','put','destroy','multer','util'];(function(_0x46bc12,_0x5e2b34){var _0x44e497=function(_0x335051){while(--_0x335051){_0x46bc12['push'](_0x46bc12['shift']());}};_0x44e497(++_0x5e2b34);}(_0xd37c,0x1e1));var _0xcd37=function(_0x4fd40a,_0xa699ab){_0x4fd40a=_0x4fd40a-0x0;var _0x586cc6=_0xd37c[_0x4fd40a];return _0x586cc6;};'use strict';var multer=require(_0xcd37('0x0'));var util=require(_0xcd37('0x1'));var path=require(_0xcd37('0x2'));var timeout=require(_0xcd37('0x3'));var express=require(_0xcd37('0x4'));var router=express[_0xcd37('0x5')]();var fs_extra=require(_0xcd37('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcd37('0x7'));var config=require(_0xcd37('0x8'));var controller=require(_0xcd37('0x9'));router[_0xcd37('0xa')]('/',auth[_0xcd37('0xb')](),controller[_0xcd37('0xc')]);router[_0xcd37('0xa')](_0xcd37('0xd'),auth[_0xcd37('0xb')](),controller['show']);router[_0xcd37('0xa')](_0xcd37('0xe'),auth[_0xcd37('0xb')](),controller[_0xcd37('0xf')]);router[_0xcd37('0xa')]('/:id/run',auth['isAuthenticated'](),controller[_0xcd37('0x10')]);router[_0xcd37('0xa')]('/:id/query',auth[_0xcd37('0xb')](),controller['query']);router[_0xcd37('0x11')]('/',auth['isAuthenticated'](),controller[_0xcd37('0x12')]);router[_0xcd37('0x13')](_0xcd37('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xcd37('0xd'),auth[_0xcd37('0xb')](),controller[_0xcd37('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index f61dc36..cd08bf8 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 _0xf2ca=['STRING','TEXT','sequelize','exports'];(function(_0x2ad1b8,_0x1ea09b){var _0x52547d=function(_0x33b77c){while(--_0x33b77c){_0x2ad1b8['push'](_0x2ad1b8['shift']());}};_0x52547d(++_0x1ea09b);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0xf2ca[_0x46c1d5];return _0x40fe7b;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'name':{'type':Sequelize[_0xaf2c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xaf2c('0x2')]},'table':{'type':Sequelize[_0xaf2c('0x2')]},'conditions':{'type':Sequelize[_0xaf2c('0x3')]},'joins':{'type':Sequelize[_0xaf2c('0x3')]}}; \ No newline at end of file +var _0xae24=['sequelize','STRING'];(function(_0x4744ce,_0x476e99){var _0x41cf3f=function(_0x4dd841){while(--_0x4dd841){_0x4744ce['push'](_0x4744ce['shift']());}};_0x41cf3f(++_0x476e99);}(_0xae24,0x182));var _0x4ae2=function(_0x1f15de,_0x327ced){_0x1f15de=_0x1f15de-0x0;var _0x12b6a7=_0xae24[_0x1f15de];return _0x12b6a7;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4ae2('0x1')]},'table':{'type':Sequelize[_0x4ae2('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 412d8c1..98289a7 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 _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x444784,_0x3ccfbc){var _0x3f1675=function(_0x3813c6){while(--_0x3813c6){_0x444784['push'](_0x444784['shift']());}};_0x3f1675(++_0x3ccfbc);}(_0x1cb9,0x14e));var _0x91cb=function(_0x141ea1,_0x13a245){_0x141ea1=_0x141ea1-0x0;var _0x174108=_0x1cb9[_0x141ea1];return _0x174108;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file +var _0xf494=['name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','includeAll','find','create','body','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','join','left_join','cross_join','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)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','field','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','IS\x20NULL','operator','condition','getFields','groupBy','clone','output','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','IS\x20NOT\x20EMPTY','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','DefaultReports','error','stack'];(function(_0x4e9467,_0x3e7800){var _0x5fe528=function(_0x6938ea){while(--_0x6938ea){_0x4e9467['push'](_0x4e9467['shift']());}};_0x5fe528(++_0x3e7800);}(_0xf494,0x1c6));var _0x4f49=function(_0x50e05c,_0x16834d){_0x50e05c=_0x50e05c-0x0;var _0x17b8fe=_0xf494[_0x50e05c];return _0x17b8fe;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];var dbH=require(_0x4f49('0x18'))['dbH'];function respondWithStatusCode(_0x1e1c37,_0x111a8b){_0x111a8b=_0x111a8b||0xcc;return function(_0x1b9145){if(_0x1b9145){return _0x1e1c37[_0x4f49('0x19')](_0x111a8b);}return _0x1e1c37[_0x4f49('0x1a')](_0x111a8b)[_0x4f49('0x1b')]();};}function respondWithResult(_0xfdb477,_0x5c373e){_0x5c373e=_0x5c373e||0xc8;return function(_0x515ace){if(_0x515ace){return _0xfdb477[_0x4f49('0x1a')](_0x5c373e)[_0x4f49('0x1c')](_0x515ace);}};}function respondWithFilteredResult(_0x5878f4,_0x5bdfaf){return function(_0x2f0a0d){if(_0x2f0a0d){var _0x2ecaaa=typeof _0x5bdfaf[_0x4f49('0x1d')]==='undefined'&&typeof _0x5bdfaf[_0x4f49('0x1e')]===_0x4f49('0x1f');var _0x4e85df=_0x2f0a0d['count'];var _0x5bb23b=_0x2ecaaa?0x0:_0x5bdfaf['offset'];var _0x47f1e8=_0x2ecaaa?_0x2f0a0d[_0x4f49('0x20')]:_0x5bdfaf[_0x4f49('0x1d')]+_0x5bdfaf[_0x4f49('0x1e')];var _0x407042;if(_0x47f1e8>=_0x4e85df){_0x47f1e8=_0x4e85df;_0x407042=0xc8;}else{_0x407042=0xce;}_0x5878f4['status'](_0x407042);return _0x5878f4[_0x4f49('0x21')](_0x4f49('0x22'),_0x5bb23b+'-'+_0x47f1e8+'/'+_0x4e85df)[_0x4f49('0x1c')](_0x2f0a0d);}return null;};}function patchUpdates(_0xaab5e7){return function(_0xea82f8){try{jsonpatch['apply'](_0xea82f8,_0xaab5e7,!![]);}catch(_0x3e7e28){return BPromise[_0x4f49('0x23')](_0x3e7e28);}return _0xea82f8[_0x4f49('0x24')]();};}function saveUpdates(_0x53b57d,_0x40755e){return function(_0x1d70a7){if(_0x1d70a7){return _0x1d70a7[_0x4f49('0x25')](_0x53b57d)[_0x4f49('0x26')](function(_0x9d30aa){return _0x9d30aa;});}return null;};}function removeEntity(_0x36187b,_0x559d98){return function(_0x4e9041){if(_0x4e9041){return _0x4e9041[_0x4f49('0x27')]()[_0x4f49('0x26')](function(){var _0x4fedbb=_0x4e9041[_0x4f49('0x28')]({'plain':!![]});var _0x2c1519=_0x4f49('0x29');return db['UserProfileResource'][_0x4f49('0x27')]({'where':{'type':_0x2c1519,'resourceId':_0x4fedbb['id']}})[_0x4f49('0x26')](function(){return _0x4e9041;});})[_0x4f49('0x26')](function(){_0x36187b[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x122404,_0x4915af){return function(_0x50c571){if(!_0x50c571){_0x122404[_0x4f49('0x19')](0x194);}return _0x50c571;};}function handleError(_0x2c00ee,_0x605c91){_0x605c91=_0x605c91||0x1f4;return function(_0x560050){logger[_0x4f49('0x2a')](_0x560050[_0x4f49('0x2b')]);if(_0x560050[_0x4f49('0x2c')]){delete _0x560050['name'];}_0x2c00ee['status'](_0x605c91)[_0x4f49('0x2d')](_0x560050);};}exports[_0x4f49('0x2e')]=function(_0x7a6ea0,_0x5e7076){var _0x1eaac6={},_0x35aa33={},_0x173657={'count':0x0,'rows':[]};var _0x2ceda4=_[_0x4f49('0x2f')](db[_0x4f49('0x30')][_0x4f49('0x31')],function(_0x45ae19){return{'name':_0x45ae19[_0x4f49('0x32')],'type':_0x45ae19[_0x4f49('0x33')][_0x4f49('0x34')]};});_0x35aa33[_0x4f49('0x35')]=_[_0x4f49('0x2f')](_0x2ceda4,_0x4f49('0x2c'));_0x35aa33[_0x4f49('0x36')]=_[_0x4f49('0x37')](_0x7a6ea0[_0x4f49('0x36')]);_0x35aa33[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x35aa33['model'],_0x35aa33[_0x4f49('0x36')]);_0x1eaac6[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x35aa33[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3b')]));_0x1eaac6[_0x4f49('0x3a')]=_0x1eaac6[_0x4f49('0x3a')][_0x4f49('0x3c')]?_0x1eaac6[_0x4f49('0x3a')]:_0x35aa33[_0x4f49('0x35')];if(!_0x7a6ea0[_0x4f49('0x36')]['hasOwnProperty'](_0x4f49('0x3d'))){_0x1eaac6[_0x4f49('0x1e')]=qs[_0x4f49('0x1e')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1e')]);_0x1eaac6[_0x4f49('0x1d')]=qs[_0x4f49('0x1d')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x1d')]);}_0x1eaac6[_0x4f49('0x3e')]=qs[_0x4f49('0x3f')](_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x3f')]);_0x1eaac6[_0x4f49('0x40')]=qs['filters'](_[_0x4f49('0x41')](_0x7a6ea0[_0x4f49('0x36')],_0x35aa33['filters']),_0x2ceda4);if(_0x7a6ea0[_0x4f49('0x36')][_0x4f49('0x42')]){_0x1eaac6['where']=_[_0x4f49('0x43')](_0x1eaac6[_0x4f49('0x40')],{'$or':_[_0x4f49('0x2f')](_0x2ceda4,function(_0x200b1d){if(_0x200b1d[_0x4f49('0x33')]!==_0x4f49('0x44')){var _0x29e910={};_0x29e910[_0x200b1d['name']]={'$like':'%'+_0x7a6ea0['query']['filter']+'%'};return _0x29e910;}})});}_0x1eaac6=_[_0x4f49('0x43')]({},_0x1eaac6,_0x7a6ea0[_0x4f49('0x45')]);var _0x2e4355={'where':_0x1eaac6[_0x4f49('0x40')]};return db[_0x4f49('0x30')][_0x4f49('0x20')](_0x2e4355)[_0x4f49('0x26')](function(_0x23720a){_0x173657[_0x4f49('0x20')]=_0x23720a;if(_0x7a6ea0['query']['includeAll']){_0x1eaac6[_0x4f49('0x46')]=[{'all':!![]}];}return db[_0x4f49('0x30')][_0x4f49('0x47')](_0x1eaac6);})['then'](function(_0x2d6b56){_0x173657['rows']=_0x2d6b56;return _0x173657;})['then'](respondWithFilteredResult(_0x5e7076,_0x1eaac6))[_0x4f49('0x48')](handleError(_0x5e7076,null));};exports[_0x4f49('0x49')]=function(_0x40eadc,_0x497cb8){var _0x287781={'raw':!![],'where':{'id':_0x40eadc['params']['id']}},_0x11b4df={};_0x11b4df[_0x4f49('0x35')]=_['keys'](db[_0x4f49('0x30')][_0x4f49('0x31')]);_0x11b4df[_0x4f49('0x36')]=_['keys'](_0x40eadc[_0x4f49('0x36')]);_0x11b4df[_0x4f49('0x38')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],_0x11b4df[_0x4f49('0x36')]);_0x287781[_0x4f49('0x3a')]=_[_0x4f49('0x39')](_0x11b4df[_0x4f49('0x35')],qs[_0x4f49('0x3b')](_0x40eadc[_0x4f49('0x36')]['fields']));_0x287781[_0x4f49('0x3a')]=_0x287781[_0x4f49('0x3a')]['length']?_0x287781[_0x4f49('0x3a')]:_0x11b4df['model'];if(_0x40eadc[_0x4f49('0x36')][_0x4f49('0x4a')]){_0x287781[_0x4f49('0x46')]=[{'all':!![]}];}_0x287781=_[_0x4f49('0x43')]({},_0x287781,_0x40eadc['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x287781)[_0x4f49('0x26')](handleEntityNotFound(_0x497cb8,null))[_0x4f49('0x26')](respondWithResult(_0x497cb8,null))[_0x4f49('0x48')](handleError(_0x497cb8,null));};exports[_0x4f49('0x4c')]=function(_0x37fdb7,_0xd282c){return db[_0x4f49('0x30')][_0x4f49('0x4c')](_0x37fdb7[_0x4f49('0x4d')],{})[_0x4f49('0x26')](function(_0x148031){var _0x2104d0=_0x37fdb7[_0x4f49('0x4e')][_0x4f49('0x28')]({'plain':!![]});if(!_0x2104d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2104d0['role']===_0x4f49('0x4e')){var _0x197670=_0x148031[_0x4f49('0x28')]({'plain':!![]});var _0xe46c90=_0x4f49('0x4f');return db[_0x4f49('0x50')][_0x4f49('0x4b')]({'where':{'name':_0xe46c90,'userProfileId':_0x2104d0['userProfileId']},'raw':!![]})[_0x4f49('0x26')](function(_0x4ff0a2){if(_0x4ff0a2&&_0x4ff0a2[_0x4f49('0x51')]===0x0){return db[_0x4f49('0x52')][_0x4f49('0x4c')]({'name':_0x197670[_0x4f49('0x2c')],'resourceId':_0x197670['id'],'type':'DefaultReports','sectionId':_0x4ff0a2['id']},{})[_0x4f49('0x26')](function(){return _0x148031;});}else{return _0x148031;}})['catch'](function(_0x52d18c){logger[_0x4f49('0x2a')](_0x4f49('0x53'),_0x52d18c);throw _0x52d18c;});}return _0x148031;})[_0x4f49('0x26')](respondWithResult(_0xd282c,0xc9))[_0x4f49('0x48')](handleError(_0xd282c,null));};exports['update']=function(_0x599c51,_0xd7f47b){if(_0x599c51[_0x4f49('0x4d')]['id']){delete _0x599c51['body']['id'];}return db[_0x4f49('0x30')]['find']({'where':{'id':_0x599c51['params']['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0xd7f47b,null))['then'](saveUpdates(_0x599c51[_0x4f49('0x4d')],null))['then'](respondWithResult(_0xd7f47b,null))[_0x4f49('0x48')](handleError(_0xd7f47b,null));};exports[_0x4f49('0x27')]=function(_0x2472c9,_0x883408){return db[_0x4f49('0x30')][_0x4f49('0x4b')]({'where':{'id':_0x2472c9[_0x4f49('0x54')]['id']}})[_0x4f49('0x26')](handleEntityNotFound(_0x883408,null))['then'](removeEntity(_0x883408,null))[_0x4f49('0x48')](handleError(_0x883408,null));};exports['preview']=function(_0x213608,_0x1f640d){var _0xc4fc6b=0xa;var _0x467f12=[_0x4f49('0x55'),_0x4f49('0x56'),'right_join',_0x4f49('0x57')];var _0xd3689c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x564bf5={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x21807e=function(_0x265988){return!_[_0x4f49('0x62')](['IS\x20NULL',_0x4f49('0x63'),_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x265988);};var _0x293839=function(_0x17b15){if(!_0x17b15||!_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x28ea73='(',_0x1b80f2=0x0;_0x1b80f2<_0x17b15[_0x4f49('0x65')][_0x4f49('0x3c')];_0x1b80f2+=0x1){_0x1b80f2>0x0&&(_0x28ea73+='\x20'+_0x17b15['operator']+'\x20');_0x28ea73+=_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]?_0x293839(_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x66')]):_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x67')]+'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition']+(_0x21807e(_0x17b15[_0x4f49('0x65')][_0x1b80f2]['condition'])?'\x20'+_0x17b15[_0x4f49('0x65')][_0x1b80f2][_0x4f49('0x68')]:'');}return _0x28ea73+')';};var _0x4714c7={'where':{'id':_0x213608[_0x4f49('0x54')]['id']}},_0xf29378,_0xc7743e,_0x3f2f3f,_0x61a565,_0x297698;_0x4714c7=_[_0x4f49('0x43')]({},_0x4714c7,_0x213608['options']);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x4714c7)[_0x4f49('0x26')](function(_0x2cdaa4){if(_0x2cdaa4){_0xf29378=_0x2cdaa4;return _0x2cdaa4['getFields']();}return null;})['then'](function(_0x28e8ae){if(_0x28e8ae){if(!_0x28e8ae['length']){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0xc7743e=_0x28e8ae;return db[_0x4f49('0x6c')][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x179431){if(_0x179431){_0x3f2f3f=_[_0x4f49('0x6d')](_0x179431,'id');var _0x3823f0;var _0x3e9b47=squel[_0x4f49('0x6e')]();_0x3e9b47[_0x4f49('0x6f')](_0xf29378[_0x4f49('0x70')]);for(var _0xd53de8=0x0;_0xd53de8<_0xc7743e[_0x4f49('0x3c')];_0xd53de8+=0x1){_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x71')]?_0x3f2f3f[_0xc7743e[_0xd53de8][_0x4f49('0x71')]][_0x4f49('0x72')]:_0xc7743e[_0xd53de8][_0x4f49('0x67')];_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0xd3689c[_0xc7743e[_0xd53de8][_0x4f49('0x73')]],'%s',_0x3823f0):_0x3823f0;_0x3823f0=_0xc7743e[_0xd53de8][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x564bf5[_0xc7743e[_0xd53de8][_0x4f49('0x75')]],'%s',_0x3823f0):_0x3823f0;if(_0xc7743e[_0xd53de8]['groupBy']){_0x3e9b47[_0x4f49('0x66')](_0x3823f0);}_0xc7743e[_0xd53de8]['orderBy']&&_0x3e9b47[_0x4f49('0x3e')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x76')]===_0x4f49('0x77')?![]:!![]);_0x3e9b47[_0x4f49('0x67')](_0x3823f0,_0xc7743e[_0xd53de8][_0x4f49('0x78')]||_0x3823f0);}if(_0xf29378[_0x4f49('0x79')]){_0xf29378[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0xf29378[_0x4f49('0x79')]);for(var _0x541ac6=0x0;_0x541ac6<_0xf29378['joins'][_0x4f49('0x3c')];_0x541ac6+=0x1){if(_0xf29378['joins'][_0x541ac6][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x467f12,_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')])&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['parentKey']&&_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')]&&_0xf29378[_0x4f49('0x79')][_0x541ac6]['foreignKey']){_0x3e9b47[_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x33')]](_0xf29378['joins'][_0x541ac6][_0x4f49('0x7b')],null,util['format'](_0x4f49('0x7c'),_0xf29378[_0x4f49('0x70')],_0xf29378['joins'][_0x541ac6][_0x4f49('0x7d')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7b')],_0xf29378[_0x4f49('0x79')][_0x541ac6][_0x4f49('0x7e')]));}}}if(_0xf29378[_0x4f49('0x7f')]){_0xf29378['conditions']=JSON[_0x4f49('0x7a')](_0xf29378['conditions']);_0x3e9b47[_0x4f49('0x40')](_0x293839(_0xf29378['conditions'][_0x4f49('0x66')]));}_0x297698=_0x3e9b47['clone']();_0x3e9b47[_0x4f49('0x1e')](_0xc4fc6b);_0x3e9b47[_0x4f49('0x1d')](0x0);logger[_0x4f49('0x80')](_0x4f49('0x81'),_0x3e9b47['toString']());return dbH[_0x4f49('0x82')]['query'](_0x3e9b47[_0x4f49('0x83')](),{'type':dbH['sequelize'][_0x4f49('0x84')]['SELECT']});}})['then'](respondWithResult(_0x1f640d,null))[_0x4f49('0x48')](handleError(_0x1f640d,null));};function runReport(_0x20b2be,_0x16cb4d,_0x4c0e7a){var _0x289810=_0x16cb4d[_0x4f49('0x2c')];var _0x5c33c9=0xa;var _0x5d52ae=['join',_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x87439={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':_0x4f49('0x59'),'MIN':_0x4f49('0x5a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0x2902a1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4f49('0x5f'),'HOUR':_0x4f49('0x60'),'ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x389679=function(_0x5304c3){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),'IS\x20NOT\x20NULL',_0x4f49('0x64'),'IS\x20NOT\x20EMPTY'],_0x5304c3);};var _0x351a33=function(_0x4d72a0){if(!_0x4d72a0||!_0x4d72a0[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x2ef19e='(',_0x6ad599=0x0;_0x6ad599<_0x4d72a0[_0x4f49('0x65')]['length'];_0x6ad599+=0x1){_0x6ad599>0x0&&(_0x2ef19e+='\x20'+_0x4d72a0[_0x4f49('0x8a')]+'\x20');_0x2ef19e+=_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x66')]?_0x351a33(_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['group']):_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['field']+'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599]['condition']+(_0x389679(_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x8b')])?'\x20'+_0x4d72a0[_0x4f49('0x65')][_0x6ad599][_0x4f49('0x68')]:'');}return _0x2ef19e+')';};var _0x111e90={'where':{'id':_0x20b2be['id']}},_0xd253ed,_0x323a3a,_0xe0adc3,_0x3a26ff,_0x64f0ee;_0x111e90=_['merge']({},_0x111e90,_0x4c0e7a);return db[_0x4f49('0x30')][_0x4f49('0x4b')](_0x111e90)[_0x4f49('0x26')](function(_0x299849){if(_0x299849){_0xd253ed=_0x299849;return _0x299849[_0x4f49('0x8c')]();}return null;})[_0x4f49('0x26')](function(_0x55b28b){if(_0x55b28b){if(!_0x55b28b[_0x4f49('0x3c')]){throw new db[(_0x4f49('0x69'))][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x323a3a=_0x55b28b;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})['then'](function(_0x3c4e88){if(_0x3c4e88){_0xe0adc3=_[_0x4f49('0x6d')](_0x3c4e88,'id');var _0x5c5d2;var _0xa880a2=squel['select']();_0xa880a2[_0x4f49('0x6f')](_0xd253ed[_0x4f49('0x70')]);for(var _0x11c0a0=0x0;_0x11c0a0<_0x323a3a[_0x4f49('0x3c')];_0x11c0a0+=0x1){_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x71')]?_0xe0adc3[_0x323a3a[_0x11c0a0][_0x4f49('0x71')]][_0x4f49('0x72')]:_0x323a3a[_0x11c0a0][_0x4f49('0x67')];_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x73')]?_[_0x4f49('0x74')](_0x87439[_0x323a3a[_0x11c0a0][_0x4f49('0x73')]],'%s',_0x5c5d2):_0x5c5d2;_0x5c5d2=_0x323a3a[_0x11c0a0][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0x2902a1[_0x323a3a[_0x11c0a0][_0x4f49('0x75')]],'%s',_0x5c5d2):_0x5c5d2;if(_0x323a3a[_0x11c0a0][_0x4f49('0x8d')]){_0xa880a2[_0x4f49('0x66')](_0x5c5d2);}_0x323a3a[_0x11c0a0][_0x4f49('0x76')]&&_0xa880a2[_0x4f49('0x3e')](_0x5c5d2,_0x323a3a[_0x11c0a0]['orderBy']===_0x4f49('0x77')?![]:!![]);_0xa880a2[_0x4f49('0x67')](_0x5c5d2,_0x323a3a[_0x11c0a0][_0x4f49('0x78')]||_0x5c5d2);}if(_0xd253ed[_0x4f49('0x79')]){_0xd253ed['joins']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x79')]);for(var _0x594460=0x0;_0x594460<_0xd253ed[_0x4f49('0x79')]['length'];_0x594460+=0x1){if(_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x5d52ae,_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x33')])&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7d')]&&_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')]&&_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']){_0xa880a2[_0xd253ed['joins'][_0x594460][_0x4f49('0x33')]](_0xd253ed['joins'][_0x594460][_0x4f49('0x7b')],null,util[_0x4f49('0x75')]('%s.%s\x20=\x20%s.%s',_0xd253ed['table'],_0xd253ed[_0x4f49('0x79')][_0x594460]['parentKey'],_0xd253ed[_0x4f49('0x79')][_0x594460][_0x4f49('0x7b')],_0xd253ed[_0x4f49('0x79')][_0x594460]['foreignKey']));}}}if(_0xd253ed[_0x4f49('0x7f')]){_0xd253ed['conditions']=JSON[_0x4f49('0x7a')](_0xd253ed[_0x4f49('0x7f')]);_0xa880a2[_0x4f49('0x40')](_0x351a33(_0xd253ed['conditions'][_0x4f49('0x66')]));}_0x64f0ee=_0xa880a2[_0x4f49('0x8e')]();_0xa880a2[_0x4f49('0x1e')](_0x5c33c9);_0xa880a2['offset'](0x0);return;}})['then'](function(){if(_0x16cb4d[_0x4f49('0x8f')]==='web'){return null;}var _0x2bc9df=_[_0x4f49('0x43')](_0x16cb4d,{'name':_0x16cb4d[_0x4f49('0x90')]||_0x16cb4d['name']||_0xd253ed[_0x4f49('0x2c')],'basename':_0x289810,'savename':util['format'](_0x4f49('0x91'),_0x16cb4d[_0x4f49('0x2c')]||_0xd253ed[_0x4f49('0x2c')],require('randomstring')[_0x4f49('0x92')](0x4),_0x16cb4d[_0x4f49('0x8f')]||_0x4f49('0x93')),'reportId':_0xd253ed['id'],'reportType':_0x4f49('0x94')});return db[_0x4f49('0x95')][_0x4f49('0x4c')](_0x2bc9df,{'raw':!![]});})['then'](function(_0x5b6ac7){if(_0xd253ed[_0x4f49('0x70')]===_0x4f49('0x96')){_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+_0x4f49('0x97'),_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}else{_0x64f0ee[_0x4f49('0x40')](_0xd253ed[_0x4f49('0x70')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x16cb4d[_0x4f49('0x98')],_0x16cb4d[_0x4f49('0x99')]);}if(_0x5b6ac7){logger[_0x4f49('0x9a')]('Run\x20Query:',_0x64f0ee[_0x4f49('0x83')]());require(_0x4f49('0x9b'))[_0x4f49('0x9c')](path['join'](__dirname,_0x4f49('0x9d'),_0x5b6ac7[_0x4f49('0x8f')]),[_0x5b6ac7['id'],_0x64f0ee[_0x4f49('0x83')](),path['join'](__dirname,_0x4f49('0x9e'),_0x5b6ac7[_0x4f49('0x9f')]),_0x289810]);return _0x5b6ac7;}else{var _0x5efb11=squel['select']();_0x5efb11[_0x4f49('0x6f')]('('+_0x64f0ee[_0x4f49('0x83')]()+')',_0x4f49('0xa0'));_0x5efb11[_0x4f49('0x67')](_0x4f49('0xa1'),_0x4f49('0x20'));_0x64f0ee['limit'](_0x16cb4d['limit']||_0x5c33c9);_0x64f0ee['offset'](_0x16cb4d[_0x4f49('0x1d')]||0x0);return dbH[_0x4f49('0x82')]['query'](_0x5efb11[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')]['SELECT']})['then'](function(_0x3633b5){if(!_0x3633b5['length']){_0x3a26ff=0x0;}else{_0x3a26ff=_0x3633b5[0x0][_0x4f49('0x20')]||0x0;}return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x64f0ee[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')]['QueryTypes'][_0x4f49('0xa2')]});})[_0x4f49('0x26')](function(_0x45c938){return{'rows':_0x45c938||[],'count':_0x3a26ff};});}});}exports[_0x4f49('0xa3')]=function(_0x4a4d75,_0x93e85d){return runReport(_0x4a4d75[_0x4f49('0x54')],_0x4a4d75['query'],_0x4a4d75[_0x4f49('0x45')])[_0x4f49('0x26')](respondWithResult(_0x93e85d,null))[_0x4f49('0x48')](handleError(_0x93e85d,null));};exports[_0x4f49('0xa4')]=runReport;exports[_0x4f49('0x36')]=function(_0x40991b,_0x56290f){var _0x4994b6=0xa;var _0x1c7d87=[_0x4f49('0x55'),_0x4f49('0x56'),_0x4f49('0x85'),_0x4f49('0x57')];var _0x5cd00a={'SUM':_0x4f49('0x86'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4f49('0x58'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x4f49('0x5b'),'GROUP_CONCAT':_0x4f49('0x5c'),'GROUP_CONCAT ASC':_0x4f49('0x87'),'GROUP_CONCAT DESC':_0x4f49('0x5d')};var _0xd876f1={'SEC_TO_TIME':_0x4f49('0x5e'),'DATE':_0x4f49('0x5f'),'HOUR':'HOUR(%s)','ROUND':_0x4f49('0x88'),'UNIX_TIMESTAMP':_0x4f49('0x61')};var _0x1ae2c9=function(_0x566634){return!_[_0x4f49('0x62')]([_0x4f49('0x89'),_0x4f49('0x63'),'IS\x20EMPTY',_0x4f49('0xa5')],_0x566634);};var _0x541dc2=function(_0x4061bf){if(!_0x4061bf||!_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')]){return'';}for(var _0x1bc18d='(',_0x5e6103=0x0;_0x5e6103<_0x4061bf[_0x4f49('0x65')][_0x4f49('0x3c')];_0x5e6103+=0x1){_0x5e6103>0x0&&(_0x1bc18d+='\x20'+_0x4061bf[_0x4f49('0x8a')]+'\x20');_0x1bc18d+=_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]?_0x541dc2(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x66')]):_0x4061bf[_0x4f49('0x65')][_0x5e6103]['field']+'\x20'+_0x4061bf['rules'][_0x5e6103][_0x4f49('0x8b')]+(_0x1ae2c9(_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x8b')])?'\x20'+_0x4061bf[_0x4f49('0x65')][_0x5e6103][_0x4f49('0x68')]:'');}return _0x1bc18d+')';};var _0x29dbab={'where':{'id':_0x40991b[_0x4f49('0x54')]['id']}},_0x5f459b,_0x1d090f,_0x37d2f4,_0x5bcb36,_0x3f04fa;_0x29dbab=_[_0x4f49('0x43')]({},_0x29dbab,_0x40991b['options']);return db['AnalyticDefaultReport'][_0x4f49('0x4b')](_0x29dbab)[_0x4f49('0x26')](function(_0x200848){if(_0x200848){_0x5f459b=_0x200848;return _0x200848['getFields']();}return null;})[_0x4f49('0x26')](function(_0x48f4bc){if(_0x48f4bc){if(!_0x48f4bc[_0x4f49('0x3c')]){throw new db['Sequelize'][(_0x4f49('0x6a'))](_0x4f49('0x6b'),0x193);}_0x1d090f=_0x48f4bc;return db['AnalyticMetric'][_0x4f49('0x47')]({'raw':!![]});}return null;})[_0x4f49('0x26')](function(_0x513bc9){if(_0x513bc9){_0x37d2f4=_[_0x4f49('0x6d')](_0x513bc9,'id');var _0x47567c;var _0x5f1538=squel[_0x4f49('0x6e')]();_0x5f1538[_0x4f49('0x6f')](_0x5f459b[_0x4f49('0x70')]);for(var _0xd91e48=0x0;_0xd91e48<_0x1d090f[_0x4f49('0x3c')];_0xd91e48+=0x1){_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x71')]?_0x37d2f4[_0x1d090f[_0xd91e48]['MetricId']][_0x4f49('0x72')]:_0x1d090f[_0xd91e48][_0x4f49('0x67')];_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x73')]?_['replace'](_0x5cd00a[_0x1d090f[_0xd91e48][_0x4f49('0x73')]],'%s',_0x47567c):_0x47567c;_0x47567c=_0x1d090f[_0xd91e48][_0x4f49('0x75')]?_[_0x4f49('0x74')](_0xd876f1[_0x1d090f[_0xd91e48][_0x4f49('0x75')]],'%s',_0x47567c):_0x47567c;if(_0x1d090f[_0xd91e48][_0x4f49('0x8d')]){_0x5f1538[_0x4f49('0x66')](_0x47567c);}_0x1d090f[_0xd91e48][_0x4f49('0x76')]&&_0x5f1538['order'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x76')]==='DESC'?![]:!![]);_0x5f1538['field'](_0x47567c,_0x1d090f[_0xd91e48][_0x4f49('0x78')]||_0x47567c);}if(_0x5f459b['joins']){_0x5f459b[_0x4f49('0x79')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x79')]);for(var _0x85eb3f=0x0;_0x85eb3f<_0x5f459b[_0x4f49('0x79')][_0x4f49('0x3c')];_0x85eb3f+=0x1){if(_0x5f459b['joins'][_0x85eb3f][_0x4f49('0x33')]&&_[_0x4f49('0x62')](_0x1c7d87,_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')])&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')]&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable']&&_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]){_0x5f1538[_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x33')]](_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7b')],null,util[_0x4f49('0x75')](_0x4f49('0x7c'),_0x5f459b[_0x4f49('0x70')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7d')],_0x5f459b[_0x4f49('0x79')][_0x85eb3f]['foreignTable'],_0x5f459b[_0x4f49('0x79')][_0x85eb3f][_0x4f49('0x7e')]));}}}if(_0x5f459b['conditions']){_0x5f459b[_0x4f49('0x7f')]=JSON[_0x4f49('0x7a')](_0x5f459b[_0x4f49('0x7f')]);_0x5f1538[_0x4f49('0x40')](_0x541dc2(_0x5f459b[_0x4f49('0x7f')][_0x4f49('0x66')]));}_0x3f04fa=_0x5f1538['clone']();_0x5f1538['limit'](_0x4994b6);_0x5f1538['offset'](0x0);logger['debug'](_0x4f49('0x81'),_0x5f1538['toString']());return dbH[_0x4f49('0x82')][_0x4f49('0x36')](_0x5f1538[_0x4f49('0x83')](),{'type':dbH[_0x4f49('0x82')][_0x4f49('0x84')][_0x4f49('0xa2')]});}})['then'](function(){return{'sql':_0x3f04fa[_0x4f49('0x83')]()};})['then'](respondWithResult(_0x56290f,null))[_0x4f49('0x48')](handleError(_0x56290f,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 1980423..db60b65 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 _0xf9e5=['analytics_default_reports','lodash','moment','bluebird','request-promise','path','rimraf','exports','AnalyticDefaultReport'];(function(_0x5f084b,_0x55dd5a){var _0x54ee68=function(_0x287144){while(--_0x287144){_0x5f084b['push'](_0x5f084b['shift']());}};_0x54ee68(++_0x55dd5a);}(_0xf9e5,0x1c3));var _0x5f9e=function(_0x21481a,_0x145e1b){_0x21481a=_0x21481a-0x0;var _0x405315=_0xf9e5[_0x21481a];return _0x405315;};'use strict';var _=require(_0x5f9e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5f9e('0x1'));var BPromise=require(_0x5f9e('0x2'));var rp=require(_0x5f9e('0x3'));var fs=require('fs');var path=require(_0x5f9e('0x4'));var rimraf=require(_0x5f9e('0x5'));var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x5f9e('0x6')]=function(_0x49d3d8,_0x4c35b3){return _0x49d3d8['define'](_0x5f9e('0x7'),attributes,{'tableName':_0x5f9e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4256=['rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x251b02,_0x38c0f7){var _0x14017c=function(_0x7a976a){while(--_0x7a976a){_0x251b02['push'](_0x251b02['shift']());}};_0x14017c(++_0x38c0f7);}(_0x4256,0x148));var _0x6425=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0x4256[_0x4a209a];return _0x4b3c20;};'use strict';var _=require(_0x6425('0x0'));var util=require(_0x6425('0x1'));var logger=require(_0x6425('0x2'))(_0x6425('0x3'));var moment=require(_0x6425('0x4'));var BPromise=require(_0x6425('0x5'));var rp=require(_0x6425('0x6'));var fs=require('fs');var path=require(_0x6425('0x7'));var rimraf=require(_0x6425('0x8'));var config=require(_0x6425('0x9'));var attributes=require('./analyticDefaultReport.attributes');module[_0x6425('0xa')]=function(_0x384476,_0x2caeed){return _0x384476[_0x6425('0xb')](_0x6425('0xc'),attributes,{'tableName':_0x6425('0xd'),'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 82362c5..bb393df 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 _0x7554=['then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x126d38,_0x2a6798){var _0x5535bb=function(_0x1f959f){while(--_0x1f959f){_0x126d38['push'](_0x126d38['shift']());}};_0x5535bb(++_0x2a6798);}(_0x7554,0x113));var _0x4755=function(_0x4f24ec,_0x2544e9){_0x4f24ec=_0x4f24ec-0x0;var _0x43570b=_0x7554[_0x4f24ec];return _0x43570b;};'use strict';var _=require(_0x4755('0x0'));var util=require(_0x4755('0x1'));var moment=require(_0x4755('0x2'));var BPromise=require(_0x4755('0x3'));var rs=require(_0x4755('0x4'));var fs=require('fs');var Redis=require(_0x4755('0x5'));var db=require(_0x4755('0x6'))['db'];var utils=require(_0x4755('0x7'));var logger=require(_0x4755('0x8'))(_0x4755('0x9'));var config=require('../../config/environment');var jayson=require(_0x4755('0xa'));var client=jayson[_0x4755('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f482f,_0xeaead7,_0x2358d1){return new BPromise(function(_0x166b5b,_0x2c5856){return client[_0x4755('0xc')](_0x5f482f,_0x2358d1)[_0x4755('0xd')](function(_0x152608){logger[_0x4755('0xe')](_0x4755('0xf'),_0xeaead7,_0x4755('0x10'));logger[_0x4755('0x11')](_0x4755('0x12'),_0xeaead7,_0x4755('0x10'),JSON['stringify'](_0x152608));if(_0x152608['error']){if(_0x152608[_0x4755('0x13')][_0x4755('0x14')]===0x1f4){logger[_0x4755('0x13')](_0x4755('0xf'),_0xeaead7,_0x152608[_0x4755('0x13')][_0x4755('0x15')]);return _0x2c5856(_0x152608[_0x4755('0x13')][_0x4755('0x15')]);}logger[_0x4755('0x13')](_0x4755('0xf'),_0xeaead7,_0x152608[_0x4755('0x13')][_0x4755('0x15')]);return _0x166b5b(_0x152608[_0x4755('0x13')]['message']);}else{logger[_0x4755('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xeaead7,_0x4755('0x10'));_0x166b5b(_0x152608[_0x4755('0x16')][_0x4755('0x15')]);}})[_0x4755('0x17')](function(_0xc551a4){logger[_0x4755('0x13')](_0x4755('0xf'),_0xeaead7,_0xc551a4);_0x2c5856(_0xc551a4);});});} \ No newline at end of file +var _0xcea9=['code','message','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x399b34,_0x30d7e0){var _0xd355a7=function(_0x515fe8){while(--_0x515fe8){_0x399b34['push'](_0x399b34['shift']());}};_0xd355a7(++_0x30d7e0);}(_0xcea9,0x1e2));var _0x9cea=function(_0x55730b,_0x160fe8){_0x55730b=_0x55730b-0x0;var _0x548413=_0xcea9[_0x55730b];return _0x548413;};'use strict';var _=require(_0x9cea('0x0'));var util=require(_0x9cea('0x1'));var moment=require(_0x9cea('0x2'));var BPromise=require('bluebird');var rs=require(_0x9cea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9cea('0x4'))['db'];var utils=require(_0x9cea('0x5'));var logger=require(_0x9cea('0x6'))('rpc');var config=require(_0x9cea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9cea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1930c5,_0x497fa9,_0x5bc605){return new BPromise(function(_0x487740,_0xefdc1a){return client[_0x9cea('0x9')](_0x1930c5,_0x5bc605)[_0x9cea('0xa')](function(_0x5aa49f){logger[_0x9cea('0xb')](_0x9cea('0xc'),_0x497fa9,_0x9cea('0xd'));logger[_0x9cea('0xe')](_0x9cea('0xf'),_0x497fa9,'request\x20sent',JSON[_0x9cea('0x10')](_0x5aa49f));if(_0x5aa49f[_0x9cea('0x11')]){if(_0x5aa49f['error'][_0x9cea('0x12')]===0x1f4){logger[_0x9cea('0x11')](_0x9cea('0xc'),_0x497fa9,_0x5aa49f[_0x9cea('0x11')][_0x9cea('0x13')]);return _0xefdc1a(_0x5aa49f['error'][_0x9cea('0x13')]);}logger[_0x9cea('0x11')](_0x9cea('0xc'),_0x497fa9,_0x5aa49f[_0x9cea('0x11')]['message']);return _0x487740(_0x5aa49f[_0x9cea('0x11')][_0x9cea('0x13')]);}else{logger[_0x9cea('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x497fa9,_0x9cea('0xd'));_0x487740(_0x5aa49f['result'][_0x9cea('0x13')]);}})['catch'](function(_0x353655){logger[_0x9cea('0x11')](_0x9cea('0xc'),_0x497fa9,_0x353655);_0xefdc1a(_0x353655);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 2dd3838..86d2e82 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 _0xd16c=['connect-timeout','Router','fs-extra','./analyticDefaultReport.controller','get','/:id','preview','/:id/run','run','isAuthenticated','query','create','put','update','delete','exports','multer','path'];(function(_0x21e834,_0x29609a){var _0x238b7b=function(_0x107fd0){while(--_0x107fd0){_0x21e834['push'](_0x21e834['shift']());}};_0x238b7b(++_0x29609a);}(_0xd16c,0xd6));var _0xcd16=function(_0x5524ff,_0x18a811){_0x5524ff=_0x5524ff-0x0;var _0x4eb65c=_0xd16c[_0x5524ff];return _0x4eb65c;};'use strict';var multer=require(_0xcd16('0x0'));var util=require('util');var path=require(_0xcd16('0x1'));var timeout=require(_0xcd16('0x2'));var express=require('express');var router=express[_0xcd16('0x3')]();var fs_extra=require(_0xcd16('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcd16('0x5'));router[_0xcd16('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xcd16('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xcd16('0x6')]('/:id/preview',auth['isAuthenticated'](),controller[_0xcd16('0x8')]);router['get'](_0xcd16('0x9'),auth['isAuthenticated'](),controller[_0xcd16('0xa')]);router[_0xcd16('0x6')]('/:id/query',auth[_0xcd16('0xb')](),controller[_0xcd16('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcd16('0xd')]);router[_0xcd16('0xe')](_0xcd16('0x7'),auth[_0xcd16('0xb')](),controller[_0xcd16('0xf')]);router[_0xcd16('0x10')](_0xcd16('0x7'),auth[_0xcd16('0xb')](),controller['destroy']);module[_0xcd16('0x11')]=router; \ No newline at end of file +var _0x9c49=['multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','/:id','get','preview','/:id/run','/:id/query','post','create','put','update','destroy','exports'];(function(_0x1ebf08,_0x7a822b){var _0x1adb9d=function(_0xd4688){while(--_0xd4688){_0x1ebf08['push'](_0x1ebf08['shift']());}};_0x1adb9d(++_0x7a822b);}(_0x9c49,0x1c8));var _0x99c4=function(_0x18bf47,_0x400206){_0x18bf47=_0x18bf47-0x0;var _0x408e64=_0x9c49[_0x18bf47];return _0x408e64;};'use strict';var multer=require(_0x99c4('0x0'));var util=require(_0x99c4('0x1'));var path=require('path');var timeout=require(_0x99c4('0x2'));var express=require('express');var router=express[_0x99c4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x99c4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x99c4('0x5'));var controller=require('./analyticDefaultReport.controller');router['get']('/',auth[_0x99c4('0x6')](),controller[_0x99c4('0x7')]);router['get'](_0x99c4('0x8'),auth[_0x99c4('0x6')](),controller['show']);router[_0x99c4('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0x99c4('0xa')]);router['get'](_0x99c4('0xb'),auth[_0x99c4('0x6')](),controller['run']);router[_0x99c4('0x9')](_0x99c4('0xc'),auth[_0x99c4('0x6')](),controller['query']);router[_0x99c4('0xd')]('/',auth[_0x99c4('0x6')](),controller[_0x99c4('0xe')]);router[_0x99c4('0xf')](_0x99c4('0x8'),auth[_0x99c4('0x6')](),controller[_0x99c4('0x10')]);router['delete'](_0x99c4('0x8'),auth[_0x99c4('0x6')](),controller[_0x99c4('0x11')]);module[_0x99c4('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 59d5ba7..41002eb 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 _0xdffa=['xlsx','csv','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED','exports','STRING'];(function(_0x52f2a3,_0x4dc25d){var _0x558470=function(_0x5ac25c){while(--_0x5ac25c){_0x52f2a3['push'](_0x52f2a3['shift']());}};_0x558470(++_0x4dc25d);}(_0xdffa,0x6c));var _0xadff=function(_0x281f58,_0x6a4400){_0x281f58=_0x281f58-0x0;var _0x3b6bf4=_0xdffa[_0x281f58];return _0x3b6bf4;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xadff('0x0')]={'name':{'type':Sequelize[_0xadff('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xadff('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf',_0xadff('0x2')),'allowNull':![],'defaultValue':_0xadff('0x3')},'savename':{'type':Sequelize[_0xadff('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xadff('0x4')]},'endDate':{'type':Sequelize[_0xadff('0x4')]},'status':{'type':Sequelize[_0xadff('0x1')],'defaultValue':_0xadff('0x5')},'type':{'type':Sequelize['ENUM'](_0xadff('0x6'),_0xadff('0x7')),'allowNull':![],'defaultValue':_0xadff('0x6')},'reportId':{'type':Sequelize[_0xadff('0x8')](0xb)[_0xadff('0x9')]},'reportType':{'type':Sequelize[_0xadff('0x1')]}}; \ No newline at end of file +var _0x3f7f=['sequelize','moment','STRING','ENUM','csv','pdf','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x49f02c,_0xaa1372){var _0x193b81=function(_0x3cc300){while(--_0x3cc300){_0x49f02c['push'](_0x49f02c['shift']());}};_0x193b81(++_0xaa1372);}(_0x3f7f,0x16b));var _0xf3f7=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3f7f[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0xf3f7('0x0'));var moment=require(_0xf3f7('0x1'));module['exports']={'name':{'type':Sequelize[_0xf3f7('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xf3f7('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xf3f7('0x3')](_0xf3f7('0x4'),_0xf3f7('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0xf3f7('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xf3f7('0x6')]},'endDate':{'type':Sequelize[_0xf3f7('0x6')]},'status':{'type':Sequelize[_0xf3f7('0x2')],'defaultValue':_0xf3f7('0x7')},'type':{'type':Sequelize['ENUM'](_0xf3f7('0x8'),_0xf3f7('0x9')),'allowNull':![],'defaultValue':_0xf3f7('0x8')},'reportId':{'type':Sequelize[_0xf3f7('0xa')](0xb)['UNSIGNED']},'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 5a43b1f..f0ca3ae 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 _0x8cad=['intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','where','filters','filter','merge','options','AnalyticExtractedReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','end','sendStatus','name','send','index','type','key','model','map','query','keys'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x8cad,0x1a3));var _0xd8ca=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x8cad[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require(_0xd8ca('0x0'));var rimraf=require(_0xd8ca('0x1'));var zipdir=require(_0xd8ca('0x2'));var jsonpatch=require(_0xd8ca('0x3'));var rp=require(_0xd8ca('0x4'));var moment=require('moment');var BPromise=require(_0xd8ca('0x5'));var Mustache=require(_0xd8ca('0x6'));var util=require('util');var path=require(_0xd8ca('0x7'));var sox=require(_0xd8ca('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8ca('0x9'));var _=require(_0xd8ca('0xa'));var squel=require(_0xd8ca('0xb'));var crypto=require(_0xd8ca('0xc'));var jsforce=require(_0xd8ca('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd8ca('0xe'));var querystring=require(_0xd8ca('0xf'));var Papa=require(_0xd8ca('0x10'));var Redis=require(_0xd8ca('0x11'));var authService=require(_0xd8ca('0x12'));var qs=require(_0xd8ca('0x13'));var as=require(_0xd8ca('0x14'));var hardwareService=require(_0xd8ca('0x15'));var logger=require('../../config/logger')(_0xd8ca('0x16'));var utils=require(_0xd8ca('0x17'));var config=require(_0xd8ca('0x18'));var licenseUtil=require(_0xd8ca('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb3319d,_0x3a5501){_0x3a5501=_0x3a5501||0xcc;return function(_0x21f302){if(_0x21f302){return _0xb3319d['sendStatus'](_0x3a5501);}return _0xb3319d[_0xd8ca('0x1a')](_0x3a5501)['end']();};}function respondWithResult(_0x427978,_0x50425b){_0x50425b=_0x50425b||0xc8;return function(_0x5b88fb){if(_0x5b88fb){return _0x427978[_0xd8ca('0x1a')](_0x50425b)['json'](_0x5b88fb);}};}function respondWithFilteredResult(_0x5f3d8d,_0x474c30){return function(_0x53a54a){if(_0x53a54a){var _0x4b2184=typeof _0x474c30['offset']===_0xd8ca('0x1b')&&typeof _0x474c30['limit']===_0xd8ca('0x1b');var _0x547770=_0x53a54a[_0xd8ca('0x1c')];var _0x362227=_0x4b2184?0x0:_0x474c30['offset'];var _0x45675d=_0x4b2184?_0x53a54a[_0xd8ca('0x1c')]:_0x474c30['offset']+_0x474c30[_0xd8ca('0x1d')];var _0xbbb308;if(_0x45675d>=_0x547770){_0x45675d=_0x547770;_0xbbb308=0xc8;}else{_0xbbb308=0xce;}_0x5f3d8d[_0xd8ca('0x1a')](_0xbbb308);return _0x5f3d8d[_0xd8ca('0x1e')](_0xd8ca('0x1f'),_0x362227+'-'+_0x45675d+'/'+_0x547770)['json'](_0x53a54a);}return null;};}function patchUpdates(_0x31f918){return function(_0x48d2dc){try{jsonpatch[_0xd8ca('0x20')](_0x48d2dc,_0x31f918,!![]);}catch(_0x14680f){return BPromise['reject'](_0x14680f);}return _0x48d2dc[_0xd8ca('0x21')]();};}function saveUpdates(_0x23ecaf,_0x5360a1){return function(_0x1beb0f){if(_0x1beb0f){return _0x1beb0f[_0xd8ca('0x22')](_0x23ecaf)[_0xd8ca('0x23')](function(_0x926fe8){return _0x926fe8;});}return null;};}function removeEntity(_0x46f686,_0xb9c180){return function(_0x1a9d88){if(_0x1a9d88){return _0x1a9d88[_0xd8ca('0x24')]()[_0xd8ca('0x23')](function(){var _0x37644a=_0x1a9d88[_0xd8ca('0x25')]({'plain':!![]});var _0x39f81a=_0xd8ca('0x26');return db[_0xd8ca('0x27')][_0xd8ca('0x24')]({'where':{'type':_0x39f81a,'resourceId':_0x37644a['id']}})[_0xd8ca('0x23')](function(){return _0x1a9d88;});})[_0xd8ca('0x23')](function(){_0x46f686[_0xd8ca('0x1a')](0xcc)[_0xd8ca('0x28')]();});}};}function handleEntityNotFound(_0x351a54,_0x84a570){return function(_0x2c3d51){if(!_0x2c3d51){_0x351a54[_0xd8ca('0x29')](0x194);}return _0x2c3d51;};}function handleError(_0x53a3de,_0x56c861){_0x56c861=_0x56c861||0x1f4;return function(_0x1722b5){logger['error'](_0x1722b5['stack']);if(_0x1722b5[_0xd8ca('0x2a')]){delete _0x1722b5['name'];}_0x53a3de[_0xd8ca('0x1a')](_0x56c861)[_0xd8ca('0x2b')](_0x1722b5);};}exports[_0xd8ca('0x2c')]=function(_0x41fc3a,_0x388899){var _0x550cd4={},_0x5c72ad={},_0x27f595={'count':0x0,'rows':[]};var _0x582754=_['map'](db['AnalyticExtractedReport']['rawAttributes'],function(_0x4d8c1b){return{'name':_0x4d8c1b['fieldName'],'type':_0x4d8c1b[_0xd8ca('0x2d')][_0xd8ca('0x2e')]};});_0x5c72ad[_0xd8ca('0x2f')]=_[_0xd8ca('0x30')](_0x582754,_0xd8ca('0x2a'));_0x5c72ad[_0xd8ca('0x31')]=_[_0xd8ca('0x32')](_0x41fc3a['query']);_0x5c72ad['filters']=_[_0xd8ca('0x33')](_0x5c72ad['model'],_0x5c72ad[_0xd8ca('0x31')]);_0x550cd4[_0xd8ca('0x34')]=_[_0xd8ca('0x33')](_0x5c72ad[_0xd8ca('0x2f')],qs['fields'](_0x41fc3a[_0xd8ca('0x31')][_0xd8ca('0x35')]));_0x550cd4[_0xd8ca('0x34')]=_0x550cd4[_0xd8ca('0x34')][_0xd8ca('0x36')]?_0x550cd4[_0xd8ca('0x34')]:_0x5c72ad[_0xd8ca('0x2f')];if(!_0x41fc3a['query'][_0xd8ca('0x37')](_0xd8ca('0x38'))){_0x550cd4[_0xd8ca('0x1d')]=qs[_0xd8ca('0x1d')](_0x41fc3a['query'][_0xd8ca('0x1d')]);_0x550cd4['offset']=qs[_0xd8ca('0x39')](_0x41fc3a['query'][_0xd8ca('0x39')]);}_0x550cd4['order']=qs['sort'](_0x41fc3a[_0xd8ca('0x31')]['sort']);_0x550cd4[_0xd8ca('0x3a')]=qs[_0xd8ca('0x3b')](_['pick'](_0x41fc3a[_0xd8ca('0x31')],_0x5c72ad[_0xd8ca('0x3b')]),_0x582754);if(_0x41fc3a[_0xd8ca('0x31')][_0xd8ca('0x3c')]){_0x550cd4['where']=_[_0xd8ca('0x3d')](_0x550cd4['where'],{'$or':_[_0xd8ca('0x30')](_0x582754,function(_0x1ef11c){if(_0x1ef11c[_0xd8ca('0x2d')]!=='VIRTUAL'){var _0x5a1202={};_0x5a1202[_0x1ef11c['name']]={'$like':'%'+_0x41fc3a[_0xd8ca('0x31')]['filter']+'%'};return _0x5a1202;}})});}_0x550cd4=_['merge']({},_0x550cd4,_0x41fc3a[_0xd8ca('0x3e')]);var _0x445266={'where':_0x550cd4[_0xd8ca('0x3a')]};return db[_0xd8ca('0x3f')][_0xd8ca('0x1c')](_0x445266)['then'](function(_0x2b2ea2){_0x27f595[_0xd8ca('0x1c')]=_0x2b2ea2;if(_0x41fc3a[_0xd8ca('0x31')][_0xd8ca('0x40')]){_0x550cd4[_0xd8ca('0x41')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0xd8ca('0x42')](_0x550cd4);})[_0xd8ca('0x23')](function(_0x132cb7){_0x27f595[_0xd8ca('0x43')]=_0x132cb7;return _0x27f595;})[_0xd8ca('0x23')](respondWithFilteredResult(_0x388899,_0x550cd4))[_0xd8ca('0x44')](handleError(_0x388899,null));};exports[_0xd8ca('0x45')]=function(_0x5f104e,_0x5f14a6){var _0xaefade={'raw':!![],'where':{'id':_0x5f104e[_0xd8ca('0x46')]['id']}},_0x245cd8={};_0x245cd8[_0xd8ca('0x2f')]=_[_0xd8ca('0x32')](db[_0xd8ca('0x3f')]['rawAttributes']);_0x245cd8[_0xd8ca('0x31')]=_['keys'](_0x5f104e[_0xd8ca('0x31')]);_0x245cd8[_0xd8ca('0x3b')]=_[_0xd8ca('0x33')](_0x245cd8[_0xd8ca('0x2f')],_0x245cd8[_0xd8ca('0x31')]);_0xaefade[_0xd8ca('0x34')]=_[_0xd8ca('0x33')](_0x245cd8['model'],qs[_0xd8ca('0x35')](_0x5f104e[_0xd8ca('0x31')][_0xd8ca('0x35')]));_0xaefade['attributes']=_0xaefade['attributes']['length']?_0xaefade['attributes']:_0x245cd8[_0xd8ca('0x2f')];if(_0x5f104e['query'][_0xd8ca('0x40')]){_0xaefade[_0xd8ca('0x41')]=[{'all':!![]}];}_0xaefade=_[_0xd8ca('0x3d')]({},_0xaefade,_0x5f104e['options']);return db[_0xd8ca('0x3f')][_0xd8ca('0x47')](_0xaefade)['then'](handleEntityNotFound(_0x5f14a6,null))[_0xd8ca('0x23')](respondWithResult(_0x5f14a6,null))['catch'](handleError(_0x5f14a6,null));};exports[_0xd8ca('0x48')]=function(_0x358da2,_0xc0d52b){return db['AnalyticExtractedReport'][_0xd8ca('0x48')](_0x358da2[_0xd8ca('0x49')],{})[_0xd8ca('0x23')](function(_0x5c6974){var _0x328a34=_0x358da2[_0xd8ca('0x4a')][_0xd8ca('0x25')]({'plain':!![]});if(!_0x328a34)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x328a34[_0xd8ca('0x4b')]===_0xd8ca('0x4a')){var _0x7acba7=_0x5c6974[_0xd8ca('0x25')]({'plain':!![]});var _0x38bbd5='ExtractedReports';return db['UserProfileSection'][_0xd8ca('0x47')]({'where':{'name':_0x38bbd5,'userProfileId':_0x328a34[_0xd8ca('0x4c')]},'raw':!![]})[_0xd8ca('0x23')](function(_0x329a8f){if(_0x329a8f&&_0x329a8f[_0xd8ca('0x4d')]===0x0){return db[_0xd8ca('0x27')]['create']({'name':_0x7acba7[_0xd8ca('0x2a')],'resourceId':_0x7acba7['id'],'type':_0x329a8f[_0xd8ca('0x2a')],'sectionId':_0x329a8f['id']},{})[_0xd8ca('0x23')](function(){return _0x5c6974;});}else{return _0x5c6974;}})[_0xd8ca('0x44')](function(_0x21de3a){logger['error'](_0xd8ca('0x4e'),_0x21de3a);throw _0x21de3a;});}return _0x5c6974;})[_0xd8ca('0x23')](respondWithResult(_0xc0d52b,0xc9))['catch'](handleError(_0xc0d52b,null));};exports[_0xd8ca('0x22')]=function(_0x12ae8f,_0x12a5ac){if(_0x12ae8f['body']['id']){delete _0x12ae8f[_0xd8ca('0x49')]['id'];}return db[_0xd8ca('0x3f')][_0xd8ca('0x47')]({'where':{'id':_0x12ae8f[_0xd8ca('0x46')]['id']}})[_0xd8ca('0x23')](handleEntityNotFound(_0x12a5ac,null))[_0xd8ca('0x23')](saveUpdates(_0x12ae8f['body'],null))[_0xd8ca('0x23')](respondWithResult(_0x12a5ac,null))[_0xd8ca('0x44')](handleError(_0x12a5ac,null));};exports[_0xd8ca('0x24')]=function(_0xd6c777,_0x362bea){return db['AnalyticExtractedReport'][_0xd8ca('0x47')]({'where':{'id':_0xd6c777[_0xd8ca('0x46')]['id']}})['then'](handleEntityNotFound(_0x362bea,null))[_0xd8ca('0x23')](removeEntity(_0x362bea,null))['catch'](handleError(_0x362bea,null));};exports[_0xd8ca('0x4f')]=function(_0x4bb60c,_0x574d69,_0x12d601){return db[_0xd8ca('0x3f')][_0xd8ca('0x47')]({'where':{'id':_0x4bb60c[_0xd8ca('0x46')]['id']},'attributes':[_0xd8ca('0x2a'),'basename',_0xd8ca('0x50'),_0xd8ca('0x51')],'raw':!![]})[_0xd8ca('0x23')](handleEntityNotFound(_0x574d69,null))[_0xd8ca('0x23')](function(_0x1dec80){if(_0x1dec80){if(!fs[_0xd8ca('0x52')](path[_0xd8ca('0x53')](config[_0xd8ca('0x54')],_0xd8ca('0x55'),_0x1dec80[_0xd8ca('0x50')]))){throw new db[(_0xd8ca('0x56'))][(_0xd8ca('0x57'))](_0xd8ca('0x58'));}if(_0x4bb60c[_0xd8ca('0x31')][_0xd8ca('0x59')]){return _0x574d69[_0xd8ca('0x29')](0xc8);}return _0x574d69['download'](path[_0xd8ca('0x53')](config[_0xd8ca('0x54')],_0xd8ca('0x55'),_0x1dec80['savename']),util[_0xd8ca('0x5a')](_0xd8ca('0x5b'),_0x1dec80[_0xd8ca('0x5c')]||_0x1dec80[_0xd8ca('0x2a')],_0x1dec80[_0xd8ca('0x51')][_0xd8ca('0x5d')]()));}})[_0xd8ca('0x44')](handleError(_0x574d69,null));}; \ No newline at end of file +var _0x38dc=['output','existsSync','root','server/files/reports','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','format','%s.%s','toLowerCase','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','filter','merge','where','options','includeAll','include','rows','catch','show','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename'];(function(_0x3ec641,_0x2bb3b3){var _0xf002a2=function(_0x522f70){while(--_0x522f70){_0x3ec641['push'](_0x3ec641['shift']());}};_0xf002a2(++_0x2bb3b3);}(_0x38dc,0x6b));var _0xc38d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x38dc[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc38d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc38d('0x1'));var moment=require(_0xc38d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xc38d('0x3'));var util=require(_0xc38d('0x4'));var path=require(_0xc38d('0x5'));var sox=require(_0xc38d('0x6'));var csv=require(_0xc38d('0x7'));var ejs=require(_0xc38d('0x8'));var fs=require('fs');var fs_extra=require(_0xc38d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc38d('0xa'));var jsforce=require(_0xc38d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc38d('0x7'));var querystring=require(_0xc38d('0xc'));var Papa=require(_0xc38d('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc38d('0xe'));var as=require(_0xc38d('0xf'));var hardwareService=require(_0xc38d('0x10'));var logger=require(_0xc38d('0x11'))('api');var utils=require(_0xc38d('0x12'));var config=require(_0xc38d('0x13'));var licenseUtil=require(_0xc38d('0x14'));var db=require(_0xc38d('0x15'))['db'];function respondWithStatusCode(_0x2748c1,_0x29c85d){_0x29c85d=_0x29c85d||0xcc;return function(_0x5a689c){if(_0x5a689c){return _0x2748c1['sendStatus'](_0x29c85d);}return _0x2748c1[_0xc38d('0x16')](_0x29c85d)[_0xc38d('0x17')]();};}function respondWithResult(_0x19cd72,_0x1d40df){_0x1d40df=_0x1d40df||0xc8;return function(_0x2c239f){if(_0x2c239f){return _0x19cd72[_0xc38d('0x16')](_0x1d40df)[_0xc38d('0x18')](_0x2c239f);}};}function respondWithFilteredResult(_0x3460d9,_0x3aded6){return function(_0x1a78f3){if(_0x1a78f3){var _0x35864b=typeof _0x3aded6[_0xc38d('0x19')]===_0xc38d('0x1a')&&typeof _0x3aded6[_0xc38d('0x1b')]===_0xc38d('0x1a');var _0x5bd11c=_0x1a78f3[_0xc38d('0x1c')];var _0x5d4b27=_0x35864b?0x0:_0x3aded6[_0xc38d('0x19')];var _0x1d0c2b=_0x35864b?_0x1a78f3['count']:_0x3aded6[_0xc38d('0x19')]+_0x3aded6['limit'];var _0x424b74;if(_0x1d0c2b>=_0x5bd11c){_0x1d0c2b=_0x5bd11c;_0x424b74=0xc8;}else{_0x424b74=0xce;}_0x3460d9[_0xc38d('0x16')](_0x424b74);return _0x3460d9[_0xc38d('0x1d')]('Content-Range',_0x5d4b27+'-'+_0x1d0c2b+'/'+_0x5bd11c)[_0xc38d('0x18')](_0x1a78f3);}return null;};}function patchUpdates(_0x1a671f){return function(_0x1ad239){try{jsonpatch[_0xc38d('0x1e')](_0x1ad239,_0x1a671f,!![]);}catch(_0xf29bc8){return BPromise[_0xc38d('0x1f')](_0xf29bc8);}return _0x1ad239[_0xc38d('0x20')]();};}function saveUpdates(_0x4ced7f,_0x549d07){return function(_0x5b525a){if(_0x5b525a){return _0x5b525a[_0xc38d('0x21')](_0x4ced7f)[_0xc38d('0x22')](function(_0xcabdc7){return _0xcabdc7;});}return null;};}function removeEntity(_0x3a088b,_0x3c14f1){return function(_0x1fd785){if(_0x1fd785){return _0x1fd785['destroy']()['then'](function(){var _0x28a810=_0x1fd785[_0xc38d('0x23')]({'plain':!![]});var _0x26e487=_0xc38d('0x24');return db[_0xc38d('0x25')][_0xc38d('0x26')]({'where':{'type':_0x26e487,'resourceId':_0x28a810['id']}})[_0xc38d('0x22')](function(){return _0x1fd785;});})[_0xc38d('0x22')](function(){_0x3a088b[_0xc38d('0x16')](0xcc)[_0xc38d('0x17')]();});}};}function handleEntityNotFound(_0x333965,_0x40b869){return function(_0x538acb){if(!_0x538acb){_0x333965[_0xc38d('0x27')](0x194);}return _0x538acb;};}function handleError(_0x135974,_0x53152f){_0x53152f=_0x53152f||0x1f4;return function(_0x2c5612){logger[_0xc38d('0x28')](_0x2c5612[_0xc38d('0x29')]);if(_0x2c5612[_0xc38d('0x2a')]){delete _0x2c5612[_0xc38d('0x2a')];}_0x135974[_0xc38d('0x16')](_0x53152f)[_0xc38d('0x2b')](_0x2c5612);};}exports[_0xc38d('0x2c')]=function(_0x862e3,_0x493ca7){var _0x4aeada={},_0xa6f4c7={},_0x56a1b4={'count':0x0,'rows':[]};var _0x3b15d3=_[_0xc38d('0x2d')](db[_0xc38d('0x2e')][_0xc38d('0x2f')],function(_0x2f3410){return{'name':_0x2f3410[_0xc38d('0x30')],'type':_0x2f3410[_0xc38d('0x31')][_0xc38d('0x32')]};});_0xa6f4c7[_0xc38d('0x33')]=_[_0xc38d('0x2d')](_0x3b15d3,_0xc38d('0x2a'));_0xa6f4c7[_0xc38d('0x34')]=_[_0xc38d('0x35')](_0x862e3[_0xc38d('0x34')]);_0xa6f4c7[_0xc38d('0x36')]=_['intersection'](_0xa6f4c7['model'],_0xa6f4c7[_0xc38d('0x34')]);_0x4aeada[_0xc38d('0x37')]=_['intersection'](_0xa6f4c7['model'],qs['fields'](_0x862e3[_0xc38d('0x34')][_0xc38d('0x38')]));_0x4aeada[_0xc38d('0x37')]=_0x4aeada[_0xc38d('0x37')][_0xc38d('0x39')]?_0x4aeada[_0xc38d('0x37')]:_0xa6f4c7[_0xc38d('0x33')];if(!_0x862e3[_0xc38d('0x34')][_0xc38d('0x3a')]('nolimit')){_0x4aeada[_0xc38d('0x1b')]=qs[_0xc38d('0x1b')](_0x862e3[_0xc38d('0x34')][_0xc38d('0x1b')]);_0x4aeada[_0xc38d('0x19')]=qs[_0xc38d('0x19')](_0x862e3['query'][_0xc38d('0x19')]);}_0x4aeada['order']=qs['sort'](_0x862e3[_0xc38d('0x34')][_0xc38d('0x3b')]);_0x4aeada['where']=qs['filters'](_['pick'](_0x862e3[_0xc38d('0x34')],_0xa6f4c7[_0xc38d('0x36')]),_0x3b15d3);if(_0x862e3[_0xc38d('0x34')][_0xc38d('0x3c')]){_0x4aeada['where']=_[_0xc38d('0x3d')](_0x4aeada[_0xc38d('0x3e')],{'$or':_[_0xc38d('0x2d')](_0x3b15d3,function(_0x25bc4a){if(_0x25bc4a[_0xc38d('0x31')]!=='VIRTUAL'){var _0x1e1ee7={};_0x1e1ee7[_0x25bc4a['name']]={'$like':'%'+_0x862e3['query'][_0xc38d('0x3c')]+'%'};return _0x1e1ee7;}})});}_0x4aeada=_[_0xc38d('0x3d')]({},_0x4aeada,_0x862e3[_0xc38d('0x3f')]);var _0x41b919={'where':_0x4aeada['where']};return db[_0xc38d('0x2e')]['count'](_0x41b919)[_0xc38d('0x22')](function(_0x9d10a7){_0x56a1b4[_0xc38d('0x1c')]=_0x9d10a7;if(_0x862e3[_0xc38d('0x34')][_0xc38d('0x40')]){_0x4aeada[_0xc38d('0x41')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x4aeada);})['then'](function(_0x329f80){_0x56a1b4[_0xc38d('0x42')]=_0x329f80;return _0x56a1b4;})['then'](respondWithFilteredResult(_0x493ca7,_0x4aeada))[_0xc38d('0x43')](handleError(_0x493ca7,null));};exports[_0xc38d('0x44')]=function(_0x2297c9,_0x22c683){var _0x4bdf08={'raw':!![],'where':{'id':_0x2297c9[_0xc38d('0x45')]['id']}},_0x44ad38={};_0x44ad38['model']=_[_0xc38d('0x35')](db['AnalyticExtractedReport'][_0xc38d('0x2f')]);_0x44ad38[_0xc38d('0x34')]=_['keys'](_0x2297c9['query']);_0x44ad38['filters']=_['intersection'](_0x44ad38[_0xc38d('0x33')],_0x44ad38['query']);_0x4bdf08[_0xc38d('0x37')]=_[_0xc38d('0x46')](_0x44ad38[_0xc38d('0x33')],qs['fields'](_0x2297c9['query'][_0xc38d('0x38')]));_0x4bdf08['attributes']=_0x4bdf08['attributes']['length']?_0x4bdf08[_0xc38d('0x37')]:_0x44ad38[_0xc38d('0x33')];if(_0x2297c9['query']['includeAll']){_0x4bdf08[_0xc38d('0x41')]=[{'all':!![]}];}_0x4bdf08=_[_0xc38d('0x3d')]({},_0x4bdf08,_0x2297c9[_0xc38d('0x3f')]);return db[_0xc38d('0x2e')]['find'](_0x4bdf08)[_0xc38d('0x22')](handleEntityNotFound(_0x22c683,null))[_0xc38d('0x22')](respondWithResult(_0x22c683,null))[_0xc38d('0x43')](handleError(_0x22c683,null));};exports[_0xc38d('0x47')]=function(_0x59e975,_0x19d6bd){return db[_0xc38d('0x2e')][_0xc38d('0x47')](_0x59e975[_0xc38d('0x48')],{})[_0xc38d('0x22')](function(_0x2072c2){var _0x1177a6=_0x59e975[_0xc38d('0x49')][_0xc38d('0x23')]({'plain':!![]});if(!_0x1177a6)throw new Error(_0xc38d('0x4a'));if(_0x1177a6[_0xc38d('0x4b')]===_0xc38d('0x49')){var _0x2fb257=_0x2072c2[_0xc38d('0x23')]({'plain':!![]});var _0x36a18a='ExtractedReports';return db[_0xc38d('0x4c')][_0xc38d('0x4d')]({'where':{'name':_0x36a18a,'userProfileId':_0x1177a6[_0xc38d('0x4e')]},'raw':!![]})[_0xc38d('0x22')](function(_0x55f06a){if(_0x55f06a&&_0x55f06a[_0xc38d('0x4f')]===0x0){return db['UserProfileResource'][_0xc38d('0x47')]({'name':_0x2fb257[_0xc38d('0x2a')],'resourceId':_0x2fb257['id'],'type':_0x55f06a['name'],'sectionId':_0x55f06a['id']},{})[_0xc38d('0x22')](function(){return _0x2072c2;});}else{return _0x2072c2;}})[_0xc38d('0x43')](function(_0x46627a){logger[_0xc38d('0x28')](_0xc38d('0x50'),_0x46627a);throw _0x46627a;});}return _0x2072c2;})[_0xc38d('0x22')](respondWithResult(_0x19d6bd,0xc9))['catch'](handleError(_0x19d6bd,null));};exports[_0xc38d('0x21')]=function(_0x181ae8,_0x2f0179){if(_0x181ae8[_0xc38d('0x48')]['id']){delete _0x181ae8[_0xc38d('0x48')]['id'];}return db[_0xc38d('0x2e')]['find']({'where':{'id':_0x181ae8[_0xc38d('0x45')]['id']}})[_0xc38d('0x22')](handleEntityNotFound(_0x2f0179,null))['then'](saveUpdates(_0x181ae8[_0xc38d('0x48')],null))['then'](respondWithResult(_0x2f0179,null))[_0xc38d('0x43')](handleError(_0x2f0179,null));};exports[_0xc38d('0x26')]=function(_0x5661d5,_0x48c19d){return db[_0xc38d('0x2e')][_0xc38d('0x4d')]({'where':{'id':_0x5661d5[_0xc38d('0x45')]['id']}})['then'](handleEntityNotFound(_0x48c19d,null))[_0xc38d('0x22')](removeEntity(_0x48c19d,null))[_0xc38d('0x43')](handleError(_0x48c19d,null));};exports[_0xc38d('0x51')]=function(_0x1966ca,_0x59ca25,_0x3f5cef){return db[_0xc38d('0x2e')][_0xc38d('0x4d')]({'where':{'id':_0x1966ca[_0xc38d('0x45')]['id']},'attributes':[_0xc38d('0x2a'),_0xc38d('0x52'),'savename',_0xc38d('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x59ca25,null))[_0xc38d('0x22')](function(_0x3fd820){if(_0x3fd820){if(!fs[_0xc38d('0x54')](path['join'](config[_0xc38d('0x55')],_0xc38d('0x56'),_0x3fd820[_0xc38d('0x57')]))){throw new db[(_0xc38d('0x58'))][(_0xc38d('0x59'))](_0xc38d('0x5a'));}if(_0x1966ca[_0xc38d('0x34')]['exists']){return _0x59ca25[_0xc38d('0x27')](0xc8);}return _0x59ca25[_0xc38d('0x51')](path[_0xc38d('0x5b')](config['root'],'server/files/reports',_0x3fd820[_0xc38d('0x57')]),util[_0xc38d('0x5c')](_0xc38d('0x5d'),_0x3fd820[_0xc38d('0x52')]||_0x3fd820[_0xc38d('0x2a')],_0x3fd820[_0xc38d('0x53')][_0xc38d('0x5e')]()));}})[_0xc38d('0x43')](handleError(_0x59ca25,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 21c97bd..ca64a8e 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 _0xa910=['request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','moment','bluebird'];(function(_0x2d770f,_0x1dc91a){var _0x39f6cb=function(_0x1c6e83){while(--_0x1c6e83){_0x2d770f['push'](_0x2d770f['shift']());}};_0x39f6cb(++_0x1dc91a);}(_0xa910,0xb0));var _0x0a91=function(_0x637b74,_0x2e00e3){_0x637b74=_0x637b74-0x0;var _0x55b175=_0xa910[_0x637b74];return _0x55b175;};'use strict';var _=require(_0x0a91('0x0'));var util=require(_0x0a91('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a91('0x2'));var BPromise=require(_0x0a91('0x3'));var rp=require(_0x0a91('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a91('0x5'));var config=require(_0x0a91('0x6'));var attributes=require(_0x0a91('0x7'));module[_0x0a91('0x8')]=function(_0x221de8,_0x51dc2c){return _0x221de8[_0x0a91('0x9')](_0x0a91('0xa'),attributes,{'tableName':_0x0a91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe91b=['../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x119ef1,_0x17c4e5){var _0x33fcc5=function(_0x3fada2){while(--_0x3fada2){_0x119ef1['push'](_0x119ef1['shift']());}};_0x33fcc5(++_0x17c4e5);}(_0xe91b,0x101));var _0xbe91=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0xe91b[_0x467cb0];return _0x2153f7;};'use strict';var _=require(_0xbe91('0x0'));var util=require(_0xbe91('0x1'));var logger=require(_0xbe91('0x2'))(_0xbe91('0x3'));var moment=require(_0xbe91('0x4'));var BPromise=require(_0xbe91('0x5'));var rp=require(_0xbe91('0x6'));var fs=require('fs');var path=require(_0xbe91('0x7'));var rimraf=require(_0xbe91('0x8'));var config=require(_0xbe91('0x9'));var attributes=require(_0xbe91('0xa'));module[_0xbe91('0xb')]=function(_0x339b24,_0x5774bf){return _0x339b24[_0xbe91('0xc')]('AnalyticExtractedReport',attributes,{'tableName':_0xbe91('0xd'),'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 c496512..d8acdd4 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 _0x6f75=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x6f75,0x71));var _0x56f7=function(_0x5506d5,_0xb4387f){_0x5506d5=_0x5506d5-0x0;var _0x317210=_0x6f75[_0x5506d5];return _0x317210;};'use strict';var _=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var moment=require(_0x56f7('0x2'));var BPromise=require(_0x56f7('0x3'));var rs=require(_0x56f7('0x4'));var fs=require('fs');var Redis=require(_0x56f7('0x5'));var db=require(_0x56f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56f7('0x7'))(_0x56f7('0x8'));var config=require(_0x56f7('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x137d14,_0xcc51b1,_0x4b5dcc){return new BPromise(function(_0x184bf7,_0x5155ff){return client['request'](_0x137d14,_0x4b5dcc)[_0x56f7('0xa')](function(_0x1e607c){logger[_0x56f7('0xb')](_0x56f7('0xc'),_0xcc51b1,_0x56f7('0xd'));logger[_0x56f7('0xe')](_0x56f7('0xf'),_0xcc51b1,_0x56f7('0xd'),JSON[_0x56f7('0x10')](_0x1e607c));if(_0x1e607c[_0x56f7('0x11')]){if(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x12')]===0x1f4){logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c['error'][_0x56f7('0x13')]);return _0x5155ff(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);return _0x184bf7(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0xcc51b1,_0x56f7('0xd'));_0x184bf7(_0x1e607c[_0x56f7('0x14')][_0x56f7('0x13')]);}})[_0x56f7('0x15')](function(_0x40fb77){logger[_0x56f7('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xcc51b1,_0x40fb77);_0x5155ff(_0x40fb77);});});} \ No newline at end of file +var _0xa9ba=['stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent'];(function(_0x7a97e0,_0x24151f){var _0x180320=function(_0x33b1d1){while(--_0x33b1d1){_0x7a97e0['push'](_0x7a97e0['shift']());}};_0x180320(++_0x24151f);}(_0xa9ba,0x16e));var _0xaa9b=function(_0x9d7196,_0x2155ab){_0x9d7196=_0x9d7196-0x0;var _0x15a2eb=_0xa9ba[_0x9d7196];return _0x15a2eb;};'use strict';var _=require('lodash');var util=require(_0xaa9b('0x0'));var moment=require(_0xaa9b('0x1'));var BPromise=require(_0xaa9b('0x2'));var rs=require(_0xaa9b('0x3'));var fs=require('fs');var Redis=require(_0xaa9b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa9b('0x5'));var logger=require(_0xaa9b('0x6'))(_0xaa9b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xaa9b('0x8')][_0xaa9b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd0d065,_0x56f41d,_0x3cc80f){return new BPromise(function(_0x18f8fd,_0x4638f2){return client[_0xaa9b('0xa')](_0xd0d065,_0x3cc80f)['then'](function(_0x4b338d){logger[_0xaa9b('0xb')](_0xaa9b('0xc'),_0x56f41d,'request\x20sent');logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x56f41d,_0xaa9b('0xd'),JSON[_0xaa9b('0xe')](_0x4b338d));if(_0x4b338d[_0xaa9b('0xf')]){if(_0x4b338d[_0xaa9b('0xf')]['code']===0x1f4){logger[_0xaa9b('0xf')](_0xaa9b('0xc'),_0x56f41d,_0x4b338d[_0xaa9b('0xf')]['message']);return _0x4638f2(_0x4b338d['error'][_0xaa9b('0x10')]);}logger[_0xaa9b('0xf')](_0xaa9b('0xc'),_0x56f41d,_0x4b338d[_0xaa9b('0xf')][_0xaa9b('0x10')]);return _0x18f8fd(_0x4b338d['error'][_0xaa9b('0x10')]);}else{logger[_0xaa9b('0xb')](_0xaa9b('0xc'),_0x56f41d,_0xaa9b('0xd'));_0x18f8fd(_0x4b338d[_0xaa9b('0x11')][_0xaa9b('0x10')]);}})[_0xaa9b('0x12')](function(_0x26fa6d){logger['error'](_0xaa9b('0xc'),_0x56f41d,_0x26fa6d);_0x4638f2(_0x26fa6d);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 4fc9767..16dffc5 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 _0xb9e1=['./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','download','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9e1,0x1ef));var _0x1b9e=function(_0x2c50e4,_0x15cd2f){_0x2c50e4=_0x2c50e4-0x0;var _0x474118=_0xb9e1[_0x2c50e4];return _0x474118;};'use strict';var multer=require(_0x1b9e('0x0'));var util=require(_0x1b9e('0x1'));var path=require(_0x1b9e('0x2'));var timeout=require(_0x1b9e('0x3'));var express=require(_0x1b9e('0x4'));var router=express['Router']();var fs_extra=require(_0x1b9e('0x5'));var auth=require(_0x1b9e('0x6'));var interaction=require(_0x1b9e('0x7'));var config=require(_0x1b9e('0x8'));var controller=require(_0x1b9e('0x9'));router[_0x1b9e('0xa')]('/',auth[_0x1b9e('0xb')](),controller[_0x1b9e('0xc')]);router['get'](_0x1b9e('0xd'),auth['isAuthenticated'](),controller[_0x1b9e('0xe')]);router[_0x1b9e('0xa')]('/:id/download',auth[_0x1b9e('0xb')](),controller[_0x1b9e('0xf')]);router[_0x1b9e('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1b9e('0x11')](_0x1b9e('0xd'),auth[_0x1b9e('0xb')](),controller['update']);router[_0x1b9e('0x12')](_0x1b9e('0xd'),auth[_0x1b9e('0xb')](),controller[_0x1b9e('0x13')]);module[_0x1b9e('0x14')]=router; \ No newline at end of file +var _0x4b45=['show','/:id/download','download','post','/:id','update','destroy','exports','util','path','connect-timeout','Router','get','isAuthenticated'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x4b45,0x19e));var _0x54b4=function(_0x47a618,_0x1252bc){_0x47a618=_0x47a618-0x0;var _0x5840f5=_0x4b45[_0x47a618];return _0x5840f5;};'use strict';var multer=require('multer');var util=require(_0x54b4('0x0'));var path=require(_0x54b4('0x1'));var timeout=require(_0x54b4('0x2'));var express=require('express');var router=express[_0x54b4('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x54b4('0x4')]('/',auth[_0x54b4('0x5')](),controller['index']);router[_0x54b4('0x4')]('/:id',auth[_0x54b4('0x5')](),controller[_0x54b4('0x6')]);router[_0x54b4('0x4')](_0x54b4('0x7'),auth[_0x54b4('0x5')](),controller[_0x54b4('0x8')]);router[_0x54b4('0x9')]('/',auth[_0x54b4('0x5')](),controller['create']);router['put'](_0x54b4('0xa'),auth[_0x54b4('0x5')](),controller[_0x54b4('0xb')]);router['delete'](_0x54b4('0xa'),auth[_0x54b4('0x5')](),controller[_0x54b4('0xc')]);module[_0x54b4('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index a7d43a0..e466d93 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 _0x7020=['STRING','BOOLEAN','TEXT'];(function(_0x1868b5,_0x1f4ad9){var _0x4015d4=function(_0x4a0c17){while(--_0x4a0c17){_0x1868b5['push'](_0x1868b5['shift']());}};_0x4015d4(++_0x1f4ad9);}(_0x7020,0x10a));var _0x0702=function(_0x49f03a,_0x45a3fb){_0x49f03a=_0x49f03a-0x0;var _0x284369=_0x7020[_0x49f03a];return _0x284369;};'use strict';var Sequelize=require('sequelize');module['exports']={'field':{'type':Sequelize[_0x0702('0x0')]},'alias':{'type':Sequelize[_0x0702('0x1')]},'function':{'type':Sequelize[_0x0702('0x1')]},'format':{'type':Sequelize[_0x0702('0x1')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0702('0x1')]},'custom':{'type':Sequelize[_0x0702('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd102=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd102,0xf8));var _0x2d10=function(_0x4fab09,_0x2e343b){_0x4fab09=_0x4fab09-0x0;var _0xf457df=_0xd102[_0x4fab09];return _0xf457df;};'use strict';var Sequelize=require(_0x2d10('0x0'));module[_0x2d10('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x2d10('0x2')]},'format':{'type':Sequelize[_0x2d10('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x2d10('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index edb25d4..e59b12c 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 _0x3e1f=['create','body','bulkCreate','destroy','bulkDestroy','transaction','CustomReportId','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find'];(function(_0x42ce54,_0xec4416){var _0x588616=function(_0x4a6b6c){while(--_0x4a6b6c){_0x42ce54['push'](_0x42ce54['shift']());}};_0x588616(++_0xec4416);}(_0x3e1f,0xeb));var _0xf3e1=function(_0x4f0c2b,_0x2c9d14){_0x4f0c2b=_0x4f0c2b-0x0;var _0x526436=_0x3e1f[_0x4f0c2b];return _0x526436;};'use strict';var emlformat=require(_0xf3e1('0x0'));var rimraf=require(_0xf3e1('0x1'));var zipdir=require(_0xf3e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf3e1('0x3'));var BPromise=require(_0xf3e1('0x4'));var Mustache=require(_0xf3e1('0x5'));var util=require(_0xf3e1('0x6'));var path=require('path');var sox=require(_0xf3e1('0x7'));var csv=require(_0xf3e1('0x8'));var ejs=require(_0xf3e1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf3e1('0xa'));var squel=require('squel');var crypto=require(_0xf3e1('0xb'));var jsforce=require(_0xf3e1('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf3e1('0x8'));var querystring=require('querystring');var Papa=require(_0xf3e1('0xd'));var Redis=require(_0xf3e1('0xe'));var authService=require(_0xf3e1('0xf'));var qs=require(_0xf3e1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3e1('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf3e1('0x12'));var config=require(_0xf3e1('0x13'));var licenseUtil=require(_0xf3e1('0x14'));var db=require(_0xf3e1('0x15'))['db'];function respondWithStatusCode(_0x217fa0,_0x9d9b1){_0x9d9b1=_0x9d9b1||0xcc;return function(_0x257b20){if(_0x257b20){return _0x217fa0[_0xf3e1('0x16')](_0x9d9b1);}return _0x217fa0[_0xf3e1('0x17')](_0x9d9b1)[_0xf3e1('0x18')]();};}function respondWithResult(_0x58414d,_0x1f07f3){_0x1f07f3=_0x1f07f3||0xc8;return function(_0x4663e2){if(_0x4663e2){return _0x58414d['status'](_0x1f07f3)[_0xf3e1('0x19')](_0x4663e2);}};}function respondWithFilteredResult(_0x36438d,_0x45ac17){return function(_0x97e6a2){if(_0x97e6a2){var _0x557488=typeof _0x45ac17[_0xf3e1('0x1a')]===_0xf3e1('0x1b')&&typeof _0x45ac17[_0xf3e1('0x1c')]===_0xf3e1('0x1b');var _0x1f35a5=_0x97e6a2['count'];var _0x1d8df9=_0x557488?0x0:_0x45ac17[_0xf3e1('0x1a')];var _0x1525ea=_0x557488?_0x97e6a2[_0xf3e1('0x1d')]:_0x45ac17[_0xf3e1('0x1a')]+_0x45ac17[_0xf3e1('0x1c')];var _0x7948;if(_0x1525ea>=_0x1f35a5){_0x1525ea=_0x1f35a5;_0x7948=0xc8;}else{_0x7948=0xce;}_0x36438d[_0xf3e1('0x17')](_0x7948);return _0x36438d[_0xf3e1('0x1e')](_0xf3e1('0x1f'),_0x1d8df9+'-'+_0x1525ea+'/'+_0x1f35a5)[_0xf3e1('0x19')](_0x97e6a2);}return null;};}function patchUpdates(_0x526872){return function(_0x510180){try{jsonpatch[_0xf3e1('0x20')](_0x510180,_0x526872,!![]);}catch(_0x53af95){return BPromise[_0xf3e1('0x21')](_0x53af95);}return _0x510180['save']();};}function saveUpdates(_0x1f7318,_0x173508){return function(_0x4994c9){if(_0x4994c9){return _0x4994c9[_0xf3e1('0x22')](_0x1f7318)['then'](function(_0x59278f){return _0x59278f;});}return null;};}function removeEntity(_0x1de7b7,_0x55b7ba){return function(_0x1e02ff){if(_0x1e02ff){return _0x1e02ff['destroy']()[_0xf3e1('0x23')](function(){_0x1de7b7[_0xf3e1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2192cc,_0x64c5a){return function(_0x522ba8){if(!_0x522ba8){_0x2192cc[_0xf3e1('0x16')](0x194);}return _0x522ba8;};}function handleError(_0x46d422,_0x2dc523){_0x2dc523=_0x2dc523||0x1f4;return function(_0x259c82){logger[_0xf3e1('0x24')](_0x259c82[_0xf3e1('0x25')]);if(_0x259c82[_0xf3e1('0x26')]){delete _0x259c82[_0xf3e1('0x26')];}_0x46d422[_0xf3e1('0x17')](_0x2dc523)[_0xf3e1('0x27')](_0x259c82);};}exports[_0xf3e1('0x28')]=function(_0x1f8150,_0x111320){var _0x32d9cf={},_0x103926={},_0x5e6bfa={'count':0x0,'rows':[]};var _0x2ffc4b=_[_0xf3e1('0x29')](db[_0xf3e1('0x2a')][_0xf3e1('0x2b')],function(_0x1eefb8){return{'name':_0x1eefb8[_0xf3e1('0x2c')],'type':_0x1eefb8['type'][_0xf3e1('0x2d')]};});_0x103926[_0xf3e1('0x2e')]=_[_0xf3e1('0x29')](_0x2ffc4b,_0xf3e1('0x26'));_0x103926[_0xf3e1('0x2f')]=_[_0xf3e1('0x30')](_0x1f8150[_0xf3e1('0x2f')]);_0x103926[_0xf3e1('0x31')]=_[_0xf3e1('0x32')](_0x103926[_0xf3e1('0x2e')],_0x103926['query']);_0x32d9cf[_0xf3e1('0x33')]=_[_0xf3e1('0x32')](_0x103926[_0xf3e1('0x2e')],qs[_0xf3e1('0x34')](_0x1f8150['query'][_0xf3e1('0x34')]));_0x32d9cf[_0xf3e1('0x33')]=_0x32d9cf['attributes'][_0xf3e1('0x35')]?_0x32d9cf[_0xf3e1('0x33')]:_0x103926['model'];if(!_0x1f8150[_0xf3e1('0x2f')]['hasOwnProperty'](_0xf3e1('0x36'))){_0x32d9cf[_0xf3e1('0x1c')]=qs['limit'](_0x1f8150['query']['limit']);_0x32d9cf[_0xf3e1('0x1a')]=qs[_0xf3e1('0x1a')](_0x1f8150[_0xf3e1('0x2f')][_0xf3e1('0x1a')]);}_0x32d9cf[_0xf3e1('0x37')]=qs[_0xf3e1('0x38')](_0x1f8150[_0xf3e1('0x2f')][_0xf3e1('0x38')]);_0x32d9cf['where']=qs[_0xf3e1('0x31')](_[_0xf3e1('0x39')](_0x1f8150[_0xf3e1('0x2f')],_0x103926[_0xf3e1('0x31')]),_0x2ffc4b);if(_0x1f8150[_0xf3e1('0x2f')][_0xf3e1('0x3a')]){_0x32d9cf[_0xf3e1('0x3b')]=_[_0xf3e1('0x3c')](_0x32d9cf[_0xf3e1('0x3b')],{'$or':_[_0xf3e1('0x29')](_0x2ffc4b,function(_0x1dd63d){if(_0x1dd63d['type']!==_0xf3e1('0x3d')){var _0x36c6ab={};_0x36c6ab[_0x1dd63d[_0xf3e1('0x26')]]={'$like':'%'+_0x1f8150[_0xf3e1('0x2f')][_0xf3e1('0x3a')]+'%'};return _0x36c6ab;}})});}_0x32d9cf=_[_0xf3e1('0x3c')]({},_0x32d9cf,_0x1f8150[_0xf3e1('0x3e')]);var _0x3e6ecb={'where':_0x32d9cf['where']};return db[_0xf3e1('0x2a')][_0xf3e1('0x1d')](_0x3e6ecb)['then'](function(_0x1c3749){_0x5e6bfa['count']=_0x1c3749;if(_0x1f8150[_0xf3e1('0x2f')][_0xf3e1('0x3f')]){_0x32d9cf['include']=[{'all':!![]}];}return db[_0xf3e1('0x2a')]['findAll'](_0x32d9cf);})[_0xf3e1('0x23')](function(_0x34fcc4){_0x5e6bfa[_0xf3e1('0x40')]=_0x34fcc4;return _0x5e6bfa;})[_0xf3e1('0x23')](respondWithFilteredResult(_0x111320,_0x32d9cf))[_0xf3e1('0x41')](handleError(_0x111320,null));};exports[_0xf3e1('0x42')]=function(_0xc5fc1a,_0x19d611){var _0x4bd7cd={'raw':![],'where':{'id':_0xc5fc1a[_0xf3e1('0x43')]['id']}},_0x408717={};_0x408717[_0xf3e1('0x2e')]=_[_0xf3e1('0x30')](db[_0xf3e1('0x2a')][_0xf3e1('0x2b')]);_0x408717['query']=_['keys'](_0xc5fc1a['query']);_0x408717[_0xf3e1('0x31')]=_['intersection'](_0x408717[_0xf3e1('0x2e')],_0x408717[_0xf3e1('0x2f')]);_0x4bd7cd['attributes']=_[_0xf3e1('0x32')](_0x408717[_0xf3e1('0x2e')],qs['fields'](_0xc5fc1a['query'][_0xf3e1('0x34')]));_0x4bd7cd[_0xf3e1('0x33')]=_0x4bd7cd[_0xf3e1('0x33')][_0xf3e1('0x35')]?_0x4bd7cd['attributes']:_0x408717[_0xf3e1('0x2e')];if(_0xc5fc1a[_0xf3e1('0x2f')][_0xf3e1('0x3f')]){_0x4bd7cd['include']=[{'all':!![]}];}_0x4bd7cd=_['merge']({},_0x4bd7cd,_0xc5fc1a[_0xf3e1('0x3e')]);return db['AnalyticFieldReport'][_0xf3e1('0x44')](_0x4bd7cd)['then'](handleEntityNotFound(_0x19d611,null))[_0xf3e1('0x23')](respondWithResult(_0x19d611,null))['catch'](handleError(_0x19d611,null));};exports[_0xf3e1('0x45')]=function(_0x5bdb07,_0x2b58ad){return db[_0xf3e1('0x2a')][_0xf3e1('0x45')](_0x5bdb07[_0xf3e1('0x46')],{})[_0xf3e1('0x23')](respondWithResult(_0x2b58ad,0xc9))[_0xf3e1('0x41')](handleError(_0x2b58ad,null));};exports[_0xf3e1('0x47')]=function(_0xa4982c,_0x2e4425){return db[_0xf3e1('0x2a')][_0xf3e1('0x47')](_0xa4982c[_0xf3e1('0x46')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2e4425,0xc9))['catch'](handleError(_0x2e4425,null));};exports[_0xf3e1('0x22')]=function(_0x237d69,_0x4df6b8){if(_0x237d69[_0xf3e1('0x46')]['id']){delete _0x237d69['body']['id'];}return db[_0xf3e1('0x2a')][_0xf3e1('0x44')]({'where':{'id':_0x237d69[_0xf3e1('0x43')]['id']}})[_0xf3e1('0x23')](handleEntityNotFound(_0x4df6b8,null))[_0xf3e1('0x23')](saveUpdates(_0x237d69[_0xf3e1('0x46')],null))[_0xf3e1('0x23')](respondWithResult(_0x4df6b8,null))[_0xf3e1('0x41')](handleError(_0x4df6b8,null));};exports[_0xf3e1('0x48')]=function(_0x29bcfb,_0x44eedd){return db[_0xf3e1('0x2a')]['find']({'where':{'id':_0x29bcfb[_0xf3e1('0x43')]['id']}})[_0xf3e1('0x23')](handleEntityNotFound(_0x44eedd,null))[_0xf3e1('0x23')](removeEntity(_0x44eedd,null))[_0xf3e1('0x41')](handleError(_0x44eedd,null));};exports[_0xf3e1('0x49')]=function(_0x48f779,_0x126bcd){return db[_0xf3e1('0x2a')][_0xf3e1('0x48')]({'where':{'id':_0x48f779[_0xf3e1('0x2f')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xf3e1('0x23')](respondWithResult(_0x126bcd,0xcc))[_0xf3e1('0x41')](handleError(_0x126bcd,null));};exports['addFields']=function(_0x4450c9,_0x2e354d,_0x566706){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x4450c9[_0xf3e1('0x43')]['id']}})[_0xf3e1('0x23')](handleEntityNotFound(_0x2e354d,null))['then'](function(_0x4946a6){if(_0x4946a6){return db['sequelize'][_0xf3e1('0x4a')](function(_0x3dd643){return db[_0xf3e1('0x2a')][_0xf3e1('0x48')]({'where':{'CustomReportId':_0x4450c9[_0xf3e1('0x43')]['id']},'transaction':_0x3dd643})['then'](function(_0x5915b9){var _0x3dfc5d=_['map'](_0x4450c9[_0xf3e1('0x46')],function(_0x17e660){delete _0x17e660['id'];_0x17e660[_0xf3e1('0x4b')]=_0x4450c9[_0xf3e1('0x43')]['id'];return _0x17e660;});return db[_0xf3e1('0x2a')]['bulkCreate'](_0x3dfc5d,{'transaction':_0x3dd643});});})[_0xf3e1('0x23')](function(){return db[_0xf3e1('0x2a')]['findAll']({'where':{'CustomReportId':_0x4450c9[_0xf3e1('0x43')]['id']}});});}})['then'](respondWithResult(_0x2e354d,null))[_0xf3e1('0x41')](handleError(_0x2e354d,null));}; \ No newline at end of file +var _0x19ee=['bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','findAll','rows','catch','show','params','include','create','body','bulkCreate','find','bulkDestroy','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','zip-dir'];(function(_0x4bc56e,_0x4f2fc0){var _0x29c230=function(_0x2068d2){while(--_0x2068d2){_0x4bc56e['push'](_0x4bc56e['shift']());}};_0x29c230(++_0x4f2fc0);}(_0x19ee,0xe1));var _0xe19e=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0x19ee[_0x118afa];return _0x167d76;};'use strict';var emlformat=require(_0xe19e('0x0'));var rimraf=require(_0xe19e('0x1'));var zipdir=require(_0xe19e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe19e('0x3'));var Mustache=require(_0xe19e('0x4'));var util=require('util');var path=require('path');var sox=require(_0xe19e('0x5'));var csv=require('to-csv');var ejs=require(_0xe19e('0x6'));var fs=require('fs');var fs_extra=require(_0xe19e('0x7'));var _=require(_0xe19e('0x8'));var squel=require('squel');var crypto=require(_0xe19e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe19e('0xa'));var toCsv=require(_0xe19e('0xb'));var querystring=require(_0xe19e('0xc'));var Papa=require('papaparse');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('../../config/license/hardware');var logger=require(_0xe19e('0xd'))(_0xe19e('0xe'));var utils=require('../../config/utils');var config=require(_0xe19e('0xf'));var licenseUtil=require(_0xe19e('0x10'));var db=require(_0xe19e('0x11'))['db'];function respondWithStatusCode(_0x3ab8df,_0x32585e){_0x32585e=_0x32585e||0xcc;return function(_0xe4e142){if(_0xe4e142){return _0x3ab8df[_0xe19e('0x12')](_0x32585e);}return _0x3ab8df['status'](_0x32585e)[_0xe19e('0x13')]();};}function respondWithResult(_0x371e43,_0x3e3152){_0x3e3152=_0x3e3152||0xc8;return function(_0x597f6e){if(_0x597f6e){return _0x371e43[_0xe19e('0x14')](_0x3e3152)[_0xe19e('0x15')](_0x597f6e);}};}function respondWithFilteredResult(_0x46e3d1,_0x394144){return function(_0x12c0ba){if(_0x12c0ba){var _0x3a066d=typeof _0x394144['offset']===_0xe19e('0x16')&&typeof _0x394144[_0xe19e('0x17')]===_0xe19e('0x16');var _0x5401c7=_0x12c0ba[_0xe19e('0x18')];var _0x2b5095=_0x3a066d?0x0:_0x394144[_0xe19e('0x19')];var _0x48617e=_0x3a066d?_0x12c0ba['count']:_0x394144['offset']+_0x394144['limit'];var _0x3f0051;if(_0x48617e>=_0x5401c7){_0x48617e=_0x5401c7;_0x3f0051=0xc8;}else{_0x3f0051=0xce;}_0x46e3d1[_0xe19e('0x14')](_0x3f0051);return _0x46e3d1[_0xe19e('0x1a')](_0xe19e('0x1b'),_0x2b5095+'-'+_0x48617e+'/'+_0x5401c7)['json'](_0x12c0ba);}return null;};}function patchUpdates(_0x573c5b){return function(_0x172319){try{jsonpatch[_0xe19e('0x1c')](_0x172319,_0x573c5b,!![]);}catch(_0xcb19c4){return BPromise[_0xe19e('0x1d')](_0xcb19c4);}return _0x172319[_0xe19e('0x1e')]();};}function saveUpdates(_0x17d568,_0x423020){return function(_0x17a621){if(_0x17a621){return _0x17a621['update'](_0x17d568)['then'](function(_0x550c42){return _0x550c42;});}return null;};}function removeEntity(_0x483901,_0x3b8d65){return function(_0x1fee81){if(_0x1fee81){return _0x1fee81[_0xe19e('0x1f')]()[_0xe19e('0x20')](function(){_0x483901[_0xe19e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x101899,_0x2b2a09){return function(_0x25840a){if(!_0x25840a){_0x101899[_0xe19e('0x12')](0x194);}return _0x25840a;};}function handleError(_0xd5e757,_0xd8cffb){_0xd8cffb=_0xd8cffb||0x1f4;return function(_0x14ca7d){logger[_0xe19e('0x21')](_0x14ca7d[_0xe19e('0x22')]);if(_0x14ca7d[_0xe19e('0x23')]){delete _0x14ca7d[_0xe19e('0x23')];}_0xd5e757['status'](_0xd8cffb)[_0xe19e('0x24')](_0x14ca7d);};}exports[_0xe19e('0x25')]=function(_0x1bb022,_0x515c3f){var _0x3f0145={},_0x4bf47a={},_0x5d4541={'count':0x0,'rows':[]};var _0x40160d=_[_0xe19e('0x26')](db[_0xe19e('0x27')][_0xe19e('0x28')],function(_0x2d85ed){return{'name':_0x2d85ed[_0xe19e('0x29')],'type':_0x2d85ed['type'][_0xe19e('0x2a')]};});_0x4bf47a['model']=_[_0xe19e('0x26')](_0x40160d,_0xe19e('0x23'));_0x4bf47a[_0xe19e('0x2b')]=_[_0xe19e('0x2c')](_0x1bb022['query']);_0x4bf47a[_0xe19e('0x2d')]=_[_0xe19e('0x2e')](_0x4bf47a['model'],_0x4bf47a['query']);_0x3f0145['attributes']=_[_0xe19e('0x2e')](_0x4bf47a[_0xe19e('0x2f')],qs['fields'](_0x1bb022['query'][_0xe19e('0x30')]));_0x3f0145[_0xe19e('0x31')]=_0x3f0145[_0xe19e('0x31')][_0xe19e('0x32')]?_0x3f0145['attributes']:_0x4bf47a[_0xe19e('0x2f')];if(!_0x1bb022[_0xe19e('0x2b')]['hasOwnProperty'](_0xe19e('0x33'))){_0x3f0145[_0xe19e('0x17')]=qs['limit'](_0x1bb022[_0xe19e('0x2b')]['limit']);_0x3f0145[_0xe19e('0x19')]=qs[_0xe19e('0x19')](_0x1bb022[_0xe19e('0x2b')][_0xe19e('0x19')]);}_0x3f0145[_0xe19e('0x34')]=qs[_0xe19e('0x35')](_0x1bb022[_0xe19e('0x2b')]['sort']);_0x3f0145[_0xe19e('0x36')]=qs[_0xe19e('0x2d')](_[_0xe19e('0x37')](_0x1bb022[_0xe19e('0x2b')],_0x4bf47a[_0xe19e('0x2d')]),_0x40160d);if(_0x1bb022['query'][_0xe19e('0x38')]){_0x3f0145[_0xe19e('0x36')]=_[_0xe19e('0x39')](_0x3f0145[_0xe19e('0x36')],{'$or':_[_0xe19e('0x26')](_0x40160d,function(_0x4c4a8e){if(_0x4c4a8e[_0xe19e('0x3a')]!=='VIRTUAL'){var _0x4f66f4={};_0x4f66f4[_0x4c4a8e[_0xe19e('0x23')]]={'$like':'%'+_0x1bb022[_0xe19e('0x2b')]['filter']+'%'};return _0x4f66f4;}})});}_0x3f0145=_['merge']({},_0x3f0145,_0x1bb022[_0xe19e('0x3b')]);var _0x80b663={'where':_0x3f0145[_0xe19e('0x36')]};return db[_0xe19e('0x27')][_0xe19e('0x18')](_0x80b663)[_0xe19e('0x20')](function(_0x1a1e04){_0x5d4541[_0xe19e('0x18')]=_0x1a1e04;if(_0x1bb022[_0xe19e('0x2b')]['includeAll']){_0x3f0145['include']=[{'all':!![]}];}return db[_0xe19e('0x27')][_0xe19e('0x3c')](_0x3f0145);})[_0xe19e('0x20')](function(_0x7070ee){_0x5d4541[_0xe19e('0x3d')]=_0x7070ee;return _0x5d4541;})['then'](respondWithFilteredResult(_0x515c3f,_0x3f0145))[_0xe19e('0x3e')](handleError(_0x515c3f,null));};exports[_0xe19e('0x3f')]=function(_0x71a84d,_0x1a2a47){var _0x25acdf={'raw':![],'where':{'id':_0x71a84d[_0xe19e('0x40')]['id']}},_0x59a5a0={};_0x59a5a0[_0xe19e('0x2f')]=_[_0xe19e('0x2c')](db[_0xe19e('0x27')][_0xe19e('0x28')]);_0x59a5a0[_0xe19e('0x2b')]=_[_0xe19e('0x2c')](_0x71a84d[_0xe19e('0x2b')]);_0x59a5a0[_0xe19e('0x2d')]=_[_0xe19e('0x2e')](_0x59a5a0[_0xe19e('0x2f')],_0x59a5a0[_0xe19e('0x2b')]);_0x25acdf[_0xe19e('0x31')]=_['intersection'](_0x59a5a0[_0xe19e('0x2f')],qs[_0xe19e('0x30')](_0x71a84d['query']['fields']));_0x25acdf[_0xe19e('0x31')]=_0x25acdf[_0xe19e('0x31')][_0xe19e('0x32')]?_0x25acdf['attributes']:_0x59a5a0['model'];if(_0x71a84d['query']['includeAll']){_0x25acdf[_0xe19e('0x41')]=[{'all':!![]}];}_0x25acdf=_['merge']({},_0x25acdf,_0x71a84d[_0xe19e('0x3b')]);return db[_0xe19e('0x27')]['find'](_0x25acdf)[_0xe19e('0x20')](handleEntityNotFound(_0x1a2a47,null))[_0xe19e('0x20')](respondWithResult(_0x1a2a47,null))[_0xe19e('0x3e')](handleError(_0x1a2a47,null));};exports[_0xe19e('0x42')]=function(_0x145e6f,_0x305a2a){return db[_0xe19e('0x27')][_0xe19e('0x42')](_0x145e6f[_0xe19e('0x43')],{})[_0xe19e('0x20')](respondWithResult(_0x305a2a,0xc9))[_0xe19e('0x3e')](handleError(_0x305a2a,null));};exports[_0xe19e('0x44')]=function(_0x1ff924,_0x5be079){return db['AnalyticFieldReport'][_0xe19e('0x44')](_0x1ff924['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x5be079,0xc9))[_0xe19e('0x3e')](handleError(_0x5be079,null));};exports['update']=function(_0x4f7fb7,_0x3ff71f){if(_0x4f7fb7[_0xe19e('0x43')]['id']){delete _0x4f7fb7['body']['id'];}return db['AnalyticFieldReport'][_0xe19e('0x45')]({'where':{'id':_0x4f7fb7['params']['id']}})[_0xe19e('0x20')](handleEntityNotFound(_0x3ff71f,null))[_0xe19e('0x20')](saveUpdates(_0x4f7fb7[_0xe19e('0x43')],null))['then'](respondWithResult(_0x3ff71f,null))[_0xe19e('0x3e')](handleError(_0x3ff71f,null));};exports[_0xe19e('0x1f')]=function(_0x3734c1,_0x3eb035){return db[_0xe19e('0x27')][_0xe19e('0x45')]({'where':{'id':_0x3734c1[_0xe19e('0x40')]['id']}})[_0xe19e('0x20')](handleEntityNotFound(_0x3eb035,null))[_0xe19e('0x20')](removeEntity(_0x3eb035,null))[_0xe19e('0x3e')](handleError(_0x3eb035,null));};exports[_0xe19e('0x46')]=function(_0x3807a7,_0x850647){return db[_0xe19e('0x27')][_0xe19e('0x1f')]({'where':{'id':_0x3807a7['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x850647,0xcc))[_0xe19e('0x3e')](handleError(_0x850647,null));};exports[_0xe19e('0x47')]=function(_0x4c43d9,_0x413f1a,_0x2c7266){return db[_0xe19e('0x48')][_0xe19e('0x49')]({'where':{'id':_0x4c43d9[_0xe19e('0x40')]['id']}})[_0xe19e('0x20')](handleEntityNotFound(_0x413f1a,null))['then'](function(_0x5cd94d){if(_0x5cd94d){return db['sequelize'][_0xe19e('0x4a')](function(_0x2b7e79){return db[_0xe19e('0x27')]['destroy']({'where':{'CustomReportId':_0x4c43d9[_0xe19e('0x40')]['id']},'transaction':_0x2b7e79})[_0xe19e('0x20')](function(_0x4547c6){var _0x13f188=_[_0xe19e('0x26')](_0x4c43d9[_0xe19e('0x43')],function(_0x2775a6){delete _0x2775a6['id'];_0x2775a6[_0xe19e('0x4b')]=_0x4c43d9['params']['id'];return _0x2775a6;});return db[_0xe19e('0x27')][_0xe19e('0x44')](_0x13f188,{'transaction':_0x2b7e79});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x4c43d9[_0xe19e('0x40')]['id']}});});}})[_0xe19e('0x20')](respondWithResult(_0x413f1a,null))['catch'](handleError(_0x413f1a,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 6dc9538..2928f27 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 _0x1a56=['AnalyticFieldReport','analytics_report_fields','lodash','util','api','bluebird','path','../../config/environment','./analyticFieldReport.attributes'];(function(_0x442ccd,_0x415d61){var _0x1a2c10=function(_0x4ddd45){while(--_0x4ddd45){_0x442ccd['push'](_0x442ccd['shift']());}};_0x1a2c10(++_0x415d61);}(_0x1a56,0x77));var _0x61a5=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0x1a56[_0x309d93];return _0x2dd61d;};'use strict';var _=require(_0x61a5('0x0'));var util=require(_0x61a5('0x1'));var logger=require('../../config/logger')(_0x61a5('0x2'));var moment=require('moment');var BPromise=require(_0x61a5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61a5('0x4'));var rimraf=require('rimraf');var config=require(_0x61a5('0x5'));var attributes=require(_0x61a5('0x6'));module['exports']=function(_0x38720b,_0x2be52f){return _0x38720b['define'](_0x61a5('0x7'),attributes,{'tableName':_0x61a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9187=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x5448a9,_0x4764da){var _0x1924af=function(_0x34f9bf){while(--_0x34f9bf){_0x5448a9['push'](_0x5448a9['shift']());}};_0x1924af(++_0x4764da);}(_0x9187,0x1d0));var _0x7918=function(_0x7d5b1b,_0x20e692){_0x7d5b1b=_0x7d5b1b-0x0;var _0x51988c=_0x9187[_0x7d5b1b];return _0x51988c;};'use strict';var _=require(_0x7918('0x0'));var util=require(_0x7918('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7918('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7918('0x3'));var config=require(_0x7918('0x4'));var attributes=require(_0x7918('0x5'));module[_0x7918('0x6')]=function(_0x4f67e1,_0x260081){return _0x4f67e1[_0x7918('0x7')](_0x7918('0x8'),attributes,{'tableName':_0x7918('0x9'),'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 19542c9..39b48a3 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 _0x7409=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticFieldReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring'];(function(_0x31ed4c,_0x2d09bb){var _0x4d0bd0=function(_0x42197b){while(--_0x42197b){_0x31ed4c['push'](_0x31ed4c['shift']());}};_0x4d0bd0(++_0x2d09bb);}(_0x7409,0x12f));var _0x9740=function(_0x39dae4,_0x58a305){_0x39dae4=_0x39dae4-0x0;var _0x39ab08=_0x7409[_0x39dae4];return _0x39ab08;};'use strict';var _=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var moment=require(_0x9740('0x2'));var BPromise=require(_0x9740('0x3'));var rs=require(_0x9740('0x4'));var fs=require('fs');var Redis=require(_0x9740('0x5'));var db=require(_0x9740('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9740('0x7'))(_0x9740('0x8'));var config=require(_0x9740('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9740('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1738f9,_0x1b3ae5,_0x99aac6){return new BPromise(function(_0x578a2a,_0x5157a3){return client[_0x9740('0xb')](_0x1738f9,_0x99aac6)[_0x9740('0xc')](function(_0x5901cf){logger[_0x9740('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1b3ae5,_0x9740('0xe'));logger[_0x9740('0xf')](_0x9740('0x10'),_0x1b3ae5,_0x9740('0xe'),JSON[_0x9740('0x11')](_0x5901cf));if(_0x5901cf['error']){if(_0x5901cf[_0x9740('0x12')]['code']===0x1f4){logger[_0x9740('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1b3ae5,_0x5901cf[_0x9740('0x12')][_0x9740('0x13')]);return _0x5157a3(_0x5901cf['error'][_0x9740('0x13')]);}logger['error'](_0x9740('0x14'),_0x1b3ae5,_0x5901cf['error'][_0x9740('0x13')]);return _0x578a2a(_0x5901cf['error']['message']);}else{logger[_0x9740('0xd')](_0x9740('0x14'),_0x1b3ae5,_0x9740('0xe'));_0x578a2a(_0x5901cf[_0x9740('0x15')]['message']);}})['catch'](function(_0x54735a){logger[_0x9740('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1b3ae5,_0x54735a);_0x5157a3(_0x54735a);});});} \ No newline at end of file +var _0xc92e=['request','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xc92e,0x1d9));var _0xec92=function(_0x3f5b69,_0x29662b){_0x3f5b69=_0x3f5b69-0x0;var _0x210d91=_0xc92e[_0x3f5b69];return _0x210d91;};'use strict';var _=require(_0xec92('0x0'));var util=require(_0xec92('0x1'));var moment=require('moment');var BPromise=require(_0xec92('0x2'));var rs=require(_0xec92('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec92('0x4'))(_0xec92('0x5'));var config=require(_0xec92('0x6'));var jayson=require(_0xec92('0x7'));var client=jayson[_0xec92('0x8')][_0xec92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2aa10b,_0xe62556,_0x202e31){return new BPromise(function(_0x5b768c,_0x44a0d8){return client[_0xec92('0xa')](_0x2aa10b,_0x202e31)['then'](function(_0x3aac21){logger[_0xec92('0xb')](_0xec92('0xc'),_0xe62556,'request\x20sent');logger[_0xec92('0xd')](_0xec92('0xe'),_0xe62556,_0xec92('0xf'),JSON['stringify'](_0x3aac21));if(_0x3aac21['error']){if(_0x3aac21['error'][_0xec92('0x10')]===0x1f4){logger[_0xec92('0x11')](_0xec92('0xc'),_0xe62556,_0x3aac21[_0xec92('0x11')]['message']);return _0x44a0d8(_0x3aac21[_0xec92('0x11')]['message']);}logger[_0xec92('0x11')](_0xec92('0xc'),_0xe62556,_0x3aac21[_0xec92('0x11')][_0xec92('0x12')]);return _0x5b768c(_0x3aac21[_0xec92('0x11')][_0xec92('0x12')]);}else{logger[_0xec92('0xb')](_0xec92('0xc'),_0xe62556,_0xec92('0xf'));_0x5b768c(_0x3aac21[_0xec92('0x13')]['message']);}})[_0xec92('0x14')](function(_0x53f52b){logger[_0xec92('0x11')](_0xec92('0xc'),_0xe62556,_0x53f52b);_0x44a0d8(_0x53f52b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index b15cccb..9c2534a 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(_0x328d85,_0x828433){var _0x2fbd07=function(_0x3d976b){while(--_0x3d976b){_0x328d85['push'](_0x328d85['shift']());}};_0x2fbd07(++_0x828433);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x12cbed,_0x250b62){var _0x56ba23=function(_0x572337){while(--_0x572337){_0x12cbed['push'](_0x12cbed['shift']());}};_0x56ba23(++_0x250b62);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 3cc9e3f..7001457 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 _0x26f9=['exports','name','STRING','sequelize'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x26f9,0x16f));var _0x926f=function(_0x2812c2,_0x2b382d){_0x2812c2=_0x2812c2-0x0;var _0x218ac9=_0x26f9[_0x2812c2];return _0x218ac9;};'use strict';var Sequelize=require(_0x926f('0x0'));module[_0x926f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x926f('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x926f('0x3')]}}; \ No newline at end of file +var _0x0d74=['STRING','TEXT','sequelize','exports'];(function(_0x579216,_0x287466){var _0x1c5ca9=function(_0x2b3084){while(--_0x2b3084){_0x579216['push'](_0x579216['shift']());}};_0x1c5ca9(++_0x287466);}(_0x0d74,0x146));var _0x40d7=function(_0xa43082,_0x24156b){_0xa43082=_0xa43082-0x0;var _0x64a0c6=_0x0d74[_0xa43082];return _0x64a0c6;};'use strict';var Sequelize=require(_0x40d7('0x0'));module[_0x40d7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x40d7('0x2')]},'metric':{'type':Sequelize[_0x40d7('0x3')]},'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 9621d9a..f8f25eb 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 _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x11b253,_0x5b685f){var _0x3e7bdc=function(_0x523975){while(--_0x523975){_0x11b253['push'](_0x11b253['shift']());}};_0x3e7bdc(++_0x5b685f);}(_0x46ed,0x168));var _0xd46e=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x46ed[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file +var _0x00bb=['create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','json','undefined','limit','offset','apply','reject','update','destroy','get','Metrics','then','stack','name','send','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x2f8028,_0x158207){var _0x42acbb=function(_0x52e8b7){while(--_0x52e8b7){_0x2f8028['push'](_0x2f8028['shift']());}};_0x42acbb(++_0x158207);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x00bb[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){var _0x44efe5=_0x3ab3cc[_0xb00b('0x1f')]({'plain':!![]});var _0x3c9500=_0xb00b('0x20');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c9500,'resourceId':_0x44efe5['id']}})[_0xb00b('0x21')](function(){return _0x3ab3cc;});})['then'](function(){_0x2896d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac55,_0x73b6b0){return function(_0x2592cf){if(!_0x2592cf){_0x16ac55[_0xb00b('0x15')](0x194);}return _0x2592cf;};}function handleError(_0x1f14fa,_0x197379){_0x197379=_0x197379||0x1f4;return function(_0x15d3b9){logger['error'](_0x15d3b9[_0xb00b('0x22')]);if(_0x15d3b9['name']){delete _0x15d3b9[_0xb00b('0x23')];}_0x1f14fa[_0xb00b('0x16')](_0x197379)[_0xb00b('0x24')](_0x15d3b9);};}exports['index']=function(_0x2fc11a,_0x280ed3){var _0x16fbd5={},_0x183233={},_0x303625={'count':0x0,'rows':[]};var _0x2b9824=_[_0xb00b('0x25')](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x54e247){return{'name':_0x54e247[_0xb00b('0x28')],'type':_0x54e247[_0xb00b('0x29')]['key']};});_0x183233[_0xb00b('0x2a')]=_[_0xb00b('0x25')](_0x2b9824,'name');_0x183233[_0xb00b('0x2b')]=_['keys'](_0x2fc11a[_0xb00b('0x2b')]);_0x183233[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x183233[_0xb00b('0x2a')],_0x183233[_0xb00b('0x2b')]);_0x16fbd5[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x183233['model'],qs['fields'](_0x2fc11a['query'][_0xb00b('0x2f')]));_0x16fbd5[_0xb00b('0x2e')]=_0x16fbd5[_0xb00b('0x2e')][_0xb00b('0x30')]?_0x16fbd5['attributes']:_0x183233[_0xb00b('0x2a')];if(!_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x16fbd5[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x16fbd5['offset']=qs['offset'](_0x2fc11a[_0xb00b('0x2b')]['offset']);}_0x16fbd5[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x34')]);_0x16fbd5[_0xb00b('0x35')]=qs[_0xb00b('0x2c')](_[_0xb00b('0x36')](_0x2fc11a['query'],_0x183233[_0xb00b('0x2c')]),_0x2b9824);if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x16fbd5[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x16fbd5[_0xb00b('0x35')],{'$or':_['map'](_0x2b9824,function(_0x36980a){if(_0x36980a[_0xb00b('0x29')]!=='VIRTUAL'){var _0x17ff34={};_0x17ff34[_0x36980a[_0xb00b('0x23')]]={'$like':'%'+_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x37')]+'%'};return _0x17ff34;}})});}_0x16fbd5=_[_0xb00b('0x38')]({},_0x16fbd5,_0x2fc11a['options']);var _0x14ff6a={'where':_0x16fbd5[_0xb00b('0x35')]};return db[_0xb00b('0x26')][_0xb00b('0x39')](_0x14ff6a)['then'](function(_0x4867fe){_0x303625[_0xb00b('0x39')]=_0x4867fe;if(_0x2fc11a[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x16fbd5[_0xb00b('0x3b')]=[{'all':!![]}];}return db[_0xb00b('0x26')][_0xb00b('0x3c')](_0x16fbd5);})[_0xb00b('0x21')](function(_0x493841){_0x303625[_0xb00b('0x3d')]=_0x493841;return _0x303625;})[_0xb00b('0x21')](respondWithFilteredResult(_0x280ed3,_0x16fbd5))[_0xb00b('0x3e')](handleError(_0x280ed3,null));};exports[_0xb00b('0x3f')]=function(_0x302ded,_0x1dc4c5){var _0x2e3d83={'raw':!![],'where':{'id':_0x302ded[_0xb00b('0x40')]['id']}},_0x974a29={};_0x974a29[_0xb00b('0x2a')]=_[_0xb00b('0x41')](db[_0xb00b('0x26')]['rawAttributes']);_0x974a29[_0xb00b('0x2b')]=_[_0xb00b('0x41')](_0x302ded[_0xb00b('0x2b')]);_0x974a29[_0xb00b('0x2c')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],_0x974a29[_0xb00b('0x2b')]);_0x2e3d83[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x974a29[_0xb00b('0x2a')],qs[_0xb00b('0x2f')](_0x302ded[_0xb00b('0x2b')]['fields']));_0x2e3d83['attributes']=_0x2e3d83['attributes'][_0xb00b('0x30')]?_0x2e3d83[_0xb00b('0x2e')]:_0x974a29['model'];if(_0x302ded[_0xb00b('0x2b')][_0xb00b('0x3a')]){_0x2e3d83[_0xb00b('0x3b')]=[{'all':!![]}];}_0x2e3d83=_[_0xb00b('0x38')]({},_0x2e3d83,_0x302ded['options']);return db['AnalyticMetric'][_0xb00b('0x42')](_0x2e3d83)[_0xb00b('0x21')](handleEntityNotFound(_0x1dc4c5,null))['then'](respondWithResult(_0x1dc4c5,null))['catch'](handleError(_0x1dc4c5,null));};exports[_0xb00b('0x43')]=function(_0x3a205d,_0x4e0be4){return db[_0xb00b('0x26')]['create'](_0x3a205d['body'],{})['then'](function(_0x465d90){var _0x481515=_0x3a205d[_0xb00b('0x44')][_0xb00b('0x1f')]({'plain':!![]});if(!_0x481515)throw new Error(_0xb00b('0x45'));if(_0x481515[_0xb00b('0x46')]===_0xb00b('0x44')){var _0xda60ca=_0x465d90['get']({'plain':!![]});var _0x5bd40c=_0xb00b('0x20');return db[_0xb00b('0x47')]['find']({'where':{'name':_0x5bd40c,'userProfileId':_0x481515[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x21')](function(_0x57f6ab){if(_0x57f6ab&&_0x57f6ab[_0xb00b('0x49')]===0x0){return db[_0xb00b('0x4a')][_0xb00b('0x43')]({'name':_0xda60ca['name'],'resourceId':_0xda60ca['id'],'type':_0x57f6ab['name'],'sectionId':_0x57f6ab['id']},{})[_0xb00b('0x21')](function(){return _0x465d90;});}else{return _0x465d90;}})[_0xb00b('0x3e')](function(_0x12737d){logger[_0xb00b('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12737d);throw _0x12737d;});}return _0x465d90;})[_0xb00b('0x21')](respondWithResult(_0x4e0be4,0xc9))[_0xb00b('0x3e')](handleError(_0x4e0be4,null));};exports['update']=function(_0x4cd9fd,_0x160965){if(_0x4cd9fd['body']['id']){delete _0x4cd9fd[_0xb00b('0x4c')]['id'];}return db[_0xb00b('0x26')][_0xb00b('0x42')]({'where':{'id':_0x4cd9fd[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x160965,null))[_0xb00b('0x21')](saveUpdates(_0x4cd9fd['body'],null))[_0xb00b('0x21')](respondWithResult(_0x160965,null))['catch'](handleError(_0x160965,null));};exports[_0xb00b('0x1e')]=function(_0x98caa9,_0x4129ba){return db['AnalyticMetric'][_0xb00b('0x42')]({'where':{'id':_0x98caa9[_0xb00b('0x40')]['id']}})[_0xb00b('0x21')](handleEntityNotFound(_0x4129ba,null))['then'](removeEntity(_0x4129ba,null))[_0xb00b('0x3e')](handleError(_0x4129ba,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index c92682f..f60868b 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 _0xc9b0=['../../config/logger','api','moment','bluebird','request-promise','path','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x2ecfd9,_0x265b8d){var _0x2e53a0=function(_0x358997){while(--_0x358997){_0x2ecfd9['push'](_0x2ecfd9['shift']());}};_0x2e53a0(++_0x265b8d);}(_0xc9b0,0x143));var _0x0c9b=function(_0x378d98,_0x1bfdc2){_0x378d98=_0x378d98-0x0;var _0x1ed4f5=_0xc9b0[_0x378d98];return _0x1ed4f5;};'use strict';var _=require(_0x0c9b('0x0'));var util=require(_0x0c9b('0x1'));var logger=require(_0x0c9b('0x2'))(_0x0c9b('0x3'));var moment=require(_0x0c9b('0x4'));var BPromise=require(_0x0c9b('0x5'));var rp=require(_0x0c9b('0x6'));var fs=require('fs');var path=require(_0x0c9b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0c9b('0x8'));module[_0x0c9b('0x9')]=function(_0x192da5,_0x368518){return _0x192da5[_0x0c9b('0xa')](_0x0c9b('0xb'),attributes,{'tableName':_0x0c9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce1=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics'];(function(_0x281b57,_0x11632e){var _0x37a22d=function(_0x123d4c){while(--_0x123d4c){_0x281b57['push'](_0x281b57['shift']());}};_0x37a22d(++_0x11632e);}(_0x8ce1,0x152));var _0x18ce=function(_0x495f2a,_0x223c84){_0x495f2a=_0x495f2a-0x0;var _0x137470=_0x8ce1[_0x495f2a];return _0x137470;};'use strict';var _=require(_0x18ce('0x0'));var util=require(_0x18ce('0x1'));var logger=require(_0x18ce('0x2'))(_0x18ce('0x3'));var moment=require(_0x18ce('0x4'));var BPromise=require(_0x18ce('0x5'));var rp=require(_0x18ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18ce('0x7'));var config=require(_0x18ce('0x8'));var attributes=require(_0x18ce('0x9'));module[_0x18ce('0xa')]=function(_0x532604,_0x17d12a){return _0x532604[_0x18ce('0xb')]('AnalyticMetric',attributes,{'tableName':_0x18ce('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 b57e52f..23877cf 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 _0x8359=['http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8359,0x1ae));var _0x9835=function(_0x45806b,_0x53eeae){_0x45806b=_0x45806b-0x0;var _0x3e228e=_0x8359[_0x45806b];return _0x3e228e;};'use strict';var _=require(_0x9835('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9835('0x1'));var rs=require(_0x9835('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9835('0x3'))(_0x9835('0x4'));var config=require(_0x9835('0x5'));var jayson=require(_0x9835('0x6'));var client=jayson['client'][_0x9835('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e7e06,_0x2fd687,_0xb8f73){return new BPromise(function(_0xbe185e,_0x4111fd){return client[_0x9835('0x8')](_0x5e7e06,_0xb8f73)[_0x9835('0x9')](function(_0x472d17){logger[_0x9835('0xa')](_0x9835('0xb'),_0x2fd687,_0x9835('0xc'));logger[_0x9835('0xd')](_0x9835('0xe'),_0x2fd687,'request\x20sent',JSON['stringify'](_0x472d17));if(_0x472d17['error']){if(_0x472d17['error'][_0x9835('0xf')]===0x1f4){logger[_0x9835('0x10')](_0x9835('0xb'),_0x2fd687,_0x472d17[_0x9835('0x10')][_0x9835('0x11')]);return _0x4111fd(_0x472d17[_0x9835('0x10')][_0x9835('0x11')]);}logger[_0x9835('0x10')](_0x9835('0xb'),_0x2fd687,_0x472d17[_0x9835('0x10')][_0x9835('0x11')]);return _0xbe185e(_0x472d17['error'][_0x9835('0x11')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x2fd687,'request\x20sent');_0xbe185e(_0x472d17['result'][_0x9835('0x11')]);}})[_0x9835('0x12')](function(_0x1875b3){logger[_0x9835('0x10')](_0x9835('0xb'),_0x2fd687,_0x1875b3);_0x4111fd(_0x1875b3);});});} \ No newline at end of file +var _0xe01c=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','randomstring','../../config/utils'];(function(_0x3616ef,_0x211fd1){var _0x4df78b=function(_0x21ec0f){while(--_0x21ec0f){_0x3616ef['push'](_0x3616ef['shift']());}};_0x4df78b(++_0x211fd1);}(_0xe01c,0x14f));var _0xce01=function(_0x561ab7,_0x436ad1){_0x561ab7=_0x561ab7-0x0;var _0x4c995e=_0xe01c[_0x561ab7];return _0x4c995e;};'use strict';var _=require(_0xce01('0x0'));var util=require(_0xce01('0x1'));var moment=require(_0xce01('0x2'));var BPromise=require('bluebird');var rs=require(_0xce01('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce01('0x4'));var logger=require(_0xce01('0x5'))('rpc');var config=require(_0xce01('0x6'));var jayson=require(_0xce01('0x7'));var client=jayson[_0xce01('0x8')][_0xce01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ecba4,_0x2b2b29,_0x19b3a2){return new BPromise(function(_0x901e28,_0xe915ea){return client[_0xce01('0xa')](_0x2ecba4,_0x19b3a2)[_0xce01('0xb')](function(_0x28ed4e){logger[_0xce01('0xc')](_0xce01('0xd'),_0x2b2b29,_0xce01('0xe'));logger[_0xce01('0xf')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x2b2b29,_0xce01('0xe'),JSON[_0xce01('0x10')](_0x28ed4e));if(_0x28ed4e[_0xce01('0x11')]){if(_0x28ed4e[_0xce01('0x11')][_0xce01('0x12')]===0x1f4){logger[_0xce01('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x2b2b29,_0x28ed4e[_0xce01('0x11')][_0xce01('0x13')]);return _0xe915ea(_0x28ed4e[_0xce01('0x11')][_0xce01('0x13')]);}logger[_0xce01('0x11')](_0xce01('0xd'),_0x2b2b29,_0x28ed4e[_0xce01('0x11')][_0xce01('0x13')]);return _0x901e28(_0x28ed4e[_0xce01('0x11')][_0xce01('0x13')]);}else{logger[_0xce01('0xc')](_0xce01('0xd'),_0x2b2b29,_0xce01('0xe'));_0x901e28(_0x28ed4e['result']['message']);}})['catch'](function(_0x1a0d14){logger[_0xce01('0x11')](_0xce01('0xd'),_0x2b2b29,_0x1a0d14);_0xe915ea(_0x1a0d14);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index dc0e964..fe82d84 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 _0x81d4=['show','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x81d4,0x197));var _0x481d=function(_0x2afde6,_0x501cb9){_0x2afde6=_0x2afde6-0x0;var _0x2c4284=_0x81d4[_0x2afde6];return _0x2c4284;};'use strict';var multer=require('multer');var util=require(_0x481d('0x0'));var path=require(_0x481d('0x1'));var timeout=require('connect-timeout');var express=require(_0x481d('0x2'));var router=express[_0x481d('0x3')]();var fs_extra=require(_0x481d('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x481d('0x5'));var controller=require(_0x481d('0x6'));router[_0x481d('0x7')]('/',auth['isAuthenticated'](),controller[_0x481d('0x8')]);router[_0x481d('0x7')](_0x481d('0x9'),auth[_0x481d('0xa')](),controller[_0x481d('0xb')]);router[_0x481d('0xc')]('/',auth['isAuthenticated'](),controller[_0x481d('0xd')]);router[_0x481d('0xe')](_0x481d('0x9'),auth['isAuthenticated'](),controller[_0x481d('0xf')]);router[_0x481d('0x10')]('/:id',auth[_0x481d('0xa')](),controller[_0x481d('0x11')]);module[_0x481d('0x12')]=router; \ No newline at end of file +var _0x6dc0=['multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./analyticMetric.controller','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports'];(function(_0xa6330,_0x54d0c2){var _0x4755aa=function(_0x44dffd){while(--_0x44dffd){_0xa6330['push'](_0xa6330['shift']());}};_0x4755aa(++_0x54d0c2);}(_0x6dc0,0x18c));var _0x06dc=function(_0x5ce2e7,_0x36735e){_0x5ce2e7=_0x5ce2e7-0x0;var _0x15e5f5=_0x6dc0[_0x5ce2e7];return _0x15e5f5;};'use strict';var multer=require(_0x06dc('0x0'));var util=require('util');var path=require(_0x06dc('0x1'));var timeout=require(_0x06dc('0x2'));var express=require(_0x06dc('0x3'));var router=express[_0x06dc('0x4')]();var fs_extra=require(_0x06dc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x06dc('0x6'));var controller=require(_0x06dc('0x7'));router['get']('/',auth[_0x06dc('0x8')](),controller[_0x06dc('0x9')]);router['get'](_0x06dc('0xa'),auth['isAuthenticated'](),controller[_0x06dc('0xb')]);router[_0x06dc('0xc')]('/',auth[_0x06dc('0x8')](),controller[_0x06dc('0xd')]);router[_0x06dc('0xe')]('/:id',auth[_0x06dc('0x8')](),controller['update']);router[_0x06dc('0xf')](_0x06dc('0xa'),auth['isAuthenticated'](),controller[_0x06dc('0x10')]);module[_0x06dc('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 3cbd381..6a87640 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 _0xef7d=['exports'];(function(_0x5ea5d4,_0x5c54da){var _0x289a05=function(_0x250c5d){while(--_0x250c5d){_0x5ea5d4['push'](_0x5ea5d4['shift']());}};_0x289a05(++_0x5c54da);}(_0xef7d,0x1b3));var _0xdef7=function(_0x1e5f91,_0xa38bd9){_0x1e5f91=_0x1e5f91-0x0;var _0x5bb46b=_0xef7d[_0x1e5f91];return _0x5bb46b;};'use strict';var Sequelize=require('sequelize');module[_0xdef7('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x95ba=['exports','TEXT','sequelize'];(function(_0xab9864,_0x5ab487){var _0x500468=function(_0x441a7c){while(--_0x441a7c){_0xab9864['push'](_0xab9864['shift']());}};_0x500468(++_0x5ab487);}(_0x95ba,0x17c));var _0xa95b=function(_0x46f940,_0xc854e2){_0x46f940=_0x46f940-0x0;var _0x4572f3=_0x95ba[_0x46f940];return _0x4572f3;};'use strict';var Sequelize=require(_0xa95b('0x0'));module[_0xa95b('0x1')]={'tree':{'type':Sequelize[_0xa95b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index e21e54d..5665b1a 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 _0xee59=['create','body','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','ejs','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find'];(function(_0x2aac4b,_0x2629bd){var _0xf5fba8=function(_0x390b42){while(--_0x390b42){_0x2aac4b['push'](_0x2aac4b['shift']());}};_0xf5fba8(++_0x2629bd);}(_0xee59,0x1f3));var _0x9ee5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xee59[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ee5('0x0'));var zipdir=require(_0x9ee5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ee5('0x2'));var moment=require('moment');var BPromise=require(_0x9ee5('0x3'));var Mustache=require(_0x9ee5('0x4'));var util=require(_0x9ee5('0x5'));var path=require('path');var sox=require(_0x9ee5('0x6'));var csv=require('to-csv');var ejs=require(_0x9ee5('0x7'));var fs=require('fs');var fs_extra=require(_0x9ee5('0x8'));var _=require(_0x9ee5('0x9'));var squel=require(_0x9ee5('0xa'));var crypto=require(_0x9ee5('0xb'));var jsforce=require(_0x9ee5('0xc'));var deskjs=require(_0x9ee5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9ee5('0xe'));var Papa=require(_0x9ee5('0xf'));var Redis=require(_0x9ee5('0x10'));var authService=require(_0x9ee5('0x11'));var qs=require(_0x9ee5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9ee5('0x13'));var logger=require(_0x9ee5('0x14'))('api');var utils=require(_0x9ee5('0x15'));var config=require(_0x9ee5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ee5('0x17'))['db'];function respondWithStatusCode(_0x5b8390,_0x2ddb25){_0x2ddb25=_0x2ddb25||0xcc;return function(_0x2e9a73){if(_0x2e9a73){return _0x5b8390[_0x9ee5('0x18')](_0x2ddb25);}return _0x5b8390[_0x9ee5('0x19')](_0x2ddb25)['end']();};}function respondWithResult(_0x3411b5,_0x305fa4){_0x305fa4=_0x305fa4||0xc8;return function(_0x26f230){if(_0x26f230){return _0x3411b5[_0x9ee5('0x19')](_0x305fa4)[_0x9ee5('0x1a')](_0x26f230);}};}function respondWithFilteredResult(_0x32ae2e,_0x5231c6){return function(_0x3ad260){if(_0x3ad260){var _0x33bdc1=typeof _0x5231c6[_0x9ee5('0x1b')]===_0x9ee5('0x1c')&&typeof _0x5231c6[_0x9ee5('0x1d')]==='undefined';var _0x228373=_0x3ad260[_0x9ee5('0x1e')];var _0x37ed12=_0x33bdc1?0x0:_0x5231c6[_0x9ee5('0x1b')];var _0x342487=_0x33bdc1?_0x3ad260[_0x9ee5('0x1e')]:_0x5231c6[_0x9ee5('0x1b')]+_0x5231c6['limit'];var _0x36c486;if(_0x342487>=_0x228373){_0x342487=_0x228373;_0x36c486=0xc8;}else{_0x36c486=0xce;}_0x32ae2e['status'](_0x36c486);return _0x32ae2e[_0x9ee5('0x1f')](_0x9ee5('0x20'),_0x37ed12+'-'+_0x342487+'/'+_0x228373)[_0x9ee5('0x1a')](_0x3ad260);}return null;};}function patchUpdates(_0x32c155){return function(_0x20c159){try{jsonpatch[_0x9ee5('0x21')](_0x20c159,_0x32c155,!![]);}catch(_0x5a0652){return BPromise['reject'](_0x5a0652);}return _0x20c159[_0x9ee5('0x22')]();};}function saveUpdates(_0x5c200b,_0x1b1f8d){return function(_0x5243ed){if(_0x5243ed){return _0x5243ed[_0x9ee5('0x23')](_0x5c200b)[_0x9ee5('0x24')](function(_0x482236){return _0x482236;});}return null;};}function removeEntity(_0x1b7bba,_0x548ca4){return function(_0x33ab83){if(_0x33ab83){return _0x33ab83[_0x9ee5('0x25')]()['then'](function(){_0x1b7bba[_0x9ee5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d639e,_0x3715ba){return function(_0x6d36b2){if(!_0x6d36b2){_0x1d639e['sendStatus'](0x194);}return _0x6d36b2;};}function handleError(_0x1a7456,_0x5f5bbd){_0x5f5bbd=_0x5f5bbd||0x1f4;return function(_0x40e100){logger[_0x9ee5('0x26')](_0x40e100[_0x9ee5('0x27')]);if(_0x40e100[_0x9ee5('0x28')]){delete _0x40e100[_0x9ee5('0x28')];}_0x1a7456[_0x9ee5('0x19')](_0x5f5bbd)[_0x9ee5('0x29')](_0x40e100);};}exports[_0x9ee5('0x2a')]=function(_0x3b32f5,_0x1a2dbf){var _0x157e87={},_0x36e6f3={},_0x3f39b6={'count':0x0,'rows':[]};var _0x3a6739=_[_0x9ee5('0x2b')](db[_0x9ee5('0x2c')]['rawAttributes'],function(_0x149880){return{'name':_0x149880[_0x9ee5('0x2d')],'type':_0x149880[_0x9ee5('0x2e')][_0x9ee5('0x2f')]};});_0x36e6f3[_0x9ee5('0x30')]=_[_0x9ee5('0x2b')](_0x3a6739,_0x9ee5('0x28'));_0x36e6f3[_0x9ee5('0x31')]=_['keys'](_0x3b32f5[_0x9ee5('0x31')]);_0x36e6f3['filters']=_[_0x9ee5('0x32')](_0x36e6f3[_0x9ee5('0x30')],_0x36e6f3[_0x9ee5('0x31')]);_0x157e87[_0x9ee5('0x33')]=_[_0x9ee5('0x32')](_0x36e6f3[_0x9ee5('0x30')],qs[_0x9ee5('0x34')](_0x3b32f5[_0x9ee5('0x31')][_0x9ee5('0x34')]));_0x157e87[_0x9ee5('0x33')]=_0x157e87['attributes']['length']?_0x157e87[_0x9ee5('0x33')]:_0x36e6f3[_0x9ee5('0x30')];if(!_0x3b32f5['query']['hasOwnProperty'](_0x9ee5('0x35'))){_0x157e87[_0x9ee5('0x1d')]=qs[_0x9ee5('0x1d')](_0x3b32f5[_0x9ee5('0x31')][_0x9ee5('0x1d')]);_0x157e87[_0x9ee5('0x1b')]=qs[_0x9ee5('0x1b')](_0x3b32f5['query'][_0x9ee5('0x1b')]);}_0x157e87[_0x9ee5('0x36')]=qs['sort'](_0x3b32f5[_0x9ee5('0x31')]['sort']);_0x157e87[_0x9ee5('0x37')]=qs[_0x9ee5('0x38')](_['pick'](_0x3b32f5[_0x9ee5('0x31')],_0x36e6f3[_0x9ee5('0x38')]),_0x3a6739);if(_0x3b32f5[_0x9ee5('0x31')][_0x9ee5('0x39')]){_0x157e87['where']=_[_0x9ee5('0x3a')](_0x157e87[_0x9ee5('0x37')],{'$or':_[_0x9ee5('0x2b')](_0x3a6739,function(_0xd5d02e){if(_0xd5d02e[_0x9ee5('0x2e')]!=='VIRTUAL'){var _0x2dcc7d={};_0x2dcc7d[_0xd5d02e['name']]={'$like':'%'+_0x3b32f5[_0x9ee5('0x31')][_0x9ee5('0x39')]+'%'};return _0x2dcc7d;}})});}_0x157e87=_['merge']({},_0x157e87,_0x3b32f5[_0x9ee5('0x3b')]);var _0x408acd={'where':_0x157e87[_0x9ee5('0x37')]};return db[_0x9ee5('0x2c')][_0x9ee5('0x1e')](_0x408acd)[_0x9ee5('0x24')](function(_0x3d0467){_0x3f39b6[_0x9ee5('0x1e')]=_0x3d0467;if(_0x3b32f5[_0x9ee5('0x31')][_0x9ee5('0x3c')]){_0x157e87[_0x9ee5('0x3d')]=[{'all':!![]}];}return db[_0x9ee5('0x2c')][_0x9ee5('0x3e')](_0x157e87);})[_0x9ee5('0x24')](function(_0x3e6a3a){_0x3f39b6[_0x9ee5('0x3f')]=_0x3e6a3a;return _0x3f39b6;})[_0x9ee5('0x24')](respondWithFilteredResult(_0x1a2dbf,_0x157e87))[_0x9ee5('0x40')](handleError(_0x1a2dbf,null));};exports[_0x9ee5('0x41')]=function(_0x40c5bc,_0x421fd6){var _0xb53f75={'raw':!![],'where':{'id':_0x40c5bc[_0x9ee5('0x42')]['id']}},_0x2897c6={};_0x2897c6[_0x9ee5('0x30')]=_[_0x9ee5('0x43')](db[_0x9ee5('0x2c')]['rawAttributes']);_0x2897c6['query']=_[_0x9ee5('0x43')](_0x40c5bc[_0x9ee5('0x31')]);_0x2897c6[_0x9ee5('0x38')]=_[_0x9ee5('0x32')](_0x2897c6[_0x9ee5('0x30')],_0x2897c6[_0x9ee5('0x31')]);_0xb53f75[_0x9ee5('0x33')]=_[_0x9ee5('0x32')](_0x2897c6[_0x9ee5('0x30')],qs[_0x9ee5('0x34')](_0x40c5bc['query'][_0x9ee5('0x34')]));_0xb53f75[_0x9ee5('0x33')]=_0xb53f75[_0x9ee5('0x33')]['length']?_0xb53f75[_0x9ee5('0x33')]:_0x2897c6[_0x9ee5('0x30')];if(_0x40c5bc[_0x9ee5('0x31')][_0x9ee5('0x3c')]){_0xb53f75['include']=[{'all':!![]}];}_0xb53f75=_[_0x9ee5('0x3a')]({},_0xb53f75,_0x40c5bc['options']);return db[_0x9ee5('0x2c')][_0x9ee5('0x44')](_0xb53f75)[_0x9ee5('0x24')](handleEntityNotFound(_0x421fd6,null))[_0x9ee5('0x24')](respondWithResult(_0x421fd6,null))[_0x9ee5('0x40')](handleError(_0x421fd6,null));};exports[_0x9ee5('0x45')]=function(_0x310931,_0x590e1c){return db[_0x9ee5('0x2c')][_0x9ee5('0x45')](_0x310931[_0x9ee5('0x46')],{})['then'](respondWithResult(_0x590e1c,0xc9))[_0x9ee5('0x40')](handleError(_0x590e1c,null));};exports[_0x9ee5('0x23')]=function(_0x13da2c,_0x33a01e){if(_0x13da2c['body']['id']){delete _0x13da2c[_0x9ee5('0x46')]['id'];}return db[_0x9ee5('0x2c')][_0x9ee5('0x44')]({'where':{'id':_0x13da2c['params']['id']}})[_0x9ee5('0x24')](handleEntityNotFound(_0x33a01e,null))[_0x9ee5('0x24')](saveUpdates(_0x13da2c[_0x9ee5('0x46')],null))['then'](respondWithResult(_0x33a01e,null))[_0x9ee5('0x40')](handleError(_0x33a01e,null));};exports[_0x9ee5('0x25')]=function(_0x913e1b,_0x3edea6){return db[_0x9ee5('0x2c')][_0x9ee5('0x44')]({'where':{'id':_0x913e1b[_0x9ee5('0x42')]['id']}})[_0x9ee5('0x24')](handleEntityNotFound(_0x3edea6,null))[_0x9ee5('0x24')](removeEntity(_0x3edea6,null))[_0x9ee5('0x40')](handleError(_0x3edea6,null));}; \ No newline at end of file +var _0xfb4b=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','fast-json-patch','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfb4b,0x7f));var _0xbfb4=function(_0x4722c7,_0x326525){_0x4722c7=_0x4722c7-0x0;var _0x24cb31=_0xfb4b[_0x4722c7];return _0x24cb31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbfb4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbfb4('0x1'));var rp=require('request-promise');var moment=require(_0xbfb4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbfb4('0x3'));var util=require(_0xbfb4('0x4'));var path=require(_0xbfb4('0x5'));var sox=require('sox');var csv=require(_0xbfb4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfb4('0x7'));var _=require(_0xbfb4('0x8'));var squel=require(_0xbfb4('0x9'));var crypto=require(_0xbfb4('0xa'));var jsforce=require(_0xbfb4('0xb'));var deskjs=require(_0xbfb4('0xc'));var toCsv=require(_0xbfb4('0x6'));var querystring=require(_0xbfb4('0xd'));var Papa=require(_0xbfb4('0xe'));var Redis=require(_0xbfb4('0xf'));var authService=require(_0xbfb4('0x10'));var qs=require(_0xbfb4('0x11'));var as=require(_0xbfb4('0x12'));var hardwareService=require(_0xbfb4('0x13'));var logger=require(_0xbfb4('0x14'))(_0xbfb4('0x15'));var utils=require(_0xbfb4('0x16'));var config=require(_0xbfb4('0x17'));var licenseUtil=require(_0xbfb4('0x18'));var db=require(_0xbfb4('0x19'))['db'];function respondWithStatusCode(_0x55802a,_0x4286c8){_0x4286c8=_0x4286c8||0xcc;return function(_0x23b52c){if(_0x23b52c){return _0x55802a[_0xbfb4('0x1a')](_0x4286c8);}return _0x55802a['status'](_0x4286c8)[_0xbfb4('0x1b')]();};}function respondWithResult(_0xe4a76f,_0x4fecb4){_0x4fecb4=_0x4fecb4||0xc8;return function(_0x61ce21){if(_0x61ce21){return _0xe4a76f[_0xbfb4('0x1c')](_0x4fecb4)[_0xbfb4('0x1d')](_0x61ce21);}};}function respondWithFilteredResult(_0x453b2b,_0x41dece){return function(_0x14b621){if(_0x14b621){var _0x55c538=typeof _0x41dece[_0xbfb4('0x1e')]==='undefined'&&typeof _0x41dece[_0xbfb4('0x1f')]===_0xbfb4('0x20');var _0xfb0f38=_0x14b621['count'];var _0x5b41a4=_0x55c538?0x0:_0x41dece[_0xbfb4('0x1e')];var _0x130a27=_0x55c538?_0x14b621[_0xbfb4('0x21')]:_0x41dece[_0xbfb4('0x1e')]+_0x41dece[_0xbfb4('0x1f')];var _0x5d9335;if(_0x130a27>=_0xfb0f38){_0x130a27=_0xfb0f38;_0x5d9335=0xc8;}else{_0x5d9335=0xce;}_0x453b2b[_0xbfb4('0x1c')](_0x5d9335);return _0x453b2b['set'](_0xbfb4('0x22'),_0x5b41a4+'-'+_0x130a27+'/'+_0xfb0f38)['json'](_0x14b621);}return null;};}function patchUpdates(_0x2c53e3){return function(_0x5887c8){try{jsonpatch[_0xbfb4('0x23')](_0x5887c8,_0x2c53e3,!![]);}catch(_0x294a66){return BPromise[_0xbfb4('0x24')](_0x294a66);}return _0x5887c8[_0xbfb4('0x25')]();};}function saveUpdates(_0x17d80a,_0x1a79c7){return function(_0x302c5e){if(_0x302c5e){return _0x302c5e[_0xbfb4('0x26')](_0x17d80a)[_0xbfb4('0x27')](function(_0x424ce4){return _0x424ce4;});}return null;};}function removeEntity(_0x45b9ee,_0x50137b){return function(_0x1749b0){if(_0x1749b0){return _0x1749b0[_0xbfb4('0x28')]()[_0xbfb4('0x27')](function(){_0x45b9ee[_0xbfb4('0x1c')](0xcc)[_0xbfb4('0x1b')]();});}};}function handleEntityNotFound(_0x3c0618,_0x5a5e76){return function(_0x27ce4d){if(!_0x27ce4d){_0x3c0618['sendStatus'](0x194);}return _0x27ce4d;};}function handleError(_0x20561d,_0x28a421){_0x28a421=_0x28a421||0x1f4;return function(_0x2c47b6){logger['error'](_0x2c47b6[_0xbfb4('0x29')]);if(_0x2c47b6['name']){delete _0x2c47b6['name'];}_0x20561d[_0xbfb4('0x1c')](_0x28a421)['send'](_0x2c47b6);};}exports[_0xbfb4('0x2a')]=function(_0x34f3a3,_0x2d1edb){var _0x117a96={},_0x20e5bb={},_0x310873={'count':0x0,'rows':[]};var _0x4f0e06=_[_0xbfb4('0x2b')](db[_0xbfb4('0x2c')][_0xbfb4('0x2d')],function(_0x59d90e){return{'name':_0x59d90e[_0xbfb4('0x2e')],'type':_0x59d90e[_0xbfb4('0x2f')]['key']};});_0x20e5bb[_0xbfb4('0x30')]=_[_0xbfb4('0x2b')](_0x4f0e06,'name');_0x20e5bb[_0xbfb4('0x31')]=_[_0xbfb4('0x32')](_0x34f3a3[_0xbfb4('0x31')]);_0x20e5bb[_0xbfb4('0x33')]=_[_0xbfb4('0x34')](_0x20e5bb['model'],_0x20e5bb[_0xbfb4('0x31')]);_0x117a96[_0xbfb4('0x35')]=_[_0xbfb4('0x34')](_0x20e5bb['model'],qs['fields'](_0x34f3a3[_0xbfb4('0x31')][_0xbfb4('0x36')]));_0x117a96[_0xbfb4('0x35')]=_0x117a96[_0xbfb4('0x35')][_0xbfb4('0x37')]?_0x117a96['attributes']:_0x20e5bb['model'];if(!_0x34f3a3['query']['hasOwnProperty'](_0xbfb4('0x38'))){_0x117a96[_0xbfb4('0x1f')]=qs['limit'](_0x34f3a3['query']['limit']);_0x117a96[_0xbfb4('0x1e')]=qs['offset'](_0x34f3a3[_0xbfb4('0x31')]['offset']);}_0x117a96['order']=qs[_0xbfb4('0x39')](_0x34f3a3[_0xbfb4('0x31')][_0xbfb4('0x39')]);_0x117a96['where']=qs[_0xbfb4('0x33')](_[_0xbfb4('0x3a')](_0x34f3a3[_0xbfb4('0x31')],_0x20e5bb['filters']),_0x4f0e06);if(_0x34f3a3[_0xbfb4('0x31')][_0xbfb4('0x3b')]){_0x117a96[_0xbfb4('0x3c')]=_['merge'](_0x117a96[_0xbfb4('0x3c')],{'$or':_[_0xbfb4('0x2b')](_0x4f0e06,function(_0x50b361){if(_0x50b361[_0xbfb4('0x2f')]!==_0xbfb4('0x3d')){var _0x14d082={};_0x14d082[_0x50b361[_0xbfb4('0x3e')]]={'$like':'%'+_0x34f3a3[_0xbfb4('0x31')][_0xbfb4('0x3b')]+'%'};return _0x14d082;}})});}_0x117a96=_[_0xbfb4('0x3f')]({},_0x117a96,_0x34f3a3[_0xbfb4('0x40')]);var _0x21198b={'where':_0x117a96[_0xbfb4('0x3c')]};return db[_0xbfb4('0x2c')][_0xbfb4('0x21')](_0x21198b)[_0xbfb4('0x27')](function(_0x19694c){_0x310873[_0xbfb4('0x21')]=_0x19694c;if(_0x34f3a3[_0xbfb4('0x31')][_0xbfb4('0x41')]){_0x117a96[_0xbfb4('0x42')]=[{'all':!![]}];}return db[_0xbfb4('0x2c')][_0xbfb4('0x43')](_0x117a96);})['then'](function(_0x5743e2){_0x310873[_0xbfb4('0x44')]=_0x5743e2;return _0x310873;})[_0xbfb4('0x27')](respondWithFilteredResult(_0x2d1edb,_0x117a96))[_0xbfb4('0x45')](handleError(_0x2d1edb,null));};exports[_0xbfb4('0x46')]=function(_0x5cf060,_0x299bcf){var _0x455c26={'raw':!![],'where':{'id':_0x5cf060[_0xbfb4('0x47')]['id']}},_0x16aa13={};_0x16aa13['model']=_[_0xbfb4('0x32')](db[_0xbfb4('0x2c')][_0xbfb4('0x2d')]);_0x16aa13[_0xbfb4('0x31')]=_[_0xbfb4('0x32')](_0x5cf060[_0xbfb4('0x31')]);_0x16aa13[_0xbfb4('0x33')]=_[_0xbfb4('0x34')](_0x16aa13['model'],_0x16aa13[_0xbfb4('0x31')]);_0x455c26[_0xbfb4('0x35')]=_[_0xbfb4('0x34')](_0x16aa13[_0xbfb4('0x30')],qs[_0xbfb4('0x36')](_0x5cf060[_0xbfb4('0x31')]['fields']));_0x455c26[_0xbfb4('0x35')]=_0x455c26[_0xbfb4('0x35')]['length']?_0x455c26['attributes']:_0x16aa13[_0xbfb4('0x30')];if(_0x5cf060[_0xbfb4('0x31')][_0xbfb4('0x41')]){_0x455c26[_0xbfb4('0x42')]=[{'all':!![]}];}_0x455c26=_[_0xbfb4('0x3f')]({},_0x455c26,_0x5cf060[_0xbfb4('0x40')]);return db[_0xbfb4('0x2c')][_0xbfb4('0x48')](_0x455c26)[_0xbfb4('0x27')](handleEntityNotFound(_0x299bcf,null))[_0xbfb4('0x27')](respondWithResult(_0x299bcf,null))[_0xbfb4('0x45')](handleError(_0x299bcf,null));};exports[_0xbfb4('0x49')]=function(_0x2ed802,_0x579cb4){return db[_0xbfb4('0x2c')][_0xbfb4('0x49')](_0x2ed802[_0xbfb4('0x4a')],{})[_0xbfb4('0x27')](respondWithResult(_0x579cb4,0xc9))['catch'](handleError(_0x579cb4,null));};exports[_0xbfb4('0x26')]=function(_0x5eac20,_0x452142){if(_0x5eac20['body']['id']){delete _0x5eac20['body']['id'];}return db['AnalyticTreeReport'][_0xbfb4('0x48')]({'where':{'id':_0x5eac20[_0xbfb4('0x47')]['id']}})['then'](handleEntityNotFound(_0x452142,null))['then'](saveUpdates(_0x5eac20[_0xbfb4('0x4a')],null))['then'](respondWithResult(_0x452142,null))[_0xbfb4('0x45')](handleError(_0x452142,null));};exports[_0xbfb4('0x28')]=function(_0x6afa06,_0xbe22ae){return db[_0xbfb4('0x2c')][_0xbfb4('0x48')]({'where':{'id':_0x6afa06['params']['id']}})[_0xbfb4('0x27')](handleEntityNotFound(_0xbe22ae,null))[_0xbfb4('0x27')](removeEntity(_0xbe22ae,null))[_0xbfb4('0x45')](handleError(_0xbe22ae,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 27f96fe..d1eac63 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 _0x41ab=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4b3ee7,_0x3cb08a){var _0x5b6f01=function(_0x4476fc){while(--_0x4476fc){_0x4b3ee7['push'](_0x4b3ee7['shift']());}};_0x5b6f01(++_0x3cb08a);}(_0x41ab,0x141));var _0xb41a=function(_0x4ceae1,_0x437160){_0x4ceae1=_0x4ceae1-0x0;var _0x3dc47e=_0x41ab[_0x4ceae1];return _0x3dc47e;};'use strict';var _=require(_0xb41a('0x0'));var util=require(_0xb41a('0x1'));var logger=require(_0xb41a('0x2'))(_0xb41a('0x3'));var moment=require(_0xb41a('0x4'));var BPromise=require(_0xb41a('0x5'));var rp=require(_0xb41a('0x6'));var fs=require('fs');var path=require(_0xb41a('0x7'));var rimraf=require(_0xb41a('0x8'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x14600b,_0x5e483b){return _0x14600b['define'](_0xb41a('0x9'),attributes,{'tableName':_0xb41a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x134d=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3ab53f,_0x508ae7){var _0x42c654=function(_0x4095e2){while(--_0x4095e2){_0x3ab53f['push'](_0x3ab53f['shift']());}};_0x42c654(++_0x508ae7);}(_0x134d,0x173));var _0xd134=function(_0x530a5d,_0x59d1ae){_0x530a5d=_0x530a5d-0x0;var _0x1b297d=_0x134d[_0x530a5d];return _0x1b297d;};'use strict';var _=require('lodash');var util=require(_0xd134('0x0'));var logger=require(_0xd134('0x1'))(_0xd134('0x2'));var moment=require(_0xd134('0x3'));var BPromise=require(_0xd134('0x4'));var rp=require(_0xd134('0x5'));var fs=require('fs');var path=require(_0xd134('0x6'));var rimraf=require(_0xd134('0x7'));var config=require(_0xd134('0x8'));var attributes=require(_0xd134('0x9'));module[_0xd134('0xa')]=function(_0x5d6249,_0x5911a5){return _0x5d6249[_0xd134('0xb')](_0xd134('0xc'),attributes,{'tableName':_0xd134('0xd'),'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 f1c33ef..6089a78 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x3e10a9,_0x31de10){var _0x2ae051=function(_0x5b523e){while(--_0x5b523e){_0x3e10a9['push'](_0x3e10a9['shift']());}};_0x2ae051(++_0x31de10);}(_0xdb28,0x106));var _0x8db2=function(_0x17f91d,_0x48072e){_0x17f91d=_0x17f91d-0x0;var _0x25f489=_0xdb28[_0x17f91d];return _0x25f489;};'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')]('AnalyticTreeReport,\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 _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(_0x5d628f,_0xdfa6ac){var _0x68983a=function(_0x3c28ae){while(--_0x3c28ae){_0x5d628f['push'](_0x5d628f['shift']());}};_0x68983a(++_0xdfa6ac);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2de25a,_0x5df46f){_0x2de25a=_0x2de25a-0x0;var _0x132f44=_0x5f2f[_0x2de25a];return _0x132f44;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 675cd00..d0d2bbe 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 _0x4327=['../../config/environment','isAuthenticated','/:id','show','post','put','update','delete','exports','path','express','../../components/interaction/service'];(function(_0x19e08e,_0x178f46){var _0x14c229=function(_0x791b3b){while(--_0x791b3b){_0x19e08e['push'](_0x19e08e['shift']());}};_0x14c229(++_0x178f46);}(_0x4327,0x11d));var _0x7432=function(_0x2cfb48,_0x24b83b){_0x2cfb48=_0x2cfb48-0x0;var _0xc4594f=_0x4327[_0x2cfb48];return _0xc4594f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7432('0x0'));var timeout=require('connect-timeout');var express=require(_0x7432('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7432('0x2'));var config=require(_0x7432('0x3'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0x7432('0x4')](),controller['index']);router['get'](_0x7432('0x5'),auth['isAuthenticated'](),controller[_0x7432('0x6')]);router[_0x7432('0x7')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7432('0x8')]('/:id',auth[_0x7432('0x4')](),controller[_0x7432('0x9')]);router[_0x7432('0xa')]('/:id',auth[_0x7432('0x4')](),controller['destroy']);module[_0x7432('0xb')]=router; \ No newline at end of file +var _0x2472=['put','update','exports','util','path','Router','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x3609af,_0x3d20ea){var _0x438412=function(_0x3bc2a4){while(--_0x3bc2a4){_0x3609af['push'](_0x3609af['shift']());}};_0x438412(++_0x3d20ea);}(_0x2472,0xe3));var _0x2247=function(_0x4eb2b5,_0x35d937){_0x4eb2b5=_0x4eb2b5-0x0;var _0x226ef8=_0x2472[_0x4eb2b5];return _0x226ef8;};'use strict';var multer=require('multer');var util=require(_0x2247('0x0'));var path=require(_0x2247('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2247('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2247('0x3'));var config=require('../../config/environment');var controller=require(_0x2247('0x4'));router[_0x2247('0x5')]('/',auth[_0x2247('0x6')](),controller[_0x2247('0x7')]);router[_0x2247('0x5')](_0x2247('0x8'),auth[_0x2247('0x6')](),controller[_0x2247('0x9')]);router[_0x2247('0xa')]('/',auth[_0x2247('0x6')](),controller['create']);router[_0x2247('0xb')]('/:id',auth[_0x2247('0x6')](),controller[_0x2247('0xc')]);router['delete'](_0x2247('0x8'),auth[_0x2247('0x6')](),controller['destroy']);module[_0x2247('0xd')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 78ba0b1..ce80c58 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 _0x851d=['STRING','sequelize'];(function(_0x4f1d24,_0x2d0b63){var _0x3cf780=function(_0x488e3d){while(--_0x488e3d){_0x4f1d24['push'](_0x4f1d24['shift']());}};_0x3cf780(++_0x2d0b63);}(_0x851d,0x69));var _0xd851=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x851d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd851('0x0'));module['exports']={'name':{'type':Sequelize[_0xd851('0x1')]},'basename':{'type':Sequelize[_0xd851('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeedf=['sequelize','exports','STRING'];(function(_0x5c0431,_0x122734){var _0x516bfa=function(_0x4528e4){while(--_0x4528e4){_0x5c0431['push'](_0x5c0431['shift']());}};_0x516bfa(++_0x122734);}(_0xeedf,0x12c));var _0xfeed=function(_0x204912,_0x491149){_0x204912=_0x204912-0x0;var _0x568075=_0xeedf[_0x204912];return _0x568075;};'use strict';var Sequelize=require(_0xfeed('0x0'));module[_0xfeed('0x1')]={'name':{'type':Sequelize[_0xfeed('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfeed('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index a3e1ca1..f66207d 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 _0x6df5=['filename','download','findOne','join','server/files/attachments/','basename','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Attachment','findAll','rows','catch','show','params','find','clone','get','updatedAt','body','omit','createdAt','create'];(function(_0x35eec1,_0x9a6437){var _0x32e069=function(_0xd5def1){while(--_0xd5def1){_0x35eec1['push'](_0x35eec1['shift']());}};_0x32e069(++_0x9a6437);}(_0x6df5,0xb4));var _0x56df=function(_0x12f35c,_0x23fe06){_0x12f35c=_0x12f35c-0x0;var _0xe7442a=_0x6df5[_0x12f35c];return _0xe7442a;};'use strict';var emlformat=require(_0x56df('0x0'));var rimraf=require(_0x56df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56df('0x2'));var rp=require(_0x56df('0x3'));var moment=require('moment');var BPromise=require(_0x56df('0x4'));var Mustache=require('mustache');var util=require(_0x56df('0x5'));var path=require(_0x56df('0x6'));var sox=require(_0x56df('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56df('0x8'));var _=require(_0x56df('0x9'));var squel=require(_0x56df('0xa'));var crypto=require(_0x56df('0xb'));var jsforce=require(_0x56df('0xc'));var deskjs=require(_0x56df('0xd'));var toCsv=require(_0x56df('0xe'));var querystring=require(_0x56df('0xf'));var Papa=require('papaparse');var Redis=require(_0x56df('0x10'));var authService=require(_0x56df('0x11'));var qs=require(_0x56df('0x12'));var as=require(_0x56df('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x56df('0x14'))(_0x56df('0x15'));var utils=require('../../config/utils');var config=require(_0x56df('0x16'));var licenseUtil=require(_0x56df('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c989f,_0x5d3e74){_0x5d3e74=_0x5d3e74||0xcc;return function(_0x305e23){if(_0x305e23){return _0x5c989f['sendStatus'](_0x5d3e74);}return _0x5c989f[_0x56df('0x18')](_0x5d3e74)[_0x56df('0x19')]();};}function respondWithResult(_0x48101b,_0x595472){_0x595472=_0x595472||0xc8;return function(_0x4240f3){if(_0x4240f3){return _0x48101b[_0x56df('0x18')](_0x595472)['json'](_0x4240f3);}};}function respondWithFilteredResult(_0x12ee70,_0x35c330){return function(_0x2ea844){if(_0x2ea844){var _0x729257=typeof _0x35c330['offset']===_0x56df('0x1a')&&typeof _0x35c330[_0x56df('0x1b')]===_0x56df('0x1a');var _0xf927ba=_0x2ea844[_0x56df('0x1c')];var _0x81c0fe=_0x729257?0x0:_0x35c330[_0x56df('0x1d')];var _0x9b5949=_0x729257?_0x2ea844[_0x56df('0x1c')]:_0x35c330['offset']+_0x35c330[_0x56df('0x1b')];var _0x886ba8;if(_0x9b5949>=_0xf927ba){_0x9b5949=_0xf927ba;_0x886ba8=0xc8;}else{_0x886ba8=0xce;}_0x12ee70[_0x56df('0x18')](_0x886ba8);return _0x12ee70['set'](_0x56df('0x1e'),_0x81c0fe+'-'+_0x9b5949+'/'+_0xf927ba)[_0x56df('0x1f')](_0x2ea844);}return null;};}function patchUpdates(_0x1c38d2){return function(_0x16dbf3){try{jsonpatch[_0x56df('0x20')](_0x16dbf3,_0x1c38d2,!![]);}catch(_0x180e50){return BPromise[_0x56df('0x21')](_0x180e50);}return _0x16dbf3[_0x56df('0x22')]();};}function saveUpdates(_0x86354b,_0x2d9df0){return function(_0x52c3c8){if(_0x52c3c8){return _0x52c3c8[_0x56df('0x23')](_0x86354b)[_0x56df('0x24')](function(_0xabf566){return _0xabf566;});}return null;};}function removeEntity(_0x4e082e,_0x585586){return function(_0x3a3c7f){if(_0x3a3c7f){return _0x3a3c7f[_0x56df('0x25')]()[_0x56df('0x24')](function(){_0x4e082e[_0x56df('0x18')](0xcc)[_0x56df('0x19')]();});}};}function handleEntityNotFound(_0x12b357,_0x487a13){return function(_0x2374b8){if(!_0x2374b8){_0x12b357['sendStatus'](0x194);}return _0x2374b8;};}function handleError(_0x115846,_0x514c7c){_0x514c7c=_0x514c7c||0x1f4;return function(_0x2dc53c){logger[_0x56df('0x26')](_0x2dc53c[_0x56df('0x27')]);if(_0x2dc53c[_0x56df('0x28')]){delete _0x2dc53c['name'];}_0x115846[_0x56df('0x18')](_0x514c7c)['send'](_0x2dc53c);};}exports[_0x56df('0x29')]=function(_0x39c41e,_0x352c16){var _0x1a1a58={},_0x189a9d={},_0x4542d6={'count':0x0,'rows':[]};var _0x58d0fd=_[_0x56df('0x2a')](db['Attachment'][_0x56df('0x2b')],function(_0x9a0961){return{'name':_0x9a0961[_0x56df('0x2c')],'type':_0x9a0961[_0x56df('0x2d')][_0x56df('0x2e')]};});_0x189a9d[_0x56df('0x2f')]=_['map'](_0x58d0fd,'name');_0x189a9d[_0x56df('0x30')]=_[_0x56df('0x31')](_0x39c41e[_0x56df('0x30')]);_0x189a9d[_0x56df('0x32')]=_[_0x56df('0x33')](_0x189a9d[_0x56df('0x2f')],_0x189a9d[_0x56df('0x30')]);_0x1a1a58[_0x56df('0x34')]=_[_0x56df('0x33')](_0x189a9d['model'],qs['fields'](_0x39c41e[_0x56df('0x30')][_0x56df('0x35')]));_0x1a1a58[_0x56df('0x34')]=_0x1a1a58['attributes'][_0x56df('0x36')]?_0x1a1a58[_0x56df('0x34')]:_0x189a9d[_0x56df('0x2f')];if(!_0x39c41e[_0x56df('0x30')][_0x56df('0x37')](_0x56df('0x38'))){_0x1a1a58[_0x56df('0x1b')]=qs[_0x56df('0x1b')](_0x39c41e[_0x56df('0x30')][_0x56df('0x1b')]);_0x1a1a58[_0x56df('0x1d')]=qs[_0x56df('0x1d')](_0x39c41e[_0x56df('0x30')]['offset']);}_0x1a1a58[_0x56df('0x39')]=qs[_0x56df('0x3a')](_0x39c41e[_0x56df('0x30')]['sort']);_0x1a1a58[_0x56df('0x3b')]=qs['filters'](_[_0x56df('0x3c')](_0x39c41e['query'],_0x189a9d[_0x56df('0x32')]),_0x58d0fd);if(_0x39c41e['query'][_0x56df('0x3d')]){_0x1a1a58[_0x56df('0x3b')]=_[_0x56df('0x3e')](_0x1a1a58['where'],{'$or':_[_0x56df('0x2a')](_0x58d0fd,function(_0x457901){if(_0x457901['type']!==_0x56df('0x3f')){var _0x55f6ee={};_0x55f6ee[_0x457901[_0x56df('0x28')]]={'$like':'%'+_0x39c41e[_0x56df('0x30')][_0x56df('0x3d')]+'%'};return _0x55f6ee;}})});}_0x1a1a58=_[_0x56df('0x3e')]({},_0x1a1a58,_0x39c41e[_0x56df('0x40')]);var _0x21af9f={'where':_0x1a1a58[_0x56df('0x3b')]};return db['Attachment'][_0x56df('0x1c')](_0x21af9f)[_0x56df('0x24')](function(_0x398f54){_0x4542d6[_0x56df('0x1c')]=_0x398f54;if(_0x39c41e[_0x56df('0x30')][_0x56df('0x41')]){_0x1a1a58[_0x56df('0x42')]=[{'all':!![]}];}return db[_0x56df('0x43')][_0x56df('0x44')](_0x1a1a58);})[_0x56df('0x24')](function(_0x2d1820){_0x4542d6[_0x56df('0x45')]=_0x2d1820;return _0x4542d6;})[_0x56df('0x24')](respondWithFilteredResult(_0x352c16,_0x1a1a58))[_0x56df('0x46')](handleError(_0x352c16,null));};exports[_0x56df('0x47')]=function(_0x160601,_0x4093e5){var _0x1c456f={'raw':!![],'where':{'id':_0x160601[_0x56df('0x48')]['id']}},_0x5d37d0={};_0x5d37d0[_0x56df('0x2f')]=_[_0x56df('0x31')](db[_0x56df('0x43')][_0x56df('0x2b')]);_0x5d37d0[_0x56df('0x30')]=_[_0x56df('0x31')](_0x160601['query']);_0x5d37d0[_0x56df('0x32')]=_[_0x56df('0x33')](_0x5d37d0['model'],_0x5d37d0[_0x56df('0x30')]);_0x1c456f[_0x56df('0x34')]=_[_0x56df('0x33')](_0x5d37d0[_0x56df('0x2f')],qs[_0x56df('0x35')](_0x160601[_0x56df('0x30')][_0x56df('0x35')]));_0x1c456f['attributes']=_0x1c456f[_0x56df('0x34')][_0x56df('0x36')]?_0x1c456f[_0x56df('0x34')]:_0x5d37d0[_0x56df('0x2f')];if(_0x160601[_0x56df('0x30')][_0x56df('0x41')]){_0x1c456f[_0x56df('0x42')]=[{'all':!![]}];}_0x1c456f=_['merge']({},_0x1c456f,_0x160601[_0x56df('0x40')]);return db[_0x56df('0x43')][_0x56df('0x49')](_0x1c456f)[_0x56df('0x24')](handleEntityNotFound(_0x4093e5,null))[_0x56df('0x24')](respondWithResult(_0x4093e5,null))[_0x56df('0x46')](handleError(_0x4093e5,null));};exports[_0x56df('0x4a')]=function(_0x60c3b8,_0x175a5c){var _0x1e9b8a={'where':{'id':_0x60c3b8[_0x56df('0x48')]['id']}},_0x714660={};_0x714660[_0x56df('0x2f')]=_[_0x56df('0x31')](db[_0x56df('0x43')][_0x56df('0x2b')]);_0x1e9b8a[_0x56df('0x34')]=_[_0x56df('0x33')](_0x714660[_0x56df('0x2f')],qs[_0x56df('0x35')](_0x60c3b8['query']['fields']));_0x1e9b8a[_0x56df('0x34')]=_0x1e9b8a['attributes']['length']?_0x1e9b8a['attributes']:_0x714660[_0x56df('0x2f')];if(_0x60c3b8['query'][_0x56df('0x41')]){_0x1e9b8a[_0x56df('0x42')]=[{'all':!![]}];}_0x1e9b8a=_[_0x56df('0x3e')]({},_0x1e9b8a,_0x60c3b8['options']);return db[_0x56df('0x43')][_0x56df('0x49')](_0x1e9b8a)[_0x56df('0x24')](handleEntityNotFound(_0x175a5c,null))[_0x56df('0x24')](function(_0xb23fbe){if(_0xb23fbe){var _0x4e2eeb=_0xb23fbe[_0x56df('0x4b')]({'plain':!![]});_0x4e2eeb=qs['omit'](_0x4e2eeb,['id','createdAt',_0x56df('0x4c')]);_0x60c3b8[_0x56df('0x4d')]=_[_0x56df('0x4e')](_0x60c3b8['body'],['id',_0x56df('0x4f'),_0x56df('0x4c')]);return db[_0x56df('0x43')][_0x56df('0x50')](_[_0x56df('0x3e')](_0x4e2eeb,_0x60c3b8[_0x56df('0x4d')]),{'include':_0x60c3b8[_0x56df('0x30')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x56df('0x24')](respondWithResult(_0x175a5c,0xc9))[_0x56df('0x46')](handleError(_0x175a5c,null));};exports['update']=function(_0x5145af,_0x4749b4){if(_0x5145af[_0x56df('0x4d')]['id']){delete _0x5145af[_0x56df('0x4d')]['id'];}return db[_0x56df('0x43')]['find']({'where':{'id':_0x5145af['params']['id']}})[_0x56df('0x24')](handleEntityNotFound(_0x4749b4,null))['then'](saveUpdates(_0x5145af[_0x56df('0x4d')],null))[_0x56df('0x24')](respondWithResult(_0x4749b4,null))['catch'](handleError(_0x4749b4,null));};exports['destroy']=function(_0x418e73,_0xcef80c){return db[_0x56df('0x43')][_0x56df('0x49')]({'where':{'id':_0x418e73[_0x56df('0x48')]['id']}})['then'](handleEntityNotFound(_0xcef80c,null))[_0x56df('0x24')](removeEntity(_0xcef80c,null))[_0x56df('0x46')](handleError(_0xcef80c,null));};exports[_0x56df('0x50')]=function(_0xaa308e,_0x3b8edf,_0x579bb4){_0xaa308e[_0x56df('0x4d')]['name']=_0xaa308e['file']['originalname'];_0xaa308e[_0x56df('0x4d')]['basename']=_0xaa308e['file'][_0x56df('0x51')];_0xaa308e['body'][_0x56df('0x2d')]=_0xaa308e['file']['mimetype'];return db[_0x56df('0x43')][_0x56df('0x50')](_0xaa308e[_0x56df('0x4d')])[_0x56df('0x24')](respondWithResult(_0x3b8edf,0xc9))[_0x56df('0x46')](handleError(_0x3b8edf,null));};exports[_0x56df('0x52')]=function(_0x32e0ed,_0x2e91ab,_0x1e0064){return db[_0x56df('0x43')][_0x56df('0x53')]({'where':{'id':_0x32e0ed[_0x56df('0x48')]['id']},'raw':!![]})[_0x56df('0x24')](handleEntityNotFound(_0x2e91ab,null))[_0x56df('0x24')](function(_0x2b5954){if(_0x2b5954){var _0xe73637=_0x2b5954['ChatOfflineMessageId']!==null;var _0x1537cf=path[_0x56df('0x54')](config['root'],_0x56df('0x55'));if(_0xe73637){_0x1537cf=path[_0x56df('0x54')](_0x1537cf,'offline-chat/');}var _0x498287=path[_0x56df('0x54')](_0x1537cf,_0x2b5954[_0x56df('0x56')]);return _0x2e91ab[_0x56df('0x52')](_0x498287);}})[_0x56df('0x46')](handleError(_0x2e91ab,null));}; \ No newline at end of file +var _0xf57f=['options','include','findAll','show','params','keys','Attachment','find','catch','clone','includeAll','get','omit','createdAt','updatedAt','body','create','file','basename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL'];(function(_0x2a2f72,_0x2dead3){var _0x369c6a=function(_0x252507){while(--_0x252507){_0x2a2f72['push'](_0x2a2f72['shift']());}};_0x369c6a(++_0x2dead3);}(_0xf57f,0x166));var _0xff57=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0xf57f[_0x31abee];return _0x3c1761;};'use strict';var emlformat=require(_0xff57('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff57('0x1'));var jsonpatch=require(_0xff57('0x2'));var rp=require('request-promise');var moment=require(_0xff57('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xff57('0x4'));var sox=require(_0xff57('0x5'));var csv=require(_0xff57('0x6'));var ejs=require(_0xff57('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff57('0x8'));var squel=require('squel');var crypto=require(_0xff57('0x9'));var jsforce=require(_0xff57('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xff57('0x6'));var querystring=require(_0xff57('0xb'));var Papa=require('papaparse');var Redis=require(_0xff57('0xc'));var authService=require(_0xff57('0xd'));var qs=require(_0xff57('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff57('0xf'));var logger=require(_0xff57('0x10'))(_0xff57('0x11'));var utils=require(_0xff57('0x12'));var config=require(_0xff57('0x13'));var licenseUtil=require(_0xff57('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57c351,_0x322f1b){_0x322f1b=_0x322f1b||0xcc;return function(_0xa0ba48){if(_0xa0ba48){return _0x57c351['sendStatus'](_0x322f1b);}return _0x57c351[_0xff57('0x15')](_0x322f1b)[_0xff57('0x16')]();};}function respondWithResult(_0x292b3e,_0x4255d6){_0x4255d6=_0x4255d6||0xc8;return function(_0x2e830a){if(_0x2e830a){return _0x292b3e['status'](_0x4255d6)['json'](_0x2e830a);}};}function respondWithFilteredResult(_0x491eac,_0x3f2995){return function(_0x276127){if(_0x276127){var _0x2ed712=typeof _0x3f2995[_0xff57('0x17')]==='undefined'&&typeof _0x3f2995[_0xff57('0x18')]===_0xff57('0x19');var _0x1b4e66=_0x276127[_0xff57('0x1a')];var _0x4cf6fd=_0x2ed712?0x0:_0x3f2995[_0xff57('0x17')];var _0x1307c3=_0x2ed712?_0x276127[_0xff57('0x1a')]:_0x3f2995[_0xff57('0x17')]+_0x3f2995[_0xff57('0x18')];var _0x46cc53;if(_0x1307c3>=_0x1b4e66){_0x1307c3=_0x1b4e66;_0x46cc53=0xc8;}else{_0x46cc53=0xce;}_0x491eac[_0xff57('0x15')](_0x46cc53);return _0x491eac[_0xff57('0x1b')](_0xff57('0x1c'),_0x4cf6fd+'-'+_0x1307c3+'/'+_0x1b4e66)[_0xff57('0x1d')](_0x276127);}return null;};}function patchUpdates(_0xb1a8bd){return function(_0x53bf82){try{jsonpatch['apply'](_0x53bf82,_0xb1a8bd,!![]);}catch(_0x493d67){return BPromise[_0xff57('0x1e')](_0x493d67);}return _0x53bf82[_0xff57('0x1f')]();};}function saveUpdates(_0x532c6c,_0x568fd5){return function(_0x4fae20){if(_0x4fae20){return _0x4fae20['update'](_0x532c6c)[_0xff57('0x20')](function(_0x21ac20){return _0x21ac20;});}return null;};}function removeEntity(_0x4bb241,_0x39fd56){return function(_0x1977de){if(_0x1977de){return _0x1977de['destroy']()[_0xff57('0x20')](function(){_0x4bb241[_0xff57('0x15')](0xcc)[_0xff57('0x16')]();});}};}function handleEntityNotFound(_0x8c32f5,_0x1eb8bb){return function(_0x195a97){if(!_0x195a97){_0x8c32f5[_0xff57('0x21')](0x194);}return _0x195a97;};}function handleError(_0x13970a,_0x44886f){_0x44886f=_0x44886f||0x1f4;return function(_0x3699c0){logger[_0xff57('0x22')](_0x3699c0[_0xff57('0x23')]);if(_0x3699c0['name']){delete _0x3699c0[_0xff57('0x24')];}_0x13970a['status'](_0x44886f)['send'](_0x3699c0);};}exports[_0xff57('0x25')]=function(_0x4a2387,_0x49834e){var _0x3aa3e5={},_0x4f319c={},_0x27314e={'count':0x0,'rows':[]};var _0x13ba0b=_[_0xff57('0x26')](db['Attachment'][_0xff57('0x27')],function(_0x235e57){return{'name':_0x235e57[_0xff57('0x28')],'type':_0x235e57[_0xff57('0x29')]['key']};});_0x4f319c[_0xff57('0x2a')]=_[_0xff57('0x26')](_0x13ba0b,_0xff57('0x24'));_0x4f319c[_0xff57('0x2b')]=_['keys'](_0x4a2387[_0xff57('0x2b')]);_0x4f319c['filters']=_[_0xff57('0x2c')](_0x4f319c[_0xff57('0x2a')],_0x4f319c[_0xff57('0x2b')]);_0x3aa3e5[_0xff57('0x2d')]=_['intersection'](_0x4f319c[_0xff57('0x2a')],qs['fields'](_0x4a2387['query'][_0xff57('0x2e')]));_0x3aa3e5['attributes']=_0x3aa3e5[_0xff57('0x2d')][_0xff57('0x2f')]?_0x3aa3e5[_0xff57('0x2d')]:_0x4f319c[_0xff57('0x2a')];if(!_0x4a2387[_0xff57('0x2b')][_0xff57('0x30')](_0xff57('0x31'))){_0x3aa3e5[_0xff57('0x18')]=qs[_0xff57('0x18')](_0x4a2387[_0xff57('0x2b')]['limit']);_0x3aa3e5[_0xff57('0x17')]=qs['offset'](_0x4a2387[_0xff57('0x2b')][_0xff57('0x17')]);}_0x3aa3e5['order']=qs[_0xff57('0x32')](_0x4a2387[_0xff57('0x2b')][_0xff57('0x32')]);_0x3aa3e5['where']=qs[_0xff57('0x33')](_[_0xff57('0x34')](_0x4a2387[_0xff57('0x2b')],_0x4f319c['filters']),_0x13ba0b);if(_0x4a2387['query'][_0xff57('0x35')]){_0x3aa3e5[_0xff57('0x36')]=_[_0xff57('0x37')](_0x3aa3e5[_0xff57('0x36')],{'$or':_[_0xff57('0x26')](_0x13ba0b,function(_0x273b4b){if(_0x273b4b[_0xff57('0x29')]!==_0xff57('0x38')){var _0x364e9f={};_0x364e9f[_0x273b4b[_0xff57('0x24')]]={'$like':'%'+_0x4a2387[_0xff57('0x2b')][_0xff57('0x35')]+'%'};return _0x364e9f;}})});}_0x3aa3e5=_[_0xff57('0x37')]({},_0x3aa3e5,_0x4a2387[_0xff57('0x39')]);var _0x5086f3={'where':_0x3aa3e5[_0xff57('0x36')]};return db['Attachment'][_0xff57('0x1a')](_0x5086f3)['then'](function(_0x4c49ab){_0x27314e[_0xff57('0x1a')]=_0x4c49ab;if(_0x4a2387['query']['includeAll']){_0x3aa3e5[_0xff57('0x3a')]=[{'all':!![]}];}return db['Attachment'][_0xff57('0x3b')](_0x3aa3e5);})[_0xff57('0x20')](function(_0x1c1d4c){_0x27314e['rows']=_0x1c1d4c;return _0x27314e;})[_0xff57('0x20')](respondWithFilteredResult(_0x49834e,_0x3aa3e5))['catch'](handleError(_0x49834e,null));};exports[_0xff57('0x3c')]=function(_0x5939c2,_0x2098cf){var _0x6f220e={'raw':!![],'where':{'id':_0x5939c2[_0xff57('0x3d')]['id']}},_0x403f9b={};_0x403f9b[_0xff57('0x2a')]=_[_0xff57('0x3e')](db[_0xff57('0x3f')][_0xff57('0x27')]);_0x403f9b[_0xff57('0x2b')]=_[_0xff57('0x3e')](_0x5939c2[_0xff57('0x2b')]);_0x403f9b[_0xff57('0x33')]=_[_0xff57('0x2c')](_0x403f9b['model'],_0x403f9b[_0xff57('0x2b')]);_0x6f220e['attributes']=_[_0xff57('0x2c')](_0x403f9b['model'],qs[_0xff57('0x2e')](_0x5939c2[_0xff57('0x2b')][_0xff57('0x2e')]));_0x6f220e[_0xff57('0x2d')]=_0x6f220e[_0xff57('0x2d')][_0xff57('0x2f')]?_0x6f220e[_0xff57('0x2d')]:_0x403f9b[_0xff57('0x2a')];if(_0x5939c2['query']['includeAll']){_0x6f220e[_0xff57('0x3a')]=[{'all':!![]}];}_0x6f220e=_[_0xff57('0x37')]({},_0x6f220e,_0x5939c2['options']);return db['Attachment'][_0xff57('0x40')](_0x6f220e)['then'](handleEntityNotFound(_0x2098cf,null))[_0xff57('0x20')](respondWithResult(_0x2098cf,null))[_0xff57('0x41')](handleError(_0x2098cf,null));};exports[_0xff57('0x42')]=function(_0x4f7f35,_0x2911ee){var _0x273be7={'where':{'id':_0x4f7f35[_0xff57('0x3d')]['id']}},_0x66c534={};_0x66c534[_0xff57('0x2a')]=_[_0xff57('0x3e')](db[_0xff57('0x3f')][_0xff57('0x27')]);_0x273be7['attributes']=_[_0xff57('0x2c')](_0x66c534['model'],qs['fields'](_0x4f7f35[_0xff57('0x2b')][_0xff57('0x2e')]));_0x273be7['attributes']=_0x273be7[_0xff57('0x2d')][_0xff57('0x2f')]?_0x273be7[_0xff57('0x2d')]:_0x66c534[_0xff57('0x2a')];if(_0x4f7f35[_0xff57('0x2b')][_0xff57('0x43')]){_0x273be7['include']=[{'all':!![]}];}_0x273be7=_[_0xff57('0x37')]({},_0x273be7,_0x4f7f35['options']);return db[_0xff57('0x3f')]['find'](_0x273be7)[_0xff57('0x20')](handleEntityNotFound(_0x2911ee,null))['then'](function(_0xed4a6f){if(_0xed4a6f){var _0x1f513d=_0xed4a6f[_0xff57('0x44')]({'plain':!![]});_0x1f513d=qs[_0xff57('0x45')](_0x1f513d,['id',_0xff57('0x46'),_0xff57('0x47')]);_0x4f7f35[_0xff57('0x48')]=_[_0xff57('0x45')](_0x4f7f35['body'],['id','createdAt',_0xff57('0x47')]);return db['Attachment'][_0xff57('0x49')](_[_0xff57('0x37')](_0x1f513d,_0x4f7f35[_0xff57('0x48')]),{'include':_0x4f7f35[_0xff57('0x2b')][_0xff57('0x43')]?[{'all':!![]}]:undefined});}})[_0xff57('0x20')](respondWithResult(_0x2911ee,0xc9))[_0xff57('0x41')](handleError(_0x2911ee,null));};exports['update']=function(_0x211a35,_0x12355a){if(_0x211a35['body']['id']){delete _0x211a35[_0xff57('0x48')]['id'];}return db[_0xff57('0x3f')][_0xff57('0x40')]({'where':{'id':_0x211a35['params']['id']}})[_0xff57('0x20')](handleEntityNotFound(_0x12355a,null))[_0xff57('0x20')](saveUpdates(_0x211a35['body'],null))['then'](respondWithResult(_0x12355a,null))[_0xff57('0x41')](handleError(_0x12355a,null));};exports['destroy']=function(_0x2b0342,_0x1cec55){return db['Attachment'][_0xff57('0x40')]({'where':{'id':_0x2b0342[_0xff57('0x3d')]['id']}})[_0xff57('0x20')](handleEntityNotFound(_0x1cec55,null))[_0xff57('0x20')](removeEntity(_0x1cec55,null))[_0xff57('0x41')](handleError(_0x1cec55,null));};exports[_0xff57('0x49')]=function(_0x2c8bf2,_0x3bf119,_0x34ed44){_0x2c8bf2[_0xff57('0x48')][_0xff57('0x24')]=_0x2c8bf2[_0xff57('0x4a')]['originalname'];_0x2c8bf2['body'][_0xff57('0x4b')]=_0x2c8bf2['file']['filename'];_0x2c8bf2['body'][_0xff57('0x29')]=_0x2c8bf2[_0xff57('0x4a')]['mimetype'];return db[_0xff57('0x3f')][_0xff57('0x49')](_0x2c8bf2[_0xff57('0x48')])['then'](respondWithResult(_0x3bf119,0xc9))[_0xff57('0x41')](handleError(_0x3bf119,null));};exports[_0xff57('0x4c')]=function(_0x2f7427,_0x26ead9,_0x36be45){return db['Attachment'][_0xff57('0x4d')]({'where':{'id':_0x2f7427['params']['id']},'raw':!![]})[_0xff57('0x20')](handleEntityNotFound(_0x26ead9,null))[_0xff57('0x20')](function(_0x4518e0){if(_0x4518e0){var _0x1e3f54=_0x4518e0[_0xff57('0x4e')]!==null;var _0x95d87d=path[_0xff57('0x4f')](config[_0xff57('0x50')],_0xff57('0x51'));if(_0x1e3f54){_0x95d87d=path[_0xff57('0x4f')](_0x95d87d,_0xff57('0x52'));}var _0x490c04=path[_0xff57('0x4f')](_0x95d87d,_0x4518e0['basename']);return _0x26ead9[_0xff57('0x4c')](_0x490c04);}})[_0xff57('0x41')](handleError(_0x26ead9,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 3c2b0a7..b1962b6 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 _0x01df=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','define','attachments'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x01df,0x1b8));var _0xf01d=function(_0x3fb2b7,_0x38ed27){_0x3fb2b7=_0x3fb2b7-0x0;var _0x1fdabe=_0x01df[_0x3fb2b7];return _0x1fdabe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf01d('0x0'))('api');var moment=require(_0xf01d('0x1'));var BPromise=require(_0xf01d('0x2'));var rp=require(_0xf01d('0x3'));var fs=require('fs');var path=require(_0xf01d('0x4'));var rimraf=require(_0xf01d('0x5'));var config=require(_0xf01d('0x6'));var attributes=require(_0xf01d('0x7'));module['exports']=function(_0x442197,_0x4b761f){return _0x442197[_0xf01d('0x8')]('Attachment',attributes,{'tableName':_0xf01d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ed5=['bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','attachments','util','../../config/logger','moment'];(function(_0x4c9380,_0x2fefc0){var _0x49a523=function(_0x165e85){while(--_0x165e85){_0x4c9380['push'](_0x4c9380['shift']());}};_0x49a523(++_0x2fefc0);}(_0x9ed5,0x126));var _0x59ed=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0x9ed5[_0x27bd2c];return _0x3784ea;};'use strict';var _=require('lodash');var util=require(_0x59ed('0x0'));var logger=require(_0x59ed('0x1'))('api');var moment=require(_0x59ed('0x2'));var BPromise=require(_0x59ed('0x3'));var rp=require(_0x59ed('0x4'));var fs=require('fs');var path=require(_0x59ed('0x5'));var rimraf=require(_0x59ed('0x6'));var config=require(_0x59ed('0x7'));var attributes=require(_0x59ed('0x8'));module[_0x59ed('0x9')]=function(_0x583118,_0xb1d3db){return _0x583118['define']('Attachment',attributes,{'tableName':_0x59ed('0xa'),'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 75e0c95..3e35751 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 _0xcc73=['body','raw','stringify','util','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateAttachment','Attachment','create'];(function(_0x79ee9e,_0x2af75b){var _0x33f608=function(_0x4b8405){while(--_0x4b8405){_0x79ee9e['push'](_0x79ee9e['shift']());}};_0x33f608(++_0x2af75b);}(_0xcc73,0x1cb));var _0x3cc7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xcc73[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x3cc7('0x0'));var moment=require(_0x3cc7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3cc7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3cc7('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x3cc7('0x4'));var jayson=require(_0x3cc7('0x5'));var client=jayson[_0x3cc7('0x6')][_0x3cc7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x127590,_0x5604df,_0x416c48){return new BPromise(function(_0x37c184,_0x3f2dd7){return client[_0x3cc7('0x8')](_0x127590,_0x416c48)['then'](function(_0x2ff7ba){logger[_0x3cc7('0x9')](_0x3cc7('0xa'),_0x5604df,_0x3cc7('0xb'));logger[_0x3cc7('0xc')](_0x3cc7('0xd'),_0x5604df,_0x3cc7('0xb'),JSON['stringify'](_0x2ff7ba));if(_0x2ff7ba['error']){if(_0x2ff7ba[_0x3cc7('0xe')]['code']===0x1f4){logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);return _0x3f2dd7(_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);}logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);return _0x37c184(_0x2ff7ba[_0x3cc7('0xe')][_0x3cc7('0xf')]);}else{logger[_0x3cc7('0x9')](_0x3cc7('0xa'),_0x5604df,_0x3cc7('0xb'));_0x37c184(_0x2ff7ba[_0x3cc7('0x10')][_0x3cc7('0xf')]);}})[_0x3cc7('0x11')](function(_0x386a31){logger[_0x3cc7('0xe')](_0x3cc7('0xa'),_0x5604df,_0x386a31);_0x3f2dd7(_0x386a31);});});}exports[_0x3cc7('0x12')]=function(_0x2a4ddf){var _0xff4317=this;return new Promise(function(_0x118aa0,_0x2f196a){return db[_0x3cc7('0x13')][_0x3cc7('0x14')](_0x2a4ddf[_0x3cc7('0x15')],{'raw':_0x2a4ddf['options']?_0x2a4ddf['options'][_0x3cc7('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x41c9fb){logger[_0x3cc7('0x9')](_0x3cc7('0x12'),_0x2a4ddf);logger['debug']('CreateAttachment',_0x2a4ddf,JSON[_0x3cc7('0x17')](_0x41c9fb));_0x118aa0(_0x41c9fb);})[_0x3cc7('0x11')](function(_0x4d5b7f){logger[_0x3cc7('0xe')](_0x3cc7('0x12'),_0x4d5b7f['message'],_0x2a4ddf);_0x2f196a(_0xff4317[_0x3cc7('0xe')](0x1f4,_0x4d5b7f['message']));});});}; \ No newline at end of file +var _0xae79=['options','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','create','body'];(function(_0x2ab2cc,_0xe88512){var _0x4f89f6=function(_0x3f6e6c){while(--_0x3f6e6c){_0x2ab2cc['push'](_0x2ab2cc['shift']());}};_0x4f89f6(++_0xe88512);}(_0xae79,0x1d3));var _0x9ae7=function(_0x58d4ff,_0x20a955){_0x58d4ff=_0x58d4ff-0x0;var _0x227eea=_0xae79[_0x58d4ff];return _0x227eea;};'use strict';var _=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var moment=require(_0x9ae7('0x2'));var BPromise=require(_0x9ae7('0x3'));var rs=require(_0x9ae7('0x4'));var fs=require('fs');var Redis=require(_0x9ae7('0x5'));var db=require(_0x9ae7('0x6'))['db'];var utils=require(_0x9ae7('0x7'));var logger=require(_0x9ae7('0x8'))(_0x9ae7('0x9'));var config=require(_0x9ae7('0xa'));var jayson=require(_0x9ae7('0xb'));var client=jayson[_0x9ae7('0xc')][_0x9ae7('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x409d34,_0x57114d,_0x2761c2){return new BPromise(function(_0x47774e,_0x3c7738){return client[_0x9ae7('0xe')](_0x409d34,_0x2761c2)[_0x9ae7('0xf')](function(_0xc023d2){logger['info'](_0x9ae7('0x10'),_0x57114d,'request\x20sent');logger[_0x9ae7('0x11')](_0x9ae7('0x12'),_0x57114d,_0x9ae7('0x13'),JSON[_0x9ae7('0x14')](_0xc023d2));if(_0xc023d2[_0x9ae7('0x15')]){if(_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x16')]===0x1f4){logger['error'](_0x9ae7('0x10'),_0x57114d,_0xc023d2[_0x9ae7('0x15')]['message']);return _0x3c7738(_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x17')]);}logger[_0x9ae7('0x15')](_0x9ae7('0x10'),_0x57114d,_0xc023d2[_0x9ae7('0x15')][_0x9ae7('0x17')]);return _0x47774e(_0xc023d2[_0x9ae7('0x15')]['message']);}else{logger[_0x9ae7('0x18')](_0x9ae7('0x10'),_0x57114d,_0x9ae7('0x13'));_0x47774e(_0xc023d2[_0x9ae7('0x19')]['message']);}})[_0x9ae7('0x1a')](function(_0xe1a2d1){logger[_0x9ae7('0x15')]('Attachment,\x20%s,\x20%s',_0x57114d,_0xe1a2d1);_0x3c7738(_0xe1a2d1);});});}exports['CreateAttachment']=function(_0x2c7643){var _0x5e69c2=this;return new Promise(function(_0x5d6ad1,_0x5d0635){return db['Attachment'][_0x9ae7('0x1b')](_0x2c7643[_0x9ae7('0x1c')],{'raw':_0x2c7643[_0x9ae7('0x1d')]?_0x2c7643[_0x9ae7('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x9ae7('0xf')](function(_0x1d94fb){logger['info'](_0x9ae7('0x1e'),_0x2c7643);logger['debug'](_0x9ae7('0x1e'),_0x2c7643,JSON[_0x9ae7('0x14')](_0x1d94fb));_0x5d6ad1(_0x1d94fb);})['catch'](function(_0x356559){logger['error']('CreateAttachment',_0x356559[_0x9ae7('0x17')],_0x2c7643);_0x5d0635(_0x5e69c2[_0x9ae7('0x15')](0x1f4,_0x356559[_0x9ae7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9927590..8122923 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4acfd2,_0x5b9374){_0x4acfd2=_0x4acfd2-0x0;var _0x12afbe=_0x0b0e[_0x4acfd2];return _0x12afbe;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x379b3d,_0xb565a7){var _0x5ae947=function(_0x31311b){while(--_0x31311b){_0x379b3d['push'](_0x379b3d['shift']());}};_0x5ae947(++_0xb565a7);}(_0x2032,0xd9));var _0x2203=function(_0x38bd5a,_0x526d00){_0x38bd5a=_0x38bd5a-0x0;var _0x3089a5=_0x2032[_0x38bd5a];return _0x3089a5;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 819277f..2964315 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 _0x2899=['Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','disabled','blocked','blockedAt','admin','user','add','minutes','clearBlockUser','getLicense','catch','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/logger','activedirectory','domain','authenticate','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','findOne','adSsoEnabled','blockDuration','then'];(function(_0x4cf8d4,_0x5aee73){var _0x2c1beb=function(_0x39b0a4){while(--_0x39b0a4){_0x4cf8d4['push'](_0x4cf8d4['shift']());}};_0x2c1beb(++_0x5aee73);}(_0x2899,0xfe));var _0x9289=function(_0x29f791,_0xc6582f){_0x29f791=_0x29f791-0x0;var _0x5395c6=_0x2899[_0x29f791];return _0x5395c6;};'use strict';var passport=require(_0x9289('0x0'));var LocalStrategy=require(_0x9289('0x1'))[_0x9289('0x2')];var moment=require(_0x9289('0x3'));var ActiveDirectory=require(_0x9289('0x4'));var BPromise=require(_0x9289('0x5'));var util=require(_0x9289('0x6'));var db=require(_0x9289('0x7'))['db'];var authService=require(_0x9289('0x8'));var utils=require('../../config/utils');var config=require('../../config/environment');var logger=require(_0x9289('0x9'))('api');function isActiveDirectoryConfigured(_0x200897){var _0x5c6e49=![];if(typeof _0x200897['activedirectory']!=='undefined'){_0x5c6e49=_0x200897['activedirectory']['baseDN']&&_0x200897['activedirectory']['url']&&_0x200897[_0x9289('0xa')][_0x9289('0xb')];}return _0x5c6e49;}function adAuthenticate(_0x2b7e62,_0x3a5cf9,_0x337da3){return new BPromise(function(_0x4bc43e,_0x1be352){try{var _0xf1b23e=new ActiveDirectory(_0x2b7e62);_0xf1b23e[_0x9289('0xc')](_0x3a5cf9,_0x337da3,function(_0x34bb27,_0x469548){if(_0x34bb27){logger[_0x9289('0xd')](_0x9289('0xe'),_0x3a5cf9,util[_0x9289('0xf')](_0x34bb27,{'showHidden':![],'depth':null}));_0x1be352(_0x9289('0x10'));}else if(!_0x469548){logger[_0x9289('0xd')](_0x9289('0x11'),_0x3a5cf9);_0x1be352('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4bc43e(_0x469548);}});}catch(_0x3fa3e2){_0x1be352(_0x3fa3e2);}});}function ActiveDirectoryAuthenticate(_0x4ba8e0,_0x3ec5b6,_0x451b6b,_0x99533a){var _0x113a61,_0x1235ce;if(!isActiveDirectoryConfigured(config)){logger[_0x9289('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x3ec5b6);return _0x99533a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting'][_0x9289('0x12')]({'where':{'id':0x1},'attributes':[_0x9289('0x13'),_0x9289('0x14')],'raw':!![]})[_0x9289('0x15')](function(_0x1adc5a){_0x113a61=_0x1adc5a;if(!_0x113a61[_0x9289('0x13')]){logger[_0x9289('0xd')](_0x9289('0x16'),_0x3ec5b6);throw new Error(_0x9289('0x10'));}return _0x4ba8e0[_0x9289('0x12')]({'attributes':['id',_0x9289('0x17'),_0x9289('0x18'),'salt','role',_0x9289('0x19'),_0x9289('0x1a'),_0x9289('0x1b'),'online'],'where':{'name':_0x3ec5b6,'role':{'$or':[_0x9289('0x1c'),_0x9289('0x1d'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x29c422){if(!_0x29c422||_0x29c422&&_0x29c422[_0x9289('0x17')]!==_0x3ec5b6){throw new Error(_0x9289('0x10'));}_0x1235ce=_0x29c422;var _0x6cfbd8=_0x1235ce[_0x9289('0x17')]+'@'+config[_0x9289('0xa')][_0x9289('0xb')];return adAuthenticate(config[_0x9289('0xa')],_0x6cfbd8,_0x451b6b);})[_0x9289('0x15')](function(_0x557fe0){if(_0x1235ce[_0x9289('0x19')]){throw new Error(_0x9289('0x10'));}if(_0x113a61['blockDuration']>0x0){if(_0x1235ce[_0x9289('0x1a')]){if(moment(_0x1235ce[_0x9289('0x1b')])[_0x9289('0x1e')](_0x113a61[_0x9289('0x14')],_0x9289('0x1f'))>moment()){throw new Error(_0x9289('0x10'));}return utils[_0x9289('0x20')](_0x1235ce,0x0,![],null)[_0x9289('0x15')](function(){return utils[_0x9289('0x21')](_0x1235ce);})[_0x9289('0x15')](function(){return _0x99533a(null,_0x1235ce);});}else{return utils[_0x9289('0x21')](_0x1235ce)[_0x9289('0x15')](function(){return _0x99533a(null,_0x1235ce);});}}else{return utils[_0x9289('0x21')](_0x1235ce)[_0x9289('0x15')](function(){return _0x99533a(null,_0x1235ce);});}})[_0x9289('0x22')](function(_0x166208){return _0x99533a(null,![],_0x166208);});}function handleError(_0x406a84,_0x45b90c,_0x4ca720){return _0x406a84['status'](_0x45b90c||0x1f4)[_0x9289('0x23')]({'message':_0x4ca720?_0x4ca720[_0x9289('0x24')]||_0x4ca720:''});}exports[_0x9289('0x25')]=function(_0x3c5561,_0xb37b25,_0x243c28){passport[_0x9289('0xc')](_0x9289('0x26'),function(_0x34451c,_0x54a01e,_0x3fd922){var _0x582be0=_0x34451c||_0x3fd922;if(_0x582be0){return handleError(_0xb37b25,0x191,_0x582be0);}if(!_0x54a01e){return handleError(_0xb37b25,0x194,{'message':_0x9289('0x27')});}else{var _0x578063={'payload':{'id':_0x54a01e['id'],'role':_0x54a01e[_0x9289('0x28')]},'options':{'expiresIn':0x15180}};return authService[_0x9289('0x29')](_0x578063)[_0x9289('0x15')](function(_0xcae459){_0xb37b25[_0x9289('0x2a')]({'id':_0x54a01e['id'],'token':_0xcae459,'statusCall':'','isAlreadyLogged':_0x54a01e[_0x9289('0x2b')]});});}})(_0x3c5561,_0xb37b25,_0x243c28);};passport[_0x9289('0x2c')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':_0x9289('0x18')},function(_0x396b95,_0x4b734b,_0x9beb75){return ActiveDirectoryAuthenticate(db[_0x9289('0x2d')],_0x396b95,_0x4b734b,_0x9beb75);})); \ No newline at end of file +var _0xca15=['password','salt','role','disabled','blocked','blockedAt','online','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','baseDN','url','domain','authenticate','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'];(function(_0x1bd027,_0x565a42){var _0x193de7=function(_0x4af495){while(--_0x4af495){_0x1bd027['push'](_0x1bd027['shift']());}};_0x193de7(++_0x565a42);}(_0xca15,0x83));var _0x5ca1=function(_0x7f6bc8,_0x98c3bf){_0x7f6bc8=_0x7f6bc8-0x0;var _0xb899c7=_0xca15[_0x7f6bc8];return _0xb899c7;};'use strict';var passport=require(_0x5ca1('0x0'));var LocalStrategy=require(_0x5ca1('0x1'))['Strategy'];var moment=require(_0x5ca1('0x2'));var ActiveDirectory=require(_0x5ca1('0x3'));var BPromise=require(_0x5ca1('0x4'));var util=require(_0x5ca1('0x5'));var db=require(_0x5ca1('0x6'))['db'];var authService=require(_0x5ca1('0x7'));var utils=require(_0x5ca1('0x8'));var config=require(_0x5ca1('0x9'));var logger=require(_0x5ca1('0xa'))(_0x5ca1('0xb'));function isActiveDirectoryConfigured(_0x265bc4){var _0x34d3d3=![];if(typeof _0x265bc4['activedirectory']!==_0x5ca1('0xc')){_0x34d3d3=_0x265bc4[_0x5ca1('0xd')][_0x5ca1('0xe')]&&_0x265bc4['activedirectory'][_0x5ca1('0xf')]&&_0x265bc4[_0x5ca1('0xd')][_0x5ca1('0x10')];}return _0x34d3d3;}function adAuthenticate(_0x5a2b42,_0x430be1,_0x51dcd0){return new BPromise(function(_0x47692a,_0x5cdb1d){try{var _0x5d0bd2=new ActiveDirectory(_0x5a2b42);_0x5d0bd2[_0x5ca1('0x11')](_0x430be1,_0x51dcd0,function(_0x3ab58,_0x257315){if(_0x3ab58){logger[_0x5ca1('0x12')](_0x5ca1('0x13'),_0x430be1,util[_0x5ca1('0x14')](_0x3ab58,{'showHidden':![],'depth':null}));_0x5cdb1d(_0x5ca1('0x15'));}else if(!_0x257315){logger[_0x5ca1('0x12')](_0x5ca1('0x16'),_0x430be1);_0x5cdb1d('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x47692a(_0x257315);}});}catch(_0x41ad97){_0x5cdb1d(_0x41ad97);}});}function ActiveDirectoryAuthenticate(_0x4bb32d,_0x2bf279,_0x1cfb4e,_0x4c8944){var _0x281acd,_0x16019f;if(!isActiveDirectoryConfigured(config)){logger[_0x5ca1('0x12')](_0x5ca1('0x17'),_0x2bf279);return _0x4c8944(null,![],{'message':_0x5ca1('0x15')});}return db[_0x5ca1('0x18')][_0x5ca1('0x19')]({'where':{'id':0x1},'attributes':[_0x5ca1('0x1a'),_0x5ca1('0x1b')],'raw':!![]})[_0x5ca1('0x1c')](function(_0x19b69a){_0x281acd=_0x19b69a;if(!_0x281acd[_0x5ca1('0x1a')]){logger[_0x5ca1('0x12')](_0x5ca1('0x1d'),_0x2bf279);throw new Error(_0x5ca1('0x15'));}return _0x4bb32d['findOne']({'attributes':['id',_0x5ca1('0x1e'),_0x5ca1('0x1f'),_0x5ca1('0x20'),_0x5ca1('0x21'),_0x5ca1('0x22'),_0x5ca1('0x23'),_0x5ca1('0x24'),_0x5ca1('0x25')],'where':{'name':_0x2bf279,'role':{'$or':['admin','user',_0x5ca1('0x26')]},'adSsoEnabled':!![]}});})['then'](function(_0x266de9){if(!_0x266de9||_0x266de9&&_0x266de9['name']!==_0x2bf279){throw new Error(_0x5ca1('0x15'));}_0x16019f=_0x266de9;var _0x3ac510=_0x16019f[_0x5ca1('0x1e')]+'@'+config['activedirectory'][_0x5ca1('0x10')];return adAuthenticate(config[_0x5ca1('0xd')],_0x3ac510,_0x1cfb4e);})['then'](function(_0x59252f){if(_0x16019f[_0x5ca1('0x22')]){throw new Error(_0x5ca1('0x15'));}if(_0x281acd[_0x5ca1('0x1b')]>0x0){if(_0x16019f[_0x5ca1('0x23')]){if(moment(_0x16019f[_0x5ca1('0x24')])[_0x5ca1('0x27')](_0x281acd[_0x5ca1('0x1b')],_0x5ca1('0x28'))>moment()){throw new Error(_0x5ca1('0x15'));}return utils[_0x5ca1('0x29')](_0x16019f,0x0,![],null)[_0x5ca1('0x1c')](function(){return utils[_0x5ca1('0x2a')](_0x16019f);})[_0x5ca1('0x1c')](function(){return _0x4c8944(null,_0x16019f);});}else{return utils[_0x5ca1('0x2a')](_0x16019f)[_0x5ca1('0x1c')](function(){return _0x4c8944(null,_0x16019f);});}}else{return utils['getLicense'](_0x16019f)[_0x5ca1('0x1c')](function(){return _0x4c8944(null,_0x16019f);});}})[_0x5ca1('0x2b')](function(_0x456aa8){return _0x4c8944(null,![],_0x456aa8);});}function handleError(_0x39939d,_0x4c1926,_0x595527){return _0x39939d[_0x5ca1('0x2c')](_0x4c1926||0x1f4)[_0x5ca1('0x2d')]({'message':_0x595527?_0x595527[_0x5ca1('0x2e')]||_0x595527:''});}exports[_0x5ca1('0x2f')]=function(_0x465921,_0x7add6c,_0x3e82f3){passport[_0x5ca1('0x11')](_0x5ca1('0x30'),function(_0x12fb2d,_0x2c8c0c,_0x360f1d){var _0x51adf5=_0x12fb2d||_0x360f1d;if(_0x51adf5){return handleError(_0x7add6c,0x191,_0x51adf5);}if(!_0x2c8c0c){return handleError(_0x7add6c,0x194,{'message':_0x5ca1('0x31')});}else{var _0x212691={'payload':{'id':_0x2c8c0c['id'],'role':_0x2c8c0c[_0x5ca1('0x21')]},'options':{'expiresIn':0x15180}};return authService[_0x5ca1('0x32')](_0x212691)[_0x5ca1('0x1c')](function(_0x5837c6){_0x7add6c[_0x5ca1('0x33')]({'id':_0x2c8c0c['id'],'token':_0x5837c6,'statusCall':'','isAlreadyLogged':_0x2c8c0c['online']});});}})(_0x465921,_0x7add6c,_0x3e82f3);};passport[_0x5ca1('0x34')](_0x5ca1('0x30'),new LocalStrategy({'usernameField':_0x5ca1('0x1e'),'passwordField':_0x5ca1('0x1f')},function(_0x545705,_0x2b80ec,_0x1f6f15){return ActiveDirectoryAuthenticate(db[_0x5ca1('0x35')],_0x545705,_0x2b80ec,_0x1f6f15);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a7fc0af..268e594 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 _0x2197=['express','Router','post','login','exports'];(function(_0x2a9a79,_0x31a7ea){var _0x41bfa6=function(_0x57f8f4){while(--_0x57f8f4){_0x2a9a79['push'](_0x2a9a79['shift']());}};_0x41bfa6(++_0x31a7ea);}(_0x2197,0xb4));var _0x7219=function(_0x575283,_0x4c7361){_0x575283=_0x575283-0x0;var _0x1aca09=_0x2197[_0x575283];return _0x1aca09;};'use strict';var express=require(_0x7219('0x0'));var router=express[_0x7219('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x7219('0x2')]('/',controller[_0x7219('0x3')]);module[_0x7219('0x4')]=router; \ No newline at end of file +var _0x41ef=['exports','express','./authActiveDirectory.controller','post','login'];(function(_0x3a852f,_0x28fa07){var _0x3f40a5=function(_0x57c7e8){while(--_0x57c7e8){_0x3a852f['push'](_0x3a852f['shift']());}};_0x3f40a5(++_0x28fa07);}(_0x41ef,0x1eb));var _0xf41e=function(_0x1e4598,_0x1ba223){_0x1e4598=_0x1e4598-0x0;var _0x53b3ee=_0x41ef[_0x1e4598];return _0x53b3ee;};'use strict';var express=require(_0xf41e('0x0'));var router=express['Router']();var controller=require(_0xf41e('0x1'));router[_0xf41e('0x2')]('/',controller[_0xf41e('0x3')]);module[_0xf41e('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 56fd388..66eb18c 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(_0x4df6e3,_0x122209){var _0x314432=function(_0x590113){while(--_0x590113){_0x4df6e3['push'](_0x4df6e3['shift']());}};_0x314432(++_0x122209);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x1089d4,_0x382a95){var _0xd170aa=function(_0x349cb3){while(--_0x349cb3){_0x1089d4['push'](_0x1089d4['shift']());}};_0xd170aa(++_0x382a95);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 4070793..20595ee 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 _0x9deb=['get','login','isMiddleware','setTokenCookie','exports','passport','./authGoogle.controller','../../components/auth/service'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0x9deb,0x12d));var _0xb9de=function(_0x3788a4,_0x3b177d){_0x3788a4=_0x3788a4-0x0;var _0x21bba6=_0x9deb[_0x3788a4];return _0x21bba6;};'use strict';var express=require('express');var passport=require(_0xb9de('0x0'));var router=express['Router']();var controller=require(_0xb9de('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0xb9de('0x2'));router[_0xb9de('0x3')]('/',controller[_0xb9de('0x4')]);router[_0xb9de('0x3')]('/callback',controller['callback'],authService[_0xb9de('0x5')],userController[_0xb9de('0x4')],authService[_0xb9de('0x6')]);module[_0xb9de('0x7')]=router; \ No newline at end of file +var _0x7119=['login','callback','isMiddleware','setTokenCookie','exports','passport','./authGoogle.controller','../../components/auth/service','get'];(function(_0x579751,_0x4b96a2){var _0x1d00ba=function(_0x24cefc){while(--_0x24cefc){_0x579751['push'](_0x579751['shift']());}};_0x1d00ba(++_0x4b96a2);}(_0x7119,0x1c7));var _0x9711=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x7119[_0x57d13b];return _0x467696;};'use strict';var express=require('express');var passport=require(_0x9711('0x0'));var router=express['Router']();var controller=require(_0x9711('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0x9711('0x2'));router[_0x9711('0x3')]('/',controller[_0x9711('0x4')]);router[_0x9711('0x3')]('/callback',controller[_0x9711('0x5')],authService[_0x9711('0x6')],userController[_0x9711('0x4')],authService[_0x9711('0x7')]);module[_0x9711('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 c685d05..ad96a07 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 _0x9e41=['authenticate','blocked','clearBlockUser','disabled','add','minutes','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','Setting','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','securePassword','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','resetPasswordExpires','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','findOne','allowedLoginAttempts','blockDuration','then','name','password','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9e41,0x1cf));var _0x19e4=function(_0x13f93e,_0x310b7d){_0x13f93e=_0x13f93e-0x0;var _0x362548=_0x9e41[_0x13f93e];return _0x362548;};'use strict';var util=require(_0x19e4('0x0'));var passport=require('passport');var LocalStrategy=require(_0x19e4('0x1'))[_0x19e4('0x2')];var jayson=require(_0x19e4('0x3'));var _=require(_0x19e4('0x4'));var rs=require(_0x19e4('0x5'));var moment=require(_0x19e4('0x6'));var db=require(_0x19e4('0x7'))['db'];var authService=require(_0x19e4('0x8'));var utils=require(_0x19e4('0x9'));var client=jayson[_0x19e4('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x695c2,_0x58b07c,_0xb4e94a,_0x10f672){var _0x133767,_0x3291d8;return db['Setting'][_0x19e4('0xb')]({'where':{'id':0x1},'attributes':[_0x19e4('0xc'),_0x19e4('0xd')],'raw':!![]})[_0x19e4('0xe')](function(_0x2545f0){_0x133767=_0x2545f0;return _0x695c2[_0x19e4('0xb')]({'attributes':['id',_0x19e4('0xf'),_0x19e4('0x10'),'salt','role','disabled','blocked',_0x19e4('0x11'),_0x19e4('0x12')],'where':{'name':_0x58b07c,'role':{'$or':[_0x19e4('0x13'),_0x19e4('0x14'),_0x19e4('0x15')]}}});})['then'](function(_0x91c007){if(!_0x91c007||_0x91c007&&_0x91c007['name']!==_0x58b07c){throw new Error(_0x19e4('0x16'));}else{_0x3291d8=_0x91c007;return _0x3291d8;}})[_0x19e4('0xe')](function(){_0x3291d8[_0x19e4('0x17')](_0xb4e94a,function(_0x5929c6,_0x5f49b7){var _0x5ca672=_0x3291d8[_0x19e4('0x12')]+0x1;if(_0x5929c6){return _0x10f672(_0x5929c6);}else if(!_0x5f49b7){if(_0x3291d8['disabled']){return _0x10f672(null,![],{'message':_0x19e4('0x16')});}else if(_0x133767[_0x19e4('0xc')]>0x0){if(_0x3291d8[_0x19e4('0x18')]){if(_0x133767[_0x19e4('0xd')]>0x0){if(moment(_0x3291d8['blockedAt'])['add'](_0x133767[_0x19e4('0xd')],'minutes')>moment()){return _0x10f672(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x19e4('0x19')](_0x3291d8,_0x5ca672,![],null)[_0x19e4('0xe')](function(){return _0x10f672(null,![],{'message':_0x19e4('0x16')});});}}else{return _0x10f672(null,![],{'message':_0x19e4('0x16')});}}else{if(_0x5ca672>=_0x133767[_0x19e4('0xc')]){return utils[_0x19e4('0x19')](_0x3291d8,0x0,!![],moment())[_0x19e4('0xe')](function(){return _0x10f672(null,![],{'message':_0x19e4('0x16')});});}else{return utils[_0x19e4('0x19')](_0x3291d8,_0x5ca672,![],null)['then'](function(){return _0x10f672(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x10f672(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3291d8[_0x19e4('0x1a')]){return _0x10f672(null,![],{'message':_0x19e4('0x16')});}else if(_0x133767['allowedLoginAttempts']>0x0){if(_0x3291d8[_0x19e4('0x18')]){if(_0x133767[_0x19e4('0xd')]>0x0){if(moment(_0x3291d8[_0x19e4('0x11')])[_0x19e4('0x1b')](_0x133767[_0x19e4('0xd')],_0x19e4('0x1c'))>moment()){return _0x10f672(null,![],{'message':_0x19e4('0x16')});}else{return utils[_0x19e4('0x19')](_0x3291d8,0x0,![],null)[_0x19e4('0xe')](function(){return utils[_0x19e4('0x1d')](_0x3291d8);})['then'](function(){return _0x10f672(null,_0x3291d8);});}}else{return _0x10f672(null,![],{'message':_0x19e4('0x16')});}}else{return utils[_0x19e4('0x19')](_0x3291d8,0x0,![],null)[_0x19e4('0xe')](function(){return utils[_0x19e4('0x1d')](_0x3291d8);})[_0x19e4('0xe')](function(){return _0x10f672(null,_0x3291d8);})[_0x19e4('0x1e')](function(_0x54baec){return _0x10f672(null,![],_0x54baec);});}}else{if(_0x3291d8[_0x19e4('0x18')]){return _0x10f672(null,![],{'message':_0x19e4('0x16')});}else{return utils['getLicense'](_0x3291d8)[_0x19e4('0xe')](function(){return _0x10f672(null,_0x3291d8);});}}}});})[_0x19e4('0x1e')](function(_0x21d2e5){return _0x10f672(null,![],_0x21d2e5);});}function sendServiceMail(_0x336354){return db['MailAccount'][_0x19e4('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x19e4('0xf'),_0x19e4('0x20')],'include':[{'model':db[_0x19e4('0x21')],'as':_0x19e4('0x22'),'include':[{'model':db['CloudProvider'],'as':_0x19e4('0x23')}]}]})[_0x19e4('0xe')](function(_0x34eb07){if(!_0x34eb07){throw new Error(_0x19e4('0x24'));}var _0x2ed822=_0x34eb07[_0x19e4('0x25')]();var _0x1f7a23={'account':_0x2ed822,'message':_['merge']({'from':util[_0x19e4('0x26')](_0x19e4('0x27'),_0x34eb07[_0x19e4('0xf')],_0x34eb07[_0x19e4('0x20')]||_0x34eb07['Smtp'][_0x19e4('0x14')])},_0x336354)};return client['request']('SendMail',_0x1f7a23);})[_0x19e4('0xe')](function(_0x1ab442){if(_0x1ab442[_0x19e4('0x28')]){throw new Error(util['format'](_0x19e4('0x29'),_0x1ab442[_0x19e4('0x28')][_0x19e4('0x2a')]||JSON[_0x19e4('0x2b')](_0x1ab442[_0x19e4('0x28')])));}return!![];});}function handleError(_0x32e4ae,_0x3f05bd,_0x582604){return _0x32e4ae[_0x19e4('0x2c')](_0x3f05bd||0x1f4)['send']({'message':_0x582604?_0x582604[_0x19e4('0x2a')]||_0x582604:''});}exports['login']=function(_0x3e753a,_0x264acd,_0x2a0131){passport[_0x19e4('0x17')](_0x19e4('0x2d'),function(_0x1830ae,_0x4e0b7a,_0x225667){var _0x2b9d09=_0x1830ae||_0x225667;if(_0x2b9d09){return handleError(_0x264acd,0x191,_0x2b9d09);}if(!_0x4e0b7a){return handleError(_0x264acd,0x194,{'message':_0x19e4('0x2e')});}else{var _0x53decb={'payload':{'id':_0x4e0b7a['id'],'role':_0x4e0b7a['role']},'options':{'expiresIn':0x15180}};return authService[_0x19e4('0x2f')](_0x53decb)['then'](function(_0x258536){_0x264acd[_0x19e4('0x30')]({'id':_0x4e0b7a['id'],'token':_0x258536,'statusCall':'','isAlreadyLogged':_0x4e0b7a[_0x19e4('0x31')]});});}})(_0x3e753a,_0x264acd,_0x2a0131);};exports[_0x19e4('0x32')]=function(_0x569997,_0x5261b8){if(!_0x569997['body']['email']){return handleError(_0x5261b8,0x1f4,{'message':_0x19e4('0x33')});}var _0x4b0137=rs[_0x19e4('0x34')]();_0x569997['body'][_0x19e4('0x20')]=_0x569997[_0x19e4('0x35')][_0x19e4('0x20')][_0x19e4('0x36')]()['toLowerCase']();var _0x247324;return db[_0x19e4('0x37')][_0x19e4('0xb')]({'where':{'id':0x1},'attributes':[_0x19e4('0xc'),'blockDuration'],'raw':!![]})[_0x19e4('0xe')](function(_0x439f29){_0x247324=_0x439f29;return db['User'][_0x19e4('0x1f')]({'where':{'email':_0x569997[_0x19e4('0x35')][_0x19e4('0x20')]}});})['then'](function(_0x221877){if(!_0x221877){throw new Error(_0x19e4('0x38'));}if(_0x221877[_0x19e4('0x1a')]){throw new Error(_0x19e4('0x39'));}if(_0x221877[_0x19e4('0x18')]){if(moment(_0x221877[_0x19e4('0x11')])[_0x19e4('0x1b')](_0x247324[_0x19e4('0xd')],_0x19e4('0x1c'))>moment()){throw new Error(_0x19e4('0x3a'));}else{_0x221877[_0x19e4('0x18')]=![];_0x221877[_0x19e4('0x11')]=null;}}_0x221877[_0x19e4('0x3b')]=_0x4b0137;_0x221877['resetPasswordExpires']=Date[_0x19e4('0x3c')]()+0x36ee80;return _0x221877[_0x19e4('0x3d')]();})[_0x19e4('0xe')](function(){return sendServiceMail({'to':_0x569997['body'][_0x19e4('0x20')],'subject':_0x19e4('0x3e'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x19e4('0x3f')+_0x19e4('0x40')+_0x569997[_0x19e4('0x41')]['host']+'/reset/'+_0x4b0137+'\x0a\x0a'+_0x19e4('0x42')});})[_0x19e4('0xe')](function(){_0x5261b8[_0x19e4('0x2c')](0xc8)[_0x19e4('0x43')]({'message':'Reset\x20Email\x20sent!'});})[_0x19e4('0x1e')](function(_0x491560){return handleError(_0x5261b8,0x1f4,_0x491560);});};exports['reset']=function(_0x255be7,_0x1403c2){return db[_0x19e4('0x44')]['find']({'where':{'resetPasswordToken':_0x255be7[_0x19e4('0x45')][_0x19e4('0x46')],'resetPasswordExpires':{'$gt':Date[_0x19e4('0x3c')]()}}})[_0x19e4('0xe')](function(_0x2d8303){if(!_0x2d8303){throw new Error(_0x19e4('0x47'));}return db[_0x19e4('0x37')][_0x19e4('0xb')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x19e4('0x48')]})['then'](function(_0x2181ef){if(_0x2181ef[_0x19e4('0x49')])authService[_0x19e4('0x4a')](_0x255be7['body'][_0x19e4('0x10')]);if(!_0x2181ef[_0x19e4('0x4b')]||!_0x2d8303['previousPasswords'])return _0x2d8303;authService[_0x19e4('0x4c')](_0x255be7[_0x19e4('0x35')][_0x19e4('0x10')],_0x2d8303[_0x19e4('0x4d')],_0x2181ef[_0x19e4('0x48')]);return _0x2d8303;})[_0x19e4('0xe')](function(){_0x2d8303['password']=_0x255be7[_0x19e4('0x35')][_0x19e4('0x10')];_0x2d8303['resetPasswordToken']=null;_0x2d8303[_0x19e4('0x4e')]=null;return _0x2d8303[_0x19e4('0x3d')]();});})['then'](function(){_0x1403c2[_0x19e4('0x2c')](0xc8)[_0x19e4('0x43')]({'message':_0x19e4('0x4f')});})['catch'](function(_0x3e951b){return handleError(_0x1403c2,0x1f4,_0x3e951b);});};passport[_0x19e4('0x50')](_0x19e4('0x2d'),new LocalStrategy({'usernameField':_0x19e4('0xf'),'passwordField':_0x19e4('0x10')},function(_0x363154,_0x1b1f70,_0x492402){return localAuthenticate(db[_0x19e4('0x44')],_0x363154,_0x1b1f70,_0x492402);})); \ No newline at end of file +var _0x75ad=['minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','email','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','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','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','previousPasswords','validatePasswordHistory','Password\x20reset!','use','User','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../config/utils','client','http','Setting','findOne','blockDuration','name','password','salt','role','disabled','blocked','admin','user','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','allowedLoginAttempts','blockedAt'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x75ad,0xd7));var _0xd75a=function(_0x1fe8a9,_0x374e5e){_0x1fe8a9=_0x1fe8a9-0x0;var _0x507e1c=_0x75ad[_0x1fe8a9];return _0x507e1c;};'use strict';var util=require(_0xd75a('0x0'));var passport=require(_0xd75a('0x1'));var LocalStrategy=require(_0xd75a('0x2'))[_0xd75a('0x3')];var jayson=require(_0xd75a('0x4'));var _=require(_0xd75a('0x5'));var rs=require('randomstring');var moment=require(_0xd75a('0x6'));var db=require(_0xd75a('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xd75a('0x8'));var client=jayson[_0xd75a('0x9')][_0xd75a('0xa')]({'port':0x232b});function localAuthenticate(_0x2d2ff4,_0x5c8ef9,_0x40ee1f,_0x396cd1){var _0x4c7bbe,_0x12a0de;return db[_0xd75a('0xb')][_0xd75a('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xd75a('0xd')],'raw':!![]})['then'](function(_0x593d01){_0x4c7bbe=_0x593d01;return _0x2d2ff4[_0xd75a('0xc')]({'attributes':['id',_0xd75a('0xe'),_0xd75a('0xf'),_0xd75a('0x10'),_0xd75a('0x11'),_0xd75a('0x12'),_0xd75a('0x13'),'blockedAt','loginAttempts'],'where':{'name':_0x5c8ef9,'role':{'$or':[_0xd75a('0x14'),_0xd75a('0x15'),'agent']}}});})[_0xd75a('0x16')](function(_0x28346e){if(!_0x28346e||_0x28346e&&_0x28346e[_0xd75a('0xe')]!==_0x5c8ef9){throw new Error(_0xd75a('0x17'));}else{_0x12a0de=_0x28346e;return _0x12a0de;}})[_0xd75a('0x16')](function(){_0x12a0de[_0xd75a('0x18')](_0x40ee1f,function(_0x431be2,_0x3f7b43){var _0x3b26fc=_0x12a0de[_0xd75a('0x19')]+0x1;if(_0x431be2){return _0x396cd1(_0x431be2);}else if(!_0x3f7b43){if(_0x12a0de[_0xd75a('0x12')]){return _0x396cd1(null,![],{'message':_0xd75a('0x17')});}else if(_0x4c7bbe[_0xd75a('0x1a')]>0x0){if(_0x12a0de['blocked']){if(_0x4c7bbe[_0xd75a('0xd')]>0x0){if(moment(_0x12a0de[_0xd75a('0x1b')])['add'](_0x4c7bbe['blockDuration'],_0xd75a('0x1c'))>moment()){return _0x396cd1(null,![],{'message':_0xd75a('0x17')});}else{return utils[_0xd75a('0x1d')](_0x12a0de,_0x3b26fc,![],null)['then'](function(){return _0x396cd1(null,![],{'message':_0xd75a('0x17')});});}}else{return _0x396cd1(null,![],{'message':_0xd75a('0x17')});}}else{if(_0x3b26fc>=_0x4c7bbe[_0xd75a('0x1a')]){return utils['clearBlockUser'](_0x12a0de,0x0,!![],moment())[_0xd75a('0x16')](function(){return _0x396cd1(null,![],{'message':_0xd75a('0x17')});});}else{return utils[_0xd75a('0x1d')](_0x12a0de,_0x3b26fc,![],null)[_0xd75a('0x16')](function(){return _0x396cd1(null,![],{'message':_0xd75a('0x17')});});}}}else{return _0x396cd1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x12a0de[_0xd75a('0x12')]){return _0x396cd1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4c7bbe['allowedLoginAttempts']>0x0){if(_0x12a0de[_0xd75a('0x13')]){if(_0x4c7bbe[_0xd75a('0xd')]>0x0){if(moment(_0x12a0de[_0xd75a('0x1b')])['add'](_0x4c7bbe[_0xd75a('0xd')],'minutes')>moment()){return _0x396cd1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xd75a('0x1d')](_0x12a0de,0x0,![],null)['then'](function(){return utils[_0xd75a('0x1e')](_0x12a0de);})['then'](function(){return _0x396cd1(null,_0x12a0de);});}}else{return _0x396cd1(null,![],{'message':_0xd75a('0x17')});}}else{return utils[_0xd75a('0x1d')](_0x12a0de,0x0,![],null)['then'](function(){return utils[_0xd75a('0x1e')](_0x12a0de);})[_0xd75a('0x16')](function(){return _0x396cd1(null,_0x12a0de);})[_0xd75a('0x1f')](function(_0x2a21aa){return _0x396cd1(null,![],_0x2a21aa);});}}else{if(_0x12a0de[_0xd75a('0x13')]){return _0x396cd1(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x12a0de)[_0xd75a('0x16')](function(){return _0x396cd1(null,_0x12a0de);});}}}});})[_0xd75a('0x1f')](function(_0x186a10){return _0x396cd1(null,![],_0x186a10);});}function sendServiceMail(_0x1de00b){return db[_0xd75a('0x20')][_0xd75a('0x21')]({'where':{'service':!![]},'attributes':['id',_0xd75a('0xe'),'email'],'include':[{'model':db[_0xd75a('0x22')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]})['then'](function(_0x4473e2){if(!_0x4473e2){throw new Error(_0xd75a('0x23'));}var _0x68ebe7=_0x4473e2[_0xd75a('0x24')]();var _0x39754e={'account':_0x68ebe7,'message':_['merge']({'from':util[_0xd75a('0x25')](_0xd75a('0x26'),_0x4473e2[_0xd75a('0xe')],_0x4473e2[_0xd75a('0x27')]||_0x4473e2['Smtp'][_0xd75a('0x15')])},_0x1de00b)};return client[_0xd75a('0x28')](_0xd75a('0x29'),_0x39754e);})[_0xd75a('0x16')](function(_0x110fa5){if(_0x110fa5[_0xd75a('0x2a')]){throw new Error(util[_0xd75a('0x25')](_0xd75a('0x2b'),_0x110fa5[_0xd75a('0x2a')][_0xd75a('0x2c')]||JSON[_0xd75a('0x2d')](_0x110fa5[_0xd75a('0x2a')])));}return!![];});}function handleError(_0x3517a1,_0xb031e9,_0x4b41fa){return _0x3517a1[_0xd75a('0x2e')](_0xb031e9||0x1f4)[_0xd75a('0x2f')]({'message':_0x4b41fa?_0x4b41fa['message']||_0x4b41fa:''});}exports['login']=function(_0x3c15f9,_0x141867,_0x194942){passport['authenticate'](_0xd75a('0x30'),function(_0x4590c4,_0x19f744,_0x2f1b98){var _0xa99280=_0x4590c4||_0x2f1b98;if(_0xa99280){return handleError(_0x141867,0x191,_0xa99280);}if(!_0x19f744){return handleError(_0x141867,0x194,{'message':_0xd75a('0x31')});}else{var _0x184f91={'payload':{'id':_0x19f744['id'],'role':_0x19f744[_0xd75a('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0xd75a('0x32')](_0x184f91)[_0xd75a('0x16')](function(_0x35fdfd){_0x141867[_0xd75a('0x33')]({'id':_0x19f744['id'],'token':_0x35fdfd,'statusCall':'','isAlreadyLogged':_0x19f744[_0xd75a('0x34')]});});}})(_0x3c15f9,_0x141867,_0x194942);};exports[_0xd75a('0x35')]=function(_0x1b0703,_0x47d75e){if(!_0x1b0703[_0xd75a('0x36')][_0xd75a('0x27')]){return handleError(_0x47d75e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x460377=rs[_0xd75a('0x37')]();_0x1b0703[_0xd75a('0x36')]['email']=_0x1b0703[_0xd75a('0x36')][_0xd75a('0x27')][_0xd75a('0x38')]()[_0xd75a('0x39')]();var _0x2f90a7;return db[_0xd75a('0xb')][_0xd75a('0xc')]({'where':{'id':0x1},'attributes':[_0xd75a('0x1a'),'blockDuration'],'raw':!![]})[_0xd75a('0x16')](function(_0x5f5c5d){_0x2f90a7=_0x5f5c5d;return db['User'][_0xd75a('0x21')]({'where':{'email':_0x1b0703[_0xd75a('0x36')][_0xd75a('0x27')]}});})[_0xd75a('0x16')](function(_0xbe68f5){if(!_0xbe68f5){throw new Error(_0xd75a('0x3a'));}if(_0xbe68f5[_0xd75a('0x12')]){throw new Error(_0xd75a('0x3b'));}if(_0xbe68f5[_0xd75a('0x13')]){if(moment(_0xbe68f5[_0xd75a('0x1b')])[_0xd75a('0x3c')](_0x2f90a7[_0xd75a('0xd')],_0xd75a('0x1c'))>moment()){throw new Error(_0xd75a('0x3d'));}else{_0xbe68f5['blocked']=![];_0xbe68f5[_0xd75a('0x1b')]=null;}}_0xbe68f5[_0xd75a('0x3e')]=_0x460377;_0xbe68f5[_0xd75a('0x3f')]=Date[_0xd75a('0x40')]()+0x36ee80;return _0xbe68f5[_0xd75a('0x41')]();})[_0xd75a('0x16')](function(){return sendServiceMail({'to':_0x1b0703[_0xd75a('0x36')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xd75a('0x42')+_0xd75a('0x43')+_0xd75a('0x44')+_0x1b0703[_0xd75a('0x45')]['host']+'/reset/'+_0x460377+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xd75a('0x16')](function(){_0x47d75e[_0xd75a('0x2e')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0xd75a('0x1f')](function(_0x44c4fb){return handleError(_0x47d75e,0x1f4,_0x44c4fb);});};exports[_0xd75a('0x46')]=function(_0x5307a5,_0x5d126e){return db['User'][_0xd75a('0x21')]({'where':{'resetPasswordToken':_0x5307a5[_0xd75a('0x47')][_0xd75a('0x48')],'resetPasswordExpires':{'$gt':Date[_0xd75a('0x40')]()}}})['then'](function(_0xf8be1a){if(!_0xf8be1a){throw new Error(_0xd75a('0x49'));}return db[_0xd75a('0xb')]['findOne']({'attributes':['id',_0xd75a('0x4a'),'enforcePasswordHistory',_0xd75a('0x4b')]})[_0xd75a('0x16')](function(_0xf97f3d){if(_0xf97f3d[_0xd75a('0x4a')])authService['validatePasswordPattern'](_0x5307a5[_0xd75a('0x36')][_0xd75a('0xf')]);if(!_0xf97f3d['enforcePasswordHistory']||!_0xf8be1a[_0xd75a('0x4c')])return _0xf8be1a;authService[_0xd75a('0x4d')](_0x5307a5['body'][_0xd75a('0xf')],_0xf8be1a[_0xd75a('0x4c')],_0xf97f3d[_0xd75a('0x4b')]);return _0xf8be1a;})[_0xd75a('0x16')](function(){_0xf8be1a[_0xd75a('0xf')]=_0x5307a5[_0xd75a('0x36')][_0xd75a('0xf')];_0xf8be1a[_0xd75a('0x3e')]=null;_0xf8be1a[_0xd75a('0x3f')]=null;return _0xf8be1a['save']();});})[_0xd75a('0x16')](function(){_0x5d126e[_0xd75a('0x2e')](0xc8)[_0xd75a('0x2f')]({'message':_0xd75a('0x4e')});})[_0xd75a('0x1f')](function(_0x3e9ea0){return handleError(_0x5d126e,0x1f4,_0x3e9ea0);});};passport[_0xd75a('0x4f')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0xd75a('0xf')},function(_0x4e9f22,_0x1797db,_0x3253f4){return localAuthenticate(db[_0xd75a('0x50')],_0x4e9f22,_0x1797db,_0x3253f4);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index dc4e6f0..51c78e3 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 _0xb9e4=['express','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','exports'];(function(_0x1bb0eb,_0x5ce0a0){var _0x31e097=function(_0x4c89e5){while(--_0x4c89e5){_0x1bb0eb['push'](_0x1bb0eb['shift']());}};_0x31e097(++_0x5ce0a0);}(_0xb9e4,0x183));var _0x4b9e=function(_0x4e317a,_0x30e4c2){_0x4e317a=_0x4e317a-0x0;var _0x39635b=_0xb9e4[_0x4e317a];return _0x39635b;};'use strict';var express=require(_0x4b9e('0x0'));var router=express[_0x4b9e('0x1')]();var controller=require(_0x4b9e('0x2'));router[_0x4b9e('0x3')]('/',controller[_0x4b9e('0x4')]);router[_0x4b9e('0x3')](_0x4b9e('0x5'),controller[_0x4b9e('0x6')]);router[_0x4b9e('0x3')](_0x4b9e('0x7'),controller['reset']);module[_0x4b9e('0x8')]=router; \ No newline at end of file +var _0xc323=['exports','express','./authLocal.controller','post','login','/forgot','/reset/:token'];(function(_0x448c9a,_0x36ed05){var _0x185c40=function(_0x61fe86){while(--_0x61fe86){_0x448c9a['push'](_0x448c9a['shift']());}};_0x185c40(++_0x36ed05);}(_0xc323,0x1d6));var _0x3c32=function(_0x5d27a6,_0x5b3184){_0x5d27a6=_0x5d27a6-0x0;var _0x221530=_0xc323[_0x5d27a6];return _0x221530;};'use strict';var express=require(_0x3c32('0x0'));var router=express['Router']();var controller=require(_0x3c32('0x1'));router[_0x3c32('0x2')]('/',controller[_0x3c32('0x3')]);router['post'](_0x3c32('0x4'),controller['forgot']);router['post'](_0x3c32('0x5'),controller['reset']);module[_0x3c32('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 1420ad4..e66c3f6 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 _0xa49d=['STRING','BOOLEAN','exports'];(function(_0x1c8017,_0x34aff3){var _0x5e443f=function(_0x408aab){while(--_0x408aab){_0x1c8017['push'](_0x1c8017['shift']());}};_0x5e443f(++_0x34aff3);}(_0xa49d,0x80));var _0xda49=function(_0x537aa0,_0x44c227){_0x537aa0=_0x537aa0-0x0;var _0x233590=_0xa49d[_0x537aa0];return _0x233590;};'use strict';var Sequelize=require('sequelize');module[_0xda49('0x0')]={'name':{'type':Sequelize[_0xda49('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xda49('0x1')]},'description':{'type':Sequelize[_0xda49('0x1')]},'status':{'type':Sequelize[_0xda49('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0xb222=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x22d53d,_0x339808){var _0x40dd91=function(_0x1ea0a6){while(--_0x1ea0a6){_0x22d53d['push'](_0x22d53d['shift']());}};_0x40dd91(++_0x339808);}(_0xb222,0xcd));var _0x2b22=function(_0x3260fa,_0x24dbb7){_0x3260fa=_0x3260fa-0x0;var _0x120340=_0xb222[_0x3260fa];return _0x120340;};'use strict';var Sequelize=require(_0x2b22('0x0'));module[_0x2b22('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x2b22('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x2b22('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2b22('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index bb66172..a48e3c0 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 _0x729a=['then','error','name','send','Automation','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','addConditions','ids','omit','getConditions','Condition','hasOwnProperty','Action','addActions','getActions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy'];(function(_0x37a080,_0x4be368){var _0x466e3e=function(_0x55a701){while(--_0x55a701){_0x37a080['push'](_0x37a080['shift']());}};_0x466e3e(++_0x4be368);}(_0x729a,0x1d7));var _0xa729=function(_0x34057e,_0x539224){_0x34057e=_0x34057e-0x0;var _0x3497b4=_0x729a[_0x34057e];return _0x3497b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa729('0x0'));var zipdir=require(_0xa729('0x1'));var jsonpatch=require(_0xa729('0x2'));var rp=require(_0xa729('0x3'));var moment=require(_0xa729('0x4'));var BPromise=require(_0xa729('0x5'));var Mustache=require(_0xa729('0x6'));var util=require('util');var path=require(_0xa729('0x7'));var sox=require(_0xa729('0x8'));var csv=require(_0xa729('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa729('0xa'));var _=require('lodash');var squel=require(_0xa729('0xb'));var crypto=require('crypto');var jsforce=require(_0xa729('0xc'));var deskjs=require(_0xa729('0xd'));var toCsv=require(_0xa729('0x9'));var querystring=require(_0xa729('0xe'));var Papa=require(_0xa729('0xf'));var Redis=require(_0xa729('0x10'));var authService=require(_0xa729('0x11'));var qs=require(_0xa729('0x12'));var as=require(_0xa729('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa729('0x14'))(_0xa729('0x15'));var utils=require(_0xa729('0x16'));var config=require(_0xa729('0x17'));var licenseUtil=require(_0xa729('0x18'));var db=require(_0xa729('0x19'))['db'];function respondWithStatusCode(_0x25a080,_0x1771d6){_0x1771d6=_0x1771d6||0xcc;return function(_0x1df042){if(_0x1df042){return _0x25a080[_0xa729('0x1a')](_0x1771d6);}return _0x25a080[_0xa729('0x1b')](_0x1771d6)[_0xa729('0x1c')]();};}function respondWithResult(_0xde96e6,_0xd3859e){_0xd3859e=_0xd3859e||0xc8;return function(_0x4ca669){if(_0x4ca669){return _0xde96e6[_0xa729('0x1b')](_0xd3859e)[_0xa729('0x1d')](_0x4ca669);}};}function respondWithFilteredResult(_0x1b098f,_0x4d3431){return function(_0x141b28){if(_0x141b28){var _0x597138=typeof _0x4d3431[_0xa729('0x1e')]===_0xa729('0x1f')&&typeof _0x4d3431[_0xa729('0x20')]==='undefined';var _0x15fa18=_0x141b28[_0xa729('0x21')];var _0x1781f8=_0x597138?0x0:_0x4d3431[_0xa729('0x1e')];var _0x57b505=_0x597138?_0x141b28[_0xa729('0x21')]:_0x4d3431[_0xa729('0x1e')]+_0x4d3431[_0xa729('0x20')];var _0x5637d6;if(_0x57b505>=_0x15fa18){_0x57b505=_0x15fa18;_0x5637d6=0xc8;}else{_0x5637d6=0xce;}_0x1b098f[_0xa729('0x1b')](_0x5637d6);return _0x1b098f[_0xa729('0x22')](_0xa729('0x23'),_0x1781f8+'-'+_0x57b505+'/'+_0x15fa18)['json'](_0x141b28);}return null;};}function patchUpdates(_0xada803){return function(_0x5eaf7e){try{jsonpatch['apply'](_0x5eaf7e,_0xada803,!![]);}catch(_0x21e4f4){return BPromise[_0xa729('0x24')](_0x21e4f4);}return _0x5eaf7e['save']();};}function saveUpdates(_0x4f150a,_0x12e13a){return function(_0x4b32d5){if(_0x4b32d5){return _0x4b32d5[_0xa729('0x25')](_0x4f150a)['then'](function(_0x445304){return _0x445304;});}return null;};}function removeEntity(_0x45edbf,_0x5c62f7){return function(_0x2361ee){if(_0x2361ee){return _0x2361ee[_0xa729('0x26')]()[_0xa729('0x27')](function(){_0x45edbf[_0xa729('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3c3f,_0x50ed38){return function(_0x5886a4){if(!_0x5886a4){_0x2d3c3f[_0xa729('0x1a')](0x194);}return _0x5886a4;};}function handleError(_0x1413c5,_0xc7bd64){_0xc7bd64=_0xc7bd64||0x1f4;return function(_0x20eba4){logger[_0xa729('0x28')](_0x20eba4['stack']);if(_0x20eba4[_0xa729('0x29')]){delete _0x20eba4[_0xa729('0x29')];}_0x1413c5['status'](_0xc7bd64)[_0xa729('0x2a')](_0x20eba4);};}exports['index']=function(_0x3761d4,_0x400245){var _0x46d5fa={},_0x53e2da={},_0x4c1da8={'count':0x0,'rows':[]};var _0x7dfa0d=_['map'](db[_0xa729('0x2b')][_0xa729('0x2c')],function(_0x3cb172){return{'name':_0x3cb172[_0xa729('0x2d')],'type':_0x3cb172[_0xa729('0x2e')][_0xa729('0x2f')]};});_0x53e2da[_0xa729('0x30')]=_[_0xa729('0x31')](_0x7dfa0d,_0xa729('0x29'));_0x53e2da[_0xa729('0x32')]=_[_0xa729('0x33')](_0x3761d4[_0xa729('0x32')]);_0x53e2da[_0xa729('0x34')]=_[_0xa729('0x35')](_0x53e2da[_0xa729('0x30')],_0x53e2da[_0xa729('0x32')]);_0x46d5fa[_0xa729('0x36')]=_[_0xa729('0x35')](_0x53e2da[_0xa729('0x30')],qs[_0xa729('0x37')](_0x3761d4[_0xa729('0x32')][_0xa729('0x37')]));_0x46d5fa['attributes']=_0x46d5fa[_0xa729('0x36')][_0xa729('0x38')]?_0x46d5fa[_0xa729('0x36')]:_0x53e2da['model'];if(!_0x3761d4[_0xa729('0x32')]['hasOwnProperty'](_0xa729('0x39'))){_0x46d5fa[_0xa729('0x20')]=qs[_0xa729('0x20')](_0x3761d4[_0xa729('0x32')]['limit']);_0x46d5fa[_0xa729('0x1e')]=qs[_0xa729('0x1e')](_0x3761d4[_0xa729('0x32')][_0xa729('0x1e')]);}_0x46d5fa[_0xa729('0x3a')]=qs[_0xa729('0x3b')](_0x3761d4[_0xa729('0x32')][_0xa729('0x3b')]);_0x46d5fa['where']=qs[_0xa729('0x34')](_[_0xa729('0x3c')](_0x3761d4['query'],_0x53e2da['filters']),_0x7dfa0d);if(_0x3761d4[_0xa729('0x32')][_0xa729('0x3d')]){_0x46d5fa[_0xa729('0x3e')]=_[_0xa729('0x3f')](_0x46d5fa[_0xa729('0x3e')],{'$or':_[_0xa729('0x31')](_0x7dfa0d,function(_0x454e29){if(_0x454e29[_0xa729('0x2e')]!==_0xa729('0x40')){var _0x123c13={};_0x123c13[_0x454e29[_0xa729('0x29')]]={'$like':'%'+_0x3761d4[_0xa729('0x32')]['filter']+'%'};return _0x123c13;}})});}_0x46d5fa=_[_0xa729('0x3f')]({},_0x46d5fa,_0x3761d4[_0xa729('0x41')]);var _0x4e4d72={'where':_0x46d5fa[_0xa729('0x3e')]};return db['Automation'][_0xa729('0x21')](_0x4e4d72)[_0xa729('0x27')](function(_0x3e7a2a){_0x4c1da8[_0xa729('0x21')]=_0x3e7a2a;if(_0x3761d4[_0xa729('0x32')][_0xa729('0x42')]){_0x46d5fa[_0xa729('0x43')]=[{'all':!![]}];}return db[_0xa729('0x2b')][_0xa729('0x44')](_0x46d5fa);})[_0xa729('0x27')](function(_0x11568a){_0x4c1da8[_0xa729('0x45')]=_0x11568a;return _0x4c1da8;})[_0xa729('0x27')](respondWithFilteredResult(_0x400245,_0x46d5fa))[_0xa729('0x46')](handleError(_0x400245,null));};exports['show']=function(_0x6a5871,_0x59dae2){var _0x3b96fb={'raw':![],'where':{'id':_0x6a5871[_0xa729('0x47')]['id']}},_0x276ed6={};_0x276ed6['model']=_[_0xa729('0x33')](db['Automation'][_0xa729('0x2c')]);_0x276ed6[_0xa729('0x32')]=_[_0xa729('0x33')](_0x6a5871[_0xa729('0x32')]);_0x276ed6[_0xa729('0x34')]=_[_0xa729('0x35')](_0x276ed6[_0xa729('0x30')],_0x276ed6[_0xa729('0x32')]);_0x3b96fb[_0xa729('0x36')]=_[_0xa729('0x35')](_0x276ed6[_0xa729('0x30')],qs[_0xa729('0x37')](_0x6a5871[_0xa729('0x32')][_0xa729('0x37')]));_0x3b96fb[_0xa729('0x36')]=_0x3b96fb['attributes'][_0xa729('0x38')]?_0x3b96fb[_0xa729('0x36')]:_0x276ed6[_0xa729('0x30')];if(_0x6a5871[_0xa729('0x32')][_0xa729('0x42')]){_0x3b96fb['include']=[{'all':!![]}];}_0x3b96fb=_[_0xa729('0x3f')]({},_0x3b96fb,_0x6a5871[_0xa729('0x41')]);return db['Automation']['find'](_0x3b96fb)['then'](handleEntityNotFound(_0x59dae2,null))[_0xa729('0x27')](respondWithResult(_0x59dae2,null))[_0xa729('0x46')](handleError(_0x59dae2,null));};exports[_0xa729('0x48')]=function(_0x1bc508,_0x10209d){return db[_0xa729('0x2b')][_0xa729('0x48')](_0x1bc508['body'],{})[_0xa729('0x27')](respondWithResult(_0x10209d,0xc9))['catch'](handleError(_0x10209d,null));};exports[_0xa729('0x25')]=function(_0x56fc87,_0x2bae39){if(_0x56fc87[_0xa729('0x49')]['id']){delete _0x56fc87[_0xa729('0x49')]['id'];}return db['Automation'][_0xa729('0x4a')]({'where':{'id':_0x56fc87[_0xa729('0x47')]['id']}})[_0xa729('0x27')](handleEntityNotFound(_0x2bae39,null))[_0xa729('0x27')](saveUpdates(_0x56fc87[_0xa729('0x49')],null))['then'](respondWithResult(_0x2bae39,null))[_0xa729('0x46')](handleError(_0x2bae39,null));};exports[_0xa729('0x26')]=function(_0x1bf000,_0x183b19){return db[_0xa729('0x2b')][_0xa729('0x4a')]({'where':{'id':_0x1bf000[_0xa729('0x47')]['id']}})[_0xa729('0x27')](handleEntityNotFound(_0x183b19,null))[_0xa729('0x27')](removeEntity(_0x183b19,null))[_0xa729('0x46')](handleError(_0x183b19,null));};exports[_0xa729('0x4b')]=function(_0x25b62c,_0x43ed25,_0x590927){return db['Condition'][_0xa729('0x4a')]({'where':{'id':_0x25b62c['params']['id']}})[_0xa729('0x27')](handleEntityNotFound(_0x43ed25,null))[_0xa729('0x27')](function(_0x3acc56){if(_0x3acc56){return _0x3acc56[_0xa729('0x4b')](_0x25b62c[_0xa729('0x49')][_0xa729('0x4c')],_[_0xa729('0x4d')](_0x25b62c[_0xa729('0x49')],[_0xa729('0x4c'),'id'])||{});}})[_0xa729('0x27')](respondWithResult(_0x43ed25,null))[_0xa729('0x46')](handleError(_0x43ed25,null));};exports[_0xa729('0x4e')]=function(_0x146572,_0x546142,_0x1759be){var _0x1b5858={};var _0x199c75={};var _0xd62fb2;var _0x5670b3;return db[_0xa729('0x2b')]['findOne']({'where':{'id':_0x146572[_0xa729('0x47')]['id']}})[_0xa729('0x27')](handleEntityNotFound(_0x546142,null))[_0xa729('0x27')](function(_0x69671b){if(_0x69671b){_0xd62fb2=_0x69671b;_0x199c75[_0xa729('0x30')]=_[_0xa729('0x33')](db[_0xa729('0x4f')]['rawAttributes']);_0x199c75['query']=_[_0xa729('0x33')](_0x146572[_0xa729('0x32')]);_0x199c75[_0xa729('0x34')]=_[_0xa729('0x35')](_0x199c75[_0xa729('0x30')],_0x199c75['query']);_0x1b5858[_0xa729('0x36')]=_[_0xa729('0x35')](_0x199c75['model'],qs[_0xa729('0x37')](_0x146572[_0xa729('0x32')]['fields']));_0x1b5858[_0xa729('0x36')]=_0x1b5858[_0xa729('0x36')]['length']?_0x1b5858[_0xa729('0x36')]:_0x199c75[_0xa729('0x30')];_0x1b5858['order']=qs['sort'](_0x146572[_0xa729('0x32')]['sort']);_0x1b5858[_0xa729('0x3e')]=qs['filters'](_['pick'](_0x146572[_0xa729('0x32')],_0x199c75['filters']));if(_0x146572[_0xa729('0x32')][_0xa729('0x3d')]){_0x1b5858[_0xa729('0x3e')]=_[_0xa729('0x3f')](_0x1b5858[_0xa729('0x3e')],{'$or':_[_0xa729('0x31')](_0x1b5858[_0xa729('0x36')],function(_0x3a4c19){var _0x24d27d={};_0x24d27d[_0x3a4c19]={'$like':'%'+_0x146572[_0xa729('0x32')][_0xa729('0x3d')]+'%'};return _0x24d27d;})});}_0x1b5858=_[_0xa729('0x3f')]({},_0x1b5858,_0x146572[_0xa729('0x41')]);return _0xd62fb2['getConditions'](_0x1b5858);}})[_0xa729('0x27')](function(_0x2eb1cb){if(_0x2eb1cb){_0x5670b3=_0x2eb1cb[_0xa729('0x38')];if(!_0x146572[_0xa729('0x32')][_0xa729('0x50')]('nolimit')){_0x1b5858['limit']=qs[_0xa729('0x20')](_0x146572[_0xa729('0x32')][_0xa729('0x20')]);_0x1b5858['offset']=qs[_0xa729('0x1e')](_0x146572[_0xa729('0x32')][_0xa729('0x1e')]);}return _0xd62fb2['getConditions'](_0x1b5858);}})['then'](function(_0x37b832){if(_0x37b832){return _0x37b832?{'count':_0x5670b3,'rows':_0x37b832}:null;}})[_0xa729('0x27')](respondWithResult(_0x546142,null))[_0xa729('0x46')](handleError(_0x546142,null));};exports['addActions']=function(_0x31f745,_0x10d042,_0x1958aa){return db[_0xa729('0x51')][_0xa729('0x4a')]({'where':{'id':_0x31f745[_0xa729('0x47')]['id']}})[_0xa729('0x27')](handleEntityNotFound(_0x10d042,null))[_0xa729('0x27')](function(_0x15a37f){if(_0x15a37f){return _0x15a37f[_0xa729('0x52')](_0x31f745['body']['ids'],_['omit'](_0x31f745['body'],[_0xa729('0x4c'),'id'])||{});}})[_0xa729('0x27')](respondWithResult(_0x10d042,null))['catch'](handleError(_0x10d042,null));};exports[_0xa729('0x53')]=function(_0x586773,_0x10ca0f,_0x39dadf){var _0x169425={};var _0x524f10={};var _0x1cb1a1;var _0x1cd4af;return db[_0xa729('0x2b')][_0xa729('0x54')]({'where':{'id':_0x586773[_0xa729('0x47')]['id']}})[_0xa729('0x27')](handleEntityNotFound(_0x10ca0f,null))[_0xa729('0x27')](function(_0x4ce616){if(_0x4ce616){_0x1cb1a1=_0x4ce616;_0x524f10[_0xa729('0x30')]=_[_0xa729('0x33')](db[_0xa729('0x51')]['rawAttributes']);_0x524f10[_0xa729('0x32')]=_['keys'](_0x586773[_0xa729('0x32')]);_0x524f10[_0xa729('0x34')]=_[_0xa729('0x35')](_0x524f10['model'],_0x524f10[_0xa729('0x32')]);_0x169425[_0xa729('0x36')]=_[_0xa729('0x35')](_0x524f10[_0xa729('0x30')],qs[_0xa729('0x37')](_0x586773[_0xa729('0x32')][_0xa729('0x37')]));_0x169425[_0xa729('0x36')]=_0x169425[_0xa729('0x36')][_0xa729('0x38')]?_0x169425[_0xa729('0x36')]:_0x524f10[_0xa729('0x30')];_0x169425['order']=qs['sort'](_0x586773[_0xa729('0x32')]['sort']);_0x169425[_0xa729('0x3e')]=qs[_0xa729('0x34')](_[_0xa729('0x3c')](_0x586773[_0xa729('0x32')],_0x524f10[_0xa729('0x34')]));if(_0x586773[_0xa729('0x32')][_0xa729('0x3d')]){_0x169425[_0xa729('0x3e')]=_[_0xa729('0x3f')](_0x169425[_0xa729('0x3e')],{'$or':_[_0xa729('0x31')](_0x169425[_0xa729('0x36')],function(_0x5288df){var _0x1549f3={};_0x1549f3[_0x5288df]={'$like':'%'+_0x586773[_0xa729('0x32')]['filter']+'%'};return _0x1549f3;})});}_0x169425=_[_0xa729('0x3f')]({},_0x169425,_0x586773[_0xa729('0x41')]);return _0x1cb1a1['getActions'](_0x169425);}})['then'](function(_0x257fe4){if(_0x257fe4){_0x1cd4af=_0x257fe4[_0xa729('0x38')];if(!_0x586773[_0xa729('0x32')][_0xa729('0x50')](_0xa729('0x39'))){_0x169425[_0xa729('0x20')]=qs['limit'](_0x586773[_0xa729('0x32')][_0xa729('0x20')]);_0x169425[_0xa729('0x1e')]=qs[_0xa729('0x1e')](_0x586773['query'][_0xa729('0x1e')]);}return _0x1cb1a1[_0xa729('0x53')](_0x169425);}})[_0xa729('0x27')](function(_0x558efc){if(_0x558efc){return _0x558efc?{'count':_0x1cd4af,'rows':_0x558efc}:null;}})[_0xa729('0x27')](respondWithResult(_0x10ca0f,null))[_0xa729('0x46')](handleError(_0x10ca0f,null));}; \ No newline at end of file +var _0x6c61=['options','Automation','includeAll','include','findAll','catch','show','params','find','body','Condition','ids','getConditions','length','pick','nolimit','addActions','Action','omit','getActions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','send','index','map','rawAttributes','fieldName','type','model','name','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL'];(function(_0x2e5fef,_0x252152){var _0xe38c0c=function(_0x1ded16){while(--_0x1ded16){_0x2e5fef['push'](_0x2e5fef['shift']());}};_0xe38c0c(++_0x252152);}(_0x6c61,0x169));var _0x16c6=function(_0x5646ff,_0x2dc956){_0x5646ff=_0x5646ff-0x0;var _0x2d9a0e=_0x6c61[_0x5646ff];return _0x2d9a0e;};'use strict';var emlformat=require(_0x16c6('0x0'));var rimraf=require(_0x16c6('0x1'));var zipdir=require(_0x16c6('0x2'));var jsonpatch=require(_0x16c6('0x3'));var rp=require(_0x16c6('0x4'));var moment=require('moment');var BPromise=require(_0x16c6('0x5'));var Mustache=require(_0x16c6('0x6'));var util=require('util');var path=require(_0x16c6('0x7'));var sox=require(_0x16c6('0x8'));var csv=require(_0x16c6('0x9'));var ejs=require(_0x16c6('0xa'));var fs=require('fs');var fs_extra=require(_0x16c6('0xb'));var _=require(_0x16c6('0xc'));var squel=require(_0x16c6('0xd'));var crypto=require('crypto');var jsforce=require(_0x16c6('0xe'));var deskjs=require(_0x16c6('0xf'));var toCsv=require(_0x16c6('0x9'));var querystring=require(_0x16c6('0x10'));var Papa=require(_0x16c6('0x11'));var Redis=require('ioredis');var authService=require(_0x16c6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x16c6('0x13'));var hardwareService=require(_0x16c6('0x14'));var logger=require(_0x16c6('0x15'))(_0x16c6('0x16'));var utils=require(_0x16c6('0x17'));var config=require(_0x16c6('0x18'));var licenseUtil=require(_0x16c6('0x19'));var db=require(_0x16c6('0x1a'))['db'];function respondWithStatusCode(_0x5e3677,_0x2ab493){_0x2ab493=_0x2ab493||0xcc;return function(_0x4cee50){if(_0x4cee50){return _0x5e3677['sendStatus'](_0x2ab493);}return _0x5e3677[_0x16c6('0x1b')](_0x2ab493)[_0x16c6('0x1c')]();};}function respondWithResult(_0x9c697,_0x3d2766){_0x3d2766=_0x3d2766||0xc8;return function(_0x1aeb94){if(_0x1aeb94){return _0x9c697[_0x16c6('0x1b')](_0x3d2766)[_0x16c6('0x1d')](_0x1aeb94);}};}function respondWithFilteredResult(_0x2b4e6f,_0x2a110e){return function(_0x5e7d24){if(_0x5e7d24){var _0x2227af=typeof _0x2a110e[_0x16c6('0x1e')]===_0x16c6('0x1f')&&typeof _0x2a110e[_0x16c6('0x20')]===_0x16c6('0x1f');var _0x5e4885=_0x5e7d24[_0x16c6('0x21')];var _0x597c47=_0x2227af?0x0:_0x2a110e[_0x16c6('0x1e')];var _0xcc8480=_0x2227af?_0x5e7d24[_0x16c6('0x21')]:_0x2a110e['offset']+_0x2a110e[_0x16c6('0x20')];var _0x3ddcbf;if(_0xcc8480>=_0x5e4885){_0xcc8480=_0x5e4885;_0x3ddcbf=0xc8;}else{_0x3ddcbf=0xce;}_0x2b4e6f[_0x16c6('0x1b')](_0x3ddcbf);return _0x2b4e6f[_0x16c6('0x22')](_0x16c6('0x23'),_0x597c47+'-'+_0xcc8480+'/'+_0x5e4885)[_0x16c6('0x1d')](_0x5e7d24);}return null;};}function patchUpdates(_0x55b975){return function(_0x16c5c0){try{jsonpatch[_0x16c6('0x24')](_0x16c5c0,_0x55b975,!![]);}catch(_0x3387c4){return BPromise[_0x16c6('0x25')](_0x3387c4);}return _0x16c5c0[_0x16c6('0x26')]();};}function saveUpdates(_0x28d634,_0x40f53a){return function(_0x4e1f93){if(_0x4e1f93){return _0x4e1f93[_0x16c6('0x27')](_0x28d634)[_0x16c6('0x28')](function(_0x4d92ee){return _0x4d92ee;});}return null;};}function removeEntity(_0x45620c,_0x39ebd8){return function(_0xe0927f){if(_0xe0927f){return _0xe0927f[_0x16c6('0x29')]()[_0x16c6('0x28')](function(){_0x45620c[_0x16c6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32b789,_0x3b25fe){return function(_0x3a3a33){if(!_0x3a3a33){_0x32b789[_0x16c6('0x2a')](0x194);}return _0x3a3a33;};}function handleError(_0x36c2cb,_0x449b1b){_0x449b1b=_0x449b1b||0x1f4;return function(_0x4f26e8){logger['error'](_0x4f26e8['stack']);if(_0x4f26e8['name']){delete _0x4f26e8['name'];}_0x36c2cb[_0x16c6('0x1b')](_0x449b1b)[_0x16c6('0x2b')](_0x4f26e8);};}exports[_0x16c6('0x2c')]=function(_0x5c12b3,_0x24c742){var _0x28ebfb={},_0x39cffc={},_0x2ef3f7={'count':0x0,'rows':[]};var _0x16c8b8=_[_0x16c6('0x2d')](db['Automation'][_0x16c6('0x2e')],function(_0x78dfde){return{'name':_0x78dfde[_0x16c6('0x2f')],'type':_0x78dfde[_0x16c6('0x30')]['key']};});_0x39cffc[_0x16c6('0x31')]=_[_0x16c6('0x2d')](_0x16c8b8,_0x16c6('0x32'));_0x39cffc[_0x16c6('0x33')]=_[_0x16c6('0x34')](_0x5c12b3[_0x16c6('0x33')]);_0x39cffc['filters']=_['intersection'](_0x39cffc[_0x16c6('0x31')],_0x39cffc['query']);_0x28ebfb[_0x16c6('0x35')]=_[_0x16c6('0x36')](_0x39cffc['model'],qs['fields'](_0x5c12b3[_0x16c6('0x33')][_0x16c6('0x37')]));_0x28ebfb[_0x16c6('0x35')]=_0x28ebfb[_0x16c6('0x35')]['length']?_0x28ebfb[_0x16c6('0x35')]:_0x39cffc[_0x16c6('0x31')];if(!_0x5c12b3[_0x16c6('0x33')][_0x16c6('0x38')]('nolimit')){_0x28ebfb['limit']=qs['limit'](_0x5c12b3[_0x16c6('0x33')]['limit']);_0x28ebfb[_0x16c6('0x1e')]=qs[_0x16c6('0x1e')](_0x5c12b3['query'][_0x16c6('0x1e')]);}_0x28ebfb[_0x16c6('0x39')]=qs[_0x16c6('0x3a')](_0x5c12b3['query'][_0x16c6('0x3a')]);_0x28ebfb[_0x16c6('0x3b')]=qs['filters'](_['pick'](_0x5c12b3[_0x16c6('0x33')],_0x39cffc[_0x16c6('0x3c')]),_0x16c8b8);if(_0x5c12b3[_0x16c6('0x33')][_0x16c6('0x3d')]){_0x28ebfb[_0x16c6('0x3b')]=_[_0x16c6('0x3e')](_0x28ebfb[_0x16c6('0x3b')],{'$or':_[_0x16c6('0x2d')](_0x16c8b8,function(_0x46b09f){if(_0x46b09f[_0x16c6('0x30')]!==_0x16c6('0x3f')){var _0x15d9a4={};_0x15d9a4[_0x46b09f[_0x16c6('0x32')]]={'$like':'%'+_0x5c12b3['query'][_0x16c6('0x3d')]+'%'};return _0x15d9a4;}})});}_0x28ebfb=_[_0x16c6('0x3e')]({},_0x28ebfb,_0x5c12b3[_0x16c6('0x40')]);var _0x5299f4={'where':_0x28ebfb[_0x16c6('0x3b')]};return db[_0x16c6('0x41')][_0x16c6('0x21')](_0x5299f4)[_0x16c6('0x28')](function(_0x97db5d){_0x2ef3f7[_0x16c6('0x21')]=_0x97db5d;if(_0x5c12b3[_0x16c6('0x33')][_0x16c6('0x42')]){_0x28ebfb[_0x16c6('0x43')]=[{'all':!![]}];}return db[_0x16c6('0x41')][_0x16c6('0x44')](_0x28ebfb);})[_0x16c6('0x28')](function(_0x2e21cd){_0x2ef3f7['rows']=_0x2e21cd;return _0x2ef3f7;})['then'](respondWithFilteredResult(_0x24c742,_0x28ebfb))[_0x16c6('0x45')](handleError(_0x24c742,null));};exports[_0x16c6('0x46')]=function(_0x2b4e4f,_0x4a1af1){var _0x495128={'raw':![],'where':{'id':_0x2b4e4f[_0x16c6('0x47')]['id']}},_0x550b99={};_0x550b99[_0x16c6('0x31')]=_[_0x16c6('0x34')](db[_0x16c6('0x41')][_0x16c6('0x2e')]);_0x550b99['query']=_[_0x16c6('0x34')](_0x2b4e4f[_0x16c6('0x33')]);_0x550b99[_0x16c6('0x3c')]=_[_0x16c6('0x36')](_0x550b99[_0x16c6('0x31')],_0x550b99[_0x16c6('0x33')]);_0x495128['attributes']=_[_0x16c6('0x36')](_0x550b99[_0x16c6('0x31')],qs[_0x16c6('0x37')](_0x2b4e4f[_0x16c6('0x33')][_0x16c6('0x37')]));_0x495128[_0x16c6('0x35')]=_0x495128[_0x16c6('0x35')]['length']?_0x495128[_0x16c6('0x35')]:_0x550b99[_0x16c6('0x31')];if(_0x2b4e4f[_0x16c6('0x33')][_0x16c6('0x42')]){_0x495128['include']=[{'all':!![]}];}_0x495128=_[_0x16c6('0x3e')]({},_0x495128,_0x2b4e4f['options']);return db['Automation'][_0x16c6('0x48')](_0x495128)[_0x16c6('0x28')](handleEntityNotFound(_0x4a1af1,null))[_0x16c6('0x28')](respondWithResult(_0x4a1af1,null))[_0x16c6('0x45')](handleError(_0x4a1af1,null));};exports['create']=function(_0x206257,_0x3c60db){return db[_0x16c6('0x41')]['create'](_0x206257['body'],{})['then'](respondWithResult(_0x3c60db,0xc9))[_0x16c6('0x45')](handleError(_0x3c60db,null));};exports[_0x16c6('0x27')]=function(_0x43d8ed,_0xff3277){if(_0x43d8ed[_0x16c6('0x49')]['id']){delete _0x43d8ed[_0x16c6('0x49')]['id'];}return db[_0x16c6('0x41')][_0x16c6('0x48')]({'where':{'id':_0x43d8ed[_0x16c6('0x47')]['id']}})[_0x16c6('0x28')](handleEntityNotFound(_0xff3277,null))[_0x16c6('0x28')](saveUpdates(_0x43d8ed[_0x16c6('0x49')],null))[_0x16c6('0x28')](respondWithResult(_0xff3277,null))[_0x16c6('0x45')](handleError(_0xff3277,null));};exports[_0x16c6('0x29')]=function(_0x280a2a,_0x4be668){return db[_0x16c6('0x41')][_0x16c6('0x48')]({'where':{'id':_0x280a2a[_0x16c6('0x47')]['id']}})['then'](handleEntityNotFound(_0x4be668,null))['then'](removeEntity(_0x4be668,null))[_0x16c6('0x45')](handleError(_0x4be668,null));};exports['addConditions']=function(_0x407d88,_0x1c1a49,_0x488b7c){return db[_0x16c6('0x4a')]['find']({'where':{'id':_0x407d88[_0x16c6('0x47')]['id']}})[_0x16c6('0x28')](handleEntityNotFound(_0x1c1a49,null))['then'](function(_0x46afbc){if(_0x46afbc){return _0x46afbc['addConditions'](_0x407d88[_0x16c6('0x49')][_0x16c6('0x4b')],_['omit'](_0x407d88[_0x16c6('0x49')],[_0x16c6('0x4b'),'id'])||{});}})[_0x16c6('0x28')](respondWithResult(_0x1c1a49,null))[_0x16c6('0x45')](handleError(_0x1c1a49,null));};exports[_0x16c6('0x4c')]=function(_0x40fd70,_0x139031,_0x49c600){var _0x4d9f68={};var _0x120dff={};var _0x8b88fa;var _0x374b65;return db[_0x16c6('0x41')]['findOne']({'where':{'id':_0x40fd70['params']['id']}})[_0x16c6('0x28')](handleEntityNotFound(_0x139031,null))[_0x16c6('0x28')](function(_0x55042a){if(_0x55042a){_0x8b88fa=_0x55042a;_0x120dff[_0x16c6('0x31')]=_[_0x16c6('0x34')](db[_0x16c6('0x4a')][_0x16c6('0x2e')]);_0x120dff['query']=_[_0x16c6('0x34')](_0x40fd70['query']);_0x120dff['filters']=_[_0x16c6('0x36')](_0x120dff[_0x16c6('0x31')],_0x120dff[_0x16c6('0x33')]);_0x4d9f68[_0x16c6('0x35')]=_[_0x16c6('0x36')](_0x120dff['model'],qs[_0x16c6('0x37')](_0x40fd70[_0x16c6('0x33')][_0x16c6('0x37')]));_0x4d9f68[_0x16c6('0x35')]=_0x4d9f68[_0x16c6('0x35')][_0x16c6('0x4d')]?_0x4d9f68[_0x16c6('0x35')]:_0x120dff[_0x16c6('0x31')];_0x4d9f68[_0x16c6('0x39')]=qs[_0x16c6('0x3a')](_0x40fd70['query'][_0x16c6('0x3a')]);_0x4d9f68[_0x16c6('0x3b')]=qs['filters'](_[_0x16c6('0x4e')](_0x40fd70[_0x16c6('0x33')],_0x120dff[_0x16c6('0x3c')]));if(_0x40fd70['query'][_0x16c6('0x3d')]){_0x4d9f68[_0x16c6('0x3b')]=_[_0x16c6('0x3e')](_0x4d9f68[_0x16c6('0x3b')],{'$or':_['map'](_0x4d9f68[_0x16c6('0x35')],function(_0x841309){var _0x3834d9={};_0x3834d9[_0x841309]={'$like':'%'+_0x40fd70[_0x16c6('0x33')][_0x16c6('0x3d')]+'%'};return _0x3834d9;})});}_0x4d9f68=_[_0x16c6('0x3e')]({},_0x4d9f68,_0x40fd70[_0x16c6('0x40')]);return _0x8b88fa[_0x16c6('0x4c')](_0x4d9f68);}})['then'](function(_0x421de9){if(_0x421de9){_0x374b65=_0x421de9['length'];if(!_0x40fd70['query'][_0x16c6('0x38')](_0x16c6('0x4f'))){_0x4d9f68[_0x16c6('0x20')]=qs['limit'](_0x40fd70[_0x16c6('0x33')][_0x16c6('0x20')]);_0x4d9f68[_0x16c6('0x1e')]=qs[_0x16c6('0x1e')](_0x40fd70[_0x16c6('0x33')]['offset']);}return _0x8b88fa[_0x16c6('0x4c')](_0x4d9f68);}})[_0x16c6('0x28')](function(_0x44aa96){if(_0x44aa96){return _0x44aa96?{'count':_0x374b65,'rows':_0x44aa96}:null;}})[_0x16c6('0x28')](respondWithResult(_0x139031,null))[_0x16c6('0x45')](handleError(_0x139031,null));};exports[_0x16c6('0x50')]=function(_0x1f37ec,_0xd2816b,_0x2ff565){return db[_0x16c6('0x51')][_0x16c6('0x48')]({'where':{'id':_0x1f37ec[_0x16c6('0x47')]['id']}})[_0x16c6('0x28')](handleEntityNotFound(_0xd2816b,null))[_0x16c6('0x28')](function(_0x26007e){if(_0x26007e){return _0x26007e['addActions'](_0x1f37ec[_0x16c6('0x49')][_0x16c6('0x4b')],_[_0x16c6('0x52')](_0x1f37ec[_0x16c6('0x49')],['ids','id'])||{});}})[_0x16c6('0x28')](respondWithResult(_0xd2816b,null))['catch'](handleError(_0xd2816b,null));};exports[_0x16c6('0x53')]=function(_0x3a9c66,_0x5a8ee6,_0xedb471){var _0xe0b0dd={};var _0x4d6352={};var _0x543352;var _0x281212;return db[_0x16c6('0x41')][_0x16c6('0x54')]({'where':{'id':_0x3a9c66['params']['id']}})[_0x16c6('0x28')](handleEntityNotFound(_0x5a8ee6,null))[_0x16c6('0x28')](function(_0xa279ab){if(_0xa279ab){_0x543352=_0xa279ab;_0x4d6352['model']=_[_0x16c6('0x34')](db[_0x16c6('0x51')][_0x16c6('0x2e')]);_0x4d6352['query']=_[_0x16c6('0x34')](_0x3a9c66[_0x16c6('0x33')]);_0x4d6352[_0x16c6('0x3c')]=_[_0x16c6('0x36')](_0x4d6352['model'],_0x4d6352[_0x16c6('0x33')]);_0xe0b0dd[_0x16c6('0x35')]=_[_0x16c6('0x36')](_0x4d6352[_0x16c6('0x31')],qs[_0x16c6('0x37')](_0x3a9c66[_0x16c6('0x33')]['fields']));_0xe0b0dd[_0x16c6('0x35')]=_0xe0b0dd[_0x16c6('0x35')][_0x16c6('0x4d')]?_0xe0b0dd['attributes']:_0x4d6352[_0x16c6('0x31')];_0xe0b0dd['order']=qs[_0x16c6('0x3a')](_0x3a9c66[_0x16c6('0x33')]['sort']);_0xe0b0dd[_0x16c6('0x3b')]=qs[_0x16c6('0x3c')](_['pick'](_0x3a9c66[_0x16c6('0x33')],_0x4d6352[_0x16c6('0x3c')]));if(_0x3a9c66[_0x16c6('0x33')][_0x16c6('0x3d')]){_0xe0b0dd[_0x16c6('0x3b')]=_[_0x16c6('0x3e')](_0xe0b0dd[_0x16c6('0x3b')],{'$or':_[_0x16c6('0x2d')](_0xe0b0dd[_0x16c6('0x35')],function(_0x558bd6){var _0x18ed07={};_0x18ed07[_0x558bd6]={'$like':'%'+_0x3a9c66['query'][_0x16c6('0x3d')]+'%'};return _0x18ed07;})});}_0xe0b0dd=_[_0x16c6('0x3e')]({},_0xe0b0dd,_0x3a9c66[_0x16c6('0x40')]);return _0x543352['getActions'](_0xe0b0dd);}})[_0x16c6('0x28')](function(_0x29c976){if(_0x29c976){_0x281212=_0x29c976['length'];if(!_0x3a9c66[_0x16c6('0x33')][_0x16c6('0x38')]('nolimit')){_0xe0b0dd[_0x16c6('0x20')]=qs[_0x16c6('0x20')](_0x3a9c66[_0x16c6('0x33')][_0x16c6('0x20')]);_0xe0b0dd[_0x16c6('0x1e')]=qs[_0x16c6('0x1e')](_0x3a9c66[_0x16c6('0x33')][_0x16c6('0x1e')]);}return _0x543352[_0x16c6('0x53')](_0xe0b0dd);}})[_0x16c6('0x28')](function(_0x34752e){if(_0x34752e){return _0x34752e?{'count':_0x281212,'rows':_0x34752e}:null;}})[_0x16c6('0x28')](respondWithResult(_0x5a8ee6,null))[_0x16c6('0x45')](handleError(_0x5a8ee6,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index ec0d3d7..06c632a 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 _0x818f=['request-promise','path','../../config/environment','exports','Automation','tools_automations','util','../../config/logger','api','moment'];(function(_0x75bcfd,_0x548f36){var _0x5de5e8=function(_0x4b6a04){while(--_0x4b6a04){_0x75bcfd['push'](_0x75bcfd['shift']());}};_0x5de5e8(++_0x548f36);}(_0x818f,0x196));var _0xf818=function(_0x2db3aa,_0x90b8a9){_0x2db3aa=_0x2db3aa-0x0;var _0x5c3e2c=_0x818f[_0x2db3aa];return _0x5c3e2c;};'use strict';var _=require('lodash');var util=require(_0xf818('0x0'));var logger=require(_0xf818('0x1'))(_0xf818('0x2'));var moment=require(_0xf818('0x3'));var BPromise=require('bluebird');var rp=require(_0xf818('0x4'));var fs=require('fs');var path=require(_0xf818('0x5'));var rimraf=require('rimraf');var config=require(_0xf818('0x6'));var attributes=require('./automation.attributes');module[_0xf818('0x7')]=function(_0x47ac40,_0x5622fd){return _0x47ac40['define'](_0xf818('0x8'),attributes,{'tableName':_0xf818('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb3f=['../../config/logger','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeb3f,0x1f3));var _0xfeb3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xeb3f[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0xfeb3('0x0'));var logger=require(_0xfeb3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfeb3('0x2'));var fs=require('fs');var path=require(_0xfeb3('0x3'));var rimraf=require(_0xfeb3('0x4'));var config=require(_0xfeb3('0x5'));var attributes=require(_0xfeb3('0x6'));module[_0xfeb3('0x7')]=function(_0x9ea1cb,_0x3b83da){return _0x9ea1cb['define'](_0xfeb3('0x8'),attributes,{'tableName':_0xfeb3('0x9'),'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 6246384..8dee1e5 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 _0x9123=['lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','message','Automation,\x20%s,\x20%s','result','catch'];(function(_0x53c85d,_0x5d5281){var _0x48f975=function(_0x18fdff){while(--_0x18fdff){_0x53c85d['push'](_0x53c85d['shift']());}};_0x48f975(++_0x5d5281);}(_0x9123,0x140));var _0x3912=function(_0x40e35a,_0x2e2e20){_0x40e35a=_0x40e35a-0x0;var _0x10f00c=_0x9123[_0x40e35a];return _0x10f00c;};'use strict';var _=require(_0x3912('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3912('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3912('0x2'))['db'];var utils=require(_0x3912('0x3'));var logger=require(_0x3912('0x4'))(_0x3912('0x5'));var config=require('../../config/environment');var jayson=require(_0x3912('0x6'));var client=jayson[_0x3912('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea5cf,_0x2b3ac0,_0x2d75b6){return new BPromise(function(_0x2325d0,_0x51fb5b){return client[_0x3912('0x8')](_0x4ea5cf,_0x2d75b6)[_0x3912('0x9')](function(_0x2f5910){logger[_0x3912('0xa')]('Automation,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'));logger[_0x3912('0xc')]('Automation,\x20%s,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'),JSON[_0x3912('0xd')](_0x2f5910));if(_0x2f5910[_0x3912('0xe')]){if(_0x2f5910[_0x3912('0xe')][_0x3912('0xf')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x2b3ac0,_0x2f5910[_0x3912('0xe')][_0x3912('0x10')]);return _0x51fb5b(_0x2f5910[_0x3912('0xe')]['message']);}logger[_0x3912('0xe')](_0x3912('0x11'),_0x2b3ac0,_0x2f5910['error'][_0x3912('0x10')]);return _0x2325d0(_0x2f5910[_0x3912('0xe')][_0x3912('0x10')]);}else{logger[_0x3912('0xa')]('Automation,\x20%s,\x20%s',_0x2b3ac0,_0x3912('0xb'));_0x2325d0(_0x2f5910[_0x3912('0x12')][_0x3912('0x10')]);}})[_0x3912('0x13')](function(_0x4658b6){logger['error'](_0x3912('0x11'),_0x2b3ac0,_0x4658b6);_0x51fb5b(_0x4658b6);});});} \ No newline at end of file +var _0xdfb1=['../../config/logger','client','http','request','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xf8cca2,_0x12a2df){var _0x2ef044=function(_0x5e6c6b){while(--_0x5e6c6b){_0xf8cca2['push'](_0xf8cca2['shift']());}};_0x2ef044(++_0x12a2df);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x2d13a3,_0x480de5){_0x2d13a3=_0x2d13a3-0x0;var _0x5a993c=_0xdfb1[_0x2d13a3];return _0x5a993c;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var moment=require(_0x1dfb('0x2'));var BPromise=require(_0x1dfb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dfb('0x4'));var db=require(_0x1dfb('0x5'))['db'];var utils=require(_0x1dfb('0x6'));var logger=require(_0x1dfb('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1dfb('0x8')][_0x1dfb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e10d9,_0x496be7,_0x42d45e){return new BPromise(function(_0x491406,_0x141081){return client[_0x1dfb('0xa')](_0x1e10d9,_0x42d45e)['then'](function(_0x24d8b9){logger[_0x1dfb('0xb')](_0x1dfb('0xc'),_0x496be7,'request\x20sent');logger[_0x1dfb('0xd')](_0x1dfb('0xe'),_0x496be7,_0x1dfb('0xf'),JSON[_0x1dfb('0x10')](_0x24d8b9));if(_0x24d8b9[_0x1dfb('0x11')]){if(_0x24d8b9[_0x1dfb('0x11')][_0x1dfb('0x12')]===0x1f4){logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x24d8b9['error'][_0x1dfb('0x13')]);return _0x141081(_0x24d8b9[_0x1dfb('0x11')]['message']);}logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x24d8b9[_0x1dfb('0x11')]['message']);return _0x491406(_0x24d8b9[_0x1dfb('0x11')][_0x1dfb('0x13')]);}else{logger[_0x1dfb('0xb')]('Automation,\x20%s,\x20%s',_0x496be7,_0x1dfb('0xf'));_0x491406(_0x24d8b9[_0x1dfb('0x14')][_0x1dfb('0x13')]);}})['catch'](function(_0x1186d1){logger[_0x1dfb('0x11')](_0x1dfb('0xc'),_0x496be7,_0x1186d1);_0x141081(_0x1186d1);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 0076a6b..af7f0d0 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 _0x35f9=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x389339,_0x8a6ae9){var _0x49dabc=function(_0x1306bf){while(--_0x1306bf){_0x389339['push'](_0x389339['shift']());}};_0x49dabc(++_0x8a6ae9);}(_0x35f9,0x1df));var _0x935f=function(_0xace180,_0x392fce){_0xace180=_0xace180-0x0;var _0x31fff1=_0x35f9[_0xace180];return _0x31fff1;};'use strict';var multer=require(_0x935f('0x0'));var util=require(_0x935f('0x1'));var path=require(_0x935f('0x2'));var timeout=require(_0x935f('0x3'));var express=require('express');var router=express[_0x935f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x935f('0x5'));var config=require(_0x935f('0x6'));var controller=require('./automation.controller');router['get']('/',auth[_0x935f('0x7')](),controller[_0x935f('0x8')]);router[_0x935f('0x9')](_0x935f('0xa'),auth[_0x935f('0x7')](),controller[_0x935f('0xb')]);router[_0x935f('0x9')]('/:id/conditions',auth[_0x935f('0x7')](),controller[_0x935f('0xc')]);router[_0x935f('0x9')](_0x935f('0xd'),auth[_0x935f('0x7')](),controller[_0x935f('0xe')]);router[_0x935f('0xf')]('/',auth[_0x935f('0x7')](),controller[_0x935f('0x10')]);router['post']('/:id/conditions',auth[_0x935f('0x7')](),controller[_0x935f('0x11')]);router[_0x935f('0xf')]('/:id/actions',auth['isAuthenticated'](),controller[_0x935f('0x12')]);router[_0x935f('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x935f('0x14')]);router['delete'](_0x935f('0xa'),auth[_0x935f('0x7')](),controller[_0x935f('0x15')]);module[_0x935f('0x16')]=router; \ No newline at end of file +var _0xd8ee=['../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','getActions','create','post','addActions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x59014b,_0x294587){var _0x176fc9=function(_0x755cce){while(--_0x755cce){_0x59014b['push'](_0x59014b['shift']());}};_0x176fc9(++_0x294587);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x4e0f60,_0x426fe6){_0x4e0f60=_0x4e0f60-0x0;var _0x48e1ef=_0xd8ee[_0x4e0f60];return _0x48e1ef;};'use strict';var multer=require(_0xed8e('0x0'));var util=require('util');var path=require(_0xed8e('0x1'));var timeout=require(_0xed8e('0x2'));var express=require(_0xed8e('0x3'));var router=express['Router']();var fs_extra=require(_0xed8e('0x4'));var auth=require(_0xed8e('0x5'));var interaction=require(_0xed8e('0x6'));var config=require(_0xed8e('0x7'));var controller=require(_0xed8e('0x8'));router[_0xed8e('0x9')]('/',auth['isAuthenticated'](),controller[_0xed8e('0xa')]);router[_0xed8e('0x9')](_0xed8e('0xb'),auth[_0xed8e('0xc')](),controller[_0xed8e('0xd')]);router[_0xed8e('0x9')](_0xed8e('0xe'),auth['isAuthenticated'](),controller['getConditions']);router[_0xed8e('0x9')]('/:id/actions',auth['isAuthenticated'](),controller[_0xed8e('0xf')]);router['post']('/',auth[_0xed8e('0xc')](),controller[_0xed8e('0x10')]);router['post'](_0xed8e('0xe'),auth[_0xed8e('0xc')](),controller['addConditions']);router[_0xed8e('0x11')]('/:id/actions',auth[_0xed8e('0xc')](),controller[_0xed8e('0x12')]);router[_0xed8e('0x13')](_0xed8e('0xb'),auth[_0xed8e('0xc')](),controller[_0xed8e('0x14')]);router[_0xed8e('0x15')](_0xed8e('0xb'),auth[_0xed8e('0xc')](),controller[_0xed8e('0x16')]);module[_0xed8e('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5e27735..3ef89a2 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 _0x67e8=['#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\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','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen'];(function(_0x4aab83,_0x138c22){var _0x119a72=function(_0x42aa20){while(--_0x42aa20){_0x4aab83['push'](_0x4aab83['shift']());}};_0x119a72(++_0x138c22);}(_0x67e8,0xcf));var _0x867e=function(_0x3c06a3,_0x259d76){_0x3c06a3=_0x3c06a3-0x0;var _0x2a6ed5=_0x67e8[_0x3c06a3];return _0x2a6ed5;};'use strict';var Sequelize=require(_0x867e('0x0'));module[_0x867e('0x1')]={'name':{'type':Sequelize[_0x867e('0x2')],'unique':_0x867e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x867e('0x4')](_0x867e('0x5')),'allowNull':![],'defaultValue':_0x867e('0x5')},'description':{'type':Sequelize[_0x867e('0x2')]},'active':{'type':Sequelize[_0x867e('0x6')],'defaultValue':0x0,'comment':_0x867e('0x7')},'limitCalls':{'type':Sequelize[_0x867e('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x867e('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x867e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x867e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x867e('0x8')](0x3)[_0x867e('0xa')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x867e('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x867e('0x8')](0x3)[_0x867e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x867e('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x867e('0x8')](0x5)[_0x867e('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x867e('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x867e('0x8')](0x3)[_0x867e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x867e('0xe')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x867e('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x867e('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x867e('0x8')](0x3)[_0x867e('0xa')],'defaultValue':0x3,'comment':_0x867e('0x10')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x867e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x867e('0x8')](0x3)[_0x867e('0xa')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x867e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x867e('0x2')],'defaultValue':_0x867e('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x867e('0x4')](_0x867e('0x12'),_0x867e('0x13'),_0x867e('0x14')),'defaultValue':_0x867e('0x12')},'dialAMDActive':{'type':Sequelize[_0x867e('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x867e('0x8')](0x9)[_0x867e('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x867e('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x867e('0x8')](0x9)[_0x867e('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x867e('0xa')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x867e('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x867e('0x8')](0x9)[_0x867e('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x867e('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x867e('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x867e('0x8')](0x9)[_0x867e('0xa')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x867e('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x867e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x867e('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x867e('0x8')](0x9)[_0x867e('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x867e('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x867e('0x1c'),_0x867e('0x1d')),'defaultValue':_0x867e('0x1c')},'dialPrefix':{'type':Sequelize[_0x867e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x867e('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x867e('0x1e')},'dialCutDigit':{'type':Sequelize[_0x867e('0x8')](0x3)[_0x867e('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x867e('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x867e('0x8')](0x3)[_0x867e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x867e('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x867e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x867e('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x867e('0x8')](0x3)[_0x867e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x867e('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x867e('0x8')](0x5)[_0x867e('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x867e('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x867e('0x8')](0x3)[_0x867e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x867e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x867e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x867e('0x8')](0x5)[_0x867e('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x867e('0x8')](0x3)[_0x867e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x867e('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x867e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x867e('0x25')}}; \ No newline at end of file +var _0x0e8c=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','BOOLEAN','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x329990,_0x3f6357){var _0x1092b6=function(_0x82b85){while(--_0x82b85){_0x329990['push'](_0x329990['shift']());}};_0x1092b6(++_0x3f6357);}(_0x0e8c,0x1e0));var _0xc0e8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0e8c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xc0e8('0x0')]={'name':{'type':Sequelize[_0xc0e8('0x1')],'unique':_0xc0e8('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc0e8('0x3')](_0xc0e8('0x4')),'allowNull':![],'defaultValue':_0xc0e8('0x4')},'description':{'type':Sequelize[_0xc0e8('0x1')]},'active':{'type':Sequelize[_0xc0e8('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc0e8('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc0e8('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc0e8('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xc0e8('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc0e8('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc0e8('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'defaultValue':0x3,'comment':_0xc0e8('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc0e8('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc0e8('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc0e8('0x1')],'defaultValue':_0xc0e8('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0xc0e8('0x11'),'never',_0xc0e8('0x12')),'defaultValue':_0xc0e8('0x11')},'dialAMDActive':{'type':Sequelize[_0xc0e8('0x5')],'defaultValue':0x0,'comment':_0xc0e8('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xc0e8('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xc0e8('0x7')](0x9)[_0xc0e8('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc0e8('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc0e8('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc0e8('0x7')](0x9)[_0xc0e8('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xc0e8('0x7')](0x9)[_0xc0e8('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc0e8('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc0e8('0x7')](0x9)[_0xc0e8('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc0e8('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc0e8('0x7')](0x9)[_0xc0e8('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc0e8('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc0e8('0x3')]('DESC','ASC'),'defaultValue':_0xc0e8('0x19')},'dialPrefix':{'type':Sequelize[_0xc0e8('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc0e8('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc0e8('0x1a')},'dialCutDigit':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc0e8('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc0e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc0e8('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xc0e8('0x7')](0x3)[_0xc0e8('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc0e8('0x7')](0x5)[_0xc0e8('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc0e8('0x20')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3684820..5dd9cc0 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 _0x00a4=['destroy','end','sendStatus','error','stack','name','index','Campaign','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','clone','omit','createdAt','updatedAt','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','sort','pick','CampaignId','findOne','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','COALESCE(phone,\x27\x27)','into','cm_hopper_additional_phones','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','insert','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','IvrCampaigns'];(function(_0x5c0d48,_0x3731e9){var _0x1b5331=function(_0x2287b8){while(--_0x2287b8){_0x5c0d48['push'](_0x5c0d48['shift']());}};_0x1b5331(++_0x3731e9);}(_0x00a4,0x186));var _0x400a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x00a4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x400a('0x0'));var rimraf=require(_0x400a('0x1'));var zipdir=require(_0x400a('0x2'));var jsonpatch=require(_0x400a('0x3'));var rp=require(_0x400a('0x4'));var moment=require('moment');var BPromise=require(_0x400a('0x5'));var Mustache=require('mustache');var util=require(_0x400a('0x6'));var path=require(_0x400a('0x7'));var sox=require('sox');var csv=require(_0x400a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x400a('0x9'));var squel=require(_0x400a('0xa'));var crypto=require(_0x400a('0xb'));var jsforce=require(_0x400a('0xc'));var deskjs=require(_0x400a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x400a('0xe'));var Papa=require(_0x400a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x400a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x400a('0x11'))(_0x400a('0x12'));var utils=require(_0x400a('0x13'));var config=require(_0x400a('0x14'));var licenseUtil=require(_0x400a('0x15'));var db=require(_0x400a('0x16'))['db'];function respondWithStatusCode(_0x49ebbd,_0x3b81e2){_0x3b81e2=_0x3b81e2||0xcc;return function(_0x74be0f){if(_0x74be0f){return _0x49ebbd['sendStatus'](_0x3b81e2);}return _0x49ebbd['status'](_0x3b81e2)['end']();};}function respondWithResult(_0x203759,_0x188c99){_0x188c99=_0x188c99||0xc8;return function(_0x2967aa){if(_0x2967aa){return _0x203759[_0x400a('0x17')](_0x188c99)[_0x400a('0x18')](_0x2967aa);}};}function respondWithFilteredResult(_0x41f35e,_0x5d86e1){return function(_0x275286){if(_0x275286){var _0xfd25c6=typeof _0x5d86e1[_0x400a('0x19')]===_0x400a('0x1a')&&typeof _0x5d86e1[_0x400a('0x1b')]===_0x400a('0x1a');var _0x1506c4=_0x275286['count'];var _0x2e6831=_0xfd25c6?0x0:_0x5d86e1[_0x400a('0x19')];var _0x267a4e=_0xfd25c6?_0x275286[_0x400a('0x1c')]:_0x5d86e1[_0x400a('0x19')]+_0x5d86e1[_0x400a('0x1b')];var _0x4c7ddf;if(_0x267a4e>=_0x1506c4){_0x267a4e=_0x1506c4;_0x4c7ddf=0xc8;}else{_0x4c7ddf=0xce;}_0x41f35e[_0x400a('0x17')](_0x4c7ddf);return _0x41f35e[_0x400a('0x1d')](_0x400a('0x1e'),_0x2e6831+'-'+_0x267a4e+'/'+_0x1506c4)['json'](_0x275286);}return null;};}function patchUpdates(_0xd7e75d){return function(_0x1ccb14){try{jsonpatch['apply'](_0x1ccb14,_0xd7e75d,!![]);}catch(_0x47f63a){return BPromise[_0x400a('0x1f')](_0x47f63a);}return _0x1ccb14['save']();};}function saveUpdates(_0x182b05,_0x368d55){return function(_0x11e1fa){if(_0x11e1fa){return _0x11e1fa[_0x400a('0x20')](_0x182b05)[_0x400a('0x21')](function(_0x11db80){return _0x11db80;});}return null;};}function removeEntity(_0x369387,_0x7ec3bb){return function(_0x4f4912){if(_0x4f4912){return _0x4f4912['destroy']()[_0x400a('0x21')](function(){var _0x3524b8=_0x4f4912[_0x400a('0x22')]({'plain':!![]});var _0x26682f=_0x400a('0x23');return db['UserProfileResource'][_0x400a('0x24')]({'where':{'type':_0x26682f,'resourceId':_0x3524b8['id']}})[_0x400a('0x21')](function(){return _0x4f4912;});})[_0x400a('0x21')](function(){_0x369387['status'](0xcc)[_0x400a('0x25')]();});}};}function handleEntityNotFound(_0x3f8a81,_0x46a244){return function(_0x50fbc0){if(!_0x50fbc0){_0x3f8a81[_0x400a('0x26')](0x194);}return _0x50fbc0;};}function handleError(_0x4644c2,_0x1f103e){_0x1f103e=_0x1f103e||0x1f4;return function(_0x3e7c43){logger[_0x400a('0x27')](_0x3e7c43[_0x400a('0x28')]);if(_0x3e7c43[_0x400a('0x29')]){delete _0x3e7c43[_0x400a('0x29')];}_0x4644c2[_0x400a('0x17')](_0x1f103e)['send'](_0x3e7c43);};}exports[_0x400a('0x2a')]=function(_0x2caadf,_0x2753e4){var _0x445bda={},_0x1597e4={},_0x3cb8b4={'count':0x0,'rows':[]};var _0x3cb040=_['map'](db[_0x400a('0x2b')]['rawAttributes'],function(_0x1f6b23){return{'name':_0x1f6b23[_0x400a('0x2c')],'type':_0x1f6b23['type'][_0x400a('0x2d')]};});_0x1597e4['model']=_[_0x400a('0x2e')](_0x3cb040,_0x400a('0x29'));_0x1597e4['query']=_[_0x400a('0x2f')](_0x2caadf[_0x400a('0x30')]);_0x1597e4[_0x400a('0x31')]=_[_0x400a('0x32')](_0x1597e4[_0x400a('0x33')],_0x1597e4['query']);_0x445bda[_0x400a('0x34')]=_[_0x400a('0x32')](_0x1597e4['model'],qs[_0x400a('0x35')](_0x2caadf['query'][_0x400a('0x35')]));_0x445bda[_0x400a('0x34')]=_0x445bda[_0x400a('0x34')][_0x400a('0x36')]?_0x445bda['attributes']:_0x1597e4['model'];if(!_0x2caadf[_0x400a('0x30')][_0x400a('0x37')](_0x400a('0x38'))){_0x445bda[_0x400a('0x1b')]=qs[_0x400a('0x1b')](_0x2caadf['query'][_0x400a('0x1b')]);_0x445bda['offset']=qs[_0x400a('0x19')](_0x2caadf[_0x400a('0x30')]['offset']);}_0x445bda[_0x400a('0x39')]=qs['sort'](_0x2caadf[_0x400a('0x30')]['sort']);_0x445bda[_0x400a('0x3a')]=qs[_0x400a('0x31')](_['pick'](_0x2caadf['query'],_0x1597e4['filters']),_0x3cb040);if(_0x2caadf['query'][_0x400a('0x3b')]){_0x445bda[_0x400a('0x3a')]=_[_0x400a('0x3c')](_0x445bda['where'],{'$or':_['map'](_0x3cb040,function(_0x3d731a){if(_0x3d731a[_0x400a('0x3d')]!==_0x400a('0x3e')){var _0x3e5cd7={};_0x3e5cd7[_0x3d731a[_0x400a('0x29')]]={'$like':'%'+_0x2caadf['query'][_0x400a('0x3b')]+'%'};return _0x3e5cd7;}})});}_0x445bda=_[_0x400a('0x3c')]({},_0x445bda,_0x2caadf[_0x400a('0x3f')]);var _0x388c38={'where':_0x445bda[_0x400a('0x3a')]};return db[_0x400a('0x2b')][_0x400a('0x1c')](_0x388c38)[_0x400a('0x21')](function(_0x409d25){_0x3cb8b4['count']=_0x409d25;if(_0x2caadf[_0x400a('0x30')][_0x400a('0x40')]){_0x445bda[_0x400a('0x41')]=[{'all':!![]}];}return db[_0x400a('0x2b')][_0x400a('0x42')](_0x445bda);})['then'](function(_0x3a5997){_0x3cb8b4[_0x400a('0x43')]=_0x3a5997;return _0x3cb8b4;})['then'](respondWithFilteredResult(_0x2753e4,_0x445bda))[_0x400a('0x44')](handleError(_0x2753e4,null));};exports[_0x400a('0x45')]=function(_0x5c8381,_0x45e71c){var _0x3125ae={'raw':![],'where':{'id':_0x5c8381[_0x400a('0x46')]['id']}},_0xff0aa7={};_0xff0aa7[_0x400a('0x33')]=_['keys'](db[_0x400a('0x2b')][_0x400a('0x47')]);_0xff0aa7[_0x400a('0x30')]=_[_0x400a('0x2f')](_0x5c8381[_0x400a('0x30')]);_0xff0aa7[_0x400a('0x31')]=_[_0x400a('0x32')](_0xff0aa7[_0x400a('0x33')],_0xff0aa7[_0x400a('0x30')]);_0x3125ae[_0x400a('0x34')]=_[_0x400a('0x32')](_0xff0aa7[_0x400a('0x33')],qs[_0x400a('0x35')](_0x5c8381['query'][_0x400a('0x35')]));_0x3125ae['attributes']=_0x3125ae['attributes'][_0x400a('0x36')]?_0x3125ae['attributes']:_0xff0aa7['model'];if(_0x5c8381[_0x400a('0x30')][_0x400a('0x40')]){_0x3125ae[_0x400a('0x41')]=[{'all':!![]}];}_0x3125ae=_[_0x400a('0x3c')]({},_0x3125ae,_0x5c8381[_0x400a('0x3f')]);return db['Campaign'][_0x400a('0x48')](_0x3125ae)[_0x400a('0x21')](handleEntityNotFound(_0x45e71c,null))['then'](respondWithResult(_0x45e71c,null))[_0x400a('0x44')](handleError(_0x45e71c,null));};exports['create']=function(_0x3ea387,_0x5671f3){return db['Campaign'][_0x400a('0x49')](_0x3ea387[_0x400a('0x4a')],{})[_0x400a('0x21')](function(_0x2af23c){var _0x3f41cb=_0x3ea387[_0x400a('0x4b')][_0x400a('0x22')]({'plain':!![]});if(!_0x3f41cb)throw new Error(_0x400a('0x4c'));if(_0x3f41cb[_0x400a('0x4d')]===_0x400a('0x4b')){var _0xf7a502=_0x2af23c[_0x400a('0x22')]({'plain':!![]});var _0x26bc33='IvrCampaigns';return db[_0x400a('0x4e')]['find']({'where':{'name':_0x26bc33,'userProfileId':_0x3f41cb['userProfileId']},'raw':!![]})[_0x400a('0x21')](function(_0x57d789){if(_0x57d789&&_0x57d789['autoAssociation']===0x0){return db['UserProfileResource'][_0x400a('0x49')]({'name':_0xf7a502['name'],'resourceId':_0xf7a502['id'],'type':_0x57d789[_0x400a('0x29')],'sectionId':_0x57d789['id']},{})['then'](function(){return _0x2af23c;});}else{return _0x2af23c;}})[_0x400a('0x44')](function(_0x2ead92){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ead92);throw _0x2ead92;});}return _0x2af23c;})['then'](respondWithResult(_0x5671f3,0xc9))['catch'](handleError(_0x5671f3,null));};exports[_0x400a('0x4f')]=function(_0x1aeb89,_0x108645){var _0x3dcbc4={'where':{'id':_0x1aeb89['params']['id']}},_0x4da092={};_0x4da092[_0x400a('0x33')]=_[_0x400a('0x2f')](db[_0x400a('0x2b')][_0x400a('0x47')]);_0x3dcbc4[_0x400a('0x34')]=_[_0x400a('0x32')](_0x4da092['model'],qs[_0x400a('0x35')](_0x1aeb89[_0x400a('0x30')][_0x400a('0x35')]));_0x3dcbc4[_0x400a('0x34')]=_0x3dcbc4[_0x400a('0x34')][_0x400a('0x36')]?_0x3dcbc4['attributes']:_0x4da092[_0x400a('0x33')];if(_0x1aeb89[_0x400a('0x30')]['includeAll']){_0x3dcbc4[_0x400a('0x41')]=[{'all':!![]}];}_0x3dcbc4=_[_0x400a('0x3c')]({},_0x3dcbc4,_0x1aeb89[_0x400a('0x3f')]);return db[_0x400a('0x2b')][_0x400a('0x48')](_0x3dcbc4)[_0x400a('0x21')](handleEntityNotFound(_0x108645,null))['then'](function(_0x167ba6){if(_0x167ba6){var _0x1cea04=_0x167ba6[_0x400a('0x22')]({'plain':!![]});_0x1cea04=qs[_0x400a('0x50')](_0x1cea04,['id',_0x400a('0x51'),'updatedAt']);_0x1aeb89[_0x400a('0x4a')]=_[_0x400a('0x50')](_0x1aeb89['body'],['id','createdAt',_0x400a('0x52')]);return db['Campaign']['create'](_[_0x400a('0x3c')](_0x1cea04,_0x1aeb89[_0x400a('0x4a')]),{'include':_0x1aeb89[_0x400a('0x30')][_0x400a('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x2c5610){var _0x2dc795=_0x1aeb89['user'][_0x400a('0x22')]({'plain':!![]});if(!_0x2dc795)throw new Error(_0x400a('0x4c'));if(_0x2dc795[_0x400a('0x4d')]==='user'){var _0x1cdfd1=_0x2c5610[_0x400a('0x22')]({'plain':!![]});var _0x527d16='IvrCampaigns';return db['UserProfileSection'][_0x400a('0x48')]({'where':{'name':_0x527d16,'userProfileId':_0x2dc795[_0x400a('0x53')]},'raw':!![]})['then'](function(_0x28f2e2){if(_0x28f2e2&&_0x28f2e2[_0x400a('0x54')]===0x0){return db['UserProfileResource'][_0x400a('0x49')]({'name':_0x1cdfd1[_0x400a('0x29')],'resourceId':_0x1cdfd1['id'],'type':_0x28f2e2[_0x400a('0x29')],'sectionId':_0x28f2e2['id']},{})['then'](function(){return _0x2c5610;});}else{return _0x2c5610;}})[_0x400a('0x44')](function(_0x4a4a70){logger[_0x400a('0x27')](_0x400a('0x55'),_0x4a4a70);throw _0x4a4a70;});}return _0x2c5610;});}})[_0x400a('0x21')](respondWithResult(_0x108645,0xc9))[_0x400a('0x44')](handleError(_0x108645,null));};exports['update']=function(_0x41e985,_0x219684){if(_0x41e985['body']['id']){delete _0x41e985['body']['id'];}return db['Campaign'][_0x400a('0x48')]({'where':{'id':_0x41e985['params']['id']}})[_0x400a('0x21')](handleEntityNotFound(_0x219684,null))['then'](saveUpdates(_0x41e985[_0x400a('0x4a')],null))[_0x400a('0x21')](respondWithResult(_0x219684,null))[_0x400a('0x44')](handleError(_0x219684,null));};exports[_0x400a('0x24')]=function(_0x187828,_0x244aea){return db['Campaign'][_0x400a('0x48')]({'where':{'id':_0x187828['params']['id']}})[_0x400a('0x21')](handleEntityNotFound(_0x244aea,null))[_0x400a('0x21')](removeEntity(_0x244aea,null))[_0x400a('0x44')](handleError(_0x244aea,null));};exports[_0x400a('0x56')]=function(_0x562356,_0x3ccc28,_0x2f18cc){var _0x4d8d53={'raw':!![],'where':{}};var _0x1a0d2f={};var _0x54620c={'count':0x0,'rows':[]};return db[_0x400a('0x2b')]['findOne']({'where':{'id':_0x562356[_0x400a('0x46')]['id']}})['then'](handleEntityNotFound(_0x3ccc28,null))[_0x400a('0x21')](function(_0x9db66){if(_0x9db66){_0x1a0d2f[_0x400a('0x33')]=_['keys'](db[_0x400a('0x57')][_0x400a('0x47')]);_0x1a0d2f[_0x400a('0x30')]=_[_0x400a('0x2f')](_0x562356[_0x400a('0x30')]);_0x1a0d2f[_0x400a('0x31')]=_['intersection'](_0x1a0d2f['model'],_0x1a0d2f[_0x400a('0x30')]);_0x4d8d53[_0x400a('0x34')]=_[_0x400a('0x32')](_0x1a0d2f[_0x400a('0x33')],qs[_0x400a('0x35')](_0x562356[_0x400a('0x30')][_0x400a('0x35')]));_0x4d8d53['attributes']=_0x4d8d53[_0x400a('0x34')][_0x400a('0x36')]?_0x4d8d53[_0x400a('0x34')]:_0x1a0d2f[_0x400a('0x33')];if(!_0x562356[_0x400a('0x30')][_0x400a('0x37')](_0x400a('0x38'))){_0x4d8d53[_0x400a('0x1b')]=qs[_0x400a('0x1b')](_0x562356[_0x400a('0x30')][_0x400a('0x1b')]);_0x4d8d53['offset']=qs[_0x400a('0x19')](_0x562356['query'][_0x400a('0x19')]);}_0x4d8d53[_0x400a('0x39')]=qs[_0x400a('0x58')](_0x562356[_0x400a('0x30')][_0x400a('0x58')]);_0x4d8d53['where']=qs['filters'](_[_0x400a('0x59')](_0x562356[_0x400a('0x30')],_0x1a0d2f['filters']));_0x4d8d53[_0x400a('0x3a')][_0x400a('0x5a')]=_0x9db66['id'];if(_0x562356['query'][_0x400a('0x3b')]){_0x4d8d53['where']=_[_0x400a('0x3c')](_0x4d8d53[_0x400a('0x3a')],{'$or':_['map'](_0x4d8d53[_0x400a('0x34')],function(_0x1c20c3){var _0x52918f={};_0x52918f[_0x1c20c3]={'$like':'%'+_0x562356[_0x400a('0x30')][_0x400a('0x3b')]+'%'};return _0x52918f;})});}_0x4d8d53=_[_0x400a('0x3c')]({},_0x4d8d53,_0x562356[_0x400a('0x3f')]);return db[_0x400a('0x57')][_0x400a('0x1c')]({'where':_0x4d8d53[_0x400a('0x3a')]})[_0x400a('0x21')](function(_0x591c5c){_0x54620c[_0x400a('0x1c')]=_0x591c5c;if(_0x562356['query'][_0x400a('0x40')]){_0x4d8d53[_0x400a('0x41')]=[{'all':!![]}];}return db[_0x400a('0x57')][_0x400a('0x42')](_0x4d8d53);})[_0x400a('0x21')](function(_0x4bc8e3){_0x54620c[_0x400a('0x43')]=_0x4bc8e3;return _0x54620c;});}})[_0x400a('0x21')](respondWithFilteredResult(_0x3ccc28,_0x4d8d53))[_0x400a('0x44')](handleError(_0x3ccc28,null));};exports['getHopperHistories']=function(_0x2feee9,_0x31b998,_0x5330f2){var _0xa25d43={'raw':!![],'where':{}};var _0x3a206a={};var _0x400e9f={'count':0x0,'rows':[]};return db[_0x400a('0x2b')][_0x400a('0x5b')]({'where':{'id':_0x2feee9['params']['id']}})[_0x400a('0x21')](handleEntityNotFound(_0x31b998,null))[_0x400a('0x21')](function(_0x437b8f){if(_0x437b8f){_0x3a206a['model']=_[_0x400a('0x2f')](db['CmHopperHistory'][_0x400a('0x47')]);_0x3a206a[_0x400a('0x30')]=_['keys'](_0x2feee9[_0x400a('0x30')]);_0x3a206a['filters']=_[_0x400a('0x32')](_0x3a206a[_0x400a('0x33')],_0x3a206a[_0x400a('0x30')]);_0xa25d43[_0x400a('0x34')]=_[_0x400a('0x32')](_0x3a206a['model'],qs[_0x400a('0x35')](_0x2feee9['query'][_0x400a('0x35')]));_0xa25d43['attributes']=_0xa25d43[_0x400a('0x34')][_0x400a('0x36')]?_0xa25d43['attributes']:_0x3a206a[_0x400a('0x33')];if(!_0x2feee9[_0x400a('0x30')][_0x400a('0x37')](_0x400a('0x38'))){_0xa25d43['limit']=qs[_0x400a('0x1b')](_0x2feee9[_0x400a('0x30')][_0x400a('0x1b')]);_0xa25d43[_0x400a('0x19')]=qs[_0x400a('0x19')](_0x2feee9[_0x400a('0x30')][_0x400a('0x19')]);}_0xa25d43[_0x400a('0x39')]=qs[_0x400a('0x58')](_0x2feee9[_0x400a('0x30')]['sort']);_0xa25d43['where']=qs[_0x400a('0x31')](_['pick'](_0x2feee9[_0x400a('0x30')],_0x3a206a[_0x400a('0x31')]));_0xa25d43[_0x400a('0x3a')][_0x400a('0x5a')]=_0x437b8f['id'];if(_0x2feee9['query'][_0x400a('0x3b')]){_0xa25d43[_0x400a('0x3a')]=_[_0x400a('0x3c')](_0xa25d43[_0x400a('0x3a')],{'$or':_['map'](_0xa25d43[_0x400a('0x34')],function(_0x43cc56){var _0x19f3fa={};_0x19f3fa[_0x43cc56]={'$like':'%'+_0x2feee9[_0x400a('0x30')][_0x400a('0x3b')]+'%'};return _0x19f3fa;})});}_0xa25d43=_[_0x400a('0x3c')]({},_0xa25d43,_0x2feee9[_0x400a('0x3f')]);return db['CmHopperHistory'][_0x400a('0x1c')]({'where':_0xa25d43['where']})[_0x400a('0x21')](function(_0xacd83c){_0x400e9f[_0x400a('0x1c')]=_0xacd83c;if(_0x2feee9[_0x400a('0x30')][_0x400a('0x40')]){_0xa25d43[_0x400a('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x400a('0x42')](_0xa25d43);})[_0x400a('0x21')](function(_0x32f464){_0x400e9f[_0x400a('0x43')]=_0x32f464;return _0x400e9f;});}})['then'](respondWithFilteredResult(_0x31b998,_0xa25d43))[_0x400a('0x44')](handleError(_0x31b998,null));};exports[_0x400a('0x5c')]=function(_0x1b7fc9,_0x140b03,_0x217e2f){var _0xfd7ad3={'raw':!![],'where':{}};var _0x54f4e9={};var _0x5bf5ae={'count':0x0,'rows':[]};return db[_0x400a('0x2b')][_0x400a('0x5b')]({'where':{'id':_0x1b7fc9[_0x400a('0x46')]['id']}})[_0x400a('0x21')](handleEntityNotFound(_0x140b03,null))['then'](function(_0x13a94c){if(_0x13a94c){_0x54f4e9['model']=_[_0x400a('0x2f')](db[_0x400a('0x5d')][_0x400a('0x47')]);_0x54f4e9['query']=_[_0x400a('0x2f')](_0x1b7fc9[_0x400a('0x30')]);_0x54f4e9[_0x400a('0x31')]=_[_0x400a('0x32')](_0x54f4e9['model'],_0x54f4e9[_0x400a('0x30')]);_0xfd7ad3['attributes']=_['intersection'](_0x54f4e9['model'],qs[_0x400a('0x35')](_0x1b7fc9[_0x400a('0x30')][_0x400a('0x35')]));_0xfd7ad3[_0x400a('0x34')]=_0xfd7ad3[_0x400a('0x34')][_0x400a('0x36')]?_0xfd7ad3[_0x400a('0x34')]:_0x54f4e9['model'];if(!_0x1b7fc9[_0x400a('0x30')][_0x400a('0x37')](_0x400a('0x38'))){_0xfd7ad3[_0x400a('0x1b')]=qs[_0x400a('0x1b')](_0x1b7fc9['query']['limit']);_0xfd7ad3['offset']=qs['offset'](_0x1b7fc9[_0x400a('0x30')][_0x400a('0x19')]);}_0xfd7ad3[_0x400a('0x39')]=qs[_0x400a('0x58')](_0x1b7fc9[_0x400a('0x30')][_0x400a('0x58')]);_0xfd7ad3[_0x400a('0x3a')]=qs[_0x400a('0x31')](_[_0x400a('0x59')](_0x1b7fc9[_0x400a('0x30')],_0x54f4e9['filters']));_0xfd7ad3[_0x400a('0x3a')][_0x400a('0x5a')]=_0x13a94c['id'];if(_0x1b7fc9[_0x400a('0x30')]['filter']){_0xfd7ad3[_0x400a('0x3a')]=_[_0x400a('0x3c')](_0xfd7ad3[_0x400a('0x3a')],{'$or':_[_0x400a('0x2e')](_0xfd7ad3[_0x400a('0x34')],function(_0x1a6938){var _0x41a3b2={};_0x41a3b2[_0x1a6938]={'$like':'%'+_0x1b7fc9[_0x400a('0x30')][_0x400a('0x3b')]+'%'};return _0x41a3b2;})});}_0xfd7ad3=_[_0x400a('0x3c')]({},_0xfd7ad3,_0x1b7fc9[_0x400a('0x3f')]);return db[_0x400a('0x5d')][_0x400a('0x1c')]({'where':_0xfd7ad3[_0x400a('0x3a')]})[_0x400a('0x21')](function(_0x28d0da){_0x5bf5ae['count']=_0x28d0da;if(_0x1b7fc9[_0x400a('0x30')][_0x400a('0x40')]){_0xfd7ad3['include']=[{'all':!![]}];}return db[_0x400a('0x5d')][_0x400a('0x42')](_0xfd7ad3);})['then'](function(_0x8f251){_0x5bf5ae[_0x400a('0x43')]=_0x8f251;return _0x5bf5ae;});}})[_0x400a('0x21')](respondWithFilteredResult(_0x140b03,_0xfd7ad3))[_0x400a('0x44')](handleError(_0x140b03,null));};exports[_0x400a('0x5e')]=function(_0x57e7bf,_0x438ae3,_0x411377){var _0x2f0027={'raw':!![],'where':{}};var _0x19df36={};var _0x5d4475={'count':0x0,'rows':[]};return db[_0x400a('0x2b')][_0x400a('0x5b')]({'where':{'id':_0x57e7bf[_0x400a('0x46')]['id']}})['then'](handleEntityNotFound(_0x438ae3,null))[_0x400a('0x21')](function(_0x319f53){if(_0x319f53){_0x19df36[_0x400a('0x33')]=_[_0x400a('0x2f')](db[_0x400a('0x5f')]['rawAttributes']);_0x19df36[_0x400a('0x30')]=_[_0x400a('0x2f')](_0x57e7bf['query']);_0x19df36[_0x400a('0x31')]=_[_0x400a('0x32')](_0x19df36['model'],_0x19df36[_0x400a('0x30')]);_0x2f0027[_0x400a('0x34')]=_[_0x400a('0x32')](_0x19df36[_0x400a('0x33')],qs[_0x400a('0x35')](_0x57e7bf[_0x400a('0x30')][_0x400a('0x35')]));_0x2f0027[_0x400a('0x34')]=_0x2f0027[_0x400a('0x34')][_0x400a('0x36')]?_0x2f0027[_0x400a('0x34')]:_0x19df36[_0x400a('0x33')];if(!_0x57e7bf['query'][_0x400a('0x37')](_0x400a('0x38'))){_0x2f0027['limit']=qs[_0x400a('0x1b')](_0x57e7bf['query']['limit']);_0x2f0027[_0x400a('0x19')]=qs[_0x400a('0x19')](_0x57e7bf[_0x400a('0x30')][_0x400a('0x19')]);}_0x2f0027[_0x400a('0x39')]=qs[_0x400a('0x58')](_0x57e7bf[_0x400a('0x30')]['sort']);_0x2f0027[_0x400a('0x3a')]=qs[_0x400a('0x31')](_['pick'](_0x57e7bf[_0x400a('0x30')],_0x19df36[_0x400a('0x31')]));_0x2f0027[_0x400a('0x3a')]['CampaignId']=_0x319f53['id'];if(_0x57e7bf[_0x400a('0x30')][_0x400a('0x3b')]){_0x2f0027[_0x400a('0x3a')]=_[_0x400a('0x3c')](_0x2f0027[_0x400a('0x3a')],{'$or':_[_0x400a('0x2e')](_0x2f0027[_0x400a('0x34')],function(_0x1b59e9){var _0x4e0214={};_0x4e0214[_0x1b59e9]={'$like':'%'+_0x57e7bf[_0x400a('0x30')]['filter']+'%'};return _0x4e0214;})});}_0x2f0027=_[_0x400a('0x3c')]({},_0x2f0027,_0x57e7bf['options']);return db[_0x400a('0x5f')][_0x400a('0x1c')]({'where':_0x2f0027[_0x400a('0x3a')]})[_0x400a('0x21')](function(_0x3e164b){_0x5d4475['count']=_0x3e164b;if(_0x57e7bf[_0x400a('0x30')][_0x400a('0x40')]){_0x2f0027[_0x400a('0x41')]=[{'all':!![]}];}return db[_0x400a('0x5f')]['findAll'](_0x2f0027);})['then'](function(_0x238434){_0x5d4475[_0x400a('0x43')]=_0x238434;return _0x5d4475;});}})['then'](respondWithFilteredResult(_0x438ae3,_0x2f0027))[_0x400a('0x44')](handleError(_0x438ae3,null));};exports[_0x400a('0x60')]=function(_0x589de7,_0x4c049d,_0x18d5e0){var _0x3e1939={};var _0x639c4d={};var _0x4a9223;var _0x496bce;return db['Campaign'][_0x400a('0x5b')]({'where':{'id':_0x589de7[_0x400a('0x46')]['id']}})['then'](handleEntityNotFound(_0x4c049d,null))[_0x400a('0x21')](function(_0x301317){if(_0x301317){_0x4a9223=_0x301317;_0x639c4d[_0x400a('0x33')]=_[_0x400a('0x2f')](db[_0x400a('0x61')][_0x400a('0x47')]);_0x639c4d[_0x400a('0x30')]=_[_0x400a('0x2f')](_0x589de7['query']);_0x639c4d[_0x400a('0x31')]=_[_0x400a('0x32')](_0x639c4d['model'],_0x639c4d[_0x400a('0x30')]);_0x3e1939['attributes']=_['intersection'](_0x639c4d[_0x400a('0x33')],qs[_0x400a('0x35')](_0x589de7['query'][_0x400a('0x35')]));_0x3e1939['attributes']=_0x3e1939[_0x400a('0x34')][_0x400a('0x36')]?_0x3e1939[_0x400a('0x34')]:_0x639c4d[_0x400a('0x33')];_0x3e1939['order']=qs[_0x400a('0x58')](_0x589de7[_0x400a('0x30')][_0x400a('0x58')]);_0x3e1939[_0x400a('0x3a')]=qs[_0x400a('0x31')](_['pick'](_0x589de7[_0x400a('0x30')],_0x639c4d[_0x400a('0x31')]));if(_0x589de7[_0x400a('0x30')][_0x400a('0x3b')]){_0x3e1939[_0x400a('0x3a')]=_[_0x400a('0x3c')](_0x3e1939['where'],{'$or':_['map'](_0x3e1939['attributes'],function(_0x2e1d6c){var _0x111a70={};_0x111a70[_0x2e1d6c]={'$like':'%'+_0x589de7['query'][_0x400a('0x3b')]+'%'};return _0x111a70;})});}_0x3e1939=_[_0x400a('0x3c')]({},_0x3e1939,_0x589de7[_0x400a('0x3f')]);return _0x4a9223[_0x400a('0x60')](_0x3e1939);}})[_0x400a('0x21')](function(_0xa28f35){if(_0xa28f35){_0x496bce=_0xa28f35[_0x400a('0x36')];if(!_0x589de7[_0x400a('0x30')][_0x400a('0x37')](_0x400a('0x38'))){_0x3e1939[_0x400a('0x1b')]=qs[_0x400a('0x1b')](_0x589de7['query'][_0x400a('0x1b')]);_0x3e1939[_0x400a('0x19')]=qs[_0x400a('0x19')](_0x589de7[_0x400a('0x30')][_0x400a('0x19')]);}return _0x4a9223[_0x400a('0x60')](_0x3e1939);}})[_0x400a('0x21')](function(_0xc8e8aa){if(_0xc8e8aa){return _0xc8e8aa?{'count':_0x496bce,'rows':_0xc8e8aa}:null;}})[_0x400a('0x21')](respondWithResult(_0x4c049d,null))[_0x400a('0x44')](handleError(_0x4c049d,null));};exports[_0x400a('0x62')]=function(_0x5e52d7,_0x34b789,_0x2238b9){var _0x32e69b,_0x360677;var _0x5ab0a6=[];var _0x350441=moment()[_0x400a('0x63')](_0x400a('0x64'));return db[_0x400a('0x2b')][_0x400a('0x48')]({'where':{'id':_0x5e52d7[_0x400a('0x46')]['id']}})[_0x400a('0x21')](handleEntityNotFound(_0x34b789,null))['then'](function(_0x2116e1){if(_0x2116e1){_0x360677=_0x2116e1;return _0x2116e1['addLists'](_0x5e52d7[_0x400a('0x4a')][_0x400a('0x65')],_['omit'](_0x5e52d7[_0x400a('0x4a')],['ids','id'])||{});}return null;})[_0x400a('0x66')](function(_0xed2e5a){var _0x5aee8c;var _0x4d087b;_0x32e69b=_0xed2e5a||[];var _0x53b391=[];if(_0xed2e5a){for(var _0xd63b6a=0x0;_0xd63b6a<_0xed2e5a['length'];_0xd63b6a+=0x1){var _0x55294d=_0xed2e5a[_0xd63b6a]['get']({'plain':!![]});_0x360677[_0x400a('0x67')]=_0x5e52d7['body'][_0x400a('0x67')]?_0x5e52d7[_0x400a('0x4a')][_0x400a('0x67')]:_0x360677[_0x400a('0x67')];switch(_0x360677[_0x400a('0x67')]){case _0x400a('0x68'):_0x5aee8c=squel['insert']()['into'](_0x400a('0x69'))['fromQuery']([_0x400a('0x6a'),_0x400a('0x6b'),_0x400a('0x6c'),_0x400a('0x6d'),_0x400a('0x5a'),_0x400a('0x51'),_0x400a('0x52')],squel[_0x400a('0x6e')]()[_0x400a('0x6f')]('phone','phone')[_0x400a('0x6f')](_0x400a('0x70'),_0x400a('0x6b'))[_0x400a('0x6f')]('id',_0x400a('0x6c'))[_0x400a('0x6f')](_0x55294d[_0x400a('0x71')][_0x400a('0x72')](),_0x400a('0x6d'))['field'](_0x5e52d7[_0x400a('0x46')]['id']['toString'](),_0x400a('0x5a'))[_0x400a('0x6f')]('\x27'+_0x350441+'\x27',_0x400a('0x51'))[_0x400a('0x6f')]('\x27'+_0x350441+'\x27',_0x400a('0x52'))[_0x400a('0x73')]('cm_contacts')[_0x400a('0x3a')](_0x400a('0x74'))[_0x400a('0x3a')](_0x400a('0x75'),_0x55294d[_0x400a('0x71')][_0x400a('0x72')]())['where'](_0x400a('0x76'))['where'](_0x400a('0x77'),squel[_0x400a('0x6e')]()[_0x400a('0x6f')](_0x400a('0x78'))[_0x400a('0x73')]('cm_hopper_final')['where'](_0x400a('0x79'),_0x5e52d7[_0x400a('0x46')]['id'][_0x400a('0x72')]()))[_0x400a('0x3a')](_0x400a('0x77'),squel[_0x400a('0x6e')]()[_0x400a('0x6f')]('COALESCE(phone,\x27\x27)')[_0x400a('0x73')](_0x400a('0x69'))[_0x400a('0x3a')](_0x400a('0x79'),_0x5e52d7[_0x400a('0x46')]['id']['toString']())))[_0x400a('0x72')]();break;case _0x400a('0x7a'):_0x5aee8c=squel['insert']()['into']('cm_hopper')[_0x400a('0x7b')]([_0x400a('0x6a'),'scheduledAt',_0x400a('0x6c'),_0x400a('0x6d'),_0x400a('0x5a'),_0x400a('0x51'),_0x400a('0x52')],squel[_0x400a('0x6e')]()[_0x400a('0x6f')](_0x400a('0x6a'),'phone')[_0x400a('0x6f')](_0x400a('0x70'),_0x400a('0x6b'))[_0x400a('0x6f')]('id',_0x400a('0x6c'))['field'](_0x55294d['CmListId'][_0x400a('0x72')](),'ListId')[_0x400a('0x6f')](_0x5e52d7[_0x400a('0x46')]['id']['toString'](),'CampaignId')['field']('\x27'+_0x350441+'\x27',_0x400a('0x51'))[_0x400a('0x6f')]('\x27'+_0x350441+'\x27','updatedAt')['from']('cm_contacts')[_0x400a('0x3a')](_0x400a('0x74'))[_0x400a('0x3a')](_0x400a('0x75'),_0x55294d[_0x400a('0x71')][_0x400a('0x72')]())[_0x400a('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0x400a('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0x400a('0x6e')]()[_0x400a('0x6f')](_0x400a('0x7c'))['from'](_0x400a('0x69'))[_0x400a('0x3a')](_0x400a('0x79'),_0x5e52d7['params']['id'][_0x400a('0x72')]())))[_0x400a('0x72')]();break;default:_0x5aee8c=squel['insert']()['into'](_0x400a('0x69'))['fromQuery']([_0x400a('0x6a'),'scheduledAt',_0x400a('0x6c'),_0x400a('0x6d'),_0x400a('0x5a'),'createdAt',_0x400a('0x52')],squel[_0x400a('0x6e')]()[_0x400a('0x6f')](_0x400a('0x6a'),_0x400a('0x6a'))['field']('NOW()','scheduledAt')[_0x400a('0x6f')]('id',_0x400a('0x6c'))[_0x400a('0x6f')](_0x55294d['CmListId']['toString'](),_0x400a('0x6d'))[_0x400a('0x6f')](_0x5e52d7['params']['id'][_0x400a('0x72')](),'CampaignId')[_0x400a('0x6f')]('\x27'+_0x350441+'\x27',_0x400a('0x51'))[_0x400a('0x6f')]('\x27'+_0x350441+'\x27',_0x400a('0x52'))[_0x400a('0x73')]('cm_contacts')[_0x400a('0x3a')](_0x400a('0x74'))[_0x400a('0x3a')](_0x400a('0x75'),_0x55294d[_0x400a('0x71')]['toString']())[_0x400a('0x3a')](_0x400a('0x76')))[_0x400a('0x72')]();}_0x4d087b=squel['insert']()[_0x400a('0x7d')](_0x400a('0x7e'))[_0x400a('0x7b')](['cmHopperId',_0x400a('0x6b'),'phone',_0x400a('0x7f'),_0x400a('0x51'),_0x400a('0x52')],squel[_0x400a('0x6e')]()[_0x400a('0x6f')](_0x400a('0x80'),'id')[_0x400a('0x6f')](_0x400a('0x70'),'scheduledAt')['field'](_0x400a('0x81'),'phone')[_0x400a('0x6f')]('ci.OrderBY','OrderBy')[_0x400a('0x6f')]('\x27'+_0x350441+'\x27',_0x400a('0x51'))[_0x400a('0x6f')]('\x27'+_0x350441+'\x27',_0x400a('0x52'))[_0x400a('0x73')](_0x400a('0x82'),'ci')['join']('cm_hopper','h',_0x400a('0x83'))['where'](_0x400a('0x84'),_0x55294d[_0x400a('0x71')][_0x400a('0x72')]())[_0x400a('0x3a')]('h.CampaignId=?',_0x5e52d7[_0x400a('0x46')]['id'][_0x400a('0x72')]())[_0x400a('0x3a')](_0x400a('0x85'),_0x350441))[_0x400a('0x72')]();_0x53b391[_0x400a('0x86')](db[_0x400a('0x87')][_0x400a('0x30')](_0x5aee8c));_0x5ab0a6[_0x400a('0x86')](db[_0x400a('0x87')][_0x400a('0x30')](_0x4d087b));}return BPromise[_0x400a('0x88')](_0x53b391);}})['then'](function(){return BPromise[_0x400a('0x88')](_0x5ab0a6);})['then'](function(){return _0x32e69b;})['then'](respondWithResult(_0x34b789,null))[_0x400a('0x44')](handleError(_0x34b789,null));};exports[_0x400a('0x89')]=function(_0x29b7cd,_0x2a596d,_0x6039cc){return db[_0x400a('0x2b')][_0x400a('0x48')]({'where':{'id':_0x29b7cd[_0x400a('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a596d,null))['then'](function(_0x49f358){if(_0x49f358){return _0x49f358[_0x400a('0x89')](_0x29b7cd[_0x400a('0x30')]['ids']);}})[_0x400a('0x21')](function(_0x390d46){if(_0x390d46){return db[_0x400a('0x57')]['destroy']({'where':{'ListId':_0x29b7cd['query'][_0x400a('0x65')],'CampaignId':_0x29b7cd[_0x400a('0x46')]['id']}})[_0x400a('0x21')](function(){return _0x390d46;});}})[_0x400a('0x21')](respondWithStatusCode(_0x2a596d,null))[_0x400a('0x44')](handleError(_0x2a596d,null));};exports[_0x400a('0x8a')]=function(_0x29ded9,_0x6ac4cf,_0x4def20){var _0x3ab504={};var _0x52a2e4={};var _0x1e6b75;var _0x175b20;return db[_0x400a('0x2b')][_0x400a('0x5b')]({'where':{'id':_0x29ded9[_0x400a('0x46')]['id']}})[_0x400a('0x21')](handleEntityNotFound(_0x6ac4cf,null))[_0x400a('0x21')](function(_0x3443ac){if(_0x3443ac){_0x1e6b75=_0x3443ac;_0x52a2e4[_0x400a('0x33')]=_[_0x400a('0x2f')](db[_0x400a('0x61')]['rawAttributes']);_0x52a2e4['query']=_[_0x400a('0x2f')](_0x29ded9['query']);_0x52a2e4[_0x400a('0x31')]=_[_0x400a('0x32')](_0x52a2e4[_0x400a('0x33')],_0x52a2e4[_0x400a('0x30')]);_0x3ab504[_0x400a('0x34')]=_[_0x400a('0x32')](_0x52a2e4['model'],qs[_0x400a('0x35')](_0x29ded9[_0x400a('0x30')][_0x400a('0x35')]));_0x3ab504[_0x400a('0x34')]=_0x3ab504[_0x400a('0x34')][_0x400a('0x36')]?_0x3ab504[_0x400a('0x34')]:_0x52a2e4[_0x400a('0x33')];_0x3ab504['order']=qs[_0x400a('0x58')](_0x29ded9[_0x400a('0x30')][_0x400a('0x58')]);_0x3ab504[_0x400a('0x3a')]=qs['filters'](_[_0x400a('0x59')](_0x29ded9[_0x400a('0x30')],_0x52a2e4['filters']));if(_0x29ded9[_0x400a('0x30')][_0x400a('0x3b')]){_0x3ab504[_0x400a('0x3a')]=_[_0x400a('0x3c')](_0x3ab504['where'],{'$or':_[_0x400a('0x2e')](_0x3ab504[_0x400a('0x34')],function(_0x20ae55){var _0x2368ee={};_0x2368ee[_0x20ae55]={'$like':'%'+_0x29ded9[_0x400a('0x30')][_0x400a('0x3b')]+'%'};return _0x2368ee;})});}_0x3ab504=_[_0x400a('0x3c')]({},_0x3ab504,_0x29ded9[_0x400a('0x3f')]);return _0x1e6b75[_0x400a('0x8a')](_0x3ab504);}})['then'](function(_0x50abfa){if(_0x50abfa){_0x175b20=_0x50abfa[_0x400a('0x36')];if(!_0x29ded9[_0x400a('0x30')][_0x400a('0x37')](_0x400a('0x38'))){_0x3ab504[_0x400a('0x1b')]=qs[_0x400a('0x1b')](_0x29ded9[_0x400a('0x30')][_0x400a('0x1b')]);_0x3ab504[_0x400a('0x19')]=qs[_0x400a('0x19')](_0x29ded9['query'][_0x400a('0x19')]);}return _0x1e6b75[_0x400a('0x8a')](_0x3ab504);}})[_0x400a('0x21')](function(_0x58f2cd){if(_0x58f2cd){return _0x58f2cd?{'count':_0x175b20,'rows':_0x58f2cd}:null;}})['then'](respondWithResult(_0x6ac4cf,null))[_0x400a('0x44')](handleError(_0x6ac4cf,null));};exports[_0x400a('0x8b')]=function(_0x595693,_0x389906,_0x408fbb){var _0x5ab519,_0x45aabc;var _0x462bf6=[];var _0x309645=moment()[_0x400a('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x400a('0x2b')][_0x400a('0x48')]({'where':{'id':_0x595693['params']['id']}})[_0x400a('0x21')](handleEntityNotFound(_0x389906,null))[_0x400a('0x21')](function(_0x342b79){if(_0x342b79){_0x45aabc=_0x342b79;return _0x342b79[_0x400a('0x8b')](_0x595693[_0x400a('0x4a')][_0x400a('0x65')],_[_0x400a('0x50')](_0x595693[_0x400a('0x4a')],['ids','id'])||{});}return null;})[_0x400a('0x66')](function(_0x36bc92){var _0x5eec6a;var _0x33aa8f;_0x5ab519=_0x36bc92||[];var _0x10ba2a=[];if(_0x36bc92){for(var _0x5b3c26=0x0;_0x5b3c26<_0x36bc92[_0x400a('0x36')];_0x5b3c26+=0x1){var _0x51c922=_0x36bc92[_0x5b3c26][_0x400a('0x22')]({'plain':!![]});_0x5eec6a=squel[_0x400a('0x8c')]()[_0x400a('0x7d')]('cm_hopper_black')['fromQuery']([_0x400a('0x6a'),_0x400a('0x6c'),_0x400a('0x6d'),_0x400a('0x5a'),_0x400a('0x51'),_0x400a('0x52')],squel[_0x400a('0x6e')]()[_0x400a('0x6f')]('phone',_0x400a('0x6a'))[_0x400a('0x6f')]('id',_0x400a('0x6c'))[_0x400a('0x6f')](_0x51c922[_0x400a('0x71')]['toString'](),'ListId')[_0x400a('0x6f')](_0x595693[_0x400a('0x46')]['id'][_0x400a('0x72')](),_0x400a('0x5a'))[_0x400a('0x6f')]('NOW()','createdAt')['field'](_0x400a('0x70'),_0x400a('0x52'))[_0x400a('0x73')]('cm_contacts')[_0x400a('0x3a')](_0x400a('0x74'))['where']('ListId\x20=\x20?',_0x51c922['CmListId'][_0x400a('0x72')]())[_0x400a('0x3a')](_0x400a('0x76')))['toString']();_0x10ba2a[_0x400a('0x86')](db['sequelize'][_0x400a('0x30')](_0x5eec6a));}return BPromise[_0x400a('0x88')](_0x10ba2a);}})[_0x400a('0x21')](function(){return _0x5ab519;})['then'](respondWithResult(_0x389906,null))[_0x400a('0x44')](handleError(_0x389906,null));};exports[_0x400a('0x8d')]=function(_0x12545b,_0x49dc79,_0x5b5106){return db['Campaign'][_0x400a('0x48')]({'where':{'id':_0x12545b[_0x400a('0x46')]['id']}})[_0x400a('0x21')](handleEntityNotFound(_0x49dc79,null))[_0x400a('0x21')](function(_0x3972b9){if(_0x3972b9){return _0x3972b9[_0x400a('0x8d')](_0x12545b[_0x400a('0x30')][_0x400a('0x65')]);}})[_0x400a('0x21')](function(_0x4d19a2){if(_0x4d19a2){return db['CmHopperBlack'][_0x400a('0x24')]({'where':{'ListId':_0x12545b[_0x400a('0x30')][_0x400a('0x65')],'CampaignId':_0x12545b['params']['id']}})['then'](function(){return _0x4d19a2;});}})[_0x400a('0x21')](respondWithStatusCode(_0x49dc79,null))['catch'](handleError(_0x49dc79,null));}; \ No newline at end of file +var _0x301e=['error','name','index','map','Campaign','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','autoAssociation','getHoppers','CmHopper','CampaignId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','select','field','NOW()','ContactId','CmListId','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','toString','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.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','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','IvrCampaigns','UserProfileResource'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x301e,0x6e));var _0xe301=function(_0x3c6df7,_0x538710){_0x3c6df7=_0x3c6df7-0x0;var _0x2d3584=_0x301e[_0x3c6df7];return _0x2d3584;};'use strict';var emlformat=require(_0xe301('0x0'));var rimraf=require(_0xe301('0x1'));var zipdir=require(_0xe301('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe301('0x3'));var moment=require(_0xe301('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe301('0x5'));var util=require(_0xe301('0x6'));var path=require(_0xe301('0x7'));var sox=require(_0xe301('0x8'));var csv=require(_0xe301('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe301('0xa'));var _=require(_0xe301('0xb'));var squel=require(_0xe301('0xc'));var crypto=require(_0xe301('0xd'));var jsforce=require(_0xe301('0xe'));var deskjs=require(_0xe301('0xf'));var toCsv=require(_0xe301('0x9'));var querystring=require(_0xe301('0x10'));var Papa=require(_0xe301('0x11'));var Redis=require(_0xe301('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe301('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe301('0x14'));var logger=require('../../config/logger')(_0xe301('0x15'));var utils=require(_0xe301('0x16'));var config=require(_0xe301('0x17'));var licenseUtil=require(_0xe301('0x18'));var db=require(_0xe301('0x19'))['db'];function respondWithStatusCode(_0x34c4c0,_0x9400ef){_0x9400ef=_0x9400ef||0xcc;return function(_0x5132d1){if(_0x5132d1){return _0x34c4c0[_0xe301('0x1a')](_0x9400ef);}return _0x34c4c0[_0xe301('0x1b')](_0x9400ef)[_0xe301('0x1c')]();};}function respondWithResult(_0xca2b87,_0x2aba8f){_0x2aba8f=_0x2aba8f||0xc8;return function(_0x17d7bf){if(_0x17d7bf){return _0xca2b87[_0xe301('0x1b')](_0x2aba8f)[_0xe301('0x1d')](_0x17d7bf);}};}function respondWithFilteredResult(_0x1f2017,_0x3a362a){return function(_0x4525c8){if(_0x4525c8){var _0x5e9a54=typeof _0x3a362a['offset']===_0xe301('0x1e')&&typeof _0x3a362a[_0xe301('0x1f')]==='undefined';var _0x4a65f3=_0x4525c8[_0xe301('0x20')];var _0x57b2cf=_0x5e9a54?0x0:_0x3a362a[_0xe301('0x21')];var _0x40673a=_0x5e9a54?_0x4525c8[_0xe301('0x20')]:_0x3a362a[_0xe301('0x21')]+_0x3a362a['limit'];var _0x38fbf8;if(_0x40673a>=_0x4a65f3){_0x40673a=_0x4a65f3;_0x38fbf8=0xc8;}else{_0x38fbf8=0xce;}_0x1f2017['status'](_0x38fbf8);return _0x1f2017[_0xe301('0x22')](_0xe301('0x23'),_0x57b2cf+'-'+_0x40673a+'/'+_0x4a65f3)[_0xe301('0x1d')](_0x4525c8);}return null;};}function patchUpdates(_0x549a71){return function(_0x576ebb){try{jsonpatch['apply'](_0x576ebb,_0x549a71,!![]);}catch(_0x1ed005){return BPromise['reject'](_0x1ed005);}return _0x576ebb[_0xe301('0x24')]();};}function saveUpdates(_0x3a97d2,_0x4a722a){return function(_0xd51582){if(_0xd51582){return _0xd51582[_0xe301('0x25')](_0x3a97d2)[_0xe301('0x26')](function(_0x70d8e){return _0x70d8e;});}return null;};}function removeEntity(_0x1f4957,_0xa8cf12){return function(_0x559fb0){if(_0x559fb0){return _0x559fb0[_0xe301('0x27')]()[_0xe301('0x26')](function(){var _0x215654=_0x559fb0['get']({'plain':!![]});var _0x195f1d=_0xe301('0x28');return db[_0xe301('0x29')][_0xe301('0x27')]({'where':{'type':_0x195f1d,'resourceId':_0x215654['id']}})[_0xe301('0x26')](function(){return _0x559fb0;});})[_0xe301('0x26')](function(){_0x1f4957['status'](0xcc)[_0xe301('0x1c')]();});}};}function handleEntityNotFound(_0x5a0625,_0x29a1a2){return function(_0x2214f8){if(!_0x2214f8){_0x5a0625[_0xe301('0x1a')](0x194);}return _0x2214f8;};}function handleError(_0xbcbd5,_0x31eec6){_0x31eec6=_0x31eec6||0x1f4;return function(_0x55dc45){logger[_0xe301('0x2a')](_0x55dc45['stack']);if(_0x55dc45[_0xe301('0x2b')]){delete _0x55dc45[_0xe301('0x2b')];}_0xbcbd5[_0xe301('0x1b')](_0x31eec6)['send'](_0x55dc45);};}exports[_0xe301('0x2c')]=function(_0x144548,_0x43ba1d){var _0x13fcd4={},_0x2ad878={},_0x380786={'count':0x0,'rows':[]};var _0x1b886d=_[_0xe301('0x2d')](db[_0xe301('0x2e')][_0xe301('0x2f')],function(_0x387378){return{'name':_0x387378['fieldName'],'type':_0x387378['type'][_0xe301('0x30')]};});_0x2ad878[_0xe301('0x31')]=_[_0xe301('0x2d')](_0x1b886d,_0xe301('0x2b'));_0x2ad878[_0xe301('0x32')]=_[_0xe301('0x33')](_0x144548['query']);_0x2ad878[_0xe301('0x34')]=_[_0xe301('0x35')](_0x2ad878[_0xe301('0x31')],_0x2ad878[_0xe301('0x32')]);_0x13fcd4[_0xe301('0x36')]=_['intersection'](_0x2ad878[_0xe301('0x31')],qs[_0xe301('0x37')](_0x144548['query'][_0xe301('0x37')]));_0x13fcd4[_0xe301('0x36')]=_0x13fcd4[_0xe301('0x36')][_0xe301('0x38')]?_0x13fcd4[_0xe301('0x36')]:_0x2ad878[_0xe301('0x31')];if(!_0x144548[_0xe301('0x32')][_0xe301('0x39')](_0xe301('0x3a'))){_0x13fcd4[_0xe301('0x1f')]=qs['limit'](_0x144548[_0xe301('0x32')][_0xe301('0x1f')]);_0x13fcd4[_0xe301('0x21')]=qs[_0xe301('0x21')](_0x144548['query'][_0xe301('0x21')]);}_0x13fcd4[_0xe301('0x3b')]=qs[_0xe301('0x3c')](_0x144548['query']['sort']);_0x13fcd4[_0xe301('0x3d')]=qs['filters'](_[_0xe301('0x3e')](_0x144548[_0xe301('0x32')],_0x2ad878[_0xe301('0x34')]),_0x1b886d);if(_0x144548[_0xe301('0x32')][_0xe301('0x3f')]){_0x13fcd4[_0xe301('0x3d')]=_[_0xe301('0x40')](_0x13fcd4['where'],{'$or':_[_0xe301('0x2d')](_0x1b886d,function(_0xb03a08){if(_0xb03a08[_0xe301('0x41')]!==_0xe301('0x42')){var _0x260f1b={};_0x260f1b[_0xb03a08[_0xe301('0x2b')]]={'$like':'%'+_0x144548['query'][_0xe301('0x3f')]+'%'};return _0x260f1b;}})});}_0x13fcd4=_[_0xe301('0x40')]({},_0x13fcd4,_0x144548[_0xe301('0x43')]);var _0x53eff2={'where':_0x13fcd4[_0xe301('0x3d')]};return db['Campaign'][_0xe301('0x20')](_0x53eff2)[_0xe301('0x26')](function(_0x458d81){_0x380786[_0xe301('0x20')]=_0x458d81;if(_0x144548[_0xe301('0x32')][_0xe301('0x44')]){_0x13fcd4[_0xe301('0x45')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x13fcd4);})[_0xe301('0x26')](function(_0x4bda55){_0x380786['rows']=_0x4bda55;return _0x380786;})['then'](respondWithFilteredResult(_0x43ba1d,_0x13fcd4))[_0xe301('0x46')](handleError(_0x43ba1d,null));};exports[_0xe301('0x47')]=function(_0x21a7b2,_0x43f570){var _0x1ea516={'raw':![],'where':{'id':_0x21a7b2[_0xe301('0x48')]['id']}},_0x311c4e={};_0x311c4e[_0xe301('0x31')]=_['keys'](db['Campaign'][_0xe301('0x2f')]);_0x311c4e[_0xe301('0x32')]=_[_0xe301('0x33')](_0x21a7b2['query']);_0x311c4e[_0xe301('0x34')]=_['intersection'](_0x311c4e['model'],_0x311c4e[_0xe301('0x32')]);_0x1ea516[_0xe301('0x36')]=_[_0xe301('0x35')](_0x311c4e[_0xe301('0x31')],qs[_0xe301('0x37')](_0x21a7b2['query'][_0xe301('0x37')]));_0x1ea516['attributes']=_0x1ea516[_0xe301('0x36')][_0xe301('0x38')]?_0x1ea516[_0xe301('0x36')]:_0x311c4e['model'];if(_0x21a7b2['query']['includeAll']){_0x1ea516[_0xe301('0x45')]=[{'all':!![]}];}_0x1ea516=_[_0xe301('0x40')]({},_0x1ea516,_0x21a7b2[_0xe301('0x43')]);return db['Campaign'][_0xe301('0x49')](_0x1ea516)[_0xe301('0x26')](handleEntityNotFound(_0x43f570,null))[_0xe301('0x26')](respondWithResult(_0x43f570,null))[_0xe301('0x46')](handleError(_0x43f570,null));};exports['create']=function(_0x5101a3,_0x3ae24c){return db['Campaign'][_0xe301('0x4a')](_0x5101a3[_0xe301('0x4b')],{})[_0xe301('0x26')](function(_0x6e46ba){var _0x525ebf=_0x5101a3[_0xe301('0x4c')][_0xe301('0x4d')]({'plain':!![]});if(!_0x525ebf)throw new Error(_0xe301('0x4e'));if(_0x525ebf[_0xe301('0x4f')]===_0xe301('0x4c')){var _0x4ec53a=_0x6e46ba[_0xe301('0x4d')]({'plain':!![]});var _0x14b006='IvrCampaigns';return db[_0xe301('0x50')][_0xe301('0x49')]({'where':{'name':_0x14b006,'userProfileId':_0x525ebf[_0xe301('0x51')]},'raw':!![]})[_0xe301('0x26')](function(_0x9a81c1){if(_0x9a81c1&&_0x9a81c1['autoAssociation']===0x0){return db[_0xe301('0x29')][_0xe301('0x4a')]({'name':_0x4ec53a[_0xe301('0x2b')],'resourceId':_0x4ec53a['id'],'type':_0x9a81c1[_0xe301('0x2b')],'sectionId':_0x9a81c1['id']},{})[_0xe301('0x26')](function(){return _0x6e46ba;});}else{return _0x6e46ba;}})[_0xe301('0x46')](function(_0x326eea){logger['error'](_0xe301('0x52'),_0x326eea);throw _0x326eea;});}return _0x6e46ba;})[_0xe301('0x26')](respondWithResult(_0x3ae24c,0xc9))[_0xe301('0x46')](handleError(_0x3ae24c,null));};exports[_0xe301('0x53')]=function(_0x485015,_0x375f34){var _0x5eabac={'where':{'id':_0x485015[_0xe301('0x48')]['id']}},_0x3ea172={};_0x3ea172[_0xe301('0x31')]=_[_0xe301('0x33')](db[_0xe301('0x2e')]['rawAttributes']);_0x5eabac[_0xe301('0x36')]=_[_0xe301('0x35')](_0x3ea172['model'],qs[_0xe301('0x37')](_0x485015['query']['fields']));_0x5eabac[_0xe301('0x36')]=_0x5eabac['attributes']['length']?_0x5eabac['attributes']:_0x3ea172['model'];if(_0x485015[_0xe301('0x32')][_0xe301('0x44')]){_0x5eabac[_0xe301('0x45')]=[{'all':!![]}];}_0x5eabac=_[_0xe301('0x40')]({},_0x5eabac,_0x485015['options']);return db['Campaign'][_0xe301('0x49')](_0x5eabac)[_0xe301('0x26')](handleEntityNotFound(_0x375f34,null))[_0xe301('0x26')](function(_0x5aa494){if(_0x5aa494){var _0x4dba2c=_0x5aa494[_0xe301('0x4d')]({'plain':!![]});_0x4dba2c=qs[_0xe301('0x54')](_0x4dba2c,['id','createdAt',_0xe301('0x55')]);_0x485015[_0xe301('0x4b')]=_['omit'](_0x485015['body'],['id',_0xe301('0x56'),_0xe301('0x55')]);return db['Campaign'][_0xe301('0x4a')](_[_0xe301('0x40')](_0x4dba2c,_0x485015[_0xe301('0x4b')]),{'include':_0x485015['query'][_0xe301('0x44')]?[{'all':!![]}]:undefined})[_0xe301('0x26')](function(_0x9a3600){var _0x3050d7=_0x485015[_0xe301('0x4c')][_0xe301('0x4d')]({'plain':!![]});if(!_0x3050d7)throw new Error(_0xe301('0x4e'));if(_0x3050d7[_0xe301('0x4f')]==='user'){var _0x5cdd9a=_0x9a3600[_0xe301('0x4d')]({'plain':!![]});var _0x4d365f=_0xe301('0x28');return db[_0xe301('0x50')][_0xe301('0x49')]({'where':{'name':_0x4d365f,'userProfileId':_0x3050d7[_0xe301('0x51')]},'raw':!![]})[_0xe301('0x26')](function(_0x45ff14){if(_0x45ff14&&_0x45ff14[_0xe301('0x57')]===0x0){return db[_0xe301('0x29')][_0xe301('0x4a')]({'name':_0x5cdd9a[_0xe301('0x2b')],'resourceId':_0x5cdd9a['id'],'type':_0x45ff14['name'],'sectionId':_0x45ff14['id']},{})[_0xe301('0x26')](function(){return _0x9a3600;});}else{return _0x9a3600;}})[_0xe301('0x46')](function(_0x536367){logger['error'](_0xe301('0x52'),_0x536367);throw _0x536367;});}return _0x9a3600;});}})['then'](respondWithResult(_0x375f34,0xc9))[_0xe301('0x46')](handleError(_0x375f34,null));};exports[_0xe301('0x25')]=function(_0xfa6a10,_0x471ae8){if(_0xfa6a10[_0xe301('0x4b')]['id']){delete _0xfa6a10[_0xe301('0x4b')]['id'];}return db[_0xe301('0x2e')]['find']({'where':{'id':_0xfa6a10[_0xe301('0x48')]['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x471ae8,null))['then'](saveUpdates(_0xfa6a10[_0xe301('0x4b')],null))[_0xe301('0x26')](respondWithResult(_0x471ae8,null))['catch'](handleError(_0x471ae8,null));};exports[_0xe301('0x27')]=function(_0x51fab4,_0x4a96cb){return db['Campaign'][_0xe301('0x49')]({'where':{'id':_0x51fab4[_0xe301('0x48')]['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x4a96cb,null))[_0xe301('0x26')](removeEntity(_0x4a96cb,null))[_0xe301('0x46')](handleError(_0x4a96cb,null));};exports[_0xe301('0x58')]=function(_0x74ea35,_0x1e1719,_0x3a5a1a){var _0x4cb2b5={'raw':!![],'where':{}};var _0x199a53={};var _0x3ab901={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x74ea35['params']['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x1e1719,null))[_0xe301('0x26')](function(_0x3b3fe8){if(_0x3b3fe8){_0x199a53[_0xe301('0x31')]=_[_0xe301('0x33')](db[_0xe301('0x59')][_0xe301('0x2f')]);_0x199a53[_0xe301('0x32')]=_[_0xe301('0x33')](_0x74ea35[_0xe301('0x32')]);_0x199a53[_0xe301('0x34')]=_[_0xe301('0x35')](_0x199a53[_0xe301('0x31')],_0x199a53[_0xe301('0x32')]);_0x4cb2b5['attributes']=_[_0xe301('0x35')](_0x199a53[_0xe301('0x31')],qs['fields'](_0x74ea35[_0xe301('0x32')]['fields']));_0x4cb2b5[_0xe301('0x36')]=_0x4cb2b5['attributes'][_0xe301('0x38')]?_0x4cb2b5[_0xe301('0x36')]:_0x199a53['model'];if(!_0x74ea35['query'][_0xe301('0x39')](_0xe301('0x3a'))){_0x4cb2b5[_0xe301('0x1f')]=qs[_0xe301('0x1f')](_0x74ea35[_0xe301('0x32')]['limit']);_0x4cb2b5['offset']=qs[_0xe301('0x21')](_0x74ea35[_0xe301('0x32')]['offset']);}_0x4cb2b5['order']=qs[_0xe301('0x3c')](_0x74ea35[_0xe301('0x32')][_0xe301('0x3c')]);_0x4cb2b5[_0xe301('0x3d')]=qs[_0xe301('0x34')](_[_0xe301('0x3e')](_0x74ea35[_0xe301('0x32')],_0x199a53[_0xe301('0x34')]));_0x4cb2b5['where'][_0xe301('0x5a')]=_0x3b3fe8['id'];if(_0x74ea35[_0xe301('0x32')][_0xe301('0x3f')]){_0x4cb2b5['where']=_[_0xe301('0x40')](_0x4cb2b5[_0xe301('0x3d')],{'$or':_[_0xe301('0x2d')](_0x4cb2b5[_0xe301('0x36')],function(_0x36b09b){var _0x1e663f={};_0x1e663f[_0x36b09b]={'$like':'%'+_0x74ea35[_0xe301('0x32')][_0xe301('0x3f')]+'%'};return _0x1e663f;})});}_0x4cb2b5=_['merge']({},_0x4cb2b5,_0x74ea35['options']);return db[_0xe301('0x59')][_0xe301('0x20')]({'where':_0x4cb2b5[_0xe301('0x3d')]})[_0xe301('0x26')](function(_0xb9f930){_0x3ab901[_0xe301('0x20')]=_0xb9f930;if(_0x74ea35[_0xe301('0x32')][_0xe301('0x44')]){_0x4cb2b5['include']=[{'all':!![]}];}return db[_0xe301('0x59')][_0xe301('0x5b')](_0x4cb2b5);})[_0xe301('0x26')](function(_0x278e2b){_0x3ab901[_0xe301('0x5c')]=_0x278e2b;return _0x3ab901;});}})[_0xe301('0x26')](respondWithFilteredResult(_0x1e1719,_0x4cb2b5))[_0xe301('0x46')](handleError(_0x1e1719,null));};exports[_0xe301('0x5d')]=function(_0x452a63,_0x2799e8,_0xe09cef){var _0x31a79d={'raw':!![],'where':{}};var _0x40777b={};var _0x4364fe={'count':0x0,'rows':[]};return db[_0xe301('0x2e')][_0xe301('0x5e')]({'where':{'id':_0x452a63['params']['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x2799e8,null))['then'](function(_0x29406d){if(_0x29406d){_0x40777b[_0xe301('0x31')]=_[_0xe301('0x33')](db[_0xe301('0x5f')]['rawAttributes']);_0x40777b[_0xe301('0x32')]=_['keys'](_0x452a63['query']);_0x40777b[_0xe301('0x34')]=_['intersection'](_0x40777b['model'],_0x40777b[_0xe301('0x32')]);_0x31a79d['attributes']=_[_0xe301('0x35')](_0x40777b[_0xe301('0x31')],qs[_0xe301('0x37')](_0x452a63[_0xe301('0x32')][_0xe301('0x37')]));_0x31a79d['attributes']=_0x31a79d['attributes'][_0xe301('0x38')]?_0x31a79d['attributes']:_0x40777b[_0xe301('0x31')];if(!_0x452a63['query'][_0xe301('0x39')]('nolimit')){_0x31a79d['limit']=qs[_0xe301('0x1f')](_0x452a63[_0xe301('0x32')]['limit']);_0x31a79d[_0xe301('0x21')]=qs[_0xe301('0x21')](_0x452a63['query'][_0xe301('0x21')]);}_0x31a79d[_0xe301('0x3b')]=qs[_0xe301('0x3c')](_0x452a63['query'][_0xe301('0x3c')]);_0x31a79d[_0xe301('0x3d')]=qs[_0xe301('0x34')](_['pick'](_0x452a63[_0xe301('0x32')],_0x40777b['filters']));_0x31a79d[_0xe301('0x3d')]['CampaignId']=_0x29406d['id'];if(_0x452a63[_0xe301('0x32')][_0xe301('0x3f')]){_0x31a79d['where']=_[_0xe301('0x40')](_0x31a79d[_0xe301('0x3d')],{'$or':_[_0xe301('0x2d')](_0x31a79d[_0xe301('0x36')],function(_0x2d8a5){var _0x5d1342={};_0x5d1342[_0x2d8a5]={'$like':'%'+_0x452a63[_0xe301('0x32')]['filter']+'%'};return _0x5d1342;})});}_0x31a79d=_[_0xe301('0x40')]({},_0x31a79d,_0x452a63[_0xe301('0x43')]);return db[_0xe301('0x5f')][_0xe301('0x20')]({'where':_0x31a79d['where']})[_0xe301('0x26')](function(_0x27bb65){_0x4364fe[_0xe301('0x20')]=_0x27bb65;if(_0x452a63[_0xe301('0x32')][_0xe301('0x44')]){_0x31a79d['include']=[{'all':!![]}];}return db[_0xe301('0x5f')][_0xe301('0x5b')](_0x31a79d);})[_0xe301('0x26')](function(_0x594422){_0x4364fe[_0xe301('0x5c')]=_0x594422;return _0x4364fe;});}})[_0xe301('0x26')](respondWithFilteredResult(_0x2799e8,_0x31a79d))[_0xe301('0x46')](handleError(_0x2799e8,null));};exports[_0xe301('0x60')]=function(_0x13d15c,_0x60c389,_0x2b22e8){var _0x25f2b4={'raw':!![],'where':{}};var _0x315b92={};var _0x413865={'count':0x0,'rows':[]};return db[_0xe301('0x2e')][_0xe301('0x5e')]({'where':{'id':_0x13d15c[_0xe301('0x48')]['id']}})['then'](handleEntityNotFound(_0x60c389,null))[_0xe301('0x26')](function(_0x43d7ae){if(_0x43d7ae){_0x315b92[_0xe301('0x31')]=_[_0xe301('0x33')](db[_0xe301('0x61')]['rawAttributes']);_0x315b92['query']=_[_0xe301('0x33')](_0x13d15c[_0xe301('0x32')]);_0x315b92[_0xe301('0x34')]=_[_0xe301('0x35')](_0x315b92[_0xe301('0x31')],_0x315b92[_0xe301('0x32')]);_0x25f2b4[_0xe301('0x36')]=_[_0xe301('0x35')](_0x315b92['model'],qs[_0xe301('0x37')](_0x13d15c[_0xe301('0x32')][_0xe301('0x37')]));_0x25f2b4['attributes']=_0x25f2b4['attributes'][_0xe301('0x38')]?_0x25f2b4[_0xe301('0x36')]:_0x315b92['model'];if(!_0x13d15c['query']['hasOwnProperty'](_0xe301('0x3a'))){_0x25f2b4[_0xe301('0x1f')]=qs[_0xe301('0x1f')](_0x13d15c[_0xe301('0x32')][_0xe301('0x1f')]);_0x25f2b4[_0xe301('0x21')]=qs[_0xe301('0x21')](_0x13d15c[_0xe301('0x32')][_0xe301('0x21')]);}_0x25f2b4[_0xe301('0x3b')]=qs[_0xe301('0x3c')](_0x13d15c[_0xe301('0x32')]['sort']);_0x25f2b4[_0xe301('0x3d')]=qs[_0xe301('0x34')](_[_0xe301('0x3e')](_0x13d15c[_0xe301('0x32')],_0x315b92[_0xe301('0x34')]));_0x25f2b4[_0xe301('0x3d')][_0xe301('0x5a')]=_0x43d7ae['id'];if(_0x13d15c['query']['filter']){_0x25f2b4[_0xe301('0x3d')]=_['merge'](_0x25f2b4[_0xe301('0x3d')],{'$or':_[_0xe301('0x2d')](_0x25f2b4[_0xe301('0x36')],function(_0x5fe076){var _0x11b481={};_0x11b481[_0x5fe076]={'$like':'%'+_0x13d15c[_0xe301('0x32')]['filter']+'%'};return _0x11b481;})});}_0x25f2b4=_['merge']({},_0x25f2b4,_0x13d15c[_0xe301('0x43')]);return db['CmHopperFinal'][_0xe301('0x20')]({'where':_0x25f2b4[_0xe301('0x3d')]})[_0xe301('0x26')](function(_0xd5d948){_0x413865[_0xe301('0x20')]=_0xd5d948;if(_0x13d15c[_0xe301('0x32')][_0xe301('0x44')]){_0x25f2b4[_0xe301('0x45')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x25f2b4);})[_0xe301('0x26')](function(_0x568008){_0x413865[_0xe301('0x5c')]=_0x568008;return _0x413865;});}})['then'](respondWithFilteredResult(_0x60c389,_0x25f2b4))[_0xe301('0x46')](handleError(_0x60c389,null));};exports[_0xe301('0x62')]=function(_0x24f75c,_0x1a0e4b,_0x21d73a){var _0x507460={'raw':!![],'where':{}};var _0x3a09b9={};var _0x5ccebc={'count':0x0,'rows':[]};return db[_0xe301('0x2e')][_0xe301('0x5e')]({'where':{'id':_0x24f75c[_0xe301('0x48')]['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x1a0e4b,null))[_0xe301('0x26')](function(_0x493795){if(_0x493795){_0x3a09b9[_0xe301('0x31')]=_['keys'](db[_0xe301('0x63')][_0xe301('0x2f')]);_0x3a09b9[_0xe301('0x32')]=_[_0xe301('0x33')](_0x24f75c['query']);_0x3a09b9['filters']=_['intersection'](_0x3a09b9[_0xe301('0x31')],_0x3a09b9[_0xe301('0x32')]);_0x507460[_0xe301('0x36')]=_['intersection'](_0x3a09b9[_0xe301('0x31')],qs[_0xe301('0x37')](_0x24f75c[_0xe301('0x32')]['fields']));_0x507460['attributes']=_0x507460[_0xe301('0x36')][_0xe301('0x38')]?_0x507460[_0xe301('0x36')]:_0x3a09b9['model'];if(!_0x24f75c[_0xe301('0x32')][_0xe301('0x39')](_0xe301('0x3a'))){_0x507460['limit']=qs[_0xe301('0x1f')](_0x24f75c[_0xe301('0x32')][_0xe301('0x1f')]);_0x507460[_0xe301('0x21')]=qs[_0xe301('0x21')](_0x24f75c[_0xe301('0x32')]['offset']);}_0x507460[_0xe301('0x3b')]=qs[_0xe301('0x3c')](_0x24f75c[_0xe301('0x32')][_0xe301('0x3c')]);_0x507460[_0xe301('0x3d')]=qs['filters'](_['pick'](_0x24f75c['query'],_0x3a09b9[_0xe301('0x34')]));_0x507460[_0xe301('0x3d')][_0xe301('0x5a')]=_0x493795['id'];if(_0x24f75c['query']['filter']){_0x507460[_0xe301('0x3d')]=_[_0xe301('0x40')](_0x507460[_0xe301('0x3d')],{'$or':_[_0xe301('0x2d')](_0x507460[_0xe301('0x36')],function(_0x1a163f){var _0x5219fd={};_0x5219fd[_0x1a163f]={'$like':'%'+_0x24f75c[_0xe301('0x32')][_0xe301('0x3f')]+'%'};return _0x5219fd;})});}_0x507460=_[_0xe301('0x40')]({},_0x507460,_0x24f75c[_0xe301('0x43')]);return db['CmHopperBlack']['count']({'where':_0x507460[_0xe301('0x3d')]})[_0xe301('0x26')](function(_0x5686d0){_0x5ccebc[_0xe301('0x20')]=_0x5686d0;if(_0x24f75c['query'][_0xe301('0x44')]){_0x507460[_0xe301('0x45')]=[{'all':!![]}];}return db[_0xe301('0x63')][_0xe301('0x5b')](_0x507460);})[_0xe301('0x26')](function(_0x10cae9){_0x5ccebc[_0xe301('0x5c')]=_0x10cae9;return _0x5ccebc;});}})['then'](respondWithFilteredResult(_0x1a0e4b,_0x507460))[_0xe301('0x46')](handleError(_0x1a0e4b,null));};exports[_0xe301('0x64')]=function(_0x8622ae,_0x405bcb,_0x5de860){var _0x16af45={};var _0x1872b2={};var _0xa45a35;var _0x56437c;return db[_0xe301('0x2e')]['findOne']({'where':{'id':_0x8622ae['params']['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x405bcb,null))[_0xe301('0x26')](function(_0x17b31d){if(_0x17b31d){_0xa45a35=_0x17b31d;_0x1872b2['model']=_[_0xe301('0x33')](db[_0xe301('0x65')][_0xe301('0x2f')]);_0x1872b2['query']=_[_0xe301('0x33')](_0x8622ae[_0xe301('0x32')]);_0x1872b2[_0xe301('0x34')]=_[_0xe301('0x35')](_0x1872b2[_0xe301('0x31')],_0x1872b2[_0xe301('0x32')]);_0x16af45['attributes']=_[_0xe301('0x35')](_0x1872b2['model'],qs[_0xe301('0x37')](_0x8622ae['query']['fields']));_0x16af45['attributes']=_0x16af45[_0xe301('0x36')]['length']?_0x16af45[_0xe301('0x36')]:_0x1872b2['model'];_0x16af45[_0xe301('0x3b')]=qs[_0xe301('0x3c')](_0x8622ae[_0xe301('0x32')][_0xe301('0x3c')]);_0x16af45[_0xe301('0x3d')]=qs[_0xe301('0x34')](_[_0xe301('0x3e')](_0x8622ae[_0xe301('0x32')],_0x1872b2['filters']));if(_0x8622ae[_0xe301('0x32')][_0xe301('0x3f')]){_0x16af45['where']=_['merge'](_0x16af45['where'],{'$or':_[_0xe301('0x2d')](_0x16af45[_0xe301('0x36')],function(_0x550445){var _0x4de898={};_0x4de898[_0x550445]={'$like':'%'+_0x8622ae['query'][_0xe301('0x3f')]+'%'};return _0x4de898;})});}_0x16af45=_[_0xe301('0x40')]({},_0x16af45,_0x8622ae[_0xe301('0x43')]);return _0xa45a35['getLists'](_0x16af45);}})[_0xe301('0x26')](function(_0x518cd4){if(_0x518cd4){_0x56437c=_0x518cd4[_0xe301('0x38')];if(!_0x8622ae[_0xe301('0x32')][_0xe301('0x39')](_0xe301('0x3a'))){_0x16af45[_0xe301('0x1f')]=qs['limit'](_0x8622ae[_0xe301('0x32')]['limit']);_0x16af45[_0xe301('0x21')]=qs[_0xe301('0x21')](_0x8622ae[_0xe301('0x32')][_0xe301('0x21')]);}return _0xa45a35[_0xe301('0x64')](_0x16af45);}})['then'](function(_0x331b39){if(_0x331b39){return _0x331b39?{'count':_0x56437c,'rows':_0x331b39}:null;}})['then'](respondWithResult(_0x405bcb,null))[_0xe301('0x46')](handleError(_0x405bcb,null));};exports[_0xe301('0x66')]=function(_0x1c35b6,_0x12f79b,_0x1316f0){var _0x2fcdd9,_0x3a7458;var _0x17f00e=[];var _0x1cfdfa=moment()['format'](_0xe301('0x67'));return db[_0xe301('0x2e')][_0xe301('0x49')]({'where':{'id':_0x1c35b6[_0xe301('0x48')]['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x12f79b,null))['then'](function(_0x18f135){if(_0x18f135){_0x3a7458=_0x18f135;return _0x18f135['addLists'](_0x1c35b6[_0xe301('0x4b')]['ids'],_[_0xe301('0x54')](_0x1c35b6[_0xe301('0x4b')],[_0xe301('0x68'),'id'])||{});}return null;})[_0xe301('0x69')](function(_0xd7a2f7){var _0x150ef2;var _0x36d52a;_0x2fcdd9=_0xd7a2f7||[];var _0xecc418=[];if(_0xd7a2f7){for(var _0x3ef2fb=0x0;_0x3ef2fb<_0xd7a2f7[_0xe301('0x38')];_0x3ef2fb+=0x1){var _0x41996c=_0xd7a2f7[_0x3ef2fb][_0xe301('0x4d')]({'plain':!![]});_0x3a7458['dialCheckDuplicateType']=_0x1c35b6[_0xe301('0x4b')][_0xe301('0x6a')]?_0x1c35b6['body'][_0xe301('0x6a')]:_0x3a7458[_0xe301('0x6a')];switch(_0x3a7458[_0xe301('0x6a')]){case _0xe301('0x6b'):_0x150ef2=squel[_0xe301('0x6c')]()[_0xe301('0x6d')](_0xe301('0x6e'))[_0xe301('0x6f')]([_0xe301('0x70'),_0xe301('0x71'),'ContactId','ListId',_0xe301('0x5a'),'createdAt',_0xe301('0x55')],squel[_0xe301('0x72')]()['field'](_0xe301('0x70'),_0xe301('0x70'))[_0xe301('0x73')](_0xe301('0x74'),'scheduledAt')[_0xe301('0x73')]('id',_0xe301('0x75'))[_0xe301('0x73')](_0x41996c[_0xe301('0x76')]['toString'](),_0xe301('0x77'))[_0xe301('0x73')](_0x1c35b6[_0xe301('0x48')]['id']['toString'](),_0xe301('0x5a'))[_0xe301('0x73')]('\x27'+_0x1cfdfa+'\x27',_0xe301('0x56'))['field']('\x27'+_0x1cfdfa+'\x27',_0xe301('0x55'))[_0xe301('0x78')](_0xe301('0x79'))[_0xe301('0x3d')](_0xe301('0x7a'))[_0xe301('0x3d')]('ListId\x20=\x20?',_0x41996c[_0xe301('0x76')]['toString']())[_0xe301('0x3d')](_0xe301('0x7b'))[_0xe301('0x3d')](_0xe301('0x7c'),squel['select']()[_0xe301('0x73')](_0xe301('0x7d'))[_0xe301('0x78')](_0xe301('0x7e'))[_0xe301('0x3d')](_0xe301('0x7f'),_0x1c35b6['params']['id'][_0xe301('0x80')]()))['where'](_0xe301('0x7c'),squel[_0xe301('0x72')]()[_0xe301('0x73')](_0xe301('0x81'))[_0xe301('0x78')](_0xe301('0x6e'))['where'](_0xe301('0x7f'),_0x1c35b6[_0xe301('0x48')]['id']['toString']())))[_0xe301('0x80')]();break;case'onlyIfOpen':_0x150ef2=squel[_0xe301('0x6c')]()['into'](_0xe301('0x6e'))[_0xe301('0x6f')](['phone',_0xe301('0x71'),_0xe301('0x75'),'ListId','CampaignId','createdAt',_0xe301('0x55')],squel['select']()[_0xe301('0x73')]('phone','phone')[_0xe301('0x73')]('NOW()',_0xe301('0x71'))[_0xe301('0x73')]('id',_0xe301('0x75'))['field'](_0x41996c[_0xe301('0x76')]['toString'](),_0xe301('0x77'))[_0xe301('0x73')](_0x1c35b6[_0xe301('0x48')]['id'][_0xe301('0x80')](),_0xe301('0x5a'))[_0xe301('0x73')]('\x27'+_0x1cfdfa+'\x27','createdAt')[_0xe301('0x73')]('\x27'+_0x1cfdfa+'\x27','updatedAt')['from'](_0xe301('0x79'))[_0xe301('0x3d')](_0xe301('0x7a'))['where'](_0xe301('0x82'),_0x41996c[_0xe301('0x76')]['toString']())[_0xe301('0x3d')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xe301('0x7c'),squel['select']()['field'](_0xe301('0x81'))[_0xe301('0x78')]('cm_hopper')[_0xe301('0x3d')](_0xe301('0x7f'),_0x1c35b6[_0xe301('0x48')]['id'][_0xe301('0x80')]())))[_0xe301('0x80')]();break;default:_0x150ef2=squel[_0xe301('0x6c')]()[_0xe301('0x6d')]('cm_hopper')['fromQuery'](['phone',_0xe301('0x71'),_0xe301('0x75'),_0xe301('0x77'),_0xe301('0x5a'),_0xe301('0x56'),_0xe301('0x55')],squel[_0xe301('0x72')]()[_0xe301('0x73')](_0xe301('0x70'),_0xe301('0x70'))[_0xe301('0x73')](_0xe301('0x74'),'scheduledAt')['field']('id','ContactId')[_0xe301('0x73')](_0x41996c[_0xe301('0x76')]['toString'](),_0xe301('0x77'))[_0xe301('0x73')](_0x1c35b6['params']['id'][_0xe301('0x80')](),_0xe301('0x5a'))['field']('\x27'+_0x1cfdfa+'\x27',_0xe301('0x56'))[_0xe301('0x73')]('\x27'+_0x1cfdfa+'\x27','updatedAt')[_0xe301('0x78')]('cm_contacts')[_0xe301('0x3d')](_0xe301('0x7a'))[_0xe301('0x3d')](_0xe301('0x82'),_0x41996c['CmListId'][_0xe301('0x80')]())['where'](_0xe301('0x7b')))['toString']();}_0x36d52a=squel[_0xe301('0x6c')]()[_0xe301('0x6d')](_0xe301('0x83'))['fromQuery']([_0xe301('0x84'),_0xe301('0x71'),_0xe301('0x70'),_0xe301('0x85'),_0xe301('0x56'),_0xe301('0x55')],squel[_0xe301('0x72')]()[_0xe301('0x73')](_0xe301('0x86'),'id')[_0xe301('0x73')](_0xe301('0x74'),'scheduledAt')['field'](_0xe301('0x87'),_0xe301('0x70'))['field'](_0xe301('0x88'),'OrderBy')[_0xe301('0x73')]('\x27'+_0x1cfdfa+'\x27',_0xe301('0x56'))['field']('\x27'+_0x1cfdfa+'\x27',_0xe301('0x55'))[_0xe301('0x78')](_0xe301('0x89'),'ci')[_0xe301('0x8a')](_0xe301('0x6e'),'h',_0xe301('0x8b'))[_0xe301('0x3d')](_0xe301('0x8c'),_0x41996c[_0xe301('0x76')][_0xe301('0x80')]())[_0xe301('0x3d')](_0xe301('0x8d'),_0x1c35b6[_0xe301('0x48')]['id'][_0xe301('0x80')]())[_0xe301('0x3d')](_0xe301('0x8e'),_0x1cfdfa))[_0xe301('0x80')]();_0xecc418[_0xe301('0x8f')](db[_0xe301('0x90')][_0xe301('0x32')](_0x150ef2));_0x17f00e[_0xe301('0x8f')](db[_0xe301('0x90')]['query'](_0x36d52a));}return BPromise['all'](_0xecc418);}})[_0xe301('0x26')](function(){return BPromise[_0xe301('0x91')](_0x17f00e);})['then'](function(){return _0x2fcdd9;})['then'](respondWithResult(_0x12f79b,null))[_0xe301('0x46')](handleError(_0x12f79b,null));};exports[_0xe301('0x92')]=function(_0x1d05af,_0x4a3de4,_0x584f0b){return db[_0xe301('0x2e')]['find']({'where':{'id':_0x1d05af['params']['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x4a3de4,null))[_0xe301('0x26')](function(_0x2f3e08){if(_0x2f3e08){return _0x2f3e08['removeLists'](_0x1d05af['query'][_0xe301('0x68')]);}})[_0xe301('0x26')](function(_0x27acc5){if(_0x27acc5){return db['CmHopper']['destroy']({'where':{'ListId':_0x1d05af[_0xe301('0x32')][_0xe301('0x68')],'CampaignId':_0x1d05af[_0xe301('0x48')]['id']}})[_0xe301('0x26')](function(){return _0x27acc5;});}})['then'](respondWithStatusCode(_0x4a3de4,null))[_0xe301('0x46')](handleError(_0x4a3de4,null));};exports[_0xe301('0x93')]=function(_0x56d660,_0x27e423,_0x504938){var _0x516914={};var _0xfa470a={};var _0xa1e70b;var _0x25816c;return db[_0xe301('0x2e')][_0xe301('0x5e')]({'where':{'id':_0x56d660['params']['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x27e423,null))['then'](function(_0xce54af){if(_0xce54af){_0xa1e70b=_0xce54af;_0xfa470a[_0xe301('0x31')]=_['keys'](db[_0xe301('0x65')][_0xe301('0x2f')]);_0xfa470a[_0xe301('0x32')]=_[_0xe301('0x33')](_0x56d660[_0xe301('0x32')]);_0xfa470a[_0xe301('0x34')]=_[_0xe301('0x35')](_0xfa470a[_0xe301('0x31')],_0xfa470a[_0xe301('0x32')]);_0x516914[_0xe301('0x36')]=_['intersection'](_0xfa470a[_0xe301('0x31')],qs[_0xe301('0x37')](_0x56d660[_0xe301('0x32')][_0xe301('0x37')]));_0x516914[_0xe301('0x36')]=_0x516914[_0xe301('0x36')]['length']?_0x516914[_0xe301('0x36')]:_0xfa470a[_0xe301('0x31')];_0x516914['order']=qs[_0xe301('0x3c')](_0x56d660[_0xe301('0x32')]['sort']);_0x516914['where']=qs[_0xe301('0x34')](_[_0xe301('0x3e')](_0x56d660[_0xe301('0x32')],_0xfa470a[_0xe301('0x34')]));if(_0x56d660[_0xe301('0x32')][_0xe301('0x3f')]){_0x516914[_0xe301('0x3d')]=_[_0xe301('0x40')](_0x516914[_0xe301('0x3d')],{'$or':_['map'](_0x516914[_0xe301('0x36')],function(_0x2f408c){var _0x288397={};_0x288397[_0x2f408c]={'$like':'%'+_0x56d660['query'][_0xe301('0x3f')]+'%'};return _0x288397;})});}_0x516914=_['merge']({},_0x516914,_0x56d660[_0xe301('0x43')]);return _0xa1e70b['getBlackLists'](_0x516914);}})[_0xe301('0x26')](function(_0x2b7bcb){if(_0x2b7bcb){_0x25816c=_0x2b7bcb[_0xe301('0x38')];if(!_0x56d660[_0xe301('0x32')][_0xe301('0x39')]('nolimit')){_0x516914[_0xe301('0x1f')]=qs[_0xe301('0x1f')](_0x56d660[_0xe301('0x32')]['limit']);_0x516914['offset']=qs['offset'](_0x56d660['query'][_0xe301('0x21')]);}return _0xa1e70b[_0xe301('0x93')](_0x516914);}})['then'](function(_0x1ec2ec){if(_0x1ec2ec){return _0x1ec2ec?{'count':_0x25816c,'rows':_0x1ec2ec}:null;}})[_0xe301('0x26')](respondWithResult(_0x27e423,null))[_0xe301('0x46')](handleError(_0x27e423,null));};exports[_0xe301('0x94')]=function(_0x5bfec2,_0x584168,_0x1adf05){var _0x5bc019,_0xbfe3bd;var _0x2e351c=[];var _0x11bfb6=moment()[_0xe301('0x95')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xe301('0x2e')]['find']({'where':{'id':_0x5bfec2[_0xe301('0x48')]['id']}})[_0xe301('0x26')](handleEntityNotFound(_0x584168,null))[_0xe301('0x26')](function(_0x57748d){if(_0x57748d){_0xbfe3bd=_0x57748d;return _0x57748d[_0xe301('0x94')](_0x5bfec2['body'][_0xe301('0x68')],_[_0xe301('0x54')](_0x5bfec2[_0xe301('0x4b')],[_0xe301('0x68'),'id'])||{});}return null;})[_0xe301('0x69')](function(_0x1a9644){var _0x5eab32;var _0x4e94d6;_0x5bc019=_0x1a9644||[];var _0x5863bf=[];if(_0x1a9644){for(var _0x431536=0x0;_0x431536<_0x1a9644[_0xe301('0x38')];_0x431536+=0x1){var _0x4bb05e=_0x1a9644[_0x431536][_0xe301('0x4d')]({'plain':!![]});_0x5eab32=squel[_0xe301('0x6c')]()[_0xe301('0x6d')](_0xe301('0x96'))[_0xe301('0x6f')](['phone','ContactId',_0xe301('0x77'),_0xe301('0x5a'),'createdAt','updatedAt'],squel[_0xe301('0x72')]()[_0xe301('0x73')]('phone','phone')['field']('id',_0xe301('0x75'))[_0xe301('0x73')](_0x4bb05e[_0xe301('0x76')][_0xe301('0x80')](),_0xe301('0x77'))[_0xe301('0x73')](_0x5bfec2[_0xe301('0x48')]['id']['toString'](),'CampaignId')[_0xe301('0x73')](_0xe301('0x74'),_0xe301('0x56'))[_0xe301('0x73')]('NOW()','updatedAt')[_0xe301('0x78')](_0xe301('0x79'))['where']('deletedAt\x20IS\x20NULL')[_0xe301('0x3d')](_0xe301('0x82'),_0x4bb05e['CmListId'][_0xe301('0x80')]())[_0xe301('0x3d')](_0xe301('0x7b')))['toString']();_0x5863bf[_0xe301('0x8f')](db[_0xe301('0x90')]['query'](_0x5eab32));}return BPromise[_0xe301('0x91')](_0x5863bf);}})['then'](function(){return _0x5bc019;})[_0xe301('0x26')](respondWithResult(_0x584168,null))[_0xe301('0x46')](handleError(_0x584168,null));};exports[_0xe301('0x97')]=function(_0x28dc58,_0x1cfc9f,_0x1972d0){return db[_0xe301('0x2e')][_0xe301('0x49')]({'where':{'id':_0x28dc58[_0xe301('0x48')]['id']}})['then'](handleEntityNotFound(_0x1cfc9f,null))[_0xe301('0x26')](function(_0x412fb7){if(_0x412fb7){return _0x412fb7[_0xe301('0x97')](_0x28dc58[_0xe301('0x32')][_0xe301('0x68')]);}})[_0xe301('0x26')](function(_0x17d3cf){if(_0x17d3cf){return db[_0xe301('0x63')]['destroy']({'where':{'ListId':_0x28dc58[_0xe301('0x32')]['ids'],'CampaignId':_0x28dc58['params']['id']}})[_0xe301('0x26')](function(){return _0x17d3cf;});}})[_0xe301('0x26')](respondWithStatusCode(_0x1cfc9f,null))[_0xe301('0x46')](handleError(_0x1cfc9f,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 193c5d2..98c12ec 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(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x3410f3,_0x516979){var _0x5f2755=function(_0x305883){while(--_0x305883){_0x3410f3['push'](_0x3410f3['shift']());}};_0x5f2755(++_0x516979);}(_0x7a54,0x106));var _0x47a5=function(_0x2a9494,_0x4f59c4){_0x2a9494=_0x2a9494-0x0;var _0x214216=_0x7a54[_0x2a9494];return _0x214216;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index b8f556c..f16f811 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 _0xfe60=['Campaign','findAll','options','raw','where','attributes','map','include','model','then','GetCampaign','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','Campaign,\x20%s,\x20%s','message','result','catch'];(function(_0x4cfa2e,_0x5752b5){var _0x279b50=function(_0x3f817b){while(--_0x3f817b){_0x4cfa2e['push'](_0x4cfa2e['shift']());}};_0x279b50(++_0x5752b5);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x591dae,_0x90fa01){_0x591dae=_0x591dae-0x0;var _0x569227=_0xfe60[_0x591dae];return _0x569227;};'use strict';var _=require('lodash');var util=require(_0x0fe6('0x0'));var moment=require('moment');var BPromise=require(_0x0fe6('0x1'));var rs=require(_0x0fe6('0x2'));var fs=require('fs');var Redis=require(_0x0fe6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0fe6('0x4'));var logger=require(_0x0fe6('0x5'))(_0x0fe6('0x6'));var config=require(_0x0fe6('0x7'));var jayson=require(_0x0fe6('0x8'));var client=jayson[_0x0fe6('0x9')][_0x0fe6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21775d,_0x31e58e,_0x24e88f){return new BPromise(function(_0x58d620,_0x2f1344){return client['request'](_0x21775d,_0x24e88f)['then'](function(_0x572d4f){logger[_0x0fe6('0xb')]('Campaign,\x20%s,\x20%s',_0x31e58e,_0x0fe6('0xc'));logger[_0x0fe6('0xd')](_0x0fe6('0xe'),_0x31e58e,_0x0fe6('0xc'),JSON[_0x0fe6('0xf')](_0x572d4f));if(_0x572d4f[_0x0fe6('0x10')]){if(_0x572d4f[_0x0fe6('0x10')]['code']===0x1f4){logger[_0x0fe6('0x10')](_0x0fe6('0x11'),_0x31e58e,_0x572d4f[_0x0fe6('0x10')]['message']);return _0x2f1344(_0x572d4f['error'][_0x0fe6('0x12')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x31e58e,_0x572d4f['error'][_0x0fe6('0x12')]);return _0x58d620(_0x572d4f[_0x0fe6('0x10')][_0x0fe6('0x12')]);}else{logger[_0x0fe6('0xb')](_0x0fe6('0x11'),_0x31e58e,_0x0fe6('0xc'));_0x58d620(_0x572d4f[_0x0fe6('0x13')][_0x0fe6('0x12')]);}})[_0x0fe6('0x14')](function(_0x4669c4){logger[_0x0fe6('0x10')](_0x0fe6('0x11'),_0x31e58e,_0x4669c4);_0x2f1344(_0x4669c4);});});}exports['GetCampaign']=function(_0x469a48){var _0xe6bb13=this;return new Promise(function(_0x34fc0c,_0x2d3c01){return db[_0x0fe6('0x15')][_0x0fe6('0x16')]({'raw':_0x469a48[_0x0fe6('0x17')]?_0x469a48[_0x0fe6('0x17')][_0x0fe6('0x18')]===undefined?!![]:![]:!![],'where':_0x469a48[_0x0fe6('0x17')]?_0x469a48[_0x0fe6('0x17')][_0x0fe6('0x19')]||null:null,'attributes':_0x469a48['options']?_0x469a48[_0x0fe6('0x17')][_0x0fe6('0x1a')]||null:null,'limit':_0x469a48[_0x0fe6('0x17')]?_0x469a48[_0x0fe6('0x17')]['limit']||null:null,'include':_0x469a48[_0x0fe6('0x17')]?_0x469a48[_0x0fe6('0x17')]['include']?_[_0x0fe6('0x1b')](_0x469a48['options'][_0x0fe6('0x1c')],function(_0x224741){return{'model':db[_0x224741[_0x0fe6('0x1d')]],'as':_0x224741['as'],'attributes':_0x224741[_0x0fe6('0x1a')],'include':_0x224741['include']?_[_0x0fe6('0x1b')](_0x224741[_0x0fe6('0x1c')],function(_0x7f855d){return{'model':db[_0x7f855d[_0x0fe6('0x1d')]],'as':_0x7f855d['as'],'attributes':_0x7f855d[_0x0fe6('0x1a')],'include':_0x7f855d['include']?_[_0x0fe6('0x1b')](_0x7f855d[_0x0fe6('0x1c')],function(_0x3428a7){return{'model':db[_0x3428a7[_0x0fe6('0x1d')]],'as':_0x3428a7['as'],'attributes':_0x3428a7[_0x0fe6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0fe6('0x1e')](function(_0x4e1c48){logger[_0x0fe6('0xb')](_0x0fe6('0x1f'),_0x469a48);logger[_0x0fe6('0xd')](_0x0fe6('0x1f'),_0x469a48,JSON[_0x0fe6('0xf')](_0x4e1c48));_0x34fc0c(_0x4e1c48);})[_0x0fe6('0x14')](function(_0x18fad1){logger[_0x0fe6('0x10')](_0x0fe6('0x1f'),_0x18fad1['message'],_0x469a48);_0x2d3c01(_0xe6bb13[_0x0fe6('0x10')](0x1f4,_0x18fad1[_0x0fe6('0x12')]));});});}; \ No newline at end of file +var _0xef38=['include','info','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','findAll','options','raw','attributes','limit','map','model'];(function(_0x517802,_0x2b4bc3){var _0x1dbe68=function(_0xd6e08c){while(--_0xd6e08c){_0x517802['push'](_0x517802['shift']());}};_0x1dbe68(++_0x2b4bc3);}(_0xef38,0x122));var _0x8ef3=function(_0x55b73e,_0x4f9036){_0x55b73e=_0x55b73e-0x0;var _0x2175cd=_0xef38[_0x55b73e];return _0x2175cd;};'use strict';var _=require('lodash');var util=require(_0x8ef3('0x0'));var moment=require(_0x8ef3('0x1'));var BPromise=require(_0x8ef3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef3('0x3'))['db'];var utils=require(_0x8ef3('0x4'));var logger=require(_0x8ef3('0x5'))(_0x8ef3('0x6'));var config=require(_0x8ef3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8ef3('0x8')][_0x8ef3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ee13,_0x2c9ccd,_0x26107d){return new BPromise(function(_0x217874,_0x12b6c0){return client[_0x8ef3('0xa')](_0x50ee13,_0x26107d)[_0x8ef3('0xb')](function(_0xc4b3b3){logger['info'](_0x8ef3('0xc'),_0x2c9ccd,_0x8ef3('0xd'));logger[_0x8ef3('0xe')](_0x8ef3('0xf'),_0x2c9ccd,_0x8ef3('0xd'),JSON[_0x8ef3('0x10')](_0xc4b3b3));if(_0xc4b3b3[_0x8ef3('0x11')]){if(_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x12')]===0x1f4){logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);return _0x12b6c0(_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);}logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0xc4b3b3[_0x8ef3('0x11')][_0x8ef3('0x13')]);return _0x217874(_0xc4b3b3['error'][_0x8ef3('0x13')]);}else{logger['info'](_0x8ef3('0xc'),_0x2c9ccd,'request\x20sent');_0x217874(_0xc4b3b3[_0x8ef3('0x14')][_0x8ef3('0x13')]);}})['catch'](function(_0x56884c){logger[_0x8ef3('0x11')](_0x8ef3('0xc'),_0x2c9ccd,_0x56884c);_0x12b6c0(_0x56884c);});});}exports[_0x8ef3('0x15')]=function(_0x434aa9){var _0x5296f2=this;return new Promise(function(_0x5cbed2,_0x29025b){return db[_0x8ef3('0x16')][_0x8ef3('0x17')]({'raw':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9['options'][_0x8ef3('0x19')]===undefined?!![]:![]:!![],'where':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')]['where']||null:null,'attributes':_0x434aa9['options']?_0x434aa9[_0x8ef3('0x18')][_0x8ef3('0x1a')]||null:null,'limit':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')][_0x8ef3('0x1b')]||null:null,'include':_0x434aa9[_0x8ef3('0x18')]?_0x434aa9[_0x8ef3('0x18')]['include']?_[_0x8ef3('0x1c')](_0x434aa9[_0x8ef3('0x18')]['include'],function(_0xa9829e){return{'model':db[_0xa9829e[_0x8ef3('0x1d')]],'as':_0xa9829e['as'],'attributes':_0xa9829e[_0x8ef3('0x1a')],'include':_0xa9829e[_0x8ef3('0x1e')]?_[_0x8ef3('0x1c')](_0xa9829e['include'],function(_0x18ef45){return{'model':db[_0x18ef45[_0x8ef3('0x1d')]],'as':_0x18ef45['as'],'attributes':_0x18ef45[_0x8ef3('0x1a')],'include':_0x18ef45[_0x8ef3('0x1e')]?_['map'](_0x18ef45[_0x8ef3('0x1e')],function(_0x28637a){return{'model':db[_0x28637a[_0x8ef3('0x1d')]],'as':_0x28637a['as'],'attributes':_0x28637a[_0x8ef3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x8ef3('0xb')](function(_0x28748f){logger[_0x8ef3('0x1f')](_0x8ef3('0x15'),_0x434aa9);logger[_0x8ef3('0xe')](_0x8ef3('0x15'),_0x434aa9,JSON[_0x8ef3('0x10')](_0x28748f));_0x5cbed2(_0x28748f);})['catch'](function(_0x4408f9){logger[_0x8ef3('0x11')](_0x8ef3('0x15'),_0x4408f9[_0x8ef3('0x13')],_0x434aa9);_0x29025b(_0x5296f2[_0x8ef3('0x11')](0x1f4,_0x4408f9[_0x8ef3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 5312866..cc6bc27 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 _0xe186=['/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','clone','addBlackLists','/:id','update','destroy','delete','removeLists','removeBlackLists','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/hoppers','getHoppers'];(function(_0x536195,_0x145f3e){var _0x293236=function(_0x6cbeec){while(--_0x6cbeec){_0x536195['push'](_0x536195['shift']());}};_0x293236(++_0x145f3e);}(_0xe186,0x146));var _0x6e18=function(_0xea16f,_0x24995b){_0xea16f=_0xea16f-0x0;var _0x32104c=_0xe186[_0xea16f];return _0x32104c;};'use strict';var multer=require(_0x6e18('0x0'));var util=require(_0x6e18('0x1'));var path=require('path');var timeout=require(_0x6e18('0x2'));var express=require(_0x6e18('0x3'));var router=express[_0x6e18('0x4')]();var fs_extra=require(_0x6e18('0x5'));var auth=require(_0x6e18('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6e18('0x7'));var controller=require('./campaign.controller');router[_0x6e18('0x8')]('/',auth[_0x6e18('0x9')](),controller[_0x6e18('0xa')]);router['get']('/:id',auth[_0x6e18('0x9')](),controller[_0x6e18('0xb')]);router[_0x6e18('0x8')](_0x6e18('0xc'),auth[_0x6e18('0x9')](),controller[_0x6e18('0xd')]);router[_0x6e18('0x8')](_0x6e18('0xe'),auth['isAuthenticated'](),controller[_0x6e18('0xf')]);router[_0x6e18('0x8')](_0x6e18('0x10'),auth[_0x6e18('0x9')](),controller[_0x6e18('0x11')]);router['get'](_0x6e18('0x12'),auth['isAuthenticated'](),controller[_0x6e18('0x13')]);router[_0x6e18('0x8')](_0x6e18('0x14'),auth[_0x6e18('0x9')](),controller[_0x6e18('0x15')]);router[_0x6e18('0x8')]('/:id/blacklists',auth[_0x6e18('0x9')](),controller[_0x6e18('0x16')]);router[_0x6e18('0x17')]('/',auth['isAuthenticated'](),controller[_0x6e18('0x18')]);router[_0x6e18('0x17')](_0x6e18('0x19'),auth[_0x6e18('0x9')](),controller[_0x6e18('0x1a')]);router[_0x6e18('0x17')](_0x6e18('0x14'),auth['isAuthenticated'](),controller['addLists']);router[_0x6e18('0x17')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x6e18('0x1b')]);router['put'](_0x6e18('0x1c'),auth[_0x6e18('0x9')](),controller[_0x6e18('0x1d')]);router['delete']('/:id',auth[_0x6e18('0x9')](),controller[_0x6e18('0x1e')]);router[_0x6e18('0x1f')](_0x6e18('0x14'),auth[_0x6e18('0x9')](),controller[_0x6e18('0x20')]);router[_0x6e18('0x1f')]('/:id/blacklists',auth[_0x6e18('0x9')](),controller[_0x6e18('0x21')]);module['exports']=router; \ No newline at end of file +var _0x43b8=['post','/:id/clone','addLists','addBlackLists','put','/:id','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists'];(function(_0x2164a2,_0x4f1072){var _0x4d2275=function(_0x52968b){while(--_0x52968b){_0x2164a2['push'](_0x2164a2['shift']());}};_0x4d2275(++_0x4f1072);}(_0x43b8,0x1bd));var _0x843b=function(_0x244694,_0x4c866f){_0x244694=_0x244694-0x0;var _0x282042=_0x43b8[_0x244694];return _0x282042;};'use strict';var multer=require(_0x843b('0x0'));var util=require(_0x843b('0x1'));var path=require(_0x843b('0x2'));var timeout=require(_0x843b('0x3'));var express=require(_0x843b('0x4'));var router=express[_0x843b('0x5')]();var fs_extra=require(_0x843b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x843b('0x7'));var config=require(_0x843b('0x8'));var controller=require('./campaign.controller');router[_0x843b('0x9')]('/',auth[_0x843b('0xa')](),controller['index']);router[_0x843b('0x9')]('/:id',auth[_0x843b('0xa')](),controller['show']);router[_0x843b('0x9')](_0x843b('0xb'),auth[_0x843b('0xa')](),controller[_0x843b('0xc')]);router[_0x843b('0x9')](_0x843b('0xd'),auth[_0x843b('0xa')](),controller['getHopperHistories']);router[_0x843b('0x9')]('/:id/hopper_finals',auth[_0x843b('0xa')](),controller[_0x843b('0xe')]);router[_0x843b('0x9')](_0x843b('0xf'),auth[_0x843b('0xa')](),controller[_0x843b('0x10')]);router['get'](_0x843b('0x11'),auth[_0x843b('0xa')](),controller[_0x843b('0x12')]);router[_0x843b('0x9')]('/:id/blacklists',auth[_0x843b('0xa')](),controller[_0x843b('0x13')]);router[_0x843b('0x14')]('/',auth[_0x843b('0xa')](),controller['create']);router['post'](_0x843b('0x15'),auth[_0x843b('0xa')](),controller['clone']);router[_0x843b('0x14')](_0x843b('0x11'),auth['isAuthenticated'](),controller[_0x843b('0x16')]);router[_0x843b('0x14')]('/:id/blacklists',auth[_0x843b('0xa')](),controller[_0x843b('0x17')]);router[_0x843b('0x18')](_0x843b('0x19'),auth[_0x843b('0xa')](),controller['update']);router[_0x843b('0x1a')](_0x843b('0x19'),auth[_0x843b('0xa')](),controller[_0x843b('0x1b')]);router[_0x843b('0x1a')](_0x843b('0x11'),auth[_0x843b('0xa')](),controller[_0x843b('0x1c')]);router[_0x843b('0x1a')]('/:id/blacklists',auth[_0x843b('0xa')](),controller[_0x843b('0x1d')]);module[_0x843b('0x1e')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 99fddd8..ab9ad60 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 _0x181e=['key','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x1057a8,_0x355fd3){var _0x4fa6b1=function(_0x2646a9){while(--_0x2646a9){_0x1057a8['push'](_0x1057a8['shift']());}};_0x4fa6b1(++_0x355fd3);}(_0x181e,0x88));var _0xe181=function(_0xea73f,_0x4d4ce7){_0xea73f=_0xea73f-0x0;var _0x7ee2e9=_0x181e[_0xea73f];return _0x7ee2e9;};'use strict';var Sequelize=require(_0xe181('0x0'));module[_0xe181('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xe181('0x2')],'get':function(){return this[_0xe181('0x3')](_0xe181('0x4'));}}}; \ No newline at end of file +var _0x7c79=['TEXT','getDataValue','key','sequelize','exports','STRING'];(function(_0x11f755,_0x5bf90b){var _0x11b47f=function(_0x46efb8){while(--_0x46efb8){_0x11f755['push'](_0x11f755['shift']());}};_0x11b47f(++_0x5bf90b);}(_0x7c79,0x171));var _0x97c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c79[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x97c7('0x0'));module[_0x97c7('0x1')]={'key':{'type':Sequelize[_0x97c7('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x97c7('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x97c7('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x97c7('0x4')](_0x97c7('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index e3bd6cb..3e3fdce 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 _0xb571=['The\x20inserted\x20key\x20already\x20exists.','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','error','stack','name','index','map','CannedAnswer','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','options','include','findAll','show','find','catch','update','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError'];(function(_0x57d628,_0xda6747){var _0x2f8486=function(_0x5f2cba){while(--_0x5f2cba){_0x57d628['push'](_0x57d628['shift']());}};_0x2f8486(++_0xda6747);}(_0xb571,0x1ed));var _0x1b57=function(_0x5dec36,_0x3d2662){_0x5dec36=_0x5dec36-0x0;var _0x4f342e=_0xb571[_0x5dec36];return _0x4f342e;};'use strict';var emlformat=require(_0x1b57('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1b57('0x1'));var moment=require(_0x1b57('0x2'));var BPromise=require(_0x1b57('0x3'));var Mustache=require(_0x1b57('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1b57('0x5'));var csv=require('to-csv');var ejs=require(_0x1b57('0x6'));var fs=require('fs');var fs_extra=require(_0x1b57('0x7'));var _=require(_0x1b57('0x8'));var squel=require(_0x1b57('0x9'));var crypto=require(_0x1b57('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1b57('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1b57('0xc'));var Papa=require('papaparse');var Redis=require(_0x1b57('0xd'));var authService=require(_0x1b57('0xe'));var qs=require(_0x1b57('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b57('0x10'));var logger=require('../../config/logger')(_0x1b57('0x11'));var utils=require(_0x1b57('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1b57('0x13'));var db=require(_0x1b57('0x14'))['db'];function respondWithStatusCode(_0x2c6a5e,_0x551ede){_0x551ede=_0x551ede||0xcc;return function(_0x1fa92b){if(_0x1fa92b){return _0x2c6a5e[_0x1b57('0x15')](_0x551ede);}return _0x2c6a5e[_0x1b57('0x16')](_0x551ede)[_0x1b57('0x17')]();};}function respondWithResult(_0x524573,_0x1a83ab){_0x1a83ab=_0x1a83ab||0xc8;return function(_0x33db7f){if(_0x33db7f){return _0x524573[_0x1b57('0x16')](_0x1a83ab)[_0x1b57('0x18')](_0x33db7f);}};}function respondWithFilteredResult(_0x415d79,_0x2fdd39){return function(_0x435fd0){if(_0x435fd0){var _0x5ad966=typeof _0x2fdd39[_0x1b57('0x19')]===_0x1b57('0x1a')&&typeof _0x2fdd39['limit']===_0x1b57('0x1a');var _0x1329b7=_0x435fd0[_0x1b57('0x1b')];var _0x394ebf=_0x5ad966?0x0:_0x2fdd39[_0x1b57('0x19')];var _0x4e4e33=_0x5ad966?_0x435fd0['count']:_0x2fdd39[_0x1b57('0x19')]+_0x2fdd39[_0x1b57('0x1c')];var _0x1debce;if(_0x4e4e33>=_0x1329b7){_0x4e4e33=_0x1329b7;_0x1debce=0xc8;}else{_0x1debce=0xce;}_0x415d79['status'](_0x1debce);return _0x415d79[_0x1b57('0x1d')](_0x1b57('0x1e'),_0x394ebf+'-'+_0x4e4e33+'/'+_0x1329b7)[_0x1b57('0x18')](_0x435fd0);}return null;};}function patchUpdates(_0x43ade0){return function(_0x223c6e){try{jsonpatch[_0x1b57('0x1f')](_0x223c6e,_0x43ade0,!![]);}catch(_0x37954f){return BPromise[_0x1b57('0x20')](_0x37954f);}return _0x223c6e[_0x1b57('0x21')]();};}function saveUpdates(_0x55515d,_0x3b6bfe){return function(_0x581535){if(_0x581535){return _0x581535['update'](_0x55515d)[_0x1b57('0x22')](function(_0x530aa1){return _0x530aa1;});}return null;};}function removeEntity(_0x242ee4,_0x14af5b){return function(_0x12a8fc){if(_0x12a8fc){return _0x12a8fc[_0x1b57('0x23')]()['then'](function(){var _0x27f0fd=_0x12a8fc['get']({'plain':!![]});var _0x25c0da='CannedAnswers';return db[_0x1b57('0x24')][_0x1b57('0x23')]({'where':{'type':_0x25c0da,'resourceId':_0x27f0fd['id']}})[_0x1b57('0x22')](function(){return _0x12a8fc;});})[_0x1b57('0x22')](function(){_0x242ee4[_0x1b57('0x16')](0xcc)[_0x1b57('0x17')]();});}};}function handleEntityNotFound(_0x5a30aa,_0x3c6b31){return function(_0x46f123){if(!_0x46f123){_0x5a30aa['sendStatus'](0x194);}return _0x46f123;};}function handleError(_0x3c1952,_0x2ddcb0){_0x2ddcb0=_0x2ddcb0||0x1f4;return function(_0x56c73f){logger[_0x1b57('0x25')](_0x56c73f[_0x1b57('0x26')]);if(_0x56c73f[_0x1b57('0x27')]){delete _0x56c73f[_0x1b57('0x27')];}_0x3c1952[_0x1b57('0x16')](_0x2ddcb0)['send'](_0x56c73f);};}exports[_0x1b57('0x28')]=function(_0x481ba4,_0x2ce6c4){var _0x1d657d={},_0x1579f4={},_0x1caab5={'count':0x0,'rows':[]};var _0x4acb4d=_[_0x1b57('0x29')](db[_0x1b57('0x2a')]['rawAttributes'],function(_0x5118f4){return{'name':_0x5118f4['fieldName'],'type':_0x5118f4['type'][_0x1b57('0x2b')]};});_0x1579f4[_0x1b57('0x2c')]=_['map'](_0x4acb4d,'name');_0x1579f4['query']=_[_0x1b57('0x2d')](_0x481ba4[_0x1b57('0x2e')]);_0x1579f4[_0x1b57('0x2f')]=_[_0x1b57('0x30')](_0x1579f4['model'],_0x1579f4['query']);_0x1d657d[_0x1b57('0x31')]=_['intersection'](_0x1579f4[_0x1b57('0x2c')],qs[_0x1b57('0x32')](_0x481ba4[_0x1b57('0x2e')][_0x1b57('0x32')]));_0x1d657d[_0x1b57('0x31')]=_0x1d657d['attributes'][_0x1b57('0x33')]?_0x1d657d[_0x1b57('0x31')]:_0x1579f4[_0x1b57('0x2c')];if(!_0x481ba4['query']['hasOwnProperty'](_0x1b57('0x34'))){_0x1d657d['limit']=qs['limit'](_0x481ba4[_0x1b57('0x2e')]['limit']);_0x1d657d[_0x1b57('0x19')]=qs[_0x1b57('0x19')](_0x481ba4[_0x1b57('0x2e')][_0x1b57('0x19')]);}_0x1d657d[_0x1b57('0x35')]=qs[_0x1b57('0x36')](_0x481ba4[_0x1b57('0x2e')][_0x1b57('0x36')]);_0x1d657d[_0x1b57('0x37')]=qs['filters'](_['pick'](_0x481ba4[_0x1b57('0x2e')],_0x1579f4['filters']),_0x4acb4d);if(_0x481ba4['query'][_0x1b57('0x38')]){_0x1d657d['where']=_[_0x1b57('0x39')](_0x1d657d[_0x1b57('0x37')],{'$or':[{'key':{'$like':'%'+_0x481ba4[_0x1b57('0x2e')][_0x1b57('0x38')]+'%'}},{'value':{'$like':'%'+_0x481ba4[_0x1b57('0x2e')][_0x1b57('0x38')]+'%'}}]});}_0x1d657d=_[_0x1b57('0x39')]({},_0x1d657d,_0x481ba4[_0x1b57('0x3a')]);var _0x5dc750={'where':_0x1d657d[_0x1b57('0x37')]};return db[_0x1b57('0x2a')][_0x1b57('0x1b')](_0x5dc750)['then'](function(_0x4f6344){_0x1caab5[_0x1b57('0x1b')]=_0x4f6344;if(_0x481ba4[_0x1b57('0x2e')]['includeAll']){_0x1d657d[_0x1b57('0x3b')]=[{'all':!![]}];}return db[_0x1b57('0x2a')][_0x1b57('0x3c')](_0x1d657d);})['then'](function(_0x163115){_0x1caab5['rows']=_0x163115;return _0x1caab5;})[_0x1b57('0x22')](respondWithFilteredResult(_0x2ce6c4,_0x1d657d))['catch'](handleError(_0x2ce6c4,null));};exports[_0x1b57('0x3d')]=function(_0x1255d3,_0x1d8ffe){var _0x11fb56={'raw':!![],'where':{'id':_0x1255d3['params']['id']}},_0xe72aa6={};_0xe72aa6[_0x1b57('0x2c')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0xe72aa6[_0x1b57('0x2e')]=_['keys'](_0x1255d3[_0x1b57('0x2e')]);_0xe72aa6[_0x1b57('0x2f')]=_[_0x1b57('0x30')](_0xe72aa6[_0x1b57('0x2c')],_0xe72aa6[_0x1b57('0x2e')]);_0x11fb56[_0x1b57('0x31')]=_[_0x1b57('0x30')](_0xe72aa6[_0x1b57('0x2c')],qs[_0x1b57('0x32')](_0x1255d3[_0x1b57('0x2e')][_0x1b57('0x32')]));_0x11fb56['attributes']=_0x11fb56[_0x1b57('0x31')][_0x1b57('0x33')]?_0x11fb56[_0x1b57('0x31')]:_0xe72aa6['model'];if(_0x1255d3[_0x1b57('0x2e')]['includeAll']){_0x11fb56['include']=[{'all':!![]}];}_0x11fb56=_[_0x1b57('0x39')]({},_0x11fb56,_0x1255d3[_0x1b57('0x3a')]);return db[_0x1b57('0x2a')][_0x1b57('0x3e')](_0x11fb56)['then'](handleEntityNotFound(_0x1d8ffe,null))[_0x1b57('0x22')](respondWithResult(_0x1d8ffe,null))[_0x1b57('0x3f')](handleError(_0x1d8ffe,null));};exports[_0x1b57('0x40')]=function(_0x453eec,_0x200c80){if(_0x453eec[_0x1b57('0x41')]['id']){delete _0x453eec[_0x1b57('0x41')]['id'];}return db[_0x1b57('0x2a')][_0x1b57('0x3e')]({'where':{'id':_0x453eec[_0x1b57('0x42')]['id']}})[_0x1b57('0x22')](handleEntityNotFound(_0x200c80,null))[_0x1b57('0x22')](saveUpdates(_0x453eec['body'],null))[_0x1b57('0x22')](respondWithResult(_0x200c80,null))['catch'](handleError(_0x200c80,null));};exports[_0x1b57('0x23')]=function(_0x2a1d8f,_0x26f500){return db['CannedAnswer'][_0x1b57('0x3e')]({'where':{'id':_0x2a1d8f[_0x1b57('0x42')]['id']}})[_0x1b57('0x22')](handleEntityNotFound(_0x26f500,null))[_0x1b57('0x22')](removeEntity(_0x26f500,null))[_0x1b57('0x3f')](handleError(_0x26f500,null));};exports[_0x1b57('0x43')]=function(_0x261620,_0x5043a7){var _0x469d9d={'key':_0x261620['body'][_0x1b57('0x2b')]};if(_0x261620[_0x1b57('0x41')][_0x1b57('0x44')]){_0x469d9d[_0x1b57('0x44')]=_0x261620[_0x1b57('0x41')]['MailAccountId'];}else if(_0x261620[_0x1b57('0x41')][_0x1b57('0x45')]){_0x469d9d[_0x1b57('0x45')]=_0x261620['body']['SmsAccountId'];}else if(_0x261620[_0x1b57('0x41')][_0x1b57('0x46')]){_0x469d9d[_0x1b57('0x46')]=_0x261620[_0x1b57('0x41')][_0x1b57('0x46')];}else if(_0x261620['body'][_0x1b57('0x47')]){_0x469d9d[_0x1b57('0x47')]=_0x261620['body'][_0x1b57('0x47')];}return db[_0x1b57('0x2a')][_0x1b57('0x3e')]({'where':_0x469d9d})[_0x1b57('0x22')](function(_0x31edfb){if(_0x31edfb){throw new db[(_0x1b57('0x48'))][(_0x1b57('0x49'))](_0x1b57('0x4a'));}return db['CannedAnswer'][_0x1b57('0x43')](_0x261620[_0x1b57('0x41')]);})['then'](function(_0x57bf57){var _0x41576c=_0x261620['user'][_0x1b57('0x4b')]({'plain':!![]});if(!_0x41576c)throw new Error(_0x1b57('0x4c'));if(_0x41576c[_0x1b57('0x4d')]==='user'){var _0x43aafc=_0x57bf57['get']({'plain':!![]});return db['UserProfileSection'][_0x1b57('0x3e')]({'where':{'name':_0x1b57('0x4e'),'userProfileId':_0x41576c['userProfileId']},'raw':!![]})[_0x1b57('0x22')](function(_0x137faf){if(_0x137faf&&_0x137faf[_0x1b57('0x4f')]===0x0){return db[_0x1b57('0x24')][_0x1b57('0x43')]({'name':_0x43aafc['name'],'resourceId':_0x43aafc['id'],'type':_0x137faf[_0x1b57('0x27')],'sectionId':_0x137faf['id']},{})[_0x1b57('0x22')](function(){return _0x57bf57;});}else{return _0x57bf57;}})[_0x1b57('0x3f')](function(_0x1789cf){logger[_0x1b57('0x25')](_0x1b57('0x50'),_0x1789cf);throw _0x1789cf;});}return _0x57bf57;})['then'](respondWithResult(_0x5043a7,0xc9))[_0x1b57('0x3f')](handleError(_0x5043a7,null));}; \ No newline at end of file +var _0xa24a=['undefined','count','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name','send','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','length','includeAll','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit'];(function(_0x1c468d,_0x50b31f){var _0x29202e=function(_0x73f11){while(--_0x73f11){_0x1c468d['push'](_0x1c468d['shift']());}};_0x29202e(++_0x50b31f);}(_0xa24a,0x97));var _0xaa24=function(_0x21e6d8,_0xa3aa85){_0x21e6d8=_0x21e6d8-0x0;var _0x42f051=_0xa24a[_0x21e6d8];return _0x42f051;};'use strict';var emlformat=require(_0xaa24('0x0'));var rimraf=require(_0xaa24('0x1'));var zipdir=require(_0xaa24('0x2'));var jsonpatch=require(_0xaa24('0x3'));var rp=require(_0xaa24('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa24('0x5'));var path=require(_0xaa24('0x6'));var sox=require(_0xaa24('0x7'));var csv=require(_0xaa24('0x8'));var ejs=require(_0xaa24('0x9'));var fs=require('fs');var fs_extra=require(_0xaa24('0xa'));var _=require(_0xaa24('0xb'));var squel=require(_0xaa24('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa24('0xd'));var toCsv=require(_0xaa24('0x8'));var querystring=require(_0xaa24('0xe'));var Papa=require(_0xaa24('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaa24('0x10'));var hardwareService=require(_0xaa24('0x11'));var logger=require(_0xaa24('0x12'))(_0xaa24('0x13'));var utils=require(_0xaa24('0x14'));var config=require(_0xaa24('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450eaf,_0x4c8919){_0x4c8919=_0x4c8919||0xcc;return function(_0x3bea94){if(_0x3bea94){return _0x450eaf[_0xaa24('0x16')](_0x4c8919);}return _0x450eaf[_0xaa24('0x17')](_0x4c8919)['end']();};}function respondWithResult(_0xd1805c,_0x42959a){_0x42959a=_0x42959a||0xc8;return function(_0x490b00){if(_0x490b00){return _0xd1805c['status'](_0x42959a)[_0xaa24('0x18')](_0x490b00);}};}function respondWithFilteredResult(_0x59d08b,_0x458807){return function(_0x276e8d){if(_0x276e8d){var _0x238b21=typeof _0x458807[_0xaa24('0x19')]==='undefined'&&typeof _0x458807[_0xaa24('0x1a')]===_0xaa24('0x1b');var _0x1ef38e=_0x276e8d[_0xaa24('0x1c')];var _0x597f70=_0x238b21?0x0:_0x458807[_0xaa24('0x19')];var _0x5889cf=_0x238b21?_0x276e8d['count']:_0x458807[_0xaa24('0x19')]+_0x458807['limit'];var _0xf83a55;if(_0x5889cf>=_0x1ef38e){_0x5889cf=_0x1ef38e;_0xf83a55=0xc8;}else{_0xf83a55=0xce;}_0x59d08b[_0xaa24('0x17')](_0xf83a55);return _0x59d08b['set'](_0xaa24('0x1d'),_0x597f70+'-'+_0x5889cf+'/'+_0x1ef38e)[_0xaa24('0x18')](_0x276e8d);}return null;};}function patchUpdates(_0x514817){return function(_0x26972d){try{jsonpatch[_0xaa24('0x1e')](_0x26972d,_0x514817,!![]);}catch(_0x77bbb8){return BPromise[_0xaa24('0x1f')](_0x77bbb8);}return _0x26972d['save']();};}function saveUpdates(_0x57db55,_0x4b9057){return function(_0x12a939){if(_0x12a939){return _0x12a939[_0xaa24('0x20')](_0x57db55)[_0xaa24('0x21')](function(_0x4433ae){return _0x4433ae;});}return null;};}function removeEntity(_0x47bae5,_0x1a9e5d){return function(_0x100c93){if(_0x100c93){return _0x100c93[_0xaa24('0x22')]()[_0xaa24('0x21')](function(){var _0x18c3d9=_0x100c93[_0xaa24('0x23')]({'plain':!![]});var _0x2079e5=_0xaa24('0x24');return db[_0xaa24('0x25')][_0xaa24('0x22')]({'where':{'type':_0x2079e5,'resourceId':_0x18c3d9['id']}})['then'](function(){return _0x100c93;});})[_0xaa24('0x21')](function(){_0x47bae5[_0xaa24('0x17')](0xcc)[_0xaa24('0x26')]();});}};}function handleEntityNotFound(_0x51f933,_0x52318d){return function(_0x1635fa){if(!_0x1635fa){_0x51f933[_0xaa24('0x16')](0x194);}return _0x1635fa;};}function handleError(_0x154aec,_0x389a56){_0x389a56=_0x389a56||0x1f4;return function(_0x49a0d5){logger[_0xaa24('0x27')](_0x49a0d5[_0xaa24('0x28')]);if(_0x49a0d5[_0xaa24('0x29')]){delete _0x49a0d5[_0xaa24('0x29')];}_0x154aec['status'](_0x389a56)[_0xaa24('0x2a')](_0x49a0d5);};}exports[_0xaa24('0x2b')]=function(_0x3db536,_0x532a16){var _0x1a771d={},_0x17a40d={},_0xaecd7a={'count':0x0,'rows':[]};var _0x3da5fe=_['map'](db[_0xaa24('0x2c')][_0xaa24('0x2d')],function(_0x503eed){return{'name':_0x503eed[_0xaa24('0x2e')],'type':_0x503eed[_0xaa24('0x2f')][_0xaa24('0x30')]};});_0x17a40d[_0xaa24('0x31')]=_[_0xaa24('0x32')](_0x3da5fe,_0xaa24('0x29'));_0x17a40d[_0xaa24('0x33')]=_[_0xaa24('0x34')](_0x3db536[_0xaa24('0x33')]);_0x17a40d[_0xaa24('0x35')]=_[_0xaa24('0x36')](_0x17a40d[_0xaa24('0x31')],_0x17a40d[_0xaa24('0x33')]);_0x1a771d[_0xaa24('0x37')]=_[_0xaa24('0x36')](_0x17a40d[_0xaa24('0x31')],qs[_0xaa24('0x38')](_0x3db536[_0xaa24('0x33')]['fields']));_0x1a771d['attributes']=_0x1a771d[_0xaa24('0x37')]['length']?_0x1a771d[_0xaa24('0x37')]:_0x17a40d[_0xaa24('0x31')];if(!_0x3db536['query'][_0xaa24('0x39')](_0xaa24('0x3a'))){_0x1a771d[_0xaa24('0x1a')]=qs[_0xaa24('0x1a')](_0x3db536['query'][_0xaa24('0x1a')]);_0x1a771d[_0xaa24('0x19')]=qs[_0xaa24('0x19')](_0x3db536[_0xaa24('0x33')][_0xaa24('0x19')]);}_0x1a771d['order']=qs[_0xaa24('0x3b')](_0x3db536[_0xaa24('0x33')]['sort']);_0x1a771d[_0xaa24('0x3c')]=qs[_0xaa24('0x35')](_[_0xaa24('0x3d')](_0x3db536[_0xaa24('0x33')],_0x17a40d[_0xaa24('0x35')]),_0x3da5fe);if(_0x3db536[_0xaa24('0x33')][_0xaa24('0x3e')]){_0x1a771d['where']=_[_0xaa24('0x3f')](_0x1a771d[_0xaa24('0x3c')],{'$or':[{'key':{'$like':'%'+_0x3db536[_0xaa24('0x33')]['filter']+'%'}},{'value':{'$like':'%'+_0x3db536[_0xaa24('0x33')][_0xaa24('0x3e')]+'%'}}]});}_0x1a771d=_[_0xaa24('0x3f')]({},_0x1a771d,_0x3db536[_0xaa24('0x40')]);var _0x50b83b={'where':_0x1a771d[_0xaa24('0x3c')]};return db['CannedAnswer'][_0xaa24('0x1c')](_0x50b83b)[_0xaa24('0x21')](function(_0x350bc9){_0xaecd7a[_0xaa24('0x1c')]=_0x350bc9;if(_0x3db536[_0xaa24('0x33')]['includeAll']){_0x1a771d[_0xaa24('0x41')]=[{'all':!![]}];}return db[_0xaa24('0x2c')][_0xaa24('0x42')](_0x1a771d);})[_0xaa24('0x21')](function(_0x5479cd){_0xaecd7a[_0xaa24('0x43')]=_0x5479cd;return _0xaecd7a;})[_0xaa24('0x21')](respondWithFilteredResult(_0x532a16,_0x1a771d))[_0xaa24('0x44')](handleError(_0x532a16,null));};exports['show']=function(_0x18ad24,_0x888df3){var _0x44660c={'raw':!![],'where':{'id':_0x18ad24[_0xaa24('0x45')]['id']}},_0x5699e0={};_0x5699e0[_0xaa24('0x31')]=_['keys'](db[_0xaa24('0x2c')][_0xaa24('0x2d')]);_0x5699e0['query']=_['keys'](_0x18ad24[_0xaa24('0x33')]);_0x5699e0[_0xaa24('0x35')]=_[_0xaa24('0x36')](_0x5699e0[_0xaa24('0x31')],_0x5699e0['query']);_0x44660c[_0xaa24('0x37')]=_[_0xaa24('0x36')](_0x5699e0[_0xaa24('0x31')],qs[_0xaa24('0x38')](_0x18ad24[_0xaa24('0x33')][_0xaa24('0x38')]));_0x44660c[_0xaa24('0x37')]=_0x44660c[_0xaa24('0x37')][_0xaa24('0x46')]?_0x44660c[_0xaa24('0x37')]:_0x5699e0[_0xaa24('0x31')];if(_0x18ad24['query'][_0xaa24('0x47')]){_0x44660c[_0xaa24('0x41')]=[{'all':!![]}];}_0x44660c=_[_0xaa24('0x3f')]({},_0x44660c,_0x18ad24[_0xaa24('0x40')]);return db[_0xaa24('0x2c')][_0xaa24('0x48')](_0x44660c)[_0xaa24('0x21')](handleEntityNotFound(_0x888df3,null))[_0xaa24('0x21')](respondWithResult(_0x888df3,null))['catch'](handleError(_0x888df3,null));};exports['update']=function(_0xa96522,_0x4b78fa){if(_0xa96522[_0xaa24('0x49')]['id']){delete _0xa96522['body']['id'];}return db[_0xaa24('0x2c')][_0xaa24('0x48')]({'where':{'id':_0xa96522[_0xaa24('0x45')]['id']}})[_0xaa24('0x21')](handleEntityNotFound(_0x4b78fa,null))[_0xaa24('0x21')](saveUpdates(_0xa96522[_0xaa24('0x49')],null))['then'](respondWithResult(_0x4b78fa,null))[_0xaa24('0x44')](handleError(_0x4b78fa,null));};exports[_0xaa24('0x22')]=function(_0x2d7970,_0xdb43e7){return db[_0xaa24('0x2c')]['find']({'where':{'id':_0x2d7970[_0xaa24('0x45')]['id']}})[_0xaa24('0x21')](handleEntityNotFound(_0xdb43e7,null))[_0xaa24('0x21')](removeEntity(_0xdb43e7,null))['catch'](handleError(_0xdb43e7,null));};exports['create']=function(_0x53ca8c,_0x17299e){var _0x2ba345={'key':_0x53ca8c[_0xaa24('0x49')]['key']};if(_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4a')]){_0x2ba345[_0xaa24('0x4a')]=_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4a')];}else if(_0x53ca8c[_0xaa24('0x49')]['SmsAccountId']){_0x2ba345[_0xaa24('0x4b')]=_0x53ca8c['body']['SmsAccountId'];}else if(_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4c')]){_0x2ba345[_0xaa24('0x4c')]=_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4c')];}else if(_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4d')]){_0x2ba345['ChatWebsiteId']=_0x53ca8c[_0xaa24('0x49')][_0xaa24('0x4d')];}return db[_0xaa24('0x2c')]['find']({'where':_0x2ba345})[_0xaa24('0x21')](function(_0x2166d3){if(_0x2166d3){throw new db[(_0xaa24('0x4e'))][(_0xaa24('0x4f'))](_0xaa24('0x50'));}return db[_0xaa24('0x2c')][_0xaa24('0x51')](_0x53ca8c['body']);})[_0xaa24('0x21')](function(_0x5971e6){var _0x5bfc2b=_0x53ca8c[_0xaa24('0x52')][_0xaa24('0x23')]({'plain':!![]});if(!_0x5bfc2b)throw new Error(_0xaa24('0x53'));if(_0x5bfc2b[_0xaa24('0x54')]==='user'){var _0x17f3e2=_0x5971e6['get']({'plain':!![]});return db[_0xaa24('0x55')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x5bfc2b[_0xaa24('0x56')]},'raw':!![]})[_0xaa24('0x21')](function(_0x418a9d){if(_0x418a9d&&_0x418a9d[_0xaa24('0x57')]===0x0){return db[_0xaa24('0x25')][_0xaa24('0x51')]({'name':_0x17f3e2['name'],'resourceId':_0x17f3e2['id'],'type':_0x418a9d[_0xaa24('0x29')],'sectionId':_0x418a9d['id']},{})[_0xaa24('0x21')](function(){return _0x5971e6;});}else{return _0x5971e6;}})[_0xaa24('0x44')](function(_0x1dce7c){logger[_0xaa24('0x27')](_0xaa24('0x58'),_0x1dce7c);throw _0x1dce7c;});}return _0x5971e6;})['then'](respondWithResult(_0x17299e,0xc9))[_0xaa24('0x44')](handleError(_0x17299e,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 237ea61..41405f7 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 _0xf770=['CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','exports'];(function(_0x2e0d04,_0x28aa4e){var _0x3294b6=function(_0x55b57c){while(--_0x55b57c){_0x2e0d04['push'](_0x2e0d04['shift']());}};_0x3294b6(++_0x28aa4e);}(_0xf770,0x107));var _0x0f77=function(_0x2bf090,_0x2a5239){_0x2bf090=_0x2bf090-0x0;var _0x596c1b=_0xf770[_0x2bf090];return _0x596c1b;};'use strict';var _=require(_0x0f77('0x0'));var util=require('util');var logger=require(_0x0f77('0x1'))('api');var moment=require(_0x0f77('0x2'));var BPromise=require(_0x0f77('0x3'));var rp=require(_0x0f77('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f77('0x5'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x0f77('0x6')]=function(_0x57a93e,_0x336071){return _0x57a93e['define'](_0x0f77('0x7'),attributes,{'tableName':_0x0f77('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0f77('0x9')});}; \ No newline at end of file +var _0x43b7=['request-promise','path','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird'];(function(_0x4dffc2,_0x498606){var _0x25af99=function(_0x984268){while(--_0x984268){_0x4dffc2['push'](_0x4dffc2['shift']());}};_0x25af99(++_0x498606);}(_0x43b7,0xa3));var _0x743b=function(_0x1eaade,_0xdc34){_0x1eaade=_0x1eaade-0x0;var _0x557821=_0x43b7[_0x1eaade];return _0x557821;};'use strict';var _=require(_0x743b('0x0'));var util=require(_0x743b('0x1'));var logger=require(_0x743b('0x2'))(_0x743b('0x3'));var moment=require('moment');var BPromise=require(_0x743b('0x4'));var rp=require(_0x743b('0x5'));var fs=require('fs');var path=require(_0x743b('0x6'));var rimraf=require('rimraf');var config=require(_0x743b('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x743b('0x8')]=function(_0x3de02b,_0x12d0f4){return _0x3de02b['define'](_0x743b('0x9'),attributes,{'tableName':_0x743b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x743b('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 5ffa04d..579900a 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(_0x396d19,_0x2bf082){var _0x5d307b=function(_0x1339ac){while(--_0x1339ac){_0x396d19['push'](_0x396d19['shift']());}};_0x5d307b(++_0x2bf082);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x464c85,_0x3b2237){var _0x4ee07c=function(_0x1371ef){while(--_0x1371ef){_0x464c85['push'](_0x464c85['shift']());}};_0x4ee07c(++_0x3b2237);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 0ab16f7..1ca02da 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 _0xf83c=['fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x36ac6a,_0x1195e1){var _0x1f992b=function(_0x16f319){while(--_0x16f319){_0x36ac6a['push'](_0x36ac6a['shift']());}};_0x1f992b(++_0x1195e1);}(_0xf83c,0x82));var _0xcf83=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0xf83c[_0x576266];return _0x18234f;};'use strict';var multer=require(_0xcf83('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xcf83('0x1'));var express=require(_0xcf83('0x2'));var router=express['Router']();var fs_extra=require(_0xcf83('0x3'));var auth=require(_0xcf83('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcf83('0x5'));var controller=require(_0xcf83('0x6'));router[_0xcf83('0x7')]('/',auth[_0xcf83('0x8')](),controller[_0xcf83('0x9')]);router['get'](_0xcf83('0xa'),auth[_0xcf83('0x8')](),controller[_0xcf83('0xb')]);router[_0xcf83('0xc')]('/',auth['isAuthenticated'](),controller[_0xcf83('0xd')]);router[_0xcf83('0xe')](_0xcf83('0xa'),auth['isAuthenticated'](),controller[_0xcf83('0xf')]);router[_0xcf83('0x10')](_0xcf83('0xa'),auth['isAuthenticated'](),controller[_0xcf83('0x11')]);module[_0xcf83('0x12')]=router; \ No newline at end of file +var _0x8baa=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','multer','util','path'];(function(_0x41e4eb,_0x58029b){var _0x3d54b3=function(_0x54f1ff){while(--_0x54f1ff){_0x41e4eb['push'](_0x41e4eb['shift']());}};_0x3d54b3(++_0x58029b);}(_0x8baa,0x11d));var _0xa8ba=function(_0x5b1a0a,_0x1540a9){_0x5b1a0a=_0x5b1a0a-0x0;var _0x5b9b87=_0x8baa[_0x5b1a0a];return _0x5b9b87;};'use strict';var multer=require(_0xa8ba('0x0'));var util=require(_0xa8ba('0x1'));var path=require(_0xa8ba('0x2'));var timeout=require(_0xa8ba('0x3'));var express=require(_0xa8ba('0x4'));var router=express['Router']();var fs_extra=require(_0xa8ba('0x5'));var auth=require(_0xa8ba('0x6'));var interaction=require(_0xa8ba('0x7'));var config=require(_0xa8ba('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth[_0xa8ba('0x9')](),controller['index']);router[_0xa8ba('0xa')](_0xa8ba('0xb'),auth['isAuthenticated'](),controller[_0xa8ba('0xc')]);router[_0xa8ba('0xd')]('/',auth[_0xa8ba('0x9')](),controller['create']);router[_0xa8ba('0xe')](_0xa8ba('0xb'),auth[_0xa8ba('0x9')](),controller[_0xa8ba('0xf')]);router[_0xa8ba('0x10')]('/:id',auth[_0xa8ba('0x9')](),controller[_0xa8ba('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index f4606ef..32b5529 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 _0x7072=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x1332b2,_0x4591f9){var _0x51f700=function(_0x489f93){while(--_0x489f93){_0x1332b2['push'](_0x1332b2['shift']());}};_0x51f700(++_0x4591f9);}(_0x7072,0x138));var _0x2707=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x7072[_0x125ff8];return _0x2d9ef;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'calldate':{'type':Sequelize[_0x2707('0x1')],'allowNull':![],'defaultValue':_0x2707('0x2')},'clid':{'type':Sequelize[_0x2707('0x3')]},'src':{'type':Sequelize[_0x2707('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2707('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x2707('0x3')]},'lastdata':{'type':Sequelize[_0x2707('0x3')]},'duration':{'type':Sequelize[_0x2707('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2707('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2707('0x3')]},'amaflags':{'type':Sequelize[_0x2707('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x2707('0x3')]},'userfield':{'type':Sequelize[_0x2707('0x3')]},'uniqueid':{'type':Sequelize[_0x2707('0x3')]},'linkedid':{'type':Sequelize[_0x2707('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2707('0x3')]},'tag':{'type':Sequelize[_0x2707('0x3')]}}; \ No newline at end of file +var _0x6002=['exports','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x6002,0x103));var _0x2600=function(_0x30f2fd,_0x1207b4){_0x30f2fd=_0x30f2fd-0x0;var _0x42adbc=_0x6002[_0x30f2fd];return _0x42adbc;};'use strict';var Sequelize=require(_0x2600('0x0'));module[_0x2600('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x2600('0x2')},'clid':{'type':Sequelize[_0x2600('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x2600('0x3')]},'dcontext':{'type':Sequelize[_0x2600('0x3')]},'channel':{'type':Sequelize[_0x2600('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x2600('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2600('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x2600('0x3')]},'sequence':{'type':Sequelize[_0x2600('0x3')]},'peeraccount':{'type':Sequelize[_0x2600('0x3')]},'type':{'type':Sequelize[_0x2600('0x3')]},'tag':{'type':Sequelize[_0x2600('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 778505d..73bedd5 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 _0x8085=['name','send','index','map','Cdr','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','catch','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','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/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack'];(function(_0x375add,_0x3e2336){var _0x3d94df=function(_0xf8bfd5){while(--_0xf8bfd5){_0x375add['push'](_0x375add['shift']());}};_0x3d94df(++_0x3e2336);}(_0x8085,0x71));var _0x5808=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x8085[_0x59bcb1];return _0x4a737f;};'use strict';var emlformat=require(_0x5808('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5808('0x1'));var rp=require(_0x5808('0x2'));var moment=require(_0x5808('0x3'));var BPromise=require(_0x5808('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5808('0x5'));var sox=require(_0x5808('0x6'));var csv=require('to-csv');var ejs=require(_0x5808('0x7'));var fs=require('fs');var fs_extra=require(_0x5808('0x8'));var _=require(_0x5808('0x9'));var squel=require(_0x5808('0xa'));var crypto=require(_0x5808('0xb'));var jsforce=require(_0x5808('0xc'));var deskjs=require(_0x5808('0xd'));var toCsv=require(_0x5808('0xe'));var querystring=require(_0x5808('0xf'));var Papa=require(_0x5808('0x10'));var Redis=require(_0x5808('0x11'));var authService=require(_0x5808('0x12'));var qs=require(_0x5808('0x13'));var as=require(_0x5808('0x14'));var hardwareService=require(_0x5808('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5808('0x16'));var config=require(_0x5808('0x17'));var licenseUtil=require(_0x5808('0x18'));var db=require(_0x5808('0x19'))['db'];function respondWithStatusCode(_0xab4f46,_0x19be03){_0x19be03=_0x19be03||0xcc;return function(_0x10572d){if(_0x10572d){return _0xab4f46['sendStatus'](_0x19be03);}return _0xab4f46['status'](_0x19be03)[_0x5808('0x1a')]();};}function respondWithResult(_0x19252b,_0x3582d6){_0x3582d6=_0x3582d6||0xc8;return function(_0x3e7c09){if(_0x3e7c09){return _0x19252b[_0x5808('0x1b')](_0x3582d6)[_0x5808('0x1c')](_0x3e7c09);}};}function respondWithFilteredResult(_0x299b22,_0x2af9da){return function(_0x1dda8d){if(_0x1dda8d){var _0x46dd8a=typeof _0x2af9da[_0x5808('0x1d')]==='undefined'&&typeof _0x2af9da[_0x5808('0x1e')]==='undefined';var _0x406e65=_0x1dda8d[_0x5808('0x1f')];var _0x3bf0ee=_0x46dd8a?0x0:_0x2af9da['offset'];var _0x9e58d4=_0x46dd8a?_0x1dda8d[_0x5808('0x1f')]:_0x2af9da['offset']+_0x2af9da['limit'];var _0x3c7c02;if(_0x9e58d4>=_0x406e65){_0x9e58d4=_0x406e65;_0x3c7c02=0xc8;}else{_0x3c7c02=0xce;}_0x299b22['status'](_0x3c7c02);return _0x299b22[_0x5808('0x20')](_0x5808('0x21'),_0x3bf0ee+'-'+_0x9e58d4+'/'+_0x406e65)[_0x5808('0x1c')](_0x1dda8d);}return null;};}function patchUpdates(_0xaac16a){return function(_0x578d70){try{jsonpatch['apply'](_0x578d70,_0xaac16a,!![]);}catch(_0xe82ad0){return BPromise[_0x5808('0x22')](_0xe82ad0);}return _0x578d70[_0x5808('0x23')]();};}function saveUpdates(_0x39bca3,_0x409337){return function(_0x33b583){if(_0x33b583){return _0x33b583[_0x5808('0x24')](_0x39bca3)[_0x5808('0x25')](function(_0x3a575e){return _0x3a575e;});}return null;};}function removeEntity(_0x4e1dfc,_0x5b5175){return function(_0x130590){if(_0x130590){return _0x130590[_0x5808('0x26')]()['then'](function(){_0x4e1dfc['status'](0xcc)[_0x5808('0x1a')]();});}};}function handleEntityNotFound(_0x467500,_0x1dddbd){return function(_0x4a4d05){if(!_0x4a4d05){_0x467500['sendStatus'](0x194);}return _0x4a4d05;};}function handleError(_0x24ee0f,_0x2c2cb5){_0x2c2cb5=_0x2c2cb5||0x1f4;return function(_0x27c991){logger[_0x5808('0x27')](_0x27c991[_0x5808('0x28')]);if(_0x27c991['name']){delete _0x27c991[_0x5808('0x29')];}_0x24ee0f[_0x5808('0x1b')](_0x2c2cb5)[_0x5808('0x2a')](_0x27c991);};}exports[_0x5808('0x2b')]=function(_0x28c1eb,_0x19ac63){var _0x1117ac={},_0x4ad6d8={},_0x560e83={'count':0x0,'rows':[]};var _0x4f6342=_[_0x5808('0x2c')](db[_0x5808('0x2d')]['rawAttributes'],function(_0x3faa07){return{'name':_0x3faa07[_0x5808('0x2e')],'type':_0x3faa07[_0x5808('0x2f')][_0x5808('0x30')]};});_0x4ad6d8[_0x5808('0x31')]=_[_0x5808('0x2c')](_0x4f6342,'name');_0x4ad6d8[_0x5808('0x32')]=_[_0x5808('0x33')](_0x28c1eb[_0x5808('0x32')]);_0x4ad6d8['filters']=_['intersection'](_0x4ad6d8[_0x5808('0x31')],_0x4ad6d8['query']);_0x1117ac[_0x5808('0x34')]=_[_0x5808('0x35')](_0x4ad6d8['model'],qs[_0x5808('0x36')](_0x28c1eb[_0x5808('0x32')]['fields']));_0x1117ac['attributes']=_0x1117ac[_0x5808('0x34')]['length']?_0x1117ac[_0x5808('0x34')]:_0x4ad6d8['model'];if(!_0x28c1eb[_0x5808('0x32')][_0x5808('0x37')](_0x5808('0x38'))){_0x1117ac['limit']=qs[_0x5808('0x1e')](_0x28c1eb['query'][_0x5808('0x1e')]);_0x1117ac['offset']=qs['offset'](_0x28c1eb[_0x5808('0x32')][_0x5808('0x1d')]);}_0x1117ac[_0x5808('0x39')]=qs['sort'](_0x28c1eb['query'][_0x5808('0x3a')]);_0x1117ac[_0x5808('0x3b')]=qs['filters'](_[_0x5808('0x3c')](_0x28c1eb[_0x5808('0x32')],_0x4ad6d8[_0x5808('0x3d')]),_0x4f6342);if(_0x28c1eb['query'][_0x5808('0x3e')]){_0x1117ac[_0x5808('0x3b')]=_[_0x5808('0x3f')](_0x1117ac['where'],{'$or':_[_0x5808('0x2c')](_0x4f6342,function(_0x12a045){if(_0x12a045['type']!=='VIRTUAL'){var _0x477278={};_0x477278[_0x12a045['name']]={'$like':'%'+_0x28c1eb[_0x5808('0x32')][_0x5808('0x3e')]+'%'};return _0x477278;}})});}_0x1117ac=_[_0x5808('0x3f')]({},_0x1117ac,_0x28c1eb[_0x5808('0x40')]);var _0x21fc36={'where':_0x1117ac['where']};return db['Cdr'][_0x5808('0x1f')](_0x21fc36)[_0x5808('0x25')](function(_0x402b4e){_0x560e83['count']=_0x402b4e;if(_0x28c1eb[_0x5808('0x32')][_0x5808('0x41')]){_0x1117ac[_0x5808('0x42')]=[{'all':!![]}];}return db[_0x5808('0x2d')][_0x5808('0x43')](_0x1117ac);})['then'](function(_0x1130c8){_0x560e83[_0x5808('0x44')]=_0x1130c8;return _0x560e83;})[_0x5808('0x25')](respondWithFilteredResult(_0x19ac63,_0x1117ac))['catch'](handleError(_0x19ac63,null));};exports[_0x5808('0x45')]=function(_0x287e07,_0xc62608){var _0x5e1230={'raw':!![],'where':{'id':_0x287e07[_0x5808('0x46')]['id']}},_0x5dcb50={};_0x5dcb50[_0x5808('0x31')]=_[_0x5808('0x33')](db[_0x5808('0x2d')][_0x5808('0x47')]);_0x5dcb50[_0x5808('0x32')]=_[_0x5808('0x33')](_0x287e07[_0x5808('0x32')]);_0x5dcb50[_0x5808('0x3d')]=_[_0x5808('0x35')](_0x5dcb50[_0x5808('0x31')],_0x5dcb50[_0x5808('0x32')]);_0x5e1230[_0x5808('0x34')]=_['intersection'](_0x5dcb50['model'],qs[_0x5808('0x36')](_0x287e07[_0x5808('0x32')][_0x5808('0x36')]));_0x5e1230[_0x5808('0x34')]=_0x5e1230[_0x5808('0x34')][_0x5808('0x48')]?_0x5e1230[_0x5808('0x34')]:_0x5dcb50['model'];if(_0x287e07[_0x5808('0x32')]['includeAll']){_0x5e1230[_0x5808('0x42')]=[{'all':!![]}];}_0x5e1230=_['merge']({},_0x5e1230,_0x287e07[_0x5808('0x40')]);return db['Cdr']['find'](_0x5e1230)['then'](handleEntityNotFound(_0xc62608,null))[_0x5808('0x25')](respondWithResult(_0xc62608,null))[_0x5808('0x49')](handleError(_0xc62608,null));};exports['create']=function(_0x46c8ed,_0x4568d0){return db[_0x5808('0x2d')]['create'](_0x46c8ed[_0x5808('0x4a')],{})['then'](respondWithResult(_0x4568d0,0xc9))[_0x5808('0x49')](handleError(_0x4568d0,null));};exports[_0x5808('0x24')]=function(_0x13fe11,_0x5cc977){if(_0x13fe11[_0x5808('0x4a')]['id']){delete _0x13fe11[_0x5808('0x4a')]['id'];}return db[_0x5808('0x2d')][_0x5808('0x4b')]({'where':{'id':_0x13fe11['params']['id']}})[_0x5808('0x25')](handleEntityNotFound(_0x5cc977,null))[_0x5808('0x25')](saveUpdates(_0x13fe11[_0x5808('0x4a')],null))[_0x5808('0x25')](respondWithResult(_0x5cc977,null))[_0x5808('0x49')](handleError(_0x5cc977,null));};exports[_0x5808('0x26')]=function(_0x5572f3,_0x23d2fe){return db[_0x5808('0x2d')][_0x5808('0x4b')]({'where':{'id':_0x5572f3[_0x5808('0x46')]['id']}})[_0x5808('0x25')](handleEntityNotFound(_0x23d2fe,null))['then'](removeEntity(_0x23d2fe,null))[_0x5808('0x49')](handleError(_0x23d2fe,null));};exports[_0x5808('0x4c')]=function(_0xc2c5d7,_0x44ff0a){return db[_0x5808('0x2d')][_0x5808('0x4c')]()['then'](respondWithResult(_0x44ff0a,null))[_0x5808('0x49')](handleError(_0x44ff0a,null));}; \ No newline at end of file +var _0xf767=['apply','save','then','error','stack','name','map','Cdr','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','merge','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','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','../../config/environment','../../mysqldb','sendStatus','end','undefined','count','limit','status','set','json'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xf767,0x76));var _0x7f76=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xf767[_0x1b2422];return _0x376573;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f76('0x0'));var zipdir=require(_0x7f76('0x1'));var jsonpatch=require(_0x7f76('0x2'));var rp=require(_0x7f76('0x3'));var moment=require(_0x7f76('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7f76('0x5'));var util=require(_0x7f76('0x6'));var path=require(_0x7f76('0x7'));var sox=require(_0x7f76('0x8'));var csv=require('to-csv');var ejs=require(_0x7f76('0x9'));var fs=require('fs');var fs_extra=require(_0x7f76('0xa'));var _=require(_0x7f76('0xb'));var squel=require(_0x7f76('0xc'));var crypto=require(_0x7f76('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f76('0xe'));var toCsv=require(_0x7f76('0xf'));var querystring=require(_0x7f76('0x10'));var Papa=require(_0x7f76('0x11'));var Redis=require('ioredis');var authService=require(_0x7f76('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7f76('0x13'));var hardwareService=require(_0x7f76('0x14'));var logger=require(_0x7f76('0x15'))(_0x7f76('0x16'));var utils=require(_0x7f76('0x17'));var config=require(_0x7f76('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f76('0x19'))['db'];function respondWithStatusCode(_0x2cd1b3,_0x47403b){_0x47403b=_0x47403b||0xcc;return function(_0x32392b){if(_0x32392b){return _0x2cd1b3[_0x7f76('0x1a')](_0x47403b);}return _0x2cd1b3['status'](_0x47403b)[_0x7f76('0x1b')]();};}function respondWithResult(_0x4d8de0,_0x42a9d3){_0x42a9d3=_0x42a9d3||0xc8;return function(_0x256f79){if(_0x256f79){return _0x4d8de0['status'](_0x42a9d3)['json'](_0x256f79);}};}function respondWithFilteredResult(_0x58d2f3,_0xe81aa9){return function(_0x2df2db){if(_0x2df2db){var _0x286e96=typeof _0xe81aa9['offset']===_0x7f76('0x1c')&&typeof _0xe81aa9['limit']===_0x7f76('0x1c');var _0x3ceb6a=_0x2df2db[_0x7f76('0x1d')];var _0x4802ff=_0x286e96?0x0:_0xe81aa9['offset'];var _0x494537=_0x286e96?_0x2df2db['count']:_0xe81aa9['offset']+_0xe81aa9[_0x7f76('0x1e')];var _0xdb1407;if(_0x494537>=_0x3ceb6a){_0x494537=_0x3ceb6a;_0xdb1407=0xc8;}else{_0xdb1407=0xce;}_0x58d2f3[_0x7f76('0x1f')](_0xdb1407);return _0x58d2f3[_0x7f76('0x20')]('Content-Range',_0x4802ff+'-'+_0x494537+'/'+_0x3ceb6a)[_0x7f76('0x21')](_0x2df2db);}return null;};}function patchUpdates(_0x557c0f){return function(_0x38c4d6){try{jsonpatch[_0x7f76('0x22')](_0x38c4d6,_0x557c0f,!![]);}catch(_0x5a28b0){return BPromise['reject'](_0x5a28b0);}return _0x38c4d6[_0x7f76('0x23')]();};}function saveUpdates(_0xb647d8,_0x5efed5){return function(_0x3f2536){if(_0x3f2536){return _0x3f2536['update'](_0xb647d8)[_0x7f76('0x24')](function(_0x333056){return _0x333056;});}return null;};}function removeEntity(_0x31993d,_0x3deb00){return function(_0x3eea75){if(_0x3eea75){return _0x3eea75['destroy']()[_0x7f76('0x24')](function(){_0x31993d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x197519,_0x45f1c9){return function(_0x3492f4){if(!_0x3492f4){_0x197519['sendStatus'](0x194);}return _0x3492f4;};}function handleError(_0xbe6ac1,_0x1347bf){_0x1347bf=_0x1347bf||0x1f4;return function(_0x3e624d){logger[_0x7f76('0x25')](_0x3e624d[_0x7f76('0x26')]);if(_0x3e624d['name']){delete _0x3e624d[_0x7f76('0x27')];}_0xbe6ac1[_0x7f76('0x1f')](_0x1347bf)['send'](_0x3e624d);};}exports['index']=function(_0xe459de,_0x58829a){var _0x1dd664={},_0x3542e3={},_0xd5ba7={'count':0x0,'rows':[]};var _0x393bdd=_[_0x7f76('0x28')](db[_0x7f76('0x29')]['rawAttributes'],function(_0x3570ec){return{'name':_0x3570ec[_0x7f76('0x2a')],'type':_0x3570ec[_0x7f76('0x2b')][_0x7f76('0x2c')]};});_0x3542e3['model']=_[_0x7f76('0x28')](_0x393bdd,_0x7f76('0x27'));_0x3542e3[_0x7f76('0x2d')]=_['keys'](_0xe459de[_0x7f76('0x2d')]);_0x3542e3[_0x7f76('0x2e')]=_[_0x7f76('0x2f')](_0x3542e3[_0x7f76('0x30')],_0x3542e3[_0x7f76('0x2d')]);_0x1dd664[_0x7f76('0x31')]=_[_0x7f76('0x2f')](_0x3542e3[_0x7f76('0x30')],qs[_0x7f76('0x32')](_0xe459de[_0x7f76('0x2d')][_0x7f76('0x32')]));_0x1dd664[_0x7f76('0x31')]=_0x1dd664[_0x7f76('0x31')]['length']?_0x1dd664[_0x7f76('0x31')]:_0x3542e3[_0x7f76('0x30')];if(!_0xe459de[_0x7f76('0x2d')][_0x7f76('0x33')](_0x7f76('0x34'))){_0x1dd664[_0x7f76('0x1e')]=qs[_0x7f76('0x1e')](_0xe459de[_0x7f76('0x2d')]['limit']);_0x1dd664[_0x7f76('0x35')]=qs['offset'](_0xe459de['query'][_0x7f76('0x35')]);}_0x1dd664['order']=qs[_0x7f76('0x36')](_0xe459de[_0x7f76('0x2d')]['sort']);_0x1dd664[_0x7f76('0x37')]=qs['filters'](_['pick'](_0xe459de[_0x7f76('0x2d')],_0x3542e3[_0x7f76('0x2e')]),_0x393bdd);if(_0xe459de[_0x7f76('0x2d')][_0x7f76('0x38')]){_0x1dd664[_0x7f76('0x37')]=_['merge'](_0x1dd664[_0x7f76('0x37')],{'$or':_[_0x7f76('0x28')](_0x393bdd,function(_0x4edf74){if(_0x4edf74['type']!==_0x7f76('0x39')){var _0x4ea167={};_0x4ea167[_0x4edf74[_0x7f76('0x27')]]={'$like':'%'+_0xe459de[_0x7f76('0x2d')][_0x7f76('0x38')]+'%'};return _0x4ea167;}})});}_0x1dd664=_['merge']({},_0x1dd664,_0xe459de[_0x7f76('0x3a')]);var _0x26b537={'where':_0x1dd664[_0x7f76('0x37')]};return db[_0x7f76('0x29')][_0x7f76('0x1d')](_0x26b537)[_0x7f76('0x24')](function(_0x58649f){_0xd5ba7['count']=_0x58649f;if(_0xe459de[_0x7f76('0x2d')][_0x7f76('0x3b')]){_0x1dd664[_0x7f76('0x3c')]=[{'all':!![]}];}return db[_0x7f76('0x29')][_0x7f76('0x3d')](_0x1dd664);})[_0x7f76('0x24')](function(_0x401284){_0xd5ba7[_0x7f76('0x3e')]=_0x401284;return _0xd5ba7;})[_0x7f76('0x24')](respondWithFilteredResult(_0x58829a,_0x1dd664))[_0x7f76('0x3f')](handleError(_0x58829a,null));};exports[_0x7f76('0x40')]=function(_0x313d37,_0x3229b9){var _0x391d04={'raw':!![],'where':{'id':_0x313d37[_0x7f76('0x41')]['id']}},_0x2a43f1={};_0x2a43f1[_0x7f76('0x30')]=_[_0x7f76('0x42')](db['Cdr'][_0x7f76('0x43')]);_0x2a43f1[_0x7f76('0x2d')]=_[_0x7f76('0x42')](_0x313d37['query']);_0x2a43f1['filters']=_[_0x7f76('0x2f')](_0x2a43f1['model'],_0x2a43f1[_0x7f76('0x2d')]);_0x391d04['attributes']=_['intersection'](_0x2a43f1[_0x7f76('0x30')],qs[_0x7f76('0x32')](_0x313d37[_0x7f76('0x2d')][_0x7f76('0x32')]));_0x391d04[_0x7f76('0x31')]=_0x391d04[_0x7f76('0x31')][_0x7f76('0x44')]?_0x391d04[_0x7f76('0x31')]:_0x2a43f1[_0x7f76('0x30')];if(_0x313d37[_0x7f76('0x2d')][_0x7f76('0x3b')]){_0x391d04[_0x7f76('0x3c')]=[{'all':!![]}];}_0x391d04=_[_0x7f76('0x45')]({},_0x391d04,_0x313d37[_0x7f76('0x3a')]);return db['Cdr'][_0x7f76('0x46')](_0x391d04)['then'](handleEntityNotFound(_0x3229b9,null))[_0x7f76('0x24')](respondWithResult(_0x3229b9,null))[_0x7f76('0x3f')](handleError(_0x3229b9,null));};exports[_0x7f76('0x47')]=function(_0x39bbef,_0x487b1f){return db[_0x7f76('0x29')][_0x7f76('0x47')](_0x39bbef[_0x7f76('0x48')],{})[_0x7f76('0x24')](respondWithResult(_0x487b1f,0xc9))['catch'](handleError(_0x487b1f,null));};exports[_0x7f76('0x49')]=function(_0xd87fe7,_0x53f77a){if(_0xd87fe7[_0x7f76('0x48')]['id']){delete _0xd87fe7[_0x7f76('0x48')]['id'];}return db[_0x7f76('0x29')]['find']({'where':{'id':_0xd87fe7[_0x7f76('0x41')]['id']}})[_0x7f76('0x24')](handleEntityNotFound(_0x53f77a,null))[_0x7f76('0x24')](saveUpdates(_0xd87fe7[_0x7f76('0x48')],null))[_0x7f76('0x24')](respondWithResult(_0x53f77a,null))[_0x7f76('0x3f')](handleError(_0x53f77a,null));};exports[_0x7f76('0x4a')]=function(_0x42abd9,_0x1a4d3c){return db[_0x7f76('0x29')][_0x7f76('0x46')]({'where':{'id':_0x42abd9[_0x7f76('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a4d3c,null))[_0x7f76('0x24')](removeEntity(_0x1a4d3c,null))['catch'](handleError(_0x1a4d3c,null));};exports[_0x7f76('0x4b')]=function(_0x3bcd59,_0x171c71){return db['Cdr'][_0x7f76('0x4b')]()[_0x7f76('0x24')](respondWithResult(_0x171c71,null))['catch'](handleError(_0x171c71,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 0e089c5..60f2668 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(_0x23dc18,_0x1e729a){var _0x248c55=function(_0x380498){while(--_0x380498){_0x23dc18['push'](_0x23dc18['shift']());}};_0x248c55(++_0x1e729a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x25463d,_0x3f28fb){var _0x21ed76=function(_0x9ae3ce){while(--_0x9ae3ce){_0x25463d['push'](_0x25463d['shift']());}};_0x21ed76(++_0x3f28fb);}(_0x7a54,0x106));var _0x47a5=function(_0x5f546b,_0x594c94){_0x5f546b=_0x5f546b-0x0;var _0x11733d=_0x7a54[_0x5f546b];return _0x11733d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index d875be8..7fdb366 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 _0x4fb0=['client','http','request','then','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','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x5610b7,_0x5095be){var _0x1c0eef=function(_0x1bd91a){while(--_0x1bd91a){_0x5610b7['push'](_0x5610b7['shift']());}};_0x1c0eef(++_0x5095be);}(_0x4fb0,0x1f2));var _0x04fb=function(_0x2cdaaa,_0x25d1a9){_0x2cdaaa=_0x2cdaaa-0x0;var _0x2822d4=_0x4fb0[_0x2cdaaa];return _0x2822d4;};'use strict';var _=require(_0x04fb('0x0'));var util=require(_0x04fb('0x1'));var moment=require(_0x04fb('0x2'));var BPromise=require(_0x04fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04fb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x04fb('0x5'));var logger=require(_0x04fb('0x6'))('rpc');var config=require(_0x04fb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x04fb('0x8')][_0x04fb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d250d,_0x20d214,_0x3dd0a5){return new BPromise(function(_0x6d0890,_0x2b7b20){return client[_0x04fb('0xa')](_0x5d250d,_0x3dd0a5)[_0x04fb('0xb')](function(_0x1894f){logger[_0x04fb('0xc')](_0x04fb('0xd'),_0x20d214,_0x04fb('0xe'));logger[_0x04fb('0xf')](_0x04fb('0x10'),_0x20d214,_0x04fb('0xe'),JSON[_0x04fb('0x11')](_0x1894f));if(_0x1894f[_0x04fb('0x12')]){if(_0x1894f['error'][_0x04fb('0x13')]===0x1f4){logger[_0x04fb('0x12')](_0x04fb('0xd'),_0x20d214,_0x1894f['error'][_0x04fb('0x14')]);return _0x2b7b20(_0x1894f[_0x04fb('0x12')]['message']);}logger['error'](_0x04fb('0xd'),_0x20d214,_0x1894f['error']['message']);return _0x6d0890(_0x1894f[_0x04fb('0x12')][_0x04fb('0x14')]);}else{logger[_0x04fb('0xc')](_0x04fb('0xd'),_0x20d214,_0x04fb('0xe'));_0x6d0890(_0x1894f[_0x04fb('0x15')][_0x04fb('0x14')]);}})[_0x04fb('0x16')](function(_0x44804f){logger[_0x04fb('0x12')]('Cdr,\x20%s,\x20%s',_0x20d214,_0x44804f);_0x2b7b20(_0x44804f);});});} \ No newline at end of file +var _0xfb10=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','Cdr,\x20%s,\x20%s','result','catch','util'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0xfb10,0x1ed));var _0x0fb1=function(_0x405f33,_0x49fa77){_0x405f33=_0x405f33-0x0;var _0x3b9b8d=_0xfb10[_0x405f33];return _0x3b9b8d;};'use strict';var _=require('lodash');var util=require(_0x0fb1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0fb1('0x1'));var fs=require('fs');var Redis=require(_0x0fb1('0x2'));var db=require(_0x0fb1('0x3'))['db'];var utils=require(_0x0fb1('0x4'));var logger=require(_0x0fb1('0x5'))('rpc');var config=require(_0x0fb1('0x6'));var jayson=require(_0x0fb1('0x7'));var client=jayson[_0x0fb1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15a2e6,_0x5ddf18,_0x543f20){return new BPromise(function(_0x106ccd,_0x266e7c){return client['request'](_0x15a2e6,_0x543f20)[_0x0fb1('0x9')](function(_0x5d4d21){logger[_0x0fb1('0xa')]('Cdr,\x20%s,\x20%s',_0x5ddf18,'request\x20sent');logger[_0x0fb1('0xb')](_0x0fb1('0xc'),_0x5ddf18,'request\x20sent',JSON[_0x0fb1('0xd')](_0x5d4d21));if(_0x5d4d21[_0x0fb1('0xe')]){if(_0x5d4d21[_0x0fb1('0xe')]['code']===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x5ddf18,_0x5d4d21[_0x0fb1('0xe')][_0x0fb1('0xf')]);return _0x266e7c(_0x5d4d21[_0x0fb1('0xe')][_0x0fb1('0xf')]);}logger[_0x0fb1('0xe')](_0x0fb1('0x10'),_0x5ddf18,_0x5d4d21[_0x0fb1('0xe')][_0x0fb1('0xf')]);return _0x106ccd(_0x5d4d21[_0x0fb1('0xe')][_0x0fb1('0xf')]);}else{logger[_0x0fb1('0xa')](_0x0fb1('0x10'),_0x5ddf18,'request\x20sent');_0x106ccd(_0x5d4d21[_0x0fb1('0x11')][_0x0fb1('0xf')]);}})[_0x0fb1('0x12')](function(_0x465484){logger[_0x0fb1('0xe')](_0x0fb1('0x10'),_0x5ddf18,_0x465484);_0x266e7c(_0x465484);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index a602672..3cd8256 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(_0x427572,_0x1d89f2){var _0x585590=function(_0x1699da){while(--_0x1699da){_0x427572['push'](_0x427572['shift']());}};_0x585590(++_0x1d89f2);}(_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('./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 _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(_0xa06e0b,_0x6c2305){var _0x14142f=function(_0x2ac612){while(--_0x2ac612){_0xa06e0b['push'](_0xa06e0b['shift']());}};_0x14142f(++_0x6c2305);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 7768580..6189207 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 _0x55fe=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x558c2e,_0x30a116){var _0x21c0c7=function(_0x1efd67){while(--_0x1efd67){_0x558c2e['push'](_0x558c2e['shift']());}};_0x21c0c7(++_0x30a116);}(_0x55fe,0x196));var _0xe55f=function(_0x4af0d1,_0x162b1a){_0x4af0d1=_0x4af0d1-0x0;var _0x2f6f4c=_0x55fe[_0x4af0d1];return _0x2f6f4c;};'use strict';var Sequelize=require('sequelize');module[_0xe55f('0x0')]={'priority':{'type':Sequelize[_0xe55f('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xe55f('0x2')],'allowNull':![],'defaultValue':_0xe55f('0x3')},'appdata':{'type':Sequelize[_0xe55f('0x4')]()},'description':{'type':Sequelize[_0xe55f('0x2')]},'interval':{'type':Sequelize[_0xe55f('0x2')],'defaultValue':_0xe55f('0x5')}}; \ No newline at end of file +var _0x00a8=['*,*,*,*','sequelize','exports','STRING','TEXT'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x00a8,0x6f));var _0x800a=function(_0x411272,_0x5c5851){_0x411272=_0x411272-0x0;var _0x27f560=_0x00a8[_0x411272];return _0x27f560;};'use strict';var Sequelize=require(_0x800a('0x0'));module[_0x800a('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x800a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x800a('0x3')]()},'description':{'type':Sequelize[_0x800a('0x2')]},'interval':{'type':Sequelize[_0x800a('0x2')],'defaultValue':_0x800a('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 7f4b5e3..42b1b80 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 _0x81d5=['rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','name','params','model','keys','ChatApplication'];(function(_0x341860,_0x59ee1b){var _0x1fafb9=function(_0x42701f){while(--_0x42701f){_0x341860['push'](_0x341860['shift']());}};_0x1fafb9(++_0x59ee1b);}(_0x81d5,0x1ab));var _0x581d=function(_0x18994f,_0x4fc7ab){_0x18994f=_0x18994f-0x0;var _0x2aecb0=_0x81d5[_0x18994f];return _0x2aecb0;};'use strict';var emlformat=require(_0x581d('0x0'));var rimraf=require(_0x581d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x581d('0x2'));var rp=require(_0x581d('0x3'));var moment=require(_0x581d('0x4'));var BPromise=require(_0x581d('0x5'));var Mustache=require(_0x581d('0x6'));var util=require('util');var path=require('path');var sox=require(_0x581d('0x7'));var csv=require(_0x581d('0x8'));var ejs=require(_0x581d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x581d('0xa'));var squel=require(_0x581d('0xb'));var crypto=require(_0x581d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x581d('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x581d('0xe'));var authService=require(_0x581d('0xf'));var qs=require(_0x581d('0x10'));var as=require(_0x581d('0x11'));var hardwareService=require(_0x581d('0x12'));var logger=require('../../config/logger')(_0x581d('0x13'));var utils=require(_0x581d('0x14'));var config=require(_0x581d('0x15'));var licenseUtil=require(_0x581d('0x16'));var db=require(_0x581d('0x17'))['db'];function respondWithStatusCode(_0x271bd1,_0x1fb6ed){_0x1fb6ed=_0x1fb6ed||0xcc;return function(_0x3329cc){if(_0x3329cc){return _0x271bd1[_0x581d('0x18')](_0x1fb6ed);}return _0x271bd1[_0x581d('0x19')](_0x1fb6ed)['end']();};}function respondWithResult(_0x338c88,_0xfab29f){_0xfab29f=_0xfab29f||0xc8;return function(_0x51a035){if(_0x51a035){return _0x338c88['status'](_0xfab29f)['json'](_0x51a035);}};}function respondWithFilteredResult(_0x4deffa,_0x110e13){return function(_0x550365){if(_0x550365){var _0x1d609f=typeof _0x110e13[_0x581d('0x1a')]==='undefined'&&typeof _0x110e13[_0x581d('0x1b')]==='undefined';var _0x3172f6=_0x550365[_0x581d('0x1c')];var _0x1e059d=_0x1d609f?0x0:_0x110e13[_0x581d('0x1a')];var _0x1f790f=_0x1d609f?_0x550365[_0x581d('0x1c')]:_0x110e13[_0x581d('0x1a')]+_0x110e13['limit'];var _0x2be45b;if(_0x1f790f>=_0x3172f6){_0x1f790f=_0x3172f6;_0x2be45b=0xc8;}else{_0x2be45b=0xce;}_0x4deffa[_0x581d('0x19')](_0x2be45b);return _0x4deffa[_0x581d('0x1d')](_0x581d('0x1e'),_0x1e059d+'-'+_0x1f790f+'/'+_0x3172f6)[_0x581d('0x1f')](_0x550365);}return null;};}function patchUpdates(_0x2a2aba){return function(_0x4635a8){try{jsonpatch[_0x581d('0x20')](_0x4635a8,_0x2a2aba,!![]);}catch(_0x468543){return BPromise[_0x581d('0x21')](_0x468543);}return _0x4635a8[_0x581d('0x22')]();};}function saveUpdates(_0xf74d2b,_0x5add13){return function(_0xb96c3d){if(_0xb96c3d){return _0xb96c3d[_0x581d('0x23')](_0xf74d2b)[_0x581d('0x24')](function(_0x2a4cd9){return _0x2a4cd9;});}return null;};}function removeEntity(_0x2addd8,_0x4f7420){return function(_0x36cc8a){if(_0x36cc8a){return _0x36cc8a[_0x581d('0x25')]()['then'](function(){_0x2addd8[_0x581d('0x19')](0xcc)[_0x581d('0x26')]();});}};}function handleEntityNotFound(_0x2c8fdb,_0x5a3fd7){return function(_0x190545){if(!_0x190545){_0x2c8fdb[_0x581d('0x18')](0x194);}return _0x190545;};}function handleError(_0x146323,_0xc270bc){_0xc270bc=_0xc270bc||0x1f4;return function(_0x38f213){logger[_0x581d('0x27')](_0x38f213['stack']);if(_0x38f213[_0x581d('0x28')]){delete _0x38f213[_0x581d('0x28')];}_0x146323[_0x581d('0x19')](_0xc270bc)['send'](_0x38f213);};}exports['show']=function(_0x504f71,_0x489682){var _0x355efe={'raw':!![],'where':{'id':_0x504f71[_0x581d('0x29')]['id']}},_0x266a2b={};_0x266a2b[_0x581d('0x2a')]=_[_0x581d('0x2b')](db[_0x581d('0x2c')][_0x581d('0x2d')]);_0x266a2b[_0x581d('0x2e')]=_[_0x581d('0x2b')](_0x504f71[_0x581d('0x2e')]);_0x266a2b[_0x581d('0x2f')]=_['intersection'](_0x266a2b[_0x581d('0x2a')],_0x266a2b['query']);_0x355efe[_0x581d('0x30')]=_[_0x581d('0x31')](_0x266a2b[_0x581d('0x2a')],qs[_0x581d('0x32')](_0x504f71[_0x581d('0x2e')][_0x581d('0x32')]));_0x355efe['attributes']=_0x355efe[_0x581d('0x30')][_0x581d('0x33')]?_0x355efe['attributes']:_0x266a2b['model'];if(_0x504f71['query'][_0x581d('0x34')]){_0x355efe[_0x581d('0x35')]=[{'all':!![]}];}_0x355efe=_[_0x581d('0x36')]({},_0x355efe,_0x504f71[_0x581d('0x37')]);return db[_0x581d('0x2c')][_0x581d('0x38')](_0x355efe)[_0x581d('0x24')](handleEntityNotFound(_0x489682,null))['then'](respondWithResult(_0x489682,null))[_0x581d('0x39')](handleError(_0x489682,null));};exports[_0x581d('0x23')]=function(_0x55d184,_0x389e97){if(_0x55d184[_0x581d('0x3a')]['id']){delete _0x55d184[_0x581d('0x3a')]['id'];}return db[_0x581d('0x2c')][_0x581d('0x38')]({'where':{'id':_0x55d184['params']['id']}})[_0x581d('0x24')](handleEntityNotFound(_0x389e97,null))['then'](saveUpdates(_0x55d184[_0x581d('0x3a')],null))[_0x581d('0x24')](respondWithResult(_0x389e97,null))['catch'](handleError(_0x389e97,null));};exports['destroy']=function(_0x5eb9eb,_0x59fc1e){return db[_0x581d('0x2c')]['find']({'where':{'id':_0x5eb9eb[_0x581d('0x29')]['id']}})['then'](handleEntityNotFound(_0x59fc1e,null))[_0x581d('0x24')](removeEntity(_0x59fc1e,null))[_0x581d('0x39')](handleError(_0x59fc1e,null));}; \ No newline at end of file +var _0xa45c=['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','update','then','destroy','error','stack','name','send','show','params','keys','ChatApplication','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','request-promise','bluebird','util'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0xa45c,0x6d));var _0xca45=function(_0x289112,_0x36b9f2){_0x289112=_0x289112-0x0;var _0x19e669=_0xa45c[_0x289112];return _0x19e669;};'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={'raw':!![],'where':{'id':_0x4d546c[_0xca45('0x29')]['id']}},_0x430591={};_0x430591['model']=_[_0xca45('0x2a')](db[_0xca45('0x2b')][_0xca45('0x2c')]);_0x430591[_0xca45('0x2d')]=_['keys'](_0x4d546c['query']);_0x430591['filters']=_[_0xca45('0x2e')](_0x430591['model'],_0x430591['query']);_0x592ad2['attributes']=_[_0xca45('0x2e')](_0x430591['model'],qs['fields'](_0x4d546c[_0xca45('0x2d')][_0xca45('0x2f')]));_0x592ad2[_0xca45('0x30')]=_0x592ad2['attributes'][_0xca45('0x31')]?_0x592ad2[_0xca45('0x30')]:_0x430591['model'];if(_0x4d546c[_0xca45('0x2d')][_0xca45('0x32')]){_0x592ad2[_0xca45('0x33')]=[{'all':!![]}];}_0x592ad2=_[_0xca45('0x34')]({},_0x592ad2,_0x4d546c[_0xca45('0x35')]);return db[_0xca45('0x2b')][_0xca45('0x36')](_0x592ad2)[_0xca45('0x22')](handleEntityNotFound(_0x4da9b6,null))[_0xca45('0x22')](respondWithResult(_0x4da9b6,null))[_0xca45('0x37')](handleError(_0x4da9b6,null));};exports[_0xca45('0x21')]=function(_0x3045e7,_0x1d594c){if(_0x3045e7['body']['id']){delete _0x3045e7['body']['id'];}return db['ChatApplication'][_0xca45('0x36')]({'where':{'id':_0x3045e7[_0xca45('0x29')]['id']}})['then'](handleEntityNotFound(_0x1d594c,null))['then'](saveUpdates(_0x3045e7[_0xca45('0x38')],null))['then'](respondWithResult(_0x1d594c,null))[_0xca45('0x37')](handleError(_0x1d594c,null));};exports['destroy']=function(_0x4de1d0,_0x231043){return db[_0xca45('0x2b')][_0xca45('0x36')]({'where':{'id':_0x4de1d0[_0xca45('0x29')]['id']}})['then'](handleEntityNotFound(_0x231043,null))[_0xca45('0x22')](removeEntity(_0x231043,null))['catch'](handleError(_0x231043,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a232ab8..dd6da38 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 _0xf25a=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1857c6,_0x48840c){var _0x51011c=function(_0x3a4736){while(--_0x3a4736){_0x1857c6['push'](_0x1857c6['shift']());}};_0x51011c(++_0x48840c);}(_0xf25a,0x195));var _0xaf25=function(_0xbc0acd,_0x54cb30){_0xbc0acd=_0xbc0acd-0x0;var _0x2d563f=_0xf25a[_0xbc0acd];return _0x2d563f;};'use strict';var _=require(_0xaf25('0x0'));var util=require(_0xaf25('0x1'));var logger=require(_0xaf25('0x2'))('api');var moment=require(_0xaf25('0x3'));var BPromise=require(_0xaf25('0x4'));var rp=require(_0xaf25('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf25('0x6'));var config=require(_0xaf25('0x7'));var attributes=require(_0xaf25('0x8'));module['exports']=function(_0x49281b,_0x30eaae){return _0x49281b['define']('ChatApplication',attributes,{'tableName':_0xaf25('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaf25('0xa'),'collate':_0xaf25('0xb')});}; \ No newline at end of file +var _0xe7b3=['moment','bluebird','request-promise','rimraf','exports','define','lodash','api'];(function(_0x47872a,_0x2919a9){var _0x1cc71b=function(_0x275781){while(--_0x275781){_0x47872a['push'](_0x47872a['shift']());}};_0x1cc71b(++_0x2919a9);}(_0xe7b3,0x1b6));var _0x3e7b=function(_0x421322,_0x263804){_0x421322=_0x421322-0x0;var _0x48899e=_0xe7b3[_0x421322];return _0x48899e;};'use strict';var _=require(_0x3e7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e7b('0x1'));var moment=require(_0x3e7b('0x2'));var BPromise=require(_0x3e7b('0x3'));var rp=require(_0x3e7b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e7b('0x5'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0x3e7b('0x6')]=function(_0x1ac21f,_0x2506c4){return _0x1ac21f[_0x3e7b('0x7')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 68c2ab9..91249c2 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 _0x7825=['request','then','info','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x44b827,_0x1bb1aa){var _0x527342=function(_0x481338){while(--_0x481338){_0x44b827['push'](_0x44b827['shift']());}};_0x527342(++_0x1bb1aa);}(_0x7825,0x165));var _0x5782=function(_0x492445,_0x1454f9){_0x492445=_0x492445-0x0;var _0x34ca20=_0x7825[_0x492445];return _0x34ca20;};'use strict';var _=require('lodash');var util=require(_0x5782('0x0'));var moment=require(_0x5782('0x1'));var BPromise=require(_0x5782('0x2'));var rs=require(_0x5782('0x3'));var fs=require('fs');var Redis=require(_0x5782('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5782('0x5'));var logger=require(_0x5782('0x6'))(_0x5782('0x7'));var config=require(_0x5782('0x8'));var jayson=require(_0x5782('0x9'));var client=jayson[_0x5782('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27e23a,_0xb8da92,_0x393f53){return new BPromise(function(_0x494c42,_0x4b6de9){return client[_0x5782('0xb')](_0x27e23a,_0x393f53)[_0x5782('0xc')](function(_0x7bfff1){logger[_0x5782('0xd')]('ChatApplication,\x20%s,\x20%s',_0xb8da92,'request\x20sent');logger['debug'](_0x5782('0xe'),_0xb8da92,_0x5782('0xf'),JSON[_0x5782('0x10')](_0x7bfff1));if(_0x7bfff1['error']){if(_0x7bfff1['error'][_0x5782('0x11')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0xb8da92,_0x7bfff1['error']['message']);return _0x4b6de9(_0x7bfff1[_0x5782('0x12')]['message']);}logger[_0x5782('0x12')](_0x5782('0x13'),_0xb8da92,_0x7bfff1[_0x5782('0x12')][_0x5782('0x14')]);return _0x494c42(_0x7bfff1[_0x5782('0x12')][_0x5782('0x14')]);}else{logger[_0x5782('0xd')](_0x5782('0x13'),_0xb8da92,_0x5782('0xf'));_0x494c42(_0x7bfff1[_0x5782('0x15')][_0x5782('0x14')]);}})[_0x5782('0x16')](function(_0x4aa9b6){logger['error'](_0x5782('0x13'),_0xb8da92,_0x4aa9b6);_0x4b6de9(_0x4aa9b6);});});} \ No newline at end of file +var _0xa923=['client','request','then','info','ChatApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa923,0xa5));var _0x3a92=function(_0x511a9a,_0x2f28e6){_0x511a9a=_0x511a9a-0x0;var _0x46b11e=_0xa923[_0x511a9a];return _0x46b11e;};'use strict';var _=require(_0x3a92('0x0'));var util=require(_0x3a92('0x1'));var moment=require(_0x3a92('0x2'));var BPromise=require(_0x3a92('0x3'));var rs=require(_0x3a92('0x4'));var fs=require('fs');var Redis=require(_0x3a92('0x5'));var db=require(_0x3a92('0x6'))['db'];var utils=require(_0x3a92('0x7'));var logger=require(_0x3a92('0x8'))('rpc');var config=require(_0x3a92('0x9'));var jayson=require(_0x3a92('0xa'));var client=jayson[_0x3a92('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c9cc0,_0x389161,_0xe64a53){return new BPromise(function(_0x4c3386,_0x865afe){return client[_0x3a92('0xc')](_0x4c9cc0,_0xe64a53)[_0x3a92('0xd')](function(_0x2f4e3d){logger[_0x3a92('0xe')](_0x3a92('0xf'),_0x389161,'request\x20sent');logger[_0x3a92('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x389161,_0x3a92('0x11'),JSON['stringify'](_0x2f4e3d));if(_0x2f4e3d['error']){if(_0x2f4e3d[_0x3a92('0x12')][_0x3a92('0x13')]===0x1f4){logger['error'](_0x3a92('0xf'),_0x389161,_0x2f4e3d[_0x3a92('0x12')]['message']);return _0x865afe(_0x2f4e3d[_0x3a92('0x12')][_0x3a92('0x14')]);}logger['error'](_0x3a92('0xf'),_0x389161,_0x2f4e3d[_0x3a92('0x12')]['message']);return _0x4c3386(_0x2f4e3d[_0x3a92('0x12')][_0x3a92('0x14')]);}else{logger['info']('ChatApplication,\x20%s,\x20%s',_0x389161,_0x3a92('0x11'));_0x4c3386(_0x2f4e3d[_0x3a92('0x15')][_0x3a92('0x14')]);}})['catch'](function(_0x41d1e5){logger['error'](_0x3a92('0xf'),_0x389161,_0x41d1e5);_0x865afe(_0x41d1e5);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index efe6f02..556ff25 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 _0x9649=['../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x9649,0x120));var _0x9964=function(_0x456e1e,_0x5b4678){_0x456e1e=_0x456e1e-0x0;var _0x38ce80=_0x9649[_0x456e1e];return _0x38ce80;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9964('0x0'));var timeout=require(_0x9964('0x1'));var express=require(_0x9964('0x2'));var router=express[_0x9964('0x3')]();var fs_extra=require(_0x9964('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9964('0x5'));var config=require(_0x9964('0x6'));var controller=require(_0x9964('0x7'));router[_0x9964('0x8')](_0x9964('0x9'),auth[_0x9964('0xa')](),controller[_0x9964('0xb')]);router[_0x9964('0xc')](_0x9964('0x9'),auth[_0x9964('0xa')](),controller['update']);router['delete'](_0x9964('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9964('0xd')]=router; \ No newline at end of file +var _0xf151=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','show','put','/:id','isAuthenticated','delete','destroy','exports','multer'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xf151,0x1af));var _0x1f15=function(_0x295c83,_0x3d922c){_0x295c83=_0x295c83-0x0;var _0xb99aed=_0xf151[_0x295c83];return _0xb99aed;};'use strict';var multer=require(_0x1f15('0x0'));var util=require(_0x1f15('0x1'));var path=require(_0x1f15('0x2'));var timeout=require(_0x1f15('0x3'));var express=require(_0x1f15('0x4'));var router=express[_0x1f15('0x5')]();var fs_extra=require(_0x1f15('0x6'));var auth=require(_0x1f15('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1f15('0x8'));var controller=require(_0x1f15('0x9'));router[_0x1f15('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x1f15('0xb')]);router[_0x1f15('0xc')](_0x1f15('0xd'),auth[_0x1f15('0xe')](),controller['update']);router[_0x1f15('0xf')]('/:id',auth[_0x1f15('0xe')](),controller[_0x1f15('0x10')]);module[_0x1f15('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 2f56d81..8dac48a 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 _0x9b25=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3f2536,_0x13c082){var _0xc478f6=function(_0x585cb4){while(--_0x585cb4){_0x3f2536['push'](_0x3f2536['shift']());}};_0xc478f6(++_0x13c082);}(_0x9b25,0x1be));var _0x59b2=function(_0x142c42,_0x5963fe){_0x142c42=_0x142c42-0x0;var _0x51cf8f=_0x9b25[_0x142c42];return _0x51cf8f;};'use strict';var Sequelize=require(_0x59b2('0x0'));module[_0x59b2('0x1')]={'name':{'type':Sequelize[_0x59b2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x59b2('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0496=['BOOLEAN','sequelize','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0496,0x199));var _0x6049=function(_0x3d3ed3,_0x5de6fe){_0x3d3ed3=_0x3d3ed3-0x0;var _0x10223f=_0x0496[_0x3d3ed3];return _0x10223f;};'use strict';var Sequelize=require(_0x6049('0x0'));module['exports']={'name':{'type':Sequelize[_0x6049('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6049('0x1')]},'write':{'type':Sequelize[_0x6049('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b8bc365..0fb1a70 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 _0x9fe5=['fieldName','type','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','merge','options','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','findOne','User','order','getMembers','removeMembers','addMessage','ChatGroupId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','index','map','ChatGroup','rawAttributes'];(function(_0x5b1aed,_0x322c17){var _0x26add8=function(_0x58a9d7){while(--_0x58a9d7){_0x5b1aed['push'](_0x5b1aed['shift']());}};_0x26add8(++_0x322c17);}(_0x9fe5,0x152));var _0x59fe=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9fe5[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x59fe('0x0'));var zipdir=require(_0x59fe('0x1'));var jsonpatch=require(_0x59fe('0x2'));var rp=require(_0x59fe('0x3'));var moment=require(_0x59fe('0x4'));var BPromise=require(_0x59fe('0x5'));var Mustache=require(_0x59fe('0x6'));var util=require(_0x59fe('0x7'));var path=require(_0x59fe('0x8'));var sox=require(_0x59fe('0x9'));var csv=require(_0x59fe('0xa'));var ejs=require(_0x59fe('0xb'));var fs=require('fs');var fs_extra=require(_0x59fe('0xc'));var _=require(_0x59fe('0xd'));var squel=require(_0x59fe('0xe'));var crypto=require('crypto');var jsforce=require(_0x59fe('0xf'));var deskjs=require(_0x59fe('0x10'));var toCsv=require(_0x59fe('0xa'));var querystring=require(_0x59fe('0x11'));var Papa=require(_0x59fe('0x12'));var Redis=require(_0x59fe('0x13'));var authService=require(_0x59fe('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x59fe('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59fe('0x16'))(_0x59fe('0x17'));var utils=require(_0x59fe('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x59fe('0x19'));var db=require('../../mysqldb')['db'];config[_0x59fe('0x1a')]=_['defaults'](config[_0x59fe('0x1a')],{'host':_0x59fe('0x1b'),'port':0x18eb});var socket=require(_0x59fe('0x1c'))(new Redis(config[_0x59fe('0x1a')]));require('./chatGroup.socket')[_0x59fe('0x1d')](socket);function respondWithStatusCode(_0x21e077,_0x5ef6d7){_0x5ef6d7=_0x5ef6d7||0xcc;return function(_0xc18358){if(_0xc18358){return _0x21e077['sendStatus'](_0x5ef6d7);}return _0x21e077[_0x59fe('0x1e')](_0x5ef6d7)[_0x59fe('0x1f')]();};}function respondWithResult(_0x3482a8,_0x1c571e){_0x1c571e=_0x1c571e||0xc8;return function(_0x225501){if(_0x225501){return _0x3482a8[_0x59fe('0x1e')](_0x1c571e)[_0x59fe('0x20')](_0x225501);}};}function respondWithFilteredResult(_0x2f324a,_0x9132bb){return function(_0xeafea){if(_0xeafea){var _0xa5b2c9=typeof _0x9132bb[_0x59fe('0x21')]===_0x59fe('0x22')&&typeof _0x9132bb['limit']===_0x59fe('0x22');var _0x5ebd27=_0xeafea[_0x59fe('0x23')];var _0x4bbe23=_0xa5b2c9?0x0:_0x9132bb[_0x59fe('0x21')];var _0x3a5502=_0xa5b2c9?_0xeafea['count']:_0x9132bb[_0x59fe('0x21')]+_0x9132bb['limit'];var _0x404539;if(_0x3a5502>=_0x5ebd27){_0x3a5502=_0x5ebd27;_0x404539=0xc8;}else{_0x404539=0xce;}_0x2f324a[_0x59fe('0x1e')](_0x404539);return _0x2f324a[_0x59fe('0x24')](_0x59fe('0x25'),_0x4bbe23+'-'+_0x3a5502+'/'+_0x5ebd27)[_0x59fe('0x20')](_0xeafea);}return null;};}function patchUpdates(_0xa43437){return function(_0x3c2d82){try{jsonpatch[_0x59fe('0x26')](_0x3c2d82,_0xa43437,!![]);}catch(_0x16baf0){return BPromise[_0x59fe('0x27')](_0x16baf0);}return _0x3c2d82['save']();};}function saveUpdates(_0x3710d5,_0x68aad3){return function(_0x326c0f){if(_0x326c0f){return _0x326c0f[_0x59fe('0x28')](_0x3710d5)['then'](function(_0x1e32fa){return _0x1e32fa;});}return null;};}function removeEntity(_0x538f4d,_0x1f39b0){return function(_0x3ccf3f){if(_0x3ccf3f){return _0x3ccf3f['destroy']()[_0x59fe('0x29')](function(){_0x538f4d[_0x59fe('0x1e')](0xcc)[_0x59fe('0x1f')]();});}};}function handleEntityNotFound(_0x4a898c,_0x5203dd){return function(_0x237bad){if(!_0x237bad){_0x4a898c[_0x59fe('0x2a')](0x194);}return _0x237bad;};}function handleError(_0x804578,_0x5b51fd){_0x5b51fd=_0x5b51fd||0x1f4;return function(_0x25ec96){logger[_0x59fe('0x2b')](_0x25ec96['stack']);if(_0x25ec96[_0x59fe('0x2c')]){delete _0x25ec96[_0x59fe('0x2c')];}_0x804578[_0x59fe('0x1e')](_0x5b51fd)[_0x59fe('0x2d')](_0x25ec96);};}exports[_0x59fe('0x2e')]=function(_0x2c6e06,_0x21923e){var _0xe9235e={},_0x5b2fec={},_0x3f9db1={'count':0x0,'rows':[]};var _0x4ad401=_[_0x59fe('0x2f')](db[_0x59fe('0x30')][_0x59fe('0x31')],function(_0x534c39){return{'name':_0x534c39[_0x59fe('0x32')],'type':_0x534c39[_0x59fe('0x33')]['key']};});_0x5b2fec['model']=_[_0x59fe('0x2f')](_0x4ad401,_0x59fe('0x2c'));_0x5b2fec[_0x59fe('0x34')]=_['keys'](_0x2c6e06[_0x59fe('0x34')]);_0x5b2fec[_0x59fe('0x35')]=_['intersection'](_0x5b2fec['model'],_0x5b2fec[_0x59fe('0x34')]);_0xe9235e[_0x59fe('0x36')]=_[_0x59fe('0x37')](_0x5b2fec[_0x59fe('0x38')],qs[_0x59fe('0x39')](_0x2c6e06[_0x59fe('0x34')][_0x59fe('0x39')]));_0xe9235e['attributes']=_0xe9235e['attributes'][_0x59fe('0x3a')]?_0xe9235e[_0x59fe('0x36')]:_0x5b2fec[_0x59fe('0x38')];if(!_0x2c6e06[_0x59fe('0x34')][_0x59fe('0x3b')](_0x59fe('0x3c'))){_0xe9235e['limit']=qs[_0x59fe('0x3d')](_0x2c6e06['query'][_0x59fe('0x3d')]);_0xe9235e[_0x59fe('0x21')]=qs[_0x59fe('0x21')](_0x2c6e06['query']['offset']);}_0xe9235e['order']=qs[_0x59fe('0x3e')](_0x2c6e06[_0x59fe('0x34')][_0x59fe('0x3e')]);_0xe9235e[_0x59fe('0x3f')]=qs[_0x59fe('0x35')](_[_0x59fe('0x40')](_0x2c6e06[_0x59fe('0x34')],_0x5b2fec[_0x59fe('0x35')]),_0x4ad401);if(_0x2c6e06[_0x59fe('0x34')][_0x59fe('0x41')]){_0xe9235e['where']=_['merge'](_0xe9235e[_0x59fe('0x3f')],{'$or':_['map'](_0x4ad401,function(_0x53b313){if(_0x53b313['type']!==_0x59fe('0x42')){var _0xb9a84e={};_0xb9a84e[_0x53b313[_0x59fe('0x2c')]]={'$like':'%'+_0x2c6e06[_0x59fe('0x34')]['filter']+'%'};return _0xb9a84e;}})});}_0xe9235e=_['merge']({},_0xe9235e,_0x2c6e06['options']);var _0x3c73a9={'where':_0xe9235e[_0x59fe('0x3f')]};return db[_0x59fe('0x30')][_0x59fe('0x23')](_0x3c73a9)[_0x59fe('0x29')](function(_0x503cdd){_0x3f9db1[_0x59fe('0x23')]=_0x503cdd;if(_0x2c6e06[_0x59fe('0x34')][_0x59fe('0x43')]){_0xe9235e[_0x59fe('0x44')]=[{'all':!![]}];}return db[_0x59fe('0x30')][_0x59fe('0x45')](_0xe9235e);})[_0x59fe('0x29')](function(_0x252f75){_0x3f9db1['rows']=_0x252f75;return _0x3f9db1;})['then'](respondWithFilteredResult(_0x21923e,_0xe9235e))[_0x59fe('0x46')](handleError(_0x21923e,null));};exports[_0x59fe('0x47')]=function(_0x143710,_0x2ead83){var _0x4c6886={'raw':!![],'where':{'id':_0x143710[_0x59fe('0x48')]['id']}},_0x28cf5d={};_0x28cf5d['model']=_[_0x59fe('0x49')](db[_0x59fe('0x30')][_0x59fe('0x31')]);_0x28cf5d[_0x59fe('0x34')]=_[_0x59fe('0x49')](_0x143710[_0x59fe('0x34')]);_0x28cf5d['filters']=_[_0x59fe('0x37')](_0x28cf5d['model'],_0x28cf5d[_0x59fe('0x34')]);_0x4c6886[_0x59fe('0x36')]=_[_0x59fe('0x37')](_0x28cf5d['model'],qs[_0x59fe('0x39')](_0x143710[_0x59fe('0x34')][_0x59fe('0x39')]));_0x4c6886[_0x59fe('0x36')]=_0x4c6886[_0x59fe('0x36')][_0x59fe('0x3a')]?_0x4c6886[_0x59fe('0x36')]:_0x28cf5d['model'];if(_0x143710[_0x59fe('0x34')][_0x59fe('0x43')]){_0x4c6886['include']=[{'all':!![]}];}_0x4c6886=_[_0x59fe('0x4a')]({},_0x4c6886,_0x143710[_0x59fe('0x4b')]);return db['ChatGroup'][_0x59fe('0x4c')](_0x4c6886)[_0x59fe('0x29')](handleEntityNotFound(_0x2ead83,null))[_0x59fe('0x29')](respondWithResult(_0x2ead83,null))[_0x59fe('0x46')](handleError(_0x2ead83,null));};exports[_0x59fe('0x4d')]=function(_0x2caa18,_0x439ef1){return db['ChatGroup'][_0x59fe('0x4d')](_0x2caa18[_0x59fe('0x4e')],{})[_0x59fe('0x29')](respondWithResult(_0x439ef1,0xc9))[_0x59fe('0x46')](handleError(_0x439ef1,null));};exports[_0x59fe('0x28')]=function(_0x4dd72e,_0x5e69a4){if(_0x4dd72e[_0x59fe('0x4e')]['id']){delete _0x4dd72e[_0x59fe('0x4e')]['id'];}return db['ChatGroup'][_0x59fe('0x4c')]({'where':{'id':_0x4dd72e['params']['id']}})[_0x59fe('0x29')](handleEntityNotFound(_0x5e69a4,null))[_0x59fe('0x29')](saveUpdates(_0x4dd72e['body'],null))[_0x59fe('0x29')](respondWithResult(_0x5e69a4,null))[_0x59fe('0x46')](handleError(_0x5e69a4,null));};exports['destroy']=function(_0x3b4305,_0xa6dc4){return db[_0x59fe('0x30')][_0x59fe('0x4c')]({'where':{'id':_0x3b4305[_0x59fe('0x48')]['id']}})[_0x59fe('0x29')](handleEntityNotFound(_0xa6dc4,null))[_0x59fe('0x29')](removeEntity(_0xa6dc4,null))[_0x59fe('0x46')](handleError(_0xa6dc4,null));};exports[_0x59fe('0x4f')]=function(_0x4ba075,_0x21eb32){return db['ChatGroup'][_0x59fe('0x4f')]()[_0x59fe('0x29')](respondWithResult(_0x21eb32,null))[_0x59fe('0x46')](handleError(_0x21eb32,null));};exports[_0x59fe('0x50')]=function(_0x57e275,_0x216afa,_0x59f17f){return db[_0x59fe('0x51')][_0x59fe('0x23')]({'where':{'ChatGroupId':_0x57e275['params']['id'],'ToId':_0x57e275[_0x59fe('0x52')]['id'],'read':![]}})[_0x59fe('0x29')](function(_0x4bb90c){return{'id':_['toInteger'](_0x57e275['params']['id']),'count':_0x4bb90c};})[_0x59fe('0x29')](respondWithResult(_0x216afa,null))[_0x59fe('0x46')](handleError(_0x216afa,null));};exports[_0x59fe('0x53')]=function(_0x277255,_0x575524,_0x51e608){return db[_0x59fe('0x30')][_0x59fe('0x4c')]({'where':{'id':_0x277255[_0x59fe('0x48')]['id']}})[_0x59fe('0x29')](handleEntityNotFound(_0x575524,null))[_0x59fe('0x29')](function(_0x3dab85){if(_0x3dab85){return _0x3dab85[_0x59fe('0x53')](_0x277255[_0x59fe('0x4e')][_0x59fe('0x54')],_[_0x59fe('0x55')](_0x277255['body'],[_0x59fe('0x54'),'id'])||{});}})[_0x59fe('0x29')](respondWithResult(_0x575524,null))[_0x59fe('0x46')](handleError(_0x575524,null));};exports['getMembers']=function(_0x3a37a2,_0x162e96,_0x253406){var _0x40c893={};var _0x498f69={};var _0x1785a2;var _0x4bc1d7;return db['ChatGroup'][_0x59fe('0x56')]({'where':{'id':_0x3a37a2[_0x59fe('0x48')]['id']}})[_0x59fe('0x29')](handleEntityNotFound(_0x162e96,null))['then'](function(_0x33e455){if(_0x33e455){_0x1785a2=_0x33e455;_0x498f69['model']=_[_0x59fe('0x49')](db[_0x59fe('0x57')]['rawAttributes']);_0x498f69[_0x59fe('0x34')]=_[_0x59fe('0x49')](_0x3a37a2[_0x59fe('0x34')]);_0x498f69[_0x59fe('0x35')]=_[_0x59fe('0x37')](_0x498f69[_0x59fe('0x38')],_0x498f69[_0x59fe('0x34')]);_0x40c893[_0x59fe('0x36')]=_[_0x59fe('0x37')](_0x498f69[_0x59fe('0x38')],qs[_0x59fe('0x39')](_0x3a37a2[_0x59fe('0x34')]['fields']));_0x40c893['attributes']=_0x40c893[_0x59fe('0x36')]['length']?_0x40c893[_0x59fe('0x36')]:_0x498f69[_0x59fe('0x38')];_0x40c893[_0x59fe('0x58')]=qs['sort'](_0x3a37a2[_0x59fe('0x34')][_0x59fe('0x3e')]);_0x40c893['where']=qs['filters'](_[_0x59fe('0x40')](_0x3a37a2[_0x59fe('0x34')],_0x498f69[_0x59fe('0x35')]));if(_0x3a37a2[_0x59fe('0x34')][_0x59fe('0x41')]){_0x40c893[_0x59fe('0x3f')]=_[_0x59fe('0x4a')](_0x40c893[_0x59fe('0x3f')],{'$or':_['map'](_0x40c893[_0x59fe('0x36')],function(_0x5cbbcf){var _0x575978={};_0x575978[_0x5cbbcf]={'$like':'%'+_0x3a37a2['query'][_0x59fe('0x41')]+'%'};return _0x575978;})});}_0x40c893=_[_0x59fe('0x4a')]({},_0x40c893,_0x3a37a2['options']);return _0x1785a2[_0x59fe('0x59')](_0x40c893);}})[_0x59fe('0x29')](function(_0x1fd914){if(_0x1fd914){_0x4bc1d7=_0x1fd914[_0x59fe('0x3a')];if(!_0x3a37a2['query']['hasOwnProperty'](_0x59fe('0x3c'))){_0x40c893['limit']=qs['limit'](_0x3a37a2[_0x59fe('0x34')][_0x59fe('0x3d')]);_0x40c893['offset']=qs['offset'](_0x3a37a2[_0x59fe('0x34')][_0x59fe('0x21')]);}return _0x1785a2[_0x59fe('0x59')](_0x40c893);}})['then'](function(_0x2a4ebd){if(_0x2a4ebd){return _0x2a4ebd?{'count':_0x4bc1d7,'rows':_0x2a4ebd}:null;}})[_0x59fe('0x29')](respondWithResult(_0x162e96,null))[_0x59fe('0x46')](handleError(_0x162e96,null));};exports[_0x59fe('0x5a')]=function(_0x21cd13,_0x314550,_0x45d084){return db['ChatGroup']['find']({'where':{'id':_0x21cd13[_0x59fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x314550,null))[_0x59fe('0x29')](function(_0x429c82){if(_0x429c82){return _0x429c82['removeMembers'](_0x21cd13[_0x59fe('0x34')][_0x59fe('0x54')]);}})[_0x59fe('0x29')](respondWithStatusCode(_0x314550,null))[_0x59fe('0x46')](handleError(_0x314550,null));};exports[_0x59fe('0x5b')]=function(_0x2637fd,_0x4345e4,_0x807c19){if(_0x2637fd[_0x59fe('0x4e')]['id']){delete _0x2637fd['body']['id'];}return db[_0x59fe('0x30')][_0x59fe('0x4c')]({'where':{'id':_0x2637fd[_0x59fe('0x48')]['id']}})[_0x59fe('0x29')](handleEntityNotFound(_0x4345e4,null))[_0x59fe('0x29')](function(_0x2c9778){if(_0x2c9778){_0x2637fd[_0x59fe('0x4e')][_0x59fe('0x5c')]=_0x2c9778['id'];return db[_0x59fe('0x51')][_0x59fe('0x4d')](_0x2637fd[_0x59fe('0x4e')]);}})['then'](respondWithResult(_0x4345e4,null))[_0x59fe('0x46')](handleError(_0x4345e4,null));};exports['getMessages']=function(_0xfa00b0,_0x309c12,_0x2b5911){var _0x4a8766={};var _0x12cc6c={};var _0x581807;var _0xa450fb;return db[_0x59fe('0x30')][_0x59fe('0x56')]({'where':{'id':_0xfa00b0['params']['id']}})[_0x59fe('0x29')](handleEntityNotFound(_0x309c12,null))['then'](function(_0x2429fc){if(_0x2429fc){_0x581807=_0x2429fc;_0x12cc6c[_0x59fe('0x38')]=_['keys'](db['ChatInternalMessage'][_0x59fe('0x31')]);_0x12cc6c['query']=_[_0x59fe('0x49')](_0xfa00b0[_0x59fe('0x34')]);_0x12cc6c[_0x59fe('0x35')]=_['intersection'](_0x12cc6c[_0x59fe('0x38')],_0x12cc6c[_0x59fe('0x34')]);_0x4a8766[_0x59fe('0x36')]=_['intersection'](_0x12cc6c['model'],qs[_0x59fe('0x39')](_0xfa00b0[_0x59fe('0x34')][_0x59fe('0x39')]));_0x4a8766['attributes']=_0x4a8766['attributes'][_0x59fe('0x3a')]?_0x4a8766[_0x59fe('0x36')]:_0x12cc6c[_0x59fe('0x38')];_0x4a8766['order']=qs[_0x59fe('0x3e')](_0xfa00b0[_0x59fe('0x34')]['sort']);_0x4a8766[_0x59fe('0x3f')]=qs[_0x59fe('0x35')](_[_0x59fe('0x40')](_0xfa00b0[_0x59fe('0x34')],_0x12cc6c[_0x59fe('0x35')]));if(_0xfa00b0[_0x59fe('0x34')][_0x59fe('0x41')]){_0x4a8766[_0x59fe('0x3f')]=_[_0x59fe('0x4a')](_0x4a8766['where'],{'$or':_[_0x59fe('0x2f')](_0x4a8766[_0x59fe('0x36')],function(_0x459378){var _0xb8ad79={};_0xb8ad79[_0x459378]={'$like':'%'+_0xfa00b0['query']['filter']+'%'};return _0xb8ad79;})});}if(_0xfa00b0['query'][_0x59fe('0x5d')]){var _0x4477ed=_0xfa00b0[_0x59fe('0x34')][_0x59fe('0x5d')][_0x59fe('0x5e')](',');var _0x4a971b={};_0x4a971b[_0x4477ed[0x0]]={'$gte':moment(_0x4477ed[0x1])['format'](_0x59fe('0x5f'))};_0x4a8766[_0x59fe('0x3f')]=_['merge'](_0x4a8766[_0x59fe('0x3f')],_0x4a971b);}_0x4a8766=_[_0x59fe('0x4a')]({},_0x4a8766,_0xfa00b0['options']);return _0x581807['getMessages'](_0x4a8766);}})[_0x59fe('0x29')](function(_0x37b23e){if(_0x37b23e){_0xa450fb=_0x37b23e[_0x59fe('0x3a')];if(!_0xfa00b0[_0x59fe('0x34')]['hasOwnProperty'](_0x59fe('0x3c'))){_0x4a8766[_0x59fe('0x3d')]=qs[_0x59fe('0x3d')](_0xfa00b0['query'][_0x59fe('0x3d')]);_0x4a8766['offset']=qs[_0x59fe('0x21')](_0xfa00b0[_0x59fe('0x34')]['offset']);}return _0x581807[_0x59fe('0x60')](_0x4a8766);}})[_0x59fe('0x29')](function(_0xa634ab){if(_0xa634ab){return _0xa634ab?{'count':_0xa450fb,'rows':_0xa634ab}:null;}})['then'](respondWithResult(_0x309c12,null))[_0x59fe('0x46')](handleError(_0x309c12,null));}; \ No newline at end of file +var _0x8885=['../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','then','destroy','error','name','send','index','map','ChatGroup','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x118be1,_0x2ee67b){var _0x402517=function(_0x1a3526){while(--_0x1a3526){_0x118be1['push'](_0x118be1['shift']());}};_0x402517(++_0x2ee67b);}(_0x8885,0xab));var _0x5888=function(_0xa22f4e,_0x205c84){_0xa22f4e=_0xa22f4e-0x0;var _0xb2a0a9=_0x8885[_0xa22f4e];return _0xb2a0a9;};'use strict';var emlformat=require(_0x5888('0x0'));var rimraf=require(_0x5888('0x1'));var zipdir=require(_0x5888('0x2'));var jsonpatch=require(_0x5888('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5888('0x4'));var Mustache=require(_0x5888('0x5'));var util=require(_0x5888('0x6'));var path=require(_0x5888('0x7'));var sox=require(_0x5888('0x8'));var csv=require('to-csv');var ejs=require(_0x5888('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5888('0xa'));var squel=require(_0x5888('0xb'));var crypto=require(_0x5888('0xc'));var jsforce=require(_0x5888('0xd'));var deskjs=require(_0x5888('0xe'));var toCsv=require(_0x5888('0xf'));var querystring=require(_0x5888('0x10'));var Papa=require(_0x5888('0x11'));var Redis=require(_0x5888('0x12'));var authService=require(_0x5888('0x13'));var qs=require(_0x5888('0x14'));var as=require(_0x5888('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5888('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x5888('0x17'));var licenseUtil=require(_0x5888('0x18'));var db=require(_0x5888('0x19'))['db'];config['redis']=_['defaults'](config[_0x5888('0x1a')],{'host':_0x5888('0x1b'),'port':0x18eb});var socket=require(_0x5888('0x1c'))(new Redis(config[_0x5888('0x1a')]));require(_0x5888('0x1d'))[_0x5888('0x1e')](socket);function respondWithStatusCode(_0x52dce8,_0x1f1402){_0x1f1402=_0x1f1402||0xcc;return function(_0x123f07){if(_0x123f07){return _0x52dce8['sendStatus'](_0x1f1402);}return _0x52dce8[_0x5888('0x1f')](_0x1f1402)[_0x5888('0x20')]();};}function respondWithResult(_0x28dc21,_0x4df586){_0x4df586=_0x4df586||0xc8;return function(_0x81a3cd){if(_0x81a3cd){return _0x28dc21[_0x5888('0x1f')](_0x4df586)[_0x5888('0x21')](_0x81a3cd);}};}function respondWithFilteredResult(_0x224370,_0x1d99c2){return function(_0x4a9347){if(_0x4a9347){var _0x2616b3=typeof _0x1d99c2[_0x5888('0x22')]==='undefined'&&typeof _0x1d99c2[_0x5888('0x23')]===_0x5888('0x24');var _0x5cf452=_0x4a9347[_0x5888('0x25')];var _0x572ac8=_0x2616b3?0x0:_0x1d99c2['offset'];var _0x38098f=_0x2616b3?_0x4a9347[_0x5888('0x25')]:_0x1d99c2[_0x5888('0x22')]+_0x1d99c2[_0x5888('0x23')];var _0x233768;if(_0x38098f>=_0x5cf452){_0x38098f=_0x5cf452;_0x233768=0xc8;}else{_0x233768=0xce;}_0x224370[_0x5888('0x1f')](_0x233768);return _0x224370['set'](_0x5888('0x26'),_0x572ac8+'-'+_0x38098f+'/'+_0x5cf452)[_0x5888('0x21')](_0x4a9347);}return null;};}function patchUpdates(_0x772c14){return function(_0x5d537b){try{jsonpatch['apply'](_0x5d537b,_0x772c14,!![]);}catch(_0xede875){return BPromise[_0x5888('0x27')](_0xede875);}return _0x5d537b[_0x5888('0x28')]();};}function saveUpdates(_0x58c087,_0x5f388b){return function(_0x195e4a){if(_0x195e4a){return _0x195e4a['update'](_0x58c087)[_0x5888('0x29')](function(_0x419f5a){return _0x419f5a;});}return null;};}function removeEntity(_0x427ff2,_0x2a5deb){return function(_0x1b2bdf){if(_0x1b2bdf){return _0x1b2bdf[_0x5888('0x2a')]()[_0x5888('0x29')](function(){_0x427ff2[_0x5888('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c761d,_0x553663){return function(_0x4a660b){if(!_0x4a660b){_0x5c761d['sendStatus'](0x194);}return _0x4a660b;};}function handleError(_0x2a7357,_0x4fd949){_0x4fd949=_0x4fd949||0x1f4;return function(_0x42fbb3){logger[_0x5888('0x2b')](_0x42fbb3['stack']);if(_0x42fbb3[_0x5888('0x2c')]){delete _0x42fbb3[_0x5888('0x2c')];}_0x2a7357[_0x5888('0x1f')](_0x4fd949)[_0x5888('0x2d')](_0x42fbb3);};}exports[_0x5888('0x2e')]=function(_0x596967,_0x3d164c){var _0x35e474={},_0x1ec968={},_0xa784a4={'count':0x0,'rows':[]};var _0x3ed3e9=_[_0x5888('0x2f')](db[_0x5888('0x30')][_0x5888('0x31')],function(_0x3d67b3){return{'name':_0x3d67b3['fieldName'],'type':_0x3d67b3['type']['key']};});_0x1ec968[_0x5888('0x32')]=_['map'](_0x3ed3e9,_0x5888('0x2c'));_0x1ec968[_0x5888('0x33')]=_[_0x5888('0x34')](_0x596967['query']);_0x1ec968[_0x5888('0x35')]=_[_0x5888('0x36')](_0x1ec968[_0x5888('0x32')],_0x1ec968[_0x5888('0x33')]);_0x35e474[_0x5888('0x37')]=_[_0x5888('0x36')](_0x1ec968['model'],qs[_0x5888('0x38')](_0x596967[_0x5888('0x33')]['fields']));_0x35e474[_0x5888('0x37')]=_0x35e474['attributes'][_0x5888('0x39')]?_0x35e474[_0x5888('0x37')]:_0x1ec968['model'];if(!_0x596967[_0x5888('0x33')][_0x5888('0x3a')]('nolimit')){_0x35e474[_0x5888('0x23')]=qs[_0x5888('0x23')](_0x596967[_0x5888('0x33')][_0x5888('0x23')]);_0x35e474[_0x5888('0x22')]=qs[_0x5888('0x22')](_0x596967[_0x5888('0x33')][_0x5888('0x22')]);}_0x35e474[_0x5888('0x3b')]=qs[_0x5888('0x3c')](_0x596967['query']['sort']);_0x35e474[_0x5888('0x3d')]=qs[_0x5888('0x35')](_['pick'](_0x596967['query'],_0x1ec968[_0x5888('0x35')]),_0x3ed3e9);if(_0x596967[_0x5888('0x33')][_0x5888('0x3e')]){_0x35e474[_0x5888('0x3d')]=_[_0x5888('0x3f')](_0x35e474['where'],{'$or':_[_0x5888('0x2f')](_0x3ed3e9,function(_0x3860e4){if(_0x3860e4[_0x5888('0x40')]!==_0x5888('0x41')){var _0x426c46={};_0x426c46[_0x3860e4[_0x5888('0x2c')]]={'$like':'%'+_0x596967[_0x5888('0x33')]['filter']+'%'};return _0x426c46;}})});}_0x35e474=_[_0x5888('0x3f')]({},_0x35e474,_0x596967[_0x5888('0x42')]);var _0x43beb1={'where':_0x35e474[_0x5888('0x3d')]};return db['ChatGroup']['count'](_0x43beb1)['then'](function(_0xdd2d95){_0xa784a4[_0x5888('0x25')]=_0xdd2d95;if(_0x596967['query'][_0x5888('0x43')]){_0x35e474[_0x5888('0x44')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x35e474);})[_0x5888('0x29')](function(_0x414fc6){_0xa784a4[_0x5888('0x45')]=_0x414fc6;return _0xa784a4;})[_0x5888('0x29')](respondWithFilteredResult(_0x3d164c,_0x35e474))[_0x5888('0x46')](handleError(_0x3d164c,null));};exports[_0x5888('0x47')]=function(_0xff0313,_0x50ccd1){var _0x25eae5={'raw':!![],'where':{'id':_0xff0313[_0x5888('0x48')]['id']}},_0x28f1a0={};_0x28f1a0['model']=_[_0x5888('0x34')](db['ChatGroup'][_0x5888('0x31')]);_0x28f1a0[_0x5888('0x33')]=_[_0x5888('0x34')](_0xff0313['query']);_0x28f1a0['filters']=_[_0x5888('0x36')](_0x28f1a0['model'],_0x28f1a0['query']);_0x25eae5['attributes']=_['intersection'](_0x28f1a0[_0x5888('0x32')],qs[_0x5888('0x38')](_0xff0313[_0x5888('0x33')][_0x5888('0x38')]));_0x25eae5['attributes']=_0x25eae5['attributes'][_0x5888('0x39')]?_0x25eae5[_0x5888('0x37')]:_0x28f1a0[_0x5888('0x32')];if(_0xff0313[_0x5888('0x33')][_0x5888('0x43')]){_0x25eae5['include']=[{'all':!![]}];}_0x25eae5=_[_0x5888('0x3f')]({},_0x25eae5,_0xff0313[_0x5888('0x42')]);return db[_0x5888('0x30')][_0x5888('0x49')](_0x25eae5)[_0x5888('0x29')](handleEntityNotFound(_0x50ccd1,null))[_0x5888('0x29')](respondWithResult(_0x50ccd1,null))[_0x5888('0x46')](handleError(_0x50ccd1,null));};exports[_0x5888('0x4a')]=function(_0x5c226d,_0x2296d0){return db[_0x5888('0x30')]['create'](_0x5c226d[_0x5888('0x4b')],{})['then'](respondWithResult(_0x2296d0,0xc9))[_0x5888('0x46')](handleError(_0x2296d0,null));};exports['update']=function(_0xe076d9,_0x15de42){if(_0xe076d9[_0x5888('0x4b')]['id']){delete _0xe076d9[_0x5888('0x4b')]['id'];}return db[_0x5888('0x30')][_0x5888('0x49')]({'where':{'id':_0xe076d9[_0x5888('0x48')]['id']}})['then'](handleEntityNotFound(_0x15de42,null))[_0x5888('0x29')](saveUpdates(_0xe076d9['body'],null))[_0x5888('0x29')](respondWithResult(_0x15de42,null))[_0x5888('0x46')](handleError(_0x15de42,null));};exports[_0x5888('0x2a')]=function(_0x40ad6c,_0x8cab23){return db[_0x5888('0x30')][_0x5888('0x49')]({'where':{'id':_0x40ad6c[_0x5888('0x48')]['id']}})[_0x5888('0x29')](handleEntityNotFound(_0x8cab23,null))[_0x5888('0x29')](removeEntity(_0x8cab23,null))[_0x5888('0x46')](handleError(_0x8cab23,null));};exports['describe']=function(_0x4be6f1,_0x1356e8){return db[_0x5888('0x30')][_0x5888('0x4c')]()[_0x5888('0x29')](respondWithResult(_0x1356e8,null))[_0x5888('0x46')](handleError(_0x1356e8,null));};exports[_0x5888('0x4d')]=function(_0x4f5556,_0x5780dd,_0x1f37d4){return db[_0x5888('0x4e')]['count']({'where':{'ChatGroupId':_0x4f5556['params']['id'],'ToId':_0x4f5556[_0x5888('0x4f')]['id'],'read':![]}})[_0x5888('0x29')](function(_0x4e7473){return{'id':_[_0x5888('0x50')](_0x4f5556[_0x5888('0x48')]['id']),'count':_0x4e7473};})['then'](respondWithResult(_0x5780dd,null))[_0x5888('0x46')](handleError(_0x5780dd,null));};exports[_0x5888('0x51')]=function(_0x1a8b54,_0x4a2320,_0x36cae6){return db[_0x5888('0x30')][_0x5888('0x49')]({'where':{'id':_0x1a8b54[_0x5888('0x48')]['id']}})[_0x5888('0x29')](handleEntityNotFound(_0x4a2320,null))[_0x5888('0x29')](function(_0x4a5eeb){if(_0x4a5eeb){return _0x4a5eeb[_0x5888('0x51')](_0x1a8b54[_0x5888('0x4b')][_0x5888('0x52')],_[_0x5888('0x53')](_0x1a8b54['body'],[_0x5888('0x52'),'id'])||{});}})[_0x5888('0x29')](respondWithResult(_0x4a2320,null))[_0x5888('0x46')](handleError(_0x4a2320,null));};exports[_0x5888('0x54')]=function(_0x35ad7b,_0x284bac,_0x5bd138){var _0x3c62f8={};var _0x43a9c6={};var _0x5f412a;var _0x5d6b29;return db[_0x5888('0x30')][_0x5888('0x55')]({'where':{'id':_0x35ad7b['params']['id']}})['then'](handleEntityNotFound(_0x284bac,null))[_0x5888('0x29')](function(_0x4aa449){if(_0x4aa449){_0x5f412a=_0x4aa449;_0x43a9c6[_0x5888('0x32')]=_[_0x5888('0x34')](db[_0x5888('0x56')][_0x5888('0x31')]);_0x43a9c6[_0x5888('0x33')]=_[_0x5888('0x34')](_0x35ad7b[_0x5888('0x33')]);_0x43a9c6[_0x5888('0x35')]=_[_0x5888('0x36')](_0x43a9c6[_0x5888('0x32')],_0x43a9c6[_0x5888('0x33')]);_0x3c62f8[_0x5888('0x37')]=_[_0x5888('0x36')](_0x43a9c6[_0x5888('0x32')],qs['fields'](_0x35ad7b[_0x5888('0x33')][_0x5888('0x38')]));_0x3c62f8['attributes']=_0x3c62f8[_0x5888('0x37')]['length']?_0x3c62f8[_0x5888('0x37')]:_0x43a9c6[_0x5888('0x32')];_0x3c62f8[_0x5888('0x3b')]=qs[_0x5888('0x3c')](_0x35ad7b[_0x5888('0x33')][_0x5888('0x3c')]);_0x3c62f8[_0x5888('0x3d')]=qs[_0x5888('0x35')](_['pick'](_0x35ad7b[_0x5888('0x33')],_0x43a9c6[_0x5888('0x35')]));if(_0x35ad7b['query'][_0x5888('0x3e')]){_0x3c62f8[_0x5888('0x3d')]=_[_0x5888('0x3f')](_0x3c62f8[_0x5888('0x3d')],{'$or':_[_0x5888('0x2f')](_0x3c62f8[_0x5888('0x37')],function(_0x4947db){var _0x1083e7={};_0x1083e7[_0x4947db]={'$like':'%'+_0x35ad7b[_0x5888('0x33')]['filter']+'%'};return _0x1083e7;})});}_0x3c62f8=_[_0x5888('0x3f')]({},_0x3c62f8,_0x35ad7b[_0x5888('0x42')]);return _0x5f412a[_0x5888('0x54')](_0x3c62f8);}})[_0x5888('0x29')](function(_0x55ec97){if(_0x55ec97){_0x5d6b29=_0x55ec97[_0x5888('0x39')];if(!_0x35ad7b[_0x5888('0x33')][_0x5888('0x3a')]('nolimit')){_0x3c62f8[_0x5888('0x23')]=qs['limit'](_0x35ad7b[_0x5888('0x33')]['limit']);_0x3c62f8[_0x5888('0x22')]=qs[_0x5888('0x22')](_0x35ad7b[_0x5888('0x33')]['offset']);}return _0x5f412a[_0x5888('0x54')](_0x3c62f8);}})[_0x5888('0x29')](function(_0x2a4fa2){if(_0x2a4fa2){return _0x2a4fa2?{'count':_0x5d6b29,'rows':_0x2a4fa2}:null;}})['then'](respondWithResult(_0x284bac,null))['catch'](handleError(_0x284bac,null));};exports[_0x5888('0x57')]=function(_0x559862,_0x1ddca2,_0x368417){return db['ChatGroup'][_0x5888('0x49')]({'where':{'id':_0x559862[_0x5888('0x48')]['id']}})[_0x5888('0x29')](handleEntityNotFound(_0x1ddca2,null))[_0x5888('0x29')](function(_0x4aa10f){if(_0x4aa10f){return _0x4aa10f[_0x5888('0x57')](_0x559862[_0x5888('0x33')][_0x5888('0x52')]);}})['then'](respondWithStatusCode(_0x1ddca2,null))['catch'](handleError(_0x1ddca2,null));};exports[_0x5888('0x58')]=function(_0x53ad32,_0x272621,_0x2bf4cb){if(_0x53ad32['body']['id']){delete _0x53ad32['body']['id'];}return db[_0x5888('0x30')]['find']({'where':{'id':_0x53ad32[_0x5888('0x48')]['id']}})[_0x5888('0x29')](handleEntityNotFound(_0x272621,null))[_0x5888('0x29')](function(_0x1347a2){if(_0x1347a2){_0x53ad32[_0x5888('0x4b')][_0x5888('0x59')]=_0x1347a2['id'];return db[_0x5888('0x4e')]['create'](_0x53ad32[_0x5888('0x4b')]);}})[_0x5888('0x29')](respondWithResult(_0x272621,null))['catch'](handleError(_0x272621,null));};exports[_0x5888('0x5a')]=function(_0x3eb98f,_0x5353c6,_0x1c615a){var _0x19a25a={};var _0x5c8695={};var _0x4029d4;var _0x3b4fa6;return db['ChatGroup'][_0x5888('0x55')]({'where':{'id':_0x3eb98f[_0x5888('0x48')]['id']}})[_0x5888('0x29')](handleEntityNotFound(_0x5353c6,null))[_0x5888('0x29')](function(_0x265a61){if(_0x265a61){_0x4029d4=_0x265a61;_0x5c8695[_0x5888('0x32')]=_[_0x5888('0x34')](db['ChatInternalMessage'][_0x5888('0x31')]);_0x5c8695[_0x5888('0x33')]=_[_0x5888('0x34')](_0x3eb98f[_0x5888('0x33')]);_0x5c8695[_0x5888('0x35')]=_[_0x5888('0x36')](_0x5c8695[_0x5888('0x32')],_0x5c8695[_0x5888('0x33')]);_0x19a25a[_0x5888('0x37')]=_[_0x5888('0x36')](_0x5c8695[_0x5888('0x32')],qs['fields'](_0x3eb98f[_0x5888('0x33')][_0x5888('0x38')]));_0x19a25a[_0x5888('0x37')]=_0x19a25a[_0x5888('0x37')][_0x5888('0x39')]?_0x19a25a[_0x5888('0x37')]:_0x5c8695[_0x5888('0x32')];_0x19a25a[_0x5888('0x3b')]=qs[_0x5888('0x3c')](_0x3eb98f['query'][_0x5888('0x3c')]);_0x19a25a[_0x5888('0x3d')]=qs[_0x5888('0x35')](_[_0x5888('0x5b')](_0x3eb98f['query'],_0x5c8695[_0x5888('0x35')]));if(_0x3eb98f[_0x5888('0x33')][_0x5888('0x3e')]){_0x19a25a[_0x5888('0x3d')]=_[_0x5888('0x3f')](_0x19a25a[_0x5888('0x3d')],{'$or':_[_0x5888('0x2f')](_0x19a25a['attributes'],function(_0x4936e9){var _0x278d25={};_0x278d25[_0x4936e9]={'$like':'%'+_0x3eb98f[_0x5888('0x33')][_0x5888('0x3e')]+'%'};return _0x278d25;})});}if(_0x3eb98f[_0x5888('0x33')][_0x5888('0x5c')]){var _0x21f683=_0x3eb98f[_0x5888('0x33')][_0x5888('0x5c')][_0x5888('0x5d')](',');var _0x19bf34={};_0x19bf34[_0x21f683[0x0]]={'$gte':moment(_0x21f683[0x1])[_0x5888('0x5e')](_0x5888('0x5f'))};_0x19a25a['where']=_[_0x5888('0x3f')](_0x19a25a[_0x5888('0x3d')],_0x19bf34);}_0x19a25a=_['merge']({},_0x19a25a,_0x3eb98f[_0x5888('0x42')]);return _0x4029d4[_0x5888('0x5a')](_0x19a25a);}})[_0x5888('0x29')](function(_0x3b8825){if(_0x3b8825){_0x3b4fa6=_0x3b8825[_0x5888('0x39')];if(!_0x3eb98f['query'][_0x5888('0x3a')](_0x5888('0x60'))){_0x19a25a[_0x5888('0x23')]=qs[_0x5888('0x23')](_0x3eb98f[_0x5888('0x33')]['limit']);_0x19a25a[_0x5888('0x22')]=qs[_0x5888('0x22')](_0x3eb98f[_0x5888('0x33')]['offset']);}return _0x4029d4[_0x5888('0x5a')](_0x19a25a);}})[_0x5888('0x29')](function(_0x43ba13){if(_0x43ba13){return _0x43ba13?{'count':_0x3b4fa6,'rows':_0x43ba13}:null;}})[_0x5888('0x29')](respondWithResult(_0x5353c6,null))[_0x5888('0x46')](handleError(_0x5353c6,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index ccf17fc..8d31580 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 _0x41d0=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update'];(function(_0x3b3ed2,_0x500a63){var _0x29c108=function(_0x25714f){while(--_0x25714f){_0x3b3ed2['push'](_0x3b3ed2['shift']());}};_0x29c108(++_0x500a63);}(_0x41d0,0x1c6));var _0x041d=function(_0x4dd5c6,_0x4d5c81){_0x4dd5c6=_0x4dd5c6-0x0;var _0x56b748=_0x41d0[_0x4dd5c6];return _0x56b748;};'use strict';var EventEmitter=require(_0x041d('0x0'));var ChatGroup=require(_0x041d('0x1'))['db'][_0x041d('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x041d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x041d('0x4'),'afterDestroy':_0x041d('0x5')};function emitEvent(_0x12e55d){return function(_0x397dad,_0x41e587,_0x3a22a4){ChatGroupEvents[_0x041d('0x6')](_0x12e55d+':'+_0x397dad['id'],_0x397dad);ChatGroupEvents[_0x041d('0x6')](_0x12e55d,_0x397dad);_0x3a22a4(null);};}for(var e in events){if(events[_0x041d('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x041d('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x1c77=['ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty','../../mysqldb'];(function(_0x4d655e,_0x4804ac){var _0x23a831=function(_0x4a0914){while(--_0x4a0914){_0x4d655e['push'](_0x4d655e['shift']());}};_0x23a831(++_0x4804ac);}(_0x1c77,0xed));var _0x71c7=function(_0x506172,_0xbc3a3){_0x506172=_0x506172-0x0;var _0x2723c0=_0x1c77[_0x506172];return _0x2723c0;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x71c7('0x0'))['db'][_0x71c7('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x71c7('0x2')](0x0);var events={'afterCreate':_0x71c7('0x3'),'afterUpdate':_0x71c7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29ab58){return function(_0x37620a,_0x1f314c,_0x305ff7){ChatGroupEvents[_0x71c7('0x5')](_0x29ab58+':'+_0x37620a['id'],_0x37620a);ChatGroupEvents[_0x71c7('0x5')](_0x29ab58,_0x37620a);_0x305ff7(null);};}for(var e in events){if(events[_0x71c7('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 3167338..d386fa6 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 _0xafa5=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0xafa5,0x139));var _0x5afa=function(_0x573325,_0x2f2fa5){_0x573325=_0x573325-0x0;var _0x1987bb=_0xafa5[_0x573325];return _0x1987bb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5afa('0x0'));var moment=require(_0x5afa('0x1'));var BPromise=require(_0x5afa('0x2'));var rp=require(_0x5afa('0x3'));var fs=require('fs');var path=require(_0x5afa('0x4'));var rimraf=require(_0x5afa('0x5'));var config=require(_0x5afa('0x6'));var attributes=require(_0x5afa('0x7'));module[_0x5afa('0x8')]=function(_0x31e82b,_0x5a8269){return _0x31e82b[_0x5afa('0x9')](_0x5afa('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x894f=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api','bluebird','rimraf'];(function(_0x4d1413,_0x311027){var _0x10dd2a=function(_0x19d9fd){while(--_0x19d9fd){_0x4d1413['push'](_0x4d1413['shift']());}};_0x10dd2a(++_0x311027);}(_0x894f,0x7f));var _0xf894=function(_0x55ab34,_0x18ca9f){_0x55ab34=_0x55ab34-0x0;var _0x1936da=_0x894f[_0x55ab34];return _0x1936da;};'use strict';var _=require(_0xf894('0x0'));var util=require('util');var logger=require(_0xf894('0x1'))(_0xf894('0x2'));var moment=require('moment');var BPromise=require(_0xf894('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf894('0x4'));var config=require(_0xf894('0x5'));var attributes=require(_0xf894('0x6'));module[_0xf894('0x7')]=function(_0x12e3eb,_0x10bc14){return _0x12e3eb[_0xf894('0x8')](_0xf894('0x9'),attributes,{'tableName':_0xf894('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 0623cb0..12057d5 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 _0xeed7=['request\x20sent','debug','stringify','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s'];(function(_0x58e2e8,_0x345009){var _0x4af21b=function(_0x403f57){while(--_0x403f57){_0x58e2e8['push'](_0x58e2e8['shift']());}};_0x4af21b(++_0x345009);}(_0xeed7,0xdf));var _0x7eed=function(_0x5e9491,_0x24180e){_0x5e9491=_0x5e9491-0x0;var _0xed31c3=_0xeed7[_0x5e9491];return _0xed31c3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7eed('0x0'));var BPromise=require(_0x7eed('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7eed('0x2'));var db=require(_0x7eed('0x3'))['db'];var utils=require(_0x7eed('0x4'));var logger=require(_0x7eed('0x5'))('rpc');var config=require(_0x7eed('0x6'));var jayson=require(_0x7eed('0x7'));var client=jayson['client'][_0x7eed('0x8')]({'port':0x232a});config[_0x7eed('0x9')]=_[_0x7eed('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7eed('0xb'))(new Redis(config[_0x7eed('0x9')]));require(_0x7eed('0xc'))['register'](socket);function respondWithRpcPromise(_0x398464,_0x4f0916,_0x5dc5bb){return new BPromise(function(_0x377ff1,_0x42aac7){return client[_0x7eed('0xd')](_0x398464,_0x5dc5bb)[_0x7eed('0xe')](function(_0x19f623){logger[_0x7eed('0xf')](_0x7eed('0x10'),_0x4f0916,_0x7eed('0x11'));logger[_0x7eed('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4f0916,_0x7eed('0x11'),JSON[_0x7eed('0x13')](_0x19f623));if(_0x19f623[_0x7eed('0x14')]){if(_0x19f623['error']['code']===0x1f4){logger[_0x7eed('0x14')](_0x7eed('0x10'),_0x4f0916,_0x19f623[_0x7eed('0x14')][_0x7eed('0x15')]);return _0x42aac7(_0x19f623[_0x7eed('0x14')]['message']);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x4f0916,_0x19f623[_0x7eed('0x14')]['message']);return _0x377ff1(_0x19f623['error']['message']);}else{logger[_0x7eed('0xf')](_0x7eed('0x10'),_0x4f0916,_0x7eed('0x11'));_0x377ff1(_0x19f623[_0x7eed('0x16')][_0x7eed('0x15')]);}})[_0x7eed('0x17')](function(_0x222f33){logger[_0x7eed('0x14')](_0x7eed('0x10'),_0x4f0916,_0x222f33);_0x42aac7(_0x222f33);});});} \ No newline at end of file +var _0x8388=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x23ab7f,_0x4251d2){var _0x405ca9=function(_0x47e585){while(--_0x47e585){_0x23ab7f['push'](_0x23ab7f['shift']());}};_0x405ca9(++_0x4251d2);}(_0x8388,0x18d));var _0x8838=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8388[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x8838('0x0'));var util=require(_0x8838('0x1'));var moment=require(_0x8838('0x2'));var BPromise=require(_0x8838('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8838('0x4'));var db=require(_0x8838('0x5'))['db'];var utils=require(_0x8838('0x6'));var logger=require(_0x8838('0x7'))(_0x8838('0x8'));var config=require('../../config/environment');var jayson=require(_0x8838('0x9'));var client=jayson[_0x8838('0xa')]['http']({'port':0x232a});config[_0x8838('0xb')]=_[_0x8838('0xc')](config[_0x8838('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8838('0xd'))(new Redis(config['redis']));require('./chatGroup.socket')[_0x8838('0xe')](socket);function respondWithRpcPromise(_0x4b5419,_0x4aedc9,_0x336b66){return new BPromise(function(_0x28de3d,_0x1e728e){return client[_0x8838('0xf')](_0x4b5419,_0x336b66)['then'](function(_0xd472af){logger[_0x8838('0x10')](_0x8838('0x11'),_0x4aedc9,_0x8838('0x12'));logger['debug'](_0x8838('0x13'),_0x4aedc9,'request\x20sent',JSON['stringify'](_0xd472af));if(_0xd472af[_0x8838('0x14')]){if(_0xd472af[_0x8838('0x14')][_0x8838('0x15')]===0x1f4){logger[_0x8838('0x14')](_0x8838('0x11'),_0x4aedc9,_0xd472af[_0x8838('0x14')][_0x8838('0x16')]);return _0x1e728e(_0xd472af[_0x8838('0x14')]['message']);}logger[_0x8838('0x14')](_0x8838('0x11'),_0x4aedc9,_0xd472af['error'][_0x8838('0x16')]);return _0x28de3d(_0xd472af[_0x8838('0x14')][_0x8838('0x16')]);}else{logger['info'](_0x8838('0x11'),_0x4aedc9,'request\x20sent');_0x28de3d(_0xd472af[_0x8838('0x17')][_0x8838('0x16')]);}})[_0x8838('0x18')](function(_0x4eb6e2){logger[_0x8838('0x14')](_0x8838('0x11'),_0x4aedc9,_0x4eb6e2);_0x1e728e(_0x4eb6e2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 3bddfff..327b2b9 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 _0x5c27=['./chatGroup.events','save','remove','update','emit','removeListener','register','length'];(function(_0x428565,_0x274c41){var _0x1749d7=function(_0x28f95b){while(--_0x28f95b){_0x428565['push'](_0x428565['shift']());}};_0x1749d7(++_0x274c41);}(_0x5c27,0xe8));var _0x75c2=function(_0x5440d3,_0x68412d){_0x5440d3=_0x5440d3-0x0;var _0x49b20a=_0x5c27[_0x5440d3];return _0x49b20a;};'use strict';var ChatGroupEvents=require(_0x75c2('0x0'));var events=[_0x75c2('0x1'),_0x75c2('0x2'),_0x75c2('0x3')];function createListener(_0x214c79,_0x3b49da){return function(_0x48788a){_0x3b49da[_0x75c2('0x4')](_0x214c79,_0x48788a);};}function removeListener(_0x240c14,_0x5db6b5){return function(){ChatGroupEvents[_0x75c2('0x5')](_0x240c14,_0x5db6b5);};}exports[_0x75c2('0x6')]=function(_0x1adc40){for(var _0x31d3d7=0x0,_0x5212d0=events[_0x75c2('0x7')];_0x31d3d7<_0x5212d0;_0x31d3d7++){var _0x42d53f=events[_0x31d3d7];var _0x238a5a=createListener('chatGroup:'+_0x42d53f,_0x1adc40);ChatGroupEvents['on'](_0x42d53f,_0x238a5a);}}; \ No newline at end of file +var _0xe765=['update','emit','register','length','chatGroup:','save','remove'];(function(_0x52ef06,_0x19c8c1){var _0x3d06d2=function(_0x437fb3){while(--_0x437fb3){_0x52ef06['push'](_0x52ef06['shift']());}};_0x3d06d2(++_0x19c8c1);}(_0xe765,0x11d));var _0x5e76=function(_0x4b351e,_0xad9b86){_0x4b351e=_0x4b351e-0x0;var _0x123e52=_0xe765[_0x4b351e];return _0x123e52;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x5e76('0x0'),_0x5e76('0x1'),_0x5e76('0x2')];function createListener(_0x2e2bd9,_0x1428ba){return function(_0xd42406){_0x1428ba[_0x5e76('0x3')](_0x2e2bd9,_0xd42406);};}function removeListener(_0x579f20,_0x188d83){return function(){ChatGroupEvents['removeListener'](_0x579f20,_0x188d83);};}exports[_0x5e76('0x4')]=function(_0x3113c6){for(var _0x2f016e=0x0,_0x33656e=events[_0x5e76('0x5')];_0x2f016e<_0x33656e;_0x2f016e++){var _0x32faec=events[_0x2f016e];var _0x3ad255=createListener(_0x5e76('0x6')+_0x32faec,_0x3113c6);ChatGroupEvents['on'](_0x32faec,_0x3ad255);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6e4b506..bfbfaee 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 _0x9923=['getMessages','post','create','addMembers','addMessage','/:id','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/unread','isAuthenticated','getUnread','/:id/members','/:id/messages'];(function(_0x140f47,_0x27601e){var _0x33dabf=function(_0x2719d0){while(--_0x2719d0){_0x140f47['push'](_0x140f47['shift']());}};_0x33dabf(++_0x27601e);}(_0x9923,0x167));var _0x3992=function(_0x372c3e,_0x4ebb70){_0x372c3e=_0x372c3e-0x0;var _0x4b5b54=_0x9923[_0x372c3e];return _0x4b5b54;};'use strict';var multer=require(_0x3992('0x0'));var util=require(_0x3992('0x1'));var path=require(_0x3992('0x2'));var timeout=require(_0x3992('0x3'));var express=require(_0x3992('0x4'));var router=express[_0x3992('0x5')]();var fs_extra=require(_0x3992('0x6'));var auth=require(_0x3992('0x7'));var interaction=require(_0x3992('0x8'));var config=require(_0x3992('0x9'));var controller=require('./chatGroup.controller');router[_0x3992('0xa')]('/',auth['isAuthenticated'](),controller[_0x3992('0xb')]);router[_0x3992('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3992('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x3992('0xc')]);router['get'](_0x3992('0xd'),auth[_0x3992('0xe')](),controller[_0x3992('0xf')]);router['get'](_0x3992('0x10'),auth[_0x3992('0xe')](),controller['getMembers']);router['get'](_0x3992('0x11'),auth['isAuthenticated'](),controller[_0x3992('0x12')]);router[_0x3992('0x13')]('/',auth[_0x3992('0xe')](),controller[_0x3992('0x14')]);router[_0x3992('0x13')](_0x3992('0x10'),auth['isAuthenticated'](),controller[_0x3992('0x15')]);router['post'](_0x3992('0x11'),auth[_0x3992('0xe')](),controller[_0x3992('0x16')]);router['put'](_0x3992('0x17'),auth[_0x3992('0xe')](),controller[_0x3992('0x18')]);router[_0x3992('0x19')](_0x3992('0x17'),auth[_0x3992('0xe')](),controller[_0x3992('0x1a')]);router[_0x3992('0x19')](_0x3992('0x10'),auth['isAuthenticated'](),controller[_0x3992('0x1b')]);module[_0x3992('0x1c')]=router; \ No newline at end of file +var _0x5291=['path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','addMessage','/:id','delete','removeMembers','exports','multer','util'];(function(_0x4f13f3,_0x350d48){var _0x2921cd=function(_0xc0125c){while(--_0xc0125c){_0x4f13f3['push'](_0x4f13f3['shift']());}};_0x2921cd(++_0x350d48);}(_0x5291,0xc6));var _0x1529=function(_0x1ca579,_0x38651d){_0x1ca579=_0x1ca579-0x0;var _0x5e9ea2=_0x5291[_0x1ca579];return _0x5e9ea2;};'use strict';var multer=require(_0x1529('0x0'));var util=require(_0x1529('0x1'));var path=require(_0x1529('0x2'));var timeout=require('connect-timeout');var express=require(_0x1529('0x3'));var router=express[_0x1529('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1529('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1529('0x6'));var controller=require('./chatGroup.controller');router[_0x1529('0x7')]('/',auth[_0x1529('0x8')](),controller[_0x1529('0x9')]);router[_0x1529('0x7')](_0x1529('0xa'),auth['isAuthenticated'](),controller[_0x1529('0xb')]);router[_0x1529('0x7')]('/:id',auth[_0x1529('0x8')](),controller['show']);router[_0x1529('0x7')]('/:id/unread',auth[_0x1529('0x8')](),controller[_0x1529('0xc')]);router[_0x1529('0x7')](_0x1529('0xd'),auth['isAuthenticated'](),controller[_0x1529('0xe')]);router[_0x1529('0x7')](_0x1529('0xf'),auth[_0x1529('0x8')](),controller[_0x1529('0x10')]);router['post']('/',auth[_0x1529('0x8')](),controller[_0x1529('0x11')]);router[_0x1529('0x12')](_0x1529('0xd'),auth[_0x1529('0x8')](),controller[_0x1529('0x13')]);router[_0x1529('0x12')](_0x1529('0xf'),auth[_0x1529('0x8')](),controller[_0x1529('0x14')]);router['put'](_0x1529('0x15'),auth[_0x1529('0x8')](),controller['update']);router[_0x1529('0x16')](_0x1529('0x15'),auth[_0x1529('0x8')](),controller['destroy']);router['delete'](_0x1529('0xd'),auth[_0x1529('0x8')](),controller[_0x1529('0x17')]);module[_0x1529('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a1bed16..37d2434 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 _0xb01a=['exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','sequelize'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0xb01a,0x1a1));var _0xab01=function(_0x3def41,_0x16bccf){_0x3def41=_0x3def41-0x0;var _0x391741=_0xb01a[_0x3def41];return _0x391741;};'use strict';var Sequelize=require(_0xab01('0x0'));module[_0xab01('0x1')]={'closed':{'type':Sequelize[_0xab01('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xab01('0x3')]},'ratingType':{'type':Sequelize[_0xab01('0x4')](_0xab01('0x5'),_0xab01('0x6')),'defaultValue':_0xab01('0x5')},'ratingMessage':{'type':Sequelize[_0xab01('0x7')]},'pathTranscript':{'type':Sequelize[_0xab01('0x7')]},'mailTranscript':{'type':Sequelize[_0xab01('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xab01('0x9')]},'disposition':{'type':Sequelize[_0xab01('0x8')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xab01('0x8')]},'note':{'type':Sequelize[_0xab01('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xab01('0x8')]},'osVersion':{'type':Sequelize[_0xab01('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xab01('0x8')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xab01('0x8')]},'formData':{'type':Sequelize['TEXT'](_0xab01('0xa'))},'read1stAt':{'type':Sequelize[_0xab01('0x9')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xab01('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xab01('0x8')]},'vidaooSessionId':{'type':Sequelize[_0xab01('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0xab01('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x4bde=['STRING','DATE','long','out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0x4bde,0x1b1));var _0xe4bd=function(_0x550ae2,_0x395896){_0x550ae2=_0x550ae2-0x0;var _0x236657=_0x4bde[_0x550ae2];return _0x236657;};'use strict';var Sequelize=require(_0xe4bd('0x0'));module[_0xe4bd('0x1')]={'closed':{'type':Sequelize[_0xe4bd('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xe4bd('0x3')](_0xe4bd('0x4'),_0xe4bd('0x5')),'defaultValue':_0xe4bd('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xe4bd('0x6')]},'mailTranscript':{'type':Sequelize[_0xe4bd('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xe4bd('0x8')]},'disposition':{'type':Sequelize[_0xe4bd('0x7')]},'secondDisposition':{'type':Sequelize[_0xe4bd('0x7')]},'thirdDisposition':{'type':Sequelize[_0xe4bd('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xe4bd('0x7')]},'browserVersion':{'type':Sequelize[_0xe4bd('0x7')]},'osName':{'type':Sequelize[_0xe4bd('0x7')]},'osVersion':{'type':Sequelize[_0xe4bd('0x7')]},'deviceModel':{'type':Sequelize[_0xe4bd('0x7')]},'deviceVendor':{'type':Sequelize[_0xe4bd('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xe4bd('0x6')](_0xe4bd('0x9'))},'read1stAt':{'type':Sequelize[_0xe4bd('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe4bd('0x3')]('in',_0xe4bd('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xe4bd('0x7')]},'customerPort':{'type':Sequelize[_0xe4bd('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xe4bd('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 487eaa2..0fc706d 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 _0x6aa9=['mailTranscript','Mail\x20Transcript','addMessage','ids','omit','rawAttributes','nolimit','order','sort','where','pick','filters','filter','$gte','split','options','rows','getMyMessages','hasOwnProperty','ChatInteractionId','includeAgent','push','setTags','spread','Tag','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Attachment','read','Account','Owner','get','mkdirSync','YYYY-MM-DD\x20HH:mm:ss','closedAt','toString','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','unlinkSync','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','status','end','json','undefined','count','offset','limit','set','update','destroy','stack','name','send','render','merge','agent','index','map','ChatInteraction','fieldName','type','key','findAll','chat','query','user','show','params','keys','intersection','fields','attributes','length','model','includeAll','include','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','contact','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','isNull','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','sendStatus','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','closed','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','direction','secret','appendFileSync','MailAccount','Smtp','CloudProvider','SendMail','sendMail'];(function(_0x10ffe9,_0x25d4ea){var _0x432ffc=function(_0x505eaa){while(--_0x505eaa){_0x10ffe9['push'](_0x10ffe9['shift']());}};_0x432ffc(++_0x25d4ea);}(_0x6aa9,0x110));var _0x96aa=function(_0x1bdda7,_0x2a6c7e){_0x1bdda7=_0x1bdda7-0x0;var _0x4b3f82=_0x6aa9[_0x1bdda7];return _0x4b3f82;};'use strict';var rimraf=require(_0x96aa('0x0'));var zipdir=require(_0x96aa('0x1'));var rp=require(_0x96aa('0x2'));var moment=require('moment');var BPromise=require(_0x96aa('0x3'));var Mustache=require(_0x96aa('0x4'));var util=require(_0x96aa('0x5'));var path=require(_0x96aa('0x6'));var ejs=require(_0x96aa('0x7'));var fs=require('fs');var _=require(_0x96aa('0x8'));var Redis=require('ioredis');var interaction=require(_0x96aa('0x9'));var qs=require('../../components/parsers/qs');var pdf=require(_0x96aa('0xa'));var logger=require(_0x96aa('0xb'))(_0x96aa('0xc'));var config=require(_0x96aa('0xd'));var db=require('../../mysqldb')['db'];config[_0x96aa('0xe')]=_[_0x96aa('0xf')](config[_0x96aa('0xe')],{'host':_0x96aa('0x10'),'port':0x18eb});var socket=require(_0x96aa('0x11'))(new Redis(config[_0x96aa('0xe')]));require(_0x96aa('0x12'))[_0x96aa('0x13')](socket);var jayson=require(_0x96aa('0x14'));var client=jayson['client'][_0x96aa('0x15')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0xba39c8,_0x2af4e3,_0xcd782a,_0x458c93){return new BPromise(function(_0x3e14e0,_0x7ed422){var _0x490b12=_0x458c93||client;return _0x490b12['request'](_0xba39c8,_0xcd782a)[_0x96aa('0x16')](function(_0xd75528){logger[_0x96aa('0x17')](_0x96aa('0x18'),_0x2af4e3,'request\x20sent');logger['debug'](_0x96aa('0x19'),_0x2af4e3,'request\x20sent',JSON[_0x96aa('0x1a')](_0xd75528));if(_0xd75528['error']){if(_0xd75528[_0x96aa('0x1b')]['code']===0x1f4){logger[_0x96aa('0x1b')](_0x96aa('0x18'),_0x2af4e3,_0xd75528[_0x96aa('0x1b')]['message']);return _0x7ed422(_0xd75528[_0x96aa('0x1b')][_0x96aa('0x1c')]);}logger[_0x96aa('0x1b')](_0x96aa('0x18'),_0x2af4e3,_0xd75528[_0x96aa('0x1b')][_0x96aa('0x1c')]);return _0x3e14e0(_0xd75528[_0x96aa('0x1b')][_0x96aa('0x1c')]);}else{logger[_0x96aa('0x17')](_0x96aa('0x18'),_0x2af4e3,_0x96aa('0x1d'));_0x3e14e0(_0xd75528['result'][_0x96aa('0x1c')]);}})[_0x96aa('0x1e')](function(_0x77a2ce){logger['error'](_0x96aa('0x18'),_0x2af4e3,_0x77a2ce);_0x7ed422(_0x77a2ce);});});}function respondWithStatusCode(_0x386821,_0x3952ae){_0x3952ae=_0x3952ae||0xcc;return function(_0x39b379){if(_0x39b379){return _0x386821['sendStatus'](_0x3952ae);}return _0x386821[_0x96aa('0x1f')](_0x3952ae)[_0x96aa('0x20')]();};}function respondWithResult(_0x52c7b8,_0x1d17d4){_0x1d17d4=_0x1d17d4||0xc8;return function(_0x2d9d15){if(_0x2d9d15){return _0x52c7b8[_0x96aa('0x1f')](_0x1d17d4)[_0x96aa('0x21')](_0x2d9d15);}};}function respondWithFilteredResult(_0x2514e,_0x3e7bec){return function(_0x5ef4a2){if(_0x5ef4a2){var _0x906ceb=typeof _0x3e7bec['offset']===_0x96aa('0x22')&&typeof _0x3e7bec['limit']==='undefined';var _0x2e3f97=_0x5ef4a2[_0x96aa('0x23')];var _0x41af23=_0x906ceb?0x0:_0x3e7bec['offset'];var _0xe6ab83=_0x906ceb?_0x5ef4a2[_0x96aa('0x23')]:_0x3e7bec[_0x96aa('0x24')]+_0x3e7bec[_0x96aa('0x25')];var _0x36421c;if(_0xe6ab83>=_0x2e3f97){_0xe6ab83=_0x2e3f97;_0x36421c=0xc8;}else{_0x36421c=0xce;}_0x2514e['status'](_0x36421c);return _0x2514e[_0x96aa('0x26')]('Content-Range',_0x41af23+'-'+_0xe6ab83+'/'+_0x2e3f97)[_0x96aa('0x21')](_0x5ef4a2);}return null;};}function saveUpdates(_0x1a4ae0){return function(_0x2a3b89){if(_0x2a3b89){return _0x2a3b89[_0x96aa('0x27')](_0x1a4ae0)[_0x96aa('0x16')](function(_0xb14ba3){return _0xb14ba3;});}return null;};}function removeEntity(_0x3d86c3){return function(_0x3c3c9b){if(_0x3c3c9b){return _0x3c3c9b[_0x96aa('0x28')]()[_0x96aa('0x16')](function(){_0x3d86c3['status'](0xcc)[_0x96aa('0x20')]();});}};}function handleEntityNotFound(_0x26d5ea){return function(_0x35bcf0){if(!_0x35bcf0){_0x26d5ea['sendStatus'](0x194);}return _0x35bcf0;};}function handleError(_0x14b192,_0x511a69){_0x511a69=_0x511a69||0x1f4;return function(_0x31d84b){logger['error'](_0x31d84b[_0x96aa('0x29')]);if(_0x31d84b[_0x96aa('0x2a')]){delete _0x31d84b[_0x96aa('0x2a')];}_0x14b192[_0x96aa('0x1f')](_0x511a69)[_0x96aa('0x2b')](_0x31d84b);};}function getMustacheRender(_0x3b3561,_0x41fa46){return Mustache[_0x96aa('0x2c')](_0x3b3561,_[_0x96aa('0x2d')](_0x41fa46['body'],{'contact':_0x41fa46['contact'],'message':_0x41fa46[_0x96aa('0x1c')],'agent':_0x41fa46[_0x96aa('0x2e')],'interaction':_0x41fa46['interaction'],'account':_0x41fa46['account']}))||'';}exports[_0x96aa('0x2f')]=function(_0x16bb1e,_0x5e0141){var _0x16de67={};var _0x2733fe=_[_0x96aa('0x30')](db[_0x96aa('0x31')]['rawAttributes'],function(_0x353157){return{'name':_0x353157[_0x96aa('0x32')],'type':_0x353157[_0x96aa('0x33')][_0x96aa('0x34')]};});_0x16de67=qs['getOptions'](_0x2733fe,_0x16bb1e);return interaction[_0x96aa('0x35')](_0x96aa('0x36'),_0x16bb1e[_0x96aa('0x37')],_0x16bb1e[_0x96aa('0x38')],_0x16de67,_0x2733fe)['then'](respondWithFilteredResult(_0x5e0141,_0x16de67))['catch'](handleError(_0x5e0141,null));};exports[_0x96aa('0x39')]=function(_0x5ea9cc,_0x30db00){var _0xd051c8={'raw':![],'where':{'id':_0x5ea9cc[_0x96aa('0x3a')]['id']}},_0x3ecdeb={};_0x3ecdeb['model']=_[_0x96aa('0x3b')](db[_0x96aa('0x31')]['rawAttributes']);_0x3ecdeb[_0x96aa('0x37')]=_[_0x96aa('0x3b')](_0x5ea9cc[_0x96aa('0x37')]);_0x3ecdeb['filters']=_['intersection'](_0x3ecdeb['model'],_0x3ecdeb[_0x96aa('0x37')]);_0xd051c8['attributes']=_[_0x96aa('0x3c')](_0x3ecdeb['model'],qs[_0x96aa('0x3d')](_0x5ea9cc[_0x96aa('0x37')][_0x96aa('0x3d')]));_0xd051c8[_0x96aa('0x3e')]=_0xd051c8[_0x96aa('0x3e')][_0x96aa('0x3f')]?_0xd051c8[_0x96aa('0x3e')]:_0x3ecdeb[_0x96aa('0x40')];if(_0x5ea9cc[_0x96aa('0x37')][_0x96aa('0x41')]){_0xd051c8[_0x96aa('0x42')]=[{'all':!![]}];}_0xd051c8=_[_0x96aa('0x2d')]({},_0xd051c8,_0x5ea9cc['options']);return db['ChatInteraction'][_0x96aa('0x43')](_0xd051c8)[_0x96aa('0x16')](handleEntityNotFound(_0x30db00,null))['then'](respondWithResult(_0x30db00,null))[_0x96aa('0x1e')](handleError(_0x30db00,null));};exports[_0x96aa('0x44')]=function(_0x58eae8,_0x4dfd03){return db[_0x96aa('0x31')][_0x96aa('0x44')](_0x58eae8[_0x96aa('0x45')],{})[_0x96aa('0x16')](respondWithResult(_0x4dfd03,0xc9))[_0x96aa('0x1e')](handleError(_0x4dfd03,null));};exports[_0x96aa('0x27')]=function(_0x466b41,_0x8494d0){if(_0x466b41['body']['id']){delete _0x466b41['body']['id'];}return db[_0x96aa('0x31')][_0x96aa('0x43')]({'where':{'id':_0x466b41[_0x96aa('0x3a')]['id']}})[_0x96aa('0x16')](handleEntityNotFound(_0x8494d0,null))[_0x96aa('0x16')](saveUpdates(_0x466b41[_0x96aa('0x45')],null))[_0x96aa('0x16')](respondWithResult(_0x8494d0,null))['catch'](handleError(_0x8494d0,null));};exports[_0x96aa('0x28')]=function(_0x565942,_0x21cefe){return db[_0x96aa('0x31')][_0x96aa('0x43')]({'where':{'id':_0x565942['params']['id']}})[_0x96aa('0x16')](handleEntityNotFound(_0x21cefe,null))['then'](removeEntity(_0x21cefe,null))[_0x96aa('0x1e')](handleError(_0x21cefe,null));};exports[_0x96aa('0x46')]=function(_0x448056,_0x353f06){return db[_0x96aa('0x31')][_0x96aa('0x46')]()[_0x96aa('0x16')](respondWithResult(_0x353f06,null))['catch'](handleError(_0x353f06,null));};exports[_0x96aa('0x47')]=function(_0x30a075,_0x3048a1){var _0x40067b=_0x30a075[_0x96aa('0x3a')]['id'];var _0x47c447;var _0x57414e;var _0x16aae7;return db[_0x96aa('0x31')][_0x96aa('0x48')]({'where':{'id':_0x40067b}})[_0x96aa('0x16')](function(_0x52e31d){_0x47c447=_0x52e31d;return db[_0x96aa('0x49')][_0x96aa('0x48')]({'where':{'id':_0x52e31d[_0x96aa('0x4a')]},'attributes':['id','vidaooApiKey',_0x96aa('0x4b'),_0x96aa('0x4c'),_0x96aa('0x4d'),_0x96aa('0x4e')],'raw':!![]});})[_0x96aa('0x16')](function(_0x34b7f4){if(_0x34b7f4&&_0x34b7f4['vidaooApiKey']&&_0x34b7f4[_0x96aa('0x4b')]){_0x57414e=_0x34b7f4;var _0x2a3908={'interaction':{'id':_0x40067b},'agent':{'id':_0x30a075['user']['id'],'name':_0x30a075[_0x96aa('0x38')][_0x96aa('0x2a')],'fullname':_0x30a075[_0x96aa('0x38')]['fullname'],'email':_0x30a075[_0x96aa('0x38')][_0x96aa('0x4f')]},'contact':_0x30a075[_0x96aa('0x45')][_0x96aa('0x50')],'account':_0x30a075[_0x96aa('0x45')][_0x96aa('0x51')]};var _0x198f98={'rejectUnauthorized':![],'method':_0x96aa('0x52'),'url':_0x96aa('0x53'),'headers':{'X-APIKEY':_0x34b7f4[_0x96aa('0x54')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x30a075[_0x96aa('0x38')][_0x96aa('0x4f')]],'buttons':null,'topic':_0x57414e[_0x96aa('0x4c')],'note':_[_0x96aa('0x55')](_0x57414e['vidaooNote'])?null:getMustacheRender(_0x57414e[_0x96aa('0x4d')],_0x2a3908),'metadata':null},'redirect':_0x96aa('0x56'),'json':!![]};try{if(!_['isNull'](_0x57414e['vidaooMetadata'])){var _0x5d44b8=getMustacheRender(_0x57414e[_0x96aa('0x4e')],_0x2a3908);var _0x454f27=JSON[_0x96aa('0x57')](_0x5d44b8);_0x198f98[_0x96aa('0x45')][_0x96aa('0x58')]=_0x454f27;}}catch(_0x445a17){throw new db[(_0x96aa('0x59'))][(_0x96aa('0x5a'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x198f98);}else{throw new db[(_0x96aa('0x59'))][(_0x96aa('0x5a'))](_0x96aa('0x5b'));}})['then'](function(_0x226b33){_0x16aae7=_0x226b33;if(_0x16aae7['id']){var _0x59f773={'body':_0x16aae7[_0x96aa('0x5c')],'ChatWebsiteId':_0x57414e['id'],'ChatInteractionId':_0x47c447['id'],'direction':_0x96aa('0x5d'),'UserId':_0x30a075[_0x96aa('0x38')]['id']};return db[_0x96aa('0x5e')][_0x96aa('0x44')](_0x59f773,{});}else{throw new db[(_0x96aa('0x59'))]['ValidationError'](_0x96aa('0x5f'));}})[_0x96aa('0x16')](function(){return _0x47c447[_0x96aa('0x60')]({'vidaooSessionId':_0x16aae7['id']});})['then'](respondWithResult(_0x3048a1,null))[_0x96aa('0x1e')](handleError(_0x3048a1,null));};exports[_0x96aa('0x61')]=function(_0x2fad77,_0x367298){if(_0x2fad77[_0x96aa('0x45')]['id']){delete _0x2fad77[_0x96aa('0x45')]['id'];}return db[_0x96aa('0x31')][_0x96aa('0x43')]({'where':{'id':_0x2fad77[_0x96aa('0x3a')]['id']},'include':[{'model':db[_0x96aa('0x62')],'as':'Contact'}]})[_0x96aa('0x16')](handleEntityNotFound(_0x367298,null))[_0x96aa('0x16')](saveUpdates(_0x2fad77['body'],null))['then'](respondWithResult(_0x367298,null))[_0x96aa('0x1e')](handleError(_0x367298,null));};exports[_0x96aa('0x63')]=function(_0x4a5696,_0x77c581){if(_0x4a5696[_0x96aa('0x45')]['id']){delete _0x4a5696[_0x96aa('0x45')]['id'];}return db[_0x96aa('0x31')][_0x96aa('0x43')]({'where':{'id':_0x4a5696[_0x96aa('0x3a')]['id']}})[_0x96aa('0x16')](function(_0x2b8d96){if(!_0x2b8d96){logger[_0x96aa('0x1b')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x96aa('0x63'),0x194,_0x96aa('0x64'));_0x77c581[_0x96aa('0x65')](0x194);}else{if(_0x2b8d96[_0x96aa('0x66')]){throw new db[(_0x96aa('0x59'))][(_0x96aa('0x5a'))](_0x96aa('0x67'));}}return _0x2b8d96;})[_0x96aa('0x16')](function(_0x598bf5){if(_0x598bf5){return _0x598bf5['update']({'closed':_0x4a5696[_0x96aa('0x45')]['closed'],'disposition':_0x4a5696[_0x96aa('0x45')][_0x96aa('0x68')]})['then'](function(_0x4202c0){return _0x4202c0;});}})[_0x96aa('0x16')](function(){return respondWithRpcPromise(_0x96aa('0x69'),_0x96aa('0x63'),_0x4a5696[_0x96aa('0x45')],client9004);})[_0x96aa('0x16')](respondWithResult(_0x77c581,null))['catch'](handleError(_0x77c581,null));};exports[_0x96aa('0x6a')]=function(_0x197193,_0x147ec1){_0x197193['body']['name']=_0x197193['file'][_0x96aa('0x6b')];_0x197193['body'][_0x96aa('0x6c')]=_0x197193[_0x96aa('0x6d')][_0x96aa('0x6e')];_0x197193['body'][_0x96aa('0x33')]=_0x197193[_0x96aa('0x6d')][_0x96aa('0x6f')];return db['Attachment'][_0x96aa('0x44')](_0x197193[_0x96aa('0x45')])[_0x96aa('0x16')](respondWithResult(_0x147ec1,0xc9))[_0x96aa('0x1e')](handleError(_0x147ec1,null));};exports['attachmentDownload']=function(_0xb0a1ee,_0x32f970){return db['ChatInteraction']['findOne']({'where':{'id':_0xb0a1ee[_0x96aa('0x3a')]['id']},'raw':!![]})[_0x96aa('0x16')](handleEntityNotFound(_0x32f970,null))[_0x96aa('0x16')](function(_0x254d53){if(_0x254d53){if(_0x254d53[_0x96aa('0x70')]){return _0x32f970[_0x96aa('0x1f')](0x193)[_0x96aa('0x21')]({'status':0x193,'message':_0x96aa('0x71')});}return db['Attachment'][_0x96aa('0x48')]({'where':{'id':_0xb0a1ee['query'][_0x96aa('0x72')]},'raw':!![]})[_0x96aa('0x16')](handleEntityNotFound(_0x32f970,null));}})[_0x96aa('0x16')](function(_0x177dec){if(_0x177dec){var _0x48716a=_0x177dec['ChatOfflineMessageId']!==null;var _0x255abf=path[_0x96aa('0x73')](config[_0x96aa('0x74')],_0x96aa('0x75'));if(_0x48716a){_0x255abf=path[_0x96aa('0x73')](_0x255abf,_0x96aa('0x76'));}var _0x179b4c=path[_0x96aa('0x73')](_0x255abf,_0x177dec['basename']);return _0x32f970[_0x96aa('0x77')](_0x179b4c);}})['catch'](handleError(_0x32f970,null));};exports[_0x96aa('0x78')]=function(_0x16b912,_0x306a08){var _0x7cea0b=null;var _0x548ea2=null;var _0x2c80bf=null;if(_0x16b912[_0x96aa('0x45')]['id']){delete _0x16b912['body']['id'];}if(_0x16b912[_0x96aa('0x45')]['mailTranscript']){_0x2c80bf=path[_0x96aa('0x73')](config[_0x96aa('0x74')],_0x96aa('0x79'),util[_0x96aa('0x7a')](_0x96aa('0x7b'),Date[_0x96aa('0x7c')]()));_0x16b912[_0x96aa('0x45')][_0x96aa('0x7d')]=_0x2c80bf;}return db[_0x96aa('0x31')][_0x96aa('0x43')]({'where':{'id':_0x16b912[_0x96aa('0x3a')]['id']},'include':[{'model':db[_0x96aa('0x5e')],'as':_0x96aa('0x7e'),'include':[{'model':db[_0x96aa('0x7f')],'as':'User'}]}]})[_0x96aa('0x16')](handleEntityNotFound(_0x306a08,null))['then'](saveUpdates(_0x16b912[_0x96aa('0x45')],null))['then'](function(_0x381a24){if(_0x381a24){_0x7cea0b=_0x381a24;return db[_0x96aa('0x49')][_0x96aa('0x43')]({'where':{'id':_0x7cea0b[_0x96aa('0x4a')]}});}})[_0x96aa('0x16')](function(_0x3fd3fc){if(_0x3fd3fc){_0x548ea2=_0x3fd3fc;return db[_0x96aa('0x62')][_0x96aa('0x43')]({'where':{'id':_0x7cea0b[_0x96aa('0x80')]}});}})[_0x96aa('0x16')](function(_0x1b7b54){if(_0x1b7b54){if(_0x2c80bf){var _0x5f14cb=null;for(var _0x5b9b67=0x1;_0x5b9b67<_0x7cea0b[_0x96aa('0x7e')][_0x96aa('0x3f')];++_0x5b9b67){_0x5f14cb=_0x7cea0b[_0x96aa('0x7e')][_0x5b9b67];var _0x59f6eb=_0x5f14cb[_0x96aa('0x66')]?util[_0x96aa('0x7a')](_0x96aa('0x81'),_0x548ea2[_0x96aa('0x82')],_0x5f14cb['UserId']):_0x96aa('0x83');var _0x302332=_0x16b912[_0x96aa('0x45')][_0x96aa('0x84')]||util[_0x96aa('0x7a')](_0x96aa('0x81'),_0x96aa('0x85'),_0x5f14cb[_0x96aa('0x80')]);switch(_0x548ea2[_0x96aa('0x86')]){case _0x96aa('0x87'):_0x59f6eb=_0x5f14cb[_0x96aa('0x66')]?util[_0x96aa('0x7a')](_0x96aa('0x81'),_0x548ea2[_0x96aa('0x82')],_0x5f14cb['UserId']):_0x96aa('0x83');break;case _0x96aa('0x88'):_0x59f6eb=_0x5f14cb[_0x96aa('0x66')]?_0x5f14cb[_0x96aa('0x7f')][_0x96aa('0x89')]||_0x5f14cb[_0x96aa('0x7f')][_0x96aa('0x8a')]:_0x96aa('0x83');break;case _0x96aa('0x8b'):_0x59f6eb=_0x5f14cb[_0x96aa('0x66')]?_0x5f14cb[_0x96aa('0x7f')][_0x96aa('0x8a')]:'System';break;default:_0x59f6eb=_0x5f14cb[_0x96aa('0x66')]?util[_0x96aa('0x7a')](_0x96aa('0x81'),_0x548ea2[_0x96aa('0x82')],_0x5f14cb[_0x96aa('0x66')]):_0x96aa('0x83');}var _0x146e38=util[_0x96aa('0x7a')](_0x96aa('0x8c'),moment(_0x5f14cb[_0x96aa('0x8d')])[_0x96aa('0x7a')]('MM/DD/YYYY\x20HH:mm:ss'),_0x5f14cb[_0x96aa('0x8e')]==='in'?_0x302332:_0x59f6eb,_0x5f14cb[_0x96aa('0x45')]);if(!_0x5f14cb[_0x96aa('0x8f')]){fs[_0x96aa('0x90')](_0x2c80bf,_0x146e38);}}return db[_0x96aa('0x91')][_0x96aa('0x48')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x96aa('0x92'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x96aa('0x93'),'raw':!![]}]}]});}}})['then'](function(_0x34955e){if(!_0x34955e||!_0x34955e['Smtp']||!_0x16b912['body'])return _0x7cea0b;var _0x16eb47=_0x34955e['getSmtpOptions']();return respondWithRpcPromise(_0x96aa('0x94'),_0x96aa('0x95'),{'account':_0x16eb47,'message':{'from':util[_0x96aa('0x7a')]('\x22%s\x22\x20<%s>',_0x34955e[_0x96aa('0x2a')],_0x34955e[_0x96aa('0x4f')]||_0x34955e['Smtp'][_0x96aa('0x38')]),'to':_0x16b912['body'][_0x96aa('0x96')],'subject':_0x96aa('0x97'),'text':util[_0x96aa('0x7a')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x16b912[_0x96aa('0x45')][_0x96aa('0x96')]),'attachments':[{'path':_0x2c80bf}]}})[_0x96aa('0x16')](function(){return _0x7cea0b;})['catch'](function(_0x2750b3){logger['error'](_0x2750b3);});})[_0x96aa('0x16')](respondWithStatusCode(_0x306a08,0xc8))[_0x96aa('0x1e')](handleError(_0x306a08,null));};exports[_0x96aa('0x98')]=function(_0x370d78,_0x517b6f){return db[_0x96aa('0x5e')]['find']({'where':{'id':_0x370d78[_0x96aa('0x3a')]['id']}})[_0x96aa('0x16')](handleEntityNotFound(_0x517b6f,null))[_0x96aa('0x16')](function(_0xeca101){if(_0xeca101){return _0xeca101[_0x96aa('0x98')](_0x370d78['body'][_0x96aa('0x99')],_[_0x96aa('0x9a')](_0x370d78[_0x96aa('0x45')],['ids','id'])||{});}})[_0x96aa('0x16')](respondWithResult(_0x517b6f,null))['catch'](handleError(_0x517b6f,null));};exports['getMessages']=function(_0x355011,_0x4c555c){var _0xdb1ccd={'raw':![],'where':{}};var _0x4340db={};var _0x1a3f45={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x96aa('0x48')]({'where':{'id':_0x355011['params']['id']}})[_0x96aa('0x16')](handleEntityNotFound(_0x4c555c,null))[_0x96aa('0x16')](function(_0x1e2d8a){if(_0x1e2d8a){_0x4340db[_0x96aa('0x40')]=_[_0x96aa('0x3b')](db[_0x96aa('0x5e')][_0x96aa('0x9b')]);_0x4340db[_0x96aa('0x37')]=_[_0x96aa('0x3b')](_0x355011['query']);_0x4340db['filters']=_[_0x96aa('0x3c')](_0x4340db[_0x96aa('0x40')],_0x4340db[_0x96aa('0x37')]);_0xdb1ccd['attributes']=_[_0x96aa('0x3c')](_0x4340db['model'],qs[_0x96aa('0x3d')](_0x355011[_0x96aa('0x37')][_0x96aa('0x3d')]));_0xdb1ccd[_0x96aa('0x3e')]=_0xdb1ccd[_0x96aa('0x3e')][_0x96aa('0x3f')]?_0xdb1ccd[_0x96aa('0x3e')]:_0x4340db[_0x96aa('0x40')];if(!_0x355011[_0x96aa('0x37')]['hasOwnProperty'](_0x96aa('0x9c'))){_0xdb1ccd['limit']=qs[_0x96aa('0x25')](_0x355011[_0x96aa('0x37')][_0x96aa('0x25')]);_0xdb1ccd[_0x96aa('0x24')]=qs['offset'](_0x355011[_0x96aa('0x37')][_0x96aa('0x24')]);}_0xdb1ccd[_0x96aa('0x9d')]=qs[_0x96aa('0x9e')](_0x355011[_0x96aa('0x37')][_0x96aa('0x9e')]);_0xdb1ccd[_0x96aa('0x9f')]=qs['filters'](_[_0x96aa('0xa0')](_0x355011[_0x96aa('0x37')],_0x4340db[_0x96aa('0xa1')]));_0xdb1ccd[_0x96aa('0x9f')]['ChatInteractionId']=_0x1e2d8a['id'];if(_0x355011['query'][_0x96aa('0xa2')]){_0xdb1ccd[_0x96aa('0x9f')]=_['merge'](_0xdb1ccd[_0x96aa('0x9f')],{'$or':_[_0x96aa('0x30')](_0xdb1ccd[_0x96aa('0x3e')],function(_0x445eaa){var _0x598b5d={};_0x598b5d[_0x445eaa]={'$like':'%'+_0x355011['query'][_0x96aa('0xa2')]+'%'};return _0x598b5d;})});}if(_0x355011[_0x96aa('0x37')][_0x96aa('0xa3')]){var _0x502c61=_0x355011[_0x96aa('0x37')]['$gte'][_0x96aa('0xa4')](',');var _0x587df9={};_0x587df9[_0x502c61[0x0]]={'$gte':moment(_0x502c61[0x1])[_0x96aa('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')};_0xdb1ccd['where']=_['merge'](_0xdb1ccd[_0x96aa('0x9f')],_0x587df9);}_0xdb1ccd=_[_0x96aa('0x2d')]({},_0xdb1ccd,_0x355011[_0x96aa('0xa5')]);return db['ChatMessage'][_0x96aa('0x23')]({'where':_0xdb1ccd[_0x96aa('0x9f')]})[_0x96aa('0x16')](function(_0x307abf){_0x1a3f45[_0x96aa('0x23')]=_0x307abf;if(_0x355011['query']['includeAll']){_0xdb1ccd[_0x96aa('0x42')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0xdb1ccd);})[_0x96aa('0x16')](function(_0x11c9b5){_0x1a3f45[_0x96aa('0xa6')]=_0x11c9b5;return _0x1a3f45;});}})[_0x96aa('0x16')](respondWithFilteredResult(_0x4c555c,_0xdb1ccd))[_0x96aa('0x1e')](handleError(_0x4c555c,null));};exports[_0x96aa('0xa7')]=function(_0x1e572f,_0x11e9b2){var _0x2c3b25={'where':{}},_0x1a1100={},_0x206933={'count':0x0,'rows':[]};return db[_0x96aa('0x31')]['findOne']({'where':{'id':_0x1e572f[_0x96aa('0x3a')]['id']}})[_0x96aa('0x16')](handleEntityNotFound(_0x11e9b2,null))[_0x96aa('0x16')](function(_0x177b3c){if(_0x177b3c){_0x1a1100[_0x96aa('0x40')]=_[_0x96aa('0x3b')](db['ChatMessage'][_0x96aa('0x9b')]);_0x1a1100[_0x96aa('0x37')]=_[_0x96aa('0x3b')](_0x1e572f['query']);_0x1a1100[_0x96aa('0xa1')]=_[_0x96aa('0x3c')](_0x1a1100[_0x96aa('0x40')],_0x1a1100[_0x96aa('0x37')]);_0x2c3b25[_0x96aa('0x3e')]=_[_0x96aa('0x3c')](_0x1a1100[_0x96aa('0x40')],qs[_0x96aa('0x3d')](_0x1e572f[_0x96aa('0x37')][_0x96aa('0x3d')]));_0x2c3b25[_0x96aa('0x3e')]=_0x2c3b25[_0x96aa('0x3e')][_0x96aa('0x3f')]?_0x2c3b25[_0x96aa('0x3e')]:_0x1a1100[_0x96aa('0x40')];if(!_0x1e572f[_0x96aa('0x37')][_0x96aa('0xa8')]('nolimit')){_0x2c3b25[_0x96aa('0x25')]=qs[_0x96aa('0x25')](_0x1e572f[_0x96aa('0x37')][_0x96aa('0x25')]);_0x2c3b25[_0x96aa('0x24')]=qs[_0x96aa('0x24')](_0x1e572f['query'][_0x96aa('0x24')]);}_0x2c3b25[_0x96aa('0x9d')]=qs[_0x96aa('0x9e')](_0x1e572f[_0x96aa('0x37')]['sort']);_0x2c3b25[_0x96aa('0x9f')]=qs[_0x96aa('0xa1')](_[_0x96aa('0xa0')](_0x1e572f[_0x96aa('0x37')],_0x1a1100['filters']));_0x2c3b25[_0x96aa('0x9f')][_0x96aa('0xa9')]=_0x177b3c['id'];if(_0x1e572f[_0x96aa('0x37')][_0x96aa('0xa2')]){_0x2c3b25[_0x96aa('0x9f')]=_[_0x96aa('0x2d')](_0x2c3b25[_0x96aa('0x9f')],{'$or':_[_0x96aa('0x30')](_0x2c3b25['attributes'],function(_0x3dfe44){var _0x79dfeb={};_0x79dfeb[_0x3dfe44]={'$like':'%'+_0x1e572f['query'][_0x96aa('0xa2')]+'%'};return _0x79dfeb;})});}_0x2c3b25['where'][_0x96aa('0x8f')]=![];if(_0x1e572f[_0x96aa('0x37')]['id']){_0x2c3b25[_0x96aa('0x9f')]['id']={'$gt':_0x1e572f[_0x96aa('0x37')]['id']};}_0x2c3b25=_[_0x96aa('0x2d')]({},_0x2c3b25,_0x1e572f[_0x96aa('0xa5')]);return db[_0x96aa('0x5e')][_0x96aa('0x23')]({'where':_0x2c3b25[_0x96aa('0x9f')]})[_0x96aa('0x16')](function(_0x1bfdf9){_0x206933[_0x96aa('0x23')]=_0x1bfdf9;_0x2c3b25['include']=[];if(_0x1e572f[_0x96aa('0x37')][_0x96aa('0xaa')]){_0x2c3b25[_0x96aa('0x42')][_0x96aa('0xab')]({'model':db[_0x96aa('0x7f')],'as':_0x96aa('0x7f'),'attributes':['id',_0x96aa('0x8a'),'alias']});}if(_0x1e572f[_0x96aa('0x37')]['includeAll']){_0x2c3b25[_0x96aa('0x42')]=[{'all':!![]}];}return db[_0x96aa('0x5e')]['findAll'](_0x2c3b25);})['then'](function(_0x639ee6){_0x206933[_0x96aa('0xa6')]=_0x639ee6;return _0x206933;});}})[_0x96aa('0x16')](respondWithFilteredResult(_0x11e9b2,_0x2c3b25))[_0x96aa('0x1e')](handleError(_0x11e9b2,null));};exports['addTags']=function(_0x3712d1,_0x39a736){return db['ChatInteraction'][_0x96aa('0x43')]({'where':{'id':_0x3712d1[_0x96aa('0x3a')]['id']}})[_0x96aa('0x16')](handleEntityNotFound(_0x39a736,null))[_0x96aa('0x16')](function(_0x1c89bd){if(_0x1c89bd){return _0x1c89bd[_0x96aa('0xac')](_0x3712d1[_0x96aa('0x45')][_0x96aa('0x99')],_[_0x96aa('0x9a')](_0x3712d1[_0x96aa('0x45')],[_0x96aa('0x99'),'id'])||{})[_0x96aa('0xad')](function(){return db[_0x96aa('0xae')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x3712d1['body'][_0x96aa('0x99')]}});})[_0x96aa('0x16')](function(_0xa65318){socket['emit']('chatInteractionTags:save',{'id':Number(_0x3712d1['params']['id']),'tags':_0xa65318||[]});return{'id':Number(_0x3712d1[_0x96aa('0x3a')]['id']),'tags':_0xa65318||[]};});}})[_0x96aa('0x16')](respondWithResult(_0x39a736,null))[_0x96aa('0x1e')](handleError(_0x39a736,null));};exports[_0x96aa('0xaf')]=function(_0x4a7427,_0x26e158){return db[_0x96aa('0x31')]['find']({'where':{'id':_0x4a7427['params']['id']}})[_0x96aa('0x16')](handleEntityNotFound(_0x26e158,null))['then'](function(_0x558398){if(_0x558398){return _0x558398['removeTags'](_0x4a7427[_0x96aa('0x37')][_0x96aa('0x99')]);}})[_0x96aa('0x16')](respondWithStatusCode(_0x26e158,null))[_0x96aa('0x1e')](handleError(_0x26e158,null));};exports['download']=function(_0xb0b1ac,_0x396c8b){var _0x46a96f=moment()[_0x96aa('0xb0')]()['toString']();var _0x1fe22a=path[_0x96aa('0x73')](config['root'],_0x96aa('0xb1'),_0x96aa('0xb2'),_0x96aa('0xb3'));var _0x33dd43=path[_0x96aa('0x73')](config[_0x96aa('0x74')],'server',_0x96aa('0xb2'),_0x96aa('0xb4'));var _0x31bca4=path['join'](_0x1fe22a,_0x46a96f);var _0x1e3476=util[_0x96aa('0x7a')](_0x96aa('0xb5'),_0xb0b1ac[_0x96aa('0x3a')]['id'],_0x46a96f);var _0x4682f6=path[_0x96aa('0x73')](_0x1fe22a,_0x1e3476);var _0x157d8f=[];_0x157d8f[_0x96aa('0xab')]({'model':db[_0x96aa('0x7f')],'as':'User','attributes':['id',_0x96aa('0x8a')],'raw':!![]});_0x157d8f[_0x96aa('0xab')]({'model':db['CmContact'],'as':_0x96aa('0xb6'),'attributes':['id',_0x96aa('0xb7'),_0x96aa('0xb8')],'raw':!![]});if(_0xb0b1ac[_0x96aa('0x37')][_0x96aa('0xb4')]){_0x157d8f[_0x96aa('0xab')]({'model':db['Attachment'],'as':_0x96aa('0xb9'),'raw':!![]});}var _0x8a397b=[{'model':db[_0x96aa('0x5e')],'as':_0x96aa('0x7e'),'attributes':['id',_0x96aa('0x45'),_0x96aa('0x8d'),_0x96aa('0x8e'),_0x96aa('0x8f'),_0x96aa('0xba')],'include':_0x157d8f}];_0x8a397b[_0x96aa('0xab')]({'model':db['ChatWebsite'],'as':_0x96aa('0xbb'),'attributes':['id','name']});_0x8a397b['push']({'model':db['User'],'as':_0x96aa('0xbc'),'attributes':['id',_0x96aa('0x8a')]});return db['ChatInteraction'][_0x96aa('0x43')]({'where':{'id':_0xb0b1ac[_0x96aa('0x3a')]['id']},'include':_0x8a397b})[_0x96aa('0x16')](handleEntityNotFound(_0x396c8b,null))[_0x96aa('0x16')](function(_0x18678b){if(_0x18678b){var _0x20344f=_0x18678b[_0x96aa('0xbd')]({'plain':!![]});fs[_0x96aa('0xbe')](_0x31bca4);var _0x2416f6={'channel':'Chat','account':_0x20344f['Account'][_0x96aa('0x2a')],'agent':_0x20344f['Owner']?_0x20344f[_0x96aa('0xbc')][_0x96aa('0x8a')]:'N.A.','createdAt':moment(_0x20344f[_0x96aa('0x8d')])[_0x96aa('0x7a')](_0x96aa('0xbf'))['toString'](),'closedAt':_0x20344f[_0x96aa('0x70')]?moment(_0x20344f[_0x96aa('0xc0')])[_0x96aa('0x7a')](_0x96aa('0xbf'))[_0x96aa('0xc1')]():'','disposition':_0x20344f['disposition'],'chatInfo':{'browser':_0x20344f[_0x96aa('0xc2')],'os':_0x20344f[_0x96aa('0xc3')],'referer':_0x20344f[_0x96aa('0xc4')],'customerIp':_0x20344f[_0x96aa('0xc5')],'customerPort':_0x20344f[_0x96aa('0xc6')]?_0x20344f[_0x96aa('0xc6')]:'N.A.'},'messages':_(_0x20344f['Messages'])[_0x96aa('0xc7')]()[_0x96aa('0xa2')]({'secret':![]})[_0x96aa('0x30')](function(_0x5a02e8){if(_0x5a02e8[_0x96aa('0xb9')]){var _0x283457=path[_0x96aa('0x73')](_0x33dd43,_0x5a02e8[_0x96aa('0xb9')]['basename']);if(fs[_0x96aa('0xc8')](_0x283457)){fs[_0x96aa('0xc9')](_0x283457)[_0x96aa('0xca')](fs['createWriteStream'](path['join'](_0x31bca4,_0x5a02e8[_0x96aa('0xb9')][_0x96aa('0x6c')])));}}return{'date':moment(_0x5a02e8['createdAt'])[_0x96aa('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0x96aa('0xc1')](),'sender':_0x5a02e8[_0x96aa('0x8e')]==='out'?_0x5a02e8['User']?_0x5a02e8[_0x96aa('0x7f')][_0x96aa('0x8a')]:_0x96aa('0x83'):_0x5a02e8[_0x96aa('0xb6')][_0x96aa('0xb7')]+(_0x5a02e8[_0x96aa('0xb6')][_0x96aa('0xb8')]?'\x20'+_0x5a02e8['Contact'][_0x96aa('0xb8')]:''),'body':_0x5a02e8['Attachment']?_0x5a02e8['Attachment'][_0x96aa('0x6c')]:_0x5a02e8[_0x96aa('0x45')],'direction':_0x5a02e8[_0x96aa('0x8e')]===_0x96aa('0x5d')?'A':'C','secret':_0x5a02e8[_0x96aa('0x8f')],'read':_0x5a02e8[_0x96aa('0xba')],'attachment':_0x5a02e8['Attachment']};})['value']()};return ejs[_0x96aa('0xcb')](path[_0x96aa('0x73')](config[_0x96aa('0x74')],_0x96aa('0xb1'),_0x96aa('0xcc'),_0x96aa('0xcd')),{'interaction':_0x2416f6})[_0x96aa('0x16')](function(_0x4d5abf){var _0x47c9c2=path[_0x96aa('0x73')](_0x31bca4,_0x96aa('0xce')+_0x20344f['id']+'-'+_0x46a96f+_0x96aa('0xcf'));var _0x193d74={'path':_0x47c9c2,'channel':_0x96aa('0xd0'),'interactionId':_0x20344f['id']};return pdf[_0x96aa('0xd1')](_0x4d5abf,_0x193d74);})[_0x96aa('0x16')](function(){return new Promise(function(_0x5ac22c,_0x452066){zipdir(_0x31bca4,{'saveTo':_0x4682f6},function(_0x500e4f,_0x2fb966){if(_0x500e4f)return _0x452066(_0x500e4f);return _0x5ac22c(_0x2fb966);});})[_0x96aa('0x16')](function(){return new BPromise(function(_0x5ae545,_0x4f7a71){rimraf(_0x31bca4,function(_0x7f2e41){if(_0x7f2e41)_0x4f7a71(_0x7f2e41);return _0x5ae545();});});})['then'](function(){return _0x396c8b[_0x96aa('0x77')](_0x4682f6,_0x1e3476,function(_0x598c4c){if(_0x598c4c){logger[_0x96aa('0x1b')]('err',_0x598c4c);}else{fs[_0x96aa('0xd2')](_0x4682f6);}});});});}else{return _0x396c8b['sendStatus'](0xc8);}})[_0x96aa('0x1e')](handleError(_0x396c8b,null));}; \ No newline at end of file +var _0x3164=['unlinkSync','rimraf','bluebird','mustache','util','path','lodash','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','ChatInteraction,\x20%s,\x20%s','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','stack','name','merge','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','query','params','keys','attributes','intersection','fields','length','include','find','create','body','describe','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','sendStatus','Interaction\x20already\x20assigned','closed','AbandonInteraction','originalname','file','mimetype','Attachment','ChatOfflineMessageId','join','offline-chat/','basename','mailTranscript','root','format','transcript-%s.txt','Messages','User','ChatWebsite','ContactId','UserId','%s%d','agentAlias','Visitor','website_alias','agent_alias','alias','fullname','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','model','filters','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','secret','options','includeAgent','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','Account','Owner','get','mkdirSync','N.A.','disposition','browserName','osName','referer','customerIp','customerPort','createReadStream','pipe','createWriteStream','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','err'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0x3164,0x18b));var _0x4316=function(_0x3add15,_0x1556a8){_0x3add15=_0x3add15-0x0;var _0x4171d0=_0x3164[_0x3add15];return _0x4171d0;};'use strict';var rimraf=require(_0x4316('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4316('0x1'));var Mustache=require(_0x4316('0x2'));var util=require(_0x4316('0x3'));var path=require(_0x4316('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4316('0x5'));var Redis=require('ioredis');var interaction=require(_0x4316('0x6'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x4316('0x7'))('api');var config=require(_0x4316('0x8'));var db=require(_0x4316('0x9'))['db'];config[_0x4316('0xa')]=_['defaults'](config[_0x4316('0xa')],{'host':_0x4316('0xb'),'port':0x18eb});var socket=require(_0x4316('0xc'))(new Redis(config[_0x4316('0xa')]));require(_0x4316('0xd'))[_0x4316('0xe')](socket);var jayson=require(_0x4316('0xf'));var client=jayson[_0x4316('0x10')][_0x4316('0x11')]({'port':0x232b});var client9004=jayson[_0x4316('0x10')][_0x4316('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x2582f0,_0x2f7ea7,_0x47ff00,_0x349e82){return new BPromise(function(_0x45606a,_0x473fe0){var _0xdc18b7=_0x349e82||client;return _0xdc18b7[_0x4316('0x12')](_0x2582f0,_0x47ff00)[_0x4316('0x13')](function(_0x216a87){logger[_0x4316('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x2f7ea7,_0x4316('0x15'));logger['debug'](_0x4316('0x16'),_0x2f7ea7,_0x4316('0x15'),JSON['stringify'](_0x216a87));if(_0x216a87[_0x4316('0x17')]){if(_0x216a87[_0x4316('0x17')][_0x4316('0x18')]===0x1f4){logger[_0x4316('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x2f7ea7,_0x216a87[_0x4316('0x17')][_0x4316('0x19')]);return _0x473fe0(_0x216a87[_0x4316('0x17')][_0x4316('0x19')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2f7ea7,_0x216a87[_0x4316('0x17')][_0x4316('0x19')]);return _0x45606a(_0x216a87[_0x4316('0x17')][_0x4316('0x19')]);}else{logger[_0x4316('0x14')](_0x4316('0x1a'),_0x2f7ea7,_0x4316('0x15'));_0x45606a(_0x216a87['result'][_0x4316('0x19')]);}})[_0x4316('0x1b')](function(_0x2b35b3){logger[_0x4316('0x17')](_0x4316('0x1a'),_0x2f7ea7,_0x2b35b3);_0x473fe0(_0x2b35b3);});});}function respondWithStatusCode(_0x3bc68c,_0x489c9c){_0x489c9c=_0x489c9c||0xcc;return function(_0x40446d){if(_0x40446d){return _0x3bc68c['sendStatus'](_0x489c9c);}return _0x3bc68c[_0x4316('0x1c')](_0x489c9c)[_0x4316('0x1d')]();};}function respondWithResult(_0x1a1dd7,_0x486a15){_0x486a15=_0x486a15||0xc8;return function(_0x170384){if(_0x170384){return _0x1a1dd7[_0x4316('0x1c')](_0x486a15)[_0x4316('0x1e')](_0x170384);}};}function respondWithFilteredResult(_0x51dccd,_0x3caeda){return function(_0x15e63d){if(_0x15e63d){var _0x388dc3=typeof _0x3caeda[_0x4316('0x1f')]==='undefined'&&typeof _0x3caeda[_0x4316('0x20')]===_0x4316('0x21');var _0x3e2eb0=_0x15e63d[_0x4316('0x22')];var _0x10e7e5=_0x388dc3?0x0:_0x3caeda['offset'];var _0x4e5670=_0x388dc3?_0x15e63d[_0x4316('0x22')]:_0x3caeda[_0x4316('0x1f')]+_0x3caeda[_0x4316('0x20')];var _0x4da7aa;if(_0x4e5670>=_0x3e2eb0){_0x4e5670=_0x3e2eb0;_0x4da7aa=0xc8;}else{_0x4da7aa=0xce;}_0x51dccd[_0x4316('0x1c')](_0x4da7aa);return _0x51dccd[_0x4316('0x23')](_0x4316('0x24'),_0x10e7e5+'-'+_0x4e5670+'/'+_0x3e2eb0)[_0x4316('0x1e')](_0x15e63d);}return null;};}function saveUpdates(_0x2b9b3f){return function(_0x32e5a6){if(_0x32e5a6){return _0x32e5a6[_0x4316('0x25')](_0x2b9b3f)[_0x4316('0x13')](function(_0x59a6e6){return _0x59a6e6;});}return null;};}function removeEntity(_0x155718){return function(_0x339008){if(_0x339008){return _0x339008[_0x4316('0x26')]()[_0x4316('0x13')](function(){_0x155718[_0x4316('0x1c')](0xcc)[_0x4316('0x1d')]();});}};}function handleEntityNotFound(_0x56cd16){return function(_0x3830a7){if(!_0x3830a7){_0x56cd16['sendStatus'](0x194);}return _0x3830a7;};}function handleError(_0x553aff,_0x301dff){_0x301dff=_0x301dff||0x1f4;return function(_0xe9c243){logger[_0x4316('0x17')](_0xe9c243[_0x4316('0x27')]);if(_0xe9c243[_0x4316('0x28')]){delete _0xe9c243[_0x4316('0x28')];}_0x553aff[_0x4316('0x1c')](_0x301dff)['send'](_0xe9c243);};}function getMustacheRender(_0x58d3e6,_0x3ea64b){return Mustache['render'](_0x58d3e6,_[_0x4316('0x29')](_0x3ea64b['body'],{'contact':_0x3ea64b[_0x4316('0x2a')],'message':_0x3ea64b[_0x4316('0x19')],'agent':_0x3ea64b[_0x4316('0x2b')],'interaction':_0x3ea64b[_0x4316('0x2c')],'account':_0x3ea64b[_0x4316('0x2d')]}))||'';}exports[_0x4316('0x2e')]=function(_0x28f59e,_0x584069){var _0x57ab81={};var _0x4af228=_[_0x4316('0x2f')](db[_0x4316('0x30')][_0x4316('0x31')],function(_0x391b6b){return{'name':_0x391b6b[_0x4316('0x32')],'type':_0x391b6b[_0x4316('0x33')][_0x4316('0x34')]};});_0x57ab81=qs[_0x4316('0x35')](_0x4af228,_0x28f59e);return interaction['findAll']('chat',_0x28f59e[_0x4316('0x36')],_0x28f59e['user'],_0x57ab81,_0x4af228)[_0x4316('0x13')](respondWithFilteredResult(_0x584069,_0x57ab81))[_0x4316('0x1b')](handleError(_0x584069,null));};exports['show']=function(_0x41b90f,_0xd7919b){var _0x1ac8f6={'raw':![],'where':{'id':_0x41b90f[_0x4316('0x37')]['id']}},_0x3883ef={};_0x3883ef['model']=_[_0x4316('0x38')](db[_0x4316('0x30')][_0x4316('0x31')]);_0x3883ef[_0x4316('0x36')]=_[_0x4316('0x38')](_0x41b90f[_0x4316('0x36')]);_0x3883ef['filters']=_['intersection'](_0x3883ef['model'],_0x3883ef[_0x4316('0x36')]);_0x1ac8f6[_0x4316('0x39')]=_[_0x4316('0x3a')](_0x3883ef['model'],qs['fields'](_0x41b90f[_0x4316('0x36')][_0x4316('0x3b')]));_0x1ac8f6[_0x4316('0x39')]=_0x1ac8f6[_0x4316('0x39')][_0x4316('0x3c')]?_0x1ac8f6[_0x4316('0x39')]:_0x3883ef['model'];if(_0x41b90f[_0x4316('0x36')]['includeAll']){_0x1ac8f6[_0x4316('0x3d')]=[{'all':!![]}];}_0x1ac8f6=_[_0x4316('0x29')]({},_0x1ac8f6,_0x41b90f['options']);return db['ChatInteraction'][_0x4316('0x3e')](_0x1ac8f6)[_0x4316('0x13')](handleEntityNotFound(_0xd7919b,null))['then'](respondWithResult(_0xd7919b,null))[_0x4316('0x1b')](handleError(_0xd7919b,null));};exports[_0x4316('0x3f')]=function(_0x2819bc,_0x2f38c1){return db[_0x4316('0x30')][_0x4316('0x3f')](_0x2819bc[_0x4316('0x40')],{})[_0x4316('0x13')](respondWithResult(_0x2f38c1,0xc9))[_0x4316('0x1b')](handleError(_0x2f38c1,null));};exports['update']=function(_0x24beb9,_0x3591de){if(_0x24beb9[_0x4316('0x40')]['id']){delete _0x24beb9[_0x4316('0x40')]['id'];}return db[_0x4316('0x30')][_0x4316('0x3e')]({'where':{'id':_0x24beb9[_0x4316('0x37')]['id']}})[_0x4316('0x13')](handleEntityNotFound(_0x3591de,null))[_0x4316('0x13')](saveUpdates(_0x24beb9[_0x4316('0x40')],null))[_0x4316('0x13')](respondWithResult(_0x3591de,null))['catch'](handleError(_0x3591de,null));};exports['destroy']=function(_0x52de26,_0x2a0da8){return db['ChatInteraction'][_0x4316('0x3e')]({'where':{'id':_0x52de26[_0x4316('0x37')]['id']}})['then'](handleEntityNotFound(_0x2a0da8,null))[_0x4316('0x13')](removeEntity(_0x2a0da8,null))[_0x4316('0x1b')](handleError(_0x2a0da8,null));};exports[_0x4316('0x41')]=function(_0x336ead,_0x4dde34){return db[_0x4316('0x30')]['describe']()[_0x4316('0x13')](respondWithResult(_0x4dde34,null))[_0x4316('0x1b')](handleError(_0x4dde34,null));};exports['createVidaooSession']=function(_0x45c72a,_0x1c47b2){var _0xd1f897=_0x45c72a[_0x4316('0x37')]['id'];var _0x18583a;var _0x2b82e1;var _0x22e422;return db[_0x4316('0x30')][_0x4316('0x42')]({'where':{'id':_0xd1f897}})[_0x4316('0x13')](function(_0x46a84){_0x18583a=_0x46a84;return db['ChatWebsite'][_0x4316('0x42')]({'where':{'id':_0x46a84[_0x4316('0x43')]},'attributes':['id',_0x4316('0x44'),_0x4316('0x45'),_0x4316('0x46'),_0x4316('0x47'),_0x4316('0x48')],'raw':!![]});})['then'](function(_0x424903){if(_0x424903&&_0x424903['vidaooApiKey']&&_0x424903[_0x4316('0x45')]){_0x2b82e1=_0x424903;var _0x1b7fc2={'interaction':{'id':_0xd1f897},'agent':{'id':_0x45c72a[_0x4316('0x49')]['id'],'name':_0x45c72a['user']['name'],'fullname':_0x45c72a[_0x4316('0x49')]['fullname'],'email':_0x45c72a['user'][_0x4316('0x4a')]},'contact':_0x45c72a['body'][_0x4316('0x2a')],'account':_0x45c72a['body'][_0x4316('0x2d')]};var _0x1adbb5={'rejectUnauthorized':![],'method':'POST','url':_0x4316('0x4b'),'headers':{'X-APIKEY':_0x424903[_0x4316('0x44')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x45c72a[_0x4316('0x49')][_0x4316('0x4a')]],'buttons':null,'topic':_0x2b82e1[_0x4316('0x46')],'note':_[_0x4316('0x4c')](_0x2b82e1['vidaooNote'])?null:getMustacheRender(_0x2b82e1[_0x4316('0x47')],_0x1b7fc2),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x4316('0x4c')](_0x2b82e1[_0x4316('0x48')])){var _0x4db346=getMustacheRender(_0x2b82e1['vidaooMetadata'],_0x1b7fc2);var _0x6f263b=JSON[_0x4316('0x4d')](_0x4db346);_0x1adbb5[_0x4316('0x40')]['metadata']=_0x6f263b;}}catch(_0x137afc){throw new db[(_0x4316('0x4e'))]['ValidationError'](_0x4316('0x4f'));}return rp(_0x1adbb5);}else{throw new db['Sequelize']['ValidationError'](_0x4316('0x50'));}})[_0x4316('0x13')](function(_0x148af6){_0x22e422=_0x148af6;if(_0x22e422['id']){var _0x4cb86c={'body':_0x22e422['join_url'],'ChatWebsiteId':_0x2b82e1['id'],'ChatInteractionId':_0x18583a['id'],'direction':_0x4316('0x51'),'UserId':_0x45c72a[_0x4316('0x49')]['id']};return db[_0x4316('0x52')][_0x4316('0x3f')](_0x4cb86c,{});}else{throw new db[(_0x4316('0x4e'))][(_0x4316('0x53'))](_0x4316('0x54'));}})[_0x4316('0x13')](function(){return _0x18583a[_0x4316('0x55')]({'vidaooSessionId':_0x22e422['id']});})[_0x4316('0x13')](respondWithResult(_0x1c47b2,null))[_0x4316('0x1b')](handleError(_0x1c47b2,null));};exports['customUpdate']=function(_0x34f555,_0x208fcf){if(_0x34f555[_0x4316('0x40')]['id']){delete _0x34f555[_0x4316('0x40')]['id'];}return db['ChatInteraction'][_0x4316('0x3e')]({'where':{'id':_0x34f555['params']['id']},'include':[{'model':db[_0x4316('0x56')],'as':_0x4316('0x57')}]})[_0x4316('0x13')](handleEntityNotFound(_0x208fcf,null))[_0x4316('0x13')](saveUpdates(_0x34f555[_0x4316('0x40')],null))[_0x4316('0x13')](respondWithResult(_0x208fcf,null))[_0x4316('0x1b')](handleError(_0x208fcf,null));};exports[_0x4316('0x58')]=function(_0x21f94c,_0x429e6c){if(_0x21f94c[_0x4316('0x40')]['id']){delete _0x21f94c[_0x4316('0x40')]['id'];}return db['ChatInteraction'][_0x4316('0x3e')]({'where':{'id':_0x21f94c[_0x4316('0x37')]['id']}})['then'](function(_0x990fb3){if(!_0x990fb3){logger[_0x4316('0x17')](_0x4316('0x59'),'abandon',0x194,'entity\x20not\x20found');_0x429e6c[_0x4316('0x5a')](0x194);}else{if(_0x990fb3['UserId']){throw new db[(_0x4316('0x4e'))]['ValidationError'](_0x4316('0x5b'));}}return _0x990fb3;})[_0x4316('0x13')](function(_0x55e732){if(_0x55e732){return _0x55e732['update']({'closed':_0x21f94c[_0x4316('0x40')][_0x4316('0x5c')],'disposition':_0x21f94c[_0x4316('0x40')]['disposition']})[_0x4316('0x13')](function(_0x1065a0){return _0x1065a0;});}})[_0x4316('0x13')](function(){return respondWithRpcPromise(_0x4316('0x5d'),_0x4316('0x58'),_0x21f94c[_0x4316('0x40')],client9004);})[_0x4316('0x13')](respondWithResult(_0x429e6c,null))[_0x4316('0x1b')](handleError(_0x429e6c,null));};exports['attachmentUpload']=function(_0x2bd942,_0x3b3cd9){_0x2bd942[_0x4316('0x40')][_0x4316('0x28')]=_0x2bd942['file'][_0x4316('0x5e')];_0x2bd942[_0x4316('0x40')]['basename']=_0x2bd942['file']['filename'];_0x2bd942[_0x4316('0x40')][_0x4316('0x33')]=_0x2bd942[_0x4316('0x5f')][_0x4316('0x60')];return db[_0x4316('0x61')][_0x4316('0x3f')](_0x2bd942[_0x4316('0x40')])['then'](respondWithResult(_0x3b3cd9,0xc9))[_0x4316('0x1b')](handleError(_0x3b3cd9,null));};exports['attachmentDownload']=function(_0x456f42,_0x53465d){return db[_0x4316('0x30')]['findOne']({'where':{'id':_0x456f42[_0x4316('0x37')]['id']},'raw':!![]})[_0x4316('0x13')](handleEntityNotFound(_0x53465d,null))['then'](function(_0x19671e){if(_0x19671e){if(_0x19671e[_0x4316('0x5c')]){return _0x53465d['status'](0x193)[_0x4316('0x1e')]({'status':0x193,'message':'Unauthorized'});}return db[_0x4316('0x61')][_0x4316('0x42')]({'where':{'id':_0x456f42[_0x4316('0x36')]['attachId']},'raw':!![]})[_0x4316('0x13')](handleEntityNotFound(_0x53465d,null));}})[_0x4316('0x13')](function(_0x11ec60){if(_0x11ec60){var _0x3cb51a=_0x11ec60[_0x4316('0x62')]!==null;var _0x2b7be6=path[_0x4316('0x63')](config['root'],'server/files/attachments/');if(_0x3cb51a){_0x2b7be6=path[_0x4316('0x63')](_0x2b7be6,_0x4316('0x64'));}var _0x2a99dc=path['join'](_0x2b7be6,_0x11ec60[_0x4316('0x65')]);return _0x53465d['download'](_0x2a99dc);}})[_0x4316('0x1b')](handleError(_0x53465d,null));};exports['close']=function(_0x391aa5,_0x55bd88){var _0x54bace=null;var _0x55408b=null;var _0x4fec6d=null;if(_0x391aa5[_0x4316('0x40')]['id']){delete _0x391aa5[_0x4316('0x40')]['id'];}if(_0x391aa5[_0x4316('0x40')][_0x4316('0x66')]){_0x4fec6d=path[_0x4316('0x63')](config[_0x4316('0x67')],'server/files/chat/upload/',util[_0x4316('0x68')](_0x4316('0x69'),Date['now']()));_0x391aa5[_0x4316('0x40')]['pathTranscript']=_0x4fec6d;}return db[_0x4316('0x30')]['find']({'where':{'id':_0x391aa5[_0x4316('0x37')]['id']},'include':[{'model':db[_0x4316('0x52')],'as':_0x4316('0x6a'),'include':[{'model':db[_0x4316('0x6b')],'as':_0x4316('0x6b')}]}]})[_0x4316('0x13')](handleEntityNotFound(_0x55bd88,null))[_0x4316('0x13')](saveUpdates(_0x391aa5[_0x4316('0x40')],null))['then'](function(_0x1182b2){if(_0x1182b2){_0x54bace=_0x1182b2;return db[_0x4316('0x6c')]['find']({'where':{'id':_0x54bace['ChatWebsiteId']}});}})[_0x4316('0x13')](function(_0x16bdfc){if(_0x16bdfc){_0x55408b=_0x16bdfc;return db[_0x4316('0x56')][_0x4316('0x3e')]({'where':{'id':_0x54bace[_0x4316('0x6d')]}});}})[_0x4316('0x13')](function(_0x3af946){if(_0x3af946){if(_0x4fec6d){var _0x3faef3=null;for(var _0x183caa=0x1;_0x183caa<_0x54bace[_0x4316('0x6a')][_0x4316('0x3c')];++_0x183caa){_0x3faef3=_0x54bace['Messages'][_0x183caa];var _0xc25d0a=_0x3faef3[_0x4316('0x6e')]?util[_0x4316('0x68')](_0x4316('0x6f'),_0x55408b[_0x4316('0x70')],_0x3faef3['UserId']):'System';var _0x49b5d8=_0x391aa5[_0x4316('0x40')]['customer']||util[_0x4316('0x68')](_0x4316('0x6f'),_0x4316('0x71'),_0x3faef3[_0x4316('0x6d')]);switch(_0x55408b['agentIdentifier']){case _0x4316('0x72'):_0xc25d0a=_0x3faef3[_0x4316('0x6e')]?util['format'](_0x4316('0x6f'),_0x55408b[_0x4316('0x70')],_0x3faef3[_0x4316('0x6e')]):'System';break;case _0x4316('0x73'):_0xc25d0a=_0x3faef3['UserId']?_0x3faef3['User'][_0x4316('0x74')]||_0x3faef3['User'][_0x4316('0x75')]:_0x4316('0x76');break;case _0x4316('0x77'):_0xc25d0a=_0x3faef3[_0x4316('0x6e')]?_0x3faef3[_0x4316('0x6b')]['fullname']:_0x4316('0x76');break;default:_0xc25d0a=_0x3faef3[_0x4316('0x6e')]?util[_0x4316('0x68')](_0x4316('0x6f'),_0x55408b[_0x4316('0x70')],_0x3faef3[_0x4316('0x6e')]):_0x4316('0x76');}var _0x5b18f8=util[_0x4316('0x68')](_0x4316('0x78'),moment(_0x3faef3[_0x4316('0x79')])['format'](_0x4316('0x7a')),_0x3faef3[_0x4316('0x7b')]==='in'?_0x49b5d8:_0xc25d0a,_0x3faef3[_0x4316('0x40')]);if(!_0x3faef3['secret']){fs['appendFileSync'](_0x4fec6d,_0x5b18f8);}}return db['MailAccount'][_0x4316('0x42')]({'where':{'service':!![]},'include':[{'model':db[_0x4316('0x7c')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x4316('0x7d')],'as':_0x4316('0x7d'),'raw':!![]}]}]});}}})[_0x4316('0x13')](function(_0x534fca){if(!_0x534fca||!_0x534fca[_0x4316('0x7e')]||!_0x391aa5[_0x4316('0x40')])return _0x54bace;var _0x1b4231=_0x534fca[_0x4316('0x7f')]();return respondWithRpcPromise(_0x4316('0x80'),_0x4316('0x81'),{'account':_0x1b4231,'message':{'from':util['format'](_0x4316('0x82'),_0x534fca[_0x4316('0x28')],_0x534fca[_0x4316('0x4a')]||_0x534fca['Smtp'][_0x4316('0x49')]),'to':_0x391aa5[_0x4316('0x40')][_0x4316('0x66')],'subject':'Mail\x20Transcript','text':util[_0x4316('0x68')](_0x4316('0x83'),_0x391aa5[_0x4316('0x40')][_0x4316('0x66')]),'attachments':[{'path':_0x4fec6d}]}})['then'](function(){return _0x54bace;})['catch'](function(_0x4886fd){logger[_0x4316('0x17')](_0x4886fd);});})[_0x4316('0x13')](respondWithStatusCode(_0x55bd88,0xc8))[_0x4316('0x1b')](handleError(_0x55bd88,null));};exports[_0x4316('0x84')]=function(_0x52c7ff,_0x28e349){return db['ChatMessage'][_0x4316('0x3e')]({'where':{'id':_0x52c7ff[_0x4316('0x37')]['id']}})[_0x4316('0x13')](handleEntityNotFound(_0x28e349,null))[_0x4316('0x13')](function(_0x1d52e1){if(_0x1d52e1){return _0x1d52e1[_0x4316('0x84')](_0x52c7ff[_0x4316('0x40')]['ids'],_[_0x4316('0x85')](_0x52c7ff[_0x4316('0x40')],[_0x4316('0x86'),'id'])||{});}})[_0x4316('0x13')](respondWithResult(_0x28e349,null))[_0x4316('0x1b')](handleError(_0x28e349,null));};exports[_0x4316('0x87')]=function(_0x10368d,_0x3efa55){var _0x13b744={'raw':![],'where':{}};var _0x5d84ae={};var _0x4ac7f5={'count':0x0,'rows':[]};return db[_0x4316('0x30')][_0x4316('0x42')]({'where':{'id':_0x10368d[_0x4316('0x37')]['id']}})[_0x4316('0x13')](handleEntityNotFound(_0x3efa55,null))['then'](function(_0x3dea94){if(_0x3dea94){_0x5d84ae[_0x4316('0x88')]=_[_0x4316('0x38')](db['ChatMessage'][_0x4316('0x31')]);_0x5d84ae[_0x4316('0x36')]=_[_0x4316('0x38')](_0x10368d[_0x4316('0x36')]);_0x5d84ae[_0x4316('0x89')]=_[_0x4316('0x3a')](_0x5d84ae['model'],_0x5d84ae[_0x4316('0x36')]);_0x13b744[_0x4316('0x39')]=_['intersection'](_0x5d84ae[_0x4316('0x88')],qs['fields'](_0x10368d[_0x4316('0x36')][_0x4316('0x3b')]));_0x13b744[_0x4316('0x39')]=_0x13b744[_0x4316('0x39')][_0x4316('0x3c')]?_0x13b744[_0x4316('0x39')]:_0x5d84ae[_0x4316('0x88')];if(!_0x10368d['query'][_0x4316('0x8a')](_0x4316('0x8b'))){_0x13b744[_0x4316('0x20')]=qs['limit'](_0x10368d[_0x4316('0x36')][_0x4316('0x20')]);_0x13b744[_0x4316('0x1f')]=qs[_0x4316('0x1f')](_0x10368d[_0x4316('0x36')]['offset']);}_0x13b744[_0x4316('0x8c')]=qs[_0x4316('0x8d')](_0x10368d[_0x4316('0x36')][_0x4316('0x8d')]);_0x13b744[_0x4316('0x8e')]=qs['filters'](_[_0x4316('0x8f')](_0x10368d['query'],_0x5d84ae[_0x4316('0x89')]));_0x13b744['where'][_0x4316('0x90')]=_0x3dea94['id'];if(_0x10368d[_0x4316('0x36')][_0x4316('0x91')]){_0x13b744[_0x4316('0x8e')]=_[_0x4316('0x29')](_0x13b744['where'],{'$or':_[_0x4316('0x2f')](_0x13b744[_0x4316('0x39')],function(_0x3b928b){var _0x2cfc0c={};_0x2cfc0c[_0x3b928b]={'$like':'%'+_0x10368d[_0x4316('0x36')][_0x4316('0x91')]+'%'};return _0x2cfc0c;})});}if(_0x10368d[_0x4316('0x36')][_0x4316('0x92')]){var _0x2bc75d=_0x10368d[_0x4316('0x36')][_0x4316('0x92')][_0x4316('0x93')](',');var _0x5c8cc4={};_0x5c8cc4[_0x2bc75d[0x0]]={'$gte':moment(_0x2bc75d[0x1])['format'](_0x4316('0x94'))};_0x13b744[_0x4316('0x8e')]=_[_0x4316('0x29')](_0x13b744[_0x4316('0x8e')],_0x5c8cc4);}_0x13b744=_[_0x4316('0x29')]({},_0x13b744,_0x10368d['options']);return db[_0x4316('0x52')][_0x4316('0x22')]({'where':_0x13b744[_0x4316('0x8e')]})[_0x4316('0x13')](function(_0x4b9386){_0x4ac7f5[_0x4316('0x22')]=_0x4b9386;if(_0x10368d[_0x4316('0x36')][_0x4316('0x95')]){_0x13b744['include']=[{'all':!![]}];}return db['ChatMessage'][_0x4316('0x96')](_0x13b744);})[_0x4316('0x13')](function(_0x1aee4a){_0x4ac7f5[_0x4316('0x97')]=_0x1aee4a;return _0x4ac7f5;});}})['then'](respondWithFilteredResult(_0x3efa55,_0x13b744))[_0x4316('0x1b')](handleError(_0x3efa55,null));};exports['getMyMessages']=function(_0x11cd0d,_0x234bbb){var _0x4e3c41={'where':{}},_0xb2dca2={},_0x15872a={'count':0x0,'rows':[]};return db[_0x4316('0x30')]['findOne']({'where':{'id':_0x11cd0d[_0x4316('0x37')]['id']}})[_0x4316('0x13')](handleEntityNotFound(_0x234bbb,null))[_0x4316('0x13')](function(_0xeacd3e){if(_0xeacd3e){_0xb2dca2[_0x4316('0x88')]=_['keys'](db['ChatMessage'][_0x4316('0x31')]);_0xb2dca2['query']=_[_0x4316('0x38')](_0x11cd0d[_0x4316('0x36')]);_0xb2dca2[_0x4316('0x89')]=_[_0x4316('0x3a')](_0xb2dca2[_0x4316('0x88')],_0xb2dca2[_0x4316('0x36')]);_0x4e3c41[_0x4316('0x39')]=_[_0x4316('0x3a')](_0xb2dca2[_0x4316('0x88')],qs[_0x4316('0x3b')](_0x11cd0d[_0x4316('0x36')][_0x4316('0x3b')]));_0x4e3c41['attributes']=_0x4e3c41['attributes'][_0x4316('0x3c')]?_0x4e3c41[_0x4316('0x39')]:_0xb2dca2[_0x4316('0x88')];if(!_0x11cd0d[_0x4316('0x36')]['hasOwnProperty'](_0x4316('0x8b'))){_0x4e3c41['limit']=qs[_0x4316('0x20')](_0x11cd0d[_0x4316('0x36')][_0x4316('0x20')]);_0x4e3c41[_0x4316('0x1f')]=qs[_0x4316('0x1f')](_0x11cd0d['query'][_0x4316('0x1f')]);}_0x4e3c41[_0x4316('0x8c')]=qs[_0x4316('0x8d')](_0x11cd0d['query'][_0x4316('0x8d')]);_0x4e3c41[_0x4316('0x8e')]=qs['filters'](_[_0x4316('0x8f')](_0x11cd0d[_0x4316('0x36')],_0xb2dca2[_0x4316('0x89')]));_0x4e3c41[_0x4316('0x8e')][_0x4316('0x90')]=_0xeacd3e['id'];if(_0x11cd0d['query']['filter']){_0x4e3c41['where']=_[_0x4316('0x29')](_0x4e3c41[_0x4316('0x8e')],{'$or':_[_0x4316('0x2f')](_0x4e3c41[_0x4316('0x39')],function(_0x2ef3e8){var _0x12c40d={};_0x12c40d[_0x2ef3e8]={'$like':'%'+_0x11cd0d[_0x4316('0x36')][_0x4316('0x91')]+'%'};return _0x12c40d;})});}_0x4e3c41[_0x4316('0x8e')][_0x4316('0x98')]=![];if(_0x11cd0d[_0x4316('0x36')]['id']){_0x4e3c41[_0x4316('0x8e')]['id']={'$gt':_0x11cd0d['query']['id']};}_0x4e3c41=_[_0x4316('0x29')]({},_0x4e3c41,_0x11cd0d[_0x4316('0x99')]);return db[_0x4316('0x52')][_0x4316('0x22')]({'where':_0x4e3c41[_0x4316('0x8e')]})[_0x4316('0x13')](function(_0x250192){_0x15872a[_0x4316('0x22')]=_0x250192;_0x4e3c41['include']=[];if(_0x11cd0d[_0x4316('0x36')][_0x4316('0x9a')]){_0x4e3c41[_0x4316('0x3d')]['push']({'model':db[_0x4316('0x6b')],'as':'User','attributes':['id','fullname','alias']});}if(_0x11cd0d[_0x4316('0x36')]['includeAll']){_0x4e3c41[_0x4316('0x3d')]=[{'all':!![]}];}return db[_0x4316('0x52')]['findAll'](_0x4e3c41);})[_0x4316('0x13')](function(_0x339f40){_0x15872a[_0x4316('0x97')]=_0x339f40;return _0x15872a;});}})[_0x4316('0x13')](respondWithFilteredResult(_0x234bbb,_0x4e3c41))[_0x4316('0x1b')](handleError(_0x234bbb,null));};exports['addTags']=function(_0x1bc168,_0x4d76e0){return db[_0x4316('0x30')][_0x4316('0x3e')]({'where':{'id':_0x1bc168[_0x4316('0x37')]['id']}})['then'](handleEntityNotFound(_0x4d76e0,null))[_0x4316('0x13')](function(_0x5e9fd9){if(_0x5e9fd9){return _0x5e9fd9['setTags'](_0x1bc168['body'][_0x4316('0x86')],_['omit'](_0x1bc168[_0x4316('0x40')],[_0x4316('0x86'),'id'])||{})[_0x4316('0x9b')](function(){return db[_0x4316('0x9c')][_0x4316('0x96')]({'attributes':['id',_0x4316('0x28'),_0x4316('0x9d')],'where':{'id':_0x1bc168['body'][_0x4316('0x86')]}});})[_0x4316('0x13')](function(_0x938400){socket[_0x4316('0x9e')](_0x4316('0x9f'),{'id':Number(_0x1bc168[_0x4316('0x37')]['id']),'tags':_0x938400||[]});return{'id':Number(_0x1bc168['params']['id']),'tags':_0x938400||[]};});}})[_0x4316('0x13')](respondWithResult(_0x4d76e0,null))[_0x4316('0x1b')](handleError(_0x4d76e0,null));};exports[_0x4316('0xa0')]=function(_0x225f39,_0x4f20a8){return db[_0x4316('0x30')][_0x4316('0x3e')]({'where':{'id':_0x225f39[_0x4316('0x37')]['id']}})[_0x4316('0x13')](handleEntityNotFound(_0x4f20a8,null))[_0x4316('0x13')](function(_0x2a20e1){if(_0x2a20e1){return _0x2a20e1[_0x4316('0xa0')](_0x225f39['query'][_0x4316('0x86')]);}})['then'](respondWithStatusCode(_0x4f20a8,null))[_0x4316('0x1b')](handleError(_0x4f20a8,null));};exports[_0x4316('0xa1')]=function(_0x359965,_0x5845c1){var _0x64ca90=moment()[_0x4316('0xa2')]()[_0x4316('0xa3')]();var _0x423e57=path['join'](config['root'],_0x4316('0xa4'),_0x4316('0xa5'),_0x4316('0xa6'));var _0x395560=path[_0x4316('0x63')](config['root'],_0x4316('0xa4'),_0x4316('0xa5'),_0x4316('0xa7'));var _0x1c3eaf=path[_0x4316('0x63')](_0x423e57,_0x64ca90);var _0x466940=util[_0x4316('0x68')](_0x4316('0xa8'),_0x359965[_0x4316('0x37')]['id'],_0x64ca90);var _0x59e692=path['join'](_0x423e57,_0x466940);var _0x3f4f09=[];_0x3f4f09[_0x4316('0xa9')]({'model':db[_0x4316('0x6b')],'as':_0x4316('0x6b'),'attributes':['id',_0x4316('0x75')],'raw':!![]});_0x3f4f09[_0x4316('0xa9')]({'model':db[_0x4316('0x56')],'as':_0x4316('0x57'),'attributes':['id',_0x4316('0xaa'),_0x4316('0xab')],'raw':!![]});if(_0x359965[_0x4316('0x36')][_0x4316('0xa7')]){_0x3f4f09[_0x4316('0xa9')]({'model':db[_0x4316('0x61')],'as':_0x4316('0x61'),'raw':!![]});}var _0x236291=[{'model':db[_0x4316('0x52')],'as':_0x4316('0x6a'),'attributes':['id',_0x4316('0x40'),_0x4316('0x79'),_0x4316('0x7b'),_0x4316('0x98'),_0x4316('0xac')],'include':_0x3f4f09}];_0x236291['push']({'model':db['ChatWebsite'],'as':_0x4316('0xad'),'attributes':['id','name']});_0x236291[_0x4316('0xa9')]({'model':db['User'],'as':_0x4316('0xae'),'attributes':['id','fullname']});return db[_0x4316('0x30')][_0x4316('0x3e')]({'where':{'id':_0x359965['params']['id']},'include':_0x236291})[_0x4316('0x13')](handleEntityNotFound(_0x5845c1,null))[_0x4316('0x13')](function(_0x3348d0){if(_0x3348d0){var _0x5a993f=_0x3348d0[_0x4316('0xaf')]({'plain':!![]});fs[_0x4316('0xb0')](_0x1c3eaf);var _0x396f6b={'channel':'Chat','account':_0x5a993f[_0x4316('0xad')][_0x4316('0x28')],'agent':_0x5a993f['Owner']?_0x5a993f[_0x4316('0xae')]['fullname']:_0x4316('0xb1'),'createdAt':moment(_0x5a993f[_0x4316('0x79')])[_0x4316('0x68')](_0x4316('0x94'))[_0x4316('0xa3')](),'closedAt':_0x5a993f['closed']?moment(_0x5a993f['closedAt'])[_0x4316('0x68')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4316('0xa3')]():'','disposition':_0x5a993f[_0x4316('0xb2')],'chatInfo':{'browser':_0x5a993f[_0x4316('0xb3')],'os':_0x5a993f[_0x4316('0xb4')],'referer':_0x5a993f[_0x4316('0xb5')],'customerIp':_0x5a993f[_0x4316('0xb6')],'customerPort':_0x5a993f[_0x4316('0xb7')]?_0x5a993f[_0x4316('0xb7')]:_0x4316('0xb1')},'messages':_(_0x5a993f[_0x4316('0x6a')])['tail']()[_0x4316('0x91')]({'secret':![]})['map'](function(_0x308214){if(_0x308214[_0x4316('0x61')]){var _0x3577b3=path['join'](_0x395560,_0x308214[_0x4316('0x61')][_0x4316('0x65')]);if(fs['existsSync'](_0x3577b3)){fs[_0x4316('0xb8')](_0x3577b3)[_0x4316('0xb9')](fs[_0x4316('0xba')](path['join'](_0x1c3eaf,_0x308214[_0x4316('0x61')][_0x4316('0x65')])));}}return{'date':moment(_0x308214[_0x4316('0x79')])[_0x4316('0x68')](_0x4316('0x94'))[_0x4316('0xa3')](),'sender':_0x308214[_0x4316('0x7b')]===_0x4316('0x51')?_0x308214[_0x4316('0x6b')]?_0x308214[_0x4316('0x6b')][_0x4316('0x75')]:_0x4316('0x76'):_0x308214['Contact'][_0x4316('0xaa')]+(_0x308214[_0x4316('0x57')][_0x4316('0xab')]?'\x20'+_0x308214['Contact'][_0x4316('0xab')]:''),'body':_0x308214[_0x4316('0x61')]?_0x308214[_0x4316('0x61')][_0x4316('0x65')]:_0x308214['body'],'direction':_0x308214[_0x4316('0x7b')]===_0x4316('0x51')?'A':'C','secret':_0x308214[_0x4316('0x98')],'read':_0x308214['read'],'attachment':_0x308214['Attachment']};})[_0x4316('0xbb')]()};return ejs[_0x4316('0xbc')](path[_0x4316('0x63')](config[_0x4316('0x67')],_0x4316('0xa4'),_0x4316('0xbd'),_0x4316('0xbe')),{'interaction':_0x396f6b})['then'](function(_0x1ca6d6){var _0x23064d=path['join'](_0x1c3eaf,_0x4316('0xbf')+_0x5a993f['id']+'-'+_0x64ca90+_0x4316('0xc0'));var _0x59c24a={'path':_0x23064d,'channel':_0x4316('0xc1'),'interactionId':_0x5a993f['id']};return pdf[_0x4316('0xc2')](_0x1ca6d6,_0x59c24a);})[_0x4316('0x13')](function(){return new Promise(function(_0x4e7a84,_0x59004d){zipdir(_0x1c3eaf,{'saveTo':_0x59e692},function(_0x47addd,_0x49bd90){if(_0x47addd)return _0x59004d(_0x47addd);return _0x4e7a84(_0x49bd90);});})[_0x4316('0x13')](function(){return new BPromise(function(_0x11398e,_0x1c5e88){rimraf(_0x1c3eaf,function(_0xe540c6){if(_0xe540c6)_0x1c5e88(_0xe540c6);return _0x11398e();});});})[_0x4316('0x13')](function(){return _0x5845c1[_0x4316('0xa1')](_0x59e692,_0x466940,function(_0x570eca){if(_0x570eca){logger[_0x4316('0x17')](_0x4316('0xc3'),_0x570eca);}else{fs[_0x4316('0xc4')](_0x59e692);}});});});}else{return _0x5845c1[_0x4316('0x5a')](0xc8);}})[_0x4316('0x1b')](handleError(_0x5845c1,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 299864f..0554189 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 _0xe33f=['emit','catch','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x16f6ca,_0x51447c){var _0x3f87f6=function(_0x145dcb){while(--_0x145dcb){_0x16f6ca['push'](_0x16f6ca['shift']());}};_0x3f87f6(++_0x51447c);}(_0xe33f,0x136));var _0xfe33=function(_0x31c6a2,_0x3bf8b3){_0x31c6a2=_0x31c6a2-0x0;var _0xe87acb=_0xe33f[_0x31c6a2];return _0xe87acb;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xfe33('0x0'))['db'][_0xfe33('0x1')];var ChatMessage=require(_0xfe33('0x0'))['db'][_0xfe33('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xfe33('0x3')](0x0);var events={'afterCreate':_0xfe33('0x4'),'afterUpdate':_0xfe33('0x5'),'afterDestroy':_0xfe33('0x6')};function emitEvent(_0x3127bb){return function(_0x3af05f,_0x5bc1c4,_0x15c384){_0x3af05f['getUsers']({'attributes':['id'],'raw':!![]})[_0xfe33('0x7')](function(_0x3de6ce){_0x3af05f[_0xfe33('0x8')](_0xfe33('0x9'),_0x3de6ce[_0xfe33('0xa')](function(_0x293bf5){return{'id':_0x293bf5['id']};}));return ChatMessage[_0xfe33('0xb')]({'where':{'ChatInteractionId':_0x3af05f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfe33('0x7')](function(_0x3ada2b){_0x3af05f['setDataValue'](_0xfe33('0xc'),_0x3ada2b[_0xfe33('0xd')]);ChatInteractionEvents[_0xfe33('0xe')](_0x3127bb+':'+_0x3af05f['id'],_0x3af05f);ChatInteractionEvents[_0xfe33('0xe')](_0x3127bb,_0x3af05f);_0x15c384(null);})[_0xfe33('0xf')](_0x15c384(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xfe33('0x10')](e,emitEvent(event));}}module[_0xfe33('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0xb8c8=['Users','map','findAll','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','update','remove','getUsers','then','setDataValue'];(function(_0x2d89f8,_0x2959e7){var _0x3e6700=function(_0x37bcec){while(--_0x37bcec){_0x2d89f8['push'](_0x2d89f8['shift']());}};_0x3e6700(++_0x2959e7);}(_0xb8c8,0xbb));var _0x8b8c=function(_0x472e18,_0xd42b15){_0x472e18=_0x472e18-0x0;var _0x195882=_0xb8c8[_0x472e18];return _0x195882;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x8b8c('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0x8b8c('0x0'))['db'][_0x8b8c('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x8b8c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b8c('0x3'),'afterDestroy':_0x8b8c('0x4')};function emitEvent(_0x3d5cf5){return function(_0x515260,_0x42e7c8,_0x1bac18){_0x515260[_0x8b8c('0x5')]({'attributes':['id'],'raw':!![]})[_0x8b8c('0x6')](function(_0x26f791){_0x515260[_0x8b8c('0x7')](_0x8b8c('0x8'),_0x26f791[_0x8b8c('0x9')](function(_0x17ac61){return{'id':_0x17ac61['id']};}));return ChatMessage[_0x8b8c('0xa')]({'where':{'ChatInteractionId':_0x515260['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b8c('0x6')](function(_0x2a856e){_0x515260['setDataValue']('unreadMessages',_0x2a856e['length']);ChatInteractionEvents[_0x8b8c('0xb')](_0x3d5cf5+':'+_0x515260['id'],_0x515260);ChatInteractionEvents[_0x8b8c('0xb')](_0x3d5cf5,_0x515260);_0x1bac18(null);})['catch'](_0x1bac18(null));};}for(var e in events){if(events[_0x8b8c('0xc')](e)){var event=events[e];ChatInteraction[_0x8b8c('0xd')](e,emitEvent(event));}}module[_0x8b8c('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 3c4e32f..cf0640c 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 _0x4acb=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5e7402,_0x193ac9){var _0x53d890=function(_0x6b1f0e){while(--_0x6b1f0e){_0x5e7402['push'](_0x5e7402['shift']());}};_0x53d890(++_0x193ac9);}(_0x4acb,0x9a));var _0xb4ac=function(_0x525b7d,_0x10def3){_0x525b7d=_0x525b7d-0x0;var _0x5c748e=_0x4acb[_0x525b7d];return _0x5c748e;};'use strict';var _=require('lodash');var util=require(_0xb4ac('0x0'));var logger=require(_0xb4ac('0x1'))(_0xb4ac('0x2'));var moment=require(_0xb4ac('0x3'));var BPromise=require(_0xb4ac('0x4'));var rp=require(_0xb4ac('0x5'));var fs=require('fs');var path=require(_0xb4ac('0x6'));var rimraf=require(_0xb4ac('0x7'));var config=require(_0xb4ac('0x8'));var attributes=require(_0xb4ac('0x9'));module[_0xb4ac('0xa')]=function(_0x8854bf,_0x2e6604){return _0x8854bf['define'](_0xb4ac('0xb'),attributes,{'tableName':_0xb4ac('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x6a2959,_0x1e0952,_0x3525bb){if(_0x6a2959[_0xb4ac('0xd')](_0xb4ac('0xe'))){_0x6a2959['closedAt']=moment()[_0xb4ac('0xf')](_0xb4ac('0x10'));}_0x3525bb(null,_0x6a2959);}},'charset':_0xb4ac('0x11'),'collate':_0xb4ac('0x12')});}; \ No newline at end of file +var _0xf914=['moment','bluebird','request-promise','path','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x37cab3,_0x3969ff){var _0x1c601f=function(_0x38b36a){while(--_0x38b36a){_0x37cab3['push'](_0x37cab3['shift']());}};_0x1c601f(++_0x3969ff);}(_0xf914,0x85));var _0x4f91=function(_0x4f7418,_0x1755cc){_0x4f7418=_0x4f7418-0x0;var _0x4afe7e=_0xf914[_0x4f7418];return _0x4afe7e;};'use strict';var _=require(_0x4f91('0x0'));var util=require(_0x4f91('0x1'));var logger=require(_0x4f91('0x2'))('api');var moment=require(_0x4f91('0x3'));var BPromise=require(_0x4f91('0x4'));var rp=require(_0x4f91('0x5'));var fs=require('fs');var path=require(_0x4f91('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4f91('0x7'));module[_0x4f91('0x8')]=function(_0x2b5be3,_0x3cf294){return _0x2b5be3['define'](_0x4f91('0x9'),attributes,{'tableName':_0x4f91('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f5aea,_0x52069c,_0x1cd1c3){if(_0x5f5aea['changed'](_0x4f91('0xb'))){_0x5f5aea[_0x4f91('0xc')]=moment()[_0x4f91('0xd')](_0x4f91('0xe'));}_0x1cd1c3(null,_0x5f5aea);}},'charset':_0x4f91('0xf'),'collate':_0x4f91('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 4a12b40..0975248 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 _0x8765=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','code','error','ChatInteraction,\x20%s,\x20%s','message','catch','UpdateChatInteraction','options','where','attributes','limit','stringify','AddTagsToChatInteraction','find','body','ids','omit','spread','AddTags','debug'];(function(_0x168466,_0x5f37e5){var _0xcf8a4=function(_0x48cf99){while(--_0x48cf99){_0x168466['push'](_0x168466['shift']());}};_0xcf8a4(++_0x5f37e5);}(_0x8765,0x7e));var _0x5876=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8765[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5876('0x0'));var util=require(_0x5876('0x1'));var moment=require(_0x5876('0x2'));var BPromise=require(_0x5876('0x3'));var rs=require(_0x5876('0x4'));var fs=require('fs');var Redis=require(_0x5876('0x5'));var db=require(_0x5876('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5876('0x7'));var config=require(_0x5876('0x8'));var jayson=require(_0x5876('0x9'));var client=jayson[_0x5876('0xa')][_0x5876('0xb')]({'port':0x232a});config[_0x5876('0xc')]=_[_0x5876('0xd')](config['redis'],{'host':_0x5876('0xe'),'port':0x18eb});var socket=require(_0x5876('0xf'))(new Redis(config[_0x5876('0xc')]));require(_0x5876('0x10'))[_0x5876('0x11')](socket);function respondWithRpcPromise(_0x201cda,_0x5ca96a,_0x14f43a){return new BPromise(function(_0x32d23c,_0x2b40aa){return client[_0x5876('0x12')](_0x201cda,_0x14f43a)[_0x5876('0x13')](function(_0x33dc43){logger[_0x5876('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x5ca96a,_0x5876('0x15'));logger['debug'](_0x5876('0x16'),_0x5ca96a,'request\x20sent',JSON['stringify'](_0x33dc43));if(_0x33dc43['error']){if(_0x33dc43['error'][_0x5876('0x17')]===0x1f4){logger[_0x5876('0x18')](_0x5876('0x19'),_0x5ca96a,_0x33dc43[_0x5876('0x18')][_0x5876('0x1a')]);return _0x2b40aa(_0x33dc43[_0x5876('0x18')][_0x5876('0x1a')]);}logger[_0x5876('0x18')](_0x5876('0x19'),_0x5ca96a,_0x33dc43['error'][_0x5876('0x1a')]);return _0x32d23c(_0x33dc43[_0x5876('0x18')][_0x5876('0x1a')]);}else{logger[_0x5876('0x14')](_0x5876('0x19'),_0x5ca96a,'request\x20sent');_0x32d23c(_0x33dc43['result'][_0x5876('0x1a')]);}})[_0x5876('0x1b')](function(_0xe7cf54){logger[_0x5876('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x5ca96a,_0xe7cf54);_0x2b40aa(_0xe7cf54);});});}exports[_0x5876('0x1c')]=function(_0x58b040){var _0x46ccb5=this;return new Promise(function(_0x160ad4,_0x12588c){return db['ChatInteraction']['update'](_0x58b040['body'],{'raw':_0x58b040[_0x5876('0x1d')]?_0x58b040[_0x5876('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58b040[_0x5876('0x1d')]?_0x58b040['options'][_0x5876('0x1e')]||null:null,'attributes':_0x58b040[_0x5876('0x1d')]?_0x58b040[_0x5876('0x1d')][_0x5876('0x1f')]||null:null,'limit':_0x58b040['options']?_0x58b040[_0x5876('0x1d')][_0x5876('0x20')]||null:null})[_0x5876('0x13')](function(_0x6d30da){logger['info'](_0x5876('0x1c'),_0x58b040);logger['debug']('UpdateChatInteraction',_0x58b040,JSON[_0x5876('0x21')](_0x6d30da));_0x160ad4(_0x6d30da);})[_0x5876('0x1b')](function(_0x43cd80){logger[_0x5876('0x18')](_0x5876('0x1c'),_0x43cd80[_0x5876('0x1a')],_0x58b040);_0x12588c(_0x46ccb5['error'](0x1f4,_0x43cd80[_0x5876('0x1a')]));});});};exports[_0x5876('0x22')]=function(_0x3f8186){return new Promise(function(_0x7b4aeb,_0x31e3df){return db['ChatInteraction'][_0x5876('0x23')]({'where':_0x3f8186['options']?_0x3f8186[_0x5876('0x1d')][_0x5876('0x1e')]||null:null})[_0x5876('0x13')](function(_0x597447){if(_0x597447){return _0x597447['addTags'](_0x3f8186[_0x5876('0x24')][_0x5876('0x25')],_[_0x5876('0x26')](_0x3f8186[_0x5876('0x24')],[_0x5876('0x25'),'id'])||{});}})[_0x5876('0x27')](function(_0x555a48){logger[_0x5876('0x14')](_0x5876('0x28'),_0x3f8186);logger[_0x5876('0x29')](_0x5876('0x28'),_0x3f8186,JSON[_0x5876('0x21')](_0x555a48));_0x7b4aeb(_0x555a48);})[_0x5876('0x1b')](function(_0x1dbea6){logger[_0x5876('0x18')](_0x5876('0x28'),_0x1dbea6['message'],_0x3f8186);_0x31e3df(_this['error'](0x1f4,_0x1dbea6[_0x5876('0x1a')]));});});}; \ No newline at end of file +var _0x6ea4=['debug','AddTagsToChatInteraction','addTags','body','omit','ids','spread','AddTags','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit'];(function(_0x54e30f,_0x3d2450){var _0x8accde=function(_0x4eca4a){while(--_0x4eca4a){_0x54e30f['push'](_0x54e30f['shift']());}};_0x8accde(++_0x3d2450);}(_0x6ea4,0x1d6));var _0x46ea=function(_0x50ed5c,_0x38e2f2){_0x50ed5c=_0x50ed5c-0x0;var _0x42905c=_0x6ea4[_0x50ed5c];return _0x42905c;};'use strict';var _=require(_0x46ea('0x0'));var util=require('util');var moment=require(_0x46ea('0x1'));var BPromise=require(_0x46ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x46ea('0x4'));var logger=require('../../config/logger')(_0x46ea('0x5'));var config=require(_0x46ea('0x6'));var jayson=require(_0x46ea('0x7'));var client=jayson['client'][_0x46ea('0x8')]({'port':0x232a});config[_0x46ea('0x9')]=_[_0x46ea('0xa')](config[_0x46ea('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x46ea('0xb'))(new Redis(config[_0x46ea('0x9')]));require(_0x46ea('0xc'))[_0x46ea('0xd')](socket);function respondWithRpcPromise(_0x6f2eb1,_0x5589fa,_0x3c1629){return new BPromise(function(_0x3d1df7,_0x590614){return client[_0x46ea('0xe')](_0x6f2eb1,_0x3c1629)[_0x46ea('0xf')](function(_0x59ded9){logger[_0x46ea('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x5589fa,_0x46ea('0x11'));logger['debug'](_0x46ea('0x12'),_0x5589fa,'request\x20sent',JSON[_0x46ea('0x13')](_0x59ded9));if(_0x59ded9[_0x46ea('0x14')]){if(_0x59ded9[_0x46ea('0x14')][_0x46ea('0x15')]===0x1f4){logger[_0x46ea('0x14')](_0x46ea('0x16'),_0x5589fa,_0x59ded9[_0x46ea('0x14')][_0x46ea('0x17')]);return _0x590614(_0x59ded9[_0x46ea('0x14')][_0x46ea('0x17')]);}logger[_0x46ea('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x5589fa,_0x59ded9[_0x46ea('0x14')][_0x46ea('0x17')]);return _0x3d1df7(_0x59ded9[_0x46ea('0x14')][_0x46ea('0x17')]);}else{logger[_0x46ea('0x10')](_0x46ea('0x16'),_0x5589fa,_0x46ea('0x11'));_0x3d1df7(_0x59ded9[_0x46ea('0x18')]['message']);}})[_0x46ea('0x19')](function(_0x566b74){logger[_0x46ea('0x14')](_0x46ea('0x16'),_0x5589fa,_0x566b74);_0x590614(_0x566b74);});});}exports[_0x46ea('0x1a')]=function(_0x18ded4){var _0x57a5f6=this;return new Promise(function(_0x4b160b,_0x25309a){return db[_0x46ea('0x1b')][_0x46ea('0x1c')](_0x18ded4['body'],{'raw':_0x18ded4[_0x46ea('0x1d')]?_0x18ded4['options'][_0x46ea('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18ded4[_0x46ea('0x1d')]?_0x18ded4[_0x46ea('0x1d')][_0x46ea('0x1f')]||null:null,'attributes':_0x18ded4['options']?_0x18ded4['options'][_0x46ea('0x20')]||null:null,'limit':_0x18ded4[_0x46ea('0x1d')]?_0x18ded4[_0x46ea('0x1d')][_0x46ea('0x21')]||null:null})['then'](function(_0x33ffb0){logger['info'](_0x46ea('0x1a'),_0x18ded4);logger[_0x46ea('0x22')](_0x46ea('0x1a'),_0x18ded4,JSON[_0x46ea('0x13')](_0x33ffb0));_0x4b160b(_0x33ffb0);})[_0x46ea('0x19')](function(_0xaaca10){logger['error'](_0x46ea('0x1a'),_0xaaca10['message'],_0x18ded4);_0x25309a(_0x57a5f6['error'](0x1f4,_0xaaca10[_0x46ea('0x17')]));});});};exports[_0x46ea('0x23')]=function(_0x571666){return new Promise(function(_0x3a2a15,_0x3bbb63){return db['ChatInteraction']['find']({'where':_0x571666[_0x46ea('0x1d')]?_0x571666[_0x46ea('0x1d')]['where']||null:null})[_0x46ea('0xf')](function(_0x59d00b){if(_0x59d00b){return _0x59d00b[_0x46ea('0x24')](_0x571666[_0x46ea('0x25')]['ids'],_[_0x46ea('0x26')](_0x571666[_0x46ea('0x25')],[_0x46ea('0x27'),'id'])||{});}})[_0x46ea('0x28')](function(_0x2b1e86){logger[_0x46ea('0x10')]('AddTags',_0x571666);logger[_0x46ea('0x22')](_0x46ea('0x29'),_0x571666,JSON[_0x46ea('0x13')](_0x2b1e86));_0x3a2a15(_0x2b1e86);})['catch'](function(_0x3d125a){logger['error'](_0x46ea('0x29'),_0x3d125a[_0x46ea('0x17')],_0x571666);_0x3bbb63(_this['error'](0x1f4,_0x3d125a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1b67fb4..8b0e42f 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 _0x73f9=['remove','update','emit','removeListener','length','chatInteraction:','save'];(function(_0x16b0c8,_0x51ecb2){var _0x147e60=function(_0x3214e9){while(--_0x3214e9){_0x16b0c8['push'](_0x16b0c8['shift']());}};_0x147e60(++_0x51ecb2);}(_0x73f9,0x1c6));var _0x973f=function(_0x453dc8,_0x4874b6){_0x453dc8=_0x453dc8-0x0;var _0x4c3595=_0x73f9[_0x453dc8];return _0x4c3595;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x973f('0x0'),_0x973f('0x1'),_0x973f('0x2')];function createListener(_0x1e6168,_0x3c7eaf){return function(_0x14cffe){_0x3c7eaf[_0x973f('0x3')](_0x1e6168,_0x14cffe);};}function removeListener(_0x5c85cf,_0x30897a){return function(){ChatInteractionEvents[_0x973f('0x4')](_0x5c85cf,_0x30897a);};}exports['register']=function(_0x4e752d){for(var _0x387c32=0x0,_0x4f09c1=events[_0x973f('0x5')];_0x387c32<_0x4f09c1;_0x387c32++){var _0x48feb6=events[_0x387c32];var _0x5cd408=createListener(_0x973f('0x6')+_0x48feb6,_0x4e752d);ChatInteractionEvents['on'](_0x48feb6,_0x5cd408);}}; \ No newline at end of file +var _0xf6ae=['./chatInteraction.events','save','remove','update','emit','removeListener','length','chatInteraction:'];(function(_0x2f2619,_0x27618f){var _0x4f958f=function(_0x3a432d){while(--_0x3a432d){_0x2f2619['push'](_0x2f2619['shift']());}};_0x4f958f(++_0x27618f);}(_0xf6ae,0x1d0));var _0xef6a=function(_0x435c0e,_0x394a4a){_0x435c0e=_0x435c0e-0x0;var _0x1742ef=_0xf6ae[_0x435c0e];return _0x1742ef;};'use strict';var ChatInteractionEvents=require(_0xef6a('0x0'));var events=[_0xef6a('0x1'),_0xef6a('0x2'),_0xef6a('0x3')];function createListener(_0x64cfb5,_0x4d18b9){return function(_0x92937a){_0x4d18b9[_0xef6a('0x4')](_0x64cfb5,_0x92937a);};}function removeListener(_0x3ba9a1,_0x40ecb6){return function(){ChatInteractionEvents[_0xef6a('0x5')](_0x3ba9a1,_0x40ecb6);};}exports['register']=function(_0x1f8c67){for(var _0xb53a73=0x0,_0x78a4f1=events[_0xef6a('0x6')];_0xb53a73<_0x78a4f1;_0xb53a73++){var _0x55c966=events[_0xb53a73];var _0x5641ba=createListener(_0xef6a('0x7')+_0x55c966,_0x1f8c67);ChatInteractionEvents['on'](_0x55c966,_0x5641ba);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2e5f19e..0ce0ff7 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 _0x2580=['update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','/:id/my_messages','getMyMessages','download','create','post','/:id/vidaoo','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','file','attachmentUpload','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update'];(function(_0x1798e1,_0x262b8e){var _0x57a2d9=function(_0x40435e){while(--_0x40435e){_0x1798e1['push'](_0x1798e1['shift']());}};_0x57a2d9(++_0x262b8e);}(_0x2580,0x10f));var _0x0258=function(_0x4fd6e9,_0x34e6d6){_0x4fd6e9=_0x4fd6e9-0x0;var _0x54c5c4=_0x2580[_0x4fd6e9];return _0x54c5c4;};'use strict';var multer=require(_0x0258('0x0'));var util=require(_0x0258('0x1'));var path=require(_0x0258('0x2'));var timeout=require(_0x0258('0x3'));var express=require(_0x0258('0x4'));var router=express['Router']();var fs_extra=require(_0x0258('0x5'));var auth=require(_0x0258('0x6'));var interaction=require(_0x0258('0x7'));var config=require('../../config/environment');var controller=require(_0x0258('0x8'));router[_0x0258('0x9')]('/',auth[_0x0258('0xa')](),controller[_0x0258('0xb')]);router[_0x0258('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x0258('0xc')]);router['get'](_0x0258('0xd'),auth[_0x0258('0xe')](),controller[_0x0258('0xf')]);router[_0x0258('0x9')](_0x0258('0x10'),auth[_0x0258('0xe')](),controller['attachmentDownload']);router['get'](_0x0258('0x11'),auth[_0x0258('0xa')](),controller['getMessages']);router[_0x0258('0x9')](_0x0258('0x12'),auth[_0x0258('0xe')](),controller[_0x0258('0x13')]);router[_0x0258('0x9')]('/:id/download',auth[_0x0258('0xa')](),controller[_0x0258('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0258('0x15')]);router[_0x0258('0x16')](_0x0258('0x17'),auth[_0x0258('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4cc3ee,_0x46680a,_0x3a2caa){_0x3a2caa(null,path[_0x0258('0x18')](config[_0x0258('0x19')],_0x0258('0x1a')));},'filename':function(_0x20c580,_0x2f538e,_0x3e4d44){_0x3e4d44(null,util[_0x0258('0x1b')](_0x0258('0x1c'),Date[_0x0258('0x1d')](),_0x2f538e[_0x0258('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x0258('0x1f'),upload['single'](_0x0258('0x20')),controller[_0x0258('0x21')]);router[_0x0258('0x16')](_0x0258('0x11'),auth[_0x0258('0xe')](),controller['addMessage']);router[_0x0258('0x16')](_0x0258('0x22'),auth[_0x0258('0xa')](),interaction[_0x0258('0x23')]('chat',_0x0258('0x24')),controller[_0x0258('0x25')]);router[_0x0258('0x26')](_0x0258('0xd'),auth[_0x0258('0xa')](),interaction[_0x0258('0x23')](_0x0258('0x27'),_0x0258('0x28')),controller[_0x0258('0x29')]);router[_0x0258('0x26')](_0x0258('0x2a'),controller[_0x0258('0x2b')]);router[_0x0258('0x26')](_0x0258('0x2c'),auth[_0x0258('0xe')](),controller[_0x0258('0x2d')]);router[_0x0258('0x26')](_0x0258('0x2e'),controller[_0x0258('0x2f')]);router['delete']('/:id',auth[_0x0258('0xa')](),interaction[_0x0258('0x23')]('chat','chatinteraction:destroy'),controller[_0x0258('0x30')]);router[_0x0258('0x31')](_0x0258('0x22'),auth[_0x0258('0xa')](),controller[_0x0258('0x32')]);module[_0x0258('0x33')]=router; \ No newline at end of file +var _0x7605=['createVidaooSession','root','server/files/attachments/','format','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','chat','chatinteraction:update','update','put','customUpdate','/:id/abandon','/:id/close','delete','chatinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/download','create','post','/:id/vidaoo'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7605,0x191));var _0x5760=function(_0x41ff01,_0x432b4e){_0x41ff01=_0x41ff01-0x0;var _0x165ebc=_0x7605[_0x41ff01];return _0x165ebc;};'use strict';var multer=require(_0x5760('0x0'));var util=require(_0x5760('0x1'));var path=require(_0x5760('0x2'));var timeout=require('connect-timeout');var express=require(_0x5760('0x3'));var router=express[_0x5760('0x4')]();var fs_extra=require(_0x5760('0x5'));var auth=require(_0x5760('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5760('0x7'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x5760('0x8')](),controller[_0x5760('0x9')]);router['get'](_0x5760('0xa'),auth['isAuthenticated'](),controller[_0x5760('0xb')]);router[_0x5760('0xc')](_0x5760('0xd'),auth[_0x5760('0xe')](),controller['show']);router[_0x5760('0xc')]('/:id/attachment_download',auth[_0x5760('0xe')](),controller[_0x5760('0xf')]);router[_0x5760('0xc')](_0x5760('0x10'),auth[_0x5760('0x8')](),controller[_0x5760('0x11')]);router[_0x5760('0xc')]('/:id/my_messages',auth[_0x5760('0xe')](),controller['getMyMessages']);router[_0x5760('0xc')](_0x5760('0x12'),auth[_0x5760('0x8')](),controller['download']);router['post']('/',auth[_0x5760('0x8')](),controller[_0x5760('0x13')]);router[_0x5760('0x14')](_0x5760('0x15'),auth[_0x5760('0x8')](),controller[_0x5760('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ef837,_0x164215,_0xf67730){_0xf67730(null,path['join'](config[_0x5760('0x17')],_0x5760('0x18')));},'filename':function(_0x1aeb3f,_0x2c9b25,_0x571dad){_0x571dad(null,util[_0x5760('0x19')]('%s-%s',Date['now'](),_0x2c9b25[_0x5760('0x1a')][_0x5760('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x5760('0x1c'),upload[_0x5760('0x1d')](_0x5760('0x1e')),controller[_0x5760('0x1f')]);router[_0x5760('0x14')](_0x5760('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x5760('0x20')]);router[_0x5760('0x14')](_0x5760('0x21'),auth[_0x5760('0x8')](),interaction[_0x5760('0x22')]('chat',_0x5760('0x23')),controller['addTags']);router['put']('/:id',auth[_0x5760('0x8')](),interaction[_0x5760('0x22')](_0x5760('0x24'),_0x5760('0x25')),controller[_0x5760('0x26')]);router[_0x5760('0x27')]('/:id/custom_update',controller[_0x5760('0x28')]);router[_0x5760('0x27')](_0x5760('0x29'),auth[_0x5760('0xe')](),controller['abandon']);router[_0x5760('0x27')](_0x5760('0x2a'),controller['close']);router[_0x5760('0x2b')](_0x5760('0xd'),auth[_0x5760('0x8')](),interaction[_0x5760('0x22')](_0x5760('0x24'),_0x5760('0x2c')),controller['destroy']);router['delete'](_0x5760('0x21'),auth[_0x5760('0x8')](),controller[_0x5760('0x2d')]);module[_0x5760('0x2e')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 84a5092..5fb1c5a 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 _0x6cf2=['exports','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6cf2,0xb8));var _0x26cf=function(_0x438525,_0x16ea09){_0x438525=_0x438525-0x0;var _0x288a50=_0x6cf2[_0x438525];return _0x288a50;};'use strict';var Sequelize=require(_0x26cf('0x0'));module[_0x26cf('0x1')]={'body':{'type':Sequelize['TEXT'](_0x26cf('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x26cf('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x26cf('0x4')]}}; \ No newline at end of file +var _0xdb69=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x5d0fe6,_0x40ae52){var _0x2ce912=function(_0x260da2){while(--_0x260da2){_0x5d0fe6['push'](_0x5d0fe6['shift']());}};_0x2ce912(++_0x40ae52);}(_0xdb69,0x170));var _0x9db6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xdb69[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x9db6('0x0')]={'body':{'type':Sequelize[_0x9db6('0x1')](_0x9db6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9db6('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9db6('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f449ccd..01d6b6c 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 _0x5b0d=['body','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','admin','user','fullname','role','internal','online','showWebBar','-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','resourceId','push','FromId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatInternalMessage','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','catch','show','params','rawAttributes','length','options','find','create'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0x5b0d,0x8f));var _0xd5b0=function(_0x3dd174,_0x31fcf6){_0x3dd174=_0x3dd174-0x0;var _0x2d0e06=_0x5b0d[_0x3dd174];return _0x2d0e06;};'use strict';var emlformat=require(_0xd5b0('0x0'));var rimraf=require(_0xd5b0('0x1'));var zipdir=require(_0xd5b0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd5b0('0x3'));var moment=require(_0xd5b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd5b0('0x5'));var util=require(_0xd5b0('0x6'));var path=require('path');var sox=require(_0xd5b0('0x7'));var csv=require('to-csv');var ejs=require(_0xd5b0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd5b0('0x9'));var squel=require(_0xd5b0('0xa'));var crypto=require(_0xd5b0('0xb'));var jsforce=require(_0xd5b0('0xc'));var deskjs=require(_0xd5b0('0xd'));var toCsv=require(_0xd5b0('0xe'));var querystring=require('querystring');var Papa=require(_0xd5b0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd5b0('0x10'));var as=require(_0xd5b0('0x11'));var hardwareService=require(_0xd5b0('0x12'));var logger=require(_0xd5b0('0x13'))(_0xd5b0('0x14'));var utils=require(_0xd5b0('0x15'));var config=require(_0xd5b0('0x16'));var licenseUtil=require(_0xd5b0('0x17'));var db=require(_0xd5b0('0x18'))['db'];config[_0xd5b0('0x19')]=_[_0xd5b0('0x1a')](config[_0xd5b0('0x19')],{'host':_0xd5b0('0x1b'),'port':0x18eb});var socket=require(_0xd5b0('0x1c'))(new Redis(config[_0xd5b0('0x19')]));require(_0xd5b0('0x1d'))[_0xd5b0('0x1e')](socket);function respondWithStatusCode(_0x40b3eb,_0x3d44d3){_0x3d44d3=_0x3d44d3||0xcc;return function(_0x25d19d){if(_0x25d19d){return _0x40b3eb[_0xd5b0('0x1f')](_0x3d44d3);}return _0x40b3eb[_0xd5b0('0x20')](_0x3d44d3)[_0xd5b0('0x21')]();};}function respondWithResult(_0x4e2117,_0x5aacdd){_0x5aacdd=_0x5aacdd||0xc8;return function(_0x117b87){if(_0x117b87){return _0x4e2117['status'](_0x5aacdd)[_0xd5b0('0x22')](_0x117b87);}};}function respondWithFilteredResult(_0x5eeb27,_0x360884){return function(_0xec4f0f){if(_0xec4f0f){var _0x3d4661=typeof _0x360884[_0xd5b0('0x23')]===_0xd5b0('0x24')&&typeof _0x360884[_0xd5b0('0x25')]===_0xd5b0('0x24');var _0xad2471=_0xec4f0f[_0xd5b0('0x26')];var _0x570012=_0x3d4661?0x0:_0x360884[_0xd5b0('0x23')];var _0x567861=_0x3d4661?_0xec4f0f['count']:_0x360884[_0xd5b0('0x23')]+_0x360884[_0xd5b0('0x25')];var _0x183d2a;if(_0x567861>=_0xad2471){_0x567861=_0xad2471;_0x183d2a=0xc8;}else{_0x183d2a=0xce;}_0x5eeb27[_0xd5b0('0x20')](_0x183d2a);return _0x5eeb27['set'](_0xd5b0('0x27'),_0x570012+'-'+_0x567861+'/'+_0xad2471)['json'](_0xec4f0f);}return null;};}function patchUpdates(_0x4f469f){return function(_0x49ba3a){try{jsonpatch[_0xd5b0('0x28')](_0x49ba3a,_0x4f469f,!![]);}catch(_0x9d4cb2){return BPromise[_0xd5b0('0x29')](_0x9d4cb2);}return _0x49ba3a[_0xd5b0('0x2a')]();};}function saveUpdates(_0x6a37b,_0x502528){return function(_0x26db0d){if(_0x26db0d){return _0x26db0d[_0xd5b0('0x2b')](_0x6a37b)[_0xd5b0('0x2c')](function(_0x2d81d7){return _0x2d81d7;});}return null;};}function removeEntity(_0xa8ee8f,_0x853bc2){return function(_0x291673){if(_0x291673){return _0x291673[_0xd5b0('0x2d')]()[_0xd5b0('0x2c')](function(){_0xa8ee8f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5713b0,_0x545159){return function(_0x257c0a){if(!_0x257c0a){_0x5713b0[_0xd5b0('0x1f')](0x194);}return _0x257c0a;};}function handleError(_0x896fec,_0x4c543a){_0x4c543a=_0x4c543a||0x1f4;return function(_0x40afd1){logger[_0xd5b0('0x2e')](_0x40afd1[_0xd5b0('0x2f')]);if(_0x40afd1[_0xd5b0('0x30')]){delete _0x40afd1[_0xd5b0('0x30')];}_0x896fec[_0xd5b0('0x20')](_0x4c543a)[_0xd5b0('0x31')](_0x40afd1);};}exports[_0xd5b0('0x32')]=function(_0x59b07c,_0x1a345f){var _0x3918a8={},_0x8df1e9={},_0x369df9={'count':0x0,'rows':[]};var _0x3f5dee=_['map'](db[_0xd5b0('0x33')]['rawAttributes'],function(_0x238812){return{'name':_0x238812[_0xd5b0('0x34')],'type':_0x238812[_0xd5b0('0x35')][_0xd5b0('0x36')]};});_0x8df1e9[_0xd5b0('0x37')]=_[_0xd5b0('0x38')](_0x3f5dee,_0xd5b0('0x30'));_0x8df1e9[_0xd5b0('0x39')]=_[_0xd5b0('0x3a')](_0x59b07c[_0xd5b0('0x39')]);_0x8df1e9[_0xd5b0('0x3b')]=_['intersection'](_0x8df1e9[_0xd5b0('0x37')],_0x8df1e9[_0xd5b0('0x39')]);_0x3918a8[_0xd5b0('0x3c')]=_[_0xd5b0('0x3d')](_0x8df1e9[_0xd5b0('0x37')],qs['fields'](_0x59b07c[_0xd5b0('0x39')][_0xd5b0('0x3e')]));_0x3918a8[_0xd5b0('0x3c')]=_0x3918a8[_0xd5b0('0x3c')]['length']?_0x3918a8['attributes']:_0x8df1e9[_0xd5b0('0x37')];if(!_0x59b07c[_0xd5b0('0x39')][_0xd5b0('0x3f')](_0xd5b0('0x40'))){_0x3918a8[_0xd5b0('0x25')]=qs[_0xd5b0('0x25')](_0x59b07c[_0xd5b0('0x39')][_0xd5b0('0x25')]);_0x3918a8[_0xd5b0('0x23')]=qs[_0xd5b0('0x23')](_0x59b07c['query'][_0xd5b0('0x23')]);}_0x3918a8[_0xd5b0('0x41')]=qs['sort'](_0x59b07c[_0xd5b0('0x39')][_0xd5b0('0x42')]);_0x3918a8[_0xd5b0('0x43')]=qs[_0xd5b0('0x3b')](_[_0xd5b0('0x44')](_0x59b07c['query'],_0x8df1e9[_0xd5b0('0x3b')]),_0x3f5dee);if(_0x59b07c[_0xd5b0('0x39')]['filter']){_0x3918a8[_0xd5b0('0x43')]=_[_0xd5b0('0x45')](_0x3918a8[_0xd5b0('0x43')],{'$or':_['map'](_0x3f5dee,function(_0x386619){if(_0x386619[_0xd5b0('0x35')]!=='VIRTUAL'){var _0x30796e={};_0x30796e[_0x386619[_0xd5b0('0x30')]]={'$like':'%'+_0x59b07c['query'][_0xd5b0('0x46')]+'%'};return _0x30796e;}})});}_0x3918a8=_['merge']({},_0x3918a8,_0x59b07c['options']);var _0x192b69={'where':_0x3918a8[_0xd5b0('0x43')]};return db[_0xd5b0('0x33')]['count'](_0x192b69)[_0xd5b0('0x2c')](function(_0x38f210){_0x369df9[_0xd5b0('0x26')]=_0x38f210;if(_0x59b07c['query'][_0xd5b0('0x47')]){_0x3918a8[_0xd5b0('0x48')]=[{'all':!![]}];}return db[_0xd5b0('0x33')]['findAll'](_0x3918a8);})[_0xd5b0('0x2c')](function(_0x1441a9){_0x369df9['rows']=_0x1441a9;return _0x369df9;})[_0xd5b0('0x2c')](respondWithFilteredResult(_0x1a345f,_0x3918a8))[_0xd5b0('0x49')](handleError(_0x1a345f,null));};exports[_0xd5b0('0x4a')]=function(_0x125c21,_0x3ba8dd){var _0x874285={'raw':!![],'where':{'id':_0x125c21[_0xd5b0('0x4b')]['id']}},_0x565491={};_0x565491[_0xd5b0('0x37')]=_[_0xd5b0('0x3a')](db[_0xd5b0('0x33')][_0xd5b0('0x4c')]);_0x565491[_0xd5b0('0x39')]=_[_0xd5b0('0x3a')](_0x125c21[_0xd5b0('0x39')]);_0x565491[_0xd5b0('0x3b')]=_['intersection'](_0x565491[_0xd5b0('0x37')],_0x565491['query']);_0x874285['attributes']=_[_0xd5b0('0x3d')](_0x565491[_0xd5b0('0x37')],qs[_0xd5b0('0x3e')](_0x125c21[_0xd5b0('0x39')][_0xd5b0('0x3e')]));_0x874285[_0xd5b0('0x3c')]=_0x874285[_0xd5b0('0x3c')][_0xd5b0('0x4d')]?_0x874285[_0xd5b0('0x3c')]:_0x565491[_0xd5b0('0x37')];if(_0x125c21[_0xd5b0('0x39')][_0xd5b0('0x47')]){_0x874285[_0xd5b0('0x48')]=[{'all':!![]}];}_0x874285=_[_0xd5b0('0x45')]({},_0x874285,_0x125c21[_0xd5b0('0x4e')]);return db['ChatInternalMessage'][_0xd5b0('0x4f')](_0x874285)[_0xd5b0('0x2c')](handleEntityNotFound(_0x3ba8dd,null))[_0xd5b0('0x2c')](respondWithResult(_0x3ba8dd,null))[_0xd5b0('0x49')](handleError(_0x3ba8dd,null));};exports[_0xd5b0('0x50')]=function(_0x180861,_0x29d5fb){return db['ChatInternalMessage'][_0xd5b0('0x50')](_0x180861['body'],{})[_0xd5b0('0x2c')](respondWithResult(_0x29d5fb,0xc9))[_0xd5b0('0x49')](handleError(_0x29d5fb,null));};exports[_0xd5b0('0x2b')]=function(_0x39e09a,_0x3d35ea){if(_0x39e09a[_0xd5b0('0x51')]['id']){delete _0x39e09a[_0xd5b0('0x51')]['id'];}return db[_0xd5b0('0x33')]['find']({'where':{'id':_0x39e09a[_0xd5b0('0x4b')]['id']}})[_0xd5b0('0x2c')](handleEntityNotFound(_0x3d35ea,null))[_0xd5b0('0x2c')](saveUpdates(_0x39e09a['body'],null))[_0xd5b0('0x2c')](respondWithResult(_0x3d35ea,null))[_0xd5b0('0x49')](handleError(_0x3d35ea,null));};exports[_0xd5b0('0x2d')]=function(_0x14c5f0,_0x1a5aaa){return db['ChatInternalMessage'][_0xd5b0('0x4f')]({'where':{'id':_0x14c5f0[_0xd5b0('0x4b')]['id']}})[_0xd5b0('0x2c')](handleEntityNotFound(_0x1a5aaa,null))['then'](removeEntity(_0x1a5aaa,null))['catch'](handleError(_0x1a5aaa,null));};exports[_0xd5b0('0x52')]=function(_0x5a100f,_0x2793d9){return db[_0xd5b0('0x33')][_0xd5b0('0x52')]()['then'](respondWithResult(_0x2793d9,null))['catch'](handleError(_0x2793d9,null));};function wrapUser(_0x5c829f){return function(_0x5160ed){var _0x576874=_0x5c829f[_0xd5b0('0x53')]({'plain':!![]});_0x576874[_0xd5b0('0x54')]=[];if(_0x5160ed){_0x576874[_0xd5b0('0x55')]=_0x5160ed[_0xd5b0('0x56')];_0x576874[_0xd5b0('0x57')]=_0x5160ed;}else{_0x576874[_0xd5b0('0x55')]=moment(0x0)['format'](_0xd5b0('0x58'));_0x576874['lastMessage']={};}return _0x576874;};}exports[_0xd5b0('0x59')]=function(_0x5b89ba,_0x578714,_0x345f96){var _0x1c2c83=[];return db[_0xd5b0('0x5a')][_0xd5b0('0x5b')]({'where':{'role':[_0xd5b0('0x5c'),_0xd5b0('0x5d'),_0xd5b0('0x5e')]},'attributes':['id',_0xd5b0('0x5f'),_0xd5b0('0x30'),_0xd5b0('0x60'),'userpic',_0xd5b0('0x61'),_0xd5b0('0x62'),'lastLoginAt','allowmessenger',_0xd5b0('0x63')],'order':qs[_0xd5b0('0x42')](_0xd5b0('0x64')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0xd5b0('0x30'),_0xd5b0('0x35')],'through':{'attributes':[]}}]})['then'](function(_0x4bf76d){if(_0x4bf76d){var _0x279e66=_0x5b89ba[_0xd5b0('0x5e')][_0xd5b0('0x53')]({'plain':!![]});if(!_0x279e66)throw new Error(_0xd5b0('0x65'));if(_0x279e66[_0xd5b0('0x60')]==='user'){return db[_0xd5b0('0x66')][_0xd5b0('0x4f')]({'where':{'name':_0xd5b0('0x67'),'userProfileId':_0x279e66[_0xd5b0('0x68')]},'raw':!![]})[_0xd5b0('0x2c')](function(_0x20f321){if(_0x20f321){if(_0x20f321['autoAssociation']===0x0){return db[_0xd5b0('0x69')][_0xd5b0('0x5b')]({'where':{'sectionId':_0x20f321['id']},'raw':!![]})[_0xd5b0('0x2c')](function(_0x23233b){var _0x32fc07=[];if(_['isEmpty'](_0x23233b)){_0x32fc07=_['filter'](_0x4bf76d,function(_0x369d52){if(_0x369d52[_0xd5b0('0x60')]!==_0xd5b0('0x5c')){return _0x369d52;}});return _0x32fc07;}else{for(var _0x1142dd=0x0;_0x1142dd<_0x4bf76d[_0xd5b0('0x4d')];_0x1142dd++){var _0x1e0d8b=_0x4bf76d[_0x1142dd];if(_0x1e0d8b[_0xd5b0('0x60')]===_0xd5b0('0x5c')){var _0x1d2672=_['find'](_0x23233b,function(_0x1b3160){return _0x1b3160[_0xd5b0('0x6a')]===_0x1e0d8b['id'];});if(_0x1d2672)_0x32fc07[_0xd5b0('0x6b')](_0x1e0d8b);}else{_0x32fc07[_0xd5b0('0x6b')](_0x1e0d8b);}}return _0x32fc07;}});}else{return _0x4bf76d;}}else{var _0x4a69d8=_[_0xd5b0('0x46')](_0x4bf76d,function(_0x2975c0){if(_0x2975c0[_0xd5b0('0x60')]!==_0xd5b0('0x5c')){return _0x2975c0;}});return _0x4a69d8;}});}else{return _0x4bf76d;}}})[_0xd5b0('0x2c')](function(_0x527615){var _0x5de861=[];if(_0x527615){_0x1c2c83=_0x527615;for(var _0x1e1a52=0x0;_0x1e1a52<_0x527615[_0xd5b0('0x4d')];_0x1e1a52+=0x1){_0x1c2c83[_0x1e1a52][_0xd5b0('0x54')]=[];_0x5de861[_0xd5b0('0x6b')](db[_0xd5b0('0x33')][_0xd5b0('0x4f')]({'where':{'FromId':[_0x5b89ba[_0xd5b0('0x5e')]['id'],_0x527615[_0x1e1a52]['id']],'ToId':[_0x5b89ba[_0xd5b0('0x5e')]['id'],_0x527615[_0x1e1a52]['id']],'ChatGroupId':null},'attributes':['id',_0xd5b0('0x56'),_0xd5b0('0x6c'),'ToId',_0xd5b0('0x6d'),_0xd5b0('0x51')],'order':qs[_0xd5b0('0x42')](_0xd5b0('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd5b0('0x2c')](wrapUser(_0x527615[_0x1e1a52])));}return BPromise[_0xd5b0('0x6f')](_0x5de861);}return[];})[_0xd5b0('0x2c')](function(_0x49f221){return{'rows':_0x49f221,'count':_0x49f221['length']};})[_0xd5b0('0x2c')](respondWithResult(_0x578714,null))[_0xd5b0('0x49')](handleError(_0x578714,null));}; \ No newline at end of file +var _0xe687=['eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','get','messages','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','admin','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','filter','resourceId','push','FromId','ToId','read','-createdAt','all'];(function(_0x15c667,_0x306a08){var _0x540e10=function(_0x48e90e){while(--_0x48e90e){_0x15c667['push'](_0x15c667['shift']());}};_0x540e10(++_0x306a08);}(_0xe687,0xdc));var _0x7e68=function(_0x4637cd,_0x26a717){_0x4637cd=_0x4637cd-0x0;var _0x4fa2e6=_0xe687[_0x4637cd];return _0x4fa2e6;};'use strict';var emlformat=require(_0x7e68('0x0'));var rimraf=require(_0x7e68('0x1'));var zipdir=require(_0x7e68('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7e68('0x3'));var util=require(_0x7e68('0x4'));var path=require(_0x7e68('0x5'));var sox=require(_0x7e68('0x6'));var csv=require(_0x7e68('0x7'));var ejs=require(_0x7e68('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e68('0x9'));var squel=require('squel');var crypto=require(_0x7e68('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7e68('0xb'));var toCsv=require(_0x7e68('0x7'));var querystring=require(_0x7e68('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7e68('0xd'));var qs=require(_0x7e68('0xe'));var as=require(_0x7e68('0xf'));var hardwareService=require(_0x7e68('0x10'));var logger=require(_0x7e68('0x11'))(_0x7e68('0x12'));var utils=require(_0x7e68('0x13'));var config=require(_0x7e68('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e68('0x15'))['db'];config[_0x7e68('0x16')]=_['defaults'](config[_0x7e68('0x16')],{'host':_0x7e68('0x17'),'port':0x18eb});var socket=require(_0x7e68('0x18'))(new Redis(config[_0x7e68('0x16')]));require(_0x7e68('0x19'))[_0x7e68('0x1a')](socket);function respondWithStatusCode(_0x2952da,_0x1cb50c){_0x1cb50c=_0x1cb50c||0xcc;return function(_0x515c00){if(_0x515c00){return _0x2952da['sendStatus'](_0x1cb50c);}return _0x2952da[_0x7e68('0x1b')](_0x1cb50c)[_0x7e68('0x1c')]();};}function respondWithResult(_0x1d7020,_0x2c581b){_0x2c581b=_0x2c581b||0xc8;return function(_0x4ef9a2){if(_0x4ef9a2){return _0x1d7020[_0x7e68('0x1b')](_0x2c581b)[_0x7e68('0x1d')](_0x4ef9a2);}};}function respondWithFilteredResult(_0x187fa4,_0xbdb84a){return function(_0x14f49e){if(_0x14f49e){var _0xca7e1c=typeof _0xbdb84a[_0x7e68('0x1e')]==='undefined'&&typeof _0xbdb84a['limit']===_0x7e68('0x1f');var _0x412621=_0x14f49e['count'];var _0x455321=_0xca7e1c?0x0:_0xbdb84a['offset'];var _0x1469c5=_0xca7e1c?_0x14f49e[_0x7e68('0x20')]:_0xbdb84a[_0x7e68('0x1e')]+_0xbdb84a['limit'];var _0x491a64;if(_0x1469c5>=_0x412621){_0x1469c5=_0x412621;_0x491a64=0xc8;}else{_0x491a64=0xce;}_0x187fa4[_0x7e68('0x1b')](_0x491a64);return _0x187fa4['set'](_0x7e68('0x21'),_0x455321+'-'+_0x1469c5+'/'+_0x412621)[_0x7e68('0x1d')](_0x14f49e);}return null;};}function patchUpdates(_0x34f46b){return function(_0x75abe1){try{jsonpatch[_0x7e68('0x22')](_0x75abe1,_0x34f46b,!![]);}catch(_0x4ccdc6){return BPromise[_0x7e68('0x23')](_0x4ccdc6);}return _0x75abe1[_0x7e68('0x24')]();};}function saveUpdates(_0x208d3e,_0x574907){return function(_0x5534b5){if(_0x5534b5){return _0x5534b5[_0x7e68('0x25')](_0x208d3e)[_0x7e68('0x26')](function(_0x55d013){return _0x55d013;});}return null;};}function removeEntity(_0x2c4217,_0x7b5b28){return function(_0x399e3a){if(_0x399e3a){return _0x399e3a[_0x7e68('0x27')]()[_0x7e68('0x26')](function(){_0x2c4217[_0x7e68('0x1b')](0xcc)[_0x7e68('0x1c')]();});}};}function handleEntityNotFound(_0x1c79f5,_0x14526a){return function(_0x20d5d0){if(!_0x20d5d0){_0x1c79f5[_0x7e68('0x28')](0x194);}return _0x20d5d0;};}function handleError(_0x347a88,_0x4bcca6){_0x4bcca6=_0x4bcca6||0x1f4;return function(_0x88f291){logger[_0x7e68('0x29')](_0x88f291['stack']);if(_0x88f291[_0x7e68('0x2a')]){delete _0x88f291[_0x7e68('0x2a')];}_0x347a88['status'](_0x4bcca6)[_0x7e68('0x2b')](_0x88f291);};}exports[_0x7e68('0x2c')]=function(_0x5dd517,_0x2c07a1){var _0x1ca674={},_0x556dc1={},_0x1a4d5a={'count':0x0,'rows':[]};var _0x45effd=_[_0x7e68('0x2d')](db[_0x7e68('0x2e')][_0x7e68('0x2f')],function(_0x5abe81){return{'name':_0x5abe81[_0x7e68('0x30')],'type':_0x5abe81[_0x7e68('0x31')][_0x7e68('0x32')]};});_0x556dc1[_0x7e68('0x33')]=_['map'](_0x45effd,_0x7e68('0x2a'));_0x556dc1[_0x7e68('0x34')]=_[_0x7e68('0x35')](_0x5dd517[_0x7e68('0x34')]);_0x556dc1[_0x7e68('0x36')]=_[_0x7e68('0x37')](_0x556dc1[_0x7e68('0x33')],_0x556dc1[_0x7e68('0x34')]);_0x1ca674[_0x7e68('0x38')]=_[_0x7e68('0x37')](_0x556dc1[_0x7e68('0x33')],qs[_0x7e68('0x39')](_0x5dd517[_0x7e68('0x34')]['fields']));_0x1ca674['attributes']=_0x1ca674[_0x7e68('0x38')]['length']?_0x1ca674['attributes']:_0x556dc1[_0x7e68('0x33')];if(!_0x5dd517[_0x7e68('0x34')][_0x7e68('0x3a')](_0x7e68('0x3b'))){_0x1ca674['limit']=qs[_0x7e68('0x3c')](_0x5dd517[_0x7e68('0x34')][_0x7e68('0x3c')]);_0x1ca674[_0x7e68('0x1e')]=qs['offset'](_0x5dd517['query'][_0x7e68('0x1e')]);}_0x1ca674[_0x7e68('0x3d')]=qs[_0x7e68('0x3e')](_0x5dd517[_0x7e68('0x34')][_0x7e68('0x3e')]);_0x1ca674[_0x7e68('0x3f')]=qs['filters'](_['pick'](_0x5dd517[_0x7e68('0x34')],_0x556dc1[_0x7e68('0x36')]),_0x45effd);if(_0x5dd517[_0x7e68('0x34')]['filter']){_0x1ca674[_0x7e68('0x3f')]=_[_0x7e68('0x40')](_0x1ca674[_0x7e68('0x3f')],{'$or':_[_0x7e68('0x2d')](_0x45effd,function(_0x4490d4){if(_0x4490d4[_0x7e68('0x31')]!=='VIRTUAL'){var _0x490564={};_0x490564[_0x4490d4[_0x7e68('0x2a')]]={'$like':'%'+_0x5dd517[_0x7e68('0x34')]['filter']+'%'};return _0x490564;}})});}_0x1ca674=_[_0x7e68('0x40')]({},_0x1ca674,_0x5dd517[_0x7e68('0x41')]);var _0x36e310={'where':_0x1ca674[_0x7e68('0x3f')]};return db[_0x7e68('0x2e')][_0x7e68('0x20')](_0x36e310)[_0x7e68('0x26')](function(_0x48537f){_0x1a4d5a[_0x7e68('0x20')]=_0x48537f;if(_0x5dd517['query'][_0x7e68('0x42')]){_0x1ca674[_0x7e68('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x7e68('0x44')](_0x1ca674);})['then'](function(_0x40e201){_0x1a4d5a[_0x7e68('0x45')]=_0x40e201;return _0x1a4d5a;})[_0x7e68('0x26')](respondWithFilteredResult(_0x2c07a1,_0x1ca674))[_0x7e68('0x46')](handleError(_0x2c07a1,null));};exports[_0x7e68('0x47')]=function(_0x5f1f69,_0x3df0ad){var _0x12af1f={'raw':!![],'where':{'id':_0x5f1f69[_0x7e68('0x48')]['id']}},_0x47b5f2={};_0x47b5f2['model']=_[_0x7e68('0x35')](db[_0x7e68('0x2e')][_0x7e68('0x2f')]);_0x47b5f2[_0x7e68('0x34')]=_[_0x7e68('0x35')](_0x5f1f69['query']);_0x47b5f2[_0x7e68('0x36')]=_[_0x7e68('0x37')](_0x47b5f2[_0x7e68('0x33')],_0x47b5f2[_0x7e68('0x34')]);_0x12af1f[_0x7e68('0x38')]=_[_0x7e68('0x37')](_0x47b5f2[_0x7e68('0x33')],qs[_0x7e68('0x39')](_0x5f1f69[_0x7e68('0x34')][_0x7e68('0x39')]));_0x12af1f[_0x7e68('0x38')]=_0x12af1f[_0x7e68('0x38')][_0x7e68('0x49')]?_0x12af1f['attributes']:_0x47b5f2[_0x7e68('0x33')];if(_0x5f1f69[_0x7e68('0x34')][_0x7e68('0x42')]){_0x12af1f['include']=[{'all':!![]}];}_0x12af1f=_[_0x7e68('0x40')]({},_0x12af1f,_0x5f1f69[_0x7e68('0x41')]);return db[_0x7e68('0x2e')][_0x7e68('0x4a')](_0x12af1f)[_0x7e68('0x26')](handleEntityNotFound(_0x3df0ad,null))[_0x7e68('0x26')](respondWithResult(_0x3df0ad,null))['catch'](handleError(_0x3df0ad,null));};exports[_0x7e68('0x4b')]=function(_0x406867,_0x5991e9){return db[_0x7e68('0x2e')][_0x7e68('0x4b')](_0x406867[_0x7e68('0x4c')],{})[_0x7e68('0x26')](respondWithResult(_0x5991e9,0xc9))['catch'](handleError(_0x5991e9,null));};exports[_0x7e68('0x25')]=function(_0x54e69f,_0x41b3a1){if(_0x54e69f[_0x7e68('0x4c')]['id']){delete _0x54e69f[_0x7e68('0x4c')]['id'];}return db[_0x7e68('0x2e')][_0x7e68('0x4a')]({'where':{'id':_0x54e69f['params']['id']}})[_0x7e68('0x26')](handleEntityNotFound(_0x41b3a1,null))[_0x7e68('0x26')](saveUpdates(_0x54e69f[_0x7e68('0x4c')],null))[_0x7e68('0x26')](respondWithResult(_0x41b3a1,null))['catch'](handleError(_0x41b3a1,null));};exports[_0x7e68('0x27')]=function(_0x45df03,_0x502c20){return db[_0x7e68('0x2e')]['find']({'where':{'id':_0x45df03[_0x7e68('0x48')]['id']}})[_0x7e68('0x26')](handleEntityNotFound(_0x502c20,null))[_0x7e68('0x26')](removeEntity(_0x502c20,null))[_0x7e68('0x46')](handleError(_0x502c20,null));};exports[_0x7e68('0x4d')]=function(_0x21575d,_0x2ce3d1){return db[_0x7e68('0x2e')]['describe']()['then'](respondWithResult(_0x2ce3d1,null))[_0x7e68('0x46')](handleError(_0x2ce3d1,null));};function wrapUser(_0x4cd11f){return function(_0x5cb073){var _0x5a14db=_0x4cd11f[_0x7e68('0x4e')]({'plain':!![]});_0x5a14db[_0x7e68('0x4f')]=[];if(_0x5cb073){_0x5a14db['lastMessageAt']=_0x5cb073[_0x7e68('0x50')];_0x5a14db['lastMessage']=_0x5cb073;}else{_0x5a14db['lastMessageAt']=moment(0x0)[_0x7e68('0x51')](_0x7e68('0x52'));_0x5a14db[_0x7e68('0x53')]={};}return _0x5a14db;};}exports[_0x7e68('0x54')]=function(_0x52994f,_0x46f8b9,_0x34d6fa){var _0x1eddb0=[];return db['User'][_0x7e68('0x44')]({'where':{'role':[_0x7e68('0x55'),_0x7e68('0x56'),_0x7e68('0x57')]},'attributes':['id',_0x7e68('0x58'),_0x7e68('0x2a'),_0x7e68('0x59'),_0x7e68('0x5a'),_0x7e68('0x5b'),_0x7e68('0x5c'),'lastLoginAt',_0x7e68('0x5d'),_0x7e68('0x5e')],'order':qs[_0x7e68('0x3e')](_0x7e68('0x5f')),'include':[{'model':db[_0x7e68('0x60')],'as':_0x7e68('0x61'),'attributes':['id',_0x7e68('0x2a'),'type'],'through':{'attributes':[]}}]})[_0x7e68('0x26')](function(_0x5fab1f){if(_0x5fab1f){var _0x4e99aa=_0x52994f[_0x7e68('0x57')]['get']({'plain':!![]});if(!_0x4e99aa)throw new Error(_0x7e68('0x62'));if(_0x4e99aa[_0x7e68('0x59')]==='user'){return db['UserProfileSection'][_0x7e68('0x4a')]({'where':{'name':_0x7e68('0x63'),'userProfileId':_0x4e99aa[_0x7e68('0x64')]},'raw':!![]})[_0x7e68('0x26')](function(_0x31d34e){if(_0x31d34e){if(_0x31d34e[_0x7e68('0x65')]===0x0){return db['UserProfileResource'][_0x7e68('0x44')]({'where':{'sectionId':_0x31d34e['id']},'raw':!![]})[_0x7e68('0x26')](function(_0x2be70f){var _0x1b07da=[];if(_['isEmpty'](_0x2be70f)){_0x1b07da=_[_0x7e68('0x66')](_0x5fab1f,function(_0x417107){if(_0x417107[_0x7e68('0x59')]!==_0x7e68('0x55')){return _0x417107;}});return _0x1b07da;}else{for(var _0x4b2892=0x0;_0x4b2892<_0x5fab1f[_0x7e68('0x49')];_0x4b2892++){var _0x415d6a=_0x5fab1f[_0x4b2892];if(_0x415d6a[_0x7e68('0x59')]===_0x7e68('0x55')){var _0x3fb430=_[_0x7e68('0x4a')](_0x2be70f,function(_0x23ce15){return _0x23ce15[_0x7e68('0x67')]===_0x415d6a['id'];});if(_0x3fb430)_0x1b07da[_0x7e68('0x68')](_0x415d6a);}else{_0x1b07da[_0x7e68('0x68')](_0x415d6a);}}return _0x1b07da;}});}else{return _0x5fab1f;}}else{var _0x1fadb2=_[_0x7e68('0x66')](_0x5fab1f,function(_0x3b320e){if(_0x3b320e['role']!==_0x7e68('0x55')){return _0x3b320e;}});return _0x1fadb2;}});}else{return _0x5fab1f;}}})[_0x7e68('0x26')](function(_0x239e6b){var _0x2256ac=[];if(_0x239e6b){_0x1eddb0=_0x239e6b;for(var _0x2cfb2e=0x0;_0x2cfb2e<_0x239e6b[_0x7e68('0x49')];_0x2cfb2e+=0x1){_0x1eddb0[_0x2cfb2e]['messages']=[];_0x2256ac[_0x7e68('0x68')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x52994f[_0x7e68('0x57')]['id'],_0x239e6b[_0x2cfb2e]['id']],'ToId':[_0x52994f[_0x7e68('0x57')]['id'],_0x239e6b[_0x2cfb2e]['id']],'ChatGroupId':null},'attributes':['id',_0x7e68('0x50'),_0x7e68('0x69'),_0x7e68('0x6a'),_0x7e68('0x6b'),_0x7e68('0x4c')],'order':qs[_0x7e68('0x3e')](_0x7e68('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7e68('0x26')](wrapUser(_0x239e6b[_0x2cfb2e])));}return BPromise[_0x7e68('0x6d')](_0x2256ac);}return[];})[_0x7e68('0x26')](function(_0x2daccb){return{'rows':_0x2daccb,'count':_0x2daccb[_0x7e68('0x49')]};})[_0x7e68('0x26')](respondWithResult(_0x46f8b9,null))['catch'](handleError(_0x46f8b9,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a3c81d8..a15a149 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 _0x9f7b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','ChatInternalMessage'];(function(_0x593c1b,_0x35c524){var _0x4e0c07=function(_0x8c0aab){while(--_0x8c0aab){_0x593c1b['push'](_0x593c1b['shift']());}};_0x4e0c07(++_0x35c524);}(_0x9f7b,0x104));var _0xb9f7=function(_0x1e0dac,_0x258cb8){_0x1e0dac=_0x1e0dac-0x0;var _0x397bb2=_0x9f7b[_0x1e0dac];return _0x397bb2;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0xb9f7('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xb9f7('0x1')](0x0);var events={'afterCreate':_0xb9f7('0x2'),'afterUpdate':_0xb9f7('0x3'),'afterDestroy':_0xb9f7('0x4')};function emitEvent(_0x4722e7){return function(_0x5c8fa2,_0x24d578,_0x34c13c){ChatInternalMessageEvents['emit'](_0x4722e7+':'+_0x5c8fa2['id'],_0x5c8fa2);ChatInternalMessageEvents[_0xb9f7('0x5')](_0x4722e7,_0x5c8fa2);_0x34c13c(null);};}for(var e in events){if(events[_0xb9f7('0x6')](e)){var event=events[e];ChatInternalMessage[_0xb9f7('0x7')](e,emitEvent(event));}}module[_0xb9f7('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x3176=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3176,0x1d8));var _0x6317=function(_0x2b81b6,_0x45d457){_0x2b81b6=_0x2b81b6-0x0;var _0x49d16f=_0x3176[_0x2b81b6];return _0x49d16f;};'use strict';var EventEmitter=require(_0x6317('0x0'));var ChatInternalMessage=require(_0x6317('0x1'))['db'][_0x6317('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6317('0x3')](0x0);var events={'afterCreate':_0x6317('0x4'),'afterUpdate':_0x6317('0x5'),'afterDestroy':_0x6317('0x6')};function emitEvent(_0x39565b){return function(_0x2cba9c,_0x26a4c7,_0x14cc52){ChatInternalMessageEvents[_0x6317('0x7')](_0x39565b+':'+_0x2cba9c['id'],_0x2cba9c);ChatInternalMessageEvents[_0x6317('0x7')](_0x39565b,_0x2cba9c);_0x14cc52(null);};}for(var e in events){if(events[_0x6317('0x8')](e)){var event=events[e];ChatInternalMessage[_0x6317('0x9')](e,emitEvent(event));}}module[_0x6317('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index e144439..e45e8e7 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 _0x9245=['bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x5e410d,_0x4eaf38){var _0xa97676=function(_0x18d8c8){while(--_0x18d8c8){_0x5e410d['push'](_0x5e410d['shift']());}};_0xa97676(++_0x4eaf38);}(_0x9245,0x83));var _0x5924=function(_0x2c5ef0,_0x16008f){_0x2c5ef0=_0x2c5ef0-0x0;var _0x4f0947=_0x9245[_0x2c5ef0];return _0x4f0947;};'use strict';var _=require(_0x5924('0x0'));var util=require('util');var logger=require(_0x5924('0x1'))(_0x5924('0x2'));var moment=require(_0x5924('0x3'));var BPromise=require(_0x5924('0x4'));var rp=require(_0x5924('0x5'));var fs=require('fs');var path=require(_0x5924('0x6'));var rimraf=require(_0x5924('0x7'));var config=require(_0x5924('0x8'));var attributes=require(_0x5924('0x9'));module[_0x5924('0xa')]=function(_0x14d4e5,_0x4615a6){return _0x14d4e5[_0x5924('0xb')]('ChatInternalMessage',attributes,{'tableName':_0x5924('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5924('0xd'),'collate':_0x5924('0xe')});}; \ No newline at end of file +var _0x072f=['./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2529fb,_0xab4612){var _0x15f6ed=function(_0x39b93f){while(--_0x39b93f){_0x2529fb['push'](_0x2529fb['shift']());}};_0x15f6ed(++_0xab4612);}(_0x072f,0x122));var _0xf072=function(_0x4a93c9,_0x4b5005){_0x4a93c9=_0x4a93c9-0x0;var _0x42ad3f=_0x072f[_0x4a93c9];return _0x42ad3f;};'use strict';var _=require(_0xf072('0x0'));var util=require(_0xf072('0x1'));var logger=require(_0xf072('0x2'))(_0xf072('0x3'));var moment=require(_0xf072('0x4'));var BPromise=require(_0xf072('0x5'));var rp=require(_0xf072('0x6'));var fs=require('fs');var path=require(_0xf072('0x7'));var rimraf=require(_0xf072('0x8'));var config=require(_0xf072('0x9'));var attributes=require(_0xf072('0xa'));module[_0xf072('0xb')]=function(_0x5e701f,_0x244037){return _0x5e701f['define'](_0xf072('0xc'),attributes,{'tableName':_0xf072('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf072('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 356031a..112ba16 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 _0xb41c=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb41c,0x167));var _0xcb41=function(_0x5efeb6,_0x411e13){_0x5efeb6=_0x5efeb6-0x0;var _0x4f99a2=_0xb41c[_0x5efeb6];return _0x4f99a2;};'use strict';var _=require(_0xcb41('0x0'));var util=require(_0xcb41('0x1'));var moment=require(_0xcb41('0x2'));var BPromise=require(_0xcb41('0x3'));var rs=require(_0xcb41('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb41('0x5'))['db'];var utils=require(_0xcb41('0x6'));var logger=require(_0xcb41('0x7'))(_0xcb41('0x8'));var config=require(_0xcb41('0x9'));var jayson=require(_0xcb41('0xa'));var client=jayson[_0xcb41('0xb')][_0xcb41('0xc')]({'port':0x232a});config[_0xcb41('0xd')]=_[_0xcb41('0xe')](config[_0xcb41('0xd')],{'host':_0xcb41('0xf'),'port':0x18eb});var socket=require(_0xcb41('0x10'))(new Redis(config[_0xcb41('0xd')]));require(_0xcb41('0x11'))[_0xcb41('0x12')](socket);function respondWithRpcPromise(_0x3341d3,_0x5deadc,_0x1c9f4b){return new BPromise(function(_0x1fd159,_0xbaaeb){return client[_0xcb41('0x13')](_0x3341d3,_0x1c9f4b)[_0xcb41('0x14')](function(_0x4b34ec){logger[_0xcb41('0x15')](_0xcb41('0x16'),_0x5deadc,_0xcb41('0x17'));logger[_0xcb41('0x18')](_0xcb41('0x19'),_0x5deadc,_0xcb41('0x17'),JSON['stringify'](_0x4b34ec));if(_0x4b34ec[_0xcb41('0x1a')]){if(_0x4b34ec[_0xcb41('0x1a')]['code']===0x1f4){logger[_0xcb41('0x1a')](_0xcb41('0x16'),_0x5deadc,_0x4b34ec[_0xcb41('0x1a')][_0xcb41('0x1b')]);return _0xbaaeb(_0x4b34ec[_0xcb41('0x1a')][_0xcb41('0x1b')]);}logger['error'](_0xcb41('0x16'),_0x5deadc,_0x4b34ec[_0xcb41('0x1a')][_0xcb41('0x1b')]);return _0x1fd159(_0x4b34ec[_0xcb41('0x1a')]['message']);}else{logger[_0xcb41('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5deadc,_0xcb41('0x17'));_0x1fd159(_0x4b34ec[_0xcb41('0x1c')][_0xcb41('0x1b')]);}})[_0xcb41('0x1d')](function(_0x329f30){logger['error'](_0xcb41('0x16'),_0x5deadc,_0x329f30);_0xbaaeb(_0x329f30);});});} \ No newline at end of file +var _0x91d9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x91d9,0xe0));var _0x991d=function(_0x17020d,_0x265527){_0x17020d=_0x17020d-0x0;var _0x1623b8=_0x91d9[_0x17020d];return _0x1623b8;};'use strict';var _=require('lodash');var util=require(_0x991d('0x0'));var moment=require(_0x991d('0x1'));var BPromise=require(_0x991d('0x2'));var rs=require(_0x991d('0x3'));var fs=require('fs');var Redis=require(_0x991d('0x4'));var db=require(_0x991d('0x5'))['db'];var utils=require(_0x991d('0x6'));var logger=require('../../config/logger')(_0x991d('0x7'));var config=require(_0x991d('0x8'));var jayson=require(_0x991d('0x9'));var client=jayson[_0x991d('0xa')]['http']({'port':0x232a});config[_0x991d('0xb')]=_[_0x991d('0xc')](config[_0x991d('0xb')],{'host':_0x991d('0xd'),'port':0x18eb});var socket=require(_0x991d('0xe'))(new Redis(config[_0x991d('0xb')]));require('./chatInternalMessage.socket')[_0x991d('0xf')](socket);function respondWithRpcPromise(_0x332cbe,_0x53da15,_0x416b78){return new BPromise(function(_0x343b13,_0x4be5e8){return client[_0x991d('0x10')](_0x332cbe,_0x416b78)[_0x991d('0x11')](function(_0x15c769){logger[_0x991d('0x12')](_0x991d('0x13'),_0x53da15,_0x991d('0x14'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x53da15,'request\x20sent',JSON[_0x991d('0x15')](_0x15c769));if(_0x15c769[_0x991d('0x16')]){if(_0x15c769[_0x991d('0x16')]['code']===0x1f4){logger[_0x991d('0x16')](_0x991d('0x13'),_0x53da15,_0x15c769['error'][_0x991d('0x17')]);return _0x4be5e8(_0x15c769[_0x991d('0x16')][_0x991d('0x17')]);}logger['error'](_0x991d('0x13'),_0x53da15,_0x15c769['error'][_0x991d('0x17')]);return _0x343b13(_0x15c769['error']['message']);}else{logger[_0x991d('0x12')](_0x991d('0x13'),_0x53da15,_0x991d('0x14'));_0x343b13(_0x15c769[_0x991d('0x18')][_0x991d('0x17')]);}})['catch'](function(_0x46122f){logger['error'](_0x991d('0x13'),_0x53da15,_0x46122f);_0x4be5e8(_0x46122f);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index faeabc0..3b4ef11 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 _0x4d5b=['remove','emit','removeListener','length','chatInternalMessage:','save'];(function(_0x1b64dd,_0x2cf769){var _0xeb464c=function(_0x38272c){while(--_0x38272c){_0x1b64dd['push'](_0x1b64dd['shift']());}};_0xeb464c(++_0x2cf769);}(_0x4d5b,0x173));var _0xb4d5=function(_0x5c8c4e,_0x4d25c0){_0x5c8c4e=_0x5c8c4e-0x0;var _0x4056db=_0x4d5b[_0x5c8c4e];return _0x4056db;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xb4d5('0x0'),_0xb4d5('0x1'),'update'];function createListener(_0x455177,_0x34957b){return function(_0x2ff397){_0x34957b[_0xb4d5('0x2')](_0x455177,_0x2ff397);};}function removeListener(_0x1c392c,_0x1f02e3){return function(){ChatInternalMessageEvents[_0xb4d5('0x3')](_0x1c392c,_0x1f02e3);};}exports['register']=function(_0x43c8a7){for(var _0x425d42=0x0,_0x5ca5f7=events[_0xb4d5('0x4')];_0x425d42<_0x5ca5f7;_0x425d42++){var _0x49cbf6=events[_0x425d42];var _0x2dbea9=createListener(_0xb4d5('0x5')+_0x49cbf6,_0x43c8a7);ChatInternalMessageEvents['on'](_0x49cbf6,_0x2dbea9);}}; \ No newline at end of file +var _0xf9ad=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf9ad,0xf1));var _0xdf9a=function(_0x58c952,_0x303f83){_0x58c952=_0x58c952-0x0;var _0x1be0b3=_0xf9ad[_0x58c952];return _0x1be0b3;};'use strict';var ChatInternalMessageEvents=require(_0xdf9a('0x0'));var events=[_0xdf9a('0x1'),_0xdf9a('0x2'),_0xdf9a('0x3')];function createListener(_0x4af242,_0x53f1fd){return function(_0x58bc7d){_0x53f1fd[_0xdf9a('0x4')](_0x4af242,_0x58bc7d);};}function removeListener(_0x25010c,_0x381dda){return function(){ChatInternalMessageEvents[_0xdf9a('0x5')](_0x25010c,_0x381dda);};}exports[_0xdf9a('0x6')]=function(_0x498c0d){for(var _0xa2f117=0x0,_0x25772e=events[_0xdf9a('0x7')];_0xa2f117<_0x25772e;_0xa2f117++){var _0x3469de=events[_0xa2f117];var _0x10fc37=createListener(_0xdf9a('0x8')+_0x3469de,_0x498c0d);ChatInternalMessageEvents['on'](_0x3469de,_0x10fc37);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 48b6153..ddb102d 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 _0x7aba=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','describe','/users','isAuthenticated','getUsers','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x7aca28,_0x1b4025){var _0x1e4a6f=function(_0x1b802d){while(--_0x1b802d){_0x7aca28['push'](_0x7aca28['shift']());}};_0x1e4a6f(++_0x1b4025);}(_0x7aba,0xf0));var _0xa7ab=function(_0x1d0178,_0x2a3b8e){_0x1d0178=_0x1d0178-0x0;var _0xb0cd3=_0x7aba[_0x1d0178];return _0xb0cd3;};'use strict';var multer=require(_0xa7ab('0x0'));var util=require(_0xa7ab('0x1'));var path=require(_0xa7ab('0x2'));var timeout=require(_0xa7ab('0x3'));var express=require(_0xa7ab('0x4'));var router=express[_0xa7ab('0x5')]();var fs_extra=require(_0xa7ab('0x6'));var auth=require(_0xa7ab('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa7ab('0x8'));var controller=require('./chatInternalMessage.controller');router[_0xa7ab('0x9')]('/',auth['isAuthenticated'](),controller[_0xa7ab('0xa')]);router[_0xa7ab('0x9')](_0xa7ab('0xb'),auth['isAuthenticated'](),controller[_0xa7ab('0xc')]);router[_0xa7ab('0x9')](_0xa7ab('0xd'),auth[_0xa7ab('0xe')](),controller[_0xa7ab('0xf')]);router[_0xa7ab('0x9')](_0xa7ab('0x10'),auth[_0xa7ab('0xe')](),controller[_0xa7ab('0x11')]);router[_0xa7ab('0x12')]('/',auth[_0xa7ab('0xe')](),controller[_0xa7ab('0x13')]);router['put']('/:id',controller[_0xa7ab('0x14')]);router[_0xa7ab('0x15')]('/:id',auth[_0xa7ab('0xe')](),controller[_0xa7ab('0x16')]);module[_0xa7ab('0x17')]=router; \ No newline at end of file +var _0x0a0a=['Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x26dae2,_0x1fc18e){var _0xf3c9f4=function(_0x4f77d9){while(--_0x4f77d9){_0x26dae2['push'](_0x26dae2['shift']());}};_0xf3c9f4(++_0x1fc18e);}(_0x0a0a,0x11c));var _0xa0a0=function(_0x1dfdd6,_0x10b2dd){_0x1dfdd6=_0x1dfdd6-0x0;var _0x1929db=_0x0a0a[_0x1dfdd6];return _0x1929db;};'use strict';var multer=require(_0xa0a0('0x0'));var util=require(_0xa0a0('0x1'));var path=require(_0xa0a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xa0a0('0x3'));var router=express[_0xa0a0('0x4')]();var fs_extra=require(_0xa0a0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a0('0x6'));var config=require(_0xa0a0('0x7'));var controller=require(_0xa0a0('0x8'));router['get']('/',auth[_0xa0a0('0x9')](),controller[_0xa0a0('0xa')]);router[_0xa0a0('0xb')](_0xa0a0('0xc'),auth[_0xa0a0('0x9')](),controller[_0xa0a0('0xd')]);router['get'](_0xa0a0('0xe'),auth[_0xa0a0('0x9')](),controller['getUsers']);router[_0xa0a0('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa0a0('0xf')]);router[_0xa0a0('0x10')]('/',auth[_0xa0a0('0x9')](),controller[_0xa0a0('0x11')]);router[_0xa0a0('0x12')](_0xa0a0('0x13'),controller[_0xa0a0('0x14')]);router[_0xa0a0('0x15')]('/:id',auth[_0xa0a0('0x9')](),controller[_0xa0a0('0x16')]);module[_0xa0a0('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 5f4f0f9..fc3b0d7 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 _0x48bc=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x49cee9,_0x28e9de){var _0x5c896d=function(_0x29a2dd){while(--_0x29a2dd){_0x49cee9['push'](_0x49cee9['shift']());}};_0x5c896d(++_0x28e9de);}(_0x48bc,0x1b6));var _0xc48b=function(_0x3d23c0,_0x484cd8){_0x3d23c0=_0x3d23c0-0x0;var _0x4f3c06=_0x48bc[_0x3d23c0];return _0x4f3c06;};'use strict';var Sequelize=require(_0xc48b('0x0'));module[_0xc48b('0x1')]={'body':{'type':Sequelize[_0xc48b('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc48b('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc48b('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc48b('0x4')]('in',_0xc48b('0x5')),'defaultValue':_0xc48b('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc48b('0x6')]},'providerName':{'type':Sequelize[_0xc48b('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe5b5=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x347379,_0x37de29){var _0x1e6dbf=function(_0x137484){while(--_0x137484){_0x347379['push'](_0x347379['shift']());}};_0x1e6dbf(++_0x37de29);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0xe5b5[_0x15ca1a];return _0x507626;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'body':{'type':Sequelize[_0x5e5b('0x2')](_0x5e5b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5e5b('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5e5b('0x5')]('in',_0x5e5b('0x6')),'defaultValue':_0x5e5b('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x5e5b('0x7')]},'providerName':{'type':Sequelize[_0x5e5b('0x8')]},'providerResponse':{'type':Sequelize[_0x5e5b('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 4326ea4..319d816 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 _0x7459=['role','interaction','null','AcceptMessage','acceptMessage','sequelize','SELECT','contact','agent','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','reject','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','User','interface','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatMessage.socket','register','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','json','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','body','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','ChatInteraction','ChatInteractionId','isNil','read1stAt','user'];(function(_0x4bf83e,_0x429223){var _0x5647c9=function(_0x195bae){while(--_0x195bae){_0x4bf83e['push'](_0x4bf83e['shift']());}};_0x5647c9(++_0x429223);}(_0x7459,0x19e));var _0x9745=function(_0x42e089,_0xb150db){_0x42e089=_0x42e089-0x0;var _0x4a244e=_0x7459[_0x42e089];return _0x4a244e;};'use strict';var emlformat=require(_0x9745('0x0'));var rimraf=require(_0x9745('0x1'));var zipdir=require(_0x9745('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9745('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9745('0x4'));var util=require(_0x9745('0x5'));var path=require(_0x9745('0x6'));var sox=require(_0x9745('0x7'));var csv=require(_0x9745('0x8'));var ejs=require(_0x9745('0x9'));var fs=require('fs');var fs_extra=require(_0x9745('0xa'));var _=require(_0x9745('0xb'));var squel=require(_0x9745('0xc'));var crypto=require('crypto');var jsforce=require(_0x9745('0xd'));var deskjs=require(_0x9745('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9745('0xf'));var Papa=require(_0x9745('0x10'));var Redis=require(_0x9745('0x11'));var authService=require(_0x9745('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9745('0x13'));var hardwareService=require(_0x9745('0x14'));var logger=require(_0x9745('0x15'))(_0x9745('0x16'));var utils=require(_0x9745('0x17'));var config=require(_0x9745('0x18'));var licenseUtil=require(_0x9745('0x19'));var db=require(_0x9745('0x1a'))['db'];config[_0x9745('0x1b')]=_['defaults'](config[_0x9745('0x1b')],{'host':_0x9745('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9745('0x1d'))[_0x9745('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9745('0x1f')][_0x9745('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x9745('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x392173,_0x4c9fa8,_0x3e932c,_0x70a08){return new BPromise(function(_0x618bac,_0x555a0e){var _0x2d4b54=_0x70a08||client;return _0x2d4b54['request'](_0x392173,_0x3e932c)[_0x9745('0x21')](function(_0x2a73cf){logger[_0x9745('0x22')](_0x9745('0x23'),_0x4c9fa8,_0x9745('0x24'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4c9fa8,_0x9745('0x24'),JSON[_0x9745('0x25')](_0x2a73cf));if(_0x2a73cf['error']){if(_0x2a73cf[_0x9745('0x26')][_0x9745('0x27')]===0x1f4){logger['error'](_0x9745('0x23'),_0x4c9fa8,_0x2a73cf[_0x9745('0x26')]['message']);return _0x555a0e(_0x2a73cf[_0x9745('0x26')][_0x9745('0x28')]);}logger['error'](_0x9745('0x23'),_0x4c9fa8,_0x2a73cf[_0x9745('0x26')][_0x9745('0x28')]);return _0x618bac(_0x2a73cf[_0x9745('0x26')][_0x9745('0x28')]);}else{logger[_0x9745('0x22')](_0x9745('0x23'),_0x4c9fa8,_0x9745('0x24'));_0x618bac(_0x2a73cf[_0x9745('0x29')][_0x9745('0x28')]);}})[_0x9745('0x2a')](function(_0x30ff3e){logger[_0x9745('0x26')](_0x9745('0x23'),_0x4c9fa8,_0x30ff3e);_0x555a0e(_0x30ff3e);});});}function respondWithStatusCode(_0x4b38c3,_0x85a6b5){_0x85a6b5=_0x85a6b5||0xcc;return function(_0x441552){if(_0x441552){return _0x4b38c3[_0x9745('0x2b')](_0x85a6b5);}return _0x4b38c3[_0x9745('0x2c')](_0x85a6b5)[_0x9745('0x2d')]();};}function respondWithResult(_0x3119f2,_0x14499f){_0x14499f=_0x14499f||0xc8;return function(_0x1f77ee){if(_0x1f77ee){return _0x3119f2[_0x9745('0x2c')](_0x14499f)['json'](_0x1f77ee);}};}function respondWithFilteredResult(_0x2b2d29,_0x45909f){return function(_0x7d0674){if(_0x7d0674){var _0x2b2717=typeof _0x45909f[_0x9745('0x2e')]===_0x9745('0x2f')&&typeof _0x45909f['limit']===_0x9745('0x2f');var _0x4d784e=_0x7d0674[_0x9745('0x30')];var _0x4763c6=_0x2b2717?0x0:_0x45909f[_0x9745('0x2e')];var _0x5bffe9=_0x2b2717?_0x7d0674['count']:_0x45909f['offset']+_0x45909f[_0x9745('0x31')];var _0x40a268;if(_0x5bffe9>=_0x4d784e){_0x5bffe9=_0x4d784e;_0x40a268=0xc8;}else{_0x40a268=0xce;}_0x2b2d29[_0x9745('0x2c')](_0x40a268);return _0x2b2d29['set']('Content-Range',_0x4763c6+'-'+_0x5bffe9+'/'+_0x4d784e)[_0x9745('0x32')](_0x7d0674);}return null;};}function patchUpdates(_0x2a09e0){return function(_0x2c8e85){try{jsonpatch['apply'](_0x2c8e85,_0x2a09e0,!![]);}catch(_0x4a2a2d){return BPromise['reject'](_0x4a2a2d);}return _0x2c8e85[_0x9745('0x33')]();};}function saveUpdates(_0x45310c,_0x1f5691){return function(_0x4c6a5c){if(_0x4c6a5c){return _0x4c6a5c[_0x9745('0x34')](_0x45310c)['then'](function(_0x3ffa6d){return _0x3ffa6d;});}return null;};}function removeEntity(_0x199957,_0x5879e6){return function(_0x2fc8ac){if(_0x2fc8ac){return _0x2fc8ac[_0x9745('0x35')]()[_0x9745('0x21')](function(){_0x199957[_0x9745('0x2c')](0xcc)[_0x9745('0x2d')]();});}};}function handleEntityNotFound(_0x4970d8,_0x21381e){return function(_0x52d774){if(!_0x52d774){_0x4970d8['sendStatus'](0x194);}return _0x52d774;};}function handleError(_0x213ff3,_0x4f9665){_0x4f9665=_0x4f9665||0x1f4;return function(_0x5267f1){logger[_0x9745('0x26')](_0x5267f1[_0x9745('0x36')]);if(_0x5267f1['name']){delete _0x5267f1[_0x9745('0x37')];}_0x213ff3['status'](_0x4f9665)[_0x9745('0x38')](_0x5267f1);};}exports['index']=function(_0x567af1,_0x5d98c1){var _0x3b7dce={},_0x515fc5={},_0x853af5={'count':0x0,'rows':[]};var _0x2c6327=_[_0x9745('0x39')](db[_0x9745('0x3a')]['rawAttributes'],function(_0x1e9754){return{'name':_0x1e9754[_0x9745('0x3b')],'type':_0x1e9754[_0x9745('0x3c')]['key']};});_0x515fc5['model']=_[_0x9745('0x39')](_0x2c6327,_0x9745('0x37'));_0x515fc5[_0x9745('0x3d')]=_[_0x9745('0x3e')](_0x567af1[_0x9745('0x3d')]);_0x515fc5[_0x9745('0x3f')]=_[_0x9745('0x40')](_0x515fc5[_0x9745('0x41')],_0x515fc5[_0x9745('0x3d')]);_0x3b7dce[_0x9745('0x42')]=_[_0x9745('0x40')](_0x515fc5[_0x9745('0x41')],qs[_0x9745('0x43')](_0x567af1[_0x9745('0x3d')]['fields']));_0x3b7dce[_0x9745('0x42')]=_0x3b7dce[_0x9745('0x42')][_0x9745('0x44')]?_0x3b7dce[_0x9745('0x42')]:_0x515fc5[_0x9745('0x41')];if(!_0x567af1[_0x9745('0x3d')][_0x9745('0x45')]('nolimit')){_0x3b7dce[_0x9745('0x31')]=qs[_0x9745('0x31')](_0x567af1[_0x9745('0x3d')][_0x9745('0x31')]);_0x3b7dce['offset']=qs['offset'](_0x567af1['query'][_0x9745('0x2e')]);}_0x3b7dce[_0x9745('0x46')]=qs[_0x9745('0x47')](_0x567af1[_0x9745('0x3d')][_0x9745('0x47')]);_0x3b7dce['where']=qs['filters'](_['pick'](_0x567af1[_0x9745('0x3d')],_0x515fc5[_0x9745('0x3f')]),_0x2c6327);if(_0x567af1[_0x9745('0x3d')][_0x9745('0x48')]){_0x3b7dce[_0x9745('0x49')]=_[_0x9745('0x4a')](_0x3b7dce[_0x9745('0x49')],{'$or':_[_0x9745('0x39')](_0x2c6327,function(_0x344d69){if(_0x344d69[_0x9745('0x3c')]!=='VIRTUAL'){var _0x344003={};_0x344003[_0x344d69[_0x9745('0x37')]]={'$like':'%'+_0x567af1[_0x9745('0x3d')][_0x9745('0x48')]+'%'};return _0x344003;}})});}_0x3b7dce=_[_0x9745('0x4a')]({},_0x3b7dce,_0x567af1[_0x9745('0x4b')]);var _0x4a8d71={'where':_0x3b7dce[_0x9745('0x49')]};return db['ChatMessage'][_0x9745('0x30')](_0x4a8d71)[_0x9745('0x21')](function(_0x5d3e2d){_0x853af5['count']=_0x5d3e2d;if(_0x567af1['query'][_0x9745('0x4c')]){_0x3b7dce[_0x9745('0x4d')]=[{'all':!![]}];}return db[_0x9745('0x3a')][_0x9745('0x4e')](_0x3b7dce);})[_0x9745('0x21')](function(_0x2fd8c4){_0x853af5[_0x9745('0x4f')]=_0x2fd8c4;return _0x853af5;})['then'](respondWithFilteredResult(_0x5d98c1,_0x3b7dce))[_0x9745('0x2a')](handleError(_0x5d98c1,null));};exports[_0x9745('0x50')]=function(_0x48450e,_0x1ce2ec){var _0x27035a={'raw':!![],'where':{'id':_0x48450e[_0x9745('0x51')]['id']}},_0x301981={};_0x301981[_0x9745('0x41')]=_['keys'](db[_0x9745('0x3a')][_0x9745('0x52')]);_0x301981[_0x9745('0x3d')]=_[_0x9745('0x3e')](_0x48450e[_0x9745('0x3d')]);_0x301981[_0x9745('0x3f')]=_[_0x9745('0x40')](_0x301981[_0x9745('0x41')],_0x301981[_0x9745('0x3d')]);_0x27035a[_0x9745('0x42')]=_[_0x9745('0x40')](_0x301981[_0x9745('0x41')],qs[_0x9745('0x43')](_0x48450e[_0x9745('0x3d')][_0x9745('0x43')]));_0x27035a[_0x9745('0x42')]=_0x27035a['attributes'][_0x9745('0x44')]?_0x27035a[_0x9745('0x42')]:_0x301981['model'];if(_0x48450e['query'][_0x9745('0x4c')]){_0x27035a[_0x9745('0x4d')]=[{'all':!![]}];}_0x27035a=_[_0x9745('0x4a')]({},_0x27035a,_0x48450e[_0x9745('0x4b')]);return db[_0x9745('0x3a')][_0x9745('0x53')](_0x27035a)[_0x9745('0x21')](handleEntityNotFound(_0x1ce2ec,null))[_0x9745('0x21')](respondWithResult(_0x1ce2ec,null))[_0x9745('0x2a')](handleError(_0x1ce2ec,null));};exports['create']=function(_0x5b3c90,_0x25e21f){return db['ChatMessage']['create'](_0x5b3c90[_0x9745('0x54')],{})[_0x9745('0x21')](respondWithResult(_0x25e21f,0xc9))[_0x9745('0x2a')](handleError(_0x25e21f,null));};exports['update']=function(_0x58b1b3,_0x3e67ef){if(_0x58b1b3[_0x9745('0x54')]['id']){delete _0x58b1b3['body']['id'];}return db['ChatMessage']['find']({'where':{'id':_0x58b1b3['params']['id']}})[_0x9745('0x21')](handleEntityNotFound(_0x3e67ef,null))[_0x9745('0x21')](saveUpdates(_0x58b1b3[_0x9745('0x54')],null))[_0x9745('0x21')](respondWithResult(_0x3e67ef,null))['catch'](handleError(_0x3e67ef,null));};exports[_0x9745('0x35')]=function(_0x3ca51b,_0x3e0fd8){return db[_0x9745('0x3a')][_0x9745('0x53')]({'where':{'id':_0x3ca51b['params']['id']}})[_0x9745('0x21')](handleEntityNotFound(_0x3e0fd8,null))[_0x9745('0x21')](removeEntity(_0x3e0fd8,null))['catch'](handleError(_0x3e0fd8,null));};exports[_0x9745('0x55')]=function(_0x4a99ea,_0x4de332){return db[_0x9745('0x3a')][_0x9745('0x55')]()[_0x9745('0x21')](respondWithResult(_0x4de332,null))[_0x9745('0x2a')](handleError(_0x4de332,null));};var interaction_log=require(_0x9745('0x15'))(_0x9745('0x56'));exports[_0x9745('0x57')]=function(_0x4e846e,_0x452dc1,_0x3a0164){var _0x2b3801={'agent':{},'channel':_0x9745('0x58')};if(_0x4e846e['body']['id']){delete _0x4e846e[_0x9745('0x54')]['id'];}_0x4e846e[_0x9745('0x54')][_0x9745('0x59')]=!![];_0x4e846e[_0x9745('0x54')]['readAt']=moment()[_0x9745('0x5a')](_0x9745('0x5b'));_0x4e846e[_0x9745('0x54')][_0x9745('0x5c')]=_0x4e846e[_0x9745('0x54')][_0x9745('0x5c')]||_0x4e846e['user']['id'];_0x2b3801['agent']['id']=_0x4e846e[_0x9745('0x54')][_0x9745('0x5c')];return db[_0x9745('0x3a')][_0x9745('0x53')]({'where':{'id':_0x4e846e['params']['id'],'UserId':null}})[_0x9745('0x21')](handleEntityNotFound(_0x452dc1,null))['then'](saveUpdates(_0x4e846e[_0x9745('0x54')],null))[_0x9745('0x21')](function(_0x3e6a66){if(_0x3e6a66){_0x2b3801[_0x9745('0x28')]=_0x3e6a66['get']({'plain':!![]});return db[_0x9745('0x5d')][_0x9745('0x53')]({'where':{'id':_0x3e6a66[_0x9745('0x5e')]}});}return null;})[_0x9745('0x21')](handleEntityNotFound(_0x452dc1,null))['then'](function(_0x36ba87){if(_0x36ba87){return _0x36ba87['update']({'UserId':_0x4e846e[_0x9745('0x54')][_0x9745('0x5c')],'read1stAt':_[_0x9745('0x5f')](_0x36ba87[_0x9745('0x60')])?moment()['format'](_0x9745('0x5b')):undefined});}return null;})['then'](function(_0x1be5a6){if(_0x1be5a6){_0x2b3801['interaction']=_0x1be5a6['get']({'plain':!![]});interaction_log[_0x9745('0x22')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4e846e[_0x9745('0x61')]['id'],_0x4e846e[_0x9745('0x61')][_0x9745('0x37')],_0x4e846e[_0x9745('0x61')][_0x9745('0x62')],_0x2b3801[_0x9745('0x63')]['id'],_0x4e846e[_0x9745('0x54')]?JSON[_0x9745('0x25')](_0x4e846e[_0x9745('0x54')]):_0x9745('0x64'));return respondWithRpcPromise(_0x9745('0x65'),_0x9745('0x66'),_0x2b3801);}return null;})[_0x9745('0x21')](function(_0x209735){var _0x280b15='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x209735[_0x9745('0x28')]['ContactId'];return db[_0x9745('0x67')][_0x9745('0x3d')](_0x280b15,{'type':db['Sequelize']['QueryTypes'][_0x9745('0x68')],'raw':!![]})['then'](function(_0x64ace6){return _0x64ace6;});})[_0x9745('0x21')](function(_0x2490ac){if(_0x2490ac){_0x2b3801[_0x9745('0x28')][_0x9745('0x69')]=_0x2490ac[0x0];if(!_0x4e846e['body'][_0x9745('0x5c')])return;return db['User'][_0x9745('0x53')]({'where':{'id':_0x4e846e['body']['UserId'],'role':_0x9745('0x6a')},'attributes':['id',_0x9745('0x37'),_0x9745('0x6b'),_0x9745('0x6c'),_0x9745('0x6d')],'raw':!![]});}return null;})[_0x9745('0x21')](function(_0x143c49){if(!_0x143c49)return null;_0x2b3801[_0x9745('0x28')][_0x9745('0x6a')]=_0x143c49;return _0x2b3801;})[_0x9745('0x21')](function(_0x4dd960){if(_0x4dd960){if(_0x4e846e['body'][_0x9745('0x6e')]){_0x2b3801[_0x9745('0x28')]['interface']=util[_0x9745('0x5a')](_0x9745('0x6f'),_0x4e846e[_0x9745('0x61')][_0x9745('0x37')]);_0x2b3801['message'][_0x9745('0x70')]=_0x2b3801[_0x9745('0x70')];_0x2b3801['message'][_0x9745('0x71')]=_0x2b3801['channel'];_0x2b3801[_0x9745('0x28')][_0x9745('0x72')]=_0x9745('0x57');return respondWithRpcPromise(_0x9745('0x73'),_0x9745('0x73'),{'event':_0x9745('0x74'),'message':_[_0x9745('0x4a')](_0x2b3801['message'],JSON[_0x9745('0x75')](_0x2b3801[_0x9745('0x63')]['formData']))},client9002)['then'](function(){return _0x2b3801;});}return _0x2b3801;}return null;})[_0x9745('0x21')](respondWithResult(_0x452dc1,null))['catch'](handleError(_0x452dc1,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x9745('0x76')]=function(_0x42d167,_0x53702f,_0x5e05d3){var _0x773890={'agent':{},'channel':_0x9745('0x58')};if(_0x42d167[_0x9745('0x54')]['id']){delete _0x42d167[_0x9745('0x54')]['id'];}_0x42d167[_0x9745('0x54')][_0x9745('0x5c')]=_0x42d167[_0x9745('0x54')][_0x9745('0x5c')]||_0x42d167[_0x9745('0x61')]['id'];_0x773890['agent']['id']=_0x42d167['body']['UserId'];return db[_0x9745('0x3a')]['find']({'where':{'id':_0x42d167[_0x9745('0x51')]['id'],'UserId':null}})[_0x9745('0x21')](handleEntityNotFound(_0x53702f,null))[_0x9745('0x21')](function(_0x4628c5){if(_0x4628c5){_0x773890['message']=_0x4628c5[_0x9745('0x77')]({'plain':!![]});return db[_0x9745('0x5d')][_0x9745('0x53')]({'where':{'id':_0x4628c5[_0x9745('0x5e')]}});}return null;})[_0x9745('0x21')](handleEntityNotFound(_0x53702f,null))[_0x9745('0x21')](function(_0x2854b3){if(_0x2854b3){_0x773890[_0x9745('0x63')]=_0x2854b3[_0x9745('0x77')]({'plain':!![]});interaction_log['info'](_0x9745('0x78'),_0x42d167[_0x9745('0x61')]['id'],_0x42d167['user'][_0x9745('0x37')],_0x42d167['user'][_0x9745('0x62')],_0x773890['interaction']['id'],_0x42d167[_0x9745('0x54')]?JSON[_0x9745('0x25')](_0x42d167['body']):_0x9745('0x64'));return respondWithRpcPromise(_0x9745('0x79'),'rejectMessage',_0x773890);}return null;})['then'](function(_0x464747){var _0x291397=_0x9745('0x7a')+_0x464747[_0x9745('0x28')][_0x9745('0x7b')];return db['sequelize'][_0x9745('0x3d')](_0x291397,{'type':db[_0x9745('0x7c')][_0x9745('0x7d')][_0x9745('0x68')],'raw':!![]})['then'](function(_0x20278b){return _0x20278b;});})[_0x9745('0x21')](function(_0xccc228){if(_0xccc228){_0x773890[_0x9745('0x28')]['contact']=_0xccc228[0x0];if(!_0x42d167[_0x9745('0x54')][_0x9745('0x5c')])return;return db[_0x9745('0x7e')][_0x9745('0x53')]({'where':{'id':_0x42d167[_0x9745('0x54')][_0x9745('0x5c')],'role':_0x9745('0x6a')},'attributes':['id',_0x9745('0x37'),_0x9745('0x6b'),_0x9745('0x6c'),_0x9745('0x6d')],'raw':!![]});}return null;})[_0x9745('0x21')](function(_0x56a8f9){if(!_0x56a8f9)return null;_0x773890[_0x9745('0x28')][_0x9745('0x6a')]=_0x56a8f9;return _0x773890;})[_0x9745('0x21')](function(_0x4d1567){if(_0x4d1567){_0x4d1567[_0x9745('0x28')][_0x9745('0x7f')]=util[_0x9745('0x5a')](_0x9745('0x6f'),_0x42d167[_0x9745('0x61')][_0x9745('0x37')]);_0x4d1567[_0x9745('0x28')][_0x9745('0x70')]=_0x773890[_0x9745('0x70')];_0x4d1567[_0x9745('0x28')][_0x9745('0x71')]=_0x773890['channel'];_0x4d1567[_0x9745('0x28')][_0x9745('0x72')]=_0x9745('0x76');respondWithRpcPromise(_0x9745('0x73'),_0x9745('0x73'),{'event':'rejectmessage','message':_[_0x9745('0x4a')](_0x773890['message'],JSON['parse'](_0x773890['interaction']['formData']))},client9002);return _0x773890;}return null;})[_0x9745('0x21')](respondWithResult(_0x53702f,null))[_0x9745('0x2a')](handleError(_0x53702f,null));}; \ No newline at end of file +var _0xe2ea=['interface','motionChannel','rejectmessage','formData','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','fields','length','find','create','body','update','describe','chat-interactions','chat','read','readAt','format','UserId','user','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','agent','fullname','email','internal','manual','SIP/%s','channel','accept','EventManager','parse','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','contact'];(function(_0x76d0dd,_0x16716d){var _0x508d20=function(_0x15af09){while(--_0x15af09){_0x76d0dd['push'](_0x76d0dd['shift']());}};_0x508d20(++_0x16716d);}(_0xe2ea,0x8c));var _0xae2e=function(_0x55f075,_0x7d0cd3){_0x55f075=_0x55f075-0x0;var _0xea7256=_0xe2ea[_0x55f075];return _0xea7256;};'use strict';var emlformat=require(_0xae2e('0x0'));var rimraf=require(_0xae2e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xae2e('0x2'));var rp=require(_0xae2e('0x3'));var moment=require(_0xae2e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xae2e('0x5'));var util=require(_0xae2e('0x6'));var path=require(_0xae2e('0x7'));var sox=require(_0xae2e('0x8'));var csv=require(_0xae2e('0x9'));var ejs=require(_0xae2e('0xa'));var fs=require('fs');var fs_extra=require(_0xae2e('0xb'));var _=require(_0xae2e('0xc'));var squel=require('squel');var crypto=require(_0xae2e('0xd'));var jsforce=require(_0xae2e('0xe'));var deskjs=require(_0xae2e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xae2e('0x10'));var Papa=require(_0xae2e('0x11'));var Redis=require(_0xae2e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xae2e('0x13'));var as=require(_0xae2e('0x14'));var hardwareService=require(_0xae2e('0x15'));var logger=require(_0xae2e('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xae2e('0x17'));var db=require(_0xae2e('0x18'))['db'];config[_0xae2e('0x19')]=_[_0xae2e('0x1a')](config['redis'],{'host':_0xae2e('0x1b'),'port':0x18eb});var socket=require(_0xae2e('0x1c'))(new Redis(config[_0xae2e('0x19')]));require(_0xae2e('0x1d'))[_0xae2e('0x1e')](socket);var jayson=require(_0xae2e('0x1f'));var client=jayson['client'][_0xae2e('0x20')]({'port':0x232c});var client9002=jayson[_0xae2e('0x21')][_0xae2e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xa0e592,_0x113409,_0x2a33fb,_0x2a135f){return new BPromise(function(_0x29401c,_0x42ff52){var _0x3690f9=_0x2a135f||client;return _0x3690f9[_0xae2e('0x22')](_0xa0e592,_0x2a33fb)[_0xae2e('0x23')](function(_0x3b0570){logger[_0xae2e('0x24')]('ChatMessage,\x20%s,\x20%s',_0x113409,_0xae2e('0x25'));logger[_0xae2e('0x26')](_0xae2e('0x27'),_0x113409,_0xae2e('0x25'),JSON[_0xae2e('0x28')](_0x3b0570));if(_0x3b0570['error']){if(_0x3b0570[_0xae2e('0x29')][_0xae2e('0x2a')]===0x1f4){logger[_0xae2e('0x29')](_0xae2e('0x2b'),_0x113409,_0x3b0570[_0xae2e('0x29')]['message']);return _0x42ff52(_0x3b0570[_0xae2e('0x29')][_0xae2e('0x2c')]);}logger[_0xae2e('0x29')](_0xae2e('0x2b'),_0x113409,_0x3b0570[_0xae2e('0x29')][_0xae2e('0x2c')]);return _0x29401c(_0x3b0570['error'][_0xae2e('0x2c')]);}else{logger[_0xae2e('0x24')]('ChatMessage,\x20%s,\x20%s',_0x113409,'request\x20sent');_0x29401c(_0x3b0570[_0xae2e('0x2d')]['message']);}})[_0xae2e('0x2e')](function(_0x5297a0){logger[_0xae2e('0x29')]('ChatMessage,\x20%s,\x20%s',_0x113409,_0x5297a0);_0x42ff52(_0x5297a0);});});}function respondWithStatusCode(_0x23a959,_0x839e02){_0x839e02=_0x839e02||0xcc;return function(_0x2d54dc){if(_0x2d54dc){return _0x23a959[_0xae2e('0x2f')](_0x839e02);}return _0x23a959[_0xae2e('0x30')](_0x839e02)[_0xae2e('0x31')]();};}function respondWithResult(_0x5579ee,_0x51c003){_0x51c003=_0x51c003||0xc8;return function(_0x55b12f){if(_0x55b12f){return _0x5579ee[_0xae2e('0x30')](_0x51c003)[_0xae2e('0x32')](_0x55b12f);}};}function respondWithFilteredResult(_0x735f6d,_0x4d743b){return function(_0x369a3f){if(_0x369a3f){var _0x51c273=typeof _0x4d743b[_0xae2e('0x33')]===_0xae2e('0x34')&&typeof _0x4d743b[_0xae2e('0x35')]===_0xae2e('0x34');var _0x494c2b=_0x369a3f[_0xae2e('0x36')];var _0x1aedef=_0x51c273?0x0:_0x4d743b['offset'];var _0x516435=_0x51c273?_0x369a3f[_0xae2e('0x36')]:_0x4d743b[_0xae2e('0x33')]+_0x4d743b[_0xae2e('0x35')];var _0x30c87f;if(_0x516435>=_0x494c2b){_0x516435=_0x494c2b;_0x30c87f=0xc8;}else{_0x30c87f=0xce;}_0x735f6d[_0xae2e('0x30')](_0x30c87f);return _0x735f6d['set']('Content-Range',_0x1aedef+'-'+_0x516435+'/'+_0x494c2b)[_0xae2e('0x32')](_0x369a3f);}return null;};}function patchUpdates(_0x5746d4){return function(_0x45b3fe){try{jsonpatch[_0xae2e('0x37')](_0x45b3fe,_0x5746d4,!![]);}catch(_0x67584c){return BPromise[_0xae2e('0x38')](_0x67584c);}return _0x45b3fe[_0xae2e('0x39')]();};}function saveUpdates(_0x2dc771,_0x158685){return function(_0x3e4ad9){if(_0x3e4ad9){return _0x3e4ad9['update'](_0x2dc771)['then'](function(_0x3ee747){return _0x3ee747;});}return null;};}function removeEntity(_0x40c3c1,_0x445e4e){return function(_0x35073d){if(_0x35073d){return _0x35073d[_0xae2e('0x3a')]()[_0xae2e('0x23')](function(){_0x40c3c1[_0xae2e('0x30')](0xcc)[_0xae2e('0x31')]();});}};}function handleEntityNotFound(_0x4e7fac,_0x4994f0){return function(_0x26365c){if(!_0x26365c){_0x4e7fac[_0xae2e('0x2f')](0x194);}return _0x26365c;};}function handleError(_0x7371e5,_0x3319ba){_0x3319ba=_0x3319ba||0x1f4;return function(_0x4de38f){logger[_0xae2e('0x29')](_0x4de38f[_0xae2e('0x3b')]);if(_0x4de38f[_0xae2e('0x3c')]){delete _0x4de38f[_0xae2e('0x3c')];}_0x7371e5[_0xae2e('0x30')](_0x3319ba)[_0xae2e('0x3d')](_0x4de38f);};}exports[_0xae2e('0x3e')]=function(_0x1c547c,_0x4ca077){var _0x48f3ae={},_0x40c62e={},_0x1f684b={'count':0x0,'rows':[]};var _0x37038a=_[_0xae2e('0x3f')](db[_0xae2e('0x40')][_0xae2e('0x41')],function(_0x3a83b7){return{'name':_0x3a83b7[_0xae2e('0x42')],'type':_0x3a83b7['type']['key']};});_0x40c62e[_0xae2e('0x43')]=_[_0xae2e('0x3f')](_0x37038a,'name');_0x40c62e[_0xae2e('0x44')]=_[_0xae2e('0x45')](_0x1c547c[_0xae2e('0x44')]);_0x40c62e[_0xae2e('0x46')]=_[_0xae2e('0x47')](_0x40c62e[_0xae2e('0x43')],_0x40c62e[_0xae2e('0x44')]);_0x48f3ae['attributes']=_[_0xae2e('0x47')](_0x40c62e[_0xae2e('0x43')],qs['fields'](_0x1c547c[_0xae2e('0x44')]['fields']));_0x48f3ae[_0xae2e('0x48')]=_0x48f3ae['attributes']['length']?_0x48f3ae['attributes']:_0x40c62e['model'];if(!_0x1c547c[_0xae2e('0x44')][_0xae2e('0x49')]('nolimit')){_0x48f3ae[_0xae2e('0x35')]=qs[_0xae2e('0x35')](_0x1c547c[_0xae2e('0x44')]['limit']);_0x48f3ae[_0xae2e('0x33')]=qs[_0xae2e('0x33')](_0x1c547c['query'][_0xae2e('0x33')]);}_0x48f3ae[_0xae2e('0x4a')]=qs['sort'](_0x1c547c[_0xae2e('0x44')][_0xae2e('0x4b')]);_0x48f3ae[_0xae2e('0x4c')]=qs['filters'](_[_0xae2e('0x4d')](_0x1c547c['query'],_0x40c62e['filters']),_0x37038a);if(_0x1c547c[_0xae2e('0x44')][_0xae2e('0x4e')]){_0x48f3ae[_0xae2e('0x4c')]=_[_0xae2e('0x4f')](_0x48f3ae[_0xae2e('0x4c')],{'$or':_['map'](_0x37038a,function(_0x26d79e){if(_0x26d79e[_0xae2e('0x50')]!==_0xae2e('0x51')){var _0x333b03={};_0x333b03[_0x26d79e[_0xae2e('0x3c')]]={'$like':'%'+_0x1c547c[_0xae2e('0x44')][_0xae2e('0x4e')]+'%'};return _0x333b03;}})});}_0x48f3ae=_[_0xae2e('0x4f')]({},_0x48f3ae,_0x1c547c[_0xae2e('0x52')]);var _0x1ac2bf={'where':_0x48f3ae[_0xae2e('0x4c')]};return db[_0xae2e('0x40')][_0xae2e('0x36')](_0x1ac2bf)[_0xae2e('0x23')](function(_0x4ab85e){_0x1f684b[_0xae2e('0x36')]=_0x4ab85e;if(_0x1c547c[_0xae2e('0x44')][_0xae2e('0x53')]){_0x48f3ae[_0xae2e('0x54')]=[{'all':!![]}];}return db[_0xae2e('0x40')][_0xae2e('0x55')](_0x48f3ae);})[_0xae2e('0x23')](function(_0x3728b1){_0x1f684b['rows']=_0x3728b1;return _0x1f684b;})['then'](respondWithFilteredResult(_0x4ca077,_0x48f3ae))['catch'](handleError(_0x4ca077,null));};exports[_0xae2e('0x56')]=function(_0xdf3d88,_0x4a1415){var _0x546eeb={'raw':!![],'where':{'id':_0xdf3d88[_0xae2e('0x57')]['id']}},_0x2c1044={};_0x2c1044[_0xae2e('0x43')]=_['keys'](db['ChatMessage'][_0xae2e('0x41')]);_0x2c1044[_0xae2e('0x44')]=_[_0xae2e('0x45')](_0xdf3d88[_0xae2e('0x44')]);_0x2c1044[_0xae2e('0x46')]=_[_0xae2e('0x47')](_0x2c1044['model'],_0x2c1044[_0xae2e('0x44')]);_0x546eeb[_0xae2e('0x48')]=_['intersection'](_0x2c1044[_0xae2e('0x43')],qs['fields'](_0xdf3d88[_0xae2e('0x44')][_0xae2e('0x58')]));_0x546eeb[_0xae2e('0x48')]=_0x546eeb[_0xae2e('0x48')][_0xae2e('0x59')]?_0x546eeb[_0xae2e('0x48')]:_0x2c1044[_0xae2e('0x43')];if(_0xdf3d88[_0xae2e('0x44')][_0xae2e('0x53')]){_0x546eeb[_0xae2e('0x54')]=[{'all':!![]}];}_0x546eeb=_[_0xae2e('0x4f')]({},_0x546eeb,_0xdf3d88[_0xae2e('0x52')]);return db['ChatMessage'][_0xae2e('0x5a')](_0x546eeb)[_0xae2e('0x23')](handleEntityNotFound(_0x4a1415,null))[_0xae2e('0x23')](respondWithResult(_0x4a1415,null))[_0xae2e('0x2e')](handleError(_0x4a1415,null));};exports['create']=function(_0x19c365,_0x44918c){return db[_0xae2e('0x40')][_0xae2e('0x5b')](_0x19c365[_0xae2e('0x5c')],{})[_0xae2e('0x23')](respondWithResult(_0x44918c,0xc9))[_0xae2e('0x2e')](handleError(_0x44918c,null));};exports[_0xae2e('0x5d')]=function(_0x49b4bc,_0x1254f5){if(_0x49b4bc[_0xae2e('0x5c')]['id']){delete _0x49b4bc[_0xae2e('0x5c')]['id'];}return db['ChatMessage'][_0xae2e('0x5a')]({'where':{'id':_0x49b4bc['params']['id']}})['then'](handleEntityNotFound(_0x1254f5,null))[_0xae2e('0x23')](saveUpdates(_0x49b4bc[_0xae2e('0x5c')],null))[_0xae2e('0x23')](respondWithResult(_0x1254f5,null))[_0xae2e('0x2e')](handleError(_0x1254f5,null));};exports[_0xae2e('0x3a')]=function(_0xbf1fa6,_0x20a472){return db['ChatMessage'][_0xae2e('0x5a')]({'where':{'id':_0xbf1fa6[_0xae2e('0x57')]['id']}})[_0xae2e('0x23')](handleEntityNotFound(_0x20a472,null))[_0xae2e('0x23')](removeEntity(_0x20a472,null))['catch'](handleError(_0x20a472,null));};exports[_0xae2e('0x5e')]=function(_0x1f19f8,_0x4bb091){return db[_0xae2e('0x40')]['describe']()[_0xae2e('0x23')](respondWithResult(_0x4bb091,null))[_0xae2e('0x2e')](handleError(_0x4bb091,null));};var interaction_log=require(_0xae2e('0x16'))(_0xae2e('0x5f'));exports['accept']=function(_0x540af4,_0x38bfd9,_0x5608f7){var _0xe41b63={'agent':{},'channel':_0xae2e('0x60')};if(_0x540af4[_0xae2e('0x5c')]['id']){delete _0x540af4[_0xae2e('0x5c')]['id'];}_0x540af4[_0xae2e('0x5c')][_0xae2e('0x61')]=!![];_0x540af4['body'][_0xae2e('0x62')]=moment()[_0xae2e('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x540af4[_0xae2e('0x5c')][_0xae2e('0x64')]=_0x540af4[_0xae2e('0x5c')][_0xae2e('0x64')]||_0x540af4[_0xae2e('0x65')]['id'];_0xe41b63['agent']['id']=_0x540af4['body'][_0xae2e('0x64')];return db['ChatMessage']['find']({'where':{'id':_0x540af4[_0xae2e('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x38bfd9,null))[_0xae2e('0x23')](saveUpdates(_0x540af4[_0xae2e('0x5c')],null))['then'](function(_0x501074){if(_0x501074){_0xe41b63[_0xae2e('0x2c')]=_0x501074['get']({'plain':!![]});return db[_0xae2e('0x66')][_0xae2e('0x5a')]({'where':{'id':_0x501074[_0xae2e('0x67')]}});}return null;})[_0xae2e('0x23')](handleEntityNotFound(_0x38bfd9,null))['then'](function(_0x5d5080){if(_0x5d5080){return _0x5d5080['update']({'UserId':_0x540af4[_0xae2e('0x5c')]['UserId'],'read1stAt':_[_0xae2e('0x68')](_0x5d5080[_0xae2e('0x69')])?moment()['format'](_0xae2e('0x6a')):undefined});}return null;})[_0xae2e('0x23')](function(_0x10ae33){if(_0x10ae33){_0xe41b63[_0xae2e('0x6b')]=_0x10ae33['get']({'plain':!![]});interaction_log[_0xae2e('0x24')](_0xae2e('0x6c'),_0x540af4[_0xae2e('0x65')]['id'],_0x540af4[_0xae2e('0x65')][_0xae2e('0x3c')],_0x540af4['user'][_0xae2e('0x6d')],_0xe41b63[_0xae2e('0x6b')]['id'],_0x540af4[_0xae2e('0x5c')]?JSON[_0xae2e('0x28')](_0x540af4['body']):_0xae2e('0x6e'));return respondWithRpcPromise(_0xae2e('0x6f'),_0xae2e('0x70'),_0xe41b63);}return null;})['then'](function(_0x576b49){var _0x2d8e4d=_0xae2e('0x71')+_0x576b49[_0xae2e('0x2c')][_0xae2e('0x72')];return db[_0xae2e('0x73')][_0xae2e('0x44')](_0x2d8e4d,{'type':db[_0xae2e('0x74')][_0xae2e('0x75')][_0xae2e('0x76')],'raw':!![]})[_0xae2e('0x23')](function(_0x5f40b9){return _0x5f40b9;});})[_0xae2e('0x23')](function(_0xb43af2){if(_0xb43af2){_0xe41b63['message']['contact']=_0xb43af2[0x0];if(!_0x540af4[_0xae2e('0x5c')]['UserId'])return;return db['User'][_0xae2e('0x5a')]({'where':{'id':_0x540af4['body'][_0xae2e('0x64')],'role':_0xae2e('0x77')},'attributes':['id',_0xae2e('0x3c'),_0xae2e('0x78'),_0xae2e('0x79'),_0xae2e('0x7a')],'raw':!![]});}return null;})[_0xae2e('0x23')](function(_0x7730c0){if(!_0x7730c0)return null;_0xe41b63[_0xae2e('0x2c')]['agent']=_0x7730c0;return _0xe41b63;})[_0xae2e('0x23')](function(_0x38b488){if(_0x38b488){if(_0x540af4[_0xae2e('0x5c')][_0xae2e('0x7b')]){_0xe41b63[_0xae2e('0x2c')]['interface']=util[_0xae2e('0x63')](_0xae2e('0x7c'),_0x540af4[_0xae2e('0x65')][_0xae2e('0x3c')]);_0xe41b63['message'][_0xae2e('0x7d')]=_0xe41b63[_0xae2e('0x7d')];_0xe41b63['message']['motionChannel']=_0xe41b63[_0xae2e('0x7d')];_0xe41b63[_0xae2e('0x2c')]['event']=_0xae2e('0x7e');return respondWithRpcPromise(_0xae2e('0x7f'),_0xae2e('0x7f'),{'event':'acceptmessage','message':_['merge'](_0xe41b63[_0xae2e('0x2c')],JSON[_0xae2e('0x80')](_0xe41b63['interaction']['formData']))},client9002)[_0xae2e('0x23')](function(){return _0xe41b63;});}return _0xe41b63;}return null;})[_0xae2e('0x23')](respondWithResult(_0x38bfd9,null))['catch'](handleError(_0x38bfd9,null));};var interaction_log=require(_0xae2e('0x16'))(_0xae2e('0x5f'));exports[_0xae2e('0x38')]=function(_0x49c0ff,_0x483cf8,_0x513432){var _0x833604={'agent':{},'channel':'chat'};if(_0x49c0ff[_0xae2e('0x5c')]['id']){delete _0x49c0ff[_0xae2e('0x5c')]['id'];}_0x49c0ff[_0xae2e('0x5c')][_0xae2e('0x64')]=_0x49c0ff[_0xae2e('0x5c')][_0xae2e('0x64')]||_0x49c0ff['user']['id'];_0x833604[_0xae2e('0x77')]['id']=_0x49c0ff[_0xae2e('0x5c')][_0xae2e('0x64')];return db[_0xae2e('0x40')][_0xae2e('0x5a')]({'where':{'id':_0x49c0ff['params']['id'],'UserId':null}})[_0xae2e('0x23')](handleEntityNotFound(_0x483cf8,null))['then'](function(_0x185094){if(_0x185094){_0x833604[_0xae2e('0x2c')]=_0x185094[_0xae2e('0x81')]({'plain':!![]});return db[_0xae2e('0x66')][_0xae2e('0x5a')]({'where':{'id':_0x185094['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x483cf8,null))[_0xae2e('0x23')](function(_0x41a873){if(_0x41a873){_0x833604[_0xae2e('0x6b')]=_0x41a873['get']({'plain':!![]});interaction_log[_0xae2e('0x24')](_0xae2e('0x82'),_0x49c0ff['user']['id'],_0x49c0ff[_0xae2e('0x65')][_0xae2e('0x3c')],_0x49c0ff['user'][_0xae2e('0x6d')],_0x833604['interaction']['id'],_0x49c0ff['body']?JSON['stringify'](_0x49c0ff[_0xae2e('0x5c')]):_0xae2e('0x6e'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x833604);}return null;})[_0xae2e('0x23')](function(_0x28e20a){var _0x24cd9f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x28e20a[_0xae2e('0x2c')][_0xae2e('0x72')];return db[_0xae2e('0x73')][_0xae2e('0x44')](_0x24cd9f,{'type':db[_0xae2e('0x74')]['QueryTypes']['SELECT'],'raw':!![]})[_0xae2e('0x23')](function(_0x2864ae){return _0x2864ae;});})[_0xae2e('0x23')](function(_0x11f675){if(_0x11f675){_0x833604[_0xae2e('0x2c')][_0xae2e('0x83')]=_0x11f675[0x0];if(!_0x49c0ff[_0xae2e('0x5c')][_0xae2e('0x64')])return;return db['User'][_0xae2e('0x5a')]({'where':{'id':_0x49c0ff[_0xae2e('0x5c')][_0xae2e('0x64')],'role':'agent'},'attributes':['id','name',_0xae2e('0x78'),'email',_0xae2e('0x7a')],'raw':!![]});}return null;})[_0xae2e('0x23')](function(_0x39631){if(!_0x39631)return null;_0x833604['message']['agent']=_0x39631;return _0x833604;})['then'](function(_0x205493){if(_0x205493){_0x205493[_0xae2e('0x2c')][_0xae2e('0x84')]=util['format'](_0xae2e('0x7c'),_0x49c0ff[_0xae2e('0x65')][_0xae2e('0x3c')]);_0x205493['message'][_0xae2e('0x7d')]=_0x833604[_0xae2e('0x7d')];_0x205493['message'][_0xae2e('0x85')]=_0x833604[_0xae2e('0x7d')];_0x205493[_0xae2e('0x2c')]['event']=_0xae2e('0x38');respondWithRpcPromise('EventManager',_0xae2e('0x7f'),{'event':_0xae2e('0x86'),'message':_[_0xae2e('0x4f')](_0x833604[_0xae2e('0x2c')],JSON[_0xae2e('0x80')](_0x833604[_0xae2e('0x6b')][_0xae2e('0x87')]))},client9002);return _0x833604;}return null;})['then'](respondWithResult(_0x483cf8,null))['catch'](handleError(_0x483cf8,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index ecd3891..ade88bb 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 _0x9d2a=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9d2a,0x1f2));var _0xa9d2=function(_0x247394,_0x1130c7){_0x247394=_0x247394-0x0;var _0x323f53=_0x9d2a[_0x247394];return _0x323f53;};'use strict';var EventEmitter=require(_0xa9d2('0x0'));var ChatMessage=require(_0xa9d2('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xa9d2('0x2')](0x0);var events={'afterCreate':_0xa9d2('0x3'),'afterUpdate':_0xa9d2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2fb1df){return function(_0x31495d,_0x4be69c,_0x185760){ChatMessageEvents[_0xa9d2('0x5')](_0x2fb1df+':'+_0x31495d['id'],_0x31495d);ChatMessageEvents[_0xa9d2('0x5')](_0x2fb1df,_0x31495d);_0x185760(null);};}for(var e in events){if(events[_0xa9d2('0x6')](e)){var event=events[e];ChatMessage[_0xa9d2('0x7')](e,emitEvent(event));}}module[_0xa9d2('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x9db1=['emit','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x17babc,_0x5c68f3){var _0x2bb70b=function(_0x428fdd){while(--_0x428fdd){_0x17babc['push'](_0x17babc['shift']());}};_0x2bb70b(++_0x5c68f3);}(_0x9db1,0x142));var _0x19db=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9db1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x19db('0x0'));var ChatMessage=require(_0x19db('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x19db('0x2')](0x0);var events={'afterCreate':_0x19db('0x3'),'afterUpdate':_0x19db('0x4'),'afterDestroy':_0x19db('0x5')};function emitEvent(_0x185178){return function(_0x19d39a,_0x39a20b,_0x232b51){ChatMessageEvents[_0x19db('0x6')](_0x185178+':'+_0x19d39a['id'],_0x19d39a);ChatMessageEvents[_0x19db('0x6')](_0x185178,_0x19d39a);_0x232b51(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x19db('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 98930b1..fd90f7d 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 _0x7cca=['findOne','ChatInteractionId','update','createdAt','catch','error','utf8mb4','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId'];(function(_0x43fd38,_0x226b81){var _0x4cb7bd=function(_0x320be6){while(--_0x320be6){_0x43fd38['push'](_0x43fd38['shift']());}};_0x4cb7bd(++_0x226b81);}(_0x7cca,0xff));var _0xa7cc=function(_0x25aec2,_0x23844f){_0x25aec2=_0x25aec2-0x0;var _0x2cd01a=_0x7cca[_0x25aec2];return _0x2cd01a;};'use strict';var _=require(_0xa7cc('0x0'));var util=require(_0xa7cc('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa7cc('0x2'));var BPromise=require(_0xa7cc('0x3'));var rp=require(_0xa7cc('0x4'));var fs=require('fs');var path=require(_0xa7cc('0x5'));var rimraf=require(_0xa7cc('0x6'));var config=require(_0xa7cc('0x7'));var attributes=require(_0xa7cc('0x8'));module[_0xa7cc('0x9')]=function(_0x16d9a6,_0xb0f7a7){return _0x16d9a6[_0xa7cc('0xa')](_0xa7cc('0xb'),attributes,{'tableName':_0xa7cc('0xc'),'paranoid':![],'indexes':[{'name':_0xa7cc('0xd'),'fields':[_0xa7cc('0xe')],'type':_0xa7cc('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d706c,_0x1b08de,_0x53013e){var _0x37028e=_0x16d9a6[_0xa7cc('0x10')];var _0x49e266=_0x2d706c[_0xa7cc('0x11')]({'plain':!![]});if(_0x49e266[_0xa7cc('0x12')][_0xa7cc('0x13')]()==='in'||_0x49e266['direction']['toLowerCase']()===_0xa7cc('0x14')&&!_0x49e266[_0xa7cc('0x15')]&&!_[_0xa7cc('0x16')](_0x49e266[_0xa7cc('0x17')])){_0x37028e['ChatInteraction'][_0xa7cc('0x18')]({'where':{'id':_0x49e266[_0xa7cc('0x19')]}})['then'](function(_0x1e0f02){if(_0x1e0f02){_0x1e0f02[_0xa7cc('0x1a')]({'lastMsgAt':_0x49e266[_0xa7cc('0x1b')],'lastMsgDirection':_0x49e266['direction'][_0xa7cc('0x13')]()});}})[_0xa7cc('0x1c')](function(_0x590ced){console[_0xa7cc('0x1d')](_0x590ced);});}_0x53013e();}},'charset':_0xa7cc('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x69e5=['direction','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','FULLTEXT','models','get','toLowerCase'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x69e5,0x123));var _0x569e=function(_0x4d521e,_0x58ba39){_0x4d521e=_0x4d521e-0x0;var _0x3beb42=_0x69e5[_0x4d521e];return _0x3beb42;};'use strict';var _=require(_0x569e('0x0'));var util=require(_0x569e('0x1'));var logger=require(_0x569e('0x2'))(_0x569e('0x3'));var moment=require(_0x569e('0x4'));var BPromise=require(_0x569e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x569e('0x6'));var rimraf=require(_0x569e('0x7'));var config=require(_0x569e('0x8'));var attributes=require(_0x569e('0x9'));module[_0x569e('0xa')]=function(_0x599a33,_0x4642a1){return _0x599a33[_0x569e('0xb')](_0x569e('0xc'),attributes,{'tableName':_0x569e('0xd'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x569e('0xe')],'type':_0x569e('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x762a2c,_0x34654a,_0x483674){var _0x4945b9=_0x599a33[_0x569e('0x10')];var _0x3fb853=_0x762a2c[_0x569e('0x11')]({'plain':!![]});if(_0x3fb853['direction'][_0x569e('0x12')]()==='in'||_0x3fb853[_0x569e('0x13')][_0x569e('0x12')]()===_0x569e('0x14')&&!_0x3fb853['secret']&&!_[_0x569e('0x15')](_0x3fb853[_0x569e('0x16')])){_0x4945b9[_0x569e('0x17')][_0x569e('0x18')]({'where':{'id':_0x3fb853[_0x569e('0x19')]}})[_0x569e('0x1a')](function(_0xe42b1a){if(_0xe42b1a){_0xe42b1a['update']({'lastMsgAt':_0x3fb853[_0x569e('0x1b')],'lastMsgDirection':_0x3fb853[_0x569e('0x13')]['toLowerCase']()});}})[_0x569e('0x1c')](function(_0x1ac433){console[_0x569e('0x1d')](_0x1ac433);});}_0x483674();}},'charset':_0x569e('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 8c4ffd3..9313124 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 _0xc48d=['debug','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','register','request','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage','ChatMessage','create','options','raw'];(function(_0x106b25,_0x54e987){var _0x9ba749=function(_0x3b0360){while(--_0x3b0360){_0x106b25['push'](_0x106b25['shift']());}};_0x9ba749(++_0x54e987);}(_0xc48d,0x11a));var _0xdc48=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0xc48d[_0x43b06b];return _0x2c555b;};'use strict';var _=require(_0xdc48('0x0'));var util=require(_0xdc48('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdc48('0x2'));var fs=require('fs');var Redis=require(_0xdc48('0x3'));var db=require(_0xdc48('0x4'))['db'];var utils=require(_0xdc48('0x5'));var logger=require(_0xdc48('0x6'))(_0xdc48('0x7'));var config=require(_0xdc48('0x8'));var jayson=require(_0xdc48('0x9'));var client=jayson[_0xdc48('0xa')][_0xdc48('0xb')]({'port':0x232a});config[_0xdc48('0xc')]=_[_0xdc48('0xd')](config[_0xdc48('0xc')],{'host':_0xdc48('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc48('0xc')]));require(_0xdc48('0xf'))[_0xdc48('0x10')](socket);function respondWithRpcPromise(_0x31c527,_0x404756,_0x27dd28){return new BPromise(function(_0xfb6101,_0x327146){return client[_0xdc48('0x11')](_0x31c527,_0x27dd28)[_0xdc48('0x12')](function(_0xa225bd){logger[_0xdc48('0x13')]('ChatMessage,\x20%s,\x20%s',_0x404756,_0xdc48('0x14'));logger['debug'](_0xdc48('0x15'),_0x404756,'request\x20sent',JSON[_0xdc48('0x16')](_0xa225bd));if(_0xa225bd[_0xdc48('0x17')]){if(_0xa225bd[_0xdc48('0x17')][_0xdc48('0x18')]===0x1f4){logger['error'](_0xdc48('0x19'),_0x404756,_0xa225bd[_0xdc48('0x17')][_0xdc48('0x1a')]);return _0x327146(_0xa225bd[_0xdc48('0x17')][_0xdc48('0x1a')]);}logger[_0xdc48('0x17')](_0xdc48('0x19'),_0x404756,_0xa225bd[_0xdc48('0x17')][_0xdc48('0x1a')]);return _0xfb6101(_0xa225bd[_0xdc48('0x17')][_0xdc48('0x1a')]);}else{logger[_0xdc48('0x13')](_0xdc48('0x19'),_0x404756,_0xdc48('0x14'));_0xfb6101(_0xa225bd[_0xdc48('0x1b')]['message']);}})['catch'](function(_0x5a3747){logger[_0xdc48('0x17')]('ChatMessage,\x20%s,\x20%s',_0x404756,_0x5a3747);_0x327146(_0x5a3747);});});}exports[_0xdc48('0x1c')]=function(_0x504d24){var _0x35c20c=this;return new Promise(function(_0x3e77c3,_0x77bd0c){return db[_0xdc48('0x1d')][_0xdc48('0x1e')](_0x504d24['body'],{'raw':_0x504d24[_0xdc48('0x1f')]?_0x504d24[_0xdc48('0x1f')][_0xdc48('0x20')]===undefined?!![]:![]:!![]})[_0xdc48('0x12')](function(_0x419e78){logger[_0xdc48('0x13')](_0xdc48('0x1c'),_0x504d24);logger[_0xdc48('0x21')](_0xdc48('0x1c'),_0x504d24,JSON[_0xdc48('0x16')](_0x419e78));_0x3e77c3(_0x419e78);})[_0xdc48('0x22')](function(_0x233ba6){logger[_0xdc48('0x17')]('CreateChatMessage',_0x233ba6[_0xdc48('0x1a')],_0x504d24);_0x77bd0c(_0x35c20c[_0xdc48('0x17')](0x1f4,_0x233ba6[_0xdc48('0x1a')]));});});}; \ No newline at end of file +var _0x612a=['body','options','raw','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateChatMessage','ChatMessage','create'];(function(_0x26e8bf,_0x5054d7){var _0x15a67b=function(_0x329fd3){while(--_0x329fd3){_0x26e8bf['push'](_0x26e8bf['shift']());}};_0x15a67b(++_0x5054d7);}(_0x612a,0xa4));var _0xa612=function(_0x52e363,_0x48062a){_0x52e363=_0x52e363-0x0;var _0x3fc2b5=_0x612a[_0x52e363];return _0x3fc2b5;};'use strict';var _=require('lodash');var util=require(_0xa612('0x0'));var moment=require(_0xa612('0x1'));var BPromise=require(_0xa612('0x2'));var rs=require(_0xa612('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa612('0x4'))['db'];var utils=require(_0xa612('0x5'));var logger=require(_0xa612('0x6'))(_0xa612('0x7'));var config=require(_0xa612('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa612('0x9')][_0xa612('0xa')]({'port':0x232a});config[_0xa612('0xb')]=_[_0xa612('0xc')](config[_0xa612('0xb')],{'host':_0xa612('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')[_0xa612('0xe')](socket);function respondWithRpcPromise(_0x1bbe8f,_0x505311,_0x2fff63){return new BPromise(function(_0x423cf8,_0x1c3cc8){return client[_0xa612('0xf')](_0x1bbe8f,_0x2fff63)[_0xa612('0x10')](function(_0x555ccb){logger[_0xa612('0x11')](_0xa612('0x12'),_0x505311,_0xa612('0x13'));logger[_0xa612('0x14')](_0xa612('0x15'),_0x505311,_0xa612('0x13'),JSON[_0xa612('0x16')](_0x555ccb));if(_0x555ccb[_0xa612('0x17')]){if(_0x555ccb[_0xa612('0x17')]['code']===0x1f4){logger[_0xa612('0x17')]('ChatMessage,\x20%s,\x20%s',_0x505311,_0x555ccb[_0xa612('0x17')]['message']);return _0x1c3cc8(_0x555ccb[_0xa612('0x17')][_0xa612('0x18')]);}logger[_0xa612('0x17')](_0xa612('0x12'),_0x505311,_0x555ccb[_0xa612('0x17')]['message']);return _0x423cf8(_0x555ccb['error'][_0xa612('0x18')]);}else{logger[_0xa612('0x11')](_0xa612('0x12'),_0x505311,_0xa612('0x13'));_0x423cf8(_0x555ccb['result']['message']);}})['catch'](function(_0x4df57c){logger[_0xa612('0x17')]('ChatMessage,\x20%s,\x20%s',_0x505311,_0x4df57c);_0x1c3cc8(_0x4df57c);});});}exports[_0xa612('0x19')]=function(_0x3de6f9){var _0x516221=this;return new Promise(function(_0x33de7d,_0x53d2d7){return db[_0xa612('0x1a')][_0xa612('0x1b')](_0x3de6f9[_0xa612('0x1c')],{'raw':_0x3de6f9[_0xa612('0x1d')]?_0x3de6f9[_0xa612('0x1d')][_0xa612('0x1e')]===undefined?!![]:![]:!![]})[_0xa612('0x10')](function(_0x4221b2){logger[_0xa612('0x11')](_0xa612('0x19'),_0x3de6f9);logger[_0xa612('0x14')](_0xa612('0x19'),_0x3de6f9,JSON[_0xa612('0x16')](_0x4221b2));_0x33de7d(_0x4221b2);})[_0xa612('0x1f')](function(_0x1409b8){logger[_0xa612('0x17')](_0xa612('0x19'),_0x1409b8[_0xa612('0x18')],_0x3de6f9);_0x53d2d7(_0x516221[_0xa612('0x17')](0x1f4,_0x1409b8[_0xa612('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 4bdfbd5..4cfe8fe 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 _0x6b8f=['save','update','emit','removeListener','register','length'];(function(_0x4ab001,_0x532960){var _0x52c134=function(_0x3f4fc9){while(--_0x3f4fc9){_0x4ab001['push'](_0x4ab001['shift']());}};_0x52c134(++_0x532960);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x378e5b,_0x49fa7e){_0x378e5b=_0x378e5b-0x0;var _0x3410c3=_0x6b8f[_0x378e5b];return _0x3410c3;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xf6b8('0x0'),'remove',_0xf6b8('0x1')];function createListener(_0x4e006e,_0x5443a1){return function(_0x362c27){_0x5443a1[_0xf6b8('0x2')](_0x4e006e,_0x362c27);};}function removeListener(_0x4d0ee5,_0x2b5ca9){return function(){ChatMessageEvents[_0xf6b8('0x3')](_0x4d0ee5,_0x2b5ca9);};}exports[_0xf6b8('0x4')]=function(_0x549eac){for(var _0x2d035e=0x0,_0x79c66d=events[_0xf6b8('0x5')];_0x2d035e<_0x79c66d;_0x2d035e++){var _0x3c3430=events[_0x2d035e];var _0x557910=createListener('chatMessage:'+_0x3c3430,_0x549eac);ChatMessageEvents['on'](_0x3c3430,_0x557910);}}; \ No newline at end of file +var _0xee14=['length','chatMessage:','remove','update','emit','removeListener'];(function(_0x38a660,_0x3a6593){var _0x5a601c=function(_0x2190a8){while(--_0x2190a8){_0x38a660['push'](_0x38a660['shift']());}};_0x5a601c(++_0x3a6593);}(_0xee14,0x13a));var _0x4ee1=function(_0x52021d,_0x1f0186){_0x52021d=_0x52021d-0x0;var _0x349db=_0xee14[_0x52021d];return _0x349db;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x4ee1('0x0'),_0x4ee1('0x1')];function createListener(_0x34e49d,_0x1fa407){return function(_0x18e3c4){_0x1fa407[_0x4ee1('0x2')](_0x34e49d,_0x18e3c4);};}function removeListener(_0x34a0ae,_0x1e5fb6){return function(){ChatMessageEvents[_0x4ee1('0x3')](_0x34a0ae,_0x1e5fb6);};}exports['register']=function(_0xba6d36){for(var _0x573700=0x0,_0x327c18=events[_0x4ee1('0x4')];_0x573700<_0x327c18;_0x573700++){var _0x187656=events[_0x573700];var _0x293d5f=createListener(_0x4ee1('0x5')+_0x187656,_0xba6d36);ChatMessageEvents['on'](_0x187656,_0x293d5f);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index a9f693c..3cee03e 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 _0x6121=['create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create'];(function(_0x33484b,_0x380ad8){var _0x4ebdef=function(_0x568f37){while(--_0x568f37){_0x33484b['push'](_0x33484b['shift']());}};_0x4ebdef(++_0x380ad8);}(_0x6121,0x7d));var _0x1612=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6121[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x1612('0x0'));var util=require(_0x1612('0x1'));var path=require(_0x1612('0x2'));var timeout=require(_0x1612('0x3'));var express=require(_0x1612('0x4'));var router=express['Router']();var fs_extra=require(_0x1612('0x5'));var auth=require(_0x1612('0x6'));var interaction=require(_0x1612('0x7'));var config=require(_0x1612('0x8'));var controller=require('./chatMessage.controller');router[_0x1612('0x9')]('/',auth[_0x1612('0xa')](),controller[_0x1612('0xb')]);router[_0x1612('0x9')](_0x1612('0xc'),auth['isAuthenticated'](),controller[_0x1612('0xd')]);router['get'](_0x1612('0xe'),auth[_0x1612('0xa')](),controller[_0x1612('0xf')]);router[_0x1612('0x10')]('/',auth[_0x1612('0xa')](),interaction[_0x1612('0x11')](_0x1612('0x12'),_0x1612('0x13')),controller[_0x1612('0x14')]);router[_0x1612('0x15')](_0x1612('0xe'),controller[_0x1612('0x16')]);router[_0x1612('0x15')](_0x1612('0x17'),auth['isAuthenticated'](),controller[_0x1612('0x18')]);router[_0x1612('0x15')](_0x1612('0x19'),auth['isAuthenticated'](),controller[_0x1612('0x1a')]);router[_0x1612('0x1b')](_0x1612('0xe'),auth[_0x1612('0xa')](),controller[_0x1612('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xa079=['create','put','update','/:id/accept','accept','/:id/reject','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id','show','tracked','chat'];(function(_0x42b1f6,_0x3df91b){var _0x37ee4f=function(_0x55df2){while(--_0x55df2){_0x42b1f6['push'](_0x42b1f6['shift']());}};_0x37ee4f(++_0x3df91b);}(_0xa079,0x1b8));var _0x9a07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa079[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9a07('0x0'));var util=require(_0x9a07('0x1'));var path=require(_0x9a07('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a07('0x3'));var router=express[_0x9a07('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9a07('0x5'));var config=require(_0x9a07('0x6'));var controller=require(_0x9a07('0x7'));router[_0x9a07('0x8')]('/',auth[_0x9a07('0x9')](),controller[_0x9a07('0xa')]);router[_0x9a07('0x8')](_0x9a07('0xb'),auth[_0x9a07('0x9')](),controller['describe']);router['get'](_0x9a07('0xc'),auth[_0x9a07('0x9')](),controller[_0x9a07('0xd')]);router['post']('/',auth[_0x9a07('0x9')](),interaction[_0x9a07('0xe')](_0x9a07('0xf'),'chatmessage:create'),controller[_0x9a07('0x10')]);router[_0x9a07('0x11')](_0x9a07('0xc'),controller[_0x9a07('0x12')]);router[_0x9a07('0x11')](_0x9a07('0x13'),auth['isAuthenticated'](),controller[_0x9a07('0x14')]);router[_0x9a07('0x11')](_0x9a07('0x15'),auth[_0x9a07('0x9')](),controller['reject']);router[_0x9a07('0x16')]('/:id',auth[_0x9a07('0x9')](),controller['destroy']);module[_0x9a07('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 2689b98..d767749 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x3f1203,_0xffd4c7){var _0xcec45d=function(_0x38c6c8){while(--_0x38c6c8){_0x3f1203['push'](_0x3f1203['shift']());}};_0xcec45d(++_0xffd4c7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x340c3c,_0x3578b0){_0x340c3c=_0x340c3c-0x0;var _0x3e5431=_0x5f2f[_0x340c3c];return _0x3e5431;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x0b0e=['medium','sequelize','TEXT'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3aaef5,_0x16cdc8){_0x3aaef5=_0x3aaef5-0x0;var _0x4c0ed5=_0x0b0e[_0x3aaef5];return _0x4c0ed5;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 40353f5..2e6d01e 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(_0x590667,_0x310611){var _0x2c6e28=function(_0xd3a81d){while(--_0xd3a81d){_0x590667['push'](_0x590667['shift']());}};_0x2c6e28(++_0x310611);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5ba4c5,_0x4f3319){var _0x3209aa=function(_0x576cae){while(--_0x576cae){_0x5ba4c5['push'](_0x5ba4c5['shift']());}};_0x3209aa(++_0x4f3319);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index f3bb299..a4cbd84 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 _0xb662=['remove','emit','hasOwnProperty','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update'];(function(_0x547206,_0x33c3da){var _0x5cb60b=function(_0x30d9b1){while(--_0x30d9b1){_0x547206['push'](_0x547206['shift']());}};_0x5cb60b(++_0x33c3da);}(_0xb662,0x13e));var _0x2b66=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xb662[_0x4ed520];return _0x4415a6;};'use strict';var EventEmitter=require(_0x2b66('0x0'));var ChatOfflineMessage=require(_0x2b66('0x1'))['db'][_0x2b66('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x2b66('0x3')](0x0);var events={'afterCreate':_0x2b66('0x4'),'afterUpdate':_0x2b66('0x5'),'afterDestroy':_0x2b66('0x6')};function emitEvent(_0x1665f4){return function(_0x1cfb8d,_0x136655,_0x156bbe){ChatOfflineMessageEvents[_0x2b66('0x7')](_0x1665f4+':'+_0x1cfb8d['id'],_0x1cfb8d);ChatOfflineMessageEvents[_0x2b66('0x7')](_0x1665f4,_0x1cfb8d);_0x156bbe(null);};}for(var e in events){if(events[_0x2b66('0x8')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x3930=['hook','exports','../../mysqldb','setMaxListeners','update','emit'];(function(_0x1bb030,_0x27d05f){var _0x28ef4f=function(_0xb1150e){while(--_0xb1150e){_0x1bb030['push'](_0x1bb030['shift']());}};_0x28ef4f(++_0x27d05f);}(_0x3930,0x12e));var _0x0393=function(_0x3239f5,_0x50e77c){_0x3239f5=_0x3239f5-0x0;var _0x3559c8=_0x3930[_0x3239f5];return _0x3559c8;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x0393('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0393('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0393('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1f9762){return function(_0x4da057,_0x4f603f,_0x288d3a){ChatOfflineMessageEvents[_0x0393('0x3')](_0x1f9762+':'+_0x4da057['id'],_0x4da057);ChatOfflineMessageEvents[_0x0393('0x3')](_0x1f9762,_0x4da057);_0x288d3a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x0393('0x4')](e,emitEvent(event));}}module[_0x0393('0x5')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 734d589..86b3d98 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 _0x8769=['./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x38867a,_0x43724f){var _0x2c77d8=function(_0x51d1a3){while(--_0x51d1a3){_0x38867a['push'](_0x38867a['shift']());}};_0x2c77d8(++_0x43724f);}(_0x8769,0x10a));var _0x9876=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x8769[_0x1e4360];return _0x31e6b4;};'use strict';var attributes=require(_0x9876('0x0'));module[_0x9876('0x1')]=function(_0x4a7b65){return _0x4a7b65[_0x9876('0x2')](_0x9876('0x3'),attributes,{'tableName':_0x9876('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9876('0x5'),'collate':_0x9876('0x6')});}; \ No newline at end of file +var _0x279f=['exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x4839eb,_0x364008){var _0x2982e4=function(_0x4b370c){while(--_0x4b370c){_0x4839eb['push'](_0x4839eb['shift']());}};_0x2982e4(++_0x364008);}(_0x279f,0x18b));var _0xf279=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x279f[_0x1928c9];return _0x51b5fb;};'use strict';var attributes=require(_0xf279('0x0'));module[_0xf279('0x1')]=function(_0x379d6c){return _0x379d6c[_0xf279('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0xf279('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf279('0x4'),'collate':_0xf279('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0a7377e..c6f042e 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 _0xb5fc=['client','request','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5ca7ee,_0x4c4c48){var _0x47123f=function(_0x55f46c){while(--_0x55f46c){_0x5ca7ee['push'](_0x5ca7ee['shift']());}};_0x47123f(++_0x4c4c48);}(_0xb5fc,0x71));var _0xcb5f=function(_0x3d3c2f,_0xedf6bc){_0x3d3c2f=_0x3d3c2f-0x0;var _0x3571be=_0xb5fc[_0x3d3c2f];return _0x3571be;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb5f('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb5f('0x1'))['db'];var utils=require(_0xcb5f('0x2'));var logger=require(_0xcb5f('0x3'))(_0xcb5f('0x4'));var config=require(_0xcb5f('0x5'));var jayson=require(_0xcb5f('0x6'));var client=jayson[_0xcb5f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13abe7,_0x48cfe1,_0x1dfeb0){return new BPromise(function(_0x29308d,_0x36535f){return client[_0xcb5f('0x8')](_0x13abe7,_0x1dfeb0)['then'](function(_0x2165f6){logger[_0xcb5f('0x9')]('ChatOfflineMessage,\x20%s,\x20%s',_0x48cfe1,_0xcb5f('0xa'));logger[_0xcb5f('0xb')](_0xcb5f('0xc'),_0x48cfe1,_0xcb5f('0xa'),JSON[_0xcb5f('0xd')](_0x2165f6));if(_0x2165f6[_0xcb5f('0xe')]){if(_0x2165f6[_0xcb5f('0xe')][_0xcb5f('0xf')]===0x1f4){logger[_0xcb5f('0xe')](_0xcb5f('0x10'),_0x48cfe1,_0x2165f6[_0xcb5f('0xe')][_0xcb5f('0x11')]);return _0x36535f(_0x2165f6['error'][_0xcb5f('0x11')]);}logger[_0xcb5f('0xe')](_0xcb5f('0x10'),_0x48cfe1,_0x2165f6[_0xcb5f('0xe')][_0xcb5f('0x11')]);return _0x29308d(_0x2165f6[_0xcb5f('0xe')][_0xcb5f('0x11')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x48cfe1,_0xcb5f('0xa'));_0x29308d(_0x2165f6[_0xcb5f('0x12')][_0xcb5f('0x11')]);}})[_0xcb5f('0x13')](function(_0x3909be){logger[_0xcb5f('0xe')](_0xcb5f('0x10'),_0x48cfe1,_0x3909be);_0x36535f(_0x3909be);});});} \ No newline at end of file +var _0x3d32=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x13342f,_0x3d6303){var _0x2fc1fc=function(_0x2d991f){while(--_0x2d991f){_0x13342f['push'](_0x13342f['shift']());}};_0x2fc1fc(++_0x3d6303);}(_0x3d32,0x13c));var _0x23d3=function(_0x43e218,_0x41ef9b){_0x43e218=_0x43e218-0x0;var _0xf1d7e=_0x3d32[_0x43e218];return _0xf1d7e;};'use strict';var _=require(_0x23d3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23d3('0x1'))['db'];var utils=require(_0x23d3('0x2'));var logger=require(_0x23d3('0x3'))(_0x23d3('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x23d3('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14d62f,_0x5a2af9,_0x4c9b7f){return new BPromise(function(_0x5265d9,_0x39aa95){return client['request'](_0x14d62f,_0x4c9b7f)['then'](function(_0x426e17){logger[_0x23d3('0x6')](_0x23d3('0x7'),_0x5a2af9,_0x23d3('0x8'));logger['debug'](_0x23d3('0x9'),_0x5a2af9,_0x23d3('0x8'),JSON['stringify'](_0x426e17));if(_0x426e17[_0x23d3('0xa')]){if(_0x426e17['error']['code']===0x1f4){logger[_0x23d3('0xa')](_0x23d3('0x7'),_0x5a2af9,_0x426e17[_0x23d3('0xa')]['message']);return _0x39aa95(_0x426e17[_0x23d3('0xa')][_0x23d3('0xb')]);}logger[_0x23d3('0xa')](_0x23d3('0x7'),_0x5a2af9,_0x426e17[_0x23d3('0xa')][_0x23d3('0xb')]);return _0x5265d9(_0x426e17['error']['message']);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x5a2af9,_0x23d3('0x8'));_0x5265d9(_0x426e17['result'][_0x23d3('0xb')]);}})[_0x23d3('0xc')](function(_0xcb2a9){logger[_0x23d3('0xa')](_0x23d3('0x7'),_0x5a2af9,_0xcb2a9);_0x39aa95(_0xcb2a9);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 6607dd7..2f14270 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 _0xd4bf=['path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','/:id','show','post','put','delete','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4bf,0x18a));var _0xfd4b=function(_0x4211cf,_0x3ebd73){_0x4211cf=_0x4211cf-0x0;var _0x26a121=_0xd4bf[_0x4211cf];return _0x26a121;};'use strict';var multer=require(_0xfd4b('0x0'));var util=require(_0xfd4b('0x1'));var path=require(_0xfd4b('0x2'));var timeout=require(_0xfd4b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfd4b('0x4'));var auth=require(_0xfd4b('0x5'));var interaction=require(_0xfd4b('0x6'));var config=require(_0xfd4b('0x7'));var controller=require(_0xfd4b('0x8'));router['get']('/',auth[_0xfd4b('0x9')](),controller['index']);router[_0xfd4b('0xa')](_0xfd4b('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xfd4b('0xa')](_0xfd4b('0xc'),auth[_0xfd4b('0x9')](),controller[_0xfd4b('0xd')]);router[_0xfd4b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfd4b('0xf')](_0xfd4b('0xc'),auth[_0xfd4b('0x9')](),controller['update']);router[_0xfd4b('0x10')]('/:id',auth[_0xfd4b('0x9')](),controller['destroy']);module[_0xfd4b('0x11')]=router; \ No newline at end of file +var _0xb9ea=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','destroy','exports','multer'];(function(_0x17a80c,_0xfad831){var _0x4d7e6b=function(_0x5739e6){while(--_0x5739e6){_0x17a80c['push'](_0x17a80c['shift']());}};_0x4d7e6b(++_0xfad831);}(_0xb9ea,0x131));var _0xab9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9ea[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xab9e('0x0'));var util=require('util');var path=require(_0xab9e('0x1'));var timeout=require('connect-timeout');var express=require(_0xab9e('0x2'));var router=express[_0xab9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xab9e('0x4'));var interaction=require(_0xab9e('0x5'));var config=require(_0xab9e('0x6'));var controller=require(_0xab9e('0x7'));router[_0xab9e('0x8')]('/',auth[_0xab9e('0x9')](),controller['index']);router[_0xab9e('0x8')](_0xab9e('0xa'),auth['isAuthenticated'](),controller[_0xab9e('0xb')]);router[_0xab9e('0x8')](_0xab9e('0xc'),auth[_0xab9e('0x9')](),controller[_0xab9e('0xd')]);router[_0xab9e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xab9e('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xab9e('0x10')]);module[_0xab9e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 98f6539..c2df612 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 _0x5850=['timeout','mouseOver','INTEGER','STRING','ENUM'];(function(_0x3ffa1f,_0x56a0cf){var _0x4e06f1=function(_0x171ce2){while(--_0x171ce2){_0x3ffa1f['push'](_0x3ffa1f['shift']());}};_0x4e06f1(++_0x56a0cf);}(_0x5850,0x161));var _0x0585=function(_0x1df6e7,_0x58d850){_0x1df6e7=_0x1df6e7-0x0;var _0x267504=_0x5850[_0x1df6e7];return _0x267504;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0585('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x0585('0x1')]('mouseOver',_0x0585('0x2')),'defaultValue':_0x0585('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0585('0x4')]}}; \ No newline at end of file +var _0xacfc=['STRING','ENUM','mouseOver','timeout','INTEGER','exports'];(function(_0x403ce7,_0x5e2728){var _0x550430=function(_0x11ee32){while(--_0x11ee32){_0x403ce7['push'](_0x403ce7['shift']());}};_0x550430(++_0x5e2728);}(_0xacfc,0x77));var _0xcacf=function(_0x3a861c,_0xf07f4c){_0x3a861c=_0x3a861c-0x0;var _0xbb4383=_0xacfc[_0x3a861c];return _0xbb4383;};'use strict';var Sequelize=require('sequelize');module[_0xcacf('0x0')]={'name':{'type':Sequelize[_0xcacf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xcacf('0x2')](_0xcacf('0x3'),_0xcacf('0x4')),'defaultValue':_0xcacf('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xcacf('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 12b3815..8af5c19 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 _0x1224=['query','keys','filters','intersection','attributes','fields','length','merge','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','send','show','params','model','ChatProactiveAction'];(function(_0x5e1c60,_0x4ef580){var _0x5f025c=function(_0x3bc9b3){while(--_0x3bc9b3){_0x5e1c60['push'](_0x5e1c60['shift']());}};_0x5f025c(++_0x4ef580);}(_0x1224,0x10d));var _0x4122=function(_0x4aadbc,_0x4afc4d){_0x4aadbc=_0x4aadbc-0x0;var _0x372f33=_0x1224[_0x4aadbc];return _0x372f33;};'use strict';var emlformat=require(_0x4122('0x0'));var rimraf=require(_0x4122('0x1'));var zipdir=require(_0x4122('0x2'));var jsonpatch=require(_0x4122('0x3'));var rp=require(_0x4122('0x4'));var moment=require(_0x4122('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4122('0x6'));var util=require(_0x4122('0x7'));var path=require(_0x4122('0x8'));var sox=require('sox');var csv=require(_0x4122('0x9'));var ejs=require(_0x4122('0xa'));var fs=require('fs');var fs_extra=require(_0x4122('0xb'));var _=require(_0x4122('0xc'));var squel=require(_0x4122('0xd'));var crypto=require(_0x4122('0xe'));var jsforce=require(_0x4122('0xf'));var deskjs=require(_0x4122('0x10'));var toCsv=require(_0x4122('0x9'));var querystring=require(_0x4122('0x11'));var Papa=require(_0x4122('0x12'));var Redis=require(_0x4122('0x13'));var authService=require(_0x4122('0x14'));var qs=require(_0x4122('0x15'));var as=require(_0x4122('0x16'));var hardwareService=require(_0x4122('0x17'));var logger=require(_0x4122('0x18'))(_0x4122('0x19'));var utils=require(_0x4122('0x1a'));var config=require(_0x4122('0x1b'));var licenseUtil=require(_0x4122('0x1c'));var db=require(_0x4122('0x1d'))['db'];function respondWithStatusCode(_0x440ff0,_0x8d4876){_0x8d4876=_0x8d4876||0xcc;return function(_0xe213d){if(_0xe213d){return _0x440ff0[_0x4122('0x1e')](_0x8d4876);}return _0x440ff0[_0x4122('0x1f')](_0x8d4876)[_0x4122('0x20')]();};}function respondWithResult(_0x421ee3,_0x1a701e){_0x1a701e=_0x1a701e||0xc8;return function(_0x3a88fe){if(_0x3a88fe){return _0x421ee3['status'](_0x1a701e)[_0x4122('0x21')](_0x3a88fe);}};}function respondWithFilteredResult(_0x3c674e,_0x192e77){return function(_0x359909){if(_0x359909){var _0x520300=typeof _0x192e77[_0x4122('0x22')]===_0x4122('0x23')&&typeof _0x192e77['limit']===_0x4122('0x23');var _0x3ec4d3=_0x359909[_0x4122('0x24')];var _0x4636ae=_0x520300?0x0:_0x192e77[_0x4122('0x22')];var _0x42374d=_0x520300?_0x359909[_0x4122('0x24')]:_0x192e77['offset']+_0x192e77['limit'];var _0x586105;if(_0x42374d>=_0x3ec4d3){_0x42374d=_0x3ec4d3;_0x586105=0xc8;}else{_0x586105=0xce;}_0x3c674e[_0x4122('0x1f')](_0x586105);return _0x3c674e[_0x4122('0x25')](_0x4122('0x26'),_0x4636ae+'-'+_0x42374d+'/'+_0x3ec4d3)[_0x4122('0x21')](_0x359909);}return null;};}function patchUpdates(_0xef6995){return function(_0xb0a7d){try{jsonpatch[_0x4122('0x27')](_0xb0a7d,_0xef6995,!![]);}catch(_0x46b24e){return BPromise['reject'](_0x46b24e);}return _0xb0a7d[_0x4122('0x28')]();};}function saveUpdates(_0x50e243,_0x4f949a){return function(_0x508cd7){if(_0x508cd7){return _0x508cd7[_0x4122('0x29')](_0x50e243)[_0x4122('0x2a')](function(_0x317418){return _0x317418;});}return null;};}function removeEntity(_0x4eb35b,_0x128fde){return function(_0x386cdc){if(_0x386cdc){return _0x386cdc['destroy']()['then'](function(){_0x4eb35b[_0x4122('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4db23e,_0x59895d){return function(_0x1b449b){if(!_0x1b449b){_0x4db23e[_0x4122('0x1e')](0x194);}return _0x1b449b;};}function handleError(_0xbb76e1,_0x1bb51b){_0x1bb51b=_0x1bb51b||0x1f4;return function(_0x31568f){logger[_0x4122('0x2b')](_0x31568f[_0x4122('0x2c')]);if(_0x31568f[_0x4122('0x2d')]){delete _0x31568f[_0x4122('0x2d')];}_0xbb76e1[_0x4122('0x1f')](_0x1bb51b)[_0x4122('0x2e')](_0x31568f);};}exports[_0x4122('0x2f')]=function(_0xfefaf6,_0x5f32c5){var _0x2e5bc2={'raw':!![],'where':{'id':_0xfefaf6[_0x4122('0x30')]['id']}},_0x43c51c={};_0x43c51c[_0x4122('0x31')]=_['keys'](db[_0x4122('0x32')]['rawAttributes']);_0x43c51c[_0x4122('0x33')]=_[_0x4122('0x34')](_0xfefaf6[_0x4122('0x33')]);_0x43c51c[_0x4122('0x35')]=_[_0x4122('0x36')](_0x43c51c[_0x4122('0x31')],_0x43c51c[_0x4122('0x33')]);_0x2e5bc2[_0x4122('0x37')]=_['intersection'](_0x43c51c[_0x4122('0x31')],qs[_0x4122('0x38')](_0xfefaf6['query'][_0x4122('0x38')]));_0x2e5bc2[_0x4122('0x37')]=_0x2e5bc2[_0x4122('0x37')][_0x4122('0x39')]?_0x2e5bc2['attributes']:_0x43c51c[_0x4122('0x31')];if(_0xfefaf6[_0x4122('0x33')]['includeAll']){_0x2e5bc2['include']=[{'all':!![]}];}_0x2e5bc2=_[_0x4122('0x3a')]({},_0x2e5bc2,_0xfefaf6['options']);return db[_0x4122('0x32')][_0x4122('0x3b')](_0x2e5bc2)['then'](handleEntityNotFound(_0x5f32c5,null))[_0x4122('0x2a')](respondWithResult(_0x5f32c5,null))[_0x4122('0x3c')](handleError(_0x5f32c5,null));};exports[_0x4122('0x3d')]=function(_0x5bb6d6,_0x35971b){return db['ChatProactiveAction'][_0x4122('0x3d')](_0x5bb6d6[_0x4122('0x3e')],{})[_0x4122('0x2a')](respondWithResult(_0x35971b,0xc9))['catch'](handleError(_0x35971b,null));};exports[_0x4122('0x29')]=function(_0x5427ca,_0x2da1bd){if(_0x5427ca[_0x4122('0x3e')]['id']){delete _0x5427ca['body']['id'];}return db['ChatProactiveAction']['find']({'where':{'id':_0x5427ca[_0x4122('0x30')]['id']}})['then'](handleEntityNotFound(_0x2da1bd,null))[_0x4122('0x2a')](saveUpdates(_0x5427ca[_0x4122('0x3e')],null))[_0x4122('0x2a')](respondWithResult(_0x2da1bd,null))[_0x4122('0x3c')](handleError(_0x2da1bd,null));};exports[_0x4122('0x3f')]=function(_0x517a59,_0x5c20ec){return db[_0x4122('0x32')]['find']({'where':{'id':_0x517a59[_0x4122('0x30')]['id']}})['then'](handleEntityNotFound(_0x5c20ec,null))[_0x4122('0x2a')](removeEntity(_0x5c20ec,null))[_0x4122('0x3c')](handleError(_0x5c20ec,null));}; \ No newline at end of file +var _0x394e=['find','then','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','sendStatus','error','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options'];(function(_0xba4dfb,_0x443432){var _0x3952d4=function(_0x10d738){while(--_0x10d738){_0xba4dfb['push'](_0xba4dfb['shift']());}};_0x3952d4(++_0x443432);}(_0x394e,0x88));var _0xe394=function(_0x28202e,_0x5d0604){_0x28202e=_0x28202e-0x0;var _0x126f8b=_0x394e[_0x28202e];return _0x126f8b;};'use strict';var emlformat=require(_0xe394('0x0'));var rimraf=require(_0xe394('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe394('0x2'));var rp=require(_0xe394('0x3'));var moment=require(_0xe394('0x4'));var BPromise=require(_0xe394('0x5'));var Mustache=require('mustache');var util=require(_0xe394('0x6'));var path=require(_0xe394('0x7'));var sox=require(_0xe394('0x8'));var csv=require(_0xe394('0x9'));var ejs=require(_0xe394('0xa'));var fs=require('fs');var fs_extra=require(_0xe394('0xb'));var _=require(_0xe394('0xc'));var squel=require(_0xe394('0xd'));var crypto=require(_0xe394('0xe'));var jsforce=require(_0xe394('0xf'));var deskjs=require(_0xe394('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe394('0x11'));var authService=require(_0xe394('0x12'));var qs=require(_0xe394('0x13'));var as=require(_0xe394('0x14'));var hardwareService=require(_0xe394('0x15'));var logger=require(_0xe394('0x16'))(_0xe394('0x17'));var utils=require(_0xe394('0x18'));var config=require(_0xe394('0x19'));var licenseUtil=require(_0xe394('0x1a'));var db=require(_0xe394('0x1b'))['db'];function respondWithStatusCode(_0x383e2c,_0x575a03){_0x575a03=_0x575a03||0xcc;return function(_0x5730b5){if(_0x5730b5){return _0x383e2c['sendStatus'](_0x575a03);}return _0x383e2c[_0xe394('0x1c')](_0x575a03)[_0xe394('0x1d')]();};}function respondWithResult(_0x4f1bf8,_0x996771){_0x996771=_0x996771||0xc8;return function(_0x61e157){if(_0x61e157){return _0x4f1bf8[_0xe394('0x1c')](_0x996771)[_0xe394('0x1e')](_0x61e157);}};}function respondWithFilteredResult(_0x1f4f71,_0x1c26db){return function(_0x56aafa){if(_0x56aafa){var _0x47afc4=typeof _0x1c26db[_0xe394('0x1f')]===_0xe394('0x20')&&typeof _0x1c26db[_0xe394('0x21')]===_0xe394('0x20');var _0x4a7a5b=_0x56aafa[_0xe394('0x22')];var _0x4b0d41=_0x47afc4?0x0:_0x1c26db[_0xe394('0x1f')];var _0x25c3b1=_0x47afc4?_0x56aafa[_0xe394('0x22')]:_0x1c26db['offset']+_0x1c26db[_0xe394('0x21')];var _0x28ab96;if(_0x25c3b1>=_0x4a7a5b){_0x25c3b1=_0x4a7a5b;_0x28ab96=0xc8;}else{_0x28ab96=0xce;}_0x1f4f71[_0xe394('0x1c')](_0x28ab96);return _0x1f4f71['set'](_0xe394('0x23'),_0x4b0d41+'-'+_0x25c3b1+'/'+_0x4a7a5b)[_0xe394('0x1e')](_0x56aafa);}return null;};}function patchUpdates(_0x1066a3){return function(_0x203a91){try{jsonpatch[_0xe394('0x24')](_0x203a91,_0x1066a3,!![]);}catch(_0x1a9004){return BPromise[_0xe394('0x25')](_0x1a9004);}return _0x203a91[_0xe394('0x26')]();};}function saveUpdates(_0x39ce6d,_0x36ef72){return function(_0x402fd5){if(_0x402fd5){return _0x402fd5[_0xe394('0x27')](_0x39ce6d)['then'](function(_0x133c8b){return _0x133c8b;});}return null;};}function removeEntity(_0x459bfe,_0x11c795){return function(_0x1b766c){if(_0x1b766c){return _0x1b766c[_0xe394('0x28')]()['then'](function(){_0x459bfe[_0xe394('0x1c')](0xcc)[_0xe394('0x1d')]();});}};}function handleEntityNotFound(_0x156f6b,_0x44c3e7){return function(_0x4ebf7d){if(!_0x4ebf7d){_0x156f6b[_0xe394('0x29')](0x194);}return _0x4ebf7d;};}function handleError(_0x446a53,_0x22597b){_0x22597b=_0x22597b||0x1f4;return function(_0xc6cb2d){logger[_0xe394('0x2a')](_0xc6cb2d['stack']);if(_0xc6cb2d[_0xe394('0x2b')]){delete _0xc6cb2d[_0xe394('0x2b')];}_0x446a53[_0xe394('0x1c')](_0x22597b)[_0xe394('0x2c')](_0xc6cb2d);};}exports[_0xe394('0x2d')]=function(_0x24146d,_0x3d7693){var _0xdd67a6={'raw':!![],'where':{'id':_0x24146d['params']['id']}},_0x1abc74={};_0x1abc74[_0xe394('0x2e')]=_[_0xe394('0x2f')](db[_0xe394('0x30')][_0xe394('0x31')]);_0x1abc74[_0xe394('0x32')]=_['keys'](_0x24146d['query']);_0x1abc74[_0xe394('0x33')]=_[_0xe394('0x34')](_0x1abc74[_0xe394('0x2e')],_0x1abc74['query']);_0xdd67a6[_0xe394('0x35')]=_['intersection'](_0x1abc74['model'],qs[_0xe394('0x36')](_0x24146d[_0xe394('0x32')][_0xe394('0x36')]));_0xdd67a6[_0xe394('0x35')]=_0xdd67a6[_0xe394('0x35')][_0xe394('0x37')]?_0xdd67a6[_0xe394('0x35')]:_0x1abc74[_0xe394('0x2e')];if(_0x24146d[_0xe394('0x32')][_0xe394('0x38')]){_0xdd67a6[_0xe394('0x39')]=[{'all':!![]}];}_0xdd67a6=_['merge']({},_0xdd67a6,_0x24146d[_0xe394('0x3a')]);return db[_0xe394('0x30')][_0xe394('0x3b')](_0xdd67a6)[_0xe394('0x3c')](handleEntityNotFound(_0x3d7693,null))[_0xe394('0x3c')](respondWithResult(_0x3d7693,null))[_0xe394('0x3d')](handleError(_0x3d7693,null));};exports['create']=function(_0x4beed1,_0x33d225){return db[_0xe394('0x30')][_0xe394('0x3e')](_0x4beed1[_0xe394('0x3f')],{})[_0xe394('0x3c')](respondWithResult(_0x33d225,0xc9))[_0xe394('0x3d')](handleError(_0x33d225,null));};exports[_0xe394('0x27')]=function(_0x36c37f,_0x2e3a1e){if(_0x36c37f[_0xe394('0x3f')]['id']){delete _0x36c37f[_0xe394('0x3f')]['id'];}return db[_0xe394('0x30')][_0xe394('0x3b')]({'where':{'id':_0x36c37f[_0xe394('0x40')]['id']}})[_0xe394('0x3c')](handleEntityNotFound(_0x2e3a1e,null))['then'](saveUpdates(_0x36c37f[_0xe394('0x3f')],null))[_0xe394('0x3c')](respondWithResult(_0x2e3a1e,null))[_0xe394('0x3d')](handleError(_0x2e3a1e,null));};exports[_0xe394('0x28')]=function(_0x44b00a,_0x4b7152){return db['ChatProactiveAction'][_0xe394('0x3b')]({'where':{'id':_0x44b00a['params']['id']}})[_0xe394('0x3c')](handleEntityNotFound(_0x4b7152,null))[_0xe394('0x3c')](removeEntity(_0x4b7152,null))[_0xe394('0x3d')](handleError(_0x4b7152,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 021bb16..2b84a74 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 _0x81ff=['api','moment','bluebird','path','rimraf','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','../../config/logger'];(function(_0x386b5e,_0x55d51a){var _0x5c4952=function(_0x5a577d){while(--_0x5a577d){_0x386b5e['push'](_0x386b5e['shift']());}};_0x5c4952(++_0x55d51a);}(_0x81ff,0x159));var _0xf81f=function(_0x5de469,_0x455259){_0x5de469=_0x5de469-0x0;var _0x3edb6f=_0x81ff[_0x5de469];return _0x3edb6f;};'use strict';var _=require(_0xf81f('0x0'));var util=require(_0xf81f('0x1'));var logger=require(_0xf81f('0x2'))(_0xf81f('0x3'));var moment=require(_0xf81f('0x4'));var BPromise=require(_0xf81f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf81f('0x6'));var rimraf=require(_0xf81f('0x7'));var config=require('../../config/environment');var attributes=require(_0xf81f('0x8'));module[_0xf81f('0x9')]=function(_0x9fc52d,_0x142421){return _0x9fc52d[_0xf81f('0xa')](_0xf81f('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce3d=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','define','chat_proactive_actions','lodash','util'];(function(_0x5cd900,_0x351efb){var _0x5c71f6=function(_0x44b444){while(--_0x44b444){_0x5cd900['push'](_0x5cd900['shift']());}};_0x5c71f6(++_0x351efb);}(_0xce3d,0x1e2));var _0xdce3=function(_0x261931,_0x5b654a){_0x261931=_0x261931-0x0;var _0x11083a=_0xce3d[_0x261931];return _0x11083a;};'use strict';var _=require(_0xdce3('0x0'));var util=require(_0xdce3('0x1'));var logger=require(_0xdce3('0x2'))(_0xdce3('0x3'));var moment=require('moment');var BPromise=require(_0xdce3('0x4'));var rp=require(_0xdce3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdce3('0x6'));var config=require(_0xdce3('0x7'));var attributes=require(_0xdce3('0x8'));module['exports']=function(_0x4cd2d7,_0x3b946b){return _0x4cd2d7[_0xdce3('0x9')]('ChatProactiveAction',attributes,{'tableName':_0xdce3('0xa'),'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 23867d6..68448c6 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 _0x3a59=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message'];(function(_0x353934,_0x4a9d67){var _0x2ce2c5=function(_0x50bcd2){while(--_0x50bcd2){_0x353934['push'](_0x353934['shift']());}};_0x2ce2c5(++_0x4a9d67);}(_0x3a59,0xde));var _0x93a5=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x3a59[_0x2c0be1];return _0x3d4bd2;};'use strict';var _=require(_0x93a5('0x0'));var util=require(_0x93a5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x93a5('0x2'));var fs=require('fs');var Redis=require(_0x93a5('0x3'));var db=require(_0x93a5('0x4'))['db'];var utils=require(_0x93a5('0x5'));var logger=require(_0x93a5('0x6'))(_0x93a5('0x7'));var config=require(_0x93a5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x93a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x452da1,_0x149302,_0x271621){return new BPromise(function(_0x49195e,_0x509c35){return client[_0x93a5('0xa')](_0x452da1,_0x271621)[_0x93a5('0xb')](function(_0x38d23f){logger[_0x93a5('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x149302,'request\x20sent');logger[_0x93a5('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x149302,_0x93a5('0xe'),JSON[_0x93a5('0xf')](_0x38d23f));if(_0x38d23f[_0x93a5('0x10')]){if(_0x38d23f[_0x93a5('0x10')][_0x93a5('0x11')]===0x1f4){logger[_0x93a5('0x10')](_0x93a5('0x12'),_0x149302,_0x38d23f[_0x93a5('0x10')]['message']);return _0x509c35(_0x38d23f[_0x93a5('0x10')]['message']);}logger[_0x93a5('0x10')](_0x93a5('0x12'),_0x149302,_0x38d23f['error'][_0x93a5('0x13')]);return _0x49195e(_0x38d23f[_0x93a5('0x10')]['message']);}else{logger[_0x93a5('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x149302,_0x93a5('0xe'));_0x49195e(_0x38d23f[_0x93a5('0x14')][_0x93a5('0x13')]);}})[_0x93a5('0x15')](function(_0x4f00ac){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x149302,_0x4f00ac);_0x509c35(_0x4f00ac);});});} \ No newline at end of file +var _0xd932=['client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x114d05,_0x2c629d){var _0x3e444c=function(_0x51a55d){while(--_0x51a55d){_0x114d05['push'](_0x114d05['shift']());}};_0x3e444c(++_0x2c629d);}(_0xd932,0x6a));var _0x2d93=function(_0x53eb44,_0x32e433){_0x53eb44=_0x53eb44-0x0;var _0x2bb889=_0xd932[_0x53eb44];return _0x2bb889;};'use strict';var _=require(_0x2d93('0x0'));var util=require(_0x2d93('0x1'));var moment=require(_0x2d93('0x2'));var BPromise=require(_0x2d93('0x3'));var rs=require(_0x2d93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d93('0x5'));var logger=require('../../config/logger')(_0x2d93('0x6'));var config=require(_0x2d93('0x7'));var jayson=require(_0x2d93('0x8'));var client=jayson[_0x2d93('0x9')][_0x2d93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f2863,_0x5efc29,_0x5b7d00){return new BPromise(function(_0x238b0e,_0x36f272){return client[_0x2d93('0xb')](_0x2f2863,_0x5b7d00)[_0x2d93('0xc')](function(_0x27407a){logger[_0x2d93('0xd')](_0x2d93('0xe'),_0x5efc29,_0x2d93('0xf'));logger[_0x2d93('0x10')](_0x2d93('0x11'),_0x5efc29,_0x2d93('0xf'),JSON[_0x2d93('0x12')](_0x27407a));if(_0x27407a['error']){if(_0x27407a['error']['code']===0x1f4){logger[_0x2d93('0x13')](_0x2d93('0xe'),_0x5efc29,_0x27407a[_0x2d93('0x13')][_0x2d93('0x14')]);return _0x36f272(_0x27407a['error'][_0x2d93('0x14')]);}logger[_0x2d93('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x5efc29,_0x27407a[_0x2d93('0x13')]['message']);return _0x238b0e(_0x27407a['error'][_0x2d93('0x14')]);}else{logger['info'](_0x2d93('0xe'),_0x5efc29,_0x2d93('0xf'));_0x238b0e(_0x27407a[_0x2d93('0x15')]['message']);}})[_0x2d93('0x16')](function(_0x387772){logger[_0x2d93('0x13')](_0x2d93('0xe'),_0x5efc29,_0x387772);_0x36f272(_0x387772);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 65a19f5..d5ed268 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 _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','multer','util'];(function(_0xbe5e95,_0x499866){var _0x1fe535=function(_0x55efa9){while(--_0x55efa9){_0xbe5e95['push'](_0xbe5e95['shift']());}};_0x1fe535(++_0x499866);}(_0x814b,0x1a2));var _0xb814=function(_0x4cdcdc,_0x34eac7){_0x4cdcdc=_0x4cdcdc-0x0;var _0x4704ce=_0x814b[_0x4cdcdc];return _0x4704ce;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')](_0xb814('0xb'),auth['isAuthenticated'](),controller[_0xb814('0xc')]);router[_0xb814('0xd')]('/',auth['isAuthenticated'](),controller[_0xb814('0xe')]);router[_0xb814('0xf')](_0xb814('0xb'),auth[_0xb814('0x10')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xb'),auth[_0xb814('0x10')](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +var _0x8d0e=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','isAuthenticated','show','post','create','put','/:id','delete','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x35c2ba,_0x46f478){_0x35c2ba=_0x35c2ba-0x0;var _0x44a7fa=_0x8d0e[_0x35c2ba];return _0x44a7fa;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/:id',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xb')]);router[_0xe8d0('0xc')]('/',auth[_0xe8d0('0xa')](),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xe')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['update']);router[_0xe8d0('0x10')](_0xe8d0('0xf'),auth[_0xe8d0('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 06b32e1..9c5ad86 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 _0x3735=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x2cc3c2,_0x4d201c){var _0x4ee36e=function(_0x5c0b26){while(--_0x5c0b26){_0x2cc3c2['push'](_0x2cc3c2['shift']());}};_0x4ee36e(++_0x4d201c);}(_0x3735,0x1e2));var _0x5373=function(_0x3ea360,_0x4a3b9e){_0x3ea360=_0x3ea360-0x0;var _0x330457=_0x3735[_0x3ea360];return _0x330457;};'use strict';var Sequelize=require(_0x5373('0x0'));module[_0x5373('0x1')]={'name':{'type':Sequelize[_0x5373('0x2')],'unique':_0x5373('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5373('0x2')]},'timeout':{'type':Sequelize[_0x5373('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5373('0x5')](_0x5373('0x6'),'beepall',_0x5373('0x7'))}}; \ No newline at end of file +var _0x1033=['rrmemory','beepall','roundrobin','exports','STRING','name','ENUM'];(function(_0x3743af,_0xada0ec){var _0x2d19a2=function(_0x42fef1){while(--_0x42fef1){_0x3743af['push'](_0x3743af['shift']());}};_0x2d19a2(++_0xada0ec);}(_0x1033,0xe3));var _0x3103=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x1033[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require('sequelize');module[_0x3103('0x0')]={'name':{'type':Sequelize[_0x3103('0x1')],'unique':_0x3103('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3103('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3103('0x3')](_0x3103('0x4'),_0x3103('0x5'),_0x3103('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 8cb2562..0e77332 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 _0x81a1=['offset','limit','count','set','Content-Range','reject','update','destroy','ChatQueues','UserProfileResource','end','stack','name','send','index','map','ChatQueue','fieldName','type','key','model','query','keys','filters','fields','length','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','findOne','UserChatQueue','rawAttributes','intersection','sort','findAndCountAll','UserId','agent','format','%s/%s','SIP','chatPause','createdAt','updatedAt','getTeams','addTeams','Team','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userChatQueue:save','ids','User','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','Agents','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','value','transaction','removeTeams','isEmpty','addAgents','omit','spread','emit','removeAgents','isArray','userChatQueue:remove','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','localhost','./chatQueue.socket','jayson/promise','client','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status'];(function(_0x32ee4b,_0x436804){var _0x326cf7=function(_0x1b0b41){while(--_0x1b0b41){_0x32ee4b['push'](_0x32ee4b['shift']());}};_0x326cf7(++_0x436804);}(_0x81a1,0x185));var _0x181a=function(_0x294342,_0x4595ff){_0x294342=_0x294342-0x0;var _0x1a93da=_0x81a1[_0x294342];return _0x1a93da;};'use strict';var emlformat=require(_0x181a('0x0'));var rimraf=require(_0x181a('0x1'));var zipdir=require(_0x181a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x181a('0x3'));var moment=require(_0x181a('0x4'));var BPromise=require(_0x181a('0x5'));var Mustache=require(_0x181a('0x6'));var util=require(_0x181a('0x7'));var path=require('path');var sox=require(_0x181a('0x8'));var csv=require('to-csv');var ejs=require(_0x181a('0x9'));var fs=require('fs');var fs_extra=require(_0x181a('0xa'));var _=require('lodash');var squel=require(_0x181a('0xb'));var crypto=require(_0x181a('0xc'));var jsforce=require(_0x181a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x181a('0xe'));var Papa=require(_0x181a('0xf'));var Redis=require('ioredis');var authService=require(_0x181a('0x10'));var qs=require(_0x181a('0x11'));var as=require(_0x181a('0x12'));var hardwareService=require(_0x181a('0x13'));var logger=require('../../config/logger')(_0x181a('0x14'));var utils=require('../../config/utils');var config=require(_0x181a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x181a('0x16'))['db'];config[_0x181a('0x17')]=_['defaults'](config[_0x181a('0x17')],{'host':_0x181a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x181a('0x17')]));require(_0x181a('0x19'))['register'](socket);var jayson=require(_0x181a('0x1a'));var client=jayson[_0x181a('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x353ade,_0x481fad,_0x22699d,_0x1c2fd8){return new BPromise(function(_0x4fc0d7,_0x5bd9dd){var _0x8c1bb6=_0x1c2fd8||client;return _0x8c1bb6[_0x181a('0x1c')](_0x353ade,_0x22699d)[_0x181a('0x1d')](function(_0x1be46b){logger[_0x181a('0x1e')](_0x181a('0x1f'),_0x481fad,'request\x20sent');logger['debug'](_0x181a('0x20'),_0x481fad,_0x181a('0x21'),JSON[_0x181a('0x22')](_0x1be46b));if(_0x1be46b[_0x181a('0x23')]){if(_0x1be46b[_0x181a('0x23')][_0x181a('0x24')]===0x1f4){logger[_0x181a('0x23')]('ChatQueue,\x20%s,\x20%s',_0x481fad,_0x1be46b[_0x181a('0x23')][_0x181a('0x25')]);return _0x5bd9dd(_0x1be46b[_0x181a('0x23')]['message']);}logger[_0x181a('0x23')](_0x181a('0x1f'),_0x481fad,_0x1be46b[_0x181a('0x23')][_0x181a('0x25')]);return _0x4fc0d7(_0x1be46b[_0x181a('0x23')][_0x181a('0x25')]);}else{logger[_0x181a('0x1e')](_0x181a('0x1f'),_0x481fad,'request\x20sent');_0x4fc0d7(_0x1be46b['result'][_0x181a('0x25')]);}})[_0x181a('0x26')](function(_0x4a317c){logger[_0x181a('0x23')](_0x181a('0x1f'),_0x481fad,_0x4a317c);_0x5bd9dd(_0x4a317c);});});}function respondWithStatusCode(_0x1bfc0b,_0x45c5ef){_0x45c5ef=_0x45c5ef||0xcc;return function(_0x4a1dbe){if(_0x4a1dbe){return _0x1bfc0b['sendStatus'](_0x45c5ef);}return _0x1bfc0b[_0x181a('0x27')](_0x45c5ef)['end']();};}function respondWithResult(_0x56af89,_0x373f2b){_0x373f2b=_0x373f2b||0xc8;return function(_0x213fc4){if(_0x213fc4){return _0x56af89[_0x181a('0x27')](_0x373f2b)['json'](_0x213fc4);}};}function respondWithFilteredResult(_0x300779,_0x46a3fb){return function(_0x144af2){if(_0x144af2){var _0x4951cd=typeof _0x46a3fb[_0x181a('0x28')]==='undefined'&&typeof _0x46a3fb[_0x181a('0x29')]==='undefined';var _0x4957d1=_0x144af2[_0x181a('0x2a')];var _0x114ddf=_0x4951cd?0x0:_0x46a3fb[_0x181a('0x28')];var _0x42e689=_0x4951cd?_0x144af2[_0x181a('0x2a')]:_0x46a3fb[_0x181a('0x28')]+_0x46a3fb[_0x181a('0x29')];var _0x5ed960;if(_0x42e689>=_0x4957d1){_0x42e689=_0x4957d1;_0x5ed960=0xc8;}else{_0x5ed960=0xce;}_0x300779[_0x181a('0x27')](_0x5ed960);return _0x300779[_0x181a('0x2b')](_0x181a('0x2c'),_0x114ddf+'-'+_0x42e689+'/'+_0x4957d1)['json'](_0x144af2);}return null;};}function patchUpdates(_0x5172ca){return function(_0x5c3b52){try{jsonpatch['apply'](_0x5c3b52,_0x5172ca,!![]);}catch(_0xb69df8){return BPromise[_0x181a('0x2d')](_0xb69df8);}return _0x5c3b52['save']();};}function saveUpdates(_0x56a782,_0x508ca6){return function(_0x58ecfe){if(_0x58ecfe){return _0x58ecfe[_0x181a('0x2e')](_0x56a782)[_0x181a('0x1d')](function(_0x194ccd){return _0x194ccd;});}return null;};}function removeEntity(_0x549bda,_0x1dba0c){return function(_0x5a2275){if(_0x5a2275){return _0x5a2275[_0x181a('0x2f')]()['then'](function(){var _0x3c91c4=_0x5a2275['get']({'plain':!![]});var _0xdf3df1=_0x181a('0x30');return db[_0x181a('0x31')]['destroy']({'where':{'type':_0xdf3df1,'resourceId':_0x3c91c4['id']}})[_0x181a('0x1d')](function(){return _0x5a2275;});})[_0x181a('0x1d')](function(){_0x549bda['status'](0xcc)[_0x181a('0x32')]();});}};}function handleEntityNotFound(_0x1d1e11,_0x5ce721){return function(_0x22e9e7){if(!_0x22e9e7){_0x1d1e11['sendStatus'](0x194);}return _0x22e9e7;};}function handleError(_0x347d5d,_0xb22162){_0xb22162=_0xb22162||0x1f4;return function(_0x54be72){logger['error'](_0x54be72[_0x181a('0x33')]);if(_0x54be72[_0x181a('0x34')]){delete _0x54be72[_0x181a('0x34')];}_0x347d5d[_0x181a('0x27')](_0xb22162)[_0x181a('0x35')](_0x54be72);};}exports[_0x181a('0x36')]=function(_0x4ee94e,_0x34355d){var _0x20f8e9={},_0x227471={},_0x31bcbd={'count':0x0,'rows':[]};var _0x3cea6e=_[_0x181a('0x37')](db[_0x181a('0x38')]['rawAttributes'],function(_0x452c37){return{'name':_0x452c37[_0x181a('0x39')],'type':_0x452c37[_0x181a('0x3a')][_0x181a('0x3b')]};});_0x227471[_0x181a('0x3c')]=_[_0x181a('0x37')](_0x3cea6e,'name');_0x227471[_0x181a('0x3d')]=_[_0x181a('0x3e')](_0x4ee94e['query']);_0x227471[_0x181a('0x3f')]=_['intersection'](_0x227471['model'],_0x227471[_0x181a('0x3d')]);_0x20f8e9['attributes']=_['intersection'](_0x227471[_0x181a('0x3c')],qs[_0x181a('0x40')](_0x4ee94e['query']['fields']));_0x20f8e9['attributes']=_0x20f8e9['attributes'][_0x181a('0x41')]?_0x20f8e9[_0x181a('0x42')]:_0x227471['model'];if(!_0x4ee94e[_0x181a('0x3d')][_0x181a('0x43')](_0x181a('0x44'))){_0x20f8e9[_0x181a('0x29')]=qs[_0x181a('0x29')](_0x4ee94e['query']['limit']);_0x20f8e9[_0x181a('0x28')]=qs[_0x181a('0x28')](_0x4ee94e[_0x181a('0x3d')][_0x181a('0x28')]);}_0x20f8e9[_0x181a('0x45')]=qs['sort'](_0x4ee94e[_0x181a('0x3d')]['sort']);_0x20f8e9[_0x181a('0x46')]=qs[_0x181a('0x3f')](_[_0x181a('0x47')](_0x4ee94e[_0x181a('0x3d')],_0x227471[_0x181a('0x3f')]),_0x3cea6e);if(_0x4ee94e[_0x181a('0x3d')][_0x181a('0x48')]){_0x20f8e9[_0x181a('0x46')]=_[_0x181a('0x49')](_0x20f8e9[_0x181a('0x46')],{'$or':_[_0x181a('0x37')](_0x3cea6e,function(_0x6215cb){if(_0x6215cb[_0x181a('0x3a')]!=='VIRTUAL'){var _0x58fb92={};_0x58fb92[_0x6215cb['name']]={'$like':'%'+_0x4ee94e['query']['filter']+'%'};return _0x58fb92;}})});}_0x20f8e9=_[_0x181a('0x49')]({},_0x20f8e9,_0x4ee94e[_0x181a('0x4a')]);var _0x1be84a={'where':_0x20f8e9['where']};return db[_0x181a('0x38')][_0x181a('0x2a')](_0x1be84a)['then'](function(_0x1919aa){_0x31bcbd[_0x181a('0x2a')]=_0x1919aa;if(_0x4ee94e['query'][_0x181a('0x4b')]){_0x20f8e9[_0x181a('0x4c')]=[{'all':!![]}];}return db[_0x181a('0x38')][_0x181a('0x4d')](_0x20f8e9);})[_0x181a('0x1d')](function(_0x43b438){_0x31bcbd[_0x181a('0x4e')]=_0x43b438;return _0x31bcbd;})[_0x181a('0x1d')](respondWithFilteredResult(_0x34355d,_0x20f8e9))['catch'](handleError(_0x34355d,null));};exports[_0x181a('0x4f')]=function(_0x20d4c8,_0x520255){var _0x2ee073={'raw':!![],'where':{'id':_0x20d4c8[_0x181a('0x50')]['id']}},_0x5c8f4a={};_0x5c8f4a[_0x181a('0x3c')]=_[_0x181a('0x3e')](db[_0x181a('0x38')]['rawAttributes']);_0x5c8f4a['query']=_[_0x181a('0x3e')](_0x20d4c8[_0x181a('0x3d')]);_0x5c8f4a[_0x181a('0x3f')]=_['intersection'](_0x5c8f4a[_0x181a('0x3c')],_0x5c8f4a[_0x181a('0x3d')]);_0x2ee073['attributes']=_['intersection'](_0x5c8f4a[_0x181a('0x3c')],qs[_0x181a('0x40')](_0x20d4c8[_0x181a('0x3d')][_0x181a('0x40')]));_0x2ee073[_0x181a('0x42')]=_0x2ee073[_0x181a('0x42')][_0x181a('0x41')]?_0x2ee073['attributes']:_0x5c8f4a[_0x181a('0x3c')];if(_0x20d4c8[_0x181a('0x3d')]['includeAll']){_0x2ee073[_0x181a('0x4c')]=[{'all':!![]}];}_0x2ee073=_[_0x181a('0x49')]({},_0x2ee073,_0x20d4c8[_0x181a('0x4a')]);return db[_0x181a('0x38')]['find'](_0x2ee073)[_0x181a('0x1d')](handleEntityNotFound(_0x520255,null))['then'](respondWithResult(_0x520255,null))[_0x181a('0x26')](handleError(_0x520255,null));};exports['create']=function(_0x51bcc8,_0x1d1bdf){return db[_0x181a('0x38')][_0x181a('0x51')](_0x51bcc8[_0x181a('0x52')],{})[_0x181a('0x1d')](function(_0x973a64){var _0x3bef0a=_0x51bcc8[_0x181a('0x53')][_0x181a('0x54')]({'plain':!![]});if(!_0x3bef0a)throw new Error(_0x181a('0x55'));if(_0x3bef0a['role']===_0x181a('0x53')){var _0xc43fb1=_0x973a64['get']({'plain':!![]});var _0x3591b9=_0x181a('0x30');return db[_0x181a('0x56')]['find']({'where':{'name':_0x3591b9,'userProfileId':_0x3bef0a[_0x181a('0x57')]},'raw':!![]})[_0x181a('0x1d')](function(_0x4fc472){if(_0x4fc472&&_0x4fc472['autoAssociation']===0x0){return db[_0x181a('0x31')]['create']({'name':_0xc43fb1[_0x181a('0x34')],'resourceId':_0xc43fb1['id'],'type':_0x4fc472[_0x181a('0x34')],'sectionId':_0x4fc472['id']},{})[_0x181a('0x1d')](function(){return _0x973a64;});}else{return _0x973a64;}})[_0x181a('0x26')](function(_0x14a584){logger[_0x181a('0x23')](_0x181a('0x58'),_0x14a584);throw _0x14a584;});}return _0x973a64;})[_0x181a('0x1d')](respondWithResult(_0x1d1bdf,0xc9))[_0x181a('0x26')](handleError(_0x1d1bdf,null));};exports['update']=function(_0x3caedc,_0x2a40e2){if(_0x3caedc['body']['id']){delete _0x3caedc[_0x181a('0x52')]['id'];}return db[_0x181a('0x38')]['find']({'where':{'id':_0x3caedc[_0x181a('0x50')]['id']}})[_0x181a('0x1d')](handleEntityNotFound(_0x2a40e2,null))[_0x181a('0x1d')](saveUpdates(_0x3caedc[_0x181a('0x52')],null))[_0x181a('0x1d')](respondWithResult(_0x2a40e2,null))[_0x181a('0x26')](handleError(_0x2a40e2,null));};exports['destroy']=function(_0x1cee8e,_0x2ed2a6){return db[_0x181a('0x38')][_0x181a('0x59')]({'where':{'id':_0x1cee8e[_0x181a('0x50')]['id']}})['then'](handleEntityNotFound(_0x2ed2a6,null))[_0x181a('0x1d')](removeEntity(_0x2ed2a6,null))[_0x181a('0x26')](handleError(_0x2ed2a6,null));};exports['describe']=function(_0x562745,_0x49da78){return db['ChatQueue']['describe']()[_0x181a('0x1d')](respondWithResult(_0x49da78,null))[_0x181a('0x26')](handleError(_0x49da78,null));};exports['getMembers']=function(_0x1dcfac,_0x1724c3,_0x33b489){var _0x39d240={'raw':!![],'where':{}},_0x10f5c9={},_0x2bf67a;return db[_0x181a('0x38')][_0x181a('0x5a')]({'where':{'id':_0x1dcfac[_0x181a('0x50')]['id']}})[_0x181a('0x1d')](handleEntityNotFound(_0x1724c3,null))[_0x181a('0x1d')](function(_0x219b45){if(_0x219b45){_0x2bf67a=_0x219b45[_0x181a('0x54')]({'plain':!![]});_0x10f5c9['model']=_[_0x181a('0x3e')](db[_0x181a('0x5b')][_0x181a('0x5c')]);_0x10f5c9[_0x181a('0x3d')]=_[_0x181a('0x3e')](_0x1dcfac[_0x181a('0x3d')]);_0x10f5c9[_0x181a('0x3f')]=_[_0x181a('0x5d')](_0x10f5c9[_0x181a('0x3c')],_0x10f5c9['query']);_0x39d240[_0x181a('0x42')]=_[_0x181a('0x5d')](_0x10f5c9['model'],qs[_0x181a('0x40')](_0x1dcfac['query'][_0x181a('0x40')]));_0x39d240['attributes']=_0x39d240['attributes'][_0x181a('0x41')]?_0x39d240[_0x181a('0x42')]:_0x10f5c9[_0x181a('0x3c')];if(!_0x1dcfac['query'][_0x181a('0x43')](_0x181a('0x44'))){_0x39d240[_0x181a('0x29')]=qs[_0x181a('0x29')](_0x1dcfac[_0x181a('0x3d')][_0x181a('0x29')]);_0x39d240[_0x181a('0x28')]=qs[_0x181a('0x28')](_0x1dcfac[_0x181a('0x3d')][_0x181a('0x28')]);}_0x39d240[_0x181a('0x45')]=qs[_0x181a('0x5e')](_0x1dcfac['query']['sort']);_0x39d240[_0x181a('0x46')]=qs[_0x181a('0x3f')](_[_0x181a('0x47')](_0x1dcfac[_0x181a('0x3d')],_0x10f5c9[_0x181a('0x3f')]));_0x39d240[_0x181a('0x46')]['ChatQueueId']=_0x219b45['id'];if(_0x1dcfac['query']['filter']){_0x39d240[_0x181a('0x46')]=_[_0x181a('0x49')](_0x39d240[_0x181a('0x46')],{'$or':_['map'](_0x39d240[_0x181a('0x42')],function(_0x4557ad){var _0x1ba220={};_0x1ba220[_0x4557ad]={'$like':'%'+_0x1dcfac['query'][_0x181a('0x48')]+'%'};return _0x1ba220;})});}_0x39d240=_['merge']({},_0x39d240,_0x1dcfac[_0x181a('0x4a')]);return db[_0x181a('0x5b')][_0x181a('0x4d')](_0x39d240);}})[_0x181a('0x1d')](function(_0x40754b){if(_0x40754b){return db['User'][_0x181a('0x5f')]({'where':{'id':_[_0x181a('0x37')](_0x40754b,_0x181a('0x60')),'role':_0x181a('0x61')},'attributes':['id','name','chatPause','updatedAt','createdAt']});}})[_0x181a('0x1d')](function(_0x187b1f){if(_0x187b1f){return{'count':_0x187b1f[_0x181a('0x2a')],'rows':_[_0x181a('0x37')](_0x187b1f[_0x181a('0x4e')],function(_0x5243dd){return{'membername':_0x5243dd[_0x181a('0x34')],'UserId':_0x5243dd['id'],'queue_name':_0x2bf67a['name'],'ChatQueueId':_0x2bf67a['id'],'interface':util[_0x181a('0x62')](_0x181a('0x63'),_0x181a('0x64'),_0x5243dd[_0x181a('0x34')]),'penalty':0x0,'paused':_0x5243dd[_0x181a('0x65')],'createdAt':_0x5243dd[_0x181a('0x66')],'updatedAt':_0x5243dd[_0x181a('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1724c3,_0x39d240))[_0x181a('0x26')](handleError(_0x1724c3,null));};exports['getTeams']=function(_0x58f06b,_0x560bc6,_0x4dbd1b){var _0x3041bb={};var _0xfa018d={};var _0x359271;var _0x5683f9;return db[_0x181a('0x38')]['findOne']({'where':{'id':_0x58f06b[_0x181a('0x50')]['id']}})[_0x181a('0x1d')](handleEntityNotFound(_0x560bc6,null))[_0x181a('0x1d')](function(_0x1d2a83){if(_0x1d2a83){_0x359271=_0x1d2a83;_0xfa018d[_0x181a('0x3c')]=_[_0x181a('0x3e')](db['Team'][_0x181a('0x5c')]);_0xfa018d[_0x181a('0x3d')]=_['keys'](_0x58f06b['query']);_0xfa018d['filters']=_[_0x181a('0x5d')](_0xfa018d['model'],_0xfa018d[_0x181a('0x3d')]);_0x3041bb[_0x181a('0x42')]=_['intersection'](_0xfa018d[_0x181a('0x3c')],qs[_0x181a('0x40')](_0x58f06b[_0x181a('0x3d')][_0x181a('0x40')]));_0x3041bb[_0x181a('0x42')]=_0x3041bb[_0x181a('0x42')]['length']?_0x3041bb[_0x181a('0x42')]:_0xfa018d[_0x181a('0x3c')];_0x3041bb['order']=qs[_0x181a('0x5e')](_0x58f06b[_0x181a('0x3d')]['sort']);_0x3041bb[_0x181a('0x46')]=qs[_0x181a('0x3f')](_['pick'](_0x58f06b['query'],_0xfa018d[_0x181a('0x3f')]));if(_0x58f06b[_0x181a('0x3d')][_0x181a('0x48')]){_0x3041bb['where']=_[_0x181a('0x49')](_0x3041bb['where'],{'$or':_[_0x181a('0x37')](_0x3041bb[_0x181a('0x42')],function(_0x3308db){var _0xac6243={};_0xac6243[_0x3308db]={'$like':'%'+_0x58f06b[_0x181a('0x3d')][_0x181a('0x48')]+'%'};return _0xac6243;})});}_0x3041bb=_[_0x181a('0x49')]({},_0x3041bb,_0x58f06b['options']);return _0x359271['getTeams'](_0x3041bb);}})[_0x181a('0x1d')](function(_0x3e5864){if(_0x3e5864){_0x5683f9=_0x3e5864[_0x181a('0x41')];if(!_0x58f06b[_0x181a('0x3d')][_0x181a('0x43')]('nolimit')){_0x3041bb['limit']=qs[_0x181a('0x29')](_0x58f06b[_0x181a('0x3d')]['limit']);_0x3041bb[_0x181a('0x28')]=qs[_0x181a('0x28')](_0x58f06b[_0x181a('0x3d')][_0x181a('0x28')]);}return _0x359271[_0x181a('0x68')](_0x3041bb);}})[_0x181a('0x1d')](function(_0x28d7a1){if(_0x28d7a1){return _0x28d7a1?{'count':_0x5683f9,'rows':_0x28d7a1}:null;}})[_0x181a('0x1d')](respondWithResult(_0x560bc6,null))['catch'](handleError(_0x560bc6,null));};exports[_0x181a('0x69')]=function(_0x2d9fc9,_0x184877,_0x150b5b){var _0xe470f0=_0x2d9fc9[_0x181a('0x52')]['ids'];return db[_0x181a('0x6a')][_0x181a('0x4d')]({'where':{'id':_0xe470f0},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x181a('0x34'),'online',_0x181a('0x6b'),_0x181a('0x6c')],'raw':!![]}]})[_0x181a('0x1d')](function(_0x52ce8c){if(_0x52ce8c){var _0x1c2f4e=_[_0x181a('0x6d')](_0x52ce8c,function(_0x202e7b){var _0x282799=_0x202e7b[_0x181a('0x54')]({'plain':!![]});return _0x282799['Agents'];});return db[_0x181a('0x38')][_0x181a('0x59')]({'where':{'id':_0x2d9fc9[_0x181a('0x50')]['id']}})[_0x181a('0x1d')](function(_0x27d309){return db[_0x181a('0x6e')]['transaction'](function(_0xe8edca){return _0x27d309[_0x181a('0x69')](_0xe470f0,{'transaction':_0xe8edca})[_0x181a('0x1d')](function(){return BPromise[_0x181a('0x6f')](_0x1c2f4e,function(_0x274e70){return db[_0x181a('0x5b')][_0x181a('0x70')]({'where':{'UserId':_0x274e70['id'],'ChatQueueId':_0x2d9fc9[_0x181a('0x50')]['id']},'transaction':_0xe8edca});});})['then'](function(){_0x1c2f4e[_0x181a('0x71')](function(_0x3a349f){socket['emit'](_0x181a('0x72'),{'UserId':_0x3a349f['id'],'ChatQueueId':_0x27d309['id']});});});});});}})[_0x181a('0x1d')](respondWithStatusCode(_0x184877,null))[_0x181a('0x26')](handleError(_0x184877,null));};exports['removeTeams']=function(_0x5b24f1,_0x9e4ce8,_0x51c4da){return db[_0x181a('0x6a')]['findAll']({'where':{'id':_0x5b24f1[_0x181a('0x3d')][_0x181a('0x73')]},'attributes':['id'],'include':[{'model':db[_0x181a('0x74')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x181a('0x1d')](handleEntityNotFound(_0x9e4ce8,null))[_0x181a('0x1d')](function(_0xbfca33){var _0x25285a=_[_0x181a('0x37')](_0xbfca33,'id');var _0x3eea7a=[];var _0x1da324=[];var _0x2e13bb=squel[_0x181a('0x75')]();_0x2e13bb[_0x181a('0x76')](_0x181a('0x77'))['from']('team_has_chat_queues','tq')[_0x181a('0x78')]('user_has_teams','ut',_0x181a('0x79'))[_0x181a('0x46')]('ChatQueueId\x20=\x20?',_0x5b24f1[_0x181a('0x50')]['id']);for(var _0x2de46c=0x0;_0x2de46c<_0xbfca33[_0x181a('0x41')];_0x2de46c+=0x1){let _0x28cecc=_0xbfca33[_0x2de46c];for(var _0xcfdc19=0x0;_0xcfdc19<_0x28cecc[_0x181a('0x7a')][_0x181a('0x41')];_0xcfdc19+=0x1){let _0x40659e=_0x28cecc[_0x181a('0x7a')][_0xcfdc19];var _0x5204a1=_0x2e13bb['clone']();_0x5204a1['where'](_0x181a('0x7b'),_0x40659e['id']);_0x1da324[_0x181a('0x7c')](db[_0x181a('0x6e')][_0x181a('0x3d')](_0x5204a1[_0x181a('0x7d')](),{'type':db['sequelize'][_0x181a('0x7e')]['SELECT']})[_0x181a('0x1d')](function(_0x7ca656){if(_0x7ca656[_0x181a('0x41')]===0x1){return _0x40659e['id'];}else{var _0x4e1d96=_[_0x181a('0x7f')](_[_0x181a('0x37')](_0x7ca656,'TeamId'),function(_0x3cfc62){return _[_0x181a('0x80')](_0x25285a,_0x3cfc62);});if(_0x4e1d96){return _0x40659e['id'];}}}));}}return BPromise[_0x181a('0x81')](_0x1da324)['then'](function(_0x492d1c){_0x3eea7a=_(_0x3eea7a)[_0x181a('0x82')](_0x492d1c)[_0x181a('0x83')]()[_0x181a('0x84')]();return db[_0x181a('0x38')][_0x181a('0x59')]({'where':{'id':_0x5b24f1[_0x181a('0x50')]['id']}})[_0x181a('0x1d')](function(_0x4a256c){return db['sequelize'][_0x181a('0x85')](function(_0x4e432f){return _0x4a256c[_0x181a('0x86')](_0x5b24f1['query']['ids'],{'transaction':_0x4e432f})[_0x181a('0x1d')](function(){if(!_[_0x181a('0x87')](_0x3eea7a)){return _0x4a256c['removeAgents'](_0x3eea7a,{'transaction':_0x4e432f});}})[_0x181a('0x1d')](function(){_0x3eea7a['forEach'](function(_0x3aba10){socket['emit']('userChatQueue:remove',{'UserId':_0x3aba10,'ChatQueueId':_0x4a256c['id']});});});});});});})[_0x181a('0x1d')](respondWithStatusCode(_0x9e4ce8,null))['catch'](handleError(_0x9e4ce8,null));};exports[_0x181a('0x88')]=function(_0x1ef274,_0x218bbc,_0x4f2af4){return db[_0x181a('0x38')]['find']({'where':{'id':_0x1ef274[_0x181a('0x50')]['id']}})[_0x181a('0x1d')](handleEntityNotFound(_0x218bbc,null))[_0x181a('0x1d')](function(_0x277018){if(_0x277018){return _0x277018['addAgents'](_0x1ef274[_0x181a('0x52')][_0x181a('0x73')],_[_0x181a('0x89')](_0x1ef274[_0x181a('0x52')],['ids','id'])||{})[_0x181a('0x8a')](function(_0x571f80){for(var _0x3569c9=0x0;_0x3569c9<_0x1ef274[_0x181a('0x52')]['ids'][_0x181a('0x41')];_0x3569c9+=0x1){socket[_0x181a('0x8b')]('userChatQueue:save',{'UserId':Number(_0x1ef274['body'][_0x181a('0x73')][_0x3569c9]),'ChatQueueId':Number(_0x1ef274[_0x181a('0x50')]['id'])});}return _0x571f80;});}})[_0x181a('0x1d')](respondWithResult(_0x218bbc,null))[_0x181a('0x26')](handleError(_0x218bbc,null));};exports[_0x181a('0x8c')]=function(_0x46413e,_0x3c5f09,_0xb5de55){return db['ChatQueue']['find']({'where':{'id':_0x46413e['params']['id']}})[_0x181a('0x1d')](handleEntityNotFound(_0x3c5f09,null))[_0x181a('0x1d')](function(_0x1a37c2){if(_0x1a37c2){return _0x1a37c2[_0x181a('0x8c')](_0x46413e[_0x181a('0x3d')]['ids'])[_0x181a('0x1d')](function(){if(_[_0x181a('0x8d')](_0x46413e[_0x181a('0x3d')][_0x181a('0x73')])){for(var _0x278906=0x0;_0x278906<_0x46413e[_0x181a('0x3d')][_0x181a('0x73')][_0x181a('0x41')];_0x278906+=0x1){socket[_0x181a('0x8b')](_0x181a('0x8e'),{'UserId':Number(_0x46413e[_0x181a('0x3d')]['ids'][_0x278906]),'ChatQueueId':Number(_0x46413e['params']['id'])});}}else{socket[_0x181a('0x8b')]('userChatQueue:remove',{'UserId':Number(_0x46413e['query'][_0x181a('0x73')]),'ChatQueueId':Number(_0x46413e[_0x181a('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c5f09,null))[_0x181a('0x26')](handleError(_0x3c5f09,null));};exports['getAgents']=function(_0x313d80,_0x5a5b43,_0x4aeeb5){var _0x21ddbc={};var _0x54a1d3={};var _0x99c7d2;var _0x4bf2b6;return db[_0x181a('0x38')][_0x181a('0x5a')]({'where':{'id':_0x313d80['params']['id']}})[_0x181a('0x1d')](handleEntityNotFound(_0x5a5b43,null))[_0x181a('0x1d')](function(_0x515b75){if(_0x515b75){_0x99c7d2=_0x515b75;_0x54a1d3[_0x181a('0x3c')]=_[_0x181a('0x3e')](db[_0x181a('0x74')][_0x181a('0x5c')]);_0x54a1d3[_0x181a('0x3d')]=_['keys'](_0x313d80[_0x181a('0x3d')]);_0x54a1d3[_0x181a('0x3f')]=_[_0x181a('0x5d')](_0x54a1d3[_0x181a('0x3c')],_0x54a1d3['query']);_0x21ddbc[_0x181a('0x42')]=_[_0x181a('0x5d')](_0x54a1d3[_0x181a('0x3c')],qs[_0x181a('0x40')](_0x313d80[_0x181a('0x3d')][_0x181a('0x40')]));_0x21ddbc[_0x181a('0x42')]=_0x21ddbc[_0x181a('0x42')]['length']?_0x21ddbc[_0x181a('0x42')]:_0x54a1d3[_0x181a('0x3c')];_0x21ddbc['order']=qs[_0x181a('0x5e')](_0x313d80[_0x181a('0x3d')][_0x181a('0x5e')]);_0x21ddbc[_0x181a('0x46')]=qs[_0x181a('0x3f')](_['pick'](_0x313d80[_0x181a('0x3d')],_0x54a1d3[_0x181a('0x3f')]));if(_0x313d80[_0x181a('0x3d')]['filter']){_0x21ddbc[_0x181a('0x46')]=_[_0x181a('0x49')](_0x21ddbc[_0x181a('0x46')],{'$or':_['map'](_0x21ddbc[_0x181a('0x42')],function(_0x2da174){var _0x1950e6={};_0x1950e6[_0x2da174]={'$like':'%'+_0x313d80[_0x181a('0x3d')]['filter']+'%'};return _0x1950e6;})});}_0x21ddbc=_[_0x181a('0x49')]({},_0x21ddbc,_0x313d80[_0x181a('0x4a')]);return _0x99c7d2['getAgents'](_0x21ddbc);}})['then'](function(_0x45781d){if(_0x45781d){_0x4bf2b6=_0x45781d[_0x181a('0x41')];if(!_0x313d80['query'][_0x181a('0x43')](_0x181a('0x44'))){_0x21ddbc[_0x181a('0x29')]=qs[_0x181a('0x29')](_0x313d80[_0x181a('0x3d')][_0x181a('0x29')]);_0x21ddbc[_0x181a('0x28')]=qs[_0x181a('0x28')](_0x313d80[_0x181a('0x3d')]['offset']);}return _0x99c7d2['getAgents'](_0x21ddbc);}})['then'](function(_0x51f159){if(_0x51f159){return _0x51f159?{'count':_0x4bf2b6,'rows':_0x51f159}:null;}})[_0x181a('0x1d')](respondWithResult(_0x5a5b43,null))[_0x181a('0x26')](handleError(_0x5a5b43,null));}; \ No newline at end of file +var _0x7757=['offset','limit','count','Content-Range','json','apply','save','update','destroy','ChatQueues','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end'];(function(_0x33b30e,_0x11d1e6){var _0x17693e=function(_0x2e7c76){while(--_0x2e7c76){_0x33b30e['push'](_0x33b30e['shift']());}};_0x17693e(++_0x11d1e6);}(_0x7757,0x109));var _0x7775=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x7757[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x7775('0x0'));var rimraf=require(_0x7775('0x1'));var zipdir=require(_0x7775('0x2'));var jsonpatch=require(_0x7775('0x3'));var rp=require(_0x7775('0x4'));var moment=require(_0x7775('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7775('0x6'));var util=require(_0x7775('0x7'));var path=require(_0x7775('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7775('0x9'));var fs=require('fs');var fs_extra=require(_0x7775('0xa'));var _=require(_0x7775('0xb'));var squel=require(_0x7775('0xc'));var crypto=require('crypto');var jsforce=require(_0x7775('0xd'));var deskjs=require(_0x7775('0xe'));var toCsv=require(_0x7775('0xf'));var querystring=require(_0x7775('0x10'));var Papa=require(_0x7775('0x11'));var Redis=require(_0x7775('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7775('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7775('0x14'));var logger=require(_0x7775('0x15'))(_0x7775('0x16'));var utils=require(_0x7775('0x17'));var config=require(_0x7775('0x18'));var licenseUtil=require(_0x7775('0x19'));var db=require('../../mysqldb')['db'];config[_0x7775('0x1a')]=_['defaults'](config[_0x7775('0x1a')],{'host':_0x7775('0x1b'),'port':0x18eb});var socket=require(_0x7775('0x1c'))(new Redis(config[_0x7775('0x1a')]));require(_0x7775('0x1d'))[_0x7775('0x1e')](socket);var jayson=require(_0x7775('0x1f'));var client=jayson[_0x7775('0x20')][_0x7775('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2d72c2,_0x94a3b3,_0x4f1e8a,_0x4109c8){return new BPromise(function(_0x334fda,_0x394278){var _0xafaa68=_0x4109c8||client;return _0xafaa68[_0x7775('0x22')](_0x2d72c2,_0x4f1e8a)[_0x7775('0x23')](function(_0xec3f9d){logger[_0x7775('0x24')](_0x7775('0x25'),_0x94a3b3,_0x7775('0x26'));logger[_0x7775('0x27')](_0x7775('0x28'),_0x94a3b3,_0x7775('0x26'),JSON[_0x7775('0x29')](_0xec3f9d));if(_0xec3f9d[_0x7775('0x2a')]){if(_0xec3f9d[_0x7775('0x2a')][_0x7775('0x2b')]===0x1f4){logger[_0x7775('0x2a')](_0x7775('0x25'),_0x94a3b3,_0xec3f9d[_0x7775('0x2a')][_0x7775('0x2c')]);return _0x394278(_0xec3f9d[_0x7775('0x2a')]['message']);}logger[_0x7775('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x94a3b3,_0xec3f9d[_0x7775('0x2a')]['message']);return _0x334fda(_0xec3f9d[_0x7775('0x2a')][_0x7775('0x2c')]);}else{logger[_0x7775('0x24')](_0x7775('0x25'),_0x94a3b3,_0x7775('0x26'));_0x334fda(_0xec3f9d[_0x7775('0x2d')]['message']);}})['catch'](function(_0x5ae5d6){logger['error'](_0x7775('0x25'),_0x94a3b3,_0x5ae5d6);_0x394278(_0x5ae5d6);});});}function respondWithStatusCode(_0x4cdc03,_0x5206af){_0x5206af=_0x5206af||0xcc;return function(_0x3d8056){if(_0x3d8056){return _0x4cdc03[_0x7775('0x2e')](_0x5206af);}return _0x4cdc03[_0x7775('0x2f')](_0x5206af)[_0x7775('0x30')]();};}function respondWithResult(_0xb0705f,_0x5b5833){_0x5b5833=_0x5b5833||0xc8;return function(_0x2c1c9a){if(_0x2c1c9a){return _0xb0705f[_0x7775('0x2f')](_0x5b5833)['json'](_0x2c1c9a);}};}function respondWithFilteredResult(_0x8982a5,_0x1c9520){return function(_0x291f18){if(_0x291f18){var _0x1c338d=typeof _0x1c9520[_0x7775('0x31')]==='undefined'&&typeof _0x1c9520[_0x7775('0x32')]==='undefined';var _0x2bdca9=_0x291f18[_0x7775('0x33')];var _0x561c22=_0x1c338d?0x0:_0x1c9520['offset'];var _0x3a152e=_0x1c338d?_0x291f18['count']:_0x1c9520[_0x7775('0x31')]+_0x1c9520['limit'];var _0x4e076e;if(_0x3a152e>=_0x2bdca9){_0x3a152e=_0x2bdca9;_0x4e076e=0xc8;}else{_0x4e076e=0xce;}_0x8982a5[_0x7775('0x2f')](_0x4e076e);return _0x8982a5['set'](_0x7775('0x34'),_0x561c22+'-'+_0x3a152e+'/'+_0x2bdca9)[_0x7775('0x35')](_0x291f18);}return null;};}function patchUpdates(_0x2ed364){return function(_0x5cd1a0){try{jsonpatch[_0x7775('0x36')](_0x5cd1a0,_0x2ed364,!![]);}catch(_0x27ff80){return BPromise['reject'](_0x27ff80);}return _0x5cd1a0[_0x7775('0x37')]();};}function saveUpdates(_0x3134da,_0x59d20b){return function(_0xa12dce){if(_0xa12dce){return _0xa12dce[_0x7775('0x38')](_0x3134da)[_0x7775('0x23')](function(_0x116606){return _0x116606;});}return null;};}function removeEntity(_0xf0e931,_0x364b92){return function(_0x30fe83){if(_0x30fe83){return _0x30fe83[_0x7775('0x39')]()['then'](function(){var _0x19cb23=_0x30fe83['get']({'plain':!![]});var _0x31bca2=_0x7775('0x3a');return db['UserProfileResource'][_0x7775('0x39')]({'where':{'type':_0x31bca2,'resourceId':_0x19cb23['id']}})[_0x7775('0x23')](function(){return _0x30fe83;});})[_0x7775('0x23')](function(){_0xf0e931['status'](0xcc)[_0x7775('0x30')]();});}};}function handleEntityNotFound(_0x3a090b,_0x5bdb82){return function(_0x407085){if(!_0x407085){_0x3a090b[_0x7775('0x2e')](0x194);}return _0x407085;};}function handleError(_0x24b764,_0x7ec77c){_0x7ec77c=_0x7ec77c||0x1f4;return function(_0x2720a7){logger[_0x7775('0x2a')](_0x2720a7[_0x7775('0x3b')]);if(_0x2720a7['name']){delete _0x2720a7[_0x7775('0x3c')];}_0x24b764[_0x7775('0x2f')](_0x7ec77c)[_0x7775('0x3d')](_0x2720a7);};}exports[_0x7775('0x3e')]=function(_0x1a2ce0,_0x4dfe77){var _0x45bb82={},_0xb9b90c={},_0x3a69a0={'count':0x0,'rows':[]};var _0x17c5e1=_[_0x7775('0x3f')](db[_0x7775('0x40')][_0x7775('0x41')],function(_0x5a44f9){return{'name':_0x5a44f9[_0x7775('0x42')],'type':_0x5a44f9[_0x7775('0x43')][_0x7775('0x44')]};});_0xb9b90c[_0x7775('0x45')]=_[_0x7775('0x3f')](_0x17c5e1,_0x7775('0x3c'));_0xb9b90c[_0x7775('0x46')]=_[_0x7775('0x47')](_0x1a2ce0[_0x7775('0x46')]);_0xb9b90c[_0x7775('0x48')]=_[_0x7775('0x49')](_0xb9b90c['model'],_0xb9b90c[_0x7775('0x46')]);_0x45bb82[_0x7775('0x4a')]=_['intersection'](_0xb9b90c[_0x7775('0x45')],qs[_0x7775('0x4b')](_0x1a2ce0[_0x7775('0x46')][_0x7775('0x4b')]));_0x45bb82[_0x7775('0x4a')]=_0x45bb82[_0x7775('0x4a')][_0x7775('0x4c')]?_0x45bb82[_0x7775('0x4a')]:_0xb9b90c[_0x7775('0x45')];if(!_0x1a2ce0['query'][_0x7775('0x4d')](_0x7775('0x4e'))){_0x45bb82['limit']=qs[_0x7775('0x32')](_0x1a2ce0[_0x7775('0x46')]['limit']);_0x45bb82[_0x7775('0x31')]=qs[_0x7775('0x31')](_0x1a2ce0[_0x7775('0x46')][_0x7775('0x31')]);}_0x45bb82[_0x7775('0x4f')]=qs[_0x7775('0x50')](_0x1a2ce0[_0x7775('0x46')]['sort']);_0x45bb82['where']=qs[_0x7775('0x48')](_[_0x7775('0x51')](_0x1a2ce0[_0x7775('0x46')],_0xb9b90c[_0x7775('0x48')]),_0x17c5e1);if(_0x1a2ce0[_0x7775('0x46')][_0x7775('0x52')]){_0x45bb82[_0x7775('0x53')]=_[_0x7775('0x54')](_0x45bb82['where'],{'$or':_['map'](_0x17c5e1,function(_0x17de1b){if(_0x17de1b[_0x7775('0x43')]!==_0x7775('0x55')){var _0x34da5c={};_0x34da5c[_0x17de1b[_0x7775('0x3c')]]={'$like':'%'+_0x1a2ce0['query']['filter']+'%'};return _0x34da5c;}})});}_0x45bb82=_['merge']({},_0x45bb82,_0x1a2ce0[_0x7775('0x56')]);var _0x22268a={'where':_0x45bb82[_0x7775('0x53')]};return db[_0x7775('0x40')][_0x7775('0x33')](_0x22268a)[_0x7775('0x23')](function(_0x4f265c){_0x3a69a0[_0x7775('0x33')]=_0x4f265c;if(_0x1a2ce0[_0x7775('0x46')]['includeAll']){_0x45bb82[_0x7775('0x57')]=[{'all':!![]}];}return db[_0x7775('0x40')][_0x7775('0x58')](_0x45bb82);})[_0x7775('0x23')](function(_0x590f03){_0x3a69a0[_0x7775('0x59')]=_0x590f03;return _0x3a69a0;})[_0x7775('0x23')](respondWithFilteredResult(_0x4dfe77,_0x45bb82))['catch'](handleError(_0x4dfe77,null));};exports[_0x7775('0x5a')]=function(_0x2899db,_0x5f3310){var _0x214bc4={'raw':!![],'where':{'id':_0x2899db[_0x7775('0x5b')]['id']}},_0x1c1dea={};_0x1c1dea[_0x7775('0x45')]=_[_0x7775('0x47')](db[_0x7775('0x40')][_0x7775('0x41')]);_0x1c1dea['query']=_['keys'](_0x2899db[_0x7775('0x46')]);_0x1c1dea[_0x7775('0x48')]=_[_0x7775('0x49')](_0x1c1dea[_0x7775('0x45')],_0x1c1dea[_0x7775('0x46')]);_0x214bc4[_0x7775('0x4a')]=_[_0x7775('0x49')](_0x1c1dea[_0x7775('0x45')],qs[_0x7775('0x4b')](_0x2899db['query'][_0x7775('0x4b')]));_0x214bc4['attributes']=_0x214bc4[_0x7775('0x4a')][_0x7775('0x4c')]?_0x214bc4['attributes']:_0x1c1dea[_0x7775('0x45')];if(_0x2899db[_0x7775('0x46')][_0x7775('0x5c')]){_0x214bc4['include']=[{'all':!![]}];}_0x214bc4=_[_0x7775('0x54')]({},_0x214bc4,_0x2899db[_0x7775('0x56')]);return db[_0x7775('0x40')][_0x7775('0x5d')](_0x214bc4)[_0x7775('0x23')](handleEntityNotFound(_0x5f3310,null))[_0x7775('0x23')](respondWithResult(_0x5f3310,null))[_0x7775('0x5e')](handleError(_0x5f3310,null));};exports[_0x7775('0x5f')]=function(_0x14a323,_0x17fdfa){return db[_0x7775('0x40')]['create'](_0x14a323[_0x7775('0x60')],{})[_0x7775('0x23')](function(_0x142cb4){var _0x46fd10=_0x14a323[_0x7775('0x61')]['get']({'plain':!![]});if(!_0x46fd10)throw new Error(_0x7775('0x62'));if(_0x46fd10[_0x7775('0x63')]===_0x7775('0x61')){var _0x38c1be=_0x142cb4[_0x7775('0x64')]({'plain':!![]});var _0x774e72=_0x7775('0x3a');return db[_0x7775('0x65')][_0x7775('0x5d')]({'where':{'name':_0x774e72,'userProfileId':_0x46fd10['userProfileId']},'raw':!![]})['then'](function(_0x3da737){if(_0x3da737&&_0x3da737['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x38c1be[_0x7775('0x3c')],'resourceId':_0x38c1be['id'],'type':_0x3da737['name'],'sectionId':_0x3da737['id']},{})[_0x7775('0x23')](function(){return _0x142cb4;});}else{return _0x142cb4;}})[_0x7775('0x5e')](function(_0x410cc1){logger[_0x7775('0x2a')](_0x7775('0x66'),_0x410cc1);throw _0x410cc1;});}return _0x142cb4;})[_0x7775('0x23')](respondWithResult(_0x17fdfa,0xc9))['catch'](handleError(_0x17fdfa,null));};exports[_0x7775('0x38')]=function(_0xa1b0db,_0x2ff700){if(_0xa1b0db[_0x7775('0x60')]['id']){delete _0xa1b0db[_0x7775('0x60')]['id'];}return db[_0x7775('0x40')][_0x7775('0x5d')]({'where':{'id':_0xa1b0db['params']['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x2ff700,null))[_0x7775('0x23')](saveUpdates(_0xa1b0db[_0x7775('0x60')],null))[_0x7775('0x23')](respondWithResult(_0x2ff700,null))[_0x7775('0x5e')](handleError(_0x2ff700,null));};exports[_0x7775('0x39')]=function(_0x30fc06,_0x25c2aa){return db[_0x7775('0x40')][_0x7775('0x5d')]({'where':{'id':_0x30fc06[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x25c2aa,null))['then'](removeEntity(_0x25c2aa,null))[_0x7775('0x5e')](handleError(_0x25c2aa,null));};exports[_0x7775('0x67')]=function(_0x10e794,_0x132548){return db[_0x7775('0x40')][_0x7775('0x67')]()['then'](respondWithResult(_0x132548,null))[_0x7775('0x5e')](handleError(_0x132548,null));};exports['getMembers']=function(_0xe888b7,_0x4dbb69,_0x1a2163){var _0xc051a0={'raw':!![],'where':{}},_0x10eba6={},_0x982264;return db[_0x7775('0x40')][_0x7775('0x68')]({'where':{'id':_0xe888b7[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x4dbb69,null))['then'](function(_0x50941b){if(_0x50941b){_0x982264=_0x50941b[_0x7775('0x64')]({'plain':!![]});_0x10eba6[_0x7775('0x45')]=_['keys'](db['UserChatQueue'][_0x7775('0x41')]);_0x10eba6[_0x7775('0x46')]=_[_0x7775('0x47')](_0xe888b7[_0x7775('0x46')]);_0x10eba6[_0x7775('0x48')]=_[_0x7775('0x49')](_0x10eba6[_0x7775('0x45')],_0x10eba6[_0x7775('0x46')]);_0xc051a0[_0x7775('0x4a')]=_[_0x7775('0x49')](_0x10eba6[_0x7775('0x45')],qs[_0x7775('0x4b')](_0xe888b7[_0x7775('0x46')]['fields']));_0xc051a0[_0x7775('0x4a')]=_0xc051a0['attributes'][_0x7775('0x4c')]?_0xc051a0['attributes']:_0x10eba6[_0x7775('0x45')];if(!_0xe888b7[_0x7775('0x46')][_0x7775('0x4d')](_0x7775('0x4e'))){_0xc051a0['limit']=qs[_0x7775('0x32')](_0xe888b7[_0x7775('0x46')]['limit']);_0xc051a0['offset']=qs[_0x7775('0x31')](_0xe888b7[_0x7775('0x46')][_0x7775('0x31')]);}_0xc051a0[_0x7775('0x4f')]=qs[_0x7775('0x50')](_0xe888b7[_0x7775('0x46')]['sort']);_0xc051a0['where']=qs['filters'](_[_0x7775('0x51')](_0xe888b7[_0x7775('0x46')],_0x10eba6[_0x7775('0x48')]));_0xc051a0['where']['ChatQueueId']=_0x50941b['id'];if(_0xe888b7[_0x7775('0x46')][_0x7775('0x52')]){_0xc051a0[_0x7775('0x53')]=_[_0x7775('0x54')](_0xc051a0[_0x7775('0x53')],{'$or':_['map'](_0xc051a0[_0x7775('0x4a')],function(_0xe50d87){var _0x443da6={};_0x443da6[_0xe50d87]={'$like':'%'+_0xe888b7['query'][_0x7775('0x52')]+'%'};return _0x443da6;})});}_0xc051a0=_[_0x7775('0x54')]({},_0xc051a0,_0xe888b7['options']);return db[_0x7775('0x69')][_0x7775('0x58')](_0xc051a0);}})['then'](function(_0x49f035){if(_0x49f035){return db[_0x7775('0x6a')][_0x7775('0x6b')]({'where':{'id':_[_0x7775('0x3f')](_0x49f035,_0x7775('0x6c')),'role':_0x7775('0x6d')},'attributes':['id','name',_0x7775('0x6e'),_0x7775('0x6f'),_0x7775('0x70')]});}})[_0x7775('0x23')](function(_0x5774f3){if(_0x5774f3){return{'count':_0x5774f3[_0x7775('0x33')],'rows':_[_0x7775('0x3f')](_0x5774f3['rows'],function(_0x3cbc31){return{'membername':_0x3cbc31[_0x7775('0x3c')],'UserId':_0x3cbc31['id'],'queue_name':_0x982264[_0x7775('0x3c')],'ChatQueueId':_0x982264['id'],'interface':util[_0x7775('0x71')](_0x7775('0x72'),_0x7775('0x73'),_0x3cbc31['name']),'penalty':0x0,'paused':_0x3cbc31[_0x7775('0x6e')],'createdAt':_0x3cbc31[_0x7775('0x70')],'updatedAt':_0x3cbc31[_0x7775('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7775('0x23')](respondWithFilteredResult(_0x4dbb69,_0xc051a0))[_0x7775('0x5e')](handleError(_0x4dbb69,null));};exports[_0x7775('0x74')]=function(_0xa29bf,_0x1044bf,_0x2b186d){var _0x26001f={};var _0x213b4a={};var _0x1aa42c;var _0x105438;return db[_0x7775('0x40')]['findOne']({'where':{'id':_0xa29bf[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x1044bf,null))[_0x7775('0x23')](function(_0x529940){if(_0x529940){_0x1aa42c=_0x529940;_0x213b4a[_0x7775('0x45')]=_[_0x7775('0x47')](db[_0x7775('0x75')][_0x7775('0x41')]);_0x213b4a[_0x7775('0x46')]=_[_0x7775('0x47')](_0xa29bf[_0x7775('0x46')]);_0x213b4a['filters']=_['intersection'](_0x213b4a['model'],_0x213b4a[_0x7775('0x46')]);_0x26001f[_0x7775('0x4a')]=_[_0x7775('0x49')](_0x213b4a[_0x7775('0x45')],qs['fields'](_0xa29bf[_0x7775('0x46')][_0x7775('0x4b')]));_0x26001f[_0x7775('0x4a')]=_0x26001f[_0x7775('0x4a')][_0x7775('0x4c')]?_0x26001f[_0x7775('0x4a')]:_0x213b4a[_0x7775('0x45')];_0x26001f['order']=qs[_0x7775('0x50')](_0xa29bf[_0x7775('0x46')]['sort']);_0x26001f['where']=qs[_0x7775('0x48')](_[_0x7775('0x51')](_0xa29bf['query'],_0x213b4a[_0x7775('0x48')]));if(_0xa29bf[_0x7775('0x46')][_0x7775('0x52')]){_0x26001f['where']=_['merge'](_0x26001f['where'],{'$or':_[_0x7775('0x3f')](_0x26001f[_0x7775('0x4a')],function(_0x274c9c){var _0x595193={};_0x595193[_0x274c9c]={'$like':'%'+_0xa29bf[_0x7775('0x46')]['filter']+'%'};return _0x595193;})});}_0x26001f=_[_0x7775('0x54')]({},_0x26001f,_0xa29bf[_0x7775('0x56')]);return _0x1aa42c[_0x7775('0x74')](_0x26001f);}})['then'](function(_0x3fcc86){if(_0x3fcc86){_0x105438=_0x3fcc86[_0x7775('0x4c')];if(!_0xa29bf[_0x7775('0x46')]['hasOwnProperty'](_0x7775('0x4e'))){_0x26001f['limit']=qs['limit'](_0xa29bf[_0x7775('0x46')][_0x7775('0x32')]);_0x26001f[_0x7775('0x31')]=qs[_0x7775('0x31')](_0xa29bf[_0x7775('0x46')][_0x7775('0x31')]);}return _0x1aa42c['getTeams'](_0x26001f);}})['then'](function(_0x119de1){if(_0x119de1){return _0x119de1?{'count':_0x105438,'rows':_0x119de1}:null;}})[_0x7775('0x23')](respondWithResult(_0x1044bf,null))[_0x7775('0x5e')](handleError(_0x1044bf,null));};exports['addTeams']=function(_0x5011fc,_0xeec62e,_0x31bb93){var _0x4dad75=_0x5011fc[_0x7775('0x60')][_0x7775('0x76')];return db['Team'][_0x7775('0x58')]({'where':{'id':_0x4dad75},'attributes':['id'],'include':[{'model':db[_0x7775('0x6a')],'as':_0x7775('0x77'),'attributes':['id',_0x7775('0x3c'),_0x7775('0x78'),_0x7775('0x79'),_0x7775('0x7a')],'raw':!![]}]})[_0x7775('0x23')](function(_0x3ebb09){if(_0x3ebb09){var _0x4dae19=_[_0x7775('0x7b')](_0x3ebb09,function(_0x3c81ca){var _0x5cb556=_0x3c81ca[_0x7775('0x64')]({'plain':!![]});return _0x5cb556[_0x7775('0x77')];});return db[_0x7775('0x40')][_0x7775('0x5d')]({'where':{'id':_0x5011fc[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](function(_0x3b3e68){return db[_0x7775('0x7c')]['transaction'](function(_0x39d8bc){return _0x3b3e68[_0x7775('0x7d')](_0x4dad75,{'transaction':_0x39d8bc})[_0x7775('0x23')](function(){return BPromise[_0x7775('0x7e')](_0x4dae19,function(_0x448229){return db[_0x7775('0x69')][_0x7775('0x7f')]({'where':{'UserId':_0x448229['id'],'ChatQueueId':_0x5011fc[_0x7775('0x5b')]['id']},'transaction':_0x39d8bc});});})['then'](function(){_0x4dae19[_0x7775('0x80')](function(_0x1613cc){socket[_0x7775('0x81')](_0x7775('0x82'),{'UserId':_0x1613cc['id'],'ChatQueueId':_0x3b3e68['id']});});});});});}})[_0x7775('0x23')](respondWithStatusCode(_0xeec62e,null))['catch'](handleError(_0xeec62e,null));};exports[_0x7775('0x83')]=function(_0x2939b0,_0xdafde0,_0x40bed0){return db[_0x7775('0x75')][_0x7775('0x58')]({'where':{'id':_0x2939b0[_0x7775('0x46')][_0x7775('0x76')]},'attributes':['id'],'include':[{'model':db[_0x7775('0x6a')],'as':_0x7775('0x77'),'attributes':['id'],'raw':!![]}]})[_0x7775('0x23')](handleEntityNotFound(_0xdafde0,null))['then'](function(_0x1faa73){var _0x1b274a=_[_0x7775('0x3f')](_0x1faa73,'id');var _0x37d582=[];var _0x30210d=[];var _0x53c5c2=squel['select']();_0x53c5c2[_0x7775('0x84')](_0x7775('0x85'))[_0x7775('0x86')](_0x7775('0x87'),'tq')[_0x7775('0x88')](_0x7775('0x89'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7775('0x53')](_0x7775('0x8a'),_0x2939b0[_0x7775('0x5b')]['id']);for(var _0x5590fc=0x0;_0x5590fc<_0x1faa73[_0x7775('0x4c')];_0x5590fc+=0x1){let _0x55d2d2=_0x1faa73[_0x5590fc];for(var _0x67cbb9=0x0;_0x67cbb9<_0x55d2d2[_0x7775('0x77')][_0x7775('0x4c')];_0x67cbb9+=0x1){let _0x3dabf7=_0x55d2d2[_0x7775('0x77')][_0x67cbb9];var _0x10f7af=_0x53c5c2['clone']();_0x10f7af[_0x7775('0x53')](_0x7775('0x8b'),_0x3dabf7['id']);_0x30210d['push'](db[_0x7775('0x7c')][_0x7775('0x46')](_0x10f7af[_0x7775('0x8c')](),{'type':db[_0x7775('0x7c')][_0x7775('0x8d')][_0x7775('0x8e')]})[_0x7775('0x23')](function(_0x33cd6f){if(_0x33cd6f['length']===0x1){return _0x3dabf7['id'];}else{var _0x248b87=_[_0x7775('0x8f')](_[_0x7775('0x3f')](_0x33cd6f,_0x7775('0x90')),function(_0x273345){return _[_0x7775('0x91')](_0x1b274a,_0x273345);});if(_0x248b87){return _0x3dabf7['id'];}}}));}}return BPromise[_0x7775('0x92')](_0x30210d)[_0x7775('0x23')](function(_0x30de88){_0x37d582=_(_0x37d582)[_0x7775('0x93')](_0x30de88)[_0x7775('0x94')]()[_0x7775('0x95')]();return db[_0x7775('0x40')][_0x7775('0x5d')]({'where':{'id':_0x2939b0[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](function(_0x5ca750){return db[_0x7775('0x7c')][_0x7775('0x96')](function(_0xcf1f85){return _0x5ca750[_0x7775('0x83')](_0x2939b0['query']['ids'],{'transaction':_0xcf1f85})[_0x7775('0x23')](function(){if(!_[_0x7775('0x97')](_0x37d582)){return _0x5ca750[_0x7775('0x98')](_0x37d582,{'transaction':_0xcf1f85});}})[_0x7775('0x23')](function(){_0x37d582[_0x7775('0x80')](function(_0x597080){socket[_0x7775('0x81')](_0x7775('0x99'),{'UserId':_0x597080,'ChatQueueId':_0x5ca750['id']});});});});});});})[_0x7775('0x23')](respondWithStatusCode(_0xdafde0,null))[_0x7775('0x5e')](handleError(_0xdafde0,null));};exports[_0x7775('0x9a')]=function(_0x1e949d,_0x5dab76,_0x81f90f){return db['ChatQueue'][_0x7775('0x5d')]({'where':{'id':_0x1e949d[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x5dab76,null))[_0x7775('0x23')](function(_0x142d2c){if(_0x142d2c){return _0x142d2c[_0x7775('0x9a')](_0x1e949d[_0x7775('0x60')][_0x7775('0x76')],_[_0x7775('0x9b')](_0x1e949d[_0x7775('0x60')],['ids','id'])||{})['spread'](function(_0x312007){for(var _0x570a26=0x0;_0x570a26<_0x1e949d[_0x7775('0x60')]['ids'][_0x7775('0x4c')];_0x570a26+=0x1){socket[_0x7775('0x81')]('userChatQueue:save',{'UserId':Number(_0x1e949d[_0x7775('0x60')][_0x7775('0x76')][_0x570a26]),'ChatQueueId':Number(_0x1e949d['params']['id'])});}return _0x312007;});}})['then'](respondWithResult(_0x5dab76,null))[_0x7775('0x5e')](handleError(_0x5dab76,null));};exports[_0x7775('0x98')]=function(_0x139d19,_0x11298b,_0x66aedb){return db[_0x7775('0x40')]['find']({'where':{'id':_0x139d19[_0x7775('0x5b')]['id']}})['then'](handleEntityNotFound(_0x11298b,null))['then'](function(_0x3c5393){if(_0x3c5393){return _0x3c5393[_0x7775('0x98')](_0x139d19[_0x7775('0x46')][_0x7775('0x76')])[_0x7775('0x23')](function(){if(_['isArray'](_0x139d19[_0x7775('0x46')][_0x7775('0x76')])){for(var _0x12795b=0x0;_0x12795b<_0x139d19[_0x7775('0x46')][_0x7775('0x76')][_0x7775('0x4c')];_0x12795b+=0x1){socket['emit'](_0x7775('0x99'),{'UserId':Number(_0x139d19[_0x7775('0x46')][_0x7775('0x76')][_0x12795b]),'ChatQueueId':Number(_0x139d19[_0x7775('0x5b')]['id'])});}}else{socket['emit'](_0x7775('0x99'),{'UserId':Number(_0x139d19[_0x7775('0x46')][_0x7775('0x76')]),'ChatQueueId':Number(_0x139d19[_0x7775('0x5b')]['id'])});}});}})[_0x7775('0x23')](respondWithStatusCode(_0x11298b,null))[_0x7775('0x5e')](handleError(_0x11298b,null));};exports['getAgents']=function(_0x55b838,_0x20630c,_0x493168){var _0xcc37ee={};var _0x1ce2fb={};var _0x323259;var _0x4f48cd;return db[_0x7775('0x40')][_0x7775('0x68')]({'where':{'id':_0x55b838[_0x7775('0x5b')]['id']}})[_0x7775('0x23')](handleEntityNotFound(_0x20630c,null))[_0x7775('0x23')](function(_0x2fe2e7){if(_0x2fe2e7){_0x323259=_0x2fe2e7;_0x1ce2fb[_0x7775('0x45')]=_[_0x7775('0x47')](db[_0x7775('0x6a')][_0x7775('0x41')]);_0x1ce2fb[_0x7775('0x46')]=_[_0x7775('0x47')](_0x55b838['query']);_0x1ce2fb[_0x7775('0x48')]=_[_0x7775('0x49')](_0x1ce2fb['model'],_0x1ce2fb[_0x7775('0x46')]);_0xcc37ee[_0x7775('0x4a')]=_[_0x7775('0x49')](_0x1ce2fb[_0x7775('0x45')],qs[_0x7775('0x4b')](_0x55b838['query'][_0x7775('0x4b')]));_0xcc37ee['attributes']=_0xcc37ee[_0x7775('0x4a')][_0x7775('0x4c')]?_0xcc37ee[_0x7775('0x4a')]:_0x1ce2fb['model'];_0xcc37ee[_0x7775('0x4f')]=qs[_0x7775('0x50')](_0x55b838[_0x7775('0x46')][_0x7775('0x50')]);_0xcc37ee[_0x7775('0x53')]=qs[_0x7775('0x48')](_[_0x7775('0x51')](_0x55b838[_0x7775('0x46')],_0x1ce2fb[_0x7775('0x48')]));if(_0x55b838['query'][_0x7775('0x52')]){_0xcc37ee[_0x7775('0x53')]=_[_0x7775('0x54')](_0xcc37ee['where'],{'$or':_[_0x7775('0x3f')](_0xcc37ee[_0x7775('0x4a')],function(_0x500579){var _0x1c5f6={};_0x1c5f6[_0x500579]={'$like':'%'+_0x55b838[_0x7775('0x46')][_0x7775('0x52')]+'%'};return _0x1c5f6;})});}_0xcc37ee=_[_0x7775('0x54')]({},_0xcc37ee,_0x55b838[_0x7775('0x56')]);return _0x323259[_0x7775('0x9c')](_0xcc37ee);}})[_0x7775('0x23')](function(_0x3ee2f6){if(_0x3ee2f6){_0x4f48cd=_0x3ee2f6['length'];if(!_0x55b838[_0x7775('0x46')][_0x7775('0x4d')](_0x7775('0x4e'))){_0xcc37ee[_0x7775('0x32')]=qs['limit'](_0x55b838[_0x7775('0x46')]['limit']);_0xcc37ee[_0x7775('0x31')]=qs['offset'](_0x55b838[_0x7775('0x46')][_0x7775('0x31')]);}return _0x323259[_0x7775('0x9c')](_0xcc37ee);}})['then'](function(_0xd62005){if(_0xd62005){return _0xd62005?{'count':_0x4f48cd,'rows':_0xd62005}:null;}})[_0x7775('0x23')](respondWithResult(_0x20630c,null))[_0x7775('0x5e')](handleError(_0x20630c,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e2ab946..9b00253 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 _0xadab=['ChatQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x27d0d8,_0x2b657d){var _0x2b79d1=function(_0x249ec1){while(--_0x249ec1){_0x27d0d8['push'](_0x27d0d8['shift']());}};_0x2b79d1(++_0x2b657d);}(_0xadab,0x1ca));var _0xbada=function(_0x2e0af0,_0x83719c){_0x2e0af0=_0x2e0af0-0x0;var _0x2dfdc9=_0xadab[_0x2e0af0];return _0x2dfdc9;};'use strict';var EventEmitter=require(_0xbada('0x0'));var ChatQueue=require(_0xbada('0x1'))['db'][_0xbada('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbada('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbada('0x4'),'afterDestroy':_0xbada('0x5')};function emitEvent(_0x2186f6){return function(_0x1b773c,_0x26c698,_0x42003d){ChatQueueEvents[_0xbada('0x6')](_0x2186f6+':'+_0x1b773c['id'],_0x1b773c);ChatQueueEvents['emit'](_0x2186f6,_0x1b773c);_0x42003d(null);};}for(var e in events){if(events[_0xbada('0x7')](e)){var event=events[e];ChatQueue[_0xbada('0x8')](e,emitEvent(event));}}module[_0xbada('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x59a0=['exports','events','../../mysqldb','ChatQueue','save','update','remove','emit','hook'];(function(_0x37a887,_0x5abb88){var _0x52ff95=function(_0x4065ee){while(--_0x4065ee){_0x37a887['push'](_0x37a887['shift']());}};_0x52ff95(++_0x5abb88);}(_0x59a0,0x184));var _0x059a=function(_0x2717e6,_0x397bff){_0x2717e6=_0x2717e6-0x0;var _0x2944f1=_0x59a0[_0x2717e6];return _0x2944f1;};'use strict';var EventEmitter=require(_0x059a('0x0'));var ChatQueue=require(_0x059a('0x1'))['db'][_0x059a('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x059a('0x3'),'afterUpdate':_0x059a('0x4'),'afterDestroy':_0x059a('0x5')};function emitEvent(_0x36e384){return function(_0x542f60,_0x5a637e,_0x5d1a34){ChatQueueEvents['emit'](_0x36e384+':'+_0x542f60['id'],_0x542f60);ChatQueueEvents[_0x059a('0x6')](_0x36e384,_0x542f60);_0x5d1a34(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x059a('0x7')](e,emitEvent(event));}}module[_0x059a('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 6719121..a31c146 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 _0x96a2=['util','api','bluebird','request-promise','rimraf','./chatQueue.attributes','exports','define','ChatQueue'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x96a2,0x87));var _0x296a=function(_0x5a2233,_0x872ad7){_0x5a2233=_0x5a2233-0x0;var _0x5214e1=_0x96a2[_0x5a2233];return _0x5214e1;};'use strict';var _=require('lodash');var util=require(_0x296a('0x0'));var logger=require('../../config/logger')(_0x296a('0x1'));var moment=require('moment');var BPromise=require(_0x296a('0x2'));var rp=require(_0x296a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x296a('0x4'));var config=require('../../config/environment');var attributes=require(_0x296a('0x5'));module[_0x296a('0x6')]=function(_0x3ec27e,_0x185439){return _0x3ec27e[_0x296a('0x7')](_0x296a('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ddb=['moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','ChatQueue','lodash','util','../../config/logger','api'];(function(_0x5165a2,_0x2fc38d){var _0x5edefb=function(_0x275942){while(--_0x275942){_0x5165a2['push'](_0x5165a2['shift']());}};_0x5edefb(++_0x2fc38d);}(_0x1ddb,0x125));var _0xb1dd=function(_0x2de564,_0x14ac58){_0x2de564=_0x2de564-0x0;var _0x5b7809=_0x1ddb[_0x2de564];return _0x5b7809;};'use strict';var _=require(_0xb1dd('0x0'));var util=require(_0xb1dd('0x1'));var logger=require(_0xb1dd('0x2'))(_0xb1dd('0x3'));var moment=require(_0xb1dd('0x4'));var BPromise=require(_0xb1dd('0x5'));var rp=require(_0xb1dd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb1dd('0x7'));var config=require(_0xb1dd('0x8'));var attributes=require(_0xb1dd('0x9'));module['exports']=function(_0xe9628,_0x17b35d){return _0xe9628['define'](_0xb1dd('0xa'),attributes,{'tableName':'chat_queues','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 b1b84b7..540f4d4 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 _0x85ed=['ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetChatQueue','ChatQueue','findAll','options','raw','attributes','include','map','model','catch','ShowChatQueue','find','where','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis','defaults','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x85ed,0x1e7));var _0xd85e=function(_0x2eb5bc,_0x4634c6){_0x2eb5bc=_0x2eb5bc-0x0;var _0x51c7b1=_0x85ed[_0x2eb5bc];return _0x51c7b1;};'use strict';var _=require(_0xd85e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd85e('0x1'));var fs=require('fs');var Redis=require(_0xd85e('0x2'));var db=require(_0xd85e('0x3'))['db'];var utils=require(_0xd85e('0x4'));var logger=require(_0xd85e('0x5'))('rpc');var config=require(_0xd85e('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd85e('0x7')]=_[_0xd85e('0x8')](config[_0xd85e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd85e('0x7')]));require(_0xd85e('0x9'))[_0xd85e('0xa')](socket);function respondWithRpcPromise(_0x26a05f,_0x535e1f,_0x3846ea){return new BPromise(function(_0xf28f6c,_0x80ad5a){return client[_0xd85e('0xb')](_0x26a05f,_0x3846ea)[_0xd85e('0xc')](function(_0x226c32){logger[_0xd85e('0xd')](_0xd85e('0xe'),_0x535e1f,_0xd85e('0xf'));logger[_0xd85e('0x10')](_0xd85e('0x11'),_0x535e1f,'request\x20sent',JSON[_0xd85e('0x12')](_0x226c32));if(_0x226c32['error']){if(_0x226c32['error'][_0xd85e('0x13')]===0x1f4){logger['error'](_0xd85e('0xe'),_0x535e1f,_0x226c32[_0xd85e('0x14')][_0xd85e('0x15')]);return _0x80ad5a(_0x226c32['error'][_0xd85e('0x15')]);}logger[_0xd85e('0x14')]('ChatQueue,\x20%s,\x20%s',_0x535e1f,_0x226c32[_0xd85e('0x14')][_0xd85e('0x15')]);return _0xf28f6c(_0x226c32[_0xd85e('0x14')][_0xd85e('0x15')]);}else{logger[_0xd85e('0xd')](_0xd85e('0xe'),_0x535e1f,_0xd85e('0xf'));_0xf28f6c(_0x226c32[_0xd85e('0x16')]['message']);}})['catch'](function(_0xbee319){logger[_0xd85e('0x14')](_0xd85e('0xe'),_0x535e1f,_0xbee319);_0x80ad5a(_0xbee319);});});}exports[_0xd85e('0x17')]=function(_0x1ab755){var _0x311421=this;return new Promise(function(_0xfd58ea,_0x5b5a4f){return db[_0xd85e('0x18')][_0xd85e('0x19')]({'raw':_0x1ab755[_0xd85e('0x1a')]?_0x1ab755[_0xd85e('0x1a')][_0xd85e('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ab755[_0xd85e('0x1a')]?_0x1ab755[_0xd85e('0x1a')]['where']||null:null,'attributes':_0x1ab755[_0xd85e('0x1a')]?_0x1ab755[_0xd85e('0x1a')][_0xd85e('0x1c')]||null:null,'limit':_0x1ab755['options']?_0x1ab755[_0xd85e('0x1a')]['limit']||null:null,'include':_0x1ab755['options']?_0x1ab755[_0xd85e('0x1a')][_0xd85e('0x1d')]?_[_0xd85e('0x1e')](_0x1ab755[_0xd85e('0x1a')][_0xd85e('0x1d')],function(_0x17eada){return{'model':db[_0x17eada[_0xd85e('0x1f')]],'as':_0x17eada['as'],'attributes':_0x17eada[_0xd85e('0x1c')],'include':_0x17eada[_0xd85e('0x1d')]?_[_0xd85e('0x1e')](_0x17eada['include'],function(_0x1da9d9){return{'model':db[_0x1da9d9[_0xd85e('0x1f')]],'as':_0x1da9d9['as'],'attributes':_0x1da9d9[_0xd85e('0x1c')],'include':_0x1da9d9[_0xd85e('0x1d')]?_[_0xd85e('0x1e')](_0x1da9d9[_0xd85e('0x1d')],function(_0x461413){return{'model':db[_0x461413[_0xd85e('0x1f')]],'as':_0x461413['as'],'attributes':_0x461413[_0xd85e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd85e('0xc')](function(_0x228c69){logger['info'](_0xd85e('0x17'),_0x1ab755);logger['debug'](_0xd85e('0x17'),_0x1ab755,JSON['stringify'](_0x228c69));_0xfd58ea(_0x228c69);})[_0xd85e('0x20')](function(_0x58a0b4){logger[_0xd85e('0x14')](_0xd85e('0x17'),_0x58a0b4[_0xd85e('0x15')],_0x1ab755);_0x5b5a4f(_0x311421[_0xd85e('0x14')](0x1f4,_0x58a0b4[_0xd85e('0x15')]));});});};exports[_0xd85e('0x21')]=function(_0x2a6b01){var _0x397032=this;return new Promise(function(_0x5e0147,_0x80c368){return db[_0xd85e('0x18')][_0xd85e('0x22')]({'raw':_0x2a6b01['options']?_0x2a6b01[_0xd85e('0x1a')][_0xd85e('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a6b01['options']?_0x2a6b01[_0xd85e('0x1a')][_0xd85e('0x23')]||null:null,'attributes':_0x2a6b01['options']?_0x2a6b01[_0xd85e('0x1a')]['attributes']||null:null,'include':_0x2a6b01['options']?_0x2a6b01[_0xd85e('0x1a')][_0xd85e('0x1d')]?_[_0xd85e('0x1e')](_0x2a6b01[_0xd85e('0x1a')][_0xd85e('0x1d')],function(_0x168982){return{'model':db[_0x168982[_0xd85e('0x1f')]],'as':_0x168982['as'],'attributes':_0x168982[_0xd85e('0x1c')],'include':_0x168982[_0xd85e('0x1d')]?_[_0xd85e('0x1e')](_0x168982[_0xd85e('0x1d')],function(_0x212e00){return{'model':db[_0x212e00[_0xd85e('0x1f')]],'as':_0x212e00['as'],'attributes':_0x212e00[_0xd85e('0x1c')],'include':_0x212e00['include']?_[_0xd85e('0x1e')](_0x212e00['include'],function(_0x1f63d0){return{'model':db[_0x1f63d0[_0xd85e('0x1f')]],'as':_0x1f63d0['as'],'attributes':_0x1f63d0[_0xd85e('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd85e('0xc')](function(_0x166424){logger[_0xd85e('0xd')](_0xd85e('0x21'),_0x2a6b01);logger[_0xd85e('0x10')](_0xd85e('0x21'),_0x2a6b01,JSON[_0xd85e('0x12')](_0x166424));_0x5e0147(_0x166424);})[_0xd85e('0x20')](function(_0x46a99c){logger[_0xd85e('0x14')]('ShowChatQueue',_0x46a99c[_0xd85e('0x15')],_0x2a6b01);_0x80c368(_0x397032[_0xd85e('0x14')](0x1f4,_0x46a99c[_0xd85e('0x15')]));});});}; \ No newline at end of file +var _0x9bb3=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','map','include','model','debug','ShowChatQueue','lodash','util','moment','bluebird'];(function(_0xaca3f,_0x52732c){var _0x386c4d=function(_0x3542ad){while(--_0x3542ad){_0xaca3f['push'](_0xaca3f['shift']());}};_0x386c4d(++_0x52732c);}(_0x9bb3,0x134));var _0x39bb=function(_0x19f5a7,_0x5c99bc){_0x19f5a7=_0x19f5a7-0x0;var _0x6f4800=_0x9bb3[_0x19f5a7];return _0x6f4800;};'use strict';var _=require(_0x39bb('0x0'));var util=require(_0x39bb('0x1'));var moment=require(_0x39bb('0x2'));var BPromise=require(_0x39bb('0x3'));var rs=require(_0x39bb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x39bb('0x5'));var logger=require(_0x39bb('0x6'))(_0x39bb('0x7'));var config=require(_0x39bb('0x8'));var jayson=require(_0x39bb('0x9'));var client=jayson[_0x39bb('0xa')][_0x39bb('0xb')]({'port':0x232a});config[_0x39bb('0xc')]=_[_0x39bb('0xd')](config[_0x39bb('0xc')],{'host':_0x39bb('0xe'),'port':0x18eb});var socket=require(_0x39bb('0xf'))(new Redis(config[_0x39bb('0xc')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3eb2f9,_0x39362a,_0x4b7e6f){return new BPromise(function(_0x15c485,_0x5215fb){return client[_0x39bb('0x10')](_0x3eb2f9,_0x4b7e6f)[_0x39bb('0x11')](function(_0x2fce1c){logger['info'](_0x39bb('0x12'),_0x39362a,'request\x20sent');logger['debug'](_0x39bb('0x13'),_0x39362a,_0x39bb('0x14'),JSON[_0x39bb('0x15')](_0x2fce1c));if(_0x2fce1c[_0x39bb('0x16')]){if(_0x2fce1c[_0x39bb('0x16')][_0x39bb('0x17')]===0x1f4){logger[_0x39bb('0x16')]('ChatQueue,\x20%s,\x20%s',_0x39362a,_0x2fce1c['error'][_0x39bb('0x18')]);return _0x5215fb(_0x2fce1c['error'][_0x39bb('0x18')]);}logger[_0x39bb('0x16')](_0x39bb('0x12'),_0x39362a,_0x2fce1c[_0x39bb('0x16')][_0x39bb('0x18')]);return _0x15c485(_0x2fce1c[_0x39bb('0x16')][_0x39bb('0x18')]);}else{logger[_0x39bb('0x19')](_0x39bb('0x12'),_0x39362a,_0x39bb('0x14'));_0x15c485(_0x2fce1c['result'][_0x39bb('0x18')]);}})[_0x39bb('0x1a')](function(_0x369be0){logger['error'](_0x39bb('0x12'),_0x39362a,_0x369be0);_0x5215fb(_0x369be0);});});}exports[_0x39bb('0x1b')]=function(_0xd92981){var _0x1b90a4=this;return new Promise(function(_0x148fe1,_0xfa6090){return db[_0x39bb('0x1c')][_0x39bb('0x1d')]({'raw':_0xd92981['options']?_0xd92981[_0x39bb('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xd92981['options']?_0xd92981[_0x39bb('0x1e')][_0x39bb('0x1f')]||null:null,'attributes':_0xd92981['options']?_0xd92981['options'][_0x39bb('0x20')]||null:null,'limit':_0xd92981[_0x39bb('0x1e')]?_0xd92981['options'][_0x39bb('0x21')]||null:null,'include':_0xd92981[_0x39bb('0x1e')]?_0xd92981[_0x39bb('0x1e')]['include']?_[_0x39bb('0x22')](_0xd92981['options'][_0x39bb('0x23')],function(_0x3d1cef){return{'model':db[_0x3d1cef[_0x39bb('0x24')]],'as':_0x3d1cef['as'],'attributes':_0x3d1cef[_0x39bb('0x20')],'include':_0x3d1cef[_0x39bb('0x23')]?_['map'](_0x3d1cef['include'],function(_0xe597b8){return{'model':db[_0xe597b8[_0x39bb('0x24')]],'as':_0xe597b8['as'],'attributes':_0xe597b8['attributes'],'include':_0xe597b8['include']?_[_0x39bb('0x22')](_0xe597b8[_0x39bb('0x23')],function(_0x14440b){return{'model':db[_0x14440b['model']],'as':_0x14440b['as'],'attributes':_0x14440b[_0x39bb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f9fe2){logger[_0x39bb('0x19')]('GetChatQueue',_0xd92981);logger[_0x39bb('0x25')](_0x39bb('0x1b'),_0xd92981,JSON[_0x39bb('0x15')](_0x1f9fe2));_0x148fe1(_0x1f9fe2);})[_0x39bb('0x1a')](function(_0x1cdef1){logger[_0x39bb('0x16')](_0x39bb('0x1b'),_0x1cdef1[_0x39bb('0x18')],_0xd92981);_0xfa6090(_0x1b90a4[_0x39bb('0x16')](0x1f4,_0x1cdef1[_0x39bb('0x18')]));});});};exports[_0x39bb('0x26')]=function(_0x3e137a){var _0x370d22=this;return new Promise(function(_0x5e0ae8,_0x182460){return db[_0x39bb('0x1c')]['find']({'raw':_0x3e137a[_0x39bb('0x1e')]?_0x3e137a[_0x39bb('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x3e137a[_0x39bb('0x1e')]?_0x3e137a[_0x39bb('0x1e')][_0x39bb('0x1f')]||null:null,'attributes':_0x3e137a['options']?_0x3e137a['options']['attributes']||null:null,'include':_0x3e137a[_0x39bb('0x1e')]?_0x3e137a[_0x39bb('0x1e')][_0x39bb('0x23')]?_[_0x39bb('0x22')](_0x3e137a['options'][_0x39bb('0x23')],function(_0x4cd284){return{'model':db[_0x4cd284[_0x39bb('0x24')]],'as':_0x4cd284['as'],'attributes':_0x4cd284['attributes'],'include':_0x4cd284['include']?_['map'](_0x4cd284['include'],function(_0x16e8ea){return{'model':db[_0x16e8ea[_0x39bb('0x24')]],'as':_0x16e8ea['as'],'attributes':_0x16e8ea['attributes'],'include':_0x16e8ea[_0x39bb('0x23')]?_[_0x39bb('0x22')](_0x16e8ea['include'],function(_0x4c62a0){return{'model':db[_0x4c62a0[_0x39bb('0x24')]],'as':_0x4c62a0['as'],'attributes':_0x4c62a0[_0x39bb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x39bb('0x11')](function(_0x119ac7){logger[_0x39bb('0x19')](_0x39bb('0x26'),_0x3e137a);logger[_0x39bb('0x25')](_0x39bb('0x26'),_0x3e137a,JSON[_0x39bb('0x15')](_0x119ac7));_0x5e0ae8(_0x119ac7);})[_0x39bb('0x1a')](function(_0x94de2b){logger['error']('ShowChatQueue',_0x94de2b[_0x39bb('0x18')],_0x3e137a);_0x182460(_0x370d22[_0x39bb('0x16')](0x1f4,_0x94de2b[_0x39bb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 11b12c3..ccada0f 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 _0x6334=['length','chatQueue:','./chatQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x331a5,_0x4a2f92){var _0x1bc5c8=function(_0x5c2d85){while(--_0x5c2d85){_0x331a5['push'](_0x331a5['shift']());}};_0x1bc5c8(++_0x4a2f92);}(_0x6334,0x119));var _0x4633=function(_0x172ed7,_0x3d08fd){_0x172ed7=_0x172ed7-0x0;var _0xfa8f61=_0x6334[_0x172ed7];return _0xfa8f61;};'use strict';var ChatQueueEvents=require(_0x4633('0x0'));var events=[_0x4633('0x1'),_0x4633('0x2'),_0x4633('0x3')];function createListener(_0x1e53a0,_0x47254b){return function(_0x5109db){_0x47254b[_0x4633('0x4')](_0x1e53a0,_0x5109db);};}function removeListener(_0x205442,_0x2a2b3c){return function(){ChatQueueEvents[_0x4633('0x5')](_0x205442,_0x2a2b3c);};}exports[_0x4633('0x6')]=function(_0x6493dc){for(var _0x175e14=0x0,_0x4a8997=events[_0x4633('0x7')];_0x175e14<_0x4a8997;_0x175e14++){var _0x56891d=events[_0x175e14];var _0x21af74=createListener(_0x4633('0x8')+_0x56891d,_0x6493dc);ChatQueueEvents['on'](_0x56891d,_0x21af74);}}; \ No newline at end of file +var _0x72b1=['register','length','./chatQueue.events','remove','update','emit','removeListener'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x72b1,0x16e));var _0x172b=function(_0x44e4fa,_0x2df5b5){_0x44e4fa=_0x44e4fa-0x0;var _0x2c3c0f=_0x72b1[_0x44e4fa];return _0x2c3c0f;};'use strict';var ChatQueueEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatQueueEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatQueue:'+_0x517363,_0x475fd6);ChatQueueEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 01074d5..7d33abb 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3e74,0x175));var _0x43e7=function(_0x5a47ed,_0x20d548){_0x5a47ed=_0x5a47ed-0x0;var _0x1642c1=_0x3e74[_0x5a47ed];return _0x1642c1;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x359d00,_0x215da8){var _0x511edd=function(_0x105448){while(--_0x105448){_0x359d00['push'](_0x359d00['shift']());}};_0x511edd(++_0x215da8);}(_0xe14b,0x93));var _0xbe14=function(_0x2f7819,_0x4303da){_0x2f7819=_0x2f7819-0x0;var _0x2c418d=_0xe14b[_0x2f7819];return _0x2c418d;};'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['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 18e6a72..58f2d15 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 _0xd843=['STRING','DATE','moment','sequelize'];(function(_0x26071c,_0x1ca4e2){var _0x2fb70e=function(_0x1e5079){while(--_0x1e5079){_0x26071c['push'](_0x26071c['shift']());}};_0x2fb70e(++_0x1ca4e2);}(_0xd843,0x172));var _0x3d84=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xd843[_0x3b7a0c];return _0x3bb70f;};'use strict';var moment=require(_0x3d84('0x0'));var Sequelize=require(_0x3d84('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3d84('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3d84('0x3')]},'acceptAt':{'type':Sequelize[_0x3d84('0x3')]},'exitAt':{'type':Sequelize[_0x3d84('0x3')]},'reason':{'type':Sequelize[_0x3d84('0x2')]}}; \ No newline at end of file +var _0xfead=['STRING','DATE','moment','sequelize','exports'];(function(_0x228fcc,_0x491886){var _0x19d09c=function(_0x459fd5){while(--_0x459fd5){_0x228fcc['push'](_0x228fcc['shift']());}};_0x19d09c(++_0x491886);}(_0xfead,0x1d8));var _0xdfea=function(_0x5f30c1,_0x5c9c25){_0x5f30c1=_0x5f30c1-0x0;var _0xd3c44d=_0xfead[_0x5f30c1];return _0xd3c44d;};'use strict';var moment=require(_0xdfea('0x0'));var Sequelize=require(_0xdfea('0x1'));module[_0xdfea('0x2')]={'uniqueid':{'type':Sequelize[_0xdfea('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xdfea('0x3')]},'joinAt':{'type':Sequelize[_0xdfea('0x4')]},'leaveAt':{'type':Sequelize[_0xdfea('0x4')]},'acceptAt':{'type':Sequelize[_0xdfea('0x4')]},'exitAt':{'type':Sequelize[_0xdfea('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 380dc3d..ea25516 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 _0xc1dc=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','ChatQueueReport','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x5e2a2,_0x2654ee){var _0x280de8=function(_0x1a05d8){while(--_0x1a05d8){_0x5e2a2['push'](_0x5e2a2['shift']());}};_0x280de8(++_0x2654ee);}(_0xc1dc,0x84));var _0xcc1d=function(_0x213d5d,_0x305d72){_0x213d5d=_0x213d5d-0x0;var _0x225993=_0xc1dc[_0x213d5d];return _0x225993;};'use strict';var emlformat=require(_0xcc1d('0x0'));var rimraf=require(_0xcc1d('0x1'));var zipdir=require(_0xcc1d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc1d('0x3'));var moment=require('moment');var BPromise=require(_0xcc1d('0x4'));var Mustache=require(_0xcc1d('0x5'));var util=require('util');var path=require(_0xcc1d('0x6'));var sox=require(_0xcc1d('0x7'));var csv=require(_0xcc1d('0x8'));var ejs=require(_0xcc1d('0x9'));var fs=require('fs');var fs_extra=require(_0xcc1d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcc1d('0xb'));var jsforce=require(_0xcc1d('0xc'));var deskjs=require(_0xcc1d('0xd'));var toCsv=require(_0xcc1d('0x8'));var querystring=require(_0xcc1d('0xe'));var Papa=require(_0xcc1d('0xf'));var Redis=require('ioredis');var authService=require(_0xcc1d('0x10'));var qs=require(_0xcc1d('0x11'));var as=require(_0xcc1d('0x12'));var hardwareService=require(_0xcc1d('0x13'));var logger=require(_0xcc1d('0x14'))(_0xcc1d('0x15'));var utils=require('../../config/utils');var config=require(_0xcc1d('0x16'));var licenseUtil=require(_0xcc1d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11a34f,_0x3e2534){_0x3e2534=_0x3e2534||0xcc;return function(_0x1440f6){if(_0x1440f6){return _0x11a34f[_0xcc1d('0x18')](_0x3e2534);}return _0x11a34f[_0xcc1d('0x19')](_0x3e2534)[_0xcc1d('0x1a')]();};}function respondWithResult(_0x18b64a,_0x5345ab){_0x5345ab=_0x5345ab||0xc8;return function(_0x5e66ce){if(_0x5e66ce){return _0x18b64a[_0xcc1d('0x19')](_0x5345ab)['json'](_0x5e66ce);}};}function respondWithFilteredResult(_0x35e177,_0x452772){return function(_0x35f147){if(_0x35f147){var _0xc71166=typeof _0x452772[_0xcc1d('0x1b')]===_0xcc1d('0x1c')&&typeof _0x452772[_0xcc1d('0x1d')]===_0xcc1d('0x1c');var _0x2147ca=_0x35f147[_0xcc1d('0x1e')];var _0x483963=_0xc71166?0x0:_0x452772['offset'];var _0x2ee388=_0xc71166?_0x35f147['count']:_0x452772[_0xcc1d('0x1b')]+_0x452772[_0xcc1d('0x1d')];var _0xf44327;if(_0x2ee388>=_0x2147ca){_0x2ee388=_0x2147ca;_0xf44327=0xc8;}else{_0xf44327=0xce;}_0x35e177[_0xcc1d('0x19')](_0xf44327);return _0x35e177[_0xcc1d('0x1f')](_0xcc1d('0x20'),_0x483963+'-'+_0x2ee388+'/'+_0x2147ca)[_0xcc1d('0x21')](_0x35f147);}return null;};}function patchUpdates(_0x1b88f4){return function(_0x438288){try{jsonpatch['apply'](_0x438288,_0x1b88f4,!![]);}catch(_0x23189c){return BPromise['reject'](_0x23189c);}return _0x438288[_0xcc1d('0x22')]();};}function saveUpdates(_0x1bcf7b,_0x167b9f){return function(_0x5a2df6){if(_0x5a2df6){return _0x5a2df6[_0xcc1d('0x23')](_0x1bcf7b)[_0xcc1d('0x24')](function(_0x31a006){return _0x31a006;});}return null;};}function removeEntity(_0x451523,_0xac9e86){return function(_0x5e2f74){if(_0x5e2f74){return _0x5e2f74[_0xcc1d('0x25')]()['then'](function(){_0x451523[_0xcc1d('0x19')](0xcc)[_0xcc1d('0x1a')]();});}};}function handleEntityNotFound(_0x3f8b30,_0x40e31c){return function(_0xd2dba0){if(!_0xd2dba0){_0x3f8b30['sendStatus'](0x194);}return _0xd2dba0;};}function handleError(_0x8ae1a4,_0x17cdfe){_0x17cdfe=_0x17cdfe||0x1f4;return function(_0xec0667){logger['error'](_0xec0667[_0xcc1d('0x26')]);if(_0xec0667['name']){delete _0xec0667[_0xcc1d('0x27')];}_0x8ae1a4['status'](_0x17cdfe)[_0xcc1d('0x28')](_0xec0667);};}exports[_0xcc1d('0x29')]=function(_0x47710b,_0x50b769){var _0x2c5c51={},_0x10f5d3={},_0x11ba24={'count':0x0,'rows':[]};var _0x4a406f=_[_0xcc1d('0x2a')](db['ChatQueueReport'][_0xcc1d('0x2b')],function(_0x2a68ef){return{'name':_0x2a68ef[_0xcc1d('0x2c')],'type':_0x2a68ef[_0xcc1d('0x2d')][_0xcc1d('0x2e')]};});_0x10f5d3['model']=_[_0xcc1d('0x2a')](_0x4a406f,_0xcc1d('0x27'));_0x10f5d3['query']=_[_0xcc1d('0x2f')](_0x47710b['query']);_0x10f5d3[_0xcc1d('0x30')]=_['intersection'](_0x10f5d3['model'],_0x10f5d3[_0xcc1d('0x31')]);_0x2c5c51['attributes']=_[_0xcc1d('0x32')](_0x10f5d3[_0xcc1d('0x33')],qs[_0xcc1d('0x34')](_0x47710b[_0xcc1d('0x31')][_0xcc1d('0x34')]));_0x2c5c51[_0xcc1d('0x35')]=_0x2c5c51['attributes'][_0xcc1d('0x36')]?_0x2c5c51['attributes']:_0x10f5d3[_0xcc1d('0x33')];if(!_0x47710b[_0xcc1d('0x31')][_0xcc1d('0x37')](_0xcc1d('0x38'))){_0x2c5c51['limit']=qs[_0xcc1d('0x1d')](_0x47710b[_0xcc1d('0x31')][_0xcc1d('0x1d')]);_0x2c5c51[_0xcc1d('0x1b')]=qs[_0xcc1d('0x1b')](_0x47710b[_0xcc1d('0x31')][_0xcc1d('0x1b')]);}_0x2c5c51[_0xcc1d('0x39')]=qs[_0xcc1d('0x3a')](_0x47710b[_0xcc1d('0x31')]['sort']);_0x2c5c51['where']=qs[_0xcc1d('0x30')](_[_0xcc1d('0x3b')](_0x47710b['query'],_0x10f5d3['filters']),_0x4a406f);if(_0x47710b['query'][_0xcc1d('0x3c')]){_0x2c5c51[_0xcc1d('0x3d')]=_[_0xcc1d('0x3e')](_0x2c5c51[_0xcc1d('0x3d')],{'$or':_[_0xcc1d('0x2a')](_0x4a406f,function(_0xcc81fd){if(_0xcc81fd[_0xcc1d('0x2d')]!=='VIRTUAL'){var _0x3d35e9={};_0x3d35e9[_0xcc81fd['name']]={'$like':'%'+_0x47710b['query']['filter']+'%'};return _0x3d35e9;}})});}_0x2c5c51=_[_0xcc1d('0x3e')]({},_0x2c5c51,_0x47710b[_0xcc1d('0x3f')]);var _0x59d656={'where':_0x2c5c51['where']};return db[_0xcc1d('0x40')]['count'](_0x59d656)[_0xcc1d('0x24')](function(_0x91e50d){_0x11ba24[_0xcc1d('0x1e')]=_0x91e50d;if(_0x47710b['query'][_0xcc1d('0x41')]){_0x2c5c51[_0xcc1d('0x42')]=[{'all':!![]}];}return db[_0xcc1d('0x40')][_0xcc1d('0x43')](_0x2c5c51);})[_0xcc1d('0x24')](function(_0x350b9d){_0x11ba24[_0xcc1d('0x44')]=_0x350b9d;return _0x11ba24;})['then'](respondWithFilteredResult(_0x50b769,_0x2c5c51))[_0xcc1d('0x45')](handleError(_0x50b769,null));};exports['show']=function(_0x809c64,_0x2ac320){var _0x1d74b4={'raw':!![],'where':{'id':_0x809c64[_0xcc1d('0x46')]['id']}},_0x252361={};_0x252361[_0xcc1d('0x33')]=_[_0xcc1d('0x2f')](db[_0xcc1d('0x40')][_0xcc1d('0x2b')]);_0x252361[_0xcc1d('0x31')]=_[_0xcc1d('0x2f')](_0x809c64[_0xcc1d('0x31')]);_0x252361['filters']=_[_0xcc1d('0x32')](_0x252361[_0xcc1d('0x33')],_0x252361[_0xcc1d('0x31')]);_0x1d74b4[_0xcc1d('0x35')]=_[_0xcc1d('0x32')](_0x252361[_0xcc1d('0x33')],qs[_0xcc1d('0x34')](_0x809c64[_0xcc1d('0x31')][_0xcc1d('0x34')]));_0x1d74b4[_0xcc1d('0x35')]=_0x1d74b4[_0xcc1d('0x35')]['length']?_0x1d74b4[_0xcc1d('0x35')]:_0x252361[_0xcc1d('0x33')];if(_0x809c64[_0xcc1d('0x31')][_0xcc1d('0x41')]){_0x1d74b4[_0xcc1d('0x42')]=[{'all':!![]}];}_0x1d74b4=_[_0xcc1d('0x3e')]({},_0x1d74b4,_0x809c64[_0xcc1d('0x3f')]);return db[_0xcc1d('0x40')][_0xcc1d('0x47')](_0x1d74b4)[_0xcc1d('0x24')](handleEntityNotFound(_0x2ac320,null))[_0xcc1d('0x24')](respondWithResult(_0x2ac320,null))[_0xcc1d('0x45')](handleError(_0x2ac320,null));};exports[_0xcc1d('0x48')]=function(_0x1ba4fc,_0x3e9a69){return db[_0xcc1d('0x40')][_0xcc1d('0x48')](_0x1ba4fc[_0xcc1d('0x49')],{})[_0xcc1d('0x24')](respondWithResult(_0x3e9a69,0xc9))[_0xcc1d('0x45')](handleError(_0x3e9a69,null));};exports['update']=function(_0x46a883,_0x4f4359){if(_0x46a883[_0xcc1d('0x49')]['id']){delete _0x46a883[_0xcc1d('0x49')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x46a883[_0xcc1d('0x46')]['id']}})[_0xcc1d('0x24')](handleEntityNotFound(_0x4f4359,null))[_0xcc1d('0x24')](saveUpdates(_0x46a883[_0xcc1d('0x49')],null))[_0xcc1d('0x24')](respondWithResult(_0x4f4359,null))[_0xcc1d('0x45')](handleError(_0x4f4359,null));};exports['destroy']=function(_0x40b834,_0x98ee9a){return db['ChatQueueReport'][_0xcc1d('0x47')]({'where':{'id':_0x40b834[_0xcc1d('0x46')]['id']}})[_0xcc1d('0x24')](handleEntityNotFound(_0x98ee9a,null))['then'](removeEntity(_0x98ee9a,null))[_0xcc1d('0x45')](handleError(_0x98ee9a,null));};exports[_0xcc1d('0x4a')]=function(_0x3b232f,_0x50d994){return db[_0xcc1d('0x40')][_0xcc1d('0x4a')]()[_0xcc1d('0x24')](respondWithResult(_0x50d994,null))[_0xcc1d('0x45')](handleError(_0x50d994,null));}; \ No newline at end of file +var _0x9fd4=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','ChatQueueReport','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','include','findAll','rows','catch','params','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x9fd4,0x16c));var _0x49fd=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0x9fd4[_0x5c72ee];return _0x231876;};'use strict';var emlformat=require(_0x49fd('0x0'));var rimraf=require(_0x49fd('0x1'));var zipdir=require(_0x49fd('0x2'));var jsonpatch=require(_0x49fd('0x3'));var rp=require(_0x49fd('0x4'));var moment=require(_0x49fd('0x5'));var BPromise=require(_0x49fd('0x6'));var Mustache=require(_0x49fd('0x7'));var util=require(_0x49fd('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x49fd('0x9'));var ejs=require(_0x49fd('0xa'));var fs=require('fs');var fs_extra=require(_0x49fd('0xb'));var _=require(_0x49fd('0xc'));var squel=require('squel');var crypto=require(_0x49fd('0xd'));var jsforce=require(_0x49fd('0xe'));var deskjs=require(_0x49fd('0xf'));var toCsv=require(_0x49fd('0x9'));var querystring=require(_0x49fd('0x10'));var Papa=require('papaparse');var Redis=require(_0x49fd('0x11'));var authService=require(_0x49fd('0x12'));var qs=require(_0x49fd('0x13'));var as=require(_0x49fd('0x14'));var hardwareService=require(_0x49fd('0x15'));var logger=require(_0x49fd('0x16'))(_0x49fd('0x17'));var utils=require('../../config/utils');var config=require(_0x49fd('0x18'));var licenseUtil=require(_0x49fd('0x19'));var db=require(_0x49fd('0x1a'))['db'];function respondWithStatusCode(_0x40d1b0,_0x15dabd){_0x15dabd=_0x15dabd||0xcc;return function(_0x206bd8){if(_0x206bd8){return _0x40d1b0[_0x49fd('0x1b')](_0x15dabd);}return _0x40d1b0[_0x49fd('0x1c')](_0x15dabd)[_0x49fd('0x1d')]();};}function respondWithResult(_0x652890,_0x157b09){_0x157b09=_0x157b09||0xc8;return function(_0x44c18c){if(_0x44c18c){return _0x652890[_0x49fd('0x1c')](_0x157b09)[_0x49fd('0x1e')](_0x44c18c);}};}function respondWithFilteredResult(_0x264ab1,_0x201109){return function(_0x2859f2){if(_0x2859f2){var _0x3ca675=typeof _0x201109[_0x49fd('0x1f')]===_0x49fd('0x20')&&typeof _0x201109[_0x49fd('0x21')]===_0x49fd('0x20');var _0x320fe5=_0x2859f2[_0x49fd('0x22')];var _0xb55d24=_0x3ca675?0x0:_0x201109[_0x49fd('0x1f')];var _0x598793=_0x3ca675?_0x2859f2[_0x49fd('0x22')]:_0x201109[_0x49fd('0x1f')]+_0x201109['limit'];var _0x5c323a;if(_0x598793>=_0x320fe5){_0x598793=_0x320fe5;_0x5c323a=0xc8;}else{_0x5c323a=0xce;}_0x264ab1[_0x49fd('0x1c')](_0x5c323a);return _0x264ab1['set'](_0x49fd('0x23'),_0xb55d24+'-'+_0x598793+'/'+_0x320fe5)[_0x49fd('0x1e')](_0x2859f2);}return null;};}function patchUpdates(_0x599315){return function(_0xf7efcf){try{jsonpatch[_0x49fd('0x24')](_0xf7efcf,_0x599315,!![]);}catch(_0x5ae3bc){return BPromise[_0x49fd('0x25')](_0x5ae3bc);}return _0xf7efcf[_0x49fd('0x26')]();};}function saveUpdates(_0x2e1c40,_0x290f59){return function(_0x20fa0d){if(_0x20fa0d){return _0x20fa0d[_0x49fd('0x27')](_0x2e1c40)['then'](function(_0x46019d){return _0x46019d;});}return null;};}function removeEntity(_0xd43815,_0x8f202b){return function(_0x4bf811){if(_0x4bf811){return _0x4bf811[_0x49fd('0x28')]()[_0x49fd('0x29')](function(){_0xd43815[_0x49fd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x597161,_0x497469){return function(_0x13c5a8){if(!_0x13c5a8){_0x597161[_0x49fd('0x1b')](0x194);}return _0x13c5a8;};}function handleError(_0x4ec190,_0x302ab2){_0x302ab2=_0x302ab2||0x1f4;return function(_0x9587b9){logger[_0x49fd('0x2a')](_0x9587b9[_0x49fd('0x2b')]);if(_0x9587b9[_0x49fd('0x2c')]){delete _0x9587b9['name'];}_0x4ec190[_0x49fd('0x1c')](_0x302ab2)['send'](_0x9587b9);};}exports[_0x49fd('0x2d')]=function(_0x89badc,_0x54acb5){var _0x203038={},_0x2c8568={},_0x23374c={'count':0x0,'rows':[]};var _0x43826f=_[_0x49fd('0x2e')](db[_0x49fd('0x2f')][_0x49fd('0x30')],function(_0x242203){return{'name':_0x242203['fieldName'],'type':_0x242203[_0x49fd('0x31')]['key']};});_0x2c8568[_0x49fd('0x32')]=_['map'](_0x43826f,_0x49fd('0x2c'));_0x2c8568[_0x49fd('0x33')]=_[_0x49fd('0x34')](_0x89badc['query']);_0x2c8568['filters']=_['intersection'](_0x2c8568[_0x49fd('0x32')],_0x2c8568[_0x49fd('0x33')]);_0x203038['attributes']=_[_0x49fd('0x35')](_0x2c8568['model'],qs['fields'](_0x89badc[_0x49fd('0x33')][_0x49fd('0x36')]));_0x203038[_0x49fd('0x37')]=_0x203038[_0x49fd('0x37')][_0x49fd('0x38')]?_0x203038['attributes']:_0x2c8568['model'];if(!_0x89badc[_0x49fd('0x33')][_0x49fd('0x39')](_0x49fd('0x3a'))){_0x203038[_0x49fd('0x21')]=qs['limit'](_0x89badc[_0x49fd('0x33')][_0x49fd('0x21')]);_0x203038[_0x49fd('0x1f')]=qs[_0x49fd('0x1f')](_0x89badc[_0x49fd('0x33')][_0x49fd('0x1f')]);}_0x203038[_0x49fd('0x3b')]=qs[_0x49fd('0x3c')](_0x89badc[_0x49fd('0x33')][_0x49fd('0x3c')]);_0x203038[_0x49fd('0x3d')]=qs['filters'](_[_0x49fd('0x3e')](_0x89badc[_0x49fd('0x33')],_0x2c8568[_0x49fd('0x3f')]),_0x43826f);if(_0x89badc[_0x49fd('0x33')][_0x49fd('0x40')]){_0x203038[_0x49fd('0x3d')]=_[_0x49fd('0x41')](_0x203038[_0x49fd('0x3d')],{'$or':_[_0x49fd('0x2e')](_0x43826f,function(_0x4a1856){if(_0x4a1856[_0x49fd('0x31')]!=='VIRTUAL'){var _0x46e84c={};_0x46e84c[_0x4a1856[_0x49fd('0x2c')]]={'$like':'%'+_0x89badc['query'][_0x49fd('0x40')]+'%'};return _0x46e84c;}})});}_0x203038=_[_0x49fd('0x41')]({},_0x203038,_0x89badc['options']);var _0x1f9a65={'where':_0x203038['where']};return db['ChatQueueReport']['count'](_0x1f9a65)[_0x49fd('0x29')](function(_0x32982e){_0x23374c[_0x49fd('0x22')]=_0x32982e;if(_0x89badc[_0x49fd('0x33')]['includeAll']){_0x203038[_0x49fd('0x42')]=[{'all':!![]}];}return db[_0x49fd('0x2f')][_0x49fd('0x43')](_0x203038);})[_0x49fd('0x29')](function(_0x115c5a){_0x23374c[_0x49fd('0x44')]=_0x115c5a;return _0x23374c;})[_0x49fd('0x29')](respondWithFilteredResult(_0x54acb5,_0x203038))[_0x49fd('0x45')](handleError(_0x54acb5,null));};exports['show']=function(_0x255a73,_0x2c8ab1){var _0x4dce94={'raw':!![],'where':{'id':_0x255a73[_0x49fd('0x46')]['id']}},_0x3be41b={};_0x3be41b['model']=_[_0x49fd('0x34')](db['ChatQueueReport'][_0x49fd('0x30')]);_0x3be41b[_0x49fd('0x33')]=_[_0x49fd('0x34')](_0x255a73[_0x49fd('0x33')]);_0x3be41b['filters']=_['intersection'](_0x3be41b[_0x49fd('0x32')],_0x3be41b['query']);_0x4dce94[_0x49fd('0x37')]=_[_0x49fd('0x35')](_0x3be41b[_0x49fd('0x32')],qs[_0x49fd('0x36')](_0x255a73['query'][_0x49fd('0x36')]));_0x4dce94[_0x49fd('0x37')]=_0x4dce94[_0x49fd('0x37')][_0x49fd('0x38')]?_0x4dce94[_0x49fd('0x37')]:_0x3be41b[_0x49fd('0x32')];if(_0x255a73[_0x49fd('0x33')][_0x49fd('0x47')]){_0x4dce94[_0x49fd('0x42')]=[{'all':!![]}];}_0x4dce94=_[_0x49fd('0x41')]({},_0x4dce94,_0x255a73[_0x49fd('0x48')]);return db[_0x49fd('0x2f')][_0x49fd('0x49')](_0x4dce94)[_0x49fd('0x29')](handleEntityNotFound(_0x2c8ab1,null))['then'](respondWithResult(_0x2c8ab1,null))['catch'](handleError(_0x2c8ab1,null));};exports[_0x49fd('0x4a')]=function(_0xa3518f,_0x42287e){return db[_0x49fd('0x2f')]['create'](_0xa3518f[_0x49fd('0x4b')],{})[_0x49fd('0x29')](respondWithResult(_0x42287e,0xc9))['catch'](handleError(_0x42287e,null));};exports[_0x49fd('0x27')]=function(_0x270360,_0xaac56f){if(_0x270360[_0x49fd('0x4b')]['id']){delete _0x270360[_0x49fd('0x4b')]['id'];}return db[_0x49fd('0x2f')][_0x49fd('0x49')]({'where':{'id':_0x270360[_0x49fd('0x46')]['id']}})[_0x49fd('0x29')](handleEntityNotFound(_0xaac56f,null))[_0x49fd('0x29')](saveUpdates(_0x270360[_0x49fd('0x4b')],null))['then'](respondWithResult(_0xaac56f,null))[_0x49fd('0x45')](handleError(_0xaac56f,null));};exports[_0x49fd('0x28')]=function(_0x32694b,_0x263cf3){return db[_0x49fd('0x2f')][_0x49fd('0x49')]({'where':{'id':_0x32694b['params']['id']}})['then'](handleEntityNotFound(_0x263cf3,null))[_0x49fd('0x29')](removeEntity(_0x263cf3,null))[_0x49fd('0x45')](handleError(_0x263cf3,null));};exports[_0x49fd('0x4c')]=function(_0x5c34c0,_0x31783f){return db[_0x49fd('0x2f')]['describe']()['then'](respondWithResult(_0x31783f,null))['catch'](handleError(_0x31783f,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index bf24386..1dfbadd 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(_0x2d72ab,_0x5a97f5){var _0x256423=function(_0x94ed46){while(--_0x94ed46){_0x2d72ab['push'](_0x2d72ab['shift']());}};_0x256423(++_0x5a97f5);}(_0xb10b,0x12a));var _0xbb10=function(_0x40d5c8,_0x411c6e){_0x40d5c8=_0x40d5c8-0x0;var _0x5f294f=_0xb10b[_0x40d5c8];return _0x5f294f;};'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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x4deae2,_0x124e5c){var _0x140c9f=function(_0x59d15f){while(--_0x59d15f){_0x4deae2['push'](_0x4deae2['shift']());}};_0x140c9f(++_0x124e5c);}(_0x757a,0xde));var _0xa757=function(_0x3f7cb6,_0x2241fe){_0x3f7cb6=_0x3f7cb6-0x0;var _0x1f8011=_0x757a[_0x3f7cb6];return _0x1f8011;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b97b31f..cee4eef 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 _0x7f1b=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit','lodash','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x7f1b,0x12b));var _0xb7f1=function(_0x1772b7,_0x1743e7){_0x1772b7=_0x1772b7-0x0;var _0x5baaad=_0x7f1b[_0x1772b7];return _0x5baaad;};'use strict';var _=require(_0xb7f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb7f1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb7f1('0x2'));var logger=require(_0xb7f1('0x3'))(_0xb7f1('0x4'));var config=require(_0xb7f1('0x5'));var jayson=require(_0xb7f1('0x6'));var client=jayson['client'][_0xb7f1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x29e686,_0x7a94a1,_0x2504b3){return new BPromise(function(_0x3bee91,_0x463026){return client[_0xb7f1('0x8')](_0x29e686,_0x2504b3)[_0xb7f1('0x9')](function(_0x435f32){logger[_0xb7f1('0xa')](_0xb7f1('0xb'),_0x7a94a1,_0xb7f1('0xc'));logger[_0xb7f1('0xd')](_0xb7f1('0xe'),_0x7a94a1,_0xb7f1('0xc'),JSON[_0xb7f1('0xf')](_0x435f32));if(_0x435f32['error']){if(_0x435f32[_0xb7f1('0x10')][_0xb7f1('0x11')]===0x1f4){logger[_0xb7f1('0x10')](_0xb7f1('0xb'),_0x7a94a1,_0x435f32[_0xb7f1('0x10')][_0xb7f1('0x12')]);return _0x463026(_0x435f32[_0xb7f1('0x10')][_0xb7f1('0x12')]);}logger[_0xb7f1('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x7a94a1,_0x435f32['error'][_0xb7f1('0x12')]);return _0x3bee91(_0x435f32['error']['message']);}else{logger[_0xb7f1('0xa')](_0xb7f1('0xb'),_0x7a94a1,'request\x20sent');_0x3bee91(_0x435f32[_0xb7f1('0x13')][_0xb7f1('0x12')]);}})[_0xb7f1('0x14')](function(_0x3ced85){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x7a94a1,_0x3ced85);_0x463026(_0x3ced85);});});}exports[_0xb7f1('0x15')]=function(_0x195035){var _0x536194=this;return new Promise(function(_0xbc2361,_0x4b7db2){return db[_0xb7f1('0x16')]['create'](_0x195035[_0xb7f1('0x17')],{'raw':_0x195035[_0xb7f1('0x18')]?_0x195035[_0xb7f1('0x18')][_0xb7f1('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xa11f0c){logger[_0xb7f1('0xa')](_0xb7f1('0x15'),_0x195035);logger[_0xb7f1('0xd')]('CreateChatQueueReport',_0x195035,JSON[_0xb7f1('0xf')](_0xa11f0c));_0xbc2361(_0xa11f0c);})[_0xb7f1('0x14')](function(_0x49f3ad){logger['error'](_0xb7f1('0x15'),_0x49f3ad['message'],_0x195035);_0x4b7db2(_0x536194[_0xb7f1('0x10')](0x1f4,_0x49f3ad['message']));});});};exports[_0xb7f1('0x1a')]=function(_0x25c61a){var _0x243474=this;return new Promise(function(_0xbf1b8e,_0x2ab151){return db[_0xb7f1('0x16')][_0xb7f1('0x1b')](_0x25c61a[_0xb7f1('0x17')],{'raw':_0x25c61a['options']?_0x25c61a[_0xb7f1('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25c61a['options']?_0x25c61a[_0xb7f1('0x18')][_0xb7f1('0x1c')]||null:null,'attributes':_0x25c61a[_0xb7f1('0x18')]?_0x25c61a[_0xb7f1('0x18')][_0xb7f1('0x1d')]||null:null,'limit':_0x25c61a['options']?_0x25c61a[_0xb7f1('0x18')][_0xb7f1('0x1e')]||null:null})['then'](function(_0x4521dd){logger[_0xb7f1('0xa')](_0xb7f1('0x1a'),_0x25c61a);logger[_0xb7f1('0xd')](_0xb7f1('0x1a'),_0x25c61a,JSON[_0xb7f1('0xf')](_0x4521dd));_0xbf1b8e(_0x4521dd);})[_0xb7f1('0x14')](function(_0xe800ba){logger[_0xb7f1('0x10')](_0xb7f1('0x1a'),_0xe800ba[_0xb7f1('0x12')],_0x25c61a);_0x2ab151(_0x243474['error'](0x1f4,_0xe800ba[_0xb7f1('0x12')]));});});}; \ No newline at end of file +var _0x8145=['result','catch','CreateChatQueueReport','ChatQueueReport','options','raw','debug','UpdateChatQueueReport','update','body','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x551fce,_0x131ca9){var _0x485540=function(_0x45176e){while(--_0x45176e){_0x551fce['push'](_0x551fce['shift']());}};_0x485540(++_0x131ca9);}(_0x8145,0xdd));var _0x5814=function(_0x59ccfd,_0x2e888d){_0x59ccfd=_0x59ccfd-0x0;var _0xb7ac6=_0x8145[_0x59ccfd];return _0xb7ac6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5814('0x0'));var BPromise=require(_0x5814('0x1'));var rs=require(_0x5814('0x2'));var fs=require('fs');var Redis=require(_0x5814('0x3'));var db=require(_0x5814('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5814('0x5'))(_0x5814('0x6'));var config=require('../../config/environment');var jayson=require(_0x5814('0x7'));var client=jayson['client'][_0x5814('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x201f77,_0x3d199e,_0x282ab7){return new BPromise(function(_0x567751,_0x1aad8f){return client[_0x5814('0x9')](_0x201f77,_0x282ab7)[_0x5814('0xa')](function(_0x5dd689){logger[_0x5814('0xb')](_0x5814('0xc'),_0x3d199e,_0x5814('0xd'));logger['debug'](_0x5814('0xe'),_0x3d199e,_0x5814('0xd'),JSON[_0x5814('0xf')](_0x5dd689));if(_0x5dd689[_0x5814('0x10')]){if(_0x5dd689[_0x5814('0x10')][_0x5814('0x11')]===0x1f4){logger[_0x5814('0x10')](_0x5814('0xc'),_0x3d199e,_0x5dd689[_0x5814('0x10')][_0x5814('0x12')]);return _0x1aad8f(_0x5dd689[_0x5814('0x10')]['message']);}logger[_0x5814('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x3d199e,_0x5dd689[_0x5814('0x10')][_0x5814('0x12')]);return _0x567751(_0x5dd689[_0x5814('0x10')]['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x3d199e,_0x5814('0xd'));_0x567751(_0x5dd689[_0x5814('0x13')][_0x5814('0x12')]);}})[_0x5814('0x14')](function(_0x38f48a){logger[_0x5814('0x10')](_0x5814('0xc'),_0x3d199e,_0x38f48a);_0x1aad8f(_0x38f48a);});});}exports[_0x5814('0x15')]=function(_0x3e2d8e){var _0x4c243d=this;return new Promise(function(_0x2a1ce5,_0x3c79e6){return db[_0x5814('0x16')]['create'](_0x3e2d8e['body'],{'raw':_0x3e2d8e[_0x5814('0x17')]?_0x3e2d8e[_0x5814('0x17')][_0x5814('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x30c3e6){logger[_0x5814('0xb')]('CreateChatQueueReport',_0x3e2d8e);logger[_0x5814('0x19')]('CreateChatQueueReport',_0x3e2d8e,JSON[_0x5814('0xf')](_0x30c3e6));_0x2a1ce5(_0x30c3e6);})['catch'](function(_0x5ea866){logger['error'](_0x5814('0x15'),_0x5ea866[_0x5814('0x12')],_0x3e2d8e);_0x3c79e6(_0x4c243d['error'](0x1f4,_0x5ea866[_0x5814('0x12')]));});});};exports[_0x5814('0x1a')]=function(_0xa9d511){var _0x591ece=this;return new Promise(function(_0x135529,_0x193a76){return db[_0x5814('0x16')][_0x5814('0x1b')](_0xa9d511[_0x5814('0x1c')],{'raw':_0xa9d511[_0x5814('0x17')]?_0xa9d511[_0x5814('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa9d511[_0x5814('0x17')]?_0xa9d511[_0x5814('0x17')][_0x5814('0x1d')]||null:null,'attributes':_0xa9d511['options']?_0xa9d511['options']['attributes']||null:null,'limit':_0xa9d511[_0x5814('0x17')]?_0xa9d511[_0x5814('0x17')]['limit']||null:null})[_0x5814('0xa')](function(_0x352b69){logger[_0x5814('0xb')](_0x5814('0x1a'),_0xa9d511);logger['debug']('UpdateChatQueueReport',_0xa9d511,JSON[_0x5814('0xf')](_0x352b69));_0x135529(_0x352b69);})[_0x5814('0x14')](function(_0x590a0b){logger['error'](_0x5814('0x1a'),_0x590a0b[_0x5814('0x12')],_0xa9d511);_0x193a76(_0x591ece[_0x5814('0x10')](0x1f4,_0x590a0b[_0x5814('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 5bb542b..9c2cf8f 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 _0xa4f4=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','update','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa4f4,0x1b8));var _0x4a4f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa4f4[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x4a4f('0x0'));var util=require(_0x4a4f('0x1'));var path=require('path');var timeout=require(_0x4a4f('0x2'));var express=require(_0x4a4f('0x3'));var router=express[_0x4a4f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a4f('0x5'));var interaction=require(_0x4a4f('0x6'));var config=require(_0x4a4f('0x7'));var controller=require(_0x4a4f('0x8'));router['get']('/',auth[_0x4a4f('0x9')](),controller[_0x4a4f('0xa')]);router[_0x4a4f('0xb')]('/describe',auth[_0x4a4f('0x9')](),controller[_0x4a4f('0xc')]);router[_0x4a4f('0xb')]('/:id',auth[_0x4a4f('0x9')](),controller[_0x4a4f('0xd')]);router[_0x4a4f('0xe')]('/',auth[_0x4a4f('0x9')](),controller[_0x4a4f('0xf')]);router[_0x4a4f('0x10')](_0x4a4f('0x11'),auth[_0x4a4f('0x9')](),controller[_0x4a4f('0x12')]);router['delete'](_0x4a4f('0x11'),auth['isAuthenticated'](),controller[_0x4a4f('0x13')]);module['exports']=router; \ No newline at end of file +var _0x50c6=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2fe0fe,_0x46da20){var _0x62d3f2=function(_0x3b722c){while(--_0x3b722c){_0x2fe0fe['push'](_0x2fe0fe['shift']());}};_0x62d3f2(++_0x46da20);}(_0x50c6,0x113));var _0x650c=function(_0x3650d1,_0x4d275e){_0x3650d1=_0x3650d1-0x0;var _0x32f21e=_0x50c6[_0x3650d1];return _0x32f21e;};'use strict';var multer=require(_0x650c('0x0'));var util=require(_0x650c('0x1'));var path=require(_0x650c('0x2'));var timeout=require(_0x650c('0x3'));var express=require(_0x650c('0x4'));var router=express[_0x650c('0x5')]();var fs_extra=require(_0x650c('0x6'));var auth=require(_0x650c('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x650c('0x8'));var controller=require('./chatQueueReport.controller');router[_0x650c('0x9')]('/',auth[_0x650c('0xa')](),controller[_0x650c('0xb')]);router['get'](_0x650c('0xc'),auth[_0x650c('0xa')](),controller[_0x650c('0xd')]);router[_0x650c('0x9')](_0x650c('0xe'),auth[_0x650c('0xa')](),controller[_0x650c('0xf')]);router[_0x650c('0x10')]('/',auth[_0x650c('0xa')](),controller[_0x650c('0x11')]);router[_0x650c('0x12')](_0x650c('0xe'),auth['isAuthenticated'](),controller[_0x650c('0x13')]);router[_0x650c('0x14')]('/:id',auth[_0x650c('0xa')](),controller[_0x650c('0x15')]);module[_0x650c('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 4138024..d8b9fe1 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x1f1e7d,_0x476a17){var _0x205a30=function(_0x58a806){while(--_0x58a806){_0x1f1e7d['push'](_0x1f1e7d['shift']());}};_0x205a30(++_0x476a17);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0xf3cd[_0x52f159];return _0x156799;};'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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x39215e,_0x3938b9){var _0x443f38=function(_0x399f47){while(--_0x399f47){_0x39215e['push'](_0x39215e['shift']());}};_0x443f38(++_0x3938b9);}(_0xedd9,0xfc));var _0x9edd=function(_0x3431e2,_0x13b280){_0x3431e2=_0x3431e2-0x0;var _0x2cacfa=_0xedd9[_0x3431e2];return _0x2cacfa;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2ec9b5a..30be5ee 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 _0x62b8=['undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','ChatTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','rawAttributes','find','create','update','body','describe','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status'];(function(_0x312d9f,_0x843ecc){var _0x1d9e22=function(_0x91e95){while(--_0x91e95){_0x312d9f['push'](_0x312d9f['shift']());}};_0x1d9e22(++_0x843ecc);}(_0x62b8,0x142));var _0x862b=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x62b8[_0x1a72f3];return _0x57ef47;};'use strict';var emlformat=require(_0x862b('0x0'));var rimraf=require(_0x862b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x862b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x862b('0x3'));var util=require(_0x862b('0x4'));var path=require(_0x862b('0x5'));var sox=require('sox');var csv=require(_0x862b('0x6'));var ejs=require(_0x862b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x862b('0x8'));var squel=require(_0x862b('0x9'));var crypto=require(_0x862b('0xa'));var jsforce=require(_0x862b('0xb'));var deskjs=require(_0x862b('0xc'));var toCsv=require(_0x862b('0x6'));var querystring=require('querystring');var Papa=require(_0x862b('0xd'));var Redis=require(_0x862b('0xe'));var authService=require(_0x862b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x862b('0x10'));var hardwareService=require(_0x862b('0x11'));var logger=require(_0x862b('0x12'))(_0x862b('0x13'));var utils=require(_0x862b('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dc5f1,_0x32aa92){_0x32aa92=_0x32aa92||0xcc;return function(_0x399e9b){if(_0x399e9b){return _0x4dc5f1[_0x862b('0x15')](_0x32aa92);}return _0x4dc5f1[_0x862b('0x16')](_0x32aa92)['end']();};}function respondWithResult(_0x19a9b2,_0x1fc2b1){_0x1fc2b1=_0x1fc2b1||0xc8;return function(_0x5ddbd2){if(_0x5ddbd2){return _0x19a9b2[_0x862b('0x16')](_0x1fc2b1)['json'](_0x5ddbd2);}};}function respondWithFilteredResult(_0x39025b,_0x4854c1){return function(_0x6eb3d7){if(_0x6eb3d7){var _0x45dc0f=typeof _0x4854c1['offset']===_0x862b('0x17')&&typeof _0x4854c1[_0x862b('0x18')]===_0x862b('0x17');var _0x15e22f=_0x6eb3d7[_0x862b('0x19')];var _0x29a4fa=_0x45dc0f?0x0:_0x4854c1[_0x862b('0x1a')];var _0x16d314=_0x45dc0f?_0x6eb3d7[_0x862b('0x19')]:_0x4854c1[_0x862b('0x1a')]+_0x4854c1['limit'];var _0x383b9f;if(_0x16d314>=_0x15e22f){_0x16d314=_0x15e22f;_0x383b9f=0xc8;}else{_0x383b9f=0xce;}_0x39025b[_0x862b('0x16')](_0x383b9f);return _0x39025b[_0x862b('0x1b')](_0x862b('0x1c'),_0x29a4fa+'-'+_0x16d314+'/'+_0x15e22f)[_0x862b('0x1d')](_0x6eb3d7);}return null;};}function patchUpdates(_0xd93935){return function(_0x89a113){try{jsonpatch[_0x862b('0x1e')](_0x89a113,_0xd93935,!![]);}catch(_0x3b6634){return BPromise[_0x862b('0x1f')](_0x3b6634);}return _0x89a113[_0x862b('0x20')]();};}function saveUpdates(_0x4ae519,_0x1a5c92){return function(_0x49bfae){if(_0x49bfae){return _0x49bfae['update'](_0x4ae519)[_0x862b('0x21')](function(_0x1d4958){return _0x1d4958;});}return null;};}function removeEntity(_0x50149f,_0x41359d){return function(_0x1bad82){if(_0x1bad82){return _0x1bad82[_0x862b('0x22')]()[_0x862b('0x21')](function(){_0x50149f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28baaa,_0x53abac){return function(_0x4d787d){if(!_0x4d787d){_0x28baaa[_0x862b('0x15')](0x194);}return _0x4d787d;};}function handleError(_0x40e002,_0x4f6175){_0x4f6175=_0x4f6175||0x1f4;return function(_0x2eb219){logger[_0x862b('0x23')](_0x2eb219['stack']);if(_0x2eb219[_0x862b('0x24')]){delete _0x2eb219['name'];}_0x40e002['status'](_0x4f6175)[_0x862b('0x25')](_0x2eb219);};}exports['index']=function(_0x21ab35,_0x325669){var _0x277734={},_0x550a0b={},_0x5a4f1e={'count':0x0,'rows':[]};var _0x1cffaf=_['map'](db[_0x862b('0x26')]['rawAttributes'],function(_0x4dce3c){return{'name':_0x4dce3c[_0x862b('0x27')],'type':_0x4dce3c[_0x862b('0x28')][_0x862b('0x29')]};});_0x550a0b[_0x862b('0x2a')]=_[_0x862b('0x2b')](_0x1cffaf,_0x862b('0x24'));_0x550a0b[_0x862b('0x2c')]=_[_0x862b('0x2d')](_0x21ab35['query']);_0x550a0b[_0x862b('0x2e')]=_[_0x862b('0x2f')](_0x550a0b[_0x862b('0x2a')],_0x550a0b['query']);_0x277734[_0x862b('0x30')]=_[_0x862b('0x2f')](_0x550a0b[_0x862b('0x2a')],qs['fields'](_0x21ab35[_0x862b('0x2c')][_0x862b('0x31')]));_0x277734[_0x862b('0x30')]=_0x277734['attributes']['length']?_0x277734[_0x862b('0x30')]:_0x550a0b['model'];if(!_0x21ab35[_0x862b('0x2c')]['hasOwnProperty'](_0x862b('0x32'))){_0x277734['limit']=qs['limit'](_0x21ab35['query'][_0x862b('0x18')]);_0x277734[_0x862b('0x1a')]=qs[_0x862b('0x1a')](_0x21ab35[_0x862b('0x2c')][_0x862b('0x1a')]);}_0x277734[_0x862b('0x33')]=qs['sort'](_0x21ab35[_0x862b('0x2c')]['sort']);_0x277734[_0x862b('0x34')]=qs[_0x862b('0x2e')](_[_0x862b('0x35')](_0x21ab35['query'],_0x550a0b[_0x862b('0x2e')]),_0x1cffaf);if(_0x21ab35[_0x862b('0x2c')][_0x862b('0x36')]){_0x277734[_0x862b('0x34')]=_[_0x862b('0x37')](_0x277734[_0x862b('0x34')],{'$or':_[_0x862b('0x2b')](_0x1cffaf,function(_0x3b73b5){if(_0x3b73b5[_0x862b('0x28')]!==_0x862b('0x38')){var _0x221d36={};_0x221d36[_0x3b73b5[_0x862b('0x24')]]={'$like':'%'+_0x21ab35[_0x862b('0x2c')][_0x862b('0x36')]+'%'};return _0x221d36;}})});}_0x277734=_['merge']({},_0x277734,_0x21ab35[_0x862b('0x39')]);var _0x37d43e={'where':_0x277734['where']};return db[_0x862b('0x26')][_0x862b('0x19')](_0x37d43e)[_0x862b('0x21')](function(_0x74661d){_0x5a4f1e[_0x862b('0x19')]=_0x74661d;if(_0x21ab35[_0x862b('0x2c')][_0x862b('0x3a')]){_0x277734[_0x862b('0x3b')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x277734);})[_0x862b('0x21')](function(_0x3b518d){_0x5a4f1e['rows']=_0x3b518d;return _0x5a4f1e;})['then'](respondWithFilteredResult(_0x325669,_0x277734))[_0x862b('0x3c')](handleError(_0x325669,null));};exports[_0x862b('0x3d')]=function(_0x3428a2,_0x236719){var _0x5a43e3={'raw':!![],'where':{'id':_0x3428a2[_0x862b('0x3e')]['id']}},_0x3e4a8a={};_0x3e4a8a[_0x862b('0x2a')]=_[_0x862b('0x2d')](db[_0x862b('0x26')][_0x862b('0x3f')]);_0x3e4a8a[_0x862b('0x2c')]=_[_0x862b('0x2d')](_0x3428a2[_0x862b('0x2c')]);_0x3e4a8a['filters']=_[_0x862b('0x2f')](_0x3e4a8a[_0x862b('0x2a')],_0x3e4a8a['query']);_0x5a43e3[_0x862b('0x30')]=_[_0x862b('0x2f')](_0x3e4a8a[_0x862b('0x2a')],qs[_0x862b('0x31')](_0x3428a2[_0x862b('0x2c')]['fields']));_0x5a43e3['attributes']=_0x5a43e3[_0x862b('0x30')]['length']?_0x5a43e3[_0x862b('0x30')]:_0x3e4a8a['model'];if(_0x3428a2['query'][_0x862b('0x3a')]){_0x5a43e3[_0x862b('0x3b')]=[{'all':!![]}];}_0x5a43e3=_[_0x862b('0x37')]({},_0x5a43e3,_0x3428a2[_0x862b('0x39')]);return db[_0x862b('0x26')][_0x862b('0x40')](_0x5a43e3)[_0x862b('0x21')](handleEntityNotFound(_0x236719,null))['then'](respondWithResult(_0x236719,null))[_0x862b('0x3c')](handleError(_0x236719,null));};exports['create']=function(_0x3644a7,_0x1c7828){return db[_0x862b('0x26')][_0x862b('0x41')](_0x3644a7['body'],{})[_0x862b('0x21')](respondWithResult(_0x1c7828,0xc9))['catch'](handleError(_0x1c7828,null));};exports[_0x862b('0x42')]=function(_0x809b7,_0x2bbe46){if(_0x809b7[_0x862b('0x43')]['id']){delete _0x809b7[_0x862b('0x43')]['id'];}return db['ChatTransferReport'][_0x862b('0x40')]({'where':{'id':_0x809b7[_0x862b('0x3e')]['id']}})[_0x862b('0x21')](handleEntityNotFound(_0x2bbe46,null))[_0x862b('0x21')](saveUpdates(_0x809b7[_0x862b('0x43')],null))[_0x862b('0x21')](respondWithResult(_0x2bbe46,null))[_0x862b('0x3c')](handleError(_0x2bbe46,null));};exports[_0x862b('0x22')]=function(_0x3a3e65,_0x5e129e){return db[_0x862b('0x26')][_0x862b('0x40')]({'where':{'id':_0x3a3e65['params']['id']}})[_0x862b('0x21')](handleEntityNotFound(_0x5e129e,null))[_0x862b('0x21')](removeEntity(_0x5e129e,null))[_0x862b('0x3c')](handleError(_0x5e129e,null));};exports['describe']=function(_0x280db5,_0x7dbbe4){return db[_0x862b('0x26')][_0x862b('0x44')]()[_0x862b('0x21')](respondWithResult(_0x7dbbe4,null))[_0x862b('0x3c')](handleError(_0x7dbbe4,null));}; \ No newline at end of file +var _0x9d6e=['end','error','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','destroy','then'];(function(_0x58a31f,_0x568175){var _0x4986a1=function(_0x29263e){while(--_0x29263e){_0x58a31f['push'](_0x58a31f['shift']());}};_0x4986a1(++_0x568175);}(_0x9d6e,0x111));var _0xe9d6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9d6e[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9d6('0x0'));var zipdir=require(_0xe9d6('0x1'));var jsonpatch=require(_0xe9d6('0x2'));var rp=require(_0xe9d6('0x3'));var moment=require(_0xe9d6('0x4'));var BPromise=require(_0xe9d6('0x5'));var Mustache=require(_0xe9d6('0x6'));var util=require('util');var path=require(_0xe9d6('0x7'));var sox=require(_0xe9d6('0x8'));var csv=require(_0xe9d6('0x9'));var ejs=require(_0xe9d6('0xa'));var fs=require('fs');var fs_extra=require(_0xe9d6('0xb'));var _=require(_0xe9d6('0xc'));var squel=require('squel');var crypto=require(_0xe9d6('0xd'));var jsforce=require(_0xe9d6('0xe'));var deskjs=require(_0xe9d6('0xf'));var toCsv=require(_0xe9d6('0x9'));var querystring=require(_0xe9d6('0x10'));var Papa=require('papaparse');var Redis=require(_0xe9d6('0x11'));var authService=require(_0xe9d6('0x12'));var qs=require(_0xe9d6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9d6('0x14'))(_0xe9d6('0x15'));var utils=require(_0xe9d6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe9d6('0x17'));var db=require(_0xe9d6('0x18'))['db'];function respondWithStatusCode(_0x21f5e9,_0x3784a6){_0x3784a6=_0x3784a6||0xcc;return function(_0x4ca6f5){if(_0x4ca6f5){return _0x21f5e9[_0xe9d6('0x19')](_0x3784a6);}return _0x21f5e9[_0xe9d6('0x1a')](_0x3784a6)['end']();};}function respondWithResult(_0x6a2634,_0x48bb43){_0x48bb43=_0x48bb43||0xc8;return function(_0x4a8058){if(_0x4a8058){return _0x6a2634['status'](_0x48bb43)['json'](_0x4a8058);}};}function respondWithFilteredResult(_0x41f905,_0x2e7781){return function(_0x228856){if(_0x228856){var _0xe8f2ad=typeof _0x2e7781['offset']===_0xe9d6('0x1b')&&typeof _0x2e7781[_0xe9d6('0x1c')]==='undefined';var _0x15aad0=_0x228856[_0xe9d6('0x1d')];var _0x3f71a3=_0xe8f2ad?0x0:_0x2e7781[_0xe9d6('0x1e')];var _0x18b506=_0xe8f2ad?_0x228856['count']:_0x2e7781['offset']+_0x2e7781[_0xe9d6('0x1c')];var _0x1d2999;if(_0x18b506>=_0x15aad0){_0x18b506=_0x15aad0;_0x1d2999=0xc8;}else{_0x1d2999=0xce;}_0x41f905['status'](_0x1d2999);return _0x41f905[_0xe9d6('0x1f')](_0xe9d6('0x20'),_0x3f71a3+'-'+_0x18b506+'/'+_0x15aad0)[_0xe9d6('0x21')](_0x228856);}return null;};}function patchUpdates(_0x296146){return function(_0x5417c3){try{jsonpatch[_0xe9d6('0x22')](_0x5417c3,_0x296146,!![]);}catch(_0x2ef86e){return BPromise['reject'](_0x2ef86e);}return _0x5417c3[_0xe9d6('0x23')]();};}function saveUpdates(_0x1dd090,_0x1b62c9){return function(_0x939813){if(_0x939813){return _0x939813[_0xe9d6('0x24')](_0x1dd090)['then'](function(_0x4b111d){return _0x4b111d;});}return null;};}function removeEntity(_0x2a3f9f,_0x16d5de){return function(_0x26bbaa){if(_0x26bbaa){return _0x26bbaa[_0xe9d6('0x25')]()[_0xe9d6('0x26')](function(){_0x2a3f9f[_0xe9d6('0x1a')](0xcc)[_0xe9d6('0x27')]();});}};}function handleEntityNotFound(_0x48155d,_0x36aa1e){return function(_0xef0156){if(!_0xef0156){_0x48155d[_0xe9d6('0x19')](0x194);}return _0xef0156;};}function handleError(_0x222fb4,_0x2f863a){_0x2f863a=_0x2f863a||0x1f4;return function(_0x228b61){logger[_0xe9d6('0x28')](_0x228b61[_0xe9d6('0x29')]);if(_0x228b61['name']){delete _0x228b61[_0xe9d6('0x2a')];}_0x222fb4[_0xe9d6('0x1a')](_0x2f863a)[_0xe9d6('0x2b')](_0x228b61);};}exports[_0xe9d6('0x2c')]=function(_0x4457ee,_0x2badf2){var _0x48d710={},_0x413f1a={},_0x14ba78={'count':0x0,'rows':[]};var _0x448a4e=_['map'](db[_0xe9d6('0x2d')][_0xe9d6('0x2e')],function(_0xdbd372){return{'name':_0xdbd372[_0xe9d6('0x2f')],'type':_0xdbd372[_0xe9d6('0x30')][_0xe9d6('0x31')]};});_0x413f1a[_0xe9d6('0x32')]=_[_0xe9d6('0x33')](_0x448a4e,_0xe9d6('0x2a'));_0x413f1a[_0xe9d6('0x34')]=_[_0xe9d6('0x35')](_0x4457ee[_0xe9d6('0x34')]);_0x413f1a[_0xe9d6('0x36')]=_['intersection'](_0x413f1a[_0xe9d6('0x32')],_0x413f1a[_0xe9d6('0x34')]);_0x48d710['attributes']=_[_0xe9d6('0x37')](_0x413f1a[_0xe9d6('0x32')],qs[_0xe9d6('0x38')](_0x4457ee['query']['fields']));_0x48d710[_0xe9d6('0x39')]=_0x48d710['attributes'][_0xe9d6('0x3a')]?_0x48d710[_0xe9d6('0x39')]:_0x413f1a['model'];if(!_0x4457ee[_0xe9d6('0x34')][_0xe9d6('0x3b')]('nolimit')){_0x48d710[_0xe9d6('0x1c')]=qs[_0xe9d6('0x1c')](_0x4457ee[_0xe9d6('0x34')]['limit']);_0x48d710[_0xe9d6('0x1e')]=qs[_0xe9d6('0x1e')](_0x4457ee[_0xe9d6('0x34')][_0xe9d6('0x1e')]);}_0x48d710[_0xe9d6('0x3c')]=qs[_0xe9d6('0x3d')](_0x4457ee['query'][_0xe9d6('0x3d')]);_0x48d710[_0xe9d6('0x3e')]=qs['filters'](_[_0xe9d6('0x3f')](_0x4457ee['query'],_0x413f1a[_0xe9d6('0x36')]),_0x448a4e);if(_0x4457ee[_0xe9d6('0x34')][_0xe9d6('0x40')]){_0x48d710[_0xe9d6('0x3e')]=_[_0xe9d6('0x41')](_0x48d710[_0xe9d6('0x3e')],{'$or':_[_0xe9d6('0x33')](_0x448a4e,function(_0x115cb9){if(_0x115cb9[_0xe9d6('0x30')]!==_0xe9d6('0x42')){var _0x31b9c9={};_0x31b9c9[_0x115cb9[_0xe9d6('0x2a')]]={'$like':'%'+_0x4457ee[_0xe9d6('0x34')][_0xe9d6('0x40')]+'%'};return _0x31b9c9;}})});}_0x48d710=_[_0xe9d6('0x41')]({},_0x48d710,_0x4457ee[_0xe9d6('0x43')]);var _0x548789={'where':_0x48d710[_0xe9d6('0x3e')]};return db[_0xe9d6('0x2d')]['count'](_0x548789)[_0xe9d6('0x26')](function(_0x31f890){_0x14ba78[_0xe9d6('0x1d')]=_0x31f890;if(_0x4457ee[_0xe9d6('0x34')][_0xe9d6('0x44')]){_0x48d710['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0xe9d6('0x45')](_0x48d710);})[_0xe9d6('0x26')](function(_0x47c8d7){_0x14ba78[_0xe9d6('0x46')]=_0x47c8d7;return _0x14ba78;})[_0xe9d6('0x26')](respondWithFilteredResult(_0x2badf2,_0x48d710))[_0xe9d6('0x47')](handleError(_0x2badf2,null));};exports['show']=function(_0x3428c6,_0x31f95b){var _0x443ebf={'raw':!![],'where':{'id':_0x3428c6[_0xe9d6('0x48')]['id']}},_0x3a2331={};_0x3a2331['model']=_[_0xe9d6('0x35')](db[_0xe9d6('0x2d')][_0xe9d6('0x2e')]);_0x3a2331[_0xe9d6('0x34')]=_[_0xe9d6('0x35')](_0x3428c6[_0xe9d6('0x34')]);_0x3a2331[_0xe9d6('0x36')]=_[_0xe9d6('0x37')](_0x3a2331[_0xe9d6('0x32')],_0x3a2331[_0xe9d6('0x34')]);_0x443ebf[_0xe9d6('0x39')]=_['intersection'](_0x3a2331[_0xe9d6('0x32')],qs[_0xe9d6('0x38')](_0x3428c6['query'][_0xe9d6('0x38')]));_0x443ebf[_0xe9d6('0x39')]=_0x443ebf[_0xe9d6('0x39')][_0xe9d6('0x3a')]?_0x443ebf['attributes']:_0x3a2331[_0xe9d6('0x32')];if(_0x3428c6['query'][_0xe9d6('0x44')]){_0x443ebf[_0xe9d6('0x49')]=[{'all':!![]}];}_0x443ebf=_[_0xe9d6('0x41')]({},_0x443ebf,_0x3428c6['options']);return db[_0xe9d6('0x2d')][_0xe9d6('0x4a')](_0x443ebf)['then'](handleEntityNotFound(_0x31f95b,null))['then'](respondWithResult(_0x31f95b,null))[_0xe9d6('0x47')](handleError(_0x31f95b,null));};exports['create']=function(_0xac3382,_0x21247b){return db['ChatTransferReport'][_0xe9d6('0x4b')](_0xac3382[_0xe9d6('0x4c')],{})['then'](respondWithResult(_0x21247b,0xc9))[_0xe9d6('0x47')](handleError(_0x21247b,null));};exports[_0xe9d6('0x24')]=function(_0x28aee5,_0x4a7237){if(_0x28aee5[_0xe9d6('0x4c')]['id']){delete _0x28aee5[_0xe9d6('0x4c')]['id'];}return db[_0xe9d6('0x2d')][_0xe9d6('0x4a')]({'where':{'id':_0x28aee5['params']['id']}})[_0xe9d6('0x26')](handleEntityNotFound(_0x4a7237,null))[_0xe9d6('0x26')](saveUpdates(_0x28aee5[_0xe9d6('0x4c')],null))[_0xe9d6('0x26')](respondWithResult(_0x4a7237,null))[_0xe9d6('0x47')](handleError(_0x4a7237,null));};exports[_0xe9d6('0x25')]=function(_0x4325e1,_0x45c685){return db[_0xe9d6('0x2d')][_0xe9d6('0x4a')]({'where':{'id':_0x4325e1[_0xe9d6('0x48')]['id']}})[_0xe9d6('0x26')](handleEntityNotFound(_0x45c685,null))[_0xe9d6('0x26')](removeEntity(_0x45c685,null))[_0xe9d6('0x47')](handleError(_0x45c685,null));};exports[_0xe9d6('0x4d')]=function(_0x1a26fe,_0x5c2d6c){return db[_0xe9d6('0x2d')][_0xe9d6('0x4d')]()['then'](respondWithResult(_0x5c2d6c,null))[_0xe9d6('0x47')](handleError(_0x5c2d6c,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 71d055f..61b9b5e 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 _0xb7c8=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','moment','bluebird'];(function(_0x484999,_0x57181d){var _0x240762=function(_0x4b0433){while(--_0x4b0433){_0x484999['push'](_0x484999['shift']());}};_0x240762(++_0x57181d);}(_0xb7c8,0xd4));var _0x8b7c=function(_0x27342a,_0x9a6b52){_0x27342a=_0x27342a-0x0;var _0x444cc4=_0xb7c8[_0x27342a];return _0x444cc4;};'use strict';var _=require(_0x8b7c('0x0'));var util=require(_0x8b7c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8b7c('0x2'));var BPromise=require(_0x8b7c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8b7c('0x4'));var config=require(_0x8b7c('0x5'));var attributes=require(_0x8b7c('0x6'));module[_0x8b7c('0x7')]=function(_0x2f1c6e,_0xb93eec){return _0x2f1c6e[_0x8b7c('0x8')](_0x8b7c('0x9'),attributes,{'tableName':_0x8b7c('0xa'),'paranoid':![],'indexes':[{'name':_0x8b7c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0544=['path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x26ba35,_0x3816f5){var _0x1d073e=function(_0x7ff982){while(--_0x7ff982){_0x26ba35['push'](_0x26ba35['shift']());}};_0x1d073e(++_0x3816f5);}(_0x0544,0x6b));var _0x4054=function(_0x2136a6,_0x35af63){_0x2136a6=_0x2136a6-0x0;var _0x55b948=_0x0544[_0x2136a6];return _0x55b948;};'use strict';var _=require('lodash');var util=require(_0x4054('0x0'));var logger=require(_0x4054('0x1'))('api');var moment=require(_0x4054('0x2'));var BPromise=require(_0x4054('0x3'));var rp=require(_0x4054('0x4'));var fs=require('fs');var path=require(_0x4054('0x5'));var rimraf=require(_0x4054('0x6'));var config=require(_0x4054('0x7'));var attributes=require(_0x4054('0x8'));module[_0x4054('0x9')]=function(_0x37e492,_0x4ef540){return _0x37e492[_0x4054('0xa')](_0x4054('0xb'),attributes,{'tableName':_0x4054('0xc'),'paranoid':![],'indexes':[{'name':_0x4054('0xd'),'fields':[_0x4054('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 215a56c..19dce5f 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 _0x841e=['client','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x15748b,_0x3a28e3){var _0x1ac58d=function(_0x16850e){while(--_0x16850e){_0x15748b['push'](_0x15748b['shift']());}};_0x1ac58d(++_0x3a28e3);}(_0x841e,0x1d9));var _0xe841=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x841e[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xe841('0x0'));var util=require('util');var moment=require(_0xe841('0x1'));var BPromise=require(_0xe841('0x2'));var rs=require(_0xe841('0x3'));var fs=require('fs');var Redis=require(_0xe841('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe841('0x5'));var logger=require('../../config/logger')(_0xe841('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe841('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d6cdb,_0x52b835,_0x41ebce){return new BPromise(function(_0x255673,_0x560cdb){return client['request'](_0x1d6cdb,_0x41ebce)[_0xe841('0x8')](function(_0x16fc08){logger[_0xe841('0x9')]('ChatTransferReport,\x20%s,\x20%s',_0x52b835,_0xe841('0xa'));logger[_0xe841('0xb')](_0xe841('0xc'),_0x52b835,_0xe841('0xa'),JSON[_0xe841('0xd')](_0x16fc08));if(_0x16fc08[_0xe841('0xe')]){if(_0x16fc08[_0xe841('0xe')][_0xe841('0xf')]===0x1f4){logger[_0xe841('0xe')](_0xe841('0x10'),_0x52b835,_0x16fc08[_0xe841('0xe')][_0xe841('0x11')]);return _0x560cdb(_0x16fc08[_0xe841('0xe')][_0xe841('0x11')]);}logger[_0xe841('0xe')](_0xe841('0x10'),_0x52b835,_0x16fc08[_0xe841('0xe')][_0xe841('0x11')]);return _0x255673(_0x16fc08[_0xe841('0xe')][_0xe841('0x11')]);}else{logger[_0xe841('0x9')]('ChatTransferReport,\x20%s,\x20%s',_0x52b835,'request\x20sent');_0x255673(_0x16fc08[_0xe841('0x12')][_0xe841('0x11')]);}})[_0xe841('0x13')](function(_0x266a2f){logger[_0xe841('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x52b835,_0x266a2f);_0x560cdb(_0x266a2f);});});} \ No newline at end of file +var _0x305f=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util'];(function(_0x47e41e,_0x12bf58){var _0xf81f18=function(_0x217456){while(--_0x217456){_0x47e41e['push'](_0x47e41e['shift']());}};_0xf81f18(++_0x12bf58);}(_0x305f,0x1c6));var _0xf305=function(_0x1b0bd0,_0xbbe219){_0x1b0bd0=_0x1b0bd0-0x0;var _0x2a0018=_0x305f[_0x1b0bd0];return _0x2a0018;};'use strict';var _=require(_0xf305('0x0'));var util=require(_0xf305('0x1'));var moment=require(_0xf305('0x2'));var BPromise=require(_0xf305('0x3'));var rs=require(_0xf305('0x4'));var fs=require('fs');var Redis=require(_0xf305('0x5'));var db=require(_0xf305('0x6'))['db'];var utils=require(_0xf305('0x7'));var logger=require('../../config/logger')(_0xf305('0x8'));var config=require('../../config/environment');var jayson=require(_0xf305('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x176f8c,_0xd87da6,_0x2e1d5b){return new BPromise(function(_0x29d811,_0x338014){return client[_0xf305('0xa')](_0x176f8c,_0x2e1d5b)['then'](function(_0x33a479){logger[_0xf305('0xb')](_0xf305('0xc'),_0xd87da6,_0xf305('0xd'));logger[_0xf305('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xd87da6,_0xf305('0xd'),JSON['stringify'](_0x33a479));if(_0x33a479[_0xf305('0xf')]){if(_0x33a479[_0xf305('0xf')][_0xf305('0x10')]===0x1f4){logger[_0xf305('0xf')](_0xf305('0xc'),_0xd87da6,_0x33a479[_0xf305('0xf')][_0xf305('0x11')]);return _0x338014(_0x33a479[_0xf305('0xf')][_0xf305('0x11')]);}logger['error'](_0xf305('0xc'),_0xd87da6,_0x33a479['error'][_0xf305('0x11')]);return _0x29d811(_0x33a479[_0xf305('0xf')][_0xf305('0x11')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0xd87da6,_0xf305('0xd'));_0x29d811(_0x33a479[_0xf305('0x12')]['message']);}})['catch'](function(_0x42edb8){logger[_0xf305('0xf')](_0xf305('0xc'),_0xd87da6,_0x42edb8);_0x338014(_0x42edb8);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index b271ab6..4de85b8 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 _0x525a=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','exports'];(function(_0x3b5431,_0x1809f9){var _0x161318=function(_0x522bc2){while(--_0x522bc2){_0x3b5431['push'](_0x3b5431['shift']());}};_0x161318(++_0x1809f9);}(_0x525a,0x140));var _0xa525=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0x525a[_0x53c256];return _0x25feb6;};'use strict';var multer=require('multer');var util=require(_0xa525('0x0'));var path=require(_0xa525('0x1'));var timeout=require(_0xa525('0x2'));var express=require('express');var router=express[_0xa525('0x3')]();var fs_extra=require(_0xa525('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa525('0x5'));var config=require('../../config/environment');var controller=require(_0xa525('0x6'));router[_0xa525('0x7')]('/',auth[_0xa525('0x8')](),controller[_0xa525('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xa525('0xa')]);router[_0xa525('0x7')](_0xa525('0xb'),auth[_0xa525('0x8')](),controller['show']);router[_0xa525('0xc')]('/',auth[_0xa525('0x8')](),controller[_0xa525('0xd')]);router[_0xa525('0xe')]('/:id',auth[_0xa525('0x8')](),controller['update']);router['delete']('/:id',auth[_0xa525('0x8')](),controller['destroy']);module[_0xa525('0xf')]=router; \ No newline at end of file +var _0x4911=['get','describe','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index'];(function(_0x5b8c2f,_0x20bb13){var _0x425952=function(_0x5c604a){while(--_0x5c604a){_0x5b8c2f['push'](_0x5b8c2f['shift']());}};_0x425952(++_0x20bb13);}(_0x4911,0x7c));var _0x1491=function(_0x5d289a,_0x352880){_0x5d289a=_0x5d289a-0x0;var _0x14bd5f=_0x4911[_0x5d289a];return _0x14bd5f;};'use strict';var multer=require(_0x1491('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1491('0x1'));var express=require(_0x1491('0x2'));var router=express[_0x1491('0x3')]();var fs_extra=require(_0x1491('0x4'));var auth=require(_0x1491('0x5'));var interaction=require(_0x1491('0x6'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router['get']('/',auth[_0x1491('0x7')](),controller[_0x1491('0x8')]);router[_0x1491('0x9')]('/describe',auth[_0x1491('0x7')](),controller[_0x1491('0xa')]);router[_0x1491('0x9')](_0x1491('0xb'),auth['isAuthenticated'](),controller[_0x1491('0xc')]);router['post']('/',auth[_0x1491('0x7')](),controller[_0x1491('0xd')]);router[_0x1491('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1491('0xf')]);router[_0x1491('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1491('0x11')]);module[_0x1491('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index e7aabae..bb914e9 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 _0xb821=['All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','address','email','STRING','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','text','name','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','parse','generate'];(function(_0x43422c,_0x104710){var _0x324c36=function(_0x20416d){while(--_0x20416d){_0x43422c['push'](_0x43422c['shift']());}};_0x324c36(++_0x104710);}(_0xb821,0xa7));var _0x1b82=function(_0x50a3af,_0x265ce9){_0x50a3af=_0x50a3af-0x0;var _0x5c7e02=_0xb821[_0x50a3af];return _0x5c7e02;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x1b82('0x0'));module[_0x1b82('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1b82('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x1b82('0x3')},'mapKeyOffline':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0x3')},'key':{'type':Sequelize[_0x1b82('0x4')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x1b82('0x5')},'customerAlias':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x1b82('0x4')],'allowNull':![],'defaultValue':_0x1b82('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1b82('0x4')],'allowNull':![],'defaultValue':_0x1b82('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1b82('0x4')],'allowNull':![],'defaultValue':_0x1b82('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x1b82('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1b82('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1b82('0x4')]},'animation':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1b82('0xa')](_0x1b82('0xb'),_0x1b82('0xc')),'defaultValue':_0x1b82('0xb')},'header_online':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0xd')},'offline_chat_button':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x1b82('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1b82('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x1b82('0x11')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0x12')},'placeholderMessage':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x1b82('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x1b82('0xe')},'skipMessageButton':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0x14')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0x15')},'ratingType':{'type':Sequelize['ENUM'](_0x1b82('0x16'),_0x1b82('0x17')),'defaultValue':_0x1b82('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x1b82('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x1b82('0x10')],'defaultValue':function(){return JSON[_0x1b82('0x18')]({'items':[{'type':_0x1b82('0x19'),'variable':null,'config':{'placeholder':'name','type':_0x1b82('0x1a'),'required':!![]},'props':{'title':_0x1b82('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0x1b82('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x1b82('0x3'),'type':_0x1b82('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x1b82('0x1c'))?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0xf2e556){return this[_0x1b82('0x1d')](_0x1b82('0x1c'),JSON[_0x1b82('0x18')](_0xf2e556));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1b82('0x18')]({'items':[{'type':_0x1b82('0x19'),'props':{'title':_0x1b82('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x1b82('0x3'),'type':_0x1b82('0x3')},'variable':null},{'type':_0x1b82('0x1e'),'config':{'placeholder':_0x1b82('0x1f')},'props':{'title':_0x1b82('0x1f'),'helpText':_0x1b82('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0x1b82('0x21')](_0x1b82('0x22'))?JSON[_0x1b82('0x23')](this[_0x1b82('0x21')]('offlineForm')):{};},'set':function(_0x17b3aa){return this[_0x1b82('0x1d')](_0x1b82('0x22'),JSON[_0x1b82('0x18')](_0x17b3aa));}},'token':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':function(){return rs[_0x1b82('0x24')]();}},'autoclose':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1b82('0x4')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x1b82('0x4')]},'waitingTitle':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0x25')},'waitingMessage':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x1b82('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x1b82('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1b82('0x10')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1b82('0x4')]},'notificationTemplate':{'type':Sequelize[_0x1b82('0x10')],'defaultValue':function(){return _0x1b82('0x28');}},'notificationSound':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0x29')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x1b82('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0x2b')},'messagesAlignment':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0x2c')},'defaultTitle':{'type':Sequelize[_0x1b82('0x4')]},'customerAvatar':{'type':Sequelize[_0x1b82('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x1b82('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':_0x1b82('0x2d')},'systemAvatar':{'type':Sequelize[_0x1b82('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1b82('0x8')],'comment':_0x1b82('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x1b82('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x17d214){if(!_0x17d214)this['setDataValue'](_0x1b82('0x2f'),null);this['setDataValue'](_0x1b82('0x30'),_0x17d214);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x1b82('0x4')],'allowNull':![],'defaultValue':_0x1b82('0x31')},'vidaooNote':{'type':Sequelize[_0x1b82('0x4')],'defaultValue':function(){return _0x1b82('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x1b82('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x1b82('0x10')]}}; \ No newline at end of file +var _0xf3cd=['rounded','squared','We\x20are\x20here!','Chat','Send','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','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.','website_alias','bottom_right','CHAT','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM'];(function(_0x255cab,_0x53a59e){var _0x53fd8b=function(_0x4268c4){while(--_0x4268c4){_0x255cab['push'](_0x255cab['shift']());}};_0x53fd8b(++_0x53a59e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4131da,_0x124783){_0x4131da=_0x4131da-0x0;var _0x583242=_0xf3cd[_0x4131da];return _0x583242;};'use strict';var Sequelize=require(_0xdf3c('0x0'));var rs=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'name':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![],'unique':_0xdf3c('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x5')},'mapKeyOffline':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x6')},'customerAlias':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![],'defaultValue':_0xdf3c('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdf3c('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![],'defaultValue':_0xdf3c('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xdf3c('0x3')]},'animation':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xdf3c('0xa')](_0xdf3c('0xb'),_0xdf3c('0xc')),'defaultValue':_0xdf3c('0xb')},'header_online':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0xd')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xdf3c('0xe')},'offline_chat_button':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0xf')},'header_offline':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdf3c('0x10')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xdf3c('0x11')]},'closingQuestion':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x14')},'noteTitle':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x15')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdf3c('0x16')},'closingMessage':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x17')},'closingMessageButton':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0xf')},'skipMessageButton':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x18')},'conditionAgreement':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x19')},'ratingType':{'type':Sequelize['ENUM']('star',_0xdf3c('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xdf3c('0x10')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xdf3c('0x11')],'defaultValue':function(){return JSON[_0xdf3c('0x1b')]({'items':[{'type':_0xdf3c('0x1c'),'variable':null,'config':{'placeholder':_0xdf3c('0x1d'),'type':_0xdf3c('0x1e'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xdf3c('0x1c'),'props':{'title':_0xdf3c('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xdf3c('0x5'),'type':_0xdf3c('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xdf3c('0x1f')](_0xdf3c('0x20'))?JSON[_0xdf3c('0x21')](this[_0xdf3c('0x1f')](_0xdf3c('0x20'))):{};},'set':function(_0x1adee4){return this['setDataValue'](_0xdf3c('0x20'),JSON[_0xdf3c('0x1b')](_0x1adee4));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xdf3c('0x1b')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xdf3c('0x5')},'variable':null},{'type':_0xdf3c('0x22'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xdf3c('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xdf3c('0x1f')](_0xdf3c('0x24'))?JSON[_0xdf3c('0x21')](this['getDataValue'](_0xdf3c('0x24'))):{};},'set':function(_0x2a2d94){return this['setDataValue']('offlineForm',JSON[_0xdf3c('0x1b')](_0x2a2d94));}},'token':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':function(){return rs[_0xdf3c('0x25')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xdf3c('0x3')]},'forwardOffline':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x26')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdf3c('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x28')},'offlineMessageBody':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x29')},'skipUnmanaged':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0xf')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdf3c('0x11')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xdf3c('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[_0xdf3c('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xdf3c('0x2b')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x2c')},'messagesAlignment':{'type':Sequelize[_0xdf3c('0x3')],'defaultValue':_0xdf3c('0x2d')},'defaultTitle':{'type':Sequelize[_0xdf3c('0x3')]},'customerAvatar':{'type':Sequelize[_0xdf3c('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdf3c('0x10')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdf3c('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xdf3c('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdf3c('0x10')],'comment':_0xdf3c('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![],'comment':_0xdf3c('0x30'),'set':function(_0x3098cb){if(!_0x3098cb)this[_0xdf3c('0x31')](_0xdf3c('0x32'),null);this[_0xdf3c('0x31')](_0xdf3c('0x33'),_0x3098cb);}},'vidaooEscalation':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xdf3c('0x3')]},'vidaooTopic':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xdf3c('0x34');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xdf3c('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xdf3c('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 49539a6..9b5aec1 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 _0x68ba=['ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','CannedAnswer','getAnswers','order','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','ChatApplication','account','Applications','list','orderBy','applications','priority','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','contact','firstName','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','fromString','originalname','mimetype','server','attachments','sequelize','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','openNewInteraction','MailAccountId','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','ids','getInteractions','Contact','User','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.ejs','remote','x-real-ip','connection','replace','verticalAlignment','labelText','textColor','textButtonColor','color_button','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','removeAgents','emit','userChatWebsite:remove','getAgents','bluebird','util','path','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','undefined','limit','count','offset','set','update','destroy','get'];(function(_0xf2f1a1,_0x40d89e){var _0x276d73=function(_0x4482e4){while(--_0x4482e4){_0xf2f1a1['push'](_0xf2f1a1['shift']());}};_0x276d73(++_0x40d89e);}(_0x68ba,0x100));var _0xa68b=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x68ba[_0x77773a];return _0x1091a2;};'use strict';var BPromise=require(_0xa68b('0x0'));var Mustache=require('mustache');var util=require(_0xa68b('0x1'));var path=require(_0xa68b('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa68b('0x3'));var _=require(_0xa68b('0x4'));var querystring=require(_0xa68b('0x5'));var Redis=require(_0xa68b('0x6'));var qs=require(_0xa68b('0x7'));var logger=require(_0xa68b('0x8'))(_0xa68b('0x9'));var config=require(_0xa68b('0xa'));var db=require(_0xa68b('0xb'))['db'];config[_0xa68b('0xc')]=_[_0xa68b('0xd')](config['redis'],{'host':_0xa68b('0xe'),'port':0x18eb});var socket=require(_0xa68b('0xf'))(new Redis(config[_0xa68b('0xc')]));require(_0xa68b('0x10'))[_0xa68b('0x11')](socket);var htmlToText=require(_0xa68b('0x12'));var jayson=require(_0xa68b('0x13'));var client=jayson[_0xa68b('0x14')][_0xa68b('0x15')]({'port':0x232c});var client9002=jayson['client'][_0xa68b('0x15')]({'port':0x232a});var client9003=jayson[_0xa68b('0x14')][_0xa68b('0x15')]({'port':0x232b});var client9001=jayson[_0xa68b('0x14')][_0xa68b('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x2309b8,_0x137252,_0x471906,_0x42e144){return new BPromise(function(_0x28afab,_0x18926d){var _0x8dbf89=_0x42e144||client;return _0x8dbf89[_0xa68b('0x16')](_0x2309b8,_0x471906)[_0xa68b('0x17')](function(_0x4cd271){logger[_0xa68b('0x18')](_0xa68b('0x19'),_0x137252,_0xa68b('0x1a'));logger[_0xa68b('0x1b')](_0xa68b('0x1c'),_0x137252,'request\x20sent',JSON[_0xa68b('0x1d')](_0x4cd271));if(_0x4cd271[_0xa68b('0x1e')]){if(_0x4cd271[_0xa68b('0x1e')][_0xa68b('0x1f')]===0x1f4){logger['error'](_0xa68b('0x19'),_0x137252,_0x4cd271[_0xa68b('0x1e')][_0xa68b('0x20')]);return _0x18926d(_0x4cd271[_0xa68b('0x1e')][_0xa68b('0x20')]);}logger[_0xa68b('0x1e')](_0xa68b('0x19'),_0x137252,_0x4cd271['error']['message']);return _0x28afab(_0x4cd271['error'][_0xa68b('0x20')]);}else{logger['info'](_0xa68b('0x19'),_0x137252,'request\x20sent');_0x28afab(_0x4cd271['result']['message']);}})['catch'](function(_0x56f4fb){logger['error'](_0xa68b('0x19'),_0x137252,_0x56f4fb);_0x18926d(_0x56f4fb);});});}function respondWithStatusCode(_0x4df31a,_0xadf4d){_0xadf4d=_0xadf4d||0xcc;return function(_0x216c0e){if(_0x216c0e){return _0x4df31a[_0xa68b('0x21')](_0xadf4d);}return _0x4df31a[_0xa68b('0x22')](_0xadf4d)[_0xa68b('0x23')]();};}function respondWithResult(_0x494cd0,_0x2fe297){_0x2fe297=_0x2fe297||0xc8;return function(_0x30d0b1){if(_0x30d0b1){return _0x494cd0[_0xa68b('0x22')](_0x2fe297)[_0xa68b('0x24')](_0x30d0b1);}};}function respondWithFilteredResult(_0xc2f26b,_0x3957e1){return function(_0x499c10){if(_0x499c10){var _0x408211=typeof _0x3957e1['offset']===_0xa68b('0x25')&&typeof _0x3957e1[_0xa68b('0x26')]===_0xa68b('0x25');var _0x13ecfa=_0x499c10[_0xa68b('0x27')];var _0x71f373=_0x408211?0x0:_0x3957e1[_0xa68b('0x28')];var _0x424364=_0x408211?_0x499c10[_0xa68b('0x27')]:_0x3957e1[_0xa68b('0x28')]+_0x3957e1['limit'];var _0x12531a;if(_0x424364>=_0x13ecfa){_0x424364=_0x13ecfa;_0x12531a=0xc8;}else{_0x12531a=0xce;}_0xc2f26b[_0xa68b('0x22')](_0x12531a);return _0xc2f26b[_0xa68b('0x29')]('Content-Range',_0x71f373+'-'+_0x424364+'/'+_0x13ecfa)[_0xa68b('0x24')](_0x499c10);}return null;};}function saveUpdates(_0x1159c0){return function(_0x1d2530){if(_0x1d2530){return _0x1d2530[_0xa68b('0x2a')](_0x1159c0)[_0xa68b('0x17')](function(_0x5e2cd8){return _0x5e2cd8;});}return null;};}function removeEntity(_0x161cad){return function(_0x26130d){if(_0x26130d){return _0x26130d[_0xa68b('0x2b')]()['then'](function(){var _0x557a0c=_0x26130d[_0xa68b('0x2c')]({'plain':!![]});var _0x2b817f=_0xa68b('0x2d');return db[_0xa68b('0x2e')][_0xa68b('0x2b')]({'where':{'type':_0x2b817f,'resourceId':_0x557a0c['id']}})[_0xa68b('0x17')](function(){return _0x26130d;});})[_0xa68b('0x17')](function(){_0x161cad[_0xa68b('0x22')](0xcc)[_0xa68b('0x23')]();});}};}function handleEntityNotFound(_0x216d37){return function(_0x2b85c2){if(!_0x2b85c2){_0x216d37[_0xa68b('0x21')](0x194);}return _0x2b85c2;};}function handleError(_0x3fe918,_0x2f6a35){_0x2f6a35=_0x2f6a35||0x1f4;return function(_0xed6691){logger[_0xa68b('0x1e')](_0xed6691[_0xa68b('0x2f')]);if(_0xed6691[_0xa68b('0x30')]){delete _0xed6691[_0xa68b('0x30')];}_0x3fe918[_0xa68b('0x22')](_0x2f6a35)['send'](_0xed6691);};}exports[_0xa68b('0x31')]=function(_0x223f16,_0x308f0c){var _0x4b8fc6={'include':[{'model':db[_0xa68b('0x32')],'as':_0xa68b('0x33')}]},_0x346f1f={},_0x5818fd={'count':0x0,'rows':[]};var _0x44e820=_[_0xa68b('0x34')](db[_0xa68b('0x35')][_0xa68b('0x36')],function(_0x530aed){return{'name':_0x530aed[_0xa68b('0x37')],'type':_0x530aed[_0xa68b('0x38')][_0xa68b('0x39')]};});_0x346f1f[_0xa68b('0x3a')]=_[_0xa68b('0x34')](_0x44e820,'name');_0x346f1f['query']=_[_0xa68b('0x3b')](_0x223f16[_0xa68b('0x3c')]);_0x346f1f[_0xa68b('0x3d')]=_[_0xa68b('0x3e')](_0x346f1f['model'],_0x346f1f[_0xa68b('0x3c')]);_0x4b8fc6[_0xa68b('0x3f')]=_['intersection'](_0x346f1f['model'],qs[_0xa68b('0x40')](_0x223f16[_0xa68b('0x3c')][_0xa68b('0x40')]));_0x4b8fc6[_0xa68b('0x3f')]=_0x4b8fc6[_0xa68b('0x3f')]['length']?_0x4b8fc6['attributes']:_0x346f1f['model'];if(!_0x223f16[_0xa68b('0x3c')][_0xa68b('0x41')]('nolimit')){_0x4b8fc6[_0xa68b('0x26')]=qs[_0xa68b('0x26')](_0x223f16['query'][_0xa68b('0x26')]);_0x4b8fc6[_0xa68b('0x28')]=qs[_0xa68b('0x28')](_0x223f16[_0xa68b('0x3c')][_0xa68b('0x28')]);}_0x4b8fc6['order']=qs[_0xa68b('0x42')](_0x223f16[_0xa68b('0x3c')][_0xa68b('0x42')]);_0x4b8fc6['where']=qs[_0xa68b('0x3d')](_['pick'](_0x223f16[_0xa68b('0x3c')],_0x346f1f[_0xa68b('0x3d')]),_0x44e820);if(_0x223f16[_0xa68b('0x3c')][_0xa68b('0x43')]){_0x4b8fc6[_0xa68b('0x44')]=_[_0xa68b('0x45')](_0x4b8fc6['where'],{'$or':_['map'](_0x44e820,function(_0x3bc89){if(_0x3bc89[_0xa68b('0x38')]!==_0xa68b('0x46')){var _0x4a7eb3={};_0x4a7eb3[_0x3bc89[_0xa68b('0x30')]]={'$like':'%'+_0x223f16[_0xa68b('0x3c')]['filter']+'%'};return _0x4a7eb3;}})});}_0x4b8fc6=_[_0xa68b('0x45')]({},_0x4b8fc6,_0x223f16[_0xa68b('0x47')]);var _0x28103c={'where':_0x4b8fc6[_0xa68b('0x44')]};return db[_0xa68b('0x35')][_0xa68b('0x27')](_0x28103c)[_0xa68b('0x17')](function(_0x137187){_0x5818fd[_0xa68b('0x27')]=_0x137187;if(_0x223f16[_0xa68b('0x3c')][_0xa68b('0x48')]){_0x4b8fc6[_0xa68b('0x49')]=[{'all':!![]}];}return db['ChatWebsite'][_0xa68b('0x4a')](_0x4b8fc6);})[_0xa68b('0x17')](function(_0x539c51){_0x5818fd[_0xa68b('0x4b')]=_0x539c51;return _0x5818fd;})[_0xa68b('0x17')](respondWithFilteredResult(_0x308f0c,_0x4b8fc6))[_0xa68b('0x4c')](handleError(_0x308f0c,null));};exports[_0xa68b('0x4d')]=function(_0x4ea721,_0xbe2cc8){var _0x5a8fb8={'raw':![],'where':{'id':_0x4ea721[_0xa68b('0x4e')]['id']},'include':[{'model':db[_0xa68b('0x32')],'as':_0xa68b('0x33')}]},_0x1fdaea={};_0x1fdaea['model']=_[_0xa68b('0x3b')](db[_0xa68b('0x35')][_0xa68b('0x36')]);_0x1fdaea[_0xa68b('0x3c')]=_[_0xa68b('0x3b')](_0x4ea721[_0xa68b('0x3c')]);_0x1fdaea['filters']=_[_0xa68b('0x3e')](_0x1fdaea[_0xa68b('0x3a')],_0x1fdaea['query']);_0x5a8fb8[_0xa68b('0x3f')]=_[_0xa68b('0x3e')](_0x1fdaea[_0xa68b('0x3a')],qs[_0xa68b('0x40')](_0x4ea721[_0xa68b('0x3c')][_0xa68b('0x40')]));_0x5a8fb8[_0xa68b('0x3f')]=_0x5a8fb8[_0xa68b('0x3f')][_0xa68b('0x4f')]?_0x5a8fb8[_0xa68b('0x3f')]:_0x1fdaea['model'];if(_0x4ea721[_0xa68b('0x3c')][_0xa68b('0x48')]){_0x5a8fb8[_0xa68b('0x49')]=[{'all':!![]}];}_0x5a8fb8=_[_0xa68b('0x45')]({},_0x5a8fb8,_0x4ea721[_0xa68b('0x47')]);return db[_0xa68b('0x35')]['find'](_0x5a8fb8)[_0xa68b('0x17')](handleEntityNotFound(_0xbe2cc8,null))[_0xa68b('0x17')](respondWithResult(_0xbe2cc8,null))[_0xa68b('0x4c')](handleError(_0xbe2cc8,null));};exports[_0xa68b('0x50')]=function(_0xe154bb,_0xd9ad89){return db[_0xa68b('0x35')][_0xa68b('0x50')](_0xe154bb[_0xa68b('0x51')],{})[_0xa68b('0x17')](function(_0x8ec6fc){var _0x3cb6ed=_0xe154bb['user'][_0xa68b('0x2c')]({'plain':!![]});if(!_0x3cb6ed)throw new Error(_0xa68b('0x52'));if(_0x3cb6ed[_0xa68b('0x53')]===_0xa68b('0x54')){var _0x2a7e7e=_0x8ec6fc[_0xa68b('0x2c')]({'plain':!![]});var _0x3a4c3b='ChatWebsites';return db['UserProfileSection'][_0xa68b('0x55')]({'where':{'name':_0x3a4c3b,'userProfileId':_0x3cb6ed[_0xa68b('0x56')]},'raw':!![]})[_0xa68b('0x17')](function(_0x2e99a0){if(_0x2e99a0&&_0x2e99a0[_0xa68b('0x57')]===0x0){return db[_0xa68b('0x2e')][_0xa68b('0x50')]({'name':_0x2a7e7e[_0xa68b('0x30')],'resourceId':_0x2a7e7e['id'],'type':_0x2e99a0['name'],'sectionId':_0x2e99a0['id']},{})[_0xa68b('0x17')](function(){return _0x8ec6fc;});}else{return _0x8ec6fc;}})[_0xa68b('0x4c')](function(_0x1f793f){logger['error'](_0xa68b('0x58'),_0x1f793f);throw _0x1f793f;});}return _0x8ec6fc;})[_0xa68b('0x17')](respondWithResult(_0xd9ad89,0xc9))[_0xa68b('0x4c')](handleError(_0xd9ad89,null));};exports['update']=function(_0x12d45a,_0x3767a1){if(_0x12d45a['body']['id']){delete _0x12d45a[_0xa68b('0x51')]['id'];}return db[_0xa68b('0x35')][_0xa68b('0x55')]({'where':{'id':_0x12d45a[_0xa68b('0x4e')]['id']},'include':[{'model':db['Pause'],'as':_0xa68b('0x33')}]})[_0xa68b('0x17')](handleEntityNotFound(_0x3767a1,null))[_0xa68b('0x17')](saveUpdates(_0x12d45a[_0xa68b('0x51')],null))[_0xa68b('0x17')](respondWithResult(_0x3767a1,null))['catch'](handleError(_0x3767a1,null));};exports['destroy']=function(_0x437ea1,_0x2f63eb){return db[_0xa68b('0x35')][_0xa68b('0x55')]({'where':{'id':_0x437ea1[_0xa68b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2f63eb,null))[_0xa68b('0x17')](removeEntity(_0x2f63eb,null))['catch'](handleError(_0x2f63eb,null));};exports[_0xa68b('0x59')]=function(_0x5041cc,_0x1e56a3){return db[_0xa68b('0x35')][_0xa68b('0x59')]()[_0xa68b('0x17')](respondWithResult(_0x1e56a3,null))[_0xa68b('0x4c')](handleError(_0x1e56a3,null));};exports[_0xa68b('0x5a')]=function(_0x9dd515,_0x128183){if(_0x9dd515[_0xa68b('0x51')]['id']){delete _0x9dd515['body']['id'];}return db[_0xa68b('0x35')][_0xa68b('0x55')]({'where':{'id':_0x9dd515[_0xa68b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x128183,null))['then'](function(_0x3c394c){if(_0x3c394c){_0x9dd515[_0xa68b('0x51')][_0xa68b('0x5b')]=_0x3c394c['id'];return db[_0xa68b('0x5c')][_0xa68b('0x50')](_0x9dd515[_0xa68b('0x51')]);}})[_0xa68b('0x17')](respondWithResult(_0x128183,null))['catch'](handleError(_0x128183,null));};exports[_0xa68b('0x5d')]=function(_0x595864,_0x49ff67){var _0x37aca3={'raw':![],'where':{}};var _0x33238a={};var _0x33fe22={'count':0x0,'rows':[]};return db[_0xa68b('0x35')][_0xa68b('0x5e')]({'where':{'id':_0x595864['params']['id']}})['then'](handleEntityNotFound(_0x49ff67,null))['then'](function(_0x34ddec){if(_0x34ddec){_0x33238a[_0xa68b('0x3a')]=_[_0xa68b('0x3b')](db[_0xa68b('0x5c')][_0xa68b('0x36')]);_0x33238a[_0xa68b('0x3c')]=_[_0xa68b('0x3b')](_0x595864[_0xa68b('0x3c')]);_0x33238a['filters']=_[_0xa68b('0x3e')](_0x33238a[_0xa68b('0x3a')],_0x33238a[_0xa68b('0x3c')]);_0x37aca3['attributes']=_[_0xa68b('0x3e')](_0x33238a['model'],qs[_0xa68b('0x40')](_0x595864[_0xa68b('0x3c')][_0xa68b('0x40')]));_0x37aca3[_0xa68b('0x3f')]=_0x37aca3[_0xa68b('0x3f')]['length']?_0x37aca3[_0xa68b('0x3f')]:_0x33238a['model'];if(!_0x595864[_0xa68b('0x3c')]['hasOwnProperty'](_0xa68b('0x5f'))){_0x37aca3['limit']=qs[_0xa68b('0x26')](_0x595864[_0xa68b('0x3c')][_0xa68b('0x26')]);_0x37aca3[_0xa68b('0x28')]=qs[_0xa68b('0x28')](_0x595864[_0xa68b('0x3c')][_0xa68b('0x28')]);}_0x37aca3['order']=qs[_0xa68b('0x42')](_0x595864[_0xa68b('0x3c')][_0xa68b('0x42')]);_0x37aca3[_0xa68b('0x44')]=qs[_0xa68b('0x3d')](_[_0xa68b('0x60')](_0x595864[_0xa68b('0x3c')],_0x33238a[_0xa68b('0x3d')]));_0x37aca3['where'][_0xa68b('0x5b')]=_0x34ddec['id'];if(_0x595864[_0xa68b('0x3c')]['filter']){_0x37aca3[_0xa68b('0x44')]=_['merge'](_0x37aca3['where'],{'$or':_[_0xa68b('0x34')](_0x37aca3[_0xa68b('0x3f')],function(_0x64381){var _0x2e1bb4={};_0x2e1bb4[_0x64381]={'$like':'%'+_0x595864[_0xa68b('0x3c')][_0xa68b('0x43')]+'%'};return _0x2e1bb4;})});}_0x37aca3=_[_0xa68b('0x45')]({},_0x37aca3,_0x595864['options']);return db[_0xa68b('0x5c')][_0xa68b('0x27')]({'where':_0x37aca3[_0xa68b('0x44')]})[_0xa68b('0x17')](function(_0x5cfebb){_0x33fe22['count']=_0x5cfebb;if(_0x595864[_0xa68b('0x3c')]['includeAll']){_0x37aca3[_0xa68b('0x49')]=[{'all':!![]}];}return db[_0xa68b('0x5c')]['findAll'](_0x37aca3);})[_0xa68b('0x17')](function(_0x2c3034){_0x33fe22['rows']=_0x2c3034;return _0x33fe22;});}})[_0xa68b('0x17')](respondWithFilteredResult(_0x49ff67,_0x37aca3))[_0xa68b('0x4c')](handleError(_0x49ff67,null));};exports[_0xa68b('0x61')]=function(_0x1010cf,_0x5bc607){return db[_0xa68b('0x35')][_0xa68b('0x55')]({'where':{'id':_0x1010cf['params']['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x5bc607,null))[_0xa68b('0x17')](function(_0x16cc1c){if(_0x16cc1c){return _0x16cc1c[_0xa68b('0x61')](_0x1010cf[_0xa68b('0x3c')]['ids']);}})[_0xa68b('0x17')](respondWithStatusCode(_0x5bc607,null))['catch'](handleError(_0x5bc607,null));};exports['addAnswer']=function(_0x20ca55,_0x1a4a06){if(_0x20ca55[_0xa68b('0x51')]['id']){delete _0x20ca55[_0xa68b('0x51')]['id'];}return db[_0xa68b('0x35')]['find']({'where':{'id':_0x20ca55[_0xa68b('0x4e')]['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x1a4a06,null))[_0xa68b('0x17')](function(_0xfc8e3b){if(_0xfc8e3b){_0x20ca55[_0xa68b('0x51')][_0xa68b('0x5b')]=_0xfc8e3b['id'];return db[_0xa68b('0x62')][_0xa68b('0x50')](_0x20ca55[_0xa68b('0x51')]);}})[_0xa68b('0x17')](respondWithResult(_0x1a4a06,null))['catch'](handleError(_0x1a4a06,null));};exports[_0xa68b('0x63')]=function(_0x32d278,_0xfae93e){var _0x454437={'raw':![],'where':{}};var _0x1b9f41={};var _0x555e24={'count':0x0,'rows':[]};return db[_0xa68b('0x35')][_0xa68b('0x5e')]({'where':{'id':_0x32d278[_0xa68b('0x4e')]['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0xfae93e,null))[_0xa68b('0x17')](function(_0x43d127){if(_0x43d127){_0x1b9f41[_0xa68b('0x3a')]=_[_0xa68b('0x3b')](db['CannedAnswer'][_0xa68b('0x36')]);_0x1b9f41[_0xa68b('0x3c')]=_['keys'](_0x32d278[_0xa68b('0x3c')]);_0x1b9f41['filters']=_[_0xa68b('0x3e')](_0x1b9f41['model'],_0x1b9f41[_0xa68b('0x3c')]);_0x454437[_0xa68b('0x3f')]=_['intersection'](_0x1b9f41[_0xa68b('0x3a')],qs[_0xa68b('0x40')](_0x32d278['query'][_0xa68b('0x40')]));_0x454437[_0xa68b('0x3f')]=_0x454437[_0xa68b('0x3f')]['length']?_0x454437[_0xa68b('0x3f')]:_0x1b9f41[_0xa68b('0x3a')];if(!_0x32d278['query']['hasOwnProperty'](_0xa68b('0x5f'))){_0x454437[_0xa68b('0x26')]=qs[_0xa68b('0x26')](_0x32d278[_0xa68b('0x3c')][_0xa68b('0x26')]);_0x454437['offset']=qs['offset'](_0x32d278[_0xa68b('0x3c')][_0xa68b('0x28')]);}_0x454437[_0xa68b('0x64')]=qs[_0xa68b('0x42')](_0x32d278[_0xa68b('0x3c')][_0xa68b('0x42')]);_0x454437[_0xa68b('0x44')]=qs[_0xa68b('0x3d')](_[_0xa68b('0x60')](_0x32d278[_0xa68b('0x3c')],_0x1b9f41[_0xa68b('0x3d')]));_0x454437['where'][_0xa68b('0x5b')]=_0x43d127['id'];if(_0x32d278['query'][_0xa68b('0x43')]){_0x454437[_0xa68b('0x44')]=_['merge'](_0x454437[_0xa68b('0x44')],{'$or':_[_0xa68b('0x34')](_0x454437[_0xa68b('0x3f')],function(_0x31840a){var _0x2de3c8={};_0x2de3c8[_0x31840a]={'$like':'%'+_0x32d278['query'][_0xa68b('0x43')]+'%'};return _0x2de3c8;})});}_0x454437=_[_0xa68b('0x45')]({},_0x454437,_0x32d278[_0xa68b('0x47')]);return db[_0xa68b('0x62')][_0xa68b('0x27')]({'where':_0x454437['where']})[_0xa68b('0x17')](function(_0x32d8ae){_0x555e24[_0xa68b('0x27')]=_0x32d8ae;if(_0x32d278[_0xa68b('0x3c')][_0xa68b('0x48')]){_0x454437[_0xa68b('0x49')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x454437);})['then'](function(_0x3a8552){_0x555e24[_0xa68b('0x4b')]=_0x3a8552;return _0x555e24;});}})[_0xa68b('0x17')](respondWithFilteredResult(_0xfae93e,_0x454437))[_0xa68b('0x4c')](handleError(_0xfae93e,null));};exports[_0xa68b('0x65')]=function(_0x4f5583,_0x3c7aed){return db['ChatWebsite'][_0xa68b('0x55')]({'where':{'id':_0x4f5583['params']['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x3c7aed,null))['then'](function(_0x494223){if(_0x494223){return _0x494223[_0xa68b('0x65')](_0x4f5583[_0xa68b('0x3c')]['ids']);}})[_0xa68b('0x17')](respondWithStatusCode(_0x3c7aed,null))[_0xa68b('0x4c')](handleError(_0x3c7aed,null));};exports['addLogo']=function(_0x1a35c9,_0x4169d0){_0x1a35c9[_0xa68b('0x51')][_0xa68b('0x66')]=_0x1a35c9[_0xa68b('0x67')][_0xa68b('0x68')];return db['ChatWebsite'][_0xa68b('0x55')]({'where':{'id':_0x1a35c9[_0xa68b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4169d0,null))['then'](saveUpdates(_0x1a35c9[_0xa68b('0x51')],null))['then'](respondWithResult(_0x4169d0,null))['catch'](handleError(_0x4169d0,null));};exports[_0xa68b('0x69')]=function(_0x3b33c1,_0x49a513){_0x3b33c1[_0xa68b('0x51')][_0xa68b('0x6a')]=_0x3b33c1[_0xa68b('0x67')]['filename'];return db[_0xa68b('0x35')][_0xa68b('0x55')]({'where':{'id':_0x3b33c1[_0xa68b('0x4e')]['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x49a513,null))[_0xa68b('0x17')](saveUpdates(_0x3b33c1[_0xa68b('0x51')],null))[_0xa68b('0x17')](respondWithResult(_0x49a513,null))[_0xa68b('0x4c')](handleError(_0x49a513,null));};exports[_0xa68b('0x6b')]=function(_0x3a3a7c,_0x4d8e9f){_0x3a3a7c[_0xa68b('0x51')][_0xa68b('0x6c')]=_0x3a3a7c['file'][_0xa68b('0x68')];return db[_0xa68b('0x35')][_0xa68b('0x55')]({'where':{'id':_0x3a3a7c['params']['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x4d8e9f,null))[_0xa68b('0x17')](saveUpdates(_0x3a3a7c[_0xa68b('0x51')],null))['then'](respondWithResult(_0x4d8e9f,null))[_0xa68b('0x4c')](handleError(_0x4d8e9f,null));};exports[_0xa68b('0x6d')]=function(_0x179049,_0x52c174){_0x179049[_0xa68b('0x51')][_0xa68b('0x6e')]=_0x179049[_0xa68b('0x67')][_0xa68b('0x68')];return db['ChatWebsite'][_0xa68b('0x55')]({'where':{'id':_0x179049[_0xa68b('0x4e')]['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x52c174,null))[_0xa68b('0x17')](saveUpdates(_0x179049[_0xa68b('0x51')],null))[_0xa68b('0x17')](respondWithResult(_0x52c174,null))[_0xa68b('0x4c')](handleError(_0x52c174,null));};exports[_0xa68b('0x6f')]=function(_0x25e21e,_0x36c2af){var _0x4ed9a8=path['join'](config[_0xa68b('0x70')],_0xa68b('0x71'));var _0x5ed5ab={'where':{'id':_0x25e21e[_0xa68b('0x4e')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x2d040c=![];return require(_0xa68b('0x72'))[_0xa68b('0x73')]()['then'](function(_0x3bcf13){if(_0x3bcf13){_0x2d040c=_0x3bcf13[_0xa68b('0x74')];}})[_0xa68b('0x17')](function(){return db[_0xa68b('0x35')][_0xa68b('0x55')](_0x5ed5ab);})[_0xa68b('0x17')](handleEntityNotFound(_0x36c2af,null))[_0xa68b('0x17')](function(_0x5c32c8){if(_0x5c32c8){if(!_[_0xa68b('0x75')](_0x5c32c8[_0xa68b('0x66')])){if(fs[_0xa68b('0x76')](path['join'](config[_0xa68b('0x70')],'server/files/images/logos/',_0x5c32c8[_0xa68b('0x66')]))&&_0x2d040c){_0x4ed9a8=path[_0xa68b('0x77')](config['root'],_0xa68b('0x78'),_0x5c32c8['sitepic']);}}return _0x36c2af[_0xa68b('0x79')](_0x4ed9a8);}})[_0xa68b('0x4c')](handleError(_0x36c2af,null));};exports[_0xa68b('0x7a')]=function(_0x504490,_0x46b079){var _0x265cc8=path[_0xa68b('0x77')](config['root'],_0xa68b('0x7b'));var _0x834d83={'where':{'id':_0x504490[_0xa68b('0x4e')]['id']},'attributes':['id',_0xa68b('0x6a')],'raw':!![]};return db['ChatWebsite']['find'](_0x834d83)[_0xa68b('0x17')](handleEntityNotFound(_0x46b079,null))[_0xa68b('0x17')](function(_0x2b992b){if(_0x2b992b){if(!_[_0xa68b('0x75')](_0x2b992b[_0xa68b('0x6a')])){if(fs[_0xa68b('0x76')](path[_0xa68b('0x77')](config[_0xa68b('0x70')],_0xa68b('0x7c'),_0x2b992b[_0xa68b('0x6a')]))){_0x265cc8=path[_0xa68b('0x77')](config[_0xa68b('0x70')],_0xa68b('0x7c'),_0x2b992b[_0xa68b('0x6a')]);}}return _0x46b079[_0xa68b('0x79')](_0x265cc8);}})[_0xa68b('0x4c')](handleError(_0x46b079,null));};exports[_0xa68b('0x7d')]=function(_0x89c370,_0x39cb9c){var _0xae1415=path[_0xa68b('0x77')](config[_0xa68b('0x70')],'server/files/images/avatars/customer_avatar.png');var _0x5cf42a={'where':{'id':_0x89c370[_0xa68b('0x4e')]['id']},'attributes':['id','customerAvatar',_0xa68b('0x7e')],'raw':!![]};return db['ChatWebsite']['find'](_0x5cf42a)[_0xa68b('0x17')](handleEntityNotFound(_0x39cb9c,null))[_0xa68b('0x17')](function(_0x8a48ed){if(_0x8a48ed){if(!_['isNil'](_0x8a48ed['customerAvatar'])){if(fs[_0xa68b('0x76')](path[_0xa68b('0x77')](config['root'],'server/files/images/avatars/',_0x8a48ed[_0xa68b('0x6c')]))&&_0x8a48ed[_0xa68b('0x7e')]){_0xae1415=path['join'](config[_0xa68b('0x70')],_0xa68b('0x7c'),_0x8a48ed[_0xa68b('0x6c')]);}}return _0x39cb9c[_0xa68b('0x79')](_0xae1415);}})[_0xa68b('0x4c')](handleError(_0x39cb9c,null));};exports[_0xa68b('0x7f')]=function(_0x2624fd,_0x4c3834){var _0x504ebd=path[_0xa68b('0x77')](config['root'],_0xa68b('0x80'));var _0x333979={'where':{'id':_0x2624fd['params']['id']},'attributes':['id',_0xa68b('0x6e')],'raw':!![]};return db['ChatWebsite'][_0xa68b('0x55')](_0x333979)[_0xa68b('0x17')](handleEntityNotFound(_0x4c3834,null))[_0xa68b('0x17')](function(_0x4a8db0){if(_0x4a8db0){if(!_['isNil'](_0x4a8db0[_0xa68b('0x6e')])){if(fs[_0xa68b('0x76')](path['join'](config[_0xa68b('0x70')],'server/files/images/avatars/',_0x4a8db0[_0xa68b('0x6e')]))){_0x504ebd=path[_0xa68b('0x77')](config[_0xa68b('0x70')],_0xa68b('0x7c'),_0x4a8db0[_0xa68b('0x6e')]);}}return _0x4c3834[_0xa68b('0x79')](_0x504ebd);}})['catch'](handleError(_0x4c3834,null));};exports[_0xa68b('0x81')]=function(_0x31b018,_0x245775){var _0x21ae75=require(_0xa68b('0x82'));var _0x298528=new _0x21ae75();var _0x47b14b=_0x298528['setUA'](_0x31b018[_0xa68b('0x83')][_0xa68b('0x84')])[_0xa68b('0x85')]();var _0x197faa={'body':_0x31b018[_0xa68b('0x51')],'channel':_0xa68b('0x86')};var _0x488222=[];var _0xe9355=[];var _0x2d0bf2={};var _0x1db3b0=![];return db[_0xa68b('0x87')][_0xa68b('0x59')]()[_0xa68b('0x17')](function(_0xf32753){if(!_0xf32753){throw new db[(_0xa68b('0x88'))][(_0xa68b('0x89'))](_0xa68b('0x8a'));}_0x488222=_['difference'](_[_0xa68b('0x3b')](_0xf32753),[_0xa68b('0x8b'),_0xa68b('0x8c')]);_0xe9355=_[_0xa68b('0x8d')](_[_0xa68b('0x3b')](_0xf32753),[_0xa68b('0x8b'),_0xa68b('0x8c'),'CompanyId',_0xa68b('0x8e')]);if(_0x31b018['body']['id']){delete _0x31b018['body']['id'];}if(_['isNil'](_0x31b018['body']['from'])){throw new db['Sequelize'][(_0xa68b('0x89'))](_0xa68b('0x8f'));}if(_['isNil'](_0x31b018[_0xa68b('0x51')][_0xa68b('0x51')])||_0x31b018[_0xa68b('0x51')][_0xa68b('0x51')]===''){throw new db[(_0xa68b('0x88'))][(_0xa68b('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa68b('0x75')](_0x31b018[_0xa68b('0x51')]['mapKey'])){throw new db[(_0xa68b('0x88'))][(_0xa68b('0x89'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe9355);}if(!_['includes'](_0xe9355,_0x31b018[_0xa68b('0x51')][_0xa68b('0x90')])){throw new db[(_0xa68b('0x88'))]['ValidationError'](_0xa68b('0x91')+_0xe9355);}_0x2d0bf2[_0x31b018[_0xa68b('0x51')]['mapKey']]=_0x31b018['body'][_0xa68b('0x92')];})['then'](function(){return db[_0xa68b('0x35')]['find']({'where':{'id':_0x31b018[_0xa68b('0x4e')]['id']},'include':[{'model':db[_0xa68b('0x93')],'as':_0xa68b('0x94'),'include':[{'model':db[_0xa68b('0x87')],'as':_0xa68b('0x95'),'where':_0x2d0bf2,'limit':0x1,'order':[[_0xa68b('0x8c'),_0xa68b('0x96')]]}]},{'model':db[_0xa68b('0x97')],'as':'Applications'}]});})[_0xa68b('0x17')](handleEntityNotFound(_0x245775,null))['then'](function(_0xf6afe){if(_0xf6afe&&_0xf6afe[_0xa68b('0x94')]){_0x197faa[_0xa68b('0x98')]=_0xf6afe;_0x197faa['applications']=_0xf6afe[_0xa68b('0x99')];_0x197faa[_0xa68b('0x9a')]=_0xf6afe[_0xa68b('0x94')];_0x197faa['applications']=_[_0xa68b('0x9b')](_0x197faa[_0xa68b('0x9c')],[_0xa68b('0x9d')],['asc']);if(_0x197faa[_0xa68b('0x98')][_0xa68b('0x99')]){delete _0x197faa[_0xa68b('0x98')][_0xa68b('0x99')];}if(_0x197faa[_0xa68b('0x98')][_0xa68b('0x94')]&&_0x197faa['account'][_0xa68b('0x94')][_0xa68b('0x95')][_0xa68b('0x4f')]){return _0x197faa[_0xa68b('0x98')][_0xa68b('0x94')][_0xa68b('0x95')][0x0];}var _0x5f27cc=_[_0xa68b('0xd')](_0x31b018['body'],{'firstName':_0x31b018[_0xa68b('0x51')][_0xa68b('0x92')],'ListId':_0xf6afe[_0xa68b('0x8e')]});_0x5f27cc[_0x31b018['body'][_0xa68b('0x90')]]=_0x31b018['body'][_0xa68b('0x92')];return db[_0xa68b('0x87')][_0xa68b('0x50')](_0x5f27cc,{'fields':_0x488222,'raw':!![]});}})[_0xa68b('0x17')](handleEntityNotFound(_0x245775,null))[_0xa68b('0x17')](function(_0x1c4ca3){_0x197faa['contact']=_0x1c4ca3;var _0x416fb3=_0x31b018[_0xa68b('0x51')]['customerIp'];if(_0x31b018[_0xa68b('0x83')][_0xa68b('0x9e')]){_0x416fb3=_0x31b018[_0xa68b('0x83')][_0xa68b('0x9e')];}else if(_0x31b018[_0xa68b('0x83')][_0xa68b('0x9f')]){_0x416fb3=_[_0xa68b('0xa0')](_0x31b018[_0xa68b('0x83')][_0xa68b('0x9f')][_0xa68b('0xa1')](','));}if(_0x1c4ca3){var _0x2d2175={'ContactId':_0x1c4ca3['id'],'ChatWebsiteId':_0x31b018[_0xa68b('0x4e')]['id'],'from':(_0x1c4ca3['firstName']||'')+'\x20'+(_0x1c4ca3[_0xa68b('0xa2')]||''),'customerIp':_0x416fb3,'customerPort':_0x31b018[_0xa68b('0x83')][_0xa68b('0xa3')]?_0x31b018[_0xa68b('0x83')][_0xa68b('0xa3')]:null,'referer':_0x31b018[_0xa68b('0x51')][_0xa68b('0xa4')],'browserName':_0x47b14b[_0xa68b('0xa5')][_0xa68b('0x30')]&&_0x47b14b['browser'][_0xa68b('0xa6')]?util[_0xa68b('0xa7')]('%s\x20%s',_0x47b14b[_0xa68b('0xa5')][_0xa68b('0x30')],_0x47b14b[_0xa68b('0xa5')]['version']):_0xa68b('0xa8'),'browserVersion':_0x47b14b[_0xa68b('0xa5')][_0xa68b('0xa6')]||_0xa68b('0xa8'),'osName':util[_0xa68b('0xa7')](_0xa68b('0xa9'),_0x47b14b['os'][_0xa68b('0x30')],_0x47b14b['os'][_0xa68b('0xa6')]),'osVersion':_0x47b14b['os'][_0xa68b('0xa6')],'deviceModel':_0x47b14b[_0xa68b('0xaa')][_0xa68b('0x3a')]&&_0x47b14b[_0xa68b('0xaa')]['vendor']?util[_0xa68b('0xa7')](_0xa68b('0xab'),_0x47b14b[_0xa68b('0xaa')][_0xa68b('0x3a')],_0x47b14b['device'][_0xa68b('0xac')],_0x47b14b['device']['type']):null,'deviceVendor':_0x47b14b[_0xa68b('0xaa')][_0xa68b('0xac')],'deviceType':_0x47b14b[_0xa68b('0xaa')][_0xa68b('0x38')],'formData':JSON['stringify'](_0x31b018[_0xa68b('0x51')])};var _0x5c8d00={'ChatWebsiteId':_0x31b018[_0xa68b('0x4e')]['id'],'closed':![]};if(_0x31b018['body']['threadId']){_0x5c8d00[_0xa68b('0xad')]=_0x31b018[_0xa68b('0x51')][_0xa68b('0xad')];return db[_0xa68b('0xae')][_0xa68b('0x55')]({'where':_0x5c8d00})[_0xa68b('0x17')](function(_0x5c18de){if(_0x5c18de){return[_0x5c18de,![]];}_0x2d2175[_0xa68b('0xad')]=_0x31b018['body'][_0xa68b('0xad')];_0x2d2175[_0xa68b('0xaf')]=_0x31b018['body'][_0xa68b('0xaf')];return db['ChatInteraction'][_0xa68b('0x50')](_0x2d2175)[_0xa68b('0x17')](function(_0x5d0f13){return[_0x5d0f13,!![]];});});}_0x5c8d00[_0xa68b('0xb0')]=_0x1c4ca3['id'];if(_0x31b018[_0xa68b('0x51')]['interaction']&&_0x31b018['body'][_0xa68b('0xb1')]['id']){_0x5c8d00['id']=_0x31b018['body'][_0xa68b('0xb1')]['id'];return db[_0xa68b('0xae')]['find']({'where':_0x5c8d00})[_0xa68b('0x17')](function(_0x17c513){if(_0x17c513){return[_0x17c513,![]];}return db[_0xa68b('0xae')][_0xa68b('0x50')](_0x2d2175)[_0xa68b('0x17')](function(_0x42da20){return[_0x42da20,!![]];});});}return db['ChatInteraction'][_0xa68b('0x50')](_0x2d2175)[_0xa68b('0x17')](function(_0x1a8b06){return[_0x1a8b06,!![]];});}})['spread'](function(_0x506a58,_0x192f5f){if(_0x506a58){_0x1db3b0=_0x192f5f;if(!_0x192f5f){var _0x2fa121={'from':(_0x197faa[_0xa68b('0xb2')][_0xa68b('0xb3')]||'')+'\x20'+(_0x197faa['contact'][_0xa68b('0xa2')]||'')};if(_0x31b018[_0xa68b('0x51')]['threadId']&&_0x31b018[_0xa68b('0x51')][_0xa68b('0xb4')]&&_0x31b018['body'][_0xa68b('0xad')]!=_0x31b018[_0xa68b('0x51')][_0xa68b('0xb4')]){_0x2fa121[_0xa68b('0xad')]=_0x31b018['body']['messageId'];}return _0x506a58[_0xa68b('0x2a')](_0x2fa121);}else{return _0x506a58;}}})['then'](function(_0x45af30){_0x197faa[_0xa68b('0xb1')]=_0x45af30['get']({'plain':!![]});_0x197faa['interaction'][_0xa68b('0xb5')]=_0x1db3b0;if(_0x197faa['interaction']['created']){if(_0x197faa[_0xa68b('0x98')][_0xa68b('0xb6')]){_0x197faa[_0xa68b('0x9c')][_0xa68b('0xb7')]({'id':0x0,'priority':_0x197faa[_0xa68b('0x9c')]['length']+0x1,'app':'close','appdata':_0xa68b('0xb8'),'interval':_0xa68b('0xb9')});}}return db[_0xa68b('0xba')][_0xa68b('0x50')]({'body':_0x31b018[_0xa68b('0x51')]['body'],'ChatWebsiteId':_0x31b018[_0xa68b('0x4e')]['id'],'ChatInteractionId':_0x45af30['id'],'direction':'in','ContactId':_0x197faa[_0xa68b('0xb2')]['id'],'AttachmentId':_0x31b018['body'][_0xa68b('0xbb')]});})[_0xa68b('0x17')](function(_0xc30e93){_0x197faa[_0xa68b('0x20')]=_0xc30e93;if(_0x197faa[_0xa68b('0xb1')][_0xa68b('0xbc')]){return db['User'][_0xa68b('0x55')]({'attributes':['id',_0xa68b('0x30')],'where':{'id':_0x197faa['interaction'][_0xa68b('0xbc')]}})[_0xa68b('0x17')](function(_0x2ec90f){if(_0x2ec90f){_0x197faa['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xa68b('0xbd'),'appdata':_0x2ec90f[_0xa68b('0x30')]+','+(_0x197faa[_0xa68b('0x98')][_0xa68b('0xbe')]||0xa),'interval':_0xa68b('0xb9')});_0x197faa[_0xa68b('0xbf')]=!![];}return respondWithRpcPromise(_0xa68b('0xc0'),_0xa68b('0xc1'),_0x197faa);});}return respondWithRpcPromise(_0xa68b('0xc0'),'startRouting',_0x197faa);})[_0xa68b('0x17')](function(_0x478414){respondWithRpcPromise(_0xa68b('0xc2'),'EventManager',{'event':_0xa68b('0x81'),'message':_0x478414},client9002);return _0x478414;})[_0xa68b('0x17')](respondWithResult(_0x245775,null))[_0xa68b('0x4c')](handleError(_0x245775,null));};exports[_0xa68b('0xc3')]=function(_0x4d6796,_0x448930){var _0x59f516,_0x3995a3,_0x48f2a5;var _0x375bc7=[];var _0x491a0d={};var _0x5f2f69=_0x4d6796[_0xa68b('0xc4')]||[];var _0x596fc5=[];var _0x20b942;return db[_0xa68b('0x87')][_0xa68b('0x59')]()['then'](function(_0x1f4a63){if(!_0x1f4a63){throw new db[(_0xa68b('0x88'))]['ValidationError'](_0xa68b('0x8a'));}_0x375bc7=_[_0xa68b('0x8d')](_[_0xa68b('0x3b')](_0x1f4a63),[_0xa68b('0x8b'),_0xa68b('0x8c'),_0xa68b('0xc5'),_0xa68b('0x8e')]);if(_0x4d6796[_0xa68b('0x51')]['id']){delete _0x4d6796[_0xa68b('0x51')]['id'];}if(_[_0xa68b('0x75')](_0x4d6796[_0xa68b('0x51')][_0xa68b('0x92')])){throw _0x448930[_0xa68b('0x22')](0x1f4)[_0xa68b('0xc6')](new db['Sequelize'][(_0xa68b('0x89'))]('from\x20is\x20mandatory'));}if(_['isNil'](_0x4d6796['body'][_0xa68b('0x51')])||_0x4d6796[_0xa68b('0x51')][_0xa68b('0x51')]===''){throw _0x448930[_0xa68b('0x22')](0x1f4)[_0xa68b('0xc6')](new db['Sequelize'][(_0xa68b('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa68b('0x75')](_0x4d6796[_0xa68b('0x51')][_0xa68b('0xc7')])){throw _0x448930['status'](0x1f4)[_0xa68b('0xc6')](new db[(_0xa68b('0x88'))][(_0xa68b('0x89'))](_0xa68b('0xc8')+_0x375bc7));}if(!_['includes'](_0x375bc7,_0x4d6796[_0xa68b('0x51')]['mapKeyOffline'])){throw _0x448930[_0xa68b('0x22')](0x1f4)[_0xa68b('0xc6')](new db[(_0xa68b('0x88'))][(_0xa68b('0x89'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x375bc7));}_0x491a0d[_0x4d6796[_0xa68b('0x51')][_0xa68b('0xc7')]]=_0x4d6796[_0xa68b('0x51')][_0xa68b('0x92')];})[_0xa68b('0x17')](function(){return db[_0xa68b('0x35')][_0xa68b('0x55')]({'where':{'id':_0x4d6796['params']['id']},'include':[{'model':db[_0xa68b('0x93')],'as':_0xa68b('0x94')},{'model':db['MailAccount'],'as':_0xa68b('0xc9')}]});})[_0xa68b('0x17')](handleEntityNotFound(_0x448930,null))[_0xa68b('0x17')](function(_0x4fe870){if(_0x4fe870&&_0x4fe870['List']){_0x3995a3=_0x4fe870;var _0x125a28=_['defaults'](_0x4d6796[_0xa68b('0x51')],{'firstName':_0x4d6796[_0xa68b('0x51')][_0xa68b('0x92')],'phone':_0x4d6796[_0xa68b('0x51')]['from'],'ListId':_0x4fe870[_0xa68b('0x8e')]});_0x125a28[_0x4d6796[_0xa68b('0x51')][_0xa68b('0xc7')]]=_0x4d6796[_0xa68b('0x51')][_0xa68b('0x92')];return db[_0xa68b('0x87')]['findOrCreate']({'where':_0x491a0d,'defaults':_0x125a28});}})[_0xa68b('0xca')](function(_0x314fbe){if(_0x314fbe){_0x48f2a5=_0x314fbe;var _0x981bb=fs['readFileSync'](path[_0xa68b('0x77')](config[_0xa68b('0x70')],_0xa68b('0xcb')),_0xa68b('0xcc'));var _0x3ddf25=ejs[_0xa68b('0xcd')](_0x981bb,{'body':_['toPairs'](_0x4d6796[_0xa68b('0x51')][_0xa68b('0x51')]),'bodyTitle':_0x3995a3[_0xa68b('0xce')]});return db['ChatOfflineMessage'][_0xa68b('0x50')]({'body':_0x3ddf25,'plainBody':htmlToText[_0xa68b('0xcf')](_0x3ddf25),'ContactId':_0x314fbe['id'],'ChatWebsiteId':_0x3995a3['id']});}})[_0xa68b('0x17')](function(_0x38afd6){_0x20b942=_0x38afd6;if(_0x5f2f69[_0xa68b('0x4f')]){var _0x54d183=_0x5f2f69['map'](function(_0x29c3b8){return{'name':_0x29c3b8[_0xa68b('0xd0')],'basename':_0x29c3b8[_0xa68b('0x68')],'type':_0x29c3b8[_0xa68b('0xd1')],'ChatOfflineMessageId':_0x38afd6['id']};});_0x596fc5=_0x54d183['map'](_0x4f1267=>{var _0x2e27bb={'filename':_0x4f1267['name'],'path':path[_0xa68b('0x77')](config[_0xa68b('0x70')],_0xa68b('0xd2'),_0xa68b('0xc4'),_0xa68b('0xd3'),'offline-chat',_0x4f1267['basename'])};return _0x2e27bb;});if(!_0x3995a3['openNewInteraction']){return db[_0xa68b('0xd4')]['transaction'](function(_0x168774){return db[_0xa68b('0xd5')]['bulkCreate'](_0x54d183,{'transaction':_0x168774});});}}})['then'](function(){if(_0x20b942){_0x59f516=_0x20b942;return db[_0xa68b('0xc9')][_0xa68b('0x5e')]({'where':{'service':!![]},'include':[{'model':db[_0xa68b('0xd6')],'as':_0xa68b('0xd7'),'raw':!![],'include':[{'model':db[_0xa68b('0xd8')],'as':_0xa68b('0xd8'),'raw':!![]}]}]});}})['then'](function(_0x2eec5c){if(_0x2eec5c&&_0x2eec5c[_0xa68b('0xd7')]&&_0x3995a3[_0xa68b('0xd9')]&&_0x3995a3['forwardOfflineAddress']){var _0x9f04f8=_0x2eec5c['getSmtpOptions']();return respondWithRpcPromise(_0xa68b('0xda'),_0xa68b('0xdb'),{'account':_0x9f04f8,'message':{'from':util[_0xa68b('0xa7')](_0xa68b('0xdc'),_0x2eec5c[_0xa68b('0x30')],_0x2eec5c[_0xa68b('0xdd')]||_0x2eec5c[_0xa68b('0xd7')][_0xa68b('0x54')]),'to':_0x3995a3[_0xa68b('0xde')],'subject':_0x3995a3[_0xa68b('0xdf')],'html':_0x59f516[_0xa68b('0x51')],'attachments':_0x596fc5}},client9003)[_0xa68b('0x17')](function(){return _0x59f516;})[_0xa68b('0x4c')](function(_0x39f93f){logger[_0xa68b('0x1e')](_0x39f93f);});}})[_0xa68b('0x17')](function(){if(_0x3995a3&&_0x3995a3[_0xa68b('0xe0')]&&_0x3995a3[_0xa68b('0xe1')]){var _0x152a03=[];if(_0x5f2f69[_0xa68b('0x4f')]){_0x152a03=_0x5f2f69[_0xa68b('0x34')](function(_0x18c8a3){return{'name':_0x18c8a3[_0xa68b('0xd0')],'basename':_0x18c8a3[_0xa68b('0x68')],'type':_0x18c8a3[_0xa68b('0xd1')],'ChatOfflineMessageId':_0x20b942['id']};});}var _0x2ec608;if(!_[_0xa68b('0x75')](_0x3995a3[_0xa68b('0xe2')])){var _0x5cad8c=_[_0xa68b('0x34')](_0x4d6796[_0xa68b('0x51')],function(_0x40e9dd){return _0x40e9dd;});var _0x2c8491=_[_0xa68b('0xe3')](_0x5cad8c)[0x0];var _0x3c2226=_[_0xa68b('0xe4')](_0x2c8491,function(_0x3b5615){return _0x3b5615;});_0x2ec608=_0x3c2226[0x1][_0x3995a3[_0xa68b('0xe2')]];}var _0x28ca5e={'from':_0x48f2a5[_0xa68b('0xdd')],'firstName':_0x48f2a5[_0xa68b('0xb3')],'lastName':_0x48f2a5['lastName'],'mapKey':_0xa68b('0xdd'),'message':{'from':_0x48f2a5[_0xa68b('0xdd')],'to':_0x3995a3[_0xa68b('0xc9')][_0xa68b('0xdd')],'cc':'','subject':_['isNil'](_0x2ec608)?_0x3995a3[_0xa68b('0xdf')]:_0x2ec608,'messageId':'','sentAt':new Date(),'attach':_0x152a03[_0xa68b('0x4f')],'attachments':_0x152a03,'originChannel':_0xa68b('0xe5'),'ChatWebsiteId':_0x3995a3['id'],'ChatOfflineMessageId':_0x59f516['id'],'originTo':_0x3995a3[_0xa68b('0xc9')][_0xa68b('0xdd')]},'body':_0x59f516[_0xa68b('0x51')]};var _0x123008={'account':{'id':_0x3995a3[_0xa68b('0xe1')]},'body':_0x28ca5e,'log':_0xa68b('0xe6')};return respondWithRpcPromise(_0xa68b('0xe6'),_0xa68b('0xe7'),_0x123008,client9001)[_0xa68b('0x17')](function(){return _0x59f516;})[_0xa68b('0x4c')](function(_0x5914be){logger['error'](_0x5914be);});}return;})['then'](function(){if(_0x59f516){return _0x59f516;}})['then'](respondWithResult(_0x448930,null))[_0xa68b('0x4c')](function(_0x4c2960){logger[_0xa68b('0x1e')](_0xa68b('0x4c'),_0x4c2960);for(var _0x30e099 of _0x5f2f69){var _0xb65c21=path[_0xa68b('0x77')](config[_0xa68b('0x70')],'server','files',_0xa68b('0xd3'),'offline-chat',_0x30e099[_0xa68b('0x68')]);fs_extra['remove'](_0xb65c21)[_0xa68b('0x4c')](function(_0x45b1bd){logger['error'](_0xa68b('0xe8'),_0xb65c21,_0x45b1bd);});}});};exports[_0xa68b('0xe9')]=function(_0x339b62,_0x491417){return db[_0xa68b('0xae')]['find']({'where':{'id':_0x339b62[_0xa68b('0x4e')]['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x491417,null))[_0xa68b('0x17')](function(_0x3d55c7){if(_0x3d55c7){return _0x3d55c7[_0xa68b('0xe9')](_0x339b62[_0xa68b('0x51')]['ids'],_[_0xa68b('0xea')](_0x339b62['body'],[_0xa68b('0xeb'),'id'])||{});}})[_0xa68b('0x17')](respondWithResult(_0x491417,null))[_0xa68b('0x4c')](handleError(_0x491417,null));};exports[_0xa68b('0xec')]=function(_0x5593ea,_0x41635e){var _0x5781e7={'raw':![],'where':{}};var _0x4a5dfb={};var _0x12b436={'count':0x0,'rows':[]};return db[_0xa68b('0x35')][_0xa68b('0x5e')]({'where':{'id':_0x5593ea[_0xa68b('0x4e')]['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x41635e,null))[_0xa68b('0x17')](function(_0xcc7d8f){if(_0xcc7d8f){_0x4a5dfb[_0xa68b('0x3a')]=_[_0xa68b('0x3b')](db[_0xa68b('0xae')][_0xa68b('0x36')]);_0x4a5dfb[_0xa68b('0x3c')]=_[_0xa68b('0x3b')](_0x5593ea[_0xa68b('0x3c')]);_0x4a5dfb[_0xa68b('0x3d')]=_['intersection'](_0x4a5dfb['model'],_0x4a5dfb[_0xa68b('0x3c')]);_0x5781e7[_0xa68b('0x3f')]=_[_0xa68b('0x3e')](_0x4a5dfb[_0xa68b('0x3a')],qs[_0xa68b('0x40')](_0x5593ea['query'][_0xa68b('0x40')]));_0x5781e7[_0xa68b('0x3f')]=_0x5781e7[_0xa68b('0x3f')][_0xa68b('0x4f')]?_0x5781e7['attributes']:_0x4a5dfb[_0xa68b('0x3a')];if(!_0x5593ea[_0xa68b('0x3c')][_0xa68b('0x41')]('nolimit')){_0x5781e7[_0xa68b('0x26')]=qs[_0xa68b('0x26')](_0x5593ea[_0xa68b('0x3c')][_0xa68b('0x26')]);_0x5781e7[_0xa68b('0x28')]=qs[_0xa68b('0x28')](_0x5593ea[_0xa68b('0x3c')][_0xa68b('0x28')]);}_0x5781e7[_0xa68b('0x64')]=qs[_0xa68b('0x42')](_0x5593ea[_0xa68b('0x3c')][_0xa68b('0x42')]);_0x5781e7[_0xa68b('0x44')]=qs[_0xa68b('0x3d')](_[_0xa68b('0x60')](_0x5593ea[_0xa68b('0x3c')],_0x4a5dfb['filters']));_0x5781e7['where']['ChatWebsiteId']=_0xcc7d8f['id'];if(_0x5593ea[_0xa68b('0x3c')][_0xa68b('0x43')]){_0x5781e7[_0xa68b('0x44')]=_[_0xa68b('0x45')](_0x5781e7['where'],{'$or':_['map'](_0x5781e7[_0xa68b('0x3f')],function(_0x5f2e0b){var _0xe23bca={};_0xe23bca[_0x5f2e0b]={'$like':'%'+_0x5593ea[_0xa68b('0x3c')][_0xa68b('0x43')]+'%'};return _0xe23bca;})});}_0x5781e7=_['merge']({},_0x5781e7,_0x5593ea['options']);return db[_0xa68b('0xae')][_0xa68b('0x27')]({'where':_0x5781e7[_0xa68b('0x44')]})['then'](function(_0x148df1){_0x12b436['count']=_0x148df1;if(_0x5593ea['query'][_0xa68b('0x48')]){_0x5781e7[_0xa68b('0x49')]=[{'model':db[_0xa68b('0x87')],'as':_0xa68b('0xed'),'required':![]},{'model':db[_0xa68b('0xee')],'as':'Owner','attributes':[_0xa68b('0x30'),_0xa68b('0xef'),'internal'],'required':![]},{'model':db[_0xa68b('0xf0')],'as':_0xa68b('0xf1'),'attributes':['id',_0xa68b('0x30'),_0xa68b('0xf2')],'where':_0x5593ea[_0xa68b('0x3c')][_0xa68b('0xf3')]?{'id':_0x5593ea[_0xa68b('0x3c')]['tag']}:undefined,'required':_0x5593ea['query'][_0xa68b('0xf3')]?!![]:![]}];}return db['ChatInteraction'][_0xa68b('0x4a')](_0x5781e7);})[_0xa68b('0x17')](function(_0x39431f){_0x12b436[_0xa68b('0x4b')]=_0x39431f;return _0x12b436;});}})[_0xa68b('0x17')](respondWithFilteredResult(_0x41635e,_0x5781e7))[_0xa68b('0x4c')](handleError(_0x41635e,null));};function iftimePromise(_0x2562bb,_0x378dac){return respondWithRpcPromise(_0xa68b('0xf4'),_0xa68b('0xf5'),{'command':_0x378dac[_0xa68b('0xf6')]?util[_0xa68b('0xa7')]('iftime\x20%s,%s',_0x2562bb[_0xa68b('0xf7')],_0x378dac[_0xa68b('0xf6')]):util[_0xa68b('0xa7')](_0xa68b('0xf8'),_0x2562bb[_0xa68b('0xf7')])},client9002)[_0xa68b('0x17')](function(_0x320290){var _0x5f1644=_0x320290&&_0x320290[_0xa68b('0xf9')](_0xa68b('0xfa'))>=0x0?!![]:![];logger[_0xa68b('0x18')](_0xa68b('0xfb'),_0x378dac['id'],_0x2562bb['id'],_0x2562bb[_0xa68b('0xf7')],_0x5f1644?'ONLINE':_0xa68b('0xfc'),_0x378dac[_0xa68b('0xf6')]?_0x378dac[_0xa68b('0xf6')]:_0xa68b('0xfd'));return _0x5f1644;})[_0xa68b('0x4c')](function(_0xc37715){logger[_0xa68b('0x1e')](_0xa68b('0xfb'),_0x378dac['id'],_0x2562bb['id'],_0x2562bb['interval'],util[_0xa68b('0xfe')](_0xc37715,{'showHidden':![],'depth':null}),_0x378dac[_0xa68b('0xf6')]?_0x378dac[_0xa68b('0xf6')]:_0xa68b('0xfd'));return![];});}exports[_0xa68b('0xf5')]=function(_0x385aae,_0x3c3fe0){var _0xf2564d=0x0;var _0x1e5e65=0x0;var _0x304ff0=![];var _0x4f19e2;var _0x599ade;return db[_0xa68b('0x35')][_0xa68b('0x55')]({'where':{'id':_0x385aae['params']['id']},'include':[{'model':db[_0xa68b('0xff')],'as':'Interval','include':[{'model':db[_0xa68b('0xff')],'as':_0xa68b('0x100'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3c3fe0,null))[_0xa68b('0x17')](function(_0x5e008d){if(_0x5e008d){_0x4f19e2=_0x5e008d;return _0x5e008d[_0xa68b('0x101')]({'raw':!![]});}})['then'](function(_0xcf0058){if(_0x4f19e2){if(_0xcf0058){_0x599ade=_0xcf0058;}}return require(_0xa68b('0x72'))[_0xa68b('0x73')]();})[_0xa68b('0x17')](function(_0x48afc8){if(_0x48afc8){_0x1e5e65=_0x48afc8[_0xa68b('0x102')];_0x304ff0=_0x48afc8[_0xa68b('0x74')];}})['then'](function(){return db[_0xa68b('0xae')][_0xa68b('0x27')]({'where':{'closed':![]}});})['then'](function(_0x51a0ff){_0xf2564d=_0x51a0ff;if(_0x1e5e65&&_0x51a0ff>_0x1e5e65){return db[_0xa68b('0x103')][_0xa68b('0x5e')]({'where':{'id':0x1}})[_0xa68b('0x17')](function(_0x1c006c){if(_0x1c006c){_0x1c006c['increment'](_0xa68b('0x104'));}});}})['then'](function(){if(_0x4f19e2['Interval']&&_0x4f19e2[_0xa68b('0xff')][_0xa68b('0x100')]){var _0x945b58=[];for(var _0x32780c=0x0;_0x32780c<_0x4f19e2[_0xa68b('0xff')][_0xa68b('0x100')][_0xa68b('0x4f')];_0x32780c++){var _0x4d4e76=_0x4f19e2[_0xa68b('0xff')][_0xa68b('0x100')][_0x32780c][_0xa68b('0x2c')]({'plain':!![]});_0x945b58[_0xa68b('0xb7')](iftimePromise(_0x4d4e76,_0x4f19e2));}return BPromise[_0xa68b('0x105')](_0x945b58)['then'](function(_0x144710){return _[_0xa68b('0x106')](_0x144710);});}else{return!![];}})[_0xa68b('0x17')](function(_0x32dd04){var _0x5de1bb=fs[_0xa68b('0x107')](path['join'](config[_0xa68b('0x70')],_0xa68b('0x108')),'utf8');var _0xa80a2a={'remote':_0x4f19e2[_0xa68b('0x109')],'query':querystring[_0xa68b('0x1d')](_[_0xa68b('0x45')](_0x4f19e2[_0xa68b('0x2c')]({'plain':!![]}),{'customerIp':_0x385aae['headers']['x-forwarded-for']||_0x385aae[_0xa68b('0x83')][_0xa68b('0x10a')]||_0x385aae[_0xa68b('0x10b')]['remoteAddress']||_0x385aae['ip'],'referer':_0x385aae['headers']['referer'],'openedInteractions':_0xf2564d,'maxInteractions':_0x1e5e65,'virtual':_0x304ff0[_0xa68b('0x102')],'online':_0x32dd04,'custom':_0x304ff0}))[_0xa68b('0x10c')](/'/g,'\x5c\x27')};_0x3c3fe0[_0xa68b('0xc6')](ejs[_0xa68b('0xcd')](Mustache['render'](_0x5de1bb,_0xa80a2a),{'proactiveActions':_0x599ade,'alignment':_0x4f19e2['alignment'],'verticalAlignment':_0x4f19e2[_0xa68b('0x10d')],'div_color':_0x4f19e2[_0xa68b('0xf2')],'labelText':_0x4f19e2[_0xa68b('0x10e')],'text_color':_0x4f19e2[_0xa68b('0x10f')],'text_button_color':_0x4f19e2[_0xa68b('0x110')],'button_color':_0x4f19e2[_0xa68b('0x111')],'background_color':_0x4f19e2['backgroundColor'],'hideWhenOffline':_0x4f19e2[_0xa68b('0x112')],'interval':_0x4f19e2[_0xa68b('0x113')]}));})[_0xa68b('0x4c')](handleError(_0x3c3fe0,null));};exports[_0xa68b('0x114')]=function(_0x9c0744,_0x35b482){var _0x2fa604=_0x9c0744[_0xa68b('0x4e')]['id'];var _0x5251e3=_0x9c0744[_0xa68b('0x51')];var _0x28e987=0xc8;var _0x5a765c=null;return db[_0xa68b('0xd4')]['transaction']({'isolationLevel':db[_0xa68b('0xd4')][_0xa68b('0x115')][_0xa68b('0x116')][_0xa68b('0x117')]},function(_0x4df97c){return db['ChatWebsite'][_0xa68b('0x5e')]({'where':{'id':_0x2fa604},'transaction':_0x4df97c})[_0xa68b('0x17')](function(_0x1c91b7){if(_0x1c91b7){return db[_0xa68b('0x97')][_0xa68b('0x2b')]({'where':{'ChatWebsiteId':_0x2fa604},'transaction':_0x4df97c})[_0xa68b('0x17')](function(){var _0x317ee7=_[_0xa68b('0x34')](_0x5251e3,function(_0x2d4341){_0x2d4341['ChatWebsiteId']=_0x2fa604;return _0x2d4341;});return db[_0xa68b('0x97')][_0xa68b('0x118')](_0x317ee7,{'transaction':_0x4df97c});});}else{_0x28e987=0x194;_0x5a765c=[];}});})[_0xa68b('0x17')](function(){if(_0x28e987!==0x194){return db['ChatApplication'][_0xa68b('0x119')]({'where':{'ChatWebsiteId':_0x2fa604},'order':_0xa68b('0x9d')})[_0xa68b('0x17')](function(_0x412577){_0x5a765c=_0x412577;});}})[_0xa68b('0x4c')](function(_0x5ee83f){_0x28e987=0x1f4;logger['error'](_0x5ee83f['stack']);if(_0x5ee83f[_0xa68b('0x30')]){delete _0x5ee83f[_0xa68b('0x30')];}_0x5a765c=_0x5ee83f;})[_0xa68b('0x11a')](function(){if(_0x5a765c===null){_0x35b482[_0xa68b('0x21')](_0x28e987);}else{if(_0x28e987===0x1f4){_0x35b482[_0xa68b('0x22')](_0x28e987)[_0xa68b('0xc6')](_0x5a765c);}else{_0x35b482[_0xa68b('0x22')](_0x28e987)[_0xa68b('0x24')](_0x5a765c);}}});};exports[_0xa68b('0x11b')]=function(_0x1dd255,_0x52bd36){var _0x3b028c={};var _0x3a370c={};var _0x41575d;var _0x28c1b5;return db['ChatWebsite'][_0xa68b('0x5e')]({'where':{'id':_0x1dd255[_0xa68b('0x4e')]['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x52bd36,null))[_0xa68b('0x17')](function(_0x136480){if(_0x136480){_0x41575d=_0x136480;_0x3a370c['model']=_[_0xa68b('0x3b')](db[_0xa68b('0x97')]['rawAttributes']);_0x3a370c[_0xa68b('0x3c')]=_[_0xa68b('0x3b')](_0x1dd255[_0xa68b('0x3c')]);_0x3a370c[_0xa68b('0x3d')]=_[_0xa68b('0x3e')](_0x3a370c['model'],_0x3a370c[_0xa68b('0x3c')]);_0x3b028c[_0xa68b('0x3f')]=_[_0xa68b('0x3e')](_0x3a370c['model'],qs[_0xa68b('0x40')](_0x1dd255[_0xa68b('0x3c')]['fields']));_0x3b028c['attributes']=_0x3b028c[_0xa68b('0x3f')][_0xa68b('0x4f')]?_0x3b028c[_0xa68b('0x3f')]:_0x3a370c['model'];_0x3b028c['order']=qs[_0xa68b('0x42')](_0x1dd255[_0xa68b('0x3c')][_0xa68b('0x42')]);_0x3b028c[_0xa68b('0x44')]=qs[_0xa68b('0x3d')](_[_0xa68b('0x60')](_0x1dd255['query'],_0x3a370c[_0xa68b('0x3d')]));if(_0x1dd255[_0xa68b('0x3c')]['filter']){_0x3b028c[_0xa68b('0x44')]=_[_0xa68b('0x45')](_0x3b028c[_0xa68b('0x44')],{'$or':_[_0xa68b('0x34')](_0x3b028c[_0xa68b('0x3f')],function(_0x24b373){var _0x28c59b={};_0x28c59b[_0x24b373]={'$like':'%'+_0x1dd255[_0xa68b('0x3c')]['filter']+'%'};return _0x28c59b;})});}_0x3b028c=_[_0xa68b('0x45')]({},_0x3b028c,_0x1dd255[_0xa68b('0x47')]);return _0x41575d[_0xa68b('0x11b')](_0x3b028c);}})['then'](function(_0x3c8a73){if(_0x3c8a73){_0x28c1b5=_0x3c8a73[_0xa68b('0x4f')];if(!_0x1dd255[_0xa68b('0x3c')]['hasOwnProperty']('nolimit')){_0x3b028c[_0xa68b('0x26')]=qs[_0xa68b('0x26')](_0x1dd255[_0xa68b('0x3c')][_0xa68b('0x26')]);_0x3b028c[_0xa68b('0x28')]=qs[_0xa68b('0x28')](_0x1dd255[_0xa68b('0x3c')][_0xa68b('0x28')]);}return _0x41575d['getApplications'](_0x3b028c);}})[_0xa68b('0x17')](function(_0x3e4aca){if(_0x3e4aca){return _0x3e4aca?{'count':_0x28c1b5,'rows':_0x3e4aca}:null;}})[_0xa68b('0x17')](respondWithResult(_0x52bd36,null))['catch'](handleError(_0x52bd36,null));};exports[_0xa68b('0x11c')]=function(_0x5c3ca5,_0x1e306d){return db[_0xa68b('0x11d')]['find']({'where':{'id':_0x5c3ca5['params']['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x1e306d,null))[_0xa68b('0x17')](function(_0x3d9960){if(_0x3d9960){return _0x3d9960['addProactiveActions'](_0x5c3ca5[_0xa68b('0x51')][_0xa68b('0xeb')],_[_0xa68b('0xea')](_0x5c3ca5['body'],[_0xa68b('0xeb'),'id'])||{});}})[_0xa68b('0x17')](respondWithResult(_0x1e306d,null))[_0xa68b('0x4c')](handleError(_0x1e306d,null));};exports[_0xa68b('0x101')]=function(_0x1751b2,_0x2a688a){var _0x249586={};var _0x2994d5={};var _0x1da71a;var _0x568579;return db[_0xa68b('0x35')][_0xa68b('0x5e')]({'where':{'id':_0x1751b2[_0xa68b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2a688a,null))[_0xa68b('0x17')](function(_0x2bce){if(_0x2bce){_0x1da71a=_0x2bce;_0x2994d5[_0xa68b('0x3a')]=_[_0xa68b('0x3b')](db[_0xa68b('0x11e')][_0xa68b('0x36')]);_0x2994d5['query']=_[_0xa68b('0x3b')](_0x1751b2[_0xa68b('0x3c')]);_0x2994d5[_0xa68b('0x3d')]=_['intersection'](_0x2994d5[_0xa68b('0x3a')],_0x2994d5[_0xa68b('0x3c')]);_0x249586[_0xa68b('0x3f')]=_[_0xa68b('0x3e')](_0x2994d5[_0xa68b('0x3a')],qs[_0xa68b('0x40')](_0x1751b2[_0xa68b('0x3c')]['fields']));_0x249586[_0xa68b('0x3f')]=_0x249586[_0xa68b('0x3f')]['length']?_0x249586['attributes']:_0x2994d5['model'];_0x249586['order']=qs[_0xa68b('0x42')](_0x1751b2[_0xa68b('0x3c')][_0xa68b('0x42')]);_0x249586[_0xa68b('0x44')]=qs[_0xa68b('0x3d')](_['pick'](_0x1751b2[_0xa68b('0x3c')],_0x2994d5[_0xa68b('0x3d')]));if(_0x1751b2[_0xa68b('0x3c')]['filter']){_0x249586[_0xa68b('0x44')]=_[_0xa68b('0x45')](_0x249586['where'],{'$or':_['map'](_0x249586[_0xa68b('0x3f')],function(_0x197327){var _0x596173={};_0x596173[_0x197327]={'$like':'%'+_0x1751b2[_0xa68b('0x3c')]['filter']+'%'};return _0x596173;})});}_0x249586=_['merge']({},_0x249586,_0x1751b2[_0xa68b('0x47')]);return _0x1da71a[_0xa68b('0x101')](_0x249586);}})[_0xa68b('0x17')](function(_0x391592){if(_0x391592){_0x568579=_0x391592[_0xa68b('0x4f')];if(!_0x1751b2['query'][_0xa68b('0x41')]('nolimit')){_0x249586[_0xa68b('0x26')]=qs[_0xa68b('0x26')](_0x1751b2['query'][_0xa68b('0x26')]);_0x249586[_0xa68b('0x28')]=qs['offset'](_0x1751b2[_0xa68b('0x3c')][_0xa68b('0x28')]);}return _0x1da71a[_0xa68b('0x101')](_0x249586);}})['then'](function(_0x961fbd){if(_0x961fbd){return _0x961fbd?{'count':_0x568579,'rows':_0x961fbd}:null;}})['then'](respondWithResult(_0x2a688a,null))[_0xa68b('0x4c')](handleError(_0x2a688a,null));};exports[_0xa68b('0x11f')]=function(_0x30fae7,_0x59105b){var _0x41cfa4=_0x30fae7[_0xa68b('0x3c')][_0xa68b('0x120')]==='false'?_0xa68b('0x121'):_0xa68b('0x122');return db[_0xa68b('0x35')]['find']({'attributes':['id',_0x41cfa4],'where':{'id':_0x30fae7['params']['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x59105b,null))['then'](function(_0x2f32bb){if(_0x2f32bb){var _0x29cbf0=_0x2f32bb[_0x41cfa4];var _0x36ad24=_0x29cbf0&&_0x29cbf0[_0xa68b('0x123')]?_0x29cbf0[_0xa68b('0x123')]:[];_0x59105b[_0xa68b('0xc6')]({'fromKey':_[_0xa68b('0x75')](_0x29cbf0[_0xa68b('0x124')])?undefined:_0x29cbf0['fromKey'],'count':_0x36ad24[_0xa68b('0x4f')],'rows':_0x36ad24});}})[_0xa68b('0x4c')](handleError(_0x59105b,null));};exports[_0xa68b('0x125')]=function(_0xdee5f8,_0x4bbaa9){var _0x53c2f8={'raw':![],'where':{}};var _0x269bb2={};var _0x2d2aa7={'count':0x0,'rows':[]};return db[_0xa68b('0x35')]['findOne']({'where':{'id':_0xdee5f8['params']['id']}})['then'](handleEntityNotFound(_0x4bbaa9,null))[_0xa68b('0x17')](function(_0x51d76a){if(_0x51d76a){_0x269bb2[_0xa68b('0x3a')]=_[_0xa68b('0x3b')](db[_0xa68b('0x126')][_0xa68b('0x36')]);_0x269bb2[_0xa68b('0x3c')]=_['keys'](_0xdee5f8['query']);_0x269bb2['filters']=_['intersection'](_0x269bb2[_0xa68b('0x3a')],_0x269bb2[_0xa68b('0x3c')]);_0x53c2f8[_0xa68b('0x3f')]=_[_0xa68b('0x3e')](_0x269bb2[_0xa68b('0x3a')],qs[_0xa68b('0x40')](_0xdee5f8['query'][_0xa68b('0x40')]));_0x53c2f8['attributes']=_0x53c2f8['attributes']['length']?_0x53c2f8[_0xa68b('0x3f')]:_0x269bb2['model'];if(!_0xdee5f8['query']['hasOwnProperty'](_0xa68b('0x5f'))){_0x53c2f8['limit']=qs[_0xa68b('0x26')](_0xdee5f8[_0xa68b('0x3c')][_0xa68b('0x26')]);_0x53c2f8[_0xa68b('0x28')]=qs[_0xa68b('0x28')](_0xdee5f8[_0xa68b('0x3c')][_0xa68b('0x28')]);}_0x53c2f8[_0xa68b('0x64')]=qs[_0xa68b('0x42')](_0xdee5f8[_0xa68b('0x3c')][_0xa68b('0x42')]);_0x53c2f8['where']=qs[_0xa68b('0x3d')](_[_0xa68b('0x60')](_0xdee5f8[_0xa68b('0x3c')],_0x269bb2[_0xa68b('0x3d')]));_0x53c2f8[_0xa68b('0x44')][_0xa68b('0x5b')]=_0x51d76a['id'];if(_0xdee5f8[_0xa68b('0x3c')][_0xa68b('0x43')]){_0x53c2f8['where']=_[_0xa68b('0x45')](_0x53c2f8['where'],{'$or':_[_0xa68b('0x34')](_0x53c2f8[_0xa68b('0x3f')],function(_0x1cdf8d){var _0x134f68={};_0x134f68[_0x1cdf8d]={'$like':'%'+_0xdee5f8[_0xa68b('0x3c')]['filter']+'%'};return _0x134f68;})});}_0x53c2f8=_['merge']({},_0x53c2f8,_0xdee5f8['options']);return db['ChatOfflineMessage'][_0xa68b('0x27')]({'where':_0x53c2f8[_0xa68b('0x44')]})['then'](function(_0x4980cd){_0x2d2aa7[_0xa68b('0x27')]=_0x4980cd;if(_0xdee5f8['query'][_0xa68b('0x48')]){_0x53c2f8['include']=[{'all':!![]}];}else{_0x53c2f8['include']=[{'model':db[_0xa68b('0x87')],'as':_0xa68b('0xed'),'required':![]},{'model':db['Attachment'],'as':_0xa68b('0x127'),'required':![]}];}return db[_0xa68b('0x126')][_0xa68b('0x4a')](_0x53c2f8);})['then'](function(_0x38808c){_0x2d2aa7[_0xa68b('0x4b')]=_0x38808c;return _0x2d2aa7;});}})[_0xa68b('0x17')](respondWithFilteredResult(_0x4bbaa9,_0x53c2f8))[_0xa68b('0x4c')](handleError(_0x4bbaa9,null));};exports[_0xa68b('0x128')]=function(_0x192242,_0x56cc03){return db['ChatWebsite'][_0xa68b('0x55')]({'where':{'id':_0x192242[_0xa68b('0x4e')]['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x56cc03,null))['then'](function(_0x34c004){if(_0x34c004){return _0x34c004[_0xa68b('0x128')](_0x192242[_0xa68b('0x51')][_0xa68b('0xeb')],_[_0xa68b('0xea')](_0x192242['body'],[_0xa68b('0xeb'),'id'])||{})[_0xa68b('0xca')](function(_0x536849){for(var _0xb91d9b=0x0;_0xb91d9b<_0x192242[_0xa68b('0x51')][_0xa68b('0xeb')][_0xa68b('0x4f')];_0xb91d9b+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x192242['body'][_0xa68b('0xeb')][_0xb91d9b]),'ChatWebsiteId':Number(_0x192242[_0xa68b('0x4e')]['id'])});}return _0x536849;});}})['then'](respondWithResult(_0x56cc03,null))['catch'](handleError(_0x56cc03,null));};exports[_0xa68b('0x129')]=function(_0xdd795b,_0x5a18e7){return db[_0xa68b('0x35')][_0xa68b('0x55')]({'where':{'id':_0xdd795b[_0xa68b('0x4e')]['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x5a18e7,null))[_0xa68b('0x17')](function(_0x43d463){if(_0x43d463){return _0x43d463[_0xa68b('0x129')](_0xdd795b[_0xa68b('0x3c')][_0xa68b('0xeb')])[_0xa68b('0x17')](function(){if(_['isArray'](_0xdd795b[_0xa68b('0x3c')]['ids'])){for(var _0x154a1f=0x0;_0x154a1f<_0xdd795b[_0xa68b('0x3c')][_0xa68b('0xeb')]['length'];_0x154a1f+=0x1){socket[_0xa68b('0x12a')](_0xa68b('0x12b'),{'UserId':Number(_0xdd795b[_0xa68b('0x3c')]['ids'][_0x154a1f]),'ChatWebsiteId':Number(_0xdd795b['params']['id'])});}}else{socket[_0xa68b('0x12a')](_0xa68b('0x12b'),{'UserId':Number(_0xdd795b['query'][_0xa68b('0xeb')]),'ChatWebsiteId':Number(_0xdd795b[_0xa68b('0x4e')]['id'])});}});}})[_0xa68b('0x17')](respondWithStatusCode(_0x5a18e7,null))[_0xa68b('0x4c')](handleError(_0x5a18e7,null));};exports[_0xa68b('0x12c')]=function(_0x261518,_0x23b3e4){var _0x435a23={};var _0x497e78={};var _0x4a59b3;var _0x193d29;return db[_0xa68b('0x35')]['findOne']({'where':{'id':_0x261518[_0xa68b('0x4e')]['id']}})[_0xa68b('0x17')](handleEntityNotFound(_0x23b3e4,null))['then'](function(_0x47fe45){if(_0x47fe45){_0x4a59b3=_0x47fe45;_0x497e78['model']=_[_0xa68b('0x3b')](db[_0xa68b('0xee')][_0xa68b('0x36')]);_0x497e78[_0xa68b('0x3c')]=_[_0xa68b('0x3b')](_0x261518['query']);_0x497e78[_0xa68b('0x3d')]=_[_0xa68b('0x3e')](_0x497e78[_0xa68b('0x3a')],_0x497e78[_0xa68b('0x3c')]);_0x435a23['attributes']=_[_0xa68b('0x3e')](_0x497e78[_0xa68b('0x3a')],qs[_0xa68b('0x40')](_0x261518[_0xa68b('0x3c')][_0xa68b('0x40')]));_0x435a23[_0xa68b('0x3f')]=_0x435a23[_0xa68b('0x3f')][_0xa68b('0x4f')]?_0x435a23[_0xa68b('0x3f')]:_0x497e78[_0xa68b('0x3a')];_0x435a23['order']=qs['sort'](_0x261518[_0xa68b('0x3c')]['sort']);_0x435a23[_0xa68b('0x44')]=qs[_0xa68b('0x3d')](_[_0xa68b('0x60')](_0x261518[_0xa68b('0x3c')],_0x497e78[_0xa68b('0x3d')]));if(_0x261518[_0xa68b('0x3c')]['filter']){_0x435a23[_0xa68b('0x44')]=_['merge'](_0x435a23[_0xa68b('0x44')],{'$or':_[_0xa68b('0x34')](_0x435a23['attributes'],function(_0x306cf5){var _0x5cbfe7={};_0x5cbfe7[_0x306cf5]={'$like':'%'+_0x261518['query'][_0xa68b('0x43')]+'%'};return _0x5cbfe7;})});}_0x435a23=_[_0xa68b('0x45')]({},_0x435a23,_0x261518[_0xa68b('0x47')]);return _0x4a59b3[_0xa68b('0x12c')](_0x435a23);}})[_0xa68b('0x17')](function(_0x13dc3b){if(_0x13dc3b){_0x193d29=_0x13dc3b[_0xa68b('0x4f')];if(!_0x261518[_0xa68b('0x3c')][_0xa68b('0x41')](_0xa68b('0x5f'))){_0x435a23[_0xa68b('0x26')]=qs[_0xa68b('0x26')](_0x261518[_0xa68b('0x3c')][_0xa68b('0x26')]);_0x435a23[_0xa68b('0x28')]=qs[_0xa68b('0x28')](_0x261518['query']['offset']);}return _0x4a59b3[_0xa68b('0x12c')](_0x435a23);}})[_0xa68b('0x17')](function(_0x4d0bbc){if(_0x4d0bbc){return _0x4d0bbc?{'count':_0x193d29,'rows':_0x4d0bbc}:null;}})[_0xa68b('0x17')](respondWithResult(_0x23b3e4,null))[_0xa68b('0x4c')](handleError(_0x23b3e4,null));}; \ No newline at end of file +var _0xd73b=['sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','finally','getApplications','addProactiveActions','omit','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','status','json','undefined','limit','offset','count','Content-Range','update','destroy','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','findAll','catch','show','mandatoryDispositionPause','includeAll','options','create','body','user','get','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ChatWebsiteId','Disposition','sort','include','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','ValidationError','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','Applications','list','applications','priority','asc','account','Contacts','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','threadId','ChatInteraction','externalUrl','interaction','spread','firstName','messageId','created','push','close','unmanaged','*,*,*,*','ChatMessage','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','basename','transaction','Attachment','bulkCreate','MailServerOut','CloudProvider','Smtp','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','subjectOffline','email','Chat','NotifyMailAccount','notifyMail','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','../../config/license/util','virtual','License','increment','chatLicenseExceeded','some','remote','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','textButtonColor','backgroundColor','hideWhenOffline','addApplications'];(function(_0x4d235a,_0x581a63){var _0x261f27=function(_0x44e838){while(--_0x44e838){_0x4d235a['push'](_0x4d235a['shift']());}};_0x261f27(++_0x581a63);}(_0xd73b,0x14c));var _0xbd73=function(_0x405227,_0x52d46a){_0x405227=_0x405227-0x0;var _0x667fee=_0xd73b[_0x405227];return _0x667fee;};'use strict';var BPromise=require(_0xbd73('0x0'));var Mustache=require(_0xbd73('0x1'));var util=require(_0xbd73('0x2'));var path=require(_0xbd73('0x3'));var ejs=require(_0xbd73('0x4'));var fs=require('fs');var fs_extra=require(_0xbd73('0x5'));var _=require(_0xbd73('0x6'));var querystring=require(_0xbd73('0x7'));var Redis=require(_0xbd73('0x8'));var qs=require(_0xbd73('0x9'));var logger=require(_0xbd73('0xa'))(_0xbd73('0xb'));var config=require(_0xbd73('0xc'));var db=require(_0xbd73('0xd'))['db'];config[_0xbd73('0xe')]=_[_0xbd73('0xf')](config['redis'],{'host':_0xbd73('0x10'),'port':0x18eb});var socket=require(_0xbd73('0x11'))(new Redis(config[_0xbd73('0xe')]));require(_0xbd73('0x12'))[_0xbd73('0x13')](socket);var htmlToText=require(_0xbd73('0x14'));var jayson=require(_0xbd73('0x15'));var client=jayson[_0xbd73('0x16')][_0xbd73('0x17')]({'port':0x232c});var client9002=jayson[_0xbd73('0x16')][_0xbd73('0x17')]({'port':0x232a});var client9003=jayson[_0xbd73('0x16')][_0xbd73('0x17')]({'port':0x232b});var client9001=jayson['client'][_0xbd73('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x40f731,_0x1d6fd3,_0x2025f8,_0x192569){return new BPromise(function(_0x30105f,_0x577266){var _0x105c3f=_0x192569||client;return _0x105c3f[_0xbd73('0x18')](_0x40f731,_0x2025f8)[_0xbd73('0x19')](function(_0x2eb35c){logger[_0xbd73('0x1a')](_0xbd73('0x1b'),_0x1d6fd3,'request\x20sent');logger[_0xbd73('0x1c')](_0xbd73('0x1d'),_0x1d6fd3,'request\x20sent',JSON[_0xbd73('0x1e')](_0x2eb35c));if(_0x2eb35c[_0xbd73('0x1f')]){if(_0x2eb35c['error'][_0xbd73('0x20')]===0x1f4){logger['error'](_0xbd73('0x1b'),_0x1d6fd3,_0x2eb35c[_0xbd73('0x1f')][_0xbd73('0x21')]);return _0x577266(_0x2eb35c[_0xbd73('0x1f')][_0xbd73('0x21')]);}logger[_0xbd73('0x1f')](_0xbd73('0x1b'),_0x1d6fd3,_0x2eb35c[_0xbd73('0x1f')]['message']);return _0x30105f(_0x2eb35c[_0xbd73('0x1f')][_0xbd73('0x21')]);}else{logger[_0xbd73('0x1a')](_0xbd73('0x1b'),_0x1d6fd3,_0xbd73('0x22'));_0x30105f(_0x2eb35c[_0xbd73('0x23')][_0xbd73('0x21')]);}})['catch'](function(_0x5cd2cc){logger[_0xbd73('0x1f')](_0xbd73('0x1b'),_0x1d6fd3,_0x5cd2cc);_0x577266(_0x5cd2cc);});});}function respondWithStatusCode(_0x439da1,_0x58b575){_0x58b575=_0x58b575||0xcc;return function(_0x588a26){if(_0x588a26){return _0x439da1['sendStatus'](_0x58b575);}return _0x439da1[_0xbd73('0x24')](_0x58b575)['end']();};}function respondWithResult(_0x83ab9f,_0x127581){_0x127581=_0x127581||0xc8;return function(_0x3069c3){if(_0x3069c3){return _0x83ab9f[_0xbd73('0x24')](_0x127581)[_0xbd73('0x25')](_0x3069c3);}};}function respondWithFilteredResult(_0x18f58d,_0x468e6a){return function(_0x22c2ab){if(_0x22c2ab){var _0x3d966a=typeof _0x468e6a['offset']===_0xbd73('0x26')&&typeof _0x468e6a[_0xbd73('0x27')]===_0xbd73('0x26');var _0x151795=_0x22c2ab['count'];var _0x23ffd8=_0x3d966a?0x0:_0x468e6a[_0xbd73('0x28')];var _0x9d69b=_0x3d966a?_0x22c2ab[_0xbd73('0x29')]:_0x468e6a['offset']+_0x468e6a[_0xbd73('0x27')];var _0x49cd51;if(_0x9d69b>=_0x151795){_0x9d69b=_0x151795;_0x49cd51=0xc8;}else{_0x49cd51=0xce;}_0x18f58d['status'](_0x49cd51);return _0x18f58d['set'](_0xbd73('0x2a'),_0x23ffd8+'-'+_0x9d69b+'/'+_0x151795)['json'](_0x22c2ab);}return null;};}function saveUpdates(_0x40248a){return function(_0x2a8077){if(_0x2a8077){return _0x2a8077[_0xbd73('0x2b')](_0x40248a)['then'](function(_0xd23d15){return _0xd23d15;});}return null;};}function removeEntity(_0x1c24eb){return function(_0x283813){if(_0x283813){return _0x283813[_0xbd73('0x2c')]()[_0xbd73('0x19')](function(){var _0x1da9a3=_0x283813['get']({'plain':!![]});var _0xce5b35=_0xbd73('0x2d');return db[_0xbd73('0x2e')][_0xbd73('0x2c')]({'where':{'type':_0xce5b35,'resourceId':_0x1da9a3['id']}})[_0xbd73('0x19')](function(){return _0x283813;});})[_0xbd73('0x19')](function(){_0x1c24eb[_0xbd73('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36fa65){return function(_0x540a8c){if(!_0x540a8c){_0x36fa65['sendStatus'](0x194);}return _0x540a8c;};}function handleError(_0x29dec0,_0x245bcd){_0x245bcd=_0x245bcd||0x1f4;return function(_0x39f22f){logger[_0xbd73('0x1f')](_0x39f22f[_0xbd73('0x2f')]);if(_0x39f22f[_0xbd73('0x30')]){delete _0x39f22f['name'];}_0x29dec0['status'](_0x245bcd)[_0xbd73('0x31')](_0x39f22f);};}exports[_0xbd73('0x32')]=function(_0x51f52b,_0x3c15b5){var _0x2bfeb6={'include':[{'model':db[_0xbd73('0x33')],'as':'mandatoryDispositionPause'}]},_0x579845={},_0x315e53={'count':0x0,'rows':[]};var _0x3a13e1=_[_0xbd73('0x34')](db[_0xbd73('0x35')][_0xbd73('0x36')],function(_0x133bbb){return{'name':_0x133bbb[_0xbd73('0x37')],'type':_0x133bbb['type']['key']};});_0x579845[_0xbd73('0x38')]=_[_0xbd73('0x34')](_0x3a13e1,'name');_0x579845[_0xbd73('0x39')]=_[_0xbd73('0x3a')](_0x51f52b['query']);_0x579845[_0xbd73('0x3b')]=_['intersection'](_0x579845[_0xbd73('0x38')],_0x579845[_0xbd73('0x39')]);_0x2bfeb6[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x579845[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0x51f52b[_0xbd73('0x39')][_0xbd73('0x3e')]));_0x2bfeb6[_0xbd73('0x3c')]=_0x2bfeb6[_0xbd73('0x3c')][_0xbd73('0x3f')]?_0x2bfeb6[_0xbd73('0x3c')]:_0x579845['model'];if(!_0x51f52b[_0xbd73('0x39')][_0xbd73('0x40')](_0xbd73('0x41'))){_0x2bfeb6['limit']=qs[_0xbd73('0x27')](_0x51f52b[_0xbd73('0x39')][_0xbd73('0x27')]);_0x2bfeb6[_0xbd73('0x28')]=qs['offset'](_0x51f52b[_0xbd73('0x39')]['offset']);}_0x2bfeb6[_0xbd73('0x42')]=qs['sort'](_0x51f52b[_0xbd73('0x39')]['sort']);_0x2bfeb6[_0xbd73('0x43')]=qs['filters'](_[_0xbd73('0x44')](_0x51f52b['query'],_0x579845['filters']),_0x3a13e1);if(_0x51f52b['query'][_0xbd73('0x45')]){_0x2bfeb6[_0xbd73('0x43')]=_[_0xbd73('0x46')](_0x2bfeb6[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x3a13e1,function(_0x63bb35){if(_0x63bb35[_0xbd73('0x47')]!==_0xbd73('0x48')){var _0x8611ac={};_0x8611ac[_0x63bb35[_0xbd73('0x30')]]={'$like':'%'+_0x51f52b[_0xbd73('0x39')][_0xbd73('0x45')]+'%'};return _0x8611ac;}})});}_0x2bfeb6=_[_0xbd73('0x46')]({},_0x2bfeb6,_0x51f52b['options']);var _0x89c288={'where':_0x2bfeb6[_0xbd73('0x43')]};return db['ChatWebsite'][_0xbd73('0x29')](_0x89c288)[_0xbd73('0x19')](function(_0x5c8009){_0x315e53[_0xbd73('0x29')]=_0x5c8009;if(_0x51f52b[_0xbd73('0x39')]['includeAll']){_0x2bfeb6['include']=[{'all':!![]}];}return db[_0xbd73('0x35')][_0xbd73('0x49')](_0x2bfeb6);})[_0xbd73('0x19')](function(_0x5ef664){_0x315e53['rows']=_0x5ef664;return _0x315e53;})['then'](respondWithFilteredResult(_0x3c15b5,_0x2bfeb6))[_0xbd73('0x4a')](handleError(_0x3c15b5,null));};exports[_0xbd73('0x4b')]=function(_0x3d3ae0,_0x994ba5){var _0x1668d5={'raw':![],'where':{'id':_0x3d3ae0['params']['id']},'include':[{'model':db[_0xbd73('0x33')],'as':_0xbd73('0x4c')}]},_0x3e6997={};_0x3e6997[_0xbd73('0x38')]=_['keys'](db[_0xbd73('0x35')]['rawAttributes']);_0x3e6997[_0xbd73('0x39')]=_[_0xbd73('0x3a')](_0x3d3ae0[_0xbd73('0x39')]);_0x3e6997[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x3e6997[_0xbd73('0x38')],_0x3e6997[_0xbd73('0x39')]);_0x1668d5[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x3e6997[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0x3d3ae0[_0xbd73('0x39')][_0xbd73('0x3e')]));_0x1668d5[_0xbd73('0x3c')]=_0x1668d5['attributes']['length']?_0x1668d5[_0xbd73('0x3c')]:_0x3e6997['model'];if(_0x3d3ae0['query'][_0xbd73('0x4d')]){_0x1668d5['include']=[{'all':!![]}];}_0x1668d5=_[_0xbd73('0x46')]({},_0x1668d5,_0x3d3ae0[_0xbd73('0x4e')]);return db[_0xbd73('0x35')]['find'](_0x1668d5)[_0xbd73('0x19')](handleEntityNotFound(_0x994ba5,null))[_0xbd73('0x19')](respondWithResult(_0x994ba5,null))[_0xbd73('0x4a')](handleError(_0x994ba5,null));};exports[_0xbd73('0x4f')]=function(_0x54da4d,_0x2ecbf8){return db[_0xbd73('0x35')][_0xbd73('0x4f')](_0x54da4d[_0xbd73('0x50')],{})[_0xbd73('0x19')](function(_0x429b27){var _0x5b067e=_0x54da4d[_0xbd73('0x51')][_0xbd73('0x52')]({'plain':!![]});if(!_0x5b067e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b067e[_0xbd73('0x53')]===_0xbd73('0x51')){var _0x5634e4=_0x429b27[_0xbd73('0x52')]({'plain':!![]});var _0x340b03='ChatWebsites';return db['UserProfileSection'][_0xbd73('0x54')]({'where':{'name':_0x340b03,'userProfileId':_0x5b067e['userProfileId']},'raw':!![]})[_0xbd73('0x19')](function(_0x283015){if(_0x283015&&_0x283015[_0xbd73('0x55')]===0x0){return db[_0xbd73('0x2e')]['create']({'name':_0x5634e4[_0xbd73('0x30')],'resourceId':_0x5634e4['id'],'type':_0x283015[_0xbd73('0x30')],'sectionId':_0x283015['id']},{})[_0xbd73('0x19')](function(){return _0x429b27;});}else{return _0x429b27;}})[_0xbd73('0x4a')](function(_0x5e909f){logger[_0xbd73('0x1f')](_0xbd73('0x56'),_0x5e909f);throw _0x5e909f;});}return _0x429b27;})[_0xbd73('0x19')](respondWithResult(_0x2ecbf8,0xc9))[_0xbd73('0x4a')](handleError(_0x2ecbf8,null));};exports[_0xbd73('0x2b')]=function(_0x514d37,_0x37dd32){if(_0x514d37['body']['id']){delete _0x514d37[_0xbd73('0x50')]['id'];}return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x514d37[_0xbd73('0x57')]['id']},'include':[{'model':db[_0xbd73('0x33')],'as':'mandatoryDispositionPause'}]})[_0xbd73('0x19')](handleEntityNotFound(_0x37dd32,null))['then'](saveUpdates(_0x514d37[_0xbd73('0x50')],null))['then'](respondWithResult(_0x37dd32,null))[_0xbd73('0x4a')](handleError(_0x37dd32,null));};exports['destroy']=function(_0x1ed76f,_0x2a8cae){return db['ChatWebsite'][_0xbd73('0x54')]({'where':{'id':_0x1ed76f[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x2a8cae,null))[_0xbd73('0x19')](removeEntity(_0x2a8cae,null))[_0xbd73('0x4a')](handleError(_0x2a8cae,null));};exports[_0xbd73('0x58')]=function(_0x2a2b35,_0x3c10bd){return db[_0xbd73('0x35')][_0xbd73('0x58')]()[_0xbd73('0x19')](respondWithResult(_0x3c10bd,null))[_0xbd73('0x4a')](handleError(_0x3c10bd,null));};exports[_0xbd73('0x59')]=function(_0x90d9de,_0x3de0ec){if(_0x90d9de[_0xbd73('0x50')]['id']){delete _0x90d9de[_0xbd73('0x50')]['id'];}return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x90d9de[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x3de0ec,null))[_0xbd73('0x19')](function(_0x4b7326){if(_0x4b7326){_0x90d9de[_0xbd73('0x50')][_0xbd73('0x5a')]=_0x4b7326['id'];return db[_0xbd73('0x5b')][_0xbd73('0x4f')](_0x90d9de[_0xbd73('0x50')]);}})[_0xbd73('0x19')](respondWithResult(_0x3de0ec,null))[_0xbd73('0x4a')](handleError(_0x3de0ec,null));};exports['getDispositions']=function(_0x149bd4,_0x3d2e65){var _0xb3dc86={'raw':![],'where':{}};var _0x82179={};var _0x4f3980={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x149bd4[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x3d2e65,null))[_0xbd73('0x19')](function(_0x4181bb){if(_0x4181bb){_0x82179[_0xbd73('0x38')]=_[_0xbd73('0x3a')](db['Disposition'][_0xbd73('0x36')]);_0x82179['query']=_[_0xbd73('0x3a')](_0x149bd4[_0xbd73('0x39')]);_0x82179[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x82179[_0xbd73('0x38')],_0x82179[_0xbd73('0x39')]);_0xb3dc86[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x82179[_0xbd73('0x38')],qs['fields'](_0x149bd4[_0xbd73('0x39')][_0xbd73('0x3e')]));_0xb3dc86[_0xbd73('0x3c')]=_0xb3dc86['attributes'][_0xbd73('0x3f')]?_0xb3dc86[_0xbd73('0x3c')]:_0x82179[_0xbd73('0x38')];if(!_0x149bd4[_0xbd73('0x39')]['hasOwnProperty'](_0xbd73('0x41'))){_0xb3dc86[_0xbd73('0x27')]=qs[_0xbd73('0x27')](_0x149bd4[_0xbd73('0x39')][_0xbd73('0x27')]);_0xb3dc86[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0x149bd4[_0xbd73('0x39')][_0xbd73('0x28')]);}_0xb3dc86['order']=qs[_0xbd73('0x5c')](_0x149bd4['query']['sort']);_0xb3dc86[_0xbd73('0x43')]=qs['filters'](_['pick'](_0x149bd4[_0xbd73('0x39')],_0x82179[_0xbd73('0x3b')]));_0xb3dc86['where'][_0xbd73('0x5a')]=_0x4181bb['id'];if(_0x149bd4[_0xbd73('0x39')][_0xbd73('0x45')]){_0xb3dc86[_0xbd73('0x43')]=_['merge'](_0xb3dc86[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0xb3dc86[_0xbd73('0x3c')],function(_0xe7ad22){var _0xb2e3cc={};_0xb2e3cc[_0xe7ad22]={'$like':'%'+_0x149bd4['query'][_0xbd73('0x45')]+'%'};return _0xb2e3cc;})});}_0xb3dc86=_[_0xbd73('0x46')]({},_0xb3dc86,_0x149bd4[_0xbd73('0x4e')]);return db[_0xbd73('0x5b')][_0xbd73('0x29')]({'where':_0xb3dc86['where']})[_0xbd73('0x19')](function(_0x26b58b){_0x4f3980['count']=_0x26b58b;if(_0x149bd4[_0xbd73('0x39')][_0xbd73('0x4d')]){_0xb3dc86[_0xbd73('0x5d')]=[{'all':!![]}];}return db[_0xbd73('0x5b')][_0xbd73('0x49')](_0xb3dc86);})[_0xbd73('0x19')](function(_0x352eca){_0x4f3980[_0xbd73('0x5e')]=_0x352eca;return _0x4f3980;});}})[_0xbd73('0x19')](respondWithFilteredResult(_0x3d2e65,_0xb3dc86))[_0xbd73('0x4a')](handleError(_0x3d2e65,null));};exports[_0xbd73('0x5f')]=function(_0x56516c,_0x131790){return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x56516c[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x131790,null))['then'](function(_0x538b73){if(_0x538b73){return _0x538b73[_0xbd73('0x5f')](_0x56516c[_0xbd73('0x39')]['ids']);}})[_0xbd73('0x19')](respondWithStatusCode(_0x131790,null))[_0xbd73('0x4a')](handleError(_0x131790,null));};exports[_0xbd73('0x60')]=function(_0x48cadd,_0x3b203f){if(_0x48cadd['body']['id']){delete _0x48cadd[_0xbd73('0x50')]['id'];}return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x48cadd[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x3b203f,null))[_0xbd73('0x19')](function(_0x317e5c){if(_0x317e5c){_0x48cadd[_0xbd73('0x50')]['ChatWebsiteId']=_0x317e5c['id'];return db[_0xbd73('0x61')][_0xbd73('0x4f')](_0x48cadd[_0xbd73('0x50')]);}})[_0xbd73('0x19')](respondWithResult(_0x3b203f,null))[_0xbd73('0x4a')](handleError(_0x3b203f,null));};exports[_0xbd73('0x62')]=function(_0x1e06d1,_0xb10f66){var _0x21edf5={'raw':![],'where':{}};var _0x588c81={};var _0x5c0bdc={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbd73('0x63')]({'where':{'id':_0x1e06d1[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0xb10f66,null))[_0xbd73('0x19')](function(_0x250c52){if(_0x250c52){_0x588c81[_0xbd73('0x38')]=_[_0xbd73('0x3a')](db[_0xbd73('0x61')][_0xbd73('0x36')]);_0x588c81['query']=_[_0xbd73('0x3a')](_0x1e06d1[_0xbd73('0x39')]);_0x588c81[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x588c81[_0xbd73('0x38')],_0x588c81['query']);_0x21edf5[_0xbd73('0x3c')]=_['intersection'](_0x588c81[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0x1e06d1[_0xbd73('0x39')]['fields']));_0x21edf5[_0xbd73('0x3c')]=_0x21edf5[_0xbd73('0x3c')][_0xbd73('0x3f')]?_0x21edf5[_0xbd73('0x3c')]:_0x588c81[_0xbd73('0x38')];if(!_0x1e06d1['query']['hasOwnProperty'](_0xbd73('0x41'))){_0x21edf5[_0xbd73('0x27')]=qs[_0xbd73('0x27')](_0x1e06d1[_0xbd73('0x39')][_0xbd73('0x27')]);_0x21edf5[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0x1e06d1[_0xbd73('0x39')][_0xbd73('0x28')]);}_0x21edf5[_0xbd73('0x42')]=qs[_0xbd73('0x5c')](_0x1e06d1[_0xbd73('0x39')]['sort']);_0x21edf5[_0xbd73('0x43')]=qs[_0xbd73('0x3b')](_[_0xbd73('0x44')](_0x1e06d1[_0xbd73('0x39')],_0x588c81['filters']));_0x21edf5[_0xbd73('0x43')][_0xbd73('0x5a')]=_0x250c52['id'];if(_0x1e06d1['query']['filter']){_0x21edf5['where']=_['merge'](_0x21edf5[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x21edf5[_0xbd73('0x3c')],function(_0xc7f152){var _0x2b00c3={};_0x2b00c3[_0xc7f152]={'$like':'%'+_0x1e06d1['query'][_0xbd73('0x45')]+'%'};return _0x2b00c3;})});}_0x21edf5=_[_0xbd73('0x46')]({},_0x21edf5,_0x1e06d1['options']);return db[_0xbd73('0x61')][_0xbd73('0x29')]({'where':_0x21edf5[_0xbd73('0x43')]})[_0xbd73('0x19')](function(_0x5fb170){_0x5c0bdc[_0xbd73('0x29')]=_0x5fb170;if(_0x1e06d1[_0xbd73('0x39')]['includeAll']){_0x21edf5['include']=[{'all':!![]}];}return db[_0xbd73('0x61')][_0xbd73('0x49')](_0x21edf5);})[_0xbd73('0x19')](function(_0x53440d){_0x5c0bdc[_0xbd73('0x5e')]=_0x53440d;return _0x5c0bdc;});}})['then'](respondWithFilteredResult(_0xb10f66,_0x21edf5))[_0xbd73('0x4a')](handleError(_0xb10f66,null));};exports[_0xbd73('0x64')]=function(_0x58d25c,_0xaac3){return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x58d25c[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0xaac3,null))[_0xbd73('0x19')](function(_0x303ce8){if(_0x303ce8){return _0x303ce8[_0xbd73('0x64')](_0x58d25c[_0xbd73('0x39')][_0xbd73('0x65')]);}})[_0xbd73('0x19')](respondWithStatusCode(_0xaac3,null))[_0xbd73('0x4a')](handleError(_0xaac3,null));};exports[_0xbd73('0x66')]=function(_0xc0fef0,_0x38bc03){_0xc0fef0[_0xbd73('0x50')][_0xbd73('0x67')]=_0xc0fef0[_0xbd73('0x68')][_0xbd73('0x69')];return db[_0xbd73('0x35')]['find']({'where':{'id':_0xc0fef0[_0xbd73('0x57')]['id']}})['then'](handleEntityNotFound(_0x38bc03,null))['then'](saveUpdates(_0xc0fef0['body'],null))[_0xbd73('0x19')](respondWithResult(_0x38bc03,null))['catch'](handleError(_0x38bc03,null));};exports[_0xbd73('0x6a')]=function(_0x2b10ab,_0x576bc3){_0x2b10ab[_0xbd73('0x50')]['agentAvatar']=_0x2b10ab[_0xbd73('0x68')][_0xbd73('0x69')];return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x2b10ab['params']['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x576bc3,null))[_0xbd73('0x19')](saveUpdates(_0x2b10ab[_0xbd73('0x50')],null))[_0xbd73('0x19')](respondWithResult(_0x576bc3,null))[_0xbd73('0x4a')](handleError(_0x576bc3,null));};exports[_0xbd73('0x6b')]=function(_0xea8b95,_0xcb20d7){_0xea8b95[_0xbd73('0x50')][_0xbd73('0x6c')]=_0xea8b95[_0xbd73('0x68')][_0xbd73('0x69')];return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0xea8b95['params']['id']}})['then'](handleEntityNotFound(_0xcb20d7,null))[_0xbd73('0x19')](saveUpdates(_0xea8b95[_0xbd73('0x50')],null))[_0xbd73('0x19')](respondWithResult(_0xcb20d7,null))[_0xbd73('0x4a')](handleError(_0xcb20d7,null));};exports[_0xbd73('0x6d')]=function(_0x89bd9c,_0x4f73c0){_0x89bd9c[_0xbd73('0x50')][_0xbd73('0x6e')]=_0x89bd9c[_0xbd73('0x68')]['filename'];return db['ChatWebsite']['find']({'where':{'id':_0x89bd9c[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x4f73c0,null))[_0xbd73('0x19')](saveUpdates(_0x89bd9c[_0xbd73('0x50')],null))['then'](respondWithResult(_0x4f73c0,null))[_0xbd73('0x4a')](handleError(_0x4f73c0,null));};exports[_0xbd73('0x6f')]=function(_0x21bc9f,_0x24e22a){var _0x4b04f4=path[_0xbd73('0x70')](config['root'],_0xbd73('0x71'));var _0x24cc8b={'where':{'id':_0x21bc9f['params']['id']},'attributes':['id',_0xbd73('0x67')],'raw':!![]};var _0x1e1a9e=![];return require('../../config/license/util')[_0xbd73('0x72')]()['then'](function(_0x67cb04){if(_0x67cb04){_0x1e1a9e=_0x67cb04[_0xbd73('0x73')];}})[_0xbd73('0x19')](function(){return db['ChatWebsite']['find'](_0x24cc8b);})['then'](handleEntityNotFound(_0x24e22a,null))[_0xbd73('0x19')](function(_0x224c92){if(_0x224c92){if(!_[_0xbd73('0x74')](_0x224c92[_0xbd73('0x67')])){if(fs[_0xbd73('0x75')](path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x77'),_0x224c92[_0xbd73('0x67')]))&&_0x1e1a9e){_0x4b04f4=path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x77'),_0x224c92[_0xbd73('0x67')]);}}return _0x24e22a[_0xbd73('0x78')](_0x4b04f4);}})[_0xbd73('0x4a')](handleError(_0x24e22a,null));};exports[_0xbd73('0x79')]=function(_0x54ba11,_0x2930ba){var _0x1ecc76=path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x7a'));var _0x1cdbea={'where':{'id':_0x54ba11[_0xbd73('0x57')]['id']},'attributes':['id',_0xbd73('0x7b')],'raw':!![]};return db[_0xbd73('0x35')][_0xbd73('0x54')](_0x1cdbea)[_0xbd73('0x19')](handleEntityNotFound(_0x2930ba,null))['then'](function(_0x4af797){if(_0x4af797){if(!_[_0xbd73('0x74')](_0x4af797['agentAvatar'])){if(fs[_0xbd73('0x75')](path[_0xbd73('0x70')](config[_0xbd73('0x76')],'server/files/images/avatars/',_0x4af797['agentAvatar']))){_0x1ecc76=path[_0xbd73('0x70')](config['root'],_0xbd73('0x7c'),_0x4af797[_0xbd73('0x7b')]);}}return _0x2930ba['download'](_0x1ecc76);}})[_0xbd73('0x4a')](handleError(_0x2930ba,null));};exports[_0xbd73('0x7d')]=function(_0x288826,_0x492aed){var _0x484239=path['join'](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x34d64d={'where':{'id':_0x288826[_0xbd73('0x57')]['id']},'attributes':['id','customerAvatar',_0xbd73('0x7e')],'raw':!![]};return db[_0xbd73('0x35')][_0xbd73('0x54')](_0x34d64d)['then'](handleEntityNotFound(_0x492aed,null))[_0xbd73('0x19')](function(_0x31d267){if(_0x31d267){if(!_['isNil'](_0x31d267[_0xbd73('0x6c')])){if(fs[_0xbd73('0x75')](path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x7c'),_0x31d267[_0xbd73('0x6c')]))&&_0x31d267[_0xbd73('0x7e')]){_0x484239=path['join'](config['root'],'server/files/images/avatars/',_0x31d267[_0xbd73('0x6c')]);}}return _0x492aed[_0xbd73('0x78')](_0x484239);}})[_0xbd73('0x4a')](handleError(_0x492aed,null));};exports['getSystemAvatar']=function(_0x2615d7,_0x13680a){var _0x5b1ffd=path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x7f'));var _0x4e2efc={'where':{'id':_0x2615d7[_0xbd73('0x57')]['id']},'attributes':['id',_0xbd73('0x6e')],'raw':!![]};return db[_0xbd73('0x35')]['find'](_0x4e2efc)['then'](handleEntityNotFound(_0x13680a,null))[_0xbd73('0x19')](function(_0x46ebd4){if(_0x46ebd4){if(!_[_0xbd73('0x74')](_0x46ebd4['systemAvatar'])){if(fs[_0xbd73('0x75')](path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0x7c'),_0x46ebd4[_0xbd73('0x6e')]))){_0x5b1ffd=path['join'](config[_0xbd73('0x76')],'server/files/images/avatars/',_0x46ebd4[_0xbd73('0x6e')]);}}return _0x13680a[_0xbd73('0x78')](_0x5b1ffd);}})['catch'](handleError(_0x13680a,null));};exports[_0xbd73('0x80')]=function(_0x1a8677,_0x5a4851){var _0x51611b=require(_0xbd73('0x81'));var _0x4d7ece=new _0x51611b();var _0x192c35=_0x4d7ece[_0xbd73('0x82')](_0x1a8677[_0xbd73('0x83')][_0xbd73('0x84')])[_0xbd73('0x85')]();var _0xb29ea4={'body':_0x1a8677['body'],'channel':_0xbd73('0x86')};var _0x22a2e0=[];var _0x1c4945=[];var _0x2600af={};var _0x4b331c=![];return db[_0xbd73('0x87')]['describe']()['then'](function(_0x468cf6){if(!_0x468cf6){throw new db[(_0xbd73('0x88'))]['ValidationError'](_0xbd73('0x89'));}_0x22a2e0=_[_0xbd73('0x8a')](_[_0xbd73('0x3a')](_0x468cf6),[_0xbd73('0x8b'),_0xbd73('0x8c')]);_0x1c4945=_['difference'](_[_0xbd73('0x3a')](_0x468cf6),[_0xbd73('0x8b'),_0xbd73('0x8c'),'CompanyId',_0xbd73('0x8d')]);if(_0x1a8677[_0xbd73('0x50')]['id']){delete _0x1a8677[_0xbd73('0x50')]['id'];}if(_[_0xbd73('0x74')](_0x1a8677[_0xbd73('0x50')][_0xbd73('0x8e')])){throw new db[(_0xbd73('0x88'))]['ValidationError'](_0xbd73('0x8f'));}if(_['isNil'](_0x1a8677[_0xbd73('0x50')][_0xbd73('0x50')])||_0x1a8677[_0xbd73('0x50')]['body']===''){throw new db[(_0xbd73('0x88'))]['ValidationError'](_0xbd73('0x90'));}if(_[_0xbd73('0x74')](_0x1a8677['body']['mapKey'])){throw new db[(_0xbd73('0x88'))][(_0xbd73('0x91'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c4945);}if(!_[_0xbd73('0x92')](_0x1c4945,_0x1a8677[_0xbd73('0x50')][_0xbd73('0x93')])){throw new db[(_0xbd73('0x88'))][(_0xbd73('0x91'))](_0xbd73('0x94')+_0x1c4945);}_0x2600af[_0x1a8677[_0xbd73('0x50')][_0xbd73('0x93')]]=_0x1a8677[_0xbd73('0x50')][_0xbd73('0x8e')];})[_0xbd73('0x19')](function(){return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x1a8677[_0xbd73('0x57')]['id']},'include':[{'model':db[_0xbd73('0x95')],'as':_0xbd73('0x96'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2600af,'limit':0x1,'order':[[_0xbd73('0x8c'),_0xbd73('0x97')]]}]},{'model':db['ChatApplication'],'as':_0xbd73('0x98')}]});})['then'](handleEntityNotFound(_0x5a4851,null))['then'](function(_0x2af548){if(_0x2af548&&_0x2af548[_0xbd73('0x96')]){_0xb29ea4['account']=_0x2af548;_0xb29ea4['applications']=_0x2af548['Applications'];_0xb29ea4[_0xbd73('0x99')]=_0x2af548[_0xbd73('0x96')];_0xb29ea4['applications']=_['orderBy'](_0xb29ea4[_0xbd73('0x9a')],[_0xbd73('0x9b')],[_0xbd73('0x9c')]);if(_0xb29ea4[_0xbd73('0x9d')]['Applications']){delete _0xb29ea4[_0xbd73('0x9d')]['Applications'];}if(_0xb29ea4[_0xbd73('0x9d')][_0xbd73('0x96')]&&_0xb29ea4['account'][_0xbd73('0x96')][_0xbd73('0x9e')]['length']){return _0xb29ea4[_0xbd73('0x9d')][_0xbd73('0x96')][_0xbd73('0x9e')][0x0];}var _0x38ae88=_[_0xbd73('0xf')](_0x1a8677[_0xbd73('0x50')],{'firstName':_0x1a8677[_0xbd73('0x50')][_0xbd73('0x8e')],'ListId':_0x2af548[_0xbd73('0x8d')]});_0x38ae88[_0x1a8677[_0xbd73('0x50')]['mapKey']]=_0x1a8677['body'][_0xbd73('0x8e')];return db[_0xbd73('0x87')][_0xbd73('0x4f')](_0x38ae88,{'fields':_0x22a2e0,'raw':!![]});}})[_0xbd73('0x19')](handleEntityNotFound(_0x5a4851,null))[_0xbd73('0x19')](function(_0x13207f){_0xb29ea4[_0xbd73('0x9f')]=_0x13207f;var _0x52eae7=_0x1a8677['body'][_0xbd73('0xa0')];if(_0x1a8677[_0xbd73('0x83')][_0xbd73('0xa1')]){_0x52eae7=_0x1a8677['headers']['cf-connecting-ip'];}else if(_0x1a8677[_0xbd73('0x83')][_0xbd73('0xa2')]){_0x52eae7=_['first'](_0x1a8677[_0xbd73('0x83')][_0xbd73('0xa2')][_0xbd73('0xa3')](','));}if(_0x13207f){var _0x38b05c={'ContactId':_0x13207f['id'],'ChatWebsiteId':_0x1a8677[_0xbd73('0x57')]['id'],'from':(_0x13207f['firstName']||'')+'\x20'+(_0x13207f[_0xbd73('0xa4')]||''),'customerIp':_0x52eae7,'customerPort':_0x1a8677[_0xbd73('0x83')]['x-real-port']?_0x1a8677[_0xbd73('0x83')]['x-real-port']:null,'referer':_0x1a8677[_0xbd73('0x50')][_0xbd73('0xa5')],'browserName':_0x192c35[_0xbd73('0xa6')][_0xbd73('0x30')]&&_0x192c35['browser'][_0xbd73('0xa7')]?util[_0xbd73('0xa8')](_0xbd73('0xa9'),_0x192c35[_0xbd73('0xa6')][_0xbd73('0x30')],_0x192c35[_0xbd73('0xa6')][_0xbd73('0xa7')]):_0xbd73('0xaa'),'browserVersion':_0x192c35[_0xbd73('0xa6')][_0xbd73('0xa7')]||_0xbd73('0xaa'),'osName':util[_0xbd73('0xa8')](_0xbd73('0xa9'),_0x192c35['os'][_0xbd73('0x30')],_0x192c35['os'][_0xbd73('0xa7')]),'osVersion':_0x192c35['os'][_0xbd73('0xa7')],'deviceModel':_0x192c35[_0xbd73('0xab')][_0xbd73('0x38')]&&_0x192c35['device']['vendor']?util['format'](_0xbd73('0xac'),_0x192c35[_0xbd73('0xab')]['model'],_0x192c35[_0xbd73('0xab')]['vendor'],_0x192c35[_0xbd73('0xab')][_0xbd73('0x47')]):null,'deviceVendor':_0x192c35[_0xbd73('0xab')][_0xbd73('0xad')],'deviceType':_0x192c35[_0xbd73('0xab')][_0xbd73('0x47')],'formData':JSON[_0xbd73('0x1e')](_0x1a8677[_0xbd73('0x50')])};var _0x4f7732={'ChatWebsiteId':_0x1a8677[_0xbd73('0x57')]['id'],'closed':![]};if(_0x1a8677[_0xbd73('0x50')][_0xbd73('0xae')]){_0x4f7732[_0xbd73('0xae')]=_0x1a8677[_0xbd73('0x50')][_0xbd73('0xae')];return db[_0xbd73('0xaf')]['find']({'where':_0x4f7732})[_0xbd73('0x19')](function(_0x403faf){if(_0x403faf){return[_0x403faf,![]];}_0x38b05c[_0xbd73('0xae')]=_0x1a8677['body'][_0xbd73('0xae')];_0x38b05c[_0xbd73('0xb0')]=_0x1a8677[_0xbd73('0x50')][_0xbd73('0xb0')];return db[_0xbd73('0xaf')][_0xbd73('0x4f')](_0x38b05c)[_0xbd73('0x19')](function(_0x2297d7){return[_0x2297d7,!![]];});});}_0x4f7732['ContactId']=_0x13207f['id'];if(_0x1a8677[_0xbd73('0x50')][_0xbd73('0xb1')]&&_0x1a8677['body'][_0xbd73('0xb1')]['id']){_0x4f7732['id']=_0x1a8677['body'][_0xbd73('0xb1')]['id'];return db[_0xbd73('0xaf')][_0xbd73('0x54')]({'where':_0x4f7732})[_0xbd73('0x19')](function(_0x3b0c4d){if(_0x3b0c4d){return[_0x3b0c4d,![]];}return db[_0xbd73('0xaf')][_0xbd73('0x4f')](_0x38b05c)[_0xbd73('0x19')](function(_0x151316){return[_0x151316,!![]];});});}return db['ChatInteraction'][_0xbd73('0x4f')](_0x38b05c)[_0xbd73('0x19')](function(_0x518e70){return[_0x518e70,!![]];});}})[_0xbd73('0xb2')](function(_0x835d19,_0x487ffc){if(_0x835d19){_0x4b331c=_0x487ffc;if(!_0x487ffc){var _0x59e3bd={'from':(_0xb29ea4[_0xbd73('0x9f')][_0xbd73('0xb3')]||'')+'\x20'+(_0xb29ea4[_0xbd73('0x9f')][_0xbd73('0xa4')]||'')};if(_0x1a8677[_0xbd73('0x50')]['threadId']&&_0x1a8677['body'][_0xbd73('0xb4')]&&_0x1a8677[_0xbd73('0x50')][_0xbd73('0xae')]!=_0x1a8677[_0xbd73('0x50')][_0xbd73('0xb4')]){_0x59e3bd[_0xbd73('0xae')]=_0x1a8677['body'][_0xbd73('0xb4')];}return _0x835d19[_0xbd73('0x2b')](_0x59e3bd);}else{return _0x835d19;}}})[_0xbd73('0x19')](function(_0xbb616){_0xb29ea4[_0xbd73('0xb1')]=_0xbb616[_0xbd73('0x52')]({'plain':!![]});_0xb29ea4[_0xbd73('0xb1')][_0xbd73('0xb5')]=_0x4b331c;if(_0xb29ea4[_0xbd73('0xb1')][_0xbd73('0xb5')]){if(_0xb29ea4[_0xbd73('0x9d')]['autoclose']){_0xb29ea4[_0xbd73('0x9a')][_0xbd73('0xb6')]({'id':0x0,'priority':_0xb29ea4[_0xbd73('0x9a')]['length']+0x1,'app':_0xbd73('0xb7'),'appdata':_0xbd73('0xb8'),'interval':_0xbd73('0xb9')});}}return db[_0xbd73('0xba')][_0xbd73('0x4f')]({'body':_0x1a8677[_0xbd73('0x50')][_0xbd73('0x50')],'ChatWebsiteId':_0x1a8677[_0xbd73('0x57')]['id'],'ChatInteractionId':_0xbb616['id'],'direction':'in','ContactId':_0xb29ea4['contact']['id'],'AttachmentId':_0x1a8677[_0xbd73('0x50')]['AttachmentId']});})[_0xbd73('0x19')](function(_0x9942cd){_0xb29ea4[_0xbd73('0x21')]=_0x9942cd;if(_0xb29ea4[_0xbd73('0xb1')]['UserId']){return db[_0xbd73('0xbb')][_0xbd73('0x54')]({'attributes':['id',_0xbd73('0x30')],'where':{'id':_0xb29ea4[_0xbd73('0xb1')]['UserId']}})[_0xbd73('0x19')](function(_0x28935a){if(_0x28935a){_0xb29ea4['applications'][_0xbd73('0xbc')]({'id':0x0,'priority':0x0,'app':_0xbd73('0xbd'),'appdata':_0x28935a[_0xbd73('0x30')]+','+(_0xb29ea4[_0xbd73('0x9d')][_0xbd73('0xbe')]||0xa),'interval':_0xbd73('0xb9')});_0xb29ea4[_0xbd73('0xbf')]=!![];}return respondWithRpcPromise(_0xbd73('0xc0'),_0xbd73('0xc1'),_0xb29ea4);});}return respondWithRpcPromise('Start',_0xbd73('0xc1'),_0xb29ea4);})[_0xbd73('0x19')](function(_0x57636c){respondWithRpcPromise(_0xbd73('0xc2'),_0xbd73('0xc2'),{'event':'notify','message':_0x57636c},client9002);return _0x57636c;})[_0xbd73('0x19')](respondWithResult(_0x5a4851,null))[_0xbd73('0x4a')](handleError(_0x5a4851,null));};exports[_0xbd73('0xc3')]=function(_0x1d210e,_0x31b627){var _0x434d81,_0x1d4675,_0x170643;var _0x4dd8c1=[];var _0x55b94b={};var _0x514a7b=_0x1d210e[_0xbd73('0xc4')]||[];var _0x2c9a0d=[];var _0x1f6d69;return db[_0xbd73('0x87')][_0xbd73('0x58')]()[_0xbd73('0x19')](function(_0x4a8902){if(!_0x4a8902){throw new db[(_0xbd73('0x88'))][(_0xbd73('0x91'))]('no\x20available\x20attributes');}_0x4dd8c1=_[_0xbd73('0x8a')](_['keys'](_0x4a8902),[_0xbd73('0x8b'),_0xbd73('0x8c'),_0xbd73('0xc5'),_0xbd73('0x8d')]);if(_0x1d210e[_0xbd73('0x50')]['id']){delete _0x1d210e[_0xbd73('0x50')]['id'];}if(_[_0xbd73('0x74')](_0x1d210e[_0xbd73('0x50')][_0xbd73('0x8e')])){throw _0x31b627[_0xbd73('0x24')](0x1f4)['send'](new db[(_0xbd73('0x88'))][(_0xbd73('0x91'))](_0xbd73('0x8f')));}if(_[_0xbd73('0x74')](_0x1d210e[_0xbd73('0x50')][_0xbd73('0x50')])||_0x1d210e[_0xbd73('0x50')]['body']===''){throw _0x31b627[_0xbd73('0x24')](0x1f4)['send'](new db[(_0xbd73('0x88'))]['ValidationError'](_0xbd73('0x90')));}if(_[_0xbd73('0x74')](_0x1d210e[_0xbd73('0x50')][_0xbd73('0xc6')])){throw _0x31b627['status'](0x1f4)[_0xbd73('0x31')](new db['Sequelize'][(_0xbd73('0x91'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4dd8c1));}if(!_[_0xbd73('0x92')](_0x4dd8c1,_0x1d210e[_0xbd73('0x50')]['mapKeyOffline'])){throw _0x31b627['status'](0x1f4)[_0xbd73('0x31')](new db[(_0xbd73('0x88'))][(_0xbd73('0x91'))](_0xbd73('0xc7')+_0x4dd8c1));}_0x55b94b[_0x1d210e['body'][_0xbd73('0xc6')]]=_0x1d210e[_0xbd73('0x50')][_0xbd73('0x8e')];})[_0xbd73('0x19')](function(){return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x1d210e[_0xbd73('0x57')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db['MailAccount'],'as':_0xbd73('0xc8')}]});})['then'](handleEntityNotFound(_0x31b627,null))[_0xbd73('0x19')](function(_0x59e2ac){if(_0x59e2ac&&_0x59e2ac['List']){_0x1d4675=_0x59e2ac;var _0x294f53=_['defaults'](_0x1d210e[_0xbd73('0x50')],{'firstName':_0x1d210e[_0xbd73('0x50')][_0xbd73('0x8e')],'phone':_0x1d210e[_0xbd73('0x50')][_0xbd73('0x8e')],'ListId':_0x59e2ac[_0xbd73('0x8d')]});_0x294f53[_0x1d210e[_0xbd73('0x50')][_0xbd73('0xc6')]]=_0x1d210e['body'][_0xbd73('0x8e')];return db[_0xbd73('0x87')]['findOrCreate']({'where':_0x55b94b,'defaults':_0x294f53});}})[_0xbd73('0xb2')](function(_0x274d26){if(_0x274d26){_0x170643=_0x274d26;var _0x156f4e=fs[_0xbd73('0xc9')](path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0xca')),_0xbd73('0xcb'));var _0x10c9a6=ejs[_0xbd73('0xcc')](_0x156f4e,{'body':_[_0xbd73('0xcd')](_0x1d210e[_0xbd73('0x50')][_0xbd73('0x50')]),'bodyTitle':_0x1d4675[_0xbd73('0xce')]});return db[_0xbd73('0xcf')]['create']({'body':_0x10c9a6,'plainBody':htmlToText[_0xbd73('0xd0')](_0x10c9a6),'ContactId':_0x274d26['id'],'ChatWebsiteId':_0x1d4675['id']});}})[_0xbd73('0x19')](function(_0x4a6c0f){_0x1f6d69=_0x4a6c0f;if(_0x514a7b[_0xbd73('0x3f')]){var _0x31ab84=_0x514a7b['map'](function(_0x29e476){return{'name':_0x29e476[_0xbd73('0xd1')],'basename':_0x29e476['filename'],'type':_0x29e476[_0xbd73('0xd2')],'ChatOfflineMessageId':_0x4a6c0f['id']};});_0x2c9a0d=_0x31ab84[_0xbd73('0x34')](_0x618d20=>{var _0x46277a={'filename':_0x618d20[_0xbd73('0x30')],'path':path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0xd3'),_0xbd73('0xc4'),_0xbd73('0xd4'),'offline-chat',_0x618d20[_0xbd73('0xd5')])};return _0x46277a;});if(!_0x1d4675['openNewInteraction']){return db['sequelize'][_0xbd73('0xd6')](function(_0x585404){return db[_0xbd73('0xd7')][_0xbd73('0xd8')](_0x31ab84,{'transaction':_0x585404});});}}})[_0xbd73('0x19')](function(){if(_0x1f6d69){_0x434d81=_0x1f6d69;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xbd73('0xd9')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xbd73('0xda')],'as':_0xbd73('0xda'),'raw':!![]}]}]});}})['then'](function(_0x392b3f){if(_0x392b3f&&_0x392b3f[_0xbd73('0xdb')]&&_0x1d4675[_0xbd73('0xdc')]&&_0x1d4675['forwardOfflineAddress']){var _0xfc4cf2=_0x392b3f[_0xbd73('0xdd')]();return respondWithRpcPromise(_0xbd73('0xde'),_0xbd73('0xdf'),{'account':_0xfc4cf2,'message':{'from':util[_0xbd73('0xa8')](_0xbd73('0xe0'),_0x392b3f[_0xbd73('0x30')],_0x392b3f['email']||_0x392b3f[_0xbd73('0xdb')][_0xbd73('0x51')]),'to':_0x1d4675[_0xbd73('0xe1')],'subject':_0x1d4675[_0xbd73('0xe2')],'html':_0x434d81[_0xbd73('0x50')],'attachments':_0x2c9a0d}},client9003)[_0xbd73('0x19')](function(){return _0x434d81;})['catch'](function(_0x56a623){logger[_0xbd73('0x1f')](_0x56a623);});}})['then'](function(){if(_0x1d4675&&_0x1d4675['openNewInteraction']&&_0x1d4675[_0xbd73('0xe3')]){var _0x5593f8=[];if(_0x514a7b[_0xbd73('0x3f')]){_0x5593f8=_0x514a7b['map'](function(_0xc54f8c){return{'name':_0xc54f8c[_0xbd73('0xd1')],'basename':_0xc54f8c['filename'],'type':_0xc54f8c[_0xbd73('0xd2')],'ChatOfflineMessageId':_0x1f6d69['id']};});}var _0x16ca38;if(!_['isNil'](_0x1d4675['subjectOffline'])){var _0x30d4f=_['map'](_0x1d210e['body'],function(_0x3bf4ac){return _0x3bf4ac;});var _0x3bf752=_[_0xbd73('0xe4')](_0x30d4f)[0x0];var _0x2326e4=_[_0xbd73('0xe5')](_0x3bf752,function(_0x9d9bd3){return _0x9d9bd3;});_0x16ca38=_0x2326e4[0x1][_0x1d4675[_0xbd73('0xe6')]];}var _0x21c2da={'from':_0x170643[_0xbd73('0xe7')],'firstName':_0x170643[_0xbd73('0xb3')],'lastName':_0x170643[_0xbd73('0xa4')],'mapKey':_0xbd73('0xe7'),'message':{'from':_0x170643[_0xbd73('0xe7')],'to':_0x1d4675[_0xbd73('0xc8')][_0xbd73('0xe7')],'cc':'','subject':_[_0xbd73('0x74')](_0x16ca38)?_0x1d4675[_0xbd73('0xe2')]:_0x16ca38,'messageId':'','sentAt':new Date(),'attach':_0x5593f8[_0xbd73('0x3f')],'attachments':_0x5593f8,'originChannel':_0xbd73('0xe8'),'ChatWebsiteId':_0x1d4675['id'],'ChatOfflineMessageId':_0x434d81['id'],'originTo':_0x1d4675[_0xbd73('0xc8')][_0xbd73('0xe7')]},'body':_0x434d81[_0xbd73('0x50')]};var _0x360f6c={'account':{'id':_0x1d4675[_0xbd73('0xe3')]},'body':_0x21c2da,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xbd73('0xe9'),_0xbd73('0xea'),_0x360f6c,client9001)['then'](function(){return _0x434d81;})[_0xbd73('0x4a')](function(_0xa5c37a){logger[_0xbd73('0x1f')](_0xa5c37a);});}return;})[_0xbd73('0x19')](function(){if(_0x434d81){return _0x434d81;}})[_0xbd73('0x19')](respondWithResult(_0x31b627,null))[_0xbd73('0x4a')](function(_0x4d08ec){logger[_0xbd73('0x1f')]('catch',_0x4d08ec);for(var _0x1300a6 of _0x514a7b){var _0x44f796=path[_0xbd73('0x70')](config[_0xbd73('0x76')],_0xbd73('0xd3'),_0xbd73('0xc4'),'attachments',_0xbd73('0xeb'),_0x1300a6[_0xbd73('0x69')]);fs_extra[_0xbd73('0xec')](_0x44f796)[_0xbd73('0x4a')](function(_0x46219a){logger[_0xbd73('0x1f')](_0xbd73('0xed'),_0x44f796,_0x46219a);});}});};exports[_0xbd73('0xee')]=function(_0x9888,_0x24a20f){return db[_0xbd73('0xaf')][_0xbd73('0x54')]({'where':{'id':_0x9888[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x24a20f,null))[_0xbd73('0x19')](function(_0x250eb4){if(_0x250eb4){return _0x250eb4['addInteraction'](_0x9888[_0xbd73('0x50')][_0xbd73('0x65')],_['omit'](_0x9888[_0xbd73('0x50')],['ids','id'])||{});}})[_0xbd73('0x19')](respondWithResult(_0x24a20f,null))[_0xbd73('0x4a')](handleError(_0x24a20f,null));};exports['getInteractions']=function(_0x38f052,_0x30da80){var _0x2a2e9a={'raw':![],'where':{}};var _0x3ddaf4={};var _0x23fcba={'count':0x0,'rows':[]};return db[_0xbd73('0x35')][_0xbd73('0x63')]({'where':{'id':_0x38f052[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x30da80,null))[_0xbd73('0x19')](function(_0x5c649f){if(_0x5c649f){_0x3ddaf4[_0xbd73('0x38')]=_[_0xbd73('0x3a')](db['ChatInteraction'][_0xbd73('0x36')]);_0x3ddaf4['query']=_[_0xbd73('0x3a')](_0x38f052[_0xbd73('0x39')]);_0x3ddaf4['filters']=_[_0xbd73('0x3d')](_0x3ddaf4[_0xbd73('0x38')],_0x3ddaf4[_0xbd73('0x39')]);_0x2a2e9a['attributes']=_[_0xbd73('0x3d')](_0x3ddaf4[_0xbd73('0x38')],qs['fields'](_0x38f052[_0xbd73('0x39')]['fields']));_0x2a2e9a[_0xbd73('0x3c')]=_0x2a2e9a[_0xbd73('0x3c')][_0xbd73('0x3f')]?_0x2a2e9a[_0xbd73('0x3c')]:_0x3ddaf4[_0xbd73('0x38')];if(!_0x38f052[_0xbd73('0x39')][_0xbd73('0x40')](_0xbd73('0x41'))){_0x2a2e9a[_0xbd73('0x27')]=qs[_0xbd73('0x27')](_0x38f052[_0xbd73('0x39')][_0xbd73('0x27')]);_0x2a2e9a[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0x38f052['query'][_0xbd73('0x28')]);}_0x2a2e9a[_0xbd73('0x42')]=qs[_0xbd73('0x5c')](_0x38f052['query'][_0xbd73('0x5c')]);_0x2a2e9a[_0xbd73('0x43')]=qs[_0xbd73('0x3b')](_['pick'](_0x38f052[_0xbd73('0x39')],_0x3ddaf4[_0xbd73('0x3b')]));_0x2a2e9a[_0xbd73('0x43')][_0xbd73('0x5a')]=_0x5c649f['id'];if(_0x38f052[_0xbd73('0x39')][_0xbd73('0x45')]){_0x2a2e9a[_0xbd73('0x43')]=_[_0xbd73('0x46')](_0x2a2e9a[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x2a2e9a[_0xbd73('0x3c')],function(_0x2efcc0){var _0x4e2a1d={};_0x4e2a1d[_0x2efcc0]={'$like':'%'+_0x38f052[_0xbd73('0x39')][_0xbd73('0x45')]+'%'};return _0x4e2a1d;})});}_0x2a2e9a=_[_0xbd73('0x46')]({},_0x2a2e9a,_0x38f052['options']);return db['ChatInteraction'][_0xbd73('0x29')]({'where':_0x2a2e9a[_0xbd73('0x43')]})['then'](function(_0x13d599){_0x23fcba[_0xbd73('0x29')]=_0x13d599;if(_0x38f052[_0xbd73('0x39')]['includeAll']){_0x2a2e9a[_0xbd73('0x5d')]=[{'model':db[_0xbd73('0x87')],'as':_0xbd73('0xef'),'required':![]},{'model':db[_0xbd73('0xbb')],'as':_0xbd73('0xf0'),'attributes':[_0xbd73('0x30'),_0xbd73('0xf1'),_0xbd73('0xf2')],'required':![]},{'model':db[_0xbd73('0xf3')],'as':_0xbd73('0xf4'),'attributes':['id',_0xbd73('0x30'),_0xbd73('0xf5')],'where':_0x38f052[_0xbd73('0x39')][_0xbd73('0xf6')]?{'id':_0x38f052[_0xbd73('0x39')][_0xbd73('0xf6')]}:undefined,'required':_0x38f052['query'][_0xbd73('0xf6')]?!![]:![]}];}return db['ChatInteraction'][_0xbd73('0x49')](_0x2a2e9a);})[_0xbd73('0x19')](function(_0x4fe8cb){_0x23fcba[_0xbd73('0x5e')]=_0x4fe8cb;return _0x23fcba;});}})['then'](respondWithFilteredResult(_0x30da80,_0x2a2e9a))[_0xbd73('0x4a')](handleError(_0x30da80,null));};function iftimePromise(_0x1d6503,_0x1ba7b3){return respondWithRpcPromise(_0xbd73('0xf7'),_0xbd73('0xf8'),{'command':_0x1ba7b3[_0xbd73('0xf9')]?util[_0xbd73('0xa8')](_0xbd73('0xfa'),_0x1d6503[_0xbd73('0xfb')],_0x1ba7b3['timezone']):util[_0xbd73('0xa8')](_0xbd73('0xfc'),_0x1d6503[_0xbd73('0xfb')])},client9002)['then'](function(_0x11d058){var _0x54f405=_0x11d058&&_0x11d058['indexOf'](_0xbd73('0xfd'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1ba7b3['id'],_0x1d6503['id'],_0x1d6503[_0xbd73('0xfb')],_0x54f405?_0xbd73('0xfe'):'OFFLINE',_0x1ba7b3[_0xbd73('0xf9')]?_0x1ba7b3[_0xbd73('0xf9')]:_0xbd73('0xff'));return _0x54f405;})['catch'](function(_0x10ab87){logger[_0xbd73('0x1f')](_0xbd73('0x100'),_0x1ba7b3['id'],_0x1d6503['id'],_0x1d6503[_0xbd73('0xfb')],util[_0xbd73('0x101')](_0x10ab87,{'showHidden':![],'depth':null}),_0x1ba7b3[_0xbd73('0xf9')]?_0x1ba7b3[_0xbd73('0xf9')]:_0xbd73('0xff'));return![];});}exports['getSnippet']=function(_0x2ab827,_0x206764){var _0x3d0761=0x0;var _0x170125=0x0;var _0xb9fce1=![];var _0x2595b2;var _0x45852b;return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x2ab827['params']['id']},'include':[{'model':db[_0xbd73('0x102')],'as':_0xbd73('0x102'),'include':[{'model':db['Interval'],'as':_0xbd73('0x103'),'attributes':['id',_0xbd73('0xfb')],'raw':!![]}]}]})[_0xbd73('0x19')](handleEntityNotFound(_0x206764,null))[_0xbd73('0x19')](function(_0x3f40f2){if(_0x3f40f2){_0x2595b2=_0x3f40f2;return _0x3f40f2['getProactiveActions']({'raw':!![]});}})[_0xbd73('0x19')](function(_0x5e2814){if(_0x2595b2){if(_0x5e2814){_0x45852b=_0x5e2814;}}return require(_0xbd73('0x104'))[_0xbd73('0x72')]();})['then'](function(_0x2340a2){if(_0x2340a2){_0x170125=_0x2340a2[_0xbd73('0x105')];_0xb9fce1=_0x2340a2[_0xbd73('0x73')];}})[_0xbd73('0x19')](function(){return db['ChatInteraction'][_0xbd73('0x29')]({'where':{'closed':![]}});})[_0xbd73('0x19')](function(_0x4db64b){_0x3d0761=_0x4db64b;if(_0x170125&&_0x4db64b>_0x170125){return db[_0xbd73('0x106')][_0xbd73('0x63')]({'where':{'id':0x1}})[_0xbd73('0x19')](function(_0x4bd356){if(_0x4bd356){_0x4bd356[_0xbd73('0x107')](_0xbd73('0x108'));}});}})[_0xbd73('0x19')](function(){if(_0x2595b2['Interval']&&_0x2595b2[_0xbd73('0x102')]['Intervals']){var _0x5e5ef1=[];for(var _0x2e8b35=0x0;_0x2e8b35<_0x2595b2['Interval'][_0xbd73('0x103')][_0xbd73('0x3f')];_0x2e8b35++){var _0x198a81=_0x2595b2[_0xbd73('0x102')][_0xbd73('0x103')][_0x2e8b35][_0xbd73('0x52')]({'plain':!![]});_0x5e5ef1[_0xbd73('0xb6')](iftimePromise(_0x198a81,_0x2595b2));}return BPromise['all'](_0x5e5ef1)[_0xbd73('0x19')](function(_0x337211){return _[_0xbd73('0x109')](_0x337211);});}else{return!![];}})[_0xbd73('0x19')](function(_0x45a588){var _0x414b1f=fs['readFileSync'](path[_0xbd73('0x70')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x45a820={'remote':_0x2595b2[_0xbd73('0x10a')],'query':querystring['stringify'](_[_0xbd73('0x46')](_0x2595b2[_0xbd73('0x52')]({'plain':!![]}),{'customerIp':_0x2ab827['headers'][_0xbd73('0xa2')]||_0x2ab827[_0xbd73('0x83')][_0xbd73('0x10b')]||_0x2ab827[_0xbd73('0x10c')][_0xbd73('0x10d')]||_0x2ab827['ip'],'referer':_0x2ab827[_0xbd73('0x83')]['referer'],'openedInteractions':_0x3d0761,'maxInteractions':_0x170125,'virtual':_0xb9fce1[_0xbd73('0x105')],'online':_0x45a588,'custom':_0xb9fce1}))[_0xbd73('0x10e')](/'/g,'\x5c\x27')};_0x206764[_0xbd73('0x31')](ejs[_0xbd73('0xcc')](Mustache[_0xbd73('0xcc')](_0x414b1f,_0x45a820),{'proactiveActions':_0x45852b,'alignment':_0x2595b2[_0xbd73('0x10f')],'verticalAlignment':_0x2595b2[_0xbd73('0x110')],'div_color':_0x2595b2[_0xbd73('0xf5')],'labelText':_0x2595b2['labelText'],'text_color':_0x2595b2[_0xbd73('0x111')],'text_button_color':_0x2595b2[_0xbd73('0x112')],'button_color':_0x2595b2['color_button'],'background_color':_0x2595b2[_0xbd73('0x113')],'hideWhenOffline':_0x2595b2[_0xbd73('0x114')],'interval':_0x2595b2['IntervalId']}));})[_0xbd73('0x4a')](handleError(_0x206764,null));};exports[_0xbd73('0x115')]=function(_0x489a73,_0x909c24){var _0x51de11=_0x489a73[_0xbd73('0x57')]['id'];var _0x3a3615=_0x489a73[_0xbd73('0x50')];var _0x431aee=0xc8;var _0x575071=null;return db[_0xbd73('0x116')][_0xbd73('0xd6')]({'isolationLevel':db[_0xbd73('0x116')][_0xbd73('0x117')][_0xbd73('0x118')][_0xbd73('0x119')]},function(_0x35a138){return db['ChatWebsite']['findOne']({'where':{'id':_0x51de11},'transaction':_0x35a138})[_0xbd73('0x19')](function(_0x44d626){if(_0x44d626){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x51de11},'transaction':_0x35a138})[_0xbd73('0x19')](function(){var _0x389250=_[_0xbd73('0x34')](_0x3a3615,function(_0x1b37e2){_0x1b37e2[_0xbd73('0x5a')]=_0x51de11;return _0x1b37e2;});return db[_0xbd73('0x11a')][_0xbd73('0xd8')](_0x389250,{'transaction':_0x35a138});});}else{_0x431aee=0x194;_0x575071=[];}});})[_0xbd73('0x19')](function(){if(_0x431aee!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x51de11},'order':_0xbd73('0x9b')})[_0xbd73('0x19')](function(_0x2f3113){_0x575071=_0x2f3113;});}})['catch'](function(_0x4e1107){_0x431aee=0x1f4;logger[_0xbd73('0x1f')](_0x4e1107[_0xbd73('0x2f')]);if(_0x4e1107['name']){delete _0x4e1107[_0xbd73('0x30')];}_0x575071=_0x4e1107;})[_0xbd73('0x11b')](function(){if(_0x575071===null){_0x909c24['sendStatus'](_0x431aee);}else{if(_0x431aee===0x1f4){_0x909c24[_0xbd73('0x24')](_0x431aee)[_0xbd73('0x31')](_0x575071);}else{_0x909c24[_0xbd73('0x24')](_0x431aee)[_0xbd73('0x25')](_0x575071);}}});};exports[_0xbd73('0x11c')]=function(_0xf7a018,_0x3e68f5){var _0x1f9076={};var _0x460a34={};var _0x70fe38;var _0x16004b;return db[_0xbd73('0x35')]['findOne']({'where':{'id':_0xf7a018['params']['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x3e68f5,null))[_0xbd73('0x19')](function(_0x143869){if(_0x143869){_0x70fe38=_0x143869;_0x460a34[_0xbd73('0x38')]=_['keys'](db[_0xbd73('0x11a')][_0xbd73('0x36')]);_0x460a34['query']=_[_0xbd73('0x3a')](_0xf7a018['query']);_0x460a34[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x460a34['model'],_0x460a34[_0xbd73('0x39')]);_0x1f9076[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x460a34[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0xf7a018[_0xbd73('0x39')]['fields']));_0x1f9076['attributes']=_0x1f9076['attributes'][_0xbd73('0x3f')]?_0x1f9076[_0xbd73('0x3c')]:_0x460a34[_0xbd73('0x38')];_0x1f9076[_0xbd73('0x42')]=qs[_0xbd73('0x5c')](_0xf7a018[_0xbd73('0x39')][_0xbd73('0x5c')]);_0x1f9076[_0xbd73('0x43')]=qs['filters'](_[_0xbd73('0x44')](_0xf7a018[_0xbd73('0x39')],_0x460a34['filters']));if(_0xf7a018[_0xbd73('0x39')]['filter']){_0x1f9076[_0xbd73('0x43')]=_['merge'](_0x1f9076[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x1f9076[_0xbd73('0x3c')],function(_0x30622d){var _0x720df1={};_0x720df1[_0x30622d]={'$like':'%'+_0xf7a018['query'][_0xbd73('0x45')]+'%'};return _0x720df1;})});}_0x1f9076=_[_0xbd73('0x46')]({},_0x1f9076,_0xf7a018[_0xbd73('0x4e')]);return _0x70fe38['getApplications'](_0x1f9076);}})['then'](function(_0x4b4e56){if(_0x4b4e56){_0x16004b=_0x4b4e56['length'];if(!_0xf7a018[_0xbd73('0x39')][_0xbd73('0x40')](_0xbd73('0x41'))){_0x1f9076[_0xbd73('0x27')]=qs[_0xbd73('0x27')](_0xf7a018['query'][_0xbd73('0x27')]);_0x1f9076[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0xf7a018[_0xbd73('0x39')][_0xbd73('0x28')]);}return _0x70fe38[_0xbd73('0x11c')](_0x1f9076);}})['then'](function(_0x1d7198){if(_0x1d7198){return _0x1d7198?{'count':_0x16004b,'rows':_0x1d7198}:null;}})[_0xbd73('0x19')](respondWithResult(_0x3e68f5,null))[_0xbd73('0x4a')](handleError(_0x3e68f5,null));};exports['addProactiveActions']=function(_0x510e86,_0x3899b7){return db['chatProactiveAction'][_0xbd73('0x54')]({'where':{'id':_0x510e86['params']['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x3899b7,null))[_0xbd73('0x19')](function(_0x4a39b7){if(_0x4a39b7){return _0x4a39b7[_0xbd73('0x11d')](_0x510e86[_0xbd73('0x50')][_0xbd73('0x65')],_[_0xbd73('0x11e')](_0x510e86[_0xbd73('0x50')],['ids','id'])||{});}})[_0xbd73('0x19')](respondWithResult(_0x3899b7,null))['catch'](handleError(_0x3899b7,null));};exports[_0xbd73('0x11f')]=function(_0x2a80bc,_0x1f3f35){var _0x3fb346={};var _0x398e6b={};var _0x44568d;var _0x5a84b7;return db[_0xbd73('0x35')][_0xbd73('0x63')]({'where':{'id':_0x2a80bc[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x1f3f35,null))[_0xbd73('0x19')](function(_0xf8fb9e){if(_0xf8fb9e){_0x44568d=_0xf8fb9e;_0x398e6b[_0xbd73('0x38')]=_[_0xbd73('0x3a')](db[_0xbd73('0x120')]['rawAttributes']);_0x398e6b['query']=_['keys'](_0x2a80bc[_0xbd73('0x39')]);_0x398e6b[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x398e6b[_0xbd73('0x38')],_0x398e6b[_0xbd73('0x39')]);_0x3fb346[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x398e6b[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0x2a80bc[_0xbd73('0x39')]['fields']));_0x3fb346[_0xbd73('0x3c')]=_0x3fb346['attributes']['length']?_0x3fb346[_0xbd73('0x3c')]:_0x398e6b[_0xbd73('0x38')];_0x3fb346['order']=qs[_0xbd73('0x5c')](_0x2a80bc[_0xbd73('0x39')][_0xbd73('0x5c')]);_0x3fb346[_0xbd73('0x43')]=qs[_0xbd73('0x3b')](_[_0xbd73('0x44')](_0x2a80bc['query'],_0x398e6b['filters']));if(_0x2a80bc['query'][_0xbd73('0x45')]){_0x3fb346[_0xbd73('0x43')]=_[_0xbd73('0x46')](_0x3fb346[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x3fb346[_0xbd73('0x3c')],function(_0x42d039){var _0x3a3a8a={};_0x3a3a8a[_0x42d039]={'$like':'%'+_0x2a80bc[_0xbd73('0x39')]['filter']+'%'};return _0x3a3a8a;})});}_0x3fb346=_[_0xbd73('0x46')]({},_0x3fb346,_0x2a80bc[_0xbd73('0x4e')]);return _0x44568d[_0xbd73('0x11f')](_0x3fb346);}})[_0xbd73('0x19')](function(_0x4eeb4e){if(_0x4eeb4e){_0x5a84b7=_0x4eeb4e[_0xbd73('0x3f')];if(!_0x2a80bc[_0xbd73('0x39')][_0xbd73('0x40')](_0xbd73('0x41'))){_0x3fb346[_0xbd73('0x27')]=qs[_0xbd73('0x27')](_0x2a80bc[_0xbd73('0x39')][_0xbd73('0x27')]);_0x3fb346[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0x2a80bc[_0xbd73('0x39')]['offset']);}return _0x44568d[_0xbd73('0x11f')](_0x3fb346);}})[_0xbd73('0x19')](function(_0x5e56d6){if(_0x5e56d6){return _0x5e56d6?{'count':_0x5a84b7,'rows':_0x5e56d6}:null;}})[_0xbd73('0x19')](respondWithResult(_0x1f3f35,null))[_0xbd73('0x4a')](handleError(_0x1f3f35,null));};exports[_0xbd73('0x121')]=function(_0x30f07f,_0x40a24b){var _0x192f3f=_0x30f07f[_0xbd73('0x39')][_0xbd73('0x122')]===_0xbd73('0x123')?_0xbd73('0x124'):_0xbd73('0x125');return db[_0xbd73('0x35')][_0xbd73('0x54')]({'attributes':['id',_0x192f3f],'where':{'id':_0x30f07f[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x40a24b,null))[_0xbd73('0x19')](function(_0x2062a4){if(_0x2062a4){var _0x364785=_0x2062a4[_0x192f3f];var _0x1f37af=_0x364785&&_0x364785['items']?_0x364785[_0xbd73('0x126')]:[];_0x40a24b[_0xbd73('0x31')]({'fromKey':_[_0xbd73('0x74')](_0x364785[_0xbd73('0x127')])?undefined:_0x364785[_0xbd73('0x127')],'count':_0x1f37af[_0xbd73('0x3f')],'rows':_0x1f37af});}})['catch'](handleError(_0x40a24b,null));};exports[_0xbd73('0x128')]=function(_0x367a14,_0x6ac66e){var _0x283ea7={'raw':![],'where':{}};var _0x2dcba3={};var _0x4bc7cc={'count':0x0,'rows':[]};return db[_0xbd73('0x35')][_0xbd73('0x63')]({'where':{'id':_0x367a14[_0xbd73('0x57')]['id']}})['then'](handleEntityNotFound(_0x6ac66e,null))[_0xbd73('0x19')](function(_0x19cb76){if(_0x19cb76){_0x2dcba3['model']=_['keys'](db[_0xbd73('0xcf')]['rawAttributes']);_0x2dcba3['query']=_[_0xbd73('0x3a')](_0x367a14[_0xbd73('0x39')]);_0x2dcba3[_0xbd73('0x3b')]=_['intersection'](_0x2dcba3[_0xbd73('0x38')],_0x2dcba3[_0xbd73('0x39')]);_0x283ea7[_0xbd73('0x3c')]=_[_0xbd73('0x3d')](_0x2dcba3[_0xbd73('0x38')],qs[_0xbd73('0x3e')](_0x367a14[_0xbd73('0x39')][_0xbd73('0x3e')]));_0x283ea7[_0xbd73('0x3c')]=_0x283ea7[_0xbd73('0x3c')][_0xbd73('0x3f')]?_0x283ea7[_0xbd73('0x3c')]:_0x2dcba3[_0xbd73('0x38')];if(!_0x367a14[_0xbd73('0x39')]['hasOwnProperty'](_0xbd73('0x41'))){_0x283ea7['limit']=qs['limit'](_0x367a14['query']['limit']);_0x283ea7[_0xbd73('0x28')]=qs[_0xbd73('0x28')](_0x367a14[_0xbd73('0x39')][_0xbd73('0x28')]);}_0x283ea7[_0xbd73('0x42')]=qs[_0xbd73('0x5c')](_0x367a14[_0xbd73('0x39')][_0xbd73('0x5c')]);_0x283ea7[_0xbd73('0x43')]=qs[_0xbd73('0x3b')](_[_0xbd73('0x44')](_0x367a14['query'],_0x2dcba3[_0xbd73('0x3b')]));_0x283ea7[_0xbd73('0x43')][_0xbd73('0x5a')]=_0x19cb76['id'];if(_0x367a14['query']['filter']){_0x283ea7[_0xbd73('0x43')]=_['merge'](_0x283ea7[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x283ea7[_0xbd73('0x3c')],function(_0x23c4a1){var _0x366caf={};_0x366caf[_0x23c4a1]={'$like':'%'+_0x367a14['query'][_0xbd73('0x45')]+'%'};return _0x366caf;})});}_0x283ea7=_[_0xbd73('0x46')]({},_0x283ea7,_0x367a14['options']);return db[_0xbd73('0xcf')][_0xbd73('0x29')]({'where':_0x283ea7[_0xbd73('0x43')]})[_0xbd73('0x19')](function(_0x2e82bb){_0x4bc7cc[_0xbd73('0x29')]=_0x2e82bb;if(_0x367a14[_0xbd73('0x39')]['includeAll']){_0x283ea7[_0xbd73('0x5d')]=[{'all':!![]}];}else{_0x283ea7['include']=[{'model':db[_0xbd73('0x87')],'as':_0xbd73('0xef'),'required':![]},{'model':db[_0xbd73('0xd7')],'as':_0xbd73('0x129'),'required':![]}];}return db[_0xbd73('0xcf')][_0xbd73('0x49')](_0x283ea7);})[_0xbd73('0x19')](function(_0x58d8ee){_0x4bc7cc[_0xbd73('0x5e')]=_0x58d8ee;return _0x4bc7cc;});}})[_0xbd73('0x19')](respondWithFilteredResult(_0x6ac66e,_0x283ea7))[_0xbd73('0x4a')](handleError(_0x6ac66e,null));};exports[_0xbd73('0x12a')]=function(_0x5f13cc,_0x5e24b0){return db[_0xbd73('0x35')][_0xbd73('0x54')]({'where':{'id':_0x5f13cc[_0xbd73('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e24b0,null))[_0xbd73('0x19')](function(_0x446e5e){if(_0x446e5e){return _0x446e5e[_0xbd73('0x12a')](_0x5f13cc['body'][_0xbd73('0x65')],_[_0xbd73('0x11e')](_0x5f13cc[_0xbd73('0x50')],['ids','id'])||{})[_0xbd73('0xb2')](function(_0x1bc924){for(var _0x4b1903=0x0;_0x4b1903<_0x5f13cc[_0xbd73('0x50')][_0xbd73('0x65')][_0xbd73('0x3f')];_0x4b1903+=0x1){socket[_0xbd73('0x12b')](_0xbd73('0x12c'),{'UserId':Number(_0x5f13cc['body']['ids'][_0x4b1903]),'ChatWebsiteId':Number(_0x5f13cc[_0xbd73('0x57')]['id'])});}return _0x1bc924;});}})[_0xbd73('0x19')](respondWithResult(_0x5e24b0,null))[_0xbd73('0x4a')](handleError(_0x5e24b0,null));};exports[_0xbd73('0x12d')]=function(_0x46f545,_0x35026d){return db['ChatWebsite']['find']({'where':{'id':_0x46f545[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0x35026d,null))['then'](function(_0x482bc1){if(_0x482bc1){return _0x482bc1[_0xbd73('0x12d')](_0x46f545[_0xbd73('0x39')][_0xbd73('0x65')])['then'](function(){if(_[_0xbd73('0x12e')](_0x46f545['query'][_0xbd73('0x65')])){for(var _0x100972=0x0;_0x100972<_0x46f545['query'][_0xbd73('0x65')][_0xbd73('0x3f')];_0x100972+=0x1){socket['emit'](_0xbd73('0x12f'),{'UserId':Number(_0x46f545[_0xbd73('0x39')]['ids'][_0x100972]),'ChatWebsiteId':Number(_0x46f545[_0xbd73('0x57')]['id'])});}}else{socket[_0xbd73('0x12b')]('userChatWebsite:remove',{'UserId':Number(_0x46f545[_0xbd73('0x39')][_0xbd73('0x65')]),'ChatWebsiteId':Number(_0x46f545[_0xbd73('0x57')]['id'])});}});}})[_0xbd73('0x19')](respondWithStatusCode(_0x35026d,null))[_0xbd73('0x4a')](handleError(_0x35026d,null));};exports[_0xbd73('0x130')]=function(_0x20ba2d,_0xc2fd83){var _0x5e7892={};var _0x39b05d={};var _0x5f1907;var _0x230045;return db['ChatWebsite'][_0xbd73('0x63')]({'where':{'id':_0x20ba2d[_0xbd73('0x57')]['id']}})[_0xbd73('0x19')](handleEntityNotFound(_0xc2fd83,null))[_0xbd73('0x19')](function(_0x58eb9f){if(_0x58eb9f){_0x5f1907=_0x58eb9f;_0x39b05d[_0xbd73('0x38')]=_[_0xbd73('0x3a')](db[_0xbd73('0xbb')]['rawAttributes']);_0x39b05d['query']=_['keys'](_0x20ba2d[_0xbd73('0x39')]);_0x39b05d[_0xbd73('0x3b')]=_[_0xbd73('0x3d')](_0x39b05d[_0xbd73('0x38')],_0x39b05d[_0xbd73('0x39')]);_0x5e7892[_0xbd73('0x3c')]=_['intersection'](_0x39b05d[_0xbd73('0x38')],qs['fields'](_0x20ba2d[_0xbd73('0x39')]['fields']));_0x5e7892[_0xbd73('0x3c')]=_0x5e7892[_0xbd73('0x3c')]['length']?_0x5e7892[_0xbd73('0x3c')]:_0x39b05d[_0xbd73('0x38')];_0x5e7892[_0xbd73('0x42')]=qs[_0xbd73('0x5c')](_0x20ba2d['query']['sort']);_0x5e7892['where']=qs[_0xbd73('0x3b')](_['pick'](_0x20ba2d[_0xbd73('0x39')],_0x39b05d['filters']));if(_0x20ba2d[_0xbd73('0x39')]['filter']){_0x5e7892[_0xbd73('0x43')]=_['merge'](_0x5e7892[_0xbd73('0x43')],{'$or':_[_0xbd73('0x34')](_0x5e7892[_0xbd73('0x3c')],function(_0x332022){var _0x3f1ee4={};_0x3f1ee4[_0x332022]={'$like':'%'+_0x20ba2d[_0xbd73('0x39')][_0xbd73('0x45')]+'%'};return _0x3f1ee4;})});}_0x5e7892=_['merge']({},_0x5e7892,_0x20ba2d[_0xbd73('0x4e')]);return _0x5f1907[_0xbd73('0x130')](_0x5e7892);}})[_0xbd73('0x19')](function(_0x56422f){if(_0x56422f){_0x230045=_0x56422f[_0xbd73('0x3f')];if(!_0x20ba2d['query'][_0xbd73('0x40')](_0xbd73('0x41'))){_0x5e7892['limit']=qs[_0xbd73('0x27')](_0x20ba2d[_0xbd73('0x39')][_0xbd73('0x27')]);_0x5e7892['offset']=qs[_0xbd73('0x28')](_0x20ba2d['query']['offset']);}return _0x5f1907[_0xbd73('0x130')](_0x5e7892);}})[_0xbd73('0x19')](function(_0x7b24fc){if(_0x7b24fc){return _0x7b24fc?{'count':_0x230045,'rows':_0x7b24fc}:null;}})[_0xbd73('0x19')](respondWithResult(_0xc2fd83,null))[_0xbd73('0x4a')](handleError(_0xc2fd83,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ea95061..484ef37 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 _0xa98d=['hasOwnProperty','hook','exports','events','ChatWebsite','save','update','emit'];(function(_0x4b3ed9,_0x4bb280){var _0x56c9a4=function(_0xa615c8){while(--_0xa615c8){_0x4b3ed9['push'](_0x4b3ed9['shift']());}};_0x56c9a4(++_0x4bb280);}(_0xa98d,0xa3));var _0xda98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa98d[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xda98('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xda98('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xda98('0x2'),'afterUpdate':_0xda98('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5e5a09){return function(_0xf9ae27,_0x3a4432,_0x5ddf11){ChatWebsiteEvents[_0xda98('0x4')](_0x5e5a09+':'+_0xf9ae27['id'],_0xf9ae27);ChatWebsiteEvents[_0xda98('0x4')](_0x5e5a09,_0xf9ae27);_0x5ddf11(null);};}for(var e in events){if(events[_0xda98('0x5')](e)){var event=events[e];ChatWebsite[_0xda98('0x6')](e,emitEvent(event));}}module[_0xda98('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x5089=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x22afe1,_0x2a6f2d){var _0x3bb5b9=function(_0x177218){while(--_0x177218){_0x22afe1['push'](_0x22afe1['shift']());}};_0x3bb5b9(++_0x2a6f2d);}(_0x5089,0x1bb));var _0x9508=function(_0x3b2244,_0x54873f){_0x3b2244=_0x3b2244-0x0;var _0x2dcc14=_0x5089[_0x3b2244];return _0x2dcc14;};'use strict';var EventEmitter=require(_0x9508('0x0'));var ChatWebsite=require(_0x9508('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9508('0x2')](0x0);var events={'afterCreate':_0x9508('0x3'),'afterUpdate':_0x9508('0x4'),'afterDestroy':_0x9508('0x5')};function emitEvent(_0x172549){return function(_0x59d3ee,_0x86540d,_0x5e80fa){ChatWebsiteEvents[_0x9508('0x6')](_0x172549+':'+_0x59d3ee['id'],_0x59d3ee);ChatWebsiteEvents[_0x9508('0x6')](_0x172549,_0x59d3ee);_0x5e80fa(null);};}for(var e in events){if(events[_0x9508('0x7')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x9508('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 27c2e8c..54f4594 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 _0x8255=['util','../../config/logger','api','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash'];(function(_0x511705,_0x14a5e8){var _0xe6ddee=function(_0x2a70a5){while(--_0x2a70a5){_0x511705['push'](_0x511705['shift']());}};_0xe6ddee(++_0x14a5e8);}(_0x8255,0x99));var _0x5825=function(_0x4b9893,_0x5048e4){_0x4b9893=_0x4b9893-0x0;var _0x4625b9=_0x8255[_0x4b9893];return _0x4625b9;};'use strict';var _=require(_0x5825('0x0'));var util=require(_0x5825('0x1'));var logger=require(_0x5825('0x2'))(_0x5825('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5825('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5825('0x5'));var config=require(_0x5825('0x6'));var attributes=require(_0x5825('0x7'));module['exports']=function(_0x29babe,_0x44e00e){return _0x29babe[_0x5825('0x8')](_0x5825('0x9'),attributes,{'tableName':_0x5825('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bd5=['lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite'];(function(_0x90142b,_0x3b8e05){var _0x49d6cd=function(_0x1a72b6){while(--_0x1a72b6){_0x90142b['push'](_0x90142b['shift']());}};_0x49d6cd(++_0x3b8e05);}(_0x7bd5,0x82));var _0x57bd=function(_0x313f18,_0x317e02){_0x313f18=_0x313f18-0x0;var _0x592fbb=_0x7bd5[_0x313f18];return _0x592fbb;};'use strict';var _=require(_0x57bd('0x0'));var util=require(_0x57bd('0x1'));var logger=require('../../config/logger')(_0x57bd('0x2'));var moment=require('moment');var BPromise=require(_0x57bd('0x3'));var rp=require(_0x57bd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57bd('0x5'));var config=require(_0x57bd('0x6'));var attributes=require(_0x57bd('0x7'));module[_0x57bd('0x8')]=function(_0x4527c,_0x162094){return _0x4527c['define'](_0x57bd('0x9'),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 102af6d..39d5508 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 _0xa1b3=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0xa1b3,0x163));var _0x3a1b=function(_0xfbfed8,_0x4de223){_0xfbfed8=_0xfbfed8-0x0;var _0x5e837d=_0xa1b3[_0xfbfed8];return _0x5e837d;};'use strict';var _=require(_0x3a1b('0x0'));var util=require(_0x3a1b('0x1'));var moment=require('moment');var BPromise=require(_0x3a1b('0x2'));var rs=require(_0x3a1b('0x3'));var fs=require('fs');var Redis=require(_0x3a1b('0x4'));var db=require(_0x3a1b('0x5'))['db'];var utils=require(_0x3a1b('0x6'));var logger=require('../../config/logger')(_0x3a1b('0x7'));var config=require(_0x3a1b('0x8'));var jayson=require(_0x3a1b('0x9'));var client=jayson[_0x3a1b('0xa')][_0x3a1b('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3a1b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3a1b('0xc')]));require(_0x3a1b('0xd'))[_0x3a1b('0xe')](socket);function respondWithRpcPromise(_0x461bb7,_0x376ece,_0x3a0f31){return new BPromise(function(_0x43a384,_0x16eda8){return client[_0x3a1b('0xf')](_0x461bb7,_0x3a0f31)[_0x3a1b('0x10')](function(_0x3ddcb8){logger[_0x3a1b('0x11')](_0x3a1b('0x12'),_0x376ece,_0x3a1b('0x13'));logger['debug'](_0x3a1b('0x14'),_0x376ece,'request\x20sent',JSON[_0x3a1b('0x15')](_0x3ddcb8));if(_0x3ddcb8[_0x3a1b('0x16')]){if(_0x3ddcb8[_0x3a1b('0x16')][_0x3a1b('0x17')]===0x1f4){logger[_0x3a1b('0x16')](_0x3a1b('0x12'),_0x376ece,_0x3ddcb8[_0x3a1b('0x16')][_0x3a1b('0x18')]);return _0x16eda8(_0x3ddcb8[_0x3a1b('0x16')][_0x3a1b('0x18')]);}logger[_0x3a1b('0x16')](_0x3a1b('0x12'),_0x376ece,_0x3ddcb8[_0x3a1b('0x16')]['message']);return _0x43a384(_0x3ddcb8['error'][_0x3a1b('0x18')]);}else{logger[_0x3a1b('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x376ece,_0x3a1b('0x13'));_0x43a384(_0x3ddcb8[_0x3a1b('0x19')]['message']);}})[_0x3a1b('0x1a')](function(_0xeb217){logger[_0x3a1b('0x16')](_0x3a1b('0x12'),_0x376ece,_0xeb217);_0x16eda8(_0xeb217);});});} \ No newline at end of file +var _0x6b25=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b25,0xdf));var _0x56b2=function(_0x2cafdb,_0x15833a){_0x2cafdb=_0x2cafdb-0x0;var _0x4d4970=_0x6b25[_0x2cafdb];return _0x4d4970;};'use strict';var _=require(_0x56b2('0x0'));var util=require(_0x56b2('0x1'));var moment=require(_0x56b2('0x2'));var BPromise=require(_0x56b2('0x3'));var rs=require(_0x56b2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56b2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x56b2('0x6'))(_0x56b2('0x7'));var config=require(_0x56b2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x56b2('0x9')][_0x56b2('0xa')]({'port':0x232a});config[_0x56b2('0xb')]=_[_0x56b2('0xc')](config[_0x56b2('0xb')],{'host':_0x56b2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56b2('0xb')]));require(_0x56b2('0xe'))[_0x56b2('0xf')](socket);function respondWithRpcPromise(_0x5cfc6c,_0x66bbb2,_0xc0bf8a){return new BPromise(function(_0x344005,_0x458fbc){return client[_0x56b2('0x10')](_0x5cfc6c,_0xc0bf8a)[_0x56b2('0x11')](function(_0x5d4c9a){logger['info'](_0x56b2('0x12'),_0x66bbb2,_0x56b2('0x13'));logger[_0x56b2('0x14')](_0x56b2('0x15'),_0x66bbb2,'request\x20sent',JSON[_0x56b2('0x16')](_0x5d4c9a));if(_0x5d4c9a['error']){if(_0x5d4c9a[_0x56b2('0x17')]['code']===0x1f4){logger[_0x56b2('0x17')](_0x56b2('0x12'),_0x66bbb2,_0x5d4c9a[_0x56b2('0x17')][_0x56b2('0x18')]);return _0x458fbc(_0x5d4c9a['error'][_0x56b2('0x18')]);}logger[_0x56b2('0x17')](_0x56b2('0x12'),_0x66bbb2,_0x5d4c9a[_0x56b2('0x17')][_0x56b2('0x18')]);return _0x344005(_0x5d4c9a['error'][_0x56b2('0x18')]);}else{logger[_0x56b2('0x19')](_0x56b2('0x12'),_0x66bbb2,_0x56b2('0x13'));_0x344005(_0x5d4c9a[_0x56b2('0x1a')][_0x56b2('0x18')]);}})[_0x56b2('0x1b')](function(_0x49bcdb){logger[_0x56b2('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x66bbb2,_0x49bcdb);_0x458fbc(_0x49bcdb);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 54470de..d0a03a6 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 _0x6b95=['./chatWebsite.events','remove','update','emit','removeListener','length','chatWebsite:'];(function(_0x53b30d,_0x4e8041){var _0x1a5e40=function(_0x38bcde){while(--_0x38bcde){_0x53b30d['push'](_0x53b30d['shift']());}};_0x1a5e40(++_0x4e8041);}(_0x6b95,0x1a4));var _0x56b9=function(_0x5162e9,_0x1b613c){_0x5162e9=_0x5162e9-0x0;var _0x6dfe81=_0x6b95[_0x5162e9];return _0x6dfe81;};'use strict';var ChatWebsiteEvents=require(_0x56b9('0x0'));var events=['save',_0x56b9('0x1'),_0x56b9('0x2')];function createListener(_0x9d0f76,_0x5bb556){return function(_0x4c43d4){_0x5bb556[_0x56b9('0x3')](_0x9d0f76,_0x4c43d4);};}function removeListener(_0x34952f,_0x29a245){return function(){ChatWebsiteEvents[_0x56b9('0x4')](_0x34952f,_0x29a245);};}exports['register']=function(_0x139fcf){for(var _0x38cd05=0x0,_0x257429=events[_0x56b9('0x5')];_0x38cd05<_0x257429;_0x38cd05++){var _0x486180=events[_0x38cd05];var _0x1d2d91=createListener(_0x56b9('0x6')+_0x486180,_0x139fcf);ChatWebsiteEvents['on'](_0x486180,_0x1d2d91);}}; \ No newline at end of file +var _0xa8e9=['emit','removeListener','chatWebsite:','./chatWebsite.events','save','remove','update'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xa8e9,0x168));var _0x9a8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa8e9[_0x3dd15e];return _0x231fd0;};'use strict';var ChatWebsiteEvents=require(_0x9a8e('0x0'));var events=[_0x9a8e('0x1'),_0x9a8e('0x2'),_0x9a8e('0x3')];function createListener(_0x817b5d,_0x4d1176){return function(_0x519352){_0x4d1176[_0x9a8e('0x4')](_0x817b5d,_0x519352);};}function removeListener(_0x40e3e0,_0x50e862){return function(){ChatWebsiteEvents[_0x9a8e('0x5')](_0x40e3e0,_0x50e862);};}exports['register']=function(_0x40246f){for(var _0x1b0528=0x0,_0x1d2cd0=events['length'];_0x1b0528<_0x1d2cd0;_0x1b0528++){var _0xb2d343=events[_0x1b0528];var _0x4df3ef=createListener(_0x9a8e('0x6')+_0xb2d343,_0x40246f);ChatWebsiteEvents['on'](_0xb2d343,_0x4df3ef);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index ae4691b..c8b5330 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 _0x1921=['/:id/users','put','update','delete','destroy','/:id/dispositions','removeDispositions','/:id/canned_answers','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','index','/describe','describe','/:id','show','isAuthenticated','getAnswers','/:id/logo','getLogo','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','post','addAnswer','diskStorage','join','server/files/images/logos/','%s-%s','now','single','file','addLogo','root','server/files/images/avatars/','addAvatar','format','originalname','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','offline-chat','replace','any','addInteraction','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions'];(function(_0x4de836,_0x82ac62){var _0x224b7a=function(_0x14f7f8){while(--_0x14f7f8){_0x4de836['push'](_0x4de836['shift']());}};_0x224b7a(++_0x82ac62);}(_0x1921,0xcc));var _0x1192=function(_0x38b27f,_0x4b9a43){_0x38b27f=_0x38b27f-0x0;var _0x5b9c4d=_0x1921[_0x38b27f];return _0x5b9c4d;};'use strict';var multer=require(_0x1192('0x0'));var util=require(_0x1192('0x1'));var path=require(_0x1192('0x2'));var timeout=require(_0x1192('0x3'));var express=require(_0x1192('0x4'));var router=express['Router']();var fs_extra=require(_0x1192('0x5'));var auth=require(_0x1192('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1192('0x7'));var controller=require(_0x1192('0x8'));router[_0x1192('0x9')]('/',auth['isAuthenticated'](),controller[_0x1192('0xa')]);router[_0x1192('0x9')](_0x1192('0xb'),auth['isAuthenticated'](),controller[_0x1192('0xc')]);router[_0x1192('0x9')](_0x1192('0xd'),auth['isAuthenticated'](),controller[_0x1192('0xe')]);router[_0x1192('0x9')]('/:id/dispositions',auth[_0x1192('0xf')](),controller['getDispositions']);router[_0x1192('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1192('0x10')]);router[_0x1192('0x9')](_0x1192('0x11'),controller[_0x1192('0x12')]);router[_0x1192('0x9')]('/:id/avatar',controller[_0x1192('0x13')]);router[_0x1192('0x9')]('/:id/customer_avatar',controller[_0x1192('0x14')]);router['get'](_0x1192('0x15'),controller[_0x1192('0x16')]);router[_0x1192('0x9')](_0x1192('0x17'),auth[_0x1192('0xf')](),controller['getInteractions']);router[_0x1192('0x9')](_0x1192('0x18'),controller['getSnippet']);router[_0x1192('0x9')]('/:id/applications',auth[_0x1192('0xf')](),controller[_0x1192('0x19')]);router[_0x1192('0x9')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x1192('0x1a')]);router['get'](_0x1192('0x1b'),controller[_0x1192('0x1c')]);router[_0x1192('0x9')](_0x1192('0x1d'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x1192('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x1192('0x1e')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1192('0x1e')]('/:id/dispositions',auth[_0x1192('0xf')](),controller['addDisposition']);router[_0x1192('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1192('0x1f')]);var upload=multer({'storage':multer[_0x1192('0x20')]({'destination':function(_0x46f08d,_0x437cea,_0x4c464e){_0x4c464e(null,path[_0x1192('0x21')](config['root'],_0x1192('0x22')));},'filename':function(_0x3a4e0c,_0x18fb52,_0x6c0138){_0x6c0138(null,util['format'](_0x1192('0x23'),Date[_0x1192('0x24')](),_0x18fb52['originalname']));}})});router[_0x1192('0x1e')](_0x1192('0x11'),upload[_0x1192('0x25')](_0x1192('0x26')),controller[_0x1192('0x27')]);var upload=multer({'storage':multer[_0x1192('0x20')]({'destination':function(_0x595e88,_0x3c0134,_0x35f06a){_0x35f06a(null,path[_0x1192('0x21')](config[_0x1192('0x28')],_0x1192('0x29')));},'filename':function(_0x2f9b1e,_0x1d0fca,_0x19e280){_0x19e280(null,util['format'](_0x1192('0x23'),Date[_0x1192('0x24')](),_0x1d0fca['originalname']));}})});router[_0x1192('0x1e')]('/:id/avatar',upload['single'](_0x1192('0x26')),controller[_0x1192('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xcd3898,_0x261b11,_0x41af3f){_0x41af3f(null,path[_0x1192('0x21')](config['root'],_0x1192('0x29')));},'filename':function(_0x1199b2,_0x4feaad,_0x10fa6b){_0x10fa6b(null,util[_0x1192('0x2b')](_0x1192('0x23'),Date[_0x1192('0x24')](),_0x4feaad[_0x1192('0x2c')]));}})});router[_0x1192('0x1e')](_0x1192('0x2d'),upload['single'](_0x1192('0x26')),controller[_0x1192('0x2e')]);var upload=multer({'storage':multer[_0x1192('0x20')]({'destination':function(_0x4576bf,_0x1eff2b,_0x495fbe){_0x495fbe(null,path['join'](config[_0x1192('0x28')],'server/files/images/avatars/'));},'filename':function(_0x469804,_0x9c6534,_0x58e7a0){_0x58e7a0(null,util[_0x1192('0x2b')]('%s-%s',Date[_0x1192('0x24')](),_0x9c6534[_0x1192('0x2c')]));}})});router[_0x1192('0x1e')](_0x1192('0x15'),upload[_0x1192('0x25')]('file'),controller[_0x1192('0x2f')]);router[_0x1192('0x1e')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x5f37b2,_0x1381fc,_0x31bac3){const _0x5dd14e=path[_0x1192('0x21')](config[_0x1192('0x28')],'server/files','attachments',_0x1192('0x30'));fs_extra['ensureDir'](_0x5dd14e,function(){_0x31bac3(null,_0x5dd14e);});},'filename':function(_0x512213,_0x31de8a,_0x44cb37){const _0x5eb46d=_0x31de8a[_0x1192('0x2c')][_0x1192('0x31')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x31922f=path['extname'](_0x5eb46d);const _0x2be751=Date[_0x1192('0x24')]()+'-'+_0x5eb46d[_0x1192('0x31')](_0x31922f,'')+_0x31922f;_0x44cb37(null,_0x2be751);}})});router[_0x1192('0x1e')]('/:id/offline',offlineUploadMulter[_0x1192('0x32')](),controller['offline']);router[_0x1192('0x1e')]('/:id/interactions',auth[_0x1192('0xf')](),controller[_0x1192('0x33')]);router[_0x1192('0x1e')](_0x1192('0x34'),auth['isAuthenticated'](),controller[_0x1192('0x35')]);router[_0x1192('0x1e')](_0x1192('0x36'),auth[_0x1192('0xf')](),controller[_0x1192('0x37')]);router['post'](_0x1192('0x38'),auth['isAuthenticated'](),controller['addAgents']);router[_0x1192('0x39')](_0x1192('0xd'),auth['isAuthenticated'](),controller[_0x1192('0x3a')]);router[_0x1192('0x3b')](_0x1192('0xd'),auth[_0x1192('0xf')](),controller[_0x1192('0x3c')]);router[_0x1192('0x3b')](_0x1192('0x3d'),auth[_0x1192('0xf')](),controller[_0x1192('0x3e')]);router[_0x1192('0x3b')](_0x1192('0x3f'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x1192('0x3b')]('/:id/users',auth['isAuthenticated'](),controller[_0x1192('0x40')]);module['exports']=router; \ No newline at end of file +var _0xe612=['getAnswers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','addDisposition','addAnswer','diskStorage','root','%s-%s','originalname','single','addLogo','join','server/files/images/avatars/','format','now','file','addAvatar','addCustomerAvatar','addSystemAvatar','notify','attachments','offline-chat','ensureDir','replace','extname','any','offline','/:id/interactions','addInteraction','addApplications','/:id/users','addAgents','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x1c2362,_0x397a51){var _0x44300d=function(_0x309430){while(--_0x309430){_0x1c2362['push'](_0x1c2362['shift']());}};_0x44300d(++_0x397a51);}(_0xe612,0x19d));var _0x2e61=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe612[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x2e61('0x0'));var util=require(_0x2e61('0x1'));var path=require(_0x2e61('0x2'));var timeout=require(_0x2e61('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2e61('0x4'));var auth=require(_0x2e61('0x5'));var interaction=require(_0x2e61('0x6'));var config=require(_0x2e61('0x7'));var controller=require(_0x2e61('0x8'));router[_0x2e61('0x9')]('/',auth[_0x2e61('0xa')](),controller[_0x2e61('0xb')]);router[_0x2e61('0x9')](_0x2e61('0xc'),auth[_0x2e61('0xa')](),controller[_0x2e61('0xd')]);router['get'](_0x2e61('0xe'),auth[_0x2e61('0xa')](),controller[_0x2e61('0xf')]);router[_0x2e61('0x9')](_0x2e61('0x10'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x11')]);router[_0x2e61('0x9')](_0x2e61('0x12'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x13')]);router[_0x2e61('0x9')](_0x2e61('0x14'),controller['getLogo']);router[_0x2e61('0x9')](_0x2e61('0x15'),controller['getAvatar']);router[_0x2e61('0x9')](_0x2e61('0x16'),controller[_0x2e61('0x17')]);router[_0x2e61('0x9')](_0x2e61('0x18'),controller[_0x2e61('0x19')]);router['get']('/:id/interactions',auth[_0x2e61('0xa')](),controller[_0x2e61('0x1a')]);router['get'](_0x2e61('0x1b'),controller[_0x2e61('0x1c')]);router[_0x2e61('0x9')](_0x2e61('0x1d'),auth[_0x2e61('0xa')](),controller['getApplications']);router[_0x2e61('0x9')](_0x2e61('0x1e'),auth[_0x2e61('0xa')](),controller['getProactiveActions']);router[_0x2e61('0x9')](_0x2e61('0x1f'),controller[_0x2e61('0x20')]);router[_0x2e61('0x9')](_0x2e61('0x21'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x22')]);router[_0x2e61('0x9')]('/:id/users',auth[_0x2e61('0xa')](),controller[_0x2e61('0x23')]);router[_0x2e61('0x24')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2e61('0x24')](_0x2e61('0x10'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x25')]);router[_0x2e61('0x24')](_0x2e61('0x12'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x26')]);var upload=multer({'storage':multer[_0x2e61('0x27')]({'destination':function(_0x1b4a4f,_0x457795,_0x558947){_0x558947(null,path['join'](config[_0x2e61('0x28')],'server/files/images/logos/'));},'filename':function(_0x11fd4f,_0x10bd67,_0x4c7232){_0x4c7232(null,util['format'](_0x2e61('0x29'),Date['now'](),_0x10bd67[_0x2e61('0x2a')]));}})});router[_0x2e61('0x24')](_0x2e61('0x14'),upload[_0x2e61('0x2b')]('file'),controller[_0x2e61('0x2c')]);var upload=multer({'storage':multer[_0x2e61('0x27')]({'destination':function(_0x993e56,_0x179661,_0x40097d){_0x40097d(null,path[_0x2e61('0x2d')](config[_0x2e61('0x28')],_0x2e61('0x2e')));},'filename':function(_0x597254,_0x4752f8,_0x3508e1){_0x3508e1(null,util[_0x2e61('0x2f')](_0x2e61('0x29'),Date[_0x2e61('0x30')](),_0x4752f8[_0x2e61('0x2a')]));}})});router[_0x2e61('0x24')]('/:id/avatar',upload[_0x2e61('0x2b')](_0x2e61('0x31')),controller[_0x2e61('0x32')]);var upload=multer({'storage':multer[_0x2e61('0x27')]({'destination':function(_0x413e77,_0x5d37f5,_0x5eae91){_0x5eae91(null,path[_0x2e61('0x2d')](config[_0x2e61('0x28')],_0x2e61('0x2e')));},'filename':function(_0x5a04dd,_0x44c1a2,_0x127e18){_0x127e18(null,util[_0x2e61('0x2f')](_0x2e61('0x29'),Date[_0x2e61('0x30')](),_0x44c1a2['originalname']));}})});router[_0x2e61('0x24')](_0x2e61('0x16'),upload['single'](_0x2e61('0x31')),controller[_0x2e61('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x314aec,_0x437d51,_0x505ff4){_0x505ff4(null,path[_0x2e61('0x2d')](config[_0x2e61('0x28')],'server/files/images/avatars/'));},'filename':function(_0x5ac3e8,_0x2146ad,_0x37a5d4){_0x37a5d4(null,util[_0x2e61('0x2f')]('%s-%s',Date[_0x2e61('0x30')](),_0x2146ad[_0x2e61('0x2a')]));}})});router[_0x2e61('0x24')](_0x2e61('0x18'),upload[_0x2e61('0x2b')]('file'),controller[_0x2e61('0x34')]);router['post']('/:id/notify',controller[_0x2e61('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x2e61('0x27')]({'destination':function(_0x2f1f2d,_0x3d77c0,_0x4528ae){const _0x15849f=path[_0x2e61('0x2d')](config['root'],'server/files',_0x2e61('0x36'),_0x2e61('0x37'));fs_extra[_0x2e61('0x38')](_0x15849f,function(){_0x4528ae(null,_0x15849f);});},'filename':function(_0x125a84,_0x2b6060,_0x5adb3b){const _0x4735d8=_0x2b6060[_0x2e61('0x2a')][_0x2e61('0x39')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2f9cbc=path[_0x2e61('0x3a')](_0x4735d8);const _0x2d6cec=Date[_0x2e61('0x30')]()+'-'+_0x4735d8[_0x2e61('0x39')](_0x2f9cbc,'')+_0x2f9cbc;_0x5adb3b(null,_0x2d6cec);}})});router[_0x2e61('0x24')]('/:id/offline',offlineUploadMulter[_0x2e61('0x3b')](),controller[_0x2e61('0x3c')]);router['post'](_0x2e61('0x3d'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x3e')]);router['post'](_0x2e61('0x1d'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x3f')]);router['post']('/:id/proactive_actions',auth[_0x2e61('0xa')](),controller['addProactiveActions']);router[_0x2e61('0x24')](_0x2e61('0x40'),auth['isAuthenticated'](),controller[_0x2e61('0x41')]);router[_0x2e61('0x42')](_0x2e61('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x2e61('0x43')](_0x2e61('0xe'),auth['isAuthenticated'](),controller[_0x2e61('0x44')]);router[_0x2e61('0x43')](_0x2e61('0x10'),auth['isAuthenticated'](),controller[_0x2e61('0x45')]);router[_0x2e61('0x43')](_0x2e61('0x12'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x46')]);router['delete'](_0x2e61('0x40'),auth[_0x2e61('0xa')](),controller[_0x2e61('0x47')]);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 5a0819c..372641f 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 _0x5f29=['use','exports','beaver-logger/server','express','../config/environment','Router','env','app','get','/client-logs'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x5f29,0x84));var _0x95f2=function(_0x45321d,_0x58eb4f){_0x45321d=_0x45321d-0x0;var _0x1a999a=_0x5f29[_0x45321d];return _0x1a999a;};var beaverLogger=require(_0x95f2('0x0'));var express=require(_0x95f2('0x1'));var auth=require('../components/auth/service');var config=require(_0x95f2('0x2'));var router=express[_0x95f2('0x3')]();var isProduction=config[_0x95f2('0x4')]==='production'||![];function clientSideLogs(_0xc3b8b2,_0x414800,_0x50a428){var _0x1fcbcf=_0xc3b8b2[_0x95f2('0x5')][_0x95f2('0x6')]('client-side-logger');if(!_0x1fcbcf){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':_0x95f2('0x7'),'logger':_0x1fcbcf,'enableCors':!isProduction})(_0xc3b8b2,_0x414800,_0x50a428);}router[_0x95f2('0x8')](auth['isAuthenticated'](),clientSideLogs);module[_0x95f2('0x9')]=router; \ No newline at end of file +var _0x9423=['use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs'];(function(_0x4f95f8,_0xb3da1b){var _0x3b41ec=function(_0x3fb5f1){while(--_0x3fb5f1){_0x4f95f8['push'](_0x4f95f8['shift']());}};_0x3b41ec(++_0xb3da1b);}(_0x9423,0x1e3));var _0x3942=function(_0x14e366,_0x5177ce){_0x14e366=_0x14e366-0x0;var _0x52c7ff=_0x9423[_0x14e366];return _0x52c7ff;};var beaverLogger=require(_0x3942('0x0'));var express=require('express');var auth=require(_0x3942('0x1'));var config=require(_0x3942('0x2'));var router=express[_0x3942('0x3')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x1b996b,_0x748db,_0x2212c4){var _0x46f013=_0x1b996b[_0x3942('0x4')]['get'](_0x3942('0x5'));if(!_0x46f013){throw new Error(_0x3942('0x6'));}return beaverLogger[_0x3942('0x7')]({'uri':_0x3942('0x8'),'logger':_0x46f013,'enableCors':!isProduction})(_0x1b996b,_0x748db,_0x2212c4);}router[_0x3942('0x9')](auth[_0x3942('0xa')](),clientSideLogs);module[_0x3942('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 9b8df05..47acc00 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 _0xb0c0=['TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x170ce6,_0x14de47){var _0x3bcc9b=function(_0x444771){while(--_0x444771){_0x170ce6['push'](_0x170ce6['shift']());}};_0x3bcc9b(++_0x14de47);}(_0xb0c0,0x9e));var _0x0b0c=function(_0x420104,_0x1138c2){_0x420104=_0x420104-0x0;var _0x50ec32=_0xb0c0[_0x420104];return _0x50ec32;};'use strict';var Sequelize=require(_0x0b0c('0x0'));module[_0x0b0c('0x1')]={'name':{'type':Sequelize[_0x0b0c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0b0c('0x3')](_0x0b0c('0x4'),_0x0b0c('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x0b0c('0x3')](_0x0b0c('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0x0b0c('0x2')],'comment':_0x0b0c('0x7')},'data2':{'type':Sequelize[_0x0b0c('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x0b0c('0x2')],'comment':_0x0b0c('0x8')},'data4':{'type':Sequelize[_0x0b0c('0x2')],'comment':_0x0b0c('0x9')},'data5':{'type':Sequelize[_0x0b0c('0xa')],'comment':_0x0b0c('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0x0b0c('0xc')},'data7':{'type':Sequelize[_0x0b0c('0xa')],'comment':_0x0b0c('0xd')}}; \ No newline at end of file +var _0x8ea7=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x3d92cb,_0x11aa36){var _0x50026d=function(_0x43df54){while(--_0x43df54){_0x3d92cb['push'](_0x3d92cb['shift']());}};_0x50026d(++_0x11aa36);}(_0x8ea7,0x19e));var _0x78ea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ea7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x78ea('0x0'));module[_0x78ea('0x1')]={'name':{'type':Sequelize[_0x78ea('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x78ea('0x3')](_0x78ea('0x4'),_0x78ea('0x5'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x78ea('0x3')](_0x78ea('0x6'),_0x78ea('0x7'))},'data1':{'type':Sequelize[_0x78ea('0x2')],'comment':_0x78ea('0x8')},'data2':{'type':Sequelize[_0x78ea('0x2')],'comment':_0x78ea('0x9')},'data3':{'type':Sequelize[_0x78ea('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0x78ea('0x2')],'comment':_0x78ea('0xa')},'data5':{'type':Sequelize[_0x78ea('0xb')],'comment':_0x78ea('0xc')},'data6':{'type':Sequelize[_0x78ea('0xb')],'comment':_0x78ea('0xd')},'data7':{'type':Sequelize[_0x78ea('0xb')],'comment':_0x78ea('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 3298257..a398fbd 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 _0x1b8c=['includeAll','include','rows','service','decryptString','catch','show','rawAttributes','find','MicrosoftAzure','data3','create','Name\x20parameter\x20not\x20specified','values','includes','body','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','params','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','Invalid\x20state\x20parameter','parse','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','state','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','update','then','destroy','error','stack','name','send','padEnd','slice','map','CloudProvider','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options'];(function(_0x557a23,_0x3894ff){var _0x599c2b=function(_0x179333){while(--_0x179333){_0x557a23['push'](_0x557a23['shift']());}};_0x599c2b(++_0x3894ff);}(_0x1b8c,0x8d));var _0xc1b8=function(_0xb2e780,_0x1b6730){_0xb2e780=_0xb2e780-0x0;var _0x4a45d3=_0x1b8c[_0xb2e780];return _0x4a45d3;};'use strict';var _=require(_0xc1b8('0x0'));var Redis=require(_0xc1b8('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xc1b8('0x2'));var config=require(_0xc1b8('0x3'));var logger=require(_0xc1b8('0x4'))(_0xc1b8('0x5'));var db=require(_0xc1b8('0x6'))['db'];var oauth=require(_0xc1b8('0x7'));config[_0xc1b8('0x8')]=_[_0xc1b8('0x9')](config[_0xc1b8('0x8')],{'host':_0xc1b8('0xa'),'port':0x18eb});var socket=require(_0xc1b8('0xb'))(new Redis(config['redis']));var redis=new Redis(config[_0xc1b8('0x8')]);function respondWithStatusCode(_0x5189a3,_0x3aa189){_0x3aa189=_0x3aa189||0xcc;return function(_0x5e08a2){if(_0x5e08a2){return _0x5189a3[_0xc1b8('0xc')](_0x3aa189);}return _0x5189a3[_0xc1b8('0xd')](_0x3aa189)[_0xc1b8('0xe')]();};}function respondWithResult(_0x416a3d,_0x357286){_0x357286=_0x357286||0xc8;return function(_0x205ff7){if(_0x205ff7){return _0x416a3d[_0xc1b8('0xd')](_0x357286)[_0xc1b8('0xf')](_0x205ff7);}};}function respondWithFilteredResult(_0x1b6e19,_0x1e859f){return function(_0x3f2d51){if(_0x3f2d51){var _0x179b0f=typeof _0x1e859f['offset']==='undefined'&&typeof _0x1e859f[_0xc1b8('0x10')]===_0xc1b8('0x11');var _0x5a0cf6=_0x3f2d51[_0xc1b8('0x12')];var _0x265378=_0x179b0f?0x0:_0x1e859f[_0xc1b8('0x13')];var _0x32c1a4=_0x179b0f?_0x3f2d51[_0xc1b8('0x12')]:_0x1e859f[_0xc1b8('0x13')]+_0x1e859f[_0xc1b8('0x10')];var _0x2c66b2;if(_0x32c1a4>=_0x5a0cf6){_0x32c1a4=_0x5a0cf6;_0x2c66b2=0xc8;}else{_0x2c66b2=0xce;}_0x1b6e19[_0xc1b8('0xd')](_0x2c66b2);return _0x1b6e19['set'](_0xc1b8('0x14'),_0x265378+'-'+_0x32c1a4+'/'+_0x5a0cf6)[_0xc1b8('0xf')](_0x3f2d51);}return null;};}function saveUpdates(_0xecc1ee){return function(_0x48cf0c){if(_0x48cf0c){return _0x48cf0c[_0xc1b8('0x15')](_0xecc1ee)[_0xc1b8('0x16')](function(_0x3d6229){return _0x3d6229;});}return null;};}function removeEntity(_0x5e523d){return function(_0x205181){if(_0x205181){return _0x205181[_0xc1b8('0x17')]()[_0xc1b8('0x16')](function(){_0x5e523d[_0xc1b8('0xd')](0xcc)[_0xc1b8('0xe')]();});}};}function handleEntityNotFound(_0x2bd187){return function(_0x5b3648){if(!_0x5b3648){_0x2bd187['sendStatus'](0x194);}return _0x5b3648;};}function handleError(_0x1c096f,_0x115fa3){_0x115fa3=_0x115fa3||0x1f4;return function(_0x276199){logger[_0xc1b8('0x18')](_0x276199[_0xc1b8('0x19')]);if(_0x276199[_0xc1b8('0x1a')]){delete _0x276199[_0xc1b8('0x1a')];}_0x1c096f[_0xc1b8('0xd')](_0x115fa3)[_0xc1b8('0x1b')](_0x276199);};}function maskClientSecret(_0x31d9f9){return _[_0xc1b8('0x1c')](_0x31d9f9[_0xc1b8('0x1d')](0x0,0x3),0x14,'*');}exports['index']=function(_0x4d2556,_0x5794ff){var _0x170f80={},_0x596428={},_0x1678c5={'count':0x0,'rows':[]};var _0x5beae5=_[_0xc1b8('0x1e')](db[_0xc1b8('0x1f')]['rawAttributes'],function(_0x3a23de){return{'name':_0x3a23de[_0xc1b8('0x20')],'type':_0x3a23de[_0xc1b8('0x21')][_0xc1b8('0x22')]};});_0x596428[_0xc1b8('0x23')]=_['map'](_0x5beae5,_0xc1b8('0x1a'));_0x596428[_0xc1b8('0x24')]=_[_0xc1b8('0x25')](_0x4d2556[_0xc1b8('0x24')]);_0x596428[_0xc1b8('0x26')]=_[_0xc1b8('0x27')](_0x596428[_0xc1b8('0x23')],_0x596428['query']);_0x170f80[_0xc1b8('0x28')]=_[_0xc1b8('0x27')](_0x596428[_0xc1b8('0x23')],qs['fields'](_0x4d2556['query'][_0xc1b8('0x29')]));_0x170f80[_0xc1b8('0x28')]=_0x170f80[_0xc1b8('0x28')]['length']?_0x170f80['attributes']:_0x596428['model'];if(!_0x4d2556['query'][_0xc1b8('0x2a')](_0xc1b8('0x2b'))){_0x170f80['limit']=qs[_0xc1b8('0x10')](_0x4d2556[_0xc1b8('0x24')]['limit']);_0x170f80[_0xc1b8('0x13')]=qs[_0xc1b8('0x13')](_0x4d2556['query'][_0xc1b8('0x13')]);}_0x170f80[_0xc1b8('0x2c')]=qs[_0xc1b8('0x2d')](_0x4d2556[_0xc1b8('0x24')][_0xc1b8('0x2d')]);_0x170f80[_0xc1b8('0x2e')]=qs[_0xc1b8('0x26')](_['pick'](_0x4d2556[_0xc1b8('0x24')],_0x596428[_0xc1b8('0x26')]),_0x5beae5);if(_0x4d2556[_0xc1b8('0x24')]['filter']){_0x170f80[_0xc1b8('0x2e')]=_[_0xc1b8('0x2f')](_0x170f80[_0xc1b8('0x2e')],{'$or':_[_0xc1b8('0x1e')](_0x5beae5,function(_0x58c81e){if(_0x58c81e[_0xc1b8('0x21')]!==_0xc1b8('0x30')){var _0x5e9b98={};_0x5e9b98[_0x58c81e[_0xc1b8('0x1a')]]={'$like':'%'+_0x4d2556[_0xc1b8('0x24')][_0xc1b8('0x31')]+'%'};return _0x5e9b98;}})});}_0x170f80=_[_0xc1b8('0x2f')]({},_0x170f80,_0x4d2556[_0xc1b8('0x32')]);var _0x21797f={'where':_0x170f80[_0xc1b8('0x2e')]};return db[_0xc1b8('0x1f')][_0xc1b8('0x12')](_0x21797f)[_0xc1b8('0x16')](function(_0x494fd8){_0x1678c5['count']=_0x494fd8;if(_0x4d2556['query'][_0xc1b8('0x33')]){_0x170f80[_0xc1b8('0x34')]=[{'all':!![]}];}return db[_0xc1b8('0x1f')]['findAll'](_0x170f80);})[_0xc1b8('0x16')](function(_0x4d67f4){_0x1678c5[_0xc1b8('0x35')]=_[_0xc1b8('0x1e')](_0x4d67f4,function(_0x50af9c){if(_0x50af9c[_0xc1b8('0x36')]==='MicrosoftAzure'){var _0x441ff=encryptor[_0xc1b8('0x37')](_0x50af9c['data3']);_0x50af9c['data3']=maskClientSecret(_0x441ff);}return _0x50af9c;});return _0x1678c5;})[_0xc1b8('0x16')](respondWithFilteredResult(_0x5794ff,_0x170f80))[_0xc1b8('0x38')](handleError(_0x5794ff,null));};exports[_0xc1b8('0x39')]=function(_0x5df23d,_0x1fcfcb){var _0x1e0339={'raw':!![],'where':{'id':_0x5df23d['params']['id']}},_0x3e1527={};_0x3e1527[_0xc1b8('0x23')]=_[_0xc1b8('0x25')](db['CloudProvider'][_0xc1b8('0x3a')]);_0x3e1527['query']=_[_0xc1b8('0x25')](_0x5df23d[_0xc1b8('0x24')]);_0x3e1527[_0xc1b8('0x26')]=_[_0xc1b8('0x27')](_0x3e1527[_0xc1b8('0x23')],_0x3e1527['query']);_0x1e0339[_0xc1b8('0x28')]=_[_0xc1b8('0x27')](_0x3e1527[_0xc1b8('0x23')],qs[_0xc1b8('0x29')](_0x5df23d['query'][_0xc1b8('0x29')]));_0x1e0339['attributes']=_0x1e0339[_0xc1b8('0x28')]['length']?_0x1e0339[_0xc1b8('0x28')]:_0x3e1527[_0xc1b8('0x23')];if(_0x5df23d['query']['includeAll']){_0x1e0339[_0xc1b8('0x34')]=[{'all':!![]}];}_0x1e0339=_[_0xc1b8('0x2f')]({},_0x1e0339,_0x5df23d['options']);return db[_0xc1b8('0x1f')][_0xc1b8('0x3b')](_0x1e0339)[_0xc1b8('0x16')](handleEntityNotFound(_0x1fcfcb,null))[_0xc1b8('0x16')](function(_0x542f56){if(_0x542f56[_0xc1b8('0x36')]===_0xc1b8('0x3c')){var _0x19ddd4=encryptor[_0xc1b8('0x37')](_0x542f56[_0xc1b8('0x3d')]);_0x542f56[_0xc1b8('0x3d')]=maskClientSecret(_0x19ddd4);}return _0x542f56;})[_0xc1b8('0x16')](respondWithResult(_0x1fcfcb,null))['catch'](handleError(_0x1fcfcb,null));};exports[_0xc1b8('0x3e')]=function(_0x4e0925,_0x1908e5){if(!_0x4e0925['body'][_0xc1b8('0x1a')])throw new Error(_0xc1b8('0x3f'));if(!_0x4e0925['body'][_0xc1b8('0x36')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x5cbdb5=db[_0xc1b8('0x1f')]['rawAttributes'][_0xc1b8('0x36')][_0xc1b8('0x40')];if(!_0x5cbdb5[_0xc1b8('0x41')](_0x4e0925[_0xc1b8('0x42')][_0xc1b8('0x36')]))throw new Error(_0xc1b8('0x43')+_0x5cbdb5[_0xc1b8('0x44')](',\x20'));if(_0x4e0925['body']['service']==='MicrosoftAzure'&&_0x4e0925[_0xc1b8('0x42')][_0xc1b8('0x3d')]){_0x4e0925[_0xc1b8('0x42')][_0xc1b8('0x3d')]=encryptor[_0xc1b8('0x45')](_0x4e0925[_0xc1b8('0x42')][_0xc1b8('0x3d')]);}return db[_0xc1b8('0x1f')]['create'](_0x4e0925['body'],{})[_0xc1b8('0x16')](respondWithResult(_0x1908e5,0xc9))[_0xc1b8('0x38')](handleError(_0x1908e5,null));};exports['update']=function(_0x2b7dae,_0x143f68){if(_0x2b7dae[_0xc1b8('0x42')]['id']){delete _0x2b7dae[_0xc1b8('0x42')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x2b7dae[_0xc1b8('0x46')]['id']}})['then'](handleEntityNotFound(_0x143f68,null))['then'](function(_0x452aa1){if(_0x452aa1[_0xc1b8('0x36')]===_0xc1b8('0x3c')&&_0x2b7dae['body']['data3']){_0x2b7dae[_0xc1b8('0x42')]['data3']=encryptor['encryptString'](_0x2b7dae[_0xc1b8('0x42')]['data3']);}return _0x452aa1;})[_0xc1b8('0x16')](saveUpdates(_0x2b7dae[_0xc1b8('0x42')],null))[_0xc1b8('0x16')](respondWithResult(_0x143f68,null))[_0xc1b8('0x38')](handleError(_0x143f68,null));};exports[_0xc1b8('0x17')]=function(_0x2d1435,_0x1f6a8d){return db['CloudProvider'][_0xc1b8('0x3b')]({'where':{'id':_0x2d1435[_0xc1b8('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f6a8d,null))[_0xc1b8('0x16')](removeEntity(_0x1f6a8d,null))[_0xc1b8('0x38')](handleError(_0x1f6a8d,null));};exports[_0xc1b8('0x47')]=function(_0x2d7dfe,_0x5ca603){return db[_0xc1b8('0x1f')]['findOne']({'where':{'id':_0x2d7dfe['params']['id']},'raw':!![]})[_0xc1b8('0x16')](function(_0x384ae3){if(!_0x384ae3)return _0x5ca603[_0xc1b8('0xc')](0x194);return{'url':oauth[_0xc1b8('0x48')](_0x384ae3,_0x2d7dfe[_0xc1b8('0x49')]['id'])};})['then'](respondWithResult(_0x5ca603,null))['catch'](handleError(_0x5ca603,null));};exports[_0xc1b8('0x4a')]=function(_0x75f3d6,_0x379e5d){var _0x3ffb9a=_0x75f3d6[_0xc1b8('0x42')];var _0x132fe7;var _0x2c85d1;if(_0x3ffb9a[_0xc1b8('0x18')])throw _0x3ffb9a;redis['get'](_0x3ffb9a['state'])[_0xc1b8('0x16')](function(_0x500fe){if(!_0x500fe)throw new Error(_0xc1b8('0x4b'));_0x132fe7=JSON[_0xc1b8('0x4c')](_0x500fe);var _0x44cc8c=Buffer['from'](_0x3ffb9a['state'],'base64')['toString'](_0xc1b8('0x4d'));_0x2c85d1=JSON[_0xc1b8('0x4c')](_0x44cc8c);if(!oauth[_0xc1b8('0x4e')](_0x3ffb9a['id_token'],_0x132fe7[_0xc1b8('0x4f')]))throw new Error(_0xc1b8('0x50'));redis[_0xc1b8('0x51')](_0x3ffb9a[_0xc1b8('0x52')]);return oauth[_0xc1b8('0x53')](_0x3ffb9a[_0xc1b8('0x54')],_0x132fe7);})['then'](function(_0x2b4703){_0x132fe7[_0xc1b8('0x55')]=_0x2b4703[_0xc1b8('0x56')];_0x132fe7[_0xc1b8('0x57')]=_0x2b4703[_0xc1b8('0x58')];return db[_0xc1b8('0x1f')][_0xc1b8('0x15')]({'data5':_0x132fe7[_0xc1b8('0x55')],'data6':_0x132fe7['data6']},{'where':{'id':_0x132fe7['id']}});})[_0xc1b8('0x16')](function(){oauth[_0xc1b8('0x59')](_0x132fe7);socket[_0xc1b8('0x5a')](_0xc1b8('0x5b'),{'id':_0x2c85d1['id']});return;})['then'](respondWithStatusCode(_0x379e5d,null))[_0xc1b8('0x38')](function(_0x354ca1){if(_0x2c85d1){socket[_0xc1b8('0x5a')]('microsoftAuthorization:error',{'id':_0x2c85d1['id']});}if(!_0x132fe7){logger[_0xc1b8('0x18')](_0xc1b8('0x5c'),_0x354ca1);return _0x379e5d[_0xc1b8('0xd')](0x1f4)[_0xc1b8('0x1b')](_0x354ca1[_0xc1b8('0x5d')]);}logger[_0xc1b8('0x18')](_0xc1b8('0x5e'),_0x132fe7['id'],JSON[_0xc1b8('0x5f')](_0x354ca1));});}; \ No newline at end of file +var _0xf0f6=['data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','destroy','name','padEnd','slice','CloudProvider','fieldName','type','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','merge','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','length','options','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','error','state','Invalid\x20state\x20parameter','parse','from','toString','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code'];(function(_0x35c2fc,_0xabea37){var _0x4727fd=function(_0x4eccfe){while(--_0x4eccfe){_0x35c2fc['push'](_0x35c2fc['shift']());}};_0x4727fd(++_0xabea37);}(_0xf0f6,0x1db));var _0x6f0f=function(_0x2685da,_0x3c928b){_0x2685da=_0x2685da-0x0;var _0x3b43f5=_0xf0f6[_0x2685da];return _0x3b43f5;};'use strict';var _=require(_0x6f0f('0x0'));var Redis=require(_0x6f0f('0x1'));var qs=require(_0x6f0f('0x2'));var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x6f0f('0x3'));var db=require(_0x6f0f('0x4'))['db'];var oauth=require(_0x6f0f('0x5'));config[_0x6f0f('0x6')]=_[_0x6f0f('0x7')](config[_0x6f0f('0x6')],{'host':_0x6f0f('0x8'),'port':0x18eb});var socket=require(_0x6f0f('0x9'))(new Redis(config[_0x6f0f('0x6')]));var redis=new Redis(config[_0x6f0f('0x6')]);function respondWithStatusCode(_0x54648a,_0x1e0fae){_0x1e0fae=_0x1e0fae||0xcc;return function(_0x33b0ab){if(_0x33b0ab){return _0x54648a[_0x6f0f('0xa')](_0x1e0fae);}return _0x54648a['status'](_0x1e0fae)[_0x6f0f('0xb')]();};}function respondWithResult(_0x177cb5,_0xfbf9ec){_0xfbf9ec=_0xfbf9ec||0xc8;return function(_0x291767){if(_0x291767){return _0x177cb5[_0x6f0f('0xc')](_0xfbf9ec)[_0x6f0f('0xd')](_0x291767);}};}function respondWithFilteredResult(_0x2b4e07,_0x409680){return function(_0x6010fa){if(_0x6010fa){var _0x3e41d6=typeof _0x409680[_0x6f0f('0xe')]==='undefined'&&typeof _0x409680['limit']===_0x6f0f('0xf');var _0x2c7c9b=_0x6010fa['count'];var _0x3edcbd=_0x3e41d6?0x0:_0x409680[_0x6f0f('0xe')];var _0x38b5fb=_0x3e41d6?_0x6010fa[_0x6f0f('0x10')]:_0x409680['offset']+_0x409680[_0x6f0f('0x11')];var _0x278ca3;if(_0x38b5fb>=_0x2c7c9b){_0x38b5fb=_0x2c7c9b;_0x278ca3=0xc8;}else{_0x278ca3=0xce;}_0x2b4e07[_0x6f0f('0xc')](_0x278ca3);return _0x2b4e07['set'](_0x6f0f('0x12'),_0x3edcbd+'-'+_0x38b5fb+'/'+_0x2c7c9b)[_0x6f0f('0xd')](_0x6010fa);}return null;};}function saveUpdates(_0x4ac85c){return function(_0x1d00c2){if(_0x1d00c2){return _0x1d00c2[_0x6f0f('0x13')](_0x4ac85c)[_0x6f0f('0x14')](function(_0x31b890){return _0x31b890;});}return null;};}function removeEntity(_0x20c560){return function(_0x5caa97){if(_0x5caa97){return _0x5caa97[_0x6f0f('0x15')]()[_0x6f0f('0x14')](function(){_0x20c560[_0x6f0f('0xc')](0xcc)[_0x6f0f('0xb')]();});}};}function handleEntityNotFound(_0x39f20f){return function(_0x1e1ce4){if(!_0x1e1ce4){_0x39f20f[_0x6f0f('0xa')](0x194);}return _0x1e1ce4;};}function handleError(_0x4dbc2f,_0x13ad64){_0x13ad64=_0x13ad64||0x1f4;return function(_0x53974a){logger['error'](_0x53974a['stack']);if(_0x53974a[_0x6f0f('0x16')]){delete _0x53974a['name'];}_0x4dbc2f['status'](_0x13ad64)['send'](_0x53974a);};}function maskClientSecret(_0x2614fe){return _[_0x6f0f('0x17')](_0x2614fe[_0x6f0f('0x18')](0x0,0x3),0x14,'*');}exports['index']=function(_0x36666d,_0x4df79){var _0x160a4e={},_0x4e327f={},_0x497f4f={'count':0x0,'rows':[]};var _0x34dac4=_['map'](db[_0x6f0f('0x19')]['rawAttributes'],function(_0xb1d805){return{'name':_0xb1d805[_0x6f0f('0x1a')],'type':_0xb1d805[_0x6f0f('0x1b')]['key']};});_0x4e327f[_0x6f0f('0x1c')]=_[_0x6f0f('0x1d')](_0x34dac4,'name');_0x4e327f['query']=_[_0x6f0f('0x1e')](_0x36666d['query']);_0x4e327f['filters']=_[_0x6f0f('0x1f')](_0x4e327f[_0x6f0f('0x1c')],_0x4e327f[_0x6f0f('0x20')]);_0x160a4e[_0x6f0f('0x21')]=_['intersection'](_0x4e327f[_0x6f0f('0x1c')],qs[_0x6f0f('0x22')](_0x36666d[_0x6f0f('0x20')]['fields']));_0x160a4e['attributes']=_0x160a4e['attributes']['length']?_0x160a4e['attributes']:_0x4e327f[_0x6f0f('0x1c')];if(!_0x36666d['query'][_0x6f0f('0x23')](_0x6f0f('0x24'))){_0x160a4e[_0x6f0f('0x11')]=qs['limit'](_0x36666d[_0x6f0f('0x20')]['limit']);_0x160a4e[_0x6f0f('0xe')]=qs[_0x6f0f('0xe')](_0x36666d['query'][_0x6f0f('0xe')]);}_0x160a4e[_0x6f0f('0x25')]=qs['sort'](_0x36666d[_0x6f0f('0x20')][_0x6f0f('0x26')]);_0x160a4e[_0x6f0f('0x27')]=qs['filters'](_['pick'](_0x36666d[_0x6f0f('0x20')],_0x4e327f[_0x6f0f('0x28')]),_0x34dac4);if(_0x36666d['query']['filter']){_0x160a4e['where']=_['merge'](_0x160a4e[_0x6f0f('0x27')],{'$or':_[_0x6f0f('0x1d')](_0x34dac4,function(_0x4ccb42){if(_0x4ccb42['type']!==_0x6f0f('0x29')){var _0x2256c8={};_0x2256c8[_0x4ccb42[_0x6f0f('0x16')]]={'$like':'%'+_0x36666d[_0x6f0f('0x20')]['filter']+'%'};return _0x2256c8;}})});}_0x160a4e=_[_0x6f0f('0x2a')]({},_0x160a4e,_0x36666d['options']);var _0x3ba548={'where':_0x160a4e[_0x6f0f('0x27')]};return db[_0x6f0f('0x19')][_0x6f0f('0x10')](_0x3ba548)[_0x6f0f('0x14')](function(_0x31f981){_0x497f4f[_0x6f0f('0x10')]=_0x31f981;if(_0x36666d['query'][_0x6f0f('0x2b')]){_0x160a4e[_0x6f0f('0x2c')]=[{'all':!![]}];}return db[_0x6f0f('0x19')][_0x6f0f('0x2d')](_0x160a4e);})[_0x6f0f('0x14')](function(_0x23f51a){_0x497f4f[_0x6f0f('0x2e')]=_['map'](_0x23f51a,function(_0x57325e){if(_0x57325e[_0x6f0f('0x2f')]===_0x6f0f('0x30')){var _0x21e5de=encryptor[_0x6f0f('0x31')](_0x57325e['data3']);_0x57325e[_0x6f0f('0x32')]=maskClientSecret(_0x21e5de);}return _0x57325e;});return _0x497f4f;})[_0x6f0f('0x14')](respondWithFilteredResult(_0x4df79,_0x160a4e))[_0x6f0f('0x33')](handleError(_0x4df79,null));};exports[_0x6f0f('0x34')]=function(_0x33ae08,_0x2f2bff){var _0x4080d2={'raw':!![],'where':{'id':_0x33ae08[_0x6f0f('0x35')]['id']}},_0x12e19d={};_0x12e19d[_0x6f0f('0x1c')]=_['keys'](db[_0x6f0f('0x19')][_0x6f0f('0x36')]);_0x12e19d['query']=_[_0x6f0f('0x1e')](_0x33ae08[_0x6f0f('0x20')]);_0x12e19d['filters']=_[_0x6f0f('0x1f')](_0x12e19d['model'],_0x12e19d[_0x6f0f('0x20')]);_0x4080d2[_0x6f0f('0x21')]=_[_0x6f0f('0x1f')](_0x12e19d['model'],qs[_0x6f0f('0x22')](_0x33ae08[_0x6f0f('0x20')][_0x6f0f('0x22')]));_0x4080d2['attributes']=_0x4080d2[_0x6f0f('0x21')][_0x6f0f('0x37')]?_0x4080d2[_0x6f0f('0x21')]:_0x12e19d[_0x6f0f('0x1c')];if(_0x33ae08[_0x6f0f('0x20')][_0x6f0f('0x2b')]){_0x4080d2[_0x6f0f('0x2c')]=[{'all':!![]}];}_0x4080d2=_[_0x6f0f('0x2a')]({},_0x4080d2,_0x33ae08[_0x6f0f('0x38')]);return db[_0x6f0f('0x19')][_0x6f0f('0x39')](_0x4080d2)['then'](handleEntityNotFound(_0x2f2bff,null))[_0x6f0f('0x14')](function(_0x5e386a){if(_0x5e386a[_0x6f0f('0x2f')]===_0x6f0f('0x30')){var _0x2246d4=encryptor['decryptString'](_0x5e386a[_0x6f0f('0x32')]);_0x5e386a[_0x6f0f('0x32')]=maskClientSecret(_0x2246d4);}return _0x5e386a;})[_0x6f0f('0x14')](respondWithResult(_0x2f2bff,null))[_0x6f0f('0x33')](handleError(_0x2f2bff,null));};exports[_0x6f0f('0x3a')]=function(_0x1c11e3,_0x3ae2d1){if(!_0x1c11e3[_0x6f0f('0x3b')][_0x6f0f('0x16')])throw new Error(_0x6f0f('0x3c'));if(!_0x1c11e3['body']['service'])throw new Error(_0x6f0f('0x3d'));var _0x504d05=db[_0x6f0f('0x19')][_0x6f0f('0x36')]['service'][_0x6f0f('0x3e')];if(!_0x504d05[_0x6f0f('0x3f')](_0x1c11e3['body'][_0x6f0f('0x2f')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x504d05[_0x6f0f('0x40')](',\x20'));if(_0x1c11e3['body'][_0x6f0f('0x2f')]===_0x6f0f('0x30')&&_0x1c11e3['body']['data3']){_0x1c11e3[_0x6f0f('0x3b')][_0x6f0f('0x32')]=encryptor['encryptString'](_0x1c11e3[_0x6f0f('0x3b')]['data3']);}return db[_0x6f0f('0x19')][_0x6f0f('0x3a')](_0x1c11e3[_0x6f0f('0x3b')],{})[_0x6f0f('0x14')](respondWithResult(_0x3ae2d1,0xc9))[_0x6f0f('0x33')](handleError(_0x3ae2d1,null));};exports['update']=function(_0x2cc512,_0x56f4f8){if(_0x2cc512['body']['id']){delete _0x2cc512[_0x6f0f('0x3b')]['id'];}return db['CloudProvider'][_0x6f0f('0x39')]({'where':{'id':_0x2cc512[_0x6f0f('0x35')]['id']}})[_0x6f0f('0x14')](handleEntityNotFound(_0x56f4f8,null))[_0x6f0f('0x14')](function(_0x39640f){if(_0x39640f['service']==='MicrosoftAzure'&&_0x2cc512['body'][_0x6f0f('0x32')]){_0x2cc512['body'][_0x6f0f('0x32')]=encryptor[_0x6f0f('0x41')](_0x2cc512[_0x6f0f('0x3b')][_0x6f0f('0x32')]);}return _0x39640f;})[_0x6f0f('0x14')](saveUpdates(_0x2cc512[_0x6f0f('0x3b')],null))[_0x6f0f('0x14')](respondWithResult(_0x56f4f8,null))[_0x6f0f('0x33')](handleError(_0x56f4f8,null));};exports[_0x6f0f('0x15')]=function(_0x5d5705,_0x4ca897){return db[_0x6f0f('0x19')][_0x6f0f('0x39')]({'where':{'id':_0x5d5705[_0x6f0f('0x35')]['id']}})[_0x6f0f('0x14')](handleEntityNotFound(_0x4ca897,null))['then'](removeEntity(_0x4ca897,null))['catch'](handleError(_0x4ca897,null));};exports[_0x6f0f('0x42')]=function(_0x3d2daf,_0x25ee49){return db[_0x6f0f('0x19')][_0x6f0f('0x43')]({'where':{'id':_0x3d2daf['params']['id']},'raw':!![]})['then'](function(_0x5abf2f){if(!_0x5abf2f)return _0x25ee49[_0x6f0f('0xa')](0x194);return{'url':oauth[_0x6f0f('0x44')](_0x5abf2f,_0x3d2daf['user']['id'])};})[_0x6f0f('0x14')](respondWithResult(_0x25ee49,null))[_0x6f0f('0x33')](handleError(_0x25ee49,null));};exports[_0x6f0f('0x45')]=function(_0x2230c4,_0x2a561a){var _0x631492=_0x2230c4[_0x6f0f('0x3b')];var _0x305c48;var _0x518739;if(_0x631492[_0x6f0f('0x46')])throw _0x631492;redis['get'](_0x631492[_0x6f0f('0x47')])[_0x6f0f('0x14')](function(_0x37cac8){if(!_0x37cac8)throw new Error(_0x6f0f('0x48'));_0x305c48=JSON[_0x6f0f('0x49')](_0x37cac8);var _0x5db4ad=Buffer[_0x6f0f('0x4a')](_0x631492['state'],'base64')[_0x6f0f('0x4b')]('ascii');_0x518739=JSON[_0x6f0f('0x49')](_0x5db4ad);if(!oauth[_0x6f0f('0x4c')](_0x631492[_0x6f0f('0x4d')],_0x305c48[_0x6f0f('0x4e')]))throw new Error(_0x6f0f('0x4f'));redis[_0x6f0f('0x50')](_0x631492[_0x6f0f('0x47')]);return oauth[_0x6f0f('0x51')](_0x631492[_0x6f0f('0x52')],_0x305c48);})[_0x6f0f('0x14')](function(_0x160301){_0x305c48[_0x6f0f('0x53')]=_0x160301[_0x6f0f('0x54')];_0x305c48[_0x6f0f('0x55')]=_0x160301[_0x6f0f('0x56')];return db[_0x6f0f('0x19')][_0x6f0f('0x13')]({'data5':_0x305c48[_0x6f0f('0x53')],'data6':_0x305c48[_0x6f0f('0x55')]},{'where':{'id':_0x305c48['id']}});})['then'](function(){oauth[_0x6f0f('0x57')](_0x305c48);socket[_0x6f0f('0x58')]('microsoftAuthorization:success',{'id':_0x518739['id']});return;})['then'](respondWithStatusCode(_0x2a561a,null))[_0x6f0f('0x33')](function(_0x24ba77){if(_0x518739){socket[_0x6f0f('0x58')](_0x6f0f('0x59'),{'id':_0x518739['id']});}if(!_0x305c48){logger[_0x6f0f('0x46')]('Invalid\x20authentication\x20state\x20parameter',_0x24ba77);return _0x2a561a[_0x6f0f('0xc')](0x1f4)['send'](_0x24ba77[_0x6f0f('0x5a')]);}logger[_0x6f0f('0x46')](_0x6f0f('0x5b'),_0x305c48['id'],JSON[_0x6f0f('0x5c')](_0x24ba77));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b0774f7..ba92521 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 _0x0ade=['define','cloud_providers','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./cloudProvider.attributes','exports'];(function(_0x220b09,_0x2cd7f6){var _0x50b125=function(_0x7eff01){while(--_0x7eff01){_0x220b09['push'](_0x220b09['shift']());}};_0x50b125(++_0x2cd7f6);}(_0x0ade,0x178));var _0xe0ad=function(_0x192ff1,_0x410b3){_0x192ff1=_0x192ff1-0x0;var _0x217b14=_0x0ade[_0x192ff1];return _0x217b14;};'use strict';var _=require(_0xe0ad('0x0'));var util=require(_0xe0ad('0x1'));var logger=require(_0xe0ad('0x2'))('api');var moment=require(_0xe0ad('0x3'));var BPromise=require(_0xe0ad('0x4'));var rp=require(_0xe0ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe0ad('0x6'));var attributes=require(_0xe0ad('0x7'));module[_0xe0ad('0x8')]=function(_0x12ef21,_0x34832a){return _0x12ef21[_0xe0ad('0x9')]('CloudProvider',attributes,{'tableName':_0xe0ad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e98=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','define'];(function(_0x6d8384,_0x31ccaf){var _0x59dac7=function(_0x442093){while(--_0x442093){_0x6d8384['push'](_0x6d8384['shift']());}};_0x59dac7(++_0x31ccaf);}(_0x2e98,0x8c));var _0x82e9=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2e98[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x82e9('0x0'))(_0x82e9('0x1'));var moment=require(_0x82e9('0x2'));var BPromise=require(_0x82e9('0x3'));var rp=require(_0x82e9('0x4'));var fs=require('fs');var path=require(_0x82e9('0x5'));var rimraf=require('rimraf');var config=require(_0x82e9('0x6'));var attributes=require(_0x82e9('0x7'));module[_0x82e9('0x8')]=function(_0x37e969,_0x7249e2){return _0x37e969[_0x82e9('0x9')]('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index c7f0c08..29b5e0d 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 _0xff49=['data2','code','id_token','stringify','toString','base64','randomBytes','hex','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','login','key','value','set','decode','aud','audience','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','decryptString','data3','POST','{TENANT_ID}','access_token','data5','data6','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','all','catch','inspect','exports','lodash','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','offline_access','/authorize','/token','map','type','Dynamics365','push','join','Outlook365','data7','/.default','replace'];(function(_0x4bdda3,_0x25f960){var _0x3f8722=function(_0x341120){while(--_0x341120){_0x4bdda3['push'](_0x4bdda3['shift']());}};_0x3f8722(++_0x25f960);}(_0xff49,0x167));var _0x9ff4=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0xff49[_0x19d24c];return _0x2fae8d;};'use strict';var _=require(_0x9ff4('0x0'));var crypto=require('crypto');var jwt=require('jsonwebtoken');var moment=require('moment');var Redis=require(_0x9ff4('0x1'));var rp=require(_0x9ff4('0x2'));var util=require(_0x9ff4('0x3'));var encryptor=require(_0x9ff4('0x4'));var config=require(_0x9ff4('0x5'));var logger=require(_0x9ff4('0x6'))(_0x9ff4('0x7'));var schedule=require(_0x9ff4('0x8'));var db=require(_0x9ff4('0x9'))['db'];config[_0x9ff4('0xa')]=_['defaults'](config[_0x9ff4('0xa')],{'host':_0x9ff4('0xb'),'port':0x18eb});var redis=new Redis(config[_0x9ff4('0xa')]);var MICROSOFT_AUTH_URL=_0x9ff4('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x9ff4('0xd'),_0x9ff4('0xe'),'offline_access',_0x9ff4('0xf'),_0x9ff4('0x10'),_0x9ff4('0x11')],'Dynamics365':[_0x9ff4('0x12'),_0x9ff4('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0x9ff4('0x14');var MICROSOFT_TOKEN_ENDPOINT=_0x9ff4('0x15');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x15ddfa){var _0x1d7380=_[_0x9ff4('0x16')](AZURE_AUTH_SCOPES[_0x15ddfa[_0x9ff4('0x17')]]);if(_0x15ddfa['type']===_0x9ff4('0x18'))_0x1d7380[_0x9ff4('0x19')](_0x15ddfa['data7']+'/.default');return _0x1d7380[_0x9ff4('0x1a')]('\x20');}function getAccessTokenScope(_0x236e93){if(_0x236e93[_0x9ff4('0x17')]===_0x9ff4('0x1b'))return _0x9ff4('0xf');if(_0x236e93['type']===_0x9ff4('0x18'))return _0x236e93[_0x9ff4('0x1c')]+_0x9ff4('0x1d');}function generateMicrosoftAuthorizationUrl(_0x5313a2,_0x4383d9){var _0x46cd52=MICROSOFT_AUTH_URL[_0x9ff4('0x1e')]('{TENANT_ID}',_0x5313a2[_0x9ff4('0x1f')]);var _0x50c94e=[_0x9ff4('0x20'),_0x9ff4('0x21')];var _0x1f7d80=Buffer['from'](JSON[_0x9ff4('0x22')]({'id':_0x4383d9}))[_0x9ff4('0x23')](_0x9ff4('0x24'));var _0x59687b=crypto[_0x9ff4('0x25')](0x10)[_0x9ff4('0x23')](_0x9ff4('0x26'));var _0x11e9d4=getAuthorizationScopes(_0x5313a2);var _0x7bcf6=[{'key':'client_id','value':_0x5313a2[_0x9ff4('0x27')]},{'key':_0x9ff4('0x28'),'value':encodeURIComponent(_0x50c94e[_0x9ff4('0x1a')]('\x20'))},{'key':_0x9ff4('0x29'),'value':_0x5313a2[_0x9ff4('0x2a')]},{'key':_0x9ff4('0x2b'),'value':_0x9ff4('0x2c')},{'key':_0x9ff4('0x2d'),'value':encodeURIComponent(_0x11e9d4)},{'key':_0x9ff4('0x2e'),'value':_0x1f7d80},{'key':_0x9ff4('0x2f'),'value':_0x59687b},{'key':'prompt','value':_0x9ff4('0x30')}];var _0xd0b760=_0x46cd52+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x9ff4('0x16')](_0x7bcf6,function(_0x3f0973){return _0x3f0973[_0x9ff4('0x31')]+'='+_0x3f0973[_0x9ff4('0x32')];})[_0x9ff4('0x1a')]('&');_0x5313a2['oauth2Claims']={'issuer':_0x46cd52[_0x9ff4('0x1e')]('oauth2/',''),'audience':_0x5313a2[_0x9ff4('0x27')],'state':_0x1f7d80,'nonce':_0x59687b};redis[_0x9ff4('0x33')](_0x1f7d80,JSON[_0x9ff4('0x22')](_0x5313a2));return _0xd0b760;}function isValidIdToken(_0x40bd1b,_0x1f92e7){try{var _0x2c799c=jwt[_0x9ff4('0x34')](_0x40bd1b,{'complete':!![]});var _0x4beb17=_0x2c799c['payload'];if(_0x4beb17['iss']!==_0x1f92e7['issuer'])return![];if(_0x4beb17[_0x9ff4('0x35')]!==_0x1f92e7[_0x9ff4('0x36')])return![];if(_0x4beb17['nonce']!==_0x1f92e7['nonce'])return![];if(moment()[_0x9ff4('0x37')](moment[_0x9ff4('0x38')](_0x4beb17[_0x9ff4('0x39')])))return![];return!![];}catch(_0xb632f3){throw _0xb632f3;}}function refreshOauth2MicrosoftAccessToken(_0x228b82){return Promise[_0x9ff4('0x3a')]()[_0x9ff4('0x3b')](function(){if(_0x228b82['data3'])return _0x228b82;return db[_0x9ff4('0x3c')][_0x9ff4('0x3d')]({'where':{'id':_0x228b82['id']},'raw':!![]});})[_0x9ff4('0x3b')](function(_0x171f07){var _0x30d0e8={'grant_type':_0x9ff4('0x3e'),'refresh_token':_0x171f07['data6'],'scope':getAccessTokenScope(_0x171f07),'redirect_uri':_0x171f07[_0x9ff4('0x2a')],'client_id':_0x171f07[_0x9ff4('0x27')],'client_secret':encryptor[_0x9ff4('0x3f')](_0x171f07[_0x9ff4('0x40')])};var _0x17eebf={'method':_0x9ff4('0x41'),'uri':MICROSOFT_AUTH_URL[_0x9ff4('0x1e')](_0x9ff4('0x42'),_0x171f07[_0x9ff4('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x30d0e8,'json':!![]};return rp(_0x17eebf);})[_0x9ff4('0x3b')](function(_0x2cca98){_0x228b82['data5']=_0x2cca98[_0x9ff4('0x43')];_0x228b82['data6']=_0x2cca98['refresh_token'];return db[_0x9ff4('0x3c')]['update']({'data5':_0x228b82[_0x9ff4('0x44')],'data6':_0x228b82[_0x9ff4('0x45')]},{'where':{'id':_0x228b82['id']}});})[_0x9ff4('0x3b')](function(){return _0x228b82;})['catch'](function(_0x354c1b){logger[_0x9ff4('0x46')](_0x9ff4('0x47'),_0x228b82['id'],_0x354c1b);});}function getOauth2MicrosoftAccessToken(_0x1804f8,_0x443cd5){var _0x1a3783={'grant_type':_0x9ff4('0x48'),'code':_0x1804f8,'scope':getAccessTokenScope(_0x443cd5),'redirect_uri':_0x443cd5['data4'],'client_id':_0x443cd5[_0x9ff4('0x27')],'client_secret':encryptor[_0x9ff4('0x3f')](_0x443cd5['data3'])};var _0x5b769b={'method':_0x9ff4('0x41'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x443cd5['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1a3783,'json':!![]};return rp(_0x5b769b);}function startRefreshInterval(_0x684251){var _0x52cd8f=schedule[_0x9ff4('0x49')];if(_0x52cd8f[_0x684251['id']])clearInterval(_0x52cd8f[_0x684251['id']]);_0x52cd8f[_0x684251['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x684251['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x9ff4('0x49')]=_0x52cd8f;}function startAllRefreshIntervals(){return db[_0x9ff4('0x3c')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9ff4('0x3b')](function(_0x1b69c8){var _0x2c37e2=_0x1b69c8[_0x9ff4('0x16')](function(_0x28de7e){return refreshOauth2MicrosoftAccessToken(_0x28de7e)[_0x9ff4('0x3b')](function(_0x50bd47){startRefreshInterval(_0x50bd47);});});return Promise[_0x9ff4('0x4a')](_0x2c37e2);})[_0x9ff4('0x4b')](function(_0x246b87){var _0x39ab2d=_0x246b87?util[_0x9ff4('0x4c')](_0x246b87,{'showHidden':![],'depth':null}):'';logger[_0x9ff4('0x46')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x39ab2d);});}module[_0x9ff4('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x1663=['then','refresh_token','data6','POST','data5','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','data4','decryptString','intervals','findAll','all','inspect','error','jsonwebtoken','moment','request-promise','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','map','type','Dynamics365','push','/.default','join','Outlook365','data7','{TENANT_ID}','data2','code','id_token','from','stringify','toString','base64','randomBytes','data1','redirect_uri','response_mode','form_post','state','nonce','prompt','key','value','oauth2Claims','replace','oauth2/','set','iss','issuer','aud','audience','isAfter','unix','exp','resolve','data3','CloudProvider'];(function(_0x5020fa,_0x2c6b89){var _0x5f0706=function(_0x94da7b){while(--_0x94da7b){_0x5020fa['push'](_0x5020fa['shift']());}};_0x5f0706(++_0x2c6b89);}(_0x1663,0xa2));var _0x3166=function(_0x333151,_0x347994){_0x333151=_0x333151-0x0;var _0x52ead1=_0x1663[_0x333151];return _0x52ead1;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x3166('0x0'));var moment=require(_0x3166('0x1'));var Redis=require('ioredis');var rp=require(_0x3166('0x2'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require(_0x3166('0x3'));var logger=require(_0x3166('0x4'))(_0x3166('0x5'));var schedule=require(_0x3166('0x6'));var db=require(_0x3166('0x7'))['db'];config[_0x3166('0x8')]=_['defaults'](config[_0x3166('0x8')],{'host':_0x3166('0x9'),'port':0x18eb});var redis=new Redis(config[_0x3166('0x8')]);var MICROSOFT_AUTH_URL=_0x3166('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x3166('0xb'),'profile',_0x3166('0xc'),_0x3166('0xd'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x3166('0xe'),_0x3166('0xf')],'Dynamics365':[_0x3166('0xb'),_0x3166('0xd')]};var MICROSOFT_AUTH_ENDPOINT=_0x3166('0x10');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1cf199){var _0x46a4a2=_[_0x3166('0x11')](AZURE_AUTH_SCOPES[_0x1cf199[_0x3166('0x12')]]);if(_0x1cf199[_0x3166('0x12')]===_0x3166('0x13'))_0x46a4a2[_0x3166('0x14')](_0x1cf199['data7']+_0x3166('0x15'));return _0x46a4a2[_0x3166('0x16')]('\x20');}function getAccessTokenScope(_0x161c9b){if(_0x161c9b[_0x3166('0x12')]===_0x3166('0x17'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x161c9b['type']==='Dynamics365')return _0x161c9b[_0x3166('0x18')]+_0x3166('0x15');}function generateMicrosoftAuthorizationUrl(_0x2e1fed,_0x1fc373){var _0x17ba06=MICROSOFT_AUTH_URL['replace'](_0x3166('0x19'),_0x2e1fed[_0x3166('0x1a')]);var _0x41df46=[_0x3166('0x1b'),_0x3166('0x1c')];var _0x52a160=Buffer[_0x3166('0x1d')](JSON[_0x3166('0x1e')]({'id':_0x1fc373}))[_0x3166('0x1f')](_0x3166('0x20'));var _0x293e2e=crypto[_0x3166('0x21')](0x10)[_0x3166('0x1f')]('hex');var _0x1bc29c=getAuthorizationScopes(_0x2e1fed);var _0xcae2f8=[{'key':'client_id','value':_0x2e1fed[_0x3166('0x22')]},{'key':'response_type','value':encodeURIComponent(_0x41df46[_0x3166('0x16')]('\x20'))},{'key':_0x3166('0x23'),'value':_0x2e1fed['data4']},{'key':_0x3166('0x24'),'value':_0x3166('0x25')},{'key':'scope','value':encodeURIComponent(_0x1bc29c)},{'key':_0x3166('0x26'),'value':_0x52a160},{'key':_0x3166('0x27'),'value':_0x293e2e},{'key':_0x3166('0x28'),'value':'login'}];var _0x4c975d=_0x17ba06+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x3166('0x11')](_0xcae2f8,function(_0x43fee7){return _0x43fee7[_0x3166('0x29')]+'='+_0x43fee7[_0x3166('0x2a')];})[_0x3166('0x16')]('&');_0x2e1fed[_0x3166('0x2b')]={'issuer':_0x17ba06[_0x3166('0x2c')](_0x3166('0x2d'),''),'audience':_0x2e1fed[_0x3166('0x22')],'state':_0x52a160,'nonce':_0x293e2e};redis[_0x3166('0x2e')](_0x52a160,JSON[_0x3166('0x1e')](_0x2e1fed));return _0x4c975d;}function isValidIdToken(_0x22e705,_0x1a1450){try{var _0x3373af=jwt['decode'](_0x22e705,{'complete':!![]});var _0x5a33c6=_0x3373af['payload'];if(_0x5a33c6[_0x3166('0x2f')]!==_0x1a1450[_0x3166('0x30')])return![];if(_0x5a33c6[_0x3166('0x31')]!==_0x1a1450[_0x3166('0x32')])return![];if(_0x5a33c6[_0x3166('0x27')]!==_0x1a1450[_0x3166('0x27')])return![];if(moment()[_0x3166('0x33')](moment[_0x3166('0x34')](_0x5a33c6[_0x3166('0x35')])))return![];return!![];}catch(_0x453afa){throw _0x453afa;}}function refreshOauth2MicrosoftAccessToken(_0x4ca94d){return Promise[_0x3166('0x36')]()['then'](function(){if(_0x4ca94d[_0x3166('0x37')])return _0x4ca94d;return db[_0x3166('0x38')]['findOne']({'where':{'id':_0x4ca94d['id']},'raw':!![]});})[_0x3166('0x39')](function(_0x40036f){var _0x12acb7={'grant_type':_0x3166('0x3a'),'refresh_token':_0x40036f[_0x3166('0x3b')],'scope':getAccessTokenScope(_0x40036f),'redirect_uri':_0x40036f['data4'],'client_id':_0x40036f[_0x3166('0x22')],'client_secret':encryptor['decryptString'](_0x40036f['data3'])};var _0x306f0a={'method':_0x3166('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x3166('0x2c')]('{TENANT_ID}',_0x40036f['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x12acb7,'json':!![]};return rp(_0x306f0a);})[_0x3166('0x39')](function(_0x43250a){_0x4ca94d[_0x3166('0x3d')]=_0x43250a[_0x3166('0x3e')];_0x4ca94d[_0x3166('0x3b')]=_0x43250a[_0x3166('0x3a')];return db[_0x3166('0x38')][_0x3166('0x3f')]({'data5':_0x4ca94d[_0x3166('0x3d')],'data6':_0x4ca94d[_0x3166('0x3b')]},{'where':{'id':_0x4ca94d['id']}});})[_0x3166('0x39')](function(){return _0x4ca94d;})[_0x3166('0x40')](function(_0x571ce3){logger['error'](_0x3166('0x41'),_0x4ca94d['id'],_0x571ce3);});}function getOauth2MicrosoftAccessToken(_0x1d4e37,_0x58fec0){var _0x30cbab={'grant_type':'authorization_code','code':_0x1d4e37,'scope':getAccessTokenScope(_0x58fec0),'redirect_uri':_0x58fec0[_0x3166('0x42')],'client_id':_0x58fec0[_0x3166('0x22')],'client_secret':encryptor[_0x3166('0x43')](_0x58fec0[_0x3166('0x37')])};var _0x42bc91={'method':_0x3166('0x3c'),'uri':MICROSOFT_AUTH_URL[_0x3166('0x2c')](_0x3166('0x19'),_0x58fec0[_0x3166('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x30cbab,'json':!![]};return rp(_0x42bc91);}function startRefreshInterval(_0x30b44c){var _0x3c4505=schedule['intervals'];if(_0x3c4505[_0x30b44c['id']])clearInterval(_0x3c4505[_0x30b44c['id']]);_0x3c4505[_0x30b44c['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x30b44c['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x3166('0x44')]=_0x3c4505;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x3166('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x597cd0){var _0x5dd612=_0x597cd0[_0x3166('0x11')](function(_0x4acf91){return refreshOauth2MicrosoftAccessToken(_0x4acf91)['then'](function(_0x520d5a){startRefreshInterval(_0x520d5a);});});return Promise[_0x3166('0x46')](_0x5dd612);})[_0x3166('0x40')](function(_0x3017bb){var _0x5ed9b4=_0x3017bb?util[_0x3166('0x47')](_0x3017bb,{'showHidden':![],'depth':null}):'';logger[_0x3166('0x48')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x5ed9b4);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 25df8fd..d115c40 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 _0x1131=['client','request','then','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5fda16,_0x3bf048){var _0x46c10a=function(_0x37558d){while(--_0x37558d){_0x5fda16['push'](_0x5fda16['shift']());}};_0x46c10a(++_0x3bf048);}(_0x1131,0x71));var _0x1113=function(_0x5b8590,_0x3a7c08){_0x5b8590=_0x5b8590-0x0;var _0x5e3b2a=_0x1131[_0x5b8590];return _0x5e3b2a;};'use strict';var _=require('lodash');var util=require(_0x1113('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1113('0x1'));var db=require(_0x1113('0x2'))['db'];var utils=require(_0x1113('0x3'));var logger=require(_0x1113('0x4'))(_0x1113('0x5'));var config=require(_0x1113('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1113('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f76a7,_0x500c86,_0x502a53){return new BPromise(function(_0x458f86,_0x53a218){return client[_0x1113('0x8')](_0x1f76a7,_0x502a53)[_0x1113('0x9')](function(_0x3e20dd){logger[_0x1113('0xa')](_0x1113('0xb'),_0x500c86,'request\x20sent');logger['debug'](_0x1113('0xc'),_0x500c86,_0x1113('0xd'),JSON[_0x1113('0xe')](_0x3e20dd));if(_0x3e20dd['error']){if(_0x3e20dd[_0x1113('0xf')][_0x1113('0x10')]===0x1f4){logger['error'](_0x1113('0xb'),_0x500c86,_0x3e20dd[_0x1113('0xf')][_0x1113('0x11')]);return _0x53a218(_0x3e20dd[_0x1113('0xf')]['message']);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x500c86,_0x3e20dd['error'][_0x1113('0x11')]);return _0x458f86(_0x3e20dd[_0x1113('0xf')][_0x1113('0x11')]);}else{logger[_0x1113('0xa')]('CloudProvider,\x20%s,\x20%s',_0x500c86,_0x1113('0xd'));_0x458f86(_0x3e20dd[_0x1113('0x12')][_0x1113('0x11')]);}})[_0x1113('0x13')](function(_0x1cadcb){logger[_0x1113('0xf')](_0x1113('0xb'),_0x500c86,_0x1cadcb);_0x53a218(_0x1cadcb);});});} \ No newline at end of file +var _0xba6f=['debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','CloudProvider,\x20%s,\x20%s','request\x20sent'];(function(_0x57db2b,_0x21397e){var _0x381abb=function(_0x210534){while(--_0x210534){_0x57db2b['push'](_0x57db2b['shift']());}};_0x381abb(++_0x21397e);}(_0xba6f,0x1d0));var _0xfba6=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0xba6f[_0x23f8c8];return _0x3dc718;};'use strict';var _=require(_0xfba6('0x0'));var util=require('util');var moment=require(_0xfba6('0x1'));var BPromise=require(_0xfba6('0x2'));var rs=require(_0xfba6('0x3'));var fs=require('fs');var Redis=require(_0xfba6('0x4'));var db=require(_0xfba6('0x5'))['db'];var utils=require(_0xfba6('0x6'));var logger=require(_0xfba6('0x7'))(_0xfba6('0x8'));var config=require(_0xfba6('0x9'));var jayson=require(_0xfba6('0xa'));var client=jayson[_0xfba6('0xb')][_0xfba6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x99e213,_0x5d86c3,_0x1b3c5c){return new BPromise(function(_0x2bd0e6,_0x4dd2a2){return client['request'](_0x99e213,_0x1b3c5c)['then'](function(_0x3effea){logger[_0xfba6('0xd')](_0xfba6('0xe'),_0x5d86c3,_0xfba6('0xf'));logger[_0xfba6('0x10')](_0xfba6('0x11'),_0x5d86c3,_0xfba6('0xf'),JSON[_0xfba6('0x12')](_0x3effea));if(_0x3effea[_0xfba6('0x13')]){if(_0x3effea[_0xfba6('0x13')][_0xfba6('0x14')]===0x1f4){logger['error'](_0xfba6('0xe'),_0x5d86c3,_0x3effea[_0xfba6('0x13')][_0xfba6('0x15')]);return _0x4dd2a2(_0x3effea[_0xfba6('0x13')]['message']);}logger[_0xfba6('0x13')]('CloudProvider,\x20%s,\x20%s',_0x5d86c3,_0x3effea['error'][_0xfba6('0x15')]);return _0x2bd0e6(_0x3effea[_0xfba6('0x13')][_0xfba6('0x15')]);}else{logger[_0xfba6('0xd')](_0xfba6('0xe'),_0x5d86c3,_0xfba6('0xf'));_0x2bd0e6(_0x3effea[_0xfba6('0x16')][_0xfba6('0x15')]);}})[_0xfba6('0x17')](function(_0x228add){logger[_0xfba6('0x13')](_0xfba6('0xe'),_0x5d86c3,_0x228add);_0x4dd2a2(_0x228add);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b72ce47..8dfb7b5 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(_0x48d5fd,_0x5498a0){var _0x245c47=function(_0x27b62b){while(--_0x27b62b){_0x48d5fd['push'](_0x48d5fd['shift']());}};_0x245c47(++_0x5498a0);}(_0x2ef3,0xba));var _0x32ef=function(_0x32182d,_0x15e3f3){_0x32182d=_0x32182d-0x0;var _0x376ee0=_0x2ef3[_0x32182d];return _0x376ee0;};'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 _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(_0x214cdf,_0x458085){var _0x232d5b=function(_0x1546d8){while(--_0x1546d8){_0x214cdf['push'](_0x214cdf['shift']());}};_0x232d5b(++_0x458085);}(_0x2ef3,0xba));var _0x32ef=function(_0x5bc03d,_0x274ed1){_0x5bc03d=_0x5bc03d-0x0;var _0x30285d=_0x2ef3[_0x5bc03d];return _0x30285d;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 1c4a672..8366015 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 _0x48c4=['exports','STRING','sequelize'];(function(_0x4346bb,_0x21c6f8){var _0x3fd272=function(_0x4ec982){while(--_0x4ec982){_0x4346bb['push'](_0x4346bb['shift']());}};_0x3fd272(++_0x21c6f8);}(_0x48c4,0x134));var _0x448c=function(_0x205273,_0x1de635){_0x205273=_0x205273-0x0;var _0x1a7900=_0x48c4[_0x205273];return _0x1a7900;};'use strict';var Sequelize=require(_0x448c('0x0'));module[_0x448c('0x1')]={'name':{'type':Sequelize[_0x448c('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x448c('0x2')]},'companyId':{'type':Sequelize[_0x448c('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x448c('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x448c('0x2')]},'postalCode':{'type':Sequelize[_0x448c('0x2')]},'city':{'type':Sequelize[_0x448c('0x2')]},'country':{'type':Sequelize[_0x448c('0x2')]},'email':{'type':Sequelize[_0x448c('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x448c('0x2')]},'sPostalCode':{'type':Sequelize[_0x448c('0x2')]},'sCity':{'type':Sequelize[_0x448c('0x2')]},'sCountry':{'type':Sequelize[_0x448c('0x2')]},'description':{'type':Sequelize[_0x448c('0x2')]}}; \ No newline at end of file +var _0x4829=['name','exports','STRING'];(function(_0x4291c8,_0x496c13){var _0x40ee75=function(_0x3ac215){while(--_0x3ac215){_0x4291c8['push'](_0x4291c8['shift']());}};_0x40ee75(++_0x496c13);}(_0x4829,0xcd));var _0x9482=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x4829[_0x3d4876];return _0x58ca9d;};'use strict';var Sequelize=require('sequelize');module[_0x9482('0x0')]={'name':{'type':Sequelize[_0x9482('0x1')],'unique':_0x9482('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9482('0x1')]},'companyId':{'type':Sequelize[_0x9482('0x1')]},'website':{'type':Sequelize[_0x9482('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9482('0x1')]},'type':{'type':Sequelize[_0x9482('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9482('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9482('0x1')]},'email':{'type':Sequelize[_0x9482('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9482('0x1')]},'sStreet':{'type':Sequelize[_0x9482('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x9482('0x1')]},'sCountry':{'type':Sequelize[_0x9482('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 0afb40e..6c5dc03 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 _0xf0e6=['request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','destroy','then','get','Companies','UserProfileResource','end','stack','name','send','index','CmCompany','describe','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','ids','getContacts','findOne','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x356527,_0x3e536b){var _0x1d8923=function(_0x11db9c){while(--_0x11db9c){_0x356527['push'](_0x356527['shift']());}};_0x1d8923(++_0x3e536b);}(_0xf0e6,0x1af));var _0x6f0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf0e6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6f0e('0x0'));var rimraf=require(_0x6f0e('0x1'));var zipdir=require(_0x6f0e('0x2'));var jsonpatch=require(_0x6f0e('0x3'));var rp=require(_0x6f0e('0x4'));var moment=require('moment');var BPromise=require(_0x6f0e('0x5'));var Mustache=require(_0x6f0e('0x6'));var util=require('util');var path=require(_0x6f0e('0x7'));var sox=require(_0x6f0e('0x8'));var csv=require(_0x6f0e('0x9'));var ejs=require(_0x6f0e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f0e('0xb'));var squel=require(_0x6f0e('0xc'));var crypto=require('crypto');var jsforce=require(_0x6f0e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6f0e('0x9'));var querystring=require('querystring');var Papa=require(_0x6f0e('0xe'));var Redis=require(_0x6f0e('0xf'));var authService=require(_0x6f0e('0x10'));var qs=require(_0x6f0e('0x11'));var as=require(_0x6f0e('0x12'));var hardwareService=require(_0x6f0e('0x13'));var logger=require(_0x6f0e('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6f0e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f0e('0x16'))['db'];function respondWithStatusCode(_0xa1aec,_0x84392){_0x84392=_0x84392||0xcc;return function(_0x29b973){if(_0x29b973){return _0xa1aec[_0x6f0e('0x17')](_0x84392);}return _0xa1aec[_0x6f0e('0x18')](_0x84392)['end']();};}function respondWithResult(_0x663aa5,_0x109ee){_0x109ee=_0x109ee||0xc8;return function(_0x3f6586){if(_0x3f6586){return _0x663aa5[_0x6f0e('0x18')](_0x109ee)[_0x6f0e('0x19')](_0x3f6586);}};}function respondWithFilteredResult(_0x3585d9,_0x1ad0d1){return function(_0x172056){if(_0x172056){var _0x594ac1=typeof _0x1ad0d1['offset']===_0x6f0e('0x1a')&&typeof _0x1ad0d1[_0x6f0e('0x1b')]==='undefined';var _0x551368=_0x172056['count'];var _0x5b7486=_0x594ac1?0x0:_0x1ad0d1['offset'];var _0x259380=_0x594ac1?_0x172056[_0x6f0e('0x1c')]:_0x1ad0d1[_0x6f0e('0x1d')]+_0x1ad0d1['limit'];var _0xdf30c0;if(_0x259380>=_0x551368){_0x259380=_0x551368;_0xdf30c0=0xc8;}else{_0xdf30c0=0xce;}_0x3585d9['status'](_0xdf30c0);return _0x3585d9['set'](_0x6f0e('0x1e'),_0x5b7486+'-'+_0x259380+'/'+_0x551368)[_0x6f0e('0x19')](_0x172056);}return null;};}function patchUpdates(_0x5de194){return function(_0x5f3cd2){try{jsonpatch[_0x6f0e('0x1f')](_0x5f3cd2,_0x5de194,!![]);}catch(_0xdc383b){return BPromise['reject'](_0xdc383b);}return _0x5f3cd2[_0x6f0e('0x20')]();};}function saveUpdates(_0x2c5ac3,_0x30c917){return function(_0x4b6fd1){if(_0x4b6fd1){return _0x4b6fd1['update'](_0x2c5ac3)['then'](function(_0x273fe5){return _0x273fe5;});}return null;};}function removeEntity(_0x1c2644,_0x47d65c){return function(_0x51f59c){if(_0x51f59c){return _0x51f59c[_0x6f0e('0x21')]()[_0x6f0e('0x22')](function(){var _0x2d6a11=_0x51f59c[_0x6f0e('0x23')]({'plain':!![]});var _0x232fbd=_0x6f0e('0x24');return db[_0x6f0e('0x25')][_0x6f0e('0x21')]({'where':{'type':_0x232fbd,'resourceId':_0x2d6a11['id']}})['then'](function(){return _0x51f59c;});})[_0x6f0e('0x22')](function(){_0x1c2644[_0x6f0e('0x18')](0xcc)[_0x6f0e('0x26')]();});}};}function handleEntityNotFound(_0x507918,_0x2efd8c){return function(_0xa5d5dc){if(!_0xa5d5dc){_0x507918[_0x6f0e('0x17')](0x194);}return _0xa5d5dc;};}function handleError(_0x58f3f5,_0x1eda01){_0x1eda01=_0x1eda01||0x1f4;return function(_0x3f01b3){logger['error'](_0x3f01b3[_0x6f0e('0x27')]);if(_0x3f01b3[_0x6f0e('0x28')]){delete _0x3f01b3[_0x6f0e('0x28')];}_0x58f3f5[_0x6f0e('0x18')](_0x1eda01)[_0x6f0e('0x29')](_0x3f01b3);};}exports[_0x6f0e('0x2a')]=function(_0x13d083,_0x3a2b66){var _0x48fa96={},_0x443e7e={},_0x1e0fcb={'count':0x0,'rows':[]};return db[_0x6f0e('0x2b')][_0x6f0e('0x2c')]()[_0x6f0e('0x22')](function(_0x5c4691){_0x443e7e[_0x6f0e('0x2d')]=_['keys'](_0x5c4691);_0x443e7e['query']=_['keys'](_0x13d083[_0x6f0e('0x2e')]);_0x443e7e[_0x6f0e('0x2f')]=_[_0x6f0e('0x30')](_0x443e7e[_0x6f0e('0x2d')],_0x443e7e['query']);_0x48fa96[_0x6f0e('0x31')]=_['intersection'](_0x443e7e[_0x6f0e('0x2d')],qs[_0x6f0e('0x32')](_0x13d083[_0x6f0e('0x2e')]['fields']));_0x48fa96[_0x6f0e('0x31')]=_0x48fa96['attributes'][_0x6f0e('0x33')]?_0x48fa96[_0x6f0e('0x31')]:_0x443e7e[_0x6f0e('0x2d')];if(!_0x13d083[_0x6f0e('0x2e')][_0x6f0e('0x34')](_0x6f0e('0x35'))){_0x48fa96['limit']=qs['limit'](_0x13d083['query'][_0x6f0e('0x1b')]);_0x48fa96[_0x6f0e('0x1d')]=qs[_0x6f0e('0x1d')](_0x13d083[_0x6f0e('0x2e')][_0x6f0e('0x1d')]);}_0x48fa96[_0x6f0e('0x36')]=qs[_0x6f0e('0x37')](_0x13d083[_0x6f0e('0x2e')]['sort']);_0x48fa96[_0x6f0e('0x38')]=qs[_0x6f0e('0x2f')](_[_0x6f0e('0x39')](_0x13d083['query'],_0x443e7e['filters']),_0x5c4691);if(_0x13d083[_0x6f0e('0x2e')][_0x6f0e('0x3a')]){_0x48fa96[_0x6f0e('0x38')]=_[_0x6f0e('0x3b')](_0x48fa96[_0x6f0e('0x38')],{'$or':_[_0x6f0e('0x3c')](_0x48fa96[_0x6f0e('0x31')],function(_0x587e99){var _0xd11329={};_0xd11329[_0x587e99]={'$like':'%'+_0x13d083[_0x6f0e('0x2e')]['filter']+'%'};return _0xd11329;})});}_0x48fa96=_[_0x6f0e('0x3b')]({},_0x48fa96,_0x13d083[_0x6f0e('0x3d')]);var _0x5cda98={'where':_0x48fa96[_0x6f0e('0x38')]};return db[_0x6f0e('0x2b')][_0x6f0e('0x1c')](_0x5cda98)[_0x6f0e('0x22')](function(_0x1db64b){_0x1e0fcb['count']=_0x1db64b;if(_0x13d083[_0x6f0e('0x2e')][_0x6f0e('0x3e')]){_0x48fa96[_0x6f0e('0x3f')]=[{'all':!![]}];}return db[_0x6f0e('0x2b')][_0x6f0e('0x40')](_0x48fa96);})[_0x6f0e('0x22')](function(_0x52436a){_0x1e0fcb[_0x6f0e('0x41')]=_0x52436a;return _0x1e0fcb;})[_0x6f0e('0x22')](respondWithFilteredResult(_0x3a2b66,_0x48fa96))[_0x6f0e('0x42')](handleError(_0x3a2b66,null));})[_0x6f0e('0x42')](handleError(_0x3a2b66,null));};exports[_0x6f0e('0x43')]=function(_0x2a4a51,_0xb2b392){var _0x468135={'raw':![],'where':{'id':_0x2a4a51[_0x6f0e('0x44')]['id']}},_0x52d149={};_0x52d149['model']=_[_0x6f0e('0x45')](db['CmCompany'][_0x6f0e('0x46')]);_0x52d149[_0x6f0e('0x2e')]=_[_0x6f0e('0x45')](_0x2a4a51['query']);_0x52d149['filters']=_[_0x6f0e('0x30')](_0x52d149[_0x6f0e('0x2d')],_0x52d149['query']);_0x468135[_0x6f0e('0x31')]=_[_0x6f0e('0x30')](_0x52d149[_0x6f0e('0x2d')],qs[_0x6f0e('0x32')](_0x2a4a51[_0x6f0e('0x2e')][_0x6f0e('0x32')]));_0x468135[_0x6f0e('0x31')]=_0x468135[_0x6f0e('0x31')][_0x6f0e('0x33')]?_0x468135['attributes']:_0x52d149[_0x6f0e('0x2d')];if(_0x2a4a51[_0x6f0e('0x2e')]['includeAll']){_0x468135[_0x6f0e('0x3f')]=[{'all':!![]}];}_0x468135=_[_0x6f0e('0x3b')]({},_0x468135,_0x2a4a51[_0x6f0e('0x3d')]);return db['CmCompany'][_0x6f0e('0x47')](_0x468135)[_0x6f0e('0x22')](handleEntityNotFound(_0xb2b392,null))[_0x6f0e('0x22')](respondWithResult(_0xb2b392,null))[_0x6f0e('0x42')](handleError(_0xb2b392,null));};exports[_0x6f0e('0x48')]=function(_0x3d2f47,_0x8eb62){return db[_0x6f0e('0x2b')]['create'](_0x3d2f47[_0x6f0e('0x49')],{})[_0x6f0e('0x22')](function(_0x122caa){var _0x2eb083=_0x3d2f47[_0x6f0e('0x4a')][_0x6f0e('0x23')]({'plain':!![]});if(!_0x2eb083)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2eb083[_0x6f0e('0x4b')]==='user'){var _0x1d6d70=_0x122caa[_0x6f0e('0x23')]({'plain':!![]});var _0x191d54=_0x6f0e('0x24');return db[_0x6f0e('0x4c')]['find']({'where':{'name':_0x191d54,'userProfileId':_0x2eb083[_0x6f0e('0x4d')]},'raw':!![]})[_0x6f0e('0x22')](function(_0x51fa52){if(_0x51fa52&&_0x51fa52[_0x6f0e('0x4e')]===0x0){return db[_0x6f0e('0x25')]['create']({'name':_0x1d6d70[_0x6f0e('0x28')],'resourceId':_0x1d6d70['id'],'type':_0x51fa52['name'],'sectionId':_0x51fa52['id']},{})[_0x6f0e('0x22')](function(){return _0x122caa;});}else{return _0x122caa;}})[_0x6f0e('0x42')](function(_0x53299b){logger[_0x6f0e('0x4f')](_0x6f0e('0x50'),_0x53299b);throw _0x53299b;});}return _0x122caa;})[_0x6f0e('0x22')](respondWithResult(_0x8eb62,0xc9))[_0x6f0e('0x42')](handleError(_0x8eb62,null));};exports[_0x6f0e('0x51')]=function(_0x4367ab,_0x5ef689){if(_0x4367ab[_0x6f0e('0x49')]['id']){delete _0x4367ab[_0x6f0e('0x49')]['id'];}return db['CmCompany'][_0x6f0e('0x47')]({'where':{'id':_0x4367ab[_0x6f0e('0x44')]['id']}})[_0x6f0e('0x22')](handleEntityNotFound(_0x5ef689,null))[_0x6f0e('0x22')](saveUpdates(_0x4367ab['body'],null))[_0x6f0e('0x22')](respondWithResult(_0x5ef689,null))[_0x6f0e('0x42')](handleError(_0x5ef689,null));};exports['destroy']=function(_0x6259c0,_0x3ff471){return db['CmCompany'][_0x6f0e('0x47')]({'where':{'id':_0x6259c0[_0x6f0e('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ff471,null))['then'](removeEntity(_0x3ff471,null))[_0x6f0e('0x42')](handleError(_0x3ff471,null));};exports[_0x6f0e('0x2c')]=function(_0x185e06,_0x45b9ad){return db[_0x6f0e('0x2b')][_0x6f0e('0x2c')]()[_0x6f0e('0x22')](respondWithResult(_0x45b9ad,null))[_0x6f0e('0x42')](handleError(_0x45b9ad,null));};exports[_0x6f0e('0x52')]=function(_0x4abdf1,_0x48b32,_0x126d97){return db[_0x6f0e('0x53')][_0x6f0e('0x47')]({'where':{'id':_0x4abdf1[_0x6f0e('0x44')]['id']}})[_0x6f0e('0x22')](handleEntityNotFound(_0x48b32,null))['then'](function(_0x4ea220){if(_0x4ea220){return _0x4ea220[_0x6f0e('0x52')](_0x4abdf1[_0x6f0e('0x49')][_0x6f0e('0x54')],_['omit'](_0x4abdf1[_0x6f0e('0x49')],[_0x6f0e('0x54'),'id'])||{});}})[_0x6f0e('0x22')](respondWithResult(_0x48b32,null))[_0x6f0e('0x42')](handleError(_0x48b32,null));};exports[_0x6f0e('0x55')]=function(_0x50bb8a,_0x3d5e34,_0x1e0443){var _0x324404={};var _0x562d0e={};var _0xfe6e58;var _0x1a493d;return db[_0x6f0e('0x2b')][_0x6f0e('0x56')]({'where':{'id':_0x50bb8a[_0x6f0e('0x44')]['id']}})[_0x6f0e('0x22')](handleEntityNotFound(_0x3d5e34,null))[_0x6f0e('0x22')](function(_0x57616c){if(_0x57616c){_0xfe6e58=_0x57616c;_0x562d0e[_0x6f0e('0x2d')]=_[_0x6f0e('0x45')](db[_0x6f0e('0x53')]['rawAttributes']);_0x562d0e[_0x6f0e('0x2e')]=_['keys'](_0x50bb8a[_0x6f0e('0x2e')]);_0x562d0e['filters']=_[_0x6f0e('0x30')](_0x562d0e[_0x6f0e('0x2d')],_0x562d0e[_0x6f0e('0x2e')]);_0x324404[_0x6f0e('0x31')]=_[_0x6f0e('0x30')](_0x562d0e['model'],qs['fields'](_0x50bb8a['query'][_0x6f0e('0x32')]));_0x324404[_0x6f0e('0x31')]=_0x324404[_0x6f0e('0x31')][_0x6f0e('0x33')]?_0x324404[_0x6f0e('0x31')]:_0x562d0e['model'];_0x324404['order']=qs[_0x6f0e('0x37')](_0x50bb8a['query']['sort']);_0x324404[_0x6f0e('0x38')]=qs[_0x6f0e('0x2f')](_['pick'](_0x50bb8a[_0x6f0e('0x2e')],_0x562d0e['filters']));if(_0x50bb8a['query'][_0x6f0e('0x3a')]){_0x324404[_0x6f0e('0x38')]=_[_0x6f0e('0x3b')](_0x324404[_0x6f0e('0x38')],{'$or':_[_0x6f0e('0x3c')](_0x324404[_0x6f0e('0x31')],function(_0x377f78){var _0x59e880={};_0x59e880[_0x377f78]={'$like':'%'+_0x50bb8a[_0x6f0e('0x2e')]['filter']+'%'};return _0x59e880;})});}_0x324404=_[_0x6f0e('0x3b')]({},_0x324404,_0x50bb8a[_0x6f0e('0x3d')]);return _0xfe6e58[_0x6f0e('0x55')](_0x324404);}})[_0x6f0e('0x22')](function(_0x39f114){if(_0x39f114){_0x1a493d=_0x39f114[_0x6f0e('0x33')];if(!_0x50bb8a[_0x6f0e('0x2e')]['hasOwnProperty']('nolimit')){_0x324404[_0x6f0e('0x1b')]=qs[_0x6f0e('0x1b')](_0x50bb8a[_0x6f0e('0x2e')][_0x6f0e('0x1b')]);_0x324404[_0x6f0e('0x1d')]=qs[_0x6f0e('0x1d')](_0x50bb8a[_0x6f0e('0x2e')][_0x6f0e('0x1d')]);}return _0xfe6e58['getContacts'](_0x324404);}})['then'](function(_0x58b3ed){if(_0x58b3ed){return _0x58b3ed?{'count':_0x1a493d,'rows':_0x58b3ed}:null;}})['then'](respondWithResult(_0x3d5e34,null))[_0x6f0e('0x42')](handleError(_0x3d5e34,null));}; \ No newline at end of file +var _0x6f8f=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Companies','error','stack','name','send','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','filter','merge','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','addContacts','ids','omit','getContacts','findOne','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0x6f8f,0x90));var _0xf6f8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f8f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf6f8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf6f8('0x1'));var rp=require(_0xf6f8('0x2'));var moment=require(_0xf6f8('0x3'));var BPromise=require(_0xf6f8('0x4'));var Mustache=require(_0xf6f8('0x5'));var util=require(_0xf6f8('0x6'));var path=require(_0xf6f8('0x7'));var sox=require(_0xf6f8('0x8'));var csv=require('to-csv');var ejs=require(_0xf6f8('0x9'));var fs=require('fs');var fs_extra=require(_0xf6f8('0xa'));var _=require(_0xf6f8('0xb'));var squel=require(_0xf6f8('0xc'));var crypto=require('crypto');var jsforce=require(_0xf6f8('0xd'));var deskjs=require(_0xf6f8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf6f8('0xf'));var Papa=require(_0xf6f8('0x10'));var Redis=require(_0xf6f8('0x11'));var authService=require(_0xf6f8('0x12'));var qs=require(_0xf6f8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6f8('0x14'));var logger=require(_0xf6f8('0x15'))(_0xf6f8('0x16'));var utils=require('../../config/utils');var config=require(_0xf6f8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e6ca0,_0x556b93){_0x556b93=_0x556b93||0xcc;return function(_0x42d711){if(_0x42d711){return _0x2e6ca0['sendStatus'](_0x556b93);}return _0x2e6ca0[_0xf6f8('0x18')](_0x556b93)[_0xf6f8('0x19')]();};}function respondWithResult(_0x213998,_0x2e6ae2){_0x2e6ae2=_0x2e6ae2||0xc8;return function(_0x5a71d3){if(_0x5a71d3){return _0x213998[_0xf6f8('0x18')](_0x2e6ae2)[_0xf6f8('0x1a')](_0x5a71d3);}};}function respondWithFilteredResult(_0x3f9b6b,_0x19b107){return function(_0x2dadf0){if(_0x2dadf0){var _0x19ef31=typeof _0x19b107[_0xf6f8('0x1b')]===_0xf6f8('0x1c')&&typeof _0x19b107[_0xf6f8('0x1d')]===_0xf6f8('0x1c');var _0x16dc05=_0x2dadf0[_0xf6f8('0x1e')];var _0x15cf16=_0x19ef31?0x0:_0x19b107[_0xf6f8('0x1b')];var _0x4310fe=_0x19ef31?_0x2dadf0[_0xf6f8('0x1e')]:_0x19b107[_0xf6f8('0x1b')]+_0x19b107['limit'];var _0x4b9752;if(_0x4310fe>=_0x16dc05){_0x4310fe=_0x16dc05;_0x4b9752=0xc8;}else{_0x4b9752=0xce;}_0x3f9b6b['status'](_0x4b9752);return _0x3f9b6b[_0xf6f8('0x1f')](_0xf6f8('0x20'),_0x15cf16+'-'+_0x4310fe+'/'+_0x16dc05)[_0xf6f8('0x1a')](_0x2dadf0);}return null;};}function patchUpdates(_0x30b27e){return function(_0x4dea46){try{jsonpatch[_0xf6f8('0x21')](_0x4dea46,_0x30b27e,!![]);}catch(_0x145dc4){return BPromise[_0xf6f8('0x22')](_0x145dc4);}return _0x4dea46[_0xf6f8('0x23')]();};}function saveUpdates(_0x17acbe,_0x1aa550){return function(_0x3b6a39){if(_0x3b6a39){return _0x3b6a39[_0xf6f8('0x24')](_0x17acbe)['then'](function(_0x238627){return _0x238627;});}return null;};}function removeEntity(_0x3eea5d,_0x3f6721){return function(_0x5a4c9c){if(_0x5a4c9c){return _0x5a4c9c[_0xf6f8('0x25')]()[_0xf6f8('0x26')](function(){var _0x2de292=_0x5a4c9c[_0xf6f8('0x27')]({'plain':!![]});var _0x2e0144=_0xf6f8('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e0144,'resourceId':_0x2de292['id']}})[_0xf6f8('0x26')](function(){return _0x5a4c9c;});})[_0xf6f8('0x26')](function(){_0x3eea5d['status'](0xcc)[_0xf6f8('0x19')]();});}};}function handleEntityNotFound(_0x4f1a62,_0x36c8d9){return function(_0x52647a){if(!_0x52647a){_0x4f1a62['sendStatus'](0x194);}return _0x52647a;};}function handleError(_0x3e3fb7,_0x59ca24){_0x59ca24=_0x59ca24||0x1f4;return function(_0x20d7c1){logger[_0xf6f8('0x29')](_0x20d7c1[_0xf6f8('0x2a')]);if(_0x20d7c1['name']){delete _0x20d7c1[_0xf6f8('0x2b')];}_0x3e3fb7['status'](_0x59ca24)[_0xf6f8('0x2c')](_0x20d7c1);};}exports['index']=function(_0x183d35,_0x302fd3){var _0x5e6ae5={},_0x4af85b={},_0x1359da={'count':0x0,'rows':[]};return db['CmCompany'][_0xf6f8('0x2d')]()[_0xf6f8('0x26')](function(_0x125a9e){_0x4af85b[_0xf6f8('0x2e')]=_[_0xf6f8('0x2f')](_0x125a9e);_0x4af85b[_0xf6f8('0x30')]=_[_0xf6f8('0x2f')](_0x183d35[_0xf6f8('0x30')]);_0x4af85b[_0xf6f8('0x31')]=_[_0xf6f8('0x32')](_0x4af85b['model'],_0x4af85b[_0xf6f8('0x30')]);_0x5e6ae5[_0xf6f8('0x33')]=_[_0xf6f8('0x32')](_0x4af85b[_0xf6f8('0x2e')],qs[_0xf6f8('0x34')](_0x183d35[_0xf6f8('0x30')]['fields']));_0x5e6ae5[_0xf6f8('0x33')]=_0x5e6ae5['attributes'][_0xf6f8('0x35')]?_0x5e6ae5[_0xf6f8('0x33')]:_0x4af85b[_0xf6f8('0x2e')];if(!_0x183d35[_0xf6f8('0x30')][_0xf6f8('0x36')](_0xf6f8('0x37'))){_0x5e6ae5['limit']=qs['limit'](_0x183d35[_0xf6f8('0x30')]['limit']);_0x5e6ae5[_0xf6f8('0x1b')]=qs[_0xf6f8('0x1b')](_0x183d35[_0xf6f8('0x30')]['offset']);}_0x5e6ae5[_0xf6f8('0x38')]=qs['sort'](_0x183d35['query'][_0xf6f8('0x39')]);_0x5e6ae5[_0xf6f8('0x3a')]=qs[_0xf6f8('0x31')](_[_0xf6f8('0x3b')](_0x183d35[_0xf6f8('0x30')],_0x4af85b[_0xf6f8('0x31')]),_0x125a9e);if(_0x183d35[_0xf6f8('0x30')]['filter']){_0x5e6ae5[_0xf6f8('0x3a')]=_['merge'](_0x5e6ae5['where'],{'$or':_[_0xf6f8('0x3c')](_0x5e6ae5[_0xf6f8('0x33')],function(_0xa09bcf){var _0x173247={};_0x173247[_0xa09bcf]={'$like':'%'+_0x183d35['query'][_0xf6f8('0x3d')]+'%'};return _0x173247;})});}_0x5e6ae5=_[_0xf6f8('0x3e')]({},_0x5e6ae5,_0x183d35[_0xf6f8('0x3f')]);var _0x497d93={'where':_0x5e6ae5['where']};return db[_0xf6f8('0x40')]['count'](_0x497d93)[_0xf6f8('0x26')](function(_0x164548){_0x1359da[_0xf6f8('0x1e')]=_0x164548;if(_0x183d35[_0xf6f8('0x30')][_0xf6f8('0x41')]){_0x5e6ae5[_0xf6f8('0x42')]=[{'all':!![]}];}return db[_0xf6f8('0x40')][_0xf6f8('0x43')](_0x5e6ae5);})[_0xf6f8('0x26')](function(_0x15fe9d){_0x1359da[_0xf6f8('0x44')]=_0x15fe9d;return _0x1359da;})['then'](respondWithFilteredResult(_0x302fd3,_0x5e6ae5))[_0xf6f8('0x45')](handleError(_0x302fd3,null));})[_0xf6f8('0x45')](handleError(_0x302fd3,null));};exports[_0xf6f8('0x46')]=function(_0x5157d2,_0x234a8c){var _0x2c9b97={'raw':![],'where':{'id':_0x5157d2[_0xf6f8('0x47')]['id']}},_0x42683b={};_0x42683b['model']=_['keys'](db[_0xf6f8('0x40')]['rawAttributes']);_0x42683b[_0xf6f8('0x30')]=_[_0xf6f8('0x2f')](_0x5157d2[_0xf6f8('0x30')]);_0x42683b['filters']=_[_0xf6f8('0x32')](_0x42683b[_0xf6f8('0x2e')],_0x42683b[_0xf6f8('0x30')]);_0x2c9b97[_0xf6f8('0x33')]=_[_0xf6f8('0x32')](_0x42683b[_0xf6f8('0x2e')],qs[_0xf6f8('0x34')](_0x5157d2[_0xf6f8('0x30')][_0xf6f8('0x34')]));_0x2c9b97[_0xf6f8('0x33')]=_0x2c9b97[_0xf6f8('0x33')][_0xf6f8('0x35')]?_0x2c9b97[_0xf6f8('0x33')]:_0x42683b['model'];if(_0x5157d2[_0xf6f8('0x30')][_0xf6f8('0x41')]){_0x2c9b97['include']=[{'all':!![]}];}_0x2c9b97=_['merge']({},_0x2c9b97,_0x5157d2[_0xf6f8('0x3f')]);return db['CmCompany'][_0xf6f8('0x48')](_0x2c9b97)[_0xf6f8('0x26')](handleEntityNotFound(_0x234a8c,null))[_0xf6f8('0x26')](respondWithResult(_0x234a8c,null))[_0xf6f8('0x45')](handleError(_0x234a8c,null));};exports[_0xf6f8('0x49')]=function(_0x457f16,_0x3013bc){return db['CmCompany'][_0xf6f8('0x49')](_0x457f16[_0xf6f8('0x4a')],{})[_0xf6f8('0x26')](function(_0x85bc34){var _0x3decd7=_0x457f16['user'][_0xf6f8('0x27')]({'plain':!![]});if(!_0x3decd7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3decd7['role']===_0xf6f8('0x4b')){var _0x12bba8=_0x85bc34[_0xf6f8('0x27')]({'plain':!![]});var _0x3a1056=_0xf6f8('0x28');return db[_0xf6f8('0x4c')][_0xf6f8('0x48')]({'where':{'name':_0x3a1056,'userProfileId':_0x3decd7[_0xf6f8('0x4d')]},'raw':!![]})[_0xf6f8('0x26')](function(_0xa4a051){if(_0xa4a051&&_0xa4a051[_0xf6f8('0x4e')]===0x0){return db[_0xf6f8('0x4f')][_0xf6f8('0x49')]({'name':_0x12bba8[_0xf6f8('0x2b')],'resourceId':_0x12bba8['id'],'type':_0xa4a051['name'],'sectionId':_0xa4a051['id']},{})['then'](function(){return _0x85bc34;});}else{return _0x85bc34;}})[_0xf6f8('0x45')](function(_0x558f24){logger[_0xf6f8('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x558f24);throw _0x558f24;});}return _0x85bc34;})[_0xf6f8('0x26')](respondWithResult(_0x3013bc,0xc9))[_0xf6f8('0x45')](handleError(_0x3013bc,null));};exports[_0xf6f8('0x24')]=function(_0x89662f,_0x499850){if(_0x89662f[_0xf6f8('0x4a')]['id']){delete _0x89662f[_0xf6f8('0x4a')]['id'];}return db[_0xf6f8('0x40')]['find']({'where':{'id':_0x89662f[_0xf6f8('0x47')]['id']}})[_0xf6f8('0x26')](handleEntityNotFound(_0x499850,null))[_0xf6f8('0x26')](saveUpdates(_0x89662f[_0xf6f8('0x4a')],null))[_0xf6f8('0x26')](respondWithResult(_0x499850,null))['catch'](handleError(_0x499850,null));};exports[_0xf6f8('0x25')]=function(_0x5a4041,_0x1aac88){return db[_0xf6f8('0x40')]['find']({'where':{'id':_0x5a4041['params']['id']}})[_0xf6f8('0x26')](handleEntityNotFound(_0x1aac88,null))['then'](removeEntity(_0x1aac88,null))[_0xf6f8('0x45')](handleError(_0x1aac88,null));};exports[_0xf6f8('0x2d')]=function(_0x3192af,_0x528d73){return db[_0xf6f8('0x40')]['describe']()[_0xf6f8('0x26')](respondWithResult(_0x528d73,null))[_0xf6f8('0x45')](handleError(_0x528d73,null));};exports[_0xf6f8('0x50')]=function(_0x89bbd6,_0x39d0f4,_0x36a31d){return db['CmContact'][_0xf6f8('0x48')]({'where':{'id':_0x89bbd6[_0xf6f8('0x47')]['id']}})[_0xf6f8('0x26')](handleEntityNotFound(_0x39d0f4,null))['then'](function(_0x9ebf7){if(_0x9ebf7){return _0x9ebf7[_0xf6f8('0x50')](_0x89bbd6[_0xf6f8('0x4a')][_0xf6f8('0x51')],_[_0xf6f8('0x52')](_0x89bbd6['body'],[_0xf6f8('0x51'),'id'])||{});}})[_0xf6f8('0x26')](respondWithResult(_0x39d0f4,null))['catch'](handleError(_0x39d0f4,null));};exports[_0xf6f8('0x53')]=function(_0x426432,_0x3d5873,_0x5aed59){var _0x108b60={};var _0x193e04={};var _0x8a591e;var _0x35f355;return db['CmCompany'][_0xf6f8('0x54')]({'where':{'id':_0x426432[_0xf6f8('0x47')]['id']}})[_0xf6f8('0x26')](handleEntityNotFound(_0x3d5873,null))[_0xf6f8('0x26')](function(_0x39faf2){if(_0x39faf2){_0x8a591e=_0x39faf2;_0x193e04['model']=_[_0xf6f8('0x2f')](db['CmContact']['rawAttributes']);_0x193e04[_0xf6f8('0x30')]=_[_0xf6f8('0x2f')](_0x426432[_0xf6f8('0x30')]);_0x193e04[_0xf6f8('0x31')]=_[_0xf6f8('0x32')](_0x193e04[_0xf6f8('0x2e')],_0x193e04[_0xf6f8('0x30')]);_0x108b60['attributes']=_[_0xf6f8('0x32')](_0x193e04[_0xf6f8('0x2e')],qs[_0xf6f8('0x34')](_0x426432[_0xf6f8('0x30')]['fields']));_0x108b60[_0xf6f8('0x33')]=_0x108b60[_0xf6f8('0x33')]['length']?_0x108b60[_0xf6f8('0x33')]:_0x193e04[_0xf6f8('0x2e')];_0x108b60[_0xf6f8('0x38')]=qs[_0xf6f8('0x39')](_0x426432[_0xf6f8('0x30')][_0xf6f8('0x39')]);_0x108b60[_0xf6f8('0x3a')]=qs[_0xf6f8('0x31')](_[_0xf6f8('0x3b')](_0x426432[_0xf6f8('0x30')],_0x193e04[_0xf6f8('0x31')]));if(_0x426432['query']['filter']){_0x108b60['where']=_[_0xf6f8('0x3e')](_0x108b60[_0xf6f8('0x3a')],{'$or':_[_0xf6f8('0x3c')](_0x108b60[_0xf6f8('0x33')],function(_0x5b2d8d){var _0x472dc5={};_0x472dc5[_0x5b2d8d]={'$like':'%'+_0x426432[_0xf6f8('0x30')][_0xf6f8('0x3d')]+'%'};return _0x472dc5;})});}_0x108b60=_['merge']({},_0x108b60,_0x426432[_0xf6f8('0x3f')]);return _0x8a591e[_0xf6f8('0x53')](_0x108b60);}})[_0xf6f8('0x26')](function(_0x7004e7){if(_0x7004e7){_0x35f355=_0x7004e7[_0xf6f8('0x35')];if(!_0x426432[_0xf6f8('0x30')][_0xf6f8('0x36')](_0xf6f8('0x37'))){_0x108b60['limit']=qs[_0xf6f8('0x1d')](_0x426432[_0xf6f8('0x30')]['limit']);_0x108b60[_0xf6f8('0x1b')]=qs[_0xf6f8('0x1b')](_0x426432['query'][_0xf6f8('0x1b')]);}return _0x8a591e[_0xf6f8('0x53')](_0x108b60);}})[_0xf6f8('0x26')](function(_0x17aeb6){if(_0x17aeb6){return _0x17aeb6?{'count':_0x35f355,'rows':_0x17aeb6}:null;}})[_0xf6f8('0x26')](respondWithResult(_0x3d5873,null))[_0xf6f8('0x45')](handleError(_0x3d5873,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index b22cd73..96728ee 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 _0x9150=['path','rimraf','../../config/environment','./cmCompany.attributes','exports','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x9150,0xa2));var _0x0915=function(_0x493086,_0x1c15dd){_0x493086=_0x493086-0x0;var _0x51b0dd=_0x9150[_0x493086];return _0x51b0dd;};'use strict';var _=require(_0x0915('0x0'));var util=require(_0x0915('0x1'));var logger=require(_0x0915('0x2'))(_0x0915('0x3'));var moment=require(_0x0915('0x4'));var BPromise=require(_0x0915('0x5'));var rp=require(_0x0915('0x6'));var fs=require('fs');var path=require(_0x0915('0x7'));var rimraf=require(_0x0915('0x8'));var config=require(_0x0915('0x9'));var attributes=require(_0x0915('0xa'));module[_0x0915('0xb')]=function(_0x1dbf04,_0x299771){return _0x1dbf04['define']('CmCompany',attributes,{'tableName':_0x0915('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef5b=['./cmCompany.attributes','exports','define','cm_companies','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x40e59a,_0x2608dd){var _0x571c0d=function(_0x563802){while(--_0x563802){_0x40e59a['push'](_0x40e59a['shift']());}};_0x571c0d(++_0x2608dd);}(_0xef5b,0x70));var _0xbef5=function(_0x3d75df,_0x286e7a){_0x3d75df=_0x3d75df-0x0;var _0x25d327=_0xef5b[_0x3d75df];return _0x25d327;};'use strict';var _=require('lodash');var util=require(_0xbef5('0x0'));var logger=require('../../config/logger')(_0xbef5('0x1'));var moment=require(_0xbef5('0x2'));var BPromise=require(_0xbef5('0x3'));var rp=require(_0xbef5('0x4'));var fs=require('fs');var path=require(_0xbef5('0x5'));var rimraf=require(_0xbef5('0x6'));var config=require(_0xbef5('0x7'));var attributes=require(_0xbef5('0x8'));module[_0xbef5('0x9')]=function(_0x4ea6f0,_0x135b2f){return _0x4ea6f0[_0xbef5('0xa')]('CmCompany',attributes,{'tableName':_0xbef5('0xb'),'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 d839fbd..a8c6959 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 _0xb1d5=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x37a1e6,_0x536b85){var _0x115a59=function(_0x4173a7){while(--_0x4173a7){_0x37a1e6['push'](_0x37a1e6['shift']());}};_0x115a59(++_0x536b85);}(_0xb1d5,0xec));var _0x5b1d=function(_0x3a376f,_0x4694fb){_0x3a376f=_0x3a376f-0x0;var _0x2cc9ae=_0xb1d5[_0x3a376f];return _0x2cc9ae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5b1d('0x0'));var BPromise=require(_0x5b1d('0x1'));var rs=require(_0x5b1d('0x2'));var fs=require('fs');var Redis=require(_0x5b1d('0x3'));var db=require(_0x5b1d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b1d('0x5'))(_0x5b1d('0x6'));var config=require(_0x5b1d('0x7'));var jayson=require(_0x5b1d('0x8'));var client=jayson[_0x5b1d('0x9')][_0x5b1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ba70e,_0x5663bc,_0x4f68fe){return new BPromise(function(_0x387b32,_0x47ea5d){return client[_0x5b1d('0xb')](_0x5ba70e,_0x4f68fe)[_0x5b1d('0xc')](function(_0x1bd8ae){logger[_0x5b1d('0xd')](_0x5b1d('0xe'),_0x5663bc,_0x5b1d('0xf'));logger['debug'](_0x5b1d('0x10'),_0x5663bc,_0x5b1d('0xf'),JSON[_0x5b1d('0x11')](_0x1bd8ae));if(_0x1bd8ae[_0x5b1d('0x12')]){if(_0x1bd8ae['error'][_0x5b1d('0x13')]===0x1f4){logger[_0x5b1d('0x12')](_0x5b1d('0xe'),_0x5663bc,_0x1bd8ae['error'][_0x5b1d('0x14')]);return _0x47ea5d(_0x1bd8ae[_0x5b1d('0x12')]['message']);}logger[_0x5b1d('0x12')](_0x5b1d('0xe'),_0x5663bc,_0x1bd8ae['error'][_0x5b1d('0x14')]);return _0x387b32(_0x1bd8ae['error'][_0x5b1d('0x14')]);}else{logger[_0x5b1d('0xd')]('CmCompany,\x20%s,\x20%s',_0x5663bc,'request\x20sent');_0x387b32(_0x1bd8ae[_0x5b1d('0x15')]['message']);}})['catch'](function(_0x51d65e){logger[_0x5b1d('0x12')]('CmCompany,\x20%s,\x20%s',_0x5663bc,_0x51d65e);_0x47ea5d(_0x51d65e);});});} \ No newline at end of file +var _0x2a5d=['code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x420746,_0x26dd66){var _0x1c6de2=function(_0x1162d7){while(--_0x1162d7){_0x420746['push'](_0x420746['shift']());}};_0x1c6de2(++_0x26dd66);}(_0x2a5d,0x6d));var _0xd2a5=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x2a5d[_0x176329];return _0x31997c;};'use strict';var _=require(_0xd2a5('0x0'));var util=require('util');var moment=require(_0xd2a5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd2a5('0x2'));var db=require(_0xd2a5('0x3'))['db'];var utils=require(_0xd2a5('0x4'));var logger=require(_0xd2a5('0x5'))('rpc');var config=require(_0xd2a5('0x6'));var jayson=require(_0xd2a5('0x7'));var client=jayson[_0xd2a5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e599c,_0x5746ed,_0x1efbbb){return new BPromise(function(_0x437e81,_0xb18eda){return client['request'](_0x5e599c,_0x1efbbb)[_0xd2a5('0x9')](function(_0x5219c3){logger[_0xd2a5('0xa')](_0xd2a5('0xb'),_0x5746ed,_0xd2a5('0xc'));logger[_0xd2a5('0xd')](_0xd2a5('0xe'),_0x5746ed,_0xd2a5('0xc'),JSON[_0xd2a5('0xf')](_0x5219c3));if(_0x5219c3[_0xd2a5('0x10')]){if(_0x5219c3['error'][_0xd2a5('0x11')]===0x1f4){logger[_0xd2a5('0x10')](_0xd2a5('0xb'),_0x5746ed,_0x5219c3['error'][_0xd2a5('0x12')]);return _0xb18eda(_0x5219c3[_0xd2a5('0x10')][_0xd2a5('0x12')]);}logger[_0xd2a5('0x10')](_0xd2a5('0xb'),_0x5746ed,_0x5219c3['error']['message']);return _0x437e81(_0x5219c3[_0xd2a5('0x10')][_0xd2a5('0x12')]);}else{logger[_0xd2a5('0xa')](_0xd2a5('0xb'),_0x5746ed,_0xd2a5('0xc'));_0x437e81(_0x5219c3[_0xd2a5('0x13')]['message']);}})[_0xd2a5('0x14')](function(_0x5edb54){logger[_0xd2a5('0x10')](_0xd2a5('0xb'),_0x5746ed,_0x5edb54);_0xb18eda(_0x5edb54);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 32517c9..727208e 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 _0xf45d=['express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','create','post','put','update','destroy','multer','util','connect-timeout'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xf45d,0x151));var _0xdf45=function(_0x58e001,_0x3b2a88){_0x58e001=_0x58e001-0x0;var _0x37f3b8=_0xf45d[_0x58e001];return _0x37f3b8;};'use strict';var multer=require(_0xdf45('0x0'));var util=require(_0xdf45('0x1'));var path=require('path');var timeout=require(_0xdf45('0x2'));var express=require(_0xdf45('0x3'));var router=express[_0xdf45('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdf45('0x5'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xdf45('0x6')]('/',auth[_0xdf45('0x7')](),controller[_0xdf45('0x8')]);router[_0xdf45('0x6')](_0xdf45('0x9'),auth[_0xdf45('0x7')](),controller[_0xdf45('0xa')]);router[_0xdf45('0x6')](_0xdf45('0xb'),auth['isAuthenticated'](),controller[_0xdf45('0xc')]);router[_0xdf45('0x6')](_0xdf45('0xd'),auth['isAuthenticated'](),controller[_0xdf45('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdf45('0xf')]);router[_0xdf45('0x10')](_0xdf45('0xd'),auth[_0xdf45('0x7')](),controller['addContacts']);router[_0xdf45('0x11')](_0xdf45('0xb'),auth[_0xdf45('0x7')](),controller[_0xdf45('0x12')]);router['delete']('/:id',auth[_0xdf45('0x7')](),controller[_0xdf45('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0291=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','./cmCompany.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete'];(function(_0x544d7a,_0x3be1fd){var _0x46fc8c=function(_0x34ec20){while(--_0x34ec20){_0x544d7a['push'](_0x544d7a['shift']());}};_0x46fc8c(++_0x3be1fd);}(_0x0291,0x162));var _0x1029=function(_0x523a3b,_0x21e2b5){_0x523a3b=_0x523a3b-0x0;var _0x1b113d=_0x0291[_0x523a3b];return _0x1b113d;};'use strict';var multer=require(_0x1029('0x0'));var util=require(_0x1029('0x1'));var path=require('path');var timeout=require(_0x1029('0x2'));var express=require('express');var router=express[_0x1029('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1029('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1029('0x5'));router['get']('/',auth[_0x1029('0x6')](),controller['index']);router[_0x1029('0x7')](_0x1029('0x8'),auth[_0x1029('0x6')](),controller[_0x1029('0x9')]);router[_0x1029('0x7')](_0x1029('0xa'),auth['isAuthenticated'](),controller[_0x1029('0xb')]);router['get'](_0x1029('0xc'),auth[_0x1029('0x6')](),controller[_0x1029('0xd')]);router[_0x1029('0xe')]('/',auth[_0x1029('0x6')](),controller[_0x1029('0xf')]);router['post'](_0x1029('0xc'),auth[_0x1029('0x6')](),controller[_0x1029('0x10')]);router[_0x1029('0x11')]('/:id',auth[_0x1029('0x6')](),controller[_0x1029('0x12')]);router[_0x1029('0x13')](_0x1029('0xa'),auth['isAuthenticated'](),controller[_0x1029('0x14')]);module[_0x1029('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index bc85f50..c655cf0 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 _0xbb05=['TEXT','INTEGER','DATE','NOW','lodash','sequelize','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbb05,0xcf));var _0x5bb0=function(_0xb24c13,_0xbafb19){_0xb24c13=_0xb24c13-0x0;var _0x55cc8e=_0xbb05[_0xb24c13];return _0x55cc8e;};'use strict';var _=require(_0x5bb0('0x0'));var Sequelize=require(_0x5bb0('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x5bb0('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x5bb0('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5bb0('0x2')]},'city':{'type':Sequelize[_0x5bb0('0x2')]},'country':{'type':Sequelize[_0x5bb0('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5bb0('0x3')]},'phone':{'type':Sequelize[_0x5bb0('0x2')]},'mobile':{'type':Sequelize[_0x5bb0('0x2')]},'fax':{'type':Sequelize[_0x5bb0('0x2')]},'email':{'type':Sequelize[_0x5bb0('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x5bb0('0x2')]},'fb_data':{'type':Sequelize[_0x5bb0('0x2')]},'twitter':{'type':Sequelize[_0x5bb0('0x2')]},'skype':{'type':Sequelize[_0x5bb0('0x2')]},'teams':{'type':Sequelize[_0x5bb0('0x2')]},'viber':{'type':Sequelize[_0x5bb0('0x2')]},'line':{'type':Sequelize[_0x5bb0('0x2')]},'wechat':{'type':Sequelize[_0x5bb0('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x5bb0('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5bb0('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x5bb0('0x5')],'defaultValue':Sequelize[_0x5bb0('0x6')]},'dialTimezone':{'type':Sequelize[_0x5bb0('0x2')]},'utcOffset':{'type':Sequelize[_0x5bb0('0x4')]}}; \ No newline at end of file +var _0xf62d=['STRING','TEXT','INTEGER','UNSIGNED','NOW','sequelize','exports'];(function(_0x26fd67,_0x510e30){var _0x840207=function(_0x1372c9){while(--_0x1372c9){_0x26fd67['push'](_0x26fd67['shift']());}};_0x840207(++_0x510e30);}(_0xf62d,0x1b7));var _0xdf62=function(_0x4eab97,_0x52a55f){_0x4eab97=_0x4eab97-0x0;var _0x41f8b2=_0xf62d[_0x4eab97];return _0x41f8b2;};'use strict';var _=require('lodash');var Sequelize=require(_0xdf62('0x0'));module[_0xdf62('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xdf62('0x2')]},'postalCode':{'type':Sequelize[_0xdf62('0x2')]},'city':{'type':Sequelize[_0xdf62('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xdf62('0x2')]},'description':{'type':Sequelize[_0xdf62('0x3')]},'phone':{'type':Sequelize[_0xdf62('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdf62('0x2')]},'url':{'type':Sequelize[_0xdf62('0x2')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xdf62('0x2')]},'skype':{'type':Sequelize[_0xdf62('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xdf62('0x2')]},'line':{'type':Sequelize[_0xdf62('0x2')]},'wechat':{'type':Sequelize[_0xdf62('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xdf62('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xdf62('0x2')]},'priority':{'type':Sequelize[_0xdf62('0x4')](0x2)[_0xdf62('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xdf62('0x6')]},'dialTimezone':{'type':Sequelize[_0xdf62('0x2')]},'utcOffset':{'type':Sequelize[_0xdf62('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 07eea9f..a7efcbe 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 _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 42e75c9..4437bb9 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 _0x8653=['hook','exports','events','CmContact','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x112337,_0xb6c8fb){var _0x299602=function(_0x79d17c){while(--_0x79d17c){_0x112337['push'](_0x112337['shift']());}};_0x299602(++_0xb6c8fb);}(_0x8653,0xf5));var _0x3865=function(_0x5843f2,_0x189651){_0x5843f2=_0x5843f2-0x0;var _0x179536=_0x8653[_0x5843f2];return _0x179536;};'use strict';var EventEmitter=require(_0x3865('0x0'));var CmContact=require('../../mysqldb')['db'][_0x3865('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x3865('0x2')](0x0);var events={'afterCreate':_0x3865('0x3'),'afterUpdate':_0x3865('0x4'),'afterDestroy':'remove'};function emitEvent(_0x10d20b){return function(_0x748f57,_0x25fbb9,_0x32ec4c){CmContactEvents[_0x3865('0x5')](_0x10d20b+':'+_0x748f57['id'],_0x748f57);CmContactEvents[_0x3865('0x5')](_0x10d20b,_0x748f57);_0x32ec4c(null);};}for(var e in events){if(events[_0x3865('0x6')](e)){var event=events[e];CmContact[_0x3865('0x7')](e,emitEvent(event));}}module[_0x3865('0x8')]=CmContactEvents; \ No newline at end of file +var _0xa209=['remove','emit','exports','events','../../mysqldb','CmContact','setMaxListeners','save'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0xa209,0x1bb));var _0x9a20=function(_0x47cda4,_0x23ec19){_0x47cda4=_0x47cda4-0x0;var _0xc16bae=_0xa209[_0x47cda4];return _0xc16bae;};'use strict';var EventEmitter=require(_0x9a20('0x0'));var CmContact=require(_0x9a20('0x1'))['db'][_0x9a20('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x9a20('0x3')](0x0);var events={'afterCreate':_0x9a20('0x4'),'afterUpdate':'update','afterDestroy':_0x9a20('0x5')};function emitEvent(_0x4fa418){return function(_0x2a3096,_0x529711,_0x45b657){CmContactEvents['emit'](_0x4fa418+':'+_0x2a3096['id'],_0x2a3096);CmContactEvents[_0x9a20('0x6')](_0x4fa418,_0x2a3096);_0x45b657(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x9a20('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 7542bfa..e07099e 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 _0x5af7=['length','onlyIfOpen','BlackLists','CmHopperBlack','message','always','Campaign','cmContact,\x20%s,\x20%s','List\x20not\x20found','isEmpty','destroy','VoiceQueueId','CampaignId','push','all','info','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','firstName','lastName','fax','email','utf8mb4_unicode_ci','models','get','error','cmContact','inspect','scheduledat','isNil','VoiceQueue','findOne','then','dialTimezone','timezones','utcOffset','add','format','YYYY-MM-DD\x20HH:mm:ss','CmHopper','cmContact,\x20afterCreate\x20','create','priority','callbackUniqueid','catch','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','afterCreate','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','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists'];(function(_0xee6ce3,_0x584c02){var _0x578ab=function(_0x2781d3){while(--_0x2781d3){_0xee6ce3['push'](_0xee6ce3['shift']());}};_0x578ab(++_0x584c02);}(_0x5af7,0x17d));var _0x75af=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0x5af7[_0x1f1e31];return _0x229b56;};'use strict';var _=require(_0x75af('0x0'));var util=require('util');var logger=require(_0x75af('0x1'))(_0x75af('0x2'));var moment=require('moment');var BPromise=require(_0x75af('0x3'));var rp=require(_0x75af('0x4'));var fs=require('fs');var path=require(_0x75af('0x5'));var rimraf=require(_0x75af('0x6'));var config=require(_0x75af('0x7'));var shared=require('../../config/environment/shared');var attributes=require(_0x75af('0x8'));module[_0x75af('0x9')]=function(_0x54505c,_0x767cf2){return _0x54505c[_0x75af('0xa')](_0x75af('0xb'),attributes,{'tableName':_0x75af('0xc'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x75af('0xd')]},{'name':'fti_cm_contacts','fields':[_0x75af('0xe'),_0x75af('0xf'),_0x75af('0xd'),'mobile',_0x75af('0x10'),_0x75af('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0x75af('0x12'),'hooks':{'afterCreate':function(_0x31a6cb,_0xeb5aa2,_0x518918){var _0x49e4de=_0x54505c[_0x75af('0x13')];var _0x5ce75c=_0x31a6cb[_0x75af('0x14')]({'plain':!![]});function _0x1e3176(){return function(_0x1a3c25){logger[_0x75af('0x15')](_0x75af('0x16'),'afterCreate',util[_0x75af('0x17')](_0x1a3c25,{'showHidden':![],'depth':null}));};}function _0x3462dc(_0x2aa450,_0x1da463){var _0x1fe6f0=_0x1da463['scheduledat']?_0x1da463[_0x75af('0x18')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x4b459e,_0x1cb3e6){if(_[_0x75af('0x19')](_0x1da463['dialTimezone'])){_0x4b459e({'ret':_0x1fe6f0});}else{_0x49e4de[_0x75af('0x1a')][_0x75af('0x1b')]({'where':{'id':_0x2aa450['id']}})[_0x75af('0x1c')](function(_0x3f2bfd){if(!_[_0x75af('0x19')](_0x3f2bfd)){var _0xe4e188=_0x3f2bfd[_0x75af('0x1d')];if(!_[_0x75af('0x19')](_0xe4e188)){var _0x5a892c=shared[_0x75af('0x1e')];var _0x3c3c69=_0x5a892c[_0xe4e188];var _0x417a06=_0x5a892c[_0x1da463[_0x75af('0x1d')]];if(!_['isNil'](_0x3c3c69)&&!_[_0x75af('0x19')](_0x417a06)){var _0x5071b8=_0x3c3c69[_0x75af('0x1f')]-_0x417a06[_0x75af('0x1f')];_0x1fe6f0=_0x1da463['scheduledat']?_0x1da463['scheduledat']:moment();var _0x509464=moment(_0x1fe6f0)[_0x75af('0x20')](_0x5071b8,'minutes');_0x4b459e({'ret':_0x509464[_0x75af('0x21')](_0x75af('0x22'))});}else _0x4b459e({'ret':_0x1fe6f0});}else _0x4b459e({'ret':_0x1fe6f0});}else{_0x4b459e({'ret':_0x1fe6f0});}});}});return 0xa;}var _0x1842b6=function(_0x505199){return new BPromise(function(_0x5a517d,_0x383513){_0x3462dc(_0x505199,_0x5ce75c)['then'](function(_0x17c9ad){_0x5ce75c[_0x75af('0x18')]=_0x17c9ad['ret'];_0x49e4de[_0x75af('0x23')]['findOne']({'where':{'phone':_0x5ce75c[_0x75af('0xd')],'VoiceQueueId':_0x505199['id']}})['then'](function(_0x143285){if(!_[_0x75af('0x19')](_0x143285)){throw new Error(_0x75af('0x24')+_0x5ce75c['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x505199['id']);}return _0x49e4de[_0x75af('0x23')][_0x75af('0x25')]({'phone':_0x5ce75c['phone'],'ContactId':_0x5ce75c['id'],'ListId':_0x5ce75c['ListId'],'priority':_0x5ce75c['priority']?_0x5ce75c[_0x75af('0x26')]:0x2,'scheduledat':_0x5ce75c['scheduledat']?_0x5ce75c[_0x75af('0x18')]:moment()[_0x75af('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5ce75c[_0x75af('0x27')]?!![]:![],'callbackuniqueid':_0x5ce75c[_0x75af('0x27')]?_0x5ce75c[_0x75af('0x27')]:undefined,'callbackat':_0x5ce75c[_0x75af('0x27')]?moment()[_0x75af('0x21')](_0x75af('0x22')):undefined,'VoiceQueueId':_0x505199['id']});})[_0x75af('0x28')](function(_0x4fb8e5){_0x383513(_0x4fb8e5);});});});};var _0x4ac476=function(_0x1761c4){return new BPromise(function(_0x2f7fc4,_0xb6192e){_0x3462dc(_0x1761c4,_0x5ce75c)['then'](function(_0xa9647b){_0x5ce75c['scheduledat']=_0xa9647b[_0x75af('0x29')];_0x49e4de[_0x75af('0x23')]['findOne']({'where':{'phone':_0x5ce75c[_0x75af('0xd')],'VoiceQueueId':_0x1761c4['id']}})['then'](function(_0x1150e3){if(!_['isNil'](_0x1150e3)){throw new Error('cmContact,\x20afterCreate\x20'+_0x5ce75c['phone']+_0x75af('0x2a')+_0x1761c4['id']);}return _0x49e4de[_0x75af('0x2b')][_0x75af('0x1b')]({'where':{'calleridnum':_0x5ce75c[_0x75af('0xd')],'VoiceQueueId':_0x1761c4['id']}});})[_0x75af('0x1c')](function(_0x381dc3){if(!_[_0x75af('0x19')](_0x381dc3)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x5ce75c['phone']+_0x75af('0x2c')+_0x1761c4['id']);}return _0x49e4de[_0x75af('0x23')]['create']({'phone':_0x5ce75c[_0x75af('0xd')],'ContactId':_0x5ce75c['id'],'ListId':_0x5ce75c[_0x75af('0x2d')],'priority':_0x5ce75c[_0x75af('0x26')]?_0x5ce75c[_0x75af('0x26')]:0x2,'scheduledat':_0x5ce75c[_0x75af('0x18')]?_0x5ce75c[_0x75af('0x18')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5ce75c[_0x75af('0x27')]?!![]:![],'callbackuniqueid':_0x5ce75c[_0x75af('0x27')]?_0x5ce75c[_0x75af('0x27')]:undefined,'callbackat':_0x5ce75c[_0x75af('0x27')]?moment()['format'](_0x75af('0x22')):undefined,'VoiceQueueId':_0x1761c4['id']});})[_0x75af('0x28')](function(_0x2eaa79){_0xb6192e(_0x2eaa79);});});});};function _0x40de2d(){return function(_0x450c59){logger[_0x75af('0x15')]('cmContact',_0x75af('0x2e'),util[_0x75af('0x17')](_0x450c59,{'showHidden':![],'depth':null}));};}function _0x420b80(_0x95fc9,_0x780c44){var _0x3e5841=_0x780c44['scheduledat']?_0x780c44[_0x75af('0x18')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0xec5482,_0x537e22){if(_[_0x75af('0x19')](_0x780c44[_0x75af('0x1d')])){_0xec5482({'ret':_0x3e5841});}else{_0x49e4de['Campaign']['findOne']({'where':{'id':_0x95fc9['id']}})[_0x75af('0x1c')](function(_0x48aa8c){if(!_[_0x75af('0x19')](_0x48aa8c)){var _0x829308=_0x48aa8c[_0x75af('0x1d')];if(!_[_0x75af('0x19')](_0x829308)){var _0x5f2a0e=shared['timezones'];var _0x5ebea2=_0x5f2a0e[_0x829308];var _0x3c652b=_0x5f2a0e[_0x780c44[_0x75af('0x1d')]];if(!_[_0x75af('0x19')](_0x5ebea2)&&!_[_0x75af('0x19')](_0x3c652b)){var _0x3e05cb=_0x5ebea2[_0x75af('0x1f')]-_0x3c652b[_0x75af('0x1f')];_0x3e5841=_0x780c44[_0x75af('0x18')]?_0x780c44[_0x75af('0x18')]:moment();var _0x2fc948=moment(_0x3e5841)['add'](_0x3e05cb,_0x75af('0x2f'));_0xec5482({'ret':_0x2fc948[_0x75af('0x21')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0xec5482({'ret':_0x3e5841});}else _0xec5482({'ret':_0x3e5841});}else{_0xec5482({'ret':_0x3e5841});}});}});return 0xa;}var _0x234b67=function(_0x1d7b2c){return new BPromise(function(_0x23e504,_0x22e87a){_0x420b80(_0x1d7b2c,_0x5ce75c)[_0x75af('0x1c')](function(_0x14b1f0){_0x5ce75c['scheduledat']=_0x14b1f0[_0x75af('0x29')];_0x49e4de['CmHopper'][_0x75af('0x1b')]({'where':{'phone':_0x5ce75c[_0x75af('0xd')],'CampaignId':_0x1d7b2c['id']}})[_0x75af('0x1c')](function(_0x53621e){if(!_[_0x75af('0x19')](_0x53621e)){throw new Error(_0x75af('0x24')+_0x5ce75c[_0x75af('0xd')]+_0x75af('0x30')+_0x1d7b2c['id']);}return _0x49e4de['CmHopper']['create']({'phone':_0x5ce75c[_0x75af('0xd')],'ContactId':_0x5ce75c['id'],'ListId':_0x5ce75c['ListId'],'priority':_0x5ce75c[_0x75af('0x26')]?_0x5ce75c[_0x75af('0x26')]:0x2,'scheduledat':_0x5ce75c[_0x75af('0x18')]?_0x5ce75c['scheduledat']:moment()[_0x75af('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5ce75c[_0x75af('0x27')]?!![]:![],'callbackuniqueid':_0x5ce75c[_0x75af('0x27')]?_0x5ce75c[_0x75af('0x27')]:undefined,'callbackat':_0x5ce75c[_0x75af('0x27')]?moment()[_0x75af('0x21')](_0x75af('0x22')):undefined,'CampaignId':_0x1d7b2c['id']});})[_0x75af('0x28')](function(_0x5c883d){_0x22e87a(_0x5c883d);});});});};var _0x5c3c86=function(_0x39541d){return new BPromise(function(_0x443d88,_0x5ce723){_0x420b80(_0x39541d,_0x5ce75c)[_0x75af('0x1c')](function(_0xcd6cb9){_0x5ce75c['scheduledat']=_0xcd6cb9[_0x75af('0x29')];_0x49e4de[_0x75af('0x23')][_0x75af('0x1b')]({'where':{'phone':_0x5ce75c[_0x75af('0xd')],'CampaignId':_0x39541d['id']}})[_0x75af('0x1c')](function(_0x1333d6){if(!_['isNil'](_0x1333d6)){throw new Error(_0x75af('0x24')+_0x5ce75c[_0x75af('0xd')]+_0x75af('0x31')+_0x39541d['id']);}return _0x49e4de['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x5ce75c['phone'],'CampaignId':_0x39541d['id']}});})[_0x75af('0x1c')](function(_0x30789b){if(!_[_0x75af('0x19')](_0x30789b)){throw new Error(_0x75af('0x32')+_0x5ce75c[_0x75af('0xd')]+_0x75af('0x33')+_0x39541d['id']);}return _0x49e4de[_0x75af('0x23')][_0x75af('0x25')]({'phone':_0x5ce75c[_0x75af('0xd')],'ContactId':_0x5ce75c['id'],'ListId':_0x5ce75c[_0x75af('0x2d')],'priority':_0x5ce75c[_0x75af('0x26')]?_0x5ce75c[_0x75af('0x26')]:0x2,'scheduledat':_0x5ce75c[_0x75af('0x18')]?_0x5ce75c[_0x75af('0x18')]:moment()[_0x75af('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5ce75c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x5ce75c[_0x75af('0x27')]?_0x5ce75c['callbackUniqueid']:undefined,'callbackat':_0x5ce75c[_0x75af('0x27')]?moment()[_0x75af('0x21')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x39541d['id']});})[_0x75af('0x28')](function(_0x4b230b){_0x5ce723(_0x4b230b);});});});};if(_0x5ce75c[_0x75af('0x2d')]){_0x49e4de[_0x75af('0x1a')][_0x75af('0x34')]({'where':{'type':_0x75af('0x35')},'attributes':['id',_0x75af('0x36'),_0x75af('0x1d')],'include':[{'model':_0x49e4de[_0x75af('0x37')],'as':_0x75af('0x38'),'where':{'id':_0x5ce75c[_0x75af('0x2d')]}}]})['then'](function(_0x422a0f){if(_0x422a0f){var _0x1211a8=[];for(var _0x4bbad8=0x0,_0x568a02;_0x4bbad8<_0x422a0f[_0x75af('0x39')];_0x4bbad8+=0x1){_0x568a02=_0x422a0f[_0x4bbad8]['get']({'plain':!![]});switch(_0x568a02[_0x75af('0x36')]){case'always':_0x4ac476(_0x568a02)[_0x75af('0x28')](_0x1e3176());break;case _0x75af('0x3a'):_0x1842b6(_0x568a02)[_0x75af('0x28')](_0x1e3176());break;default:_0x420b80(_0x568a02,_0x5ce75c)[_0x75af('0x1c')](function(_0x58a58a){_0x5ce75c[_0x75af('0x18')]=_0x58a58a['ret'];_0x49e4de[_0x75af('0x23')][_0x75af('0x25')]({'phone':_0x5ce75c[_0x75af('0xd')],'ContactId':_0x5ce75c['id'],'ListId':_0x5ce75c['ListId'],'scheduledat':_0x5ce75c[_0x75af('0x18')]?_0x5ce75c[_0x75af('0x18')]:moment()['format'](_0x75af('0x22')),'priority':_0x5ce75c[_0x75af('0x26')]?_0x5ce75c['priority']:0x2,'callback':_0x5ce75c[_0x75af('0x27')]?!![]:![],'callbackuniqueid':_0x5ce75c[_0x75af('0x27')]?_0x5ce75c[_0x75af('0x27')]:undefined,'callbackat':_0x5ce75c['callbackUniqueid']?moment()['format'](_0x75af('0x22')):undefined,'VoiceQueueId':_0x568a02['id']})[_0x75af('0x28')](_0x1e3176());});}}}})[_0x75af('0x1c')](function(){return _0x49e4de[_0x75af('0x1a')][_0x75af('0x34')]({'where':{'type':_0x75af('0x35')},'attributes':['id'],'include':[{'model':_0x49e4de[_0x75af('0x37')],'as':_0x75af('0x3b'),'where':{'id':_0x5ce75c[_0x75af('0x2d')]}}]})['then'](function(_0x51f28e){if(_0x51f28e){var _0x237562=[];for(var _0x4ec9fa=0x0,_0x3d38fa;_0x4ec9fa<_0x51f28e['length'];_0x4ec9fa+=0x1){_0x3d38fa=_0x51f28e[_0x4ec9fa][_0x75af('0x14')]({'plain':!![]});_0x49e4de[_0x75af('0x3c')][_0x75af('0x25')]({'phone':_0x5ce75c[_0x75af('0xd')],'ContactId':_0x5ce75c['id'],'ListId':_0x5ce75c[_0x75af('0x2d')],'VoiceQueueId':_0x3d38fa['id']})[_0x75af('0x28')](function(_0x4b1685){logger[_0x75af('0x15')]('cmContact,\x20%s,\x20%s',_0x75af('0x2e'),_0x4b1685[_0x75af('0x3d')]);});}}});})[_0x75af('0x1c')](function(){return _0x49e4de['Campaign'][_0x75af('0x34')]({'attributes':['id',_0x75af('0x36'),_0x75af('0x1d')],'include':[{'model':_0x49e4de[_0x75af('0x37')],'as':_0x75af('0x38'),'where':{'id':_0x5ce75c[_0x75af('0x2d')]}}]})['then'](function(_0x4908c0){if(_0x4908c0){var _0x2653a5=[];for(var _0x440d8c=0x0,_0xab0eb3;_0x440d8c<_0x4908c0[_0x75af('0x39')];_0x440d8c+=0x1){_0xab0eb3=_0x4908c0[_0x440d8c][_0x75af('0x14')]({'plain':!![]});switch(_0xab0eb3[_0x75af('0x36')]){case _0x75af('0x3e'):_0x5c3c86(_0xab0eb3)[_0x75af('0x28')](_0x40de2d());break;case'onlyIfOpen':_0x234b67(_0xab0eb3)[_0x75af('0x28')](_0x40de2d());break;default:_0x49e4de[_0x75af('0x23')][_0x75af('0x25')]({'phone':_0x5ce75c[_0x75af('0xd')],'ContactId':_0x5ce75c['id'],'ListId':_0x5ce75c['ListId'],'scheduledat':_0x5ce75c[_0x75af('0x18')]?_0x5ce75c['scheduledat']:moment()[_0x75af('0x21')](_0x75af('0x22')),'priority':_0x5ce75c[_0x75af('0x26')]?_0x5ce75c[_0x75af('0x26')]:0x2,'callback':_0x5ce75c[_0x75af('0x27')]?!![]:![],'callbackuniqueid':_0x5ce75c[_0x75af('0x27')]?_0x5ce75c[_0x75af('0x27')]:undefined,'callbackat':_0x5ce75c[_0x75af('0x27')]?moment()[_0x75af('0x21')](_0x75af('0x22')):undefined,'CampaignId':_0xab0eb3['id']})[_0x75af('0x28')](_0x40de2d());}}}});})[_0x75af('0x1c')](function(){return _0x49e4de[_0x75af('0x3f')][_0x75af('0x34')]({'attributes':['id'],'include':[{'model':_0x49e4de[_0x75af('0x37')],'as':_0x75af('0x3b'),'where':{'id':_0x5ce75c[_0x75af('0x2d')]}}]})[_0x75af('0x1c')](function(_0x272aa8){if(_0x272aa8){var _0x5ca93c=[];for(var _0x49f7fb=0x0,_0x1a4f11;_0x49f7fb<_0x272aa8[_0x75af('0x39')];_0x49f7fb+=0x1){_0x1a4f11=_0x272aa8[_0x49f7fb][_0x75af('0x14')]({'plain':!![]});_0x49e4de[_0x75af('0x3c')]['create']({'phone':_0x5ce75c[_0x75af('0xd')],'ContactId':_0x5ce75c['id'],'ListId':_0x5ce75c[_0x75af('0x2d')],'CampaignId':_0x1a4f11['id']})['catch'](function(_0x530093){logger[_0x75af('0x15')]('cmContact,\x20%s,\x20%s',_0x75af('0x2e'),_0x530093[_0x75af('0x3d')]);});}}});})[_0x75af('0x1c')](function(){_0x518918();})[_0x75af('0x28')](function(_0x574a59){logger[_0x75af('0x15')](_0x75af('0x40'),'afterCreate',_0x574a59[_0x75af('0x3d')]);_0x518918(_0x574a59);});}else{_0x518918(new Error(_0x75af('0x41')));}},'afterDestroy':function(_0x1a292b,_0x606c79,_0x49e2cb){var _0x1b3170=_0x54505c[_0x75af('0x13')];var _0x1d36b1=_0x1a292b[_0x75af('0x14')]({'plain':!![]});return _0x1b3170['CmHopper'][_0x75af('0x34')]({'raw':!![],'where':{'ListId':_0x1d36b1[_0x75af('0x2d')],'ContactId':_0x1d36b1['id']}})[_0x75af('0x1c')](function(_0x24ccdc){if(!_[_0x75af('0x42')](_0x24ccdc)){var _0x256641=[];for(var _0x2808af=0x0;_0x2808af<_0x24ccdc[_0x75af('0x39')];_0x2808af+=0x1){var _0x237c2e=_0x1b3170[_0x75af('0x23')][_0x75af('0x43')]({'where':{'ListId':_0x24ccdc[_0x2808af]['ListId'],'ContactId':_0x24ccdc[_0x2808af]['ContactId'],'VoiceQueueId':_0x24ccdc[_0x2808af][_0x75af('0x44')],'CampaignId':_0x24ccdc[_0x2808af][_0x75af('0x45')]}});_0x256641[_0x75af('0x46')](_0x237c2e);}return BPromise[_0x75af('0x47')](_0x256641);}})[_0x75af('0x1c')](function(_0xd7373c){logger[_0x75af('0x48')]('[CmContact][afterDestroy][Succesfull]',util[_0x75af('0x17')](_0xd7373c,{'showHidden':![],'depth':null}));_0x49e2cb();})[_0x75af('0x28')](function(_0x2296ad){logger[_0x75af('0x15')]('[CmContact][afterDestroy][Error]',util[_0x75af('0x17')](_0x2296ad,{'showHidden':![],'depth':null}));_0x49e2cb(_0x2296ad);});}}});}; \ No newline at end of file +var _0x4bb2=['afterCreate','Campaign','timezones','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','get','always','onlyIfOpen','BlackLists','cmContact,\x20%s,\x20%s','message','findAll','List\x20not\x20found','isEmpty','destroy','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','firstName','lastName','mobile','email','FULLTEXT','utf8mb4_unicode_ci','models','cmContact','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','VoiceQueue','findOne','then','dialTimezone','utcOffset','minutes','ret','CmHopper','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','error'];(function(_0x117020,_0x5932e3){var _0x35c4cf=function(_0x19b83d){while(--_0x19b83d){_0x117020['push'](_0x117020['shift']());}};_0x35c4cf(++_0x5932e3);}(_0x4bb2,0xb4));var _0x24bb=function(_0x4ebc8f,_0x71255){_0x4ebc8f=_0x4ebc8f-0x0;var _0x1b94a8=_0x4bb2[_0x4ebc8f];return _0x1b94a8;};'use strict';var _=require(_0x24bb('0x0'));var util=require(_0x24bb('0x1'));var logger=require(_0x24bb('0x2'))(_0x24bb('0x3'));var moment=require(_0x24bb('0x4'));var BPromise=require(_0x24bb('0x5'));var rp=require(_0x24bb('0x6'));var fs=require('fs');var path=require(_0x24bb('0x7'));var rimraf=require('rimraf');var config=require(_0x24bb('0x8'));var shared=require(_0x24bb('0x9'));var attributes=require(_0x24bb('0xa'));module[_0x24bb('0xb')]=function(_0x3cab2a,_0x12cc44){return _0x3cab2a[_0x24bb('0xc')](_0x24bb('0xd'),attributes,{'tableName':_0x24bb('0xe'),'paranoid':!![],'indexes':[{'name':_0x24bb('0xf'),'fields':[_0x24bb('0xf')]},{'name':'fti_cm_contacts','fields':[_0x24bb('0x10'),_0x24bb('0x11'),_0x24bb('0xf'),_0x24bb('0x12'),'fax',_0x24bb('0x13')],'type':_0x24bb('0x14')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x24bb('0x15'),'hooks':{'afterCreate':function(_0x2aa4ac,_0x4fb588,_0xbdfee0){var _0x470754=_0x3cab2a[_0x24bb('0x16')];var _0x5b9587=_0x2aa4ac['get']({'plain':!![]});function _0x2dfa1c(){return function(_0x33fae9){logger['error'](_0x24bb('0x17'),'afterCreate',util[_0x24bb('0x18')](_0x33fae9,{'showHidden':![],'depth':null}));};}function _0xd51185(_0x39cc04,_0x470f86){var _0x13e96e=_0x470f86[_0x24bb('0x19')]?_0x470f86[_0x24bb('0x19')]:moment()[_0x24bb('0x1a')](_0x24bb('0x1b'));return new BPromise(function(_0x24e1cf,_0x23fe8d){if(_[_0x24bb('0x1c')](_0x470f86['dialTimezone'])){_0x24e1cf({'ret':_0x13e96e});}else{_0x470754[_0x24bb('0x1d')][_0x24bb('0x1e')]({'where':{'id':_0x39cc04['id']}})[_0x24bb('0x1f')](function(_0x394f4){if(!_['isNil'](_0x394f4)){var _0x9433e1=_0x394f4[_0x24bb('0x20')];if(!_[_0x24bb('0x1c')](_0x9433e1)){var _0x5d7356=shared['timezones'];var _0x1ad9bd=_0x5d7356[_0x9433e1];var _0x506ca4=_0x5d7356[_0x470f86[_0x24bb('0x20')]];if(!_[_0x24bb('0x1c')](_0x1ad9bd)&&!_[_0x24bb('0x1c')](_0x506ca4)){var _0x219c7f=_0x1ad9bd['utcOffset']-_0x506ca4[_0x24bb('0x21')];_0x13e96e=_0x470f86[_0x24bb('0x19')]?_0x470f86[_0x24bb('0x19')]:moment();var _0x5ddcf3=moment(_0x13e96e)['add'](_0x219c7f,_0x24bb('0x22'));_0x24e1cf({'ret':_0x5ddcf3[_0x24bb('0x1a')](_0x24bb('0x1b'))});}else _0x24e1cf({'ret':_0x13e96e});}else _0x24e1cf({'ret':_0x13e96e});}else{_0x24e1cf({'ret':_0x13e96e});}});}});return 0xa;}var _0x33f837=function(_0xeda30){return new BPromise(function(_0x241fc1,_0x62902c){_0xd51185(_0xeda30,_0x5b9587)['then'](function(_0x5a152d){_0x5b9587['scheduledat']=_0x5a152d[_0x24bb('0x23')];_0x470754[_0x24bb('0x24')][_0x24bb('0x1e')]({'where':{'phone':_0x5b9587[_0x24bb('0xf')],'VoiceQueueId':_0xeda30['id']}})[_0x24bb('0x1f')](function(_0x154465){if(!_[_0x24bb('0x1c')](_0x154465)){throw new Error('cmContact,\x20afterCreate\x20'+_0x5b9587[_0x24bb('0xf')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0xeda30['id']);}return _0x470754[_0x24bb('0x24')]['create']({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'priority':_0x5b9587[_0x24bb('0x26')]?_0x5b9587[_0x24bb('0x26')]:0x2,'scheduledat':_0x5b9587[_0x24bb('0x19')]?_0x5b9587[_0x24bb('0x19')]:moment()[_0x24bb('0x1a')](_0x24bb('0x1b')),'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587['callbackUniqueid']?_0x5b9587[_0x24bb('0x27')]:undefined,'callbackat':_0x5b9587[_0x24bb('0x27')]?moment()[_0x24bb('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xeda30['id']});})[_0x24bb('0x28')](function(_0x17e2de){_0x62902c(_0x17e2de);});});});};var _0x361283=function(_0x5a8078){return new BPromise(function(_0x2ffa4c,_0x2be83f){_0xd51185(_0x5a8078,_0x5b9587)[_0x24bb('0x1f')](function(_0x498b4c){_0x5b9587[_0x24bb('0x19')]=_0x498b4c[_0x24bb('0x23')];_0x470754[_0x24bb('0x24')]['findOne']({'where':{'phone':_0x5b9587[_0x24bb('0xf')],'VoiceQueueId':_0x5a8078['id']}})[_0x24bb('0x1f')](function(_0x2fa111){if(!_[_0x24bb('0x1c')](_0x2fa111)){throw new Error(_0x24bb('0x29')+_0x5b9587['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x5a8078['id']);}return _0x470754['CmHopperFinal'][_0x24bb('0x1e')]({'where':{'calleridnum':_0x5b9587['phone'],'VoiceQueueId':_0x5a8078['id']}});})['then'](function(_0x2e6f87){if(!_['isNil'](_0x2e6f87)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x5b9587[_0x24bb('0xf')]+_0x24bb('0x2a')+_0x5a8078['id']);}return _0x470754['CmHopper'][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'priority':_0x5b9587['priority']?_0x5b9587[_0x24bb('0x26')]:0x2,'scheduledat':_0x5b9587['scheduledat']?_0x5b9587[_0x24bb('0x19')]:moment()[_0x24bb('0x1a')](_0x24bb('0x1b')),'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587[_0x24bb('0x27')]?_0x5b9587['callbackUniqueid']:undefined,'callbackat':_0x5b9587['callbackUniqueid']?moment()[_0x24bb('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x5a8078['id']});})[_0x24bb('0x28')](function(_0x30b9c8){_0x2be83f(_0x30b9c8);});});});};function _0x1817da(){return function(_0x4ad33a){logger[_0x24bb('0x2c')](_0x24bb('0x17'),_0x24bb('0x2d'),util[_0x24bb('0x18')](_0x4ad33a,{'showHidden':![],'depth':null}));};}function _0x4d39b9(_0x5718b0,_0x56e0d9){var _0x11e49e=_0x56e0d9[_0x24bb('0x19')]?_0x56e0d9[_0x24bb('0x19')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x25f94d,_0xd9f044){if(_[_0x24bb('0x1c')](_0x56e0d9['dialTimezone'])){_0x25f94d({'ret':_0x11e49e});}else{_0x470754[_0x24bb('0x2e')][_0x24bb('0x1e')]({'where':{'id':_0x5718b0['id']}})[_0x24bb('0x1f')](function(_0x345d86){if(!_[_0x24bb('0x1c')](_0x345d86)){var _0x392557=_0x345d86[_0x24bb('0x20')];if(!_[_0x24bb('0x1c')](_0x392557)){var _0x114d21=shared[_0x24bb('0x2f')];var _0x22485e=_0x114d21[_0x392557];var _0x34abb3=_0x114d21[_0x56e0d9['dialTimezone']];if(!_[_0x24bb('0x1c')](_0x22485e)&&!_['isNil'](_0x34abb3)){var _0x35e360=_0x22485e[_0x24bb('0x21')]-_0x34abb3[_0x24bb('0x21')];_0x11e49e=_0x56e0d9[_0x24bb('0x19')]?_0x56e0d9[_0x24bb('0x19')]:moment();var _0x1025ea=moment(_0x11e49e)[_0x24bb('0x30')](_0x35e360,_0x24bb('0x22'));_0x25f94d({'ret':_0x1025ea[_0x24bb('0x1a')](_0x24bb('0x1b'))});}else _0x25f94d({'ret':_0x11e49e});}else _0x25f94d({'ret':_0x11e49e});}else{_0x25f94d({'ret':_0x11e49e});}});}});return 0xa;}var _0x18fe3c=function(_0x422373){return new BPromise(function(_0x50edfa,_0x37eed5){_0x4d39b9(_0x422373,_0x5b9587)[_0x24bb('0x1f')](function(_0x1902de){_0x5b9587[_0x24bb('0x19')]=_0x1902de[_0x24bb('0x23')];_0x470754[_0x24bb('0x24')][_0x24bb('0x1e')]({'where':{'phone':_0x5b9587[_0x24bb('0xf')],'CampaignId':_0x422373['id']}})[_0x24bb('0x1f')](function(_0x811e2d){if(!_['isNil'](_0x811e2d)){throw new Error('cmContact,\x20afterCreate\x20'+_0x5b9587[_0x24bb('0xf')]+_0x24bb('0x31')+_0x422373['id']);}return _0x470754[_0x24bb('0x24')][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'priority':_0x5b9587[_0x24bb('0x26')]?_0x5b9587['priority']:0x2,'scheduledat':_0x5b9587[_0x24bb('0x19')]?_0x5b9587['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587[_0x24bb('0x27')]?_0x5b9587[_0x24bb('0x27')]:undefined,'callbackat':_0x5b9587[_0x24bb('0x27')]?moment()[_0x24bb('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x422373['id']});})['catch'](function(_0x14fa9b){_0x37eed5(_0x14fa9b);});});});};var _0x50e3ef=function(_0x66db1f){return new BPromise(function(_0x47306e,_0x51963a){_0x4d39b9(_0x66db1f,_0x5b9587)[_0x24bb('0x1f')](function(_0x30ce3b){_0x5b9587[_0x24bb('0x19')]=_0x30ce3b[_0x24bb('0x23')];_0x470754[_0x24bb('0x24')][_0x24bb('0x1e')]({'where':{'phone':_0x5b9587[_0x24bb('0xf')],'CampaignId':_0x66db1f['id']}})['then'](function(_0x33b6b9){if(!_[_0x24bb('0x1c')](_0x33b6b9)){throw new Error(_0x24bb('0x29')+_0x5b9587[_0x24bb('0xf')]+_0x24bb('0x32')+_0x66db1f['id']);}return _0x470754[_0x24bb('0x33')]['findOne']({'where':{'calleridnum':_0x5b9587['phone'],'CampaignId':_0x66db1f['id']}});})[_0x24bb('0x1f')](function(_0xdcbfbd){if(!_[_0x24bb('0x1c')](_0xdcbfbd)){throw new Error(_0x24bb('0x34')+_0x5b9587[_0x24bb('0xf')]+_0x24bb('0x35')+_0x66db1f['id']);}return _0x470754[_0x24bb('0x24')][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587['ListId'],'priority':_0x5b9587['priority']?_0x5b9587[_0x24bb('0x26')]:0x2,'scheduledat':_0x5b9587['scheduledat']?_0x5b9587['scheduledat']:moment()['format'](_0x24bb('0x1b')),'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587[_0x24bb('0x27')]?_0x5b9587[_0x24bb('0x27')]:undefined,'callbackat':_0x5b9587[_0x24bb('0x27')]?moment()[_0x24bb('0x1a')](_0x24bb('0x1b')):undefined,'CampaignId':_0x66db1f['id']});})[_0x24bb('0x28')](function(_0x2d0758){_0x51963a(_0x2d0758);});});});};if(_0x5b9587[_0x24bb('0x25')]){_0x470754['VoiceQueue']['findAll']({'where':{'type':_0x24bb('0x36')},'attributes':['id',_0x24bb('0x37'),_0x24bb('0x20')],'include':[{'model':_0x470754[_0x24bb('0x38')],'as':_0x24bb('0x39'),'where':{'id':_0x5b9587[_0x24bb('0x25')]}}]})[_0x24bb('0x1f')](function(_0x5ef430){if(_0x5ef430){var _0x156388=[];for(var _0xdf5d89=0x0,_0x189c9b;_0xdf5d89<_0x5ef430[_0x24bb('0x3a')];_0xdf5d89+=0x1){_0x189c9b=_0x5ef430[_0xdf5d89][_0x24bb('0x3b')]({'plain':!![]});switch(_0x189c9b['dialCheckDuplicateType']){case _0x24bb('0x3c'):_0x361283(_0x189c9b)[_0x24bb('0x28')](_0x2dfa1c());break;case _0x24bb('0x3d'):_0x33f837(_0x189c9b)[_0x24bb('0x28')](_0x2dfa1c());break;default:_0x4d39b9(_0x189c9b,_0x5b9587)[_0x24bb('0x1f')](function(_0x351868){_0x5b9587['scheduledat']=_0x351868[_0x24bb('0x23')];_0x470754['CmHopper'][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587['ListId'],'scheduledat':_0x5b9587[_0x24bb('0x19')]?_0x5b9587[_0x24bb('0x19')]:moment()[_0x24bb('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x5b9587[_0x24bb('0x26')]?_0x5b9587[_0x24bb('0x26')]:0x2,'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587[_0x24bb('0x27')]?_0x5b9587[_0x24bb('0x27')]:undefined,'callbackat':_0x5b9587[_0x24bb('0x27')]?moment()[_0x24bb('0x1a')](_0x24bb('0x1b')):undefined,'VoiceQueueId':_0x189c9b['id']})[_0x24bb('0x28')](_0x2dfa1c());});}}}})[_0x24bb('0x1f')](function(){return _0x470754[_0x24bb('0x1d')]['findAll']({'where':{'type':_0x24bb('0x36')},'attributes':['id'],'include':[{'model':_0x470754['CmList'],'as':_0x24bb('0x3e'),'where':{'id':_0x5b9587[_0x24bb('0x25')]}}]})[_0x24bb('0x1f')](function(_0x3cfe62){if(_0x3cfe62){var _0xa6bfb1=[];for(var _0x3a0685=0x0,_0x1022bf;_0x3a0685<_0x3cfe62[_0x24bb('0x3a')];_0x3a0685+=0x1){_0x1022bf=_0x3cfe62[_0x3a0685][_0x24bb('0x3b')]({'plain':!![]});_0x470754['CmHopperBlack'][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'VoiceQueueId':_0x1022bf['id']})[_0x24bb('0x28')](function(_0x4e656c){logger[_0x24bb('0x2c')](_0x24bb('0x3f'),'afterCreate',_0x4e656c[_0x24bb('0x40')]);});}}});})[_0x24bb('0x1f')](function(){return _0x470754['Campaign'][_0x24bb('0x41')]({'attributes':['id',_0x24bb('0x37'),'dialTimezone'],'include':[{'model':_0x470754[_0x24bb('0x38')],'as':_0x24bb('0x39'),'where':{'id':_0x5b9587[_0x24bb('0x25')]}}]})[_0x24bb('0x1f')](function(_0x2d57e9){if(_0x2d57e9){var _0x5f1a72=[];for(var _0x56f797=0x0,_0x367156;_0x56f797<_0x2d57e9[_0x24bb('0x3a')];_0x56f797+=0x1){_0x367156=_0x2d57e9[_0x56f797][_0x24bb('0x3b')]({'plain':!![]});switch(_0x367156['dialCheckDuplicateType']){case _0x24bb('0x3c'):_0x50e3ef(_0x367156)['catch'](_0x1817da());break;case'onlyIfOpen':_0x18fe3c(_0x367156)['catch'](_0x1817da());break;default:_0x470754[_0x24bb('0x24')]['create']({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'scheduledat':_0x5b9587['scheduledat']?_0x5b9587[_0x24bb('0x19')]:moment()[_0x24bb('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x5b9587[_0x24bb('0x26')]?_0x5b9587[_0x24bb('0x26')]:0x2,'callback':_0x5b9587[_0x24bb('0x27')]?!![]:![],'callbackuniqueid':_0x5b9587[_0x24bb('0x27')]?_0x5b9587['callbackUniqueid']:undefined,'callbackat':_0x5b9587['callbackUniqueid']?moment()[_0x24bb('0x1a')](_0x24bb('0x1b')):undefined,'CampaignId':_0x367156['id']})[_0x24bb('0x28')](_0x1817da());}}}});})[_0x24bb('0x1f')](function(){return _0x470754[_0x24bb('0x2e')][_0x24bb('0x41')]({'attributes':['id'],'include':[{'model':_0x470754['CmList'],'as':'BlackLists','where':{'id':_0x5b9587[_0x24bb('0x25')]}}]})['then'](function(_0x388a88){if(_0x388a88){var _0x1fd7c6=[];for(var _0x2c1a5a=0x0,_0x253e03;_0x2c1a5a<_0x388a88['length'];_0x2c1a5a+=0x1){_0x253e03=_0x388a88[_0x2c1a5a][_0x24bb('0x3b')]({'plain':!![]});_0x470754['CmHopperBlack'][_0x24bb('0x2b')]({'phone':_0x5b9587[_0x24bb('0xf')],'ContactId':_0x5b9587['id'],'ListId':_0x5b9587[_0x24bb('0x25')],'CampaignId':_0x253e03['id']})[_0x24bb('0x28')](function(_0x1f0569){logger[_0x24bb('0x2c')]('cmContact,\x20%s,\x20%s',_0x24bb('0x2d'),_0x1f0569[_0x24bb('0x40')]);});}}});})[_0x24bb('0x1f')](function(){_0xbdfee0();})[_0x24bb('0x28')](function(_0xe3c52a){logger['error'](_0x24bb('0x3f'),_0x24bb('0x2d'),_0xe3c52a[_0x24bb('0x40')]);_0xbdfee0(_0xe3c52a);});}else{_0xbdfee0(new Error(_0x24bb('0x42')));}},'afterDestroy':function(_0x19614b,_0x229db8,_0x4d1ab9){var _0x358718=_0x3cab2a[_0x24bb('0x16')];var _0x126947=_0x19614b[_0x24bb('0x3b')]({'plain':!![]});return _0x358718['CmHopper'][_0x24bb('0x41')]({'raw':!![],'where':{'ListId':_0x126947[_0x24bb('0x25')],'ContactId':_0x126947['id']}})['then'](function(_0x1cc0f1){if(!_[_0x24bb('0x43')](_0x1cc0f1)){var _0x27d17a=[];for(var _0x16f8ea=0x0;_0x16f8ea<_0x1cc0f1[_0x24bb('0x3a')];_0x16f8ea+=0x1){var _0x1e922b=_0x358718[_0x24bb('0x24')][_0x24bb('0x44')]({'where':{'ListId':_0x1cc0f1[_0x16f8ea][_0x24bb('0x25')],'ContactId':_0x1cc0f1[_0x16f8ea][_0x24bb('0x45')],'VoiceQueueId':_0x1cc0f1[_0x16f8ea][_0x24bb('0x46')],'CampaignId':_0x1cc0f1[_0x16f8ea]['CampaignId']}});_0x27d17a[_0x24bb('0x47')](_0x1e922b);}return BPromise[_0x24bb('0x48')](_0x27d17a);}})[_0x24bb('0x1f')](function(_0x2fec7){logger[_0x24bb('0x49')](_0x24bb('0x4a'),util[_0x24bb('0x18')](_0x2fec7,{'showHidden':![],'depth':null}));_0x4d1ab9();})[_0x24bb('0x28')](function(_0x53d063){logger[_0x24bb('0x2c')]('[CmContact][afterDestroy][Error]',util[_0x24bb('0x18')](_0x53d063,{'showHidden':![],'depth':null}));_0x4d1ab9(_0x53d063);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 03c1d09..10d94a1 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3e2123,_0x2e34c1){var _0x1ecc0a=function(_0x358f93){while(--_0x358f93){_0x3e2123['push'](_0x3e2123['shift']());}};_0x1ecc0a(++_0x2e34c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 7a2fe42..3565de3 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 _0xdb4b=['STRING','INTEGER','PHONE','exports'];(function(_0x37c88c,_0x211269){var _0x2ad952=function(_0x4f4b8f){while(--_0x4f4b8f){_0x37c88c['push'](_0x37c88c['shift']());}};_0x2ad952(++_0x211269);}(_0xdb4b,0xd7));var _0xbdb4=function(_0x397004,_0x7949f){_0x397004=_0x397004-0x0;var _0xa7a10=_0xdb4b[_0x397004];return _0xa7a10;};'use strict';var Sequelize=require('sequelize');module[_0xbdb4('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xbdb4('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xbdb4('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xbdb4('0x1')],'defaultValue':_0xbdb4('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xbdb4('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xa25c=['INTEGER','STRING','PHONE','exports'];(function(_0x23d5c9,_0x51be1b){var _0x1b23a1=function(_0x5a0b45){while(--_0x5a0b45){_0x23d5c9['push'](_0x23d5c9['shift']());}};_0x1b23a1(++_0x51be1b);}(_0xa25c,0x13f));var _0xca25=function(_0x390b40,_0x32a62e){_0x390b40=_0x390b40-0x0;var _0x11a416=_0xa25c[_0x390b40];return _0x11a416;};'use strict';var Sequelize=require('sequelize');module[_0xca25('0x0')]={'CmContactId':{'type':Sequelize[_0xca25('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xca25('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xca25('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xca25('0x2')],'defaultValue':_0xca25('0x3')},'OrderBy':{'type':Sequelize[_0xca25('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xca25('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 8e8de3b..36405e8 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 _0x5230=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','CmContactHasItems','UserProfileResource','destroy','error','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort'];(function(_0x15b817,_0x26beac){var _0x56dd81=function(_0x17159d){while(--_0x17159d){_0x15b817['push'](_0x15b817['shift']());}};_0x56dd81(++_0x26beac);}(_0x5230,0x1f0));var _0x0523=function(_0x36c71f,_0x2846e8){_0x36c71f=_0x36c71f-0x0;var _0x3863ce=_0x5230[_0x36c71f];return _0x3863ce;};'use strict';var emlformat=require(_0x0523('0x0'));var rimraf=require(_0x0523('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0523('0x2'));var rp=require(_0x0523('0x3'));var moment=require(_0x0523('0x4'));var BPromise=require(_0x0523('0x5'));var Mustache=require(_0x0523('0x6'));var util=require('util');var path=require(_0x0523('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0523('0x8'));var fs=require('fs');var fs_extra=require(_0x0523('0x9'));var _=require(_0x0523('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0523('0xb'));var deskjs=require(_0x0523('0xc'));var toCsv=require(_0x0523('0xd'));var querystring=require(_0x0523('0xe'));var Papa=require(_0x0523('0xf'));var Redis=require(_0x0523('0x10'));var authService=require(_0x0523('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0523('0x12'));var logger=require(_0x0523('0x13'))('api');var utils=require(_0x0523('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0523('0x15'));var db=require(_0x0523('0x16'))['db'];function respondWithStatusCode(_0x1915b7,_0x3b5a5c){_0x3b5a5c=_0x3b5a5c||0xcc;return function(_0x3b3c14){if(_0x3b3c14){return _0x1915b7[_0x0523('0x17')](_0x3b5a5c);}return _0x1915b7[_0x0523('0x18')](_0x3b5a5c)[_0x0523('0x19')]();};}function respondWithResult(_0x12c2a5,_0x4acc63){_0x4acc63=_0x4acc63||0xc8;return function(_0x3a74f5){if(_0x3a74f5){return _0x12c2a5['status'](_0x4acc63)[_0x0523('0x1a')](_0x3a74f5);}};}function respondWithFilteredResult(_0x5f4bb4,_0x53b8d4){return function(_0x1891ff){if(_0x1891ff){var _0x5a628a=typeof _0x53b8d4[_0x0523('0x1b')]===_0x0523('0x1c')&&typeof _0x53b8d4[_0x0523('0x1d')]===_0x0523('0x1c');var _0x18cd70=_0x1891ff[_0x0523('0x1e')];var _0x5ba1e8=_0x5a628a?0x0:_0x53b8d4[_0x0523('0x1b')];var _0x4e3669=_0x5a628a?_0x1891ff[_0x0523('0x1e')]:_0x53b8d4[_0x0523('0x1b')]+_0x53b8d4[_0x0523('0x1d')];var _0x579e1e;if(_0x4e3669>=_0x18cd70){_0x4e3669=_0x18cd70;_0x579e1e=0xc8;}else{_0x579e1e=0xce;}_0x5f4bb4['status'](_0x579e1e);return _0x5f4bb4[_0x0523('0x1f')](_0x0523('0x20'),_0x5ba1e8+'-'+_0x4e3669+'/'+_0x18cd70)['json'](_0x1891ff);}return null;};}function patchUpdates(_0x1eb2df){return function(_0x10c504){try{jsonpatch[_0x0523('0x21')](_0x10c504,_0x1eb2df,!![]);}catch(_0x4e4160){return BPromise['reject'](_0x4e4160);}return _0x10c504['save']();};}function saveUpdates(_0x3d58eb,_0x516af1){return function(_0x418280){if(_0x418280){return _0x418280['update'](_0x3d58eb)[_0x0523('0x22')](function(_0x33f557){return _0x33f557;});}return null;};}function removeEntity(_0x416c3e,_0x946c17){return function(_0x54441c){if(_0x54441c){return _0x54441c['destroy']()[_0x0523('0x22')](function(){var _0x5b611b=_0x54441c[_0x0523('0x23')]({'plain':!![]});var _0x20f3d1=_0x0523('0x24');return db[_0x0523('0x25')][_0x0523('0x26')]({'where':{'type':_0x20f3d1,'resourceId':_0x5b611b['id']}})[_0x0523('0x22')](function(){return _0x54441c;});})[_0x0523('0x22')](function(){_0x416c3e[_0x0523('0x18')](0xcc)[_0x0523('0x19')]();});}};}function handleEntityNotFound(_0x271ed7,_0x1160d5){return function(_0x31ddd5){if(!_0x31ddd5){_0x271ed7[_0x0523('0x17')](0x194);}return _0x31ddd5;};}function handleError(_0x155e70,_0x105084){_0x105084=_0x105084||0x1f4;return function(_0x4309aa){logger[_0x0523('0x27')](_0x4309aa['stack']);if(_0x4309aa['name']){delete _0x4309aa[_0x0523('0x28')];}_0x155e70[_0x0523('0x18')](_0x105084)[_0x0523('0x29')](_0x4309aa);};}exports[_0x0523('0x2a')]=function(_0x5bae1f,_0x146861){var _0x318289={},_0x3a10d5={},_0x50b74e={'count':0x0,'rows':[]};var _0x450502=_['map'](db[_0x0523('0x2b')][_0x0523('0x2c')],function(_0x109de1){return{'name':_0x109de1[_0x0523('0x2d')],'type':_0x109de1[_0x0523('0x2e')]['key']};});_0x3a10d5[_0x0523('0x2f')]=_[_0x0523('0x30')](_0x450502,_0x0523('0x28'));_0x3a10d5[_0x0523('0x31')]=_['keys'](_0x5bae1f[_0x0523('0x31')]);_0x3a10d5[_0x0523('0x32')]=_[_0x0523('0x33')](_0x3a10d5[_0x0523('0x2f')],_0x3a10d5[_0x0523('0x31')]);_0x318289['attributes']=_['intersection'](_0x3a10d5['model'],qs[_0x0523('0x34')](_0x5bae1f[_0x0523('0x31')]['fields']));_0x318289[_0x0523('0x35')]=_0x318289['attributes']['length']?_0x318289[_0x0523('0x35')]:_0x3a10d5[_0x0523('0x2f')];if(!_0x5bae1f[_0x0523('0x31')][_0x0523('0x36')]('nolimit')){_0x318289['limit']=qs[_0x0523('0x1d')](_0x5bae1f[_0x0523('0x31')][_0x0523('0x1d')]);_0x318289[_0x0523('0x1b')]=qs[_0x0523('0x1b')](_0x5bae1f[_0x0523('0x31')][_0x0523('0x1b')]);}_0x318289[_0x0523('0x37')]=qs['sort'](_0x5bae1f['query'][_0x0523('0x38')]);_0x318289[_0x0523('0x39')]=qs['filters'](_['pick'](_0x5bae1f[_0x0523('0x31')],_0x3a10d5['filters']),_0x450502);if(_0x5bae1f[_0x0523('0x31')][_0x0523('0x3a')]){_0x318289[_0x0523('0x39')]=_['merge'](_0x318289[_0x0523('0x39')],{'$or':_['map'](_0x450502,function(_0x494f18){if(_0x494f18[_0x0523('0x2e')]!==_0x0523('0x3b')){var _0x5da04b={};_0x5da04b[_0x494f18[_0x0523('0x28')]]={'$like':'%'+_0x5bae1f['query'][_0x0523('0x3a')]+'%'};return _0x5da04b;}})});}_0x318289=_[_0x0523('0x3c')]({},_0x318289,_0x5bae1f[_0x0523('0x3d')]);var _0x17cfce={'where':_0x318289['where']};return db[_0x0523('0x2b')][_0x0523('0x1e')](_0x17cfce)[_0x0523('0x22')](function(_0x1eefb5){_0x50b74e[_0x0523('0x1e')]=_0x1eefb5;if(_0x5bae1f[_0x0523('0x31')][_0x0523('0x3e')]){_0x318289[_0x0523('0x3f')]=[{'all':!![]}];}return db[_0x0523('0x2b')][_0x0523('0x40')](_0x318289);})['then'](function(_0x5e7672){_0x50b74e['rows']=_0x5e7672;return _0x50b74e;})[_0x0523('0x22')](respondWithFilteredResult(_0x146861,_0x318289))[_0x0523('0x41')](handleError(_0x146861,null));};exports[_0x0523('0x42')]=function(_0x4729be,_0x55f0e1){var _0x2b2493={'raw':!![],'where':{'id':_0x4729be['params']['id']}},_0x2d2a31={};_0x2d2a31[_0x0523('0x2f')]=_[_0x0523('0x43')](db[_0x0523('0x2b')]['rawAttributes']);_0x2d2a31[_0x0523('0x31')]=_[_0x0523('0x43')](_0x4729be['query']);_0x2d2a31[_0x0523('0x32')]=_[_0x0523('0x33')](_0x2d2a31[_0x0523('0x2f')],_0x2d2a31[_0x0523('0x31')]);_0x2b2493[_0x0523('0x35')]=_[_0x0523('0x33')](_0x2d2a31[_0x0523('0x2f')],qs['fields'](_0x4729be[_0x0523('0x31')]['fields']));_0x2b2493[_0x0523('0x35')]=_0x2b2493[_0x0523('0x35')][_0x0523('0x44')]?_0x2b2493['attributes']:_0x2d2a31[_0x0523('0x2f')];if(_0x4729be[_0x0523('0x31')][_0x0523('0x3e')]){_0x2b2493[_0x0523('0x3f')]=[{'all':!![]}];}_0x2b2493=_[_0x0523('0x3c')]({},_0x2b2493,_0x4729be[_0x0523('0x3d')]);return db['CmContactHasItem'][_0x0523('0x45')](_0x2b2493)[_0x0523('0x22')](handleEntityNotFound(_0x55f0e1,null))[_0x0523('0x22')](respondWithResult(_0x55f0e1,null))[_0x0523('0x41')](handleError(_0x55f0e1,null));};exports[_0x0523('0x46')]=function(_0x26387b,_0x4e8a55){return db[_0x0523('0x2b')]['create'](_0x26387b[_0x0523('0x47')],{})[_0x0523('0x22')](function(_0x44df1f){var _0x310906=_0x26387b[_0x0523('0x48')][_0x0523('0x23')]({'plain':!![]});if(!_0x310906)throw new Error(_0x0523('0x49'));if(_0x310906[_0x0523('0x4a')]==='user'){var _0x548647=_0x44df1f['get']({'plain':!![]});var _0x2fe53d='CmContactHasItems';return db[_0x0523('0x4b')]['find']({'where':{'name':_0x2fe53d,'userProfileId':_0x310906['userProfileId']},'raw':!![]})[_0x0523('0x22')](function(_0x2f6855){if(_0x2f6855&&_0x2f6855[_0x0523('0x4c')]===0x0){return db[_0x0523('0x25')]['create']({'name':_0x548647[_0x0523('0x28')],'resourceId':_0x548647['id'],'type':_0x2f6855[_0x0523('0x28')],'sectionId':_0x2f6855['id']},{})[_0x0523('0x22')](function(){return _0x44df1f;});}else{return _0x44df1f;}})[_0x0523('0x41')](function(_0x4b80ad){logger[_0x0523('0x27')](_0x0523('0x4d'),_0x4b80ad);throw _0x4b80ad;});}return _0x44df1f;})[_0x0523('0x22')](respondWithResult(_0x4e8a55,0xc9))[_0x0523('0x41')](handleError(_0x4e8a55,null));};exports[_0x0523('0x4e')]=function(_0x3e274b,_0x346019){if(_0x3e274b[_0x0523('0x47')]['id']){delete _0x3e274b[_0x0523('0x47')]['id'];}return db['CmContactHasItem'][_0x0523('0x45')]({'where':{'id':_0x3e274b['params']['id']}})[_0x0523('0x22')](handleEntityNotFound(_0x346019,null))[_0x0523('0x22')](saveUpdates(_0x3e274b['body'],null))[_0x0523('0x22')](respondWithResult(_0x346019,null))[_0x0523('0x41')](handleError(_0x346019,null));};exports[_0x0523('0x26')]=function(_0x3f937f,_0xfbbe8f){return db[_0x0523('0x2b')]['find']({'where':{'id':_0x3f937f['params']['id']}})[_0x0523('0x22')](handleEntityNotFound(_0xfbbe8f,null))[_0x0523('0x22')](removeEntity(_0xfbbe8f,null))[_0x0523('0x41')](handleError(_0xfbbe8f,null));}; \ No newline at end of file +var _0x8fff=['ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','undefined','count','set','reject','update','destroy','then','UserProfileResource','end','error','stack','name','index','map','CmContactHasItem','fieldName','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','keys','rawAttributes','find','create','body','user','get','role','CmContactHasItems','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse'];(function(_0x292a48,_0xb843c3){var _0x2b1a2d=function(_0x184ccd){while(--_0x184ccd){_0x292a48['push'](_0x292a48['shift']());}};_0x2b1a2d(++_0xb843c3);}(_0x8fff,0x1ac));var _0xf8ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fff[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf8ff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf8ff('0x1'));var jsonpatch=require(_0xf8ff('0x2'));var rp=require(_0xf8ff('0x3'));var moment=require(_0xf8ff('0x4'));var BPromise=require(_0xf8ff('0x5'));var Mustache=require(_0xf8ff('0x6'));var util=require(_0xf8ff('0x7'));var path=require('path');var sox=require(_0xf8ff('0x8'));var csv=require('to-csv');var ejs=require(_0xf8ff('0x9'));var fs=require('fs');var fs_extra=require(_0xf8ff('0xa'));var _=require('lodash');var squel=require(_0xf8ff('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf8ff('0xc'));var toCsv=require(_0xf8ff('0xd'));var querystring=require(_0xf8ff('0xe'));var Papa=require(_0xf8ff('0xf'));var Redis=require(_0xf8ff('0x10'));var authService=require(_0xf8ff('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf8ff('0x12'));var utils=require(_0xf8ff('0x13'));var config=require(_0xf8ff('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f13f2,_0x343700){_0x343700=_0x343700||0xcc;return function(_0x33f540){if(_0x33f540){return _0x2f13f2[_0xf8ff('0x15')](_0x343700);}return _0x2f13f2[_0xf8ff('0x16')](_0x343700)['end']();};}function respondWithResult(_0x514323,_0x30f28c){_0x30f28c=_0x30f28c||0xc8;return function(_0x249b2d){if(_0x249b2d){return _0x514323[_0xf8ff('0x16')](_0x30f28c)[_0xf8ff('0x17')](_0x249b2d);}};}function respondWithFilteredResult(_0x4db919,_0x5ea406){return function(_0x34f93b){if(_0x34f93b){var _0x201ed9=typeof _0x5ea406[_0xf8ff('0x18')]==='undefined'&&typeof _0x5ea406[_0xf8ff('0x19')]===_0xf8ff('0x1a');var _0x62e52f=_0x34f93b[_0xf8ff('0x1b')];var _0x1a8be1=_0x201ed9?0x0:_0x5ea406[_0xf8ff('0x18')];var _0x212f61=_0x201ed9?_0x34f93b[_0xf8ff('0x1b')]:_0x5ea406[_0xf8ff('0x18')]+_0x5ea406[_0xf8ff('0x19')];var _0x5d6d9a;if(_0x212f61>=_0x62e52f){_0x212f61=_0x62e52f;_0x5d6d9a=0xc8;}else{_0x5d6d9a=0xce;}_0x4db919[_0xf8ff('0x16')](_0x5d6d9a);return _0x4db919[_0xf8ff('0x1c')]('Content-Range',_0x1a8be1+'-'+_0x212f61+'/'+_0x62e52f)[_0xf8ff('0x17')](_0x34f93b);}return null;};}function patchUpdates(_0x193f28){return function(_0x4ec53f){try{jsonpatch['apply'](_0x4ec53f,_0x193f28,!![]);}catch(_0x3d6dc2){return BPromise[_0xf8ff('0x1d')](_0x3d6dc2);}return _0x4ec53f['save']();};}function saveUpdates(_0x3f6449,_0x32d2df){return function(_0x307d91){if(_0x307d91){return _0x307d91[_0xf8ff('0x1e')](_0x3f6449)['then'](function(_0x4ae326){return _0x4ae326;});}return null;};}function removeEntity(_0x45b999,_0x58509d){return function(_0x549de1){if(_0x549de1){return _0x549de1[_0xf8ff('0x1f')]()[_0xf8ff('0x20')](function(){var _0x4e5980=_0x549de1['get']({'plain':!![]});var _0x6c6c6b='CmContactHasItems';return db[_0xf8ff('0x21')][_0xf8ff('0x1f')]({'where':{'type':_0x6c6c6b,'resourceId':_0x4e5980['id']}})[_0xf8ff('0x20')](function(){return _0x549de1;});})['then'](function(){_0x45b999['status'](0xcc)[_0xf8ff('0x22')]();});}};}function handleEntityNotFound(_0x2930bb,_0x2a9ef0){return function(_0xdb8828){if(!_0xdb8828){_0x2930bb[_0xf8ff('0x15')](0x194);}return _0xdb8828;};}function handleError(_0xe88fd6,_0x4bcb3a){_0x4bcb3a=_0x4bcb3a||0x1f4;return function(_0x48423d){logger[_0xf8ff('0x23')](_0x48423d[_0xf8ff('0x24')]);if(_0x48423d[_0xf8ff('0x25')]){delete _0x48423d[_0xf8ff('0x25')];}_0xe88fd6[_0xf8ff('0x16')](_0x4bcb3a)['send'](_0x48423d);};}exports[_0xf8ff('0x26')]=function(_0x1ffcc7,_0x352617){var _0x1a1228={},_0x3b74af={},_0x1ff9bf={'count':0x0,'rows':[]};var _0x7dfc5=_[_0xf8ff('0x27')](db[_0xf8ff('0x28')]['rawAttributes'],function(_0x326207){return{'name':_0x326207[_0xf8ff('0x29')],'type':_0x326207['type']['key']};});_0x3b74af[_0xf8ff('0x2a')]=_['map'](_0x7dfc5,_0xf8ff('0x25'));_0x3b74af['query']=_['keys'](_0x1ffcc7[_0xf8ff('0x2b')]);_0x3b74af[_0xf8ff('0x2c')]=_['intersection'](_0x3b74af[_0xf8ff('0x2a')],_0x3b74af[_0xf8ff('0x2b')]);_0x1a1228[_0xf8ff('0x2d')]=_[_0xf8ff('0x2e')](_0x3b74af[_0xf8ff('0x2a')],qs[_0xf8ff('0x2f')](_0x1ffcc7['query']['fields']));_0x1a1228['attributes']=_0x1a1228[_0xf8ff('0x2d')]['length']?_0x1a1228[_0xf8ff('0x2d')]:_0x3b74af[_0xf8ff('0x2a')];if(!_0x1ffcc7[_0xf8ff('0x2b')][_0xf8ff('0x30')](_0xf8ff('0x31'))){_0x1a1228[_0xf8ff('0x19')]=qs[_0xf8ff('0x19')](_0x1ffcc7[_0xf8ff('0x2b')][_0xf8ff('0x19')]);_0x1a1228[_0xf8ff('0x18')]=qs[_0xf8ff('0x18')](_0x1ffcc7[_0xf8ff('0x2b')][_0xf8ff('0x18')]);}_0x1a1228[_0xf8ff('0x32')]=qs[_0xf8ff('0x33')](_0x1ffcc7[_0xf8ff('0x2b')]['sort']);_0x1a1228[_0xf8ff('0x34')]=qs['filters'](_[_0xf8ff('0x35')](_0x1ffcc7[_0xf8ff('0x2b')],_0x3b74af[_0xf8ff('0x2c')]),_0x7dfc5);if(_0x1ffcc7[_0xf8ff('0x2b')][_0xf8ff('0x36')]){_0x1a1228[_0xf8ff('0x34')]=_[_0xf8ff('0x37')](_0x1a1228[_0xf8ff('0x34')],{'$or':_['map'](_0x7dfc5,function(_0x5dff64){if(_0x5dff64[_0xf8ff('0x38')]!=='VIRTUAL'){var _0x7ea15b={};_0x7ea15b[_0x5dff64[_0xf8ff('0x25')]]={'$like':'%'+_0x1ffcc7['query'][_0xf8ff('0x36')]+'%'};return _0x7ea15b;}})});}_0x1a1228=_[_0xf8ff('0x37')]({},_0x1a1228,_0x1ffcc7[_0xf8ff('0x39')]);var _0x2f342c={'where':_0x1a1228[_0xf8ff('0x34')]};return db[_0xf8ff('0x28')][_0xf8ff('0x1b')](_0x2f342c)[_0xf8ff('0x20')](function(_0x47d62b){_0x1ff9bf[_0xf8ff('0x1b')]=_0x47d62b;if(_0x1ffcc7['query'][_0xf8ff('0x3a')]){_0x1a1228[_0xf8ff('0x3b')]=[{'all':!![]}];}return db[_0xf8ff('0x28')][_0xf8ff('0x3c')](_0x1a1228);})[_0xf8ff('0x20')](function(_0x502c6a){_0x1ff9bf['rows']=_0x502c6a;return _0x1ff9bf;})[_0xf8ff('0x20')](respondWithFilteredResult(_0x352617,_0x1a1228))[_0xf8ff('0x3d')](handleError(_0x352617,null));};exports['show']=function(_0xfbd8b4,_0x41c696){var _0x2f40db={'raw':!![],'where':{'id':_0xfbd8b4['params']['id']}},_0x2bd90b={};_0x2bd90b[_0xf8ff('0x2a')]=_[_0xf8ff('0x3e')](db[_0xf8ff('0x28')][_0xf8ff('0x3f')]);_0x2bd90b[_0xf8ff('0x2b')]=_[_0xf8ff('0x3e')](_0xfbd8b4['query']);_0x2bd90b[_0xf8ff('0x2c')]=_[_0xf8ff('0x2e')](_0x2bd90b['model'],_0x2bd90b[_0xf8ff('0x2b')]);_0x2f40db['attributes']=_[_0xf8ff('0x2e')](_0x2bd90b[_0xf8ff('0x2a')],qs[_0xf8ff('0x2f')](_0xfbd8b4['query'][_0xf8ff('0x2f')]));_0x2f40db[_0xf8ff('0x2d')]=_0x2f40db[_0xf8ff('0x2d')]['length']?_0x2f40db['attributes']:_0x2bd90b[_0xf8ff('0x2a')];if(_0xfbd8b4['query']['includeAll']){_0x2f40db[_0xf8ff('0x3b')]=[{'all':!![]}];}_0x2f40db=_[_0xf8ff('0x37')]({},_0x2f40db,_0xfbd8b4[_0xf8ff('0x39')]);return db[_0xf8ff('0x28')][_0xf8ff('0x40')](_0x2f40db)['then'](handleEntityNotFound(_0x41c696,null))['then'](respondWithResult(_0x41c696,null))[_0xf8ff('0x3d')](handleError(_0x41c696,null));};exports['create']=function(_0x4ae4eb,_0x33d11b){return db[_0xf8ff('0x28')][_0xf8ff('0x41')](_0x4ae4eb[_0xf8ff('0x42')],{})[_0xf8ff('0x20')](function(_0x246bf3){var _0x436742=_0x4ae4eb[_0xf8ff('0x43')][_0xf8ff('0x44')]({'plain':!![]});if(!_0x436742)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x436742[_0xf8ff('0x45')]==='user'){var _0x2f257d=_0x246bf3[_0xf8ff('0x44')]({'plain':!![]});var _0x290d91=_0xf8ff('0x46');return db[_0xf8ff('0x47')][_0xf8ff('0x40')]({'where':{'name':_0x290d91,'userProfileId':_0x436742['userProfileId']},'raw':!![]})['then'](function(_0x2b77f7){if(_0x2b77f7&&_0x2b77f7['autoAssociation']===0x0){return db[_0xf8ff('0x21')][_0xf8ff('0x41')]({'name':_0x2f257d[_0xf8ff('0x25')],'resourceId':_0x2f257d['id'],'type':_0x2b77f7[_0xf8ff('0x25')],'sectionId':_0x2b77f7['id']},{})[_0xf8ff('0x20')](function(){return _0x246bf3;});}else{return _0x246bf3;}})[_0xf8ff('0x3d')](function(_0x56a7ed){logger[_0xf8ff('0x23')](_0xf8ff('0x48'),_0x56a7ed);throw _0x56a7ed;});}return _0x246bf3;})[_0xf8ff('0x20')](respondWithResult(_0x33d11b,0xc9))[_0xf8ff('0x3d')](handleError(_0x33d11b,null));};exports['update']=function(_0x36b5d8,_0x396877){if(_0x36b5d8[_0xf8ff('0x42')]['id']){delete _0x36b5d8['body']['id'];}return db['CmContactHasItem'][_0xf8ff('0x40')]({'where':{'id':_0x36b5d8[_0xf8ff('0x49')]['id']}})[_0xf8ff('0x20')](handleEntityNotFound(_0x396877,null))[_0xf8ff('0x20')](saveUpdates(_0x36b5d8[_0xf8ff('0x42')],null))[_0xf8ff('0x20')](respondWithResult(_0x396877,null))['catch'](handleError(_0x396877,null));};exports[_0xf8ff('0x1f')]=function(_0x1e21f0,_0x460306){return db[_0xf8ff('0x28')][_0xf8ff('0x40')]({'where':{'id':_0x1e21f0[_0xf8ff('0x49')]['id']}})[_0xf8ff('0x20')](handleEntityNotFound(_0x460306,null))['then'](removeEntity(_0x460306,null))[_0xf8ff('0x3d')](handleError(_0x460306,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 48805b9..79893f0 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 _0x9b10=['rimraf','exports','define','CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5a3cf6,_0x10a82f){var _0x5de42b=function(_0x16727f){while(--_0x16727f){_0x5a3cf6['push'](_0x5a3cf6['shift']());}};_0x5de42b(++_0x10a82f);}(_0x9b10,0x15a));var _0x09b1=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9b10[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x09b1('0x0'));var util=require('util');var logger=require(_0x09b1('0x1'))(_0x09b1('0x2'));var moment=require(_0x09b1('0x3'));var BPromise=require(_0x09b1('0x4'));var rp=require(_0x09b1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x09b1('0x6'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x09b1('0x7')]=function(_0xbdcec4,_0x2361a3){return _0xbdcec4[_0x09b1('0x8')](_0x09b1('0x9'),attributes,{'tableName':_0x09b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85be=['rimraf','./cmContactHasItem.attributes','exports','define','cm_contact_has_items','lodash','util','api','moment','request-promise','path'];(function(_0x5e6c43,_0x132a12){var _0x23d90e=function(_0x279b49){while(--_0x279b49){_0x5e6c43['push'](_0x5e6c43['shift']());}};_0x23d90e(++_0x132a12);}(_0x85be,0x1c8));var _0xe85b=function(_0x2d4ed0,_0x4692e9){_0x2d4ed0=_0x2d4ed0-0x0;var _0x23bb55=_0x85be[_0x2d4ed0];return _0x23bb55;};'use strict';var _=require(_0xe85b('0x0'));var util=require(_0xe85b('0x1'));var logger=require('../../config/logger')(_0xe85b('0x2'));var moment=require(_0xe85b('0x3'));var BPromise=require('bluebird');var rp=require(_0xe85b('0x4'));var fs=require('fs');var path=require(_0xe85b('0x5'));var rimraf=require(_0xe85b('0x6'));var config=require('../../config/environment');var attributes=require(_0xe85b('0x7'));module[_0xe85b('0x8')]=function(_0x32c3e9,_0x1fa0e1){return _0x32c3e9[_0xe85b('0x9')]('CmContactHasItem',attributes,{'tableName':_0xe85b('0xa'),'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 4e6973b..6e48a65 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 _0xf103=['util','moment','randomstring','ioredis','../../config/logger','client','http','request','then','info','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','catch','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf103,0x8b));var _0x3f10=function(_0x3685d1,_0x30868b){_0x3685d1=_0x3685d1-0x0;var _0x35e9cc=_0xf103[_0x3685d1];return _0x35e9cc;};'use strict';var _=require(_0x3f10('0x0'));var util=require(_0x3f10('0x1'));var moment=require(_0x3f10('0x2'));var BPromise=require('bluebird');var rs=require(_0x3f10('0x3'));var fs=require('fs');var Redis=require(_0x3f10('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3f10('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f10('0x6')][_0x3f10('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x285746,_0x1c67dd,_0x57b7c8){return new BPromise(function(_0x3ee355,_0x3b3865){return client[_0x3f10('0x8')](_0x285746,_0x57b7c8)[_0x3f10('0x9')](function(_0x5b7ffe){logger[_0x3f10('0xa')]('CmContactHasItem,\x20%s,\x20%s',_0x1c67dd,'request\x20sent');logger[_0x3f10('0xb')](_0x3f10('0xc'),_0x1c67dd,_0x3f10('0xd'),JSON[_0x3f10('0xe')](_0x5b7ffe));if(_0x5b7ffe['error']){if(_0x5b7ffe[_0x3f10('0xf')][_0x3f10('0x10')]===0x1f4){logger[_0x3f10('0xf')](_0x3f10('0x11'),_0x1c67dd,_0x5b7ffe[_0x3f10('0xf')][_0x3f10('0x12')]);return _0x3b3865(_0x5b7ffe[_0x3f10('0xf')]['message']);}logger[_0x3f10('0xf')](_0x3f10('0x11'),_0x1c67dd,_0x5b7ffe[_0x3f10('0xf')]['message']);return _0x3ee355(_0x5b7ffe['error']['message']);}else{logger[_0x3f10('0xa')](_0x3f10('0x11'),_0x1c67dd,_0x3f10('0xd'));_0x3ee355(_0x5b7ffe['result'][_0x3f10('0x12')]);}})[_0x3f10('0x13')](function(_0x94266a){logger['error'](_0x3f10('0x11'),_0x1c67dd,_0x94266a);_0x3b3865(_0x94266a);});});} \ No newline at end of file +var _0x78c1=['jayson/promise','client','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3d6533,_0x594c70){var _0x25dc67=function(_0xe7d925){while(--_0xe7d925){_0x3d6533['push'](_0x3d6533['shift']());}};_0x25dc67(++_0x594c70);}(_0x78c1,0x19d));var _0x178c=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x78c1[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x178c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x178c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x178c('0x2'));var db=require(_0x178c('0x3'))['db'];var utils=require(_0x178c('0x4'));var logger=require('../../config/logger')(_0x178c('0x5'));var config=require(_0x178c('0x6'));var jayson=require(_0x178c('0x7'));var client=jayson[_0x178c('0x8')][_0x178c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12171e,_0x41ade0,_0x475ccf){return new BPromise(function(_0x171bf1,_0x9b53ab){return client[_0x178c('0xa')](_0x12171e,_0x475ccf)['then'](function(_0x451874){logger[_0x178c('0xb')](_0x178c('0xc'),_0x41ade0,_0x178c('0xd'));logger['debug'](_0x178c('0xe'),_0x41ade0,_0x178c('0xd'),JSON[_0x178c('0xf')](_0x451874));if(_0x451874['error']){if(_0x451874[_0x178c('0x10')][_0x178c('0x11')]===0x1f4){logger[_0x178c('0x10')](_0x178c('0xc'),_0x41ade0,_0x451874[_0x178c('0x10')][_0x178c('0x12')]);return _0x9b53ab(_0x451874[_0x178c('0x10')][_0x178c('0x12')]);}logger[_0x178c('0x10')](_0x178c('0xc'),_0x41ade0,_0x451874[_0x178c('0x10')][_0x178c('0x12')]);return _0x171bf1(_0x451874[_0x178c('0x10')]['message']);}else{logger[_0x178c('0xb')](_0x178c('0xc'),_0x41ade0,_0x178c('0xd'));_0x171bf1(_0x451874[_0x178c('0x13')]['message']);}})['catch'](function(_0x2bbd28){logger[_0x178c('0x10')](_0x178c('0xc'),_0x41ade0,_0x2bbd28);_0x9b53ab(_0x2bbd28);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 0c2bbe6..548d2e6 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 _0x7899=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x12ea80,_0x4656df){var _0x382c43=function(_0x3635e2){while(--_0x3635e2){_0x12ea80['push'](_0x12ea80['shift']());}};_0x382c43(++_0x4656df);}(_0x7899,0x168));var _0x9789=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0x7899[_0x272d90];return _0x2bf4a2;};'use strict';var multer=require(_0x9789('0x0'));var util=require(_0x9789('0x1'));var path=require(_0x9789('0x2'));var timeout=require(_0x9789('0x3'));var express=require(_0x9789('0x4'));var router=express[_0x9789('0x5')]();var fs_extra=require(_0x9789('0x6'));var auth=require(_0x9789('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9789('0x8'));var controller=require('./cmContactHasItem.controller');router[_0x9789('0x9')]('/',auth[_0x9789('0xa')](),controller[_0x9789('0xb')]);router['get'](_0x9789('0xc'),auth['isAuthenticated'](),controller[_0x9789('0xd')]);router[_0x9789('0xe')]('/',auth[_0x9789('0xa')](),controller[_0x9789('0xf')]);router[_0x9789('0x10')](_0x9789('0xc'),auth[_0x9789('0xa')](),controller[_0x9789('0x11')]);router[_0x9789('0x12')](_0x9789('0xc'),auth[_0x9789('0xa')](),controller[_0x9789('0x13')]);module[_0x9789('0x14')]=router; \ No newline at end of file +var _0x478d=['create','put','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x4ad9e3,_0x287e3c){var _0x42134b=function(_0x31b916){while(--_0x31b916){_0x4ad9e3['push'](_0x4ad9e3['shift']());}};_0x42134b(++_0x287e3c);}(_0x478d,0x89));var _0xd478=function(_0x3bd6c4,_0x2f5e7e){_0x3bd6c4=_0x3bd6c4-0x0;var _0x43018a=_0x478d[_0x3bd6c4];return _0x43018a;};'use strict';var multer=require(_0xd478('0x0'));var util=require(_0xd478('0x1'));var path=require(_0xd478('0x2'));var timeout=require(_0xd478('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd478('0x4'));var auth=require(_0xd478('0x5'));var interaction=require(_0xd478('0x6'));var config=require(_0xd478('0x7'));var controller=require(_0xd478('0x8'));router[_0xd478('0x9')]('/',auth[_0xd478('0xa')](),controller[_0xd478('0xb')]);router[_0xd478('0x9')](_0xd478('0xc'),auth['isAuthenticated'](),controller[_0xd478('0xd')]);router[_0xd478('0xe')]('/',auth[_0xd478('0xa')](),controller[_0xd478('0xf')]);router[_0xd478('0x10')](_0xd478('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd478('0xc'),auth['isAuthenticated'](),controller[_0xd478('0x11')]);module[_0xd478('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 59fd765..7952d53 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 _0x9232=['sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','TEXT','long','type','select','parse','values','BOOLEAN','ENUM','voice'];(function(_0x33fc8d,_0x358809){var _0x28d830=function(_0x4897d3){while(--_0x4897d3){_0x33fc8d['push'](_0x33fc8d['shift']());}};_0x28d830(++_0x358809);}(_0x9232,0x165));var _0x2923=function(_0x9c8b20,_0x9b8963){_0x9c8b20=_0x9c8b20-0x0;var _0x21c78d=_0x9232[_0x9c8b20];return _0x21c78d;};'use strict';var Sequelize=require(_0x2923('0x0'));var _=require(_0x2923('0x1'));module[_0x2923('0x2')]={'name':{'type':Sequelize[_0x2923('0x3')],'get':function(_0x544b86){return this[_0x2923('0x4')](_0x2923('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3de269){this[_0x2923('0x6')](_0x2923('0x5'),_0x3de269?_0x3de269:this['getDataValue'](_0x2923('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x2923('0x8')](_0x2923('0x9')),'get':function(){if(this[_0x2923('0x4')](_0x2923('0xa'))===_0x2923('0xb')){return JSON[_0x2923('0xc')](this[_0x2923('0x4')]('values'));}else{return this[_0x2923('0x4')](_0x2923('0xd'));}},'set':function(_0x4ef9cc){if(Array['isArray'](_0x4ef9cc)){this[_0x2923('0x6')](_0x2923('0xd'),JSON['stringify'](_0x4ef9cc));}else{this[_0x2923('0x6')]('values',_0x4ef9cc);}}},'required':{'type':Sequelize[_0x2923('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x2923('0xf')](_0x2923('0x10'))}}; \ No newline at end of file +var _0x2681=['values','stringify','BOOLEAN','ENUM','voice','lodash','getDataValue','STRING','setDataValue','alias','TEXT','select','parse'];(function(_0x134857,_0x26e253){var _0x34808c=function(_0x19ab3b){while(--_0x19ab3b){_0x134857['push'](_0x134857['shift']());}};_0x34808c(++_0x26e253);}(_0x2681,0xc8));var _0x1268=function(_0x5c9044,_0x4d8595){_0x5c9044=_0x5c9044-0x0;var _0x300857=_0x2681[_0x5c9044];return _0x300857;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1268('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x38c8bf){return this[_0x1268('0x1')]('alias');}},'alias':{'type':Sequelize[_0x1268('0x2')],'allowNull':![],'set':function(_0x26c5b1){this[_0x1268('0x3')](_0x1268('0x4'),_0x26c5b1?_0x26c5b1:this[_0x1268('0x1')]('name'));}},'type':{'type':Sequelize[_0x1268('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0x1268('0x5')]('long'),'get':function(){if(this[_0x1268('0x1')]('type')===_0x1268('0x6')){return JSON[_0x1268('0x7')](this['getDataValue']('values'));}else{return this[_0x1268('0x1')](_0x1268('0x8'));}},'set':function(_0x4ce17f){if(Array['isArray'](_0x4ce17f)){this['setDataValue'](_0x1268('0x8'),JSON[_0x1268('0x9')](_0x4ce17f));}else{this[_0x1268('0x3')](_0x1268('0x8'),_0x4ce17f);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1268('0xa')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1268('0xb')](_0x1268('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index f3f5854..dadafdf 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 _0x4282=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','offset','limit','undefined','count','set','Content-Range','json','save','update','then','destroy','sendStatus','error','stack','name','send','map','CmCustomField','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','rawAttributes','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d'];(function(_0x4ef600,_0x97aecd){var _0x27c11a=function(_0x5208ed){while(--_0x5208ed){_0x4ef600['push'](_0x4ef600['shift']());}};_0x27c11a(++_0x97aecd);}(_0x4282,0x168));var _0x2428=function(_0x41cfa5,_0x41b8ef){_0x41cfa5=_0x41cfa5-0x0;var _0xae5fd7=_0x4282[_0x41cfa5];return _0xae5fd7;};'use strict';var emlformat=require(_0x2428('0x0'));var rimraf=require(_0x2428('0x1'));var zipdir=require(_0x2428('0x2'));var jsonpatch=require(_0x2428('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2428('0x4'));var Mustache=require(_0x2428('0x5'));var util=require(_0x2428('0x6'));var path=require(_0x2428('0x7'));var sox=require(_0x2428('0x8'));var csv=require(_0x2428('0x9'));var ejs=require(_0x2428('0xa'));var fs=require('fs');var fs_extra=require(_0x2428('0xb'));var _=require(_0x2428('0xc'));var squel=require(_0x2428('0xd'));var crypto=require(_0x2428('0xe'));var jsforce=require(_0x2428('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2428('0x10'));var Papa=require(_0x2428('0x11'));var Redis=require(_0x2428('0x12'));var authService=require(_0x2428('0x13'));var qs=require(_0x2428('0x14'));var as=require(_0x2428('0x15'));var hardwareService=require(_0x2428('0x16'));var logger=require(_0x2428('0x17'))(_0x2428('0x18'));var utils=require('../../config/utils');var config=require(_0x2428('0x19'));var licenseUtil=require(_0x2428('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f95d2,_0x1d93b9){_0x1d93b9=_0x1d93b9||0xcc;return function(_0x40e715){if(_0x40e715){return _0x3f95d2['sendStatus'](_0x1d93b9);}return _0x3f95d2['status'](_0x1d93b9)[_0x2428('0x1b')]();};}function respondWithResult(_0x361222,_0x29db8e){_0x29db8e=_0x29db8e||0xc8;return function(_0x5e10b0){if(_0x5e10b0){return _0x361222[_0x2428('0x1c')](_0x29db8e)['json'](_0x5e10b0);}};}function respondWithFilteredResult(_0x3be097,_0x194188){return function(_0x44d39c){if(_0x44d39c){var _0x5f8570=typeof _0x194188[_0x2428('0x1d')]==='undefined'&&typeof _0x194188[_0x2428('0x1e')]===_0x2428('0x1f');var _0x59d53e=_0x44d39c['count'];var _0x21495c=_0x5f8570?0x0:_0x194188[_0x2428('0x1d')];var _0x26710e=_0x5f8570?_0x44d39c[_0x2428('0x20')]:_0x194188[_0x2428('0x1d')]+_0x194188[_0x2428('0x1e')];var _0x11b419;if(_0x26710e>=_0x59d53e){_0x26710e=_0x59d53e;_0x11b419=0xc8;}else{_0x11b419=0xce;}_0x3be097['status'](_0x11b419);return _0x3be097[_0x2428('0x21')](_0x2428('0x22'),_0x21495c+'-'+_0x26710e+'/'+_0x59d53e)[_0x2428('0x23')](_0x44d39c);}return null;};}function patchUpdates(_0x285639){return function(_0x48c1c2){try{jsonpatch['apply'](_0x48c1c2,_0x285639,!![]);}catch(_0x156197){return BPromise['reject'](_0x156197);}return _0x48c1c2[_0x2428('0x24')]();};}function saveUpdates(_0x410193,_0x54e172){return function(_0x155c40){if(_0x155c40){return _0x155c40[_0x2428('0x25')](_0x410193)[_0x2428('0x26')](function(_0x37218b){return _0x37218b;});}return null;};}function removeEntity(_0x3eb353,_0x12f225){return function(_0x2fb73e){if(_0x2fb73e){return _0x2fb73e[_0x2428('0x27')]()[_0x2428('0x26')](function(){_0x3eb353[_0x2428('0x1c')](0xcc)[_0x2428('0x1b')]();});}};}function handleEntityNotFound(_0x2b4155,_0x8ccb3b){return function(_0xa98392){if(!_0xa98392){_0x2b4155[_0x2428('0x28')](0x194);}return _0xa98392;};}function handleError(_0x451b8b,_0x43426b){_0x43426b=_0x43426b||0x1f4;return function(_0x3c5e1d){logger[_0x2428('0x29')](_0x3c5e1d[_0x2428('0x2a')]);if(_0x3c5e1d[_0x2428('0x2b')]){delete _0x3c5e1d[_0x2428('0x2b')];}_0x451b8b[_0x2428('0x1c')](_0x43426b)[_0x2428('0x2c')](_0x3c5e1d);};}exports['index']=function(_0x437032,_0x3f3bcc){var _0x548ffb={},_0x467af8={},_0x3defc9={'count':0x0,'rows':[]};var _0x3b18c0=_[_0x2428('0x2d')](db[_0x2428('0x2e')]['rawAttributes'],function(_0x3ae015){return{'name':_0x3ae015[_0x2428('0x2f')],'type':_0x3ae015[_0x2428('0x30')][_0x2428('0x31')]};});_0x467af8[_0x2428('0x32')]=_[_0x2428('0x33')](_[_0x2428('0x2d')](_0x3b18c0,'name'),[_0x2428('0x2b')]);_0x467af8['query']=_[_0x2428('0x34')](_0x437032[_0x2428('0x35')]);_0x467af8[_0x2428('0x36')]=_[_0x2428('0x37')](_0x467af8['model'],_0x467af8[_0x2428('0x35')]);_0x548ffb[_0x2428('0x38')]=_['intersection'](_0x467af8[_0x2428('0x32')],qs[_0x2428('0x39')](_0x437032[_0x2428('0x35')]['fields']));_0x548ffb['attributes']=_0x548ffb[_0x2428('0x38')]['length']?_0x548ffb[_0x2428('0x38')]:_0x467af8[_0x2428('0x32')];if(!_0x437032[_0x2428('0x35')][_0x2428('0x3a')](_0x2428('0x3b'))){_0x548ffb['limit']=qs[_0x2428('0x1e')](_0x437032[_0x2428('0x35')][_0x2428('0x1e')]);_0x548ffb[_0x2428('0x1d')]=qs[_0x2428('0x1d')](_0x437032[_0x2428('0x35')][_0x2428('0x1d')]);}_0x548ffb[_0x2428('0x3c')]=qs['sort'](_0x437032[_0x2428('0x35')][_0x2428('0x3d')]);_0x548ffb[_0x2428('0x3e')]=qs['filters'](_['pick'](_0x437032[_0x2428('0x35')],_0x467af8[_0x2428('0x36')]),_0x3b18c0);if(_0x437032[_0x2428('0x35')][_0x2428('0x3f')]){_0x548ffb[_0x2428('0x3e')]=_['merge'](_0x548ffb[_0x2428('0x3e')],{'$or':_[_0x2428('0x2d')](_0x3b18c0,function(_0x1a110d){if(_0x1a110d['type']!=='VIRTUAL'){var _0x5ac1fc={};_0x5ac1fc[_0x1a110d['name']]={'$like':'%'+_0x437032[_0x2428('0x35')]['filter']+'%'};return _0x5ac1fc;}})});}_0x548ffb=_[_0x2428('0x40')]({},_0x548ffb,_0x437032[_0x2428('0x41')]);var _0x10cd89={'where':_0x548ffb[_0x2428('0x3e')]};return db[_0x2428('0x2e')][_0x2428('0x20')](_0x10cd89)['then'](function(_0x3a9fc8){_0x3defc9[_0x2428('0x20')]=_0x3a9fc8;if(_0x437032[_0x2428('0x35')]['includeAll']){_0x548ffb[_0x2428('0x42')]=[{'all':!![]}];}return db['CmCustomField'][_0x2428('0x43')](_0x548ffb);})[_0x2428('0x26')](function(_0x6722d7){_0x3defc9[_0x2428('0x44')]=_0x6722d7;return _0x3defc9;})[_0x2428('0x26')](respondWithFilteredResult(_0x3f3bcc,_0x548ffb))[_0x2428('0x45')](handleError(_0x3f3bcc,null));};exports[_0x2428('0x46')]=function(_0x57a793,_0x108760){var _0x5d27a0={'raw':!![],'where':{'id':_0x57a793['params']['id']}},_0x3f183b={};_0x3f183b['model']=_[_0x2428('0x34')](db[_0x2428('0x2e')][_0x2428('0x47')]);_0x3f183b[_0x2428('0x35')]=_[_0x2428('0x34')](_0x57a793[_0x2428('0x35')]);_0x3f183b[_0x2428('0x36')]=_[_0x2428('0x37')](_0x3f183b[_0x2428('0x32')],_0x3f183b[_0x2428('0x35')]);_0x5d27a0['attributes']=_[_0x2428('0x37')](_0x3f183b[_0x2428('0x32')],qs[_0x2428('0x39')](_0x57a793[_0x2428('0x35')][_0x2428('0x39')]));_0x5d27a0[_0x2428('0x38')]=_0x5d27a0[_0x2428('0x38')]['length']?_0x5d27a0[_0x2428('0x38')]:_0x3f183b[_0x2428('0x32')];if(_0x57a793[_0x2428('0x35')]['includeAll']){_0x5d27a0[_0x2428('0x42')]=[{'all':!![]}];}_0x5d27a0=_[_0x2428('0x40')]({},_0x5d27a0,_0x57a793[_0x2428('0x41')]);return db[_0x2428('0x2e')][_0x2428('0x48')](_0x5d27a0)[_0x2428('0x26')](handleEntityNotFound(_0x108760,null))[_0x2428('0x26')](respondWithResult(_0x108760,null))['catch'](handleError(_0x108760,null));};exports[_0x2428('0x25')]=function(_0x53928f,_0x3c1dc1){if(_0x53928f[_0x2428('0x49')]['id']){delete _0x53928f['body']['id'];}return db[_0x2428('0x2e')][_0x2428('0x48')]({'where':{'id':_0x53928f[_0x2428('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3c1dc1,null))[_0x2428('0x26')](saveUpdates(_0x53928f[_0x2428('0x49')],null))[_0x2428('0x26')](respondWithResult(_0x3c1dc1,null))[_0x2428('0x45')](handleError(_0x3c1dc1,null));};exports[_0x2428('0x27')]=function(_0x54d949,_0x4fdc4e){return db[_0x2428('0x2e')][_0x2428('0x48')]({'where':{'id':_0x54d949[_0x2428('0x4a')]['id']}})[_0x2428('0x26')](handleEntityNotFound(_0x4fdc4e,null))['then'](removeEntity(_0x4fdc4e,null))[_0x2428('0x45')](handleError(_0x4fdc4e,null));};exports[_0x2428('0x4b')]=function(_0x3b5c32,_0x4c2744){var _0x2b325c;return db[_0x2428('0x4c')][_0x2428('0x4d')](function(_0x2d41e2){return db[_0x2428('0x2e')][_0x2428('0x4b')](_0x3b5c32['body'],{'transaction':_0x2d41e2})['then'](function(_0x56b3c9){_0x2b325c=_0x56b3c9;var _0x25098d={'type':db[_0x2428('0x4e')][_0x2428('0x4f')],'transaction':_0x2d41e2};switch(_0x3b5c32[_0x2428('0x49')][_0x2428('0x30')]){case _0x2428('0x50'):_0x25098d['type']=db[_0x2428('0x4e')][_0x2428('0x4f')];break;case _0x2428('0x51'):_0x25098d[_0x2428('0x30')]=db[_0x2428('0x4e')][_0x2428('0x52')];break;case _0x2428('0x53'):_0x25098d[_0x2428('0x30')]=db[_0x2428('0x4e')][_0x2428('0x54')];_0x25098d[_0x2428('0x55')]=![];break;default:}return db['sequelize'][_0x2428('0x56')][_0x2428('0x57')](_0x2428('0x58'),util['format'](_0x2428('0x59'),_0x2b325c['id']),_0x25098d);})[_0x2428('0x26')](function(){return _0x2b325c;});})[_0x2428('0x26')](respondWithResult(_0x4c2744,0xc9))[_0x2428('0x45')](handleError(_0x4c2744,null));}; \ No newline at end of file +var _0xea4e=['Sequelize','text','TEXT','number','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','update','then','destroy','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','body','create','transaction'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xea4e,0x160));var _0xeea4=function(_0x319fc1,_0x29179b){_0x319fc1=_0x319fc1-0x0;var _0xb768af=_0xea4e[_0x319fc1];return _0xb768af;};'use strict';var emlformat=require(_0xeea4('0x0'));var rimraf=require(_0xeea4('0x1'));var zipdir=require(_0xeea4('0x2'));var jsonpatch=require(_0xeea4('0x3'));var rp=require('request-promise');var moment=require(_0xeea4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeea4('0x5'));var util=require('util');var path=require(_0xeea4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeea4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeea4('0x8'));var squel=require(_0xeea4('0x9'));var crypto=require(_0xeea4('0xa'));var jsforce=require(_0xeea4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeea4('0xc'));var Papa=require('papaparse');var Redis=require(_0xeea4('0xd'));var authService=require(_0xeea4('0xe'));var qs=require(_0xeea4('0xf'));var as=require(_0xeea4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeea4('0x11'))(_0xeea4('0x12'));var utils=require(_0xeea4('0x13'));var config=require(_0xeea4('0x14'));var licenseUtil=require(_0xeea4('0x15'));var db=require(_0xeea4('0x16'))['db'];function respondWithStatusCode(_0x1457a9,_0x1f480a){_0x1f480a=_0x1f480a||0xcc;return function(_0x312a45){if(_0x312a45){return _0x1457a9[_0xeea4('0x17')](_0x1f480a);}return _0x1457a9['status'](_0x1f480a)[_0xeea4('0x18')]();};}function respondWithResult(_0x1c9ad0,_0x46510b){_0x46510b=_0x46510b||0xc8;return function(_0x184709){if(_0x184709){return _0x1c9ad0[_0xeea4('0x19')](_0x46510b)[_0xeea4('0x1a')](_0x184709);}};}function respondWithFilteredResult(_0x568c91,_0x5c8f3c){return function(_0x446417){if(_0x446417){var _0x577b48=typeof _0x5c8f3c[_0xeea4('0x1b')]==='undefined'&&typeof _0x5c8f3c[_0xeea4('0x1c')]===_0xeea4('0x1d');var _0x522fee=_0x446417['count'];var _0xd8aed1=_0x577b48?0x0:_0x5c8f3c[_0xeea4('0x1b')];var _0x28640a=_0x577b48?_0x446417[_0xeea4('0x1e')]:_0x5c8f3c[_0xeea4('0x1b')]+_0x5c8f3c[_0xeea4('0x1c')];var _0x219aac;if(_0x28640a>=_0x522fee){_0x28640a=_0x522fee;_0x219aac=0xc8;}else{_0x219aac=0xce;}_0x568c91[_0xeea4('0x19')](_0x219aac);return _0x568c91['set'](_0xeea4('0x1f'),_0xd8aed1+'-'+_0x28640a+'/'+_0x522fee)[_0xeea4('0x1a')](_0x446417);}return null;};}function patchUpdates(_0x239113){return function(_0x1c201f){try{jsonpatch[_0xeea4('0x20')](_0x1c201f,_0x239113,!![]);}catch(_0x84bfe6){return BPromise['reject'](_0x84bfe6);}return _0x1c201f['save']();};}function saveUpdates(_0x5737c0,_0x4715d1){return function(_0x53d495){if(_0x53d495){return _0x53d495[_0xeea4('0x21')](_0x5737c0)[_0xeea4('0x22')](function(_0x3fab45){return _0x3fab45;});}return null;};}function removeEntity(_0x71deb0,_0x223ba3){return function(_0x1c25fd){if(_0x1c25fd){return _0x1c25fd[_0xeea4('0x23')]()[_0xeea4('0x22')](function(){_0x71deb0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x76acfb,_0x35cabf){return function(_0xccadce){if(!_0xccadce){_0x76acfb[_0xeea4('0x17')](0x194);}return _0xccadce;};}function handleError(_0x4cdb16,_0x1cb614){_0x1cb614=_0x1cb614||0x1f4;return function(_0x42e747){logger[_0xeea4('0x24')](_0x42e747['stack']);if(_0x42e747[_0xeea4('0x25')]){delete _0x42e747['name'];}_0x4cdb16['status'](_0x1cb614)[_0xeea4('0x26')](_0x42e747);};}exports[_0xeea4('0x27')]=function(_0x273e29,_0x48e8f4){var _0x4ad0d1={},_0x22eacd={},_0x3b6e7a={'count':0x0,'rows':[]};var _0x2412e0=_[_0xeea4('0x28')](db[_0xeea4('0x29')][_0xeea4('0x2a')],function(_0x51dfe5){return{'name':_0x51dfe5[_0xeea4('0x2b')],'type':_0x51dfe5[_0xeea4('0x2c')][_0xeea4('0x2d')]};});_0x22eacd[_0xeea4('0x2e')]=_[_0xeea4('0x2f')](_[_0xeea4('0x28')](_0x2412e0,'name'),[_0xeea4('0x25')]);_0x22eacd['query']=_[_0xeea4('0x30')](_0x273e29[_0xeea4('0x31')]);_0x22eacd[_0xeea4('0x32')]=_[_0xeea4('0x33')](_0x22eacd['model'],_0x22eacd[_0xeea4('0x31')]);_0x4ad0d1['attributes']=_[_0xeea4('0x33')](_0x22eacd[_0xeea4('0x2e')],qs['fields'](_0x273e29[_0xeea4('0x31')][_0xeea4('0x34')]));_0x4ad0d1[_0xeea4('0x35')]=_0x4ad0d1[_0xeea4('0x35')][_0xeea4('0x36')]?_0x4ad0d1[_0xeea4('0x35')]:_0x22eacd[_0xeea4('0x2e')];if(!_0x273e29[_0xeea4('0x31')][_0xeea4('0x37')](_0xeea4('0x38'))){_0x4ad0d1[_0xeea4('0x1c')]=qs[_0xeea4('0x1c')](_0x273e29[_0xeea4('0x31')][_0xeea4('0x1c')]);_0x4ad0d1[_0xeea4('0x1b')]=qs[_0xeea4('0x1b')](_0x273e29[_0xeea4('0x31')]['offset']);}_0x4ad0d1[_0xeea4('0x39')]=qs['sort'](_0x273e29[_0xeea4('0x31')][_0xeea4('0x3a')]);_0x4ad0d1[_0xeea4('0x3b')]=qs[_0xeea4('0x32')](_[_0xeea4('0x3c')](_0x273e29[_0xeea4('0x31')],_0x22eacd['filters']),_0x2412e0);if(_0x273e29[_0xeea4('0x31')][_0xeea4('0x3d')]){_0x4ad0d1['where']=_['merge'](_0x4ad0d1['where'],{'$or':_['map'](_0x2412e0,function(_0x84a35f){if(_0x84a35f['type']!=='VIRTUAL'){var _0x41cede={};_0x41cede[_0x84a35f[_0xeea4('0x25')]]={'$like':'%'+_0x273e29[_0xeea4('0x31')][_0xeea4('0x3d')]+'%'};return _0x41cede;}})});}_0x4ad0d1=_[_0xeea4('0x3e')]({},_0x4ad0d1,_0x273e29[_0xeea4('0x3f')]);var _0xe605d8={'where':_0x4ad0d1[_0xeea4('0x3b')]};return db[_0xeea4('0x29')][_0xeea4('0x1e')](_0xe605d8)[_0xeea4('0x22')](function(_0x1295ac){_0x3b6e7a[_0xeea4('0x1e')]=_0x1295ac;if(_0x273e29['query'][_0xeea4('0x40')]){_0x4ad0d1[_0xeea4('0x41')]=[{'all':!![]}];}return db['CmCustomField'][_0xeea4('0x42')](_0x4ad0d1);})['then'](function(_0x3e96b1){_0x3b6e7a['rows']=_0x3e96b1;return _0x3b6e7a;})[_0xeea4('0x22')](respondWithFilteredResult(_0x48e8f4,_0x4ad0d1))[_0xeea4('0x43')](handleError(_0x48e8f4,null));};exports['show']=function(_0xd324a,_0x52073e){var _0x4d99ac={'raw':!![],'where':{'id':_0xd324a[_0xeea4('0x44')]['id']}},_0xa22820={};_0xa22820[_0xeea4('0x2e')]=_[_0xeea4('0x30')](db[_0xeea4('0x29')][_0xeea4('0x2a')]);_0xa22820[_0xeea4('0x31')]=_[_0xeea4('0x30')](_0xd324a[_0xeea4('0x31')]);_0xa22820[_0xeea4('0x32')]=_[_0xeea4('0x33')](_0xa22820['model'],_0xa22820['query']);_0x4d99ac['attributes']=_[_0xeea4('0x33')](_0xa22820[_0xeea4('0x2e')],qs[_0xeea4('0x34')](_0xd324a[_0xeea4('0x31')][_0xeea4('0x34')]));_0x4d99ac[_0xeea4('0x35')]=_0x4d99ac['attributes'][_0xeea4('0x36')]?_0x4d99ac[_0xeea4('0x35')]:_0xa22820[_0xeea4('0x2e')];if(_0xd324a[_0xeea4('0x31')][_0xeea4('0x40')]){_0x4d99ac[_0xeea4('0x41')]=[{'all':!![]}];}_0x4d99ac=_['merge']({},_0x4d99ac,_0xd324a[_0xeea4('0x3f')]);return db[_0xeea4('0x29')][_0xeea4('0x45')](_0x4d99ac)[_0xeea4('0x22')](handleEntityNotFound(_0x52073e,null))[_0xeea4('0x22')](respondWithResult(_0x52073e,null))[_0xeea4('0x43')](handleError(_0x52073e,null));};exports[_0xeea4('0x21')]=function(_0x3de4f9,_0x10cf09){if(_0x3de4f9[_0xeea4('0x46')]['id']){delete _0x3de4f9[_0xeea4('0x46')]['id'];}return db['CmCustomField'][_0xeea4('0x45')]({'where':{'id':_0x3de4f9['params']['id']}})[_0xeea4('0x22')](handleEntityNotFound(_0x10cf09,null))[_0xeea4('0x22')](saveUpdates(_0x3de4f9['body'],null))['then'](respondWithResult(_0x10cf09,null))[_0xeea4('0x43')](handleError(_0x10cf09,null));};exports[_0xeea4('0x23')]=function(_0x3a5ef7,_0x52aff9){return db[_0xeea4('0x29')]['find']({'where':{'id':_0x3a5ef7[_0xeea4('0x44')]['id']}})[_0xeea4('0x22')](handleEntityNotFound(_0x52aff9,null))['then'](removeEntity(_0x52aff9,null))[_0xeea4('0x43')](handleError(_0x52aff9,null));};exports[_0xeea4('0x47')]=function(_0x344621,_0x5c8821){var _0x2bd065;return db['sequelize'][_0xeea4('0x48')](function(_0x362c37){return db[_0xeea4('0x29')][_0xeea4('0x47')](_0x344621[_0xeea4('0x46')],{'transaction':_0x362c37})[_0xeea4('0x22')](function(_0x24f1f0){_0x2bd065=_0x24f1f0;var _0x341306={'type':db[_0xeea4('0x49')]['TEXT'],'transaction':_0x362c37};switch(_0x344621[_0xeea4('0x46')]['type']){case _0xeea4('0x4a'):_0x341306[_0xeea4('0x2c')]=db[_0xeea4('0x49')][_0xeea4('0x4b')];break;case _0xeea4('0x4c'):_0x341306[_0xeea4('0x2c')]=db[_0xeea4('0x49')]['INTEGER'];break;case _0xeea4('0x4d'):_0x341306['type']=db[_0xeea4('0x49')][_0xeea4('0x4e')];_0x341306[_0xeea4('0x4f')]=![];break;default:}return db[_0xeea4('0x50')][_0xeea4('0x51')][_0xeea4('0x52')](_0xeea4('0x53'),util['format'](_0xeea4('0x54'),_0x2bd065['id']),_0x341306);})['then'](function(){return _0x2bd065;});})[_0xeea4('0x22')](respondWithResult(_0x5c8821,0xc9))[_0xeea4('0x43')](handleError(_0x5c8821,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 6165555..fc1f4c0 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 _0x3589=['exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x3589,0x1d0));var _0x9358=function(_0x51ffa7,_0x1fd8ff){_0x51ffa7=_0x51ffa7-0x0;var _0x3d1c22=_0x3589[_0x51ffa7];return _0x3d1c22;};'use strict';var _=require('lodash');var util=require(_0x9358('0x0'));var logger=require(_0x9358('0x1'))(_0x9358('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(_0x9358('0x3'));var config=require(_0x9358('0x4'));var attributes=require(_0x9358('0x5'));module[_0x9358('0x6')]=function(_0x522dea,_0x30af7c){return _0x522dea[_0x9358('0x7')](_0x9358('0x8'),attributes,{'tableName':_0x9358('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeea4=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5af954,_0x56ee93){var _0x34e676=function(_0x29595c){while(--_0x29595c){_0x5af954['push'](_0x5af954['shift']());}};_0x34e676(++_0x56ee93);}(_0xeea4,0x13a));var _0x4eea=function(_0x51544a,_0x1968e1){_0x51544a=_0x51544a-0x0;var _0x56839b=_0xeea4[_0x51544a];return _0x56839b;};'use strict';var _=require(_0x4eea('0x0'));var util=require('util');var logger=require(_0x4eea('0x1'))(_0x4eea('0x2'));var moment=require(_0x4eea('0x3'));var BPromise=require(_0x4eea('0x4'));var rp=require(_0x4eea('0x5'));var fs=require('fs');var path=require(_0x4eea('0x6'));var rimraf=require(_0x4eea('0x7'));var config=require(_0x4eea('0x8'));var attributes=require(_0x4eea('0x9'));module[_0x4eea('0xa')]=function(_0x775718,_0xdbeee1){return _0x775718[_0x4eea('0xb')](_0x4eea('0xc'),attributes,{'tableName':_0x4eea('0xd'),'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 9681e84..6908c9c 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 _0xfaa6=['rpc','client','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x15b162,_0xbc2e51){var _0x41d5b3=function(_0x20af12){while(--_0x20af12){_0x15b162['push'](_0x15b162['shift']());}};_0x41d5b3(++_0xbc2e51);}(_0xfaa6,0xbd));var _0x6faa=function(_0x1147ab,_0x10e72b){_0x1147ab=_0x1147ab-0x0;var _0x55cb5a=_0xfaa6[_0x1147ab];return _0x55cb5a;};'use strict';var _=require(_0x6faa('0x0'));var util=require(_0x6faa('0x1'));var moment=require(_0x6faa('0x2'));var BPromise=require(_0x6faa('0x3'));var rs=require(_0x6faa('0x4'));var fs=require('fs');var Redis=require(_0x6faa('0x5'));var db=require(_0x6faa('0x6'))['db'];var utils=require(_0x6faa('0x7'));var logger=require(_0x6faa('0x8'))(_0x6faa('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6faa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229c57,_0x325fc7,_0x27195c){return new BPromise(function(_0x874022,_0x23311b){return client['request'](_0x229c57,_0x27195c)[_0x6faa('0xb')](function(_0x1d682b){logger[_0x6faa('0xc')](_0x6faa('0xd'),_0x325fc7,_0x6faa('0xe'));logger[_0x6faa('0xf')](_0x6faa('0x10'),_0x325fc7,'request\x20sent',JSON[_0x6faa('0x11')](_0x1d682b));if(_0x1d682b[_0x6faa('0x12')]){if(_0x1d682b[_0x6faa('0x12')]['code']===0x1f4){logger[_0x6faa('0x12')](_0x6faa('0xd'),_0x325fc7,_0x1d682b[_0x6faa('0x12')][_0x6faa('0x13')]);return _0x23311b(_0x1d682b[_0x6faa('0x12')][_0x6faa('0x13')]);}logger[_0x6faa('0x12')](_0x6faa('0xd'),_0x325fc7,_0x1d682b[_0x6faa('0x12')]['message']);return _0x874022(_0x1d682b['error'][_0x6faa('0x13')]);}else{logger[_0x6faa('0xc')](_0x6faa('0xd'),_0x325fc7,_0x6faa('0xe'));_0x874022(_0x1d682b[_0x6faa('0x14')][_0x6faa('0x13')]);}})[_0x6faa('0x15')](function(_0x52b967){logger['error']('CmCustomField,\x20%s,\x20%s',_0x325fc7,_0x52b967);_0x23311b(_0x52b967);});});} \ No newline at end of file +var _0xbeb9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','code','error','CmCustomField,\x20%s,\x20%s','message','catch'];(function(_0x1505e5,_0x5cc291){var _0x5b1dcd=function(_0x18bfe5){while(--_0x18bfe5){_0x1505e5['push'](_0x1505e5['shift']());}};_0x5b1dcd(++_0x5cc291);}(_0xbeb9,0x108));var _0x9beb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbeb9[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x9beb('0x0'));var moment=require(_0x9beb('0x1'));var BPromise=require(_0x9beb('0x2'));var rs=require(_0x9beb('0x3'));var fs=require('fs');var Redis=require(_0x9beb('0x4'));var db=require(_0x9beb('0x5'))['db'];var utils=require(_0x9beb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9beb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9beb('0x8')][_0x9beb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dff78,_0x18fbe6,_0x4cf422){return new BPromise(function(_0x272c82,_0x2e9288){return client[_0x9beb('0xa')](_0x5dff78,_0x4cf422)[_0x9beb('0xb')](function(_0x228d70){logger[_0x9beb('0xc')]('CmCustomField,\x20%s,\x20%s',_0x18fbe6,_0x9beb('0xd'));logger[_0x9beb('0xe')](_0x9beb('0xf'),_0x18fbe6,_0x9beb('0xd'),JSON[_0x9beb('0x10')](_0x228d70));if(_0x228d70['error']){if(_0x228d70['error'][_0x9beb('0x11')]===0x1f4){logger[_0x9beb('0x12')](_0x9beb('0x13'),_0x18fbe6,_0x228d70[_0x9beb('0x12')][_0x9beb('0x14')]);return _0x2e9288(_0x228d70[_0x9beb('0x12')]['message']);}logger[_0x9beb('0x12')](_0x9beb('0x13'),_0x18fbe6,_0x228d70[_0x9beb('0x12')][_0x9beb('0x14')]);return _0x272c82(_0x228d70[_0x9beb('0x12')]['message']);}else{logger[_0x9beb('0xc')](_0x9beb('0x13'),_0x18fbe6,_0x9beb('0xd'));_0x272c82(_0x228d70['result'][_0x9beb('0x14')]);}})[_0x9beb('0x15')](function(_0x212090){logger[_0x9beb('0x12')]('CmCustomField,\x20%s,\x20%s',_0x18fbe6,_0x212090);_0x2e9288(_0x212090);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 7a5b700..3a057d5 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 _0x45aa=['/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45aa,0xdf));var _0xa45a=function(_0x16dd2c,_0x51188b){_0x16dd2c=_0x16dd2c-0x0;var _0x4fe5c3=_0x45aa[_0x16dd2c];return _0x4fe5c3;};'use strict';var multer=require('multer');var util=require(_0xa45a('0x0'));var path=require(_0xa45a('0x1'));var timeout=require(_0xa45a('0x2'));var express=require(_0xa45a('0x3'));var router=express['Router']();var fs_extra=require(_0xa45a('0x4'));var auth=require(_0xa45a('0x5'));var interaction=require(_0xa45a('0x6'));var config=require(_0xa45a('0x7'));var controller=require(_0xa45a('0x8'));router[_0xa45a('0x9')]('/',auth[_0xa45a('0xa')](),controller['index']);router[_0xa45a('0x9')](_0xa45a('0xb'),auth[_0xa45a('0xa')](),controller['show']);router[_0xa45a('0xc')]('/',auth[_0xa45a('0xa')](),controller[_0xa45a('0xd')]);router['put'](_0xa45a('0xb'),auth[_0xa45a('0xa')](),controller[_0xa45a('0xe')]);router[_0xa45a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xa45a('0x10')]);module[_0xa45a('0x11')]=router; \ No newline at end of file +var _0xe647=['isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get'];(function(_0x41828b,_0x278d36){var _0x1a3afb=function(_0x5985c8){while(--_0x5985c8){_0x41828b['push'](_0x41828b['shift']());}};_0x1a3afb(++_0x278d36);}(_0xe647,0x16d));var _0x7e64=function(_0x670b46,_0x2208ed){_0x670b46=_0x670b46-0x0;var _0x5a5ff2=_0xe647[_0x670b46];return _0x5a5ff2;};'use strict';var multer=require(_0x7e64('0x0'));var util=require(_0x7e64('0x1'));var path=require('path');var timeout=require(_0x7e64('0x2'));var express=require(_0x7e64('0x3'));var router=express[_0x7e64('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7e64('0x5'));var config=require(_0x7e64('0x6'));var controller=require(_0x7e64('0x7'));router[_0x7e64('0x8')]('/',auth[_0x7e64('0x9')](),controller['index']);router[_0x7e64('0x8')](_0x7e64('0xa'),auth[_0x7e64('0x9')](),controller[_0x7e64('0xb')]);router[_0x7e64('0xc')]('/',auth[_0x7e64('0x9')](),controller[_0x7e64('0xd')]);router[_0x7e64('0xe')](_0x7e64('0xa'),auth[_0x7e64('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7e64('0x9')](),controller[_0x7e64('0xf')]);module[_0x7e64('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5d79ce7..23e7277 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 _0x80d0=['sequelize','exports','BOOLEAN','DATE','INTEGER','STRING','UNSIGNED','contactListQueue','moment'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0x80d0,0x10d));var _0x080d=function(_0x1155f4,_0x107a57){_0x1155f4=_0x1155f4-0x0;var _0x5da85b=_0x80d0[_0x1155f4];return _0x5da85b;};'use strict';var moment=require(_0x080d('0x0'));var Sequelize=require(_0x080d('0x1'));module[_0x080d('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x080d('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x080d('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x080d('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x080d('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x080d('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x080d('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x080d('0x5')](0x2)[_0x080d('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x080d('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x080d('0x5')],'unique':_0x080d('0x8')},'UserId':{'type':Sequelize[_0x080d('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x080d('0x5')],'unique':_0x080d('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x080d('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x080d('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x080d('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x080d('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x080d('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xd51c=['exports','STRING','BOOLEAN','INTEGER','DATE','UNSIGNED','contactListQueue','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd51c,0x117));var _0xcd51=function(_0x437edb,_0x5ea790){_0x437edb=_0x437edb-0x0;var _0x3ea54a=_0xd51c[_0x437edb];return _0x3ea54a;};'use strict';var moment=require('moment');var Sequelize=require(_0xcd51('0x0'));module[_0xcd51('0x1')]={'phone':{'type':Sequelize[_0xcd51('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xcd51('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xcd51('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcd51('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xcd51('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcd51('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcd51('0x5')]},'priority':{'type':Sequelize[_0xcd51('0x4')](0x2)[_0xcd51('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xcd51('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xcd51('0x4')],'unique':_0xcd51('0x7')},'ListId':{'type':Sequelize[_0xcd51('0x4')],'unique':_0xcd51('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xcd51('0x4')],'unique':_0xcd51('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xcd51('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcd51('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcd51('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xcd51('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xcd51('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0xcd51('0x5')],'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 c01015e..c26a439 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 _0x8098=['preview','dialOrderByScheduledAt','sequelize','transaction','dialPreviewAutoRecallMe','value','direction','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','recallme','LOCK','UPDATE','Company','CmList','dialActive','scheduledat','Contact','CmCompany','List','outbound','isNumber','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','concat','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','filter','where','merge','VIRTUAL','options','CmHopper','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','updatedAt','state','statedesc','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','getVoiceQueues'];(function(_0x89ace6,_0x39064b){var _0x302694=function(_0x7dd49){while(--_0x7dd49){_0x89ace6['push'](_0x89ace6['shift']());}};_0x302694(++_0x39064b);}(_0x8098,0x1ba));var _0x8809=function(_0x538c7d,_0x4c5a83){_0x538c7d=_0x538c7d-0x0;var _0x5af70f=_0x8098[_0x538c7d];return _0x5af70f;};'use strict';var moment=require('moment');var _=require('lodash');var qs=require(_0x8809('0x0'));var logger=require(_0x8809('0x1'))(_0x8809('0x2'));var shared=require(_0x8809('0x3'));var db=require(_0x8809('0x4'))['db'];function respondWithResult(_0x4b0838,_0x2bb438){_0x2bb438=_0x2bb438||0xc8;return function(_0x1d7425){if(_0x1d7425){return _0x4b0838[_0x8809('0x5')](_0x2bb438)[_0x8809('0x6')](_0x1d7425);}};}function respondWithFilteredResult(_0x5804f0,_0xeb811){return function(_0x2af39c){if(_0x2af39c){var _0x54880c=typeof _0xeb811[_0x8809('0x7')]===_0x8809('0x8')&&typeof _0xeb811[_0x8809('0x9')]===_0x8809('0x8');var _0x1cb2ba=_0x2af39c[_0x8809('0xa')];var _0x2e2c3c=_0x54880c?0x0:_0xeb811[_0x8809('0x7')];var _0x25ed44=_0x54880c?_0x2af39c[_0x8809('0xa')]:_0xeb811[_0x8809('0x7')]+_0xeb811[_0x8809('0x9')];var _0x16053f;if(_0x25ed44>=_0x1cb2ba){_0x25ed44=_0x1cb2ba;_0x16053f=0xc8;}else{_0x16053f=0xce;}_0x5804f0[_0x8809('0x5')](_0x16053f);return _0x5804f0[_0x8809('0xb')](_0x8809('0xc'),_0x2e2c3c+'-'+_0x25ed44+'/'+_0x1cb2ba)['json'](_0x2af39c);}return null;};}function saveUpdates(_0x388b99,_0x455989){return function(_0x4d3b4c){if(_0x4d3b4c){return _0x4d3b4c[_0x8809('0xd')](_0x388b99)[_0x8809('0xe')](function(_0x5d2f30){return _0x5d2f30;});}return null;};}function handleEntityNotFound(_0x5d87df,_0x316f2c){return function(_0x2e4279){if(!_0x2e4279){_0x5d87df[_0x8809('0xf')](0x194);}return _0x2e4279;};}function handleError(_0x13b958,_0x131716){_0x131716=_0x131716||0x1f4;return function(_0x3d4d7e){logger[_0x8809('0x10')](_0x3d4d7e['stack']);if(_0x3d4d7e[_0x8809('0x11')]){delete _0x3d4d7e[_0x8809('0x11')];}_0x13b958['status'](_0x131716)[_0x8809('0x12')](_0x3d4d7e);};}exports[_0x8809('0x13')]=function(_0x5f032e,_0x3b0562){var _0x8ec527={},_0x7ec1a6={},_0x17289e={'count':0x0,'rows':[]};var _0x9f2f9d=_['map'](db['CmHopper'][_0x8809('0x14')],function(_0xc998a3){return{'name':_0xc998a3[_0x8809('0x15')],'type':_0xc998a3[_0x8809('0x16')][_0x8809('0x17')]};});_0x7ec1a6[_0x8809('0x18')]=_[_0x8809('0x19')](_0x9f2f9d,_0x8809('0x11'));_0x7ec1a6[_0x8809('0x1a')]=_[_0x8809('0x1b')](_0x5f032e[_0x8809('0x1a')]);_0x7ec1a6[_0x8809('0x1c')]=_[_0x8809('0x1d')](_0x7ec1a6['model'],_0x7ec1a6['query']);_0x7ec1a6[_0x8809('0x1c')]=_[_0x8809('0x1e')](_0x7ec1a6['filters'],['$and','$or',_0x8809('0x1f'),_0x8809('0x20'),_0x8809('0x21'),_0x8809('0x22'),_0x8809('0x23'),_0x8809('0x24'),_0x8809('0x25'),_0x8809('0x26'),_0x8809('0x27'),_0x8809('0x28'),_0x8809('0x29'),_0x8809('0x2a'),'$notLike',_0x8809('0x2b'),_0x8809('0x2c'),_0x8809('0x2a'),'$overlap',_0x8809('0x2d'),_0x8809('0x2e'),_0x8809('0x2f')]);_0x8ec527[_0x8809('0x30')]=_[_0x8809('0x1d')](_0x7ec1a6['model'],qs[_0x8809('0x31')](_0x5f032e['query'][_0x8809('0x31')]));_0x8ec527[_0x8809('0x30')]=_0x8ec527['attributes'][_0x8809('0x32')]?_0x8ec527['attributes']:_0x7ec1a6[_0x8809('0x18')];if(!_0x5f032e[_0x8809('0x1a')][_0x8809('0x33')](_0x8809('0x34'))){_0x8ec527[_0x8809('0x9')]=qs[_0x8809('0x9')](_0x5f032e['query']['limit']);_0x8ec527[_0x8809('0x7')]=qs[_0x8809('0x7')](_0x5f032e[_0x8809('0x1a')][_0x8809('0x7')]);}_0x8ec527[_0x8809('0x35')]=qs['sort'](_0x5f032e[_0x8809('0x1a')]['sort']);_0x8ec527['where']=qs[_0x8809('0x1c')](_['pick'](_0x5f032e[_0x8809('0x1a')],_0x7ec1a6['filters']),_0x9f2f9d);if(_0x5f032e[_0x8809('0x1a')][_0x8809('0x36')]){_0x8ec527[_0x8809('0x37')]=_[_0x8809('0x38')](_0x8ec527[_0x8809('0x37')],{'$or':_[_0x8809('0x19')](_0x9f2f9d,function(_0x58db84){if(_0x58db84[_0x8809('0x16')]!==_0x8809('0x39')){var _0x5b7b13={};_0x5b7b13[_0x58db84[_0x8809('0x11')]]={'$like':'%'+_0x5f032e[_0x8809('0x1a')][_0x8809('0x36')]+'%'};return _0x5b7b13;}})});}_0x8ec527=_[_0x8809('0x38')]({},_0x8ec527,_0x5f032e[_0x8809('0x3a')]);var _0x356817={'where':_0x8ec527['where']};return db[_0x8809('0x3b')][_0x8809('0xa')](_0x356817)[_0x8809('0xe')](function(_0x2af931){_0x17289e[_0x8809('0xa')]=_0x2af931;if(_0x5f032e[_0x8809('0x1a')][_0x8809('0x3c')]){_0x8ec527[_0x8809('0x3d')]=[{'all':!![]}];}return db['CmHopper'][_0x8809('0x3e')](_0x8ec527);})[_0x8809('0xe')](function(_0x225b03){_0x17289e[_0x8809('0x3f')]=_0x225b03;return _0x17289e;})['then'](respondWithFilteredResult(_0x3b0562,_0x8ec527))[_0x8809('0x40')](handleError(_0x3b0562,null));};exports[_0x8809('0x41')]=function(_0x35d449,_0x306bc7){var _0x8e60e2={'raw':!![],'where':{'id':_0x35d449[_0x8809('0x42')]['id']}},_0x17e4e7={};_0x17e4e7[_0x8809('0x18')]=_[_0x8809('0x1b')](db[_0x8809('0x3b')][_0x8809('0x14')]);_0x17e4e7[_0x8809('0x1a')]=_[_0x8809('0x1b')](_0x35d449[_0x8809('0x1a')]);_0x17e4e7[_0x8809('0x1c')]=_[_0x8809('0x1d')](_0x17e4e7[_0x8809('0x18')],_0x17e4e7[_0x8809('0x1a')]);_0x8e60e2[_0x8809('0x30')]=_[_0x8809('0x1d')](_0x17e4e7[_0x8809('0x18')],qs[_0x8809('0x31')](_0x35d449[_0x8809('0x1a')]['fields']));_0x8e60e2[_0x8809('0x30')]=_0x8e60e2[_0x8809('0x30')]['length']?_0x8e60e2[_0x8809('0x30')]:_0x17e4e7[_0x8809('0x18')];if(_0x35d449[_0x8809('0x1a')][_0x8809('0x3c')]){_0x8e60e2[_0x8809('0x3d')]=[{'all':!![]}];}_0x8e60e2=_['merge']({},_0x8e60e2,_0x35d449['options']);return db[_0x8809('0x3b')][_0x8809('0x43')](_0x8e60e2)[_0x8809('0xe')](handleEntityNotFound(_0x306bc7,null))[_0x8809('0xe')](respondWithResult(_0x306bc7,null))['catch'](handleError(_0x306bc7,null));};exports['create']=function(_0x3cb60d,_0x2eeca7){return db['CmHopper'][_0x8809('0x44')](_0x3cb60d[_0x8809('0x45')],{})['then'](respondWithResult(_0x2eeca7,0xc9))[_0x8809('0x40')](handleError(_0x2eeca7,null));};exports[_0x8809('0xd')]=function(_0x4655b0,_0x129c06){if(_0x4655b0['body']['id']){delete _0x4655b0[_0x8809('0x45')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x4655b0[_0x8809('0x42')]['id']}})[_0x8809('0xe')](handleEntityNotFound(_0x129c06,null))[_0x8809('0xe')](saveUpdates(_0x4655b0[_0x8809('0x45')],null))[_0x8809('0xe')](respondWithResult(_0x129c06,null))[_0x8809('0x40')](handleError(_0x129c06,null));};exports['describe']=function(_0x2bd916,_0x3d6c26){return db[_0x8809('0x3b')][_0x8809('0x46')]()[_0x8809('0xe')](respondWithResult(_0x3d6c26,null))[_0x8809('0x40')](handleError(_0x3d6c26,null));};exports[_0x8809('0x47')]=function(_0x373bf4,_0x23f6f6){var _0x3da832;var _0x548b0d=_0x373bf4[_0x8809('0x42')]['id'];return db[_0x8809('0x3b')][_0x8809('0x43')]({'where':{'id':_0x373bf4[_0x8809('0x42')]['id']}})[_0x8809('0xe')](handleEntityNotFound(_0x23f6f6,null))[_0x8809('0xe')](function(_0x12506c){if(_0x12506c){return _0x12506c['destroy']()[_0x8809('0xe')](function(_0x5496a3){return _0x5496a3;});}})[_0x8809('0xe')](function(_0x3bb5dd){_0x3da832=_0x3bb5dd;if(_0x3bb5dd){if(_0x3bb5dd[_0x8809('0x48')]||_0x3bb5dd[_0x8809('0x49')]){return db[_0x3bb5dd[_0x8809('0x48')]?_0x8809('0x4a'):_0x8809('0x4b')][_0x8809('0x43')]({'where':{'id':_0x3bb5dd['VoiceQueueId']?_0x3bb5dd[_0x8809('0x48')]:_0x3bb5dd[_0x8809('0x49')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x37133){var _0x36d549={};if(_0x37133){_['merge'](_0x36d549,_[_0x8809('0x4c')](_0x3da832['dataValues'],['createdAt',_0x8809('0x4d'),'id']));_0x36d549[_0x8809('0x4e')]=0x15;_0x36d549[_0x8809('0x4f')]=_0x8809('0x50');_0x36d549[_0x8809('0x51')]=_0x37133[_0x8809('0x11')];_0x36d549[_0x8809('0x52')]=_0x373bf4['user'][_0x8809('0x11')];_0x36d549[_0x8809('0x53')]=_0x373bf4[_0x8809('0x54')]['id'];_0x36d549[_0x8809('0x50')]=!![];_0x36d549[_0x8809('0x55')]=moment()[_0x8809('0x56')](_0x8809('0x57'));_0x36d549[_0x8809('0x58')]=_0x3da832[_0x8809('0x59')];_0x36d549[_0x8809('0x5a')]=_0x3da832['VoiceQueueId']?_0x8809('0x5b'):_0x8809('0x5c');return db[_0x8809('0x5d')][_0x8809('0x43')]({'where':{'id':_0x36d549[_0x8809('0x5e')]},'attributes':[_0x8809('0x5f'),'lastName']})[_0x8809('0xe')](function(_0x26d484){if(!_[_0x8809('0x60')](_0x23f6f6)&&!_[_0x8809('0x60')](_0x26d484[_0x8809('0x5f')])){_0x36d549['calleridname']=_0x26d484[_0x8809('0x5f')];if(!_[_0x8809('0x60')](_0x26d484['lastName'])){_0x36d549['calleridname']+='\x20'+_0x26d484[_0x8809('0x61')];}}})[_0x8809('0x62')](function(){return db[_0x8809('0x63')]['create'](_0x36d549);});}})[_0x8809('0xe')](function(_0xdd485b){return db[_0x8809('0x64')][_0x8809('0x47')]({'where':{'CmHopperId':_0x548b0d}});})[_0x8809('0xe')](function(){return _0x23f6f6[_0x8809('0x5')](0xcc)['end']();})['catch'](handleError(_0x23f6f6,null));};exports['getPreview']=function(_0x1734d1,_0xf698e4){var _0x4b1573=[];return db['CmContact']['describe']()[_0x8809('0xe')](function(_0x1b72d8){_0x4b1573=_['keys'](_0x1b72d8);return _0x1734d1[_0x8809('0x54')][_0x8809('0x65')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8809('0x66')},'attributes':['id',_0x8809('0x67'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0x8809('0xe')](function(_0x4e2a3e){if(_0x4e2a3e&&_0x4e2a3e[_0x8809('0x32')]){return db[_0x8809('0x68')][_0x8809('0x69')](function(_0x1d252e){var _0x2fa1af={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8809('0x56')](_0x8809('0x57'))},'VoiceQueueId':{'$in':_[_0x8809('0x19')](_0x4e2a3e,'id')},'$or':[{'UserId':null},{'UserId':_0x1734d1[_0x8809('0x54')]['id']}]};var _0x10ade5={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4e2a3e)[_0x8809('0x36')]([_0x8809('0x6a'),0x0])[_0x8809('0x19')]('id')[_0x8809('0x6b')]()},'$or':[{'UserId':null},{'UserId':_0x1734d1[_0x8809('0x54')]['id']}]};var _0x1a827e={'$or':[_0x2fa1af,_0x10ade5]};var _0x5e2b75=[];if(_0x1734d1[_0x8809('0x45')]['direction']&&_0x1734d1[_0x8809('0x45')][_0x8809('0x6c')]==='prev'){if(!_['isEmpty'](_0x1734d1[_0x8809('0x45')][_0x8809('0x6d')])){_0x1a827e['id']={'$in':_0x1734d1['body'][_0x8809('0x6d')]};}_0x5e2b75=[[_0x8809('0x6e'),_0x8809('0x6f')],[_0x8809('0x70'),_0x4e2a3e[0x0][_0x8809('0x67')]===_0x8809('0x6f')?_0x8809('0x71'):'ASC'],db[_0x8809('0x68')][_0x8809('0x72')](_0x8809('0x73')),['id',_0x8809('0x71')]];}else{if(!_['isEmpty'](_0x1734d1[_0x8809('0x45')]['hopperIds'])){_0x1a827e['id']={'$notIn':_0x1734d1['body'][_0x8809('0x6d')]};}_0x5e2b75=[[_0x8809('0x6e'),_0x8809('0x71')],[_0x8809('0x70'),_0x4e2a3e[0x0][_0x8809('0x67')]],db['sequelize'][_0x8809('0x72')](_0x8809('0x74')),['id','ASC']];}return db[_0x8809('0x3b')][_0x8809('0x75')]({'attributes':['id','scheduledat',_0x8809('0x59'),_0x8809('0x76')],'where':_0x1a827e,'order':_0x5e2b75,'transaction':_0x1d252e,'lock':_0x1d252e[_0x8809('0x77')][_0x8809('0x78')],'include':[{'model':db[_0x8809('0x5d')],'as':'Contact','attributes':_0x4b1573,'include':[{'model':db['CmCompany'],'as':_0x8809('0x79'),'attributes':['id',_0x8809('0x11')]}]},{'model':db[_0x8809('0x7a')],'as':'List','attributes':['id',_0x8809('0x11')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x8809('0x11'),_0x8809('0x7b')]}]})['then'](function(_0x3a688b){if(_0x3a688b){return _0x3a688b[_0x8809('0xd')]({'UserId':_0x1734d1['user']['id']},{'transaction':_0x1d252e});}});});}})[_0x8809('0xe')](handleEntityNotFound(_0xf698e4,null))[_0x8809('0xe')](respondWithResult(_0xf698e4,null))[_0x8809('0x40')](handleError(_0xf698e4,null));};exports['getPreviewRecall']=function(_0x491e1f,_0x56853a,_0x55cfe8){var _0x394525=[];var _0x350a9b=_0x491e1f['params']['id'];var _0x18fdce=_0x491e1f[_0x8809('0x54')]['id'];return db['CmContact'][_0x8809('0x46')]()[_0x8809('0xe')](function(_0x27b641){_0x394525=_[_0x8809('0x1b')](_0x27b641);return db['sequelize']['transaction'](function(_0x5c058a){const _0x578528={'id':_0x350a9b};return db[_0x8809('0x3b')][_0x8809('0x75')]({'attributes':['id',_0x8809('0x7c'),_0x8809('0x76')],'where':_0x578528,'transaction':_0x5c058a,'lock':_0x5c058a[_0x8809('0x77')][_0x8809('0x78')],'include':[{'model':db[_0x8809('0x5d')],'as':_0x8809('0x7d'),'attributes':_0x394525,'include':[{'model':db[_0x8809('0x7e')],'as':_0x8809('0x79'),'attributes':['id',_0x8809('0x11')]}]},{'model':db[_0x8809('0x7a')],'as':_0x8809('0x7f'),'attributes':['id',_0x8809('0x11')]},{'model':db[_0x8809('0x4a')],'as':'Queue','attributes':['id','name',_0x8809('0x7b')]}]})[_0x8809('0xe')](function(_0x24a2cc){if(_0x24a2cc){return _0x24a2cc[_0x8809('0xd')]({'UserId':_0x18fdce},{'transaction':_0x5c058a});}});});})[_0x8809('0xe')](handleEntityNotFound(_0x56853a,null))[_0x8809('0xe')](respondWithResult(_0x56853a,null))[_0x8809('0x40')](handleError(_0x56853a,null));};exports['getOpenContacts']=function(_0x427447,_0x174251){return _0x427447[_0x8809('0x54')][_0x8809('0x65')]({'where':{'type':_0x8809('0x80'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x8809('0xe')](function(_0x45f8a5){if(_0x45f8a5&&_0x45f8a5[_0x8809('0x32')]){return db[_0x8809('0x3b')][_0x8809('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x8809('0x19')](_0x45f8a5,'id')},'$or':[{'UserId':null},{'UserId':_0x427447[_0x8809('0x54')]['id']}]}});}return 0x0;})['then'](function(_0x4c3461){if(!_[_0x8809('0x60')](_0x4c3461)&&_[_0x8809('0x81')](_0x4c3461)){return _0x174251[_0x8809('0x5')](0xc8)['json']({'contacts':_0x4c3461});}else{logger[_0x8809('0x10')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x8809('0x82'),0x194,_0x8809('0x83'));_0x174251[_0x8809('0xf')](0x194);}})[_0x8809('0x40')](handleError(_0x174251,null));};exports[_0x8809('0x84')]=function(_0x2a0ce0,_0x1a4c26){var _0x371d37=shared[_0x8809('0x85')];var _0x3451a4=[];_[_0x8809('0x19')](_0x371d37,function(_0x33bb07){_0x3451a4['push']({'id':_0x33bb07['name'],'name':_0x33bb07['name'],'utcOffset':_0x33bb07[_0x8809('0x86')]});});return _0x1a4c26[_0x8809('0x5')](0xc8)['json']({'tz':_0x3451a4});};exports[_0x8809('0x87')]=function(_0x9552fe,_0x43b3ad){var _0x22cb6d=shared[_0x8809('0x85')];var _0x27552f={};if(!_[_0x8809('0x60')](_0x22cb6d[_0x9552fe[_0x8809('0x45')]['id']]))_0x27552f=_0x22cb6d[_0x9552fe[_0x8809('0x45')]['id']];return _0x43b3ad[_0x8809('0x5')](0xc8)[_0x8809('0x6')](_0x27552f);}; \ No newline at end of file +var _0xfd87=['count','set','Content-Range','update','then','sendStatus','error','stack','name','map','CmHopper','rawAttributes','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$lte','$ne','$eq','$not','$between','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','rows','catch','show','create','body','find','params','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','dataValues','createdAt','updatedAt','state','statedesc','membername','user','UserId','deleted','deletedat','calleridnum','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','value','direction','prev','hopperIds','priority','ASC','DESC','isEmpty','scheduledAt','scheduledat','phone','recallme','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','LOCK','CmList','getOpenContacts','isNumber','json','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit'];(function(_0x4c3070,_0xc2fb4c){var _0x536a44=function(_0x1412a5){while(--_0x1412a5){_0x4c3070['push'](_0x4c3070['shift']());}};_0x536a44(++_0xc2fb4c);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x7fd8('0x0'));var _=require(_0x7fd8('0x1'));var qs=require(_0x7fd8('0x2'));var logger=require(_0x7fd8('0x3'))(_0x7fd8('0x4'));var shared=require(_0x7fd8('0x5'));var db=require(_0x7fd8('0x6'))['db'];function respondWithResult(_0x42b06c,_0x4429f2){_0x4429f2=_0x4429f2||0xc8;return function(_0x43b442){if(_0x43b442){return _0x42b06c[_0x7fd8('0x7')](_0x4429f2)['json'](_0x43b442);}};}function respondWithFilteredResult(_0x1395b6,_0x10a778){return function(_0x55681d){if(_0x55681d){var _0x378037=typeof _0x10a778[_0x7fd8('0x8')]===_0x7fd8('0x9')&&typeof _0x10a778[_0x7fd8('0xa')]===_0x7fd8('0x9');var _0x515439=_0x55681d[_0x7fd8('0xb')];var _0x18e3ea=_0x378037?0x0:_0x10a778[_0x7fd8('0x8')];var _0x596d03=_0x378037?_0x55681d['count']:_0x10a778['offset']+_0x10a778[_0x7fd8('0xa')];var _0x4e6096;if(_0x596d03>=_0x515439){_0x596d03=_0x515439;_0x4e6096=0xc8;}else{_0x4e6096=0xce;}_0x1395b6[_0x7fd8('0x7')](_0x4e6096);return _0x1395b6[_0x7fd8('0xc')](_0x7fd8('0xd'),_0x18e3ea+'-'+_0x596d03+'/'+_0x515439)['json'](_0x55681d);}return null;};}function saveUpdates(_0x136770,_0x2cccdb){return function(_0xe84aa7){if(_0xe84aa7){return _0xe84aa7[_0x7fd8('0xe')](_0x136770)[_0x7fd8('0xf')](function(_0x5b7061){return _0x5b7061;});}return null;};}function handleEntityNotFound(_0x1af365,_0x17a3a1){return function(_0x1d481a){if(!_0x1d481a){_0x1af365[_0x7fd8('0x10')](0x194);}return _0x1d481a;};}function handleError(_0x250a02,_0x38d45a){_0x38d45a=_0x38d45a||0x1f4;return function(_0x1a4a52){logger[_0x7fd8('0x11')](_0x1a4a52[_0x7fd8('0x12')]);if(_0x1a4a52[_0x7fd8('0x13')]){delete _0x1a4a52[_0x7fd8('0x13')];}_0x250a02['status'](_0x38d45a)['send'](_0x1a4a52);};}exports['index']=function(_0xab57f7,_0xce23dc){var _0x48734c={},_0x39e301={},_0xb6f53b={'count':0x0,'rows':[]};var _0x40b134=_[_0x7fd8('0x14')](db[_0x7fd8('0x15')][_0x7fd8('0x16')],function(_0x2edf31){return{'name':_0x2edf31[_0x7fd8('0x17')],'type':_0x2edf31['type'][_0x7fd8('0x18')]};});_0x39e301[_0x7fd8('0x19')]=_[_0x7fd8('0x14')](_0x40b134,_0x7fd8('0x13'));_0x39e301[_0x7fd8('0x1a')]=_[_0x7fd8('0x1b')](_0xab57f7['query']);_0x39e301[_0x7fd8('0x1c')]=_[_0x7fd8('0x1d')](_0x39e301[_0x7fd8('0x19')],_0x39e301[_0x7fd8('0x1a')]);_0x39e301['filters']=_[_0x7fd8('0x1e')](_0x39e301[_0x7fd8('0x1c')],[_0x7fd8('0x1f'),_0x7fd8('0x20'),_0x7fd8('0x21'),'$gte','$lt',_0x7fd8('0x22'),_0x7fd8('0x23'),_0x7fd8('0x24'),_0x7fd8('0x25'),_0x7fd8('0x26'),'$notBetween',_0x7fd8('0x27'),_0x7fd8('0x28'),_0x7fd8('0x29'),_0x7fd8('0x2a'),_0x7fd8('0x2b'),'$notILike','$like',_0x7fd8('0x2c'),_0x7fd8('0x2d'),_0x7fd8('0x2e'),_0x7fd8('0x2f')]);_0x48734c['attributes']=_['intersection'](_0x39e301[_0x7fd8('0x19')],qs['fields'](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x30')]));_0x48734c[_0x7fd8('0x31')]=_0x48734c['attributes'][_0x7fd8('0x32')]?_0x48734c['attributes']:_0x39e301[_0x7fd8('0x19')];if(!_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x33')](_0x7fd8('0x34'))){_0x48734c[_0x7fd8('0xa')]=qs[_0x7fd8('0xa')](_0xab57f7[_0x7fd8('0x1a')]['limit']);_0x48734c[_0x7fd8('0x8')]=qs[_0x7fd8('0x8')](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x8')]);}_0x48734c[_0x7fd8('0x35')]=qs[_0x7fd8('0x36')](_0xab57f7[_0x7fd8('0x1a')][_0x7fd8('0x36')]);_0x48734c['where']=qs['filters'](_[_0x7fd8('0x37')](_0xab57f7[_0x7fd8('0x1a')],_0x39e301[_0x7fd8('0x1c')]),_0x40b134);if(_0xab57f7['query'][_0x7fd8('0x38')]){_0x48734c['where']=_['merge'](_0x48734c[_0x7fd8('0x39')],{'$or':_[_0x7fd8('0x14')](_0x40b134,function(_0x298dd6){if(_0x298dd6[_0x7fd8('0x3a')]!==_0x7fd8('0x3b')){var _0x3a889e={};_0x3a889e[_0x298dd6[_0x7fd8('0x13')]]={'$like':'%'+_0xab57f7[_0x7fd8('0x1a')]['filter']+'%'};return _0x3a889e;}})});}_0x48734c=_[_0x7fd8('0x3c')]({},_0x48734c,_0xab57f7['options']);var _0x5e6231={'where':_0x48734c[_0x7fd8('0x39')]};return db['CmHopper']['count'](_0x5e6231)['then'](function(_0x6c5e52){_0xb6f53b[_0x7fd8('0xb')]=_0x6c5e52;if(_0xab57f7['query'][_0x7fd8('0x3d')]){_0x48734c[_0x7fd8('0x3e')]=[{'all':!![]}];}return db[_0x7fd8('0x15')]['findAll'](_0x48734c);})['then'](function(_0x4ec65a){_0xb6f53b[_0x7fd8('0x3f')]=_0x4ec65a;return _0xb6f53b;})[_0x7fd8('0xf')](respondWithFilteredResult(_0xce23dc,_0x48734c))[_0x7fd8('0x40')](handleError(_0xce23dc,null));};exports[_0x7fd8('0x41')]=function(_0x1d2eca,_0x1b8737){var _0x2b5abb={'raw':!![],'where':{'id':_0x1d2eca['params']['id']}},_0x501f59={};_0x501f59['model']=_[_0x7fd8('0x1b')](db[_0x7fd8('0x15')][_0x7fd8('0x16')]);_0x501f59['query']=_[_0x7fd8('0x1b')](_0x1d2eca[_0x7fd8('0x1a')]);_0x501f59[_0x7fd8('0x1c')]=_[_0x7fd8('0x1d')](_0x501f59['model'],_0x501f59[_0x7fd8('0x1a')]);_0x2b5abb[_0x7fd8('0x31')]=_['intersection'](_0x501f59[_0x7fd8('0x19')],qs['fields'](_0x1d2eca[_0x7fd8('0x1a')][_0x7fd8('0x30')]));_0x2b5abb[_0x7fd8('0x31')]=_0x2b5abb[_0x7fd8('0x31')]['length']?_0x2b5abb[_0x7fd8('0x31')]:_0x501f59[_0x7fd8('0x19')];if(_0x1d2eca[_0x7fd8('0x1a')][_0x7fd8('0x3d')]){_0x2b5abb[_0x7fd8('0x3e')]=[{'all':!![]}];}_0x2b5abb=_[_0x7fd8('0x3c')]({},_0x2b5abb,_0x1d2eca['options']);return db['CmHopper']['find'](_0x2b5abb)[_0x7fd8('0xf')](handleEntityNotFound(_0x1b8737,null))[_0x7fd8('0xf')](respondWithResult(_0x1b8737,null))['catch'](handleError(_0x1b8737,null));};exports['create']=function(_0x328e81,_0x371a02){return db['CmHopper'][_0x7fd8('0x42')](_0x328e81[_0x7fd8('0x43')],{})[_0x7fd8('0xf')](respondWithResult(_0x371a02,0xc9))['catch'](handleError(_0x371a02,null));};exports[_0x7fd8('0xe')]=function(_0x47462e,_0x4f6a65){if(_0x47462e[_0x7fd8('0x43')]['id']){delete _0x47462e['body']['id'];}return db[_0x7fd8('0x15')][_0x7fd8('0x44')]({'where':{'id':_0x47462e[_0x7fd8('0x45')]['id']}})[_0x7fd8('0xf')](handleEntityNotFound(_0x4f6a65,null))[_0x7fd8('0xf')](saveUpdates(_0x47462e[_0x7fd8('0x43')],null))[_0x7fd8('0xf')](respondWithResult(_0x4f6a65,null))[_0x7fd8('0x40')](handleError(_0x4f6a65,null));};exports['describe']=function(_0x1666e7,_0x5ca89e){return db[_0x7fd8('0x15')][_0x7fd8('0x46')]()['then'](respondWithResult(_0x5ca89e,null))[_0x7fd8('0x40')](handleError(_0x5ca89e,null));};exports[_0x7fd8('0x47')]=function(_0x5cbc91,_0x5e3a45){var _0x59dc51;var _0xcfb3a8=_0x5cbc91['params']['id'];return db[_0x7fd8('0x15')][_0x7fd8('0x44')]({'where':{'id':_0x5cbc91[_0x7fd8('0x45')]['id']}})[_0x7fd8('0xf')](handleEntityNotFound(_0x5e3a45,null))[_0x7fd8('0xf')](function(_0x4bbd34){if(_0x4bbd34){return _0x4bbd34['destroy']()[_0x7fd8('0xf')](function(_0x46c230){return _0x46c230;});}})[_0x7fd8('0xf')](function(_0x169317){_0x59dc51=_0x169317;if(_0x169317){if(_0x169317['VoiceQueueId']||_0x169317[_0x7fd8('0x48')]){return db[_0x169317['VoiceQueueId']?_0x7fd8('0x49'):_0x7fd8('0x4a')][_0x7fd8('0x44')]({'where':{'id':_0x169317[_0x7fd8('0x4b')]?_0x169317[_0x7fd8('0x4b')]:_0x169317[_0x7fd8('0x48')]},'attributes':['id',_0x7fd8('0x13')],'raw':!![]});}}})[_0x7fd8('0xf')](function(_0x369e11){var _0x20f460={};if(_0x369e11){_[_0x7fd8('0x3c')](_0x20f460,_['omit'](_0x59dc51[_0x7fd8('0x4c')],[_0x7fd8('0x4d'),_0x7fd8('0x4e'),'id']));_0x20f460[_0x7fd8('0x4f')]=0x15;_0x20f460[_0x7fd8('0x50')]='deleted';_0x20f460['campaign']=_0x369e11['name'];_0x20f460[_0x7fd8('0x51')]=_0x5cbc91[_0x7fd8('0x52')][_0x7fd8('0x13')];_0x20f460[_0x7fd8('0x53')]=_0x5cbc91[_0x7fd8('0x52')]['id'];_0x20f460[_0x7fd8('0x54')]=!![];_0x20f460[_0x7fd8('0x55')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x20f460[_0x7fd8('0x56')]=_0x59dc51['phone'];_0x20f460[_0x7fd8('0x57')]=_0x59dc51[_0x7fd8('0x4b')]?'queue':_0x7fd8('0x58');return db[_0x7fd8('0x59')]['find']({'where':{'id':_0x20f460[_0x7fd8('0x5a')]},'attributes':[_0x7fd8('0x5b'),_0x7fd8('0x5c')]})[_0x7fd8('0xf')](function(_0x47013a){if(!_[_0x7fd8('0x5d')](_0x5e3a45)&&!_[_0x7fd8('0x5d')](_0x47013a['firstName'])){_0x20f460[_0x7fd8('0x5e')]=_0x47013a[_0x7fd8('0x5b')];if(!_[_0x7fd8('0x5d')](_0x47013a[_0x7fd8('0x5c')])){_0x20f460[_0x7fd8('0x5e')]+='\x20'+_0x47013a['lastName'];}}})[_0x7fd8('0x5f')](function(){return db[_0x7fd8('0x60')][_0x7fd8('0x42')](_0x20f460);});}})['then'](function(_0x5e7495){return db[_0x7fd8('0x61')][_0x7fd8('0x47')]({'where':{'CmHopperId':_0xcfb3a8}});})[_0x7fd8('0xf')](function(){return _0x5e3a45[_0x7fd8('0x7')](0xcc)[_0x7fd8('0x62')]();})[_0x7fd8('0x40')](handleError(_0x5e3a45,null));};exports['getPreview']=function(_0x24756f,_0x1cb6e4){var _0xa04550=[];return db[_0x7fd8('0x59')]['describe']()[_0x7fd8('0xf')](function(_0x6118d7){_0xa04550=_[_0x7fd8('0x1b')](_0x6118d7);return _0x24756f[_0x7fd8('0x52')][_0x7fd8('0x63')]({'where':{'type':_0x7fd8('0x64'),'dialActive':!![],'dialMethod':_0x7fd8('0x65')},'attributes':['id',_0x7fd8('0x66'),_0x7fd8('0x67')],'raw':!![]});})[_0x7fd8('0xf')](function(_0x3fc049){if(_0x3fc049&&_0x3fc049[_0x7fd8('0x32')]){return db[_0x7fd8('0x68')][_0x7fd8('0x69')](function(_0x5cb9a0){var _0x48e1cc={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7fd8('0x6a')](_0x7fd8('0x6b'))},'VoiceQueueId':{'$in':_[_0x7fd8('0x14')](_0x3fc049,'id')},'$or':[{'UserId':null},{'UserId':_0x24756f[_0x7fd8('0x52')]['id']}]};var _0xd62b0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3fc049)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x7fd8('0x14')]('id')[_0x7fd8('0x6c')]()},'$or':[{'UserId':null},{'UserId':_0x24756f['user']['id']}]};var _0x4c04b3={'$or':[_0x48e1cc,_0xd62b0]};var _0x489bf3=[];if(_0x24756f[_0x7fd8('0x43')][_0x7fd8('0x6d')]&&_0x24756f[_0x7fd8('0x43')][_0x7fd8('0x6d')]===_0x7fd8('0x6e')){if(!_['isEmpty'](_0x24756f['body'][_0x7fd8('0x6f')])){_0x4c04b3['id']={'$in':_0x24756f[_0x7fd8('0x43')]['hopperIds']};}_0x489bf3=[[_0x7fd8('0x70'),_0x7fd8('0x71')],['scheduledAt',_0x3fc049[0x0][_0x7fd8('0x66')]==='ASC'?_0x7fd8('0x72'):'ASC'],db[_0x7fd8('0x68')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x7fd8('0x72')]];}else{if(!_[_0x7fd8('0x73')](_0x24756f['body'][_0x7fd8('0x6f')])){_0x4c04b3['id']={'$notIn':_0x24756f['body'][_0x7fd8('0x6f')]};}_0x489bf3=[[_0x7fd8('0x70'),_0x7fd8('0x72')],[_0x7fd8('0x74'),_0x3fc049[0x0][_0x7fd8('0x66')]],db[_0x7fd8('0x68')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x7fd8('0x71')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x7fd8('0x75'),_0x7fd8('0x76'),_0x7fd8('0x77')],'where':_0x4c04b3,'order':_0x489bf3,'transaction':_0x5cb9a0,'lock':_0x5cb9a0['LOCK'][_0x7fd8('0x78')],'include':[{'model':db[_0x7fd8('0x59')],'as':_0x7fd8('0x79'),'attributes':_0xa04550,'include':[{'model':db[_0x7fd8('0x7a')],'as':_0x7fd8('0x7b'),'attributes':['id',_0x7fd8('0x13')]}]},{'model':db['CmList'],'as':_0x7fd8('0x7c'),'attributes':['id',_0x7fd8('0x13')]},{'model':db[_0x7fd8('0x49')],'as':_0x7fd8('0x7d'),'attributes':['id',_0x7fd8('0x13'),_0x7fd8('0x7e')]}]})[_0x7fd8('0xf')](function(_0x1c46eb){if(_0x1c46eb){return _0x1c46eb['update']({'UserId':_0x24756f[_0x7fd8('0x52')]['id']},{'transaction':_0x5cb9a0});}});});}})[_0x7fd8('0xf')](handleEntityNotFound(_0x1cb6e4,null))[_0x7fd8('0xf')](respondWithResult(_0x1cb6e4,null))['catch'](handleError(_0x1cb6e4,null));};exports[_0x7fd8('0x7f')]=function(_0x4394f3,_0x1fd9bc,_0x4426cb){var _0x43fef0=[];var _0xafff06=_0x4394f3['params']['id'];var _0x335333=_0x4394f3[_0x7fd8('0x52')]['id'];return db[_0x7fd8('0x59')][_0x7fd8('0x46')]()['then'](function(_0x72429a){_0x43fef0=_[_0x7fd8('0x1b')](_0x72429a);return db[_0x7fd8('0x68')][_0x7fd8('0x69')](function(_0x42e7ae){const _0x296119={'id':_0xafff06};return db['CmHopper']['findOne']({'attributes':['id','scheduledat',_0x7fd8('0x77')],'where':_0x296119,'transaction':_0x42e7ae,'lock':_0x42e7ae[_0x7fd8('0x80')]['UPDATE'],'include':[{'model':db[_0x7fd8('0x59')],'as':'Contact','attributes':_0x43fef0,'include':[{'model':db[_0x7fd8('0x7a')],'as':_0x7fd8('0x7b'),'attributes':['id',_0x7fd8('0x13')]}]},{'model':db[_0x7fd8('0x81')],'as':_0x7fd8('0x7c'),'attributes':['id',_0x7fd8('0x13')]},{'model':db[_0x7fd8('0x49')],'as':_0x7fd8('0x7d'),'attributes':['id',_0x7fd8('0x13'),_0x7fd8('0x7e')]}]})[_0x7fd8('0xf')](function(_0x446b01){if(_0x446b01){return _0x446b01[_0x7fd8('0xe')]({'UserId':_0x335333},{'transaction':_0x42e7ae});}});});})['then'](handleEntityNotFound(_0x1fd9bc,null))[_0x7fd8('0xf')](respondWithResult(_0x1fd9bc,null))[_0x7fd8('0x40')](handleError(_0x1fd9bc,null));};exports[_0x7fd8('0x82')]=function(_0x3c353c,_0x68df89){return _0x3c353c['user'][_0x7fd8('0x63')]({'where':{'type':_0x7fd8('0x64'),'dialActive':!![],'dialMethod':_0x7fd8('0x65')},'attributes':['id'],'raw':!![]})[_0x7fd8('0xf')](function(_0x58f956){if(_0x58f956&&_0x58f956[_0x7fd8('0x32')]){return db[_0x7fd8('0x15')][_0x7fd8('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7fd8('0x6a')](_0x7fd8('0x6b'))},'VoiceQueueId':{'$in':_['map'](_0x58f956,'id')},'$or':[{'UserId':null},{'UserId':_0x3c353c[_0x7fd8('0x52')]['id']}]}});}return 0x0;})['then'](function(_0x111114){if(!_[_0x7fd8('0x5d')](_0x111114)&&_[_0x7fd8('0x83')](_0x111114)){return _0x68df89['status'](0xc8)[_0x7fd8('0x84')]({'contacts':_0x111114});}else{logger[_0x7fd8('0x11')](_0x7fd8('0x85'),_0x7fd8('0x82'),0x194,'entity\x20not\x20found');_0x68df89[_0x7fd8('0x10')](0x194);}})[_0x7fd8('0x40')](handleError(_0x68df89,null));};exports[_0x7fd8('0x86')]=function(_0x4cfe36,_0x408a07){var _0x148843=shared[_0x7fd8('0x87')];var _0xb66bee=[];_[_0x7fd8('0x14')](_0x148843,function(_0x147343){_0xb66bee[_0x7fd8('0x88')]({'id':_0x147343[_0x7fd8('0x13')],'name':_0x147343[_0x7fd8('0x13')],'utcOffset':_0x147343[_0x7fd8('0x89')]});});return _0x408a07['status'](0xc8)[_0x7fd8('0x84')]({'tz':_0xb66bee});};exports[_0x7fd8('0x8a')]=function(_0x2affd1,_0x15025d){var _0x56aff8=shared[_0x7fd8('0x87')];var _0x5f28fa={};if(!_['isNil'](_0x56aff8[_0x2affd1[_0x7fd8('0x43')]['id']]))_0x5f28fa=_0x56aff8[_0x2affd1['body']['id']];return _0x15025d[_0x7fd8('0x7')](0xc8)[_0x7fd8('0x84')](_0x5f28fa);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 945dda7..1f9c939 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 _0xf494=['define','scheduledat','phone','priority','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x3f21ea,_0xf1c7ce){var _0x5ce7f7=function(_0xa6ee86){while(--_0xa6ee86){_0x3f21ea['push'](_0x3f21ea['shift']());}};_0x5ce7f7(++_0xf1c7ce);}(_0xf494,0x1c6));var _0x4f49=function(_0x5759ae,_0x178f0f){_0x5759ae=_0x5759ae-0x0;var _0x1797cc=_0xf494[_0x5759ae];return _0x1797cc;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]},{'name':_0x4f49('0xd'),'fields':[_0x4f49('0xd')]},{'name':_0x4f49('0xe'),'fields':[_0x4f49('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['define','scheduledat','phone','priority','lodash','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x0295,0x1f0));var _0x5029=function(_0x2a2f52,_0x37a983){_0x2a2f52=_0x2a2f52-0x0;var _0x1e1816=_0x0295[_0x2a2f52];return _0x1e1816;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5029('0x9')]},{'name':'phone','fields':[_0x5029('0xa')]},{'name':'priority','fields':[_0x5029('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 7e54be6..d2c61fc 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 _0x0ae9=['then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','findAll','raw','options','where','attributes','include','map','model','find','ShowCmHopper','CreateCmHopper','CmHopper','create','UpdateCmHopper','update','limit','body','active','DestroyCmHopper','destroy','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','length','UserId','push','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','\x20MINUTE','NOW()','voicePause','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x606a15,_0x172191){var _0x238702=function(_0x192d7e){while(--_0x192d7e){_0x606a15['push'](_0x606a15['shift']());}};_0x238702(++_0x172191);}(_0x0ae9,0x105));var _0x90ae=function(_0x497416,_0x3ab375){_0x497416=_0x497416-0x0;var _0x45f974=_0x0ae9[_0x497416];return _0x45f974;};'use strict';var _=require(_0x90ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x90ae('0x1'));var db=require(_0x90ae('0x2'))['db'];var logger=require(_0x90ae('0x3'))(_0x90ae('0x4'));var jayson=require(_0x90ae('0x5'));var client=jayson[_0x90ae('0x6')][_0x90ae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30c2ab,_0x1949ac,_0x319533){return new BPromise(function(_0x2afb33,_0x331827){return client[_0x90ae('0x8')](_0x30c2ab,_0x319533)[_0x90ae('0x9')](function(_0x2ef768){logger[_0x90ae('0xa')](_0x90ae('0xb'),_0x1949ac,_0x90ae('0xc'));logger[_0x90ae('0xd')](_0x90ae('0xe'),_0x1949ac,_0x90ae('0xc'),JSON[_0x90ae('0xf')](_0x2ef768));if(_0x2ef768[_0x90ae('0x10')]){if(_0x2ef768['error'][_0x90ae('0x11')]===0x1f4){logger[_0x90ae('0x10')](_0x90ae('0xb'),_0x1949ac,_0x2ef768['error'][_0x90ae('0x12')]);return _0x331827(_0x2ef768['error'][_0x90ae('0x12')]);}logger[_0x90ae('0x10')]('CmHopper,\x20%s,\x20%s',_0x1949ac,_0x2ef768['error'][_0x90ae('0x12')]);return _0x2afb33(_0x2ef768[_0x90ae('0x10')][_0x90ae('0x12')]);}else{logger[_0x90ae('0xa')](_0x90ae('0xb'),_0x1949ac,'request\x20sent');_0x2afb33(_0x2ef768[_0x90ae('0x13')][_0x90ae('0x12')]);}})[_0x90ae('0x14')](function(_0x557bf9){logger[_0x90ae('0x10')](_0x90ae('0xb'),_0x1949ac,_0x557bf9);_0x331827(_0x557bf9);});});}exports[_0x90ae('0x15')]=function(_0x4cda45){var _0x2a1d1e=this;return new Promise(function(_0xd84f25,_0xa5b3b1){return db['CmHopper'][_0x90ae('0x16')]({'raw':_0x4cda45['options']?_0x4cda45['options'][_0x90ae('0x17')]===undefined?!![]:![]:!![],'where':_0x4cda45['options']?_0x4cda45[_0x90ae('0x18')][_0x90ae('0x19')]||null:null,'attributes':_0x4cda45[_0x90ae('0x18')]?_0x4cda45['options'][_0x90ae('0x1a')]||null:null,'limit':_0x4cda45[_0x90ae('0x18')]?_0x4cda45[_0x90ae('0x18')]['limit']||null:null,'include':_0x4cda45[_0x90ae('0x18')]?_0x4cda45['options'][_0x90ae('0x1b')]?_[_0x90ae('0x1c')](_0x4cda45[_0x90ae('0x18')][_0x90ae('0x1b')],function(_0x1f6aae){return{'model':db[_0x1f6aae[_0x90ae('0x1d')]],'as':_0x1f6aae['as'],'attributes':_0x1f6aae['attributes'],'include':_0x1f6aae[_0x90ae('0x1b')]?_[_0x90ae('0x1c')](_0x1f6aae[_0x90ae('0x1b')],function(_0x2abaa1){return{'model':db[_0x2abaa1[_0x90ae('0x1d')]],'as':_0x2abaa1['as'],'attributes':_0x2abaa1[_0x90ae('0x1a')],'include':_0x2abaa1['include']?_[_0x90ae('0x1c')](_0x2abaa1[_0x90ae('0x1b')],function(_0x1555db){return{'model':db[_0x1555db[_0x90ae('0x1d')]],'as':_0x1555db['as'],'attributes':_0x1555db['attributes']};}):[]};}):[]};}):[]:[]})[_0x90ae('0x9')](function(_0x19a0f6){logger['info']('GetCmHopper',_0x4cda45);logger[_0x90ae('0xd')]('GetCmHopper',_0x4cda45,JSON['stringify'](_0x19a0f6));_0xd84f25(_0x19a0f6);})['catch'](function(_0x33df32){logger['error']('GetCmHopper',_0x33df32[_0x90ae('0x12')],_0x4cda45);_0xa5b3b1(_0x2a1d1e['error'](0x1f4,_0x33df32[_0x90ae('0x12')]));});});};exports['ShowCmHopper']=function(_0x212945){var _0x2108b4=this;return new Promise(function(_0xd22091,_0x362aee){return db['CmHopper'][_0x90ae('0x1e')]({'raw':_0x212945['options']?_0x212945[_0x90ae('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x212945[_0x90ae('0x18')]?_0x212945[_0x90ae('0x18')]['where']||null:null,'attributes':_0x212945[_0x90ae('0x18')]?_0x212945[_0x90ae('0x18')][_0x90ae('0x1a')]||null:null,'include':_0x212945['options']?_0x212945['options']['include']?_['map'](_0x212945['options'][_0x90ae('0x1b')],function(_0x1e29c0){return{'model':db[_0x1e29c0[_0x90ae('0x1d')]],'as':_0x1e29c0['as'],'attributes':_0x1e29c0[_0x90ae('0x1a')],'include':_0x1e29c0[_0x90ae('0x1b')]?_[_0x90ae('0x1c')](_0x1e29c0[_0x90ae('0x1b')],function(_0x1840ed){return{'model':db[_0x1840ed[_0x90ae('0x1d')]],'as':_0x1840ed['as'],'attributes':_0x1840ed[_0x90ae('0x1a')],'include':_0x1840ed['include']?_[_0x90ae('0x1c')](_0x1840ed[_0x90ae('0x1b')],function(_0x5100ff){return{'model':db[_0x5100ff['model']],'as':_0x5100ff['as'],'attributes':_0x5100ff[_0x90ae('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x90ae('0x9')](function(_0x38615e){logger[_0x90ae('0xa')]('ShowCmHopper',_0x212945);logger[_0x90ae('0xd')](_0x90ae('0x1f'),_0x212945,JSON[_0x90ae('0xf')](_0x38615e));_0xd22091(_0x38615e);})['catch'](function(_0x259017){logger['error'](_0x90ae('0x1f'),_0x259017['message'],_0x212945);_0x362aee(_0x2108b4[_0x90ae('0x10')](0x1f4,_0x259017[_0x90ae('0x12')]));});});};exports[_0x90ae('0x20')]=function(_0x598119){var _0x45cf15=this;return new Promise(function(_0x56cad0,_0x53a4ff){return db[_0x90ae('0x21')][_0x90ae('0x22')](_0x598119['body'],{'raw':_0x598119['options']?_0x598119[_0x90ae('0x18')][_0x90ae('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5d824a){logger[_0x90ae('0xa')](_0x90ae('0x20'),_0x598119);logger[_0x90ae('0xd')](_0x90ae('0x20'),_0x598119,JSON[_0x90ae('0xf')](_0x5d824a));_0x56cad0(_0x5d824a);})[_0x90ae('0x14')](function(_0x3d9014){logger[_0x90ae('0x10')]('CreateCmHopper',_0x3d9014['message'],_0x598119);_0x53a4ff(_0x45cf15[_0x90ae('0x10')](0x1f4,_0x3d9014['message']));});});};exports[_0x90ae('0x23')]=function(_0xc484bc){var _0x4408ed=this;return new Promise(function(_0x2fbb33,_0x302879){return db[_0x90ae('0x21')][_0x90ae('0x24')](_0xc484bc['body'],{'raw':_0xc484bc[_0x90ae('0x18')]?_0xc484bc[_0x90ae('0x18')][_0x90ae('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc484bc['options']?_0xc484bc[_0x90ae('0x18')]['where']||null:null,'attributes':_0xc484bc[_0x90ae('0x18')]?_0xc484bc['options'][_0x90ae('0x1a')]||null:null,'limit':_0xc484bc[_0x90ae('0x18')]?_0xc484bc['options'][_0x90ae('0x25')]||null:null})[_0x90ae('0x9')](function(_0x2291a2){logger[_0x90ae('0xa')]('UpdateCmHopper',_0xc484bc);logger[_0x90ae('0xa')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0xc484bc[_0x90ae('0x18')][_0x90ae('0x19')]),_0xc484bc[_0x90ae('0x26')][_0x90ae('0x27')]);logger[_0x90ae('0xd')](_0x90ae('0x23'),_0xc484bc,JSON[_0x90ae('0xf')](_0x2291a2));_0x2fbb33(_0x2291a2);})[_0x90ae('0x14')](function(_0xd811cc){logger[_0x90ae('0x10')](_0x90ae('0x23'),_0xd811cc['message'],_0xc484bc);_0x302879(_0x4408ed[_0x90ae('0x10')](0x1f4,_0xd811cc['message']));});});};exports[_0x90ae('0x28')]=function(_0x136eb2){var _0x6e61fb=this;return new Promise(function(_0x72264f,_0x16bb42){return db[_0x90ae('0x21')][_0x90ae('0x29')]({'where':_0x136eb2[_0x90ae('0x18')]?_0x136eb2[_0x90ae('0x18')]['where']||null:null})[_0x90ae('0x9')](function(_0x279ac7){logger[_0x90ae('0xa')](_0x90ae('0x28'),_0x136eb2);logger[_0x90ae('0xd')]('DestroyCmHopper',_0x136eb2,JSON[_0x90ae('0xf')](_0x279ac7));_0x72264f(_0x279ac7);})[_0x90ae('0x14')](function(_0x402e0b){logger[_0x90ae('0x10')]('DestroyCmHopper',_0x402e0b[_0x90ae('0x12')],_0x136eb2);_0x16bb42(_0x6e61fb[_0x90ae('0x10')](0x1f4,_0x402e0b[_0x90ae('0x12')]));});});};exports['GetContactDialer']=function(_0x296747){var _0x36f91a=this;return new Promise(function(_0x56fa9f,_0x22a915){return db[_0x90ae('0x2a')][_0x90ae('0x2b')]()[_0x90ae('0x9')](function(_0x3a2c62){return db[_0x90ae('0x2c')][_0x90ae('0x2d')](function(_0x45af53){return db[_0x90ae('0x21')][_0x90ae('0x16')]({'where':_0x296747['options']?_0x296747[_0x90ae('0x18')][_0x90ae('0x19')]||null:null,'attributes':_0x296747[_0x90ae('0x18')]?_0x296747[_0x90ae('0x18')]['attributes']||null:null,'limit':_0x296747[_0x90ae('0x18')]?_0x296747[_0x90ae('0x18')][_0x90ae('0x25')]||null:null,'order':_0x296747[_0x90ae('0x18')]?_0x296747[_0x90ae('0x18')][_0x90ae('0x2e')]||null:null,'transaction':_0x45af53,'lock':_0x45af53[_0x90ae('0x2f')][_0x90ae('0x30')],'include':[{'model':db[_0x90ae('0x2a')],'as':_0x90ae('0x31'),'attributes':_[_0x90ae('0x32')](_0x3a2c62)},{'model':db[_0x90ae('0x33')],'as':_0x90ae('0x34'),'attributes':['id',_0x90ae('0x35'),'voicePause']}]})[_0x90ae('0x9')](function(_0x5e9d8e){var _0x12f27c=[];var _0x4486e6=[];for(var _0x38c4bb=0x0;_0x38c4bb<_0x5e9d8e[_0x90ae('0x36')];_0x38c4bb+=0x1){var _0x509ea5=_0x5e9d8e[_0x38c4bb][_0x90ae('0x37')];if(_0x509ea5===null){_0x12f27c[_0x90ae('0x38')](_0x5e9d8e[_0x38c4bb][_0x90ae('0x24')](_0x296747[_0x90ae('0x26')],{'transaction':_0x45af53}));}else if(!_0x4486e6['includes'](_0x509ea5)){_0x4486e6[_0x90ae('0x38')](_0x509ea5);_0x12f27c[_0x90ae('0x38')](_0x5e9d8e[_0x38c4bb][_0x90ae('0x24')](_0x296747[_0x90ae('0x26')],{'transaction':_0x45af53}));}}return BPromise[_0x90ae('0x39')](_0x12f27c);});})[_0x90ae('0x9')](function(_0x121b11){logger[_0x90ae('0xa')](_0x90ae('0x3a'),_0x296747);if(_0x121b11['length']>0x0){logger[_0x90ae('0xa')](_0x90ae('0x3b'),_0x121b11[0x0][_0x90ae('0x3c')]['id'],_0x121b11[0x0][_0x90ae('0x3c')][_0x90ae('0x3d')],_0x121b11[0x0][_0x90ae('0x3c')][_0x90ae('0x27')]);}logger[_0x90ae('0xd')]('GetContactDialer',_0x296747,JSON[_0x90ae('0xf')](_0x121b11));_0x56fa9f(_0x121b11);})['catch'](function(_0x40e535){logger[_0x90ae('0x10')](_0x90ae('0x3a'),_0x40e535[_0x90ae('0x12')],_0x296747);_0x22a915(_0x36f91a['error'](0x1f4,_0x40e535[_0x90ae('0x12')]));});});});};exports[_0x90ae('0x3e')]=function(_0x33b45){var _0x10fcd5=this;return new Promise(function(_0x275173,_0x38bf7f){return db[_0x90ae('0x2c')][_0x90ae('0x2d')](function(_0x222039){return db[_0x90ae('0x3f')][_0x90ae('0x22')](_0x33b45[_0x90ae('0x26')],{'raw':_0x33b45[_0x90ae('0x18')]?_0x33b45['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x222039})[_0x90ae('0x9')](function(){logger[_0x90ae('0xa')](_0x90ae('0x40'),JSON[_0x90ae('0xf')](_0x33b45[_0x90ae('0x18')][_0x90ae('0x19')]),_0x33b45[_0x90ae('0x18')][_0x90ae('0x19')][_0x90ae('0x27')]);return db[_0x90ae('0x21')][_0x90ae('0x29')]({'where':_0x33b45['options']?_0x33b45['options'][_0x90ae('0x19')]||null:null,'transaction':_0x222039});});})[_0x90ae('0x9')](function(_0x2d168a){logger[_0x90ae('0xa')](_0x90ae('0x3e'),_0x33b45);logger[_0x90ae('0xd')](_0x90ae('0x3e'),_0x33b45,JSON[_0x90ae('0xf')](_0x2d168a));_0x275173(_0x2d168a);})[_0x90ae('0x14')](function(_0x51ad92){logger[_0x90ae('0x10')](_0x90ae('0x3e'),_0x51ad92[_0x90ae('0x12')],_0x33b45);_0x38bf7f(_0x10fcd5[_0x90ae('0x10')](0x1f4,_0x51ad92['message']));});});};exports['CountReScheduled']=function(_0x1195b3){var _0x4e946b=this;return new Promise(function(_0x130ecd,_0x446d4b){return db[_0x90ae('0x21')][_0x90ae('0x16')]({'raw':_0x1195b3['options']?_0x1195b3[_0x90ae('0x18')][_0x90ae('0x17')]===undefined?!![]:![]:!![],'where':_0x1195b3[_0x90ae('0x18')]?_0x1195b3['options'][_0x90ae('0x19')]||null:null,'attributes':[[db[_0x90ae('0x2c')]['fn'](_0x90ae('0x41'),db[_0x90ae('0x2c')]['fn']('IF',db['sequelize'][_0x90ae('0x42')](_0x90ae('0x43')+util[_0x90ae('0x44')]('\x22%s\x22',moment()[_0x90ae('0x44')](_0x90ae('0x45')))+_0x90ae('0x46')))),_0x90ae('0x47')]]})[_0x90ae('0x9')](function(_0x4cba92){logger['info']('CountReScheduled',_0x1195b3);logger[_0x90ae('0xd')](_0x90ae('0x48'),_0x1195b3,JSON[_0x90ae('0xf')](_0x4cba92));_0x130ecd(_0x4cba92);})[_0x90ae('0x14')](function(_0x52f261){logger[_0x90ae('0x10')]('CountReScheduled',_0x52f261[_0x90ae('0x12')],_0x1195b3);_0x446d4b(_0x4e946b[_0x90ae('0x10')](0x1f4,_0x52f261['message']));});});};exports['GetContactRecallMe']=function(_0x1ca79f){var _0x58a629=this;return new Promise(function(_0x387bd5,_0x1b5ee8){return db['CmContact']['describe']()[_0x90ae('0x9')](function(_0x54dc67){return db['sequelize'][_0x90ae('0x2d')](function(_0x110854){return db['CmHopper'][_0x90ae('0x16')]({'where':_0x1ca79f[_0x90ae('0x18')]?_0x1ca79f[_0x90ae('0x18')][_0x90ae('0x19')]||null:null,'attributes':_0x1ca79f[_0x90ae('0x18')]?_0x1ca79f['options'][_0x90ae('0x1a')]||null:null,'limit':0x1,'order':_0x1ca79f[_0x90ae('0x18')]?_0x1ca79f[_0x90ae('0x18')][_0x90ae('0x2e')]||null:null,'group':db[_0x90ae('0x21')][_0x90ae('0x37')],'transaction':_0x110854,'lock':_0x110854[_0x90ae('0x2f')][_0x90ae('0x30')],'include':_0x1ca79f[_0x90ae('0x18')]?_0x1ca79f[_0x90ae('0x18')]['include']?_['map'](_0x1ca79f[_0x90ae('0x18')][_0x90ae('0x1b')],function(_0x21243e){return{'model':db[_0x21243e[_0x90ae('0x1d')]],'as':_0x21243e['as'],'attributes':_0x21243e[_0x90ae('0x1a')],'include':_0x21243e[_0x90ae('0x1b')]?_[_0x90ae('0x1c')](_0x21243e[_0x90ae('0x1b')],function(_0x26f5e2){return{'model':db[_0x26f5e2[_0x90ae('0x1d')]],'as':_0x26f5e2['as'],'attributes':_0x26f5e2[_0x90ae('0x1a')],'include':_0x26f5e2[_0x90ae('0x1b')]?_[_0x90ae('0x1c')](_0x26f5e2['include'],function(_0x38acfc){return{'model':db[_0x38acfc[_0x90ae('0x1d')]],'as':_0x38acfc['as'],'attributes':_0x38acfc[_0x90ae('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x90ae('0x9')](function(_0x32e0d4){var _0x245c7e=[];for(var _0x600658=0x0;_0x600658<_0x32e0d4[_0x90ae('0x36')];_0x600658+=0x1){_0x245c7e[_0x90ae('0x38')](_0x32e0d4[_0x600658][_0x90ae('0x24')](_0x1ca79f[_0x90ae('0x26')],{'transaction':_0x110854}));}return BPromise[_0x90ae('0x39')](_0x245c7e);});})[_0x90ae('0x9')](function(_0x1e1dcd){logger[_0x90ae('0xa')](_0x90ae('0x49'),_0x1ca79f);logger[_0x90ae('0xd')](_0x90ae('0x49'),_0x1ca79f,JSON[_0x90ae('0xf')](_0x1e1dcd));_0x387bd5(_0x1e1dcd);})[_0x90ae('0x14')](function(_0x1c7895){logger['error'](_0x90ae('0x49'),_0x1c7895[_0x90ae('0x12')],_0x1ca79f);_0x1b5ee8(_0x58a629[_0x90ae('0x10')](0x1f4,_0x1c7895['message']));});});});};exports[_0x90ae('0x4a')]=function(_0x4a5d39){var _0x446c1b=this;return new Promise(function(_0x401f91,_0x2ebc98){db[_0x90ae('0x2a')]['describe']()[_0x90ae('0x9')](function(_0x10d944){return db[_0x90ae('0x21')]['findAll']({'raw':_0x4a5d39[_0x90ae('0x18')]?_0x4a5d39[_0x90ae('0x18')][_0x90ae('0x17')]===undefined?!![]:![]:!![],'where':_0x4a5d39[_0x90ae('0x18')]?_0x4a5d39[_0x90ae('0x18')][_0x90ae('0x19')]||null:null,'attributes':_0x4a5d39[_0x90ae('0x18')]?_0x4a5d39[_0x90ae('0x18')][_0x90ae('0x1a')]||null:null,'limit':_0x4a5d39[_0x90ae('0x18')]?_0x4a5d39[_0x90ae('0x18')][_0x90ae('0x25')]||null:null,'include':_0x4a5d39['options']?_0x4a5d39['options'][_0x90ae('0x1b')]?_[_0x90ae('0x1c')](_0x4a5d39[_0x90ae('0x18')][_0x90ae('0x1b')],function(_0x280921){return{'model':db[_0x280921['model']],'as':_0x280921['as'],'attributes':_0x280921['as']===_0x90ae('0x31')?_[_0x90ae('0x32')](_0x10d944):_0x280921[_0x90ae('0x1a')],'include':_0x280921[_0x90ae('0x1b')]?_[_0x90ae('0x1c')](_0x280921['include'],function(_0x3756fb){return{'model':db[_0x3756fb[_0x90ae('0x1d')]],'as':_0x3756fb['as'],'attributes':_0x3756fb[_0x90ae('0x1a')],'include':_0x3756fb[_0x90ae('0x1b')]?_[_0x90ae('0x1c')](_0x3756fb['include'],function(_0x21eadb){return{'model':db[_0x21eadb[_0x90ae('0x1d')]],'as':_0x21eadb['as'],'attributes':_0x21eadb['attributes']};}):[]};}):[]};}):[]:[]})[_0x90ae('0x9')](function(_0x246595){logger[_0x90ae('0xa')]('GetCmHopper',_0x4a5d39);logger[_0x90ae('0xd')](_0x90ae('0x15'),_0x4a5d39,JSON[_0x90ae('0xf')](_0x246595));_0x401f91(_0x246595);})['catch'](function(_0x108280){logger[_0x90ae('0x10')](_0x90ae('0x15'),_0x108280[_0x90ae('0x12')],_0x4a5d39);_0x2ebc98(_0x446c1b['error'](0x1f4,_0x108280[_0x90ae('0x12')]));});});});};exports[_0x90ae('0x4b')]=function(_0x425e30){var _0x4081c6=this;return new Promise(function(_0x4bab6c,_0x4573a2){return db[_0x90ae('0x2a')][_0x90ae('0x4c')]({'raw':!![],'where':{'phone':_0x425e30[_0x90ae('0x18')][_0x90ae('0x19')][_0x90ae('0x4d')]},'attributes':['id',_0x90ae('0x4e')],'order':[['id',_0x90ae('0x4f')]]})[_0x90ae('0x9')](function(_0x53c939){logger[_0x90ae('0xa')](_0x90ae('0x50'),_0x425e30);logger[_0x90ae('0xd')](_0x90ae('0x50'),_0x425e30,JSON[_0x90ae('0xf')](_0x53c939));_0x4bab6c(_0x53c939);})[_0x90ae('0x14')](function(_0x1a0c64){logger[_0x90ae('0x10')](_0x90ae('0x50'),_0x1a0c64[_0x90ae('0x12')],_0x425e30);_0x4573a2(_0x4081c6['error'](0x1f4,_0x1a0c64[_0x90ae('0x12')]));});});};exports['ResetActiveCalls']=function(_0x43a15d){var _0x13c0f5=this;return new Promise(function(_0x3fb86f,_0x6a8761){return db[_0x90ae('0x2c')][_0x90ae('0x2d')](function(_0x49c95b){return db[_0x90ae('0x21')][_0x90ae('0x24')](_0x43a15d['body'],{'where':{},'transaction':_0x49c95b})[_0x90ae('0x9')](function(_0x32ac25){logger['info'](_0x90ae('0x51'),_0x43a15d);logger[_0x90ae('0xd')](_0x90ae('0x51'),_0x43a15d,JSON[_0x90ae('0xf')](_0x32ac25));_0x3fb86f(_0x32ac25);})[_0x90ae('0x14')](function(_0x264845){logger[_0x90ae('0x10')](_0x90ae('0x51'),_0x264845['message'],_0x43a15d);_0x6a8761(_0x13c0f5[_0x90ae('0x10')](0x1f4,_0x264845['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0xe8cbc6){var _0x4be8d8=this;var _0x36752d=_0xe8cbc6[_0x90ae('0x26')][_0x90ae('0x19')][_0x90ae('0x52')];var _0x34546d=_0xe8cbc6['body'][_0x90ae('0x19')][_0x90ae('0x53')];var _0x3b860b=_0xe8cbc6[_0x90ae('0x26')]['where']['availableAgentsIds'];return new Promise(function(_0xa6594b,_0xf22821){return db[_0x90ae('0x21')][_0x90ae('0x16')]({'where':{'voiceQueueId':{'$in':_0x36752d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x34546d+_0x90ae('0x54')),'$gt':db['sequelize'][_0x90ae('0x42')](_0x90ae('0x55'))}},'UserId':{'$in':_0x3b860b}},'include':[{'model':db[_0x90ae('0x2a')],'as':'Contact'},{'model':db[_0x90ae('0x33')],'as':_0x90ae('0x34'),'attributes':['id',_0x90ae('0x35'),_0x90ae('0x56')]},{'model':db[_0x90ae('0x57')],'as':_0x90ae('0x58')}]})['then'](function(_0x5b380d){if(_0x5b380d[_0x90ae('0x36')]>0x0){return db[_0x90ae('0x2c')]['transaction'](function(_0xbd1345){return db[_0x90ae('0x21')][_0x90ae('0x24')]({'recallmeNotifiedDate':db[_0x90ae('0x2c')]['literal']('NOW()')},{'where':{'id':{'$in':_[_0x90ae('0x1c')](_0x5b380d,'id')}},'transaction':_0xbd1345})[_0x90ae('0x9')](function(){_0xa6594b(_0x5b380d);})['catch'](function(_0x1ec849){logger['error'](_0x90ae('0x59'),_0x1ec849[_0x90ae('0x12')],_0xe8cbc6);_0xf22821(_0x4be8d8['error'](0x1f4,_0x1ec849[_0x90ae('0x12')]));});})['catch'](function(_0xc1f840){logger[_0x90ae('0x10')](_0x90ae('0x59'),_0xc1f840[_0x90ae('0x12')],_0xe8cbc6);_0xf22821(_0x4be8d8[_0x90ae('0x10')](0x1f4,_0xc1f840[_0x90ae('0x12')]));});}else{_0xa6594b(_0x5b380d);}});});}; \ No newline at end of file +var _0xe124=['util','bluebird','../../config/logger','rpc','client','http','then','info','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','error','code','CmHopper,\x20%s,\x20%s','message','result','catch','GetCmHopper','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowCmHopper','CmHopper','find','debug','create','body','CreateCmHopper','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','sequelize','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','update','includes','all','GetContactDialer','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','transaction','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','order','GetCmHopperPreview','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','CmList','List','NOW()'];(function(_0x44aee2,_0x49a5ff){var _0x1bafde=function(_0x16bc26){while(--_0x16bc26){_0x44aee2['push'](_0x44aee2['shift']());}};_0x1bafde(++_0x49a5ff);}(_0xe124,0x154));var _0x4e12=function(_0x477588,_0x591b7d){_0x477588=_0x477588-0x0;var _0x25860a=_0xe124[_0x477588];return _0x25860a;};'use strict';var _=require('lodash');var util=require(_0x4e12('0x0'));var moment=require('moment');var BPromise=require(_0x4e12('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x4e12('0x2'))(_0x4e12('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x4e12('0x4')][_0x4e12('0x5')]({'port':0x232a});function respondWithRpcPromise(_0xc28242,_0x2f668f,_0x248d47){return new BPromise(function(_0x49f46d,_0x3d10ca){return client['request'](_0xc28242,_0x248d47)[_0x4e12('0x6')](function(_0x4a2e6e){logger[_0x4e12('0x7')]('CmHopper,\x20%s,\x20%s',_0x2f668f,_0x4e12('0x8'));logger['debug'](_0x4e12('0x9'),_0x2f668f,'request\x20sent',JSON['stringify'](_0x4a2e6e));if(_0x4a2e6e['error']){if(_0x4a2e6e[_0x4e12('0xa')][_0x4e12('0xb')]===0x1f4){logger[_0x4e12('0xa')](_0x4e12('0xc'),_0x2f668f,_0x4a2e6e['error'][_0x4e12('0xd')]);return _0x3d10ca(_0x4a2e6e['error']['message']);}logger['error']('CmHopper,\x20%s,\x20%s',_0x2f668f,_0x4a2e6e[_0x4e12('0xa')][_0x4e12('0xd')]);return _0x49f46d(_0x4a2e6e[_0x4e12('0xa')]['message']);}else{logger[_0x4e12('0x7')]('CmHopper,\x20%s,\x20%s',_0x2f668f,'request\x20sent');_0x49f46d(_0x4a2e6e[_0x4e12('0xe')][_0x4e12('0xd')]);}})[_0x4e12('0xf')](function(_0x1827ef){logger[_0x4e12('0xa')]('CmHopper,\x20%s,\x20%s',_0x2f668f,_0x1827ef);_0x3d10ca(_0x1827ef);});});}exports[_0x4e12('0x10')]=function(_0x383096){var _0x30202c=this;return new Promise(function(_0x155dec,_0x51707b){return db['CmHopper'][_0x4e12('0x11')]({'raw':_0x383096[_0x4e12('0x12')]?_0x383096[_0x4e12('0x12')][_0x4e12('0x13')]===undefined?!![]:![]:!![],'where':_0x383096['options']?_0x383096[_0x4e12('0x12')][_0x4e12('0x14')]||null:null,'attributes':_0x383096[_0x4e12('0x12')]?_0x383096['options']['attributes']||null:null,'limit':_0x383096[_0x4e12('0x12')]?_0x383096[_0x4e12('0x12')][_0x4e12('0x15')]||null:null,'include':_0x383096[_0x4e12('0x12')]?_0x383096['options'][_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x383096[_0x4e12('0x12')][_0x4e12('0x16')],function(_0x5a08ae){return{'model':db[_0x5a08ae[_0x4e12('0x18')]],'as':_0x5a08ae['as'],'attributes':_0x5a08ae[_0x4e12('0x19')],'include':_0x5a08ae[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x5a08ae['include'],function(_0x22d2cc){return{'model':db[_0x22d2cc[_0x4e12('0x18')]],'as':_0x22d2cc['as'],'attributes':_0x22d2cc[_0x4e12('0x19')],'include':_0x22d2cc[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x22d2cc[_0x4e12('0x16')],function(_0x4b96f5){return{'model':db[_0x4b96f5[_0x4e12('0x18')]],'as':_0x4b96f5['as'],'attributes':_0x4b96f5[_0x4e12('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e12('0x6')](function(_0x50c3b7){logger[_0x4e12('0x7')](_0x4e12('0x10'),_0x383096);logger['debug']('GetCmHopper',_0x383096,JSON[_0x4e12('0x1a')](_0x50c3b7));_0x155dec(_0x50c3b7);})[_0x4e12('0xf')](function(_0xfefd5d){logger[_0x4e12('0xa')](_0x4e12('0x10'),_0xfefd5d['message'],_0x383096);_0x51707b(_0x30202c[_0x4e12('0xa')](0x1f4,_0xfefd5d[_0x4e12('0xd')]));});});};exports[_0x4e12('0x1b')]=function(_0x5ed06c){var _0x47541b=this;return new Promise(function(_0x4b4148,_0x761f97){return db[_0x4e12('0x1c')][_0x4e12('0x1d')]({'raw':_0x5ed06c['options']?_0x5ed06c[_0x4e12('0x12')][_0x4e12('0x13')]===undefined?!![]:![]:!![],'where':_0x5ed06c[_0x4e12('0x12')]?_0x5ed06c[_0x4e12('0x12')]['where']||null:null,'attributes':_0x5ed06c[_0x4e12('0x12')]?_0x5ed06c[_0x4e12('0x12')][_0x4e12('0x19')]||null:null,'include':_0x5ed06c[_0x4e12('0x12')]?_0x5ed06c[_0x4e12('0x12')][_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x5ed06c['options'][_0x4e12('0x16')],function(_0x5d70ef){return{'model':db[_0x5d70ef[_0x4e12('0x18')]],'as':_0x5d70ef['as'],'attributes':_0x5d70ef[_0x4e12('0x19')],'include':_0x5d70ef[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x5d70ef['include'],function(_0x3ecc4a){return{'model':db[_0x3ecc4a[_0x4e12('0x18')]],'as':_0x3ecc4a['as'],'attributes':_0x3ecc4a[_0x4e12('0x19')],'include':_0x3ecc4a['include']?_[_0x4e12('0x17')](_0x3ecc4a[_0x4e12('0x16')],function(_0x3ba948){return{'model':db[_0x3ba948[_0x4e12('0x18')]],'as':_0x3ba948['as'],'attributes':_0x3ba948[_0x4e12('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e12('0x6')](function(_0x4a9301){logger['info'](_0x4e12('0x1b'),_0x5ed06c);logger[_0x4e12('0x1e')](_0x4e12('0x1b'),_0x5ed06c,JSON[_0x4e12('0x1a')](_0x4a9301));_0x4b4148(_0x4a9301);})[_0x4e12('0xf')](function(_0x158b1d){logger[_0x4e12('0xa')]('ShowCmHopper',_0x158b1d['message'],_0x5ed06c);_0x761f97(_0x47541b['error'](0x1f4,_0x158b1d[_0x4e12('0xd')]));});});};exports['CreateCmHopper']=function(_0x5ce774){var _0x23093f=this;return new Promise(function(_0xd81d28,_0x432055){return db[_0x4e12('0x1c')][_0x4e12('0x1f')](_0x5ce774[_0x4e12('0x20')],{'raw':_0x5ce774['options']?_0x5ce774[_0x4e12('0x12')][_0x4e12('0x13')]===undefined?!![]:![]:!![]})['then'](function(_0x221ac4){logger[_0x4e12('0x7')](_0x4e12('0x21'),_0x5ce774);logger['debug'](_0x4e12('0x21'),_0x5ce774,JSON[_0x4e12('0x1a')](_0x221ac4));_0xd81d28(_0x221ac4);})[_0x4e12('0xf')](function(_0x45058d){logger[_0x4e12('0xa')](_0x4e12('0x21'),_0x45058d['message'],_0x5ce774);_0x432055(_0x23093f['error'](0x1f4,_0x45058d['message']));});});};exports[_0x4e12('0x22')]=function(_0x167c59){var _0x2f7fd2=this;return new Promise(function(_0x4f7af2,_0x27cd51){return db['CmHopper']['update'](_0x167c59[_0x4e12('0x20')],{'raw':_0x167c59[_0x4e12('0x12')]?_0x167c59[_0x4e12('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x167c59['options']?_0x167c59[_0x4e12('0x12')]['where']||null:null,'attributes':_0x167c59[_0x4e12('0x12')]?_0x167c59[_0x4e12('0x12')][_0x4e12('0x19')]||null:null,'limit':_0x167c59[_0x4e12('0x12')]?_0x167c59['options'][_0x4e12('0x15')]||null:null})[_0x4e12('0x6')](function(_0x489c95){logger['info'](_0x4e12('0x22'),_0x167c59);logger[_0x4e12('0x7')](_0x4e12('0x23'),JSON[_0x4e12('0x1a')](_0x167c59[_0x4e12('0x12')][_0x4e12('0x14')]),_0x167c59[_0x4e12('0x20')][_0x4e12('0x24')]);logger[_0x4e12('0x1e')]('UpdateCmHopper',_0x167c59,JSON[_0x4e12('0x1a')](_0x489c95));_0x4f7af2(_0x489c95);})['catch'](function(_0x937a73){logger['error'](_0x4e12('0x22'),_0x937a73[_0x4e12('0xd')],_0x167c59);_0x27cd51(_0x2f7fd2[_0x4e12('0xa')](0x1f4,_0x937a73[_0x4e12('0xd')]));});});};exports[_0x4e12('0x25')]=function(_0x2b7309){var _0x5e9b6e=this;return new Promise(function(_0x5f300a,_0x165433){return db[_0x4e12('0x1c')][_0x4e12('0x26')]({'where':_0x2b7309[_0x4e12('0x12')]?_0x2b7309[_0x4e12('0x12')][_0x4e12('0x14')]||null:null})[_0x4e12('0x6')](function(_0xa15b7b){logger[_0x4e12('0x7')](_0x4e12('0x25'),_0x2b7309);logger[_0x4e12('0x1e')](_0x4e12('0x25'),_0x2b7309,JSON[_0x4e12('0x1a')](_0xa15b7b));_0x5f300a(_0xa15b7b);})[_0x4e12('0xf')](function(_0x3a780a){logger[_0x4e12('0xa')]('DestroyCmHopper',_0x3a780a[_0x4e12('0xd')],_0x2b7309);_0x165433(_0x5e9b6e[_0x4e12('0xa')](0x1f4,_0x3a780a[_0x4e12('0xd')]));});});};exports['GetContactDialer']=function(_0x11a89d){var _0x394742=this;return new Promise(function(_0xec5f1,_0x2fa339){return db[_0x4e12('0x27')]['describe']()['then'](function(_0x1b3a6e){return db[_0x4e12('0x28')]['transaction'](function(_0x578928){return db[_0x4e12('0x1c')][_0x4e12('0x11')]({'where':_0x11a89d[_0x4e12('0x12')]?_0x11a89d[_0x4e12('0x12')][_0x4e12('0x14')]||null:null,'attributes':_0x11a89d[_0x4e12('0x12')]?_0x11a89d[_0x4e12('0x12')][_0x4e12('0x19')]||null:null,'limit':_0x11a89d[_0x4e12('0x12')]?_0x11a89d[_0x4e12('0x12')]['limit']||null:null,'order':_0x11a89d[_0x4e12('0x12')]?_0x11a89d[_0x4e12('0x12')]['order']||null:null,'transaction':_0x578928,'lock':_0x578928['LOCK'][_0x4e12('0x29')],'include':[{'model':db['CmContact'],'as':_0x4e12('0x2a'),'attributes':_[_0x4e12('0x2b')](_0x1b3a6e)},{'model':db[_0x4e12('0x2c')],'as':_0x4e12('0x2d'),'attributes':['id',_0x4e12('0x2e'),_0x4e12('0x2f')]}]})[_0x4e12('0x6')](function(_0x2334bd){var _0x1a3a37=[];var _0x46dc70=[];for(var _0x2ac1aa=0x0;_0x2ac1aa<_0x2334bd[_0x4e12('0x30')];_0x2ac1aa+=0x1){var _0x29c221=_0x2334bd[_0x2ac1aa][_0x4e12('0x31')];if(_0x29c221===null){_0x1a3a37[_0x4e12('0x32')](_0x2334bd[_0x2ac1aa][_0x4e12('0x33')](_0x11a89d[_0x4e12('0x20')],{'transaction':_0x578928}));}else if(!_0x46dc70[_0x4e12('0x34')](_0x29c221)){_0x46dc70['push'](_0x29c221);_0x1a3a37[_0x4e12('0x32')](_0x2334bd[_0x2ac1aa][_0x4e12('0x33')](_0x11a89d[_0x4e12('0x20')],{'transaction':_0x578928}));}}return BPromise[_0x4e12('0x35')](_0x1a3a37);});})[_0x4e12('0x6')](function(_0x17831a){logger[_0x4e12('0x7')](_0x4e12('0x36'),_0x11a89d);if(_0x17831a['length']>0x0){logger[_0x4e12('0x7')](_0x4e12('0x37'),_0x17831a[0x0][_0x4e12('0x38')]['id'],_0x17831a[0x0][_0x4e12('0x38')]['ContactId'],_0x17831a[0x0][_0x4e12('0x38')][_0x4e12('0x24')]);}logger['debug'](_0x4e12('0x36'),_0x11a89d,JSON[_0x4e12('0x1a')](_0x17831a));_0xec5f1(_0x17831a);})[_0x4e12('0xf')](function(_0x3bedeb){logger[_0x4e12('0xa')]('GetContactDialer',_0x3bedeb[_0x4e12('0xd')],_0x11a89d);_0x2fa339(_0x394742['error'](0x1f4,_0x3bedeb[_0x4e12('0xd')]));});});});};exports[_0x4e12('0x39')]=function(_0x106de4){var _0x5ae129=this;return new Promise(function(_0x4535c6,_0x24ea9c){return db[_0x4e12('0x28')][_0x4e12('0x3a')](function(_0x2acf19){return db['CmHopperFinal'][_0x4e12('0x1f')](_0x106de4[_0x4e12('0x20')],{'raw':_0x106de4['options']?_0x106de4['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x2acf19})[_0x4e12('0x6')](function(){logger[_0x4e12('0x7')](_0x4e12('0x3b'),JSON['stringify'](_0x106de4[_0x4e12('0x12')]['where']),_0x106de4[_0x4e12('0x12')]['where'][_0x4e12('0x24')]);return db['CmHopper'][_0x4e12('0x26')]({'where':_0x106de4[_0x4e12('0x12')]?_0x106de4[_0x4e12('0x12')]['where']||null:null,'transaction':_0x2acf19});});})[_0x4e12('0x6')](function(_0x127607){logger[_0x4e12('0x7')](_0x4e12('0x39'),_0x106de4);logger[_0x4e12('0x1e')](_0x4e12('0x39'),_0x106de4,JSON['stringify'](_0x127607));_0x4535c6(_0x127607);})[_0x4e12('0xf')](function(_0x467567){logger[_0x4e12('0xa')](_0x4e12('0x39'),_0x467567[_0x4e12('0xd')],_0x106de4);_0x24ea9c(_0x5ae129[_0x4e12('0xa')](0x1f4,_0x467567[_0x4e12('0xd')]));});});};exports[_0x4e12('0x3c')]=function(_0x236e1f){var _0x19d6fe=this;return new Promise(function(_0x4b9c2f,_0x5ac026){return db['CmHopper'][_0x4e12('0x11')]({'raw':_0x236e1f[_0x4e12('0x12')]?_0x236e1f['options'][_0x4e12('0x13')]===undefined?!![]:![]:!![],'where':_0x236e1f['options']?_0x236e1f[_0x4e12('0x12')][_0x4e12('0x14')]||null:null,'attributes':[[db[_0x4e12('0x28')]['fn'](_0x4e12('0x3d'),db[_0x4e12('0x28')]['fn']('IF',db[_0x4e12('0x28')][_0x4e12('0x3e')](_0x4e12('0x3f')+util[_0x4e12('0x40')]('\x22%s\x22',moment()[_0x4e12('0x40')](_0x4e12('0x41')))+_0x4e12('0x42')))),_0x4e12('0x43')]]})[_0x4e12('0x6')](function(_0x31a997){logger[_0x4e12('0x7')](_0x4e12('0x3c'),_0x236e1f);logger[_0x4e12('0x1e')](_0x4e12('0x3c'),_0x236e1f,JSON[_0x4e12('0x1a')](_0x31a997));_0x4b9c2f(_0x31a997);})[_0x4e12('0xf')](function(_0x53d1ef){logger[_0x4e12('0xa')](_0x4e12('0x3c'),_0x53d1ef['message'],_0x236e1f);_0x5ac026(_0x19d6fe[_0x4e12('0xa')](0x1f4,_0x53d1ef[_0x4e12('0xd')]));});});};exports[_0x4e12('0x44')]=function(_0x3a7814){var _0x5d9de2=this;return new Promise(function(_0x22cce2,_0x2853bf){return db[_0x4e12('0x27')][_0x4e12('0x45')]()[_0x4e12('0x6')](function(_0x357570){return db[_0x4e12('0x28')][_0x4e12('0x3a')](function(_0x24bb27){return db[_0x4e12('0x1c')][_0x4e12('0x11')]({'where':_0x3a7814[_0x4e12('0x12')]?_0x3a7814[_0x4e12('0x12')][_0x4e12('0x14')]||null:null,'attributes':_0x3a7814[_0x4e12('0x12')]?_0x3a7814[_0x4e12('0x12')][_0x4e12('0x19')]||null:null,'limit':0x1,'order':_0x3a7814['options']?_0x3a7814[_0x4e12('0x12')][_0x4e12('0x46')]||null:null,'group':db[_0x4e12('0x1c')][_0x4e12('0x31')],'transaction':_0x24bb27,'lock':_0x24bb27['LOCK'][_0x4e12('0x29')],'include':_0x3a7814['options']?_0x3a7814[_0x4e12('0x12')][_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x3a7814[_0x4e12('0x12')][_0x4e12('0x16')],function(_0x146d66){return{'model':db[_0x146d66[_0x4e12('0x18')]],'as':_0x146d66['as'],'attributes':_0x146d66[_0x4e12('0x19')],'include':_0x146d66[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x146d66['include'],function(_0xbb914){return{'model':db[_0xbb914[_0x4e12('0x18')]],'as':_0xbb914['as'],'attributes':_0xbb914[_0x4e12('0x19')],'include':_0xbb914[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0xbb914[_0x4e12('0x16')],function(_0x3080e0){return{'model':db[_0x3080e0[_0x4e12('0x18')]],'as':_0x3080e0['as'],'attributes':_0x3080e0[_0x4e12('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e12('0x6')](function(_0x5871ad){var _0x46f1b1=[];for(var _0x3f2dcc=0x0;_0x3f2dcc<_0x5871ad[_0x4e12('0x30')];_0x3f2dcc+=0x1){_0x46f1b1[_0x4e12('0x32')](_0x5871ad[_0x3f2dcc][_0x4e12('0x33')](_0x3a7814[_0x4e12('0x20')],{'transaction':_0x24bb27}));}return BPromise['all'](_0x46f1b1);});})[_0x4e12('0x6')](function(_0xcd106b){logger['info'](_0x4e12('0x44'),_0x3a7814);logger[_0x4e12('0x1e')](_0x4e12('0x44'),_0x3a7814,JSON[_0x4e12('0x1a')](_0xcd106b));_0x22cce2(_0xcd106b);})[_0x4e12('0xf')](function(_0x378963){logger[_0x4e12('0xa')]('GetContactRecallMe',_0x378963['message'],_0x3a7814);_0x2853bf(_0x5d9de2[_0x4e12('0xa')](0x1f4,_0x378963[_0x4e12('0xd')]));});});});};exports[_0x4e12('0x47')]=function(_0x259b4d){var _0x17c33f=this;return new Promise(function(_0x40462e,_0x3f682d){db['CmContact'][_0x4e12('0x45')]()[_0x4e12('0x6')](function(_0x41b1bb){return db[_0x4e12('0x1c')]['findAll']({'raw':_0x259b4d[_0x4e12('0x12')]?_0x259b4d['options'][_0x4e12('0x13')]===undefined?!![]:![]:!![],'where':_0x259b4d[_0x4e12('0x12')]?_0x259b4d[_0x4e12('0x12')][_0x4e12('0x14')]||null:null,'attributes':_0x259b4d['options']?_0x259b4d[_0x4e12('0x12')][_0x4e12('0x19')]||null:null,'limit':_0x259b4d[_0x4e12('0x12')]?_0x259b4d[_0x4e12('0x12')][_0x4e12('0x15')]||null:null,'include':_0x259b4d['options']?_0x259b4d[_0x4e12('0x12')][_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x259b4d[_0x4e12('0x12')][_0x4e12('0x16')],function(_0x53f5bd){return{'model':db[_0x53f5bd[_0x4e12('0x18')]],'as':_0x53f5bd['as'],'attributes':_0x53f5bd['as']===_0x4e12('0x2a')?_[_0x4e12('0x2b')](_0x41b1bb):_0x53f5bd['attributes'],'include':_0x53f5bd[_0x4e12('0x16')]?_[_0x4e12('0x17')](_0x53f5bd['include'],function(_0x26314a){return{'model':db[_0x26314a[_0x4e12('0x18')]],'as':_0x26314a['as'],'attributes':_0x26314a[_0x4e12('0x19')],'include':_0x26314a[_0x4e12('0x16')]?_['map'](_0x26314a[_0x4e12('0x16')],function(_0x499995){return{'model':db[_0x499995[_0x4e12('0x18')]],'as':_0x499995['as'],'attributes':_0x499995[_0x4e12('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e12('0x6')](function(_0x45aa9d){logger['info']('GetCmHopper',_0x259b4d);logger[_0x4e12('0x1e')](_0x4e12('0x10'),_0x259b4d,JSON['stringify'](_0x45aa9d));_0x40462e(_0x45aa9d);})[_0x4e12('0xf')](function(_0xd5f317){logger[_0x4e12('0xa')](_0x4e12('0x10'),_0xd5f317[_0x4e12('0xd')],_0x259b4d);_0x3f682d(_0x17c33f['error'](0x1f4,_0xd5f317[_0x4e12('0xd')]));});});});};exports['GetContactByPhone']=function(_0x581305){var _0xdf4fe0=this;return new Promise(function(_0x4f6093,_0x1d5156){return db[_0x4e12('0x27')]['findOne']({'raw':!![],'where':{'phone':_0x581305[_0x4e12('0x12')]['where'][_0x4e12('0x48')]},'attributes':['id',_0x4e12('0x49')],'order':[['id',_0x4e12('0x4a')]]})[_0x4e12('0x6')](function(_0x45b14f){logger[_0x4e12('0x7')](_0x4e12('0x4b'),_0x581305);logger[_0x4e12('0x1e')](_0x4e12('0x4b'),_0x581305,JSON[_0x4e12('0x1a')](_0x45b14f));_0x4f6093(_0x45b14f);})[_0x4e12('0xf')](function(_0x3fccdd){logger[_0x4e12('0xa')](_0x4e12('0x4b'),_0x3fccdd[_0x4e12('0xd')],_0x581305);_0x1d5156(_0xdf4fe0[_0x4e12('0xa')](0x1f4,_0x3fccdd['message']));});});};exports[_0x4e12('0x4c')]=function(_0x530030){var _0x2430d3=this;return new Promise(function(_0x12f49c,_0x1e6cd9){return db[_0x4e12('0x28')][_0x4e12('0x3a')](function(_0x34a338){return db['CmHopper'][_0x4e12('0x33')](_0x530030['body'],{'where':{},'transaction':_0x34a338})['then'](function(_0xb761dd){logger['info'](_0x4e12('0x4c'),_0x530030);logger[_0x4e12('0x1e')](_0x4e12('0x4c'),_0x530030,JSON[_0x4e12('0x1a')](_0xb761dd));_0x12f49c(_0xb761dd);})['catch'](function(_0x41c476){logger[_0x4e12('0xa')](_0x4e12('0x4c'),_0x41c476[_0x4e12('0xd')],_0x530030);_0x1e6cd9(_0x2430d3[_0x4e12('0xa')](0x1f4,_0x41c476[_0x4e12('0xd')]));});});});};exports[_0x4e12('0x4d')]=function(_0x5bf75e){var _0xbefb2e=this;var _0x5c9630=_0x5bf75e[_0x4e12('0x20')][_0x4e12('0x14')]['voiceQueueIds'];var _0x4ca520=_0x5bf75e[_0x4e12('0x20')]['where'][_0x4e12('0x4e')];var _0x531599=_0x5bf75e['body']['where'][_0x4e12('0x4f')];return new Promise(function(_0xc99fa0,_0x593e00){return db[_0x4e12('0x1c')]['findAll']({'where':{'voiceQueueId':{'$in':_0x5c9630},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4e12('0x28')][_0x4e12('0x3e')](_0x4e12('0x50')+_0x4ca520+_0x4e12('0x51')),'$gt':db[_0x4e12('0x28')][_0x4e12('0x3e')]('NOW()')}},'UserId':{'$in':_0x531599}},'include':[{'model':db[_0x4e12('0x27')],'as':_0x4e12('0x2a')},{'model':db[_0x4e12('0x2c')],'as':'Agent','attributes':['id',_0x4e12('0x2e'),_0x4e12('0x2f')]},{'model':db[_0x4e12('0x52')],'as':_0x4e12('0x53')}]})[_0x4e12('0x6')](function(_0x1980ab){if(_0x1980ab[_0x4e12('0x30')]>0x0){return db[_0x4e12('0x28')][_0x4e12('0x3a')](function(_0x230921){return db[_0x4e12('0x1c')]['update']({'recallmeNotifiedDate':db[_0x4e12('0x28')]['literal'](_0x4e12('0x54'))},{'where':{'id':{'$in':_[_0x4e12('0x17')](_0x1980ab,'id')}},'transaction':_0x230921})[_0x4e12('0x6')](function(){_0xc99fa0(_0x1980ab);})['catch'](function(_0x22da86){logger['error'](_0x4e12('0x4d'),_0x22da86['message'],_0x5bf75e);_0x593e00(_0xbefb2e[_0x4e12('0xa')](0x1f4,_0x22da86[_0x4e12('0xd')]));});})[_0x4e12('0xf')](function(_0x54521a){logger[_0x4e12('0xa')]('CmHopperHandlePreviewRecallNotifications',_0x54521a[_0x4e12('0xd')],_0x5bf75e);_0x593e00(_0xbefb2e[_0x4e12('0xa')](0x1f4,_0x54521a[_0x4e12('0xd')]));});}else{_0xc99fa0(_0x1980ab);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c2a9f9a..18655bb 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 _0x1289=['update','delete','destroy','express','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put'];(function(_0xd8dab8,_0x5d35da){var _0x41c119=function(_0x2ba039){while(--_0x2ba039){_0xd8dab8['push'](_0xd8dab8['shift']());}};_0x41c119(++_0x5d35da);}(_0x1289,0x13b));var _0x9128=function(_0x4777f6,_0x429478){_0x4777f6=_0x4777f6-0x0;var _0x56c2de=_0x1289[_0x4777f6];return _0x56c2de;};'use strict';var express=require(_0x9128('0x0'));var router=express['Router']();var auth=require(_0x9128('0x1'));var controller=require(_0x9128('0x2'));router[_0x9128('0x3')]('/',auth[_0x9128('0x4')](),controller[_0x9128('0x5')]);router['get'](_0x9128('0x6'),auth[_0x9128('0x4')](),controller[_0x9128('0x7')]);router[_0x9128('0x3')](_0x9128('0x8'),auth[_0x9128('0x4')](),controller[_0x9128('0x9')]);router[_0x9128('0x3')](_0x9128('0xa'),auth[_0x9128('0x4')](),controller['getTimezones']);router[_0x9128('0x3')](_0x9128('0xb'),auth[_0x9128('0x4')](),controller[_0x9128('0xc')]);router[_0x9128('0x3')](_0x9128('0xd'),auth['isAuthenticated'](),controller[_0x9128('0xe')]);router[_0x9128('0xf')]('/',auth[_0x9128('0x4')](),controller[_0x9128('0x10')]);router[_0x9128('0xf')](_0x9128('0x11'),auth[_0x9128('0x4')](),controller[_0x9128('0x12')]);router[_0x9128('0xf')]('/timezone',auth[_0x9128('0x4')](),controller[_0x9128('0x13')]);router[_0x9128('0x14')](_0x9128('0xb'),auth[_0x9128('0x4')](),controller[_0x9128('0x15')]);router[_0x9128('0x16')](_0x9128('0xb'),auth[_0x9128('0x4')](),controller[_0x9128('0x17')]);module['exports']=router; \ No newline at end of file +var _0x5799=['/timezone','getTimezone','update','exports','express','../../components/auth/service','get','isAuthenticated','describe','/opencontacts','/timezones','getTimezones','/:id','post','create','/preview','getPreview'];(function(_0x2b8e36,_0x4145eb){var _0x3255a6=function(_0x52cb14){while(--_0x52cb14){_0x2b8e36['push'](_0x2b8e36['shift']());}};_0x3255a6(++_0x4145eb);}(_0x5799,0x1ad));var _0x9579=function(_0x2f4c94,_0x112089){_0x2f4c94=_0x2f4c94-0x0;var _0x4f6e55=_0x5799[_0x2f4c94];return _0x4f6e55;};'use strict';var express=require(_0x9579('0x0'));var router=express['Router']();var auth=require(_0x9579('0x1'));var controller=require('./cmHopper.controller');router[_0x9579('0x2')]('/',auth[_0x9579('0x3')](),controller['index']);router[_0x9579('0x2')]('/describe',auth[_0x9579('0x3')](),controller[_0x9579('0x4')]);router[_0x9579('0x2')](_0x9579('0x5'),auth[_0x9579('0x3')](),controller['getOpenContacts']);router['get'](_0x9579('0x6'),auth[_0x9579('0x3')](),controller[_0x9579('0x7')]);router['get'](_0x9579('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x9579('0x2')]('/:id/previewrecall',auth[_0x9579('0x3')](),controller['getPreviewRecall']);router[_0x9579('0x9')]('/',auth[_0x9579('0x3')](),controller[_0x9579('0xa')]);router['post'](_0x9579('0xb'),auth['isAuthenticated'](),controller[_0x9579('0xc')]);router[_0x9579('0x9')](_0x9579('0xd'),auth['isAuthenticated'](),controller[_0x9579('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9579('0xf')]);router['delete'](_0x9579('0x8'),auth[_0x9579('0x3')](),controller['destroy']);module[_0x9579('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 133e09d..8d5026a 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 _0xf104=['format','moment','exports','INTEGER','STRING','DATE'];(function(_0x205123,_0x240ebe){var _0x5b69fb=function(_0x488aaf){while(--_0x488aaf){_0x205123['push'](_0x205123['shift']());}};_0x5b69fb(++_0x240ebe);}(_0xf104,0xeb));var _0x4f10=function(_0x58746d,_0x393abc){_0x58746d=_0x58746d-0x0;var _0x442bed=_0xf104[_0x58746d];return _0x442bed;};'use strict';var moment=require(_0x4f10('0x0'));var Sequelize=require('sequelize');module[_0x4f10('0x1')]={'CmHopperId':{'type':Sequelize[_0x4f10('0x2')]},'phone':{'type':Sequelize[_0x4f10('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x4f10('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4f10('0x4')],'defaultValue':moment()[_0x4f10('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x4f10('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4f10('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4f10('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4f10('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4f10('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4f10('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4f10('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x21ec=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER'];(function(_0x3442f9,_0x3e901f){var _0x286f5=function(_0x4c11c7){while(--_0x4c11c7){_0x3442f9['push'](_0x3442f9['shift']());}};_0x286f5(++_0x3e901f);}(_0x21ec,0x12c));var _0xc21e=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x21ec[_0xefd519];return _0x4bb882;};'use strict';var moment=require(_0xc21e('0x0'));var Sequelize=require(_0xc21e('0x1'));module[_0xc21e('0x2')]={'CmHopperId':{'type':Sequelize[_0xc21e('0x3')]},'phone':{'type':Sequelize[_0xc21e('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xc21e('0x5')],'defaultValue':moment()[_0xc21e('0x6')](_0xc21e('0x7'))},'countbusyretry':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc21e('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index e7cbb88..5a1fb20 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 _0xa5a4=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','options','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','CmHopperAdditionalPhones','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','query','keys','model','attributes'];(function(_0x191eb7,_0x4385e6){var _0x5a0ce1=function(_0x51dd18){while(--_0x51dd18){_0x191eb7['push'](_0x191eb7['shift']());}};_0x5a0ce1(++_0x4385e6);}(_0xa5a4,0x172));var _0x4a5a=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0xa5a4[_0x2a56ad];return _0x425175;};'use strict';var emlformat=require(_0x4a5a('0x0'));var rimraf=require(_0x4a5a('0x1'));var zipdir=require(_0x4a5a('0x2'));var jsonpatch=require(_0x4a5a('0x3'));var rp=require(_0x4a5a('0x4'));var moment=require(_0x4a5a('0x5'));var BPromise=require(_0x4a5a('0x6'));var Mustache=require(_0x4a5a('0x7'));var util=require('util');var path=require(_0x4a5a('0x8'));var sox=require(_0x4a5a('0x9'));var csv=require(_0x4a5a('0xa'));var ejs=require(_0x4a5a('0xb'));var fs=require('fs');var fs_extra=require(_0x4a5a('0xc'));var _=require(_0x4a5a('0xd'));var squel=require(_0x4a5a('0xe'));var crypto=require(_0x4a5a('0xf'));var jsforce=require(_0x4a5a('0x10'));var deskjs=require(_0x4a5a('0x11'));var toCsv=require(_0x4a5a('0xa'));var querystring=require(_0x4a5a('0x12'));var Papa=require(_0x4a5a('0x13'));var Redis=require('ioredis');var authService=require(_0x4a5a('0x14'));var qs=require(_0x4a5a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4a5a('0x16'));var utils=require('../../config/utils');var config=require(_0x4a5a('0x17'));var licenseUtil=require(_0x4a5a('0x18'));var db=require(_0x4a5a('0x19'))['db'];function respondWithStatusCode(_0x3df89c,_0x10f425){_0x10f425=_0x10f425||0xcc;return function(_0x435915){if(_0x435915){return _0x3df89c[_0x4a5a('0x1a')](_0x10f425);}return _0x3df89c[_0x4a5a('0x1b')](_0x10f425)[_0x4a5a('0x1c')]();};}function respondWithResult(_0x25627f,_0x5996c8){_0x5996c8=_0x5996c8||0xc8;return function(_0x3b8a82){if(_0x3b8a82){return _0x25627f[_0x4a5a('0x1b')](_0x5996c8)[_0x4a5a('0x1d')](_0x3b8a82);}};}function respondWithFilteredResult(_0x5e6065,_0x4d4c50){return function(_0x5247fb){if(_0x5247fb){var _0x1db666=typeof _0x4d4c50[_0x4a5a('0x1e')]===_0x4a5a('0x1f')&&typeof _0x4d4c50[_0x4a5a('0x20')]===_0x4a5a('0x1f');var _0x5efd67=_0x5247fb[_0x4a5a('0x21')];var _0x50644b=_0x1db666?0x0:_0x4d4c50[_0x4a5a('0x1e')];var _0x510ea2=_0x1db666?_0x5247fb[_0x4a5a('0x21')]:_0x4d4c50[_0x4a5a('0x1e')]+_0x4d4c50[_0x4a5a('0x20')];var _0x317389;if(_0x510ea2>=_0x5efd67){_0x510ea2=_0x5efd67;_0x317389=0xc8;}else{_0x317389=0xce;}_0x5e6065[_0x4a5a('0x1b')](_0x317389);return _0x5e6065[_0x4a5a('0x22')](_0x4a5a('0x23'),_0x50644b+'-'+_0x510ea2+'/'+_0x5efd67)[_0x4a5a('0x1d')](_0x5247fb);}return null;};}function patchUpdates(_0x3d4a88){return function(_0x40fbdc){try{jsonpatch[_0x4a5a('0x24')](_0x40fbdc,_0x3d4a88,!![]);}catch(_0x504a2e){return BPromise['reject'](_0x504a2e);}return _0x40fbdc['save']();};}function saveUpdates(_0xd5651a,_0x4bd34d){return function(_0x315a15){if(_0x315a15){return _0x315a15[_0x4a5a('0x25')](_0xd5651a)[_0x4a5a('0x26')](function(_0x514852){return _0x514852;});}return null;};}function removeEntity(_0x47a986,_0x85d95b){return function(_0x37b4a1){if(_0x37b4a1){return _0x37b4a1[_0x4a5a('0x27')]()[_0x4a5a('0x26')](function(){var _0x2366f0=_0x37b4a1[_0x4a5a('0x28')]({'plain':!![]});var _0xcb3f33=_0x4a5a('0x29');return db['UserProfileResource'][_0x4a5a('0x27')]({'where':{'type':_0xcb3f33,'resourceId':_0x2366f0['id']}})[_0x4a5a('0x26')](function(){return _0x37b4a1;});})[_0x4a5a('0x26')](function(){_0x47a986['status'](0xcc)[_0x4a5a('0x1c')]();});}};}function handleEntityNotFound(_0x12e74c,_0x3c8829){return function(_0x3854fa){if(!_0x3854fa){_0x12e74c[_0x4a5a('0x1a')](0x194);}return _0x3854fa;};}function handleError(_0x3c2050,_0x29e488){_0x29e488=_0x29e488||0x1f4;return function(_0x3dfa1d){logger[_0x4a5a('0x2a')](_0x3dfa1d[_0x4a5a('0x2b')]);if(_0x3dfa1d['name']){delete _0x3dfa1d[_0x4a5a('0x2c')];}_0x3c2050[_0x4a5a('0x1b')](_0x29e488)[_0x4a5a('0x2d')](_0x3dfa1d);};}exports['index']=function(_0xf61b33,_0x3e1737){var _0x5d60b1={},_0xbc2650={},_0x79e519={'count':0x0,'rows':[]};var _0x19e806=_[_0x4a5a('0x2e')](db[_0x4a5a('0x2f')][_0x4a5a('0x30')],function(_0x19ff86){return{'name':_0x19ff86[_0x4a5a('0x31')],'type':_0x19ff86[_0x4a5a('0x32')]['key']};});_0xbc2650['model']=_[_0x4a5a('0x2e')](_0x19e806,_0x4a5a('0x2c'));_0xbc2650[_0x4a5a('0x33')]=_[_0x4a5a('0x34')](_0xf61b33[_0x4a5a('0x33')]);_0xbc2650['filters']=_['intersection'](_0xbc2650[_0x4a5a('0x35')],_0xbc2650[_0x4a5a('0x33')]);_0x5d60b1[_0x4a5a('0x36')]=_[_0x4a5a('0x37')](_0xbc2650[_0x4a5a('0x35')],qs[_0x4a5a('0x38')](_0xf61b33[_0x4a5a('0x33')]['fields']));_0x5d60b1[_0x4a5a('0x36')]=_0x5d60b1['attributes'][_0x4a5a('0x39')]?_0x5d60b1[_0x4a5a('0x36')]:_0xbc2650[_0x4a5a('0x35')];if(!_0xf61b33[_0x4a5a('0x33')][_0x4a5a('0x3a')](_0x4a5a('0x3b'))){_0x5d60b1[_0x4a5a('0x20')]=qs[_0x4a5a('0x20')](_0xf61b33[_0x4a5a('0x33')][_0x4a5a('0x20')]);_0x5d60b1[_0x4a5a('0x1e')]=qs['offset'](_0xf61b33[_0x4a5a('0x33')][_0x4a5a('0x1e')]);}_0x5d60b1[_0x4a5a('0x3c')]=qs[_0x4a5a('0x3d')](_0xf61b33[_0x4a5a('0x33')][_0x4a5a('0x3d')]);_0x5d60b1[_0x4a5a('0x3e')]=qs[_0x4a5a('0x3f')](_[_0x4a5a('0x40')](_0xf61b33[_0x4a5a('0x33')],_0xbc2650['filters']),_0x19e806);if(_0xf61b33[_0x4a5a('0x33')]['filter']){_0x5d60b1[_0x4a5a('0x3e')]=_[_0x4a5a('0x41')](_0x5d60b1['where'],{'$or':_['map'](_0x19e806,function(_0x4901c4){if(_0x4901c4[_0x4a5a('0x32')]!==_0x4a5a('0x42')){var _0x2fc9ef={};_0x2fc9ef[_0x4901c4[_0x4a5a('0x2c')]]={'$like':'%'+_0xf61b33[_0x4a5a('0x33')][_0x4a5a('0x43')]+'%'};return _0x2fc9ef;}})});}_0x5d60b1=_[_0x4a5a('0x41')]({},_0x5d60b1,_0xf61b33['options']);var _0x1b964a={'where':_0x5d60b1[_0x4a5a('0x3e')]};return db[_0x4a5a('0x2f')][_0x4a5a('0x21')](_0x1b964a)['then'](function(_0x3c2a30){_0x79e519[_0x4a5a('0x21')]=_0x3c2a30;if(_0xf61b33['query'][_0x4a5a('0x44')]){_0x5d60b1[_0x4a5a('0x45')]=[{'all':!![]}];}return db[_0x4a5a('0x2f')][_0x4a5a('0x46')](_0x5d60b1);})['then'](function(_0x2cbf0c){_0x79e519[_0x4a5a('0x47')]=_0x2cbf0c;return _0x79e519;})[_0x4a5a('0x26')](respondWithFilteredResult(_0x3e1737,_0x5d60b1))['catch'](handleError(_0x3e1737,null));};exports[_0x4a5a('0x48')]=function(_0x3bd645,_0x14778d){var _0x396625={'raw':!![],'where':{'id':_0x3bd645['params']['id']}},_0x5d23e4={};_0x5d23e4[_0x4a5a('0x35')]=_[_0x4a5a('0x34')](db[_0x4a5a('0x2f')][_0x4a5a('0x30')]);_0x5d23e4['query']=_[_0x4a5a('0x34')](_0x3bd645[_0x4a5a('0x33')]);_0x5d23e4['filters']=_[_0x4a5a('0x37')](_0x5d23e4[_0x4a5a('0x35')],_0x5d23e4[_0x4a5a('0x33')]);_0x396625['attributes']=_[_0x4a5a('0x37')](_0x5d23e4[_0x4a5a('0x35')],qs[_0x4a5a('0x38')](_0x3bd645[_0x4a5a('0x33')][_0x4a5a('0x38')]));_0x396625[_0x4a5a('0x36')]=_0x396625[_0x4a5a('0x36')][_0x4a5a('0x39')]?_0x396625[_0x4a5a('0x36')]:_0x5d23e4[_0x4a5a('0x35')];if(_0x3bd645[_0x4a5a('0x33')][_0x4a5a('0x44')]){_0x396625[_0x4a5a('0x45')]=[{'all':!![]}];}_0x396625=_['merge']({},_0x396625,_0x3bd645[_0x4a5a('0x49')]);return db[_0x4a5a('0x2f')][_0x4a5a('0x4a')](_0x396625)['then'](handleEntityNotFound(_0x14778d,null))[_0x4a5a('0x26')](respondWithResult(_0x14778d,null))[_0x4a5a('0x4b')](handleError(_0x14778d,null));};exports[_0x4a5a('0x4c')]=function(_0x2268ce,_0x422237){return db['CmHopperAdditionalPhone'][_0x4a5a('0x4c')](_0x2268ce[_0x4a5a('0x4d')],{})[_0x4a5a('0x26')](function(_0x40ef7b){var _0xe794ea=_0x2268ce[_0x4a5a('0x4e')][_0x4a5a('0x28')]({'plain':!![]});if(!_0xe794ea)throw new Error(_0x4a5a('0x4f'));if(_0xe794ea[_0x4a5a('0x50')]===_0x4a5a('0x4e')){var _0xc8870f=_0x40ef7b[_0x4a5a('0x28')]({'plain':!![]});var _0x1e3c88='CmHopperAdditionalPhones';return db[_0x4a5a('0x51')][_0x4a5a('0x4a')]({'where':{'name':_0x1e3c88,'userProfileId':_0xe794ea['userProfileId']},'raw':!![]})[_0x4a5a('0x26')](function(_0x352c6b){if(_0x352c6b&&_0x352c6b[_0x4a5a('0x52')]===0x0){return db['UserProfileResource'][_0x4a5a('0x4c')]({'name':_0xc8870f[_0x4a5a('0x2c')],'resourceId':_0xc8870f['id'],'type':_0x352c6b[_0x4a5a('0x2c')],'sectionId':_0x352c6b['id']},{})[_0x4a5a('0x26')](function(){return _0x40ef7b;});}else{return _0x40ef7b;}})[_0x4a5a('0x4b')](function(_0x46986f){logger[_0x4a5a('0x2a')](_0x4a5a('0x53'),_0x46986f);throw _0x46986f;});}return _0x40ef7b;})[_0x4a5a('0x26')](respondWithResult(_0x422237,0xc9))[_0x4a5a('0x4b')](handleError(_0x422237,null));};exports[_0x4a5a('0x25')]=function(_0x183444,_0x3a602f){if(_0x183444['body']['id']){delete _0x183444['body']['id'];}return db['CmHopperAdditionalPhone'][_0x4a5a('0x4a')]({'where':{'id':_0x183444['params']['id']}})[_0x4a5a('0x26')](handleEntityNotFound(_0x3a602f,null))['then'](saveUpdates(_0x183444['body'],null))['then'](respondWithResult(_0x3a602f,null))[_0x4a5a('0x4b')](handleError(_0x3a602f,null));};exports['destroy']=function(_0xccb57c,_0x7a5807){return db[_0x4a5a('0x2f')][_0x4a5a('0x4a')]({'where':{'id':_0xccb57c[_0x4a5a('0x54')]['id']}})[_0x4a5a('0x26')](handleEntityNotFound(_0x7a5807,null))[_0x4a5a('0x26')](removeEntity(_0x7a5807,null))[_0x4a5a('0x4b')](handleError(_0x7a5807,null));}; \ No newline at end of file +var _0x1fb5=['send','map','CmHopperAdditionalPhone','fieldName','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x1fb5,0x1c1));var _0x51fb=function(_0x12c877,_0x3b5ef7){_0x12c877=_0x12c877-0x0;var _0x3e592d=_0x1fb5[_0x12c877];return _0x3e592d;};'use strict';var emlformat=require(_0x51fb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x51fb('0x1'));var jsonpatch=require(_0x51fb('0x2'));var rp=require('request-promise');var moment=require(_0x51fb('0x3'));var BPromise=require(_0x51fb('0x4'));var Mustache=require('mustache');var util=require(_0x51fb('0x5'));var path=require(_0x51fb('0x6'));var sox=require(_0x51fb('0x7'));var csv=require('to-csv');var ejs=require(_0x51fb('0x8'));var fs=require('fs');var fs_extra=require(_0x51fb('0x9'));var _=require(_0x51fb('0xa'));var squel=require(_0x51fb('0xb'));var crypto=require(_0x51fb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x51fb('0xd'));var toCsv=require(_0x51fb('0xe'));var querystring=require('querystring');var Papa=require(_0x51fb('0xf'));var Redis=require('ioredis');var authService=require(_0x51fb('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x51fb('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x51fb('0x12'))('api');var utils=require(_0x51fb('0x13'));var config=require(_0x51fb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x51fb('0x15'))['db'];function respondWithStatusCode(_0x18889d,_0x4ed7d6){_0x4ed7d6=_0x4ed7d6||0xcc;return function(_0x1966bf){if(_0x1966bf){return _0x18889d['sendStatus'](_0x4ed7d6);}return _0x18889d[_0x51fb('0x16')](_0x4ed7d6)[_0x51fb('0x17')]();};}function respondWithResult(_0x4498eb,_0x24bc50){_0x24bc50=_0x24bc50||0xc8;return function(_0xd5b2d7){if(_0xd5b2d7){return _0x4498eb[_0x51fb('0x16')](_0x24bc50)[_0x51fb('0x18')](_0xd5b2d7);}};}function respondWithFilteredResult(_0x47efba,_0xd916d0){return function(_0xba5a9e){if(_0xba5a9e){var _0x494a83=typeof _0xd916d0[_0x51fb('0x19')]===_0x51fb('0x1a')&&typeof _0xd916d0['limit']===_0x51fb('0x1a');var _0x9c91e9=_0xba5a9e[_0x51fb('0x1b')];var _0x2e5c8f=_0x494a83?0x0:_0xd916d0[_0x51fb('0x19')];var _0x58f8e7=_0x494a83?_0xba5a9e['count']:_0xd916d0['offset']+_0xd916d0[_0x51fb('0x1c')];var _0xacf4a5;if(_0x58f8e7>=_0x9c91e9){_0x58f8e7=_0x9c91e9;_0xacf4a5=0xc8;}else{_0xacf4a5=0xce;}_0x47efba[_0x51fb('0x16')](_0xacf4a5);return _0x47efba[_0x51fb('0x1d')](_0x51fb('0x1e'),_0x2e5c8f+'-'+_0x58f8e7+'/'+_0x9c91e9)['json'](_0xba5a9e);}return null;};}function patchUpdates(_0x539e42){return function(_0x45c63d){try{jsonpatch[_0x51fb('0x1f')](_0x45c63d,_0x539e42,!![]);}catch(_0x345dbe){return BPromise[_0x51fb('0x20')](_0x345dbe);}return _0x45c63d[_0x51fb('0x21')]();};}function saveUpdates(_0x2f26b6,_0xc5db27){return function(_0x10d9e7){if(_0x10d9e7){return _0x10d9e7[_0x51fb('0x22')](_0x2f26b6)[_0x51fb('0x23')](function(_0x57633c){return _0x57633c;});}return null;};}function removeEntity(_0x57e78b,_0x518fe4){return function(_0x3f0333){if(_0x3f0333){return _0x3f0333[_0x51fb('0x24')]()[_0x51fb('0x23')](function(){var _0x328fba=_0x3f0333[_0x51fb('0x25')]({'plain':!![]});var _0x46685d=_0x51fb('0x26');return db[_0x51fb('0x27')][_0x51fb('0x24')]({'where':{'type':_0x46685d,'resourceId':_0x328fba['id']}})[_0x51fb('0x23')](function(){return _0x3f0333;});})['then'](function(){_0x57e78b[_0x51fb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d5189,_0x3881d7){return function(_0x452f9a){if(!_0x452f9a){_0x1d5189['sendStatus'](0x194);}return _0x452f9a;};}function handleError(_0x577c4a,_0xacc281){_0xacc281=_0xacc281||0x1f4;return function(_0x3dfcf6){logger[_0x51fb('0x28')](_0x3dfcf6[_0x51fb('0x29')]);if(_0x3dfcf6[_0x51fb('0x2a')]){delete _0x3dfcf6[_0x51fb('0x2a')];}_0x577c4a[_0x51fb('0x16')](_0xacc281)[_0x51fb('0x2b')](_0x3dfcf6);};}exports['index']=function(_0x2c1932,_0x519b76){var _0x485f95={},_0x5225c0={},_0x219463={'count':0x0,'rows':[]};var _0x1ce1b6=_[_0x51fb('0x2c')](db[_0x51fb('0x2d')]['rawAttributes'],function(_0x718e39){return{'name':_0x718e39[_0x51fb('0x2e')],'type':_0x718e39['type']['key']};});_0x5225c0['model']=_['map'](_0x1ce1b6,_0x51fb('0x2a'));_0x5225c0[_0x51fb('0x2f')]=_[_0x51fb('0x30')](_0x2c1932[_0x51fb('0x2f')]);_0x5225c0[_0x51fb('0x31')]=_[_0x51fb('0x32')](_0x5225c0[_0x51fb('0x33')],_0x5225c0['query']);_0x485f95[_0x51fb('0x34')]=_[_0x51fb('0x32')](_0x5225c0[_0x51fb('0x33')],qs[_0x51fb('0x35')](_0x2c1932[_0x51fb('0x2f')]['fields']));_0x485f95[_0x51fb('0x34')]=_0x485f95[_0x51fb('0x34')]['length']?_0x485f95[_0x51fb('0x34')]:_0x5225c0[_0x51fb('0x33')];if(!_0x2c1932[_0x51fb('0x2f')][_0x51fb('0x36')]('nolimit')){_0x485f95[_0x51fb('0x1c')]=qs[_0x51fb('0x1c')](_0x2c1932[_0x51fb('0x2f')][_0x51fb('0x1c')]);_0x485f95['offset']=qs[_0x51fb('0x19')](_0x2c1932['query'][_0x51fb('0x19')]);}_0x485f95[_0x51fb('0x37')]=qs[_0x51fb('0x38')](_0x2c1932[_0x51fb('0x2f')][_0x51fb('0x38')]);_0x485f95[_0x51fb('0x39')]=qs[_0x51fb('0x31')](_[_0x51fb('0x3a')](_0x2c1932[_0x51fb('0x2f')],_0x5225c0[_0x51fb('0x31')]),_0x1ce1b6);if(_0x2c1932['query'][_0x51fb('0x3b')]){_0x485f95['where']=_[_0x51fb('0x3c')](_0x485f95[_0x51fb('0x39')],{'$or':_['map'](_0x1ce1b6,function(_0x2bfa9b){if(_0x2bfa9b[_0x51fb('0x3d')]!=='VIRTUAL'){var _0x3c63fc={};_0x3c63fc[_0x2bfa9b[_0x51fb('0x2a')]]={'$like':'%'+_0x2c1932[_0x51fb('0x2f')][_0x51fb('0x3b')]+'%'};return _0x3c63fc;}})});}_0x485f95=_[_0x51fb('0x3c')]({},_0x485f95,_0x2c1932[_0x51fb('0x3e')]);var _0x3ad778={'where':_0x485f95[_0x51fb('0x39')]};return db[_0x51fb('0x2d')][_0x51fb('0x1b')](_0x3ad778)['then'](function(_0x359297){_0x219463[_0x51fb('0x1b')]=_0x359297;if(_0x2c1932[_0x51fb('0x2f')][_0x51fb('0x3f')]){_0x485f95[_0x51fb('0x40')]=[{'all':!![]}];}return db[_0x51fb('0x2d')][_0x51fb('0x41')](_0x485f95);})[_0x51fb('0x23')](function(_0x28298c){_0x219463[_0x51fb('0x42')]=_0x28298c;return _0x219463;})[_0x51fb('0x23')](respondWithFilteredResult(_0x519b76,_0x485f95))[_0x51fb('0x43')](handleError(_0x519b76,null));};exports[_0x51fb('0x44')]=function(_0x3085bb,_0x51ab4c){var _0x122820={'raw':!![],'where':{'id':_0x3085bb[_0x51fb('0x45')]['id']}},_0x5f1542={};_0x5f1542[_0x51fb('0x33')]=_[_0x51fb('0x30')](db[_0x51fb('0x2d')][_0x51fb('0x46')]);_0x5f1542['query']=_[_0x51fb('0x30')](_0x3085bb['query']);_0x5f1542['filters']=_['intersection'](_0x5f1542[_0x51fb('0x33')],_0x5f1542[_0x51fb('0x2f')]);_0x122820[_0x51fb('0x34')]=_[_0x51fb('0x32')](_0x5f1542['model'],qs[_0x51fb('0x35')](_0x3085bb[_0x51fb('0x2f')][_0x51fb('0x35')]));_0x122820[_0x51fb('0x34')]=_0x122820['attributes'][_0x51fb('0x47')]?_0x122820[_0x51fb('0x34')]:_0x5f1542[_0x51fb('0x33')];if(_0x3085bb[_0x51fb('0x2f')]['includeAll']){_0x122820[_0x51fb('0x40')]=[{'all':!![]}];}_0x122820=_['merge']({},_0x122820,_0x3085bb[_0x51fb('0x3e')]);return db[_0x51fb('0x2d')][_0x51fb('0x48')](_0x122820)[_0x51fb('0x23')](handleEntityNotFound(_0x51ab4c,null))[_0x51fb('0x23')](respondWithResult(_0x51ab4c,null))[_0x51fb('0x43')](handleError(_0x51ab4c,null));};exports[_0x51fb('0x49')]=function(_0x437f3c,_0x40dceb){return db[_0x51fb('0x2d')][_0x51fb('0x49')](_0x437f3c[_0x51fb('0x4a')],{})[_0x51fb('0x23')](function(_0x3ad1ee){var _0x227a31=_0x437f3c['user'][_0x51fb('0x25')]({'plain':!![]});if(!_0x227a31)throw new Error(_0x51fb('0x4b'));if(_0x227a31[_0x51fb('0x4c')]===_0x51fb('0x4d')){var _0x51146d=_0x3ad1ee[_0x51fb('0x25')]({'plain':!![]});var _0x46c19d=_0x51fb('0x26');return db[_0x51fb('0x4e')][_0x51fb('0x48')]({'where':{'name':_0x46c19d,'userProfileId':_0x227a31[_0x51fb('0x4f')]},'raw':!![]})['then'](function(_0x40f894){if(_0x40f894&&_0x40f894[_0x51fb('0x50')]===0x0){return db[_0x51fb('0x27')][_0x51fb('0x49')]({'name':_0x51146d['name'],'resourceId':_0x51146d['id'],'type':_0x40f894['name'],'sectionId':_0x40f894['id']},{})[_0x51fb('0x23')](function(){return _0x3ad1ee;});}else{return _0x3ad1ee;}})[_0x51fb('0x43')](function(_0x53b8e5){logger['error'](_0x51fb('0x51'),_0x53b8e5);throw _0x53b8e5;});}return _0x3ad1ee;})[_0x51fb('0x23')](respondWithResult(_0x40dceb,0xc9))[_0x51fb('0x43')](handleError(_0x40dceb,null));};exports[_0x51fb('0x22')]=function(_0x524ac6,_0x2018da){if(_0x524ac6[_0x51fb('0x4a')]['id']){delete _0x524ac6['body']['id'];}return db['CmHopperAdditionalPhone'][_0x51fb('0x48')]({'where':{'id':_0x524ac6['params']['id']}})['then'](handleEntityNotFound(_0x2018da,null))[_0x51fb('0x23')](saveUpdates(_0x524ac6[_0x51fb('0x4a')],null))['then'](respondWithResult(_0x2018da,null))[_0x51fb('0x43')](handleError(_0x2018da,null));};exports[_0x51fb('0x24')]=function(_0x4371ff,_0x4a0c10){return db[_0x51fb('0x2d')]['find']({'where':{'id':_0x4371ff[_0x51fb('0x45')]['id']}})[_0x51fb('0x23')](handleEntityNotFound(_0x4a0c10,null))['then'](removeEntity(_0x4a0c10,null))[_0x51fb('0x43')](handleError(_0x4a0c10,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 038e56d..c28e20d 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 _0x190a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes'];(function(_0x200cef,_0x33af91){var _0x5cb7ff=function(_0x5a41ee){while(--_0x5a41ee){_0x200cef['push'](_0x200cef['shift']());}};_0x5cb7ff(++_0x33af91);}(_0x190a,0x1ea));var _0xa190=function(_0x42f067,_0x5812f5){_0x42f067=_0x42f067-0x0;var _0x425b80=_0x190a[_0x42f067];return _0x425b80;};'use strict';var _=require(_0xa190('0x0'));var util=require(_0xa190('0x1'));var logger=require(_0xa190('0x2'))(_0xa190('0x3'));var moment=require(_0xa190('0x4'));var BPromise=require(_0xa190('0x5'));var rp=require(_0xa190('0x6'));var fs=require('fs');var path=require(_0xa190('0x7'));var rimraf=require(_0xa190('0x8'));var config=require('../../config/environment');var attributes=require(_0xa190('0x9'));module['exports']=function(_0x230098,_0x2207f2){return _0x230098['define']('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcacd=['path','rimraf','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','moment','bluebird','request-promise'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0xcacd,0x1bf));var _0xdcac=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xcacd[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xdcac('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdcac('0x1'));var BPromise=require(_0xdcac('0x2'));var rp=require(_0xdcac('0x3'));var fs=require('fs');var path=require(_0xdcac('0x4'));var rimraf=require(_0xdcac('0x5'));var config=require('../../config/environment');var attributes=require(_0xdcac('0x6'));module[_0xdcac('0x7')]=function(_0x208907,_0x58af9f){return _0x208907[_0xdcac('0x8')](_0xdcac('0x9'),attributes,{'tableName':_0xdcac('0xa'),'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 b160c23..5856839 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 _0x548b=['countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','catch','duration','waitTime','scheduledat','add','minutes','isNil','phone','countnoanswerretry','countagentrejectretry','createdAt','updatedAt','transaction','update','CmHopper','activateAdditionalPhone','IncrementPreviewCounters','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VerifyAdditionalPhones','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC'];(function(_0x38f2f4,_0x219f52){var _0x54d8e3=function(_0x45046c){while(--_0x45046c){_0x38f2f4['push'](_0x38f2f4['shift']());}};_0x54d8e3(++_0x219f52);}(_0x548b,0x1b6));var _0xb548=function(_0x54618c,_0x57c42a){_0x54618c=_0x54618c-0x0;var _0x34e3a8=_0x548b[_0x54618c];return _0x34e3a8;};'use strict';var _=require(_0xb548('0x0'));var util=require('util');var moment=require(_0xb548('0x1'));var BPromise=require(_0xb548('0x2'));var rs=require(_0xb548('0x3'));var fs=require('fs');var Redis=require(_0xb548('0x4'));var db=require(_0xb548('0x5'))['db'];var utils=require(_0xb548('0x6'));var logger=require(_0xb548('0x7'))(_0xb548('0x8'));var config=require(_0xb548('0x9'));var jayson=require(_0xb548('0xa'));var client=jayson[_0xb548('0xb')][_0xb548('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21acbd,_0x5bbfe5,_0x4cee8e){return new BPromise(function(_0x3b367b,_0x25e0f3){return client[_0xb548('0xd')](_0x21acbd,_0x4cee8e)[_0xb548('0xe')](function(_0x20ede0){logger[_0xb548('0xf')](_0xb548('0x10'),_0x5bbfe5,_0xb548('0x11'));logger[_0xb548('0x12')](_0xb548('0x13'),_0x5bbfe5,_0xb548('0x11'),JSON[_0xb548('0x14')](_0x20ede0));if(_0x20ede0[_0xb548('0x15')]){if(_0x20ede0[_0xb548('0x15')][_0xb548('0x16')]===0x1f4){logger['error'](_0xb548('0x10'),_0x5bbfe5,_0x20ede0[_0xb548('0x15')][_0xb548('0x17')]);return _0x25e0f3(_0x20ede0[_0xb548('0x15')][_0xb548('0x17')]);}logger['error'](_0xb548('0x10'),_0x5bbfe5,_0x20ede0['error'][_0xb548('0x17')]);return _0x3b367b(_0x20ede0[_0xb548('0x15')]['message']);}else{logger[_0xb548('0xf')](_0xb548('0x10'),_0x5bbfe5,_0xb548('0x11'));_0x3b367b(_0x20ede0[_0xb548('0x18')][_0xb548('0x17')]);}})['catch'](function(_0x481493){logger[_0xb548('0x15')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5bbfe5,_0x481493);_0x25e0f3(_0x481493);});});}exports[_0xb548('0x19')]=function(_0x396321){var _0x2f8e2e=this;return new Promise(function(_0x405942,_0x116da7){return db['CmHopper'][_0xb548('0x1a')]({'raw':!![],'where':{'ContactId':_0x396321[_0xb548('0x1b')][_0xb548('0x1c')],'ListId':_0x396321[_0xb548('0x1b')][_0xb548('0x1d')],'VoiceQueueId':_0x396321['body'][_0xb548('0x1e')]===undefined?null:_0x396321[_0xb548('0x1b')]['VoiceQueueId'],'CampaignId':_0x396321['body']['CampaignId']===undefined?null:_0x396321[_0xb548('0x1b')][_0xb548('0x1f')]}})[_0xb548('0xe')](function(_0x4fc64f){if(_0x4fc64f!=null){return db['CmHopperAdditionalPhone'][_0xb548('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x4fc64f['id'],'OrderBy':{'$gt':_0x4fc64f[_0xb548('0x20')]}},'order':[[_0xb548('0x20'),_0xb548('0x21')]]})[_0xb548('0xe')](function(_0x521903){var _0x1e2cd1=0x0;if(_0x521903){if(_0x521903[_0xb548('0x22')]+_0x521903[_0xb548('0x23')]+_0x521903['countnoanswerretry']+_0x521903['countnosuchnumberretry']+_0x521903[_0xb548('0x24')]+_0x521903[_0xb548('0x25')]+_0x521903[_0xb548('0x26')]+_0x521903['countagentrejectretry']<_0x396321[_0xb548('0x27')][_0xb548('0x28')])_0x1e2cd1=0x1;_0x405942({'additional':_0x1e2cd1});}else{return db[_0xb548('0x29')][_0xb548('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x4fc64f['id']},'order':[[_0xb548('0x20'),_0xb548('0x21')]]})[_0xb548('0xe')](function(_0x15310e){var _0x3b1dd3=0x0;if(_0x15310e){if(_0x15310e['countbusyretry']+_0x15310e[_0xb548('0x23')]+_0x15310e['countnoanswerretry']+_0x15310e['countnosuchnumberretry']+_0x15310e['countdropretry']+_0x15310e[_0xb548('0x25')]+_0x15310e[_0xb548('0x26')]+_0x15310e['countagentrejectretry']<_0x396321[_0xb548('0x27')][_0xb548('0x28')])_0x3b1dd3=0x1;_0x405942({'additional':_0x3b1dd3});}else{_0x405942({'additional':0x0});}})[_0xb548('0x2a')](function(_0x3fa2a4){logger[_0xb548('0x15')]('VerifyAdditionalPhones',_0x3fa2a4[_0xb548('0x17')]);_0x116da7(_0x2f8e2e[_0xb548('0x15')](0x1f4,_0x3fa2a4['message']));});}})[_0xb548('0x2a')](function(_0xb822cc){logger['error'](_0xb548('0x19'),_0xb822cc[_0xb548('0x17')]);_0x116da7(_0x2f8e2e[_0xb548('0x15')](0x1f4,_0xb822cc[_0xb548('0x17')]));});}else _0x405942({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x4b52fc){var _0x234d1d=this;return new Promise(function(_0x51b7f9,_0xbea3d3){return db['CmHopper'][_0xb548('0x1a')]({'raw':!![],'where':{'ContactId':_0x4b52fc['body'][_0xb548('0x1c')],'ListId':_0x4b52fc['body']['ListId'],'VoiceQueueId':_0x4b52fc['body'][_0xb548('0x1e')]===undefined?null:_0x4b52fc['body'][_0xb548('0x1e')],'CampaignId':_0x4b52fc[_0xb548('0x1b')]['CampaignId']===undefined?null:_0x4b52fc[_0xb548('0x1b')][_0xb548('0x1f')]}})[_0xb548('0xe')](function(_0x21030e){if(_0x21030e!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x21030e['id'],'OrderBy':{'$gte':_0x21030e[_0xb548('0x20')]}},'order':[[_0xb548('0x20'),'ASC']]})[_0xb548('0xe')](function(_0x116bd1){if(_0x116bd1)return activateAdditionalPhone(_0x21030e,_0x4b52fc[_0xb548('0x1b')],_0x116bd1,_0x4b52fc[_0xb548('0x2b')],_0x4b52fc['waitTime'])[_0xb548('0xe')](function(_0x2699a3){_0x51b7f9(_0x2699a3);});else{return db[_0xb548('0x29')][_0xb548('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x21030e['id']},'order':[[_0xb548('0x20'),_0xb548('0x21')]]})[_0xb548('0xe')](function(_0x3869b5){if(_0x3869b5)return activateAdditionalPhone(_0x21030e,_0x4b52fc[_0xb548('0x1b')],_0x3869b5,_0x4b52fc[_0xb548('0x2b')],_0x4b52fc[_0xb548('0x2c')])[_0xb548('0xe')](function(_0x5b3cd3){_0x51b7f9(_0x5b3cd3);});else{_0x51b7f9({'id':_0x21030e['id'],'phone':''});}})[_0xb548('0x2a')](function(_0x1b033a){logger[_0xb548('0x15')](_0xb548('0x19'),_0x1b033a['message']);_0xbea3d3(_0x234d1d['error'](0x1f4,_0x1b033a[_0xb548('0x17')]));});}})[_0xb548('0x2a')](function(_0x5ac30f){logger[_0xb548('0x15')](_0xb548('0x19'),_0x5ac30f['message']);_0xbea3d3(_0x234d1d[_0xb548('0x15')](0x1f4,_0x5ac30f[_0xb548('0x17')]));});}else _0x51b7f9(0x1);});});};function activateAdditionalPhone(_0x16e1c8,_0x1c1b0f,_0x12d7ac,_0x1a1002,_0x53d252){return new Promise(function(_0x355911,_0x476ab7){var _0x64a4b8;if(_['isNil'](_0x12d7ac['scheduledat'])){_0x12d7ac['scheduledat']=moment();}if(moment()>moment(_0x12d7ac[_0xb548('0x2d')])){_0x64a4b8=moment()[_0xb548('0x2e')](_0x53d252||0x3,_0xb548('0x2f'));}else{if(_0x12d7ac[_0xb548('0x20')]==0x0){_0x64a4b8=moment(_0x12d7ac[_0xb548('0x2d')]);}else{_0x64a4b8=moment()[_0xb548('0x2e')](_0x53d252||0x3,_0xb548('0x2f'));}}if(_[_0xb548('0x30')](_0x64a4b8)){_0x64a4b8=moment()['add'](_0x53d252||0x3,'minutes');}var _0x5c8def={'phone':_0x16e1c8[_0xb548('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x16e1c8[_0xb548('0x20')])?0x0:_0x16e1c8['OrderBy'],'scheduledat':moment()[_0xb548('0x2e')](_0x1a1002||0x1,_0xb548('0x2f')),'countbusyretry':_0x1c1b0f[_0xb548('0x22')],'countcongestionretry':_0x1c1b0f[_0xb548('0x23')],'countnoanswerretry':_0x1c1b0f[_0xb548('0x32')],'countnosuchnumberretry':_0x1c1b0f['countnosuchnumberretry'],'countdropretry':_0x1c1b0f[_0xb548('0x24')],'countabandonedretry':_0x1c1b0f['countabandonedretry'],'countmachineretry':_0x1c1b0f['countmachineretry'],'countagentrejectretry':_0x1c1b0f[_0xb548('0x33')],'createdAt':_0x1c1b0f['createdAt'],'updatedAt':_0x1c1b0f['updatedAt']};var _0x3180a6={'CmHopperId':_0x16e1c8['id'],'phone':_0x12d7ac['phone'],'active':0x0,'OrderBy':_[_0xb548('0x30')](_0x12d7ac[_0xb548('0x20')])?0x0:_0x12d7ac[_0xb548('0x20')],'scheduledat':_0x64a4b8,'countbusyretry':_0x12d7ac['countbusyretry'],'countcongestionretry':_0x12d7ac[_0xb548('0x23')],'countnoanswerretry':_0x12d7ac[_0xb548('0x32')],'countnosuchnumberretry':_0x12d7ac['countnosuchnumberretry'],'countdropretry':_0x12d7ac[_0xb548('0x24')],'countabandonedretry':_0x12d7ac[_0xb548('0x25')],'countmachineretry':_0x12d7ac[_0xb548('0x26')],'countagentrejectretry':_0x12d7ac[_0xb548('0x33')],'createdAt':_0x12d7ac[_0xb548('0x34')],'updatedAt':_0x12d7ac[_0xb548('0x35')]};return db['sequelize'][_0xb548('0x36')](function(_0x154ad0){return db[_0xb548('0x29')][_0xb548('0x37')](_0x5c8def,{'where':{'id':_0x12d7ac['id']}},{'transaction':_0x154ad0})['then'](function(){return db[_0xb548('0x38')]['update'](_0x3180a6,{'where':{'id':_0x16e1c8['id']}},{'transaction':_0x154ad0});});})[_0xb548('0xe')](function(_0x32881a){_0x355911({'id':_0x16e1c8['id'],'phone':_0x12d7ac[_0xb548('0x31')]});})[_0xb548('0x2a')](function(_0x53c0d8){logger[_0xb548('0x15')](_0xb548('0x39'),_0x53c0d8['message']);_0x476ab7({'error':_0x53c0d8[_0xb548('0x17')]});});});}exports['IncrementPreviewCounters']=function(_0x56b483){var _0x486eb5=this;return new Promise(function(_0x4ebb01,_0x31debc){return db[_0xb548('0x38')][_0xb548('0x37')](_0x56b483[_0xb548('0x1b')]['field'],{'where':{'id':_0x56b483['body']['id']}})[_0xb548('0xe')](function(_0x4332b5){_0x4ebb01(_0x4332b5);})[_0xb548('0x2a')](function(_0x255dd1){logger[_0xb548('0x15')](_0xb548('0x3a'),_0x255dd1['message']);_0x31debc(_0x486eb5['error'](0x1f4,_0x255dd1[_0xb548('0x17')]));});});}; \ No newline at end of file +var _0x261c=['countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry'];(function(_0x3a2ee2,_0x59d56b){var _0x1e7d1e=function(_0x815530){while(--_0x815530){_0x3a2ee2['push'](_0x3a2ee2['shift']());}};_0x1e7d1e(++_0x59d56b);}(_0x261c,0x101));var _0xc261=function(_0x5bca8f,_0x1683d5){_0x5bca8f=_0x5bca8f-0x0;var _0x20fd20=_0x261c[_0x5bca8f];return _0x20fd20;};'use strict';var _=require(_0xc261('0x0'));var util=require(_0xc261('0x1'));var moment=require(_0xc261('0x2'));var BPromise=require('bluebird');var rs=require(_0xc261('0x3'));var fs=require('fs');var Redis=require(_0xc261('0x4'));var db=require(_0xc261('0x5'))['db'];var utils=require(_0xc261('0x6'));var logger=require(_0xc261('0x7'))(_0xc261('0x8'));var config=require(_0xc261('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc261('0xa')][_0xc261('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30c0a2,_0x52d7c9,_0x5c4a9f){return new BPromise(function(_0xe9ba0e,_0x559ca5){return client[_0xc261('0xc')](_0x30c0a2,_0x5c4a9f)[_0xc261('0xd')](function(_0x596a45){logger[_0xc261('0xe')](_0xc261('0xf'),_0x52d7c9,_0xc261('0x10'));logger[_0xc261('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x52d7c9,_0xc261('0x10'),JSON['stringify'](_0x596a45));if(_0x596a45['error']){if(_0x596a45[_0xc261('0x12')][_0xc261('0x13')]===0x1f4){logger[_0xc261('0x12')](_0xc261('0xf'),_0x52d7c9,_0x596a45[_0xc261('0x12')][_0xc261('0x14')]);return _0x559ca5(_0x596a45[_0xc261('0x12')][_0xc261('0x14')]);}logger[_0xc261('0x12')](_0xc261('0xf'),_0x52d7c9,_0x596a45['error'][_0xc261('0x14')]);return _0xe9ba0e(_0x596a45[_0xc261('0x12')][_0xc261('0x14')]);}else{logger[_0xc261('0xe')](_0xc261('0xf'),_0x52d7c9,'request\x20sent');_0xe9ba0e(_0x596a45[_0xc261('0x15')][_0xc261('0x14')]);}})[_0xc261('0x16')](function(_0x477735){logger[_0xc261('0x12')](_0xc261('0xf'),_0x52d7c9,_0x477735);_0x559ca5(_0x477735);});});}exports[_0xc261('0x17')]=function(_0x1c345b){var _0x3c898c=this;return new Promise(function(_0x32e431,_0x14780b){return db[_0xc261('0x18')][_0xc261('0x19')]({'raw':!![],'where':{'ContactId':_0x1c345b[_0xc261('0x1a')]['ContactId'],'ListId':_0x1c345b['body'][_0xc261('0x1b')],'VoiceQueueId':_0x1c345b[_0xc261('0x1a')][_0xc261('0x1c')]===undefined?null:_0x1c345b['body'][_0xc261('0x1c')],'CampaignId':_0x1c345b[_0xc261('0x1a')][_0xc261('0x1d')]===undefined?null:_0x1c345b[_0xc261('0x1a')][_0xc261('0x1d')]}})[_0xc261('0xd')](function(_0x1739d3){if(_0x1739d3!=null){return db[_0xc261('0x1e')][_0xc261('0x19')]({'raw':!![],'where':{'CmHopperId':_0x1739d3['id'],'OrderBy':{'$gt':_0x1739d3[_0xc261('0x1f')]}},'order':[['OrderBy',_0xc261('0x20')]]})[_0xc261('0xd')](function(_0x17dd40){var _0x60a1ab=0x0;if(_0x17dd40){if(_0x17dd40[_0xc261('0x21')]+_0x17dd40[_0xc261('0x22')]+_0x17dd40[_0xc261('0x23')]+_0x17dd40[_0xc261('0x24')]+_0x17dd40[_0xc261('0x25')]+_0x17dd40[_0xc261('0x26')]+_0x17dd40[_0xc261('0x27')]+_0x17dd40[_0xc261('0x28')]<_0x1c345b[_0xc261('0x29')][_0xc261('0x2a')])_0x60a1ab=0x1;_0x32e431({'additional':_0x60a1ab});}else{return db[_0xc261('0x1e')][_0xc261('0x19')]({'raw':!![],'where':{'CmHopperId':_0x1739d3['id']},'order':[[_0xc261('0x1f'),_0xc261('0x20')]]})['then'](function(_0x59866f){var _0x3322df=0x0;if(_0x59866f){if(_0x59866f['countbusyretry']+_0x59866f[_0xc261('0x22')]+_0x59866f['countnoanswerretry']+_0x59866f['countnosuchnumberretry']+_0x59866f[_0xc261('0x25')]+_0x59866f[_0xc261('0x26')]+_0x59866f[_0xc261('0x27')]+_0x59866f[_0xc261('0x28')]<_0x1c345b[_0xc261('0x29')][_0xc261('0x2a')])_0x3322df=0x1;_0x32e431({'additional':_0x3322df});}else{_0x32e431({'additional':0x0});}})['catch'](function(_0x165352){logger[_0xc261('0x12')](_0xc261('0x17'),_0x165352['message']);_0x14780b(_0x3c898c[_0xc261('0x12')](0x1f4,_0x165352[_0xc261('0x14')]));});}})[_0xc261('0x16')](function(_0x3cc583){logger[_0xc261('0x12')](_0xc261('0x17'),_0x3cc583[_0xc261('0x14')]);_0x14780b(_0x3c898c[_0xc261('0x12')](0x1f4,_0x3cc583[_0xc261('0x14')]));});}else _0x32e431({'additional':0x0});});});};exports[_0xc261('0x2b')]=function(_0x1015c7){var _0x3269a7=this;return new Promise(function(_0x197c75,_0x2b759d){return db[_0xc261('0x18')]['findOne']({'raw':!![],'where':{'ContactId':_0x1015c7[_0xc261('0x1a')][_0xc261('0x2c')],'ListId':_0x1015c7[_0xc261('0x1a')][_0xc261('0x1b')],'VoiceQueueId':_0x1015c7[_0xc261('0x1a')][_0xc261('0x1c')]===undefined?null:_0x1015c7[_0xc261('0x1a')]['VoiceQueueId'],'CampaignId':_0x1015c7[_0xc261('0x1a')][_0xc261('0x1d')]===undefined?null:_0x1015c7['body']['CampaignId']}})[_0xc261('0xd')](function(_0x3def24){if(_0x3def24!=null){return db[_0xc261('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3def24['id'],'OrderBy':{'$gte':_0x3def24[_0xc261('0x1f')]}},'order':[['OrderBy',_0xc261('0x20')]]})[_0xc261('0xd')](function(_0x17037b){if(_0x17037b)return activateAdditionalPhone(_0x3def24,_0x1015c7['body'],_0x17037b,_0x1015c7[_0xc261('0x2d')],_0x1015c7[_0xc261('0x2e')])[_0xc261('0xd')](function(_0x57b98c){_0x197c75(_0x57b98c);});else{return db[_0xc261('0x1e')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3def24['id']},'order':[[_0xc261('0x1f'),'ASC']]})['then'](function(_0x5d5378){if(_0x5d5378)return activateAdditionalPhone(_0x3def24,_0x1015c7[_0xc261('0x1a')],_0x5d5378,_0x1015c7[_0xc261('0x2d')],_0x1015c7[_0xc261('0x2e')])[_0xc261('0xd')](function(_0x566d46){_0x197c75(_0x566d46);});else{_0x197c75({'id':_0x3def24['id'],'phone':''});}})[_0xc261('0x16')](function(_0x1ddd09){logger[_0xc261('0x12')](_0xc261('0x17'),_0x1ddd09[_0xc261('0x14')]);_0x2b759d(_0x3269a7[_0xc261('0x12')](0x1f4,_0x1ddd09[_0xc261('0x14')]));});}})['catch'](function(_0x4d9a1e){logger['error'](_0xc261('0x17'),_0x4d9a1e[_0xc261('0x14')]);_0x2b759d(_0x3269a7['error'](0x1f4,_0x4d9a1e[_0xc261('0x14')]));});}else _0x197c75(0x1);});});};function activateAdditionalPhone(_0x3f6bb6,_0x34a029,_0x1eca77,_0x86e5eb,_0x4177d9){return new Promise(function(_0x4c4f9,_0x190352){var _0x4c431c;if(_[_0xc261('0x2f')](_0x1eca77[_0xc261('0x30')])){_0x1eca77[_0xc261('0x30')]=moment();}if(moment()>moment(_0x1eca77[_0xc261('0x30')])){_0x4c431c=moment()[_0xc261('0x31')](_0x4177d9||0x3,'minutes');}else{if(_0x1eca77[_0xc261('0x1f')]==0x0){_0x4c431c=moment(_0x1eca77[_0xc261('0x30')]);}else{_0x4c431c=moment()[_0xc261('0x31')](_0x4177d9||0x3,_0xc261('0x32'));}}if(_[_0xc261('0x2f')](_0x4c431c)){_0x4c431c=moment()[_0xc261('0x31')](_0x4177d9||0x3,_0xc261('0x32'));}var _0x15e855={'phone':_0x3f6bb6[_0xc261('0x33')],'active':0x0,'OrderBy':_[_0xc261('0x2f')](_0x3f6bb6[_0xc261('0x1f')])?0x0:_0x3f6bb6[_0xc261('0x1f')],'scheduledat':moment()[_0xc261('0x31')](_0x86e5eb||0x1,'minutes'),'countbusyretry':_0x34a029[_0xc261('0x21')],'countcongestionretry':_0x34a029['countcongestionretry'],'countnoanswerretry':_0x34a029['countnoanswerretry'],'countnosuchnumberretry':_0x34a029['countnosuchnumberretry'],'countdropretry':_0x34a029[_0xc261('0x25')],'countabandonedretry':_0x34a029[_0xc261('0x26')],'countmachineretry':_0x34a029[_0xc261('0x27')],'countagentrejectretry':_0x34a029[_0xc261('0x28')],'createdAt':_0x34a029[_0xc261('0x34')],'updatedAt':_0x34a029['updatedAt']};var _0x3cfecd={'CmHopperId':_0x3f6bb6['id'],'phone':_0x1eca77['phone'],'active':0x0,'OrderBy':_['isNil'](_0x1eca77[_0xc261('0x1f')])?0x0:_0x1eca77[_0xc261('0x1f')],'scheduledat':_0x4c431c,'countbusyretry':_0x1eca77[_0xc261('0x21')],'countcongestionretry':_0x1eca77[_0xc261('0x22')],'countnoanswerretry':_0x1eca77[_0xc261('0x23')],'countnosuchnumberretry':_0x1eca77[_0xc261('0x24')],'countdropretry':_0x1eca77[_0xc261('0x25')],'countabandonedretry':_0x1eca77[_0xc261('0x26')],'countmachineretry':_0x1eca77[_0xc261('0x27')],'countagentrejectretry':_0x1eca77[_0xc261('0x28')],'createdAt':_0x1eca77['createdAt'],'updatedAt':_0x1eca77['updatedAt']};return db[_0xc261('0x35')][_0xc261('0x36')](function(_0x30bd43){return db[_0xc261('0x1e')][_0xc261('0x37')](_0x15e855,{'where':{'id':_0x1eca77['id']}},{'transaction':_0x30bd43})[_0xc261('0xd')](function(){return db['CmHopper']['update'](_0x3cfecd,{'where':{'id':_0x3f6bb6['id']}},{'transaction':_0x30bd43});});})['then'](function(_0x485453){_0x4c4f9({'id':_0x3f6bb6['id'],'phone':_0x1eca77[_0xc261('0x33')]});})[_0xc261('0x16')](function(_0x4ed9da){logger[_0xc261('0x12')](_0xc261('0x38'),_0x4ed9da['message']);_0x190352({'error':_0x4ed9da[_0xc261('0x14')]});});});}exports['IncrementPreviewCounters']=function(_0x28d3c6){var _0x566cc1=this;return new Promise(function(_0x18b6b1,_0x4087a9){return db[_0xc261('0x18')][_0xc261('0x37')](_0x28d3c6['body'][_0xc261('0x39')],{'where':{'id':_0x28d3c6['body']['id']}})[_0xc261('0xd')](function(_0x9c4e73){_0x18b6b1(_0x9c4e73);})[_0xc261('0x16')](function(_0x250704){logger[_0xc261('0x12')](_0xc261('0x3a'),_0x250704[_0xc261('0x14')]);_0x4087a9(_0x566cc1[_0xc261('0x12')](0x1f4,_0x250704['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index dd792b2..335a4a1 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 _0xefdc=['update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x204afc,_0x5277e6){var _0x30e3c7=function(_0x4d13be){while(--_0x4d13be){_0x204afc['push'](_0x204afc['shift']());}};_0x30e3c7(++_0x5277e6);}(_0xefdc,0xc1));var _0xcefd=function(_0x2c8b7a,_0x483fe0){_0x2c8b7a=_0x2c8b7a-0x0;var _0x1c1cf9=_0xefdc[_0x2c8b7a];return _0x1c1cf9;};'use strict';var multer=require(_0xcefd('0x0'));var util=require(_0xcefd('0x1'));var path=require(_0xcefd('0x2'));var timeout=require(_0xcefd('0x3'));var express=require(_0xcefd('0x4'));var router=express[_0xcefd('0x5')]();var fs_extra=require(_0xcefd('0x6'));var auth=require(_0xcefd('0x7'));var interaction=require(_0xcefd('0x8'));var config=require('../../config/environment');var controller=require(_0xcefd('0x9'));router[_0xcefd('0xa')]('/',auth[_0xcefd('0xb')](),controller[_0xcefd('0xc')]);router['get'](_0xcefd('0xd'),auth[_0xcefd('0xb')](),controller[_0xcefd('0xe')]);router[_0xcefd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xcefd('0xd'),auth[_0xcefd('0xb')](),controller[_0xcefd('0x10')]);router[_0xcefd('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xcefd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x10dc=['post','create','delete','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated'];(function(_0x1bb6da,_0x109949){var _0xebfd99=function(_0x954e8c){while(--_0x954e8c){_0x1bb6da['push'](_0x1bb6da['shift']());}};_0xebfd99(++_0x109949);}(_0x10dc,0x13f));var _0xc10d=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0x10dc[_0x1cb0b4];return _0x525b60;};'use strict';var multer=require(_0xc10d('0x0'));var util=require(_0xc10d('0x1'));var path=require(_0xc10d('0x2'));var timeout=require(_0xc10d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc10d('0x4'));var config=require(_0xc10d('0x5'));var controller=require(_0xc10d('0x6'));router[_0xc10d('0x7')]('/',auth['isAuthenticated'](),controller[_0xc10d('0x8')]);router[_0xc10d('0x7')](_0xc10d('0x9'),auth[_0xc10d('0xa')](),controller['show']);router[_0xc10d('0xb')]('/',auth['isAuthenticated'](),controller[_0xc10d('0xc')]);router['put']('/:id',auth[_0xc10d('0xa')](),controller['update']);router[_0xc10d('0xd')](_0xc10d('0x9'),auth[_0xc10d('0xa')](),controller['destroy']);module[_0xc10d('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 43be945..02490ae 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 _0x0619=['moment','sequelize','exports','STRING','contactListQueue','INTEGER'];(function(_0xd07344,_0x58a689){var _0x4bbc4d=function(_0x5e7671){while(--_0x5e7671){_0xd07344['push'](_0xd07344['shift']());}};_0x4bbc4d(++_0x58a689);}(_0x0619,0x90));var _0x9061=function(_0x2b5730,_0x2b0e3d){_0x2b5730=_0x2b5730-0x0;var _0x216232=_0x0619[_0x2b5730];return _0x216232;};'use strict';var moment=require(_0x9061('0x0'));var Sequelize=require(_0x9061('0x1'));module[_0x9061('0x2')]={'phone':{'type':Sequelize[_0x9061('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x9061('0x4')},'ListId':{'type':Sequelize[_0x9061('0x5')],'unique':_0x9061('0x4')},'VoiceQueueId':{'type':Sequelize[_0x9061('0x5')],'unique':_0x9061('0x4')}}; \ No newline at end of file +var _0x9483=['INTEGER','contactListQueue','moment','sequelize','STRING'];(function(_0x4581c3,_0x5bdaaf){var _0x35a854=function(_0x4e14fa){while(--_0x4e14fa){_0x4581c3['push'](_0x4581c3['shift']());}};_0x35a854(++_0x5bdaaf);}(_0x9483,0x12e));var _0x3948=function(_0x7ce723,_0x5f08a8){_0x7ce723=_0x7ce723-0x0;var _0xd9c5c=_0x9483[_0x7ce723];return _0xd9c5c;};'use strict';var moment=require(_0x3948('0x0'));var Sequelize=require(_0x3948('0x1'));module['exports']={'phone':{'type':Sequelize[_0x3948('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3948('0x3')],'unique':_0x3948('0x4')},'ListId':{'type':Sequelize[_0x3948('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x3948('0x3')],'unique':_0x3948('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 769be39..ef41329 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 _0xb2a5=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','end','name','send','index','map','CmHopperBlack','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','keys','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x367a3d,_0x452717){var _0x460539=function(_0x1e8beb){while(--_0x1e8beb){_0x367a3d['push'](_0x367a3d['shift']());}};_0x460539(++_0x452717);}(_0xb2a5,0x1ac));var _0x5b2a=function(_0x33ae8a,_0x5c53dc){_0x33ae8a=_0x33ae8a-0x0;var _0x17e759=_0xb2a5[_0x33ae8a];return _0x17e759;};'use strict';var emlformat=require(_0x5b2a('0x0'));var rimraf=require(_0x5b2a('0x1'));var zipdir=require(_0x5b2a('0x2'));var jsonpatch=require(_0x5b2a('0x3'));var rp=require(_0x5b2a('0x4'));var moment=require(_0x5b2a('0x5'));var BPromise=require(_0x5b2a('0x6'));var Mustache=require(_0x5b2a('0x7'));var util=require(_0x5b2a('0x8'));var path=require(_0x5b2a('0x9'));var sox=require(_0x5b2a('0xa'));var csv=require(_0x5b2a('0xb'));var ejs=require(_0x5b2a('0xc'));var fs=require('fs');var fs_extra=require(_0x5b2a('0xd'));var _=require(_0x5b2a('0xe'));var squel=require(_0x5b2a('0xf'));var crypto=require('crypto');var jsforce=require(_0x5b2a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5b2a('0xb'));var querystring=require('querystring');var Papa=require(_0x5b2a('0x11'));var Redis=require('ioredis');var authService=require(_0x5b2a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5b2a('0x13'));var hardwareService=require(_0x5b2a('0x14'));var logger=require(_0x5b2a('0x15'))(_0x5b2a('0x16'));var utils=require(_0x5b2a('0x17'));var config=require(_0x5b2a('0x18'));var licenseUtil=require(_0x5b2a('0x19'));var db=require(_0x5b2a('0x1a'))['db'];function respondWithStatusCode(_0x3e44ab,_0x1903a0){_0x1903a0=_0x1903a0||0xcc;return function(_0x2c2310){if(_0x2c2310){return _0x3e44ab[_0x5b2a('0x1b')](_0x1903a0);}return _0x3e44ab[_0x5b2a('0x1c')](_0x1903a0)['end']();};}function respondWithResult(_0x1d90d6,_0x4e2a48){_0x4e2a48=_0x4e2a48||0xc8;return function(_0x3c6078){if(_0x3c6078){return _0x1d90d6['status'](_0x4e2a48)[_0x5b2a('0x1d')](_0x3c6078);}};}function respondWithFilteredResult(_0x2f7833,_0x93d3ef){return function(_0x20ba09){if(_0x20ba09){var _0x17d2f3=typeof _0x93d3ef[_0x5b2a('0x1e')]==='undefined'&&typeof _0x93d3ef[_0x5b2a('0x1f')]===_0x5b2a('0x20');var _0x46a698=_0x20ba09[_0x5b2a('0x21')];var _0x45f9d2=_0x17d2f3?0x0:_0x93d3ef[_0x5b2a('0x1e')];var _0x3c2f0a=_0x17d2f3?_0x20ba09[_0x5b2a('0x21')]:_0x93d3ef['offset']+_0x93d3ef[_0x5b2a('0x1f')];var _0x5f5bf9;if(_0x3c2f0a>=_0x46a698){_0x3c2f0a=_0x46a698;_0x5f5bf9=0xc8;}else{_0x5f5bf9=0xce;}_0x2f7833[_0x5b2a('0x1c')](_0x5f5bf9);return _0x2f7833['set'](_0x5b2a('0x22'),_0x45f9d2+'-'+_0x3c2f0a+'/'+_0x46a698)[_0x5b2a('0x1d')](_0x20ba09);}return null;};}function patchUpdates(_0x17a079){return function(_0x13d9a7){try{jsonpatch['apply'](_0x13d9a7,_0x17a079,!![]);}catch(_0x4bdccb){return BPromise[_0x5b2a('0x23')](_0x4bdccb);}return _0x13d9a7[_0x5b2a('0x24')]();};}function saveUpdates(_0x5033a8,_0x7756c2){return function(_0x33ba0c){if(_0x33ba0c){return _0x33ba0c[_0x5b2a('0x25')](_0x5033a8)[_0x5b2a('0x26')](function(_0xf1cf0){return _0xf1cf0;});}return null;};}function removeEntity(_0x443d24,_0x223aef){return function(_0x4eb748){if(_0x4eb748){return _0x4eb748[_0x5b2a('0x27')]()[_0x5b2a('0x26')](function(){_0x443d24['status'](0xcc)[_0x5b2a('0x28')]();});}};}function handleEntityNotFound(_0x346e4d,_0x293960){return function(_0x2063a2){if(!_0x2063a2){_0x346e4d['sendStatus'](0x194);}return _0x2063a2;};}function handleError(_0x6dc8fc,_0x4a1827){_0x4a1827=_0x4a1827||0x1f4;return function(_0x3df225){logger['error'](_0x3df225['stack']);if(_0x3df225[_0x5b2a('0x29')]){delete _0x3df225[_0x5b2a('0x29')];}_0x6dc8fc[_0x5b2a('0x1c')](_0x4a1827)[_0x5b2a('0x2a')](_0x3df225);};}exports[_0x5b2a('0x2b')]=function(_0x2ea75c,_0x4de22a){var _0x2c0743={},_0x287bc4={},_0xd47239={'count':0x0,'rows':[]};var _0x1d03ac=_[_0x5b2a('0x2c')](db[_0x5b2a('0x2d')][_0x5b2a('0x2e')],function(_0x201cab){return{'name':_0x201cab['fieldName'],'type':_0x201cab['type'][_0x5b2a('0x2f')]};});_0x287bc4[_0x5b2a('0x30')]=_['map'](_0x1d03ac,_0x5b2a('0x29'));_0x287bc4[_0x5b2a('0x31')]=_['keys'](_0x2ea75c[_0x5b2a('0x31')]);_0x287bc4[_0x5b2a('0x32')]=_[_0x5b2a('0x33')](_0x287bc4['model'],_0x287bc4[_0x5b2a('0x31')]);_0x2c0743[_0x5b2a('0x34')]=_[_0x5b2a('0x33')](_0x287bc4['model'],qs[_0x5b2a('0x35')](_0x2ea75c[_0x5b2a('0x31')][_0x5b2a('0x35')]));_0x2c0743[_0x5b2a('0x34')]=_0x2c0743[_0x5b2a('0x34')][_0x5b2a('0x36')]?_0x2c0743['attributes']:_0x287bc4[_0x5b2a('0x30')];if(!_0x2ea75c[_0x5b2a('0x31')][_0x5b2a('0x37')]('nolimit')){_0x2c0743[_0x5b2a('0x1f')]=qs[_0x5b2a('0x1f')](_0x2ea75c['query']['limit']);_0x2c0743[_0x5b2a('0x1e')]=qs[_0x5b2a('0x1e')](_0x2ea75c[_0x5b2a('0x31')]['offset']);}_0x2c0743[_0x5b2a('0x38')]=qs[_0x5b2a('0x39')](_0x2ea75c[_0x5b2a('0x31')]['sort']);_0x2c0743[_0x5b2a('0x3a')]=qs[_0x5b2a('0x32')](_[_0x5b2a('0x3b')](_0x2ea75c['query'],_0x287bc4['filters']),_0x1d03ac);if(_0x2ea75c[_0x5b2a('0x31')][_0x5b2a('0x3c')]){_0x2c0743[_0x5b2a('0x3a')]=_[_0x5b2a('0x3d')](_0x2c0743[_0x5b2a('0x3a')],{'$or':_[_0x5b2a('0x2c')](_0x1d03ac,function(_0x276923){if(_0x276923[_0x5b2a('0x3e')]!==_0x5b2a('0x3f')){var _0x3a81d3={};_0x3a81d3[_0x276923['name']]={'$like':'%'+_0x2ea75c[_0x5b2a('0x31')][_0x5b2a('0x3c')]+'%'};return _0x3a81d3;}})});}_0x2c0743=_[_0x5b2a('0x3d')]({},_0x2c0743,_0x2ea75c[_0x5b2a('0x40')]);var _0x2c6808={'where':_0x2c0743[_0x5b2a('0x3a')]};return db['CmHopperBlack'][_0x5b2a('0x21')](_0x2c6808)['then'](function(_0x10f3b1){_0xd47239['count']=_0x10f3b1;if(_0x2ea75c['query'][_0x5b2a('0x41')]){_0x2c0743[_0x5b2a('0x42')]=[{'all':!![]}];}return db[_0x5b2a('0x2d')]['findAll'](_0x2c0743);})['then'](function(_0x1d17e4){_0xd47239[_0x5b2a('0x43')]=_0x1d17e4;return _0xd47239;})[_0x5b2a('0x26')](respondWithFilteredResult(_0x4de22a,_0x2c0743))['catch'](handleError(_0x4de22a,null));};exports[_0x5b2a('0x44')]=function(_0x47b362,_0x2e0c42){var _0xddd39={'raw':!![],'where':{'id':_0x47b362[_0x5b2a('0x45')]['id']}},_0x50a861={};_0x50a861[_0x5b2a('0x30')]=_[_0x5b2a('0x46')](db[_0x5b2a('0x2d')][_0x5b2a('0x2e')]);_0x50a861[_0x5b2a('0x31')]=_[_0x5b2a('0x46')](_0x47b362[_0x5b2a('0x31')]);_0x50a861[_0x5b2a('0x32')]=_[_0x5b2a('0x33')](_0x50a861['model'],_0x50a861['query']);_0xddd39[_0x5b2a('0x34')]=_[_0x5b2a('0x33')](_0x50a861['model'],qs['fields'](_0x47b362[_0x5b2a('0x31')][_0x5b2a('0x35')]));_0xddd39[_0x5b2a('0x34')]=_0xddd39['attributes'][_0x5b2a('0x36')]?_0xddd39[_0x5b2a('0x34')]:_0x50a861[_0x5b2a('0x30')];if(_0x47b362[_0x5b2a('0x31')][_0x5b2a('0x41')]){_0xddd39[_0x5b2a('0x42')]=[{'all':!![]}];}_0xddd39=_[_0x5b2a('0x3d')]({},_0xddd39,_0x47b362[_0x5b2a('0x40')]);return db[_0x5b2a('0x2d')]['find'](_0xddd39)['then'](handleEntityNotFound(_0x2e0c42,null))['then'](respondWithResult(_0x2e0c42,null))[_0x5b2a('0x47')](handleError(_0x2e0c42,null));};exports[_0x5b2a('0x25')]=function(_0x5dfbd0,_0x23c9ed){if(_0x5dfbd0[_0x5b2a('0x48')]['id']){delete _0x5dfbd0['body']['id'];}return db[_0x5b2a('0x2d')][_0x5b2a('0x49')]({'where':{'id':_0x5dfbd0[_0x5b2a('0x45')]['id']}})[_0x5b2a('0x26')](handleEntityNotFound(_0x23c9ed,null))['then'](saveUpdates(_0x5dfbd0['body'],null))[_0x5b2a('0x26')](respondWithResult(_0x23c9ed,null))[_0x5b2a('0x47')](handleError(_0x23c9ed,null));};exports[_0x5b2a('0x27')]=function(_0x44975d,_0x4e4b1d){return db[_0x5b2a('0x2d')]['find']({'where':{'id':_0x44975d['params']['id']}})[_0x5b2a('0x26')](handleEntityNotFound(_0x4e4b1d,null))[_0x5b2a('0x26')](removeEntity(_0x4e4b1d,null))[_0x5b2a('0x47')](handleError(_0x4e4b1d,null));};exports[_0x5b2a('0x4a')]=function(_0x285f92,_0x34bbc8){return db['CmHopperBlack'][_0x5b2a('0x4a')]()[_0x5b2a('0x26')](respondWithResult(_0x34bbc8,null))['catch'](handleError(_0x34bbc8,null));}; \ No newline at end of file +var _0x2906=['intersection','fields','query','length','nolimit','order','sort','where','filter','merge','options','CmHopperBlack','include','rows','catch','params','includeAll','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','Content-Range','apply','update','then','error','stack','name','send','index','map','rawAttributes','type','key','model','keys','filters','attributes'];(function(_0x307724,_0x2e185d){var _0x5d3431=function(_0x3ad2a6){while(--_0x3ad2a6){_0x307724['push'](_0x307724['shift']());}};_0x5d3431(++_0x2e185d);}(_0x2906,0xe0));var _0x6290=function(_0xcbb8db,_0x1f0a12){_0xcbb8db=_0xcbb8db-0x0;var _0x2fdcac=_0x2906[_0xcbb8db];return _0x2fdcac;};'use strict';var emlformat=require(_0x6290('0x0'));var rimraf=require(_0x6290('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6290('0x2'));var rp=require('request-promise');var moment=require(_0x6290('0x3'));var BPromise=require(_0x6290('0x4'));var Mustache=require(_0x6290('0x5'));var util=require(_0x6290('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6290('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6290('0x8'));var squel=require('squel');var crypto=require(_0x6290('0x9'));var jsforce=require(_0x6290('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6290('0xb'));var querystring=require(_0x6290('0xc'));var Papa=require(_0x6290('0xd'));var Redis=require(_0x6290('0xe'));var authService=require(_0x6290('0xf'));var qs=require(_0x6290('0x10'));var as=require(_0x6290('0x11'));var hardwareService=require(_0x6290('0x12'));var logger=require(_0x6290('0x13'))(_0x6290('0x14'));var utils=require(_0x6290('0x15'));var config=require(_0x6290('0x16'));var licenseUtil=require(_0x6290('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa58ce7,_0x4f0301){_0x4f0301=_0x4f0301||0xcc;return function(_0x31420d){if(_0x31420d){return _0xa58ce7['sendStatus'](_0x4f0301);}return _0xa58ce7[_0x6290('0x18')](_0x4f0301)[_0x6290('0x19')]();};}function respondWithResult(_0x1560f1,_0x4614c0){_0x4614c0=_0x4614c0||0xc8;return function(_0x151db9){if(_0x151db9){return _0x1560f1['status'](_0x4614c0)[_0x6290('0x1a')](_0x151db9);}};}function respondWithFilteredResult(_0x50d7b5,_0x226453){return function(_0x5ba781){if(_0x5ba781){var _0x204336=typeof _0x226453['offset']===_0x6290('0x1b')&&typeof _0x226453[_0x6290('0x1c')]===_0x6290('0x1b');var _0x3080e3=_0x5ba781['count'];var _0x43b43c=_0x204336?0x0:_0x226453[_0x6290('0x1d')];var _0x55f676=_0x204336?_0x5ba781[_0x6290('0x1e')]:_0x226453['offset']+_0x226453[_0x6290('0x1c')];var _0x45b322;if(_0x55f676>=_0x3080e3){_0x55f676=_0x3080e3;_0x45b322=0xc8;}else{_0x45b322=0xce;}_0x50d7b5[_0x6290('0x18')](_0x45b322);return _0x50d7b5['set'](_0x6290('0x1f'),_0x43b43c+'-'+_0x55f676+'/'+_0x3080e3)[_0x6290('0x1a')](_0x5ba781);}return null;};}function patchUpdates(_0x54100b){return function(_0x14ac6b){try{jsonpatch[_0x6290('0x20')](_0x14ac6b,_0x54100b,!![]);}catch(_0x2579a3){return BPromise['reject'](_0x2579a3);}return _0x14ac6b['save']();};}function saveUpdates(_0x2ccf34,_0x161526){return function(_0x4f9424){if(_0x4f9424){return _0x4f9424[_0x6290('0x21')](_0x2ccf34)[_0x6290('0x22')](function(_0x218861){return _0x218861;});}return null;};}function removeEntity(_0x2f4b9b,_0x30274c){return function(_0x20f26a){if(_0x20f26a){return _0x20f26a['destroy']()['then'](function(){_0x2f4b9b['status'](0xcc)[_0x6290('0x19')]();});}};}function handleEntityNotFound(_0x321ac4,_0x2fecc4){return function(_0x5eaa99){if(!_0x5eaa99){_0x321ac4['sendStatus'](0x194);}return _0x5eaa99;};}function handleError(_0x4c058b,_0x198e1f){_0x198e1f=_0x198e1f||0x1f4;return function(_0x1be6ad){logger[_0x6290('0x23')](_0x1be6ad[_0x6290('0x24')]);if(_0x1be6ad['name']){delete _0x1be6ad[_0x6290('0x25')];}_0x4c058b[_0x6290('0x18')](_0x198e1f)[_0x6290('0x26')](_0x1be6ad);};}exports[_0x6290('0x27')]=function(_0x5452f7,_0x3f1570){var _0x26bdf0={},_0x142b05={},_0x130d86={'count':0x0,'rows':[]};var _0x316f6a=_[_0x6290('0x28')](db['CmHopperBlack'][_0x6290('0x29')],function(_0x57e38b){return{'name':_0x57e38b['fieldName'],'type':_0x57e38b[_0x6290('0x2a')][_0x6290('0x2b')]};});_0x142b05[_0x6290('0x2c')]=_['map'](_0x316f6a,'name');_0x142b05['query']=_[_0x6290('0x2d')](_0x5452f7['query']);_0x142b05[_0x6290('0x2e')]=_['intersection'](_0x142b05[_0x6290('0x2c')],_0x142b05['query']);_0x26bdf0[_0x6290('0x2f')]=_[_0x6290('0x30')](_0x142b05['model'],qs[_0x6290('0x31')](_0x5452f7[_0x6290('0x32')][_0x6290('0x31')]));_0x26bdf0[_0x6290('0x2f')]=_0x26bdf0[_0x6290('0x2f')][_0x6290('0x33')]?_0x26bdf0[_0x6290('0x2f')]:_0x142b05[_0x6290('0x2c')];if(!_0x5452f7[_0x6290('0x32')]['hasOwnProperty'](_0x6290('0x34'))){_0x26bdf0[_0x6290('0x1c')]=qs['limit'](_0x5452f7[_0x6290('0x32')][_0x6290('0x1c')]);_0x26bdf0[_0x6290('0x1d')]=qs['offset'](_0x5452f7['query'][_0x6290('0x1d')]);}_0x26bdf0[_0x6290('0x35')]=qs['sort'](_0x5452f7[_0x6290('0x32')][_0x6290('0x36')]);_0x26bdf0[_0x6290('0x37')]=qs[_0x6290('0x2e')](_['pick'](_0x5452f7[_0x6290('0x32')],_0x142b05[_0x6290('0x2e')]),_0x316f6a);if(_0x5452f7[_0x6290('0x32')][_0x6290('0x38')]){_0x26bdf0[_0x6290('0x37')]=_[_0x6290('0x39')](_0x26bdf0[_0x6290('0x37')],{'$or':_['map'](_0x316f6a,function(_0x119e4b){if(_0x119e4b['type']!=='VIRTUAL'){var _0x3649a5={};_0x3649a5[_0x119e4b[_0x6290('0x25')]]={'$like':'%'+_0x5452f7[_0x6290('0x32')][_0x6290('0x38')]+'%'};return _0x3649a5;}})});}_0x26bdf0=_['merge']({},_0x26bdf0,_0x5452f7[_0x6290('0x3a')]);var _0x4080d4={'where':_0x26bdf0[_0x6290('0x37')]};return db[_0x6290('0x3b')][_0x6290('0x1e')](_0x4080d4)[_0x6290('0x22')](function(_0x4fdcfc){_0x130d86[_0x6290('0x1e')]=_0x4fdcfc;if(_0x5452f7[_0x6290('0x32')]['includeAll']){_0x26bdf0[_0x6290('0x3c')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x26bdf0);})[_0x6290('0x22')](function(_0x37a2f9){_0x130d86[_0x6290('0x3d')]=_0x37a2f9;return _0x130d86;})[_0x6290('0x22')](respondWithFilteredResult(_0x3f1570,_0x26bdf0))[_0x6290('0x3e')](handleError(_0x3f1570,null));};exports['show']=function(_0x5cbb6f,_0x278c5a){var _0xfaa27e={'raw':!![],'where':{'id':_0x5cbb6f[_0x6290('0x3f')]['id']}},_0x464347={};_0x464347[_0x6290('0x2c')]=_[_0x6290('0x2d')](db[_0x6290('0x3b')]['rawAttributes']);_0x464347[_0x6290('0x32')]=_[_0x6290('0x2d')](_0x5cbb6f[_0x6290('0x32')]);_0x464347[_0x6290('0x2e')]=_[_0x6290('0x30')](_0x464347[_0x6290('0x2c')],_0x464347[_0x6290('0x32')]);_0xfaa27e[_0x6290('0x2f')]=_[_0x6290('0x30')](_0x464347[_0x6290('0x2c')],qs['fields'](_0x5cbb6f[_0x6290('0x32')][_0x6290('0x31')]));_0xfaa27e[_0x6290('0x2f')]=_0xfaa27e['attributes'][_0x6290('0x33')]?_0xfaa27e['attributes']:_0x464347['model'];if(_0x5cbb6f[_0x6290('0x32')][_0x6290('0x40')]){_0xfaa27e['include']=[{'all':!![]}];}_0xfaa27e=_[_0x6290('0x39')]({},_0xfaa27e,_0x5cbb6f['options']);return db[_0x6290('0x3b')]['find'](_0xfaa27e)[_0x6290('0x22')](handleEntityNotFound(_0x278c5a,null))['then'](respondWithResult(_0x278c5a,null))[_0x6290('0x3e')](handleError(_0x278c5a,null));};exports[_0x6290('0x21')]=function(_0x19ce84,_0x3d3ded){if(_0x19ce84[_0x6290('0x41')]['id']){delete _0x19ce84[_0x6290('0x41')]['id'];}return db['CmHopperBlack'][_0x6290('0x42')]({'where':{'id':_0x19ce84[_0x6290('0x3f')]['id']}})[_0x6290('0x22')](handleEntityNotFound(_0x3d3ded,null))['then'](saveUpdates(_0x19ce84[_0x6290('0x41')],null))[_0x6290('0x22')](respondWithResult(_0x3d3ded,null))[_0x6290('0x3e')](handleError(_0x3d3ded,null));};exports['destroy']=function(_0x553137,_0x369edc){return db[_0x6290('0x3b')]['find']({'where':{'id':_0x553137['params']['id']}})[_0x6290('0x22')](handleEntityNotFound(_0x369edc,null))[_0x6290('0x22')](removeEntity(_0x369edc,null))[_0x6290('0x3e')](handleError(_0x369edc,null));};exports[_0x6290('0x43')]=function(_0x3998d9,_0x157717){return db['CmHopperBlack'][_0x6290('0x43')]()[_0x6290('0x22')](respondWithResult(_0x157717,null))[_0x6290('0x3e')](handleError(_0x157717,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 9a5bc1a..e2d8657 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 _0xf964=['moment','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api'];(function(_0x123f3f,_0x15455c){var _0x5c724c=function(_0x202e94){while(--_0x202e94){_0x123f3f['push'](_0x123f3f['shift']());}};_0x5c724c(++_0x15455c);}(_0xf964,0x15b));var _0x4f96=function(_0x5bd20b,_0x313b2b){_0x5bd20b=_0x5bd20b-0x0;var _0x35dae7=_0xf964[_0x5bd20b];return _0x35dae7;};'use strict';var _=require(_0x4f96('0x0'));var util=require(_0x4f96('0x1'));var logger=require(_0x4f96('0x2'))(_0x4f96('0x3'));var moment=require(_0x4f96('0x4'));var BPromise=require('bluebird');var rp=require(_0x4f96('0x5'));var fs=require('fs');var path=require(_0x4f96('0x6'));var rimraf=require('rimraf');var config=require(_0x4f96('0x7'));var attributes=require(_0x4f96('0x8'));module[_0x4f96('0x9')]=function(_0x543914,_0x1b83fd){return _0x543914[_0x4f96('0xa')](_0x4f96('0xb'),attributes,{'tableName':_0x4f96('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf435=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','define','CmHopperBlack'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xf435,0xcc));var _0x5f43=function(_0x5d9362,_0x4112cb){_0x5d9362=_0x5d9362-0x0;var _0x505993=_0xf435[_0x5d9362];return _0x505993;};'use strict';var _=require(_0x5f43('0x0'));var util=require('util');var logger=require(_0x5f43('0x1'))(_0x5f43('0x2'));var moment=require(_0x5f43('0x3'));var BPromise=require(_0x5f43('0x4'));var rp=require(_0x5f43('0x5'));var fs=require('fs');var path=require(_0x5f43('0x6'));var rimraf=require(_0x5f43('0x7'));var config=require(_0x5f43('0x8'));var attributes=require(_0x5f43('0x9'));module['exports']=function(_0x31d5f6,_0x2e57a6){return _0x31d5f6[_0x5f43('0xa')](_0x5f43('0xb'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index b145d00..b4e942c 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 _0xe5bd=['UpdateCmHopperBlack','CmHopperBlack','body','raw','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','catch','GetCmHopperBlack','findAll','options','where','attributes','limit','include','model','map'];(function(_0x39b869,_0x3142d7){var _0x1529af=function(_0x3befc0){while(--_0x3befc0){_0x39b869['push'](_0x39b869['shift']());}};_0x1529af(++_0x3142d7);}(_0xe5bd,0xa6));var _0xde5b=function(_0x3c395f,_0x59277b){_0x3c395f=_0x3c395f-0x0;var _0x44d41e=_0xe5bd[_0x3c395f];return _0x44d41e;};'use strict';var _=require(_0xde5b('0x0'));var util=require(_0xde5b('0x1'));var moment=require(_0xde5b('0x2'));var BPromise=require(_0xde5b('0x3'));var rs=require(_0xde5b('0x4'));var fs=require('fs');var Redis=require(_0xde5b('0x5'));var db=require(_0xde5b('0x6'))['db'];var utils=require(_0xde5b('0x7'));var logger=require(_0xde5b('0x8'))(_0xde5b('0x9'));var config=require(_0xde5b('0xa'));var jayson=require(_0xde5b('0xb'));var client=jayson[_0xde5b('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x400e48,_0x10334b,_0x19dd70){return new BPromise(function(_0x202eff,_0x454627){return client[_0xde5b('0xd')](_0x400e48,_0x19dd70)[_0xde5b('0xe')](function(_0x2d496b){logger[_0xde5b('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x10334b,_0xde5b('0x10'));logger[_0xde5b('0x11')](_0xde5b('0x12'),_0x10334b,_0xde5b('0x10'),JSON[_0xde5b('0x13')](_0x2d496b));if(_0x2d496b[_0xde5b('0x14')]){if(_0x2d496b[_0xde5b('0x14')][_0xde5b('0x15')]===0x1f4){logger[_0xde5b('0x14')](_0xde5b('0x16'),_0x10334b,_0x2d496b[_0xde5b('0x14')][_0xde5b('0x17')]);return _0x454627(_0x2d496b[_0xde5b('0x14')][_0xde5b('0x17')]);}logger[_0xde5b('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x10334b,_0x2d496b[_0xde5b('0x14')][_0xde5b('0x17')]);return _0x202eff(_0x2d496b[_0xde5b('0x14')][_0xde5b('0x17')]);}else{logger[_0xde5b('0xf')](_0xde5b('0x16'),_0x10334b,_0xde5b('0x10'));_0x202eff(_0x2d496b['result'][_0xde5b('0x17')]);}})[_0xde5b('0x18')](function(_0x2b21d2){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x10334b,_0x2b21d2);_0x454627(_0x2b21d2);});});}exports[_0xde5b('0x19')]=function(_0x361488){var _0x184f60=this;return new Promise(function(_0xc68e5b,_0x9b4e42){return db['CmHopperBlack'][_0xde5b('0x1a')]({'raw':_0x361488[_0xde5b('0x1b')]?_0x361488[_0xde5b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x361488[_0xde5b('0x1b')]?_0x361488[_0xde5b('0x1b')][_0xde5b('0x1c')]||null:null,'attributes':_0x361488['options']?_0x361488[_0xde5b('0x1b')][_0xde5b('0x1d')]||null:null,'limit':_0x361488[_0xde5b('0x1b')]?_0x361488['options'][_0xde5b('0x1e')]||null:null,'include':_0x361488[_0xde5b('0x1b')]?_0x361488[_0xde5b('0x1b')][_0xde5b('0x1f')]?_['map'](_0x361488[_0xde5b('0x1b')][_0xde5b('0x1f')],function(_0x586aae){return{'model':db[_0x586aae[_0xde5b('0x20')]],'as':_0x586aae['as'],'attributes':_0x586aae['attributes'],'include':_0x586aae['include']?_[_0xde5b('0x21')](_0x586aae[_0xde5b('0x1f')],function(_0x1b1935){return{'model':db[_0x1b1935[_0xde5b('0x20')]],'as':_0x1b1935['as'],'attributes':_0x1b1935['attributes'],'include':_0x1b1935[_0xde5b('0x1f')]?_['map'](_0x1b1935['include'],function(_0x3e3456){return{'model':db[_0x3e3456[_0xde5b('0x20')]],'as':_0x3e3456['as'],'attributes':_0x3e3456[_0xde5b('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38be13){logger[_0xde5b('0xf')](_0xde5b('0x19'),_0x361488);logger['debug'](_0xde5b('0x19'),_0x361488,JSON[_0xde5b('0x13')](_0x38be13));_0xc68e5b(_0x38be13);})['catch'](function(_0x2dce39){logger[_0xde5b('0x14')]('GetCmHopperBlack',_0x2dce39[_0xde5b('0x17')],_0x361488);_0x9b4e42(_0x184f60['error'](0x1f4,_0x2dce39['message']));});});};exports[_0xde5b('0x22')]=function(_0x1d43a1){var _0x33cac9=this;return new Promise(function(_0x1e4829,_0x109d35){return db[_0xde5b('0x23')]['update'](_0x1d43a1[_0xde5b('0x24')],{'raw':_0x1d43a1[_0xde5b('0x1b')]?_0x1d43a1[_0xde5b('0x1b')][_0xde5b('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d43a1[_0xde5b('0x1b')]?_0x1d43a1[_0xde5b('0x1b')][_0xde5b('0x1c')]||null:null,'attributes':_0x1d43a1[_0xde5b('0x1b')]?_0x1d43a1['options'][_0xde5b('0x1d')]||null:null,'limit':_0x1d43a1[_0xde5b('0x1b')]?_0x1d43a1[_0xde5b('0x1b')][_0xde5b('0x1e')]||null:null})[_0xde5b('0xe')](function(_0x59cbbe){logger[_0xde5b('0xf')](_0xde5b('0x22'),_0x1d43a1);logger[_0xde5b('0x11')]('UpdateCmHopperBlack',_0x1d43a1,JSON['stringify'](_0x59cbbe));_0x1e4829(_0x59cbbe);})[_0xde5b('0x18')](function(_0x128784){logger['error']('UpdateCmHopperBlack',_0x128784['message'],_0x1d43a1);_0x109d35(_0x33cac9[_0xde5b('0x14')](0x1f4,_0x128784[_0xde5b('0x17')]));});});};exports[_0xde5b('0x26')]=function(_0x41b809){var _0x199b71=this;return new Promise(function(_0x16628d,_0x344c5d){return db[_0xde5b('0x23')][_0xde5b('0x27')]({'where':_0x41b809[_0xde5b('0x1b')]?_0x41b809[_0xde5b('0x1b')][_0xde5b('0x1c')]||null:null})[_0xde5b('0xe')](function(_0x5a9965){logger[_0xde5b('0xf')](_0xde5b('0x26'),_0x41b809);logger[_0xde5b('0x11')](_0xde5b('0x26'),_0x41b809,JSON[_0xde5b('0x13')](_0x5a9965));_0x16628d(_0x5a9965);})[_0xde5b('0x18')](function(_0x3643c2){logger['error']('DestroyCmHopperBlack',_0x3643c2[_0xde5b('0x17')],_0x41b809);_0x344c5d(_0x199b71[_0xde5b('0x14')](0x1f4,_0x3643c2[_0xde5b('0x17')]));});});}; \ No newline at end of file +var _0xeaed=['../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','update','body','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1c1cb0,_0xc347a0){var _0x55384f=function(_0x49def4){while(--_0x49def4){_0x1c1cb0['push'](_0x1c1cb0['shift']());}};_0x55384f(++_0xc347a0);}(_0xeaed,0x64));var _0xdeae=function(_0xfd4594,_0x286a80){_0xfd4594=_0xfd4594-0x0;var _0xb361d1=_0xeaed[_0xfd4594];return _0xb361d1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdeae('0x0'));var BPromise=require(_0xdeae('0x1'));var rs=require(_0xdeae('0x2'));var fs=require('fs');var Redis=require(_0xdeae('0x3'));var db=require(_0xdeae('0x4'))['db'];var utils=require(_0xdeae('0x5'));var logger=require(_0xdeae('0x6'))(_0xdeae('0x7'));var config=require(_0xdeae('0x8'));var jayson=require(_0xdeae('0x9'));var client=jayson[_0xdeae('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ddbb3,_0xaf01cb,_0x525cbb){return new BPromise(function(_0x1e0d5b,_0x41a8e6){return client[_0xdeae('0xb')](_0x3ddbb3,_0x525cbb)[_0xdeae('0xc')](function(_0x30b969){logger[_0xdeae('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0xaf01cb,_0xdeae('0xe'));logger[_0xdeae('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0xaf01cb,_0xdeae('0xe'),JSON[_0xdeae('0x10')](_0x30b969));if(_0x30b969[_0xdeae('0x11')]){if(_0x30b969[_0xdeae('0x11')]['code']===0x1f4){logger[_0xdeae('0x11')](_0xdeae('0x12'),_0xaf01cb,_0x30b969['error']['message']);return _0x41a8e6(_0x30b969[_0xdeae('0x11')][_0xdeae('0x13')]);}logger[_0xdeae('0x11')](_0xdeae('0x12'),_0xaf01cb,_0x30b969[_0xdeae('0x11')][_0xdeae('0x13')]);return _0x1e0d5b(_0x30b969[_0xdeae('0x11')][_0xdeae('0x13')]);}else{logger[_0xdeae('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0xaf01cb,_0xdeae('0xe'));_0x1e0d5b(_0x30b969['result'][_0xdeae('0x13')]);}})[_0xdeae('0x14')](function(_0x4b89e1){logger[_0xdeae('0x11')](_0xdeae('0x12'),_0xaf01cb,_0x4b89e1);_0x41a8e6(_0x4b89e1);});});}exports[_0xdeae('0x15')]=function(_0x33a63f){var _0x4d68f2=this;return new Promise(function(_0x527f5c,_0x368354){return db[_0xdeae('0x16')]['findAll']({'raw':_0x33a63f['options']?_0x33a63f[_0xdeae('0x17')][_0xdeae('0x18')]===undefined?!![]:![]:!![],'where':_0x33a63f[_0xdeae('0x17')]?_0x33a63f[_0xdeae('0x17')][_0xdeae('0x19')]||null:null,'attributes':_0x33a63f[_0xdeae('0x17')]?_0x33a63f['options'][_0xdeae('0x1a')]||null:null,'limit':_0x33a63f[_0xdeae('0x17')]?_0x33a63f[_0xdeae('0x17')][_0xdeae('0x1b')]||null:null,'include':_0x33a63f['options']?_0x33a63f['options'][_0xdeae('0x1c')]?_[_0xdeae('0x1d')](_0x33a63f[_0xdeae('0x17')]['include'],function(_0x525f1a){return{'model':db[_0x525f1a[_0xdeae('0x1e')]],'as':_0x525f1a['as'],'attributes':_0x525f1a[_0xdeae('0x1a')],'include':_0x525f1a['include']?_[_0xdeae('0x1d')](_0x525f1a[_0xdeae('0x1c')],function(_0x427a63){return{'model':db[_0x427a63[_0xdeae('0x1e')]],'as':_0x427a63['as'],'attributes':_0x427a63[_0xdeae('0x1a')],'include':_0x427a63[_0xdeae('0x1c')]?_['map'](_0x427a63['include'],function(_0x2d3a1a){return{'model':db[_0x2d3a1a[_0xdeae('0x1e')]],'as':_0x2d3a1a['as'],'attributes':_0x2d3a1a[_0xdeae('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdeae('0xc')](function(_0x18f0d5){logger[_0xdeae('0xd')](_0xdeae('0x15'),_0x33a63f);logger[_0xdeae('0xf')](_0xdeae('0x15'),_0x33a63f,JSON[_0xdeae('0x10')](_0x18f0d5));_0x527f5c(_0x18f0d5);})[_0xdeae('0x14')](function(_0xdc77f0){logger['error']('GetCmHopperBlack',_0xdc77f0[_0xdeae('0x13')],_0x33a63f);_0x368354(_0x4d68f2[_0xdeae('0x11')](0x1f4,_0xdc77f0[_0xdeae('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x357c2f){var _0xad0395=this;return new Promise(function(_0x32facd,_0x1b719e){return db['CmHopperBlack'][_0xdeae('0x1f')](_0x357c2f[_0xdeae('0x20')],{'raw':_0x357c2f[_0xdeae('0x17')]?_0x357c2f[_0xdeae('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x357c2f[_0xdeae('0x17')]?_0x357c2f['options'][_0xdeae('0x19')]||null:null,'attributes':_0x357c2f[_0xdeae('0x17')]?_0x357c2f[_0xdeae('0x17')][_0xdeae('0x1a')]||null:null,'limit':_0x357c2f[_0xdeae('0x17')]?_0x357c2f[_0xdeae('0x17')]['limit']||null:null})['then'](function(_0x3844e2){logger['info'](_0xdeae('0x21'),_0x357c2f);logger['debug']('UpdateCmHopperBlack',_0x357c2f,JSON[_0xdeae('0x10')](_0x3844e2));_0x32facd(_0x3844e2);})[_0xdeae('0x14')](function(_0x3b6a56){logger[_0xdeae('0x11')](_0xdeae('0x21'),_0x3b6a56[_0xdeae('0x13')],_0x357c2f);_0x1b719e(_0xad0395[_0xdeae('0x11')](0x1f4,_0x3b6a56[_0xdeae('0x13')]));});});};exports['DestroyCmHopperBlack']=function(_0x3b48e0){var _0x1a4794=this;return new Promise(function(_0x3692bb,_0x14ea82){return db[_0xdeae('0x16')][_0xdeae('0x22')]({'where':_0x3b48e0[_0xdeae('0x17')]?_0x3b48e0[_0xdeae('0x17')]['where']||null:null})[_0xdeae('0xc')](function(_0xbdb75f){logger[_0xdeae('0xd')](_0xdeae('0x23'),_0x3b48e0);logger['debug'](_0xdeae('0x23'),_0x3b48e0,JSON['stringify'](_0xbdb75f));_0x3692bb(_0xbdb75f);})[_0xdeae('0x14')](function(_0x3ac15a){logger[_0xdeae('0x11')]('DestroyCmHopperBlack',_0x3ac15a['message'],_0x3b48e0);_0x14ea82(_0x1a4794[_0xdeae('0x11')](0x1f4,_0x3ac15a[_0xdeae('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 0866a64..8022200 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 _0x7b84=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x7b84,0x17c));var _0x47b8=function(_0x232167,_0x4a398e){_0x232167=_0x232167-0x0;var _0x537e8a=_0x7b84[_0x232167];return _0x537e8a;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0x11')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0x13')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);module[_0x47b8('0x15')]=router; \ No newline at end of file +var _0x7ee1=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','isAuthenticated','/:id','delete','destroy','multer','express'];(function(_0x230412,_0x5bbfff){var _0x2096ee=function(_0x2508b0){while(--_0x2508b0){_0x230412['push'](_0x230412['shift']());}};_0x2096ee(++_0x5bbfff);}(_0x7ee1,0x8d));var _0x17ee=function(_0x23bf29,_0x5e8600){_0x23bf29=_0x23bf29-0x0;var _0x41094b=_0x7ee1[_0x23bf29];return _0x41094b;};'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')]('/describe',auth[_0x17ee('0x9')](),controller['describe']);router[_0x17ee('0x7')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller['show']);router['put']('/:id',auth[_0x17ee('0x9')](),controller['update']);router[_0x17ee('0xb')](_0x17ee('0xa'),auth[_0x17ee('0x9')](),controller[_0x17ee('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 75e684a..e975277 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 _0x9a15=['followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','setDataValue'];(function(_0x1db672,_0x54925b){var _0x46f874=function(_0xb7772c){while(--_0xb7772c){_0x1db672['push'](_0x1db672['shift']());}};_0x46f874(++_0x54925b);}(_0x9a15,0x19b));var _0x59a1=function(_0x2fc117,_0x5bf83d){_0x2fc117=_0x2fc117-0x0;var _0x339be9=_0x9a15[_0x2fc117];return _0x339be9;};'use strict';var Sequelize=require(_0x59a1('0x0'));var moment=require(_0x59a1('0x1'));module[_0x59a1('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x59a1('0x3')]},'scheduledat':{'type':Sequelize[_0x59a1('0x4')]},'countbusyretry':{'type':Sequelize[_0x59a1('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x59a1('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x59a1('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x59a1('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x59a1('0x3')]},'calleridname':{'type':Sequelize[_0x59a1('0x3')]},'starttime':{'type':Sequelize[_0x59a1('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x59a1('0x4')]},'endtime':{'type':Sequelize[_0x59a1('0x4')]},'ringtime':{'type':Sequelize[_0x59a1('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x59a1('0x3')]},'membername':{'type':Sequelize[_0x59a1('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x59a1('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x59a1('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x21bc88){var _0x3d0bca=this['getDataValue']('endtime');if(_0x3d0bca&&_0x21bc88){this[_0x59a1('0x6')](_0x59a1('0x7'),moment(_0x21bc88)[_0x59a1('0x8')](moment(_0x3d0bca),_0x59a1('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x59a1('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x59a1('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x59a1('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x59a1('0x4')]},'callback':{'type':Sequelize[_0x59a1('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x59a1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x59a1('0x4')]},'deleted':{'type':Sequelize[_0x59a1('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x59a1('0x4')]},'recallme':{'type':Sequelize[_0x59a1('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x59a1('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x59a1('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x59a1('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x59a1('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x59a1('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x839f=['INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x39cd5c,_0x29f33e){var _0x971df4=function(_0x56aa8e){while(--_0x56aa8e){_0x39cd5c['push'](_0x39cd5c['shift']());}};_0x971df4(++_0x29f33e);}(_0x839f,0x12a));var _0xf839=function(_0x4e67ce,_0x32c8c7){_0x4e67ce=_0x4e67ce-0x0;var _0x345a96=_0x839f[_0x4e67ce];return _0x345a96;};'use strict';var Sequelize=require(_0xf839('0x0'));var moment=require(_0xf839('0x1'));module['exports']={'state':{'type':Sequelize[_0xf839('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf839('0x3')]},'scheduledat':{'type':Sequelize[_0xf839('0x4')]},'countbusyretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf839('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xf839('0x3')]},'originatecalleridname':{'type':Sequelize[_0xf839('0x3')]},'calleridnum':{'type':Sequelize[_0xf839('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf839('0x4')]},'answertime':{'type':Sequelize[_0xf839('0x4')]},'droptime':{'type':Sequelize[_0xf839('0x4')]},'endtime':{'type':Sequelize[_0xf839('0x4')]},'ringtime':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf839('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf839('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xf839('0x3')]},'disposition':{'type':Sequelize[_0xf839('0x3')]},'secondDisposition':{'type':Sequelize[_0xf839('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xf839('0x4')],'set':function(_0xba4d92){var _0x287b8e=this[_0xf839('0x5')](_0xf839('0x6'));if(_0x287b8e&&_0xba4d92){this[_0xf839('0x7')](_0xf839('0x8'),moment(_0xba4d92)[_0xf839('0x9')](moment(_0x287b8e),_0xf839('0xa')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xf839('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xf839('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf839('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xf839('0x4')]},'callback':{'type':Sequelize[_0xf839('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf839('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xf839('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xf839('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf839('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 6711901..b808176 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 _0x7a54=['calleridnum\x20NOT\x20IN\x20(?)','calleridnum','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','findOne','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','CmHopperFinal','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL'];(function(_0x20dd32,_0x595bb0){var _0x40bddf=function(_0x5e82b3){while(--_0x5e82b3){_0x20dd32['push'](_0x20dd32['shift']());}};_0x40bddf(++_0x595bb0);}(_0x7a54,0x106));var _0x47a5=function(_0x31e78e,_0xeeb77f){_0x31e78e=_0x31e78e-0x0;var _0x45d800=_0x7a54[_0x31e78e];return _0x45d800;};'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['CmHopperFinal'][_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['CmHopperFinal']['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['describe']=function(_0x2d38de,_0x23bb04){return db['CmHopperFinal']['describe']()[_0x47a5('0x23')](respondWithResult(_0x23bb04,null))['catch'](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0xd93e37,_0x54c35f){if(_0xd93e37['body'][_0x47a5('0x47')]){delete _0xd93e37['body'][_0x47a5('0x47')];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'uniqueid':_0xd93e37[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x54c35f,null))[_0x47a5('0x23')](saveUpdates(_0xd93e37[_0x47a5('0x48')],null))['then'](respondWithResult(_0x54c35f,null))['catch'](handleError(_0x54c35f,null));};exports[_0x47a5('0x49')]=function(_0x411230,_0x1163e3,_0x9ea93e){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x411230[_0x47a5('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4c')))),'noSuchContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x4d')))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x205,\x201,\x20null'))),_0x47a5('0x50')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x208,\x201,\x20null'))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x52')))),'dropContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x47a5('0x53')))),'abandonedContacts'],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2022,\x201,\x20null'))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x55')))),_0x47a5('0x56')]]})['then'](handleEntityNotFound(_0x1163e3,null))[_0x47a5('0x23')](respondWithResult(_0x1163e3,null))[_0x47a5('0x46')](handleError(_0x1163e3,null));};exports[_0x47a5('0x57')]=function(_0x5a33b8,_0x30ea7a,_0x4db625){return db[_0x47a5('0x2a')][_0x47a5('0x3e')]({'raw':![],'where':{'CampaignId':_0x5a33b8[_0x47a5('0x41')]['id']},'attributes':[[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x47a5('0x4e')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x58')))),'busyContacts'],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db['sequelize']['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x59')))),_0x47a5('0x51')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')]['literal'](_0x47a5('0x52')))),_0x47a5('0x5a')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db['sequelize'][_0x47a5('0x4f')](_0x47a5('0x53')))),_0x47a5('0x5b')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')](_0x47a5('0x5c')))),_0x47a5('0x54')],[db[_0x47a5('0x4b')]['fn'](_0x47a5('0x4a'),db[_0x47a5('0x4b')]['fn']('IF',db[_0x47a5('0x4b')][_0x47a5('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x47a5('0x56')]]})[_0x47a5('0x23')](handleEntityNotFound(_0x30ea7a,null))[_0x47a5('0x23')](respondWithResult(_0x30ea7a,null))['catch'](handleError(_0x30ea7a,null));};exports[_0x47a5('0x5d')]=function(_0x2e46af,_0x36c67,_0x26f1ac){return db['VoiceQueue'][_0x47a5('0x45')]({'where':{'id':_0x2e46af['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x36c67,null))['then'](function(_0x43f649){var _0x4cf7c5;if(_0x43f649){_0x4cf7c5=squel[_0x47a5('0x5e')]()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery'](['phone','scheduledAt',_0x47a5('0x61'),_0x47a5('0x62'),_0x47a5('0x63'),_0x47a5('0x64'),'updatedAt'],squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x67'),_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6a'))[_0x47a5('0x66')](_0x47a5('0x6b'),_0x47a5('0x61'))[_0x47a5('0x66')](_0x47a5('0x6c'),'ListId')[_0x47a5('0x66')]('ANY_VALUE(VoiceQueueId)',_0x47a5('0x63'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x6d'))[_0x47a5('0x6e')](_0x47a5('0x6f'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x72'),_0x2e46af['body']['state']['toString']())['where'](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()[_0x47a5('0x66')](_0x47a5('0x68'))[_0x47a5('0x6e')](_0x47a5('0x60'))[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')](_0x47a5('0x74'),squel['select']()[_0x47a5('0x66')](_0x47a5('0x75'))[_0x47a5('0x6e')]('cm_hopper_final')[_0x47a5('0x38')](_0x47a5('0x70'),_0x2e46af[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')]('state\x20=\x204'))['group'](_0x47a5('0x61')))[_0x47a5('0x71')]();return db[_0x47a5('0x4b')][_0x47a5('0x2f')](_0x4cf7c5);}return[];})[_0x47a5('0x23')](respondWithResult(_0x36c67,null))[_0x47a5('0x46')](handleError(_0x36c67,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x592322,_0x3e0dbd,_0x4f2361){return db[_0x47a5('0x76')][_0x47a5('0x45')]({'where':{'id':_0x592322[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x3e0dbd,null))['then'](function(_0x3c66e3){var _0x550bde;if(_0x3c66e3){_0x550bde=squel['insert']()[_0x47a5('0x5f')](_0x47a5('0x60'))['fromQuery']([_0x47a5('0x68'),_0x47a5('0x6a'),_0x47a5('0x61'),'ListId',_0x47a5('0x77'),'createdAt',_0x47a5('0x6d')],squel[_0x47a5('0x65')]()[_0x47a5('0x66')]('ANY_VALUE(calleridnum)',_0x47a5('0x68'))[_0x47a5('0x66')](_0x47a5('0x69'),'scheduledAt')[_0x47a5('0x66')]('ANY_VALUE(ContactId)',_0x47a5('0x61'))['field'](_0x47a5('0x6c'),_0x47a5('0x62'))[_0x47a5('0x66')](_0x47a5('0x78'),'CampaignId')[_0x47a5('0x66')](_0x47a5('0x69'),_0x47a5('0x64'))[_0x47a5('0x66')](_0x47a5('0x69'),'updatedAt')['from'](_0x47a5('0x6f'))['where'](_0x47a5('0x79'),_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]())['where'](_0x47a5('0x72'),_0x592322[_0x47a5('0x48')]['state'][_0x47a5('0x71')]())[_0x47a5('0x38')](_0x47a5('0x73'))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x47a5('0x66')](_0x47a5('0x68'))['from'](_0x47a5('0x60'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id'][_0x47a5('0x71')]()))[_0x47a5('0x38')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x47a5('0x65')]()['field'](_0x47a5('0x75'))['from'](_0x47a5('0x6f'))[_0x47a5('0x38')]('CampaignId\x20=\x20?',_0x592322[_0x47a5('0x41')]['id']['toString']())[_0x47a5('0x38')](_0x47a5('0x7a')))[_0x47a5('0x7b')](_0x47a5('0x61')))['toString']();return db[_0x47a5('0x4b')]['query'](_0x550bde);}return[];})['then'](respondWithResult(_0x3e0dbd,null))[_0x47a5('0x46')](handleError(_0x3e0dbd,null));};exports[_0x47a5('0x7c')]=function(_0x352238,_0x96fb22,_0x380c8b){return db['CmHopper'][_0x47a5('0x7d')]({'where':{'VoiceQueueId':_0x352238[_0x47a5('0x48')][_0x47a5('0x63')],'CampaignId':_0x352238[_0x47a5('0x48')]['CampaignId'],'ContactId':_0x352238[_0x47a5('0x48')]['ContactId']}})[_0x47a5('0x23')](handleEntityNotFound(_0x96fb22,null))[_0x47a5('0x23')](function(_0x3f93f0){if(_0x3f93f0){return _0x3f93f0;}return null;})[_0x47a5('0x23')](respondWithResult(_0x96fb22,null))[_0x47a5('0x46')](handleError(_0x96fb22,null));}; \ No newline at end of file +var _0x4137=['squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','uniqueid','body','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','literal','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4137,0xf8));var _0x7413=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4137[_0x46698a];return _0x356db0;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['CmHopperFinal'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['describe']=function(_0x513657,_0x3c1f1a){return db['CmHopperFinal']['describe']()[_0x7413('0x25')](respondWithResult(_0x3c1f1a,null))[_0x7413('0x47')](handleError(_0x3c1f1a,null));};exports['update']=function(_0x2aa12c,_0x586d25){if(_0x2aa12c['body'][_0x7413('0x48')]){delete _0x2aa12c['body'][_0x7413('0x48')];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'uniqueid':_0x2aa12c[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x586d25,null))[_0x7413('0x25')](saveUpdates(_0x2aa12c[_0x7413('0x49')],null))[_0x7413('0x25')](respondWithResult(_0x586d25,null))[_0x7413('0x47')](handleError(_0x586d25,null));};exports[_0x7413('0x4a')]=function(_0x50a27d,_0x369891,_0x501407){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x50a27d[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x4d')))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize']['literal'](_0x7413('0x51')))),_0x7413('0x52')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x55')))),'abandonedContacts'],[db[_0x7413('0x4b')]['fn']('COUNT',db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')]['literal'](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x369891,null))[_0x7413('0x25')](respondWithResult(_0x369891,null))[_0x7413('0x47')](handleError(_0x369891,null));};exports[_0x7413('0x5a')]=function(_0x28130e,_0x593571,_0x35f7e8){return db['CmHopperFinal'][_0x7413('0x41')]({'raw':![],'where':{'CampaignId':_0x28130e[_0x7413('0x43')]['id']},'attributes':[[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x5b')))),_0x7413('0x4e')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x4f')))),_0x7413('0x50')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db['sequelize'][_0x7413('0x54')](_0x7413('0x51')))),'congestionContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x53')))),'dropContacts'],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7413('0x5c')],[db[_0x7413('0x4b')]['fn'](_0x7413('0x4c'),db[_0x7413('0x4b')]['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x56')))),_0x7413('0x57')],[db['sequelize']['fn'](_0x7413('0x4c'),db['sequelize']['fn']('IF',db[_0x7413('0x4b')][_0x7413('0x54')](_0x7413('0x58')))),_0x7413('0x59')]]})[_0x7413('0x25')](handleEntityNotFound(_0x593571,null))[_0x7413('0x25')](respondWithResult(_0x593571,null))[_0x7413('0x47')](handleError(_0x593571,null));};exports[_0x7413('0x5d')]=function(_0x2c504e,_0x50910a,_0x5988bd){return db[_0x7413('0x5e')]['find']({'where':{'id':_0x2c504e[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x50910a,null))['then'](function(_0x2be9b1){var _0x4b676a;if(_0x2be9b1){_0x4b676a=squel[_0x7413('0x5f')]()[_0x7413('0x60')]('cm_hopper')['fromQuery']([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),'ListId',_0x7413('0x64'),_0x7413('0x65'),_0x7413('0x66')],squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x69'),'phone')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x62'))['field'](_0x7413('0x6b'),_0x7413('0x63'))[_0x7413('0x68')](_0x7413('0x6c'),_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x6e'),_0x7413('0x64'))[_0x7413('0x68')]('NOW()',_0x7413('0x65'))[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x71'),_0x2c504e['params']['id']['toString']())[_0x7413('0x3b')](_0x7413('0x72'),_0x2c504e['body'][_0x7413('0x73')][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('phone')[_0x7413('0x6f')]('cm_hopper')[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')](_0x7413('0x77'))[_0x7413('0x6f')](_0x7413('0x70'))[_0x7413('0x3b')](_0x7413('0x71'),_0x2c504e['params']['id'][_0x7413('0x74')]())[_0x7413('0x3b')]('state\x20=\x204'))['group']('ContactId'))[_0x7413('0x74')]();return db['sequelize'][_0x7413('0x32')](_0x4b676a);}return[];})[_0x7413('0x25')](respondWithResult(_0x50910a,null))[_0x7413('0x47')](handleError(_0x50910a,null));};exports[_0x7413('0x78')]=function(_0x470c21,_0x17c115,_0xbba3c7){return db[_0x7413('0x79')][_0x7413('0x46')]({'where':{'id':_0x470c21['params']['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x17c115,null))[_0x7413('0x25')](function(_0x38bb4e){var _0x4ea60e;if(_0x38bb4e){_0x4ea60e=squel[_0x7413('0x5f')]()[_0x7413('0x60')](_0x7413('0x7a'))[_0x7413('0x7b')]([_0x7413('0x61'),_0x7413('0x62'),_0x7413('0x63'),_0x7413('0x6d'),_0x7413('0x7c'),_0x7413('0x65'),'updatedAt'],squel[_0x7413('0x67')]()[_0x7413('0x68')]('ANY_VALUE(calleridnum)',_0x7413('0x61'))[_0x7413('0x68')]('NOW()',_0x7413('0x62'))[_0x7413('0x68')](_0x7413('0x6b'),'ContactId')[_0x7413('0x68')]('ANY_VALUE(ListId)',_0x7413('0x6d'))[_0x7413('0x68')](_0x7413('0x7d'),_0x7413('0x7c'))[_0x7413('0x68')](_0x7413('0x6a'),'createdAt')[_0x7413('0x68')](_0x7413('0x6a'),_0x7413('0x66'))[_0x7413('0x6f')](_0x7413('0x70'))['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x72'),_0x470c21['body']['state'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x75'))[_0x7413('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x7413('0x68')](_0x7413('0x61'))[_0x7413('0x6f')]('cm_hopper')['where'](_0x7413('0x7e'),_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]()))[_0x7413('0x3b')](_0x7413('0x76'),squel[_0x7413('0x67')]()[_0x7413('0x68')]('calleridnum')['from'](_0x7413('0x70'))[_0x7413('0x3b')]('CampaignId\x20=\x20?',_0x470c21[_0x7413('0x43')]['id'][_0x7413('0x74')]())[_0x7413('0x3b')](_0x7413('0x7f')))[_0x7413('0x80')](_0x7413('0x63')))[_0x7413('0x74')]();return db[_0x7413('0x4b')][_0x7413('0x32')](_0x4ea60e);}return[];})['then'](respondWithResult(_0x17c115,null))[_0x7413('0x47')](handleError(_0x17c115,null));};exports[_0x7413('0x81')]=function(_0x59d665,_0x1f3e26,_0xccd480){return db[_0x7413('0x82')]['findOne']({'where':{'VoiceQueueId':_0x59d665['body']['VoiceQueueId'],'CampaignId':_0x59d665[_0x7413('0x49')][_0x7413('0x7c')],'ContactId':_0x59d665[_0x7413('0x49')][_0x7413('0x63')]}})[_0x7413('0x25')](handleEntityNotFound(_0x1f3e26,null))[_0x7413('0x25')](function(_0x207293){if(_0x207293){return _0x207293;}return null;})[_0x7413('0x25')](respondWithResult(_0x1f3e26,null))['catch'](handleError(_0x1f3e26,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ca26e47..d86c5a7 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 _0x0f7e=['rimraf','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x9b9c97,_0x84bbce){var _0x3860e2=function(_0xe2d70a){while(--_0xe2d70a){_0x9b9c97['push'](_0x9b9c97['shift']());}};_0x3860e2(++_0x84bbce);}(_0x0f7e,0x1d9));var _0xe0f7=function(_0x58d5de,_0x1419c2){_0x58d5de=_0x58d5de-0x0;var _0x1c70e7=_0x0f7e[_0x58d5de];return _0x1c70e7;};'use strict';var _=require(_0xe0f7('0x0'));var util=require('util');var logger=require(_0xe0f7('0x1'))(_0xe0f7('0x2'));var moment=require(_0xe0f7('0x3'));var BPromise=require(_0xe0f7('0x4'));var rp=require(_0xe0f7('0x5'));var fs=require('fs');var path=require(_0xe0f7('0x6'));var rimraf=require(_0xe0f7('0x7'));var config=require(_0xe0f7('0x8'));var attributes=require(_0xe0f7('0x9'));module[_0xe0f7('0xa')]=function(_0x5db9e9,_0x52d01b){return _0x5db9e9[_0xe0f7('0xb')](_0xe0f7('0xc'),attributes,{'tableName':_0xe0f7('0xd'),'paranoid':![],'indexes':[{'name':_0xe0f7('0xe'),'fields':['calleridnum']},{'name':_0xe0f7('0xf'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xda34=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./cmHopperFinal.attributes','define'];(function(_0x41df11,_0x5bed70){var _0x5d4050=function(_0x2322bb){while(--_0x2322bb){_0x41df11['push'](_0x41df11['shift']());}};_0x5d4050(++_0x5bed70);}(_0xda34,0xac));var _0x4da3=function(_0x37783e,_0x3fb3ff){_0x37783e=_0x37783e-0x0;var _0x51955f=_0xda34[_0x37783e];return _0x51955f;};'use strict';var _=require(_0x4da3('0x0'));var util=require(_0x4da3('0x1'));var logger=require(_0x4da3('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4da3('0x3'));var rp=require(_0x4da3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4da3('0x5'));var config=require('../../config/environment');var attributes=require(_0x4da3('0x6'));module['exports']=function(_0x34d333,_0x41c536){return _0x34d333[_0x4da3('0x7')](_0x4da3('0x8'),attributes,{'tableName':_0x4da3('0x9'),'paranoid':![],'indexes':[{'name':_0x4da3('0xa'),'fields':[_0x4da3('0xa')]},{'name':'uniqueid','fields':[_0x4da3('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 f812f12..fc1dd7d 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x1e3029,_0x5aac32){var _0x3dcfe5=function(_0x36a3f1){while(--_0x36a3f1){_0x1e3029['push'](_0x1e3029['shift']());}};_0x3dcfe5(++_0x5aac32);}(_0xb10b,0x12a));var _0xbb10=function(_0xd4470d,_0x47318d){_0xd4470d=_0xd4470d-0x0;var _0x5544c5=_0xb10b[_0xd4470d];return _0x5544c5;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x56c59e,_0x37998b){var _0x24a922=function(_0x3e7660){while(--_0x3e7660){_0x56c59e['push'](_0x56c59e['shift']());}};_0x24a922(++_0x37998b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5560f6,_0x225f9c){_0x5560f6=_0x5560f6-0x0;var _0x25d4ef=_0xb10b[_0x5560f6];return _0x25d4ef;};'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 35235e2..23db25d 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 _0xe440=['../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','/:id','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0xc71e23,_0x434337){var _0x119ad7=function(_0x503498){while(--_0x503498){_0xc71e23['push'](_0xc71e23['shift']());}};_0x119ad7(++_0x434337);}(_0xe440,0x10d));var _0x0e44=function(_0x1a140b,_0x49695f){_0x1a140b=_0x1a140b-0x0;var _0x383cc4=_0xe440[_0x1a140b];return _0x383cc4;};'use strict';var multer=require('multer');var util=require(_0x0e44('0x0'));var path=require(_0x0e44('0x1'));var timeout=require(_0x0e44('0x2'));var express=require(_0x0e44('0x3'));var router=express[_0x0e44('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e44('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0e44('0x6'));var controller=require(_0x0e44('0x7'));router[_0x0e44('0x8')]('/',auth[_0x0e44('0x9')](),controller[_0x0e44('0xa')]);router[_0x0e44('0x8')](_0x0e44('0xb'),auth['isAuthenticated'](),controller[_0x0e44('0xc')]);router[_0x0e44('0x8')]('/:id',auth[_0x0e44('0x9')](),controller[_0x0e44('0xd')]);router[_0x0e44('0x8')]('/voice/queue/countAttributes/:id',auth[_0x0e44('0x9')](),controller[_0x0e44('0xe')]);router[_0x0e44('0x8')](_0x0e44('0xf'),auth[_0x0e44('0x9')](),controller[_0x0e44('0x10')]);router[_0x0e44('0x11')](_0x0e44('0x12'),auth['isAuthenticated'](),controller[_0x0e44('0x13')]);router[_0x0e44('0x11')](_0x0e44('0x14'),auth[_0x0e44('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x0e44('0x11')](_0x0e44('0x15'),auth[_0x0e44('0x9')](),controller[_0x0e44('0x16')]);router[_0x0e44('0x17')](_0x0e44('0x18'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xcc6d=['moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','/voice/queue/countAttributes/:id','/voice/queue/moveContacts/:id'];(function(_0x1470cf,_0x5d471f){var _0x2482fb=function(_0x1747e3){while(--_0x1747e3){_0x1470cf['push'](_0x1470cf['shift']());}};_0x2482fb(++_0x5d471f);}(_0xcc6d,0x1a9));var _0xdcc6=function(_0x296dfc,_0x341e7d){_0x296dfc=_0x296dfc-0x0;var _0x3675c6=_0xcc6d[_0x296dfc];return _0x3675c6;};'use strict';var multer=require(_0xdcc6('0x0'));var util=require(_0xdcc6('0x1'));var path=require(_0xdcc6('0x2'));var timeout=require(_0xdcc6('0x3'));var express=require(_0xdcc6('0x4'));var router=express['Router']();var fs_extra=require(_0xdcc6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdcc6('0x6'));var controller=require('./cmHopperFinal.controller');router[_0xdcc6('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xdcc6('0x8'),auth['isAuthenticated'](),controller[_0xdcc6('0x9')]);router[_0xdcc6('0x7')](_0xdcc6('0xa'),auth[_0xdcc6('0xb')](),controller[_0xdcc6('0xc')]);router['get'](_0xdcc6('0xd'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router['get']('/campaign/countAttributes/:id',auth[_0xdcc6('0xb')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xdcc6('0xe'),auth[_0xdcc6('0xb')](),controller[_0xdcc6('0xf')]);router[_0xdcc6('0x10')](_0xdcc6('0x11'),auth[_0xdcc6('0xb')](),controller[_0xdcc6('0x12')]);router[_0xdcc6('0x10')](_0xdcc6('0x13'),auth[_0xdcc6('0xb')](),controller['checkContactHopper']);router['put'](_0xdcc6('0xa'),auth['isAuthenticated'](),controller[_0xdcc6('0x14')]);module[_0xdcc6('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 8759d80..d9962e0 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 _0x5f02=['BOOLEAN','sequelize','INTEGER','DATE','STRING'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x5f02,0xa6));var _0x25f0=function(_0x707bae,_0x61938e){_0x707bae=_0x707bae-0x0;var _0x13a79b=_0x5f02[_0x707bae];return _0x13a79b;};'use strict';var Sequelize=require(_0x25f0('0x0'));module['exports']={'state':{'type':Sequelize[_0x25f0('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x25f0('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x25f0('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x25f0('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x25f0('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x25f0('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x25f0('0x3')]},'calleridname':{'type':Sequelize[_0x25f0('0x3')]},'starttime':{'type':Sequelize[_0x25f0('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x25f0('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x25f0('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x25f0('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x25f0('0x3')]},'campaigntype':{'type':Sequelize[_0x25f0('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x25f0('0x3')]},'amd':{'type':Sequelize[_0x25f0('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x25f0('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x25f0('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x25f0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x25f0('0x2')]},'recallme':{'type':Sequelize[_0x25f0('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x25f0('0x2')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x25f0('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x25f0('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x25f0('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x25f0('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x25f0('0x1')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf6e6=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x441c12,_0x491e5a){var _0x312edf=function(_0x40605b){while(--_0x40605b){_0x441c12['push'](_0x441c12['shift']());}};_0x312edf(++_0x491e5a);}(_0xf6e6,0x1a8));var _0x6f6e=function(_0x137195,_0xb5c988){_0x137195=_0x137195-0x0;var _0x25245c=_0xf6e6[_0x137195];return _0x25245c;};'use strict';var Sequelize=require(_0x6f6e('0x0'));module[_0x6f6e('0x1')]={'state':{'type':Sequelize[_0x6f6e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6f6e('0x3')]},'scheduledat':{'type':Sequelize[_0x6f6e('0x4')]},'countbusyretry':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6f6e('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6f6e('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6f6e('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6f6e('0x4')]},'endtime':{'type':Sequelize[_0x6f6e('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x6f6e('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6f6e('0x3')]},'reason':{'type':Sequelize[_0x6f6e('0x3')]},'amd':{'type':Sequelize[_0x6f6e('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6f6e('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x6f6e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6f6e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x6f6e('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6f6e('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 14df34c..c95a188 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 _0x0158=['VIRTUAL','merge','options','CmHopperHistory','findAll','rows','catch','show','params','find','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','end','status','json','undefined','count','offset','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type'];(function(_0xd5219a,_0x1ae736){var _0x38ff0f=function(_0x70aac){while(--_0x70aac){_0xd5219a['push'](_0xd5219a['shift']());}};_0x38ff0f(++_0x1ae736);}(_0x0158,0x1b8));var _0x8015=function(_0x50c534,_0x3c8dce){_0x50c534=_0x50c534-0x0;var _0x4677df=_0x0158[_0x50c534];return _0x4677df;};'use strict';var emlformat=require(_0x8015('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8015('0x1'));var jsonpatch=require(_0x8015('0x2'));var rp=require(_0x8015('0x3'));var moment=require(_0x8015('0x4'));var BPromise=require(_0x8015('0x5'));var Mustache=require(_0x8015('0x6'));var util=require(_0x8015('0x7'));var path=require(_0x8015('0x8'));var sox=require(_0x8015('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8015('0xa'));var jsforce=require(_0x8015('0xb'));var deskjs=require(_0x8015('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8015('0xd'));var Redis=require('ioredis');var authService=require(_0x8015('0xe'));var qs=require(_0x8015('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8015('0x10'));var logger=require('../../config/logger')(_0x8015('0x11'));var utils=require('../../config/utils');var config=require(_0x8015('0x12'));var licenseUtil=require(_0x8015('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50113a,_0x404b9e){_0x404b9e=_0x404b9e||0xcc;return function(_0x380579){if(_0x380579){return _0x50113a['sendStatus'](_0x404b9e);}return _0x50113a['status'](_0x404b9e)[_0x8015('0x14')]();};}function respondWithResult(_0x334cd0,_0x580b3b){_0x580b3b=_0x580b3b||0xc8;return function(_0x27a51){if(_0x27a51){return _0x334cd0[_0x8015('0x15')](_0x580b3b)[_0x8015('0x16')](_0x27a51);}};}function respondWithFilteredResult(_0x174d52,_0x3cd37f){return function(_0x21e3ea){if(_0x21e3ea){var _0x357592=typeof _0x3cd37f['offset']===_0x8015('0x17')&&typeof _0x3cd37f['limit']===_0x8015('0x17');var _0xa522f2=_0x21e3ea[_0x8015('0x18')];var _0x3a65fd=_0x357592?0x0:_0x3cd37f['offset'];var _0x4f9267=_0x357592?_0x21e3ea[_0x8015('0x18')]:_0x3cd37f[_0x8015('0x19')]+_0x3cd37f['limit'];var _0xa8e960;if(_0x4f9267>=_0xa522f2){_0x4f9267=_0xa522f2;_0xa8e960=0xc8;}else{_0xa8e960=0xce;}_0x174d52[_0x8015('0x15')](_0xa8e960);return _0x174d52['set'](_0x8015('0x1a'),_0x3a65fd+'-'+_0x4f9267+'/'+_0xa522f2)[_0x8015('0x16')](_0x21e3ea);}return null;};}function patchUpdates(_0x34e7d6){return function(_0x580346){try{jsonpatch[_0x8015('0x1b')](_0x580346,_0x34e7d6,!![]);}catch(_0x2bd8f3){return BPromise[_0x8015('0x1c')](_0x2bd8f3);}return _0x580346[_0x8015('0x1d')]();};}function saveUpdates(_0x359e15,_0x6e7e65){return function(_0x162456){if(_0x162456){return _0x162456[_0x8015('0x1e')](_0x359e15)[_0x8015('0x1f')](function(_0x2ac780){return _0x2ac780;});}return null;};}function removeEntity(_0x5b2365,_0x167197){return function(_0x2c0671){if(_0x2c0671){return _0x2c0671['destroy']()['then'](function(){_0x5b2365['status'](0xcc)[_0x8015('0x14')]();});}};}function handleEntityNotFound(_0x46a084,_0x169833){return function(_0xa83cf9){if(!_0xa83cf9){_0x46a084[_0x8015('0x20')](0x194);}return _0xa83cf9;};}function handleError(_0x1d6011,_0x477f89){_0x477f89=_0x477f89||0x1f4;return function(_0x5f04dd){logger['error'](_0x5f04dd[_0x8015('0x21')]);if(_0x5f04dd[_0x8015('0x22')]){delete _0x5f04dd[_0x8015('0x22')];}_0x1d6011['status'](_0x477f89)[_0x8015('0x23')](_0x5f04dd);};}exports[_0x8015('0x24')]=function(_0x24bfad,_0xeb00e6){var _0x24c9d8={},_0x1a33bb={},_0x1beec8={'count':0x0,'rows':[]};var _0x26f869=_['map'](db['CmHopperHistory'][_0x8015('0x25')],function(_0xf82040){return{'name':_0xf82040[_0x8015('0x26')],'type':_0xf82040['type'][_0x8015('0x27')]};});_0x1a33bb[_0x8015('0x28')]=_[_0x8015('0x29')](_0x26f869,'name');_0x1a33bb['query']=_[_0x8015('0x2a')](_0x24bfad[_0x8015('0x2b')]);_0x1a33bb['filters']=_[_0x8015('0x2c')](_0x1a33bb['model'],_0x1a33bb[_0x8015('0x2b')]);_0x24c9d8[_0x8015('0x2d')]=_[_0x8015('0x2c')](_0x1a33bb['model'],qs[_0x8015('0x2e')](_0x24bfad[_0x8015('0x2b')][_0x8015('0x2e')]));_0x24c9d8['attributes']=_0x24c9d8['attributes'][_0x8015('0x2f')]?_0x24c9d8[_0x8015('0x2d')]:_0x1a33bb[_0x8015('0x28')];if(!_0x24bfad[_0x8015('0x2b')][_0x8015('0x30')](_0x8015('0x31'))){_0x24c9d8[_0x8015('0x32')]=qs[_0x8015('0x32')](_0x24bfad['query'][_0x8015('0x32')]);_0x24c9d8['offset']=qs['offset'](_0x24bfad['query'][_0x8015('0x19')]);}_0x24c9d8[_0x8015('0x33')]=qs['sort'](_0x24bfad[_0x8015('0x2b')][_0x8015('0x34')]);_0x24c9d8[_0x8015('0x35')]=qs['filters'](_['pick'](_0x24bfad[_0x8015('0x2b')],_0x1a33bb[_0x8015('0x36')]),_0x26f869);if(_0x24bfad[_0x8015('0x2b')][_0x8015('0x37')]){_0x24c9d8[_0x8015('0x35')]=_['merge'](_0x24c9d8[_0x8015('0x35')],{'$or':_[_0x8015('0x29')](_0x26f869,function(_0x5c3a35){if(_0x5c3a35[_0x8015('0x38')]!==_0x8015('0x39')){var _0x1b830c={};_0x1b830c[_0x5c3a35[_0x8015('0x22')]]={'$like':'%'+_0x24bfad[_0x8015('0x2b')][_0x8015('0x37')]+'%'};return _0x1b830c;}})});}_0x24c9d8=_[_0x8015('0x3a')]({},_0x24c9d8,_0x24bfad[_0x8015('0x3b')]);var _0x57c1cd={'where':_0x24c9d8['where']};return db['CmHopperHistory'][_0x8015('0x18')](_0x57c1cd)[_0x8015('0x1f')](function(_0x3d7f10){_0x1beec8['count']=_0x3d7f10;if(_0x24bfad[_0x8015('0x2b')]['includeAll']){_0x24c9d8['include']=[{'all':!![]}];}return db[_0x8015('0x3c')][_0x8015('0x3d')](_0x24c9d8);})[_0x8015('0x1f')](function(_0x5177f2){_0x1beec8[_0x8015('0x3e')]=_0x5177f2;return _0x1beec8;})[_0x8015('0x1f')](respondWithFilteredResult(_0xeb00e6,_0x24c9d8))[_0x8015('0x3f')](handleError(_0xeb00e6,null));};exports[_0x8015('0x40')]=function(_0x523b1e,_0x43a05c){var _0x30fff4={'raw':!![],'where':{'id':_0x523b1e[_0x8015('0x41')]['id']}},_0x3640bb={};_0x3640bb[_0x8015('0x28')]=_[_0x8015('0x2a')](db[_0x8015('0x3c')]['rawAttributes']);_0x3640bb['query']=_[_0x8015('0x2a')](_0x523b1e[_0x8015('0x2b')]);_0x3640bb['filters']=_[_0x8015('0x2c')](_0x3640bb[_0x8015('0x28')],_0x3640bb[_0x8015('0x2b')]);_0x30fff4[_0x8015('0x2d')]=_['intersection'](_0x3640bb[_0x8015('0x28')],qs[_0x8015('0x2e')](_0x523b1e[_0x8015('0x2b')][_0x8015('0x2e')]));_0x30fff4[_0x8015('0x2d')]=_0x30fff4[_0x8015('0x2d')]['length']?_0x30fff4[_0x8015('0x2d')]:_0x3640bb['model'];if(_0x523b1e[_0x8015('0x2b')]['includeAll']){_0x30fff4['include']=[{'all':!![]}];}_0x30fff4=_[_0x8015('0x3a')]({},_0x30fff4,_0x523b1e[_0x8015('0x3b')]);return db[_0x8015('0x3c')][_0x8015('0x42')](_0x30fff4)[_0x8015('0x1f')](handleEntityNotFound(_0x43a05c,null))[_0x8015('0x1f')](respondWithResult(_0x43a05c,null))[_0x8015('0x3f')](handleError(_0x43a05c,null));};exports['create']=function(_0x3a26c6,_0x1fd1d2){return db[_0x8015('0x3c')][_0x8015('0x43')](_0x3a26c6[_0x8015('0x44')],{})['then'](respondWithResult(_0x1fd1d2,0xc9))['catch'](handleError(_0x1fd1d2,null));};exports[_0x8015('0x45')]=function(_0x2ed06a,_0x1fb70f){return db[_0x8015('0x3c')][_0x8015('0x45')]()[_0x8015('0x1f')](respondWithResult(_0x1fb70f,null))['catch'](handleError(_0x1fb70f,null));};exports[_0x8015('0x1e')]=function(_0x35837b,_0x45768a){if(_0x35837b[_0x8015('0x44')]['uniqueid']){delete _0x35837b[_0x8015('0x44')][_0x8015('0x46')];}return db[_0x8015('0x3c')][_0x8015('0x42')]({'where':{'uniqueid':_0x35837b['params']['id']}})[_0x8015('0x1f')](handleEntityNotFound(_0x45768a,null))[_0x8015('0x1f')](saveUpdates(_0x35837b['body'],null))['then'](respondWithResult(_0x45768a,null))['catch'](handleError(_0x45768a,null));}; \ No newline at end of file +var _0x52d8=['attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','end','stack','name','send','index','map','CmHopperHistory','rawAttributes','type','key','model','keys','filters','query','intersection','fields'];(function(_0x25a136,_0x57320e){var _0x5b7159=function(_0x32c8f9){while(--_0x32c8f9){_0x25a136['push'](_0x25a136['shift']());}};_0x5b7159(++_0x57320e);}(_0x52d8,0x150));var _0x852d=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x52d8[_0x284bc3];return _0x41ac81;};'use strict';var emlformat=require(_0x852d('0x0'));var rimraf=require(_0x852d('0x1'));var zipdir=require(_0x852d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x852d('0x3'));var moment=require(_0x852d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x852d('0x5'));var util=require('util');var path=require(_0x852d('0x6'));var sox=require(_0x852d('0x7'));var csv=require(_0x852d('0x8'));var ejs=require(_0x852d('0x9'));var fs=require('fs');var fs_extra=require(_0x852d('0xa'));var _=require(_0x852d('0xb'));var squel=require(_0x852d('0xc'));var crypto=require(_0x852d('0xd'));var jsforce=require(_0x852d('0xe'));var deskjs=require(_0x852d('0xf'));var toCsv=require(_0x852d('0x8'));var querystring=require('querystring');var Papa=require(_0x852d('0x10'));var Redis=require(_0x852d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x852d('0x12'));var as=require(_0x852d('0x13'));var hardwareService=require(_0x852d('0x14'));var logger=require(_0x852d('0x15'))('api');var utils=require(_0x852d('0x16'));var config=require(_0x852d('0x17'));var licenseUtil=require(_0x852d('0x18'));var db=require(_0x852d('0x19'))['db'];function respondWithStatusCode(_0x4d3084,_0x5bb294){_0x5bb294=_0x5bb294||0xcc;return function(_0x5503a9){if(_0x5503a9){return _0x4d3084[_0x852d('0x1a')](_0x5bb294);}return _0x4d3084[_0x852d('0x1b')](_0x5bb294)['end']();};}function respondWithResult(_0x2a32cf,_0x13735a){_0x13735a=_0x13735a||0xc8;return function(_0x27d01f){if(_0x27d01f){return _0x2a32cf[_0x852d('0x1b')](_0x13735a)[_0x852d('0x1c')](_0x27d01f);}};}function respondWithFilteredResult(_0x5c6e12,_0x5e79d7){return function(_0x4c3ac4){if(_0x4c3ac4){var _0x41eafd=typeof _0x5e79d7[_0x852d('0x1d')]===_0x852d('0x1e')&&typeof _0x5e79d7[_0x852d('0x1f')]===_0x852d('0x1e');var _0x51ac4c=_0x4c3ac4[_0x852d('0x20')];var _0x3ffb8d=_0x41eafd?0x0:_0x5e79d7[_0x852d('0x1d')];var _0x22a0c0=_0x41eafd?_0x4c3ac4[_0x852d('0x20')]:_0x5e79d7[_0x852d('0x1d')]+_0x5e79d7[_0x852d('0x1f')];var _0x436ad0;if(_0x22a0c0>=_0x51ac4c){_0x22a0c0=_0x51ac4c;_0x436ad0=0xc8;}else{_0x436ad0=0xce;}_0x5c6e12[_0x852d('0x1b')](_0x436ad0);return _0x5c6e12[_0x852d('0x21')](_0x852d('0x22'),_0x3ffb8d+'-'+_0x22a0c0+'/'+_0x51ac4c)['json'](_0x4c3ac4);}return null;};}function patchUpdates(_0x4ee529){return function(_0x1429d1){try{jsonpatch['apply'](_0x1429d1,_0x4ee529,!![]);}catch(_0x1cfdca){return BPromise[_0x852d('0x23')](_0x1cfdca);}return _0x1429d1['save']();};}function saveUpdates(_0x3701c0,_0x1ae3e7){return function(_0x2a6e5d){if(_0x2a6e5d){return _0x2a6e5d['update'](_0x3701c0)[_0x852d('0x24')](function(_0x19cf08){return _0x19cf08;});}return null;};}function removeEntity(_0x189a9e,_0x476489){return function(_0x34ccf4){if(_0x34ccf4){return _0x34ccf4[_0x852d('0x25')]()['then'](function(){_0x189a9e[_0x852d('0x1b')](0xcc)[_0x852d('0x26')]();});}};}function handleEntityNotFound(_0x384ea5,_0x231330){return function(_0x1d4173){if(!_0x1d4173){_0x384ea5[_0x852d('0x1a')](0x194);}return _0x1d4173;};}function handleError(_0x25cc26,_0x56fcaf){_0x56fcaf=_0x56fcaf||0x1f4;return function(_0x491c93){logger['error'](_0x491c93[_0x852d('0x27')]);if(_0x491c93[_0x852d('0x28')]){delete _0x491c93['name'];}_0x25cc26[_0x852d('0x1b')](_0x56fcaf)[_0x852d('0x29')](_0x491c93);};}exports[_0x852d('0x2a')]=function(_0x203a26,_0x43f78){var _0x1423ad={},_0xe23ad8={},_0x1cad35={'count':0x0,'rows':[]};var _0x224430=_[_0x852d('0x2b')](db[_0x852d('0x2c')][_0x852d('0x2d')],function(_0x5126d9){return{'name':_0x5126d9['fieldName'],'type':_0x5126d9[_0x852d('0x2e')][_0x852d('0x2f')]};});_0xe23ad8[_0x852d('0x30')]=_[_0x852d('0x2b')](_0x224430,_0x852d('0x28'));_0xe23ad8['query']=_[_0x852d('0x31')](_0x203a26['query']);_0xe23ad8[_0x852d('0x32')]=_['intersection'](_0xe23ad8[_0x852d('0x30')],_0xe23ad8[_0x852d('0x33')]);_0x1423ad['attributes']=_[_0x852d('0x34')](_0xe23ad8[_0x852d('0x30')],qs['fields'](_0x203a26[_0x852d('0x33')][_0x852d('0x35')]));_0x1423ad['attributes']=_0x1423ad[_0x852d('0x36')][_0x852d('0x37')]?_0x1423ad[_0x852d('0x36')]:_0xe23ad8[_0x852d('0x30')];if(!_0x203a26[_0x852d('0x33')][_0x852d('0x38')](_0x852d('0x39'))){_0x1423ad[_0x852d('0x1f')]=qs[_0x852d('0x1f')](_0x203a26[_0x852d('0x33')][_0x852d('0x1f')]);_0x1423ad['offset']=qs[_0x852d('0x1d')](_0x203a26[_0x852d('0x33')][_0x852d('0x1d')]);}_0x1423ad['order']=qs['sort'](_0x203a26[_0x852d('0x33')][_0x852d('0x3a')]);_0x1423ad[_0x852d('0x3b')]=qs['filters'](_[_0x852d('0x3c')](_0x203a26[_0x852d('0x33')],_0xe23ad8[_0x852d('0x32')]),_0x224430);if(_0x203a26[_0x852d('0x33')][_0x852d('0x3d')]){_0x1423ad[_0x852d('0x3b')]=_[_0x852d('0x3e')](_0x1423ad['where'],{'$or':_[_0x852d('0x2b')](_0x224430,function(_0x3d1483){if(_0x3d1483[_0x852d('0x2e')]!==_0x852d('0x3f')){var _0x4387c3={};_0x4387c3[_0x3d1483[_0x852d('0x28')]]={'$like':'%'+_0x203a26[_0x852d('0x33')][_0x852d('0x3d')]+'%'};return _0x4387c3;}})});}_0x1423ad=_['merge']({},_0x1423ad,_0x203a26[_0x852d('0x40')]);var _0x293c54={'where':_0x1423ad['where']};return db[_0x852d('0x2c')][_0x852d('0x20')](_0x293c54)[_0x852d('0x24')](function(_0x7f2001){_0x1cad35['count']=_0x7f2001;if(_0x203a26['query'][_0x852d('0x41')]){_0x1423ad['include']=[{'all':!![]}];}return db[_0x852d('0x2c')][_0x852d('0x42')](_0x1423ad);})[_0x852d('0x24')](function(_0x3e8102){_0x1cad35[_0x852d('0x43')]=_0x3e8102;return _0x1cad35;})['then'](respondWithFilteredResult(_0x43f78,_0x1423ad))[_0x852d('0x44')](handleError(_0x43f78,null));};exports[_0x852d('0x45')]=function(_0xfc6211,_0x1c0030){var _0x4e604d={'raw':!![],'where':{'id':_0xfc6211[_0x852d('0x46')]['id']}},_0x16f0da={};_0x16f0da['model']=_['keys'](db[_0x852d('0x2c')]['rawAttributes']);_0x16f0da[_0x852d('0x33')]=_['keys'](_0xfc6211[_0x852d('0x33')]);_0x16f0da[_0x852d('0x32')]=_[_0x852d('0x34')](_0x16f0da[_0x852d('0x30')],_0x16f0da[_0x852d('0x33')]);_0x4e604d[_0x852d('0x36')]=_[_0x852d('0x34')](_0x16f0da[_0x852d('0x30')],qs[_0x852d('0x35')](_0xfc6211[_0x852d('0x33')][_0x852d('0x35')]));_0x4e604d['attributes']=_0x4e604d['attributes']['length']?_0x4e604d['attributes']:_0x16f0da[_0x852d('0x30')];if(_0xfc6211['query'][_0x852d('0x41')]){_0x4e604d[_0x852d('0x47')]=[{'all':!![]}];}_0x4e604d=_[_0x852d('0x3e')]({},_0x4e604d,_0xfc6211['options']);return db[_0x852d('0x2c')][_0x852d('0x48')](_0x4e604d)['then'](handleEntityNotFound(_0x1c0030,null))[_0x852d('0x24')](respondWithResult(_0x1c0030,null))[_0x852d('0x44')](handleError(_0x1c0030,null));};exports['create']=function(_0x304c3e,_0xd94089){return db['CmHopperHistory'][_0x852d('0x49')](_0x304c3e[_0x852d('0x4a')],{})[_0x852d('0x24')](respondWithResult(_0xd94089,0xc9))[_0x852d('0x44')](handleError(_0xd94089,null));};exports[_0x852d('0x4b')]=function(_0x127707,_0x4db282){return db[_0x852d('0x2c')]['describe']()[_0x852d('0x24')](respondWithResult(_0x4db282,null))['catch'](handleError(_0x4db282,null));};exports[_0x852d('0x4c')]=function(_0x38af4b,_0x5a68b2){if(_0x38af4b[_0x852d('0x4a')]['uniqueid']){delete _0x38af4b[_0x852d('0x4a')][_0x852d('0x4d')];}return db[_0x852d('0x2c')][_0x852d('0x48')]({'where':{'uniqueid':_0x38af4b[_0x852d('0x46')]['id']}})['then'](handleEntityNotFound(_0x5a68b2,null))[_0x852d('0x24')](saveUpdates(_0x38af4b[_0x852d('0x4a')],null))['then'](respondWithResult(_0x5a68b2,null))[_0x852d('0x44')](handleError(_0x5a68b2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 1b03d79..b604a0b 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 _0xacf4=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4a10ee,_0x28bf0f){var _0x4885cd=function(_0x17abe5){while(--_0x17abe5){_0x4a10ee['push'](_0x4a10ee['shift']());}};_0x4885cd(++_0x28bf0f);}(_0xacf4,0xe7));var _0x4acf=function(_0x1ca5ae,_0x45fccb){_0x1ca5ae=_0x1ca5ae-0x0;var _0x172852=_0xacf4[_0x1ca5ae];return _0x172852;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));module[_0x4acf('0x8')]=function(_0x4e0c43,_0x24bf24){return _0x4e0c43[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'paranoid':![],'indexes':[{'name':_0x4acf('0xc'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x4acf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cb5=['rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4a310d,_0x33322d){var _0x5eaf36=function(_0x233014){while(--_0x233014){_0x4a310d['push'](_0x4a310d['shift']());}};_0x5eaf36(++_0x33322d);}(_0x4cb5,0x8f));var _0x54cb=function(_0x2230e2,_0x27393d){_0x2230e2=_0x2230e2-0x0;var _0x16ef4f=_0x4cb5[_0x2230e2];return _0x16ef4f;};'use strict';var _=require(_0x54cb('0x0'));var util=require(_0x54cb('0x1'));var logger=require(_0x54cb('0x2'))(_0x54cb('0x3'));var moment=require('moment');var BPromise=require(_0x54cb('0x4'));var rp=require(_0x54cb('0x5'));var fs=require('fs');var path=require(_0x54cb('0x6'));var rimraf=require(_0x54cb('0x7'));var config=require(_0x54cb('0x8'));var attributes=require(_0x54cb('0x9'));module[_0x54cb('0xa')]=function(_0x48aed1,_0x44f36d){return _0x48aed1[_0x54cb('0xb')]('CmHopperHistory',attributes,{'tableName':_0x54cb('0xc'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x54cb('0xd')]},{'name':_0x54cb('0xe'),'fields':[_0x54cb('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 62a98d3..7b86473 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 _0xa5fa=['CmHopperHistory,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code'];(function(_0xebcf62,_0x3c7a6c){var _0x408349=function(_0x249656){while(--_0x249656){_0xebcf62['push'](_0xebcf62['shift']());}};_0x408349(++_0x3c7a6c);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x279c80,_0x3c9692){_0x279c80=_0x279c80-0x0;var _0x4e1f5c=_0xa5fa[_0x279c80];return _0x4e1f5c;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')](_0x3d874f[_0xaa5f('0x19')],{'raw':_0x3d874f[_0xaa5f('0x1a')]?_0x3d874f[_0xaa5f('0x1a')][_0xaa5f('0x1b')]===undefined?!![]:![]:!![]})[_0xaa5f('0x1c')](function(_0x194691){logger[_0xaa5f('0xc')](_0xaa5f('0x16'),_0x3d874f);logger[_0xaa5f('0xd')](_0xaa5f('0x16'),_0x3d874f,JSON[_0xaa5f('0xe')](_0x194691));_0x1019e8(_0x194691);})['catch'](function(_0x1e917d){logger['error'](_0xaa5f('0x16'),_0x1e917d[_0xaa5f('0x12')],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x1e917d[_0xaa5f('0x12')]));});});};exports[_0xaa5f('0x1d')]=function(_0x5b9f0b){var _0xf6a8c3=this;return new Promise(function(_0x15f70b,_0x32cd16){return db[_0xaa5f('0x17')][_0xaa5f('0x1e')]({'raw':_0x5b9f0b[_0xaa5f('0x1a')]?_0x5b9f0b[_0xaa5f('0x1a')][_0xaa5f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b9f0b['options']?_0x5b9f0b[_0xaa5f('0x1a')][_0xaa5f('0x1f')]||null:null,'attributes':[[db[_0xaa5f('0x20')]['fn']('COUNT',db[_0xaa5f('0x20')][_0xaa5f('0x21')]('id')),_0xaa5f('0x22')],[db['sequelize']['fn'](_0xaa5f('0x23'),db['sequelize']['fn']('IF',db['sequelize'][_0xaa5f('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0xaa5f('0x25')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xaa5f('0x20')]['literal'](_0xaa5f('0x26')))),_0xaa5f('0x27')],[db['sequelize']['fn']('COUNT',db[_0xaa5f('0x20')]['fn']('IF',db['sequelize'][_0xaa5f('0x24')](_0xaa5f('0x28')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xaa5f('0x20')]['fn'](_0xaa5f('0x29'),db[_0xaa5f('0x20')]['fn']('IF',db['sequelize'][_0xaa5f('0x24')](_0xaa5f('0x2a')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0xaa5f('0x20')][_0xaa5f('0x24')](_0xaa5f('0x2b')))),_0xaa5f('0x2c')]]})[_0xaa5f('0x1c')](function(_0x3bcaf6){logger[_0xaa5f('0xc')]('AvgHandleTime',_0x5b9f0b);logger[_0xaa5f('0xd')](_0xaa5f('0x1d'),_0x5b9f0b,JSON[_0xaa5f('0xe')](_0x3bcaf6));_0x15f70b(_0x3bcaf6);})[_0xaa5f('0x15')](function(_0x3fd269){logger[_0xaa5f('0xf')]('AvgHandleTime',_0x3fd269[_0xaa5f('0x12')],_0x5b9f0b);_0x32cd16(_0xf6a8c3[_0xaa5f('0xf')](0x1f4,_0x3fd269[_0xaa5f('0x12')]));});});};exports[_0xaa5f('0x2d')]=function(_0x3dc2f5){var _0x56ac45=this;return new Promise(function(_0x4dd41a,_0x43126e){return db[_0xaa5f('0x17')][_0xaa5f('0x1e')]({'raw':_0x3dc2f5[_0xaa5f('0x1a')]?_0x3dc2f5['options'][_0xaa5f('0x1b')]===undefined?!![]:![]:!![],'where':_0x3dc2f5[_0xaa5f('0x1a')]?_0x3dc2f5[_0xaa5f('0x1a')][_0xaa5f('0x1f')]||null:null,'attributes':[[_0xaa5f('0x2e'),_0xaa5f('0x2f')],[db[_0xaa5f('0x20')]['fn'](_0xaa5f('0x23'),db[_0xaa5f('0x20')]['fn']('IF',db[_0xaa5f('0x20')][_0xaa5f('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0xaa5f('0x30')],[db[_0xaa5f('0x20')]['fn'](_0xaa5f('0x23'),db[_0xaa5f('0x20')]['fn']('IF',db[_0xaa5f('0x20')][_0xaa5f('0x24')](_0xaa5f('0x31')))),_0xaa5f('0x32')],[db[_0xaa5f('0x20')]['fn'](_0xaa5f('0x23'),db['sequelize']['fn']('IF',db[_0xaa5f('0x20')]['literal'](_0xaa5f('0x33')))),_0xaa5f('0x34')],[db[_0xaa5f('0x20')]['fn']('COUNT',db[_0xaa5f('0x20')]['fn']('IF',db[_0xaa5f('0x20')][_0xaa5f('0x24')]('`state`\x20=\x205,\x201,\x20null'))),_0xaa5f('0x35')],[db[_0xaa5f('0x20')]['fn'](_0xaa5f('0x23'),db[_0xaa5f('0x20')]['fn']('IF',db['sequelize'][_0xaa5f('0x24')](_0xaa5f('0x36')))),_0xaa5f('0x37')],[db[_0xaa5f('0x20')]['fn'](_0xaa5f('0x23'),db[_0xaa5f('0x20')]['fn']('IF',db[_0xaa5f('0x20')][_0xaa5f('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xaa5f('0x38')],[db['sequelize']['fn'](_0xaa5f('0x23'),db['sequelize']['fn']('IF',db[_0xaa5f('0x20')][_0xaa5f('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xaa5f('0x39')],[db[_0xaa5f('0x20')]['fn'](_0xaa5f('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xaa5f('0x3a')))),'outboundUnknownCallsDay'],[db[_0xaa5f('0x20')]['fn'](_0xaa5f('0x23'),db[_0xaa5f('0x20')]['fn']('IF',db[_0xaa5f('0x20')]['literal'](_0xaa5f('0x3b')))),_0xaa5f('0x3c')],[db[_0xaa5f('0x20')]['fn'](_0xaa5f('0x23'),db[_0xaa5f('0x20')]['fn']('IF',db[_0xaa5f('0x20')][_0xaa5f('0x24')](_0xaa5f('0x3d')))),_0xaa5f('0x3e')],[db[_0xaa5f('0x20')]['fn'](_0xaa5f('0x23'),db[_0xaa5f('0x20')]['fn']('IF',db[_0xaa5f('0x20')][_0xaa5f('0x24')](_0xaa5f('0x3f')))),_0xaa5f('0x40')],[db['sequelize']['fn'](_0xaa5f('0x23'),db[_0xaa5f('0x20')]['fn']('IF',db[_0xaa5f('0x20')][_0xaa5f('0x24')](_0xaa5f('0x41')))),_0xaa5f('0x42')],[db[_0xaa5f('0x20')]['fn']('COUNT',db[_0xaa5f('0x20')]['fn']('IF',db[_0xaa5f('0x20')][_0xaa5f('0x24')](_0xaa5f('0x43')))),'outboundRejectCallsDay'],[db[_0xaa5f('0x20')]['fn'](_0xaa5f('0x23'),db[_0xaa5f('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':['campaign']})['then'](function(_0x1f47a0){logger[_0xaa5f('0xc')](_0xaa5f('0x2d'),_0x3dc2f5);logger[_0xaa5f('0xd')](_0xaa5f('0x2d'),_0x3dc2f5,JSON[_0xaa5f('0xe')](_0x1f47a0));_0x4dd41a(_0x1f47a0);})['catch'](function(_0x584a3d){logger[_0xaa5f('0xf')](_0xaa5f('0x2d'),_0x584a3d['message'],_0x3dc2f5);_0x43126e(_0x56ac45[_0xaa5f('0xf')](0x1f4,_0x584a3d[_0xaa5f('0x12')]));});});};exports[_0xaa5f('0x44')]=function(_0x294657){var _0x469875=this;return new Promise(function(_0x3db842,_0x3aff09){return db['CmHopperHistory']['findAll']({'raw':_0x294657[_0xaa5f('0x1a')]?_0x294657[_0xaa5f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x294657['options']?_0x294657['options'][_0xaa5f('0x1f')]||null:null,'attributes':[['campaign',_0xaa5f('0x2f')],[db['sequelize']['fn']('COUNT',db[_0xaa5f('0x20')][_0xaa5f('0x21')]('id')),_0xaa5f('0x45')],[db['sequelize']['fn'](_0xaa5f('0x23'),db[_0xaa5f('0x20')]['fn']('IF',db[_0xaa5f('0x20')]['literal'](_0xaa5f('0x33')))),_0xaa5f('0x46')]],'group':['campaign']})[_0xaa5f('0x1c')](function(_0x2b2300){logger[_0xaa5f('0xc')](_0xaa5f('0x44'),_0x294657);logger[_0xaa5f('0xd')](_0xaa5f('0x44'),_0x294657,JSON[_0xaa5f('0xe')](_0x2b2300));_0x3db842(_0x2b2300);})[_0xaa5f('0x15')](function(_0x45efcb){logger['error'](_0xaa5f('0x44'),_0x45efcb[_0xaa5f('0x12')],_0x294657);_0x3aff09(_0x469875[_0xaa5f('0xf')](0x1f4,_0x45efcb[_0xaa5f('0x12')]));});});}; \ No newline at end of file +var _0x24fe=['col','ivrTotalCallsDays','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateCmHopperHistory','create','body','options','raw','stringify','where','sequelize','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','COUNT','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','AvgHandleTime','CmHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','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=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name'];(function(_0x23b70b,_0x1b6e9e){var _0x546fb3=function(_0xb1bb7b){while(--_0xb1bb7b){_0x23b70b['push'](_0x23b70b['shift']());}};_0x546fb3(++_0x1b6e9e);}(_0x24fe,0x1b8));var _0xe24f=function(_0x431d4c,_0x19490a){_0x431d4c=_0x431d4c-0x0;var _0x411f02=_0x24fe[_0x431d4c];return _0x411f02;};'use strict';var _=require(_0xe24f('0x0'));var util=require('util');var moment=require(_0xe24f('0x1'));var BPromise=require(_0xe24f('0x2'));var rs=require(_0xe24f('0x3'));var fs=require('fs');var Redis=require(_0xe24f('0x4'));var db=require(_0xe24f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe24f('0x6'))(_0xe24f('0x7'));var config=require('../../config/environment');var jayson=require(_0xe24f('0x8'));var client=jayson[_0xe24f('0x9')][_0xe24f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dff78,_0x24627c,_0x27e3ad){return new BPromise(function(_0x39c377,_0x960ffa){return client[_0xe24f('0xb')](_0x1dff78,_0x27e3ad)[_0xe24f('0xc')](function(_0x1ca824){logger['info'](_0xe24f('0xd'),_0x24627c,_0xe24f('0xe'));logger['debug'](_0xe24f('0xf'),_0x24627c,_0xe24f('0xe'),JSON['stringify'](_0x1ca824));if(_0x1ca824['error']){if(_0x1ca824[_0xe24f('0x10')][_0xe24f('0x11')]===0x1f4){logger[_0xe24f('0x10')](_0xe24f('0xd'),_0x24627c,_0x1ca824[_0xe24f('0x10')][_0xe24f('0x12')]);return _0x960ffa(_0x1ca824[_0xe24f('0x10')][_0xe24f('0x12')]);}logger[_0xe24f('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x24627c,_0x1ca824['error'][_0xe24f('0x12')]);return _0x39c377(_0x1ca824[_0xe24f('0x10')]['message']);}else{logger[_0xe24f('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x24627c,_0xe24f('0xe'));_0x39c377(_0x1ca824[_0xe24f('0x14')][_0xe24f('0x12')]);}})[_0xe24f('0x15')](function(_0x5e3d3f){logger[_0xe24f('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x24627c,_0x5e3d3f);_0x960ffa(_0x5e3d3f);});});}exports[_0xe24f('0x16')]=function(_0x1f7273){var _0x1a7c6a=this;return new Promise(function(_0x562478,_0x2150c0){return db['CmHopperHistory'][_0xe24f('0x17')](_0x1f7273[_0xe24f('0x18')],{'raw':_0x1f7273[_0xe24f('0x19')]?_0x1f7273[_0xe24f('0x19')][_0xe24f('0x1a')]===undefined?!![]:![]:!![]})[_0xe24f('0xc')](function(_0x1baa45){logger['info'](_0xe24f('0x16'),_0x1f7273);logger['debug']('CreateCmHopperHistory',_0x1f7273,JSON[_0xe24f('0x1b')](_0x1baa45));_0x562478(_0x1baa45);})[_0xe24f('0x15')](function(_0x5c5f5c){logger[_0xe24f('0x10')](_0xe24f('0x16'),_0x5c5f5c[_0xe24f('0x12')],_0x1f7273);_0x2150c0(_0x1a7c6a[_0xe24f('0x10')](0x1f4,_0x5c5f5c[_0xe24f('0x12')]));});});};exports['AvgHandleTime']=function(_0x5d09e4){var _0x1e458b=this;return new Promise(function(_0x26c15e,_0x47e62e){return db['CmHopperHistory']['findAll']({'raw':_0x5d09e4['options']?_0x5d09e4['options'][_0xe24f('0x1a')]===undefined?!![]:![]:!![],'where':_0x5d09e4[_0xe24f('0x19')]?_0x5d09e4['options'][_0xe24f('0x1c')]||null:null,'attributes':[[db[_0xe24f('0x1d')]['fn']('COUNT',db[_0xe24f('0x1d')]['col']('id')),_0xe24f('0x1e')],[db[_0xe24f('0x1d')]['fn']('COUNT',db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x20')))),_0xe24f('0x21')],[db[_0xe24f('0x1d')]['fn']('COUNT',db[_0xe24f('0x1d')]['fn']('IF',db['sequelize'][_0xe24f('0x1f')](_0xe24f('0x22')))),_0xe24f('0x23')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db['sequelize']['fn']('IF',db[_0xe24f('0x1d')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xe24f('0x1d')]['fn']('AVG',db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')]['literal'](_0xe24f('0x25')))),_0xe24f('0x26')],[db[_0xe24f('0x1d')]['fn']('AVG',db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')]['literal'](_0xe24f('0x27')))),_0xe24f('0x28')]]})[_0xe24f('0xc')](function(_0xeb8d8b){logger[_0xe24f('0x13')]('AvgHandleTime',_0x5d09e4);logger[_0xe24f('0x29')](_0xe24f('0x2a'),_0x5d09e4,JSON[_0xe24f('0x1b')](_0xeb8d8b));_0x26c15e(_0xeb8d8b);})[_0xe24f('0x15')](function(_0x29911c){logger[_0xe24f('0x10')](_0xe24f('0x2a'),_0x29911c[_0xe24f('0x12')],_0x5d09e4);_0x47e62e(_0x1e458b[_0xe24f('0x10')](0x1f4,_0x29911c['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4c9e11){var _0x4c6d26=this;return new Promise(function(_0x2ad868,_0x2d39c3){return db[_0xe24f('0x2b')][_0xe24f('0x2c')]({'raw':_0x4c9e11[_0xe24f('0x19')]?_0x4c9e11['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c9e11[_0xe24f('0x19')]?_0x4c9e11[_0xe24f('0x19')][_0xe24f('0x1c')]||null:null,'attributes':[[_0xe24f('0x2d'),'name'],[db['sequelize']['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x2e')))),_0xe24f('0x2f')],[db['sequelize']['fn']('COUNT',db[_0xe24f('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xe24f('0x30')))),_0xe24f('0x31')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x20')))),_0xe24f('0x32')],[db[_0xe24f('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe24f('0x1d')]['literal'](_0xe24f('0x33')))),_0xe24f('0x34')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x35')))),_0xe24f('0x36')],[db['sequelize']['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xe24f('0x37')))),'outboundDropCallsDayTimeout'],[db[_0xe24f('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x38')))),_0xe24f('0x39')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db['sequelize']['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x3a')))),_0xe24f('0x3b')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x3c')))),_0xe24f('0x3d')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')](_0xe24f('0x3e')))),_0xe24f('0x3f')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0xe24f('0x24'),db[_0xe24f('0x1d')]['fn']('IF',db[_0xe24f('0x1d')][_0xe24f('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),_0xe24f('0x40')],[db[_0xe24f('0x1d')]['fn'](_0xe24f('0x24'),db['sequelize']['fn']('IF',db[_0xe24f('0x1d')]['literal'](_0xe24f('0x41')))),'outboundRejectCallsDay'],[db[_0xe24f('0x1d')]['fn']('COUNT',db[_0xe24f('0x1d')]['fn']('IF',db['sequelize'][_0xe24f('0x1f')](_0xe24f('0x42')))),_0xe24f('0x43')]],'group':[_0xe24f('0x2d')]})['then'](function(_0x15c50e){logger[_0xe24f('0x13')](_0xe24f('0x44'),_0x4c9e11);logger[_0xe24f('0x29')]('GetVoiceQueueHopperHistory',_0x4c9e11,JSON[_0xe24f('0x1b')](_0x15c50e));_0x2ad868(_0x15c50e);})[_0xe24f('0x15')](function(_0x1e493a){logger[_0xe24f('0x10')](_0xe24f('0x44'),_0x1e493a['message'],_0x4c9e11);_0x2d39c3(_0x4c6d26['error'](0x1f4,_0x1e493a[_0xe24f('0x12')]));});});};exports[_0xe24f('0x45')]=function(_0x1e1f6a){var _0x44816e=this;return new Promise(function(_0x57b6bc,_0x325da2){return db['CmHopperHistory']['findAll']({'raw':_0x1e1f6a[_0xe24f('0x19')]?_0x1e1f6a[_0xe24f('0x19')][_0xe24f('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e1f6a['options']?_0x1e1f6a[_0xe24f('0x19')][_0xe24f('0x1c')]||null:null,'attributes':[[_0xe24f('0x2d'),_0xe24f('0x46')],[db['sequelize']['fn'](_0xe24f('0x24'),db['sequelize'][_0xe24f('0x47')]('id')),_0xe24f('0x48')],[db[_0xe24f('0x1d')]['fn']('COUNT',db[_0xe24f('0x1d')]['fn']('IF',db['sequelize'][_0xe24f('0x1f')](_0xe24f('0x20')))),'ivrAnswerCallsDay']],'group':[_0xe24f('0x2d')]})[_0xe24f('0xc')](function(_0x56911a){logger['info']('GetCampaignHopperHistory',_0x1e1f6a);logger['debug'](_0xe24f('0x45'),_0x1e1f6a,JSON['stringify'](_0x56911a));_0x57b6bc(_0x56911a);})['catch'](function(_0x3e6b80){logger[_0xe24f('0x10')](_0xe24f('0x45'),_0x3e6b80[_0xe24f('0x12')],_0x1e1f6a);_0x325da2(_0x44816e['error'](0x1f4,_0x3e6b80[_0xe24f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0ed9831..dc6b87e 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 _0x0651=['isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x12042a,_0x3477eb){var _0x408051=function(_0xca848b){while(--_0xca848b){_0x12042a['push'](_0x12042a['shift']());}};_0x408051(++_0x3477eb);}(_0x0651,0xbf));var _0x1065=function(_0x976129,_0x460466){_0x976129=_0x976129-0x0;var _0x5beee1=_0x0651[_0x976129];return _0x5beee1;};'use strict';var multer=require(_0x1065('0x0'));var util=require(_0x1065('0x1'));var path=require(_0x1065('0x2'));var timeout=require('connect-timeout');var express=require(_0x1065('0x3'));var router=express[_0x1065('0x4')]();var fs_extra=require(_0x1065('0x5'));var auth=require(_0x1065('0x6'));var interaction=require(_0x1065('0x7'));var config=require(_0x1065('0x8'));var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x1065('0x9')](),controller[_0x1065('0xa')]);router[_0x1065('0xb')](_0x1065('0xc'),auth[_0x1065('0x9')](),controller[_0x1065('0xd')]);router[_0x1065('0xb')](_0x1065('0xe'),auth[_0x1065('0x9')](),controller[_0x1065('0xf')]);router[_0x1065('0x10')]('/',auth[_0x1065('0x9')](),controller[_0x1065('0x11')]);router[_0x1065('0x12')](_0x1065('0xe'),auth[_0x1065('0x9')](),controller[_0x1065('0x13')]);module['exports']=router; \ No newline at end of file +var _0x3935=['express','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','/:id','show','create','update','multer','util','connect-timeout'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x3935,0x66));var _0x5393=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0x3935[_0x539533];return _0x3942f3;};'use strict';var multer=require(_0x5393('0x0'));var util=require(_0x5393('0x1'));var path=require('path');var timeout=require(_0x5393('0x2'));var express=require(_0x5393('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5393('0x4'));var config=require(_0x5393('0x5'));var controller=require(_0x5393('0x6'));router[_0x5393('0x7')]('/',auth[_0x5393('0x8')](),controller['index']);router[_0x5393('0x7')](_0x5393('0x9'),auth['isAuthenticated'](),controller[_0x5393('0xa')]);router[_0x5393('0x7')](_0x5393('0xb'),auth['isAuthenticated'](),controller[_0x5393('0xc')]);router['post']('/',auth[_0x5393('0x8')](),controller[_0x5393('0xd')]);router['put'](_0x5393('0xb'),auth[_0x5393('0x8')](),controller[_0x5393('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c421a15..9c634f1 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 _0x2e8a=['STRING','exports'];(function(_0x35e92e,_0x21581b){var _0x1205a8=function(_0x4325d8){while(--_0x4325d8){_0x35e92e['push'](_0x35e92e['shift']());}};_0x1205a8(++_0x21581b);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x511e82,_0x5c8e7b){_0x511e82=_0x511e82-0x0;var _0x32bc8e=_0x2e8a[_0x511e82];return _0x32bc8e;};'use strict';var Sequelize=require('sequelize');module[_0xa2e8('0x0')]={'name':{'type':Sequelize[_0xa2e8('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa2e8('0x1')]},'dialPrefix':{'type':Sequelize[_0xa2e8('0x1')]}}; \ No newline at end of file +var _0xdefc=['sequelize','exports','STRING'];(function(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_0xdefc,0x1b3));var _0xcdef=function(_0x503699,_0x152145){_0x503699=_0x503699-0x0;var _0xd66c82=_0xdefc[_0x503699];return _0xd66c82;};'use strict';var Sequelize=require(_0xcdef('0x0'));module[_0xcdef('0x1')]={'name':{'type':Sequelize[_0xcdef('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0xcdef('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index eec029f..584c208 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 _0x72f5=['count','set','Content-Range','apply','reject','save','update','then','destroy','get','Lists','name','send','index','map','CmList','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','catch','body','describe','ListId','Disposition','getDispositions','findOne','removeDispositions','addContacts','tags','join','CmContact','omit','success','push','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','c.ListId\x20=\x20?','distinct','customField_','alias','select','item','from','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','field','description','toString','each','now','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','BOOLEAN','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','ids','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','User','info','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x72f5,0x80));var _0x572f=function(_0x216c14,_0x573f53){_0x216c14=_0x216c14-0x0;var _0x2c4383=_0x72f5[_0x216c14];return _0x2c4383;};'use strict';var emlformat=require(_0x572f('0x0'));var rimraf=require(_0x572f('0x1'));var zipdir=require(_0x572f('0x2'));var jsonpatch=require(_0x572f('0x3'));var rp=require(_0x572f('0x4'));var moment=require(_0x572f('0x5'));var BPromise=require(_0x572f('0x6'));var Mustache=require(_0x572f('0x7'));var util=require('util');var path=require(_0x572f('0x8'));var sox=require(_0x572f('0x9'));var csv=require(_0x572f('0xa'));var ejs=require(_0x572f('0xb'));var fs=require('fs');var fs_extra=require(_0x572f('0xc'));var _=require(_0x572f('0xd'));var squel=require('squel');var crypto=require(_0x572f('0xe'));var jsforce=require(_0x572f('0xf'));var deskjs=require(_0x572f('0x10'));var toCsv=require(_0x572f('0xa'));var querystring=require(_0x572f('0x11'));var Papa=require(_0x572f('0x12'));var Redis=require(_0x572f('0x13'));var authService=require(_0x572f('0x14'));var qs=require(_0x572f('0x15'));var as=require(_0x572f('0x16'));var hardwareService=require(_0x572f('0x17'));var logger=require(_0x572f('0x18'))('api');var utils=require(_0x572f('0x19'));var config=require(_0x572f('0x1a'));var licenseUtil=require(_0x572f('0x1b'));var db=require(_0x572f('0x1c'))['db'];var csv_results;config[_0x572f('0x1d')]=_[_0x572f('0x1e')](config[_0x572f('0x1d')],{'host':_0x572f('0x1f'),'port':0x18eb});var socket=require(_0x572f('0x20'))(new Redis(config[_0x572f('0x1d')]));require(_0x572f('0x21'))[_0x572f('0x22')](socket);function respondWithStatusCode(_0x27e4e4,_0x254003){_0x254003=_0x254003||0xcc;return function(_0x12ed27){if(_0x12ed27){return _0x27e4e4[_0x572f('0x23')](_0x254003);}return _0x27e4e4[_0x572f('0x24')](_0x254003)[_0x572f('0x25')]();};}function respondWithResult(_0x300f13,_0x4decbb){_0x4decbb=_0x4decbb||0xc8;return function(_0x553a7c){if(_0x553a7c){return _0x300f13[_0x572f('0x24')](_0x4decbb)[_0x572f('0x26')](_0x553a7c);}};}function respondWithFilteredResult(_0x2caaab,_0x1aa058){return function(_0x2fc8bd){if(_0x2fc8bd){var _0x3616f5=typeof _0x1aa058[_0x572f('0x27')]===_0x572f('0x28')&&typeof _0x1aa058[_0x572f('0x29')]===_0x572f('0x28');var _0x390acc=_0x2fc8bd['count'];var _0x304ff7=_0x3616f5?0x0:_0x1aa058[_0x572f('0x27')];var _0x4e587e=_0x3616f5?_0x2fc8bd[_0x572f('0x2a')]:_0x1aa058[_0x572f('0x27')]+_0x1aa058[_0x572f('0x29')];var _0x3e4ee5;if(_0x4e587e>=_0x390acc){_0x4e587e=_0x390acc;_0x3e4ee5=0xc8;}else{_0x3e4ee5=0xce;}_0x2caaab[_0x572f('0x24')](_0x3e4ee5);return _0x2caaab[_0x572f('0x2b')](_0x572f('0x2c'),_0x304ff7+'-'+_0x4e587e+'/'+_0x390acc)[_0x572f('0x26')](_0x2fc8bd);}return null;};}function patchUpdates(_0x921827){return function(_0x6b808c){try{jsonpatch[_0x572f('0x2d')](_0x6b808c,_0x921827,!![]);}catch(_0x342c28){return BPromise[_0x572f('0x2e')](_0x342c28);}return _0x6b808c[_0x572f('0x2f')]();};}function saveUpdates(_0x3989c8,_0x9ad304){return function(_0x574025){if(_0x574025){return _0x574025[_0x572f('0x30')](_0x3989c8)[_0x572f('0x31')](function(_0x4d41c9){return _0x4d41c9;});}return null;};}function removeEntity(_0x5c033a,_0x1e6975){return function(_0x57c5d0){if(_0x57c5d0){return _0x57c5d0[_0x572f('0x32')]()[_0x572f('0x31')](function(){var _0x1e6850=_0x57c5d0[_0x572f('0x33')]({'plain':!![]});var _0x57f87b=_0x572f('0x34');return db['UserProfileResource'][_0x572f('0x32')]({'where':{'type':_0x57f87b,'resourceId':_0x1e6850['id']}})[_0x572f('0x31')](function(){return _0x57c5d0;});})[_0x572f('0x31')](function(){_0x5c033a[_0x572f('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5df913,_0x492dfc){return function(_0x18569c){if(!_0x18569c){_0x5df913[_0x572f('0x23')](0x194);}return _0x18569c;};}function handleError(_0x52612f,_0x7d3b6e){_0x7d3b6e=_0x7d3b6e||0x1f4;return function(_0x1490a9){logger['error'](_0x1490a9['stack']);if(_0x1490a9[_0x572f('0x35')]){delete _0x1490a9[_0x572f('0x35')];}_0x52612f[_0x572f('0x24')](_0x7d3b6e)[_0x572f('0x36')](_0x1490a9);};}exports[_0x572f('0x37')]=function(_0x3b0857,_0x5a603f){var _0x18da53={},_0x12c256={},_0x555b8c={'count':0x0,'rows':[]};var _0x494457=_[_0x572f('0x38')](db[_0x572f('0x39')][_0x572f('0x3a')],function(_0x4e477b){return{'name':_0x4e477b[_0x572f('0x3b')],'type':_0x4e477b['type'][_0x572f('0x3c')]};});_0x12c256['model']=_[_0x572f('0x38')](_0x494457,_0x572f('0x35'));_0x12c256['query']=_[_0x572f('0x3d')](_0x3b0857[_0x572f('0x3e')]);_0x12c256[_0x572f('0x3f')]=_[_0x572f('0x40')](_0x12c256['model'],_0x12c256[_0x572f('0x3e')]);_0x18da53[_0x572f('0x41')]=_[_0x572f('0x40')](_0x12c256[_0x572f('0x42')],qs[_0x572f('0x43')](_0x3b0857[_0x572f('0x3e')][_0x572f('0x43')]));_0x18da53[_0x572f('0x41')]=_0x18da53[_0x572f('0x41')][_0x572f('0x44')]?_0x18da53[_0x572f('0x41')]:_0x12c256[_0x572f('0x42')];if(!_0x3b0857[_0x572f('0x3e')][_0x572f('0x45')](_0x572f('0x46'))){_0x18da53[_0x572f('0x29')]=qs[_0x572f('0x29')](_0x3b0857[_0x572f('0x3e')][_0x572f('0x29')]);_0x18da53[_0x572f('0x27')]=qs[_0x572f('0x27')](_0x3b0857[_0x572f('0x3e')]['offset']);}_0x18da53[_0x572f('0x47')]=qs[_0x572f('0x48')](_0x3b0857[_0x572f('0x3e')]['sort']);_0x18da53[_0x572f('0x49')]=qs[_0x572f('0x3f')](_[_0x572f('0x4a')](_0x3b0857[_0x572f('0x3e')],_0x12c256[_0x572f('0x3f')]),_0x494457);if(_0x3b0857[_0x572f('0x3e')][_0x572f('0x4b')]){_0x18da53[_0x572f('0x49')]=_[_0x572f('0x4c')](_0x18da53[_0x572f('0x49')],{'$or':_['map'](_0x494457,function(_0x41716c){if(_0x41716c[_0x572f('0x4d')]!==_0x572f('0x4e')){var _0x27fa71={};_0x27fa71[_0x41716c[_0x572f('0x35')]]={'$like':'%'+_0x3b0857[_0x572f('0x3e')][_0x572f('0x4b')]+'%'};return _0x27fa71;}})});}_0x18da53=_[_0x572f('0x4c')]({},_0x18da53,_0x3b0857['options']);var _0x1ee3c0={'where':_0x18da53[_0x572f('0x49')]};return db['CmList'][_0x572f('0x2a')](_0x1ee3c0)[_0x572f('0x31')](function(_0x2b3eff){_0x555b8c['count']=_0x2b3eff;if(_0x3b0857[_0x572f('0x3e')][_0x572f('0x4f')]){_0x18da53[_0x572f('0x50')]=[{'all':!![]}];}return db[_0x572f('0x39')][_0x572f('0x51')](_0x18da53);})[_0x572f('0x31')](function(_0x303fdd){_0x555b8c[_0x572f('0x52')]=_0x303fdd;return _0x555b8c;})[_0x572f('0x31')](respondWithFilteredResult(_0x5a603f,_0x18da53))['catch'](handleError(_0x5a603f,null));};exports[_0x572f('0x53')]=function(_0x58bf7a,_0x37c07e){var _0x2604f7={'raw':![],'where':{'id':_0x58bf7a[_0x572f('0x54')]['id']}},_0x2274ef={};_0x2274ef['model']=_['keys'](db[_0x572f('0x39')][_0x572f('0x3a')]);_0x2274ef[_0x572f('0x3e')]=_[_0x572f('0x3d')](_0x58bf7a[_0x572f('0x3e')]);_0x2274ef[_0x572f('0x3f')]=_[_0x572f('0x40')](_0x2274ef[_0x572f('0x42')],_0x2274ef[_0x572f('0x3e')]);_0x2604f7['attributes']=_[_0x572f('0x40')](_0x2274ef[_0x572f('0x42')],qs[_0x572f('0x43')](_0x58bf7a[_0x572f('0x3e')][_0x572f('0x43')]));_0x2604f7[_0x572f('0x41')]=_0x2604f7['attributes']['length']?_0x2604f7[_0x572f('0x41')]:_0x2274ef[_0x572f('0x42')];if(_0x58bf7a['query']['includeAll']){_0x2604f7['include']=[{'all':!![]}];}_0x2604f7=_[_0x572f('0x4c')]({},_0x2604f7,_0x58bf7a[_0x572f('0x55')]);return db[_0x572f('0x39')][_0x572f('0x56')](_0x2604f7)[_0x572f('0x31')](handleEntityNotFound(_0x37c07e,null))[_0x572f('0x31')](respondWithResult(_0x37c07e,null))['catch'](handleError(_0x37c07e,null));};exports[_0x572f('0x57')]=function(_0xcbd214,_0xa5dea7){return db[_0x572f('0x39')][_0x572f('0x57')](_0xcbd214['body'],{})[_0x572f('0x31')](function(_0x401239){var _0x54aae1=_0xcbd214[_0x572f('0x58')]['get']({'plain':!![]});if(!_0x54aae1)throw new Error(_0x572f('0x59'));if(_0x54aae1['role']==='user'){var _0x445da9=_0x401239[_0x572f('0x33')]({'plain':!![]});var _0x1f03ea=_0x572f('0x34');return db['UserProfileSection'][_0x572f('0x56')]({'where':{'name':_0x1f03ea,'userProfileId':_0x54aae1[_0x572f('0x5a')]},'raw':!![]})[_0x572f('0x31')](function(_0x38594d){if(_0x38594d&&_0x38594d[_0x572f('0x5b')]===0x0){return db[_0x572f('0x5c')][_0x572f('0x57')]({'name':_0x445da9[_0x572f('0x35')],'resourceId':_0x445da9['id'],'type':_0x38594d[_0x572f('0x35')],'sectionId':_0x38594d['id']},{})[_0x572f('0x31')](function(){return _0x401239;});}else{return _0x401239;}})[_0x572f('0x5d')](function(_0x3b35c4){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b35c4);throw _0x3b35c4;});}return _0x401239;})['then'](respondWithResult(_0xa5dea7,0xc9))[_0x572f('0x5d')](handleError(_0xa5dea7,null));};exports[_0x572f('0x30')]=function(_0x4d4070,_0x47d0b1){if(_0x4d4070[_0x572f('0x5e')]['id']){delete _0x4d4070[_0x572f('0x5e')]['id'];}return db[_0x572f('0x39')]['find']({'where':{'id':_0x4d4070[_0x572f('0x54')]['id']}})[_0x572f('0x31')](handleEntityNotFound(_0x47d0b1,null))[_0x572f('0x31')](saveUpdates(_0x4d4070[_0x572f('0x5e')],null))[_0x572f('0x31')](respondWithResult(_0x47d0b1,null))[_0x572f('0x5d')](handleError(_0x47d0b1,null));};exports['destroy']=function(_0x34ded8,_0xdc3ce2){return db[_0x572f('0x39')][_0x572f('0x56')]({'where':{'id':_0x34ded8[_0x572f('0x54')]['id']}})[_0x572f('0x31')](handleEntityNotFound(_0xdc3ce2,null))[_0x572f('0x31')](removeEntity(_0xdc3ce2,null))[_0x572f('0x5d')](handleError(_0xdc3ce2,null));};exports[_0x572f('0x5f')]=function(_0x21e60f,_0x7f1110){return db['CmList'][_0x572f('0x5f')]()['then'](respondWithResult(_0x7f1110,null))[_0x572f('0x5d')](handleError(_0x7f1110,null));};exports['addDisposition']=function(_0x39fec0,_0xc91e4b,_0x4d44a4){if(_0x39fec0[_0x572f('0x5e')]['id']){delete _0x39fec0[_0x572f('0x5e')]['id'];}return db[_0x572f('0x39')]['find']({'where':{'id':_0x39fec0[_0x572f('0x54')]['id']}})[_0x572f('0x31')](handleEntityNotFound(_0xc91e4b,null))[_0x572f('0x31')](function(_0x1071c1){if(_0x1071c1){_0x39fec0[_0x572f('0x5e')][_0x572f('0x60')]=_0x1071c1['id'];return db[_0x572f('0x61')][_0x572f('0x57')](_0x39fec0[_0x572f('0x5e')]);}})[_0x572f('0x31')](respondWithResult(_0xc91e4b,null))[_0x572f('0x5d')](handleError(_0xc91e4b,null));};exports[_0x572f('0x62')]=function(_0x566ba7,_0x1b1bb9,_0x341317){var _0x2216df={'raw':![],'where':{}};var _0x1894ab={};var _0x15ca4a={'count':0x0,'rows':[]};return db[_0x572f('0x39')][_0x572f('0x63')]({'where':{'id':_0x566ba7[_0x572f('0x54')]['id']}})[_0x572f('0x31')](handleEntityNotFound(_0x1b1bb9,null))[_0x572f('0x31')](function(_0x2c0f68){if(_0x2c0f68){_0x1894ab['model']=_[_0x572f('0x3d')](db[_0x572f('0x61')][_0x572f('0x3a')]);_0x1894ab['query']=_[_0x572f('0x3d')](_0x566ba7[_0x572f('0x3e')]);_0x1894ab[_0x572f('0x3f')]=_['intersection'](_0x1894ab[_0x572f('0x42')],_0x1894ab['query']);_0x2216df[_0x572f('0x41')]=_[_0x572f('0x40')](_0x1894ab[_0x572f('0x42')],qs[_0x572f('0x43')](_0x566ba7['query'][_0x572f('0x43')]));_0x2216df[_0x572f('0x41')]=_0x2216df[_0x572f('0x41')][_0x572f('0x44')]?_0x2216df['attributes']:_0x1894ab['model'];if(!_0x566ba7[_0x572f('0x3e')][_0x572f('0x45')](_0x572f('0x46'))){_0x2216df[_0x572f('0x29')]=qs[_0x572f('0x29')](_0x566ba7['query'][_0x572f('0x29')]);_0x2216df[_0x572f('0x27')]=qs[_0x572f('0x27')](_0x566ba7['query'][_0x572f('0x27')]);}_0x2216df[_0x572f('0x47')]=qs['sort'](_0x566ba7['query'][_0x572f('0x48')]);_0x2216df['where']=qs[_0x572f('0x3f')](_[_0x572f('0x4a')](_0x566ba7[_0x572f('0x3e')],_0x1894ab[_0x572f('0x3f')]));_0x2216df['where'][_0x572f('0x60')]=_0x2c0f68['id'];if(_0x566ba7[_0x572f('0x3e')][_0x572f('0x4b')]){_0x2216df[_0x572f('0x49')]=_[_0x572f('0x4c')](_0x2216df['where'],{'$or':_[_0x572f('0x38')](_0x2216df[_0x572f('0x41')],function(_0x3ae42c){var _0x1536e2={};_0x1536e2[_0x3ae42c]={'$like':'%'+_0x566ba7['query'][_0x572f('0x4b')]+'%'};return _0x1536e2;})});}_0x2216df=_['merge']({},_0x2216df,_0x566ba7['options']);return db[_0x572f('0x61')][_0x572f('0x2a')]({'where':_0x2216df[_0x572f('0x49')]})['then'](function(_0xb13436){_0x15ca4a[_0x572f('0x2a')]=_0xb13436;if(_0x566ba7[_0x572f('0x3e')][_0x572f('0x4f')]){_0x2216df[_0x572f('0x50')]=[{'all':!![]}];}return db[_0x572f('0x61')][_0x572f('0x51')](_0x2216df);})[_0x572f('0x31')](function(_0x1be409){_0x15ca4a[_0x572f('0x52')]=_0x1be409;return _0x15ca4a;});}})[_0x572f('0x31')](respondWithFilteredResult(_0x1b1bb9,_0x2216df))['catch'](handleError(_0x1b1bb9,null));};exports[_0x572f('0x64')]=function(_0x548673,_0xcdea9b,_0x5b9fe0){return db[_0x572f('0x39')][_0x572f('0x56')]({'where':{'id':_0x548673[_0x572f('0x54')]['id']}})[_0x572f('0x31')](handleEntityNotFound(_0xcdea9b,null))['then'](function(_0x4b99f2){if(_0x4b99f2){return _0x4b99f2[_0x572f('0x64')](_0x548673[_0x572f('0x3e')]['ids']);}})[_0x572f('0x31')](respondWithStatusCode(_0xcdea9b,null))[_0x572f('0x5d')](handleError(_0xcdea9b,null));};exports[_0x572f('0x65')]=function(_0x414c94,_0x232d02,_0x2d126c){return db[_0x572f('0x39')][_0x572f('0x56')]({'where':{'id':_0x414c94['params']['id']}})[_0x572f('0x31')](handleEntityNotFound(_0x232d02,null))[_0x572f('0x31')](function(_0x48e9a7){if(_0x48e9a7){var _0x3841cd=[];var _0x5e8a31={'success':[],'errors':[]};return db['CmContact'][_0x572f('0x5f')]()[_0x572f('0x31')](function(_0x3b76d9){if(_0x414c94['body'][_0x572f('0x66')]&&_['isArray'](_0x414c94[_0x572f('0x5e')][_0x572f('0x66')])){if(_0x414c94[_0x572f('0x5e')]['tags'][_0x572f('0x44')]){_0x414c94[_0x572f('0x5e')]['tags']=_0x414c94['body'][_0x572f('0x66')][_0x572f('0x67')](';')+';';}else{_0x414c94[_0x572f('0x5e')]['tags']=null;}}else{_0x414c94[_0x572f('0x5e')][_0x572f('0x66')]=null;}if(_0x414c94[_0x572f('0x5e')]&&_['isArray'](_0x414c94[_0x572f('0x5e')])){for(var _0x23a7f2=0x0;_0x23a7f2<_0x414c94[_0x572f('0x5e')][_0x572f('0x44')];_0x23a7f2+=0x1){_0x414c94[_0x572f('0x5e')][_0x23a7f2]['ListId']=_0x414c94['params']['id'];_0x3841cd['push'](_0x414c94[_0x572f('0x5e')][_0x23a7f2]);}return BPromise['each'](_0x3841cd,function(_0x5c04e5){return db[_0x572f('0x68')][_0x572f('0x57')](_[_0x572f('0x69')](_0x5c04e5,['ids','id'])||{},{'fields':_[_0x572f('0x3d')](_0x3b76d9),'raw':!![]})['then'](function(_0x2479ae){_0x5e8a31[_0x572f('0x6a')][_0x572f('0x6b')](_0x2479ae['dataValues']);})[_0x572f('0x5d')](function(_0x430f53){_0x5e8a31[_0x572f('0x6c')][_0x572f('0x6b')]({'data':_0x5c04e5,'error':_0x430f53[_0x572f('0x6d')]});});})[_0x572f('0x31')](function(_0x5bdefe){return _0x5e8a31;})[_0x572f('0x5d')](function(_0x593758){return _0x593758;});}else{_0x232d02[_0x572f('0x24')](0x190)['json']({'message':_0x572f('0x6e')});}});}})[_0x572f('0x31')](respondWithResult(_0x232d02,null))[_0x572f('0x5d')](handleError(_0x232d02,null));};exports[_0x572f('0x6f')]=function(_0x3e620c,_0xcd9dec,_0xc07e8d){var _0x503276;return db[_0x572f('0x39')][_0x572f('0x56')]({'where':{'id':_0x3e620c[_0x572f('0x54')]['id']},'include':[{'model':db[_0x572f('0x70')],'as':_0x572f('0x71')}]})[_0x572f('0x31')](handleEntityNotFound(_0xcd9dec,null))[_0x572f('0x31')](function(_0x97483b){if(_0x97483b){_0x503276=_0x97483b;return db[_0x572f('0x68')][_0x572f('0x3a')];}})[_0x572f('0x31')](function(_0x397d95){if(_0x397d95){var _0xa57157={};var _0x405c3e={};_0x405c3e[_0x572f('0x42')]=_[_0x572f('0x72')](_['keys'](_0x397d95),_[_0x572f('0x38')](_0x503276['CustomFields'],function(_0x120fba){return util[_0x572f('0x73')](_0x572f('0x74'),_0x120fba['id']);}));_0x405c3e[_0x572f('0x3e')]=_['keys'](_0x3e620c[_0x572f('0x3e')]);_0x405c3e[_0x572f('0x3f')]=_['intersection'](_0x405c3e[_0x572f('0x42')],_0x405c3e[_0x572f('0x3e')]);_0xa57157[_0x572f('0x41')]=_['intersection'](_0x405c3e[_0x572f('0x42')],qs[_0x572f('0x43')](_0x3e620c[_0x572f('0x3e')][_0x572f('0x43')]));_0xa57157[_0x572f('0x41')]=_0xa57157[_0x572f('0x41')]['length']?_0xa57157[_0x572f('0x41')]:_0x405c3e['model'];if(!_0x3e620c[_0x572f('0x3e')][_0x572f('0x45')](_0x572f('0x46'))){_0xa57157[_0x572f('0x29')]=qs[_0x572f('0x29')](_0x3e620c[_0x572f('0x3e')]['limit']);_0xa57157[_0x572f('0x27')]=qs[_0x572f('0x27')](_0x3e620c[_0x572f('0x3e')][_0x572f('0x27')]);}_0xa57157['order']=qs[_0x572f('0x48')](_0x3e620c[_0x572f('0x3e')][_0x572f('0x48')]);_0xa57157[_0x572f('0x49')]=qs['filters'](_[_0x572f('0x4a')](_0x3e620c[_0x572f('0x3e')],_0x405c3e[_0x572f('0x3f')]));_0xa57157[_0x572f('0x75')]=!![];if(_0x3e620c[_0x572f('0x3e')]['filter']){_0xa57157[_0x572f('0x49')]=_['merge'](_0xa57157[_0x572f('0x49')],{'$or':_[_0x572f('0x38')](_0xa57157[_0x572f('0x41')],function(_0x5f1cf0){var _0x593830={};_0x593830[_0x5f1cf0]={'$like':'%'+_0x3e620c[_0x572f('0x3e')]['filter']+'%'};return _0x593830;})});}_0xa57157=_[_0x572f('0x4c')]({},_0xa57157,_0x3e620c['options']);return _0x503276[_0x572f('0x6f')](_0xa57157);}})[_0x572f('0x31')](respondWithResult(_0xcd9dec,null))[_0x572f('0x5d')](handleError(_0xcd9dec,null));};exports[_0x572f('0x76')]=function(_0x3f557f,_0x34117b,_0x2a859e){var _0x4560f2;var _0x211a27;var _0x204096;var _0x80dbd9=_0x3f557f['params']['id'];csv_results=[];return db[_0x572f('0x77')][_0x572f('0x51')]({'attributes':['id',_0x572f('0x35')],'raw':!![],'order':[_0x572f('0x78')]})['then'](function(_0x1eb2b4){_0x4560f2=_0x1eb2b4;var _0x728644=_['keys'](db[_0x572f('0x68')][_0x572f('0x3a')]);return db['CmCustomField'][_0x572f('0x51')]({'raw':!![],'attributes':['id','alias']})[_0x572f('0x31')](function(_0x3acaf6){_0x211a27=_0x3acaf6;var _0x230add=squel['select']()[_0x572f('0x43')](_0x728644)['from']('cm_contacts','c')[_0x572f('0x49')](_0x572f('0x79'),_0x80dbd9)[_0x572f('0x49')]('c.deletedAt\x20is\x20null')[_0x572f('0x7a')]();for(var _0x46e8b8=0x0;_0x46e8b8<_0x211a27[_0x572f('0x44')];_0x46e8b8++){_0x230add['field']('c.cf_'+_0x211a27[_0x46e8b8]['id'],_0x572f('0x7b')+_0x211a27[_0x46e8b8][_0x572f('0x7c')]);}for(var _0x46e8b8=0x0;_0x46e8b8<_0x4560f2[_0x572f('0x44')];_0x46e8b8++){_0x230add['field'](squel[_0x572f('0x7d')]()['field'](_0x572f('0x7e'))[_0x572f('0x7f')]('cm_contact_has_items')['where'](_0x572f('0x80'),_0x4560f2[_0x46e8b8]['id'])[_0x572f('0x49')](_0x572f('0x81')),_0x572f('0x82')+_0x4560f2[_0x46e8b8]['name']);_0x230add[_0x572f('0x83')](squel[_0x572f('0x7d')]()[_0x572f('0x83')](_0x572f('0x84'))[_0x572f('0x7f')]('cm_contact_has_items')[_0x572f('0x49')](_0x572f('0x80'),_0x4560f2[_0x46e8b8]['id'])[_0x572f('0x49')](_0x572f('0x81')),'description_additionalPhone_'+_0x4560f2[_0x46e8b8]['name']);}var _0x120695=[];_0x120695['push'](_0x230add[_0x572f('0x85')]());BPromise[_0x572f('0x86')](_0x120695,handleQuery)['then'](function(_0x34e526){handleQuery(_0x230add[_0x572f('0x85')]());var _0x4b3128=csv_results[0x0];if(!_['isEmpty'](_0x4b3128)){var _0x1a373a=toCsv(_0x4b3128);var _0x3b995a=Date[_0x572f('0x87')]();fs['writeFileSync'](util[_0x572f('0x73')](_0x572f('0x88'),_0x80dbd9,_0x3b995a),_0x1a373a);_0x34117b[_0x572f('0x89')]('Content-disposition','attachment;\x20filename='+util[_0x572f('0x73')](_0x572f('0x8a'),_0x80dbd9,_0x3b995a));_0x34117b['setHeader'](_0x572f('0x8b'),_0x572f('0x8c'));return _0x34117b[_0x572f('0x8d')](util[_0x572f('0x73')](_0x572f('0x88'),_0x80dbd9,_0x3b995a));}else{return _0x34117b[_0x572f('0x23')](0xcc);}});});});};exports[_0x572f('0x8e')]=function(_0x54b119,_0xda8eed,_0x27d42e){var _0x3f22e7;delete _0x54b119[_0x572f('0x5e')]['id'];return db['CmList']['findOne']({'where':{'id':_0x54b119['params']['id']}})[_0x572f('0x31')](handleEntityNotFound(_0xda8eed,null))[_0x572f('0x31')](function(_0x482bdc){if(_0x482bdc){return db[_0x572f('0x8f')][_0x572f('0x90')](function(_0x5aac11){return db[_0x572f('0x70')][_0x572f('0x57')](_0x54b119['body'],{'transaction':_0x5aac11})[_0x572f('0x31')](function(_0xd662fb){_0x3f22e7=_0xd662fb;return _0x482bdc[_0x572f('0x91')](_0xd662fb,{'transaction':_0x5aac11});})['then'](function(){var _0x5373f1={'type':db[_0x572f('0x92')][_0x572f('0x93')],'transaction':_0x5aac11};switch(_0x54b119[_0x572f('0x5e')]['type']){case _0x572f('0x94'):_0x5373f1['type']=db[_0x572f('0x92')]['TEXT'];break;case'number':_0x5373f1[_0x572f('0x4d')]=db[_0x572f('0x92')][_0x572f('0x95')];break;case'switch':_0x5373f1[_0x572f('0x4d')]=db[_0x572f('0x92')][_0x572f('0x96')];_0x5373f1[_0x572f('0x97')]=![];break;default:}return db[_0x572f('0x8f')]['queryInterface'][_0x572f('0x98')](_0x572f('0x99'),util[_0x572f('0x73')](_0x572f('0x9a'),_0x3f22e7['id']),_0x5373f1);})[_0x572f('0x31')](function(){return _0x3f22e7;});});}})['then'](respondWithResult(_0xda8eed,null))['catch'](handleError(_0xda8eed,null));};exports[_0x572f('0x9b')]=function(_0x3571b5,_0x482970,_0x5b5ae2){var _0x34818e={};var _0x97b054={};var _0x577744;var _0x5cc2ed;return db['CmList'][_0x572f('0x63')]({'where':{'id':_0x3571b5[_0x572f('0x54')]['id']}})['then'](handleEntityNotFound(_0x482970,null))[_0x572f('0x31')](function(_0x3aa756){if(_0x3aa756){_0x577744=_0x3aa756;_0x97b054[_0x572f('0x42')]=_[_0x572f('0x3d')](db[_0x572f('0x70')][_0x572f('0x3a')]);_0x97b054[_0x572f('0x3e')]=_[_0x572f('0x3d')](_0x3571b5['query']);_0x97b054[_0x572f('0x3f')]=_['intersection'](_0x97b054[_0x572f('0x42')],_0x97b054[_0x572f('0x3e')]);_0x34818e['attributes']=_[_0x572f('0x40')](_0x97b054[_0x572f('0x42')],qs[_0x572f('0x43')](_0x3571b5[_0x572f('0x3e')][_0x572f('0x43')]));_0x34818e[_0x572f('0x41')]=_0x34818e[_0x572f('0x41')][_0x572f('0x44')]?_0x34818e['attributes']:_0x97b054['model'];_0x34818e[_0x572f('0x47')]=qs[_0x572f('0x48')](_0x3571b5[_0x572f('0x3e')][_0x572f('0x48')]);_0x34818e[_0x572f('0x49')]=qs[_0x572f('0x3f')](_[_0x572f('0x4a')](_0x3571b5[_0x572f('0x3e')],_0x97b054[_0x572f('0x3f')]));_0x34818e[_0x572f('0x49')]=_[_0x572f('0x4c')](_0x34818e['where'],{'$or':[{'ListId':_0x3aa756['id']},{'ListId':null}]});if(_0x3571b5[_0x572f('0x3e')][_0x572f('0x4b')]){_0x34818e['where']=_[_0x572f('0x4c')](_0x34818e[_0x572f('0x49')],{'$or':_[_0x572f('0x38')](_0x34818e[_0x572f('0x41')],function(_0x403043){var _0x4560c8={};_0x4560c8[_0x403043]={'$like':'%'+_0x3571b5[_0x572f('0x3e')][_0x572f('0x4b')]+'%'};return _0x4560c8;})});}_0x34818e=_[_0x572f('0x4c')]({},_0x34818e,_0x3571b5['options']);return db[_0x572f('0x70')][_0x572f('0x9c')](_0x34818e);}})[_0x572f('0x31')](respondWithResult(_0x482970,null))[_0x572f('0x5d')](handleError(_0x482970,null));};exports[_0x572f('0x9d')]=function(_0x4f707d,_0x1a00d5){return db['CmCustomField'][_0x572f('0x9c')]({'where':{'ListId':null}})[_0x572f('0x31')](handleEntityNotFound(_0x1a00d5,null))[_0x572f('0x31')](function(_0x52ef9e){return _0x52ef9e;})[_0x572f('0x31')](respondWithResult(_0x1a00d5,null))[_0x572f('0x5d')](handleError(_0x1a00d5,null));};exports[_0x572f('0x9e')]=function(_0x25bbf2,_0x2badc1,_0x98031){return db[_0x572f('0x39')]['find']({'where':{'id':_0x25bbf2[_0x572f('0x54')]['id']}})[_0x572f('0x31')](handleEntityNotFound(_0x2badc1,null))['then'](function(_0x260f29){if(_0x260f29){return _0x260f29[_0x572f('0x9e')](_0x25bbf2[_0x572f('0x5e')]['ids'],_[_0x572f('0x69')](_0x25bbf2[_0x572f('0x5e')],[_0x572f('0x9f'),'id'])||{})[_0x572f('0xa0')](function(_0x210eed){for(var _0x2f4ff6=0x0;_0x2f4ff6<_0x25bbf2[_0x572f('0x5e')][_0x572f('0x9f')][_0x572f('0x44')];_0x2f4ff6+=0x1){socket[_0x572f('0xa1')](_0x572f('0xa2'),{'UserId':Number(_0x25bbf2['body'][_0x572f('0x9f')][_0x2f4ff6]),'CmListId':Number(_0x25bbf2['params']['id'])});}return _0x210eed;});}})[_0x572f('0x31')](respondWithResult(_0x2badc1,null))[_0x572f('0x5d')](handleError(_0x2badc1,null));};exports[_0x572f('0xa3')]=function(_0x1b7c0b,_0x505843,_0x4f4c36){return db['CmList']['find']({'where':{'id':_0x1b7c0b['params']['id']}})[_0x572f('0x31')](handleEntityNotFound(_0x505843,null))[_0x572f('0x31')](function(_0x25f23f){if(_0x25f23f){return _0x25f23f[_0x572f('0xa3')](_0x1b7c0b['query'][_0x572f('0x9f')])[_0x572f('0x31')](function(){if(_[_0x572f('0xa4')](_0x1b7c0b[_0x572f('0x3e')][_0x572f('0x9f')])){for(var _0x1a3a5b=0x0;_0x1a3a5b<_0x1b7c0b['query'][_0x572f('0x9f')][_0x572f('0x44')];_0x1a3a5b+=0x1){socket[_0x572f('0xa1')](_0x572f('0xa5'),{'UserId':Number(_0x1b7c0b[_0x572f('0x3e')][_0x572f('0x9f')][_0x1a3a5b]),'CmListId':Number(_0x1b7c0b[_0x572f('0x54')]['id'])});}}else{socket[_0x572f('0xa1')]('userCmList:remove',{'UserId':Number(_0x1b7c0b[_0x572f('0x3e')][_0x572f('0x9f')]),'CmListId':Number(_0x1b7c0b[_0x572f('0x54')]['id'])});}});}})[_0x572f('0x31')](respondWithStatusCode(_0x505843,null))[_0x572f('0x5d')](handleError(_0x505843,null));};exports[_0x572f('0xa6')]=function(_0x206145,_0x830bba,_0x457514){var _0x417dd3={};var _0x1db751={};var _0x182821;var _0x27ea07;return db[_0x572f('0x39')][_0x572f('0x63')]({'where':{'id':_0x206145['params']['id']}})['then'](handleEntityNotFound(_0x830bba,null))[_0x572f('0x31')](function(_0x205774){if(_0x205774){_0x182821=_0x205774;_0x1db751[_0x572f('0x42')]=_[_0x572f('0x3d')](db[_0x572f('0xa7')][_0x572f('0x3a')]);_0x1db751[_0x572f('0x3e')]=_['keys'](_0x206145[_0x572f('0x3e')]);_0x1db751[_0x572f('0x3f')]=_[_0x572f('0x40')](_0x1db751['model'],_0x1db751[_0x572f('0x3e')]);_0x417dd3['attributes']=_[_0x572f('0x40')](_0x1db751[_0x572f('0x42')],qs['fields'](_0x206145[_0x572f('0x3e')][_0x572f('0x43')]));_0x417dd3[_0x572f('0x41')]=_0x417dd3[_0x572f('0x41')][_0x572f('0x44')]?_0x417dd3['attributes']:_0x1db751[_0x572f('0x42')];_0x417dd3['order']=qs['sort'](_0x206145['query'][_0x572f('0x48')]);_0x417dd3[_0x572f('0x49')]=qs[_0x572f('0x3f')](_[_0x572f('0x4a')](_0x206145[_0x572f('0x3e')],_0x1db751['filters']));if(_0x206145[_0x572f('0x3e')]['filter']){_0x417dd3[_0x572f('0x49')]=_['merge'](_0x417dd3[_0x572f('0x49')],{'$or':_[_0x572f('0x38')](_0x417dd3[_0x572f('0x41')],function(_0x320146){var _0x252078={};_0x252078[_0x320146]={'$like':'%'+_0x206145[_0x572f('0x3e')]['filter']+'%'};return _0x252078;})});}_0x417dd3=_[_0x572f('0x4c')]({},_0x417dd3,_0x206145[_0x572f('0x55')]);return _0x182821[_0x572f('0xa6')](_0x417dd3);}})[_0x572f('0x31')](function(_0x4376e3){if(_0x4376e3){_0x27ea07=_0x4376e3['length'];if(!_0x206145['query'][_0x572f('0x45')](_0x572f('0x46'))){_0x417dd3[_0x572f('0x29')]=qs[_0x572f('0x29')](_0x206145['query'][_0x572f('0x29')]);_0x417dd3[_0x572f('0x27')]=qs[_0x572f('0x27')](_0x206145[_0x572f('0x3e')]['offset']);}return _0x182821[_0x572f('0xa6')](_0x417dd3);}})[_0x572f('0x31')](function(_0x5652d5){if(_0x5652d5){return _0x5652d5?{'count':_0x27ea07,'rows':_0x5652d5}:null;}})[_0x572f('0x31')](respondWithResult(_0x830bba,null))[_0x572f('0x5d')](handleError(_0x830bba,null));};function handleQuery(_0x4e9130){logger[_0x572f('0xa8')](_0x4e9130);return db[_0x572f('0x8f')][_0x572f('0x3e')](_0x4e9130)[_0x572f('0xa0')](function(_0x5a7e8a){csv_results[_0x572f('0x6b')](_0x5a7e8a);})[_0x572f('0x5d')](function(_0x46c8a9){logger[_0x572f('0xa9')](_0x46c8a9[_0x572f('0x6d')]);});} \ No newline at end of file +var _0x3399=['rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','Lists','UserProfileResource','end','error','stack','name','send','index','CmList','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addContacts','tags','isArray','push','CmContact','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','each','isEmpty','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','removeAgents','userCmList:remove','emit','getAgents','info','eml-format'];(function(_0x45bab4,_0x344a83){var _0xcf0db0=function(_0x554beb){while(--_0x554beb){_0x45bab4['push'](_0x45bab4['shift']());}};_0xcf0db0(++_0x344a83);}(_0x3399,0x13f));var _0x9339=function(_0x3253e3,_0x19d384){_0x3253e3=_0x3253e3-0x0;var _0x10ca3e=_0x3399[_0x3253e3];return _0x10ca3e;};'use strict';var emlformat=require(_0x9339('0x0'));var rimraf=require(_0x9339('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9339('0x2'));var rp=require('request-promise');var moment=require(_0x9339('0x3'));var BPromise=require(_0x9339('0x4'));var Mustache=require(_0x9339('0x5'));var util=require('util');var path=require(_0x9339('0x6'));var sox=require(_0x9339('0x7'));var csv=require(_0x9339('0x8'));var ejs=require(_0x9339('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9339('0xa'));var squel=require(_0x9339('0xb'));var crypto=require(_0x9339('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9339('0x8'));var querystring=require(_0x9339('0xd'));var Papa=require(_0x9339('0xe'));var Redis=require('ioredis');var authService=require(_0x9339('0xf'));var qs=require(_0x9339('0x10'));var as=require(_0x9339('0x11'));var hardwareService=require(_0x9339('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9339('0x13'));var config=require(_0x9339('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9339('0x15'))['db'];var csv_results;config[_0x9339('0x16')]=_[_0x9339('0x17')](config[_0x9339('0x16')],{'host':_0x9339('0x18'),'port':0x18eb});var socket=require(_0x9339('0x19'))(new Redis(config[_0x9339('0x16')]));require(_0x9339('0x1a'))[_0x9339('0x1b')](socket);function respondWithStatusCode(_0x4a10d9,_0x5a80cb){_0x5a80cb=_0x5a80cb||0xcc;return function(_0x118909){if(_0x118909){return _0x4a10d9[_0x9339('0x1c')](_0x5a80cb);}return _0x4a10d9['status'](_0x5a80cb)['end']();};}function respondWithResult(_0x39f5e2,_0x50817f){_0x50817f=_0x50817f||0xc8;return function(_0x1bda9f){if(_0x1bda9f){return _0x39f5e2[_0x9339('0x1d')](_0x50817f)[_0x9339('0x1e')](_0x1bda9f);}};}function respondWithFilteredResult(_0x1a7136,_0x27f3ac){return function(_0x4da6ee){if(_0x4da6ee){var _0x4911dc=typeof _0x27f3ac[_0x9339('0x1f')]===_0x9339('0x20')&&typeof _0x27f3ac[_0x9339('0x21')]===_0x9339('0x20');var _0x1b4dc3=_0x4da6ee[_0x9339('0x22')];var _0x4d4182=_0x4911dc?0x0:_0x27f3ac[_0x9339('0x1f')];var _0x20b180=_0x4911dc?_0x4da6ee[_0x9339('0x22')]:_0x27f3ac[_0x9339('0x1f')]+_0x27f3ac[_0x9339('0x21')];var _0x6997e1;if(_0x20b180>=_0x1b4dc3){_0x20b180=_0x1b4dc3;_0x6997e1=0xc8;}else{_0x6997e1=0xce;}_0x1a7136['status'](_0x6997e1);return _0x1a7136['set'](_0x9339('0x23'),_0x4d4182+'-'+_0x20b180+'/'+_0x1b4dc3)['json'](_0x4da6ee);}return null;};}function patchUpdates(_0x15a59b){return function(_0x3f5154){try{jsonpatch[_0x9339('0x24')](_0x3f5154,_0x15a59b,!![]);}catch(_0x190e22){return BPromise[_0x9339('0x25')](_0x190e22);}return _0x3f5154['save']();};}function saveUpdates(_0x4c8914,_0x1dfcac){return function(_0x13326b){if(_0x13326b){return _0x13326b[_0x9339('0x26')](_0x4c8914)[_0x9339('0x27')](function(_0x172771){return _0x172771;});}return null;};}function removeEntity(_0x36780d,_0x23aa65){return function(_0x169dda){if(_0x169dda){return _0x169dda[_0x9339('0x28')]()[_0x9339('0x27')](function(){var _0x552472=_0x169dda['get']({'plain':!![]});var _0x10dc94=_0x9339('0x29');return db[_0x9339('0x2a')][_0x9339('0x28')]({'where':{'type':_0x10dc94,'resourceId':_0x552472['id']}})['then'](function(){return _0x169dda;});})[_0x9339('0x27')](function(){_0x36780d[_0x9339('0x1d')](0xcc)[_0x9339('0x2b')]();});}};}function handleEntityNotFound(_0x26d9d9,_0x384110){return function(_0x4b2167){if(!_0x4b2167){_0x26d9d9[_0x9339('0x1c')](0x194);}return _0x4b2167;};}function handleError(_0x19d71d,_0x185372){_0x185372=_0x185372||0x1f4;return function(_0x372eb7){logger[_0x9339('0x2c')](_0x372eb7[_0x9339('0x2d')]);if(_0x372eb7[_0x9339('0x2e')]){delete _0x372eb7[_0x9339('0x2e')];}_0x19d71d['status'](_0x185372)[_0x9339('0x2f')](_0x372eb7);};}exports[_0x9339('0x30')]=function(_0x3a772d,_0x4459f4){var _0x309088={},_0x1ddab7={},_0x5f5624={'count':0x0,'rows':[]};var _0x3ad536=_['map'](db[_0x9339('0x31')][_0x9339('0x32')],function(_0xaff427){return{'name':_0xaff427['fieldName'],'type':_0xaff427['type'][_0x9339('0x33')]};});_0x1ddab7[_0x9339('0x34')]=_[_0x9339('0x35')](_0x3ad536,_0x9339('0x2e'));_0x1ddab7[_0x9339('0x36')]=_[_0x9339('0x37')](_0x3a772d[_0x9339('0x36')]);_0x1ddab7['filters']=_[_0x9339('0x38')](_0x1ddab7[_0x9339('0x34')],_0x1ddab7['query']);_0x309088[_0x9339('0x39')]=_['intersection'](_0x1ddab7[_0x9339('0x34')],qs[_0x9339('0x3a')](_0x3a772d[_0x9339('0x36')]['fields']));_0x309088[_0x9339('0x39')]=_0x309088['attributes'][_0x9339('0x3b')]?_0x309088['attributes']:_0x1ddab7[_0x9339('0x34')];if(!_0x3a772d[_0x9339('0x36')][_0x9339('0x3c')]('nolimit')){_0x309088[_0x9339('0x21')]=qs['limit'](_0x3a772d[_0x9339('0x36')][_0x9339('0x21')]);_0x309088[_0x9339('0x1f')]=qs[_0x9339('0x1f')](_0x3a772d[_0x9339('0x36')]['offset']);}_0x309088[_0x9339('0x3d')]=qs['sort'](_0x3a772d[_0x9339('0x36')][_0x9339('0x3e')]);_0x309088[_0x9339('0x3f')]=qs[_0x9339('0x40')](_['pick'](_0x3a772d['query'],_0x1ddab7[_0x9339('0x40')]),_0x3ad536);if(_0x3a772d[_0x9339('0x36')][_0x9339('0x41')]){_0x309088['where']=_[_0x9339('0x42')](_0x309088['where'],{'$or':_[_0x9339('0x35')](_0x3ad536,function(_0x216217){if(_0x216217[_0x9339('0x43')]!=='VIRTUAL'){var _0x4d369c={};_0x4d369c[_0x216217[_0x9339('0x2e')]]={'$like':'%'+_0x3a772d['query'][_0x9339('0x41')]+'%'};return _0x4d369c;}})});}_0x309088=_[_0x9339('0x42')]({},_0x309088,_0x3a772d[_0x9339('0x44')]);var _0x49bb65={'where':_0x309088[_0x9339('0x3f')]};return db[_0x9339('0x31')]['count'](_0x49bb65)[_0x9339('0x27')](function(_0x26b76d){_0x5f5624[_0x9339('0x22')]=_0x26b76d;if(_0x3a772d['query'][_0x9339('0x45')]){_0x309088[_0x9339('0x46')]=[{'all':!![]}];}return db[_0x9339('0x31')][_0x9339('0x47')](_0x309088);})[_0x9339('0x27')](function(_0x45f19f){_0x5f5624[_0x9339('0x48')]=_0x45f19f;return _0x5f5624;})[_0x9339('0x27')](respondWithFilteredResult(_0x4459f4,_0x309088))[_0x9339('0x49')](handleError(_0x4459f4,null));};exports[_0x9339('0x4a')]=function(_0x27c75f,_0x3294a9){var _0x482b32={'raw':![],'where':{'id':_0x27c75f[_0x9339('0x4b')]['id']}},_0x55e11b={};_0x55e11b[_0x9339('0x34')]=_[_0x9339('0x37')](db[_0x9339('0x31')][_0x9339('0x32')]);_0x55e11b[_0x9339('0x36')]=_[_0x9339('0x37')](_0x27c75f['query']);_0x55e11b[_0x9339('0x40')]=_[_0x9339('0x38')](_0x55e11b[_0x9339('0x34')],_0x55e11b[_0x9339('0x36')]);_0x482b32['attributes']=_['intersection'](_0x55e11b[_0x9339('0x34')],qs[_0x9339('0x3a')](_0x27c75f[_0x9339('0x36')]['fields']));_0x482b32[_0x9339('0x39')]=_0x482b32['attributes'][_0x9339('0x3b')]?_0x482b32[_0x9339('0x39')]:_0x55e11b[_0x9339('0x34')];if(_0x27c75f[_0x9339('0x36')]['includeAll']){_0x482b32[_0x9339('0x46')]=[{'all':!![]}];}_0x482b32=_['merge']({},_0x482b32,_0x27c75f[_0x9339('0x44')]);return db[_0x9339('0x31')]['find'](_0x482b32)[_0x9339('0x27')](handleEntityNotFound(_0x3294a9,null))[_0x9339('0x27')](respondWithResult(_0x3294a9,null))[_0x9339('0x49')](handleError(_0x3294a9,null));};exports[_0x9339('0x4c')]=function(_0x5ed621,_0x49fb83){return db[_0x9339('0x31')]['create'](_0x5ed621['body'],{})[_0x9339('0x27')](function(_0x3901ed){var _0x45194a=_0x5ed621[_0x9339('0x4d')][_0x9339('0x4e')]({'plain':!![]});if(!_0x45194a)throw new Error(_0x9339('0x4f'));if(_0x45194a[_0x9339('0x50')]===_0x9339('0x4d')){var _0x57d654=_0x3901ed['get']({'plain':!![]});var _0x2771f1=_0x9339('0x29');return db[_0x9339('0x51')][_0x9339('0x52')]({'where':{'name':_0x2771f1,'userProfileId':_0x45194a[_0x9339('0x53')]},'raw':!![]})[_0x9339('0x27')](function(_0x4c9737){if(_0x4c9737&&_0x4c9737['autoAssociation']===0x0){return db[_0x9339('0x2a')][_0x9339('0x4c')]({'name':_0x57d654[_0x9339('0x2e')],'resourceId':_0x57d654['id'],'type':_0x4c9737[_0x9339('0x2e')],'sectionId':_0x4c9737['id']},{})[_0x9339('0x27')](function(){return _0x3901ed;});}else{return _0x3901ed;}})[_0x9339('0x49')](function(_0x2afc6b){logger['error'](_0x9339('0x54'),_0x2afc6b);throw _0x2afc6b;});}return _0x3901ed;})[_0x9339('0x27')](respondWithResult(_0x49fb83,0xc9))['catch'](handleError(_0x49fb83,null));};exports[_0x9339('0x26')]=function(_0x154ea1,_0x300e3b){if(_0x154ea1[_0x9339('0x55')]['id']){delete _0x154ea1['body']['id'];}return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x154ea1[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x300e3b,null))[_0x9339('0x27')](saveUpdates(_0x154ea1['body'],null))['then'](respondWithResult(_0x300e3b,null))[_0x9339('0x49')](handleError(_0x300e3b,null));};exports[_0x9339('0x28')]=function(_0x173730,_0x2ec90c){return db['CmList'][_0x9339('0x52')]({'where':{'id':_0x173730['params']['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x2ec90c,null))['then'](removeEntity(_0x2ec90c,null))['catch'](handleError(_0x2ec90c,null));};exports['describe']=function(_0x287b7a,_0x296f36){return db['CmList']['describe']()[_0x9339('0x27')](respondWithResult(_0x296f36,null))[_0x9339('0x49')](handleError(_0x296f36,null));};exports[_0x9339('0x56')]=function(_0x48f052,_0x5c3245,_0x4633da){if(_0x48f052[_0x9339('0x55')]['id']){delete _0x48f052[_0x9339('0x55')]['id'];}return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x48f052['params']['id']}})['then'](handleEntityNotFound(_0x5c3245,null))[_0x9339('0x27')](function(_0x4929bf){if(_0x4929bf){_0x48f052[_0x9339('0x55')][_0x9339('0x57')]=_0x4929bf['id'];return db[_0x9339('0x58')]['create'](_0x48f052['body']);}})[_0x9339('0x27')](respondWithResult(_0x5c3245,null))[_0x9339('0x49')](handleError(_0x5c3245,null));};exports[_0x9339('0x59')]=function(_0x207bbb,_0x5b18bd,_0x22a048){var _0x110e55={'raw':![],'where':{}};var _0x59d03c={};var _0x2a8c20={'count':0x0,'rows':[]};return db['CmList'][_0x9339('0x5a')]({'where':{'id':_0x207bbb[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x5b18bd,null))['then'](function(_0x549e1b){if(_0x549e1b){_0x59d03c[_0x9339('0x34')]=_[_0x9339('0x37')](db[_0x9339('0x58')][_0x9339('0x32')]);_0x59d03c[_0x9339('0x36')]=_[_0x9339('0x37')](_0x207bbb[_0x9339('0x36')]);_0x59d03c[_0x9339('0x40')]=_[_0x9339('0x38')](_0x59d03c['model'],_0x59d03c[_0x9339('0x36')]);_0x110e55['attributes']=_['intersection'](_0x59d03c['model'],qs[_0x9339('0x3a')](_0x207bbb[_0x9339('0x36')][_0x9339('0x3a')]));_0x110e55[_0x9339('0x39')]=_0x110e55[_0x9339('0x39')][_0x9339('0x3b')]?_0x110e55[_0x9339('0x39')]:_0x59d03c[_0x9339('0x34')];if(!_0x207bbb[_0x9339('0x36')][_0x9339('0x3c')](_0x9339('0x5b'))){_0x110e55[_0x9339('0x21')]=qs[_0x9339('0x21')](_0x207bbb[_0x9339('0x36')][_0x9339('0x21')]);_0x110e55[_0x9339('0x1f')]=qs[_0x9339('0x1f')](_0x207bbb[_0x9339('0x36')]['offset']);}_0x110e55[_0x9339('0x3d')]=qs[_0x9339('0x3e')](_0x207bbb[_0x9339('0x36')][_0x9339('0x3e')]);_0x110e55['where']=qs[_0x9339('0x40')](_[_0x9339('0x5c')](_0x207bbb[_0x9339('0x36')],_0x59d03c['filters']));_0x110e55[_0x9339('0x3f')]['ListId']=_0x549e1b['id'];if(_0x207bbb[_0x9339('0x36')][_0x9339('0x41')]){_0x110e55[_0x9339('0x3f')]=_[_0x9339('0x42')](_0x110e55[_0x9339('0x3f')],{'$or':_[_0x9339('0x35')](_0x110e55[_0x9339('0x39')],function(_0x23632b){var _0x7d8066={};_0x7d8066[_0x23632b]={'$like':'%'+_0x207bbb[_0x9339('0x36')][_0x9339('0x41')]+'%'};return _0x7d8066;})});}_0x110e55=_['merge']({},_0x110e55,_0x207bbb[_0x9339('0x44')]);return db[_0x9339('0x58')][_0x9339('0x22')]({'where':_0x110e55[_0x9339('0x3f')]})[_0x9339('0x27')](function(_0x3b5bf5){_0x2a8c20[_0x9339('0x22')]=_0x3b5bf5;if(_0x207bbb[_0x9339('0x36')][_0x9339('0x45')]){_0x110e55[_0x9339('0x46')]=[{'all':!![]}];}return db[_0x9339('0x58')][_0x9339('0x47')](_0x110e55);})[_0x9339('0x27')](function(_0x45b232){_0x2a8c20[_0x9339('0x48')]=_0x45b232;return _0x2a8c20;});}})[_0x9339('0x27')](respondWithFilteredResult(_0x5b18bd,_0x110e55))['catch'](handleError(_0x5b18bd,null));};exports[_0x9339('0x5d')]=function(_0x3adee8,_0x3fdb6b,_0x1aca94){return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x3adee8[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x3fdb6b,null))['then'](function(_0x2d68a1){if(_0x2d68a1){return _0x2d68a1[_0x9339('0x5d')](_0x3adee8[_0x9339('0x36')][_0x9339('0x5e')]);}})[_0x9339('0x27')](respondWithStatusCode(_0x3fdb6b,null))[_0x9339('0x49')](handleError(_0x3fdb6b,null));};exports[_0x9339('0x5f')]=function(_0x146ce6,_0x5de879,_0x58743c){return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x146ce6[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x5de879,null))['then'](function(_0x3746bb){if(_0x3746bb){var _0x380db2=[];var _0x25ffab={'success':[],'errors':[]};return db['CmContact']['describe']()[_0x9339('0x27')](function(_0x3ea1ab){if(_0x146ce6[_0x9339('0x55')][_0x9339('0x60')]&&_[_0x9339('0x61')](_0x146ce6[_0x9339('0x55')][_0x9339('0x60')])){if(_0x146ce6['body'][_0x9339('0x60')][_0x9339('0x3b')]){_0x146ce6[_0x9339('0x55')][_0x9339('0x60')]=_0x146ce6[_0x9339('0x55')][_0x9339('0x60')]['join'](';')+';';}else{_0x146ce6[_0x9339('0x55')]['tags']=null;}}else{_0x146ce6[_0x9339('0x55')][_0x9339('0x60')]=null;}if(_0x146ce6[_0x9339('0x55')]&&_[_0x9339('0x61')](_0x146ce6[_0x9339('0x55')])){for(var _0x80e455=0x0;_0x80e455<_0x146ce6[_0x9339('0x55')][_0x9339('0x3b')];_0x80e455+=0x1){_0x146ce6[_0x9339('0x55')][_0x80e455][_0x9339('0x57')]=_0x146ce6[_0x9339('0x4b')]['id'];_0x380db2[_0x9339('0x62')](_0x146ce6['body'][_0x80e455]);}return BPromise['each'](_0x380db2,function(_0xfe2e5d){return db[_0x9339('0x63')][_0x9339('0x4c')](_[_0x9339('0x64')](_0xfe2e5d,[_0x9339('0x5e'),'id'])||{},{'fields':_['keys'](_0x3ea1ab),'raw':!![]})[_0x9339('0x27')](function(_0x19a1f9){_0x25ffab[_0x9339('0x65')]['push'](_0x19a1f9[_0x9339('0x66')]);})['catch'](function(_0x4b1aba){_0x25ffab[_0x9339('0x67')]['push']({'data':_0xfe2e5d,'error':_0x4b1aba[_0x9339('0x68')]});});})['then'](function(_0x2b5584){return _0x25ffab;})[_0x9339('0x49')](function(_0x44059d){return _0x44059d;});}else{_0x5de879['status'](0x190)[_0x9339('0x1e')]({'message':_0x9339('0x69')});}});}})['then'](respondWithResult(_0x5de879,null))['catch'](handleError(_0x5de879,null));};exports[_0x9339('0x6a')]=function(_0x2e584b,_0x1a4ec3,_0xa8038e){var _0x3ef8e9;return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x2e584b[_0x9339('0x4b')]['id']},'include':[{'model':db[_0x9339('0x6b')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x1a4ec3,null))[_0x9339('0x27')](function(_0x4e12f2){if(_0x4e12f2){_0x3ef8e9=_0x4e12f2;return db[_0x9339('0x63')][_0x9339('0x32')];}})['then'](function(_0x47a12c){if(_0x47a12c){var _0x348f79={};var _0x575851={};_0x575851[_0x9339('0x34')]=_[_0x9339('0x6c')](_[_0x9339('0x37')](_0x47a12c),_[_0x9339('0x35')](_0x3ef8e9[_0x9339('0x6d')],function(_0x2a35b9){return util[_0x9339('0x6e')](_0x9339('0x6f'),_0x2a35b9['id']);}));_0x575851['query']=_[_0x9339('0x37')](_0x2e584b['query']);_0x575851[_0x9339('0x40')]=_[_0x9339('0x38')](_0x575851[_0x9339('0x34')],_0x575851[_0x9339('0x36')]);_0x348f79[_0x9339('0x39')]=_['intersection'](_0x575851[_0x9339('0x34')],qs[_0x9339('0x3a')](_0x2e584b[_0x9339('0x36')][_0x9339('0x3a')]));_0x348f79[_0x9339('0x39')]=_0x348f79[_0x9339('0x39')][_0x9339('0x3b')]?_0x348f79['attributes']:_0x575851[_0x9339('0x34')];if(!_0x2e584b['query'][_0x9339('0x3c')](_0x9339('0x5b'))){_0x348f79['limit']=qs['limit'](_0x2e584b[_0x9339('0x36')][_0x9339('0x21')]);_0x348f79[_0x9339('0x1f')]=qs['offset'](_0x2e584b[_0x9339('0x36')]['offset']);}_0x348f79[_0x9339('0x3d')]=qs[_0x9339('0x3e')](_0x2e584b[_0x9339('0x36')][_0x9339('0x3e')]);_0x348f79['where']=qs[_0x9339('0x40')](_[_0x9339('0x5c')](_0x2e584b['query'],_0x575851[_0x9339('0x40')]));_0x348f79[_0x9339('0x70')]=!![];if(_0x2e584b[_0x9339('0x36')][_0x9339('0x41')]){_0x348f79[_0x9339('0x3f')]=_[_0x9339('0x42')](_0x348f79[_0x9339('0x3f')],{'$or':_[_0x9339('0x35')](_0x348f79['attributes'],function(_0x3724d9){var _0x51d2e2={};_0x51d2e2[_0x3724d9]={'$like':'%'+_0x2e584b[_0x9339('0x36')]['filter']+'%'};return _0x51d2e2;})});}_0x348f79=_[_0x9339('0x42')]({},_0x348f79,_0x2e584b[_0x9339('0x44')]);return _0x3ef8e9[_0x9339('0x6a')](_0x348f79);}})[_0x9339('0x27')](respondWithResult(_0x1a4ec3,null))['catch'](handleError(_0x1a4ec3,null));};exports[_0x9339('0x71')]=function(_0xb6c22b,_0x2ab2c3,_0xa05abc){var _0x1278a5;var _0x3c40e9;var _0x27dfdb;var _0x442511=_0xb6c22b[_0x9339('0x4b')]['id'];csv_results=[];return db[_0x9339('0x72')]['findAll']({'attributes':['id',_0x9339('0x2e')],'raw':!![],'order':[_0x9339('0x73')]})[_0x9339('0x27')](function(_0x48687a){_0x1278a5=_0x48687a;var _0x28f77f=_['keys'](db['CmContact'][_0x9339('0x32')]);return db[_0x9339('0x6b')]['findAll']({'raw':!![],'attributes':['id',_0x9339('0x74')]})[_0x9339('0x27')](function(_0x3c3f64){_0x3c40e9=_0x3c3f64;var _0x5c341f=squel[_0x9339('0x75')]()[_0x9339('0x3a')](_0x28f77f)[_0x9339('0x76')](_0x9339('0x77'),'c')[_0x9339('0x3f')](_0x9339('0x78'),_0x442511)[_0x9339('0x3f')](_0x9339('0x79'))['distinct']();for(var _0x4bc2f3=0x0;_0x4bc2f3<_0x3c40e9[_0x9339('0x3b')];_0x4bc2f3++){_0x5c341f[_0x9339('0x7a')](_0x9339('0x7b')+_0x3c40e9[_0x4bc2f3]['id'],_0x9339('0x7c')+_0x3c40e9[_0x4bc2f3]['alias']);}for(var _0x4bc2f3=0x0;_0x4bc2f3<_0x1278a5[_0x9339('0x3b')];_0x4bc2f3++){_0x5c341f[_0x9339('0x7a')](squel[_0x9339('0x75')]()[_0x9339('0x7a')](_0x9339('0x7d'))[_0x9339('0x76')](_0x9339('0x7e'))[_0x9339('0x3f')](_0x9339('0x7f'),_0x1278a5[_0x4bc2f3]['id'])['where']('CmContactId\x20=\x20c.id'),_0x9339('0x80')+_0x1278a5[_0x4bc2f3]['name']);_0x5c341f[_0x9339('0x7a')](squel[_0x9339('0x75')]()[_0x9339('0x7a')](_0x9339('0x81'))[_0x9339('0x76')](_0x9339('0x7e'))['where'](_0x9339('0x7f'),_0x1278a5[_0x4bc2f3]['id'])[_0x9339('0x3f')](_0x9339('0x82')),'description_additionalPhone_'+_0x1278a5[_0x4bc2f3][_0x9339('0x2e')]);}var _0xe3c3e5=[];_0xe3c3e5[_0x9339('0x62')](_0x5c341f['toString']());BPromise[_0x9339('0x83')](_0xe3c3e5,handleQuery)['then'](function(_0x4da7ec){handleQuery(_0x5c341f['toString']());var _0x1dfea9=csv_results[0x0];if(!_[_0x9339('0x84')](_0x1dfea9)){var _0x168b89=toCsv(_0x1dfea9);var _0x9acb80=Date['now']();fs['writeFileSync'](util[_0x9339('0x6e')](_0x9339('0x85'),_0x442511,_0x9acb80),_0x168b89);_0x2ab2c3[_0x9339('0x86')]('Content-disposition',_0x9339('0x87')+util[_0x9339('0x6e')](_0x9339('0x88'),_0x442511,_0x9acb80));_0x2ab2c3[_0x9339('0x86')](_0x9339('0x89'),'text/csv');return _0x2ab2c3[_0x9339('0x8a')](util[_0x9339('0x6e')](_0x9339('0x85'),_0x442511,_0x9acb80));}else{return _0x2ab2c3[_0x9339('0x1c')](0xcc);}});});});};exports[_0x9339('0x8b')]=function(_0x366b06,_0x286373,_0x110374){var _0x133c53;delete _0x366b06['body']['id'];return db[_0x9339('0x31')]['findOne']({'where':{'id':_0x366b06[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x286373,null))[_0x9339('0x27')](function(_0x487f44){if(_0x487f44){return db[_0x9339('0x8c')][_0x9339('0x8d')](function(_0x492fa0){return db[_0x9339('0x6b')][_0x9339('0x4c')](_0x366b06['body'],{'transaction':_0x492fa0})[_0x9339('0x27')](function(_0x30c9fc){_0x133c53=_0x30c9fc;return _0x487f44[_0x9339('0x8e')](_0x30c9fc,{'transaction':_0x492fa0});})[_0x9339('0x27')](function(){var _0x20087b={'type':db[_0x9339('0x8f')]['TEXT'],'transaction':_0x492fa0};switch(_0x366b06[_0x9339('0x55')][_0x9339('0x43')]){case _0x9339('0x90'):_0x20087b[_0x9339('0x43')]=db[_0x9339('0x8f')]['TEXT'];break;case'number':_0x20087b[_0x9339('0x43')]=db[_0x9339('0x8f')][_0x9339('0x91')];break;case _0x9339('0x92'):_0x20087b[_0x9339('0x43')]=db[_0x9339('0x8f')]['BOOLEAN'];_0x20087b[_0x9339('0x93')]=![];break;default:}return db['sequelize'][_0x9339('0x94')][_0x9339('0x95')](_0x9339('0x77'),util[_0x9339('0x6e')](_0x9339('0x96'),_0x133c53['id']),_0x20087b);})[_0x9339('0x27')](function(){return _0x133c53;});});}})['then'](respondWithResult(_0x286373,null))[_0x9339('0x49')](handleError(_0x286373,null));};exports[_0x9339('0x97')]=function(_0x50d3f6,_0x39954f,_0x35fc88){var _0x22272d={};var _0x126205={};var _0x2a2530;var _0x2a92db;return db[_0x9339('0x31')][_0x9339('0x5a')]({'where':{'id':_0x50d3f6['params']['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x39954f,null))['then'](function(_0x3b48a5){if(_0x3b48a5){_0x2a2530=_0x3b48a5;_0x126205[_0x9339('0x34')]=_['keys'](db['CmCustomField'][_0x9339('0x32')]);_0x126205[_0x9339('0x36')]=_['keys'](_0x50d3f6[_0x9339('0x36')]);_0x126205[_0x9339('0x40')]=_[_0x9339('0x38')](_0x126205[_0x9339('0x34')],_0x126205['query']);_0x22272d['attributes']=_[_0x9339('0x38')](_0x126205[_0x9339('0x34')],qs['fields'](_0x50d3f6[_0x9339('0x36')][_0x9339('0x3a')]));_0x22272d['attributes']=_0x22272d[_0x9339('0x39')][_0x9339('0x3b')]?_0x22272d[_0x9339('0x39')]:_0x126205[_0x9339('0x34')];_0x22272d['order']=qs[_0x9339('0x3e')](_0x50d3f6['query']['sort']);_0x22272d[_0x9339('0x3f')]=qs[_0x9339('0x40')](_[_0x9339('0x5c')](_0x50d3f6['query'],_0x126205[_0x9339('0x40')]));_0x22272d[_0x9339('0x3f')]=_[_0x9339('0x42')](_0x22272d[_0x9339('0x3f')],{'$or':[{'ListId':_0x3b48a5['id']},{'ListId':null}]});if(_0x50d3f6[_0x9339('0x36')][_0x9339('0x41')]){_0x22272d[_0x9339('0x3f')]=_[_0x9339('0x42')](_0x22272d[_0x9339('0x3f')],{'$or':_['map'](_0x22272d[_0x9339('0x39')],function(_0x4cc946){var _0x31fa73={};_0x31fa73[_0x4cc946]={'$like':'%'+_0x50d3f6[_0x9339('0x36')][_0x9339('0x41')]+'%'};return _0x31fa73;})});}_0x22272d=_[_0x9339('0x42')]({},_0x22272d,_0x50d3f6[_0x9339('0x44')]);return db[_0x9339('0x6b')][_0x9339('0x98')](_0x22272d);}})[_0x9339('0x27')](respondWithResult(_0x39954f,null))[_0x9339('0x49')](handleError(_0x39954f,null));};exports[_0x9339('0x99')]=function(_0x52588a,_0xcb3fbd){return db[_0x9339('0x6b')]['findAndCountAll']({'where':{'ListId':null}})[_0x9339('0x27')](handleEntityNotFound(_0xcb3fbd,null))[_0x9339('0x27')](function(_0x48dfbd){return _0x48dfbd;})['then'](respondWithResult(_0xcb3fbd,null))[_0x9339('0x49')](handleError(_0xcb3fbd,null));};exports[_0x9339('0x9a')]=function(_0x497717,_0x20d816,_0x154e19){return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x497717[_0x9339('0x4b')]['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x20d816,null))[_0x9339('0x27')](function(_0x4c460e){if(_0x4c460e){return _0x4c460e[_0x9339('0x9a')](_0x497717['body']['ids'],_['omit'](_0x497717[_0x9339('0x55')],[_0x9339('0x5e'),'id'])||{})['spread'](function(_0x5edc86){for(var _0x3de8d7=0x0;_0x3de8d7<_0x497717['body']['ids'][_0x9339('0x3b')];_0x3de8d7+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0x497717[_0x9339('0x55')][_0x9339('0x5e')][_0x3de8d7]),'CmListId':Number(_0x497717['params']['id'])});}return _0x5edc86;});}})[_0x9339('0x27')](respondWithResult(_0x20d816,null))[_0x9339('0x49')](handleError(_0x20d816,null));};exports[_0x9339('0x9b')]=function(_0x2604b8,_0x1966d2,_0x42c198){return db[_0x9339('0x31')][_0x9339('0x52')]({'where':{'id':_0x2604b8[_0x9339('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1966d2,null))[_0x9339('0x27')](function(_0x9f2579){if(_0x9f2579){return _0x9f2579[_0x9339('0x9b')](_0x2604b8['query'][_0x9339('0x5e')])[_0x9339('0x27')](function(){if(_['isArray'](_0x2604b8['query'][_0x9339('0x5e')])){for(var _0x2c5dba=0x0;_0x2c5dba<_0x2604b8[_0x9339('0x36')][_0x9339('0x5e')]['length'];_0x2c5dba+=0x1){socket['emit'](_0x9339('0x9c'),{'UserId':Number(_0x2604b8[_0x9339('0x36')][_0x9339('0x5e')][_0x2c5dba]),'CmListId':Number(_0x2604b8[_0x9339('0x4b')]['id'])});}}else{socket[_0x9339('0x9d')](_0x9339('0x9c'),{'UserId':Number(_0x2604b8[_0x9339('0x36')][_0x9339('0x5e')]),'CmListId':Number(_0x2604b8[_0x9339('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x1966d2,null))[_0x9339('0x49')](handleError(_0x1966d2,null));};exports[_0x9339('0x9e')]=function(_0x4d2c9e,_0x53dbfa,_0x27e9ab){var _0x37762e={};var _0x483b7e={};var _0x249252;var _0x630b6a;return db[_0x9339('0x31')][_0x9339('0x5a')]({'where':{'id':_0x4d2c9e['params']['id']}})[_0x9339('0x27')](handleEntityNotFound(_0x53dbfa,null))[_0x9339('0x27')](function(_0x462836){if(_0x462836){_0x249252=_0x462836;_0x483b7e[_0x9339('0x34')]=_[_0x9339('0x37')](db['User'][_0x9339('0x32')]);_0x483b7e['query']=_[_0x9339('0x37')](_0x4d2c9e['query']);_0x483b7e['filters']=_[_0x9339('0x38')](_0x483b7e[_0x9339('0x34')],_0x483b7e[_0x9339('0x36')]);_0x37762e['attributes']=_[_0x9339('0x38')](_0x483b7e['model'],qs[_0x9339('0x3a')](_0x4d2c9e[_0x9339('0x36')]['fields']));_0x37762e[_0x9339('0x39')]=_0x37762e[_0x9339('0x39')]['length']?_0x37762e[_0x9339('0x39')]:_0x483b7e['model'];_0x37762e[_0x9339('0x3d')]=qs[_0x9339('0x3e')](_0x4d2c9e['query']['sort']);_0x37762e[_0x9339('0x3f')]=qs[_0x9339('0x40')](_[_0x9339('0x5c')](_0x4d2c9e[_0x9339('0x36')],_0x483b7e[_0x9339('0x40')]));if(_0x4d2c9e[_0x9339('0x36')][_0x9339('0x41')]){_0x37762e[_0x9339('0x3f')]=_[_0x9339('0x42')](_0x37762e[_0x9339('0x3f')],{'$or':_['map'](_0x37762e[_0x9339('0x39')],function(_0x47a7e1){var _0x1faffc={};_0x1faffc[_0x47a7e1]={'$like':'%'+_0x4d2c9e[_0x9339('0x36')][_0x9339('0x41')]+'%'};return _0x1faffc;})});}_0x37762e=_[_0x9339('0x42')]({},_0x37762e,_0x4d2c9e[_0x9339('0x44')]);return _0x249252['getAgents'](_0x37762e);}})[_0x9339('0x27')](function(_0x4ee982){if(_0x4ee982){_0x630b6a=_0x4ee982['length'];if(!_0x4d2c9e['query'][_0x9339('0x3c')](_0x9339('0x5b'))){_0x37762e[_0x9339('0x21')]=qs[_0x9339('0x21')](_0x4d2c9e[_0x9339('0x36')][_0x9339('0x21')]);_0x37762e[_0x9339('0x1f')]=qs['offset'](_0x4d2c9e[_0x9339('0x36')][_0x9339('0x1f')]);}return _0x249252[_0x9339('0x9e')](_0x37762e);}})[_0x9339('0x27')](function(_0xf3c567){if(_0xf3c567){return _0xf3c567?{'count':_0x630b6a,'rows':_0xf3c567}:null;}})['then'](respondWithResult(_0x53dbfa,null))[_0x9339('0x49')](handleError(_0x53dbfa,null));};function handleQuery(_0x5af19c){logger[_0x9339('0x9f')](_0x5af19c);return db[_0x9339('0x8c')][_0x9339('0x36')](_0x5af19c)['spread'](function(_0x1d3e19){csv_results['push'](_0x1d3e19);})[_0x9339('0x49')](function(_0x2c681e){logger[_0x9339('0x2c')](_0x2c681e['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 3454c93..bcc4a50 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(_0x121ffa,_0x2037b5){var _0x5f0bea=function(_0xd94804){while(--_0xd94804){_0x121ffa['push'](_0x121ffa['shift']());}};_0x5f0bea(++_0x2037b5);}(_0x814b,0x1a2));var _0xb814=function(_0x4da382,_0x4cfc5d){_0x4da382=_0x4da382-0x0;var _0x10073f=_0x814b[_0x4da382];return _0x10073f;};'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 _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x326f,0xd1));var _0xf326=function(_0x3d3a0e,_0x3aa8a0){_0x3d3a0e=_0x3d3a0e-0x0;var _0x97584b=_0x326f[_0x3d3a0e];return _0x97584b;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 93da684..bf8d6c9 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 _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api'];(function(_0x4c8bc6,_0x1e5fa4){var _0x241983=function(_0x5539b2){while(--_0x5539b2){_0x4c8bc6['push'](_0x4c8bc6['shift']());}};_0x241983(++_0x1e5fa4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./cmList.attributes','define','CmList'];(function(_0x2416f2,_0x183451){var _0x162fde=function(_0x4c32ae){while(--_0x4c32ae){_0x2416f2['push'](_0x2416f2['shift']());}};_0x162fde(++_0x183451);}(_0x99e9,0xb4));var _0x999e=function(_0x4c0155,_0x5b20db){_0x4c0155=_0x4c0155-0x0;var _0x1276db=_0x99e9[_0x4c0155];return _0x1276db;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 056ab95..ff55df0 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 _0xf43a=['../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','CmList,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x238830,_0x545f75){var _0x5917f0=function(_0x12f821){while(--_0x12f821){_0x238830['push'](_0x238830['shift']());}};_0x5917f0(++_0x545f75);}(_0xf43a,0xe2));var _0xaf43=function(_0x308aea,_0x2f5271){_0x308aea=_0x308aea-0x0;var _0x4b03b5=_0xf43a[_0x308aea];return _0x4b03b5;};'use strict';var _=require('lodash');var util=require(_0xaf43('0x0'));var moment=require(_0xaf43('0x1'));var BPromise=require(_0xaf43('0x2'));var rs=require(_0xaf43('0x3'));var fs=require('fs');var Redis=require(_0xaf43('0x4'));var db=require(_0xaf43('0x5'))['db'];var utils=require(_0xaf43('0x6'));var logger=require('../../config/logger')(_0xaf43('0x7'));var config=require(_0xaf43('0x8'));var jayson=require(_0xaf43('0x9'));var client=jayson[_0xaf43('0xa')]['http']({'port':0x232a});config[_0xaf43('0xb')]=_['defaults'](config[_0xaf43('0xb')],{'host':_0xaf43('0xc'),'port':0x18eb});var socket=require(_0xaf43('0xd'))(new Redis(config[_0xaf43('0xb')]));require('./cmList.socket')[_0xaf43('0xe')](socket);function respondWithRpcPromise(_0x32373f,_0x55a694,_0x40b769){return new BPromise(function(_0x364f96,_0x5f079c){return client[_0xaf43('0xf')](_0x32373f,_0x40b769)['then'](function(_0x4d67d4){logger['info'](_0xaf43('0x10'),_0x55a694,'request\x20sent');logger[_0xaf43('0x11')]('CmList,\x20%s,\x20%s,\x20%s',_0x55a694,_0xaf43('0x12'),JSON[_0xaf43('0x13')](_0x4d67d4));if(_0x4d67d4[_0xaf43('0x14')]){if(_0x4d67d4[_0xaf43('0x14')][_0xaf43('0x15')]===0x1f4){logger[_0xaf43('0x14')](_0xaf43('0x10'),_0x55a694,_0x4d67d4[_0xaf43('0x14')]['message']);return _0x5f079c(_0x4d67d4[_0xaf43('0x14')][_0xaf43('0x16')]);}logger[_0xaf43('0x14')](_0xaf43('0x10'),_0x55a694,_0x4d67d4[_0xaf43('0x14')][_0xaf43('0x16')]);return _0x364f96(_0x4d67d4[_0xaf43('0x14')][_0xaf43('0x16')]);}else{logger[_0xaf43('0x17')](_0xaf43('0x10'),_0x55a694,_0xaf43('0x12'));_0x364f96(_0x4d67d4[_0xaf43('0x18')][_0xaf43('0x16')]);}})[_0xaf43('0x19')](function(_0x209214){logger[_0xaf43('0x14')](_0xaf43('0x10'),_0x55a694,_0x209214);_0x5f079c(_0x209214);});});} \ No newline at end of file +var _0x5f3b=['request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmList.socket','register'];(function(_0x48a96f,_0x530059){var _0x3ff3ef=function(_0x286059){while(--_0x286059){_0x48a96f['push'](_0x48a96f['shift']());}};_0x3ff3ef(++_0x530059);}(_0x5f3b,0x1a1));var _0xb5f3=function(_0x5c4937,_0x4bd800){_0x5c4937=_0x5c4937-0x0;var _0x1a0ad7=_0x5f3b[_0x5c4937];return _0x1a0ad7;};'use strict';var _=require(_0xb5f3('0x0'));var util=require(_0xb5f3('0x1'));var moment=require('moment');var BPromise=require(_0xb5f3('0x2'));var rs=require(_0xb5f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb5f3('0x4'));var logger=require(_0xb5f3('0x5'))(_0xb5f3('0x6'));var config=require('../../config/environment');var jayson=require(_0xb5f3('0x7'));var client=jayson[_0xb5f3('0x8')][_0xb5f3('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb5f3('0xa')],{'host':_0xb5f3('0xb'),'port':0x18eb});var socket=require(_0xb5f3('0xc'))(new Redis(config[_0xb5f3('0xa')]));require(_0xb5f3('0xd'))[_0xb5f3('0xe')](socket);function respondWithRpcPromise(_0x1dae6e,_0x11e20c,_0xfcc8d2){return new BPromise(function(_0x450928,_0x3bf28c){return client[_0xb5f3('0xf')](_0x1dae6e,_0xfcc8d2)['then'](function(_0x2b66cb){logger[_0xb5f3('0x10')](_0xb5f3('0x11'),_0x11e20c,_0xb5f3('0x12'));logger[_0xb5f3('0x13')](_0xb5f3('0x14'),_0x11e20c,'request\x20sent',JSON['stringify'](_0x2b66cb));if(_0x2b66cb[_0xb5f3('0x15')]){if(_0x2b66cb[_0xb5f3('0x15')][_0xb5f3('0x16')]===0x1f4){logger[_0xb5f3('0x15')](_0xb5f3('0x11'),_0x11e20c,_0x2b66cb[_0xb5f3('0x15')][_0xb5f3('0x17')]);return _0x3bf28c(_0x2b66cb['error'][_0xb5f3('0x17')]);}logger[_0xb5f3('0x15')]('CmList,\x20%s,\x20%s',_0x11e20c,_0x2b66cb[_0xb5f3('0x15')][_0xb5f3('0x17')]);return _0x450928(_0x2b66cb[_0xb5f3('0x15')][_0xb5f3('0x17')]);}else{logger[_0xb5f3('0x10')]('CmList,\x20%s,\x20%s',_0x11e20c,_0xb5f3('0x12'));_0x450928(_0x2b66cb['result']['message']);}})['catch'](function(_0x21e5db){logger['error'](_0xb5f3('0x11'),_0x11e20c,_0x21e5db);_0x3bf28c(_0x21e5db);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 63228d1..5c33531 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 _0xce0b=['register','cmList:','./cmList.events','save','remove','update','removeListener'];(function(_0x10e3f7,_0x353b97){var _0x3ee398=function(_0x16d5ce){while(--_0x16d5ce){_0x10e3f7['push'](_0x10e3f7['shift']());}};_0x3ee398(++_0x353b97);}(_0xce0b,0x191));var _0xbce0=function(_0x469741,_0x28bdb7){_0x469741=_0x469741-0x0;var _0x31d7e2=_0xce0b[_0x469741];return _0x31d7e2;};'use strict';var CmListEvents=require(_0xbce0('0x0'));var events=[_0xbce0('0x1'),_0xbce0('0x2'),_0xbce0('0x3')];function createListener(_0x14a0d4,_0x38aad0){return function(_0xe8fac4){_0x38aad0['emit'](_0x14a0d4,_0xe8fac4);};}function removeListener(_0x2699fc,_0x2f35c4){return function(){CmListEvents[_0xbce0('0x4')](_0x2699fc,_0x2f35c4);};}exports[_0xbce0('0x5')]=function(_0x2b0d80){for(var _0x44960f=0x0,_0x6695bd=events['length'];_0x44960f<_0x6695bd;_0x44960f++){var _0x52adc0=events[_0x44960f];var _0x53087c=createListener(_0xbce0('0x6')+_0x52adc0,_0x2b0d80);CmListEvents['on'](_0x52adc0,_0x53087c);}}; \ No newline at end of file +var _0x1161=['cmList:','./cmList.events','save','remove','update','register','length'];(function(_0x1ac197,_0x534cad){var _0x3ae75f=function(_0x39e825){while(--_0x39e825){_0x1ac197['push'](_0x1ac197['shift']());}};_0x3ae75f(++_0x534cad);}(_0x1161,0x189));var _0x1116=function(_0x4dbb87,_0x2e238f){_0x4dbb87=_0x4dbb87-0x0;var _0x2f6e90=_0x1161[_0x4dbb87];return _0x2f6e90;};'use strict';var CmListEvents=require(_0x1116('0x0'));var events=[_0x1116('0x1'),_0x1116('0x2'),_0x1116('0x3')];function createListener(_0xba83e4,_0x5cc3cd){return function(_0x532c96){_0x5cc3cd['emit'](_0xba83e4,_0x532c96);};}function removeListener(_0x2038ba,_0x559160){return function(){CmListEvents['removeListener'](_0x2038ba,_0x559160);};}exports[_0x1116('0x4')]=function(_0x5703f8){for(var _0x1bb559=0x0,_0x88afd6=events[_0x1116('0x5')];_0x1bb559<_0x88afd6;_0x1bb559++){var _0x4cd3b8=events[_0x1bb559];var _0x27c76c=createListener(_0x1116('0x6')+_0x4cd3b8,_0x5703f8);CmListEvents['on'](_0x4cd3b8,_0x27c76c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index dbc575f..e20f671 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 _0x60bb=['show','/:id/dispositions','getDispositions','/:id/contacts/csv','/:id/users','post','create','addDisposition','addContacts','/:id/fields','addCustomField','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/global_fields','getGlobalCustomFields','/:id'];(function(_0x566f7c,_0x21812f){var _0xad1a70=function(_0x2cd277){while(--_0x2cd277){_0x566f7c['push'](_0x566f7c['shift']());}};_0xad1a70(++_0x21812f);}(_0x60bb,0x164));var _0xb60b=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0x60bb[_0x42bafd];return _0x2ed705;};'use strict';var multer=require(_0xb60b('0x0'));var util=require(_0xb60b('0x1'));var path=require(_0xb60b('0x2'));var timeout=require(_0xb60b('0x3'));var express=require(_0xb60b('0x4'));var router=express[_0xb60b('0x5')]();var fs_extra=require(_0xb60b('0x6'));var auth=require(_0xb60b('0x7'));var interaction=require(_0xb60b('0x8'));var config=require(_0xb60b('0x9'));var controller=require(_0xb60b('0xa'));router[_0xb60b('0xb')]('/',auth[_0xb60b('0xc')](),controller['index']);router[_0xb60b('0xb')](_0xb60b('0xd'),auth[_0xb60b('0xc')](),controller[_0xb60b('0xe')]);router[_0xb60b('0xb')](_0xb60b('0xf'),auth['isAuthenticated'](),controller[_0xb60b('0x10')]);router['get'](_0xb60b('0x11'),auth['isAuthenticated'](),controller[_0xb60b('0x12')]);router[_0xb60b('0xb')](_0xb60b('0x13'),auth['isAuthenticated'](),controller[_0xb60b('0x14')]);router[_0xb60b('0xb')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0xb60b('0xb')](_0xb60b('0x15'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0xb60b('0xb')]('/:id/fields',auth[_0xb60b('0xc')](),controller['getCustomFields']);router[_0xb60b('0xb')](_0xb60b('0x16'),auth[_0xb60b('0xc')](),controller['getAgents']);router[_0xb60b('0x17')]('/',auth[_0xb60b('0xc')](),controller[_0xb60b('0x18')]);router['post'](_0xb60b('0x13'),auth['isAuthenticated'](),controller[_0xb60b('0x19')]);router[_0xb60b('0x17')]('/:id/contacts',auth[_0xb60b('0xc')](),controller[_0xb60b('0x1a')]);router[_0xb60b('0x17')](_0xb60b('0x1b'),auth[_0xb60b('0xc')](),controller[_0xb60b('0x1c')]);router['post'](_0xb60b('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0xb60b('0xc')](),controller[_0xb60b('0x1d')]);router[_0xb60b('0x1e')]('/:id',auth[_0xb60b('0xc')](),controller[_0xb60b('0x1f')]);router[_0xb60b('0x1e')](_0xb60b('0x13'),auth[_0xb60b('0xc')](),controller[_0xb60b('0x20')]);router[_0xb60b('0x1e')](_0xb60b('0x16'),auth[_0xb60b('0xc')](),controller[_0xb60b('0x21')]);module['exports']=router; \ No newline at end of file +var _0xb5cd=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','/global_fields','isAuthenticated','/:id/dispositions','getDispositions','getCustomFields','/:id/users','getAgents','post','create','/:id/contacts','addContacts','/:id/fields','addAgents','/:id','update','delete','removeDispositions','removeAgents','multer','util'];(function(_0x46b7d3,_0x2bac87){var _0x4639b0=function(_0x4920c7){while(--_0x4920c7){_0x46b7d3['push'](_0x46b7d3['shift']());}};_0x4639b0(++_0x2bac87);}(_0xb5cd,0x134));var _0xdb5c=function(_0x4a85fa,_0x2752b8){_0x4a85fa=_0x4a85fa-0x0;var _0x5dd57a=_0xb5cd[_0x4a85fa];return _0x5dd57a;};'use strict';var multer=require(_0xdb5c('0x0'));var util=require(_0xdb5c('0x1'));var path=require(_0xdb5c('0x2'));var timeout=require(_0xdb5c('0x3'));var express=require(_0xdb5c('0x4'));var router=express['Router']();var fs_extra=require(_0xdb5c('0x5'));var auth=require(_0xdb5c('0x6'));var interaction=require(_0xdb5c('0x7'));var config=require(_0xdb5c('0x8'));var controller=require(_0xdb5c('0x9'));router[_0xdb5c('0xa')]('/',auth['isAuthenticated'](),controller[_0xdb5c('0xb')]);router[_0xdb5c('0xa')](_0xdb5c('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xdb5c('0xa')](_0xdb5c('0xd'),auth[_0xdb5c('0xe')](),controller['getGlobalCustomFields']);router[_0xdb5c('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdb5c('0xa')](_0xdb5c('0xf'),auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x10')]);router[_0xdb5c('0xa')]('/:id/contacts',auth[_0xdb5c('0xe')](),controller['getContacts']);router[_0xdb5c('0xa')]('/:id/contacts/csv',auth['isAuthenticated'](),controller['getContactsCsv']);router['get']('/:id/fields',auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x11')]);router['get'](_0xdb5c('0x12'),auth['isAuthenticated'](),controller[_0xdb5c('0x13')]);router[_0xdb5c('0x14')]('/',auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x15')]);router[_0xdb5c('0x14')]('/:id/dispositions',auth[_0xdb5c('0xe')](),controller['addDisposition']);router[_0xdb5c('0x14')](_0xdb5c('0x16'),auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x17')]);router[_0xdb5c('0x14')](_0xdb5c('0x18'),auth['isAuthenticated'](),controller['addCustomField']);router[_0xdb5c('0x14')](_0xdb5c('0x12'),auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x19')]);router['put'](_0xdb5c('0x1a'),auth['isAuthenticated'](),controller[_0xdb5c('0x1b')]);router[_0xdb5c('0x1c')](_0xdb5c('0x1a'),auth[_0xdb5c('0xe')](),controller['destroy']);router[_0xdb5c('0x1c')](_0xdb5c('0xf'),auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x1d')]);router[_0xdb5c('0x1c')](_0xdb5c('0x12'),auth[_0xdb5c('0xe')](),controller[_0xdb5c('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 56bd060..c9c5524 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 _0xdd9c=['STRING','VIRTUAL','getDataValue','field'];(function(_0x22900c,_0x57bcce){var _0x52cab1=function(_0x15ca79){while(--_0x15ca79){_0x22900c['push'](_0x22900c['shift']());}};_0x52cab1(++_0x57bcce);}(_0xdd9c,0xd9));var _0xcdd9=function(_0x5e6941,_0xc3a94c){_0x5e6941=_0x5e6941-0x0;var _0x55e3bd=_0xdd9c[_0x5e6941];return _0x55e3bd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcdd9('0x0')],'get':function(_0xa4b460){return this[_0xcdd9('0x1')](_0xcdd9('0x2'));}},'field':{'type':Sequelize[_0xcdd9('0x3')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xcdd9('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xc0ba=['sequelize','VIRTUAL','getDataValue','field','STRING'];(function(_0x46e523,_0xe6fccb){var _0x5da0ee=function(_0x396682){while(--_0x396682){_0x46e523['push'](_0x46e523['shift']());}};_0x5da0ee(++_0xe6fccb);}(_0xc0ba,0x177));var _0xac0b=function(_0x193a6e,_0x45dd00){_0x193a6e=_0x193a6e-0x0;var _0x599a9b=_0xc0ba[_0x193a6e];return _0x599a9b;};'use strict';var Sequelize=require(_0xac0b('0x0'));module['exports']={'name':{'type':Sequelize[_0xac0b('0x1')],'get':function(_0x6b3dc3){return this[_0xac0b('0x2')](_0xac0b('0x3'));}},'field':{'type':Sequelize[_0xac0b('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'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 55f1b4b..7f0bae5 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x2f4ae8,_0x26433f){var _0x2dc376=function(_0x3d9023){while(--_0x3d9023){_0x2f4ae8['push'](_0x2f4ae8['shift']());}};_0x2dc376(++_0x26433f);}(_0x7a54,0x106));var _0x47a5=function(_0x1b9b79,_0x17897a){_0x1b9b79=_0x1b9b79-0x0;var _0x458e25=_0x7a54[_0x1b9b79];return _0x458e25;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x374c10,_0xb65e4d){var _0x14a829=function(_0x1e41fe){while(--_0x1e41fe){_0x374c10['push'](_0x374c10['shift']());}};_0x14a829(++_0xb65e4d);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 2f7567f..eb5de87 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 _0x3cfc=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions'];(function(_0x8f18a0,_0x9f73ae){var _0xee9fc5=function(_0x4a8ee6){while(--_0x4a8ee6){_0x8f18a0['push'](_0x8f18a0['shift']());}};_0xee9fc5(++_0x9f73ae);}(_0x3cfc,0x155));var _0xc3cf=function(_0x1cd155,_0x206f1a){_0x1cd155=_0x1cd155-0x0;var _0x4ab090=_0x3cfc[_0x1cd155];return _0x4ab090;};'use strict';var _=require(_0xc3cf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc3cf('0x1'));var BPromise=require(_0xc3cf('0x2'));var rp=require(_0xc3cf('0x3'));var fs=require('fs');var path=require(_0xc3cf('0x4'));var rimraf=require(_0xc3cf('0x5'));var config=require(_0xc3cf('0x6'));var attributes=require(_0xc3cf('0x7'));module[_0xc3cf('0x8')]=function(_0xd56c3,_0x185290){return _0xd56c3[_0xc3cf('0x9')]('Condition',attributes,{'tableName':_0xc3cf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb22=['./condition.attributes','exports','tools_conditions','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x10986c,_0xc98154){var _0x344f39=function(_0x34b804){while(--_0x34b804){_0x10986c['push'](_0x10986c['shift']());}};_0x344f39(++_0xc98154);}(_0xdb22,0x1dc));var _0x2db2=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdb22[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x2db2('0x0'));var logger=require(_0x2db2('0x1'))(_0x2db2('0x2'));var moment=require(_0x2db2('0x3'));var BPromise=require('bluebird');var rp=require(_0x2db2('0x4'));var fs=require('fs');var path=require(_0x2db2('0x5'));var rimraf=require(_0x2db2('0x6'));var config=require(_0x2db2('0x7'));var attributes=require(_0x2db2('0x8'));module[_0x2db2('0x9')]=function(_0x2ba3f3,_0x3db1f4){return _0x2ba3f3['define']('Condition',attributes,{'tableName':_0x2db2('0xa'),'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 6fadc17..269cb84 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 _0x52a4=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x1eb7da,_0x1f73bc){var _0x20dc66=function(_0x2a4e02){while(--_0x2a4e02){_0x1eb7da['push'](_0x1eb7da['shift']());}};_0x20dc66(++_0x1f73bc);}(_0x52a4,0x183));var _0x452a=function(_0x6aeb10,_0x1f209e){_0x6aeb10=_0x6aeb10-0x0;var _0x4dcb8d=_0x52a4[_0x6aeb10];return _0x4dcb8d;};'use strict';var _=require(_0x452a('0x0'));var util=require(_0x452a('0x1'));var moment=require(_0x452a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x452a('0x3'));var db=require(_0x452a('0x4'))['db'];var utils=require(_0x452a('0x5'));var logger=require(_0x452a('0x6'))(_0x452a('0x7'));var config=require(_0x452a('0x8'));var jayson=require(_0x452a('0x9'));var client=jayson[_0x452a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3746f8,_0x19885e,_0xe78a20){return new BPromise(function(_0x507053,_0x4e2bd0){return client[_0x452a('0xb')](_0x3746f8,_0xe78a20)[_0x452a('0xc')](function(_0x5eb5db){logger[_0x452a('0xd')](_0x452a('0xe'),_0x19885e,_0x452a('0xf'));logger[_0x452a('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x19885e,_0x452a('0xf'),JSON[_0x452a('0x11')](_0x5eb5db));if(_0x5eb5db[_0x452a('0x12')]){if(_0x5eb5db[_0x452a('0x12')][_0x452a('0x13')]===0x1f4){logger[_0x452a('0x12')](_0x452a('0xe'),_0x19885e,_0x5eb5db[_0x452a('0x12')][_0x452a('0x14')]);return _0x4e2bd0(_0x5eb5db['error']['message']);}logger[_0x452a('0x12')](_0x452a('0xe'),_0x19885e,_0x5eb5db['error']['message']);return _0x507053(_0x5eb5db[_0x452a('0x12')][_0x452a('0x14')]);}else{logger[_0x452a('0xd')](_0x452a('0xe'),_0x19885e,'request\x20sent');_0x507053(_0x5eb5db[_0x452a('0x15')][_0x452a('0x14')]);}})[_0x452a('0x16')](function(_0x157675){logger[_0x452a('0x12')](_0x452a('0xe'),_0x19885e,_0x157675);_0x4e2bd0(_0x157675);});});} \ No newline at end of file +var _0xdb46=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x40197b,_0x4e763f){var _0x3b9c2f=function(_0x41c34f){while(--_0x41c34f){_0x40197b['push'](_0x40197b['shift']());}};_0x3b9c2f(++_0x4e763f);}(_0xdb46,0x1f1));var _0x6db4=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0xdb46[_0x318840];return _0x223da4;};'use strict';var _=require(_0x6db4('0x0'));var util=require('util');var moment=require(_0x6db4('0x1'));var BPromise=require('bluebird');var rs=require(_0x6db4('0x2'));var fs=require('fs');var Redis=require(_0x6db4('0x3'));var db=require(_0x6db4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6db4('0x5'))(_0x6db4('0x6'));var config=require(_0x6db4('0x7'));var jayson=require(_0x6db4('0x8'));var client=jayson[_0x6db4('0x9')][_0x6db4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x245671,_0xefb0f3,_0x2586ed){return new BPromise(function(_0x4acc5d,_0x170019){return client[_0x6db4('0xb')](_0x245671,_0x2586ed)[_0x6db4('0xc')](function(_0x361b75){logger[_0x6db4('0xd')]('Condition,\x20%s,\x20%s',_0xefb0f3,_0x6db4('0xe'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0xefb0f3,_0x6db4('0xe'),JSON['stringify'](_0x361b75));if(_0x361b75[_0x6db4('0xf')]){if(_0x361b75[_0x6db4('0xf')][_0x6db4('0x10')]===0x1f4){logger[_0x6db4('0xf')](_0x6db4('0x11'),_0xefb0f3,_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);return _0x170019(_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);}logger['error'](_0x6db4('0x11'),_0xefb0f3,_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);return _0x4acc5d(_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);}else{logger['info'](_0x6db4('0x11'),_0xefb0f3,'request\x20sent');_0x4acc5d(_0x361b75[_0x6db4('0x13')]['message']);}})[_0x6db4('0x14')](function(_0x40e003){logger[_0x6db4('0xf')]('Condition,\x20%s,\x20%s',_0xefb0f3,_0x40e003);_0x170019(_0x40e003);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 796cece..ed5b305 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 _0xea8e=['../../components/interaction/service','./condition.controller','put','isAuthenticated','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x41a898,_0x4b90b8){var _0x3c1bf9=function(_0x415464){while(--_0x415464){_0x41a898['push'](_0x41a898['shift']());}};_0x3c1bf9(++_0x4b90b8);}(_0xea8e,0x140));var _0xeea8=function(_0x5ea7e0,_0x2f46f2){_0x5ea7e0=_0x5ea7e0-0x0;var _0x1c49c7=_0xea8e[_0x5ea7e0];return _0x1c49c7;};'use strict';var multer=require(_0xeea8('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeea8('0x1'));var router=express[_0xeea8('0x2')]();var fs_extra=require(_0xeea8('0x3'));var auth=require(_0xeea8('0x4'));var interaction=require(_0xeea8('0x5'));var config=require('../../config/environment');var controller=require(_0xeea8('0x6'));router[_0xeea8('0x7')]('/:id',auth[_0xeea8('0x8')](),controller[_0xeea8('0x9')]);router[_0xeea8('0xa')]('/:id',auth[_0xeea8('0x8')](),controller[_0xeea8('0xb')]);module[_0xeea8('0xc')]=router; \ No newline at end of file +var _0x30f9=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x4362a6,_0x5a8775){var _0x4e0f9d=function(_0x112c7a){while(--_0x112c7a){_0x4362a6['push'](_0x4362a6['shift']());}};_0x4e0f9d(++_0x5a8775);}(_0x30f9,0x96));var _0x930f=function(_0x1bd230,_0x1da01e){_0x1bd230=_0x1bd230-0x0;var _0x19a3e3=_0x30f9[_0x1bd230];return _0x19a3e3;};'use strict';var multer=require(_0x930f('0x0'));var util=require(_0x930f('0x1'));var path=require(_0x930f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x930f('0x3')]();var fs_extra=require(_0x930f('0x4'));var auth=require(_0x930f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x930f('0x6'));var controller=require(_0x930f('0x7'));router[_0x930f('0x8')](_0x930f('0x9'),auth[_0x930f('0xa')](),controller[_0x930f('0xb')]);router[_0x930f('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);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 3db97d6..33ac149 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 _0xaed3=['sequelize','STRING','name','INTEGER'];(function(_0x4f8127,_0x56baec){var _0x5acf5e=function(_0x476754){while(--_0x476754){_0x4f8127['push'](_0x4f8127['shift']());}};_0x5acf5e(++_0x56baec);}(_0xaed3,0xb0));var _0x3aed=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0xaed3[_0x240261];return _0x45c332;};'use strict';var Sequelize=require(_0x3aed('0x0'));module['exports']={'name':{'type':Sequelize[_0x3aed('0x1')],'allowNull':![],'unique':_0x3aed('0x2')},'OrderBy':{'type':Sequelize[_0x3aed('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3aed('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x6e15=['sequelize','exports','name','STRING'];(function(_0x592e79,_0x13488b){var _0x2420a8=function(_0x3f7bf5){while(--_0x3f7bf5){_0x592e79['push'](_0x592e79['shift']());}};_0x2420a8(++_0x13488b);}(_0x6e15,0xf8));var _0x56e1=function(_0x590ec2,_0x3c8c69){_0x590ec2=_0x590ec2-0x0;var _0xe06bff=_0x6e15[_0x590ec2];return _0xe06bff;};'use strict';var Sequelize=require(_0x56e1('0x0'));module[_0x56e1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x56e1('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x56e1('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 875b992..40fcca8 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 _0x781d=['find','CmContactHasItem','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','get','stack','name','send','index','ContactItemType','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4cefbf,_0x82b6ef){var _0x14c78f=function(_0x2e41b7){while(--_0x2e41b7){_0x4cefbf['push'](_0x4cefbf['shift']());}};_0x14c78f(++_0x82b6ef);}(_0x781d,0x14a));var _0xd781=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x781d[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){var _0x221f14=_0x31bf57[_0xd781('0x27')]({'plain':!![]});var _0x10940b='ContactItemTypes';return db['UserProfileResource'][_0xd781('0x25')]({'where':{'type':_0x10940b,'resourceId':_0x221f14['id']}})[_0xd781('0x26')](function(){return _0x31bf57;});})[_0xd781('0x26')](function(){_0x101480['status'](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x5a431b,_0x47c609){return function(_0x1e29c8){if(!_0x1e29c8){_0x5a431b['sendStatus'](0x194);}return _0x1e29c8;};}function handleError(_0x3e868,_0x123a6a){_0x123a6a=_0x123a6a||0x1f4;return function(_0x5c3848){logger['error'](_0x5c3848[_0xd781('0x28')]);if(_0x5c3848['name']){delete _0x5c3848[_0xd781('0x29')];}_0x3e868['status'](_0x123a6a)[_0xd781('0x2a')](_0x5c3848);};}exports[_0xd781('0x2b')]=function(_0x556127,_0x54521e){var _0x432d14={},_0x29e81a={},_0x1c7d83={'count':0x0,'rows':[]};var _0x5a389c=_['map'](db[_0xd781('0x2c')][_0xd781('0x2d')],function(_0x36a889){return{'name':_0x36a889['fieldName'],'type':_0x36a889['type'][_0xd781('0x2e')]};});_0x29e81a[_0xd781('0x2f')]=_['map'](_0x5a389c,_0xd781('0x29'));_0x29e81a[_0xd781('0x30')]=_['keys'](_0x556127[_0xd781('0x30')]);_0x29e81a[_0xd781('0x31')]=_[_0xd781('0x32')](_0x29e81a[_0xd781('0x2f')],_0x29e81a['query']);_0x432d14[_0xd781('0x33')]=_[_0xd781('0x32')](_0x29e81a[_0xd781('0x2f')],qs[_0xd781('0x34')](_0x556127['query'][_0xd781('0x34')]));_0x432d14[_0xd781('0x33')]=_0x432d14['attributes'][_0xd781('0x35')]?_0x432d14['attributes']:_0x29e81a[_0xd781('0x2f')];if(!_0x556127[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x36'))){_0x432d14[_0xd781('0x1e')]=qs['limit'](_0x556127[_0xd781('0x30')]['limit']);_0x432d14[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x556127['query'][_0xd781('0x1c')]);}_0x432d14[_0xd781('0x37')]=qs['sort'](_0x556127[_0xd781('0x30')][_0xd781('0x38')]);_0x432d14[_0xd781('0x39')]=qs['filters'](_[_0xd781('0x3a')](_0x556127[_0xd781('0x30')],_0x29e81a[_0xd781('0x31')]),_0x5a389c);if(_0x556127[_0xd781('0x30')][_0xd781('0x3b')]){_0x432d14[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x432d14[_0xd781('0x39')],{'$or':_[_0xd781('0x3d')](_0x5a389c,function(_0x5c6026){if(_0x5c6026[_0xd781('0x3e')]!=='VIRTUAL'){var _0x2504ac={};_0x2504ac[_0x5c6026[_0xd781('0x29')]]={'$like':'%'+_0x556127['query'][_0xd781('0x3b')]+'%'};return _0x2504ac;}})});}_0x432d14=_[_0xd781('0x3c')]({},_0x432d14,_0x556127[_0xd781('0x3f')]);var _0x402c9c={'where':_0x432d14['where']};return db[_0xd781('0x2c')]['count'](_0x402c9c)[_0xd781('0x26')](function(_0xcdaacf){_0x1c7d83['count']=_0xcdaacf;if(_0x556127['query'][_0xd781('0x40')]){_0x432d14[_0xd781('0x41')]=[{'all':!![]}];}return db[_0xd781('0x2c')][_0xd781('0x42')](_0x432d14);})['then'](function(_0x46e7f6){_0x1c7d83[_0xd781('0x43')]=_0x46e7f6;return _0x1c7d83;})['then'](respondWithFilteredResult(_0x54521e,_0x432d14))['catch'](handleError(_0x54521e,null));};exports[_0xd781('0x44')]=function(_0x1d901e,_0xaa552){var _0x4e2eea={'raw':!![],'where':{'id':_0x1d901e[_0xd781('0x45')]['id']}},_0x594f85={};_0x594f85[_0xd781('0x2f')]=_[_0xd781('0x46')](db[_0xd781('0x2c')][_0xd781('0x2d')]);_0x594f85[_0xd781('0x30')]=_['keys'](_0x1d901e['query']);_0x594f85[_0xd781('0x31')]=_[_0xd781('0x32')](_0x594f85[_0xd781('0x2f')],_0x594f85[_0xd781('0x30')]);_0x4e2eea[_0xd781('0x33')]=_['intersection'](_0x594f85[_0xd781('0x2f')],qs[_0xd781('0x34')](_0x1d901e[_0xd781('0x30')]['fields']));_0x4e2eea[_0xd781('0x33')]=_0x4e2eea[_0xd781('0x33')][_0xd781('0x35')]?_0x4e2eea['attributes']:_0x594f85[_0xd781('0x2f')];if(_0x1d901e[_0xd781('0x30')]['includeAll']){_0x4e2eea['include']=[{'all':!![]}];}_0x4e2eea=_[_0xd781('0x3c')]({},_0x4e2eea,_0x1d901e[_0xd781('0x3f')]);return db[_0xd781('0x2c')]['find'](_0x4e2eea)[_0xd781('0x26')](handleEntityNotFound(_0xaa552,null))[_0xd781('0x26')](respondWithResult(_0xaa552,null))[_0xd781('0x47')](handleError(_0xaa552,null));};exports[_0xd781('0x48')]=function(_0x336d30,_0x3828ad){return db[_0xd781('0x2c')]['create'](_0x336d30[_0xd781('0x49')],{})[_0xd781('0x26')](function(_0x1d54bd){var _0x4c7cb6=_0x336d30[_0xd781('0x4a')][_0xd781('0x27')]({'plain':!![]});if(!_0x4c7cb6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c7cb6[_0xd781('0x4b')]===_0xd781('0x4a')){var _0x41caac=_0x1d54bd[_0xd781('0x27')]({'plain':!![]});var _0x42a2f9='ContactItemTypes';return db[_0xd781('0x4c')]['find']({'where':{'name':_0x42a2f9,'userProfileId':_0x4c7cb6[_0xd781('0x4d')]},'raw':!![]})['then'](function(_0x2ce1f6){if(_0x2ce1f6&&_0x2ce1f6[_0xd781('0x4e')]===0x0){return db['UserProfileResource'][_0xd781('0x48')]({'name':_0x41caac['name'],'resourceId':_0x41caac['id'],'type':_0x2ce1f6['name'],'sectionId':_0x2ce1f6['id']},{})['then'](function(){return _0x1d54bd;});}else{return _0x1d54bd;}})[_0xd781('0x47')](function(_0x174fcd){logger['error'](_0xd781('0x4f'),_0x174fcd);throw _0x174fcd;});}return _0x1d54bd;})['then'](respondWithResult(_0x3828ad,0xc9))[_0xd781('0x47')](handleError(_0x3828ad,null));};exports[_0xd781('0x24')]=function(_0x39d47d,_0x19a6c2){if(_0x39d47d['body']['id']){delete _0x39d47d[_0xd781('0x49')]['id'];}return db['ContactItemType'][_0xd781('0x50')]({'where':{'id':_0x39d47d['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0x19a6c2,null))[_0xd781('0x26')](saveUpdates(_0x39d47d['body'],null))[_0xd781('0x26')](respondWithResult(_0x19a6c2,null))[_0xd781('0x47')](handleError(_0x19a6c2,null));};exports[_0xd781('0x25')]=function(_0x32fd9f,_0xfc466c){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x32fd9f['params']['id']}})[_0xd781('0x26')](handleEntityNotFound(_0xfc466c,null))[_0xd781('0x26')](db[_0xd781('0x51')][_0xd781('0x24')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x32fd9f['params']['id']}}))[_0xd781('0x26')](removeEntity(_0xfc466c,null))['catch'](handleError(_0xfc466c,null));}; \ No newline at end of file +var _0x7708=['util','path','to-csv','fs-extra','lodash','squel','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','offset','count','limit','set','apply','save','update','then','destroy','ContactItemTypes','UserProfileResource','error','stack','send','index','map','ContactItemType','key','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','show','params','rawAttributes','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','fast-json-patch'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0x7708,0x188));var _0x8770=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x7708[_0x47e7cb];return _0x2a8874;};'use strict';var emlformat=require(_0x8770('0x0'));var rimraf=require(_0x8770('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8770('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8770('0x3'));var path=require(_0x8770('0x4'));var sox=require('sox');var csv=require(_0x8770('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8770('0x6'));var _=require(_0x8770('0x7'));var squel=require(_0x8770('0x8'));var crypto=require(_0x8770('0x9'));var jsforce=require(_0x8770('0xa'));var deskjs=require(_0x8770('0xb'));var toCsv=require(_0x8770('0x5'));var querystring=require('querystring');var Papa=require(_0x8770('0xc'));var Redis=require(_0x8770('0xd'));var authService=require(_0x8770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8770('0xf'));var hardwareService=require(_0x8770('0x10'));var logger=require(_0x8770('0x11'))(_0x8770('0x12'));var utils=require('../../config/utils');var config=require(_0x8770('0x13'));var licenseUtil=require(_0x8770('0x14'));var db=require(_0x8770('0x15'))['db'];function respondWithStatusCode(_0x51efbc,_0xb52d60){_0xb52d60=_0xb52d60||0xcc;return function(_0x455a65){if(_0x455a65){return _0x51efbc[_0x8770('0x16')](_0xb52d60);}return _0x51efbc[_0x8770('0x17')](_0xb52d60)[_0x8770('0x18')]();};}function respondWithResult(_0x12a06f,_0x1ce41d){_0x1ce41d=_0x1ce41d||0xc8;return function(_0x12439f){if(_0x12439f){return _0x12a06f['status'](_0x1ce41d)[_0x8770('0x19')](_0x12439f);}};}function respondWithFilteredResult(_0x106a20,_0x5dd4e7){return function(_0x2f7918){if(_0x2f7918){var _0x52254f=typeof _0x5dd4e7[_0x8770('0x1a')]==='undefined'&&typeof _0x5dd4e7['limit']==='undefined';var _0x155e83=_0x2f7918[_0x8770('0x1b')];var _0x17b634=_0x52254f?0x0:_0x5dd4e7[_0x8770('0x1a')];var _0x4b0691=_0x52254f?_0x2f7918['count']:_0x5dd4e7[_0x8770('0x1a')]+_0x5dd4e7[_0x8770('0x1c')];var _0x26cbcd;if(_0x4b0691>=_0x155e83){_0x4b0691=_0x155e83;_0x26cbcd=0xc8;}else{_0x26cbcd=0xce;}_0x106a20[_0x8770('0x17')](_0x26cbcd);return _0x106a20[_0x8770('0x1d')]('Content-Range',_0x17b634+'-'+_0x4b0691+'/'+_0x155e83)[_0x8770('0x19')](_0x2f7918);}return null;};}function patchUpdates(_0x1234dd){return function(_0x384b1e){try{jsonpatch[_0x8770('0x1e')](_0x384b1e,_0x1234dd,!![]);}catch(_0x582048){return BPromise['reject'](_0x582048);}return _0x384b1e[_0x8770('0x1f')]();};}function saveUpdates(_0x348e2f,_0x443716){return function(_0x2918a7){if(_0x2918a7){return _0x2918a7[_0x8770('0x20')](_0x348e2f)[_0x8770('0x21')](function(_0x5819dc){return _0x5819dc;});}return null;};}function removeEntity(_0x468fc0,_0x23ad66){return function(_0x4274dd){if(_0x4274dd){return _0x4274dd[_0x8770('0x22')]()['then'](function(){var _0x460474=_0x4274dd['get']({'plain':!![]});var _0x7b4755=_0x8770('0x23');return db[_0x8770('0x24')][_0x8770('0x22')]({'where':{'type':_0x7b4755,'resourceId':_0x460474['id']}})[_0x8770('0x21')](function(){return _0x4274dd;});})[_0x8770('0x21')](function(){_0x468fc0[_0x8770('0x17')](0xcc)[_0x8770('0x18')]();});}};}function handleEntityNotFound(_0xb3f4aa,_0xa480){return function(_0x5f4973){if(!_0x5f4973){_0xb3f4aa[_0x8770('0x16')](0x194);}return _0x5f4973;};}function handleError(_0x199b96,_0x1df627){_0x1df627=_0x1df627||0x1f4;return function(_0x5c7bd){logger[_0x8770('0x25')](_0x5c7bd[_0x8770('0x26')]);if(_0x5c7bd['name']){delete _0x5c7bd['name'];}_0x199b96[_0x8770('0x17')](_0x1df627)[_0x8770('0x27')](_0x5c7bd);};}exports[_0x8770('0x28')]=function(_0x365080,_0x23f4b0){var _0x4bc072={},_0x5282dd={},_0x45fff4={'count':0x0,'rows':[]};var _0x144c24=_[_0x8770('0x29')](db[_0x8770('0x2a')]['rawAttributes'],function(_0x2f4e44){return{'name':_0x2f4e44['fieldName'],'type':_0x2f4e44['type'][_0x8770('0x2b')]};});_0x5282dd['model']=_[_0x8770('0x29')](_0x144c24,_0x8770('0x2c'));_0x5282dd[_0x8770('0x2d')]=_[_0x8770('0x2e')](_0x365080[_0x8770('0x2d')]);_0x5282dd[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],_0x5282dd[_0x8770('0x2d')]);_0x4bc072['attributes']=_[_0x8770('0x30')](_0x5282dd[_0x8770('0x31')],qs[_0x8770('0x32')](_0x365080['query']['fields']));_0x4bc072[_0x8770('0x33')]=_0x4bc072[_0x8770('0x33')][_0x8770('0x34')]?_0x4bc072['attributes']:_0x5282dd[_0x8770('0x31')];if(!_0x365080['query'][_0x8770('0x35')](_0x8770('0x36'))){_0x4bc072[_0x8770('0x1c')]=qs[_0x8770('0x1c')](_0x365080[_0x8770('0x2d')][_0x8770('0x1c')]);_0x4bc072[_0x8770('0x1a')]=qs[_0x8770('0x1a')](_0x365080[_0x8770('0x2d')][_0x8770('0x1a')]);}_0x4bc072['order']=qs[_0x8770('0x37')](_0x365080[_0x8770('0x2d')][_0x8770('0x37')]);_0x4bc072['where']=qs[_0x8770('0x2f')](_[_0x8770('0x38')](_0x365080[_0x8770('0x2d')],_0x5282dd[_0x8770('0x2f')]),_0x144c24);if(_0x365080[_0x8770('0x2d')][_0x8770('0x39')]){_0x4bc072['where']=_[_0x8770('0x3a')](_0x4bc072['where'],{'$or':_[_0x8770('0x29')](_0x144c24,function(_0x57f52e){if(_0x57f52e[_0x8770('0x3b')]!==_0x8770('0x3c')){var _0x306142={};_0x306142[_0x57f52e['name']]={'$like':'%'+_0x365080[_0x8770('0x2d')][_0x8770('0x39')]+'%'};return _0x306142;}})});}_0x4bc072=_[_0x8770('0x3a')]({},_0x4bc072,_0x365080[_0x8770('0x3d')]);var _0x408e86={'where':_0x4bc072[_0x8770('0x3e')]};return db['ContactItemType'][_0x8770('0x1b')](_0x408e86)['then'](function(_0x4bcfc7){_0x45fff4[_0x8770('0x1b')]=_0x4bcfc7;if(_0x365080[_0x8770('0x2d')][_0x8770('0x3f')]){_0x4bc072[_0x8770('0x40')]=[{'all':!![]}];}return db[_0x8770('0x2a')]['findAll'](_0x4bc072);})[_0x8770('0x21')](function(_0x26ae1b){_0x45fff4['rows']=_0x26ae1b;return _0x45fff4;})[_0x8770('0x21')](respondWithFilteredResult(_0x23f4b0,_0x4bc072))['catch'](handleError(_0x23f4b0,null));};exports[_0x8770('0x41')]=function(_0x6bfa55,_0xc29c65){var _0x39c0d3={'raw':!![],'where':{'id':_0x6bfa55[_0x8770('0x42')]['id']}},_0x29dae5={};_0x29dae5[_0x8770('0x31')]=_[_0x8770('0x2e')](db[_0x8770('0x2a')][_0x8770('0x43')]);_0x29dae5[_0x8770('0x2d')]=_['keys'](_0x6bfa55[_0x8770('0x2d')]);_0x29dae5[_0x8770('0x2f')]=_[_0x8770('0x30')](_0x29dae5[_0x8770('0x31')],_0x29dae5[_0x8770('0x2d')]);_0x39c0d3[_0x8770('0x33')]=_['intersection'](_0x29dae5[_0x8770('0x31')],qs[_0x8770('0x32')](_0x6bfa55[_0x8770('0x2d')][_0x8770('0x32')]));_0x39c0d3[_0x8770('0x33')]=_0x39c0d3[_0x8770('0x33')][_0x8770('0x34')]?_0x39c0d3[_0x8770('0x33')]:_0x29dae5['model'];if(_0x6bfa55[_0x8770('0x2d')][_0x8770('0x3f')]){_0x39c0d3[_0x8770('0x40')]=[{'all':!![]}];}_0x39c0d3=_[_0x8770('0x3a')]({},_0x39c0d3,_0x6bfa55[_0x8770('0x3d')]);return db['ContactItemType']['find'](_0x39c0d3)[_0x8770('0x21')](handleEntityNotFound(_0xc29c65,null))['then'](respondWithResult(_0xc29c65,null))[_0x8770('0x44')](handleError(_0xc29c65,null));};exports['create']=function(_0x4f9e0b,_0x3805d8){return db[_0x8770('0x2a')][_0x8770('0x45')](_0x4f9e0b[_0x8770('0x46')],{})['then'](function(_0x136cc1){var _0x48dea0=_0x4f9e0b['user']['get']({'plain':!![]});if(!_0x48dea0)throw new Error(_0x8770('0x47'));if(_0x48dea0[_0x8770('0x48')]===_0x8770('0x49')){var _0x4f5cb8=_0x136cc1[_0x8770('0x4a')]({'plain':!![]});var _0x5b6638=_0x8770('0x23');return db[_0x8770('0x4b')][_0x8770('0x4c')]({'where':{'name':_0x5b6638,'userProfileId':_0x48dea0['userProfileId']},'raw':!![]})[_0x8770('0x21')](function(_0x5de11e){if(_0x5de11e&&_0x5de11e['autoAssociation']===0x0){return db['UserProfileResource'][_0x8770('0x45')]({'name':_0x4f5cb8[_0x8770('0x2c')],'resourceId':_0x4f5cb8['id'],'type':_0x5de11e[_0x8770('0x2c')],'sectionId':_0x5de11e['id']},{})[_0x8770('0x21')](function(){return _0x136cc1;});}else{return _0x136cc1;}})[_0x8770('0x44')](function(_0x1df5cd){logger['error'](_0x8770('0x4d'),_0x1df5cd);throw _0x1df5cd;});}return _0x136cc1;})['then'](respondWithResult(_0x3805d8,0xc9))[_0x8770('0x44')](handleError(_0x3805d8,null));};exports[_0x8770('0x20')]=function(_0x475e9d,_0x3e4f77){if(_0x475e9d['body']['id']){delete _0x475e9d[_0x8770('0x46')]['id'];}return db[_0x8770('0x2a')]['find']({'where':{'id':_0x475e9d['params']['id']}})['then'](handleEntityNotFound(_0x3e4f77,null))['then'](saveUpdates(_0x475e9d[_0x8770('0x46')],null))[_0x8770('0x21')](respondWithResult(_0x3e4f77,null))['catch'](handleError(_0x3e4f77,null));};exports[_0x8770('0x22')]=function(_0x38b68f,_0x435c23){return db[_0x8770('0x2a')][_0x8770('0x4c')]({'where':{'id':_0x38b68f[_0x8770('0x42')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x435c23,null))[_0x8770('0x21')](db[_0x8770('0x4e')][_0x8770('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x38b68f[_0x8770('0x42')]['id']}}))['then'](removeEntity(_0x435c23,null))[_0x8770('0x44')](handleError(_0x435c23,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 002d988..c553734 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 _0x6c81=['rimraf','../../config/environment','exports','define','tools_contact_item_types','../../config/logger','api','moment','request-promise','path'];(function(_0x5c7a09,_0x61180b){var _0x3c102f=function(_0x1916bf){while(--_0x1916bf){_0x5c7a09['push'](_0x5c7a09['shift']());}};_0x3c102f(++_0x61180b);}(_0x6c81,0x181));var _0x16c8=function(_0x1308ec,_0x32c99e){_0x1308ec=_0x1308ec-0x0;var _0x1a43c8=_0x6c81[_0x1308ec];return _0x1a43c8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x16c8('0x0'))(_0x16c8('0x1'));var moment=require(_0x16c8('0x2'));var BPromise=require('bluebird');var rp=require(_0x16c8('0x3'));var fs=require('fs');var path=require(_0x16c8('0x4'));var rimraf=require(_0x16c8('0x5'));var config=require(_0x16c8('0x6'));var attributes=require('./contactItemType.attributes');module[_0x16c8('0x7')]=function(_0x4316fc,_0x473483){return _0x4316fc[_0x16c8('0x8')]('ContactItemType',attributes,{'tableName':_0x16c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f4b=['define','lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x14ef5f,_0x1123b8){var _0x2c4ee0=function(_0x4a29f6){while(--_0x4a29f6){_0x14ef5f['push'](_0x14ef5f['shift']());}};_0x2c4ee0(++_0x1123b8);}(_0x8f4b,0x189));var _0xb8f4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8f4b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb8f4('0x0'));var util=require('util');var logger=require(_0xb8f4('0x1'))('api');var moment=require(_0xb8f4('0x2'));var BPromise=require(_0xb8f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb8f4('0x4'));var config=require(_0xb8f4('0x5'));var attributes=require('./contactItemType.attributes');module[_0xb8f4('0x6')]=function(_0x30483e,_0x2d0737){return _0x30483e[_0xb8f4('0x7')]('ContactItemType',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 c1e5b7a..214c125 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 _0x3715=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x34a209,_0x2956c1){var _0x394785=function(_0xf136ae){while(--_0xf136ae){_0x34a209['push'](_0x34a209['shift']());}};_0x394785(++_0x2956c1);}(_0x3715,0xc3));var _0x5371=function(_0x55a85f,_0x48c076){_0x55a85f=_0x55a85f-0x0;var _0x46cd73=_0x3715[_0x55a85f];return _0x46cd73;};'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')]('ContactItemType,\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 +var _0xb973=['error','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0xb973,0xc9));var _0x3b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb973[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b97('0x0'));var util=require('util');var moment=require(_0x3b97('0x1'));var BPromise=require(_0x3b97('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b97('0x3'));var db=require(_0x3b97('0x4'))['db'];var utils=require(_0x3b97('0x5'));var logger=require(_0x3b97('0x6'))(_0x3b97('0x7'));var config=require(_0x3b97('0x8'));var jayson=require(_0x3b97('0x9'));var client=jayson[_0x3b97('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e3692,_0x2f6a3e,_0x1bfe3f){return new BPromise(function(_0x7e23b8,_0x27e67f){return client[_0x3b97('0xb')](_0x2e3692,_0x1bfe3f)[_0x3b97('0xc')](function(_0x3d70e9){logger[_0x3b97('0xd')](_0x3b97('0xe'),_0x2f6a3e,_0x3b97('0xf'));logger[_0x3b97('0x10')](_0x3b97('0x11'),_0x2f6a3e,_0x3b97('0xf'),JSON[_0x3b97('0x12')](_0x3d70e9));if(_0x3d70e9['error']){if(_0x3d70e9[_0x3b97('0x13')]['code']===0x1f4){logger[_0x3b97('0x13')]('ContactItemType,\x20%s,\x20%s',_0x2f6a3e,_0x3d70e9[_0x3b97('0x13')][_0x3b97('0x14')]);return _0x27e67f(_0x3d70e9['error'][_0x3b97('0x14')]);}logger[_0x3b97('0x13')](_0x3b97('0xe'),_0x2f6a3e,_0x3d70e9['error']['message']);return _0x7e23b8(_0x3d70e9[_0x3b97('0x13')]['message']);}else{logger[_0x3b97('0xd')](_0x3b97('0xe'),_0x2f6a3e,'request\x20sent');_0x7e23b8(_0x3d70e9['result']['message']);}})[_0x3b97('0x15')](function(_0x7e1ee9){logger[_0x3b97('0x13')]('ContactItemType,\x20%s,\x20%s',_0x2f6a3e,_0x7e1ee9);_0x27e67f(_0x7e1ee9);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 4f2ccfd..adca77e 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 _0xe153=['create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./contactItemType.controller','get','index','/:id','isAuthenticated','show'];(function(_0xe47126,_0x32bfd3){var _0x1ada08=function(_0x39649c){while(--_0x39649c){_0xe47126['push'](_0xe47126['shift']());}};_0x1ada08(++_0x32bfd3);}(_0xe153,0x70));var _0x3e15=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe153[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x3e15('0x0'));var util=require(_0x3e15('0x1'));var path=require(_0x3e15('0x2'));var timeout=require(_0x3e15('0x3'));var express=require(_0x3e15('0x4'));var router=express[_0x3e15('0x5')]();var fs_extra=require(_0x3e15('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3e15('0x7'));var controller=require(_0x3e15('0x8'));router[_0x3e15('0x9')]('/',auth['isAuthenticated'](),controller[_0x3e15('0xa')]);router[_0x3e15('0x9')](_0x3e15('0xb'),auth[_0x3e15('0xc')](),controller[_0x3e15('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3e15('0xe')]);router[_0x3e15('0xf')](_0x3e15('0xb'),auth[_0x3e15('0xc')](),controller[_0x3e15('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3e15('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb2b4=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x413912,_0x407a53){var _0x1669db=function(_0xb7009e){while(--_0xb7009e){_0x413912['push'](_0x413912['shift']());}};_0x1669db(++_0x407a53);}(_0xb2b4,0x1b4));var _0x4b2b=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0xb2b4[_0x2dd390];return _0x3afe47;};'use strict';var multer=require(_0x4b2b('0x0'));var util=require(_0x4b2b('0x1'));var path=require(_0x4b2b('0x2'));var timeout=require(_0x4b2b('0x3'));var express=require('express');var router=express[_0x4b2b('0x4')]();var fs_extra=require(_0x4b2b('0x5'));var auth=require(_0x4b2b('0x6'));var interaction=require(_0x4b2b('0x7'));var config=require('../../config/environment');var controller=require(_0x4b2b('0x8'));router[_0x4b2b('0x9')]('/',auth[_0x4b2b('0xa')](),controller[_0x4b2b('0xb')]);router[_0x4b2b('0x9')](_0x4b2b('0xc'),auth[_0x4b2b('0xa')](),controller[_0x4b2b('0xd')]);router[_0x4b2b('0xe')]('/',auth[_0x4b2b('0xa')](),controller[_0x4b2b('0xf')]);router['put']('/:id',auth[_0x4b2b('0xa')](),controller['update']);router[_0x4b2b('0x10')]('/:id',auth[_0x4b2b('0xa')](),controller[_0x4b2b('0x11')]);module[_0x4b2b('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 27168c7..9c9f9b8 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 _0xbaf0=['name','exports','STRING'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x38c8be,_0x34b3ee){var _0x1537aa=function(_0x5b4100){while(--_0x5b4100){_0x38c8be['push'](_0x38c8be['shift']());}};_0x1537aa(++_0x34b3ee);}(_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':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4d3429d..a64fb41 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 _0x7cae=['api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','offset','limit','count','set','apply','update','then','UserProfileResource','destroy','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','total','attrSerie3','web-report','attrReport','reportType','attrRefresh','addItem','DashboardId','DashboardItem','getItems','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0x7cae,0xed));var _0xe7ca=function(_0x581c99,_0xdbd802){_0x581c99=_0x581c99-0x0;var _0x19f0f3=_0x7cae[_0x581c99];return _0x19f0f3;};'use strict';var emlformat=require(_0xe7ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7ca('0x1'));var jsonpatch=require(_0xe7ca('0x2'));var rp=require(_0xe7ca('0x3'));var moment=require(_0xe7ca('0x4'));var BPromise=require(_0xe7ca('0x5'));var Mustache=require(_0xe7ca('0x6'));var util=require(_0xe7ca('0x7'));var path=require(_0xe7ca('0x8'));var sox=require(_0xe7ca('0x9'));var csv=require(_0xe7ca('0xa'));var ejs=require(_0xe7ca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7ca('0xc'));var squel=require(_0xe7ca('0xd'));var crypto=require(_0xe7ca('0xe'));var jsforce=require(_0xe7ca('0xf'));var deskjs=require(_0xe7ca('0x10'));var toCsv=require(_0xe7ca('0xa'));var querystring=require(_0xe7ca('0x11'));var Papa=require('papaparse');var Redis=require(_0xe7ca('0x12'));var authService=require(_0xe7ca('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe7ca('0x14'));var hardwareService=require(_0xe7ca('0x15'));var logger=require(_0xe7ca('0x16'))(_0xe7ca('0x17'));var utils=require(_0xe7ca('0x18'));var config=require(_0xe7ca('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ca('0x1a'))['db'];config[_0xe7ca('0x1b')]=_['defaults'](config['redis'],{'host':_0xe7ca('0x1c'),'port':0x18eb});var socket=require(_0xe7ca('0x1d'))(new Redis(config['redis']));require(_0xe7ca('0x1e'))[_0xe7ca('0x1f')](socket);function respondWithStatusCode(_0x165828,_0x121070){_0x121070=_0x121070||0xcc;return function(_0x4a8643){if(_0x4a8643){return _0x165828[_0xe7ca('0x20')](_0x121070);}return _0x165828[_0xe7ca('0x21')](_0x121070)[_0xe7ca('0x22')]();};}function respondWithResult(_0x3f7952,_0x5c5293){_0x5c5293=_0x5c5293||0xc8;return function(_0x42d10a){if(_0x42d10a){return _0x3f7952[_0xe7ca('0x21')](_0x5c5293)['json'](_0x42d10a);}};}function respondWithFilteredResult(_0x28eddb,_0x4d13e2){return function(_0x333ecf){if(_0x333ecf){var _0x20429b=typeof _0x4d13e2[_0xe7ca('0x23')]==='undefined'&&typeof _0x4d13e2[_0xe7ca('0x24')]==='undefined';var _0x3af4bb=_0x333ecf[_0xe7ca('0x25')];var _0x10f3dc=_0x20429b?0x0:_0x4d13e2['offset'];var _0x43d808=_0x20429b?_0x333ecf[_0xe7ca('0x25')]:_0x4d13e2[_0xe7ca('0x23')]+_0x4d13e2[_0xe7ca('0x24')];var _0x5b00ca;if(_0x43d808>=_0x3af4bb){_0x43d808=_0x3af4bb;_0x5b00ca=0xc8;}else{_0x5b00ca=0xce;}_0x28eddb[_0xe7ca('0x21')](_0x5b00ca);return _0x28eddb[_0xe7ca('0x26')]('Content-Range',_0x10f3dc+'-'+_0x43d808+'/'+_0x3af4bb)['json'](_0x333ecf);}return null;};}function patchUpdates(_0x42cd57){return function(_0x5a0ee2){try{jsonpatch[_0xe7ca('0x27')](_0x5a0ee2,_0x42cd57,!![]);}catch(_0x391c19){return BPromise['reject'](_0x391c19);}return _0x5a0ee2['save']();};}function saveUpdates(_0xc39dbc,_0x2ada2b){return function(_0x480b5a){if(_0x480b5a){return _0x480b5a[_0xe7ca('0x28')](_0xc39dbc)[_0xe7ca('0x29')](function(_0x1c9596){return _0x1c9596;});}return null;};}function removeEntity(_0x4a4491,_0x51fd7e){return function(_0x186d42){if(_0x186d42){return _0x186d42['destroy']()[_0xe7ca('0x29')](function(){var _0x17de52=_0x186d42['get']({'plain':!![]});var _0x1593e8='CustomDashboards';return db[_0xe7ca('0x2a')][_0xe7ca('0x2b')]({'where':{'type':_0x1593e8,'resourceId':_0x17de52['id']}})['then'](function(){return _0x186d42;});})[_0xe7ca('0x29')](function(){_0x4a4491[_0xe7ca('0x21')](0xcc)[_0xe7ca('0x22')]();});}};}function handleEntityNotFound(_0x463ac9,_0x371f62){return function(_0x4afcaf){if(!_0x4afcaf){_0x463ac9['sendStatus'](0x194);}return _0x4afcaf;};}function handleError(_0x1eaa76,_0x3b36cd){_0x3b36cd=_0x3b36cd||0x1f4;return function(_0x237f6b){logger[_0xe7ca('0x2c')](_0x237f6b[_0xe7ca('0x2d')]);if(_0x237f6b[_0xe7ca('0x2e')]){delete _0x237f6b[_0xe7ca('0x2e')];}_0x1eaa76[_0xe7ca('0x21')](_0x3b36cd)[_0xe7ca('0x2f')](_0x237f6b);};}exports[_0xe7ca('0x30')]=function(_0x28d5fd,_0x1c860b){var _0x5400d5={},_0x108eb4={},_0x1c8324={'count':0x0,'rows':[]};var _0x41aea7=_[_0xe7ca('0x31')](db[_0xe7ca('0x32')][_0xe7ca('0x33')],function(_0x22a326){return{'name':_0x22a326[_0xe7ca('0x34')],'type':_0x22a326[_0xe7ca('0x35')][_0xe7ca('0x36')]};});_0x108eb4['model']=_[_0xe7ca('0x31')](_0x41aea7,'name');_0x108eb4[_0xe7ca('0x37')]=_['keys'](_0x28d5fd[_0xe7ca('0x37')]);_0x108eb4[_0xe7ca('0x38')]=_[_0xe7ca('0x39')](_0x108eb4[_0xe7ca('0x3a')],_0x108eb4[_0xe7ca('0x37')]);_0x5400d5[_0xe7ca('0x3b')]=_[_0xe7ca('0x39')](_0x108eb4[_0xe7ca('0x3a')],qs[_0xe7ca('0x3c')](_0x28d5fd[_0xe7ca('0x37')][_0xe7ca('0x3c')]));_0x5400d5[_0xe7ca('0x3b')]=_0x5400d5[_0xe7ca('0x3b')]['length']?_0x5400d5['attributes']:_0x108eb4[_0xe7ca('0x3a')];if(!_0x28d5fd[_0xe7ca('0x37')][_0xe7ca('0x3d')](_0xe7ca('0x3e'))){_0x5400d5[_0xe7ca('0x24')]=qs[_0xe7ca('0x24')](_0x28d5fd[_0xe7ca('0x37')][_0xe7ca('0x24')]);_0x5400d5[_0xe7ca('0x23')]=qs['offset'](_0x28d5fd[_0xe7ca('0x37')][_0xe7ca('0x23')]);}_0x5400d5[_0xe7ca('0x3f')]=qs[_0xe7ca('0x40')](_0x28d5fd[_0xe7ca('0x37')][_0xe7ca('0x40')]);_0x5400d5[_0xe7ca('0x41')]=qs[_0xe7ca('0x38')](_[_0xe7ca('0x42')](_0x28d5fd[_0xe7ca('0x37')],_0x108eb4[_0xe7ca('0x38')]),_0x41aea7);if(_0x28d5fd['query'][_0xe7ca('0x43')]){_0x5400d5[_0xe7ca('0x41')]=_[_0xe7ca('0x44')](_0x5400d5[_0xe7ca('0x41')],{'$or':_[_0xe7ca('0x31')](_0x41aea7,function(_0x5ebb91){if(_0x5ebb91[_0xe7ca('0x35')]!==_0xe7ca('0x45')){var _0x5c9278={};_0x5c9278[_0x5ebb91['name']]={'$like':'%'+_0x28d5fd[_0xe7ca('0x37')]['filter']+'%'};return _0x5c9278;}})});}_0x5400d5=_[_0xe7ca('0x44')]({},_0x5400d5,_0x28d5fd[_0xe7ca('0x46')]);var _0x58ea6f={'where':_0x5400d5[_0xe7ca('0x41')]};return db['Dashboard'][_0xe7ca('0x25')](_0x58ea6f)[_0xe7ca('0x29')](function(_0x2018a5){_0x1c8324[_0xe7ca('0x25')]=_0x2018a5;if(_0x28d5fd[_0xe7ca('0x37')][_0xe7ca('0x47')]){_0x5400d5['include']=[{'all':!![]}];}return db['Dashboard'][_0xe7ca('0x48')](_0x5400d5);})[_0xe7ca('0x29')](function(_0x1d0e71){_0x1c8324[_0xe7ca('0x49')]=_0x1d0e71;return _0x1c8324;})['then'](respondWithFilteredResult(_0x1c860b,_0x5400d5))[_0xe7ca('0x4a')](handleError(_0x1c860b,null));};exports[_0xe7ca('0x4b')]=function(_0x4e7886,_0x3e1891){var _0x1e8eaf={'raw':![],'where':{'id':_0x4e7886[_0xe7ca('0x4c')]['id']}},_0x2b1d94={};_0x2b1d94[_0xe7ca('0x3a')]=_[_0xe7ca('0x4d')](db[_0xe7ca('0x32')]['rawAttributes']);_0x2b1d94[_0xe7ca('0x37')]=_[_0xe7ca('0x4d')](_0x4e7886[_0xe7ca('0x37')]);_0x2b1d94[_0xe7ca('0x38')]=_['intersection'](_0x2b1d94[_0xe7ca('0x3a')],_0x2b1d94[_0xe7ca('0x37')]);_0x1e8eaf[_0xe7ca('0x3b')]=_[_0xe7ca('0x39')](_0x2b1d94[_0xe7ca('0x3a')],qs[_0xe7ca('0x3c')](_0x4e7886[_0xe7ca('0x37')][_0xe7ca('0x3c')]));_0x1e8eaf[_0xe7ca('0x3b')]=_0x1e8eaf[_0xe7ca('0x3b')][_0xe7ca('0x4e')]?_0x1e8eaf[_0xe7ca('0x3b')]:_0x2b1d94[_0xe7ca('0x3a')];if(_0x4e7886[_0xe7ca('0x37')][_0xe7ca('0x47')]){_0x1e8eaf[_0xe7ca('0x4f')]=[{'all':!![]}];}_0x1e8eaf=_['merge']({},_0x1e8eaf,_0x4e7886[_0xe7ca('0x46')]);return db[_0xe7ca('0x32')][_0xe7ca('0x50')](_0x1e8eaf)[_0xe7ca('0x29')](handleEntityNotFound(_0x3e1891,null))[_0xe7ca('0x29')](respondWithResult(_0x3e1891,null))[_0xe7ca('0x4a')](handleError(_0x3e1891,null));};exports[_0xe7ca('0x51')]=function(_0x39ac8e,_0x5911df){return db['Dashboard']['create'](_0x39ac8e[_0xe7ca('0x52')],{})['then'](function(_0x28c45f){var _0x417870=_0x39ac8e[_0xe7ca('0x53')][_0xe7ca('0x54')]({'plain':!![]});if(!_0x417870)throw new Error(_0xe7ca('0x55'));if(_0x417870[_0xe7ca('0x56')]==='user'){var _0x1693b6=_0x28c45f['get']({'plain':!![]});var _0x402d35=_0xe7ca('0x57');return db[_0xe7ca('0x58')]['find']({'where':{'name':_0x402d35,'userProfileId':_0x417870[_0xe7ca('0x59')]},'raw':!![]})[_0xe7ca('0x29')](function(_0x311d63){if(_0x311d63&&_0x311d63[_0xe7ca('0x5a')]===0x0){return db[_0xe7ca('0x2a')][_0xe7ca('0x51')]({'name':_0x1693b6[_0xe7ca('0x2e')],'resourceId':_0x1693b6['id'],'type':_0x311d63[_0xe7ca('0x2e')],'sectionId':_0x311d63['id']},{})[_0xe7ca('0x29')](function(){return _0x28c45f;});}else{return _0x28c45f;}})[_0xe7ca('0x4a')](function(_0x22a100){logger[_0xe7ca('0x2c')](_0xe7ca('0x5b'),_0x22a100);throw _0x22a100;});}return _0x28c45f;})[_0xe7ca('0x29')](respondWithResult(_0x5911df,0xc9))[_0xe7ca('0x4a')](handleError(_0x5911df,null));};exports[_0xe7ca('0x5c')]=function(_0x1952c2,_0x405575){var _0x568df5={'where':{'id':_0x1952c2[_0xe7ca('0x4c')]['id']}},_0x267578={};_0x267578[_0xe7ca('0x3a')]=_[_0xe7ca('0x4d')](db[_0xe7ca('0x32')][_0xe7ca('0x33')]);_0x568df5[_0xe7ca('0x3b')]=_[_0xe7ca('0x39')](_0x267578[_0xe7ca('0x3a')],qs[_0xe7ca('0x3c')](_0x1952c2[_0xe7ca('0x37')]['fields']));_0x568df5[_0xe7ca('0x3b')]=_0x568df5['attributes'][_0xe7ca('0x4e')]?_0x568df5['attributes']:_0x267578[_0xe7ca('0x3a')];if(_0x1952c2[_0xe7ca('0x37')]['includeAll']){_0x568df5[_0xe7ca('0x4f')]=[{'all':!![]}];}_0x568df5=_[_0xe7ca('0x44')]({},_0x568df5,_0x1952c2[_0xe7ca('0x46')]);return db[_0xe7ca('0x32')]['find'](_0x568df5)[_0xe7ca('0x29')](handleEntityNotFound(_0x405575,null))['then'](function(_0x5bb07e){if(_0x5bb07e){var _0xe1d792=_0x5bb07e['get']({'plain':!![]});_0xe1d792=qs[_0xe7ca('0x5d')](_0xe1d792,['id','createdAt','updatedAt']);_0x1952c2[_0xe7ca('0x52')]=_['omit'](_0x1952c2['body'],['id',_0xe7ca('0x5e'),_0xe7ca('0x5f')]);return db[_0xe7ca('0x32')]['create'](_[_0xe7ca('0x44')](_0xe1d792,_0x1952c2[_0xe7ca('0x52')]),{'include':_0x1952c2[_0xe7ca('0x37')][_0xe7ca('0x47')]?[{'all':!![]}]:undefined})[_0xe7ca('0x29')](function(_0x49238f){var _0x2cc178=_0x1952c2[_0xe7ca('0x53')][_0xe7ca('0x54')]({'plain':!![]});if(!_0x2cc178)throw new Error(_0xe7ca('0x55'));if(_0x2cc178[_0xe7ca('0x56')]==='user'){var _0x55f49c=_0x49238f[_0xe7ca('0x54')]({'plain':!![]});var _0x4eff82=_0xe7ca('0x57');return db['UserProfileSection'][_0xe7ca('0x50')]({'where':{'name':_0x4eff82,'userProfileId':_0x2cc178[_0xe7ca('0x59')]},'raw':!![]})[_0xe7ca('0x29')](function(_0x33dfba){if(_0x33dfba&&_0x33dfba['autoAssociation']===0x0){return db[_0xe7ca('0x2a')][_0xe7ca('0x51')]({'name':_0x55f49c[_0xe7ca('0x2e')],'resourceId':_0x55f49c['id'],'type':_0x33dfba[_0xe7ca('0x2e')],'sectionId':_0x33dfba['id']},{})['then'](function(){return _0x49238f;});}else{return _0x49238f;}})[_0xe7ca('0x4a')](function(_0x2a6beb){logger[_0xe7ca('0x2c')](_0xe7ca('0x5b'),_0x2a6beb);throw _0x2a6beb;});}return _0x49238f;});}})['then'](respondWithResult(_0x405575,0xc9))[_0xe7ca('0x4a')](handleError(_0x405575,null));};exports[_0xe7ca('0x28')]=function(_0x53561c,_0x6c4337){if(_0x53561c[_0xe7ca('0x52')]['id']){delete _0x53561c[_0xe7ca('0x52')]['id'];}return db[_0xe7ca('0x32')][_0xe7ca('0x50')]({'where':{'id':_0x53561c[_0xe7ca('0x4c')]['id']}})[_0xe7ca('0x29')](handleEntityNotFound(_0x6c4337,null))[_0xe7ca('0x29')](saveUpdates(_0x53561c[_0xe7ca('0x52')],null))['then'](respondWithResult(_0x6c4337,null))[_0xe7ca('0x4a')](handleError(_0x6c4337,null));};exports[_0xe7ca('0x2b')]=function(_0x246df2,_0x49e4f3){return db[_0xe7ca('0x32')]['find']({'where':{'id':_0x246df2['params']['id']}})[_0xe7ca('0x29')](handleEntityNotFound(_0x49e4f3,null))[_0xe7ca('0x29')](removeEntity(_0x49e4f3,null))['catch'](handleError(_0x49e4f3,null));};function widgetAttributes(_0x20c025){try{switch(_0x20c025[_0xe7ca('0x35')]){case _0xe7ca('0x60'):return[{'name':_0xe7ca('0x61'),'value':_0x20c025[_0xe7ca('0x61')]||(_0x20c025['attrs']&&_0x20c025[_0xe7ca('0x62')][0x0]?_0x20c025[_0xe7ca('0x62')][0x0][_0xe7ca('0x63')]:undefined)||_0xe7ca('0x64')}];case _0xe7ca('0x65'):return[{'name':_0xe7ca('0x66'),'value':_0x20c025[_0xe7ca('0x66')]||(_0x20c025['attrs']&&_0x20c025['attrs'][0x0]?_0x20c025[_0xe7ca('0x62')][0x0][_0xe7ca('0x63')]:undefined)||''}];case _0xe7ca('0x67'):return[{'name':'attrHourFormat','value':_0x20c025[_0xe7ca('0x68')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x0]?_0x20c025[_0xe7ca('0x62')][0x0][_0xe7ca('0x63')]:undefined)||_0xe7ca('0x69')},{'name':_0xe7ca('0x6a'),'value':_0x20c025[_0xe7ca('0x6a')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x1]?_0x20c025[_0xe7ca('0x62')][0x1][_0xe7ca('0x63')]:undefined)||_0xe7ca('0x6b')},{'name':_0xe7ca('0x6c'),'value':_0x20c025[_0xe7ca('0x6c')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x2]?_0x20c025[_0xe7ca('0x62')][0x2][_0xe7ca('0x63')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x20c025[_0xe7ca('0x6d')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x0]?_0x20c025[_0xe7ca('0x62')][0x0][_0xe7ca('0x63')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x20c025[_0xe7ca('0x6e')]||(_0x20c025['attrs']&&_0x20c025[_0xe7ca('0x62')][0x1]?_0x20c025[_0xe7ca('0x62')][0x1][_0xe7ca('0x63')]:undefined)||[]},{'name':_0xe7ca('0x6c'),'value':_0x20c025[_0xe7ca('0x6c')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x2]?_0x20c025[_0xe7ca('0x62')][0x2][_0xe7ca('0x63')]:undefined)||0x14},{'name':_0xe7ca('0x6f'),'value':_0x20c025['attrChannel']||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x3]?_0x20c025[_0xe7ca('0x62')][0x3][_0xe7ca('0x63')]:undefined)||_0xe7ca('0x70')},{'name':_0xe7ca('0x71'),'value':_0x20c025[_0xe7ca('0x71')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025['attrs'][0x4]?_0x20c025[_0xe7ca('0x62')][0x4]['value']:undefined)||''},{'name':_0xe7ca('0x72'),'value':_0x20c025[_0xe7ca('0x72')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x5]?_0x20c025[_0xe7ca('0x62')][0x5]['value']:undefined)||''},{'name':_0xe7ca('0x73'),'value':_0x20c025['attrSmsAccounts']||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x6]?_0x20c025[_0xe7ca('0x62')][0x6][_0xe7ca('0x63')]:undefined)||''},{'name':_0xe7ca('0x74'),'value':_0x20c025[_0xe7ca('0x74')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x7]?_0x20c025[_0xe7ca('0x62')][0x7][_0xe7ca('0x63')]:undefined)||''},{'name':_0xe7ca('0x75'),'value':_0x20c025['attrWhatsappAccounts']||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x8]?_0x20c025[_0xe7ca('0x62')][0x8]['value']:undefined)||''},{'name':_0xe7ca('0x76'),'value':_0x20c025[_0xe7ca('0x76')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025['attrs'][0x9]?_0x20c025[_0xe7ca('0x62')][0x9]['value']:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x20c025[_0xe7ca('0x77')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x0]?_0x20c025[_0xe7ca('0x62')][0x0][_0xe7ca('0x63')]:undefined)||_0xe7ca('0x78')},{'name':'attrSerie2','value':_0x20c025['attrSerie2']||(_0x20c025['attrs']&&_0x20c025[_0xe7ca('0x62')][0x1]?_0x20c025[_0xe7ca('0x62')][0x1]['value']:undefined)||null},{'name':_0xe7ca('0x79'),'value':_0x20c025[_0xe7ca('0x79')]||(_0x20c025['attrs']&&_0x20c025['attrs'][0x2]?_0x20c025[_0xe7ca('0x62')][0x2]['value']:undefined)||null},{'name':_0xe7ca('0x6e'),'value':_0x20c025[_0xe7ca('0x6e')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x3]?_0x20c025[_0xe7ca('0x62')][0x3][_0xe7ca('0x63')]:undefined)||[]},{'name':_0xe7ca('0x6f'),'value':_0x20c025[_0xe7ca('0x6f')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025['attrs'][0x4]?_0x20c025[_0xe7ca('0x62')][0x4]['value']:undefined)||_0xe7ca('0x70')},{'name':_0xe7ca('0x71'),'value':_0x20c025['attrEmailAccounts']||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x5]?_0x20c025[_0xe7ca('0x62')][0x5]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x20c025[_0xe7ca('0x72')]||(_0x20c025['attrs']&&_0x20c025[_0xe7ca('0x62')][0x6]?_0x20c025[_0xe7ca('0x62')][0x6]['value']:undefined)||''},{'name':_0xe7ca('0x73'),'value':_0x20c025[_0xe7ca('0x73')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x7]?_0x20c025[_0xe7ca('0x62')][0x7][_0xe7ca('0x63')]:undefined)||''},{'name':_0xe7ca('0x74'),'value':_0x20c025['attrOpenchannelAccounts']||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x8]?_0x20c025['attrs'][0x8][_0xe7ca('0x63')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x20c025['attrWhatsappAccounts']||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x9]?_0x20c025[_0xe7ca('0x62')][0x9][_0xe7ca('0x63')]:undefined)||''},{'name':'attrChatWebsites','value':_0x20c025[_0xe7ca('0x76')]||(_0x20c025['attrs']&&_0x20c025[_0xe7ca('0x62')][0xa]?_0x20c025[_0xe7ca('0x62')][0xa][_0xe7ca('0x63')]:undefined)||''}];case _0xe7ca('0x7a'):return[{'name':_0xe7ca('0x7b'),'type':_0x20c025[_0xe7ca('0x7c')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025[_0xe7ca('0x62')][0x0]?_0x20c025[_0xe7ca('0x62')][0x0]['type']:undefined)||null,'value':_0x20c025[_0xe7ca('0x7b')]||(_0x20c025['attrs']&&_0x20c025['attrs'][0x0]?_0x20c025[_0xe7ca('0x62')][0x0]['value']:undefined)||null},{'name':_0xe7ca('0x7d'),'value':_0x20c025[_0xe7ca('0x7d')]||(_0x20c025[_0xe7ca('0x62')]&&_0x20c025['attrs'][0x1]?_0x20c025[_0xe7ca('0x62')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x569f69){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x569f69));return[];}}exports[_0xe7ca('0x7e')]=function(_0x45fde9,_0x3d1a15,_0xb06700){if(_0x45fde9[_0xe7ca('0x52')]['id']){delete _0x45fde9['body']['id'];}return db[_0xe7ca('0x32')][_0xe7ca('0x50')]({'where':{'id':_0x45fde9[_0xe7ca('0x4c')]['id']}})[_0xe7ca('0x29')](handleEntityNotFound(_0x3d1a15,null))[_0xe7ca('0x29')](function(_0x28aea5){if(_0x28aea5){_0x45fde9[_0xe7ca('0x52')][_0xe7ca('0x7f')]=_0x28aea5['id'];_0x45fde9[_0xe7ca('0x52')][_0xe7ca('0x62')]=widgetAttributes(_0x45fde9['body']);return db[_0xe7ca('0x80')][_0xe7ca('0x51')](_0x45fde9[_0xe7ca('0x52')]);}})['then'](respondWithResult(_0x3d1a15,null))['catch'](handleError(_0x3d1a15,null));};exports[_0xe7ca('0x81')]=function(_0x2a620e,_0x504c0e,_0x554872){var _0x5ca60e={};var _0x243bf6={};var _0x416058;var _0x8de70e;return db['Dashboard']['findOne']({'where':{'id':_0x2a620e['params']['id']}})['then'](handleEntityNotFound(_0x504c0e,null))['then'](function(_0x5a4dde){if(_0x5a4dde){_0x416058=_0x5a4dde;_0x243bf6['model']=_['keys'](db[_0xe7ca('0x80')]['rawAttributes']);_0x243bf6[_0xe7ca('0x37')]=_[_0xe7ca('0x4d')](_0x2a620e['query']);_0x243bf6[_0xe7ca('0x38')]=_[_0xe7ca('0x39')](_0x243bf6[_0xe7ca('0x3a')],_0x243bf6['query']);_0x5ca60e['attributes']=_[_0xe7ca('0x39')](_0x243bf6[_0xe7ca('0x3a')],qs['fields'](_0x2a620e[_0xe7ca('0x37')]['fields']));_0x5ca60e[_0xe7ca('0x3b')]=_0x5ca60e[_0xe7ca('0x3b')][_0xe7ca('0x4e')]?_0x5ca60e['attributes']:_0x243bf6[_0xe7ca('0x3a')];_0x5ca60e[_0xe7ca('0x3f')]=qs['sort'](_0x2a620e['query'][_0xe7ca('0x40')]);_0x5ca60e[_0xe7ca('0x41')]=qs[_0xe7ca('0x38')](_['pick'](_0x2a620e[_0xe7ca('0x37')],_0x243bf6['filters']));if(_0x2a620e['query'][_0xe7ca('0x43')]){_0x5ca60e[_0xe7ca('0x41')]=_['merge'](_0x5ca60e[_0xe7ca('0x41')],{'$or':_[_0xe7ca('0x31')](_0x5ca60e['attributes'],function(_0x50fe8e){var _0x35b7c4={};_0x35b7c4[_0x50fe8e]={'$like':'%'+_0x2a620e[_0xe7ca('0x37')][_0xe7ca('0x43')]+'%'};return _0x35b7c4;})});}_0x5ca60e=_['merge']({},_0x5ca60e,_0x2a620e[_0xe7ca('0x46')]);return _0x416058[_0xe7ca('0x81')](_0x5ca60e);}})['then'](function(_0x43f071){if(_0x43f071){_0x8de70e=_0x43f071[_0xe7ca('0x4e')];if(!_0x2a620e[_0xe7ca('0x37')][_0xe7ca('0x3d')]('nolimit')){_0x5ca60e[_0xe7ca('0x24')]=qs[_0xe7ca('0x24')](_0x2a620e[_0xe7ca('0x37')][_0xe7ca('0x24')]);_0x5ca60e['offset']=qs['offset'](_0x2a620e[_0xe7ca('0x37')][_0xe7ca('0x23')]);}return _0x416058[_0xe7ca('0x81')](_0x5ca60e);}})['then'](function(_0x577c9d){if(_0x577c9d){return _0x577c9d?{'count':_0x8de70e,'rows':_0x577c9d}:null;}})[_0xe7ca('0x29')](respondWithResult(_0x504c0e,null))[_0xe7ca('0x4a')](handleError(_0x504c0e,null));}; \ No newline at end of file +var _0x11e4=['order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrFaxAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','error','stack','name','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x13b378,_0x555b28){var _0x567fd2=function(_0x13d270){while(--_0x13d270){_0x13b378['push'](_0x13b378['shift']());}};_0x567fd2(++_0x555b28);}(_0x11e4,0x159));var _0x411e=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x11e4[_0x4e9628];return _0x27bc8c;};'use strict';var emlformat=require(_0x411e('0x0'));var rimraf=require(_0x411e('0x1'));var zipdir=require(_0x411e('0x2'));var jsonpatch=require(_0x411e('0x3'));var rp=require(_0x411e('0x4'));var moment=require('moment');var BPromise=require(_0x411e('0x5'));var Mustache=require(_0x411e('0x6'));var util=require(_0x411e('0x7'));var path=require(_0x411e('0x8'));var sox=require(_0x411e('0x9'));var csv=require(_0x411e('0xa'));var ejs=require(_0x411e('0xb'));var fs=require('fs');var fs_extra=require(_0x411e('0xc'));var _=require(_0x411e('0xd'));var squel=require(_0x411e('0xe'));var crypto=require(_0x411e('0xf'));var jsforce=require(_0x411e('0x10'));var deskjs=require(_0x411e('0x11'));var toCsv=require(_0x411e('0xa'));var querystring=require(_0x411e('0x12'));var Papa=require(_0x411e('0x13'));var Redis=require('ioredis');var authService=require(_0x411e('0x14'));var qs=require(_0x411e('0x15'));var as=require(_0x411e('0x16'));var hardwareService=require(_0x411e('0x17'));var logger=require(_0x411e('0x18'))('api');var utils=require(_0x411e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x411e('0x1a'));var db=require('../../mysqldb')['db'];config[_0x411e('0x1b')]=_[_0x411e('0x1c')](config[_0x411e('0x1b')],{'host':_0x411e('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x411e('0x1b')]));require(_0x411e('0x1e'))[_0x411e('0x1f')](socket);function respondWithStatusCode(_0x1547e7,_0x56f683){_0x56f683=_0x56f683||0xcc;return function(_0x41fb89){if(_0x41fb89){return _0x1547e7[_0x411e('0x20')](_0x56f683);}return _0x1547e7[_0x411e('0x21')](_0x56f683)[_0x411e('0x22')]();};}function respondWithResult(_0x1971ed,_0x511e3d){_0x511e3d=_0x511e3d||0xc8;return function(_0x549927){if(_0x549927){return _0x1971ed[_0x411e('0x21')](_0x511e3d)[_0x411e('0x23')](_0x549927);}};}function respondWithFilteredResult(_0x22dfda,_0x34bdd8){return function(_0x5e7bc9){if(_0x5e7bc9){var _0xad042c=typeof _0x34bdd8[_0x411e('0x24')]==='undefined'&&typeof _0x34bdd8[_0x411e('0x25')]===_0x411e('0x26');var _0x2d041f=_0x5e7bc9[_0x411e('0x27')];var _0x5cbcb=_0xad042c?0x0:_0x34bdd8[_0x411e('0x24')];var _0x26fe2a=_0xad042c?_0x5e7bc9[_0x411e('0x27')]:_0x34bdd8[_0x411e('0x24')]+_0x34bdd8[_0x411e('0x25')];var _0x5bf6d1;if(_0x26fe2a>=_0x2d041f){_0x26fe2a=_0x2d041f;_0x5bf6d1=0xc8;}else{_0x5bf6d1=0xce;}_0x22dfda[_0x411e('0x21')](_0x5bf6d1);return _0x22dfda[_0x411e('0x28')]('Content-Range',_0x5cbcb+'-'+_0x26fe2a+'/'+_0x2d041f)[_0x411e('0x23')](_0x5e7bc9);}return null;};}function patchUpdates(_0x279b14){return function(_0x586398){try{jsonpatch[_0x411e('0x29')](_0x586398,_0x279b14,!![]);}catch(_0x3f6710){return BPromise[_0x411e('0x2a')](_0x3f6710);}return _0x586398[_0x411e('0x2b')]();};}function saveUpdates(_0x535412,_0x3572b5){return function(_0x4427c9){if(_0x4427c9){return _0x4427c9['update'](_0x535412)[_0x411e('0x2c')](function(_0x3f3dad){return _0x3f3dad;});}return null;};}function removeEntity(_0x2741ee,_0x1c1a8c){return function(_0x3085d6){if(_0x3085d6){return _0x3085d6[_0x411e('0x2d')]()[_0x411e('0x2c')](function(){var _0x319ed7=_0x3085d6['get']({'plain':!![]});var _0xe945c7='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0xe945c7,'resourceId':_0x319ed7['id']}})[_0x411e('0x2c')](function(){return _0x3085d6;});})[_0x411e('0x2c')](function(){_0x2741ee[_0x411e('0x21')](0xcc)[_0x411e('0x22')]();});}};}function handleEntityNotFound(_0x22a320,_0x246929){return function(_0x44c551){if(!_0x44c551){_0x22a320['sendStatus'](0x194);}return _0x44c551;};}function handleError(_0x2284f2,_0x2053df){_0x2053df=_0x2053df||0x1f4;return function(_0x58795b){logger[_0x411e('0x2e')](_0x58795b[_0x411e('0x2f')]);if(_0x58795b['name']){delete _0x58795b[_0x411e('0x30')];}_0x2284f2[_0x411e('0x21')](_0x2053df)['send'](_0x58795b);};}exports['index']=function(_0x4fa23c,_0x115813){var _0x52bc91={},_0x8e06c7={},_0x7c4460={'count':0x0,'rows':[]};var _0xb7611=_['map'](db[_0x411e('0x31')][_0x411e('0x32')],function(_0x435274){return{'name':_0x435274[_0x411e('0x33')],'type':_0x435274[_0x411e('0x34')][_0x411e('0x35')]};});_0x8e06c7[_0x411e('0x36')]=_['map'](_0xb7611,_0x411e('0x30'));_0x8e06c7['query']=_[_0x411e('0x37')](_0x4fa23c[_0x411e('0x38')]);_0x8e06c7[_0x411e('0x39')]=_[_0x411e('0x3a')](_0x8e06c7[_0x411e('0x36')],_0x8e06c7[_0x411e('0x38')]);_0x52bc91[_0x411e('0x3b')]=_[_0x411e('0x3a')](_0x8e06c7[_0x411e('0x36')],qs['fields'](_0x4fa23c[_0x411e('0x38')][_0x411e('0x3c')]));_0x52bc91[_0x411e('0x3b')]=_0x52bc91[_0x411e('0x3b')][_0x411e('0x3d')]?_0x52bc91[_0x411e('0x3b')]:_0x8e06c7['model'];if(!_0x4fa23c[_0x411e('0x38')][_0x411e('0x3e')]('nolimit')){_0x52bc91['limit']=qs[_0x411e('0x25')](_0x4fa23c['query'][_0x411e('0x25')]);_0x52bc91[_0x411e('0x24')]=qs[_0x411e('0x24')](_0x4fa23c[_0x411e('0x38')][_0x411e('0x24')]);}_0x52bc91[_0x411e('0x3f')]=qs[_0x411e('0x40')](_0x4fa23c[_0x411e('0x38')]['sort']);_0x52bc91[_0x411e('0x41')]=qs[_0x411e('0x39')](_[_0x411e('0x42')](_0x4fa23c[_0x411e('0x38')],_0x8e06c7[_0x411e('0x39')]),_0xb7611);if(_0x4fa23c['query'][_0x411e('0x43')]){_0x52bc91['where']=_[_0x411e('0x44')](_0x52bc91[_0x411e('0x41')],{'$or':_[_0x411e('0x45')](_0xb7611,function(_0x493489){if(_0x493489['type']!==_0x411e('0x46')){var _0x7ac5f2={};_0x7ac5f2[_0x493489['name']]={'$like':'%'+_0x4fa23c[_0x411e('0x38')][_0x411e('0x43')]+'%'};return _0x7ac5f2;}})});}_0x52bc91=_[_0x411e('0x44')]({},_0x52bc91,_0x4fa23c[_0x411e('0x47')]);var _0x129528={'where':_0x52bc91[_0x411e('0x41')]};return db[_0x411e('0x31')][_0x411e('0x27')](_0x129528)['then'](function(_0x4ab49c){_0x7c4460[_0x411e('0x27')]=_0x4ab49c;if(_0x4fa23c[_0x411e('0x38')][_0x411e('0x48')]){_0x52bc91[_0x411e('0x49')]=[{'all':!![]}];}return db[_0x411e('0x31')][_0x411e('0x4a')](_0x52bc91);})['then'](function(_0x1ea1a3){_0x7c4460[_0x411e('0x4b')]=_0x1ea1a3;return _0x7c4460;})['then'](respondWithFilteredResult(_0x115813,_0x52bc91))[_0x411e('0x4c')](handleError(_0x115813,null));};exports['show']=function(_0x3b5fda,_0x5daaf1){var _0x2b6f0a={'raw':![],'where':{'id':_0x3b5fda[_0x411e('0x4d')]['id']}},_0x3926ba={};_0x3926ba[_0x411e('0x36')]=_[_0x411e('0x37')](db[_0x411e('0x31')][_0x411e('0x32')]);_0x3926ba[_0x411e('0x38')]=_[_0x411e('0x37')](_0x3b5fda['query']);_0x3926ba['filters']=_[_0x411e('0x3a')](_0x3926ba[_0x411e('0x36')],_0x3926ba['query']);_0x2b6f0a[_0x411e('0x3b')]=_['intersection'](_0x3926ba[_0x411e('0x36')],qs[_0x411e('0x3c')](_0x3b5fda[_0x411e('0x38')]['fields']));_0x2b6f0a[_0x411e('0x3b')]=_0x2b6f0a[_0x411e('0x3b')]['length']?_0x2b6f0a[_0x411e('0x3b')]:_0x3926ba['model'];if(_0x3b5fda[_0x411e('0x38')][_0x411e('0x48')]){_0x2b6f0a[_0x411e('0x49')]=[{'all':!![]}];}_0x2b6f0a=_['merge']({},_0x2b6f0a,_0x3b5fda['options']);return db[_0x411e('0x31')][_0x411e('0x4e')](_0x2b6f0a)['then'](handleEntityNotFound(_0x5daaf1,null))['then'](respondWithResult(_0x5daaf1,null))[_0x411e('0x4c')](handleError(_0x5daaf1,null));};exports[_0x411e('0x4f')]=function(_0x54d048,_0x734404){return db[_0x411e('0x31')]['create'](_0x54d048[_0x411e('0x50')],{})[_0x411e('0x2c')](function(_0x1f4bf2){var _0x5eec8e=_0x54d048[_0x411e('0x51')][_0x411e('0x52')]({'plain':!![]});if(!_0x5eec8e)throw new Error(_0x411e('0x53'));if(_0x5eec8e[_0x411e('0x54')]===_0x411e('0x51')){var _0x2e71f1=_0x1f4bf2['get']({'plain':!![]});var _0x12f737=_0x411e('0x55');return db['UserProfileSection'][_0x411e('0x4e')]({'where':{'name':_0x12f737,'userProfileId':_0x5eec8e[_0x411e('0x56')]},'raw':!![]})[_0x411e('0x2c')](function(_0x5204c9){if(_0x5204c9&&_0x5204c9[_0x411e('0x57')]===0x0){return db[_0x411e('0x58')][_0x411e('0x4f')]({'name':_0x2e71f1['name'],'resourceId':_0x2e71f1['id'],'type':_0x5204c9[_0x411e('0x30')],'sectionId':_0x5204c9['id']},{})[_0x411e('0x2c')](function(){return _0x1f4bf2;});}else{return _0x1f4bf2;}})[_0x411e('0x4c')](function(_0x2d3b9a){logger[_0x411e('0x2e')](_0x411e('0x59'),_0x2d3b9a);throw _0x2d3b9a;});}return _0x1f4bf2;})[_0x411e('0x2c')](respondWithResult(_0x734404,0xc9))[_0x411e('0x4c')](handleError(_0x734404,null));};exports[_0x411e('0x5a')]=function(_0x452f03,_0x3845bc){var _0x2252fc={'where':{'id':_0x452f03[_0x411e('0x4d')]['id']}},_0x501120={};_0x501120[_0x411e('0x36')]=_['keys'](db[_0x411e('0x31')]['rawAttributes']);_0x2252fc[_0x411e('0x3b')]=_[_0x411e('0x3a')](_0x501120[_0x411e('0x36')],qs[_0x411e('0x3c')](_0x452f03[_0x411e('0x38')][_0x411e('0x3c')]));_0x2252fc['attributes']=_0x2252fc[_0x411e('0x3b')][_0x411e('0x3d')]?_0x2252fc['attributes']:_0x501120[_0x411e('0x36')];if(_0x452f03['query'][_0x411e('0x48')]){_0x2252fc[_0x411e('0x49')]=[{'all':!![]}];}_0x2252fc=_['merge']({},_0x2252fc,_0x452f03[_0x411e('0x47')]);return db[_0x411e('0x31')][_0x411e('0x4e')](_0x2252fc)[_0x411e('0x2c')](handleEntityNotFound(_0x3845bc,null))[_0x411e('0x2c')](function(_0x218a9b){if(_0x218a9b){var _0x423eae=_0x218a9b['get']({'plain':!![]});_0x423eae=qs[_0x411e('0x5b')](_0x423eae,['id',_0x411e('0x5c'),_0x411e('0x5d')]);_0x452f03[_0x411e('0x50')]=_[_0x411e('0x5b')](_0x452f03[_0x411e('0x50')],['id',_0x411e('0x5c'),_0x411e('0x5d')]);return db[_0x411e('0x31')]['create'](_['merge'](_0x423eae,_0x452f03[_0x411e('0x50')]),{'include':_0x452f03['query'][_0x411e('0x48')]?[{'all':!![]}]:undefined})[_0x411e('0x2c')](function(_0x54f38f){var _0x33a913=_0x452f03['user'][_0x411e('0x52')]({'plain':!![]});if(!_0x33a913)throw new Error(_0x411e('0x53'));if(_0x33a913['role']===_0x411e('0x51')){var _0x503588=_0x54f38f['get']({'plain':!![]});var _0x1ad8aa='CustomDashboards';return db[_0x411e('0x5e')][_0x411e('0x4e')]({'where':{'name':_0x1ad8aa,'userProfileId':_0x33a913[_0x411e('0x56')]},'raw':!![]})[_0x411e('0x2c')](function(_0x30c2c0){if(_0x30c2c0&&_0x30c2c0[_0x411e('0x57')]===0x0){return db[_0x411e('0x58')]['create']({'name':_0x503588[_0x411e('0x30')],'resourceId':_0x503588['id'],'type':_0x30c2c0[_0x411e('0x30')],'sectionId':_0x30c2c0['id']},{})[_0x411e('0x2c')](function(){return _0x54f38f;});}else{return _0x54f38f;}})[_0x411e('0x4c')](function(_0x5c539e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c539e);throw _0x5c539e;});}return _0x54f38f;});}})[_0x411e('0x2c')](respondWithResult(_0x3845bc,0xc9))[_0x411e('0x4c')](handleError(_0x3845bc,null));};exports[_0x411e('0x5f')]=function(_0x150ac0,_0x2e8960){if(_0x150ac0[_0x411e('0x50')]['id']){delete _0x150ac0[_0x411e('0x50')]['id'];}return db[_0x411e('0x31')]['find']({'where':{'id':_0x150ac0[_0x411e('0x4d')]['id']}})[_0x411e('0x2c')](handleEntityNotFound(_0x2e8960,null))[_0x411e('0x2c')](saveUpdates(_0x150ac0['body'],null))[_0x411e('0x2c')](respondWithResult(_0x2e8960,null))[_0x411e('0x4c')](handleError(_0x2e8960,null));};exports[_0x411e('0x2d')]=function(_0x7db3e1,_0x5cc56d){return db[_0x411e('0x31')][_0x411e('0x4e')]({'where':{'id':_0x7db3e1['params']['id']}})[_0x411e('0x2c')](handleEntityNotFound(_0x5cc56d,null))[_0x411e('0x2c')](removeEntity(_0x5cc56d,null))['catch'](handleError(_0x5cc56d,null));};function widgetAttributes(_0x590853){try{switch(_0x590853[_0x411e('0x34')]){case _0x411e('0x60'):return[{'name':_0x411e('0x61'),'value':_0x590853[_0x411e('0x61')]||(_0x590853['attrs']&&_0x590853[_0x411e('0x62')][0x0]?_0x590853['attrs'][0x0][_0x411e('0x63')]:undefined)||_0x411e('0x64')}];case _0x411e('0x65'):return[{'name':_0x411e('0x66'),'value':_0x590853[_0x411e('0x66')]||(_0x590853['attrs']&&_0x590853[_0x411e('0x62')][0x0]?_0x590853[_0x411e('0x62')][0x0][_0x411e('0x63')]:undefined)||''}];case _0x411e('0x67'):return[{'name':_0x411e('0x68'),'value':_0x590853[_0x411e('0x68')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x0]?_0x590853[_0x411e('0x62')][0x0]['value']:undefined)||_0x411e('0x69')},{'name':_0x411e('0x6a'),'value':_0x590853[_0x411e('0x6a')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x1]?_0x590853['attrs'][0x1][_0x411e('0x63')]:undefined)||_0x411e('0x6b')},{'name':_0x411e('0x6c'),'value':_0x590853[_0x411e('0x6c')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0x2]?_0x590853['attrs'][0x2]['value']:undefined)||0xc}];case _0x411e('0x6d'):return[{'name':_0x411e('0x6e'),'value':_0x590853[_0x411e('0x6e')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x0]?_0x590853[_0x411e('0x62')][0x0][_0x411e('0x63')]:undefined)||_0x411e('0x6f')},{'name':_0x411e('0x70'),'value':_0x590853[_0x411e('0x70')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x1]?_0x590853[_0x411e('0x62')][0x1]['value']:undefined)||[]},{'name':_0x411e('0x6c'),'value':_0x590853[_0x411e('0x6c')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x2]?_0x590853[_0x411e('0x62')][0x2]['value']:undefined)||0x14},{'name':_0x411e('0x71'),'value':_0x590853[_0x411e('0x71')]||(_0x590853['attrs']&&_0x590853[_0x411e('0x62')][0x3]?_0x590853[_0x411e('0x62')][0x3][_0x411e('0x63')]:undefined)||'voice'},{'name':_0x411e('0x72'),'value':_0x590853['attrEmailAccounts']||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x4]?_0x590853[_0x411e('0x62')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x590853['attrFaxAccounts']||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x5]?_0x590853[_0x411e('0x62')][0x5][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x73'),'value':_0x590853[_0x411e('0x73')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0x6]?_0x590853[_0x411e('0x62')][0x6][_0x411e('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x590853[_0x411e('0x74')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x7]?_0x590853[_0x411e('0x62')][0x7][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x75'),'value':_0x590853[_0x411e('0x75')]||(_0x590853['attrs']&&_0x590853[_0x411e('0x62')][0x8]?_0x590853[_0x411e('0x62')][0x8][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x76'),'value':_0x590853[_0x411e('0x76')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0x9]?_0x590853[_0x411e('0x62')][0x9][_0x411e('0x63')]:undefined)||''}];case _0x411e('0x77'):case'pie-chart':return[{'name':_0x411e('0x78'),'value':_0x590853['attrSerie1']||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x0]?_0x590853['attrs'][0x0][_0x411e('0x63')]:undefined)||_0x411e('0x6f')},{'name':_0x411e('0x79'),'value':_0x590853[_0x411e('0x79')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x1]?_0x590853[_0x411e('0x62')][0x1][_0x411e('0x63')]:undefined)||null},{'name':_0x411e('0x7a'),'value':_0x590853['attrSerie3']||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x2]?_0x590853['attrs'][0x2][_0x411e('0x63')]:undefined)||null},{'name':_0x411e('0x70'),'value':_0x590853[_0x411e('0x70')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x3]?_0x590853['attrs'][0x3][_0x411e('0x63')]:undefined)||[]},{'name':_0x411e('0x71'),'value':_0x590853[_0x411e('0x71')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x4]?_0x590853[_0x411e('0x62')][0x4][_0x411e('0x63')]:undefined)||_0x411e('0x7b')},{'name':'attrEmailAccounts','value':_0x590853['attrEmailAccounts']||(_0x590853['attrs']&&_0x590853[_0x411e('0x62')][0x5]?_0x590853[_0x411e('0x62')][0x5][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x7c'),'value':_0x590853[_0x411e('0x7c')]||(_0x590853['attrs']&&_0x590853['attrs'][0x6]?_0x590853[_0x411e('0x62')][0x6][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x73'),'value':_0x590853[_0x411e('0x73')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0x7]?_0x590853[_0x411e('0x62')][0x7][_0x411e('0x63')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x590853['attrOpenchannelAccounts']||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x8]?_0x590853[_0x411e('0x62')][0x8][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x75'),'value':_0x590853[_0x411e('0x75')]||(_0x590853['attrs']&&_0x590853['attrs'][0x9]?_0x590853['attrs'][0x9][_0x411e('0x63')]:undefined)||''},{'name':_0x411e('0x76'),'value':_0x590853[_0x411e('0x76')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0xa]?_0x590853['attrs'][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x411e('0x7d'),'type':_0x590853[_0x411e('0x7e')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x0]?_0x590853['attrs'][0x0][_0x411e('0x34')]:undefined)||null,'value':_0x590853[_0x411e('0x7d')]||(_0x590853[_0x411e('0x62')]&&_0x590853['attrs'][0x0]?_0x590853[_0x411e('0x62')][0x0][_0x411e('0x63')]:undefined)||null},{'name':_0x411e('0x7f'),'value':_0x590853[_0x411e('0x7f')]||(_0x590853[_0x411e('0x62')]&&_0x590853[_0x411e('0x62')][0x1]?_0x590853[_0x411e('0x62')][0x1][_0x411e('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x5e61bd){logger[_0x411e('0x2e')](_0x411e('0x80'),JSON[_0x411e('0x81')](_0x5e61bd));return[];}}exports[_0x411e('0x82')]=function(_0x3857ab,_0x5d17ff,_0x3f3f8e){if(_0x3857ab[_0x411e('0x50')]['id']){delete _0x3857ab[_0x411e('0x50')]['id'];}return db[_0x411e('0x31')][_0x411e('0x4e')]({'where':{'id':_0x3857ab[_0x411e('0x4d')]['id']}})[_0x411e('0x2c')](handleEntityNotFound(_0x5d17ff,null))['then'](function(_0x57fdc9){if(_0x57fdc9){_0x3857ab[_0x411e('0x50')][_0x411e('0x83')]=_0x57fdc9['id'];_0x3857ab[_0x411e('0x50')][_0x411e('0x62')]=widgetAttributes(_0x3857ab['body']);return db['DashboardItem']['create'](_0x3857ab[_0x411e('0x50')]);}})['then'](respondWithResult(_0x5d17ff,null))[_0x411e('0x4c')](handleError(_0x5d17ff,null));};exports[_0x411e('0x84')]=function(_0x25423d,_0x1deab6,_0x46e58e){var _0xd0c9aa={};var _0x4e9784={};var _0x57770a;var _0x4a502d;return db[_0x411e('0x31')][_0x411e('0x85')]({'where':{'id':_0x25423d[_0x411e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1deab6,null))[_0x411e('0x2c')](function(_0x5b7a91){if(_0x5b7a91){_0x57770a=_0x5b7a91;_0x4e9784[_0x411e('0x36')]=_[_0x411e('0x37')](db[_0x411e('0x86')][_0x411e('0x32')]);_0x4e9784['query']=_[_0x411e('0x37')](_0x25423d[_0x411e('0x38')]);_0x4e9784[_0x411e('0x39')]=_[_0x411e('0x3a')](_0x4e9784['model'],_0x4e9784['query']);_0xd0c9aa['attributes']=_['intersection'](_0x4e9784['model'],qs[_0x411e('0x3c')](_0x25423d[_0x411e('0x38')][_0x411e('0x3c')]));_0xd0c9aa[_0x411e('0x3b')]=_0xd0c9aa[_0x411e('0x3b')][_0x411e('0x3d')]?_0xd0c9aa[_0x411e('0x3b')]:_0x4e9784[_0x411e('0x36')];_0xd0c9aa['order']=qs['sort'](_0x25423d[_0x411e('0x38')]['sort']);_0xd0c9aa['where']=qs['filters'](_[_0x411e('0x42')](_0x25423d['query'],_0x4e9784[_0x411e('0x39')]));if(_0x25423d[_0x411e('0x38')][_0x411e('0x43')]){_0xd0c9aa[_0x411e('0x41')]=_[_0x411e('0x44')](_0xd0c9aa[_0x411e('0x41')],{'$or':_[_0x411e('0x45')](_0xd0c9aa[_0x411e('0x3b')],function(_0x200730){var _0x4c2e97={};_0x4c2e97[_0x200730]={'$like':'%'+_0x25423d[_0x411e('0x38')][_0x411e('0x43')]+'%'};return _0x4c2e97;})});}_0xd0c9aa=_[_0x411e('0x44')]({},_0xd0c9aa,_0x25423d[_0x411e('0x47')]);return _0x57770a[_0x411e('0x84')](_0xd0c9aa);}})[_0x411e('0x2c')](function(_0x22a2d9){if(_0x22a2d9){_0x4a502d=_0x22a2d9[_0x411e('0x3d')];if(!_0x25423d[_0x411e('0x38')]['hasOwnProperty'](_0x411e('0x87'))){_0xd0c9aa['limit']=qs[_0x411e('0x25')](_0x25423d['query'][_0x411e('0x25')]);_0xd0c9aa[_0x411e('0x24')]=qs[_0x411e('0x24')](_0x25423d[_0x411e('0x38')][_0x411e('0x24')]);}return _0x57770a[_0x411e('0x84')](_0xd0c9aa);}})['then'](function(_0x4464de){if(_0x4464de){return _0x4464de?{'count':_0x4a502d,'rows':_0x4464de}:null;}})['then'](respondWithResult(_0x1deab6,null))[_0x411e('0x4c')](handleError(_0x1deab6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 9e6c571..8dff162 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 _0x09d3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb','Dashboard'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x09d3,0x16e));var _0x309d=function(_0x2fd7e3,_0x23eef9){_0x2fd7e3=_0x2fd7e3-0x0;var _0x3f6d46=_0x09d3[_0x2fd7e3];return _0x3f6d46;};'use strict';var EventEmitter=require(_0x309d('0x0'));var Dashboard=require(_0x309d('0x1'))['db'][_0x309d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x309d('0x3')](0x0);var events={'afterCreate':_0x309d('0x4'),'afterUpdate':_0x309d('0x5'),'afterDestroy':_0x309d('0x6')};function emitEvent(_0x2a4b21){return function(_0x58d0d3,_0x2ee349,_0x1bb14b){DashboardEvents[_0x309d('0x7')](_0x2a4b21+':'+_0x58d0d3['id'],_0x58d0d3);DashboardEvents[_0x309d('0x7')](_0x2a4b21,_0x58d0d3);_0x1bb14b(null);};}for(var e in events){if(events[_0x309d('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x8868=['save','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x8868,0x1ac));var _0x8886=function(_0x5359db,_0xad0416){_0x5359db=_0x5359db-0x0;var _0x34bdda=_0x8868[_0x5359db];return _0x34bdda;};'use strict';var EventEmitter=require(_0x8886('0x0'));var Dashboard=require(_0x8886('0x1'))['db'][_0x8886('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8886('0x3')](0x0);var events={'afterCreate':_0x8886('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x547dca){return function(_0x293a07,_0x4e9564,_0x26d276){DashboardEvents[_0x8886('0x5')](_0x547dca+':'+_0x293a07['id'],_0x293a07);DashboardEvents[_0x8886('0x5')](_0x547dca,_0x293a07);_0x26d276(null);};}for(var e in events){if(events[_0x8886('0x6')](e)){var event=events[e];Dashboard[_0x8886('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index bab4c73..b1e24c0 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 _0xb76f=['request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird'];(function(_0x16e725,_0x244eb4){var _0x1d419c=function(_0x4fb078){while(--_0x4fb078){_0x16e725['push'](_0x16e725['shift']());}};_0x1d419c(++_0x244eb4);}(_0xb76f,0x159));var _0xfb76=function(_0x3ad818,_0x494184){_0x3ad818=_0x3ad818-0x0;var _0x44938b=_0xb76f[_0x3ad818];return _0x44938b;};'use strict';var _=require(_0xfb76('0x0'));var util=require(_0xfb76('0x1'));var logger=require(_0xfb76('0x2'))('api');var moment=require(_0xfb76('0x3'));var BPromise=require(_0xfb76('0x4'));var rp=require(_0xfb76('0x5'));var fs=require('fs');var path=require(_0xfb76('0x6'));var rimraf=require(_0xfb76('0x7'));var config=require(_0xfb76('0x8'));var attributes=require(_0xfb76('0x9'));module[_0xfb76('0xa')]=function(_0x1b6f4c,_0x2e146c){return _0x1b6f4c[_0xfb76('0xb')](_0xfb76('0xc'),attributes,{'tableName':_0xfb76('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x438d=['dashboards','lodash','util','api','moment','bluebird','path','rimraf','./dashboard.attributes','exports','define'];(function(_0x4e7809,_0x3e36e6){var _0x1bdb02=function(_0x2dfe15){while(--_0x2dfe15){_0x4e7809['push'](_0x4e7809['shift']());}};_0x1bdb02(++_0x3e36e6);}(_0x438d,0x182));var _0xd438=function(_0x97ab47,_0x5cdab2){_0x97ab47=_0x97ab47-0x0;var _0x2d291f=_0x438d[_0x97ab47];return _0x2d291f;};'use strict';var _=require(_0xd438('0x0'));var util=require(_0xd438('0x1'));var logger=require('../../config/logger')(_0xd438('0x2'));var moment=require(_0xd438('0x3'));var BPromise=require(_0xd438('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd438('0x5'));var rimraf=require(_0xd438('0x6'));var config=require('../../config/environment');var attributes=require(_0xd438('0x7'));module[_0xd438('0x8')]=function(_0x85aa83,_0x564915){return _0x85aa83[_0xd438('0x9')]('Dashboard',attributes,{'tableName':_0xd438('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 370b67a..ca0ffaa 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 _0x9ef4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment'];(function(_0x554426,_0x2f4360){var _0x49ad51=function(_0x44e958){while(--_0x44e958){_0x554426['push'](_0x554426['shift']());}};_0x49ad51(++_0x2f4360);}(_0x9ef4,0xad));var _0x49ef=function(_0x4a0dd2,_0x2ce879){_0x4a0dd2=_0x4a0dd2-0x0;var _0x1b8c27=_0x9ef4[_0x4a0dd2];return _0x1b8c27;};'use strict';var _=require(_0x49ef('0x0'));var util=require('util');var moment=require(_0x49ef('0x1'));var BPromise=require(_0x49ef('0x2'));var rs=require(_0x49ef('0x3'));var fs=require('fs');var Redis=require(_0x49ef('0x4'));var db=require(_0x49ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x49ef('0x6'))('rpc');var config=require(_0x49ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x49ef('0x8')][_0x49ef('0x9')]({'port':0x232a});config[_0x49ef('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x49ef('0xa')]));require(_0x49ef('0xb'))[_0x49ef('0xc')](socket);function respondWithRpcPromise(_0x33d49a,_0x3f5f29,_0x40c530){return new BPromise(function(_0x3179c4,_0x4f28e3){return client[_0x49ef('0xd')](_0x33d49a,_0x40c530)[_0x49ef('0xe')](function(_0x5db694){logger[_0x49ef('0xf')](_0x49ef('0x10'),_0x3f5f29,_0x49ef('0x11'));logger[_0x49ef('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x3f5f29,'request\x20sent',JSON[_0x49ef('0x13')](_0x5db694));if(_0x5db694['error']){if(_0x5db694[_0x49ef('0x14')][_0x49ef('0x15')]===0x1f4){logger['error'](_0x49ef('0x10'),_0x3f5f29,_0x5db694['error'][_0x49ef('0x16')]);return _0x4f28e3(_0x5db694[_0x49ef('0x14')][_0x49ef('0x16')]);}logger[_0x49ef('0x14')](_0x49ef('0x10'),_0x3f5f29,_0x5db694[_0x49ef('0x14')][_0x49ef('0x16')]);return _0x3179c4(_0x5db694[_0x49ef('0x14')]['message']);}else{logger[_0x49ef('0xf')](_0x49ef('0x10'),_0x3f5f29,_0x49ef('0x11'));_0x3179c4(_0x5db694[_0x49ef('0x17')][_0x49ef('0x16')]);}})[_0x49ef('0x18')](function(_0x425fea){logger[_0x49ef('0x14')](_0x49ef('0x10'),_0x3f5f29,_0x425fea);_0x4f28e3(_0x425fea);});});} \ No newline at end of file +var _0xfea5=['error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0xfea5,0x94));var _0x5fea=function(_0x367097,_0x583938){_0x367097=_0x367097-0x0;var _0xba3bc1=_0xfea5[_0x367097];return _0xba3bc1;};'use strict';var _=require('lodash');var util=require(_0x5fea('0x0'));var moment=require(_0x5fea('0x1'));var BPromise=require(_0x5fea('0x2'));var rs=require(_0x5fea('0x3'));var fs=require('fs');var Redis=require(_0x5fea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5fea('0x5'));var logger=require(_0x5fea('0x6'))(_0x5fea('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5fea('0x8')]({'port':0x232a});config[_0x5fea('0x9')]=_[_0x5fea('0xa')](config[_0x5fea('0x9')],{'host':_0x5fea('0xb'),'port':0x18eb});var socket=require(_0x5fea('0xc'))(new Redis(config[_0x5fea('0x9')]));require(_0x5fea('0xd'))[_0x5fea('0xe')](socket);function respondWithRpcPromise(_0x481c2f,_0xc21dca,_0x18926f){return new BPromise(function(_0x530852,_0x433d94){return client[_0x5fea('0xf')](_0x481c2f,_0x18926f)[_0x5fea('0x10')](function(_0x5831c9){logger['info'](_0x5fea('0x11'),_0xc21dca,_0x5fea('0x12'));logger[_0x5fea('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0xc21dca,'request\x20sent',JSON['stringify'](_0x5831c9));if(_0x5831c9[_0x5fea('0x14')]){if(_0x5831c9[_0x5fea('0x14')]['code']===0x1f4){logger[_0x5fea('0x14')](_0x5fea('0x11'),_0xc21dca,_0x5831c9[_0x5fea('0x14')]['message']);return _0x433d94(_0x5831c9[_0x5fea('0x14')][_0x5fea('0x15')]);}logger['error'](_0x5fea('0x11'),_0xc21dca,_0x5831c9[_0x5fea('0x14')][_0x5fea('0x15')]);return _0x530852(_0x5831c9[_0x5fea('0x14')][_0x5fea('0x15')]);}else{logger['info'](_0x5fea('0x11'),_0xc21dca,_0x5fea('0x12'));_0x530852(_0x5831c9[_0x5fea('0x16')][_0x5fea('0x15')]);}})[_0x5fea('0x17')](function(_0x53dc93){logger['error'](_0x5fea('0x11'),_0xc21dca,_0x53dc93);_0x433d94(_0x53dc93);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index b8ecdfa..8d66d28 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 _0x1f65=['save','remove','emit','removeListener','register','length','./dashboard.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f65,0x6f));var _0x51f6=function(_0x1aa7b1,_0xe9e31d){_0x1aa7b1=_0x1aa7b1-0x0;var _0x5d4ff4=_0x1f65[_0x1aa7b1];return _0x5d4ff4;};'use strict';var DashboardEvents=require(_0x51f6('0x0'));var events=[_0x51f6('0x1'),_0x51f6('0x2'),'update'];function createListener(_0x3af20c,_0x2ea7d1){return function(_0xf4aea2){_0x2ea7d1[_0x51f6('0x3')](_0x3af20c,_0xf4aea2);};}function removeListener(_0x3f00ba,_0x280225){return function(){DashboardEvents[_0x51f6('0x4')](_0x3f00ba,_0x280225);};}exports[_0x51f6('0x5')]=function(_0x1b1dc5){for(var _0x41ef4f=0x0,_0x10778d=events[_0x51f6('0x6')];_0x41ef4f<_0x10778d;_0x41ef4f++){var _0x1c5493=events[_0x41ef4f];var _0x577a87=createListener('dashboard:'+_0x1c5493,_0x1b1dc5);DashboardEvents['on'](_0x1c5493,_0x577a87);}}; \ No newline at end of file +var _0x5dda=['length','dashboard:','save','remove','emit','register'];(function(_0x519a01,_0x39e9d0){var _0x368af3=function(_0x3e2d37){while(--_0x3e2d37){_0x519a01['push'](_0x519a01['shift']());}};_0x368af3(++_0x39e9d0);}(_0x5dda,0x164));var _0xa5dd=function(_0x23c150,_0xeab35){_0x23c150=_0x23c150-0x0;var _0x70336a=_0x5dda[_0x23c150];return _0x70336a;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xa5dd('0x0'),_0xa5dd('0x1'),'update'];function createListener(_0x3ae9cc,_0x30b2bc){return function(_0x1dd4a2){_0x30b2bc[_0xa5dd('0x2')](_0x3ae9cc,_0x1dd4a2);};}function removeListener(_0x115e70,_0x6c0a36){return function(){DashboardEvents['removeListener'](_0x115e70,_0x6c0a36);};}exports[_0xa5dd('0x3')]=function(_0x38f9b3){for(var _0x4a20a3=0x0,_0x36ef45=events[_0xa5dd('0x4')];_0x4a20a3<_0x36ef45;_0x4a20a3++){var _0x33fece=events[_0x4a20a3];var _0x29f766=createListener(_0xa5dd('0x5')+_0x33fece,_0x38f9b3);DashboardEvents['on'](_0x33fece,_0x29f766);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5cd5214..811115c 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 _0x7078=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','/:id','isAuthenticated','getItems','create','/:id/clone','post','/:id/items','put','update','exports','path','connect-timeout','express','Router'];(function(_0x2437a1,_0x4dfb16){var _0x4f20dc=function(_0x55ac01){while(--_0x55ac01){_0x2437a1['push'](_0x2437a1['shift']());}};_0x4f20dc(++_0x4dfb16);}(_0x7078,0x178));var _0x8707=function(_0x2abf7f,_0x23b05a){_0x2abf7f=_0x2abf7f-0x0;var _0x248bce=_0x7078[_0x2abf7f];return _0x248bce;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8707('0x0'));var timeout=require(_0x8707('0x1'));var express=require(_0x8707('0x2'));var router=express[_0x8707('0x3')]();var fs_extra=require(_0x8707('0x4'));var auth=require(_0x8707('0x5'));var interaction=require(_0x8707('0x6'));var config=require(_0x8707('0x7'));var controller=require(_0x8707('0x8'));router[_0x8707('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8707('0x9')](_0x8707('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x8707('0x9')]('/:id/items',auth[_0x8707('0xb')](),controller[_0x8707('0xc')]);router['post']('/',auth[_0x8707('0xb')](),controller[_0x8707('0xd')]);router['post'](_0x8707('0xe'),auth[_0x8707('0xb')](),controller['clone']);router[_0x8707('0xf')](_0x8707('0x10'),auth[_0x8707('0xb')](),controller['addItem']);router[_0x8707('0x11')](_0x8707('0xa'),auth[_0x8707('0xb')](),controller[_0x8707('0x12')]);router['delete'](_0x8707('0xa'),auth[_0x8707('0xb')](),controller['destroy']);module[_0x8707('0x13')]=router; \ No newline at end of file +var _0xd9b5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x2613f5,_0x34d0d2){var _0x4bff9b=function(_0x1d8948){while(--_0x1d8948){_0x2613f5['push'](_0x2613f5['shift']());}};_0x4bff9b(++_0x34d0d2);}(_0xd9b5,0x126));var _0x5d9b=function(_0x2625aa,_0x1bc020){_0x2625aa=_0x2625aa-0x0;var _0x3458fd=_0xd9b5[_0x2625aa];return _0x3458fd;};'use strict';var multer=require(_0x5d9b('0x0'));var util=require(_0x5d9b('0x1'));var path=require(_0x5d9b('0x2'));var timeout=require(_0x5d9b('0x3'));var express=require('express');var router=express[_0x5d9b('0x4')]();var fs_extra=require(_0x5d9b('0x5'));var auth=require(_0x5d9b('0x6'));var interaction=require(_0x5d9b('0x7'));var config=require(_0x5d9b('0x8'));var controller=require(_0x5d9b('0x9'));router[_0x5d9b('0xa')]('/',auth[_0x5d9b('0xb')](),controller[_0x5d9b('0xc')]);router[_0x5d9b('0xa')](_0x5d9b('0xd'),auth[_0x5d9b('0xb')](),controller[_0x5d9b('0xe')]);router[_0x5d9b('0xa')](_0x5d9b('0xf'),auth[_0x5d9b('0xb')](),controller[_0x5d9b('0x10')]);router[_0x5d9b('0x11')]('/',auth[_0x5d9b('0xb')](),controller['create']);router[_0x5d9b('0x11')](_0x5d9b('0x12'),auth[_0x5d9b('0xb')](),controller[_0x5d9b('0x13')]);router[_0x5d9b('0x11')](_0x5d9b('0xf'),auth[_0x5d9b('0xb')](),controller[_0x5d9b('0x14')]);router[_0x5d9b('0x15')](_0x5d9b('0xd'),auth['isAuthenticated'](),controller[_0x5d9b('0x16')]);router[_0x5d9b('0x17')](_0x5d9b('0xd'),auth[_0x5d9b('0xb')](),controller['destroy']);module[_0x5d9b('0x18')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index be2d35f..c1a29fb 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 _0x687b=['sequelize','squel','lodash','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','STRING','#ffffff','#2196f3'];(function(_0x253fa6,_0xa4c7f3){var _0x4311aa=function(_0x4c0e2a){while(--_0x4c0e2a){_0x253fa6['push'](_0x253fa6['shift']());}};_0x4311aa(++_0xa4c7f3);}(_0x687b,0x14a));var _0xb687=function(_0x48105b,_0x266487){_0x48105b=_0x48105b-0x0;var _0x1ca419=_0x687b[_0x48105b];return _0x1ca419;};'use strict';var Sequelize=require(_0xb687('0x0'));var squel=require(_0xb687('0x1'));var _=require(_0xb687('0x2'));module[_0xb687('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb687('0x4')](_0xb687('0x5')),'get':function(){try{return JSON[_0xb687('0x6')](this[_0xb687('0x7')](_0xb687('0x8')));}catch(_0x194c55){return[];}},'set':function(_0x16ccf3){try{this[_0xb687('0x9')](_0xb687('0x8'),JSON[_0xb687('0xa')](_0x16ccf3));}catch(_0x48942b){this[_0xb687('0x9')](_0xb687('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xb687('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb687('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb687('0xb')]},'col':{'type':Sequelize[_0xb687('0xb')]},'background':{'type':Sequelize[_0xb687('0xc')],'allowNull':![],'defaultValue':_0xb687('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb687('0xc')],'allowNull':![],'defaultValue':_0xb687('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb687('0xc')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x2542=['exports','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0x2542,0x169));var _0x2254=function(_0x4e222c,_0x4b76b8){_0x4e222c=_0x4e222c-0x0;var _0x519305=_0x2542[_0x4e222c];return _0x519305;};'use strict';var Sequelize=require(_0x2254('0x0'));var squel=require(_0x2254('0x1'));var _=require(_0x2254('0x2'));module[_0x2254('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2254('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x2254('0x5')),'get':function(){try{return JSON[_0x2254('0x6')](this[_0x2254('0x7')](_0x2254('0x8')));}catch(_0x76c902){return[];}},'set':function(_0x508183){try{this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')](_0x508183));}catch(_0x3c45ec){this[_0x2254('0x9')](_0x2254('0x8'),JSON[_0x2254('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x2254('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x2254('0xb')]},'col':{'type':Sequelize[_0x2254('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2254('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x2254('0x4')],'allowNull':![],'defaultValue':_0x2254('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x2254('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index a881a32..c9b5ef9 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 _0x1c75=['attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','attrFaxAccounts','web-report','attrReport','reportType','attrRefresh','stringify','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','DashboardItem','find','catch','type','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x535d14,_0xe332b1){var _0x413448=function(_0x5b3d7b){while(--_0x5b3d7b){_0x535d14['push'](_0x535d14['shift']());}};_0x413448(++_0xe332b1);}(_0x1c75,0xce));var _0x51c7=function(_0x347f4e,_0x51235d){_0x347f4e=_0x347f4e-0x0;var _0x32164d=_0x1c75[_0x347f4e];return _0x32164d;};'use strict';var emlformat=require(_0x51c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51c7('0x1'));var moment=require(_0x51c7('0x2'));var BPromise=require(_0x51c7('0x3'));var Mustache=require(_0x51c7('0x4'));var util=require(_0x51c7('0x5'));var path=require(_0x51c7('0x6'));var sox=require(_0x51c7('0x7'));var csv=require(_0x51c7('0x8'));var ejs=require(_0x51c7('0x9'));var fs=require('fs');var fs_extra=require(_0x51c7('0xa'));var _=require(_0x51c7('0xb'));var squel=require('squel');var crypto=require(_0x51c7('0xc'));var jsforce=require(_0x51c7('0xd'));var deskjs=require(_0x51c7('0xe'));var toCsv=require(_0x51c7('0x8'));var querystring=require('querystring');var Papa=require(_0x51c7('0xf'));var Redis=require('ioredis');var authService=require(_0x51c7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x51c7('0x11'));var hardwareService=require(_0x51c7('0x12'));var logger=require('../../config/logger')(_0x51c7('0x13'));var utils=require(_0x51c7('0x14'));var config=require(_0x51c7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x51c7('0x16')](config[_0x51c7('0x17')],{'host':_0x51c7('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51c7('0x17')]));require('./dashboardItem.socket')[_0x51c7('0x19')](socket);function respondWithStatusCode(_0x5a5ea9,_0x2e54af){_0x2e54af=_0x2e54af||0xcc;return function(_0x48f08a){if(_0x48f08a){return _0x5a5ea9[_0x51c7('0x1a')](_0x2e54af);}return _0x5a5ea9[_0x51c7('0x1b')](_0x2e54af)[_0x51c7('0x1c')]();};}function respondWithResult(_0x39da99,_0x521d8a){_0x521d8a=_0x521d8a||0xc8;return function(_0x177e14){if(_0x177e14){return _0x39da99[_0x51c7('0x1b')](_0x521d8a)[_0x51c7('0x1d')](_0x177e14);}};}function respondWithFilteredResult(_0x3079b7,_0x209ab3){return function(_0x36b29a){if(_0x36b29a){var _0x4a64e4=typeof _0x209ab3[_0x51c7('0x1e')]===_0x51c7('0x1f')&&typeof _0x209ab3[_0x51c7('0x20')]==='undefined';var _0x3c1f43=_0x36b29a[_0x51c7('0x21')];var _0x51f751=_0x4a64e4?0x0:_0x209ab3['offset'];var _0x1fa9d5=_0x4a64e4?_0x36b29a[_0x51c7('0x21')]:_0x209ab3[_0x51c7('0x1e')]+_0x209ab3[_0x51c7('0x20')];var _0x4072b9;if(_0x1fa9d5>=_0x3c1f43){_0x1fa9d5=_0x3c1f43;_0x4072b9=0xc8;}else{_0x4072b9=0xce;}_0x3079b7[_0x51c7('0x1b')](_0x4072b9);return _0x3079b7[_0x51c7('0x22')]('Content-Range',_0x51f751+'-'+_0x1fa9d5+'/'+_0x3c1f43)[_0x51c7('0x1d')](_0x36b29a);}return null;};}function patchUpdates(_0x11c83d){return function(_0x4e0108){try{jsonpatch[_0x51c7('0x23')](_0x4e0108,_0x11c83d,!![]);}catch(_0x48b259){return BPromise[_0x51c7('0x24')](_0x48b259);}return _0x4e0108[_0x51c7('0x25')]();};}function saveUpdates(_0x414de0,_0x48e6e6){return function(_0x11f01f){if(_0x11f01f){return _0x11f01f[_0x51c7('0x26')](_0x414de0)[_0x51c7('0x27')](function(_0x13a3ad){return _0x13a3ad;});}return null;};}function removeEntity(_0x44de99,_0x1c3935){return function(_0x57fe70){if(_0x57fe70){return _0x57fe70[_0x51c7('0x28')]()['then'](function(){_0x44de99[_0x51c7('0x1b')](0xcc)[_0x51c7('0x1c')]();});}};}function handleEntityNotFound(_0x331ad9,_0x1c29fb){return function(_0x375a70){if(!_0x375a70){_0x331ad9[_0x51c7('0x1a')](0x194);}return _0x375a70;};}function handleError(_0x32ac6e,_0x198465){_0x198465=_0x198465||0x1f4;return function(_0x42745b){logger[_0x51c7('0x29')](_0x42745b[_0x51c7('0x2a')]);if(_0x42745b[_0x51c7('0x2b')]){delete _0x42745b['name'];}_0x32ac6e[_0x51c7('0x1b')](_0x198465)[_0x51c7('0x2c')](_0x42745b);};}exports[_0x51c7('0x2d')]=function(_0x2eebb4,_0x588fbb){var _0x21ff27={'raw':![],'where':{'id':_0x2eebb4[_0x51c7('0x2e')]['id']}},_0x5e90bc={};_0x5e90bc[_0x51c7('0x2f')]=_[_0x51c7('0x30')](db['DashboardItem'][_0x51c7('0x31')]);_0x5e90bc['query']=_[_0x51c7('0x30')](_0x2eebb4[_0x51c7('0x32')]);_0x5e90bc[_0x51c7('0x33')]=_[_0x51c7('0x34')](_0x5e90bc[_0x51c7('0x2f')],_0x5e90bc[_0x51c7('0x32')]);_0x21ff27[_0x51c7('0x35')]=_[_0x51c7('0x34')](_0x5e90bc[_0x51c7('0x2f')],qs[_0x51c7('0x36')](_0x2eebb4['query'][_0x51c7('0x36')]));_0x21ff27['attributes']=_0x21ff27[_0x51c7('0x35')][_0x51c7('0x37')]?_0x21ff27['attributes']:_0x5e90bc[_0x51c7('0x2f')];if(_0x2eebb4[_0x51c7('0x32')][_0x51c7('0x38')]){_0x21ff27[_0x51c7('0x39')]=[{'all':!![]}];}_0x21ff27=_['merge']({},_0x21ff27,_0x2eebb4[_0x51c7('0x3a')]);return db[_0x51c7('0x3b')][_0x51c7('0x3c')](_0x21ff27)[_0x51c7('0x27')](handleEntityNotFound(_0x588fbb,null))['then'](respondWithResult(_0x588fbb,null))[_0x51c7('0x3d')](handleError(_0x588fbb,null));};exports[_0x51c7('0x28')]=function(_0x13fa10,_0x39ba1e){return db[_0x51c7('0x3b')]['find']({'where':{'id':_0x13fa10[_0x51c7('0x2e')]['id']}})['then'](handleEntityNotFound(_0x39ba1e,null))[_0x51c7('0x27')](removeEntity(_0x39ba1e,null))['catch'](handleError(_0x39ba1e,null));};function widgetAttributes(_0x12f54c){try{switch(_0x12f54c[_0x51c7('0x3e')]){case'iframe':return[{'name':_0x51c7('0x3f'),'value':_0x12f54c[_0x51c7('0x3f')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c['attrs'][0x0]['value']:undefined)||_0x51c7('0x41')}];case _0x51c7('0x42'):return[{'name':_0x51c7('0x43'),'value':_0x12f54c[_0x51c7('0x43')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c['attrs'][0x0][_0x51c7('0x44')]:undefined)||''}];case _0x51c7('0x45'):return[{'name':_0x51c7('0x46'),'value':_0x12f54c[_0x51c7('0x46')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x44')]:undefined)||_0x51c7('0x47')},{'name':_0x51c7('0x48'),'value':_0x12f54c[_0x51c7('0x48')]||(_0x12f54c['attrs']&&_0x12f54c['attrs'][0x1]?_0x12f54c[_0x51c7('0x40')][0x1][_0x51c7('0x44')]:undefined)||'0.00'},{'name':_0x51c7('0x49'),'value':_0x12f54c[_0x51c7('0x49')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x2]?_0x12f54c[_0x51c7('0x40')][0x2][_0x51c7('0x44')]:undefined)||0xc}];case _0x51c7('0x4a'):return[{'name':_0x51c7('0x4b'),'value':_0x12f54c[_0x51c7('0x4b')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x0]?_0x12f54c['attrs'][0x0][_0x51c7('0x44')]:undefined)||_0x51c7('0x4c')},{'name':_0x51c7('0x4d'),'value':_0x12f54c[_0x51c7('0x4d')]||(_0x12f54c['attrs']&&_0x12f54c['attrs'][0x1]?_0x12f54c[_0x51c7('0x40')][0x1][_0x51c7('0x44')]:undefined)||[]},{'name':_0x51c7('0x49'),'value':_0x12f54c['attrFontSize']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x2]?_0x12f54c[_0x51c7('0x40')][0x2][_0x51c7('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x12f54c[_0x51c7('0x4e')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x3]?_0x12f54c[_0x51c7('0x40')][0x3][_0x51c7('0x44')]:undefined)||_0x51c7('0x4f')},{'name':'attrEmailAccounts','value':_0x12f54c['attrEmailAccounts']||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x4]?_0x12f54c[_0x51c7('0x40')][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0x12f54c['attrFaxAccounts']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x5]?_0x12f54c[_0x51c7('0x40')][0x5][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x50'),'value':_0x12f54c[_0x51c7('0x50')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x6]?_0x12f54c[_0x51c7('0x40')][0x6][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x51'),'value':_0x12f54c[_0x51c7('0x51')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x7]?_0x12f54c[_0x51c7('0x40')][0x7]['value']:undefined)||''},{'name':_0x51c7('0x52'),'value':_0x12f54c[_0x51c7('0x52')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x8]?_0x12f54c[_0x51c7('0x40')][0x8]['value']:undefined)||''},{'name':_0x51c7('0x53'),'value':_0x12f54c[_0x51c7('0x53')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x9]?_0x12f54c[_0x51c7('0x40')][0x9][_0x51c7('0x44')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x51c7('0x54'),'value':_0x12f54c[_0x51c7('0x54')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x44')]:undefined)||_0x51c7('0x4c')},{'name':_0x51c7('0x55'),'value':_0x12f54c[_0x51c7('0x55')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x1]?_0x12f54c[_0x51c7('0x40')][0x1][_0x51c7('0x44')]:undefined)||null},{'name':_0x51c7('0x56'),'value':_0x12f54c[_0x51c7('0x56')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x2]?_0x12f54c[_0x51c7('0x40')][0x2][_0x51c7('0x44')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x12f54c['attrVoiceQueues']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x3]?_0x12f54c[_0x51c7('0x40')][0x3][_0x51c7('0x44')]:undefined)||[]},{'name':'attrChannel','value':_0x12f54c[_0x51c7('0x4e')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x4]?_0x12f54c[_0x51c7('0x40')][0x4][_0x51c7('0x44')]:undefined)||'voice'},{'name':_0x51c7('0x57'),'value':_0x12f54c[_0x51c7('0x57')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x5]?_0x12f54c['attrs'][0x5]['value']:undefined)||''},{'name':_0x51c7('0x58'),'value':_0x12f54c[_0x51c7('0x58')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x6]?_0x12f54c[_0x51c7('0x40')][0x6][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x50'),'value':_0x12f54c[_0x51c7('0x50')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x7]?_0x12f54c['attrs'][0x7]['value']:undefined)||''},{'name':_0x51c7('0x51'),'value':_0x12f54c['attrOpenchannelAccounts']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x8]?_0x12f54c[_0x51c7('0x40')][0x8][_0x51c7('0x44')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x12f54c[_0x51c7('0x52')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c['attrs'][0x9]?_0x12f54c['attrs'][0x9][_0x51c7('0x44')]:undefined)||''},{'name':_0x51c7('0x53'),'value':_0x12f54c['attrChatWebsites']||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0xa]?_0x12f54c[_0x51c7('0x40')][0xa]['value']:undefined)||''}];case _0x51c7('0x59'):return[{'name':_0x51c7('0x5a'),'type':_0x12f54c[_0x51c7('0x5b')]||(_0x12f54c['attrs']&&_0x12f54c['attrs'][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x3e')]:undefined)||null,'value':_0x12f54c[_0x51c7('0x5a')]||(_0x12f54c[_0x51c7('0x40')]&&_0x12f54c[_0x51c7('0x40')][0x0]?_0x12f54c[_0x51c7('0x40')][0x0][_0x51c7('0x44')]:undefined)||null},{'name':_0x51c7('0x5c'),'value':_0x12f54c[_0x51c7('0x5c')]||(_0x12f54c['attrs']&&_0x12f54c[_0x51c7('0x40')][0x1]?_0x12f54c['attrs'][0x1][_0x51c7('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x3dabf1){logger[_0x51c7('0x29')]('widgetAttributes:\x20%s',JSON[_0x51c7('0x5d')](_0x3dabf1));return[];}}exports[_0x51c7('0x5e')]=function(_0x354a96,_0x5470b7){if(_0x354a96[_0x51c7('0x5f')]){_0x354a96['body'][_0x51c7('0x40')]=widgetAttributes(_0x354a96[_0x51c7('0x5f')]);}return db['DashboardItem']['create'](_0x354a96['body'],{})[_0x51c7('0x27')](respondWithResult(_0x5470b7,0xc9))[_0x51c7('0x3d')](handleError(_0x5470b7,null));};exports[_0x51c7('0x26')]=function(_0x175bd1,_0x438e7f){if(_0x175bd1[_0x51c7('0x5f')]['id']){delete _0x175bd1[_0x51c7('0x5f')]['id'];}_0x175bd1[_0x51c7('0x5f')][_0x51c7('0x40')]=widgetAttributes(_0x175bd1['body']);return db[_0x51c7('0x3b')][_0x51c7('0x3c')]({'where':{'id':_0x175bd1['params']['id']}})[_0x51c7('0x27')](handleEntityNotFound(_0x438e7f,null))[_0x51c7('0x27')](saveUpdates(_0x175bd1[_0x51c7('0x5f')],null))['then'](respondWithResult(_0x438e7f,null))[_0x51c7('0x3d')](handleError(_0x438e7f,null));}; \ No newline at end of file +var _0x1dcc=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','attributes','intersection','fields','includeAll','include','merge','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','body','create','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse'];(function(_0x1ff212,_0x2c3934){var _0x30d3f3=function(_0x348ec2){while(--_0x348ec2){_0x1ff212['push'](_0x1ff212['shift']());}};_0x30d3f3(++_0x2c3934);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x13ec50,_0x1f532f){_0x13ec50=_0x13ec50-0x0;var _0x736ee7=_0x1dcc[_0x13ec50];return _0x736ee7;};'use strict';var emlformat=require(_0xc1dc('0x0'));var rimraf=require(_0xc1dc('0x1'));var zipdir=require(_0xc1dc('0x2'));var jsonpatch=require(_0xc1dc('0x3'));var rp=require('request-promise');var moment=require(_0xc1dc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1dc('0x5'));var util=require(_0xc1dc('0x6'));var path=require(_0xc1dc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc1dc('0x8'));var fs=require('fs');var fs_extra=require(_0xc1dc('0x9'));var _=require(_0xc1dc('0xa'));var squel=require('squel');var crypto=require(_0xc1dc('0xb'));var jsforce=require(_0xc1dc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc1dc('0xd'));var querystring=require('querystring');var Papa=require(_0xc1dc('0xe'));var Redis=require('ioredis');var authService=require(_0xc1dc('0xf'));var qs=require(_0xc1dc('0x10'));var as=require(_0xc1dc('0x11'));var hardwareService=require(_0xc1dc('0x12'));var logger=require(_0xc1dc('0x13'))(_0xc1dc('0x14'));var utils=require(_0xc1dc('0x15'));var config=require(_0xc1dc('0x16'));var licenseUtil=require(_0xc1dc('0x17'));var db=require('../../mysqldb')['db'];config[_0xc1dc('0x18')]=_[_0xc1dc('0x19')](config[_0xc1dc('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc1dc('0x1a'))(new Redis(config[_0xc1dc('0x18')]));require(_0xc1dc('0x1b'))[_0xc1dc('0x1c')](socket);function respondWithStatusCode(_0x145708,_0x322868){_0x322868=_0x322868||0xcc;return function(_0x188182){if(_0x188182){return _0x145708[_0xc1dc('0x1d')](_0x322868);}return _0x145708[_0xc1dc('0x1e')](_0x322868)[_0xc1dc('0x1f')]();};}function respondWithResult(_0x1cbbfe,_0x5885b0){_0x5885b0=_0x5885b0||0xc8;return function(_0x16ec8b){if(_0x16ec8b){return _0x1cbbfe[_0xc1dc('0x1e')](_0x5885b0)[_0xc1dc('0x20')](_0x16ec8b);}};}function respondWithFilteredResult(_0x3d3315,_0x47c72e){return function(_0x332400){if(_0x332400){var _0xc01137=typeof _0x47c72e['offset']==='undefined'&&typeof _0x47c72e[_0xc1dc('0x21')]===_0xc1dc('0x22');var _0x197941=_0x332400[_0xc1dc('0x23')];var _0x1707dc=_0xc01137?0x0:_0x47c72e[_0xc1dc('0x24')];var _0xedc38f=_0xc01137?_0x332400[_0xc1dc('0x23')]:_0x47c72e['offset']+_0x47c72e['limit'];var _0x4efe0d;if(_0xedc38f>=_0x197941){_0xedc38f=_0x197941;_0x4efe0d=0xc8;}else{_0x4efe0d=0xce;}_0x3d3315[_0xc1dc('0x1e')](_0x4efe0d);return _0x3d3315[_0xc1dc('0x25')]('Content-Range',_0x1707dc+'-'+_0xedc38f+'/'+_0x197941)[_0xc1dc('0x20')](_0x332400);}return null;};}function patchUpdates(_0x19325f){return function(_0x3f6552){try{jsonpatch[_0xc1dc('0x26')](_0x3f6552,_0x19325f,!![]);}catch(_0x22b80d){return BPromise[_0xc1dc('0x27')](_0x22b80d);}return _0x3f6552[_0xc1dc('0x28')]();};}function saveUpdates(_0x18ba56,_0x3efff1){return function(_0x1a6d65){if(_0x1a6d65){return _0x1a6d65['update'](_0x18ba56)[_0xc1dc('0x29')](function(_0xfeb0b1){return _0xfeb0b1;});}return null;};}function removeEntity(_0x17ce2b,_0x52b0b9){return function(_0x4e3ab2){if(_0x4e3ab2){return _0x4e3ab2[_0xc1dc('0x2a')]()[_0xc1dc('0x29')](function(){_0x17ce2b[_0xc1dc('0x1e')](0xcc)[_0xc1dc('0x1f')]();});}};}function handleEntityNotFound(_0x354e71,_0x152a50){return function(_0xd67136){if(!_0xd67136){_0x354e71[_0xc1dc('0x1d')](0x194);}return _0xd67136;};}function handleError(_0x204b8a,_0x5dbd36){_0x5dbd36=_0x5dbd36||0x1f4;return function(_0x2d5a57){logger[_0xc1dc('0x2b')](_0x2d5a57[_0xc1dc('0x2c')]);if(_0x2d5a57[_0xc1dc('0x2d')]){delete _0x2d5a57[_0xc1dc('0x2d')];}_0x204b8a[_0xc1dc('0x1e')](_0x5dbd36)[_0xc1dc('0x2e')](_0x2d5a57);};}exports[_0xc1dc('0x2f')]=function(_0x336add,_0x1182a4){var _0x3b9dc9={'raw':![],'where':{'id':_0x336add[_0xc1dc('0x30')]['id']}},_0x5c380c={};_0x5c380c[_0xc1dc('0x31')]=_[_0xc1dc('0x32')](db[_0xc1dc('0x33')][_0xc1dc('0x34')]);_0x5c380c[_0xc1dc('0x35')]=_[_0xc1dc('0x32')](_0x336add[_0xc1dc('0x35')]);_0x5c380c[_0xc1dc('0x36')]=_['intersection'](_0x5c380c['model'],_0x5c380c[_0xc1dc('0x35')]);_0x3b9dc9[_0xc1dc('0x37')]=_[_0xc1dc('0x38')](_0x5c380c[_0xc1dc('0x31')],qs[_0xc1dc('0x39')](_0x336add[_0xc1dc('0x35')]['fields']));_0x3b9dc9[_0xc1dc('0x37')]=_0x3b9dc9[_0xc1dc('0x37')]['length']?_0x3b9dc9[_0xc1dc('0x37')]:_0x5c380c[_0xc1dc('0x31')];if(_0x336add['query'][_0xc1dc('0x3a')]){_0x3b9dc9[_0xc1dc('0x3b')]=[{'all':!![]}];}_0x3b9dc9=_[_0xc1dc('0x3c')]({},_0x3b9dc9,_0x336add['options']);return db[_0xc1dc('0x33')][_0xc1dc('0x3d')](_0x3b9dc9)[_0xc1dc('0x29')](handleEntityNotFound(_0x1182a4,null))[_0xc1dc('0x29')](respondWithResult(_0x1182a4,null))[_0xc1dc('0x3e')](handleError(_0x1182a4,null));};exports[_0xc1dc('0x2a')]=function(_0x2dcc63,_0x796d11){return db[_0xc1dc('0x33')]['find']({'where':{'id':_0x2dcc63[_0xc1dc('0x30')]['id']}})[_0xc1dc('0x29')](handleEntityNotFound(_0x796d11,null))[_0xc1dc('0x29')](removeEntity(_0x796d11,null))['catch'](handleError(_0x796d11,null));};function widgetAttributes(_0x19bde9){try{switch(_0x19bde9[_0xc1dc('0x3f')]){case _0xc1dc('0x40'):return[{'name':_0xc1dc('0x41'),'value':_0x19bde9[_0xc1dc('0x41')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9[_0xc1dc('0x42')][0x0]['value']:undefined)||_0xc1dc('0x43')}];case _0xc1dc('0x44'):return[{'name':_0xc1dc('0x45'),'value':_0x19bde9[_0xc1dc('0x45')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9['attrs'][0x0][_0xc1dc('0x46')]:undefined)||''}];case _0xc1dc('0x47'):return[{'name':_0xc1dc('0x48'),'value':_0x19bde9[_0xc1dc('0x48')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x0]?_0x19bde9['attrs'][0x0][_0xc1dc('0x46')]:undefined)||_0xc1dc('0x49')},{'name':_0xc1dc('0x4a'),'value':_0x19bde9[_0xc1dc('0x4a')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x1]?_0x19bde9[_0xc1dc('0x42')][0x1]['value']:undefined)||_0xc1dc('0x4b')},{'name':_0xc1dc('0x4c'),'value':_0x19bde9[_0xc1dc('0x4c')]||(_0x19bde9['attrs']&&_0x19bde9[_0xc1dc('0x42')][0x2]?_0x19bde9[_0xc1dc('0x42')][0x2][_0xc1dc('0x46')]:undefined)||0xc}];case _0xc1dc('0x4d'):return[{'name':'attrMetric','value':_0x19bde9['attrMetric']||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9['attrs'][0x0][_0xc1dc('0x46')]:undefined)||_0xc1dc('0x4e')},{'name':_0xc1dc('0x4f'),'value':_0x19bde9[_0xc1dc('0x4f')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x1]?_0x19bde9[_0xc1dc('0x42')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x19bde9[_0xc1dc('0x4c')]||(_0x19bde9['attrs']&&_0x19bde9[_0xc1dc('0x42')][0x2]?_0x19bde9[_0xc1dc('0x42')][0x2][_0xc1dc('0x46')]:undefined)||0x14},{'name':_0xc1dc('0x50'),'value':_0x19bde9[_0xc1dc('0x50')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x3]?_0x19bde9[_0xc1dc('0x42')][0x3]['value']:undefined)||_0xc1dc('0x51')},{'name':_0xc1dc('0x52'),'value':_0x19bde9[_0xc1dc('0x52')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x4]?_0x19bde9[_0xc1dc('0x42')][0x4][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x53'),'value':_0x19bde9[_0xc1dc('0x53')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x5]?_0x19bde9['attrs'][0x5]['value']:undefined)||''},{'name':_0xc1dc('0x54'),'value':_0x19bde9[_0xc1dc('0x54')]||(_0x19bde9['attrs']&&_0x19bde9[_0xc1dc('0x42')][0x6]?_0x19bde9[_0xc1dc('0x42')][0x6]['value']:undefined)||''},{'name':_0xc1dc('0x55'),'value':_0x19bde9['attrOpenchannelAccounts']||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x7]?_0x19bde9[_0xc1dc('0x42')][0x7][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x56'),'value':_0x19bde9[_0xc1dc('0x56')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x8]?_0x19bde9['attrs'][0x8][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x57'),'value':_0x19bde9[_0xc1dc('0x57')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x9]?_0x19bde9[_0xc1dc('0x42')][0x9][_0xc1dc('0x46')]:undefined)||''}];case _0xc1dc('0x58'):case _0xc1dc('0x59'):return[{'name':_0xc1dc('0x5a'),'value':_0x19bde9[_0xc1dc('0x5a')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9['attrs'][0x0][_0xc1dc('0x46')]:undefined)||_0xc1dc('0x4e')},{'name':_0xc1dc('0x5b'),'value':_0x19bde9[_0xc1dc('0x5b')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x1]?_0x19bde9[_0xc1dc('0x42')][0x1]['value']:undefined)||null},{'name':_0xc1dc('0x5c'),'value':_0x19bde9[_0xc1dc('0x5c')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x2]?_0x19bde9[_0xc1dc('0x42')][0x2][_0xc1dc('0x46')]:undefined)||null},{'name':_0xc1dc('0x4f'),'value':_0x19bde9[_0xc1dc('0x4f')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x3]?_0x19bde9[_0xc1dc('0x42')][0x3]['value']:undefined)||[]},{'name':_0xc1dc('0x50'),'value':_0x19bde9[_0xc1dc('0x50')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x4]?_0x19bde9[_0xc1dc('0x42')][0x4][_0xc1dc('0x46')]:undefined)||_0xc1dc('0x51')},{'name':'attrEmailAccounts','value':_0x19bde9[_0xc1dc('0x52')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x5]?_0x19bde9['attrs'][0x5][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x53'),'value':_0x19bde9[_0xc1dc('0x53')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x6]?_0x19bde9['attrs'][0x6][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x54'),'value':_0x19bde9[_0xc1dc('0x54')]||(_0x19bde9['attrs']&&_0x19bde9[_0xc1dc('0x42')][0x7]?_0x19bde9[_0xc1dc('0x42')][0x7][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x55'),'value':_0x19bde9[_0xc1dc('0x55')]||(_0x19bde9['attrs']&&_0x19bde9[_0xc1dc('0x42')][0x8]?_0x19bde9[_0xc1dc('0x42')][0x8][_0xc1dc('0x46')]:undefined)||''},{'name':_0xc1dc('0x56'),'value':_0x19bde9[_0xc1dc('0x56')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x9]?_0x19bde9[_0xc1dc('0x42')][0x9][_0xc1dc('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x19bde9['attrChatWebsites']||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0xa]?_0x19bde9[_0xc1dc('0x42')][0xa][_0xc1dc('0x46')]:undefined)||''}];case _0xc1dc('0x5d'):return[{'name':_0xc1dc('0x5e'),'type':_0x19bde9[_0xc1dc('0x5f')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9[_0xc1dc('0x42')][0x0][_0xc1dc('0x3f')]:undefined)||null,'value':_0x19bde9[_0xc1dc('0x5e')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9[_0xc1dc('0x42')][0x0]?_0x19bde9[_0xc1dc('0x42')][0x0][_0xc1dc('0x46')]:undefined)||null},{'name':_0xc1dc('0x60'),'value':_0x19bde9[_0xc1dc('0x60')]||(_0x19bde9[_0xc1dc('0x42')]&&_0x19bde9['attrs'][0x1]?_0x19bde9[_0xc1dc('0x42')][0x1][_0xc1dc('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x260f68){logger['error']('widgetAttributes:\x20%s',JSON[_0xc1dc('0x61')](_0x260f68));return[];}}exports['create']=function(_0x1a9cc4,_0x1e0098){if(_0x1a9cc4[_0xc1dc('0x62')]){_0x1a9cc4[_0xc1dc('0x62')]['attrs']=widgetAttributes(_0x1a9cc4['body']);}return db[_0xc1dc('0x33')][_0xc1dc('0x63')](_0x1a9cc4[_0xc1dc('0x62')],{})[_0xc1dc('0x29')](respondWithResult(_0x1e0098,0xc9))[_0xc1dc('0x3e')](handleError(_0x1e0098,null));};exports[_0xc1dc('0x64')]=function(_0x439daa,_0x5e6625){if(_0x439daa[_0xc1dc('0x62')]['id']){delete _0x439daa['body']['id'];}_0x439daa[_0xc1dc('0x62')][_0xc1dc('0x42')]=widgetAttributes(_0x439daa['body']);return db[_0xc1dc('0x33')][_0xc1dc('0x3d')]({'where':{'id':_0x439daa['params']['id']}})[_0xc1dc('0x29')](handleEntityNotFound(_0x5e6625,null))[_0xc1dc('0x29')](saveUpdates(_0x439daa['body'],null))[_0xc1dc('0x29')](respondWithResult(_0x5e6625,null))[_0xc1dc('0x3e')](handleError(_0x5e6625,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 811e61d..1289909 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 _0x0fe0=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0fe0,0x1d2));var _0x00fe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0fe0[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x00fe('0x0'));var DashboardItem=require(_0x00fe('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x00fe('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x00fe('0x3')};function emitEvent(_0x5b8af5){return function(_0xbff9b,_0x1303e5,_0x5601dc){DashboardItemEvents[_0x00fe('0x4')](_0x5b8af5+':'+_0xbff9b['id'],_0xbff9b);DashboardItemEvents[_0x00fe('0x4')](_0x5b8af5,_0xbff9b);_0x5601dc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x00fe('0x5')](e,emitEvent(event));}}module[_0x00fe('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0xff48=['save','remove','emit','exports','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x118793,_0x2618b2){var _0x527018=function(_0x47239c){while(--_0x47239c){_0x118793['push'](_0x118793['shift']());}};_0x527018(++_0x2618b2);}(_0xff48,0xf2));var _0x8ff4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xff48[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x8ff4('0x0'))['db'][_0x8ff4('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8ff4('0x2')](0x0);var events={'afterCreate':_0x8ff4('0x3'),'afterUpdate':'update','afterDestroy':_0x8ff4('0x4')};function emitEvent(_0x47785e){return function(_0x241fd0,_0x29abc4,_0x5bea34){DashboardItemEvents[_0x8ff4('0x5')](_0x47785e+':'+_0x241fd0['id'],_0x241fd0);DashboardItemEvents[_0x8ff4('0x5')](_0x47785e,_0x241fd0);_0x5bea34(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x8ff4('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 76470e4..625fb9e 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 _0x9251=['path','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5af97c,_0x24a49f){var _0x3472ae=function(_0x54cdc3){while(--_0x54cdc3){_0x5af97c['push'](_0x5af97c['shift']());}};_0x3472ae(++_0x24a49f);}(_0x9251,0x1e6));var _0x1925=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0x9251[_0x1034ca];return _0x1a023a;};'use strict';var _=require('lodash');var util=require(_0x1925('0x0'));var logger=require(_0x1925('0x1'))(_0x1925('0x2'));var moment=require(_0x1925('0x3'));var BPromise=require(_0x1925('0x4'));var rp=require(_0x1925('0x5'));var fs=require('fs');var path=require(_0x1925('0x6'));var rimraf=require(_0x1925('0x7'));var config=require(_0x1925('0x8'));var attributes=require(_0x1925('0x9'));module['exports']=function(_0x24af68,_0xe3c3a5){return _0x24af68[_0x1925('0xa')](_0x1925('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x154e=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x149c82,_0x5521e9){var _0x1b032a=function(_0x3dd650){while(--_0x3dd650){_0x149c82['push'](_0x149c82['shift']());}};_0x1b032a(++_0x5521e9);}(_0x154e,0xd3));var _0xe154=function(_0x407bfc,_0x296d09){_0x407bfc=_0x407bfc-0x0;var _0x3a352d=_0x154e[_0x407bfc];return _0x3a352d;};'use strict';var _=require(_0xe154('0x0'));var util=require(_0xe154('0x1'));var logger=require(_0xe154('0x2'))('api');var moment=require(_0xe154('0x3'));var BPromise=require(_0xe154('0x4'));var rp=require(_0xe154('0x5'));var fs=require('fs');var path=require(_0xe154('0x6'));var rimraf=require(_0xe154('0x7'));var config=require(_0xe154('0x8'));var attributes=require(_0xe154('0x9'));module[_0xe154('0xa')]=function(_0x66f3ff,_0xe013a9){return _0x66f3ff[_0xe154('0xb')](_0xe154('0xc'),attributes,{'tableName':_0xe154('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index b1d4ef2..701d46d 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 _0x3d34=['localhost','register','request','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x3aa1d5,_0x470cc2){var _0x931515=function(_0x2d0a02){while(--_0x2d0a02){_0x3aa1d5['push'](_0x3aa1d5['shift']());}};_0x931515(++_0x470cc2);}(_0x3d34,0x1c7));var _0x43d3=function(_0x16dfb3,_0x1613fc){_0x16dfb3=_0x16dfb3-0x0;var _0x1d8030=_0x3d34[_0x16dfb3];return _0x1d8030;};'use strict';var _=require(_0x43d3('0x0'));var util=require(_0x43d3('0x1'));var moment=require(_0x43d3('0x2'));var BPromise=require(_0x43d3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43d3('0x4'));var db=require(_0x43d3('0x5'))['db'];var utils=require(_0x43d3('0x6'));var logger=require('../../config/logger')(_0x43d3('0x7'));var config=require(_0x43d3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x43d3('0x9')][_0x43d3('0xa')]({'port':0x232a});config[_0x43d3('0xb')]=_[_0x43d3('0xc')](config[_0x43d3('0xb')],{'host':_0x43d3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x43d3('0xb')]));require('./dashboardItem.socket')[_0x43d3('0xe')](socket);function respondWithRpcPromise(_0x13c9cb,_0x671bf2,_0x5df88c){return new BPromise(function(_0x2829c9,_0x2335ef){return client[_0x43d3('0xf')](_0x13c9cb,_0x5df88c)['then'](function(_0x167371){logger['info']('DashboardItem,\x20%s,\x20%s',_0x671bf2,_0x43d3('0x10'));logger[_0x43d3('0x11')](_0x43d3('0x12'),_0x671bf2,_0x43d3('0x10'),JSON[_0x43d3('0x13')](_0x167371));if(_0x167371[_0x43d3('0x14')]){if(_0x167371[_0x43d3('0x14')][_0x43d3('0x15')]===0x1f4){logger[_0x43d3('0x14')]('DashboardItem,\x20%s,\x20%s',_0x671bf2,_0x167371['error'][_0x43d3('0x16')]);return _0x2335ef(_0x167371[_0x43d3('0x14')][_0x43d3('0x16')]);}logger[_0x43d3('0x14')](_0x43d3('0x17'),_0x671bf2,_0x167371[_0x43d3('0x14')][_0x43d3('0x16')]);return _0x2829c9(_0x167371[_0x43d3('0x14')][_0x43d3('0x16')]);}else{logger[_0x43d3('0x18')](_0x43d3('0x17'),_0x671bf2,'request\x20sent');_0x2829c9(_0x167371['result'][_0x43d3('0x16')]);}})[_0x43d3('0x19')](function(_0x33044b){logger[_0x43d3('0x14')](_0x43d3('0x17'),_0x671bf2,_0x33044b);_0x2335ef(_0x33044b);});});} \ No newline at end of file +var _0xddbc=['redis','./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','localhost','socket.io-emitter'];(function(_0x3af7c0,_0xae3ae0){var _0x23a789=function(_0x3bef73){while(--_0x3bef73){_0x3af7c0['push'](_0x3af7c0['shift']());}};_0x23a789(++_0xae3ae0);}(_0xddbc,0x1f3));var _0xcddb=function(_0x3b4458,_0x36be7c){_0x3b4458=_0x3b4458-0x0;var _0x104891=_0xddbc[_0x3b4458];return _0x104891;};'use strict';var _=require(_0xcddb('0x0'));var util=require(_0xcddb('0x1'));var moment=require(_0xcddb('0x2'));var BPromise=require(_0xcddb('0x3'));var rs=require(_0xcddb('0x4'));var fs=require('fs');var Redis=require(_0xcddb('0x5'));var db=require(_0xcddb('0x6'))['db'];var utils=require(_0xcddb('0x7'));var logger=require(_0xcddb('0x8'))('rpc');var config=require(_0xcddb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcddb('0xa')][_0xcddb('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xcddb('0xc'),'port':0x18eb});var socket=require(_0xcddb('0xd'))(new Redis(config[_0xcddb('0xe')]));require(_0xcddb('0xf'))['register'](socket);function respondWithRpcPromise(_0x44a177,_0x3893dd,_0x153914){return new BPromise(function(_0x2eaeff,_0xf539ff){return client['request'](_0x44a177,_0x153914)[_0xcddb('0x10')](function(_0x1af0b7){logger[_0xcddb('0x11')](_0xcddb('0x12'),_0x3893dd,'request\x20sent');logger['debug'](_0xcddb('0x13'),_0x3893dd,_0xcddb('0x14'),JSON[_0xcddb('0x15')](_0x1af0b7));if(_0x1af0b7[_0xcddb('0x16')]){if(_0x1af0b7[_0xcddb('0x16')][_0xcddb('0x17')]===0x1f4){logger[_0xcddb('0x16')](_0xcddb('0x12'),_0x3893dd,_0x1af0b7[_0xcddb('0x16')][_0xcddb('0x18')]);return _0xf539ff(_0x1af0b7[_0xcddb('0x16')]['message']);}logger[_0xcddb('0x16')](_0xcddb('0x12'),_0x3893dd,_0x1af0b7[_0xcddb('0x16')]['message']);return _0x2eaeff(_0x1af0b7[_0xcddb('0x16')]['message']);}else{logger[_0xcddb('0x11')](_0xcddb('0x12'),_0x3893dd,_0xcddb('0x14'));_0x2eaeff(_0x1af0b7[_0xcddb('0x19')]['message']);}})[_0xcddb('0x1a')](function(_0x2a2b75){logger[_0xcddb('0x16')](_0xcddb('0x12'),_0x3893dd,_0x2a2b75);_0xf539ff(_0x2a2b75);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index ca133a0..8a0492e 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 _0x023a=['save','update','emit','removeListener','register','length'];(function(_0xa7f7b6,_0x4fd285){var _0x4e8221=function(_0xa0716e){while(--_0xa0716e){_0xa7f7b6['push'](_0xa7f7b6['shift']());}};_0x4e8221(++_0x4fd285);}(_0x023a,0xae));var _0xa023=function(_0x420f0b,_0x20948d){_0x420f0b=_0x420f0b-0x0;var _0x44a149=_0x023a[_0x420f0b];return _0x44a149;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xa023('0x0'),'remove',_0xa023('0x1')];function createListener(_0x258856,_0xe5b681){return function(_0x352d1a){_0xe5b681[_0xa023('0x2')](_0x258856,_0x352d1a);};}function removeListener(_0x2daf2e,_0x5edee8){return function(){DashboardItemEvents[_0xa023('0x3')](_0x2daf2e,_0x5edee8);};}exports[_0xa023('0x4')]=function(_0x5d9a55){for(var _0x5881f1=0x0,_0x299a36=events[_0xa023('0x5')];_0x5881f1<_0x299a36;_0x5881f1++){var _0x2c074a=events[_0x5881f1];var _0x46aed0=createListener('dashboardItem:'+_0x2c074a,_0x5d9a55);DashboardItemEvents['on'](_0x2c074a,_0x46aed0);}}; \ No newline at end of file +var _0x595c=['dashboardItem:','update','emit','removeListener','register','length'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x595c,0x1f3));var _0xc595=function(_0x469b0e,_0x43a3e4){_0x469b0e=_0x469b0e-0x0;var _0x5eaf17=_0x595c[_0x469b0e];return _0x5eaf17;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=['save','remove',_0xc595('0x0')];function createListener(_0x1aa6a1,_0x333093){return function(_0x47f922){_0x333093[_0xc595('0x1')](_0x1aa6a1,_0x47f922);};}function removeListener(_0x38a8f2,_0x1eea5d){return function(){DashboardItemEvents[_0xc595('0x2')](_0x38a8f2,_0x1eea5d);};}exports[_0xc595('0x3')]=function(_0x268694){for(var _0x529278=0x0,_0x520147=events[_0xc595('0x4')];_0x529278<_0x520147;_0x529278++){var _0x30d971=events[_0x529278];var _0x4fe826=createListener(_0xc595('0x5')+_0x30d971,_0x268694);DashboardItemEvents['on'](_0x30d971,_0x4fe826);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5a8afed..d92b351 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 _0xf0f2=['Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x541756,_0x4f2167){var _0x4351b4=function(_0x16dc59){while(--_0x16dc59){_0x541756['push'](_0x541756['shift']());}};_0x4351b4(++_0x4f2167);}(_0xf0f2,0x75));var _0x2f0f=function(_0x462a88,_0xbf35a2){_0x462a88=_0x462a88-0x0;var _0x2e86ce=_0xf0f2[_0x462a88];return _0x2e86ce;};'use strict';var multer=require(_0x2f0f('0x0'));var util=require(_0x2f0f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2f0f('0x2')]();var fs_extra=require(_0x2f0f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2f0f('0x4'));var config=require(_0x2f0f('0x5'));var controller=require(_0x2f0f('0x6'));router['get'](_0x2f0f('0x7'),auth[_0x2f0f('0x8')](),controller[_0x2f0f('0x9')]);router[_0x2f0f('0xa')]('/',auth[_0x2f0f('0x8')](),controller[_0x2f0f('0xb')]);router[_0x2f0f('0xc')]('/:id',auth[_0x2f0f('0x8')](),controller[_0x2f0f('0xd')]);router[_0x2f0f('0xe')](_0x2f0f('0x7'),auth[_0x2f0f('0x8')](),controller[_0x2f0f('0xf')]);module[_0x2f0f('0x10')]=router; \ No newline at end of file +var _0xe666=['post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show'];(function(_0xf5c724,_0x41ea3e){var _0x3f6d0f=function(_0x1a0e76){while(--_0x1a0e76){_0xf5c724['push'](_0xf5c724['shift']());}};_0x3f6d0f(++_0x41ea3e);}(_0xe666,0x14a));var _0x6e66=function(_0x3185a1,_0x335b0c){_0x3185a1=_0x3185a1-0x0;var _0xacaa78=_0xe666[_0x3185a1];return _0xacaa78;};'use strict';var multer=require(_0x6e66('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6e66('0x1'));var express=require(_0x6e66('0x2'));var router=express[_0x6e66('0x3')]();var fs_extra=require(_0x6e66('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6e66('0x5'));var config=require(_0x6e66('0x6'));var controller=require(_0x6e66('0x7'));router[_0x6e66('0x8')](_0x6e66('0x9'),auth[_0x6e66('0xa')](),controller[_0x6e66('0xb')]);router[_0x6e66('0xc')]('/',auth[_0x6e66('0xa')](),controller[_0x6e66('0xd')]);router['put'](_0x6e66('0x9'),auth['isAuthenticated'](),controller[_0x6e66('0xe')]);router[_0x6e66('0xf')](_0x6e66('0x9'),auth[_0x6e66('0xa')](),controller[_0x6e66('0x10')]);module[_0x6e66('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 9d69c56..918e534 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 _0x48b4=['ENUM','third','first','sequelize','exports','STRING'];(function(_0x520f3b,_0x2a7684){var _0x2e60fe=function(_0x468afb){while(--_0x468afb){_0x520f3b['push'](_0x520f3b['shift']());}};_0x2e60fe(++_0x2a7684);}(_0x48b4,0x147));var _0x448b=function(_0x214c4a,_0xfa03cd){_0x214c4a=_0x214c4a-0x0;var _0xc2011f=_0x48b4[_0x214c4a];return _0xc2011f;};'use strict';var Sequelize=require(_0x448b('0x0'));module[_0x448b('0x1')]={'name':{'type':Sequelize[_0x448b('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x448b('0x3')]('first','second',_0x448b('0x4')),'allowNull':![],'defaultValue':_0x448b('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x43af=['first','sequelize','exports','STRING','ENUM'];(function(_0x4fc7b3,_0x17e8eb){var _0xc6ca00=function(_0x2bdcc3){while(--_0x2bdcc3){_0x4fc7b3['push'](_0x4fc7b3['shift']());}};_0xc6ca00(++_0x17e8eb);}(_0x43af,0x18c));var _0xf43a=function(_0x15cce4,_0x1c32b2){_0x15cce4=_0x15cce4-0x0;var _0x5b2c23=_0x43af[_0x15cce4];return _0x5b2c23;};'use strict';var Sequelize=require(_0xf43a('0x0'));module[_0xf43a('0x1')]={'name':{'type':Sequelize[_0xf43a('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xf43a('0x3')](_0xf43a('0x4'),'second','third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xf43a('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index e0d191a..01406a2 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 _0xf360=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','Dispositions','UserProfileResource','stack','name','send','Disposition','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','get'];(function(_0x2bf284,_0x405951){var _0xd2510f=function(_0x5ccfcf){while(--_0x5ccfcf){_0x2bf284['push'](_0x2bf284['shift']());}};_0xd2510f(++_0x405951);}(_0xf360,0x9e));var _0x0f36=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xf360[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x0f36('0x0'));var rimraf=require(_0x0f36('0x1'));var zipdir=require(_0x0f36('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f36('0x3'));var moment=require('moment');var BPromise=require(_0x0f36('0x4'));var Mustache=require(_0x0f36('0x5'));var util=require(_0x0f36('0x6'));var path=require('path');var sox=require(_0x0f36('0x7'));var csv=require(_0x0f36('0x8'));var ejs=require(_0x0f36('0x9'));var fs=require('fs');var fs_extra=require(_0x0f36('0xa'));var _=require(_0x0f36('0xb'));var squel=require(_0x0f36('0xc'));var crypto=require(_0x0f36('0xd'));var jsforce=require(_0x0f36('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0f36('0x8'));var querystring=require(_0x0f36('0xf'));var Papa=require(_0x0f36('0x10'));var Redis=require(_0x0f36('0x11'));var authService=require(_0x0f36('0x12'));var qs=require(_0x0f36('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f36('0x14'));var logger=require(_0x0f36('0x15'))(_0x0f36('0x16'));var utils=require('../../config/utils');var config=require(_0x0f36('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x478313,_0xea1040){_0xea1040=_0xea1040||0xcc;return function(_0x4e30cc){if(_0x4e30cc){return _0x478313[_0x0f36('0x18')](_0xea1040);}return _0x478313[_0x0f36('0x19')](_0xea1040)[_0x0f36('0x1a')]();};}function respondWithResult(_0xb021c,_0x5dee19){_0x5dee19=_0x5dee19||0xc8;return function(_0x1a06cc){if(_0x1a06cc){return _0xb021c['status'](_0x5dee19)[_0x0f36('0x1b')](_0x1a06cc);}};}function respondWithFilteredResult(_0x19afe8,_0x420baf){return function(_0x38e64a){if(_0x38e64a){var _0x167825=typeof _0x420baf[_0x0f36('0x1c')]===_0x0f36('0x1d')&&typeof _0x420baf['limit']==='undefined';var _0x2f26d2=_0x38e64a[_0x0f36('0x1e')];var _0x4b48eb=_0x167825?0x0:_0x420baf['offset'];var _0x121ff3=_0x167825?_0x38e64a[_0x0f36('0x1e')]:_0x420baf['offset']+_0x420baf[_0x0f36('0x1f')];var _0x28eaf2;if(_0x121ff3>=_0x2f26d2){_0x121ff3=_0x2f26d2;_0x28eaf2=0xc8;}else{_0x28eaf2=0xce;}_0x19afe8['status'](_0x28eaf2);return _0x19afe8[_0x0f36('0x20')]('Content-Range',_0x4b48eb+'-'+_0x121ff3+'/'+_0x2f26d2)['json'](_0x38e64a);}return null;};}function patchUpdates(_0x2f7972){return function(_0x1b365a){try{jsonpatch['apply'](_0x1b365a,_0x2f7972,!![]);}catch(_0x5888c5){return BPromise[_0x0f36('0x21')](_0x5888c5);}return _0x1b365a[_0x0f36('0x22')]();};}function saveUpdates(_0x5c15d9,_0x249b7a){return function(_0x567814){if(_0x567814){return _0x567814[_0x0f36('0x23')](_0x5c15d9)['then'](function(_0x2eb5be){return _0x2eb5be;});}return null;};}function removeEntity(_0x21837e,_0x15722f){return function(_0x552d90){if(_0x552d90){return _0x552d90[_0x0f36('0x24')]()[_0x0f36('0x25')](function(){var _0x1e87c9=_0x552d90['get']({'plain':!![]});var _0x2e7ee5=_0x0f36('0x26');return db[_0x0f36('0x27')][_0x0f36('0x24')]({'where':{'type':_0x2e7ee5,'resourceId':_0x1e87c9['id']}})['then'](function(){return _0x552d90;});})[_0x0f36('0x25')](function(){_0x21837e['status'](0xcc)[_0x0f36('0x1a')]();});}};}function handleEntityNotFound(_0x481492,_0x186527){return function(_0x3b8385){if(!_0x3b8385){_0x481492[_0x0f36('0x18')](0x194);}return _0x3b8385;};}function handleError(_0x40ca49,_0x4ad99d){_0x4ad99d=_0x4ad99d||0x1f4;return function(_0x398dcd){logger['error'](_0x398dcd[_0x0f36('0x28')]);if(_0x398dcd[_0x0f36('0x29')]){delete _0x398dcd[_0x0f36('0x29')];}_0x40ca49[_0x0f36('0x19')](_0x4ad99d)[_0x0f36('0x2a')](_0x398dcd);};}exports['index']=function(_0x15f872,_0x21f4c5){var _0x43974a={},_0x161e11={},_0xbd824c={'count':0x0,'rows':[]};var _0x4b76e7=_['map'](db[_0x0f36('0x2b')][_0x0f36('0x2c')],function(_0x10b43c){return{'name':_0x10b43c[_0x0f36('0x2d')],'type':_0x10b43c[_0x0f36('0x2e')]['key']};});_0x161e11[_0x0f36('0x2f')]=_['map'](_0x4b76e7,_0x0f36('0x29'));_0x161e11['query']=_[_0x0f36('0x30')](_0x15f872['query']);_0x161e11[_0x0f36('0x31')]=_[_0x0f36('0x32')](_0x161e11[_0x0f36('0x2f')],_0x161e11[_0x0f36('0x33')]);_0x43974a[_0x0f36('0x34')]=_[_0x0f36('0x32')](_0x161e11[_0x0f36('0x2f')],qs[_0x0f36('0x35')](_0x15f872[_0x0f36('0x33')][_0x0f36('0x35')]));_0x43974a[_0x0f36('0x34')]=_0x43974a[_0x0f36('0x34')][_0x0f36('0x36')]?_0x43974a[_0x0f36('0x34')]:_0x161e11[_0x0f36('0x2f')];if(!_0x15f872[_0x0f36('0x33')]['hasOwnProperty'](_0x0f36('0x37'))){_0x43974a['limit']=qs[_0x0f36('0x1f')](_0x15f872[_0x0f36('0x33')]['limit']);_0x43974a[_0x0f36('0x1c')]=qs[_0x0f36('0x1c')](_0x15f872['query'][_0x0f36('0x1c')]);}_0x43974a[_0x0f36('0x38')]=qs[_0x0f36('0x39')](_0x15f872['query']['sort']);_0x43974a[_0x0f36('0x3a')]=qs[_0x0f36('0x31')](_[_0x0f36('0x3b')](_0x15f872[_0x0f36('0x33')],_0x161e11[_0x0f36('0x31')]),_0x4b76e7);if(_0x15f872['query'][_0x0f36('0x3c')]){_0x43974a['where']=_['merge'](_0x43974a[_0x0f36('0x3a')],{'$or':_['map'](_0x4b76e7,function(_0x415807){if(_0x415807[_0x0f36('0x2e')]!=='VIRTUAL'){var _0x4d9794={};_0x4d9794[_0x415807['name']]={'$like':'%'+_0x15f872[_0x0f36('0x33')][_0x0f36('0x3c')]+'%'};return _0x4d9794;}})});}_0x43974a=_[_0x0f36('0x3d')]({},_0x43974a,_0x15f872[_0x0f36('0x3e')]);var _0x93299={'where':_0x43974a[_0x0f36('0x3a')]};return db[_0x0f36('0x2b')][_0x0f36('0x1e')](_0x93299)['then'](function(_0x25a8ef){_0xbd824c[_0x0f36('0x1e')]=_0x25a8ef;if(_0x15f872['query'][_0x0f36('0x3f')]){_0x43974a[_0x0f36('0x40')]=[{'all':!![]}];}return db['Disposition'][_0x0f36('0x41')](_0x43974a);})[_0x0f36('0x25')](function(_0xfd3189){_0xbd824c['rows']=_0xfd3189;return _0xbd824c;})[_0x0f36('0x25')](respondWithFilteredResult(_0x21f4c5,_0x43974a))[_0x0f36('0x42')](handleError(_0x21f4c5,null));};exports['show']=function(_0x23e4a2,_0x27d8df){var _0x42014c={'raw':!![],'where':{'id':_0x23e4a2[_0x0f36('0x43')]['id']}},_0x26214c={};_0x26214c['model']=_['keys'](db['Disposition']['rawAttributes']);_0x26214c[_0x0f36('0x33')]=_[_0x0f36('0x30')](_0x23e4a2['query']);_0x26214c[_0x0f36('0x31')]=_[_0x0f36('0x32')](_0x26214c[_0x0f36('0x2f')],_0x26214c['query']);_0x42014c['attributes']=_[_0x0f36('0x32')](_0x26214c[_0x0f36('0x2f')],qs['fields'](_0x23e4a2[_0x0f36('0x33')]['fields']));_0x42014c[_0x0f36('0x34')]=_0x42014c[_0x0f36('0x34')][_0x0f36('0x36')]?_0x42014c['attributes']:_0x26214c['model'];if(_0x23e4a2[_0x0f36('0x33')][_0x0f36('0x3f')]){_0x42014c[_0x0f36('0x40')]=[{'all':!![]}];}_0x42014c=_['merge']({},_0x42014c,_0x23e4a2['options']);return db[_0x0f36('0x2b')][_0x0f36('0x44')](_0x42014c)[_0x0f36('0x25')](handleEntityNotFound(_0x27d8df,null))[_0x0f36('0x25')](respondWithResult(_0x27d8df,null))['catch'](handleError(_0x27d8df,null));};exports[_0x0f36('0x45')]=function(_0x8afde7,_0x11e8e1){return db[_0x0f36('0x2b')][_0x0f36('0x45')](_0x8afde7[_0x0f36('0x46')],{})[_0x0f36('0x25')](function(_0x51099e){var _0x43d75f=_0x8afde7[_0x0f36('0x47')][_0x0f36('0x48')]({'plain':!![]});if(!_0x43d75f)throw new Error(_0x0f36('0x49'));if(_0x43d75f[_0x0f36('0x4a')]===_0x0f36('0x47')){var _0x1188f2=_0x51099e[_0x0f36('0x48')]({'plain':!![]});var _0x51ce28=_0x0f36('0x26');return db['UserProfileSection'][_0x0f36('0x44')]({'where':{'name':_0x51ce28,'userProfileId':_0x43d75f[_0x0f36('0x4b')]},'raw':!![]})[_0x0f36('0x25')](function(_0xcc6d7f){if(_0xcc6d7f&&_0xcc6d7f[_0x0f36('0x4c')]===0x0){return db[_0x0f36('0x27')]['create']({'name':_0x1188f2[_0x0f36('0x29')],'resourceId':_0x1188f2['id'],'type':_0xcc6d7f['name'],'sectionId':_0xcc6d7f['id']},{})['then'](function(){return _0x51099e;});}else{return _0x51099e;}})['catch'](function(_0x270104){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x270104);throw _0x270104;});}return _0x51099e;})[_0x0f36('0x25')](respondWithResult(_0x11e8e1,0xc9))[_0x0f36('0x42')](handleError(_0x11e8e1,null));};exports[_0x0f36('0x23')]=function(_0x2a5217,_0x2e2eb7){if(_0x2a5217[_0x0f36('0x46')]['id']){delete _0x2a5217['body']['id'];}return db['Disposition']['find']({'where':{'id':_0x2a5217[_0x0f36('0x43')]['id']}})[_0x0f36('0x25')](handleEntityNotFound(_0x2e2eb7,null))[_0x0f36('0x25')](saveUpdates(_0x2a5217[_0x0f36('0x46')],null))[_0x0f36('0x25')](respondWithResult(_0x2e2eb7,null))[_0x0f36('0x42')](handleError(_0x2e2eb7,null));};exports[_0x0f36('0x24')]=function(_0x3ab5ee,_0x3514df){return db['Disposition'][_0x0f36('0x44')]({'where':{'id':_0x3ab5ee[_0x0f36('0x43')]['id']}})['then'](handleEntityNotFound(_0x3514df,null))[_0x0f36('0x25')](removeEntity(_0x3514df,null))[_0x0f36('0x42')](handleError(_0x3514df,null));}; \ No newline at end of file +var _0xc6f8=['params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','then','get','error','stack','name','send','index','map','Disposition','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x15fa6a,_0x20ae9d){var _0xae4565=function(_0x1930a8){while(--_0x1930a8){_0x15fa6a['push'](_0x15fa6a['shift']());}};_0xae4565(++_0x20ae9d);}(_0xc6f8,0x14c));var _0x8c6f=function(_0x4178c7,_0x6999b2){_0x4178c7=_0x4178c7-0x0;var _0x3b921a=_0xc6f8[_0x4178c7];return _0x3b921a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8c6f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c6f('0x1'));var moment=require(_0x8c6f('0x2'));var BPromise=require(_0x8c6f('0x3'));var Mustache=require(_0x8c6f('0x4'));var util=require(_0x8c6f('0x5'));var path=require('path');var sox=require(_0x8c6f('0x6'));var csv=require('to-csv');var ejs=require(_0x8c6f('0x7'));var fs=require('fs');var fs_extra=require(_0x8c6f('0x8'));var _=require('lodash');var squel=require(_0x8c6f('0x9'));var crypto=require('crypto');var jsforce=require(_0x8c6f('0xa'));var deskjs=require(_0x8c6f('0xb'));var toCsv=require(_0x8c6f('0xc'));var querystring=require('querystring');var Papa=require(_0x8c6f('0xd'));var Redis=require(_0x8c6f('0xe'));var authService=require(_0x8c6f('0xf'));var qs=require(_0x8c6f('0x10'));var as=require(_0x8c6f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8c6f('0x12'));var utils=require(_0x8c6f('0x13'));var config=require(_0x8c6f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c6f('0x15'))['db'];function respondWithStatusCode(_0x41e2a3,_0x372dc3){_0x372dc3=_0x372dc3||0xcc;return function(_0xdcb8bd){if(_0xdcb8bd){return _0x41e2a3[_0x8c6f('0x16')](_0x372dc3);}return _0x41e2a3[_0x8c6f('0x17')](_0x372dc3)[_0x8c6f('0x18')]();};}function respondWithResult(_0x3b1b26,_0xf9b0e3){_0xf9b0e3=_0xf9b0e3||0xc8;return function(_0x58f6ca){if(_0x58f6ca){return _0x3b1b26['status'](_0xf9b0e3)[_0x8c6f('0x19')](_0x58f6ca);}};}function respondWithFilteredResult(_0x1f20e9,_0x30d841){return function(_0x326cec){if(_0x326cec){var _0x469187=typeof _0x30d841[_0x8c6f('0x1a')]==='undefined'&&typeof _0x30d841[_0x8c6f('0x1b')]===_0x8c6f('0x1c');var _0x23e4a1=_0x326cec[_0x8c6f('0x1d')];var _0x57d008=_0x469187?0x0:_0x30d841[_0x8c6f('0x1a')];var _0x558ed5=_0x469187?_0x326cec[_0x8c6f('0x1d')]:_0x30d841['offset']+_0x30d841[_0x8c6f('0x1b')];var _0x173ca1;if(_0x558ed5>=_0x23e4a1){_0x558ed5=_0x23e4a1;_0x173ca1=0xc8;}else{_0x173ca1=0xce;}_0x1f20e9['status'](_0x173ca1);return _0x1f20e9[_0x8c6f('0x1e')](_0x8c6f('0x1f'),_0x57d008+'-'+_0x558ed5+'/'+_0x23e4a1)[_0x8c6f('0x19')](_0x326cec);}return null;};}function patchUpdates(_0xc256e1){return function(_0x53fe61){try{jsonpatch['apply'](_0x53fe61,_0xc256e1,!![]);}catch(_0x2033bc){return BPromise[_0x8c6f('0x20')](_0x2033bc);}return _0x53fe61['save']();};}function saveUpdates(_0x67dd2d,_0x59a65f){return function(_0x350768){if(_0x350768){return _0x350768[_0x8c6f('0x21')](_0x67dd2d)['then'](function(_0x5ce23d){return _0x5ce23d;});}return null;};}function removeEntity(_0x230863,_0x5c4fef){return function(_0x259f8a){if(_0x259f8a){return _0x259f8a[_0x8c6f('0x22')]()[_0x8c6f('0x23')](function(){var _0x1183da=_0x259f8a[_0x8c6f('0x24')]({'plain':!![]});var _0x437b64='Dispositions';return db['UserProfileResource']['destroy']({'where':{'type':_0x437b64,'resourceId':_0x1183da['id']}})[_0x8c6f('0x23')](function(){return _0x259f8a;});})[_0x8c6f('0x23')](function(){_0x230863[_0x8c6f('0x17')](0xcc)[_0x8c6f('0x18')]();});}};}function handleEntityNotFound(_0x4fe8e3,_0x4cf257){return function(_0x349585){if(!_0x349585){_0x4fe8e3[_0x8c6f('0x16')](0x194);}return _0x349585;};}function handleError(_0x5d09bc,_0x15e7a2){_0x15e7a2=_0x15e7a2||0x1f4;return function(_0x380d1d){logger[_0x8c6f('0x25')](_0x380d1d[_0x8c6f('0x26')]);if(_0x380d1d[_0x8c6f('0x27')]){delete _0x380d1d[_0x8c6f('0x27')];}_0x5d09bc[_0x8c6f('0x17')](_0x15e7a2)[_0x8c6f('0x28')](_0x380d1d);};}exports[_0x8c6f('0x29')]=function(_0x5aff44,_0x4f329b){var _0x5a3c8f={},_0xaa92fd={},_0x4dc2f1={'count':0x0,'rows':[]};var _0x31b865=_[_0x8c6f('0x2a')](db[_0x8c6f('0x2b')][_0x8c6f('0x2c')],function(_0x409fc4){return{'name':_0x409fc4['fieldName'],'type':_0x409fc4['type']['key']};});_0xaa92fd[_0x8c6f('0x2d')]=_[_0x8c6f('0x2a')](_0x31b865,_0x8c6f('0x27'));_0xaa92fd['query']=_[_0x8c6f('0x2e')](_0x5aff44[_0x8c6f('0x2f')]);_0xaa92fd[_0x8c6f('0x30')]=_[_0x8c6f('0x31')](_0xaa92fd[_0x8c6f('0x2d')],_0xaa92fd[_0x8c6f('0x2f')]);_0x5a3c8f[_0x8c6f('0x32')]=_[_0x8c6f('0x31')](_0xaa92fd['model'],qs['fields'](_0x5aff44[_0x8c6f('0x2f')][_0x8c6f('0x33')]));_0x5a3c8f['attributes']=_0x5a3c8f[_0x8c6f('0x32')][_0x8c6f('0x34')]?_0x5a3c8f[_0x8c6f('0x32')]:_0xaa92fd['model'];if(!_0x5aff44[_0x8c6f('0x2f')][_0x8c6f('0x35')]('nolimit')){_0x5a3c8f['limit']=qs[_0x8c6f('0x1b')](_0x5aff44[_0x8c6f('0x2f')]['limit']);_0x5a3c8f[_0x8c6f('0x1a')]=qs['offset'](_0x5aff44['query'][_0x8c6f('0x1a')]);}_0x5a3c8f[_0x8c6f('0x36')]=qs['sort'](_0x5aff44[_0x8c6f('0x2f')][_0x8c6f('0x37')]);_0x5a3c8f[_0x8c6f('0x38')]=qs['filters'](_['pick'](_0x5aff44[_0x8c6f('0x2f')],_0xaa92fd['filters']),_0x31b865);if(_0x5aff44[_0x8c6f('0x2f')][_0x8c6f('0x39')]){_0x5a3c8f[_0x8c6f('0x38')]=_[_0x8c6f('0x3a')](_0x5a3c8f[_0x8c6f('0x38')],{'$or':_[_0x8c6f('0x2a')](_0x31b865,function(_0x1cb7db){if(_0x1cb7db[_0x8c6f('0x3b')]!==_0x8c6f('0x3c')){var _0x5eb4ab={};_0x5eb4ab[_0x1cb7db[_0x8c6f('0x27')]]={'$like':'%'+_0x5aff44[_0x8c6f('0x2f')]['filter']+'%'};return _0x5eb4ab;}})});}_0x5a3c8f=_[_0x8c6f('0x3a')]({},_0x5a3c8f,_0x5aff44[_0x8c6f('0x3d')]);var _0x56f580={'where':_0x5a3c8f[_0x8c6f('0x38')]};return db[_0x8c6f('0x2b')][_0x8c6f('0x1d')](_0x56f580)[_0x8c6f('0x23')](function(_0x7330a8){_0x4dc2f1[_0x8c6f('0x1d')]=_0x7330a8;if(_0x5aff44['query'][_0x8c6f('0x3e')]){_0x5a3c8f[_0x8c6f('0x3f')]=[{'all':!![]}];}return db[_0x8c6f('0x2b')][_0x8c6f('0x40')](_0x5a3c8f);})['then'](function(_0x455a22){_0x4dc2f1[_0x8c6f('0x41')]=_0x455a22;return _0x4dc2f1;})[_0x8c6f('0x23')](respondWithFilteredResult(_0x4f329b,_0x5a3c8f))[_0x8c6f('0x42')](handleError(_0x4f329b,null));};exports[_0x8c6f('0x43')]=function(_0x5edf48,_0x1d3ce9){var _0xb2a21={'raw':!![],'where':{'id':_0x5edf48[_0x8c6f('0x44')]['id']}},_0x237c9f={};_0x237c9f[_0x8c6f('0x2d')]=_[_0x8c6f('0x2e')](db['Disposition'][_0x8c6f('0x2c')]);_0x237c9f[_0x8c6f('0x2f')]=_['keys'](_0x5edf48[_0x8c6f('0x2f')]);_0x237c9f[_0x8c6f('0x30')]=_[_0x8c6f('0x31')](_0x237c9f[_0x8c6f('0x2d')],_0x237c9f[_0x8c6f('0x2f')]);_0xb2a21[_0x8c6f('0x32')]=_[_0x8c6f('0x31')](_0x237c9f['model'],qs[_0x8c6f('0x33')](_0x5edf48[_0x8c6f('0x2f')][_0x8c6f('0x33')]));_0xb2a21['attributes']=_0xb2a21['attributes'][_0x8c6f('0x34')]?_0xb2a21[_0x8c6f('0x32')]:_0x237c9f['model'];if(_0x5edf48['query'][_0x8c6f('0x3e')]){_0xb2a21['include']=[{'all':!![]}];}_0xb2a21=_['merge']({},_0xb2a21,_0x5edf48['options']);return db[_0x8c6f('0x2b')][_0x8c6f('0x45')](_0xb2a21)['then'](handleEntityNotFound(_0x1d3ce9,null))['then'](respondWithResult(_0x1d3ce9,null))[_0x8c6f('0x42')](handleError(_0x1d3ce9,null));};exports[_0x8c6f('0x46')]=function(_0x5b8531,_0x39a943){return db[_0x8c6f('0x2b')][_0x8c6f('0x46')](_0x5b8531['body'],{})['then'](function(_0x21c090){var _0x3b5a75=_0x5b8531[_0x8c6f('0x47')][_0x8c6f('0x24')]({'plain':!![]});if(!_0x3b5a75)throw new Error(_0x8c6f('0x48'));if(_0x3b5a75[_0x8c6f('0x49')]==='user'){var _0x2d74cf=_0x21c090[_0x8c6f('0x24')]({'plain':!![]});var _0xebbd1a=_0x8c6f('0x4a');return db[_0x8c6f('0x4b')][_0x8c6f('0x45')]({'where':{'name':_0xebbd1a,'userProfileId':_0x3b5a75[_0x8c6f('0x4c')]},'raw':!![]})[_0x8c6f('0x23')](function(_0x1f8317){if(_0x1f8317&&_0x1f8317[_0x8c6f('0x4d')]===0x0){return db[_0x8c6f('0x4e')][_0x8c6f('0x46')]({'name':_0x2d74cf[_0x8c6f('0x27')],'resourceId':_0x2d74cf['id'],'type':_0x1f8317[_0x8c6f('0x27')],'sectionId':_0x1f8317['id']},{})['then'](function(){return _0x21c090;});}else{return _0x21c090;}})[_0x8c6f('0x42')](function(_0x3aa82f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3aa82f);throw _0x3aa82f;});}return _0x21c090;})[_0x8c6f('0x23')](respondWithResult(_0x39a943,0xc9))['catch'](handleError(_0x39a943,null));};exports['update']=function(_0x15349c,_0x48c381){if(_0x15349c[_0x8c6f('0x4f')]['id']){delete _0x15349c[_0x8c6f('0x4f')]['id'];}return db[_0x8c6f('0x2b')][_0x8c6f('0x45')]({'where':{'id':_0x15349c[_0x8c6f('0x44')]['id']}})[_0x8c6f('0x23')](handleEntityNotFound(_0x48c381,null))[_0x8c6f('0x23')](saveUpdates(_0x15349c[_0x8c6f('0x4f')],null))['then'](respondWithResult(_0x48c381,null))[_0x8c6f('0x42')](handleError(_0x48c381,null));};exports['destroy']=function(_0x54a52b,_0x1a8d97){return db[_0x8c6f('0x2b')][_0x8c6f('0x45')]({'where':{'id':_0x54a52b[_0x8c6f('0x44')]['id']}})[_0x8c6f('0x23')](handleEntityNotFound(_0x1a8d97,null))[_0x8c6f('0x23')](removeEntity(_0x1a8d97,null))['catch'](handleError(_0x1a8d97,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 7d52916..c701ff6 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 _0x7ea7=['api','moment','path','rimraf','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','name','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger'];(function(_0x1841fd,_0x5482d9){var _0x45c4f6=function(_0x3e78ea){while(--_0x3e78ea){_0x1841fd['push'](_0x1841fd['shift']());}};_0x45c4f6(++_0x5482d9);}(_0x7ea7,0x162));var _0x77ea=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x7ea7[_0x540dcb];return _0x49353c;};'use strict';var _=require(_0x77ea('0x0'));var util=require(_0x77ea('0x1'));var logger=require(_0x77ea('0x2'))(_0x77ea('0x3'));var moment=require(_0x77ea('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x77ea('0x5'));var rimraf=require(_0x77ea('0x6'));var config=require(_0x77ea('0x7'));var attributes=require(_0x77ea('0x8'));module['exports']=function(_0x429dd8,_0x73b838){return _0x429dd8[_0x77ea('0x9')](_0x77ea('0xa'),attributes,{'tableName':_0x77ea('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x77ea('0xc'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x77ea('0xc'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x77ea('0xc'),_0x77ea('0xd')]},{'unique':!![],'name':_0x77ea('0xe'),'fields':[_0x77ea('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x77ea('0xf'),'fields':[_0x77ea('0xc'),_0x77ea('0x10')]},{'unique':!![],'name':_0x77ea('0x11'),'fields':['name',_0x77ea('0x12')]},{'unique':!![],'name':_0x77ea('0x13'),'fields':['name',_0x77ea('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa807=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel'];(function(_0x5dca6a,_0x2ecaf4){var _0x3fe6c4=function(_0x3a696d){while(--_0x3a696d){_0x5dca6a['push'](_0x5dca6a['shift']());}};_0x3fe6c4(++_0x2ecaf4);}(_0xa807,0xfd));var _0x7a80=function(_0x2dcaf5,_0x56a960){_0x2dcaf5=_0x2dcaf5-0x0;var _0x4ed132=_0xa807[_0x2dcaf5];return _0x4ed132;};'use strict';var _=require(_0x7a80('0x0'));var util=require(_0x7a80('0x1'));var logger=require(_0x7a80('0x2'))(_0x7a80('0x3'));var moment=require(_0x7a80('0x4'));var BPromise=require(_0x7a80('0x5'));var rp=require(_0x7a80('0x6'));var fs=require('fs');var path=require(_0x7a80('0x7'));var rimraf=require('rimraf');var config=require(_0x7a80('0x8'));var attributes=require(_0x7a80('0x9'));module[_0x7a80('0xa')]=function(_0x2d94e2,_0x54b155){return _0x2d94e2[_0x7a80('0xb')](_0x7a80('0xc'),attributes,{'tableName':_0x7a80('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7a80('0xe'),'fields':[_0x7a80('0xf'),'ListId']},{'unique':!![],'name':'name_chat','fields':[_0x7a80('0xf'),_0x7a80('0x10')]},{'unique':!![],'name':_0x7a80('0x11'),'fields':[_0x7a80('0xf'),_0x7a80('0x12')]},{'unique':!![],'name':_0x7a80('0x13'),'fields':[_0x7a80('0xf'),_0x7a80('0x14')]},{'unique':!![],'name':_0x7a80('0x15'),'fields':[_0x7a80('0xf'),'FaxAccountId']},{'unique':!![],'name':_0x7a80('0x16'),'fields':[_0x7a80('0xf'),'OpenchannelAccountId']},{'unique':!![],'name':'name_whatsapp','fields':[_0x7a80('0xf'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a189ddf..cd80472 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(_0x1c7ed6,_0x32ea1){var _0xb9d46a=function(_0x4bc8e4){while(--_0x4bc8e4){_0x1c7ed6['push'](_0x1c7ed6['shift']());}};_0xb9d46a(++_0x32ea1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x4ece24,_0x5b0acc){var _0x459b60=function(_0x470f51){while(--_0x470f51){_0x4ece24['push'](_0x4ece24['shift']());}};_0x459b60(++_0x5b0acc);}(_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 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 3b66cde..55e9756 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 _0x93c4=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x587393,_0x4d1a14){var _0x350c99=function(_0x1fcd99){while(--_0x1fcd99){_0x587393['push'](_0x587393['shift']());}};_0x350c99(++_0x4d1a14);}(_0x93c4,0x179));var _0x493c=function(_0xdb9a19,_0x205fcd){_0xdb9a19=_0xdb9a19-0x0;var _0x10937=_0x93c4[_0xdb9a19];return _0x10937;};'use strict';var multer=require(_0x493c('0x0'));var util=require(_0x493c('0x1'));var path=require(_0x493c('0x2'));var timeout=require(_0x493c('0x3'));var express=require(_0x493c('0x4'));var router=express[_0x493c('0x5')]();var fs_extra=require(_0x493c('0x6'));var auth=require(_0x493c('0x7'));var interaction=require(_0x493c('0x8'));var config=require(_0x493c('0x9'));var controller=require(_0x493c('0xa'));router['get']('/',auth[_0x493c('0xb')](),controller[_0x493c('0xc')]);router[_0x493c('0xd')](_0x493c('0xe'),auth[_0x493c('0xb')](),controller[_0x493c('0xf')]);router[_0x493c('0x10')]('/',auth[_0x493c('0xb')](),controller[_0x493c('0x11')]);router[_0x493c('0x12')](_0x493c('0xe'),auth[_0x493c('0xb')](),controller[_0x493c('0x13')]);router['delete']('/:id',auth[_0x493c('0xb')](),controller[_0x493c('0x14')]);module[_0x493c('0x15')]=router; \ No newline at end of file +var _0x46c9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','path','connect-timeout','express','Router'];(function(_0xa3a0b5,_0x59e9a1){var _0x4257ca=function(_0x12eb43){while(--_0x12eb43){_0xa3a0b5['push'](_0xa3a0b5['shift']());}};_0x4257ca(++_0x59e9a1);}(_0x46c9,0x106));var _0x946c=function(_0x1554e6,_0x28607d){_0x1554e6=_0x1554e6-0x0;var _0x4cafbf=_0x46c9[_0x1554e6];return _0x4cafbf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x946c('0x0'));var timeout=require(_0x946c('0x1'));var express=require(_0x946c('0x2'));var router=express[_0x946c('0x3')]();var fs_extra=require(_0x946c('0x4'));var auth=require(_0x946c('0x5'));var interaction=require(_0x946c('0x6'));var config=require(_0x946c('0x7'));var controller=require(_0x946c('0x8'));router[_0x946c('0x9')]('/',auth[_0x946c('0xa')](),controller[_0x946c('0xb')]);router[_0x946c('0x9')](_0x946c('0xc'),auth[_0x946c('0xa')](),controller[_0x946c('0xd')]);router[_0x946c('0xe')]('/',auth[_0x946c('0xa')](),controller[_0x946c('0xf')]);router[_0x946c('0x10')]('/:id',auth[_0x946c('0xa')](),controller[_0x946c('0x11')]);router['delete'](_0x946c('0xc'),auth['isAuthenticated'](),controller[_0x946c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index bd3f8f8..1966e49 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 _0xca26=['SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','localstationid','ENUM','4800','7200','9600','12000','14400','2400','v17,v27,v29'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0xca26,0x1bf));var _0x6ca2=function(_0x31ebeb,_0x280752){_0x31ebeb=_0x31ebeb-0x0;var _0x300c75=_0xca26[_0x31ebeb];return _0x300c75;};'use strict';var Sequelize=require(_0x6ca2('0x0'));module[_0x6ca2('0x1')]={'name':{'type':Sequelize[_0x6ca2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6ca2('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x6ca2('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x6ca2('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x6ca2('0x2')],'unique':_0x6ca2('0x4')},'minrate':{'type':Sequelize[_0x6ca2('0x5')]('2400',_0x6ca2('0x6'),_0x6ca2('0x7'),_0x6ca2('0x8'),_0x6ca2('0x9'),_0x6ca2('0xa')),'defaultValue':_0x6ca2('0x6')},'maxrate':{'type':Sequelize['ENUM'](_0x6ca2('0xb'),_0x6ca2('0x6'),'7200','9600',_0x6ca2('0x9'),_0x6ca2('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x6ca2('0xc')},'gateway':{'type':Sequelize[_0x6ca2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6ca2('0x5')](_0x6ca2('0xd'),_0x6ca2('0xe'),_0x6ca2('0xf'),'KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x6ca2('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6ca2('0x10')],'defaultValue':function(){return _0x6ca2('0x11');}},'notificationSound':{'type':Sequelize[_0x6ca2('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6ca2('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6ca2('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6ca2('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6ca2('0x13')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6ca2('0x12')],'defaultValue':![],'comment':_0x6ca2('0x14'),'set':function(_0xa32cb1){if(!_0xa32cb1)this[_0x6ca2('0x15')](_0x6ca2('0x16'),null);this[_0x6ca2('0x15')]('mandatoryDisposition',_0xa32cb1);}}}; \ No newline at end of file +var _0xdd55=['exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','7200','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x581bdf,_0x11d27f){var _0x44e862=function(_0x2f14f9){while(--_0x2f14f9){_0x581bdf['push'](_0x581bdf['shift']());}};_0x44e862(++_0x11d27f);}(_0xdd55,0x95));var _0x5dd5=function(_0x46c25c,_0x43f24b){_0x46c25c=_0x46c25c-0x0;var _0x477fca=_0xdd55[_0x46c25c];return _0x477fca;};'use strict';var Sequelize=require(_0x5dd5('0x0'));module[_0x5dd5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5dd5('0x2')]},'ecm':{'type':Sequelize[_0x5dd5('0x3')](_0x5dd5('0x4'),'no'),'defaultValue':_0x5dd5('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x5dd5('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x5dd5('0x6')},'minrate':{'type':Sequelize[_0x5dd5('0x3')](_0x5dd5('0x7'),_0x5dd5('0x8'),'7200',_0x5dd5('0x9'),_0x5dd5('0xa'),_0x5dd5('0xb')),'defaultValue':_0x5dd5('0x8')},'maxrate':{'type':Sequelize[_0x5dd5('0x3')](_0x5dd5('0x7'),_0x5dd5('0x8'),_0x5dd5('0xc'),_0x5dd5('0x9'),_0x5dd5('0xa'),_0x5dd5('0xb')),'defaultValue':_0x5dd5('0xb')},'modem':{'type':Sequelize[_0x5dd5('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x5dd5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5dd5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5dd5('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5dd5('0x3')](_0x5dd5('0xe'),_0x5dd5('0xf'),_0x5dd5('0x10'),_0x5dd5('0x11')),'defaultValue':_0x5dd5('0xe')},'key':{'type':Sequelize[_0x5dd5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5dd5('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5dd5('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5dd5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5dd5('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5dd5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5dd5('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5dd5('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5dd5('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x5dd5('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5dd5('0x15'),'set':function(_0xbb2b48){if(!_0xbb2b48)this[_0x5dd5('0x16')](_0x5dd5('0x17'),null);this[_0x5dd5('0x16')](_0x5dd5('0x18'),_0xbb2b48);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index e99da7e..38bf3ef 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 _0x96c4=['fullname','internal','Tag','color','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','send','getApplications','context','app','type','appdata','push','Answer','CDR(type)=inbound-fax','ecm','localstationid','gateway','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','FaxMessage','List','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','message','FaxAccount,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','show','params','rawAttributes','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','options','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','omit','FaxInteraction','CmContact','Contact','User','Owner'];(function(_0x341caf,_0x568261){var _0x2fbde6=function(_0x43b64f){while(--_0x43b64f){_0x341caf['push'](_0x341caf['shift']());}};_0x2fbde6(++_0x568261);}(_0x96c4,0x111));var _0x496c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x96c4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x496c('0x0'));var jsonpatch=require(_0x496c('0x1'));var rp=require(_0x496c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x496c('0x3'));var util=require(_0x496c('0x4'));var path=require(_0x496c('0x5'));var sox=require(_0x496c('0x6'));var csv=require(_0x496c('0x7'));var ejs=require(_0x496c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x496c('0x9'));var squel=require(_0x496c('0xa'));var crypto=require(_0x496c('0xb'));var jsforce=require(_0x496c('0xc'));var deskjs=require(_0x496c('0xd'));var toCsv=require(_0x496c('0x7'));var querystring=require(_0x496c('0xe'));var Papa=require(_0x496c('0xf'));var Redis=require(_0x496c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x496c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x496c('0x12'));var logger=require(_0x496c('0x13'))(_0x496c('0x14'));var utils=require(_0x496c('0x15'));var config=require(_0x496c('0x16'));var licenseUtil=require(_0x496c('0x17'));var db=require(_0x496c('0x18'))['db'];config[_0x496c('0x19')]=_[_0x496c('0x1a')](config['redis'],{'host':_0x496c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x496c('0x19')]));require(_0x496c('0x1c'))[_0x496c('0x1d')](socket);var jayson=require(_0x496c('0x1e'));var client=jayson[_0x496c('0x1f')][_0x496c('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x101bc1,_0x21bc22,_0x1b73d5,_0x2294a2){return new BPromise(function(_0x4fe9fb,_0x412139){var _0x59376b=_0x2294a2||client;return _0x59376b[_0x496c('0x21')](_0x101bc1,_0x1b73d5)[_0x496c('0x22')](function(_0xe4e2a9){logger[_0x496c('0x23')]('FaxAccount,\x20%s,\x20%s',_0x21bc22,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x21bc22,_0x496c('0x24'),JSON[_0x496c('0x25')](_0xe4e2a9));if(_0xe4e2a9[_0x496c('0x26')]){if(_0xe4e2a9[_0x496c('0x26')]['code']===0x1f4){logger[_0x496c('0x26')]('FaxAccount,\x20%s,\x20%s',_0x21bc22,_0xe4e2a9[_0x496c('0x26')][_0x496c('0x27')]);return _0x412139(_0xe4e2a9['error'][_0x496c('0x27')]);}logger['error'](_0x496c('0x28'),_0x21bc22,_0xe4e2a9[_0x496c('0x26')]['message']);return _0x4fe9fb(_0xe4e2a9[_0x496c('0x26')][_0x496c('0x27')]);}else{logger['info'](_0x496c('0x28'),_0x21bc22,_0x496c('0x24'));_0x4fe9fb(_0xe4e2a9[_0x496c('0x29')][_0x496c('0x27')]);}})[_0x496c('0x2a')](function(_0x1423cc){logger[_0x496c('0x26')](_0x496c('0x28'),_0x21bc22,_0x1423cc);_0x412139(_0x1423cc);});});}function respondWithStatusCode(_0x2c0872,_0x1d4323){_0x1d4323=_0x1d4323||0xcc;return function(_0x361998){if(_0x361998){return _0x2c0872[_0x496c('0x2b')](_0x1d4323);}return _0x2c0872[_0x496c('0x2c')](_0x1d4323)['end']();};}function respondWithResult(_0x5deefe,_0x57cfee){_0x57cfee=_0x57cfee||0xc8;return function(_0x54e66c){if(_0x54e66c){return _0x5deefe[_0x496c('0x2c')](_0x57cfee)[_0x496c('0x2d')](_0x54e66c);}};}function respondWithFilteredResult(_0x465f83,_0x121f5f){return function(_0x2ca86e){if(_0x2ca86e){var _0xd9b69c=typeof _0x121f5f[_0x496c('0x2e')]===_0x496c('0x2f')&&typeof _0x121f5f[_0x496c('0x30')]===_0x496c('0x2f');var _0x2b1661=_0x2ca86e[_0x496c('0x31')];var _0x25b7e8=_0xd9b69c?0x0:_0x121f5f[_0x496c('0x2e')];var _0x1d4739=_0xd9b69c?_0x2ca86e[_0x496c('0x31')]:_0x121f5f['offset']+_0x121f5f[_0x496c('0x30')];var _0x506627;if(_0x1d4739>=_0x2b1661){_0x1d4739=_0x2b1661;_0x506627=0xc8;}else{_0x506627=0xce;}_0x465f83[_0x496c('0x2c')](_0x506627);return _0x465f83[_0x496c('0x32')](_0x496c('0x33'),_0x25b7e8+'-'+_0x1d4739+'/'+_0x2b1661)[_0x496c('0x2d')](_0x2ca86e);}return null;};}function patchUpdates(_0xbd420){return function(_0x57b13e){try{jsonpatch[_0x496c('0x34')](_0x57b13e,_0xbd420,!![]);}catch(_0xf4ca45){return BPromise[_0x496c('0x35')](_0xf4ca45);}return _0x57b13e[_0x496c('0x36')]();};}function saveUpdates(_0x4ca89e,_0x22bc7d){return function(_0x3ff272){if(_0x3ff272){return _0x3ff272[_0x496c('0x37')](_0x4ca89e)[_0x496c('0x22')](function(_0x36693f){return _0x36693f;});}return null;};}function removeEntity(_0x5048a6,_0x2203fe){return function(_0x3d9cfc){if(_0x3d9cfc){return _0x3d9cfc[_0x496c('0x38')]()['then'](function(){var _0x27047e=_0x3d9cfc[_0x496c('0x39')]({'plain':!![]});var _0x3a6a32=_0x496c('0x3a');return db[_0x496c('0x3b')][_0x496c('0x38')]({'where':{'type':_0x3a6a32,'resourceId':_0x27047e['id']}})[_0x496c('0x22')](function(){return _0x3d9cfc;});})[_0x496c('0x22')](function(){_0x5048a6[_0x496c('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2866d8,_0x5c5c70){return function(_0x5a0d6c){if(!_0x5a0d6c){_0x2866d8[_0x496c('0x2b')](0x194);}return _0x5a0d6c;};}function handleError(_0xf223a2,_0x4b11fe){_0x4b11fe=_0x4b11fe||0x1f4;return function(_0x47d3ae){logger[_0x496c('0x26')](_0x47d3ae[_0x496c('0x3c')]);if(_0x47d3ae[_0x496c('0x3d')]){delete _0x47d3ae[_0x496c('0x3d')];}_0xf223a2[_0x496c('0x2c')](_0x4b11fe)['send'](_0x47d3ae);};}exports[_0x496c('0x3e')]=function(_0x1294d0,_0x1f7bb9){var _0x203f07={'include':[{'model':db[_0x496c('0x3f')],'as':_0x496c('0x40')}]},_0x4dcb8d={},_0x5a8632={'count':0x0,'rows':[]};var _0x164831=_[_0x496c('0x41')](db[_0x496c('0x42')]['rawAttributes'],function(_0xe051c8){return{'name':_0xe051c8[_0x496c('0x43')],'type':_0xe051c8['type']['key']};});_0x4dcb8d[_0x496c('0x44')]=_[_0x496c('0x41')](_0x164831,_0x496c('0x3d'));_0x4dcb8d[_0x496c('0x45')]=_[_0x496c('0x46')](_0x1294d0[_0x496c('0x45')]);_0x4dcb8d[_0x496c('0x47')]=_[_0x496c('0x48')](_0x4dcb8d['model'],_0x4dcb8d['query']);_0x203f07['attributes']=_[_0x496c('0x48')](_0x4dcb8d[_0x496c('0x44')],qs[_0x496c('0x49')](_0x1294d0['query'][_0x496c('0x49')]));_0x203f07[_0x496c('0x4a')]=_0x203f07[_0x496c('0x4a')][_0x496c('0x4b')]?_0x203f07[_0x496c('0x4a')]:_0x4dcb8d[_0x496c('0x44')];if(!_0x1294d0['query']['hasOwnProperty'](_0x496c('0x4c'))){_0x203f07[_0x496c('0x30')]=qs[_0x496c('0x30')](_0x1294d0[_0x496c('0x45')][_0x496c('0x30')]);_0x203f07['offset']=qs[_0x496c('0x2e')](_0x1294d0[_0x496c('0x45')][_0x496c('0x2e')]);}_0x203f07[_0x496c('0x4d')]=qs[_0x496c('0x4e')](_0x1294d0[_0x496c('0x45')]['sort']);_0x203f07[_0x496c('0x4f')]=qs[_0x496c('0x47')](_[_0x496c('0x50')](_0x1294d0[_0x496c('0x45')],_0x4dcb8d[_0x496c('0x47')]),_0x164831);if(_0x1294d0['query'][_0x496c('0x51')]){_0x203f07[_0x496c('0x4f')]=_['merge'](_0x203f07[_0x496c('0x4f')],{'$or':_[_0x496c('0x41')](_0x164831,function(_0x5cf884){if(_0x5cf884['type']!==_0x496c('0x52')){var _0x1528de={};_0x1528de[_0x5cf884['name']]={'$like':'%'+_0x1294d0[_0x496c('0x45')][_0x496c('0x51')]+'%'};return _0x1528de;}})});}_0x203f07=_[_0x496c('0x53')]({},_0x203f07,_0x1294d0['options']);var _0x508e42={'where':_0x203f07[_0x496c('0x4f')]};return db[_0x496c('0x42')]['count'](_0x508e42)[_0x496c('0x22')](function(_0x339d9d){_0x5a8632[_0x496c('0x31')]=_0x339d9d;if(_0x1294d0[_0x496c('0x45')][_0x496c('0x54')]){_0x203f07[_0x496c('0x55')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x203f07);})[_0x496c('0x22')](function(_0x3fdca7){_0x5a8632[_0x496c('0x56')]=_0x3fdca7;return _0x5a8632;})[_0x496c('0x22')](respondWithFilteredResult(_0x1f7bb9,_0x203f07))[_0x496c('0x2a')](handleError(_0x1f7bb9,null));};exports[_0x496c('0x57')]=function(_0x394715,_0x279da8){var _0x2aecbe={'raw':![],'where':{'id':_0x394715[_0x496c('0x58')]['id']},'include':[{'model':db[_0x496c('0x3f')],'as':_0x496c('0x40')}]},_0x187215={};_0x187215[_0x496c('0x44')]=_[_0x496c('0x46')](db[_0x496c('0x42')][_0x496c('0x59')]);_0x187215[_0x496c('0x45')]=_[_0x496c('0x46')](_0x394715[_0x496c('0x45')]);_0x187215[_0x496c('0x47')]=_[_0x496c('0x48')](_0x187215['model'],_0x187215[_0x496c('0x45')]);_0x2aecbe[_0x496c('0x4a')]=_[_0x496c('0x48')](_0x187215[_0x496c('0x44')],qs['fields'](_0x394715[_0x496c('0x45')][_0x496c('0x49')]));_0x2aecbe[_0x496c('0x4a')]=_0x2aecbe[_0x496c('0x4a')][_0x496c('0x4b')]?_0x2aecbe[_0x496c('0x4a')]:_0x187215[_0x496c('0x44')];if(_0x394715[_0x496c('0x45')][_0x496c('0x54')]){_0x2aecbe[_0x496c('0x55')]=[{'all':!![]}];}_0x2aecbe=_[_0x496c('0x53')]({},_0x2aecbe,_0x394715['options']);return db[_0x496c('0x42')][_0x496c('0x5a')](_0x2aecbe)[_0x496c('0x22')](handleEntityNotFound(_0x279da8,null))['then'](respondWithResult(_0x279da8,null))[_0x496c('0x2a')](handleError(_0x279da8,null));};exports['create']=function(_0x389bdf,_0x3df984){return db['FaxAccount']['create'](_0x389bdf[_0x496c('0x5b')],{})[_0x496c('0x22')](function(_0x3393c4){var _0x515c15=_0x389bdf['user']['get']({'plain':!![]});if(!_0x515c15)throw new Error(_0x496c('0x5c'));if(_0x515c15[_0x496c('0x5d')]===_0x496c('0x5e')){var _0x30e5f9=_0x3393c4[_0x496c('0x39')]({'plain':!![]});var _0x5b2b10=_0x496c('0x3a');return db[_0x496c('0x5f')][_0x496c('0x5a')]({'where':{'name':_0x5b2b10,'userProfileId':_0x515c15[_0x496c('0x60')]},'raw':!![]})[_0x496c('0x22')](function(_0x39e29c){if(_0x39e29c&&_0x39e29c[_0x496c('0x61')]===0x0){return db[_0x496c('0x3b')]['create']({'name':_0x30e5f9[_0x496c('0x3d')],'resourceId':_0x30e5f9['id'],'type':_0x39e29c[_0x496c('0x3d')],'sectionId':_0x39e29c['id']},{})[_0x496c('0x22')](function(){return _0x3393c4;});}else{return _0x3393c4;}})[_0x496c('0x2a')](function(_0xfae4b5){logger[_0x496c('0x26')](_0x496c('0x62'),_0xfae4b5);throw _0xfae4b5;});}return _0x3393c4;})[_0x496c('0x22')](respondWithResult(_0x3df984,0xc9))[_0x496c('0x2a')](handleError(_0x3df984,null));};exports[_0x496c('0x37')]=function(_0x40825c,_0x1161cf){if(_0x40825c[_0x496c('0x5b')]['id']){delete _0x40825c[_0x496c('0x5b')]['id'];}return db[_0x496c('0x42')][_0x496c('0x5a')]({'where':{'id':_0x40825c[_0x496c('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x496c('0x40')}]})[_0x496c('0x22')](handleEntityNotFound(_0x1161cf,null))[_0x496c('0x22')](saveUpdates(_0x40825c['body'],null))[_0x496c('0x22')](respondWithResult(_0x1161cf,null))[_0x496c('0x2a')](handleError(_0x1161cf,null));};exports['destroy']=function(_0x5b50a4,_0x1e034d){return db['FaxAccount']['find']({'where':{'id':_0x5b50a4[_0x496c('0x58')]['id']}})[_0x496c('0x22')](handleEntityNotFound(_0x1e034d,null))[_0x496c('0x22')](removeEntity(_0x1e034d,null))[_0x496c('0x2a')](handleError(_0x1e034d,null));};exports['describe']=function(_0x23bd16,_0x991f6c){return db[_0x496c('0x42')][_0x496c('0x63')]()[_0x496c('0x22')](respondWithResult(_0x991f6c,null))[_0x496c('0x2a')](handleError(_0x991f6c,null));};exports[_0x496c('0x64')]=function(_0x565dcd,_0xf62159,_0x5367fb){if(_0x565dcd[_0x496c('0x5b')]['id']){delete _0x565dcd[_0x496c('0x5b')]['id'];}return db['FaxAccount'][_0x496c('0x5a')]({'where':{'id':_0x565dcd[_0x496c('0x58')]['id']}})['then'](handleEntityNotFound(_0xf62159,null))[_0x496c('0x22')](function(_0x4e3274){if(_0x4e3274){_0x565dcd[_0x496c('0x5b')][_0x496c('0x65')]=_0x4e3274['id'];return db[_0x496c('0x66')][_0x496c('0x67')](_0x565dcd['body']);}})['then'](respondWithResult(_0xf62159,null))['catch'](handleError(_0xf62159,null));};exports[_0x496c('0x68')]=function(_0x309974,_0x3be932,_0x128fc4){var _0x470df0={'raw':![],'where':{}};var _0xa0f171={};var _0x5fa309={'count':0x0,'rows':[]};return db[_0x496c('0x42')][_0x496c('0x69')]({'where':{'id':_0x309974[_0x496c('0x58')]['id']}})['then'](handleEntityNotFound(_0x3be932,null))[_0x496c('0x22')](function(_0xa891e8){if(_0xa891e8){_0xa0f171['model']=_[_0x496c('0x46')](db[_0x496c('0x66')]['rawAttributes']);_0xa0f171[_0x496c('0x45')]=_[_0x496c('0x46')](_0x309974['query']);_0xa0f171[_0x496c('0x47')]=_[_0x496c('0x48')](_0xa0f171[_0x496c('0x44')],_0xa0f171[_0x496c('0x45')]);_0x470df0[_0x496c('0x4a')]=_[_0x496c('0x48')](_0xa0f171[_0x496c('0x44')],qs[_0x496c('0x49')](_0x309974[_0x496c('0x45')][_0x496c('0x49')]));_0x470df0[_0x496c('0x4a')]=_0x470df0[_0x496c('0x4a')][_0x496c('0x4b')]?_0x470df0[_0x496c('0x4a')]:_0xa0f171[_0x496c('0x44')];if(!_0x309974[_0x496c('0x45')][_0x496c('0x6a')](_0x496c('0x4c'))){_0x470df0[_0x496c('0x30')]=qs['limit'](_0x309974[_0x496c('0x45')][_0x496c('0x30')]);_0x470df0['offset']=qs[_0x496c('0x2e')](_0x309974['query'][_0x496c('0x2e')]);}_0x470df0[_0x496c('0x4d')]=qs[_0x496c('0x4e')](_0x309974[_0x496c('0x45')]['sort']);_0x470df0[_0x496c('0x4f')]=qs[_0x496c('0x47')](_['pick'](_0x309974[_0x496c('0x45')],_0xa0f171['filters']));_0x470df0[_0x496c('0x4f')][_0x496c('0x65')]=_0xa891e8['id'];if(_0x309974[_0x496c('0x45')]['filter']){_0x470df0[_0x496c('0x4f')]=_[_0x496c('0x53')](_0x470df0[_0x496c('0x4f')],{'$or':_[_0x496c('0x41')](_0x470df0[_0x496c('0x4a')],function(_0x2a8ed2){var _0x492e3d={};_0x492e3d[_0x2a8ed2]={'$like':'%'+_0x309974[_0x496c('0x45')]['filter']+'%'};return _0x492e3d;})});}_0x470df0=_[_0x496c('0x53')]({},_0x470df0,_0x309974[_0x496c('0x6b')]);return db[_0x496c('0x66')][_0x496c('0x31')]({'where':_0x470df0['where']})[_0x496c('0x22')](function(_0x5e9ea3){_0x5fa309['count']=_0x5e9ea3;if(_0x309974['query'][_0x496c('0x54')]){_0x470df0['include']=[{'all':!![]}];}return db[_0x496c('0x66')][_0x496c('0x6c')](_0x470df0);})[_0x496c('0x22')](function(_0x6d1075){_0x5fa309[_0x496c('0x56')]=_0x6d1075;return _0x5fa309;});}})[_0x496c('0x22')](respondWithFilteredResult(_0x3be932,_0x470df0))[_0x496c('0x2a')](handleError(_0x3be932,null));};exports['removeDispositions']=function(_0x2dedbf,_0x37e6b0,_0xf2324b){return db[_0x496c('0x42')]['find']({'where':{'id':_0x2dedbf[_0x496c('0x58')]['id']}})[_0x496c('0x22')](handleEntityNotFound(_0x37e6b0,null))[_0x496c('0x22')](function(_0x1b166c){if(_0x1b166c){return _0x1b166c[_0x496c('0x6d')](_0x2dedbf[_0x496c('0x45')][_0x496c('0x6e')]);}})['then'](respondWithStatusCode(_0x37e6b0,null))[_0x496c('0x2a')](handleError(_0x37e6b0,null));};exports[_0x496c('0x6f')]=function(_0x261bbd,_0x2da4ce,_0x23a89f){if(_0x261bbd['body']['id']){delete _0x261bbd[_0x496c('0x5b')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x261bbd['params']['id']}})[_0x496c('0x22')](handleEntityNotFound(_0x2da4ce,null))[_0x496c('0x22')](function(_0x5c83f8){if(_0x5c83f8){_0x261bbd[_0x496c('0x5b')]['FaxAccountId']=_0x5c83f8['id'];return db[_0x496c('0x70')][_0x496c('0x67')](_0x261bbd[_0x496c('0x5b')]);}})[_0x496c('0x22')](respondWithResult(_0x2da4ce,null))[_0x496c('0x2a')](handleError(_0x2da4ce,null));};exports['getAnswers']=function(_0x1350c2,_0x4834a4,_0x71d9c9){var _0xbb041d={'raw':![],'where':{}};var _0x4f419a={};var _0x5ab00f={'count':0x0,'rows':[]};return db[_0x496c('0x42')][_0x496c('0x69')]({'where':{'id':_0x1350c2['params']['id']}})[_0x496c('0x22')](handleEntityNotFound(_0x4834a4,null))[_0x496c('0x22')](function(_0xbb278){if(_0xbb278){_0x4f419a[_0x496c('0x44')]=_['keys'](db['CannedAnswer'][_0x496c('0x59')]);_0x4f419a[_0x496c('0x45')]=_['keys'](_0x1350c2['query']);_0x4f419a[_0x496c('0x47')]=_['intersection'](_0x4f419a[_0x496c('0x44')],_0x4f419a[_0x496c('0x45')]);_0xbb041d[_0x496c('0x4a')]=_[_0x496c('0x48')](_0x4f419a[_0x496c('0x44')],qs[_0x496c('0x49')](_0x1350c2[_0x496c('0x45')]['fields']));_0xbb041d[_0x496c('0x4a')]=_0xbb041d[_0x496c('0x4a')][_0x496c('0x4b')]?_0xbb041d[_0x496c('0x4a')]:_0x4f419a['model'];if(!_0x1350c2['query']['hasOwnProperty'](_0x496c('0x4c'))){_0xbb041d[_0x496c('0x30')]=qs['limit'](_0x1350c2[_0x496c('0x45')][_0x496c('0x30')]);_0xbb041d[_0x496c('0x2e')]=qs[_0x496c('0x2e')](_0x1350c2[_0x496c('0x45')][_0x496c('0x2e')]);}_0xbb041d[_0x496c('0x4d')]=qs[_0x496c('0x4e')](_0x1350c2[_0x496c('0x45')][_0x496c('0x4e')]);_0xbb041d[_0x496c('0x4f')]=qs['filters'](_[_0x496c('0x50')](_0x1350c2[_0x496c('0x45')],_0x4f419a[_0x496c('0x47')]));_0xbb041d[_0x496c('0x4f')][_0x496c('0x65')]=_0xbb278['id'];if(_0x1350c2['query']['filter']){_0xbb041d[_0x496c('0x4f')]=_[_0x496c('0x53')](_0xbb041d[_0x496c('0x4f')],{'$or':_[_0x496c('0x41')](_0xbb041d[_0x496c('0x4a')],function(_0x1ddcb1){var _0x33c3fa={};_0x33c3fa[_0x1ddcb1]={'$like':'%'+_0x1350c2['query'][_0x496c('0x51')]+'%'};return _0x33c3fa;})});}_0xbb041d=_['merge']({},_0xbb041d,_0x1350c2[_0x496c('0x6b')]);return db[_0x496c('0x70')][_0x496c('0x31')]({'where':_0xbb041d[_0x496c('0x4f')]})['then'](function(_0x5c4a01){_0x5ab00f[_0x496c('0x31')]=_0x5c4a01;if(_0x1350c2[_0x496c('0x45')][_0x496c('0x54')]){_0xbb041d[_0x496c('0x55')]=[{'all':!![]}];}return db[_0x496c('0x70')][_0x496c('0x6c')](_0xbb041d);})[_0x496c('0x22')](function(_0x2a1b0e){_0x5ab00f[_0x496c('0x56')]=_0x2a1b0e;return _0x5ab00f;});}})[_0x496c('0x22')](respondWithFilteredResult(_0x4834a4,_0xbb041d))[_0x496c('0x2a')](handleError(_0x4834a4,null));};exports[_0x496c('0x71')]=function(_0x3a4261,_0x35bad2,_0x3a0837){return db['FaxAccount'][_0x496c('0x5a')]({'where':{'id':_0x3a4261[_0x496c('0x58')]['id']}})[_0x496c('0x22')](handleEntityNotFound(_0x35bad2,null))['then'](function(_0x270699){if(_0x270699){return _0x270699['removeAnswers'](_0x3a4261[_0x496c('0x45')][_0x496c('0x6e')]);}})[_0x496c('0x22')](respondWithStatusCode(_0x35bad2,null))[_0x496c('0x2a')](handleError(_0x35bad2,null));};exports['addInteraction']=function(_0x42b22f,_0x46e02b,_0x4f140e){return db['FaxInteraction'][_0x496c('0x5a')]({'where':{'id':_0x42b22f[_0x496c('0x58')]['id']}})[_0x496c('0x22')](handleEntityNotFound(_0x46e02b,null))[_0x496c('0x22')](function(_0x4d9dff){if(_0x4d9dff){return _0x4d9dff[_0x496c('0x72')](_0x42b22f['body'][_0x496c('0x6e')],_[_0x496c('0x73')](_0x42b22f[_0x496c('0x5b')],[_0x496c('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x46e02b,null))[_0x496c('0x2a')](handleError(_0x46e02b,null));};exports['getInteractions']=function(_0x15676b,_0x5556b5,_0x349507){var _0x5465f1={'raw':![],'where':{}};var _0x2caa5b={};var _0x22e0c5={'count':0x0,'rows':[]};return db[_0x496c('0x42')][_0x496c('0x69')]({'where':{'id':_0x15676b[_0x496c('0x58')]['id']}})[_0x496c('0x22')](handleEntityNotFound(_0x5556b5,null))[_0x496c('0x22')](function(_0x487e5f){if(_0x487e5f){_0x2caa5b[_0x496c('0x44')]=_[_0x496c('0x46')](db[_0x496c('0x74')][_0x496c('0x59')]);_0x2caa5b['query']=_[_0x496c('0x46')](_0x15676b['query']);_0x2caa5b['filters']=_[_0x496c('0x48')](_0x2caa5b['model'],_0x2caa5b['query']);_0x5465f1[_0x496c('0x4a')]=_[_0x496c('0x48')](_0x2caa5b[_0x496c('0x44')],qs['fields'](_0x15676b[_0x496c('0x45')][_0x496c('0x49')]));_0x5465f1[_0x496c('0x4a')]=_0x5465f1['attributes']['length']?_0x5465f1[_0x496c('0x4a')]:_0x2caa5b['model'];if(!_0x15676b[_0x496c('0x45')]['hasOwnProperty']('nolimit')){_0x5465f1[_0x496c('0x30')]=qs[_0x496c('0x30')](_0x15676b[_0x496c('0x45')][_0x496c('0x30')]);_0x5465f1[_0x496c('0x2e')]=qs[_0x496c('0x2e')](_0x15676b['query'][_0x496c('0x2e')]);}_0x5465f1['order']=qs[_0x496c('0x4e')](_0x15676b[_0x496c('0x45')][_0x496c('0x4e')]);_0x5465f1['where']=qs['filters'](_[_0x496c('0x50')](_0x15676b['query'],_0x2caa5b['filters']));_0x5465f1[_0x496c('0x4f')]['FaxAccountId']=_0x487e5f['id'];if(_0x15676b['query'][_0x496c('0x51')]){_0x5465f1[_0x496c('0x4f')]=_[_0x496c('0x53')](_0x5465f1[_0x496c('0x4f')],{'$or':_[_0x496c('0x41')](_0x5465f1['attributes'],function(_0x2ba0e1){var _0x21cf81={};_0x21cf81[_0x2ba0e1]={'$like':'%'+_0x15676b[_0x496c('0x45')][_0x496c('0x51')]+'%'};return _0x21cf81;})});}_0x5465f1=_[_0x496c('0x53')]({},_0x5465f1,_0x15676b[_0x496c('0x6b')]);return db[_0x496c('0x74')][_0x496c('0x31')]({'where':_0x5465f1[_0x496c('0x4f')]})['then'](function(_0x501f52){_0x22e0c5[_0x496c('0x31')]=_0x501f52;if(_0x15676b[_0x496c('0x45')][_0x496c('0x54')]){_0x5465f1[_0x496c('0x55')]=[{'model':db[_0x496c('0x75')],'as':_0x496c('0x76'),'required':![]},{'model':db[_0x496c('0x77')],'as':_0x496c('0x78'),'attributes':[_0x496c('0x3d'),_0x496c('0x79'),_0x496c('0x7a')],'required':![]},{'model':db[_0x496c('0x7b')],'as':'Tags','attributes':['id',_0x496c('0x3d'),_0x496c('0x7c')],'where':_0x15676b[_0x496c('0x45')]['tag']?{'id':_0x15676b['query']['tag']}:undefined,'required':_0x15676b[_0x496c('0x45')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0x496c('0x6c')](_0x5465f1);})[_0x496c('0x22')](function(_0x28f0ef){_0x22e0c5[_0x496c('0x56')]=_0x28f0ef;return _0x22e0c5;});}})[_0x496c('0x22')](respondWithFilteredResult(_0x5556b5,_0x5465f1))['catch'](handleError(_0x5556b5,null));};exports[_0x496c('0x7d')]=function(_0x29eef7,_0x2426a7){var _0x504d8c=_0x29eef7[_0x496c('0x58')]['id'];var _0x3a3725=_0x29eef7['body'];var _0x817287=0xc8;var _0x1736dd=null;return db[_0x496c('0x7e')][_0x496c('0x7f')]({'isolationLevel':db[_0x496c('0x7e')][_0x496c('0x80')][_0x496c('0x81')][_0x496c('0x82')]},function(_0x16407c){return db['FaxAccount'][_0x496c('0x69')]({'where':{'id':_0x504d8c},'transaction':_0x16407c})[_0x496c('0x22')](function(_0x11a109){if(_0x11a109){return db[_0x496c('0x83')][_0x496c('0x38')]({'where':{'FaxAccountId':_0x504d8c},'transaction':_0x16407c})[_0x496c('0x22')](function(){var _0x56e591=_[_0x496c('0x41')](_0x3a3725,function(_0x155923){_0x155923[_0x496c('0x65')]=_0x504d8c;return _0x155923;});return db[_0x496c('0x83')][_0x496c('0x84')](_0x56e591,{'transaction':_0x16407c});});}else{_0x817287=0x194;_0x1736dd=[];}});})[_0x496c('0x22')](function(){if(_0x817287!==0x194){return db[_0x496c('0x83')][_0x496c('0x85')]({'where':{'FaxAccountId':_0x504d8c},'order':_0x496c('0x86')})[_0x496c('0x22')](function(_0x288f89){_0x1736dd=_0x288f89;});}})[_0x496c('0x2a')](function(_0x3bd898){_0x817287=0x1f4;logger['error'](_0x3bd898[_0x496c('0x3c')]);if(_0x3bd898['name']){delete _0x3bd898[_0x496c('0x3d')];}_0x1736dd=_0x3bd898;})['finally'](function(){if(_0x1736dd===null){_0x2426a7[_0x496c('0x2b')](_0x817287);}else{if(_0x817287===0x1f4){_0x2426a7['status'](_0x817287)[_0x496c('0x87')](_0x1736dd);}else{_0x2426a7[_0x496c('0x2c')](_0x817287)['json'](_0x1736dd);}}});};exports[_0x496c('0x88')]=function(_0x375bec,_0x302b1f,_0xb8987c){var _0x246925={};var _0x3e101a={};var _0x41c7d2;var _0x403636;return db[_0x496c('0x42')][_0x496c('0x69')]({'where':{'id':_0x375bec[_0x496c('0x58')]['id']}})['then'](handleEntityNotFound(_0x302b1f,null))[_0x496c('0x22')](function(_0x54751c){if(_0x54751c){_0x41c7d2=_0x54751c;_0x3e101a[_0x496c('0x44')]=_[_0x496c('0x46')](db[_0x496c('0x83')]['rawAttributes']);_0x3e101a[_0x496c('0x45')]=_[_0x496c('0x46')](_0x375bec[_0x496c('0x45')]);_0x3e101a[_0x496c('0x47')]=_[_0x496c('0x48')](_0x3e101a[_0x496c('0x44')],_0x3e101a['query']);_0x246925['attributes']=_[_0x496c('0x48')](_0x3e101a[_0x496c('0x44')],qs[_0x496c('0x49')](_0x375bec[_0x496c('0x45')][_0x496c('0x49')]));_0x246925['attributes']=_0x246925['attributes'][_0x496c('0x4b')]?_0x246925[_0x496c('0x4a')]:_0x3e101a[_0x496c('0x44')];_0x246925[_0x496c('0x4d')]=qs['sort'](_0x375bec[_0x496c('0x45')][_0x496c('0x4e')]);_0x246925[_0x496c('0x4f')]=qs[_0x496c('0x47')](_[_0x496c('0x50')](_0x375bec['query'],_0x3e101a[_0x496c('0x47')]));if(_0x375bec[_0x496c('0x45')][_0x496c('0x51')]){_0x246925['where']=_[_0x496c('0x53')](_0x246925['where'],{'$or':_[_0x496c('0x41')](_0x246925[_0x496c('0x4a')],function(_0x340049){var _0x32bf97={};_0x32bf97[_0x340049]={'$like':'%'+_0x375bec[_0x496c('0x45')][_0x496c('0x51')]+'%'};return _0x32bf97;})});}_0x246925=_[_0x496c('0x53')]({},_0x246925,_0x375bec[_0x496c('0x6b')]);return _0x41c7d2['getApplications'](_0x246925);}})[_0x496c('0x22')](function(_0x413a23){if(_0x413a23){_0x403636=_0x413a23['length'];if(!_0x375bec[_0x496c('0x45')][_0x496c('0x6a')](_0x496c('0x4c'))){_0x246925['limit']=qs['limit'](_0x375bec[_0x496c('0x45')][_0x496c('0x30')]);_0x246925[_0x496c('0x2e')]=qs[_0x496c('0x2e')](_0x375bec[_0x496c('0x45')][_0x496c('0x2e')]);}return _0x41c7d2[_0x496c('0x88')](_0x246925);}})[_0x496c('0x22')](function(_0x13eca6){if(_0x13eca6){return _0x13eca6?{'count':_0x403636,'rows':_0x13eca6}:null;}})[_0x496c('0x22')](respondWithResult(_0x302b1f,null))[_0x496c('0x2a')](handleError(_0x302b1f,null));};function Extension(_0x4da6c0,_0x595862,_0x34b80c,_0x50fa50){this[_0x496c('0x89')]='from-voip-provider';this['exten']=_0x4da6c0['localstationid'];this[_0x496c('0x8a')]=_0x50fa50;this[_0x496c('0x8b')]='system';this['description']='Fax\x20Extension';this[_0x496c('0x65')]=_0x4da6c0['id'];this[_0x496c('0x86')]=_0x595862;this[_0x496c('0x8c')]=_0x34b80c;}function createExtensionsReciveFax(_0x3e9a50){var _0x122d4f=0x1;var _0x491240=[];_0x491240[_0x496c('0x8d')](new Extension(_0x3e9a50,_0x122d4f,'',_0x496c('0x8e')));_0x122d4f+=0x1;_0x491240['push'](new Extension(_0x3e9a50,_0x122d4f,_0x496c('0x8f'),'Set'));_0x122d4f+=0x1;for(var _0x3604be in _0x3e9a50){if(_0x3e9a50[_0x496c('0x6a')](_0x3604be)&&(_0x3604be===_0x496c('0x90')||_0x3604be===_0x496c('0x91')||_0x3604be===_0x496c('0x92')||_0x3604be==='faxdetect'||_0x3604be===_0x496c('0x93')||_0x3604be===_0x496c('0x94')||_0x3604be===_0x496c('0x95')||_0x3604be==='modem'||_0x3604be===_0x496c('0x96'))){_0x491240[_0x496c('0x8d')](new Extension(_0x3e9a50,_0x122d4f,_0x496c('0x97')+_0x3604be+')='+_0x3e9a50[_0x3604be],_0x496c('0x98')));_0x122d4f+=0x1;}}_0x491240[_0x496c('0x8d')](new Extension(_0x3e9a50,_0x122d4f,'6',_0x496c('0x99')));_0x122d4f+=0x1;_0x491240[_0x496c('0x8d')](new Extension(_0x3e9a50,_0x122d4f,_0x496c('0x9a'),'ReceiveFax'));_0x122d4f=0x0;return _0x491240;}exports[_0x496c('0x9b')]=function(_0x45516e,_0x59cbdb,_0xd3a319){var _0x5c3145;return db['sequelize']['transaction'](function(_0x39bc1d){return db[_0x496c('0x42')][_0x496c('0x67')](_0x45516e[_0x496c('0x5b')],{'transaction':_0x39bc1d})[_0x496c('0x22')](function(_0x2f1a8e){_0x5c3145=_0x2f1a8e['get']({'plain':!![]});return db['VoiceExtension'][_0x496c('0x84')](createExtensionsReciveFax(_0x5c3145),{'transaction':_0x39bc1d});});})['then'](function(){return _0x5c3145;})[_0x496c('0x22')](respondWithResult(_0x59cbdb,null))[_0x496c('0x2a')](handleError(_0x59cbdb,null));};exports['updateAccountApplications']=function(_0x5ea47c,_0x5ba516,_0x26d502){var _0x178c7e;return db[_0x496c('0x7e')]['transaction'](function(_0x4fd495){return db['FaxAccount'][_0x496c('0x37')](_0x5ea47c[_0x496c('0x5b')],{'where':{'id':_0x5ea47c[_0x496c('0x5b')]['id']},'transaction':_0x4fd495})[_0x496c('0x22')](function(_0x35de69){return db[_0x496c('0x9c')][_0x496c('0x38')]({'where':{'FaxAccountId':_0x5ea47c[_0x496c('0x5b')]['id']},'transaction':_0x4fd495})[_0x496c('0x22')](function(_0x82bd03){return db[_0x496c('0x9c')][_0x496c('0x84')](createExtensionsReciveFax(_['omit'](_0x5ea47c[_0x496c('0x5b')],[_0x496c('0x9d'),_0x496c('0x9e'),_0x496c('0x9f'),_0x496c('0xa0'),_0x496c('0xa1'),_0x496c('0xa2')])),{'transaction':_0x4fd495});});});})[_0x496c('0x22')](function(){return db['FaxAccount'][_0x496c('0xa3')](_0x5ea47c[_0x496c('0x5b')]['id']);})['then'](respondWithResult(_0x5ba516,null))[_0x496c('0x2a')](handleError(_0x5ba516,null));};exports[_0x496c('0xa4')]=function(_0x9ece46,_0x19a6c3,_0x4cf39e){var _0x2a2924={'raw':!![],'where':{}};var _0x2b14b8={};var _0x54b98={'count':0x0,'rows':[]};return db[_0x496c('0x42')][_0x496c('0x69')]({'where':{'id':_0x9ece46['params']['id']}})[_0x496c('0x22')](handleEntityNotFound(_0x19a6c3,null))[_0x496c('0x22')](function(_0x4a29d2){if(_0x4a29d2){_0x2b14b8[_0x496c('0x44')]=_['keys'](db['FaxMessage'][_0x496c('0x59')]);_0x2b14b8['query']=_[_0x496c('0x46')](_0x9ece46['query']);_0x2b14b8[_0x496c('0x47')]=_[_0x496c('0x48')](_0x2b14b8[_0x496c('0x44')],_0x2b14b8[_0x496c('0x45')]);_0x2a2924[_0x496c('0x4a')]=_[_0x496c('0x48')](_0x2b14b8['model'],qs[_0x496c('0x49')](_0x9ece46[_0x496c('0x45')][_0x496c('0x49')]));_0x2a2924['attributes']=_0x2a2924[_0x496c('0x4a')]['length']?_0x2a2924[_0x496c('0x4a')]:_0x2b14b8[_0x496c('0x44')];if(!_0x9ece46[_0x496c('0x45')][_0x496c('0x6a')](_0x496c('0x4c'))){_0x2a2924[_0x496c('0x30')]=qs[_0x496c('0x30')](_0x9ece46['query'][_0x496c('0x30')]);_0x2a2924['offset']=qs[_0x496c('0x2e')](_0x9ece46[_0x496c('0x45')][_0x496c('0x2e')]);}_0x2a2924['order']=qs[_0x496c('0x4e')](_0x9ece46['query']['sort']);_0x2a2924[_0x496c('0x4f')]=qs[_0x496c('0x47')](_['pick'](_0x9ece46[_0x496c('0x45')],_0x2b14b8[_0x496c('0x47')]));_0x2a2924[_0x496c('0x4f')]['FaxAccountId']=_0x4a29d2['id'];if(_0x9ece46[_0x496c('0x45')][_0x496c('0x51')]){_0x2a2924[_0x496c('0x4f')]=_[_0x496c('0x53')](_0x2a2924['where'],{'$or':_[_0x496c('0x41')](_0x2a2924['attributes'],function(_0x485cd2){var _0x1887b1={};_0x1887b1[_0x485cd2]={'$like':'%'+_0x9ece46[_0x496c('0x45')][_0x496c('0x51')]+'%'};return _0x1887b1;})});}if(_0x9ece46[_0x496c('0x45')][_0x496c('0xa5')]){var _0x732b30=_0x9ece46[_0x496c('0x45')][_0x496c('0xa5')][_0x496c('0xa6')](',');var _0x119488={};_0x119488[_0x732b30[0x0]]={'$gte':moment(_0x732b30[0x1])[_0x496c('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2a2924['where']=_['merge'](_0x2a2924[_0x496c('0x4f')],_0x119488);}_0x2a2924=_[_0x496c('0x53')]({},_0x2a2924,_0x9ece46['options']);return db[_0x496c('0xa8')][_0x496c('0x31')]({'where':_0x2a2924['where']})[_0x496c('0x22')](function(_0x2e11dc){_0x54b98[_0x496c('0x31')]=_0x2e11dc;if(_0x9ece46[_0x496c('0x45')]['includeAll']){_0x2a2924[_0x496c('0x55')]=[{'all':!![]}];}return db[_0x496c('0xa8')][_0x496c('0x6c')](_0x2a2924);})[_0x496c('0x22')](function(_0x302c62){_0x54b98[_0x496c('0x56')]=_0x302c62;return _0x54b98;});}})[_0x496c('0x22')](respondWithFilteredResult(_0x19a6c3,_0x2a2924))[_0x496c('0x2a')](handleError(_0x19a6c3,null));};exports[_0x496c('0x87')]=function(_0x26b712,_0x406611,_0x1d93f6){var _0x13f6bd,_0x15fe05={},_0x329885;if(_0x26b712[_0x496c('0x5b')]['to']){_0x329885=_0x26b712['body']['to'][0x0];}return db['FaxAccount'][_0x496c('0x5a')]({'where':{'id':_0x26b712['params']['id']},'include':[{'model':db['CmList'],'as':_0x496c('0xa9'),'include':[{'model':db[_0x496c('0x75')],'as':_0x496c('0xaa'),'where':{'fax':_0x329885},'limit':0x1,'order':[[_0x496c('0xa0'),_0x496c('0xab')]]}]}]})[_0x496c('0x22')](handleEntityNotFound(_0x406611,null))['then'](function(_0x58fa8e){_0x13f6bd=_0x58fa8e;if(_0x26b712[_0x496c('0x5b')][_0x496c('0xac')]&&_0x26b712[_0x496c('0x5b')]['attachments'][_0x496c('0x4b')]){for(var _0x582960=0x0;_0x582960<_0x26b712[_0x496c('0x5b')][_0x496c('0xac')]['length'];_0x582960+=0x1){_0x26b712[_0x496c('0x5b')]['attachments'][_0x582960]={'filename':_0x26b712[_0x496c('0x5b')][_0x496c('0xac')][_0x582960][_0x496c('0x3d')],'id':_0x26b712[_0x496c('0x5b')][_0x496c('0xac')][_0x582960]['id'],'path':path[_0x496c('0xad')](config[_0x496c('0xae')],'server/files/attachments',_0x26b712[_0x496c('0x5b')][_0x496c('0xac')][_0x582960][_0x496c('0xaf')])};}}return respondWithRpcPromise(_0x496c('0xb0'),_0x496c('0xb0'),{'FaxAccountId':_[_0x496c('0xb1')](_0x26b712['params']['id'])?undefined:_0x26b712[_0x496c('0x58')]['id'],'path':_['isNil'](_0x26b712[_0x496c('0x5b')]['attachments'][0x0][_0x496c('0x5')])?undefined:_0x26b712[_0x496c('0x5b')][_0x496c('0xac')][0x0][_0x496c('0x5')],'fax':_[_0x496c('0xb1')](_0x26b712[_0x496c('0x5b')]['to'][0x0])?undefined:_0x26b712[_0x496c('0x5b')]['to'][0x0]},client9002);})[_0x496c('0x22')](function(){if(_0x13f6bd){if(_[_0x496c('0xb1')](_0x26b712['body'][_0x496c('0xb2')])){_0x26b712[_0x496c('0x5b')][_0x496c('0xb2')]=util['format']('\x22%s\x22\x20<%s>',_0x13f6bd[_0x496c('0x3d')],_0x13f6bd[_0x496c('0xb3')]);}if(_0x13f6bd['List']){if(_0x13f6bd['List'][_0x496c('0xaa')][_0x496c('0x4b')]){return _0x13f6bd['List'][_0x496c('0xaa')][0x0];}else{return db[_0x496c('0x75')][_0x496c('0x67')](_['defaults'](_0x26b712['body'],{'firstName':_0x26b712['body']['to'][0x0],'phone':_0x26b712[_0x496c('0x5b')]['to'][0x0],'fax':_0x26b712[_0x496c('0x5b')]['to'][0x0],'ListId':_0x13f6bd[_0x496c('0xa2')]}));}}else{throw new Error(_0x496c('0xb4'));}}else{throw new Error(_0x496c('0xb5'));}})[_0x496c('0x22')](function(_0x3b890f){if(_0x3b890f){return db[_0x496c('0x74')][_0x496c('0x5a')]({'where':{'ContactId':_0x3b890f['id'],'closed':![],'FaxAccountId':_0x13f6bd['id']}})[_0x496c('0x22')](function(_0x1c38df){if(_0x1c38df){return[_0x1c38df,![]];}return db[_0x496c('0x74')][_0x496c('0x67')]({'UserId':_0x26b712[_0x496c('0x5e')]['id'],'ContactId':_0x3b890f['id'],'FaxAccountId':_0x13f6bd['id'],'fax':_0x26b712[_0x496c('0x5b')]['to'][0x0],'firstMsgDirection':_0x496c('0xb6'),'Messages':[_[_0x496c('0x53')](_0x26b712[_0x496c('0x5b')],{'read':![],'body':_0x26b712['body'][_0x496c('0xac')][0x0][_0x496c('0xb7')],'FaxAccountId':_0x13f6bd['id'],'UserId':_0x26b712[_0x496c('0x5e')]['id'],'ContactId':_0x3b890f['id'],'AttachmentId':_0x26b712[_0x496c('0x5b')][_0x496c('0xac')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x496c('0xb8')}]})[_0x496c('0x22')](function(_0x20baf9){return[_0x20baf9,!![]];});});}else{throw new Error(_0x496c('0xb9'));}})[_0x496c('0xba')](function(_0x431b76,_0x3529c7){if(_0x3529c7){return _0x431b76;}return db[_0x496c('0xa8')][_0x496c('0x67')]({'direction':_0x496c('0xb6'),'read':![],'body':_0x26b712['body'][_0x496c('0xac')][0x0][_0x496c('0xb7')],'FaxAccountId':_0x13f6bd['id'],'FaxInteractionId':_0x431b76['id'],'UserId':_0x26b712[_0x496c('0x5e')]['id'],'ContactId':_0x431b76[_0x496c('0xbb')],'AttachmentId':_0x26b712[_0x496c('0x5b')][_0x496c('0xac')][0x0]['id']})[_0x496c('0x22')](function(_0x58621a){_0x431b76[_0x496c('0xbc')]['Messages']=[];_0x431b76[_0x496c('0xbc')]['Messages'][_0x496c('0x8d')](_0x58621a[_0x496c('0xbc')]);return _0x431b76;});})[_0x496c('0x22')](function(_0x5bbb2e){respondWithRpcPromise('SendFax',_0x496c('0xbd'),{'FaxAccountId':_['isNil'](_0x26b712[_0x496c('0x58')]['id'])?undefined:_0x26b712['params']['id'],'path':_[_0x496c('0xb1')](_0x26b712[_0x496c('0x5b')][_0x496c('0xac')][0x0][_0x496c('0x5')])?undefined:_0x26b712[_0x496c('0x5b')][_0x496c('0xac')][0x0][_0x496c('0x5')],'fax':_[_0x496c('0xb1')](_0x26b712[_0x496c('0x5b')]['to'][0x0])?undefined:_0x26b712['body']['to'][0x0],'AttachmentId':_0x26b712[_0x496c('0x5b')]['attachments'][0x0]['id']},client9002)[_0x496c('0x22')](function(_0x3f8309){logger[_0x496c('0x23')](_0x496c('0xbe'),_0x3f8309);})[_0x496c('0x2a')](function(_0x285332){logger[_0x496c('0x23')]('SendFaxRpc,\x20%s',_0x285332);});return _0x5bbb2e;})[_0x496c('0x22')](respondWithResult(_0x406611,null))['catch'](handleError(_0x406611,null));};exports[_0x496c('0xbf')]=function(_0xb21a20,_0x1f55ef,_0x4859ef){return db['FaxAccount'][_0x496c('0x5a')]({'where':{'id':_0xb21a20['params']['id']}})[_0x496c('0x22')](handleEntityNotFound(_0x1f55ef,null))[_0x496c('0x22')](function(_0x9b7e9c){if(_0x9b7e9c){return _0x9b7e9c[_0x496c('0xbf')](_0xb21a20['body'][_0x496c('0x6e')],_[_0x496c('0x73')](_0xb21a20[_0x496c('0x5b')],['ids','id'])||{})['spread'](function(_0x394a72){for(var _0x28a3e1=0x0;_0x28a3e1<_0xb21a20['body'][_0x496c('0x6e')][_0x496c('0x4b')];_0x28a3e1+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0xb21a20[_0x496c('0x5b')][_0x496c('0x6e')][_0x28a3e1]),'FaxAccountId':Number(_0xb21a20[_0x496c('0x58')]['id'])});}return _0x394a72;});}})['then'](respondWithResult(_0x1f55ef,null))[_0x496c('0x2a')](handleError(_0x1f55ef,null));};exports[_0x496c('0xc0')]=function(_0x5d2d60,_0x4a5b4e,_0x1726af){return db[_0x496c('0x42')]['find']({'where':{'id':_0x5d2d60[_0x496c('0x58')]['id']}})['then'](handleEntityNotFound(_0x4a5b4e,null))[_0x496c('0x22')](function(_0x29c31d){if(_0x29c31d){return _0x29c31d[_0x496c('0xc0')](_0x5d2d60['query'][_0x496c('0x6e')])[_0x496c('0x22')](function(){if(_[_0x496c('0xc1')](_0x5d2d60['query']['ids'])){for(var _0xc3a33a=0x0;_0xc3a33a<_0x5d2d60[_0x496c('0x45')]['ids'][_0x496c('0x4b')];_0xc3a33a+=0x1){socket[_0x496c('0xc2')](_0x496c('0xc3'),{'UserId':Number(_0x5d2d60[_0x496c('0x45')][_0x496c('0x6e')][_0xc3a33a]),'FaxAccountId':Number(_0x5d2d60[_0x496c('0x58')]['id'])});}}else{socket[_0x496c('0xc2')](_0x496c('0xc3'),{'UserId':Number(_0x5d2d60[_0x496c('0x45')][_0x496c('0x6e')]),'FaxAccountId':Number(_0x5d2d60['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4a5b4e,null))[_0x496c('0x2a')](handleError(_0x4a5b4e,null));};exports[_0x496c('0xc4')]=function(_0x5068a3,_0x227fa3,_0x3aac06){var _0x557b7a={};var _0x5dbb7f={};var _0x5577b1;var _0x586c22;return db[_0x496c('0x42')]['findOne']({'where':{'id':_0x5068a3[_0x496c('0x58')]['id']}})[_0x496c('0x22')](handleEntityNotFound(_0x227fa3,null))[_0x496c('0x22')](function(_0x5cdd3d){if(_0x5cdd3d){_0x5577b1=_0x5cdd3d;_0x5dbb7f[_0x496c('0x44')]=_['keys'](db['User']['rawAttributes']);_0x5dbb7f[_0x496c('0x45')]=_[_0x496c('0x46')](_0x5068a3[_0x496c('0x45')]);_0x5dbb7f[_0x496c('0x47')]=_['intersection'](_0x5dbb7f[_0x496c('0x44')],_0x5dbb7f[_0x496c('0x45')]);_0x557b7a[_0x496c('0x4a')]=_[_0x496c('0x48')](_0x5dbb7f[_0x496c('0x44')],qs[_0x496c('0x49')](_0x5068a3[_0x496c('0x45')][_0x496c('0x49')]));_0x557b7a[_0x496c('0x4a')]=_0x557b7a[_0x496c('0x4a')][_0x496c('0x4b')]?_0x557b7a[_0x496c('0x4a')]:_0x5dbb7f[_0x496c('0x44')];_0x557b7a['order']=qs[_0x496c('0x4e')](_0x5068a3[_0x496c('0x45')][_0x496c('0x4e')]);_0x557b7a[_0x496c('0x4f')]=qs[_0x496c('0x47')](_['pick'](_0x5068a3[_0x496c('0x45')],_0x5dbb7f[_0x496c('0x47')]));if(_0x5068a3[_0x496c('0x45')]['filter']){_0x557b7a[_0x496c('0x4f')]=_['merge'](_0x557b7a[_0x496c('0x4f')],{'$or':_[_0x496c('0x41')](_0x557b7a[_0x496c('0x4a')],function(_0x8b9eb1){var _0x3d52c4={};_0x3d52c4[_0x8b9eb1]={'$like':'%'+_0x5068a3[_0x496c('0x45')][_0x496c('0x51')]+'%'};return _0x3d52c4;})});}_0x557b7a=_[_0x496c('0x53')]({},_0x557b7a,_0x5068a3[_0x496c('0x6b')]);return _0x5577b1[_0x496c('0xc4')](_0x557b7a);}})[_0x496c('0x22')](function(_0x3cadb9){if(_0x3cadb9){_0x586c22=_0x3cadb9['length'];if(!_0x5068a3[_0x496c('0x45')][_0x496c('0x6a')](_0x496c('0x4c'))){_0x557b7a[_0x496c('0x30')]=qs[_0x496c('0x30')](_0x5068a3[_0x496c('0x45')][_0x496c('0x30')]);_0x557b7a[_0x496c('0x2e')]=qs[_0x496c('0x2e')](_0x5068a3[_0x496c('0x45')][_0x496c('0x2e')]);}return _0x5577b1[_0x496c('0xc4')](_0x557b7a);}})[_0x496c('0x22')](function(_0x3adfb4){if(_0x3adfb4){return _0x3adfb4?{'count':_0x586c22,'rows':_0x3adfb4}:null;}})[_0x496c('0x22')](respondWithResult(_0x227fa3,null))['catch'](handleError(_0x227fa3,null));}; \ No newline at end of file +var _0xa60a=['basename','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','List','ListId','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','name','send','index','mandatoryDispositionPause','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','FaxAccount','include','findAll','rows','show','params','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','FaxAccounts','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','FaxAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','stack','getApplications','context','localstationid','app','type','description','Fax\x20Extension','priority','appdata','Answer','push','ecm','gateway','faxdetect','headerinfo','minrate','Set','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','attachments','join','server/files/attachments'];(function(_0x47088e,_0x461de8){var _0x5468fa=function(_0x38d0e1){while(--_0x38d0e1){_0x47088e['push'](_0x47088e['shift']());}};_0x5468fa(++_0x461de8);}(_0xa60a,0xd8));var _0xaa60=function(_0x35c35e,_0x3115ec){_0x35c35e=_0x35c35e-0x0;var _0x3fa8e3=_0xa60a[_0x35c35e];return _0x3fa8e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa60('0x0'));var zipdir=require(_0xaa60('0x1'));var jsonpatch=require(_0xaa60('0x2'));var rp=require(_0xaa60('0x3'));var moment=require(_0xaa60('0x4'));var BPromise=require(_0xaa60('0x5'));var Mustache=require(_0xaa60('0x6'));var util=require(_0xaa60('0x7'));var path=require(_0xaa60('0x8'));var sox=require(_0xaa60('0x9'));var csv=require(_0xaa60('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa60('0xb'));var _=require(_0xaa60('0xc'));var squel=require(_0xaa60('0xd'));var crypto=require(_0xaa60('0xe'));var jsforce=require(_0xaa60('0xf'));var deskjs=require(_0xaa60('0x10'));var toCsv=require(_0xaa60('0xa'));var querystring=require(_0xaa60('0x11'));var Papa=require(_0xaa60('0x12'));var Redis=require('ioredis');var authService=require(_0xaa60('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaa60('0x14'));var hardwareService=require(_0xaa60('0x15'));var logger=require(_0xaa60('0x16'))('api');var utils=require(_0xaa60('0x17'));var config=require(_0xaa60('0x18'));var licenseUtil=require(_0xaa60('0x19'));var db=require(_0xaa60('0x1a'))['db'];config[_0xaa60('0x1b')]=_[_0xaa60('0x1c')](config[_0xaa60('0x1b')],{'host':_0xaa60('0x1d'),'port':0x18eb});var socket=require(_0xaa60('0x1e'))(new Redis(config[_0xaa60('0x1b')]));require(_0xaa60('0x1f'))[_0xaa60('0x20')](socket);var jayson=require(_0xaa60('0x21'));var client=jayson[_0xaa60('0x22')][_0xaa60('0x23')]({'port':0x232c});var client9002=jayson[_0xaa60('0x22')][_0xaa60('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x526ae8,_0x1f2264,_0xbe3a3e,_0x499fa0){return new BPromise(function(_0x1f2f56,_0x15413c){var _0x376fc9=_0x499fa0||client;return _0x376fc9[_0xaa60('0x24')](_0x526ae8,_0xbe3a3e)[_0xaa60('0x25')](function(_0x3ba0ff){logger[_0xaa60('0x26')](_0xaa60('0x27'),_0x1f2264,_0xaa60('0x28'));logger[_0xaa60('0x29')](_0xaa60('0x2a'),_0x1f2264,_0xaa60('0x28'),JSON[_0xaa60('0x2b')](_0x3ba0ff));if(_0x3ba0ff['error']){if(_0x3ba0ff[_0xaa60('0x2c')]['code']===0x1f4){logger[_0xaa60('0x2c')](_0xaa60('0x27'),_0x1f2264,_0x3ba0ff['error'][_0xaa60('0x2d')]);return _0x15413c(_0x3ba0ff[_0xaa60('0x2c')][_0xaa60('0x2d')]);}logger['error'](_0xaa60('0x27'),_0x1f2264,_0x3ba0ff[_0xaa60('0x2c')][_0xaa60('0x2d')]);return _0x1f2f56(_0x3ba0ff[_0xaa60('0x2c')][_0xaa60('0x2d')]);}else{logger[_0xaa60('0x26')](_0xaa60('0x27'),_0x1f2264,_0xaa60('0x28'));_0x1f2f56(_0x3ba0ff['result'][_0xaa60('0x2d')]);}})[_0xaa60('0x2e')](function(_0x41195e){logger[_0xaa60('0x2c')](_0xaa60('0x27'),_0x1f2264,_0x41195e);_0x15413c(_0x41195e);});});}function respondWithStatusCode(_0x53ccfc,_0x100a88){_0x100a88=_0x100a88||0xcc;return function(_0x260be5){if(_0x260be5){return _0x53ccfc[_0xaa60('0x2f')](_0x100a88);}return _0x53ccfc['status'](_0x100a88)[_0xaa60('0x30')]();};}function respondWithResult(_0xdeb465,_0x373e26){_0x373e26=_0x373e26||0xc8;return function(_0x5d3a71){if(_0x5d3a71){return _0xdeb465[_0xaa60('0x31')](_0x373e26)[_0xaa60('0x32')](_0x5d3a71);}};}function respondWithFilteredResult(_0x459e6e,_0x1d6c75){return function(_0x2bc006){if(_0x2bc006){var _0x3a3be7=typeof _0x1d6c75[_0xaa60('0x33')]===_0xaa60('0x34')&&typeof _0x1d6c75[_0xaa60('0x35')]==='undefined';var _0x24f272=_0x2bc006[_0xaa60('0x36')];var _0x150974=_0x3a3be7?0x0:_0x1d6c75[_0xaa60('0x33')];var _0x18bc8d=_0x3a3be7?_0x2bc006[_0xaa60('0x36')]:_0x1d6c75[_0xaa60('0x33')]+_0x1d6c75[_0xaa60('0x35')];var _0x17a131;if(_0x18bc8d>=_0x24f272){_0x18bc8d=_0x24f272;_0x17a131=0xc8;}else{_0x17a131=0xce;}_0x459e6e[_0xaa60('0x31')](_0x17a131);return _0x459e6e[_0xaa60('0x37')](_0xaa60('0x38'),_0x150974+'-'+_0x18bc8d+'/'+_0x24f272)['json'](_0x2bc006);}return null;};}function patchUpdates(_0x4da55e){return function(_0xf2d669){try{jsonpatch[_0xaa60('0x39')](_0xf2d669,_0x4da55e,!![]);}catch(_0x2c18ad){return BPromise[_0xaa60('0x3a')](_0x2c18ad);}return _0xf2d669[_0xaa60('0x3b')]();};}function saveUpdates(_0x4cc1f9,_0x1db9a6){return function(_0x5289e0){if(_0x5289e0){return _0x5289e0[_0xaa60('0x3c')](_0x4cc1f9)[_0xaa60('0x25')](function(_0x5da7ad){return _0x5da7ad;});}return null;};}function removeEntity(_0x331dde,_0x4966ab){return function(_0x352e1c){if(_0x352e1c){return _0x352e1c[_0xaa60('0x3d')]()[_0xaa60('0x25')](function(){var _0x2ffd9e=_0x352e1c[_0xaa60('0x3e')]({'plain':!![]});var _0x575dd6='FaxAccounts';return db['UserProfileResource'][_0xaa60('0x3d')]({'where':{'type':_0x575dd6,'resourceId':_0x2ffd9e['id']}})[_0xaa60('0x25')](function(){return _0x352e1c;});})[_0xaa60('0x25')](function(){_0x331dde['status'](0xcc)[_0xaa60('0x30')]();});}};}function handleEntityNotFound(_0x558806,_0x282e93){return function(_0x28bc6b){if(!_0x28bc6b){_0x558806[_0xaa60('0x2f')](0x194);}return _0x28bc6b;};}function handleError(_0x16b740,_0x509f1f){_0x509f1f=_0x509f1f||0x1f4;return function(_0x3c8743){logger[_0xaa60('0x2c')](_0x3c8743['stack']);if(_0x3c8743[_0xaa60('0x3f')]){delete _0x3c8743['name'];}_0x16b740[_0xaa60('0x31')](_0x509f1f)[_0xaa60('0x40')](_0x3c8743);};}exports[_0xaa60('0x41')]=function(_0x3991c0,_0x1795c0){var _0x461ebf={'include':[{'model':db['Pause'],'as':_0xaa60('0x42')}]},_0x37acf1={},_0x655d56={'count':0x0,'rows':[]};var _0x51d107=_['map'](db['FaxAccount'][_0xaa60('0x43')],function(_0x42b27b){return{'name':_0x42b27b[_0xaa60('0x44')],'type':_0x42b27b['type'][_0xaa60('0x45')]};});_0x37acf1[_0xaa60('0x46')]=_[_0xaa60('0x47')](_0x51d107,_0xaa60('0x3f'));_0x37acf1[_0xaa60('0x48')]=_[_0xaa60('0x49')](_0x3991c0['query']);_0x37acf1['filters']=_[_0xaa60('0x4a')](_0x37acf1[_0xaa60('0x46')],_0x37acf1[_0xaa60('0x48')]);_0x461ebf['attributes']=_[_0xaa60('0x4a')](_0x37acf1[_0xaa60('0x46')],qs['fields'](_0x3991c0[_0xaa60('0x48')][_0xaa60('0x4b')]));_0x461ebf[_0xaa60('0x4c')]=_0x461ebf[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x461ebf[_0xaa60('0x4c')]:_0x37acf1[_0xaa60('0x46')];if(!_0x3991c0['query'][_0xaa60('0x4e')]('nolimit')){_0x461ebf[_0xaa60('0x35')]=qs[_0xaa60('0x35')](_0x3991c0['query']['limit']);_0x461ebf[_0xaa60('0x33')]=qs[_0xaa60('0x33')](_0x3991c0[_0xaa60('0x48')][_0xaa60('0x33')]);}_0x461ebf[_0xaa60('0x4f')]=qs['sort'](_0x3991c0[_0xaa60('0x48')][_0xaa60('0x50')]);_0x461ebf['where']=qs[_0xaa60('0x51')](_[_0xaa60('0x52')](_0x3991c0[_0xaa60('0x48')],_0x37acf1[_0xaa60('0x51')]),_0x51d107);if(_0x3991c0[_0xaa60('0x48')][_0xaa60('0x53')]){_0x461ebf[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x461ebf[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x51d107,function(_0x3ddb53){if(_0x3ddb53['type']!=='VIRTUAL'){var _0x129265={};_0x129265[_0x3ddb53[_0xaa60('0x3f')]]={'$like':'%'+_0x3991c0[_0xaa60('0x48')][_0xaa60('0x53')]+'%'};return _0x129265;}})});}_0x461ebf=_[_0xaa60('0x55')]({},_0x461ebf,_0x3991c0['options']);var _0x4e87cd={'where':_0x461ebf[_0xaa60('0x54')]};return db[_0xaa60('0x56')][_0xaa60('0x36')](_0x4e87cd)[_0xaa60('0x25')](function(_0x3a27fb){_0x655d56[_0xaa60('0x36')]=_0x3a27fb;if(_0x3991c0[_0xaa60('0x48')]['includeAll']){_0x461ebf[_0xaa60('0x57')]=[{'all':!![]}];}return db[_0xaa60('0x56')][_0xaa60('0x58')](_0x461ebf);})[_0xaa60('0x25')](function(_0x5c6691){_0x655d56[_0xaa60('0x59')]=_0x5c6691;return _0x655d56;})[_0xaa60('0x25')](respondWithFilteredResult(_0x1795c0,_0x461ebf))['catch'](handleError(_0x1795c0,null));};exports[_0xaa60('0x5a')]=function(_0x50f05e,_0x10d43f){var _0x50f3a7={'raw':![],'where':{'id':_0x50f05e[_0xaa60('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xaa60('0x42')}]},_0x57df01={};_0x57df01[_0xaa60('0x46')]=_[_0xaa60('0x49')](db[_0xaa60('0x56')]['rawAttributes']);_0x57df01['query']=_[_0xaa60('0x49')](_0x50f05e[_0xaa60('0x48')]);_0x57df01[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0x57df01[_0xaa60('0x46')],_0x57df01[_0xaa60('0x48')]);_0x50f3a7['attributes']=_[_0xaa60('0x4a')](_0x57df01[_0xaa60('0x46')],qs[_0xaa60('0x4b')](_0x50f05e[_0xaa60('0x48')]['fields']));_0x50f3a7[_0xaa60('0x4c')]=_0x50f3a7[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x50f3a7[_0xaa60('0x4c')]:_0x57df01[_0xaa60('0x46')];if(_0x50f05e['query'][_0xaa60('0x5c')]){_0x50f3a7[_0xaa60('0x57')]=[{'all':!![]}];}_0x50f3a7=_['merge']({},_0x50f3a7,_0x50f05e[_0xaa60('0x5d')]);return db[_0xaa60('0x56')][_0xaa60('0x5e')](_0x50f3a7)[_0xaa60('0x25')](handleEntityNotFound(_0x10d43f,null))[_0xaa60('0x25')](respondWithResult(_0x10d43f,null))[_0xaa60('0x2e')](handleError(_0x10d43f,null));};exports[_0xaa60('0x5f')]=function(_0x3238b2,_0x3af593){return db['FaxAccount']['create'](_0x3238b2[_0xaa60('0x60')],{})[_0xaa60('0x25')](function(_0x46c785){var _0x43c035=_0x3238b2['user'][_0xaa60('0x3e')]({'plain':!![]});if(!_0x43c035)throw new Error(_0xaa60('0x61'));if(_0x43c035['role']===_0xaa60('0x62')){var _0x52be13=_0x46c785['get']({'plain':!![]});var _0x2a6b2a=_0xaa60('0x63');return db[_0xaa60('0x64')]['find']({'where':{'name':_0x2a6b2a,'userProfileId':_0x43c035[_0xaa60('0x65')]},'raw':!![]})[_0xaa60('0x25')](function(_0x308936){if(_0x308936&&_0x308936['autoAssociation']===0x0){return db[_0xaa60('0x66')][_0xaa60('0x5f')]({'name':_0x52be13[_0xaa60('0x3f')],'resourceId':_0x52be13['id'],'type':_0x308936[_0xaa60('0x3f')],'sectionId':_0x308936['id']},{})[_0xaa60('0x25')](function(){return _0x46c785;});}else{return _0x46c785;}})[_0xaa60('0x2e')](function(_0x4f9aaa){logger[_0xaa60('0x2c')](_0xaa60('0x67'),_0x4f9aaa);throw _0x4f9aaa;});}return _0x46c785;})[_0xaa60('0x25')](respondWithResult(_0x3af593,0xc9))[_0xaa60('0x2e')](handleError(_0x3af593,null));};exports[_0xaa60('0x3c')]=function(_0xff77c8,_0x3e76a7){if(_0xff77c8[_0xaa60('0x60')]['id']){delete _0xff77c8[_0xaa60('0x60')]['id'];}return db['FaxAccount'][_0xaa60('0x5e')]({'where':{'id':_0xff77c8[_0xaa60('0x5b')]['id']},'include':[{'model':db[_0xaa60('0x68')],'as':_0xaa60('0x42')}]})[_0xaa60('0x25')](handleEntityNotFound(_0x3e76a7,null))[_0xaa60('0x25')](saveUpdates(_0xff77c8[_0xaa60('0x60')],null))[_0xaa60('0x25')](respondWithResult(_0x3e76a7,null))[_0xaa60('0x2e')](handleError(_0x3e76a7,null));};exports[_0xaa60('0x3d')]=function(_0x2a231b,_0x18fc8c){return db[_0xaa60('0x56')][_0xaa60('0x5e')]({'where':{'id':_0x2a231b[_0xaa60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x18fc8c,null))[_0xaa60('0x25')](removeEntity(_0x18fc8c,null))[_0xaa60('0x2e')](handleError(_0x18fc8c,null));};exports[_0xaa60('0x69')]=function(_0x32febc,_0x49b95e){return db[_0xaa60('0x56')]['describe']()[_0xaa60('0x25')](respondWithResult(_0x49b95e,null))[_0xaa60('0x2e')](handleError(_0x49b95e,null));};exports['addDisposition']=function(_0x539bca,_0x59659a,_0x204446){if(_0x539bca[_0xaa60('0x60')]['id']){delete _0x539bca['body']['id'];}return db[_0xaa60('0x56')][_0xaa60('0x5e')]({'where':{'id':_0x539bca[_0xaa60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x59659a,null))[_0xaa60('0x25')](function(_0x178326){if(_0x178326){_0x539bca[_0xaa60('0x60')][_0xaa60('0x6a')]=_0x178326['id'];return db[_0xaa60('0x6b')]['create'](_0x539bca[_0xaa60('0x60')]);}})[_0xaa60('0x25')](respondWithResult(_0x59659a,null))[_0xaa60('0x2e')](handleError(_0x59659a,null));};exports[_0xaa60('0x6c')]=function(_0x87b964,_0x547010,_0x1dc06d){var _0x5e671f={'raw':![],'where':{}};var _0x2a03a0={};var _0x4b174d={'count':0x0,'rows':[]};return db['FaxAccount'][_0xaa60('0x6d')]({'where':{'id':_0x87b964[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x547010,null))[_0xaa60('0x25')](function(_0x2ed8e4){if(_0x2ed8e4){_0x2a03a0[_0xaa60('0x46')]=_[_0xaa60('0x49')](db[_0xaa60('0x6b')]['rawAttributes']);_0x2a03a0['query']=_['keys'](_0x87b964[_0xaa60('0x48')]);_0x2a03a0[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0x2a03a0['model'],_0x2a03a0[_0xaa60('0x48')]);_0x5e671f['attributes']=_['intersection'](_0x2a03a0[_0xaa60('0x46')],qs[_0xaa60('0x4b')](_0x87b964['query']['fields']));_0x5e671f[_0xaa60('0x4c')]=_0x5e671f[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x5e671f['attributes']:_0x2a03a0[_0xaa60('0x46')];if(!_0x87b964[_0xaa60('0x48')][_0xaa60('0x4e')](_0xaa60('0x6e'))){_0x5e671f[_0xaa60('0x35')]=qs[_0xaa60('0x35')](_0x87b964[_0xaa60('0x48')][_0xaa60('0x35')]);_0x5e671f['offset']=qs['offset'](_0x87b964[_0xaa60('0x48')][_0xaa60('0x33')]);}_0x5e671f['order']=qs['sort'](_0x87b964[_0xaa60('0x48')][_0xaa60('0x50')]);_0x5e671f[_0xaa60('0x54')]=qs['filters'](_[_0xaa60('0x52')](_0x87b964[_0xaa60('0x48')],_0x2a03a0[_0xaa60('0x51')]));_0x5e671f[_0xaa60('0x54')][_0xaa60('0x6a')]=_0x2ed8e4['id'];if(_0x87b964[_0xaa60('0x48')][_0xaa60('0x53')]){_0x5e671f[_0xaa60('0x54')]=_['merge'](_0x5e671f[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x5e671f[_0xaa60('0x4c')],function(_0x49a6e4){var _0x4aee9b={};_0x4aee9b[_0x49a6e4]={'$like':'%'+_0x87b964[_0xaa60('0x48')][_0xaa60('0x53')]+'%'};return _0x4aee9b;})});}_0x5e671f=_[_0xaa60('0x55')]({},_0x5e671f,_0x87b964['options']);return db['Disposition'][_0xaa60('0x36')]({'where':_0x5e671f['where']})[_0xaa60('0x25')](function(_0x8f0acb){_0x4b174d[_0xaa60('0x36')]=_0x8f0acb;if(_0x87b964[_0xaa60('0x48')]['includeAll']){_0x5e671f[_0xaa60('0x57')]=[{'all':!![]}];}return db['Disposition'][_0xaa60('0x58')](_0x5e671f);})[_0xaa60('0x25')](function(_0x391ca3){_0x4b174d[_0xaa60('0x59')]=_0x391ca3;return _0x4b174d;});}})[_0xaa60('0x25')](respondWithFilteredResult(_0x547010,_0x5e671f))[_0xaa60('0x2e')](handleError(_0x547010,null));};exports[_0xaa60('0x6f')]=function(_0x13ee9a,_0x1050fc,_0x4c1d99){return db[_0xaa60('0x56')][_0xaa60('0x5e')]({'where':{'id':_0x13ee9a['params']['id']}})['then'](handleEntityNotFound(_0x1050fc,null))[_0xaa60('0x25')](function(_0x8d263f){if(_0x8d263f){return _0x8d263f[_0xaa60('0x6f')](_0x13ee9a[_0xaa60('0x48')]['ids']);}})[_0xaa60('0x25')](respondWithStatusCode(_0x1050fc,null))[_0xaa60('0x2e')](handleError(_0x1050fc,null));};exports[_0xaa60('0x70')]=function(_0x3315ff,_0x3a740c,_0x24a1d8){if(_0x3315ff[_0xaa60('0x60')]['id']){delete _0x3315ff[_0xaa60('0x60')]['id'];}return db[_0xaa60('0x56')][_0xaa60('0x5e')]({'where':{'id':_0x3315ff[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x3a740c,null))[_0xaa60('0x25')](function(_0x98a729){if(_0x98a729){_0x3315ff[_0xaa60('0x60')]['FaxAccountId']=_0x98a729['id'];return db[_0xaa60('0x71')][_0xaa60('0x5f')](_0x3315ff[_0xaa60('0x60')]);}})['then'](respondWithResult(_0x3a740c,null))[_0xaa60('0x2e')](handleError(_0x3a740c,null));};exports[_0xaa60('0x72')]=function(_0x556cff,_0x177781,_0x1dbfba){var _0x5a1896={'raw':![],'where':{}};var _0x458117={};var _0x19cf4e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x556cff[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x177781,null))[_0xaa60('0x25')](function(_0x3beaff){if(_0x3beaff){_0x458117[_0xaa60('0x46')]=_['keys'](db['CannedAnswer'][_0xaa60('0x43')]);_0x458117[_0xaa60('0x48')]=_[_0xaa60('0x49')](_0x556cff[_0xaa60('0x48')]);_0x458117[_0xaa60('0x51')]=_['intersection'](_0x458117[_0xaa60('0x46')],_0x458117[_0xaa60('0x48')]);_0x5a1896['attributes']=_[_0xaa60('0x4a')](_0x458117['model'],qs[_0xaa60('0x4b')](_0x556cff[_0xaa60('0x48')][_0xaa60('0x4b')]));_0x5a1896[_0xaa60('0x4c')]=_0x5a1896[_0xaa60('0x4c')]['length']?_0x5a1896[_0xaa60('0x4c')]:_0x458117['model'];if(!_0x556cff[_0xaa60('0x48')][_0xaa60('0x4e')]('nolimit')){_0x5a1896[_0xaa60('0x35')]=qs['limit'](_0x556cff[_0xaa60('0x48')][_0xaa60('0x35')]);_0x5a1896['offset']=qs[_0xaa60('0x33')](_0x556cff[_0xaa60('0x48')][_0xaa60('0x33')]);}_0x5a1896[_0xaa60('0x4f')]=qs['sort'](_0x556cff[_0xaa60('0x48')]['sort']);_0x5a1896[_0xaa60('0x54')]=qs[_0xaa60('0x51')](_[_0xaa60('0x52')](_0x556cff[_0xaa60('0x48')],_0x458117['filters']));_0x5a1896[_0xaa60('0x54')][_0xaa60('0x6a')]=_0x3beaff['id'];if(_0x556cff[_0xaa60('0x48')][_0xaa60('0x53')]){_0x5a1896['where']=_[_0xaa60('0x55')](_0x5a1896['where'],{'$or':_[_0xaa60('0x47')](_0x5a1896['attributes'],function(_0x4a7e93){var _0x482b3d={};_0x482b3d[_0x4a7e93]={'$like':'%'+_0x556cff[_0xaa60('0x48')][_0xaa60('0x53')]+'%'};return _0x482b3d;})});}_0x5a1896=_[_0xaa60('0x55')]({},_0x5a1896,_0x556cff[_0xaa60('0x5d')]);return db['CannedAnswer'][_0xaa60('0x36')]({'where':_0x5a1896[_0xaa60('0x54')]})[_0xaa60('0x25')](function(_0x1bf47f){_0x19cf4e[_0xaa60('0x36')]=_0x1bf47f;if(_0x556cff[_0xaa60('0x48')][_0xaa60('0x5c')]){_0x5a1896['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xaa60('0x58')](_0x5a1896);})[_0xaa60('0x25')](function(_0xb954b2){_0x19cf4e[_0xaa60('0x59')]=_0xb954b2;return _0x19cf4e;});}})[_0xaa60('0x25')](respondWithFilteredResult(_0x177781,_0x5a1896))[_0xaa60('0x2e')](handleError(_0x177781,null));};exports[_0xaa60('0x73')]=function(_0x5ef512,_0x1882d7,_0x9d22ff){return db['FaxAccount'][_0xaa60('0x5e')]({'where':{'id':_0x5ef512[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x1882d7,null))[_0xaa60('0x25')](function(_0x503fb8){if(_0x503fb8){return _0x503fb8['removeAnswers'](_0x5ef512['query'][_0xaa60('0x74')]);}})[_0xaa60('0x25')](respondWithStatusCode(_0x1882d7,null))[_0xaa60('0x2e')](handleError(_0x1882d7,null));};exports[_0xaa60('0x75')]=function(_0x3dd718,_0x3830d9,_0x27768e){return db[_0xaa60('0x76')][_0xaa60('0x5e')]({'where':{'id':_0x3dd718[_0xaa60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3830d9,null))[_0xaa60('0x25')](function(_0x26ac09){if(_0x26ac09){return _0x26ac09[_0xaa60('0x75')](_0x3dd718[_0xaa60('0x60')][_0xaa60('0x74')],_[_0xaa60('0x77')](_0x3dd718[_0xaa60('0x60')],['ids','id'])||{});}})[_0xaa60('0x25')](respondWithResult(_0x3830d9,null))[_0xaa60('0x2e')](handleError(_0x3830d9,null));};exports[_0xaa60('0x78')]=function(_0x1a3db7,_0x483255,_0x11622a){var _0x50a5f3={'raw':![],'where':{}};var _0x42682={};var _0x53e9ab={'count':0x0,'rows':[]};return db[_0xaa60('0x56')]['findOne']({'where':{'id':_0x1a3db7[_0xaa60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x483255,null))[_0xaa60('0x25')](function(_0x389247){if(_0x389247){_0x42682[_0xaa60('0x46')]=_['keys'](db[_0xaa60('0x76')][_0xaa60('0x43')]);_0x42682[_0xaa60('0x48')]=_['keys'](_0x1a3db7['query']);_0x42682[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0x42682[_0xaa60('0x46')],_0x42682[_0xaa60('0x48')]);_0x50a5f3[_0xaa60('0x4c')]=_[_0xaa60('0x4a')](_0x42682[_0xaa60('0x46')],qs[_0xaa60('0x4b')](_0x1a3db7[_0xaa60('0x48')][_0xaa60('0x4b')]));_0x50a5f3[_0xaa60('0x4c')]=_0x50a5f3[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x50a5f3['attributes']:_0x42682[_0xaa60('0x46')];if(!_0x1a3db7['query']['hasOwnProperty']('nolimit')){_0x50a5f3['limit']=qs[_0xaa60('0x35')](_0x1a3db7['query']['limit']);_0x50a5f3[_0xaa60('0x33')]=qs[_0xaa60('0x33')](_0x1a3db7[_0xaa60('0x48')]['offset']);}_0x50a5f3[_0xaa60('0x4f')]=qs[_0xaa60('0x50')](_0x1a3db7['query'][_0xaa60('0x50')]);_0x50a5f3[_0xaa60('0x54')]=qs[_0xaa60('0x51')](_['pick'](_0x1a3db7[_0xaa60('0x48')],_0x42682[_0xaa60('0x51')]));_0x50a5f3[_0xaa60('0x54')][_0xaa60('0x6a')]=_0x389247['id'];if(_0x1a3db7[_0xaa60('0x48')][_0xaa60('0x53')]){_0x50a5f3[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x50a5f3[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x50a5f3[_0xaa60('0x4c')],function(_0x350b09){var _0x502820={};_0x502820[_0x350b09]={'$like':'%'+_0x1a3db7[_0xaa60('0x48')]['filter']+'%'};return _0x502820;})});}_0x50a5f3=_[_0xaa60('0x55')]({},_0x50a5f3,_0x1a3db7[_0xaa60('0x5d')]);return db[_0xaa60('0x76')][_0xaa60('0x36')]({'where':_0x50a5f3[_0xaa60('0x54')]})[_0xaa60('0x25')](function(_0x4c7899){_0x53e9ab[_0xaa60('0x36')]=_0x4c7899;if(_0x1a3db7['query'][_0xaa60('0x5c')]){_0x50a5f3[_0xaa60('0x57')]=[{'model':db[_0xaa60('0x79')],'as':_0xaa60('0x7a'),'required':![]},{'model':db[_0xaa60('0x7b')],'as':_0xaa60('0x7c'),'attributes':['name',_0xaa60('0x7d'),_0xaa60('0x7e')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xaa60('0x3f'),_0xaa60('0x7f')],'where':_0x1a3db7[_0xaa60('0x48')][_0xaa60('0x80')]?{'id':_0x1a3db7['query'][_0xaa60('0x80')]}:undefined,'required':_0x1a3db7[_0xaa60('0x48')][_0xaa60('0x80')]?!![]:![]}];}return db['FaxInteraction'][_0xaa60('0x58')](_0x50a5f3);})[_0xaa60('0x25')](function(_0x435a7a){_0x53e9ab['rows']=_0x435a7a;return _0x53e9ab;});}})[_0xaa60('0x25')](respondWithFilteredResult(_0x483255,_0x50a5f3))[_0xaa60('0x2e')](handleError(_0x483255,null));};exports[_0xaa60('0x81')]=function(_0x13d1c3,_0x346906){var _0x49c72f=_0x13d1c3[_0xaa60('0x5b')]['id'];var _0x45e01b=_0x13d1c3[_0xaa60('0x60')];var _0x266eae=0xc8;var _0x56f5c9=null;return db[_0xaa60('0x82')][_0xaa60('0x83')]({'isolationLevel':db[_0xaa60('0x82')][_0xaa60('0x84')][_0xaa60('0x85')][_0xaa60('0x86')]},function(_0x59e7c2){return db[_0xaa60('0x56')][_0xaa60('0x6d')]({'where':{'id':_0x49c72f},'transaction':_0x59e7c2})[_0xaa60('0x25')](function(_0x3fa223){if(_0x3fa223){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x49c72f},'transaction':_0x59e7c2})[_0xaa60('0x25')](function(){var _0x4ebb27=_[_0xaa60('0x47')](_0x45e01b,function(_0x219ace){_0x219ace['FaxAccountId']=_0x49c72f;return _0x219ace;});return db[_0xaa60('0x87')][_0xaa60('0x88')](_0x4ebb27,{'transaction':_0x59e7c2});});}else{_0x266eae=0x194;_0x56f5c9=[];}});})[_0xaa60('0x25')](function(){if(_0x266eae!==0x194){return db[_0xaa60('0x87')]['findAndCountAll']({'where':{'FaxAccountId':_0x49c72f},'order':'priority'})[_0xaa60('0x25')](function(_0x52da35){_0x56f5c9=_0x52da35;});}})['catch'](function(_0x208873){_0x266eae=0x1f4;logger[_0xaa60('0x2c')](_0x208873[_0xaa60('0x89')]);if(_0x208873[_0xaa60('0x3f')]){delete _0x208873[_0xaa60('0x3f')];}_0x56f5c9=_0x208873;})['finally'](function(){if(_0x56f5c9===null){_0x346906[_0xaa60('0x2f')](_0x266eae);}else{if(_0x266eae===0x1f4){_0x346906[_0xaa60('0x31')](_0x266eae)['send'](_0x56f5c9);}else{_0x346906['status'](_0x266eae)[_0xaa60('0x32')](_0x56f5c9);}}});};exports[_0xaa60('0x8a')]=function(_0x5ee017,_0x1fb198,_0x98e05){var _0x150552={};var _0xe0271={};var _0x54a4bb;var _0x5ed5f1;return db[_0xaa60('0x56')]['findOne']({'where':{'id':_0x5ee017[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x1fb198,null))['then'](function(_0x1efee5){if(_0x1efee5){_0x54a4bb=_0x1efee5;_0xe0271['model']=_['keys'](db[_0xaa60('0x87')][_0xaa60('0x43')]);_0xe0271['query']=_[_0xaa60('0x49')](_0x5ee017['query']);_0xe0271[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0xe0271[_0xaa60('0x46')],_0xe0271[_0xaa60('0x48')]);_0x150552[_0xaa60('0x4c')]=_[_0xaa60('0x4a')](_0xe0271[_0xaa60('0x46')],qs['fields'](_0x5ee017[_0xaa60('0x48')][_0xaa60('0x4b')]));_0x150552[_0xaa60('0x4c')]=_0x150552[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x150552[_0xaa60('0x4c')]:_0xe0271[_0xaa60('0x46')];_0x150552[_0xaa60('0x4f')]=qs['sort'](_0x5ee017[_0xaa60('0x48')]['sort']);_0x150552[_0xaa60('0x54')]=qs[_0xaa60('0x51')](_[_0xaa60('0x52')](_0x5ee017[_0xaa60('0x48')],_0xe0271[_0xaa60('0x51')]));if(_0x5ee017[_0xaa60('0x48')][_0xaa60('0x53')]){_0x150552[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x150552[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x150552[_0xaa60('0x4c')],function(_0x15ed7e){var _0x236ebc={};_0x236ebc[_0x15ed7e]={'$like':'%'+_0x5ee017[_0xaa60('0x48')][_0xaa60('0x53')]+'%'};return _0x236ebc;})});}_0x150552=_['merge']({},_0x150552,_0x5ee017[_0xaa60('0x5d')]);return _0x54a4bb['getApplications'](_0x150552);}})['then'](function(_0x4ce319){if(_0x4ce319){_0x5ed5f1=_0x4ce319[_0xaa60('0x4d')];if(!_0x5ee017['query'][_0xaa60('0x4e')](_0xaa60('0x6e'))){_0x150552[_0xaa60('0x35')]=qs[_0xaa60('0x35')](_0x5ee017[_0xaa60('0x48')][_0xaa60('0x35')]);_0x150552[_0xaa60('0x33')]=qs['offset'](_0x5ee017['query']['offset']);}return _0x54a4bb[_0xaa60('0x8a')](_0x150552);}})[_0xaa60('0x25')](function(_0x5258a7){if(_0x5258a7){return _0x5258a7?{'count':_0x5ed5f1,'rows':_0x5258a7}:null;}})[_0xaa60('0x25')](respondWithResult(_0x1fb198,null))[_0xaa60('0x2e')](handleError(_0x1fb198,null));};function Extension(_0x2270ec,_0x3637ea,_0x1244a0,_0x2368ca){this[_0xaa60('0x8b')]='from-voip-provider';this['exten']=_0x2270ec[_0xaa60('0x8c')];this[_0xaa60('0x8d')]=_0x2368ca;this[_0xaa60('0x8e')]='system';this[_0xaa60('0x8f')]=_0xaa60('0x90');this[_0xaa60('0x6a')]=_0x2270ec['id'];this[_0xaa60('0x91')]=_0x3637ea;this[_0xaa60('0x92')]=_0x1244a0;}function createExtensionsReciveFax(_0x58f752){var _0x22e7d0=0x1;var _0x1e774b=[];_0x1e774b['push'](new Extension(_0x58f752,_0x22e7d0,'',_0xaa60('0x93')));_0x22e7d0+=0x1;_0x1e774b[_0xaa60('0x94')](new Extension(_0x58f752,_0x22e7d0,'CDR(type)=inbound-fax','Set'));_0x22e7d0+=0x1;for(var _0x276445 in _0x58f752){if(_0x58f752[_0xaa60('0x4e')](_0x276445)&&(_0x276445===_0xaa60('0x95')||_0x276445==='localstationid'||_0x276445===_0xaa60('0x96')||_0x276445===_0xaa60('0x97')||_0x276445===_0xaa60('0x98')||_0x276445==='maxrate'||_0x276445===_0xaa60('0x99')||_0x276445==='modem'||_0x276445==='t38timeout')){_0x1e774b[_0xaa60('0x94')](new Extension(_0x58f752,_0x22e7d0,'FAXOPT('+_0x276445+')='+_0x58f752[_0x276445],_0xaa60('0x9a')));_0x22e7d0+=0x1;}}_0x1e774b['push'](new Extension(_0x58f752,_0x22e7d0,'6','Wait'));_0x22e7d0+=0x1;_0x1e774b[_0xaa60('0x94')](new Extension(_0x58f752,_0x22e7d0,_0xaa60('0x9b'),'ReceiveFax'));_0x22e7d0=0x0;return _0x1e774b;}exports[_0xaa60('0x9c')]=function(_0x76e75f,_0x410477,_0x36c107){var _0x8bf5fa;return db[_0xaa60('0x82')]['transaction'](function(_0x240c6a){return db[_0xaa60('0x56')][_0xaa60('0x5f')](_0x76e75f['body'],{'transaction':_0x240c6a})[_0xaa60('0x25')](function(_0xa059c){_0x8bf5fa=_0xa059c[_0xaa60('0x3e')]({'plain':!![]});return db[_0xaa60('0x9d')]['bulkCreate'](createExtensionsReciveFax(_0x8bf5fa),{'transaction':_0x240c6a});});})[_0xaa60('0x25')](function(){return _0x8bf5fa;})[_0xaa60('0x25')](respondWithResult(_0x410477,null))[_0xaa60('0x2e')](handleError(_0x410477,null));};exports[_0xaa60('0x9e')]=function(_0x40c6ef,_0x37f606,_0x46b191){var _0x5f1aa7;return db[_0xaa60('0x82')][_0xaa60('0x83')](function(_0x1af3ca){return db[_0xaa60('0x56')][_0xaa60('0x3c')](_0x40c6ef[_0xaa60('0x60')],{'where':{'id':_0x40c6ef[_0xaa60('0x60')]['id']},'transaction':_0x1af3ca})['then'](function(_0x3e4d30){return db[_0xaa60('0x9d')]['destroy']({'where':{'FaxAccountId':_0x40c6ef[_0xaa60('0x60')]['id']},'transaction':_0x1af3ca})['then'](function(_0x1880c6){return db[_0xaa60('0x9d')][_0xaa60('0x88')](createExtensionsReciveFax(_[_0xaa60('0x77')](_0x40c6ef[_0xaa60('0x60')],[_0xaa60('0x9f'),_0xaa60('0x45'),_0xaa60('0xa0'),'updatedAt','TrunkId','ListId'])),{'transaction':_0x1af3ca});});});})[_0xaa60('0x25')](function(){return db[_0xaa60('0x56')][_0xaa60('0xa1')](_0x40c6ef[_0xaa60('0x60')]['id']);})[_0xaa60('0x25')](respondWithResult(_0x37f606,null))[_0xaa60('0x2e')](handleError(_0x37f606,null));};exports['getMessages']=function(_0x1cd968,_0x4a0a39,_0x22f630){var _0x3f8d88={'raw':!![],'where':{}};var _0x569f2b={};var _0xbd639e={'count':0x0,'rows':[]};return db[_0xaa60('0x56')][_0xaa60('0x6d')]({'where':{'id':_0x1cd968[_0xaa60('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4a0a39,null))[_0xaa60('0x25')](function(_0x4be3d1){if(_0x4be3d1){_0x569f2b['model']=_['keys'](db[_0xaa60('0xa2')][_0xaa60('0x43')]);_0x569f2b[_0xaa60('0x48')]=_[_0xaa60('0x49')](_0x1cd968[_0xaa60('0x48')]);_0x569f2b[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0x569f2b['model'],_0x569f2b[_0xaa60('0x48')]);_0x3f8d88['attributes']=_[_0xaa60('0x4a')](_0x569f2b[_0xaa60('0x46')],qs[_0xaa60('0x4b')](_0x1cd968[_0xaa60('0x48')][_0xaa60('0x4b')]));_0x3f8d88[_0xaa60('0x4c')]=_0x3f8d88[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x3f8d88['attributes']:_0x569f2b[_0xaa60('0x46')];if(!_0x1cd968[_0xaa60('0x48')][_0xaa60('0x4e')](_0xaa60('0x6e'))){_0x3f8d88[_0xaa60('0x35')]=qs[_0xaa60('0x35')](_0x1cd968[_0xaa60('0x48')][_0xaa60('0x35')]);_0x3f8d88[_0xaa60('0x33')]=qs[_0xaa60('0x33')](_0x1cd968[_0xaa60('0x48')][_0xaa60('0x33')]);}_0x3f8d88['order']=qs[_0xaa60('0x50')](_0x1cd968[_0xaa60('0x48')][_0xaa60('0x50')]);_0x3f8d88['where']=qs['filters'](_[_0xaa60('0x52')](_0x1cd968[_0xaa60('0x48')],_0x569f2b[_0xaa60('0x51')]));_0x3f8d88[_0xaa60('0x54')]['FaxAccountId']=_0x4be3d1['id'];if(_0x1cd968[_0xaa60('0x48')][_0xaa60('0x53')]){_0x3f8d88[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x3f8d88[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x3f8d88[_0xaa60('0x4c')],function(_0x413177){var _0x9ae993={};_0x9ae993[_0x413177]={'$like':'%'+_0x1cd968['query'][_0xaa60('0x53')]+'%'};return _0x9ae993;})});}if(_0x1cd968[_0xaa60('0x48')][_0xaa60('0xa3')]){var _0x136b2b=_0x1cd968[_0xaa60('0x48')][_0xaa60('0xa3')][_0xaa60('0xa4')](',');var _0x5e1b92={};_0x5e1b92[_0x136b2b[0x0]]={'$gte':moment(_0x136b2b[0x1])[_0xaa60('0xa5')](_0xaa60('0xa6'))};_0x3f8d88[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x3f8d88['where'],_0x5e1b92);}_0x3f8d88=_['merge']({},_0x3f8d88,_0x1cd968['options']);return db[_0xaa60('0xa2')][_0xaa60('0x36')]({'where':_0x3f8d88['where']})[_0xaa60('0x25')](function(_0x30747d){_0xbd639e[_0xaa60('0x36')]=_0x30747d;if(_0x1cd968['query'][_0xaa60('0x5c')]){_0x3f8d88[_0xaa60('0x57')]=[{'all':!![]}];}return db[_0xaa60('0xa2')]['findAll'](_0x3f8d88);})[_0xaa60('0x25')](function(_0x5da9be){_0xbd639e[_0xaa60('0x59')]=_0x5da9be;return _0xbd639e;});}})[_0xaa60('0x25')](respondWithFilteredResult(_0x4a0a39,_0x3f8d88))[_0xaa60('0x2e')](handleError(_0x4a0a39,null));};exports['send']=function(_0x25e695,_0x23ec0b,_0x56f61c){var _0x472cd0,_0x386b0c={},_0x42e1c2;if(_0x25e695[_0xaa60('0x60')]['to']){_0x42e1c2=_0x25e695[_0xaa60('0x60')]['to'][0x0];}return db['FaxAccount'][_0xaa60('0x5e')]({'where':{'id':_0x25e695['params']['id']},'include':[{'model':db[_0xaa60('0xa7')],'as':'List','include':[{'model':db[_0xaa60('0x79')],'as':_0xaa60('0xa8'),'where':{'fax':_0x42e1c2},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x23ec0b,null))[_0xaa60('0x25')](function(_0x24fff0){_0x472cd0=_0x24fff0;if(_0x25e695[_0xaa60('0x60')]['attachments']&&_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][_0xaa60('0x4d')]){for(var _0xbb25f8=0x0;_0xbb25f8<_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][_0xaa60('0x4d')];_0xbb25f8+=0x1){_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][_0xbb25f8]={'filename':_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][_0xbb25f8][_0xaa60('0x3f')],'id':_0x25e695[_0xaa60('0x60')]['attachments'][_0xbb25f8]['id'],'path':path[_0xaa60('0xaa')](config['root'],_0xaa60('0xab'),_0x25e695['body'][_0xaa60('0xa9')][_0xbb25f8][_0xaa60('0xac')])};}}return respondWithRpcPromise(_0xaa60('0xad'),_0xaa60('0xad'),{'FaxAccountId':_[_0xaa60('0xae')](_0x25e695[_0xaa60('0x5b')]['id'])?undefined:_0x25e695['params']['id'],'path':_[_0xaa60('0xae')](_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][0x0][_0xaa60('0x8')])?undefined:_0x25e695[_0xaa60('0x60')]['attachments'][0x0][_0xaa60('0x8')],'fax':_[_0xaa60('0xae')](_0x25e695[_0xaa60('0x60')]['to'][0x0])?undefined:_0x25e695[_0xaa60('0x60')]['to'][0x0]},client9002);})[_0xaa60('0x25')](function(){if(_0x472cd0){if(_['isNil'](_0x25e695[_0xaa60('0x60')]['from'])){_0x25e695[_0xaa60('0x60')]['from']=util[_0xaa60('0xa5')](_0xaa60('0xaf'),_0x472cd0[_0xaa60('0x3f')],_0x472cd0['fax']);}if(_0x472cd0[_0xaa60('0xb0')]){if(_0x472cd0[_0xaa60('0xb0')][_0xaa60('0xa8')][_0xaa60('0x4d')]){return _0x472cd0[_0xaa60('0xb0')]['Contacts'][0x0];}else{return db[_0xaa60('0x79')][_0xaa60('0x5f')](_[_0xaa60('0x1c')](_0x25e695[_0xaa60('0x60')],{'firstName':_0x25e695['body']['to'][0x0],'phone':_0x25e695[_0xaa60('0x60')]['to'][0x0],'fax':_0x25e695[_0xaa60('0x60')]['to'][0x0],'ListId':_0x472cd0[_0xaa60('0xb1')]}));}}else{throw new Error(_0xaa60('0xb2'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xaa60('0x25')](function(_0x64f6e2){if(_0x64f6e2){return db[_0xaa60('0x76')][_0xaa60('0x5e')]({'where':{'ContactId':_0x64f6e2['id'],'closed':![],'FaxAccountId':_0x472cd0['id']}})[_0xaa60('0x25')](function(_0x4131a9){if(_0x4131a9){return[_0x4131a9,![]];}return db[_0xaa60('0x76')][_0xaa60('0x5f')]({'UserId':_0x25e695[_0xaa60('0x62')]['id'],'ContactId':_0x64f6e2['id'],'FaxAccountId':_0x472cd0['id'],'fax':_0x25e695[_0xaa60('0x60')]['to'][0x0],'firstMsgDirection':_0xaa60('0xb3'),'Messages':[_[_0xaa60('0x55')](_0x25e695['body'],{'read':![],'body':_0x25e695['body']['attachments'][0x0][_0xaa60('0xb4')],'FaxAccountId':_0x472cd0['id'],'UserId':_0x25e695['user']['id'],'ContactId':_0x64f6e2['id'],'AttachmentId':_0x25e695[_0xaa60('0x60')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xaa60('0xb5')}]})[_0xaa60('0x25')](function(_0x212342){return[_0x212342,!![]];});});}else{throw new Error(_0xaa60('0xb6'));}})[_0xaa60('0xb7')](function(_0x3f9939,_0xe683b6){if(_0xe683b6){return _0x3f9939;}return db[_0xaa60('0xa2')][_0xaa60('0x5f')]({'direction':'out','read':![],'body':_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][0x0]['filename'],'FaxAccountId':_0x472cd0['id'],'FaxInteractionId':_0x3f9939['id'],'UserId':_0x25e695['user']['id'],'ContactId':_0x3f9939[_0xaa60('0xb8')],'AttachmentId':_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][0x0]['id']})[_0xaa60('0x25')](function(_0x1a995b){_0x3f9939[_0xaa60('0xb9')][_0xaa60('0xb5')]=[];_0x3f9939[_0xaa60('0xb9')]['Messages'][_0xaa60('0x94')](_0x1a995b[_0xaa60('0xb9')]);return _0x3f9939;});})[_0xaa60('0x25')](function(_0x116215){respondWithRpcPromise('SendFax',_0xaa60('0xba'),{'FaxAccountId':_['isNil'](_0x25e695['params']['id'])?undefined:_0x25e695[_0xaa60('0x5b')]['id'],'path':_[_0xaa60('0xae')](_0x25e695['body'][_0xaa60('0xa9')][0x0]['path'])?undefined:_0x25e695[_0xaa60('0x60')][_0xaa60('0xa9')][0x0][_0xaa60('0x8')],'fax':_[_0xaa60('0xae')](_0x25e695['body']['to'][0x0])?undefined:_0x25e695[_0xaa60('0x60')]['to'][0x0],'AttachmentId':_0x25e695[_0xaa60('0x60')]['attachments'][0x0]['id']},client9002)[_0xaa60('0x25')](function(_0x2eb04e){logger['info'](_0xaa60('0xbb'),_0x2eb04e);})[_0xaa60('0x2e')](function(_0x2d09b0){logger[_0xaa60('0x26')]('SendFaxRpc,\x20%s',_0x2d09b0);});return _0x116215;})[_0xaa60('0x25')](respondWithResult(_0x23ec0b,null))[_0xaa60('0x2e')](handleError(_0x23ec0b,null));};exports[_0xaa60('0xbc')]=function(_0x2c624b,_0x2336ae,_0xfde4ef){return db['FaxAccount'][_0xaa60('0x5e')]({'where':{'id':_0x2c624b[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x2336ae,null))['then'](function(_0x1f89d0){if(_0x1f89d0){return _0x1f89d0[_0xaa60('0xbc')](_0x2c624b[_0xaa60('0x60')][_0xaa60('0x74')],_[_0xaa60('0x77')](_0x2c624b[_0xaa60('0x60')],[_0xaa60('0x74'),'id'])||{})[_0xaa60('0xb7')](function(_0x2c2b66){for(var _0x9c13d4=0x0;_0x9c13d4<_0x2c624b[_0xaa60('0x60')][_0xaa60('0x74')][_0xaa60('0x4d')];_0x9c13d4+=0x1){socket[_0xaa60('0xbd')](_0xaa60('0xbe'),{'UserId':Number(_0x2c624b[_0xaa60('0x60')]['ids'][_0x9c13d4]),'FaxAccountId':Number(_0x2c624b[_0xaa60('0x5b')]['id'])});}return _0x2c2b66;});}})['then'](respondWithResult(_0x2336ae,null))[_0xaa60('0x2e')](handleError(_0x2336ae,null));};exports[_0xaa60('0xbf')]=function(_0x3c8f2f,_0x195c18,_0x66cb01){return db[_0xaa60('0x56')][_0xaa60('0x5e')]({'where':{'id':_0x3c8f2f[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x195c18,null))[_0xaa60('0x25')](function(_0x2815c5){if(_0x2815c5){return _0x2815c5['removeAgents'](_0x3c8f2f[_0xaa60('0x48')][_0xaa60('0x74')])['then'](function(){if(_['isArray'](_0x3c8f2f['query'][_0xaa60('0x74')])){for(var _0x5173b2=0x0;_0x5173b2<_0x3c8f2f['query'][_0xaa60('0x74')][_0xaa60('0x4d')];_0x5173b2+=0x1){socket[_0xaa60('0xbd')](_0xaa60('0xc0'),{'UserId':Number(_0x3c8f2f['query'][_0xaa60('0x74')][_0x5173b2]),'FaxAccountId':Number(_0x3c8f2f[_0xaa60('0x5b')]['id'])});}}else{socket[_0xaa60('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x3c8f2f[_0xaa60('0x48')]['ids']),'FaxAccountId':Number(_0x3c8f2f[_0xaa60('0x5b')]['id'])});}});}})[_0xaa60('0x25')](respondWithStatusCode(_0x195c18,null))[_0xaa60('0x2e')](handleError(_0x195c18,null));};exports[_0xaa60('0xc1')]=function(_0x56bc39,_0x192aa7,_0x119738){var _0x206416={};var _0x419612={};var _0x1279df;var _0xbcc78b;return db[_0xaa60('0x56')][_0xaa60('0x6d')]({'where':{'id':_0x56bc39[_0xaa60('0x5b')]['id']}})[_0xaa60('0x25')](handleEntityNotFound(_0x192aa7,null))[_0xaa60('0x25')](function(_0x4eb2e3){if(_0x4eb2e3){_0x1279df=_0x4eb2e3;_0x419612['model']=_['keys'](db[_0xaa60('0x7b')]['rawAttributes']);_0x419612[_0xaa60('0x48')]=_[_0xaa60('0x49')](_0x56bc39[_0xaa60('0x48')]);_0x419612[_0xaa60('0x51')]=_[_0xaa60('0x4a')](_0x419612[_0xaa60('0x46')],_0x419612[_0xaa60('0x48')]);_0x206416[_0xaa60('0x4c')]=_[_0xaa60('0x4a')](_0x419612[_0xaa60('0x46')],qs['fields'](_0x56bc39['query']['fields']));_0x206416['attributes']=_0x206416[_0xaa60('0x4c')][_0xaa60('0x4d')]?_0x206416[_0xaa60('0x4c')]:_0x419612['model'];_0x206416[_0xaa60('0x4f')]=qs['sort'](_0x56bc39[_0xaa60('0x48')]['sort']);_0x206416[_0xaa60('0x54')]=qs[_0xaa60('0x51')](_[_0xaa60('0x52')](_0x56bc39[_0xaa60('0x48')],_0x419612[_0xaa60('0x51')]));if(_0x56bc39[_0xaa60('0x48')]['filter']){_0x206416[_0xaa60('0x54')]=_[_0xaa60('0x55')](_0x206416[_0xaa60('0x54')],{'$or':_[_0xaa60('0x47')](_0x206416[_0xaa60('0x4c')],function(_0x42e5f8){var _0x142ef9={};_0x142ef9[_0x42e5f8]={'$like':'%'+_0x56bc39[_0xaa60('0x48')][_0xaa60('0x53')]+'%'};return _0x142ef9;})});}_0x206416=_[_0xaa60('0x55')]({},_0x206416,_0x56bc39[_0xaa60('0x5d')]);return _0x1279df[_0xaa60('0xc1')](_0x206416);}})[_0xaa60('0x25')](function(_0x4304f0){if(_0x4304f0){_0xbcc78b=_0x4304f0[_0xaa60('0x4d')];if(!_0x56bc39[_0xaa60('0x48')][_0xaa60('0x4e')](_0xaa60('0x6e'))){_0x206416[_0xaa60('0x35')]=qs[_0xaa60('0x35')](_0x56bc39[_0xaa60('0x48')][_0xaa60('0x35')]);_0x206416[_0xaa60('0x33')]=qs[_0xaa60('0x33')](_0x56bc39[_0xaa60('0x48')]['offset']);}return _0x1279df['getAgents'](_0x206416);}})[_0xaa60('0x25')](function(_0x72096d){if(_0x72096d){return _0x72096d?{'count':_0xbcc78b,'rows':_0x72096d}:null;}})[_0xaa60('0x25')](respondWithResult(_0x192aa7,null))['catch'](handleError(_0x192aa7,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 67cdb3b..ea22267 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 _0x242d=['FaxAccount','setMaxListeners','update','emit','hook','exports','events','../../mysqldb'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x242d,0x11e));var _0xd242=function(_0xe02346,_0x5e4eb7){_0xe02346=_0xe02346-0x0;var _0x4a6a6e=_0x242d[_0xe02346];return _0x4a6a6e;};'use strict';var EventEmitter=require(_0xd242('0x0'));var FaxAccount=require(_0xd242('0x1'))['db'][_0xd242('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xd242('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd242('0x4'),'afterDestroy':'remove'};function emitEvent(_0xceed1f){return function(_0x176890,_0x2b6a39,_0x380368){FaxAccountEvents['emit'](_0xceed1f+':'+_0x176890['id'],_0x176890);FaxAccountEvents[_0xd242('0x5')](_0xceed1f,_0x176890);_0x380368(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xd242('0x6')](e,emitEvent(event));}}module[_0xd242('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x13a0=['setMaxListeners','save','remove','hook','exports','../../mysqldb','FaxAccount'];(function(_0x334a94,_0x26b6d1){var _0x1db170=function(_0x5ee6d8){while(--_0x5ee6d8){_0x334a94['push'](_0x334a94['shift']());}};_0x1db170(++_0x26b6d1);}(_0x13a0,0x1cc));var _0x013a=function(_0x4bb145,_0x3e7d33){_0x4bb145=_0x4bb145-0x0;var _0x4db596=_0x13a0[_0x4bb145];return _0x4db596;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x013a('0x0'))['db'][_0x013a('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x013a('0x2')](0x0);var events={'afterCreate':_0x013a('0x3'),'afterUpdate':'update','afterDestroy':_0x013a('0x4')};function emitEvent(_0x4f79c2){return function(_0x395416,_0x5025e3,_0x41c510){FaxAccountEvents['emit'](_0x4f79c2+':'+_0x395416['id'],_0x395416);FaxAccountEvents['emit'](_0x4f79c2,_0x395416);_0x41c510(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x013a('0x5')](e,emitEvent(event));}}module[_0x013a('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index c302e9c..2aae5df 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 _0xb76d=['api','bluebird','request-promise','path','rimraf','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xb76d,0x111));var _0xdb76=function(_0x148eae,_0xe0f769){_0x148eae=_0x148eae-0x0;var _0x18bcf8=_0xb76d[_0x148eae];return _0x18bcf8;};'use strict';var _=require(_0xdb76('0x0'));var util=require('util');var logger=require(_0xdb76('0x1'))(_0xdb76('0x2'));var moment=require('moment');var BPromise=require(_0xdb76('0x3'));var rp=require(_0xdb76('0x4'));var fs=require('fs');var path=require(_0xdb76('0x5'));var rimraf=require(_0xdb76('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xdb76('0x7')]=function(_0x68af50,_0x5dca70){return _0x68af50[_0xdb76('0x8')](_0xdb76('0x9'),attributes,{'tableName':_0xdb76('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff20=['bluebird','request-promise','path','rimraf','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment'];(function(_0x38ee24,_0x56d030){var _0x2d3dc6=function(_0x64ec8a){while(--_0x64ec8a){_0x38ee24['push'](_0x38ee24['shift']());}};_0x2d3dc6(++_0x56d030);}(_0xff20,0xa4));var _0x0ff2=function(_0x25a281,_0x373839){_0x25a281=_0x25a281-0x0;var _0xc58b68=_0xff20[_0x25a281];return _0xc58b68;};'use strict';var _=require(_0x0ff2('0x0'));var util=require('util');var logger=require(_0x0ff2('0x1'))(_0x0ff2('0x2'));var moment=require(_0x0ff2('0x3'));var BPromise=require(_0x0ff2('0x4'));var rp=require(_0x0ff2('0x5'));var fs=require('fs');var path=require(_0x0ff2('0x6'));var rimraf=require(_0x0ff2('0x7'));var config=require('../../config/environment');var attributes=require(_0x0ff2('0x8'));module['exports']=function(_0xd1d2e3,_0x2a1e11){return _0xd1d2e3[_0x0ff2('0x9')](_0x0ff2('0xa'),attributes,{'tableName':_0x0ff2('0xb'),'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 b8aae3f..3fe2f0b 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 _0xad14=['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','account','DESC','FaxApplication','List','get','applications','Applications','list','orderBy','asc','Contacts','create','FaxInteraction','find','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','include','map','model','debug','NotifyFaxAccount','body','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xad14,0x7f));var _0x4ad1=function(_0x254635,_0x472b4c){_0x254635=_0x254635-0x0;var _0x35293c=_0xad14[_0x254635];return _0x35293c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4ad1('0x0'));var rs=require(_0x4ad1('0x1'));var fs=require('fs');var Redis=require(_0x4ad1('0x2'));var db=require(_0x4ad1('0x3'))['db'];var utils=require(_0x4ad1('0x4'));var logger=require(_0x4ad1('0x5'))(_0x4ad1('0x6'));var config=require('../../config/environment');var jayson=require(_0x4ad1('0x7'));var client=jayson[_0x4ad1('0x8')][_0x4ad1('0x9')]({'port':0x232c});config[_0x4ad1('0xa')]=_[_0x4ad1('0xb')](config[_0x4ad1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ad1('0xc'))(new Redis(config[_0x4ad1('0xa')]));require(_0x4ad1('0xd'))[_0x4ad1('0xe')](socket);function respondWithRpcPromise(_0x1e5f9b,_0x3881c6,_0x1fe3c3){return new BPromise(function(_0xa45354,_0x5ad0e5){return client[_0x4ad1('0xf')](_0x1e5f9b,_0x1fe3c3)[_0x4ad1('0x10')](function(_0x2cc96b){logger[_0x4ad1('0x11')](_0x4ad1('0x12'),_0x3881c6,_0x4ad1('0x13'));logger['debug'](_0x4ad1('0x14'),_0x3881c6,_0x4ad1('0x13'),JSON[_0x4ad1('0x15')](_0x2cc96b));if(_0x2cc96b[_0x4ad1('0x16')]){if(_0x2cc96b[_0x4ad1('0x16')][_0x4ad1('0x17')]===0x1f4){logger['error'](_0x4ad1('0x12'),_0x3881c6,_0x2cc96b[_0x4ad1('0x16')][_0x4ad1('0x18')]);return _0x5ad0e5(_0x2cc96b[_0x4ad1('0x16')][_0x4ad1('0x18')]);}logger['error'](_0x4ad1('0x12'),_0x3881c6,_0x2cc96b[_0x4ad1('0x16')][_0x4ad1('0x18')]);return _0xa45354(_0x2cc96b[_0x4ad1('0x16')][_0x4ad1('0x18')]);}else{logger['info'](_0x4ad1('0x12'),_0x3881c6,_0x4ad1('0x13'));_0xa45354(_0x2cc96b[_0x4ad1('0x19')][_0x4ad1('0x18')]);}})[_0x4ad1('0x1a')](function(_0x599e7b){logger[_0x4ad1('0x16')](_0x4ad1('0x12'),_0x3881c6,_0x599e7b);_0x5ad0e5(_0x599e7b);});});}exports[_0x4ad1('0x1b')]=function(_0x30c35e){var _0x2e71d1=this;return new Promise(function(_0x192b56,_0x2dd741){return db[_0x4ad1('0x1c')][_0x4ad1('0x1d')]({'raw':_0x30c35e['options']?_0x30c35e[_0x4ad1('0x1e')][_0x4ad1('0x1f')]===undefined?!![]:![]:!![],'where':_0x30c35e['options']?_0x30c35e[_0x4ad1('0x1e')]['where']||null:null,'attributes':_0x30c35e[_0x4ad1('0x1e')]?_0x30c35e[_0x4ad1('0x1e')][_0x4ad1('0x20')]||null:null,'limit':_0x30c35e[_0x4ad1('0x1e')]?_0x30c35e[_0x4ad1('0x1e')]['limit']||null:null,'include':_0x30c35e['options']?_0x30c35e[_0x4ad1('0x1e')][_0x4ad1('0x21')]?_[_0x4ad1('0x22')](_0x30c35e['options'][_0x4ad1('0x21')],function(_0xfcc65){return{'model':db[_0xfcc65[_0x4ad1('0x23')]],'as':_0xfcc65['as'],'attributes':_0xfcc65[_0x4ad1('0x20')],'include':_0xfcc65[_0x4ad1('0x21')]?_[_0x4ad1('0x22')](_0xfcc65[_0x4ad1('0x21')],function(_0xf31d3a){return{'model':db[_0xf31d3a[_0x4ad1('0x23')]],'as':_0xf31d3a['as'],'attributes':_0xf31d3a[_0x4ad1('0x20')],'include':_0xf31d3a[_0x4ad1('0x21')]?_[_0x4ad1('0x22')](_0xf31d3a[_0x4ad1('0x21')],function(_0x3395e7){return{'model':db[_0x3395e7[_0x4ad1('0x23')]],'as':_0x3395e7['as'],'attributes':_0x3395e7[_0x4ad1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4ad1('0x10')](function(_0x372646){logger[_0x4ad1('0x11')]('GetFaxAccount',_0x30c35e);logger[_0x4ad1('0x24')](_0x4ad1('0x1b'),_0x30c35e,JSON[_0x4ad1('0x15')](_0x372646));_0x192b56(_0x372646);})[_0x4ad1('0x1a')](function(_0xb0b496){logger['error']('GetFaxAccount',_0xb0b496['message'],_0x30c35e);_0x2dd741(_0x2e71d1['error'](0x1f4,_0xb0b496[_0x4ad1('0x18')]));});});};exports[_0x4ad1('0x25')]=function(_0x72bc47,_0xa5cf73,_0x49c012){var _0x4ca7d1=this;return new Promise(function(_0x447504,_0x43299d){var _0x5504b4={'body':_0x72bc47[_0x4ad1('0x26')],'channel':'fax'};var _0x1d2c03=[];var _0x49dae0=[];var _0x3d826a={};return db[_0x4ad1('0x27')][_0x4ad1('0x28')]()[_0x4ad1('0x10')](function(_0x96bf92){if(!_0x96bf92){throw new db['Sequelize'][(_0x4ad1('0x29'))](_0x4ad1('0x2a'));}_0x1d2c03=_[_0x4ad1('0x2b')](_[_0x4ad1('0x2c')](_0x96bf92),[_0x4ad1('0x2d'),_0x4ad1('0x2e')]);_0x49dae0=_[_0x4ad1('0x2b')](_[_0x4ad1('0x2c')](_0x96bf92),[_0x4ad1('0x2d'),'updatedAt',_0x4ad1('0x2f'),_0x4ad1('0x30')]);if(_0x72bc47[_0x4ad1('0x26')]['id']){delete _0x72bc47[_0x4ad1('0x26')]['id'];}if(_[_0x4ad1('0x31')](_0x72bc47[_0x4ad1('0x26')][_0x4ad1('0x32')])){throw new db[(_0x4ad1('0x33'))][(_0x4ad1('0x29'))](_0x4ad1('0x34'));}if(_[_0x4ad1('0x31')](_0x72bc47[_0x4ad1('0x26')][_0x4ad1('0x26')])||_0x72bc47[_0x4ad1('0x26')][_0x4ad1('0x26')]===''){throw new db[(_0x4ad1('0x33'))][(_0x4ad1('0x29'))](_0x4ad1('0x35'));}if(_[_0x4ad1('0x31')](_0x72bc47[_0x4ad1('0x26')][_0x4ad1('0x36')])){throw new db[(_0x4ad1('0x33'))][(_0x4ad1('0x29'))](_0x4ad1('0x37')+_0x49dae0);}if(!_[_0x4ad1('0x38')](_0x49dae0,_0x72bc47[_0x4ad1('0x26')][_0x4ad1('0x36')])){throw new db[(_0x4ad1('0x33'))][(_0x4ad1('0x29'))](_0x4ad1('0x39')+_0x49dae0);}_0x3d826a[_0x72bc47[_0x4ad1('0x26')][_0x4ad1('0x36')]]=_0x72bc47[_0x4ad1('0x26')][_0x4ad1('0x32')];})[_0x4ad1('0x10')](function(){return db['FaxAccount']['find']({'where':{'id':_0x72bc47[_0x4ad1('0x3a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x3d826a,'limit':0x1,'order':[[_0x4ad1('0x2e'),_0x4ad1('0x3b')]]}]},{'model':db[_0x4ad1('0x3c')],'as':'Applications'}]});})[_0x4ad1('0x10')](function(_0x33e596){if(_0x33e596&&_0x33e596[_0x4ad1('0x3d')]){var _0x3895e5=_0x33e596[_0x4ad1('0x3e')]({'plain':!![]});_0x5504b4[_0x4ad1('0x3a')]=_0x3895e5;_0x5504b4[_0x4ad1('0x3f')]=_0x3895e5[_0x4ad1('0x40')];_0x5504b4[_0x4ad1('0x41')]=_0x3895e5[_0x4ad1('0x3d')];_0x5504b4[_0x4ad1('0x3f')]=_[_0x4ad1('0x42')](_0x5504b4['applications'],['priority'],[_0x4ad1('0x43')]);if(_0x5504b4['account'][_0x4ad1('0x40')]){delete _0x5504b4['account']['Applications'];}if(_0x5504b4[_0x4ad1('0x3a')][_0x4ad1('0x3d')]&&_0x5504b4['account'][_0x4ad1('0x3d')][_0x4ad1('0x44')]['length']){return _0x5504b4[_0x4ad1('0x3a')][_0x4ad1('0x3d')][_0x4ad1('0x44')][0x0];}var _0x273306=_['defaults'](_0x72bc47['body'],{'firstName':_0x72bc47['body'][_0x4ad1('0x32')],'ListId':_0x3895e5['ListId']});_0x273306[_0x72bc47[_0x4ad1('0x26')][_0x4ad1('0x36')]]=_0x72bc47[_0x4ad1('0x26')][_0x4ad1('0x32')];return db[_0x4ad1('0x27')][_0x4ad1('0x45')](_0x273306,{'fields':_0x1d2c03,'raw':!![]});}})[_0x4ad1('0x10')](function(_0x462420){_0x5504b4['contact']=_0x462420;if(_0x462420){var _0x1183c2={'ContactId':_0x462420['id'],'FaxAccountId':_0x72bc47[_0x4ad1('0x3a')]['id'],'fax':_0x462420['fax']};return db[_0x4ad1('0x46')][_0x4ad1('0x47')]({'where':{'ContactId':_0x462420['id'],'closed':![],'FaxAccountId':_0x72bc47['account']['id']}})[_0x4ad1('0x10')](function(_0x1714ab){if(_0x1714ab){return[_0x1714ab,![]];}return db[_0x4ad1('0x46')][_0x4ad1('0x45')](_0x1183c2)['then'](function(_0x204e14){return[_0x204e14,!![]];});});}else{throw new Error(_0x4ad1('0x48'));}})[_0x4ad1('0x49')](function(_0xcacd2d,_0x4efbab){var _0x417636=_0xcacd2d[_0x4ad1('0x3e')]({'plain':!![]});if(_0x4efbab){if(_0x5504b4['account']['autoclose']){_0x5504b4[_0x4ad1('0x3f')][_0x4ad1('0x4a')]({'id':0x0,'priority':_0x5504b4[_0x4ad1('0x3f')]['length']+0x1,'app':_0x4ad1('0x4b'),'appdata':_0x4ad1('0x4c'),'interval':_0x4ad1('0x4d')});}_0x417636[_0x4ad1('0x4e')]=!![];}else{_0x417636[_0x4ad1('0x4e')]=![];}_0x5504b4[_0x4ad1('0x4f')]=_0x417636;return db['FaxMessage'][_0x4ad1('0x45')]({'body':_0x72bc47['body']['body'],'FaxAccountId':_0x72bc47[_0x4ad1('0x3a')]['id'],'FaxInteractionId':_0xcacd2d['id'],'direction':'in','ContactId':_0xcacd2d[_0x4ad1('0x50')],'AttachmentId':_0x72bc47[_0x4ad1('0x26')][_0x4ad1('0x51')]});})[_0x4ad1('0x10')](function(_0xc8367a){_0x5504b4[_0x4ad1('0x18')]=_0xc8367a;if(_0x5504b4['interaction'][_0x4ad1('0x52')]){return db[_0x4ad1('0x53')]['find']({'attributes':['id',_0x4ad1('0x54')],'where':{'id':_0x5504b4['interaction'][_0x4ad1('0x52')]}})[_0x4ad1('0x10')](function(_0x168a61){if(_0x168a61){_0x5504b4[_0x4ad1('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x4ad1('0x55'),'appdata':_0x168a61['name']+','+(_0x5504b4['account'][_0x4ad1('0x56')]||0xa),'interval':_0x4ad1('0x4d')});}return respondWithRpcPromise(_0x4ad1('0x57'),'startRouting',_0x5504b4);});}return respondWithRpcPromise(_0x4ad1('0x57'),'startRouting',_0x5504b4);})[_0x4ad1('0x10')](function(_0x4aa885){_0x447504(_0x4aa885);})[_0x4ad1('0x1a')](function(_0x7a9f16){_0x43299d(_0x4ca7d1[_0x4ad1('0x16')](0x1f4,_0x7a9f16[_0x4ad1('0x18')]));});});}; \ No newline at end of file +var _0x0ea2=['CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','applications','list','orderBy','priority','length','create','FaxInteraction','get','autoclose','push','close','unmanaged','*,*,*,*','created','AttachmentId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','GetFaxAccount','FaxAccount','findAll','options','attributes','limit','map','include','model','then','NotifyFaxAccount','body','fax','describe','ValidationError','difference','keys','createdAt','updatedAt','ListId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','from','find','account'];(function(_0x5990f8,_0x3dd2f7){var _0x1acc40=function(_0x434272){while(--_0x434272){_0x5990f8['push'](_0x5990f8['shift']());}};_0x1acc40(++_0x3dd2f7);}(_0x0ea2,0x1cd));var _0x20ea=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x0ea2[_0x30f07a];return _0xb38461;};'use strict';var _=require(_0x20ea('0x0'));var util=require(_0x20ea('0x1'));var moment=require(_0x20ea('0x2'));var BPromise=require('bluebird');var rs=require(_0x20ea('0x3'));var fs=require('fs');var Redis=require(_0x20ea('0x4'));var db=require(_0x20ea('0x5'))['db'];var utils=require(_0x20ea('0x6'));var logger=require(_0x20ea('0x7'))('rpc');var config=require(_0x20ea('0x8'));var jayson=require(_0x20ea('0x9'));var client=jayson['client']['http']({'port':0x232c});config['redis']=_[_0x20ea('0xa')](config[_0x20ea('0xb')],{'host':_0x20ea('0xc'),'port':0x18eb});var socket=require(_0x20ea('0xd'))(new Redis(config[_0x20ea('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3b4b9e,_0x54ce09,_0xeb066c){return new BPromise(function(_0x4a361e,_0xddf264){return client['request'](_0x3b4b9e,_0xeb066c)['then'](function(_0x348079){logger['info'](_0x20ea('0xe'),_0x54ce09,'request\x20sent');logger[_0x20ea('0xf')](_0x20ea('0x10'),_0x54ce09,'request\x20sent',JSON[_0x20ea('0x11')](_0x348079));if(_0x348079[_0x20ea('0x12')]){if(_0x348079[_0x20ea('0x12')][_0x20ea('0x13')]===0x1f4){logger[_0x20ea('0x12')](_0x20ea('0xe'),_0x54ce09,_0x348079[_0x20ea('0x12')][_0x20ea('0x14')]);return _0xddf264(_0x348079[_0x20ea('0x12')][_0x20ea('0x14')]);}logger[_0x20ea('0x12')](_0x20ea('0xe'),_0x54ce09,_0x348079[_0x20ea('0x12')][_0x20ea('0x14')]);return _0x4a361e(_0x348079[_0x20ea('0x12')][_0x20ea('0x14')]);}else{logger[_0x20ea('0x15')](_0x20ea('0xe'),_0x54ce09,_0x20ea('0x16'));_0x4a361e(_0x348079[_0x20ea('0x17')][_0x20ea('0x14')]);}})[_0x20ea('0x18')](function(_0x15bd27){logger[_0x20ea('0x12')](_0x20ea('0xe'),_0x54ce09,_0x15bd27);_0xddf264(_0x15bd27);});});}exports[_0x20ea('0x19')]=function(_0x2cd496){var _0x173f73=this;return new Promise(function(_0x1f0a47,_0x22e976){return db[_0x20ea('0x1a')][_0x20ea('0x1b')]({'raw':_0x2cd496[_0x20ea('0x1c')]?_0x2cd496[_0x20ea('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2cd496[_0x20ea('0x1c')]?_0x2cd496[_0x20ea('0x1c')]['where']||null:null,'attributes':_0x2cd496[_0x20ea('0x1c')]?_0x2cd496[_0x20ea('0x1c')][_0x20ea('0x1d')]||null:null,'limit':_0x2cd496[_0x20ea('0x1c')]?_0x2cd496[_0x20ea('0x1c')][_0x20ea('0x1e')]||null:null,'include':_0x2cd496[_0x20ea('0x1c')]?_0x2cd496['options']['include']?_[_0x20ea('0x1f')](_0x2cd496[_0x20ea('0x1c')][_0x20ea('0x20')],function(_0x1d7343){return{'model':db[_0x1d7343['model']],'as':_0x1d7343['as'],'attributes':_0x1d7343[_0x20ea('0x1d')],'include':_0x1d7343[_0x20ea('0x20')]?_[_0x20ea('0x1f')](_0x1d7343[_0x20ea('0x20')],function(_0x1ad69a){return{'model':db[_0x1ad69a[_0x20ea('0x21')]],'as':_0x1ad69a['as'],'attributes':_0x1ad69a['attributes'],'include':_0x1ad69a[_0x20ea('0x20')]?_[_0x20ea('0x1f')](_0x1ad69a['include'],function(_0x2497f5){return{'model':db[_0x2497f5[_0x20ea('0x21')]],'as':_0x2497f5['as'],'attributes':_0x2497f5['attributes']};}):[]};}):[]};}):[]:[]})[_0x20ea('0x22')](function(_0x56575c){logger[_0x20ea('0x15')](_0x20ea('0x19'),_0x2cd496);logger[_0x20ea('0xf')](_0x20ea('0x19'),_0x2cd496,JSON[_0x20ea('0x11')](_0x56575c));_0x1f0a47(_0x56575c);})[_0x20ea('0x18')](function(_0x17982b){logger[_0x20ea('0x12')](_0x20ea('0x19'),_0x17982b[_0x20ea('0x14')],_0x2cd496);_0x22e976(_0x173f73[_0x20ea('0x12')](0x1f4,_0x17982b[_0x20ea('0x14')]));});});};exports[_0x20ea('0x23')]=function(_0x3b0fcf,_0x3c7743,_0x565a43){var _0x2c8296=this;return new Promise(function(_0x377569,_0x3b8c60){var _0x1619cf={'body':_0x3b0fcf[_0x20ea('0x24')],'channel':_0x20ea('0x25')};var _0x545078=[];var _0x4ea154=[];var _0x4bdced={};return db['CmContact'][_0x20ea('0x26')]()['then'](function(_0x3ff2f5){if(!_0x3ff2f5){throw new db['Sequelize'][(_0x20ea('0x27'))]('no\x20available\x20attributes');}_0x545078=_[_0x20ea('0x28')](_['keys'](_0x3ff2f5),['createdAt','updatedAt']);_0x4ea154=_[_0x20ea('0x28')](_[_0x20ea('0x29')](_0x3ff2f5),[_0x20ea('0x2a'),_0x20ea('0x2b'),'CompanyId',_0x20ea('0x2c')]);if(_0x3b0fcf['body']['id']){delete _0x3b0fcf['body']['id'];}if(_[_0x20ea('0x2d')](_0x3b0fcf[_0x20ea('0x24')]['from'])){throw new db[(_0x20ea('0x2e'))][(_0x20ea('0x27'))](_0x20ea('0x2f'));}if(_[_0x20ea('0x2d')](_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x24')])||_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x24')]===''){throw new db[(_0x20ea('0x2e'))][(_0x20ea('0x27'))](_0x20ea('0x30'));}if(_['isNil'](_0x3b0fcf[_0x20ea('0x24')]['mapKey'])){throw new db['Sequelize'][(_0x20ea('0x27'))](_0x20ea('0x31')+_0x4ea154);}if(!_[_0x20ea('0x32')](_0x4ea154,_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x33')])){throw new db[(_0x20ea('0x2e'))][(_0x20ea('0x27'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ea154);}_0x4bdced[_0x3b0fcf[_0x20ea('0x24')]['mapKey']]=_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x34')];})[_0x20ea('0x22')](function(){return db[_0x20ea('0x1a')][_0x20ea('0x35')]({'where':{'id':_0x3b0fcf[_0x20ea('0x36')]['id']},'include':[{'model':db[_0x20ea('0x37')],'as':_0x20ea('0x38'),'include':[{'model':db[_0x20ea('0x39')],'as':_0x20ea('0x3a'),'where':_0x4bdced,'limit':0x1,'order':[['updatedAt',_0x20ea('0x3b')]]}]},{'model':db[_0x20ea('0x3c')],'as':_0x20ea('0x3d')}]});})['then'](function(_0x790d83){if(_0x790d83&&_0x790d83[_0x20ea('0x38')]){var _0x2677a2=_0x790d83['get']({'plain':!![]});_0x1619cf[_0x20ea('0x36')]=_0x2677a2;_0x1619cf[_0x20ea('0x3e')]=_0x2677a2['Applications'];_0x1619cf[_0x20ea('0x3f')]=_0x2677a2[_0x20ea('0x38')];_0x1619cf[_0x20ea('0x3e')]=_[_0x20ea('0x40')](_0x1619cf[_0x20ea('0x3e')],[_0x20ea('0x41')],['asc']);if(_0x1619cf[_0x20ea('0x36')][_0x20ea('0x3d')]){delete _0x1619cf['account'][_0x20ea('0x3d')];}if(_0x1619cf[_0x20ea('0x36')]['List']&&_0x1619cf[_0x20ea('0x36')][_0x20ea('0x38')][_0x20ea('0x3a')][_0x20ea('0x42')]){return _0x1619cf['account'][_0x20ea('0x38')]['Contacts'][0x0];}var _0x592587=_['defaults'](_0x3b0fcf[_0x20ea('0x24')],{'firstName':_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x34')],'ListId':_0x2677a2[_0x20ea('0x2c')]});_0x592587[_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x33')]]=_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x34')];return db['CmContact'][_0x20ea('0x43')](_0x592587,{'fields':_0x545078,'raw':!![]});}})[_0x20ea('0x22')](function(_0x1bbab9){_0x1619cf['contact']=_0x1bbab9;if(_0x1bbab9){var _0x3775c1={'ContactId':_0x1bbab9['id'],'FaxAccountId':_0x3b0fcf['account']['id'],'fax':_0x1bbab9[_0x20ea('0x25')]};return db[_0x20ea('0x44')][_0x20ea('0x35')]({'where':{'ContactId':_0x1bbab9['id'],'closed':![],'FaxAccountId':_0x3b0fcf[_0x20ea('0x36')]['id']}})['then'](function(_0x3ab74e){if(_0x3ab74e){return[_0x3ab74e,![]];}return db['FaxInteraction'][_0x20ea('0x43')](_0x3775c1)[_0x20ea('0x22')](function(_0x47ae01){return[_0x47ae01,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x23c46f,_0xc4e593){var _0x397ebe=_0x23c46f[_0x20ea('0x45')]({'plain':!![]});if(_0xc4e593){if(_0x1619cf[_0x20ea('0x36')][_0x20ea('0x46')]){_0x1619cf[_0x20ea('0x3e')][_0x20ea('0x47')]({'id':0x0,'priority':_0x1619cf[_0x20ea('0x3e')][_0x20ea('0x42')]+0x1,'app':_0x20ea('0x48'),'appdata':_0x20ea('0x49'),'interval':_0x20ea('0x4a')});}_0x397ebe[_0x20ea('0x4b')]=!![];}else{_0x397ebe[_0x20ea('0x4b')]=![];}_0x1619cf['interaction']=_0x397ebe;return db['FaxMessage'][_0x20ea('0x43')]({'body':_0x3b0fcf[_0x20ea('0x24')][_0x20ea('0x24')],'FaxAccountId':_0x3b0fcf['account']['id'],'FaxInteractionId':_0x23c46f['id'],'direction':'in','ContactId':_0x23c46f['ContactId'],'AttachmentId':_0x3b0fcf['body'][_0x20ea('0x4c')]});})[_0x20ea('0x22')](function(_0x1cba5e){_0x1619cf[_0x20ea('0x14')]=_0x1cba5e;if(_0x1619cf[_0x20ea('0x4d')][_0x20ea('0x4e')]){return db[_0x20ea('0x4f')]['find']({'attributes':['id',_0x20ea('0x50')],'where':{'id':_0x1619cf[_0x20ea('0x4d')][_0x20ea('0x4e')]}})[_0x20ea('0x22')](function(_0x21280d){if(_0x21280d){_0x1619cf[_0x20ea('0x3e')][_0x20ea('0x51')]({'id':0x0,'priority':0x0,'app':_0x20ea('0x52'),'appdata':_0x21280d['name']+','+(_0x1619cf[_0x20ea('0x36')][_0x20ea('0x53')]||0xa),'interval':_0x20ea('0x4a')});}return respondWithRpcPromise('Start',_0x20ea('0x54'),_0x1619cf);});}return respondWithRpcPromise(_0x20ea('0x55'),_0x20ea('0x54'),_0x1619cf);})['then'](function(_0x1f6abb){_0x377569(_0x1f6abb);})[_0x20ea('0x18')](function(_0x21d199){_0x3b8c60(_0x2c8296[_0x20ea('0x12')](0x1f4,_0x21d199[_0x20ea('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 7239044..beed556 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 _0x2c6c=['emit','removeListener','faxAccount:','./faxAccount.events','save','update'];(function(_0x5a556a,_0x39b261){var _0x3f6dd5=function(_0x10c23b){while(--_0x10c23b){_0x5a556a['push'](_0x5a556a['shift']());}};_0x3f6dd5(++_0x39b261);}(_0x2c6c,0x159));var _0xc2c6=function(_0x1adda4,_0x3998fb){_0x1adda4=_0x1adda4-0x0;var _0x115486=_0x2c6c[_0x1adda4];return _0x115486;};'use strict';var FaxAccountEvents=require(_0xc2c6('0x0'));var events=[_0xc2c6('0x1'),'remove',_0xc2c6('0x2')];function createListener(_0x2c8032,_0xf1691f){return function(_0x3939eb){_0xf1691f[_0xc2c6('0x3')](_0x2c8032,_0x3939eb);};}function removeListener(_0x2321e3,_0x3461b2){return function(){FaxAccountEvents[_0xc2c6('0x4')](_0x2321e3,_0x3461b2);};}exports['register']=function(_0x39ed57){for(var _0x42684f=0x0,_0xb2b83c=events['length'];_0x42684f<_0xb2b83c;_0x42684f++){var _0x2fdd4f=events[_0x42684f];var _0x188d01=createListener(_0xc2c6('0x5')+_0x2fdd4f,_0x39ed57);FaxAccountEvents['on'](_0x2fdd4f,_0x188d01);}}; \ No newline at end of file +var _0x45de=['remove','removeListener','register','length','faxAccount:','save'];(function(_0x442b4a,_0x5a8588){var _0x45a995=function(_0x5bacf1){while(--_0x5bacf1){_0x442b4a['push'](_0x442b4a['shift']());}};_0x45a995(++_0x5a8588);}(_0x45de,0x1a3));var _0xe45d=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x45de[_0x1694f5];return _0x5b4321;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xe45d('0x0'),_0xe45d('0x1'),'update'];function createListener(_0x151061,_0x14305e){return function(_0x41c23a){_0x14305e['emit'](_0x151061,_0x41c23a);};}function removeListener(_0x12bc47,_0x3b65b9){return function(){FaxAccountEvents[_0xe45d('0x2')](_0x12bc47,_0x3b65b9);};}exports[_0xe45d('0x3')]=function(_0x5ba1a7){for(var _0x14179c=0x0,_0x2eb45e=events[_0xe45d('0x4')];_0x14179c<_0x2eb45e;_0x14179c++){var _0x4b1944=events[_0x14179c];var _0x29c029=createListener(_0xe45d('0x5')+_0x4b1944,_0x5ba1a7);FaxAccountEvents['on'](_0x4b1944,_0x29c029);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6a9e3b4..ef4f4ed 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x151144,_0xa664db){var _0x2526ef=function(_0x99baa6){while(--_0x99baa6){_0x151144['push'](_0x151144['shift']());}};_0x2526ef(++_0xa664db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x3b74d1,_0x478b4b){var _0xdf01d6=function(_0x8b09a0){while(--_0x8b09a0){_0x3b74d1['push'](_0x3b74d1['shift']());}};_0xdf01d6(++_0x478b4b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index aaa28a0..24d157e 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 _0xc0eb=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3ae25b,_0x84fc3c){var _0x5ddabd=function(_0xa45504){while(--_0xa45504){_0x3ae25b['push'](_0x3ae25b['shift']());}};_0x5ddabd(++_0x84fc3c);}(_0xc0eb,0x169));var _0xbc0e=function(_0xbf414,_0x150f82){_0xbf414=_0xbf414-0x0;var _0x388768=_0xc0eb[_0xbf414];return _0x388768;};'use strict';var Sequelize=require(_0xbc0e('0x0'));module[_0xbc0e('0x1')]={'priority':{'type':Sequelize[_0xbc0e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbc0e('0x3')],'allowNull':![],'defaultValue':_0xbc0e('0x4')},'appdata':{'type':Sequelize[_0xbc0e('0x5')]()},'description':{'type':Sequelize[_0xbc0e('0x3')]},'interval':{'type':Sequelize[_0xbc0e('0x3')],'defaultValue':_0xbc0e('0x6')}}; \ No newline at end of file +var _0x8257=['noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x3177d9,_0x557123){var _0xdc6884=function(_0x40ea5f){while(--_0x40ea5f){_0x3177d9['push'](_0x3177d9['shift']());}};_0xdc6884(++_0x557123);}(_0x8257,0xda));var _0x7825=function(_0x205e5a,_0x5c19fb){_0x205e5a=_0x205e5a-0x0;var _0x10da58=_0x8257[_0x205e5a];return _0x10da58;};'use strict';var Sequelize=require(_0x7825('0x0'));module[_0x7825('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7825('0x2')},'appdata':{'type':Sequelize[_0x7825('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7825('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 976acde..0b02b27 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 _0x2682=['send','map','FaxApplication','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','merge','filter','options','include','findAll','rows','catch','params','rawAttributes','keys','includeAll','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','update','destroy','then','sendStatus','error','stack','name'];(function(_0x690188,_0x38c55d){var _0x3d3e52=function(_0x4386b1){while(--_0x4386b1){_0x690188['push'](_0x690188['shift']());}};_0x3d3e52(++_0x38c55d);}(_0x2682,0x1ea));var _0x2268=function(_0x3aed75,_0x3f7844){_0x3aed75=_0x3aed75-0x0;var _0x438e3b=_0x2682[_0x3aed75];return _0x438e3b;};'use strict';var emlformat=require(_0x2268('0x0'));var rimraf=require(_0x2268('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2268('0x2'));var rp=require(_0x2268('0x3'));var moment=require('moment');var BPromise=require(_0x2268('0x4'));var Mustache=require(_0x2268('0x5'));var util=require(_0x2268('0x6'));var path=require(_0x2268('0x7'));var sox=require('sox');var csv=require(_0x2268('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2268('0x9'));var _=require(_0x2268('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2268('0xb'));var deskjs=require(_0x2268('0xc'));var toCsv=require(_0x2268('0x8'));var querystring=require(_0x2268('0xd'));var Papa=require(_0x2268('0xe'));var Redis=require('ioredis');var authService=require(_0x2268('0xf'));var qs=require(_0x2268('0x10'));var as=require(_0x2268('0x11'));var hardwareService=require(_0x2268('0x12'));var logger=require('../../config/logger')(_0x2268('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2268('0x14'));var db=require(_0x2268('0x15'))['db'];function respondWithStatusCode(_0x1fd634,_0x442683){_0x442683=_0x442683||0xcc;return function(_0x518700){if(_0x518700){return _0x1fd634['sendStatus'](_0x442683);}return _0x1fd634[_0x2268('0x16')](_0x442683)[_0x2268('0x17')]();};}function respondWithResult(_0x5f290b,_0x473e67){_0x473e67=_0x473e67||0xc8;return function(_0x532fbb){if(_0x532fbb){return _0x5f290b[_0x2268('0x16')](_0x473e67)[_0x2268('0x18')](_0x532fbb);}};}function respondWithFilteredResult(_0x5de9de,_0xc17d09){return function(_0x357b86){if(_0x357b86){var _0x1d5843=typeof _0xc17d09[_0x2268('0x19')]===_0x2268('0x1a')&&typeof _0xc17d09['limit']===_0x2268('0x1a');var _0x558bfe=_0x357b86['count'];var _0x5bcc1a=_0x1d5843?0x0:_0xc17d09[_0x2268('0x19')];var _0x24ed25=_0x1d5843?_0x357b86[_0x2268('0x1b')]:_0xc17d09['offset']+_0xc17d09[_0x2268('0x1c')];var _0xf23d02;if(_0x24ed25>=_0x558bfe){_0x24ed25=_0x558bfe;_0xf23d02=0xc8;}else{_0xf23d02=0xce;}_0x5de9de['status'](_0xf23d02);return _0x5de9de[_0x2268('0x1d')]('Content-Range',_0x5bcc1a+'-'+_0x24ed25+'/'+_0x558bfe)[_0x2268('0x18')](_0x357b86);}return null;};}function patchUpdates(_0x19c1b0){return function(_0x3a52b1){try{jsonpatch[_0x2268('0x1e')](_0x3a52b1,_0x19c1b0,!![]);}catch(_0x424129){return BPromise['reject'](_0x424129);}return _0x3a52b1['save']();};}function saveUpdates(_0x54474f,_0xbedf70){return function(_0x237096){if(_0x237096){return _0x237096[_0x2268('0x1f')](_0x54474f)['then'](function(_0x3f1f9d){return _0x3f1f9d;});}return null;};}function removeEntity(_0xb22caa,_0x534ba7){return function(_0x5f3001){if(_0x5f3001){return _0x5f3001[_0x2268('0x20')]()[_0x2268('0x21')](function(){_0xb22caa[_0x2268('0x16')](0xcc)[_0x2268('0x17')]();});}};}function handleEntityNotFound(_0x4ad51c,_0x364e66){return function(_0x5eac2a){if(!_0x5eac2a){_0x4ad51c[_0x2268('0x22')](0x194);}return _0x5eac2a;};}function handleError(_0x17ec7e,_0x3a6bcf){_0x3a6bcf=_0x3a6bcf||0x1f4;return function(_0x9e7120){logger[_0x2268('0x23')](_0x9e7120[_0x2268('0x24')]);if(_0x9e7120[_0x2268('0x25')]){delete _0x9e7120[_0x2268('0x25')];}_0x17ec7e[_0x2268('0x16')](_0x3a6bcf)[_0x2268('0x26')](_0x9e7120);};}exports['index']=function(_0x3663c8,_0x26d6cd){var _0x3feaf1={},_0x436c0a={},_0x2b08bf={'count':0x0,'rows':[]};var _0x3e72b6=_[_0x2268('0x27')](db[_0x2268('0x28')]['rawAttributes'],function(_0x43e20e){return{'name':_0x43e20e[_0x2268('0x29')],'type':_0x43e20e[_0x2268('0x2a')]['key']};});_0x436c0a[_0x2268('0x2b')]=_[_0x2268('0x27')](_0x3e72b6,_0x2268('0x25'));_0x436c0a[_0x2268('0x2c')]=_['keys'](_0x3663c8[_0x2268('0x2c')]);_0x436c0a[_0x2268('0x2d')]=_[_0x2268('0x2e')](_0x436c0a[_0x2268('0x2b')],_0x436c0a[_0x2268('0x2c')]);_0x3feaf1[_0x2268('0x2f')]=_[_0x2268('0x2e')](_0x436c0a[_0x2268('0x2b')],qs['fields'](_0x3663c8[_0x2268('0x2c')][_0x2268('0x30')]));_0x3feaf1[_0x2268('0x2f')]=_0x3feaf1['attributes']['length']?_0x3feaf1['attributes']:_0x436c0a[_0x2268('0x2b')];if(!_0x3663c8[_0x2268('0x2c')][_0x2268('0x31')]('nolimit')){_0x3feaf1[_0x2268('0x1c')]=qs[_0x2268('0x1c')](_0x3663c8[_0x2268('0x2c')]['limit']);_0x3feaf1[_0x2268('0x19')]=qs[_0x2268('0x19')](_0x3663c8[_0x2268('0x2c')][_0x2268('0x19')]);}_0x3feaf1[_0x2268('0x32')]=qs['sort'](_0x3663c8[_0x2268('0x2c')]['sort']);_0x3feaf1[_0x2268('0x33')]=qs[_0x2268('0x2d')](_['pick'](_0x3663c8[_0x2268('0x2c')],_0x436c0a[_0x2268('0x2d')]),_0x3e72b6);if(_0x3663c8['query']['filter']){_0x3feaf1[_0x2268('0x33')]=_[_0x2268('0x34')](_0x3feaf1[_0x2268('0x33')],{'$or':_['map'](_0x3e72b6,function(_0x2e2e89){if(_0x2e2e89[_0x2268('0x2a')]!=='VIRTUAL'){var _0x28ecee={};_0x28ecee[_0x2e2e89['name']]={'$like':'%'+_0x3663c8['query'][_0x2268('0x35')]+'%'};return _0x28ecee;}})});}_0x3feaf1=_[_0x2268('0x34')]({},_0x3feaf1,_0x3663c8[_0x2268('0x36')]);var _0x4efe32={'where':_0x3feaf1[_0x2268('0x33')]};return db[_0x2268('0x28')][_0x2268('0x1b')](_0x4efe32)[_0x2268('0x21')](function(_0x5d7514){_0x2b08bf[_0x2268('0x1b')]=_0x5d7514;if(_0x3663c8[_0x2268('0x2c')]['includeAll']){_0x3feaf1[_0x2268('0x37')]=[{'all':!![]}];}return db[_0x2268('0x28')][_0x2268('0x38')](_0x3feaf1);})[_0x2268('0x21')](function(_0x3b5a96){_0x2b08bf[_0x2268('0x39')]=_0x3b5a96;return _0x2b08bf;})[_0x2268('0x21')](respondWithFilteredResult(_0x26d6cd,_0x3feaf1))[_0x2268('0x3a')](handleError(_0x26d6cd,null));};exports['show']=function(_0x117d04,_0x342a0e){var _0x11a3bd={'raw':!![],'where':{'id':_0x117d04[_0x2268('0x3b')]['id']}},_0x16171f={};_0x16171f[_0x2268('0x2b')]=_['keys'](db[_0x2268('0x28')][_0x2268('0x3c')]);_0x16171f[_0x2268('0x2c')]=_[_0x2268('0x3d')](_0x117d04[_0x2268('0x2c')]);_0x16171f[_0x2268('0x2d')]=_[_0x2268('0x2e')](_0x16171f[_0x2268('0x2b')],_0x16171f[_0x2268('0x2c')]);_0x11a3bd[_0x2268('0x2f')]=_[_0x2268('0x2e')](_0x16171f[_0x2268('0x2b')],qs[_0x2268('0x30')](_0x117d04[_0x2268('0x2c')][_0x2268('0x30')]));_0x11a3bd[_0x2268('0x2f')]=_0x11a3bd[_0x2268('0x2f')]['length']?_0x11a3bd['attributes']:_0x16171f['model'];if(_0x117d04['query'][_0x2268('0x3e')]){_0x11a3bd[_0x2268('0x37')]=[{'all':!![]}];}_0x11a3bd=_['merge']({},_0x11a3bd,_0x117d04[_0x2268('0x36')]);return db[_0x2268('0x28')][_0x2268('0x3f')](_0x11a3bd)['then'](handleEntityNotFound(_0x342a0e,null))[_0x2268('0x21')](respondWithResult(_0x342a0e,null))[_0x2268('0x3a')](handleError(_0x342a0e,null));};exports[_0x2268('0x40')]=function(_0x50b278,_0x5f420c){return db[_0x2268('0x28')][_0x2268('0x40')](_0x50b278[_0x2268('0x41')],{})['then'](respondWithResult(_0x5f420c,0xc9))['catch'](handleError(_0x5f420c,null));};exports[_0x2268('0x1f')]=function(_0x239149,_0x446913){if(_0x239149[_0x2268('0x41')]['id']){delete _0x239149[_0x2268('0x41')]['id'];}return db['FaxApplication'][_0x2268('0x3f')]({'where':{'id':_0x239149[_0x2268('0x3b')]['id']}})[_0x2268('0x21')](handleEntityNotFound(_0x446913,null))[_0x2268('0x21')](saveUpdates(_0x239149['body'],null))['then'](respondWithResult(_0x446913,null))[_0x2268('0x3a')](handleError(_0x446913,null));};exports[_0x2268('0x20')]=function(_0x2de184,_0x1d5924){return db[_0x2268('0x28')][_0x2268('0x3f')]({'where':{'id':_0x2de184[_0x2268('0x3b')]['id']}})[_0x2268('0x21')](handleEntityNotFound(_0x1d5924,null))[_0x2268('0x21')](removeEntity(_0x1d5924,null))[_0x2268('0x3a')](handleError(_0x1d5924,null));}; \ No newline at end of file +var _0xab77=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','type','key','model','map','query'];(function(_0x31c042,_0x1db4d6){var _0x51f7ad=function(_0x4358d7){while(--_0x4358d7){_0x31c042['push'](_0x31c042['shift']());}};_0x51f7ad(++_0x1db4d6);}(_0xab77,0x18e));var _0x7ab7=function(_0x486338,_0x2ab3f9){_0x486338=_0x486338-0x0;var _0x4c8298=_0xab77[_0x486338];return _0x4c8298;};'use strict';var emlformat=require(_0x7ab7('0x0'));var rimraf=require(_0x7ab7('0x1'));var zipdir=require(_0x7ab7('0x2'));var jsonpatch=require(_0x7ab7('0x3'));var rp=require(_0x7ab7('0x4'));var moment=require(_0x7ab7('0x5'));var BPromise=require(_0x7ab7('0x6'));var Mustache=require(_0x7ab7('0x7'));var util=require(_0x7ab7('0x8'));var path=require(_0x7ab7('0x9'));var sox=require(_0x7ab7('0xa'));var csv=require('to-csv');var ejs=require(_0x7ab7('0xb'));var fs=require('fs');var fs_extra=require(_0x7ab7('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7ab7('0xd'));var jsforce=require(_0x7ab7('0xe'));var deskjs=require(_0x7ab7('0xf'));var toCsv=require(_0x7ab7('0x10'));var querystring=require('querystring');var Papa=require(_0x7ab7('0x11'));var Redis=require('ioredis');var authService=require(_0x7ab7('0x12'));var qs=require(_0x7ab7('0x13'));var as=require(_0x7ab7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x7ab7('0x15'));var config=require(_0x7ab7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7ab7('0x17'))['db'];function respondWithStatusCode(_0x1e1f4c,_0x5dab84){_0x5dab84=_0x5dab84||0xcc;return function(_0x579396){if(_0x579396){return _0x1e1f4c[_0x7ab7('0x18')](_0x5dab84);}return _0x1e1f4c[_0x7ab7('0x19')](_0x5dab84)[_0x7ab7('0x1a')]();};}function respondWithResult(_0x16e024,_0x32b07f){_0x32b07f=_0x32b07f||0xc8;return function(_0x3c1e23){if(_0x3c1e23){return _0x16e024[_0x7ab7('0x19')](_0x32b07f)['json'](_0x3c1e23);}};}function respondWithFilteredResult(_0x5d07fc,_0x5d55e5){return function(_0x1c1ee6){if(_0x1c1ee6){var _0x4f2c6c=typeof _0x5d55e5[_0x7ab7('0x1b')]===_0x7ab7('0x1c')&&typeof _0x5d55e5[_0x7ab7('0x1d')]===_0x7ab7('0x1c');var _0x306594=_0x1c1ee6['count'];var _0x4efa25=_0x4f2c6c?0x0:_0x5d55e5[_0x7ab7('0x1b')];var _0x1f52a0=_0x4f2c6c?_0x1c1ee6[_0x7ab7('0x1e')]:_0x5d55e5['offset']+_0x5d55e5['limit'];var _0x315586;if(_0x1f52a0>=_0x306594){_0x1f52a0=_0x306594;_0x315586=0xc8;}else{_0x315586=0xce;}_0x5d07fc[_0x7ab7('0x19')](_0x315586);return _0x5d07fc[_0x7ab7('0x1f')](_0x7ab7('0x20'),_0x4efa25+'-'+_0x1f52a0+'/'+_0x306594)[_0x7ab7('0x21')](_0x1c1ee6);}return null;};}function patchUpdates(_0x1faf11){return function(_0x4be921){try{jsonpatch[_0x7ab7('0x22')](_0x4be921,_0x1faf11,!![]);}catch(_0x5429a8){return BPromise[_0x7ab7('0x23')](_0x5429a8);}return _0x4be921[_0x7ab7('0x24')]();};}function saveUpdates(_0x543091,_0x23b1d9){return function(_0x5810c1){if(_0x5810c1){return _0x5810c1[_0x7ab7('0x25')](_0x543091)[_0x7ab7('0x26')](function(_0x6abfd1){return _0x6abfd1;});}return null;};}function removeEntity(_0xbe341b,_0x4b6be8){return function(_0x253a1d){if(_0x253a1d){return _0x253a1d[_0x7ab7('0x27')]()[_0x7ab7('0x26')](function(){_0xbe341b[_0x7ab7('0x19')](0xcc)[_0x7ab7('0x1a')]();});}};}function handleEntityNotFound(_0x15556b,_0x2f2d03){return function(_0x38a36b){if(!_0x38a36b){_0x15556b[_0x7ab7('0x18')](0x194);}return _0x38a36b;};}function handleError(_0x4db98f,_0x33b8d9){_0x33b8d9=_0x33b8d9||0x1f4;return function(_0x425116){logger[_0x7ab7('0x28')](_0x425116[_0x7ab7('0x29')]);if(_0x425116[_0x7ab7('0x2a')]){delete _0x425116['name'];}_0x4db98f['status'](_0x33b8d9)[_0x7ab7('0x2b')](_0x425116);};}exports[_0x7ab7('0x2c')]=function(_0x265934,_0x8a7aad){var _0xe12148={},_0x2aba6e={},_0x3d42b4={'count':0x0,'rows':[]};var _0x3c3d54=_['map'](db[_0x7ab7('0x2d')][_0x7ab7('0x2e')],function(_0x117b17){return{'name':_0x117b17['fieldName'],'type':_0x117b17[_0x7ab7('0x2f')][_0x7ab7('0x30')]};});_0x2aba6e[_0x7ab7('0x31')]=_[_0x7ab7('0x32')](_0x3c3d54,_0x7ab7('0x2a'));_0x2aba6e[_0x7ab7('0x33')]=_[_0x7ab7('0x34')](_0x265934[_0x7ab7('0x33')]);_0x2aba6e[_0x7ab7('0x35')]=_[_0x7ab7('0x36')](_0x2aba6e['model'],_0x2aba6e[_0x7ab7('0x33')]);_0xe12148[_0x7ab7('0x37')]=_[_0x7ab7('0x36')](_0x2aba6e[_0x7ab7('0x31')],qs[_0x7ab7('0x38')](_0x265934[_0x7ab7('0x33')][_0x7ab7('0x38')]));_0xe12148[_0x7ab7('0x37')]=_0xe12148['attributes'][_0x7ab7('0x39')]?_0xe12148[_0x7ab7('0x37')]:_0x2aba6e['model'];if(!_0x265934[_0x7ab7('0x33')][_0x7ab7('0x3a')]('nolimit')){_0xe12148['limit']=qs[_0x7ab7('0x1d')](_0x265934[_0x7ab7('0x33')]['limit']);_0xe12148['offset']=qs[_0x7ab7('0x1b')](_0x265934[_0x7ab7('0x33')][_0x7ab7('0x1b')]);}_0xe12148[_0x7ab7('0x3b')]=qs[_0x7ab7('0x3c')](_0x265934[_0x7ab7('0x33')][_0x7ab7('0x3c')]);_0xe12148[_0x7ab7('0x3d')]=qs[_0x7ab7('0x35')](_['pick'](_0x265934[_0x7ab7('0x33')],_0x2aba6e[_0x7ab7('0x35')]),_0x3c3d54);if(_0x265934[_0x7ab7('0x33')]['filter']){_0xe12148[_0x7ab7('0x3d')]=_[_0x7ab7('0x3e')](_0xe12148[_0x7ab7('0x3d')],{'$or':_['map'](_0x3c3d54,function(_0x51f14d){if(_0x51f14d['type']!=='VIRTUAL'){var _0x4ed123={};_0x4ed123[_0x51f14d['name']]={'$like':'%'+_0x265934[_0x7ab7('0x33')][_0x7ab7('0x3f')]+'%'};return _0x4ed123;}})});}_0xe12148=_[_0x7ab7('0x3e')]({},_0xe12148,_0x265934['options']);var _0x3bb0df={'where':_0xe12148[_0x7ab7('0x3d')]};return db[_0x7ab7('0x2d')][_0x7ab7('0x1e')](_0x3bb0df)[_0x7ab7('0x26')](function(_0x1227f1){_0x3d42b4[_0x7ab7('0x1e')]=_0x1227f1;if(_0x265934[_0x7ab7('0x33')]['includeAll']){_0xe12148[_0x7ab7('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0x7ab7('0x41')](_0xe12148);})['then'](function(_0x24550a){_0x3d42b4[_0x7ab7('0x42')]=_0x24550a;return _0x3d42b4;})[_0x7ab7('0x26')](respondWithFilteredResult(_0x8a7aad,_0xe12148))[_0x7ab7('0x43')](handleError(_0x8a7aad,null));};exports[_0x7ab7('0x44')]=function(_0x43d410,_0x6a07bc){var _0x43e876={'raw':!![],'where':{'id':_0x43d410[_0x7ab7('0x45')]['id']}},_0x1f47d7={};_0x1f47d7[_0x7ab7('0x31')]=_['keys'](db[_0x7ab7('0x2d')][_0x7ab7('0x2e')]);_0x1f47d7[_0x7ab7('0x33')]=_['keys'](_0x43d410[_0x7ab7('0x33')]);_0x1f47d7[_0x7ab7('0x35')]=_[_0x7ab7('0x36')](_0x1f47d7[_0x7ab7('0x31')],_0x1f47d7[_0x7ab7('0x33')]);_0x43e876[_0x7ab7('0x37')]=_['intersection'](_0x1f47d7[_0x7ab7('0x31')],qs[_0x7ab7('0x38')](_0x43d410['query'][_0x7ab7('0x38')]));_0x43e876[_0x7ab7('0x37')]=_0x43e876[_0x7ab7('0x37')][_0x7ab7('0x39')]?_0x43e876[_0x7ab7('0x37')]:_0x1f47d7[_0x7ab7('0x31')];if(_0x43d410[_0x7ab7('0x33')][_0x7ab7('0x46')]){_0x43e876[_0x7ab7('0x40')]=[{'all':!![]}];}_0x43e876=_[_0x7ab7('0x3e')]({},_0x43e876,_0x43d410[_0x7ab7('0x47')]);return db[_0x7ab7('0x2d')][_0x7ab7('0x48')](_0x43e876)[_0x7ab7('0x26')](handleEntityNotFound(_0x6a07bc,null))['then'](respondWithResult(_0x6a07bc,null))[_0x7ab7('0x43')](handleError(_0x6a07bc,null));};exports[_0x7ab7('0x49')]=function(_0x3a28f0,_0x57e706){return db['FaxApplication'][_0x7ab7('0x49')](_0x3a28f0[_0x7ab7('0x4a')],{})[_0x7ab7('0x26')](respondWithResult(_0x57e706,0xc9))['catch'](handleError(_0x57e706,null));};exports[_0x7ab7('0x25')]=function(_0x4fc7b7,_0x1e597d){if(_0x4fc7b7[_0x7ab7('0x4a')]['id']){delete _0x4fc7b7['body']['id'];}return db[_0x7ab7('0x2d')]['find']({'where':{'id':_0x4fc7b7[_0x7ab7('0x45')]['id']}})[_0x7ab7('0x26')](handleEntityNotFound(_0x1e597d,null))[_0x7ab7('0x26')](saveUpdates(_0x4fc7b7[_0x7ab7('0x4a')],null))[_0x7ab7('0x26')](respondWithResult(_0x1e597d,null))[_0x7ab7('0x43')](handleError(_0x1e597d,null));};exports[_0x7ab7('0x27')]=function(_0x5e84da,_0x234aba){return db[_0x7ab7('0x2d')][_0x7ab7('0x48')]({'where':{'id':_0x5e84da['params']['id']}})[_0x7ab7('0x26')](handleEntityNotFound(_0x234aba,null))[_0x7ab7('0x26')](removeEntity(_0x234aba,null))[_0x7ab7('0x43')](handleError(_0x234aba,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 68ccb18..0c0cb21 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 _0x9a4f=['path','../../config/environment','./faxApplication.attributes','exports','fax_applications','util','../../config/logger','api','bluebird'];(function(_0x10f5ea,_0xeb348a){var _0x5c4f0f=function(_0x3644db){while(--_0x3644db){_0x10f5ea['push'](_0x10f5ea['shift']());}};_0x5c4f0f(++_0xeb348a);}(_0x9a4f,0x12e));var _0xf9a4=function(_0xee741b,_0x10cf16){_0xee741b=_0xee741b-0x0;var _0x9ce0a2=_0x9a4f[_0xee741b];return _0x9ce0a2;};'use strict';var _=require('lodash');var util=require(_0xf9a4('0x0'));var logger=require(_0xf9a4('0x1'))(_0xf9a4('0x2'));var moment=require('moment');var BPromise=require(_0xf9a4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf9a4('0x4'));var rimraf=require('rimraf');var config=require(_0xf9a4('0x5'));var attributes=require(_0xf9a4('0x6'));module[_0xf9a4('0x7')]=function(_0x2e7bc7,_0x48f3c6){return _0x2e7bc7['define']('FaxApplication',attributes,{'tableName':_0xf9a4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5546=['fax_applications','utf8mb4','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','FaxApplication'];(function(_0x5e0f76,_0x23bf31){var _0x35f07a=function(_0x55cd81){while(--_0x55cd81){_0x5e0f76['push'](_0x5e0f76['shift']());}};_0x35f07a(++_0x23bf31);}(_0x5546,0x9e));var _0x6554=function(_0x46672d,_0x359677){_0x46672d=_0x46672d-0x0;var _0x4294d5=_0x5546[_0x46672d];return _0x4294d5;};'use strict';var _=require(_0x6554('0x0'));var util=require(_0x6554('0x1'));var logger=require('../../config/logger')(_0x6554('0x2'));var moment=require('moment');var BPromise=require(_0x6554('0x3'));var rp=require(_0x6554('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6554('0x5'));var config=require(_0x6554('0x6'));var attributes=require('./faxApplication.attributes');module[_0x6554('0x7')]=function(_0x1b8ff1,_0xf59817){return _0x1b8ff1[_0x6554('0x8')](_0x6554('0x9'),attributes,{'tableName':_0x6554('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6554('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 7b722b4..4135fe2 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 _0x4bce=['raw','where','limit','then','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','UpdateFaxApplication','FaxApplication','update','body','options'];(function(_0xc510c5,_0xece57d){var _0x7b45c7=function(_0x2cf214){while(--_0x2cf214){_0xc510c5['push'](_0xc510c5['shift']());}};_0x7b45c7(++_0xece57d);}(_0x4bce,0x1e5));var _0xe4bc=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0x4bce[_0x4d2f00];return _0x2d7b7f;};'use strict';var _=require(_0xe4bc('0x0'));var util=require(_0xe4bc('0x1'));var moment=require(_0xe4bc('0x2'));var BPromise=require(_0xe4bc('0x3'));var rs=require(_0xe4bc('0x4'));var fs=require('fs');var Redis=require(_0xe4bc('0x5'));var db=require(_0xe4bc('0x6'))['db'];var utils=require(_0xe4bc('0x7'));var logger=require(_0xe4bc('0x8'))(_0xe4bc('0x9'));var config=require('../../config/environment');var jayson=require(_0xe4bc('0xa'));var client=jayson[_0xe4bc('0xb')][_0xe4bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf6e45b,_0x3c4b09,_0x18b07f){return new BPromise(function(_0x3f05fb,_0x41ef07){return client[_0xe4bc('0xd')](_0xf6e45b,_0x18b07f)['then'](function(_0x31d5b1){logger[_0xe4bc('0xe')](_0xe4bc('0xf'),_0x3c4b09,'request\x20sent');logger[_0xe4bc('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x3c4b09,_0xe4bc('0x11'),JSON[_0xe4bc('0x12')](_0x31d5b1));if(_0x31d5b1[_0xe4bc('0x13')]){if(_0x31d5b1['error'][_0xe4bc('0x14')]===0x1f4){logger[_0xe4bc('0x13')](_0xe4bc('0xf'),_0x3c4b09,_0x31d5b1[_0xe4bc('0x13')][_0xe4bc('0x15')]);return _0x41ef07(_0x31d5b1['error'][_0xe4bc('0x15')]);}logger[_0xe4bc('0x13')](_0xe4bc('0xf'),_0x3c4b09,_0x31d5b1[_0xe4bc('0x13')]['message']);return _0x3f05fb(_0x31d5b1[_0xe4bc('0x13')][_0xe4bc('0x15')]);}else{logger[_0xe4bc('0xe')](_0xe4bc('0xf'),_0x3c4b09,_0xe4bc('0x11'));_0x3f05fb(_0x31d5b1['result'][_0xe4bc('0x15')]);}})['catch'](function(_0x65343e){logger[_0xe4bc('0x13')](_0xe4bc('0xf'),_0x3c4b09,_0x65343e);_0x41ef07(_0x65343e);});});}exports[_0xe4bc('0x16')]=function(_0x532b47){var _0x33930f=this;return new Promise(function(_0xbec858,_0x2b86b2){return db[_0xe4bc('0x17')][_0xe4bc('0x18')](_0x532b47[_0xe4bc('0x19')],{'raw':_0x532b47[_0xe4bc('0x1a')]?_0x532b47[_0xe4bc('0x1a')][_0xe4bc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x532b47[_0xe4bc('0x1a')]?_0x532b47[_0xe4bc('0x1a')][_0xe4bc('0x1c')]||null:null,'attributes':_0x532b47[_0xe4bc('0x1a')]?_0x532b47[_0xe4bc('0x1a')]['attributes']||null:null,'limit':_0x532b47[_0xe4bc('0x1a')]?_0x532b47['options'][_0xe4bc('0x1d')]||null:null})[_0xe4bc('0x1e')](function(_0x4792ea){logger[_0xe4bc('0xe')]('UpdateFaxApplication',_0x532b47);logger[_0xe4bc('0x10')]('UpdateFaxApplication',_0x532b47,JSON[_0xe4bc('0x12')](_0x4792ea));_0xbec858(_0x4792ea);})[_0xe4bc('0x1f')](function(_0x27d069){logger[_0xe4bc('0x13')](_0xe4bc('0x16'),_0x27d069[_0xe4bc('0x15')],_0x532b47);_0x2b86b2(_0x33930f[_0xe4bc('0x13')](0x1f4,_0x27d069['message']));});});}; \ No newline at end of file +var _0x8251=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x8251,0x1cf));var _0x1825=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8251[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x1825('0x0'));var util=require(_0x1825('0x1'));var moment=require(_0x1825('0x2'));var BPromise=require(_0x1825('0x3'));var rs=require(_0x1825('0x4'));var fs=require('fs');var Redis=require(_0x1825('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1825('0x6'));var logger=require(_0x1825('0x7'))(_0x1825('0x8'));var config=require('../../config/environment');var jayson=require(_0x1825('0x9'));var client=jayson[_0x1825('0xa')][_0x1825('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f98a9,_0x5a2c53,_0x32943a){return new BPromise(function(_0x3804e9,_0x1d398a){return client[_0x1825('0xc')](_0x5f98a9,_0x32943a)[_0x1825('0xd')](function(_0x100793){logger['info'](_0x1825('0xe'),_0x5a2c53,_0x1825('0xf'));logger[_0x1825('0x10')](_0x1825('0x11'),_0x5a2c53,_0x1825('0xf'),JSON[_0x1825('0x12')](_0x100793));if(_0x100793[_0x1825('0x13')]){if(_0x100793[_0x1825('0x13')][_0x1825('0x14')]===0x1f4){logger[_0x1825('0x13')](_0x1825('0xe'),_0x5a2c53,_0x100793[_0x1825('0x13')]['message']);return _0x1d398a(_0x100793[_0x1825('0x13')][_0x1825('0x15')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x5a2c53,_0x100793[_0x1825('0x13')][_0x1825('0x15')]);return _0x3804e9(_0x100793[_0x1825('0x13')][_0x1825('0x15')]);}else{logger[_0x1825('0x16')](_0x1825('0xe'),_0x5a2c53,_0x1825('0xf'));_0x3804e9(_0x100793[_0x1825('0x17')][_0x1825('0x15')]);}})['catch'](function(_0x1ed3d6){logger['error'](_0x1825('0xe'),_0x5a2c53,_0x1ed3d6);_0x1d398a(_0x1ed3d6);});});}exports[_0x1825('0x18')]=function(_0x144eed){var _0x36c15c=this;return new Promise(function(_0x1837d1,_0x3cabae){return db[_0x1825('0x19')][_0x1825('0x1a')](_0x144eed[_0x1825('0x1b')],{'raw':_0x144eed[_0x1825('0x1c')]?_0x144eed[_0x1825('0x1c')][_0x1825('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x144eed[_0x1825('0x1c')]?_0x144eed[_0x1825('0x1c')][_0x1825('0x1e')]||null:null,'attributes':_0x144eed['options']?_0x144eed[_0x1825('0x1c')][_0x1825('0x1f')]||null:null,'limit':_0x144eed['options']?_0x144eed[_0x1825('0x1c')]['limit']||null:null})['then'](function(_0x519c54){logger[_0x1825('0x16')]('UpdateFaxApplication',_0x144eed);logger['debug']('UpdateFaxApplication',_0x144eed,JSON['stringify'](_0x519c54));_0x1837d1(_0x519c54);})[_0x1825('0x20')](function(_0x372f07){logger[_0x1825('0x13')]('UpdateFaxApplication',_0x372f07['message'],_0x144eed);_0x3cabae(_0x36c15c[_0x1825('0x13')](0x1f4,_0x372f07[_0x1825('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 6c491a1..7ccd0cc 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 _0xe605=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x52a678,_0x4c73f4){var _0x1b2ba6=function(_0x230caa){while(--_0x230caa){_0x52a678['push'](_0x52a678['shift']());}};_0x1b2ba6(++_0x4c73f4);}(_0xe605,0x92));var _0x5e60=function(_0x15082,_0x3b215f){_0x15082=_0x15082-0x0;var _0xf489e2=_0xe605[_0x15082];return _0xf489e2;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router[_0x5e60('0xe')](_0x5e60('0xf'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')]('/:id',auth[_0x5e60('0xb')](),controller['destroy']);module[_0x5e60('0x12')]=router; \ No newline at end of file +var _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x2f19c0,_0x5e1c3a){var _0x88fc50=function(_0x919f5a){while(--_0x919f5a){_0x2f19c0['push'](_0x2f19c0['shift']());}};_0x88fc50(++_0x5e1c3a);}(_0xa571,0x107));var _0x1a57=function(_0x124ef4,_0x1b39f5){_0x124ef4=_0x124ef4-0x0;var _0x23a8a7=_0xa571[_0x124ef4];return _0x23a8a7;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index ae93d53..a8e58ba 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 _0xbcee=['DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbcee,0xfa));var _0xebce=function(_0x1259b1,_0x52b693){_0x1259b1=_0x1259b1-0x0;var _0x23c88e=_0xbcee[_0x1259b1];return _0x23c88e;};'use strict';var Sequelize=require(_0xebce('0x0'));module[_0xebce('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xebce('0x2')]},'disposition':{'type':Sequelize[_0xebce('0x3')]},'secondDisposition':{'type':Sequelize[_0xebce('0x3')]},'thirdDisposition':{'type':Sequelize[_0xebce('0x3')]},'note':{'type':Sequelize[_0xebce('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xebce('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xebce('0x4')]('in',_0xebce('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xebce('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xebce('0x4')]('in',_0xebce('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xf4d9=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x2e41e2,_0x4e7250){var _0x2844d6=function(_0x28ce24){while(--_0x28ce24){_0x2e41e2['push'](_0x2e41e2['shift']());}};_0x2844d6(++_0x4e7250);}(_0xf4d9,0x156));var _0x9f4d=function(_0xca7efa,_0x2a2f46){_0xca7efa=_0xca7efa-0x0;var _0x1936ca=_0xf4d9[_0xca7efa];return _0x1936ca;};'use strict';var Sequelize=require(_0x9f4d('0x0'));module[_0x9f4d('0x1')]={'closed':{'type':Sequelize[_0x9f4d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9f4d('0x3')]},'disposition':{'type':Sequelize[_0x9f4d('0x4')]},'secondDisposition':{'type':Sequelize[_0x9f4d('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9f4d('0x4')]},'note':{'type':Sequelize[_0x9f4d('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x9f4d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9f4d('0x5')]('in',_0x9f4d('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9f4d('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9f4d('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index ff37f4b..f5e8607 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 _0x8885=['fieldName','type','key','findAll','fax','user','catch','params','keys','query','model','attributes','intersection','fields','length','includeAll','include','merge','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','filters','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','color','emit','removeTags','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','download','err','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','error','stack','name','send','map','FaxInteraction','rawAttributes'];(function(_0x39397a,_0x43fe11){var _0x4377ba=function(_0xa02798){while(--_0xa02798){_0x39397a['push'](_0x39397a['shift']());}};_0x4377ba(++_0x43fe11);}(_0x8885,0xad));var _0x5888=function(_0x535c39,_0xfcfe16){_0x535c39=_0x535c39-0x0;var _0x46b1f3=_0x8885[_0x535c39];return _0x46b1f3;};'use strict';var rimraf=require(_0x5888('0x0'));var zipdir=require(_0x5888('0x1'));var moment=require(_0x5888('0x2'));var BPromise=require(_0x5888('0x3'));var util=require('util');var path=require(_0x5888('0x4'));var fs=require('fs');var _=require(_0x5888('0x5'));var Redis=require(_0x5888('0x6'));var interaction=require(_0x5888('0x7'));var qs=require(_0x5888('0x8'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x5888('0x9'))['db'];config[_0x5888('0xa')]=_[_0x5888('0xb')](config[_0x5888('0xa')],{'host':_0x5888('0xc'),'port':0x18eb});var socket=require(_0x5888('0xd'))(new Redis(config[_0x5888('0xa')]));require('./faxInteraction.socket')[_0x5888('0xe')](socket);function respondWithStatusCode(_0x233354,_0x4ec684){_0x4ec684=_0x4ec684||0xcc;return function(_0x1b2706){if(_0x1b2706){return _0x233354[_0x5888('0xf')](_0x4ec684);}return _0x233354[_0x5888('0x10')](_0x4ec684)[_0x5888('0x11')]();};}function respondWithResult(_0x18f571,_0x4a96cf){_0x4a96cf=_0x4a96cf||0xc8;return function(_0x14a896){if(_0x14a896){return _0x18f571['status'](_0x4a96cf)[_0x5888('0x12')](_0x14a896);}};}function respondWithFilteredResult(_0x56c656,_0x451cde){return function(_0x3d4a21){if(_0x3d4a21){var _0x8dc02c=typeof _0x451cde['offset']===_0x5888('0x13')&&typeof _0x451cde[_0x5888('0x14')]===_0x5888('0x13');var _0x3c6bbf=_0x3d4a21[_0x5888('0x15')];var _0x417933=_0x8dc02c?0x0:_0x451cde['offset'];var _0x25c87e=_0x8dc02c?_0x3d4a21[_0x5888('0x15')]:_0x451cde[_0x5888('0x16')]+_0x451cde[_0x5888('0x14')];var _0x42299e;if(_0x25c87e>=_0x3c6bbf){_0x25c87e=_0x3c6bbf;_0x42299e=0xc8;}else{_0x42299e=0xce;}_0x56c656[_0x5888('0x10')](_0x42299e);return _0x56c656[_0x5888('0x17')]('Content-Range',_0x417933+'-'+_0x25c87e+'/'+_0x3c6bbf)[_0x5888('0x12')](_0x3d4a21);}return null;};}function saveUpdates(_0x5167f4){return function(_0xd0f578){if(_0xd0f578){return _0xd0f578[_0x5888('0x18')](_0x5167f4)[_0x5888('0x19')](function(_0x3f54f9){return _0x3f54f9;});}return null;};}function removeEntity(_0x297986){return function(_0x1b8305){if(_0x1b8305){return _0x1b8305['destroy']()[_0x5888('0x19')](function(){_0x297986[_0x5888('0x10')](0xcc)[_0x5888('0x11')]();});}};}function handleEntityNotFound(_0x42f18b){return function(_0x397ed6){if(!_0x397ed6){_0x42f18b['sendStatus'](0x194);}return _0x397ed6;};}function handleError(_0x5ec7b6,_0x527974){_0x527974=_0x527974||0x1f4;return function(_0x562b89){logger[_0x5888('0x1a')](_0x562b89[_0x5888('0x1b')]);if(_0x562b89['name']){delete _0x562b89[_0x5888('0x1c')];}_0x5ec7b6['status'](_0x527974)[_0x5888('0x1d')](_0x562b89);};}exports['index']=function(_0x297cdd,_0x4f6b1f){var _0x470737={};var _0x315b5a=_[_0x5888('0x1e')](db[_0x5888('0x1f')][_0x5888('0x20')],function(_0x2b698c){return{'name':_0x2b698c[_0x5888('0x21')],'type':_0x2b698c[_0x5888('0x22')][_0x5888('0x23')]};});_0x470737=qs['getOptions'](_0x315b5a,_0x297cdd);return interaction[_0x5888('0x24')](_0x5888('0x25'),_0x297cdd['query'],_0x297cdd[_0x5888('0x26')],_0x470737,_0x315b5a)[_0x5888('0x19')](respondWithFilteredResult(_0x4f6b1f,_0x470737))[_0x5888('0x27')](handleError(_0x4f6b1f,null));};exports['show']=function(_0x3dbc18,_0x4735d6){var _0x120ce8={'raw':![],'where':{'id':_0x3dbc18[_0x5888('0x28')]['id']}},_0x378dc6={};_0x378dc6['model']=_['keys'](db['FaxInteraction'][_0x5888('0x20')]);_0x378dc6['query']=_[_0x5888('0x29')](_0x3dbc18[_0x5888('0x2a')]);_0x378dc6['filters']=_['intersection'](_0x378dc6[_0x5888('0x2b')],_0x378dc6[_0x5888('0x2a')]);_0x120ce8[_0x5888('0x2c')]=_[_0x5888('0x2d')](_0x378dc6['model'],qs[_0x5888('0x2e')](_0x3dbc18[_0x5888('0x2a')][_0x5888('0x2e')]));_0x120ce8['attributes']=_0x120ce8[_0x5888('0x2c')][_0x5888('0x2f')]?_0x120ce8['attributes']:_0x378dc6[_0x5888('0x2b')];if(_0x3dbc18[_0x5888('0x2a')][_0x5888('0x30')]){_0x120ce8[_0x5888('0x31')]=[{'all':!![]}];}_0x120ce8=_[_0x5888('0x32')]({},_0x120ce8,_0x3dbc18['options']);return db[_0x5888('0x1f')][_0x5888('0x33')](_0x120ce8)[_0x5888('0x19')](handleEntityNotFound(_0x4735d6,null))[_0x5888('0x19')](respondWithResult(_0x4735d6,null))[_0x5888('0x27')](handleError(_0x4735d6,null));};exports[_0x5888('0x34')]=function(_0x4a5e0c,_0x5f0404){return db[_0x5888('0x1f')][_0x5888('0x34')](_0x4a5e0c['body'],{})[_0x5888('0x19')](respondWithResult(_0x5f0404,0xc9))['catch'](handleError(_0x5f0404,null));};exports['update']=function(_0xf6166f,_0x1a0b39){if(_0xf6166f[_0x5888('0x35')]['id']){delete _0xf6166f[_0x5888('0x35')]['id'];}return db[_0x5888('0x1f')][_0x5888('0x33')]({'where':{'id':_0xf6166f['params']['id']}})['then'](handleEntityNotFound(_0x1a0b39,null))['then'](saveUpdates(_0xf6166f[_0x5888('0x35')],null))[_0x5888('0x19')](respondWithResult(_0x1a0b39,null))[_0x5888('0x27')](handleError(_0x1a0b39,null));};exports['destroy']=function(_0x489b40,_0x2c1ad5){return db[_0x5888('0x1f')]['find']({'where':{'id':_0x489b40['params']['id']}})[_0x5888('0x19')](handleEntityNotFound(_0x2c1ad5,null))[_0x5888('0x19')](removeEntity(_0x2c1ad5,null))[_0x5888('0x27')](handleError(_0x2c1ad5,null));};exports[_0x5888('0x36')]=function(_0x50055d,_0x5734df){return db[_0x5888('0x1f')]['describe']()['then'](respondWithResult(_0x5734df,null))[_0x5888('0x27')](handleError(_0x5734df,null));};exports[_0x5888('0x37')]=function(_0x2b8181,_0x50b833){return db[_0x5888('0x38')][_0x5888('0x33')]({'where':{'id':_0x2b8181[_0x5888('0x28')]['id']}})['then'](handleEntityNotFound(_0x50b833,null))[_0x5888('0x19')](function(_0x578987){if(_0x578987){return _0x578987[_0x5888('0x37')](_0x2b8181[_0x5888('0x35')][_0x5888('0x39')],_[_0x5888('0x3a')](_0x2b8181[_0x5888('0x35')],['ids','id'])||{});}})['then'](respondWithResult(_0x50b833,null))[_0x5888('0x27')](handleError(_0x50b833,null));};exports[_0x5888('0x3b')]=function(_0x31ecde,_0x2c241a){var _0x259300={'raw':![],'where':{}};var _0x3c2693={};var _0x2dec9e={'count':0x0,'rows':[]};return db[_0x5888('0x1f')][_0x5888('0x3c')]({'where':{'id':_0x31ecde[_0x5888('0x28')]['id']}})[_0x5888('0x19')](handleEntityNotFound(_0x2c241a,null))[_0x5888('0x19')](function(_0x52507d){if(_0x52507d){_0x3c2693[_0x5888('0x2b')]=_['keys'](db[_0x5888('0x38')][_0x5888('0x20')]);_0x3c2693[_0x5888('0x2a')]=_['keys'](_0x31ecde[_0x5888('0x2a')]);_0x3c2693['filters']=_[_0x5888('0x2d')](_0x3c2693[_0x5888('0x2b')],_0x3c2693['query']);_0x259300[_0x5888('0x2c')]=_[_0x5888('0x2d')](_0x3c2693[_0x5888('0x2b')],qs[_0x5888('0x2e')](_0x31ecde[_0x5888('0x2a')][_0x5888('0x2e')]));_0x259300[_0x5888('0x2c')]=_0x259300[_0x5888('0x2c')][_0x5888('0x2f')]?_0x259300[_0x5888('0x2c')]:_0x3c2693[_0x5888('0x2b')];if(!_0x31ecde[_0x5888('0x2a')][_0x5888('0x3d')](_0x5888('0x3e'))){_0x259300[_0x5888('0x14')]=qs[_0x5888('0x14')](_0x31ecde[_0x5888('0x2a')][_0x5888('0x14')]);_0x259300[_0x5888('0x16')]=qs[_0x5888('0x16')](_0x31ecde[_0x5888('0x2a')][_0x5888('0x16')]);}_0x259300[_0x5888('0x3f')]=qs['sort'](_0x31ecde['query'][_0x5888('0x40')]);_0x259300[_0x5888('0x41')]=qs[_0x5888('0x42')](_['pick'](_0x31ecde[_0x5888('0x2a')],_0x3c2693[_0x5888('0x42')]));_0x259300['where'][_0x5888('0x43')]=_0x52507d['id'];if(_0x31ecde[_0x5888('0x2a')][_0x5888('0x44')]){_0x259300['where']=_['merge'](_0x259300[_0x5888('0x41')],{'$or':_['map'](_0x259300[_0x5888('0x2c')],function(_0x24df96){var _0x59f10d={};_0x59f10d[_0x24df96]={'$like':'%'+_0x31ecde[_0x5888('0x2a')]['filter']+'%'};return _0x59f10d;})});}if(_0x31ecde[_0x5888('0x2a')][_0x5888('0x45')]){var _0x34a77b=_0x31ecde[_0x5888('0x2a')][_0x5888('0x45')][_0x5888('0x46')](',');var _0xa294e2={};_0xa294e2[_0x34a77b[0x0]]={'$gte':moment(_0x34a77b[0x1])['format'](_0x5888('0x47'))};_0x259300[_0x5888('0x41')]=_[_0x5888('0x32')](_0x259300['where'],_0xa294e2);}_0x259300=_['merge']({},_0x259300,_0x31ecde[_0x5888('0x48')]);return db['FaxMessage'][_0x5888('0x15')]({'where':_0x259300[_0x5888('0x41')]})['then'](function(_0x547198){_0x2dec9e[_0x5888('0x15')]=_0x547198;if(_0x31ecde[_0x5888('0x2a')]['includeAll']){_0x259300[_0x5888('0x31')]=[{'all':!![]}];}return db[_0x5888('0x38')][_0x5888('0x24')](_0x259300);})['then'](function(_0x5d1fcf){_0x2dec9e[_0x5888('0x49')]=_0x5d1fcf;return _0x2dec9e;});}})['then'](respondWithFilteredResult(_0x2c241a,_0x259300))['catch'](handleError(_0x2c241a,null));};exports[_0x5888('0x4a')]=function(_0x3dcce8,_0x53eaa7){return db[_0x5888('0x1f')][_0x5888('0x33')]({'where':{'id':_0x3dcce8[_0x5888('0x28')]['id']}})['then'](handleEntityNotFound(_0x53eaa7,null))[_0x5888('0x19')](function(_0x1cfeec){if(_0x1cfeec){return _0x1cfeec[_0x5888('0x4b')](_0x3dcce8[_0x5888('0x35')][_0x5888('0x39')],_[_0x5888('0x3a')](_0x3dcce8['body'],[_0x5888('0x39'),'id'])||{})[_0x5888('0x4c')](function(){return db['Tag'][_0x5888('0x24')]({'attributes':['id','name',_0x5888('0x4d')],'where':{'id':_0x3dcce8['body'][_0x5888('0x39')]}});})['then'](function(_0x52e0bd){socket[_0x5888('0x4e')]('faxInteractionTags:save',{'id':Number(_0x3dcce8['params']['id']),'tags':_0x52e0bd||[]});return{'id':Number(_0x3dcce8[_0x5888('0x28')]['id']),'tags':_0x52e0bd||[]};});}})[_0x5888('0x19')](respondWithResult(_0x53eaa7,null))[_0x5888('0x27')](handleError(_0x53eaa7,null));};exports[_0x5888('0x4f')]=function(_0x4c0e07,_0x3af76d){return db[_0x5888('0x1f')]['find']({'where':{'id':_0x4c0e07['params']['id']}})[_0x5888('0x19')](handleEntityNotFound(_0x3af76d,null))['then'](function(_0xe4b4d3){if(_0xe4b4d3){return _0xe4b4d3[_0x5888('0x4f')](_0x4c0e07[_0x5888('0x2a')][_0x5888('0x39')]);}})['then'](respondWithStatusCode(_0x3af76d,null))[_0x5888('0x27')](handleError(_0x3af76d,null));};exports['download']=function(_0x5173aa,_0x4f73ab){var _0x25c759=moment()[_0x5888('0x50')]()[_0x5888('0x51')]();var _0x26a863=path[_0x5888('0x52')](config[_0x5888('0x53')],_0x5888('0x54'),_0x5888('0x55'),_0x5888('0x56'));var _0x43c5f4=path[_0x5888('0x52')](config[_0x5888('0x53')],_0x5888('0x54'),_0x5888('0x55'),_0x5888('0x57'));var _0x105665=path['join'](_0x26a863,_0x25c759);var _0x164684=util[_0x5888('0x58')](_0x5888('0x59'),_0x5173aa['params']['id'],_0x25c759);var _0x4fd84b=path[_0x5888('0x52')](_0x26a863,_0x164684);var _0x2b986e=[];_0x2b986e[_0x5888('0x5a')]({'model':db[_0x5888('0x5b')],'as':_0x5888('0x5b'),'raw':!![]});var _0x4a14d7=[{'model':db[_0x5888('0x38')],'as':_0x5888('0x5c'),'attributes':['id',_0x5888('0x35'),_0x5888('0x5d')],'include':_0x2b986e}];return db['FaxInteraction'][_0x5888('0x33')]({'where':{'id':_0x5173aa[_0x5888('0x28')]['id']},'include':_0x4a14d7})[_0x5888('0x19')](handleEntityNotFound(_0x4f73ab,null))['then'](function(_0x3c83ea){if(_0x3c83ea&&_0x3c83ea['Messages']){var _0x197396=_0x3c83ea[_0x5888('0x5e')]({'plain':!![]});fs['mkdirSync'](_0x105665);for(var _0x5665d4=0x0;_0x5665d4<_0x197396[_0x5888('0x5c')][_0x5888('0x2f')];_0x5665d4++){var _0xdf1122=_0x197396[_0x5888('0x5c')][_0x5665d4][_0x5888('0x5b')];if(_0xdf1122){var _0x217d62=path[_0x5888('0x52')](_0x43c5f4,_0xdf1122[_0x5888('0x5f')]);if(fs[_0x5888('0x60')](_0x217d62)){fs[_0x5888('0x61')](_0x217d62)[_0x5888('0x62')](fs[_0x5888('0x63')](path['join'](_0x105665,_0xdf1122[_0x5888('0x5f')])));}}}return BPromise[_0x5888('0x64')]()[_0x5888('0x19')](function(){return new BPromise(function(_0x4b37ad,_0x5de855){zipdir(_0x105665,{'saveTo':_0x4fd84b},function(_0x59a120,_0x485e86){if(_0x59a120)return _0x5de855(_0x59a120);return _0x4b37ad(_0x485e86);});})[_0x5888('0x19')](function(){return new BPromise(function(_0x27f58e,_0x544c9a){rimraf(_0x105665,function(_0x4af43d){if(_0x4af43d)_0x544c9a(_0x4af43d);return _0x27f58e();});});})['then'](function(){return _0x4f73ab[_0x5888('0x65')](_0x4fd84b,_0x164684,function(_0x741a25){if(_0x741a25){console['log'](_0x5888('0x66'),_0x741a25);}else{fs['unlinkSync'](_0x4fd84b);}});});});}else{return _0x4f73ab[_0x5888('0xf')](0xc8);}})['catch'](handleError(_0x4f73ab,null));}; \ No newline at end of file +var _0x4d04=['intersection','nolimit','sort','where','pick','merge','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','color','emit','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','log','err','unlinkSync','rimraf','moment','bluebird','util','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','end','error','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','keys','filters','model','fields','attributes','length','includeAll','include','options','find','create','update','body','destroy','describe','FaxMessage','addMessage','ids','omit','findOne'];(function(_0x457dda,_0xb45bfc){var _0x1bc9ca=function(_0x342e99){while(--_0x342e99){_0x457dda['push'](_0x457dda['shift']());}};_0x1bc9ca(++_0xb45bfc);}(_0x4d04,0x8b));var _0x44d0=function(_0x163b1f,_0xbe94a2){_0x163b1f=_0x163b1f-0x0;var _0x34f140=_0x4d04[_0x163b1f];return _0x34f140;};'use strict';var rimraf=require(_0x44d0('0x0'));var zipdir=require('zip-dir');var moment=require(_0x44d0('0x1'));var BPromise=require(_0x44d0('0x2'));var util=require(_0x44d0('0x3'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0x44d0('0x4'));var qs=require(_0x44d0('0x5'));var logger=require('../../config/logger')(_0x44d0('0x6'));var config=require(_0x44d0('0x7'));var db=require('../../mysqldb')['db'];config[_0x44d0('0x8')]=_['defaults'](config['redis'],{'host':_0x44d0('0x9'),'port':0x18eb});var socket=require(_0x44d0('0xa'))(new Redis(config[_0x44d0('0x8')]));require(_0x44d0('0xb'))[_0x44d0('0xc')](socket);function respondWithStatusCode(_0x30eb64,_0x14bc7e){_0x14bc7e=_0x14bc7e||0xcc;return function(_0x4f49de){if(_0x4f49de){return _0x30eb64[_0x44d0('0xd')](_0x14bc7e);}return _0x30eb64[_0x44d0('0xe')](_0x14bc7e)['end']();};}function respondWithResult(_0x10fc7d,_0x2e0e44){_0x2e0e44=_0x2e0e44||0xc8;return function(_0x31f74d){if(_0x31f74d){return _0x10fc7d['status'](_0x2e0e44)[_0x44d0('0xf')](_0x31f74d);}};}function respondWithFilteredResult(_0x762770,_0x3991e7){return function(_0x536d00){if(_0x536d00){var _0x7ee913=typeof _0x3991e7['offset']===_0x44d0('0x10')&&typeof _0x3991e7[_0x44d0('0x11')]===_0x44d0('0x10');var _0x2a3a7e=_0x536d00[_0x44d0('0x12')];var _0x28f765=_0x7ee913?0x0:_0x3991e7[_0x44d0('0x13')];var _0x4d0e29=_0x7ee913?_0x536d00[_0x44d0('0x12')]:_0x3991e7['offset']+_0x3991e7['limit'];var _0x125fef;if(_0x4d0e29>=_0x2a3a7e){_0x4d0e29=_0x2a3a7e;_0x125fef=0xc8;}else{_0x125fef=0xce;}_0x762770[_0x44d0('0xe')](_0x125fef);return _0x762770[_0x44d0('0x14')](_0x44d0('0x15'),_0x28f765+'-'+_0x4d0e29+'/'+_0x2a3a7e)['json'](_0x536d00);}return null;};}function saveUpdates(_0x1075c1){return function(_0x5baaf4){if(_0x5baaf4){return _0x5baaf4['update'](_0x1075c1)[_0x44d0('0x16')](function(_0x51877d){return _0x51877d;});}return null;};}function removeEntity(_0x5dbaf3){return function(_0xf7b406){if(_0xf7b406){return _0xf7b406['destroy']()[_0x44d0('0x16')](function(){_0x5dbaf3['status'](0xcc)[_0x44d0('0x17')]();});}};}function handleEntityNotFound(_0x24cada){return function(_0x5067bf){if(!_0x5067bf){_0x24cada[_0x44d0('0xd')](0x194);}return _0x5067bf;};}function handleError(_0x2c2df1,_0x3b6e91){_0x3b6e91=_0x3b6e91||0x1f4;return function(_0x174926){logger[_0x44d0('0x18')](_0x174926[_0x44d0('0x19')]);if(_0x174926[_0x44d0('0x1a')]){delete _0x174926[_0x44d0('0x1a')];}_0x2c2df1['status'](_0x3b6e91)[_0x44d0('0x1b')](_0x174926);};}exports[_0x44d0('0x1c')]=function(_0xeeaa40,_0x17c136){var _0x10a513={};var _0x1f6f48=_[_0x44d0('0x1d')](db[_0x44d0('0x1e')][_0x44d0('0x1f')],function(_0x51aa7a){return{'name':_0x51aa7a[_0x44d0('0x20')],'type':_0x51aa7a[_0x44d0('0x21')][_0x44d0('0x22')]};});_0x10a513=qs[_0x44d0('0x23')](_0x1f6f48,_0xeeaa40);return interaction[_0x44d0('0x24')](_0x44d0('0x25'),_0xeeaa40[_0x44d0('0x26')],_0xeeaa40[_0x44d0('0x27')],_0x10a513,_0x1f6f48)[_0x44d0('0x16')](respondWithFilteredResult(_0x17c136,_0x10a513))[_0x44d0('0x28')](handleError(_0x17c136,null));};exports[_0x44d0('0x29')]=function(_0x1639f0,_0x183972){var _0xaca527={'raw':![],'where':{'id':_0x1639f0[_0x44d0('0x2a')]['id']}},_0x298321={};_0x298321['model']=_[_0x44d0('0x2b')](db['FaxInteraction'][_0x44d0('0x1f')]);_0x298321[_0x44d0('0x26')]=_[_0x44d0('0x2b')](_0x1639f0['query']);_0x298321[_0x44d0('0x2c')]=_['intersection'](_0x298321[_0x44d0('0x2d')],_0x298321[_0x44d0('0x26')]);_0xaca527['attributes']=_['intersection'](_0x298321['model'],qs[_0x44d0('0x2e')](_0x1639f0[_0x44d0('0x26')]['fields']));_0xaca527[_0x44d0('0x2f')]=_0xaca527[_0x44d0('0x2f')][_0x44d0('0x30')]?_0xaca527[_0x44d0('0x2f')]:_0x298321[_0x44d0('0x2d')];if(_0x1639f0[_0x44d0('0x26')][_0x44d0('0x31')]){_0xaca527[_0x44d0('0x32')]=[{'all':!![]}];}_0xaca527=_['merge']({},_0xaca527,_0x1639f0[_0x44d0('0x33')]);return db[_0x44d0('0x1e')][_0x44d0('0x34')](_0xaca527)[_0x44d0('0x16')](handleEntityNotFound(_0x183972,null))[_0x44d0('0x16')](respondWithResult(_0x183972,null))[_0x44d0('0x28')](handleError(_0x183972,null));};exports[_0x44d0('0x35')]=function(_0x5818d7,_0x1384b3){return db[_0x44d0('0x1e')][_0x44d0('0x35')](_0x5818d7['body'],{})[_0x44d0('0x16')](respondWithResult(_0x1384b3,0xc9))[_0x44d0('0x28')](handleError(_0x1384b3,null));};exports[_0x44d0('0x36')]=function(_0x3074bc,_0x5021ba){if(_0x3074bc['body']['id']){delete _0x3074bc[_0x44d0('0x37')]['id'];}return db[_0x44d0('0x1e')][_0x44d0('0x34')]({'where':{'id':_0x3074bc[_0x44d0('0x2a')]['id']}})[_0x44d0('0x16')](handleEntityNotFound(_0x5021ba,null))[_0x44d0('0x16')](saveUpdates(_0x3074bc[_0x44d0('0x37')],null))['then'](respondWithResult(_0x5021ba,null))[_0x44d0('0x28')](handleError(_0x5021ba,null));};exports[_0x44d0('0x38')]=function(_0x4f57d7,_0x3afbf0){return db['FaxInteraction'][_0x44d0('0x34')]({'where':{'id':_0x4f57d7['params']['id']}})[_0x44d0('0x16')](handleEntityNotFound(_0x3afbf0,null))[_0x44d0('0x16')](removeEntity(_0x3afbf0,null))[_0x44d0('0x28')](handleError(_0x3afbf0,null));};exports[_0x44d0('0x39')]=function(_0x34fe7b,_0x3ce242){return db[_0x44d0('0x1e')]['describe']()[_0x44d0('0x16')](respondWithResult(_0x3ce242,null))['catch'](handleError(_0x3ce242,null));};exports['addMessage']=function(_0x1efdc9,_0xf58d65){return db[_0x44d0('0x3a')]['find']({'where':{'id':_0x1efdc9[_0x44d0('0x2a')]['id']}})['then'](handleEntityNotFound(_0xf58d65,null))[_0x44d0('0x16')](function(_0x921bcd){if(_0x921bcd){return _0x921bcd[_0x44d0('0x3b')](_0x1efdc9[_0x44d0('0x37')][_0x44d0('0x3c')],_[_0x44d0('0x3d')](_0x1efdc9['body'],[_0x44d0('0x3c'),'id'])||{});}})[_0x44d0('0x16')](respondWithResult(_0xf58d65,null))['catch'](handleError(_0xf58d65,null));};exports['getMessages']=function(_0x4185a2,_0x1e846f){var _0x463451={'raw':![],'where':{}};var _0x1e1e37={};var _0x532e1d={'count':0x0,'rows':[]};return db[_0x44d0('0x1e')][_0x44d0('0x3e')]({'where':{'id':_0x4185a2[_0x44d0('0x2a')]['id']}})[_0x44d0('0x16')](handleEntityNotFound(_0x1e846f,null))[_0x44d0('0x16')](function(_0x4fd2c4){if(_0x4fd2c4){_0x1e1e37['model']=_[_0x44d0('0x2b')](db[_0x44d0('0x3a')][_0x44d0('0x1f')]);_0x1e1e37['query']=_[_0x44d0('0x2b')](_0x4185a2[_0x44d0('0x26')]);_0x1e1e37['filters']=_[_0x44d0('0x3f')](_0x1e1e37[_0x44d0('0x2d')],_0x1e1e37[_0x44d0('0x26')]);_0x463451[_0x44d0('0x2f')]=_['intersection'](_0x1e1e37[_0x44d0('0x2d')],qs[_0x44d0('0x2e')](_0x4185a2['query']['fields']));_0x463451[_0x44d0('0x2f')]=_0x463451[_0x44d0('0x2f')][_0x44d0('0x30')]?_0x463451[_0x44d0('0x2f')]:_0x1e1e37['model'];if(!_0x4185a2[_0x44d0('0x26')]['hasOwnProperty'](_0x44d0('0x40'))){_0x463451[_0x44d0('0x11')]=qs[_0x44d0('0x11')](_0x4185a2[_0x44d0('0x26')][_0x44d0('0x11')]);_0x463451[_0x44d0('0x13')]=qs[_0x44d0('0x13')](_0x4185a2[_0x44d0('0x26')][_0x44d0('0x13')]);}_0x463451['order']=qs[_0x44d0('0x41')](_0x4185a2[_0x44d0('0x26')][_0x44d0('0x41')]);_0x463451[_0x44d0('0x42')]=qs[_0x44d0('0x2c')](_[_0x44d0('0x43')](_0x4185a2['query'],_0x1e1e37[_0x44d0('0x2c')]));_0x463451[_0x44d0('0x42')]['FaxInteractionId']=_0x4fd2c4['id'];if(_0x4185a2[_0x44d0('0x26')]['filter']){_0x463451[_0x44d0('0x42')]=_[_0x44d0('0x44')](_0x463451['where'],{'$or':_[_0x44d0('0x1d')](_0x463451[_0x44d0('0x2f')],function(_0x5be3ef){var _0x15d411={};_0x15d411[_0x5be3ef]={'$like':'%'+_0x4185a2['query'][_0x44d0('0x45')]+'%'};return _0x15d411;})});}if(_0x4185a2['query'][_0x44d0('0x46')]){var _0x56f4e9=_0x4185a2[_0x44d0('0x26')][_0x44d0('0x46')][_0x44d0('0x47')](',');var _0x2d2ce7={};_0x2d2ce7[_0x56f4e9[0x0]]={'$gte':moment(_0x56f4e9[0x1])[_0x44d0('0x48')](_0x44d0('0x49'))};_0x463451['where']=_['merge'](_0x463451[_0x44d0('0x42')],_0x2d2ce7);}_0x463451=_[_0x44d0('0x44')]({},_0x463451,_0x4185a2['options']);return db['FaxMessage'][_0x44d0('0x12')]({'where':_0x463451[_0x44d0('0x42')]})[_0x44d0('0x16')](function(_0xe75fbd){_0x532e1d[_0x44d0('0x12')]=_0xe75fbd;if(_0x4185a2[_0x44d0('0x26')][_0x44d0('0x31')]){_0x463451[_0x44d0('0x32')]=[{'all':!![]}];}return db[_0x44d0('0x3a')][_0x44d0('0x24')](_0x463451);})[_0x44d0('0x16')](function(_0x5b24ea){_0x532e1d['rows']=_0x5b24ea;return _0x532e1d;});}})[_0x44d0('0x16')](respondWithFilteredResult(_0x1e846f,_0x463451))[_0x44d0('0x28')](handleError(_0x1e846f,null));};exports[_0x44d0('0x4a')]=function(_0x58d93c,_0x4cb14d){return db['FaxInteraction'][_0x44d0('0x34')]({'where':{'id':_0x58d93c['params']['id']}})[_0x44d0('0x16')](handleEntityNotFound(_0x4cb14d,null))[_0x44d0('0x16')](function(_0x41132e){if(_0x41132e){return _0x41132e[_0x44d0('0x4b')](_0x58d93c[_0x44d0('0x37')][_0x44d0('0x3c')],_[_0x44d0('0x3d')](_0x58d93c[_0x44d0('0x37')],[_0x44d0('0x3c'),'id'])||{})[_0x44d0('0x4c')](function(){return db['Tag'][_0x44d0('0x24')]({'attributes':['id',_0x44d0('0x1a'),_0x44d0('0x4d')],'where':{'id':_0x58d93c['body']['ids']}});})['then'](function(_0x2cd212){socket[_0x44d0('0x4e')]('faxInteractionTags:save',{'id':Number(_0x58d93c['params']['id']),'tags':_0x2cd212||[]});return{'id':Number(_0x58d93c[_0x44d0('0x2a')]['id']),'tags':_0x2cd212||[]};});}})[_0x44d0('0x16')](respondWithResult(_0x4cb14d,null))[_0x44d0('0x28')](handleError(_0x4cb14d,null));};exports[_0x44d0('0x4f')]=function(_0x106cd0,_0x1e2995){return db[_0x44d0('0x1e')][_0x44d0('0x34')]({'where':{'id':_0x106cd0[_0x44d0('0x2a')]['id']}})[_0x44d0('0x16')](handleEntityNotFound(_0x1e2995,null))[_0x44d0('0x16')](function(_0x3624bd){if(_0x3624bd){return _0x3624bd['removeTags'](_0x106cd0[_0x44d0('0x26')]['ids']);}})[_0x44d0('0x16')](respondWithStatusCode(_0x1e2995,null))['catch'](handleError(_0x1e2995,null));};exports[_0x44d0('0x50')]=function(_0x2a2dad,_0x3e3a4f){var _0x281032=moment()[_0x44d0('0x51')]()['toString']();var _0x2f4053=path[_0x44d0('0x52')](config[_0x44d0('0x53')],'server',_0x44d0('0x54'),_0x44d0('0x55'));var _0x57373d=path[_0x44d0('0x52')](config['root'],_0x44d0('0x56'),'files',_0x44d0('0x57'));var _0x242ed7=path['join'](_0x2f4053,_0x281032);var _0xe0f5c1=util[_0x44d0('0x48')](_0x44d0('0x58'),_0x2a2dad[_0x44d0('0x2a')]['id'],_0x281032);var _0x212283=path[_0x44d0('0x52')](_0x2f4053,_0xe0f5c1);var _0x46d812=[];_0x46d812[_0x44d0('0x59')]({'model':db['Attachment'],'as':_0x44d0('0x5a'),'raw':!![]});var _0x3f634d=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id','body','createdAt'],'include':_0x46d812}];return db[_0x44d0('0x1e')][_0x44d0('0x34')]({'where':{'id':_0x2a2dad[_0x44d0('0x2a')]['id']},'include':_0x3f634d})[_0x44d0('0x16')](handleEntityNotFound(_0x3e3a4f,null))['then'](function(_0x10d4a6){if(_0x10d4a6&&_0x10d4a6[_0x44d0('0x5b')]){var _0x2fad9c=_0x10d4a6[_0x44d0('0x5c')]({'plain':!![]});fs[_0x44d0('0x5d')](_0x242ed7);for(var _0x518cb9=0x0;_0x518cb9<_0x2fad9c[_0x44d0('0x5b')]['length'];_0x518cb9++){var _0x37f78f=_0x2fad9c[_0x44d0('0x5b')][_0x518cb9][_0x44d0('0x5a')];if(_0x37f78f){var _0x577d43=path[_0x44d0('0x52')](_0x57373d,_0x37f78f[_0x44d0('0x5e')]);if(fs['existsSync'](_0x577d43)){fs[_0x44d0('0x5f')](_0x577d43)[_0x44d0('0x60')](fs[_0x44d0('0x61')](path[_0x44d0('0x52')](_0x242ed7,_0x37f78f['basename'])));}}}return BPromise['resolve']()[_0x44d0('0x16')](function(){return new BPromise(function(_0x47a832,_0x1abdd0){zipdir(_0x242ed7,{'saveTo':_0x212283},function(_0x45219e,_0x1706fd){if(_0x45219e)return _0x1abdd0(_0x45219e);return _0x47a832(_0x1706fd);});})[_0x44d0('0x16')](function(){return new BPromise(function(_0x5dd193,_0x514c96){rimraf(_0x242ed7,function(_0x17c09d){if(_0x17c09d)_0x514c96(_0x17c09d);return _0x5dd193();});});})['then'](function(){return _0x3e3a4f[_0x44d0('0x50')](_0x212283,_0xe0f5c1,function(_0xd9954b){if(_0xd9954b){console[_0x44d0('0x62')](_0x44d0('0x63'),_0xd9954b);}else{fs[_0x44d0('0x64')](_0x212283);}});});});}else{return _0x3e3a4f[_0x44d0('0xd')](0xc8);}})['catch'](handleError(_0x3e3a4f,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index b45421f..b865b46 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 _0x854b=['hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch'];(function(_0x5729c3,_0x2c3755){var _0x1478b1=function(_0x1a85ba){while(--_0x1a85ba){_0x5729c3['push'](_0x5729c3['shift']());}};_0x1478b1(++_0x2c3755);}(_0x854b,0x147));var _0xb854=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x854b[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xb854('0x0'))['db'][_0xb854('0x1')];var FaxMessage=require(_0xb854('0x0'))['db'][_0xb854('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb854('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb854('0x4'),'afterDestroy':_0xb854('0x5')};function emitEvent(_0x56424f){return function(_0x10f9c9,_0x5697ca,_0xcb1ef8){_0x10f9c9[_0xb854('0x6')]({'attributes':['id'],'raw':!![]})[_0xb854('0x7')](function(_0x135e85){_0x10f9c9[_0xb854('0x8')](_0xb854('0x9'),_0x135e85[_0xb854('0xa')](function(_0x3638c9){return{'id':_0x3638c9['id']};}));return FaxMessage[_0xb854('0xb')]({'where':{'FaxInteractionId':_0x10f9c9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb854('0x7')](function(_0x2222db){_0x10f9c9[_0xb854('0x8')](_0xb854('0xc'),_0x2222db['length']);FaxInteractionEvents['emit'](_0x56424f+':'+_0x10f9c9['id'],_0x10f9c9);FaxInteractionEvents[_0xb854('0xd')](_0x56424f,_0x10f9c9);_0xcb1ef8(null);})[_0xb854('0xe')](_0xcb1ef8(null));};}for(var e in events){if(events[_0xb854('0xf')](e)){var event=events[e];FaxInteraction[_0xb854('0x10')](e,emitEvent(event));}}module[_0xb854('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0xc351=['FaxMessage','setMaxListeners','update','remove','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','../../mysqldb','FaxInteraction'];(function(_0xf5f608,_0x460a7a){var _0x26fd58=function(_0x471c75){while(--_0x471c75){_0xf5f608['push'](_0xf5f608['shift']());}};_0x26fd58(++_0x460a7a);}(_0xc351,0x19e));var _0x1c35=function(_0xc2634d,_0x3bed70){_0xc2634d=_0xc2634d-0x0;var _0x52afab=_0xc351[_0xc2634d];return _0x52afab;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1c35('0x0'))['db'][_0x1c35('0x1')];var FaxMessage=require(_0x1c35('0x0'))['db'][_0x1c35('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1c35('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1c35('0x4'),'afterDestroy':_0x1c35('0x5')};function emitEvent(_0x602a5f){return function(_0x2589cf,_0x6e7ba2,_0x37560e){_0x2589cf['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5d8fc4){_0x2589cf[_0x1c35('0x6')](_0x1c35('0x7'),_0x5d8fc4[_0x1c35('0x8')](function(_0x424a50){return{'id':_0x424a50['id']};}));return FaxMessage[_0x1c35('0x9')]({'where':{'FaxInteractionId':_0x2589cf['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x464809){_0x2589cf['setDataValue']('unreadMessages',_0x464809['length']);FaxInteractionEvents['emit'](_0x602a5f+':'+_0x2589cf['id'],_0x2589cf);FaxInteractionEvents[_0x1c35('0xa')](_0x602a5f,_0x2589cf);_0x37560e(null);})[_0x1c35('0xb')](_0x37560e(null));};}for(var e in events){if(events[_0x1c35('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 2ca3299..a066e4d 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 _0xd5f9=['closed','format','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','changed'];(function(_0x5eb29d,_0x3c0e8d){var _0xfd1784=function(_0x2aa6f6){while(--_0x2aa6f6){_0x5eb29d['push'](_0x5eb29d['shift']());}};_0xfd1784(++_0x3c0e8d);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0xd5f9[_0x1c9c24];return _0x349c69;};'use strict';var _=require(_0x9d5f('0x0'));var util=require(_0x9d5f('0x1'));var logger=require(_0x9d5f('0x2'))(_0x9d5f('0x3'));var moment=require('moment');var BPromise=require(_0x9d5f('0x4'));var rp=require(_0x9d5f('0x5'));var fs=require('fs');var path=require(_0x9d5f('0x6'));var rimraf=require(_0x9d5f('0x7'));var config=require(_0x9d5f('0x8'));var attributes=require(_0x9d5f('0x9'));module['exports']=function(_0x546c04,_0x58edae){return _0x546c04[_0x9d5f('0xa')](_0x9d5f('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x402a35,_0x255389,_0x4bb4a2){if(_0x402a35[_0x9d5f('0xc')](_0x9d5f('0xd'))){_0x402a35['closedAt']=moment()[_0x9d5f('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4bb4a2(null,_0x402a35);}}});}; \ No newline at end of file +var _0xb486=['FaxInteraction','fax_interactions','changed','closed','closedAt','format','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x29dfa5,_0xd3078e){var _0x41c15a=function(_0x10802b){while(--_0x10802b){_0x29dfa5['push'](_0x29dfa5['shift']());}};_0x41c15a(++_0xd3078e);}(_0xb486,0x138));var _0x6b48=function(_0x4eabdf,_0xe159f6){_0x4eabdf=_0x4eabdf-0x0;var _0x29f266=_0xb486[_0x4eabdf];return _0x29f266;};'use strict';var _=require(_0x6b48('0x0'));var util=require(_0x6b48('0x1'));var logger=require('../../config/logger')(_0x6b48('0x2'));var moment=require(_0x6b48('0x3'));var BPromise=require(_0x6b48('0x4'));var rp=require(_0x6b48('0x5'));var fs=require('fs');var path=require(_0x6b48('0x6'));var rimraf=require(_0x6b48('0x7'));var config=require(_0x6b48('0x8'));var attributes=require(_0x6b48('0x9'));module[_0x6b48('0xa')]=function(_0x27a2ed,_0x40ae92){return _0x27a2ed[_0x6b48('0xb')](_0x6b48('0xc'),attributes,{'tableName':_0x6b48('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x468a1c,_0x5318f3,_0x187d78){if(_0x468a1c[_0x6b48('0xe')](_0x6b48('0xf'))){_0x468a1c[_0x6b48('0x10')]=moment()[_0x6b48('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x187d78(null,_0x468a1c);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 831cb83..15b2ebe 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 _0xe60e=['../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateFaxInteraction','update','body','options','raw','where','attributes','FaxInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','ioredis'];(function(_0x1e8779,_0x287a0b){var _0x52378e=function(_0x22d28e){while(--_0x22d28e){_0x1e8779['push'](_0x1e8779['shift']());}};_0x52378e(++_0x287a0b);}(_0xe60e,0x1d0));var _0xee60=function(_0x13ef33,_0xeef600){_0x13ef33=_0x13ef33-0x0;var _0x3bd624=_0xe60e[_0x13ef33];return _0x3bd624;};'use strict';var _=require(_0xee60('0x0'));var util=require(_0xee60('0x1'));var moment=require(_0xee60('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee60('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xee60('0x4'));var logger=require('../../config/logger')(_0xee60('0x5'));var config=require('../../config/environment');var jayson=require(_0xee60('0x6'));var client=jayson[_0xee60('0x7')][_0xee60('0x8')]({'port':0x232a});config[_0xee60('0x9')]=_[_0xee60('0xa')](config[_0xee60('0x9')],{'host':_0xee60('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xee60('0xc'))['register'](socket);function respondWithRpcPromise(_0x3cdd5f,_0x197b1f,_0xd76016){return new BPromise(function(_0x2b1ec2,_0x441036){return client[_0xee60('0xd')](_0x3cdd5f,_0xd76016)[_0xee60('0xe')](function(_0x17b9cb){logger['info'](_0xee60('0xf'),_0x197b1f,_0xee60('0x10'));logger[_0xee60('0x11')](_0xee60('0x12'),_0x197b1f,_0xee60('0x10'),JSON[_0xee60('0x13')](_0x17b9cb));if(_0x17b9cb[_0xee60('0x14')]){if(_0x17b9cb['error'][_0xee60('0x15')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x197b1f,_0x17b9cb[_0xee60('0x14')][_0xee60('0x16')]);return _0x441036(_0x17b9cb[_0xee60('0x14')][_0xee60('0x16')]);}logger[_0xee60('0x14')](_0xee60('0xf'),_0x197b1f,_0x17b9cb[_0xee60('0x14')][_0xee60('0x16')]);return _0x2b1ec2(_0x17b9cb[_0xee60('0x14')][_0xee60('0x16')]);}else{logger[_0xee60('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x197b1f,'request\x20sent');_0x2b1ec2(_0x17b9cb['result'][_0xee60('0x16')]);}})[_0xee60('0x18')](function(_0x46f1c3){logger[_0xee60('0x14')](_0xee60('0xf'),_0x197b1f,_0x46f1c3);_0x441036(_0x46f1c3);});});}exports[_0xee60('0x19')]=function(_0x37c7e7){var _0x3bb2ad=this;return new Promise(function(_0x40e3fd,_0x40e80e){return db['FaxInteraction'][_0xee60('0x1a')](_0x37c7e7[_0xee60('0x1b')],{'raw':_0x37c7e7[_0xee60('0x1c')]?_0x37c7e7[_0xee60('0x1c')][_0xee60('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37c7e7['options']?_0x37c7e7['options'][_0xee60('0x1e')]||null:null,'attributes':_0x37c7e7[_0xee60('0x1c')]?_0x37c7e7[_0xee60('0x1c')][_0xee60('0x1f')]||null:null,'limit':_0x37c7e7[_0xee60('0x1c')]?_0x37c7e7[_0xee60('0x1c')]['limit']||null:null})[_0xee60('0xe')](function(_0x160151){logger[_0xee60('0x17')](_0xee60('0x19'),_0x37c7e7);logger['debug'](_0xee60('0x19'),_0x37c7e7,JSON[_0xee60('0x13')](_0x160151));_0x40e3fd(_0x160151);})[_0xee60('0x18')](function(_0x514d4e){logger['error'](_0xee60('0x19'),_0x514d4e[_0xee60('0x16')],_0x37c7e7);_0x40e80e(_0x3bb2ad[_0xee60('0x14')](0x1f4,_0x514d4e['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x12b878){return new Promise(function(_0x1d1704,_0x133d4e){return db[_0xee60('0x20')][_0xee60('0x21')]({'where':_0x12b878[_0xee60('0x1c')]?_0x12b878['options'][_0xee60('0x1e')]||null:null})['then'](function(_0x403734){if(_0x403734){return _0x403734[_0xee60('0x22')](_0x12b878[_0xee60('0x1b')]['ids'],_[_0xee60('0x23')](_0x12b878['body'],[_0xee60('0x24'),'id'])||{});}})[_0xee60('0x25')](function(_0x42ee86){logger[_0xee60('0x17')](_0xee60('0x26'),_0x12b878);logger[_0xee60('0x11')](_0xee60('0x26'),_0x12b878,JSON[_0xee60('0x13')](_0x42ee86));_0x1d1704(_0x42ee86);})[_0xee60('0x18')](function(_0x1a74c4){logger[_0xee60('0x14')](_0xee60('0x26'),_0x1a74c4[_0xee60('0x16')],_0x12b878);_0x133d4e(_this[_0xee60('0x14')](0x1f4,_0x1a74c4[_0xee60('0x16')]));});});}; \ No newline at end of file +var _0xb11c=['code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToFaxInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x295317,_0x46aebf){var _0x458246=function(_0x46f6ee){while(--_0x46f6ee){_0x295317['push'](_0x295317['shift']());}};_0x458246(++_0x46aebf);}(_0xb11c,0xc0));var _0xcb11=function(_0x5aa046,_0x73d090){_0x5aa046=_0x5aa046-0x0;var _0x31a7c7=_0xb11c[_0x5aa046];return _0x31a7c7;};'use strict';var _=require(_0xcb11('0x0'));var util=require(_0xcb11('0x1'));var moment=require(_0xcb11('0x2'));var BPromise=require('bluebird');var rs=require(_0xcb11('0x3'));var fs=require('fs');var Redis=require(_0xcb11('0x4'));var db=require(_0xcb11('0x5'))['db'];var utils=require(_0xcb11('0x6'));var logger=require(_0xcb11('0x7'))('rpc');var config=require(_0xcb11('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcb11('0x9')]({'port':0x232a});config[_0xcb11('0xa')]=_[_0xcb11('0xb')](config[_0xcb11('0xa')],{'host':_0xcb11('0xc'),'port':0x18eb});var socket=require(_0xcb11('0xd'))(new Redis(config['redis']));require(_0xcb11('0xe'))[_0xcb11('0xf')](socket);function respondWithRpcPromise(_0x4b94ab,_0x675308,_0x38b69b){return new BPromise(function(_0x29d532,_0x14e847){return client[_0xcb11('0x10')](_0x4b94ab,_0x38b69b)['then'](function(_0x403659){logger[_0xcb11('0x11')](_0xcb11('0x12'),_0x675308,_0xcb11('0x13'));logger[_0xcb11('0x14')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x675308,_0xcb11('0x13'),JSON[_0xcb11('0x15')](_0x403659));if(_0x403659['error']){if(_0x403659[_0xcb11('0x16')][_0xcb11('0x17')]===0x1f4){logger[_0xcb11('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x675308,_0x403659['error'][_0xcb11('0x18')]);return _0x14e847(_0x403659[_0xcb11('0x16')][_0xcb11('0x18')]);}logger[_0xcb11('0x16')](_0xcb11('0x12'),_0x675308,_0x403659[_0xcb11('0x16')][_0xcb11('0x18')]);return _0x29d532(_0x403659[_0xcb11('0x16')][_0xcb11('0x18')]);}else{logger[_0xcb11('0x11')](_0xcb11('0x12'),_0x675308,_0xcb11('0x13'));_0x29d532(_0x403659[_0xcb11('0x19')]['message']);}})[_0xcb11('0x1a')](function(_0x21a0cd){logger[_0xcb11('0x16')](_0xcb11('0x12'),_0x675308,_0x21a0cd);_0x14e847(_0x21a0cd);});});}exports[_0xcb11('0x1b')]=function(_0x2cb5fa){var _0x33278e=this;return new Promise(function(_0x144fa4,_0x2fc9d0){return db[_0xcb11('0x1c')][_0xcb11('0x1d')](_0x2cb5fa[_0xcb11('0x1e')],{'raw':_0x2cb5fa[_0xcb11('0x1f')]?_0x2cb5fa[_0xcb11('0x1f')][_0xcb11('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cb5fa[_0xcb11('0x1f')]?_0x2cb5fa[_0xcb11('0x1f')][_0xcb11('0x21')]||null:null,'attributes':_0x2cb5fa[_0xcb11('0x1f')]?_0x2cb5fa[_0xcb11('0x1f')][_0xcb11('0x22')]||null:null,'limit':_0x2cb5fa[_0xcb11('0x1f')]?_0x2cb5fa[_0xcb11('0x1f')][_0xcb11('0x23')]||null:null})[_0xcb11('0x24')](function(_0x2cb393){logger[_0xcb11('0x11')](_0xcb11('0x1b'),_0x2cb5fa);logger[_0xcb11('0x14')](_0xcb11('0x1b'),_0x2cb5fa,JSON[_0xcb11('0x15')](_0x2cb393));_0x144fa4(_0x2cb393);})[_0xcb11('0x1a')](function(_0x2fc8f9){logger['error'](_0xcb11('0x1b'),_0x2fc8f9[_0xcb11('0x18')],_0x2cb5fa);_0x2fc9d0(_0x33278e['error'](0x1f4,_0x2fc8f9[_0xcb11('0x18')]));});});};exports[_0xcb11('0x25')]=function(_0xa8a548){return new Promise(function(_0x2f419c,_0x13521f){return db[_0xcb11('0x1c')][_0xcb11('0x26')]({'where':_0xa8a548['options']?_0xa8a548[_0xcb11('0x1f')][_0xcb11('0x21')]||null:null})['then'](function(_0x3f1274){if(_0x3f1274){return _0x3f1274[_0xcb11('0x27')](_0xa8a548[_0xcb11('0x1e')][_0xcb11('0x28')],_[_0xcb11('0x29')](_0xa8a548['body'],[_0xcb11('0x28'),'id'])||{});}})['spread'](function(_0x46805c){logger[_0xcb11('0x11')](_0xcb11('0x2a'),_0xa8a548);logger[_0xcb11('0x14')](_0xcb11('0x2a'),_0xa8a548,JSON['stringify'](_0x46805c));_0x2f419c(_0x46805c);})['catch'](function(_0x1ad9e2){logger['error'](_0xcb11('0x2a'),_0x1ad9e2[_0xcb11('0x18')],_0xa8a548);_0x13521f(_this['error'](0x1f4,_0x1ad9e2[_0xcb11('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 9be2db8..1c02fcd 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 _0x2b89=['update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0x2b89,0x126));var _0x92b8=function(_0x226e70,_0x529df0){_0x226e70=_0x226e70-0x0;var _0x342b95=_0x2b89[_0x226e70];return _0x342b95;};'use strict';var FaxInteractionEvents=require(_0x92b8('0x0'));var events=[_0x92b8('0x1'),_0x92b8('0x2'),_0x92b8('0x3')];function createListener(_0x4d2fda,_0x2eb8c9){return function(_0x1ddeab){_0x2eb8c9[_0x92b8('0x4')](_0x4d2fda,_0x1ddeab);};}function removeListener(_0x37cb89,_0x77e7c9){return function(){FaxInteractionEvents[_0x92b8('0x5')](_0x37cb89,_0x77e7c9);};}exports[_0x92b8('0x6')]=function(_0x22fcac){for(var _0x56a156=0x0,_0x19f2b9=events[_0x92b8('0x7')];_0x56a156<_0x19f2b9;_0x56a156++){var _0x1bda0f=events[_0x56a156];var _0x2423c1=createListener(_0x92b8('0x8')+_0x1bda0f,_0x22fcac);FaxInteractionEvents['on'](_0x1bda0f,_0x2423c1);}}; \ No newline at end of file +var _0x3b5f=['remove','update','emit','removeListener','length','faxInteraction:','./faxInteraction.events','save'];(function(_0x5efc4c,_0x1c3244){var _0x2445b2=function(_0x277b47){while(--_0x277b47){_0x5efc4c['push'](_0x5efc4c['shift']());}};_0x2445b2(++_0x1c3244);}(_0x3b5f,0xa6));var _0xf3b5=function(_0x181164,_0x4cba0d){_0x181164=_0x181164-0x0;var _0x5be4f8=_0x3b5f[_0x181164];return _0x5be4f8;};'use strict';var FaxInteractionEvents=require(_0xf3b5('0x0'));var events=[_0xf3b5('0x1'),_0xf3b5('0x2'),_0xf3b5('0x3')];function createListener(_0xb477cb,_0x4460cd){return function(_0x5f13c3){_0x4460cd[_0xf3b5('0x4')](_0xb477cb,_0x5f13c3);};}function removeListener(_0x1372d1,_0x481265){return function(){FaxInteractionEvents[_0xf3b5('0x5')](_0x1372d1,_0x481265);};}exports['register']=function(_0x5600ce){for(var _0x523ebe=0x0,_0x454450=events[_0xf3b5('0x6')];_0x523ebe<_0x454450;_0x523ebe++){var _0x59b85d=events[_0x523ebe];var _0x10e402=createListener(_0xf3b5('0x7')+_0x59b85d,_0x5600ce);FaxInteractionEvents['on'](_0x59b85d,_0x10e402);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 2e214a4..e6b5573 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 _0x050e=['../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','update','delete','faxinteraction:destroy','removeTags','util','path','connect-timeout','express','Router'];(function(_0x4d75b3,_0x50e9eb){var _0x4e5813=function(_0x2b9c80){while(--_0x2b9c80){_0x4d75b3['push'](_0x4d75b3['shift']());}};_0x4e5813(++_0x50e9eb);}(_0x050e,0x131));var _0xe050=function(_0x3cedf9,_0x33753d){_0x3cedf9=_0x3cedf9-0x0;var _0x3ede26=_0x050e[_0x3cedf9];return _0x3ede26;};'use strict';var multer=require('multer');var util=require(_0xe050('0x0'));var path=require(_0xe050('0x1'));var timeout=require(_0xe050('0x2'));var express=require(_0xe050('0x3'));var router=express[_0xe050('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe050('0x5'));var config=require(_0xe050('0x6'));var controller=require(_0xe050('0x7'));router[_0xe050('0x8')]('/',auth['isAuthenticated'](),controller[_0xe050('0x9')]);router[_0xe050('0x8')](_0xe050('0xa'),auth['isAuthenticated'](),controller[_0xe050('0xb')]);router[_0xe050('0x8')](_0xe050('0xc'),auth[_0xe050('0xd')](),controller[_0xe050('0xe')]);router['get']('/:id/messages',auth[_0xe050('0xd')](),controller['getMessages']);router['get'](_0xe050('0xf'),auth[_0xe050('0xd')](),controller[_0xe050('0x10')]);router[_0xe050('0x11')]('/',auth['isAuthenticated'](),controller[_0xe050('0x12')]);router[_0xe050('0x11')](_0xe050('0x13'),auth[_0xe050('0xd')](),controller[_0xe050('0x14')]);router[_0xe050('0x11')](_0xe050('0x15'),auth[_0xe050('0xd')](),interaction[_0xe050('0x16')](_0xe050('0x17'),_0xe050('0x18')),controller[_0xe050('0x19')]);router[_0xe050('0x1a')]('/:id',auth[_0xe050('0xd')](),interaction[_0xe050('0x16')](_0xe050('0x17'),'faxinteraction:update'),controller[_0xe050('0x1b')]);router[_0xe050('0x1c')](_0xe050('0xc'),auth[_0xe050('0xd')](),interaction['tracked'](_0xe050('0x17'),_0xe050('0x1d')),controller['destroy']);router[_0xe050('0x1c')](_0xe050('0x15'),auth[_0xe050('0xd')](),controller[_0xe050('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x09d8=['faxinteraction:update','faxinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','fax','faxinteraction:addtags','addTags','tracked'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x09d8,0x1d5));var _0x809d=function(_0x3cf053,_0x7a9947){_0x3cf053=_0x3cf053-0x0;var _0x3b55a0=_0x09d8[_0x3cf053];return _0x3b55a0;};'use strict';var multer=require('multer');var util=require(_0x809d('0x0'));var path=require('path');var timeout=require(_0x809d('0x1'));var express=require(_0x809d('0x2'));var router=express[_0x809d('0x3')]();var fs_extra=require(_0x809d('0x4'));var auth=require(_0x809d('0x5'));var interaction=require(_0x809d('0x6'));var config=require(_0x809d('0x7'));var controller=require('./faxInteraction.controller');router[_0x809d('0x8')]('/',auth[_0x809d('0x9')](),controller['index']);router[_0x809d('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x809d('0xa'),auth['isAuthenticated'](),controller[_0x809d('0xb')]);router['get'](_0x809d('0xc'),auth['isAuthenticated'](),controller[_0x809d('0xd')]);router['get'](_0x809d('0xe'),auth[_0x809d('0x9')](),controller[_0x809d('0xf')]);router['post']('/',auth[_0x809d('0x9')](),controller[_0x809d('0x10')]);router[_0x809d('0x11')](_0x809d('0xc'),auth[_0x809d('0x9')](),controller[_0x809d('0x12')]);router[_0x809d('0x11')](_0x809d('0x13'),auth[_0x809d('0x9')](),interaction['tracked'](_0x809d('0x14'),_0x809d('0x15')),controller[_0x809d('0x16')]);router['put'](_0x809d('0xa'),auth[_0x809d('0x9')](),interaction[_0x809d('0x17')](_0x809d('0x14'),_0x809d('0x18')),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x809d('0x14'),_0x809d('0x19')),controller[_0x809d('0x1a')]);router['delete']('/:id/tags',auth[_0x809d('0x9')](),controller[_0x809d('0x1b')]);module[_0x809d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index bfcf3c1..0853459 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 _0xf257=['BOOLEAN','ENUM','out','DATE','TEXT','medium'];(function(_0x16a757,_0x17c6ea){var _0x5f316a=function(_0x584b49){while(--_0x584b49){_0x16a757['push'](_0x16a757['shift']());}};_0x5f316a(++_0x17c6ea);}(_0xf257,0x82));var _0x7f25=function(_0x447ce1,_0x11cf0b){_0x447ce1=_0x447ce1-0x0;var _0x4c1e7a=_0xf257[_0x447ce1];return _0x4c1e7a;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x7f25('0x0')](_0x7f25('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x7f25('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7f25('0x3')]('in','out'),'defaultValue':_0x7f25('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x7f25('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7f25('0x5')]}}; \ No newline at end of file +var _0xa7b4=['DATE','exports','TEXT','BOOLEAN','ENUM'];(function(_0x1196b0,_0x36c47a){var _0x111c52=function(_0x5604c7){while(--_0x5604c7){_0x1196b0['push'](_0x1196b0['shift']());}};_0x111c52(++_0x36c47a);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x5612cf,_0x36d8b9){_0x5612cf=_0x5612cf-0x0;var _0x8b92bd=_0xa7b4[_0x5612cf];return _0x8b92bd;};'use strict';var Sequelize=require('sequelize');module[_0x4a7b('0x0')]={'body':{'type':Sequelize[_0x4a7b('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4a7b('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4a7b('0x3')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x4a7b('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 21dfa55..b440b42 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 _0x1139=['fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','FaxMessage','includeAll','findAll','rows','keys','include','body','params','destroy','describe','fax-interactions','accept','fax','read','readAt','UserId','agent','find','get','FaxInteraction','FaxInteractionId','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','role','rejectMessage','sequelize','QueryTypes','internal','event','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','isNil','/var/opt/motion2/server/files/attachments/%s','join','root','files','attachments','eml-format','rimraf','zip-dir','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','status','end','offset','limit','count','json','reject','save','update','sendStatus','name','send','index','map','rawAttributes'];(function(_0x497ee0,_0x17c87c){var _0x47c05a=function(_0x1a8c81){while(--_0x1a8c81){_0x497ee0['push'](_0x497ee0['shift']());}};_0x47c05a(++_0x17c87c);}(_0x1139,0xd5));var _0x9113=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1139[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x9113('0x0'));var rimraf=require(_0x9113('0x1'));var zipdir=require(_0x9113('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9113('0x3'));var BPromise=require(_0x9113('0x4'));var Mustache=require('mustache');var util=require(_0x9113('0x5'));var path=require(_0x9113('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9113('0x7'));var fs=require('fs');var fs_extra=require(_0x9113('0x8'));var _=require(_0x9113('0x9'));var squel=require(_0x9113('0xa'));var crypto=require(_0x9113('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9113('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9113('0xd'));var qs=require(_0x9113('0xe'));var as=require(_0x9113('0xf'));var hardwareService=require(_0x9113('0x10'));var logger=require(_0x9113('0x11'))('api');var utils=require(_0x9113('0x12'));var config=require(_0x9113('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9113('0x14'))['db'];config[_0x9113('0x15')]=_[_0x9113('0x16')](config[_0x9113('0x15')],{'host':_0x9113('0x17'),'port':0x18eb});var socket=require(_0x9113('0x18'))(new Redis(config[_0x9113('0x15')]));require(_0x9113('0x19'))[_0x9113('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9113('0x1b')][_0x9113('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x9113('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x6f4487,_0x1f5b43,_0x24e8d9,_0x1437fe){return new BPromise(function(_0x3618c9,_0x55c605){var _0x4f2feb=_0x1437fe||client;return _0x4f2feb['request'](_0x6f4487,_0x24e8d9)[_0x9113('0x1d')](function(_0x26581e){logger[_0x9113('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x1f5b43,_0x9113('0x1f'));logger['debug'](_0x9113('0x20'),_0x1f5b43,_0x9113('0x1f'),JSON[_0x9113('0x21')](_0x26581e));if(_0x26581e['error']){if(_0x26581e[_0x9113('0x22')][_0x9113('0x23')]===0x1f4){logger['error'](_0x9113('0x24'),_0x1f5b43,_0x26581e[_0x9113('0x22')][_0x9113('0x25')]);return _0x55c605(_0x26581e[_0x9113('0x22')][_0x9113('0x25')]);}logger['error'](_0x9113('0x24'),_0x1f5b43,_0x26581e[_0x9113('0x22')][_0x9113('0x25')]);return _0x3618c9(_0x26581e[_0x9113('0x22')][_0x9113('0x25')]);}else{logger[_0x9113('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x1f5b43,_0x9113('0x1f'));_0x3618c9(_0x26581e[_0x9113('0x26')][_0x9113('0x25')]);}})[_0x9113('0x27')](function(_0x28e5e5){logger[_0x9113('0x22')](_0x9113('0x24'),_0x1f5b43,_0x28e5e5);_0x55c605(_0x28e5e5);});});}function respondWithStatusCode(_0xdb6fe7,_0x56e9f5){_0x56e9f5=_0x56e9f5||0xcc;return function(_0x498c7a){if(_0x498c7a){return _0xdb6fe7['sendStatus'](_0x56e9f5);}return _0xdb6fe7[_0x9113('0x28')](_0x56e9f5)[_0x9113('0x29')]();};}function respondWithResult(_0x3c1345,_0x107bbf){_0x107bbf=_0x107bbf||0xc8;return function(_0x17d186){if(_0x17d186){return _0x3c1345[_0x9113('0x28')](_0x107bbf)['json'](_0x17d186);}};}function respondWithFilteredResult(_0x135e28,_0x499048){return function(_0x13aa58){if(_0x13aa58){var _0x1ff53a=typeof _0x499048[_0x9113('0x2a')]==='undefined'&&typeof _0x499048[_0x9113('0x2b')]==='undefined';var _0x2e9c72=_0x13aa58[_0x9113('0x2c')];var _0x4202b6=_0x1ff53a?0x0:_0x499048[_0x9113('0x2a')];var _0x47a312=_0x1ff53a?_0x13aa58['count']:_0x499048['offset']+_0x499048[_0x9113('0x2b')];var _0x168416;if(_0x47a312>=_0x2e9c72){_0x47a312=_0x2e9c72;_0x168416=0xc8;}else{_0x168416=0xce;}_0x135e28[_0x9113('0x28')](_0x168416);return _0x135e28['set']('Content-Range',_0x4202b6+'-'+_0x47a312+'/'+_0x2e9c72)[_0x9113('0x2d')](_0x13aa58);}return null;};}function patchUpdates(_0x16a38b){return function(_0x1ba6bb){try{jsonpatch['apply'](_0x1ba6bb,_0x16a38b,!![]);}catch(_0x456cbe){return BPromise[_0x9113('0x2e')](_0x456cbe);}return _0x1ba6bb[_0x9113('0x2f')]();};}function saveUpdates(_0x542d37,_0x544bc8){return function(_0x402826){if(_0x402826){return _0x402826[_0x9113('0x30')](_0x542d37)[_0x9113('0x1d')](function(_0x537212){return _0x537212;});}return null;};}function removeEntity(_0x4a8783,_0x36ad9d){return function(_0x1585fd){if(_0x1585fd){return _0x1585fd['destroy']()[_0x9113('0x1d')](function(){_0x4a8783[_0x9113('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32c162,_0x3148e3){return function(_0x164d16){if(!_0x164d16){_0x32c162[_0x9113('0x31')](0x194);}return _0x164d16;};}function handleError(_0x126ec1,_0xf6f434){_0xf6f434=_0xf6f434||0x1f4;return function(_0x41d981){logger['error'](_0x41d981['stack']);if(_0x41d981[_0x9113('0x32')]){delete _0x41d981['name'];}_0x126ec1[_0x9113('0x28')](_0xf6f434)[_0x9113('0x33')](_0x41d981);};}exports[_0x9113('0x34')]=function(_0x192e1f,_0x415ccc){var _0x1d69eb={},_0x45c664={},_0x1d4e77={'count':0x0,'rows':[]};var _0x1afd24=_[_0x9113('0x35')](db['FaxMessage'][_0x9113('0x36')],function(_0x5575e8){return{'name':_0x5575e8[_0x9113('0x37')],'type':_0x5575e8['type']['key']};});_0x45c664[_0x9113('0x38')]=_[_0x9113('0x35')](_0x1afd24,_0x9113('0x32'));_0x45c664[_0x9113('0x39')]=_['keys'](_0x192e1f[_0x9113('0x39')]);_0x45c664[_0x9113('0x3a')]=_[_0x9113('0x3b')](_0x45c664['model'],_0x45c664[_0x9113('0x39')]);_0x1d69eb[_0x9113('0x3c')]=_[_0x9113('0x3b')](_0x45c664[_0x9113('0x38')],qs[_0x9113('0x3d')](_0x192e1f[_0x9113('0x39')]['fields']));_0x1d69eb[_0x9113('0x3c')]=_0x1d69eb[_0x9113('0x3c')][_0x9113('0x3e')]?_0x1d69eb[_0x9113('0x3c')]:_0x45c664[_0x9113('0x38')];if(!_0x192e1f[_0x9113('0x39')][_0x9113('0x3f')](_0x9113('0x40'))){_0x1d69eb[_0x9113('0x2b')]=qs[_0x9113('0x2b')](_0x192e1f[_0x9113('0x39')][_0x9113('0x2b')]);_0x1d69eb[_0x9113('0x2a')]=qs['offset'](_0x192e1f['query'][_0x9113('0x2a')]);}_0x1d69eb[_0x9113('0x41')]=qs[_0x9113('0x42')](_0x192e1f[_0x9113('0x39')][_0x9113('0x42')]);_0x1d69eb[_0x9113('0x43')]=qs[_0x9113('0x3a')](_[_0x9113('0x44')](_0x192e1f[_0x9113('0x39')],_0x45c664[_0x9113('0x3a')]),_0x1afd24);if(_0x192e1f['query'][_0x9113('0x45')]){_0x1d69eb[_0x9113('0x43')]=_['merge'](_0x1d69eb[_0x9113('0x43')],{'$or':_[_0x9113('0x35')](_0x1afd24,function(_0x1fa8ef){if(_0x1fa8ef[_0x9113('0x46')]!=='VIRTUAL'){var _0x3dfa7a={};_0x3dfa7a[_0x1fa8ef[_0x9113('0x32')]]={'$like':'%'+_0x192e1f['query'][_0x9113('0x45')]+'%'};return _0x3dfa7a;}})});}_0x1d69eb=_[_0x9113('0x47')]({},_0x1d69eb,_0x192e1f[_0x9113('0x48')]);var _0x10662b={'where':_0x1d69eb[_0x9113('0x43')]};return db[_0x9113('0x49')][_0x9113('0x2c')](_0x10662b)[_0x9113('0x1d')](function(_0x265e9a){_0x1d4e77['count']=_0x265e9a;if(_0x192e1f[_0x9113('0x39')][_0x9113('0x4a')]){_0x1d69eb['include']=[{'all':!![]}];}return db[_0x9113('0x49')][_0x9113('0x4b')](_0x1d69eb);})[_0x9113('0x1d')](function(_0x90953d){_0x1d4e77[_0x9113('0x4c')]=_0x90953d;return _0x1d4e77;})[_0x9113('0x1d')](respondWithFilteredResult(_0x415ccc,_0x1d69eb))['catch'](handleError(_0x415ccc,null));};exports['show']=function(_0x474055,_0x7695ac){var _0xd9cb4={'raw':!![],'where':{'id':_0x474055['params']['id']}},_0x28921c={};_0x28921c['model']=_[_0x9113('0x4d')](db[_0x9113('0x49')][_0x9113('0x36')]);_0x28921c[_0x9113('0x39')]=_[_0x9113('0x4d')](_0x474055['query']);_0x28921c[_0x9113('0x3a')]=_[_0x9113('0x3b')](_0x28921c[_0x9113('0x38')],_0x28921c[_0x9113('0x39')]);_0xd9cb4[_0x9113('0x3c')]=_[_0x9113('0x3b')](_0x28921c[_0x9113('0x38')],qs[_0x9113('0x3d')](_0x474055[_0x9113('0x39')][_0x9113('0x3d')]));_0xd9cb4[_0x9113('0x3c')]=_0xd9cb4[_0x9113('0x3c')][_0x9113('0x3e')]?_0xd9cb4[_0x9113('0x3c')]:_0x28921c['model'];if(_0x474055[_0x9113('0x39')][_0x9113('0x4a')]){_0xd9cb4[_0x9113('0x4e')]=[{'all':!![]}];}_0xd9cb4=_[_0x9113('0x47')]({},_0xd9cb4,_0x474055['options']);return db[_0x9113('0x49')]['find'](_0xd9cb4)[_0x9113('0x1d')](handleEntityNotFound(_0x7695ac,null))[_0x9113('0x1d')](respondWithResult(_0x7695ac,null))[_0x9113('0x27')](handleError(_0x7695ac,null));};exports[_0x9113('0x30')]=function(_0x44cb5b,_0x120616){if(_0x44cb5b[_0x9113('0x4f')]['id']){delete _0x44cb5b[_0x9113('0x4f')]['id'];}return db[_0x9113('0x49')]['find']({'where':{'id':_0x44cb5b[_0x9113('0x50')]['id']}})['then'](handleEntityNotFound(_0x120616,null))[_0x9113('0x1d')](saveUpdates(_0x44cb5b['body'],null))[_0x9113('0x1d')](respondWithResult(_0x120616,null))[_0x9113('0x27')](handleError(_0x120616,null));};exports[_0x9113('0x51')]=function(_0x44a9a4,_0xb683a0){return db['FaxMessage']['find']({'where':{'id':_0x44a9a4['params']['id']}})['then'](handleEntityNotFound(_0xb683a0,null))['then'](removeEntity(_0xb683a0,null))['catch'](handleError(_0xb683a0,null));};exports['describe']=function(_0x3aee55,_0x4fd154){return db[_0x9113('0x49')][_0x9113('0x52')]()['then'](respondWithResult(_0x4fd154,null))['catch'](handleError(_0x4fd154,null));};var interaction_log=require(_0x9113('0x11'))(_0x9113('0x53'));exports[_0x9113('0x54')]=function(_0xf94750,_0x211172,_0xf5b2af){var _0x4ebc54={'agent':{},'channel':_0x9113('0x55')};if(_0xf94750[_0x9113('0x4f')]['id']){delete _0xf94750[_0x9113('0x4f')]['id'];}_0xf94750[_0x9113('0x4f')][_0x9113('0x56')]=!![];_0xf94750['body'][_0x9113('0x57')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xf94750[_0x9113('0x4f')][_0x9113('0x58')]=_0xf94750[_0x9113('0x4f')][_0x9113('0x58')]||_0xf94750['user']['id'];_0x4ebc54[_0x9113('0x59')]['id']=_0xf94750['body'][_0x9113('0x58')];return db[_0x9113('0x49')][_0x9113('0x5a')]({'where':{'id':_0xf94750['params']['id'],'UserId':null}})[_0x9113('0x1d')](handleEntityNotFound(_0x211172,null))[_0x9113('0x1d')](saveUpdates(_0xf94750[_0x9113('0x4f')],null))[_0x9113('0x1d')](function(_0x11417c){if(_0x11417c){_0x4ebc54['message']=_0x11417c[_0x9113('0x5b')]({'plain':!![]});return db[_0x9113('0x5c')][_0x9113('0x5a')]({'where':{'id':_0x11417c[_0x9113('0x5d')]}});}return null;})[_0x9113('0x1d')](handleEntityNotFound(_0x211172,null))[_0x9113('0x1d')](function(_0x292ac8){if(_0x292ac8){return _0x292ac8[_0x9113('0x30')]({'UserId':_0xf94750[_0x9113('0x4f')][_0x9113('0x58')],'read1stAt':_['isNil'](_0x292ac8['read1stAt'])?moment()[_0x9113('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9113('0x1d')](function(_0x52ac56){if(_0x52ac56){_0x4ebc54[_0x9113('0x5f')]=_0x52ac56[_0x9113('0x5b')]({'plain':!![]});interaction_log[_0x9113('0x1e')](_0x9113('0x60'),_0xf94750[_0x9113('0x61')]['id'],_0xf94750[_0x9113('0x61')][_0x9113('0x32')],_0xf94750[_0x9113('0x61')]['role'],_0x4ebc54[_0x9113('0x5f')]['id'],_0xf94750[_0x9113('0x4f')]?JSON[_0x9113('0x21')](_0xf94750[_0x9113('0x4f')]):_0x9113('0x62'));return respondWithRpcPromise('AcceptMessage',_0x9113('0x63'),_0x4ebc54);}return null;})[_0x9113('0x1d')](function(_0x21f259){var _0x9052b8=_0x9113('0x64')+_0x21f259['message'][_0x9113('0x65')];return db['sequelize']['query'](_0x9052b8,{'type':db[_0x9113('0x66')]['QueryTypes'][_0x9113('0x67')],'raw':!![]})[_0x9113('0x1d')](function(_0x105052){return _0x105052;});})['then'](function(_0x5ed42b){if(_0x5ed42b){_0x4ebc54[_0x9113('0x25')][_0x9113('0x68')]=_0x5ed42b[0x0];if(!_0xf94750[_0x9113('0x4f')][_0x9113('0x58')])return;return db[_0x9113('0x69')]['find']({'where':{'id':_0xf94750['body']['UserId'],'role':_0x9113('0x59')},'attributes':['id',_0x9113('0x32'),_0x9113('0x6a'),_0x9113('0x6b'),'internal'],'raw':!![]});}return null;})['then'](function(_0x57df10){if(!_0x57df10)return null;_0x4ebc54[_0x9113('0x25')][_0x9113('0x59')]=_0x57df10;return _0x4ebc54;})[_0x9113('0x1d')](function(_0x4e43f2){if(_0x4e43f2){if(_0xf94750[_0x9113('0x4f')][_0x9113('0x6c')]){_0x4ebc54[_0x9113('0x25')][_0x9113('0x6d')]=util[_0x9113('0x5e')](_0x9113('0x6e'),_0xf94750[_0x9113('0x61')][_0x9113('0x32')]);_0x4ebc54[_0x9113('0x25')][_0x9113('0x6f')]=_0x4ebc54[_0x9113('0x6f')];_0x4ebc54[_0x9113('0x25')][_0x9113('0x70')]=_0x4ebc54[_0x9113('0x6f')];_0x4ebc54[_0x9113('0x25')]['event']=_0x9113('0x54');return respondWithRpcPromise(_0x9113('0x71'),_0x9113('0x71'),{'event':_0x9113('0x72'),'message':_0x4ebc54[_0x9113('0x25')]},client9002)[_0x9113('0x1d')](function(){return _0x4ebc54;});}return _0x4ebc54;}return null;})[_0x9113('0x1d')](respondWithResult(_0x211172,null))[_0x9113('0x27')](handleError(_0x211172,null));};var interaction_log=require(_0x9113('0x11'))(_0x9113('0x53'));exports[_0x9113('0x2e')]=function(_0x5d0e81,_0x428e8c,_0x46677b){var _0xc09614={'agent':{},'channel':_0x9113('0x55')};if(_0x5d0e81[_0x9113('0x4f')]['id']){delete _0x5d0e81[_0x9113('0x4f')]['id'];}_0x5d0e81['body'][_0x9113('0x58')]=_0x5d0e81[_0x9113('0x4f')][_0x9113('0x58')]||_0x5d0e81['user']['id'];_0xc09614['agent']['id']=_0x5d0e81[_0x9113('0x4f')][_0x9113('0x58')];return db[_0x9113('0x49')]['find']({'where':{'id':_0x5d0e81['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x428e8c,null))[_0x9113('0x1d')](function(_0x4e5c31){if(_0x4e5c31){_0xc09614['message']=_0x4e5c31[_0x9113('0x5b')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x4e5c31[_0x9113('0x5d')]}});}return null;})[_0x9113('0x1d')](handleEntityNotFound(_0x428e8c,null))[_0x9113('0x1d')](function(_0x1f2ae5){if(_0x1f2ae5){_0xc09614['interaction']=_0x1f2ae5[_0x9113('0x5b')]({'plain':!![]});interaction_log[_0x9113('0x1e')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5d0e81[_0x9113('0x61')]['id'],_0x5d0e81[_0x9113('0x61')][_0x9113('0x32')],_0x5d0e81[_0x9113('0x61')][_0x9113('0x73')],_0xc09614[_0x9113('0x5f')]['id'],_0x5d0e81[_0x9113('0x4f')]?JSON[_0x9113('0x21')](_0x5d0e81[_0x9113('0x4f')]):_0x9113('0x62'));return respondWithRpcPromise('RejectMessage',_0x9113('0x74'),_0xc09614);}return null;})[_0x9113('0x1d')](function(_0x394a9a){var _0xeebfcc=_0x9113('0x64')+_0x394a9a['message'][_0x9113('0x65')];return db[_0x9113('0x75')][_0x9113('0x39')](_0xeebfcc,{'type':db[_0x9113('0x66')][_0x9113('0x76')][_0x9113('0x67')],'raw':!![]})[_0x9113('0x1d')](function(_0x63a7a0){return _0x63a7a0;});})['then'](function(_0x6136d){if(_0x6136d){_0xc09614[_0x9113('0x25')][_0x9113('0x68')]=_0x6136d[0x0];if(!_0x5d0e81['body'][_0x9113('0x58')])return;return db[_0x9113('0x69')][_0x9113('0x5a')]({'where':{'id':_0x5d0e81[_0x9113('0x4f')][_0x9113('0x58')],'role':'agent'},'attributes':['id',_0x9113('0x32'),'fullname',_0x9113('0x6b'),_0x9113('0x77')],'raw':!![]});}return null;})[_0x9113('0x1d')](function(_0x2d55f9){if(!_0x2d55f9)return null;_0xc09614[_0x9113('0x25')]['agent']=_0x2d55f9;return _0xc09614;})[_0x9113('0x1d')](function(_0x32b833){if(_0x32b833){_0x32b833[_0x9113('0x25')]['interface']=util[_0x9113('0x5e')](_0x9113('0x6e'),_0x5d0e81['user'][_0x9113('0x32')]);_0x32b833['message']['channel']=_0xc09614['channel'];_0x32b833[_0x9113('0x25')][_0x9113('0x70')]=_0xc09614['channel'];_0x32b833[_0x9113('0x25')][_0x9113('0x78')]='reject';respondWithRpcPromise(_0x9113('0x71'),_0x9113('0x71'),{'event':_0x9113('0x79'),'message':_0x32b833[_0x9113('0x25')]},client9002);return _0xc09614;}return null;})['then'](respondWithResult(_0x428e8c,null))[_0x9113('0x27')](handleError(_0x428e8c,null));};exports[_0x9113('0x7a')]=function(_0x192615,_0x1fc23d){var _0x1f9a14;return db[_0x9113('0x49')][_0x9113('0x7a')](_0x192615[_0x9113('0x4f')],{})['then'](function(_0x4ec32f){_0x1f9a14=_0x4ec32f;return db[_0x9113('0x7b')][_0x9113('0x7c')]({'where':{'id':_0x1f9a14['ContactId']}});})[_0x9113('0x1d')](function(_0x418022){if(_['isNil'](_0x418022)){return;}else{_0x1f9a14[_0x9113('0x55')]=_0x418022[_0x9113('0x55')];return db[_0x9113('0x7d')]['findOne']({'where':{'id':_0x1f9a14[_0x9113('0x7e')]}});}})[_0x9113('0x1d')](function(_0x426716){return respondWithRpcPromise(_0x9113('0x7f'),'SendFax',{'FaxAccountId':_[_0x9113('0x80')](_0x192615['body'])?undefined:_0x192615[_0x9113('0x4f')]['FaxAccountId'],'path':_[_0x9113('0x80')](_0x426716)?undefined:util['format'](_0x9113('0x81'),_0x426716['basename']),'fax':_[_0x9113('0x80')](_0x1f9a14[_0x9113('0x55')])?undefined:_0x1f9a14['fax'],'AttachmentId':_0x1f9a14[_0x9113('0x7e')]},client9002);})[_0x9113('0x1d')](respondWithResult(_0x1fc23d,0xc9))[_0x9113('0x27')](handleError(_0x1fc23d,null));};exports['download']=function(_0x13ee69,_0x10ec47){var _0xa9fc9=path[_0x9113('0x82')](config[_0x9113('0x83')],'server',_0x9113('0x84'),_0x9113('0x85'));return db[_0x9113('0x49')][_0x9113('0x5a')]({'where':{'id':_0x13ee69[_0x9113('0x50')]['id']},'include':[{'model':db[_0x9113('0x7d')],'as':_0x9113('0x7d')}]})[_0x9113('0x1d')](handleEntityNotFound(_0x10ec47,null))[_0x9113('0x1d')](function(_0x56ceb4){if(_0x56ceb4){return _0x10ec47['download'](path[_0x9113('0x82')](_0xa9fc9,_0x56ceb4['Attachment']['basename']));}})[_0x9113('0x27')](handleError(_0x10ec47,null));}; \ No newline at end of file +var _0x8ae5=['Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','end','stack','name','send','FaxMessage','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','rawAttributes','length','body','find','destroy','params','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','stringify','null','AcceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','email','interface','rejectmessage','CmContact','isNil'];(function(_0x2181dc,_0x6a8b82){var _0x2fe9a6=function(_0x56a028){while(--_0x56a028){_0x2181dc['push'](_0x2181dc['shift']());}};_0x2fe9a6(++_0x6a8b82);}(_0x8ae5,0x1ac));var _0x58ae=function(_0x52a133,_0x53f647){_0x52a133=_0x52a133-0x0;var _0x2157ab=_0x8ae5[_0x52a133];return _0x2157ab;};'use strict';var emlformat=require(_0x58ae('0x0'));var rimraf=require(_0x58ae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58ae('0x2'));var rp=require(_0x58ae('0x3'));var moment=require('moment');var BPromise=require(_0x58ae('0x4'));var Mustache=require('mustache');var util=require(_0x58ae('0x5'));var path=require(_0x58ae('0x6'));var sox=require(_0x58ae('0x7'));var csv=require('to-csv');var ejs=require(_0x58ae('0x8'));var fs=require('fs');var fs_extra=require(_0x58ae('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x58ae('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x58ae('0xb'));var querystring=require(_0x58ae('0xc'));var Papa=require(_0x58ae('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x58ae('0xe'));var as=require(_0x58ae('0xf'));var hardwareService=require(_0x58ae('0x10'));var logger=require(_0x58ae('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x58ae('0x12'));var licenseUtil=require(_0x58ae('0x13'));var db=require(_0x58ae('0x14'))['db'];config[_0x58ae('0x15')]=_[_0x58ae('0x16')](config[_0x58ae('0x15')],{'host':_0x58ae('0x17'),'port':0x18eb});var socket=require(_0x58ae('0x18'))(new Redis(config[_0x58ae('0x15')]));require('./faxMessage.socket')[_0x58ae('0x19')](socket);var jayson=require(_0x58ae('0x1a'));var client=jayson[_0x58ae('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0x58ae('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x420387,_0x38c711,_0x3b9109,_0x56bb3b){return new BPromise(function(_0x30d23e,_0x59bd57){var _0x348c9c=_0x56bb3b||client;return _0x348c9c['request'](_0x420387,_0x3b9109)[_0x58ae('0x1d')](function(_0x22efd9){logger[_0x58ae('0x1e')](_0x58ae('0x1f'),_0x38c711,'request\x20sent');logger[_0x58ae('0x20')](_0x58ae('0x21'),_0x38c711,_0x58ae('0x22'),JSON['stringify'](_0x22efd9));if(_0x22efd9[_0x58ae('0x23')]){if(_0x22efd9['error'][_0x58ae('0x24')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x38c711,_0x22efd9[_0x58ae('0x23')][_0x58ae('0x25')]);return _0x59bd57(_0x22efd9['error'][_0x58ae('0x25')]);}logger['error'](_0x58ae('0x1f'),_0x38c711,_0x22efd9[_0x58ae('0x23')][_0x58ae('0x25')]);return _0x30d23e(_0x22efd9['error']['message']);}else{logger['info'](_0x58ae('0x1f'),_0x38c711,'request\x20sent');_0x30d23e(_0x22efd9[_0x58ae('0x26')][_0x58ae('0x25')]);}})[_0x58ae('0x27')](function(_0x15a0fc){logger['error'](_0x58ae('0x1f'),_0x38c711,_0x15a0fc);_0x59bd57(_0x15a0fc);});});}function respondWithStatusCode(_0xbc4d26,_0x3e6937){_0x3e6937=_0x3e6937||0xcc;return function(_0x1215a2){if(_0x1215a2){return _0xbc4d26[_0x58ae('0x28')](_0x3e6937);}return _0xbc4d26['status'](_0x3e6937)['end']();};}function respondWithResult(_0xf75b4e,_0x46a564){_0x46a564=_0x46a564||0xc8;return function(_0xc5252c){if(_0xc5252c){return _0xf75b4e[_0x58ae('0x29')](_0x46a564)['json'](_0xc5252c);}};}function respondWithFilteredResult(_0x138c89,_0x42abd4){return function(_0x50b027){if(_0x50b027){var _0x15faeb=typeof _0x42abd4[_0x58ae('0x2a')]===_0x58ae('0x2b')&&typeof _0x42abd4[_0x58ae('0x2c')]===_0x58ae('0x2b');var _0x458b8d=_0x50b027[_0x58ae('0x2d')];var _0x32c028=_0x15faeb?0x0:_0x42abd4[_0x58ae('0x2a')];var _0xe76a63=_0x15faeb?_0x50b027[_0x58ae('0x2d')]:_0x42abd4[_0x58ae('0x2a')]+_0x42abd4[_0x58ae('0x2c')];var _0x3545c7;if(_0xe76a63>=_0x458b8d){_0xe76a63=_0x458b8d;_0x3545c7=0xc8;}else{_0x3545c7=0xce;}_0x138c89['status'](_0x3545c7);return _0x138c89[_0x58ae('0x2e')]('Content-Range',_0x32c028+'-'+_0xe76a63+'/'+_0x458b8d)[_0x58ae('0x2f')](_0x50b027);}return null;};}function patchUpdates(_0x2fa158){return function(_0x2ed9f1){try{jsonpatch[_0x58ae('0x30')](_0x2ed9f1,_0x2fa158,!![]);}catch(_0x45bae2){return BPromise[_0x58ae('0x31')](_0x45bae2);}return _0x2ed9f1[_0x58ae('0x32')]();};}function saveUpdates(_0x475288,_0x44620e){return function(_0x45f590){if(_0x45f590){return _0x45f590[_0x58ae('0x33')](_0x475288)['then'](function(_0x111459){return _0x111459;});}return null;};}function removeEntity(_0x10aace,_0x5ddaab){return function(_0x1ed73b){if(_0x1ed73b){return _0x1ed73b['destroy']()[_0x58ae('0x1d')](function(){_0x10aace[_0x58ae('0x29')](0xcc)[_0x58ae('0x34')]();});}};}function handleEntityNotFound(_0x37d67d,_0x1979f1){return function(_0x498937){if(!_0x498937){_0x37d67d[_0x58ae('0x28')](0x194);}return _0x498937;};}function handleError(_0xd7061,_0xa4aa90){_0xa4aa90=_0xa4aa90||0x1f4;return function(_0x50c307){logger[_0x58ae('0x23')](_0x50c307[_0x58ae('0x35')]);if(_0x50c307[_0x58ae('0x36')]){delete _0x50c307[_0x58ae('0x36')];}_0xd7061[_0x58ae('0x29')](_0xa4aa90)[_0x58ae('0x37')](_0x50c307);};}exports['index']=function(_0x19015c,_0x2bded0){var _0x4088db={},_0x31679b={},_0x15e4e7={'count':0x0,'rows':[]};var _0x16da6b=_['map'](db[_0x58ae('0x38')]['rawAttributes'],function(_0x16b245){return{'name':_0x16b245[_0x58ae('0x39')],'type':_0x16b245[_0x58ae('0x3a')]['key']};});_0x31679b['model']=_['map'](_0x16da6b,'name');_0x31679b[_0x58ae('0x3b')]=_[_0x58ae('0x3c')](_0x19015c[_0x58ae('0x3b')]);_0x31679b[_0x58ae('0x3d')]=_[_0x58ae('0x3e')](_0x31679b[_0x58ae('0x3f')],_0x31679b[_0x58ae('0x3b')]);_0x4088db['attributes']=_[_0x58ae('0x3e')](_0x31679b[_0x58ae('0x3f')],qs['fields'](_0x19015c['query'][_0x58ae('0x40')]));_0x4088db['attributes']=_0x4088db[_0x58ae('0x41')]['length']?_0x4088db[_0x58ae('0x41')]:_0x31679b[_0x58ae('0x3f')];if(!_0x19015c[_0x58ae('0x3b')][_0x58ae('0x42')](_0x58ae('0x43'))){_0x4088db[_0x58ae('0x2c')]=qs[_0x58ae('0x2c')](_0x19015c['query']['limit']);_0x4088db[_0x58ae('0x2a')]=qs['offset'](_0x19015c['query'][_0x58ae('0x2a')]);}_0x4088db[_0x58ae('0x44')]=qs[_0x58ae('0x45')](_0x19015c[_0x58ae('0x3b')][_0x58ae('0x45')]);_0x4088db[_0x58ae('0x46')]=qs[_0x58ae('0x3d')](_[_0x58ae('0x47')](_0x19015c[_0x58ae('0x3b')],_0x31679b[_0x58ae('0x3d')]),_0x16da6b);if(_0x19015c[_0x58ae('0x3b')]['filter']){_0x4088db[_0x58ae('0x46')]=_['merge'](_0x4088db[_0x58ae('0x46')],{'$or':_['map'](_0x16da6b,function(_0x4d1cda){if(_0x4d1cda['type']!==_0x58ae('0x48')){var _0x5bde1c={};_0x5bde1c[_0x4d1cda[_0x58ae('0x36')]]={'$like':'%'+_0x19015c['query'][_0x58ae('0x49')]+'%'};return _0x5bde1c;}})});}_0x4088db=_[_0x58ae('0x4a')]({},_0x4088db,_0x19015c[_0x58ae('0x4b')]);var _0x320b8b={'where':_0x4088db[_0x58ae('0x46')]};return db[_0x58ae('0x38')]['count'](_0x320b8b)[_0x58ae('0x1d')](function(_0x1f7f9a){_0x15e4e7['count']=_0x1f7f9a;if(_0x19015c[_0x58ae('0x3b')][_0x58ae('0x4c')]){_0x4088db[_0x58ae('0x4d')]=[{'all':!![]}];}return db[_0x58ae('0x38')][_0x58ae('0x4e')](_0x4088db);})[_0x58ae('0x1d')](function(_0xaf7064){_0x15e4e7[_0x58ae('0x4f')]=_0xaf7064;return _0x15e4e7;})[_0x58ae('0x1d')](respondWithFilteredResult(_0x2bded0,_0x4088db))[_0x58ae('0x27')](handleError(_0x2bded0,null));};exports[_0x58ae('0x50')]=function(_0x4125b3,_0x5d24de){var _0x1ea8d6={'raw':!![],'where':{'id':_0x4125b3['params']['id']}},_0x3c6e7d={};_0x3c6e7d[_0x58ae('0x3f')]=_['keys'](db['FaxMessage'][_0x58ae('0x51')]);_0x3c6e7d['query']=_[_0x58ae('0x3c')](_0x4125b3[_0x58ae('0x3b')]);_0x3c6e7d[_0x58ae('0x3d')]=_[_0x58ae('0x3e')](_0x3c6e7d['model'],_0x3c6e7d[_0x58ae('0x3b')]);_0x1ea8d6[_0x58ae('0x41')]=_[_0x58ae('0x3e')](_0x3c6e7d[_0x58ae('0x3f')],qs[_0x58ae('0x40')](_0x4125b3[_0x58ae('0x3b')]['fields']));_0x1ea8d6[_0x58ae('0x41')]=_0x1ea8d6[_0x58ae('0x41')][_0x58ae('0x52')]?_0x1ea8d6[_0x58ae('0x41')]:_0x3c6e7d[_0x58ae('0x3f')];if(_0x4125b3[_0x58ae('0x3b')][_0x58ae('0x4c')]){_0x1ea8d6[_0x58ae('0x4d')]=[{'all':!![]}];}_0x1ea8d6=_[_0x58ae('0x4a')]({},_0x1ea8d6,_0x4125b3[_0x58ae('0x4b')]);return db[_0x58ae('0x38')]['find'](_0x1ea8d6)[_0x58ae('0x1d')](handleEntityNotFound(_0x5d24de,null))[_0x58ae('0x1d')](respondWithResult(_0x5d24de,null))[_0x58ae('0x27')](handleError(_0x5d24de,null));};exports[_0x58ae('0x33')]=function(_0x2cd30b,_0x59d1ad){if(_0x2cd30b[_0x58ae('0x53')]['id']){delete _0x2cd30b[_0x58ae('0x53')]['id'];}return db[_0x58ae('0x38')][_0x58ae('0x54')]({'where':{'id':_0x2cd30b['params']['id']}})[_0x58ae('0x1d')](handleEntityNotFound(_0x59d1ad,null))[_0x58ae('0x1d')](saveUpdates(_0x2cd30b[_0x58ae('0x53')],null))[_0x58ae('0x1d')](respondWithResult(_0x59d1ad,null))[_0x58ae('0x27')](handleError(_0x59d1ad,null));};exports[_0x58ae('0x55')]=function(_0x32c770,_0x5a26e6){return db[_0x58ae('0x38')][_0x58ae('0x54')]({'where':{'id':_0x32c770[_0x58ae('0x56')]['id']}})[_0x58ae('0x1d')](handleEntityNotFound(_0x5a26e6,null))[_0x58ae('0x1d')](removeEntity(_0x5a26e6,null))[_0x58ae('0x27')](handleError(_0x5a26e6,null));};exports[_0x58ae('0x57')]=function(_0x45f749,_0x335fc5){return db[_0x58ae('0x38')][_0x58ae('0x57')]()[_0x58ae('0x1d')](respondWithResult(_0x335fc5,null))[_0x58ae('0x27')](handleError(_0x335fc5,null));};var interaction_log=require(_0x58ae('0x11'))(_0x58ae('0x58'));exports[_0x58ae('0x59')]=function(_0x2ed43f,_0x385464,_0x49ebb1){var _0x72a06b={'agent':{},'channel':_0x58ae('0x5a')};if(_0x2ed43f[_0x58ae('0x53')]['id']){delete _0x2ed43f[_0x58ae('0x53')]['id'];}_0x2ed43f[_0x58ae('0x53')][_0x58ae('0x5b')]=!![];_0x2ed43f[_0x58ae('0x53')][_0x58ae('0x5c')]=moment()[_0x58ae('0x5d')](_0x58ae('0x5e'));_0x2ed43f['body'][_0x58ae('0x5f')]=_0x2ed43f[_0x58ae('0x53')]['UserId']||_0x2ed43f[_0x58ae('0x60')]['id'];_0x72a06b[_0x58ae('0x61')]['id']=_0x2ed43f[_0x58ae('0x53')]['UserId'];return db[_0x58ae('0x38')][_0x58ae('0x54')]({'where':{'id':_0x2ed43f[_0x58ae('0x56')]['id'],'UserId':null}})[_0x58ae('0x1d')](handleEntityNotFound(_0x385464,null))[_0x58ae('0x1d')](saveUpdates(_0x2ed43f['body'],null))[_0x58ae('0x1d')](function(_0x4ab848){if(_0x4ab848){_0x72a06b['message']=_0x4ab848[_0x58ae('0x62')]({'plain':!![]});return db[_0x58ae('0x63')][_0x58ae('0x54')]({'where':{'id':_0x4ab848[_0x58ae('0x64')]}});}return null;})[_0x58ae('0x1d')](handleEntityNotFound(_0x385464,null))['then'](function(_0x3a37a7){if(_0x3a37a7){return _0x3a37a7[_0x58ae('0x33')]({'UserId':_0x2ed43f[_0x58ae('0x53')][_0x58ae('0x5f')],'read1stAt':_['isNil'](_0x3a37a7[_0x58ae('0x65')])?moment()['format'](_0x58ae('0x5e')):undefined});}return null;})[_0x58ae('0x1d')](function(_0x34b3df){if(_0x34b3df){_0x72a06b['interaction']=_0x34b3df[_0x58ae('0x62')]({'plain':!![]});interaction_log[_0x58ae('0x1e')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ed43f['user']['id'],_0x2ed43f[_0x58ae('0x60')]['name'],_0x2ed43f[_0x58ae('0x60')]['role'],_0x72a06b[_0x58ae('0x66')]['id'],_0x2ed43f['body']?JSON[_0x58ae('0x67')](_0x2ed43f[_0x58ae('0x53')]):_0x58ae('0x68'));return respondWithRpcPromise(_0x58ae('0x69'),'acceptMessage',_0x72a06b);}return null;})[_0x58ae('0x1d')](function(_0x3f4c84){var _0x41657c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3f4c84[_0x58ae('0x25')][_0x58ae('0x6a')];return db[_0x58ae('0x6b')][_0x58ae('0x3b')](_0x41657c,{'type':db[_0x58ae('0x6c')]['QueryTypes'][_0x58ae('0x6d')],'raw':!![]})['then'](function(_0x33648d){return _0x33648d;});})[_0x58ae('0x1d')](function(_0x35224b){if(_0x35224b){_0x72a06b[_0x58ae('0x25')][_0x58ae('0x6e')]=_0x35224b[0x0];if(!_0x2ed43f[_0x58ae('0x53')][_0x58ae('0x5f')])return;return db[_0x58ae('0x6f')]['find']({'where':{'id':_0x2ed43f['body']['UserId'],'role':_0x58ae('0x61')},'attributes':['id',_0x58ae('0x36'),_0x58ae('0x70'),'email',_0x58ae('0x71')],'raw':!![]});}return null;})[_0x58ae('0x1d')](function(_0x5577a3){if(!_0x5577a3)return null;_0x72a06b[_0x58ae('0x25')][_0x58ae('0x61')]=_0x5577a3;return _0x72a06b;})[_0x58ae('0x1d')](function(_0x5c34af){if(_0x5c34af){if(_0x2ed43f[_0x58ae('0x53')][_0x58ae('0x72')]){_0x72a06b[_0x58ae('0x25')]['interface']=util['format'](_0x58ae('0x73'),_0x2ed43f[_0x58ae('0x60')][_0x58ae('0x36')]);_0x72a06b[_0x58ae('0x25')][_0x58ae('0x74')]=_0x72a06b[_0x58ae('0x74')];_0x72a06b[_0x58ae('0x25')][_0x58ae('0x75')]=_0x72a06b[_0x58ae('0x74')];_0x72a06b[_0x58ae('0x25')][_0x58ae('0x76')]=_0x58ae('0x59');return respondWithRpcPromise(_0x58ae('0x77'),'EventManager',{'event':'acceptmessage','message':_0x72a06b[_0x58ae('0x25')]},client9002)[_0x58ae('0x1d')](function(){return _0x72a06b;});}return _0x72a06b;}return null;})[_0x58ae('0x1d')](respondWithResult(_0x385464,null))[_0x58ae('0x27')](handleError(_0x385464,null));};var interaction_log=require(_0x58ae('0x11'))('fax-interactions');exports['reject']=function(_0x2150ad,_0x42db8e,_0x4449a4){var _0x5711d7={'agent':{},'channel':'fax'};if(_0x2150ad[_0x58ae('0x53')]['id']){delete _0x2150ad['body']['id'];}_0x2150ad[_0x58ae('0x53')]['UserId']=_0x2150ad[_0x58ae('0x53')][_0x58ae('0x5f')]||_0x2150ad[_0x58ae('0x60')]['id'];_0x5711d7[_0x58ae('0x61')]['id']=_0x2150ad[_0x58ae('0x53')][_0x58ae('0x5f')];return db['FaxMessage'][_0x58ae('0x54')]({'where':{'id':_0x2150ad[_0x58ae('0x56')]['id'],'UserId':null}})[_0x58ae('0x1d')](handleEntityNotFound(_0x42db8e,null))['then'](function(_0x4d6012){if(_0x4d6012){_0x5711d7[_0x58ae('0x25')]=_0x4d6012['get']({'plain':!![]});return db[_0x58ae('0x63')]['find']({'where':{'id':_0x4d6012['FaxInteractionId']}});}return null;})[_0x58ae('0x1d')](handleEntityNotFound(_0x42db8e,null))['then'](function(_0x481bea){if(_0x481bea){_0x5711d7[_0x58ae('0x66')]=_0x481bea[_0x58ae('0x62')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2150ad[_0x58ae('0x60')]['id'],_0x2150ad[_0x58ae('0x60')][_0x58ae('0x36')],_0x2150ad[_0x58ae('0x60')][_0x58ae('0x78')],_0x5711d7[_0x58ae('0x66')]['id'],_0x2150ad[_0x58ae('0x53')]?JSON[_0x58ae('0x67')](_0x2150ad['body']):'null');return respondWithRpcPromise('RejectMessage',_0x58ae('0x79'),_0x5711d7);}return null;})[_0x58ae('0x1d')](function(_0x33447d){var _0x14c5a2=_0x58ae('0x7a')+_0x33447d[_0x58ae('0x25')][_0x58ae('0x6a')];return db['sequelize'][_0x58ae('0x3b')](_0x14c5a2,{'type':db[_0x58ae('0x6c')]['QueryTypes']['SELECT'],'raw':!![]})[_0x58ae('0x1d')](function(_0x254c4c){return _0x254c4c;});})[_0x58ae('0x1d')](function(_0x17b9f2){if(_0x17b9f2){_0x5711d7['message'][_0x58ae('0x6e')]=_0x17b9f2[0x0];if(!_0x2150ad[_0x58ae('0x53')][_0x58ae('0x5f')])return;return db[_0x58ae('0x6f')]['find']({'where':{'id':_0x2150ad[_0x58ae('0x53')][_0x58ae('0x5f')],'role':_0x58ae('0x61')},'attributes':['id',_0x58ae('0x36'),'fullname',_0x58ae('0x7b'),_0x58ae('0x71')],'raw':!![]});}return null;})[_0x58ae('0x1d')](function(_0x14daf5){if(!_0x14daf5)return null;_0x5711d7[_0x58ae('0x25')][_0x58ae('0x61')]=_0x14daf5;return _0x5711d7;})[_0x58ae('0x1d')](function(_0x161610){if(_0x161610){_0x161610[_0x58ae('0x25')][_0x58ae('0x7c')]=util['format'](_0x58ae('0x73'),_0x2150ad['user'][_0x58ae('0x36')]);_0x161610['message'][_0x58ae('0x74')]=_0x5711d7[_0x58ae('0x74')];_0x161610[_0x58ae('0x25')][_0x58ae('0x75')]=_0x5711d7['channel'];_0x161610['message'][_0x58ae('0x76')]='reject';respondWithRpcPromise(_0x58ae('0x77'),'EventManager',{'event':_0x58ae('0x7d'),'message':_0x161610[_0x58ae('0x25')]},client9002);return _0x5711d7;}return null;})[_0x58ae('0x1d')](respondWithResult(_0x42db8e,null))[_0x58ae('0x27')](handleError(_0x42db8e,null));};exports['create']=function(_0x4ffcd5,_0x745d6){var _0x260a30;return db[_0x58ae('0x38')]['create'](_0x4ffcd5[_0x58ae('0x53')],{})[_0x58ae('0x1d')](function(_0x40602c){_0x260a30=_0x40602c;return db[_0x58ae('0x7e')]['findOne']({'where':{'id':_0x260a30[_0x58ae('0x6a')]}});})[_0x58ae('0x1d')](function(_0x4339eb){if(_[_0x58ae('0x7f')](_0x4339eb)){return;}else{_0x260a30[_0x58ae('0x5a')]=_0x4339eb[_0x58ae('0x5a')];return db[_0x58ae('0x80')]['findOne']({'where':{'id':_0x260a30[_0x58ae('0x81')]}});}})[_0x58ae('0x1d')](function(_0x16a157){return respondWithRpcPromise('SendFax',_0x58ae('0x82'),{'FaxAccountId':_[_0x58ae('0x7f')](_0x4ffcd5[_0x58ae('0x53')])?undefined:_0x4ffcd5[_0x58ae('0x53')][_0x58ae('0x83')],'path':_[_0x58ae('0x7f')](_0x16a157)?undefined:util[_0x58ae('0x5d')](_0x58ae('0x84'),_0x16a157[_0x58ae('0x85')]),'fax':_[_0x58ae('0x7f')](_0x260a30[_0x58ae('0x5a')])?undefined:_0x260a30[_0x58ae('0x5a')],'AttachmentId':_0x260a30[_0x58ae('0x81')]},client9002);})['then'](respondWithResult(_0x745d6,0xc9))[_0x58ae('0x27')](handleError(_0x745d6,null));};exports[_0x58ae('0x86')]=function(_0x4200a3,_0x252df8){var _0xaf161e=path[_0x58ae('0x87')](config[_0x58ae('0x88')],_0x58ae('0x89'),'files',_0x58ae('0x8a'));return db[_0x58ae('0x38')][_0x58ae('0x54')]({'where':{'id':_0x4200a3['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x252df8,null))[_0x58ae('0x1d')](function(_0x2e55f9){if(_0x2e55f9){return _0x252df8[_0x58ae('0x86')](path[_0x58ae('0x87')](_0xaf161e,_0x2e55f9['Attachment']['basename']));}})['catch'](handleError(_0x252df8,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 7642c93..c280280 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 _0x3595=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x318262,_0xaa1967){var _0x4369=function(_0x5893dd){while(--_0x5893dd){_0x318262['push'](_0x318262['shift']());}};_0x4369(++_0xaa1967);}(_0x3595,0x147));var _0x5359=function(_0x47f19c,_0x120f2b){_0x47f19c=_0x47f19c-0x0;var _0x347ead=_0x3595[_0x47f19c];return _0x347ead;};'use strict';var EventEmitter=require(_0x5359('0x0'));var FaxMessage=require(_0x5359('0x1'))['db'][_0x5359('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5359('0x3'),'afterUpdate':_0x5359('0x4'),'afterDestroy':_0x5359('0x5')};function emitEvent(_0x3fd018){return function(_0x1fa814,_0x125c76,_0x4e42e0){FaxMessageEvents['emit'](_0x3fd018+':'+_0x1fa814['id'],_0x1fa814);FaxMessageEvents[_0x5359('0x6')](_0x3fd018,_0x1fa814);_0x4e42e0(null);};}for(var e in events){if(events[_0x5359('0x7')](e)){var event=events[e];FaxMessage[_0x5359('0x8')](e,emitEvent(event));}}module[_0x5359('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x1ab1=['events','setMaxListeners','emit','hook','exports'];(function(_0x19a7d3,_0x487155){var _0x569a8e=function(_0x456e99){while(--_0x456e99){_0x19a7d3['push'](_0x19a7d3['shift']());}};_0x569a8e(++_0x487155);}(_0x1ab1,0x12c));var _0x11ab=function(_0x1c8985,_0x3ef0b3){_0x1c8985=_0x1c8985-0x0;var _0x466eab=_0x1ab1[_0x1c8985];return _0x466eab;};'use strict';var EventEmitter=require(_0x11ab('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x11ab('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x28a19c){return function(_0x4a6492,_0x1fc2bd,_0x363103){FaxMessageEvents[_0x11ab('0x2')](_0x28a19c+':'+_0x4a6492['id'],_0x4a6492);FaxMessageEvents[_0x11ab('0x2')](_0x28a19c,_0x4a6492);_0x363103(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x11ab('0x3')](e,emitEvent(event));}}module[_0x11ab('0x4')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index de96002..f4c8007 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 _0x5446=['get','direction','toLowerCase','out','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./faxMessage.attributes','exports','define','fax_messages','body','FULLTEXT','models'];(function(_0x4d7a70,_0x2d3bfa){var _0x3aafbb=function(_0x43fbf2){while(--_0x43fbf2){_0x4d7a70['push'](_0x4d7a70['shift']());}};_0x3aafbb(++_0x2d3bfa);}(_0x5446,0x1d8));var _0x6544=function(_0xdaa2d6,_0x3d7bb1){_0xdaa2d6=_0xdaa2d6-0x0;var _0x225dcc=_0x5446[_0xdaa2d6];return _0x225dcc;};'use strict';var _=require(_0x6544('0x0'));var util=require(_0x6544('0x1'));var logger=require(_0x6544('0x2'))(_0x6544('0x3'));var moment=require(_0x6544('0x4'));var BPromise=require(_0x6544('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6544('0x6'));var attributes=require(_0x6544('0x7'));module[_0x6544('0x8')]=function(_0x360440,_0x367c24){return _0x360440[_0x6544('0x9')]('FaxMessage',attributes,{'tableName':_0x6544('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x6544('0xb')],'type':_0x6544('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27c7a9,_0x417deb,_0x232376){var _0x845584=_0x360440[_0x6544('0xd')];var _0x62d282=_0x27c7a9[_0x6544('0xe')]({'plain':!![]});if(_0x62d282[_0x6544('0xf')][_0x6544('0x10')]()==='in'||_0x62d282[_0x6544('0xf')]['toLowerCase']()===_0x6544('0x11')&&!_0x62d282['secret']&&!_['isNil'](_0x62d282['UserId'])){_0x845584[_0x6544('0x12')][_0x6544('0x13')]({'where':{'id':_0x62d282[_0x6544('0x14')]}})[_0x6544('0x15')](function(_0x5d2bd0){if(_0x5d2bd0){_0x5d2bd0[_0x6544('0x16')]({'lastMsgAt':_0x62d282[_0x6544('0x17')],'lastMsgDirection':_0x62d282[_0x6544('0xf')][_0x6544('0x10')]()});}})[_0x6544('0x18')](function(_0x59a8fd){console['error'](_0x59a8fd);});}_0x232376();}},'charset':_0x6544('0x19'),'collate':_0x6544('0x1a')});}; \ No newline at end of file +var _0x8b91=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error'];(function(_0x3f4416,_0x312741){var _0x5400d7=function(_0x505c3c){while(--_0x505c3c){_0x3f4416['push'](_0x3f4416['shift']());}};_0x5400d7(++_0x312741);}(_0x8b91,0x71));var _0x18b9=function(_0x59e60b,_0x15a05e){_0x59e60b=_0x59e60b-0x0;var _0x3d1f95=_0x8b91[_0x59e60b];return _0x3d1f95;};'use strict';var _=require(_0x18b9('0x0'));var util=require(_0x18b9('0x1'));var logger=require('../../config/logger')(_0x18b9('0x2'));var moment=require(_0x18b9('0x3'));var BPromise=require(_0x18b9('0x4'));var rp=require(_0x18b9('0x5'));var fs=require('fs');var path=require(_0x18b9('0x6'));var rimraf=require('rimraf');var config=require(_0x18b9('0x7'));var attributes=require('./faxMessage.attributes');module['exports']=function(_0x1bce28,_0x966e1e){return _0x1bce28[_0x18b9('0x8')](_0x18b9('0x9'),attributes,{'tableName':_0x18b9('0xa'),'paranoid':![],'indexes':[{'name':_0x18b9('0xb'),'fields':[_0x18b9('0xc')],'type':_0x18b9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x28cd4a,_0x3c64d4,_0x3d417a){var _0x28d942=_0x1bce28[_0x18b9('0xe')];var _0xb4f7f6=_0x28cd4a['get']({'plain':!![]});if(_0xb4f7f6[_0x18b9('0xf')][_0x18b9('0x10')]()==='in'||_0xb4f7f6[_0x18b9('0xf')][_0x18b9('0x10')]()===_0x18b9('0x11')&&!_0xb4f7f6['secret']&&!_[_0x18b9('0x12')](_0xb4f7f6[_0x18b9('0x13')])){_0x28d942[_0x18b9('0x14')][_0x18b9('0x15')]({'where':{'id':_0xb4f7f6[_0x18b9('0x16')]}})[_0x18b9('0x17')](function(_0x17fada){if(_0x17fada){_0x17fada[_0x18b9('0x18')]({'lastMsgAt':_0xb4f7f6['createdAt'],'lastMsgDirection':_0xb4f7f6[_0x18b9('0xf')]['toLowerCase']()});}})[_0x18b9('0x19')](function(_0x5a9f29){console[_0x18b9('0x1a')](_0x5a9f29);});}_0x3d417a();}},'charset':'utf8mb4','collate':_0x18b9('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index d228aad..1e2e6d0 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 _0x98a8=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./faxMessage.socket','register','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','raw','attributes','limit','stringify','lodash','util','moment','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x98a8,0x12c));var _0x898a=function(_0x2998d3,_0x2489bb){_0x2998d3=_0x2998d3-0x0;var _0x5b3fdc=_0x98a8[_0x2998d3];return _0x5b3fdc;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});config[_0x898a('0xc')]=_['defaults'](config[_0x898a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0xd'))(new Redis(config[_0x898a('0xc')]));require(_0x898a('0xe'))[_0x898a('0xf')](socket);function respondWithRpcPromise(_0x3150df,_0x388a47,_0x42faa4){return new BPromise(function(_0x1a92de,_0x3806cb){return client['request'](_0x3150df,_0x42faa4)[_0x898a('0x10')](function(_0x502e95){logger[_0x898a('0x11')]('FaxMessage,\x20%s,\x20%s',_0x388a47,_0x898a('0x12'));logger[_0x898a('0x13')](_0x898a('0x14'),_0x388a47,'request\x20sent',JSON['stringify'](_0x502e95));if(_0x502e95['error']){if(_0x502e95[_0x898a('0x15')][_0x898a('0x16')]===0x1f4){logger[_0x898a('0x15')](_0x898a('0x17'),_0x388a47,_0x502e95[_0x898a('0x15')][_0x898a('0x18')]);return _0x3806cb(_0x502e95['error'][_0x898a('0x18')]);}logger['error'](_0x898a('0x17'),_0x388a47,_0x502e95['error'][_0x898a('0x18')]);return _0x1a92de(_0x502e95['error'][_0x898a('0x18')]);}else{logger['info'](_0x898a('0x17'),_0x388a47,_0x898a('0x12'));_0x1a92de(_0x502e95[_0x898a('0x19')]['message']);}})[_0x898a('0x1a')](function(_0x5960e0){logger['error'](_0x898a('0x17'),_0x388a47,_0x5960e0);_0x3806cb(_0x5960e0);});});}exports[_0x898a('0x1b')]=function(_0x58c3ab){var _0x4d374b=this;return new Promise(function(_0x12bc0f,_0x26449a){return db[_0x898a('0x1c')][_0x898a('0x1d')](_0x58c3ab[_0x898a('0x1e')],{'raw':_0x58c3ab[_0x898a('0x1f')]?_0x58c3ab[_0x898a('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x898a('0x10')](function(_0x50718e){logger[_0x898a('0x11')](_0x898a('0x1b'),_0x58c3ab);logger[_0x898a('0x13')](_0x898a('0x1b'),_0x58c3ab,JSON['stringify'](_0x50718e));_0x12bc0f(_0x50718e);})[_0x898a('0x1a')](function(_0x16c318){logger[_0x898a('0x15')](_0x898a('0x1b'),_0x16c318[_0x898a('0x18')],_0x58c3ab);_0x26449a(_0x4d374b[_0x898a('0x15')](0x1f4,_0x16c318['message']));});});};exports[_0x898a('0x20')]=function(_0x51d501){var _0x513c6b=this;return new Promise(function(_0x53ddb2,_0x3678be){return db[_0x898a('0x1c')][_0x898a('0x21')](_0x51d501[_0x898a('0x1e')],{'raw':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')]['where']||null:null,'attributes':_0x51d501['options']?_0x51d501['options'][_0x898a('0x23')]||null:null,'limit':_0x51d501[_0x898a('0x1f')]?_0x51d501[_0x898a('0x1f')][_0x898a('0x24')]||null:null})[_0x898a('0x10')](function(_0x560000){logger[_0x898a('0x11')](_0x898a('0x20'),_0x51d501);logger[_0x898a('0x13')](_0x898a('0x20'),_0x51d501,JSON[_0x898a('0x25')](_0x560000));_0x53ddb2(_0x560000);})[_0x898a('0x1a')](function(_0x494127){logger[_0x898a('0x15')](_0x898a('0x20'),_0x494127[_0x898a('0x18')],_0x51d501);_0x3678be(_0x513c6b[_0x898a('0x15')](0x1f4,_0x494127[_0x898a('0x18')]));});});}; \ No newline at end of file +var _0xedd9=['create','body','raw','CreateFaxMessage','catch','FaxMessage','update','options','where','attributes','limit','UpdateFaxMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3b7dd0,_0xaefa1b){var _0x14802e=function(_0x46e9aa){while(--_0x46e9aa){_0x3b7dd0['push'](_0x3b7dd0['shift']());}};_0x14802e(++_0xaefa1b);}(_0xedd9,0xfc));var _0x9edd=function(_0x23f491,_0x44ecbd){_0x23f491=_0x23f491-0x0;var _0xef2c35=_0xedd9[_0x23f491];return _0xef2c35;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});config['redis']=_[_0x9edd('0xc')](config['redis'],{'host':_0x9edd('0xd'),'port':0x18eb});var socket=require(_0x9edd('0xe'))(new Redis(config[_0x9edd('0xf')]));require(_0x9edd('0x10'))['register'](socket);function respondWithRpcPromise(_0x494a24,_0x5d2f90,_0x2076fc){return new BPromise(function(_0x138767,_0x523026){return client[_0x9edd('0x11')](_0x494a24,_0x2076fc)[_0x9edd('0x12')](function(_0x5b6c00){logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));logger[_0x9edd('0x16')](_0x9edd('0x17'),_0x5d2f90,_0x9edd('0x15'),JSON[_0x9edd('0x18')](_0x5b6c00));if(_0x5b6c00[_0x9edd('0x19')]){if(_0x5b6c00['error'][_0x9edd('0x1a')]===0x1f4){logger[_0x9edd('0x19')](_0x9edd('0x14'),_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x523026(_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);}logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x5b6c00[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x138767(_0x5b6c00[_0x9edd('0x19')]['message']);}else{logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x5d2f90,_0x9edd('0x15'));_0x138767(_0x5b6c00['result'][_0x9edd('0x1b')]);}})['catch'](function(_0x2cdcef){logger[_0x9edd('0x19')]('FaxMessage,\x20%s,\x20%s',_0x5d2f90,_0x2cdcef);_0x523026(_0x2cdcef);});});}exports['CreateFaxMessage']=function(_0x45c3ab){var _0x50338f=this;return new Promise(function(_0x27a95a,_0x54a03f){return db['FaxMessage'][_0x9edd('0x1c')](_0x45c3ab[_0x9edd('0x1d')],{'raw':_0x45c3ab['options']?_0x45c3ab['options'][_0x9edd('0x1e')]===undefined?!![]:![]:!![]})[_0x9edd('0x12')](function(_0x477878){logger['info'](_0x9edd('0x1f'),_0x45c3ab);logger[_0x9edd('0x16')](_0x9edd('0x1f'),_0x45c3ab,JSON[_0x9edd('0x18')](_0x477878));_0x27a95a(_0x477878);})[_0x9edd('0x20')](function(_0x4c75d2){logger[_0x9edd('0x19')](_0x9edd('0x1f'),_0x4c75d2[_0x9edd('0x1b')],_0x45c3ab);_0x54a03f(_0x50338f[_0x9edd('0x19')](0x1f4,_0x4c75d2[_0x9edd('0x1b')]));});});};exports['UpdateFaxMessage']=function(_0x4b3d1b){var _0x3276ee=this;return new Promise(function(_0xfeca7b,_0x8d67aa){return db[_0x9edd('0x21')][_0x9edd('0x22')](_0x4b3d1b['body'],{'raw':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b['options'][_0x9edd('0x24')]||null:null,'attributes':_0x4b3d1b[_0x9edd('0x23')]?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x25')]||null:null,'limit':_0x4b3d1b['options']?_0x4b3d1b[_0x9edd('0x23')][_0x9edd('0x26')]||null:null})[_0x9edd('0x12')](function(_0x12c1bc){logger[_0x9edd('0x13')](_0x9edd('0x27'),_0x4b3d1b);logger[_0x9edd('0x16')](_0x9edd('0x27'),_0x4b3d1b,JSON[_0x9edd('0x18')](_0x12c1bc));_0xfeca7b(_0x12c1bc);})[_0x9edd('0x20')](function(_0x4fd03f){logger[_0x9edd('0x19')](_0x9edd('0x27'),_0x4fd03f[_0x9edd('0x1b')],_0x4b3d1b);_0x8d67aa(_0x3276ee[_0x9edd('0x19')](0x1f4,_0x4fd03f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 50ce26d..900d39e 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 _0x4d37=['length','faxMessage:','./faxMessage.events','save','remove','update','emit','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d37,0x192));var _0x74d3=function(_0x395155,_0x192ffd){_0x395155=_0x395155-0x0;var _0x179767=_0x4d37[_0x395155];return _0x179767;};'use strict';var FaxMessageEvents=require(_0x74d3('0x0'));var events=[_0x74d3('0x1'),_0x74d3('0x2'),_0x74d3('0x3')];function createListener(_0x4e11b6,_0x46973a){return function(_0xd9a31){_0x46973a[_0x74d3('0x4')](_0x4e11b6,_0xd9a31);};}function removeListener(_0x5f41e,_0x2d8789){return function(){FaxMessageEvents['removeListener'](_0x5f41e,_0x2d8789);};}exports[_0x74d3('0x5')]=function(_0x5891a4){for(var _0x8bc47b=0x0,_0x3ab75e=events[_0x74d3('0x6')];_0x8bc47b<_0x3ab75e;_0x8bc47b++){var _0x535902=events[_0x8bc47b];var _0x46ec4b=createListener(_0x74d3('0x7')+_0x535902,_0x5891a4);FaxMessageEvents['on'](_0x535902,_0x46ec4b);}}; \ No newline at end of file +var _0xbd00=['./faxMessage.events','save','remove','update','emit','removeListener','register','length','faxMessage:'];(function(_0x312804,_0x5eb700){var _0x4550fe=function(_0x49f939){while(--_0x49f939){_0x312804['push'](_0x312804['shift']());}};_0x4550fe(++_0x5eb700);}(_0xbd00,0xea));var _0x0bd0=function(_0x3185ad,_0x5e5ca2){_0x3185ad=_0x3185ad-0x0;var _0x4f77fb=_0xbd00[_0x3185ad];return _0x4f77fb;};'use strict';var FaxMessageEvents=require(_0x0bd0('0x0'));var events=[_0x0bd0('0x1'),_0x0bd0('0x2'),_0x0bd0('0x3')];function createListener(_0x36b816,_0x1a1f0f){return function(_0xb2a253){_0x1a1f0f[_0x0bd0('0x4')](_0x36b816,_0xb2a253);};}function removeListener(_0x19eee0,_0x47b3c9){return function(){FaxMessageEvents[_0x0bd0('0x5')](_0x19eee0,_0x47b3c9);};}exports[_0x0bd0('0x6')]=function(_0x8464f5){for(var _0x182d60=0x0,_0x931b5a=events[_0x0bd0('0x7')];_0x182d60<_0x931b5a;_0x182d60++){var _0x404592=events[_0x182d60];var _0x1ad209=createListener(_0x0bd0('0x8')+_0x404592,_0x8464f5);FaxMessageEvents['on'](_0x404592,_0x1ad209);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 07f2319..b40d3e5 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 _0xde2c=['/describe','describe','show','/:id/download','download','post','fax','faxmessage:create','create','put','/:id','/:id/reject','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index'];(function(_0x5eb559,_0x28295e){var _0x5ec974=function(_0x269ff4){while(--_0x269ff4){_0x5eb559['push'](_0x5eb559['shift']());}};_0x5ec974(++_0x28295e);}(_0xde2c,0x7f));var _0xcde2=function(_0x344adc,_0x183c37){_0x344adc=_0x344adc-0x0;var _0x4014b2=_0xde2c[_0x344adc];return _0x4014b2;};'use strict';var multer=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var path=require(_0xcde2('0x2'));var timeout=require(_0xcde2('0x3'));var express=require(_0xcde2('0x4'));var router=express[_0xcde2('0x5')]();var fs_extra=require(_0xcde2('0x6'));var auth=require(_0xcde2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcde2('0x8'));var controller=require(_0xcde2('0x9'));router[_0xcde2('0xa')]('/',auth[_0xcde2('0xb')](),controller[_0xcde2('0xc')]);router['get'](_0xcde2('0xd'),auth[_0xcde2('0xb')](),controller[_0xcde2('0xe')]);router['get']('/:id',auth[_0xcde2('0xb')](),controller[_0xcde2('0xf')]);router['get'](_0xcde2('0x10'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x11')]);router[_0xcde2('0x12')]('/',auth['isAuthenticated'](),interaction['tracked'](_0xcde2('0x13'),_0xcde2('0x14')),controller[_0xcde2('0x15')]);router[_0xcde2('0x16')](_0xcde2('0x17'),auth[_0xcde2('0xb')](),controller['update']);router[_0xcde2('0x16')]('/:id/accept',auth[_0xcde2('0xb')](),controller['accept']);router['put'](_0xcde2('0x18'),auth[_0xcde2('0xb')](),controller[_0xcde2('0x19')]);router[_0xcde2('0x1a')](_0xcde2('0x17'),auth['isAuthenticated'](),controller[_0xcde2('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x3667=['/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index'];(function(_0xe3c2de,_0x450b01){var _0x1a73d4=function(_0x382736){while(--_0x382736){_0xe3c2de['push'](_0xe3c2de['shift']());}};_0x1a73d4(++_0x450b01);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var fs_extra=require(_0x7366('0x5'));var auth=require(_0x7366('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7366('0x7'));var controller=require(_0x7366('0x8'));router[_0x7366('0x9')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xb')]);router['get'](_0x7366('0xc'),auth[_0x7366('0xa')](),controller[_0x7366('0xd')]);router[_0x7366('0x9')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0xf')]);router[_0x7366('0x9')](_0x7366('0x10'),auth[_0x7366('0xa')](),controller[_0x7366('0x11')]);router[_0x7366('0x12')]('/',auth[_0x7366('0xa')](),interaction[_0x7366('0x13')](_0x7366('0x14'),_0x7366('0x15')),controller[_0x7366('0x16')]);router[_0x7366('0x17')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0x18')]);router[_0x7366('0x17')](_0x7366('0x19'),auth[_0x7366('0xa')](),controller[_0x7366('0x1a')]);router[_0x7366('0x17')](_0x7366('0x1b'),auth[_0x7366('0xa')](),controller['reject']);router[_0x7366('0x1c')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0x1d')]);module[_0x7366('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 91df56a..9936693 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 _0x757b=['beepall','INTEGER','sequelize','STRING','name','ENUM'];(function(_0x443547,_0x21d7a8){var _0x1423a8=function(_0x2f8d47){while(--_0x2f8d47){_0x443547['push'](_0x443547['shift']());}};_0x1423a8(++_0x21d7a8);}(_0x757b,0x7a));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb757('0x0'));module['exports']={'name':{'type':Sequelize[_0xb757('0x1')],'unique':_0xb757('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb757('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb757('0x3')]('rrmemory',_0xb757('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xb757('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd535=['INTEGER','beepall','roundrobin','sequelize','exports'];(function(_0x156432,_0x55bc5a){var _0x7147bd=function(_0x332f54){while(--_0x332f54){_0x156432['push'](_0x156432['shift']());}};_0x7147bd(++_0x55bc5a);}(_0xd535,0x161));var _0x5d53=function(_0x307e60,_0x1eaaed){_0x307e60=_0x307e60-0x0;var _0x2759ce=_0xd535[_0x307e60];return _0x2759ce;};'use strict';var Sequelize=require(_0x5d53('0x0'));module[_0x5d53('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x5d53('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x5d53('0x3'),_0x5d53('0x4')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5d53('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 8dcf767..0f8aacc 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 _0x197e=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','merge','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','order','FaxQueueId','UserFaxQueue','findAndCountAll','agent','faxPause','updatedAt','createdAt','%s/%s','getTeams','Team','nolimit','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','compact','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse'];(function(_0x22b9b2,_0xd46817){var _0x7ee463=function(_0x81a082){while(--_0x81a082){_0x22b9b2['push'](_0x22b9b2['shift']());}};_0x7ee463(++_0xd46817);}(_0x197e,0x104));var _0xe197=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x197e[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe197('0x0'));var jsonpatch=require(_0xe197('0x1'));var rp=require(_0xe197('0x2'));var moment=require('moment');var BPromise=require(_0xe197('0x3'));var Mustache=require(_0xe197('0x4'));var util=require('util');var path=require(_0xe197('0x5'));var sox=require(_0xe197('0x6'));var csv=require(_0xe197('0x7'));var ejs=require(_0xe197('0x8'));var fs=require('fs');var fs_extra=require(_0xe197('0x9'));var _=require('lodash');var squel=require(_0xe197('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe197('0xb'));var toCsv=require('to-csv');var querystring=require(_0xe197('0xc'));var Papa=require(_0xe197('0xd'));var Redis=require(_0xe197('0xe'));var authService=require(_0xe197('0xf'));var qs=require(_0xe197('0x10'));var as=require(_0xe197('0x11'));var hardwareService=require(_0xe197('0x12'));var logger=require(_0xe197('0x13'))(_0xe197('0x14'));var utils=require(_0xe197('0x15'));var config=require(_0xe197('0x16'));var licenseUtil=require(_0xe197('0x17'));var db=require(_0xe197('0x18'))['db'];config[_0xe197('0x19')]=_['defaults'](config[_0xe197('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe197('0x1a'))(new Redis(config['redis']));require(_0xe197('0x1b'))[_0xe197('0x1c')](socket);function respondWithStatusCode(_0xd36f24,_0x4fb915){_0x4fb915=_0x4fb915||0xcc;return function(_0x54fcc7){if(_0x54fcc7){return _0xd36f24[_0xe197('0x1d')](_0x4fb915);}return _0xd36f24[_0xe197('0x1e')](_0x4fb915)[_0xe197('0x1f')]();};}function respondWithResult(_0x3ac2c3,_0x492174){_0x492174=_0x492174||0xc8;return function(_0x4c600d){if(_0x4c600d){return _0x3ac2c3[_0xe197('0x1e')](_0x492174)[_0xe197('0x20')](_0x4c600d);}};}function respondWithFilteredResult(_0x251afb,_0x2394b3){return function(_0x835122){if(_0x835122){var _0x2429c2=typeof _0x2394b3[_0xe197('0x21')]===_0xe197('0x22')&&typeof _0x2394b3[_0xe197('0x23')]==='undefined';var _0x105317=_0x835122[_0xe197('0x24')];var _0x28bf1a=_0x2429c2?0x0:_0x2394b3[_0xe197('0x21')];var _0x301de5=_0x2429c2?_0x835122[_0xe197('0x24')]:_0x2394b3[_0xe197('0x21')]+_0x2394b3[_0xe197('0x23')];var _0x21206d;if(_0x301de5>=_0x105317){_0x301de5=_0x105317;_0x21206d=0xc8;}else{_0x21206d=0xce;}_0x251afb[_0xe197('0x1e')](_0x21206d);return _0x251afb[_0xe197('0x25')]('Content-Range',_0x28bf1a+'-'+_0x301de5+'/'+_0x105317)[_0xe197('0x20')](_0x835122);}return null;};}function patchUpdates(_0x31600a){return function(_0x224adc){try{jsonpatch['apply'](_0x224adc,_0x31600a,!![]);}catch(_0x1e16eb){return BPromise['reject'](_0x1e16eb);}return _0x224adc['save']();};}function saveUpdates(_0x451caf,_0x247182){return function(_0x173849){if(_0x173849){return _0x173849['update'](_0x451caf)['then'](function(_0x5998fd){return _0x5998fd;});}return null;};}function removeEntity(_0x5ae184,_0x45f459){return function(_0x200c38){if(_0x200c38){return _0x200c38[_0xe197('0x26')]()[_0xe197('0x27')](function(){var _0x48bde9=_0x200c38['get']({'plain':!![]});var _0x41d12e='FaxQueues';return db[_0xe197('0x28')][_0xe197('0x26')]({'where':{'type':_0x41d12e,'resourceId':_0x48bde9['id']}})['then'](function(){return _0x200c38;});})[_0xe197('0x27')](function(){_0x5ae184[_0xe197('0x1e')](0xcc)[_0xe197('0x1f')]();});}};}function handleEntityNotFound(_0x329d77,_0x164bdc){return function(_0x24e20a){if(!_0x24e20a){_0x329d77[_0xe197('0x1d')](0x194);}return _0x24e20a;};}function handleError(_0x54f492,_0x44a7d1){_0x44a7d1=_0x44a7d1||0x1f4;return function(_0x3f0c0a){logger[_0xe197('0x29')](_0x3f0c0a[_0xe197('0x2a')]);if(_0x3f0c0a[_0xe197('0x2b')]){delete _0x3f0c0a['name'];}_0x54f492[_0xe197('0x1e')](_0x44a7d1)[_0xe197('0x2c')](_0x3f0c0a);};}exports[_0xe197('0x2d')]=function(_0x525a5d,_0x2cd526){var _0x12711c={},_0x26ff66={},_0x4dcb02={'count':0x0,'rows':[]};var _0x53d528=_[_0xe197('0x2e')](db[_0xe197('0x2f')][_0xe197('0x30')],function(_0x2dce4c){return{'name':_0x2dce4c[_0xe197('0x31')],'type':_0x2dce4c[_0xe197('0x32')]['key']};});_0x26ff66[_0xe197('0x33')]=_[_0xe197('0x2e')](_0x53d528,'name');_0x26ff66[_0xe197('0x34')]=_[_0xe197('0x35')](_0x525a5d[_0xe197('0x34')]);_0x26ff66['filters']=_[_0xe197('0x36')](_0x26ff66['model'],_0x26ff66[_0xe197('0x34')]);_0x12711c['attributes']=_['intersection'](_0x26ff66[_0xe197('0x33')],qs[_0xe197('0x37')](_0x525a5d[_0xe197('0x34')][_0xe197('0x37')]));_0x12711c[_0xe197('0x38')]=_0x12711c[_0xe197('0x38')][_0xe197('0x39')]?_0x12711c[_0xe197('0x38')]:_0x26ff66[_0xe197('0x33')];if(!_0x525a5d[_0xe197('0x34')][_0xe197('0x3a')]('nolimit')){_0x12711c[_0xe197('0x23')]=qs[_0xe197('0x23')](_0x525a5d['query'][_0xe197('0x23')]);_0x12711c[_0xe197('0x21')]=qs['offset'](_0x525a5d[_0xe197('0x34')][_0xe197('0x21')]);}_0x12711c['order']=qs[_0xe197('0x3b')](_0x525a5d[_0xe197('0x34')][_0xe197('0x3b')]);_0x12711c[_0xe197('0x3c')]=qs['filters'](_[_0xe197('0x3d')](_0x525a5d['query'],_0x26ff66[_0xe197('0x3e')]),_0x53d528);if(_0x525a5d[_0xe197('0x34')]['filter']){_0x12711c[_0xe197('0x3c')]=_[_0xe197('0x3f')](_0x12711c['where'],{'$or':_[_0xe197('0x2e')](_0x53d528,function(_0x2b854f){if(_0x2b854f['type']!=='VIRTUAL'){var _0x53d9f1={};_0x53d9f1[_0x2b854f[_0xe197('0x2b')]]={'$like':'%'+_0x525a5d[_0xe197('0x34')][_0xe197('0x40')]+'%'};return _0x53d9f1;}})});}_0x12711c=_[_0xe197('0x3f')]({},_0x12711c,_0x525a5d[_0xe197('0x41')]);var _0x1d1648={'where':_0x12711c[_0xe197('0x3c')]};return db[_0xe197('0x2f')][_0xe197('0x24')](_0x1d1648)['then'](function(_0x702ada){_0x4dcb02['count']=_0x702ada;if(_0x525a5d[_0xe197('0x34')][_0xe197('0x42')]){_0x12711c[_0xe197('0x43')]=[{'all':!![]}];}return db[_0xe197('0x2f')][_0xe197('0x44')](_0x12711c);})[_0xe197('0x27')](function(_0x529a13){_0x4dcb02[_0xe197('0x45')]=_0x529a13;return _0x4dcb02;})[_0xe197('0x27')](respondWithFilteredResult(_0x2cd526,_0x12711c))[_0xe197('0x46')](handleError(_0x2cd526,null));};exports['show']=function(_0x284c09,_0x17cc28){var _0x50bd65={'raw':!![],'where':{'id':_0x284c09[_0xe197('0x47')]['id']}},_0x4852db={};_0x4852db[_0xe197('0x33')]=_[_0xe197('0x35')](db[_0xe197('0x2f')][_0xe197('0x30')]);_0x4852db[_0xe197('0x34')]=_[_0xe197('0x35')](_0x284c09['query']);_0x4852db['filters']=_[_0xe197('0x36')](_0x4852db[_0xe197('0x33')],_0x4852db[_0xe197('0x34')]);_0x50bd65[_0xe197('0x38')]=_['intersection'](_0x4852db[_0xe197('0x33')],qs['fields'](_0x284c09[_0xe197('0x34')]['fields']));_0x50bd65[_0xe197('0x38')]=_0x50bd65[_0xe197('0x38')][_0xe197('0x39')]?_0x50bd65['attributes']:_0x4852db[_0xe197('0x33')];if(_0x284c09[_0xe197('0x34')]['includeAll']){_0x50bd65[_0xe197('0x43')]=[{'all':!![]}];}_0x50bd65=_[_0xe197('0x3f')]({},_0x50bd65,_0x284c09[_0xe197('0x41')]);return db[_0xe197('0x2f')][_0xe197('0x48')](_0x50bd65)[_0xe197('0x27')](handleEntityNotFound(_0x17cc28,null))['then'](respondWithResult(_0x17cc28,null))['catch'](handleError(_0x17cc28,null));};exports[_0xe197('0x49')]=function(_0xd1be69,_0x457d97){return db[_0xe197('0x2f')][_0xe197('0x49')](_0xd1be69[_0xe197('0x4a')],{})[_0xe197('0x27')](function(_0x4c8b14){var _0x3fe540=_0xd1be69[_0xe197('0x4b')][_0xe197('0x4c')]({'plain':!![]});if(!_0x3fe540)throw new Error(_0xe197('0x4d'));if(_0x3fe540[_0xe197('0x4e')]===_0xe197('0x4b')){var _0x35cba4=_0x4c8b14[_0xe197('0x4c')]({'plain':!![]});var _0x144327=_0xe197('0x4f');return db[_0xe197('0x50')][_0xe197('0x48')]({'where':{'name':_0x144327,'userProfileId':_0x3fe540[_0xe197('0x51')]},'raw':!![]})[_0xe197('0x27')](function(_0x1dd7ec){if(_0x1dd7ec&&_0x1dd7ec[_0xe197('0x52')]===0x0){return db[_0xe197('0x28')][_0xe197('0x49')]({'name':_0x35cba4[_0xe197('0x2b')],'resourceId':_0x35cba4['id'],'type':_0x1dd7ec[_0xe197('0x2b')],'sectionId':_0x1dd7ec['id']},{})[_0xe197('0x27')](function(){return _0x4c8b14;});}else{return _0x4c8b14;}})[_0xe197('0x46')](function(_0x2fc23c){logger[_0xe197('0x29')](_0xe197('0x53'),_0x2fc23c);throw _0x2fc23c;});}return _0x4c8b14;})[_0xe197('0x27')](respondWithResult(_0x457d97,0xc9))[_0xe197('0x46')](handleError(_0x457d97,null));};exports['update']=function(_0x1f74e2,_0x273c6d){if(_0x1f74e2['body']['id']){delete _0x1f74e2[_0xe197('0x4a')]['id'];}return db[_0xe197('0x2f')]['find']({'where':{'id':_0x1f74e2[_0xe197('0x47')]['id']}})['then'](handleEntityNotFound(_0x273c6d,null))[_0xe197('0x27')](saveUpdates(_0x1f74e2[_0xe197('0x4a')],null))[_0xe197('0x27')](respondWithResult(_0x273c6d,null))['catch'](handleError(_0x273c6d,null));};exports[_0xe197('0x26')]=function(_0x1de96e,_0x54f476){return db[_0xe197('0x2f')][_0xe197('0x48')]({'where':{'id':_0x1de96e['params']['id']}})[_0xe197('0x27')](handleEntityNotFound(_0x54f476,null))['then'](removeEntity(_0x54f476,null))[_0xe197('0x46')](handleError(_0x54f476,null));};exports[_0xe197('0x54')]=function(_0x4dc970,_0x1b72bf){return db[_0xe197('0x2f')][_0xe197('0x54')]()[_0xe197('0x27')](respondWithResult(_0x1b72bf,null))['catch'](handleError(_0x1b72bf,null));};exports[_0xe197('0x55')]=function(_0x32e153,_0x585b1b,_0x21e385){var _0x5c6797={'raw':!![],'where':{}},_0x3d1da2={},_0x865de6;return db['FaxQueue'][_0xe197('0x56')]({'where':{'id':_0x32e153[_0xe197('0x47')]['id']}})['then'](handleEntityNotFound(_0x585b1b,null))[_0xe197('0x27')](function(_0x1a41a8){if(_0x1a41a8){_0x865de6=_0x1a41a8['get']({'plain':!![]});_0x3d1da2['model']=_[_0xe197('0x35')](db['UserFaxQueue'][_0xe197('0x30')]);_0x3d1da2[_0xe197('0x34')]=_['keys'](_0x32e153[_0xe197('0x34')]);_0x3d1da2[_0xe197('0x3e')]=_[_0xe197('0x36')](_0x3d1da2[_0xe197('0x33')],_0x3d1da2['query']);_0x5c6797['attributes']=_[_0xe197('0x36')](_0x3d1da2[_0xe197('0x33')],qs[_0xe197('0x37')](_0x32e153[_0xe197('0x34')]['fields']));_0x5c6797[_0xe197('0x38')]=_0x5c6797[_0xe197('0x38')][_0xe197('0x39')]?_0x5c6797[_0xe197('0x38')]:_0x3d1da2[_0xe197('0x33')];if(!_0x32e153['query']['hasOwnProperty']('nolimit')){_0x5c6797[_0xe197('0x23')]=qs[_0xe197('0x23')](_0x32e153[_0xe197('0x34')][_0xe197('0x23')]);_0x5c6797['offset']=qs[_0xe197('0x21')](_0x32e153[_0xe197('0x34')][_0xe197('0x21')]);}_0x5c6797[_0xe197('0x57')]=qs['sort'](_0x32e153[_0xe197('0x34')][_0xe197('0x3b')]);_0x5c6797[_0xe197('0x3c')]=qs[_0xe197('0x3e')](_[_0xe197('0x3d')](_0x32e153[_0xe197('0x34')],_0x3d1da2[_0xe197('0x3e')]));_0x5c6797['where'][_0xe197('0x58')]=_0x1a41a8['id'];if(_0x32e153[_0xe197('0x34')][_0xe197('0x40')]){_0x5c6797['where']=_[_0xe197('0x3f')](_0x5c6797[_0xe197('0x3c')],{'$or':_[_0xe197('0x2e')](_0x5c6797[_0xe197('0x38')],function(_0x2a1ab5){var _0x116698={};_0x116698[_0x2a1ab5]={'$like':'%'+_0x32e153[_0xe197('0x34')][_0xe197('0x40')]+'%'};return _0x116698;})});}_0x5c6797=_['merge']({},_0x5c6797,_0x32e153['options']);return db[_0xe197('0x59')][_0xe197('0x44')](_0x5c6797);}})[_0xe197('0x27')](function(_0x4b8c4d){if(_0x4b8c4d){return db['User'][_0xe197('0x5a')]({'where':{'id':_[_0xe197('0x2e')](_0x4b8c4d,'UserId'),'role':_0xe197('0x5b')},'attributes':['id',_0xe197('0x2b'),_0xe197('0x5c'),_0xe197('0x5d'),_0xe197('0x5e')]});}})[_0xe197('0x27')](function(_0x2be167){if(_0x2be167){return{'count':_0x2be167[_0xe197('0x24')],'rows':_['map'](_0x2be167['rows'],function(_0x17bd61){return{'membername':_0x17bd61[_0xe197('0x2b')],'UserId':_0x17bd61['id'],'queue_name':_0x865de6['name'],'FaxQueueId':_0x865de6['id'],'interface':util['format'](_0xe197('0x5f'),'SIP',_0x17bd61[_0xe197('0x2b')]),'penalty':0x0,'paused':_0x17bd61[_0xe197('0x5c')],'createdAt':_0x17bd61[_0xe197('0x5e')],'updatedAt':_0x17bd61[_0xe197('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe197('0x27')](respondWithFilteredResult(_0x585b1b,_0x5c6797))[_0xe197('0x46')](handleError(_0x585b1b,null));};exports[_0xe197('0x60')]=function(_0x323499,_0x4fc11f,_0x47d304){var _0xa4807e={};var _0x272984={};var _0x2f0d1f;var _0x4cbc10;return db[_0xe197('0x2f')][_0xe197('0x56')]({'where':{'id':_0x323499[_0xe197('0x47')]['id']}})[_0xe197('0x27')](handleEntityNotFound(_0x4fc11f,null))[_0xe197('0x27')](function(_0x2ed463){if(_0x2ed463){_0x2f0d1f=_0x2ed463;_0x272984[_0xe197('0x33')]=_[_0xe197('0x35')](db[_0xe197('0x61')][_0xe197('0x30')]);_0x272984['query']=_['keys'](_0x323499[_0xe197('0x34')]);_0x272984[_0xe197('0x3e')]=_[_0xe197('0x36')](_0x272984[_0xe197('0x33')],_0x272984[_0xe197('0x34')]);_0xa4807e['attributes']=_[_0xe197('0x36')](_0x272984['model'],qs[_0xe197('0x37')](_0x323499['query'][_0xe197('0x37')]));_0xa4807e[_0xe197('0x38')]=_0xa4807e['attributes'][_0xe197('0x39')]?_0xa4807e[_0xe197('0x38')]:_0x272984[_0xe197('0x33')];_0xa4807e['order']=qs[_0xe197('0x3b')](_0x323499[_0xe197('0x34')]['sort']);_0xa4807e['where']=qs[_0xe197('0x3e')](_[_0xe197('0x3d')](_0x323499[_0xe197('0x34')],_0x272984[_0xe197('0x3e')]));if(_0x323499[_0xe197('0x34')][_0xe197('0x40')]){_0xa4807e['where']=_[_0xe197('0x3f')](_0xa4807e[_0xe197('0x3c')],{'$or':_[_0xe197('0x2e')](_0xa4807e['attributes'],function(_0x590519){var _0x6fca9f={};_0x6fca9f[_0x590519]={'$like':'%'+_0x323499['query'][_0xe197('0x40')]+'%'};return _0x6fca9f;})});}_0xa4807e=_[_0xe197('0x3f')]({},_0xa4807e,_0x323499[_0xe197('0x41')]);return _0x2f0d1f[_0xe197('0x60')](_0xa4807e);}})[_0xe197('0x27')](function(_0x389fac){if(_0x389fac){_0x4cbc10=_0x389fac[_0xe197('0x39')];if(!_0x323499[_0xe197('0x34')][_0xe197('0x3a')](_0xe197('0x62'))){_0xa4807e['limit']=qs[_0xe197('0x23')](_0x323499[_0xe197('0x34')]['limit']);_0xa4807e[_0xe197('0x21')]=qs['offset'](_0x323499[_0xe197('0x34')][_0xe197('0x21')]);}return _0x2f0d1f['getTeams'](_0xa4807e);}})[_0xe197('0x27')](function(_0xf2698a){if(_0xf2698a){return _0xf2698a?{'count':_0x4cbc10,'rows':_0xf2698a}:null;}})[_0xe197('0x27')](respondWithResult(_0x4fc11f,null))[_0xe197('0x46')](handleError(_0x4fc11f,null));};exports[_0xe197('0x63')]=function(_0x30c487,_0x14701a,_0x55b90e){var _0x17adfc=_0x30c487[_0xe197('0x4a')]['ids'];return db[_0xe197('0x61')][_0xe197('0x44')]({'where':{'id':_0x17adfc},'attributes':['id'],'include':[{'model':db[_0xe197('0x64')],'as':_0xe197('0x65'),'attributes':['id',_0xe197('0x2b'),_0xe197('0x66'),_0xe197('0x67'),_0xe197('0x68')],'raw':!![]}]})[_0xe197('0x27')](function(_0x31a4a9){if(_0x31a4a9){var _0x5d85d1=_[_0xe197('0x69')](_0x31a4a9,function(_0x3967c5){var _0x9bb730=_0x3967c5[_0xe197('0x4c')]({'plain':!![]});return _0x9bb730[_0xe197('0x65')];});return db['FaxQueue'][_0xe197('0x48')]({'where':{'id':_0x30c487[_0xe197('0x47')]['id']}})['then'](function(_0x457b53){return db[_0xe197('0x6a')][_0xe197('0x6b')](function(_0x12df94){return _0x457b53[_0xe197('0x63')](_0x17adfc,{'transaction':_0x12df94})[_0xe197('0x27')](function(){return BPromise[_0xe197('0x6c')](_0x5d85d1,function(_0x3e15bb){return db[_0xe197('0x59')]['findOrCreate']({'where':{'UserId':_0x3e15bb['id'],'FaxQueueId':_0x30c487[_0xe197('0x47')]['id']},'transaction':_0x12df94});});})[_0xe197('0x27')](function(){_0x5d85d1[_0xe197('0x6d')](function(_0xc49316){socket[_0xe197('0x6e')](_0xe197('0x6f'),{'UserId':_0xc49316['id'],'FaxQueueId':_0x457b53['id']});});});});});}})[_0xe197('0x27')](respondWithStatusCode(_0x14701a,null))['catch'](handleError(_0x14701a,null));};exports[_0xe197('0x70')]=function(_0x5db56d,_0x5e4d24,_0x39d6bb){return db[_0xe197('0x61')]['findAll']({'where':{'id':_0x5db56d[_0xe197('0x34')][_0xe197('0x71')]},'attributes':['id'],'include':[{'model':db[_0xe197('0x64')],'as':_0xe197('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5e4d24,null))[_0xe197('0x27')](function(_0x452bd3){var _0x32e272=_[_0xe197('0x2e')](_0x452bd3,'id');var _0x41fffb=[];var _0x2dc4f9=[];var _0x440f95=squel[_0xe197('0x72')]();_0x440f95[_0xe197('0x73')](_0xe197('0x74'))['from'](_0xe197('0x75'),'tq')['join'](_0xe197('0x76'),'ut',_0xe197('0x77'))['where'](_0xe197('0x78'),_0x5db56d[_0xe197('0x47')]['id']);for(var _0xefa7ba=0x0;_0xefa7ba<_0x452bd3[_0xe197('0x39')];_0xefa7ba+=0x1){let _0x1931e5=_0x452bd3[_0xefa7ba];for(var _0x58a7a2=0x0;_0x58a7a2<_0x1931e5[_0xe197('0x65')][_0xe197('0x39')];_0x58a7a2+=0x1){let _0x136a80=_0x1931e5[_0xe197('0x65')][_0x58a7a2];var _0x5a55fe=_0x440f95[_0xe197('0x79')]();_0x5a55fe['where']('ut.UserId\x20=\x20?',_0x136a80['id']);_0x2dc4f9[_0xe197('0x7a')](db[_0xe197('0x6a')][_0xe197('0x34')](_0x5a55fe[_0xe197('0x7b')](),{'type':db[_0xe197('0x6a')][_0xe197('0x7c')]['SELECT']})[_0xe197('0x27')](function(_0x2477da){if(_0x2477da[_0xe197('0x39')]===0x1){return _0x136a80['id'];}else{var _0x559df9=_[_0xe197('0x7d')](_['map'](_0x2477da,_0xe197('0x7e')),function(_0x5c8e6c){return _['includes'](_0x32e272,_0x5c8e6c);});if(_0x559df9){return _0x136a80['id'];}}}));}}return BPromise[_0xe197('0x7f')](_0x2dc4f9)[_0xe197('0x27')](function(_0x35bf80){_0x41fffb=_(_0x41fffb)['union'](_0x35bf80)[_0xe197('0x80')]()['value']();return db[_0xe197('0x2f')][_0xe197('0x48')]({'where':{'id':_0x5db56d[_0xe197('0x47')]['id']}})['then'](function(_0x1d471e){return db[_0xe197('0x6a')][_0xe197('0x6b')](function(_0x44cd84){return _0x1d471e[_0xe197('0x70')](_0x5db56d[_0xe197('0x34')][_0xe197('0x71')],{'transaction':_0x44cd84})[_0xe197('0x27')](function(){if(!_[_0xe197('0x81')](_0x41fffb)){return _0x1d471e[_0xe197('0x82')](_0x41fffb,{'transaction':_0x44cd84});}})[_0xe197('0x27')](function(){_0x41fffb[_0xe197('0x6d')](function(_0x503b2f){socket[_0xe197('0x6e')](_0xe197('0x83'),{'UserId':_0x503b2f,'FaxQueueId':_0x1d471e['id']});});});});});});})[_0xe197('0x27')](respondWithStatusCode(_0x5e4d24,null))['catch'](handleError(_0x5e4d24,null));};exports[_0xe197('0x84')]=function(_0x6cb179,_0x43daf5,_0x5eafab){return db[_0xe197('0x2f')][_0xe197('0x48')]({'where':{'id':_0x6cb179[_0xe197('0x47')]['id']}})[_0xe197('0x27')](handleEntityNotFound(_0x43daf5,null))[_0xe197('0x27')](function(_0x3cea91){if(_0x3cea91){return _0x3cea91[_0xe197('0x84')](_0x6cb179[_0xe197('0x4a')]['ids'],_[_0xe197('0x85')](_0x6cb179[_0xe197('0x4a')],[_0xe197('0x71'),'id'])||{})[_0xe197('0x86')](function(_0x514153){for(var _0xdfa76=0x0;_0xdfa76<_0x6cb179['body'][_0xe197('0x71')][_0xe197('0x39')];_0xdfa76+=0x1){socket['emit'](_0xe197('0x6f'),{'UserId':Number(_0x6cb179[_0xe197('0x4a')][_0xe197('0x71')][_0xdfa76]),'FaxQueueId':Number(_0x6cb179[_0xe197('0x47')]['id'])});}return _0x514153;});}})[_0xe197('0x27')](respondWithResult(_0x43daf5,null))[_0xe197('0x46')](handleError(_0x43daf5,null));};exports[_0xe197('0x82')]=function(_0x5cc60a,_0x5a59af,_0x2e36fe){return db['FaxQueue'][_0xe197('0x48')]({'where':{'id':_0x5cc60a[_0xe197('0x47')]['id']}})['then'](handleEntityNotFound(_0x5a59af,null))[_0xe197('0x27')](function(_0x28e08f){if(_0x28e08f){return _0x28e08f[_0xe197('0x82')](_0x5cc60a['query'][_0xe197('0x71')])[_0xe197('0x27')](function(){if(_[_0xe197('0x87')](_0x5cc60a[_0xe197('0x34')][_0xe197('0x71')])){for(var _0x2c60b3=0x0;_0x2c60b3<_0x5cc60a['query'][_0xe197('0x71')][_0xe197('0x39')];_0x2c60b3+=0x1){socket[_0xe197('0x6e')](_0xe197('0x83'),{'UserId':Number(_0x5cc60a[_0xe197('0x34')][_0xe197('0x71')][_0x2c60b3]),'FaxQueueId':Number(_0x5cc60a['params']['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x5cc60a[_0xe197('0x34')][_0xe197('0x71')]),'FaxQueueId':Number(_0x5cc60a['params']['id'])});}});}})[_0xe197('0x27')](respondWithStatusCode(_0x5a59af,null))['catch'](handleError(_0x5a59af,null));};exports[_0xe197('0x88')]=function(_0x5f1f50,_0x2a97b7,_0x3adf60){var _0x3c10fb={};var _0x3f9e03={};var _0x3fd463;var _0x228149;return db['FaxQueue']['findOne']({'where':{'id':_0x5f1f50[_0xe197('0x47')]['id']}})['then'](handleEntityNotFound(_0x2a97b7,null))[_0xe197('0x27')](function(_0xcfddf2){if(_0xcfddf2){_0x3fd463=_0xcfddf2;_0x3f9e03[_0xe197('0x33')]=_[_0xe197('0x35')](db['User'][_0xe197('0x30')]);_0x3f9e03['query']=_[_0xe197('0x35')](_0x5f1f50[_0xe197('0x34')]);_0x3f9e03[_0xe197('0x3e')]=_['intersection'](_0x3f9e03[_0xe197('0x33')],_0x3f9e03[_0xe197('0x34')]);_0x3c10fb[_0xe197('0x38')]=_[_0xe197('0x36')](_0x3f9e03[_0xe197('0x33')],qs[_0xe197('0x37')](_0x5f1f50['query']['fields']));_0x3c10fb[_0xe197('0x38')]=_0x3c10fb[_0xe197('0x38')][_0xe197('0x39')]?_0x3c10fb[_0xe197('0x38')]:_0x3f9e03[_0xe197('0x33')];_0x3c10fb['order']=qs[_0xe197('0x3b')](_0x5f1f50[_0xe197('0x34')][_0xe197('0x3b')]);_0x3c10fb[_0xe197('0x3c')]=qs['filters'](_[_0xe197('0x3d')](_0x5f1f50['query'],_0x3f9e03[_0xe197('0x3e')]));if(_0x5f1f50[_0xe197('0x34')][_0xe197('0x40')]){_0x3c10fb['where']=_['merge'](_0x3c10fb['where'],{'$or':_[_0xe197('0x2e')](_0x3c10fb[_0xe197('0x38')],function(_0x35a938){var _0x30ae76={};_0x30ae76[_0x35a938]={'$like':'%'+_0x5f1f50[_0xe197('0x34')][_0xe197('0x40')]+'%'};return _0x30ae76;})});}_0x3c10fb=_[_0xe197('0x3f')]({},_0x3c10fb,_0x5f1f50[_0xe197('0x41')]);return _0x3fd463['getAgents'](_0x3c10fb);}})[_0xe197('0x27')](function(_0x34f02e){if(_0x34f02e){_0x228149=_0x34f02e[_0xe197('0x39')];if(!_0x5f1f50['query'][_0xe197('0x3a')](_0xe197('0x62'))){_0x3c10fb[_0xe197('0x23')]=qs[_0xe197('0x23')](_0x5f1f50[_0xe197('0x34')]['limit']);_0x3c10fb[_0xe197('0x21')]=qs['offset'](_0x5f1f50[_0xe197('0x34')][_0xe197('0x21')]);}return _0x3fd463[_0xe197('0x88')](_0x3c10fb);}})['then'](function(_0x1e02f6){if(_0x1e02f6){return _0x1e02f6?{'count':_0x228149,'rows':_0x1e02f6}:null;}})[_0xe197('0x27')](respondWithResult(_0x2a97b7,null))[_0xe197('0x46')](handleError(_0x2a97b7,null));}; \ No newline at end of file +var _0x397f=['isEmpty','removeAgents','emit','userFaxQueue:remove','addAgents','omit','isArray','getAgents','options','eml-format','rimraf','moment','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','FaxQueues','error','stack','name','index','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','where','pick','filter','merge','map','VIRTUAL','include','findAll','catch','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','UserProfileResource','params','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','order','sort','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','rows','format','getTeams','addTeams','ids','Team','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value'];(function(_0x154d09,_0x431816){var _0x51208d=function(_0x5841d3){while(--_0x5841d3){_0x154d09['push'](_0x154d09['shift']());}};_0x51208d(++_0x431816);}(_0x397f,0x119));var _0xf397=function(_0x5f5206,_0x3a06b9){_0x5f5206=_0x5f5206-0x0;var _0x26fdf7=_0x397f[_0x5f5206];return _0x26fdf7;};'use strict';var emlformat=require(_0xf397('0x0'));var rimraf=require(_0xf397('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf397('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf397('0x3'));var path=require(_0xf397('0x4'));var sox=require(_0xf397('0x5'));var csv=require('to-csv');var ejs=require(_0xf397('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf397('0x7'));var squel=require(_0xf397('0x8'));var crypto=require('crypto');var jsforce=require(_0xf397('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf397('0xa'));var querystring=require(_0xf397('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf397('0xc'));var qs=require(_0xf397('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf397('0xe'));var logger=require(_0xf397('0xf'))(_0xf397('0x10'));var utils=require(_0xf397('0x11'));var config=require(_0xf397('0x12'));var licenseUtil=require(_0xf397('0x13'));var db=require(_0xf397('0x14'))['db'];config[_0xf397('0x15')]=_[_0xf397('0x16')](config[_0xf397('0x15')],{'host':_0xf397('0x17'),'port':0x18eb});var socket=require(_0xf397('0x18'))(new Redis(config[_0xf397('0x15')]));require(_0xf397('0x19'))['register'](socket);function respondWithStatusCode(_0x342034,_0x3e862d){_0x3e862d=_0x3e862d||0xcc;return function(_0x11169c){if(_0x11169c){return _0x342034[_0xf397('0x1a')](_0x3e862d);}return _0x342034[_0xf397('0x1b')](_0x3e862d)[_0xf397('0x1c')]();};}function respondWithResult(_0x4ea3df,_0x5a4c42){_0x5a4c42=_0x5a4c42||0xc8;return function(_0x8c1d42){if(_0x8c1d42){return _0x4ea3df[_0xf397('0x1b')](_0x5a4c42)['json'](_0x8c1d42);}};}function respondWithFilteredResult(_0x2a6fb8,_0x45d765){return function(_0x14e3a9){if(_0x14e3a9){var _0x5eb6c6=typeof _0x45d765[_0xf397('0x1d')]===_0xf397('0x1e')&&typeof _0x45d765['limit']==='undefined';var _0x396fcb=_0x14e3a9[_0xf397('0x1f')];var _0xc88f06=_0x5eb6c6?0x0:_0x45d765[_0xf397('0x1d')];var _0x3e0f28=_0x5eb6c6?_0x14e3a9[_0xf397('0x1f')]:_0x45d765[_0xf397('0x1d')]+_0x45d765[_0xf397('0x20')];var _0x5530e4;if(_0x3e0f28>=_0x396fcb){_0x3e0f28=_0x396fcb;_0x5530e4=0xc8;}else{_0x5530e4=0xce;}_0x2a6fb8['status'](_0x5530e4);return _0x2a6fb8[_0xf397('0x21')](_0xf397('0x22'),_0xc88f06+'-'+_0x3e0f28+'/'+_0x396fcb)['json'](_0x14e3a9);}return null;};}function patchUpdates(_0x206a16){return function(_0x3eff42){try{jsonpatch['apply'](_0x3eff42,_0x206a16,!![]);}catch(_0x22d7d9){return BPromise[_0xf397('0x23')](_0x22d7d9);}return _0x3eff42[_0xf397('0x24')]();};}function saveUpdates(_0x1500df,_0x45222c){return function(_0x412fcf){if(_0x412fcf){return _0x412fcf[_0xf397('0x25')](_0x1500df)[_0xf397('0x26')](function(_0xbd22d){return _0xbd22d;});}return null;};}function removeEntity(_0x456616,_0xef5769){return function(_0x33665c){if(_0x33665c){return _0x33665c[_0xf397('0x27')]()[_0xf397('0x26')](function(){var _0x7470a3=_0x33665c[_0xf397('0x28')]({'plain':!![]});var _0x4133f8=_0xf397('0x29');return db['UserProfileResource'][_0xf397('0x27')]({'where':{'type':_0x4133f8,'resourceId':_0x7470a3['id']}})[_0xf397('0x26')](function(){return _0x33665c;});})[_0xf397('0x26')](function(){_0x456616[_0xf397('0x1b')](0xcc)[_0xf397('0x1c')]();});}};}function handleEntityNotFound(_0x601f23,_0x590678){return function(_0x5d10b8){if(!_0x5d10b8){_0x601f23[_0xf397('0x1a')](0x194);}return _0x5d10b8;};}function handleError(_0x502f00,_0x1496fb){_0x1496fb=_0x1496fb||0x1f4;return function(_0x4e5441){logger[_0xf397('0x2a')](_0x4e5441[_0xf397('0x2b')]);if(_0x4e5441['name']){delete _0x4e5441[_0xf397('0x2c')];}_0x502f00[_0xf397('0x1b')](_0x1496fb)['send'](_0x4e5441);};}exports[_0xf397('0x2d')]=function(_0x33356b,_0x557514){var _0x274a5b={},_0x4f9f03={},_0x401701={'count':0x0,'rows':[]};var _0x50da50=_['map'](db[_0xf397('0x2e')][_0xf397('0x2f')],function(_0x56c24e){return{'name':_0x56c24e[_0xf397('0x30')],'type':_0x56c24e[_0xf397('0x31')][_0xf397('0x32')]};});_0x4f9f03[_0xf397('0x33')]=_['map'](_0x50da50,_0xf397('0x2c'));_0x4f9f03[_0xf397('0x34')]=_[_0xf397('0x35')](_0x33356b[_0xf397('0x34')]);_0x4f9f03[_0xf397('0x36')]=_[_0xf397('0x37')](_0x4f9f03[_0xf397('0x33')],_0x4f9f03[_0xf397('0x34')]);_0x274a5b[_0xf397('0x38')]=_['intersection'](_0x4f9f03[_0xf397('0x33')],qs['fields'](_0x33356b[_0xf397('0x34')]['fields']));_0x274a5b['attributes']=_0x274a5b[_0xf397('0x38')][_0xf397('0x39')]?_0x274a5b[_0xf397('0x38')]:_0x4f9f03['model'];if(!_0x33356b[_0xf397('0x34')]['hasOwnProperty'](_0xf397('0x3a'))){_0x274a5b[_0xf397('0x20')]=qs['limit'](_0x33356b[_0xf397('0x34')][_0xf397('0x20')]);_0x274a5b[_0xf397('0x1d')]=qs[_0xf397('0x1d')](_0x33356b['query'][_0xf397('0x1d')]);}_0x274a5b['order']=qs['sort'](_0x33356b[_0xf397('0x34')]['sort']);_0x274a5b[_0xf397('0x3b')]=qs['filters'](_[_0xf397('0x3c')](_0x33356b[_0xf397('0x34')],_0x4f9f03[_0xf397('0x36')]),_0x50da50);if(_0x33356b[_0xf397('0x34')][_0xf397('0x3d')]){_0x274a5b[_0xf397('0x3b')]=_[_0xf397('0x3e')](_0x274a5b[_0xf397('0x3b')],{'$or':_[_0xf397('0x3f')](_0x50da50,function(_0x3da4d8){if(_0x3da4d8[_0xf397('0x31')]!==_0xf397('0x40')){var _0xca34e4={};_0xca34e4[_0x3da4d8[_0xf397('0x2c')]]={'$like':'%'+_0x33356b[_0xf397('0x34')][_0xf397('0x3d')]+'%'};return _0xca34e4;}})});}_0x274a5b=_['merge']({},_0x274a5b,_0x33356b['options']);var _0x4d3610={'where':_0x274a5b[_0xf397('0x3b')]};return db[_0xf397('0x2e')][_0xf397('0x1f')](_0x4d3610)[_0xf397('0x26')](function(_0x340f68){_0x401701['count']=_0x340f68;if(_0x33356b[_0xf397('0x34')]['includeAll']){_0x274a5b[_0xf397('0x41')]=[{'all':!![]}];}return db[_0xf397('0x2e')][_0xf397('0x42')](_0x274a5b);})[_0xf397('0x26')](function(_0x434f24){_0x401701['rows']=_0x434f24;return _0x401701;})[_0xf397('0x26')](respondWithFilteredResult(_0x557514,_0x274a5b))[_0xf397('0x43')](handleError(_0x557514,null));};exports['show']=function(_0x26a3e5,_0x57aaa7){var _0x50e54d={'raw':!![],'where':{'id':_0x26a3e5['params']['id']}},_0x4fd9ad={};_0x4fd9ad[_0xf397('0x33')]=_[_0xf397('0x35')](db[_0xf397('0x2e')][_0xf397('0x2f')]);_0x4fd9ad[_0xf397('0x34')]=_[_0xf397('0x35')](_0x26a3e5[_0xf397('0x34')]);_0x4fd9ad[_0xf397('0x36')]=_['intersection'](_0x4fd9ad['model'],_0x4fd9ad[_0xf397('0x34')]);_0x50e54d[_0xf397('0x38')]=_[_0xf397('0x37')](_0x4fd9ad[_0xf397('0x33')],qs[_0xf397('0x44')](_0x26a3e5[_0xf397('0x34')][_0xf397('0x44')]));_0x50e54d[_0xf397('0x38')]=_0x50e54d[_0xf397('0x38')][_0xf397('0x39')]?_0x50e54d['attributes']:_0x4fd9ad[_0xf397('0x33')];if(_0x26a3e5[_0xf397('0x34')][_0xf397('0x45')]){_0x50e54d[_0xf397('0x41')]=[{'all':!![]}];}_0x50e54d=_[_0xf397('0x3e')]({},_0x50e54d,_0x26a3e5['options']);return db[_0xf397('0x2e')][_0xf397('0x46')](_0x50e54d)[_0xf397('0x26')](handleEntityNotFound(_0x57aaa7,null))[_0xf397('0x26')](respondWithResult(_0x57aaa7,null))[_0xf397('0x43')](handleError(_0x57aaa7,null));};exports[_0xf397('0x47')]=function(_0x931c,_0x39e627){return db[_0xf397('0x2e')]['create'](_0x931c[_0xf397('0x48')],{})[_0xf397('0x26')](function(_0x5ecc6f){var _0x5239ef=_0x931c[_0xf397('0x49')][_0xf397('0x28')]({'plain':!![]});if(!_0x5239ef)throw new Error(_0xf397('0x4a'));if(_0x5239ef['role']===_0xf397('0x49')){var _0x4288ca=_0x5ecc6f[_0xf397('0x28')]({'plain':!![]});var _0x34f5d6=_0xf397('0x29');return db['UserProfileSection'][_0xf397('0x46')]({'where':{'name':_0x34f5d6,'userProfileId':_0x5239ef['userProfileId']},'raw':!![]})[_0xf397('0x26')](function(_0xadde0e){if(_0xadde0e&&_0xadde0e[_0xf397('0x4b')]===0x0){return db[_0xf397('0x4c')][_0xf397('0x47')]({'name':_0x4288ca[_0xf397('0x2c')],'resourceId':_0x4288ca['id'],'type':_0xadde0e[_0xf397('0x2c')],'sectionId':_0xadde0e['id']},{})[_0xf397('0x26')](function(){return _0x5ecc6f;});}else{return _0x5ecc6f;}})[_0xf397('0x43')](function(_0x4b8302){logger[_0xf397('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b8302);throw _0x4b8302;});}return _0x5ecc6f;})[_0xf397('0x26')](respondWithResult(_0x39e627,0xc9))[_0xf397('0x43')](handleError(_0x39e627,null));};exports['update']=function(_0x54c528,_0x1d4c9a){if(_0x54c528['body']['id']){delete _0x54c528[_0xf397('0x48')]['id'];}return db[_0xf397('0x2e')][_0xf397('0x46')]({'where':{'id':_0x54c528[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x1d4c9a,null))[_0xf397('0x26')](saveUpdates(_0x54c528['body'],null))[_0xf397('0x26')](respondWithResult(_0x1d4c9a,null))['catch'](handleError(_0x1d4c9a,null));};exports[_0xf397('0x27')]=function(_0x281a4d,_0x25e1ac){return db['FaxQueue']['find']({'where':{'id':_0x281a4d[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x25e1ac,null))[_0xf397('0x26')](removeEntity(_0x25e1ac,null))[_0xf397('0x43')](handleError(_0x25e1ac,null));};exports[_0xf397('0x4e')]=function(_0x34e843,_0x6983de){return db[_0xf397('0x2e')][_0xf397('0x4e')]()[_0xf397('0x26')](respondWithResult(_0x6983de,null))[_0xf397('0x43')](handleError(_0x6983de,null));};exports[_0xf397('0x4f')]=function(_0x17ebb8,_0x575b18,_0x3fbfe2){var _0x50c757={'raw':!![],'where':{}},_0x2decb3={},_0x19be40;return db['FaxQueue'][_0xf397('0x50')]({'where':{'id':_0x17ebb8['params']['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x575b18,null))[_0xf397('0x26')](function(_0x2c43f9){if(_0x2c43f9){_0x19be40=_0x2c43f9[_0xf397('0x28')]({'plain':!![]});_0x2decb3[_0xf397('0x33')]=_[_0xf397('0x35')](db[_0xf397('0x51')][_0xf397('0x2f')]);_0x2decb3[_0xf397('0x34')]=_[_0xf397('0x35')](_0x17ebb8[_0xf397('0x34')]);_0x2decb3[_0xf397('0x36')]=_[_0xf397('0x37')](_0x2decb3[_0xf397('0x33')],_0x2decb3['query']);_0x50c757[_0xf397('0x38')]=_['intersection'](_0x2decb3['model'],qs['fields'](_0x17ebb8['query'][_0xf397('0x44')]));_0x50c757[_0xf397('0x38')]=_0x50c757[_0xf397('0x38')][_0xf397('0x39')]?_0x50c757[_0xf397('0x38')]:_0x2decb3[_0xf397('0x33')];if(!_0x17ebb8[_0xf397('0x34')][_0xf397('0x52')](_0xf397('0x3a'))){_0x50c757['limit']=qs[_0xf397('0x20')](_0x17ebb8[_0xf397('0x34')][_0xf397('0x20')]);_0x50c757[_0xf397('0x1d')]=qs[_0xf397('0x1d')](_0x17ebb8['query'][_0xf397('0x1d')]);}_0x50c757[_0xf397('0x53')]=qs[_0xf397('0x54')](_0x17ebb8['query'][_0xf397('0x54')]);_0x50c757[_0xf397('0x3b')]=qs[_0xf397('0x36')](_[_0xf397('0x3c')](_0x17ebb8[_0xf397('0x34')],_0x2decb3[_0xf397('0x36')]));_0x50c757[_0xf397('0x3b')][_0xf397('0x55')]=_0x2c43f9['id'];if(_0x17ebb8['query']['filter']){_0x50c757[_0xf397('0x3b')]=_['merge'](_0x50c757['where'],{'$or':_[_0xf397('0x3f')](_0x50c757['attributes'],function(_0x4f4df3){var _0x431506={};_0x431506[_0x4f4df3]={'$like':'%'+_0x17ebb8['query'][_0xf397('0x3d')]+'%'};return _0x431506;})});}_0x50c757=_[_0xf397('0x3e')]({},_0x50c757,_0x17ebb8['options']);return db['UserFaxQueue']['findAll'](_0x50c757);}})[_0xf397('0x26')](function(_0x43ecf4){if(_0x43ecf4){return db[_0xf397('0x56')][_0xf397('0x57')]({'where':{'id':_[_0xf397('0x3f')](_0x43ecf4,_0xf397('0x58')),'role':_0xf397('0x59')},'attributes':['id',_0xf397('0x2c'),_0xf397('0x5a'),_0xf397('0x5b'),_0xf397('0x5c')]});}})[_0xf397('0x26')](function(_0x79419f){if(_0x79419f){return{'count':_0x79419f[_0xf397('0x1f')],'rows':_[_0xf397('0x3f')](_0x79419f[_0xf397('0x5d')],function(_0x4a202a){return{'membername':_0x4a202a[_0xf397('0x2c')],'UserId':_0x4a202a['id'],'queue_name':_0x19be40[_0xf397('0x2c')],'FaxQueueId':_0x19be40['id'],'interface':util[_0xf397('0x5e')]('%s/%s','SIP',_0x4a202a[_0xf397('0x2c')]),'penalty':0x0,'paused':_0x4a202a['faxPause'],'createdAt':_0x4a202a['createdAt'],'updatedAt':_0x4a202a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x575b18,_0x50c757))[_0xf397('0x43')](handleError(_0x575b18,null));};exports['getTeams']=function(_0x4cbfee,_0x252ff4,_0x4f64c9){var _0x169839={};var _0x3729d7={};var _0x57fa2c;var _0x23302e;return db[_0xf397('0x2e')][_0xf397('0x50')]({'where':{'id':_0x4cbfee[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x252ff4,null))[_0xf397('0x26')](function(_0x68859d){if(_0x68859d){_0x57fa2c=_0x68859d;_0x3729d7[_0xf397('0x33')]=_[_0xf397('0x35')](db['Team'][_0xf397('0x2f')]);_0x3729d7[_0xf397('0x34')]=_[_0xf397('0x35')](_0x4cbfee[_0xf397('0x34')]);_0x3729d7['filters']=_[_0xf397('0x37')](_0x3729d7[_0xf397('0x33')],_0x3729d7[_0xf397('0x34')]);_0x169839[_0xf397('0x38')]=_[_0xf397('0x37')](_0x3729d7[_0xf397('0x33')],qs[_0xf397('0x44')](_0x4cbfee[_0xf397('0x34')][_0xf397('0x44')]));_0x169839['attributes']=_0x169839[_0xf397('0x38')]['length']?_0x169839[_0xf397('0x38')]:_0x3729d7['model'];_0x169839[_0xf397('0x53')]=qs[_0xf397('0x54')](_0x4cbfee[_0xf397('0x34')][_0xf397('0x54')]);_0x169839[_0xf397('0x3b')]=qs[_0xf397('0x36')](_[_0xf397('0x3c')](_0x4cbfee[_0xf397('0x34')],_0x3729d7['filters']));if(_0x4cbfee['query'][_0xf397('0x3d')]){_0x169839[_0xf397('0x3b')]=_[_0xf397('0x3e')](_0x169839[_0xf397('0x3b')],{'$or':_[_0xf397('0x3f')](_0x169839[_0xf397('0x38')],function(_0x256e15){var _0x52a3f3={};_0x52a3f3[_0x256e15]={'$like':'%'+_0x4cbfee[_0xf397('0x34')]['filter']+'%'};return _0x52a3f3;})});}_0x169839=_[_0xf397('0x3e')]({},_0x169839,_0x4cbfee['options']);return _0x57fa2c[_0xf397('0x5f')](_0x169839);}})[_0xf397('0x26')](function(_0x8916ab){if(_0x8916ab){_0x23302e=_0x8916ab[_0xf397('0x39')];if(!_0x4cbfee[_0xf397('0x34')][_0xf397('0x52')](_0xf397('0x3a'))){_0x169839['limit']=qs['limit'](_0x4cbfee[_0xf397('0x34')][_0xf397('0x20')]);_0x169839[_0xf397('0x1d')]=qs['offset'](_0x4cbfee[_0xf397('0x34')]['offset']);}return _0x57fa2c[_0xf397('0x5f')](_0x169839);}})[_0xf397('0x26')](function(_0x2a404e){if(_0x2a404e){return _0x2a404e?{'count':_0x23302e,'rows':_0x2a404e}:null;}})['then'](respondWithResult(_0x252ff4,null))[_0xf397('0x43')](handleError(_0x252ff4,null));};exports[_0xf397('0x60')]=function(_0x36d672,_0x4b5456,_0x1b8741){var _0x3aa74d=_0x36d672[_0xf397('0x48')][_0xf397('0x61')];return db[_0xf397('0x62')]['findAll']({'where':{'id':_0x3aa74d},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xf397('0x2c'),'online',_0xf397('0x63'),_0xf397('0x64')],'raw':!![]}]})[_0xf397('0x26')](function(_0x56ab66){if(_0x56ab66){var _0x4f5cd5=_[_0xf397('0x65')](_0x56ab66,function(_0x3553c7){var _0x3cc2aa=_0x3553c7['get']({'plain':!![]});return _0x3cc2aa[_0xf397('0x66')];});return db[_0xf397('0x2e')][_0xf397('0x46')]({'where':{'id':_0x36d672[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](function(_0x32f560){return db[_0xf397('0x67')][_0xf397('0x68')](function(_0x3a0b3b){return _0x32f560[_0xf397('0x60')](_0x3aa74d,{'transaction':_0x3a0b3b})['then'](function(){return BPromise[_0xf397('0x69')](_0x4f5cd5,function(_0x3161ab){return db[_0xf397('0x51')][_0xf397('0x6a')]({'where':{'UserId':_0x3161ab['id'],'FaxQueueId':_0x36d672[_0xf397('0x4d')]['id']},'transaction':_0x3a0b3b});});})[_0xf397('0x26')](function(){_0x4f5cd5[_0xf397('0x6b')](function(_0x144045){socket['emit'](_0xf397('0x6c'),{'UserId':_0x144045['id'],'FaxQueueId':_0x32f560['id']});});});});});}})[_0xf397('0x26')](respondWithStatusCode(_0x4b5456,null))[_0xf397('0x43')](handleError(_0x4b5456,null));};exports[_0xf397('0x6d')]=function(_0x44fca0,_0x5cd1be,_0x4c6e91){return db[_0xf397('0x62')][_0xf397('0x42')]({'where':{'id':_0x44fca0[_0xf397('0x34')][_0xf397('0x61')]},'attributes':['id'],'include':[{'model':db[_0xf397('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf397('0x26')](handleEntityNotFound(_0x5cd1be,null))[_0xf397('0x26')](function(_0x39e8c3){var _0x45b612=_[_0xf397('0x3f')](_0x39e8c3,'id');var _0x3ceee0=[];var _0x55da1d=[];var _0xe9dec0=squel[_0xf397('0x6e')]();_0xe9dec0['field']('tq.TeamId')[_0xf397('0x6f')](_0xf397('0x70'),'tq')[_0xf397('0x71')](_0xf397('0x72'),'ut',_0xf397('0x73'))[_0xf397('0x3b')](_0xf397('0x74'),_0x44fca0[_0xf397('0x4d')]['id']);for(var _0x2019a2=0x0;_0x2019a2<_0x39e8c3['length'];_0x2019a2+=0x1){let _0x33e5ad=_0x39e8c3[_0x2019a2];for(var _0x577843=0x0;_0x577843<_0x33e5ad[_0xf397('0x66')][_0xf397('0x39')];_0x577843+=0x1){let _0x901efa=_0x33e5ad['Agents'][_0x577843];var _0x4f1779=_0xe9dec0['clone']();_0x4f1779[_0xf397('0x3b')]('ut.UserId\x20=\x20?',_0x901efa['id']);_0x55da1d[_0xf397('0x75')](db[_0xf397('0x67')][_0xf397('0x34')](_0x4f1779['toString'](),{'type':db[_0xf397('0x67')][_0xf397('0x76')][_0xf397('0x77')]})[_0xf397('0x26')](function(_0x5e0bd5){if(_0x5e0bd5['length']===0x1){return _0x901efa['id'];}else{var _0x546f39=_[_0xf397('0x78')](_[_0xf397('0x3f')](_0x5e0bd5,_0xf397('0x79')),function(_0x4c2abe){return _[_0xf397('0x7a')](_0x45b612,_0x4c2abe);});if(_0x546f39){return _0x901efa['id'];}}}));}}return BPromise[_0xf397('0x7b')](_0x55da1d)['then'](function(_0x2cba42){_0x3ceee0=_(_0x3ceee0)[_0xf397('0x7c')](_0x2cba42)[_0xf397('0x7d')]()[_0xf397('0x7e')]();return db['FaxQueue'][_0xf397('0x46')]({'where':{'id':_0x44fca0[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](function(_0x28e499){return db[_0xf397('0x67')]['transaction'](function(_0x33a4d5){return _0x28e499[_0xf397('0x6d')](_0x44fca0[_0xf397('0x34')]['ids'],{'transaction':_0x33a4d5})[_0xf397('0x26')](function(){if(!_[_0xf397('0x7f')](_0x3ceee0)){return _0x28e499[_0xf397('0x80')](_0x3ceee0,{'transaction':_0x33a4d5});}})[_0xf397('0x26')](function(){_0x3ceee0[_0xf397('0x6b')](function(_0x562cee){socket[_0xf397('0x81')](_0xf397('0x82'),{'UserId':_0x562cee,'FaxQueueId':_0x28e499['id']});});});});});});})['then'](respondWithStatusCode(_0x5cd1be,null))[_0xf397('0x43')](handleError(_0x5cd1be,null));};exports[_0xf397('0x83')]=function(_0x32e1c8,_0x12588c,_0x2603d7){return db[_0xf397('0x2e')][_0xf397('0x46')]({'where':{'id':_0x32e1c8[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x12588c,null))[_0xf397('0x26')](function(_0x43a700){if(_0x43a700){return _0x43a700['addAgents'](_0x32e1c8['body'][_0xf397('0x61')],_[_0xf397('0x84')](_0x32e1c8[_0xf397('0x48')],['ids','id'])||{})['spread'](function(_0x406833){for(var _0x24b5f1=0x0;_0x24b5f1<_0x32e1c8[_0xf397('0x48')][_0xf397('0x61')][_0xf397('0x39')];_0x24b5f1+=0x1){socket[_0xf397('0x81')](_0xf397('0x6c'),{'UserId':Number(_0x32e1c8[_0xf397('0x48')][_0xf397('0x61')][_0x24b5f1]),'FaxQueueId':Number(_0x32e1c8[_0xf397('0x4d')]['id'])});}return _0x406833;});}})['then'](respondWithResult(_0x12588c,null))['catch'](handleError(_0x12588c,null));};exports[_0xf397('0x80')]=function(_0x3dd900,_0x9c3e4f,_0x5dcece){return db[_0xf397('0x2e')][_0xf397('0x46')]({'where':{'id':_0x3dd900[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x9c3e4f,null))[_0xf397('0x26')](function(_0x190229){if(_0x190229){return _0x190229[_0xf397('0x80')](_0x3dd900['query']['ids'])['then'](function(){if(_[_0xf397('0x85')](_0x3dd900[_0xf397('0x34')][_0xf397('0x61')])){for(var _0x1fa2ae=0x0;_0x1fa2ae<_0x3dd900[_0xf397('0x34')][_0xf397('0x61')][_0xf397('0x39')];_0x1fa2ae+=0x1){socket[_0xf397('0x81')]('userFaxQueue:remove',{'UserId':Number(_0x3dd900[_0xf397('0x34')]['ids'][_0x1fa2ae]),'FaxQueueId':Number(_0x3dd900['params']['id'])});}}else{socket['emit'](_0xf397('0x82'),{'UserId':Number(_0x3dd900['query']['ids']),'FaxQueueId':Number(_0x3dd900[_0xf397('0x4d')]['id'])});}});}})[_0xf397('0x26')](respondWithStatusCode(_0x9c3e4f,null))[_0xf397('0x43')](handleError(_0x9c3e4f,null));};exports[_0xf397('0x86')]=function(_0x4383cb,_0x2c8b05,_0x5e55b0){var _0x405124={};var _0x52c9a3={};var _0x22884c;var _0x13b334;return db['FaxQueue'][_0xf397('0x50')]({'where':{'id':_0x4383cb[_0xf397('0x4d')]['id']}})[_0xf397('0x26')](handleEntityNotFound(_0x2c8b05,null))[_0xf397('0x26')](function(_0x29f8e2){if(_0x29f8e2){_0x22884c=_0x29f8e2;_0x52c9a3[_0xf397('0x33')]=_['keys'](db[_0xf397('0x56')][_0xf397('0x2f')]);_0x52c9a3[_0xf397('0x34')]=_[_0xf397('0x35')](_0x4383cb[_0xf397('0x34')]);_0x52c9a3[_0xf397('0x36')]=_[_0xf397('0x37')](_0x52c9a3[_0xf397('0x33')],_0x52c9a3['query']);_0x405124[_0xf397('0x38')]=_['intersection'](_0x52c9a3['model'],qs[_0xf397('0x44')](_0x4383cb[_0xf397('0x34')][_0xf397('0x44')]));_0x405124[_0xf397('0x38')]=_0x405124[_0xf397('0x38')][_0xf397('0x39')]?_0x405124[_0xf397('0x38')]:_0x52c9a3[_0xf397('0x33')];_0x405124[_0xf397('0x53')]=qs[_0xf397('0x54')](_0x4383cb['query']['sort']);_0x405124[_0xf397('0x3b')]=qs[_0xf397('0x36')](_[_0xf397('0x3c')](_0x4383cb[_0xf397('0x34')],_0x52c9a3[_0xf397('0x36')]));if(_0x4383cb['query'][_0xf397('0x3d')]){_0x405124['where']=_['merge'](_0x405124[_0xf397('0x3b')],{'$or':_['map'](_0x405124[_0xf397('0x38')],function(_0x15644c){var _0x505df6={};_0x505df6[_0x15644c]={'$like':'%'+_0x4383cb[_0xf397('0x34')][_0xf397('0x3d')]+'%'};return _0x505df6;})});}_0x405124=_[_0xf397('0x3e')]({},_0x405124,_0x4383cb[_0xf397('0x87')]);return _0x22884c[_0xf397('0x86')](_0x405124);}})['then'](function(_0x33fb69){if(_0x33fb69){_0x13b334=_0x33fb69[_0xf397('0x39')];if(!_0x4383cb[_0xf397('0x34')][_0xf397('0x52')](_0xf397('0x3a'))){_0x405124[_0xf397('0x20')]=qs[_0xf397('0x20')](_0x4383cb['query']['limit']);_0x405124['offset']=qs[_0xf397('0x1d')](_0x4383cb[_0xf397('0x34')][_0xf397('0x1d')]);}return _0x22884c[_0xf397('0x86')](_0x405124);}})[_0xf397('0x26')](function(_0x459cdf){if(_0x459cdf){return _0x459cdf?{'count':_0x13b334,'rows':_0x459cdf}:null;}})[_0xf397('0x26')](respondWithResult(_0x2c8b05,null))[_0xf397('0x43')](handleError(_0x2c8b05,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index f7c171f..19cb3d0 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 _0xe3ab=['FaxQueue','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xe3ab,0xc5));var _0xbe3a=function(_0x5a4113,_0x466a19){_0x5a4113=_0x5a4113-0x0;var _0x50de17=_0xe3ab[_0x5a4113];return _0x50de17;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xbe3a('0x0'))['db'][_0xbe3a('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe3a('0x2'),'afterUpdate':_0xbe3a('0x3'),'afterDestroy':_0xbe3a('0x4')};function emitEvent(_0x160e8e){return function(_0x5dd778,_0x586e92,_0x3381ca){FaxQueueEvents[_0xbe3a('0x5')](_0x160e8e+':'+_0x5dd778['id'],_0x5dd778);FaxQueueEvents[_0xbe3a('0x5')](_0x160e8e,_0x5dd778);_0x3381ca(null);};}for(var e in events){if(events[_0xbe3a('0x6')](e)){var event=events[e];FaxQueue[_0xbe3a('0x7')](e,emitEvent(event));}}module[_0xbe3a('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x62e3=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hook'];(function(_0x4d62cf,_0x44a4ec){var _0x4bb78d=function(_0x33f666){while(--_0x33f666){_0x4d62cf['push'](_0x4d62cf['shift']());}};_0x4bb78d(++_0x44a4ec);}(_0x62e3,0xf9));var _0x362e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62e3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x362e('0x0'));var FaxQueue=require(_0x362e('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x362e('0x2')](0x0);var events={'afterCreate':_0x362e('0x3'),'afterUpdate':_0x362e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x21f800){return function(_0x2996bc,_0xf8150a,_0x4b2148){FaxQueueEvents['emit'](_0x21f800+':'+_0x2996bc['id'],_0x2996bc);FaxQueueEvents[_0x362e('0x5')](_0x21f800,_0x2996bc);_0x4b2148(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x362e('0x6')](e,emitEvent(event));}}module[_0x362e('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 4ee4d8f..864e106 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 _0xa0e0=['FaxQueue','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x12b09d,_0x5ae94a){var _0x331e4e=function(_0x67dd23){while(--_0x67dd23){_0x12b09d['push'](_0x12b09d['shift']());}};_0x331e4e(++_0x5ae94a);}(_0xa0e0,0x17b));var _0x0a0e=function(_0x4e9ebd,_0x33e51a){_0x4e9ebd=_0x4e9ebd-0x0;var _0x339831=_0xa0e0[_0x4e9ebd];return _0x339831;};'use strict';var _=require('lodash');var util=require(_0x0a0e('0x0'));var logger=require(_0x0a0e('0x1'))('api');var moment=require(_0x0a0e('0x2'));var BPromise=require(_0x0a0e('0x3'));var rp=require(_0x0a0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a0e('0x5'));var config=require(_0x0a0e('0x6'));var attributes=require('./faxQueue.attributes');module[_0x0a0e('0x7')]=function(_0x230d74,_0x298562){return _0x230d74['define'](_0x0a0e('0x8'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5612=['rimraf','../../config/environment','exports','FaxQueue','fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3b9277,_0x463f10){var _0x16fa13=function(_0x5ae96b){while(--_0x5ae96b){_0x3b9277['push'](_0x3b9277['shift']());}};_0x16fa13(++_0x463f10);}(_0x5612,0x19d));var _0x2561=function(_0x36c626,_0xebdde4){_0x36c626=_0x36c626-0x0;var _0x582d10=_0x5612[_0x36c626];return _0x582d10;};'use strict';var _=require(_0x2561('0x0'));var util=require('util');var logger=require(_0x2561('0x1'))(_0x2561('0x2'));var moment=require(_0x2561('0x3'));var BPromise=require(_0x2561('0x4'));var rp=require(_0x2561('0x5'));var fs=require('fs');var path=require(_0x2561('0x6'));var rimraf=require(_0x2561('0x7'));var config=require(_0x2561('0x8'));var attributes=require('./faxQueue.attributes');module[_0x2561('0x9')]=function(_0x26dcf3,_0x2e50e0){return _0x26dcf3['define'](_0x2561('0xa'),attributes,{'tableName':_0x2561('0xb'),'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 7f58eab..b031409 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 _0x16eb=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','redis','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','include','map','model','then','ShowFaxQueue','find','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x16eb,0x1c7));var _0xb16e=function(_0x4b6531,_0xd4a85){_0x4b6531=_0x4b6531-0x0;var _0x1ccff2=_0x16eb[_0x4b6531];return _0x1ccff2;};'use strict';var _=require(_0xb16e('0x0'));var util=require(_0xb16e('0x1'));var moment=require('moment');var BPromise=require(_0xb16e('0x2'));var rs=require(_0xb16e('0x3'));var fs=require('fs');var Redis=require(_0xb16e('0x4'));var db=require(_0xb16e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb16e('0x6'))(_0xb16e('0x7'));var config=require(_0xb16e('0x8'));var jayson=require(_0xb16e('0x9'));var client=jayson['client'][_0xb16e('0xa')]({'port':0x232a});config['redis']=_[_0xb16e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb16e('0xc'))(new Redis(config[_0xb16e('0xd')]));require(_0xb16e('0xe'))['register'](socket);function respondWithRpcPromise(_0xba2120,_0x474ad2,_0x4eb56d){return new BPromise(function(_0x236b7f,_0x5399fe){return client[_0xb16e('0xf')](_0xba2120,_0x4eb56d)['then'](function(_0x514a10){logger[_0xb16e('0x10')](_0xb16e('0x11'),_0x474ad2,_0xb16e('0x12'));logger[_0xb16e('0x13')](_0xb16e('0x14'),_0x474ad2,_0xb16e('0x12'),JSON[_0xb16e('0x15')](_0x514a10));if(_0x514a10[_0xb16e('0x16')]){if(_0x514a10[_0xb16e('0x16')]['code']===0x1f4){logger['error'](_0xb16e('0x11'),_0x474ad2,_0x514a10[_0xb16e('0x16')]['message']);return _0x5399fe(_0x514a10[_0xb16e('0x16')][_0xb16e('0x17')]);}logger[_0xb16e('0x16')](_0xb16e('0x11'),_0x474ad2,_0x514a10['error'][_0xb16e('0x17')]);return _0x236b7f(_0x514a10[_0xb16e('0x16')][_0xb16e('0x17')]);}else{logger['info'](_0xb16e('0x11'),_0x474ad2,_0xb16e('0x12'));_0x236b7f(_0x514a10['result']['message']);}})[_0xb16e('0x18')](function(_0x11b98d){logger[_0xb16e('0x16')]('FaxQueue,\x20%s,\x20%s',_0x474ad2,_0x11b98d);_0x5399fe(_0x11b98d);});});}exports[_0xb16e('0x19')]=function(_0x4d081c){var _0x37702f=this;return new Promise(function(_0x11065d,_0x345f39){return db[_0xb16e('0x1a')][_0xb16e('0x1b')]({'raw':_0x4d081c[_0xb16e('0x1c')]?_0x4d081c[_0xb16e('0x1c')][_0xb16e('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d081c[_0xb16e('0x1c')]?_0x4d081c[_0xb16e('0x1c')][_0xb16e('0x1e')]||null:null,'attributes':_0x4d081c[_0xb16e('0x1c')]?_0x4d081c[_0xb16e('0x1c')][_0xb16e('0x1f')]||null:null,'limit':_0x4d081c[_0xb16e('0x1c')]?_0x4d081c[_0xb16e('0x1c')]['limit']||null:null,'include':_0x4d081c[_0xb16e('0x1c')]?_0x4d081c[_0xb16e('0x1c')][_0xb16e('0x20')]?_[_0xb16e('0x21')](_0x4d081c[_0xb16e('0x1c')][_0xb16e('0x20')],function(_0x18ce25){return{'model':db[_0x18ce25['model']],'as':_0x18ce25['as'],'attributes':_0x18ce25['attributes'],'include':_0x18ce25[_0xb16e('0x20')]?_[_0xb16e('0x21')](_0x18ce25[_0xb16e('0x20')],function(_0x9d16b7){return{'model':db[_0x9d16b7['model']],'as':_0x9d16b7['as'],'attributes':_0x9d16b7[_0xb16e('0x1f')],'include':_0x9d16b7[_0xb16e('0x20')]?_[_0xb16e('0x21')](_0x9d16b7[_0xb16e('0x20')],function(_0x34c535){return{'model':db[_0x34c535[_0xb16e('0x22')]],'as':_0x34c535['as'],'attributes':_0x34c535[_0xb16e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb16e('0x23')](function(_0x257940){logger[_0xb16e('0x10')]('GetFaxQueue',_0x4d081c);logger[_0xb16e('0x13')](_0xb16e('0x19'),_0x4d081c,JSON[_0xb16e('0x15')](_0x257940));_0x11065d(_0x257940);})['catch'](function(_0x77fba){logger['error']('GetFaxQueue',_0x77fba[_0xb16e('0x17')],_0x4d081c);_0x345f39(_0x37702f[_0xb16e('0x16')](0x1f4,_0x77fba[_0xb16e('0x17')]));});});};exports[_0xb16e('0x24')]=function(_0x4e4dfb){var _0x3942fa=this;return new Promise(function(_0x27b475,_0x51c890){return db[_0xb16e('0x1a')][_0xb16e('0x25')]({'raw':_0x4e4dfb[_0xb16e('0x1c')]?_0x4e4dfb[_0xb16e('0x1c')][_0xb16e('0x1d')]===undefined?!![]:![]:!![],'where':_0x4e4dfb[_0xb16e('0x1c')]?_0x4e4dfb[_0xb16e('0x1c')][_0xb16e('0x1e')]||null:null,'attributes':_0x4e4dfb[_0xb16e('0x1c')]?_0x4e4dfb['options']['attributes']||null:null,'include':_0x4e4dfb['options']?_0x4e4dfb[_0xb16e('0x1c')]['include']?_[_0xb16e('0x21')](_0x4e4dfb[_0xb16e('0x1c')][_0xb16e('0x20')],function(_0x2ae3c5){return{'model':db[_0x2ae3c5[_0xb16e('0x22')]],'as':_0x2ae3c5['as'],'attributes':_0x2ae3c5[_0xb16e('0x1f')],'include':_0x2ae3c5[_0xb16e('0x20')]?_[_0xb16e('0x21')](_0x2ae3c5[_0xb16e('0x20')],function(_0x3f876d){return{'model':db[_0x3f876d[_0xb16e('0x22')]],'as':_0x3f876d['as'],'attributes':_0x3f876d[_0xb16e('0x1f')],'include':_0x3f876d['include']?_[_0xb16e('0x21')](_0x3f876d['include'],function(_0x250ff7){return{'model':db[_0x250ff7[_0xb16e('0x22')]],'as':_0x250ff7['as'],'attributes':_0x250ff7[_0xb16e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30f67a){logger[_0xb16e('0x10')](_0xb16e('0x24'),_0x4e4dfb);logger[_0xb16e('0x13')]('ShowFaxQueue',_0x4e4dfb,JSON[_0xb16e('0x15')](_0x30f67a));_0x27b475(_0x30f67a);})['catch'](function(_0x194cfb){logger[_0xb16e('0x16')]('ShowFaxQueue',_0x194cfb['message'],_0x4e4dfb);_0x51c890(_0x3942fa[_0xb16e('0x16')](0x1f4,_0x194cfb['message']));});});}; \ No newline at end of file +var _0xc706=['then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','map','model','stringify','catch','ShowFaxQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0xc706,0x1c4));var _0x6c70=function(_0x4d942e,_0x46316b){_0x4d942e=_0x4d942e-0x0;var _0x1e84a4=_0xc706[_0x4d942e];return _0x1e84a4;};'use strict';var _=require(_0x6c70('0x0'));var util=require(_0x6c70('0x1'));var moment=require(_0x6c70('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c70('0x3'));var db=require(_0x6c70('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c70('0x5'))(_0x6c70('0x6'));var config=require(_0x6c70('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6c70('0x8')][_0x6c70('0x9')]({'port':0x232a});config[_0x6c70('0xa')]=_[_0x6c70('0xb')](config[_0x6c70('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c70('0xc'))(new Redis(config['redis']));require(_0x6c70('0xd'))[_0x6c70('0xe')](socket);function respondWithRpcPromise(_0x440576,_0x1352a6,_0x41da4a){return new BPromise(function(_0x1997d5,_0x314d11){return client[_0x6c70('0xf')](_0x440576,_0x41da4a)[_0x6c70('0x10')](function(_0x19a8b6){logger[_0x6c70('0x11')](_0x6c70('0x12'),_0x1352a6,_0x6c70('0x13'));logger[_0x6c70('0x14')](_0x6c70('0x15'),_0x1352a6,_0x6c70('0x13'),JSON['stringify'](_0x19a8b6));if(_0x19a8b6[_0x6c70('0x16')]){if(_0x19a8b6['error'][_0x6c70('0x17')]===0x1f4){logger[_0x6c70('0x16')](_0x6c70('0x12'),_0x1352a6,_0x19a8b6['error']['message']);return _0x314d11(_0x19a8b6[_0x6c70('0x16')][_0x6c70('0x18')]);}logger['error'](_0x6c70('0x12'),_0x1352a6,_0x19a8b6[_0x6c70('0x16')][_0x6c70('0x18')]);return _0x1997d5(_0x19a8b6[_0x6c70('0x16')]['message']);}else{logger[_0x6c70('0x11')]('FaxQueue,\x20%s,\x20%s',_0x1352a6,_0x6c70('0x13'));_0x1997d5(_0x19a8b6[_0x6c70('0x19')][_0x6c70('0x18')]);}})['catch'](function(_0x129188){logger[_0x6c70('0x16')](_0x6c70('0x12'),_0x1352a6,_0x129188);_0x314d11(_0x129188);});});}exports[_0x6c70('0x1a')]=function(_0x1807c9){var _0xe6fc7d=this;return new Promise(function(_0x24561a,_0x4fdb27){return db[_0x6c70('0x1b')][_0x6c70('0x1c')]({'raw':_0x1807c9[_0x6c70('0x1d')]?_0x1807c9[_0x6c70('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1807c9[_0x6c70('0x1d')]?_0x1807c9[_0x6c70('0x1d')][_0x6c70('0x1e')]||null:null,'attributes':_0x1807c9[_0x6c70('0x1d')]?_0x1807c9[_0x6c70('0x1d')][_0x6c70('0x1f')]||null:null,'limit':_0x1807c9[_0x6c70('0x1d')]?_0x1807c9[_0x6c70('0x1d')][_0x6c70('0x20')]||null:null,'include':_0x1807c9[_0x6c70('0x1d')]?_0x1807c9['options'][_0x6c70('0x21')]?_[_0x6c70('0x22')](_0x1807c9[_0x6c70('0x1d')][_0x6c70('0x21')],function(_0x7d34e1){return{'model':db[_0x7d34e1[_0x6c70('0x23')]],'as':_0x7d34e1['as'],'attributes':_0x7d34e1['attributes'],'include':_0x7d34e1['include']?_[_0x6c70('0x22')](_0x7d34e1[_0x6c70('0x21')],function(_0x3de19b){return{'model':db[_0x3de19b[_0x6c70('0x23')]],'as':_0x3de19b['as'],'attributes':_0x3de19b[_0x6c70('0x1f')],'include':_0x3de19b[_0x6c70('0x21')]?_[_0x6c70('0x22')](_0x3de19b[_0x6c70('0x21')],function(_0x2fd452){return{'model':db[_0x2fd452[_0x6c70('0x23')]],'as':_0x2fd452['as'],'attributes':_0x2fd452[_0x6c70('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6c70('0x10')](function(_0x2b954a){logger[_0x6c70('0x11')](_0x6c70('0x1a'),_0x1807c9);logger['debug'](_0x6c70('0x1a'),_0x1807c9,JSON[_0x6c70('0x24')](_0x2b954a));_0x24561a(_0x2b954a);})[_0x6c70('0x25')](function(_0x3d9a27){logger[_0x6c70('0x16')](_0x6c70('0x1a'),_0x3d9a27[_0x6c70('0x18')],_0x1807c9);_0x4fdb27(_0xe6fc7d['error'](0x1f4,_0x3d9a27[_0x6c70('0x18')]));});});};exports[_0x6c70('0x26')]=function(_0x276d4d){var _0x409b9a=this;return new Promise(function(_0x26c96b,_0xdef9db){return db[_0x6c70('0x1b')]['find']({'raw':_0x276d4d[_0x6c70('0x1d')]?_0x276d4d[_0x6c70('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x276d4d[_0x6c70('0x1d')]?_0x276d4d[_0x6c70('0x1d')][_0x6c70('0x1e')]||null:null,'attributes':_0x276d4d[_0x6c70('0x1d')]?_0x276d4d[_0x6c70('0x1d')][_0x6c70('0x1f')]||null:null,'include':_0x276d4d[_0x6c70('0x1d')]?_0x276d4d[_0x6c70('0x1d')][_0x6c70('0x21')]?_[_0x6c70('0x22')](_0x276d4d[_0x6c70('0x1d')][_0x6c70('0x21')],function(_0x260c61){return{'model':db[_0x260c61[_0x6c70('0x23')]],'as':_0x260c61['as'],'attributes':_0x260c61[_0x6c70('0x1f')],'include':_0x260c61[_0x6c70('0x21')]?_[_0x6c70('0x22')](_0x260c61[_0x6c70('0x21')],function(_0x264cb1){return{'model':db[_0x264cb1[_0x6c70('0x23')]],'as':_0x264cb1['as'],'attributes':_0x264cb1['attributes'],'include':_0x264cb1[_0x6c70('0x21')]?_[_0x6c70('0x22')](_0x264cb1[_0x6c70('0x21')],function(_0x222ebf){return{'model':db[_0x222ebf['model']],'as':_0x222ebf['as'],'attributes':_0x222ebf[_0x6c70('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6c70('0x10')](function(_0x37fbb6){logger[_0x6c70('0x11')](_0x6c70('0x26'),_0x276d4d);logger[_0x6c70('0x14')](_0x6c70('0x26'),_0x276d4d,JSON[_0x6c70('0x24')](_0x37fbb6));_0x26c96b(_0x37fbb6);})[_0x6c70('0x25')](function(_0x563a9d){logger['error'](_0x6c70('0x26'),_0x563a9d[_0x6c70('0x18')],_0x276d4d);_0xdef9db(_0x409b9a[_0x6c70('0x16')](0x1f4,_0x563a9d[_0x6c70('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 7b253f7..160571e 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 _0x7bee=['length','faxQueue:','save','remove','update','emit','removeListener'];(function(_0x58a364,_0x3439f6){var _0x409b74=function(_0xff5c15){while(--_0xff5c15){_0x58a364['push'](_0x58a364['shift']());}};_0x409b74(++_0x3439f6);}(_0x7bee,0x13d));var _0xe7be=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7bee[_0x46698a];return _0x356db0;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xe7be('0x0'),_0xe7be('0x1'),_0xe7be('0x2')];function createListener(_0x30cc00,_0x3d4282){return function(_0x590b88){_0x3d4282[_0xe7be('0x3')](_0x30cc00,_0x590b88);};}function removeListener(_0xdb373e,_0x47a88e){return function(){FaxQueueEvents[_0xe7be('0x4')](_0xdb373e,_0x47a88e);};}exports['register']=function(_0x4d8520){for(var _0x16eab1=0x0,_0x554764=events[_0xe7be('0x5')];_0x16eab1<_0x554764;_0x16eab1++){var _0x595be3=events[_0x16eab1];var _0x1d5cff=createListener(_0xe7be('0x6')+_0x595be3,_0x4d8520);FaxQueueEvents['on'](_0x595be3,_0x1d5cff);}}; \ No newline at end of file +var _0x2f15=['update','register','faxQueue:','save'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x2f15,0x6f));var _0x52f1=function(_0x4c9eb3,_0x39d57c){_0x4c9eb3=_0x4c9eb3-0x0;var _0x545688=_0x2f15[_0x4c9eb3];return _0x545688;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x52f1('0x0'),'remove',_0x52f1('0x1')];function createListener(_0x3548a8,_0xdc883e){return function(_0x1fe2d3){_0xdc883e['emit'](_0x3548a8,_0x1fe2d3);};}function removeListener(_0x3a0ce3,_0x3f2390){return function(){FaxQueueEvents['removeListener'](_0x3a0ce3,_0x3f2390);};}exports[_0x52f1('0x2')]=function(_0x218476){for(var _0x405430=0x0,_0x542cfa=events['length'];_0x405430<_0x542cfa;_0x405430++){var _0x5c1265=events[_0x405430];var _0x334792=createListener(_0x52f1('0x3')+_0x5c1265,_0x218476);FaxQueueEvents['on'](_0x5c1265,_0x334792);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 7b7a00d..3ec7474 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 _0x96f2=['post','addAgents','put','destroy','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create'];(function(_0x4c4284,_0x581403){var _0x18e0fb=function(_0x24abe8){while(--_0x24abe8){_0x4c4284['push'](_0x4c4284['shift']());}};_0x18e0fb(++_0x581403);}(_0x96f2,0xb0));var _0x296f=function(_0x279609,_0x4ee10f){_0x279609=_0x279609-0x0;var _0x52760e=_0x96f2[_0x279609];return _0x52760e;};'use strict';var multer=require(_0x296f('0x0'));var util=require('util');var path=require(_0x296f('0x1'));var timeout=require(_0x296f('0x2'));var express=require(_0x296f('0x3'));var router=express['Router']();var fs_extra=require(_0x296f('0x4'));var auth=require(_0x296f('0x5'));var interaction=require(_0x296f('0x6'));var config=require('../../config/environment');var controller=require(_0x296f('0x7'));router[_0x296f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x296f('0x8')](_0x296f('0x9'),auth[_0x296f('0xa')](),controller[_0x296f('0xb')]);router[_0x296f('0x8')](_0x296f('0xc'),auth[_0x296f('0xa')](),controller[_0x296f('0xd')]);router[_0x296f('0x8')](_0x296f('0xe'),auth['isAuthenticated'](),controller[_0x296f('0xf')]);router[_0x296f('0x8')](_0x296f('0x10'),auth['isAuthenticated'](),controller[_0x296f('0x11')]);router[_0x296f('0x8')](_0x296f('0x12'),auth[_0x296f('0xa')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x296f('0x13')]);router[_0x296f('0x14')](_0x296f('0x10'),auth[_0x296f('0xa')](),controller['addTeams']);router[_0x296f('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x296f('0x15')]);router[_0x296f('0x16')](_0x296f('0xc'),auth[_0x296f('0xa')](),controller['update']);router['delete'](_0x296f('0xc'),auth['isAuthenticated'](),controller[_0x296f('0x17')]);router[_0x296f('0x18')](_0x296f('0x10'),auth['isAuthenticated'](),controller[_0x296f('0x19')]);router[_0x296f('0x18')]('/:id/users',auth[_0x296f('0xa')](),controller[_0x296f('0x1a')]);module[_0x296f('0x1b')]=router; \ No newline at end of file +var _0xf562=['destroy','removeTeams','/:id/users','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','getMembers','/:id/teams','post','create','addTeams','addAgents','put','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf562,0x100));var _0x2f56=function(_0x1fdd56,_0x273762){_0x1fdd56=_0x1fdd56-0x0;var _0x5dcbe3=_0xf562[_0x1fdd56];return _0x5dcbe3;};'use strict';var multer=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var path=require(_0x2f56('0x2'));var timeout=require(_0x2f56('0x3'));var express=require(_0x2f56('0x4'));var router=express[_0x2f56('0x5')]();var fs_extra=require(_0x2f56('0x6'));var auth=require(_0x2f56('0x7'));var interaction=require(_0x2f56('0x8'));var config=require('../../config/environment');var controller=require(_0x2f56('0x9'));router['get']('/',auth[_0x2f56('0xa')](),controller['index']);router[_0x2f56('0xb')](_0x2f56('0xc'),auth[_0x2f56('0xa')](),controller[_0x2f56('0xd')]);router[_0x2f56('0xb')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller[_0x2f56('0xf')]);router[_0x2f56('0xb')]('/:id/members',auth[_0x2f56('0xa')](),controller[_0x2f56('0x10')]);router['get'](_0x2f56('0x11'),auth[_0x2f56('0xa')](),controller['getTeams']);router[_0x2f56('0xb')]('/:id/users',auth[_0x2f56('0xa')](),controller['getAgents']);router[_0x2f56('0x12')]('/',auth[_0x2f56('0xa')](),controller[_0x2f56('0x13')]);router[_0x2f56('0x12')](_0x2f56('0x11'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x14')]);router[_0x2f56('0x12')]('/:id/users',auth[_0x2f56('0xa')](),controller[_0x2f56('0x15')]);router[_0x2f56('0x16')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller['update']);router[_0x2f56('0x17')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x18')]);router[_0x2f56('0x17')]('/:id/teams',auth[_0x2f56('0xa')](),controller[_0x2f56('0x19')]);router[_0x2f56('0x17')](_0x2f56('0x1a'),auth[_0x2f56('0xa')](),controller['removeAgents']);module[_0x2f56('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index c81dcd7..de9f82b 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 _0x89b7=['STRING','DATE','exports'];(function(_0x2baca1,_0x2f3557){var _0x9aa62a=function(_0x5c47d5){while(--_0x5c47d5){_0x2baca1['push'](_0x2baca1['shift']());}};_0x9aa62a(++_0x2f3557);}(_0x89b7,0x1dc));var _0x789b=function(_0x336e33,_0x527fa3){_0x336e33=_0x336e33-0x0;var _0x6c333a=_0x89b7[_0x336e33];return _0x6c333a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x789b('0x0')]={'uniqueid':{'type':Sequelize[_0x789b('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x789b('0x1')]},'joinAt':{'type':Sequelize[_0x789b('0x2')]},'leaveAt':{'type':Sequelize[_0x789b('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x789b('0x2')]},'reason':{'type':Sequelize[_0x789b('0x1')]}}; \ No newline at end of file +var _0x1539=['DATE','sequelize','exports','STRING'];(function(_0xc48ca6,_0x1cb9cc){var _0x42342f=function(_0x455bef){while(--_0x455bef){_0xc48ca6['push'](_0xc48ca6['shift']());}};_0x42342f(++_0x1cb9cc);}(_0x1539,0x139));var _0x9153=function(_0x2bbc44,_0x3725ed){_0x2bbc44=_0x2bbc44-0x0;var _0x316148=_0x1539[_0x2bbc44];return _0x316148;};'use strict';var moment=require('moment');var Sequelize=require(_0x9153('0x0'));module[_0x9153('0x1')]={'uniqueid':{'type':Sequelize[_0x9153('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x9153('0x3')]},'leaveAt':{'type':Sequelize[_0x9153('0x3')]},'acceptAt':{'type':Sequelize[_0x9153('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x9153('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 280a4b6..cad4821 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 _0xfb30=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfb30,0x88));var _0x0fb3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfb30[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x0fb3('0x0'));var rimraf=require(_0x0fb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0fb3('0x2'));var moment=require('moment');var BPromise=require(_0x0fb3('0x3'));var Mustache=require(_0x0fb3('0x4'));var util=require(_0x0fb3('0x5'));var path=require(_0x0fb3('0x6'));var sox=require(_0x0fb3('0x7'));var csv=require(_0x0fb3('0x8'));var ejs=require(_0x0fb3('0x9'));var fs=require('fs');var fs_extra=require(_0x0fb3('0xa'));var _=require(_0x0fb3('0xb'));var squel=require(_0x0fb3('0xc'));var crypto=require(_0x0fb3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0fb3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0fb3('0xf'));var Papa=require(_0x0fb3('0x10'));var Redis=require(_0x0fb3('0x11'));var authService=require(_0x0fb3('0x12'));var qs=require(_0x0fb3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fb3('0x14'))(_0x0fb3('0x15'));var utils=require(_0x0fb3('0x16'));var config=require(_0x0fb3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fb3('0x18'))['db'];function respondWithStatusCode(_0x419d55,_0x4eddbe){_0x4eddbe=_0x4eddbe||0xcc;return function(_0x289ac5){if(_0x289ac5){return _0x419d55[_0x0fb3('0x19')](_0x4eddbe);}return _0x419d55[_0x0fb3('0x1a')](_0x4eddbe)[_0x0fb3('0x1b')]();};}function respondWithResult(_0xb2742,_0x116af7){_0x116af7=_0x116af7||0xc8;return function(_0x172cbb){if(_0x172cbb){return _0xb2742[_0x0fb3('0x1a')](_0x116af7)['json'](_0x172cbb);}};}function respondWithFilteredResult(_0x28eb50,_0x390f57){return function(_0x38db4c){if(_0x38db4c){var _0x3bfca3=typeof _0x390f57[_0x0fb3('0x1c')]===_0x0fb3('0x1d')&&typeof _0x390f57[_0x0fb3('0x1e')]===_0x0fb3('0x1d');var _0x57bca4=_0x38db4c[_0x0fb3('0x1f')];var _0x5c6559=_0x3bfca3?0x0:_0x390f57['offset'];var _0x5e2024=_0x3bfca3?_0x38db4c[_0x0fb3('0x1f')]:_0x390f57[_0x0fb3('0x1c')]+_0x390f57[_0x0fb3('0x1e')];var _0x500079;if(_0x5e2024>=_0x57bca4){_0x5e2024=_0x57bca4;_0x500079=0xc8;}else{_0x500079=0xce;}_0x28eb50[_0x0fb3('0x1a')](_0x500079);return _0x28eb50[_0x0fb3('0x20')](_0x0fb3('0x21'),_0x5c6559+'-'+_0x5e2024+'/'+_0x57bca4)[_0x0fb3('0x22')](_0x38db4c);}return null;};}function patchUpdates(_0x40ddf6){return function(_0x4bf44){try{jsonpatch[_0x0fb3('0x23')](_0x4bf44,_0x40ddf6,!![]);}catch(_0x4be3a1){return BPromise[_0x0fb3('0x24')](_0x4be3a1);}return _0x4bf44[_0x0fb3('0x25')]();};}function saveUpdates(_0x242953,_0x3c53e7){return function(_0x3b19c3){if(_0x3b19c3){return _0x3b19c3[_0x0fb3('0x26')](_0x242953)['then'](function(_0x3f1152){return _0x3f1152;});}return null;};}function removeEntity(_0xeb97c8,_0x2e678a){return function(_0x2ebfcb){if(_0x2ebfcb){return _0x2ebfcb[_0x0fb3('0x27')]()[_0x0fb3('0x28')](function(){_0xeb97c8[_0x0fb3('0x1a')](0xcc)[_0x0fb3('0x1b')]();});}};}function handleEntityNotFound(_0xc7949f,_0x576456){return function(_0x20b79e){if(!_0x20b79e){_0xc7949f['sendStatus'](0x194);}return _0x20b79e;};}function handleError(_0x998064,_0x48602e){_0x48602e=_0x48602e||0x1f4;return function(_0x427783){logger[_0x0fb3('0x29')](_0x427783[_0x0fb3('0x2a')]);if(_0x427783[_0x0fb3('0x2b')]){delete _0x427783['name'];}_0x998064['status'](_0x48602e)[_0x0fb3('0x2c')](_0x427783);};}exports['index']=function(_0xbf2629,_0x25bdd2){var _0x1d9987={},_0x111e9f={},_0x2708ef={'count':0x0,'rows':[]};var _0x2af61c=_[_0x0fb3('0x2d')](db[_0x0fb3('0x2e')][_0x0fb3('0x2f')],function(_0x63a500){return{'name':_0x63a500[_0x0fb3('0x30')],'type':_0x63a500[_0x0fb3('0x31')][_0x0fb3('0x32')]};});_0x111e9f[_0x0fb3('0x33')]=_[_0x0fb3('0x2d')](_0x2af61c,_0x0fb3('0x2b'));_0x111e9f[_0x0fb3('0x34')]=_[_0x0fb3('0x35')](_0xbf2629[_0x0fb3('0x34')]);_0x111e9f['filters']=_[_0x0fb3('0x36')](_0x111e9f[_0x0fb3('0x33')],_0x111e9f['query']);_0x1d9987[_0x0fb3('0x37')]=_[_0x0fb3('0x36')](_0x111e9f['model'],qs[_0x0fb3('0x38')](_0xbf2629['query'][_0x0fb3('0x38')]));_0x1d9987[_0x0fb3('0x37')]=_0x1d9987['attributes'][_0x0fb3('0x39')]?_0x1d9987[_0x0fb3('0x37')]:_0x111e9f['model'];if(!_0xbf2629[_0x0fb3('0x34')]['hasOwnProperty'](_0x0fb3('0x3a'))){_0x1d9987[_0x0fb3('0x1e')]=qs[_0x0fb3('0x1e')](_0xbf2629[_0x0fb3('0x34')][_0x0fb3('0x1e')]);_0x1d9987[_0x0fb3('0x1c')]=qs[_0x0fb3('0x1c')](_0xbf2629['query'][_0x0fb3('0x1c')]);}_0x1d9987[_0x0fb3('0x3b')]=qs[_0x0fb3('0x3c')](_0xbf2629[_0x0fb3('0x34')][_0x0fb3('0x3c')]);_0x1d9987[_0x0fb3('0x3d')]=qs[_0x0fb3('0x3e')](_['pick'](_0xbf2629[_0x0fb3('0x34')],_0x111e9f[_0x0fb3('0x3e')]),_0x2af61c);if(_0xbf2629[_0x0fb3('0x34')][_0x0fb3('0x3f')]){_0x1d9987['where']=_[_0x0fb3('0x40')](_0x1d9987['where'],{'$or':_[_0x0fb3('0x2d')](_0x2af61c,function(_0x569e31){if(_0x569e31[_0x0fb3('0x31')]!==_0x0fb3('0x41')){var _0x2a75f9={};_0x2a75f9[_0x569e31[_0x0fb3('0x2b')]]={'$like':'%'+_0xbf2629['query'][_0x0fb3('0x3f')]+'%'};return _0x2a75f9;}})});}_0x1d9987=_[_0x0fb3('0x40')]({},_0x1d9987,_0xbf2629[_0x0fb3('0x42')]);var _0x10ea57={'where':_0x1d9987[_0x0fb3('0x3d')]};return db[_0x0fb3('0x2e')][_0x0fb3('0x1f')](_0x10ea57)[_0x0fb3('0x28')](function(_0x42507c){_0x2708ef[_0x0fb3('0x1f')]=_0x42507c;if(_0xbf2629[_0x0fb3('0x34')]['includeAll']){_0x1d9987[_0x0fb3('0x43')]=[{'all':!![]}];}return db[_0x0fb3('0x2e')][_0x0fb3('0x44')](_0x1d9987);})['then'](function(_0x45f666){_0x2708ef[_0x0fb3('0x45')]=_0x45f666;return _0x2708ef;})[_0x0fb3('0x28')](respondWithFilteredResult(_0x25bdd2,_0x1d9987))[_0x0fb3('0x46')](handleError(_0x25bdd2,null));};exports[_0x0fb3('0x47')]=function(_0x4bf567,_0x62634b){var _0x48c0e7={'raw':!![],'where':{'id':_0x4bf567['params']['id']}},_0xfd091f={};_0xfd091f[_0x0fb3('0x33')]=_[_0x0fb3('0x35')](db[_0x0fb3('0x2e')][_0x0fb3('0x2f')]);_0xfd091f[_0x0fb3('0x34')]=_[_0x0fb3('0x35')](_0x4bf567[_0x0fb3('0x34')]);_0xfd091f[_0x0fb3('0x3e')]=_[_0x0fb3('0x36')](_0xfd091f[_0x0fb3('0x33')],_0xfd091f['query']);_0x48c0e7[_0x0fb3('0x37')]=_['intersection'](_0xfd091f[_0x0fb3('0x33')],qs[_0x0fb3('0x38')](_0x4bf567[_0x0fb3('0x34')][_0x0fb3('0x38')]));_0x48c0e7[_0x0fb3('0x37')]=_0x48c0e7[_0x0fb3('0x37')][_0x0fb3('0x39')]?_0x48c0e7[_0x0fb3('0x37')]:_0xfd091f[_0x0fb3('0x33')];if(_0x4bf567[_0x0fb3('0x34')][_0x0fb3('0x48')]){_0x48c0e7[_0x0fb3('0x43')]=[{'all':!![]}];}_0x48c0e7=_['merge']({},_0x48c0e7,_0x4bf567[_0x0fb3('0x42')]);return db[_0x0fb3('0x2e')][_0x0fb3('0x49')](_0x48c0e7)['then'](handleEntityNotFound(_0x62634b,null))['then'](respondWithResult(_0x62634b,null))['catch'](handleError(_0x62634b,null));};exports[_0x0fb3('0x4a')]=function(_0x3948a0,_0x289360){return db['FaxQueueReport'][_0x0fb3('0x4a')](_0x3948a0[_0x0fb3('0x4b')],{})[_0x0fb3('0x28')](respondWithResult(_0x289360,0xc9))['catch'](handleError(_0x289360,null));};exports['update']=function(_0x57e92a,_0x16a2fc){if(_0x57e92a[_0x0fb3('0x4b')]['id']){delete _0x57e92a[_0x0fb3('0x4b')]['id'];}return db[_0x0fb3('0x2e')][_0x0fb3('0x49')]({'where':{'id':_0x57e92a['params']['id']}})[_0x0fb3('0x28')](handleEntityNotFound(_0x16a2fc,null))[_0x0fb3('0x28')](saveUpdates(_0x57e92a['body'],null))[_0x0fb3('0x28')](respondWithResult(_0x16a2fc,null))[_0x0fb3('0x46')](handleError(_0x16a2fc,null));};exports[_0x0fb3('0x27')]=function(_0xa9033e,_0x2beb43){return db[_0x0fb3('0x2e')][_0x0fb3('0x49')]({'where':{'id':_0xa9033e[_0x0fb3('0x4c')]['id']}})[_0x0fb3('0x28')](handleEntityNotFound(_0x2beb43,null))[_0x0fb3('0x28')](removeEntity(_0x2beb43,null))[_0x0fb3('0x46')](handleError(_0x2beb43,null));};exports[_0x0fb3('0x4d')]=function(_0x19302e,_0x4062ac){return db['FaxQueueReport'][_0x0fb3('0x4d')]()[_0x0fb3('0x28')](respondWithResult(_0x4062ac,null))[_0x0fb3('0x46')](handleError(_0x4062ac,null));}; \ No newline at end of file +var _0x9755=['rows','catch','show','params','rawAttributes','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','error','stack','name','send','index','FaxQueueReport','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','then','includeAll','include'];(function(_0x3b2806,_0x329a73){var _0x3c10bb=function(_0x4464f4){while(--_0x4464f4){_0x3b2806['push'](_0x3b2806['shift']());}};_0x3c10bb(++_0x329a73);}(_0x9755,0x1c6));var _0x5975=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x9755[_0x158da6];return _0x429c30;};'use strict';var emlformat=require(_0x5975('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5975('0x1'));var jsonpatch=require(_0x5975('0x2'));var rp=require(_0x5975('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5975('0x4'));var path=require(_0x5975('0x5'));var sox=require(_0x5975('0x6'));var csv=require(_0x5975('0x7'));var ejs=require(_0x5975('0x8'));var fs=require('fs');var fs_extra=require(_0x5975('0x9'));var _=require(_0x5975('0xa'));var squel=require('squel');var crypto=require(_0x5975('0xb'));var jsforce=require(_0x5975('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5975('0x7'));var querystring=require(_0x5975('0xd'));var Papa=require(_0x5975('0xe'));var Redis=require('ioredis');var authService=require(_0x5975('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5975('0x10'));var logger=require(_0x5975('0x11'))(_0x5975('0x12'));var utils=require('../../config/utils');var config=require(_0x5975('0x13'));var licenseUtil=require(_0x5975('0x14'));var db=require(_0x5975('0x15'))['db'];function respondWithStatusCode(_0x52bdaa,_0x119571){_0x119571=_0x119571||0xcc;return function(_0x2ad3ed){if(_0x2ad3ed){return _0x52bdaa[_0x5975('0x16')](_0x119571);}return _0x52bdaa[_0x5975('0x17')](_0x119571)['end']();};}function respondWithResult(_0x5e355a,_0x331385){_0x331385=_0x331385||0xc8;return function(_0x1543c5){if(_0x1543c5){return _0x5e355a[_0x5975('0x17')](_0x331385)['json'](_0x1543c5);}};}function respondWithFilteredResult(_0x1a3299,_0x4de825){return function(_0x145f39){if(_0x145f39){var _0x58da02=typeof _0x4de825[_0x5975('0x18')]===_0x5975('0x19')&&typeof _0x4de825[_0x5975('0x1a')]===_0x5975('0x19');var _0x25f2a0=_0x145f39[_0x5975('0x1b')];var _0x203829=_0x58da02?0x0:_0x4de825['offset'];var _0x4e6806=_0x58da02?_0x145f39['count']:_0x4de825['offset']+_0x4de825['limit'];var _0x296185;if(_0x4e6806>=_0x25f2a0){_0x4e6806=_0x25f2a0;_0x296185=0xc8;}else{_0x296185=0xce;}_0x1a3299['status'](_0x296185);return _0x1a3299[_0x5975('0x1c')](_0x5975('0x1d'),_0x203829+'-'+_0x4e6806+'/'+_0x25f2a0)[_0x5975('0x1e')](_0x145f39);}return null;};}function patchUpdates(_0x1977bb){return function(_0x5a9df3){try{jsonpatch[_0x5975('0x1f')](_0x5a9df3,_0x1977bb,!![]);}catch(_0x133e32){return BPromise[_0x5975('0x20')](_0x133e32);}return _0x5a9df3['save']();};}function saveUpdates(_0x34b195,_0xc916a8){return function(_0x1689e2){if(_0x1689e2){return _0x1689e2[_0x5975('0x21')](_0x34b195)['then'](function(_0x48d708){return _0x48d708;});}return null;};}function removeEntity(_0x1cef80,_0x2da6c8){return function(_0x504892){if(_0x504892){return _0x504892[_0x5975('0x22')]()['then'](function(){_0x1cef80[_0x5975('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e8b5a,_0x28c52f){return function(_0x4a1c85){if(!_0x4a1c85){_0x5e8b5a[_0x5975('0x16')](0x194);}return _0x4a1c85;};}function handleError(_0x763302,_0x57efee){_0x57efee=_0x57efee||0x1f4;return function(_0x54f304){logger[_0x5975('0x23')](_0x54f304[_0x5975('0x24')]);if(_0x54f304[_0x5975('0x25')]){delete _0x54f304[_0x5975('0x25')];}_0x763302[_0x5975('0x17')](_0x57efee)[_0x5975('0x26')](_0x54f304);};}exports[_0x5975('0x27')]=function(_0x24ee17,_0x406e65){var _0x52c4d8={},_0x37db84={},_0xd65354={'count':0x0,'rows':[]};var _0x2920b0=_['map'](db[_0x5975('0x28')]['rawAttributes'],function(_0x4bfd10){return{'name':_0x4bfd10[_0x5975('0x29')],'type':_0x4bfd10[_0x5975('0x2a')][_0x5975('0x2b')]};});_0x37db84[_0x5975('0x2c')]=_[_0x5975('0x2d')](_0x2920b0,'name');_0x37db84[_0x5975('0x2e')]=_[_0x5975('0x2f')](_0x24ee17['query']);_0x37db84['filters']=_['intersection'](_0x37db84[_0x5975('0x2c')],_0x37db84[_0x5975('0x2e')]);_0x52c4d8[_0x5975('0x30')]=_[_0x5975('0x31')](_0x37db84[_0x5975('0x2c')],qs[_0x5975('0x32')](_0x24ee17[_0x5975('0x2e')][_0x5975('0x32')]));_0x52c4d8[_0x5975('0x30')]=_0x52c4d8[_0x5975('0x30')][_0x5975('0x33')]?_0x52c4d8[_0x5975('0x30')]:_0x37db84[_0x5975('0x2c')];if(!_0x24ee17[_0x5975('0x2e')][_0x5975('0x34')](_0x5975('0x35'))){_0x52c4d8[_0x5975('0x1a')]=qs[_0x5975('0x1a')](_0x24ee17[_0x5975('0x2e')][_0x5975('0x1a')]);_0x52c4d8['offset']=qs[_0x5975('0x18')](_0x24ee17[_0x5975('0x2e')]['offset']);}_0x52c4d8[_0x5975('0x36')]=qs[_0x5975('0x37')](_0x24ee17[_0x5975('0x2e')]['sort']);_0x52c4d8[_0x5975('0x38')]=qs[_0x5975('0x39')](_[_0x5975('0x3a')](_0x24ee17['query'],_0x37db84[_0x5975('0x39')]),_0x2920b0);if(_0x24ee17[_0x5975('0x2e')][_0x5975('0x3b')]){_0x52c4d8['where']=_['merge'](_0x52c4d8[_0x5975('0x38')],{'$or':_[_0x5975('0x2d')](_0x2920b0,function(_0x4dca2f){if(_0x4dca2f['type']!=='VIRTUAL'){var _0x3d9ff6={};_0x3d9ff6[_0x4dca2f[_0x5975('0x25')]]={'$like':'%'+_0x24ee17[_0x5975('0x2e')][_0x5975('0x3b')]+'%'};return _0x3d9ff6;}})});}_0x52c4d8=_[_0x5975('0x3c')]({},_0x52c4d8,_0x24ee17['options']);var _0x464473={'where':_0x52c4d8[_0x5975('0x38')]};return db[_0x5975('0x28')][_0x5975('0x1b')](_0x464473)[_0x5975('0x3d')](function(_0x559ade){_0xd65354['count']=_0x559ade;if(_0x24ee17['query'][_0x5975('0x3e')]){_0x52c4d8[_0x5975('0x3f')]=[{'all':!![]}];}return db[_0x5975('0x28')]['findAll'](_0x52c4d8);})[_0x5975('0x3d')](function(_0x1cff9f){_0xd65354[_0x5975('0x40')]=_0x1cff9f;return _0xd65354;})['then'](respondWithFilteredResult(_0x406e65,_0x52c4d8))[_0x5975('0x41')](handleError(_0x406e65,null));};exports[_0x5975('0x42')]=function(_0x1251ab,_0x17b2c6){var _0x5ed816={'raw':!![],'where':{'id':_0x1251ab[_0x5975('0x43')]['id']}},_0x3cfb3a={};_0x3cfb3a[_0x5975('0x2c')]=_[_0x5975('0x2f')](db[_0x5975('0x28')][_0x5975('0x44')]);_0x3cfb3a[_0x5975('0x2e')]=_['keys'](_0x1251ab[_0x5975('0x2e')]);_0x3cfb3a[_0x5975('0x39')]=_['intersection'](_0x3cfb3a['model'],_0x3cfb3a[_0x5975('0x2e')]);_0x5ed816[_0x5975('0x30')]=_[_0x5975('0x31')](_0x3cfb3a['model'],qs[_0x5975('0x32')](_0x1251ab['query'][_0x5975('0x32')]));_0x5ed816[_0x5975('0x30')]=_0x5ed816[_0x5975('0x30')][_0x5975('0x33')]?_0x5ed816[_0x5975('0x30')]:_0x3cfb3a[_0x5975('0x2c')];if(_0x1251ab[_0x5975('0x2e')][_0x5975('0x3e')]){_0x5ed816[_0x5975('0x3f')]=[{'all':!![]}];}_0x5ed816=_[_0x5975('0x3c')]({},_0x5ed816,_0x1251ab[_0x5975('0x45')]);return db[_0x5975('0x28')][_0x5975('0x46')](_0x5ed816)['then'](handleEntityNotFound(_0x17b2c6,null))[_0x5975('0x3d')](respondWithResult(_0x17b2c6,null))[_0x5975('0x41')](handleError(_0x17b2c6,null));};exports[_0x5975('0x47')]=function(_0x664cd8,_0x350077){return db['FaxQueueReport'][_0x5975('0x47')](_0x664cd8[_0x5975('0x48')],{})['then'](respondWithResult(_0x350077,0xc9))[_0x5975('0x41')](handleError(_0x350077,null));};exports[_0x5975('0x21')]=function(_0x5045b1,_0x4214e8){if(_0x5045b1['body']['id']){delete _0x5045b1[_0x5975('0x48')]['id'];}return db[_0x5975('0x28')][_0x5975('0x46')]({'where':{'id':_0x5045b1[_0x5975('0x43')]['id']}})['then'](handleEntityNotFound(_0x4214e8,null))[_0x5975('0x3d')](saveUpdates(_0x5045b1['body'],null))[_0x5975('0x3d')](respondWithResult(_0x4214e8,null))['catch'](handleError(_0x4214e8,null));};exports[_0x5975('0x22')]=function(_0x135060,_0x4b1c7a){return db[_0x5975('0x28')][_0x5975('0x46')]({'where':{'id':_0x135060[_0x5975('0x43')]['id']}})[_0x5975('0x3d')](handleEntityNotFound(_0x4b1c7a,null))[_0x5975('0x3d')](removeEntity(_0x4b1c7a,null))['catch'](handleError(_0x4b1c7a,null));};exports[_0x5975('0x49')]=function(_0x4c095d,_0x334402){return db['FaxQueueReport'][_0x5975('0x49')]()['then'](respondWithResult(_0x334402,null))[_0x5975('0x41')](handleError(_0x334402,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 5180f9c..5487e73 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x3e8270,_0x293590){var _0x1ccde9=function(_0x213490){while(--_0x213490){_0x3e8270['push'](_0x3e8270['shift']());}};_0x1ccde9(++_0x293590);}(_0x814b,0x1a2));var _0xb814=function(_0x282f9a,_0x63dff){_0x282f9a=_0x282f9a-0x0;var _0x52528c=_0x814b[_0x282f9a];return _0x52528c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','api'];(function(_0x5f0f78,_0x12b8e6){var _0x14a3bc=function(_0x1018a7){while(--_0x1018a7){_0x5f0f78['push'](_0x5f0f78['shift']());}};_0x14a3bc(++_0x12b8e6);}(_0x5fab,0x177));var _0xb5fa=function(_0x2f7d18,_0x44bea6){_0x2f7d18=_0x2f7d18-0x0;var _0x425175=_0x5fab[_0x2f7d18];return _0x425175;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[{'name':_0xb5fa('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 9caadfe..b570608 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 _0xceea=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','UpdateFaxQueueReport','update','raw','where','attributes','limit','then'];(function(_0x361038,_0x33c0b9){var _0x520321=function(_0x7d5e7a){while(--_0x7d5e7a){_0x361038['push'](_0x361038['shift']());}};_0x520321(++_0x33c0b9);}(_0xceea,0x1ea));var _0xacee=function(_0x4ae076,_0x1cbacc){_0x4ae076=_0x4ae076-0x0;var _0x11f7d3=_0xceea[_0x4ae076];return _0x11f7d3;};'use strict';var _=require(_0xacee('0x0'));var util=require(_0xacee('0x1'));var moment=require(_0xacee('0x2'));var BPromise=require(_0xacee('0x3'));var rs=require(_0xacee('0x4'));var fs=require('fs');var Redis=require(_0xacee('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xacee('0x6'));var logger=require(_0xacee('0x7'))(_0xacee('0x8'));var config=require(_0xacee('0x9'));var jayson=require(_0xacee('0xa'));var client=jayson[_0xacee('0xb')][_0xacee('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x598820,_0x3b82e3,_0x186d12){return new BPromise(function(_0x17364a,_0x7ba005){return client['request'](_0x598820,_0x186d12)['then'](function(_0x3a3fce){logger[_0xacee('0xd')](_0xacee('0xe'),_0x3b82e3,_0xacee('0xf'));logger[_0xacee('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x3b82e3,_0xacee('0xf'),JSON[_0xacee('0x11')](_0x3a3fce));if(_0x3a3fce['error']){if(_0x3a3fce['error'][_0xacee('0x12')]===0x1f4){logger[_0xacee('0x13')](_0xacee('0xe'),_0x3b82e3,_0x3a3fce[_0xacee('0x13')]['message']);return _0x7ba005(_0x3a3fce[_0xacee('0x13')][_0xacee('0x14')]);}logger[_0xacee('0x13')](_0xacee('0xe'),_0x3b82e3,_0x3a3fce[_0xacee('0x13')][_0xacee('0x14')]);return _0x17364a(_0x3a3fce[_0xacee('0x13')]['message']);}else{logger[_0xacee('0xd')](_0xacee('0xe'),_0x3b82e3,_0xacee('0xf'));_0x17364a(_0x3a3fce[_0xacee('0x15')][_0xacee('0x14')]);}})[_0xacee('0x16')](function(_0x2e79b6){logger[_0xacee('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x3b82e3,_0x2e79b6);_0x7ba005(_0x2e79b6);});});}exports[_0xacee('0x17')]=function(_0x579098){var _0x3bd976=this;return new Promise(function(_0x39376a,_0x28abb5){return db[_0xacee('0x18')][_0xacee('0x19')](_0x579098[_0xacee('0x1a')],{'raw':_0x579098['options']?_0x579098[_0xacee('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1ea46e){logger[_0xacee('0xd')](_0xacee('0x17'),_0x579098);logger[_0xacee('0x10')](_0xacee('0x17'),_0x579098,JSON[_0xacee('0x11')](_0x1ea46e));_0x39376a(_0x1ea46e);})[_0xacee('0x16')](function(_0x40e61d){logger[_0xacee('0x13')](_0xacee('0x17'),_0x40e61d['message'],_0x579098);_0x28abb5(_0x3bd976[_0xacee('0x13')](0x1f4,_0x40e61d[_0xacee('0x14')]));});});};exports[_0xacee('0x1c')]=function(_0x5272e6){var _0x585384=this;return new Promise(function(_0xea1306,_0x29e70d){return db['FaxQueueReport'][_0xacee('0x1d')](_0x5272e6[_0xacee('0x1a')],{'raw':_0x5272e6['options']?_0x5272e6[_0xacee('0x1b')][_0xacee('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5272e6[_0xacee('0x1b')]?_0x5272e6[_0xacee('0x1b')][_0xacee('0x1f')]||null:null,'attributes':_0x5272e6[_0xacee('0x1b')]?_0x5272e6['options'][_0xacee('0x20')]||null:null,'limit':_0x5272e6['options']?_0x5272e6['options'][_0xacee('0x21')]||null:null})[_0xacee('0x22')](function(_0x3af3ab){logger[_0xacee('0xd')](_0xacee('0x1c'),_0x5272e6);logger['debug']('UpdateFaxQueueReport',_0x5272e6,JSON[_0xacee('0x11')](_0x3af3ab));_0xea1306(_0x3af3ab);})[_0xacee('0x16')](function(_0xdd1f31){logger[_0xacee('0x13')]('UpdateFaxQueueReport',_0xdd1f31[_0xacee('0x14')],_0x5272e6);_0x29e70d(_0x585384[_0xacee('0x13')](0x1f4,_0xdd1f31['message']));});});}; \ No newline at end of file +var _0x318a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','update','lodash','moment'];(function(_0x1f8e66,_0x2a3d83){var _0x59f195=function(_0x594f54){while(--_0x594f54){_0x1f8e66['push'](_0x1f8e66['shift']());}};_0x59f195(++_0x2a3d83);}(_0x318a,0x1de));var _0xa318=function(_0x15568f,_0x1f4581){_0x15568f=_0x15568f-0x0;var _0x1b8e3a=_0x318a[_0x15568f];return _0x1b8e3a;};'use strict';var _=require(_0xa318('0x0'));var util=require('util');var moment=require(_0xa318('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa318('0x2'));var db=require(_0xa318('0x3'))['db'];var utils=require(_0xa318('0x4'));var logger=require(_0xa318('0x5'))(_0xa318('0x6'));var config=require(_0xa318('0x7'));var jayson=require(_0xa318('0x8'));var client=jayson['client'][_0xa318('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x445a6a,_0x1b4e62,_0x4c8961){return new BPromise(function(_0x53aab8,_0x6a81e3){return client[_0xa318('0xa')](_0x445a6a,_0x4c8961)['then'](function(_0x563dbb){logger['info'](_0xa318('0xb'),_0x1b4e62,_0xa318('0xc'));logger[_0xa318('0xd')](_0xa318('0xe'),_0x1b4e62,_0xa318('0xc'),JSON[_0xa318('0xf')](_0x563dbb));if(_0x563dbb[_0xa318('0x10')]){if(_0x563dbb[_0xa318('0x10')]['code']===0x1f4){logger[_0xa318('0x10')](_0xa318('0xb'),_0x1b4e62,_0x563dbb[_0xa318('0x10')][_0xa318('0x11')]);return _0x6a81e3(_0x563dbb['error']['message']);}logger[_0xa318('0x10')](_0xa318('0xb'),_0x1b4e62,_0x563dbb[_0xa318('0x10')]['message']);return _0x53aab8(_0x563dbb['error'][_0xa318('0x11')]);}else{logger[_0xa318('0x12')](_0xa318('0xb'),_0x1b4e62,_0xa318('0xc'));_0x53aab8(_0x563dbb[_0xa318('0x13')][_0xa318('0x11')]);}})[_0xa318('0x14')](function(_0x4d78dc){logger[_0xa318('0x10')](_0xa318('0xb'),_0x1b4e62,_0x4d78dc);_0x6a81e3(_0x4d78dc);});});}exports[_0xa318('0x15')]=function(_0x517e2c){var _0x184f37=this;return new Promise(function(_0x21c350,_0x359656){return db[_0xa318('0x16')][_0xa318('0x17')](_0x517e2c[_0xa318('0x18')],{'raw':_0x517e2c[_0xa318('0x19')]?_0x517e2c[_0xa318('0x19')][_0xa318('0x1a')]===undefined?!![]:![]:!![]})[_0xa318('0x1b')](function(_0x708d15){logger[_0xa318('0x12')](_0xa318('0x15'),_0x517e2c);logger[_0xa318('0xd')]('CreateFaxQueueReport',_0x517e2c,JSON[_0xa318('0xf')](_0x708d15));_0x21c350(_0x708d15);})[_0xa318('0x14')](function(_0x3f64a7){logger['error'](_0xa318('0x15'),_0x3f64a7[_0xa318('0x11')],_0x517e2c);_0x359656(_0x184f37['error'](0x1f4,_0x3f64a7[_0xa318('0x11')]));});});};exports[_0xa318('0x1c')]=function(_0x30cb6f){var _0xe25c65=this;return new Promise(function(_0x6854bb,_0x43ebfa){return db[_0xa318('0x16')][_0xa318('0x1d')](_0x30cb6f[_0xa318('0x18')],{'raw':_0x30cb6f[_0xa318('0x19')]?_0x30cb6f['options'][_0xa318('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30cb6f[_0xa318('0x19')]?_0x30cb6f['options']['where']||null:null,'attributes':_0x30cb6f[_0xa318('0x19')]?_0x30cb6f[_0xa318('0x19')]['attributes']||null:null,'limit':_0x30cb6f[_0xa318('0x19')]?_0x30cb6f['options']['limit']||null:null})[_0xa318('0x1b')](function(_0xc95637){logger[_0xa318('0x12')](_0xa318('0x1c'),_0x30cb6f);logger['debug'](_0xa318('0x1c'),_0x30cb6f,JSON[_0xa318('0xf')](_0xc95637));_0x6854bb(_0xc95637);})['catch'](function(_0x4bde3f){logger[_0xa318('0x10')](_0xa318('0x1c'),_0x4bde3f[_0xa318('0x11')],_0x30cb6f);_0x43ebfa(_0xe25c65[_0xa318('0x10')](0x1f4,_0x4bde3f['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 43e2e7d..41d215f 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 _0xe649=['./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x300c38,_0x13e569){var _0x3f9468=function(_0x41dc71){while(--_0x41dc71){_0x300c38['push'](_0x300c38['shift']());}};_0x3f9468(++_0x13e569);}(_0xe649,0x1e7));var _0x9e64=function(_0x3cd1a4,_0x3b6bde){_0x3cd1a4=_0x3cd1a4-0x0;var _0x39532b=_0xe649[_0x3cd1a4];return _0x39532b;};'use strict';var multer=require(_0x9e64('0x0'));var util=require(_0x9e64('0x1'));var path=require(_0x9e64('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e64('0x3'));var router=express[_0x9e64('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9e64('0x5'));var interaction=require(_0x9e64('0x6'));var config=require('../../config/environment');var controller=require(_0x9e64('0x7'));router[_0x9e64('0x8')]('/',auth[_0x9e64('0x9')](),controller[_0x9e64('0xa')]);router[_0x9e64('0x8')](_0x9e64('0xb'),auth[_0x9e64('0x9')](),controller[_0x9e64('0xc')]);router[_0x9e64('0x8')](_0x9e64('0xd'),auth[_0x9e64('0x9')](),controller[_0x9e64('0xe')]);router['post']('/',auth[_0x9e64('0x9')](),controller[_0x9e64('0xf')]);router[_0x9e64('0x10')](_0x9e64('0xd'),auth[_0x9e64('0x9')](),controller[_0x9e64('0x11')]);router[_0x9e64('0x12')](_0x9e64('0xd'),auth[_0x9e64('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x23d4=['index','isAuthenticated','describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get'];(function(_0x43b88c,_0x46fb04){var _0x407299=function(_0x16dcd3){while(--_0x16dcd3){_0x43b88c['push'](_0x43b88c['shift']());}};_0x407299(++_0x46fb04);}(_0x23d4,0x1d9));var _0x423d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x23d4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x423d('0x0'));var path=require(_0x423d('0x1'));var timeout=require(_0x423d('0x2'));var express=require(_0x423d('0x3'));var router=express[_0x423d('0x4')]();var fs_extra=require(_0x423d('0x5'));var auth=require(_0x423d('0x6'));var interaction=require(_0x423d('0x7'));var config=require(_0x423d('0x8'));var controller=require(_0x423d('0x9'));router[_0x423d('0xa')]('/',auth['isAuthenticated'](),controller[_0x423d('0xb')]);router[_0x423d('0xa')]('/describe',auth[_0x423d('0xc')](),controller[_0x423d('0xd')]);router['get'](_0x423d('0xe'),auth['isAuthenticated'](),controller[_0x423d('0xf')]);router[_0x423d('0x10')]('/',auth['isAuthenticated'](),controller[_0x423d('0x11')]);router[_0x423d('0x12')]('/:id',auth[_0x423d('0xc')](),controller[_0x423d('0x13')]);router[_0x423d('0x14')](_0x423d('0xe'),auth[_0x423d('0xc')](),controller['destroy']);module[_0x423d('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 3e92833..37882a5 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0xba8282,_0x3a2e21){var _0x5cc178=function(_0x344847){while(--_0x344847){_0xba8282['push'](_0xba8282['shift']());}};_0x5cc178(++_0x3a2e21);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0xcb91[_0x416cdc];return _0x1931ce;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3a36dc,_0x3a06b0){var _0x5bff8e=function(_0x39734b){while(--_0x39734b){_0x3a36dc['push'](_0x3a36dc['shift']());}};_0x5bff8e(++_0x3a06b0);}(_0xaa88,0x137));var _0x8aa8=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xaa88[_0x55abd9];return _0x3e5669;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 2f89e19..9de24a2 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 _0x7322=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','FaxTransferReport','includeAll','include','rows','catch','show','params','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x1992cd,_0x57d364){var _0x33c636=function(_0xe94f6e){while(--_0xe94f6e){_0x1992cd['push'](_0x1992cd['shift']());}};_0x33c636(++_0x57d364);}(_0x7322,0x11a));var _0x2732=function(_0x17a754,_0x5f1052){_0x17a754=_0x17a754-0x0;var _0x545d3e=_0x7322[_0x17a754];return _0x545d3e;};'use strict';var emlformat=require(_0x2732('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2732('0x1'));var jsonpatch=require(_0x2732('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2732('0x3'));var util=require(_0x2732('0x4'));var path=require(_0x2732('0x5'));var sox=require('sox');var csv=require(_0x2732('0x6'));var ejs=require(_0x2732('0x7'));var fs=require('fs');var fs_extra=require(_0x2732('0x8'));var _=require(_0x2732('0x9'));var squel=require(_0x2732('0xa'));var crypto=require(_0x2732('0xb'));var jsforce=require(_0x2732('0xc'));var deskjs=require(_0x2732('0xd'));var toCsv=require(_0x2732('0x6'));var querystring=require(_0x2732('0xe'));var Papa=require(_0x2732('0xf'));var Redis=require(_0x2732('0x10'));var authService=require(_0x2732('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2732('0x12'));var logger=require('../../config/logger')(_0x2732('0x13'));var utils=require(_0x2732('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2732('0x15'));var db=require(_0x2732('0x16'))['db'];function respondWithStatusCode(_0x5dec25,_0x2b1ac1){_0x2b1ac1=_0x2b1ac1||0xcc;return function(_0x27873c){if(_0x27873c){return _0x5dec25[_0x2732('0x17')](_0x2b1ac1);}return _0x5dec25['status'](_0x2b1ac1)[_0x2732('0x18')]();};}function respondWithResult(_0x361b09,_0x4b70bb){_0x4b70bb=_0x4b70bb||0xc8;return function(_0xa4a98e){if(_0xa4a98e){return _0x361b09[_0x2732('0x19')](_0x4b70bb)[_0x2732('0x1a')](_0xa4a98e);}};}function respondWithFilteredResult(_0x5991a7,_0x5a435b){return function(_0x452b3d){if(_0x452b3d){var _0x1b0299=typeof _0x5a435b[_0x2732('0x1b')]===_0x2732('0x1c')&&typeof _0x5a435b[_0x2732('0x1d')]===_0x2732('0x1c');var _0x31c738=_0x452b3d[_0x2732('0x1e')];var _0x4f76c9=_0x1b0299?0x0:_0x5a435b[_0x2732('0x1b')];var _0x222508=_0x1b0299?_0x452b3d['count']:_0x5a435b[_0x2732('0x1b')]+_0x5a435b['limit'];var _0x368d2b;if(_0x222508>=_0x31c738){_0x222508=_0x31c738;_0x368d2b=0xc8;}else{_0x368d2b=0xce;}_0x5991a7[_0x2732('0x19')](_0x368d2b);return _0x5991a7[_0x2732('0x1f')](_0x2732('0x20'),_0x4f76c9+'-'+_0x222508+'/'+_0x31c738)['json'](_0x452b3d);}return null;};}function patchUpdates(_0x4383f4){return function(_0xf86cfe){try{jsonpatch[_0x2732('0x21')](_0xf86cfe,_0x4383f4,!![]);}catch(_0x2ade74){return BPromise[_0x2732('0x22')](_0x2ade74);}return _0xf86cfe[_0x2732('0x23')]();};}function saveUpdates(_0x1b4e95,_0x13d61d){return function(_0x297172){if(_0x297172){return _0x297172[_0x2732('0x24')](_0x1b4e95)['then'](function(_0x54f2be){return _0x54f2be;});}return null;};}function removeEntity(_0x3e915e,_0x16def5){return function(_0x2e4c00){if(_0x2e4c00){return _0x2e4c00[_0x2732('0x25')]()[_0x2732('0x26')](function(){_0x3e915e[_0x2732('0x19')](0xcc)[_0x2732('0x18')]();});}};}function handleEntityNotFound(_0x5d4122,_0x2066c2){return function(_0x9a3bc0){if(!_0x9a3bc0){_0x5d4122[_0x2732('0x17')](0x194);}return _0x9a3bc0;};}function handleError(_0x18efb2,_0x5b76a7){_0x5b76a7=_0x5b76a7||0x1f4;return function(_0x50b115){logger[_0x2732('0x27')](_0x50b115[_0x2732('0x28')]);if(_0x50b115[_0x2732('0x29')]){delete _0x50b115[_0x2732('0x29')];}_0x18efb2['status'](_0x5b76a7)['send'](_0x50b115);};}exports['index']=function(_0x4ec9a3,_0x17ce9a){var _0x51e8b7={},_0x4e4f8a={},_0x4da045={'count':0x0,'rows':[]};var _0x25ffb2=_[_0x2732('0x2a')](db['FaxTransferReport'][_0x2732('0x2b')],function(_0x4e4e79){return{'name':_0x4e4e79[_0x2732('0x2c')],'type':_0x4e4e79[_0x2732('0x2d')]['key']};});_0x4e4f8a[_0x2732('0x2e')]=_[_0x2732('0x2a')](_0x25ffb2,_0x2732('0x29'));_0x4e4f8a[_0x2732('0x2f')]=_[_0x2732('0x30')](_0x4ec9a3[_0x2732('0x2f')]);_0x4e4f8a['filters']=_[_0x2732('0x31')](_0x4e4f8a[_0x2732('0x2e')],_0x4e4f8a[_0x2732('0x2f')]);_0x51e8b7[_0x2732('0x32')]=_['intersection'](_0x4e4f8a[_0x2732('0x2e')],qs[_0x2732('0x33')](_0x4ec9a3[_0x2732('0x2f')][_0x2732('0x33')]));_0x51e8b7[_0x2732('0x32')]=_0x51e8b7['attributes'][_0x2732('0x34')]?_0x51e8b7[_0x2732('0x32')]:_0x4e4f8a[_0x2732('0x2e')];if(!_0x4ec9a3[_0x2732('0x2f')]['hasOwnProperty'](_0x2732('0x35'))){_0x51e8b7[_0x2732('0x1d')]=qs['limit'](_0x4ec9a3[_0x2732('0x2f')]['limit']);_0x51e8b7[_0x2732('0x1b')]=qs[_0x2732('0x1b')](_0x4ec9a3[_0x2732('0x2f')]['offset']);}_0x51e8b7[_0x2732('0x36')]=qs[_0x2732('0x37')](_0x4ec9a3['query'][_0x2732('0x37')]);_0x51e8b7[_0x2732('0x38')]=qs['filters'](_[_0x2732('0x39')](_0x4ec9a3['query'],_0x4e4f8a[_0x2732('0x3a')]),_0x25ffb2);if(_0x4ec9a3['query'][_0x2732('0x3b')]){_0x51e8b7[_0x2732('0x38')]=_[_0x2732('0x3c')](_0x51e8b7[_0x2732('0x38')],{'$or':_[_0x2732('0x2a')](_0x25ffb2,function(_0x25b96e){if(_0x25b96e[_0x2732('0x2d')]!==_0x2732('0x3d')){var _0x4f00cd={};_0x4f00cd[_0x25b96e['name']]={'$like':'%'+_0x4ec9a3[_0x2732('0x2f')][_0x2732('0x3b')]+'%'};return _0x4f00cd;}})});}_0x51e8b7=_['merge']({},_0x51e8b7,_0x4ec9a3['options']);var _0x400163={'where':_0x51e8b7[_0x2732('0x38')]};return db[_0x2732('0x3e')][_0x2732('0x1e')](_0x400163)['then'](function(_0x4c94db){_0x4da045[_0x2732('0x1e')]=_0x4c94db;if(_0x4ec9a3[_0x2732('0x2f')][_0x2732('0x3f')]){_0x51e8b7[_0x2732('0x40')]=[{'all':!![]}];}return db['FaxTransferReport']['findAll'](_0x51e8b7);})[_0x2732('0x26')](function(_0x33a163){_0x4da045[_0x2732('0x41')]=_0x33a163;return _0x4da045;})[_0x2732('0x26')](respondWithFilteredResult(_0x17ce9a,_0x51e8b7))[_0x2732('0x42')](handleError(_0x17ce9a,null));};exports[_0x2732('0x43')]=function(_0x3635cb,_0x595640){var _0x189443={'raw':!![],'where':{'id':_0x3635cb[_0x2732('0x44')]['id']}},_0x268751={};_0x268751[_0x2732('0x2e')]=_['keys'](db[_0x2732('0x3e')][_0x2732('0x2b')]);_0x268751[_0x2732('0x2f')]=_[_0x2732('0x30')](_0x3635cb[_0x2732('0x2f')]);_0x268751['filters']=_[_0x2732('0x31')](_0x268751['model'],_0x268751[_0x2732('0x2f')]);_0x189443[_0x2732('0x32')]=_[_0x2732('0x31')](_0x268751[_0x2732('0x2e')],qs[_0x2732('0x33')](_0x3635cb['query'][_0x2732('0x33')]));_0x189443['attributes']=_0x189443[_0x2732('0x32')][_0x2732('0x34')]?_0x189443[_0x2732('0x32')]:_0x268751[_0x2732('0x2e')];if(_0x3635cb[_0x2732('0x2f')]['includeAll']){_0x189443['include']=[{'all':!![]}];}_0x189443=_['merge']({},_0x189443,_0x3635cb[_0x2732('0x45')]);return db[_0x2732('0x3e')]['find'](_0x189443)['then'](handleEntityNotFound(_0x595640,null))[_0x2732('0x26')](respondWithResult(_0x595640,null))[_0x2732('0x42')](handleError(_0x595640,null));};exports['create']=function(_0x4bda5b,_0x3a2fd5){return db[_0x2732('0x3e')][_0x2732('0x46')](_0x4bda5b[_0x2732('0x47')],{})[_0x2732('0x26')](respondWithResult(_0x3a2fd5,0xc9))[_0x2732('0x42')](handleError(_0x3a2fd5,null));};exports[_0x2732('0x24')]=function(_0x553c92,_0x2ffe47){if(_0x553c92[_0x2732('0x47')]['id']){delete _0x553c92[_0x2732('0x47')]['id'];}return db[_0x2732('0x3e')][_0x2732('0x48')]({'where':{'id':_0x553c92[_0x2732('0x44')]['id']}})[_0x2732('0x26')](handleEntityNotFound(_0x2ffe47,null))['then'](saveUpdates(_0x553c92['body'],null))[_0x2732('0x26')](respondWithResult(_0x2ffe47,null))[_0x2732('0x42')](handleError(_0x2ffe47,null));};exports['destroy']=function(_0x18c81d,_0x15e4c8){return db[_0x2732('0x3e')][_0x2732('0x48')]({'where':{'id':_0x18c81d['params']['id']}})[_0x2732('0x26')](handleEntityNotFound(_0x15e4c8,null))[_0x2732('0x26')](removeEntity(_0x15e4c8,null))['catch'](handleError(_0x15e4c8,null));};exports['describe']=function(_0x318338,_0x314e3b){return db['FaxTransferReport'][_0x2732('0x49')]()[_0x2732('0x26')](respondWithResult(_0x314e3b,null))[_0x2732('0x42')](handleError(_0x314e3b,null));}; \ No newline at end of file +var _0xd065=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','sendStatus','error','stack','index','map','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','name','options','FaxTransferReport','includeAll','include','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x2fc8cb,_0x556d1d){var _0x2362c5=function(_0x27e69a){while(--_0x27e69a){_0x2fc8cb['push'](_0x2fc8cb['shift']());}};_0x2362c5(++_0x556d1d);}(_0xd065,0x158));var _0x5d06=function(_0x1819da,_0x369fe0){_0x1819da=_0x1819da-0x0;var _0x4394a8=_0xd065[_0x1819da];return _0x4394a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d06('0x0'));var zipdir=require(_0x5d06('0x1'));var jsonpatch=require(_0x5d06('0x2'));var rp=require(_0x5d06('0x3'));var moment=require('moment');var BPromise=require(_0x5d06('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x5d06('0x5'));var csv=require('to-csv');var ejs=require(_0x5d06('0x6'));var fs=require('fs');var fs_extra=require(_0x5d06('0x7'));var _=require(_0x5d06('0x8'));var squel=require(_0x5d06('0x9'));var crypto=require(_0x5d06('0xa'));var jsforce=require(_0x5d06('0xb'));var deskjs=require(_0x5d06('0xc'));var toCsv=require(_0x5d06('0xd'));var querystring=require(_0x5d06('0xe'));var Papa=require(_0x5d06('0xf'));var Redis=require(_0x5d06('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5d06('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d06('0x12'));var logger=require(_0x5d06('0x13'))(_0x5d06('0x14'));var utils=require('../../config/utils');var config=require(_0x5d06('0x15'));var licenseUtil=require(_0x5d06('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3bc152,_0xecad66){_0xecad66=_0xecad66||0xcc;return function(_0x329ee6){if(_0x329ee6){return _0x3bc152['sendStatus'](_0xecad66);}return _0x3bc152[_0x5d06('0x17')](_0xecad66)[_0x5d06('0x18')]();};}function respondWithResult(_0x420be2,_0x1851a9){_0x1851a9=_0x1851a9||0xc8;return function(_0x5cc9be){if(_0x5cc9be){return _0x420be2[_0x5d06('0x17')](_0x1851a9)[_0x5d06('0x19')](_0x5cc9be);}};}function respondWithFilteredResult(_0x6cc909,_0x420bd9){return function(_0x77fc62){if(_0x77fc62){var _0xa12242=typeof _0x420bd9[_0x5d06('0x1a')]===_0x5d06('0x1b')&&typeof _0x420bd9['limit']===_0x5d06('0x1b');var _0x1a1bb0=_0x77fc62['count'];var _0x2c1551=_0xa12242?0x0:_0x420bd9['offset'];var _0x5ee977=_0xa12242?_0x77fc62[_0x5d06('0x1c')]:_0x420bd9[_0x5d06('0x1a')]+_0x420bd9[_0x5d06('0x1d')];var _0xc321dd;if(_0x5ee977>=_0x1a1bb0){_0x5ee977=_0x1a1bb0;_0xc321dd=0xc8;}else{_0xc321dd=0xce;}_0x6cc909[_0x5d06('0x17')](_0xc321dd);return _0x6cc909['set'](_0x5d06('0x1e'),_0x2c1551+'-'+_0x5ee977+'/'+_0x1a1bb0)['json'](_0x77fc62);}return null;};}function patchUpdates(_0x1bdbe2){return function(_0x41b064){try{jsonpatch[_0x5d06('0x1f')](_0x41b064,_0x1bdbe2,!![]);}catch(_0x4c5abb){return BPromise['reject'](_0x4c5abb);}return _0x41b064['save']();};}function saveUpdates(_0x811fdc,_0x41094e){return function(_0x21f5cf){if(_0x21f5cf){return _0x21f5cf[_0x5d06('0x20')](_0x811fdc)[_0x5d06('0x21')](function(_0x58abc6){return _0x58abc6;});}return null;};}function removeEntity(_0x4f1c8f,_0x4f4d4f){return function(_0x3272bc){if(_0x3272bc){return _0x3272bc[_0x5d06('0x22')]()[_0x5d06('0x21')](function(){_0x4f1c8f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36166b,_0x59b1b7){return function(_0x189a4e){if(!_0x189a4e){_0x36166b[_0x5d06('0x23')](0x194);}return _0x189a4e;};}function handleError(_0x13a170,_0x5bbdb4){_0x5bbdb4=_0x5bbdb4||0x1f4;return function(_0x4e33b1){logger[_0x5d06('0x24')](_0x4e33b1[_0x5d06('0x25')]);if(_0x4e33b1['name']){delete _0x4e33b1['name'];}_0x13a170[_0x5d06('0x17')](_0x5bbdb4)['send'](_0x4e33b1);};}exports[_0x5d06('0x26')]=function(_0x7e27f6,_0x69578){var _0x294ef0={},_0x2ca49b={},_0x4f6e63={'count':0x0,'rows':[]};var _0x5267b8=_[_0x5d06('0x27')](db['FaxTransferReport'][_0x5d06('0x28')],function(_0x11a317){return{'name':_0x11a317[_0x5d06('0x29')],'type':_0x11a317['type']['key']};});_0x2ca49b[_0x5d06('0x2a')]=_[_0x5d06('0x27')](_0x5267b8,'name');_0x2ca49b[_0x5d06('0x2b')]=_[_0x5d06('0x2c')](_0x7e27f6[_0x5d06('0x2b')]);_0x2ca49b['filters']=_['intersection'](_0x2ca49b[_0x5d06('0x2a')],_0x2ca49b[_0x5d06('0x2b')]);_0x294ef0[_0x5d06('0x2d')]=_[_0x5d06('0x2e')](_0x2ca49b[_0x5d06('0x2a')],qs[_0x5d06('0x2f')](_0x7e27f6[_0x5d06('0x2b')]['fields']));_0x294ef0[_0x5d06('0x2d')]=_0x294ef0[_0x5d06('0x2d')][_0x5d06('0x30')]?_0x294ef0['attributes']:_0x2ca49b[_0x5d06('0x2a')];if(!_0x7e27f6[_0x5d06('0x2b')][_0x5d06('0x31')](_0x5d06('0x32'))){_0x294ef0['limit']=qs[_0x5d06('0x1d')](_0x7e27f6['query'][_0x5d06('0x1d')]);_0x294ef0[_0x5d06('0x1a')]=qs['offset'](_0x7e27f6['query'][_0x5d06('0x1a')]);}_0x294ef0[_0x5d06('0x33')]=qs[_0x5d06('0x34')](_0x7e27f6['query'][_0x5d06('0x34')]);_0x294ef0[_0x5d06('0x35')]=qs[_0x5d06('0x36')](_[_0x5d06('0x37')](_0x7e27f6['query'],_0x2ca49b[_0x5d06('0x36')]),_0x5267b8);if(_0x7e27f6[_0x5d06('0x2b')][_0x5d06('0x38')]){_0x294ef0['where']=_[_0x5d06('0x39')](_0x294ef0[_0x5d06('0x35')],{'$or':_[_0x5d06('0x27')](_0x5267b8,function(_0x4266d){if(_0x4266d[_0x5d06('0x3a')]!==_0x5d06('0x3b')){var _0x551332={};_0x551332[_0x4266d[_0x5d06('0x3c')]]={'$like':'%'+_0x7e27f6[_0x5d06('0x2b')][_0x5d06('0x38')]+'%'};return _0x551332;}})});}_0x294ef0=_['merge']({},_0x294ef0,_0x7e27f6[_0x5d06('0x3d')]);var _0x1ce59a={'where':_0x294ef0[_0x5d06('0x35')]};return db[_0x5d06('0x3e')][_0x5d06('0x1c')](_0x1ce59a)[_0x5d06('0x21')](function(_0x76d191){_0x4f6e63[_0x5d06('0x1c')]=_0x76d191;if(_0x7e27f6[_0x5d06('0x2b')][_0x5d06('0x3f')]){_0x294ef0[_0x5d06('0x40')]=[{'all':!![]}];}return db[_0x5d06('0x3e')]['findAll'](_0x294ef0);})[_0x5d06('0x21')](function(_0x516386){_0x4f6e63[_0x5d06('0x41')]=_0x516386;return _0x4f6e63;})[_0x5d06('0x21')](respondWithFilteredResult(_0x69578,_0x294ef0))[_0x5d06('0x42')](handleError(_0x69578,null));};exports[_0x5d06('0x43')]=function(_0x5ec07b,_0x4f9bcc){var _0x56e3c0={'raw':!![],'where':{'id':_0x5ec07b[_0x5d06('0x44')]['id']}},_0x359044={};_0x359044['model']=_['keys'](db[_0x5d06('0x3e')][_0x5d06('0x28')]);_0x359044[_0x5d06('0x2b')]=_['keys'](_0x5ec07b['query']);_0x359044[_0x5d06('0x36')]=_[_0x5d06('0x2e')](_0x359044[_0x5d06('0x2a')],_0x359044['query']);_0x56e3c0['attributes']=_[_0x5d06('0x2e')](_0x359044[_0x5d06('0x2a')],qs['fields'](_0x5ec07b[_0x5d06('0x2b')][_0x5d06('0x2f')]));_0x56e3c0['attributes']=_0x56e3c0[_0x5d06('0x2d')]['length']?_0x56e3c0[_0x5d06('0x2d')]:_0x359044[_0x5d06('0x2a')];if(_0x5ec07b[_0x5d06('0x2b')][_0x5d06('0x3f')]){_0x56e3c0['include']=[{'all':!![]}];}_0x56e3c0=_['merge']({},_0x56e3c0,_0x5ec07b[_0x5d06('0x3d')]);return db[_0x5d06('0x3e')][_0x5d06('0x45')](_0x56e3c0)[_0x5d06('0x21')](handleEntityNotFound(_0x4f9bcc,null))[_0x5d06('0x21')](respondWithResult(_0x4f9bcc,null))[_0x5d06('0x42')](handleError(_0x4f9bcc,null));};exports[_0x5d06('0x46')]=function(_0x1d47b0,_0x400cdf){return db[_0x5d06('0x3e')][_0x5d06('0x46')](_0x1d47b0[_0x5d06('0x47')],{})[_0x5d06('0x21')](respondWithResult(_0x400cdf,0xc9))[_0x5d06('0x42')](handleError(_0x400cdf,null));};exports[_0x5d06('0x20')]=function(_0x27939c,_0x43d342){if(_0x27939c[_0x5d06('0x47')]['id']){delete _0x27939c[_0x5d06('0x47')]['id'];}return db[_0x5d06('0x3e')][_0x5d06('0x45')]({'where':{'id':_0x27939c[_0x5d06('0x44')]['id']}})[_0x5d06('0x21')](handleEntityNotFound(_0x43d342,null))[_0x5d06('0x21')](saveUpdates(_0x27939c[_0x5d06('0x47')],null))[_0x5d06('0x21')](respondWithResult(_0x43d342,null))[_0x5d06('0x42')](handleError(_0x43d342,null));};exports[_0x5d06('0x22')]=function(_0x4ac727,_0x360269){return db[_0x5d06('0x3e')][_0x5d06('0x45')]({'where':{'id':_0x4ac727[_0x5d06('0x44')]['id']}})[_0x5d06('0x21')](handleEntityNotFound(_0x360269,null))[_0x5d06('0x21')](removeEntity(_0x360269,null))[_0x5d06('0x42')](handleError(_0x360269,null));};exports['describe']=function(_0x5eac1f,_0x5684a1){return db[_0x5d06('0x3e')][_0x5d06('0x48')]()[_0x5d06('0x21')](respondWithResult(_0x5684a1,null))[_0x5d06('0x42')](handleError(_0x5684a1,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 9994987..0ddb9b6 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 _0x8ad0=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define'];(function(_0x160606,_0x21388a){var _0x57851b=function(_0x3adf17){while(--_0x3adf17){_0x160606['push'](_0x160606['shift']());}};_0x57851b(++_0x21388a);}(_0x8ad0,0xb7));var _0x08ad=function(_0x5f007c,_0x527cd3){_0x5f007c=_0x5f007c-0x0;var _0x1a69e3=_0x8ad0[_0x5f007c];return _0x1a69e3;};'use strict';var _=require(_0x08ad('0x0'));var util=require(_0x08ad('0x1'));var logger=require(_0x08ad('0x2'))(_0x08ad('0x3'));var moment=require(_0x08ad('0x4'));var BPromise=require(_0x08ad('0x5'));var rp=require(_0x08ad('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x08ad('0x7'));var config=require(_0x08ad('0x8'));var attributes=require(_0x08ad('0x9'));module[_0x08ad('0xa')]=function(_0xcff46,_0x420a32){return _0xcff46[_0x08ad('0xb')](_0x08ad('0xc'),attributes,{'tableName':_0x08ad('0xd'),'paranoid':![],'indexes':[{'name':_0x08ad('0xe'),'fields':[_0x08ad('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4af=['uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','report_fax_transfer'];(function(_0x2c80a8,_0x466a8a){var _0x397528=function(_0x38b344){while(--_0x38b344){_0x2c80a8['push'](_0x2c80a8['shift']());}};_0x397528(++_0x466a8a);}(_0xf4af,0x7a));var _0xff4a=function(_0x3690de,_0xaad404){_0x3690de=_0x3690de-0x0;var _0x9737de=_0xf4af[_0x3690de];return _0x9737de;};'use strict';var _=require('lodash');var util=require(_0xff4a('0x0'));var logger=require(_0xff4a('0x1'))(_0xff4a('0x2'));var moment=require(_0xff4a('0x3'));var BPromise=require('bluebird');var rp=require(_0xff4a('0x4'));var fs=require('fs');var path=require(_0xff4a('0x5'));var rimraf=require(_0xff4a('0x6'));var config=require(_0xff4a('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0xff4a('0x8')]=function(_0x2a9718,_0x83349f){return _0x2a9718['define']('FaxTransferReport',attributes,{'tableName':_0xff4a('0x9'),'paranoid':![],'indexes':[{'name':_0xff4a('0xa'),'fields':[_0xff4a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 90827f1..555d8e2 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 _0xc70a=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x2d3b98,_0x2138f6){var _0x457c95=function(_0xd29298){while(--_0xd29298){_0x2d3b98['push'](_0x2d3b98['shift']());}};_0x457c95(++_0x2138f6);}(_0xc70a,0x12d));var _0xac70=function(_0x5cff36,_0x15f92c){_0x5cff36=_0x5cff36-0x0;var _0x2a2b7c=_0xc70a[_0x5cff36];return _0x2a2b7c;};'use strict';var _=require(_0xac70('0x0'));var util=require('util');var moment=require(_0xac70('0x1'));var BPromise=require(_0xac70('0x2'));var rs=require(_0xac70('0x3'));var fs=require('fs');var Redis=require(_0xac70('0x4'));var db=require(_0xac70('0x5'))['db'];var utils=require(_0xac70('0x6'));var logger=require('../../config/logger')(_0xac70('0x7'));var config=require(_0xac70('0x8'));var jayson=require(_0xac70('0x9'));var client=jayson[_0xac70('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xaaab82,_0x136225,_0x339ae8){return new BPromise(function(_0x1512f0,_0xa41f35){return client[_0xac70('0xb')](_0xaaab82,_0x339ae8)[_0xac70('0xc')](function(_0x5272b3){logger[_0xac70('0xd')](_0xac70('0xe'),_0x136225,'request\x20sent');logger[_0xac70('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x136225,_0xac70('0x10'),JSON[_0xac70('0x11')](_0x5272b3));if(_0x5272b3['error']){if(_0x5272b3[_0xac70('0x12')][_0xac70('0x13')]===0x1f4){logger[_0xac70('0x12')](_0xac70('0xe'),_0x136225,_0x5272b3['error'][_0xac70('0x14')]);return _0xa41f35(_0x5272b3[_0xac70('0x12')][_0xac70('0x14')]);}logger[_0xac70('0x12')](_0xac70('0xe'),_0x136225,_0x5272b3[_0xac70('0x12')][_0xac70('0x14')]);return _0x1512f0(_0x5272b3[_0xac70('0x12')][_0xac70('0x14')]);}else{logger[_0xac70('0xd')]('FaxTransferReport,\x20%s,\x20%s',_0x136225,_0xac70('0x10'));_0x1512f0(_0x5272b3[_0xac70('0x15')][_0xac70('0x14')]);}})[_0xac70('0x16')](function(_0x419c6e){logger[_0xac70('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x136225,_0x419c6e);_0xa41f35(_0x419c6e);});});} \ No newline at end of file +var _0x0bdd=['message','result','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','FaxTransferReport,\x20%s,\x20%s'];(function(_0x4e2d6d,_0x15cff4){var _0x473db7=function(_0x2c6ca0){while(--_0x2c6ca0){_0x4e2d6d['push'](_0x4e2d6d['shift']());}};_0x473db7(++_0x15cff4);}(_0x0bdd,0x1ca));var _0xd0bd=function(_0x8ae747,_0x135483){_0x8ae747=_0x8ae747-0x0;var _0x16d68b=_0x0bdd[_0x8ae747];return _0x16d68b;};'use strict';var _=require('lodash');var util=require(_0xd0bd('0x0'));var moment=require(_0xd0bd('0x1'));var BPromise=require(_0xd0bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0bd('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd0bd('0x4'))(_0xd0bd('0x5'));var config=require('../../config/environment');var jayson=require(_0xd0bd('0x6'));var client=jayson[_0xd0bd('0x7')][_0xd0bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe35411,_0x21f80d,_0x1d45b5){return new BPromise(function(_0x1fc5f4,_0x3d692d){return client[_0xd0bd('0x9')](_0xe35411,_0x1d45b5)[_0xd0bd('0xa')](function(_0x137418){logger[_0xd0bd('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x21f80d,_0xd0bd('0xc'));logger[_0xd0bd('0xd')](_0xd0bd('0xe'),_0x21f80d,'request\x20sent',JSON['stringify'](_0x137418));if(_0x137418[_0xd0bd('0xf')]){if(_0x137418[_0xd0bd('0xf')]['code']===0x1f4){logger[_0xd0bd('0xf')](_0xd0bd('0x10'),_0x21f80d,_0x137418['error'][_0xd0bd('0x11')]);return _0x3d692d(_0x137418[_0xd0bd('0xf')]['message']);}logger[_0xd0bd('0xf')](_0xd0bd('0x10'),_0x21f80d,_0x137418[_0xd0bd('0xf')][_0xd0bd('0x11')]);return _0x1fc5f4(_0x137418[_0xd0bd('0xf')][_0xd0bd('0x11')]);}else{logger[_0xd0bd('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x21f80d,_0xd0bd('0xc'));_0x1fc5f4(_0x137418[_0xd0bd('0x12')][_0xd0bd('0x11')]);}})['catch'](function(_0x301b0d){logger[_0xd0bd('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x21f80d,_0x301b0d);_0x3d692d(_0x301b0d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 7fba8d4..ced5eab 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 _0x62f5=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','index','/describe','describe','get','/:id','isAuthenticated','show','post','create','put','update','exports','util'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x62f5,0xfb));var _0x562f=function(_0x18949c,_0xda6153){_0x18949c=_0x18949c-0x0;var _0x177a5d=_0x62f5[_0x18949c];return _0x177a5d;};'use strict';var multer=require('multer');var util=require(_0x562f('0x0'));var path=require(_0x562f('0x1'));var timeout=require(_0x562f('0x2'));var express=require('express');var router=express[_0x562f('0x3')]();var fs_extra=require(_0x562f('0x4'));var auth=require(_0x562f('0x5'));var interaction=require(_0x562f('0x6'));var config=require(_0x562f('0x7'));var controller=require(_0x562f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x562f('0x9')]);router['get'](_0x562f('0xa'),auth['isAuthenticated'](),controller[_0x562f('0xb')]);router[_0x562f('0xc')](_0x562f('0xd'),auth[_0x562f('0xe')](),controller[_0x562f('0xf')]);router[_0x562f('0x10')]('/',auth[_0x562f('0xe')](),controller[_0x562f('0x11')]);router[_0x562f('0x12')]('/:id',auth[_0x562f('0xe')](),controller[_0x562f('0x13')]);router['delete'](_0x562f('0xd'),auth[_0x562f('0xe')](),controller['destroy']);module[_0x562f('0x14')]=router; \ No newline at end of file +var _0xdd76=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','isAuthenticated','/:id','show','create','put','delete','destroy'];(function(_0x9ff1c0,_0x207afc){var _0x3e6c23=function(_0x11ad15){while(--_0x11ad15){_0x9ff1c0['push'](_0x9ff1c0['shift']());}};_0x3e6c23(++_0x207afc);}(_0xdd76,0x110));var _0x6dd7=function(_0x18f754,_0x393612){_0x18f754=_0x18f754-0x0;var _0xf675dd=_0xdd76[_0x18f754];return _0xf675dd;};'use strict';var multer=require('multer');var util=require(_0x6dd7('0x0'));var path=require(_0x6dd7('0x1'));var timeout=require(_0x6dd7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6dd7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6dd7('0x4'));var config=require(_0x6dd7('0x5'));var controller=require(_0x6dd7('0x6'));router[_0x6dd7('0x7')]('/',auth['isAuthenticated'](),controller[_0x6dd7('0x8')]);router[_0x6dd7('0x7')]('/describe',auth[_0x6dd7('0x9')](),controller['describe']);router['get'](_0x6dd7('0xa'),auth[_0x6dd7('0x9')](),controller[_0x6dd7('0xb')]);router['post']('/',auth[_0x6dd7('0x9')](),controller[_0x6dd7('0xc')]);router[_0x6dd7('0xd')](_0x6dd7('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6dd7('0xe')](_0x6dd7('0xa'),auth[_0x6dd7('0x9')](),controller[_0x6dd7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index b35c787..1f7e1f8 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 _0x1ba8=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get','show','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x34c371,_0x1e76a7){var _0x5b7128=function(_0x410d93){while(--_0x410d93){_0x34c371['push'](_0x34c371['shift']());}};_0x5b7128(++_0x1e76a7);}(_0x1ba8,0xd5));var _0x81ba=function(_0x2c3528,_0x5872d8){_0x2c3528=_0x2c3528-0x0;var _0x10db82=_0x1ba8[_0x2c3528];return _0x10db82;};'use strict';var multer=require(_0x81ba('0x0'));var util=require(_0x81ba('0x1'));var path=require(_0x81ba('0x2'));var timeout=require(_0x81ba('0x3'));var express=require(_0x81ba('0x4'));var router=express['Router']();var fs_extra=require(_0x81ba('0x5'));var auth=require(_0x81ba('0x6'));var interaction=require(_0x81ba('0x7'));var config=require(_0x81ba('0x8'));var controller=require(_0x81ba('0x9'));router['get']('/',auth[_0x81ba('0xa')](),controller[_0x81ba('0xb')]);router[_0x81ba('0xc')]('/:id',auth[_0x81ba('0xa')](),controller[_0x81ba('0xd')]);router[_0x81ba('0xc')]('/:id/configurations',auth[_0x81ba('0xa')](),controller['getConfigurations']);router['get'](_0x81ba('0xe'),auth['isAuthenticated'](),controller[_0x81ba('0xf')]);router[_0x81ba('0x10')]('/',auth[_0x81ba('0xa')](),controller[_0x81ba('0x11')]);router[_0x81ba('0x10')]('/:id/configurations',auth[_0x81ba('0xa')](),controller[_0x81ba('0x12')]);router['put'](_0x81ba('0x13'),auth[_0x81ba('0xa')](),controller[_0x81ba('0x14')]);router[_0x81ba('0x15')]('/:id',auth[_0x81ba('0xa')](),controller[_0x81ba('0x16')]);module[_0x81ba('0x17')]=router; \ No newline at end of file +var _0xd15f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','/:id','show','get','/:id/fields','create','post','/:id/configurations','addConfiguration','put','delete','util','connect-timeout','express'];(function(_0x195fb9,_0x5ab5cc){var _0x2bf1c4=function(_0x55c2ca){while(--_0x55c2ca){_0x195fb9['push'](_0x195fb9['shift']());}};_0x2bf1c4(++_0x5ab5cc);}(_0xd15f,0x1a1));var _0xfd15=function(_0x1a87b3,_0x45ba68){_0x1a87b3=_0x1a87b3-0x0;var _0x37e84d=_0xd15f[_0x1a87b3];return _0x37e84d;};'use strict';var multer=require('multer');var util=require(_0xfd15('0x0'));var path=require('path');var timeout=require(_0xfd15('0x1'));var express=require(_0xfd15('0x2'));var router=express[_0xfd15('0x3')]();var fs_extra=require(_0xfd15('0x4'));var auth=require(_0xfd15('0x5'));var interaction=require(_0xfd15('0x6'));var config=require(_0xfd15('0x7'));var controller=require(_0xfd15('0x8'));router['get']('/',auth[_0xfd15('0x9')](),controller[_0xfd15('0xa')]);router['get'](_0xfd15('0xb'),auth[_0xfd15('0x9')](),controller[_0xfd15('0xc')]);router['get']('/:id/configurations',auth[_0xfd15('0x9')](),controller['getConfigurations']);router[_0xfd15('0xd')](_0xfd15('0xe'),auth[_0xfd15('0x9')](),controller['getFields']);router['post']('/',auth[_0xfd15('0x9')](),controller[_0xfd15('0xf')]);router[_0xfd15('0x10')](_0xfd15('0x11'),auth['isAuthenticated'](),controller[_0xfd15('0x12')]);router[_0xfd15('0x13')]('/:id',auth[_0xfd15('0x9')](),controller['update']);router[_0xfd15('0x14')](_0xfd15('0xb'),auth[_0xfd15('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 9a641e2..706d9a4 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 _0x826b=['sequelize','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x826b,0x1bc));var _0xb826=function(_0x181642,_0x59fa32){_0x181642=_0x181642-0x0;var _0x70f6ce=_0x826b[_0x181642];return _0x70f6ce;};'use strict';var Sequelize=require(_0xb826('0x0'));module['exports']={'name':{'type':Sequelize[_0xb826('0x1')]},'description':{'type':Sequelize[_0xb826('0x1')]},'username':{'type':Sequelize[_0xb826('0x1')]},'remoteUri':{'type':Sequelize[_0xb826('0x1')]},'authType':{'type':Sequelize['ENUM'](_0xb826('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xb826('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb826('0x3')](_0xb826('0x4'),_0xb826('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x407f=['sequelize','exports','STRING','basic','ENUM','integrationTab','newTab'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x407f,0xee));var _0xf407=function(_0x2221cf,_0x3fd538){_0x2221cf=_0x2221cf-0x0;var _0x5f0269=_0x407f[_0x2221cf];return _0x5f0269;};'use strict';var Sequelize=require(_0xf407('0x0'));module[_0xf407('0x1')]={'name':{'type':Sequelize[_0xf407('0x2')]},'description':{'type':Sequelize[_0xf407('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf407('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xf407('0x3')),'defaultValue':_0xf407('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xf407('0x2')]},'consumerSecret':{'type':Sequelize[_0xf407('0x2')]},'token':{'type':Sequelize[_0xf407('0x2')]},'tokenSecret':{'type':Sequelize[_0xf407('0x2')]},'serverUrl':{'type':Sequelize[_0xf407('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf407('0x4')](_0xf407('0x5'),_0xf407('0x6')),'defaultValue':_0xf407('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 38b0572..a9d70e0 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 _0x9f22=['findOne','DeskConfiguration','order','AccountId','Subjects','getSubjects','channel','getDescriptions','DeskField','Descriptions','getFields','priority','remoteUri','username','password','consumerKey','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','Authorization','Basic\x20%s','%s:%s','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','apply','update','destroy','then','sendStatus','error','stack','name','send','index','map','DeskAccount','rawAttributes','type','model','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','getConfigurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f22,0x16e));var _0x29f2=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9f22[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0x29f2('0x0'));var rimraf=require(_0x29f2('0x1'));var zipdir=require(_0x29f2('0x2'));var jsonpatch=require(_0x29f2('0x3'));var rp=require(_0x29f2('0x4'));var moment=require(_0x29f2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f2('0x6'));var path=require('path');var sox=require(_0x29f2('0x7'));var csv=require('to-csv');var ejs=require(_0x29f2('0x8'));var fs=require('fs');var fs_extra=require(_0x29f2('0x9'));var _=require(_0x29f2('0xa'));var squel=require(_0x29f2('0xb'));var crypto=require(_0x29f2('0xc'));var jsforce=require(_0x29f2('0xd'));var deskjs=require(_0x29f2('0xe'));var toCsv=require(_0x29f2('0xf'));var querystring=require(_0x29f2('0x10'));var Papa=require('papaparse');var Redis=require(_0x29f2('0x11'));var authService=require(_0x29f2('0x12'));var qs=require(_0x29f2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x29f2('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x29f2('0x15'));var licenseUtil=require(_0x29f2('0x16'));var db=require(_0x29f2('0x17'))['db'];var integrations=require(_0x29f2('0x18'));function respondWithStatusCode(_0x2bfe5b,_0x5a56d6){_0x5a56d6=_0x5a56d6||0xcc;return function(_0x51c5e8){if(_0x51c5e8){return _0x2bfe5b['sendStatus'](_0x5a56d6);}return _0x2bfe5b[_0x29f2('0x19')](_0x5a56d6)[_0x29f2('0x1a')]();};}function respondWithResult(_0x217be2,_0x11241d){_0x11241d=_0x11241d||0xc8;return function(_0x2d32fc){if(_0x2d32fc){return _0x217be2[_0x29f2('0x19')](_0x11241d)[_0x29f2('0x1b')](_0x2d32fc);}};}function respondWithFilteredResult(_0x43a37d,_0x5c8d33){return function(_0x168726){if(_0x168726){var _0x1ea0ee=typeof _0x5c8d33[_0x29f2('0x1c')]==='undefined'&&typeof _0x5c8d33[_0x29f2('0x1d')]===_0x29f2('0x1e');var _0x4f7009=_0x168726[_0x29f2('0x1f')];var _0xd2944b=_0x1ea0ee?0x0:_0x5c8d33[_0x29f2('0x1c')];var _0x1ed60e=_0x1ea0ee?_0x168726[_0x29f2('0x1f')]:_0x5c8d33[_0x29f2('0x1c')]+_0x5c8d33[_0x29f2('0x1d')];var _0x8c6d5f;if(_0x1ed60e>=_0x4f7009){_0x1ed60e=_0x4f7009;_0x8c6d5f=0xc8;}else{_0x8c6d5f=0xce;}_0x43a37d[_0x29f2('0x19')](_0x8c6d5f);return _0x43a37d[_0x29f2('0x20')]('Content-Range',_0xd2944b+'-'+_0x1ed60e+'/'+_0x4f7009)['json'](_0x168726);}return null;};}function patchUpdates(_0x619753){return function(_0x17ab10){try{jsonpatch[_0x29f2('0x21')](_0x17ab10,_0x619753,!![]);}catch(_0x24be71){return BPromise['reject'](_0x24be71);}return _0x17ab10['save']();};}function saveUpdates(_0x1b5bb7,_0x24e8e7){return function(_0x40593b){if(_0x40593b){return _0x40593b[_0x29f2('0x22')](_0x1b5bb7)['then'](function(_0x557589){return _0x557589;});}return null;};}function removeEntity(_0x549eec,_0x4314a0){return function(_0x168c36){if(_0x168c36){return _0x168c36[_0x29f2('0x23')]()[_0x29f2('0x24')](function(){_0x549eec[_0x29f2('0x19')](0xcc)[_0x29f2('0x1a')]();});}};}function handleEntityNotFound(_0x5d719e,_0x4febec){return function(_0x10c96f){if(!_0x10c96f){_0x5d719e[_0x29f2('0x25')](0x194);}return _0x10c96f;};}function handleError(_0xa27f10,_0x425a4c){_0x425a4c=_0x425a4c||0x1f4;return function(_0x12afb7){logger[_0x29f2('0x26')](_0x12afb7[_0x29f2('0x27')]);if(_0x12afb7[_0x29f2('0x28')]){delete _0x12afb7[_0x29f2('0x28')];}_0xa27f10[_0x29f2('0x19')](_0x425a4c)[_0x29f2('0x29')](_0x12afb7);};}exports[_0x29f2('0x2a')]=function(_0x7c9b9c,_0x49fe10){var _0x3a0dcd={},_0x215dcc={},_0x545957={'count':0x0,'rows':[]};var _0xf41513=_[_0x29f2('0x2b')](db[_0x29f2('0x2c')][_0x29f2('0x2d')],function(_0x484050){return{'name':_0x484050['fieldName'],'type':_0x484050[_0x29f2('0x2e')]['key']};});_0x215dcc[_0x29f2('0x2f')]=_['map'](_0xf41513,_0x29f2('0x28'));_0x215dcc['query']=_['keys'](_0x7c9b9c['query']);_0x215dcc['filters']=_[_0x29f2('0x30')](_0x215dcc[_0x29f2('0x2f')],_0x215dcc['query']);_0x3a0dcd[_0x29f2('0x31')]=_[_0x29f2('0x30')](_0x215dcc[_0x29f2('0x2f')],qs[_0x29f2('0x32')](_0x7c9b9c[_0x29f2('0x33')]['fields']));_0x3a0dcd[_0x29f2('0x31')]=_0x3a0dcd[_0x29f2('0x31')][_0x29f2('0x34')]?_0x3a0dcd[_0x29f2('0x31')]:_0x215dcc['model'];if(!_0x7c9b9c[_0x29f2('0x33')][_0x29f2('0x35')](_0x29f2('0x36'))){_0x3a0dcd[_0x29f2('0x1d')]=qs[_0x29f2('0x1d')](_0x7c9b9c[_0x29f2('0x33')][_0x29f2('0x1d')]);_0x3a0dcd[_0x29f2('0x1c')]=qs[_0x29f2('0x1c')](_0x7c9b9c[_0x29f2('0x33')][_0x29f2('0x1c')]);}_0x3a0dcd['order']=qs['sort'](_0x7c9b9c['query'][_0x29f2('0x37')]);_0x3a0dcd[_0x29f2('0x38')]=qs[_0x29f2('0x39')](_[_0x29f2('0x3a')](_0x7c9b9c[_0x29f2('0x33')],_0x215dcc[_0x29f2('0x39')]),_0xf41513);if(_0x7c9b9c[_0x29f2('0x33')][_0x29f2('0x3b')]){_0x3a0dcd[_0x29f2('0x38')]=_[_0x29f2('0x3c')](_0x3a0dcd[_0x29f2('0x38')],{'$or':_[_0x29f2('0x2b')](_0xf41513,function(_0x20aa58){if(_0x20aa58[_0x29f2('0x2e')]!==_0x29f2('0x3d')){var _0xed0391={};_0xed0391[_0x20aa58[_0x29f2('0x28')]]={'$like':'%'+_0x7c9b9c[_0x29f2('0x33')][_0x29f2('0x3b')]+'%'};return _0xed0391;}})});}_0x3a0dcd=_[_0x29f2('0x3c')]({},_0x3a0dcd,_0x7c9b9c['options']);var _0x4cd9a2={'where':_0x3a0dcd[_0x29f2('0x38')]};return db[_0x29f2('0x2c')][_0x29f2('0x1f')](_0x4cd9a2)[_0x29f2('0x24')](function(_0x208314){_0x545957['count']=_0x208314;if(_0x7c9b9c[_0x29f2('0x33')][_0x29f2('0x3e')]){_0x3a0dcd['include']=[{'all':!![]}];}return db[_0x29f2('0x2c')][_0x29f2('0x3f')](_0x3a0dcd);})[_0x29f2('0x24')](function(_0x587eb9){_0x545957['rows']=_0x587eb9;return _0x545957;})['then'](respondWithFilteredResult(_0x49fe10,_0x3a0dcd))[_0x29f2('0x40')](handleError(_0x49fe10,null));};exports[_0x29f2('0x41')]=function(_0x568fba,_0x1fc720){var _0x1b79b6={'raw':![],'where':{'id':_0x568fba[_0x29f2('0x42')]['id']}},_0x497164={};_0x497164[_0x29f2('0x2f')]=_[_0x29f2('0x43')](db[_0x29f2('0x2c')][_0x29f2('0x2d')]);_0x497164[_0x29f2('0x33')]=_['keys'](_0x568fba[_0x29f2('0x33')]);_0x497164[_0x29f2('0x39')]=_['intersection'](_0x497164[_0x29f2('0x2f')],_0x497164['query']);_0x1b79b6['attributes']=_[_0x29f2('0x30')](_0x497164[_0x29f2('0x2f')],qs[_0x29f2('0x32')](_0x568fba[_0x29f2('0x33')][_0x29f2('0x32')]));_0x1b79b6[_0x29f2('0x31')]=_0x1b79b6[_0x29f2('0x31')]['length']?_0x1b79b6[_0x29f2('0x31')]:_0x497164[_0x29f2('0x2f')];if(_0x568fba[_0x29f2('0x33')]['includeAll']){_0x1b79b6[_0x29f2('0x44')]=[{'all':!![]}];}_0x1b79b6=_['merge']({},_0x1b79b6,_0x568fba[_0x29f2('0x45')]);return db['DeskAccount'][_0x29f2('0x46')](_0x1b79b6)[_0x29f2('0x24')](handleEntityNotFound(_0x1fc720,null))[_0x29f2('0x24')](respondWithResult(_0x1fc720,null))['catch'](handleError(_0x1fc720,null));};exports[_0x29f2('0x47')]=function(_0x2a82a5,_0x527031){return db[_0x29f2('0x2c')]['create'](_0x2a82a5[_0x29f2('0x48')],{})[_0x29f2('0x24')](respondWithResult(_0x527031,0xc9))[_0x29f2('0x40')](handleError(_0x527031,null));};exports[_0x29f2('0x22')]=function(_0x28269e,_0x472bdc){if(_0x28269e[_0x29f2('0x48')]['id']){delete _0x28269e[_0x29f2('0x48')]['id'];}return db[_0x29f2('0x2c')][_0x29f2('0x46')]({'where':{'id':_0x28269e[_0x29f2('0x42')]['id']}})[_0x29f2('0x24')](handleEntityNotFound(_0x472bdc,null))[_0x29f2('0x24')](saveUpdates(_0x28269e[_0x29f2('0x48')],null))[_0x29f2('0x24')](respondWithResult(_0x472bdc,null))[_0x29f2('0x40')](handleError(_0x472bdc,null));};exports[_0x29f2('0x23')]=function(_0x476048,_0x5d6a29){return db[_0x29f2('0x2c')][_0x29f2('0x46')]({'where':{'id':_0x476048['params']['id']}})[_0x29f2('0x24')](handleEntityNotFound(_0x5d6a29,null))['then'](removeEntity(_0x5d6a29,null))[_0x29f2('0x40')](handleError(_0x5d6a29,null));};exports[_0x29f2('0x49')]=function(_0x4c120d,_0x2a1c9a,_0x38ad16){var _0x4a9880={};var _0x318c0a={};var _0x4a0565;var _0x4bbd66;return db[_0x29f2('0x2c')][_0x29f2('0x4a')]({'where':{'id':_0x4c120d[_0x29f2('0x42')]['id']}})[_0x29f2('0x24')](handleEntityNotFound(_0x2a1c9a,null))['then'](function(_0x5cbff1){if(_0x5cbff1){_0x4a0565=_0x5cbff1;_0x318c0a['model']=_[_0x29f2('0x43')](db[_0x29f2('0x4b')][_0x29f2('0x2d')]);_0x318c0a[_0x29f2('0x33')]=_[_0x29f2('0x43')](_0x4c120d[_0x29f2('0x33')]);_0x318c0a['filters']=_['intersection'](_0x318c0a[_0x29f2('0x2f')],_0x318c0a[_0x29f2('0x33')]);_0x4a9880[_0x29f2('0x31')]=_['intersection'](_0x318c0a[_0x29f2('0x2f')],qs[_0x29f2('0x32')](_0x4c120d[_0x29f2('0x33')]['fields']));_0x4a9880[_0x29f2('0x31')]=_0x4a9880[_0x29f2('0x31')]['length']?_0x4a9880['attributes']:_0x318c0a[_0x29f2('0x2f')];_0x4a9880[_0x29f2('0x4c')]=qs[_0x29f2('0x37')](_0x4c120d['query'][_0x29f2('0x37')]);_0x4a9880[_0x29f2('0x38')]=qs['filters'](_[_0x29f2('0x3a')](_0x4c120d['query'],_0x318c0a[_0x29f2('0x39')]));if(_0x4c120d[_0x29f2('0x33')][_0x29f2('0x3b')]){_0x4a9880[_0x29f2('0x38')]=_[_0x29f2('0x3c')](_0x4a9880['where'],{'$or':_[_0x29f2('0x2b')](_0x4a9880[_0x29f2('0x31')],function(_0x274f9b){var _0x13bb2d={};_0x13bb2d[_0x274f9b]={'$like':'%'+_0x4c120d[_0x29f2('0x33')][_0x29f2('0x3b')]+'%'};return _0x13bb2d;})});}_0x4a9880=_['merge']({},_0x4a9880,_0x4c120d[_0x29f2('0x45')]);return _0x4a0565[_0x29f2('0x49')](_0x4a9880);}})[_0x29f2('0x24')](function(_0x49b78f){if(_0x49b78f){_0x4bbd66=_0x49b78f['length'];if(!_0x4c120d['query']['hasOwnProperty'](_0x29f2('0x36'))){_0x4a9880[_0x29f2('0x1d')]=qs[_0x29f2('0x1d')](_0x4c120d[_0x29f2('0x33')]['limit']);_0x4a9880['offset']=qs[_0x29f2('0x1c')](_0x4c120d[_0x29f2('0x33')][_0x29f2('0x1c')]);}return _0x4a0565[_0x29f2('0x49')](_0x4a9880);}})[_0x29f2('0x24')](function(_0x4bb54a){if(_0x4bb54a){return _0x4bb54a?{'count':_0x4bbd66,'rows':_0x4bb54a}:null;}})[_0x29f2('0x24')](respondWithResult(_0x2a1c9a,null))[_0x29f2('0x40')](handleError(_0x2a1c9a,null));};exports['addConfiguration']=function(_0x5a02f1,_0x59d1cb,_0xbda078){if(_0x5a02f1[_0x29f2('0x48')]['id']){delete _0x5a02f1[_0x29f2('0x48')]['id'];}return db[_0x29f2('0x2c')][_0x29f2('0x4a')]({'where':{'id':_0x5a02f1[_0x29f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x59d1cb,null))[_0x29f2('0x24')](function(_0x1156ec){if(_0x1156ec){_0x5a02f1[_0x29f2('0x48')][_0x29f2('0x4d')]=_0x1156ec['id'];_0x5a02f1[_0x29f2('0x48')][_0x29f2('0x4e')]=integrations[_0x29f2('0x4f')](_0x5a02f1['body'][_0x29f2('0x50')],_0x5a02f1[_0x29f2('0x48')][_0x29f2('0x2e')]);_0x5a02f1['body']['Descriptions']=integrations[_0x29f2('0x51')](_0x5a02f1['body']['channel'],_0x5a02f1[_0x29f2('0x48')][_0x29f2('0x2e')]);return db[_0x29f2('0x4b')][_0x29f2('0x47')](_0x5a02f1[_0x29f2('0x48')],{'include':[{'model':db[_0x29f2('0x52')],'as':'Subjects'},{'model':db[_0x29f2('0x52')],'as':_0x29f2('0x53')}]});}return null;})[_0x29f2('0x24')](respondWithResult(_0x59d1cb,null))[_0x29f2('0x40')](handleError(_0x59d1cb,null));};exports[_0x29f2('0x54')]=function(_0x433124,_0x3e7b52,_0x6dc332){var _0x53d4cd=[{'name':'priority','label':_0x29f2('0x55'),'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 _0x10623b='';return db[_0x29f2('0x2c')][_0x29f2('0x4a')]({'where':{'id':_0x433124['params']['id']},'attributes':['id',_0x29f2('0x56'),'authType',_0x29f2('0x57'),_0x29f2('0x58'),_0x29f2('0x59'),'consumerSecret',_0x29f2('0x5a'),_0x29f2('0x5b')]})[_0x29f2('0x24')](handleEntityNotFound(_0x3e7b52,null))[_0x29f2('0x24')](function(_0x30f841){if(_0x30f841){_0x10623b=_0x30f841['remoteUri'];var _0x2de311=_0x10623b['slice'](-0x1);if(_0x2de311==='/'){_0x10623b=_0x10623b[_0x29f2('0x5c')](0x0,_0x10623b[_0x29f2('0x5d')](_0x2de311));}var _0x112a56={'method':_0x29f2('0x5e'),'uri':util[_0x29f2('0x5f')](_0x29f2('0x60'),_0x10623b),'headers':{'Content-Type':_0x29f2('0x61'),'Accept':_0x29f2('0x61')},'json':!![]};if(_0x30f841[_0x29f2('0x62')]==='basic'){_0x112a56['headers'][_0x29f2('0x63')]=util[_0x29f2('0x5f')](_0x29f2('0x64'),new Buffer(util[_0x29f2('0x5f')](_0x29f2('0x65'),_0x30f841[_0x29f2('0x57')],_0x30f841['password']))['toString'](_0x29f2('0x66')));}return rp(_0x112a56)[_0x29f2('0x24')](function(_0x538b05){return _0x53d4cd['concat'](_[_0x29f2('0x2b')](_0x538b05[_0x29f2('0x67')][_0x29f2('0x68')],function(_0x2a0aca){return{'id':_0x2a0aca[_0x29f2('0x28')],'name':_0x2a0aca[_0x29f2('0x28')],'type':_0x2a0aca[_0x29f2('0x2e')],'active':_0x2a0aca[_0x29f2('0x69')],'label':_0x2a0aca[_0x29f2('0x6a')],'custom':!![]};}));});}})[_0x29f2('0x24')](function(_0x423abc){return{'count':_0x423abc[_0x29f2('0x34')],'rows':_0x423abc};})['then'](respondWithResult(_0x3e7b52,null))['catch'](function(_0x14ea17){var _0x3487d2=_0x433124['query'][_0x29f2('0x6b')]?0x1f4:_0x14ea17[_0x29f2('0x6c')]||0x1f4;logger[_0x29f2('0x26')](_0x29f2('0x6d'),_0x29f2('0x54'),_0x3487d2,JSON['stringify'](_0x14ea17));delete _0x14ea17[_0x29f2('0x28')];if(_0x3487d2===0x191){_0x3487d2=0x190;}_0x3e7b52[_0x29f2('0x19')](_0x3487d2)['send'](_0x433124['query'][_0x29f2('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x14ea17[_0x29f2('0x6c')]}:_0x14ea17);});}; \ No newline at end of file +var _0x3519=['DeskConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','remoteUri','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','%s/custom_fields','application/json','authType','basic','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','update','then','end','sendStatus','error','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','getConfigurations','findOne'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0x3519,0x10f));var _0x9351=function(_0x3adad8,_0x5aef55){_0x3adad8=_0x3adad8-0x0;var _0x177095=_0x3519[_0x3adad8];return _0x177095;};'use strict';var emlformat=require(_0x9351('0x0'));var rimraf=require(_0x9351('0x1'));var zipdir=require(_0x9351('0x2'));var jsonpatch=require(_0x9351('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9351('0x4'));var Mustache=require(_0x9351('0x5'));var util=require(_0x9351('0x6'));var path=require('path');var sox=require(_0x9351('0x7'));var csv=require(_0x9351('0x8'));var ejs=require(_0x9351('0x9'));var fs=require('fs');var fs_extra=require(_0x9351('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9351('0xb'));var jsforce=require(_0x9351('0xc'));var deskjs=require(_0x9351('0xd'));var toCsv=require(_0x9351('0x8'));var querystring=require(_0x9351('0xe'));var Papa=require(_0x9351('0xf'));var Redis=require(_0x9351('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9351('0x11'));var hardwareService=require(_0x9351('0x12'));var logger=require(_0x9351('0x13'))(_0x9351('0x14'));var utils=require(_0x9351('0x15'));var config=require(_0x9351('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9351('0x17'))['db'];var integrations=require(_0x9351('0x18'));function respondWithStatusCode(_0x4f3430,_0xf62f0c){_0xf62f0c=_0xf62f0c||0xcc;return function(_0x237e1a){if(_0x237e1a){return _0x4f3430['sendStatus'](_0xf62f0c);}return _0x4f3430['status'](_0xf62f0c)['end']();};}function respondWithResult(_0x377ecf,_0x190c01){_0x190c01=_0x190c01||0xc8;return function(_0x419c63){if(_0x419c63){return _0x377ecf[_0x9351('0x19')](_0x190c01)[_0x9351('0x1a')](_0x419c63);}};}function respondWithFilteredResult(_0x518d0e,_0x104a4f){return function(_0x4cbfca){if(_0x4cbfca){var _0x31aaf3=typeof _0x104a4f[_0x9351('0x1b')]===_0x9351('0x1c')&&typeof _0x104a4f[_0x9351('0x1d')]===_0x9351('0x1c');var _0x2c8b4f=_0x4cbfca[_0x9351('0x1e')];var _0x2d4fbc=_0x31aaf3?0x0:_0x104a4f[_0x9351('0x1b')];var _0xe479f2=_0x31aaf3?_0x4cbfca[_0x9351('0x1e')]:_0x104a4f['offset']+_0x104a4f['limit'];var _0x3fc35e;if(_0xe479f2>=_0x2c8b4f){_0xe479f2=_0x2c8b4f;_0x3fc35e=0xc8;}else{_0x3fc35e=0xce;}_0x518d0e[_0x9351('0x19')](_0x3fc35e);return _0x518d0e[_0x9351('0x1f')]('Content-Range',_0x2d4fbc+'-'+_0xe479f2+'/'+_0x2c8b4f)[_0x9351('0x1a')](_0x4cbfca);}return null;};}function patchUpdates(_0x4dc541){return function(_0x55133f){try{jsonpatch[_0x9351('0x20')](_0x55133f,_0x4dc541,!![]);}catch(_0x3bfa48){return BPromise['reject'](_0x3bfa48);}return _0x55133f['save']();};}function saveUpdates(_0x252da8,_0x4453e5){return function(_0x368f39){if(_0x368f39){return _0x368f39[_0x9351('0x21')](_0x252da8)['then'](function(_0x49e9ec){return _0x49e9ec;});}return null;};}function removeEntity(_0x55af89,_0x4f1b2e){return function(_0x2b4b98){if(_0x2b4b98){return _0x2b4b98['destroy']()[_0x9351('0x22')](function(){_0x55af89[_0x9351('0x19')](0xcc)[_0x9351('0x23')]();});}};}function handleEntityNotFound(_0x38e40e,_0x30ee6c){return function(_0x24a3d9){if(!_0x24a3d9){_0x38e40e[_0x9351('0x24')](0x194);}return _0x24a3d9;};}function handleError(_0x48d888,_0x31448b){_0x31448b=_0x31448b||0x1f4;return function(_0x72bee3){logger[_0x9351('0x25')](_0x72bee3['stack']);if(_0x72bee3[_0x9351('0x26')]){delete _0x72bee3['name'];}_0x48d888[_0x9351('0x19')](_0x31448b)[_0x9351('0x27')](_0x72bee3);};}exports[_0x9351('0x28')]=function(_0x4ddb11,_0x1a1d20){var _0x318d4a={},_0x153ac2={},_0x29f651={'count':0x0,'rows':[]};var _0x149f7a=_[_0x9351('0x29')](db[_0x9351('0x2a')][_0x9351('0x2b')],function(_0x28d533){return{'name':_0x28d533[_0x9351('0x2c')],'type':_0x28d533[_0x9351('0x2d')][_0x9351('0x2e')]};});_0x153ac2[_0x9351('0x2f')]=_[_0x9351('0x29')](_0x149f7a,_0x9351('0x26'));_0x153ac2[_0x9351('0x30')]=_[_0x9351('0x31')](_0x4ddb11[_0x9351('0x30')]);_0x153ac2[_0x9351('0x32')]=_[_0x9351('0x33')](_0x153ac2[_0x9351('0x2f')],_0x153ac2[_0x9351('0x30')]);_0x318d4a[_0x9351('0x34')]=_[_0x9351('0x33')](_0x153ac2['model'],qs[_0x9351('0x35')](_0x4ddb11[_0x9351('0x30')][_0x9351('0x35')]));_0x318d4a[_0x9351('0x34')]=_0x318d4a['attributes'][_0x9351('0x36')]?_0x318d4a['attributes']:_0x153ac2[_0x9351('0x2f')];if(!_0x4ddb11[_0x9351('0x30')][_0x9351('0x37')]('nolimit')){_0x318d4a[_0x9351('0x1d')]=qs['limit'](_0x4ddb11['query']['limit']);_0x318d4a[_0x9351('0x1b')]=qs[_0x9351('0x1b')](_0x4ddb11[_0x9351('0x30')][_0x9351('0x1b')]);}_0x318d4a[_0x9351('0x38')]=qs['sort'](_0x4ddb11['query'][_0x9351('0x39')]);_0x318d4a[_0x9351('0x3a')]=qs[_0x9351('0x32')](_[_0x9351('0x3b')](_0x4ddb11[_0x9351('0x30')],_0x153ac2['filters']),_0x149f7a);if(_0x4ddb11['query'][_0x9351('0x3c')]){_0x318d4a['where']=_[_0x9351('0x3d')](_0x318d4a['where'],{'$or':_['map'](_0x149f7a,function(_0x52de44){if(_0x52de44['type']!==_0x9351('0x3e')){var _0x178dc9={};_0x178dc9[_0x52de44[_0x9351('0x26')]]={'$like':'%'+_0x4ddb11[_0x9351('0x30')][_0x9351('0x3c')]+'%'};return _0x178dc9;}})});}_0x318d4a=_[_0x9351('0x3d')]({},_0x318d4a,_0x4ddb11[_0x9351('0x3f')]);var _0x1badbb={'where':_0x318d4a['where']};return db['DeskAccount'][_0x9351('0x1e')](_0x1badbb)['then'](function(_0x3bfb17){_0x29f651[_0x9351('0x1e')]=_0x3bfb17;if(_0x4ddb11['query'][_0x9351('0x40')]){_0x318d4a[_0x9351('0x41')]=[{'all':!![]}];}return db[_0x9351('0x2a')][_0x9351('0x42')](_0x318d4a);})[_0x9351('0x22')](function(_0x29cb0e){_0x29f651[_0x9351('0x43')]=_0x29cb0e;return _0x29f651;})[_0x9351('0x22')](respondWithFilteredResult(_0x1a1d20,_0x318d4a))['catch'](handleError(_0x1a1d20,null));};exports[_0x9351('0x44')]=function(_0x19cd2a,_0x502fec){var _0x5ccaef={'raw':![],'where':{'id':_0x19cd2a[_0x9351('0x45')]['id']}},_0xe1ec49={};_0xe1ec49[_0x9351('0x2f')]=_['keys'](db[_0x9351('0x2a')][_0x9351('0x2b')]);_0xe1ec49['query']=_[_0x9351('0x31')](_0x19cd2a[_0x9351('0x30')]);_0xe1ec49[_0x9351('0x32')]=_['intersection'](_0xe1ec49[_0x9351('0x2f')],_0xe1ec49[_0x9351('0x30')]);_0x5ccaef[_0x9351('0x34')]=_[_0x9351('0x33')](_0xe1ec49[_0x9351('0x2f')],qs[_0x9351('0x35')](_0x19cd2a['query'][_0x9351('0x35')]));_0x5ccaef['attributes']=_0x5ccaef[_0x9351('0x34')][_0x9351('0x36')]?_0x5ccaef['attributes']:_0xe1ec49[_0x9351('0x2f')];if(_0x19cd2a[_0x9351('0x30')][_0x9351('0x40')]){_0x5ccaef[_0x9351('0x41')]=[{'all':!![]}];}_0x5ccaef=_[_0x9351('0x3d')]({},_0x5ccaef,_0x19cd2a[_0x9351('0x3f')]);return db[_0x9351('0x2a')][_0x9351('0x46')](_0x5ccaef)['then'](handleEntityNotFound(_0x502fec,null))[_0x9351('0x22')](respondWithResult(_0x502fec,null))[_0x9351('0x47')](handleError(_0x502fec,null));};exports[_0x9351('0x48')]=function(_0xf25d08,_0x3b13ee){return db[_0x9351('0x2a')][_0x9351('0x48')](_0xf25d08[_0x9351('0x49')],{})[_0x9351('0x22')](respondWithResult(_0x3b13ee,0xc9))[_0x9351('0x47')](handleError(_0x3b13ee,null));};exports[_0x9351('0x21')]=function(_0x250f06,_0x231eb3){if(_0x250f06[_0x9351('0x49')]['id']){delete _0x250f06[_0x9351('0x49')]['id'];}return db[_0x9351('0x2a')][_0x9351('0x46')]({'where':{'id':_0x250f06[_0x9351('0x45')]['id']}})[_0x9351('0x22')](handleEntityNotFound(_0x231eb3,null))[_0x9351('0x22')](saveUpdates(_0x250f06['body'],null))[_0x9351('0x22')](respondWithResult(_0x231eb3,null))[_0x9351('0x47')](handleError(_0x231eb3,null));};exports[_0x9351('0x4a')]=function(_0x2d0a70,_0x4a564e){return db[_0x9351('0x2a')][_0x9351('0x46')]({'where':{'id':_0x2d0a70[_0x9351('0x45')]['id']}})[_0x9351('0x22')](handleEntityNotFound(_0x4a564e,null))['then'](removeEntity(_0x4a564e,null))[_0x9351('0x47')](handleError(_0x4a564e,null));};exports[_0x9351('0x4b')]=function(_0x4fb48d,_0x52f09b,_0x77f1e7){var _0x96fe9a={};var _0x115b8e={};var _0x47a284;var _0x340135;return db[_0x9351('0x2a')][_0x9351('0x4c')]({'where':{'id':_0x4fb48d[_0x9351('0x45')]['id']}})[_0x9351('0x22')](handleEntityNotFound(_0x52f09b,null))[_0x9351('0x22')](function(_0x42784e){if(_0x42784e){_0x47a284=_0x42784e;_0x115b8e[_0x9351('0x2f')]=_[_0x9351('0x31')](db[_0x9351('0x4d')][_0x9351('0x2b')]);_0x115b8e[_0x9351('0x30')]=_[_0x9351('0x31')](_0x4fb48d[_0x9351('0x30')]);_0x115b8e[_0x9351('0x32')]=_[_0x9351('0x33')](_0x115b8e[_0x9351('0x2f')],_0x115b8e['query']);_0x96fe9a['attributes']=_[_0x9351('0x33')](_0x115b8e[_0x9351('0x2f')],qs[_0x9351('0x35')](_0x4fb48d[_0x9351('0x30')]['fields']));_0x96fe9a['attributes']=_0x96fe9a['attributes'][_0x9351('0x36')]?_0x96fe9a[_0x9351('0x34')]:_0x115b8e[_0x9351('0x2f')];_0x96fe9a[_0x9351('0x38')]=qs[_0x9351('0x39')](_0x4fb48d[_0x9351('0x30')][_0x9351('0x39')]);_0x96fe9a[_0x9351('0x3a')]=qs['filters'](_[_0x9351('0x3b')](_0x4fb48d[_0x9351('0x30')],_0x115b8e[_0x9351('0x32')]));if(_0x4fb48d[_0x9351('0x30')][_0x9351('0x3c')]){_0x96fe9a[_0x9351('0x3a')]=_[_0x9351('0x3d')](_0x96fe9a[_0x9351('0x3a')],{'$or':_[_0x9351('0x29')](_0x96fe9a[_0x9351('0x34')],function(_0x2a8354){var _0x4ad9f8={};_0x4ad9f8[_0x2a8354]={'$like':'%'+_0x4fb48d[_0x9351('0x30')][_0x9351('0x3c')]+'%'};return _0x4ad9f8;})});}_0x96fe9a=_[_0x9351('0x3d')]({},_0x96fe9a,_0x4fb48d[_0x9351('0x3f')]);return _0x47a284[_0x9351('0x4b')](_0x96fe9a);}})['then'](function(_0x35b773){if(_0x35b773){_0x340135=_0x35b773['length'];if(!_0x4fb48d[_0x9351('0x30')][_0x9351('0x37')](_0x9351('0x4e'))){_0x96fe9a[_0x9351('0x1d')]=qs[_0x9351('0x1d')](_0x4fb48d['query']['limit']);_0x96fe9a[_0x9351('0x1b')]=qs[_0x9351('0x1b')](_0x4fb48d['query'][_0x9351('0x1b')]);}return _0x47a284['getConfigurations'](_0x96fe9a);}})[_0x9351('0x22')](function(_0x552989){if(_0x552989){return _0x552989?{'count':_0x340135,'rows':_0x552989}:null;}})[_0x9351('0x22')](respondWithResult(_0x52f09b,null))['catch'](handleError(_0x52f09b,null));};exports[_0x9351('0x4f')]=function(_0x7bb411,_0xe54bd5,_0x1911d2){if(_0x7bb411[_0x9351('0x49')]['id']){delete _0x7bb411[_0x9351('0x49')]['id'];}return db[_0x9351('0x2a')][_0x9351('0x4c')]({'where':{'id':_0x7bb411[_0x9351('0x45')]['id']}})[_0x9351('0x22')](handleEntityNotFound(_0xe54bd5,null))[_0x9351('0x22')](function(_0x433ade){if(_0x433ade){_0x7bb411[_0x9351('0x49')][_0x9351('0x50')]=_0x433ade['id'];_0x7bb411['body'][_0x9351('0x51')]=integrations[_0x9351('0x52')](_0x7bb411[_0x9351('0x49')][_0x9351('0x53')],_0x7bb411[_0x9351('0x49')][_0x9351('0x2d')]);_0x7bb411[_0x9351('0x49')][_0x9351('0x54')]=integrations[_0x9351('0x55')](_0x7bb411['body'][_0x9351('0x53')],_0x7bb411[_0x9351('0x49')][_0x9351('0x2d')]);return db[_0x9351('0x4d')]['create'](_0x7bb411[_0x9351('0x49')],{'include':[{'model':db[_0x9351('0x56')],'as':_0x9351('0x51')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x9351('0x22')](respondWithResult(_0xe54bd5,null))[_0x9351('0x47')](handleError(_0xe54bd5,null));};exports[_0x9351('0x57')]=function(_0x3fe9a5,_0x34cc5d,_0x77ab1a){var _0x2f8678=[{'name':'priority','label':'priority','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 _0x3d63b4='';return db['DeskAccount'][_0x9351('0x4c')]({'where':{'id':_0x3fe9a5[_0x9351('0x45')]['id']},'attributes':['id',_0x9351('0x58'),'authType',_0x9351('0x59'),_0x9351('0x5a'),_0x9351('0x5b'),_0x9351('0x5c'),_0x9351('0x5d'),_0x9351('0x5e')]})[_0x9351('0x22')](handleEntityNotFound(_0x34cc5d,null))['then'](function(_0x321b13){if(_0x321b13){_0x3d63b4=_0x321b13['remoteUri'];var _0x395d27=_0x3d63b4['slice'](-0x1);if(_0x395d27==='/'){_0x3d63b4=_0x3d63b4[_0x9351('0x5f')](0x0,_0x3d63b4[_0x9351('0x60')](_0x395d27));}var _0x52104c={'method':'GET','uri':util['format'](_0x9351('0x61'),_0x3d63b4),'headers':{'Content-Type':_0x9351('0x62'),'Accept':_0x9351('0x62')},'json':!![]};if(_0x321b13[_0x9351('0x63')]===_0x9351('0x64')){_0x52104c[_0x9351('0x65')][_0x9351('0x66')]=util[_0x9351('0x67')](_0x9351('0x68'),new Buffer(util['format'](_0x9351('0x69'),_0x321b13['username'],_0x321b13[_0x9351('0x5a')]))[_0x9351('0x6a')](_0x9351('0x6b')));}return rp(_0x52104c)['then'](function(_0xa006b3){return _0x2f8678[_0x9351('0x6c')](_[_0x9351('0x29')](_0xa006b3[_0x9351('0x6d')][_0x9351('0x6e')],function(_0x1892e4){return{'id':_0x1892e4[_0x9351('0x26')],'name':_0x1892e4[_0x9351('0x26')],'type':_0x1892e4[_0x9351('0x2d')],'active':_0x1892e4[_0x9351('0x6f')],'label':_0x1892e4[_0x9351('0x70')],'custom':!![]};}));});}})[_0x9351('0x22')](function(_0x48186d){return{'count':_0x48186d[_0x9351('0x36')],'rows':_0x48186d};})[_0x9351('0x22')](respondWithResult(_0x34cc5d,null))[_0x9351('0x47')](function(_0x2a7388){var _0x2f03b9=_0x3fe9a5[_0x9351('0x30')][_0x9351('0x71')]?0x1f4:_0x2a7388[_0x9351('0x72')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x9351('0x57'),_0x2f03b9,JSON['stringify'](_0x2a7388));delete _0x2a7388[_0x9351('0x26')];if(_0x2f03b9===0x191){_0x2f03b9=0x190;}_0x34cc5d[_0x9351('0x19')](_0x2f03b9)['send'](_0x3fe9a5[_0x9351('0x30')]['test']?{'message':_0x9351('0x73'),'statusCode':_0x2a7388[_0x9351('0x72')]}:_0x2a7388);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5944a40..00ea836 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 _0xe752=['path','./intDeskAccount.attributes','exports','define','int_desk_accounts','../../config/logger','moment'];(function(_0x3a7415,_0xa026b6){var _0x5487a5=function(_0x9d4a71){while(--_0x9d4a71){_0x3a7415['push'](_0x3a7415['shift']());}};_0x5487a5(++_0xa026b6);}(_0xe752,0xc2));var _0x2e75=function(_0x5f296e,_0x277111){_0x5f296e=_0x5f296e-0x0;var _0x423c21=_0xe752[_0x5f296e];return _0x423c21;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2e75('0x0'))('api');var moment=require(_0x2e75('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e75('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2e75('0x3'));var integrations=require('../../components/integrations/configuration');module[_0x2e75('0x4')]=function(_0xff4de3,_0x2293aa){return _0xff4de3[_0x2e75('0x5')]('DeskAccount',attributes,{'tableName':_0x2e75('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2c0=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes'];(function(_0x386187,_0x1ad2ac){var _0x4abeaa=function(_0x251f63){while(--_0x251f63){_0x386187['push'](_0x386187['shift']());}};_0x4abeaa(++_0x1ad2ac);}(_0xe2c0,0x1c7));var _0x0e2c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe2c0[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x0e2c('0x0'));var util=require(_0x0e2c('0x1'));var logger=require(_0x0e2c('0x2'))(_0x0e2c('0x3'));var moment=require(_0x0e2c('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e2c('0x5'));var fs=require('fs');var path=require(_0x0e2c('0x6'));var rimraf=require(_0x0e2c('0x7'));var config=require(_0x0e2c('0x8'));var attributes=require(_0x0e2c('0x9'));var integrations=require(_0x0e2c('0xa'));module[_0x0e2c('0xb')]=function(_0x1391f5,_0x5757d0){return _0x1391f5[_0x0e2c('0xc')](_0x0e2c('0xd'),attributes,{'tableName':_0x0e2c('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 7e090c9..b9f2178 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 _0x73fc=['then','debug','ShowDeskAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','map','include','model'];(function(_0x592019,_0x5b866e){var _0x279e08=function(_0x16d031){while(--_0x16d031){_0x592019['push'](_0x592019['shift']());}};_0x279e08(++_0x5b866e);}(_0x73fc,0x1b4));var _0xc73f=function(_0x585054,_0x2bb429){_0x585054=_0x585054-0x0;var _0x3b9d80=_0x73fc[_0x585054];return _0x3b9d80;};'use strict';var _=require(_0xc73f('0x0'));var util=require(_0xc73f('0x1'));var moment=require(_0xc73f('0x2'));var BPromise=require('bluebird');var rs=require(_0xc73f('0x3'));var fs=require('fs');var Redis=require(_0xc73f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc73f('0x5'));var logger=require(_0xc73f('0x6'))(_0xc73f('0x7'));var config=require('../../config/environment');var jayson=require(_0xc73f('0x8'));var client=jayson[_0xc73f('0x9')][_0xc73f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfd122f,_0x2725d3,_0x36cf91){return new BPromise(function(_0x37ee0f,_0x469196){return client[_0xc73f('0xb')](_0xfd122f,_0x36cf91)['then'](function(_0x1864b3){logger['info']('DeskAccount,\x20%s,\x20%s',_0x2725d3,_0xc73f('0xc'));logger['debug'](_0xc73f('0xd'),_0x2725d3,_0xc73f('0xc'),JSON[_0xc73f('0xe')](_0x1864b3));if(_0x1864b3[_0xc73f('0xf')]){if(_0x1864b3[_0xc73f('0xf')][_0xc73f('0x10')]===0x1f4){logger[_0xc73f('0xf')](_0xc73f('0x11'),_0x2725d3,_0x1864b3['error'][_0xc73f('0x12')]);return _0x469196(_0x1864b3['error']['message']);}logger[_0xc73f('0xf')]('DeskAccount,\x20%s,\x20%s',_0x2725d3,_0x1864b3['error'][_0xc73f('0x12')]);return _0x37ee0f(_0x1864b3[_0xc73f('0xf')][_0xc73f('0x12')]);}else{logger[_0xc73f('0x13')]('DeskAccount,\x20%s,\x20%s',_0x2725d3,_0xc73f('0xc'));_0x37ee0f(_0x1864b3[_0xc73f('0x14')][_0xc73f('0x12')]);}})[_0xc73f('0x15')](function(_0x18a396){logger['error'](_0xc73f('0x11'),_0x2725d3,_0x18a396);_0x469196(_0x18a396);});});}exports[_0xc73f('0x16')]=function(_0x4786a1){var _0x9827be=this;return new Promise(function(_0x5a4237,_0x218247){return db[_0xc73f('0x17')][_0xc73f('0x18')]({'raw':_0x4786a1[_0xc73f('0x19')]?_0x4786a1[_0xc73f('0x19')][_0xc73f('0x1a')]===undefined?!![]:![]:!![],'where':_0x4786a1[_0xc73f('0x19')]?_0x4786a1[_0xc73f('0x19')]['where']||null:null,'attributes':_0x4786a1[_0xc73f('0x19')]?_0x4786a1[_0xc73f('0x19')][_0xc73f('0x1b')]||null:null,'limit':_0x4786a1['options']?_0x4786a1[_0xc73f('0x19')][_0xc73f('0x1c')]||null:null,'include':_0x4786a1[_0xc73f('0x19')]?_0x4786a1[_0xc73f('0x19')]['include']?_[_0xc73f('0x1d')](_0x4786a1['options']['include'],function(_0x55c412){return{'model':db[_0x55c412['model']],'as':_0x55c412['as'],'attributes':_0x55c412[_0xc73f('0x1b')],'include':_0x55c412['include']?_[_0xc73f('0x1d')](_0x55c412[_0xc73f('0x1e')],function(_0x1f798a){return{'model':db[_0x1f798a[_0xc73f('0x1f')]],'as':_0x1f798a['as'],'attributes':_0x1f798a[_0xc73f('0x1b')],'include':_0x1f798a[_0xc73f('0x1e')]?_[_0xc73f('0x1d')](_0x1f798a[_0xc73f('0x1e')],function(_0xbf8efa){return{'model':db[_0xbf8efa[_0xc73f('0x1f')]],'as':_0xbf8efa['as'],'attributes':_0xbf8efa[_0xc73f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc73f('0x20')](function(_0x447167){logger[_0xc73f('0x13')]('GetDeskAccount',_0x4786a1);logger[_0xc73f('0x21')](_0xc73f('0x16'),_0x4786a1,JSON[_0xc73f('0xe')](_0x447167));_0x5a4237(_0x447167);})[_0xc73f('0x15')](function(_0x475d99){logger['error'](_0xc73f('0x16'),_0x475d99['message'],_0x4786a1);_0x218247(_0x9827be[_0xc73f('0xf')](0x1f4,_0x475d99[_0xc73f('0x12')]));});});};exports[_0xc73f('0x22')]=function(_0x115171){var _0xde5e1=this;return new Promise(function(_0x1e7217,_0x10b273){return db[_0xc73f('0x17')][_0xc73f('0x23')]({'raw':_0x115171['options']?_0x115171[_0xc73f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x115171[_0xc73f('0x19')]?_0x115171[_0xc73f('0x19')]['where']||null:null,'attributes':_0x115171[_0xc73f('0x19')]?_0x115171[_0xc73f('0x19')][_0xc73f('0x1b')]||null:null,'include':_0x115171[_0xc73f('0x19')]?_0x115171['options'][_0xc73f('0x1e')]?_['map'](_0x115171['options'][_0xc73f('0x1e')],function(_0x5da8f5){return{'model':db[_0x5da8f5[_0xc73f('0x1f')]],'as':_0x5da8f5['as'],'attributes':_0x5da8f5[_0xc73f('0x1b')],'include':_0x5da8f5[_0xc73f('0x1e')]?_[_0xc73f('0x1d')](_0x5da8f5[_0xc73f('0x1e')],function(_0x201a8d){return{'model':db[_0x201a8d[_0xc73f('0x1f')]],'as':_0x201a8d['as'],'attributes':_0x201a8d[_0xc73f('0x1b')],'include':_0x201a8d[_0xc73f('0x1e')]?_[_0xc73f('0x1d')](_0x201a8d[_0xc73f('0x1e')],function(_0xca6339){return{'model':db[_0xca6339[_0xc73f('0x1f')]],'as':_0xca6339['as'],'attributes':_0xca6339[_0xc73f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9e6ca1){logger['info'](_0xc73f('0x22'),_0x115171);logger[_0xc73f('0x21')]('ShowDeskAccount',_0x115171,JSON[_0xc73f('0xe')](_0x9e6ca1));_0x1e7217(_0x9e6ca1);})[_0xc73f('0x15')](function(_0x352949){logger['error'](_0xc73f('0x22'),_0x352949[_0xc73f('0x12')],_0x115171);_0x10b273(_0xde5e1[_0xc73f('0xf')](0x1f4,_0x352949[_0xc73f('0x12')]));});});}; \ No newline at end of file +var _0x1b24=['rpc','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowDeskAccount','find','info','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x91ed64,_0x21b822){var _0x39dbb7=function(_0x3bfd23){while(--_0x3bfd23){_0x91ed64['push'](_0x91ed64['shift']());}};_0x39dbb7(++_0x21b822);}(_0x1b24,0x1c8));var _0x41b2=function(_0x2b97bc,_0xace6d0){_0x2b97bc=_0x2b97bc-0x0;var _0x1e784d=_0x1b24[_0x2b97bc];return _0x1e784d;};'use strict';var _=require(_0x41b2('0x0'));var util=require(_0x41b2('0x1'));var moment=require(_0x41b2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41b2('0x3'));var db=require(_0x41b2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x41b2('0x5'))(_0x41b2('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x41b2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x483afa,_0x13954d,_0x3d62ff){return new BPromise(function(_0x6d733d,_0x1cec96){return client[_0x41b2('0x8')](_0x483afa,_0x3d62ff)[_0x41b2('0x9')](function(_0x165389){logger['info'](_0x41b2('0xa'),_0x13954d,_0x41b2('0xb'));logger[_0x41b2('0xc')](_0x41b2('0xd'),_0x13954d,'request\x20sent',JSON[_0x41b2('0xe')](_0x165389));if(_0x165389[_0x41b2('0xf')]){if(_0x165389['error']['code']===0x1f4){logger[_0x41b2('0xf')]('DeskAccount,\x20%s,\x20%s',_0x13954d,_0x165389['error']['message']);return _0x1cec96(_0x165389['error'][_0x41b2('0x10')]);}logger[_0x41b2('0xf')](_0x41b2('0xa'),_0x13954d,_0x165389[_0x41b2('0xf')]['message']);return _0x6d733d(_0x165389['error']['message']);}else{logger['info'](_0x41b2('0xa'),_0x13954d,'request\x20sent');_0x6d733d(_0x165389[_0x41b2('0x11')][_0x41b2('0x10')]);}})[_0x41b2('0x12')](function(_0x2e4c04){logger[_0x41b2('0xf')]('DeskAccount,\x20%s,\x20%s',_0x13954d,_0x2e4c04);_0x1cec96(_0x2e4c04);});});}exports[_0x41b2('0x13')]=function(_0x2e982a){var _0x12fc34=this;return new Promise(function(_0x437e89,_0x3c2c1f){return db[_0x41b2('0x14')][_0x41b2('0x15')]({'raw':_0x2e982a[_0x41b2('0x16')]?_0x2e982a['options'][_0x41b2('0x17')]===undefined?!![]:![]:!![],'where':_0x2e982a[_0x41b2('0x16')]?_0x2e982a[_0x41b2('0x16')][_0x41b2('0x18')]||null:null,'attributes':_0x2e982a[_0x41b2('0x16')]?_0x2e982a['options'][_0x41b2('0x19')]||null:null,'limit':_0x2e982a[_0x41b2('0x16')]?_0x2e982a[_0x41b2('0x16')][_0x41b2('0x1a')]||null:null,'include':_0x2e982a[_0x41b2('0x16')]?_0x2e982a[_0x41b2('0x16')]['include']?_[_0x41b2('0x1b')](_0x2e982a[_0x41b2('0x16')]['include'],function(_0x163004){return{'model':db[_0x163004['model']],'as':_0x163004['as'],'attributes':_0x163004[_0x41b2('0x19')],'include':_0x163004['include']?_[_0x41b2('0x1b')](_0x163004[_0x41b2('0x1c')],function(_0x174985){return{'model':db[_0x174985[_0x41b2('0x1d')]],'as':_0x174985['as'],'attributes':_0x174985[_0x41b2('0x19')],'include':_0x174985[_0x41b2('0x1c')]?_[_0x41b2('0x1b')](_0x174985['include'],function(_0xff5732){return{'model':db[_0xff5732[_0x41b2('0x1d')]],'as':_0xff5732['as'],'attributes':_0xff5732['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x36f76b){logger['info'](_0x41b2('0x13'),_0x2e982a);logger[_0x41b2('0xc')](_0x41b2('0x13'),_0x2e982a,JSON[_0x41b2('0xe')](_0x36f76b));_0x437e89(_0x36f76b);})['catch'](function(_0x3ea0d7){logger[_0x41b2('0xf')](_0x41b2('0x13'),_0x3ea0d7[_0x41b2('0x10')],_0x2e982a);_0x3c2c1f(_0x12fc34[_0x41b2('0xf')](0x1f4,_0x3ea0d7[_0x41b2('0x10')]));});});};exports[_0x41b2('0x1e')]=function(_0x22e3fe){var _0x4834a4=this;return new Promise(function(_0x3641b4,_0x4cda8c){return db['DeskAccount'][_0x41b2('0x1f')]({'raw':_0x22e3fe[_0x41b2('0x16')]?_0x22e3fe[_0x41b2('0x16')][_0x41b2('0x17')]===undefined?!![]:![]:!![],'where':_0x22e3fe['options']?_0x22e3fe[_0x41b2('0x16')]['where']||null:null,'attributes':_0x22e3fe[_0x41b2('0x16')]?_0x22e3fe[_0x41b2('0x16')]['attributes']||null:null,'include':_0x22e3fe['options']?_0x22e3fe['options']['include']?_[_0x41b2('0x1b')](_0x22e3fe[_0x41b2('0x16')]['include'],function(_0x483aa7){return{'model':db[_0x483aa7[_0x41b2('0x1d')]],'as':_0x483aa7['as'],'attributes':_0x483aa7[_0x41b2('0x19')],'include':_0x483aa7[_0x41b2('0x1c')]?_[_0x41b2('0x1b')](_0x483aa7[_0x41b2('0x1c')],function(_0x29c438){return{'model':db[_0x29c438[_0x41b2('0x1d')]],'as':_0x29c438['as'],'attributes':_0x29c438[_0x41b2('0x19')],'include':_0x29c438[_0x41b2('0x1c')]?_['map'](_0x29c438[_0x41b2('0x1c')],function(_0x3e3b29){return{'model':db[_0x3e3b29[_0x41b2('0x1d')]],'as':_0x3e3b29['as'],'attributes':_0x3e3b29[_0x41b2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x41b2('0x9')](function(_0x3d5358){logger[_0x41b2('0x20')](_0x41b2('0x1e'),_0x22e3fe);logger['debug'](_0x41b2('0x1e'),_0x22e3fe,JSON[_0x41b2('0xe')](_0x3d5358));_0x3641b4(_0x3d5358);})[_0x41b2('0x12')](function(_0x182664){logger[_0x41b2('0xf')](_0x41b2('0x1e'),_0x182664[_0x41b2('0x10')],_0x22e3fe);_0x4cda8c(_0x4834a4[_0x41b2('0xf')](0x1f4,_0x182664[_0x41b2('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 2f914a4..c3319a4 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x183fc7,_0x4cc983){var _0x3930ec=function(_0xc3e3c6){while(--_0xc3e3c6){_0x183fc7['push'](_0x183fc7['shift']());}};_0x3930ec(++_0x4cc983);}(_0x3e74,0x175));var _0x43e7=function(_0x227da2,_0x345f69){_0x227da2=_0x227da2-0x0;var _0x1e44f1=_0x3e74[_0x227da2];return _0x1e44f1;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x13cdaa,_0x4cca8f){var _0x5066ff=function(_0x51c771){while(--_0x51c771){_0x13cdaa['push'](_0x13cdaa['shift']());}};_0x5066ff(++_0x4cca8f);}(_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/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 24eae97..11f274a 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 _0x9433=['STRING','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x9433,0x123));var _0x3943=function(_0x3dcbb5,_0xcfc072){_0x3dcbb5=_0x3dcbb5-0x0;var _0x12b83e=_0x9433[_0x3dcbb5];return _0x12b83e;};'use strict';var Sequelize=require('sequelize');module[_0x3943('0x0')]={'name':{'type':Sequelize[_0x3943('0x1')]},'description':{'type':Sequelize[_0x3943('0x1')]}}; \ No newline at end of file +var _0x05ef=['STRING','sequelize','exports'];(function(_0x1387ce,_0x48ef84){var _0x5afa82=function(_0x244706){while(--_0x244706){_0x1387ce['push'](_0x1387ce['shift']());}};_0x5afa82(++_0x48ef84);}(_0x05ef,0x1c0));var _0xf05e=function(_0x6faf9a,_0x17d9e6){_0x6faf9a=_0x6faf9a-0x0;var _0x25f7cb=_0x05ef[_0x6faf9a];return _0x25f7cb;};'use strict';var Sequelize=require(_0xf05e('0x0'));module[_0xf05e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf05e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 17518af..ca087ff 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 _0xf97a=['query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','DeskConfiguration','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','model'];(function(_0x2e6d45,_0x23928e){var _0x4f3956=function(_0x477519){while(--_0x477519){_0x2e6d45['push'](_0x2e6d45['shift']());}};_0x4f3956(++_0x23928e);}(_0xf97a,0x1d9));var _0xaf97=function(_0x56d0f4,_0x3e3be8){_0x56d0f4=_0x56d0f4-0x0;var _0x2a263c=_0xf97a[_0x56d0f4];return _0x2a263c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaf97('0x0'));var jsonpatch=require(_0xaf97('0x1'));var rp=require('request-promise');var moment=require(_0xaf97('0x2'));var BPromise=require(_0xaf97('0x3'));var Mustache=require('mustache');var util=require(_0xaf97('0x4'));var path=require(_0xaf97('0x5'));var sox=require(_0xaf97('0x6'));var csv=require(_0xaf97('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf97('0x8'));var _=require(_0xaf97('0x9'));var squel=require(_0xaf97('0xa'));var crypto=require(_0xaf97('0xb'));var jsforce=require(_0xaf97('0xc'));var deskjs=require(_0xaf97('0xd'));var toCsv=require(_0xaf97('0x7'));var querystring=require(_0xaf97('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaf97('0xf'));var qs=require(_0xaf97('0x10'));var as=require(_0xaf97('0x11'));var hardwareService=require(_0xaf97('0x12'));var logger=require(_0xaf97('0x13'))(_0xaf97('0x14'));var utils=require(_0xaf97('0x15'));var config=require(_0xaf97('0x16'));var licenseUtil=require(_0xaf97('0x17'));var db=require(_0xaf97('0x18'))['db'];function respondWithStatusCode(_0x32b559,_0x2fbb89){_0x2fbb89=_0x2fbb89||0xcc;return function(_0x2a0a23){if(_0x2a0a23){return _0x32b559[_0xaf97('0x19')](_0x2fbb89);}return _0x32b559[_0xaf97('0x1a')](_0x2fbb89)[_0xaf97('0x1b')]();};}function respondWithResult(_0x8266a6,_0x255dbe){_0x255dbe=_0x255dbe||0xc8;return function(_0x4a78a4){if(_0x4a78a4){return _0x8266a6['status'](_0x255dbe)[_0xaf97('0x1c')](_0x4a78a4);}};}function respondWithFilteredResult(_0x2129a3,_0x44ae11){return function(_0x20fad5){if(_0x20fad5){var _0xbfb0aa=typeof _0x44ae11['offset']==='undefined'&&typeof _0x44ae11[_0xaf97('0x1d')]===_0xaf97('0x1e');var _0x49dfad=_0x20fad5[_0xaf97('0x1f')];var _0x18cbb8=_0xbfb0aa?0x0:_0x44ae11[_0xaf97('0x20')];var _0x57becd=_0xbfb0aa?_0x20fad5['count']:_0x44ae11[_0xaf97('0x20')]+_0x44ae11['limit'];var _0x4f50a8;if(_0x57becd>=_0x49dfad){_0x57becd=_0x49dfad;_0x4f50a8=0xc8;}else{_0x4f50a8=0xce;}_0x2129a3[_0xaf97('0x1a')](_0x4f50a8);return _0x2129a3[_0xaf97('0x21')](_0xaf97('0x22'),_0x18cbb8+'-'+_0x57becd+'/'+_0x49dfad)[_0xaf97('0x1c')](_0x20fad5);}return null;};}function patchUpdates(_0x3c0cd7){return function(_0x7bdf79){try{jsonpatch[_0xaf97('0x23')](_0x7bdf79,_0x3c0cd7,!![]);}catch(_0x214af7){return BPromise[_0xaf97('0x24')](_0x214af7);}return _0x7bdf79[_0xaf97('0x25')]();};}function saveUpdates(_0x29a4c6,_0x11593a){return function(_0x1f19ba){if(_0x1f19ba){return _0x1f19ba[_0xaf97('0x26')](_0x29a4c6)['then'](function(_0x213788){return _0x213788;});}return null;};}function removeEntity(_0x5b81ff,_0x1c6f2b){return function(_0x8e838b){if(_0x8e838b){return _0x8e838b[_0xaf97('0x27')]()[_0xaf97('0x28')](function(){_0x5b81ff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a408b,_0x4e5ab3){return function(_0x38a54e){if(!_0x38a54e){_0x3a408b[_0xaf97('0x19')](0x194);}return _0x38a54e;};}function handleError(_0x4f5381,_0x1214b9){_0x1214b9=_0x1214b9||0x1f4;return function(_0x3bb28e){logger[_0xaf97('0x29')](_0x3bb28e[_0xaf97('0x2a')]);if(_0x3bb28e['name']){delete _0x3bb28e[_0xaf97('0x2b')];}_0x4f5381[_0xaf97('0x1a')](_0x1214b9)[_0xaf97('0x2c')](_0x3bb28e);};}exports[_0xaf97('0x2d')]=function(_0x55983c,_0x434ebd){var _0x140830={},_0x4179fa={},_0x505778={'count':0x0,'rows':[]};var _0x2aff54=_['map'](db['DeskConfiguration'][_0xaf97('0x2e')],function(_0x5bbeb6){return{'name':_0x5bbeb6[_0xaf97('0x2f')],'type':_0x5bbeb6['type']['key']};});_0x4179fa[_0xaf97('0x30')]=_['map'](_0x2aff54,_0xaf97('0x2b'));_0x4179fa[_0xaf97('0x31')]=_[_0xaf97('0x32')](_0x55983c[_0xaf97('0x31')]);_0x4179fa[_0xaf97('0x33')]=_['intersection'](_0x4179fa[_0xaf97('0x30')],_0x4179fa[_0xaf97('0x31')]);_0x140830[_0xaf97('0x34')]=_[_0xaf97('0x35')](_0x4179fa[_0xaf97('0x30')],qs[_0xaf97('0x36')](_0x55983c[_0xaf97('0x31')][_0xaf97('0x36')]));_0x140830['attributes']=_0x140830[_0xaf97('0x34')]['length']?_0x140830[_0xaf97('0x34')]:_0x4179fa[_0xaf97('0x30')];if(!_0x55983c['query'][_0xaf97('0x37')](_0xaf97('0x38'))){_0x140830[_0xaf97('0x1d')]=qs[_0xaf97('0x1d')](_0x55983c[_0xaf97('0x31')][_0xaf97('0x1d')]);_0x140830[_0xaf97('0x20')]=qs[_0xaf97('0x20')](_0x55983c[_0xaf97('0x31')][_0xaf97('0x20')]);}_0x140830[_0xaf97('0x39')]=qs[_0xaf97('0x3a')](_0x55983c[_0xaf97('0x31')][_0xaf97('0x3a')]);_0x140830[_0xaf97('0x3b')]=qs[_0xaf97('0x33')](_[_0xaf97('0x3c')](_0x55983c['query'],_0x4179fa[_0xaf97('0x33')]),_0x2aff54);if(_0x55983c['query'][_0xaf97('0x3d')]){_0x140830[_0xaf97('0x3b')]=_[_0xaf97('0x3e')](_0x140830[_0xaf97('0x3b')],{'$or':_[_0xaf97('0x3f')](_0x2aff54,function(_0x15e585){if(_0x15e585[_0xaf97('0x40')]!==_0xaf97('0x41')){var _0x1af8cf={};_0x1af8cf[_0x15e585[_0xaf97('0x2b')]]={'$like':'%'+_0x55983c['query'][_0xaf97('0x3d')]+'%'};return _0x1af8cf;}})});}_0x140830=_['merge']({},_0x140830,_0x55983c['options']);var _0x5849eb={'where':_0x140830[_0xaf97('0x3b')]};return db[_0xaf97('0x42')]['count'](_0x5849eb)[_0xaf97('0x28')](function(_0x8b4cfd){_0x505778[_0xaf97('0x1f')]=_0x8b4cfd;if(_0x55983c['query'][_0xaf97('0x43')]){_0x140830[_0xaf97('0x44')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xaf97('0x45')](_0x140830);})[_0xaf97('0x28')](function(_0x459563){_0x505778[_0xaf97('0x46')]=_0x459563;return _0x505778;})[_0xaf97('0x28')](respondWithFilteredResult(_0x434ebd,_0x140830))[_0xaf97('0x47')](handleError(_0x434ebd,null));};exports['show']=function(_0x4133d6,_0x24b490){var _0x3e2a9e={'raw':![],'where':{'id':_0x4133d6[_0xaf97('0x48')]['id']}},_0x108bb7={};_0x108bb7['model']=_[_0xaf97('0x32')](db[_0xaf97('0x42')][_0xaf97('0x2e')]);_0x108bb7[_0xaf97('0x31')]=_[_0xaf97('0x32')](_0x4133d6[_0xaf97('0x31')]);_0x108bb7[_0xaf97('0x33')]=_[_0xaf97('0x35')](_0x108bb7[_0xaf97('0x30')],_0x108bb7[_0xaf97('0x31')]);_0x3e2a9e[_0xaf97('0x34')]=_[_0xaf97('0x35')](_0x108bb7[_0xaf97('0x30')],qs[_0xaf97('0x36')](_0x4133d6['query'][_0xaf97('0x36')]));_0x3e2a9e[_0xaf97('0x34')]=_0x3e2a9e[_0xaf97('0x34')][_0xaf97('0x49')]?_0x3e2a9e[_0xaf97('0x34')]:_0x108bb7['model'];if(_0x4133d6[_0xaf97('0x31')][_0xaf97('0x43')]){_0x3e2a9e['include']=[{'all':!![]}];}_0x3e2a9e=_[_0xaf97('0x3e')]({},_0x3e2a9e,_0x4133d6[_0xaf97('0x4a')]);return db[_0xaf97('0x42')][_0xaf97('0x4b')](_0x3e2a9e)[_0xaf97('0x28')](handleEntityNotFound(_0x24b490,null))['then'](respondWithResult(_0x24b490,null))[_0xaf97('0x47')](handleError(_0x24b490,null));};exports[_0xaf97('0x4c')]=function(_0x23ead9,_0x12bb5c){return db['DeskConfiguration'][_0xaf97('0x4c')](_0x23ead9[_0xaf97('0x4d')],{})['then'](respondWithResult(_0x12bb5c,0xc9))[_0xaf97('0x47')](handleError(_0x12bb5c,null));};exports['update']=function(_0x51e4c2,_0x2c8bd0){if(_0x51e4c2[_0xaf97('0x4d')]['id']){delete _0x51e4c2['body']['id'];}return db[_0xaf97('0x42')]['find']({'where':{'id':_0x51e4c2[_0xaf97('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c8bd0,null))[_0xaf97('0x28')](saveUpdates(_0x51e4c2[_0xaf97('0x4d')],null))[_0xaf97('0x28')](respondWithResult(_0x2c8bd0,null))['catch'](handleError(_0x2c8bd0,null));};exports['destroy']=function(_0x49ff7a,_0x29f4a0){return db[_0xaf97('0x42')][_0xaf97('0x4b')]({'where':{'id':_0x49ff7a[_0xaf97('0x48')]['id']}})['then'](handleEntityNotFound(_0x29f4a0,null))[_0xaf97('0x28')](removeEntity(_0x29f4a0,null))['catch'](handleError(_0x29f4a0,null));};exports[_0xaf97('0x4e')]=function(_0x1bca1f,_0x425e45,_0x331820){var _0x337ba4={};var _0x5b6c64={};var _0x5a8cbb;var _0x599a95;return db[_0xaf97('0x42')][_0xaf97('0x4f')]({'where':{'id':_0x1bca1f[_0xaf97('0x48')]['id']}})[_0xaf97('0x28')](handleEntityNotFound(_0x425e45,null))[_0xaf97('0x28')](function(_0x14c913){if(_0x14c913){_0x5a8cbb=_0x14c913;_0x5b6c64[_0xaf97('0x30')]=_[_0xaf97('0x32')](db[_0xaf97('0x50')]['rawAttributes']);_0x5b6c64['query']=_[_0xaf97('0x32')](_0x1bca1f[_0xaf97('0x31')]);_0x5b6c64[_0xaf97('0x33')]=_[_0xaf97('0x35')](_0x5b6c64['model'],_0x5b6c64[_0xaf97('0x31')]);_0x337ba4[_0xaf97('0x34')]=_[_0xaf97('0x35')](_0x5b6c64[_0xaf97('0x30')],qs['fields'](_0x1bca1f[_0xaf97('0x31')][_0xaf97('0x36')]));_0x337ba4['attributes']=_0x337ba4[_0xaf97('0x34')]['length']?_0x337ba4[_0xaf97('0x34')]:_0x5b6c64[_0xaf97('0x30')];_0x337ba4[_0xaf97('0x39')]=qs['sort'](_0x1bca1f[_0xaf97('0x31')][_0xaf97('0x3a')]);_0x337ba4[_0xaf97('0x3b')]=qs[_0xaf97('0x33')](_[_0xaf97('0x3c')](_0x1bca1f[_0xaf97('0x31')],_0x5b6c64[_0xaf97('0x33')]));if(_0x1bca1f['query']['filter']){_0x337ba4[_0xaf97('0x3b')]=_[_0xaf97('0x3e')](_0x337ba4[_0xaf97('0x3b')],{'$or':_[_0xaf97('0x3f')](_0x337ba4[_0xaf97('0x34')],function(_0x495b46){var _0x4c1ef6={};_0x4c1ef6[_0x495b46]={'$like':'%'+_0x1bca1f[_0xaf97('0x31')][_0xaf97('0x3d')]+'%'};return _0x4c1ef6;})});}_0x337ba4=_[_0xaf97('0x3e')]({},_0x337ba4,_0x1bca1f[_0xaf97('0x4a')]);return _0x5a8cbb['getFields'](_0x337ba4);}})[_0xaf97('0x28')](function(_0x389444){if(_0x389444){_0x599a95=_0x389444['length'];if(!_0x1bca1f[_0xaf97('0x31')]['hasOwnProperty'](_0xaf97('0x38'))){_0x337ba4[_0xaf97('0x1d')]=qs[_0xaf97('0x1d')](_0x1bca1f['query']['limit']);_0x337ba4[_0xaf97('0x20')]=qs[_0xaf97('0x20')](_0x1bca1f[_0xaf97('0x31')][_0xaf97('0x20')]);}return _0x5a8cbb[_0xaf97('0x4e')](_0x337ba4);}})[_0xaf97('0x28')](function(_0x565fa3){if(_0x565fa3){return _0x565fa3?{'count':_0x599a95,'rows':_0x565fa3}:null;}})[_0xaf97('0x28')](respondWithResult(_0x425e45,null))[_0xaf97('0x47')](handleError(_0x425e45,null));};exports[_0xaf97('0x51')]=function(_0x73eaab,_0x5c97e5,_0x98d9f8){var _0x340efb={};var _0x13d321={};var _0xf9fc26;var _0x46c2c0;return db[_0xaf97('0x42')][_0xaf97('0x4f')]({'where':{'id':_0x73eaab[_0xaf97('0x48')]['id']}})[_0xaf97('0x28')](handleEntityNotFound(_0x5c97e5,null))['then'](function(_0x5b6d4d){if(_0x5b6d4d){_0xf9fc26=_0x5b6d4d;_0x13d321[_0xaf97('0x30')]=_[_0xaf97('0x32')](db['DeskField'][_0xaf97('0x2e')]);_0x13d321[_0xaf97('0x31')]=_[_0xaf97('0x32')](_0x73eaab['query']);_0x13d321[_0xaf97('0x33')]=_[_0xaf97('0x35')](_0x13d321[_0xaf97('0x30')],_0x13d321[_0xaf97('0x31')]);_0x340efb[_0xaf97('0x34')]=_[_0xaf97('0x35')](_0x13d321['model'],qs['fields'](_0x73eaab[_0xaf97('0x31')][_0xaf97('0x36')]));_0x340efb['attributes']=_0x340efb[_0xaf97('0x34')]['length']?_0x340efb['attributes']:_0x13d321['model'];_0x340efb['order']=qs[_0xaf97('0x3a')](_0x73eaab['query'][_0xaf97('0x3a')]);_0x340efb[_0xaf97('0x3b')]=qs[_0xaf97('0x33')](_[_0xaf97('0x3c')](_0x73eaab[_0xaf97('0x31')],_0x13d321[_0xaf97('0x33')]));if(_0x73eaab[_0xaf97('0x31')][_0xaf97('0x3d')]){_0x340efb[_0xaf97('0x3b')]=_[_0xaf97('0x3e')](_0x340efb[_0xaf97('0x3b')],{'$or':_[_0xaf97('0x3f')](_0x340efb[_0xaf97('0x34')],function(_0x50b060){var _0x28dbfc={};_0x28dbfc[_0x50b060]={'$like':'%'+_0x73eaab[_0xaf97('0x31')][_0xaf97('0x3d')]+'%'};return _0x28dbfc;})});}_0x340efb=_[_0xaf97('0x3e')]({},_0x340efb,_0x73eaab[_0xaf97('0x4a')]);return _0xf9fc26[_0xaf97('0x51')](_0x340efb);}})[_0xaf97('0x28')](function(_0x26c356){if(_0x26c356){_0x46c2c0=_0x26c356['length'];if(!_0x73eaab[_0xaf97('0x31')][_0xaf97('0x37')](_0xaf97('0x38'))){_0x340efb[_0xaf97('0x1d')]=qs[_0xaf97('0x1d')](_0x73eaab[_0xaf97('0x31')]['limit']);_0x340efb[_0xaf97('0x20')]=qs[_0xaf97('0x20')](_0x73eaab['query'][_0xaf97('0x20')]);}return _0xf9fc26['getSubjects'](_0x340efb);}})[_0xaf97('0x28')](function(_0x456316){if(_0x456316){return _0x456316?{'count':_0x46c2c0,'rows':_0x456316}:null;}})[_0xaf97('0x28')](respondWithResult(_0x5c97e5,null))[_0xaf97('0x47')](handleError(_0x5c97e5,null));};exports[_0xaf97('0x52')]=function(_0x94894c,_0x5e461b,_0x39035d){var _0x2ab607={};var _0x528559={};var _0x275320;var _0x49ff8a;return db['DeskConfiguration'][_0xaf97('0x4f')]({'where':{'id':_0x94894c[_0xaf97('0x48')]['id']}})[_0xaf97('0x28')](handleEntityNotFound(_0x5e461b,null))[_0xaf97('0x28')](function(_0x49dd2f){if(_0x49dd2f){_0x275320=_0x49dd2f;_0x528559['model']=_[_0xaf97('0x32')](db['DeskField']['rawAttributes']);_0x528559['query']=_[_0xaf97('0x32')](_0x94894c[_0xaf97('0x31')]);_0x528559['filters']=_['intersection'](_0x528559[_0xaf97('0x30')],_0x528559[_0xaf97('0x31')]);_0x2ab607[_0xaf97('0x34')]=_[_0xaf97('0x35')](_0x528559[_0xaf97('0x30')],qs[_0xaf97('0x36')](_0x94894c[_0xaf97('0x31')][_0xaf97('0x36')]));_0x2ab607['attributes']=_0x2ab607[_0xaf97('0x34')][_0xaf97('0x49')]?_0x2ab607[_0xaf97('0x34')]:_0x528559[_0xaf97('0x30')];_0x2ab607[_0xaf97('0x39')]=qs[_0xaf97('0x3a')](_0x94894c['query'][_0xaf97('0x3a')]);_0x2ab607['where']=qs[_0xaf97('0x33')](_['pick'](_0x94894c[_0xaf97('0x31')],_0x528559[_0xaf97('0x33')]));if(_0x94894c[_0xaf97('0x31')][_0xaf97('0x3d')]){_0x2ab607[_0xaf97('0x3b')]=_[_0xaf97('0x3e')](_0x2ab607[_0xaf97('0x3b')],{'$or':_[_0xaf97('0x3f')](_0x2ab607[_0xaf97('0x34')],function(_0x2b8b17){var _0x44a624={};_0x44a624[_0x2b8b17]={'$like':'%'+_0x94894c[_0xaf97('0x31')][_0xaf97('0x3d')]+'%'};return _0x44a624;})});}_0x2ab607=_[_0xaf97('0x3e')]({},_0x2ab607,_0x94894c[_0xaf97('0x4a')]);return _0x275320[_0xaf97('0x52')](_0x2ab607);}})[_0xaf97('0x28')](function(_0x1bd6fc){if(_0x1bd6fc){_0x49ff8a=_0x1bd6fc[_0xaf97('0x49')];if(!_0x94894c['query'][_0xaf97('0x37')](_0xaf97('0x38'))){_0x2ab607['limit']=qs[_0xaf97('0x1d')](_0x94894c['query'][_0xaf97('0x1d')]);_0x2ab607['offset']=qs['offset'](_0x94894c[_0xaf97('0x31')][_0xaf97('0x20')]);}return _0x275320[_0xaf97('0x52')](_0x2ab607);}})[_0xaf97('0x28')](function(_0x4d0e39){if(_0x4d0e39){return _0x4d0e39?{'count':_0x49ff8a,'rows':_0x4d0e39}:null;}})['then'](respondWithResult(_0x5e461b,null))[_0xaf97('0x47')](handleError(_0x5e461b,null));};exports[_0xaf97('0x53')]=function(_0x17cd67,_0x3ec565,_0x3fe700){var _0x315e63={};var _0x48e1ba={};var _0x9ca0ee;var _0x18da98;return db[_0xaf97('0x42')]['findOne']({'where':{'id':_0x17cd67[_0xaf97('0x48')]['id']}})[_0xaf97('0x28')](handleEntityNotFound(_0x3ec565,null))[_0xaf97('0x28')](function(_0x4b0cc1){if(_0x4b0cc1){_0x9ca0ee=_0x4b0cc1;_0x48e1ba['model']=_[_0xaf97('0x32')](db[_0xaf97('0x54')]['rawAttributes']);_0x48e1ba[_0xaf97('0x31')]=_['keys'](_0x17cd67[_0xaf97('0x31')]);_0x48e1ba[_0xaf97('0x33')]=_['intersection'](_0x48e1ba[_0xaf97('0x30')],_0x48e1ba[_0xaf97('0x31')]);_0x315e63[_0xaf97('0x34')]=_[_0xaf97('0x35')](_0x48e1ba['model'],qs[_0xaf97('0x36')](_0x17cd67[_0xaf97('0x31')][_0xaf97('0x36')]));_0x315e63[_0xaf97('0x34')]=_0x315e63[_0xaf97('0x34')][_0xaf97('0x49')]?_0x315e63[_0xaf97('0x34')]:_0x48e1ba[_0xaf97('0x30')];_0x315e63[_0xaf97('0x39')]=qs[_0xaf97('0x3a')](_0x17cd67[_0xaf97('0x31')][_0xaf97('0x3a')]);_0x315e63[_0xaf97('0x3b')]=qs[_0xaf97('0x33')](_['pick'](_0x17cd67['query'],_0x48e1ba[_0xaf97('0x33')]));if(_0x17cd67[_0xaf97('0x31')][_0xaf97('0x3d')]){_0x315e63[_0xaf97('0x3b')]=_[_0xaf97('0x3e')](_0x315e63[_0xaf97('0x3b')],{'$or':_[_0xaf97('0x3f')](_0x315e63['attributes'],function(_0x1f747e){var _0xbbea8b={};_0xbbea8b[_0x1f747e]={'$like':'%'+_0x17cd67[_0xaf97('0x31')][_0xaf97('0x3d')]+'%'};return _0xbbea8b;})});}_0x315e63=_[_0xaf97('0x3e')]({},_0x315e63,_0x17cd67[_0xaf97('0x4a')]);return _0x9ca0ee[_0xaf97('0x53')](_0x315e63);}})[_0xaf97('0x28')](function(_0x14a78a){if(_0x14a78a){_0x18da98=_0x14a78a[_0xaf97('0x49')];if(!_0x17cd67[_0xaf97('0x31')][_0xaf97('0x37')](_0xaf97('0x38'))){_0x315e63[_0xaf97('0x1d')]=qs[_0xaf97('0x1d')](_0x17cd67[_0xaf97('0x31')][_0xaf97('0x1d')]);_0x315e63['offset']=qs['offset'](_0x17cd67[_0xaf97('0x31')][_0xaf97('0x20')]);}return _0x9ca0ee['getTags'](_0x315e63);}})[_0xaf97('0x28')](function(_0x8c83c9){if(_0x8c83c9){return _0x8c83c9?{'count':_0x18da98,'rows':_0x8c83c9}:null;}})['then'](respondWithResult(_0x3ec565,null))[_0xaf97('0x47')](handleError(_0x3ec565,null));};exports[_0xaf97('0x55')]=function(_0x5cc96d,_0x54485b,_0x565129){if(_0x5cc96d[_0xaf97('0x4d')]['id']){delete _0x5cc96d[_0xaf97('0x4d')]['id'];}return db[_0xaf97('0x42')]['findOne']({'where':{'id':_0x5cc96d[_0xaf97('0x48')]['id']}})[_0xaf97('0x28')](handleEntityNotFound(_0x54485b,null))[_0xaf97('0x28')](function(_0x26953b){if(_0x26953b){return _0x26953b[_0xaf97('0x55')](_0x5cc96d[_0xaf97('0x4d')][_0xaf97('0x56')]||[]);}return null;})[_0xaf97('0x28')](respondWithResult(_0x54485b,null))[_0xaf97('0x47')](handleError(_0x54485b,null));}; \ No newline at end of file +var _0xaba4=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','length','create','body','find','destroy','params','catch','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','apply','reject','save','then','sendStatus','error','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x306863,_0x26f3cf){var _0x20161e=function(_0x3af666){while(--_0x3af666){_0x306863['push'](_0x306863['shift']());}};_0x20161e(++_0x26f3cf);}(_0xaba4,0x105));var _0x4aba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaba4[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x4aba('0x0'));var rimraf=require(_0x4aba('0x1'));var zipdir=require(_0x4aba('0x2'));var jsonpatch=require(_0x4aba('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4aba('0x4'));var Mustache=require(_0x4aba('0x5'));var util=require(_0x4aba('0x6'));var path=require(_0x4aba('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4aba('0x8'));var fs=require('fs');var fs_extra=require(_0x4aba('0x9'));var _=require('lodash');var squel=require(_0x4aba('0xa'));var crypto=require(_0x4aba('0xb'));var jsforce=require(_0x4aba('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4aba('0xd'));var querystring=require(_0x4aba('0xe'));var Papa=require(_0x4aba('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4aba('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4aba('0x11'));var logger=require(_0x4aba('0x12'))('api');var utils=require(_0x4aba('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4aba('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e72b1,_0xb120ea){_0xb120ea=_0xb120ea||0xcc;return function(_0x24198e){if(_0x24198e){return _0x4e72b1['sendStatus'](_0xb120ea);}return _0x4e72b1[_0x4aba('0x15')](_0xb120ea)[_0x4aba('0x16')]();};}function respondWithResult(_0x3eb58b,_0x26cfd2){_0x26cfd2=_0x26cfd2||0xc8;return function(_0x1f952){if(_0x1f952){return _0x3eb58b[_0x4aba('0x15')](_0x26cfd2)['json'](_0x1f952);}};}function respondWithFilteredResult(_0x2ebce5,_0x4ace80){return function(_0x5064ca){if(_0x5064ca){var _0x55e0c2=typeof _0x4ace80[_0x4aba('0x17')]===_0x4aba('0x18')&&typeof _0x4ace80[_0x4aba('0x19')]==='undefined';var _0x29b4a7=_0x5064ca[_0x4aba('0x1a')];var _0x53aa35=_0x55e0c2?0x0:_0x4ace80[_0x4aba('0x17')];var _0x2c3b12=_0x55e0c2?_0x5064ca[_0x4aba('0x1a')]:_0x4ace80[_0x4aba('0x17')]+_0x4ace80['limit'];var _0x2cf50;if(_0x2c3b12>=_0x29b4a7){_0x2c3b12=_0x29b4a7;_0x2cf50=0xc8;}else{_0x2cf50=0xce;}_0x2ebce5['status'](_0x2cf50);return _0x2ebce5['set']('Content-Range',_0x53aa35+'-'+_0x2c3b12+'/'+_0x29b4a7)['json'](_0x5064ca);}return null;};}function patchUpdates(_0x36ec4c){return function(_0x125587){try{jsonpatch[_0x4aba('0x1b')](_0x125587,_0x36ec4c,!![]);}catch(_0x5d70ba){return BPromise[_0x4aba('0x1c')](_0x5d70ba);}return _0x125587[_0x4aba('0x1d')]();};}function saveUpdates(_0x41731a,_0x1ebc06){return function(_0x5c07f1){if(_0x5c07f1){return _0x5c07f1['update'](_0x41731a)[_0x4aba('0x1e')](function(_0x2d7f6d){return _0x2d7f6d;});}return null;};}function removeEntity(_0x1fbd11,_0x122ce2){return function(_0x120f82){if(_0x120f82){return _0x120f82['destroy']()['then'](function(){_0x1fbd11[_0x4aba('0x15')](0xcc)[_0x4aba('0x16')]();});}};}function handleEntityNotFound(_0x30ba99,_0x1dfa70){return function(_0x3f3394){if(!_0x3f3394){_0x30ba99[_0x4aba('0x1f')](0x194);}return _0x3f3394;};}function handleError(_0x3fd720,_0x1be57b){_0x1be57b=_0x1be57b||0x1f4;return function(_0x5200b7){logger[_0x4aba('0x20')](_0x5200b7[_0x4aba('0x21')]);if(_0x5200b7[_0x4aba('0x22')]){delete _0x5200b7[_0x4aba('0x22')];}_0x3fd720['status'](_0x1be57b)[_0x4aba('0x23')](_0x5200b7);};}exports[_0x4aba('0x24')]=function(_0x13e413,_0x48277d){var _0x471fda={},_0x183e90={},_0x557a9a={'count':0x0,'rows':[]};var _0x52e75e=_['map'](db[_0x4aba('0x25')][_0x4aba('0x26')],function(_0x437190){return{'name':_0x437190[_0x4aba('0x27')],'type':_0x437190[_0x4aba('0x28')][_0x4aba('0x29')]};});_0x183e90[_0x4aba('0x2a')]=_[_0x4aba('0x2b')](_0x52e75e,_0x4aba('0x22'));_0x183e90[_0x4aba('0x2c')]=_[_0x4aba('0x2d')](_0x13e413[_0x4aba('0x2c')]);_0x183e90[_0x4aba('0x2e')]=_[_0x4aba('0x2f')](_0x183e90['model'],_0x183e90['query']);_0x471fda[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x183e90['model'],qs[_0x4aba('0x31')](_0x13e413[_0x4aba('0x2c')][_0x4aba('0x31')]));_0x471fda['attributes']=_0x471fda[_0x4aba('0x30')]['length']?_0x471fda[_0x4aba('0x30')]:_0x183e90[_0x4aba('0x2a')];if(!_0x13e413['query'][_0x4aba('0x32')](_0x4aba('0x33'))){_0x471fda[_0x4aba('0x19')]=qs[_0x4aba('0x19')](_0x13e413[_0x4aba('0x2c')]['limit']);_0x471fda[_0x4aba('0x17')]=qs[_0x4aba('0x17')](_0x13e413[_0x4aba('0x2c')][_0x4aba('0x17')]);}_0x471fda[_0x4aba('0x34')]=qs[_0x4aba('0x35')](_0x13e413[_0x4aba('0x2c')]['sort']);_0x471fda[_0x4aba('0x36')]=qs[_0x4aba('0x2e')](_[_0x4aba('0x37')](_0x13e413[_0x4aba('0x2c')],_0x183e90[_0x4aba('0x2e')]),_0x52e75e);if(_0x13e413[_0x4aba('0x2c')][_0x4aba('0x38')]){_0x471fda[_0x4aba('0x36')]=_[_0x4aba('0x39')](_0x471fda[_0x4aba('0x36')],{'$or':_[_0x4aba('0x2b')](_0x52e75e,function(_0x21873c){if(_0x21873c[_0x4aba('0x28')]!==_0x4aba('0x3a')){var _0x23ca20={};_0x23ca20[_0x21873c[_0x4aba('0x22')]]={'$like':'%'+_0x13e413[_0x4aba('0x2c')][_0x4aba('0x38')]+'%'};return _0x23ca20;}})});}_0x471fda=_['merge']({},_0x471fda,_0x13e413[_0x4aba('0x3b')]);var _0x3d5f4b={'where':_0x471fda['where']};return db[_0x4aba('0x25')][_0x4aba('0x1a')](_0x3d5f4b)[_0x4aba('0x1e')](function(_0x1c1de5){_0x557a9a['count']=_0x1c1de5;if(_0x13e413[_0x4aba('0x2c')][_0x4aba('0x3c')]){_0x471fda[_0x4aba('0x3d')]=[{'all':!![]}];}return db[_0x4aba('0x25')][_0x4aba('0x3e')](_0x471fda);})[_0x4aba('0x1e')](function(_0x30a02d){_0x557a9a[_0x4aba('0x3f')]=_0x30a02d;return _0x557a9a;})[_0x4aba('0x1e')](respondWithFilteredResult(_0x48277d,_0x471fda))['catch'](handleError(_0x48277d,null));};exports['show']=function(_0x45c450,_0x283328){var _0x5e1fb7={'raw':![],'where':{'id':_0x45c450['params']['id']}},_0x773de2={};_0x773de2[_0x4aba('0x2a')]=_['keys'](db[_0x4aba('0x25')]['rawAttributes']);_0x773de2[_0x4aba('0x2c')]=_[_0x4aba('0x2d')](_0x45c450[_0x4aba('0x2c')]);_0x773de2[_0x4aba('0x2e')]=_[_0x4aba('0x2f')](_0x773de2[_0x4aba('0x2a')],_0x773de2[_0x4aba('0x2c')]);_0x5e1fb7[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x773de2[_0x4aba('0x2a')],qs['fields'](_0x45c450['query']['fields']));_0x5e1fb7[_0x4aba('0x30')]=_0x5e1fb7[_0x4aba('0x30')][_0x4aba('0x40')]?_0x5e1fb7['attributes']:_0x773de2[_0x4aba('0x2a')];if(_0x45c450[_0x4aba('0x2c')][_0x4aba('0x3c')]){_0x5e1fb7['include']=[{'all':!![]}];}_0x5e1fb7=_[_0x4aba('0x39')]({},_0x5e1fb7,_0x45c450[_0x4aba('0x3b')]);return db[_0x4aba('0x25')]['find'](_0x5e1fb7)[_0x4aba('0x1e')](handleEntityNotFound(_0x283328,null))[_0x4aba('0x1e')](respondWithResult(_0x283328,null))['catch'](handleError(_0x283328,null));};exports[_0x4aba('0x41')]=function(_0x4f6d9d,_0x48d82e){return db[_0x4aba('0x25')][_0x4aba('0x41')](_0x4f6d9d[_0x4aba('0x42')],{})[_0x4aba('0x1e')](respondWithResult(_0x48d82e,0xc9))['catch'](handleError(_0x48d82e,null));};exports['update']=function(_0x2dd886,_0x32b60d){if(_0x2dd886['body']['id']){delete _0x2dd886['body']['id'];}return db[_0x4aba('0x25')][_0x4aba('0x43')]({'where':{'id':_0x2dd886['params']['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x32b60d,null))['then'](saveUpdates(_0x2dd886['body'],null))[_0x4aba('0x1e')](respondWithResult(_0x32b60d,null))['catch'](handleError(_0x32b60d,null));};exports[_0x4aba('0x44')]=function(_0x3a7b4e,_0x201c9b){return db[_0x4aba('0x25')]['find']({'where':{'id':_0x3a7b4e[_0x4aba('0x45')]['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x201c9b,null))[_0x4aba('0x1e')](removeEntity(_0x201c9b,null))[_0x4aba('0x46')](handleError(_0x201c9b,null));};exports[_0x4aba('0x47')]=function(_0x28d851,_0x1c37d9,_0x35c340){var _0x297e86={};var _0x3e0921={};var _0x8bb9f6;var _0x2b36f4;return db[_0x4aba('0x25')][_0x4aba('0x48')]({'where':{'id':_0x28d851[_0x4aba('0x45')]['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x1c37d9,null))[_0x4aba('0x1e')](function(_0x195c5a){if(_0x195c5a){_0x8bb9f6=_0x195c5a;_0x3e0921[_0x4aba('0x2a')]=_['keys'](db[_0x4aba('0x49')][_0x4aba('0x26')]);_0x3e0921[_0x4aba('0x2c')]=_[_0x4aba('0x2d')](_0x28d851[_0x4aba('0x2c')]);_0x3e0921['filters']=_[_0x4aba('0x2f')](_0x3e0921[_0x4aba('0x2a')],_0x3e0921['query']);_0x297e86[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x3e0921[_0x4aba('0x2a')],qs[_0x4aba('0x31')](_0x28d851[_0x4aba('0x2c')]['fields']));_0x297e86[_0x4aba('0x30')]=_0x297e86[_0x4aba('0x30')][_0x4aba('0x40')]?_0x297e86[_0x4aba('0x30')]:_0x3e0921[_0x4aba('0x2a')];_0x297e86[_0x4aba('0x34')]=qs[_0x4aba('0x35')](_0x28d851[_0x4aba('0x2c')][_0x4aba('0x35')]);_0x297e86[_0x4aba('0x36')]=qs['filters'](_[_0x4aba('0x37')](_0x28d851['query'],_0x3e0921[_0x4aba('0x2e')]));if(_0x28d851['query'][_0x4aba('0x38')]){_0x297e86[_0x4aba('0x36')]=_[_0x4aba('0x39')](_0x297e86['where'],{'$or':_[_0x4aba('0x2b')](_0x297e86[_0x4aba('0x30')],function(_0x1c0504){var _0x188bd5={};_0x188bd5[_0x1c0504]={'$like':'%'+_0x28d851[_0x4aba('0x2c')][_0x4aba('0x38')]+'%'};return _0x188bd5;})});}_0x297e86=_[_0x4aba('0x39')]({},_0x297e86,_0x28d851[_0x4aba('0x3b')]);return _0x8bb9f6[_0x4aba('0x47')](_0x297e86);}})[_0x4aba('0x1e')](function(_0x441deb){if(_0x441deb){_0x2b36f4=_0x441deb[_0x4aba('0x40')];if(!_0x28d851[_0x4aba('0x2c')][_0x4aba('0x32')](_0x4aba('0x33'))){_0x297e86['limit']=qs[_0x4aba('0x19')](_0x28d851[_0x4aba('0x2c')][_0x4aba('0x19')]);_0x297e86[_0x4aba('0x17')]=qs[_0x4aba('0x17')](_0x28d851[_0x4aba('0x2c')][_0x4aba('0x17')]);}return _0x8bb9f6['getFields'](_0x297e86);}})['then'](function(_0x241d53){if(_0x241d53){return _0x241d53?{'count':_0x2b36f4,'rows':_0x241d53}:null;}})[_0x4aba('0x1e')](respondWithResult(_0x1c37d9,null))[_0x4aba('0x46')](handleError(_0x1c37d9,null));};exports[_0x4aba('0x4a')]=function(_0x52fa7b,_0x1a306c,_0xcaa8a){var _0x2218d1={};var _0x3c4e72={};var _0x26a8fb;var _0x6d9775;return db['DeskConfiguration'][_0x4aba('0x48')]({'where':{'id':_0x52fa7b[_0x4aba('0x45')]['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x1a306c,null))[_0x4aba('0x1e')](function(_0x2f3ea9){if(_0x2f3ea9){_0x26a8fb=_0x2f3ea9;_0x3c4e72[_0x4aba('0x2a')]=_[_0x4aba('0x2d')](db['DeskField']['rawAttributes']);_0x3c4e72[_0x4aba('0x2c')]=_[_0x4aba('0x2d')](_0x52fa7b[_0x4aba('0x2c')]);_0x3c4e72['filters']=_[_0x4aba('0x2f')](_0x3c4e72[_0x4aba('0x2a')],_0x3c4e72[_0x4aba('0x2c')]);_0x2218d1[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x3c4e72[_0x4aba('0x2a')],qs['fields'](_0x52fa7b['query'][_0x4aba('0x31')]));_0x2218d1[_0x4aba('0x30')]=_0x2218d1['attributes'][_0x4aba('0x40')]?_0x2218d1[_0x4aba('0x30')]:_0x3c4e72[_0x4aba('0x2a')];_0x2218d1[_0x4aba('0x34')]=qs[_0x4aba('0x35')](_0x52fa7b[_0x4aba('0x2c')]['sort']);_0x2218d1[_0x4aba('0x36')]=qs['filters'](_[_0x4aba('0x37')](_0x52fa7b[_0x4aba('0x2c')],_0x3c4e72[_0x4aba('0x2e')]));if(_0x52fa7b[_0x4aba('0x2c')]['filter']){_0x2218d1['where']=_[_0x4aba('0x39')](_0x2218d1[_0x4aba('0x36')],{'$or':_['map'](_0x2218d1[_0x4aba('0x30')],function(_0x1ee4eb){var _0x2cb485={};_0x2cb485[_0x1ee4eb]={'$like':'%'+_0x52fa7b['query'][_0x4aba('0x38')]+'%'};return _0x2cb485;})});}_0x2218d1=_[_0x4aba('0x39')]({},_0x2218d1,_0x52fa7b['options']);return _0x26a8fb[_0x4aba('0x4a')](_0x2218d1);}})[_0x4aba('0x1e')](function(_0x104ee8){if(_0x104ee8){_0x6d9775=_0x104ee8['length'];if(!_0x52fa7b[_0x4aba('0x2c')][_0x4aba('0x32')](_0x4aba('0x33'))){_0x2218d1[_0x4aba('0x19')]=qs[_0x4aba('0x19')](_0x52fa7b[_0x4aba('0x2c')][_0x4aba('0x19')]);_0x2218d1['offset']=qs[_0x4aba('0x17')](_0x52fa7b[_0x4aba('0x2c')][_0x4aba('0x17')]);}return _0x26a8fb[_0x4aba('0x4a')](_0x2218d1);}})[_0x4aba('0x1e')](function(_0x4c9453){if(_0x4c9453){return _0x4c9453?{'count':_0x6d9775,'rows':_0x4c9453}:null;}})[_0x4aba('0x1e')](respondWithResult(_0x1a306c,null))['catch'](handleError(_0x1a306c,null));};exports[_0x4aba('0x4b')]=function(_0x3103f0,_0x5f52f9,_0x1bf6d6){var _0x2ee611={};var _0x3e0022={};var _0x1bd70e;var _0x4840b6;return db[_0x4aba('0x25')][_0x4aba('0x48')]({'where':{'id':_0x3103f0['params']['id']}})['then'](handleEntityNotFound(_0x5f52f9,null))[_0x4aba('0x1e')](function(_0x1e489){if(_0x1e489){_0x1bd70e=_0x1e489;_0x3e0022[_0x4aba('0x2a')]=_['keys'](db['DeskField'][_0x4aba('0x26')]);_0x3e0022[_0x4aba('0x2c')]=_['keys'](_0x3103f0['query']);_0x3e0022[_0x4aba('0x2e')]=_[_0x4aba('0x2f')](_0x3e0022[_0x4aba('0x2a')],_0x3e0022[_0x4aba('0x2c')]);_0x2ee611[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x3e0022['model'],qs[_0x4aba('0x31')](_0x3103f0[_0x4aba('0x2c')][_0x4aba('0x31')]));_0x2ee611['attributes']=_0x2ee611[_0x4aba('0x30')][_0x4aba('0x40')]?_0x2ee611['attributes']:_0x3e0022['model'];_0x2ee611[_0x4aba('0x34')]=qs[_0x4aba('0x35')](_0x3103f0[_0x4aba('0x2c')]['sort']);_0x2ee611[_0x4aba('0x36')]=qs[_0x4aba('0x2e')](_['pick'](_0x3103f0[_0x4aba('0x2c')],_0x3e0022[_0x4aba('0x2e')]));if(_0x3103f0['query'][_0x4aba('0x38')]){_0x2ee611[_0x4aba('0x36')]=_[_0x4aba('0x39')](_0x2ee611['where'],{'$or':_[_0x4aba('0x2b')](_0x2ee611['attributes'],function(_0x31e5f4){var _0x3a22ad={};_0x3a22ad[_0x31e5f4]={'$like':'%'+_0x3103f0[_0x4aba('0x2c')][_0x4aba('0x38')]+'%'};return _0x3a22ad;})});}_0x2ee611=_[_0x4aba('0x39')]({},_0x2ee611,_0x3103f0[_0x4aba('0x3b')]);return _0x1bd70e[_0x4aba('0x4b')](_0x2ee611);}})[_0x4aba('0x1e')](function(_0x121d9b){if(_0x121d9b){_0x4840b6=_0x121d9b[_0x4aba('0x40')];if(!_0x3103f0['query'][_0x4aba('0x32')]('nolimit')){_0x2ee611['limit']=qs[_0x4aba('0x19')](_0x3103f0[_0x4aba('0x2c')][_0x4aba('0x19')]);_0x2ee611[_0x4aba('0x17')]=qs[_0x4aba('0x17')](_0x3103f0['query'][_0x4aba('0x17')]);}return _0x1bd70e['getDescriptions'](_0x2ee611);}})[_0x4aba('0x1e')](function(_0x3da9f7){if(_0x3da9f7){return _0x3da9f7?{'count':_0x4840b6,'rows':_0x3da9f7}:null;}})[_0x4aba('0x1e')](respondWithResult(_0x5f52f9,null))[_0x4aba('0x46')](handleError(_0x5f52f9,null));};exports[_0x4aba('0x4c')]=function(_0x337839,_0x525445,_0x3964d8){var _0x2a206c={};var _0x214a52={};var _0x3eb692;var _0x25a129;return db['DeskConfiguration'][_0x4aba('0x48')]({'where':{'id':_0x337839[_0x4aba('0x45')]['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x525445,null))['then'](function(_0x3010e0){if(_0x3010e0){_0x3eb692=_0x3010e0;_0x214a52[_0x4aba('0x2a')]=_['keys'](db['Tag'][_0x4aba('0x26')]);_0x214a52[_0x4aba('0x2c')]=_[_0x4aba('0x2d')](_0x337839['query']);_0x214a52[_0x4aba('0x2e')]=_[_0x4aba('0x2f')](_0x214a52[_0x4aba('0x2a')],_0x214a52[_0x4aba('0x2c')]);_0x2a206c[_0x4aba('0x30')]=_[_0x4aba('0x2f')](_0x214a52[_0x4aba('0x2a')],qs[_0x4aba('0x31')](_0x337839[_0x4aba('0x2c')][_0x4aba('0x31')]));_0x2a206c[_0x4aba('0x30')]=_0x2a206c[_0x4aba('0x30')][_0x4aba('0x40')]?_0x2a206c['attributes']:_0x214a52[_0x4aba('0x2a')];_0x2a206c[_0x4aba('0x34')]=qs[_0x4aba('0x35')](_0x337839['query'][_0x4aba('0x35')]);_0x2a206c['where']=qs[_0x4aba('0x2e')](_[_0x4aba('0x37')](_0x337839[_0x4aba('0x2c')],_0x214a52['filters']));if(_0x337839[_0x4aba('0x2c')][_0x4aba('0x38')]){_0x2a206c[_0x4aba('0x36')]=_[_0x4aba('0x39')](_0x2a206c[_0x4aba('0x36')],{'$or':_['map'](_0x2a206c[_0x4aba('0x30')],function(_0x4084df){var _0x38b217={};_0x38b217[_0x4084df]={'$like':'%'+_0x337839[_0x4aba('0x2c')][_0x4aba('0x38')]+'%'};return _0x38b217;})});}_0x2a206c=_['merge']({},_0x2a206c,_0x337839[_0x4aba('0x3b')]);return _0x3eb692[_0x4aba('0x4c')](_0x2a206c);}})['then'](function(_0x29bd8d){if(_0x29bd8d){_0x25a129=_0x29bd8d[_0x4aba('0x40')];if(!_0x337839[_0x4aba('0x2c')][_0x4aba('0x32')]('nolimit')){_0x2a206c[_0x4aba('0x19')]=qs['limit'](_0x337839['query'][_0x4aba('0x19')]);_0x2a206c[_0x4aba('0x17')]=qs[_0x4aba('0x17')](_0x337839[_0x4aba('0x2c')][_0x4aba('0x17')]);}return _0x3eb692[_0x4aba('0x4c')](_0x2a206c);}})[_0x4aba('0x1e')](function(_0x2ca465){if(_0x2ca465){return _0x2ca465?{'count':_0x25a129,'rows':_0x2ca465}:null;}})[_0x4aba('0x1e')](respondWithResult(_0x525445,null))[_0x4aba('0x46')](handleError(_0x525445,null));};exports[_0x4aba('0x4d')]=function(_0x31d2b1,_0x1a35d3,_0x5cac8e){if(_0x31d2b1[_0x4aba('0x42')]['id']){delete _0x31d2b1[_0x4aba('0x42')]['id'];}return db['DeskConfiguration']['findOne']({'where':{'id':_0x31d2b1[_0x4aba('0x45')]['id']}})[_0x4aba('0x1e')](handleEntityNotFound(_0x1a35d3,null))[_0x4aba('0x1e')](function(_0x3eb4e3){if(_0x3eb4e3){return _0x3eb4e3['setTags'](_0x31d2b1['body'][_0x4aba('0x4e')]||[]);}return null;})['then'](respondWithResult(_0x1a35d3,null))[_0x4aba('0x46')](handleError(_0x1a35d3,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8a58a59..9fa5d91 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 _0x5c01=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','int_desk_configurations','lodash'];(function(_0x1b3e27,_0x2e03cd){var _0x37e484=function(_0x583f2d){while(--_0x583f2d){_0x1b3e27['push'](_0x1b3e27['shift']());}};_0x37e484(++_0x2e03cd);}(_0x5c01,0x83));var _0x15c0=function(_0xafb03e,_0x31a0da){_0xafb03e=_0xafb03e-0x0;var _0x12bf75=_0x5c01[_0xafb03e];return _0x12bf75;};'use strict';var _=require(_0x15c0('0x0'));var util=require(_0x15c0('0x1'));var logger=require(_0x15c0('0x2'))(_0x15c0('0x3'));var moment=require(_0x15c0('0x4'));var BPromise=require(_0x15c0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x15c0('0x6'));var config=require(_0x15c0('0x7'));var attributes=require(_0x15c0('0x8'));module[_0x15c0('0x9')]=function(_0x527116,_0x41114c){return _0x527116['define']('DeskConfiguration',attributes,{'tableName':_0x15c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85d9=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','lodash','util'];(function(_0x57d28b,_0x3cddbd){var _0x43cac1=function(_0xfbcc68){while(--_0xfbcc68){_0x57d28b['push'](_0x57d28b['shift']());}};_0x43cac1(++_0x3cddbd);}(_0x85d9,0x8d));var _0x985d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x85d9[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x985d('0x0'));var util=require(_0x985d('0x1'));var logger=require('../../config/logger')(_0x985d('0x2'));var moment=require('moment');var BPromise=require(_0x985d('0x3'));var rp=require(_0x985d('0x4'));var fs=require('fs');var path=require(_0x985d('0x5'));var rimraf=require(_0x985d('0x6'));var config=require(_0x985d('0x7'));var attributes=require(_0x985d('0x8'));module['exports']=function(_0x4a6dd6,_0x5a3bbe){return _0x4a6dd6[_0x985d('0x9')](_0x985d('0xa'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index df8ab31..b8f0f21 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 _0x86c0=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x86c0,0x133));var _0x086c=function(_0x47d12e,_0x2d0ada){_0x47d12e=_0x47d12e-0x0;var _0x1250dc=_0x86c0[_0x47d12e];return _0x1250dc;};'use strict';var _=require(_0x086c('0x0'));var util=require('util');var moment=require(_0x086c('0x1'));var BPromise=require(_0x086c('0x2'));var rs=require(_0x086c('0x3'));var fs=require('fs');var Redis=require(_0x086c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x086c('0x5'));var logger=require(_0x086c('0x6'))(_0x086c('0x7'));var config=require(_0x086c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x086c('0x9')][_0x086c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e27a8,_0x387428,_0x117df9){return new BPromise(function(_0x25e437,_0x52b942){return client[_0x086c('0xb')](_0x2e27a8,_0x117df9)[_0x086c('0xc')](function(_0xa1b79a){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));logger[_0x086c('0xe')](_0x086c('0xf'),_0x387428,_0x086c('0xd'),JSON[_0x086c('0x10')](_0xa1b79a));if(_0xa1b79a['error']){if(_0xa1b79a[_0x086c('0x11')][_0x086c('0x12')]===0x1f4){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error']['message']);return _0x52b942(_0xa1b79a[_0x086c('0x11')]['message']);}logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0xa1b79a['error'][_0x086c('0x14')]);return _0x25e437(_0xa1b79a[_0x086c('0x11')][_0x086c('0x14')]);}else{logger[_0x086c('0x15')]('DeskConfiguration,\x20%s,\x20%s',_0x387428,_0x086c('0xd'));_0x25e437(_0xa1b79a[_0x086c('0x16')][_0x086c('0x14')]);}})['catch'](function(_0x34e74f){logger[_0x086c('0x11')](_0x086c('0x13'),_0x387428,_0x34e74f);_0x52b942(_0x34e74f);});});} \ No newline at end of file +var _0x0120=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x120612,_0x363085){var _0x309a2a=function(_0x308091){while(--_0x308091){_0x120612['push'](_0x120612['shift']());}};_0x309a2a(++_0x363085);}(_0x0120,0x6f));var _0x0012=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x0120[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59980a,_0x95d441,_0x436af8){return new BPromise(function(_0x3d4c64,_0x30176d){return client[_0x0012('0xc')](_0x59980a,_0x436af8)['then'](function(_0x14991f){logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));logger['debug'](_0x0012('0x10'),_0x95d441,'request\x20sent',JSON[_0x0012('0x11')](_0x14991f));if(_0x14991f[_0x0012('0x12')]){if(_0x14991f[_0x0012('0x12')][_0x0012('0x13')]===0x1f4){logger[_0x0012('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x95d441,_0x14991f[_0x0012('0x12')]['message']);return _0x30176d(_0x14991f['error']['message']);}logger['error'](_0x0012('0xe'),_0x95d441,_0x14991f['error'][_0x0012('0x14')]);return _0x3d4c64(_0x14991f[_0x0012('0x12')]['message']);}else{logger[_0x0012('0xd')](_0x0012('0xe'),_0x95d441,_0x0012('0xf'));_0x3d4c64(_0x14991f[_0x0012('0x15')]['message']);}})['catch'](function(_0x1e7fbe){logger[_0x0012('0x12')](_0x0012('0xe'),_0x95d441,_0x1e7fbe);_0x30176d(_0x1e7fbe);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 47af602..35a81d7 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 _0x1a21=['./intDeskField.controller','isAuthenticated','index','get','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x537025,_0x52cd13){var _0x3bb37b=function(_0x2935e2){while(--_0x2935e2){_0x537025['push'](_0x537025['shift']());}};_0x3bb37b(++_0x52cd13);}(_0x1a21,0x1d9));var _0x11a2=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0x1a21[_0x5c2e5e];return _0x46a5da;};'use strict';var multer=require(_0x11a2('0x0'));var util=require(_0x11a2('0x1'));var path=require(_0x11a2('0x2'));var timeout=require(_0x11a2('0x3'));var express=require(_0x11a2('0x4'));var router=express[_0x11a2('0x5')]();var fs_extra=require(_0x11a2('0x6'));var auth=require(_0x11a2('0x7'));var interaction=require(_0x11a2('0x8'));var config=require(_0x11a2('0x9'));var controller=require(_0x11a2('0xa'));router['get']('/',auth[_0x11a2('0xb')](),controller[_0x11a2('0xc')]);router[_0x11a2('0xd')](_0x11a2('0xe'),auth[_0x11a2('0xb')](),controller[_0x11a2('0xf')]);router['post']('/',auth[_0x11a2('0xb')](),controller[_0x11a2('0x10')]);router[_0x11a2('0x11')](_0x11a2('0xe'),auth['isAuthenticated'](),controller[_0x11a2('0x12')]);router[_0x11a2('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x11a2('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3a29=['index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0x3a29,0x199));var _0x93a2=function(_0x376f12,_0x5ee53e){_0x376f12=_0x376f12-0x0;var _0x24549e=_0x3a29[_0x376f12];return _0x24549e;};'use strict';var multer=require(_0x93a2('0x0'));var util=require(_0x93a2('0x1'));var path=require(_0x93a2('0x2'));var timeout=require(_0x93a2('0x3'));var express=require('express');var router=express[_0x93a2('0x4')]();var fs_extra=require(_0x93a2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x93a2('0x6'));var config=require(_0x93a2('0x7'));var controller=require(_0x93a2('0x8'));router[_0x93a2('0x9')]('/',auth[_0x93a2('0xa')](),controller[_0x93a2('0xb')]);router[_0x93a2('0x9')](_0x93a2('0xc'),auth[_0x93a2('0xa')](),controller[_0x93a2('0xd')]);router[_0x93a2('0xe')]('/',auth[_0x93a2('0xa')](),controller[_0x93a2('0xf')]);router[_0x93a2('0x10')](_0x93a2('0xc'),auth[_0x93a2('0xa')](),controller['update']);router[_0x93a2('0x11')](_0x93a2('0xc'),auth['isAuthenticated'](),controller[_0x93a2('0x12')]);module[_0x93a2('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 754315b..0b07949 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 _0x4b89=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x5e21d0,_0x2d20eb){var _0x389286=function(_0x19614e){while(--_0x19614e){_0x5e21d0['push'](_0x5e21d0['shift']());}};_0x389286(++_0x2d20eb);}(_0x4b89,0x7b));var _0x94b8=function(_0x3f105a,_0x459d89){_0x3f105a=_0x3f105a-0x0;var _0x41a968=_0x4b89[_0x3f105a];return _0x41a968;};'use strict';var Sequelize=require('sequelize');module[_0x94b8('0x0')]={'type':{'type':Sequelize[_0x94b8('0x1')](_0x94b8('0x2'),_0x94b8('0x3'),_0x94b8('0x4'),'keyValue',_0x94b8('0x5')),'defaultValue':_0x94b8('0x2')},'content':{'type':Sequelize[_0x94b8('0x6')]},'key':{'type':Sequelize[_0x94b8('0x6')]},'keyType':{'type':Sequelize[_0x94b8('0x1')](_0x94b8('0x2'),_0x94b8('0x3'),_0x94b8('0x4'))},'keyContent':{'type':Sequelize[_0x94b8('0x6')]},'idField':{'type':Sequelize[_0x94b8('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x94b8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x94b8('0x6')]}}; \ No newline at end of file +var _0xab13=['STRING','string','exports','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x3727a9,_0x1c2edb){var _0xa16806=function(_0x3ac27c){while(--_0x3ac27c){_0x3727a9['push'](_0x3727a9['shift']());}};_0xa16806(++_0x1c2edb);}(_0xab13,0x1c2));var _0x3ab1=function(_0xefd3e6,_0x10d71e){_0xefd3e6=_0xefd3e6-0x0;var _0x52a204=_0xab13[_0xefd3e6];return _0x52a204;};'use strict';var Sequelize=require('sequelize');module[_0x3ab1('0x0')]={'type':{'type':Sequelize[_0x3ab1('0x1')]('string',_0x3ab1('0x2'),_0x3ab1('0x3'),_0x3ab1('0x4'),_0x3ab1('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3ab1('0x6')]},'key':{'type':Sequelize[_0x3ab1('0x6')]},'keyType':{'type':Sequelize[_0x3ab1('0x1')](_0x3ab1('0x7'),'variable',_0x3ab1('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3ab1('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3ab1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 0729fc7..2733c99 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 _0xb012=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../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','index','DeskField','rawAttributes','fieldName','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','length','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra'];(function(_0x545ed4,_0x4be14a){var _0x9c19c6=function(_0x13edcc){while(--_0x13edcc){_0x545ed4['push'](_0x545ed4['shift']());}};_0x9c19c6(++_0x4be14a);}(_0xb012,0x92));var _0x2b01=function(_0x82df33,_0x31f867){_0x82df33=_0x82df33-0x0;var _0x34c236=_0xb012[_0x82df33];return _0x34c236;};'use strict';var emlformat=require(_0x2b01('0x0'));var rimraf=require(_0x2b01('0x1'));var zipdir=require(_0x2b01('0x2'));var jsonpatch=require(_0x2b01('0x3'));var rp=require(_0x2b01('0x4'));var moment=require(_0x2b01('0x5'));var BPromise=require(_0x2b01('0x6'));var Mustache=require(_0x2b01('0x7'));var util=require(_0x2b01('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x2b01('0x9'));var ejs=require(_0x2b01('0xa'));var fs=require('fs');var fs_extra=require(_0x2b01('0xb'));var _=require(_0x2b01('0xc'));var squel=require(_0x2b01('0xd'));var crypto=require('crypto');var jsforce=require(_0x2b01('0xe'));var deskjs=require(_0x2b01('0xf'));var toCsv=require(_0x2b01('0x9'));var querystring=require(_0x2b01('0x10'));var Papa=require(_0x2b01('0x11'));var Redis=require(_0x2b01('0x12'));var authService=require(_0x2b01('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b01('0x14'));var logger=require(_0x2b01('0x15'))(_0x2b01('0x16'));var utils=require(_0x2b01('0x17'));var config=require(_0x2b01('0x18'));var licenseUtil=require(_0x2b01('0x19'));var db=require(_0x2b01('0x1a'))['db'];function respondWithStatusCode(_0x2488bb,_0x79b8c0){_0x79b8c0=_0x79b8c0||0xcc;return function(_0x2e57ae){if(_0x2e57ae){return _0x2488bb[_0x2b01('0x1b')](_0x79b8c0);}return _0x2488bb[_0x2b01('0x1c')](_0x79b8c0)[_0x2b01('0x1d')]();};}function respondWithResult(_0x3c81a4,_0x396429){_0x396429=_0x396429||0xc8;return function(_0x9255ea){if(_0x9255ea){return _0x3c81a4[_0x2b01('0x1c')](_0x396429)[_0x2b01('0x1e')](_0x9255ea);}};}function respondWithFilteredResult(_0x24855e,_0x3e28be){return function(_0x14eb60){if(_0x14eb60){var _0x26cf1f=typeof _0x3e28be[_0x2b01('0x1f')]===_0x2b01('0x20')&&typeof _0x3e28be[_0x2b01('0x21')]===_0x2b01('0x20');var _0x5e825a=_0x14eb60[_0x2b01('0x22')];var _0x40ddd6=_0x26cf1f?0x0:_0x3e28be['offset'];var _0x585ace=_0x26cf1f?_0x14eb60[_0x2b01('0x22')]:_0x3e28be['offset']+_0x3e28be[_0x2b01('0x21')];var _0x3fd07b;if(_0x585ace>=_0x5e825a){_0x585ace=_0x5e825a;_0x3fd07b=0xc8;}else{_0x3fd07b=0xce;}_0x24855e[_0x2b01('0x1c')](_0x3fd07b);return _0x24855e[_0x2b01('0x23')](_0x2b01('0x24'),_0x40ddd6+'-'+_0x585ace+'/'+_0x5e825a)['json'](_0x14eb60);}return null;};}function patchUpdates(_0x45beb7){return function(_0x52dcd4){try{jsonpatch[_0x2b01('0x25')](_0x52dcd4,_0x45beb7,!![]);}catch(_0x3be87e){return BPromise[_0x2b01('0x26')](_0x3be87e);}return _0x52dcd4[_0x2b01('0x27')]();};}function saveUpdates(_0xc9160d,_0x4544de){return function(_0x1a8188){if(_0x1a8188){return _0x1a8188[_0x2b01('0x28')](_0xc9160d)[_0x2b01('0x29')](function(_0x151e89){return _0x151e89;});}return null;};}function removeEntity(_0x263214,_0x392f35){return function(_0x4924ce){if(_0x4924ce){return _0x4924ce[_0x2b01('0x2a')]()[_0x2b01('0x29')](function(){_0x263214[_0x2b01('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12dd4b,_0x15ce82){return function(_0x5de415){if(!_0x5de415){_0x12dd4b['sendStatus'](0x194);}return _0x5de415;};}function handleError(_0x14e3f1,_0x5570f3){_0x5570f3=_0x5570f3||0x1f4;return function(_0x1fdee6){logger[_0x2b01('0x2b')](_0x1fdee6[_0x2b01('0x2c')]);if(_0x1fdee6[_0x2b01('0x2d')]){delete _0x1fdee6['name'];}_0x14e3f1[_0x2b01('0x1c')](_0x5570f3)['send'](_0x1fdee6);};}exports[_0x2b01('0x2e')]=function(_0x54ae57,_0x32a4ba){var _0x6a2106={},_0x9fb1f0={},_0x515c9e={'count':0x0,'rows':[]};var _0x13aa6f=_['map'](db[_0x2b01('0x2f')][_0x2b01('0x30')],function(_0x3c0699){return{'name':_0x3c0699[_0x2b01('0x31')],'type':_0x3c0699['type']['key']};});_0x9fb1f0['model']=_[_0x2b01('0x32')](_0x13aa6f,_0x2b01('0x2d'));_0x9fb1f0[_0x2b01('0x33')]=_[_0x2b01('0x34')](_0x54ae57['query']);_0x9fb1f0['filters']=_[_0x2b01('0x35')](_0x9fb1f0[_0x2b01('0x36')],_0x9fb1f0[_0x2b01('0x33')]);_0x6a2106['attributes']=_[_0x2b01('0x35')](_0x9fb1f0[_0x2b01('0x36')],qs['fields'](_0x54ae57[_0x2b01('0x33')][_0x2b01('0x37')]));_0x6a2106['attributes']=_0x6a2106[_0x2b01('0x38')]['length']?_0x6a2106['attributes']:_0x9fb1f0[_0x2b01('0x36')];if(!_0x54ae57[_0x2b01('0x33')][_0x2b01('0x39')](_0x2b01('0x3a'))){_0x6a2106['limit']=qs[_0x2b01('0x21')](_0x54ae57[_0x2b01('0x33')][_0x2b01('0x21')]);_0x6a2106[_0x2b01('0x1f')]=qs[_0x2b01('0x1f')](_0x54ae57[_0x2b01('0x33')]['offset']);}_0x6a2106[_0x2b01('0x3b')]=qs['sort'](_0x54ae57[_0x2b01('0x33')][_0x2b01('0x3c')]);_0x6a2106[_0x2b01('0x3d')]=qs[_0x2b01('0x3e')](_[_0x2b01('0x3f')](_0x54ae57[_0x2b01('0x33')],_0x9fb1f0[_0x2b01('0x3e')]),_0x13aa6f);if(_0x54ae57[_0x2b01('0x33')][_0x2b01('0x40')]){_0x6a2106[_0x2b01('0x3d')]=_[_0x2b01('0x41')](_0x6a2106[_0x2b01('0x3d')],{'$or':_[_0x2b01('0x32')](_0x13aa6f,function(_0x19190a){if(_0x19190a[_0x2b01('0x42')]!==_0x2b01('0x43')){var _0x72ab42={};_0x72ab42[_0x19190a[_0x2b01('0x2d')]]={'$like':'%'+_0x54ae57[_0x2b01('0x33')][_0x2b01('0x40')]+'%'};return _0x72ab42;}})});}_0x6a2106=_[_0x2b01('0x41')]({},_0x6a2106,_0x54ae57[_0x2b01('0x44')]);var _0x187fa0={'where':_0x6a2106[_0x2b01('0x3d')]};return db[_0x2b01('0x2f')][_0x2b01('0x22')](_0x187fa0)['then'](function(_0x2a9ed1){_0x515c9e[_0x2b01('0x22')]=_0x2a9ed1;if(_0x54ae57['query'][_0x2b01('0x45')]){_0x6a2106[_0x2b01('0x46')]=[{'all':!![]}];}return db[_0x2b01('0x2f')]['findAll'](_0x6a2106);})[_0x2b01('0x29')](function(_0x45b9c0){_0x515c9e[_0x2b01('0x47')]=_0x45b9c0;return _0x515c9e;})[_0x2b01('0x29')](respondWithFilteredResult(_0x32a4ba,_0x6a2106))['catch'](handleError(_0x32a4ba,null));};exports[_0x2b01('0x48')]=function(_0x40e3cc,_0x39bf7e){var _0xecb1be={'raw':!![],'where':{'id':_0x40e3cc['params']['id']}},_0x46c93e={};_0x46c93e[_0x2b01('0x36')]=_[_0x2b01('0x34')](db[_0x2b01('0x2f')][_0x2b01('0x30')]);_0x46c93e['query']=_[_0x2b01('0x34')](_0x40e3cc[_0x2b01('0x33')]);_0x46c93e[_0x2b01('0x3e')]=_[_0x2b01('0x35')](_0x46c93e[_0x2b01('0x36')],_0x46c93e['query']);_0xecb1be[_0x2b01('0x38')]=_[_0x2b01('0x35')](_0x46c93e[_0x2b01('0x36')],qs['fields'](_0x40e3cc['query'][_0x2b01('0x37')]));_0xecb1be['attributes']=_0xecb1be['attributes'][_0x2b01('0x49')]?_0xecb1be['attributes']:_0x46c93e[_0x2b01('0x36')];if(_0x40e3cc[_0x2b01('0x33')][_0x2b01('0x45')]){_0xecb1be[_0x2b01('0x46')]=[{'all':!![]}];}_0xecb1be=_[_0x2b01('0x41')]({},_0xecb1be,_0x40e3cc[_0x2b01('0x44')]);return db[_0x2b01('0x2f')][_0x2b01('0x4a')](_0xecb1be)['then'](handleEntityNotFound(_0x39bf7e,null))[_0x2b01('0x29')](respondWithResult(_0x39bf7e,null))['catch'](handleError(_0x39bf7e,null));};exports[_0x2b01('0x4b')]=function(_0x7895fa,_0x3faf31){return db['DeskField'][_0x2b01('0x4b')](_0x7895fa[_0x2b01('0x4c')],{})[_0x2b01('0x29')](respondWithResult(_0x3faf31,0xc9))[_0x2b01('0x4d')](handleError(_0x3faf31,null));};exports['update']=function(_0x23fbc1,_0x5072c4){if(_0x23fbc1['body']['id']){delete _0x23fbc1[_0x2b01('0x4c')]['id'];}return db[_0x2b01('0x2f')][_0x2b01('0x4a')]({'where':{'id':_0x23fbc1[_0x2b01('0x4e')]['id']}})[_0x2b01('0x29')](handleEntityNotFound(_0x5072c4,null))[_0x2b01('0x29')](saveUpdates(_0x23fbc1[_0x2b01('0x4c')],null))[_0x2b01('0x29')](respondWithResult(_0x5072c4,null))[_0x2b01('0x4d')](handleError(_0x5072c4,null));};exports['destroy']=function(_0x365fd8,_0x99006d){return db[_0x2b01('0x2f')]['find']({'where':{'id':_0x365fd8[_0x2b01('0x4e')]['id']}})['then'](handleEntityNotFound(_0x99006d,null))[_0x2b01('0x29')](removeEntity(_0x99006d,null))[_0x2b01('0x4d')](handleError(_0x99006d,null));}; \ No newline at end of file +var _0x1b20=['DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch','params','includeAll','merge','find','create','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','index','map'];(function(_0x58eec7,_0x2353db){var _0x25c5d3=function(_0x1ae895){while(--_0x1ae895){_0x58eec7['push'](_0x58eec7['shift']());}};_0x25c5d3(++_0x2353db);}(_0x1b20,0x66));var _0x01b2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b20[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01b2('0x0'));var zipdir=require(_0x01b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x01b2('0x2'));var BPromise=require(_0x01b2('0x3'));var Mustache=require(_0x01b2('0x4'));var util=require(_0x01b2('0x5'));var path=require(_0x01b2('0x6'));var sox=require(_0x01b2('0x7'));var csv=require(_0x01b2('0x8'));var ejs=require(_0x01b2('0x9'));var fs=require('fs');var fs_extra=require(_0x01b2('0xa'));var _=require(_0x01b2('0xb'));var squel=require(_0x01b2('0xc'));var crypto=require(_0x01b2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x01b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x01b2('0xf'));var Papa=require(_0x01b2('0x10'));var Redis=require(_0x01b2('0x11'));var authService=require(_0x01b2('0x12'));var qs=require(_0x01b2('0x13'));var as=require(_0x01b2('0x14'));var hardwareService=require(_0x01b2('0x15'));var logger=require(_0x01b2('0x16'))('api');var utils=require(_0x01b2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x01b2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41a618,_0x8ac569){_0x8ac569=_0x8ac569||0xcc;return function(_0x2c6d4d){if(_0x2c6d4d){return _0x41a618[_0x01b2('0x19')](_0x8ac569);}return _0x41a618['status'](_0x8ac569)[_0x01b2('0x1a')]();};}function respondWithResult(_0x2e7b31,_0x4f1c15){_0x4f1c15=_0x4f1c15||0xc8;return function(_0x1626ba){if(_0x1626ba){return _0x2e7b31[_0x01b2('0x1b')](_0x4f1c15)['json'](_0x1626ba);}};}function respondWithFilteredResult(_0x299d0c,_0x3d5833){return function(_0x1a9734){if(_0x1a9734){var _0x3f68a8=typeof _0x3d5833['offset']==='undefined'&&typeof _0x3d5833[_0x01b2('0x1c')]===_0x01b2('0x1d');var _0x588dbe=_0x1a9734[_0x01b2('0x1e')];var _0x444236=_0x3f68a8?0x0:_0x3d5833[_0x01b2('0x1f')];var _0x5986f5=_0x3f68a8?_0x1a9734[_0x01b2('0x1e')]:_0x3d5833[_0x01b2('0x1f')]+_0x3d5833[_0x01b2('0x1c')];var _0xd2acbb;if(_0x5986f5>=_0x588dbe){_0x5986f5=_0x588dbe;_0xd2acbb=0xc8;}else{_0xd2acbb=0xce;}_0x299d0c[_0x01b2('0x1b')](_0xd2acbb);return _0x299d0c['set'](_0x01b2('0x20'),_0x444236+'-'+_0x5986f5+'/'+_0x588dbe)['json'](_0x1a9734);}return null;};}function patchUpdates(_0x7464e5){return function(_0x4c0008){try{jsonpatch[_0x01b2('0x21')](_0x4c0008,_0x7464e5,!![]);}catch(_0x266264){return BPromise[_0x01b2('0x22')](_0x266264);}return _0x4c0008['save']();};}function saveUpdates(_0x269b54,_0x2f01b0){return function(_0xc3027){if(_0xc3027){return _0xc3027[_0x01b2('0x23')](_0x269b54)[_0x01b2('0x24')](function(_0x479e94){return _0x479e94;});}return null;};}function removeEntity(_0x1874b9,_0x539db1){return function(_0x54e866){if(_0x54e866){return _0x54e866[_0x01b2('0x25')]()[_0x01b2('0x24')](function(){_0x1874b9[_0x01b2('0x1b')](0xcc)[_0x01b2('0x1a')]();});}};}function handleEntityNotFound(_0x2e32c1,_0x307229){return function(_0x4920f7){if(!_0x4920f7){_0x2e32c1[_0x01b2('0x19')](0x194);}return _0x4920f7;};}function handleError(_0x239543,_0x424cfd){_0x424cfd=_0x424cfd||0x1f4;return function(_0x17274f){logger['error'](_0x17274f[_0x01b2('0x26')]);if(_0x17274f['name']){delete _0x17274f[_0x01b2('0x27')];}_0x239543[_0x01b2('0x1b')](_0x424cfd)['send'](_0x17274f);};}exports[_0x01b2('0x28')]=function(_0x5efdda,_0x487c49){var _0x291d56={},_0x4363ec={},_0x5befbf={'count':0x0,'rows':[]};var _0x24ed7d=_[_0x01b2('0x29')](db[_0x01b2('0x2a')][_0x01b2('0x2b')],function(_0x3009a6){return{'name':_0x3009a6[_0x01b2('0x2c')],'type':_0x3009a6[_0x01b2('0x2d')][_0x01b2('0x2e')]};});_0x4363ec[_0x01b2('0x2f')]=_[_0x01b2('0x29')](_0x24ed7d,_0x01b2('0x27'));_0x4363ec['query']=_[_0x01b2('0x30')](_0x5efdda[_0x01b2('0x31')]);_0x4363ec[_0x01b2('0x32')]=_[_0x01b2('0x33')](_0x4363ec[_0x01b2('0x2f')],_0x4363ec[_0x01b2('0x31')]);_0x291d56['attributes']=_['intersection'](_0x4363ec[_0x01b2('0x2f')],qs['fields'](_0x5efdda['query'][_0x01b2('0x34')]));_0x291d56[_0x01b2('0x35')]=_0x291d56[_0x01b2('0x35')][_0x01b2('0x36')]?_0x291d56['attributes']:_0x4363ec[_0x01b2('0x2f')];if(!_0x5efdda['query'][_0x01b2('0x37')]('nolimit')){_0x291d56['limit']=qs['limit'](_0x5efdda[_0x01b2('0x31')][_0x01b2('0x1c')]);_0x291d56[_0x01b2('0x1f')]=qs[_0x01b2('0x1f')](_0x5efdda['query'][_0x01b2('0x1f')]);}_0x291d56[_0x01b2('0x38')]=qs['sort'](_0x5efdda[_0x01b2('0x31')][_0x01b2('0x39')]);_0x291d56[_0x01b2('0x3a')]=qs[_0x01b2('0x32')](_[_0x01b2('0x3b')](_0x5efdda[_0x01b2('0x31')],_0x4363ec['filters']),_0x24ed7d);if(_0x5efdda[_0x01b2('0x31')][_0x01b2('0x3c')]){_0x291d56['where']=_['merge'](_0x291d56[_0x01b2('0x3a')],{'$or':_[_0x01b2('0x29')](_0x24ed7d,function(_0x4555c8){if(_0x4555c8[_0x01b2('0x2d')]!==_0x01b2('0x3d')){var _0x3b0cc7={};_0x3b0cc7[_0x4555c8['name']]={'$like':'%'+_0x5efdda['query'][_0x01b2('0x3c')]+'%'};return _0x3b0cc7;}})});}_0x291d56=_['merge']({},_0x291d56,_0x5efdda[_0x01b2('0x3e')]);var _0x31878={'where':_0x291d56[_0x01b2('0x3a')]};return db[_0x01b2('0x2a')][_0x01b2('0x1e')](_0x31878)['then'](function(_0x279ce0){_0x5befbf[_0x01b2('0x1e')]=_0x279ce0;if(_0x5efdda[_0x01b2('0x31')]['includeAll']){_0x291d56[_0x01b2('0x3f')]=[{'all':!![]}];}return db[_0x01b2('0x2a')][_0x01b2('0x40')](_0x291d56);})['then'](function(_0x34f646){_0x5befbf['rows']=_0x34f646;return _0x5befbf;})[_0x01b2('0x24')](respondWithFilteredResult(_0x487c49,_0x291d56))[_0x01b2('0x41')](handleError(_0x487c49,null));};exports['show']=function(_0x2b5214,_0x3a36fc){var _0x4da4aa={'raw':!![],'where':{'id':_0x2b5214[_0x01b2('0x42')]['id']}},_0x2df2b6={};_0x2df2b6[_0x01b2('0x2f')]=_[_0x01b2('0x30')](db[_0x01b2('0x2a')]['rawAttributes']);_0x2df2b6[_0x01b2('0x31')]=_[_0x01b2('0x30')](_0x2b5214[_0x01b2('0x31')]);_0x2df2b6['filters']=_[_0x01b2('0x33')](_0x2df2b6[_0x01b2('0x2f')],_0x2df2b6[_0x01b2('0x31')]);_0x4da4aa[_0x01b2('0x35')]=_[_0x01b2('0x33')](_0x2df2b6[_0x01b2('0x2f')],qs[_0x01b2('0x34')](_0x2b5214[_0x01b2('0x31')]['fields']));_0x4da4aa[_0x01b2('0x35')]=_0x4da4aa[_0x01b2('0x35')][_0x01b2('0x36')]?_0x4da4aa[_0x01b2('0x35')]:_0x2df2b6[_0x01b2('0x2f')];if(_0x2b5214[_0x01b2('0x31')][_0x01b2('0x43')]){_0x4da4aa['include']=[{'all':!![]}];}_0x4da4aa=_[_0x01b2('0x44')]({},_0x4da4aa,_0x2b5214[_0x01b2('0x3e')]);return db[_0x01b2('0x2a')][_0x01b2('0x45')](_0x4da4aa)['then'](handleEntityNotFound(_0x3a36fc,null))['then'](respondWithResult(_0x3a36fc,null))[_0x01b2('0x41')](handleError(_0x3a36fc,null));};exports[_0x01b2('0x46')]=function(_0x404a65,_0x49370d){return db[_0x01b2('0x2a')][_0x01b2('0x46')](_0x404a65[_0x01b2('0x47')],{})[_0x01b2('0x24')](respondWithResult(_0x49370d,0xc9))[_0x01b2('0x41')](handleError(_0x49370d,null));};exports[_0x01b2('0x23')]=function(_0x5b54c5,_0x2a8b8d){if(_0x5b54c5['body']['id']){delete _0x5b54c5[_0x01b2('0x47')]['id'];}return db['DeskField']['find']({'where':{'id':_0x5b54c5[_0x01b2('0x42')]['id']}})[_0x01b2('0x24')](handleEntityNotFound(_0x2a8b8d,null))[_0x01b2('0x24')](saveUpdates(_0x5b54c5[_0x01b2('0x47')],null))[_0x01b2('0x24')](respondWithResult(_0x2a8b8d,null))['catch'](handleError(_0x2a8b8d,null));};exports['destroy']=function(_0x387954,_0x115557){return db[_0x01b2('0x2a')][_0x01b2('0x45')]({'where':{'id':_0x387954[_0x01b2('0x42')]['id']}})[_0x01b2('0x24')](handleEntityNotFound(_0x115557,null))['then'](removeEntity(_0x115557,null))[_0x01b2('0x41')](handleError(_0x115557,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 52483f5..f10f01e 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 _0x6b05=['define','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intDeskField.attributes','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6b05,0x15e));var _0x56b0=function(_0x56b4d5,_0x1609c1){_0x56b4d5=_0x56b4d5-0x0;var _0x27974a=_0x6b05[_0x56b4d5];return _0x27974a;};'use strict';var _=require(_0x56b0('0x0'));var util=require(_0x56b0('0x1'));var logger=require(_0x56b0('0x2'))(_0x56b0('0x3'));var moment=require(_0x56b0('0x4'));var BPromise=require('bluebird');var rp=require(_0x56b0('0x5'));var fs=require('fs');var path=require(_0x56b0('0x6'));var rimraf=require(_0x56b0('0x7'));var config=require('../../config/environment');var attributes=require(_0x56b0('0x8'));module[_0x56b0('0x9')]=function(_0x959e0a,_0x20b0a9){return _0x959e0a[_0x56b0('0xa')](_0x56b0('0xb'),attributes,{'tableName':_0x56b0('0xc'),'paranoid':![],'indexes':[{'name':_0x56b0('0xd'),'fields':['idField',_0x56b0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe866=['path','rimraf','../../config/environment','./intDeskField.attributes','define','int_desk_fields','desk_unique_index','idField','lodash','../../config/logger','moment','bluebird'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xe866,0x1e8));var _0x6e86=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe866[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6e86('0x0'));var util=require('util');var logger=require(_0x6e86('0x1'))('api');var moment=require(_0x6e86('0x2'));var BPromise=require(_0x6e86('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e86('0x4'));var rimraf=require(_0x6e86('0x5'));var config=require(_0x6e86('0x6'));var attributes=require(_0x6e86('0x7'));module['exports']=function(_0x1b1c2e,_0x12e3ee){return _0x1b1c2e[_0x6e86('0x8')]('DeskField',attributes,{'tableName':_0x6e86('0x9'),'paranoid':![],'indexes':[{'name':_0x6e86('0xa'),'fields':[_0x6e86('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 34c514c..827dee9 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 _0xf838=['result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x17ca78,_0x219d44){var _0x43a0d7=function(_0x2dead5){while(--_0x2dead5){_0x17ca78['push'](_0x17ca78['shift']());}};_0x43a0d7(++_0x219d44);}(_0xf838,0xf3));var _0x8f83=function(_0x12ca9f,_0x43eddc){_0x12ca9f=_0x12ca9f-0x0;var _0x5c4c85=_0xf838[_0x12ca9f];return _0x5c4c85;};'use strict';var _=require(_0x8f83('0x0'));var util=require(_0x8f83('0x1'));var moment=require(_0x8f83('0x2'));var BPromise=require(_0x8f83('0x3'));var rs=require(_0x8f83('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f83('0x5'))['db'];var utils=require(_0x8f83('0x6'));var logger=require('../../config/logger')(_0x8f83('0x7'));var config=require(_0x8f83('0x8'));var jayson=require(_0x8f83('0x9'));var client=jayson['client'][_0x8f83('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e16f2,_0x5766ab,_0xc0f228){return new BPromise(function(_0x361551,_0xce6d5){return client[_0x8f83('0xb')](_0x4e16f2,_0xc0f228)[_0x8f83('0xc')](function(_0x4d96ca){logger[_0x8f83('0xd')](_0x8f83('0xe'),_0x5766ab,_0x8f83('0xf'));logger[_0x8f83('0x10')](_0x8f83('0x11'),_0x5766ab,'request\x20sent',JSON[_0x8f83('0x12')](_0x4d96ca));if(_0x4d96ca['error']){if(_0x4d96ca[_0x8f83('0x13')]['code']===0x1f4){logger[_0x8f83('0x13')](_0x8f83('0xe'),_0x5766ab,_0x4d96ca['error'][_0x8f83('0x14')]);return _0xce6d5(_0x4d96ca[_0x8f83('0x13')][_0x8f83('0x14')]);}logger['error'](_0x8f83('0xe'),_0x5766ab,_0x4d96ca[_0x8f83('0x13')][_0x8f83('0x14')]);return _0x361551(_0x4d96ca[_0x8f83('0x13')][_0x8f83('0x14')]);}else{logger[_0x8f83('0xd')](_0x8f83('0xe'),_0x5766ab,'request\x20sent');_0x361551(_0x4d96ca[_0x8f83('0x15')][_0x8f83('0x14')]);}})['catch'](function(_0x325713){logger['error']('DeskField,\x20%s,\x20%s',_0x5766ab,_0x325713);_0xce6d5(_0x325713);});});} \ No newline at end of file +var _0x079b=['randomstring','../../mysqldb','../../config/utils','client','http','request','info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0xa1b8e,_0x6c59d3){var _0x121982=function(_0x4234e9){while(--_0x4234e9){_0xa1b8e['push'](_0xa1b8e['shift']());}};_0x121982(++_0x6c59d3);}(_0x079b,0xb1));var _0xb079=function(_0x2b92ec,_0x18e0e3){_0x2b92ec=_0x2b92ec-0x0;var _0x12be46=_0x079b[_0x2b92ec];return _0x12be46;};'use strict';var _=require(_0xb079('0x0'));var util=require(_0xb079('0x1'));var moment=require('moment');var BPromise=require(_0xb079('0x2'));var rs=require(_0xb079('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb079('0x4'))['db'];var utils=require(_0xb079('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb079('0x6')][_0xb079('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e127e,_0x3ddd65,_0x9d2caf){return new BPromise(function(_0x5f117d,_0x3e8667){return client[_0xb079('0x8')](_0x4e127e,_0x9d2caf)['then'](function(_0xb256f0){logger[_0xb079('0x9')]('DeskField,\x20%s,\x20%s',_0x3ddd65,'request\x20sent');logger[_0xb079('0xa')](_0xb079('0xb'),_0x3ddd65,_0xb079('0xc'),JSON[_0xb079('0xd')](_0xb256f0));if(_0xb256f0['error']){if(_0xb256f0[_0xb079('0xe')][_0xb079('0xf')]===0x1f4){logger['error'](_0xb079('0x10'),_0x3ddd65,_0xb256f0[_0xb079('0xe')]['message']);return _0x3e8667(_0xb256f0[_0xb079('0xe')][_0xb079('0x11')]);}logger[_0xb079('0xe')](_0xb079('0x10'),_0x3ddd65,_0xb256f0[_0xb079('0xe')]['message']);return _0x5f117d(_0xb256f0[_0xb079('0xe')]['message']);}else{logger['info'](_0xb079('0x10'),_0x3ddd65,_0xb079('0xc'));_0x5f117d(_0xb256f0[_0xb079('0x12')][_0xb079('0x11')]);}})[_0xb079('0x13')](function(_0x22b1fa){logger[_0xb079('0xe')](_0xb079('0x10'),_0x3ddd65,_0x22b1fa);_0x3e8667(_0x22b1fa);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index a6adca9..aaf928e 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 _0x817f=['post','create','addConfiguration','put','update','destroy','exports','multer','util','Router','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields'];(function(_0x46e251,_0x328b55){var _0x350647=function(_0x384da0){while(--_0x384da0){_0x46e251['push'](_0x46e251['shift']());}};_0x350647(++_0x328b55);}(_0x817f,0x10b));var _0xf817=function(_0x354e7a,_0x4e4dc0){_0x354e7a=_0x354e7a-0x0;var _0x17b550=_0x817f[_0x354e7a];return _0x17b550;};'use strict';var multer=require(_0xf817('0x0'));var util=require(_0xf817('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf817('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf817('0x3'));var config=require(_0xf817('0x4'));var controller=require(_0xf817('0x5'));router[_0xf817('0x6')]('/',auth[_0xf817('0x7')](),controller['index']);router[_0xf817('0x6')](_0xf817('0x8'),auth[_0xf817('0x7')](),controller[_0xf817('0x9')]);router[_0xf817('0x6')](_0xf817('0xa'),auth['isAuthenticated'](),controller[_0xf817('0xb')]);router[_0xf817('0x6')]('/:id/fields',auth[_0xf817('0x7')](),controller[_0xf817('0xc')]);router[_0xf817('0xd')]('/',auth[_0xf817('0x7')](),controller[_0xf817('0xe')]);router[_0xf817('0xd')](_0xf817('0xa'),auth[_0xf817('0x7')](),controller[_0xf817('0xf')]);router[_0xf817('0x10')](_0xf817('0x8'),auth[_0xf817('0x7')](),controller[_0xf817('0x11')]);router['delete']('/:id',auth[_0xf817('0x7')](),controller[_0xf817('0x12')]);module[_0xf817('0x13')]=router; \ No newline at end of file +var _0x51fc=['../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','create','post','/:id/configurations','addConfiguration','put','delete','exports','multer','path','fs-extra','../../components/auth/service'];(function(_0x33f2ea,_0x2fc54e){var _0x5ade35=function(_0x26c8f8){while(--_0x26c8f8){_0x33f2ea['push'](_0x33f2ea['shift']());}};_0x5ade35(++_0x2fc54e);}(_0x51fc,0x1ea));var _0xc51f=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x51fc[_0x5ee3d3];return _0x4b272f;};'use strict';var multer=require(_0xc51f('0x0'));var util=require('util');var path=require(_0xc51f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc51f('0x2'));var auth=require(_0xc51f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc51f('0x4'));var controller=require(_0xc51f('0x5'));router[_0xc51f('0x6')]('/',auth[_0xc51f('0x7')](),controller['index']);router[_0xc51f('0x6')](_0xc51f('0x8'),auth[_0xc51f('0x7')](),controller[_0xc51f('0x9')]);router['get']('/:id/configurations',auth[_0xc51f('0x7')](),controller[_0xc51f('0xa')]);router[_0xc51f('0x6')](_0xc51f('0xb'),auth[_0xc51f('0x7')](),controller['getFields']);router['post']('/',auth[_0xc51f('0x7')](),controller[_0xc51f('0xc')]);router[_0xc51f('0xd')](_0xc51f('0xe'),auth[_0xc51f('0x7')](),controller[_0xc51f('0xf')]);router[_0xc51f('0x10')](_0xc51f('0x8'),auth[_0xc51f('0x7')](),controller['update']);router[_0xc51f('0x11')]('/:id',auth[_0xc51f('0x7')](),controller['destroy']);module[_0xc51f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 7a3d381..27b1a6a 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 _0xa7e6=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2d8d12,_0x5ec696){var _0x3c2473=function(_0x26fb3a){while(--_0x26fb3a){_0x2d8d12['push'](_0x2d8d12['shift']());}};_0x3c2473(++_0x5ec696);}(_0xa7e6,0x74));var _0x6a7e=function(_0x423356,_0x555fd6){_0x423356=_0x423356-0x0;var _0x523fe5=_0xa7e6[_0x423356];return _0x523fe5;};'use strict';var Sequelize=require(_0x6a7e('0x0'));module[_0x6a7e('0x1')]={'name':{'type':Sequelize[_0x6a7e('0x2')]},'username':{'type':Sequelize[_0x6a7e('0x2')]},'password':{'type':Sequelize[_0x6a7e('0x2')]},'remoteUri':{'type':Sequelize[_0x6a7e('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6a7e('0x2')]},'clientSecret':{'type':Sequelize[_0x6a7e('0x2')]},'serverUrl':{'type':Sequelize[_0x6a7e('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6a7e('0x2')]},'modernAuthentication':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdcf6=['exports','STRING'];(function(_0x4482ab,_0x5ea184){var _0x1ab274=function(_0x271674){while(--_0x271674){_0x4482ab['push'](_0x4482ab['shift']());}};_0x1ab274(++_0x5ea184);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x25a972,_0x5d2fcd){_0x25a972=_0x25a972-0x0;var _0x24ad56=_0xdcf6[_0x25a972];return _0x24ad56;};'use strict';var Sequelize=require('sequelize');module[_0x6dcf('0x0')]={'name':{'type':Sequelize[_0x6dcf('0x1')]},'username':{'type':Sequelize[_0x6dcf('0x1')]},'password':{'type':Sequelize[_0x6dcf('0x1')]},'remoteUri':{'type':Sequelize[_0x6dcf('0x1')]},'tenantId':{'type':Sequelize[_0x6dcf('0x1')]},'clientId':{'type':Sequelize[_0x6dcf('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6dcf('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6dcf('0x1')]},'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 486c532..07409fb 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 _0xb961=['billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data7','modernAuthentication','access_token','data5','POST','/oauth2/token','username','GET','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','all','test',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','count','limit','set','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','fieldName','type','key','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','params','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','directioncode','phonecall_activity_parties','accountidname'];(function(_0x4a7ab2,_0x1cfce9){var _0x4642e7=function(_0x18a51c){while(--_0x18a51c){_0x4a7ab2['push'](_0x4a7ab2['shift']());}};_0x4642e7(++_0x1cfce9);}(_0xb961,0x114));var _0x1b96=function(_0x4eb6fe,_0x318f6c){_0x4eb6fe=_0x4eb6fe-0x0;var _0x17ce75=_0xb961[_0x4eb6fe];return _0x17ce75;};'use strict';var rp=require(_0x1b96('0x0'));var util=require(_0x1b96('0x1'));var _=require(_0x1b96('0x2'));var qs=require(_0x1b96('0x3'));var logger=require('../../config/logger')(_0x1b96('0x4'));var db=require(_0x1b96('0x5'))['db'];var integrations=require(_0x1b96('0x6'));function respondWithResult(_0x350ac2,_0x45aea7){_0x45aea7=_0x45aea7||0xc8;return function(_0x3f62f9){if(_0x3f62f9){return _0x350ac2[_0x1b96('0x7')](_0x45aea7)['json'](_0x3f62f9);}};}function respondWithFilteredResult(_0x2662ce,_0x323469){return function(_0x2af5f0){if(_0x2af5f0){var _0x474491=typeof _0x323469[_0x1b96('0x8')]===_0x1b96('0x9')&&typeof _0x323469['limit']===_0x1b96('0x9');var _0x3732c3=_0x2af5f0[_0x1b96('0xa')];var _0x43cd97=_0x474491?0x0:_0x323469['offset'];var _0x3bf8e0=_0x474491?_0x2af5f0[_0x1b96('0xa')]:_0x323469[_0x1b96('0x8')]+_0x323469[_0x1b96('0xb')];var _0xfab0f3;if(_0x3bf8e0>=_0x3732c3){_0x3bf8e0=_0x3732c3;_0xfab0f3=0xc8;}else{_0xfab0f3=0xce;}_0x2662ce[_0x1b96('0x7')](_0xfab0f3);return _0x2662ce[_0x1b96('0xc')]('Content-Range',_0x43cd97+'-'+_0x3bf8e0+'/'+_0x3732c3)['json'](_0x2af5f0);}return null;};}function saveUpdates(_0x595480){return function(_0x28d0bb){if(_0x28d0bb){return _0x28d0bb[_0x1b96('0xd')](_0x595480)[_0x1b96('0xe')](function(_0x482ed0){return _0x482ed0;});}return null;};}function removeEntity(_0x1b71ce){return function(_0x4de085){if(_0x4de085){return _0x4de085[_0x1b96('0xf')]()[_0x1b96('0xe')](function(){_0x1b71ce['status'](0xcc)[_0x1b96('0x10')]();});}};}function handleEntityNotFound(_0x5ea342){return function(_0x25ffae){if(!_0x25ffae){_0x5ea342[_0x1b96('0x11')](0x194);}return _0x25ffae;};}function handleError(_0x499a5f,_0x45ec61){_0x45ec61=_0x45ec61||0x1f4;return function(_0xb6d2a2){logger[_0x1b96('0x12')](_0xb6d2a2[_0x1b96('0x13')]);if(_0xb6d2a2[_0x1b96('0x14')]){delete _0xb6d2a2[_0x1b96('0x14')];}_0x499a5f[_0x1b96('0x7')](_0x45ec61)[_0x1b96('0x15')](_0xb6d2a2);};}exports[_0x1b96('0x16')]=function(_0x14673a,_0xc26967){var _0xa412c2={},_0x43c195={},_0x58715f={'count':0x0,'rows':[]};var _0x112a05=_[_0x1b96('0x17')](db[_0x1b96('0x18')]['rawAttributes'],function(_0x349f7c){return{'name':_0x349f7c[_0x1b96('0x19')],'type':_0x349f7c[_0x1b96('0x1a')][_0x1b96('0x1b')]};});_0x43c195['model']=_[_0x1b96('0x17')](_0x112a05,'name');_0x43c195[_0x1b96('0x1c')]=_['keys'](_0x14673a['query']);_0x43c195['filters']=_['intersection'](_0x43c195[_0x1b96('0x1d')],_0x43c195[_0x1b96('0x1c')]);_0xa412c2['attributes']=_[_0x1b96('0x1e')](_0x43c195[_0x1b96('0x1d')],qs[_0x1b96('0x1f')](_0x14673a[_0x1b96('0x1c')]['fields']));_0xa412c2[_0x1b96('0x20')]=_0xa412c2[_0x1b96('0x20')][_0x1b96('0x21')]?_0xa412c2[_0x1b96('0x20')]:_0x43c195[_0x1b96('0x1d')];if(!_0x14673a[_0x1b96('0x1c')][_0x1b96('0x22')](_0x1b96('0x23'))){_0xa412c2[_0x1b96('0xb')]=qs[_0x1b96('0xb')](_0x14673a[_0x1b96('0x1c')][_0x1b96('0xb')]);_0xa412c2[_0x1b96('0x8')]=qs[_0x1b96('0x8')](_0x14673a[_0x1b96('0x1c')][_0x1b96('0x8')]);}_0xa412c2[_0x1b96('0x24')]=qs[_0x1b96('0x25')](_0x14673a[_0x1b96('0x1c')][_0x1b96('0x25')]);_0xa412c2[_0x1b96('0x26')]=qs[_0x1b96('0x27')](_[_0x1b96('0x28')](_0x14673a[_0x1b96('0x1c')],_0x43c195[_0x1b96('0x27')]),_0x112a05);if(_0x14673a['query'][_0x1b96('0x29')]){_0xa412c2[_0x1b96('0x26')]=_[_0x1b96('0x2a')](_0xa412c2[_0x1b96('0x26')],{'$or':_[_0x1b96('0x17')](_0x112a05,function(_0x58dabf){if(_0x58dabf[_0x1b96('0x1a')]!=='VIRTUAL'){var _0x391b08={};_0x391b08[_0x58dabf[_0x1b96('0x14')]]={'$like':'%'+_0x14673a[_0x1b96('0x1c')][_0x1b96('0x29')]+'%'};return _0x391b08;}})});}_0xa412c2=_[_0x1b96('0x2a')]({},_0xa412c2,_0x14673a[_0x1b96('0x2b')]);var _0x4d3141={'where':_0xa412c2[_0x1b96('0x26')]};return db[_0x1b96('0x18')][_0x1b96('0xa')](_0x4d3141)['then'](function(_0x41f694){_0x58715f[_0x1b96('0xa')]=_0x41f694;if(_0x14673a[_0x1b96('0x1c')][_0x1b96('0x2c')]){_0xa412c2['include']=[{'all':!![]}];}return db[_0x1b96('0x18')][_0x1b96('0x2d')](_0xa412c2);})['then'](function(_0x111219){_0x58715f[_0x1b96('0x2e')]=_0x111219;return _0x58715f;})[_0x1b96('0xe')](respondWithFilteredResult(_0xc26967,_0xa412c2))[_0x1b96('0x2f')](handleError(_0xc26967,null));};exports[_0x1b96('0x30')]=function(_0x3848e1,_0x3b4afa){var _0x9dc2d3={'raw':![],'where':{'id':_0x3848e1['params']['id']}},_0x328aa6={};_0x328aa6[_0x1b96('0x1d')]=_[_0x1b96('0x31')](db[_0x1b96('0x18')][_0x1b96('0x32')]);_0x328aa6[_0x1b96('0x1c')]=_[_0x1b96('0x31')](_0x3848e1[_0x1b96('0x1c')]);_0x328aa6['filters']=_[_0x1b96('0x1e')](_0x328aa6[_0x1b96('0x1d')],_0x328aa6[_0x1b96('0x1c')]);_0x9dc2d3[_0x1b96('0x20')]=_[_0x1b96('0x1e')](_0x328aa6[_0x1b96('0x1d')],qs['fields'](_0x3848e1[_0x1b96('0x1c')][_0x1b96('0x1f')]));_0x9dc2d3[_0x1b96('0x20')]=_0x9dc2d3['attributes'][_0x1b96('0x21')]?_0x9dc2d3[_0x1b96('0x20')]:_0x328aa6[_0x1b96('0x1d')];if(_0x3848e1[_0x1b96('0x1c')]['includeAll']){_0x9dc2d3[_0x1b96('0x33')]=[{'all':!![]}];}_0x9dc2d3=_[_0x1b96('0x2a')]({},_0x9dc2d3,_0x3848e1['options']);return db[_0x1b96('0x18')][_0x1b96('0x34')](_0x9dc2d3)['then'](handleEntityNotFound(_0x3b4afa,null))[_0x1b96('0xe')](respondWithResult(_0x3b4afa,null))[_0x1b96('0x2f')](handleError(_0x3b4afa,null));};exports[_0x1b96('0x35')]=function(_0x3db016,_0x1aa650){return db[_0x1b96('0x18')][_0x1b96('0x35')](_0x3db016[_0x1b96('0x36')],{})[_0x1b96('0xe')](respondWithResult(_0x1aa650,0xc9))[_0x1b96('0x2f')](handleError(_0x1aa650,null));};exports[_0x1b96('0xd')]=function(_0x3becdb,_0x5abca6){if(_0x3becdb[_0x1b96('0x36')]['id']){delete _0x3becdb[_0x1b96('0x36')]['id'];}return db[_0x1b96('0x18')][_0x1b96('0x34')]({'where':{'id':_0x3becdb[_0x1b96('0x37')]['id']}})[_0x1b96('0xe')](handleEntityNotFound(_0x5abca6,null))[_0x1b96('0xe')](saveUpdates(_0x3becdb['body'],null))[_0x1b96('0xe')](respondWithResult(_0x5abca6,null))[_0x1b96('0x2f')](handleError(_0x5abca6,null));};exports['destroy']=function(_0x5c00e6,_0x5eb22d){return db[_0x1b96('0x18')][_0x1b96('0x34')]({'where':{'id':_0x5c00e6[_0x1b96('0x37')]['id']}})[_0x1b96('0xe')](handleEntityNotFound(_0x5eb22d,null))[_0x1b96('0xe')](removeEntity(_0x5eb22d,null))['catch'](handleError(_0x5eb22d,null));};exports['getConfigurations']=function(_0x59b87,_0x508a46){var _0x3da50e={};var _0x2fda3d={};var _0x550f53;var _0x1b97c2;return db['Dynamics365Account'][_0x1b96('0x38')]({'where':{'id':_0x59b87[_0x1b96('0x37')]['id']}})['then'](handleEntityNotFound(_0x508a46,null))['then'](function(_0x1561ff){if(_0x1561ff){_0x550f53=_0x1561ff;_0x2fda3d[_0x1b96('0x1d')]=_['keys'](db['Dynamics365Configuration'][_0x1b96('0x32')]);_0x2fda3d[_0x1b96('0x1c')]=_[_0x1b96('0x31')](_0x59b87[_0x1b96('0x1c')]);_0x2fda3d['filters']=_[_0x1b96('0x1e')](_0x2fda3d['model'],_0x2fda3d[_0x1b96('0x1c')]);_0x3da50e[_0x1b96('0x20')]=_[_0x1b96('0x1e')](_0x2fda3d[_0x1b96('0x1d')],qs[_0x1b96('0x1f')](_0x59b87['query'][_0x1b96('0x1f')]));_0x3da50e['attributes']=_0x3da50e['attributes'][_0x1b96('0x21')]?_0x3da50e['attributes']:_0x2fda3d[_0x1b96('0x1d')];_0x3da50e['order']=qs[_0x1b96('0x25')](_0x59b87[_0x1b96('0x1c')][_0x1b96('0x25')]);_0x3da50e[_0x1b96('0x26')]=qs[_0x1b96('0x27')](_[_0x1b96('0x28')](_0x59b87['query'],_0x2fda3d['filters']));if(_0x59b87[_0x1b96('0x1c')][_0x1b96('0x29')]){_0x3da50e['where']=_[_0x1b96('0x2a')](_0x3da50e[_0x1b96('0x26')],{'$or':_[_0x1b96('0x17')](_0x3da50e[_0x1b96('0x20')],function(_0x2ec8f0){var _0x30a4c4={};_0x30a4c4[_0x2ec8f0]={'$like':'%'+_0x59b87[_0x1b96('0x1c')][_0x1b96('0x29')]+'%'};return _0x30a4c4;})});}_0x3da50e=_['merge']({},_0x3da50e,_0x59b87[_0x1b96('0x2b')]);return _0x550f53[_0x1b96('0x39')](_0x3da50e);}})['then'](function(_0x49813b){if(_0x49813b){_0x1b97c2=_0x49813b['length'];if(!_0x59b87[_0x1b96('0x1c')][_0x1b96('0x22')]('nolimit')){_0x3da50e[_0x1b96('0xb')]=qs[_0x1b96('0xb')](_0x59b87[_0x1b96('0x1c')][_0x1b96('0xb')]);_0x3da50e['offset']=qs['offset'](_0x59b87[_0x1b96('0x1c')][_0x1b96('0x8')]);}return _0x550f53[_0x1b96('0x39')](_0x3da50e);}})[_0x1b96('0xe')](function(_0xb817de){if(_0xb817de){return _0xb817de?{'count':_0x1b97c2,'rows':_0xb817de}:null;}})[_0x1b96('0xe')](respondWithResult(_0x508a46,null))['catch'](handleError(_0x508a46,null));};exports[_0x1b96('0x3a')]=function(_0x3ae272,_0x2fb71a){if(_0x3ae272[_0x1b96('0x36')]['id']){delete _0x3ae272[_0x1b96('0x36')]['id'];}return db['Dynamics365Account'][_0x1b96('0x38')]({'where':{'id':_0x3ae272[_0x1b96('0x37')]['id']}})['then'](handleEntityNotFound(_0x2fb71a,null))[_0x1b96('0xe')](function(_0x5a6027){if(_0x5a6027){_0x3ae272[_0x1b96('0x36')][_0x1b96('0x3b')]=_0x5a6027['id'];_0x3ae272[_0x1b96('0x36')][_0x1b96('0x3c')]=integrations[_0x1b96('0x3d')](_0x3ae272[_0x1b96('0x36')][_0x1b96('0x3e')],_0x3ae272[_0x1b96('0x36')][_0x1b96('0x1a')]);_0x3ae272[_0x1b96('0x36')][_0x1b96('0x3f')]=integrations[_0x1b96('0x40')](_0x3ae272[_0x1b96('0x36')][_0x1b96('0x3e')],_0x3ae272['body'][_0x1b96('0x1a')]);return db[_0x1b96('0x41')][_0x1b96('0x35')](_0x3ae272[_0x1b96('0x36')],{'include':[{'model':db[_0x1b96('0x42')],'as':_0x1b96('0x3c')},{'model':db[_0x1b96('0x42')],'as':_0x1b96('0x3f')}]});}return null;})[_0x1b96('0xe')](respondWithResult(_0x2fb71a,null))[_0x1b96('0x2f')](handleError(_0x2fb71a,null));};function sanitizeRemoteUri(_0x5ba58b){var _0xae78cd=_0x5ba58b[_0x1b96('0x43')](-0x1);if(_0xae78cd==='/')return _0x5ba58b[_0x1b96('0x44')](0x0,_0x5ba58b[_0x1b96('0x45')](_0xae78cd));return _0x5ba58b;}function getWebApiUrl(_0x4de472){return util[_0x1b96('0x46')](_0x1b96('0x47'),_0x4de472);}exports[_0x1b96('0x48')]=function(_0x5ba0d4,_0x33ee4e){var _0x1fe8da=_0x5ba0d4[_0x1b96('0x1c')][_0x1b96('0x49')];var _0x5f1345=_0x1fe8da===_0x1b96('0x4a')?_0x1b96('0x4b'):_0x1b96('0x4c');var _0x530aa8='';var _0x26a199='';var _0x4fa78e='';var _0x593027='';var _0x3b5c85='';var _0x2b86a9='';var _0x5fd23b='';var _0x234450='';var _0xcb7f1f=[_0x1b96('0x4d'),_0x1b96('0x4e'),_0x1b96('0x4f'),_0x1b96('0x50'),_0x1b96('0x51'),'subject',_0x1b96('0x52'),'regardingobjectid',_0x1b96('0x53'),_0x1b96('0x54')];var _0x4fbfa3=[_0x1b96('0x55'),'accountidyominame','actualserviceunits',_0x1b96('0x56'),_0x1b96('0x57'),_0x1b96('0x58'),'contractdetailidname','contractidname',_0x1b96('0x59'),_0x1b96('0x5a'),'createdbyname',_0x1b96('0x5b'),'createdon','createdonbehalfbyname','createdonbehalfbyyominame',_0x1b96('0x5c'),_0x1b96('0x5d'),'customeridyominame',_0x1b96('0x5e'),_0x1b96('0x5f'),'entityimage_timestamp','entityimage_url',_0x1b96('0x60'),_0x1b96('0x61'),_0x1b96('0x62'),'followupby',_0x1b96('0x63'),'influencescore',_0x1b96('0x64'),_0x1b96('0x65'),'masteridname',_0x1b96('0x66'),_0x1b96('0x67'),'modifiedbyname','modifiedbyyominame',_0x1b96('0x68'),'modifiedonbehalfbyname',_0x1b96('0x69'),_0x1b96('0x6a'),_0x1b96('0x6b'),_0x1b96('0x6c'),_0x1b96('0x6d'),_0x1b96('0x6e'),_0x1b96('0x6f'),_0x1b96('0x70'),'owneridyominame','parentcaseidname',_0x1b96('0x71'),'primarycontactidyominame','prioritycodename',_0x1b96('0x72'),_0x1b96('0x73'),_0x1b96('0x74'),_0x1b96('0x75'),_0x1b96('0x76'),'responsiblecontactidname',_0x1b96('0x77'),_0x1b96('0x78'),_0x1b96('0x79'),_0x1b96('0x7a'),_0x1b96('0x7b'),'statecode',_0x1b96('0x7c'),'subjectidname','ticketnumber',_0x1b96('0x7d'),_0x1b96('0x7e'),_0x1b96('0x7f'),_0x1b96('0x80'),'versionnumber'];var _0x28b8ae=_0xcb7f1f[_0x1b96('0x81')](_0x4fbfa3);return db[_0x1b96('0x18')]['findOne']({'where':{'id':_0x5ba0d4[_0x1b96('0x37')]['id']},'attributes':['id','username','password',_0x1b96('0x82'),_0x1b96('0x83'),_0x1b96('0x84'),_0x1b96('0x85'),'modernAuthentication'],'include':[{'model':db[_0x1b96('0x86')],'as':_0x1b96('0x86'),'attributes':['id','data5',_0x1b96('0x87')]}]})[_0x1b96('0xe')](handleEntityNotFound(_0x33ee4e,null))[_0x1b96('0xe')](function(_0x100b6a){if(_0x100b6a){if(_0x100b6a[_0x1b96('0x88')]){_0x100b6a[_0x1b96('0x89')]=_0x100b6a['CloudProvider'][_0x1b96('0x8a')];_0x234450=sanitizeRemoteUri(_0x100b6a[_0x1b96('0x86')][_0x1b96('0x87')]);_0x5fd23b=getWebApiUrl(_0x234450);return _0x100b6a;}_0x234450=sanitizeRemoteUri(_0x100b6a['remoteUri']);_0x5fd23b=getWebApiUrl(_0x234450);var _0x539672={'method':_0x1b96('0x8b'),'uri':'https://login.microsoftonline.com/'+_0x100b6a[_0x1b96('0x83')]+_0x1b96('0x8c'),'form':{'client_id':_0x100b6a['clientId'],'resource':_0x234450,'username':_0x100b6a[_0x1b96('0x8d')],'password':_0x100b6a['password'],'grant_type':'password','client_secret':_0x100b6a[_0x1b96('0x85')]},'json':!![]};return rp(_0x539672);}})[_0x1b96('0xe')](function(_0x135729){_0x2b86a9=_0x135729[_0x1b96('0x89')];var _0x51e51f={'method':_0x1b96('0x8e'),'uri':encodeURI(_0x5fd23b+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x5f1345+'\x27'),'headers':{'Authorization':_0x1b96('0x8f')+_0x2b86a9,'If-None-Match':null,'OData-Version':_0x1b96('0x90')},'json':!![]};return rp(_0x51e51f);})[_0x1b96('0xe')](function(_0x781d3a){var _0x328049=_0x781d3a[_0x1b96('0x91')][0x0];var _0x160b41=_0x328049[_0x1b96('0x92')];var _0x233acc={'method':'GET','uri':_0x5fd23b+_0x1b96('0x93')+_0x160b41+_0x1b96('0x94'),'headers':{'Authorization':'Bearer\x20'+_0x2b86a9,'If-None-Match':null,'OData-Version':_0x1b96('0x90')},'json':!![]};return rp(_0x233acc);})[_0x1b96('0xe')](function(_0x221aa9){_0x530aa8=_0x221aa9;_0x26a199=_0x530aa8[_0x1b96('0x95')];_0x26a199=_[_0x1b96('0x96')](_0x26a199,function(_0x3bd8a8){return!_0x28b8ae['includes'](_0x3bd8a8[_0x1b96('0x97')]);});var _0x594705=[];var _0x4548e0=[];_0x26a199[_0x1b96('0x98')](function(_0x168ee3){if(_0x168ee3[_0x1b96('0x99')]){var _0x23b46a=_0x168ee3['@odata.type']['substring'](_0x168ee3[_0x1b96('0x99')][_0x1b96('0x45')]('.')+0x1);if(_0x23b46a===_0x1b96('0x9a')){_0x594705[_0x1b96('0x9b')](getSelectList(_0x5fd23b,_0x1fe8da,_0x4548e0,_0x530aa8[_0x1b96('0x92')],_0x168ee3[_0x1b96('0x92')],_0x2b86a9));}}});return Promise['all'](_0x594705);})['then'](function(_0x1f81b8){_0x4fa78e=_0x1f81b8[0x0];var _0x210c1b=[];var _0x2ddf6c=[];_0x26a199['forEach'](function(_0x3d2e7a){if(!_[_0x1b96('0x9c')](_0x3d2e7a[_0x1b96('0x99')])){var _0x7854cd=_0x3d2e7a[_0x1b96('0x99')][_0x1b96('0x44')](_0x3d2e7a[_0x1b96('0x99')][_0x1b96('0x45')]('.')+0x1);if(_0x7854cd===_0x1b96('0x9d')){_0x210c1b[_0x1b96('0x9b')](getBooleanList(_0x5fd23b,_0x1fe8da,_0x2ddf6c,_0x530aa8[_0x1b96('0x92')],_0x3d2e7a[_0x1b96('0x92')],_0x2b86a9));}}});return Promise['all'](_0x210c1b);})['then'](function(_0x2f0b47){_0x593027=_0x2f0b47[0x0];var _0x5ba5f5=[];var _0x357561=[];_0x26a199['forEach'](function(_0x433c40){if(_0x433c40[_0x1b96('0x99')]){var _0x5ac18f=_0x433c40[_0x1b96('0x99')][_0x1b96('0x44')](_0x433c40[_0x1b96('0x99')][_0x1b96('0x45')]('.')+0x1);if(_0x5ac18f===_0x1b96('0x9e')||_0x5ac18f===_0x1b96('0x9f')||_0x5ac18f===_0x1b96('0xa0')||_0x5ac18f===_0x1b96('0xa1')||_0x5ac18f===_0x1b96('0xa2')||_0x5ac18f==='DateTimeAttributeMetadata'||_0x5ac18f===_0x1b96('0xa3')||_0x5ac18f==='EntityNameAttributeMetadata'||_0x5ac18f==='StateAttributeMetadata'||_0x5ac18f==='DecimalAttributeMetadata'){_0x5ba5f5[_0x1b96('0x9b')](getInputList(_0x5fd23b,_0x1fe8da,_0x5ac18f,_0x357561,_0x530aa8[_0x1b96('0x92')],_0x433c40[_0x1b96('0x92')],_0x2b86a9));}}});return Promise[_0x1b96('0xa4')](_0x5ba5f5);})[_0x1b96('0xe')](function(_0x3aeb77){_0x3b5c85=_0x3aeb77[0x0];var _0x35f204=_0x4fa78e['concat'](_0x593027)['concat'](_0x3b5c85);var _0x5a01de={'count':_0x35f204[_0x1b96('0x21')],'rows':_0x35f204};return _0x5a01de;})[_0x1b96('0xe')](respondWithResult(_0x33ee4e,null))['catch'](function(_0x4057c0){var _0x406c2a=_0x5ba0d4[_0x1b96('0x1c')][_0x1b96('0xa5')]?0x1f4:_0x4057c0['statusCode']||0x1f4;logger[_0x1b96('0x12')](_0x4057c0[_0x1b96('0x13')]);delete _0x4057c0['name'];if(_0x406c2a===0x191){_0x406c2a=0x190;}_0x33ee4e[_0x1b96('0x7')](_0x406c2a)[_0x1b96('0x15')](_0x5ba0d4['query'][_0x1b96('0xa5')]?{'message':'Wrong\x20credentials','statusCode':_0x4057c0['statusCode']}:_0x4057c0);});};function getSelectList(_0x2ae662,_0x4781ea,_0x223968,_0x396140,_0x388e3f,_0x1e409f){var _0x2900c5={'method':_0x1b96('0x8e'),'uri':_0x2ae662+_0x1b96('0x93')+_0x396140+')/Attributes('+_0x388e3f+_0x1b96('0xa6')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x1e409f,'If-None-Match':null,'OData-Version':_0x1b96('0x90')},'json':!![]};return rp(_0x2900c5)[_0x1b96('0xe')](function(_0xb1ea8d){var _0x4e4aed=[];var _0x50cac4=_0xb1ea8d[_0x1b96('0xa7')][_0x1b96('0xa8')];_0x50cac4[_0x1b96('0x98')](function(_0x218533){_0x4e4aed[_0x1b96('0x9b')]({'name':_0x218533[_0x1b96('0xa9')][_0x1b96('0xaa')][_0x1b96('0xa9')],'value':String(_0x218533[_0x1b96('0xab')])});});var _0x109320={'id':_0x4781ea+'_'+_0xb1ea8d['LogicalName'],'name':_0xb1ea8d[_0x1b96('0xac')][_0x1b96('0xaa')][_0x1b96('0xa9')],'custom':![],'options':_0x4e4aed};_0x223968[_0x1b96('0x9b')](_0x109320);return _0x223968;});}function getBooleanList(_0x31b3c3,_0x6d8974,_0x284370,_0x301d8c,_0x19d473,_0x1c8c62){var _0x52d092={'method':'GET','uri':_0x31b3c3+_0x1b96('0x93')+_0x301d8c+_0x1b96('0xad')+_0x19d473+_0x1b96('0xae'),'headers':{'Authorization':_0x1b96('0x8f')+_0x1c8c62,'If-None-Match':null,'OData-Version':_0x1b96('0x90')},'json':!![]};return rp(_0x52d092)[_0x1b96('0xe')](function(_0x5c33c5){var _0x4590af=[];_0x4590af['push']({'name':_0x5c33c5[_0x1b96('0xa7')][_0x1b96('0xaf')][_0x1b96('0xa9')]['UserLocalizedLabel'][_0x1b96('0xa9')],'value':_0x1b96('0xb0')},{'name':_0x5c33c5[_0x1b96('0xa7')][_0x1b96('0xb1')]['Label'][_0x1b96('0xaa')][_0x1b96('0xa9')],'value':_0x1b96('0xb2')});var _0x24f9da={'id':_0x6d8974+'_'+_0x5c33c5[_0x1b96('0x97')],'name':_0x5c33c5[_0x1b96('0xac')][_0x1b96('0xaa')]['Label'],'custom':![],'options':_0x4590af};_0x284370[_0x1b96('0x9b')](_0x24f9da);return _0x284370;});}function getInputList(_0x160536,_0x1ed368,_0x1407df,_0x3d120d,_0x1ef5d4,_0xb60e3f,_0x52359e){var _0x57490e={'method':_0x1b96('0x8e'),'uri':_0x160536+_0x1b96('0x93')+_0x1ef5d4+_0x1b96('0xad')+_0xb60e3f+_0x1b96('0xb3')+_0x1407df+_0x1b96('0xb4'),'headers':{'Authorization':_0x1b96('0x8f')+_0x52359e,'If-None-Match':null,'OData-Version':_0x1b96('0x90')},'json':!![]};return rp(_0x57490e)[_0x1b96('0xe')](function(_0x718860){var _0xbc1ec0={'id':_0x1ed368+'_'+_0x718860[_0x1b96('0x97')],'name':_0x718860[_0x1b96('0xac')]['UserLocalizedLabel']?_0x718860[_0x1b96('0xac')]['UserLocalizedLabel']['Label']:_0x718860[_0x1b96('0x97')],'custom':![],'options':[]};_0x3d120d[_0x1b96('0x9b')](_0xbc1ec0);return _0x3d120d;});} \ No newline at end of file +var _0x91d1=['send',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','EntityDefinitions(','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','status','json','count','offset','limit','set','update','then','sendStatus','stack','name','map','Dynamics365Account','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','title','description','customerid','subject','phonenumber','regardingobjectid','phonecall_activity_parties','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','Attributes','remove','includes','LogicalName','@odata.type','PicklistAttributeMetadata','push','MetadataId','lastIndexOf','BooleanAttributeMetadata','forEach','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','all','concat','test','statusCode','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x91d1,0x17a));var _0x191d=function(_0x3be650,_0x3e75f6){_0x3be650=_0x3be650-0x0;var _0x440588=_0x91d1[_0x3be650];return _0x440588;};'use strict';var rp=require('request-promise');var util=require(_0x191d('0x0'));var _=require(_0x191d('0x1'));var qs=require(_0x191d('0x2'));var logger=require(_0x191d('0x3'))('api');var db=require(_0x191d('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x421929,_0x3ebcfa){_0x3ebcfa=_0x3ebcfa||0xc8;return function(_0x5bbe66){if(_0x5bbe66){return _0x421929[_0x191d('0x5')](_0x3ebcfa)[_0x191d('0x6')](_0x5bbe66);}};}function respondWithFilteredResult(_0x5a45db,_0x2111f1){return function(_0x1e8c00){if(_0x1e8c00){var _0x57b0ee=typeof _0x2111f1['offset']==='undefined'&&typeof _0x2111f1['limit']==='undefined';var _0x400e8d=_0x1e8c00[_0x191d('0x7')];var _0x2329ea=_0x57b0ee?0x0:_0x2111f1[_0x191d('0x8')];var _0x16a645=_0x57b0ee?_0x1e8c00['count']:_0x2111f1['offset']+_0x2111f1[_0x191d('0x9')];var _0x428d8c;if(_0x16a645>=_0x400e8d){_0x16a645=_0x400e8d;_0x428d8c=0xc8;}else{_0x428d8c=0xce;}_0x5a45db[_0x191d('0x5')](_0x428d8c);return _0x5a45db[_0x191d('0xa')]('Content-Range',_0x2329ea+'-'+_0x16a645+'/'+_0x400e8d)['json'](_0x1e8c00);}return null;};}function saveUpdates(_0x3acace){return function(_0x410ad2){if(_0x410ad2){return _0x410ad2[_0x191d('0xb')](_0x3acace)[_0x191d('0xc')](function(_0x2ac241){return _0x2ac241;});}return null;};}function removeEntity(_0xe0b844){return function(_0x141d78){if(_0x141d78){return _0x141d78['destroy']()[_0x191d('0xc')](function(){_0xe0b844[_0x191d('0x5')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e836){return function(_0x4dd6cf){if(!_0x4dd6cf){_0x58e836[_0x191d('0xd')](0x194);}return _0x4dd6cf;};}function handleError(_0x457eb3,_0x312b1b){_0x312b1b=_0x312b1b||0x1f4;return function(_0x4eb5b8){logger['error'](_0x4eb5b8[_0x191d('0xe')]);if(_0x4eb5b8[_0x191d('0xf')]){delete _0x4eb5b8[_0x191d('0xf')];}_0x457eb3[_0x191d('0x5')](_0x312b1b)['send'](_0x4eb5b8);};}exports['index']=function(_0x3bbe4a,_0x3b2737){var _0x3fce41={},_0x347351={},_0x21bf53={'count':0x0,'rows':[]};var _0x1ab948=_[_0x191d('0x10')](db[_0x191d('0x11')][_0x191d('0x12')],function(_0x113a5a){return{'name':_0x113a5a[_0x191d('0x13')],'type':_0x113a5a['type'][_0x191d('0x14')]};});_0x347351['model']=_['map'](_0x1ab948,_0x191d('0xf'));_0x347351[_0x191d('0x15')]=_[_0x191d('0x16')](_0x3bbe4a[_0x191d('0x15')]);_0x347351[_0x191d('0x17')]=_[_0x191d('0x18')](_0x347351[_0x191d('0x19')],_0x347351['query']);_0x3fce41[_0x191d('0x1a')]=_[_0x191d('0x18')](_0x347351[_0x191d('0x19')],qs[_0x191d('0x1b')](_0x3bbe4a['query'][_0x191d('0x1b')]));_0x3fce41[_0x191d('0x1a')]=_0x3fce41['attributes'][_0x191d('0x1c')]?_0x3fce41[_0x191d('0x1a')]:_0x347351[_0x191d('0x19')];if(!_0x3bbe4a[_0x191d('0x15')][_0x191d('0x1d')](_0x191d('0x1e'))){_0x3fce41[_0x191d('0x9')]=qs[_0x191d('0x9')](_0x3bbe4a['query']['limit']);_0x3fce41[_0x191d('0x8')]=qs[_0x191d('0x8')](_0x3bbe4a[_0x191d('0x15')]['offset']);}_0x3fce41[_0x191d('0x1f')]=qs[_0x191d('0x20')](_0x3bbe4a[_0x191d('0x15')][_0x191d('0x20')]);_0x3fce41[_0x191d('0x21')]=qs[_0x191d('0x17')](_['pick'](_0x3bbe4a['query'],_0x347351[_0x191d('0x17')]),_0x1ab948);if(_0x3bbe4a[_0x191d('0x15')]['filter']){_0x3fce41[_0x191d('0x21')]=_[_0x191d('0x22')](_0x3fce41[_0x191d('0x21')],{'$or':_['map'](_0x1ab948,function(_0x4a4bfa){if(_0x4a4bfa[_0x191d('0x23')]!=='VIRTUAL'){var _0x32a1bf={};_0x32a1bf[_0x4a4bfa[_0x191d('0xf')]]={'$like':'%'+_0x3bbe4a[_0x191d('0x15')][_0x191d('0x24')]+'%'};return _0x32a1bf;}})});}_0x3fce41=_[_0x191d('0x22')]({},_0x3fce41,_0x3bbe4a[_0x191d('0x25')]);var _0x344d96={'where':_0x3fce41[_0x191d('0x21')]};return db[_0x191d('0x11')][_0x191d('0x7')](_0x344d96)[_0x191d('0xc')](function(_0x1967ab){_0x21bf53[_0x191d('0x7')]=_0x1967ab;if(_0x3bbe4a[_0x191d('0x15')][_0x191d('0x26')]){_0x3fce41[_0x191d('0x27')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x3fce41);})[_0x191d('0xc')](function(_0x446dd7){_0x21bf53[_0x191d('0x28')]=_0x446dd7;return _0x21bf53;})[_0x191d('0xc')](respondWithFilteredResult(_0x3b2737,_0x3fce41))[_0x191d('0x29')](handleError(_0x3b2737,null));};exports[_0x191d('0x2a')]=function(_0x15a2e6,_0x5bf8ca){var _0x2ef95b={'raw':![],'where':{'id':_0x15a2e6[_0x191d('0x2b')]['id']}},_0x58ac59={};_0x58ac59['model']=_[_0x191d('0x16')](db[_0x191d('0x11')][_0x191d('0x12')]);_0x58ac59[_0x191d('0x15')]=_[_0x191d('0x16')](_0x15a2e6[_0x191d('0x15')]);_0x58ac59['filters']=_[_0x191d('0x18')](_0x58ac59[_0x191d('0x19')],_0x58ac59['query']);_0x2ef95b['attributes']=_['intersection'](_0x58ac59[_0x191d('0x19')],qs[_0x191d('0x1b')](_0x15a2e6[_0x191d('0x15')][_0x191d('0x1b')]));_0x2ef95b[_0x191d('0x1a')]=_0x2ef95b[_0x191d('0x1a')][_0x191d('0x1c')]?_0x2ef95b[_0x191d('0x1a')]:_0x58ac59['model'];if(_0x15a2e6[_0x191d('0x15')][_0x191d('0x26')]){_0x2ef95b[_0x191d('0x27')]=[{'all':!![]}];}_0x2ef95b=_[_0x191d('0x22')]({},_0x2ef95b,_0x15a2e6['options']);return db[_0x191d('0x11')][_0x191d('0x2c')](_0x2ef95b)[_0x191d('0xc')](handleEntityNotFound(_0x5bf8ca,null))['then'](respondWithResult(_0x5bf8ca,null))[_0x191d('0x29')](handleError(_0x5bf8ca,null));};exports[_0x191d('0x2d')]=function(_0x137633,_0x40416d){return db[_0x191d('0x11')][_0x191d('0x2d')](_0x137633[_0x191d('0x2e')],{})[_0x191d('0xc')](respondWithResult(_0x40416d,0xc9))[_0x191d('0x29')](handleError(_0x40416d,null));};exports[_0x191d('0xb')]=function(_0x269e55,_0x20159b){if(_0x269e55[_0x191d('0x2e')]['id']){delete _0x269e55[_0x191d('0x2e')]['id'];}return db[_0x191d('0x11')][_0x191d('0x2c')]({'where':{'id':_0x269e55['params']['id']}})['then'](handleEntityNotFound(_0x20159b,null))[_0x191d('0xc')](saveUpdates(_0x269e55['body'],null))[_0x191d('0xc')](respondWithResult(_0x20159b,null))[_0x191d('0x29')](handleError(_0x20159b,null));};exports[_0x191d('0x2f')]=function(_0x252545,_0x2e1ceb){return db[_0x191d('0x11')][_0x191d('0x2c')]({'where':{'id':_0x252545['params']['id']}})[_0x191d('0xc')](handleEntityNotFound(_0x2e1ceb,null))['then'](removeEntity(_0x2e1ceb,null))[_0x191d('0x29')](handleError(_0x2e1ceb,null));};exports[_0x191d('0x30')]=function(_0x5e4248,_0x42cfe2){var _0x500081={};var _0x312f51={};var _0x5608b8;var _0x40b87f;return db[_0x191d('0x11')][_0x191d('0x31')]({'where':{'id':_0x5e4248['params']['id']}})['then'](handleEntityNotFound(_0x42cfe2,null))['then'](function(_0x10a5f6){if(_0x10a5f6){_0x5608b8=_0x10a5f6;_0x312f51[_0x191d('0x19')]=_['keys'](db[_0x191d('0x32')][_0x191d('0x12')]);_0x312f51['query']=_['keys'](_0x5e4248[_0x191d('0x15')]);_0x312f51['filters']=_[_0x191d('0x18')](_0x312f51['model'],_0x312f51[_0x191d('0x15')]);_0x500081['attributes']=_[_0x191d('0x18')](_0x312f51['model'],qs[_0x191d('0x1b')](_0x5e4248[_0x191d('0x15')][_0x191d('0x1b')]));_0x500081[_0x191d('0x1a')]=_0x500081[_0x191d('0x1a')][_0x191d('0x1c')]?_0x500081[_0x191d('0x1a')]:_0x312f51[_0x191d('0x19')];_0x500081['order']=qs[_0x191d('0x20')](_0x5e4248[_0x191d('0x15')][_0x191d('0x20')]);_0x500081[_0x191d('0x21')]=qs[_0x191d('0x17')](_[_0x191d('0x33')](_0x5e4248[_0x191d('0x15')],_0x312f51[_0x191d('0x17')]));if(_0x5e4248['query'][_0x191d('0x24')]){_0x500081[_0x191d('0x21')]=_[_0x191d('0x22')](_0x500081[_0x191d('0x21')],{'$or':_['map'](_0x500081[_0x191d('0x1a')],function(_0x2696ca){var _0x33ff35={};_0x33ff35[_0x2696ca]={'$like':'%'+_0x5e4248[_0x191d('0x15')]['filter']+'%'};return _0x33ff35;})});}_0x500081=_[_0x191d('0x22')]({},_0x500081,_0x5e4248[_0x191d('0x25')]);return _0x5608b8[_0x191d('0x30')](_0x500081);}})[_0x191d('0xc')](function(_0x13aa01){if(_0x13aa01){_0x40b87f=_0x13aa01[_0x191d('0x1c')];if(!_0x5e4248[_0x191d('0x15')][_0x191d('0x1d')](_0x191d('0x1e'))){_0x500081[_0x191d('0x9')]=qs[_0x191d('0x9')](_0x5e4248[_0x191d('0x15')][_0x191d('0x9')]);_0x500081[_0x191d('0x8')]=qs[_0x191d('0x8')](_0x5e4248['query'][_0x191d('0x8')]);}return _0x5608b8['getConfigurations'](_0x500081);}})[_0x191d('0xc')](function(_0x575080){if(_0x575080){return _0x575080?{'count':_0x40b87f,'rows':_0x575080}:null;}})[_0x191d('0xc')](respondWithResult(_0x42cfe2,null))[_0x191d('0x29')](handleError(_0x42cfe2,null));};exports[_0x191d('0x34')]=function(_0x1bdc6d,_0xa12e25){if(_0x1bdc6d[_0x191d('0x2e')]['id']){delete _0x1bdc6d['body']['id'];}return db[_0x191d('0x11')][_0x191d('0x31')]({'where':{'id':_0x1bdc6d[_0x191d('0x2b')]['id']}})[_0x191d('0xc')](handleEntityNotFound(_0xa12e25,null))[_0x191d('0xc')](function(_0x534e93){if(_0x534e93){_0x1bdc6d[_0x191d('0x2e')]['AccountId']=_0x534e93['id'];_0x1bdc6d[_0x191d('0x2e')][_0x191d('0x35')]=integrations[_0x191d('0x36')](_0x1bdc6d[_0x191d('0x2e')][_0x191d('0x37')],_0x1bdc6d['body']['type']);_0x1bdc6d[_0x191d('0x2e')][_0x191d('0x38')]=integrations[_0x191d('0x39')](_0x1bdc6d[_0x191d('0x2e')]['channel'],_0x1bdc6d[_0x191d('0x2e')]['type']);return db[_0x191d('0x32')][_0x191d('0x2d')](_0x1bdc6d[_0x191d('0x2e')],{'include':[{'model':db[_0x191d('0x3a')],'as':_0x191d('0x35')},{'model':db[_0x191d('0x3a')],'as':_0x191d('0x38')}]});}return null;})[_0x191d('0xc')](respondWithResult(_0xa12e25,null))['catch'](handleError(_0xa12e25,null));};function sanitizeRemoteUri(_0x4d9f73){var _0x54df18=_0x4d9f73[_0x191d('0x3b')](-0x1);if(_0x54df18==='/')return _0x4d9f73[_0x191d('0x3c')](0x0,_0x4d9f73['lastIndexOf'](_0x54df18));return _0x4d9f73;}function getWebApiUrl(_0x11ce63){return util[_0x191d('0x3d')](_0x191d('0x3e'),_0x11ce63);}exports[_0x191d('0x3f')]=function(_0x5a884f,_0x1e2d7f){var _0x46a1b9=_0x5a884f[_0x191d('0x15')][_0x191d('0x40')];var _0x286309=_0x46a1b9===_0x191d('0x41')?_0x191d('0x42'):'PhoneCall';var _0x162551='';var _0x7d13ac='';var _0x42e700='';var _0x22aec9='';var _0x4d7837='';var _0xc39009='';var _0x3bddf9='';var _0x179df4='';var _0x20edbd=[_0x191d('0x43'),_0x191d('0x44'),_0x191d('0x45'),'ownerid','caseorigincode',_0x191d('0x46'),_0x191d('0x47'),_0x191d('0x48'),'directioncode',_0x191d('0x49')];var _0x549b06=['accountidname','accountidyominame',_0x191d('0x4a'),_0x191d('0x4b'),_0x191d('0x4c'),'contactidyominame',_0x191d('0x4d'),_0x191d('0x4e'),_0x191d('0x4f'),_0x191d('0x50'),'createdbyname','createdbyyominame','createdon',_0x191d('0x51'),_0x191d('0x52'),_0x191d('0x53'),'customeridtype',_0x191d('0x54'),'emailaddress','entitlementidname',_0x191d('0x55'),_0x191d('0x56'),_0x191d('0x57'),_0x191d('0x58'),_0x191d('0x59'),_0x191d('0x5a'),_0x191d('0x5b'),_0x191d('0x5c'),_0x191d('0x5d'),_0x191d('0x5e'),'masteridname',_0x191d('0x5f'),_0x191d('0x60'),_0x191d('0x61'),'modifiedbyyominame',_0x191d('0x62'),_0x191d('0x63'),_0x191d('0x64'),'msdyn_incidenttypename',_0x191d('0x65'),_0x191d('0x66'),'onholdtime',_0x191d('0x67'),_0x191d('0x68'),_0x191d('0x69'),_0x191d('0x6a'),_0x191d('0x6b'),'primarycontactidname','primarycontactidyominame',_0x191d('0x6c'),_0x191d('0x6d'),_0x191d('0x6e'),_0x191d('0x6f'),_0x191d('0x70'),'responseby',_0x191d('0x71'),'responsiblecontactidyominame',_0x191d('0x72'),'slainvokedidname',_0x191d('0x73'),_0x191d('0x74'),_0x191d('0x75'),_0x191d('0x76'),_0x191d('0x77'),_0x191d('0x78'),_0x191d('0x79'),_0x191d('0x7a'),_0x191d('0x7b'),_0x191d('0x7c'),_0x191d('0x7d')];var _0x2da8c7=_0x20edbd['concat'](_0x549b06);return db[_0x191d('0x11')][_0x191d('0x31')]({'where':{'id':_0x5a884f[_0x191d('0x2b')]['id']},'attributes':['id',_0x191d('0x7e'),_0x191d('0x7f'),_0x191d('0x80'),_0x191d('0x81'),_0x191d('0x82'),_0x191d('0x83'),_0x191d('0x84')],'include':[{'model':db[_0x191d('0x85')],'as':_0x191d('0x85'),'attributes':['id',_0x191d('0x86'),_0x191d('0x87')]}]})[_0x191d('0xc')](handleEntityNotFound(_0x1e2d7f,null))['then'](function(_0x138503){if(_0x138503){if(_0x138503[_0x191d('0x84')]){_0x138503[_0x191d('0x88')]=_0x138503[_0x191d('0x85')][_0x191d('0x86')];_0x179df4=sanitizeRemoteUri(_0x138503[_0x191d('0x85')][_0x191d('0x87')]);_0x3bddf9=getWebApiUrl(_0x179df4);return _0x138503;}_0x179df4=sanitizeRemoteUri(_0x138503[_0x191d('0x80')]);_0x3bddf9=getWebApiUrl(_0x179df4);var _0x53a684={'method':_0x191d('0x89'),'uri':'https://login.microsoftonline.com/'+_0x138503['tenantId']+_0x191d('0x8a'),'form':{'client_id':_0x138503['clientId'],'resource':_0x179df4,'username':_0x138503[_0x191d('0x7e')],'password':_0x138503[_0x191d('0x7f')],'grant_type':_0x191d('0x7f'),'client_secret':_0x138503[_0x191d('0x83')]},'json':!![]};return rp(_0x53a684);}})[_0x191d('0xc')](function(_0xe811ee){_0xc39009=_0xe811ee[_0x191d('0x88')];var _0x44b9b8={'method':_0x191d('0x8b'),'uri':encodeURI(_0x3bddf9+_0x191d('0x8c')+_0x286309+'\x27'),'headers':{'Authorization':_0x191d('0x8d')+_0xc39009,'If-None-Match':null,'OData-Version':_0x191d('0x8e')},'json':!![]};return rp(_0x44b9b8);})[_0x191d('0xc')](function(_0x660d2c){var _0x115a44=_0x660d2c['value'][0x0];var _0x4a75eb=_0x115a44['MetadataId'];var _0x3adbcb={'method':_0x191d('0x8b'),'uri':_0x3bddf9+'EntityDefinitions('+_0x4a75eb+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0xc39009,'If-None-Match':null,'OData-Version':_0x191d('0x8e')},'json':!![]};return rp(_0x3adbcb);})[_0x191d('0xc')](function(_0x29c254){_0x162551=_0x29c254;_0x7d13ac=_0x162551[_0x191d('0x8f')];_0x7d13ac=_[_0x191d('0x90')](_0x7d13ac,function(_0x230c9c){return!_0x2da8c7[_0x191d('0x91')](_0x230c9c[_0x191d('0x92')]);});var _0x80be18=[];var _0x183833=[];_0x7d13ac['forEach'](function(_0x348f85){if(_0x348f85[_0x191d('0x93')]){var _0x5b131f=_0x348f85[_0x191d('0x93')][_0x191d('0x3c')](_0x348f85[_0x191d('0x93')]['lastIndexOf']('.')+0x1);if(_0x5b131f===_0x191d('0x94')){_0x80be18[_0x191d('0x95')](getSelectList(_0x3bddf9,_0x46a1b9,_0x183833,_0x162551[_0x191d('0x96')],_0x348f85['MetadataId'],_0xc39009));}}});return Promise['all'](_0x80be18);})[_0x191d('0xc')](function(_0x475ad6){_0x42e700=_0x475ad6[0x0];var _0x5a1111=[];var _0x38f2a5=[];_0x7d13ac['forEach'](function(_0x5ba723){if(!_['isNil'](_0x5ba723[_0x191d('0x93')])){var _0x17bfcf=_0x5ba723[_0x191d('0x93')][_0x191d('0x3c')](_0x5ba723[_0x191d('0x93')][_0x191d('0x97')]('.')+0x1);if(_0x17bfcf===_0x191d('0x98')){_0x5a1111['push'](getBooleanList(_0x3bddf9,_0x46a1b9,_0x38f2a5,_0x162551[_0x191d('0x96')],_0x5ba723['MetadataId'],_0xc39009));}}});return Promise['all'](_0x5a1111);})[_0x191d('0xc')](function(_0x44b6ee){_0x22aec9=_0x44b6ee[0x0];var _0x4007c7=[];var _0x553755=[];_0x7d13ac[_0x191d('0x99')](function(_0x481bfa){if(_0x481bfa[_0x191d('0x93')]){var _0x52a76f=_0x481bfa['@odata.type'][_0x191d('0x3c')](_0x481bfa[_0x191d('0x93')]['lastIndexOf']('.')+0x1);if(_0x52a76f==='StringAttributeMetadata'||_0x52a76f===_0x191d('0x9a')||_0x52a76f===_0x191d('0x9b')||_0x52a76f==='IntegerAttributeMetadata'||_0x52a76f==='MemoAttributeMetadata'||_0x52a76f===_0x191d('0x9c')||_0x52a76f===_0x191d('0x9d')||_0x52a76f===_0x191d('0x9e')||_0x52a76f===_0x191d('0x9f')||_0x52a76f==='DecimalAttributeMetadata'){_0x4007c7[_0x191d('0x95')](getInputList(_0x3bddf9,_0x46a1b9,_0x52a76f,_0x553755,_0x162551[_0x191d('0x96')],_0x481bfa[_0x191d('0x96')],_0xc39009));}}});return Promise[_0x191d('0xa0')](_0x4007c7);})['then'](function(_0x2fc299){_0x4d7837=_0x2fc299[0x0];var _0x3897b9=_0x42e700[_0x191d('0xa1')](_0x22aec9)['concat'](_0x4d7837);var _0x434741={'count':_0x3897b9[_0x191d('0x1c')],'rows':_0x3897b9};return _0x434741;})[_0x191d('0xc')](respondWithResult(_0x1e2d7f,null))[_0x191d('0x29')](function(_0x363fc1){var _0x22196c=_0x5a884f[_0x191d('0x15')][_0x191d('0xa2')]?0x1f4:_0x363fc1[_0x191d('0xa3')]||0x1f4;logger[_0x191d('0xa4')](_0x363fc1[_0x191d('0xe')]);delete _0x363fc1[_0x191d('0xf')];if(_0x22196c===0x191){_0x22196c=0x190;}_0x1e2d7f[_0x191d('0x5')](_0x22196c)[_0x191d('0xa5')](_0x5a884f[_0x191d('0x15')][_0x191d('0xa2')]?{'message':'Wrong\x20credentials','statusCode':_0x363fc1[_0x191d('0xa3')]}:_0x363fc1);});};function getSelectList(_0x36bda0,_0x35b56a,_0x50e142,_0x51c96d,_0x14a17c,_0x476cb4){var _0x5da812={'method':_0x191d('0x8b'),'uri':_0x36bda0+'EntityDefinitions('+_0x51c96d+_0x191d('0xa6')+_0x14a17c+_0x191d('0xa7')+_0x191d('0xa8'),'headers':{'Authorization':'Bearer\x20'+_0x476cb4,'If-None-Match':null,'OData-Version':_0x191d('0x8e')},'json':!![]};return rp(_0x5da812)[_0x191d('0xc')](function(_0x1a32ca){var _0x30018f=[];var _0x1ee3f2=_0x1a32ca[_0x191d('0xa9')][_0x191d('0xaa')];_0x1ee3f2['forEach'](function(_0x1b5b18){_0x30018f[_0x191d('0x95')]({'name':_0x1b5b18[_0x191d('0xab')][_0x191d('0xac')][_0x191d('0xab')],'value':String(_0x1b5b18[_0x191d('0xad')])});});var _0x11553b={'id':_0x35b56a+'_'+_0x1a32ca[_0x191d('0x92')],'name':_0x1a32ca[_0x191d('0xae')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x30018f};_0x50e142[_0x191d('0x95')](_0x11553b);return _0x50e142;});}function getBooleanList(_0x201c16,_0x3289f0,_0x3d9748,_0x3a1b02,_0xb3d94d,_0x5d0128){var _0x33c754={'method':_0x191d('0x8b'),'uri':_0x201c16+_0x191d('0xaf')+_0x3a1b02+_0x191d('0xa6')+_0xb3d94d+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x5d0128,'If-None-Match':null,'OData-Version':_0x191d('0x8e')},'json':!![]};return rp(_0x33c754)[_0x191d('0xc')](function(_0x11534c){var _0x352bf3=[];_0x352bf3['push']({'name':_0x11534c['OptionSet'][_0x191d('0xb0')][_0x191d('0xab')][_0x191d('0xac')][_0x191d('0xab')],'value':_0x191d('0xb1')},{'name':_0x11534c['OptionSet'][_0x191d('0xb2')][_0x191d('0xab')][_0x191d('0xac')][_0x191d('0xab')],'value':'false'});var _0x40ae24={'id':_0x3289f0+'_'+_0x11534c['LogicalName'],'name':_0x11534c[_0x191d('0xae')]['UserLocalizedLabel'][_0x191d('0xab')],'custom':![],'options':_0x352bf3};_0x3d9748[_0x191d('0x95')](_0x40ae24);return _0x3d9748;});}function getInputList(_0x11be47,_0x53612b,_0x4a1442,_0xe06d34,_0x2e3095,_0x29c6de,_0x339465){var _0x22a184={'method':_0x191d('0x8b'),'uri':_0x11be47+_0x191d('0xaf')+_0x2e3095+_0x191d('0xa6')+_0x29c6de+_0x191d('0xb3')+_0x4a1442+_0x191d('0xb4'),'headers':{'Authorization':_0x191d('0x8d')+_0x339465,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x22a184)['then'](function(_0x30c059){var _0x2602ed={'id':_0x53612b+'_'+_0x30c059['LogicalName'],'name':_0x30c059[_0x191d('0xae')]['UserLocalizedLabel']?_0x30c059[_0x191d('0xae')][_0x191d('0xac')][_0x191d('0xab')]:_0x30c059['LogicalName'],'custom':![],'options':[]};_0xe06d34['push'](_0x2602ed);return _0xe06d34;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index c1164ad..8e1893e 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x19edc1,_0x5d5ba9){var _0x8073ab=function(_0x27ec17){while(--_0x27ec17){_0x19edc1['push'](_0x19edc1['shift']());}};_0x8073ab(++_0x5d5ba9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x688348,_0x1e65a1){var _0x4da52c=function(_0x20d945){while(--_0x20d945){_0x688348['push'](_0x688348['shift']());}};_0x4da52c(++_0x1e65a1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 96dfe97..2d3e394 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 _0xed5c=['moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Dynamics365Account','findAll','raw','options','where','attributes','limit','include','map','model','GetDynamics365Account','ShowDynamics365Account','find','util'];(function(_0x237bb6,_0x385c71){var _0x49ee06=function(_0x5a1648){while(--_0x5a1648){_0x237bb6['push'](_0x237bb6['shift']());}};_0x49ee06(++_0x385c71);}(_0xed5c,0x13f));var _0xced5=function(_0x84e387,_0x4a90d4){_0x84e387=_0x84e387-0x0;var _0x2866be=_0xed5c[_0x84e387];return _0x2866be;};'use strict';var _=require('lodash');var util=require(_0xced5('0x0'));var moment=require(_0xced5('0x1'));var BPromise=require('bluebird');var rs=require(_0xced5('0x2'));var fs=require('fs');var Redis=require(_0xced5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xced5('0x4'))(_0xced5('0x5'));var config=require('../../config/environment');var jayson=require(_0xced5('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbe7aba,_0x1899af,_0x6a58b9){return new BPromise(function(_0x4ecf0b,_0x15cbe6){return client[_0xced5('0x7')](_0xbe7aba,_0x6a58b9)[_0xced5('0x8')](function(_0x5a708d){logger[_0xced5('0x9')](_0xced5('0xa'),_0x1899af,_0xced5('0xb'));logger[_0xced5('0xc')](_0xced5('0xd'),_0x1899af,_0xced5('0xb'),JSON[_0xced5('0xe')](_0x5a708d));if(_0x5a708d[_0xced5('0xf')]){if(_0x5a708d['error'][_0xced5('0x10')]===0x1f4){logger['error'](_0xced5('0xa'),_0x1899af,_0x5a708d[_0xced5('0xf')][_0xced5('0x11')]);return _0x15cbe6(_0x5a708d[_0xced5('0xf')][_0xced5('0x11')]);}logger[_0xced5('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x1899af,_0x5a708d['error']['message']);return _0x4ecf0b(_0x5a708d[_0xced5('0xf')][_0xced5('0x11')]);}else{logger[_0xced5('0x9')](_0xced5('0xa'),_0x1899af,_0xced5('0xb'));_0x4ecf0b(_0x5a708d['result'][_0xced5('0x11')]);}})[_0xced5('0x12')](function(_0x417b4e){logger['error'](_0xced5('0xa'),_0x1899af,_0x417b4e);_0x15cbe6(_0x417b4e);});});}exports['GetDynamics365Account']=function(_0x4a8f6c){var _0x30f530=this;return new Promise(function(_0xed0529,_0x268d08){return db[_0xced5('0x13')][_0xced5('0x14')]({'raw':_0x4a8f6c['options']?_0x4a8f6c['options'][_0xced5('0x15')]===undefined?!![]:![]:!![],'where':_0x4a8f6c[_0xced5('0x16')]?_0x4a8f6c[_0xced5('0x16')][_0xced5('0x17')]||null:null,'attributes':_0x4a8f6c['options']?_0x4a8f6c[_0xced5('0x16')][_0xced5('0x18')]||null:null,'limit':_0x4a8f6c['options']?_0x4a8f6c[_0xced5('0x16')][_0xced5('0x19')]||null:null,'include':_0x4a8f6c['options']?_0x4a8f6c['options'][_0xced5('0x1a')]?_[_0xced5('0x1b')](_0x4a8f6c[_0xced5('0x16')]['include'],function(_0x33ae3d){return{'model':db[_0x33ae3d[_0xced5('0x1c')]],'as':_0x33ae3d['as'],'attributes':_0x33ae3d['attributes'],'include':_0x33ae3d['include']?_[_0xced5('0x1b')](_0x33ae3d[_0xced5('0x1a')],function(_0xcc13c1){return{'model':db[_0xcc13c1[_0xced5('0x1c')]],'as':_0xcc13c1['as'],'attributes':_0xcc13c1[_0xced5('0x18')],'include':_0xcc13c1['include']?_['map'](_0xcc13c1[_0xced5('0x1a')],function(_0x311b18){return{'model':db[_0x311b18['model']],'as':_0x311b18['as'],'attributes':_0x311b18['attributes']};}):[]};}):[]};}):[]:[]})[_0xced5('0x8')](function(_0x58c1a0){logger[_0xced5('0x9')](_0xced5('0x1d'),_0x4a8f6c);logger[_0xced5('0xc')](_0xced5('0x1d'),_0x4a8f6c,JSON['stringify'](_0x58c1a0));_0xed0529(_0x58c1a0);})[_0xced5('0x12')](function(_0x349d1a){logger[_0xced5('0xf')](_0xced5('0x1d'),_0x349d1a[_0xced5('0x11')],_0x4a8f6c);_0x268d08(_0x30f530['error'](0x1f4,_0x349d1a[_0xced5('0x11')]));});});};exports[_0xced5('0x1e')]=function(_0x47e274){var _0x4f962d=this;return new Promise(function(_0x50b1ce,_0x310b0a){return db[_0xced5('0x13')][_0xced5('0x1f')]({'raw':_0x47e274[_0xced5('0x16')]?_0x47e274['options']['raw']===undefined?!![]:![]:!![],'where':_0x47e274[_0xced5('0x16')]?_0x47e274[_0xced5('0x16')][_0xced5('0x17')]||null:null,'attributes':_0x47e274[_0xced5('0x16')]?_0x47e274[_0xced5('0x16')][_0xced5('0x18')]||null:null,'include':_0x47e274['options']?_0x47e274['options'][_0xced5('0x1a')]?_[_0xced5('0x1b')](_0x47e274[_0xced5('0x16')][_0xced5('0x1a')],function(_0x3bbcc8){return{'model':db[_0x3bbcc8[_0xced5('0x1c')]],'as':_0x3bbcc8['as'],'attributes':_0x3bbcc8[_0xced5('0x18')],'include':_0x3bbcc8[_0xced5('0x1a')]?_[_0xced5('0x1b')](_0x3bbcc8[_0xced5('0x1a')],function(_0x363a71){return{'model':db[_0x363a71[_0xced5('0x1c')]],'as':_0x363a71['as'],'attributes':_0x363a71[_0xced5('0x18')],'include':_0x363a71['include']?_['map'](_0x363a71['include'],function(_0x489c6c){return{'model':db[_0x489c6c['model']],'as':_0x489c6c['as'],'attributes':_0x489c6c[_0xced5('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44cf18){logger[_0xced5('0x9')](_0xced5('0x1e'),_0x47e274);logger[_0xced5('0xc')](_0xced5('0x1e'),_0x47e274,JSON[_0xced5('0xe')](_0x44cf18));_0x50b1ce(_0x44cf18);})['catch'](function(_0x34b9bb){logger[_0xced5('0xf')]('ShowDynamics365Account',_0x34b9bb[_0xced5('0x11')],_0x47e274);_0x310b0a(_0x4f962d['error'](0x1f4,_0x34b9bb['message']));});});}; \ No newline at end of file +var _0x8e0f=['catch','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','GetDynamics365Account','options','where','attributes','limit','include','map','model'];(function(_0x21238c,_0x46e9e1){var _0x1cdd7b=function(_0x1d7c52){while(--_0x1d7c52){_0x21238c['push'](_0x21238c['shift']());}};_0x1cdd7b(++_0x46e9e1);}(_0x8e0f,0xad));var _0xf8e0=function(_0x352bff,_0x4b2145){_0x352bff=_0x352bff-0x0;var _0x109e5c=_0x8e0f[_0x352bff];return _0x109e5c;};'use strict';var _=require(_0xf8e0('0x0'));var util=require(_0xf8e0('0x1'));var moment=require('moment');var BPromise=require(_0xf8e0('0x2'));var rs=require(_0xf8e0('0x3'));var fs=require('fs');var Redis=require(_0xf8e0('0x4'));var db=require(_0xf8e0('0x5'))['db'];var utils=require(_0xf8e0('0x6'));var logger=require(_0xf8e0('0x7'))(_0xf8e0('0x8'));var config=require('../../config/environment');var jayson=require(_0xf8e0('0x9'));var client=jayson[_0xf8e0('0xa')][_0xf8e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa3144d,_0x4ee27c,_0x48bbe2){return new BPromise(function(_0x12a43d,_0x2d2e48){return client[_0xf8e0('0xc')](_0xa3144d,_0x48bbe2)[_0xf8e0('0xd')](function(_0xaae8c7){logger[_0xf8e0('0xe')](_0xf8e0('0xf'),_0x4ee27c,'request\x20sent');logger[_0xf8e0('0x10')](_0xf8e0('0x11'),_0x4ee27c,_0xf8e0('0x12'),JSON[_0xf8e0('0x13')](_0xaae8c7));if(_0xaae8c7[_0xf8e0('0x14')]){if(_0xaae8c7['error'][_0xf8e0('0x15')]===0x1f4){logger[_0xf8e0('0x14')](_0xf8e0('0xf'),_0x4ee27c,_0xaae8c7['error'][_0xf8e0('0x16')]);return _0x2d2e48(_0xaae8c7['error'][_0xf8e0('0x16')]);}logger[_0xf8e0('0x14')](_0xf8e0('0xf'),_0x4ee27c,_0xaae8c7[_0xf8e0('0x14')][_0xf8e0('0x16')]);return _0x12a43d(_0xaae8c7[_0xf8e0('0x14')][_0xf8e0('0x16')]);}else{logger[_0xf8e0('0xe')](_0xf8e0('0xf'),_0x4ee27c,_0xf8e0('0x12'));_0x12a43d(_0xaae8c7['result'][_0xf8e0('0x16')]);}})['catch'](function(_0x5980e6){logger[_0xf8e0('0x14')]('Dynamics365Account,\x20%s,\x20%s',_0x4ee27c,_0x5980e6);_0x2d2e48(_0x5980e6);});});}exports[_0xf8e0('0x17')]=function(_0x163da0){var _0x32fd82=this;return new Promise(function(_0x13992f,_0x72ac14){return db['Dynamics365Account']['findAll']({'raw':_0x163da0['options']?_0x163da0[_0xf8e0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x163da0[_0xf8e0('0x18')]?_0x163da0[_0xf8e0('0x18')][_0xf8e0('0x19')]||null:null,'attributes':_0x163da0[_0xf8e0('0x18')]?_0x163da0[_0xf8e0('0x18')][_0xf8e0('0x1a')]||null:null,'limit':_0x163da0[_0xf8e0('0x18')]?_0x163da0[_0xf8e0('0x18')][_0xf8e0('0x1b')]||null:null,'include':_0x163da0[_0xf8e0('0x18')]?_0x163da0[_0xf8e0('0x18')][_0xf8e0('0x1c')]?_[_0xf8e0('0x1d')](_0x163da0[_0xf8e0('0x18')][_0xf8e0('0x1c')],function(_0x1b6a10){return{'model':db[_0x1b6a10[_0xf8e0('0x1e')]],'as':_0x1b6a10['as'],'attributes':_0x1b6a10[_0xf8e0('0x1a')],'include':_0x1b6a10[_0xf8e0('0x1c')]?_['map'](_0x1b6a10[_0xf8e0('0x1c')],function(_0x80437){return{'model':db[_0x80437[_0xf8e0('0x1e')]],'as':_0x80437['as'],'attributes':_0x80437['attributes'],'include':_0x80437['include']?_[_0xf8e0('0x1d')](_0x80437[_0xf8e0('0x1c')],function(_0x24c7ae){return{'model':db[_0x24c7ae['model']],'as':_0x24c7ae['as'],'attributes':_0x24c7ae[_0xf8e0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf8e0('0xd')](function(_0x1d4035){logger[_0xf8e0('0xe')]('GetDynamics365Account',_0x163da0);logger[_0xf8e0('0x10')](_0xf8e0('0x17'),_0x163da0,JSON[_0xf8e0('0x13')](_0x1d4035));_0x13992f(_0x1d4035);})[_0xf8e0('0x1f')](function(_0x403b8e){logger['error'](_0xf8e0('0x17'),_0x403b8e[_0xf8e0('0x16')],_0x163da0);_0x72ac14(_0x32fd82['error'](0x1f4,_0x403b8e[_0xf8e0('0x16')]));});});};exports[_0xf8e0('0x20')]=function(_0x208a08){var _0x461e4e=this;return new Promise(function(_0x575243,_0x45c966){return db['Dynamics365Account'][_0xf8e0('0x21')]({'raw':_0x208a08[_0xf8e0('0x18')]?_0x208a08[_0xf8e0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x208a08[_0xf8e0('0x18')]?_0x208a08[_0xf8e0('0x18')][_0xf8e0('0x19')]||null:null,'attributes':_0x208a08[_0xf8e0('0x18')]?_0x208a08[_0xf8e0('0x18')][_0xf8e0('0x1a')]||null:null,'include':_0x208a08[_0xf8e0('0x18')]?_0x208a08[_0xf8e0('0x18')][_0xf8e0('0x1c')]?_[_0xf8e0('0x1d')](_0x208a08[_0xf8e0('0x18')][_0xf8e0('0x1c')],function(_0x5c0904){return{'model':db[_0x5c0904[_0xf8e0('0x1e')]],'as':_0x5c0904['as'],'attributes':_0x5c0904[_0xf8e0('0x1a')],'include':_0x5c0904[_0xf8e0('0x1c')]?_['map'](_0x5c0904[_0xf8e0('0x1c')],function(_0x30cabd){return{'model':db[_0x30cabd[_0xf8e0('0x1e')]],'as':_0x30cabd['as'],'attributes':_0x30cabd[_0xf8e0('0x1a')],'include':_0x30cabd['include']?_[_0xf8e0('0x1d')](_0x30cabd[_0xf8e0('0x1c')],function(_0x1d41e2){return{'model':db[_0x1d41e2[_0xf8e0('0x1e')]],'as':_0x1d41e2['as'],'attributes':_0x1d41e2[_0xf8e0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf8e0('0xd')](function(_0x2070a5){logger[_0xf8e0('0xe')](_0xf8e0('0x20'),_0x208a08);logger['debug'](_0xf8e0('0x20'),_0x208a08,JSON[_0xf8e0('0x13')](_0x2070a5));_0x575243(_0x2070a5);})[_0xf8e0('0x1f')](function(_0x4221e5){logger['error'](_0xf8e0('0x20'),_0x4221e5[_0xf8e0('0x16')],_0x208a08);_0x45c966(_0x461e4e['error'](0x1f4,_0x4221e5[_0xf8e0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a3fee85..e7c76de 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 _0x4ffa=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','post','put','update','delete','exports','path','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ffa,0x124));var _0xa4ff=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x4ffa[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa4ff('0x0'));var timeout=require('connect-timeout');var express=require(_0xa4ff('0x1'));var router=express[_0xa4ff('0x2')]();var fs_extra=require(_0xa4ff('0x3'));var auth=require(_0xa4ff('0x4'));var interaction=require(_0xa4ff('0x5'));var config=require(_0xa4ff('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xa4ff('0x7')]('/',auth[_0xa4ff('0x8')](),controller[_0xa4ff('0x9')]);router['get'](_0xa4ff('0xa'),auth['isAuthenticated'](),controller[_0xa4ff('0xb')]);router[_0xa4ff('0x7')](_0xa4ff('0xc'),auth['isAuthenticated'](),controller[_0xa4ff('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xa4ff('0xe')]);router[_0xa4ff('0x7')](_0xa4ff('0xf'),auth[_0xa4ff('0x8')](),controller['getDescriptions']);router[_0xa4ff('0x10')]('/',auth[_0xa4ff('0x8')](),controller['create']);router[_0xa4ff('0x11')](_0xa4ff('0xa'),auth['isAuthenticated'](),controller[_0xa4ff('0x12')]);router[_0xa4ff('0x13')]('/:id',auth[_0xa4ff('0x8')](),controller['destroy']);module[_0xa4ff('0x14')]=router; \ No newline at end of file +var _0x72a1=['getDescriptions','post','create','put','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/subjects','/:id/descriptions'];(function(_0x3cbdb0,_0x5d5212){var _0x4d6fd7=function(_0x31bad4){while(--_0x31bad4){_0x3cbdb0['push'](_0x3cbdb0['shift']());}};_0x4d6fd7(++_0x5d5212);}(_0x72a1,0x1ce));var _0x172a=function(_0x550b6b,_0x4d7eec){_0x550b6b=_0x550b6b-0x0;var _0x3dfafa=_0x72a1[_0x550b6b];return _0x3dfafa;};'use strict';var multer=require('multer');var util=require(_0x172a('0x0'));var path=require('path');var timeout=require(_0x172a('0x1'));var express=require('express');var router=express[_0x172a('0x2')]();var fs_extra=require(_0x172a('0x3'));var auth=require(_0x172a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x172a('0x5'));var controller=require('./intDynamics365Configuration.controller');router[_0x172a('0x6')]('/',auth['isAuthenticated'](),controller[_0x172a('0x7')]);router['get'](_0x172a('0x8'),auth[_0x172a('0x9')](),controller[_0x172a('0xa')]);router[_0x172a('0x6')]('/:id/fields',auth[_0x172a('0x9')](),controller['getFields']);router[_0x172a('0x6')](_0x172a('0xb'),auth[_0x172a('0x9')](),controller['getSubjects']);router[_0x172a('0x6')](_0x172a('0xc'),auth[_0x172a('0x9')](),controller[_0x172a('0xd')]);router[_0x172a('0xe')]('/',auth['isAuthenticated'](),controller[_0x172a('0xf')]);router[_0x172a('0x10')](_0x172a('0x8'),auth[_0x172a('0x9')](),controller['update']);router[_0x172a('0x11')](_0x172a('0x8'),auth[_0x172a('0x9')](),controller['destroy']);module[_0x172a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index ba02ec8..61820ad 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 _0x762f=['ENUM','contact','nothing','BOOLEAN','exports','STRING','incident','phonecall'];(function(_0x2794fc,_0x290afa){var _0x3b786a=function(_0xeb5695){while(--_0xeb5695){_0x2794fc['push'](_0x2794fc['shift']());}};_0x3b786a(++_0x290afa);}(_0x762f,0x1a4));var _0xf762=function(_0x18e570,_0x257e84){_0x18e570=_0x18e570-0x0;var _0x2a421e=_0x762f[_0x18e570];return _0x2a421e;};'use strict';var Sequelize=require('sequelize');module[_0xf762('0x0')]={'name':{'type':Sequelize[_0xf762('0x1')]},'description':{'type':Sequelize[_0xf762('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xf762('0x2'),_0xf762('0x3')),'defaultValue':_0xf762('0x2')},'moduleCreate':{'type':Sequelize[_0xf762('0x4')](_0xf762('0x5'),_0xf762('0x6')),'defaultValue':_0xf762('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xf762('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xf762('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9960=['STRING','ENUM','incident','phonecall','contact','nothing','BOOLEAN','exports'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0x9960,0xd7));var _0x0996=function(_0x5e4c8a,_0x39abf4){_0x5e4c8a=_0x5e4c8a-0x0;var _0x79c628=_0x9960[_0x5e4c8a];return _0x79c628;};'use strict';var Sequelize=require('sequelize');module[_0x0996('0x0')]={'name':{'type':Sequelize[_0x0996('0x1')]},'description':{'type':Sequelize[_0x0996('0x1')]},'ticketType':{'type':Sequelize[_0x0996('0x2')](_0x0996('0x3'),_0x0996('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM'](_0x0996('0x5'),_0x0996('0x6')),'defaultValue':_0x0996('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x0996('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x0996('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 08df300..a8b31ec 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 _0xd7b2=['key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','getFields','findOne','hasOwnProperty','getSubjects','Dynamics365Field','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','index','map','Dynamics365Configuration','rawAttributes','type'];(function(_0x53441a,_0x42ee13){var _0x53ab65=function(_0x258eb6){while(--_0x258eb6){_0x53441a['push'](_0x53441a['shift']());}};_0x53ab65(++_0x42ee13);}(_0xd7b2,0x76));var _0x2d7b=function(_0x373a0c,_0x4f44b5){_0x373a0c=_0x373a0c-0x0;var _0x4f0f61=_0xd7b2[_0x373a0c];return _0x4f0f61;};'use strict';var emlformat=require(_0x2d7b('0x0'));var rimraf=require(_0x2d7b('0x1'));var zipdir=require(_0x2d7b('0x2'));var jsonpatch=require(_0x2d7b('0x3'));var rp=require(_0x2d7b('0x4'));var moment=require(_0x2d7b('0x5'));var BPromise=require(_0x2d7b('0x6'));var Mustache=require(_0x2d7b('0x7'));var util=require(_0x2d7b('0x8'));var path=require(_0x2d7b('0x9'));var sox=require(_0x2d7b('0xa'));var csv=require('to-csv');var ejs=require(_0x2d7b('0xb'));var fs=require('fs');var fs_extra=require(_0x2d7b('0xc'));var _=require(_0x2d7b('0xd'));var squel=require(_0x2d7b('0xe'));var crypto=require(_0x2d7b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2d7b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2d7b('0x11'));var Papa=require(_0x2d7b('0x12'));var Redis=require(_0x2d7b('0x13'));var authService=require(_0x2d7b('0x14'));var qs=require(_0x2d7b('0x15'));var as=require(_0x2d7b('0x16'));var hardwareService=require(_0x2d7b('0x17'));var logger=require(_0x2d7b('0x18'))(_0x2d7b('0x19'));var utils=require(_0x2d7b('0x1a'));var config=require(_0x2d7b('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x204cea,_0x186125){_0x186125=_0x186125||0xcc;return function(_0x18e4d0){if(_0x18e4d0){return _0x204cea[_0x2d7b('0x1c')](_0x186125);}return _0x204cea[_0x2d7b('0x1d')](_0x186125)[_0x2d7b('0x1e')]();};}function respondWithResult(_0x4d46b7,_0x430e86){_0x430e86=_0x430e86||0xc8;return function(_0xc47e2){if(_0xc47e2){return _0x4d46b7[_0x2d7b('0x1d')](_0x430e86)[_0x2d7b('0x1f')](_0xc47e2);}};}function respondWithFilteredResult(_0x5c1781,_0x22e878){return function(_0x3bb78d){if(_0x3bb78d){var _0x2b3d75=typeof _0x22e878[_0x2d7b('0x20')]===_0x2d7b('0x21')&&typeof _0x22e878[_0x2d7b('0x22')]===_0x2d7b('0x21');var _0x8bfaeb=_0x3bb78d[_0x2d7b('0x23')];var _0x4fcebe=_0x2b3d75?0x0:_0x22e878[_0x2d7b('0x20')];var _0x166474=_0x2b3d75?_0x3bb78d[_0x2d7b('0x23')]:_0x22e878['offset']+_0x22e878[_0x2d7b('0x22')];var _0x1cf46a;if(_0x166474>=_0x8bfaeb){_0x166474=_0x8bfaeb;_0x1cf46a=0xc8;}else{_0x1cf46a=0xce;}_0x5c1781[_0x2d7b('0x1d')](_0x1cf46a);return _0x5c1781[_0x2d7b('0x24')]('Content-Range',_0x4fcebe+'-'+_0x166474+'/'+_0x8bfaeb)[_0x2d7b('0x1f')](_0x3bb78d);}return null;};}function patchUpdates(_0x374baa){return function(_0x443400){try{jsonpatch['apply'](_0x443400,_0x374baa,!![]);}catch(_0x944814){return BPromise[_0x2d7b('0x25')](_0x944814);}return _0x443400[_0x2d7b('0x26')]();};}function saveUpdates(_0x16d3a2,_0x38f2d2){return function(_0x44b1f0){if(_0x44b1f0){return _0x44b1f0[_0x2d7b('0x27')](_0x16d3a2)[_0x2d7b('0x28')](function(_0x3907a6){return _0x3907a6;});}return null;};}function removeEntity(_0x58e772,_0x575824){return function(_0x3e170e){if(_0x3e170e){return _0x3e170e[_0x2d7b('0x29')]()[_0x2d7b('0x28')](function(){_0x58e772[_0x2d7b('0x1d')](0xcc)[_0x2d7b('0x1e')]();});}};}function handleEntityNotFound(_0x38da62,_0x2c29af){return function(_0x19ee01){if(!_0x19ee01){_0x38da62[_0x2d7b('0x1c')](0x194);}return _0x19ee01;};}function handleError(_0x177b5a,_0x40020c){_0x40020c=_0x40020c||0x1f4;return function(_0x1e8704){logger[_0x2d7b('0x2a')](_0x1e8704[_0x2d7b('0x2b')]);if(_0x1e8704[_0x2d7b('0x2c')]){delete _0x1e8704[_0x2d7b('0x2c')];}_0x177b5a['status'](_0x40020c)['send'](_0x1e8704);};}exports[_0x2d7b('0x2d')]=function(_0x2f9dd7,_0x1103e7){var _0x406b52={},_0x3897f4={},_0x5586b4={'count':0x0,'rows':[]};var _0x522a96=_[_0x2d7b('0x2e')](db[_0x2d7b('0x2f')][_0x2d7b('0x30')],function(_0x2f870c){return{'name':_0x2f870c['fieldName'],'type':_0x2f870c[_0x2d7b('0x31')][_0x2d7b('0x32')]};});_0x3897f4[_0x2d7b('0x33')]=_[_0x2d7b('0x2e')](_0x522a96,'name');_0x3897f4[_0x2d7b('0x34')]=_[_0x2d7b('0x35')](_0x2f9dd7[_0x2d7b('0x34')]);_0x3897f4['filters']=_[_0x2d7b('0x36')](_0x3897f4['model'],_0x3897f4['query']);_0x406b52[_0x2d7b('0x37')]=_[_0x2d7b('0x36')](_0x3897f4[_0x2d7b('0x33')],qs[_0x2d7b('0x38')](_0x2f9dd7[_0x2d7b('0x34')][_0x2d7b('0x38')]));_0x406b52[_0x2d7b('0x37')]=_0x406b52['attributes'][_0x2d7b('0x39')]?_0x406b52[_0x2d7b('0x37')]:_0x3897f4['model'];if(!_0x2f9dd7['query']['hasOwnProperty']('nolimit')){_0x406b52[_0x2d7b('0x22')]=qs[_0x2d7b('0x22')](_0x2f9dd7[_0x2d7b('0x34')][_0x2d7b('0x22')]);_0x406b52[_0x2d7b('0x20')]=qs[_0x2d7b('0x20')](_0x2f9dd7['query']['offset']);}_0x406b52[_0x2d7b('0x3a')]=qs[_0x2d7b('0x3b')](_0x2f9dd7[_0x2d7b('0x34')][_0x2d7b('0x3b')]);_0x406b52[_0x2d7b('0x3c')]=qs[_0x2d7b('0x3d')](_[_0x2d7b('0x3e')](_0x2f9dd7[_0x2d7b('0x34')],_0x3897f4[_0x2d7b('0x3d')]),_0x522a96);if(_0x2f9dd7[_0x2d7b('0x34')][_0x2d7b('0x3f')]){_0x406b52[_0x2d7b('0x3c')]=_[_0x2d7b('0x40')](_0x406b52[_0x2d7b('0x3c')],{'$or':_[_0x2d7b('0x2e')](_0x522a96,function(_0x48062b){if(_0x48062b[_0x2d7b('0x31')]!==_0x2d7b('0x41')){var _0x906d0={};_0x906d0[_0x48062b[_0x2d7b('0x2c')]]={'$like':'%'+_0x2f9dd7[_0x2d7b('0x34')][_0x2d7b('0x3f')]+'%'};return _0x906d0;}})});}_0x406b52=_[_0x2d7b('0x40')]({},_0x406b52,_0x2f9dd7[_0x2d7b('0x42')]);var _0x48197c={'where':_0x406b52['where']};return db[_0x2d7b('0x2f')][_0x2d7b('0x23')](_0x48197c)['then'](function(_0x38f8db){_0x5586b4[_0x2d7b('0x23')]=_0x38f8db;if(_0x2f9dd7[_0x2d7b('0x34')][_0x2d7b('0x43')]){_0x406b52['include']=[{'all':!![]}];}return db[_0x2d7b('0x2f')][_0x2d7b('0x44')](_0x406b52);})['then'](function(_0x52f3ae){_0x5586b4[_0x2d7b('0x45')]=_0x52f3ae;return _0x5586b4;})[_0x2d7b('0x28')](respondWithFilteredResult(_0x1103e7,_0x406b52))['catch'](handleError(_0x1103e7,null));};exports[_0x2d7b('0x46')]=function(_0x4d3b8d,_0x45ad98){var _0x11b299={'raw':![],'where':{'id':_0x4d3b8d[_0x2d7b('0x47')]['id']}},_0x61687b={};_0x61687b[_0x2d7b('0x33')]=_[_0x2d7b('0x35')](db[_0x2d7b('0x2f')][_0x2d7b('0x30')]);_0x61687b[_0x2d7b('0x34')]=_[_0x2d7b('0x35')](_0x4d3b8d[_0x2d7b('0x34')]);_0x61687b['filters']=_['intersection'](_0x61687b[_0x2d7b('0x33')],_0x61687b[_0x2d7b('0x34')]);_0x11b299[_0x2d7b('0x37')]=_[_0x2d7b('0x36')](_0x61687b['model'],qs[_0x2d7b('0x38')](_0x4d3b8d['query'][_0x2d7b('0x38')]));_0x11b299[_0x2d7b('0x37')]=_0x11b299[_0x2d7b('0x37')][_0x2d7b('0x39')]?_0x11b299[_0x2d7b('0x37')]:_0x61687b[_0x2d7b('0x33')];if(_0x4d3b8d['query'][_0x2d7b('0x43')]){_0x11b299[_0x2d7b('0x48')]=[{'all':!![]}];}_0x11b299=_['merge']({},_0x11b299,_0x4d3b8d[_0x2d7b('0x42')]);return db[_0x2d7b('0x2f')][_0x2d7b('0x49')](_0x11b299)[_0x2d7b('0x28')](handleEntityNotFound(_0x45ad98,null))[_0x2d7b('0x28')](respondWithResult(_0x45ad98,null))[_0x2d7b('0x4a')](handleError(_0x45ad98,null));};exports['create']=function(_0x1f792d,_0x5b632f){return db[_0x2d7b('0x2f')][_0x2d7b('0x4b')](_0x1f792d['body'],{})[_0x2d7b('0x28')](respondWithResult(_0x5b632f,0xc9))[_0x2d7b('0x4a')](handleError(_0x5b632f,null));};exports['update']=function(_0x4a2989,_0x4d8cfa){if(_0x4a2989[_0x2d7b('0x4c')]['id']){delete _0x4a2989[_0x2d7b('0x4c')]['id'];}return db[_0x2d7b('0x2f')][_0x2d7b('0x49')]({'where':{'id':_0x4a2989[_0x2d7b('0x47')]['id']}})[_0x2d7b('0x28')](handleEntityNotFound(_0x4d8cfa,null))[_0x2d7b('0x28')](saveUpdates(_0x4a2989[_0x2d7b('0x4c')],null))[_0x2d7b('0x28')](respondWithResult(_0x4d8cfa,null))[_0x2d7b('0x4a')](handleError(_0x4d8cfa,null));};exports[_0x2d7b('0x29')]=function(_0x197d8c,_0x22c0e1){return db[_0x2d7b('0x2f')]['find']({'where':{'id':_0x197d8c[_0x2d7b('0x47')]['id']}})['then'](handleEntityNotFound(_0x22c0e1,null))['then'](removeEntity(_0x22c0e1,null))[_0x2d7b('0x4a')](handleError(_0x22c0e1,null));};exports[_0x2d7b('0x4d')]=function(_0x4f4f68,_0x1bfa82,_0x2497b2){var _0x42ef03={};var _0x4260a8={};var _0x95dfa4;var _0x24fbcd;return db[_0x2d7b('0x2f')][_0x2d7b('0x4e')]({'where':{'id':_0x4f4f68[_0x2d7b('0x47')]['id']}})[_0x2d7b('0x28')](handleEntityNotFound(_0x1bfa82,null))[_0x2d7b('0x28')](function(_0x1a3d75){if(_0x1a3d75){_0x95dfa4=_0x1a3d75;_0x4260a8[_0x2d7b('0x33')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x4260a8[_0x2d7b('0x34')]=_[_0x2d7b('0x35')](_0x4f4f68['query']);_0x4260a8['filters']=_[_0x2d7b('0x36')](_0x4260a8[_0x2d7b('0x33')],_0x4260a8[_0x2d7b('0x34')]);_0x42ef03['attributes']=_[_0x2d7b('0x36')](_0x4260a8[_0x2d7b('0x33')],qs['fields'](_0x4f4f68[_0x2d7b('0x34')][_0x2d7b('0x38')]));_0x42ef03[_0x2d7b('0x37')]=_0x42ef03[_0x2d7b('0x37')][_0x2d7b('0x39')]?_0x42ef03[_0x2d7b('0x37')]:_0x4260a8[_0x2d7b('0x33')];_0x42ef03['order']=qs[_0x2d7b('0x3b')](_0x4f4f68['query'][_0x2d7b('0x3b')]);_0x42ef03[_0x2d7b('0x3c')]=qs['filters'](_[_0x2d7b('0x3e')](_0x4f4f68[_0x2d7b('0x34')],_0x4260a8[_0x2d7b('0x3d')]));if(_0x4f4f68[_0x2d7b('0x34')][_0x2d7b('0x3f')]){_0x42ef03[_0x2d7b('0x3c')]=_[_0x2d7b('0x40')](_0x42ef03[_0x2d7b('0x3c')],{'$or':_[_0x2d7b('0x2e')](_0x42ef03[_0x2d7b('0x37')],function(_0x1d0b32){var _0x35099e={};_0x35099e[_0x1d0b32]={'$like':'%'+_0x4f4f68[_0x2d7b('0x34')][_0x2d7b('0x3f')]+'%'};return _0x35099e;})});}_0x42ef03=_['merge']({},_0x42ef03,_0x4f4f68[_0x2d7b('0x42')]);return _0x95dfa4[_0x2d7b('0x4d')](_0x42ef03);}})[_0x2d7b('0x28')](function(_0x35f999){if(_0x35f999){_0x24fbcd=_0x35f999['length'];if(!_0x4f4f68[_0x2d7b('0x34')][_0x2d7b('0x4f')]('nolimit')){_0x42ef03['limit']=qs[_0x2d7b('0x22')](_0x4f4f68[_0x2d7b('0x34')][_0x2d7b('0x22')]);_0x42ef03['offset']=qs[_0x2d7b('0x20')](_0x4f4f68['query']['offset']);}return _0x95dfa4[_0x2d7b('0x4d')](_0x42ef03);}})[_0x2d7b('0x28')](function(_0x6b1322){if(_0x6b1322){return _0x6b1322?{'count':_0x24fbcd,'rows':_0x6b1322}:null;}})[_0x2d7b('0x28')](respondWithResult(_0x1bfa82,null))['catch'](handleError(_0x1bfa82,null));};exports[_0x2d7b('0x50')]=function(_0x3d4f12,_0x142bb4,_0x23dc8f){var _0x5a804c={};var _0x1dc989={};var _0x2b95c6;var _0x368b58;return db[_0x2d7b('0x2f')][_0x2d7b('0x4e')]({'where':{'id':_0x3d4f12[_0x2d7b('0x47')]['id']}})[_0x2d7b('0x28')](handleEntityNotFound(_0x142bb4,null))[_0x2d7b('0x28')](function(_0x25e9f4){if(_0x25e9f4){_0x2b95c6=_0x25e9f4;_0x1dc989['model']=_['keys'](db[_0x2d7b('0x51')][_0x2d7b('0x30')]);_0x1dc989[_0x2d7b('0x34')]=_[_0x2d7b('0x35')](_0x3d4f12[_0x2d7b('0x34')]);_0x1dc989[_0x2d7b('0x3d')]=_[_0x2d7b('0x36')](_0x1dc989[_0x2d7b('0x33')],_0x1dc989[_0x2d7b('0x34')]);_0x5a804c['attributes']=_[_0x2d7b('0x36')](_0x1dc989['model'],qs[_0x2d7b('0x38')](_0x3d4f12[_0x2d7b('0x34')][_0x2d7b('0x38')]));_0x5a804c[_0x2d7b('0x37')]=_0x5a804c['attributes'][_0x2d7b('0x39')]?_0x5a804c[_0x2d7b('0x37')]:_0x1dc989['model'];_0x5a804c[_0x2d7b('0x3a')]=qs[_0x2d7b('0x3b')](_0x3d4f12[_0x2d7b('0x34')]['sort']);_0x5a804c[_0x2d7b('0x3c')]=qs[_0x2d7b('0x3d')](_[_0x2d7b('0x3e')](_0x3d4f12[_0x2d7b('0x34')],_0x1dc989[_0x2d7b('0x3d')]));if(_0x3d4f12[_0x2d7b('0x34')][_0x2d7b('0x3f')]){_0x5a804c['where']=_[_0x2d7b('0x40')](_0x5a804c[_0x2d7b('0x3c')],{'$or':_[_0x2d7b('0x2e')](_0x5a804c[_0x2d7b('0x37')],function(_0xcb7ae8){var _0x1ffbff={};_0x1ffbff[_0xcb7ae8]={'$like':'%'+_0x3d4f12['query']['filter']+'%'};return _0x1ffbff;})});}_0x5a804c=_[_0x2d7b('0x40')]({},_0x5a804c,_0x3d4f12[_0x2d7b('0x42')]);return _0x2b95c6[_0x2d7b('0x50')](_0x5a804c);}})['then'](function(_0x5b0757){if(_0x5b0757){_0x368b58=_0x5b0757['length'];if(!_0x3d4f12[_0x2d7b('0x34')]['hasOwnProperty'](_0x2d7b('0x52'))){_0x5a804c[_0x2d7b('0x22')]=qs[_0x2d7b('0x22')](_0x3d4f12[_0x2d7b('0x34')]['limit']);_0x5a804c['offset']=qs[_0x2d7b('0x20')](_0x3d4f12[_0x2d7b('0x34')]['offset']);}return _0x2b95c6[_0x2d7b('0x50')](_0x5a804c);}})[_0x2d7b('0x28')](function(_0x4fb53a){if(_0x4fb53a){return _0x4fb53a?{'count':_0x368b58,'rows':_0x4fb53a}:null;}})[_0x2d7b('0x28')](respondWithResult(_0x142bb4,null))[_0x2d7b('0x4a')](handleError(_0x142bb4,null));};exports[_0x2d7b('0x53')]=function(_0x330d5c,_0x457c37,_0x3101c3){var _0x1bf136={};var _0x120bb9={};var _0x49e381;var _0x5c6684;return db['Dynamics365Configuration'][_0x2d7b('0x4e')]({'where':{'id':_0x330d5c['params']['id']}})['then'](handleEntityNotFound(_0x457c37,null))[_0x2d7b('0x28')](function(_0x2490a5){if(_0x2490a5){_0x49e381=_0x2490a5;_0x120bb9[_0x2d7b('0x33')]=_[_0x2d7b('0x35')](db['Dynamics365Field'][_0x2d7b('0x30')]);_0x120bb9[_0x2d7b('0x34')]=_[_0x2d7b('0x35')](_0x330d5c[_0x2d7b('0x34')]);_0x120bb9[_0x2d7b('0x3d')]=_[_0x2d7b('0x36')](_0x120bb9[_0x2d7b('0x33')],_0x120bb9[_0x2d7b('0x34')]);_0x1bf136['attributes']=_['intersection'](_0x120bb9[_0x2d7b('0x33')],qs[_0x2d7b('0x38')](_0x330d5c[_0x2d7b('0x34')][_0x2d7b('0x38')]));_0x1bf136['attributes']=_0x1bf136[_0x2d7b('0x37')][_0x2d7b('0x39')]?_0x1bf136[_0x2d7b('0x37')]:_0x120bb9[_0x2d7b('0x33')];_0x1bf136[_0x2d7b('0x3a')]=qs[_0x2d7b('0x3b')](_0x330d5c[_0x2d7b('0x34')][_0x2d7b('0x3b')]);_0x1bf136[_0x2d7b('0x3c')]=qs['filters'](_[_0x2d7b('0x3e')](_0x330d5c[_0x2d7b('0x34')],_0x120bb9[_0x2d7b('0x3d')]));if(_0x330d5c['query'][_0x2d7b('0x3f')]){_0x1bf136[_0x2d7b('0x3c')]=_[_0x2d7b('0x40')](_0x1bf136[_0x2d7b('0x3c')],{'$or':_[_0x2d7b('0x2e')](_0x1bf136[_0x2d7b('0x37')],function(_0x9ee31d){var _0x23aeef={};_0x23aeef[_0x9ee31d]={'$like':'%'+_0x330d5c[_0x2d7b('0x34')][_0x2d7b('0x3f')]+'%'};return _0x23aeef;})});}_0x1bf136=_[_0x2d7b('0x40')]({},_0x1bf136,_0x330d5c[_0x2d7b('0x42')]);return _0x49e381[_0x2d7b('0x53')](_0x1bf136);}})[_0x2d7b('0x28')](function(_0x336e98){if(_0x336e98){_0x5c6684=_0x336e98['length'];if(!_0x330d5c[_0x2d7b('0x34')]['hasOwnProperty']('nolimit')){_0x1bf136[_0x2d7b('0x22')]=qs[_0x2d7b('0x22')](_0x330d5c[_0x2d7b('0x34')]['limit']);_0x1bf136['offset']=qs[_0x2d7b('0x20')](_0x330d5c[_0x2d7b('0x34')][_0x2d7b('0x20')]);}return _0x49e381['getDescriptions'](_0x1bf136);}})[_0x2d7b('0x28')](function(_0x2b02c4){if(_0x2b02c4){return _0x2b02c4?{'count':_0x5c6684,'rows':_0x2b02c4}:null;}})[_0x2d7b('0x28')](respondWithResult(_0x457c37,null))['catch'](handleError(_0x457c37,null));}; \ No newline at end of file +var _0xc478=['update','destroy','then','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','find','create','body','params','Dynamics365Field','options','getFields','nolimit','findOne','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range'];(function(_0x5a4bae,_0x152671){var _0x19f22e=function(_0x3413d7){while(--_0x3413d7){_0x5a4bae['push'](_0x5a4bae['shift']());}};_0x19f22e(++_0x152671);}(_0xc478,0x1ad));var _0x8c47=function(_0x247eed,_0x24aeee){_0x247eed=_0x247eed-0x0;var _0x1548d9=_0xc478[_0x247eed];return _0x1548d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c47('0x0'));var zipdir=require(_0x8c47('0x1'));var jsonpatch=require(_0x8c47('0x2'));var rp=require(_0x8c47('0x3'));var moment=require(_0x8c47('0x4'));var BPromise=require(_0x8c47('0x5'));var Mustache=require(_0x8c47('0x6'));var util=require('util');var path=require(_0x8c47('0x7'));var sox=require(_0x8c47('0x8'));var csv=require(_0x8c47('0x9'));var ejs=require(_0x8c47('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c47('0xb'));var squel=require(_0x8c47('0xc'));var crypto=require(_0x8c47('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8c47('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8c47('0xf'));var Redis=require(_0x8c47('0x10'));var authService=require(_0x8c47('0x11'));var qs=require(_0x8c47('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c47('0x13'));var logger=require(_0x8c47('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8c47('0x15'));var licenseUtil=require(_0x8c47('0x16'));var db=require(_0x8c47('0x17'))['db'];function respondWithStatusCode(_0x7266fa,_0x2af035){_0x2af035=_0x2af035||0xcc;return function(_0x59b7d4){if(_0x59b7d4){return _0x7266fa[_0x8c47('0x18')](_0x2af035);}return _0x7266fa[_0x8c47('0x19')](_0x2af035)[_0x8c47('0x1a')]();};}function respondWithResult(_0x2b8f8b,_0x4de723){_0x4de723=_0x4de723||0xc8;return function(_0x5294a6){if(_0x5294a6){return _0x2b8f8b['status'](_0x4de723)[_0x8c47('0x1b')](_0x5294a6);}};}function respondWithFilteredResult(_0x8d75d0,_0x4d6f75){return function(_0x1c01e){if(_0x1c01e){var _0x2fdecf=typeof _0x4d6f75['offset']==='undefined'&&typeof _0x4d6f75[_0x8c47('0x1c')]===_0x8c47('0x1d');var _0x10675b=_0x1c01e[_0x8c47('0x1e')];var _0x8b904b=_0x2fdecf?0x0:_0x4d6f75[_0x8c47('0x1f')];var _0x3276fe=_0x2fdecf?_0x1c01e['count']:_0x4d6f75[_0x8c47('0x1f')]+_0x4d6f75[_0x8c47('0x1c')];var _0x20a6a0;if(_0x3276fe>=_0x10675b){_0x3276fe=_0x10675b;_0x20a6a0=0xc8;}else{_0x20a6a0=0xce;}_0x8d75d0['status'](_0x20a6a0);return _0x8d75d0['set'](_0x8c47('0x20'),_0x8b904b+'-'+_0x3276fe+'/'+_0x10675b)[_0x8c47('0x1b')](_0x1c01e);}return null;};}function patchUpdates(_0x321cd4){return function(_0x538805){try{jsonpatch['apply'](_0x538805,_0x321cd4,!![]);}catch(_0x2d3621){return BPromise['reject'](_0x2d3621);}return _0x538805['save']();};}function saveUpdates(_0x3e0c0a,_0x2b46f5){return function(_0x398313){if(_0x398313){return _0x398313[_0x8c47('0x21')](_0x3e0c0a)['then'](function(_0x59686c){return _0x59686c;});}return null;};}function removeEntity(_0x564e91,_0x4c7811){return function(_0xfeaecb){if(_0xfeaecb){return _0xfeaecb[_0x8c47('0x22')]()[_0x8c47('0x23')](function(){_0x564e91[_0x8c47('0x19')](0xcc)[_0x8c47('0x1a')]();});}};}function handleEntityNotFound(_0x4de4b5,_0x4c40ab){return function(_0x1c90a6){if(!_0x1c90a6){_0x4de4b5['sendStatus'](0x194);}return _0x1c90a6;};}function handleError(_0x56663c,_0x42f78c){_0x42f78c=_0x42f78c||0x1f4;return function(_0x173731){logger[_0x8c47('0x24')](_0x173731[_0x8c47('0x25')]);if(_0x173731[_0x8c47('0x26')]){delete _0x173731[_0x8c47('0x26')];}_0x56663c[_0x8c47('0x19')](_0x42f78c)[_0x8c47('0x27')](_0x173731);};}exports[_0x8c47('0x28')]=function(_0x435671,_0xdeaa47){var _0x1ef501={},_0x166ffb={},_0x2ef0ea={'count':0x0,'rows':[]};var _0x3c45be=_['map'](db[_0x8c47('0x29')][_0x8c47('0x2a')],function(_0x3b9078){return{'name':_0x3b9078['fieldName'],'type':_0x3b9078[_0x8c47('0x2b')][_0x8c47('0x2c')]};});_0x166ffb[_0x8c47('0x2d')]=_[_0x8c47('0x2e')](_0x3c45be,_0x8c47('0x26'));_0x166ffb[_0x8c47('0x2f')]=_[_0x8c47('0x30')](_0x435671[_0x8c47('0x2f')]);_0x166ffb['filters']=_[_0x8c47('0x31')](_0x166ffb[_0x8c47('0x2d')],_0x166ffb[_0x8c47('0x2f')]);_0x1ef501['attributes']=_[_0x8c47('0x31')](_0x166ffb[_0x8c47('0x2d')],qs[_0x8c47('0x32')](_0x435671['query'][_0x8c47('0x32')]));_0x1ef501[_0x8c47('0x33')]=_0x1ef501[_0x8c47('0x33')][_0x8c47('0x34')]?_0x1ef501[_0x8c47('0x33')]:_0x166ffb[_0x8c47('0x2d')];if(!_0x435671[_0x8c47('0x2f')][_0x8c47('0x35')]('nolimit')){_0x1ef501['limit']=qs['limit'](_0x435671[_0x8c47('0x2f')]['limit']);_0x1ef501[_0x8c47('0x1f')]=qs[_0x8c47('0x1f')](_0x435671[_0x8c47('0x2f')]['offset']);}_0x1ef501[_0x8c47('0x36')]=qs['sort'](_0x435671[_0x8c47('0x2f')][_0x8c47('0x37')]);_0x1ef501[_0x8c47('0x38')]=qs[_0x8c47('0x39')](_[_0x8c47('0x3a')](_0x435671['query'],_0x166ffb[_0x8c47('0x39')]),_0x3c45be);if(_0x435671[_0x8c47('0x2f')][_0x8c47('0x3b')]){_0x1ef501[_0x8c47('0x38')]=_[_0x8c47('0x3c')](_0x1ef501['where'],{'$or':_[_0x8c47('0x2e')](_0x3c45be,function(_0x137eac){if(_0x137eac[_0x8c47('0x2b')]!==_0x8c47('0x3d')){var _0x4eeb02={};_0x4eeb02[_0x137eac[_0x8c47('0x26')]]={'$like':'%'+_0x435671[_0x8c47('0x2f')]['filter']+'%'};return _0x4eeb02;}})});}_0x1ef501=_['merge']({},_0x1ef501,_0x435671['options']);var _0x5ac72d={'where':_0x1ef501[_0x8c47('0x38')]};return db[_0x8c47('0x29')][_0x8c47('0x1e')](_0x5ac72d)[_0x8c47('0x23')](function(_0x1204ba){_0x2ef0ea[_0x8c47('0x1e')]=_0x1204ba;if(_0x435671['query'][_0x8c47('0x3e')]){_0x1ef501[_0x8c47('0x3f')]=[{'all':!![]}];}return db[_0x8c47('0x29')]['findAll'](_0x1ef501);})[_0x8c47('0x23')](function(_0x577202){_0x2ef0ea['rows']=_0x577202;return _0x2ef0ea;})[_0x8c47('0x23')](respondWithFilteredResult(_0xdeaa47,_0x1ef501))[_0x8c47('0x40')](handleError(_0xdeaa47,null));};exports[_0x8c47('0x41')]=function(_0x1b5e24,_0x207f14){var _0x6f0e25={'raw':![],'where':{'id':_0x1b5e24['params']['id']}},_0x46f8cb={};_0x46f8cb[_0x8c47('0x2d')]=_[_0x8c47('0x30')](db[_0x8c47('0x29')][_0x8c47('0x2a')]);_0x46f8cb['query']=_[_0x8c47('0x30')](_0x1b5e24[_0x8c47('0x2f')]);_0x46f8cb[_0x8c47('0x39')]=_[_0x8c47('0x31')](_0x46f8cb[_0x8c47('0x2d')],_0x46f8cb[_0x8c47('0x2f')]);_0x6f0e25[_0x8c47('0x33')]=_['intersection'](_0x46f8cb[_0x8c47('0x2d')],qs[_0x8c47('0x32')](_0x1b5e24['query'][_0x8c47('0x32')]));_0x6f0e25['attributes']=_0x6f0e25['attributes']['length']?_0x6f0e25['attributes']:_0x46f8cb['model'];if(_0x1b5e24[_0x8c47('0x2f')][_0x8c47('0x3e')]){_0x6f0e25['include']=[{'all':!![]}];}_0x6f0e25=_[_0x8c47('0x3c')]({},_0x6f0e25,_0x1b5e24['options']);return db[_0x8c47('0x29')][_0x8c47('0x42')](_0x6f0e25)['then'](handleEntityNotFound(_0x207f14,null))[_0x8c47('0x23')](respondWithResult(_0x207f14,null))[_0x8c47('0x40')](handleError(_0x207f14,null));};exports[_0x8c47('0x43')]=function(_0x44f0c4,_0x1f4d19){return db[_0x8c47('0x29')][_0x8c47('0x43')](_0x44f0c4[_0x8c47('0x44')],{})['then'](respondWithResult(_0x1f4d19,0xc9))[_0x8c47('0x40')](handleError(_0x1f4d19,null));};exports[_0x8c47('0x21')]=function(_0x3003fe,_0x2751fe){if(_0x3003fe['body']['id']){delete _0x3003fe[_0x8c47('0x44')]['id'];}return db['Dynamics365Configuration'][_0x8c47('0x42')]({'where':{'id':_0x3003fe[_0x8c47('0x45')]['id']}})[_0x8c47('0x23')](handleEntityNotFound(_0x2751fe,null))[_0x8c47('0x23')](saveUpdates(_0x3003fe[_0x8c47('0x44')],null))[_0x8c47('0x23')](respondWithResult(_0x2751fe,null))[_0x8c47('0x40')](handleError(_0x2751fe,null));};exports[_0x8c47('0x22')]=function(_0x23381c,_0xce2c3){return db[_0x8c47('0x29')]['find']({'where':{'id':_0x23381c[_0x8c47('0x45')]['id']}})[_0x8c47('0x23')](handleEntityNotFound(_0xce2c3,null))[_0x8c47('0x23')](removeEntity(_0xce2c3,null))[_0x8c47('0x40')](handleError(_0xce2c3,null));};exports['getFields']=function(_0x3e769a,_0x473b90,_0x49c4cf){var _0x28bbe5={};var _0x1a64ed={};var _0x22de7a;var _0x4767e2;return db[_0x8c47('0x29')]['findOne']({'where':{'id':_0x3e769a[_0x8c47('0x45')]['id']}})[_0x8c47('0x23')](handleEntityNotFound(_0x473b90,null))[_0x8c47('0x23')](function(_0x4f9fc1){if(_0x4f9fc1){_0x22de7a=_0x4f9fc1;_0x1a64ed[_0x8c47('0x2d')]=_[_0x8c47('0x30')](db[_0x8c47('0x46')][_0x8c47('0x2a')]);_0x1a64ed[_0x8c47('0x2f')]=_[_0x8c47('0x30')](_0x3e769a['query']);_0x1a64ed[_0x8c47('0x39')]=_['intersection'](_0x1a64ed[_0x8c47('0x2d')],_0x1a64ed[_0x8c47('0x2f')]);_0x28bbe5['attributes']=_[_0x8c47('0x31')](_0x1a64ed[_0x8c47('0x2d')],qs['fields'](_0x3e769a[_0x8c47('0x2f')][_0x8c47('0x32')]));_0x28bbe5[_0x8c47('0x33')]=_0x28bbe5[_0x8c47('0x33')][_0x8c47('0x34')]?_0x28bbe5[_0x8c47('0x33')]:_0x1a64ed[_0x8c47('0x2d')];_0x28bbe5[_0x8c47('0x36')]=qs[_0x8c47('0x37')](_0x3e769a[_0x8c47('0x2f')][_0x8c47('0x37')]);_0x28bbe5[_0x8c47('0x38')]=qs[_0x8c47('0x39')](_[_0x8c47('0x3a')](_0x3e769a[_0x8c47('0x2f')],_0x1a64ed[_0x8c47('0x39')]));if(_0x3e769a['query'][_0x8c47('0x3b')]){_0x28bbe5[_0x8c47('0x38')]=_[_0x8c47('0x3c')](_0x28bbe5[_0x8c47('0x38')],{'$or':_[_0x8c47('0x2e')](_0x28bbe5[_0x8c47('0x33')],function(_0x48a33a){var _0xfc91a={};_0xfc91a[_0x48a33a]={'$like':'%'+_0x3e769a[_0x8c47('0x2f')][_0x8c47('0x3b')]+'%'};return _0xfc91a;})});}_0x28bbe5=_[_0x8c47('0x3c')]({},_0x28bbe5,_0x3e769a[_0x8c47('0x47')]);return _0x22de7a[_0x8c47('0x48')](_0x28bbe5);}})[_0x8c47('0x23')](function(_0x3c3d89){if(_0x3c3d89){_0x4767e2=_0x3c3d89[_0x8c47('0x34')];if(!_0x3e769a[_0x8c47('0x2f')][_0x8c47('0x35')](_0x8c47('0x49'))){_0x28bbe5[_0x8c47('0x1c')]=qs[_0x8c47('0x1c')](_0x3e769a[_0x8c47('0x2f')][_0x8c47('0x1c')]);_0x28bbe5[_0x8c47('0x1f')]=qs[_0x8c47('0x1f')](_0x3e769a['query'][_0x8c47('0x1f')]);}return _0x22de7a['getFields'](_0x28bbe5);}})[_0x8c47('0x23')](function(_0x1d8dad){if(_0x1d8dad){return _0x1d8dad?{'count':_0x4767e2,'rows':_0x1d8dad}:null;}})['then'](respondWithResult(_0x473b90,null))[_0x8c47('0x40')](handleError(_0x473b90,null));};exports['getSubjects']=function(_0x3342f3,_0x33e879,_0x136943){var _0x444806={};var _0x4a7cab={};var _0x15ac76;var _0x4bbd71;return db[_0x8c47('0x29')][_0x8c47('0x4a')]({'where':{'id':_0x3342f3['params']['id']}})[_0x8c47('0x23')](handleEntityNotFound(_0x33e879,null))['then'](function(_0x42482a){if(_0x42482a){_0x15ac76=_0x42482a;_0x4a7cab[_0x8c47('0x2d')]=_[_0x8c47('0x30')](db['Dynamics365Field']['rawAttributes']);_0x4a7cab['query']=_['keys'](_0x3342f3[_0x8c47('0x2f')]);_0x4a7cab['filters']=_[_0x8c47('0x31')](_0x4a7cab[_0x8c47('0x2d')],_0x4a7cab[_0x8c47('0x2f')]);_0x444806[_0x8c47('0x33')]=_[_0x8c47('0x31')](_0x4a7cab[_0x8c47('0x2d')],qs[_0x8c47('0x32')](_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x32')]));_0x444806[_0x8c47('0x33')]=_0x444806[_0x8c47('0x33')][_0x8c47('0x34')]?_0x444806[_0x8c47('0x33')]:_0x4a7cab[_0x8c47('0x2d')];_0x444806[_0x8c47('0x36')]=qs[_0x8c47('0x37')](_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x37')]);_0x444806['where']=qs['filters'](_[_0x8c47('0x3a')](_0x3342f3[_0x8c47('0x2f')],_0x4a7cab[_0x8c47('0x39')]));if(_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x3b')]){_0x444806[_0x8c47('0x38')]=_[_0x8c47('0x3c')](_0x444806[_0x8c47('0x38')],{'$or':_['map'](_0x444806[_0x8c47('0x33')],function(_0x35091e){var _0x3967d5={};_0x3967d5[_0x35091e]={'$like':'%'+_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x3b')]+'%'};return _0x3967d5;})});}_0x444806=_[_0x8c47('0x3c')]({},_0x444806,_0x3342f3[_0x8c47('0x47')]);return _0x15ac76[_0x8c47('0x4b')](_0x444806);}})[_0x8c47('0x23')](function(_0x5ac41e){if(_0x5ac41e){_0x4bbd71=_0x5ac41e['length'];if(!_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x35')](_0x8c47('0x49'))){_0x444806[_0x8c47('0x1c')]=qs['limit'](_0x3342f3['query']['limit']);_0x444806[_0x8c47('0x1f')]=qs[_0x8c47('0x1f')](_0x3342f3[_0x8c47('0x2f')][_0x8c47('0x1f')]);}return _0x15ac76[_0x8c47('0x4b')](_0x444806);}})[_0x8c47('0x23')](function(_0x5d5384){if(_0x5d5384){return _0x5d5384?{'count':_0x4bbd71,'rows':_0x5d5384}:null;}})['then'](respondWithResult(_0x33e879,null))['catch'](handleError(_0x33e879,null));};exports[_0x8c47('0x4c')]=function(_0xf9baff,_0x2de2ae,_0x3b4031){var _0xbd2318={};var _0x1900b1={};var _0x5f5cc9;var _0x4bd74f;return db[_0x8c47('0x29')][_0x8c47('0x4a')]({'where':{'id':_0xf9baff['params']['id']}})['then'](handleEntityNotFound(_0x2de2ae,null))['then'](function(_0x11416d){if(_0x11416d){_0x5f5cc9=_0x11416d;_0x1900b1['model']=_[_0x8c47('0x30')](db[_0x8c47('0x46')]['rawAttributes']);_0x1900b1[_0x8c47('0x2f')]=_[_0x8c47('0x30')](_0xf9baff[_0x8c47('0x2f')]);_0x1900b1[_0x8c47('0x39')]=_[_0x8c47('0x31')](_0x1900b1['model'],_0x1900b1[_0x8c47('0x2f')]);_0xbd2318[_0x8c47('0x33')]=_[_0x8c47('0x31')](_0x1900b1[_0x8c47('0x2d')],qs[_0x8c47('0x32')](_0xf9baff['query'][_0x8c47('0x32')]));_0xbd2318[_0x8c47('0x33')]=_0xbd2318[_0x8c47('0x33')][_0x8c47('0x34')]?_0xbd2318[_0x8c47('0x33')]:_0x1900b1['model'];_0xbd2318[_0x8c47('0x36')]=qs[_0x8c47('0x37')](_0xf9baff[_0x8c47('0x2f')][_0x8c47('0x37')]);_0xbd2318[_0x8c47('0x38')]=qs[_0x8c47('0x39')](_[_0x8c47('0x3a')](_0xf9baff[_0x8c47('0x2f')],_0x1900b1['filters']));if(_0xf9baff[_0x8c47('0x2f')][_0x8c47('0x3b')]){_0xbd2318[_0x8c47('0x38')]=_[_0x8c47('0x3c')](_0xbd2318[_0x8c47('0x38')],{'$or':_[_0x8c47('0x2e')](_0xbd2318[_0x8c47('0x33')],function(_0x2499c5){var _0x437f56={};_0x437f56[_0x2499c5]={'$like':'%'+_0xf9baff[_0x8c47('0x2f')][_0x8c47('0x3b')]+'%'};return _0x437f56;})});}_0xbd2318=_['merge']({},_0xbd2318,_0xf9baff[_0x8c47('0x47')]);return _0x5f5cc9['getDescriptions'](_0xbd2318);}})[_0x8c47('0x23')](function(_0x153801){if(_0x153801){_0x4bd74f=_0x153801[_0x8c47('0x34')];if(!_0xf9baff['query']['hasOwnProperty'](_0x8c47('0x49'))){_0xbd2318['limit']=qs[_0x8c47('0x1c')](_0xf9baff['query'][_0x8c47('0x1c')]);_0xbd2318['offset']=qs['offset'](_0xf9baff['query']['offset']);}return _0x5f5cc9[_0x8c47('0x4c')](_0xbd2318);}})[_0x8c47('0x23')](function(_0x43026f){if(_0x43026f){return _0x43026f?{'count':_0x4bd74f,'rows':_0x43026f}:null;}})[_0x8c47('0x23')](respondWithResult(_0x2de2ae,null))[_0x8c47('0x40')](handleError(_0x2de2ae,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 8602a5e..befd236 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0xbc1c4f,_0x1861e1){var _0x47920e=function(_0x1f842f){while(--_0x1f842f){_0xbc1c4f['push'](_0xbc1c4f['shift']());}};_0x47920e(++_0x1861e1);}(_0xdace,0xc5));var _0xedac=function(_0x49a57c,_0x2eb02c){_0x49a57c=_0x49a57c-0x0;var _0x4e0316=_0xdace[_0x49a57c];return _0x4e0316;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xb842c5,_0xc01101){var _0x348f91=function(_0x1ab5b4){while(--_0x1ab5b4){_0xb842c5['push'](_0xb842c5['shift']());}};_0x348f91(++_0xc01101);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x4bd67a,_0x4f9725){_0x4bd67a=_0x4bd67a-0x0;var _0x2be5fb=_0xb4e6[_0x4bd67a];return _0x2be5fb;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 01a3a81..b678564 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 _0x826c=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util'];(function(_0x2e8dd3,_0x5bd8ec){var _0x1391b6=function(_0xeea5f4){while(--_0xeea5f4){_0x2e8dd3['push'](_0x2e8dd3['shift']());}};_0x1391b6(++_0x5bd8ec);}(_0x826c,0xda));var _0xc826=function(_0x2b7339,_0x2c57be){_0x2b7339=_0x2b7339-0x0;var _0x1f9d16=_0x826c[_0x2b7339];return _0x1f9d16;};'use strict';var _=require(_0xc826('0x0'));var util=require(_0xc826('0x1'));var moment=require(_0xc826('0x2'));var BPromise=require(_0xc826('0x3'));var rs=require(_0xc826('0x4'));var fs=require('fs');var Redis=require(_0xc826('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc826('0x6'));var logger=require('../../config/logger')(_0xc826('0x7'));var config=require(_0xc826('0x8'));var jayson=require(_0xc826('0x9'));var client=jayson[_0xc826('0xa')][_0xc826('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d5344,_0x1c4e52,_0x1d3ef4){return new BPromise(function(_0x3654a6,_0x3ddebc){return client['request'](_0x5d5344,_0x1d3ef4)[_0xc826('0xc')](function(_0x3c11c9){logger[_0xc826('0xd')](_0xc826('0xe'),_0x1c4e52,_0xc826('0xf'));logger[_0xc826('0x10')](_0xc826('0x11'),_0x1c4e52,_0xc826('0xf'),JSON[_0xc826('0x12')](_0x3c11c9));if(_0x3c11c9[_0xc826('0x13')]){if(_0x3c11c9[_0xc826('0x13')]['code']===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1c4e52,_0x3c11c9[_0xc826('0x13')][_0xc826('0x14')]);return _0x3ddebc(_0x3c11c9['error'][_0xc826('0x14')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1c4e52,_0x3c11c9[_0xc826('0x13')][_0xc826('0x14')]);return _0x3654a6(_0x3c11c9[_0xc826('0x13')][_0xc826('0x14')]);}else{logger[_0xc826('0xd')](_0xc826('0xe'),_0x1c4e52,_0xc826('0xf'));_0x3654a6(_0x3c11c9['result'][_0xc826('0x14')]);}})[_0xc826('0x15')](function(_0x1f7412){logger['error'](_0xc826('0xe'),_0x1c4e52,_0x1f7412);_0x3ddebc(_0x1f7412);});});} \ No newline at end of file +var _0xf858=['Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xf858,0x11c));var _0x8f85=function(_0xc54a60,_0x4b0d42){_0xc54a60=_0xc54a60-0x0;var _0x5939de=_0xf858[_0xc54a60];return _0x5939de;};'use strict';var _=require(_0x8f85('0x0'));var util=require(_0x8f85('0x1'));var moment=require(_0x8f85('0x2'));var BPromise=require(_0x8f85('0x3'));var rs=require(_0x8f85('0x4'));var fs=require('fs');var Redis=require(_0x8f85('0x5'));var db=require(_0x8f85('0x6'))['db'];var utils=require(_0x8f85('0x7'));var logger=require(_0x8f85('0x8'))(_0x8f85('0x9'));var config=require(_0x8f85('0xa'));var jayson=require(_0x8f85('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x132fba,_0x38a05b,_0x5b1177){return new BPromise(function(_0x264c9a,_0x2d4fe6){return client[_0x8f85('0xc')](_0x132fba,_0x5b1177)[_0x8f85('0xd')](function(_0x369837){logger[_0x8f85('0xe')](_0x8f85('0xf'),_0x38a05b,'request\x20sent');logger['debug'](_0x8f85('0x10'),_0x38a05b,_0x8f85('0x11'),JSON[_0x8f85('0x12')](_0x369837));if(_0x369837[_0x8f85('0x13')]){if(_0x369837['error'][_0x8f85('0x14')]===0x1f4){logger[_0x8f85('0x13')](_0x8f85('0xf'),_0x38a05b,_0x369837['error'][_0x8f85('0x15')]);return _0x2d4fe6(_0x369837[_0x8f85('0x13')][_0x8f85('0x15')]);}logger['error'](_0x8f85('0xf'),_0x38a05b,_0x369837[_0x8f85('0x13')][_0x8f85('0x15')]);return _0x264c9a(_0x369837[_0x8f85('0x13')][_0x8f85('0x15')]);}else{logger[_0x8f85('0xe')](_0x8f85('0xf'),_0x38a05b,_0x8f85('0x11'));_0x264c9a(_0x369837[_0x8f85('0x16')][_0x8f85('0x15')]);}})['catch'](function(_0x182812){logger[_0x8f85('0x13')](_0x8f85('0xf'),_0x38a05b,_0x182812);_0x2d4fe6(_0x182812);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 73f3466..94b58bd 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 _0x7ba5=['express','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','path','connect-timeout'];(function(_0x18ab13,_0x2900b6){var _0x28d340=function(_0xfa1d44){while(--_0xfa1d44){_0x18ab13['push'](_0x18ab13['shift']());}};_0x28d340(++_0x2900b6);}(_0x7ba5,0x17e));var _0x57ba=function(_0x48da30,_0x34a38d){_0x48da30=_0x48da30-0x0;var _0x269fc2=_0x7ba5[_0x48da30];return _0x269fc2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x57ba('0x0'));var timeout=require(_0x57ba('0x1'));var express=require(_0x57ba('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x57ba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x57ba('0x4'));var controller=require(_0x57ba('0x5'));router[_0x57ba('0x6')]('/',auth[_0x57ba('0x7')](),controller[_0x57ba('0x8')]);router[_0x57ba('0x6')](_0x57ba('0x9'),auth[_0x57ba('0x7')](),controller[_0x57ba('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x57ba('0xb')]);router[_0x57ba('0xc')](_0x57ba('0x9'),auth[_0x57ba('0x7')](),controller[_0x57ba('0xd')]);router['delete'](_0x57ba('0x9'),auth[_0x57ba('0x7')](),controller[_0x57ba('0xe')]);module[_0x57ba('0xf')]=router; \ No newline at end of file +var _0x394f=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','post'];(function(_0x586885,_0x393c14){var _0x4f9133=function(_0x2d3c80){while(--_0x2d3c80){_0x586885['push'](_0x586885['shift']());}};_0x4f9133(++_0x393c14);}(_0x394f,0x181));var _0xf394=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x394f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf394('0x0'));var util=require(_0xf394('0x1'));var path=require('path');var timeout=require(_0xf394('0x2'));var express=require(_0xf394('0x3'));var router=express[_0xf394('0x4')]();var fs_extra=require(_0xf394('0x5'));var auth=require(_0xf394('0x6'));var interaction=require(_0xf394('0x7'));var config=require(_0xf394('0x8'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xf394('0x9')](),controller[_0xf394('0xa')]);router['get'](_0xf394('0xb'),auth[_0xf394('0x9')](),controller[_0xf394('0xc')]);router[_0xf394('0xd')]('/',auth[_0xf394('0x9')](),controller['create']);router[_0xf394('0xe')](_0xf394('0xb'),auth['isAuthenticated'](),controller[_0xf394('0xf')]);router[_0xf394('0x10')](_0xf394('0xb'),auth[_0xf394('0x9')](),controller[_0xf394('0x11')]);module[_0xf394('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 464f527..919324e 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 _0xfa36=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','string','variable'];(function(_0x3bb572,_0x2ebdfe){var _0xaa58c5=function(_0x43cc91){while(--_0x43cc91){_0x3bb572['push'](_0x3bb572['shift']());}};_0xaa58c5(++_0x2ebdfe);}(_0xfa36,0x1b5));var _0x6fa3=function(_0xb64e9e,_0x519fb2){_0xb64e9e=_0xb64e9e-0x0;var _0x1c63f4=_0xfa36[_0xb64e9e];return _0x1c63f4;};'use strict';var Sequelize=require(_0x6fa3('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x6fa3('0x1'),_0x6fa3('0x2'),_0x6fa3('0x3'),_0x6fa3('0x4'),'picklist'),'defaultValue':_0x6fa3('0x1')},'content':{'type':Sequelize[_0x6fa3('0x5')]},'key':{'type':Sequelize[_0x6fa3('0x5')]},'keyType':{'type':Sequelize[_0x6fa3('0x6')](_0x6fa3('0x1'),_0x6fa3('0x2'),_0x6fa3('0x3'))},'keyContent':{'type':Sequelize[_0x6fa3('0x5')]},'idField':{'type':Sequelize[_0x6fa3('0x5')]},'nameField':{'type':Sequelize[_0x6fa3('0x5')]},'customField':{'type':Sequelize[_0x6fa3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6fa3('0x5')]}}; \ No newline at end of file +var _0x220d=['exports','string','keyValue','picklist','ENUM','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x3c3e72,_0x3e1858){var _0x48a7e5=function(_0x3d1c72){while(--_0x3d1c72){_0x3c3e72['push'](_0x3c3e72['shift']());}};_0x48a7e5(++_0x3e1858);}(_0x220d,0x15d));var _0xd220=function(_0x4768dc,_0x2f5014){_0x4768dc=_0x4768dc-0x0;var _0x1c75cc=_0x220d[_0x4768dc];return _0x1c75cc;};'use strict';var Sequelize=require(_0xd220('0x0'));module[_0xd220('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd220('0x2'),'variable','customVariable',_0xd220('0x3'),_0xd220('0x4')),'defaultValue':_0xd220('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd220('0x5')](_0xd220('0x2'),_0xd220('0x6'),_0xd220('0x7'))},'keyContent':{'type':Sequelize[_0xd220('0x8')]},'idField':{'type':Sequelize[_0xd220('0x8')]},'nameField':{'type':Sequelize[_0xd220('0x8')]},'customField':{'type':Sequelize[_0xd220('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd220('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index b5e648c..683a03b 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 _0x1bfc=['mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','keys','find','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1d781d,_0x11290e){var _0x5391ef=function(_0x274edf){while(--_0x274edf){_0x1d781d['push'](_0x1d781d['shift']());}};_0x5391ef(++_0x11290e);}(_0x1bfc,0xcf));var _0xc1bf=function(_0x35ed2a,_0x4bca58){_0x35ed2a=_0x35ed2a-0x0;var _0x76cc5f=_0x1bfc[_0x35ed2a];return _0x76cc5f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1bf('0x0'));var zipdir=require(_0xc1bf('0x1'));var jsonpatch=require(_0xc1bf('0x2'));var rp=require(_0xc1bf('0x3'));var moment=require(_0xc1bf('0x4'));var BPromise=require(_0xc1bf('0x5'));var Mustache=require(_0xc1bf('0x6'));var util=require(_0xc1bf('0x7'));var path=require('path');var sox=require(_0xc1bf('0x8'));var csv=require(_0xc1bf('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1bf('0xa'));var _=require(_0xc1bf('0xb'));var squel=require(_0xc1bf('0xc'));var crypto=require(_0xc1bf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc1bf('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc1bf('0xf'));var Papa=require('papaparse');var Redis=require(_0xc1bf('0x10'));var authService=require(_0xc1bf('0x11'));var qs=require(_0xc1bf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1bf('0x13'));var logger=require(_0xc1bf('0x14'))('api');var utils=require(_0xc1bf('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc1bf('0x16'));var db=require(_0xc1bf('0x17'))['db'];function respondWithStatusCode(_0x5403e3,_0x1d8d8b){_0x1d8d8b=_0x1d8d8b||0xcc;return function(_0x5402bb){if(_0x5402bb){return _0x5403e3['sendStatus'](_0x1d8d8b);}return _0x5403e3[_0xc1bf('0x18')](_0x1d8d8b)[_0xc1bf('0x19')]();};}function respondWithResult(_0x13fe6c,_0x3b80f0){_0x3b80f0=_0x3b80f0||0xc8;return function(_0x5abc87){if(_0x5abc87){return _0x13fe6c[_0xc1bf('0x18')](_0x3b80f0)[_0xc1bf('0x1a')](_0x5abc87);}};}function respondWithFilteredResult(_0x46670d,_0x44df1b){return function(_0x483927){if(_0x483927){var _0x5306b9=typeof _0x44df1b[_0xc1bf('0x1b')]===_0xc1bf('0x1c')&&typeof _0x44df1b[_0xc1bf('0x1d')]==='undefined';var _0x1788d2=_0x483927[_0xc1bf('0x1e')];var _0x253507=_0x5306b9?0x0:_0x44df1b[_0xc1bf('0x1b')];var _0x3c8cf8=_0x5306b9?_0x483927['count']:_0x44df1b['offset']+_0x44df1b[_0xc1bf('0x1d')];var _0x544718;if(_0x3c8cf8>=_0x1788d2){_0x3c8cf8=_0x1788d2;_0x544718=0xc8;}else{_0x544718=0xce;}_0x46670d[_0xc1bf('0x18')](_0x544718);return _0x46670d[_0xc1bf('0x1f')]('Content-Range',_0x253507+'-'+_0x3c8cf8+'/'+_0x1788d2)[_0xc1bf('0x1a')](_0x483927);}return null;};}function patchUpdates(_0x955158){return function(_0x4bab80){try{jsonpatch[_0xc1bf('0x20')](_0x4bab80,_0x955158,!![]);}catch(_0x57d4f9){return BPromise[_0xc1bf('0x21')](_0x57d4f9);}return _0x4bab80[_0xc1bf('0x22')]();};}function saveUpdates(_0x5a400f,_0x3fb644){return function(_0x1afdd9){if(_0x1afdd9){return _0x1afdd9[_0xc1bf('0x23')](_0x5a400f)['then'](function(_0x55a28b){return _0x55a28b;});}return null;};}function removeEntity(_0x3299a6,_0x12894c){return function(_0x42b79a){if(_0x42b79a){return _0x42b79a['destroy']()[_0xc1bf('0x24')](function(){_0x3299a6[_0xc1bf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5382d7,_0x5d02d1){return function(_0x3005af){if(!_0x3005af){_0x5382d7[_0xc1bf('0x25')](0x194);}return _0x3005af;};}function handleError(_0x5dbcf1,_0x274b1d){_0x274b1d=_0x274b1d||0x1f4;return function(_0x3707aa){logger[_0xc1bf('0x26')](_0x3707aa[_0xc1bf('0x27')]);if(_0x3707aa['name']){delete _0x3707aa[_0xc1bf('0x28')];}_0x5dbcf1[_0xc1bf('0x18')](_0x274b1d)[_0xc1bf('0x29')](_0x3707aa);};}exports[_0xc1bf('0x2a')]=function(_0x54577e,_0xb40f18){var _0x532494={},_0xbd9cc4={},_0x1ed193={'count':0x0,'rows':[]};var _0x444325=_['map'](db[_0xc1bf('0x2b')][_0xc1bf('0x2c')],function(_0x411386){return{'name':_0x411386[_0xc1bf('0x2d')],'type':_0x411386[_0xc1bf('0x2e')][_0xc1bf('0x2f')]};});_0xbd9cc4['model']=_['map'](_0x444325,_0xc1bf('0x28'));_0xbd9cc4['query']=_['keys'](_0x54577e[_0xc1bf('0x30')]);_0xbd9cc4[_0xc1bf('0x31')]=_[_0xc1bf('0x32')](_0xbd9cc4[_0xc1bf('0x33')],_0xbd9cc4[_0xc1bf('0x30')]);_0x532494[_0xc1bf('0x34')]=_[_0xc1bf('0x32')](_0xbd9cc4[_0xc1bf('0x33')],qs[_0xc1bf('0x35')](_0x54577e[_0xc1bf('0x30')][_0xc1bf('0x35')]));_0x532494[_0xc1bf('0x34')]=_0x532494[_0xc1bf('0x34')][_0xc1bf('0x36')]?_0x532494[_0xc1bf('0x34')]:_0xbd9cc4[_0xc1bf('0x33')];if(!_0x54577e[_0xc1bf('0x30')]['hasOwnProperty'](_0xc1bf('0x37'))){_0x532494[_0xc1bf('0x1d')]=qs[_0xc1bf('0x1d')](_0x54577e[_0xc1bf('0x30')][_0xc1bf('0x1d')]);_0x532494[_0xc1bf('0x1b')]=qs[_0xc1bf('0x1b')](_0x54577e['query'][_0xc1bf('0x1b')]);}_0x532494[_0xc1bf('0x38')]=qs[_0xc1bf('0x39')](_0x54577e[_0xc1bf('0x30')][_0xc1bf('0x39')]);_0x532494[_0xc1bf('0x3a')]=qs['filters'](_['pick'](_0x54577e['query'],_0xbd9cc4['filters']),_0x444325);if(_0x54577e[_0xc1bf('0x30')][_0xc1bf('0x3b')]){_0x532494['where']=_[_0xc1bf('0x3c')](_0x532494[_0xc1bf('0x3a')],{'$or':_['map'](_0x444325,function(_0x460ede){if(_0x460ede[_0xc1bf('0x2e')]!==_0xc1bf('0x3d')){var _0x1a3818={};_0x1a3818[_0x460ede['name']]={'$like':'%'+_0x54577e[_0xc1bf('0x30')]['filter']+'%'};return _0x1a3818;}})});}_0x532494=_[_0xc1bf('0x3c')]({},_0x532494,_0x54577e[_0xc1bf('0x3e')]);var _0x2869d9={'where':_0x532494[_0xc1bf('0x3a')]};return db['Dynamics365Field'][_0xc1bf('0x1e')](_0x2869d9)[_0xc1bf('0x24')](function(_0x304246){_0x1ed193[_0xc1bf('0x1e')]=_0x304246;if(_0x54577e[_0xc1bf('0x30')][_0xc1bf('0x3f')]){_0x532494[_0xc1bf('0x40')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x532494);})['then'](function(_0x4f9e18){_0x1ed193['rows']=_0x4f9e18;return _0x1ed193;})[_0xc1bf('0x24')](respondWithFilteredResult(_0xb40f18,_0x532494))[_0xc1bf('0x41')](handleError(_0xb40f18,null));};exports['show']=function(_0x12d910,_0x5079fc){var _0x133535={'raw':!![],'where':{'id':_0x12d910['params']['id']}},_0x451d00={};_0x451d00[_0xc1bf('0x33')]=_[_0xc1bf('0x42')](db['Dynamics365Field'][_0xc1bf('0x2c')]);_0x451d00[_0xc1bf('0x30')]=_['keys'](_0x12d910[_0xc1bf('0x30')]);_0x451d00[_0xc1bf('0x31')]=_['intersection'](_0x451d00[_0xc1bf('0x33')],_0x451d00['query']);_0x133535[_0xc1bf('0x34')]=_[_0xc1bf('0x32')](_0x451d00['model'],qs['fields'](_0x12d910[_0xc1bf('0x30')][_0xc1bf('0x35')]));_0x133535[_0xc1bf('0x34')]=_0x133535[_0xc1bf('0x34')][_0xc1bf('0x36')]?_0x133535[_0xc1bf('0x34')]:_0x451d00[_0xc1bf('0x33')];if(_0x12d910[_0xc1bf('0x30')][_0xc1bf('0x3f')]){_0x133535[_0xc1bf('0x40')]=[{'all':!![]}];}_0x133535=_[_0xc1bf('0x3c')]({},_0x133535,_0x12d910[_0xc1bf('0x3e')]);return db[_0xc1bf('0x2b')][_0xc1bf('0x43')](_0x133535)['then'](handleEntityNotFound(_0x5079fc,null))['then'](respondWithResult(_0x5079fc,null))[_0xc1bf('0x41')](handleError(_0x5079fc,null));};exports['create']=function(_0x11ca86,_0xf927a7){return db[_0xc1bf('0x2b')]['create'](_0x11ca86[_0xc1bf('0x44')],{})[_0xc1bf('0x24')](respondWithResult(_0xf927a7,0xc9))[_0xc1bf('0x41')](handleError(_0xf927a7,null));};exports[_0xc1bf('0x23')]=function(_0x98b245,_0x428614){if(_0x98b245[_0xc1bf('0x44')]['id']){delete _0x98b245[_0xc1bf('0x44')]['id'];}return db[_0xc1bf('0x2b')][_0xc1bf('0x43')]({'where':{'id':_0x98b245[_0xc1bf('0x45')]['id']}})[_0xc1bf('0x24')](handleEntityNotFound(_0x428614,null))[_0xc1bf('0x24')](saveUpdates(_0x98b245[_0xc1bf('0x44')],null))['then'](respondWithResult(_0x428614,null))['catch'](handleError(_0x428614,null));};exports[_0xc1bf('0x46')]=function(_0x1d97eb,_0x3e921d){return db[_0xc1bf('0x2b')][_0xc1bf('0x43')]({'where':{'id':_0x1d97eb[_0xc1bf('0x45')]['id']}})[_0xc1bf('0x24')](handleEntityNotFound(_0x3e921d,null))[_0xc1bf('0x24')](removeEntity(_0x3e921d,null))[_0xc1bf('0x41')](handleError(_0x3e921d,null));}; \ No newline at end of file +var _0x08cc=['Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','include','findAll','catch','show','params','keys','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','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','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map'];(function(_0x4e1a49,_0x4da738){var _0x136aae=function(_0x3ffd93){while(--_0x3ffd93){_0x4e1a49['push'](_0x4e1a49['shift']());}};_0x136aae(++_0x4da738);}(_0x08cc,0x156));var _0xc08c=function(_0x4c4f1c,_0x273f15){_0x4c4f1c=_0x4c4f1c-0x0;var _0x253df0=_0x08cc[_0x4c4f1c];return _0x253df0;};'use strict';var emlformat=require(_0xc08c('0x0'));var rimraf=require(_0xc08c('0x1'));var zipdir=require(_0xc08c('0x2'));var jsonpatch=require(_0xc08c('0x3'));var rp=require(_0xc08c('0x4'));var moment=require(_0xc08c('0x5'));var BPromise=require(_0xc08c('0x6'));var Mustache=require(_0xc08c('0x7'));var util=require(_0xc08c('0x8'));var path=require('path');var sox=require(_0xc08c('0x9'));var csv=require(_0xc08c('0xa'));var ejs=require(_0xc08c('0xb'));var fs=require('fs');var fs_extra=require(_0xc08c('0xc'));var _=require(_0xc08c('0xd'));var squel=require(_0xc08c('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc08c('0xf'));var toCsv=require(_0xc08c('0xa'));var querystring=require(_0xc08c('0x10'));var Papa=require(_0xc08c('0x11'));var Redis=require(_0xc08c('0x12'));var authService=require(_0xc08c('0x13'));var qs=require(_0xc08c('0x14'));var as=require(_0xc08c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc08c('0x16'))(_0xc08c('0x17'));var utils=require(_0xc08c('0x18'));var config=require(_0xc08c('0x19'));var licenseUtil=require(_0xc08c('0x1a'));var db=require(_0xc08c('0x1b'))['db'];function respondWithStatusCode(_0x2f5108,_0x375e2d){_0x375e2d=_0x375e2d||0xcc;return function(_0x5ec839){if(_0x5ec839){return _0x2f5108['sendStatus'](_0x375e2d);}return _0x2f5108[_0xc08c('0x1c')](_0x375e2d)[_0xc08c('0x1d')]();};}function respondWithResult(_0x54ddac,_0x32f4a0){_0x32f4a0=_0x32f4a0||0xc8;return function(_0x55566a){if(_0x55566a){return _0x54ddac[_0xc08c('0x1c')](_0x32f4a0)['json'](_0x55566a);}};}function respondWithFilteredResult(_0x3aa18b,_0xbcfd0a){return function(_0x17cb57){if(_0x17cb57){var _0x3cb6bc=typeof _0xbcfd0a['offset']===_0xc08c('0x1e')&&typeof _0xbcfd0a[_0xc08c('0x1f')]===_0xc08c('0x1e');var _0x496c03=_0x17cb57[_0xc08c('0x20')];var _0x47e3b8=_0x3cb6bc?0x0:_0xbcfd0a['offset'];var _0x15cb30=_0x3cb6bc?_0x17cb57[_0xc08c('0x20')]:_0xbcfd0a[_0xc08c('0x21')]+_0xbcfd0a[_0xc08c('0x1f')];var _0x42ea97;if(_0x15cb30>=_0x496c03){_0x15cb30=_0x496c03;_0x42ea97=0xc8;}else{_0x42ea97=0xce;}_0x3aa18b[_0xc08c('0x1c')](_0x42ea97);return _0x3aa18b[_0xc08c('0x22')](_0xc08c('0x23'),_0x47e3b8+'-'+_0x15cb30+'/'+_0x496c03)[_0xc08c('0x24')](_0x17cb57);}return null;};}function patchUpdates(_0x3a397e){return function(_0x46499b){try{jsonpatch[_0xc08c('0x25')](_0x46499b,_0x3a397e,!![]);}catch(_0x261ad4){return BPromise['reject'](_0x261ad4);}return _0x46499b[_0xc08c('0x26')]();};}function saveUpdates(_0x4f1399,_0x3655a6){return function(_0x3b055b){if(_0x3b055b){return _0x3b055b[_0xc08c('0x27')](_0x4f1399)[_0xc08c('0x28')](function(_0x2df903){return _0x2df903;});}return null;};}function removeEntity(_0x411bab,_0x4cdf13){return function(_0x572e6e){if(_0x572e6e){return _0x572e6e[_0xc08c('0x29')]()[_0xc08c('0x28')](function(){_0x411bab[_0xc08c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b858,_0x1b85a7){return function(_0x4d08c4){if(!_0x4d08c4){_0x41b858[_0xc08c('0x2a')](0x194);}return _0x4d08c4;};}function handleError(_0x58c853,_0x41b951){_0x41b951=_0x41b951||0x1f4;return function(_0x511631){logger[_0xc08c('0x2b')](_0x511631[_0xc08c('0x2c')]);if(_0x511631[_0xc08c('0x2d')]){delete _0x511631[_0xc08c('0x2d')];}_0x58c853[_0xc08c('0x1c')](_0x41b951)['send'](_0x511631);};}exports[_0xc08c('0x2e')]=function(_0x4a2a67,_0x374a7d){var _0x4166ee={},_0x398d34={},_0x8ebdb6={'count':0x0,'rows':[]};var _0x12d2cf=_[_0xc08c('0x2f')](db[_0xc08c('0x30')][_0xc08c('0x31')],function(_0x388599){return{'name':_0x388599[_0xc08c('0x32')],'type':_0x388599[_0xc08c('0x33')][_0xc08c('0x34')]};});_0x398d34[_0xc08c('0x35')]=_[_0xc08c('0x2f')](_0x12d2cf,_0xc08c('0x2d'));_0x398d34[_0xc08c('0x36')]=_['keys'](_0x4a2a67[_0xc08c('0x36')]);_0x398d34[_0xc08c('0x37')]=_[_0xc08c('0x38')](_0x398d34[_0xc08c('0x35')],_0x398d34[_0xc08c('0x36')]);_0x4166ee[_0xc08c('0x39')]=_[_0xc08c('0x38')](_0x398d34[_0xc08c('0x35')],qs[_0xc08c('0x3a')](_0x4a2a67[_0xc08c('0x36')][_0xc08c('0x3a')]));_0x4166ee[_0xc08c('0x39')]=_0x4166ee['attributes'][_0xc08c('0x3b')]?_0x4166ee[_0xc08c('0x39')]:_0x398d34[_0xc08c('0x35')];if(!_0x4a2a67['query'][_0xc08c('0x3c')](_0xc08c('0x3d'))){_0x4166ee[_0xc08c('0x1f')]=qs['limit'](_0x4a2a67[_0xc08c('0x36')]['limit']);_0x4166ee[_0xc08c('0x21')]=qs['offset'](_0x4a2a67['query'][_0xc08c('0x21')]);}_0x4166ee[_0xc08c('0x3e')]=qs[_0xc08c('0x3f')](_0x4a2a67[_0xc08c('0x36')]['sort']);_0x4166ee[_0xc08c('0x40')]=qs[_0xc08c('0x37')](_['pick'](_0x4a2a67[_0xc08c('0x36')],_0x398d34[_0xc08c('0x37')]),_0x12d2cf);if(_0x4a2a67[_0xc08c('0x36')]['filter']){_0x4166ee['where']=_[_0xc08c('0x41')](_0x4166ee[_0xc08c('0x40')],{'$or':_[_0xc08c('0x2f')](_0x12d2cf,function(_0x4aaf13){if(_0x4aaf13[_0xc08c('0x33')]!=='VIRTUAL'){var _0x4fb4f9={};_0x4fb4f9[_0x4aaf13[_0xc08c('0x2d')]]={'$like':'%'+_0x4a2a67[_0xc08c('0x36')][_0xc08c('0x42')]+'%'};return _0x4fb4f9;}})});}_0x4166ee=_[_0xc08c('0x41')]({},_0x4166ee,_0x4a2a67[_0xc08c('0x43')]);var _0x404703={'where':_0x4166ee[_0xc08c('0x40')]};return db[_0xc08c('0x30')]['count'](_0x404703)[_0xc08c('0x28')](function(_0x2d5b4d){_0x8ebdb6[_0xc08c('0x20')]=_0x2d5b4d;if(_0x4a2a67[_0xc08c('0x36')]['includeAll']){_0x4166ee[_0xc08c('0x44')]=[{'all':!![]}];}return db[_0xc08c('0x30')][_0xc08c('0x45')](_0x4166ee);})[_0xc08c('0x28')](function(_0xba66f2){_0x8ebdb6['rows']=_0xba66f2;return _0x8ebdb6;})[_0xc08c('0x28')](respondWithFilteredResult(_0x374a7d,_0x4166ee))[_0xc08c('0x46')](handleError(_0x374a7d,null));};exports[_0xc08c('0x47')]=function(_0x1c248a,_0x47d6a4){var _0x5bb5f6={'raw':!![],'where':{'id':_0x1c248a[_0xc08c('0x48')]['id']}},_0x22932f={};_0x22932f[_0xc08c('0x35')]=_[_0xc08c('0x49')](db[_0xc08c('0x30')][_0xc08c('0x31')]);_0x22932f[_0xc08c('0x36')]=_[_0xc08c('0x49')](_0x1c248a['query']);_0x22932f[_0xc08c('0x37')]=_[_0xc08c('0x38')](_0x22932f['model'],_0x22932f['query']);_0x5bb5f6[_0xc08c('0x39')]=_[_0xc08c('0x38')](_0x22932f[_0xc08c('0x35')],qs[_0xc08c('0x3a')](_0x1c248a['query']['fields']));_0x5bb5f6[_0xc08c('0x39')]=_0x5bb5f6[_0xc08c('0x39')][_0xc08c('0x3b')]?_0x5bb5f6[_0xc08c('0x39')]:_0x22932f[_0xc08c('0x35')];if(_0x1c248a['query'][_0xc08c('0x4a')]){_0x5bb5f6['include']=[{'all':!![]}];}_0x5bb5f6=_['merge']({},_0x5bb5f6,_0x1c248a['options']);return db[_0xc08c('0x30')][_0xc08c('0x4b')](_0x5bb5f6)['then'](handleEntityNotFound(_0x47d6a4,null))['then'](respondWithResult(_0x47d6a4,null))[_0xc08c('0x46')](handleError(_0x47d6a4,null));};exports[_0xc08c('0x4c')]=function(_0x4646e8,_0x4f52b8){return db[_0xc08c('0x30')]['create'](_0x4646e8['body'],{})[_0xc08c('0x28')](respondWithResult(_0x4f52b8,0xc9))[_0xc08c('0x46')](handleError(_0x4f52b8,null));};exports[_0xc08c('0x27')]=function(_0x2061f6,_0x5e038e){if(_0x2061f6[_0xc08c('0x4d')]['id']){delete _0x2061f6[_0xc08c('0x4d')]['id'];}return db['Dynamics365Field'][_0xc08c('0x4b')]({'where':{'id':_0x2061f6[_0xc08c('0x48')]['id']}})[_0xc08c('0x28')](handleEntityNotFound(_0x5e038e,null))[_0xc08c('0x28')](saveUpdates(_0x2061f6['body'],null))[_0xc08c('0x28')](respondWithResult(_0x5e038e,null))['catch'](handleError(_0x5e038e,null));};exports[_0xc08c('0x29')]=function(_0x38a72c,_0x44ba49){return db[_0xc08c('0x30')]['find']({'where':{'id':_0x38a72c[_0xc08c('0x48')]['id']}})['then'](handleEntityNotFound(_0x44ba49,null))[_0xc08c('0x28')](removeEntity(_0x44ba49,null))[_0xc08c('0x46')](handleError(_0x44ba49,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 81d0999..72774d8 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 _0xa032=['dynamics365_unique_index','idField','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields'];(function(_0x59ae8f,_0x148344){var _0x3900b5=function(_0x63af51){while(--_0x63af51){_0x59ae8f['push'](_0x59ae8f['shift']());}};_0x3900b5(++_0x148344);}(_0xa032,0x1d6));var _0x2a03=function(_0x4fda88,_0x1a4d19){_0x4fda88=_0x4fda88-0x0;var _0xe37511=_0xa032[_0x4fda88];return _0xe37511;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2a03('0x0'))(_0x2a03('0x1'));var moment=require(_0x2a03('0x2'));var BPromise=require('bluebird');var rp=require(_0x2a03('0x3'));var fs=require('fs');var path=require(_0x2a03('0x4'));var rimraf=require(_0x2a03('0x5'));var config=require(_0x2a03('0x6'));var attributes=require(_0x2a03('0x7'));module['exports']=function(_0x1b41fb,_0x1be195){return _0x1b41fb[_0x2a03('0x8')](_0x2a03('0x9'),attributes,{'tableName':_0x2a03('0xa'),'paranoid':![],'indexes':[{'name':_0x2a03('0xb'),'fields':[_0x2a03('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9a9=['lodash','util','moment','bluebird','request-promise','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9a9,0x18c));var _0x9e9a=function(_0x3988e0,_0x1aea8e){_0x3988e0=_0x3988e0-0x0;var _0x5badee=_0xe9a9[_0x3988e0];return _0x5badee;};'use strict';var _=require(_0x9e9a('0x0'));var util=require(_0x9e9a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9e9a('0x2'));var BPromise=require(_0x9e9a('0x3'));var rp=require(_0x9e9a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e9a('0x5'));var config=require('../../config/environment');var attributes=require(_0x9e9a('0x6'));module[_0x9e9a('0x7')]=function(_0x5abc48,_0x58bed0){return _0x5abc48['define'](_0x9e9a('0x8'),attributes,{'tableName':_0x9e9a('0x9'),'paranoid':![],'indexes':[{'name':_0x9e9a('0xa'),'fields':[_0x9e9a('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index e0494d7..334ea5d 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 _0x3d79=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x40be1a,_0x13b843){var _0x4e6f36=function(_0x85771f){while(--_0x85771f){_0x40be1a['push'](_0x40be1a['shift']());}};_0x4e6f36(++_0x13b843);}(_0x3d79,0xa2));var _0x93d7=function(_0x1b7745,_0x4f684d){_0x1b7745=_0x1b7745-0x0;var _0x2a4fcf=_0x3d79[_0x1b7745];return _0x2a4fcf;};'use strict';var _=require(_0x93d7('0x0'));var util=require(_0x93d7('0x1'));var moment=require(_0x93d7('0x2'));var BPromise=require('bluebird');var rs=require(_0x93d7('0x3'));var fs=require('fs');var Redis=require(_0x93d7('0x4'));var db=require(_0x93d7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93d7('0x6'))(_0x93d7('0x7'));var config=require(_0x93d7('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x185164,_0x1a71f4,_0x588a5e){return new BPromise(function(_0x1c81ab,_0x58d657){return client['request'](_0x185164,_0x588a5e)[_0x93d7('0x9')](function(_0x5e4c17){logger[_0x93d7('0xa')](_0x93d7('0xb'),_0x1a71f4,_0x93d7('0xc'));logger['debug'](_0x93d7('0xd'),_0x1a71f4,'request\x20sent',JSON[_0x93d7('0xe')](_0x5e4c17));if(_0x5e4c17['error']){if(_0x5e4c17['error']['code']===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x1a71f4,_0x5e4c17[_0x93d7('0xf')]['message']);return _0x58d657(_0x5e4c17[_0x93d7('0xf')]['message']);}logger[_0x93d7('0xf')](_0x93d7('0xb'),_0x1a71f4,_0x5e4c17[_0x93d7('0xf')][_0x93d7('0x10')]);return _0x1c81ab(_0x5e4c17[_0x93d7('0xf')][_0x93d7('0x10')]);}else{logger[_0x93d7('0xa')](_0x93d7('0xb'),_0x1a71f4,_0x93d7('0xc'));_0x1c81ab(_0x5e4c17['result'][_0x93d7('0x10')]);}})[_0x93d7('0x11')](function(_0x1622bf){logger['error'](_0x93d7('0xb'),_0x1a71f4,_0x1622bf);_0x58d657(_0x1622bf);});});} \ No newline at end of file +var _0x445f=['rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x35d2b4,_0x37be04){var _0x36b0c1=function(_0x2245d8){while(--_0x2245d8){_0x35d2b4['push'](_0x35d2b4['shift']());}};_0x36b0c1(++_0x37be04);}(_0x445f,0x102));var _0xf445=function(_0x489187,_0x3f382b){_0x489187=_0x489187-0x0;var _0x4a332e=_0x445f[_0x489187];return _0x4a332e;};'use strict';var _=require(_0xf445('0x0'));var util=require(_0xf445('0x1'));var moment=require(_0xf445('0x2'));var BPromise=require('bluebird');var rs=require(_0xf445('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf445('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf445('0x5'))(_0xf445('0x6'));var config=require(_0xf445('0x7'));var jayson=require(_0xf445('0x8'));var client=jayson['client'][_0xf445('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17d321,_0x5e4e13,_0xd9f7b7){return new BPromise(function(_0x3e4899,_0x2936f8){return client[_0xf445('0xa')](_0x17d321,_0xd9f7b7)[_0xf445('0xb')](function(_0x551440){logger[_0xf445('0xc')](_0xf445('0xd'),_0x5e4e13,_0xf445('0xe'));logger[_0xf445('0xf')](_0xf445('0x10'),_0x5e4e13,'request\x20sent',JSON[_0xf445('0x11')](_0x551440));if(_0x551440[_0xf445('0x12')]){if(_0x551440[_0xf445('0x12')][_0xf445('0x13')]===0x1f4){logger[_0xf445('0x12')](_0xf445('0xd'),_0x5e4e13,_0x551440[_0xf445('0x12')][_0xf445('0x14')]);return _0x2936f8(_0x551440[_0xf445('0x12')]['message']);}logger[_0xf445('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x5e4e13,_0x551440[_0xf445('0x12')]['message']);return _0x3e4899(_0x551440[_0xf445('0x12')]['message']);}else{logger['info'](_0xf445('0xd'),_0x5e4e13,_0xf445('0xe'));_0x3e4899(_0x551440[_0xf445('0x15')][_0xf445('0x14')]);}})['catch'](function(_0x324453){logger['error'](_0xf445('0xd'),_0x5e4e13,_0x324453);_0x2936f8(_0x324453);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 13382fe..d5c72c4 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 _0x2064=['/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','post'];(function(_0x4a3570,_0x169197){var _0x235ca8=function(_0x4d167b){while(--_0x4d167b){_0x4a3570['push'](_0x4a3570['shift']());}};_0x235ca8(++_0x169197);}(_0x2064,0x91));var _0x4206=function(_0xc06b19,_0x4a4230){_0xc06b19=_0xc06b19-0x0;var _0x3f0a2f=_0x2064[_0xc06b19];return _0x3f0a2f;};'use strict';var multer=require(_0x4206('0x0'));var util=require(_0x4206('0x1'));var path=require(_0x4206('0x2'));var timeout=require(_0x4206('0x3'));var express=require(_0x4206('0x4'));var router=express[_0x4206('0x5')]();var fs_extra=require(_0x4206('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4206('0x7'));var config=require(_0x4206('0x8'));var controller=require('./intFreshdeskAccount.controller');router[_0x4206('0x9')]('/',auth[_0x4206('0xa')](),controller['index']);router['get'](_0x4206('0xb'),auth[_0x4206('0xa')](),controller[_0x4206('0xc')]);router['get']('/:id/configurations',auth[_0x4206('0xa')](),controller['getConfigurations']);router[_0x4206('0x9')](_0x4206('0xd'),auth[_0x4206('0xa')](),controller[_0x4206('0xe')]);router[_0x4206('0xf')]('/',auth[_0x4206('0xa')](),controller['create']);router['post'](_0x4206('0x10'),auth[_0x4206('0xa')](),controller[_0x4206('0x11')]);router[_0x4206('0x12')](_0x4206('0xb'),auth['isAuthenticated'](),controller[_0x4206('0x13')]);router[_0x4206('0x14')](_0x4206('0xb'),auth[_0x4206('0xa')](),controller[_0x4206('0x15')]);module[_0x4206('0x16')]=router; \ No newline at end of file +var _0xda24=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3e5e83,_0xd68bd0){var _0x17b414=function(_0x288d9f){while(--_0x288d9f){_0x3e5e83['push'](_0x3e5e83['shift']());}};_0x17b414(++_0xd68bd0);}(_0xda24,0x182));var _0x4da2=function(_0x11de69,_0x46c7c6){_0x11de69=_0x11de69-0x0;var _0x211379=_0xda24[_0x11de69];return _0x211379;};'use strict';var multer=require(_0x4da2('0x0'));var util=require(_0x4da2('0x1'));var path=require(_0x4da2('0x2'));var timeout=require(_0x4da2('0x3'));var express=require(_0x4da2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4da2('0x5'));var interaction=require(_0x4da2('0x6'));var config=require(_0x4da2('0x7'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x4da2('0x8')](),controller[_0x4da2('0x9')]);router[_0x4da2('0xa')](_0x4da2('0xb'),auth[_0x4da2('0x8')](),controller['show']);router[_0x4da2('0xa')](_0x4da2('0xc'),auth['isAuthenticated'](),controller[_0x4da2('0xd')]);router['get'](_0x4da2('0xe'),auth[_0x4da2('0x8')](),controller[_0x4da2('0xf')]);router[_0x4da2('0x10')]('/',auth[_0x4da2('0x8')](),controller['create']);router[_0x4da2('0x10')]('/:id/configurations',auth[_0x4da2('0x8')](),controller[_0x4da2('0x11')]);router[_0x4da2('0x12')](_0x4da2('0xb'),auth['isAuthenticated'](),controller[_0x4da2('0x13')]);router[_0x4da2('0x14')](_0x4da2('0xb'),auth[_0x4da2('0x8')](),controller[_0x4da2('0x15')]);module[_0x4da2('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 a89f21e..99c6273 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 _0x0424=['username','STRING'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0x0424,0x159));var _0x4042=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0x0424[_0x3203a1];return _0x24215e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4042('0x0')]},'description':{'type':Sequelize[_0x4042('0x0')]},'username':{'type':Sequelize[_0x4042('0x0')],'unique':_0x4042('0x1')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4042('0x0')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x7b84=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x7b84,0x17c));var _0x47b8=function(_0x5c6bdc,_0x3e4b2a){_0x5c6bdc=_0x5c6bdc-0x0;var _0x55b244=_0x7b84[_0x5c6bdc];return _0x55b244;};'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 d321439..8dec84c 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 _0x4dd3=['%s/%s','api/v2/ticket_fields','%s:X','apiKey','toString','requester','subject','agent','description','priority','source','ticket_type','group','remove','includes','default','label','choices','capitalize','test','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','apply','reject','destroy','then','error','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','show','params','find','create','body','findOne','order','filter','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','substring','lastIndexOf','GET','format'];(function(_0x2af445,_0x2622cc){var _0x1e1204=function(_0x3ed34f){while(--_0x3ed34f){_0x2af445['push'](_0x2af445['shift']());}};_0x1e1204(++_0x2622cc);}(_0x4dd3,0xf5));var _0x34dd=function(_0x2fdf82,_0x322e7c){_0x2fdf82=_0x2fdf82-0x0;var _0x2382f5=_0x4dd3[_0x2fdf82];return _0x2382f5;};'use strict';var emlformat=require(_0x34dd('0x0'));var rimraf=require(_0x34dd('0x1'));var zipdir=require(_0x34dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x34dd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x34dd('0x4'));var util=require(_0x34dd('0x5'));var path=require(_0x34dd('0x6'));var sox=require('sox');var csv=require(_0x34dd('0x7'));var ejs=require(_0x34dd('0x8'));var fs=require('fs');var fs_extra=require(_0x34dd('0x9'));var _=require(_0x34dd('0xa'));var squel=require(_0x34dd('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x34dd('0xc'));var toCsv=require(_0x34dd('0x7'));var querystring=require(_0x34dd('0xd'));var Papa=require('papaparse');var Redis=require(_0x34dd('0xe'));var authService=require(_0x34dd('0xf'));var qs=require(_0x34dd('0x10'));var as=require(_0x34dd('0x11'));var hardwareService=require(_0x34dd('0x12'));var logger=require(_0x34dd('0x13'))('api');var utils=require(_0x34dd('0x14'));var config=require(_0x34dd('0x15'));var licenseUtil=require(_0x34dd('0x16'));var db=require(_0x34dd('0x17'))['db'];var integrations=require(_0x34dd('0x18'));function respondWithStatusCode(_0x4e7cd1,_0x5ad320){_0x5ad320=_0x5ad320||0xcc;return function(_0x2724b1){if(_0x2724b1){return _0x4e7cd1[_0x34dd('0x19')](_0x5ad320);}return _0x4e7cd1[_0x34dd('0x1a')](_0x5ad320)['end']();};}function respondWithResult(_0x2f20bb,_0x488154){_0x488154=_0x488154||0xc8;return function(_0x26836d){if(_0x26836d){return _0x2f20bb[_0x34dd('0x1a')](_0x488154)[_0x34dd('0x1b')](_0x26836d);}};}function respondWithFilteredResult(_0x1cfaa5,_0x17a790){return function(_0x18ca7e){if(_0x18ca7e){var _0x4f7be5=typeof _0x17a790[_0x34dd('0x1c')]===_0x34dd('0x1d')&&typeof _0x17a790[_0x34dd('0x1e')]===_0x34dd('0x1d');var _0x2c9cb9=_0x18ca7e[_0x34dd('0x1f')];var _0x3e2084=_0x4f7be5?0x0:_0x17a790[_0x34dd('0x1c')];var _0xcbe2b5=_0x4f7be5?_0x18ca7e[_0x34dd('0x1f')]:_0x17a790[_0x34dd('0x1c')]+_0x17a790[_0x34dd('0x1e')];var _0x31cec7;if(_0xcbe2b5>=_0x2c9cb9){_0xcbe2b5=_0x2c9cb9;_0x31cec7=0xc8;}else{_0x31cec7=0xce;}_0x1cfaa5[_0x34dd('0x1a')](_0x31cec7);return _0x1cfaa5['set']('Content-Range',_0x3e2084+'-'+_0xcbe2b5+'/'+_0x2c9cb9)[_0x34dd('0x1b')](_0x18ca7e);}return null;};}function patchUpdates(_0x4012f9){return function(_0xb414a6){try{jsonpatch[_0x34dd('0x20')](_0xb414a6,_0x4012f9,!![]);}catch(_0x3f7495){return BPromise[_0x34dd('0x21')](_0x3f7495);}return _0xb414a6['save']();};}function saveUpdates(_0x41e4bf,_0x22c7fc){return function(_0x4a59f9){if(_0x4a59f9){return _0x4a59f9['update'](_0x41e4bf)['then'](function(_0x1e3d81){return _0x1e3d81;});}return null;};}function removeEntity(_0x56fa5e,_0x93beae){return function(_0x330641){if(_0x330641){return _0x330641[_0x34dd('0x22')]()[_0x34dd('0x23')](function(){_0x56fa5e[_0x34dd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d1df6,_0x35a5af){return function(_0x549b19){if(!_0x549b19){_0x4d1df6[_0x34dd('0x19')](0x194);}return _0x549b19;};}function handleError(_0x3a4633,_0x3a245d){_0x3a245d=_0x3a245d||0x1f4;return function(_0x1cee94){logger[_0x34dd('0x24')](_0x1cee94[_0x34dd('0x25')]);if(_0x1cee94['name']){delete _0x1cee94[_0x34dd('0x26')];}_0x3a4633[_0x34dd('0x1a')](_0x3a245d)['send'](_0x1cee94);};}exports[_0x34dd('0x27')]=function(_0x170a82,_0x172a8a){var _0x24d42c={},_0x4f68ba={},_0x5bef8e={'count':0x0,'rows':[]};var _0x991b71=_[_0x34dd('0x28')](db[_0x34dd('0x29')][_0x34dd('0x2a')],function(_0x2310c9){return{'name':_0x2310c9[_0x34dd('0x2b')],'type':_0x2310c9[_0x34dd('0x2c')][_0x34dd('0x2d')]};});_0x4f68ba['model']=_['map'](_0x991b71,_0x34dd('0x26'));_0x4f68ba[_0x34dd('0x2e')]=_[_0x34dd('0x2f')](_0x170a82[_0x34dd('0x2e')]);_0x4f68ba[_0x34dd('0x30')]=_[_0x34dd('0x31')](_0x4f68ba['model'],_0x4f68ba['query']);_0x24d42c[_0x34dd('0x32')]=_[_0x34dd('0x31')](_0x4f68ba[_0x34dd('0x33')],qs[_0x34dd('0x34')](_0x170a82[_0x34dd('0x2e')][_0x34dd('0x34')]));_0x24d42c['attributes']=_0x24d42c[_0x34dd('0x32')][_0x34dd('0x35')]?_0x24d42c['attributes']:_0x4f68ba['model'];if(!_0x170a82[_0x34dd('0x2e')][_0x34dd('0x36')](_0x34dd('0x37'))){_0x24d42c[_0x34dd('0x1e')]=qs[_0x34dd('0x1e')](_0x170a82[_0x34dd('0x2e')][_0x34dd('0x1e')]);_0x24d42c[_0x34dd('0x1c')]=qs['offset'](_0x170a82[_0x34dd('0x2e')][_0x34dd('0x1c')]);}_0x24d42c['order']=qs[_0x34dd('0x38')](_0x170a82[_0x34dd('0x2e')][_0x34dd('0x38')]);_0x24d42c[_0x34dd('0x39')]=qs['filters'](_[_0x34dd('0x3a')](_0x170a82[_0x34dd('0x2e')],_0x4f68ba['filters']),_0x991b71);if(_0x170a82[_0x34dd('0x2e')]['filter']){_0x24d42c['where']=_[_0x34dd('0x3b')](_0x24d42c[_0x34dd('0x39')],{'$or':_[_0x34dd('0x28')](_0x991b71,function(_0x36d7c7){if(_0x36d7c7[_0x34dd('0x2c')]!==_0x34dd('0x3c')){var _0x31ea50={};_0x31ea50[_0x36d7c7[_0x34dd('0x26')]]={'$like':'%'+_0x170a82[_0x34dd('0x2e')]['filter']+'%'};return _0x31ea50;}})});}_0x24d42c=_[_0x34dd('0x3b')]({},_0x24d42c,_0x170a82[_0x34dd('0x3d')]);var _0x1b116c={'where':_0x24d42c[_0x34dd('0x39')]};return db[_0x34dd('0x29')][_0x34dd('0x1f')](_0x1b116c)[_0x34dd('0x23')](function(_0x423ba7){_0x5bef8e[_0x34dd('0x1f')]=_0x423ba7;if(_0x170a82['query']['includeAll']){_0x24d42c[_0x34dd('0x3e')]=[{'all':!![]}];}return db[_0x34dd('0x29')][_0x34dd('0x3f')](_0x24d42c);})['then'](function(_0x21efaf){_0x5bef8e['rows']=_0x21efaf;return _0x5bef8e;})[_0x34dd('0x23')](respondWithFilteredResult(_0x172a8a,_0x24d42c))[_0x34dd('0x40')](handleError(_0x172a8a,null));};exports[_0x34dd('0x41')]=function(_0x45667b,_0x4a0e1c){var _0x45b193={'raw':![],'where':{'id':_0x45667b[_0x34dd('0x42')]['id']}},_0x405041={};_0x405041[_0x34dd('0x33')]=_[_0x34dd('0x2f')](db[_0x34dd('0x29')][_0x34dd('0x2a')]);_0x405041[_0x34dd('0x2e')]=_[_0x34dd('0x2f')](_0x45667b['query']);_0x405041[_0x34dd('0x30')]=_[_0x34dd('0x31')](_0x405041[_0x34dd('0x33')],_0x405041[_0x34dd('0x2e')]);_0x45b193['attributes']=_[_0x34dd('0x31')](_0x405041[_0x34dd('0x33')],qs[_0x34dd('0x34')](_0x45667b[_0x34dd('0x2e')][_0x34dd('0x34')]));_0x45b193[_0x34dd('0x32')]=_0x45b193[_0x34dd('0x32')][_0x34dd('0x35')]?_0x45b193['attributes']:_0x405041[_0x34dd('0x33')];if(_0x45667b[_0x34dd('0x2e')]['includeAll']){_0x45b193[_0x34dd('0x3e')]=[{'all':!![]}];}_0x45b193=_[_0x34dd('0x3b')]({},_0x45b193,_0x45667b[_0x34dd('0x3d')]);return db[_0x34dd('0x29')][_0x34dd('0x43')](_0x45b193)[_0x34dd('0x23')](handleEntityNotFound(_0x4a0e1c,null))['then'](respondWithResult(_0x4a0e1c,null))[_0x34dd('0x40')](handleError(_0x4a0e1c,null));};exports[_0x34dd('0x44')]=function(_0x175ca4,_0x2788b7){return db[_0x34dd('0x29')]['create'](_0x175ca4[_0x34dd('0x45')],{})[_0x34dd('0x23')](respondWithResult(_0x2788b7,0xc9))['catch'](handleError(_0x2788b7,null));};exports['update']=function(_0x3a0fef,_0x9b8f64){if(_0x3a0fef[_0x34dd('0x45')]['id']){delete _0x3a0fef[_0x34dd('0x45')]['id'];}return db[_0x34dd('0x29')][_0x34dd('0x43')]({'where':{'id':_0x3a0fef['params']['id']}})['then'](handleEntityNotFound(_0x9b8f64,null))[_0x34dd('0x23')](saveUpdates(_0x3a0fef[_0x34dd('0x45')],null))['then'](respondWithResult(_0x9b8f64,null))[_0x34dd('0x40')](handleError(_0x9b8f64,null));};exports[_0x34dd('0x22')]=function(_0x2fd1e,_0x1de70e){return db['FreshdeskAccount'][_0x34dd('0x43')]({'where':{'id':_0x2fd1e[_0x34dd('0x42')]['id']}})[_0x34dd('0x23')](handleEntityNotFound(_0x1de70e,null))[_0x34dd('0x23')](removeEntity(_0x1de70e,null))[_0x34dd('0x40')](handleError(_0x1de70e,null));};exports['getConfigurations']=function(_0x47cd1b,_0x50ac2d,_0x505e2b){var _0x521062={};var _0x17e544={};var _0x105d09;var _0x181c8e;return db['FreshdeskAccount'][_0x34dd('0x46')]({'where':{'id':_0x47cd1b[_0x34dd('0x42')]['id']}})['then'](handleEntityNotFound(_0x50ac2d,null))[_0x34dd('0x23')](function(_0x1d55b5){if(_0x1d55b5){_0x105d09=_0x1d55b5;_0x17e544[_0x34dd('0x33')]=_[_0x34dd('0x2f')](db['FreshdeskConfiguration'][_0x34dd('0x2a')]);_0x17e544[_0x34dd('0x2e')]=_[_0x34dd('0x2f')](_0x47cd1b['query']);_0x17e544[_0x34dd('0x30')]=_[_0x34dd('0x31')](_0x17e544[_0x34dd('0x33')],_0x17e544[_0x34dd('0x2e')]);_0x521062[_0x34dd('0x32')]=_[_0x34dd('0x31')](_0x17e544['model'],qs[_0x34dd('0x34')](_0x47cd1b[_0x34dd('0x2e')][_0x34dd('0x34')]));_0x521062[_0x34dd('0x32')]=_0x521062['attributes'][_0x34dd('0x35')]?_0x521062[_0x34dd('0x32')]:_0x17e544['model'];_0x521062[_0x34dd('0x47')]=qs[_0x34dd('0x38')](_0x47cd1b[_0x34dd('0x2e')][_0x34dd('0x38')]);_0x521062[_0x34dd('0x39')]=qs[_0x34dd('0x30')](_['pick'](_0x47cd1b[_0x34dd('0x2e')],_0x17e544[_0x34dd('0x30')]));if(_0x47cd1b[_0x34dd('0x2e')][_0x34dd('0x48')]){_0x521062[_0x34dd('0x39')]=_[_0x34dd('0x3b')](_0x521062[_0x34dd('0x39')],{'$or':_[_0x34dd('0x28')](_0x521062['attributes'],function(_0x1d562e){var _0xa84ad9={};_0xa84ad9[_0x1d562e]={'$like':'%'+_0x47cd1b[_0x34dd('0x2e')][_0x34dd('0x48')]+'%'};return _0xa84ad9;})});}_0x521062=_[_0x34dd('0x3b')]({},_0x521062,_0x47cd1b[_0x34dd('0x3d')]);return _0x105d09[_0x34dd('0x49')](_0x521062);}})[_0x34dd('0x23')](function(_0x274173){if(_0x274173){_0x181c8e=_0x274173['length'];if(!_0x47cd1b[_0x34dd('0x2e')][_0x34dd('0x36')](_0x34dd('0x37'))){_0x521062[_0x34dd('0x1e')]=qs[_0x34dd('0x1e')](_0x47cd1b[_0x34dd('0x2e')]['limit']);_0x521062[_0x34dd('0x1c')]=qs[_0x34dd('0x1c')](_0x47cd1b[_0x34dd('0x2e')][_0x34dd('0x1c')]);}return _0x105d09[_0x34dd('0x49')](_0x521062);}})[_0x34dd('0x23')](function(_0x4b7136){if(_0x4b7136){return _0x4b7136?{'count':_0x181c8e,'rows':_0x4b7136}:null;}})[_0x34dd('0x23')](respondWithResult(_0x50ac2d,null))['catch'](handleError(_0x50ac2d,null));};exports[_0x34dd('0x4a')]=function(_0x55219f,_0x21fbef,_0x5d6620){if(_0x55219f['body']['id']){delete _0x55219f[_0x34dd('0x45')]['id'];}return db[_0x34dd('0x29')][_0x34dd('0x46')]({'where':{'id':_0x55219f['params']['id']}})[_0x34dd('0x23')](handleEntityNotFound(_0x21fbef,null))[_0x34dd('0x23')](function(_0x158bdd){if(_0x158bdd){_0x55219f[_0x34dd('0x45')][_0x34dd('0x4b')]=_0x158bdd['id'];_0x55219f[_0x34dd('0x45')][_0x34dd('0x4c')]=integrations['getSubjects'](_0x55219f[_0x34dd('0x45')][_0x34dd('0x4d')],_0x55219f[_0x34dd('0x45')]['type']);_0x55219f[_0x34dd('0x45')][_0x34dd('0x4e')]=integrations[_0x34dd('0x4f')](_0x55219f[_0x34dd('0x45')][_0x34dd('0x4d')],_0x55219f[_0x34dd('0x45')]['type']);return db[_0x34dd('0x50')]['create'](_0x55219f[_0x34dd('0x45')],{'include':[{'model':db[_0x34dd('0x51')],'as':_0x34dd('0x4c')},{'model':db[_0x34dd('0x51')],'as':_0x34dd('0x4e')}]});}return null;})[_0x34dd('0x23')](respondWithResult(_0x21fbef,null))[_0x34dd('0x40')](handleError(_0x21fbef,null));};exports[_0x34dd('0x52')]=function(_0x1acfaf,_0x3cd434,_0x3e4c33){var _0x313858='';return db[_0x34dd('0x29')][_0x34dd('0x46')]({'where':{'id':_0x1acfaf[_0x34dd('0x42')]['id']},'attributes':['id',_0x34dd('0x53'),'apiKey']})[_0x34dd('0x23')](handleEntityNotFound(_0x3cd434,null))[_0x34dd('0x23')](function(_0x43e0e1){if(_0x43e0e1){_0x313858=_0x43e0e1[_0x34dd('0x53')];var _0x55b55b=_0x313858['slice'](-0x1);if(_0x55b55b==='/'){_0x313858=_0x313858[_0x34dd('0x54')](0x0,_0x313858[_0x34dd('0x55')](_0x55b55b));}return rp({'method':_0x34dd('0x56'),'uri':util[_0x34dd('0x57')](_0x34dd('0x58'),_0x313858,_0x34dd('0x59')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x34dd('0x57')](_0x34dd('0x5a'),_0x43e0e1[_0x34dd('0x5b')]))[_0x34dd('0x5c')]('base64'))},'json':!![]});}})[_0x34dd('0x23')](function(_0x53788d){if(_0x53788d){var _0x360e03=[_0x34dd('0x5d'),_0x34dd('0x5e'),_0x34dd('0x5f'),_0x34dd('0x60'),_0x34dd('0x1a'),_0x34dd('0x61'),'group',_0x34dd('0x62'),_0x34dd('0x63'),_0x34dd('0x64'),'company'];_[_0x34dd('0x65')](_0x53788d,function(_0x5356a1){return _0x360e03[_0x34dd('0x66')](_0x5356a1['name'])||!_0x5356a1[_0x34dd('0x67')]&&_0x5356a1[_0x34dd('0x2c')]!=='custom_text'&&_0x5356a1['type']!=='custom_dropdown';});return{'count':_0x53788d['length'],'rows':_[_0x34dd('0x28')](_0x53788d,function(_0x13c0d2){return{'id':_0x13c0d2[_0x34dd('0x26')],'name':_0x13c0d2[_0x34dd('0x68')],'custom':!_0x13c0d2['default'],'options':_0x13c0d2[_0x34dd('0x69')]?_[_0x34dd('0x28')](_0x13c0d2[_0x34dd('0x69')],function(_0x3f71fe){return{'name':_[_0x34dd('0x6a')](_0x3f71fe),'value':_0x3f71fe};}):[]};})};}})['then'](respondWithResult(_0x3cd434,null))[_0x34dd('0x40')](function(_0x466a38){var _0x48eb1d=_0x1acfaf[_0x34dd('0x2e')][_0x34dd('0x6b')]?0x1f4:_0x466a38['statusCode']||0x1f4;logger[_0x34dd('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x34dd('0x52'),_0x48eb1d,JSON[_0x34dd('0x6c')](_0x466a38));delete _0x466a38[_0x34dd('0x26')];if(_0x48eb1d===0x191){_0x48eb1d=0x190;}_0x3cd434[_0x34dd('0x1a')](_0x48eb1d)['send'](_0x1acfaf['query'][_0x34dd('0x6b')]?{'message':_0x34dd('0x6d'),'statusCode':_0x466a38[_0x34dd('0x6e')]}:_0x466a38);});}; \ No newline at end of file +var _0x4d6e=['stringify','send','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','end','error','index','map','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','type','options','FreshdeskAccount','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','destroy','params','getConfigurations','FreshdeskConfiguration','sort','addConfiguration','findOne','AccountId','channel','getDescriptions','Subjects','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','agent','priority','group','ticket_type','company','remove','includes','default','custom_text','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x105a8a,_0x15a3a2){var _0x105a0e=function(_0x3beeb1){while(--_0x3beeb1){_0x105a8a['push'](_0x105a8a['shift']());}};_0x105a0e(++_0x15a3a2);}(_0x4d6e,0x77));var _0xe4d6=function(_0x48fd24,_0x13fa0b){_0x48fd24=_0x48fd24-0x0;var _0x2edb3a=_0x4d6e[_0x48fd24];return _0x2edb3a;};'use strict';var emlformat=require(_0xe4d6('0x0'));var rimraf=require(_0xe4d6('0x1'));var zipdir=require(_0xe4d6('0x2'));var jsonpatch=require(_0xe4d6('0x3'));var rp=require(_0xe4d6('0x4'));var moment=require('moment');var BPromise=require(_0xe4d6('0x5'));var Mustache=require(_0xe4d6('0x6'));var util=require(_0xe4d6('0x7'));var path=require(_0xe4d6('0x8'));var sox=require(_0xe4d6('0x9'));var csv=require(_0xe4d6('0xa'));var ejs=require(_0xe4d6('0xb'));var fs=require('fs');var fs_extra=require(_0xe4d6('0xc'));var _=require(_0xe4d6('0xd'));var squel=require(_0xe4d6('0xe'));var crypto=require(_0xe4d6('0xf'));var jsforce=require(_0xe4d6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe4d6('0xa'));var querystring=require(_0xe4d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xe4d6('0x12'));var authService=require(_0xe4d6('0x13'));var qs=require(_0xe4d6('0x14'));var as=require(_0xe4d6('0x15'));var hardwareService=require(_0xe4d6('0x16'));var logger=require(_0xe4d6('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe4d6('0x18'));var licenseUtil=require(_0xe4d6('0x19'));var db=require(_0xe4d6('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1a80eb,_0x3f7441){_0x3f7441=_0x3f7441||0xcc;return function(_0x53eac7){if(_0x53eac7){return _0x1a80eb[_0xe4d6('0x1b')](_0x3f7441);}return _0x1a80eb[_0xe4d6('0x1c')](_0x3f7441)['end']();};}function respondWithResult(_0xdc7f40,_0x780caa){_0x780caa=_0x780caa||0xc8;return function(_0x178f59){if(_0x178f59){return _0xdc7f40[_0xe4d6('0x1c')](_0x780caa)['json'](_0x178f59);}};}function respondWithFilteredResult(_0x2e04a9,_0x28e001){return function(_0x3dbe31){if(_0x3dbe31){var _0x1ca3fb=typeof _0x28e001['offset']===_0xe4d6('0x1d')&&typeof _0x28e001['limit']==='undefined';var _0x24e9cb=_0x3dbe31[_0xe4d6('0x1e')];var _0x68b15f=_0x1ca3fb?0x0:_0x28e001[_0xe4d6('0x1f')];var _0xe99d00=_0x1ca3fb?_0x3dbe31['count']:_0x28e001[_0xe4d6('0x1f')]+_0x28e001[_0xe4d6('0x20')];var _0xab15c8;if(_0xe99d00>=_0x24e9cb){_0xe99d00=_0x24e9cb;_0xab15c8=0xc8;}else{_0xab15c8=0xce;}_0x2e04a9[_0xe4d6('0x1c')](_0xab15c8);return _0x2e04a9[_0xe4d6('0x21')](_0xe4d6('0x22'),_0x68b15f+'-'+_0xe99d00+'/'+_0x24e9cb)[_0xe4d6('0x23')](_0x3dbe31);}return null;};}function patchUpdates(_0x27e824){return function(_0x52d88d){try{jsonpatch[_0xe4d6('0x24')](_0x52d88d,_0x27e824,!![]);}catch(_0x48a404){return BPromise[_0xe4d6('0x25')](_0x48a404);}return _0x52d88d[_0xe4d6('0x26')]();};}function saveUpdates(_0x31f569,_0x162b57){return function(_0x185b9e){if(_0x185b9e){return _0x185b9e[_0xe4d6('0x27')](_0x31f569)[_0xe4d6('0x28')](function(_0x202f67){return _0x202f67;});}return null;};}function removeEntity(_0x59233f,_0x404fe1){return function(_0x12b159){if(_0x12b159){return _0x12b159['destroy']()[_0xe4d6('0x28')](function(){_0x59233f[_0xe4d6('0x1c')](0xcc)[_0xe4d6('0x29')]();});}};}function handleEntityNotFound(_0x3e8f41,_0x13aeec){return function(_0x2f467f){if(!_0x2f467f){_0x3e8f41[_0xe4d6('0x1b')](0x194);}return _0x2f467f;};}function handleError(_0xb4fe6a,_0x53110a){_0x53110a=_0x53110a||0x1f4;return function(_0x16d492){logger[_0xe4d6('0x2a')](_0x16d492['stack']);if(_0x16d492['name']){delete _0x16d492['name'];}_0xb4fe6a[_0xe4d6('0x1c')](_0x53110a)['send'](_0x16d492);};}exports[_0xe4d6('0x2b')]=function(_0x4b83fa,_0x4f0485){var _0x39f7d5={},_0x4e45f0={},_0x54ae70={'count':0x0,'rows':[]};var _0x112cbd=_[_0xe4d6('0x2c')](db['FreshdeskAccount']['rawAttributes'],function(_0x3fd34f){return{'name':_0x3fd34f[_0xe4d6('0x2d')],'type':_0x3fd34f['type'][_0xe4d6('0x2e')]};});_0x4e45f0[_0xe4d6('0x2f')]=_[_0xe4d6('0x2c')](_0x112cbd,_0xe4d6('0x30'));_0x4e45f0[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x4b83fa['query']);_0x4e45f0['filters']=_[_0xe4d6('0x33')](_0x4e45f0[_0xe4d6('0x2f')],_0x4e45f0['query']);_0x39f7d5[_0xe4d6('0x34')]=_['intersection'](_0x4e45f0[_0xe4d6('0x2f')],qs['fields'](_0x4b83fa['query'][_0xe4d6('0x35')]));_0x39f7d5['attributes']=_0x39f7d5['attributes'][_0xe4d6('0x36')]?_0x39f7d5[_0xe4d6('0x34')]:_0x4e45f0[_0xe4d6('0x2f')];if(!_0x4b83fa[_0xe4d6('0x31')]['hasOwnProperty'](_0xe4d6('0x37'))){_0x39f7d5[_0xe4d6('0x20')]=qs[_0xe4d6('0x20')](_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x20')]);_0x39f7d5[_0xe4d6('0x1f')]=qs[_0xe4d6('0x1f')](_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x1f')]);}_0x39f7d5[_0xe4d6('0x38')]=qs['sort'](_0x4b83fa[_0xe4d6('0x31')]['sort']);_0x39f7d5[_0xe4d6('0x39')]=qs[_0xe4d6('0x3a')](_[_0xe4d6('0x3b')](_0x4b83fa[_0xe4d6('0x31')],_0x4e45f0['filters']),_0x112cbd);if(_0x4b83fa['query'][_0xe4d6('0x3c')]){_0x39f7d5[_0xe4d6('0x39')]=_[_0xe4d6('0x3d')](_0x39f7d5[_0xe4d6('0x39')],{'$or':_[_0xe4d6('0x2c')](_0x112cbd,function(_0x20c286){if(_0x20c286[_0xe4d6('0x3e')]!=='VIRTUAL'){var _0x252dfd={};_0x252dfd[_0x20c286[_0xe4d6('0x30')]]={'$like':'%'+_0x4b83fa['query']['filter']+'%'};return _0x252dfd;}})});}_0x39f7d5=_[_0xe4d6('0x3d')]({},_0x39f7d5,_0x4b83fa[_0xe4d6('0x3f')]);var _0x4950cf={'where':_0x39f7d5[_0xe4d6('0x39')]};return db[_0xe4d6('0x40')][_0xe4d6('0x1e')](_0x4950cf)[_0xe4d6('0x28')](function(_0x48207b){_0x54ae70[_0xe4d6('0x1e')]=_0x48207b;if(_0x4b83fa[_0xe4d6('0x31')][_0xe4d6('0x41')]){_0x39f7d5[_0xe4d6('0x42')]=[{'all':!![]}];}return db[_0xe4d6('0x40')][_0xe4d6('0x43')](_0x39f7d5);})['then'](function(_0x5002dc){_0x54ae70['rows']=_0x5002dc;return _0x54ae70;})[_0xe4d6('0x28')](respondWithFilteredResult(_0x4f0485,_0x39f7d5))[_0xe4d6('0x44')](handleError(_0x4f0485,null));};exports[_0xe4d6('0x45')]=function(_0x314ad6,_0x4bc768){var _0x3d2516={'raw':![],'where':{'id':_0x314ad6['params']['id']}},_0x526593={};_0x526593[_0xe4d6('0x2f')]=_[_0xe4d6('0x32')](db[_0xe4d6('0x40')][_0xe4d6('0x46')]);_0x526593[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x314ad6['query']);_0x526593[_0xe4d6('0x3a')]=_[_0xe4d6('0x33')](_0x526593[_0xe4d6('0x2f')],_0x526593[_0xe4d6('0x31')]);_0x3d2516[_0xe4d6('0x34')]=_[_0xe4d6('0x33')](_0x526593[_0xe4d6('0x2f')],qs[_0xe4d6('0x35')](_0x314ad6['query'][_0xe4d6('0x35')]));_0x3d2516[_0xe4d6('0x34')]=_0x3d2516[_0xe4d6('0x34')]['length']?_0x3d2516['attributes']:_0x526593[_0xe4d6('0x2f')];if(_0x314ad6[_0xe4d6('0x31')][_0xe4d6('0x41')]){_0x3d2516[_0xe4d6('0x42')]=[{'all':!![]}];}_0x3d2516=_[_0xe4d6('0x3d')]({},_0x3d2516,_0x314ad6[_0xe4d6('0x3f')]);return db[_0xe4d6('0x40')][_0xe4d6('0x47')](_0x3d2516)[_0xe4d6('0x28')](handleEntityNotFound(_0x4bc768,null))[_0xe4d6('0x28')](respondWithResult(_0x4bc768,null))[_0xe4d6('0x44')](handleError(_0x4bc768,null));};exports[_0xe4d6('0x48')]=function(_0xe6fb2c,_0x194307){return db[_0xe4d6('0x40')][_0xe4d6('0x48')](_0xe6fb2c['body'],{})[_0xe4d6('0x28')](respondWithResult(_0x194307,0xc9))[_0xe4d6('0x44')](handleError(_0x194307,null));};exports['update']=function(_0x2bea52,_0x538e25){if(_0x2bea52[_0xe4d6('0x49')]['id']){delete _0x2bea52[_0xe4d6('0x49')]['id'];}return db['FreshdeskAccount'][_0xe4d6('0x47')]({'where':{'id':_0x2bea52['params']['id']}})['then'](handleEntityNotFound(_0x538e25,null))[_0xe4d6('0x28')](saveUpdates(_0x2bea52[_0xe4d6('0x49')],null))['then'](respondWithResult(_0x538e25,null))[_0xe4d6('0x44')](handleError(_0x538e25,null));};exports[_0xe4d6('0x4a')]=function(_0x24ed6b,_0x278c96){return db[_0xe4d6('0x40')]['find']({'where':{'id':_0x24ed6b[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x278c96,null))['then'](removeEntity(_0x278c96,null))['catch'](handleError(_0x278c96,null));};exports[_0xe4d6('0x4c')]=function(_0x12ecaf,_0x30612c,_0x478827){var _0x14f615={};var _0xc55241={};var _0x1da5e9;var _0x427575;return db[_0xe4d6('0x40')]['findOne']({'where':{'id':_0x12ecaf[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x30612c,null))[_0xe4d6('0x28')](function(_0x1b22c2){if(_0x1b22c2){_0x1da5e9=_0x1b22c2;_0xc55241[_0xe4d6('0x2f')]=_['keys'](db[_0xe4d6('0x4d')][_0xe4d6('0x46')]);_0xc55241[_0xe4d6('0x31')]=_[_0xe4d6('0x32')](_0x12ecaf[_0xe4d6('0x31')]);_0xc55241[_0xe4d6('0x3a')]=_['intersection'](_0xc55241[_0xe4d6('0x2f')],_0xc55241[_0xe4d6('0x31')]);_0x14f615[_0xe4d6('0x34')]=_[_0xe4d6('0x33')](_0xc55241[_0xe4d6('0x2f')],qs[_0xe4d6('0x35')](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x35')]));_0x14f615[_0xe4d6('0x34')]=_0x14f615[_0xe4d6('0x34')][_0xe4d6('0x36')]?_0x14f615['attributes']:_0xc55241[_0xe4d6('0x2f')];_0x14f615[_0xe4d6('0x38')]=qs[_0xe4d6('0x4e')](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x4e')]);_0x14f615[_0xe4d6('0x39')]=qs['filters'](_['pick'](_0x12ecaf[_0xe4d6('0x31')],_0xc55241[_0xe4d6('0x3a')]));if(_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x3c')]){_0x14f615['where']=_['merge'](_0x14f615[_0xe4d6('0x39')],{'$or':_[_0xe4d6('0x2c')](_0x14f615[_0xe4d6('0x34')],function(_0x2b6451){var _0x4b8047={};_0x4b8047[_0x2b6451]={'$like':'%'+_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x3c')]+'%'};return _0x4b8047;})});}_0x14f615=_['merge']({},_0x14f615,_0x12ecaf[_0xe4d6('0x3f')]);return _0x1da5e9['getConfigurations'](_0x14f615);}})[_0xe4d6('0x28')](function(_0x3b155b){if(_0x3b155b){_0x427575=_0x3b155b['length'];if(!_0x12ecaf[_0xe4d6('0x31')]['hasOwnProperty'](_0xe4d6('0x37'))){_0x14f615[_0xe4d6('0x20')]=qs['limit'](_0x12ecaf[_0xe4d6('0x31')][_0xe4d6('0x20')]);_0x14f615[_0xe4d6('0x1f')]=qs['offset'](_0x12ecaf['query']['offset']);}return _0x1da5e9[_0xe4d6('0x4c')](_0x14f615);}})[_0xe4d6('0x28')](function(_0x2ae27f){if(_0x2ae27f){return _0x2ae27f?{'count':_0x427575,'rows':_0x2ae27f}:null;}})[_0xe4d6('0x28')](respondWithResult(_0x30612c,null))[_0xe4d6('0x44')](handleError(_0x30612c,null));};exports[_0xe4d6('0x4f')]=function(_0x520608,_0x2d780d,_0x17d129){if(_0x520608[_0xe4d6('0x49')]['id']){delete _0x520608[_0xe4d6('0x49')]['id'];}return db[_0xe4d6('0x40')][_0xe4d6('0x50')]({'where':{'id':_0x520608[_0xe4d6('0x4b')]['id']}})[_0xe4d6('0x28')](handleEntityNotFound(_0x2d780d,null))[_0xe4d6('0x28')](function(_0x4fde5e){if(_0x4fde5e){_0x520608['body'][_0xe4d6('0x51')]=_0x4fde5e['id'];_0x520608[_0xe4d6('0x49')]['Subjects']=integrations['getSubjects'](_0x520608[_0xe4d6('0x49')][_0xe4d6('0x52')],_0x520608[_0xe4d6('0x49')][_0xe4d6('0x3e')]);_0x520608[_0xe4d6('0x49')]['Descriptions']=integrations[_0xe4d6('0x53')](_0x520608[_0xe4d6('0x49')][_0xe4d6('0x52')],_0x520608[_0xe4d6('0x49')][_0xe4d6('0x3e')]);return db[_0xe4d6('0x4d')]['create'](_0x520608[_0xe4d6('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0xe4d6('0x54')},{'model':db[_0xe4d6('0x55')],'as':_0xe4d6('0x56')}]});}return null;})[_0xe4d6('0x28')](respondWithResult(_0x2d780d,null))['catch'](handleError(_0x2d780d,null));};exports[_0xe4d6('0x57')]=function(_0xea686f,_0x3da67a,_0x309421){var _0x5e10ca='';return db[_0xe4d6('0x40')][_0xe4d6('0x50')]({'where':{'id':_0xea686f[_0xe4d6('0x4b')]['id']},'attributes':['id',_0xe4d6('0x58'),_0xe4d6('0x59')]})[_0xe4d6('0x28')](handleEntityNotFound(_0x3da67a,null))[_0xe4d6('0x28')](function(_0xc91476){if(_0xc91476){_0x5e10ca=_0xc91476[_0xe4d6('0x58')];var _0xeaa39=_0x5e10ca[_0xe4d6('0x5a')](-0x1);if(_0xeaa39==='/'){_0x5e10ca=_0x5e10ca[_0xe4d6('0x5b')](0x0,_0x5e10ca[_0xe4d6('0x5c')](_0xeaa39));}return rp({'method':_0xe4d6('0x5d'),'uri':util[_0xe4d6('0x5e')](_0xe4d6('0x5f'),_0x5e10ca,_0xe4d6('0x60')),'headers':{'Authorization':util[_0xe4d6('0x5e')]('Basic\x20%s',new Buffer(util[_0xe4d6('0x5e')](_0xe4d6('0x61'),_0xc91476[_0xe4d6('0x59')]))[_0xe4d6('0x62')]('base64'))},'json':!![]});}})[_0xe4d6('0x28')](function(_0x36a77f){if(_0x36a77f){var _0x256541=['requester','subject',_0xe4d6('0x63'),'description',_0xe4d6('0x1c'),_0xe4d6('0x64'),_0xe4d6('0x65'),'source',_0xe4d6('0x66'),_0xe4d6('0x65'),_0xe4d6('0x67')];_[_0xe4d6('0x68')](_0x36a77f,function(_0x2b2bdc){return _0x256541[_0xe4d6('0x69')](_0x2b2bdc[_0xe4d6('0x30')])||!_0x2b2bdc[_0xe4d6('0x6a')]&&_0x2b2bdc[_0xe4d6('0x3e')]!==_0xe4d6('0x6b')&&_0x2b2bdc[_0xe4d6('0x3e')]!=='custom_dropdown';});return{'count':_0x36a77f[_0xe4d6('0x36')],'rows':_['map'](_0x36a77f,function(_0x1ea6b7){return{'id':_0x1ea6b7['name'],'name':_0x1ea6b7[_0xe4d6('0x6c')],'custom':!_0x1ea6b7[_0xe4d6('0x6a')],'options':_0x1ea6b7[_0xe4d6('0x6d')]?_[_0xe4d6('0x2c')](_0x1ea6b7[_0xe4d6('0x6d')],function(_0x258f2d){return{'name':_[_0xe4d6('0x6e')](_0x258f2d),'value':_0x258f2d};}):[]};})};}})[_0xe4d6('0x28')](respondWithResult(_0x3da67a,null))[_0xe4d6('0x44')](function(_0x55e95c){var _0x87d700=_0xea686f[_0xe4d6('0x31')]['test']?0x1f4:_0x55e95c[_0xe4d6('0x6f')]||0x1f4;logger[_0xe4d6('0x2a')](_0xe4d6('0x70'),'getFields',_0x87d700,JSON[_0xe4d6('0x71')](_0x55e95c));delete _0x55e95c['name'];if(_0x87d700===0x191){_0x87d700=0x190;}_0x3da67a[_0xe4d6('0x1c')](_0x87d700)[_0xe4d6('0x72')](_0xea686f[_0xe4d6('0x31')][_0xe4d6('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x55e95c[_0xe4d6('0x6f')]}:_0x55e95c);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index b56dafb..dd40de5 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 _0x3dd4=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','lodash'];(function(_0x3aaa1b,_0xd27aa2){var _0x1b10a1=function(_0x67ee0e){while(--_0x67ee0e){_0x3aaa1b['push'](_0x3aaa1b['shift']());}};_0x1b10a1(++_0xd27aa2);}(_0x3dd4,0x17f));var _0x43dd=function(_0x1d24aa,_0x4c34ed){_0x1d24aa=_0x1d24aa-0x0;var _0x3b0798=_0x3dd4[_0x1d24aa];return _0x3b0798;};'use strict';var _=require(_0x43dd('0x0'));var util=require('util');var logger=require(_0x43dd('0x1'))(_0x43dd('0x2'));var moment=require(_0x43dd('0x3'));var BPromise=require(_0x43dd('0x4'));var rp=require(_0x43dd('0x5'));var fs=require('fs');var path=require(_0x43dd('0x6'));var rimraf=require(_0x43dd('0x7'));var config=require(_0x43dd('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x43dd('0x9'));module['exports']=function(_0x5edff1,_0x55cc6f){return _0x5edff1[_0x43dd('0xa')](_0x43dd('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cb8=['exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x38923b,_0x1003fb){var _0x17f099=function(_0x9a4ff0){while(--_0x9a4ff0){_0x38923b['push'](_0x38923b['shift']());}};_0x17f099(++_0x1003fb);}(_0x6cb8,0x1ba));var _0x86cb=function(_0x23a642,_0x266032){_0x23a642=_0x23a642-0x0;var _0x2c63be=_0x6cb8[_0x23a642];return _0x2c63be;};'use strict';var _=require(_0x86cb('0x0'));var util=require('util');var logger=require(_0x86cb('0x1'))(_0x86cb('0x2'));var moment=require(_0x86cb('0x3'));var BPromise=require(_0x86cb('0x4'));var rp=require(_0x86cb('0x5'));var fs=require('fs');var path=require(_0x86cb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x86cb('0x7'));var integrations=require(_0x86cb('0x8'));module[_0x86cb('0x9')]=function(_0x5acc66,_0x18ead4){return _0x5acc66[_0x86cb('0xa')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','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 d09c04a..b0c0ad2 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 _0x4365=['../../config/environment','jayson/promise','http','request','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshdeskAccount','findAll','options','attributes','limit','include','map','model','then','ShowFreshdeskAccount','FreshdeskAccount','find','raw','where','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x558099,_0x4be744){var _0x18ac2e=function(_0x1e1e9b){while(--_0x1e1e9b){_0x558099['push'](_0x558099['shift']());}};_0x18ac2e(++_0x4be744);}(_0x4365,0x82));var _0x5436=function(_0x446970,_0x2e8abc){_0x446970=_0x446970-0x0;var _0xccb49a=_0x4365[_0x446970];return _0xccb49a;};'use strict';var _=require('lodash');var util=require(_0x5436('0x0'));var moment=require('moment');var BPromise=require(_0x5436('0x1'));var rs=require(_0x5436('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5436('0x3'))['db'];var utils=require(_0x5436('0x4'));var logger=require('../../config/logger')(_0x5436('0x5'));var config=require(_0x5436('0x6'));var jayson=require(_0x5436('0x7'));var client=jayson['client'][_0x5436('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33f971,_0x5a2937,_0x53145c){return new BPromise(function(_0x55ae7c,_0x8b2263){return client[_0x5436('0x9')](_0x33f971,_0x53145c)['then'](function(_0x44d4f8){logger['info'](_0x5436('0xa'),_0x5a2937,_0x5436('0xb'));logger[_0x5436('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5a2937,_0x5436('0xb'),JSON[_0x5436('0xd')](_0x44d4f8));if(_0x44d4f8[_0x5436('0xe')]){if(_0x44d4f8[_0x5436('0xe')][_0x5436('0xf')]===0x1f4){logger[_0x5436('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x5a2937,_0x44d4f8[_0x5436('0xe')][_0x5436('0x10')]);return _0x8b2263(_0x44d4f8[_0x5436('0xe')][_0x5436('0x10')]);}logger['error'](_0x5436('0xa'),_0x5a2937,_0x44d4f8[_0x5436('0xe')][_0x5436('0x10')]);return _0x55ae7c(_0x44d4f8[_0x5436('0xe')]['message']);}else{logger[_0x5436('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x5a2937,'request\x20sent');_0x55ae7c(_0x44d4f8[_0x5436('0x12')][_0x5436('0x10')]);}})[_0x5436('0x13')](function(_0x484f93){logger[_0x5436('0xe')](_0x5436('0xa'),_0x5a2937,_0x484f93);_0x8b2263(_0x484f93);});});}exports[_0x5436('0x14')]=function(_0x225d0f){var _0x6dcfce=this;return new Promise(function(_0x74c002,_0x392bcb){return db['FreshdeskAccount'][_0x5436('0x15')]({'raw':_0x225d0f[_0x5436('0x16')]?_0x225d0f[_0x5436('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x225d0f[_0x5436('0x16')]?_0x225d0f[_0x5436('0x16')]['where']||null:null,'attributes':_0x225d0f['options']?_0x225d0f[_0x5436('0x16')][_0x5436('0x17')]||null:null,'limit':_0x225d0f[_0x5436('0x16')]?_0x225d0f[_0x5436('0x16')][_0x5436('0x18')]||null:null,'include':_0x225d0f['options']?_0x225d0f[_0x5436('0x16')]['include']?_['map'](_0x225d0f['options'][_0x5436('0x19')],function(_0x5e9665){return{'model':db[_0x5e9665['model']],'as':_0x5e9665['as'],'attributes':_0x5e9665['attributes'],'include':_0x5e9665['include']?_[_0x5436('0x1a')](_0x5e9665[_0x5436('0x19')],function(_0x3812dd){return{'model':db[_0x3812dd[_0x5436('0x1b')]],'as':_0x3812dd['as'],'attributes':_0x3812dd[_0x5436('0x17')],'include':_0x3812dd[_0x5436('0x19')]?_['map'](_0x3812dd[_0x5436('0x19')],function(_0xae662a){return{'model':db[_0xae662a[_0x5436('0x1b')]],'as':_0xae662a['as'],'attributes':_0xae662a[_0x5436('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5436('0x1c')](function(_0x2a0d54){logger[_0x5436('0x11')](_0x5436('0x14'),_0x225d0f);logger['debug'](_0x5436('0x14'),_0x225d0f,JSON['stringify'](_0x2a0d54));_0x74c002(_0x2a0d54);})['catch'](function(_0x4290fc){logger[_0x5436('0xe')](_0x5436('0x14'),_0x4290fc['message'],_0x225d0f);_0x392bcb(_0x6dcfce[_0x5436('0xe')](0x1f4,_0x4290fc[_0x5436('0x10')]));});});};exports[_0x5436('0x1d')]=function(_0x5074e){var _0x556aa4=this;return new Promise(function(_0x25e61a,_0xb344e4){return db[_0x5436('0x1e')][_0x5436('0x1f')]({'raw':_0x5074e[_0x5436('0x16')]?_0x5074e[_0x5436('0x16')][_0x5436('0x20')]===undefined?!![]:![]:!![],'where':_0x5074e[_0x5436('0x16')]?_0x5074e['options'][_0x5436('0x21')]||null:null,'attributes':_0x5074e[_0x5436('0x16')]?_0x5074e[_0x5436('0x16')][_0x5436('0x17')]||null:null,'include':_0x5074e[_0x5436('0x16')]?_0x5074e[_0x5436('0x16')][_0x5436('0x19')]?_[_0x5436('0x1a')](_0x5074e['options'][_0x5436('0x19')],function(_0x5b65ac){return{'model':db[_0x5b65ac['model']],'as':_0x5b65ac['as'],'attributes':_0x5b65ac['attributes'],'include':_0x5b65ac[_0x5436('0x19')]?_[_0x5436('0x1a')](_0x5b65ac[_0x5436('0x19')],function(_0x25e859){return{'model':db[_0x25e859[_0x5436('0x1b')]],'as':_0x25e859['as'],'attributes':_0x25e859[_0x5436('0x17')],'include':_0x25e859[_0x5436('0x19')]?_[_0x5436('0x1a')](_0x25e859[_0x5436('0x19')],function(_0x3fb17f){return{'model':db[_0x3fb17f[_0x5436('0x1b')]],'as':_0x3fb17f['as'],'attributes':_0x3fb17f['attributes']};}):[]};}):[]};}):[]:[]})[_0x5436('0x1c')](function(_0x5ce2f8){logger['info']('ShowFreshdeskAccount',_0x5074e);logger[_0x5436('0xc')]('ShowFreshdeskAccount',_0x5074e,JSON['stringify'](_0x5ce2f8));_0x25e61a(_0x5ce2f8);})[_0x5436('0x13')](function(_0x208a0f){logger[_0x5436('0xe')](_0x5436('0x1d'),_0x208a0f['message'],_0x5074e);_0xb344e4(_0x556aa4[_0x5436('0xe')](0x1f4,_0x208a0f[_0x5436('0x10')]));});});}; \ No newline at end of file +var _0xee22=['jayson/promise','client','http','then','info','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetFreshdeskAccount','debug','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5b7f31,_0x1cdfb5){var _0x1b9152=function(_0x25d863){while(--_0x25d863){_0x5b7f31['push'](_0x5b7f31['shift']());}};_0x1b9152(++_0x1cdfb5);}(_0xee22,0x8a));var _0x2ee2=function(_0x5d7eda,_0x5f737b){_0x5d7eda=_0x5d7eda-0x0;var _0x527626=_0xee22[_0x5d7eda];return _0x527626;};'use strict';var _=require(_0x2ee2('0x0'));var util=require(_0x2ee2('0x1'));var moment=require(_0x2ee2('0x2'));var BPromise=require(_0x2ee2('0x3'));var rs=require(_0x2ee2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ee2('0x5'))['db'];var utils=require(_0x2ee2('0x6'));var logger=require(_0x2ee2('0x7'))(_0x2ee2('0x8'));var config=require(_0x2ee2('0x9'));var jayson=require(_0x2ee2('0xa'));var client=jayson[_0x2ee2('0xb')][_0x2ee2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1655f0,_0x25f5f2,_0x1dea50){return new BPromise(function(_0x15912a,_0xa153f2){return client['request'](_0x1655f0,_0x1dea50)[_0x2ee2('0xd')](function(_0x482d94){logger[_0x2ee2('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x25f5f2,_0x2ee2('0xf'));logger['debug'](_0x2ee2('0x10'),_0x25f5f2,_0x2ee2('0xf'),JSON[_0x2ee2('0x11')](_0x482d94));if(_0x482d94[_0x2ee2('0x12')]){if(_0x482d94[_0x2ee2('0x12')][_0x2ee2('0x13')]===0x1f4){logger[_0x2ee2('0x12')](_0x2ee2('0x14'),_0x25f5f2,_0x482d94[_0x2ee2('0x12')][_0x2ee2('0x15')]);return _0xa153f2(_0x482d94['error'][_0x2ee2('0x15')]);}logger[_0x2ee2('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x25f5f2,_0x482d94[_0x2ee2('0x12')][_0x2ee2('0x15')]);return _0x15912a(_0x482d94[_0x2ee2('0x12')][_0x2ee2('0x15')]);}else{logger[_0x2ee2('0xe')](_0x2ee2('0x14'),_0x25f5f2,_0x2ee2('0xf'));_0x15912a(_0x482d94[_0x2ee2('0x16')][_0x2ee2('0x15')]);}})[_0x2ee2('0x17')](function(_0x562eae){logger[_0x2ee2('0x12')](_0x2ee2('0x14'),_0x25f5f2,_0x562eae);_0xa153f2(_0x562eae);});});}exports['GetFreshdeskAccount']=function(_0x2c5de1){var _0x4d01c2=this;return new Promise(function(_0x20dca2,_0x3d09f1){return db[_0x2ee2('0x18')][_0x2ee2('0x19')]({'raw':_0x2c5de1[_0x2ee2('0x1a')]?_0x2c5de1['options'][_0x2ee2('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c5de1[_0x2ee2('0x1a')]?_0x2c5de1[_0x2ee2('0x1a')][_0x2ee2('0x1c')]||null:null,'attributes':_0x2c5de1['options']?_0x2c5de1[_0x2ee2('0x1a')]['attributes']||null:null,'limit':_0x2c5de1[_0x2ee2('0x1a')]?_0x2c5de1['options'][_0x2ee2('0x1d')]||null:null,'include':_0x2c5de1['options']?_0x2c5de1[_0x2ee2('0x1a')][_0x2ee2('0x1e')]?_[_0x2ee2('0x1f')](_0x2c5de1[_0x2ee2('0x1a')][_0x2ee2('0x1e')],function(_0x388aea){return{'model':db[_0x388aea['model']],'as':_0x388aea['as'],'attributes':_0x388aea['attributes'],'include':_0x388aea['include']?_[_0x2ee2('0x1f')](_0x388aea[_0x2ee2('0x1e')],function(_0xa684f3){return{'model':db[_0xa684f3[_0x2ee2('0x20')]],'as':_0xa684f3['as'],'attributes':_0xa684f3[_0x2ee2('0x21')],'include':_0xa684f3[_0x2ee2('0x1e')]?_[_0x2ee2('0x1f')](_0xa684f3[_0x2ee2('0x1e')],function(_0x412a83){return{'model':db[_0x412a83[_0x2ee2('0x20')]],'as':_0x412a83['as'],'attributes':_0x412a83[_0x2ee2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2ee2('0xd')](function(_0x5a0db6){logger[_0x2ee2('0xe')](_0x2ee2('0x22'),_0x2c5de1);logger[_0x2ee2('0x23')](_0x2ee2('0x22'),_0x2c5de1,JSON[_0x2ee2('0x11')](_0x5a0db6));_0x20dca2(_0x5a0db6);})[_0x2ee2('0x17')](function(_0x21ac10){logger[_0x2ee2('0x12')](_0x2ee2('0x22'),_0x21ac10[_0x2ee2('0x15')],_0x2c5de1);_0x3d09f1(_0x4d01c2[_0x2ee2('0x12')](0x1f4,_0x21ac10[_0x2ee2('0x15')]));});});};exports['ShowFreshdeskAccount']=function(_0x1db4e6){var _0xedb707=this;return new Promise(function(_0x172d59,_0x361fc7){return db[_0x2ee2('0x18')]['find']({'raw':_0x1db4e6['options']?_0x1db4e6[_0x2ee2('0x1a')][_0x2ee2('0x1b')]===undefined?!![]:![]:!![],'where':_0x1db4e6[_0x2ee2('0x1a')]?_0x1db4e6[_0x2ee2('0x1a')]['where']||null:null,'attributes':_0x1db4e6[_0x2ee2('0x1a')]?_0x1db4e6[_0x2ee2('0x1a')]['attributes']||null:null,'include':_0x1db4e6['options']?_0x1db4e6[_0x2ee2('0x1a')][_0x2ee2('0x1e')]?_[_0x2ee2('0x1f')](_0x1db4e6[_0x2ee2('0x1a')][_0x2ee2('0x1e')],function(_0x500181){return{'model':db[_0x500181[_0x2ee2('0x20')]],'as':_0x500181['as'],'attributes':_0x500181['attributes'],'include':_0x500181['include']?_[_0x2ee2('0x1f')](_0x500181['include'],function(_0x21e05d){return{'model':db[_0x21e05d[_0x2ee2('0x20')]],'as':_0x21e05d['as'],'attributes':_0x21e05d[_0x2ee2('0x21')],'include':_0x21e05d['include']?_[_0x2ee2('0x1f')](_0x21e05d[_0x2ee2('0x1e')],function(_0x17e56b){return{'model':db[_0x17e56b['model']],'as':_0x17e56b['as'],'attributes':_0x17e56b[_0x2ee2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2ee2('0xd')](function(_0x3ae807){logger[_0x2ee2('0xe')](_0x2ee2('0x24'),_0x1db4e6);logger[_0x2ee2('0x23')](_0x2ee2('0x24'),_0x1db4e6,JSON['stringify'](_0x3ae807));_0x172d59(_0x3ae807);})[_0x2ee2('0x17')](function(_0x2cba2c){logger[_0x2ee2('0x12')](_0x2ee2('0x24'),_0x2cba2c[_0x2ee2('0x15')],_0x1db4e6);_0x361fc7(_0xedb707[_0x2ee2('0x12')](0x1f4,_0x2cba2c['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index c58a20a..ebbbdf2 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 _0x1034=['fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id/tags','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x491842,_0x4ca9af){var _0x54b04e=function(_0x1f62b8){while(--_0x1f62b8){_0x491842['push'](_0x491842['shift']());}};_0x54b04e(++_0x4ca9af);}(_0x1034,0x1ee));var _0x4103=function(_0x239a1a,_0x2d907a){_0x239a1a=_0x239a1a-0x0;var _0x3807c4=_0x1034[_0x239a1a];return _0x3807c4;};'use strict';var multer=require(_0x4103('0x0'));var util=require(_0x4103('0x1'));var path=require(_0x4103('0x2'));var timeout=require(_0x4103('0x3'));var express=require(_0x4103('0x4'));var router=express[_0x4103('0x5')]();var fs_extra=require(_0x4103('0x6'));var auth=require(_0x4103('0x7'));var interaction=require(_0x4103('0x8'));var config=require('../../config/environment');var controller=require(_0x4103('0x9'));router[_0x4103('0xa')]('/',auth[_0x4103('0xb')](),controller['index']);router['get']('/:id',auth[_0x4103('0xb')](),controller['show']);router['get'](_0x4103('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x4103('0xa')](_0x4103('0xd'),auth[_0x4103('0xb')](),controller[_0x4103('0xe')]);router[_0x4103('0xa')](_0x4103('0xf'),auth[_0x4103('0xb')](),controller[_0x4103('0x10')]);router['get']('/:id/tags',auth[_0x4103('0xb')](),controller['getTags']);router[_0x4103('0x11')]('/',auth['isAuthenticated'](),controller[_0x4103('0x12')]);router['post'](_0x4103('0x13'),auth[_0x4103('0xb')](),controller['setTags']);router[_0x4103('0x14')](_0x4103('0x15'),auth['isAuthenticated'](),controller['update']);router[_0x4103('0x16')](_0x4103('0x15'),auth[_0x4103('0xb')](),controller[_0x4103('0x17')]);module[_0x4103('0x18')]=router; \ No newline at end of file +var _0x1fd7=['post','create','setTags','put','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','getSubjects','getDescriptions','/:id/tags','getTags'];(function(_0x5397f4,_0x3f2c05){var _0x4cba07=function(_0x20b72d){while(--_0x20b72d){_0x5397f4['push'](_0x5397f4['shift']());}};_0x4cba07(++_0x3f2c05);}(_0x1fd7,0x1bb));var _0x71fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fd7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x71fd('0x0'));var util=require('util');var path=require(_0x71fd('0x1'));var timeout=require(_0x71fd('0x2'));var express=require(_0x71fd('0x3'));var router=express['Router']();var fs_extra=require(_0x71fd('0x4'));var auth=require(_0x71fd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x71fd('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x71fd('0x7')]('/',auth[_0x71fd('0x8')](),controller[_0x71fd('0x9')]);router[_0x71fd('0x7')](_0x71fd('0xa'),auth[_0x71fd('0x8')](),controller[_0x71fd('0xb')]);router['get']('/:id/fields',auth[_0x71fd('0x8')](),controller[_0x71fd('0xc')]);router['get']('/:id/subjects',auth[_0x71fd('0x8')](),controller[_0x71fd('0xd')]);router[_0x71fd('0x7')]('/:id/descriptions',auth[_0x71fd('0x8')](),controller[_0x71fd('0xe')]);router['get'](_0x71fd('0xf'),auth['isAuthenticated'](),controller[_0x71fd('0x10')]);router[_0x71fd('0x11')]('/',auth[_0x71fd('0x8')](),controller[_0x71fd('0x12')]);router[_0x71fd('0x11')]('/:id/tags',auth[_0x71fd('0x8')](),controller[_0x71fd('0x13')]);router[_0x71fd('0x14')](_0x71fd('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x71fd('0xa'),auth[_0x71fd('0x8')](),controller[_0x71fd('0x15')]);module[_0x71fd('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ec1ba9b..e28adf2 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 _0xd50e=['exports','STRING','sequelize'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0xd50e,0x18b));var _0xed50=function(_0x22c00c,_0x1de66a){_0x22c00c=_0x22c00c-0x0;var _0x50572c=_0xd50e[_0x22c00c];return _0x50572c;};'use strict';var Sequelize=require(_0xed50('0x0'));module[_0xed50('0x1')]={'name':{'type':Sequelize[_0xed50('0x2')]},'description':{'type':Sequelize[_0xed50('0x2')]}}; \ No newline at end of file +var _0xa195=['sequelize','exports','STRING'];(function(_0x5c82a1,_0x11a05c){var _0xf9dcac=function(_0x53479f){while(--_0x53479f){_0x5c82a1['push'](_0x5c82a1['shift']());}};_0xf9dcac(++_0x11a05c);}(_0xa195,0x1cb));var _0x5a19=function(_0x225165,_0x4176c0){_0x225165=_0x225165-0x0;var _0xd08243=_0xa195[_0x225165];return _0xd08243;};'use strict';var Sequelize=require(_0x5a19('0x0'));module[_0x5a19('0x1')]={'name':{'type':Sequelize[_0x5a19('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 088ce86..d5ea432 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 _0x9760=['index','map','FreshdeskConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','order','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','destroy','name','send'];(function(_0xdd3b26,_0x2c7c63){var _0x4d757c=function(_0x2f86fe){while(--_0x2f86fe){_0xdd3b26['push'](_0xdd3b26['shift']());}};_0x4d757c(++_0x2c7c63);}(_0x9760,0x1d4));var _0x0976=function(_0x2c0fd3,_0x340eb5){_0x2c0fd3=_0x2c0fd3-0x0;var _0x34000b=_0x9760[_0x2c0fd3];return _0x34000b;};'use strict';var emlformat=require(_0x0976('0x0'));var rimraf=require(_0x0976('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0976('0x2'));var rp=require(_0x0976('0x3'));var moment=require(_0x0976('0x4'));var BPromise=require(_0x0976('0x5'));var Mustache=require(_0x0976('0x6'));var util=require(_0x0976('0x7'));var path=require('path');var sox=require(_0x0976('0x8'));var csv=require(_0x0976('0x9'));var ejs=require(_0x0976('0xa'));var fs=require('fs');var fs_extra=require(_0x0976('0xb'));var _=require(_0x0976('0xc'));var squel=require(_0x0976('0xd'));var crypto=require(_0x0976('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0976('0xf'));var toCsv=require(_0x0976('0x9'));var querystring=require(_0x0976('0x10'));var Papa=require(_0x0976('0x11'));var Redis=require(_0x0976('0x12'));var authService=require(_0x0976('0x13'));var qs=require(_0x0976('0x14'));var as=require(_0x0976('0x15'));var hardwareService=require(_0x0976('0x16'));var logger=require('../../config/logger')(_0x0976('0x17'));var utils=require(_0x0976('0x18'));var config=require(_0x0976('0x19'));var licenseUtil=require(_0x0976('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3209e5,_0x5d8d66){_0x5d8d66=_0x5d8d66||0xcc;return function(_0x2f071d){if(_0x2f071d){return _0x3209e5['sendStatus'](_0x5d8d66);}return _0x3209e5[_0x0976('0x1b')](_0x5d8d66)[_0x0976('0x1c')]();};}function respondWithResult(_0x485e42,_0x2907df){_0x2907df=_0x2907df||0xc8;return function(_0x5cae65){if(_0x5cae65){return _0x485e42[_0x0976('0x1b')](_0x2907df)[_0x0976('0x1d')](_0x5cae65);}};}function respondWithFilteredResult(_0x482b44,_0x70c25a){return function(_0x5795ed){if(_0x5795ed){var _0x19f90f=typeof _0x70c25a['offset']===_0x0976('0x1e')&&typeof _0x70c25a[_0x0976('0x1f')]===_0x0976('0x1e');var _0x28581a=_0x5795ed['count'];var _0x18ee61=_0x19f90f?0x0:_0x70c25a[_0x0976('0x20')];var _0xfb5f00=_0x19f90f?_0x5795ed[_0x0976('0x21')]:_0x70c25a[_0x0976('0x20')]+_0x70c25a['limit'];var _0x536d43;if(_0xfb5f00>=_0x28581a){_0xfb5f00=_0x28581a;_0x536d43=0xc8;}else{_0x536d43=0xce;}_0x482b44['status'](_0x536d43);return _0x482b44[_0x0976('0x22')](_0x0976('0x23'),_0x18ee61+'-'+_0xfb5f00+'/'+_0x28581a)[_0x0976('0x1d')](_0x5795ed);}return null;};}function patchUpdates(_0x47f1a7){return function(_0x2066be){try{jsonpatch[_0x0976('0x24')](_0x2066be,_0x47f1a7,!![]);}catch(_0x19ee60){return BPromise['reject'](_0x19ee60);}return _0x2066be[_0x0976('0x25')]();};}function saveUpdates(_0x194641,_0x9e35e){return function(_0x4ae27e){if(_0x4ae27e){return _0x4ae27e[_0x0976('0x26')](_0x194641)['then'](function(_0x4a0645){return _0x4a0645;});}return null;};}function removeEntity(_0x550d24,_0x16a4df){return function(_0x1d25b7){if(_0x1d25b7){return _0x1d25b7[_0x0976('0x27')]()['then'](function(){_0x550d24[_0x0976('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49b435,_0x407b68){return function(_0x53976d){if(!_0x53976d){_0x49b435['sendStatus'](0x194);}return _0x53976d;};}function handleError(_0x338da5,_0x5e013d){_0x5e013d=_0x5e013d||0x1f4;return function(_0x55cca2){logger['error'](_0x55cca2['stack']);if(_0x55cca2['name']){delete _0x55cca2[_0x0976('0x28')];}_0x338da5[_0x0976('0x1b')](_0x5e013d)[_0x0976('0x29')](_0x55cca2);};}exports[_0x0976('0x2a')]=function(_0x5c764e,_0x1213e8){var _0x214752={},_0x46da03={},_0x1bad4a={'count':0x0,'rows':[]};var _0x3f0aee=_[_0x0976('0x2b')](db[_0x0976('0x2c')][_0x0976('0x2d')],function(_0x11065d){return{'name':_0x11065d[_0x0976('0x2e')],'type':_0x11065d['type']['key']};});_0x46da03[_0x0976('0x2f')]=_[_0x0976('0x2b')](_0x3f0aee,'name');_0x46da03[_0x0976('0x30')]=_[_0x0976('0x31')](_0x5c764e[_0x0976('0x30')]);_0x46da03[_0x0976('0x32')]=_['intersection'](_0x46da03[_0x0976('0x2f')],_0x46da03['query']);_0x214752['attributes']=_[_0x0976('0x33')](_0x46da03[_0x0976('0x2f')],qs[_0x0976('0x34')](_0x5c764e[_0x0976('0x30')][_0x0976('0x34')]));_0x214752[_0x0976('0x35')]=_0x214752[_0x0976('0x35')][_0x0976('0x36')]?_0x214752[_0x0976('0x35')]:_0x46da03[_0x0976('0x2f')];if(!_0x5c764e[_0x0976('0x30')][_0x0976('0x37')](_0x0976('0x38'))){_0x214752[_0x0976('0x1f')]=qs[_0x0976('0x1f')](_0x5c764e[_0x0976('0x30')][_0x0976('0x1f')]);_0x214752[_0x0976('0x20')]=qs[_0x0976('0x20')](_0x5c764e['query'][_0x0976('0x20')]);}_0x214752['order']=qs['sort'](_0x5c764e[_0x0976('0x30')][_0x0976('0x39')]);_0x214752[_0x0976('0x3a')]=qs['filters'](_[_0x0976('0x3b')](_0x5c764e['query'],_0x46da03[_0x0976('0x32')]),_0x3f0aee);if(_0x5c764e['query'][_0x0976('0x3c')]){_0x214752[_0x0976('0x3a')]=_[_0x0976('0x3d')](_0x214752[_0x0976('0x3a')],{'$or':_[_0x0976('0x2b')](_0x3f0aee,function(_0x51b618){if(_0x51b618[_0x0976('0x3e')]!==_0x0976('0x3f')){var _0x3bb17e={};_0x3bb17e[_0x51b618['name']]={'$like':'%'+_0x5c764e[_0x0976('0x30')][_0x0976('0x3c')]+'%'};return _0x3bb17e;}})});}_0x214752=_[_0x0976('0x3d')]({},_0x214752,_0x5c764e[_0x0976('0x40')]);var _0x1c6a78={'where':_0x214752[_0x0976('0x3a')]};return db[_0x0976('0x2c')][_0x0976('0x21')](_0x1c6a78)[_0x0976('0x41')](function(_0x3007bb){_0x1bad4a[_0x0976('0x21')]=_0x3007bb;if(_0x5c764e[_0x0976('0x30')][_0x0976('0x42')]){_0x214752[_0x0976('0x43')]=[{'all':!![]}];}return db[_0x0976('0x2c')]['findAll'](_0x214752);})[_0x0976('0x41')](function(_0x1a8be7){_0x1bad4a[_0x0976('0x44')]=_0x1a8be7;return _0x1bad4a;})[_0x0976('0x41')](respondWithFilteredResult(_0x1213e8,_0x214752))[_0x0976('0x45')](handleError(_0x1213e8,null));};exports[_0x0976('0x46')]=function(_0x572635,_0x167901){var _0x48facd={'raw':![],'where':{'id':_0x572635[_0x0976('0x47')]['id']}},_0x5a380e={};_0x5a380e[_0x0976('0x2f')]=_['keys'](db[_0x0976('0x2c')][_0x0976('0x2d')]);_0x5a380e[_0x0976('0x30')]=_[_0x0976('0x31')](_0x572635[_0x0976('0x30')]);_0x5a380e[_0x0976('0x32')]=_['intersection'](_0x5a380e[_0x0976('0x2f')],_0x5a380e[_0x0976('0x30')]);_0x48facd[_0x0976('0x35')]=_[_0x0976('0x33')](_0x5a380e['model'],qs['fields'](_0x572635[_0x0976('0x30')]['fields']));_0x48facd[_0x0976('0x35')]=_0x48facd[_0x0976('0x35')][_0x0976('0x36')]?_0x48facd[_0x0976('0x35')]:_0x5a380e[_0x0976('0x2f')];if(_0x572635[_0x0976('0x30')][_0x0976('0x42')]){_0x48facd[_0x0976('0x43')]=[{'all':!![]}];}_0x48facd=_[_0x0976('0x3d')]({},_0x48facd,_0x572635[_0x0976('0x40')]);return db['FreshdeskConfiguration'][_0x0976('0x48')](_0x48facd)[_0x0976('0x41')](handleEntityNotFound(_0x167901,null))['then'](respondWithResult(_0x167901,null))[_0x0976('0x45')](handleError(_0x167901,null));};exports[_0x0976('0x49')]=function(_0x2a854a,_0x5a225e){return db['FreshdeskConfiguration'][_0x0976('0x49')](_0x2a854a[_0x0976('0x4a')],{})[_0x0976('0x41')](respondWithResult(_0x5a225e,0xc9))[_0x0976('0x45')](handleError(_0x5a225e,null));};exports[_0x0976('0x26')]=function(_0x440a2e,_0xe7db0b){if(_0x440a2e[_0x0976('0x4a')]['id']){delete _0x440a2e['body']['id'];}return db['FreshdeskConfiguration'][_0x0976('0x48')]({'where':{'id':_0x440a2e[_0x0976('0x47')]['id']}})['then'](handleEntityNotFound(_0xe7db0b,null))['then'](saveUpdates(_0x440a2e[_0x0976('0x4a')],null))[_0x0976('0x41')](respondWithResult(_0xe7db0b,null))['catch'](handleError(_0xe7db0b,null));};exports[_0x0976('0x27')]=function(_0x468aad,_0x189bbd){return db[_0x0976('0x2c')]['find']({'where':{'id':_0x468aad['params']['id']}})[_0x0976('0x41')](handleEntityNotFound(_0x189bbd,null))[_0x0976('0x41')](removeEntity(_0x189bbd,null))[_0x0976('0x45')](handleError(_0x189bbd,null));};exports[_0x0976('0x4b')]=function(_0x523ea9,_0x5e5045,_0x259f8a){var _0x10bec5={};var _0x22d633={};var _0x15a44d;var _0x18b10a;return db[_0x0976('0x2c')][_0x0976('0x4c')]({'where':{'id':_0x523ea9[_0x0976('0x47')]['id']}})[_0x0976('0x41')](handleEntityNotFound(_0x5e5045,null))[_0x0976('0x41')](function(_0xfe5ab6){if(_0xfe5ab6){_0x15a44d=_0xfe5ab6;_0x22d633[_0x0976('0x2f')]=_[_0x0976('0x31')](db['FreshdeskField'][_0x0976('0x2d')]);_0x22d633[_0x0976('0x30')]=_['keys'](_0x523ea9[_0x0976('0x30')]);_0x22d633[_0x0976('0x32')]=_['intersection'](_0x22d633[_0x0976('0x2f')],_0x22d633[_0x0976('0x30')]);_0x10bec5[_0x0976('0x35')]=_[_0x0976('0x33')](_0x22d633[_0x0976('0x2f')],qs['fields'](_0x523ea9[_0x0976('0x30')][_0x0976('0x34')]));_0x10bec5[_0x0976('0x35')]=_0x10bec5['attributes'][_0x0976('0x36')]?_0x10bec5[_0x0976('0x35')]:_0x22d633[_0x0976('0x2f')];_0x10bec5[_0x0976('0x4d')]=qs[_0x0976('0x39')](_0x523ea9['query'][_0x0976('0x39')]);_0x10bec5['where']=qs['filters'](_[_0x0976('0x3b')](_0x523ea9[_0x0976('0x30')],_0x22d633['filters']));if(_0x523ea9[_0x0976('0x30')][_0x0976('0x3c')]){_0x10bec5[_0x0976('0x3a')]=_[_0x0976('0x3d')](_0x10bec5['where'],{'$or':_[_0x0976('0x2b')](_0x10bec5[_0x0976('0x35')],function(_0x236138){var _0x30b8a2={};_0x30b8a2[_0x236138]={'$like':'%'+_0x523ea9[_0x0976('0x30')]['filter']+'%'};return _0x30b8a2;})});}_0x10bec5=_['merge']({},_0x10bec5,_0x523ea9[_0x0976('0x40')]);return _0x15a44d[_0x0976('0x4b')](_0x10bec5);}})[_0x0976('0x41')](function(_0x288464){if(_0x288464){_0x18b10a=_0x288464[_0x0976('0x36')];if(!_0x523ea9['query'][_0x0976('0x37')](_0x0976('0x38'))){_0x10bec5[_0x0976('0x1f')]=qs[_0x0976('0x1f')](_0x523ea9[_0x0976('0x30')][_0x0976('0x1f')]);_0x10bec5[_0x0976('0x20')]=qs['offset'](_0x523ea9[_0x0976('0x30')][_0x0976('0x20')]);}return _0x15a44d['getFields'](_0x10bec5);}})[_0x0976('0x41')](function(_0x62c549){if(_0x62c549){return _0x62c549?{'count':_0x18b10a,'rows':_0x62c549}:null;}})['then'](respondWithResult(_0x5e5045,null))[_0x0976('0x45')](handleError(_0x5e5045,null));};exports[_0x0976('0x4e')]=function(_0x376b4a,_0x226678,_0x5b0734){var _0x2148e3={};var _0x475a26={};var _0x4bda71;var _0x334519;return db['FreshdeskConfiguration'][_0x0976('0x4c')]({'where':{'id':_0x376b4a['params']['id']}})[_0x0976('0x41')](handleEntityNotFound(_0x226678,null))[_0x0976('0x41')](function(_0x19173d){if(_0x19173d){_0x4bda71=_0x19173d;_0x475a26[_0x0976('0x2f')]=_[_0x0976('0x31')](db[_0x0976('0x4f')]['rawAttributes']);_0x475a26[_0x0976('0x30')]=_[_0x0976('0x31')](_0x376b4a[_0x0976('0x30')]);_0x475a26[_0x0976('0x32')]=_[_0x0976('0x33')](_0x475a26[_0x0976('0x2f')],_0x475a26[_0x0976('0x30')]);_0x2148e3[_0x0976('0x35')]=_[_0x0976('0x33')](_0x475a26[_0x0976('0x2f')],qs[_0x0976('0x34')](_0x376b4a[_0x0976('0x30')][_0x0976('0x34')]));_0x2148e3[_0x0976('0x35')]=_0x2148e3[_0x0976('0x35')][_0x0976('0x36')]?_0x2148e3['attributes']:_0x475a26[_0x0976('0x2f')];_0x2148e3[_0x0976('0x4d')]=qs[_0x0976('0x39')](_0x376b4a['query'][_0x0976('0x39')]);_0x2148e3[_0x0976('0x3a')]=qs['filters'](_['pick'](_0x376b4a[_0x0976('0x30')],_0x475a26[_0x0976('0x32')]));if(_0x376b4a['query'][_0x0976('0x3c')]){_0x2148e3[_0x0976('0x3a')]=_['merge'](_0x2148e3[_0x0976('0x3a')],{'$or':_[_0x0976('0x2b')](_0x2148e3[_0x0976('0x35')],function(_0x2bcdc0){var _0x32b761={};_0x32b761[_0x2bcdc0]={'$like':'%'+_0x376b4a[_0x0976('0x30')][_0x0976('0x3c')]+'%'};return _0x32b761;})});}_0x2148e3=_[_0x0976('0x3d')]({},_0x2148e3,_0x376b4a[_0x0976('0x40')]);return _0x4bda71['getSubjects'](_0x2148e3);}})['then'](function(_0x1aef6d){if(_0x1aef6d){_0x334519=_0x1aef6d['length'];if(!_0x376b4a['query'][_0x0976('0x37')](_0x0976('0x38'))){_0x2148e3['limit']=qs[_0x0976('0x1f')](_0x376b4a['query'][_0x0976('0x1f')]);_0x2148e3[_0x0976('0x20')]=qs[_0x0976('0x20')](_0x376b4a[_0x0976('0x30')][_0x0976('0x20')]);}return _0x4bda71[_0x0976('0x4e')](_0x2148e3);}})[_0x0976('0x41')](function(_0x5d417e){if(_0x5d417e){return _0x5d417e?{'count':_0x334519,'rows':_0x5d417e}:null;}})[_0x0976('0x41')](respondWithResult(_0x226678,null))[_0x0976('0x45')](handleError(_0x226678,null));};exports['getDescriptions']=function(_0x4e811b,_0x243b42,_0x49b992){var _0x5200bf={};var _0x229be2={};var _0x1c0295;var _0x173e7c;return db[_0x0976('0x2c')]['findOne']({'where':{'id':_0x4e811b['params']['id']}})[_0x0976('0x41')](handleEntityNotFound(_0x243b42,null))['then'](function(_0x44fd77){if(_0x44fd77){_0x1c0295=_0x44fd77;_0x229be2[_0x0976('0x2f')]=_[_0x0976('0x31')](db['FreshdeskField'][_0x0976('0x2d')]);_0x229be2[_0x0976('0x30')]=_[_0x0976('0x31')](_0x4e811b[_0x0976('0x30')]);_0x229be2[_0x0976('0x32')]=_['intersection'](_0x229be2[_0x0976('0x2f')],_0x229be2[_0x0976('0x30')]);_0x5200bf[_0x0976('0x35')]=_[_0x0976('0x33')](_0x229be2[_0x0976('0x2f')],qs[_0x0976('0x34')](_0x4e811b[_0x0976('0x30')][_0x0976('0x34')]));_0x5200bf[_0x0976('0x35')]=_0x5200bf[_0x0976('0x35')][_0x0976('0x36')]?_0x5200bf[_0x0976('0x35')]:_0x229be2[_0x0976('0x2f')];_0x5200bf[_0x0976('0x4d')]=qs[_0x0976('0x39')](_0x4e811b[_0x0976('0x30')]['sort']);_0x5200bf[_0x0976('0x3a')]=qs[_0x0976('0x32')](_[_0x0976('0x3b')](_0x4e811b['query'],_0x229be2[_0x0976('0x32')]));if(_0x4e811b[_0x0976('0x30')]['filter']){_0x5200bf['where']=_['merge'](_0x5200bf[_0x0976('0x3a')],{'$or':_[_0x0976('0x2b')](_0x5200bf[_0x0976('0x35')],function(_0x16393c){var _0x545b42={};_0x545b42[_0x16393c]={'$like':'%'+_0x4e811b[_0x0976('0x30')][_0x0976('0x3c')]+'%'};return _0x545b42;})});}_0x5200bf=_[_0x0976('0x3d')]({},_0x5200bf,_0x4e811b[_0x0976('0x40')]);return _0x1c0295[_0x0976('0x50')](_0x5200bf);}})[_0x0976('0x41')](function(_0x2da46c){if(_0x2da46c){_0x173e7c=_0x2da46c[_0x0976('0x36')];if(!_0x4e811b[_0x0976('0x30')][_0x0976('0x37')](_0x0976('0x38'))){_0x5200bf[_0x0976('0x1f')]=qs[_0x0976('0x1f')](_0x4e811b['query'][_0x0976('0x1f')]);_0x5200bf[_0x0976('0x20')]=qs[_0x0976('0x20')](_0x4e811b[_0x0976('0x30')][_0x0976('0x20')]);}return _0x1c0295[_0x0976('0x50')](_0x5200bf);}})[_0x0976('0x41')](function(_0x3a77d5){if(_0x3a77d5){return _0x3a77d5?{'count':_0x173e7c,'rows':_0x3a77d5}:null;}})[_0x0976('0x41')](respondWithResult(_0x243b42,null))[_0x0976('0x45')](handleError(_0x243b42,null));};exports[_0x0976('0x51')]=function(_0x2d4618,_0x36f4ca,_0x1e1ee7){var _0x2456ca={};var _0x485b35={};var _0x39ca86;var _0x1f320d;return db[_0x0976('0x2c')]['findOne']({'where':{'id':_0x2d4618['params']['id']}})[_0x0976('0x41')](handleEntityNotFound(_0x36f4ca,null))[_0x0976('0x41')](function(_0x49d526){if(_0x49d526){_0x39ca86=_0x49d526;_0x485b35['model']=_[_0x0976('0x31')](db[_0x0976('0x52')][_0x0976('0x2d')]);_0x485b35['query']=_['keys'](_0x2d4618[_0x0976('0x30')]);_0x485b35['filters']=_[_0x0976('0x33')](_0x485b35[_0x0976('0x2f')],_0x485b35[_0x0976('0x30')]);_0x2456ca[_0x0976('0x35')]=_[_0x0976('0x33')](_0x485b35[_0x0976('0x2f')],qs['fields'](_0x2d4618[_0x0976('0x30')][_0x0976('0x34')]));_0x2456ca[_0x0976('0x35')]=_0x2456ca[_0x0976('0x35')][_0x0976('0x36')]?_0x2456ca[_0x0976('0x35')]:_0x485b35[_0x0976('0x2f')];_0x2456ca[_0x0976('0x4d')]=qs[_0x0976('0x39')](_0x2d4618['query'][_0x0976('0x39')]);_0x2456ca['where']=qs[_0x0976('0x32')](_[_0x0976('0x3b')](_0x2d4618['query'],_0x485b35[_0x0976('0x32')]));if(_0x2d4618[_0x0976('0x30')][_0x0976('0x3c')]){_0x2456ca['where']=_[_0x0976('0x3d')](_0x2456ca['where'],{'$or':_[_0x0976('0x2b')](_0x2456ca[_0x0976('0x35')],function(_0xa376ae){var _0xb1ecab={};_0xb1ecab[_0xa376ae]={'$like':'%'+_0x2d4618[_0x0976('0x30')][_0x0976('0x3c')]+'%'};return _0xb1ecab;})});}_0x2456ca=_[_0x0976('0x3d')]({},_0x2456ca,_0x2d4618['options']);return _0x39ca86[_0x0976('0x51')](_0x2456ca);}})[_0x0976('0x41')](function(_0x347678){if(_0x347678){_0x1f320d=_0x347678['length'];if(!_0x2d4618['query']['hasOwnProperty'](_0x0976('0x38'))){_0x2456ca[_0x0976('0x1f')]=qs[_0x0976('0x1f')](_0x2d4618[_0x0976('0x30')][_0x0976('0x1f')]);_0x2456ca['offset']=qs[_0x0976('0x20')](_0x2d4618['query'][_0x0976('0x20')]);}return _0x39ca86['getTags'](_0x2456ca);}})[_0x0976('0x41')](function(_0x2edae5){if(_0x2edae5){return _0x2edae5?{'count':_0x1f320d,'rows':_0x2edae5}:null;}})[_0x0976('0x41')](respondWithResult(_0x36f4ca,null))[_0x0976('0x45')](handleError(_0x36f4ca,null));};exports[_0x0976('0x53')]=function(_0x288d1f,_0x40a39b,_0x3e833c){if(_0x288d1f['body']['id']){delete _0x288d1f['body']['id'];}return db[_0x0976('0x2c')][_0x0976('0x4c')]({'where':{'id':_0x288d1f[_0x0976('0x47')]['id']}})[_0x0976('0x41')](handleEntityNotFound(_0x40a39b,null))[_0x0976('0x41')](function(_0x59de64){if(_0x59de64){return _0x59de64['setTags'](_0x288d1f['body'][_0x0976('0x54')]||[]);}return null;})['then'](respondWithResult(_0x40a39b,null))[_0x0976('0x45')](handleError(_0x40a39b,null));}; \ No newline at end of file +var _0x7b69=['json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','FreshdeskConfiguration','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','catch','create','body','find','getFields','findOne','FreshdeskField','length','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','end'];(function(_0x5a4515,_0x401ff9){var _0x5e4a11=function(_0x1b03fa){while(--_0x1b03fa){_0x5a4515['push'](_0x5a4515['shift']());}};_0x5e4a11(++_0x401ff9);}(_0x7b69,0x92));var _0x97b6=function(_0x564c99,_0x19c936){_0x564c99=_0x564c99-0x0;var _0x56bd25=_0x7b69[_0x564c99];return _0x56bd25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97b6('0x0'));var zipdir=require(_0x97b6('0x1'));var jsonpatch=require(_0x97b6('0x2'));var rp=require(_0x97b6('0x3'));var moment=require(_0x97b6('0x4'));var BPromise=require(_0x97b6('0x5'));var Mustache=require(_0x97b6('0x6'));var util=require(_0x97b6('0x7'));var path=require(_0x97b6('0x8'));var sox=require(_0x97b6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97b6('0xa'));var squel=require(_0x97b6('0xb'));var crypto=require('crypto');var jsforce=require(_0x97b6('0xc'));var deskjs=require(_0x97b6('0xd'));var toCsv=require(_0x97b6('0xe'));var querystring=require('querystring');var Papa=require(_0x97b6('0xf'));var Redis=require(_0x97b6('0x10'));var authService=require(_0x97b6('0x11'));var qs=require(_0x97b6('0x12'));var as=require(_0x97b6('0x13'));var hardwareService=require(_0x97b6('0x14'));var logger=require(_0x97b6('0x15'))(_0x97b6('0x16'));var utils=require(_0x97b6('0x17'));var config=require(_0x97b6('0x18'));var licenseUtil=require(_0x97b6('0x19'));var db=require(_0x97b6('0x1a'))['db'];function respondWithStatusCode(_0x48a77b,_0x36f133){_0x36f133=_0x36f133||0xcc;return function(_0x31af0f){if(_0x31af0f){return _0x48a77b[_0x97b6('0x1b')](_0x36f133);}return _0x48a77b[_0x97b6('0x1c')](_0x36f133)[_0x97b6('0x1d')]();};}function respondWithResult(_0xa270ae,_0x48710b){_0x48710b=_0x48710b||0xc8;return function(_0x5ad24e){if(_0x5ad24e){return _0xa270ae[_0x97b6('0x1c')](_0x48710b)[_0x97b6('0x1e')](_0x5ad24e);}};}function respondWithFilteredResult(_0x250860,_0x232f2a){return function(_0x3d594f){if(_0x3d594f){var _0x537ee1=typeof _0x232f2a[_0x97b6('0x1f')]==='undefined'&&typeof _0x232f2a[_0x97b6('0x20')]===_0x97b6('0x21');var _0x51ec15=_0x3d594f['count'];var _0x60e883=_0x537ee1?0x0:_0x232f2a[_0x97b6('0x1f')];var _0x12f0b1=_0x537ee1?_0x3d594f[_0x97b6('0x22')]:_0x232f2a[_0x97b6('0x1f')]+_0x232f2a[_0x97b6('0x20')];var _0x3b2109;if(_0x12f0b1>=_0x51ec15){_0x12f0b1=_0x51ec15;_0x3b2109=0xc8;}else{_0x3b2109=0xce;}_0x250860['status'](_0x3b2109);return _0x250860[_0x97b6('0x23')](_0x97b6('0x24'),_0x60e883+'-'+_0x12f0b1+'/'+_0x51ec15)['json'](_0x3d594f);}return null;};}function patchUpdates(_0x1bd448){return function(_0x4c2034){try{jsonpatch[_0x97b6('0x25')](_0x4c2034,_0x1bd448,!![]);}catch(_0x36a008){return BPromise[_0x97b6('0x26')](_0x36a008);}return _0x4c2034[_0x97b6('0x27')]();};}function saveUpdates(_0x7a4669,_0xc210ed){return function(_0x5ab8fe){if(_0x5ab8fe){return _0x5ab8fe[_0x97b6('0x28')](_0x7a4669)[_0x97b6('0x29')](function(_0x4f563d){return _0x4f563d;});}return null;};}function removeEntity(_0x3d3ca3,_0x3d5623){return function(_0x1f5da1){if(_0x1f5da1){return _0x1f5da1[_0x97b6('0x2a')]()[_0x97b6('0x29')](function(){_0x3d3ca3[_0x97b6('0x1c')](0xcc)[_0x97b6('0x1d')]();});}};}function handleEntityNotFound(_0x52da1b,_0x140646){return function(_0x3c8485){if(!_0x3c8485){_0x52da1b['sendStatus'](0x194);}return _0x3c8485;};}function handleError(_0x528b7b,_0x4b7210){_0x4b7210=_0x4b7210||0x1f4;return function(_0x1e666e){logger['error'](_0x1e666e['stack']);if(_0x1e666e[_0x97b6('0x2b')]){delete _0x1e666e[_0x97b6('0x2b')];}_0x528b7b[_0x97b6('0x1c')](_0x4b7210)[_0x97b6('0x2c')](_0x1e666e);};}exports[_0x97b6('0x2d')]=function(_0x3053e5,_0x395b4e){var _0x5906e1={},_0x3cd28d={},_0x5aa706={'count':0x0,'rows':[]};var _0x3aba69=_['map'](db[_0x97b6('0x2e')]['rawAttributes'],function(_0x647768){return{'name':_0x647768[_0x97b6('0x2f')],'type':_0x647768[_0x97b6('0x30')]['key']};});_0x3cd28d[_0x97b6('0x31')]=_[_0x97b6('0x32')](_0x3aba69,'name');_0x3cd28d[_0x97b6('0x33')]=_[_0x97b6('0x34')](_0x3053e5['query']);_0x3cd28d[_0x97b6('0x35')]=_[_0x97b6('0x36')](_0x3cd28d[_0x97b6('0x31')],_0x3cd28d[_0x97b6('0x33')]);_0x5906e1[_0x97b6('0x37')]=_[_0x97b6('0x36')](_0x3cd28d[_0x97b6('0x31')],qs[_0x97b6('0x38')](_0x3053e5[_0x97b6('0x33')][_0x97b6('0x38')]));_0x5906e1[_0x97b6('0x37')]=_0x5906e1[_0x97b6('0x37')]['length']?_0x5906e1[_0x97b6('0x37')]:_0x3cd28d[_0x97b6('0x31')];if(!_0x3053e5['query'][_0x97b6('0x39')](_0x97b6('0x3a'))){_0x5906e1[_0x97b6('0x20')]=qs[_0x97b6('0x20')](_0x3053e5[_0x97b6('0x33')][_0x97b6('0x20')]);_0x5906e1[_0x97b6('0x1f')]=qs['offset'](_0x3053e5[_0x97b6('0x33')]['offset']);}_0x5906e1[_0x97b6('0x3b')]=qs[_0x97b6('0x3c')](_0x3053e5['query'][_0x97b6('0x3c')]);_0x5906e1[_0x97b6('0x3d')]=qs[_0x97b6('0x35')](_[_0x97b6('0x3e')](_0x3053e5['query'],_0x3cd28d[_0x97b6('0x35')]),_0x3aba69);if(_0x3053e5[_0x97b6('0x33')][_0x97b6('0x3f')]){_0x5906e1[_0x97b6('0x3d')]=_[_0x97b6('0x40')](_0x5906e1[_0x97b6('0x3d')],{'$or':_[_0x97b6('0x32')](_0x3aba69,function(_0x5bc912){if(_0x5bc912[_0x97b6('0x30')]!==_0x97b6('0x41')){var _0x2415cb={};_0x2415cb[_0x5bc912[_0x97b6('0x2b')]]={'$like':'%'+_0x3053e5['query'][_0x97b6('0x3f')]+'%'};return _0x2415cb;}})});}_0x5906e1=_[_0x97b6('0x40')]({},_0x5906e1,_0x3053e5['options']);var _0x1a7e84={'where':_0x5906e1[_0x97b6('0x3d')]};return db[_0x97b6('0x2e')][_0x97b6('0x22')](_0x1a7e84)[_0x97b6('0x29')](function(_0x2b289b){_0x5aa706[_0x97b6('0x22')]=_0x2b289b;if(_0x3053e5[_0x97b6('0x33')][_0x97b6('0x42')]){_0x5906e1[_0x97b6('0x43')]=[{'all':!![]}];}return db[_0x97b6('0x2e')][_0x97b6('0x44')](_0x5906e1);})[_0x97b6('0x29')](function(_0x44e3f8){_0x5aa706[_0x97b6('0x45')]=_0x44e3f8;return _0x5aa706;})[_0x97b6('0x29')](respondWithFilteredResult(_0x395b4e,_0x5906e1))['catch'](handleError(_0x395b4e,null));};exports[_0x97b6('0x46')]=function(_0x163aba,_0x2744fb){var _0x55038e={'raw':![],'where':{'id':_0x163aba[_0x97b6('0x47')]['id']}},_0x398699={};_0x398699[_0x97b6('0x31')]=_['keys'](db[_0x97b6('0x2e')][_0x97b6('0x48')]);_0x398699['query']=_[_0x97b6('0x34')](_0x163aba['query']);_0x398699[_0x97b6('0x35')]=_[_0x97b6('0x36')](_0x398699[_0x97b6('0x31')],_0x398699['query']);_0x55038e[_0x97b6('0x37')]=_[_0x97b6('0x36')](_0x398699[_0x97b6('0x31')],qs[_0x97b6('0x38')](_0x163aba[_0x97b6('0x33')][_0x97b6('0x38')]));_0x55038e['attributes']=_0x55038e[_0x97b6('0x37')]['length']?_0x55038e[_0x97b6('0x37')]:_0x398699[_0x97b6('0x31')];if(_0x163aba[_0x97b6('0x33')][_0x97b6('0x42')]){_0x55038e[_0x97b6('0x43')]=[{'all':!![]}];}_0x55038e=_[_0x97b6('0x40')]({},_0x55038e,_0x163aba[_0x97b6('0x49')]);return db[_0x97b6('0x2e')]['find'](_0x55038e)['then'](handleEntityNotFound(_0x2744fb,null))['then'](respondWithResult(_0x2744fb,null))[_0x97b6('0x4a')](handleError(_0x2744fb,null));};exports['create']=function(_0x815296,_0x44e011){return db[_0x97b6('0x2e')][_0x97b6('0x4b')](_0x815296['body'],{})[_0x97b6('0x29')](respondWithResult(_0x44e011,0xc9))[_0x97b6('0x4a')](handleError(_0x44e011,null));};exports['update']=function(_0x558cdf,_0x2deadf){if(_0x558cdf[_0x97b6('0x4c')]['id']){delete _0x558cdf[_0x97b6('0x4c')]['id'];}return db[_0x97b6('0x2e')][_0x97b6('0x4d')]({'where':{'id':_0x558cdf['params']['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x2deadf,null))['then'](saveUpdates(_0x558cdf[_0x97b6('0x4c')],null))['then'](respondWithResult(_0x2deadf,null))['catch'](handleError(_0x2deadf,null));};exports[_0x97b6('0x2a')]=function(_0x25d8c1,_0x1d3293){return db[_0x97b6('0x2e')][_0x97b6('0x4d')]({'where':{'id':_0x25d8c1[_0x97b6('0x47')]['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x1d3293,null))[_0x97b6('0x29')](removeEntity(_0x1d3293,null))[_0x97b6('0x4a')](handleError(_0x1d3293,null));};exports[_0x97b6('0x4e')]=function(_0x45888c,_0x224ead,_0xa2c022){var _0x52364a={};var _0x275491={};var _0x4e1d86;var _0x205a3b;return db[_0x97b6('0x2e')][_0x97b6('0x4f')]({'where':{'id':_0x45888c['params']['id']}})['then'](handleEntityNotFound(_0x224ead,null))[_0x97b6('0x29')](function(_0x3b825f){if(_0x3b825f){_0x4e1d86=_0x3b825f;_0x275491['model']=_['keys'](db[_0x97b6('0x50')][_0x97b6('0x48')]);_0x275491[_0x97b6('0x33')]=_[_0x97b6('0x34')](_0x45888c[_0x97b6('0x33')]);_0x275491['filters']=_[_0x97b6('0x36')](_0x275491['model'],_0x275491[_0x97b6('0x33')]);_0x52364a[_0x97b6('0x37')]=_[_0x97b6('0x36')](_0x275491[_0x97b6('0x31')],qs[_0x97b6('0x38')](_0x45888c['query']['fields']));_0x52364a['attributes']=_0x52364a[_0x97b6('0x37')][_0x97b6('0x51')]?_0x52364a['attributes']:_0x275491[_0x97b6('0x31')];_0x52364a['order']=qs[_0x97b6('0x3c')](_0x45888c[_0x97b6('0x33')][_0x97b6('0x3c')]);_0x52364a[_0x97b6('0x3d')]=qs[_0x97b6('0x35')](_[_0x97b6('0x3e')](_0x45888c[_0x97b6('0x33')],_0x275491[_0x97b6('0x35')]));if(_0x45888c['query'][_0x97b6('0x3f')]){_0x52364a[_0x97b6('0x3d')]=_['merge'](_0x52364a[_0x97b6('0x3d')],{'$or':_[_0x97b6('0x32')](_0x52364a[_0x97b6('0x37')],function(_0x76472c){var _0x466b39={};_0x466b39[_0x76472c]={'$like':'%'+_0x45888c[_0x97b6('0x33')][_0x97b6('0x3f')]+'%'};return _0x466b39;})});}_0x52364a=_[_0x97b6('0x40')]({},_0x52364a,_0x45888c[_0x97b6('0x49')]);return _0x4e1d86[_0x97b6('0x4e')](_0x52364a);}})[_0x97b6('0x29')](function(_0x2a58fe){if(_0x2a58fe){_0x205a3b=_0x2a58fe[_0x97b6('0x51')];if(!_0x45888c[_0x97b6('0x33')][_0x97b6('0x39')](_0x97b6('0x3a'))){_0x52364a['limit']=qs[_0x97b6('0x20')](_0x45888c[_0x97b6('0x33')][_0x97b6('0x20')]);_0x52364a[_0x97b6('0x1f')]=qs[_0x97b6('0x1f')](_0x45888c[_0x97b6('0x33')]['offset']);}return _0x4e1d86[_0x97b6('0x4e')](_0x52364a);}})[_0x97b6('0x29')](function(_0x12c22e){if(_0x12c22e){return _0x12c22e?{'count':_0x205a3b,'rows':_0x12c22e}:null;}})[_0x97b6('0x29')](respondWithResult(_0x224ead,null))[_0x97b6('0x4a')](handleError(_0x224ead,null));};exports['getSubjects']=function(_0x7f56b2,_0x4e35fc,_0x52c5c4){var _0x21216a={};var _0x4eb03c={};var _0x3841bc;var _0x7ff360;return db[_0x97b6('0x2e')][_0x97b6('0x4f')]({'where':{'id':_0x7f56b2[_0x97b6('0x47')]['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x4e35fc,null))[_0x97b6('0x29')](function(_0x319155){if(_0x319155){_0x3841bc=_0x319155;_0x4eb03c[_0x97b6('0x31')]=_[_0x97b6('0x34')](db[_0x97b6('0x50')][_0x97b6('0x48')]);_0x4eb03c[_0x97b6('0x33')]=_[_0x97b6('0x34')](_0x7f56b2[_0x97b6('0x33')]);_0x4eb03c['filters']=_[_0x97b6('0x36')](_0x4eb03c[_0x97b6('0x31')],_0x4eb03c['query']);_0x21216a[_0x97b6('0x37')]=_[_0x97b6('0x36')](_0x4eb03c[_0x97b6('0x31')],qs['fields'](_0x7f56b2[_0x97b6('0x33')][_0x97b6('0x38')]));_0x21216a[_0x97b6('0x37')]=_0x21216a['attributes']['length']?_0x21216a['attributes']:_0x4eb03c['model'];_0x21216a[_0x97b6('0x3b')]=qs[_0x97b6('0x3c')](_0x7f56b2['query']['sort']);_0x21216a[_0x97b6('0x3d')]=qs['filters'](_[_0x97b6('0x3e')](_0x7f56b2['query'],_0x4eb03c['filters']));if(_0x7f56b2[_0x97b6('0x33')][_0x97b6('0x3f')]){_0x21216a[_0x97b6('0x3d')]=_[_0x97b6('0x40')](_0x21216a[_0x97b6('0x3d')],{'$or':_[_0x97b6('0x32')](_0x21216a[_0x97b6('0x37')],function(_0x52709b){var _0xaeafd1={};_0xaeafd1[_0x52709b]={'$like':'%'+_0x7f56b2[_0x97b6('0x33')]['filter']+'%'};return _0xaeafd1;})});}_0x21216a=_[_0x97b6('0x40')]({},_0x21216a,_0x7f56b2[_0x97b6('0x49')]);return _0x3841bc['getSubjects'](_0x21216a);}})[_0x97b6('0x29')](function(_0x249393){if(_0x249393){_0x7ff360=_0x249393[_0x97b6('0x51')];if(!_0x7f56b2[_0x97b6('0x33')]['hasOwnProperty'](_0x97b6('0x3a'))){_0x21216a[_0x97b6('0x20')]=qs['limit'](_0x7f56b2[_0x97b6('0x33')][_0x97b6('0x20')]);_0x21216a[_0x97b6('0x1f')]=qs['offset'](_0x7f56b2[_0x97b6('0x33')]['offset']);}return _0x3841bc[_0x97b6('0x52')](_0x21216a);}})[_0x97b6('0x29')](function(_0x490d51){if(_0x490d51){return _0x490d51?{'count':_0x7ff360,'rows':_0x490d51}:null;}})['then'](respondWithResult(_0x4e35fc,null))['catch'](handleError(_0x4e35fc,null));};exports['getDescriptions']=function(_0x154265,_0x279a5a,_0x366dd1){var _0x51066c={};var _0x562fb1={};var _0x1d3347;var _0x2d8d5f;return db[_0x97b6('0x2e')][_0x97b6('0x4f')]({'where':{'id':_0x154265[_0x97b6('0x47')]['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x279a5a,null))['then'](function(_0x5959a7){if(_0x5959a7){_0x1d3347=_0x5959a7;_0x562fb1[_0x97b6('0x31')]=_[_0x97b6('0x34')](db['FreshdeskField']['rawAttributes']);_0x562fb1['query']=_[_0x97b6('0x34')](_0x154265[_0x97b6('0x33')]);_0x562fb1[_0x97b6('0x35')]=_[_0x97b6('0x36')](_0x562fb1[_0x97b6('0x31')],_0x562fb1[_0x97b6('0x33')]);_0x51066c[_0x97b6('0x37')]=_['intersection'](_0x562fb1['model'],qs[_0x97b6('0x38')](_0x154265[_0x97b6('0x33')][_0x97b6('0x38')]));_0x51066c[_0x97b6('0x37')]=_0x51066c['attributes'][_0x97b6('0x51')]?_0x51066c[_0x97b6('0x37')]:_0x562fb1[_0x97b6('0x31')];_0x51066c[_0x97b6('0x3b')]=qs[_0x97b6('0x3c')](_0x154265[_0x97b6('0x33')][_0x97b6('0x3c')]);_0x51066c[_0x97b6('0x3d')]=qs[_0x97b6('0x35')](_[_0x97b6('0x3e')](_0x154265[_0x97b6('0x33')],_0x562fb1['filters']));if(_0x154265['query']['filter']){_0x51066c[_0x97b6('0x3d')]=_['merge'](_0x51066c[_0x97b6('0x3d')],{'$or':_[_0x97b6('0x32')](_0x51066c[_0x97b6('0x37')],function(_0xb45f3a){var _0x21f8c5={};_0x21f8c5[_0xb45f3a]={'$like':'%'+_0x154265[_0x97b6('0x33')][_0x97b6('0x3f')]+'%'};return _0x21f8c5;})});}_0x51066c=_[_0x97b6('0x40')]({},_0x51066c,_0x154265[_0x97b6('0x49')]);return _0x1d3347[_0x97b6('0x53')](_0x51066c);}})[_0x97b6('0x29')](function(_0x157495){if(_0x157495){_0x2d8d5f=_0x157495[_0x97b6('0x51')];if(!_0x154265[_0x97b6('0x33')][_0x97b6('0x39')](_0x97b6('0x3a'))){_0x51066c['limit']=qs[_0x97b6('0x20')](_0x154265[_0x97b6('0x33')][_0x97b6('0x20')]);_0x51066c[_0x97b6('0x1f')]=qs[_0x97b6('0x1f')](_0x154265[_0x97b6('0x33')][_0x97b6('0x1f')]);}return _0x1d3347['getDescriptions'](_0x51066c);}})[_0x97b6('0x29')](function(_0x1b9ecf){if(_0x1b9ecf){return _0x1b9ecf?{'count':_0x2d8d5f,'rows':_0x1b9ecf}:null;}})[_0x97b6('0x29')](respondWithResult(_0x279a5a,null))[_0x97b6('0x4a')](handleError(_0x279a5a,null));};exports[_0x97b6('0x54')]=function(_0x3cc886,_0x25a0af,_0x1bc17f){var _0x116bd0={};var _0x5b1989={};var _0x13627a;var _0x4b46f6;return db[_0x97b6('0x2e')]['findOne']({'where':{'id':_0x3cc886[_0x97b6('0x47')]['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x25a0af,null))[_0x97b6('0x29')](function(_0x2bee4c){if(_0x2bee4c){_0x13627a=_0x2bee4c;_0x5b1989[_0x97b6('0x31')]=_['keys'](db[_0x97b6('0x55')][_0x97b6('0x48')]);_0x5b1989['query']=_[_0x97b6('0x34')](_0x3cc886[_0x97b6('0x33')]);_0x5b1989['filters']=_[_0x97b6('0x36')](_0x5b1989['model'],_0x5b1989[_0x97b6('0x33')]);_0x116bd0[_0x97b6('0x37')]=_[_0x97b6('0x36')](_0x5b1989['model'],qs[_0x97b6('0x38')](_0x3cc886[_0x97b6('0x33')][_0x97b6('0x38')]));_0x116bd0['attributes']=_0x116bd0[_0x97b6('0x37')][_0x97b6('0x51')]?_0x116bd0[_0x97b6('0x37')]:_0x5b1989[_0x97b6('0x31')];_0x116bd0[_0x97b6('0x3b')]=qs[_0x97b6('0x3c')](_0x3cc886[_0x97b6('0x33')][_0x97b6('0x3c')]);_0x116bd0[_0x97b6('0x3d')]=qs['filters'](_[_0x97b6('0x3e')](_0x3cc886[_0x97b6('0x33')],_0x5b1989[_0x97b6('0x35')]));if(_0x3cc886[_0x97b6('0x33')][_0x97b6('0x3f')]){_0x116bd0[_0x97b6('0x3d')]=_[_0x97b6('0x40')](_0x116bd0[_0x97b6('0x3d')],{'$or':_[_0x97b6('0x32')](_0x116bd0[_0x97b6('0x37')],function(_0x1b3275){var _0x55b968={};_0x55b968[_0x1b3275]={'$like':'%'+_0x3cc886[_0x97b6('0x33')][_0x97b6('0x3f')]+'%'};return _0x55b968;})});}_0x116bd0=_[_0x97b6('0x40')]({},_0x116bd0,_0x3cc886[_0x97b6('0x49')]);return _0x13627a['getTags'](_0x116bd0);}})[_0x97b6('0x29')](function(_0x268fca){if(_0x268fca){_0x4b46f6=_0x268fca[_0x97b6('0x51')];if(!_0x3cc886[_0x97b6('0x33')][_0x97b6('0x39')](_0x97b6('0x3a'))){_0x116bd0[_0x97b6('0x20')]=qs[_0x97b6('0x20')](_0x3cc886[_0x97b6('0x33')][_0x97b6('0x20')]);_0x116bd0[_0x97b6('0x1f')]=qs[_0x97b6('0x1f')](_0x3cc886[_0x97b6('0x33')][_0x97b6('0x1f')]);}return _0x13627a['getTags'](_0x116bd0);}})['then'](function(_0x56e88b){if(_0x56e88b){return _0x56e88b?{'count':_0x4b46f6,'rows':_0x56e88b}:null;}})['then'](respondWithResult(_0x25a0af,null))[_0x97b6('0x4a')](handleError(_0x25a0af,null));};exports[_0x97b6('0x56')]=function(_0x48812b,_0x5c7ca5,_0x56a139){if(_0x48812b[_0x97b6('0x4c')]['id']){delete _0x48812b[_0x97b6('0x4c')]['id'];}return db[_0x97b6('0x2e')][_0x97b6('0x4f')]({'where':{'id':_0x48812b[_0x97b6('0x47')]['id']}})[_0x97b6('0x29')](handleEntityNotFound(_0x5c7ca5,null))[_0x97b6('0x29')](function(_0x60faf){if(_0x60faf){return _0x60faf[_0x97b6('0x56')](_0x48812b[_0x97b6('0x4c')][_0x97b6('0x57')]||[]);}return null;})[_0x97b6('0x29')](respondWithResult(_0x5c7ca5,null))[_0x97b6('0x4a')](handleError(_0x5c7ca5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index b029333..ce44842 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 _0x3bb8=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x3bb8,0x86));var _0x83bb=function(_0x5264ed,_0x41b584){_0x5264ed=_0x5264ed-0x0;var _0x75037a=_0x3bb8[_0x5264ed];return _0x75037a;};'use strict';var _=require(_0x83bb('0x0'));var util=require(_0x83bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x83bb('0x2'));var BPromise=require(_0x83bb('0x3'));var rp=require(_0x83bb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83bb('0x5'));var config=require(_0x83bb('0x6'));var attributes=require(_0x83bb('0x7'));module[_0x83bb('0x8')]=function(_0x1bd237,_0x5a8d21){return _0x1bd237[_0x83bb('0x9')](_0x83bb('0xa'),attributes,{'tableName':_0x83bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa17f=['bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0xa17f,0x80));var _0xfa17=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xa17f[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0xfa17('0x0'));var util=require(_0xfa17('0x1'));var logger=require('../../config/logger')(_0xfa17('0x2'));var moment=require(_0xfa17('0x3'));var BPromise=require(_0xfa17('0x4'));var rp=require(_0xfa17('0x5'));var fs=require('fs');var path=require(_0xfa17('0x6'));var rimraf=require(_0xfa17('0x7'));var config=require('../../config/environment');var attributes=require(_0xfa17('0x8'));module[_0xfa17('0x9')]=function(_0x1e9408,_0x50e7d2){return _0x1e9408['define'](_0xfa17('0xa'),attributes,{'tableName':_0xfa17('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 6c4bac3..27eab0f 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 _0x8059=['client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3e6867,_0x4f1dae){var _0x18f040=function(_0x4e7cb2){while(--_0x4e7cb2){_0x3e6867['push'](_0x3e6867['shift']());}};_0x18f040(++_0x4f1dae);}(_0x8059,0x1d5));var _0x9805=function(_0x5067db,_0xf8d2f2){_0x5067db=_0x5067db-0x0;var _0x2771e4=_0x8059[_0x5067db];return _0x2771e4;};'use strict';var _=require(_0x9805('0x0'));var util=require(_0x9805('0x1'));var moment=require(_0x9805('0x2'));var BPromise=require(_0x9805('0x3'));var rs=require(_0x9805('0x4'));var fs=require('fs');var Redis=require(_0x9805('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9805('0x6'));var logger=require(_0x9805('0x7'))(_0x9805('0x8'));var config=require(_0x9805('0x9'));var jayson=require(_0x9805('0xa'));var client=jayson[_0x9805('0xb')][_0x9805('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f6cea,_0x4c2810,_0x197e79){return new BPromise(function(_0x5287c6,_0x3bee2d){return client[_0x9805('0xd')](_0x4f6cea,_0x197e79)['then'](function(_0x4ac43c){logger[_0x9805('0xe')](_0x9805('0xf'),_0x4c2810,'request\x20sent');logger[_0x9805('0x10')](_0x9805('0x11'),_0x4c2810,'request\x20sent',JSON['stringify'](_0x4ac43c));if(_0x4ac43c[_0x9805('0x12')]){if(_0x4ac43c['error'][_0x9805('0x13')]===0x1f4){logger[_0x9805('0x12')](_0x9805('0xf'),_0x4c2810,_0x4ac43c[_0x9805('0x12')][_0x9805('0x14')]);return _0x3bee2d(_0x4ac43c[_0x9805('0x12')][_0x9805('0x14')]);}logger[_0x9805('0x12')](_0x9805('0xf'),_0x4c2810,_0x4ac43c[_0x9805('0x12')]['message']);return _0x5287c6(_0x4ac43c[_0x9805('0x12')][_0x9805('0x14')]);}else{logger[_0x9805('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4c2810,_0x9805('0x15'));_0x5287c6(_0x4ac43c[_0x9805('0x16')][_0x9805('0x14')]);}})[_0x9805('0x17')](function(_0x3acd41){logger[_0x9805('0x12')](_0x9805('0xf'),_0x4c2810,_0x3acd41);_0x3bee2d(_0x3acd41);});});} \ No newline at end of file +var _0x9ccd=['rpc','../../config/environment','jayson/promise','client','http','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2e5e73,_0x30d4d9){var _0x4cf641=function(_0x26b1b6){while(--_0x26b1b6){_0x2e5e73['push'](_0x2e5e73['shift']());}};_0x4cf641(++_0x30d4d9);}(_0x9ccd,0xdf));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd9cc('0x0'));var util=require(_0xd9cc('0x1'));var moment=require(_0xd9cc('0x2'));var BPromise=require(_0xd9cc('0x3'));var rs=require(_0xd9cc('0x4'));var fs=require('fs');var Redis=require(_0xd9cc('0x5'));var db=require(_0xd9cc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9cc('0x7'))(_0xd9cc('0x8'));var config=require(_0xd9cc('0x9'));var jayson=require(_0xd9cc('0xa'));var client=jayson[_0xd9cc('0xb')][_0xd9cc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1eda17,_0x3f8483,_0x1af94d){return new BPromise(function(_0x28f915,_0x53bd7d){return client['request'](_0x1eda17,_0x1af94d)[_0xd9cc('0xd')](function(_0x569fb7){logger['info'](_0xd9cc('0xe'),_0x3f8483,_0xd9cc('0xf'));logger[_0xd9cc('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3f8483,_0xd9cc('0xf'),JSON[_0xd9cc('0x11')](_0x569fb7));if(_0x569fb7['error']){if(_0x569fb7[_0xd9cc('0x12')]['code']===0x1f4){logger[_0xd9cc('0x12')](_0xd9cc('0xe'),_0x3f8483,_0x569fb7[_0xd9cc('0x12')][_0xd9cc('0x13')]);return _0x53bd7d(_0x569fb7[_0xd9cc('0x12')][_0xd9cc('0x13')]);}logger[_0xd9cc('0x12')](_0xd9cc('0xe'),_0x3f8483,_0x569fb7[_0xd9cc('0x12')]['message']);return _0x28f915(_0x569fb7[_0xd9cc('0x12')][_0xd9cc('0x13')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f8483,_0xd9cc('0xf'));_0x28f915(_0x569fb7[_0xd9cc('0x14')][_0xd9cc('0x13')]);}})['catch'](function(_0x7f8142){logger[_0xd9cc('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3f8483,_0x7f8142);_0x53bd7d(_0x7f8142);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 6f88ae5..a210f7a 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 _0x66a3=['../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','put','update','delete','exports','connect-timeout','Router','fs-extra'];(function(_0x400566,_0x474083){var _0x40f3e8=function(_0x34c917){while(--_0x34c917){_0x400566['push'](_0x400566['shift']());}};_0x40f3e8(++_0x474083);}(_0x66a3,0xc1));var _0x366a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x366a('0x0'));var express=require('express');var router=express[_0x366a('0x1')]();var fs_extra=require(_0x366a('0x2'));var auth=require(_0x366a('0x3'));var interaction=require(_0x366a('0x4'));var config=require('../../config/environment');var controller=require(_0x366a('0x5'));router[_0x366a('0x6')]('/',auth['isAuthenticated'](),controller[_0x366a('0x7')]);router[_0x366a('0x6')](_0x366a('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x366a('0x9')](),controller['create']);router[_0x366a('0xa')](_0x366a('0x8'),auth[_0x366a('0x9')](),controller[_0x366a('0xb')]);router[_0x366a('0xc')](_0x366a('0x8'),auth[_0x366a('0x9')](),controller['destroy']);module[_0x366a('0xd')]=router; \ No newline at end of file +var _0x2648=['/:id','show','post','isAuthenticated','create','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','get'];(function(_0x449bb5,_0x4f08f2){var _0x414ce7=function(_0x75030e){while(--_0x75030e){_0x449bb5['push'](_0x449bb5['shift']());}};_0x414ce7(++_0x4f08f2);}(_0x2648,0x76));var _0x8264=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2648[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8264('0x0'));var util=require(_0x8264('0x1'));var path=require(_0x8264('0x2'));var timeout=require(_0x8264('0x3'));var express=require(_0x8264('0x4'));var router=express['Router']();var fs_extra=require(_0x8264('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8264('0x6'));var config=require(_0x8264('0x7'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8264('0x8')]);router[_0x8264('0x9')](_0x8264('0xa'),auth['isAuthenticated'](),controller[_0x8264('0xb')]);router[_0x8264('0xc')]('/',auth[_0x8264('0xd')](),controller[_0x8264('0xe')]);router['put'](_0x8264('0xa'),auth[_0x8264('0xd')](),controller['update']);router[_0x8264('0xf')](_0x8264('0xa'),auth[_0x8264('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index fe6747d..aa77435 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 _0x26ca=['exports','variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN','sequelize'];(function(_0x316cfd,_0x1dfe9d){var _0x50d52d=function(_0x3a1b0d){while(--_0x3a1b0d){_0x316cfd['push'](_0x316cfd['shift']());}};_0x50d52d(++_0x1dfe9d);}(_0x26ca,0x121));var _0xa26c=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x26ca[_0x2f45ea];return _0x485a84;};'use strict';var Sequelize=require(_0xa26c('0x0'));module[_0xa26c('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0xa26c('0x2'),_0xa26c('0x3'),_0xa26c('0x4'),_0xa26c('0x5')),'defaultValue':_0xa26c('0x6')},'content':{'type':Sequelize[_0xa26c('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa26c('0x8')](_0xa26c('0x6'),_0xa26c('0x2'),_0xa26c('0x3'))},'keyContent':{'type':Sequelize[_0xa26c('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa26c('0x7')]},'customField':{'type':Sequelize[_0xa26c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa26c('0x7')]}}; \ No newline at end of file +var _0x1b3c=['variable','customVariable','picklist','STRING','string','sequelize','exports','ENUM'];(function(_0x54a761,_0x431fd4){var _0x37d1da=function(_0x5ca617){while(--_0x5ca617){_0x54a761['push'](_0x54a761['shift']());}};_0x37d1da(++_0x431fd4);}(_0x1b3c,0x155));var _0xc1b3=function(_0x19c55c,_0x1323fe){_0x19c55c=_0x19c55c-0x0;var _0x140dc4=_0x1b3c[_0x19c55c];return _0x140dc4;};'use strict';var Sequelize=require(_0xc1b3('0x0'));module[_0xc1b3('0x1')]={'type':{'type':Sequelize[_0xc1b3('0x2')]('string',_0xc1b3('0x3'),_0xc1b3('0x4'),'keyValue',_0xc1b3('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc1b3('0x6')]},'key':{'type':Sequelize[_0xc1b3('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xc1b3('0x7'),_0xc1b3('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc1b3('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc1b3('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc1b3('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 1010260..605f0c5 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 _0xbf6e=['rawAttributes','type','key','model','query','filters','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','FreshdeskField','includeAll','include','rows','catch','show','keys','intersection','length','find','create','body','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map'];(function(_0x997332,_0x3eeac6){var _0x44610d=function(_0x29b55d){while(--_0x29b55d){_0x997332['push'](_0x997332['shift']());}};_0x44610d(++_0x3eeac6);}(_0xbf6e,0x149));var _0xebf6=function(_0x2a0bb0,_0x1fa696){_0x2a0bb0=_0x2a0bb0-0x0;var _0x5552c9=_0xbf6e[_0x2a0bb0];return _0x5552c9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebf6('0x0'));var jsonpatch=require(_0xebf6('0x1'));var rp=require(_0xebf6('0x2'));var moment=require(_0xebf6('0x3'));var BPromise=require(_0xebf6('0x4'));var Mustache=require(_0xebf6('0x5'));var util=require(_0xebf6('0x6'));var path=require('path');var sox=require(_0xebf6('0x7'));var csv=require(_0xebf6('0x8'));var ejs=require(_0xebf6('0x9'));var fs=require('fs');var fs_extra=require(_0xebf6('0xa'));var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x8'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xebf6('0x18'))['db'];function respondWithStatusCode(_0xedc361,_0x4919f1){_0x4919f1=_0x4919f1||0xcc;return function(_0x332ca0){if(_0x332ca0){return _0xedc361[_0xebf6('0x19')](_0x4919f1);}return _0xedc361[_0xebf6('0x1a')](_0x4919f1)[_0xebf6('0x1b')]();};}function respondWithResult(_0x3f69e6,_0x4dbf51){_0x4dbf51=_0x4dbf51||0xc8;return function(_0x4c01f4){if(_0x4c01f4){return _0x3f69e6['status'](_0x4dbf51)[_0xebf6('0x1c')](_0x4c01f4);}};}function respondWithFilteredResult(_0x1ae2f7,_0x50d80f){return function(_0x35570e){if(_0x35570e){var _0x2c980f=typeof _0x50d80f[_0xebf6('0x1d')]===_0xebf6('0x1e')&&typeof _0x50d80f[_0xebf6('0x1f')]===_0xebf6('0x1e');var _0x219621=_0x35570e[_0xebf6('0x20')];var _0x2d3984=_0x2c980f?0x0:_0x50d80f[_0xebf6('0x1d')];var _0x55fa31=_0x2c980f?_0x35570e['count']:_0x50d80f[_0xebf6('0x1d')]+_0x50d80f[_0xebf6('0x1f')];var _0x10051e;if(_0x55fa31>=_0x219621){_0x55fa31=_0x219621;_0x10051e=0xc8;}else{_0x10051e=0xce;}_0x1ae2f7[_0xebf6('0x1a')](_0x10051e);return _0x1ae2f7[_0xebf6('0x21')](_0xebf6('0x22'),_0x2d3984+'-'+_0x55fa31+'/'+_0x219621)[_0xebf6('0x1c')](_0x35570e);}return null;};}function patchUpdates(_0x80f523){return function(_0x4fb497){try{jsonpatch[_0xebf6('0x23')](_0x4fb497,_0x80f523,!![]);}catch(_0x81fdb3){return BPromise[_0xebf6('0x24')](_0x81fdb3);}return _0x4fb497[_0xebf6('0x25')]();};}function saveUpdates(_0x6303ac,_0x14c8ac){return function(_0x2f419e){if(_0x2f419e){return _0x2f419e[_0xebf6('0x26')](_0x6303ac)[_0xebf6('0x27')](function(_0x2e32c6){return _0x2e32c6;});}return null;};}function removeEntity(_0x232074,_0x2dd2ed){return function(_0x43c4e2){if(_0x43c4e2){return _0x43c4e2[_0xebf6('0x28')]()[_0xebf6('0x27')](function(){_0x232074[_0xebf6('0x1a')](0xcc)[_0xebf6('0x1b')]();});}};}function handleEntityNotFound(_0x1534b2,_0x3b58cb){return function(_0x4dadf7){if(!_0x4dadf7){_0x1534b2['sendStatus'](0x194);}return _0x4dadf7;};}function handleError(_0x2605a2,_0x4dc5be){_0x4dc5be=_0x4dc5be||0x1f4;return function(_0x230d84){logger[_0xebf6('0x29')](_0x230d84['stack']);if(_0x230d84['name']){delete _0x230d84[_0xebf6('0x2a')];}_0x2605a2[_0xebf6('0x1a')](_0x4dc5be)[_0xebf6('0x2b')](_0x230d84);};}exports[_0xebf6('0x2c')]=function(_0xedaaeb,_0x2dc0cf){var _0x7976d={},_0x7551ce={},_0x4c3495={'count':0x0,'rows':[]};var _0x37cd67=_[_0xebf6('0x2d')](db['FreshdeskField'][_0xebf6('0x2e')],function(_0x28bbea){return{'name':_0x28bbea['fieldName'],'type':_0x28bbea[_0xebf6('0x2f')][_0xebf6('0x30')]};});_0x7551ce[_0xebf6('0x31')]=_[_0xebf6('0x2d')](_0x37cd67,_0xebf6('0x2a'));_0x7551ce[_0xebf6('0x32')]=_['keys'](_0xedaaeb[_0xebf6('0x32')]);_0x7551ce[_0xebf6('0x33')]=_['intersection'](_0x7551ce['model'],_0x7551ce[_0xebf6('0x32')]);_0x7976d[_0xebf6('0x34')]=_['intersection'](_0x7551ce[_0xebf6('0x31')],qs[_0xebf6('0x35')](_0xedaaeb['query'][_0xebf6('0x35')]));_0x7976d[_0xebf6('0x34')]=_0x7976d[_0xebf6('0x34')]['length']?_0x7976d[_0xebf6('0x34')]:_0x7551ce[_0xebf6('0x31')];if(!_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x36')]('nolimit')){_0x7976d['limit']=qs[_0xebf6('0x1f')](_0xedaaeb[_0xebf6('0x32')]['limit']);_0x7976d[_0xebf6('0x1d')]=qs[_0xebf6('0x1d')](_0xedaaeb['query'][_0xebf6('0x1d')]);}_0x7976d[_0xebf6('0x37')]=qs[_0xebf6('0x38')](_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x38')]);_0x7976d['where']=qs[_0xebf6('0x33')](_['pick'](_0xedaaeb[_0xebf6('0x32')],_0x7551ce['filters']),_0x37cd67);if(_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x39')]){_0x7976d[_0xebf6('0x3a')]=_[_0xebf6('0x3b')](_0x7976d[_0xebf6('0x3a')],{'$or':_[_0xebf6('0x2d')](_0x37cd67,function(_0x5eb1ea){if(_0x5eb1ea[_0xebf6('0x2f')]!==_0xebf6('0x3c')){var _0x3cd9a0={};_0x3cd9a0[_0x5eb1ea[_0xebf6('0x2a')]]={'$like':'%'+_0xedaaeb[_0xebf6('0x32')][_0xebf6('0x39')]+'%'};return _0x3cd9a0;}})});}_0x7976d=_['merge']({},_0x7976d,_0xedaaeb[_0xebf6('0x3d')]);var _0x2782a5={'where':_0x7976d[_0xebf6('0x3a')]};return db[_0xebf6('0x3e')][_0xebf6('0x20')](_0x2782a5)[_0xebf6('0x27')](function(_0x4887a8){_0x4c3495['count']=_0x4887a8;if(_0xedaaeb['query'][_0xebf6('0x3f')]){_0x7976d[_0xebf6('0x40')]=[{'all':!![]}];}return db[_0xebf6('0x3e')]['findAll'](_0x7976d);})[_0xebf6('0x27')](function(_0x1c3809){_0x4c3495[_0xebf6('0x41')]=_0x1c3809;return _0x4c3495;})['then'](respondWithFilteredResult(_0x2dc0cf,_0x7976d))[_0xebf6('0x42')](handleError(_0x2dc0cf,null));};exports[_0xebf6('0x43')]=function(_0x53ccc8,_0x3813a5){var _0x1de50e={'raw':!![],'where':{'id':_0x53ccc8['params']['id']}},_0x17c4af={};_0x17c4af[_0xebf6('0x31')]=_['keys'](db['FreshdeskField'][_0xebf6('0x2e')]);_0x17c4af[_0xebf6('0x32')]=_[_0xebf6('0x44')](_0x53ccc8[_0xebf6('0x32')]);_0x17c4af['filters']=_[_0xebf6('0x45')](_0x17c4af['model'],_0x17c4af[_0xebf6('0x32')]);_0x1de50e[_0xebf6('0x34')]=_[_0xebf6('0x45')](_0x17c4af[_0xebf6('0x31')],qs[_0xebf6('0x35')](_0x53ccc8['query']['fields']));_0x1de50e[_0xebf6('0x34')]=_0x1de50e[_0xebf6('0x34')][_0xebf6('0x46')]?_0x1de50e[_0xebf6('0x34')]:_0x17c4af['model'];if(_0x53ccc8[_0xebf6('0x32')][_0xebf6('0x3f')]){_0x1de50e[_0xebf6('0x40')]=[{'all':!![]}];}_0x1de50e=_[_0xebf6('0x3b')]({},_0x1de50e,_0x53ccc8[_0xebf6('0x3d')]);return db[_0xebf6('0x3e')][_0xebf6('0x47')](_0x1de50e)['then'](handleEntityNotFound(_0x3813a5,null))[_0xebf6('0x27')](respondWithResult(_0x3813a5,null))[_0xebf6('0x42')](handleError(_0x3813a5,null));};exports[_0xebf6('0x48')]=function(_0x42e3e1,_0x166664){return db[_0xebf6('0x3e')][_0xebf6('0x48')](_0x42e3e1['body'],{})[_0xebf6('0x27')](respondWithResult(_0x166664,0xc9))['catch'](handleError(_0x166664,null));};exports[_0xebf6('0x26')]=function(_0x31d8ba,_0x5d84ac){if(_0x31d8ba[_0xebf6('0x49')]['id']){delete _0x31d8ba['body']['id'];}return db[_0xebf6('0x3e')][_0xebf6('0x47')]({'where':{'id':_0x31d8ba[_0xebf6('0x4a')]['id']}})[_0xebf6('0x27')](handleEntityNotFound(_0x5d84ac,null))[_0xebf6('0x27')](saveUpdates(_0x31d8ba['body'],null))[_0xebf6('0x27')](respondWithResult(_0x5d84ac,null))[_0xebf6('0x42')](handleError(_0x5d84ac,null));};exports['destroy']=function(_0x1f98fd,_0x2765f2){return db[_0xebf6('0x3e')][_0xebf6('0x47')]({'where':{'id':_0x1f98fd[_0xebf6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2765f2,null))[_0xebf6('0x27')](removeEntity(_0x2765f2,null))[_0xebf6('0x42')](handleError(_0x2765f2,null));}; \ No newline at end of file +var _0x9c5e=['body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','keys','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x28edf8,_0x3ab79f){_0x28edf8=_0x28edf8-0x0;var _0xb0bbba=_0x9c5e[_0x28edf8];return _0xb0bbba;};'use strict';var emlformat=require(_0xe9c5('0x0'));var rimraf=require(_0xe9c5('0x1'));var zipdir=require(_0xe9c5('0x2'));var jsonpatch=require(_0xe9c5('0x3'));var rp=require(_0xe9c5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9c5('0x5'));var path=require(_0xe9c5('0x6'));var sox=require('sox');var csv=require(_0xe9c5('0x7'));var ejs=require(_0xe9c5('0x8'));var fs=require('fs');var fs_extra=require(_0xe9c5('0x9'));var _=require(_0xe9c5('0xa'));var squel=require('squel');var crypto=require(_0xe9c5('0xb'));var jsforce=require(_0xe9c5('0xc'));var deskjs=require(_0xe9c5('0xd'));var toCsv=require(_0xe9c5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9c5('0xe'));var authService=require(_0xe9c5('0xf'));var qs=require(_0xe9c5('0x10'));var as=require(_0xe9c5('0x11'));var hardwareService=require(_0xe9c5('0x12'));var logger=require(_0xe9c5('0x13'))(_0xe9c5('0x14'));var utils=require(_0xe9c5('0x15'));var config=require(_0xe9c5('0x16'));var licenseUtil=require(_0xe9c5('0x17'));var db=require(_0xe9c5('0x18'))['db'];function respondWithStatusCode(_0x27f3e1,_0x471401){_0x471401=_0x471401||0xcc;return function(_0x25ff11){if(_0x25ff11){return _0x27f3e1[_0xe9c5('0x19')](_0x471401);}return _0x27f3e1[_0xe9c5('0x1a')](_0x471401)['end']();};}function respondWithResult(_0x3cce36,_0xe98b11){_0xe98b11=_0xe98b11||0xc8;return function(_0x5eb474){if(_0x5eb474){return _0x3cce36[_0xe9c5('0x1a')](_0xe98b11)[_0xe9c5('0x1b')](_0x5eb474);}};}function respondWithFilteredResult(_0x232584,_0x5d8236){return function(_0x163253){if(_0x163253){var _0x14eb41=typeof _0x5d8236['offset']===_0xe9c5('0x1c')&&typeof _0x5d8236[_0xe9c5('0x1d')]===_0xe9c5('0x1c');var _0x154390=_0x163253[_0xe9c5('0x1e')];var _0x4d9c7d=_0x14eb41?0x0:_0x5d8236[_0xe9c5('0x1f')];var _0x1cecae=_0x14eb41?_0x163253[_0xe9c5('0x1e')]:_0x5d8236[_0xe9c5('0x1f')]+_0x5d8236['limit'];var _0x26492a;if(_0x1cecae>=_0x154390){_0x1cecae=_0x154390;_0x26492a=0xc8;}else{_0x26492a=0xce;}_0x232584[_0xe9c5('0x1a')](_0x26492a);return _0x232584[_0xe9c5('0x20')](_0xe9c5('0x21'),_0x4d9c7d+'-'+_0x1cecae+'/'+_0x154390)[_0xe9c5('0x1b')](_0x163253);}return null;};}function patchUpdates(_0x58fbad){return function(_0x51e860){try{jsonpatch[_0xe9c5('0x22')](_0x51e860,_0x58fbad,!![]);}catch(_0x57818d){return BPromise[_0xe9c5('0x23')](_0x57818d);}return _0x51e860[_0xe9c5('0x24')]();};}function saveUpdates(_0x21b02a,_0x4d16bc){return function(_0x5750ff){if(_0x5750ff){return _0x5750ff[_0xe9c5('0x25')](_0x21b02a)[_0xe9c5('0x26')](function(_0x37fb90){return _0x37fb90;});}return null;};}function removeEntity(_0x189a13,_0x34a7c8){return function(_0x245161){if(_0x245161){return _0x245161[_0xe9c5('0x27')]()[_0xe9c5('0x26')](function(){_0x189a13[_0xe9c5('0x1a')](0xcc)[_0xe9c5('0x28')]();});}};}function handleEntityNotFound(_0x5a3caa,_0x5c8bb7){return function(_0x250e1c){if(!_0x250e1c){_0x5a3caa[_0xe9c5('0x19')](0x194);}return _0x250e1c;};}function handleError(_0x298dca,_0x3bf679){_0x3bf679=_0x3bf679||0x1f4;return function(_0x33fe71){logger[_0xe9c5('0x29')](_0x33fe71['stack']);if(_0x33fe71[_0xe9c5('0x2a')]){delete _0x33fe71['name'];}_0x298dca[_0xe9c5('0x1a')](_0x3bf679)['send'](_0x33fe71);};}exports[_0xe9c5('0x2b')]=function(_0x2112a6,_0x52d008){var _0x36d145={},_0x46d253={},_0x334f5a={'count':0x0,'rows':[]};var _0x37cfa5=_[_0xe9c5('0x2c')](db['FreshdeskField'][_0xe9c5('0x2d')],function(_0x4fcabd){return{'name':_0x4fcabd[_0xe9c5('0x2e')],'type':_0x4fcabd['type'][_0xe9c5('0x2f')]};});_0x46d253[_0xe9c5('0x30')]=_[_0xe9c5('0x2c')](_0x37cfa5,_0xe9c5('0x2a'));_0x46d253[_0xe9c5('0x31')]=_['keys'](_0x2112a6[_0xe9c5('0x31')]);_0x46d253[_0xe9c5('0x32')]=_[_0xe9c5('0x33')](_0x46d253[_0xe9c5('0x30')],_0x46d253[_0xe9c5('0x31')]);_0x36d145['attributes']=_['intersection'](_0x46d253[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x36d145[_0xe9c5('0x35')]=_0x36d145[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x36d145[_0xe9c5('0x35')]:_0x46d253['model'];if(!_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x37')]('nolimit')){_0x36d145[_0xe9c5('0x1d')]=qs['limit'](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1d')]);_0x36d145[_0xe9c5('0x1f')]=qs[_0xe9c5('0x1f')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1f')]);}_0x36d145[_0xe9c5('0x38')]=qs[_0xe9c5('0x39')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x39')]);_0x36d145[_0xe9c5('0x3a')]=qs[_0xe9c5('0x32')](_[_0xe9c5('0x3b')](_0x2112a6[_0xe9c5('0x31')],_0x46d253[_0xe9c5('0x32')]),_0x37cfa5);if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x3c')]){_0x36d145[_0xe9c5('0x3a')]=_[_0xe9c5('0x3d')](_0x36d145['where'],{'$or':_[_0xe9c5('0x2c')](_0x37cfa5,function(_0x2e3f15){if(_0x2e3f15[_0xe9c5('0x3e')]!==_0xe9c5('0x3f')){var _0x204b53={};_0x204b53[_0x2e3f15[_0xe9c5('0x2a')]]={'$like':'%'+_0x2112a6['query'][_0xe9c5('0x3c')]+'%'};return _0x204b53;}})});}_0x36d145=_[_0xe9c5('0x3d')]({},_0x36d145,_0x2112a6[_0xe9c5('0x40')]);var _0x480b83={'where':_0x36d145[_0xe9c5('0x3a')]};return db[_0xe9c5('0x41')][_0xe9c5('0x1e')](_0x480b83)[_0xe9c5('0x26')](function(_0x2c1615){_0x334f5a[_0xe9c5('0x1e')]=_0x2c1615;if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x36d145[_0xe9c5('0x43')]=[{'all':!![]}];}return db[_0xe9c5('0x41')][_0xe9c5('0x44')](_0x36d145);})['then'](function(_0x51dd18){_0x334f5a[_0xe9c5('0x45')]=_0x51dd18;return _0x334f5a;})[_0xe9c5('0x26')](respondWithFilteredResult(_0x52d008,_0x36d145))[_0xe9c5('0x46')](handleError(_0x52d008,null));};exports[_0xe9c5('0x47')]=function(_0x4ca4b0,_0x4a3fc5){var _0x382405={'raw':!![],'where':{'id':_0x4ca4b0['params']['id']}},_0x144e85={};_0x144e85[_0xe9c5('0x30')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x144e85[_0xe9c5('0x31')]=_[_0xe9c5('0x48')](_0x4ca4b0[_0xe9c5('0x31')]);_0x144e85[_0xe9c5('0x32')]=_['intersection'](_0x144e85[_0xe9c5('0x30')],_0x144e85[_0xe9c5('0x31')]);_0x382405[_0xe9c5('0x35')]=_[_0xe9c5('0x33')](_0x144e85[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x382405['attributes']=_0x382405[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x382405[_0xe9c5('0x35')]:_0x144e85[_0xe9c5('0x30')];if(_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x382405['include']=[{'all':!![]}];}_0x382405=_['merge']({},_0x382405,_0x4ca4b0['options']);return db['FreshdeskField'][_0xe9c5('0x49')](_0x382405)[_0xe9c5('0x26')](handleEntityNotFound(_0x4a3fc5,null))[_0xe9c5('0x26')](respondWithResult(_0x4a3fc5,null))['catch'](handleError(_0x4a3fc5,null));};exports[_0xe9c5('0x4a')]=function(_0x520248,_0x1ed99e){return db[_0xe9c5('0x41')][_0xe9c5('0x4a')](_0x520248[_0xe9c5('0x4b')],{})['then'](respondWithResult(_0x1ed99e,0xc9))[_0xe9c5('0x46')](handleError(_0x1ed99e,null));};exports[_0xe9c5('0x25')]=function(_0x1da6a3,_0x249940){if(_0x1da6a3['body']['id']){delete _0x1da6a3[_0xe9c5('0x4b')]['id'];}return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x1da6a3[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x249940,null))[_0xe9c5('0x26')](saveUpdates(_0x1da6a3['body'],null))[_0xe9c5('0x26')](respondWithResult(_0x249940,null))[_0xe9c5('0x46')](handleError(_0x249940,null));};exports[_0xe9c5('0x27')]=function(_0x9d0154,_0x5e7c24){return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x9d0154[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x5e7c24,null))[_0xe9c5('0x26')](removeEntity(_0x5e7c24,null))[_0xe9c5('0x46')](handleError(_0x5e7c24,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 04e1c7d..5cb1dcd 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 _0x8d48=['exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','util','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x442e13,_0xdc1165){var _0x342158=function(_0x90ffa){while(--_0x90ffa){_0x442e13['push'](_0x442e13['shift']());}};_0x342158(++_0xdc1165);}(_0x8d48,0x18b));var _0x88d4=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x8d48[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0x88d4('0x0'));var logger=require('../../config/logger')(_0x88d4('0x1'));var moment=require(_0x88d4('0x2'));var BPromise=require('bluebird');var rp=require(_0x88d4('0x3'));var fs=require('fs');var path=require(_0x88d4('0x4'));var rimraf=require(_0x88d4('0x5'));var config=require(_0x88d4('0x6'));var attributes=require(_0x88d4('0x7'));module[_0x88d4('0x8')]=function(_0x23cb77,_0x3b4531){return _0x23cb77['define'](_0x88d4('0x9'),attributes,{'tableName':_0x88d4('0xa'),'paranoid':![],'indexes':[{'name':_0x88d4('0xb'),'fields':['idField',_0x88d4('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9bc7=['moment','bluebird','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','util','../../config/logger','api'];(function(_0x4fdc46,_0x2a3759){var _0x2c178a=function(_0x59ead9){while(--_0x59ead9){_0x4fdc46['push'](_0x4fdc46['shift']());}};_0x2c178a(++_0x2a3759);}(_0x9bc7,0x177));var _0x79bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bc7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x79bc('0x0'));var logger=require(_0x79bc('0x1'))(_0x79bc('0x2'));var moment=require(_0x79bc('0x3'));var BPromise=require(_0x79bc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x79bc('0x5'));var config=require(_0x79bc('0x6'));var attributes=require(_0x79bc('0x7'));module[_0x79bc('0x8')]=function(_0x57c80d,_0x101b5a){return _0x57c80d[_0x79bc('0x9')](_0x79bc('0xa'),attributes,{'tableName':_0x79bc('0xb'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x79bc('0xc'),_0x79bc('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 3d24d2a..1c283b1 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 _0x5ef8=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','FreshdeskField,\x20%s,\x20%s','catch','util','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ef8,0x11b));var _0x85ef=function(_0x4a3acd,_0x4bf641){_0x4a3acd=_0x4a3acd-0x0;var _0x3efdaa=_0x5ef8[_0x4a3acd];return _0x3efdaa;};'use strict';var _=require('lodash');var util=require(_0x85ef('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x85ef('0x1'));var fs=require('fs');var Redis=require(_0x85ef('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x85ef('0x3'));var logger=require(_0x85ef('0x4'))(_0x85ef('0x5'));var config=require('../../config/environment');var jayson=require(_0x85ef('0x6'));var client=jayson[_0x85ef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x279fdb,_0x4178ba,_0x550f1d){return new BPromise(function(_0x498065,_0x44d918){return client[_0x85ef('0x8')](_0x279fdb,_0x550f1d)[_0x85ef('0x9')](function(_0x38926c){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x4178ba,_0x85ef('0xa'));logger[_0x85ef('0xb')](_0x85ef('0xc'),_0x4178ba,_0x85ef('0xa'),JSON[_0x85ef('0xd')](_0x38926c));if(_0x38926c[_0x85ef('0xe')]){if(_0x38926c[_0x85ef('0xe')]['code']===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x4178ba,_0x38926c['error']['message']);return _0x44d918(_0x38926c[_0x85ef('0xe')][_0x85ef('0xf')]);}logger[_0x85ef('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x4178ba,_0x38926c[_0x85ef('0xe')][_0x85ef('0xf')]);return _0x498065(_0x38926c['error']['message']);}else{logger[_0x85ef('0x10')](_0x85ef('0x11'),_0x4178ba,_0x85ef('0xa'));_0x498065(_0x38926c['result']['message']);}})[_0x85ef('0x12')](function(_0x217212){logger[_0x85ef('0xe')](_0x85ef('0x11'),_0x4178ba,_0x217212);_0x44d918(_0x217212);});});} \ No newline at end of file +var _0xb8ac=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','FreshdeskField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment'];(function(_0x105ee6,_0x2473cf){var _0x3a8333=function(_0x78adab){while(--_0x78adab){_0x105ee6['push'](_0x105ee6['shift']());}};_0x3a8333(++_0x2473cf);}(_0xb8ac,0xb1));var _0xcb8a=function(_0xa635b6,_0x1674c4){_0xa635b6=_0xa635b6-0x0;var _0x3ef961=_0xb8ac[_0xa635b6];return _0x3ef961;};'use strict';var _=require(_0xcb8a('0x0'));var util=require(_0xcb8a('0x1'));var moment=require(_0xcb8a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb8a('0x3'));var db=require(_0xcb8a('0x4'))['db'];var utils=require(_0xcb8a('0x5'));var logger=require(_0xcb8a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcb8a('0x7'));var client=jayson['client'][_0xcb8a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x589bd9,_0x377b37,_0x422d3e){return new BPromise(function(_0x1f37fd,_0xb03693){return client[_0xcb8a('0x9')](_0x589bd9,_0x422d3e)[_0xcb8a('0xa')](function(_0x1ba639){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x377b37,'request\x20sent');logger[_0xcb8a('0xb')](_0xcb8a('0xc'),_0x377b37,_0xcb8a('0xd'),JSON['stringify'](_0x1ba639));if(_0x1ba639[_0xcb8a('0xe')]){if(_0x1ba639[_0xcb8a('0xe')]['code']===0x1f4){logger[_0xcb8a('0xe')](_0xcb8a('0xf'),_0x377b37,_0x1ba639[_0xcb8a('0xe')][_0xcb8a('0x10')]);return _0xb03693(_0x1ba639[_0xcb8a('0xe')][_0xcb8a('0x10')]);}logger['error'](_0xcb8a('0xf'),_0x377b37,_0x1ba639[_0xcb8a('0xe')][_0xcb8a('0x10')]);return _0x1f37fd(_0x1ba639[_0xcb8a('0xe')][_0xcb8a('0x10')]);}else{logger[_0xcb8a('0x11')](_0xcb8a('0xf'),_0x377b37,'request\x20sent');_0x1f37fd(_0x1ba639[_0xcb8a('0x12')][_0xcb8a('0x10')]);}})[_0xcb8a('0x13')](function(_0x41a357){logger[_0xcb8a('0xe')](_0xcb8a('0xf'),_0x377b37,_0x41a357);_0xb03693(_0x41a357);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 575c045..ef37203 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 _0x0bb5=['./intFreshsalesAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3292d9,_0x3577b6){var _0x2428e6=function(_0x333a01){while(--_0x333a01){_0x3292d9['push'](_0x3292d9['shift']());}};_0x2428e6(++_0x3577b6);}(_0x0bb5,0x148));var _0x50bb=function(_0x4fa8ab,_0x1604ca){_0x4fa8ab=_0x4fa8ab-0x0;var _0x3531a2=_0x0bb5[_0x4fa8ab];return _0x3531a2;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/configurations',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x10')]('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x10')](_0x50bb('0x12'),auth[_0x50bb('0xb')](),controller['addConfiguration']);router[_0x50bb('0x13')]('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);module[_0x50bb('0x17')]=router; \ No newline at end of file +var _0xc900=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1c8d61,_0x47b090){var _0x47f60a=function(_0x1c1dff){while(--_0x1c1dff){_0x1c8d61['push'](_0x1c8d61['shift']());}};_0x47f60a(++_0x47b090);}(_0xc900,0xb3));var _0x0c90=function(_0x5c0427,_0x199e82){_0x5c0427=_0x5c0427-0x0;var _0x50e44a=_0xc900[_0x5c0427];return _0x50e44a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0c90('0x0'));var timeout=require(_0x0c90('0x1'));var express=require(_0x0c90('0x2'));var router=express['Router']();var fs_extra=require(_0x0c90('0x3'));var auth=require(_0x0c90('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0c90('0x5'));var controller=require(_0x0c90('0x6'));router[_0x0c90('0x7')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x9')]);router[_0x0c90('0x7')]('/:id',auth[_0x0c90('0x8')](),controller[_0x0c90('0xa')]);router[_0x0c90('0x7')](_0x0c90('0xb'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xc')]);router[_0x0c90('0x7')](_0x0c90('0xd'),auth[_0x0c90('0x8')](),controller[_0x0c90('0xe')]);router[_0x0c90('0xf')]('/',auth[_0x0c90('0x8')](),controller[_0x0c90('0x10')]);router['post'](_0x0c90('0xb'),auth['isAuthenticated'](),controller[_0x0c90('0x11')]);router['put'](_0x0c90('0x12'),auth[_0x0c90('0x8')](),controller[_0x0c90('0x13')]);router[_0x0c90('0x14')](_0x0c90('0x12'),auth['isAuthenticated'](),controller[_0x0c90('0x15')]);module[_0x0c90('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 0011231..8923997 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 _0x8e3f=['STRING','username','remoteUri','sequelize','exports'];(function(_0x3704b2,_0x9b13ee){var _0x2a3ca2=function(_0x35a82d){while(--_0x35a82d){_0x3704b2['push'](_0x3704b2['shift']());}};_0x2a3ca2(++_0x9b13ee);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xf8e3('0x0'));module[_0xf8e3('0x1')]={'name':{'type':Sequelize[_0xf8e3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf8e3('0x2')],'unique':_0xf8e3('0x3')},'apiKey':{'type':Sequelize[_0xf8e3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xf8e3('0x4')},'serverUrl':{'type':Sequelize[_0xf8e3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa30a=['sequelize','exports','STRING','username','remoteUri'];(function(_0x242637,_0x1c90c8){var _0x580002=function(_0x4ae875){while(--_0x4ae875){_0x242637['push'](_0x242637['shift']());}};_0x580002(++_0x1c90c8);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize[_0xaa30('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x3')},'apiKey':{'type':Sequelize[_0xaa30('0x2')]},'remoteUri':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x4')},'serverUrl':{'type':Sequelize[_0xaa30('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 00cf634..53e56c4 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 _0xbcc7=['/api/selector/owners','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','type','key','model','query','keys','intersection','attributes','fields','sort','where','filters','merge','VIRTUAL','filter','options','FreshsalesAccount','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','findOne','FreshsalesConfiguration','rawAttributes','pick','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshsalesField','remoteUri','username','slice','substring','lastIndexOf','GET','%s%s'];(function(_0x3f5570,_0x1902ae){var _0x2ad0f9=function(_0x4bb66d){while(--_0x4bb66d){_0x3f5570['push'](_0x3f5570['shift']());}};_0x2ad0f9(++_0x1902ae);}(_0xbcc7,0x19a));var _0x7bcc=function(_0xa05cf2,_0x2d118a){_0xa05cf2=_0xa05cf2-0x0;var _0x212397=_0xbcc7[_0xa05cf2];return _0x212397;};'use strict';var emlformat=require(_0x7bcc('0x0'));var rimraf=require(_0x7bcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bcc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7bcc('0x3'));var Mustache=require('mustache');var util=require(_0x7bcc('0x4'));var path=require(_0x7bcc('0x5'));var sox=require('sox');var csv=require(_0x7bcc('0x6'));var ejs=require(_0x7bcc('0x7'));var fs=require('fs');var fs_extra=require(_0x7bcc('0x8'));var _=require(_0x7bcc('0x9'));var squel=require(_0x7bcc('0xa'));var crypto=require(_0x7bcc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7bcc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7bcc('0xd'));var Papa=require(_0x7bcc('0xe'));var Redis=require('ioredis');var authService=require(_0x7bcc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bcc('0x10'))(_0x7bcc('0x11'));var utils=require(_0x7bcc('0x12'));var config=require(_0x7bcc('0x13'));var licenseUtil=require(_0x7bcc('0x14'));var db=require(_0x7bcc('0x15'))['db'];var integrations=require(_0x7bcc('0x16'));function respondWithStatusCode(_0x51b0e8,_0x3e3580){_0x3e3580=_0x3e3580||0xcc;return function(_0x101354){if(_0x101354){return _0x51b0e8[_0x7bcc('0x17')](_0x3e3580);}return _0x51b0e8[_0x7bcc('0x18')](_0x3e3580)[_0x7bcc('0x19')]();};}function respondWithResult(_0x217896,_0x4a2539){_0x4a2539=_0x4a2539||0xc8;return function(_0x3998c5){if(_0x3998c5){return _0x217896[_0x7bcc('0x18')](_0x4a2539)[_0x7bcc('0x1a')](_0x3998c5);}};}function respondWithFilteredResult(_0x461ff7,_0x30caa2){return function(_0x134d55){if(_0x134d55){var _0x432960=typeof _0x30caa2['offset']===_0x7bcc('0x1b')&&typeof _0x30caa2['limit']===_0x7bcc('0x1b');var _0x43dfc4=_0x134d55[_0x7bcc('0x1c')];var _0x323525=_0x432960?0x0:_0x30caa2['offset'];var _0x51e08d=_0x432960?_0x134d55[_0x7bcc('0x1c')]:_0x30caa2[_0x7bcc('0x1d')]+_0x30caa2[_0x7bcc('0x1e')];var _0x2bb631;if(_0x51e08d>=_0x43dfc4){_0x51e08d=_0x43dfc4;_0x2bb631=0xc8;}else{_0x2bb631=0xce;}_0x461ff7[_0x7bcc('0x18')](_0x2bb631);return _0x461ff7[_0x7bcc('0x1f')](_0x7bcc('0x20'),_0x323525+'-'+_0x51e08d+'/'+_0x43dfc4)[_0x7bcc('0x1a')](_0x134d55);}return null;};}function patchUpdates(_0x15b2c3){return function(_0x5d3409){try{jsonpatch['apply'](_0x5d3409,_0x15b2c3,!![]);}catch(_0x2dcc37){return BPromise[_0x7bcc('0x21')](_0x2dcc37);}return _0x5d3409[_0x7bcc('0x22')]();};}function saveUpdates(_0x3050cf,_0x201f40){return function(_0x2ba4bf){if(_0x2ba4bf){return _0x2ba4bf[_0x7bcc('0x23')](_0x3050cf)[_0x7bcc('0x24')](function(_0x32b3ea){return _0x32b3ea;});}return null;};}function removeEntity(_0x54c611,_0x2d25b8){return function(_0x2b3d01){if(_0x2b3d01){return _0x2b3d01[_0x7bcc('0x25')]()[_0x7bcc('0x24')](function(){_0x54c611[_0x7bcc('0x18')](0xcc)[_0x7bcc('0x19')]();});}};}function handleEntityNotFound(_0x4f8562,_0x48b296){return function(_0x345dd8){if(!_0x345dd8){_0x4f8562['sendStatus'](0x194);}return _0x345dd8;};}function handleError(_0x4db3c0,_0xd3ca3b){_0xd3ca3b=_0xd3ca3b||0x1f4;return function(_0x560cec){logger[_0x7bcc('0x26')](_0x560cec[_0x7bcc('0x27')]);if(_0x560cec[_0x7bcc('0x28')]){delete _0x560cec['name'];}_0x4db3c0[_0x7bcc('0x18')](_0xd3ca3b)[_0x7bcc('0x29')](_0x560cec);};}exports[_0x7bcc('0x2a')]=function(_0x319943,_0x20c458){var _0x1ecf95={},_0x9fdacf={},_0x57aa56={'count':0x0,'rows':[]};var _0x170c48=_[_0x7bcc('0x2b')](db['FreshsalesAccount']['rawAttributes'],function(_0x472b73){return{'name':_0x472b73['fieldName'],'type':_0x472b73[_0x7bcc('0x2c')][_0x7bcc('0x2d')]};});_0x9fdacf[_0x7bcc('0x2e')]=_[_0x7bcc('0x2b')](_0x170c48,'name');_0x9fdacf[_0x7bcc('0x2f')]=_[_0x7bcc('0x30')](_0x319943[_0x7bcc('0x2f')]);_0x9fdacf['filters']=_[_0x7bcc('0x31')](_0x9fdacf[_0x7bcc('0x2e')],_0x9fdacf[_0x7bcc('0x2f')]);_0x1ecf95[_0x7bcc('0x32')]=_[_0x7bcc('0x31')](_0x9fdacf[_0x7bcc('0x2e')],qs[_0x7bcc('0x33')](_0x319943[_0x7bcc('0x2f')][_0x7bcc('0x33')]));_0x1ecf95[_0x7bcc('0x32')]=_0x1ecf95[_0x7bcc('0x32')]['length']?_0x1ecf95[_0x7bcc('0x32')]:_0x9fdacf[_0x7bcc('0x2e')];if(!_0x319943[_0x7bcc('0x2f')]['hasOwnProperty']('nolimit')){_0x1ecf95[_0x7bcc('0x1e')]=qs[_0x7bcc('0x1e')](_0x319943[_0x7bcc('0x2f')][_0x7bcc('0x1e')]);_0x1ecf95[_0x7bcc('0x1d')]=qs[_0x7bcc('0x1d')](_0x319943[_0x7bcc('0x2f')]['offset']);}_0x1ecf95['order']=qs['sort'](_0x319943['query'][_0x7bcc('0x34')]);_0x1ecf95[_0x7bcc('0x35')]=qs[_0x7bcc('0x36')](_['pick'](_0x319943[_0x7bcc('0x2f')],_0x9fdacf[_0x7bcc('0x36')]),_0x170c48);if(_0x319943[_0x7bcc('0x2f')]['filter']){_0x1ecf95['where']=_[_0x7bcc('0x37')](_0x1ecf95[_0x7bcc('0x35')],{'$or':_[_0x7bcc('0x2b')](_0x170c48,function(_0x57fafe){if(_0x57fafe['type']!==_0x7bcc('0x38')){var _0x11dd5c={};_0x11dd5c[_0x57fafe[_0x7bcc('0x28')]]={'$like':'%'+_0x319943['query'][_0x7bcc('0x39')]+'%'};return _0x11dd5c;}})});}_0x1ecf95=_[_0x7bcc('0x37')]({},_0x1ecf95,_0x319943[_0x7bcc('0x3a')]);var _0x34d62f={'where':_0x1ecf95[_0x7bcc('0x35')]};return db[_0x7bcc('0x3b')]['count'](_0x34d62f)[_0x7bcc('0x24')](function(_0x1c6edb){_0x57aa56['count']=_0x1c6edb;if(_0x319943[_0x7bcc('0x2f')][_0x7bcc('0x3c')]){_0x1ecf95[_0x7bcc('0x3d')]=[{'all':!![]}];}return db[_0x7bcc('0x3b')][_0x7bcc('0x3e')](_0x1ecf95);})[_0x7bcc('0x24')](function(_0x632cff){_0x57aa56[_0x7bcc('0x3f')]=_0x632cff;return _0x57aa56;})['then'](respondWithFilteredResult(_0x20c458,_0x1ecf95))[_0x7bcc('0x40')](handleError(_0x20c458,null));};exports[_0x7bcc('0x41')]=function(_0x3d999f,_0x10e3a2){var _0x4074d7={'raw':![],'where':{'id':_0x3d999f['params']['id']}},_0x45f4ef={};_0x45f4ef['model']=_[_0x7bcc('0x30')](db[_0x7bcc('0x3b')]['rawAttributes']);_0x45f4ef[_0x7bcc('0x2f')]=_[_0x7bcc('0x30')](_0x3d999f[_0x7bcc('0x2f')]);_0x45f4ef[_0x7bcc('0x36')]=_[_0x7bcc('0x31')](_0x45f4ef[_0x7bcc('0x2e')],_0x45f4ef[_0x7bcc('0x2f')]);_0x4074d7['attributes']=_[_0x7bcc('0x31')](_0x45f4ef[_0x7bcc('0x2e')],qs[_0x7bcc('0x33')](_0x3d999f[_0x7bcc('0x2f')][_0x7bcc('0x33')]));_0x4074d7['attributes']=_0x4074d7[_0x7bcc('0x32')][_0x7bcc('0x42')]?_0x4074d7['attributes']:_0x45f4ef[_0x7bcc('0x2e')];if(_0x3d999f[_0x7bcc('0x2f')][_0x7bcc('0x3c')]){_0x4074d7['include']=[{'all':!![]}];}_0x4074d7=_[_0x7bcc('0x37')]({},_0x4074d7,_0x3d999f[_0x7bcc('0x3a')]);return db['FreshsalesAccount'][_0x7bcc('0x43')](_0x4074d7)[_0x7bcc('0x24')](handleEntityNotFound(_0x10e3a2,null))[_0x7bcc('0x24')](respondWithResult(_0x10e3a2,null))[_0x7bcc('0x40')](handleError(_0x10e3a2,null));};exports[_0x7bcc('0x44')]=function(_0x538a2e,_0x2c552b){return db[_0x7bcc('0x3b')]['create'](_0x538a2e[_0x7bcc('0x45')],{})['then'](respondWithResult(_0x2c552b,0xc9))[_0x7bcc('0x40')](handleError(_0x2c552b,null));};exports['update']=function(_0x29cb88,_0x513cf3){if(_0x29cb88['body']['id']){delete _0x29cb88[_0x7bcc('0x45')]['id'];}return db[_0x7bcc('0x3b')][_0x7bcc('0x43')]({'where':{'id':_0x29cb88[_0x7bcc('0x46')]['id']}})[_0x7bcc('0x24')](handleEntityNotFound(_0x513cf3,null))[_0x7bcc('0x24')](saveUpdates(_0x29cb88[_0x7bcc('0x45')],null))[_0x7bcc('0x24')](respondWithResult(_0x513cf3,null))[_0x7bcc('0x40')](handleError(_0x513cf3,null));};exports[_0x7bcc('0x25')]=function(_0x8e50eb,_0x40fde8){return db[_0x7bcc('0x3b')][_0x7bcc('0x43')]({'where':{'id':_0x8e50eb[_0x7bcc('0x46')]['id']}})['then'](handleEntityNotFound(_0x40fde8,null))[_0x7bcc('0x24')](removeEntity(_0x40fde8,null))[_0x7bcc('0x40')](handleError(_0x40fde8,null));};exports['getConfigurations']=function(_0x4bfffa,_0x2f8e0d,_0x38240d){var _0x55deaf={};var _0x5cf572={};var _0x5268f2;var _0x52b09d;return db['FreshsalesAccount'][_0x7bcc('0x47')]({'where':{'id':_0x4bfffa[_0x7bcc('0x46')]['id']}})['then'](handleEntityNotFound(_0x2f8e0d,null))['then'](function(_0x432d84){if(_0x432d84){_0x5268f2=_0x432d84;_0x5cf572[_0x7bcc('0x2e')]=_[_0x7bcc('0x30')](db[_0x7bcc('0x48')][_0x7bcc('0x49')]);_0x5cf572[_0x7bcc('0x2f')]=_['keys'](_0x4bfffa['query']);_0x5cf572[_0x7bcc('0x36')]=_[_0x7bcc('0x31')](_0x5cf572[_0x7bcc('0x2e')],_0x5cf572[_0x7bcc('0x2f')]);_0x55deaf['attributes']=_['intersection'](_0x5cf572['model'],qs[_0x7bcc('0x33')](_0x4bfffa['query'][_0x7bcc('0x33')]));_0x55deaf[_0x7bcc('0x32')]=_0x55deaf[_0x7bcc('0x32')]['length']?_0x55deaf[_0x7bcc('0x32')]:_0x5cf572['model'];_0x55deaf['order']=qs[_0x7bcc('0x34')](_0x4bfffa[_0x7bcc('0x2f')][_0x7bcc('0x34')]);_0x55deaf[_0x7bcc('0x35')]=qs[_0x7bcc('0x36')](_[_0x7bcc('0x4a')](_0x4bfffa[_0x7bcc('0x2f')],_0x5cf572[_0x7bcc('0x36')]));if(_0x4bfffa[_0x7bcc('0x2f')]['filter']){_0x55deaf[_0x7bcc('0x35')]=_[_0x7bcc('0x37')](_0x55deaf[_0x7bcc('0x35')],{'$or':_['map'](_0x55deaf[_0x7bcc('0x32')],function(_0x24c9b9){var _0x42c095={};_0x42c095[_0x24c9b9]={'$like':'%'+_0x4bfffa[_0x7bcc('0x2f')][_0x7bcc('0x39')]+'%'};return _0x42c095;})});}_0x55deaf=_[_0x7bcc('0x37')]({},_0x55deaf,_0x4bfffa[_0x7bcc('0x3a')]);return _0x5268f2[_0x7bcc('0x4b')](_0x55deaf);}})[_0x7bcc('0x24')](function(_0x27e2d1){if(_0x27e2d1){_0x52b09d=_0x27e2d1['length'];if(!_0x4bfffa[_0x7bcc('0x2f')][_0x7bcc('0x4c')]('nolimit')){_0x55deaf[_0x7bcc('0x1e')]=qs[_0x7bcc('0x1e')](_0x4bfffa[_0x7bcc('0x2f')]['limit']);_0x55deaf[_0x7bcc('0x1d')]=qs['offset'](_0x4bfffa[_0x7bcc('0x2f')][_0x7bcc('0x1d')]);}return _0x5268f2[_0x7bcc('0x4b')](_0x55deaf);}})[_0x7bcc('0x24')](function(_0x2e4a1b){if(_0x2e4a1b){return _0x2e4a1b?{'count':_0x52b09d,'rows':_0x2e4a1b}:null;}})[_0x7bcc('0x24')](respondWithResult(_0x2f8e0d,null))[_0x7bcc('0x40')](handleError(_0x2f8e0d,null));};exports['addConfiguration']=function(_0x57baed,_0x4dc93,_0x5b979b){if(_0x57baed[_0x7bcc('0x45')]['id']){delete _0x57baed[_0x7bcc('0x45')]['id'];}return db[_0x7bcc('0x3b')][_0x7bcc('0x47')]({'where':{'id':_0x57baed['params']['id']}})[_0x7bcc('0x24')](handleEntityNotFound(_0x4dc93,null))[_0x7bcc('0x24')](function(_0xc0401f){if(_0xc0401f){_0x57baed[_0x7bcc('0x45')][_0x7bcc('0x4d')]=_0xc0401f['id'];_0x57baed[_0x7bcc('0x45')][_0x7bcc('0x4e')]=integrations[_0x7bcc('0x4f')](_0x57baed[_0x7bcc('0x45')][_0x7bcc('0x50')],_0x57baed[_0x7bcc('0x45')]['type']);_0x57baed['body']['Descriptions']=integrations[_0x7bcc('0x51')](_0x57baed['body'][_0x7bcc('0x50')],_0x57baed['body'][_0x7bcc('0x2c')]);return db[_0x7bcc('0x48')][_0x7bcc('0x44')](_0x57baed[_0x7bcc('0x45')],{'include':[{'model':db[_0x7bcc('0x52')],'as':_0x7bcc('0x4e')},{'model':db[_0x7bcc('0x52')],'as':'Descriptions'}]});}return null;})[_0x7bcc('0x24')](respondWithResult(_0x4dc93,null))[_0x7bcc('0x40')](handleError(_0x4dc93,null));};exports['getFields']=function(_0x11610b,_0x57ee0f,_0x354819){var _0x4c2374='';var _0x13205f='';return db[_0x7bcc('0x3b')][_0x7bcc('0x47')]({'where':{'id':_0x11610b[_0x7bcc('0x46')]['id']},'attributes':['id','username',_0x7bcc('0x53'),'apiKey']})[_0x7bcc('0x24')](handleEntityNotFound(_0x57ee0f,null))[_0x7bcc('0x24')](function(_0x27ce03){if(_0x27ce03){_0x13205f=_0x27ce03[_0x7bcc('0x54')];_0x4c2374=_0x27ce03['remoteUri'];var _0x34cc97=_0x27ce03[_0x7bcc('0x53')][_0x7bcc('0x55')](-0x1);if(_0x34cc97==='/'){_0x4c2374=_0x4c2374[_0x7bcc('0x56')](0x0,_0x4c2374[_0x7bcc('0x57')](_0x34cc97));}return rp({'method':_0x7bcc('0x58'),'uri':util['format'](_0x7bcc('0x59'),_0x4c2374,_0x7bcc('0x5a')),'headers':{'Authorization':_0x7bcc('0x5b')+_0x27ce03[_0x7bcc('0x5c')]},'json':!![]});}})[_0x7bcc('0x24')](function(_0x10544d){if(_0x10544d){var _0xce883b=_0x10544d['users'];var _0x2f9d8d=![];var _0x36794d=null;for(_0x36794d=0x0;_0x36794d<_0xce883b[_0x7bcc('0x42')];_0x36794d++){if(_0xce883b[_0x36794d][_0x7bcc('0x5d')]===_0x13205f){_0x2f9d8d=!![];}}if(_0x2f9d8d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7bcc('0x5e')});}}})[_0x7bcc('0x24')](respondWithResult(_0x57ee0f,null))[_0x7bcc('0x40')](function(_0x19e4dd){var _0x375fd6=_0x11610b['query'][_0x7bcc('0x5f')]?0x1f4:_0x19e4dd[_0x7bcc('0x60')]||0x1f4;logger[_0x7bcc('0x26')](_0x7bcc('0x61'),_0x7bcc('0x62'),_0x375fd6,JSON['stringify'](_0x19e4dd));delete _0x19e4dd[_0x7bcc('0x28')];if(_0x375fd6===0x191){_0x375fd6=0x190;}_0x57ee0f[_0x7bcc('0x18')](_0x375fd6)[_0x7bcc('0x29')](_0x11610b[_0x7bcc('0x2f')]['test']?{'message':_0x7bcc('0x63'),'statusCode':_0x19e4dd[_0x7bcc('0x60')]}:_0x19e4dd);});}; \ No newline at end of file +var _0x80ce=['end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','error','stack','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','find','create','getConfigurations','findOne','FreshsalesConfiguration','hasOwnProperty','addConfiguration','body','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','slice','substring','lastIndexOf','GET','format','/api/selector/owners','apiKey','users','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus'];(function(_0x463abd,_0x1e7eaf){var _0x8f2a37=function(_0xf60e4b){while(--_0xf60e4b){_0x463abd['push'](_0x463abd['shift']());}};_0x8f2a37(++_0x1e7eaf);}(_0x80ce,0x184));var _0xe80c=function(_0x394f76,_0x570ddd){_0x394f76=_0x394f76-0x0;var _0x3af6f3=_0x80ce[_0x394f76];return _0x3af6f3;};'use strict';var emlformat=require(_0xe80c('0x0'));var rimraf=require(_0xe80c('0x1'));var zipdir=require(_0xe80c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe80c('0x3'));var moment=require(_0xe80c('0x4'));var BPromise=require(_0xe80c('0x5'));var Mustache=require(_0xe80c('0x6'));var util=require('util');var path=require(_0xe80c('0x7'));var sox=require(_0xe80c('0x8'));var csv=require('to-csv');var ejs=require(_0xe80c('0x9'));var fs=require('fs');var fs_extra=require(_0xe80c('0xa'));var _=require(_0xe80c('0xb'));var squel=require(_0xe80c('0xc'));var crypto=require('crypto');var jsforce=require(_0xe80c('0xd'));var deskjs=require(_0xe80c('0xe'));var toCsv=require(_0xe80c('0xf'));var querystring=require(_0xe80c('0x10'));var Papa=require('papaparse');var Redis=require(_0xe80c('0x11'));var authService=require(_0xe80c('0x12'));var qs=require(_0xe80c('0x13'));var as=require(_0xe80c('0x14'));var hardwareService=require(_0xe80c('0x15'));var logger=require(_0xe80c('0x16'))('api');var utils=require(_0xe80c('0x17'));var config=require(_0xe80c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe80c('0x19'))['db'];var integrations=require(_0xe80c('0x1a'));function respondWithStatusCode(_0x1483ae,_0x271fbb){_0x271fbb=_0x271fbb||0xcc;return function(_0x4ce038){if(_0x4ce038){return _0x1483ae[_0xe80c('0x1b')](_0x271fbb);}return _0x1483ae['status'](_0x271fbb)[_0xe80c('0x1c')]();};}function respondWithResult(_0xfa2e43,_0x425d1a){_0x425d1a=_0x425d1a||0xc8;return function(_0x46b972){if(_0x46b972){return _0xfa2e43['status'](_0x425d1a)[_0xe80c('0x1d')](_0x46b972);}};}function respondWithFilteredResult(_0x2e9087,_0x28a7ab){return function(_0x3cf414){if(_0x3cf414){var _0x4f6fe2=typeof _0x28a7ab[_0xe80c('0x1e')]===_0xe80c('0x1f')&&typeof _0x28a7ab[_0xe80c('0x20')]==='undefined';var _0x5acae7=_0x3cf414[_0xe80c('0x21')];var _0x26ee10=_0x4f6fe2?0x0:_0x28a7ab[_0xe80c('0x1e')];var _0x436525=_0x4f6fe2?_0x3cf414[_0xe80c('0x21')]:_0x28a7ab[_0xe80c('0x1e')]+_0x28a7ab['limit'];var _0x2ec198;if(_0x436525>=_0x5acae7){_0x436525=_0x5acae7;_0x2ec198=0xc8;}else{_0x2ec198=0xce;}_0x2e9087[_0xe80c('0x22')](_0x2ec198);return _0x2e9087[_0xe80c('0x23')](_0xe80c('0x24'),_0x26ee10+'-'+_0x436525+'/'+_0x5acae7)['json'](_0x3cf414);}return null;};}function patchUpdates(_0xe96e96){return function(_0x2d886e){try{jsonpatch[_0xe80c('0x25')](_0x2d886e,_0xe96e96,!![]);}catch(_0x4c3525){return BPromise['reject'](_0x4c3525);}return _0x2d886e[_0xe80c('0x26')]();};}function saveUpdates(_0x134e01,_0x1aaf57){return function(_0x30aea5){if(_0x30aea5){return _0x30aea5[_0xe80c('0x27')](_0x134e01)[_0xe80c('0x28')](function(_0x5194ea){return _0x5194ea;});}return null;};}function removeEntity(_0x191f72,_0x452397){return function(_0x31f365){if(_0x31f365){return _0x31f365[_0xe80c('0x29')]()[_0xe80c('0x28')](function(){_0x191f72[_0xe80c('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x427455,_0x24ea13){return function(_0x1266e2){if(!_0x1266e2){_0x427455[_0xe80c('0x1b')](0x194);}return _0x1266e2;};}function handleError(_0x271a12,_0x536573){_0x536573=_0x536573||0x1f4;return function(_0xeb4c96){logger[_0xe80c('0x2a')](_0xeb4c96[_0xe80c('0x2b')]);if(_0xeb4c96['name']){delete _0xeb4c96['name'];}_0x271a12[_0xe80c('0x22')](_0x536573)[_0xe80c('0x2c')](_0xeb4c96);};}exports[_0xe80c('0x2d')]=function(_0x5436cb,_0x1b058f){var _0x12c996={},_0x5013a1={},_0x56858e={'count':0x0,'rows':[]};var _0x51e24f=_[_0xe80c('0x2e')](db[_0xe80c('0x2f')][_0xe80c('0x30')],function(_0x42101b){return{'name':_0x42101b[_0xe80c('0x31')],'type':_0x42101b[_0xe80c('0x32')][_0xe80c('0x33')]};});_0x5013a1[_0xe80c('0x34')]=_['map'](_0x51e24f,'name');_0x5013a1[_0xe80c('0x35')]=_[_0xe80c('0x36')](_0x5436cb[_0xe80c('0x35')]);_0x5013a1[_0xe80c('0x37')]=_[_0xe80c('0x38')](_0x5013a1['model'],_0x5013a1[_0xe80c('0x35')]);_0x12c996['attributes']=_[_0xe80c('0x38')](_0x5013a1[_0xe80c('0x34')],qs[_0xe80c('0x39')](_0x5436cb['query'][_0xe80c('0x39')]));_0x12c996[_0xe80c('0x3a')]=_0x12c996[_0xe80c('0x3a')][_0xe80c('0x3b')]?_0x12c996[_0xe80c('0x3a')]:_0x5013a1[_0xe80c('0x34')];if(!_0x5436cb[_0xe80c('0x35')]['hasOwnProperty'](_0xe80c('0x3c'))){_0x12c996[_0xe80c('0x20')]=qs[_0xe80c('0x20')](_0x5436cb['query']['limit']);_0x12c996[_0xe80c('0x1e')]=qs['offset'](_0x5436cb[_0xe80c('0x35')][_0xe80c('0x1e')]);}_0x12c996[_0xe80c('0x3d')]=qs[_0xe80c('0x3e')](_0x5436cb[_0xe80c('0x35')][_0xe80c('0x3e')]);_0x12c996[_0xe80c('0x3f')]=qs[_0xe80c('0x37')](_[_0xe80c('0x40')](_0x5436cb[_0xe80c('0x35')],_0x5013a1[_0xe80c('0x37')]),_0x51e24f);if(_0x5436cb[_0xe80c('0x35')]['filter']){_0x12c996['where']=_[_0xe80c('0x41')](_0x12c996[_0xe80c('0x3f')],{'$or':_[_0xe80c('0x2e')](_0x51e24f,function(_0x100737){if(_0x100737[_0xe80c('0x32')]!==_0xe80c('0x42')){var _0x8ca465={};_0x8ca465[_0x100737['name']]={'$like':'%'+_0x5436cb[_0xe80c('0x35')][_0xe80c('0x43')]+'%'};return _0x8ca465;}})});}_0x12c996=_[_0xe80c('0x41')]({},_0x12c996,_0x5436cb[_0xe80c('0x44')]);var _0x358f9f={'where':_0x12c996[_0xe80c('0x3f')]};return db[_0xe80c('0x2f')][_0xe80c('0x21')](_0x358f9f)[_0xe80c('0x28')](function(_0x1b5bea){_0x56858e[_0xe80c('0x21')]=_0x1b5bea;if(_0x5436cb['query'][_0xe80c('0x45')]){_0x12c996['include']=[{'all':!![]}];}return db[_0xe80c('0x2f')][_0xe80c('0x46')](_0x12c996);})[_0xe80c('0x28')](function(_0x48d9ee){_0x56858e[_0xe80c('0x47')]=_0x48d9ee;return _0x56858e;})[_0xe80c('0x28')](respondWithFilteredResult(_0x1b058f,_0x12c996))[_0xe80c('0x48')](handleError(_0x1b058f,null));};exports['show']=function(_0x45ab5e,_0x994fa1){var _0x44033c={'raw':![],'where':{'id':_0x45ab5e[_0xe80c('0x49')]['id']}},_0x2e5ef8={};_0x2e5ef8[_0xe80c('0x34')]=_['keys'](db['FreshsalesAccount']['rawAttributes']);_0x2e5ef8[_0xe80c('0x35')]=_[_0xe80c('0x36')](_0x45ab5e[_0xe80c('0x35')]);_0x2e5ef8[_0xe80c('0x37')]=_[_0xe80c('0x38')](_0x2e5ef8[_0xe80c('0x34')],_0x2e5ef8[_0xe80c('0x35')]);_0x44033c[_0xe80c('0x3a')]=_[_0xe80c('0x38')](_0x2e5ef8[_0xe80c('0x34')],qs['fields'](_0x45ab5e[_0xe80c('0x35')][_0xe80c('0x39')]));_0x44033c['attributes']=_0x44033c['attributes'][_0xe80c('0x3b')]?_0x44033c[_0xe80c('0x3a')]:_0x2e5ef8[_0xe80c('0x34')];if(_0x45ab5e[_0xe80c('0x35')][_0xe80c('0x45')]){_0x44033c['include']=[{'all':!![]}];}_0x44033c=_[_0xe80c('0x41')]({},_0x44033c,_0x45ab5e[_0xe80c('0x44')]);return db[_0xe80c('0x2f')][_0xe80c('0x4a')](_0x44033c)[_0xe80c('0x28')](handleEntityNotFound(_0x994fa1,null))[_0xe80c('0x28')](respondWithResult(_0x994fa1,null))['catch'](handleError(_0x994fa1,null));};exports['create']=function(_0x378d28,_0x4cd692){return db[_0xe80c('0x2f')][_0xe80c('0x4b')](_0x378d28['body'],{})['then'](respondWithResult(_0x4cd692,0xc9))[_0xe80c('0x48')](handleError(_0x4cd692,null));};exports[_0xe80c('0x27')]=function(_0x132894,_0x406082){if(_0x132894['body']['id']){delete _0x132894['body']['id'];}return db[_0xe80c('0x2f')][_0xe80c('0x4a')]({'where':{'id':_0x132894[_0xe80c('0x49')]['id']}})[_0xe80c('0x28')](handleEntityNotFound(_0x406082,null))['then'](saveUpdates(_0x132894['body'],null))[_0xe80c('0x28')](respondWithResult(_0x406082,null))[_0xe80c('0x48')](handleError(_0x406082,null));};exports[_0xe80c('0x29')]=function(_0xa33dbf,_0x4b94c0){return db[_0xe80c('0x2f')][_0xe80c('0x4a')]({'where':{'id':_0xa33dbf[_0xe80c('0x49')]['id']}})[_0xe80c('0x28')](handleEntityNotFound(_0x4b94c0,null))[_0xe80c('0x28')](removeEntity(_0x4b94c0,null))[_0xe80c('0x48')](handleError(_0x4b94c0,null));};exports[_0xe80c('0x4c')]=function(_0x5ca55f,_0x3cb11f,_0x229f5c){var _0x21a951={};var _0x288994={};var _0x16a4c8;var _0x230320;return db[_0xe80c('0x2f')][_0xe80c('0x4d')]({'where':{'id':_0x5ca55f[_0xe80c('0x49')]['id']}})['then'](handleEntityNotFound(_0x3cb11f,null))['then'](function(_0xae1eb2){if(_0xae1eb2){_0x16a4c8=_0xae1eb2;_0x288994['model']=_[_0xe80c('0x36')](db[_0xe80c('0x4e')][_0xe80c('0x30')]);_0x288994['query']=_[_0xe80c('0x36')](_0x5ca55f[_0xe80c('0x35')]);_0x288994['filters']=_[_0xe80c('0x38')](_0x288994[_0xe80c('0x34')],_0x288994['query']);_0x21a951[_0xe80c('0x3a')]=_[_0xe80c('0x38')](_0x288994[_0xe80c('0x34')],qs[_0xe80c('0x39')](_0x5ca55f[_0xe80c('0x35')]['fields']));_0x21a951[_0xe80c('0x3a')]=_0x21a951[_0xe80c('0x3a')][_0xe80c('0x3b')]?_0x21a951['attributes']:_0x288994[_0xe80c('0x34')];_0x21a951['order']=qs['sort'](_0x5ca55f[_0xe80c('0x35')][_0xe80c('0x3e')]);_0x21a951['where']=qs[_0xe80c('0x37')](_[_0xe80c('0x40')](_0x5ca55f[_0xe80c('0x35')],_0x288994['filters']));if(_0x5ca55f[_0xe80c('0x35')][_0xe80c('0x43')]){_0x21a951[_0xe80c('0x3f')]=_['merge'](_0x21a951['where'],{'$or':_[_0xe80c('0x2e')](_0x21a951[_0xe80c('0x3a')],function(_0x274c83){var _0x29e6bf={};_0x29e6bf[_0x274c83]={'$like':'%'+_0x5ca55f[_0xe80c('0x35')][_0xe80c('0x43')]+'%'};return _0x29e6bf;})});}_0x21a951=_[_0xe80c('0x41')]({},_0x21a951,_0x5ca55f['options']);return _0x16a4c8[_0xe80c('0x4c')](_0x21a951);}})[_0xe80c('0x28')](function(_0x2ce3ef){if(_0x2ce3ef){_0x230320=_0x2ce3ef[_0xe80c('0x3b')];if(!_0x5ca55f[_0xe80c('0x35')][_0xe80c('0x4f')]('nolimit')){_0x21a951[_0xe80c('0x20')]=qs[_0xe80c('0x20')](_0x5ca55f[_0xe80c('0x35')]['limit']);_0x21a951[_0xe80c('0x1e')]=qs[_0xe80c('0x1e')](_0x5ca55f['query']['offset']);}return _0x16a4c8[_0xe80c('0x4c')](_0x21a951);}})['then'](function(_0x103657){if(_0x103657){return _0x103657?{'count':_0x230320,'rows':_0x103657}:null;}})[_0xe80c('0x28')](respondWithResult(_0x3cb11f,null))[_0xe80c('0x48')](handleError(_0x3cb11f,null));};exports[_0xe80c('0x50')]=function(_0x246890,_0x302c96,_0x2ae47b){if(_0x246890[_0xe80c('0x51')]['id']){delete _0x246890[_0xe80c('0x51')]['id'];}return db['FreshsalesAccount'][_0xe80c('0x4d')]({'where':{'id':_0x246890[_0xe80c('0x49')]['id']}})[_0xe80c('0x28')](handleEntityNotFound(_0x302c96,null))['then'](function(_0x457635){if(_0x457635){_0x246890[_0xe80c('0x51')][_0xe80c('0x52')]=_0x457635['id'];_0x246890['body'][_0xe80c('0x53')]=integrations[_0xe80c('0x54')](_0x246890[_0xe80c('0x51')][_0xe80c('0x55')],_0x246890[_0xe80c('0x51')]['type']);_0x246890[_0xe80c('0x51')][_0xe80c('0x56')]=integrations[_0xe80c('0x57')](_0x246890[_0xe80c('0x51')][_0xe80c('0x55')],_0x246890[_0xe80c('0x51')][_0xe80c('0x32')]);return db['FreshsalesConfiguration'][_0xe80c('0x4b')](_0x246890[_0xe80c('0x51')],{'include':[{'model':db[_0xe80c('0x58')],'as':'Subjects'},{'model':db[_0xe80c('0x58')],'as':_0xe80c('0x56')}]});}return null;})[_0xe80c('0x28')](respondWithResult(_0x302c96,null))[_0xe80c('0x48')](handleError(_0x302c96,null));};exports[_0xe80c('0x59')]=function(_0x3c5587,_0x12bd74,_0x11a74e){var _0xbb64d9='';var _0x5397dd='';return db[_0xe80c('0x2f')]['findOne']({'where':{'id':_0x3c5587['params']['id']},'attributes':['id',_0xe80c('0x5a'),_0xe80c('0x5b'),'apiKey']})[_0xe80c('0x28')](handleEntityNotFound(_0x12bd74,null))[_0xe80c('0x28')](function(_0x380176){if(_0x380176){_0x5397dd=_0x380176[_0xe80c('0x5a')];_0xbb64d9=_0x380176['remoteUri'];var _0x15064b=_0x380176[_0xe80c('0x5b')][_0xe80c('0x5c')](-0x1);if(_0x15064b==='/'){_0xbb64d9=_0xbb64d9[_0xe80c('0x5d')](0x0,_0xbb64d9[_0xe80c('0x5e')](_0x15064b));}return rp({'method':_0xe80c('0x5f'),'uri':util[_0xe80c('0x60')]('%s%s',_0xbb64d9,_0xe80c('0x61')),'headers':{'Authorization':'Token\x20token='+_0x380176[_0xe80c('0x62')]},'json':!![]});}})[_0xe80c('0x28')](function(_0x260ae5){if(_0x260ae5){var _0x50003f=_0x260ae5[_0xe80c('0x63')];var _0x2b1d09=![];var _0x985de1=null;for(_0x985de1=0x0;_0x985de1<_0x50003f[_0xe80c('0x3b')];_0x985de1++){if(_0x50003f[_0x985de1]['email']===_0x5397dd){_0x2b1d09=!![];}}if(_0x2b1d09){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0xe80c('0x28')](respondWithResult(_0x12bd74,null))[_0xe80c('0x48')](function(_0x4653da){var _0x3a4421=_0x3c5587[_0xe80c('0x35')][_0xe80c('0x64')]?0x1f4:_0x4653da[_0xe80c('0x65')]||0x1f4;logger[_0xe80c('0x2a')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3a4421,JSON[_0xe80c('0x66')](_0x4653da));delete _0x4653da['name'];if(_0x3a4421===0x191){_0x3a4421=0x190;}_0x12bd74['status'](_0x3a4421)['send'](_0x3c5587['query']['test']?{'message':_0xe80c('0x67'),'statusCode':_0x4653da[_0xe80c('0x65')]}:_0x4653da);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 488dbe2..9289214 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 _0xb016=['../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x10b7bc,_0x2c2a4f){var _0x64b7dd=function(_0x1254a0){while(--_0x1254a0){_0x10b7bc['push'](_0x10b7bc['shift']());}};_0x64b7dd(++_0x2c2a4f);}(_0xb016,0x159));var _0x6b01=function(_0x14b1e5,_0x27fc4e){_0x14b1e5=_0x14b1e5-0x0;var _0x3589ab=_0xb016[_0x14b1e5];return _0x3589ab;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b01('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b01('0x3'));var fs=require('fs');var path=require(_0x6b01('0x4'));var rimraf=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x6b01('0x7'));module[_0x6b01('0x8')]=function(_0x192b2d,_0x5759a1){return _0x192b2d['define'](_0x6b01('0x9'),attributes,{'tableName':_0x6b01('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57ca=['exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x57ca,0x108));var _0xa57c=function(_0x346dff,_0x517b06){_0x346dff=_0x346dff-0x0;var _0x4b43c9=_0x57ca[_0x346dff];return _0x4b43c9;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));var integrations=require(_0xa57c('0x8'));module[_0xa57c('0x9')]=function(_0x19473f,_0xbdfffb){return _0x19473f[_0xa57c('0xa')](_0xa57c('0xb'),attributes,{'tableName':_0xa57c('0xc'),'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 f3da304..80a2b3e 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 _0x3a6d=['client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','attributes','limit','include','model','map','debug','ShowFreshsalesAccount','find','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x41a32e,_0x3383b8){var _0x4a009c=function(_0xf1b17f){while(--_0xf1b17f){_0x41a32e['push'](_0x41a32e['shift']());}};_0x4a009c(++_0x3383b8);}(_0x3a6d,0x143));var _0xd3a6=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x3a6d[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var moment=require('moment');var BPromise=require(_0xd3a6('0x2'));var rs=require(_0xd3a6('0x3'));var fs=require('fs');var Redis=require(_0xd3a6('0x4'));var db=require(_0xd3a6('0x5'))['db'];var utils=require(_0xd3a6('0x6'));var logger=require('../../config/logger')(_0xd3a6('0x7'));var config=require(_0xd3a6('0x8'));var jayson=require(_0xd3a6('0x9'));var client=jayson[_0xd3a6('0xa')][_0xd3a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x282cb1,_0x58d83a,_0x121bd2){return new BPromise(function(_0x134dd3,_0x16858){return client[_0xd3a6('0xc')](_0x282cb1,_0x121bd2)[_0xd3a6('0xd')](function(_0xa67661){logger[_0xd3a6('0xe')](_0xd3a6('0xf'),_0x58d83a,_0xd3a6('0x10'));logger['debug'](_0xd3a6('0x11'),_0x58d83a,_0xd3a6('0x10'),JSON[_0xd3a6('0x12')](_0xa67661));if(_0xa67661[_0xd3a6('0x13')]){if(_0xa67661[_0xd3a6('0x13')]['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x58d83a,_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);return _0x16858(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}logger[_0xd3a6('0x13')](_0xd3a6('0xf'),_0x58d83a,_0xa67661[_0xd3a6('0x13')]['message']);return _0x134dd3(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}else{logger[_0xd3a6('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x58d83a,_0xd3a6('0x10'));_0x134dd3(_0xa67661[_0xd3a6('0x15')][_0xd3a6('0x14')]);}})['catch'](function(_0x3498d5){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x58d83a,_0x3498d5);_0x16858(_0x3498d5);});});}exports[_0xd3a6('0x16')]=function(_0x8d1286){var _0x32683f=this;return new Promise(function(_0xbe58b4,_0x22fb05){return db[_0xd3a6('0x17')][_0xd3a6('0x18')]({'raw':_0x8d1286['options']?_0x8d1286[_0xd3a6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1a')]||null:null,'attributes':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1b')]||null:null,'limit':_0x8d1286['options']?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1c')]||null:null,'include':_0x8d1286['options']?_0x8d1286['options']['include']?_['map'](_0x8d1286['options'][_0xd3a6('0x1d')],function(_0x400982){return{'model':db[_0x400982[_0xd3a6('0x1e')]],'as':_0x400982['as'],'attributes':_0x400982['attributes'],'include':_0x400982[_0xd3a6('0x1d')]?_['map'](_0x400982[_0xd3a6('0x1d')],function(_0x16afc8){return{'model':db[_0x16afc8[_0xd3a6('0x1e')]],'as':_0x16afc8['as'],'attributes':_0x16afc8['attributes'],'include':_0x16afc8[_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0x16afc8[_0xd3a6('0x1d')],function(_0x219e32){return{'model':db[_0x219e32[_0xd3a6('0x1e')]],'as':_0x219e32['as'],'attributes':_0x219e32[_0xd3a6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30df90){logger[_0xd3a6('0xe')](_0xd3a6('0x16'),_0x8d1286);logger[_0xd3a6('0x20')](_0xd3a6('0x16'),_0x8d1286,JSON[_0xd3a6('0x12')](_0x30df90));_0xbe58b4(_0x30df90);})['catch'](function(_0x535bd4){logger[_0xd3a6('0x13')](_0xd3a6('0x16'),_0x535bd4[_0xd3a6('0x14')],_0x8d1286);_0x22fb05(_0x32683f[_0xd3a6('0x13')](0x1f4,_0x535bd4['message']));});});};exports[_0xd3a6('0x21')]=function(_0xa4efd){var _0x4d322a=this;return new Promise(function(_0x14381c,_0x5d9867){return db[_0xd3a6('0x17')][_0xd3a6('0x22')]({'raw':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x23')]===undefined?!![]:![]:!![],'where':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd[_0xd3a6('0x19')]['where']||null:null,'attributes':_0xa4efd['options']?_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x1b')]||null:null,'include':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd['options'][_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x1d')],function(_0x3ebd0d){return{'model':db[_0x3ebd0d[_0xd3a6('0x1e')]],'as':_0x3ebd0d['as'],'attributes':_0x3ebd0d[_0xd3a6('0x1b')],'include':_0x3ebd0d[_0xd3a6('0x1d')]?_['map'](_0x3ebd0d[_0xd3a6('0x1d')],function(_0x41981c){return{'model':db[_0x41981c[_0xd3a6('0x1e')]],'as':_0x41981c['as'],'attributes':_0x41981c[_0xd3a6('0x1b')],'include':_0x41981c[_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0x41981c['include'],function(_0x16a30a){return{'model':db[_0x16a30a['model']],'as':_0x16a30a['as'],'attributes':_0x16a30a[_0xd3a6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd3a6('0xd')](function(_0x180bb9){logger[_0xd3a6('0xe')]('ShowFreshsalesAccount',_0xa4efd);logger['debug'](_0xd3a6('0x21'),_0xa4efd,JSON[_0xd3a6('0x12')](_0x180bb9));_0x14381c(_0x180bb9);})[_0xd3a6('0x24')](function(_0x5188e1){logger[_0xd3a6('0x13')](_0xd3a6('0x21'),_0x5188e1['message'],_0xa4efd);_0x5d9867(_0x4d322a[_0xd3a6('0x13')](0x1f4,_0x5188e1['message']));});});}; \ No newline at end of file +var _0x1623=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowFreshsalesAccount','lodash','bluebird','randomstring','ioredis'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x1623,0xab));var _0x3162=function(_0x34f29e,_0x366ca3){_0x34f29e=_0x34f29e-0x0;var _0x95fc75=_0x1623[_0x34f29e];return _0x95fc75;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')]({'raw':_0x1eed46[_0x3162('0x19')]?_0x1eed46['options'][_0x3162('0x1a')]===undefined?!![]:![]:!![],'where':_0x1eed46['options']?_0x1eed46['options'][_0x3162('0x1b')]||null:null,'attributes':_0x1eed46[_0x3162('0x19')]?_0x1eed46[_0x3162('0x19')]['attributes']||null:null,'limit':_0x1eed46['options']?_0x1eed46[_0x3162('0x19')][_0x3162('0x1c')]||null:null,'include':_0x1eed46[_0x3162('0x19')]?_0x1eed46[_0x3162('0x19')][_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x1eed46[_0x3162('0x19')][_0x3162('0x1d')],function(_0x5a4994){return{'model':db[_0x5a4994[_0x3162('0x1f')]],'as':_0x5a4994['as'],'attributes':_0x5a4994[_0x3162('0x20')],'include':_0x5a4994[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x5a4994[_0x3162('0x1d')],function(_0x3c543e){return{'model':db[_0x3c543e[_0x3162('0x1f')]],'as':_0x3c543e['as'],'attributes':_0x3c543e[_0x3162('0x20')],'include':_0x3c543e[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x3c543e[_0x3162('0x1d')],function(_0x2f62d7){return{'model':db[_0x2f62d7[_0x3162('0x1f')]],'as':_0x2f62d7['as'],'attributes':_0x2f62d7['attributes']};}):[]};}):[]};}):[]:[]})[_0x3162('0xa')](function(_0x552469){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger[_0x3162('0xc')]('GetFreshsalesAccount',_0x1eed46,JSON['stringify'](_0x552469));_0x4b2bf3(_0x552469);})[_0x3162('0x15')](function(_0xaa1f35){logger[_0x3162('0x10')](_0x3162('0x16'),_0xaa1f35[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97['error'](0x1f4,_0xaa1f35[_0x3162('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0xf11765){var _0x3a188e=this;return new Promise(function(_0x41e933,_0x221b38){return db[_0x3162('0x17')][_0x3162('0x21')]({'raw':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['where']||null:null,'attributes':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['attributes']||null:null,'include':_0xf11765['options']?_0xf11765[_0x3162('0x19')]['include']?_[_0x3162('0x1e')](_0xf11765[_0x3162('0x19')][_0x3162('0x1d')],function(_0x551442){return{'model':db[_0x551442['model']],'as':_0x551442['as'],'attributes':_0x551442[_0x3162('0x20')],'include':_0x551442[_0x3162('0x1d')]?_['map'](_0x551442[_0x3162('0x1d')],function(_0x4d4f74){return{'model':db[_0x4d4f74[_0x3162('0x1f')]],'as':_0x4d4f74['as'],'attributes':_0x4d4f74[_0x3162('0x20')],'include':_0x4d4f74[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x4d4f74[_0x3162('0x1d')],function(_0x3b6c91){return{'model':db[_0x3b6c91[_0x3162('0x1f')]],'as':_0x3b6c91['as'],'attributes':_0x3b6c91[_0x3162('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3162('0xa')](function(_0x16c5d6){logger[_0x3162('0xb')]('ShowFreshsalesAccount',_0xf11765);logger[_0x3162('0xc')](_0x3162('0x22'),_0xf11765,JSON[_0x3162('0xf')](_0x16c5d6));_0x41e933(_0x16c5d6);})['catch'](function(_0x59759d){logger[_0x3162('0x10')](_0x3162('0x22'),_0x59759d[_0x3162('0x13')],_0xf11765);_0x221b38(_0x3a188e[_0x3162('0x10')](0x1f4,_0x59759d['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 264dad4..69983df 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 _0x9e21=['getFields','post','create','put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','getSubjects','getDescriptions','/:id/fields'];(function(_0x4ceb9e,_0x266071){var _0x5c96ed=function(_0x196c5e){while(--_0x196c5e){_0x4ceb9e['push'](_0x4ceb9e['shift']());}};_0x5c96ed(++_0x266071);}(_0x9e21,0x1ab));var _0x19e2=function(_0x4d7aaf,_0xb955da){_0x4d7aaf=_0x4d7aaf-0x0;var _0x33fb7b=_0x9e21[_0x4d7aaf];return _0x33fb7b;};'use strict';var multer=require('multer');var util=require(_0x19e2('0x0'));var path=require('path');var timeout=require(_0x19e2('0x1'));var express=require(_0x19e2('0x2'));var router=express[_0x19e2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x19e2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x19e2('0x5'));var controller=require(_0x19e2('0x6'));router[_0x19e2('0x7')]('/',auth['isAuthenticated'](),controller[_0x19e2('0x8')]);router[_0x19e2('0x7')](_0x19e2('0x9'),auth[_0x19e2('0xa')](),controller['show']);router[_0x19e2('0x7')]('/:id/subjects',auth[_0x19e2('0xa')](),controller[_0x19e2('0xb')]);router[_0x19e2('0x7')]('/:id/descriptions',auth[_0x19e2('0xa')](),controller[_0x19e2('0xc')]);router['get'](_0x19e2('0xd'),auth[_0x19e2('0xa')](),controller[_0x19e2('0xe')]);router[_0x19e2('0xf')]('/',auth[_0x19e2('0xa')](),controller[_0x19e2('0x10')]);router[_0x19e2('0x11')]('/:id',auth[_0x19e2('0xa')](),controller[_0x19e2('0x12')]);router[_0x19e2('0x13')](_0x19e2('0x9'),auth[_0x19e2('0xa')](),controller['destroy']);module[_0x19e2('0x14')]=router; \ No newline at end of file +var _0x4258=['destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','create','put','update','delete'];(function(_0x444a70,_0x95d3d1){var _0x583249=function(_0x4cc306){while(--_0x4cc306){_0x444a70['push'](_0x444a70['shift']());}};_0x583249(++_0x95d3d1);}(_0x4258,0xfc));var _0x8425=function(_0x1bc0ce,_0x4dc2da){_0x1bc0ce=_0x1bc0ce-0x0;var _0x5bdac3=_0x4258[_0x1bc0ce];return _0x5bdac3;};'use strict';var multer=require(_0x8425('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8425('0x1'));var express=require(_0x8425('0x2'));var router=express[_0x8425('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8425('0x4'));var interaction=require(_0x8425('0x5'));var config=require(_0x8425('0x6'));var controller=require(_0x8425('0x7'));router[_0x8425('0x8')]('/',auth[_0x8425('0x9')](),controller[_0x8425('0xa')]);router[_0x8425('0x8')](_0x8425('0xb'),auth[_0x8425('0x9')](),controller[_0x8425('0xc')]);router[_0x8425('0x8')](_0x8425('0xd'),auth[_0x8425('0x9')](),controller[_0x8425('0xe')]);router[_0x8425('0x8')](_0x8425('0xf'),auth['isAuthenticated'](),controller[_0x8425('0x10')]);router['get'](_0x8425('0x11'),auth[_0x8425('0x9')](),controller[_0x8425('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8425('0x13')]);router[_0x8425('0x14')]('/:id',auth[_0x8425('0x9')](),controller[_0x8425('0x15')]);router[_0x8425('0x16')]('/:id',auth[_0x8425('0x9')](),controller[_0x8425('0x17')]);module[_0x8425('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 666cadb..93d66cf 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 _0x2a00=['STRING','sequelize'];(function(_0x533228,_0x21356e){var _0xf2792b=function(_0x223bfb){while(--_0x223bfb){_0x533228['push'](_0x533228['shift']());}};_0xf2792b(++_0x21356e);}(_0x2a00,0x12b));var _0x02a0=function(_0x3a5c68,_0x2e2c7b){_0x3a5c68=_0x3a5c68-0x0;var _0x127add=_0x2a00[_0x3a5c68];return _0x127add;};'use strict';var Sequelize=require(_0x02a0('0x0'));module['exports']={'name':{'type':Sequelize[_0x02a0('0x1')]},'description':{'type':Sequelize[_0x02a0('0x1')]}}; \ No newline at end of file +var _0x3fa6=['exports','STRING','sequelize'];(function(_0x19dc2d,_0x2b4a8b){var _0x145a78=function(_0x3385db){while(--_0x3385db){_0x19dc2d['push'](_0x19dc2d['shift']());}};_0x145a78(++_0x2b4a8b);}(_0x3fa6,0x1be));var _0x63fa=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x3fa6[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0x63fa('0x0'));module[_0x63fa('0x1')]={'name':{'type':Sequelize[_0x63fa('0x2')]},'description':{'type':Sequelize[_0x63fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index a456eaf..b5106b6 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 _0xc076=['save','then','destroy','sendStatus','error','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','update','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0xc076,0x120));var _0x6c07=function(_0x4bd62e,_0x56410c){_0x4bd62e=_0x4bd62e-0x0;var _0x59bc59=_0xc076[_0x4bd62e];return _0x59bc59;};'use strict';var emlformat=require(_0x6c07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c07('0x1'));var jsonpatch=require(_0x6c07('0x2'));var rp=require(_0x6c07('0x3'));var moment=require(_0x6c07('0x4'));var BPromise=require(_0x6c07('0x5'));var Mustache=require(_0x6c07('0x6'));var util=require(_0x6c07('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6c07('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c07('0x9'));var squel=require('squel');var crypto=require(_0x6c07('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x6c07('0xb'));var toCsv=require(_0x6c07('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6c07('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6c07('0xd'));var hardwareService=require(_0x6c07('0xe'));var logger=require(_0x6c07('0xf'))(_0x6c07('0x10'));var utils=require(_0x6c07('0x11'));var config=require(_0x6c07('0x12'));var licenseUtil=require(_0x6c07('0x13'));var db=require(_0x6c07('0x14'))['db'];function respondWithStatusCode(_0x3e1bf9,_0x19d4ce){_0x19d4ce=_0x19d4ce||0xcc;return function(_0x55ff97){if(_0x55ff97){return _0x3e1bf9['sendStatus'](_0x19d4ce);}return _0x3e1bf9[_0x6c07('0x15')](_0x19d4ce)[_0x6c07('0x16')]();};}function respondWithResult(_0x4628f8,_0x56d2d5){_0x56d2d5=_0x56d2d5||0xc8;return function(_0x575197){if(_0x575197){return _0x4628f8[_0x6c07('0x15')](_0x56d2d5)['json'](_0x575197);}};}function respondWithFilteredResult(_0x1224ff,_0x2372e1){return function(_0x33e214){if(_0x33e214){var _0x338c6d=typeof _0x2372e1[_0x6c07('0x17')]===_0x6c07('0x18')&&typeof _0x2372e1[_0x6c07('0x19')]===_0x6c07('0x18');var _0x1660e3=_0x33e214['count'];var _0x1d34b9=_0x338c6d?0x0:_0x2372e1[_0x6c07('0x17')];var _0x5bfc7d=_0x338c6d?_0x33e214[_0x6c07('0x1a')]:_0x2372e1[_0x6c07('0x17')]+_0x2372e1['limit'];var _0x147b55;if(_0x5bfc7d>=_0x1660e3){_0x5bfc7d=_0x1660e3;_0x147b55=0xc8;}else{_0x147b55=0xce;}_0x1224ff[_0x6c07('0x15')](_0x147b55);return _0x1224ff[_0x6c07('0x1b')](_0x6c07('0x1c'),_0x1d34b9+'-'+_0x5bfc7d+'/'+_0x1660e3)[_0x6c07('0x1d')](_0x33e214);}return null;};}function patchUpdates(_0x6c6751){return function(_0x31758b){try{jsonpatch[_0x6c07('0x1e')](_0x31758b,_0x6c6751,!![]);}catch(_0x178912){return BPromise[_0x6c07('0x1f')](_0x178912);}return _0x31758b[_0x6c07('0x20')]();};}function saveUpdates(_0x5e5093,_0x1a5445){return function(_0x2b973e){if(_0x2b973e){return _0x2b973e['update'](_0x5e5093)[_0x6c07('0x21')](function(_0x48f6e7){return _0x48f6e7;});}return null;};}function removeEntity(_0x1e3c8a,_0x2efd6c){return function(_0x259687){if(_0x259687){return _0x259687[_0x6c07('0x22')]()['then'](function(){_0x1e3c8a[_0x6c07('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x586c0f,_0x2f243d){return function(_0x4ac4ac){if(!_0x4ac4ac){_0x586c0f[_0x6c07('0x23')](0x194);}return _0x4ac4ac;};}function handleError(_0x5082ec,_0x3edf03){_0x3edf03=_0x3edf03||0x1f4;return function(_0x3aa655){logger[_0x6c07('0x24')](_0x3aa655[_0x6c07('0x25')]);if(_0x3aa655[_0x6c07('0x26')]){delete _0x3aa655[_0x6c07('0x26')];}_0x5082ec[_0x6c07('0x15')](_0x3edf03)['send'](_0x3aa655);};}exports[_0x6c07('0x27')]=function(_0x11183b,_0x194a4d){var _0x1f93e2={},_0x3be52b={},_0x27dabc={'count':0x0,'rows':[]};var _0x2d3064=_[_0x6c07('0x28')](db[_0x6c07('0x29')][_0x6c07('0x2a')],function(_0x49cc53){return{'name':_0x49cc53[_0x6c07('0x2b')],'type':_0x49cc53['type'][_0x6c07('0x2c')]};});_0x3be52b[_0x6c07('0x2d')]=_[_0x6c07('0x28')](_0x2d3064,_0x6c07('0x26'));_0x3be52b['query']=_['keys'](_0x11183b[_0x6c07('0x2e')]);_0x3be52b[_0x6c07('0x2f')]=_['intersection'](_0x3be52b[_0x6c07('0x2d')],_0x3be52b['query']);_0x1f93e2['attributes']=_[_0x6c07('0x30')](_0x3be52b['model'],qs[_0x6c07('0x31')](_0x11183b[_0x6c07('0x2e')][_0x6c07('0x31')]));_0x1f93e2[_0x6c07('0x32')]=_0x1f93e2[_0x6c07('0x32')][_0x6c07('0x33')]?_0x1f93e2[_0x6c07('0x32')]:_0x3be52b[_0x6c07('0x2d')];if(!_0x11183b['query'][_0x6c07('0x34')](_0x6c07('0x35'))){_0x1f93e2[_0x6c07('0x19')]=qs['limit'](_0x11183b['query']['limit']);_0x1f93e2[_0x6c07('0x17')]=qs[_0x6c07('0x17')](_0x11183b[_0x6c07('0x2e')][_0x6c07('0x17')]);}_0x1f93e2[_0x6c07('0x36')]=qs[_0x6c07('0x37')](_0x11183b[_0x6c07('0x2e')]['sort']);_0x1f93e2[_0x6c07('0x38')]=qs[_0x6c07('0x2f')](_[_0x6c07('0x39')](_0x11183b['query'],_0x3be52b[_0x6c07('0x2f')]),_0x2d3064);if(_0x11183b[_0x6c07('0x2e')][_0x6c07('0x3a')]){_0x1f93e2[_0x6c07('0x38')]=_[_0x6c07('0x3b')](_0x1f93e2['where'],{'$or':_['map'](_0x2d3064,function(_0x13a883){if(_0x13a883[_0x6c07('0x3c')]!==_0x6c07('0x3d')){var _0x4ddc9f={};_0x4ddc9f[_0x13a883[_0x6c07('0x26')]]={'$like':'%'+_0x11183b['query']['filter']+'%'};return _0x4ddc9f;}})});}_0x1f93e2=_[_0x6c07('0x3b')]({},_0x1f93e2,_0x11183b['options']);var _0x3fd3a1={'where':_0x1f93e2[_0x6c07('0x38')]};return db[_0x6c07('0x29')]['count'](_0x3fd3a1)[_0x6c07('0x21')](function(_0x35fd04){_0x27dabc['count']=_0x35fd04;if(_0x11183b[_0x6c07('0x2e')][_0x6c07('0x3e')]){_0x1f93e2[_0x6c07('0x3f')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x6c07('0x40')](_0x1f93e2);})[_0x6c07('0x21')](function(_0x1ee6f7){_0x27dabc[_0x6c07('0x41')]=_0x1ee6f7;return _0x27dabc;})['then'](respondWithFilteredResult(_0x194a4d,_0x1f93e2))[_0x6c07('0x42')](handleError(_0x194a4d,null));};exports[_0x6c07('0x43')]=function(_0x5461f9,_0x387649){var _0x2d0bec={'raw':![],'where':{'id':_0x5461f9[_0x6c07('0x44')]['id']}},_0x18c22c={};_0x18c22c[_0x6c07('0x2d')]=_['keys'](db[_0x6c07('0x29')]['rawAttributes']);_0x18c22c[_0x6c07('0x2e')]=_[_0x6c07('0x45')](_0x5461f9[_0x6c07('0x2e')]);_0x18c22c['filters']=_[_0x6c07('0x30')](_0x18c22c[_0x6c07('0x2d')],_0x18c22c[_0x6c07('0x2e')]);_0x2d0bec[_0x6c07('0x32')]=_[_0x6c07('0x30')](_0x18c22c['model'],qs[_0x6c07('0x31')](_0x5461f9[_0x6c07('0x2e')]['fields']));_0x2d0bec[_0x6c07('0x32')]=_0x2d0bec[_0x6c07('0x32')][_0x6c07('0x33')]?_0x2d0bec[_0x6c07('0x32')]:_0x18c22c[_0x6c07('0x2d')];if(_0x5461f9[_0x6c07('0x2e')]['includeAll']){_0x2d0bec['include']=[{'all':!![]}];}_0x2d0bec=_['merge']({},_0x2d0bec,_0x5461f9[_0x6c07('0x46')]);return db[_0x6c07('0x29')][_0x6c07('0x47')](_0x2d0bec)[_0x6c07('0x21')](handleEntityNotFound(_0x387649,null))[_0x6c07('0x21')](respondWithResult(_0x387649,null))[_0x6c07('0x42')](handleError(_0x387649,null));};exports[_0x6c07('0x48')]=function(_0x34f5b5,_0xde5abf){return db[_0x6c07('0x29')][_0x6c07('0x48')](_0x34f5b5[_0x6c07('0x49')],{})[_0x6c07('0x21')](respondWithResult(_0xde5abf,0xc9))['catch'](handleError(_0xde5abf,null));};exports[_0x6c07('0x4a')]=function(_0x33f494,_0x3497d2){if(_0x33f494[_0x6c07('0x49')]['id']){delete _0x33f494[_0x6c07('0x49')]['id'];}return db['FreshsalesConfiguration'][_0x6c07('0x47')]({'where':{'id':_0x33f494[_0x6c07('0x44')]['id']}})[_0x6c07('0x21')](handleEntityNotFound(_0x3497d2,null))[_0x6c07('0x21')](saveUpdates(_0x33f494[_0x6c07('0x49')],null))['then'](respondWithResult(_0x3497d2,null))[_0x6c07('0x42')](handleError(_0x3497d2,null));};exports[_0x6c07('0x22')]=function(_0x3275a6,_0x19cae5){return db[_0x6c07('0x29')]['find']({'where':{'id':_0x3275a6[_0x6c07('0x44')]['id']}})[_0x6c07('0x21')](handleEntityNotFound(_0x19cae5,null))[_0x6c07('0x21')](removeEntity(_0x19cae5,null))[_0x6c07('0x42')](handleError(_0x19cae5,null));};exports[_0x6c07('0x4b')]=function(_0x4f5a3d,_0x98774d,_0x140b6e){var _0x2bff43={};var _0x428ddd={};var _0x422423;var _0x718c6b;return db[_0x6c07('0x29')][_0x6c07('0x4c')]({'where':{'id':_0x4f5a3d['params']['id']}})[_0x6c07('0x21')](handleEntityNotFound(_0x98774d,null))['then'](function(_0x146897){if(_0x146897){_0x422423=_0x146897;_0x428ddd[_0x6c07('0x2d')]=_[_0x6c07('0x45')](db[_0x6c07('0x4d')][_0x6c07('0x2a')]);_0x428ddd[_0x6c07('0x2e')]=_[_0x6c07('0x45')](_0x4f5a3d['query']);_0x428ddd[_0x6c07('0x2f')]=_[_0x6c07('0x30')](_0x428ddd['model'],_0x428ddd[_0x6c07('0x2e')]);_0x2bff43[_0x6c07('0x32')]=_[_0x6c07('0x30')](_0x428ddd[_0x6c07('0x2d')],qs[_0x6c07('0x31')](_0x4f5a3d[_0x6c07('0x2e')][_0x6c07('0x31')]));_0x2bff43[_0x6c07('0x32')]=_0x2bff43[_0x6c07('0x32')]['length']?_0x2bff43[_0x6c07('0x32')]:_0x428ddd[_0x6c07('0x2d')];_0x2bff43[_0x6c07('0x36')]=qs[_0x6c07('0x37')](_0x4f5a3d['query'][_0x6c07('0x37')]);_0x2bff43[_0x6c07('0x38')]=qs[_0x6c07('0x2f')](_['pick'](_0x4f5a3d[_0x6c07('0x2e')],_0x428ddd[_0x6c07('0x2f')]));if(_0x4f5a3d['query'][_0x6c07('0x3a')]){_0x2bff43['where']=_[_0x6c07('0x3b')](_0x2bff43[_0x6c07('0x38')],{'$or':_[_0x6c07('0x28')](_0x2bff43['attributes'],function(_0x2b3d46){var _0x29188f={};_0x29188f[_0x2b3d46]={'$like':'%'+_0x4f5a3d[_0x6c07('0x2e')]['filter']+'%'};return _0x29188f;})});}_0x2bff43=_[_0x6c07('0x3b')]({},_0x2bff43,_0x4f5a3d['options']);return _0x422423[_0x6c07('0x4b')](_0x2bff43);}})['then'](function(_0x4179da){if(_0x4179da){_0x718c6b=_0x4179da[_0x6c07('0x33')];if(!_0x4f5a3d['query'][_0x6c07('0x34')]('nolimit')){_0x2bff43[_0x6c07('0x19')]=qs[_0x6c07('0x19')](_0x4f5a3d['query'][_0x6c07('0x19')]);_0x2bff43[_0x6c07('0x17')]=qs['offset'](_0x4f5a3d[_0x6c07('0x2e')][_0x6c07('0x17')]);}return _0x422423[_0x6c07('0x4b')](_0x2bff43);}})['then'](function(_0x2ce531){if(_0x2ce531){return _0x2ce531?{'count':_0x718c6b,'rows':_0x2ce531}:null;}})[_0x6c07('0x21')](respondWithResult(_0x98774d,null))[_0x6c07('0x42')](handleError(_0x98774d,null));};exports[_0x6c07('0x4e')]=function(_0x47597a,_0x170653,_0x224956){var _0x3eaa45={};var _0x3b2b08={};var _0x34a100;var _0x328213;return db[_0x6c07('0x29')]['findOne']({'where':{'id':_0x47597a[_0x6c07('0x44')]['id']}})[_0x6c07('0x21')](handleEntityNotFound(_0x170653,null))[_0x6c07('0x21')](function(_0x132977){if(_0x132977){_0x34a100=_0x132977;_0x3b2b08[_0x6c07('0x2d')]=_[_0x6c07('0x45')](db[_0x6c07('0x4d')]['rawAttributes']);_0x3b2b08[_0x6c07('0x2e')]=_[_0x6c07('0x45')](_0x47597a[_0x6c07('0x2e')]);_0x3b2b08[_0x6c07('0x2f')]=_['intersection'](_0x3b2b08['model'],_0x3b2b08[_0x6c07('0x2e')]);_0x3eaa45['attributes']=_['intersection'](_0x3b2b08[_0x6c07('0x2d')],qs[_0x6c07('0x31')](_0x47597a['query'][_0x6c07('0x31')]));_0x3eaa45[_0x6c07('0x32')]=_0x3eaa45['attributes'][_0x6c07('0x33')]?_0x3eaa45[_0x6c07('0x32')]:_0x3b2b08[_0x6c07('0x2d')];_0x3eaa45[_0x6c07('0x36')]=qs[_0x6c07('0x37')](_0x47597a[_0x6c07('0x2e')][_0x6c07('0x37')]);_0x3eaa45[_0x6c07('0x38')]=qs[_0x6c07('0x2f')](_['pick'](_0x47597a[_0x6c07('0x2e')],_0x3b2b08['filters']));if(_0x47597a[_0x6c07('0x2e')][_0x6c07('0x3a')]){_0x3eaa45[_0x6c07('0x38')]=_[_0x6c07('0x3b')](_0x3eaa45[_0x6c07('0x38')],{'$or':_[_0x6c07('0x28')](_0x3eaa45[_0x6c07('0x32')],function(_0x25a609){var _0x397da5={};_0x397da5[_0x25a609]={'$like':'%'+_0x47597a['query'][_0x6c07('0x3a')]+'%'};return _0x397da5;})});}_0x3eaa45=_[_0x6c07('0x3b')]({},_0x3eaa45,_0x47597a[_0x6c07('0x46')]);return _0x34a100[_0x6c07('0x4e')](_0x3eaa45);}})['then'](function(_0x395abb){if(_0x395abb){_0x328213=_0x395abb[_0x6c07('0x33')];if(!_0x47597a['query']['hasOwnProperty'](_0x6c07('0x35'))){_0x3eaa45['limit']=qs['limit'](_0x47597a[_0x6c07('0x2e')][_0x6c07('0x19')]);_0x3eaa45['offset']=qs[_0x6c07('0x17')](_0x47597a['query'][_0x6c07('0x17')]);}return _0x34a100[_0x6c07('0x4e')](_0x3eaa45);}})[_0x6c07('0x21')](function(_0x56e123){if(_0x56e123){return _0x56e123?{'count':_0x328213,'rows':_0x56e123}:null;}})[_0x6c07('0x21')](respondWithResult(_0x170653,null))[_0x6c07('0x42')](handleError(_0x170653,null));};exports[_0x6c07('0x4f')]=function(_0x2efffc,_0x36ece6,_0x283a38){var _0x3358bb={};var _0x44fcc4={};var _0x32c6e0;var _0x41903c;return db[_0x6c07('0x29')][_0x6c07('0x4c')]({'where':{'id':_0x2efffc[_0x6c07('0x44')]['id']}})[_0x6c07('0x21')](handleEntityNotFound(_0x36ece6,null))['then'](function(_0x165ea1){if(_0x165ea1){_0x32c6e0=_0x165ea1;_0x44fcc4[_0x6c07('0x2d')]=_[_0x6c07('0x45')](db[_0x6c07('0x4d')][_0x6c07('0x2a')]);_0x44fcc4[_0x6c07('0x2e')]=_[_0x6c07('0x45')](_0x2efffc['query']);_0x44fcc4[_0x6c07('0x2f')]=_[_0x6c07('0x30')](_0x44fcc4[_0x6c07('0x2d')],_0x44fcc4[_0x6c07('0x2e')]);_0x3358bb[_0x6c07('0x32')]=_[_0x6c07('0x30')](_0x44fcc4[_0x6c07('0x2d')],qs[_0x6c07('0x31')](_0x2efffc[_0x6c07('0x2e')][_0x6c07('0x31')]));_0x3358bb[_0x6c07('0x32')]=_0x3358bb['attributes'][_0x6c07('0x33')]?_0x3358bb[_0x6c07('0x32')]:_0x44fcc4[_0x6c07('0x2d')];_0x3358bb[_0x6c07('0x36')]=qs[_0x6c07('0x37')](_0x2efffc[_0x6c07('0x2e')][_0x6c07('0x37')]);_0x3358bb[_0x6c07('0x38')]=qs[_0x6c07('0x2f')](_['pick'](_0x2efffc[_0x6c07('0x2e')],_0x44fcc4[_0x6c07('0x2f')]));if(_0x2efffc[_0x6c07('0x2e')]['filter']){_0x3358bb['where']=_[_0x6c07('0x3b')](_0x3358bb[_0x6c07('0x38')],{'$or':_['map'](_0x3358bb['attributes'],function(_0x47bc8a){var _0x5be936={};_0x5be936[_0x47bc8a]={'$like':'%'+_0x2efffc[_0x6c07('0x2e')][_0x6c07('0x3a')]+'%'};return _0x5be936;})});}_0x3358bb=_[_0x6c07('0x3b')]({},_0x3358bb,_0x2efffc[_0x6c07('0x46')]);return _0x32c6e0['getFields'](_0x3358bb);}})['then'](function(_0x4a471b){if(_0x4a471b){_0x41903c=_0x4a471b[_0x6c07('0x33')];if(!_0x2efffc[_0x6c07('0x2e')]['hasOwnProperty'](_0x6c07('0x35'))){_0x3358bb[_0x6c07('0x19')]=qs[_0x6c07('0x19')](_0x2efffc[_0x6c07('0x2e')][_0x6c07('0x19')]);_0x3358bb[_0x6c07('0x17')]=qs[_0x6c07('0x17')](_0x2efffc[_0x6c07('0x2e')]['offset']);}return _0x32c6e0[_0x6c07('0x4f')](_0x3358bb);}})[_0x6c07('0x21')](function(_0x4d44ad){if(_0x4d44ad){return _0x4d44ad?{'count':_0x41903c,'rows':_0x4d44ad}:null;}})[_0x6c07('0x21')](respondWithResult(_0x36ece6,null))[_0x6c07('0x42')](handleError(_0x36ece6,null));}; \ No newline at end of file +var _0xc43f=['sort','where','pick','filter','includeAll','include','show','params','keys','merge','options','create','body','catch','update','find','findOne','getSubjects','hasOwnProperty','nolimit','FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','offset','limit','undefined','count','set','apply','reject','save','then','destroy','stack','name','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','order'];(function(_0x94ad71,_0x2bbe40){var _0x1b869e=function(_0x199f22){while(--_0x199f22){_0x94ad71['push'](_0x94ad71['shift']());}};_0x1b869e(++_0x2bbe40);}(_0xc43f,0x147));var _0xfc43=function(_0x225b71,_0x44be24){_0x225b71=_0x225b71-0x0;var _0x3bdbf7=_0xc43f[_0x225b71];return _0x3bdbf7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc43('0x0'));var zipdir=require(_0xfc43('0x1'));var jsonpatch=require(_0xfc43('0x2'));var rp=require(_0xfc43('0x3'));var moment=require(_0xfc43('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfc43('0x5'));var sox=require('sox');var csv=require(_0xfc43('0x6'));var ejs=require(_0xfc43('0x7'));var fs=require('fs');var fs_extra=require(_0xfc43('0x8'));var _=require(_0xfc43('0x9'));var squel=require(_0xfc43('0xa'));var crypto=require(_0xfc43('0xb'));var jsforce=require(_0xfc43('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xfc43('0x6'));var querystring=require(_0xfc43('0xd'));var Papa=require(_0xfc43('0xe'));var Redis=require(_0xfc43('0xf'));var authService=require(_0xfc43('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfc43('0x11'));var hardwareService=require(_0xfc43('0x12'));var logger=require(_0xfc43('0x13'))(_0xfc43('0x14'));var utils=require('../../config/utils');var config=require(_0xfc43('0x15'));var licenseUtil=require(_0xfc43('0x16'));var db=require(_0xfc43('0x17'))['db'];function respondWithStatusCode(_0x80d6de,_0x1e18a4){_0x1e18a4=_0x1e18a4||0xcc;return function(_0x311459){if(_0x311459){return _0x80d6de[_0xfc43('0x18')](_0x1e18a4);}return _0x80d6de[_0xfc43('0x19')](_0x1e18a4)[_0xfc43('0x1a')]();};}function respondWithResult(_0x475eb8,_0x59ca1e){_0x59ca1e=_0x59ca1e||0xc8;return function(_0x261095){if(_0x261095){return _0x475eb8['status'](_0x59ca1e)[_0xfc43('0x1b')](_0x261095);}};}function respondWithFilteredResult(_0x2eb695,_0x1df31f){return function(_0x11093e){if(_0x11093e){var _0x5bdb94=typeof _0x1df31f[_0xfc43('0x1c')]==='undefined'&&typeof _0x1df31f[_0xfc43('0x1d')]===_0xfc43('0x1e');var _0x519b02=_0x11093e[_0xfc43('0x1f')];var _0x23b554=_0x5bdb94?0x0:_0x1df31f['offset'];var _0x18490a=_0x5bdb94?_0x11093e[_0xfc43('0x1f')]:_0x1df31f[_0xfc43('0x1c')]+_0x1df31f[_0xfc43('0x1d')];var _0x35562a;if(_0x18490a>=_0x519b02){_0x18490a=_0x519b02;_0x35562a=0xc8;}else{_0x35562a=0xce;}_0x2eb695['status'](_0x35562a);return _0x2eb695[_0xfc43('0x20')]('Content-Range',_0x23b554+'-'+_0x18490a+'/'+_0x519b02)[_0xfc43('0x1b')](_0x11093e);}return null;};}function patchUpdates(_0x3d3dd8){return function(_0x256e03){try{jsonpatch[_0xfc43('0x21')](_0x256e03,_0x3d3dd8,!![]);}catch(_0x15b470){return BPromise[_0xfc43('0x22')](_0x15b470);}return _0x256e03[_0xfc43('0x23')]();};}function saveUpdates(_0x2ed359,_0x3e2188){return function(_0x3f25ca){if(_0x3f25ca){return _0x3f25ca['update'](_0x2ed359)[_0xfc43('0x24')](function(_0x4efa1f){return _0x4efa1f;});}return null;};}function removeEntity(_0x4cfc90,_0x314eaf){return function(_0x284773){if(_0x284773){return _0x284773[_0xfc43('0x25')]()[_0xfc43('0x24')](function(){_0x4cfc90[_0xfc43('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d6b0,_0x494a12){return function(_0x2712a6){if(!_0x2712a6){_0x51d6b0[_0xfc43('0x18')](0x194);}return _0x2712a6;};}function handleError(_0x3d5827,_0x5e6acc){_0x5e6acc=_0x5e6acc||0x1f4;return function(_0x255409){logger['error'](_0x255409[_0xfc43('0x26')]);if(_0x255409['name']){delete _0x255409[_0xfc43('0x27')];}_0x3d5827[_0xfc43('0x19')](_0x5e6acc)['send'](_0x255409);};}exports['index']=function(_0x11cc39,_0x1be80d){var _0x5b2f42={},_0x5d1424={},_0x592e1c={'count':0x0,'rows':[]};var _0x5399f8=_[_0xfc43('0x28')](db[_0xfc43('0x29')][_0xfc43('0x2a')],function(_0x500846){return{'name':_0x500846[_0xfc43('0x2b')],'type':_0x500846['type'][_0xfc43('0x2c')]};});_0x5d1424[_0xfc43('0x2d')]=_[_0xfc43('0x28')](_0x5399f8,'name');_0x5d1424[_0xfc43('0x2e')]=_['keys'](_0x11cc39[_0xfc43('0x2e')]);_0x5d1424[_0xfc43('0x2f')]=_[_0xfc43('0x30')](_0x5d1424[_0xfc43('0x2d')],_0x5d1424['query']);_0x5b2f42[_0xfc43('0x31')]=_[_0xfc43('0x30')](_0x5d1424[_0xfc43('0x2d')],qs[_0xfc43('0x32')](_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x32')]));_0x5b2f42[_0xfc43('0x31')]=_0x5b2f42[_0xfc43('0x31')][_0xfc43('0x33')]?_0x5b2f42['attributes']:_0x5d1424['model'];if(!_0x11cc39[_0xfc43('0x2e')]['hasOwnProperty']('nolimit')){_0x5b2f42['limit']=qs[_0xfc43('0x1d')](_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x1d')]);_0x5b2f42[_0xfc43('0x1c')]=qs[_0xfc43('0x1c')](_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x1c')]);}_0x5b2f42[_0xfc43('0x34')]=qs[_0xfc43('0x35')](_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x35')]);_0x5b2f42[_0xfc43('0x36')]=qs[_0xfc43('0x2f')](_[_0xfc43('0x37')](_0x11cc39[_0xfc43('0x2e')],_0x5d1424[_0xfc43('0x2f')]),_0x5399f8);if(_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x38')]){_0x5b2f42[_0xfc43('0x36')]=_['merge'](_0x5b2f42[_0xfc43('0x36')],{'$or':_[_0xfc43('0x28')](_0x5399f8,function(_0x2088b9){if(_0x2088b9['type']!=='VIRTUAL'){var _0x5ecaf0={};_0x5ecaf0[_0x2088b9[_0xfc43('0x27')]]={'$like':'%'+_0x11cc39['query']['filter']+'%'};return _0x5ecaf0;}})});}_0x5b2f42=_['merge']({},_0x5b2f42,_0x11cc39['options']);var _0x4f74f0={'where':_0x5b2f42[_0xfc43('0x36')]};return db[_0xfc43('0x29')][_0xfc43('0x1f')](_0x4f74f0)[_0xfc43('0x24')](function(_0x1c4369){_0x592e1c['count']=_0x1c4369;if(_0x11cc39[_0xfc43('0x2e')][_0xfc43('0x39')]){_0x5b2f42[_0xfc43('0x3a')]=[{'all':!![]}];}return db[_0xfc43('0x29')]['findAll'](_0x5b2f42);})[_0xfc43('0x24')](function(_0x17669e){_0x592e1c['rows']=_0x17669e;return _0x592e1c;})['then'](respondWithFilteredResult(_0x1be80d,_0x5b2f42))['catch'](handleError(_0x1be80d,null));};exports[_0xfc43('0x3b')]=function(_0x24acd4,_0x3c0ec3){var _0x124802={'raw':![],'where':{'id':_0x24acd4[_0xfc43('0x3c')]['id']}},_0x4035de={};_0x4035de[_0xfc43('0x2d')]=_[_0xfc43('0x3d')](db[_0xfc43('0x29')]['rawAttributes']);_0x4035de[_0xfc43('0x2e')]=_[_0xfc43('0x3d')](_0x24acd4[_0xfc43('0x2e')]);_0x4035de['filters']=_[_0xfc43('0x30')](_0x4035de[_0xfc43('0x2d')],_0x4035de[_0xfc43('0x2e')]);_0x124802[_0xfc43('0x31')]=_[_0xfc43('0x30')](_0x4035de[_0xfc43('0x2d')],qs['fields'](_0x24acd4[_0xfc43('0x2e')][_0xfc43('0x32')]));_0x124802['attributes']=_0x124802['attributes'][_0xfc43('0x33')]?_0x124802[_0xfc43('0x31')]:_0x4035de[_0xfc43('0x2d')];if(_0x24acd4[_0xfc43('0x2e')]['includeAll']){_0x124802[_0xfc43('0x3a')]=[{'all':!![]}];}_0x124802=_[_0xfc43('0x3e')]({},_0x124802,_0x24acd4[_0xfc43('0x3f')]);return db['FreshsalesConfiguration']['find'](_0x124802)[_0xfc43('0x24')](handleEntityNotFound(_0x3c0ec3,null))[_0xfc43('0x24')](respondWithResult(_0x3c0ec3,null))['catch'](handleError(_0x3c0ec3,null));};exports[_0xfc43('0x40')]=function(_0xd283d6,_0x13a9eb){return db[_0xfc43('0x29')][_0xfc43('0x40')](_0xd283d6[_0xfc43('0x41')],{})['then'](respondWithResult(_0x13a9eb,0xc9))[_0xfc43('0x42')](handleError(_0x13a9eb,null));};exports[_0xfc43('0x43')]=function(_0x511614,_0x1139c0){if(_0x511614[_0xfc43('0x41')]['id']){delete _0x511614[_0xfc43('0x41')]['id'];}return db['FreshsalesConfiguration'][_0xfc43('0x44')]({'where':{'id':_0x511614[_0xfc43('0x3c')]['id']}})[_0xfc43('0x24')](handleEntityNotFound(_0x1139c0,null))[_0xfc43('0x24')](saveUpdates(_0x511614[_0xfc43('0x41')],null))[_0xfc43('0x24')](respondWithResult(_0x1139c0,null))[_0xfc43('0x42')](handleError(_0x1139c0,null));};exports[_0xfc43('0x25')]=function(_0x20868d,_0x3524a8){return db['FreshsalesConfiguration'][_0xfc43('0x44')]({'where':{'id':_0x20868d[_0xfc43('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3524a8,null))['then'](removeEntity(_0x3524a8,null))[_0xfc43('0x42')](handleError(_0x3524a8,null));};exports['getSubjects']=function(_0x4d68ba,_0x24d541,_0x1a86f8){var _0x44491e={};var _0x57fc0d={};var _0x1f0767;var _0x58bda0;return db[_0xfc43('0x29')][_0xfc43('0x45')]({'where':{'id':_0x4d68ba[_0xfc43('0x3c')]['id']}})[_0xfc43('0x24')](handleEntityNotFound(_0x24d541,null))[_0xfc43('0x24')](function(_0x1ab35b){if(_0x1ab35b){_0x1f0767=_0x1ab35b;_0x57fc0d['model']=_[_0xfc43('0x3d')](db['FreshsalesField'][_0xfc43('0x2a')]);_0x57fc0d[_0xfc43('0x2e')]=_[_0xfc43('0x3d')](_0x4d68ba[_0xfc43('0x2e')]);_0x57fc0d['filters']=_[_0xfc43('0x30')](_0x57fc0d['model'],_0x57fc0d['query']);_0x44491e[_0xfc43('0x31')]=_[_0xfc43('0x30')](_0x57fc0d['model'],qs['fields'](_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x32')]));_0x44491e[_0xfc43('0x31')]=_0x44491e['attributes'][_0xfc43('0x33')]?_0x44491e[_0xfc43('0x31')]:_0x57fc0d['model'];_0x44491e[_0xfc43('0x34')]=qs[_0xfc43('0x35')](_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x35')]);_0x44491e[_0xfc43('0x36')]=qs[_0xfc43('0x2f')](_[_0xfc43('0x37')](_0x4d68ba[_0xfc43('0x2e')],_0x57fc0d[_0xfc43('0x2f')]));if(_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x38')]){_0x44491e[_0xfc43('0x36')]=_[_0xfc43('0x3e')](_0x44491e['where'],{'$or':_[_0xfc43('0x28')](_0x44491e[_0xfc43('0x31')],function(_0x51a0c3){var _0x22bd52={};_0x22bd52[_0x51a0c3]={'$like':'%'+_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x38')]+'%'};return _0x22bd52;})});}_0x44491e=_[_0xfc43('0x3e')]({},_0x44491e,_0x4d68ba[_0xfc43('0x3f')]);return _0x1f0767[_0xfc43('0x46')](_0x44491e);}})[_0xfc43('0x24')](function(_0x5e5f03){if(_0x5e5f03){_0x58bda0=_0x5e5f03['length'];if(!_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x47')](_0xfc43('0x48'))){_0x44491e[_0xfc43('0x1d')]=qs['limit'](_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x1d')]);_0x44491e[_0xfc43('0x1c')]=qs[_0xfc43('0x1c')](_0x4d68ba[_0xfc43('0x2e')][_0xfc43('0x1c')]);}return _0x1f0767[_0xfc43('0x46')](_0x44491e);}})[_0xfc43('0x24')](function(_0x57e045){if(_0x57e045){return _0x57e045?{'count':_0x58bda0,'rows':_0x57e045}:null;}})['then'](respondWithResult(_0x24d541,null))[_0xfc43('0x42')](handleError(_0x24d541,null));};exports['getDescriptions']=function(_0x38ad60,_0x540bdb,_0x55f8ad){var _0x4e3d28={};var _0x59f41d={};var _0x5a7f5;var _0x47f0b4;return db['FreshsalesConfiguration'][_0xfc43('0x45')]({'where':{'id':_0x38ad60[_0xfc43('0x3c')]['id']}})[_0xfc43('0x24')](handleEntityNotFound(_0x540bdb,null))[_0xfc43('0x24')](function(_0x2fda2b){if(_0x2fda2b){_0x5a7f5=_0x2fda2b;_0x59f41d[_0xfc43('0x2d')]=_[_0xfc43('0x3d')](db[_0xfc43('0x49')]['rawAttributes']);_0x59f41d['query']=_[_0xfc43('0x3d')](_0x38ad60[_0xfc43('0x2e')]);_0x59f41d[_0xfc43('0x2f')]=_[_0xfc43('0x30')](_0x59f41d[_0xfc43('0x2d')],_0x59f41d['query']);_0x4e3d28[_0xfc43('0x31')]=_['intersection'](_0x59f41d['model'],qs[_0xfc43('0x32')](_0x38ad60['query'][_0xfc43('0x32')]));_0x4e3d28['attributes']=_0x4e3d28['attributes'][_0xfc43('0x33')]?_0x4e3d28[_0xfc43('0x31')]:_0x59f41d[_0xfc43('0x2d')];_0x4e3d28[_0xfc43('0x34')]=qs[_0xfc43('0x35')](_0x38ad60['query'][_0xfc43('0x35')]);_0x4e3d28[_0xfc43('0x36')]=qs['filters'](_[_0xfc43('0x37')](_0x38ad60[_0xfc43('0x2e')],_0x59f41d[_0xfc43('0x2f')]));if(_0x38ad60[_0xfc43('0x2e')][_0xfc43('0x38')]){_0x4e3d28[_0xfc43('0x36')]=_[_0xfc43('0x3e')](_0x4e3d28[_0xfc43('0x36')],{'$or':_[_0xfc43('0x28')](_0x4e3d28[_0xfc43('0x31')],function(_0x236318){var _0x579e48={};_0x579e48[_0x236318]={'$like':'%'+_0x38ad60[_0xfc43('0x2e')][_0xfc43('0x38')]+'%'};return _0x579e48;})});}_0x4e3d28=_['merge']({},_0x4e3d28,_0x38ad60[_0xfc43('0x3f')]);return _0x5a7f5[_0xfc43('0x4a')](_0x4e3d28);}})['then'](function(_0x55af2d){if(_0x55af2d){_0x47f0b4=_0x55af2d[_0xfc43('0x33')];if(!_0x38ad60['query']['hasOwnProperty'](_0xfc43('0x48'))){_0x4e3d28[_0xfc43('0x1d')]=qs[_0xfc43('0x1d')](_0x38ad60[_0xfc43('0x2e')][_0xfc43('0x1d')]);_0x4e3d28[_0xfc43('0x1c')]=qs[_0xfc43('0x1c')](_0x38ad60['query'][_0xfc43('0x1c')]);}return _0x5a7f5['getDescriptions'](_0x4e3d28);}})[_0xfc43('0x24')](function(_0x3272d3){if(_0x3272d3){return _0x3272d3?{'count':_0x47f0b4,'rows':_0x3272d3}:null;}})[_0xfc43('0x24')](respondWithResult(_0x540bdb,null))[_0xfc43('0x42')](handleError(_0x540bdb,null));};exports['getFields']=function(_0x5ba2ad,_0x237d6f,_0xe910f9){var _0x28519d={};var _0x105099={};var _0x23e230;var _0x154951;return db[_0xfc43('0x29')][_0xfc43('0x45')]({'where':{'id':_0x5ba2ad['params']['id']}})[_0xfc43('0x24')](handleEntityNotFound(_0x237d6f,null))[_0xfc43('0x24')](function(_0x2abdf7){if(_0x2abdf7){_0x23e230=_0x2abdf7;_0x105099[_0xfc43('0x2d')]=_[_0xfc43('0x3d')](db[_0xfc43('0x49')]['rawAttributes']);_0x105099[_0xfc43('0x2e')]=_[_0xfc43('0x3d')](_0x5ba2ad[_0xfc43('0x2e')]);_0x105099[_0xfc43('0x2f')]=_['intersection'](_0x105099[_0xfc43('0x2d')],_0x105099[_0xfc43('0x2e')]);_0x28519d[_0xfc43('0x31')]=_['intersection'](_0x105099[_0xfc43('0x2d')],qs[_0xfc43('0x32')](_0x5ba2ad[_0xfc43('0x2e')][_0xfc43('0x32')]));_0x28519d[_0xfc43('0x31')]=_0x28519d['attributes'][_0xfc43('0x33')]?_0x28519d[_0xfc43('0x31')]:_0x105099[_0xfc43('0x2d')];_0x28519d[_0xfc43('0x34')]=qs['sort'](_0x5ba2ad[_0xfc43('0x2e')][_0xfc43('0x35')]);_0x28519d[_0xfc43('0x36')]=qs[_0xfc43('0x2f')](_['pick'](_0x5ba2ad['query'],_0x105099[_0xfc43('0x2f')]));if(_0x5ba2ad[_0xfc43('0x2e')]['filter']){_0x28519d[_0xfc43('0x36')]=_[_0xfc43('0x3e')](_0x28519d[_0xfc43('0x36')],{'$or':_['map'](_0x28519d[_0xfc43('0x31')],function(_0x45c795){var _0x28e151={};_0x28e151[_0x45c795]={'$like':'%'+_0x5ba2ad[_0xfc43('0x2e')][_0xfc43('0x38')]+'%'};return _0x28e151;})});}_0x28519d=_['merge']({},_0x28519d,_0x5ba2ad[_0xfc43('0x3f')]);return _0x23e230[_0xfc43('0x4b')](_0x28519d);}})[_0xfc43('0x24')](function(_0xfe7e72){if(_0xfe7e72){_0x154951=_0xfe7e72[_0xfc43('0x33')];if(!_0x5ba2ad[_0xfc43('0x2e')]['hasOwnProperty'](_0xfc43('0x48'))){_0x28519d[_0xfc43('0x1d')]=qs['limit'](_0x5ba2ad[_0xfc43('0x2e')][_0xfc43('0x1d')]);_0x28519d['offset']=qs['offset'](_0x5ba2ad[_0xfc43('0x2e')][_0xfc43('0x1c')]);}return _0x23e230[_0xfc43('0x4b')](_0x28519d);}})[_0xfc43('0x24')](function(_0x2c416b){if(_0x2c416b){return _0x2c416b?{'count':_0x154951,'rows':_0x2c416b}:null;}})[_0xfc43('0x24')](respondWithResult(_0x237d6f,null))[_0xfc43('0x42')](handleError(_0x237d6f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1d6b19f..871ac23 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 _0x60e8=['bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','moment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x60e8,0x152));var _0x860e=function(_0xcd8930,_0x483328){_0xcd8930=_0xcd8930-0x0;var _0x236ecb=_0x60e8[_0xcd8930];return _0x236ecb;};'use strict';var _=require(_0x860e('0x0'));var util=require('util');var logger=require(_0x860e('0x1'))('api');var moment=require(_0x860e('0x2'));var BPromise=require(_0x860e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x860e('0x4'));var rimraf=require(_0x860e('0x5'));var config=require(_0x860e('0x6'));var attributes=require(_0x860e('0x7'));module['exports']=function(_0x119396,_0x5124ec){return _0x119396[_0x860e('0x8')](_0x860e('0x9'),attributes,{'tableName':_0x860e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43a6=['bluebird','path','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','lodash','util','api','moment'];(function(_0x40c7f7,_0x42bc78){var _0x479755=function(_0x502b1e){while(--_0x502b1e){_0x40c7f7['push'](_0x40c7f7['shift']());}};_0x479755(++_0x42bc78);}(_0x43a6,0x132));var _0x643a=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x43a6[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x643a('0x0'));var util=require(_0x643a('0x1'));var logger=require('../../config/logger')(_0x643a('0x2'));var moment=require(_0x643a('0x3'));var BPromise=require(_0x643a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x643a('0x5'));var rimraf=require('rimraf');var config=require(_0x643a('0x6'));var attributes=require(_0x643a('0x7'));module['exports']=function(_0x23dbb6,_0x5d0801){return _0x23dbb6[_0x643a('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0x643a('0x9'),'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 880af32..4583b1d 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 _0xc062=['client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../config/utils','jayson/promise'];(function(_0x12c3d1,_0x3c6ae7){var _0x282840=function(_0x4ae0d2){while(--_0x4ae0d2){_0x12c3d1['push'](_0x12c3d1['shift']());}};_0x282840(++_0x3c6ae7);}(_0xc062,0x104));var _0x2c06=function(_0x4fe260,_0x885346){_0x4fe260=_0x4fe260-0x0;var _0x2d95d1=_0xc062[_0x4fe260];return _0x2d95d1;};'use strict';var _=require(_0x2c06('0x0'));var util=require(_0x2c06('0x1'));var moment=require(_0x2c06('0x2'));var BPromise=require(_0x2c06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2c06('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2c06('0x5'));var client=jayson[_0x2c06('0x6')][_0x2c06('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x25251a,_0x5abcec,_0x4d77b1){return new BPromise(function(_0x577b12,_0x1b445f){return client[_0x2c06('0x8')](_0x25251a,_0x4d77b1)[_0x2c06('0x9')](function(_0x2540a6){logger['info'](_0x2c06('0xa'),_0x5abcec,_0x2c06('0xb'));logger[_0x2c06('0xc')](_0x2c06('0xd'),_0x5abcec,_0x2c06('0xb'),JSON[_0x2c06('0xe')](_0x2540a6));if(_0x2540a6[_0x2c06('0xf')]){if(_0x2540a6[_0x2c06('0xf')]['code']===0x1f4){logger['error'](_0x2c06('0xa'),_0x5abcec,_0x2540a6[_0x2c06('0xf')]['message']);return _0x1b445f(_0x2540a6[_0x2c06('0xf')][_0x2c06('0x10')]);}logger[_0x2c06('0xf')](_0x2c06('0xa'),_0x5abcec,_0x2540a6[_0x2c06('0xf')][_0x2c06('0x10')]);return _0x577b12(_0x2540a6[_0x2c06('0xf')][_0x2c06('0x10')]);}else{logger['info'](_0x2c06('0xa'),_0x5abcec,'request\x20sent');_0x577b12(_0x2540a6[_0x2c06('0x11')][_0x2c06('0x10')]);}})[_0x2c06('0x12')](function(_0x190321){logger['error'](_0x2c06('0xa'),_0x5abcec,_0x190321);_0x1b445f(_0x190321);});});} \ No newline at end of file +var _0xebef=['message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x481e13,_0x1d5dee){var _0x5ae38b=function(_0x33bdfb){while(--_0x33bdfb){_0x481e13['push'](_0x481e13['shift']());}};_0x5ae38b(++_0x1d5dee);}(_0xebef,0xe9));var _0xfebe=function(_0xb7688b,_0x40d3f3){_0xb7688b=_0xb7688b-0x0;var _0x24d841=_0xebef[_0xb7688b];return _0x24d841;};'use strict';var _=require(_0xfebe('0x0'));var util=require('util');var moment=require(_0xfebe('0x1'));var BPromise=require('bluebird');var rs=require(_0xfebe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfebe('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfebe('0x4'))(_0xfebe('0x5'));var config=require(_0xfebe('0x6'));var jayson=require(_0xfebe('0x7'));var client=jayson[_0xfebe('0x8')][_0xfebe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6a56d6,_0x48dd1b,_0x27a6c2){return new BPromise(function(_0x356374,_0xb9eec8){return client[_0xfebe('0xa')](_0x6a56d6,_0x27a6c2)[_0xfebe('0xb')](function(_0x29b175){logger[_0xfebe('0xc')](_0xfebe('0xd'),_0x48dd1b,_0xfebe('0xe'));logger[_0xfebe('0xf')](_0xfebe('0x10'),_0x48dd1b,_0xfebe('0xe'),JSON[_0xfebe('0x11')](_0x29b175));if(_0x29b175[_0xfebe('0x12')]){if(_0x29b175[_0xfebe('0x12')][_0xfebe('0x13')]===0x1f4){logger['error'](_0xfebe('0xd'),_0x48dd1b,_0x29b175[_0xfebe('0x12')][_0xfebe('0x14')]);return _0xb9eec8(_0x29b175['error'][_0xfebe('0x14')]);}logger[_0xfebe('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x48dd1b,_0x29b175[_0xfebe('0x12')]['message']);return _0x356374(_0x29b175[_0xfebe('0x12')][_0xfebe('0x14')]);}else{logger['info'](_0xfebe('0xd'),_0x48dd1b,'request\x20sent');_0x356374(_0x29b175[_0xfebe('0x15')]['message']);}})[_0xfebe('0x16')](function(_0x4ca839){logger['error'](_0xfebe('0xd'),_0x48dd1b,_0x4ca839);_0xb9eec8(_0x4ca839);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 5652048..22a64a7 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 _0x7834=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x7834,0x13f));var _0x4783=function(_0x4b3300,_0x1137f1){_0x4b3300=_0x4b3300-0x0;var _0x2d26d3=_0x7834[_0x4b3300];return _0x2d26d3;};'use strict';var multer=require(_0x4783('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4783('0x1'));var express=require('express');var router=express[_0x4783('0x2')]();var fs_extra=require(_0x4783('0x3'));var auth=require(_0x4783('0x4'));var interaction=require(_0x4783('0x5'));var config=require(_0x4783('0x6'));var controller=require(_0x4783('0x7'));router[_0x4783('0x8')]('/',auth['isAuthenticated'](),controller[_0x4783('0x9')]);router[_0x4783('0x8')]('/:id',auth[_0x4783('0xa')](),controller[_0x4783('0xb')]);router[_0x4783('0xc')]('/',auth[_0x4783('0xa')](),controller[_0x4783('0xd')]);router[_0x4783('0xe')]('/:id',auth[_0x4783('0xa')](),controller[_0x4783('0xf')]);router[_0x4783('0x10')](_0x4783('0x11'),auth[_0x4783('0xa')](),controller[_0x4783('0x12')]);module[_0x4783('0x13')]=router; \ No newline at end of file +var _0xb07f=['show','post','create','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xb07f,0x109));var _0xfb07=function(_0x505d7c,_0x20b160){_0x505d7c=_0x505d7c-0x0;var _0x566b61=_0xb07f[_0x505d7c];return _0x566b61;};'use strict';var multer=require(_0xfb07('0x0'));var util=require(_0xfb07('0x1'));var path=require(_0xfb07('0x2'));var timeout=require(_0xfb07('0x3'));var express=require(_0xfb07('0x4'));var router=express[_0xfb07('0x5')]();var fs_extra=require(_0xfb07('0x6'));var auth=require(_0xfb07('0x7'));var interaction=require(_0xfb07('0x8'));var config=require(_0xfb07('0x9'));var controller=require(_0xfb07('0xa'));router['get']('/',auth[_0xfb07('0xb')](),controller[_0xfb07('0xc')]);router[_0xfb07('0xd')](_0xfb07('0xe'),auth[_0xfb07('0xb')](),controller[_0xfb07('0xf')]);router[_0xfb07('0x10')]('/',auth[_0xfb07('0xb')](),controller[_0xfb07('0x11')]);router[_0xfb07('0x12')](_0xfb07('0xe'),auth[_0xfb07('0xb')](),controller['update']);router['delete']('/:id',auth[_0xfb07('0xb')](),controller[_0xfb07('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2b2b4a6..aff3491 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 _0x3e54=['picklist','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x24cf6e,_0x1da6e7){var _0x1181c5=function(_0x24a21a){while(--_0x24a21a){_0x24cf6e['push'](_0x24cf6e['shift']());}};_0x1181c5(++_0x1da6e7);}(_0x3e54,0x1bc));var _0x43e5=function(_0x1a2a36,_0x547484){_0x1a2a36=_0x1a2a36-0x0;var _0x1f7578=_0x3e54[_0x1a2a36];return _0x1f7578;};'use strict';var Sequelize=require(_0x43e5('0x0'));module[_0x43e5('0x1')]={'type':{'type':Sequelize['ENUM'](_0x43e5('0x2'),_0x43e5('0x3'),_0x43e5('0x4'),_0x43e5('0x5'),_0x43e5('0x6')),'defaultValue':_0x43e5('0x2')},'content':{'type':Sequelize[_0x43e5('0x7')]},'key':{'type':Sequelize[_0x43e5('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x43e5('0x2'),_0x43e5('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x43e5('0x7')]},'idField':{'type':Sequelize[_0x43e5('0x7')]},'nameField':{'type':Sequelize[_0x43e5('0x7')]},'customField':{'type':Sequelize[_0x43e5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x43e5('0x7')]}}; \ No newline at end of file +var _0xf86d=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0xf86d,0x6c));var _0xdf86=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xf86d[_0x100e36];return _0x1df0c9;};'use strict';var Sequelize=require(_0xdf86('0x0'));module[_0xdf86('0x1')]={'type':{'type':Sequelize[_0xdf86('0x2')](_0xdf86('0x3'),_0xdf86('0x4'),'customVariable',_0xdf86('0x5'),_0xdf86('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdf86('0x7')]},'key':{'type':Sequelize[_0xdf86('0x7')]},'keyType':{'type':Sequelize[_0xdf86('0x2')](_0xdf86('0x3'),'variable',_0xdf86('0x8'))},'keyContent':{'type':Sequelize[_0xdf86('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdf86('0x7')]},'customField':{'type':Sequelize[_0xdf86('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf86('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 043c82b..6771892 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 _0xd1be=['intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','findAll','catch','params','length','include','find','create','body','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','reject','save','update','then','destroy','error','name','send','index','map','FreshsalesField','rawAttributes','type','key','query','keys','filters','model'];(function(_0x7fd68d,_0x337f7c){var _0x1371f3=function(_0x434fd7){while(--_0x434fd7){_0x7fd68d['push'](_0x7fd68d['shift']());}};_0x1371f3(++_0x337f7c);}(_0xd1be,0x131));var _0xed1b=function(_0x3a1cca,_0xf9cf7e){_0x3a1cca=_0x3a1cca-0x0;var _0x53b71c=_0xd1be[_0x3a1cca];return _0x53b71c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xed1b('0x0'));var jsonpatch=require(_0xed1b('0x1'));var rp=require(_0xed1b('0x2'));var moment=require(_0xed1b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xed1b('0x4'));var csv=require(_0xed1b('0x5'));var ejs=require(_0xed1b('0x6'));var fs=require('fs');var fs_extra=require(_0xed1b('0x7'));var _=require(_0xed1b('0x8'));var squel=require(_0xed1b('0x9'));var crypto=require('crypto');var jsforce=require(_0xed1b('0xa'));var deskjs=require(_0xed1b('0xb'));var toCsv=require(_0xed1b('0x5'));var querystring=require(_0xed1b('0xc'));var Papa=require(_0xed1b('0xd'));var Redis=require(_0xed1b('0xe'));var authService=require(_0xed1b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xed1b('0x10'));var hardwareService=require(_0xed1b('0x11'));var logger=require(_0xed1b('0x12'))(_0xed1b('0x13'));var utils=require(_0xed1b('0x14'));var config=require(_0xed1b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xed1b('0x16'))['db'];function respondWithStatusCode(_0x2f1897,_0x99c7ee){_0x99c7ee=_0x99c7ee||0xcc;return function(_0x1d3983){if(_0x1d3983){return _0x2f1897[_0xed1b('0x17')](_0x99c7ee);}return _0x2f1897[_0xed1b('0x18')](_0x99c7ee)[_0xed1b('0x19')]();};}function respondWithResult(_0x32ea47,_0x1b31b9){_0x1b31b9=_0x1b31b9||0xc8;return function(_0x37ea2a){if(_0x37ea2a){return _0x32ea47[_0xed1b('0x18')](_0x1b31b9)[_0xed1b('0x1a')](_0x37ea2a);}};}function respondWithFilteredResult(_0x105d51,_0x410177){return function(_0x23f515){if(_0x23f515){var _0x356f7f=typeof _0x410177['offset']===_0xed1b('0x1b')&&typeof _0x410177[_0xed1b('0x1c')]==='undefined';var _0x1e5430=_0x23f515['count'];var _0x2838af=_0x356f7f?0x0:_0x410177[_0xed1b('0x1d')];var _0x8d6493=_0x356f7f?_0x23f515[_0xed1b('0x1e')]:_0x410177[_0xed1b('0x1d')]+_0x410177[_0xed1b('0x1c')];var _0x2a53e5;if(_0x8d6493>=_0x1e5430){_0x8d6493=_0x1e5430;_0x2a53e5=0xc8;}else{_0x2a53e5=0xce;}_0x105d51['status'](_0x2a53e5);return _0x105d51[_0xed1b('0x1f')]('Content-Range',_0x2838af+'-'+_0x8d6493+'/'+_0x1e5430)['json'](_0x23f515);}return null;};}function patchUpdates(_0x540647){return function(_0x55f75b){try{jsonpatch['apply'](_0x55f75b,_0x540647,!![]);}catch(_0x536f5e){return BPromise[_0xed1b('0x20')](_0x536f5e);}return _0x55f75b[_0xed1b('0x21')]();};}function saveUpdates(_0x454078,_0x41c238){return function(_0x23fc62){if(_0x23fc62){return _0x23fc62[_0xed1b('0x22')](_0x454078)[_0xed1b('0x23')](function(_0x21859d){return _0x21859d;});}return null;};}function removeEntity(_0x91affb,_0x27b530){return function(_0x4fdbcc){if(_0x4fdbcc){return _0x4fdbcc[_0xed1b('0x24')]()[_0xed1b('0x23')](function(){_0x91affb['status'](0xcc)[_0xed1b('0x19')]();});}};}function handleEntityNotFound(_0x4a43f1,_0x1c0652){return function(_0x4aacc2){if(!_0x4aacc2){_0x4a43f1[_0xed1b('0x17')](0x194);}return _0x4aacc2;};}function handleError(_0xdcac7a,_0x5b7715){_0x5b7715=_0x5b7715||0x1f4;return function(_0x4768d9){logger[_0xed1b('0x25')](_0x4768d9['stack']);if(_0x4768d9['name']){delete _0x4768d9[_0xed1b('0x26')];}_0xdcac7a[_0xed1b('0x18')](_0x5b7715)[_0xed1b('0x27')](_0x4768d9);};}exports[_0xed1b('0x28')]=function(_0x1cc7a2,_0x24c540){var _0xbe4751={},_0x2e3d3c={},_0x4e70e1={'count':0x0,'rows':[]};var _0x42eb05=_[_0xed1b('0x29')](db[_0xed1b('0x2a')][_0xed1b('0x2b')],function(_0x49ee8c){return{'name':_0x49ee8c['fieldName'],'type':_0x49ee8c[_0xed1b('0x2c')][_0xed1b('0x2d')]};});_0x2e3d3c['model']=_[_0xed1b('0x29')](_0x42eb05,_0xed1b('0x26'));_0x2e3d3c[_0xed1b('0x2e')]=_[_0xed1b('0x2f')](_0x1cc7a2['query']);_0x2e3d3c[_0xed1b('0x30')]=_['intersection'](_0x2e3d3c[_0xed1b('0x31')],_0x2e3d3c[_0xed1b('0x2e')]);_0xbe4751['attributes']=_[_0xed1b('0x32')](_0x2e3d3c[_0xed1b('0x31')],qs[_0xed1b('0x33')](_0x1cc7a2['query'][_0xed1b('0x33')]));_0xbe4751[_0xed1b('0x34')]=_0xbe4751[_0xed1b('0x34')]['length']?_0xbe4751[_0xed1b('0x34')]:_0x2e3d3c[_0xed1b('0x31')];if(!_0x1cc7a2[_0xed1b('0x2e')][_0xed1b('0x35')](_0xed1b('0x36'))){_0xbe4751[_0xed1b('0x1c')]=qs[_0xed1b('0x1c')](_0x1cc7a2[_0xed1b('0x2e')][_0xed1b('0x1c')]);_0xbe4751[_0xed1b('0x1d')]=qs[_0xed1b('0x1d')](_0x1cc7a2[_0xed1b('0x2e')][_0xed1b('0x1d')]);}_0xbe4751[_0xed1b('0x37')]=qs[_0xed1b('0x38')](_0x1cc7a2[_0xed1b('0x2e')][_0xed1b('0x38')]);_0xbe4751['where']=qs[_0xed1b('0x30')](_[_0xed1b('0x39')](_0x1cc7a2[_0xed1b('0x2e')],_0x2e3d3c[_0xed1b('0x30')]),_0x42eb05);if(_0x1cc7a2[_0xed1b('0x2e')][_0xed1b('0x3a')]){_0xbe4751['where']=_[_0xed1b('0x3b')](_0xbe4751[_0xed1b('0x3c')],{'$or':_['map'](_0x42eb05,function(_0xd8c8b4){if(_0xd8c8b4[_0xed1b('0x2c')]!=='VIRTUAL'){var _0x4e8f94={};_0x4e8f94[_0xd8c8b4[_0xed1b('0x26')]]={'$like':'%'+_0x1cc7a2['query'][_0xed1b('0x3a')]+'%'};return _0x4e8f94;}})});}_0xbe4751=_[_0xed1b('0x3b')]({},_0xbe4751,_0x1cc7a2[_0xed1b('0x3d')]);var _0x482054={'where':_0xbe4751['where']};return db[_0xed1b('0x2a')][_0xed1b('0x1e')](_0x482054)['then'](function(_0x53636b){_0x4e70e1[_0xed1b('0x1e')]=_0x53636b;if(_0x1cc7a2[_0xed1b('0x2e')][_0xed1b('0x3e')]){_0xbe4751['include']=[{'all':!![]}];}return db[_0xed1b('0x2a')][_0xed1b('0x3f')](_0xbe4751);})[_0xed1b('0x23')](function(_0x33f885){_0x4e70e1['rows']=_0x33f885;return _0x4e70e1;})[_0xed1b('0x23')](respondWithFilteredResult(_0x24c540,_0xbe4751))[_0xed1b('0x40')](handleError(_0x24c540,null));};exports['show']=function(_0x2c3afa,_0x1e279c){var _0x47c29c={'raw':!![],'where':{'id':_0x2c3afa[_0xed1b('0x41')]['id']}},_0x2f1f6e={};_0x2f1f6e['model']=_[_0xed1b('0x2f')](db[_0xed1b('0x2a')][_0xed1b('0x2b')]);_0x2f1f6e[_0xed1b('0x2e')]=_['keys'](_0x2c3afa[_0xed1b('0x2e')]);_0x2f1f6e[_0xed1b('0x30')]=_[_0xed1b('0x32')](_0x2f1f6e[_0xed1b('0x31')],_0x2f1f6e[_0xed1b('0x2e')]);_0x47c29c[_0xed1b('0x34')]=_[_0xed1b('0x32')](_0x2f1f6e['model'],qs[_0xed1b('0x33')](_0x2c3afa['query'][_0xed1b('0x33')]));_0x47c29c[_0xed1b('0x34')]=_0x47c29c[_0xed1b('0x34')][_0xed1b('0x42')]?_0x47c29c[_0xed1b('0x34')]:_0x2f1f6e[_0xed1b('0x31')];if(_0x2c3afa[_0xed1b('0x2e')][_0xed1b('0x3e')]){_0x47c29c[_0xed1b('0x43')]=[{'all':!![]}];}_0x47c29c=_['merge']({},_0x47c29c,_0x2c3afa[_0xed1b('0x3d')]);return db[_0xed1b('0x2a')][_0xed1b('0x44')](_0x47c29c)['then'](handleEntityNotFound(_0x1e279c,null))[_0xed1b('0x23')](respondWithResult(_0x1e279c,null))[_0xed1b('0x40')](handleError(_0x1e279c,null));};exports[_0xed1b('0x45')]=function(_0x10620d,_0x3b1336){return db[_0xed1b('0x2a')][_0xed1b('0x45')](_0x10620d[_0xed1b('0x46')],{})[_0xed1b('0x23')](respondWithResult(_0x3b1336,0xc9))['catch'](handleError(_0x3b1336,null));};exports[_0xed1b('0x22')]=function(_0x10cd11,_0x2379b7){if(_0x10cd11[_0xed1b('0x46')]['id']){delete _0x10cd11['body']['id'];}return db[_0xed1b('0x2a')][_0xed1b('0x44')]({'where':{'id':_0x10cd11['params']['id']}})[_0xed1b('0x23')](handleEntityNotFound(_0x2379b7,null))[_0xed1b('0x23')](saveUpdates(_0x10cd11[_0xed1b('0x46')],null))[_0xed1b('0x23')](respondWithResult(_0x2379b7,null))[_0xed1b('0x40')](handleError(_0x2379b7,null));};exports['destroy']=function(_0x285ed0,_0x28447f){return db[_0xed1b('0x2a')][_0xed1b('0x44')]({'where':{'id':_0x285ed0['params']['id']}})['then'](handleEntityNotFound(_0x28447f,null))[_0xed1b('0x23')](removeEntity(_0x28447f,null))[_0xed1b('0x40')](handleError(_0x28447f,null));}; \ No newline at end of file +var _0x2fd6=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../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','then','destroy','error','name','send','FreshsalesField','rawAttributes','fieldName','key','model','map','query','keys'];(function(_0x52a1be,_0x49f576){var _0x598cff=function(_0x12fa8e){while(--_0x12fa8e){_0x52a1be['push'](_0x52a1be['shift']());}};_0x598cff(++_0x49f576);}(_0x2fd6,0xf7));var _0x62fd=function(_0x1e0097,_0x836d2b){_0x1e0097=_0x1e0097-0x0;var _0x4a3d65=_0x2fd6[_0x1e0097];return _0x4a3d65;};'use strict';var emlformat=require(_0x62fd('0x0'));var rimraf=require(_0x62fd('0x1'));var zipdir=require(_0x62fd('0x2'));var jsonpatch=require(_0x62fd('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x62fd('0x4'));var Mustache=require(_0x62fd('0x5'));var util=require(_0x62fd('0x6'));var path=require(_0x62fd('0x7'));var sox=require(_0x62fd('0x8'));var csv=require(_0x62fd('0x9'));var ejs=require(_0x62fd('0xa'));var fs=require('fs');var fs_extra=require(_0x62fd('0xb'));var _=require(_0x62fd('0xc'));var squel=require(_0x62fd('0xd'));var crypto=require(_0x62fd('0xe'));var jsforce=require(_0x62fd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x62fd('0x9'));var querystring=require(_0x62fd('0x10'));var Papa=require(_0x62fd('0x11'));var Redis=require(_0x62fd('0x12'));var authService=require(_0x62fd('0x13'));var qs=require(_0x62fd('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62fd('0x15'));var logger=require(_0x62fd('0x16'))(_0x62fd('0x17'));var utils=require(_0x62fd('0x18'));var config=require(_0x62fd('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b6df2,_0x1d8372){_0x1d8372=_0x1d8372||0xcc;return function(_0x302e15){if(_0x302e15){return _0x2b6df2[_0x62fd('0x1a')](_0x1d8372);}return _0x2b6df2[_0x62fd('0x1b')](_0x1d8372)[_0x62fd('0x1c')]();};}function respondWithResult(_0x8f9ac9,_0x3aff72){_0x3aff72=_0x3aff72||0xc8;return function(_0x4ecc3a){if(_0x4ecc3a){return _0x8f9ac9[_0x62fd('0x1b')](_0x3aff72)[_0x62fd('0x1d')](_0x4ecc3a);}};}function respondWithFilteredResult(_0x3f79c5,_0x29577f){return function(_0x2032bd){if(_0x2032bd){var _0x5e5797=typeof _0x29577f[_0x62fd('0x1e')]===_0x62fd('0x1f')&&typeof _0x29577f[_0x62fd('0x20')]==='undefined';var _0xea92f6=_0x2032bd['count'];var _0x40f302=_0x5e5797?0x0:_0x29577f[_0x62fd('0x1e')];var _0x15d189=_0x5e5797?_0x2032bd[_0x62fd('0x21')]:_0x29577f['offset']+_0x29577f[_0x62fd('0x20')];var _0x170a2e;if(_0x15d189>=_0xea92f6){_0x15d189=_0xea92f6;_0x170a2e=0xc8;}else{_0x170a2e=0xce;}_0x3f79c5[_0x62fd('0x1b')](_0x170a2e);return _0x3f79c5[_0x62fd('0x22')](_0x62fd('0x23'),_0x40f302+'-'+_0x15d189+'/'+_0xea92f6)['json'](_0x2032bd);}return null;};}function patchUpdates(_0x400621){return function(_0x54ce77){try{jsonpatch[_0x62fd('0x24')](_0x54ce77,_0x400621,!![]);}catch(_0x257f67){return BPromise[_0x62fd('0x25')](_0x257f67);}return _0x54ce77[_0x62fd('0x26')]();};}function saveUpdates(_0x2f89f5,_0x3e16f9){return function(_0x17f859){if(_0x17f859){return _0x17f859[_0x62fd('0x27')](_0x2f89f5)[_0x62fd('0x28')](function(_0x1fccb3){return _0x1fccb3;});}return null;};}function removeEntity(_0x38eafb,_0x255bf7){return function(_0xc7956e){if(_0xc7956e){return _0xc7956e[_0x62fd('0x29')]()[_0x62fd('0x28')](function(){_0x38eafb[_0x62fd('0x1b')](0xcc)[_0x62fd('0x1c')]();});}};}function handleEntityNotFound(_0x2eba2c,_0x22e703){return function(_0x2149dc){if(!_0x2149dc){_0x2eba2c['sendStatus'](0x194);}return _0x2149dc;};}function handleError(_0xbf91df,_0x1f59ae){_0x1f59ae=_0x1f59ae||0x1f4;return function(_0x5a8849){logger[_0x62fd('0x2a')](_0x5a8849['stack']);if(_0x5a8849[_0x62fd('0x2b')]){delete _0x5a8849[_0x62fd('0x2b')];}_0xbf91df[_0x62fd('0x1b')](_0x1f59ae)[_0x62fd('0x2c')](_0x5a8849);};}exports['index']=function(_0x48eb7e,_0x30e219){var _0x3a97da={},_0xaa93c5={},_0x59eea7={'count':0x0,'rows':[]};var _0x5ae0a2=_['map'](db[_0x62fd('0x2d')][_0x62fd('0x2e')],function(_0x3e722b){return{'name':_0x3e722b[_0x62fd('0x2f')],'type':_0x3e722b['type'][_0x62fd('0x30')]};});_0xaa93c5[_0x62fd('0x31')]=_[_0x62fd('0x32')](_0x5ae0a2,_0x62fd('0x2b'));_0xaa93c5[_0x62fd('0x33')]=_[_0x62fd('0x34')](_0x48eb7e[_0x62fd('0x33')]);_0xaa93c5[_0x62fd('0x35')]=_[_0x62fd('0x36')](_0xaa93c5[_0x62fd('0x31')],_0xaa93c5[_0x62fd('0x33')]);_0x3a97da[_0x62fd('0x37')]=_[_0x62fd('0x36')](_0xaa93c5[_0x62fd('0x31')],qs[_0x62fd('0x38')](_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x38')]));_0x3a97da[_0x62fd('0x37')]=_0x3a97da[_0x62fd('0x37')][_0x62fd('0x39')]?_0x3a97da['attributes']:_0xaa93c5[_0x62fd('0x31')];if(!_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x3a')](_0x62fd('0x3b'))){_0x3a97da[_0x62fd('0x20')]=qs[_0x62fd('0x20')](_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x20')]);_0x3a97da[_0x62fd('0x1e')]=qs[_0x62fd('0x1e')](_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x1e')]);}_0x3a97da[_0x62fd('0x3c')]=qs[_0x62fd('0x3d')](_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x3d')]);_0x3a97da[_0x62fd('0x3e')]=qs[_0x62fd('0x35')](_['pick'](_0x48eb7e['query'],_0xaa93c5[_0x62fd('0x35')]),_0x5ae0a2);if(_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x3f')]){_0x3a97da[_0x62fd('0x3e')]=_['merge'](_0x3a97da['where'],{'$or':_[_0x62fd('0x32')](_0x5ae0a2,function(_0x4153c2){if(_0x4153c2[_0x62fd('0x40')]!=='VIRTUAL'){var _0x50f488={};_0x50f488[_0x4153c2[_0x62fd('0x2b')]]={'$like':'%'+_0x48eb7e[_0x62fd('0x33')][_0x62fd('0x3f')]+'%'};return _0x50f488;}})});}_0x3a97da=_[_0x62fd('0x41')]({},_0x3a97da,_0x48eb7e[_0x62fd('0x42')]);var _0x59f8a8={'where':_0x3a97da[_0x62fd('0x3e')]};return db[_0x62fd('0x2d')][_0x62fd('0x21')](_0x59f8a8)[_0x62fd('0x28')](function(_0x48f8c8){_0x59eea7[_0x62fd('0x21')]=_0x48f8c8;if(_0x48eb7e['query']['includeAll']){_0x3a97da['include']=[{'all':!![]}];}return db[_0x62fd('0x2d')]['findAll'](_0x3a97da);})[_0x62fd('0x28')](function(_0x49f208){_0x59eea7[_0x62fd('0x43')]=_0x49f208;return _0x59eea7;})['then'](respondWithFilteredResult(_0x30e219,_0x3a97da))[_0x62fd('0x44')](handleError(_0x30e219,null));};exports[_0x62fd('0x45')]=function(_0xf6c00b,_0x1ffe19){var _0x563b16={'raw':!![],'where':{'id':_0xf6c00b[_0x62fd('0x46')]['id']}},_0x212549={};_0x212549[_0x62fd('0x31')]=_['keys'](db[_0x62fd('0x2d')]['rawAttributes']);_0x212549[_0x62fd('0x33')]=_['keys'](_0xf6c00b['query']);_0x212549['filters']=_[_0x62fd('0x36')](_0x212549[_0x62fd('0x31')],_0x212549[_0x62fd('0x33')]);_0x563b16[_0x62fd('0x37')]=_['intersection'](_0x212549[_0x62fd('0x31')],qs[_0x62fd('0x38')](_0xf6c00b[_0x62fd('0x33')][_0x62fd('0x38')]));_0x563b16[_0x62fd('0x37')]=_0x563b16[_0x62fd('0x37')][_0x62fd('0x39')]?_0x563b16[_0x62fd('0x37')]:_0x212549['model'];if(_0xf6c00b[_0x62fd('0x33')]['includeAll']){_0x563b16[_0x62fd('0x47')]=[{'all':!![]}];}_0x563b16=_[_0x62fd('0x41')]({},_0x563b16,_0xf6c00b[_0x62fd('0x42')]);return db['FreshsalesField'][_0x62fd('0x48')](_0x563b16)[_0x62fd('0x28')](handleEntityNotFound(_0x1ffe19,null))['then'](respondWithResult(_0x1ffe19,null))[_0x62fd('0x44')](handleError(_0x1ffe19,null));};exports[_0x62fd('0x49')]=function(_0x712a98,_0x91660b){return db[_0x62fd('0x2d')][_0x62fd('0x49')](_0x712a98[_0x62fd('0x4a')],{})[_0x62fd('0x28')](respondWithResult(_0x91660b,0xc9))[_0x62fd('0x44')](handleError(_0x91660b,null));};exports[_0x62fd('0x27')]=function(_0x5e9f99,_0x160e82){if(_0x5e9f99[_0x62fd('0x4a')]['id']){delete _0x5e9f99[_0x62fd('0x4a')]['id'];}return db[_0x62fd('0x2d')][_0x62fd('0x48')]({'where':{'id':_0x5e9f99[_0x62fd('0x46')]['id']}})['then'](handleEntityNotFound(_0x160e82,null))[_0x62fd('0x28')](saveUpdates(_0x5e9f99[_0x62fd('0x4a')],null))['then'](respondWithResult(_0x160e82,null))[_0x62fd('0x44')](handleError(_0x160e82,null));};exports['destroy']=function(_0x470925,_0x187289){return db[_0x62fd('0x2d')][_0x62fd('0x48')]({'where':{'id':_0x470925[_0x62fd('0x46')]['id']}})[_0x62fd('0x28')](handleEntityNotFound(_0x187289,null))[_0x62fd('0x28')](removeEntity(_0x187289,null))[_0x62fd('0x44')](handleError(_0x187289,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index f97caef..ae76051 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 _0xd906=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd906,0x6b));var _0x6d90=function(_0x175e11,_0x4eb63c){_0x175e11=_0x175e11-0x0;var _0x57ad0c=_0xd906[_0x175e11];return _0x57ad0c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6d90('0x0'))(_0x6d90('0x1'));var moment=require(_0x6d90('0x2'));var BPromise=require(_0x6d90('0x3'));var rp=require(_0x6d90('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6d90('0x5'));var config=require(_0x6d90('0x6'));var attributes=require(_0x6d90('0x7'));module[_0x6d90('0x8')]=function(_0x4fa119,_0x8ee191){return _0x4fa119[_0x6d90('0x9')](_0x6d90('0xa'),attributes,{'tableName':_0x6d90('0xb'),'paranoid':![],'indexes':[{'name':_0x6d90('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x88c3=['idField','FieldId','lodash','../../config/logger','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x35507b,_0x247cbe){var _0x4ff363=function(_0x52e8b5){while(--_0x52e8b5){_0x35507b['push'](_0x35507b['shift']());}};_0x4ff363(++_0x247cbe);}(_0x88c3,0x1ee));var _0x388c=function(_0x3aff62,_0x1c55cf){_0x3aff62=_0x3aff62-0x0;var _0x135909=_0x88c3[_0x3aff62];return _0x135909;};'use strict';var _=require(_0x388c('0x0'));var util=require('util');var logger=require(_0x388c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x388c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x388c('0x3'));var config=require(_0x388c('0x4'));var attributes=require(_0x388c('0x5'));module[_0x388c('0x6')]=function(_0x28ed4d,_0x23199c){return _0x28ed4d['define'](_0x388c('0x7'),attributes,{'tableName':_0x388c('0x8'),'paranoid':![],'indexes':[{'name':_0x388c('0x9'),'fields':[_0x388c('0xa'),_0x388c('0xb')],'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 2016f87..9ff1a84 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x4349da,_0x133fb9){var _0x311578=function(_0x52e9e2){while(--_0x52e9e2){_0x4349da['push'](_0x4349da['shift']());}};_0x311578(++_0x133fb9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc4aa[_0x209941];return _0x1e8729;};'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')]('FreshsalesField,\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 _0x9536=['request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesField,\x20%s,\x20%s'];(function(_0x281a04,_0x21f405){var _0x548f71=function(_0x9f8e7c){while(--_0x9f8e7c){_0x281a04['push'](_0x281a04['shift']());}};_0x548f71(++_0x21f405);}(_0x9536,0x179));var _0x6953=function(_0x212bf5,_0x165cbd){_0x212bf5=_0x212bf5-0x0;var _0xfcad21=_0x9536[_0x212bf5];return _0xfcad21;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c1b1bbb..c96ff3c 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x40638c,_0x58650c){var _0x3ad254=function(_0x3b6d5c){while(--_0x3b6d5c){_0x40638c['push'](_0x40638c['shift']());}};_0x3ad254(++_0x58650c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3d8b9a,_0x50d768){var _0x4ab686=function(_0x4369c2){while(--_0x4369c2){_0x3d8b9a['push'](_0x3d8b9a['shift']());}};_0x4ab686(++_0x50d768);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 dde0a54..5d76ec3 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 _0xa613=['username','integrationTab','newTab','sequelize','STRING'];(function(_0x3e1b42,_0x3a482f){var _0x44365f=function(_0x25e172){while(--_0x25e172){_0x3e1b42['push'](_0x3e1b42['shift']());}};_0x44365f(++_0x3a482f);}(_0xa613,0x8a));var _0x3a61=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0xa613[_0x39479f];return _0x4a6d96;};'use strict';var Sequelize=require(_0x3a61('0x0'));module['exports']={'name':{'type':Sequelize[_0x3a61('0x1')]},'description':{'type':Sequelize[_0x3a61('0x1')]},'username':{'type':Sequelize[_0x3a61('0x1')],'unique':_0x3a61('0x2')},'remoteUri':{'type':Sequelize[_0x3a61('0x1')]},'password':{'type':Sequelize[_0x3a61('0x1')]},'clientId':{'type':Sequelize[_0x3a61('0x1')]},'clientSecret':{'type':Sequelize[_0x3a61('0x1')]},'securityToken':{'type':Sequelize[_0x3a61('0x1')]},'serverUrl':{'type':Sequelize[_0x3a61('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3a61('0x3'),_0x3a61('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xdf55=['exports','STRING','ENUM','integrationTab','newTab','sequelize'];(function(_0x10f2f8,_0x4ec90c){var _0x75ddf=function(_0x333acc){while(--_0x333acc){_0x10f2f8['push'](_0x10f2f8['shift']());}};_0x75ddf(++_0x4ec90c);}(_0xdf55,0x83));var _0x5df5=function(_0x34190e,_0x50ecc7){_0x34190e=_0x34190e-0x0;var _0x41a4e6=_0xdf55[_0x34190e];return _0x41a4e6;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5df5('0x2')]},'username':{'type':Sequelize[_0x5df5('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x5df5('0x2')]},'password':{'type':Sequelize[_0x5df5('0x2')]},'clientId':{'type':Sequelize[_0x5df5('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x5df5('0x2')]},'serverUrl':{'type':Sequelize[_0x5df5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5df5('0x3')](_0x5df5('0x4'),_0x5df5('0x5')),'defaultValue':_0x5df5('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index fe703df..82a0c9d 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 _0x4f30=['count','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','index','map','SalesforceAccount','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','merge','options','includeAll','include','catch','show','rawAttributes','find','create','body','params','getConfigurations','SalesforceConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceField','Descriptions','getFields','Task','findOne','remoteUri','clientId','clientSecret','password','slice','substring','lastIndexOf','username','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','value','True','true','False','false','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit'];(function(_0x38b865,_0x4ceb6a){var _0x11af52=function(_0x718b93){while(--_0x718b93){_0x38b865['push'](_0x38b865['shift']());}};_0x11af52(++_0x4ceb6a);}(_0x4f30,0xe8));var _0x04f3=function(_0x41b27d,_0x3ad8c1){_0x41b27d=_0x41b27d-0x0;var _0x2dc5c3=_0x4f30[_0x41b27d];return _0x2dc5c3;};'use strict';var emlformat=require(_0x04f3('0x0'));var rimraf=require(_0x04f3('0x1'));var zipdir=require(_0x04f3('0x2'));var jsonpatch=require(_0x04f3('0x3'));var rp=require(_0x04f3('0x4'));var moment=require(_0x04f3('0x5'));var BPromise=require(_0x04f3('0x6'));var Mustache=require(_0x04f3('0x7'));var util=require(_0x04f3('0x8'));var path=require('path');var sox=require(_0x04f3('0x9'));var csv=require(_0x04f3('0xa'));var ejs=require(_0x04f3('0xb'));var fs=require('fs');var fs_extra=require(_0x04f3('0xc'));var _=require(_0x04f3('0xd'));var squel=require(_0x04f3('0xe'));var crypto=require(_0x04f3('0xf'));var jsforce=require(_0x04f3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x04f3('0xa'));var querystring=require(_0x04f3('0x11'));var Papa=require(_0x04f3('0x12'));var Redis=require('ioredis');var authService=require(_0x04f3('0x13'));var qs=require(_0x04f3('0x14'));var as=require(_0x04f3('0x15'));var hardwareService=require(_0x04f3('0x16'));var logger=require(_0x04f3('0x17'))(_0x04f3('0x18'));var utils=require(_0x04f3('0x19'));var config=require(_0x04f3('0x1a'));var licenseUtil=require(_0x04f3('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xa744a5,_0x2d7aaf){_0x2d7aaf=_0x2d7aaf||0xcc;return function(_0x51414a){if(_0x51414a){return _0xa744a5[_0x04f3('0x1c')](_0x2d7aaf);}return _0xa744a5[_0x04f3('0x1d')](_0x2d7aaf)['end']();};}function respondWithResult(_0x5873e7,_0x3de729){_0x3de729=_0x3de729||0xc8;return function(_0x515afa){if(_0x515afa){return _0x5873e7[_0x04f3('0x1d')](_0x3de729)[_0x04f3('0x1e')](_0x515afa);}};}function respondWithFilteredResult(_0xcfa930,_0x1b7448){return function(_0x21fb4e){if(_0x21fb4e){var _0x4ecbf2=typeof _0x1b7448[_0x04f3('0x1f')]===_0x04f3('0x20')&&typeof _0x1b7448[_0x04f3('0x21')]==='undefined';var _0x2a566a=_0x21fb4e[_0x04f3('0x22')];var _0x1b3ead=_0x4ecbf2?0x0:_0x1b7448['offset'];var _0x540e8e=_0x4ecbf2?_0x21fb4e[_0x04f3('0x22')]:_0x1b7448[_0x04f3('0x1f')]+_0x1b7448['limit'];var _0xfa2dea;if(_0x540e8e>=_0x2a566a){_0x540e8e=_0x2a566a;_0xfa2dea=0xc8;}else{_0xfa2dea=0xce;}_0xcfa930[_0x04f3('0x1d')](_0xfa2dea);return _0xcfa930[_0x04f3('0x23')](_0x04f3('0x24'),_0x1b3ead+'-'+_0x540e8e+'/'+_0x2a566a)['json'](_0x21fb4e);}return null;};}function patchUpdates(_0x5c481b){return function(_0x503a48){try{jsonpatch['apply'](_0x503a48,_0x5c481b,!![]);}catch(_0x586027){return BPromise[_0x04f3('0x25')](_0x586027);}return _0x503a48[_0x04f3('0x26')]();};}function saveUpdates(_0x6567ee,_0x257c1e){return function(_0x116914){if(_0x116914){return _0x116914[_0x04f3('0x27')](_0x6567ee)['then'](function(_0x28ead8){return _0x28ead8;});}return null;};}function removeEntity(_0x2e088d,_0x2d11c5){return function(_0xdbc3){if(_0xdbc3){return _0xdbc3[_0x04f3('0x28')]()[_0x04f3('0x29')](function(){_0x2e088d[_0x04f3('0x1d')](0xcc)[_0x04f3('0x2a')]();});}};}function handleEntityNotFound(_0x423a0a,_0x8f6af3){return function(_0x13a19e){if(!_0x13a19e){_0x423a0a[_0x04f3('0x1c')](0x194);}return _0x13a19e;};}function handleError(_0x400381,_0x3a26c2){_0x3a26c2=_0x3a26c2||0x1f4;return function(_0x2fdd91){logger[_0x04f3('0x2b')](_0x2fdd91[_0x04f3('0x2c')]);if(_0x2fdd91['name']){delete _0x2fdd91[_0x04f3('0x2d')];}_0x400381[_0x04f3('0x1d')](_0x3a26c2)['send'](_0x2fdd91);};}exports[_0x04f3('0x2e')]=function(_0x9b2e2c,_0x4dc2c5){var _0x27dbfa={},_0x37aad6={},_0x96fda6={'count':0x0,'rows':[]};var _0x551220=_[_0x04f3('0x2f')](db[_0x04f3('0x30')]['rawAttributes'],function(_0x2f12fc){return{'name':_0x2f12fc[_0x04f3('0x31')],'type':_0x2f12fc['type'][_0x04f3('0x32')]};});_0x37aad6[_0x04f3('0x33')]=_[_0x04f3('0x2f')](_0x551220,_0x04f3('0x2d'));_0x37aad6[_0x04f3('0x34')]=_[_0x04f3('0x35')](_0x9b2e2c[_0x04f3('0x34')]);_0x37aad6[_0x04f3('0x36')]=_['intersection'](_0x37aad6[_0x04f3('0x33')],_0x37aad6['query']);_0x27dbfa[_0x04f3('0x37')]=_[_0x04f3('0x38')](_0x37aad6[_0x04f3('0x33')],qs['fields'](_0x9b2e2c[_0x04f3('0x34')][_0x04f3('0x39')]));_0x27dbfa[_0x04f3('0x37')]=_0x27dbfa[_0x04f3('0x37')][_0x04f3('0x3a')]?_0x27dbfa[_0x04f3('0x37')]:_0x37aad6['model'];if(!_0x9b2e2c[_0x04f3('0x34')][_0x04f3('0x3b')](_0x04f3('0x3c'))){_0x27dbfa[_0x04f3('0x21')]=qs['limit'](_0x9b2e2c[_0x04f3('0x34')][_0x04f3('0x21')]);_0x27dbfa['offset']=qs['offset'](_0x9b2e2c['query'][_0x04f3('0x1f')]);}_0x27dbfa['order']=qs[_0x04f3('0x3d')](_0x9b2e2c['query']['sort']);_0x27dbfa['where']=qs[_0x04f3('0x36')](_[_0x04f3('0x3e')](_0x9b2e2c[_0x04f3('0x34')],_0x37aad6[_0x04f3('0x36')]),_0x551220);if(_0x9b2e2c[_0x04f3('0x34')][_0x04f3('0x3f')]){_0x27dbfa[_0x04f3('0x40')]=_['merge'](_0x27dbfa['where'],{'$or':_[_0x04f3('0x2f')](_0x551220,function(_0x332f53){if(_0x332f53[_0x04f3('0x41')]!=='VIRTUAL'){var _0x296cbf={};_0x296cbf[_0x332f53['name']]={'$like':'%'+_0x9b2e2c['query'][_0x04f3('0x3f')]+'%'};return _0x296cbf;}})});}_0x27dbfa=_[_0x04f3('0x42')]({},_0x27dbfa,_0x9b2e2c[_0x04f3('0x43')]);var _0x4fa8d6={'where':_0x27dbfa[_0x04f3('0x40')]};return db[_0x04f3('0x30')][_0x04f3('0x22')](_0x4fa8d6)['then'](function(_0x30e0c2){_0x96fda6['count']=_0x30e0c2;if(_0x9b2e2c[_0x04f3('0x34')][_0x04f3('0x44')]){_0x27dbfa[_0x04f3('0x45')]=[{'all':!![]}];}return db[_0x04f3('0x30')]['findAll'](_0x27dbfa);})[_0x04f3('0x29')](function(_0x3999e4){_0x96fda6['rows']=_0x3999e4;return _0x96fda6;})[_0x04f3('0x29')](respondWithFilteredResult(_0x4dc2c5,_0x27dbfa))[_0x04f3('0x46')](handleError(_0x4dc2c5,null));};exports[_0x04f3('0x47')]=function(_0x110613,_0x4f78b3){var _0x3f7dde={'raw':![],'where':{'id':_0x110613['params']['id']}},_0x5689a8={};_0x5689a8['model']=_[_0x04f3('0x35')](db[_0x04f3('0x30')][_0x04f3('0x48')]);_0x5689a8[_0x04f3('0x34')]=_[_0x04f3('0x35')](_0x110613[_0x04f3('0x34')]);_0x5689a8[_0x04f3('0x36')]=_[_0x04f3('0x38')](_0x5689a8['model'],_0x5689a8['query']);_0x3f7dde[_0x04f3('0x37')]=_[_0x04f3('0x38')](_0x5689a8[_0x04f3('0x33')],qs[_0x04f3('0x39')](_0x110613['query'][_0x04f3('0x39')]));_0x3f7dde[_0x04f3('0x37')]=_0x3f7dde['attributes'][_0x04f3('0x3a')]?_0x3f7dde[_0x04f3('0x37')]:_0x5689a8[_0x04f3('0x33')];if(_0x110613['query'][_0x04f3('0x44')]){_0x3f7dde[_0x04f3('0x45')]=[{'all':!![]}];}_0x3f7dde=_[_0x04f3('0x42')]({},_0x3f7dde,_0x110613[_0x04f3('0x43')]);return db[_0x04f3('0x30')][_0x04f3('0x49')](_0x3f7dde)[_0x04f3('0x29')](handleEntityNotFound(_0x4f78b3,null))[_0x04f3('0x29')](respondWithResult(_0x4f78b3,null))[_0x04f3('0x46')](handleError(_0x4f78b3,null));};exports[_0x04f3('0x4a')]=function(_0x4298ba,_0x4f0725){return db['SalesforceAccount'][_0x04f3('0x4a')](_0x4298ba[_0x04f3('0x4b')],{})['then'](respondWithResult(_0x4f0725,0xc9))['catch'](handleError(_0x4f0725,null));};exports[_0x04f3('0x27')]=function(_0x90b1c,_0x67e98b){if(_0x90b1c['body']['id']){delete _0x90b1c['body']['id'];}return db[_0x04f3('0x30')][_0x04f3('0x49')]({'where':{'id':_0x90b1c[_0x04f3('0x4c')]['id']}})[_0x04f3('0x29')](handleEntityNotFound(_0x67e98b,null))['then'](saveUpdates(_0x90b1c[_0x04f3('0x4b')],null))[_0x04f3('0x29')](respondWithResult(_0x67e98b,null))[_0x04f3('0x46')](handleError(_0x67e98b,null));};exports[_0x04f3('0x28')]=function(_0x1ea28c,_0x552cd8){return db[_0x04f3('0x30')][_0x04f3('0x49')]({'where':{'id':_0x1ea28c[_0x04f3('0x4c')]['id']}})[_0x04f3('0x29')](handleEntityNotFound(_0x552cd8,null))[_0x04f3('0x29')](removeEntity(_0x552cd8,null))[_0x04f3('0x46')](handleError(_0x552cd8,null));};exports[_0x04f3('0x4d')]=function(_0x5ba7d1,_0x253fbe,_0x324dfd){var _0x1b17a8={};var _0x34d9e4={};var _0x2433f1;var _0x55bcb4;return db['SalesforceAccount']['findOne']({'where':{'id':_0x5ba7d1[_0x04f3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x253fbe,null))[_0x04f3('0x29')](function(_0x58dcc7){if(_0x58dcc7){_0x2433f1=_0x58dcc7;_0x34d9e4[_0x04f3('0x33')]=_[_0x04f3('0x35')](db[_0x04f3('0x4e')]['rawAttributes']);_0x34d9e4['query']=_[_0x04f3('0x35')](_0x5ba7d1[_0x04f3('0x34')]);_0x34d9e4['filters']=_['intersection'](_0x34d9e4[_0x04f3('0x33')],_0x34d9e4[_0x04f3('0x34')]);_0x1b17a8['attributes']=_[_0x04f3('0x38')](_0x34d9e4[_0x04f3('0x33')],qs[_0x04f3('0x39')](_0x5ba7d1['query']['fields']));_0x1b17a8[_0x04f3('0x37')]=_0x1b17a8[_0x04f3('0x37')][_0x04f3('0x3a')]?_0x1b17a8['attributes']:_0x34d9e4[_0x04f3('0x33')];_0x1b17a8[_0x04f3('0x4f')]=qs[_0x04f3('0x3d')](_0x5ba7d1[_0x04f3('0x34')][_0x04f3('0x3d')]);_0x1b17a8[_0x04f3('0x40')]=qs[_0x04f3('0x36')](_[_0x04f3('0x3e')](_0x5ba7d1['query'],_0x34d9e4[_0x04f3('0x36')]));if(_0x5ba7d1[_0x04f3('0x34')]['filter']){_0x1b17a8['where']=_[_0x04f3('0x42')](_0x1b17a8[_0x04f3('0x40')],{'$or':_['map'](_0x1b17a8[_0x04f3('0x37')],function(_0x48f5e3){var _0x51296a={};_0x51296a[_0x48f5e3]={'$like':'%'+_0x5ba7d1[_0x04f3('0x34')]['filter']+'%'};return _0x51296a;})});}_0x1b17a8=_[_0x04f3('0x42')]({},_0x1b17a8,_0x5ba7d1[_0x04f3('0x43')]);return _0x2433f1[_0x04f3('0x4d')](_0x1b17a8);}})['then'](function(_0x4805ab){if(_0x4805ab){_0x55bcb4=_0x4805ab[_0x04f3('0x3a')];if(!_0x5ba7d1[_0x04f3('0x34')][_0x04f3('0x3b')](_0x04f3('0x3c'))){_0x1b17a8[_0x04f3('0x21')]=qs[_0x04f3('0x21')](_0x5ba7d1[_0x04f3('0x34')]['limit']);_0x1b17a8['offset']=qs[_0x04f3('0x1f')](_0x5ba7d1[_0x04f3('0x34')][_0x04f3('0x1f')]);}return _0x2433f1['getConfigurations'](_0x1b17a8);}})['then'](function(_0xf17dc2){if(_0xf17dc2){return _0xf17dc2?{'count':_0x55bcb4,'rows':_0xf17dc2}:null;}})[_0x04f3('0x29')](respondWithResult(_0x253fbe,null))[_0x04f3('0x46')](handleError(_0x253fbe,null));};exports[_0x04f3('0x50')]=function(_0x3f3951,_0x3bee91,_0x4a82a2){if(_0x3f3951[_0x04f3('0x4b')]['id']){delete _0x3f3951[_0x04f3('0x4b')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x3f3951[_0x04f3('0x4c')]['id']}})[_0x04f3('0x29')](handleEntityNotFound(_0x3bee91,null))[_0x04f3('0x29')](function(_0x35e536){if(_0x35e536){_0x3f3951['body'][_0x04f3('0x51')]=_0x35e536['id'];_0x3f3951[_0x04f3('0x4b')][_0x04f3('0x52')]=integrations[_0x04f3('0x53')](_0x3f3951[_0x04f3('0x4b')][_0x04f3('0x54')],_0x3f3951[_0x04f3('0x4b')][_0x04f3('0x41')]);_0x3f3951[_0x04f3('0x4b')]['Descriptions']=integrations[_0x04f3('0x55')](_0x3f3951['body'][_0x04f3('0x54')],_0x3f3951['body'][_0x04f3('0x41')]);return db[_0x04f3('0x4e')][_0x04f3('0x4a')](_0x3f3951[_0x04f3('0x4b')],{'include':[{'model':db[_0x04f3('0x56')],'as':'Subjects'},{'model':db[_0x04f3('0x56')],'as':_0x04f3('0x57')}]});}return null;})[_0x04f3('0x29')](respondWithResult(_0x3bee91,null))[_0x04f3('0x46')](handleError(_0x3bee91,null));};exports[_0x04f3('0x58')]=function(_0xda0bf2,_0x234aa8,_0x33c6c1){var _0x3529b5;var _0x22c297='';var _0x150f1c=_0x04f3('0x59');return db[_0x04f3('0x30')][_0x04f3('0x5a')]({'where':{'id':_0xda0bf2[_0x04f3('0x4c')]['id']},'attributes':['id',_0x04f3('0x5b'),_0x04f3('0x5c'),_0x04f3('0x5d'),'username',_0x04f3('0x5e'),'securityToken']})[_0x04f3('0x29')](handleEntityNotFound(_0x234aa8,null))[_0x04f3('0x29')](function(_0x2a4558){if(_0x2a4558){_0x22c297=_0x2a4558[_0x04f3('0x5b')];var _0x2f9651=_0x22c297[_0x04f3('0x5f')](-0x1);if(_0x2f9651==='/'){_0x22c297=_0x22c297[_0x04f3('0x60')](0x0,_0x22c297[_0x04f3('0x61')](_0x2f9651));}_0x3529b5=new jsforce['Connection']({'oauth2':{'loginUrl':_0x22c297,'clientId':_0x2a4558['clientId'],'clientSecret':_0x2a4558['clientSecret']}});return _0x3529b5['login'](_0x2a4558[_0x04f3('0x62')],_0x2a4558[_0x04f3('0x5e')][_0x04f3('0x63')](_0x2a4558[_0x04f3('0x64')]));}})['then'](function(_0x541c85){if(_0x541c85){if(!_[_0x04f3('0x65')](_0xda0bf2[_0x04f3('0x34')][_0x04f3('0x66')])){_0x150f1c=_0xda0bf2['query'][_0x04f3('0x66')];}return _0x3529b5[_0x04f3('0x67')](_0x150f1c)[_0x04f3('0x68')]();}})[_0x04f3('0x29')](function(_0x1f77e1){var _0x16fcef=[_0x04f3('0x69'),_0x04f3('0x6a'),_0x04f3('0x6b'),_0x04f3('0x6c'),_0x04f3('0x6d'),_0x04f3('0x6e')];var _0x96faf1=[_0x04f3('0x6f'),_0x04f3('0x70'),_0x04f3('0x71'),_0x04f3('0x72'),_0x04f3('0x73'),_0x04f3('0x74'),_0x04f3('0x75')];if(_0x1f77e1){_[_0x04f3('0x76')](_0x1f77e1[_0x04f3('0x39')],function(_0x2a650b){return _0x16fcef[_0x04f3('0x77')](_0x2a650b[_0x04f3('0x2d')])||!_0x96faf1['includes'](_0x2a650b[_0x04f3('0x41')]);});return{'count':_0x1f77e1[_0x04f3('0x39')][_0x04f3('0x3a')],'rows':_[_0x04f3('0x2f')](_0x1f77e1[_0x04f3('0x39')],function(_0x1357db){return{'id':_0x1357db[_0x04f3('0x2d')],'name':_0x1357db['label'],'custom':_0x1357db[_0x04f3('0x78')],'options':_0x1357db[_0x04f3('0x79')]['length']>0x0?_['map'](_0x1357db[_0x04f3('0x79')],function(_0x1d80cd){return{'name':_0x1d80cd[_0x04f3('0x7a')],'value':_0x1d80cd[_0x04f3('0x7b')]};}):_0x1357db['type']=='boolean'?[{'name':_0x04f3('0x7c'),'value':_0x04f3('0x7d')},{'name':_0x04f3('0x7e'),'value':_0x04f3('0x7f')}]:[]};})};}})[_0x04f3('0x29')](respondWithResult(_0x234aa8,null))['catch'](function(_0x220b3c){var _0x514862=_0xda0bf2[_0x04f3('0x34')][_0x04f3('0x80')]?0x1f4:_0x220b3c[_0x04f3('0x81')]||0x1f4;logger[_0x04f3('0x2b')]('getFields,\x20%s,\x20%s,\x20%s',_0x04f3('0x58'),_0x514862,JSON[_0x04f3('0x82')](_0x220b3c));delete _0x220b3c['name'];if(_0x514862===0x191){_0x514862=0x190;}_0x234aa8[_0x04f3('0x1d')](_0x514862)[_0x04f3('0x83')](_0xda0bf2['query'][_0x04f3('0x80')]?{'message':_0x04f3('0x84'),'statusCode':_0x220b3c[_0x04f3('0x81')]}:_0x220b3c);});}; \ No newline at end of file +var _0xd4c9=['clientId','securityToken','slice','substring','lastIndexOf','clientSecret','login','username','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','Subjects','channel','SalesforceField','getFields','Task','remoteUri'];(function(_0x1b9213,_0x4a939f){var _0x5eae1e=function(_0x17566d){while(--_0x17566d){_0x1b9213['push'](_0x1b9213['shift']());}};_0x5eae1e(++_0x4a939f);}(_0xd4c9,0x190));var _0x9d4c=function(_0x468a77,_0x1382be){_0x468a77=_0x468a77-0x0;var _0x2d1c33=_0xd4c9[_0x468a77];return _0x2d1c33;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d4c('0x0'));var zipdir=require(_0x9d4c('0x1'));var jsonpatch=require(_0x9d4c('0x2'));var rp=require(_0x9d4c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9d4c('0x4'));var util=require(_0x9d4c('0x5'));var path=require(_0x9d4c('0x6'));var sox=require(_0x9d4c('0x7'));var csv=require(_0x9d4c('0x8'));var ejs=require(_0x9d4c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d4c('0xa'));var squel=require(_0x9d4c('0xb'));var crypto=require(_0x9d4c('0xc'));var jsforce=require(_0x9d4c('0xd'));var deskjs=require(_0x9d4c('0xe'));var toCsv=require(_0x9d4c('0x8'));var querystring=require(_0x9d4c('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9d4c('0x10'));var qs=require(_0x9d4c('0x11'));var as=require(_0x9d4c('0x12'));var hardwareService=require(_0x9d4c('0x13'));var logger=require(_0x9d4c('0x14'))(_0x9d4c('0x15'));var utils=require(_0x9d4c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9d4c('0x17'))['db'];var integrations=require(_0x9d4c('0x18'));function respondWithStatusCode(_0x378c82,_0x1078aa){_0x1078aa=_0x1078aa||0xcc;return function(_0x408cb3){if(_0x408cb3){return _0x378c82['sendStatus'](_0x1078aa);}return _0x378c82[_0x9d4c('0x19')](_0x1078aa)[_0x9d4c('0x1a')]();};}function respondWithResult(_0x34703d,_0x3364f5){_0x3364f5=_0x3364f5||0xc8;return function(_0x5e9448){if(_0x5e9448){return _0x34703d['status'](_0x3364f5)[_0x9d4c('0x1b')](_0x5e9448);}};}function respondWithFilteredResult(_0x5341e3,_0x218c92){return function(_0x43abc1){if(_0x43abc1){var _0x7cb1c4=typeof _0x218c92[_0x9d4c('0x1c')]==='undefined'&&typeof _0x218c92[_0x9d4c('0x1d')]==='undefined';var _0x169e95=_0x43abc1[_0x9d4c('0x1e')];var _0x2c2699=_0x7cb1c4?0x0:_0x218c92['offset'];var _0x4d6686=_0x7cb1c4?_0x43abc1[_0x9d4c('0x1e')]:_0x218c92[_0x9d4c('0x1c')]+_0x218c92[_0x9d4c('0x1d')];var _0x41a567;if(_0x4d6686>=_0x169e95){_0x4d6686=_0x169e95;_0x41a567=0xc8;}else{_0x41a567=0xce;}_0x5341e3[_0x9d4c('0x19')](_0x41a567);return _0x5341e3['set'](_0x9d4c('0x1f'),_0x2c2699+'-'+_0x4d6686+'/'+_0x169e95)['json'](_0x43abc1);}return null;};}function patchUpdates(_0x3e0dcd){return function(_0x1c477f){try{jsonpatch[_0x9d4c('0x20')](_0x1c477f,_0x3e0dcd,!![]);}catch(_0x5b7f00){return BPromise[_0x9d4c('0x21')](_0x5b7f00);}return _0x1c477f['save']();};}function saveUpdates(_0x3be1ea,_0x596f46){return function(_0x44bc5e){if(_0x44bc5e){return _0x44bc5e[_0x9d4c('0x22')](_0x3be1ea)[_0x9d4c('0x23')](function(_0x16d092){return _0x16d092;});}return null;};}function removeEntity(_0x5009df,_0x3f9487){return function(_0x33205a){if(_0x33205a){return _0x33205a[_0x9d4c('0x24')]()[_0x9d4c('0x23')](function(){_0x5009df[_0x9d4c('0x19')](0xcc)[_0x9d4c('0x1a')]();});}};}function handleEntityNotFound(_0x45bf0a,_0x49444b){return function(_0x224d06){if(!_0x224d06){_0x45bf0a[_0x9d4c('0x25')](0x194);}return _0x224d06;};}function handleError(_0x30ce56,_0x1c71b8){_0x1c71b8=_0x1c71b8||0x1f4;return function(_0x5a0ccc){logger['error'](_0x5a0ccc[_0x9d4c('0x26')]);if(_0x5a0ccc[_0x9d4c('0x27')]){delete _0x5a0ccc[_0x9d4c('0x27')];}_0x30ce56[_0x9d4c('0x19')](_0x1c71b8)[_0x9d4c('0x28')](_0x5a0ccc);};}exports[_0x9d4c('0x29')]=function(_0x106f89,_0x3086ef){var _0x12d2b2={},_0x5e5be5={},_0x1b1081={'count':0x0,'rows':[]};var _0x1fcc5a=_['map'](db[_0x9d4c('0x2a')][_0x9d4c('0x2b')],function(_0x47fb69){return{'name':_0x47fb69[_0x9d4c('0x2c')],'type':_0x47fb69['type'][_0x9d4c('0x2d')]};});_0x5e5be5[_0x9d4c('0x2e')]=_[_0x9d4c('0x2f')](_0x1fcc5a,_0x9d4c('0x27'));_0x5e5be5[_0x9d4c('0x30')]=_[_0x9d4c('0x31')](_0x106f89[_0x9d4c('0x30')]);_0x5e5be5[_0x9d4c('0x32')]=_[_0x9d4c('0x33')](_0x5e5be5[_0x9d4c('0x2e')],_0x5e5be5['query']);_0x12d2b2[_0x9d4c('0x34')]=_[_0x9d4c('0x33')](_0x5e5be5[_0x9d4c('0x2e')],qs[_0x9d4c('0x35')](_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x35')]));_0x12d2b2[_0x9d4c('0x34')]=_0x12d2b2['attributes']['length']?_0x12d2b2[_0x9d4c('0x34')]:_0x5e5be5[_0x9d4c('0x2e')];if(!_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x36')](_0x9d4c('0x37'))){_0x12d2b2['limit']=qs[_0x9d4c('0x1d')](_0x106f89[_0x9d4c('0x30')]['limit']);_0x12d2b2[_0x9d4c('0x1c')]=qs['offset'](_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x1c')]);}_0x12d2b2[_0x9d4c('0x38')]=qs[_0x9d4c('0x39')](_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x39')]);_0x12d2b2[_0x9d4c('0x3a')]=qs[_0x9d4c('0x32')](_['pick'](_0x106f89[_0x9d4c('0x30')],_0x5e5be5[_0x9d4c('0x32')]),_0x1fcc5a);if(_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x3b')]){_0x12d2b2[_0x9d4c('0x3a')]=_[_0x9d4c('0x3c')](_0x12d2b2[_0x9d4c('0x3a')],{'$or':_['map'](_0x1fcc5a,function(_0x267607){if(_0x267607[_0x9d4c('0x3d')]!==_0x9d4c('0x3e')){var _0x417beb={};_0x417beb[_0x267607[_0x9d4c('0x27')]]={'$like':'%'+_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x3b')]+'%'};return _0x417beb;}})});}_0x12d2b2=_[_0x9d4c('0x3c')]({},_0x12d2b2,_0x106f89[_0x9d4c('0x3f')]);var _0x49f7a5={'where':_0x12d2b2[_0x9d4c('0x3a')]};return db['SalesforceAccount']['count'](_0x49f7a5)[_0x9d4c('0x23')](function(_0x23f516){_0x1b1081[_0x9d4c('0x1e')]=_0x23f516;if(_0x106f89[_0x9d4c('0x30')][_0x9d4c('0x40')]){_0x12d2b2[_0x9d4c('0x41')]=[{'all':!![]}];}return db[_0x9d4c('0x2a')]['findAll'](_0x12d2b2);})[_0x9d4c('0x23')](function(_0x57e7b2){_0x1b1081[_0x9d4c('0x42')]=_0x57e7b2;return _0x1b1081;})['then'](respondWithFilteredResult(_0x3086ef,_0x12d2b2))[_0x9d4c('0x43')](handleError(_0x3086ef,null));};exports[_0x9d4c('0x44')]=function(_0x592da7,_0x387ed4){var _0x466987={'raw':![],'where':{'id':_0x592da7[_0x9d4c('0x45')]['id']}},_0x4fd688={};_0x4fd688[_0x9d4c('0x2e')]=_[_0x9d4c('0x31')](db[_0x9d4c('0x2a')][_0x9d4c('0x2b')]);_0x4fd688[_0x9d4c('0x30')]=_[_0x9d4c('0x31')](_0x592da7['query']);_0x4fd688[_0x9d4c('0x32')]=_[_0x9d4c('0x33')](_0x4fd688[_0x9d4c('0x2e')],_0x4fd688[_0x9d4c('0x30')]);_0x466987[_0x9d4c('0x34')]=_[_0x9d4c('0x33')](_0x4fd688[_0x9d4c('0x2e')],qs['fields'](_0x592da7[_0x9d4c('0x30')][_0x9d4c('0x35')]));_0x466987[_0x9d4c('0x34')]=_0x466987['attributes'][_0x9d4c('0x46')]?_0x466987[_0x9d4c('0x34')]:_0x4fd688['model'];if(_0x592da7['query'][_0x9d4c('0x40')]){_0x466987[_0x9d4c('0x41')]=[{'all':!![]}];}_0x466987=_['merge']({},_0x466987,_0x592da7['options']);return db['SalesforceAccount'][_0x9d4c('0x47')](_0x466987)[_0x9d4c('0x23')](handleEntityNotFound(_0x387ed4,null))[_0x9d4c('0x23')](respondWithResult(_0x387ed4,null))['catch'](handleError(_0x387ed4,null));};exports['create']=function(_0x129eb7,_0x1b5918){return db[_0x9d4c('0x2a')][_0x9d4c('0x48')](_0x129eb7[_0x9d4c('0x49')],{})[_0x9d4c('0x23')](respondWithResult(_0x1b5918,0xc9))['catch'](handleError(_0x1b5918,null));};exports[_0x9d4c('0x22')]=function(_0x3a617a,_0x2cbc35){if(_0x3a617a[_0x9d4c('0x49')]['id']){delete _0x3a617a[_0x9d4c('0x49')]['id'];}return db['SalesforceAccount'][_0x9d4c('0x47')]({'where':{'id':_0x3a617a[_0x9d4c('0x45')]['id']}})[_0x9d4c('0x23')](handleEntityNotFound(_0x2cbc35,null))[_0x9d4c('0x23')](saveUpdates(_0x3a617a[_0x9d4c('0x49')],null))[_0x9d4c('0x23')](respondWithResult(_0x2cbc35,null))['catch'](handleError(_0x2cbc35,null));};exports[_0x9d4c('0x24')]=function(_0x30871e,_0x140da5){return db[_0x9d4c('0x2a')]['find']({'where':{'id':_0x30871e[_0x9d4c('0x45')]['id']}})[_0x9d4c('0x23')](handleEntityNotFound(_0x140da5,null))['then'](removeEntity(_0x140da5,null))[_0x9d4c('0x43')](handleError(_0x140da5,null));};exports[_0x9d4c('0x4a')]=function(_0x281a01,_0x383b8b,_0x2ace08){var _0x3a2760={};var _0x5aca14={};var _0x3978ad;var _0x19d99a;return db[_0x9d4c('0x2a')][_0x9d4c('0x4b')]({'where':{'id':_0x281a01['params']['id']}})['then'](handleEntityNotFound(_0x383b8b,null))[_0x9d4c('0x23')](function(_0x1374cf){if(_0x1374cf){_0x3978ad=_0x1374cf;_0x5aca14[_0x9d4c('0x2e')]=_[_0x9d4c('0x31')](db[_0x9d4c('0x4c')][_0x9d4c('0x2b')]);_0x5aca14[_0x9d4c('0x30')]=_['keys'](_0x281a01[_0x9d4c('0x30')]);_0x5aca14['filters']=_[_0x9d4c('0x33')](_0x5aca14[_0x9d4c('0x2e')],_0x5aca14['query']);_0x3a2760['attributes']=_[_0x9d4c('0x33')](_0x5aca14[_0x9d4c('0x2e')],qs[_0x9d4c('0x35')](_0x281a01['query'][_0x9d4c('0x35')]));_0x3a2760['attributes']=_0x3a2760['attributes'][_0x9d4c('0x46')]?_0x3a2760[_0x9d4c('0x34')]:_0x5aca14[_0x9d4c('0x2e')];_0x3a2760['order']=qs[_0x9d4c('0x39')](_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x39')]);_0x3a2760['where']=qs[_0x9d4c('0x32')](_[_0x9d4c('0x4d')](_0x281a01[_0x9d4c('0x30')],_0x5aca14[_0x9d4c('0x32')]));if(_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x3b')]){_0x3a2760['where']=_[_0x9d4c('0x3c')](_0x3a2760[_0x9d4c('0x3a')],{'$or':_[_0x9d4c('0x2f')](_0x3a2760[_0x9d4c('0x34')],function(_0x161e99){var _0x5bbd61={};_0x5bbd61[_0x161e99]={'$like':'%'+_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x3b')]+'%'};return _0x5bbd61;})});}_0x3a2760=_[_0x9d4c('0x3c')]({},_0x3a2760,_0x281a01[_0x9d4c('0x3f')]);return _0x3978ad[_0x9d4c('0x4a')](_0x3a2760);}})['then'](function(_0x341026){if(_0x341026){_0x19d99a=_0x341026[_0x9d4c('0x46')];if(!_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x36')]('nolimit')){_0x3a2760[_0x9d4c('0x1d')]=qs[_0x9d4c('0x1d')](_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x1d')]);_0x3a2760[_0x9d4c('0x1c')]=qs['offset'](_0x281a01[_0x9d4c('0x30')][_0x9d4c('0x1c')]);}return _0x3978ad[_0x9d4c('0x4a')](_0x3a2760);}})[_0x9d4c('0x23')](function(_0x4121a3){if(_0x4121a3){return _0x4121a3?{'count':_0x19d99a,'rows':_0x4121a3}:null;}})['then'](respondWithResult(_0x383b8b,null))[_0x9d4c('0x43')](handleError(_0x383b8b,null));};exports['addConfiguration']=function(_0x5cfddd,_0x3ea2ad,_0x3e663d){if(_0x5cfddd[_0x9d4c('0x49')]['id']){delete _0x5cfddd[_0x9d4c('0x49')]['id'];}return db[_0x9d4c('0x2a')][_0x9d4c('0x4b')]({'where':{'id':_0x5cfddd[_0x9d4c('0x45')]['id']}})[_0x9d4c('0x23')](handleEntityNotFound(_0x3ea2ad,null))[_0x9d4c('0x23')](function(_0x7d7c6a){if(_0x7d7c6a){_0x5cfddd[_0x9d4c('0x49')]['AccountId']=_0x7d7c6a['id'];_0x5cfddd[_0x9d4c('0x49')][_0x9d4c('0x4e')]=integrations['getSubjects'](_0x5cfddd['body'][_0x9d4c('0x4f')],_0x5cfddd[_0x9d4c('0x49')][_0x9d4c('0x3d')]);_0x5cfddd[_0x9d4c('0x49')]['Descriptions']=integrations['getDescriptions'](_0x5cfddd[_0x9d4c('0x49')][_0x9d4c('0x4f')],_0x5cfddd[_0x9d4c('0x49')]['type']);return db[_0x9d4c('0x4c')][_0x9d4c('0x48')](_0x5cfddd[_0x9d4c('0x49')],{'include':[{'model':db[_0x9d4c('0x50')],'as':_0x9d4c('0x4e')},{'model':db[_0x9d4c('0x50')],'as':'Descriptions'}]});}return null;})[_0x9d4c('0x23')](respondWithResult(_0x3ea2ad,null))[_0x9d4c('0x43')](handleError(_0x3ea2ad,null));};exports[_0x9d4c('0x51')]=function(_0x44f782,_0x4c3b31,_0x66f6){var _0x3dd4f9;var _0x5e5876='';var _0x1d1a85=_0x9d4c('0x52');return db['SalesforceAccount'][_0x9d4c('0x4b')]({'where':{'id':_0x44f782['params']['id']},'attributes':['id',_0x9d4c('0x53'),_0x9d4c('0x54'),'clientSecret','username','password',_0x9d4c('0x55')]})[_0x9d4c('0x23')](handleEntityNotFound(_0x4c3b31,null))[_0x9d4c('0x23')](function(_0x2bb843){if(_0x2bb843){_0x5e5876=_0x2bb843['remoteUri'];var _0x511de8=_0x5e5876[_0x9d4c('0x56')](-0x1);if(_0x511de8==='/'){_0x5e5876=_0x5e5876[_0x9d4c('0x57')](0x0,_0x5e5876[_0x9d4c('0x58')](_0x511de8));}_0x3dd4f9=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5e5876,'clientId':_0x2bb843[_0x9d4c('0x54')],'clientSecret':_0x2bb843[_0x9d4c('0x59')]}});return _0x3dd4f9[_0x9d4c('0x5a')](_0x2bb843[_0x9d4c('0x5b')],_0x2bb843['password'][_0x9d4c('0x5c')](_0x2bb843['securityToken']));}})[_0x9d4c('0x23')](function(_0x2efff6){if(_0x2efff6){if(!_[_0x9d4c('0x5d')](_0x44f782[_0x9d4c('0x30')][_0x9d4c('0x5e')])){_0x1d1a85=_0x44f782[_0x9d4c('0x30')][_0x9d4c('0x5e')];}return _0x3dd4f9[_0x9d4c('0x5f')](_0x1d1a85)[_0x9d4c('0x60')]();}})[_0x9d4c('0x23')](function(_0x26c469){var _0x43280d=[_0x9d4c('0x61'),_0x9d4c('0x62'),_0x9d4c('0x63'),_0x9d4c('0x64'),_0x9d4c('0x65'),'Description'];var _0x575d57=[_0x9d4c('0x66'),'int',_0x9d4c('0x67'),_0x9d4c('0x68'),_0x9d4c('0x69'),_0x9d4c('0x6a'),_0x9d4c('0x6b')];if(_0x26c469){_[_0x9d4c('0x6c')](_0x26c469[_0x9d4c('0x35')],function(_0x4ee236){return _0x43280d[_0x9d4c('0x6d')](_0x4ee236[_0x9d4c('0x27')])||!_0x575d57[_0x9d4c('0x6d')](_0x4ee236[_0x9d4c('0x3d')]);});return{'count':_0x26c469[_0x9d4c('0x35')][_0x9d4c('0x46')],'rows':_['map'](_0x26c469[_0x9d4c('0x35')],function(_0x4e2138){return{'id':_0x4e2138[_0x9d4c('0x27')],'name':_0x4e2138[_0x9d4c('0x6e')],'custom':_0x4e2138[_0x9d4c('0x6f')],'options':_0x4e2138[_0x9d4c('0x70')][_0x9d4c('0x46')]>0x0?_[_0x9d4c('0x2f')](_0x4e2138[_0x9d4c('0x70')],function(_0x70c479){return{'name':_0x70c479[_0x9d4c('0x6e')],'value':_0x70c479[_0x9d4c('0x71')]};}):_0x4e2138['type']=='boolean'?[{'name':'True','value':_0x9d4c('0x72')},{'name':_0x9d4c('0x73'),'value':'false'}]:[]};})};}})[_0x9d4c('0x23')](respondWithResult(_0x4c3b31,null))[_0x9d4c('0x43')](function(_0x901677){var _0xe918ad=_0x44f782[_0x9d4c('0x30')][_0x9d4c('0x74')]?0x1f4:_0x901677[_0x9d4c('0x75')]||0x1f4;logger['error'](_0x9d4c('0x76'),_0x9d4c('0x51'),_0xe918ad,JSON[_0x9d4c('0x77')](_0x901677));delete _0x901677[_0x9d4c('0x27')];if(_0xe918ad===0x191){_0xe918ad=0x190;}_0x4c3b31[_0x9d4c('0x19')](_0xe918ad)[_0x9d4c('0x28')](_0x44f782[_0x9d4c('0x30')][_0x9d4c('0x74')]?{'message':_0x9d4c('0x78'),'statusCode':_0x901677[_0x9d4c('0x75')]}:_0x901677);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 225b769..a914069 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 _0x993c=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger'];(function(_0x12e7c9,_0x3c852b){var _0x42703c=function(_0x1cef79){while(--_0x1cef79){_0x12e7c9['push'](_0x12e7c9['shift']());}};_0x42703c(++_0x3c852b);}(_0x993c,0x97));var _0xc993=function(_0x3f48e5,_0x283064){_0x3f48e5=_0x3f48e5-0x0;var _0x2c1a9d=_0x993c[_0x3f48e5];return _0x2c1a9d;};'use strict';var _=require(_0xc993('0x0'));var util=require(_0xc993('0x1'));var logger=require(_0xc993('0x2'))(_0xc993('0x3'));var moment=require('moment');var BPromise=require(_0xc993('0x4'));var rp=require(_0xc993('0x5'));var fs=require('fs');var path=require(_0xc993('0x6'));var rimraf=require(_0xc993('0x7'));var config=require(_0xc993('0x8'));var attributes=require(_0xc993('0x9'));var integrations=require(_0xc993('0xa'));module[_0xc993('0xb')]=function(_0x3ef79b,_0x444830){return _0x3ef79b[_0xc993('0xc')](_0xc993('0xd'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d32=['../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceAccount.attributes','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util'];(function(_0x256f06,_0x6a4413){var _0x1c00fb=function(_0x115ce5){while(--_0x115ce5){_0x256f06['push'](_0x256f06['shift']());}};_0x1c00fb(++_0x6a4413);}(_0x2d32,0xf5));var _0x22d3=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2d32[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x22d3('0x0'));var util=require(_0x22d3('0x1'));var logger=require(_0x22d3('0x2'))(_0x22d3('0x3'));var moment=require(_0x22d3('0x4'));var BPromise=require(_0x22d3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x22d3('0x6'));var rimraf=require(_0x22d3('0x7'));var config=require('../../config/environment');var attributes=require(_0x22d3('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x22d3('0x9')]=function(_0x31da8f,_0x20d7d1){return _0x31da8f[_0x22d3('0xa')](_0x22d3('0xb'),attributes,{'tableName':_0x22d3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index bb4fa2e..555a375 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 _0xe367=['attributes','limit','include','model','map','ShowSalesforceAccount','where','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw'];(function(_0x2449d8,_0x222a8d){var _0x2d274a=function(_0x398bc9){while(--_0x398bc9){_0x2449d8['push'](_0x2449d8['shift']());}};_0x2d274a(++_0x222a8d);}(_0xe367,0x10f));var _0x7e36=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe367[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7e36('0x0'));var util=require(_0x7e36('0x1'));var moment=require(_0x7e36('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e36('0x3'));var db=require(_0x7e36('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e36('0x5'))(_0x7e36('0x6'));var config=require(_0x7e36('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7e36('0x8')][_0x7e36('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e7c9d,_0x39cef3,_0x435088){return new BPromise(function(_0x27a14b,_0x3afe26){return client[_0x7e36('0xa')](_0x3e7c9d,_0x435088)[_0x7e36('0xb')](function(_0x38f75e){logger[_0x7e36('0xc')](_0x7e36('0xd'),_0x39cef3,_0x7e36('0xe'));logger[_0x7e36('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x39cef3,_0x7e36('0xe'),JSON[_0x7e36('0x10')](_0x38f75e));if(_0x38f75e[_0x7e36('0x11')]){if(_0x38f75e[_0x7e36('0x11')]['code']===0x1f4){logger[_0x7e36('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x39cef3,_0x38f75e[_0x7e36('0x11')][_0x7e36('0x12')]);return _0x3afe26(_0x38f75e[_0x7e36('0x11')][_0x7e36('0x12')]);}logger['error'](_0x7e36('0xd'),_0x39cef3,_0x38f75e[_0x7e36('0x11')][_0x7e36('0x12')]);return _0x27a14b(_0x38f75e[_0x7e36('0x11')][_0x7e36('0x12')]);}else{logger[_0x7e36('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x39cef3,_0x7e36('0xe'));_0x27a14b(_0x38f75e[_0x7e36('0x13')][_0x7e36('0x12')]);}})[_0x7e36('0x14')](function(_0x243f8e){logger['error'](_0x7e36('0xd'),_0x39cef3,_0x243f8e);_0x3afe26(_0x243f8e);});});}exports[_0x7e36('0x15')]=function(_0x34574e){var _0xf210c8=this;return new Promise(function(_0x1d2226,_0xa28dda){return db[_0x7e36('0x16')][_0x7e36('0x17')]({'raw':_0x34574e[_0x7e36('0x18')]?_0x34574e[_0x7e36('0x18')][_0x7e36('0x19')]===undefined?!![]:![]:!![],'where':_0x34574e[_0x7e36('0x18')]?_0x34574e[_0x7e36('0x18')]['where']||null:null,'attributes':_0x34574e[_0x7e36('0x18')]?_0x34574e[_0x7e36('0x18')][_0x7e36('0x1a')]||null:null,'limit':_0x34574e[_0x7e36('0x18')]?_0x34574e[_0x7e36('0x18')][_0x7e36('0x1b')]||null:null,'include':_0x34574e['options']?_0x34574e[_0x7e36('0x18')]['include']?_['map'](_0x34574e[_0x7e36('0x18')][_0x7e36('0x1c')],function(_0x431f3e){return{'model':db[_0x431f3e[_0x7e36('0x1d')]],'as':_0x431f3e['as'],'attributes':_0x431f3e['attributes'],'include':_0x431f3e[_0x7e36('0x1c')]?_[_0x7e36('0x1e')](_0x431f3e['include'],function(_0x39748d){return{'model':db[_0x39748d[_0x7e36('0x1d')]],'as':_0x39748d['as'],'attributes':_0x39748d[_0x7e36('0x1a')],'include':_0x39748d[_0x7e36('0x1c')]?_[_0x7e36('0x1e')](_0x39748d[_0x7e36('0x1c')],function(_0x2597aa){return{'model':db[_0x2597aa['model']],'as':_0x2597aa['as'],'attributes':_0x2597aa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5872a8){logger[_0x7e36('0xc')](_0x7e36('0x15'),_0x34574e);logger[_0x7e36('0xf')]('GetSalesforceAccount',_0x34574e,JSON['stringify'](_0x5872a8));_0x1d2226(_0x5872a8);})['catch'](function(_0x5b8282){logger[_0x7e36('0x11')](_0x7e36('0x15'),_0x5b8282[_0x7e36('0x12')],_0x34574e);_0xa28dda(_0xf210c8[_0x7e36('0x11')](0x1f4,_0x5b8282['message']));});});};exports[_0x7e36('0x1f')]=function(_0x5cd59e){var _0x3ab4d9=this;return new Promise(function(_0x4a157c,_0x3cbc0b){return db[_0x7e36('0x16')]['find']({'raw':_0x5cd59e[_0x7e36('0x18')]?_0x5cd59e[_0x7e36('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5cd59e['options']?_0x5cd59e[_0x7e36('0x18')][_0x7e36('0x20')]||null:null,'attributes':_0x5cd59e[_0x7e36('0x18')]?_0x5cd59e[_0x7e36('0x18')][_0x7e36('0x1a')]||null:null,'include':_0x5cd59e[_0x7e36('0x18')]?_0x5cd59e[_0x7e36('0x18')][_0x7e36('0x1c')]?_[_0x7e36('0x1e')](_0x5cd59e[_0x7e36('0x18')][_0x7e36('0x1c')],function(_0xe1fd5e){return{'model':db[_0xe1fd5e['model']],'as':_0xe1fd5e['as'],'attributes':_0xe1fd5e[_0x7e36('0x1a')],'include':_0xe1fd5e[_0x7e36('0x1c')]?_[_0x7e36('0x1e')](_0xe1fd5e[_0x7e36('0x1c')],function(_0x2e015e){return{'model':db[_0x2e015e['model']],'as':_0x2e015e['as'],'attributes':_0x2e015e['attributes'],'include':_0x2e015e[_0x7e36('0x1c')]?_['map'](_0x2e015e['include'],function(_0x5ef48f){return{'model':db[_0x5ef48f[_0x7e36('0x1d')]],'as':_0x5ef48f['as'],'attributes':_0x5ef48f[_0x7e36('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7e36('0xb')](function(_0x5712df){logger[_0x7e36('0xc')](_0x7e36('0x1f'),_0x5cd59e);logger[_0x7e36('0xf')]('ShowSalesforceAccount',_0x5cd59e,JSON['stringify'](_0x5712df));_0x4a157c(_0x5712df);})[_0x7e36('0x14')](function(_0x16c159){logger[_0x7e36('0x11')]('ShowSalesforceAccount',_0x16c159[_0x7e36('0x12')],_0x5cd59e);_0x3cbc0b(_0x3ab4d9[_0x7e36('0x11')](0x1f4,_0x16c159[_0x7e36('0x12')]));});});}; \ No newline at end of file +var _0xcd8d=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowSalesforceAccount','find','lodash','util','moment','bluebird','../../mysqldb','rpc'];(function(_0x2c8c72,_0x1b071b){var _0x136642=function(_0x368e0b){while(--_0x368e0b){_0x2c8c72['push'](_0x2c8c72['shift']());}};_0x136642(++_0x1b071b);}(_0xcd8d,0x13e));var _0xdcd8=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xcd8d[_0x13b7fd];return _0x32a74a;};'use strict';var _=require(_0xdcd8('0x0'));var util=require(_0xdcd8('0x1'));var moment=require(_0xdcd8('0x2'));var BPromise=require(_0xdcd8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcd8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdcd8('0x5'));var config=require(_0xdcd8('0x6'));var jayson=require(_0xdcd8('0x7'));var client=jayson[_0xdcd8('0x8')][_0xdcd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e3281,_0x2d42c8,_0x162ec0){return new BPromise(function(_0x2fe28f,_0x1d45d7){return client[_0xdcd8('0xa')](_0x2e3281,_0x162ec0)[_0xdcd8('0xb')](function(_0x3d4205){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x2d42c8,_0xdcd8('0xc'));logger['debug'](_0xdcd8('0xd'),_0x2d42c8,_0xdcd8('0xc'),JSON[_0xdcd8('0xe')](_0x3d4205));if(_0x3d4205['error']){if(_0x3d4205[_0xdcd8('0xf')][_0xdcd8('0x10')]===0x1f4){logger[_0xdcd8('0xf')](_0xdcd8('0x11'),_0x2d42c8,_0x3d4205[_0xdcd8('0xf')][_0xdcd8('0x12')]);return _0x1d45d7(_0x3d4205['error'][_0xdcd8('0x12')]);}logger[_0xdcd8('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x2d42c8,_0x3d4205[_0xdcd8('0xf')]['message']);return _0x2fe28f(_0x3d4205[_0xdcd8('0xf')][_0xdcd8('0x12')]);}else{logger[_0xdcd8('0x13')](_0xdcd8('0x11'),_0x2d42c8,_0xdcd8('0xc'));_0x2fe28f(_0x3d4205[_0xdcd8('0x14')]['message']);}})[_0xdcd8('0x15')](function(_0x5946c3){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x2d42c8,_0x5946c3);_0x1d45d7(_0x5946c3);});});}exports[_0xdcd8('0x16')]=function(_0x193d03){var _0x425cc2=this;return new Promise(function(_0x56d1aa,_0x593070){return db[_0xdcd8('0x17')][_0xdcd8('0x18')]({'raw':_0x193d03['options']?_0x193d03[_0xdcd8('0x19')][_0xdcd8('0x1a')]===undefined?!![]:![]:!![],'where':_0x193d03['options']?_0x193d03[_0xdcd8('0x19')][_0xdcd8('0x1b')]||null:null,'attributes':_0x193d03['options']?_0x193d03[_0xdcd8('0x19')][_0xdcd8('0x1c')]||null:null,'limit':_0x193d03['options']?_0x193d03[_0xdcd8('0x19')][_0xdcd8('0x1d')]||null:null,'include':_0x193d03[_0xdcd8('0x19')]?_0x193d03['options'][_0xdcd8('0x1e')]?_[_0xdcd8('0x1f')](_0x193d03[_0xdcd8('0x19')][_0xdcd8('0x1e')],function(_0x5422d2){return{'model':db[_0x5422d2[_0xdcd8('0x20')]],'as':_0x5422d2['as'],'attributes':_0x5422d2['attributes'],'include':_0x5422d2[_0xdcd8('0x1e')]?_[_0xdcd8('0x1f')](_0x5422d2[_0xdcd8('0x1e')],function(_0x1703ac){return{'model':db[_0x1703ac[_0xdcd8('0x20')]],'as':_0x1703ac['as'],'attributes':_0x1703ac[_0xdcd8('0x1c')],'include':_0x1703ac[_0xdcd8('0x1e')]?_['map'](_0x1703ac['include'],function(_0xbee263){return{'model':db[_0xbee263[_0xdcd8('0x20')]],'as':_0xbee263['as'],'attributes':_0xbee263[_0xdcd8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xdcd8('0xb')](function(_0x1e3581){logger[_0xdcd8('0x13')]('GetSalesforceAccount',_0x193d03);logger[_0xdcd8('0x21')]('GetSalesforceAccount',_0x193d03,JSON[_0xdcd8('0xe')](_0x1e3581));_0x56d1aa(_0x1e3581);})[_0xdcd8('0x15')](function(_0x3341ce){logger['error'](_0xdcd8('0x16'),_0x3341ce[_0xdcd8('0x12')],_0x193d03);_0x593070(_0x425cc2[_0xdcd8('0xf')](0x1f4,_0x3341ce['message']));});});};exports[_0xdcd8('0x22')]=function(_0x2d5778){var _0x23d501=this;return new Promise(function(_0x505abe,_0x4ff48a){return db[_0xdcd8('0x17')][_0xdcd8('0x23')]({'raw':_0x2d5778['options']?_0x2d5778[_0xdcd8('0x19')][_0xdcd8('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d5778[_0xdcd8('0x19')]?_0x2d5778[_0xdcd8('0x19')]['where']||null:null,'attributes':_0x2d5778['options']?_0x2d5778['options'][_0xdcd8('0x1c')]||null:null,'include':_0x2d5778[_0xdcd8('0x19')]?_0x2d5778[_0xdcd8('0x19')][_0xdcd8('0x1e')]?_[_0xdcd8('0x1f')](_0x2d5778[_0xdcd8('0x19')][_0xdcd8('0x1e')],function(_0x271eb6){return{'model':db[_0x271eb6[_0xdcd8('0x20')]],'as':_0x271eb6['as'],'attributes':_0x271eb6['attributes'],'include':_0x271eb6['include']?_['map'](_0x271eb6[_0xdcd8('0x1e')],function(_0x68ebe){return{'model':db[_0x68ebe[_0xdcd8('0x20')]],'as':_0x68ebe['as'],'attributes':_0x68ebe['attributes'],'include':_0x68ebe[_0xdcd8('0x1e')]?_['map'](_0x68ebe[_0xdcd8('0x1e')],function(_0x25ea12){return{'model':db[_0x25ea12[_0xdcd8('0x20')]],'as':_0x25ea12['as'],'attributes':_0x25ea12['attributes']};}):[]};}):[]};}):[]:[]})[_0xdcd8('0xb')](function(_0x44d8ee){logger[_0xdcd8('0x13')](_0xdcd8('0x22'),_0x2d5778);logger[_0xdcd8('0x21')](_0xdcd8('0x22'),_0x2d5778,JSON[_0xdcd8('0xe')](_0x44d8ee));_0x505abe(_0x44d8ee);})[_0xdcd8('0x15')](function(_0x2eb7a4){logger['error'](_0xdcd8('0x22'),_0x2eb7a4[_0xdcd8('0x12')],_0x2d5778);_0x4ff48a(_0x23d501['error'](0x1f4,_0x2eb7a4[_0xdcd8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 3f0c9de..3aec27d 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x33ead5,_0x5e26e0){var _0x1a84b0=function(_0xc66f20){while(--_0xc66f20){_0x33ead5['push'](_0x33ead5['shift']());}};_0x1a84b0(++_0x5e26e0);}(_0xadb5,0xad));var _0x5adb=function(_0x41cc4e,_0x4ee0ac){_0x41cc4e=_0x41cc4e-0x0;var _0x2d9484=_0xadb5[_0x41cc4e];return _0x2d9484;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xdb28,0x106));var _0x8db2=function(_0x5c597b,_0x5f0832){_0x5c597b=_0x5c597b-0x0;var _0x3f6d7a=_0xdb28[_0x5c597b];return _0x3f6d7a;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 90c9cee..2f9fa31 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 _0xedb4=['lead','exports','STRING','ENUM','Task','Case','contact_lead','contact','account_contact_lead','account','nothing'];(function(_0x54a858,_0x13d6d6){var _0x1cc506=function(_0x53ebb2){while(--_0x53ebb2){_0x54a858['push'](_0x54a858['shift']());}};_0x1cc506(++_0x13d6d6);}(_0xedb4,0x156));var _0x4edb=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0xedb4[_0x292f93];return _0x5a94b1;};'use strict';var Sequelize=require('sequelize');module[_0x4edb('0x0')]={'name':{'type':Sequelize[_0x4edb('0x1')]},'description':{'type':Sequelize[_0x4edb('0x1')]},'ticketType':{'type':Sequelize[_0x4edb('0x2')](_0x4edb('0x3'),_0x4edb('0x4')),'defaultValue':_0x4edb('0x3')},'moduleSearch':{'type':Sequelize[_0x4edb('0x2')](_0x4edb('0x5'),_0x4edb('0x6'),'lead',_0x4edb('0x7'),_0x4edb('0x8')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x4edb('0x2')](_0x4edb('0x9'),'contact',_0x4edb('0xa'),_0x4edb('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x4edb('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x4edb('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x4edb('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x4edb('0x1')]}}; \ No newline at end of file +var _0x737e=['sequelize','exports','STRING','Task','contact','lead','account_contact_lead','account','contact_lead','nothing'];(function(_0x2f42e6,_0x492225){var _0x23345f=function(_0x3ea50a){while(--_0x3ea50a){_0x2f42e6['push'](_0x2f42e6['shift']());}};_0x23345f(++_0x492225);}(_0x737e,0x1cc));var _0xe737=function(_0x332f72,_0x4f2e5e){_0x332f72=_0x332f72-0x0;var _0xba5607=_0x737e[_0x332f72];return _0xba5607;};'use strict';var Sequelize=require(_0xe737('0x0'));module[_0xe737('0x1')]={'name':{'type':Sequelize[_0xe737('0x2')]},'description':{'type':Sequelize[_0xe737('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xe737('0x3'),'Case'),'defaultValue':_0xe737('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xe737('0x4'),_0xe737('0x5'),_0xe737('0x6'),_0xe737('0x7')),'defaultValue':_0xe737('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0xe737('0x9'),'contact',_0xe737('0x5'),_0xe737('0x7')),'defaultValue':_0xe737('0x5')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xe737('0x2')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xe737('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8269f03..f625fea 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 _0xa12b=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','limit','status','set','apply','reject','save','then','destroy','error','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','update','getFields','findOne','SalesforceField','order','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs'];(function(_0x3f16bc,_0x467768){var _0x489881=function(_0x54a246){while(--_0x54a246){_0x3f16bc['push'](_0x3f16bc['shift']());}};_0x489881(++_0x467768);}(_0xa12b,0x175));var _0xba12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa12b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xba12('0x0'));var rimraf=require(_0xba12('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba12('0x2'));var rp=require('request-promise');var moment=require(_0xba12('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xba12('0x4'));var util=require('util');var path=require(_0xba12('0x5'));var sox=require(_0xba12('0x6'));var csv=require(_0xba12('0x7'));var ejs=require(_0xba12('0x8'));var fs=require('fs');var fs_extra=require(_0xba12('0x9'));var _=require(_0xba12('0xa'));var squel=require(_0xba12('0xb'));var crypto=require(_0xba12('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xba12('0x7'));var querystring=require(_0xba12('0xd'));var Papa=require(_0xba12('0xe'));var Redis=require(_0xba12('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xba12('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba12('0x11'));var logger=require(_0xba12('0x12'))(_0xba12('0x13'));var utils=require('../../config/utils');var config=require(_0xba12('0x14'));var licenseUtil=require(_0xba12('0x15'));var db=require(_0xba12('0x16'))['db'];function respondWithStatusCode(_0x4f3cc4,_0xf36ac6){_0xf36ac6=_0xf36ac6||0xcc;return function(_0x4907c9){if(_0x4907c9){return _0x4f3cc4[_0xba12('0x17')](_0xf36ac6);}return _0x4f3cc4['status'](_0xf36ac6)['end']();};}function respondWithResult(_0x30742f,_0x42170a){_0x42170a=_0x42170a||0xc8;return function(_0x2d1435){if(_0x2d1435){return _0x30742f['status'](_0x42170a)[_0xba12('0x18')](_0x2d1435);}};}function respondWithFilteredResult(_0x4cbb1d,_0x4f5cb2){return function(_0x2f4bfc){if(_0x2f4bfc){var _0x23f0bd=typeof _0x4f5cb2['offset']===_0xba12('0x19')&&typeof _0x4f5cb2['limit']===_0xba12('0x19');var _0x3a24a1=_0x2f4bfc[_0xba12('0x1a')];var _0x5c8233=_0x23f0bd?0x0:_0x4f5cb2[_0xba12('0x1b')];var _0x54bfe0=_0x23f0bd?_0x2f4bfc['count']:_0x4f5cb2[_0xba12('0x1b')]+_0x4f5cb2[_0xba12('0x1c')];var _0x1a4cff;if(_0x54bfe0>=_0x3a24a1){_0x54bfe0=_0x3a24a1;_0x1a4cff=0xc8;}else{_0x1a4cff=0xce;}_0x4cbb1d[_0xba12('0x1d')](_0x1a4cff);return _0x4cbb1d[_0xba12('0x1e')]('Content-Range',_0x5c8233+'-'+_0x54bfe0+'/'+_0x3a24a1)[_0xba12('0x18')](_0x2f4bfc);}return null;};}function patchUpdates(_0x130e50){return function(_0xc52344){try{jsonpatch[_0xba12('0x1f')](_0xc52344,_0x130e50,!![]);}catch(_0x17b0f0){return BPromise[_0xba12('0x20')](_0x17b0f0);}return _0xc52344[_0xba12('0x21')]();};}function saveUpdates(_0x84e80f,_0x14c813){return function(_0x2d2616){if(_0x2d2616){return _0x2d2616['update'](_0x84e80f)[_0xba12('0x22')](function(_0x8accff){return _0x8accff;});}return null;};}function removeEntity(_0x1f0738,_0x47795e){return function(_0x172c65){if(_0x172c65){return _0x172c65[_0xba12('0x23')]()['then'](function(){_0x1f0738[_0xba12('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4696a5,_0x14471c){return function(_0x117feb){if(!_0x117feb){_0x4696a5[_0xba12('0x17')](0x194);}return _0x117feb;};}function handleError(_0x2a14c2,_0x1c9e28){_0x1c9e28=_0x1c9e28||0x1f4;return function(_0x2d4ef0){logger[_0xba12('0x24')](_0x2d4ef0['stack']);if(_0x2d4ef0['name']){delete _0x2d4ef0[_0xba12('0x25')];}_0x2a14c2[_0xba12('0x1d')](_0x1c9e28)[_0xba12('0x26')](_0x2d4ef0);};}exports['index']=function(_0xc81110,_0xcdb51f){var _0x36db42={},_0x3c53f1={},_0x520025={'count':0x0,'rows':[]};var _0xbffb7e=_[_0xba12('0x27')](db[_0xba12('0x28')][_0xba12('0x29')],function(_0x2071ad){return{'name':_0x2071ad[_0xba12('0x2a')],'type':_0x2071ad[_0xba12('0x2b')][_0xba12('0x2c')]};});_0x3c53f1['model']=_['map'](_0xbffb7e,_0xba12('0x25'));_0x3c53f1[_0xba12('0x2d')]=_[_0xba12('0x2e')](_0xc81110[_0xba12('0x2d')]);_0x3c53f1['filters']=_[_0xba12('0x2f')](_0x3c53f1['model'],_0x3c53f1[_0xba12('0x2d')]);_0x36db42[_0xba12('0x30')]=_['intersection'](_0x3c53f1[_0xba12('0x31')],qs[_0xba12('0x32')](_0xc81110[_0xba12('0x2d')][_0xba12('0x32')]));_0x36db42[_0xba12('0x30')]=_0x36db42['attributes'][_0xba12('0x33')]?_0x36db42['attributes']:_0x3c53f1[_0xba12('0x31')];if(!_0xc81110[_0xba12('0x2d')][_0xba12('0x34')](_0xba12('0x35'))){_0x36db42[_0xba12('0x1c')]=qs[_0xba12('0x1c')](_0xc81110[_0xba12('0x2d')][_0xba12('0x1c')]);_0x36db42[_0xba12('0x1b')]=qs[_0xba12('0x1b')](_0xc81110[_0xba12('0x2d')][_0xba12('0x1b')]);}_0x36db42['order']=qs[_0xba12('0x36')](_0xc81110[_0xba12('0x2d')][_0xba12('0x36')]);_0x36db42['where']=qs[_0xba12('0x37')](_['pick'](_0xc81110[_0xba12('0x2d')],_0x3c53f1[_0xba12('0x37')]),_0xbffb7e);if(_0xc81110[_0xba12('0x2d')][_0xba12('0x38')]){_0x36db42[_0xba12('0x39')]=_['merge'](_0x36db42[_0xba12('0x39')],{'$or':_[_0xba12('0x27')](_0xbffb7e,function(_0x2fa2b8){if(_0x2fa2b8['type']!==_0xba12('0x3a')){var _0x152054={};_0x152054[_0x2fa2b8['name']]={'$like':'%'+_0xc81110['query'][_0xba12('0x38')]+'%'};return _0x152054;}})});}_0x36db42=_[_0xba12('0x3b')]({},_0x36db42,_0xc81110[_0xba12('0x3c')]);var _0x3341cf={'where':_0x36db42[_0xba12('0x39')]};return db[_0xba12('0x28')][_0xba12('0x1a')](_0x3341cf)[_0xba12('0x22')](function(_0x41d606){_0x520025[_0xba12('0x1a')]=_0x41d606;if(_0xc81110[_0xba12('0x2d')][_0xba12('0x3d')]){_0x36db42[_0xba12('0x3e')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x36db42);})['then'](function(_0x58abdb){_0x520025[_0xba12('0x3f')]=_0x58abdb;return _0x520025;})[_0xba12('0x22')](respondWithFilteredResult(_0xcdb51f,_0x36db42))[_0xba12('0x40')](handleError(_0xcdb51f,null));};exports[_0xba12('0x41')]=function(_0x2f97c5,_0x2e7c0f){var _0x180588={'raw':![],'where':{'id':_0x2f97c5[_0xba12('0x42')]['id']}},_0x2c55dc={};_0x2c55dc[_0xba12('0x31')]=_[_0xba12('0x2e')](db[_0xba12('0x28')][_0xba12('0x29')]);_0x2c55dc[_0xba12('0x2d')]=_['keys'](_0x2f97c5[_0xba12('0x2d')]);_0x2c55dc[_0xba12('0x37')]=_[_0xba12('0x2f')](_0x2c55dc[_0xba12('0x31')],_0x2c55dc['query']);_0x180588['attributes']=_[_0xba12('0x2f')](_0x2c55dc['model'],qs[_0xba12('0x32')](_0x2f97c5[_0xba12('0x2d')][_0xba12('0x32')]));_0x180588[_0xba12('0x30')]=_0x180588[_0xba12('0x30')][_0xba12('0x33')]?_0x180588[_0xba12('0x30')]:_0x2c55dc[_0xba12('0x31')];if(_0x2f97c5[_0xba12('0x2d')][_0xba12('0x3d')]){_0x180588['include']=[{'all':!![]}];}_0x180588=_[_0xba12('0x3b')]({},_0x180588,_0x2f97c5[_0xba12('0x3c')]);return db['SalesforceConfiguration'][_0xba12('0x43')](_0x180588)[_0xba12('0x22')](handleEntityNotFound(_0x2e7c0f,null))['then'](respondWithResult(_0x2e7c0f,null))[_0xba12('0x40')](handleError(_0x2e7c0f,null));};exports[_0xba12('0x44')]=function(_0x960d18,_0x4272a6){return db['SalesforceConfiguration']['create'](_0x960d18[_0xba12('0x45')],{})[_0xba12('0x22')](respondWithResult(_0x4272a6,0xc9))['catch'](handleError(_0x4272a6,null));};exports[_0xba12('0x46')]=function(_0x19265b,_0x40f8c9){if(_0x19265b[_0xba12('0x45')]['id']){delete _0x19265b[_0xba12('0x45')]['id'];}return db[_0xba12('0x28')][_0xba12('0x43')]({'where':{'id':_0x19265b['params']['id']}})[_0xba12('0x22')](handleEntityNotFound(_0x40f8c9,null))['then'](saveUpdates(_0x19265b['body'],null))[_0xba12('0x22')](respondWithResult(_0x40f8c9,null))[_0xba12('0x40')](handleError(_0x40f8c9,null));};exports[_0xba12('0x23')]=function(_0x4003f2,_0x3e39d9){return db['SalesforceConfiguration'][_0xba12('0x43')]({'where':{'id':_0x4003f2[_0xba12('0x42')]['id']}})[_0xba12('0x22')](handleEntityNotFound(_0x3e39d9,null))[_0xba12('0x22')](removeEntity(_0x3e39d9,null))['catch'](handleError(_0x3e39d9,null));};exports[_0xba12('0x47')]=function(_0x3b5f6b,_0x365d01,_0x2b1bcc){var _0x547288={};var _0x2714fc={};var _0x1d5a68;var _0x5a5302;return db[_0xba12('0x28')][_0xba12('0x48')]({'where':{'id':_0x3b5f6b[_0xba12('0x42')]['id']}})[_0xba12('0x22')](handleEntityNotFound(_0x365d01,null))[_0xba12('0x22')](function(_0xe4b07){if(_0xe4b07){_0x1d5a68=_0xe4b07;_0x2714fc[_0xba12('0x31')]=_[_0xba12('0x2e')](db[_0xba12('0x49')][_0xba12('0x29')]);_0x2714fc[_0xba12('0x2d')]=_[_0xba12('0x2e')](_0x3b5f6b[_0xba12('0x2d')]);_0x2714fc[_0xba12('0x37')]=_['intersection'](_0x2714fc[_0xba12('0x31')],_0x2714fc[_0xba12('0x2d')]);_0x547288['attributes']=_['intersection'](_0x2714fc[_0xba12('0x31')],qs['fields'](_0x3b5f6b[_0xba12('0x2d')][_0xba12('0x32')]));_0x547288[_0xba12('0x30')]=_0x547288[_0xba12('0x30')][_0xba12('0x33')]?_0x547288['attributes']:_0x2714fc[_0xba12('0x31')];_0x547288[_0xba12('0x4a')]=qs['sort'](_0x3b5f6b[_0xba12('0x2d')][_0xba12('0x36')]);_0x547288[_0xba12('0x39')]=qs[_0xba12('0x37')](_[_0xba12('0x4b')](_0x3b5f6b[_0xba12('0x2d')],_0x2714fc[_0xba12('0x37')]));if(_0x3b5f6b[_0xba12('0x2d')][_0xba12('0x38')]){_0x547288[_0xba12('0x39')]=_['merge'](_0x547288[_0xba12('0x39')],{'$or':_['map'](_0x547288[_0xba12('0x30')],function(_0x35f851){var _0x3b0c9e={};_0x3b0c9e[_0x35f851]={'$like':'%'+_0x3b5f6b[_0xba12('0x2d')][_0xba12('0x38')]+'%'};return _0x3b0c9e;})});}_0x547288=_[_0xba12('0x3b')]({},_0x547288,_0x3b5f6b[_0xba12('0x3c')]);return _0x1d5a68['getFields'](_0x547288);}})[_0xba12('0x22')](function(_0x362c9c){if(_0x362c9c){_0x5a5302=_0x362c9c[_0xba12('0x33')];if(!_0x3b5f6b[_0xba12('0x2d')]['hasOwnProperty']('nolimit')){_0x547288[_0xba12('0x1c')]=qs[_0xba12('0x1c')](_0x3b5f6b[_0xba12('0x2d')][_0xba12('0x1c')]);_0x547288[_0xba12('0x1b')]=qs['offset'](_0x3b5f6b[_0xba12('0x2d')][_0xba12('0x1b')]);}return _0x1d5a68[_0xba12('0x47')](_0x547288);}})[_0xba12('0x22')](function(_0x5d1080){if(_0x5d1080){return _0x5d1080?{'count':_0x5a5302,'rows':_0x5d1080}:null;}})[_0xba12('0x22')](respondWithResult(_0x365d01,null))[_0xba12('0x40')](handleError(_0x365d01,null));};exports[_0xba12('0x4c')]=function(_0x346a39,_0x4ff28f,_0x3a3579){var _0x3fab4c={};var _0x3a5a8b={};var _0x4acb76;var _0x44c46c;return db[_0xba12('0x28')]['findOne']({'where':{'id':_0x346a39[_0xba12('0x42')]['id']}})[_0xba12('0x22')](handleEntityNotFound(_0x4ff28f,null))[_0xba12('0x22')](function(_0x13b781){if(_0x13b781){_0x4acb76=_0x13b781;_0x3a5a8b[_0xba12('0x31')]=_[_0xba12('0x2e')](db[_0xba12('0x49')][_0xba12('0x29')]);_0x3a5a8b[_0xba12('0x2d')]=_[_0xba12('0x2e')](_0x346a39[_0xba12('0x2d')]);_0x3a5a8b[_0xba12('0x37')]=_['intersection'](_0x3a5a8b[_0xba12('0x31')],_0x3a5a8b[_0xba12('0x2d')]);_0x3fab4c[_0xba12('0x30')]=_[_0xba12('0x2f')](_0x3a5a8b['model'],qs[_0xba12('0x32')](_0x346a39[_0xba12('0x2d')][_0xba12('0x32')]));_0x3fab4c['attributes']=_0x3fab4c['attributes'][_0xba12('0x33')]?_0x3fab4c[_0xba12('0x30')]:_0x3a5a8b['model'];_0x3fab4c[_0xba12('0x4a')]=qs[_0xba12('0x36')](_0x346a39['query'][_0xba12('0x36')]);_0x3fab4c[_0xba12('0x39')]=qs[_0xba12('0x37')](_[_0xba12('0x4b')](_0x346a39['query'],_0x3a5a8b[_0xba12('0x37')]));if(_0x346a39[_0xba12('0x2d')]['filter']){_0x3fab4c[_0xba12('0x39')]=_[_0xba12('0x3b')](_0x3fab4c['where'],{'$or':_[_0xba12('0x27')](_0x3fab4c['attributes'],function(_0x591d29){var _0x272adc={};_0x272adc[_0x591d29]={'$like':'%'+_0x346a39[_0xba12('0x2d')][_0xba12('0x38')]+'%'};return _0x272adc;})});}_0x3fab4c=_[_0xba12('0x3b')]({},_0x3fab4c,_0x346a39['options']);return _0x4acb76[_0xba12('0x4c')](_0x3fab4c);}})[_0xba12('0x22')](function(_0x3f826e){if(_0x3f826e){_0x44c46c=_0x3f826e[_0xba12('0x33')];if(!_0x346a39[_0xba12('0x2d')]['hasOwnProperty']('nolimit')){_0x3fab4c[_0xba12('0x1c')]=qs[_0xba12('0x1c')](_0x346a39['query'][_0xba12('0x1c')]);_0x3fab4c[_0xba12('0x1b')]=qs[_0xba12('0x1b')](_0x346a39[_0xba12('0x2d')]['offset']);}return _0x4acb76[_0xba12('0x4c')](_0x3fab4c);}})['then'](function(_0x4be0fe){if(_0x4be0fe){return _0x4be0fe?{'count':_0x44c46c,'rows':_0x4be0fe}:null;}})[_0xba12('0x22')](respondWithResult(_0x4ff28f,null))['catch'](handleError(_0x4ff28f,null));};exports['getDescriptions']=function(_0x8129d4,_0x12bf58,_0x21dd42){var _0x1f4757={};var _0x3c35c5={};var _0x4c29b2;var _0x5d23e1;return db[_0xba12('0x28')][_0xba12('0x48')]({'where':{'id':_0x8129d4['params']['id']}})[_0xba12('0x22')](handleEntityNotFound(_0x12bf58,null))[_0xba12('0x22')](function(_0x2b7b8b){if(_0x2b7b8b){_0x4c29b2=_0x2b7b8b;_0x3c35c5[_0xba12('0x31')]=_[_0xba12('0x2e')](db[_0xba12('0x49')][_0xba12('0x29')]);_0x3c35c5['query']=_[_0xba12('0x2e')](_0x8129d4[_0xba12('0x2d')]);_0x3c35c5['filters']=_[_0xba12('0x2f')](_0x3c35c5['model'],_0x3c35c5[_0xba12('0x2d')]);_0x1f4757[_0xba12('0x30')]=_[_0xba12('0x2f')](_0x3c35c5[_0xba12('0x31')],qs[_0xba12('0x32')](_0x8129d4[_0xba12('0x2d')]['fields']));_0x1f4757[_0xba12('0x30')]=_0x1f4757['attributes'][_0xba12('0x33')]?_0x1f4757['attributes']:_0x3c35c5['model'];_0x1f4757[_0xba12('0x4a')]=qs[_0xba12('0x36')](_0x8129d4['query'][_0xba12('0x36')]);_0x1f4757[_0xba12('0x39')]=qs[_0xba12('0x37')](_[_0xba12('0x4b')](_0x8129d4['query'],_0x3c35c5[_0xba12('0x37')]));if(_0x8129d4[_0xba12('0x2d')][_0xba12('0x38')]){_0x1f4757[_0xba12('0x39')]=_[_0xba12('0x3b')](_0x1f4757[_0xba12('0x39')],{'$or':_[_0xba12('0x27')](_0x1f4757[_0xba12('0x30')],function(_0x80fa99){var _0x3d63f3={};_0x3d63f3[_0x80fa99]={'$like':'%'+_0x8129d4['query'][_0xba12('0x38')]+'%'};return _0x3d63f3;})});}_0x1f4757=_[_0xba12('0x3b')]({},_0x1f4757,_0x8129d4[_0xba12('0x3c')]);return _0x4c29b2['getDescriptions'](_0x1f4757);}})['then'](function(_0x31ac57){if(_0x31ac57){_0x5d23e1=_0x31ac57[_0xba12('0x33')];if(!_0x8129d4[_0xba12('0x2d')][_0xba12('0x34')](_0xba12('0x35'))){_0x1f4757[_0xba12('0x1c')]=qs[_0xba12('0x1c')](_0x8129d4[_0xba12('0x2d')][_0xba12('0x1c')]);_0x1f4757[_0xba12('0x1b')]=qs[_0xba12('0x1b')](_0x8129d4[_0xba12('0x2d')]['offset']);}return _0x4c29b2[_0xba12('0x4d')](_0x1f4757);}})[_0xba12('0x22')](function(_0x2f7c8f){if(_0x2f7c8f){return _0x2f7c8f?{'count':_0x5d23e1,'rows':_0x2f7c8f}:null;}})[_0xba12('0x22')](respondWithResult(_0x12bf58,null))[_0xba12('0x40')](handleError(_0x12bf58,null));}; \ No newline at end of file +var _0xc519=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','create','find','params','getFields','findOne','SalesforceField','pick','getSubjects','getDescriptions','zip-dir','request-promise','moment','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xc519,0x11b));var _0x9c51=function(_0x87987e,_0x24f91e){_0x87987e=_0x87987e-0x0;var _0x80f7bd=_0xc519[_0x87987e];return _0x80f7bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9c51('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c51('0x1'));var moment=require(_0x9c51('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9c51('0x3'));var path=require(_0x9c51('0x4'));var sox=require('sox');var csv=require(_0x9c51('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c51('0x6'));var _=require(_0x9c51('0x7'));var squel=require('squel');var crypto=require(_0x9c51('0x8'));var jsforce=require(_0x9c51('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x9c51('0x5'));var querystring=require(_0x9c51('0xa'));var Papa=require(_0x9c51('0xb'));var Redis=require(_0x9c51('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9c51('0xd'));var as=require(_0x9c51('0xe'));var hardwareService=require(_0x9c51('0xf'));var logger=require(_0x9c51('0x10'))(_0x9c51('0x11'));var utils=require(_0x9c51('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9c51('0x13'))['db'];function respondWithStatusCode(_0x5cbed0,_0x3e6bd4){_0x3e6bd4=_0x3e6bd4||0xcc;return function(_0xd78aea){if(_0xd78aea){return _0x5cbed0[_0x9c51('0x14')](_0x3e6bd4);}return _0x5cbed0[_0x9c51('0x15')](_0x3e6bd4)[_0x9c51('0x16')]();};}function respondWithResult(_0x39bfc2,_0x44487c){_0x44487c=_0x44487c||0xc8;return function(_0x58375e){if(_0x58375e){return _0x39bfc2[_0x9c51('0x15')](_0x44487c)[_0x9c51('0x17')](_0x58375e);}};}function respondWithFilteredResult(_0x25a640,_0x4598ac){return function(_0x3064c4){if(_0x3064c4){var _0x11c33f=typeof _0x4598ac[_0x9c51('0x18')]==='undefined'&&typeof _0x4598ac[_0x9c51('0x19')]==='undefined';var _0x52d8b7=_0x3064c4[_0x9c51('0x1a')];var _0x5d9daf=_0x11c33f?0x0:_0x4598ac['offset'];var _0x691273=_0x11c33f?_0x3064c4[_0x9c51('0x1a')]:_0x4598ac[_0x9c51('0x18')]+_0x4598ac[_0x9c51('0x19')];var _0x3f0ad7;if(_0x691273>=_0x52d8b7){_0x691273=_0x52d8b7;_0x3f0ad7=0xc8;}else{_0x3f0ad7=0xce;}_0x25a640[_0x9c51('0x15')](_0x3f0ad7);return _0x25a640[_0x9c51('0x1b')](_0x9c51('0x1c'),_0x5d9daf+'-'+_0x691273+'/'+_0x52d8b7)[_0x9c51('0x17')](_0x3064c4);}return null;};}function patchUpdates(_0x483b37){return function(_0x432f16){try{jsonpatch[_0x9c51('0x1d')](_0x432f16,_0x483b37,!![]);}catch(_0x58a047){return BPromise[_0x9c51('0x1e')](_0x58a047);}return _0x432f16[_0x9c51('0x1f')]();};}function saveUpdates(_0x26a2b2,_0x16be2e){return function(_0x3a8693){if(_0x3a8693){return _0x3a8693[_0x9c51('0x20')](_0x26a2b2)[_0x9c51('0x21')](function(_0x104b30){return _0x104b30;});}return null;};}function removeEntity(_0x51ae02,_0x3c4253){return function(_0x3d8283){if(_0x3d8283){return _0x3d8283[_0x9c51('0x22')]()[_0x9c51('0x21')](function(){_0x51ae02[_0x9c51('0x15')](0xcc)[_0x9c51('0x16')]();});}};}function handleEntityNotFound(_0x574b68,_0x40a786){return function(_0x73dc43){if(!_0x73dc43){_0x574b68['sendStatus'](0x194);}return _0x73dc43;};}function handleError(_0x51863a,_0x4eb9d7){_0x4eb9d7=_0x4eb9d7||0x1f4;return function(_0x5e9c41){logger[_0x9c51('0x23')](_0x5e9c41[_0x9c51('0x24')]);if(_0x5e9c41[_0x9c51('0x25')]){delete _0x5e9c41[_0x9c51('0x25')];}_0x51863a[_0x9c51('0x15')](_0x4eb9d7)[_0x9c51('0x26')](_0x5e9c41);};}exports[_0x9c51('0x27')]=function(_0x48db4a,_0xe70cd6){var _0x394bc9={},_0x9a5705={},_0x9183f={'count':0x0,'rows':[]};var _0x57c998=_['map'](db[_0x9c51('0x28')][_0x9c51('0x29')],function(_0x5182b0){return{'name':_0x5182b0[_0x9c51('0x2a')],'type':_0x5182b0[_0x9c51('0x2b')][_0x9c51('0x2c')]};});_0x9a5705[_0x9c51('0x2d')]=_[_0x9c51('0x2e')](_0x57c998,_0x9c51('0x25'));_0x9a5705['query']=_['keys'](_0x48db4a[_0x9c51('0x2f')]);_0x9a5705[_0x9c51('0x30')]=_[_0x9c51('0x31')](_0x9a5705[_0x9c51('0x2d')],_0x9a5705[_0x9c51('0x2f')]);_0x394bc9[_0x9c51('0x32')]=_[_0x9c51('0x31')](_0x9a5705[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x48db4a['query']['fields']));_0x394bc9[_0x9c51('0x32')]=_0x394bc9[_0x9c51('0x32')][_0x9c51('0x34')]?_0x394bc9[_0x9c51('0x32')]:_0x9a5705[_0x9c51('0x2d')];if(!_0x48db4a[_0x9c51('0x2f')][_0x9c51('0x35')](_0x9c51('0x36'))){_0x394bc9['limit']=qs['limit'](_0x48db4a[_0x9c51('0x2f')]['limit']);_0x394bc9[_0x9c51('0x18')]=qs['offset'](_0x48db4a[_0x9c51('0x2f')][_0x9c51('0x18')]);}_0x394bc9[_0x9c51('0x37')]=qs[_0x9c51('0x38')](_0x48db4a[_0x9c51('0x2f')]['sort']);_0x394bc9[_0x9c51('0x39')]=qs[_0x9c51('0x30')](_['pick'](_0x48db4a[_0x9c51('0x2f')],_0x9a5705[_0x9c51('0x30')]),_0x57c998);if(_0x48db4a[_0x9c51('0x2f')][_0x9c51('0x3a')]){_0x394bc9[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x394bc9['where'],{'$or':_[_0x9c51('0x2e')](_0x57c998,function(_0x1e5282){if(_0x1e5282[_0x9c51('0x2b')]!==_0x9c51('0x3c')){var _0x30a629={};_0x30a629[_0x1e5282[_0x9c51('0x25')]]={'$like':'%'+_0x48db4a[_0x9c51('0x2f')]['filter']+'%'};return _0x30a629;}})});}_0x394bc9=_[_0x9c51('0x3b')]({},_0x394bc9,_0x48db4a[_0x9c51('0x3d')]);var _0x34de73={'where':_0x394bc9[_0x9c51('0x39')]};return db['SalesforceConfiguration'][_0x9c51('0x1a')](_0x34de73)[_0x9c51('0x21')](function(_0x2170dd){_0x9183f[_0x9c51('0x1a')]=_0x2170dd;if(_0x48db4a['query'][_0x9c51('0x3e')]){_0x394bc9[_0x9c51('0x3f')]=[{'all':!![]}];}return db[_0x9c51('0x28')]['findAll'](_0x394bc9);})[_0x9c51('0x21')](function(_0x1a2f16){_0x9183f[_0x9c51('0x40')]=_0x1a2f16;return _0x9183f;})[_0x9c51('0x21')](respondWithFilteredResult(_0xe70cd6,_0x394bc9))[_0x9c51('0x41')](handleError(_0xe70cd6,null));};exports[_0x9c51('0x42')]=function(_0xaeda82,_0xe74e89){var _0x5c2c2e={'raw':![],'where':{'id':_0xaeda82['params']['id']}},_0x34a6d1={};_0x34a6d1[_0x9c51('0x2d')]=_[_0x9c51('0x43')](db['SalesforceConfiguration'][_0x9c51('0x29')]);_0x34a6d1[_0x9c51('0x2f')]=_[_0x9c51('0x43')](_0xaeda82['query']);_0x34a6d1['filters']=_[_0x9c51('0x31')](_0x34a6d1[_0x9c51('0x2d')],_0x34a6d1['query']);_0x5c2c2e[_0x9c51('0x32')]=_['intersection'](_0x34a6d1[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0xaeda82['query']['fields']));_0x5c2c2e[_0x9c51('0x32')]=_0x5c2c2e[_0x9c51('0x32')][_0x9c51('0x34')]?_0x5c2c2e['attributes']:_0x34a6d1[_0x9c51('0x2d')];if(_0xaeda82[_0x9c51('0x2f')][_0x9c51('0x3e')]){_0x5c2c2e[_0x9c51('0x3f')]=[{'all':!![]}];}_0x5c2c2e=_['merge']({},_0x5c2c2e,_0xaeda82[_0x9c51('0x3d')]);return db[_0x9c51('0x28')]['find'](_0x5c2c2e)['then'](handleEntityNotFound(_0xe74e89,null))[_0x9c51('0x21')](respondWithResult(_0xe74e89,null))[_0x9c51('0x41')](handleError(_0xe74e89,null));};exports[_0x9c51('0x44')]=function(_0x2d2d0e,_0x5382a1){return db[_0x9c51('0x28')][_0x9c51('0x44')](_0x2d2d0e['body'],{})[_0x9c51('0x21')](respondWithResult(_0x5382a1,0xc9))['catch'](handleError(_0x5382a1,null));};exports['update']=function(_0x558b02,_0x5e40b4){if(_0x558b02['body']['id']){delete _0x558b02['body']['id'];}return db[_0x9c51('0x28')][_0x9c51('0x45')]({'where':{'id':_0x558b02[_0x9c51('0x46')]['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x5e40b4,null))['then'](saveUpdates(_0x558b02['body'],null))[_0x9c51('0x21')](respondWithResult(_0x5e40b4,null))['catch'](handleError(_0x5e40b4,null));};exports[_0x9c51('0x22')]=function(_0x5e0a99,_0x4c057b){return db[_0x9c51('0x28')][_0x9c51('0x45')]({'where':{'id':_0x5e0a99['params']['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x4c057b,null))[_0x9c51('0x21')](removeEntity(_0x4c057b,null))[_0x9c51('0x41')](handleError(_0x4c057b,null));};exports[_0x9c51('0x47')]=function(_0x1f1b6e,_0x2f80a8,_0x129523){var _0x12d3aa={};var _0x21f79b={};var _0x328a53;var _0x4d78f8;return db[_0x9c51('0x28')][_0x9c51('0x48')]({'where':{'id':_0x1f1b6e[_0x9c51('0x46')]['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x2f80a8,null))[_0x9c51('0x21')](function(_0x53ae7c){if(_0x53ae7c){_0x328a53=_0x53ae7c;_0x21f79b[_0x9c51('0x2d')]=_[_0x9c51('0x43')](db[_0x9c51('0x49')]['rawAttributes']);_0x21f79b['query']=_['keys'](_0x1f1b6e['query']);_0x21f79b[_0x9c51('0x30')]=_[_0x9c51('0x31')](_0x21f79b[_0x9c51('0x2d')],_0x21f79b[_0x9c51('0x2f')]);_0x12d3aa['attributes']=_[_0x9c51('0x31')](_0x21f79b[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x1f1b6e[_0x9c51('0x2f')]['fields']));_0x12d3aa['attributes']=_0x12d3aa[_0x9c51('0x32')][_0x9c51('0x34')]?_0x12d3aa[_0x9c51('0x32')]:_0x21f79b[_0x9c51('0x2d')];_0x12d3aa[_0x9c51('0x37')]=qs[_0x9c51('0x38')](_0x1f1b6e[_0x9c51('0x2f')]['sort']);_0x12d3aa[_0x9c51('0x39')]=qs['filters'](_[_0x9c51('0x4a')](_0x1f1b6e[_0x9c51('0x2f')],_0x21f79b['filters']));if(_0x1f1b6e[_0x9c51('0x2f')]['filter']){_0x12d3aa[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x12d3aa[_0x9c51('0x39')],{'$or':_[_0x9c51('0x2e')](_0x12d3aa[_0x9c51('0x32')],function(_0x545947){var _0x6d801={};_0x6d801[_0x545947]={'$like':'%'+_0x1f1b6e[_0x9c51('0x2f')][_0x9c51('0x3a')]+'%'};return _0x6d801;})});}_0x12d3aa=_[_0x9c51('0x3b')]({},_0x12d3aa,_0x1f1b6e['options']);return _0x328a53[_0x9c51('0x47')](_0x12d3aa);}})[_0x9c51('0x21')](function(_0x1296a8){if(_0x1296a8){_0x4d78f8=_0x1296a8[_0x9c51('0x34')];if(!_0x1f1b6e['query'][_0x9c51('0x35')]('nolimit')){_0x12d3aa[_0x9c51('0x19')]=qs[_0x9c51('0x19')](_0x1f1b6e[_0x9c51('0x2f')][_0x9c51('0x19')]);_0x12d3aa[_0x9c51('0x18')]=qs[_0x9c51('0x18')](_0x1f1b6e['query'][_0x9c51('0x18')]);}return _0x328a53[_0x9c51('0x47')](_0x12d3aa);}})['then'](function(_0x15d406){if(_0x15d406){return _0x15d406?{'count':_0x4d78f8,'rows':_0x15d406}:null;}})[_0x9c51('0x21')](respondWithResult(_0x2f80a8,null))['catch'](handleError(_0x2f80a8,null));};exports[_0x9c51('0x4b')]=function(_0x1949d6,_0x10ad68,_0x29238f){var _0x4fe1c9={};var _0x48173e={};var _0x236d58;var _0x263f43;return db['SalesforceConfiguration'][_0x9c51('0x48')]({'where':{'id':_0x1949d6[_0x9c51('0x46')]['id']}})[_0x9c51('0x21')](handleEntityNotFound(_0x10ad68,null))[_0x9c51('0x21')](function(_0x101b24){if(_0x101b24){_0x236d58=_0x101b24;_0x48173e['model']=_[_0x9c51('0x43')](db['SalesforceField'][_0x9c51('0x29')]);_0x48173e['query']=_['keys'](_0x1949d6[_0x9c51('0x2f')]);_0x48173e['filters']=_['intersection'](_0x48173e[_0x9c51('0x2d')],_0x48173e['query']);_0x4fe1c9[_0x9c51('0x32')]=_[_0x9c51('0x31')](_0x48173e[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x33')]));_0x4fe1c9[_0x9c51('0x32')]=_0x4fe1c9[_0x9c51('0x32')][_0x9c51('0x34')]?_0x4fe1c9[_0x9c51('0x32')]:_0x48173e[_0x9c51('0x2d')];_0x4fe1c9[_0x9c51('0x37')]=qs[_0x9c51('0x38')](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x38')]);_0x4fe1c9[_0x9c51('0x39')]=qs[_0x9c51('0x30')](_['pick'](_0x1949d6[_0x9c51('0x2f')],_0x48173e[_0x9c51('0x30')]));if(_0x1949d6['query'][_0x9c51('0x3a')]){_0x4fe1c9[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x4fe1c9['where'],{'$or':_[_0x9c51('0x2e')](_0x4fe1c9[_0x9c51('0x32')],function(_0x185fb9){var _0x458b70={};_0x458b70[_0x185fb9]={'$like':'%'+_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x3a')]+'%'};return _0x458b70;})});}_0x4fe1c9=_[_0x9c51('0x3b')]({},_0x4fe1c9,_0x1949d6[_0x9c51('0x3d')]);return _0x236d58['getSubjects'](_0x4fe1c9);}})[_0x9c51('0x21')](function(_0x376882){if(_0x376882){_0x263f43=_0x376882[_0x9c51('0x34')];if(!_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x35')](_0x9c51('0x36'))){_0x4fe1c9[_0x9c51('0x19')]=qs[_0x9c51('0x19')](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x19')]);_0x4fe1c9[_0x9c51('0x18')]=qs['offset'](_0x1949d6[_0x9c51('0x2f')][_0x9c51('0x18')]);}return _0x236d58['getSubjects'](_0x4fe1c9);}})[_0x9c51('0x21')](function(_0x4ee03b){if(_0x4ee03b){return _0x4ee03b?{'count':_0x263f43,'rows':_0x4ee03b}:null;}})[_0x9c51('0x21')](respondWithResult(_0x10ad68,null))['catch'](handleError(_0x10ad68,null));};exports[_0x9c51('0x4c')]=function(_0x2da1c2,_0x8dcca4,_0x2c0c4b){var _0x4adec2={};var _0x144c4f={};var _0x4a20b9;var _0xcb0ac2;return db[_0x9c51('0x28')][_0x9c51('0x48')]({'where':{'id':_0x2da1c2[_0x9c51('0x46')]['id']}})['then'](handleEntityNotFound(_0x8dcca4,null))[_0x9c51('0x21')](function(_0xf4be83){if(_0xf4be83){_0x4a20b9=_0xf4be83;_0x144c4f[_0x9c51('0x2d')]=_[_0x9c51('0x43')](db[_0x9c51('0x49')][_0x9c51('0x29')]);_0x144c4f['query']=_['keys'](_0x2da1c2[_0x9c51('0x2f')]);_0x144c4f[_0x9c51('0x30')]=_[_0x9c51('0x31')](_0x144c4f[_0x9c51('0x2d')],_0x144c4f[_0x9c51('0x2f')]);_0x4adec2[_0x9c51('0x32')]=_['intersection'](_0x144c4f[_0x9c51('0x2d')],qs[_0x9c51('0x33')](_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x33')]));_0x4adec2[_0x9c51('0x32')]=_0x4adec2[_0x9c51('0x32')]['length']?_0x4adec2['attributes']:_0x144c4f[_0x9c51('0x2d')];_0x4adec2['order']=qs[_0x9c51('0x38')](_0x2da1c2['query'][_0x9c51('0x38')]);_0x4adec2[_0x9c51('0x39')]=qs['filters'](_[_0x9c51('0x4a')](_0x2da1c2[_0x9c51('0x2f')],_0x144c4f[_0x9c51('0x30')]));if(_0x2da1c2['query']['filter']){_0x4adec2[_0x9c51('0x39')]=_[_0x9c51('0x3b')](_0x4adec2[_0x9c51('0x39')],{'$or':_[_0x9c51('0x2e')](_0x4adec2[_0x9c51('0x32')],function(_0x1524de){var _0x158ab0={};_0x158ab0[_0x1524de]={'$like':'%'+_0x2da1c2[_0x9c51('0x2f')]['filter']+'%'};return _0x158ab0;})});}_0x4adec2=_['merge']({},_0x4adec2,_0x2da1c2[_0x9c51('0x3d')]);return _0x4a20b9[_0x9c51('0x4c')](_0x4adec2);}})[_0x9c51('0x21')](function(_0x30304a){if(_0x30304a){_0xcb0ac2=_0x30304a['length'];if(!_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x35')](_0x9c51('0x36'))){_0x4adec2[_0x9c51('0x19')]=qs['limit'](_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x19')]);_0x4adec2[_0x9c51('0x18')]=qs['offset'](_0x2da1c2[_0x9c51('0x2f')][_0x9c51('0x18')]);}return _0x4a20b9['getDescriptions'](_0x4adec2);}})[_0x9c51('0x21')](function(_0x358a37){if(_0x358a37){return _0x358a37?{'count':_0xcb0ac2,'rows':_0x358a37}:null;}})[_0x9c51('0x21')](respondWithResult(_0x8dcca4,null))[_0x9c51('0x41')](handleError(_0x8dcca4,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index de9cf9b..8a96874 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 _0x8945=['request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5796bf,_0x2c93ef){var _0x1aba5c=function(_0xefcd2d){while(--_0xefcd2d){_0x5796bf['push'](_0x5796bf['shift']());}};_0x1aba5c(++_0x2c93ef);}(_0x8945,0x132));var _0x5894=function(_0x9d6743,_0x34c550){_0x9d6743=_0x9d6743-0x0;var _0x54af8e=_0x8945[_0x9d6743];return _0x54af8e;};'use strict';var _=require(_0x5894('0x0'));var util=require(_0x5894('0x1'));var logger=require(_0x5894('0x2'))(_0x5894('0x3'));var moment=require(_0x5894('0x4'));var BPromise=require(_0x5894('0x5'));var rp=require(_0x5894('0x6'));var fs=require('fs');var path=require(_0x5894('0x7'));var rimraf=require(_0x5894('0x8'));var config=require(_0x5894('0x9'));var attributes=require(_0x5894('0xa'));module['exports']=function(_0x4460f0,_0x58e8f1){return _0x4460f0[_0x5894('0xb')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x304c=['define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger','moment','request-promise','path','../../config/environment','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x304c,0xb7));var _0xc304=function(_0x5dfd6d,_0x4d5431){_0x5dfd6d=_0x5dfd6d-0x0;var _0x3a7ce8=_0x304c[_0x5dfd6d];return _0x3a7ce8;};'use strict';var _=require('lodash');var util=require(_0xc304('0x0'));var logger=require(_0xc304('0x1'))('api');var moment=require(_0xc304('0x2'));var BPromise=require('bluebird');var rp=require(_0xc304('0x3'));var fs=require('fs');var path=require(_0xc304('0x4'));var rimraf=require('rimraf');var config=require(_0xc304('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xc304('0x6')]=function(_0x3f91f7,_0x1a8d49){return _0x3f91f7[_0xc304('0x7')](_0xc304('0x8'),attributes,{'tableName':_0xc304('0x9'),'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 3865db6..6c78856 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 _0xbf55=['jayson/promise','client','then','info','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0xbf55,0x19c));var _0x5bf5=function(_0x19ec02,_0x222aff){_0x19ec02=_0x19ec02-0x0;var _0x1c8fb0=_0xbf55[_0x19ec02];return _0x1c8fb0;};'use strict';var _=require(_0x5bf5('0x0'));var util=require('util');var moment=require(_0x5bf5('0x1'));var BPromise=require(_0x5bf5('0x2'));var rs=require(_0x5bf5('0x3'));var fs=require('fs');var Redis=require(_0x5bf5('0x4'));var db=require(_0x5bf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bf5('0x6'))('rpc');var config=require(_0x5bf5('0x7'));var jayson=require(_0x5bf5('0x8'));var client=jayson[_0x5bf5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bed77,_0x190f0f,_0x19d46){return new BPromise(function(_0x250a28,_0x2fd4fb){return client['request'](_0x5bed77,_0x19d46)[_0x5bf5('0xa')](function(_0x3116f3){logger[_0x5bf5('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x190f0f,'request\x20sent');logger['debug'](_0x5bf5('0xc'),_0x190f0f,_0x5bf5('0xd'),JSON[_0x5bf5('0xe')](_0x3116f3));if(_0x3116f3[_0x5bf5('0xf')]){if(_0x3116f3['error'][_0x5bf5('0x10')]===0x1f4){logger[_0x5bf5('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x190f0f,_0x3116f3['error'][_0x5bf5('0x11')]);return _0x2fd4fb(_0x3116f3[_0x5bf5('0xf')][_0x5bf5('0x11')]);}logger[_0x5bf5('0xf')](_0x5bf5('0x12'),_0x190f0f,_0x3116f3[_0x5bf5('0xf')][_0x5bf5('0x11')]);return _0x250a28(_0x3116f3[_0x5bf5('0xf')][_0x5bf5('0x11')]);}else{logger['info'](_0x5bf5('0x12'),_0x190f0f,_0x5bf5('0xd'));_0x250a28(_0x3116f3[_0x5bf5('0x13')][_0x5bf5('0x11')]);}})['catch'](function(_0x102f19){logger[_0x5bf5('0xf')](_0x5bf5('0x12'),_0x190f0f,_0x102f19);_0x2fd4fb(_0x102f19);});});} \ No newline at end of file +var _0x7000=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7000,0x159));var _0x0700=function(_0xef7b42,_0xf9ab01){_0xef7b42=_0xef7b42-0x0;var _0x5c3893=_0x7000[_0xef7b42];return _0x5c3893;};'use strict';var _=require(_0x0700('0x0'));var util=require(_0x0700('0x1'));var moment=require(_0x0700('0x2'));var BPromise=require(_0x0700('0x3'));var rs=require(_0x0700('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0700('0x5'))['db'];var utils=require(_0x0700('0x6'));var logger=require(_0x0700('0x7'))(_0x0700('0x8'));var config=require(_0x0700('0x9'));var jayson=require(_0x0700('0xa'));var client=jayson['client'][_0x0700('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9021,_0x54ac31,_0x377a2a){return new BPromise(function(_0x3518ca,_0x1e6976){return client['request'](_0x3f9021,_0x377a2a)[_0x0700('0xc')](function(_0x1a435c){logger[_0x0700('0xd')](_0x0700('0xe'),_0x54ac31,'request\x20sent');logger[_0x0700('0xf')](_0x0700('0x10'),_0x54ac31,_0x0700('0x11'),JSON['stringify'](_0x1a435c));if(_0x1a435c[_0x0700('0x12')]){if(_0x1a435c[_0x0700('0x12')][_0x0700('0x13')]===0x1f4){logger[_0x0700('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x54ac31,_0x1a435c[_0x0700('0x12')]['message']);return _0x1e6976(_0x1a435c['error'][_0x0700('0x14')]);}logger['error'](_0x0700('0xe'),_0x54ac31,_0x1a435c['error']['message']);return _0x3518ca(_0x1a435c['error'][_0x0700('0x14')]);}else{logger[_0x0700('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x54ac31,_0x0700('0x11'));_0x3518ca(_0x1a435c[_0x0700('0x15')][_0x0700('0x14')]);}})[_0x0700('0x16')](function(_0x3d021e){logger[_0x0700('0x12')](_0x0700('0xe'),_0x54ac31,_0x3d021e);_0x1e6976(_0x3d021e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 8e81cad..e10bad7 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 _0xb55b=['put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xb55b,0x130));var _0xbb55=function(_0x46e421,_0x1eeabf){_0x46e421=_0x46e421-0x0;var _0x3bc5b9=_0xb55b[_0x46e421];return _0x3bc5b9;};'use strict';var multer=require(_0xbb55('0x0'));var util=require(_0xbb55('0x1'));var path=require(_0xbb55('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb55('0x3'));var router=express[_0xbb55('0x4')]();var fs_extra=require(_0xbb55('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbb55('0x6'));var config=require(_0xbb55('0x7'));var controller=require(_0xbb55('0x8'));router[_0xbb55('0x9')]('/',auth[_0xbb55('0xa')](),controller[_0xbb55('0xb')]);router[_0xbb55('0x9')](_0xbb55('0xc'),auth[_0xbb55('0xa')](),controller[_0xbb55('0xd')]);router[_0xbb55('0xe')]('/',auth[_0xbb55('0xa')](),controller[_0xbb55('0xf')]);router[_0xbb55('0x10')](_0xbb55('0xc'),auth[_0xbb55('0xa')](),controller[_0xbb55('0x11')]);router[_0xbb55('0x12')](_0xbb55('0xc'),auth[_0xbb55('0xa')](),controller['destroy']);module[_0xbb55('0x13')]=router; \ No newline at end of file +var _0x244c=['/:id','show','post','create','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x244c,0xe0));var _0xc244=function(_0x23ab55,_0x399df5){_0x23ab55=_0x23ab55-0x0;var _0x4507c1=_0x244c[_0x23ab55];return _0x4507c1;};'use strict';var multer=require(_0xc244('0x0'));var util=require(_0xc244('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc244('0x2'));var router=express[_0xc244('0x3')]();var fs_extra=require(_0xc244('0x4'));var auth=require(_0xc244('0x5'));var interaction=require(_0xc244('0x6'));var config=require(_0xc244('0x7'));var controller=require(_0xc244('0x8'));router['get']('/',auth[_0xc244('0x9')](),controller['index']);router['get'](_0xc244('0xa'),auth['isAuthenticated'](),controller[_0xc244('0xb')]);router[_0xc244('0xc')]('/',auth[_0xc244('0x9')](),controller[_0xc244('0xd')]);router[_0xc244('0xe')](_0xc244('0xa'),auth[_0xc244('0x9')](),controller['update']);router[_0xc244('0xf')](_0xc244('0xa'),auth[_0xc244('0x9')](),controller[_0xc244('0x10')]);module[_0xc244('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index cbf2263..fe30b90 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 _0x43ab=['picklist','STRING','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x4d7a61,_0x3fb6e6){var _0x186f73=function(_0x4eeeeb){while(--_0x4eeeeb){_0x4d7a61['push'](_0x4d7a61['shift']());}};_0x186f73(++_0x3fb6e6);}(_0x43ab,0xda));var _0xb43a=function(_0x2d53ff,_0x5a8ae2){_0x2d53ff=_0x2d53ff-0x0;var _0x5e49be=_0x43ab[_0x2d53ff];return _0x5e49be;};'use strict';var Sequelize=require(_0xb43a('0x0'));module[_0xb43a('0x1')]={'type':{'type':Sequelize[_0xb43a('0x2')](_0xb43a('0x3'),'variable',_0xb43a('0x4'),_0xb43a('0x5'),_0xb43a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb43a('0x7')]},'key':{'type':Sequelize[_0xb43a('0x7')]},'keyType':{'type':Sequelize[_0xb43a('0x2')](_0xb43a('0x3'),'variable',_0xb43a('0x4'))},'keyContent':{'type':Sequelize[_0xb43a('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xb43a('0x7')]}}; \ No newline at end of file +var _0xf37f=['STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x6489f6,_0xde8e10){var _0xa566db=function(_0x4ec70a){while(--_0x4ec70a){_0x6489f6['push'](_0x6489f6['shift']());}};_0xa566db(++_0xde8e10);}(_0xf37f,0x1f1));var _0xff37=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0xf37f[_0xa9a245];return _0x2d0eaa;};'use strict';var Sequelize=require(_0xff37('0x0'));module[_0xff37('0x1')]={'type':{'type':Sequelize['ENUM'](_0xff37('0x2'),_0xff37('0x3'),_0xff37('0x4'),_0xff37('0x5'),_0xff37('0x6')),'defaultValue':_0xff37('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xff37('0x7')]},'keyType':{'type':Sequelize[_0xff37('0x8')](_0xff37('0x2'),_0xff37('0x3'),_0xff37('0x4'))},'keyContent':{'type':Sequelize[_0xff37('0x7')]},'idField':{'type':Sequelize[_0xff37('0x7')]},'variableName':{'type':Sequelize[_0xff37('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 364cf2c..d42e61c 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 _0x883f=['type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','rimraf','zip-dir','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','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','map','SalesforceField','rawAttributes','fieldName'];(function(_0x21ecea,_0x554c14){var _0x123f9c=function(_0xf65e09){while(--_0xf65e09){_0x21ecea['push'](_0x21ecea['shift']());}};_0x123f9c(++_0x554c14);}(_0x883f,0xb3));var _0xf883=function(_0x40fa3f,_0x3f3a11){_0x40fa3f=_0x40fa3f-0x0;var _0x5cc845=_0x883f[_0x40fa3f];return _0x5cc845;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf883('0x0'));var zipdir=require(_0xf883('0x1'));var jsonpatch=require(_0xf883('0x2'));var rp=require(_0xf883('0x3'));var moment=require(_0xf883('0x4'));var BPromise=require(_0xf883('0x5'));var Mustache=require(_0xf883('0x6'));var util=require('util');var path=require(_0xf883('0x7'));var sox=require(_0xf883('0x8'));var csv=require(_0xf883('0x9'));var ejs=require(_0xf883('0xa'));var fs=require('fs');var fs_extra=require(_0xf883('0xb'));var _=require('lodash');var squel=require(_0xf883('0xc'));var crypto=require('crypto');var jsforce=require(_0xf883('0xd'));var deskjs=require(_0xf883('0xe'));var toCsv=require(_0xf883('0x9'));var querystring=require(_0xf883('0xf'));var Papa=require(_0xf883('0x10'));var Redis=require(_0xf883('0x11'));var authService=require(_0xf883('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf883('0x13'));var hardwareService=require(_0xf883('0x14'));var logger=require(_0xf883('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf883('0x16'));var licenseUtil=require(_0xf883('0x17'));var db=require(_0xf883('0x18'))['db'];function respondWithStatusCode(_0x278b90,_0x559ad1){_0x559ad1=_0x559ad1||0xcc;return function(_0x2813c1){if(_0x2813c1){return _0x278b90[_0xf883('0x19')](_0x559ad1);}return _0x278b90[_0xf883('0x1a')](_0x559ad1)['end']();};}function respondWithResult(_0x496ea5,_0x222050){_0x222050=_0x222050||0xc8;return function(_0x45aad6){if(_0x45aad6){return _0x496ea5[_0xf883('0x1a')](_0x222050)[_0xf883('0x1b')](_0x45aad6);}};}function respondWithFilteredResult(_0x2fb52f,_0x8d2e92){return function(_0x162a04){if(_0x162a04){var _0x45a614=typeof _0x8d2e92['offset']===_0xf883('0x1c')&&typeof _0x8d2e92[_0xf883('0x1d')]==='undefined';var _0x23f438=_0x162a04[_0xf883('0x1e')];var _0xdb5fe5=_0x45a614?0x0:_0x8d2e92['offset'];var _0x11a84a=_0x45a614?_0x162a04[_0xf883('0x1e')]:_0x8d2e92['offset']+_0x8d2e92[_0xf883('0x1d')];var _0x37d4f9;if(_0x11a84a>=_0x23f438){_0x11a84a=_0x23f438;_0x37d4f9=0xc8;}else{_0x37d4f9=0xce;}_0x2fb52f[_0xf883('0x1a')](_0x37d4f9);return _0x2fb52f[_0xf883('0x1f')](_0xf883('0x20'),_0xdb5fe5+'-'+_0x11a84a+'/'+_0x23f438)[_0xf883('0x1b')](_0x162a04);}return null;};}function patchUpdates(_0x458607){return function(_0x3eb74c){try{jsonpatch[_0xf883('0x21')](_0x3eb74c,_0x458607,!![]);}catch(_0x2d248d){return BPromise['reject'](_0x2d248d);}return _0x3eb74c[_0xf883('0x22')]();};}function saveUpdates(_0x2a8fd9,_0x3838a5){return function(_0x163c2f){if(_0x163c2f){return _0x163c2f[_0xf883('0x23')](_0x2a8fd9)[_0xf883('0x24')](function(_0xe2f329){return _0xe2f329;});}return null;};}function removeEntity(_0x15dd57,_0x28de50){return function(_0x1daed5){if(_0x1daed5){return _0x1daed5[_0xf883('0x25')]()[_0xf883('0x24')](function(){_0x15dd57[_0xf883('0x1a')](0xcc)[_0xf883('0x26')]();});}};}function handleEntityNotFound(_0x41adc7,_0x2b81ab){return function(_0x3afabf){if(!_0x3afabf){_0x41adc7[_0xf883('0x19')](0x194);}return _0x3afabf;};}function handleError(_0x36e541,_0x5982f4){_0x5982f4=_0x5982f4||0x1f4;return function(_0x12aa64){logger[_0xf883('0x27')](_0x12aa64[_0xf883('0x28')]);if(_0x12aa64[_0xf883('0x29')]){delete _0x12aa64[_0xf883('0x29')];}_0x36e541[_0xf883('0x1a')](_0x5982f4)['send'](_0x12aa64);};}exports['index']=function(_0x4f05db,_0x2d84d4){var _0x49d90b={},_0x370aeb={},_0x31f69a={'count':0x0,'rows':[]};var _0x23e7d6=_[_0xf883('0x2a')](db[_0xf883('0x2b')][_0xf883('0x2c')],function(_0x24f7b1){return{'name':_0x24f7b1[_0xf883('0x2d')],'type':_0x24f7b1[_0xf883('0x2e')][_0xf883('0x2f')]};});_0x370aeb[_0xf883('0x30')]=_[_0xf883('0x2a')](_0x23e7d6,_0xf883('0x29'));_0x370aeb[_0xf883('0x31')]=_['keys'](_0x4f05db[_0xf883('0x31')]);_0x370aeb[_0xf883('0x32')]=_[_0xf883('0x33')](_0x370aeb[_0xf883('0x30')],_0x370aeb['query']);_0x49d90b[_0xf883('0x34')]=_[_0xf883('0x33')](_0x370aeb[_0xf883('0x30')],qs[_0xf883('0x35')](_0x4f05db[_0xf883('0x31')][_0xf883('0x35')]));_0x49d90b[_0xf883('0x34')]=_0x49d90b[_0xf883('0x34')][_0xf883('0x36')]?_0x49d90b[_0xf883('0x34')]:_0x370aeb[_0xf883('0x30')];if(!_0x4f05db['query'][_0xf883('0x37')](_0xf883('0x38'))){_0x49d90b[_0xf883('0x1d')]=qs[_0xf883('0x1d')](_0x4f05db[_0xf883('0x31')][_0xf883('0x1d')]);_0x49d90b['offset']=qs[_0xf883('0x39')](_0x4f05db[_0xf883('0x31')][_0xf883('0x39')]);}_0x49d90b['order']=qs[_0xf883('0x3a')](_0x4f05db['query'][_0xf883('0x3a')]);_0x49d90b[_0xf883('0x3b')]=qs[_0xf883('0x32')](_[_0xf883('0x3c')](_0x4f05db['query'],_0x370aeb[_0xf883('0x32')]),_0x23e7d6);if(_0x4f05db['query'][_0xf883('0x3d')]){_0x49d90b['where']=_[_0xf883('0x3e')](_0x49d90b[_0xf883('0x3b')],{'$or':_['map'](_0x23e7d6,function(_0x24d6d8){if(_0x24d6d8[_0xf883('0x2e')]!=='VIRTUAL'){var _0x1c2546={};_0x1c2546[_0x24d6d8[_0xf883('0x29')]]={'$like':'%'+_0x4f05db[_0xf883('0x31')][_0xf883('0x3d')]+'%'};return _0x1c2546;}})});}_0x49d90b=_[_0xf883('0x3e')]({},_0x49d90b,_0x4f05db[_0xf883('0x3f')]);var _0x20243d={'where':_0x49d90b[_0xf883('0x3b')]};return db['SalesforceField'][_0xf883('0x1e')](_0x20243d)[_0xf883('0x24')](function(_0x401bda){_0x31f69a[_0xf883('0x1e')]=_0x401bda;if(_0x4f05db[_0xf883('0x31')][_0xf883('0x40')]){_0x49d90b[_0xf883('0x41')]=[{'all':!![]}];}return db[_0xf883('0x2b')][_0xf883('0x42')](_0x49d90b);})[_0xf883('0x24')](function(_0x25f353){_0x31f69a[_0xf883('0x43')]=_0x25f353;return _0x31f69a;})['then'](respondWithFilteredResult(_0x2d84d4,_0x49d90b))['catch'](handleError(_0x2d84d4,null));};exports[_0xf883('0x44')]=function(_0x32b440,_0x382b21){var _0x5ced00={'raw':!![],'where':{'id':_0x32b440[_0xf883('0x45')]['id']}},_0x71c661={};_0x71c661[_0xf883('0x30')]=_[_0xf883('0x46')](db['SalesforceField'][_0xf883('0x2c')]);_0x71c661[_0xf883('0x31')]=_[_0xf883('0x46')](_0x32b440[_0xf883('0x31')]);_0x71c661['filters']=_[_0xf883('0x33')](_0x71c661[_0xf883('0x30')],_0x71c661['query']);_0x5ced00[_0xf883('0x34')]=_[_0xf883('0x33')](_0x71c661[_0xf883('0x30')],qs[_0xf883('0x35')](_0x32b440['query'][_0xf883('0x35')]));_0x5ced00['attributes']=_0x5ced00[_0xf883('0x34')][_0xf883('0x36')]?_0x5ced00['attributes']:_0x71c661[_0xf883('0x30')];if(_0x32b440[_0xf883('0x31')]['includeAll']){_0x5ced00[_0xf883('0x41')]=[{'all':!![]}];}_0x5ced00=_['merge']({},_0x5ced00,_0x32b440[_0xf883('0x3f')]);return db[_0xf883('0x2b')][_0xf883('0x47')](_0x5ced00)[_0xf883('0x24')](handleEntityNotFound(_0x382b21,null))['then'](respondWithResult(_0x382b21,null))[_0xf883('0x48')](handleError(_0x382b21,null));};exports[_0xf883('0x49')]=function(_0x86c6a2,_0x1e8ebc){return db[_0xf883('0x2b')]['create'](_0x86c6a2[_0xf883('0x4a')],{})[_0xf883('0x24')](respondWithResult(_0x1e8ebc,0xc9))['catch'](handleError(_0x1e8ebc,null));};exports['update']=function(_0x1aadc3,_0x29dbab){if(_0x1aadc3['body']['id']){delete _0x1aadc3[_0xf883('0x4a')]['id'];}return db[_0xf883('0x2b')][_0xf883('0x47')]({'where':{'id':_0x1aadc3[_0xf883('0x45')]['id']}})['then'](handleEntityNotFound(_0x29dbab,null))[_0xf883('0x24')](saveUpdates(_0x1aadc3[_0xf883('0x4a')],null))[_0xf883('0x24')](respondWithResult(_0x29dbab,null))['catch'](handleError(_0x29dbab,null));};exports[_0xf883('0x25')]=function(_0x13463d,_0x574eb7){return db[_0xf883('0x2b')][_0xf883('0x47')]({'where':{'id':_0x13463d[_0xf883('0x45')]['id']}})[_0xf883('0x24')](handleEntityNotFound(_0x574eb7,null))[_0xf883('0x24')](removeEntity(_0x574eb7,null))['catch'](handleError(_0x574eb7,null));}; \ No newline at end of file +var _0x2eaf=['moment','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','request-promise'];(function(_0x3be715,_0x54cb1f){var _0x10406b=function(_0x40f083){while(--_0x40f083){_0x3be715['push'](_0x3be715['shift']());}};_0x10406b(++_0x54cb1f);}(_0x2eaf,0x11d));var _0xf2ea=function(_0x39b249,_0x572bb7){_0x39b249=_0x39b249-0x0;var _0x3ea44a=_0x2eaf[_0x39b249];return _0x3ea44a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2ea('0x0'));var zipdir=require(_0xf2ea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2ea('0x2'));var moment=require(_0xf2ea('0x3'));var BPromise=require(_0xf2ea('0x4'));var Mustache=require(_0xf2ea('0x5'));var util=require(_0xf2ea('0x6'));var path=require(_0xf2ea('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf2ea('0x8'));var fs=require('fs');var fs_extra=require(_0xf2ea('0x9'));var _=require('lodash');var squel=require(_0xf2ea('0xa'));var crypto=require('crypto');var jsforce=require(_0xf2ea('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf2ea('0xc'));var querystring=require(_0xf2ea('0xd'));var Papa=require(_0xf2ea('0xe'));var Redis=require(_0xf2ea('0xf'));var authService=require(_0xf2ea('0x10'));var qs=require(_0xf2ea('0x11'));var as=require(_0xf2ea('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2ea('0x13'))(_0xf2ea('0x14'));var utils=require(_0xf2ea('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf72e0b,_0x55abb5){_0x55abb5=_0x55abb5||0xcc;return function(_0x3b4c5c){if(_0x3b4c5c){return _0xf72e0b[_0xf2ea('0x16')](_0x55abb5);}return _0xf72e0b[_0xf2ea('0x17')](_0x55abb5)[_0xf2ea('0x18')]();};}function respondWithResult(_0x150c2b,_0x1d91e2){_0x1d91e2=_0x1d91e2||0xc8;return function(_0x5f2e71){if(_0x5f2e71){return _0x150c2b['status'](_0x1d91e2)[_0xf2ea('0x19')](_0x5f2e71);}};}function respondWithFilteredResult(_0x153dce,_0x2c6c4d){return function(_0x2133ac){if(_0x2133ac){var _0x938689=typeof _0x2c6c4d[_0xf2ea('0x1a')]==='undefined'&&typeof _0x2c6c4d[_0xf2ea('0x1b')]===_0xf2ea('0x1c');var _0x869fd1=_0x2133ac[_0xf2ea('0x1d')];var _0xbe3a53=_0x938689?0x0:_0x2c6c4d[_0xf2ea('0x1a')];var _0x1fc92e=_0x938689?_0x2133ac['count']:_0x2c6c4d['offset']+_0x2c6c4d[_0xf2ea('0x1b')];var _0x5f2f5e;if(_0x1fc92e>=_0x869fd1){_0x1fc92e=_0x869fd1;_0x5f2f5e=0xc8;}else{_0x5f2f5e=0xce;}_0x153dce['status'](_0x5f2f5e);return _0x153dce['set'](_0xf2ea('0x1e'),_0xbe3a53+'-'+_0x1fc92e+'/'+_0x869fd1)[_0xf2ea('0x19')](_0x2133ac);}return null;};}function patchUpdates(_0x56830f){return function(_0x5a7b31){try{jsonpatch[_0xf2ea('0x1f')](_0x5a7b31,_0x56830f,!![]);}catch(_0x2fc429){return BPromise[_0xf2ea('0x20')](_0x2fc429);}return _0x5a7b31[_0xf2ea('0x21')]();};}function saveUpdates(_0x2ab888,_0x17b011){return function(_0x4615b0){if(_0x4615b0){return _0x4615b0[_0xf2ea('0x22')](_0x2ab888)[_0xf2ea('0x23')](function(_0x321527){return _0x321527;});}return null;};}function removeEntity(_0x10c15d,_0x5849e1){return function(_0x159f66){if(_0x159f66){return _0x159f66[_0xf2ea('0x24')]()[_0xf2ea('0x23')](function(){_0x10c15d[_0xf2ea('0x17')](0xcc)[_0xf2ea('0x18')]();});}};}function handleEntityNotFound(_0x383406,_0xf0d055){return function(_0x3f1f28){if(!_0x3f1f28){_0x383406[_0xf2ea('0x16')](0x194);}return _0x3f1f28;};}function handleError(_0x1c83fa,_0x3b414a){_0x3b414a=_0x3b414a||0x1f4;return function(_0x59a6ac){logger[_0xf2ea('0x25')](_0x59a6ac['stack']);if(_0x59a6ac[_0xf2ea('0x26')]){delete _0x59a6ac['name'];}_0x1c83fa[_0xf2ea('0x17')](_0x3b414a)[_0xf2ea('0x27')](_0x59a6ac);};}exports[_0xf2ea('0x28')]=function(_0x19bb1a,_0x1847b6){var _0x4cfc25={},_0x1e3e5b={},_0x353370={'count':0x0,'rows':[]};var _0x3546b3=_[_0xf2ea('0x29')](db[_0xf2ea('0x2a')][_0xf2ea('0x2b')],function(_0x49c67f){return{'name':_0x49c67f[_0xf2ea('0x2c')],'type':_0x49c67f[_0xf2ea('0x2d')][_0xf2ea('0x2e')]};});_0x1e3e5b[_0xf2ea('0x2f')]=_[_0xf2ea('0x29')](_0x3546b3,'name');_0x1e3e5b[_0xf2ea('0x30')]=_[_0xf2ea('0x31')](_0x19bb1a[_0xf2ea('0x30')]);_0x1e3e5b[_0xf2ea('0x32')]=_[_0xf2ea('0x33')](_0x1e3e5b[_0xf2ea('0x2f')],_0x1e3e5b[_0xf2ea('0x30')]);_0x4cfc25[_0xf2ea('0x34')]=_['intersection'](_0x1e3e5b[_0xf2ea('0x2f')],qs[_0xf2ea('0x35')](_0x19bb1a[_0xf2ea('0x30')][_0xf2ea('0x35')]));_0x4cfc25[_0xf2ea('0x34')]=_0x4cfc25['attributes']['length']?_0x4cfc25[_0xf2ea('0x34')]:_0x1e3e5b[_0xf2ea('0x2f')];if(!_0x19bb1a[_0xf2ea('0x30')]['hasOwnProperty'](_0xf2ea('0x36'))){_0x4cfc25[_0xf2ea('0x1b')]=qs[_0xf2ea('0x1b')](_0x19bb1a['query'][_0xf2ea('0x1b')]);_0x4cfc25[_0xf2ea('0x1a')]=qs[_0xf2ea('0x1a')](_0x19bb1a[_0xf2ea('0x30')][_0xf2ea('0x1a')]);}_0x4cfc25['order']=qs[_0xf2ea('0x37')](_0x19bb1a[_0xf2ea('0x30')][_0xf2ea('0x37')]);_0x4cfc25['where']=qs[_0xf2ea('0x32')](_[_0xf2ea('0x38')](_0x19bb1a[_0xf2ea('0x30')],_0x1e3e5b[_0xf2ea('0x32')]),_0x3546b3);if(_0x19bb1a['query'][_0xf2ea('0x39')]){_0x4cfc25['where']=_[_0xf2ea('0x3a')](_0x4cfc25[_0xf2ea('0x3b')],{'$or':_[_0xf2ea('0x29')](_0x3546b3,function(_0x191cf6){if(_0x191cf6['type']!==_0xf2ea('0x3c')){var _0x34b9c7={};_0x34b9c7[_0x191cf6[_0xf2ea('0x26')]]={'$like':'%'+_0x19bb1a[_0xf2ea('0x30')][_0xf2ea('0x39')]+'%'};return _0x34b9c7;}})});}_0x4cfc25=_[_0xf2ea('0x3a')]({},_0x4cfc25,_0x19bb1a[_0xf2ea('0x3d')]);var _0x5f3d9f={'where':_0x4cfc25[_0xf2ea('0x3b')]};return db[_0xf2ea('0x2a')][_0xf2ea('0x1d')](_0x5f3d9f)[_0xf2ea('0x23')](function(_0x4e39d3){_0x353370[_0xf2ea('0x1d')]=_0x4e39d3;if(_0x19bb1a[_0xf2ea('0x30')][_0xf2ea('0x3e')]){_0x4cfc25['include']=[{'all':!![]}];}return db[_0xf2ea('0x2a')][_0xf2ea('0x3f')](_0x4cfc25);})[_0xf2ea('0x23')](function(_0x1ef8d5){_0x353370[_0xf2ea('0x40')]=_0x1ef8d5;return _0x353370;})[_0xf2ea('0x23')](respondWithFilteredResult(_0x1847b6,_0x4cfc25))[_0xf2ea('0x41')](handleError(_0x1847b6,null));};exports[_0xf2ea('0x42')]=function(_0x1d49b5,_0xc4705c){var _0x1af06a={'raw':!![],'where':{'id':_0x1d49b5[_0xf2ea('0x43')]['id']}},_0x426346={};_0x426346[_0xf2ea('0x2f')]=_[_0xf2ea('0x31')](db['SalesforceField'][_0xf2ea('0x2b')]);_0x426346[_0xf2ea('0x30')]=_['keys'](_0x1d49b5[_0xf2ea('0x30')]);_0x426346['filters']=_[_0xf2ea('0x33')](_0x426346[_0xf2ea('0x2f')],_0x426346[_0xf2ea('0x30')]);_0x1af06a[_0xf2ea('0x34')]=_[_0xf2ea('0x33')](_0x426346[_0xf2ea('0x2f')],qs[_0xf2ea('0x35')](_0x1d49b5[_0xf2ea('0x30')][_0xf2ea('0x35')]));_0x1af06a['attributes']=_0x1af06a[_0xf2ea('0x34')]['length']?_0x1af06a[_0xf2ea('0x34')]:_0x426346['model'];if(_0x1d49b5[_0xf2ea('0x30')][_0xf2ea('0x3e')]){_0x1af06a[_0xf2ea('0x44')]=[{'all':!![]}];}_0x1af06a=_[_0xf2ea('0x3a')]({},_0x1af06a,_0x1d49b5[_0xf2ea('0x3d')]);return db[_0xf2ea('0x2a')][_0xf2ea('0x45')](_0x1af06a)[_0xf2ea('0x23')](handleEntityNotFound(_0xc4705c,null))['then'](respondWithResult(_0xc4705c,null))[_0xf2ea('0x41')](handleError(_0xc4705c,null));};exports['create']=function(_0xecb81d,_0x2941a7){return db[_0xf2ea('0x2a')][_0xf2ea('0x46')](_0xecb81d['body'],{})['then'](respondWithResult(_0x2941a7,0xc9))[_0xf2ea('0x41')](handleError(_0x2941a7,null));};exports[_0xf2ea('0x22')]=function(_0x502305,_0x5700a9){if(_0x502305[_0xf2ea('0x47')]['id']){delete _0x502305[_0xf2ea('0x47')]['id'];}return db[_0xf2ea('0x2a')]['find']({'where':{'id':_0x502305[_0xf2ea('0x43')]['id']}})['then'](handleEntityNotFound(_0x5700a9,null))[_0xf2ea('0x23')](saveUpdates(_0x502305[_0xf2ea('0x47')],null))[_0xf2ea('0x23')](respondWithResult(_0x5700a9,null))[_0xf2ea('0x41')](handleError(_0x5700a9,null));};exports[_0xf2ea('0x24')]=function(_0x121862,_0x55dde8){return db['SalesforceField'][_0xf2ea('0x45')]({'where':{'id':_0x121862[_0xf2ea('0x43')]['id']}})[_0xf2ea('0x23')](handleEntityNotFound(_0x55dde8,null))[_0xf2ea('0x23')](removeEntity(_0x55dde8,null))[_0xf2ea('0x41')](handleError(_0x55dde8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d64039d..84a6b8b 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 _0xda93=['util','moment','bluebird','request-promise','rimraf','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x316540,_0x24c1ea){var _0x7d721d=function(_0x3fbefd){while(--_0x3fbefd){_0x316540['push'](_0x316540['shift']());}};_0x7d721d(++_0x24c1ea);}(_0xda93,0x18c));var _0x3da9=function(_0x4352e6,_0x90b841){_0x4352e6=_0x4352e6-0x0;var _0x5dfd19=_0xda93[_0x4352e6];return _0x5dfd19;};'use strict';var _=require('lodash');var util=require(_0x3da9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x3da9('0x1'));var BPromise=require(_0x3da9('0x2'));var rp=require(_0x3da9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3da9('0x4'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x3da9('0x5')]=function(_0x342d7a,_0x1488ca){return _0x342d7a[_0x3da9('0x6')]('SalesforceField',attributes,{'tableName':_0x3da9('0x7'),'paranoid':![],'indexes':[{'name':_0x3da9('0x8'),'fields':[_0x3da9('0x9'),_0x3da9('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2432=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x2432,0x18f));var _0x2243=function(_0x2ab02b,_0x44a225){_0x2ab02b=_0x2ab02b-0x0;var _0x1750ae=_0x2432[_0x2ab02b];return _0x1750ae;};'use strict';var _=require(_0x2243('0x0'));var util=require(_0x2243('0x1'));var logger=require(_0x2243('0x2'))(_0x2243('0x3'));var moment=require(_0x2243('0x4'));var BPromise=require(_0x2243('0x5'));var rp=require(_0x2243('0x6'));var fs=require('fs');var path=require(_0x2243('0x7'));var rimraf=require(_0x2243('0x8'));var config=require(_0x2243('0x9'));var attributes=require(_0x2243('0xa'));module[_0x2243('0xb')]=function(_0x47a1a8,_0x1bd703){return _0x47a1a8[_0x2243('0xc')](_0x2243('0xd'),attributes,{'tableName':_0x2243('0xe'),'paranoid':![],'indexes':[{'name':_0x2243('0xf'),'fields':['idField',_0x2243('0x10')],'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 f84b99d..2b6d18b 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 _0x33a8=['jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x99189f,_0x3472e4){var _0x258e46=function(_0x4c3abb){while(--_0x4c3abb){_0x99189f['push'](_0x99189f['shift']());}};_0x258e46(++_0x3472e4);}(_0x33a8,0x150));var _0x833a=function(_0x549d20,_0xaf444a){_0x549d20=_0x549d20-0x0;var _0x2f6960=_0x33a8[_0x549d20];return _0x2f6960;};'use strict';var _=require(_0x833a('0x0'));var util=require('util');var moment=require(_0x833a('0x1'));var BPromise=require(_0x833a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x833a('0x3'));var db=require(_0x833a('0x4'))['db'];var utils=require(_0x833a('0x5'));var logger=require(_0x833a('0x6'))(_0x833a('0x7'));var config=require(_0x833a('0x8'));var jayson=require(_0x833a('0x9'));var client=jayson['client'][_0x833a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x561620,_0x39703a,_0x301a10){return new BPromise(function(_0x27d800,_0x1ef5db){return client[_0x833a('0xb')](_0x561620,_0x301a10)[_0x833a('0xc')](function(_0xa3e2e6){logger[_0x833a('0xd')](_0x833a('0xe'),_0x39703a,_0x833a('0xf'));logger[_0x833a('0x10')](_0x833a('0x11'),_0x39703a,'request\x20sent',JSON[_0x833a('0x12')](_0xa3e2e6));if(_0xa3e2e6[_0x833a('0x13')]){if(_0xa3e2e6[_0x833a('0x13')][_0x833a('0x14')]===0x1f4){logger['error'](_0x833a('0xe'),_0x39703a,_0xa3e2e6[_0x833a('0x13')][_0x833a('0x15')]);return _0x1ef5db(_0xa3e2e6['error'][_0x833a('0x15')]);}logger[_0x833a('0x13')](_0x833a('0xe'),_0x39703a,_0xa3e2e6[_0x833a('0x13')][_0x833a('0x15')]);return _0x27d800(_0xa3e2e6[_0x833a('0x13')][_0x833a('0x15')]);}else{logger[_0x833a('0xd')](_0x833a('0xe'),_0x39703a,'request\x20sent');_0x27d800(_0xa3e2e6['result'][_0x833a('0x15')]);}})[_0x833a('0x16')](function(_0x5ac0fd){logger['error'](_0x833a('0xe'),_0x39703a,_0x5ac0fd);_0x1ef5db(_0x5ac0fd);});});} \ No newline at end of file +var _0x1ff1=['SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x31f22e,_0x434db1){var _0x16e1b0=function(_0x4f5355){while(--_0x4f5355){_0x31f22e['push'](_0x31f22e['shift']());}};_0x16e1b0(++_0x434db1);}(_0x1ff1,0x15b));var _0x11ff=function(_0x262f1c,_0x404724){_0x262f1c=_0x262f1c-0x0;var _0x1c3e3c=_0x1ff1[_0x262f1c];return _0x1c3e3c;};'use strict';var _=require('lodash');var util=require(_0x11ff('0x0'));var moment=require(_0x11ff('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11ff('0x2'));var db=require(_0x11ff('0x3'))['db'];var utils=require(_0x11ff('0x4'));var logger=require(_0x11ff('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x11ff('0x6')][_0x11ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e0576,_0x300576,_0x5a7d57){return new BPromise(function(_0x2441fe,_0x56dccf){return client[_0x11ff('0x8')](_0x4e0576,_0x5a7d57)[_0x11ff('0x9')](function(_0x15a0a6){logger[_0x11ff('0xa')](_0x11ff('0xb'),_0x300576,_0x11ff('0xc'));logger[_0x11ff('0xd')](_0x11ff('0xe'),_0x300576,'request\x20sent',JSON['stringify'](_0x15a0a6));if(_0x15a0a6[_0x11ff('0xf')]){if(_0x15a0a6[_0x11ff('0xf')][_0x11ff('0x10')]===0x1f4){logger[_0x11ff('0xf')](_0x11ff('0xb'),_0x300576,_0x15a0a6[_0x11ff('0xf')]['message']);return _0x56dccf(_0x15a0a6[_0x11ff('0xf')][_0x11ff('0x11')]);}logger[_0x11ff('0xf')]('SalesforceField,\x20%s,\x20%s',_0x300576,_0x15a0a6[_0x11ff('0xf')][_0x11ff('0x11')]);return _0x2441fe(_0x15a0a6[_0x11ff('0xf')][_0x11ff('0x11')]);}else{logger[_0x11ff('0xa')](_0x11ff('0xb'),_0x300576,_0x11ff('0xc'));_0x2441fe(_0x15a0a6[_0x11ff('0x12')]['message']);}})['catch'](function(_0x905bf9){logger['error'](_0x11ff('0xb'),_0x300576,_0x905bf9);_0x56dccf(_0x905bf9);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6c15f73..cfd82a1 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 _0xba28=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','update','delete','destroy','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0xba28,0xc8));var _0x8ba2=function(_0x173f10,_0x35db61){_0x173f10=_0x173f10-0x0;var _0x53142d=_0xba28[_0x173f10];return _0x53142d;};'use strict';var multer=require(_0x8ba2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8ba2('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ba2('0x2'));var auth=require(_0x8ba2('0x3'));var interaction=require(_0x8ba2('0x4'));var config=require(_0x8ba2('0x5'));var controller=require(_0x8ba2('0x6'));router[_0x8ba2('0x7')]('/',auth[_0x8ba2('0x8')](),controller[_0x8ba2('0x9')]);router[_0x8ba2('0x7')](_0x8ba2('0xa'),auth[_0x8ba2('0x8')](),controller[_0x8ba2('0xb')]);router[_0x8ba2('0x7')](_0x8ba2('0xc'),auth[_0x8ba2('0x8')](),controller[_0x8ba2('0xd')]);router['get'](_0x8ba2('0xe'),auth['isAuthenticated'](),controller[_0x8ba2('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8ba2('0xc'),auth[_0x8ba2('0x8')](),controller[_0x8ba2('0x10')]);router[_0x8ba2('0x11')](_0x8ba2('0xa'),auth[_0x8ba2('0x8')](),controller[_0x8ba2('0x12')]);router[_0x8ba2('0x13')](_0x8ba2('0xa'),auth[_0x8ba2('0x8')](),controller[_0x8ba2('0x14')]);module['exports']=router; \ No newline at end of file +var _0xce1e=['update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','/:id','isAuthenticated','/:id/configurations','get','/:id/fields','getFields','post','addConfiguration','put'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xce1e,0x97));var _0xece1=function(_0x126464,_0x9d627f){_0x126464=_0x126464-0x0;var _0x5c06cf=_0xce1e[_0x126464];return _0x5c06cf;};'use strict';var multer=require(_0xece1('0x0'));var util=require(_0xece1('0x1'));var path=require('path');var timeout=require(_0xece1('0x2'));var express=require('express');var router=express[_0xece1('0x3')]();var fs_extra=require(_0xece1('0x4'));var auth=require(_0xece1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xece1('0x6'));var controller=require(_0xece1('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xece1('0x8'),auth[_0xece1('0x9')](),controller['show']);router['get'](_0xece1('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xece1('0xb')](_0xece1('0xc'),auth['isAuthenticated'](),controller[_0xece1('0xd')]);router[_0xece1('0xe')]('/',auth[_0xece1('0x9')](),controller['create']);router[_0xece1('0xe')](_0xece1('0xa'),auth[_0xece1('0x9')](),controller[_0xece1('0xf')]);router[_0xece1('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xece1('0x11')]);router[_0xece1('0x12')](_0xece1('0x8'),auth[_0xece1('0x9')](),controller[_0xece1('0x13')]);module[_0xece1('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 560cef4..aa1c323 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 _0xc458=['STRING','remoteUri','sequelize'];(function(_0x44b04c,_0x5786a3){var _0x1d2442=function(_0x5d6671){while(--_0x5d6671){_0x44b04c['push'](_0x44b04c['shift']());}};_0x1d2442(++_0x5786a3);}(_0xc458,0x107));var _0x8c45=function(_0x57c026,_0x44d524){_0x57c026=_0x57c026-0x0;var _0x2da5e6=_0xc458[_0x57c026];return _0x2da5e6;};'use strict';var Sequelize=require(_0x8c45('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8c45('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x8c45('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8c45('0x1')],'unique':_0x8c45('0x2')},'serverUrl':{'type':Sequelize[_0x8c45('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb0cf=['sequelize','exports','STRING','username'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb0cf,0xec));var _0xfb0c=function(_0x2724f7,_0xdab58f){_0x2724f7=_0x2724f7-0x0;var _0x3b930f=_0xb0cf[_0x2724f7];return _0x3b930f;};'use strict';var Sequelize=require(_0xfb0c('0x0'));module[_0xfb0c('0x1')]={'name':{'type':Sequelize[_0xfb0c('0x2')]},'description':{'type':Sequelize[_0xfb0c('0x2')]},'username':{'type':Sequelize[_0xfb0c('0x2')],'unique':_0xfb0c('0x3')},'password':{'type':Sequelize[_0xfb0c('0x2')]},'email':{'type':Sequelize[_0xfb0c('0x2')]},'remoteUri':{'type':Sequelize[_0xfb0c('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 70dd176..8313564 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 _0x1dbc=['incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','sys_domain_path','time_worked','business_duration','group_list','reopened_time','caller_id','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','company','reassignment_count','comments','sla_due','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','test','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ServicenowAccount','includeAll','include','catch','show','params','keys','find','create','body','findOne','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify'];(function(_0x4c2916,_0x41d619){var _0x29ddd3=function(_0x36ab0f){while(--_0x36ab0f){_0x4c2916['push'](_0x4c2916['shift']());}};_0x29ddd3(++_0x41d619);}(_0x1dbc,0x1c8));var _0xc1db=function(_0x527ce8,_0x122695){_0x527ce8=_0x527ce8-0x0;var _0x2a8a56=_0x1dbc[_0x527ce8];return _0x2a8a56;};'use strict';var emlformat=require(_0xc1db('0x0'));var rimraf=require(_0xc1db('0x1'));var zipdir=require(_0xc1db('0x2'));var jsonpatch=require(_0xc1db('0x3'));var rp=require(_0xc1db('0x4'));var moment=require(_0xc1db('0x5'));var BPromise=require(_0xc1db('0x6'));var Mustache=require(_0xc1db('0x7'));var util=require(_0xc1db('0x8'));var path=require(_0xc1db('0x9'));var sox=require(_0xc1db('0xa'));var csv=require(_0xc1db('0xb'));var ejs=require(_0xc1db('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1db('0xd'));var squel=require(_0xc1db('0xe'));var crypto=require(_0xc1db('0xf'));var jsforce=require(_0xc1db('0x10'));var deskjs=require(_0xc1db('0x11'));var toCsv=require(_0xc1db('0xb'));var querystring=require(_0xc1db('0x12'));var Papa=require(_0xc1db('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc1db('0x14'));var hardwareService=require(_0xc1db('0x15'));var logger=require(_0xc1db('0x16'))(_0xc1db('0x17'));var utils=require(_0xc1db('0x18'));var config=require(_0xc1db('0x19'));var licenseUtil=require(_0xc1db('0x1a'));var db=require(_0xc1db('0x1b'))['db'];var integrations=require(_0xc1db('0x1c'));function respondWithStatusCode(_0x5f2f1f,_0x4c12d1){_0x4c12d1=_0x4c12d1||0xcc;return function(_0x5819b9){if(_0x5819b9){return _0x5f2f1f[_0xc1db('0x1d')](_0x4c12d1);}return _0x5f2f1f[_0xc1db('0x1e')](_0x4c12d1)['end']();};}function respondWithResult(_0x8d5ef9,_0x30d1d9){_0x30d1d9=_0x30d1d9||0xc8;return function(_0x58c8cd){if(_0x58c8cd){return _0x8d5ef9[_0xc1db('0x1e')](_0x30d1d9)[_0xc1db('0x1f')](_0x58c8cd);}};}function respondWithFilteredResult(_0x21652e,_0x54414c){return function(_0xa09c8){if(_0xa09c8){var _0x27b9a5=typeof _0x54414c[_0xc1db('0x20')]==='undefined'&&typeof _0x54414c[_0xc1db('0x21')]==='undefined';var _0x4d2575=_0xa09c8[_0xc1db('0x22')];var _0x20285c=_0x27b9a5?0x0:_0x54414c[_0xc1db('0x20')];var _0xa7d2ed=_0x27b9a5?_0xa09c8[_0xc1db('0x22')]:_0x54414c[_0xc1db('0x20')]+_0x54414c[_0xc1db('0x21')];var _0xaff96c;if(_0xa7d2ed>=_0x4d2575){_0xa7d2ed=_0x4d2575;_0xaff96c=0xc8;}else{_0xaff96c=0xce;}_0x21652e[_0xc1db('0x1e')](_0xaff96c);return _0x21652e['set'](_0xc1db('0x23'),_0x20285c+'-'+_0xa7d2ed+'/'+_0x4d2575)[_0xc1db('0x1f')](_0xa09c8);}return null;};}function patchUpdates(_0xb07e85){return function(_0xb8bdf9){try{jsonpatch[_0xc1db('0x24')](_0xb8bdf9,_0xb07e85,!![]);}catch(_0x36ad4d){return BPromise[_0xc1db('0x25')](_0x36ad4d);}return _0xb8bdf9[_0xc1db('0x26')]();};}function saveUpdates(_0x38ce97,_0x3a04e3){return function(_0x2566f1){if(_0x2566f1){return _0x2566f1[_0xc1db('0x27')](_0x38ce97)[_0xc1db('0x28')](function(_0x2a5369){return _0x2a5369;});}return null;};}function removeEntity(_0x4e075e,_0x2a27ff){return function(_0x198b18){if(_0x198b18){return _0x198b18[_0xc1db('0x29')]()[_0xc1db('0x28')](function(){_0x4e075e[_0xc1db('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46ba01,_0x4132ba){return function(_0x289718){if(!_0x289718){_0x46ba01[_0xc1db('0x1d')](0x194);}return _0x289718;};}function handleError(_0x1ff8be,_0x49206f){_0x49206f=_0x49206f||0x1f4;return function(_0x4fefd4){logger[_0xc1db('0x2a')](_0x4fefd4['stack']);if(_0x4fefd4['name']){delete _0x4fefd4[_0xc1db('0x2b')];}_0x1ff8be['status'](_0x49206f)['send'](_0x4fefd4);};}exports[_0xc1db('0x2c')]=function(_0xfc41d5,_0x5d527b){var _0x7b153e={},_0x46257c={},_0x144a63={'count':0x0,'rows':[]};var _0xf648c1=_['map'](db['ServicenowAccount'][_0xc1db('0x2d')],function(_0x3f7fa4){return{'name':_0x3f7fa4['fieldName'],'type':_0x3f7fa4['type'][_0xc1db('0x2e')]};});_0x46257c[_0xc1db('0x2f')]=_[_0xc1db('0x30')](_0xf648c1,'name');_0x46257c[_0xc1db('0x31')]=_['keys'](_0xfc41d5['query']);_0x46257c[_0xc1db('0x32')]=_[_0xc1db('0x33')](_0x46257c[_0xc1db('0x2f')],_0x46257c[_0xc1db('0x31')]);_0x7b153e[_0xc1db('0x34')]=_[_0xc1db('0x33')](_0x46257c[_0xc1db('0x2f')],qs[_0xc1db('0x35')](_0xfc41d5['query'][_0xc1db('0x35')]));_0x7b153e['attributes']=_0x7b153e[_0xc1db('0x34')][_0xc1db('0x36')]?_0x7b153e[_0xc1db('0x34')]:_0x46257c[_0xc1db('0x2f')];if(!_0xfc41d5[_0xc1db('0x31')]['hasOwnProperty'](_0xc1db('0x37'))){_0x7b153e['limit']=qs['limit'](_0xfc41d5[_0xc1db('0x31')][_0xc1db('0x21')]);_0x7b153e[_0xc1db('0x20')]=qs[_0xc1db('0x20')](_0xfc41d5[_0xc1db('0x31')][_0xc1db('0x20')]);}_0x7b153e[_0xc1db('0x38')]=qs['sort'](_0xfc41d5['query'][_0xc1db('0x39')]);_0x7b153e[_0xc1db('0x3a')]=qs[_0xc1db('0x32')](_[_0xc1db('0x3b')](_0xfc41d5[_0xc1db('0x31')],_0x46257c[_0xc1db('0x32')]),_0xf648c1);if(_0xfc41d5[_0xc1db('0x31')][_0xc1db('0x3c')]){_0x7b153e[_0xc1db('0x3a')]=_['merge'](_0x7b153e[_0xc1db('0x3a')],{'$or':_[_0xc1db('0x30')](_0xf648c1,function(_0x103fed){if(_0x103fed['type']!==_0xc1db('0x3d')){var _0x998225={};_0x998225[_0x103fed[_0xc1db('0x2b')]]={'$like':'%'+_0xfc41d5[_0xc1db('0x31')]['filter']+'%'};return _0x998225;}})});}_0x7b153e=_[_0xc1db('0x3e')]({},_0x7b153e,_0xfc41d5[_0xc1db('0x3f')]);var _0xc81813={'where':_0x7b153e[_0xc1db('0x3a')]};return db[_0xc1db('0x40')][_0xc1db('0x22')](_0xc81813)['then'](function(_0x29f622){_0x144a63[_0xc1db('0x22')]=_0x29f622;if(_0xfc41d5[_0xc1db('0x31')][_0xc1db('0x41')]){_0x7b153e[_0xc1db('0x42')]=[{'all':!![]}];}return db[_0xc1db('0x40')]['findAll'](_0x7b153e);})[_0xc1db('0x28')](function(_0x2bf3ae){_0x144a63['rows']=_0x2bf3ae;return _0x144a63;})[_0xc1db('0x28')](respondWithFilteredResult(_0x5d527b,_0x7b153e))[_0xc1db('0x43')](handleError(_0x5d527b,null));};exports[_0xc1db('0x44')]=function(_0x300667,_0x15d6dc){var _0x15837a={'raw':![],'where':{'id':_0x300667[_0xc1db('0x45')]['id']}},_0x419628={};_0x419628[_0xc1db('0x2f')]=_[_0xc1db('0x46')](db[_0xc1db('0x40')]['rawAttributes']);_0x419628[_0xc1db('0x31')]=_[_0xc1db('0x46')](_0x300667[_0xc1db('0x31')]);_0x419628[_0xc1db('0x32')]=_[_0xc1db('0x33')](_0x419628['model'],_0x419628[_0xc1db('0x31')]);_0x15837a[_0xc1db('0x34')]=_[_0xc1db('0x33')](_0x419628[_0xc1db('0x2f')],qs['fields'](_0x300667[_0xc1db('0x31')]['fields']));_0x15837a[_0xc1db('0x34')]=_0x15837a[_0xc1db('0x34')][_0xc1db('0x36')]?_0x15837a[_0xc1db('0x34')]:_0x419628['model'];if(_0x300667[_0xc1db('0x31')]['includeAll']){_0x15837a[_0xc1db('0x42')]=[{'all':!![]}];}_0x15837a=_[_0xc1db('0x3e')]({},_0x15837a,_0x300667[_0xc1db('0x3f')]);return db[_0xc1db('0x40')][_0xc1db('0x47')](_0x15837a)['then'](handleEntityNotFound(_0x15d6dc,null))['then'](respondWithResult(_0x15d6dc,null))['catch'](handleError(_0x15d6dc,null));};exports[_0xc1db('0x48')]=function(_0xbe9c09,_0x43d051){return db[_0xc1db('0x40')][_0xc1db('0x48')](_0xbe9c09[_0xc1db('0x49')],{})[_0xc1db('0x28')](respondWithResult(_0x43d051,0xc9))['catch'](handleError(_0x43d051,null));};exports[_0xc1db('0x27')]=function(_0x4326e6,_0x12db87){if(_0x4326e6[_0xc1db('0x49')]['id']){delete _0x4326e6[_0xc1db('0x49')]['id'];}return db[_0xc1db('0x40')][_0xc1db('0x47')]({'where':{'id':_0x4326e6['params']['id']}})[_0xc1db('0x28')](handleEntityNotFound(_0x12db87,null))[_0xc1db('0x28')](saveUpdates(_0x4326e6[_0xc1db('0x49')],null))[_0xc1db('0x28')](respondWithResult(_0x12db87,null))[_0xc1db('0x43')](handleError(_0x12db87,null));};exports[_0xc1db('0x29')]=function(_0x188d29,_0x2f673e){return db['ServicenowAccount'][_0xc1db('0x47')]({'where':{'id':_0x188d29[_0xc1db('0x45')]['id']}})[_0xc1db('0x28')](handleEntityNotFound(_0x2f673e,null))[_0xc1db('0x28')](removeEntity(_0x2f673e,null))[_0xc1db('0x43')](handleError(_0x2f673e,null));};exports['getConfigurations']=function(_0x4d6b61,_0xf10f2d,_0x2cad96){var _0x585bb6={};var _0x570a6d={};var _0x433616;var _0x47f569;return db[_0xc1db('0x40')][_0xc1db('0x4a')]({'where':{'id':_0x4d6b61[_0xc1db('0x45')]['id']}})[_0xc1db('0x28')](handleEntityNotFound(_0xf10f2d,null))[_0xc1db('0x28')](function(_0x4898b1){if(_0x4898b1){_0x433616=_0x4898b1;_0x570a6d['model']=_[_0xc1db('0x46')](db['ServicenowConfiguration'][_0xc1db('0x2d')]);_0x570a6d['query']=_['keys'](_0x4d6b61[_0xc1db('0x31')]);_0x570a6d[_0xc1db('0x32')]=_['intersection'](_0x570a6d[_0xc1db('0x2f')],_0x570a6d[_0xc1db('0x31')]);_0x585bb6[_0xc1db('0x34')]=_[_0xc1db('0x33')](_0x570a6d[_0xc1db('0x2f')],qs[_0xc1db('0x35')](_0x4d6b61[_0xc1db('0x31')]['fields']));_0x585bb6[_0xc1db('0x34')]=_0x585bb6[_0xc1db('0x34')][_0xc1db('0x36')]?_0x585bb6[_0xc1db('0x34')]:_0x570a6d[_0xc1db('0x2f')];_0x585bb6[_0xc1db('0x38')]=qs[_0xc1db('0x39')](_0x4d6b61['query'][_0xc1db('0x39')]);_0x585bb6[_0xc1db('0x3a')]=qs['filters'](_[_0xc1db('0x3b')](_0x4d6b61[_0xc1db('0x31')],_0x570a6d[_0xc1db('0x32')]));if(_0x4d6b61[_0xc1db('0x31')][_0xc1db('0x3c')]){_0x585bb6['where']=_[_0xc1db('0x3e')](_0x585bb6['where'],{'$or':_[_0xc1db('0x30')](_0x585bb6[_0xc1db('0x34')],function(_0x1786a1){var _0x1aaf04={};_0x1aaf04[_0x1786a1]={'$like':'%'+_0x4d6b61[_0xc1db('0x31')][_0xc1db('0x3c')]+'%'};return _0x1aaf04;})});}_0x585bb6=_[_0xc1db('0x3e')]({},_0x585bb6,_0x4d6b61[_0xc1db('0x3f')]);return _0x433616[_0xc1db('0x4b')](_0x585bb6);}})[_0xc1db('0x28')](function(_0x48b897){if(_0x48b897){_0x47f569=_0x48b897['length'];if(!_0x4d6b61[_0xc1db('0x31')][_0xc1db('0x4c')](_0xc1db('0x37'))){_0x585bb6[_0xc1db('0x21')]=qs['limit'](_0x4d6b61[_0xc1db('0x31')][_0xc1db('0x21')]);_0x585bb6[_0xc1db('0x20')]=qs[_0xc1db('0x20')](_0x4d6b61['query']['offset']);}return _0x433616[_0xc1db('0x4b')](_0x585bb6);}})[_0xc1db('0x28')](function(_0xcf54f6){if(_0xcf54f6){return _0xcf54f6?{'count':_0x47f569,'rows':_0xcf54f6}:null;}})['then'](respondWithResult(_0xf10f2d,null))[_0xc1db('0x43')](handleError(_0xf10f2d,null));};exports[_0xc1db('0x4d')]=function(_0x1858f1,_0x1bb73c,_0xe5f967){if(_0x1858f1[_0xc1db('0x49')]['id']){delete _0x1858f1[_0xc1db('0x49')]['id'];}return db[_0xc1db('0x40')]['findOne']({'where':{'id':_0x1858f1['params']['id']}})['then'](handleEntityNotFound(_0x1bb73c,null))[_0xc1db('0x28')](function(_0x2a3916){if(_0x2a3916){_0x1858f1['body'][_0xc1db('0x4e')]=_0x2a3916['id'];_0x1858f1['body'][_0xc1db('0x4f')]=integrations[_0xc1db('0x50')](_0x1858f1[_0xc1db('0x49')][_0xc1db('0x51')],_0x1858f1[_0xc1db('0x49')][_0xc1db('0x52')]);_0x1858f1['body'][_0xc1db('0x53')]=integrations[_0xc1db('0x54')](_0x1858f1[_0xc1db('0x49')][_0xc1db('0x51')],_0x1858f1[_0xc1db('0x49')][_0xc1db('0x52')]);return db[_0xc1db('0x55')][_0xc1db('0x48')](_0x1858f1[_0xc1db('0x49')],{'include':[{'model':db[_0xc1db('0x56')],'as':_0xc1db('0x4f')},{'model':db[_0xc1db('0x56')],'as':_0xc1db('0x53')}]});}return null;})[_0xc1db('0x28')](respondWithResult(_0x1bb73c,null))[_0xc1db('0x43')](handleError(_0x1bb73c,null));};exports['getFields']=function(_0x16b181,_0x4f19a8,_0x7390dd){var _0x31f043=[_0xc1db('0x57'),_0xc1db('0x58'),_0xc1db('0x59'),_0xc1db('0x5a'),_0xc1db('0x5b'),_0xc1db('0x5c'),_0xc1db('0x5d'),_0xc1db('0x5e'),_0xc1db('0x5f')];var _0x3f57c7=[_0xc1db('0x60'),_0xc1db('0x57'),_0xc1db('0x61'),_0xc1db('0x62'),'upon_reject',_0xc1db('0x63'),_0xc1db('0x64'),_0xc1db('0x58'),'approval_history',_0xc1db('0x65'),_0xc1db('0x66'),_0xc1db('0x67'),_0xc1db('0x68'),_0xc1db('0x69'),_0xc1db('0x6a'),'sys_domain',_0xc1db('0x6b'),_0xc1db('0x6c'),_0xc1db('0x59'),'order',_0xc1db('0x6d'),_0xc1db('0x6e'),_0xc1db('0x6f'),_0xc1db('0x70'),_0xc1db('0x71'),'active',_0xc1db('0x72'),_0xc1db('0x73'),'priority',_0xc1db('0x74'),'rfc',_0xc1db('0x75'),'expected_start','opened_at',_0xc1db('0x76'),_0xc1db('0x77'),'work_end',_0xc1db('0x78'),'resolved_at',_0xc1db('0x79'),_0xc1db('0x7a'),'subcategory',_0xc1db('0x7b'),_0xc1db('0x7c'),'close_code','correlation_display',_0xc1db('0x7d'),_0xc1db('0x7e'),_0xc1db('0x7f'),'business_stc',_0xc1db('0x80'),_0xc1db('0x81'),'calendar_duration',_0xc1db('0x5c'),_0xc1db('0x82'),_0xc1db('0x83'),_0xc1db('0x84'),_0xc1db('0x85'),_0xc1db('0x86'),'sys_id',_0xc1db('0x87'),_0xc1db('0x88'),_0xc1db('0x5d'),_0xc1db('0x89'),'problem_id',_0xc1db('0x8a'),_0xc1db('0x8b'),'activity_due','assigned_to',_0xc1db('0x5e'),_0xc1db('0x8c'),_0xc1db('0x8d'),'approval','comments_and_work_notes',_0xc1db('0x8e'),_0xc1db('0x8f'),_0xc1db('0x90'),_0xc1db('0x91'),_0xc1db('0x92'),_0xc1db('0x93'),_0xc1db('0x94'),_0xc1db('0x95'),_0xc1db('0x5f')];var _0x5a8abc='';var _0x5919ab='';var _0x212537=[];var _0x309f3c='';var _0x3e1573='';var _0x38d0d3=[];var _0x2bf3fc='';var _0x55b053='';var _0x418c99={};var _0xcef09='';return db[_0xc1db('0x40')][_0xc1db('0x4a')]({'where':{'id':_0x16b181['params']['id']},'attributes':['id',_0xc1db('0x96'),_0xc1db('0x97'),_0xc1db('0x98'),_0xc1db('0x99'),_0xc1db('0x9a')]})[_0xc1db('0x28')](handleEntityNotFound(_0x4f19a8,null))['then'](function(_0x66e2e7){if(_0x66e2e7){_0xcef09=_0x66e2e7['remoteUri'];var _0xbf17ca=_0xcef09[_0xc1db('0x9b')](-0x1);if(_0xbf17ca==='/'){_0xcef09=_0xcef09['substring'](0x0,_0xcef09[_0xc1db('0x9c')](_0xbf17ca));}_0x55b053=util['format'](_0xc1db('0x9d'),_0xcef09);_0x2bf3fc=util['format'](_0xc1db('0x9e'),_0xcef09);_0x418c99={'user':_0x66e2e7[_0xc1db('0x96')],'pass':_0x66e2e7[_0xc1db('0x97')]};var _0x2a09c4={'method':'GET','uri':_0x55b053+_0xc1db('0x9f'),'auth':_0x418c99,'json':!![]};return rp(_0x2a09c4);}})['then'](function(_0x253609){if(_0x253609[_0xc1db('0xa0')][_0xc1db('0x36')]>0x0){_0x5a8abc=_0x253609[_0xc1db('0xa0')];}console[_0xc1db('0xa1')](_0xc1db('0xa2'),_0x5a8abc);_0x38d0d3=[];_0x5919ab=Object[_0xc1db('0xa3')]([],_0x5a8abc);_[_0xc1db('0xa4')](_0x5919ab,function(_0x30ece0){return!_0x31f043[_0xc1db('0xa5')](_0x30ece0[_0xc1db('0x2b')]);});_0x5919ab[_0xc1db('0xa6')](function(_0x1960ec){var _0x23617b=createFieldObject(_0x2bf3fc,_0x418c99,_0x1960ec[_0xc1db('0xa7')],_0x1960ec['name'],_0x1960ec[_0xc1db('0xa8')],![]);_0x38d0d3[_0xc1db('0xa9')](_0x23617b);});return Promise[_0xc1db('0xaa')](_0x38d0d3);})[_0xc1db('0x28')](function(_0x5d79ca){_0x212537=_0x5d79ca;_0x309f3c=Object[_0xc1db('0xa3')]([],_0x5a8abc);console['log'](_0xc1db('0xab'),_0x5a8abc);_[_0xc1db('0xa4')](_0x309f3c,function(_0x135bfa){return _0x3f57c7['includes'](_0x135bfa[_0xc1db('0x2b')]);});console['log'](_0xc1db('0xac'),_0x309f3c);_0x38d0d3=[];_0x309f3c['forEach'](function(_0x5243a2){var _0x277c5d=createFieldObject(_0x2bf3fc,_0x418c99,_0x5243a2[_0xc1db('0xa7')],_0x5243a2[_0xc1db('0x2b')],_0x5243a2[_0xc1db('0xa8')],!![]);_0x38d0d3[_0xc1db('0xa9')](_0x277c5d);});return Promise[_0xc1db('0xaa')](_0x38d0d3);})[_0xc1db('0x28')](function(_0x4c02d4){_0x3e1573=_0x4c02d4;var _0xd2f26e=_0x212537[_0xc1db('0xad')](_0x3e1573);return{'count':_0xd2f26e[_0xc1db('0x36')],'rows':_0xd2f26e};})[_0xc1db('0x28')](respondWithResult(_0x4f19a8,null))[_0xc1db('0x43')](function(_0x1ea7e2){console['log'](_0xc1db('0xae')+_0x1ea7e2);var _0x22e991=_0x16b181['query']['test']?0x1f4:_0x1ea7e2[_0xc1db('0xaf')]||0x1f4;logger[_0xc1db('0x2a')](_0x1ea7e2['stack']);delete _0x1ea7e2[_0xc1db('0x2b')];if(_0x22e991===0x191){_0x22e991=0x190;}_0x4f19a8[_0xc1db('0x1e')](_0x22e991)['send'](_0x16b181[_0xc1db('0x31')][_0xc1db('0xb0')]?{'message':'Wrong\x20credentials','statusCode':_0x1ea7e2['statusCode']}:_0x1ea7e2);});};function createFieldObject(_0x2b0658,_0x32d160,_0x23fef0,_0x4ce15f,_0x149e2e,_0x2f4584){return new Promise(function(_0x110dc0,_0x334918){var _0xd6b551={'id':_0x4ce15f,'name':_0x149e2e,'custom':_0x2f4584};if(_0x23fef0==='boolean'){_0xd6b551['options']=[{'name':_0xc1db('0xb1'),'value':_0xc1db('0xb2')},{'name':_0xc1db('0xb3'),'value':_0xc1db('0xb4')}];_0x110dc0(_0xd6b551);}else{var _0x48bb37={'method':'GET','uri':_0x2b0658+_0xc1db('0xb5')+_0x4ce15f,'auth':_0x32d160,'json':!![]};return rp(_0x48bb37)[_0xc1db('0x28')](function(_0x346daa){var _0x258a37=[];if(_0x346daa['result'][_0xc1db('0x36')]>0x0){_0x346daa['result'][_0xc1db('0xa6')](function(_0xe2c133){if(_0xe2c133[_0xc1db('0xb6')]===_0xc1db('0xb4')){var _0x3c2299={'name':_0xe2c133['label'],'value':_0xe2c133['value']};_0x258a37['push'](_0x3c2299);}});}_0xd6b551['options']=_0x258a37;if(_0xd6b551[_0xc1db('0x3f')][_0xc1db('0x36')]>0x0){_0x110dc0(_0xd6b551);}else{if(_0x2f4584==![]){_0x110dc0();}else{_0x110dc0(_0xd6b551);}}});}});} \ No newline at end of file +var _0x9baf=['work_start','assignment_group','business_stc','additional_assignee_list','description','close_notes','closed_by','parent_incident','contact_type','reopened_by','urgency','company','activity_due','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','upon_approval','password','email','remoteUri','serverUrl','substring','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','statusCode','send','test','boolean','true','False','inactive','false','label','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','options','hasOwnProperty','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x9baf,0x1a9));var _0xf9ba=function(_0x5a5ffc,_0x453a3d){_0x5a5ffc=_0x5a5ffc-0x0;var _0x4ed327=_0x9baf[_0x5a5ffc];return _0x4ed327;};'use strict';var emlformat=require(_0xf9ba('0x0'));var rimraf=require(_0xf9ba('0x1'));var zipdir=require(_0xf9ba('0x2'));var jsonpatch=require(_0xf9ba('0x3'));var rp=require('request-promise');var moment=require(_0xf9ba('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf9ba('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf9ba('0x6'));var ejs=require(_0xf9ba('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf9ba('0x8'));var squel=require(_0xf9ba('0x9'));var crypto=require(_0xf9ba('0xa'));var jsforce=require(_0xf9ba('0xb'));var deskjs=require(_0xf9ba('0xc'));var toCsv=require(_0xf9ba('0x6'));var querystring=require('querystring');var Papa=require(_0xf9ba('0xd'));var Redis=require('ioredis');var authService=require(_0xf9ba('0xe'));var qs=require(_0xf9ba('0xf'));var as=require(_0xf9ba('0x10'));var hardwareService=require(_0xf9ba('0x11'));var logger=require(_0xf9ba('0x12'))(_0xf9ba('0x13'));var utils=require('../../config/utils');var config=require(_0xf9ba('0x14'));var licenseUtil=require(_0xf9ba('0x15'));var db=require(_0xf9ba('0x16'))['db'];var integrations=require(_0xf9ba('0x17'));function respondWithStatusCode(_0x1e985f,_0x337c0f){_0x337c0f=_0x337c0f||0xcc;return function(_0x3e78c4){if(_0x3e78c4){return _0x1e985f['sendStatus'](_0x337c0f);}return _0x1e985f['status'](_0x337c0f)[_0xf9ba('0x18')]();};}function respondWithResult(_0x408ac0,_0x241273){_0x241273=_0x241273||0xc8;return function(_0x21c564){if(_0x21c564){return _0x408ac0[_0xf9ba('0x19')](_0x241273)['json'](_0x21c564);}};}function respondWithFilteredResult(_0x47ca92,_0x1c6d4f){return function(_0x4d7118){if(_0x4d7118){var _0x24abba=typeof _0x1c6d4f['offset']===_0xf9ba('0x1a')&&typeof _0x1c6d4f[_0xf9ba('0x1b')]==='undefined';var _0x18077d=_0x4d7118['count'];var _0x2ebb11=_0x24abba?0x0:_0x1c6d4f[_0xf9ba('0x1c')];var _0x45c07f=_0x24abba?_0x4d7118[_0xf9ba('0x1d')]:_0x1c6d4f[_0xf9ba('0x1c')]+_0x1c6d4f[_0xf9ba('0x1b')];var _0x13ad71;if(_0x45c07f>=_0x18077d){_0x45c07f=_0x18077d;_0x13ad71=0xc8;}else{_0x13ad71=0xce;}_0x47ca92[_0xf9ba('0x19')](_0x13ad71);return _0x47ca92[_0xf9ba('0x1e')](_0xf9ba('0x1f'),_0x2ebb11+'-'+_0x45c07f+'/'+_0x18077d)[_0xf9ba('0x20')](_0x4d7118);}return null;};}function patchUpdates(_0x276e29){return function(_0x7ab8fb){try{jsonpatch[_0xf9ba('0x21')](_0x7ab8fb,_0x276e29,!![]);}catch(_0x19ea65){return BPromise[_0xf9ba('0x22')](_0x19ea65);}return _0x7ab8fb[_0xf9ba('0x23')]();};}function saveUpdates(_0x1ebff8,_0x1e6778){return function(_0x4582db){if(_0x4582db){return _0x4582db[_0xf9ba('0x24')](_0x1ebff8)[_0xf9ba('0x25')](function(_0x75dab9){return _0x75dab9;});}return null;};}function removeEntity(_0x4c8b3d,_0x264454){return function(_0x1c744f){if(_0x1c744f){return _0x1c744f[_0xf9ba('0x26')]()[_0xf9ba('0x25')](function(){_0x4c8b3d[_0xf9ba('0x19')](0xcc)[_0xf9ba('0x18')]();});}};}function handleEntityNotFound(_0x50b864,_0x1e0951){return function(_0x50c9ef){if(!_0x50c9ef){_0x50b864[_0xf9ba('0x27')](0x194);}return _0x50c9ef;};}function handleError(_0x426f4d,_0x468fbe){_0x468fbe=_0x468fbe||0x1f4;return function(_0x19d6a5){logger[_0xf9ba('0x28')](_0x19d6a5[_0xf9ba('0x29')]);if(_0x19d6a5[_0xf9ba('0x2a')]){delete _0x19d6a5[_0xf9ba('0x2a')];}_0x426f4d['status'](_0x468fbe)['send'](_0x19d6a5);};}exports[_0xf9ba('0x2b')]=function(_0x2c1fe7,_0x47788b){var _0x36fbc7={},_0x21ad26={},_0x5d2cd6={'count':0x0,'rows':[]};var _0x3a0a4d=_[_0xf9ba('0x2c')](db[_0xf9ba('0x2d')][_0xf9ba('0x2e')],function(_0x4c0967){return{'name':_0x4c0967[_0xf9ba('0x2f')],'type':_0x4c0967[_0xf9ba('0x30')][_0xf9ba('0x31')]};});_0x21ad26[_0xf9ba('0x32')]=_['map'](_0x3a0a4d,_0xf9ba('0x2a'));_0x21ad26[_0xf9ba('0x33')]=_[_0xf9ba('0x34')](_0x2c1fe7[_0xf9ba('0x33')]);_0x21ad26[_0xf9ba('0x35')]=_[_0xf9ba('0x36')](_0x21ad26[_0xf9ba('0x32')],_0x21ad26[_0xf9ba('0x33')]);_0x36fbc7[_0xf9ba('0x37')]=_['intersection'](_0x21ad26[_0xf9ba('0x32')],qs[_0xf9ba('0x38')](_0x2c1fe7['query']['fields']));_0x36fbc7[_0xf9ba('0x37')]=_0x36fbc7[_0xf9ba('0x37')]['length']?_0x36fbc7[_0xf9ba('0x37')]:_0x21ad26[_0xf9ba('0x32')];if(!_0x2c1fe7[_0xf9ba('0x33')]['hasOwnProperty']('nolimit')){_0x36fbc7[_0xf9ba('0x1b')]=qs[_0xf9ba('0x1b')](_0x2c1fe7[_0xf9ba('0x33')][_0xf9ba('0x1b')]);_0x36fbc7['offset']=qs[_0xf9ba('0x1c')](_0x2c1fe7['query'][_0xf9ba('0x1c')]);}_0x36fbc7['order']=qs[_0xf9ba('0x39')](_0x2c1fe7[_0xf9ba('0x33')][_0xf9ba('0x39')]);_0x36fbc7['where']=qs['filters'](_[_0xf9ba('0x3a')](_0x2c1fe7['query'],_0x21ad26[_0xf9ba('0x35')]),_0x3a0a4d);if(_0x2c1fe7[_0xf9ba('0x33')][_0xf9ba('0x3b')]){_0x36fbc7[_0xf9ba('0x3c')]=_[_0xf9ba('0x3d')](_0x36fbc7[_0xf9ba('0x3c')],{'$or':_[_0xf9ba('0x2c')](_0x3a0a4d,function(_0x5986e6){if(_0x5986e6[_0xf9ba('0x30')]!==_0xf9ba('0x3e')){var _0x578c16={};_0x578c16[_0x5986e6['name']]={'$like':'%'+_0x2c1fe7[_0xf9ba('0x33')][_0xf9ba('0x3b')]+'%'};return _0x578c16;}})});}_0x36fbc7=_[_0xf9ba('0x3d')]({},_0x36fbc7,_0x2c1fe7['options']);var _0x517e18={'where':_0x36fbc7['where']};return db[_0xf9ba('0x2d')]['count'](_0x517e18)[_0xf9ba('0x25')](function(_0x53a9e3){_0x5d2cd6[_0xf9ba('0x1d')]=_0x53a9e3;if(_0x2c1fe7[_0xf9ba('0x33')][_0xf9ba('0x3f')]){_0x36fbc7[_0xf9ba('0x40')]=[{'all':!![]}];}return db[_0xf9ba('0x2d')][_0xf9ba('0x41')](_0x36fbc7);})[_0xf9ba('0x25')](function(_0x153e73){_0x5d2cd6[_0xf9ba('0x42')]=_0x153e73;return _0x5d2cd6;})[_0xf9ba('0x25')](respondWithFilteredResult(_0x47788b,_0x36fbc7))[_0xf9ba('0x43')](handleError(_0x47788b,null));};exports[_0xf9ba('0x44')]=function(_0x4bf1db,_0x339c54){var _0xa0bab9={'raw':![],'where':{'id':_0x4bf1db['params']['id']}},_0xc98a83={};_0xc98a83['model']=_[_0xf9ba('0x34')](db[_0xf9ba('0x2d')]['rawAttributes']);_0xc98a83['query']=_[_0xf9ba('0x34')](_0x4bf1db[_0xf9ba('0x33')]);_0xc98a83[_0xf9ba('0x35')]=_[_0xf9ba('0x36')](_0xc98a83[_0xf9ba('0x32')],_0xc98a83[_0xf9ba('0x33')]);_0xa0bab9['attributes']=_[_0xf9ba('0x36')](_0xc98a83[_0xf9ba('0x32')],qs[_0xf9ba('0x38')](_0x4bf1db[_0xf9ba('0x33')]['fields']));_0xa0bab9['attributes']=_0xa0bab9['attributes'][_0xf9ba('0x45')]?_0xa0bab9['attributes']:_0xc98a83[_0xf9ba('0x32')];if(_0x4bf1db[_0xf9ba('0x33')][_0xf9ba('0x3f')]){_0xa0bab9['include']=[{'all':!![]}];}_0xa0bab9=_[_0xf9ba('0x3d')]({},_0xa0bab9,_0x4bf1db['options']);return db[_0xf9ba('0x2d')][_0xf9ba('0x46')](_0xa0bab9)[_0xf9ba('0x25')](handleEntityNotFound(_0x339c54,null))[_0xf9ba('0x25')](respondWithResult(_0x339c54,null))[_0xf9ba('0x43')](handleError(_0x339c54,null));};exports[_0xf9ba('0x47')]=function(_0x25651e,_0x3e4480){return db[_0xf9ba('0x2d')]['create'](_0x25651e[_0xf9ba('0x48')],{})[_0xf9ba('0x25')](respondWithResult(_0x3e4480,0xc9))['catch'](handleError(_0x3e4480,null));};exports[_0xf9ba('0x24')]=function(_0x56ce80,_0x95e658){if(_0x56ce80[_0xf9ba('0x48')]['id']){delete _0x56ce80[_0xf9ba('0x48')]['id'];}return db[_0xf9ba('0x2d')][_0xf9ba('0x46')]({'where':{'id':_0x56ce80['params']['id']}})[_0xf9ba('0x25')](handleEntityNotFound(_0x95e658,null))[_0xf9ba('0x25')](saveUpdates(_0x56ce80[_0xf9ba('0x48')],null))[_0xf9ba('0x25')](respondWithResult(_0x95e658,null))[_0xf9ba('0x43')](handleError(_0x95e658,null));};exports[_0xf9ba('0x26')]=function(_0x516b47,_0x3c9b26){return db[_0xf9ba('0x2d')][_0xf9ba('0x46')]({'where':{'id':_0x516b47[_0xf9ba('0x49')]['id']}})[_0xf9ba('0x25')](handleEntityNotFound(_0x3c9b26,null))[_0xf9ba('0x25')](removeEntity(_0x3c9b26,null))[_0xf9ba('0x43')](handleError(_0x3c9b26,null));};exports[_0xf9ba('0x4a')]=function(_0xf8c5c6,_0x1835b8,_0x7792e2){var _0xe5bd94={};var _0x2a8bcc={};var _0x1bfda1;var _0x5da342;return db[_0xf9ba('0x2d')][_0xf9ba('0x4b')]({'where':{'id':_0xf8c5c6['params']['id']}})[_0xf9ba('0x25')](handleEntityNotFound(_0x1835b8,null))[_0xf9ba('0x25')](function(_0xcad62c){if(_0xcad62c){_0x1bfda1=_0xcad62c;_0x2a8bcc[_0xf9ba('0x32')]=_[_0xf9ba('0x34')](db[_0xf9ba('0x4c')][_0xf9ba('0x2e')]);_0x2a8bcc[_0xf9ba('0x33')]=_[_0xf9ba('0x34')](_0xf8c5c6[_0xf9ba('0x33')]);_0x2a8bcc['filters']=_[_0xf9ba('0x36')](_0x2a8bcc[_0xf9ba('0x32')],_0x2a8bcc['query']);_0xe5bd94['attributes']=_[_0xf9ba('0x36')](_0x2a8bcc[_0xf9ba('0x32')],qs[_0xf9ba('0x38')](_0xf8c5c6[_0xf9ba('0x33')][_0xf9ba('0x38')]));_0xe5bd94[_0xf9ba('0x37')]=_0xe5bd94[_0xf9ba('0x37')]['length']?_0xe5bd94[_0xf9ba('0x37')]:_0x2a8bcc[_0xf9ba('0x32')];_0xe5bd94['order']=qs[_0xf9ba('0x39')](_0xf8c5c6[_0xf9ba('0x33')]['sort']);_0xe5bd94[_0xf9ba('0x3c')]=qs[_0xf9ba('0x35')](_[_0xf9ba('0x3a')](_0xf8c5c6[_0xf9ba('0x33')],_0x2a8bcc['filters']));if(_0xf8c5c6['query']['filter']){_0xe5bd94[_0xf9ba('0x3c')]=_[_0xf9ba('0x3d')](_0xe5bd94[_0xf9ba('0x3c')],{'$or':_[_0xf9ba('0x2c')](_0xe5bd94[_0xf9ba('0x37')],function(_0x4bd665){var _0x2e550e={};_0x2e550e[_0x4bd665]={'$like':'%'+_0xf8c5c6[_0xf9ba('0x33')][_0xf9ba('0x3b')]+'%'};return _0x2e550e;})});}_0xe5bd94=_['merge']({},_0xe5bd94,_0xf8c5c6[_0xf9ba('0x4d')]);return _0x1bfda1[_0xf9ba('0x4a')](_0xe5bd94);}})[_0xf9ba('0x25')](function(_0x2462d7){if(_0x2462d7){_0x5da342=_0x2462d7['length'];if(!_0xf8c5c6['query'][_0xf9ba('0x4e')](_0xf9ba('0x4f'))){_0xe5bd94['limit']=qs[_0xf9ba('0x1b')](_0xf8c5c6['query'][_0xf9ba('0x1b')]);_0xe5bd94[_0xf9ba('0x1c')]=qs[_0xf9ba('0x1c')](_0xf8c5c6[_0xf9ba('0x33')][_0xf9ba('0x1c')]);}return _0x1bfda1[_0xf9ba('0x4a')](_0xe5bd94);}})[_0xf9ba('0x25')](function(_0xbaddc8){if(_0xbaddc8){return _0xbaddc8?{'count':_0x5da342,'rows':_0xbaddc8}:null;}})[_0xf9ba('0x25')](respondWithResult(_0x1835b8,null))['catch'](handleError(_0x1835b8,null));};exports['addConfiguration']=function(_0x5ba0bd,_0x11e802,_0xc3fa8d){if(_0x5ba0bd[_0xf9ba('0x48')]['id']){delete _0x5ba0bd[_0xf9ba('0x48')]['id'];}return db[_0xf9ba('0x2d')]['findOne']({'where':{'id':_0x5ba0bd[_0xf9ba('0x49')]['id']}})[_0xf9ba('0x25')](handleEntityNotFound(_0x11e802,null))['then'](function(_0x4da3c2){if(_0x4da3c2){_0x5ba0bd['body'][_0xf9ba('0x50')]=_0x4da3c2['id'];_0x5ba0bd[_0xf9ba('0x48')][_0xf9ba('0x51')]=integrations[_0xf9ba('0x52')](_0x5ba0bd[_0xf9ba('0x48')]['channel'],_0x5ba0bd[_0xf9ba('0x48')][_0xf9ba('0x30')]);_0x5ba0bd['body'][_0xf9ba('0x53')]=integrations[_0xf9ba('0x54')](_0x5ba0bd[_0xf9ba('0x48')][_0xf9ba('0x55')],_0x5ba0bd['body'][_0xf9ba('0x30')]);return db[_0xf9ba('0x4c')][_0xf9ba('0x47')](_0x5ba0bd[_0xf9ba('0x48')],{'include':[{'model':db[_0xf9ba('0x56')],'as':_0xf9ba('0x51')},{'model':db[_0xf9ba('0x56')],'as':_0xf9ba('0x53')}]});}return null;})[_0xf9ba('0x25')](respondWithResult(_0x11e802,null))['catch'](handleError(_0x11e802,null));};exports[_0xf9ba('0x57')]=function(_0x4d07fa,_0x1b85a6,_0x54bf38){var _0xa2de0b=[_0xf9ba('0x58'),_0xf9ba('0x59'),_0xf9ba('0x5a'),_0xf9ba('0x5b'),_0xf9ba('0x5c'),_0xf9ba('0x5d'),_0xf9ba('0x5e'),_0xf9ba('0x5f'),_0xf9ba('0x60')];var _0x1f14cb=['parent',_0xf9ba('0x58'),_0xf9ba('0x61'),_0xf9ba('0x62'),_0xf9ba('0x63'),_0xf9ba('0x64'),_0xf9ba('0x65'),_0xf9ba('0x59'),_0xf9ba('0x66'),_0xf9ba('0x67'),_0xf9ba('0x68'),_0xf9ba('0x69'),'opened_by','user_input',_0xf9ba('0x6a'),_0xf9ba('0x6b'),_0xf9ba('0x6c'),_0xf9ba('0x6d'),'knowledge','order',_0xf9ba('0x6e'),_0xf9ba('0x6f'),_0xf9ba('0x70'),_0xf9ba('0x71'),_0xf9ba('0x72'),'active',_0xf9ba('0x73'),_0xf9ba('0x74'),_0xf9ba('0x75'),_0xf9ba('0x76'),_0xf9ba('0x77'),_0xf9ba('0x78'),_0xf9ba('0x79'),_0xf9ba('0x7a'),_0xf9ba('0x7b'),'group_list',_0xf9ba('0x7c'),_0xf9ba('0x7d'),_0xf9ba('0x7e'),_0xf9ba('0x7f'),_0xf9ba('0x80'),_0xf9ba('0x5b'),_0xf9ba('0x81'),_0xf9ba('0x82'),'close_code',_0xf9ba('0x83'),_0xf9ba('0x84'),_0xf9ba('0x85'),_0xf9ba('0x86'),_0xf9ba('0x87'),_0xf9ba('0x88'),_0xf9ba('0x89'),'calendar_duration','notify','sys_class_name',_0xf9ba('0x8a'),_0xf9ba('0x8b'),'follow_up',_0xf9ba('0x8c'),'sys_id',_0xf9ba('0x8d'),_0xf9ba('0x8e'),'incident_state',_0xf9ba('0x8f'),'problem_id',_0xf9ba('0x90'),'reassignment_count',_0xf9ba('0x91'),'assigned_to',_0xf9ba('0x5f'),'comments',_0xf9ba('0x92'),_0xf9ba('0x93'),_0xf9ba('0x94'),_0xf9ba('0x95'),'sys_mod_count',_0xf9ba('0x96'),_0xf9ba('0x97'),'escalation',_0xf9ba('0x98'),'correlation_id','location',_0xf9ba('0x60')];var _0x491e86='';var _0x40bcaf='';var _0x70ed36=[];var _0x15f8b7='';var _0x10650c='';var _0x33a3a6=[];var _0x309e3a='';var _0x5cc173='';var _0x27c717={};var _0x3dfdbe='';return db['ServicenowAccount'][_0xf9ba('0x4b')]({'where':{'id':_0x4d07fa[_0xf9ba('0x49')]['id']},'attributes':['id','username',_0xf9ba('0x99'),_0xf9ba('0x9a'),_0xf9ba('0x9b'),_0xf9ba('0x9c')]})[_0xf9ba('0x25')](handleEntityNotFound(_0x1b85a6,null))[_0xf9ba('0x25')](function(_0x80d263){if(_0x80d263){_0x3dfdbe=_0x80d263[_0xf9ba('0x9b')];var _0x25d262=_0x3dfdbe['slice'](-0x1);if(_0x25d262==='/'){_0x3dfdbe=_0x3dfdbe[_0xf9ba('0x9d')](0x0,_0x3dfdbe['lastIndexOf'](_0x25d262));}_0x5cc173=util['format']('%s/api/now/doc/table/schema/',_0x3dfdbe);_0x309e3a=util[_0xf9ba('0x9e')](_0xf9ba('0x9f'),_0x3dfdbe);_0x27c717={'user':_0x80d263[_0xf9ba('0xa0')],'pass':_0x80d263[_0xf9ba('0x99')]};var _0x1419b1={'method':_0xf9ba('0xa1'),'uri':_0x5cc173+_0xf9ba('0xa2'),'auth':_0x27c717,'json':!![]};return rp(_0x1419b1);}})['then'](function(_0x22411f){if(_0x22411f['result'][_0xf9ba('0x45')]>0x0){_0x491e86=_0x22411f[_0xf9ba('0xa3')];}console[_0xf9ba('0xa4')](_0xf9ba('0xa5'),_0x491e86);_0x33a3a6=[];_0x40bcaf=Object[_0xf9ba('0xa6')]([],_0x491e86);_[_0xf9ba('0xa7')](_0x40bcaf,function(_0x5f010d){return!_0xa2de0b[_0xf9ba('0xa8')](_0x5f010d[_0xf9ba('0x2a')]);});_0x40bcaf[_0xf9ba('0xa9')](function(_0x14bdc7){var _0x4c0742=createFieldObject(_0x309e3a,_0x27c717,_0x14bdc7['internalType'],_0x14bdc7[_0xf9ba('0x2a')],_0x14bdc7['label'],![]);_0x33a3a6[_0xf9ba('0xaa')](_0x4c0742);});return Promise['all'](_0x33a3a6);})[_0xf9ba('0x25')](function(_0x4a504d){_0x70ed36=_0x4a504d;_0x15f8b7=Object['assign']([],_0x491e86);console['log'](_0xf9ba('0xab'),_0x491e86);_[_0xf9ba('0xa7')](_0x15f8b7,function(_0x534c65){return _0x1f14cb[_0xf9ba('0xa8')](_0x534c65['name']);});console[_0xf9ba('0xa4')](_0xf9ba('0xac'),_0x15f8b7);_0x33a3a6=[];_0x15f8b7[_0xf9ba('0xa9')](function(_0x8fbef7){var _0x1bc916=createFieldObject(_0x309e3a,_0x27c717,_0x8fbef7[_0xf9ba('0xad')],_0x8fbef7[_0xf9ba('0x2a')],_0x8fbef7['label'],!![]);_0x33a3a6[_0xf9ba('0xaa')](_0x1bc916);});return Promise['all'](_0x33a3a6);})[_0xf9ba('0x25')](function(_0x4b9a85){_0x10650c=_0x4b9a85;var _0x3670c5=_0x70ed36[_0xf9ba('0xae')](_0x10650c);return{'count':_0x3670c5[_0xf9ba('0x45')],'rows':_0x3670c5};})[_0xf9ba('0x25')](respondWithResult(_0x1b85a6,null))[_0xf9ba('0x43')](function(_0x332026){console[_0xf9ba('0xa4')](_0xf9ba('0xaf')+_0x332026);var _0x329d51=_0x4d07fa[_0xf9ba('0x33')]['test']?0x1f4:_0x332026[_0xf9ba('0xb0')]||0x1f4;logger['error'](_0x332026[_0xf9ba('0x29')]);delete _0x332026[_0xf9ba('0x2a')];if(_0x329d51===0x191){_0x329d51=0x190;}_0x1b85a6['status'](_0x329d51)[_0xf9ba('0xb1')](_0x4d07fa['query'][_0xf9ba('0xb2')]?{'message':'Wrong\x20credentials','statusCode':_0x332026[_0xf9ba('0xb0')]}:_0x332026);});};function createFieldObject(_0x515383,_0x3c37d2,_0xd7404,_0x362e49,_0x244c43,_0x31848d){return new Promise(function(_0x16098d,_0x3545c2){var _0x552c79={'id':_0x362e49,'name':_0x244c43,'custom':_0x31848d};if(_0xd7404===_0xf9ba('0xb3')){_0x552c79['options']=[{'name':'True','value':_0xf9ba('0xb4')},{'name':_0xf9ba('0xb5'),'value':'false'}];_0x16098d(_0x552c79);}else{var _0x39860a={'method':_0xf9ba('0xa1'),'uri':_0x515383+'sys_choice?sysparm_query=name=incident^element='+_0x362e49,'auth':_0x3c37d2,'json':!![]};return rp(_0x39860a)[_0xf9ba('0x25')](function(_0x23613a){var _0x4b460a=[];if(_0x23613a[_0xf9ba('0xa3')][_0xf9ba('0x45')]>0x0){_0x23613a['result'][_0xf9ba('0xa9')](function(_0x5d63ae){if(_0x5d63ae[_0xf9ba('0xb6')]===_0xf9ba('0xb7')){var _0x3fbbc1={'name':_0x5d63ae[_0xf9ba('0xb8')],'value':_0x5d63ae[_0xf9ba('0xb9')]};_0x4b460a[_0xf9ba('0xaa')](_0x3fbbc1);}});}_0x552c79[_0xf9ba('0x4d')]=_0x4b460a;if(_0x552c79[_0xf9ba('0x4d')][_0xf9ba('0x45')]>0x0){_0x16098d(_0x552c79);}else{if(_0x31848d==![]){_0x16098d();}else{_0x16098d(_0x552c79);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index bb504b9..e7f0870 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x038b=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','util','../../config/logger','api','bluebird'];(function(_0x3a4e9d,_0xc70aee){var _0x1a04e1=function(_0x316052){while(--_0x316052){_0x3a4e9d['push'](_0x3a4e9d['shift']());}};_0x1a04e1(++_0xc70aee);}(_0x038b,0x114));var _0xb038=function(_0x2a1345,_0x40899c){_0x2a1345=_0x2a1345-0x0;var _0x428181=_0x038b[_0x2a1345];return _0x428181;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));var integrations=require(_0xb038('0x7'));module['exports']=function(_0x54e1e7,_0x2e3e64){return _0x54e1e7[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x42ddba,_0x433562){var _0x372297=function(_0x3a10e3){while(--_0x3a10e3){_0x42ddba['push'](_0x42ddba['shift']());}};_0x372297(++_0x433562);}(_0x687b,0x14a));var _0xb687=function(_0x20e6c4,_0x573880){_0x20e6c4=_0x20e6c4-0x0;var _0x61fc99=_0x687b[_0x20e6c4];return _0x61fc99;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 5ff4016..6b0420d 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 _0x5630=['request\x20sent','error','code','message','result','GetServicenowAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','catch','ShowServicenowAccount','ServicenowAccount','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s'];(function(_0x329eb5,_0x1b1b40){var _0x1f276a=function(_0x20ea33){while(--_0x20ea33){_0x329eb5['push'](_0x329eb5['shift']());}};_0x1f276a(++_0x1b1b40);}(_0x5630,0x19a));var _0x0563=function(_0x28346a,_0x3462ec){_0x28346a=_0x28346a-0x0;var _0xbcaaf9=_0x5630[_0x28346a];return _0xbcaaf9;};'use strict';var _=require(_0x0563('0x0'));var util=require(_0x0563('0x1'));var moment=require(_0x0563('0x2'));var BPromise=require('bluebird');var rs=require(_0x0563('0x3'));var fs=require('fs');var Redis=require(_0x0563('0x4'));var db=require(_0x0563('0x5'))['db'];var utils=require(_0x0563('0x6'));var logger=require(_0x0563('0x7'))(_0x0563('0x8'));var config=require(_0x0563('0x9'));var jayson=require(_0x0563('0xa'));var client=jayson[_0x0563('0xb')][_0x0563('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cf351,_0x34d4c4,_0x5a100f){return new BPromise(function(_0x41d001,_0x42a2c8){return client[_0x0563('0xd')](_0x5cf351,_0x5a100f)[_0x0563('0xe')](function(_0xedfb67){logger[_0x0563('0xf')](_0x0563('0x10'),_0x34d4c4,'request\x20sent');logger[_0x0563('0x11')](_0x0563('0x12'),_0x34d4c4,_0x0563('0x13'),JSON['stringify'](_0xedfb67));if(_0xedfb67[_0x0563('0x14')]){if(_0xedfb67[_0x0563('0x14')][_0x0563('0x15')]===0x1f4){logger[_0x0563('0x14')](_0x0563('0x10'),_0x34d4c4,_0xedfb67[_0x0563('0x14')][_0x0563('0x16')]);return _0x42a2c8(_0xedfb67[_0x0563('0x14')][_0x0563('0x16')]);}logger[_0x0563('0x14')]('ServicenowAccount,\x20%s,\x20%s',_0x34d4c4,_0xedfb67[_0x0563('0x14')]['message']);return _0x41d001(_0xedfb67[_0x0563('0x14')][_0x0563('0x16')]);}else{logger[_0x0563('0xf')](_0x0563('0x10'),_0x34d4c4,_0x0563('0x13'));_0x41d001(_0xedfb67[_0x0563('0x17')][_0x0563('0x16')]);}})['catch'](function(_0x1c806e){logger[_0x0563('0x14')](_0x0563('0x10'),_0x34d4c4,_0x1c806e);_0x42a2c8(_0x1c806e);});});}exports[_0x0563('0x18')]=function(_0x1d3506){var _0x4d0b67=this;return new Promise(function(_0x2bd6f5,_0x47d7ef){return db['ServicenowAccount'][_0x0563('0x19')]({'raw':_0x1d3506[_0x0563('0x1a')]?_0x1d3506[_0x0563('0x1a')][_0x0563('0x1b')]===undefined?!![]:![]:!![],'where':_0x1d3506[_0x0563('0x1a')]?_0x1d3506[_0x0563('0x1a')]['where']||null:null,'attributes':_0x1d3506['options']?_0x1d3506[_0x0563('0x1a')][_0x0563('0x1c')]||null:null,'limit':_0x1d3506[_0x0563('0x1a')]?_0x1d3506[_0x0563('0x1a')][_0x0563('0x1d')]||null:null,'include':_0x1d3506[_0x0563('0x1a')]?_0x1d3506[_0x0563('0x1a')]['include']?_[_0x0563('0x1e')](_0x1d3506['options'][_0x0563('0x1f')],function(_0x401ac9){return{'model':db[_0x401ac9[_0x0563('0x20')]],'as':_0x401ac9['as'],'attributes':_0x401ac9[_0x0563('0x1c')],'include':_0x401ac9[_0x0563('0x1f')]?_[_0x0563('0x1e')](_0x401ac9[_0x0563('0x1f')],function(_0x3eb847){return{'model':db[_0x3eb847[_0x0563('0x20')]],'as':_0x3eb847['as'],'attributes':_0x3eb847[_0x0563('0x1c')],'include':_0x3eb847[_0x0563('0x1f')]?_[_0x0563('0x1e')](_0x3eb847[_0x0563('0x1f')],function(_0xe1b1ef){return{'model':db[_0xe1b1ef['model']],'as':_0xe1b1ef['as'],'attributes':_0xe1b1ef['attributes']};}):[]};}):[]};}):[]:[]})[_0x0563('0xe')](function(_0x19d1e2){logger[_0x0563('0xf')](_0x0563('0x18'),_0x1d3506);logger[_0x0563('0x11')](_0x0563('0x18'),_0x1d3506,JSON[_0x0563('0x21')](_0x19d1e2));_0x2bd6f5(_0x19d1e2);})[_0x0563('0x22')](function(_0xcbcc56){logger[_0x0563('0x14')](_0x0563('0x18'),_0xcbcc56['message'],_0x1d3506);_0x47d7ef(_0x4d0b67[_0x0563('0x14')](0x1f4,_0xcbcc56['message']));});});};exports[_0x0563('0x23')]=function(_0x1c9826){var _0x3d7c4b=this;return new Promise(function(_0x3245ba,_0x27f20f){return db[_0x0563('0x24')][_0x0563('0x25')]({'raw':_0x1c9826[_0x0563('0x1a')]?_0x1c9826[_0x0563('0x1a')][_0x0563('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c9826[_0x0563('0x1a')]?_0x1c9826[_0x0563('0x1a')][_0x0563('0x26')]||null:null,'attributes':_0x1c9826[_0x0563('0x1a')]?_0x1c9826['options']['attributes']||null:null,'include':_0x1c9826[_0x0563('0x1a')]?_0x1c9826[_0x0563('0x1a')][_0x0563('0x1f')]?_[_0x0563('0x1e')](_0x1c9826[_0x0563('0x1a')][_0x0563('0x1f')],function(_0x476f85){return{'model':db[_0x476f85[_0x0563('0x20')]],'as':_0x476f85['as'],'attributes':_0x476f85['attributes'],'include':_0x476f85[_0x0563('0x1f')]?_[_0x0563('0x1e')](_0x476f85['include'],function(_0xf8008c){return{'model':db[_0xf8008c[_0x0563('0x20')]],'as':_0xf8008c['as'],'attributes':_0xf8008c[_0x0563('0x1c')],'include':_0xf8008c[_0x0563('0x1f')]?_['map'](_0xf8008c['include'],function(_0x47ed3c){return{'model':db[_0x47ed3c[_0x0563('0x20')]],'as':_0x47ed3c['as'],'attributes':_0x47ed3c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0563('0xe')](function(_0x125c77){logger[_0x0563('0xf')](_0x0563('0x23'),_0x1c9826);logger[_0x0563('0x11')]('ShowServicenowAccount',_0x1c9826,JSON[_0x0563('0x21')](_0x125c77));_0x3245ba(_0x125c77);})['catch'](function(_0x268525){logger[_0x0563('0x14')]('ShowServicenowAccount',_0x268525[_0x0563('0x16')],_0x1c9826);_0x27f20f(_0x3d7c4b[_0x0563('0x14')](0x1f4,_0x268525[_0x0563('0x16')]));});});}; \ No newline at end of file +var _0xdcf6=['model','include','map','stringify','ShowServicenowAccount','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ServicenowAccount,\x20%s,\x20%s','message','info','result','catch','GetServicenowAccount','ServicenowAccount','options','raw','where','attributes','limit'];(function(_0x4000fd,_0x2fcca3){var _0x16922f=function(_0x278055){while(--_0x278055){_0x4000fd['push'](_0x4000fd['shift']());}};_0x16922f(++_0x2fcca3);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x4f192e,_0x4d1756){_0x4f192e=_0x4f192e-0x0;var _0x49294d=_0xdcf6[_0x4f192e];return _0x49294d;};'use strict';var _=require('lodash');var util=require(_0x6dcf('0x0'));var moment=require(_0x6dcf('0x1'));var BPromise=require(_0x6dcf('0x2'));var rs=require(_0x6dcf('0x3'));var fs=require('fs');var Redis=require(_0x6dcf('0x4'));var db=require(_0x6dcf('0x5'))['db'];var utils=require(_0x6dcf('0x6'));var logger=require('../../config/logger')(_0x6dcf('0x7'));var config=require(_0x6dcf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6dcf('0x9')][_0x6dcf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5abd79,_0x56fdb2,_0x5766db){return new BPromise(function(_0x34517a,_0x4e2877){return client[_0x6dcf('0xb')](_0x5abd79,_0x5766db)[_0x6dcf('0xc')](function(_0x304a75){logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x56fdb2,'request\x20sent');logger[_0x6dcf('0xd')](_0x6dcf('0xe'),_0x56fdb2,_0x6dcf('0xf'),JSON['stringify'](_0x304a75));if(_0x304a75[_0x6dcf('0x10')]){if(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x11')]===0x1f4){logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);return _0x4e2877(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);}logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);return _0x34517a(_0x304a75[_0x6dcf('0x10')][_0x6dcf('0x13')]);}else{logger[_0x6dcf('0x14')](_0x6dcf('0x12'),_0x56fdb2,'request\x20sent');_0x34517a(_0x304a75[_0x6dcf('0x15')][_0x6dcf('0x13')]);}})[_0x6dcf('0x16')](function(_0x4874ff){logger[_0x6dcf('0x10')](_0x6dcf('0x12'),_0x56fdb2,_0x4874ff);_0x4e2877(_0x4874ff);});});}exports[_0x6dcf('0x17')]=function(_0x40b6ac){var _0x821c86=this;return new Promise(function(_0x83da87,_0x1bed56){return db[_0x6dcf('0x18')]['findAll']({'raw':_0x40b6ac[_0x6dcf('0x19')]?_0x40b6ac[_0x6dcf('0x19')][_0x6dcf('0x1a')]===undefined?!![]:![]:!![],'where':_0x40b6ac[_0x6dcf('0x19')]?_0x40b6ac[_0x6dcf('0x19')][_0x6dcf('0x1b')]||null:null,'attributes':_0x40b6ac[_0x6dcf('0x19')]?_0x40b6ac['options'][_0x6dcf('0x1c')]||null:null,'limit':_0x40b6ac['options']?_0x40b6ac[_0x6dcf('0x19')][_0x6dcf('0x1d')]||null:null,'include':_0x40b6ac[_0x6dcf('0x19')]?_0x40b6ac[_0x6dcf('0x19')]['include']?_['map'](_0x40b6ac[_0x6dcf('0x19')]['include'],function(_0x1df874){return{'model':db[_0x1df874[_0x6dcf('0x1e')]],'as':_0x1df874['as'],'attributes':_0x1df874[_0x6dcf('0x1c')],'include':_0x1df874[_0x6dcf('0x1f')]?_['map'](_0x1df874[_0x6dcf('0x1f')],function(_0x2b6dbe){return{'model':db[_0x2b6dbe[_0x6dcf('0x1e')]],'as':_0x2b6dbe['as'],'attributes':_0x2b6dbe[_0x6dcf('0x1c')],'include':_0x2b6dbe['include']?_[_0x6dcf('0x20')](_0x2b6dbe[_0x6dcf('0x1f')],function(_0x2dc909){return{'model':db[_0x2dc909[_0x6dcf('0x1e')]],'as':_0x2dc909['as'],'attributes':_0x2dc909[_0x6dcf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6dcf('0xc')](function(_0x3fad7e){logger[_0x6dcf('0x14')](_0x6dcf('0x17'),_0x40b6ac);logger[_0x6dcf('0xd')](_0x6dcf('0x17'),_0x40b6ac,JSON[_0x6dcf('0x21')](_0x3fad7e));_0x83da87(_0x3fad7e);})['catch'](function(_0x3a4356){logger[_0x6dcf('0x10')]('GetServicenowAccount',_0x3a4356['message'],_0x40b6ac);_0x1bed56(_0x821c86['error'](0x1f4,_0x3a4356['message']));});});};exports[_0x6dcf('0x22')]=function(_0x356ad1){var _0x4c106c=this;return new Promise(function(_0x3d4615,_0x271c8e){return db[_0x6dcf('0x18')][_0x6dcf('0x23')]({'raw':_0x356ad1['options']?_0x356ad1[_0x6dcf('0x19')][_0x6dcf('0x1a')]===undefined?!![]:![]:!![],'where':_0x356ad1[_0x6dcf('0x19')]?_0x356ad1[_0x6dcf('0x19')][_0x6dcf('0x1b')]||null:null,'attributes':_0x356ad1[_0x6dcf('0x19')]?_0x356ad1[_0x6dcf('0x19')][_0x6dcf('0x1c')]||null:null,'include':_0x356ad1[_0x6dcf('0x19')]?_0x356ad1[_0x6dcf('0x19')][_0x6dcf('0x1f')]?_[_0x6dcf('0x20')](_0x356ad1[_0x6dcf('0x19')]['include'],function(_0x3cfd7e){return{'model':db[_0x3cfd7e[_0x6dcf('0x1e')]],'as':_0x3cfd7e['as'],'attributes':_0x3cfd7e['attributes'],'include':_0x3cfd7e[_0x6dcf('0x1f')]?_[_0x6dcf('0x20')](_0x3cfd7e[_0x6dcf('0x1f')],function(_0x9ed57e){return{'model':db[_0x9ed57e[_0x6dcf('0x1e')]],'as':_0x9ed57e['as'],'attributes':_0x9ed57e[_0x6dcf('0x1c')],'include':_0x9ed57e[_0x6dcf('0x1f')]?_[_0x6dcf('0x20')](_0x9ed57e['include'],function(_0x2eb30f){return{'model':db[_0x2eb30f['model']],'as':_0x2eb30f['as'],'attributes':_0x2eb30f[_0x6dcf('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6dcf('0xc')](function(_0x38dfa4){logger[_0x6dcf('0x14')](_0x6dcf('0x22'),_0x356ad1);logger[_0x6dcf('0xd')]('ShowServicenowAccount',_0x356ad1,JSON[_0x6dcf('0x21')](_0x38dfa4));_0x3d4615(_0x38dfa4);})['catch'](function(_0x441fc0){logger['error'](_0x6dcf('0x22'),_0x441fc0[_0x6dcf('0x13')],_0x356ad1);_0x271c8e(_0x4c106c[_0x6dcf('0x10')](0x1f4,_0x441fc0['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ea895e3..ee7fad6 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 _0x095a=['isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0xfbc3e6,_0x18a234){var _0x4c946f=function(_0x224e37){while(--_0x224e37){_0xfbc3e6['push'](_0xfbc3e6['shift']());}};_0x4c946f(++_0x18a234);}(_0x095a,0x86));var _0xa095=function(_0x338b28,_0x483f2d){_0x338b28=_0x338b28-0x0;var _0x56f5d6=_0x095a[_0x338b28];return _0x56f5d6;};'use strict';var multer=require('multer');var util=require(_0xa095('0x0'));var path=require('path');var timeout=require(_0xa095('0x1'));var express=require(_0xa095('0x2'));var router=express[_0xa095('0x3')]();var fs_extra=require(_0xa095('0x4'));var auth=require(_0xa095('0x5'));var interaction=require(_0xa095('0x6'));var config=require(_0xa095('0x7'));var controller=require(_0xa095('0x8'));router[_0xa095('0x9')]('/',auth[_0xa095('0xa')](),controller[_0xa095('0xb')]);router[_0xa095('0x9')](_0xa095('0xc'),auth[_0xa095('0xa')](),controller['show']);router[_0xa095('0x9')]('/:id/fields',auth[_0xa095('0xa')](),controller[_0xa095('0xd')]);router[_0xa095('0x9')](_0xa095('0xe'),auth[_0xa095('0xa')](),controller[_0xa095('0xf')]);router[_0xa095('0x9')](_0xa095('0x10'),auth[_0xa095('0xa')](),controller['getDescriptions']);router[_0xa095('0x11')]('/',auth[_0xa095('0xa')](),controller[_0xa095('0x12')]);router[_0xa095('0x13')](_0xa095('0xc'),auth['isAuthenticated'](),controller[_0xa095('0x14')]);router[_0xa095('0x15')]('/:id',auth[_0xa095('0xa')](),controller[_0xa095('0x16')]);module[_0xa095('0x17')]=router; \ No newline at end of file +var _0x96a9=['get','/:id','/:id/fields','getFields','/:id/subjects','isAuthenticated','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x96a9,0x100));var _0x996a=function(_0x386e94,_0x2ded59){_0x386e94=_0x386e94-0x0;var _0xbf521b=_0x96a9[_0x386e94];return _0xbf521b;};'use strict';var multer=require(_0x996a('0x0'));var util=require(_0x996a('0x1'));var path=require('path');var timeout=require(_0x996a('0x2'));var express=require('express');var router=express[_0x996a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x996a('0x4'));var interaction=require(_0x996a('0x5'));var config=require(_0x996a('0x6'));var controller=require(_0x996a('0x7'));router[_0x996a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x996a('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x996a('0x8')](_0x996a('0xa'),auth['isAuthenticated'](),controller[_0x996a('0xb')]);router[_0x996a('0x8')](_0x996a('0xc'),auth[_0x996a('0xd')](),controller['getSubjects']);router['get'](_0x996a('0xe'),auth[_0x996a('0xd')](),controller[_0x996a('0xf')]);router[_0x996a('0x10')]('/',auth[_0x996a('0xd')](),controller[_0x996a('0x11')]);router['put'](_0x996a('0x9'),auth[_0x996a('0xd')](),controller[_0x996a('0x12')]);router[_0x996a('0x13')](_0x996a('0x9'),auth[_0x996a('0xd')](),controller[_0x996a('0x14')]);module[_0x996a('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index b6c91d0..0146e0f 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 _0x519b=['STRING','sequelize','exports'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x519b,0x1e4));var _0xb519=function(_0x4bae1a,_0x5b0916){_0x4bae1a=_0x4bae1a-0x0;var _0x27f6d2=_0x519b[_0x4bae1a];return _0x27f6d2;};'use strict';var Sequelize=require(_0xb519('0x0'));module[_0xb519('0x1')]={'name':{'type':Sequelize[_0xb519('0x2')]},'description':{'type':Sequelize[_0xb519('0x2')]}}; \ No newline at end of file +var _0x8032=['exports','STRING','sequelize'];(function(_0x5bc69d,_0x4bd734){var _0x497694=function(_0x24bd1d){while(--_0x24bd1d){_0x5bc69d['push'](_0x5bc69d['shift']());}};_0x497694(++_0x4bd734);}(_0x8032,0x1ac));var _0x2803=function(_0x3a1256,_0x1fe2db){_0x3a1256=_0x3a1256-0x0;var _0x1bd352=_0x8032[_0x3a1256];return _0x1bd352;};'use strict';var Sequelize=require(_0x2803('0x0'));module[_0x2803('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2803('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 01a74b2..58c609e 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 _0xadae=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','findAll','catch','params','include','create','body','find','destroy','getFields','findOne','order','getSubjects','ServicenowField','getDescriptions','rimraf','zip-dir','fast-json-patch'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0xadae,0x1a1));var _0xeada=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xadae[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeada('0x0'));var zipdir=require(_0xeada('0x1'));var jsonpatch=require(_0xeada('0x2'));var rp=require('request-promise');var moment=require(_0xeada('0x3'));var BPromise=require(_0xeada('0x4'));var Mustache=require(_0xeada('0x5'));var util=require(_0xeada('0x6'));var path=require(_0xeada('0x7'));var sox=require(_0xeada('0x8'));var csv=require(_0xeada('0x9'));var ejs=require(_0xeada('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeada('0xb'));var squel=require(_0xeada('0xc'));var crypto=require(_0xeada('0xd'));var jsforce=require(_0xeada('0xe'));var deskjs=require(_0xeada('0xf'));var toCsv=require(_0xeada('0x9'));var querystring=require(_0xeada('0x10'));var Papa=require('papaparse');var Redis=require(_0xeada('0x11'));var authService=require(_0xeada('0x12'));var qs=require(_0xeada('0x13'));var as=require(_0xeada('0x14'));var hardwareService=require(_0xeada('0x15'));var logger=require(_0xeada('0x16'))(_0xeada('0x17'));var utils=require('../../config/utils');var config=require(_0xeada('0x18'));var licenseUtil=require(_0xeada('0x19'));var db=require(_0xeada('0x1a'))['db'];function respondWithStatusCode(_0x5a1638,_0x352d5e){_0x352d5e=_0x352d5e||0xcc;return function(_0x97e879){if(_0x97e879){return _0x5a1638[_0xeada('0x1b')](_0x352d5e);}return _0x5a1638[_0xeada('0x1c')](_0x352d5e)[_0xeada('0x1d')]();};}function respondWithResult(_0x53b212,_0x3e6ec9){_0x3e6ec9=_0x3e6ec9||0xc8;return function(_0x4df775){if(_0x4df775){return _0x53b212['status'](_0x3e6ec9)[_0xeada('0x1e')](_0x4df775);}};}function respondWithFilteredResult(_0xc309b4,_0x2e2253){return function(_0x1c6e26){if(_0x1c6e26){var _0x1bcd00=typeof _0x2e2253[_0xeada('0x1f')]===_0xeada('0x20')&&typeof _0x2e2253[_0xeada('0x21')]===_0xeada('0x20');var _0x38a166=_0x1c6e26['count'];var _0x139ff0=_0x1bcd00?0x0:_0x2e2253['offset'];var _0x1d7963=_0x1bcd00?_0x1c6e26['count']:_0x2e2253[_0xeada('0x1f')]+_0x2e2253[_0xeada('0x21')];var _0x35bcba;if(_0x1d7963>=_0x38a166){_0x1d7963=_0x38a166;_0x35bcba=0xc8;}else{_0x35bcba=0xce;}_0xc309b4[_0xeada('0x1c')](_0x35bcba);return _0xc309b4[_0xeada('0x22')](_0xeada('0x23'),_0x139ff0+'-'+_0x1d7963+'/'+_0x38a166)['json'](_0x1c6e26);}return null;};}function patchUpdates(_0x2e5bd1){return function(_0xd97f2){try{jsonpatch[_0xeada('0x24')](_0xd97f2,_0x2e5bd1,!![]);}catch(_0x1d310b){return BPromise[_0xeada('0x25')](_0x1d310b);}return _0xd97f2[_0xeada('0x26')]();};}function saveUpdates(_0x2bc645,_0x368118){return function(_0x27e86a){if(_0x27e86a){return _0x27e86a[_0xeada('0x27')](_0x2bc645)[_0xeada('0x28')](function(_0x389020){return _0x389020;});}return null;};}function removeEntity(_0x281019,_0x3be0fd){return function(_0x4957ac){if(_0x4957ac){return _0x4957ac['destroy']()['then'](function(){_0x281019['status'](0xcc)[_0xeada('0x1d')]();});}};}function handleEntityNotFound(_0x40f2da,_0x34a9ae){return function(_0x5b8613){if(!_0x5b8613){_0x40f2da[_0xeada('0x1b')](0x194);}return _0x5b8613;};}function handleError(_0x3797e2,_0x523e5d){_0x523e5d=_0x523e5d||0x1f4;return function(_0x3f1a52){logger[_0xeada('0x29')](_0x3f1a52[_0xeada('0x2a')]);if(_0x3f1a52[_0xeada('0x2b')]){delete _0x3f1a52['name'];}_0x3797e2[_0xeada('0x1c')](_0x523e5d)[_0xeada('0x2c')](_0x3f1a52);};}exports[_0xeada('0x2d')]=function(_0x5d36fd,_0x34f552){var _0x2137b4={},_0x4c4116={},_0x29acbd={'count':0x0,'rows':[]};var _0x11ca56=_['map'](db[_0xeada('0x2e')][_0xeada('0x2f')],function(_0x304780){return{'name':_0x304780['fieldName'],'type':_0x304780[_0xeada('0x30')][_0xeada('0x31')]};});_0x4c4116[_0xeada('0x32')]=_['map'](_0x11ca56,_0xeada('0x2b'));_0x4c4116['query']=_[_0xeada('0x33')](_0x5d36fd[_0xeada('0x34')]);_0x4c4116[_0xeada('0x35')]=_[_0xeada('0x36')](_0x4c4116[_0xeada('0x32')],_0x4c4116[_0xeada('0x34')]);_0x2137b4[_0xeada('0x37')]=_[_0xeada('0x36')](_0x4c4116[_0xeada('0x32')],qs[_0xeada('0x38')](_0x5d36fd[_0xeada('0x34')][_0xeada('0x38')]));_0x2137b4[_0xeada('0x37')]=_0x2137b4['attributes'][_0xeada('0x39')]?_0x2137b4[_0xeada('0x37')]:_0x4c4116[_0xeada('0x32')];if(!_0x5d36fd[_0xeada('0x34')][_0xeada('0x3a')](_0xeada('0x3b'))){_0x2137b4[_0xeada('0x21')]=qs[_0xeada('0x21')](_0x5d36fd[_0xeada('0x34')][_0xeada('0x21')]);_0x2137b4[_0xeada('0x1f')]=qs['offset'](_0x5d36fd[_0xeada('0x34')][_0xeada('0x1f')]);}_0x2137b4['order']=qs[_0xeada('0x3c')](_0x5d36fd[_0xeada('0x34')][_0xeada('0x3c')]);_0x2137b4[_0xeada('0x3d')]=qs[_0xeada('0x35')](_[_0xeada('0x3e')](_0x5d36fd[_0xeada('0x34')],_0x4c4116[_0xeada('0x35')]),_0x11ca56);if(_0x5d36fd[_0xeada('0x34')][_0xeada('0x3f')]){_0x2137b4[_0xeada('0x3d')]=_[_0xeada('0x40')](_0x2137b4[_0xeada('0x3d')],{'$or':_[_0xeada('0x41')](_0x11ca56,function(_0x2901cb){if(_0x2901cb['type']!==_0xeada('0x42')){var _0x144ccb={};_0x144ccb[_0x2901cb[_0xeada('0x2b')]]={'$like':'%'+_0x5d36fd[_0xeada('0x34')][_0xeada('0x3f')]+'%'};return _0x144ccb;}})});}_0x2137b4=_[_0xeada('0x40')]({},_0x2137b4,_0x5d36fd[_0xeada('0x43')]);var _0x50c226={'where':_0x2137b4[_0xeada('0x3d')]};return db['ServicenowConfiguration'][_0xeada('0x44')](_0x50c226)[_0xeada('0x28')](function(_0x3e8d6c){_0x29acbd['count']=_0x3e8d6c;if(_0x5d36fd[_0xeada('0x34')][_0xeada('0x45')]){_0x2137b4['include']=[{'all':!![]}];}return db[_0xeada('0x2e')][_0xeada('0x46')](_0x2137b4);})[_0xeada('0x28')](function(_0x275a4f){_0x29acbd['rows']=_0x275a4f;return _0x29acbd;})[_0xeada('0x28')](respondWithFilteredResult(_0x34f552,_0x2137b4))[_0xeada('0x47')](handleError(_0x34f552,null));};exports['show']=function(_0x1f0c82,_0x32259d){var _0x22d571={'raw':![],'where':{'id':_0x1f0c82[_0xeada('0x48')]['id']}},_0x4cb205={};_0x4cb205['model']=_[_0xeada('0x33')](db[_0xeada('0x2e')]['rawAttributes']);_0x4cb205['query']=_[_0xeada('0x33')](_0x1f0c82[_0xeada('0x34')]);_0x4cb205[_0xeada('0x35')]=_[_0xeada('0x36')](_0x4cb205[_0xeada('0x32')],_0x4cb205[_0xeada('0x34')]);_0x22d571[_0xeada('0x37')]=_[_0xeada('0x36')](_0x4cb205[_0xeada('0x32')],qs['fields'](_0x1f0c82[_0xeada('0x34')]['fields']));_0x22d571[_0xeada('0x37')]=_0x22d571[_0xeada('0x37')][_0xeada('0x39')]?_0x22d571['attributes']:_0x4cb205[_0xeada('0x32')];if(_0x1f0c82[_0xeada('0x34')][_0xeada('0x45')]){_0x22d571[_0xeada('0x49')]=[{'all':!![]}];}_0x22d571=_[_0xeada('0x40')]({},_0x22d571,_0x1f0c82['options']);return db[_0xeada('0x2e')]['find'](_0x22d571)[_0xeada('0x28')](handleEntityNotFound(_0x32259d,null))[_0xeada('0x28')](respondWithResult(_0x32259d,null))[_0xeada('0x47')](handleError(_0x32259d,null));};exports[_0xeada('0x4a')]=function(_0x2e479b,_0x3fae3a){return db[_0xeada('0x2e')]['create'](_0x2e479b['body'],{})[_0xeada('0x28')](respondWithResult(_0x3fae3a,0xc9))[_0xeada('0x47')](handleError(_0x3fae3a,null));};exports['update']=function(_0x28bd4b,_0x429bd1){if(_0x28bd4b[_0xeada('0x4b')]['id']){delete _0x28bd4b[_0xeada('0x4b')]['id'];}return db[_0xeada('0x2e')][_0xeada('0x4c')]({'where':{'id':_0x28bd4b['params']['id']}})[_0xeada('0x28')](handleEntityNotFound(_0x429bd1,null))[_0xeada('0x28')](saveUpdates(_0x28bd4b[_0xeada('0x4b')],null))[_0xeada('0x28')](respondWithResult(_0x429bd1,null))['catch'](handleError(_0x429bd1,null));};exports[_0xeada('0x4d')]=function(_0x371eac,_0x54423d){return db[_0xeada('0x2e')][_0xeada('0x4c')]({'where':{'id':_0x371eac[_0xeada('0x48')]['id']}})[_0xeada('0x28')](handleEntityNotFound(_0x54423d,null))[_0xeada('0x28')](removeEntity(_0x54423d,null))[_0xeada('0x47')](handleError(_0x54423d,null));};exports[_0xeada('0x4e')]=function(_0x477e32,_0x363ffc,_0x29fd25){var _0x4117d4={};var _0x44934f={};var _0x2afa1c;var _0x427c2e;return db[_0xeada('0x2e')][_0xeada('0x4f')]({'where':{'id':_0x477e32['params']['id']}})[_0xeada('0x28')](handleEntityNotFound(_0x363ffc,null))[_0xeada('0x28')](function(_0x406516){if(_0x406516){_0x2afa1c=_0x406516;_0x44934f[_0xeada('0x32')]=_['keys'](db['ServicenowField'][_0xeada('0x2f')]);_0x44934f[_0xeada('0x34')]=_[_0xeada('0x33')](_0x477e32[_0xeada('0x34')]);_0x44934f[_0xeada('0x35')]=_[_0xeada('0x36')](_0x44934f[_0xeada('0x32')],_0x44934f[_0xeada('0x34')]);_0x4117d4['attributes']=_[_0xeada('0x36')](_0x44934f['model'],qs['fields'](_0x477e32['query'][_0xeada('0x38')]));_0x4117d4['attributes']=_0x4117d4[_0xeada('0x37')][_0xeada('0x39')]?_0x4117d4[_0xeada('0x37')]:_0x44934f[_0xeada('0x32')];_0x4117d4[_0xeada('0x50')]=qs[_0xeada('0x3c')](_0x477e32[_0xeada('0x34')][_0xeada('0x3c')]);_0x4117d4[_0xeada('0x3d')]=qs[_0xeada('0x35')](_[_0xeada('0x3e')](_0x477e32[_0xeada('0x34')],_0x44934f[_0xeada('0x35')]));if(_0x477e32['query'][_0xeada('0x3f')]){_0x4117d4['where']=_[_0xeada('0x40')](_0x4117d4[_0xeada('0x3d')],{'$or':_['map'](_0x4117d4[_0xeada('0x37')],function(_0x4bdfc9){var _0x3896f1={};_0x3896f1[_0x4bdfc9]={'$like':'%'+_0x477e32[_0xeada('0x34')]['filter']+'%'};return _0x3896f1;})});}_0x4117d4=_[_0xeada('0x40')]({},_0x4117d4,_0x477e32[_0xeada('0x43')]);return _0x2afa1c[_0xeada('0x4e')](_0x4117d4);}})['then'](function(_0xc92d93){if(_0xc92d93){_0x427c2e=_0xc92d93[_0xeada('0x39')];if(!_0x477e32[_0xeada('0x34')][_0xeada('0x3a')](_0xeada('0x3b'))){_0x4117d4['limit']=qs[_0xeada('0x21')](_0x477e32[_0xeada('0x34')][_0xeada('0x21')]);_0x4117d4['offset']=qs[_0xeada('0x1f')](_0x477e32[_0xeada('0x34')][_0xeada('0x1f')]);}return _0x2afa1c[_0xeada('0x4e')](_0x4117d4);}})['then'](function(_0x366444){if(_0x366444){return _0x366444?{'count':_0x427c2e,'rows':_0x366444}:null;}})[_0xeada('0x28')](respondWithResult(_0x363ffc,null))[_0xeada('0x47')](handleError(_0x363ffc,null));};exports[_0xeada('0x51')]=function(_0x53db17,_0x33e9ba,_0x139a53){var _0x1abce4={};var _0x196d6c={};var _0x1ac86c;var _0x1a65ee;return db[_0xeada('0x2e')][_0xeada('0x4f')]({'where':{'id':_0x53db17[_0xeada('0x48')]['id']}})[_0xeada('0x28')](handleEntityNotFound(_0x33e9ba,null))[_0xeada('0x28')](function(_0x2a6726){if(_0x2a6726){_0x1ac86c=_0x2a6726;_0x196d6c[_0xeada('0x32')]=_[_0xeada('0x33')](db[_0xeada('0x52')][_0xeada('0x2f')]);_0x196d6c['query']=_[_0xeada('0x33')](_0x53db17[_0xeada('0x34')]);_0x196d6c['filters']=_[_0xeada('0x36')](_0x196d6c[_0xeada('0x32')],_0x196d6c[_0xeada('0x34')]);_0x1abce4[_0xeada('0x37')]=_['intersection'](_0x196d6c[_0xeada('0x32')],qs[_0xeada('0x38')](_0x53db17[_0xeada('0x34')]['fields']));_0x1abce4[_0xeada('0x37')]=_0x1abce4[_0xeada('0x37')][_0xeada('0x39')]?_0x1abce4[_0xeada('0x37')]:_0x196d6c[_0xeada('0x32')];_0x1abce4[_0xeada('0x50')]=qs[_0xeada('0x3c')](_0x53db17[_0xeada('0x34')]['sort']);_0x1abce4['where']=qs[_0xeada('0x35')](_[_0xeada('0x3e')](_0x53db17['query'],_0x196d6c[_0xeada('0x35')]));if(_0x53db17['query'][_0xeada('0x3f')]){_0x1abce4[_0xeada('0x3d')]=_[_0xeada('0x40')](_0x1abce4[_0xeada('0x3d')],{'$or':_[_0xeada('0x41')](_0x1abce4[_0xeada('0x37')],function(_0xcb8f73){var _0x4dd133={};_0x4dd133[_0xcb8f73]={'$like':'%'+_0x53db17[_0xeada('0x34')][_0xeada('0x3f')]+'%'};return _0x4dd133;})});}_0x1abce4=_[_0xeada('0x40')]({},_0x1abce4,_0x53db17[_0xeada('0x43')]);return _0x1ac86c[_0xeada('0x51')](_0x1abce4);}})['then'](function(_0x448216){if(_0x448216){_0x1a65ee=_0x448216[_0xeada('0x39')];if(!_0x53db17[_0xeada('0x34')][_0xeada('0x3a')](_0xeada('0x3b'))){_0x1abce4[_0xeada('0x21')]=qs['limit'](_0x53db17[_0xeada('0x34')][_0xeada('0x21')]);_0x1abce4[_0xeada('0x1f')]=qs[_0xeada('0x1f')](_0x53db17['query'][_0xeada('0x1f')]);}return _0x1ac86c[_0xeada('0x51')](_0x1abce4);}})['then'](function(_0x3f55f2){if(_0x3f55f2){return _0x3f55f2?{'count':_0x1a65ee,'rows':_0x3f55f2}:null;}})[_0xeada('0x28')](respondWithResult(_0x33e9ba,null))[_0xeada('0x47')](handleError(_0x33e9ba,null));};exports['getDescriptions']=function(_0x1b5576,_0x214210,_0x5e246c){var _0x806c04={};var _0x384170={};var _0x4d2b15;var _0x3d14f7;return db[_0xeada('0x2e')][_0xeada('0x4f')]({'where':{'id':_0x1b5576[_0xeada('0x48')]['id']}})[_0xeada('0x28')](handleEntityNotFound(_0x214210,null))[_0xeada('0x28')](function(_0x23d6e4){if(_0x23d6e4){_0x4d2b15=_0x23d6e4;_0x384170[_0xeada('0x32')]=_[_0xeada('0x33')](db[_0xeada('0x52')][_0xeada('0x2f')]);_0x384170[_0xeada('0x34')]=_[_0xeada('0x33')](_0x1b5576[_0xeada('0x34')]);_0x384170[_0xeada('0x35')]=_['intersection'](_0x384170[_0xeada('0x32')],_0x384170[_0xeada('0x34')]);_0x806c04['attributes']=_[_0xeada('0x36')](_0x384170['model'],qs['fields'](_0x1b5576[_0xeada('0x34')][_0xeada('0x38')]));_0x806c04[_0xeada('0x37')]=_0x806c04['attributes'][_0xeada('0x39')]?_0x806c04[_0xeada('0x37')]:_0x384170[_0xeada('0x32')];_0x806c04[_0xeada('0x50')]=qs[_0xeada('0x3c')](_0x1b5576[_0xeada('0x34')][_0xeada('0x3c')]);_0x806c04[_0xeada('0x3d')]=qs[_0xeada('0x35')](_['pick'](_0x1b5576[_0xeada('0x34')],_0x384170[_0xeada('0x35')]));if(_0x1b5576[_0xeada('0x34')][_0xeada('0x3f')]){_0x806c04[_0xeada('0x3d')]=_[_0xeada('0x40')](_0x806c04[_0xeada('0x3d')],{'$or':_['map'](_0x806c04[_0xeada('0x37')],function(_0x2de84c){var _0x104722={};_0x104722[_0x2de84c]={'$like':'%'+_0x1b5576[_0xeada('0x34')][_0xeada('0x3f')]+'%'};return _0x104722;})});}_0x806c04=_[_0xeada('0x40')]({},_0x806c04,_0x1b5576[_0xeada('0x43')]);return _0x4d2b15[_0xeada('0x53')](_0x806c04);}})[_0xeada('0x28')](function(_0x3bbe85){if(_0x3bbe85){_0x3d14f7=_0x3bbe85[_0xeada('0x39')];if(!_0x1b5576[_0xeada('0x34')][_0xeada('0x3a')](_0xeada('0x3b'))){_0x806c04[_0xeada('0x21')]=qs[_0xeada('0x21')](_0x1b5576[_0xeada('0x34')][_0xeada('0x21')]);_0x806c04['offset']=qs[_0xeada('0x1f')](_0x1b5576[_0xeada('0x34')][_0xeada('0x1f')]);}return _0x4d2b15[_0xeada('0x53')](_0x806c04);}})['then'](function(_0x48fe30){if(_0x48fe30){return _0x48fe30?{'count':_0x3d14f7,'rows':_0x48fe30}:null;}})[_0xeada('0x28')](respondWithResult(_0x214210,null))[_0xeada('0x47')](handleError(_0x214210,null));}; \ No newline at end of file +var _0xf641=['status','json','offset','limit','undefined','count','apply','reject','then','destroy','error','stack','name','index','ServicenowConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','getFields','findOne','getSubjects','ServicenowField','rawAttributes','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x459399,_0x4caf0d){var _0xeb0378=function(_0x4361e7){while(--_0x4361e7){_0x459399['push'](_0x459399['shift']());}};_0xeb0378(++_0x4caf0d);}(_0xf641,0x88));var _0x1f64=function(_0x109333,_0x5ce132){_0x109333=_0x109333-0x0;var _0x7eb389=_0xf641[_0x109333];return _0x7eb389;};'use strict';var emlformat=require(_0x1f64('0x0'));var rimraf=require(_0x1f64('0x1'));var zipdir=require(_0x1f64('0x2'));var jsonpatch=require(_0x1f64('0x3'));var rp=require(_0x1f64('0x4'));var moment=require(_0x1f64('0x5'));var BPromise=require(_0x1f64('0x6'));var Mustache=require(_0x1f64('0x7'));var util=require(_0x1f64('0x8'));var path=require(_0x1f64('0x9'));var sox=require(_0x1f64('0xa'));var csv=require(_0x1f64('0xb'));var ejs=require(_0x1f64('0xc'));var fs=require('fs');var fs_extra=require(_0x1f64('0xd'));var _=require(_0x1f64('0xe'));var squel=require(_0x1f64('0xf'));var crypto=require(_0x1f64('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1f64('0xb'));var querystring=require('querystring');var Papa=require(_0x1f64('0x11'));var Redis=require(_0x1f64('0x12'));var authService=require(_0x1f64('0x13'));var qs=require(_0x1f64('0x14'));var as=require(_0x1f64('0x15'));var hardwareService=require(_0x1f64('0x16'));var logger=require('../../config/logger')(_0x1f64('0x17'));var utils=require('../../config/utils');var config=require(_0x1f64('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f64('0x19'))['db'];function respondWithStatusCode(_0x1ad2fa,_0x24ffac){_0x24ffac=_0x24ffac||0xcc;return function(_0x399eb3){if(_0x399eb3){return _0x1ad2fa[_0x1f64('0x1a')](_0x24ffac);}return _0x1ad2fa['status'](_0x24ffac)[_0x1f64('0x1b')]();};}function respondWithResult(_0xb3ca17,_0x347ae5){_0x347ae5=_0x347ae5||0xc8;return function(_0xfb5c05){if(_0xfb5c05){return _0xb3ca17[_0x1f64('0x1c')](_0x347ae5)[_0x1f64('0x1d')](_0xfb5c05);}};}function respondWithFilteredResult(_0x3588a2,_0x3dfe84){return function(_0x44f25d){if(_0x44f25d){var _0x3213a6=typeof _0x3dfe84[_0x1f64('0x1e')]==='undefined'&&typeof _0x3dfe84[_0x1f64('0x1f')]===_0x1f64('0x20');var _0x38ba62=_0x44f25d[_0x1f64('0x21')];var _0x3483b3=_0x3213a6?0x0:_0x3dfe84['offset'];var _0x3ef85b=_0x3213a6?_0x44f25d['count']:_0x3dfe84['offset']+_0x3dfe84['limit'];var _0x29b193;if(_0x3ef85b>=_0x38ba62){_0x3ef85b=_0x38ba62;_0x29b193=0xc8;}else{_0x29b193=0xce;}_0x3588a2[_0x1f64('0x1c')](_0x29b193);return _0x3588a2['set']('Content-Range',_0x3483b3+'-'+_0x3ef85b+'/'+_0x38ba62)[_0x1f64('0x1d')](_0x44f25d);}return null;};}function patchUpdates(_0x5d56b2){return function(_0x1654a3){try{jsonpatch[_0x1f64('0x22')](_0x1654a3,_0x5d56b2,!![]);}catch(_0x21c7a4){return BPromise[_0x1f64('0x23')](_0x21c7a4);}return _0x1654a3['save']();};}function saveUpdates(_0x52da7d,_0x503c84){return function(_0x50f61e){if(_0x50f61e){return _0x50f61e['update'](_0x52da7d)[_0x1f64('0x24')](function(_0x355bb7){return _0x355bb7;});}return null;};}function removeEntity(_0xec9a97,_0x738586){return function(_0x4a7536){if(_0x4a7536){return _0x4a7536[_0x1f64('0x25')]()[_0x1f64('0x24')](function(){_0xec9a97['status'](0xcc)[_0x1f64('0x1b')]();});}};}function handleEntityNotFound(_0x58eeeb,_0x51578d){return function(_0x31f30a){if(!_0x31f30a){_0x58eeeb[_0x1f64('0x1a')](0x194);}return _0x31f30a;};}function handleError(_0x4ceee6,_0x370855){_0x370855=_0x370855||0x1f4;return function(_0x183a52){logger[_0x1f64('0x26')](_0x183a52[_0x1f64('0x27')]);if(_0x183a52['name']){delete _0x183a52[_0x1f64('0x28')];}_0x4ceee6[_0x1f64('0x1c')](_0x370855)['send'](_0x183a52);};}exports[_0x1f64('0x29')]=function(_0x340c0a,_0x4b8e4a){var _0x2d3531={},_0x2be483={},_0x431933={'count':0x0,'rows':[]};var _0x1d1228=_['map'](db[_0x1f64('0x2a')]['rawAttributes'],function(_0x527194){return{'name':_0x527194[_0x1f64('0x2b')],'type':_0x527194[_0x1f64('0x2c')][_0x1f64('0x2d')]};});_0x2be483['model']=_['map'](_0x1d1228,_0x1f64('0x28'));_0x2be483[_0x1f64('0x2e')]=_[_0x1f64('0x2f')](_0x340c0a[_0x1f64('0x2e')]);_0x2be483[_0x1f64('0x30')]=_[_0x1f64('0x31')](_0x2be483[_0x1f64('0x32')],_0x2be483[_0x1f64('0x2e')]);_0x2d3531[_0x1f64('0x33')]=_[_0x1f64('0x31')](_0x2be483[_0x1f64('0x32')],qs['fields'](_0x340c0a[_0x1f64('0x2e')][_0x1f64('0x34')]));_0x2d3531[_0x1f64('0x33')]=_0x2d3531['attributes'][_0x1f64('0x35')]?_0x2d3531['attributes']:_0x2be483['model'];if(!_0x340c0a[_0x1f64('0x2e')][_0x1f64('0x36')](_0x1f64('0x37'))){_0x2d3531[_0x1f64('0x1f')]=qs['limit'](_0x340c0a[_0x1f64('0x2e')][_0x1f64('0x1f')]);_0x2d3531['offset']=qs[_0x1f64('0x1e')](_0x340c0a[_0x1f64('0x2e')][_0x1f64('0x1e')]);}_0x2d3531[_0x1f64('0x38')]=qs[_0x1f64('0x39')](_0x340c0a['query'][_0x1f64('0x39')]);_0x2d3531[_0x1f64('0x3a')]=qs[_0x1f64('0x30')](_[_0x1f64('0x3b')](_0x340c0a[_0x1f64('0x2e')],_0x2be483['filters']),_0x1d1228);if(_0x340c0a['query'][_0x1f64('0x3c')]){_0x2d3531[_0x1f64('0x3a')]=_[_0x1f64('0x3d')](_0x2d3531[_0x1f64('0x3a')],{'$or':_[_0x1f64('0x3e')](_0x1d1228,function(_0x3d2a6e){if(_0x3d2a6e[_0x1f64('0x2c')]!==_0x1f64('0x3f')){var _0x5a0ec0={};_0x5a0ec0[_0x3d2a6e['name']]={'$like':'%'+_0x340c0a[_0x1f64('0x2e')][_0x1f64('0x3c')]+'%'};return _0x5a0ec0;}})});}_0x2d3531=_[_0x1f64('0x3d')]({},_0x2d3531,_0x340c0a[_0x1f64('0x40')]);var _0x4a7858={'where':_0x2d3531[_0x1f64('0x3a')]};return db[_0x1f64('0x2a')]['count'](_0x4a7858)[_0x1f64('0x24')](function(_0x17e613){_0x431933[_0x1f64('0x21')]=_0x17e613;if(_0x340c0a['query']['includeAll']){_0x2d3531[_0x1f64('0x41')]=[{'all':!![]}];}return db[_0x1f64('0x2a')][_0x1f64('0x42')](_0x2d3531);})['then'](function(_0x12e736){_0x431933[_0x1f64('0x43')]=_0x12e736;return _0x431933;})['then'](respondWithFilteredResult(_0x4b8e4a,_0x2d3531))[_0x1f64('0x44')](handleError(_0x4b8e4a,null));};exports[_0x1f64('0x45')]=function(_0x1a2a6d,_0x19d330){var _0x439160={'raw':![],'where':{'id':_0x1a2a6d[_0x1f64('0x46')]['id']}},_0x59a637={};_0x59a637[_0x1f64('0x32')]=_[_0x1f64('0x2f')](db['ServicenowConfiguration']['rawAttributes']);_0x59a637[_0x1f64('0x2e')]=_[_0x1f64('0x2f')](_0x1a2a6d['query']);_0x59a637[_0x1f64('0x30')]=_['intersection'](_0x59a637[_0x1f64('0x32')],_0x59a637[_0x1f64('0x2e')]);_0x439160['attributes']=_[_0x1f64('0x31')](_0x59a637['model'],qs['fields'](_0x1a2a6d[_0x1f64('0x2e')]['fields']));_0x439160[_0x1f64('0x33')]=_0x439160[_0x1f64('0x33')][_0x1f64('0x35')]?_0x439160[_0x1f64('0x33')]:_0x59a637['model'];if(_0x1a2a6d[_0x1f64('0x2e')][_0x1f64('0x47')]){_0x439160[_0x1f64('0x41')]=[{'all':!![]}];}_0x439160=_['merge']({},_0x439160,_0x1a2a6d[_0x1f64('0x40')]);return db[_0x1f64('0x2a')][_0x1f64('0x48')](_0x439160)[_0x1f64('0x24')](handleEntityNotFound(_0x19d330,null))[_0x1f64('0x24')](respondWithResult(_0x19d330,null))[_0x1f64('0x44')](handleError(_0x19d330,null));};exports[_0x1f64('0x49')]=function(_0x1b9b63,_0x59944e){return db[_0x1f64('0x2a')][_0x1f64('0x49')](_0x1b9b63[_0x1f64('0x4a')],{})[_0x1f64('0x24')](respondWithResult(_0x59944e,0xc9))[_0x1f64('0x44')](handleError(_0x59944e,null));};exports[_0x1f64('0x4b')]=function(_0x47a862,_0x80b4fc){if(_0x47a862[_0x1f64('0x4a')]['id']){delete _0x47a862['body']['id'];}return db[_0x1f64('0x2a')][_0x1f64('0x48')]({'where':{'id':_0x47a862[_0x1f64('0x46')]['id']}})[_0x1f64('0x24')](handleEntityNotFound(_0x80b4fc,null))[_0x1f64('0x24')](saveUpdates(_0x47a862['body'],null))[_0x1f64('0x24')](respondWithResult(_0x80b4fc,null))[_0x1f64('0x44')](handleError(_0x80b4fc,null));};exports['destroy']=function(_0x2a9304,_0x2ec42c){return db['ServicenowConfiguration'][_0x1f64('0x48')]({'where':{'id':_0x2a9304[_0x1f64('0x46')]['id']}})['then'](handleEntityNotFound(_0x2ec42c,null))[_0x1f64('0x24')](removeEntity(_0x2ec42c,null))[_0x1f64('0x44')](handleError(_0x2ec42c,null));};exports[_0x1f64('0x4c')]=function(_0x2de3b6,_0xe926f,_0x328f8f){var _0x369551={};var _0x4b9742={};var _0x9e769c;var _0x276a96;return db[_0x1f64('0x2a')][_0x1f64('0x4d')]({'where':{'id':_0x2de3b6[_0x1f64('0x46')]['id']}})[_0x1f64('0x24')](handleEntityNotFound(_0xe926f,null))[_0x1f64('0x24')](function(_0x3c9b43){if(_0x3c9b43){_0x9e769c=_0x3c9b43;_0x4b9742[_0x1f64('0x32')]=_[_0x1f64('0x2f')](db['ServicenowField']['rawAttributes']);_0x4b9742[_0x1f64('0x2e')]=_[_0x1f64('0x2f')](_0x2de3b6[_0x1f64('0x2e')]);_0x4b9742['filters']=_[_0x1f64('0x31')](_0x4b9742[_0x1f64('0x32')],_0x4b9742[_0x1f64('0x2e')]);_0x369551[_0x1f64('0x33')]=_[_0x1f64('0x31')](_0x4b9742[_0x1f64('0x32')],qs[_0x1f64('0x34')](_0x2de3b6[_0x1f64('0x2e')][_0x1f64('0x34')]));_0x369551[_0x1f64('0x33')]=_0x369551[_0x1f64('0x33')][_0x1f64('0x35')]?_0x369551[_0x1f64('0x33')]:_0x4b9742['model'];_0x369551[_0x1f64('0x38')]=qs[_0x1f64('0x39')](_0x2de3b6[_0x1f64('0x2e')]['sort']);_0x369551[_0x1f64('0x3a')]=qs['filters'](_['pick'](_0x2de3b6[_0x1f64('0x2e')],_0x4b9742['filters']));if(_0x2de3b6[_0x1f64('0x2e')][_0x1f64('0x3c')]){_0x369551[_0x1f64('0x3a')]=_[_0x1f64('0x3d')](_0x369551[_0x1f64('0x3a')],{'$or':_[_0x1f64('0x3e')](_0x369551[_0x1f64('0x33')],function(_0x1c6d39){var _0x230b1e={};_0x230b1e[_0x1c6d39]={'$like':'%'+_0x2de3b6[_0x1f64('0x2e')][_0x1f64('0x3c')]+'%'};return _0x230b1e;})});}_0x369551=_[_0x1f64('0x3d')]({},_0x369551,_0x2de3b6[_0x1f64('0x40')]);return _0x9e769c[_0x1f64('0x4c')](_0x369551);}})[_0x1f64('0x24')](function(_0x3dc299){if(_0x3dc299){_0x276a96=_0x3dc299[_0x1f64('0x35')];if(!_0x2de3b6[_0x1f64('0x2e')][_0x1f64('0x36')](_0x1f64('0x37'))){_0x369551[_0x1f64('0x1f')]=qs[_0x1f64('0x1f')](_0x2de3b6['query'][_0x1f64('0x1f')]);_0x369551[_0x1f64('0x1e')]=qs[_0x1f64('0x1e')](_0x2de3b6[_0x1f64('0x2e')][_0x1f64('0x1e')]);}return _0x9e769c['getFields'](_0x369551);}})[_0x1f64('0x24')](function(_0x2183ec){if(_0x2183ec){return _0x2183ec?{'count':_0x276a96,'rows':_0x2183ec}:null;}})['then'](respondWithResult(_0xe926f,null))[_0x1f64('0x44')](handleError(_0xe926f,null));};exports[_0x1f64('0x4e')]=function(_0x4f8a46,_0x416ed9,_0x4fa9f0){var _0x787949={};var _0x2db55e={};var _0x35fdb4;var _0x5d5f8a;return db[_0x1f64('0x2a')]['findOne']({'where':{'id':_0x4f8a46[_0x1f64('0x46')]['id']}})[_0x1f64('0x24')](handleEntityNotFound(_0x416ed9,null))['then'](function(_0x306536){if(_0x306536){_0x35fdb4=_0x306536;_0x2db55e[_0x1f64('0x32')]=_[_0x1f64('0x2f')](db[_0x1f64('0x4f')][_0x1f64('0x50')]);_0x2db55e[_0x1f64('0x2e')]=_[_0x1f64('0x2f')](_0x4f8a46[_0x1f64('0x2e')]);_0x2db55e[_0x1f64('0x30')]=_['intersection'](_0x2db55e[_0x1f64('0x32')],_0x2db55e[_0x1f64('0x2e')]);_0x787949[_0x1f64('0x33')]=_[_0x1f64('0x31')](_0x2db55e[_0x1f64('0x32')],qs['fields'](_0x4f8a46[_0x1f64('0x2e')]['fields']));_0x787949['attributes']=_0x787949[_0x1f64('0x33')][_0x1f64('0x35')]?_0x787949[_0x1f64('0x33')]:_0x2db55e[_0x1f64('0x32')];_0x787949[_0x1f64('0x38')]=qs['sort'](_0x4f8a46[_0x1f64('0x2e')][_0x1f64('0x39')]);_0x787949[_0x1f64('0x3a')]=qs[_0x1f64('0x30')](_['pick'](_0x4f8a46[_0x1f64('0x2e')],_0x2db55e['filters']));if(_0x4f8a46[_0x1f64('0x2e')][_0x1f64('0x3c')]){_0x787949[_0x1f64('0x3a')]=_[_0x1f64('0x3d')](_0x787949[_0x1f64('0x3a')],{'$or':_[_0x1f64('0x3e')](_0x787949[_0x1f64('0x33')],function(_0x450c62){var _0xb57e33={};_0xb57e33[_0x450c62]={'$like':'%'+_0x4f8a46[_0x1f64('0x2e')]['filter']+'%'};return _0xb57e33;})});}_0x787949=_[_0x1f64('0x3d')]({},_0x787949,_0x4f8a46[_0x1f64('0x40')]);return _0x35fdb4[_0x1f64('0x4e')](_0x787949);}})[_0x1f64('0x24')](function(_0x442720){if(_0x442720){_0x5d5f8a=_0x442720[_0x1f64('0x35')];if(!_0x4f8a46[_0x1f64('0x2e')][_0x1f64('0x36')](_0x1f64('0x37'))){_0x787949['limit']=qs[_0x1f64('0x1f')](_0x4f8a46['query']['limit']);_0x787949['offset']=qs[_0x1f64('0x1e')](_0x4f8a46[_0x1f64('0x2e')][_0x1f64('0x1e')]);}return _0x35fdb4[_0x1f64('0x4e')](_0x787949);}})[_0x1f64('0x24')](function(_0x581c92){if(_0x581c92){return _0x581c92?{'count':_0x5d5f8a,'rows':_0x581c92}:null;}})[_0x1f64('0x24')](respondWithResult(_0x416ed9,null))[_0x1f64('0x44')](handleError(_0x416ed9,null));};exports[_0x1f64('0x51')]=function(_0x517ad4,_0x420047,_0x5b0d7b){var _0x22561c={};var _0x2fc16b={};var _0x5a2d1a;var _0x49cdfc;return db[_0x1f64('0x2a')]['findOne']({'where':{'id':_0x517ad4[_0x1f64('0x46')]['id']}})[_0x1f64('0x24')](handleEntityNotFound(_0x420047,null))[_0x1f64('0x24')](function(_0x85cbe6){if(_0x85cbe6){_0x5a2d1a=_0x85cbe6;_0x2fc16b[_0x1f64('0x32')]=_[_0x1f64('0x2f')](db[_0x1f64('0x4f')][_0x1f64('0x50')]);_0x2fc16b[_0x1f64('0x2e')]=_[_0x1f64('0x2f')](_0x517ad4[_0x1f64('0x2e')]);_0x2fc16b[_0x1f64('0x30')]=_[_0x1f64('0x31')](_0x2fc16b['model'],_0x2fc16b[_0x1f64('0x2e')]);_0x22561c[_0x1f64('0x33')]=_[_0x1f64('0x31')](_0x2fc16b[_0x1f64('0x32')],qs[_0x1f64('0x34')](_0x517ad4[_0x1f64('0x2e')][_0x1f64('0x34')]));_0x22561c['attributes']=_0x22561c[_0x1f64('0x33')][_0x1f64('0x35')]?_0x22561c['attributes']:_0x2fc16b[_0x1f64('0x32')];_0x22561c[_0x1f64('0x38')]=qs[_0x1f64('0x39')](_0x517ad4['query']['sort']);_0x22561c['where']=qs[_0x1f64('0x30')](_[_0x1f64('0x3b')](_0x517ad4[_0x1f64('0x2e')],_0x2fc16b[_0x1f64('0x30')]));if(_0x517ad4['query'][_0x1f64('0x3c')]){_0x22561c[_0x1f64('0x3a')]=_[_0x1f64('0x3d')](_0x22561c[_0x1f64('0x3a')],{'$or':_['map'](_0x22561c[_0x1f64('0x33')],function(_0xc84577){var _0x3b96e4={};_0x3b96e4[_0xc84577]={'$like':'%'+_0x517ad4[_0x1f64('0x2e')]['filter']+'%'};return _0x3b96e4;})});}_0x22561c=_['merge']({},_0x22561c,_0x517ad4['options']);return _0x5a2d1a[_0x1f64('0x51')](_0x22561c);}})[_0x1f64('0x24')](function(_0x2c48c8){if(_0x2c48c8){_0x49cdfc=_0x2c48c8[_0x1f64('0x35')];if(!_0x517ad4['query'][_0x1f64('0x36')](_0x1f64('0x37'))){_0x22561c[_0x1f64('0x1f')]=qs[_0x1f64('0x1f')](_0x517ad4[_0x1f64('0x2e')][_0x1f64('0x1f')]);_0x22561c['offset']=qs[_0x1f64('0x1e')](_0x517ad4['query']['offset']);}return _0x5a2d1a['getDescriptions'](_0x22561c);}})['then'](function(_0x28f6b8){if(_0x28f6b8){return _0x28f6b8?{'count':_0x49cdfc,'rows':_0x28f6b8}:null;}})[_0x1f64('0x24')](respondWithResult(_0x420047,null))[_0x1f64('0x44')](handleError(_0x420047,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 73f3d25..0e67bba 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 _0xbbdd=['int_servicenow_configurations','util','api','moment','rimraf','exports','define'];(function(_0x1e0957,_0xf4026f){var _0x1e4676=function(_0x487102){while(--_0x487102){_0x1e0957['push'](_0x1e0957['shift']());}};_0x1e4676(++_0xf4026f);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbbdd[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xdbbd('0x0'));var logger=require('../../config/logger')(_0xdbbd('0x1'));var moment=require(_0xdbbd('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdbbd('0x3'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xdbbd('0x4')]=function(_0x103977,_0x3e81aa){return _0x103977[_0xdbbd('0x5')]('ServicenowConfiguration',attributes,{'tableName':_0xdbbd('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a86=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9a86,0x1ed));var _0x69a8=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x9a86[_0x1558ab];return _0x53b64a;};'use strict';var _=require(_0x69a8('0x0'));var util=require(_0x69a8('0x1'));var logger=require('../../config/logger')(_0x69a8('0x2'));var moment=require(_0x69a8('0x3'));var BPromise=require(_0x69a8('0x4'));var rp=require(_0x69a8('0x5'));var fs=require('fs');var path=require(_0x69a8('0x6'));var rimraf=require(_0x69a8('0x7'));var config=require(_0x69a8('0x8'));var attributes=require(_0x69a8('0x9'));module[_0x69a8('0xa')]=function(_0x36c9ac,_0x3ed1d5){return _0x36c9ac[_0x69a8('0xb')](_0x69a8('0xc'),attributes,{'tableName':_0x69a8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index b1b9cda..c230d2b 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 _0x3acb=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','request\x20sent','debug','stringify','error','code','message','ServicenowConfiguration,\x20%s,\x20%s','info','result','catch','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4d424e,_0x8ac8c5){var _0x3c2d71=function(_0x1cd567){while(--_0x1cd567){_0x4d424e['push'](_0x4d424e['shift']());}};_0x3c2d71(++_0x8ac8c5);}(_0x3acb,0x114));var _0xb3ac=function(_0x22964a,_0x5e0b04){_0x22964a=_0x22964a-0x0;var _0x178b4c=_0x3acb[_0x22964a];return _0x178b4c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb3ac('0x0'));var BPromise=require('bluebird');var rs=require(_0xb3ac('0x1'));var fs=require('fs');var Redis=require(_0xb3ac('0x2'));var db=require(_0xb3ac('0x3'))['db'];var utils=require(_0xb3ac('0x4'));var logger=require(_0xb3ac('0x5'))('rpc');var config=require(_0xb3ac('0x6'));var jayson=require(_0xb3ac('0x7'));var client=jayson[_0xb3ac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a46e5,_0x34aea1,_0x24cbc0){return new BPromise(function(_0x539a65,_0x1d444d){return client['request'](_0x2a46e5,_0x24cbc0)[_0xb3ac('0x9')](function(_0x3263d4){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x34aea1,_0xb3ac('0xa'));logger[_0xb3ac('0xb')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x34aea1,_0xb3ac('0xa'),JSON[_0xb3ac('0xc')](_0x3263d4));if(_0x3263d4[_0xb3ac('0xd')]){if(_0x3263d4[_0xb3ac('0xd')][_0xb3ac('0xe')]===0x1f4){logger[_0xb3ac('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x34aea1,_0x3263d4[_0xb3ac('0xd')]['message']);return _0x1d444d(_0x3263d4[_0xb3ac('0xd')][_0xb3ac('0xf')]);}logger[_0xb3ac('0xd')](_0xb3ac('0x10'),_0x34aea1,_0x3263d4[_0xb3ac('0xd')]['message']);return _0x539a65(_0x3263d4['error']['message']);}else{logger[_0xb3ac('0x11')](_0xb3ac('0x10'),_0x34aea1,_0xb3ac('0xa'));_0x539a65(_0x3263d4[_0xb3ac('0x12')][_0xb3ac('0xf')]);}})[_0xb3ac('0x13')](function(_0xd63f20){logger['error'](_0xb3ac('0x10'),_0x34aea1,_0xd63f20);_0x1d444d(_0xd63f20);});});} \ No newline at end of file +var _0xffbd=['request','then','info','ServicenowConfiguration,\x20%s,\x20%s','error','message','request\x20sent','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x84d12c,_0x3de265){var _0xb87252=function(_0x4788b5){while(--_0x4788b5){_0x84d12c['push'](_0x84d12c['shift']());}};_0xb87252(++_0x3de265);}(_0xffbd,0x170));var _0xdffb=function(_0x5df2ff,_0x48300e){_0x5df2ff=_0x5df2ff-0x0;var _0x594f25=_0xffbd[_0x5df2ff];return _0x594f25;};'use strict';var _=require('lodash');var util=require(_0xdffb('0x0'));var moment=require(_0xdffb('0x1'));var BPromise=require(_0xdffb('0x2'));var rs=require(_0xdffb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdffb('0x4'))['db'];var utils=require(_0xdffb('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdffb('0x6'));var jayson=require(_0xdffb('0x7'));var client=jayson[_0xdffb('0x8')][_0xdffb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b6dd4,_0x4ae2ad,_0x301699){return new BPromise(function(_0x406ade,_0x21c22e){return client[_0xdffb('0xa')](_0x3b6dd4,_0x301699)[_0xdffb('0xb')](function(_0x2c5b23){logger[_0xdffb('0xc')](_0xdffb('0xd'),_0x4ae2ad,'request\x20sent');logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4ae2ad,'request\x20sent',JSON['stringify'](_0x2c5b23));if(_0x2c5b23[_0xdffb('0xe')]){if(_0x2c5b23[_0xdffb('0xe')]['code']===0x1f4){logger[_0xdffb('0xe')](_0xdffb('0xd'),_0x4ae2ad,_0x2c5b23[_0xdffb('0xe')][_0xdffb('0xf')]);return _0x21c22e(_0x2c5b23[_0xdffb('0xe')][_0xdffb('0xf')]);}logger['error'](_0xdffb('0xd'),_0x4ae2ad,_0x2c5b23[_0xdffb('0xe')]['message']);return _0x406ade(_0x2c5b23[_0xdffb('0xe')][_0xdffb('0xf')]);}else{logger[_0xdffb('0xc')](_0xdffb('0xd'),_0x4ae2ad,_0xdffb('0x10'));_0x406ade(_0x2c5b23[_0xdffb('0x11')]['message']);}})['catch'](function(_0x490924){logger[_0xdffb('0xe')](_0xdffb('0xd'),_0x4ae2ad,_0x490924);_0x21c22e(_0x490924);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index ec4788a..0d7fea1 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 _0x3d0f=['update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x3d0f,0xf2));var _0xf3d0=function(_0x188c88,_0x210793){_0x188c88=_0x188c88-0x0;var _0x4e4c38=_0x3d0f[_0x188c88];return _0x4e4c38;};'use strict';var multer=require(_0xf3d0('0x0'));var util=require(_0xf3d0('0x1'));var path=require(_0xf3d0('0x2'));var timeout=require(_0xf3d0('0x3'));var express=require(_0xf3d0('0x4'));var router=express[_0xf3d0('0x5')]();var fs_extra=require(_0xf3d0('0x6'));var auth=require(_0xf3d0('0x7'));var interaction=require(_0xf3d0('0x8'));var config=require('../../config/environment');var controller=require(_0xf3d0('0x9'));router[_0xf3d0('0xa')]('/',auth[_0xf3d0('0xb')](),controller[_0xf3d0('0xc')]);router[_0xf3d0('0xa')]('/:id',auth[_0xf3d0('0xb')](),controller[_0xf3d0('0xd')]);router[_0xf3d0('0xe')]('/',auth[_0xf3d0('0xb')](),controller[_0xf3d0('0xf')]);router[_0xf3d0('0x10')](_0xf3d0('0x11'),auth[_0xf3d0('0xb')](),controller[_0xf3d0('0x12')]);router[_0xf3d0('0x13')](_0xf3d0('0x11'),auth[_0xf3d0('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xab3c=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','show','post','isAuthenticated','create','update','delete','destroy','exports'];(function(_0x3b584a,_0x1e9367){var _0x34d5ce=function(_0x55fb72){while(--_0x55fb72){_0x3b584a['push'](_0x3b584a['shift']());}};_0x34d5ce(++_0x1e9367);}(_0xab3c,0x78));var _0xcab3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xab3c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xcab3('0x0'));var util=require('util');var path=require(_0xcab3('0x1'));var timeout=require('connect-timeout');var express=require(_0xcab3('0x2'));var router=express[_0xcab3('0x3')]();var fs_extra=require(_0xcab3('0x4'));var auth=require(_0xcab3('0x5'));var interaction=require(_0xcab3('0x6'));var config=require(_0xcab3('0x7'));var controller=require(_0xcab3('0x8'));router[_0xcab3('0x9')]('/',auth['isAuthenticated'](),controller[_0xcab3('0xa')]);router[_0xcab3('0x9')](_0xcab3('0xb'),auth['isAuthenticated'](),controller[_0xcab3('0xc')]);router[_0xcab3('0xd')]('/',auth[_0xcab3('0xe')](),controller[_0xcab3('0xf')]);router['put'](_0xcab3('0xb'),auth['isAuthenticated'](),controller[_0xcab3('0x10')]);router[_0xcab3('0x11')]('/:id',auth[_0xcab3('0xe')](),controller[_0xcab3('0x12')]);module[_0xcab3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 7a96594..4870969 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 _0x0efa=['customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0efa,0x1dc));var _0xa0ef=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x0efa[_0x220f3f];return _0x1f170e;};'use strict';var Sequelize=require(_0xa0ef('0x0'));module[_0xa0ef('0x1')]={'type':{'type':Sequelize['ENUM'](_0xa0ef('0x2'),_0xa0ef('0x3'),_0xa0ef('0x4'),_0xa0ef('0x5'),_0xa0ef('0x6')),'defaultValue':_0xa0ef('0x2')},'content':{'type':Sequelize[_0xa0ef('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa0ef('0x8')]('string',_0xa0ef('0x3'),_0xa0ef('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa0ef('0x7')]},'nameField':{'type':Sequelize[_0xa0ef('0x7')]},'customField':{'type':Sequelize[_0xa0ef('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa0ef('0x7')]}}; \ No newline at end of file +var _0x37e5=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37e5,0x108));var _0x537e=function(_0x492a1f,_0x57a0f0){_0x492a1f=_0x492a1f-0x0;var _0x468f9e=_0x37e5[_0x492a1f];return _0x468f9e;};'use strict';var Sequelize=require(_0x537e('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x537e('0x1'),_0x537e('0x2'),_0x537e('0x3'),'keyValue',_0x537e('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x537e('0x5')]},'key':{'type':Sequelize[_0x537e('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x537e('0x1'),_0x537e('0x2'),_0x537e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x537e('0x5')]},'nameField':{'type':Sequelize[_0x537e('0x5')]},'customField':{'type':Sequelize[_0x537e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x537e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 153f726..48134f1 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 _0xb7dd=['sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','ServicenowField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','catch','params','includeAll','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xb7dd,0x1d9));var _0xdb7d=function(_0x1e3fc4,_0x4cedcf){_0x1e3fc4=_0x1e3fc4-0x0;var _0x3159d6=_0xb7dd[_0x1e3fc4];return _0x3159d6;};'use strict';var emlformat=require(_0xdb7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb7d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdb7d('0x2'));var moment=require(_0xdb7d('0x3'));var BPromise=require(_0xdb7d('0x4'));var Mustache=require('mustache');var util=require(_0xdb7d('0x5'));var path=require(_0xdb7d('0x6'));var sox=require(_0xdb7d('0x7'));var csv=require('to-csv');var ejs=require(_0xdb7d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb7d('0x9'));var squel=require(_0xdb7d('0xa'));var crypto=require(_0xdb7d('0xb'));var jsforce=require(_0xdb7d('0xc'));var deskjs=require(_0xdb7d('0xd'));var toCsv=require(_0xdb7d('0xe'));var querystring=require('querystring');var Papa=require(_0xdb7d('0xf'));var Redis=require(_0xdb7d('0x10'));var authService=require(_0xdb7d('0x11'));var qs=require(_0xdb7d('0x12'));var as=require(_0xdb7d('0x13'));var hardwareService=require(_0xdb7d('0x14'));var logger=require('../../config/logger')(_0xdb7d('0x15'));var utils=require(_0xdb7d('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdb7d('0x17'))['db'];function respondWithStatusCode(_0x189dc3,_0x4e4e22){_0x4e4e22=_0x4e4e22||0xcc;return function(_0x208a37){if(_0x208a37){return _0x189dc3[_0xdb7d('0x18')](_0x4e4e22);}return _0x189dc3[_0xdb7d('0x19')](_0x4e4e22)[_0xdb7d('0x1a')]();};}function respondWithResult(_0x112d65,_0xb2e47d){_0xb2e47d=_0xb2e47d||0xc8;return function(_0xb35a05){if(_0xb35a05){return _0x112d65[_0xdb7d('0x19')](_0xb2e47d)['json'](_0xb35a05);}};}function respondWithFilteredResult(_0x2d9c67,_0x1ecd01){return function(_0x169c39){if(_0x169c39){var _0xf17516=typeof _0x1ecd01[_0xdb7d('0x1b')]===_0xdb7d('0x1c')&&typeof _0x1ecd01[_0xdb7d('0x1d')]==='undefined';var _0x3e7169=_0x169c39[_0xdb7d('0x1e')];var _0x7f205f=_0xf17516?0x0:_0x1ecd01[_0xdb7d('0x1b')];var _0x29ade2=_0xf17516?_0x169c39[_0xdb7d('0x1e')]:_0x1ecd01['offset']+_0x1ecd01[_0xdb7d('0x1d')];var _0xa7c0aa;if(_0x29ade2>=_0x3e7169){_0x29ade2=_0x3e7169;_0xa7c0aa=0xc8;}else{_0xa7c0aa=0xce;}_0x2d9c67[_0xdb7d('0x19')](_0xa7c0aa);return _0x2d9c67['set'](_0xdb7d('0x1f'),_0x7f205f+'-'+_0x29ade2+'/'+_0x3e7169)[_0xdb7d('0x20')](_0x169c39);}return null;};}function patchUpdates(_0x423ea6){return function(_0x452796){try{jsonpatch['apply'](_0x452796,_0x423ea6,!![]);}catch(_0x23b796){return BPromise[_0xdb7d('0x21')](_0x23b796);}return _0x452796[_0xdb7d('0x22')]();};}function saveUpdates(_0x3dfcda,_0x208e2c){return function(_0x148d2c){if(_0x148d2c){return _0x148d2c[_0xdb7d('0x23')](_0x3dfcda)[_0xdb7d('0x24')](function(_0x22fe4c){return _0x22fe4c;});}return null;};}function removeEntity(_0x528806,_0x486717){return function(_0x14820d){if(_0x14820d){return _0x14820d[_0xdb7d('0x25')]()[_0xdb7d('0x24')](function(){_0x528806[_0xdb7d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3addb4,_0x556b04){return function(_0x3a984f){if(!_0x3a984f){_0x3addb4[_0xdb7d('0x18')](0x194);}return _0x3a984f;};}function handleError(_0x8ae4db,_0x470b7f){_0x470b7f=_0x470b7f||0x1f4;return function(_0x396d79){logger[_0xdb7d('0x26')](_0x396d79[_0xdb7d('0x27')]);if(_0x396d79[_0xdb7d('0x28')]){delete _0x396d79[_0xdb7d('0x28')];}_0x8ae4db[_0xdb7d('0x19')](_0x470b7f)['send'](_0x396d79);};}exports[_0xdb7d('0x29')]=function(_0x176cf0,_0x5cba6a){var _0xe17fe0={},_0x453300={},_0x4bf388={'count':0x0,'rows':[]};var _0x36f318=_[_0xdb7d('0x2a')](db[_0xdb7d('0x2b')]['rawAttributes'],function(_0x5966b9){return{'name':_0x5966b9[_0xdb7d('0x2c')],'type':_0x5966b9[_0xdb7d('0x2d')][_0xdb7d('0x2e')]};});_0x453300[_0xdb7d('0x2f')]=_[_0xdb7d('0x2a')](_0x36f318,_0xdb7d('0x28'));_0x453300[_0xdb7d('0x30')]=_[_0xdb7d('0x31')](_0x176cf0[_0xdb7d('0x30')]);_0x453300['filters']=_[_0xdb7d('0x32')](_0x453300['model'],_0x453300['query']);_0xe17fe0[_0xdb7d('0x33')]=_[_0xdb7d('0x32')](_0x453300[_0xdb7d('0x2f')],qs['fields'](_0x176cf0[_0xdb7d('0x30')][_0xdb7d('0x34')]));_0xe17fe0[_0xdb7d('0x33')]=_0xe17fe0[_0xdb7d('0x33')][_0xdb7d('0x35')]?_0xe17fe0['attributes']:_0x453300[_0xdb7d('0x2f')];if(!_0x176cf0[_0xdb7d('0x30')]['hasOwnProperty'](_0xdb7d('0x36'))){_0xe17fe0[_0xdb7d('0x1d')]=qs['limit'](_0x176cf0[_0xdb7d('0x30')]['limit']);_0xe17fe0['offset']=qs[_0xdb7d('0x1b')](_0x176cf0['query'][_0xdb7d('0x1b')]);}_0xe17fe0[_0xdb7d('0x37')]=qs['sort'](_0x176cf0['query'][_0xdb7d('0x38')]);_0xe17fe0[_0xdb7d('0x39')]=qs[_0xdb7d('0x3a')](_[_0xdb7d('0x3b')](_0x176cf0[_0xdb7d('0x30')],_0x453300[_0xdb7d('0x3a')]),_0x36f318);if(_0x176cf0[_0xdb7d('0x30')][_0xdb7d('0x3c')]){_0xe17fe0[_0xdb7d('0x39')]=_[_0xdb7d('0x3d')](_0xe17fe0[_0xdb7d('0x39')],{'$or':_['map'](_0x36f318,function(_0x4c7f87){if(_0x4c7f87[_0xdb7d('0x2d')]!=='VIRTUAL'){var _0x24a919={};_0x24a919[_0x4c7f87[_0xdb7d('0x28')]]={'$like':'%'+_0x176cf0[_0xdb7d('0x30')]['filter']+'%'};return _0x24a919;}})});}_0xe17fe0=_[_0xdb7d('0x3d')]({},_0xe17fe0,_0x176cf0[_0xdb7d('0x3e')]);var _0x4cfa92={'where':_0xe17fe0[_0xdb7d('0x39')]};return db[_0xdb7d('0x2b')][_0xdb7d('0x1e')](_0x4cfa92)[_0xdb7d('0x24')](function(_0x26f487){_0x4bf388[_0xdb7d('0x1e')]=_0x26f487;if(_0x176cf0[_0xdb7d('0x30')]['includeAll']){_0xe17fe0[_0xdb7d('0x3f')]=[{'all':!![]}];}return db[_0xdb7d('0x2b')][_0xdb7d('0x40')](_0xe17fe0);})[_0xdb7d('0x24')](function(_0x3bbef9){_0x4bf388['rows']=_0x3bbef9;return _0x4bf388;})[_0xdb7d('0x24')](respondWithFilteredResult(_0x5cba6a,_0xe17fe0))[_0xdb7d('0x41')](handleError(_0x5cba6a,null));};exports['show']=function(_0x81062,_0x1e764e){var _0x29140b={'raw':!![],'where':{'id':_0x81062[_0xdb7d('0x42')]['id']}},_0x56eab8={};_0x56eab8[_0xdb7d('0x2f')]=_[_0xdb7d('0x31')](db[_0xdb7d('0x2b')]['rawAttributes']);_0x56eab8[_0xdb7d('0x30')]=_[_0xdb7d('0x31')](_0x81062['query']);_0x56eab8[_0xdb7d('0x3a')]=_['intersection'](_0x56eab8[_0xdb7d('0x2f')],_0x56eab8[_0xdb7d('0x30')]);_0x29140b['attributes']=_[_0xdb7d('0x32')](_0x56eab8['model'],qs[_0xdb7d('0x34')](_0x81062[_0xdb7d('0x30')][_0xdb7d('0x34')]));_0x29140b['attributes']=_0x29140b[_0xdb7d('0x33')]['length']?_0x29140b[_0xdb7d('0x33')]:_0x56eab8[_0xdb7d('0x2f')];if(_0x81062[_0xdb7d('0x30')][_0xdb7d('0x43')]){_0x29140b[_0xdb7d('0x3f')]=[{'all':!![]}];}_0x29140b=_['merge']({},_0x29140b,_0x81062[_0xdb7d('0x3e')]);return db[_0xdb7d('0x2b')][_0xdb7d('0x44')](_0x29140b)['then'](handleEntityNotFound(_0x1e764e,null))['then'](respondWithResult(_0x1e764e,null))[_0xdb7d('0x41')](handleError(_0x1e764e,null));};exports[_0xdb7d('0x45')]=function(_0x3bd55d,_0x4459d2){return db['ServicenowField']['create'](_0x3bd55d[_0xdb7d('0x46')],{})[_0xdb7d('0x24')](respondWithResult(_0x4459d2,0xc9))[_0xdb7d('0x41')](handleError(_0x4459d2,null));};exports['update']=function(_0x5cd4ce,_0x3712e7){if(_0x5cd4ce[_0xdb7d('0x46')]['id']){delete _0x5cd4ce[_0xdb7d('0x46')]['id'];}return db[_0xdb7d('0x2b')][_0xdb7d('0x44')]({'where':{'id':_0x5cd4ce[_0xdb7d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3712e7,null))[_0xdb7d('0x24')](saveUpdates(_0x5cd4ce[_0xdb7d('0x46')],null))[_0xdb7d('0x24')](respondWithResult(_0x3712e7,null))[_0xdb7d('0x41')](handleError(_0x3712e7,null));};exports[_0xdb7d('0x25')]=function(_0x192842,_0x2ee398){return db[_0xdb7d('0x2b')]['find']({'where':{'id':_0x192842[_0xdb7d('0x42')]['id']}})[_0xdb7d('0x24')](handleEntityNotFound(_0x2ee398,null))['then'](removeEntity(_0x2ee398,null))['catch'](handleError(_0x2ee398,null));}; \ No newline at end of file +var _0x7875=['../../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','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','ServicenowField','rawAttributes','fieldName','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x46f5d2,_0x14ea88){var _0x5afb9c=function(_0x3c2cfb){while(--_0x3c2cfb){_0x46f5d2['push'](_0x46f5d2['shift']());}};_0x5afb9c(++_0x14ea88);}(_0x7875,0xd9));var _0x5787=function(_0x564c18,_0x114836){_0x564c18=_0x564c18-0x0;var _0x165ac8=_0x7875[_0x564c18];return _0x165ac8;};'use strict';var emlformat=require(_0x5787('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5787('0x1'));var jsonpatch=require(_0x5787('0x2'));var rp=require(_0x5787('0x3'));var moment=require('moment');var BPromise=require(_0x5787('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5787('0x5'));var sox=require(_0x5787('0x6'));var csv=require(_0x5787('0x7'));var ejs=require(_0x5787('0x8'));var fs=require('fs');var fs_extra=require(_0x5787('0x9'));var _=require(_0x5787('0xa'));var squel=require('squel');var crypto=require(_0x5787('0xb'));var jsforce=require(_0x5787('0xc'));var deskjs=require(_0x5787('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5787('0xe'));var Papa=require(_0x5787('0xf'));var Redis=require(_0x5787('0x10'));var authService=require(_0x5787('0x11'));var qs=require(_0x5787('0x12'));var as=require(_0x5787('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5787('0x14'))(_0x5787('0x15'));var utils=require(_0x5787('0x16'));var config=require(_0x5787('0x17'));var licenseUtil=require(_0x5787('0x18'));var db=require(_0x5787('0x19'))['db'];function respondWithStatusCode(_0x6fcd28,_0x2592e4){_0x2592e4=_0x2592e4||0xcc;return function(_0x2a8b1f){if(_0x2a8b1f){return _0x6fcd28[_0x5787('0x1a')](_0x2592e4);}return _0x6fcd28['status'](_0x2592e4)['end']();};}function respondWithResult(_0x203b1e,_0x58e25e){_0x58e25e=_0x58e25e||0xc8;return function(_0x4ef313){if(_0x4ef313){return _0x203b1e[_0x5787('0x1b')](_0x58e25e)[_0x5787('0x1c')](_0x4ef313);}};}function respondWithFilteredResult(_0x56db90,_0x4852c2){return function(_0x4a2bc8){if(_0x4a2bc8){var _0x509666=typeof _0x4852c2[_0x5787('0x1d')]===_0x5787('0x1e')&&typeof _0x4852c2[_0x5787('0x1f')]===_0x5787('0x1e');var _0x561ff9=_0x4a2bc8[_0x5787('0x20')];var _0x188477=_0x509666?0x0:_0x4852c2['offset'];var _0x64ec7a=_0x509666?_0x4a2bc8[_0x5787('0x20')]:_0x4852c2[_0x5787('0x1d')]+_0x4852c2[_0x5787('0x1f')];var _0x40bd12;if(_0x64ec7a>=_0x561ff9){_0x64ec7a=_0x561ff9;_0x40bd12=0xc8;}else{_0x40bd12=0xce;}_0x56db90[_0x5787('0x1b')](_0x40bd12);return _0x56db90['set'](_0x5787('0x21'),_0x188477+'-'+_0x64ec7a+'/'+_0x561ff9)['json'](_0x4a2bc8);}return null;};}function patchUpdates(_0x3d5204){return function(_0x45c3ca){try{jsonpatch['apply'](_0x45c3ca,_0x3d5204,!![]);}catch(_0x4666b7){return BPromise[_0x5787('0x22')](_0x4666b7);}return _0x45c3ca[_0x5787('0x23')]();};}function saveUpdates(_0x235fca,_0x12125e){return function(_0xb2ee08){if(_0xb2ee08){return _0xb2ee08[_0x5787('0x24')](_0x235fca)['then'](function(_0x52fb1a){return _0x52fb1a;});}return null;};}function removeEntity(_0x27e9d5,_0x117f2f){return function(_0x3f273c){if(_0x3f273c){return _0x3f273c[_0x5787('0x25')]()[_0x5787('0x26')](function(){_0x27e9d5[_0x5787('0x1b')](0xcc)[_0x5787('0x27')]();});}};}function handleEntityNotFound(_0x160714,_0x423610){return function(_0x5af666){if(!_0x5af666){_0x160714[_0x5787('0x1a')](0x194);}return _0x5af666;};}function handleError(_0x3d8be7,_0x1683d3){_0x1683d3=_0x1683d3||0x1f4;return function(_0x1c7184){logger[_0x5787('0x28')](_0x1c7184[_0x5787('0x29')]);if(_0x1c7184[_0x5787('0x2a')]){delete _0x1c7184['name'];}_0x3d8be7[_0x5787('0x1b')](_0x1683d3)[_0x5787('0x2b')](_0x1c7184);};}exports[_0x5787('0x2c')]=function(_0x392f08,_0x53e42c){var _0x92426d={},_0x4a9350={},_0xbe8fb4={'count':0x0,'rows':[]};var _0x274b21=_['map'](db[_0x5787('0x2d')][_0x5787('0x2e')],function(_0x3c4fb2){return{'name':_0x3c4fb2[_0x5787('0x2f')],'type':_0x3c4fb2['type'][_0x5787('0x30')]};});_0x4a9350[_0x5787('0x31')]=_[_0x5787('0x32')](_0x274b21,_0x5787('0x2a'));_0x4a9350[_0x5787('0x33')]=_[_0x5787('0x34')](_0x392f08[_0x5787('0x33')]);_0x4a9350['filters']=_['intersection'](_0x4a9350[_0x5787('0x31')],_0x4a9350[_0x5787('0x33')]);_0x92426d[_0x5787('0x35')]=_['intersection'](_0x4a9350['model'],qs['fields'](_0x392f08['query'][_0x5787('0x36')]));_0x92426d[_0x5787('0x35')]=_0x92426d[_0x5787('0x35')][_0x5787('0x37')]?_0x92426d[_0x5787('0x35')]:_0x4a9350[_0x5787('0x31')];if(!_0x392f08['query'][_0x5787('0x38')](_0x5787('0x39'))){_0x92426d[_0x5787('0x1f')]=qs['limit'](_0x392f08['query'][_0x5787('0x1f')]);_0x92426d[_0x5787('0x1d')]=qs[_0x5787('0x1d')](_0x392f08['query']['offset']);}_0x92426d[_0x5787('0x3a')]=qs[_0x5787('0x3b')](_0x392f08[_0x5787('0x33')]['sort']);_0x92426d[_0x5787('0x3c')]=qs['filters'](_[_0x5787('0x3d')](_0x392f08['query'],_0x4a9350[_0x5787('0x3e')]),_0x274b21);if(_0x392f08[_0x5787('0x33')][_0x5787('0x3f')]){_0x92426d[_0x5787('0x3c')]=_[_0x5787('0x40')](_0x92426d[_0x5787('0x3c')],{'$or':_['map'](_0x274b21,function(_0x5a6999){if(_0x5a6999[_0x5787('0x41')]!==_0x5787('0x42')){var _0x4c5fae={};_0x4c5fae[_0x5a6999[_0x5787('0x2a')]]={'$like':'%'+_0x392f08[_0x5787('0x33')]['filter']+'%'};return _0x4c5fae;}})});}_0x92426d=_['merge']({},_0x92426d,_0x392f08['options']);var _0x10de50={'where':_0x92426d['where']};return db[_0x5787('0x2d')][_0x5787('0x20')](_0x10de50)[_0x5787('0x26')](function(_0x413e0f){_0xbe8fb4[_0x5787('0x20')]=_0x413e0f;if(_0x392f08[_0x5787('0x33')][_0x5787('0x43')]){_0x92426d[_0x5787('0x44')]=[{'all':!![]}];}return db[_0x5787('0x2d')][_0x5787('0x45')](_0x92426d);})[_0x5787('0x26')](function(_0x2d66c5){_0xbe8fb4[_0x5787('0x46')]=_0x2d66c5;return _0xbe8fb4;})[_0x5787('0x26')](respondWithFilteredResult(_0x53e42c,_0x92426d))[_0x5787('0x47')](handleError(_0x53e42c,null));};exports[_0x5787('0x48')]=function(_0x1b34ed,_0x4284de){var _0xb85dfc={'raw':!![],'where':{'id':_0x1b34ed[_0x5787('0x49')]['id']}},_0x6d6014={};_0x6d6014['model']=_[_0x5787('0x34')](db['ServicenowField'][_0x5787('0x2e')]);_0x6d6014[_0x5787('0x33')]=_[_0x5787('0x34')](_0x1b34ed[_0x5787('0x33')]);_0x6d6014['filters']=_[_0x5787('0x4a')](_0x6d6014[_0x5787('0x31')],_0x6d6014['query']);_0xb85dfc[_0x5787('0x35')]=_['intersection'](_0x6d6014['model'],qs[_0x5787('0x36')](_0x1b34ed[_0x5787('0x33')]['fields']));_0xb85dfc[_0x5787('0x35')]=_0xb85dfc[_0x5787('0x35')][_0x5787('0x37')]?_0xb85dfc[_0x5787('0x35')]:_0x6d6014[_0x5787('0x31')];if(_0x1b34ed[_0x5787('0x33')][_0x5787('0x43')]){_0xb85dfc[_0x5787('0x44')]=[{'all':!![]}];}_0xb85dfc=_['merge']({},_0xb85dfc,_0x1b34ed['options']);return db[_0x5787('0x2d')][_0x5787('0x4b')](_0xb85dfc)[_0x5787('0x26')](handleEntityNotFound(_0x4284de,null))[_0x5787('0x26')](respondWithResult(_0x4284de,null))[_0x5787('0x47')](handleError(_0x4284de,null));};exports[_0x5787('0x4c')]=function(_0x528116,_0x224790){return db[_0x5787('0x2d')][_0x5787('0x4c')](_0x528116[_0x5787('0x4d')],{})[_0x5787('0x26')](respondWithResult(_0x224790,0xc9))[_0x5787('0x47')](handleError(_0x224790,null));};exports[_0x5787('0x24')]=function(_0x22f3e4,_0x17db98){if(_0x22f3e4[_0x5787('0x4d')]['id']){delete _0x22f3e4[_0x5787('0x4d')]['id'];}return db[_0x5787('0x2d')][_0x5787('0x4b')]({'where':{'id':_0x22f3e4[_0x5787('0x49')]['id']}})[_0x5787('0x26')](handleEntityNotFound(_0x17db98,null))[_0x5787('0x26')](saveUpdates(_0x22f3e4['body'],null))[_0x5787('0x26')](respondWithResult(_0x17db98,null))[_0x5787('0x47')](handleError(_0x17db98,null));};exports[_0x5787('0x25')]=function(_0x36cf29,_0x266803){return db['ServicenowField'][_0x5787('0x4b')]({'where':{'id':_0x36cf29['params']['id']}})[_0x5787('0x26')](handleEntityNotFound(_0x266803,null))['then'](removeEntity(_0x266803,null))[_0x5787('0x47')](handleError(_0x266803,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4aa0a3f..c59f257 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 _0x3929=['request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','moment','bluebird'];(function(_0x550c57,_0x545d16){var _0x12a674=function(_0xb04668){while(--_0xb04668){_0x550c57['push'](_0x550c57['shift']());}};_0x12a674(++_0x545d16);}(_0x3929,0xdc));var _0x9392=function(_0x4ac716,_0x40243f){_0x4ac716=_0x4ac716-0x0;var _0x35f56b=_0x3929[_0x4ac716];return _0x35f56b;};'use strict';var _=require(_0x9392('0x0'));var util=require(_0x9392('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9392('0x2'));var BPromise=require(_0x9392('0x3'));var rp=require(_0x9392('0x4'));var fs=require('fs');var path=require(_0x9392('0x5'));var rimraf=require(_0x9392('0x6'));var config=require(_0x9392('0x7'));var attributes=require(_0x9392('0x8'));module[_0x9392('0x9')]=function(_0x575b1c,_0x336fc8){return _0x575b1c[_0x9392('0xa')](_0x9392('0xb'),attributes,{'tableName':_0x9392('0xc'),'paranoid':![],'indexes':[{'name':_0x9392('0xd'),'fields':[_0x9392('0xe'),_0x9392('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa4b2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField'];(function(_0x4b3c89,_0x2b1c97){var _0x321580=function(_0x9088b6){while(--_0x9088b6){_0x4b3c89['push'](_0x4b3c89['shift']());}};_0x321580(++_0x2b1c97);}(_0xa4b2,0x195));var _0x2a4b=function(_0x39f5c2,_0xbe28ce){_0x39f5c2=_0x39f5c2-0x0;var _0x2c9f70=_0xa4b2[_0x39f5c2];return _0x2c9f70;};'use strict';var _=require(_0x2a4b('0x0'));var util=require(_0x2a4b('0x1'));var logger=require(_0x2a4b('0x2'))(_0x2a4b('0x3'));var moment=require(_0x2a4b('0x4'));var BPromise=require(_0x2a4b('0x5'));var rp=require(_0x2a4b('0x6'));var fs=require('fs');var path=require(_0x2a4b('0x7'));var rimraf=require('rimraf');var config=require(_0x2a4b('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x2a4b('0x9')]=function(_0x26fba0,_0x51f9f1){return _0x26fba0[_0x2a4b('0xa')](_0x2a4b('0xb'),attributes,{'tableName':_0x2a4b('0xc'),'paranoid':![],'indexes':[{'name':_0x2a4b('0xd'),'fields':[_0x2a4b('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 096b4d5..ab8d4fa 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 _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x13c945,_0x1c7968){var _0x4aa8de=function(_0x53f3d0){while(--_0x53f3d0){_0x13c945['push'](_0x13c945['shift']());}};_0x4aa8de(++_0x1c7968);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xb7e7[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x239b31,_0x44a64d){var _0x41c8be=function(_0x27f031){while(--_0x27f031){_0x239b31['push'](_0x239b31['shift']());}};_0x41c8be(++_0x44a64d);}(_0xda3f,0xec));var _0xfda3=function(_0x102180,_0xb9a3fa){_0x102180=_0x102180-0x0;var _0x1b3aa0=_0xda3f[_0x102180];return _0x1b3aa0;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index bab4c44..deb0d61 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1ea2e9,_0x37d6dd){var _0x419aec=function(_0x1b3317){while(--_0x1b3317){_0x1ea2e9['push'](_0x1ea2e9['shift']());}};_0x419aec(++_0x37d6dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x16bf01,_0x5ccd90){var _0x6acd09=function(_0x202bc0){while(--_0x202bc0){_0x16bf01['push'](_0x16bf01['shift']());}};_0x6acd09(++_0x5ccd90);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 2db1e73..33974fe 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(_0x3ce0ba,_0x3d4af8){var _0x4c37ce=function(_0x562853){while(--_0x562853){_0x3ce0ba['push'](_0x3ce0ba['shift']());}};_0x4c37ce(++_0x3d4af8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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(_0x287eae,_0x598896){var _0x48d4db=function(_0x5608ab){while(--_0x5608ab){_0x287eae['push'](_0x287eae['shift']());}};_0x48d4db(++_0x598896);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 81f2a23..ea4765c 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 _0xc33a=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','SugarcrmAccount','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','include','findAll','params','keys','includeAll','find','create','catch','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','duration_hours','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','stringify','values','module_fields','remove','includes','label','endsWith','value','test','send','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x38936d,_0x103706){var _0x15997a=function(_0x3e8f21){while(--_0x3e8f21){_0x38936d['push'](_0x38936d['shift']());}};_0x15997a(++_0x103706);}(_0xc33a,0xd5));var _0xac33=function(_0x4f4757,_0x44241a){_0x4f4757=_0x4f4757-0x0;var _0x549c37=_0xc33a[_0x4f4757];return _0x549c37;};'use strict';var emlformat=require(_0xac33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac33('0x1'));var jsonpatch=require(_0xac33('0x2'));var rp=require(_0xac33('0x3'));var moment=require(_0xac33('0x4'));var BPromise=require(_0xac33('0x5'));var Mustache=require(_0xac33('0x6'));var util=require(_0xac33('0x7'));var path=require('path');var sox=require(_0xac33('0x8'));var csv=require(_0xac33('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac33('0xa'));var _=require(_0xac33('0xb'));var squel=require(_0xac33('0xc'));var crypto=require(_0xac33('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xac33('0xe'));var toCsv=require(_0xac33('0x9'));var querystring=require(_0xac33('0xf'));var Papa=require('papaparse');var Redis=require(_0xac33('0x10'));var authService=require(_0xac33('0x11'));var qs=require(_0xac33('0x12'));var as=require(_0xac33('0x13'));var hardwareService=require(_0xac33('0x14'));var logger=require(_0xac33('0x15'))(_0xac33('0x16'));var utils=require(_0xac33('0x17'));var config=require(_0xac33('0x18'));var licenseUtil=require(_0xac33('0x19'));var db=require(_0xac33('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x553430,_0x116889){_0x116889=_0x116889||0xcc;return function(_0x538afa){if(_0x538afa){return _0x553430[_0xac33('0x1b')](_0x116889);}return _0x553430[_0xac33('0x1c')](_0x116889)['end']();};}function respondWithResult(_0x3bf6fd,_0xce5400){_0xce5400=_0xce5400||0xc8;return function(_0x34a393){if(_0x34a393){return _0x3bf6fd[_0xac33('0x1c')](_0xce5400)[_0xac33('0x1d')](_0x34a393);}};}function respondWithFilteredResult(_0x1aad0a,_0x4570ff){return function(_0x4d886a){if(_0x4d886a){var _0x17531d=typeof _0x4570ff[_0xac33('0x1e')]===_0xac33('0x1f')&&typeof _0x4570ff[_0xac33('0x20')]===_0xac33('0x1f');var _0x450522=_0x4d886a[_0xac33('0x21')];var _0x177633=_0x17531d?0x0:_0x4570ff[_0xac33('0x1e')];var _0x154da7=_0x17531d?_0x4d886a[_0xac33('0x21')]:_0x4570ff[_0xac33('0x1e')]+_0x4570ff[_0xac33('0x20')];var _0x5f1fa1;if(_0x154da7>=_0x450522){_0x154da7=_0x450522;_0x5f1fa1=0xc8;}else{_0x5f1fa1=0xce;}_0x1aad0a[_0xac33('0x1c')](_0x5f1fa1);return _0x1aad0a[_0xac33('0x22')](_0xac33('0x23'),_0x177633+'-'+_0x154da7+'/'+_0x450522)[_0xac33('0x1d')](_0x4d886a);}return null;};}function patchUpdates(_0x12afc8){return function(_0x5ab43a){try{jsonpatch[_0xac33('0x24')](_0x5ab43a,_0x12afc8,!![]);}catch(_0x4de7d2){return BPromise[_0xac33('0x25')](_0x4de7d2);}return _0x5ab43a[_0xac33('0x26')]();};}function saveUpdates(_0xcc7662,_0x5bfee6){return function(_0x53cfb6){if(_0x53cfb6){return _0x53cfb6[_0xac33('0x27')](_0xcc7662)[_0xac33('0x28')](function(_0x5e0fab){return _0x5e0fab;});}return null;};}function removeEntity(_0x3f3a74,_0xf4fdd8){return function(_0x4c7cde){if(_0x4c7cde){return _0x4c7cde['destroy']()[_0xac33('0x28')](function(){_0x3f3a74[_0xac33('0x1c')](0xcc)[_0xac33('0x29')]();});}};}function handleEntityNotFound(_0x34abd8,_0x1e96b9){return function(_0x2efac5){if(!_0x2efac5){_0x34abd8[_0xac33('0x1b')](0x194);}return _0x2efac5;};}function handleError(_0x1d7448,_0x5500ba){_0x5500ba=_0x5500ba||0x1f4;return function(_0x58a814){logger[_0xac33('0x2a')](_0x58a814[_0xac33('0x2b')]);if(_0x58a814['name']){delete _0x58a814[_0xac33('0x2c')];}_0x1d7448[_0xac33('0x1c')](_0x5500ba)['send'](_0x58a814);};}exports[_0xac33('0x2d')]=function(_0x3514f8,_0x4be3a8){var _0x5297c5={},_0x13ab21={},_0xd3a8b9={'count':0x0,'rows':[]};var _0x134c6a=_[_0xac33('0x2e')](db[_0xac33('0x2f')][_0xac33('0x30')],function(_0x570e08){return{'name':_0x570e08['fieldName'],'type':_0x570e08[_0xac33('0x31')][_0xac33('0x32')]};});_0x13ab21['model']=_[_0xac33('0x2e')](_0x134c6a,_0xac33('0x2c'));_0x13ab21['query']=_['keys'](_0x3514f8[_0xac33('0x33')]);_0x13ab21[_0xac33('0x34')]=_[_0xac33('0x35')](_0x13ab21[_0xac33('0x36')],_0x13ab21['query']);_0x5297c5[_0xac33('0x37')]=_[_0xac33('0x35')](_0x13ab21[_0xac33('0x36')],qs[_0xac33('0x38')](_0x3514f8['query'][_0xac33('0x38')]));_0x5297c5[_0xac33('0x37')]=_0x5297c5[_0xac33('0x37')][_0xac33('0x39')]?_0x5297c5[_0xac33('0x37')]:_0x13ab21[_0xac33('0x36')];if(!_0x3514f8[_0xac33('0x33')][_0xac33('0x3a')](_0xac33('0x3b'))){_0x5297c5[_0xac33('0x20')]=qs[_0xac33('0x20')](_0x3514f8[_0xac33('0x33')][_0xac33('0x20')]);_0x5297c5['offset']=qs[_0xac33('0x1e')](_0x3514f8[_0xac33('0x33')][_0xac33('0x1e')]);}_0x5297c5['order']=qs[_0xac33('0x3c')](_0x3514f8[_0xac33('0x33')][_0xac33('0x3c')]);_0x5297c5['where']=qs[_0xac33('0x34')](_['pick'](_0x3514f8[_0xac33('0x33')],_0x13ab21[_0xac33('0x34')]),_0x134c6a);if(_0x3514f8[_0xac33('0x33')][_0xac33('0x3d')]){_0x5297c5[_0xac33('0x3e')]=_[_0xac33('0x3f')](_0x5297c5[_0xac33('0x3e')],{'$or':_[_0xac33('0x2e')](_0x134c6a,function(_0x1edcd5){if(_0x1edcd5[_0xac33('0x31')]!=='VIRTUAL'){var _0x5c651c={};_0x5c651c[_0x1edcd5[_0xac33('0x2c')]]={'$like':'%'+_0x3514f8['query'][_0xac33('0x3d')]+'%'};return _0x5c651c;}})});}_0x5297c5=_[_0xac33('0x3f')]({},_0x5297c5,_0x3514f8[_0xac33('0x40')]);var _0x361e33={'where':_0x5297c5['where']};return db[_0xac33('0x2f')][_0xac33('0x21')](_0x361e33)[_0xac33('0x28')](function(_0x524e0b){_0xd3a8b9[_0xac33('0x21')]=_0x524e0b;if(_0x3514f8[_0xac33('0x33')]['includeAll']){_0x5297c5[_0xac33('0x41')]=[{'all':!![]}];}return db[_0xac33('0x2f')][_0xac33('0x42')](_0x5297c5);})['then'](function(_0x13c0cd){_0xd3a8b9['rows']=_0x13c0cd;return _0xd3a8b9;})[_0xac33('0x28')](respondWithFilteredResult(_0x4be3a8,_0x5297c5))['catch'](handleError(_0x4be3a8,null));};exports['show']=function(_0x1b5d9a,_0x5e8382){var _0x21de4e={'raw':![],'where':{'id':_0x1b5d9a[_0xac33('0x43')]['id']}},_0x36bd6b={};_0x36bd6b[_0xac33('0x36')]=_[_0xac33('0x44')](db[_0xac33('0x2f')][_0xac33('0x30')]);_0x36bd6b[_0xac33('0x33')]=_[_0xac33('0x44')](_0x1b5d9a[_0xac33('0x33')]);_0x36bd6b[_0xac33('0x34')]=_[_0xac33('0x35')](_0x36bd6b[_0xac33('0x36')],_0x36bd6b[_0xac33('0x33')]);_0x21de4e[_0xac33('0x37')]=_[_0xac33('0x35')](_0x36bd6b[_0xac33('0x36')],qs['fields'](_0x1b5d9a[_0xac33('0x33')][_0xac33('0x38')]));_0x21de4e[_0xac33('0x37')]=_0x21de4e['attributes'][_0xac33('0x39')]?_0x21de4e[_0xac33('0x37')]:_0x36bd6b[_0xac33('0x36')];if(_0x1b5d9a[_0xac33('0x33')][_0xac33('0x45')]){_0x21de4e[_0xac33('0x41')]=[{'all':!![]}];}_0x21de4e=_['merge']({},_0x21de4e,_0x1b5d9a[_0xac33('0x40')]);return db['SugarcrmAccount'][_0xac33('0x46')](_0x21de4e)[_0xac33('0x28')](handleEntityNotFound(_0x5e8382,null))[_0xac33('0x28')](respondWithResult(_0x5e8382,null))['catch'](handleError(_0x5e8382,null));};exports[_0xac33('0x47')]=function(_0x1d827a,_0x5a49a4){return db['SugarcrmAccount'][_0xac33('0x47')](_0x1d827a['body'],{})[_0xac33('0x28')](respondWithResult(_0x5a49a4,0xc9))[_0xac33('0x48')](handleError(_0x5a49a4,null));};exports[_0xac33('0x27')]=function(_0x4da812,_0x2dfcfc){if(_0x4da812[_0xac33('0x49')]['id']){delete _0x4da812[_0xac33('0x49')]['id'];}return db[_0xac33('0x2f')][_0xac33('0x46')]({'where':{'id':_0x4da812['params']['id']}})['then'](handleEntityNotFound(_0x2dfcfc,null))[_0xac33('0x28')](saveUpdates(_0x4da812[_0xac33('0x49')],null))[_0xac33('0x28')](respondWithResult(_0x2dfcfc,null))[_0xac33('0x48')](handleError(_0x2dfcfc,null));};exports[_0xac33('0x4a')]=function(_0x3d640b,_0x162754){return db['SugarcrmAccount']['find']({'where':{'id':_0x3d640b[_0xac33('0x43')]['id']}})[_0xac33('0x28')](handleEntityNotFound(_0x162754,null))[_0xac33('0x28')](removeEntity(_0x162754,null))[_0xac33('0x48')](handleError(_0x162754,null));};exports[_0xac33('0x4b')]=function(_0x5ce1d5,_0x4643ca,_0x542429){var _0xabe7a6={};var _0x529da6={};var _0x1164f6;var _0x32ab47;return db[_0xac33('0x2f')][_0xac33('0x4c')]({'where':{'id':_0x5ce1d5[_0xac33('0x43')]['id']}})[_0xac33('0x28')](handleEntityNotFound(_0x4643ca,null))[_0xac33('0x28')](function(_0x137fd2){if(_0x137fd2){_0x1164f6=_0x137fd2;_0x529da6[_0xac33('0x36')]=_['keys'](db[_0xac33('0x4d')]['rawAttributes']);_0x529da6[_0xac33('0x33')]=_[_0xac33('0x44')](_0x5ce1d5[_0xac33('0x33')]);_0x529da6[_0xac33('0x34')]=_['intersection'](_0x529da6[_0xac33('0x36')],_0x529da6[_0xac33('0x33')]);_0xabe7a6[_0xac33('0x37')]=_[_0xac33('0x35')](_0x529da6[_0xac33('0x36')],qs[_0xac33('0x38')](_0x5ce1d5['query']['fields']));_0xabe7a6[_0xac33('0x37')]=_0xabe7a6[_0xac33('0x37')][_0xac33('0x39')]?_0xabe7a6[_0xac33('0x37')]:_0x529da6[_0xac33('0x36')];_0xabe7a6['order']=qs['sort'](_0x5ce1d5['query'][_0xac33('0x3c')]);_0xabe7a6['where']=qs[_0xac33('0x34')](_[_0xac33('0x4e')](_0x5ce1d5['query'],_0x529da6[_0xac33('0x34')]));if(_0x5ce1d5[_0xac33('0x33')][_0xac33('0x3d')]){_0xabe7a6[_0xac33('0x3e')]=_[_0xac33('0x3f')](_0xabe7a6[_0xac33('0x3e')],{'$or':_[_0xac33('0x2e')](_0xabe7a6[_0xac33('0x37')],function(_0x5c0d6a){var _0xf367cc={};_0xf367cc[_0x5c0d6a]={'$like':'%'+_0x5ce1d5['query'][_0xac33('0x3d')]+'%'};return _0xf367cc;})});}_0xabe7a6=_[_0xac33('0x3f')]({},_0xabe7a6,_0x5ce1d5[_0xac33('0x40')]);return _0x1164f6[_0xac33('0x4b')](_0xabe7a6);}})[_0xac33('0x28')](function(_0x6ae2e6){if(_0x6ae2e6){_0x32ab47=_0x6ae2e6[_0xac33('0x39')];if(!_0x5ce1d5['query']['hasOwnProperty'](_0xac33('0x3b'))){_0xabe7a6[_0xac33('0x20')]=qs[_0xac33('0x20')](_0x5ce1d5[_0xac33('0x33')]['limit']);_0xabe7a6['offset']=qs['offset'](_0x5ce1d5[_0xac33('0x33')][_0xac33('0x1e')]);}return _0x1164f6[_0xac33('0x4b')](_0xabe7a6);}})[_0xac33('0x28')](function(_0x168c4d){if(_0x168c4d){return _0x168c4d?{'count':_0x32ab47,'rows':_0x168c4d}:null;}})[_0xac33('0x28')](respondWithResult(_0x4643ca,null))['catch'](handleError(_0x4643ca,null));};exports[_0xac33('0x4f')]=function(_0x2e8c82,_0x1905b8,_0x3def47){if(_0x2e8c82[_0xac33('0x49')]['id']){delete _0x2e8c82[_0xac33('0x49')]['id'];}return db[_0xac33('0x2f')][_0xac33('0x4c')]({'where':{'id':_0x2e8c82[_0xac33('0x43')]['id']}})[_0xac33('0x28')](handleEntityNotFound(_0x1905b8,null))[_0xac33('0x28')](function(_0x30a535){if(_0x30a535){_0x2e8c82[_0xac33('0x49')][_0xac33('0x50')]=_0x30a535['id'];_0x2e8c82[_0xac33('0x49')][_0xac33('0x51')]=integrations[_0xac33('0x52')](_0x2e8c82[_0xac33('0x49')][_0xac33('0x53')],_0x2e8c82['body'][_0xac33('0x31')]);_0x2e8c82['body'][_0xac33('0x54')]=integrations['getDescriptions'](_0x2e8c82['body'][_0xac33('0x53')],_0x2e8c82['body'][_0xac33('0x31')]);return db[_0xac33('0x4d')]['create'](_0x2e8c82[_0xac33('0x49')],{'include':[{'model':db[_0xac33('0x55')],'as':_0xac33('0x51')},{'model':db[_0xac33('0x55')],'as':'Descriptions'}]});}return null;})[_0xac33('0x28')](respondWithResult(_0x1905b8,null))['catch'](handleError(_0x1905b8,null));};exports[_0xac33('0x56')]=function(_0x14d306,_0x29bb74,_0x60dd0e){var _0x3c9eff='';var _0x514cd0=['id','name',_0xac33('0x57'),_0xac33('0x58'),_0xac33('0x59'),'date_start',_0xac33('0x5a'),'duration_minutes','parent_id',_0xac33('0x5b'),_0xac33('0x5c'),_0xac33('0x5d')];return db[_0xac33('0x2f')][_0xac33('0x4c')]({'where':{'id':_0x14d306['params']['id']},'attributes':['id',_0xac33('0x5e'),'password','remoteUri']})[_0xac33('0x28')](handleEntityNotFound(_0x29bb74,null))[_0xac33('0x28')](function(_0x5c28c0){if(_0x5c28c0){_0x3c9eff=_0x5c28c0[_0xac33('0x5f')];var _0x523022=_0x3c9eff[_0xac33('0x60')](-0x1);if(_0x523022==='/'){_0x3c9eff=_0x3c9eff[_0xac33('0x61')](0x0,_0x3c9eff[_0xac33('0x62')](_0x523022));}return rp({'method':_0xac33('0x63'),'uri':util['format'](_0xac33('0x64'),_0x3c9eff,_0xac33('0x65')),'json':!![],'form':{'method':_0xac33('0x66'),'input_type':_0xac33('0x67'),'response_type':_0xac33('0x67'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5c28c0[_0xac33('0x5e')],'password':_0x5c28c0['password'],'encryption':_0xac33('0x68')},'application':_0xac33('0x69')})}});}})[_0xac33('0x28')](function(_0x330673){if(_0x330673&&_0x330673[_0xac33('0x2c')]!==_0xac33('0x6a')&&_0x330673[_0xac33('0x2c')]!==_0xac33('0x6b')){return rp({'method':_0xac33('0x63'),'uri':util[_0xac33('0x6c')](_0xac33('0x64'),_0x3c9eff,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0xac33('0x67'),'rest_data':JSON[_0xac33('0x6d')]({'session':_0x330673['id'],'module_name':'Calls'})}})[_0xac33('0x28')](function(_0x4f7cb4){if(_0x4f7cb4){var _0x234dff=_[_0xac33('0x6e')](_0x4f7cb4[_0xac33('0x6f')]);_[_0xac33('0x70')](_0x234dff,function(_0x4ae62f){return _0x514cd0[_0xac33('0x71')](_0x4ae62f[_0xac33('0x2c')]);});return{'count':_0x234dff[_0xac33('0x39')],'rows':_[_0xac33('0x2e')](_0x234dff,function(_0x5342c0){return{'id':_0x5342c0[_0xac33('0x2c')],'name':_0x5342c0[_0xac33('0x72')],'custom':_[_0xac33('0x73')](_0x5342c0[_0xac33('0x2c')],'_c')?!![]:![],'options':_0x5342c0[_0xac33('0x40')]?_[_0xac33('0x2e')](_[_0xac33('0x6e')](_0x5342c0['options']),function(_0x273721){return{'name':_0x273721[_0xac33('0x74')],'value':_0x273721[_0xac33('0x2c')]};}):[]};})};}})['then'](respondWithResult(_0x29bb74,null))[_0xac33('0x48')](function(_0x14fa47){var _0x3943bb=_0x14d306['query'][_0xac33('0x75')]?0x1f4:_0x14fa47['statusCode']||0x1f4;logger[_0xac33('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xac33('0x56'),_0x3943bb,JSON[_0xac33('0x6d')](_0x14fa47));delete _0x14fa47['name'];if(_0x3943bb===0x191){_0x3943bb=0x190;}_0x29bb74[_0xac33('0x1c')](_0x3943bb)[_0xac33('0x76')](_0x14d306[_0xac33('0x33')]['test']?{'message':_0xac33('0x77'),'statusCode':_0x14fa47[_0xac33('0x78')]}:_0x14fa47);});}else{var _0x1b3aa5=0x1f4;_0x29bb74[_0xac33('0x1c')](_0x1b3aa5)['send']({'message':_0xac33('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x0524=['body','find','params','getConfigurations','findOne','SugarcrmConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','format','%s%s','login','JSON','stringify','PLAIN','Invalid\x20Login','POST','Calls','values','module_fields','remove','label','endsWith','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','offset','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','name','send','index','map','SugarcrmAccount','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','options','create'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x0524,0xa3));var _0x4052=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x0524[_0x146a85];return _0x1b59bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4052('0x0'));var zipdir=require(_0x4052('0x1'));var jsonpatch=require(_0x4052('0x2'));var rp=require(_0x4052('0x3'));var moment=require(_0x4052('0x4'));var BPromise=require(_0x4052('0x5'));var Mustache=require(_0x4052('0x6'));var util=require('util');var path=require(_0x4052('0x7'));var sox=require(_0x4052('0x8'));var csv=require(_0x4052('0x9'));var ejs=require(_0x4052('0xa'));var fs=require('fs');var fs_extra=require(_0x4052('0xb'));var _=require(_0x4052('0xc'));var squel=require(_0x4052('0xd'));var crypto=require(_0x4052('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4052('0xf'));var qs=require(_0x4052('0x10'));var as=require(_0x4052('0x11'));var hardwareService=require(_0x4052('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x4052('0x13'));var config=require(_0x4052('0x14'));var licenseUtil=require(_0x4052('0x15'));var db=require(_0x4052('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x166f05,_0x2927fa){_0x2927fa=_0x2927fa||0xcc;return function(_0x5f1d9f){if(_0x5f1d9f){return _0x166f05[_0x4052('0x17')](_0x2927fa);}return _0x166f05[_0x4052('0x18')](_0x2927fa)['end']();};}function respondWithResult(_0x5a648c,_0x50b074){_0x50b074=_0x50b074||0xc8;return function(_0x5cc9d6){if(_0x5cc9d6){return _0x5a648c[_0x4052('0x18')](_0x50b074)['json'](_0x5cc9d6);}};}function respondWithFilteredResult(_0x8ac78d,_0x4cde77){return function(_0x2d61a2){if(_0x2d61a2){var _0x571ef0=typeof _0x4cde77['offset']==='undefined'&&typeof _0x4cde77[_0x4052('0x19')]===_0x4052('0x1a');var _0x11ceb6=_0x2d61a2['count'];var _0x86b7ef=_0x571ef0?0x0:_0x4cde77[_0x4052('0x1b')];var _0x1fec6f=_0x571ef0?_0x2d61a2[_0x4052('0x1c')]:_0x4cde77[_0x4052('0x1b')]+_0x4cde77[_0x4052('0x19')];var _0x59c544;if(_0x1fec6f>=_0x11ceb6){_0x1fec6f=_0x11ceb6;_0x59c544=0xc8;}else{_0x59c544=0xce;}_0x8ac78d[_0x4052('0x18')](_0x59c544);return _0x8ac78d[_0x4052('0x1d')](_0x4052('0x1e'),_0x86b7ef+'-'+_0x1fec6f+'/'+_0x11ceb6)[_0x4052('0x1f')](_0x2d61a2);}return null;};}function patchUpdates(_0x3829d5){return function(_0x44a765){try{jsonpatch[_0x4052('0x20')](_0x44a765,_0x3829d5,!![]);}catch(_0x44c4ef){return BPromise[_0x4052('0x21')](_0x44c4ef);}return _0x44a765['save']();};}function saveUpdates(_0x389b29,_0x53c5d7){return function(_0xf8fe61){if(_0xf8fe61){return _0xf8fe61[_0x4052('0x22')](_0x389b29)[_0x4052('0x23')](function(_0x32f5ae){return _0x32f5ae;});}return null;};}function removeEntity(_0x2bb3b5,_0x546a90){return function(_0x5dea6c){if(_0x5dea6c){return _0x5dea6c[_0x4052('0x24')]()[_0x4052('0x23')](function(){_0x2bb3b5[_0x4052('0x18')](0xcc)[_0x4052('0x25')]();});}};}function handleEntityNotFound(_0x4725b1,_0x5ab0c3){return function(_0x45fd4d){if(!_0x45fd4d){_0x4725b1[_0x4052('0x17')](0x194);}return _0x45fd4d;};}function handleError(_0x784903,_0x128dff){_0x128dff=_0x128dff||0x1f4;return function(_0x5a78b9){logger[_0x4052('0x26')](_0x5a78b9['stack']);if(_0x5a78b9[_0x4052('0x27')]){delete _0x5a78b9[_0x4052('0x27')];}_0x784903[_0x4052('0x18')](_0x128dff)[_0x4052('0x28')](_0x5a78b9);};}exports[_0x4052('0x29')]=function(_0x33331a,_0x3646e0){var _0x194353={},_0x3c60e4={},_0x422ca4={'count':0x0,'rows':[]};var _0x4a7cca=_[_0x4052('0x2a')](db[_0x4052('0x2b')][_0x4052('0x2c')],function(_0xe404ef){return{'name':_0xe404ef['fieldName'],'type':_0xe404ef[_0x4052('0x2d')][_0x4052('0x2e')]};});_0x3c60e4['model']=_[_0x4052('0x2a')](_0x4a7cca,_0x4052('0x27'));_0x3c60e4[_0x4052('0x2f')]=_[_0x4052('0x30')](_0x33331a[_0x4052('0x2f')]);_0x3c60e4[_0x4052('0x31')]=_[_0x4052('0x32')](_0x3c60e4['model'],_0x3c60e4[_0x4052('0x2f')]);_0x194353[_0x4052('0x33')]=_[_0x4052('0x32')](_0x3c60e4[_0x4052('0x34')],qs[_0x4052('0x35')](_0x33331a[_0x4052('0x2f')][_0x4052('0x35')]));_0x194353[_0x4052('0x33')]=_0x194353[_0x4052('0x33')][_0x4052('0x36')]?_0x194353['attributes']:_0x3c60e4[_0x4052('0x34')];if(!_0x33331a['query']['hasOwnProperty'](_0x4052('0x37'))){_0x194353[_0x4052('0x19')]=qs[_0x4052('0x19')](_0x33331a[_0x4052('0x2f')][_0x4052('0x19')]);_0x194353[_0x4052('0x1b')]=qs[_0x4052('0x1b')](_0x33331a['query'][_0x4052('0x1b')]);}_0x194353['order']=qs[_0x4052('0x38')](_0x33331a['query'][_0x4052('0x38')]);_0x194353[_0x4052('0x39')]=qs[_0x4052('0x31')](_[_0x4052('0x3a')](_0x33331a[_0x4052('0x2f')],_0x3c60e4[_0x4052('0x31')]),_0x4a7cca);if(_0x33331a[_0x4052('0x2f')][_0x4052('0x3b')]){_0x194353['where']=_[_0x4052('0x3c')](_0x194353[_0x4052('0x39')],{'$or':_['map'](_0x4a7cca,function(_0x2b58c6){if(_0x2b58c6[_0x4052('0x2d')]!==_0x4052('0x3d')){var _0x5d068d={};_0x5d068d[_0x2b58c6[_0x4052('0x27')]]={'$like':'%'+_0x33331a['query'][_0x4052('0x3b')]+'%'};return _0x5d068d;}})});}_0x194353=_[_0x4052('0x3c')]({},_0x194353,_0x33331a['options']);var _0x2be3e4={'where':_0x194353['where']};return db[_0x4052('0x2b')]['count'](_0x2be3e4)['then'](function(_0x4c35c3){_0x422ca4[_0x4052('0x1c')]=_0x4c35c3;if(_0x33331a[_0x4052('0x2f')][_0x4052('0x3e')]){_0x194353[_0x4052('0x3f')]=[{'all':!![]}];}return db[_0x4052('0x2b')][_0x4052('0x40')](_0x194353);})[_0x4052('0x23')](function(_0x3671fd){_0x422ca4[_0x4052('0x41')]=_0x3671fd;return _0x422ca4;})[_0x4052('0x23')](respondWithFilteredResult(_0x3646e0,_0x194353))[_0x4052('0x42')](handleError(_0x3646e0,null));};exports['show']=function(_0x39d307,_0x62c6de){var _0x386b5b={'raw':![],'where':{'id':_0x39d307['params']['id']}},_0x3c7a31={};_0x3c7a31[_0x4052('0x34')]=_[_0x4052('0x30')](db[_0x4052('0x2b')][_0x4052('0x2c')]);_0x3c7a31['query']=_[_0x4052('0x30')](_0x39d307[_0x4052('0x2f')]);_0x3c7a31[_0x4052('0x31')]=_['intersection'](_0x3c7a31['model'],_0x3c7a31[_0x4052('0x2f')]);_0x386b5b[_0x4052('0x33')]=_[_0x4052('0x32')](_0x3c7a31['model'],qs[_0x4052('0x35')](_0x39d307[_0x4052('0x2f')][_0x4052('0x35')]));_0x386b5b[_0x4052('0x33')]=_0x386b5b[_0x4052('0x33')]['length']?_0x386b5b['attributes']:_0x3c7a31[_0x4052('0x34')];if(_0x39d307['query'][_0x4052('0x3e')]){_0x386b5b['include']=[{'all':!![]}];}_0x386b5b=_['merge']({},_0x386b5b,_0x39d307[_0x4052('0x43')]);return db[_0x4052('0x2b')]['find'](_0x386b5b)['then'](handleEntityNotFound(_0x62c6de,null))[_0x4052('0x23')](respondWithResult(_0x62c6de,null))[_0x4052('0x42')](handleError(_0x62c6de,null));};exports[_0x4052('0x44')]=function(_0x441c61,_0x4fda9b){return db[_0x4052('0x2b')][_0x4052('0x44')](_0x441c61['body'],{})[_0x4052('0x23')](respondWithResult(_0x4fda9b,0xc9))['catch'](handleError(_0x4fda9b,null));};exports[_0x4052('0x22')]=function(_0x154345,_0x42a2f1){if(_0x154345[_0x4052('0x45')]['id']){delete _0x154345[_0x4052('0x45')]['id'];}return db[_0x4052('0x2b')][_0x4052('0x46')]({'where':{'id':_0x154345[_0x4052('0x47')]['id']}})[_0x4052('0x23')](handleEntityNotFound(_0x42a2f1,null))['then'](saveUpdates(_0x154345['body'],null))[_0x4052('0x23')](respondWithResult(_0x42a2f1,null))[_0x4052('0x42')](handleError(_0x42a2f1,null));};exports['destroy']=function(_0x112730,_0x21a0eb){return db[_0x4052('0x2b')]['find']({'where':{'id':_0x112730[_0x4052('0x47')]['id']}})['then'](handleEntityNotFound(_0x21a0eb,null))[_0x4052('0x23')](removeEntity(_0x21a0eb,null))['catch'](handleError(_0x21a0eb,null));};exports[_0x4052('0x48')]=function(_0x3715fe,_0x4bf2e4,_0xf24a45){var _0x3b29e4={};var _0x1ac6bd={};var _0x5b5c80;var _0x391755;return db['SugarcrmAccount'][_0x4052('0x49')]({'where':{'id':_0x3715fe[_0x4052('0x47')]['id']}})[_0x4052('0x23')](handleEntityNotFound(_0x4bf2e4,null))[_0x4052('0x23')](function(_0x529d85){if(_0x529d85){_0x5b5c80=_0x529d85;_0x1ac6bd[_0x4052('0x34')]=_[_0x4052('0x30')](db[_0x4052('0x4a')]['rawAttributes']);_0x1ac6bd['query']=_[_0x4052('0x30')](_0x3715fe[_0x4052('0x2f')]);_0x1ac6bd[_0x4052('0x31')]=_[_0x4052('0x32')](_0x1ac6bd[_0x4052('0x34')],_0x1ac6bd[_0x4052('0x2f')]);_0x3b29e4[_0x4052('0x33')]=_[_0x4052('0x32')](_0x1ac6bd[_0x4052('0x34')],qs[_0x4052('0x35')](_0x3715fe[_0x4052('0x2f')][_0x4052('0x35')]));_0x3b29e4[_0x4052('0x33')]=_0x3b29e4[_0x4052('0x33')]['length']?_0x3b29e4['attributes']:_0x1ac6bd[_0x4052('0x34')];_0x3b29e4[_0x4052('0x4b')]=qs[_0x4052('0x38')](_0x3715fe[_0x4052('0x2f')][_0x4052('0x38')]);_0x3b29e4[_0x4052('0x39')]=qs[_0x4052('0x31')](_[_0x4052('0x3a')](_0x3715fe[_0x4052('0x2f')],_0x1ac6bd['filters']));if(_0x3715fe[_0x4052('0x2f')][_0x4052('0x3b')]){_0x3b29e4[_0x4052('0x39')]=_['merge'](_0x3b29e4[_0x4052('0x39')],{'$or':_[_0x4052('0x2a')](_0x3b29e4[_0x4052('0x33')],function(_0x3cc93f){var _0x230f0c={};_0x230f0c[_0x3cc93f]={'$like':'%'+_0x3715fe[_0x4052('0x2f')][_0x4052('0x3b')]+'%'};return _0x230f0c;})});}_0x3b29e4=_['merge']({},_0x3b29e4,_0x3715fe[_0x4052('0x43')]);return _0x5b5c80[_0x4052('0x48')](_0x3b29e4);}})[_0x4052('0x23')](function(_0x3d3588){if(_0x3d3588){_0x391755=_0x3d3588[_0x4052('0x36')];if(!_0x3715fe[_0x4052('0x2f')][_0x4052('0x4c')](_0x4052('0x37'))){_0x3b29e4[_0x4052('0x19')]=qs['limit'](_0x3715fe[_0x4052('0x2f')][_0x4052('0x19')]);_0x3b29e4[_0x4052('0x1b')]=qs['offset'](_0x3715fe[_0x4052('0x2f')][_0x4052('0x1b')]);}return _0x5b5c80['getConfigurations'](_0x3b29e4);}})[_0x4052('0x23')](function(_0x5e9f53){if(_0x5e9f53){return _0x5e9f53?{'count':_0x391755,'rows':_0x5e9f53}:null;}})[_0x4052('0x23')](respondWithResult(_0x4bf2e4,null))[_0x4052('0x42')](handleError(_0x4bf2e4,null));};exports[_0x4052('0x4d')]=function(_0x3ce041,_0x5af14b,_0x2d748f){if(_0x3ce041['body']['id']){delete _0x3ce041[_0x4052('0x45')]['id'];}return db['SugarcrmAccount'][_0x4052('0x49')]({'where':{'id':_0x3ce041[_0x4052('0x47')]['id']}})['then'](handleEntityNotFound(_0x5af14b,null))[_0x4052('0x23')](function(_0x5f2616){if(_0x5f2616){_0x3ce041['body'][_0x4052('0x4e')]=_0x5f2616['id'];_0x3ce041[_0x4052('0x45')][_0x4052('0x4f')]=integrations[_0x4052('0x50')](_0x3ce041[_0x4052('0x45')][_0x4052('0x51')],_0x3ce041['body'][_0x4052('0x2d')]);_0x3ce041['body']['Descriptions']=integrations['getDescriptions'](_0x3ce041[_0x4052('0x45')][_0x4052('0x51')],_0x3ce041[_0x4052('0x45')][_0x4052('0x2d')]);return db['SugarcrmConfiguration'][_0x4052('0x44')](_0x3ce041['body'],{'include':[{'model':db[_0x4052('0x52')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0x4052('0x53')}]});}return null;})[_0x4052('0x23')](respondWithResult(_0x5af14b,null))[_0x4052('0x42')](handleError(_0x5af14b,null));};exports[_0x4052('0x54')]=function(_0x40e9d7,_0xec5ab5,_0x17f7f6){var _0x27354a='';var _0x32a3ca=['id',_0x4052('0x27'),_0x4052('0x55'),_0x4052('0x56'),_0x4052('0x57'),_0x4052('0x58'),_0x4052('0x59'),_0x4052('0x5a'),_0x4052('0x5b'),'parent_type',_0x4052('0x5c'),_0x4052('0x5d')];return db['SugarcrmAccount'][_0x4052('0x49')]({'where':{'id':_0x40e9d7[_0x4052('0x47')]['id']},'attributes':['id',_0x4052('0x5e'),_0x4052('0x5f'),_0x4052('0x60')]})[_0x4052('0x23')](handleEntityNotFound(_0xec5ab5,null))[_0x4052('0x23')](function(_0x1ea8c1){if(_0x1ea8c1){_0x27354a=_0x1ea8c1[_0x4052('0x60')];var _0x407e2c=_0x27354a['slice'](-0x1);if(_0x407e2c==='/'){_0x27354a=_0x27354a[_0x4052('0x61')](0x0,_0x27354a[_0x4052('0x62')](_0x407e2c));}return rp({'method':'POST','uri':util[_0x4052('0x63')](_0x4052('0x64'),_0x27354a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x4052('0x65'),'input_type':_0x4052('0x66'),'response_type':'JSON','rest_data':JSON[_0x4052('0x67')]({'user_auth':{'user_name':_0x1ea8c1[_0x4052('0x5e')],'password':_0x1ea8c1[_0x4052('0x5f')],'encryption':_0x4052('0x68')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x431fca){if(_0x431fca&&_0x431fca[_0x4052('0x27')]!==_0x4052('0x69')&&_0x431fca['name']!=='Password\x20Expired'){return rp({'method':_0x4052('0x6a'),'uri':util[_0x4052('0x63')](_0x4052('0x64'),_0x27354a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x4052('0x66'),'rest_data':JSON[_0x4052('0x67')]({'session':_0x431fca['id'],'module_name':_0x4052('0x6b')})}})[_0x4052('0x23')](function(_0xcd1a7a){if(_0xcd1a7a){var _0x16e4bf=_[_0x4052('0x6c')](_0xcd1a7a[_0x4052('0x6d')]);_[_0x4052('0x6e')](_0x16e4bf,function(_0x212473){return _0x32a3ca['includes'](_0x212473['name']);});return{'count':_0x16e4bf['length'],'rows':_['map'](_0x16e4bf,function(_0x1e7c9d){return{'id':_0x1e7c9d['name'],'name':_0x1e7c9d[_0x4052('0x6f')],'custom':_[_0x4052('0x70')](_0x1e7c9d[_0x4052('0x27')],'_c')?!![]:![],'options':_0x1e7c9d[_0x4052('0x43')]?_[_0x4052('0x2a')](_['values'](_0x1e7c9d[_0x4052('0x43')]),function(_0x36a19d){return{'name':_0x36a19d['value'],'value':_0x36a19d['name']};}):[]};})};}})[_0x4052('0x23')](respondWithResult(_0xec5ab5,null))['catch'](function(_0x3f4a9d){var _0x9b7975=_0x40e9d7[_0x4052('0x2f')][_0x4052('0x71')]?0x1f4:_0x3f4a9d['statusCode']||0x1f4;logger['error'](_0x4052('0x72'),_0x4052('0x54'),_0x9b7975,JSON[_0x4052('0x67')](_0x3f4a9d));delete _0x3f4a9d[_0x4052('0x27')];if(_0x9b7975===0x191){_0x9b7975=0x190;}_0xec5ab5[_0x4052('0x18')](_0x9b7975)[_0x4052('0x28')](_0x40e9d7[_0x4052('0x2f')][_0x4052('0x71')]?{'message':_0x4052('0x73'),'statusCode':_0x3f4a9d['statusCode']}:_0x3f4a9d);});}else{var _0x21c166=0x1f4;_0xec5ab5[_0x4052('0x18')](_0x21c166)[_0x4052('0x28')]({'message':_0x4052('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 32aaa7b..4dcb8a6 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 _0xb1a6=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb1a6,0x143));var _0x6b1a=function(_0xb9ce54,_0x4a6f6c){_0xb9ce54=_0xb9ce54-0x0;var _0x57eb3b=_0xb1a6[_0xb9ce54];return _0x57eb3b;};'use strict';var _=require(_0x6b1a('0x0'));var util=require(_0x6b1a('0x1'));var logger=require(_0x6b1a('0x2'))('api');var moment=require(_0x6b1a('0x3'));var BPromise=require(_0x6b1a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b1a('0x5'));var rimraf=require(_0x6b1a('0x6'));var config=require(_0x6b1a('0x7'));var attributes=require(_0x6b1a('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x6b1a('0x9')]=function(_0x8b9422,_0x2a7d43){return _0x8b9422['define'](_0x6b1a('0xa'),attributes,{'tableName':_0x6b1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdadc=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdadc,0x75));var _0xcdad=function(_0x357c38,_0x11ef6){_0x357c38=_0x357c38-0x0;var _0x5ef17e=_0xdadc[_0x357c38];return _0x5ef17e;};'use strict';var _=require(_0xcdad('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcdad('0x1'));var moment=require(_0xcdad('0x2'));var BPromise=require(_0xcdad('0x3'));var rp=require(_0xcdad('0x4'));var fs=require('fs');var path=require(_0xcdad('0x5'));var rimraf=require(_0xcdad('0x6'));var config=require(_0xcdad('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xcdad('0x8'));module[_0xcdad('0x9')]=function(_0x84e574,_0x595c95){return _0x84e574['define'](_0xcdad('0xa'),attributes,{'tableName':_0xcdad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 8378565..9982cb0 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 _0x50f8=['findAll','options','raw','where','limit','include','model','attributes','catch','find','map','ShowSugarcrmAccount','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetSugarcrmAccount'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x50f8,0x13e));var _0x850f=function(_0x544550,_0x2fcf12){_0x544550=_0x544550-0x0;var _0x534ab4=_0x50f8[_0x544550];return _0x534ab4;};'use strict';var _=require(_0x850f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x850f('0x1'));var rs=require(_0x850f('0x2'));var fs=require('fs');var Redis=require(_0x850f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x850f('0x4'));var logger=require(_0x850f('0x5'))(_0x850f('0x6'));var config=require('../../config/environment');var jayson=require(_0x850f('0x7'));var client=jayson[_0x850f('0x8')][_0x850f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35f152,_0x3954ac,_0x43afe7){return new BPromise(function(_0xd7137a,_0x119707){return client[_0x850f('0xa')](_0x35f152,_0x43afe7)[_0x850f('0xb')](function(_0x58cc6c){logger[_0x850f('0xc')](_0x850f('0xd'),_0x3954ac,_0x850f('0xe'));logger[_0x850f('0xf')](_0x850f('0x10'),_0x3954ac,_0x850f('0xe'),JSON[_0x850f('0x11')](_0x58cc6c));if(_0x58cc6c[_0x850f('0x12')]){if(_0x58cc6c[_0x850f('0x12')][_0x850f('0x13')]===0x1f4){logger[_0x850f('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x3954ac,_0x58cc6c[_0x850f('0x12')][_0x850f('0x14')]);return _0x119707(_0x58cc6c['error'][_0x850f('0x14')]);}logger[_0x850f('0x12')](_0x850f('0xd'),_0x3954ac,_0x58cc6c[_0x850f('0x12')][_0x850f('0x14')]);return _0xd7137a(_0x58cc6c[_0x850f('0x12')][_0x850f('0x14')]);}else{logger[_0x850f('0xc')](_0x850f('0xd'),_0x3954ac,_0x850f('0xe'));_0xd7137a(_0x58cc6c['result'][_0x850f('0x14')]);}})['catch'](function(_0x4e3077){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x3954ac,_0x4e3077);_0x119707(_0x4e3077);});});}exports[_0x850f('0x15')]=function(_0x54bb91){var _0x757e6e=this;return new Promise(function(_0x1e78b0,_0x2eaeb6){return db['SugarcrmAccount'][_0x850f('0x16')]({'raw':_0x54bb91[_0x850f('0x17')]?_0x54bb91['options'][_0x850f('0x18')]===undefined?!![]:![]:!![],'where':_0x54bb91[_0x850f('0x17')]?_0x54bb91[_0x850f('0x17')][_0x850f('0x19')]||null:null,'attributes':_0x54bb91[_0x850f('0x17')]?_0x54bb91[_0x850f('0x17')]['attributes']||null:null,'limit':_0x54bb91['options']?_0x54bb91['options'][_0x850f('0x1a')]||null:null,'include':_0x54bb91[_0x850f('0x17')]?_0x54bb91[_0x850f('0x17')]['include']?_['map'](_0x54bb91[_0x850f('0x17')][_0x850f('0x1b')],function(_0x5a865b){return{'model':db[_0x5a865b[_0x850f('0x1c')]],'as':_0x5a865b['as'],'attributes':_0x5a865b['attributes'],'include':_0x5a865b[_0x850f('0x1b')]?_['map'](_0x5a865b['include'],function(_0x304c45){return{'model':db[_0x304c45[_0x850f('0x1c')]],'as':_0x304c45['as'],'attributes':_0x304c45[_0x850f('0x1d')],'include':_0x304c45[_0x850f('0x1b')]?_['map'](_0x304c45[_0x850f('0x1b')],function(_0x2067d4){return{'model':db[_0x2067d4[_0x850f('0x1c')]],'as':_0x2067d4['as'],'attributes':_0x2067d4[_0x850f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x850f('0xb')](function(_0x1ec58c){logger['info'](_0x850f('0x15'),_0x54bb91);logger[_0x850f('0xf')](_0x850f('0x15'),_0x54bb91,JSON[_0x850f('0x11')](_0x1ec58c));_0x1e78b0(_0x1ec58c);})[_0x850f('0x1e')](function(_0xb36645){logger[_0x850f('0x12')](_0x850f('0x15'),_0xb36645[_0x850f('0x14')],_0x54bb91);_0x2eaeb6(_0x757e6e['error'](0x1f4,_0xb36645[_0x850f('0x14')]));});});};exports['ShowSugarcrmAccount']=function(_0x360207){var _0x419e02=this;return new Promise(function(_0xf6d7fe,_0x564ea8){return db['SugarcrmAccount'][_0x850f('0x1f')]({'raw':_0x360207[_0x850f('0x17')]?_0x360207[_0x850f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x360207[_0x850f('0x17')]?_0x360207[_0x850f('0x17')][_0x850f('0x19')]||null:null,'attributes':_0x360207['options']?_0x360207['options'][_0x850f('0x1d')]||null:null,'include':_0x360207[_0x850f('0x17')]?_0x360207[_0x850f('0x17')]['include']?_[_0x850f('0x20')](_0x360207[_0x850f('0x17')][_0x850f('0x1b')],function(_0x43f9f0){return{'model':db[_0x43f9f0['model']],'as':_0x43f9f0['as'],'attributes':_0x43f9f0[_0x850f('0x1d')],'include':_0x43f9f0[_0x850f('0x1b')]?_[_0x850f('0x20')](_0x43f9f0[_0x850f('0x1b')],function(_0x155c0f){return{'model':db[_0x155c0f[_0x850f('0x1c')]],'as':_0x155c0f['as'],'attributes':_0x155c0f[_0x850f('0x1d')],'include':_0x155c0f[_0x850f('0x1b')]?_['map'](_0x155c0f[_0x850f('0x1b')],function(_0x138f4b){return{'model':db[_0x138f4b[_0x850f('0x1c')]],'as':_0x138f4b['as'],'attributes':_0x138f4b[_0x850f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x850f('0xb')](function(_0x2857da){logger[_0x850f('0xc')]('ShowSugarcrmAccount',_0x360207);logger[_0x850f('0xf')](_0x850f('0x21'),_0x360207,JSON[_0x850f('0x11')](_0x2857da));_0xf6d7fe(_0x2857da);})[_0x850f('0x1e')](function(_0x8c2354){logger[_0x850f('0x12')](_0x850f('0x21'),_0x8c2354[_0x850f('0x14')],_0x360207);_0x564ea8(_0x419e02[_0x850f('0x12')](0x1f4,_0x8c2354[_0x850f('0x14')]));});});}; \ No newline at end of file +var _0x32c5=['request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','model','map','catch','ShowSugarcrmAccount','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http'];(function(_0x482a12,_0x38e1d2){var _0xcd464e=function(_0x4c82c9){while(--_0x4c82c9){_0x482a12['push'](_0x482a12['shift']());}};_0xcd464e(++_0x38e1d2);}(_0x32c5,0x1e7));var _0x532c=function(_0x448bbb,_0x180ab4){_0x448bbb=_0x448bbb-0x0;var _0x43d731=_0x32c5[_0x448bbb];return _0x43d731;};'use strict';var _=require('lodash');var util=require(_0x532c('0x0'));var moment=require('moment');var BPromise=require(_0x532c('0x1'));var rs=require(_0x532c('0x2'));var fs=require('fs');var Redis=require(_0x532c('0x3'));var db=require(_0x532c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x532c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x532c('0x6')][_0x532c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21cf26,_0x3075df,_0x1b47cd){return new BPromise(function(_0x3eac1c,_0x216a36){return client[_0x532c('0x8')](_0x21cf26,_0x1b47cd)[_0x532c('0x9')](function(_0x14f29c){logger[_0x532c('0xa')](_0x532c('0xb'),_0x3075df,'request\x20sent');logger[_0x532c('0xc')](_0x532c('0xd'),_0x3075df,_0x532c('0xe'),JSON[_0x532c('0xf')](_0x14f29c));if(_0x14f29c['error']){if(_0x14f29c[_0x532c('0x10')][_0x532c('0x11')]===0x1f4){logger[_0x532c('0x10')](_0x532c('0xb'),_0x3075df,_0x14f29c[_0x532c('0x10')][_0x532c('0x12')]);return _0x216a36(_0x14f29c[_0x532c('0x10')]['message']);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x3075df,_0x14f29c[_0x532c('0x10')][_0x532c('0x12')]);return _0x3eac1c(_0x14f29c[_0x532c('0x10')][_0x532c('0x12')]);}else{logger[_0x532c('0xa')](_0x532c('0xb'),_0x3075df,_0x532c('0xe'));_0x3eac1c(_0x14f29c[_0x532c('0x13')][_0x532c('0x12')]);}})['catch'](function(_0x5eec0d){logger['error'](_0x532c('0xb'),_0x3075df,_0x5eec0d);_0x216a36(_0x5eec0d);});});}exports[_0x532c('0x14')]=function(_0x4a056d){var _0x54f51d=this;return new Promise(function(_0x57deed,_0x2ea30b){return db[_0x532c('0x15')][_0x532c('0x16')]({'raw':_0x4a056d[_0x532c('0x17')]?_0x4a056d['options'][_0x532c('0x18')]===undefined?!![]:![]:!![],'where':_0x4a056d[_0x532c('0x17')]?_0x4a056d[_0x532c('0x17')]['where']||null:null,'attributes':_0x4a056d[_0x532c('0x17')]?_0x4a056d[_0x532c('0x17')][_0x532c('0x19')]||null:null,'limit':_0x4a056d[_0x532c('0x17')]?_0x4a056d['options'][_0x532c('0x1a')]||null:null,'include':_0x4a056d['options']?_0x4a056d['options']['include']?_['map'](_0x4a056d[_0x532c('0x17')][_0x532c('0x1b')],function(_0x40fb14){return{'model':db[_0x40fb14[_0x532c('0x1c')]],'as':_0x40fb14['as'],'attributes':_0x40fb14['attributes'],'include':_0x40fb14[_0x532c('0x1b')]?_['map'](_0x40fb14[_0x532c('0x1b')],function(_0x404c08){return{'model':db[_0x404c08[_0x532c('0x1c')]],'as':_0x404c08['as'],'attributes':_0x404c08['attributes'],'include':_0x404c08['include']?_[_0x532c('0x1d')](_0x404c08[_0x532c('0x1b')],function(_0x1d4f40){return{'model':db[_0x1d4f40[_0x532c('0x1c')]],'as':_0x1d4f40['as'],'attributes':_0x1d4f40[_0x532c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x532c('0x9')](function(_0x177c7f){logger['info']('GetSugarcrmAccount',_0x4a056d);logger[_0x532c('0xc')](_0x532c('0x14'),_0x4a056d,JSON[_0x532c('0xf')](_0x177c7f));_0x57deed(_0x177c7f);})[_0x532c('0x1e')](function(_0x3cbd28){logger[_0x532c('0x10')]('GetSugarcrmAccount',_0x3cbd28['message'],_0x4a056d);_0x2ea30b(_0x54f51d[_0x532c('0x10')](0x1f4,_0x3cbd28[_0x532c('0x12')]));});});};exports[_0x532c('0x1f')]=function(_0x35dff9){var _0x46734b=this;return new Promise(function(_0x1c0ff2,_0x31dd9b){return db[_0x532c('0x15')]['find']({'raw':_0x35dff9[_0x532c('0x17')]?_0x35dff9['options'][_0x532c('0x18')]===undefined?!![]:![]:!![],'where':_0x35dff9[_0x532c('0x17')]?_0x35dff9[_0x532c('0x17')][_0x532c('0x20')]||null:null,'attributes':_0x35dff9[_0x532c('0x17')]?_0x35dff9[_0x532c('0x17')]['attributes']||null:null,'include':_0x35dff9['options']?_0x35dff9[_0x532c('0x17')][_0x532c('0x1b')]?_[_0x532c('0x1d')](_0x35dff9['options'][_0x532c('0x1b')],function(_0x5f3f4b){return{'model':db[_0x5f3f4b[_0x532c('0x1c')]],'as':_0x5f3f4b['as'],'attributes':_0x5f3f4b[_0x532c('0x19')],'include':_0x5f3f4b[_0x532c('0x1b')]?_[_0x532c('0x1d')](_0x5f3f4b['include'],function(_0x41ce06){return{'model':db[_0x41ce06[_0x532c('0x1c')]],'as':_0x41ce06['as'],'attributes':_0x41ce06[_0x532c('0x19')],'include':_0x41ce06[_0x532c('0x1b')]?_['map'](_0x41ce06['include'],function(_0x51c297){return{'model':db[_0x51c297[_0x532c('0x1c')]],'as':_0x51c297['as'],'attributes':_0x51c297[_0x532c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x532c('0x9')](function(_0x1eb674){logger['info']('ShowSugarcrmAccount',_0x35dff9);logger[_0x532c('0xc')]('ShowSugarcrmAccount',_0x35dff9,JSON[_0x532c('0xf')](_0x1eb674));_0x1c0ff2(_0x1eb674);})['catch'](function(_0x46c016){logger['error'](_0x532c('0x1f'),_0x46c016[_0x532c('0x12')],_0x35dff9);_0x31dd9b(_0x46734b['error'](0x1f4,_0x46c016[_0x532c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 0576be9..77b1837 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 _0x0e83=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post'];(function(_0x3a8d52,_0x55c1c1){var _0x21b57d=function(_0x3f4914){while(--_0x3f4914){_0x3a8d52['push'](_0x3a8d52['shift']());}};_0x21b57d(++_0x55c1c1);}(_0x0e83,0x1f3));var _0x30e8=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x0e83[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0x30e8('0x0'));var util=require(_0x30e8('0x1'));var path=require(_0x30e8('0x2'));var timeout=require(_0x30e8('0x3'));var express=require(_0x30e8('0x4'));var router=express[_0x30e8('0x5')]();var fs_extra=require(_0x30e8('0x6'));var auth=require(_0x30e8('0x7'));var interaction=require(_0x30e8('0x8'));var config=require(_0x30e8('0x9'));var controller=require(_0x30e8('0xa'));router[_0x30e8('0xb')]('/',auth[_0x30e8('0xc')](),controller[_0x30e8('0xd')]);router['get'](_0x30e8('0xe'),auth[_0x30e8('0xc')](),controller[_0x30e8('0xf')]);router[_0x30e8('0xb')](_0x30e8('0x10'),auth[_0x30e8('0xc')](),controller[_0x30e8('0x11')]);router['get'](_0x30e8('0x12'),auth[_0x30e8('0xc')](),controller['getSubjects']);router[_0x30e8('0xb')](_0x30e8('0x13'),auth[_0x30e8('0xc')](),controller['getDescriptions']);router[_0x30e8('0x14')]('/',auth[_0x30e8('0xc')](),controller[_0x30e8('0x15')]);router['put'](_0x30e8('0xe'),auth['isAuthenticated'](),controller[_0x30e8('0x16')]);router[_0x30e8('0x17')](_0x30e8('0xe'),auth[_0x30e8('0xc')](),controller[_0x30e8('0x18')]);module[_0x30e8('0x19')]=router; \ No newline at end of file +var _0x0c9b=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','/:id','delete','destroy','exports'];(function(_0x1b4600,_0x21ef7d){var _0x2b64cf=function(_0x4c8cd6){while(--_0x4c8cd6){_0x1b4600['push'](_0x1b4600['shift']());}};_0x2b64cf(++_0x21ef7d);}(_0x0c9b,0x1e3));var _0xb0c9=function(_0x8220a2,_0x41c4d3){_0x8220a2=_0x8220a2-0x0;var _0x257eea=_0x0c9b[_0x8220a2];return _0x257eea;};'use strict';var multer=require(_0xb0c9('0x0'));var util=require(_0xb0c9('0x1'));var path=require(_0xb0c9('0x2'));var timeout=require(_0xb0c9('0x3'));var express=require(_0xb0c9('0x4'));var router=express[_0xb0c9('0x5')]();var fs_extra=require(_0xb0c9('0x6'));var auth=require(_0xb0c9('0x7'));var interaction=require(_0xb0c9('0x8'));var config=require(_0xb0c9('0x9'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xb0c9('0xa')]('/',auth[_0xb0c9('0xb')](),controller[_0xb0c9('0xc')]);router['get']('/:id',auth[_0xb0c9('0xb')](),controller['show']);router[_0xb0c9('0xa')]('/:id/fields',auth[_0xb0c9('0xb')](),controller[_0xb0c9('0xd')]);router[_0xb0c9('0xa')](_0xb0c9('0xe'),auth[_0xb0c9('0xb')](),controller[_0xb0c9('0xf')]);router[_0xb0c9('0xa')](_0xb0c9('0x10'),auth[_0xb0c9('0xb')](),controller[_0xb0c9('0x11')]);router[_0xb0c9('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xb0c9('0x13'),auth[_0xb0c9('0xb')](),controller['update']);router[_0xb0c9('0x14')](_0xb0c9('0x13'),auth[_0xb0c9('0xb')](),controller[_0xb0c9('0x15')]);module[_0xb0c9('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index acdd3e1..398c377 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 _0xa09d=['sequelize','STRING'];(function(_0x3ff49d,_0x3aff4b){var _0x1947b6=function(_0x5a1994){while(--_0x5a1994){_0x3ff49d['push'](_0x3ff49d['shift']());}};_0x1947b6(++_0x3aff4b);}(_0xa09d,0x11a));var _0xda09=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xa09d[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xda09('0x0'));module['exports']={'name':{'type':Sequelize[_0xda09('0x1')]},'description':{'type':Sequelize[_0xda09('0x1')]}}; \ No newline at end of file +var _0x2b7e=['exports','STRING'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x2b7e,0x120));var _0xe2b7=function(_0x5da678,_0x29634b){_0x5da678=_0x5da678-0x0;var _0x2e1fa3=_0x2b7e[_0x5da678];return _0x2e1fa3;};'use strict';var Sequelize=require('sequelize');module[_0xe2b7('0x0')]={'name':{'type':Sequelize[_0xe2b7('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 f735016..dcd71a7 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 _0x6534=['end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','SugarcrmConfiguration','rawAttributes','fieldName','type','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','update','getFields','SugarcrmField','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5bb5a9,_0x36a3a0){var _0x4d71d0=function(_0x1a2b2b){while(--_0x1a2b2b){_0x5bb5a9['push'](_0x5bb5a9['shift']());}};_0x4d71d0(++_0x36a3a0);}(_0x6534,0x1cd));var _0x4653=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x6534[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x4653('0x0'));var rimraf=require(_0x4653('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4653('0x2'));var rp=require(_0x4653('0x3'));var moment=require(_0x4653('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4653('0x5'));var util=require(_0x4653('0x6'));var path=require(_0x4653('0x7'));var sox=require(_0x4653('0x8'));var csv=require(_0x4653('0x9'));var ejs=require(_0x4653('0xa'));var fs=require('fs');var fs_extra=require(_0x4653('0xb'));var _=require(_0x4653('0xc'));var squel=require(_0x4653('0xd'));var crypto=require(_0x4653('0xe'));var jsforce=require(_0x4653('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4653('0x9'));var querystring=require(_0x4653('0x10'));var Papa=require('papaparse');var Redis=require(_0x4653('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4653('0x12'));var as=require(_0x4653('0x13'));var hardwareService=require(_0x4653('0x14'));var logger=require(_0x4653('0x15'))('api');var utils=require(_0x4653('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4653('0x17'));var db=require(_0x4653('0x18'))['db'];function respondWithStatusCode(_0x5bbcf5,_0x3322cc){_0x3322cc=_0x3322cc||0xcc;return function(_0x52e40f){if(_0x52e40f){return _0x5bbcf5['sendStatus'](_0x3322cc);}return _0x5bbcf5['status'](_0x3322cc)[_0x4653('0x19')]();};}function respondWithResult(_0x17f9f8,_0x3164bd){_0x3164bd=_0x3164bd||0xc8;return function(_0x5d427f){if(_0x5d427f){return _0x17f9f8['status'](_0x3164bd)[_0x4653('0x1a')](_0x5d427f);}};}function respondWithFilteredResult(_0x487c95,_0xcd0d2e){return function(_0x59bdb3){if(_0x59bdb3){var _0x2480b1=typeof _0xcd0d2e[_0x4653('0x1b')]===_0x4653('0x1c')&&typeof _0xcd0d2e[_0x4653('0x1d')]===_0x4653('0x1c');var _0x122cc3=_0x59bdb3[_0x4653('0x1e')];var _0x351f5f=_0x2480b1?0x0:_0xcd0d2e['offset'];var _0x4337ce=_0x2480b1?_0x59bdb3[_0x4653('0x1e')]:_0xcd0d2e['offset']+_0xcd0d2e[_0x4653('0x1d')];var _0x2efde9;if(_0x4337ce>=_0x122cc3){_0x4337ce=_0x122cc3;_0x2efde9=0xc8;}else{_0x2efde9=0xce;}_0x487c95[_0x4653('0x1f')](_0x2efde9);return _0x487c95[_0x4653('0x20')](_0x4653('0x21'),_0x351f5f+'-'+_0x4337ce+'/'+_0x122cc3)['json'](_0x59bdb3);}return null;};}function patchUpdates(_0x49732f){return function(_0x4250d8){try{jsonpatch[_0x4653('0x22')](_0x4250d8,_0x49732f,!![]);}catch(_0x3ced18){return BPromise[_0x4653('0x23')](_0x3ced18);}return _0x4250d8[_0x4653('0x24')]();};}function saveUpdates(_0x4e76ed,_0x1bd056){return function(_0x2e95b0){if(_0x2e95b0){return _0x2e95b0['update'](_0x4e76ed)[_0x4653('0x25')](function(_0xf83b58){return _0xf83b58;});}return null;};}function removeEntity(_0x1aee30,_0x5d821e){return function(_0x30b245){if(_0x30b245){return _0x30b245[_0x4653('0x26')]()[_0x4653('0x25')](function(){_0x1aee30[_0x4653('0x1f')](0xcc)[_0x4653('0x19')]();});}};}function handleEntityNotFound(_0x589627,_0x1eac94){return function(_0x4336e6){if(!_0x4336e6){_0x589627['sendStatus'](0x194);}return _0x4336e6;};}function handleError(_0x3495f9,_0x245852){_0x245852=_0x245852||0x1f4;return function(_0x125638){logger['error'](_0x125638[_0x4653('0x27')]);if(_0x125638[_0x4653('0x28')]){delete _0x125638['name'];}_0x3495f9[_0x4653('0x1f')](_0x245852)[_0x4653('0x29')](_0x125638);};}exports['index']=function(_0x1541ce,_0x1faff9){var _0x306e15={},_0x1d1b23={},_0x5e92b7={'count':0x0,'rows':[]};var _0x59a4df=_['map'](db[_0x4653('0x2a')][_0x4653('0x2b')],function(_0x27750d){return{'name':_0x27750d[_0x4653('0x2c')],'type':_0x27750d[_0x4653('0x2d')]['key']};});_0x1d1b23[_0x4653('0x2e')]=_[_0x4653('0x2f')](_0x59a4df,_0x4653('0x28'));_0x1d1b23[_0x4653('0x30')]=_[_0x4653('0x31')](_0x1541ce[_0x4653('0x30')]);_0x1d1b23[_0x4653('0x32')]=_['intersection'](_0x1d1b23[_0x4653('0x2e')],_0x1d1b23[_0x4653('0x30')]);_0x306e15['attributes']=_['intersection'](_0x1d1b23['model'],qs[_0x4653('0x33')](_0x1541ce[_0x4653('0x30')][_0x4653('0x33')]));_0x306e15[_0x4653('0x34')]=_0x306e15[_0x4653('0x34')][_0x4653('0x35')]?_0x306e15['attributes']:_0x1d1b23[_0x4653('0x2e')];if(!_0x1541ce[_0x4653('0x30')][_0x4653('0x36')](_0x4653('0x37'))){_0x306e15[_0x4653('0x1d')]=qs[_0x4653('0x1d')](_0x1541ce[_0x4653('0x30')][_0x4653('0x1d')]);_0x306e15[_0x4653('0x1b')]=qs[_0x4653('0x1b')](_0x1541ce[_0x4653('0x30')][_0x4653('0x1b')]);}_0x306e15['order']=qs[_0x4653('0x38')](_0x1541ce[_0x4653('0x30')]['sort']);_0x306e15[_0x4653('0x39')]=qs[_0x4653('0x32')](_[_0x4653('0x3a')](_0x1541ce[_0x4653('0x30')],_0x1d1b23['filters']),_0x59a4df);if(_0x1541ce[_0x4653('0x30')][_0x4653('0x3b')]){_0x306e15['where']=_[_0x4653('0x3c')](_0x306e15[_0x4653('0x39')],{'$or':_[_0x4653('0x2f')](_0x59a4df,function(_0x55ffb9){if(_0x55ffb9[_0x4653('0x2d')]!==_0x4653('0x3d')){var _0x5b9f25={};_0x5b9f25[_0x55ffb9['name']]={'$like':'%'+_0x1541ce['query']['filter']+'%'};return _0x5b9f25;}})});}_0x306e15=_[_0x4653('0x3c')]({},_0x306e15,_0x1541ce[_0x4653('0x3e')]);var _0x4ecb2e={'where':_0x306e15[_0x4653('0x39')]};return db['SugarcrmConfiguration'][_0x4653('0x1e')](_0x4ecb2e)['then'](function(_0x485505){_0x5e92b7[_0x4653('0x1e')]=_0x485505;if(_0x1541ce[_0x4653('0x30')][_0x4653('0x3f')]){_0x306e15[_0x4653('0x40')]=[{'all':!![]}];}return db[_0x4653('0x2a')][_0x4653('0x41')](_0x306e15);})['then'](function(_0x4759be){_0x5e92b7[_0x4653('0x42')]=_0x4759be;return _0x5e92b7;})['then'](respondWithFilteredResult(_0x1faff9,_0x306e15))[_0x4653('0x43')](handleError(_0x1faff9,null));};exports[_0x4653('0x44')]=function(_0xa97613,_0x3a96dd){var _0x37b979={'raw':![],'where':{'id':_0xa97613[_0x4653('0x45')]['id']}},_0xe44eb4={};_0xe44eb4[_0x4653('0x2e')]=_[_0x4653('0x31')](db['SugarcrmConfiguration'][_0x4653('0x2b')]);_0xe44eb4[_0x4653('0x30')]=_[_0x4653('0x31')](_0xa97613[_0x4653('0x30')]);_0xe44eb4[_0x4653('0x32')]=_[_0x4653('0x46')](_0xe44eb4['model'],_0xe44eb4[_0x4653('0x30')]);_0x37b979[_0x4653('0x34')]=_['intersection'](_0xe44eb4[_0x4653('0x2e')],qs[_0x4653('0x33')](_0xa97613[_0x4653('0x30')]['fields']));_0x37b979[_0x4653('0x34')]=_0x37b979[_0x4653('0x34')][_0x4653('0x35')]?_0x37b979[_0x4653('0x34')]:_0xe44eb4['model'];if(_0xa97613[_0x4653('0x30')][_0x4653('0x3f')]){_0x37b979['include']=[{'all':!![]}];}_0x37b979=_[_0x4653('0x3c')]({},_0x37b979,_0xa97613[_0x4653('0x3e')]);return db[_0x4653('0x2a')][_0x4653('0x47')](_0x37b979)['then'](handleEntityNotFound(_0x3a96dd,null))[_0x4653('0x25')](respondWithResult(_0x3a96dd,null))[_0x4653('0x43')](handleError(_0x3a96dd,null));};exports['create']=function(_0x26e9c4,_0xa6968b){return db[_0x4653('0x2a')][_0x4653('0x48')](_0x26e9c4[_0x4653('0x49')],{})[_0x4653('0x25')](respondWithResult(_0xa6968b,0xc9))[_0x4653('0x43')](handleError(_0xa6968b,null));};exports[_0x4653('0x4a')]=function(_0x2f4722,_0x4977b1){if(_0x2f4722[_0x4653('0x49')]['id']){delete _0x2f4722[_0x4653('0x49')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x2f4722[_0x4653('0x45')]['id']}})[_0x4653('0x25')](handleEntityNotFound(_0x4977b1,null))[_0x4653('0x25')](saveUpdates(_0x2f4722[_0x4653('0x49')],null))[_0x4653('0x25')](respondWithResult(_0x4977b1,null))[_0x4653('0x43')](handleError(_0x4977b1,null));};exports[_0x4653('0x26')]=function(_0x3deaa3,_0x5b3492){return db[_0x4653('0x2a')]['find']({'where':{'id':_0x3deaa3[_0x4653('0x45')]['id']}})[_0x4653('0x25')](handleEntityNotFound(_0x5b3492,null))[_0x4653('0x25')](removeEntity(_0x5b3492,null))[_0x4653('0x43')](handleError(_0x5b3492,null));};exports[_0x4653('0x4b')]=function(_0x2b0659,_0x3cccbc,_0x2b485b){var _0x5bb25a={};var _0x2d581a={};var _0x352055;var _0xea03c9;return db[_0x4653('0x2a')]['findOne']({'where':{'id':_0x2b0659['params']['id']}})['then'](handleEntityNotFound(_0x3cccbc,null))[_0x4653('0x25')](function(_0x4a9740){if(_0x4a9740){_0x352055=_0x4a9740;_0x2d581a[_0x4653('0x2e')]=_[_0x4653('0x31')](db[_0x4653('0x4c')][_0x4653('0x2b')]);_0x2d581a[_0x4653('0x30')]=_['keys'](_0x2b0659[_0x4653('0x30')]);_0x2d581a[_0x4653('0x32')]=_[_0x4653('0x46')](_0x2d581a[_0x4653('0x2e')],_0x2d581a[_0x4653('0x30')]);_0x5bb25a[_0x4653('0x34')]=_[_0x4653('0x46')](_0x2d581a[_0x4653('0x2e')],qs[_0x4653('0x33')](_0x2b0659['query']['fields']));_0x5bb25a[_0x4653('0x34')]=_0x5bb25a[_0x4653('0x34')][_0x4653('0x35')]?_0x5bb25a[_0x4653('0x34')]:_0x2d581a[_0x4653('0x2e')];_0x5bb25a[_0x4653('0x4d')]=qs[_0x4653('0x38')](_0x2b0659[_0x4653('0x30')][_0x4653('0x38')]);_0x5bb25a[_0x4653('0x39')]=qs[_0x4653('0x32')](_[_0x4653('0x3a')](_0x2b0659[_0x4653('0x30')],_0x2d581a[_0x4653('0x32')]));if(_0x2b0659[_0x4653('0x30')][_0x4653('0x3b')]){_0x5bb25a[_0x4653('0x39')]=_[_0x4653('0x3c')](_0x5bb25a[_0x4653('0x39')],{'$or':_[_0x4653('0x2f')](_0x5bb25a['attributes'],function(_0x4070ab){var _0x2a26d7={};_0x2a26d7[_0x4070ab]={'$like':'%'+_0x2b0659[_0x4653('0x30')][_0x4653('0x3b')]+'%'};return _0x2a26d7;})});}_0x5bb25a=_[_0x4653('0x3c')]({},_0x5bb25a,_0x2b0659[_0x4653('0x3e')]);return _0x352055[_0x4653('0x4b')](_0x5bb25a);}})[_0x4653('0x25')](function(_0x16577e){if(_0x16577e){_0xea03c9=_0x16577e[_0x4653('0x35')];if(!_0x2b0659[_0x4653('0x30')][_0x4653('0x36')](_0x4653('0x37'))){_0x5bb25a['limit']=qs[_0x4653('0x1d')](_0x2b0659[_0x4653('0x30')][_0x4653('0x1d')]);_0x5bb25a[_0x4653('0x1b')]=qs[_0x4653('0x1b')](_0x2b0659[_0x4653('0x30')]['offset']);}return _0x352055[_0x4653('0x4b')](_0x5bb25a);}})[_0x4653('0x25')](function(_0x86b506){if(_0x86b506){return _0x86b506?{'count':_0xea03c9,'rows':_0x86b506}:null;}})[_0x4653('0x25')](respondWithResult(_0x3cccbc,null))[_0x4653('0x43')](handleError(_0x3cccbc,null));};exports[_0x4653('0x4e')]=function(_0x5065d7,_0x5017e9,_0x501eb5){var _0xf48b78={};var _0x1a82cc={};var _0xa79595;var _0x47fbb0;return db[_0x4653('0x2a')][_0x4653('0x4f')]({'where':{'id':_0x5065d7[_0x4653('0x45')]['id']}})[_0x4653('0x25')](handleEntityNotFound(_0x5017e9,null))['then'](function(_0x6ced6c){if(_0x6ced6c){_0xa79595=_0x6ced6c;_0x1a82cc['model']=_[_0x4653('0x31')](db[_0x4653('0x4c')][_0x4653('0x2b')]);_0x1a82cc['query']=_[_0x4653('0x31')](_0x5065d7[_0x4653('0x30')]);_0x1a82cc[_0x4653('0x32')]=_[_0x4653('0x46')](_0x1a82cc[_0x4653('0x2e')],_0x1a82cc[_0x4653('0x30')]);_0xf48b78[_0x4653('0x34')]=_[_0x4653('0x46')](_0x1a82cc[_0x4653('0x2e')],qs[_0x4653('0x33')](_0x5065d7[_0x4653('0x30')][_0x4653('0x33')]));_0xf48b78[_0x4653('0x34')]=_0xf48b78['attributes'][_0x4653('0x35')]?_0xf48b78[_0x4653('0x34')]:_0x1a82cc[_0x4653('0x2e')];_0xf48b78['order']=qs[_0x4653('0x38')](_0x5065d7[_0x4653('0x30')]['sort']);_0xf48b78[_0x4653('0x39')]=qs[_0x4653('0x32')](_[_0x4653('0x3a')](_0x5065d7['query'],_0x1a82cc['filters']));if(_0x5065d7[_0x4653('0x30')][_0x4653('0x3b')]){_0xf48b78[_0x4653('0x39')]=_[_0x4653('0x3c')](_0xf48b78[_0x4653('0x39')],{'$or':_['map'](_0xf48b78[_0x4653('0x34')],function(_0x5c42f1){var _0x1ff718={};_0x1ff718[_0x5c42f1]={'$like':'%'+_0x5065d7[_0x4653('0x30')][_0x4653('0x3b')]+'%'};return _0x1ff718;})});}_0xf48b78=_[_0x4653('0x3c')]({},_0xf48b78,_0x5065d7['options']);return _0xa79595[_0x4653('0x4e')](_0xf48b78);}})[_0x4653('0x25')](function(_0x3385c8){if(_0x3385c8){_0x47fbb0=_0x3385c8[_0x4653('0x35')];if(!_0x5065d7[_0x4653('0x30')][_0x4653('0x36')](_0x4653('0x37'))){_0xf48b78[_0x4653('0x1d')]=qs['limit'](_0x5065d7[_0x4653('0x30')][_0x4653('0x1d')]);_0xf48b78['offset']=qs[_0x4653('0x1b')](_0x5065d7[_0x4653('0x30')][_0x4653('0x1b')]);}return _0xa79595[_0x4653('0x4e')](_0xf48b78);}})[_0x4653('0x25')](function(_0x182460){if(_0x182460){return _0x182460?{'count':_0x47fbb0,'rows':_0x182460}:null;}})[_0x4653('0x25')](respondWithResult(_0x5017e9,null))[_0x4653('0x43')](handleError(_0x5017e9,null));};exports[_0x4653('0x50')]=function(_0xfb4445,_0x4e484b,_0x5b42e5){var _0x4c293e={};var _0x581c1f={};var _0x4da93b;var _0xfdcbe7;return db[_0x4653('0x2a')][_0x4653('0x4f')]({'where':{'id':_0xfb4445[_0x4653('0x45')]['id']}})[_0x4653('0x25')](handleEntityNotFound(_0x4e484b,null))[_0x4653('0x25')](function(_0x1b560e){if(_0x1b560e){_0x4da93b=_0x1b560e;_0x581c1f[_0x4653('0x2e')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x581c1f[_0x4653('0x30')]=_[_0x4653('0x31')](_0xfb4445[_0x4653('0x30')]);_0x581c1f[_0x4653('0x32')]=_[_0x4653('0x46')](_0x581c1f[_0x4653('0x2e')],_0x581c1f[_0x4653('0x30')]);_0x4c293e['attributes']=_['intersection'](_0x581c1f['model'],qs[_0x4653('0x33')](_0xfb4445[_0x4653('0x30')]['fields']));_0x4c293e['attributes']=_0x4c293e['attributes'][_0x4653('0x35')]?_0x4c293e[_0x4653('0x34')]:_0x581c1f[_0x4653('0x2e')];_0x4c293e['order']=qs[_0x4653('0x38')](_0xfb4445[_0x4653('0x30')][_0x4653('0x38')]);_0x4c293e['where']=qs['filters'](_[_0x4653('0x3a')](_0xfb4445[_0x4653('0x30')],_0x581c1f[_0x4653('0x32')]));if(_0xfb4445[_0x4653('0x30')][_0x4653('0x3b')]){_0x4c293e[_0x4653('0x39')]=_[_0x4653('0x3c')](_0x4c293e[_0x4653('0x39')],{'$or':_[_0x4653('0x2f')](_0x4c293e[_0x4653('0x34')],function(_0x28570e){var _0x16342d={};_0x16342d[_0x28570e]={'$like':'%'+_0xfb4445[_0x4653('0x30')][_0x4653('0x3b')]+'%'};return _0x16342d;})});}_0x4c293e=_[_0x4653('0x3c')]({},_0x4c293e,_0xfb4445['options']);return _0x4da93b['getDescriptions'](_0x4c293e);}})[_0x4653('0x25')](function(_0x496b54){if(_0x496b54){_0xfdcbe7=_0x496b54['length'];if(!_0xfb4445[_0x4653('0x30')][_0x4653('0x36')](_0x4653('0x37'))){_0x4c293e['limit']=qs[_0x4653('0x1d')](_0xfb4445[_0x4653('0x30')][_0x4653('0x1d')]);_0x4c293e['offset']=qs['offset'](_0xfb4445['query']['offset']);}return _0x4da93b[_0x4653('0x50')](_0x4c293e);}})['then'](function(_0x522523){if(_0x522523){return _0x522523?{'count':_0xfdcbe7,'rows':_0x522523}:null;}})[_0x4653('0x25')](respondWithResult(_0x4e484b,null))['catch'](handleError(_0x4e484b,null));}; \ No newline at end of file +var _0x0536=['sort','where','pick','filter','VIRTUAL','merge','SugarcrmConfiguration','findAll','rows','catch','show','include','options','create','body','find','params','getFields','findOne','hasOwnProperty','getSubjects','getDescriptions','SugarcrmField','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','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','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order'];(function(_0x2b2cce,_0x582b1c){var _0x2b78b3=function(_0x557d61){while(--_0x557d61){_0x2b2cce['push'](_0x2b2cce['shift']());}};_0x2b78b3(++_0x582b1c);}(_0x0536,0x157));var _0x6053=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0536[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x6053('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6053('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6053('0x2'));var moment=require(_0x6053('0x3'));var BPromise=require(_0x6053('0x4'));var Mustache=require(_0x6053('0x5'));var util=require(_0x6053('0x6'));var path=require('path');var sox=require(_0x6053('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6053('0x8'));var squel=require('squel');var crypto=require(_0x6053('0x9'));var jsforce=require(_0x6053('0xa'));var deskjs=require(_0x6053('0xb'));var toCsv=require(_0x6053('0xc'));var querystring=require(_0x6053('0xd'));var Papa=require('papaparse');var Redis=require(_0x6053('0xe'));var authService=require(_0x6053('0xf'));var qs=require(_0x6053('0x10'));var as=require(_0x6053('0x11'));var hardwareService=require(_0x6053('0x12'));var logger=require(_0x6053('0x13'))(_0x6053('0x14'));var utils=require(_0x6053('0x15'));var config=require(_0x6053('0x16'));var licenseUtil=require(_0x6053('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4de82f,_0x314206){_0x314206=_0x314206||0xcc;return function(_0x36417b){if(_0x36417b){return _0x4de82f[_0x6053('0x18')](_0x314206);}return _0x4de82f[_0x6053('0x19')](_0x314206)[_0x6053('0x1a')]();};}function respondWithResult(_0x37cf80,_0x14c0f){_0x14c0f=_0x14c0f||0xc8;return function(_0x23a91d){if(_0x23a91d){return _0x37cf80['status'](_0x14c0f)[_0x6053('0x1b')](_0x23a91d);}};}function respondWithFilteredResult(_0xe6b09,_0x56c2ce){return function(_0x3ad18b){if(_0x3ad18b){var _0x4a804c=typeof _0x56c2ce[_0x6053('0x1c')]===_0x6053('0x1d')&&typeof _0x56c2ce[_0x6053('0x1e')]===_0x6053('0x1d');var _0xad0e81=_0x3ad18b[_0x6053('0x1f')];var _0xf63914=_0x4a804c?0x0:_0x56c2ce['offset'];var _0xb4f771=_0x4a804c?_0x3ad18b[_0x6053('0x1f')]:_0x56c2ce[_0x6053('0x1c')]+_0x56c2ce[_0x6053('0x1e')];var _0xf5662a;if(_0xb4f771>=_0xad0e81){_0xb4f771=_0xad0e81;_0xf5662a=0xc8;}else{_0xf5662a=0xce;}_0xe6b09[_0x6053('0x19')](_0xf5662a);return _0xe6b09['set']('Content-Range',_0xf63914+'-'+_0xb4f771+'/'+_0xad0e81)[_0x6053('0x1b')](_0x3ad18b);}return null;};}function patchUpdates(_0xee4df9){return function(_0x43d474){try{jsonpatch[_0x6053('0x20')](_0x43d474,_0xee4df9,!![]);}catch(_0x4fa38b){return BPromise[_0x6053('0x21')](_0x4fa38b);}return _0x43d474[_0x6053('0x22')]();};}function saveUpdates(_0xc13624,_0xadb8dc){return function(_0x44d0a0){if(_0x44d0a0){return _0x44d0a0[_0x6053('0x23')](_0xc13624)[_0x6053('0x24')](function(_0x4ce81f){return _0x4ce81f;});}return null;};}function removeEntity(_0x57e2c7,_0x3f8ae7){return function(_0x4e9f88){if(_0x4e9f88){return _0x4e9f88[_0x6053('0x25')]()[_0x6053('0x24')](function(){_0x57e2c7[_0x6053('0x19')](0xcc)[_0x6053('0x1a')]();});}};}function handleEntityNotFound(_0x3f57fc,_0xfe13fe){return function(_0x397824){if(!_0x397824){_0x3f57fc[_0x6053('0x18')](0x194);}return _0x397824;};}function handleError(_0x2cb426,_0x46f25d){_0x46f25d=_0x46f25d||0x1f4;return function(_0xa0ca48){logger[_0x6053('0x26')](_0xa0ca48[_0x6053('0x27')]);if(_0xa0ca48[_0x6053('0x28')]){delete _0xa0ca48[_0x6053('0x28')];}_0x2cb426['status'](_0x46f25d)['send'](_0xa0ca48);};}exports[_0x6053('0x29')]=function(_0xc0845f,_0x7c3afa){var _0x14dc8a={},_0x47a969={},_0x4ac070={'count':0x0,'rows':[]};var _0x1fb39c=_[_0x6053('0x2a')](db['SugarcrmConfiguration'][_0x6053('0x2b')],function(_0x366f85){return{'name':_0x366f85[_0x6053('0x2c')],'type':_0x366f85[_0x6053('0x2d')][_0x6053('0x2e')]};});_0x47a969[_0x6053('0x2f')]=_[_0x6053('0x2a')](_0x1fb39c,_0x6053('0x28'));_0x47a969['query']=_[_0x6053('0x30')](_0xc0845f[_0x6053('0x31')]);_0x47a969[_0x6053('0x32')]=_[_0x6053('0x33')](_0x47a969[_0x6053('0x2f')],_0x47a969['query']);_0x14dc8a[_0x6053('0x34')]=_[_0x6053('0x33')](_0x47a969[_0x6053('0x2f')],qs[_0x6053('0x35')](_0xc0845f[_0x6053('0x31')][_0x6053('0x35')]));_0x14dc8a[_0x6053('0x34')]=_0x14dc8a[_0x6053('0x34')][_0x6053('0x36')]?_0x14dc8a[_0x6053('0x34')]:_0x47a969['model'];if(!_0xc0845f[_0x6053('0x31')]['hasOwnProperty'](_0x6053('0x37'))){_0x14dc8a[_0x6053('0x1e')]=qs[_0x6053('0x1e')](_0xc0845f['query']['limit']);_0x14dc8a[_0x6053('0x1c')]=qs[_0x6053('0x1c')](_0xc0845f[_0x6053('0x31')][_0x6053('0x1c')]);}_0x14dc8a[_0x6053('0x38')]=qs[_0x6053('0x39')](_0xc0845f[_0x6053('0x31')][_0x6053('0x39')]);_0x14dc8a[_0x6053('0x3a')]=qs[_0x6053('0x32')](_[_0x6053('0x3b')](_0xc0845f[_0x6053('0x31')],_0x47a969['filters']),_0x1fb39c);if(_0xc0845f[_0x6053('0x31')][_0x6053('0x3c')]){_0x14dc8a[_0x6053('0x3a')]=_['merge'](_0x14dc8a[_0x6053('0x3a')],{'$or':_[_0x6053('0x2a')](_0x1fb39c,function(_0x274ebe){if(_0x274ebe[_0x6053('0x2d')]!==_0x6053('0x3d')){var _0x49c0c0={};_0x49c0c0[_0x274ebe['name']]={'$like':'%'+_0xc0845f[_0x6053('0x31')][_0x6053('0x3c')]+'%'};return _0x49c0c0;}})});}_0x14dc8a=_[_0x6053('0x3e')]({},_0x14dc8a,_0xc0845f['options']);var _0x464356={'where':_0x14dc8a[_0x6053('0x3a')]};return db['SugarcrmConfiguration']['count'](_0x464356)[_0x6053('0x24')](function(_0x40b475){_0x4ac070['count']=_0x40b475;if(_0xc0845f[_0x6053('0x31')]['includeAll']){_0x14dc8a['include']=[{'all':!![]}];}return db[_0x6053('0x3f')][_0x6053('0x40')](_0x14dc8a);})['then'](function(_0x334f3b){_0x4ac070[_0x6053('0x41')]=_0x334f3b;return _0x4ac070;})[_0x6053('0x24')](respondWithFilteredResult(_0x7c3afa,_0x14dc8a))[_0x6053('0x42')](handleError(_0x7c3afa,null));};exports[_0x6053('0x43')]=function(_0x51f05b,_0x169d6d){var _0xadd190={'raw':![],'where':{'id':_0x51f05b['params']['id']}},_0x20ebc4={};_0x20ebc4[_0x6053('0x2f')]=_[_0x6053('0x30')](db['SugarcrmConfiguration']['rawAttributes']);_0x20ebc4[_0x6053('0x31')]=_['keys'](_0x51f05b['query']);_0x20ebc4[_0x6053('0x32')]=_[_0x6053('0x33')](_0x20ebc4[_0x6053('0x2f')],_0x20ebc4[_0x6053('0x31')]);_0xadd190[_0x6053('0x34')]=_[_0x6053('0x33')](_0x20ebc4[_0x6053('0x2f')],qs['fields'](_0x51f05b['query'][_0x6053('0x35')]));_0xadd190['attributes']=_0xadd190[_0x6053('0x34')]['length']?_0xadd190[_0x6053('0x34')]:_0x20ebc4[_0x6053('0x2f')];if(_0x51f05b[_0x6053('0x31')]['includeAll']){_0xadd190[_0x6053('0x44')]=[{'all':!![]}];}_0xadd190=_[_0x6053('0x3e')]({},_0xadd190,_0x51f05b[_0x6053('0x45')]);return db[_0x6053('0x3f')]['find'](_0xadd190)['then'](handleEntityNotFound(_0x169d6d,null))[_0x6053('0x24')](respondWithResult(_0x169d6d,null))['catch'](handleError(_0x169d6d,null));};exports[_0x6053('0x46')]=function(_0x2d6b12,_0x64cb56){return db['SugarcrmConfiguration'][_0x6053('0x46')](_0x2d6b12['body'],{})[_0x6053('0x24')](respondWithResult(_0x64cb56,0xc9))[_0x6053('0x42')](handleError(_0x64cb56,null));};exports['update']=function(_0x141b2a,_0x3c6ad2){if(_0x141b2a[_0x6053('0x47')]['id']){delete _0x141b2a['body']['id'];}return db[_0x6053('0x3f')][_0x6053('0x48')]({'where':{'id':_0x141b2a[_0x6053('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c6ad2,null))[_0x6053('0x24')](saveUpdates(_0x141b2a[_0x6053('0x47')],null))['then'](respondWithResult(_0x3c6ad2,null))[_0x6053('0x42')](handleError(_0x3c6ad2,null));};exports[_0x6053('0x25')]=function(_0x36c58a,_0x53e21f){return db[_0x6053('0x3f')][_0x6053('0x48')]({'where':{'id':_0x36c58a['params']['id']}})[_0x6053('0x24')](handleEntityNotFound(_0x53e21f,null))[_0x6053('0x24')](removeEntity(_0x53e21f,null))[_0x6053('0x42')](handleError(_0x53e21f,null));};exports[_0x6053('0x4a')]=function(_0x1e4a1f,_0x5131c9,_0x275031){var _0x4a5d57={};var _0x277cbf={};var _0x23f36b;var _0x230b41;return db[_0x6053('0x3f')][_0x6053('0x4b')]({'where':{'id':_0x1e4a1f[_0x6053('0x49')]['id']}})[_0x6053('0x24')](handleEntityNotFound(_0x5131c9,null))[_0x6053('0x24')](function(_0x13282c){if(_0x13282c){_0x23f36b=_0x13282c;_0x277cbf[_0x6053('0x2f')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x277cbf[_0x6053('0x31')]=_[_0x6053('0x30')](_0x1e4a1f[_0x6053('0x31')]);_0x277cbf[_0x6053('0x32')]=_['intersection'](_0x277cbf['model'],_0x277cbf['query']);_0x4a5d57[_0x6053('0x34')]=_['intersection'](_0x277cbf[_0x6053('0x2f')],qs['fields'](_0x1e4a1f['query'][_0x6053('0x35')]));_0x4a5d57[_0x6053('0x34')]=_0x4a5d57['attributes'][_0x6053('0x36')]?_0x4a5d57['attributes']:_0x277cbf[_0x6053('0x2f')];_0x4a5d57[_0x6053('0x38')]=qs[_0x6053('0x39')](_0x1e4a1f[_0x6053('0x31')]['sort']);_0x4a5d57[_0x6053('0x3a')]=qs[_0x6053('0x32')](_[_0x6053('0x3b')](_0x1e4a1f[_0x6053('0x31')],_0x277cbf['filters']));if(_0x1e4a1f[_0x6053('0x31')]['filter']){_0x4a5d57[_0x6053('0x3a')]=_['merge'](_0x4a5d57[_0x6053('0x3a')],{'$or':_[_0x6053('0x2a')](_0x4a5d57[_0x6053('0x34')],function(_0x441103){var _0x4399cb={};_0x4399cb[_0x441103]={'$like':'%'+_0x1e4a1f['query'][_0x6053('0x3c')]+'%'};return _0x4399cb;})});}_0x4a5d57=_[_0x6053('0x3e')]({},_0x4a5d57,_0x1e4a1f[_0x6053('0x45')]);return _0x23f36b[_0x6053('0x4a')](_0x4a5d57);}})[_0x6053('0x24')](function(_0x53c241){if(_0x53c241){_0x230b41=_0x53c241[_0x6053('0x36')];if(!_0x1e4a1f[_0x6053('0x31')][_0x6053('0x4c')]('nolimit')){_0x4a5d57[_0x6053('0x1e')]=qs['limit'](_0x1e4a1f[_0x6053('0x31')][_0x6053('0x1e')]);_0x4a5d57[_0x6053('0x1c')]=qs['offset'](_0x1e4a1f[_0x6053('0x31')]['offset']);}return _0x23f36b[_0x6053('0x4a')](_0x4a5d57);}})[_0x6053('0x24')](function(_0x31719a){if(_0x31719a){return _0x31719a?{'count':_0x230b41,'rows':_0x31719a}:null;}})[_0x6053('0x24')](respondWithResult(_0x5131c9,null))[_0x6053('0x42')](handleError(_0x5131c9,null));};exports['getSubjects']=function(_0x40e76f,_0xc68aa4,_0x26dde7){var _0x48e867={};var _0x9456eb={};var _0x185655;var _0x3f13ab;return db[_0x6053('0x3f')][_0x6053('0x4b')]({'where':{'id':_0x40e76f[_0x6053('0x49')]['id']}})['then'](handleEntityNotFound(_0xc68aa4,null))['then'](function(_0x4ade03){if(_0x4ade03){_0x185655=_0x4ade03;_0x9456eb['model']=_[_0x6053('0x30')](db['SugarcrmField'][_0x6053('0x2b')]);_0x9456eb[_0x6053('0x31')]=_[_0x6053('0x30')](_0x40e76f['query']);_0x9456eb['filters']=_[_0x6053('0x33')](_0x9456eb[_0x6053('0x2f')],_0x9456eb[_0x6053('0x31')]);_0x48e867['attributes']=_[_0x6053('0x33')](_0x9456eb[_0x6053('0x2f')],qs['fields'](_0x40e76f['query'][_0x6053('0x35')]));_0x48e867[_0x6053('0x34')]=_0x48e867[_0x6053('0x34')][_0x6053('0x36')]?_0x48e867[_0x6053('0x34')]:_0x9456eb[_0x6053('0x2f')];_0x48e867[_0x6053('0x38')]=qs[_0x6053('0x39')](_0x40e76f['query'][_0x6053('0x39')]);_0x48e867[_0x6053('0x3a')]=qs[_0x6053('0x32')](_[_0x6053('0x3b')](_0x40e76f[_0x6053('0x31')],_0x9456eb['filters']));if(_0x40e76f[_0x6053('0x31')][_0x6053('0x3c')]){_0x48e867[_0x6053('0x3a')]=_[_0x6053('0x3e')](_0x48e867[_0x6053('0x3a')],{'$or':_[_0x6053('0x2a')](_0x48e867['attributes'],function(_0x3fe338){var _0x5f10b2={};_0x5f10b2[_0x3fe338]={'$like':'%'+_0x40e76f['query']['filter']+'%'};return _0x5f10b2;})});}_0x48e867=_[_0x6053('0x3e')]({},_0x48e867,_0x40e76f[_0x6053('0x45')]);return _0x185655[_0x6053('0x4d')](_0x48e867);}})[_0x6053('0x24')](function(_0x4cd30a){if(_0x4cd30a){_0x3f13ab=_0x4cd30a['length'];if(!_0x40e76f[_0x6053('0x31')][_0x6053('0x4c')](_0x6053('0x37'))){_0x48e867[_0x6053('0x1e')]=qs[_0x6053('0x1e')](_0x40e76f[_0x6053('0x31')][_0x6053('0x1e')]);_0x48e867['offset']=qs[_0x6053('0x1c')](_0x40e76f[_0x6053('0x31')][_0x6053('0x1c')]);}return _0x185655[_0x6053('0x4d')](_0x48e867);}})['then'](function(_0x233cc5){if(_0x233cc5){return _0x233cc5?{'count':_0x3f13ab,'rows':_0x233cc5}:null;}})['then'](respondWithResult(_0xc68aa4,null))['catch'](handleError(_0xc68aa4,null));};exports[_0x6053('0x4e')]=function(_0x563c42,_0xb73603,_0xa6ea1){var _0x40eee7={};var _0x2e4548={};var _0x395bbd;var _0x3f9e04;return db[_0x6053('0x3f')][_0x6053('0x4b')]({'where':{'id':_0x563c42['params']['id']}})[_0x6053('0x24')](handleEntityNotFound(_0xb73603,null))[_0x6053('0x24')](function(_0x1b07e9){if(_0x1b07e9){_0x395bbd=_0x1b07e9;_0x2e4548[_0x6053('0x2f')]=_[_0x6053('0x30')](db[_0x6053('0x4f')][_0x6053('0x2b')]);_0x2e4548[_0x6053('0x31')]=_[_0x6053('0x30')](_0x563c42[_0x6053('0x31')]);_0x2e4548[_0x6053('0x32')]=_[_0x6053('0x33')](_0x2e4548[_0x6053('0x2f')],_0x2e4548[_0x6053('0x31')]);_0x40eee7[_0x6053('0x34')]=_[_0x6053('0x33')](_0x2e4548[_0x6053('0x2f')],qs[_0x6053('0x35')](_0x563c42['query'][_0x6053('0x35')]));_0x40eee7[_0x6053('0x34')]=_0x40eee7[_0x6053('0x34')]['length']?_0x40eee7[_0x6053('0x34')]:_0x2e4548[_0x6053('0x2f')];_0x40eee7[_0x6053('0x38')]=qs['sort'](_0x563c42[_0x6053('0x31')][_0x6053('0x39')]);_0x40eee7[_0x6053('0x3a')]=qs[_0x6053('0x32')](_[_0x6053('0x3b')](_0x563c42[_0x6053('0x31')],_0x2e4548['filters']));if(_0x563c42['query'][_0x6053('0x3c')]){_0x40eee7['where']=_[_0x6053('0x3e')](_0x40eee7['where'],{'$or':_['map'](_0x40eee7[_0x6053('0x34')],function(_0x195d40){var _0x1be956={};_0x1be956[_0x195d40]={'$like':'%'+_0x563c42['query']['filter']+'%'};return _0x1be956;})});}_0x40eee7=_[_0x6053('0x3e')]({},_0x40eee7,_0x563c42[_0x6053('0x45')]);return _0x395bbd[_0x6053('0x4e')](_0x40eee7);}})[_0x6053('0x24')](function(_0x2b0db4){if(_0x2b0db4){_0x3f9e04=_0x2b0db4[_0x6053('0x36')];if(!_0x563c42[_0x6053('0x31')][_0x6053('0x4c')](_0x6053('0x37'))){_0x40eee7['limit']=qs[_0x6053('0x1e')](_0x563c42[_0x6053('0x31')][_0x6053('0x1e')]);_0x40eee7['offset']=qs[_0x6053('0x1c')](_0x563c42['query'][_0x6053('0x1c')]);}return _0x395bbd['getDescriptions'](_0x40eee7);}})[_0x6053('0x24')](function(_0x459277){if(_0x459277){return _0x459277?{'count':_0x3f9e04,'rows':_0x459277}:null;}})['then'](respondWithResult(_0xb73603,null))[_0x6053('0x42')](handleError(_0xb73603,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index c61348f..d7d96d3 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 _0xb01a=['moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','util','../../config/logger','api'];(function(_0x5d949e,_0x555707){var _0x445c1e=function(_0x160f2a){while(--_0x160f2a){_0x5d949e['push'](_0x5d949e['shift']());}};_0x445c1e(++_0x555707);}(_0xb01a,0x159));var _0xab01=function(_0x4b2693,_0x29f874){_0x4b2693=_0x4b2693-0x0;var _0x1957d7=_0xb01a[_0x4b2693];return _0x1957d7;};'use strict';var _=require('lodash');var util=require(_0xab01('0x0'));var logger=require(_0xab01('0x1'))(_0xab01('0x2'));var moment=require(_0xab01('0x3'));var BPromise=require(_0xab01('0x4'));var rp=require(_0xab01('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xab01('0x6'));var config=require(_0xab01('0x7'));var attributes=require(_0xab01('0x8'));module[_0xab01('0x9')]=function(_0x1c591a,_0x57034d){return _0x1c591a[_0xab01('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0xab01('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x183f=['int_sugarcrm_configurations','lodash','util','api','moment','bluebird','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x183f,0x1ed));var _0xf183=function(_0x2d2a48,_0x24e6ac){_0x2d2a48=_0x2d2a48-0x0;var _0x41836e=_0x183f[_0x2d2a48];return _0x41836e;};'use strict';var _=require(_0xf183('0x0'));var util=require(_0xf183('0x1'));var logger=require('../../config/logger')(_0xf183('0x2'));var moment=require(_0xf183('0x3'));var BPromise=require(_0xf183('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf183('0x5'));var rimraf=require('rimraf');var config=require(_0xf183('0x6'));var attributes=require(_0xf183('0x7'));module[_0xf183('0x8')]=function(_0x288ee5,_0x49f21c){return _0x288ee5[_0xf183('0x9')](_0xf183('0xa'),attributes,{'tableName':_0xf183('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 2338415..8322a54 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 _0x30ab=['randomstring','ioredis','../../config/utils','rpc','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x568a3d,_0x49c572){var _0x15c026=function(_0x26cc3f){while(--_0x26cc3f){_0x568a3d['push'](_0x568a3d['shift']());}};_0x15c026(++_0x49c572);}(_0x30ab,0x1a1));var _0xb30a=function(_0x121d33,_0x3cf3e7){_0x121d33=_0x121d33-0x0;var _0x328d6b=_0x30ab[_0x121d33];return _0x328d6b;};'use strict';var _=require(_0xb30a('0x0'));var util=require('util');var moment=require(_0xb30a('0x1'));var BPromise=require(_0xb30a('0x2'));var rs=require(_0xb30a('0x3'));var fs=require('fs');var Redis=require(_0xb30a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb30a('0x5'));var logger=require('../../config/logger')(_0xb30a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb30a('0x7')][_0xb30a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x337637,_0x27c394,_0x36d82d){return new BPromise(function(_0x51d41f,_0xe87372){return client[_0xb30a('0x9')](_0x337637,_0x36d82d)[_0xb30a('0xa')](function(_0x417774){logger['info'](_0xb30a('0xb'),_0x27c394,_0xb30a('0xc'));logger[_0xb30a('0xd')](_0xb30a('0xe'),_0x27c394,_0xb30a('0xc'),JSON[_0xb30a('0xf')](_0x417774));if(_0x417774[_0xb30a('0x10')]){if(_0x417774[_0xb30a('0x10')][_0xb30a('0x11')]===0x1f4){logger[_0xb30a('0x10')](_0xb30a('0xb'),_0x27c394,_0x417774[_0xb30a('0x10')]['message']);return _0xe87372(_0x417774[_0xb30a('0x10')][_0xb30a('0x12')]);}logger[_0xb30a('0x10')](_0xb30a('0xb'),_0x27c394,_0x417774[_0xb30a('0x10')]['message']);return _0x51d41f(_0x417774[_0xb30a('0x10')]['message']);}else{logger['info'](_0xb30a('0xb'),_0x27c394,'request\x20sent');_0x51d41f(_0x417774[_0xb30a('0x13')][_0xb30a('0x12')]);}})['catch'](function(_0x25d687){logger['error'](_0xb30a('0xb'),_0x27c394,_0x25d687);_0xe87372(_0x25d687);});});} \ No newline at end of file +var _0xfdd1=['stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x1bcfff,_0x3ccb9b){var _0x5e74f5=function(_0x289945){while(--_0x289945){_0x1bcfff['push'](_0x1bcfff['shift']());}};_0x5e74f5(++_0x3ccb9b);}(_0xfdd1,0x1cf));var _0x1fdd=function(_0x595c4e,_0x444249){_0x595c4e=_0x595c4e-0x0;var _0x1e224c=_0xfdd1[_0x595c4e];return _0x1e224c;};'use strict';var _=require(_0x1fdd('0x0'));var util=require(_0x1fdd('0x1'));var moment=require('moment');var BPromise=require(_0x1fdd('0x2'));var rs=require(_0x1fdd('0x3'));var fs=require('fs');var Redis=require(_0x1fdd('0x4'));var db=require(_0x1fdd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fdd('0x6'))(_0x1fdd('0x7'));var config=require(_0x1fdd('0x8'));var jayson=require(_0x1fdd('0x9'));var client=jayson[_0x1fdd('0xa')][_0x1fdd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf1a200,_0x580438,_0x35bb59){return new BPromise(function(_0x364352,_0x5c58f3){return client[_0x1fdd('0xc')](_0xf1a200,_0x35bb59)['then'](function(_0x1ddda4){logger[_0x1fdd('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x580438,_0x1fdd('0xe'));logger[_0x1fdd('0xf')](_0x1fdd('0x10'),_0x580438,_0x1fdd('0xe'),JSON[_0x1fdd('0x11')](_0x1ddda4));if(_0x1ddda4[_0x1fdd('0x12')]){if(_0x1ddda4[_0x1fdd('0x12')][_0x1fdd('0x13')]===0x1f4){logger['error'](_0x1fdd('0x14'),_0x580438,_0x1ddda4[_0x1fdd('0x12')][_0x1fdd('0x15')]);return _0x5c58f3(_0x1ddda4[_0x1fdd('0x12')][_0x1fdd('0x15')]);}logger[_0x1fdd('0x12')](_0x1fdd('0x14'),_0x580438,_0x1ddda4[_0x1fdd('0x12')][_0x1fdd('0x15')]);return _0x364352(_0x1ddda4[_0x1fdd('0x12')][_0x1fdd('0x15')]);}else{logger[_0x1fdd('0xd')](_0x1fdd('0x14'),_0x580438,_0x1fdd('0xe'));_0x364352(_0x1ddda4[_0x1fdd('0x16')]['message']);}})[_0x1fdd('0x17')](function(_0x4cf43a){logger[_0x1fdd('0x12')](_0x1fdd('0x14'),_0x580438,_0x4cf43a);_0x5c58f3(_0x4cf43a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 471edea..b1d0e11 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 _0x52e1=['../../config/environment','./intSugarcrmField.controller','get','/:id','isAuthenticated','show','post','put','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x26b4ce,_0x17679d){var _0x34a3f0=function(_0x3f595d){while(--_0x3f595d){_0x26b4ce['push'](_0x26b4ce['shift']());}};_0x34a3f0(++_0x17679d);}(_0x52e1,0x12a));var _0x152e=function(_0xe6beba,_0x3f15d1){_0xe6beba=_0xe6beba-0x0;var _0x2f1c08=_0x52e1[_0xe6beba];return _0x2f1c08;};'use strict';var multer=require(_0x152e('0x0'));var util=require(_0x152e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x152e('0x2'));var router=express[_0x152e('0x3')]();var fs_extra=require(_0x152e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x152e('0x5'));var config=require(_0x152e('0x6'));var controller=require(_0x152e('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x152e('0x8')](_0x152e('0x9'),auth[_0x152e('0xa')](),controller[_0x152e('0xb')]);router[_0x152e('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x152e('0xd')](_0x152e('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x152e('0xe')](_0x152e('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x152e('0xf')]=router; \ No newline at end of file +var _0x5bbd=['post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x17ec07,_0xe3ca90){var _0x5a6c45=function(_0x59b715){while(--_0x59b715){_0x17ec07['push'](_0x17ec07['shift']());}};_0x5a6c45(++_0xe3ca90);}(_0x5bbd,0x6b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd5bb('0x0'));var util=require(_0xd5bb('0x1'));var path=require(_0xd5bb('0x2'));var timeout=require('connect-timeout');var express=require(_0xd5bb('0x3'));var router=express[_0xd5bb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd5bb('0x5'));var interaction=require(_0xd5bb('0x6'));var config=require('../../config/environment');var controller=require(_0xd5bb('0x7'));router[_0xd5bb('0x8')]('/',auth[_0xd5bb('0x9')](),controller[_0xd5bb('0xa')]);router[_0xd5bb('0x8')](_0xd5bb('0xb'),auth['isAuthenticated'](),controller[_0xd5bb('0xc')]);router[_0xd5bb('0xd')]('/',auth['isAuthenticated'](),controller[_0xd5bb('0xe')]);router[_0xd5bb('0xf')](_0xd5bb('0xb'),auth['isAuthenticated'](),controller[_0xd5bb('0x10')]);router[_0xd5bb('0x11')]('/:id',auth[_0xd5bb('0x9')](),controller[_0xd5bb('0x12')]);module[_0xd5bb('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 3b3a6fb..674eca4 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 _0xf4b4=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf4b4,0xe6));var _0x4f4b=function(_0x4a2cc2,_0x1fbafa){_0x4a2cc2=_0x4a2cc2-0x0;var _0x3f5f5c=_0xf4b4[_0x4a2cc2];return _0x3f5f5c;};'use strict';var Sequelize=require(_0x4f4b('0x0'));module[_0x4f4b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4f4b('0x2'),_0x4f4b('0x3'),_0x4f4b('0x4'),_0x4f4b('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x4f4b('0x6')]},'key':{'type':Sequelize[_0x4f4b('0x6')]},'keyType':{'type':Sequelize[_0x4f4b('0x7')](_0x4f4b('0x2'),_0x4f4b('0x3'),_0x4f4b('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4f4b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4f4b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4f4b('0x6')]}}; \ No newline at end of file +var _0xa1ab=['string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM'];(function(_0x13f05d,_0x18e8a3){var _0x1383b4=function(_0x175fd4){while(--_0x175fd4){_0x13f05d['push'](_0x13f05d['shift']());}};_0x1383b4(++_0x18e8a3);}(_0xa1ab,0xb2));var _0xba1a=function(_0x1e3211,_0x3d6096){_0x1e3211=_0x1e3211-0x0;var _0x7da801=_0xa1ab[_0x1e3211];return _0x7da801;};'use strict';var Sequelize=require('sequelize');module[_0xba1a('0x0')]={'type':{'type':Sequelize[_0xba1a('0x1')](_0xba1a('0x2'),_0xba1a('0x3'),_0xba1a('0x4'),_0xba1a('0x5'),_0xba1a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xba1a('0x7')]},'key':{'type':Sequelize[_0xba1a('0x7')]},'keyType':{'type':Sequelize[_0xba1a('0x1')](_0xba1a('0x2'),_0xba1a('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xba1a('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xba1a('0x7')]},'customField':{'type':Sequelize[_0xba1a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba1a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 810b859..0cdd64b 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 _0xf28e=['index','SugarcrmField','fieldName','type','model','map','filters','intersection','query','attributes','fields','nolimit','where','pick','filter','merge','includeAll','rows','catch','show','params','keys','rawAttributes','include','options','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','error','stack','name'];(function(_0x313303,_0x50cdfb){var _0x1e7316=function(_0x4f797e){while(--_0x4f797e){_0x313303['push'](_0x313303['shift']());}};_0x1e7316(++_0x50cdfb);}(_0xf28e,0xeb));var _0xef28=function(_0x5944e9,_0xf3da60){_0x5944e9=_0x5944e9-0x0;var _0x1098b8=_0xf28e[_0x5944e9];return _0x1098b8;};'use strict';var emlformat=require(_0xef28('0x0'));var rimraf=require(_0xef28('0x1'));var zipdir=require(_0xef28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef28('0x3'));var moment=require(_0xef28('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xef28('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef28('0x6'));var _=require(_0xef28('0x7'));var squel=require(_0xef28('0x8'));var crypto=require(_0xef28('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xef28('0xa'));var toCsv=require(_0xef28('0xb'));var querystring=require('querystring');var Papa=require(_0xef28('0xc'));var Redis=require(_0xef28('0xd'));var authService=require(_0xef28('0xe'));var qs=require(_0xef28('0xf'));var as=require(_0xef28('0x10'));var hardwareService=require(_0xef28('0x11'));var logger=require(_0xef28('0x12'))(_0xef28('0x13'));var utils=require(_0xef28('0x14'));var config=require(_0xef28('0x15'));var licenseUtil=require(_0xef28('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xca263b,_0x4cc893){_0x4cc893=_0x4cc893||0xcc;return function(_0x19cac3){if(_0x19cac3){return _0xca263b[_0xef28('0x17')](_0x4cc893);}return _0xca263b[_0xef28('0x18')](_0x4cc893)['end']();};}function respondWithResult(_0x2a30a0,_0x3e1528){_0x3e1528=_0x3e1528||0xc8;return function(_0x24f15d){if(_0x24f15d){return _0x2a30a0['status'](_0x3e1528)[_0xef28('0x19')](_0x24f15d);}};}function respondWithFilteredResult(_0x508f99,_0x2f946d){return function(_0x495e32){if(_0x495e32){var _0x23550b=typeof _0x2f946d[_0xef28('0x1a')]===_0xef28('0x1b')&&typeof _0x2f946d[_0xef28('0x1c')]==='undefined';var _0x4c5f12=_0x495e32[_0xef28('0x1d')];var _0x316c09=_0x23550b?0x0:_0x2f946d['offset'];var _0x11a207=_0x23550b?_0x495e32[_0xef28('0x1d')]:_0x2f946d[_0xef28('0x1a')]+_0x2f946d['limit'];var _0x4db800;if(_0x11a207>=_0x4c5f12){_0x11a207=_0x4c5f12;_0x4db800=0xc8;}else{_0x4db800=0xce;}_0x508f99[_0xef28('0x18')](_0x4db800);return _0x508f99[_0xef28('0x1e')]('Content-Range',_0x316c09+'-'+_0x11a207+'/'+_0x4c5f12)[_0xef28('0x19')](_0x495e32);}return null;};}function patchUpdates(_0x2902f5){return function(_0x2c47c0){try{jsonpatch[_0xef28('0x1f')](_0x2c47c0,_0x2902f5,!![]);}catch(_0x5a18d1){return BPromise[_0xef28('0x20')](_0x5a18d1);}return _0x2c47c0[_0xef28('0x21')]();};}function saveUpdates(_0x5f34c5,_0x440bc4){return function(_0x36459d){if(_0x36459d){return _0x36459d[_0xef28('0x22')](_0x5f34c5)['then'](function(_0x31413e){return _0x31413e;});}return null;};}function removeEntity(_0x45414e,_0x1c0278){return function(_0x10084c){if(_0x10084c){return _0x10084c[_0xef28('0x23')]()[_0xef28('0x24')](function(){_0x45414e[_0xef28('0x18')](0xcc)[_0xef28('0x25')]();});}};}function handleEntityNotFound(_0xfd3c0b,_0x14802a){return function(_0x24d13a){if(!_0x24d13a){_0xfd3c0b['sendStatus'](0x194);}return _0x24d13a;};}function handleError(_0x3eee99,_0x287abb){_0x287abb=_0x287abb||0x1f4;return function(_0x4d2ee3){logger[_0xef28('0x26')](_0x4d2ee3[_0xef28('0x27')]);if(_0x4d2ee3['name']){delete _0x4d2ee3[_0xef28('0x28')];}_0x3eee99[_0xef28('0x18')](_0x287abb)['send'](_0x4d2ee3);};}exports[_0xef28('0x29')]=function(_0x54026a,_0x2c2de3){var _0x1520dd={},_0x3ede1a={},_0x138b76={'count':0x0,'rows':[]};var _0x5450f8=_['map'](db[_0xef28('0x2a')]['rawAttributes'],function(_0x4808af){return{'name':_0x4808af[_0xef28('0x2b')],'type':_0x4808af[_0xef28('0x2c')]['key']};});_0x3ede1a[_0xef28('0x2d')]=_[_0xef28('0x2e')](_0x5450f8,_0xef28('0x28'));_0x3ede1a['query']=_['keys'](_0x54026a['query']);_0x3ede1a[_0xef28('0x2f')]=_[_0xef28('0x30')](_0x3ede1a[_0xef28('0x2d')],_0x3ede1a[_0xef28('0x31')]);_0x1520dd[_0xef28('0x32')]=_[_0xef28('0x30')](_0x3ede1a['model'],qs[_0xef28('0x33')](_0x54026a[_0xef28('0x31')]['fields']));_0x1520dd[_0xef28('0x32')]=_0x1520dd[_0xef28('0x32')]['length']?_0x1520dd['attributes']:_0x3ede1a[_0xef28('0x2d')];if(!_0x54026a[_0xef28('0x31')]['hasOwnProperty'](_0xef28('0x34'))){_0x1520dd[_0xef28('0x1c')]=qs[_0xef28('0x1c')](_0x54026a[_0xef28('0x31')]['limit']);_0x1520dd[_0xef28('0x1a')]=qs['offset'](_0x54026a['query'][_0xef28('0x1a')]);}_0x1520dd['order']=qs['sort'](_0x54026a[_0xef28('0x31')]['sort']);_0x1520dd[_0xef28('0x35')]=qs[_0xef28('0x2f')](_[_0xef28('0x36')](_0x54026a[_0xef28('0x31')],_0x3ede1a[_0xef28('0x2f')]),_0x5450f8);if(_0x54026a[_0xef28('0x31')][_0xef28('0x37')]){_0x1520dd[_0xef28('0x35')]=_[_0xef28('0x38')](_0x1520dd[_0xef28('0x35')],{'$or':_[_0xef28('0x2e')](_0x5450f8,function(_0x1e8502){if(_0x1e8502[_0xef28('0x2c')]!=='VIRTUAL'){var _0x35e104={};_0x35e104[_0x1e8502[_0xef28('0x28')]]={'$like':'%'+_0x54026a[_0xef28('0x31')]['filter']+'%'};return _0x35e104;}})});}_0x1520dd=_[_0xef28('0x38')]({},_0x1520dd,_0x54026a['options']);var _0x4c83d2={'where':_0x1520dd[_0xef28('0x35')]};return db[_0xef28('0x2a')][_0xef28('0x1d')](_0x4c83d2)[_0xef28('0x24')](function(_0x4d01e4){_0x138b76[_0xef28('0x1d')]=_0x4d01e4;if(_0x54026a[_0xef28('0x31')][_0xef28('0x39')]){_0x1520dd['include']=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x1520dd);})[_0xef28('0x24')](function(_0x4c704a){_0x138b76[_0xef28('0x3a')]=_0x4c704a;return _0x138b76;})['then'](respondWithFilteredResult(_0x2c2de3,_0x1520dd))[_0xef28('0x3b')](handleError(_0x2c2de3,null));};exports[_0xef28('0x3c')]=function(_0x338e36,_0x16d917){var _0x1c98d4={'raw':!![],'where':{'id':_0x338e36[_0xef28('0x3d')]['id']}},_0xccd5c6={};_0xccd5c6[_0xef28('0x2d')]=_[_0xef28('0x3e')](db[_0xef28('0x2a')][_0xef28('0x3f')]);_0xccd5c6[_0xef28('0x31')]=_['keys'](_0x338e36['query']);_0xccd5c6[_0xef28('0x2f')]=_[_0xef28('0x30')](_0xccd5c6[_0xef28('0x2d')],_0xccd5c6['query']);_0x1c98d4[_0xef28('0x32')]=_[_0xef28('0x30')](_0xccd5c6[_0xef28('0x2d')],qs[_0xef28('0x33')](_0x338e36[_0xef28('0x31')][_0xef28('0x33')]));_0x1c98d4['attributes']=_0x1c98d4['attributes']['length']?_0x1c98d4['attributes']:_0xccd5c6['model'];if(_0x338e36[_0xef28('0x31')][_0xef28('0x39')]){_0x1c98d4[_0xef28('0x40')]=[{'all':!![]}];}_0x1c98d4=_[_0xef28('0x38')]({},_0x1c98d4,_0x338e36[_0xef28('0x41')]);return db[_0xef28('0x2a')]['find'](_0x1c98d4)[_0xef28('0x24')](handleEntityNotFound(_0x16d917,null))[_0xef28('0x24')](respondWithResult(_0x16d917,null))[_0xef28('0x3b')](handleError(_0x16d917,null));};exports[_0xef28('0x42')]=function(_0x18224f,_0x61a2fc){return db['SugarcrmField'][_0xef28('0x42')](_0x18224f[_0xef28('0x43')],{})[_0xef28('0x24')](respondWithResult(_0x61a2fc,0xc9))[_0xef28('0x3b')](handleError(_0x61a2fc,null));};exports[_0xef28('0x22')]=function(_0x2306f9,_0x3f5484){if(_0x2306f9['body']['id']){delete _0x2306f9[_0xef28('0x43')]['id'];}return db[_0xef28('0x2a')][_0xef28('0x44')]({'where':{'id':_0x2306f9[_0xef28('0x3d')]['id']}})[_0xef28('0x24')](handleEntityNotFound(_0x3f5484,null))['then'](saveUpdates(_0x2306f9['body'],null))[_0xef28('0x24')](respondWithResult(_0x3f5484,null))[_0xef28('0x3b')](handleError(_0x3f5484,null));};exports[_0xef28('0x23')]=function(_0x468a43,_0x3eb5c1){return db['SugarcrmField'][_0xef28('0x44')]({'where':{'id':_0x468a43[_0xef28('0x3d')]['id']}})[_0xef28('0x24')](handleEntityNotFound(_0x3eb5c1,null))[_0xef28('0x24')](removeEntity(_0x3eb5c1,null))[_0xef28('0x3b')](handleError(_0x3eb5c1,null));}; \ No newline at end of file +var _0x6419=['options','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','keys','filters','intersection','model','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','params','include'];(function(_0x171fb2,_0x3a16c1){var _0x1ff082=function(_0xa8ad13){while(--_0xa8ad13){_0x171fb2['push'](_0x171fb2['shift']());}};_0x1ff082(++_0x3a16c1);}(_0x6419,0x99));var _0x9641=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6419[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9641('0x0'));var zipdir=require(_0x9641('0x1'));var jsonpatch=require(_0x9641('0x2'));var rp=require('request-promise');var moment=require(_0x9641('0x3'));var BPromise=require(_0x9641('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9641('0x5'));var sox=require(_0x9641('0x6'));var csv=require(_0x9641('0x7'));var ejs=require(_0x9641('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9641('0x9'));var squel=require(_0x9641('0xa'));var crypto=require(_0x9641('0xb'));var jsforce=require(_0x9641('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9641('0xd'));var Papa=require(_0x9641('0xe'));var Redis=require('ioredis');var authService=require(_0x9641('0xf'));var qs=require(_0x9641('0x10'));var as=require(_0x9641('0x11'));var hardwareService=require(_0x9641('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9641('0x13'));var config=require(_0x9641('0x14'));var licenseUtil=require(_0x9641('0x15'));var db=require(_0x9641('0x16'))['db'];function respondWithStatusCode(_0x2ed355,_0x39bfeb){_0x39bfeb=_0x39bfeb||0xcc;return function(_0x1e3fb1){if(_0x1e3fb1){return _0x2ed355[_0x9641('0x17')](_0x39bfeb);}return _0x2ed355[_0x9641('0x18')](_0x39bfeb)[_0x9641('0x19')]();};}function respondWithResult(_0x22f0a5,_0x2a7bbd){_0x2a7bbd=_0x2a7bbd||0xc8;return function(_0x45b7e){if(_0x45b7e){return _0x22f0a5['status'](_0x2a7bbd)[_0x9641('0x1a')](_0x45b7e);}};}function respondWithFilteredResult(_0x51e51e,_0x5e3c94){return function(_0x51cbcd){if(_0x51cbcd){var _0x5b93a8=typeof _0x5e3c94['offset']===_0x9641('0x1b')&&typeof _0x5e3c94[_0x9641('0x1c')]===_0x9641('0x1b');var _0x2a1275=_0x51cbcd[_0x9641('0x1d')];var _0x3a91fa=_0x5b93a8?0x0:_0x5e3c94[_0x9641('0x1e')];var _0x2277e8=_0x5b93a8?_0x51cbcd[_0x9641('0x1d')]:_0x5e3c94['offset']+_0x5e3c94[_0x9641('0x1c')];var _0x3dcd82;if(_0x2277e8>=_0x2a1275){_0x2277e8=_0x2a1275;_0x3dcd82=0xc8;}else{_0x3dcd82=0xce;}_0x51e51e[_0x9641('0x18')](_0x3dcd82);return _0x51e51e[_0x9641('0x1f')]('Content-Range',_0x3a91fa+'-'+_0x2277e8+'/'+_0x2a1275)[_0x9641('0x1a')](_0x51cbcd);}return null;};}function patchUpdates(_0x3b41e5){return function(_0x41af93){try{jsonpatch[_0x9641('0x20')](_0x41af93,_0x3b41e5,!![]);}catch(_0x32b970){return BPromise[_0x9641('0x21')](_0x32b970);}return _0x41af93['save']();};}function saveUpdates(_0x51374f,_0x125391){return function(_0xd53e58){if(_0xd53e58){return _0xd53e58[_0x9641('0x22')](_0x51374f)[_0x9641('0x23')](function(_0x2926f3){return _0x2926f3;});}return null;};}function removeEntity(_0x24734e,_0x5af277){return function(_0x2774fb){if(_0x2774fb){return _0x2774fb[_0x9641('0x24')]()[_0x9641('0x23')](function(){_0x24734e[_0x9641('0x18')](0xcc)[_0x9641('0x19')]();});}};}function handleEntityNotFound(_0xa20c1c,_0x5427e5){return function(_0x2d39a6){if(!_0x2d39a6){_0xa20c1c[_0x9641('0x17')](0x194);}return _0x2d39a6;};}function handleError(_0x3f6587,_0x2bc31a){_0x2bc31a=_0x2bc31a||0x1f4;return function(_0x6c6156){logger[_0x9641('0x25')](_0x6c6156[_0x9641('0x26')]);if(_0x6c6156[_0x9641('0x27')]){delete _0x6c6156[_0x9641('0x27')];}_0x3f6587[_0x9641('0x18')](_0x2bc31a)[_0x9641('0x28')](_0x6c6156);};}exports['index']=function(_0x4a6d33,_0x5c60ef){var _0x4bc7b8={},_0xc50a5d={},_0x4a8166={'count':0x0,'rows':[]};var _0x31d709=_[_0x9641('0x29')](db[_0x9641('0x2a')][_0x9641('0x2b')],function(_0x31e710){return{'name':_0x31e710[_0x9641('0x2c')],'type':_0x31e710[_0x9641('0x2d')][_0x9641('0x2e')]};});_0xc50a5d['model']=_[_0x9641('0x29')](_0x31d709,_0x9641('0x27'));_0xc50a5d['query']=_[_0x9641('0x2f')](_0x4a6d33['query']);_0xc50a5d[_0x9641('0x30')]=_[_0x9641('0x31')](_0xc50a5d[_0x9641('0x32')],_0xc50a5d['query']);_0x4bc7b8['attributes']=_[_0x9641('0x31')](_0xc50a5d[_0x9641('0x32')],qs[_0x9641('0x33')](_0x4a6d33[_0x9641('0x34')][_0x9641('0x33')]));_0x4bc7b8[_0x9641('0x35')]=_0x4bc7b8['attributes'][_0x9641('0x36')]?_0x4bc7b8[_0x9641('0x35')]:_0xc50a5d['model'];if(!_0x4a6d33['query'][_0x9641('0x37')](_0x9641('0x38'))){_0x4bc7b8[_0x9641('0x1c')]=qs['limit'](_0x4a6d33[_0x9641('0x34')][_0x9641('0x1c')]);_0x4bc7b8[_0x9641('0x1e')]=qs[_0x9641('0x1e')](_0x4a6d33[_0x9641('0x34')]['offset']);}_0x4bc7b8[_0x9641('0x39')]=qs[_0x9641('0x3a')](_0x4a6d33[_0x9641('0x34')][_0x9641('0x3a')]);_0x4bc7b8[_0x9641('0x3b')]=qs['filters'](_[_0x9641('0x3c')](_0x4a6d33[_0x9641('0x34')],_0xc50a5d[_0x9641('0x30')]),_0x31d709);if(_0x4a6d33[_0x9641('0x34')][_0x9641('0x3d')]){_0x4bc7b8[_0x9641('0x3b')]=_['merge'](_0x4bc7b8[_0x9641('0x3b')],{'$or':_[_0x9641('0x29')](_0x31d709,function(_0x9769b7){if(_0x9769b7[_0x9641('0x2d')]!==_0x9641('0x3e')){var _0x35cf63={};_0x35cf63[_0x9769b7[_0x9641('0x27')]]={'$like':'%'+_0x4a6d33[_0x9641('0x34')][_0x9641('0x3d')]+'%'};return _0x35cf63;}})});}_0x4bc7b8=_[_0x9641('0x3f')]({},_0x4bc7b8,_0x4a6d33['options']);var _0x2d837f={'where':_0x4bc7b8[_0x9641('0x3b')]};return db['SugarcrmField'][_0x9641('0x1d')](_0x2d837f)[_0x9641('0x23')](function(_0x501bf4){_0x4a8166[_0x9641('0x1d')]=_0x501bf4;if(_0x4a6d33[_0x9641('0x34')][_0x9641('0x40')]){_0x4bc7b8['include']=[{'all':!![]}];}return db[_0x9641('0x2a')][_0x9641('0x41')](_0x4bc7b8);})['then'](function(_0x2052c8){_0x4a8166[_0x9641('0x42')]=_0x2052c8;return _0x4a8166;})['then'](respondWithFilteredResult(_0x5c60ef,_0x4bc7b8))['catch'](handleError(_0x5c60ef,null));};exports['show']=function(_0xf227d9,_0x1ace82){var _0x21ca7c={'raw':!![],'where':{'id':_0xf227d9[_0x9641('0x43')]['id']}},_0x278bab={};_0x278bab['model']=_['keys'](db[_0x9641('0x2a')][_0x9641('0x2b')]);_0x278bab[_0x9641('0x34')]=_['keys'](_0xf227d9[_0x9641('0x34')]);_0x278bab[_0x9641('0x30')]=_[_0x9641('0x31')](_0x278bab[_0x9641('0x32')],_0x278bab[_0x9641('0x34')]);_0x21ca7c[_0x9641('0x35')]=_[_0x9641('0x31')](_0x278bab['model'],qs['fields'](_0xf227d9[_0x9641('0x34')][_0x9641('0x33')]));_0x21ca7c[_0x9641('0x35')]=_0x21ca7c[_0x9641('0x35')]['length']?_0x21ca7c[_0x9641('0x35')]:_0x278bab[_0x9641('0x32')];if(_0xf227d9[_0x9641('0x34')][_0x9641('0x40')]){_0x21ca7c[_0x9641('0x44')]=[{'all':!![]}];}_0x21ca7c=_['merge']({},_0x21ca7c,_0xf227d9[_0x9641('0x45')]);return db[_0x9641('0x2a')][_0x9641('0x46')](_0x21ca7c)['then'](handleEntityNotFound(_0x1ace82,null))[_0x9641('0x23')](respondWithResult(_0x1ace82,null))[_0x9641('0x47')](handleError(_0x1ace82,null));};exports[_0x9641('0x48')]=function(_0x2ac20f,_0x5860ac){return db[_0x9641('0x2a')][_0x9641('0x48')](_0x2ac20f[_0x9641('0x49')],{})['then'](respondWithResult(_0x5860ac,0xc9))['catch'](handleError(_0x5860ac,null));};exports[_0x9641('0x22')]=function(_0x42a120,_0x32a7bd){if(_0x42a120['body']['id']){delete _0x42a120[_0x9641('0x49')]['id'];}return db[_0x9641('0x2a')][_0x9641('0x46')]({'where':{'id':_0x42a120[_0x9641('0x43')]['id']}})[_0x9641('0x23')](handleEntityNotFound(_0x32a7bd,null))['then'](saveUpdates(_0x42a120['body'],null))['then'](respondWithResult(_0x32a7bd,null))[_0x9641('0x47')](handleError(_0x32a7bd,null));};exports[_0x9641('0x24')]=function(_0x49fee5,_0x49cd0d){return db[_0x9641('0x2a')][_0x9641('0x46')]({'where':{'id':_0x49fee5['params']['id']}})[_0x9641('0x23')](handleEntityNotFound(_0x49cd0d,null))['then'](removeEntity(_0x49cd0d,null))[_0x9641('0x47')](handleError(_0x49cd0d,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 0fd238a..bc38b4b 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 _0x2459=['idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x5ea15f,_0x2ee943){var _0x56908e=function(_0x34c787){while(--_0x34c787){_0x5ea15f['push'](_0x5ea15f['shift']());}};_0x56908e(++_0x2ee943);}(_0x2459,0x188));var _0x9245=function(_0x3d0098,_0x22ee82){_0x3d0098=_0x3d0098-0x0;var _0x3ef587=_0x2459[_0x3d0098];return _0x3ef587;};'use strict';var _=require(_0x9245('0x0'));var util=require(_0x9245('0x1'));var logger=require(_0x9245('0x2'))('api');var moment=require(_0x9245('0x3'));var BPromise=require(_0x9245('0x4'));var rp=require(_0x9245('0x5'));var fs=require('fs');var path=require(_0x9245('0x6'));var rimraf=require(_0x9245('0x7'));var config=require(_0x9245('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x9245('0x9')]=function(_0x30c574,_0x5d7087){return _0x30c574[_0x9245('0xa')]('SugarcrmField',attributes,{'tableName':_0x9245('0xb'),'paranoid':![],'indexes':[{'name':_0x9245('0xc'),'fields':[_0x9245('0xd'),_0x9245('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9662=['../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x29f5b4,_0x6bc829){var _0x14ac53=function(_0x55abf4){while(--_0x55abf4){_0x29f5b4['push'](_0x29f5b4['shift']());}};_0x14ac53(++_0x6bc829);}(_0x9662,0x156));var _0x2966=function(_0x57d7d5,_0x12070e){_0x57d7d5=_0x57d7d5-0x0;var _0x5e4795=_0x9662[_0x57d7d5];return _0x5e4795;};'use strict';var _=require(_0x2966('0x0'));var util=require(_0x2966('0x1'));var logger=require(_0x2966('0x2'))(_0x2966('0x3'));var moment=require(_0x2966('0x4'));var BPromise=require(_0x2966('0x5'));var rp=require(_0x2966('0x6'));var fs=require('fs');var path=require(_0x2966('0x7'));var rimraf=require('rimraf');var config=require(_0x2966('0x8'));var attributes=require(_0x2966('0x9'));module[_0x2966('0xa')]=function(_0x1638e8,_0x3ad9d4){return _0x1638e8['define'](_0x2966('0xb'),attributes,{'tableName':_0x2966('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x2966('0xd'),'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 9324785..115f745 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 _0x85f6=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x72eae9,_0x5b9119){var _0x1a5e79=function(_0x58641e){while(--_0x58641e){_0x72eae9['push'](_0x72eae9['shift']());}};_0x1a5e79(++_0x5b9119);}(_0x85f6,0xa7));var _0x685f=function(_0x329b97,_0x359a6d){_0x329b97=_0x329b97-0x0;var _0x2d1cc0=_0x85f6[_0x329b97];return _0x2d1cc0;};'use strict';var _=require(_0x685f('0x0'));var util=require(_0x685f('0x1'));var moment=require(_0x685f('0x2'));var BPromise=require(_0x685f('0x3'));var rs=require(_0x685f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x685f('0x5'))['db'];var utils=require(_0x685f('0x6'));var logger=require(_0x685f('0x7'))('rpc');var config=require(_0x685f('0x8'));var jayson=require(_0x685f('0x9'));var client=jayson[_0x685f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bedfb,_0x447393,_0x5ce2bf){return new BPromise(function(_0xc73e41,_0x2c0aea){return client['request'](_0x2bedfb,_0x5ce2bf)[_0x685f('0xb')](function(_0xb0ce2a){logger[_0x685f('0xc')](_0x685f('0xd'),_0x447393,_0x685f('0xe'));logger[_0x685f('0xf')](_0x685f('0x10'),_0x447393,_0x685f('0xe'),JSON[_0x685f('0x11')](_0xb0ce2a));if(_0xb0ce2a['error']){if(_0xb0ce2a[_0x685f('0x12')][_0x685f('0x13')]===0x1f4){logger[_0x685f('0x12')](_0x685f('0xd'),_0x447393,_0xb0ce2a[_0x685f('0x12')][_0x685f('0x14')]);return _0x2c0aea(_0xb0ce2a[_0x685f('0x12')]['message']);}logger[_0x685f('0x12')](_0x685f('0xd'),_0x447393,_0xb0ce2a[_0x685f('0x12')][_0x685f('0x14')]);return _0xc73e41(_0xb0ce2a['error'][_0x685f('0x14')]);}else{logger[_0x685f('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x447393,'request\x20sent');_0xc73e41(_0xb0ce2a[_0x685f('0x15')]['message']);}})[_0x685f('0x16')](function(_0x47dc90){logger['error'](_0x685f('0xd'),_0x447393,_0x47dc90);_0x2c0aea(_0x47dc90);});});} \ No newline at end of file +var _0xc9a9=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','SugarcrmField,\x20%s,\x20%s','message','lodash','util','moment'];(function(_0x5532d7,_0x55873a){var _0x56acae=function(_0x12d7b1){while(--_0x12d7b1){_0x5532d7['push'](_0x5532d7['shift']());}};_0x56acae(++_0x55873a);}(_0xc9a9,0x18d));var _0x9c9a=function(_0x4789a9,_0x48168a){_0x4789a9=_0x4789a9-0x0;var _0x132ff4=_0xc9a9[_0x4789a9];return _0x132ff4;};'use strict';var _=require(_0x9c9a('0x0'));var util=require(_0x9c9a('0x1'));var moment=require(_0x9c9a('0x2'));var BPromise=require(_0x9c9a('0x3'));var rs=require(_0x9c9a('0x4'));var fs=require('fs');var Redis=require(_0x9c9a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c9a('0x6'));var logger=require(_0x9c9a('0x7'))(_0x9c9a('0x8'));var config=require(_0x9c9a('0x9'));var jayson=require(_0x9c9a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4bee0f,_0xa976c0,_0x557c15){return new BPromise(function(_0x1c7c86,_0x103b58){return client[_0x9c9a('0xb')](_0x4bee0f,_0x557c15)[_0x9c9a('0xc')](function(_0x53fcb8){logger[_0x9c9a('0xd')]('SugarcrmField,\x20%s,\x20%s',_0xa976c0,_0x9c9a('0xe'));logger['debug'](_0x9c9a('0xf'),_0xa976c0,'request\x20sent',JSON['stringify'](_0x53fcb8));if(_0x53fcb8[_0x9c9a('0x10')]){if(_0x53fcb8[_0x9c9a('0x10')][_0x9c9a('0x11')]===0x1f4){logger[_0x9c9a('0x10')](_0x9c9a('0x12'),_0xa976c0,_0x53fcb8['error'][_0x9c9a('0x13')]);return _0x103b58(_0x53fcb8['error']['message']);}logger[_0x9c9a('0x10')]('SugarcrmField,\x20%s,\x20%s',_0xa976c0,_0x53fcb8[_0x9c9a('0x10')][_0x9c9a('0x13')]);return _0x1c7c86(_0x53fcb8[_0x9c9a('0x10')]['message']);}else{logger[_0x9c9a('0xd')](_0x9c9a('0x12'),_0xa976c0,_0x9c9a('0xe'));_0x1c7c86(_0x53fcb8['result'][_0x9c9a('0x13')]);}})['catch'](function(_0x534449){logger[_0x9c9a('0x10')](_0x9c9a('0x12'),_0xa976c0,_0x534449);_0x103b58(_0x534449);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 67b82f8..8b55ada 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 _0xa663=['util','connect-timeout','express','Router','./intVtigerAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','post','create','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x53f37f,_0xfb0b18){var _0x2fe5f8=function(_0x76ef2d){while(--_0x76ef2d){_0x53f37f['push'](_0x53f37f['shift']());}};_0x2fe5f8(++_0xfb0b18);}(_0xa663,0xc7));var _0x3a66=function(_0xd05d0e,_0x222ec6){_0xd05d0e=_0xd05d0e-0x0;var _0xa812c=_0xa663[_0xd05d0e];return _0xa812c;};'use strict';var multer=require(_0x3a66('0x0'));var util=require(_0x3a66('0x1'));var path=require('path');var timeout=require(_0x3a66('0x2'));var express=require(_0x3a66('0x3'));var router=express[_0x3a66('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3a66('0x5'));router[_0x3a66('0x6')]('/',auth['isAuthenticated'](),controller[_0x3a66('0x7')]);router['get'](_0x3a66('0x8'),auth[_0x3a66('0x9')](),controller[_0x3a66('0xa')]);router[_0x3a66('0x6')](_0x3a66('0xb'),auth[_0x3a66('0x9')](),controller['getConfigurations']);router[_0x3a66('0x6')]('/:id/fields',auth[_0x3a66('0x9')](),controller['getFields']);router[_0x3a66('0xc')]('/',auth['isAuthenticated'](),controller[_0x3a66('0xd')]);router['post'](_0x3a66('0xb'),auth['isAuthenticated'](),controller[_0x3a66('0xe')]);router[_0x3a66('0xf')](_0x3a66('0x8'),auth[_0x3a66('0x9')](),controller[_0x3a66('0x10')]);router[_0x3a66('0x11')](_0x3a66('0x8'),auth[_0x3a66('0x9')](),controller[_0x3a66('0x12')]);module[_0x3a66('0x13')]=router; \ No newline at end of file +var _0x21d1=['Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x1d93c6,_0x581245){var _0x1eca3c=function(_0x12fa36){while(--_0x12fa36){_0x1d93c6['push'](_0x1d93c6['shift']());}};_0x1eca3c(++_0x581245);}(_0x21d1,0x1c9));var _0x121d=function(_0x5e62af,_0x643a15){_0x5e62af=_0x5e62af-0x0;var _0x1ce5bb=_0x21d1[_0x5e62af];return _0x1ce5bb;};'use strict';var multer=require(_0x121d('0x0'));var util=require(_0x121d('0x1'));var path=require(_0x121d('0x2'));var timeout=require(_0x121d('0x3'));var express=require(_0x121d('0x4'));var router=express[_0x121d('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x121d('0x6'));var config=require(_0x121d('0x7'));var controller=require(_0x121d('0x8'));router[_0x121d('0x9')]('/',auth[_0x121d('0xa')](),controller['index']);router[_0x121d('0x9')](_0x121d('0xb'),auth[_0x121d('0xa')](),controller[_0x121d('0xc')]);router[_0x121d('0x9')](_0x121d('0xd'),auth[_0x121d('0xa')](),controller[_0x121d('0xe')]);router[_0x121d('0x9')](_0x121d('0xf'),auth['isAuthenticated'](),controller[_0x121d('0x10')]);router[_0x121d('0x11')]('/',auth[_0x121d('0xa')](),controller['create']);router['post'](_0x121d('0xd'),auth[_0x121d('0xa')](),controller[_0x121d('0x12')]);router['put']('/:id',auth[_0x121d('0xa')](),controller['update']);router[_0x121d('0x13')](_0x121d('0xb'),auth[_0x121d('0xa')](),controller['destroy']);module[_0x121d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 082ebfa..dd8a72d 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 _0x6000=['HelpDesk','sequelize','exports','STRING'];(function(_0x307c57,_0x2ff9e5){var _0x232faa=function(_0xef7f){while(--_0xef7f){_0x307c57['push'](_0x307c57['shift']());}};_0x232faa(++_0x2ff9e5);}(_0x6000,0xc1));var _0x0600=function(_0x545c56,_0x5306b0){_0x545c56=_0x545c56-0x0;var _0x1c9cea=_0x6000[_0x545c56];return _0x1c9cea;};'use strict';var Sequelize=require(_0x0600('0x0'));module[_0x0600('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x0600('0x2')]},'username':{'type':Sequelize[_0x0600('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x0600('0x2')],'allowNull':![],'defaultValue':_0x0600('0x3')},'remoteUri':{'type':Sequelize[_0x0600('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0600('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x0600('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1404=['STRING','HelpDesk','sequelize'];(function(_0x46a814,_0x254aab){var _0x558714=function(_0x21d470){while(--_0x21d470){_0x46a814['push'](_0x46a814['shift']());}};_0x558714(++_0x254aab);}(_0x1404,0xec));var _0x4140=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x1404[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x4140('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4140('0x1')]},'username':{'type':Sequelize[_0x4140('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4140('0x1')],'allowNull':![],'defaultValue':_0x4140('0x2')},'remoteUri':{'type':Sequelize[_0x4140('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4140('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4140('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 a8cba5b..7b86339 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 _0xc5ab=['label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','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','undefined','limit','count','set','Content-Range','apply','save','then','sendStatus','stack','name','index','map','VtigerAccount','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','body','find','destroy','getConfigurations','findOne','VtigerConfiguration','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','editable','false'];(function(_0x43566f,_0x2a6d40){var _0x11ebe6=function(_0x60dc8f){while(--_0x60dc8f){_0x43566f['push'](_0x43566f['shift']());}};_0x11ebe6(++_0x2a6d40);}(_0xc5ab,0x190));var _0xbc5a=function(_0x1a30a0,_0x16a720){_0x1a30a0=_0x1a30a0-0x0;var _0x23c9c2=_0xc5ab[_0x1a30a0];return _0x23c9c2;};'use strict';var emlformat=require(_0xbc5a('0x0'));var rimraf=require(_0xbc5a('0x1'));var zipdir=require(_0xbc5a('0x2'));var jsonpatch=require(_0xbc5a('0x3'));var rp=require(_0xbc5a('0x4'));var moment=require(_0xbc5a('0x5'));var BPromise=require(_0xbc5a('0x6'));var Mustache=require(_0xbc5a('0x7'));var util=require(_0xbc5a('0x8'));var path=require(_0xbc5a('0x9'));var sox=require(_0xbc5a('0xa'));var csv=require(_0xbc5a('0xb'));var ejs=require(_0xbc5a('0xc'));var fs=require('fs');var fs_extra=require(_0xbc5a('0xd'));var _=require('lodash');var squel=require(_0xbc5a('0xe'));var crypto=require(_0xbc5a('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xbc5a('0x10'));var toCsv=require(_0xbc5a('0xb'));var querystring=require(_0xbc5a('0x11'));var Papa=require(_0xbc5a('0x12'));var Redis=require(_0xbc5a('0x13'));var authService=require(_0xbc5a('0x14'));var qs=require(_0xbc5a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc5a('0x16'));var logger=require(_0xbc5a('0x17'))(_0xbc5a('0x18'));var utils=require(_0xbc5a('0x19'));var config=require(_0xbc5a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc5a('0x1b'))['db'];var integrations=require(_0xbc5a('0x1c'));function respondWithStatusCode(_0x253f78,_0x1000f7){_0x1000f7=_0x1000f7||0xcc;return function(_0x2beeba){if(_0x2beeba){return _0x253f78['sendStatus'](_0x1000f7);}return _0x253f78[_0xbc5a('0x1d')](_0x1000f7)['end']();};}function respondWithResult(_0x22dfca,_0xdf8670){_0xdf8670=_0xdf8670||0xc8;return function(_0x535606){if(_0x535606){return _0x22dfca[_0xbc5a('0x1d')](_0xdf8670)[_0xbc5a('0x1e')](_0x535606);}};}function respondWithFilteredResult(_0xc36f49,_0x26afb9){return function(_0x5008a3){if(_0x5008a3){var _0x20ea03=typeof _0x26afb9[_0xbc5a('0x1f')]===_0xbc5a('0x20')&&typeof _0x26afb9[_0xbc5a('0x21')]===_0xbc5a('0x20');var _0x42ba8e=_0x5008a3['count'];var _0x3a01a0=_0x20ea03?0x0:_0x26afb9['offset'];var _0x214023=_0x20ea03?_0x5008a3[_0xbc5a('0x22')]:_0x26afb9[_0xbc5a('0x1f')]+_0x26afb9[_0xbc5a('0x21')];var _0x40a2cd;if(_0x214023>=_0x42ba8e){_0x214023=_0x42ba8e;_0x40a2cd=0xc8;}else{_0x40a2cd=0xce;}_0xc36f49[_0xbc5a('0x1d')](_0x40a2cd);return _0xc36f49[_0xbc5a('0x23')](_0xbc5a('0x24'),_0x3a01a0+'-'+_0x214023+'/'+_0x42ba8e)[_0xbc5a('0x1e')](_0x5008a3);}return null;};}function patchUpdates(_0x2460e3){return function(_0x24778d){try{jsonpatch[_0xbc5a('0x25')](_0x24778d,_0x2460e3,!![]);}catch(_0x5889c4){return BPromise['reject'](_0x5889c4);}return _0x24778d[_0xbc5a('0x26')]();};}function saveUpdates(_0x5d3015,_0x19c664){return function(_0x3831af){if(_0x3831af){return _0x3831af['update'](_0x5d3015)[_0xbc5a('0x27')](function(_0x1c58fe){return _0x1c58fe;});}return null;};}function removeEntity(_0x5a3ea6,_0xbfa91c){return function(_0x5cb487){if(_0x5cb487){return _0x5cb487['destroy']()['then'](function(){_0x5a3ea6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d8f4,_0x15bb3e){return function(_0x5cc81e){if(!_0x5cc81e){_0x46d8f4[_0xbc5a('0x28')](0x194);}return _0x5cc81e;};}function handleError(_0x3be71f,_0x7fb60c){_0x7fb60c=_0x7fb60c||0x1f4;return function(_0x3e9fa4){logger['error'](_0x3e9fa4[_0xbc5a('0x29')]);if(_0x3e9fa4[_0xbc5a('0x2a')]){delete _0x3e9fa4[_0xbc5a('0x2a')];}_0x3be71f[_0xbc5a('0x1d')](_0x7fb60c)['send'](_0x3e9fa4);};}exports[_0xbc5a('0x2b')]=function(_0x36c69a,_0x27a088){var _0x4fcf72={},_0x1cf7b7={},_0x59b715={'count':0x0,'rows':[]};var _0x25af80=_[_0xbc5a('0x2c')](db[_0xbc5a('0x2d')]['rawAttributes'],function(_0x380ee4){return{'name':_0x380ee4['fieldName'],'type':_0x380ee4[_0xbc5a('0x2e')][_0xbc5a('0x2f')]};});_0x1cf7b7[_0xbc5a('0x30')]=_[_0xbc5a('0x2c')](_0x25af80,'name');_0x1cf7b7[_0xbc5a('0x31')]=_[_0xbc5a('0x32')](_0x36c69a[_0xbc5a('0x31')]);_0x1cf7b7['filters']=_[_0xbc5a('0x33')](_0x1cf7b7[_0xbc5a('0x30')],_0x1cf7b7[_0xbc5a('0x31')]);_0x4fcf72[_0xbc5a('0x34')]=_['intersection'](_0x1cf7b7['model'],qs[_0xbc5a('0x35')](_0x36c69a['query'][_0xbc5a('0x35')]));_0x4fcf72['attributes']=_0x4fcf72['attributes'][_0xbc5a('0x36')]?_0x4fcf72[_0xbc5a('0x34')]:_0x1cf7b7['model'];if(!_0x36c69a[_0xbc5a('0x31')][_0xbc5a('0x37')](_0xbc5a('0x38'))){_0x4fcf72[_0xbc5a('0x21')]=qs['limit'](_0x36c69a[_0xbc5a('0x31')][_0xbc5a('0x21')]);_0x4fcf72['offset']=qs[_0xbc5a('0x1f')](_0x36c69a[_0xbc5a('0x31')]['offset']);}_0x4fcf72[_0xbc5a('0x39')]=qs[_0xbc5a('0x3a')](_0x36c69a[_0xbc5a('0x31')]['sort']);_0x4fcf72[_0xbc5a('0x3b')]=qs[_0xbc5a('0x3c')](_['pick'](_0x36c69a[_0xbc5a('0x31')],_0x1cf7b7[_0xbc5a('0x3c')]),_0x25af80);if(_0x36c69a['query'][_0xbc5a('0x3d')]){_0x4fcf72[_0xbc5a('0x3b')]=_[_0xbc5a('0x3e')](_0x4fcf72['where'],{'$or':_[_0xbc5a('0x2c')](_0x25af80,function(_0xf4c0ec){if(_0xf4c0ec[_0xbc5a('0x2e')]!==_0xbc5a('0x3f')){var _0x3da5fc={};_0x3da5fc[_0xf4c0ec[_0xbc5a('0x2a')]]={'$like':'%'+_0x36c69a[_0xbc5a('0x31')]['filter']+'%'};return _0x3da5fc;}})});}_0x4fcf72=_[_0xbc5a('0x3e')]({},_0x4fcf72,_0x36c69a[_0xbc5a('0x40')]);var _0x11a3bf={'where':_0x4fcf72[_0xbc5a('0x3b')]};return db[_0xbc5a('0x2d')][_0xbc5a('0x22')](_0x11a3bf)[_0xbc5a('0x27')](function(_0x5d351a){_0x59b715[_0xbc5a('0x22')]=_0x5d351a;if(_0x36c69a[_0xbc5a('0x31')][_0xbc5a('0x41')]){_0x4fcf72[_0xbc5a('0x42')]=[{'all':!![]}];}return db[_0xbc5a('0x2d')][_0xbc5a('0x43')](_0x4fcf72);})[_0xbc5a('0x27')](function(_0x4b43c1){_0x59b715['rows']=_0x4b43c1;return _0x59b715;})[_0xbc5a('0x27')](respondWithFilteredResult(_0x27a088,_0x4fcf72))[_0xbc5a('0x44')](handleError(_0x27a088,null));};exports[_0xbc5a('0x45')]=function(_0x31819d,_0x3fda50){var _0x56826d={'raw':![],'where':{'id':_0x31819d[_0xbc5a('0x46')]['id']}},_0x22e7fe={};_0x22e7fe[_0xbc5a('0x30')]=_[_0xbc5a('0x32')](db[_0xbc5a('0x2d')][_0xbc5a('0x47')]);_0x22e7fe[_0xbc5a('0x31')]=_[_0xbc5a('0x32')](_0x31819d['query']);_0x22e7fe[_0xbc5a('0x3c')]=_[_0xbc5a('0x33')](_0x22e7fe[_0xbc5a('0x30')],_0x22e7fe['query']);_0x56826d[_0xbc5a('0x34')]=_[_0xbc5a('0x33')](_0x22e7fe[_0xbc5a('0x30')],qs[_0xbc5a('0x35')](_0x31819d[_0xbc5a('0x31')]['fields']));_0x56826d[_0xbc5a('0x34')]=_0x56826d[_0xbc5a('0x34')][_0xbc5a('0x36')]?_0x56826d[_0xbc5a('0x34')]:_0x22e7fe[_0xbc5a('0x30')];if(_0x31819d['query'][_0xbc5a('0x41')]){_0x56826d[_0xbc5a('0x42')]=[{'all':!![]}];}_0x56826d=_[_0xbc5a('0x3e')]({},_0x56826d,_0x31819d[_0xbc5a('0x40')]);return db[_0xbc5a('0x2d')]['find'](_0x56826d)[_0xbc5a('0x27')](handleEntityNotFound(_0x3fda50,null))['then'](respondWithResult(_0x3fda50,null))[_0xbc5a('0x44')](handleError(_0x3fda50,null));};exports['create']=function(_0x50a96e,_0xb187d3){return db[_0xbc5a('0x2d')]['create'](_0x50a96e[_0xbc5a('0x48')],{})[_0xbc5a('0x27')](respondWithResult(_0xb187d3,0xc9))[_0xbc5a('0x44')](handleError(_0xb187d3,null));};exports['update']=function(_0x511e67,_0x31c098){if(_0x511e67[_0xbc5a('0x48')]['id']){delete _0x511e67[_0xbc5a('0x48')]['id'];}return db[_0xbc5a('0x2d')][_0xbc5a('0x49')]({'where':{'id':_0x511e67[_0xbc5a('0x46')]['id']}})[_0xbc5a('0x27')](handleEntityNotFound(_0x31c098,null))['then'](saveUpdates(_0x511e67[_0xbc5a('0x48')],null))[_0xbc5a('0x27')](respondWithResult(_0x31c098,null))[_0xbc5a('0x44')](handleError(_0x31c098,null));};exports[_0xbc5a('0x4a')]=function(_0x2bdd6d,_0x1c6512){return db[_0xbc5a('0x2d')][_0xbc5a('0x49')]({'where':{'id':_0x2bdd6d[_0xbc5a('0x46')]['id']}})[_0xbc5a('0x27')](handleEntityNotFound(_0x1c6512,null))[_0xbc5a('0x27')](removeEntity(_0x1c6512,null))[_0xbc5a('0x44')](handleError(_0x1c6512,null));};exports[_0xbc5a('0x4b')]=function(_0x541094,_0x20fe93,_0x389cfa){var _0x345d3e={};var _0x433e25={};var _0x42e3de;var _0x217e0b;return db[_0xbc5a('0x2d')][_0xbc5a('0x4c')]({'where':{'id':_0x541094[_0xbc5a('0x46')]['id']}})[_0xbc5a('0x27')](handleEntityNotFound(_0x20fe93,null))[_0xbc5a('0x27')](function(_0x4082ac){if(_0x4082ac){_0x42e3de=_0x4082ac;_0x433e25['model']=_['keys'](db[_0xbc5a('0x4d')]['rawAttributes']);_0x433e25['query']=_[_0xbc5a('0x32')](_0x541094[_0xbc5a('0x31')]);_0x433e25[_0xbc5a('0x3c')]=_[_0xbc5a('0x33')](_0x433e25[_0xbc5a('0x30')],_0x433e25['query']);_0x345d3e[_0xbc5a('0x34')]=_[_0xbc5a('0x33')](_0x433e25[_0xbc5a('0x30')],qs[_0xbc5a('0x35')](_0x541094['query'][_0xbc5a('0x35')]));_0x345d3e[_0xbc5a('0x34')]=_0x345d3e[_0xbc5a('0x34')][_0xbc5a('0x36')]?_0x345d3e['attributes']:_0x433e25['model'];_0x345d3e[_0xbc5a('0x39')]=qs[_0xbc5a('0x3a')](_0x541094[_0xbc5a('0x31')]['sort']);_0x345d3e[_0xbc5a('0x3b')]=qs[_0xbc5a('0x3c')](_[_0xbc5a('0x4e')](_0x541094[_0xbc5a('0x31')],_0x433e25[_0xbc5a('0x3c')]));if(_0x541094[_0xbc5a('0x31')][_0xbc5a('0x3d')]){_0x345d3e[_0xbc5a('0x3b')]=_[_0xbc5a('0x3e')](_0x345d3e[_0xbc5a('0x3b')],{'$or':_[_0xbc5a('0x2c')](_0x345d3e[_0xbc5a('0x34')],function(_0x168dcc){var _0x2cc8d2={};_0x2cc8d2[_0x168dcc]={'$like':'%'+_0x541094[_0xbc5a('0x31')]['filter']+'%'};return _0x2cc8d2;})});}_0x345d3e=_['merge']({},_0x345d3e,_0x541094[_0xbc5a('0x40')]);return _0x42e3de[_0xbc5a('0x4b')](_0x345d3e);}})[_0xbc5a('0x27')](function(_0x544669){if(_0x544669){_0x217e0b=_0x544669[_0xbc5a('0x36')];if(!_0x541094[_0xbc5a('0x31')][_0xbc5a('0x37')](_0xbc5a('0x38'))){_0x345d3e[_0xbc5a('0x21')]=qs[_0xbc5a('0x21')](_0x541094[_0xbc5a('0x31')]['limit']);_0x345d3e[_0xbc5a('0x1f')]=qs[_0xbc5a('0x1f')](_0x541094[_0xbc5a('0x31')][_0xbc5a('0x1f')]);}return _0x42e3de[_0xbc5a('0x4b')](_0x345d3e);}})[_0xbc5a('0x27')](function(_0x130139){if(_0x130139){return _0x130139?{'count':_0x217e0b,'rows':_0x130139}:null;}})[_0xbc5a('0x27')](respondWithResult(_0x20fe93,null))[_0xbc5a('0x44')](handleError(_0x20fe93,null));};exports[_0xbc5a('0x4f')]=function(_0x1658da,_0x19aa09,_0x38d348){if(_0x1658da[_0xbc5a('0x48')]['id']){delete _0x1658da[_0xbc5a('0x48')]['id'];}return db[_0xbc5a('0x2d')][_0xbc5a('0x4c')]({'where':{'id':_0x1658da[_0xbc5a('0x46')]['id']}})[_0xbc5a('0x27')](handleEntityNotFound(_0x19aa09,null))[_0xbc5a('0x27')](function(_0x4067e3){if(_0x4067e3){_0x1658da[_0xbc5a('0x48')]['AccountId']=_0x4067e3['id'];_0x1658da[_0xbc5a('0x48')][_0xbc5a('0x50')]=integrations[_0xbc5a('0x51')](_0x1658da[_0xbc5a('0x48')][_0xbc5a('0x52')],_0x1658da[_0xbc5a('0x48')][_0xbc5a('0x2e')]);_0x1658da[_0xbc5a('0x48')][_0xbc5a('0x53')]=integrations[_0xbc5a('0x54')](_0x1658da['body'][_0xbc5a('0x52')],_0x1658da[_0xbc5a('0x48')]['type']);return db[_0xbc5a('0x4d')][_0xbc5a('0x55')](_0x1658da['body'],{'include':[{'model':db[_0xbc5a('0x56')],'as':_0xbc5a('0x50')},{'model':db[_0xbc5a('0x56')],'as':_0xbc5a('0x53')}]});}return null;})[_0xbc5a('0x27')](respondWithResult(_0x19aa09,null))[_0xbc5a('0x44')](handleError(_0x19aa09,null));};var md5=require(_0xbc5a('0x57'));exports['getFields']=function(_0x2a0a44,_0xdfedbd,_0x39c11b){var _0x51f7c5=null;var _0x1a1d7d=null;var _0x2b4755=null;var _0x592241=null;var _0xaef9ee='';return db[_0xbc5a('0x2d')][_0xbc5a('0x4c')]({'where':{'id':_0x2a0a44[_0xbc5a('0x46')]['id']},'attributes':['id',_0xbc5a('0x2a'),_0xbc5a('0x58'),_0xbc5a('0x59'),_0xbc5a('0x5a'),_0xbc5a('0x5b'),_0xbc5a('0x5c'),_0xbc5a('0x5d')]})[_0xbc5a('0x27')](handleEntityNotFound(_0xdfedbd,null))['then'](function(_0x55625d){if(_0x55625d){_0x51f7c5=_0x55625d['username'];_0x1a1d7d=_0x55625d[_0xbc5a('0x5d')];_0x2b4755=_0x55625d[_0xbc5a('0x5a')];_0xaef9ee=_0x55625d[_0xbc5a('0x5b')];var _0x216a07=_0xaef9ee['slice'](-0x1);if(_0x216a07==='/'){_0xaef9ee=_0xaef9ee[_0xbc5a('0x5e')](0x0,_0xaef9ee[_0xbc5a('0x5f')](_0x216a07));}_0x592241=util[_0xbc5a('0x60')]('%s/webservice.php',_0xaef9ee);var _0x47858d={'method':_0xbc5a('0x61'),'uri':_0x592241,'qs':{'operation':_0xbc5a('0x62'),'username':_0x55625d['username']},'json':!![]};return rp(_0x47858d);}})[_0xbc5a('0x27')](function(_0x393dea){if(_0x393dea[_0xbc5a('0x63')]){var _0x23b567={'method':_0xbc5a('0x64'),'uri':_0x592241,'form':{'operation':_0xbc5a('0x65'),'username':_0x51f7c5,'accessKey':md5(_0x393dea[_0xbc5a('0x66')][_0xbc5a('0x67')]+_0x1a1d7d)},'json':!![]};return rp(_0x23b567);}})[_0xbc5a('0x27')](function(_0x5c105d){if(_0x5c105d[_0xbc5a('0x63')]){var _0x50dd94={'method':_0xbc5a('0x61'),'uri':_0x592241,'qs':{'operation':_0xbc5a('0x68'),'username':_0x51f7c5,'sessionName':_0x5c105d[_0xbc5a('0x66')][_0xbc5a('0x69')],'elementType':_0x2b4755},'json':!![]};return rp(_0x50dd94);}})['then'](function(_0x5aaf6f){if(_0x5aaf6f[_0xbc5a('0x63')]){var _0x233055=[_0xbc5a('0x6a'),_0xbc5a('0x6b'),_0xbc5a('0x6c')];_[_0xbc5a('0x6d')](_0x5aaf6f[_0xbc5a('0x66')][_0xbc5a('0x35')],function(_0x3c0d89){return _0x233055['includes'](_0x3c0d89[_0xbc5a('0x2e')][_0xbc5a('0x2a')]);});_['remove'](_0x5aaf6f[_0xbc5a('0x66')][_0xbc5a('0x35')],function(_0x3b777d){return _0x3b777d[_0xbc5a('0x6e')]===_0xbc5a('0x6f');});return{'count':_0x5aaf6f[_0xbc5a('0x66')]['fields'][_0xbc5a('0x36')],'rows':_[_0xbc5a('0x2c')](_0x5aaf6f[_0xbc5a('0x66')][_0xbc5a('0x35')],function(_0x3b5ca1){return{'id':_0x3b5ca1[_0xbc5a('0x2a')],'name':_0x3b5ca1[_0xbc5a('0x70')],'custom':_[_0xbc5a('0x71')](_0x3b5ca1[_0xbc5a('0x2a')],_0xbc5a('0x72'))?!![]:![],'options':_0x3b5ca1[_0xbc5a('0x2e')][_0xbc5a('0x2a')]===_0xbc5a('0x73')&&_0x3b5ca1[_0xbc5a('0x2e')]['picklistValues'][_0xbc5a('0x36')]>0x0?_['map'](_0x3b5ca1[_0xbc5a('0x2e')][_0xbc5a('0x74')],function(_0xcbc1fa){return{'name':_0xcbc1fa[_0xbc5a('0x70')],'value':_0xcbc1fa[_0xbc5a('0x75')]};}):[]};})};}})[_0xbc5a('0x27')](respondWithResult(_0xdfedbd,null))['catch'](function(_0x2689e0){console[_0xbc5a('0x76')](_0xbc5a('0x77')+_0x2689e0);var _0xad3456=_0x2a0a44['query'][_0xbc5a('0x78')]?0x1f4:_0x2689e0[_0xbc5a('0x79')]||0x1f4;logger[_0xbc5a('0x7a')](_0xbc5a('0x7b'),_0xbc5a('0x7c'),_0xad3456,JSON[_0xbc5a('0x7d')](_0x2689e0));delete _0x2689e0[_0xbc5a('0x2a')];if(_0xad3456===0x191){_0xad3456=0x190;}_0xdfedbd[_0xbc5a('0x1d')](_0xad3456)[_0xbc5a('0x7e')](_0x2a0a44[_0xbc5a('0x31')]['test']?{'message':_0xbc5a('0x7f'),'statusCode':_0x2689e0['statusCode']}:_0x2689e0);});}; \ No newline at end of file +var _0x1c55=['startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','lodash','crypto','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','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','end','error','stack','name','send','index','map','VtigerAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','getConfigurations','findOne','nolimit','addConfiguration','channel','Descriptions','VtigerConfiguration','VtigerField','getFields','username','description','remoteUri','serverUrl','accessKey','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','describe','autogenerated','owner','remove','editable','label'];(function(_0x49bca7,_0x1b5e3d){var _0x44ba48=function(_0x336e6e){while(--_0x336e6e){_0x49bca7['push'](_0x49bca7['shift']());}};_0x44ba48(++_0x1b5e3d);}(_0x1c55,0x164));var _0x51c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1c55[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x51c5('0x0'));var rimraf=require(_0x51c5('0x1'));var zipdir=require(_0x51c5('0x2'));var jsonpatch=require(_0x51c5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x51c5('0x4'));var Mustache=require(_0x51c5('0x5'));var util=require('util');var path=require(_0x51c5('0x6'));var sox=require(_0x51c5('0x7'));var csv=require('to-csv');var ejs=require(_0x51c5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51c5('0x9'));var squel=require('squel');var crypto=require(_0x51c5('0xa'));var jsforce=require(_0x51c5('0xb'));var deskjs=require(_0x51c5('0xc'));var toCsv=require(_0x51c5('0xd'));var querystring=require(_0x51c5('0xe'));var Papa=require(_0x51c5('0xf'));var Redis=require(_0x51c5('0x10'));var authService=require(_0x51c5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x51c5('0x12'));var hardwareService=require(_0x51c5('0x13'));var logger=require(_0x51c5('0x14'))(_0x51c5('0x15'));var utils=require('../../config/utils');var config=require(_0x51c5('0x16'));var licenseUtil=require(_0x51c5('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x51c5('0x18'));function respondWithStatusCode(_0x331e3e,_0x4b0dfe){_0x4b0dfe=_0x4b0dfe||0xcc;return function(_0x1eae2c){if(_0x1eae2c){return _0x331e3e[_0x51c5('0x19')](_0x4b0dfe);}return _0x331e3e[_0x51c5('0x1a')](_0x4b0dfe)['end']();};}function respondWithResult(_0x5b9421,_0x327e3e){_0x327e3e=_0x327e3e||0xc8;return function(_0x1b891c){if(_0x1b891c){return _0x5b9421[_0x51c5('0x1a')](_0x327e3e)[_0x51c5('0x1b')](_0x1b891c);}};}function respondWithFilteredResult(_0x2f7f4d,_0x588f69){return function(_0x3b096c){if(_0x3b096c){var _0x2b5f9c=typeof _0x588f69[_0x51c5('0x1c')]===_0x51c5('0x1d')&&typeof _0x588f69[_0x51c5('0x1e')]===_0x51c5('0x1d');var _0x2b59e0=_0x3b096c[_0x51c5('0x1f')];var _0x1d2fa7=_0x2b5f9c?0x0:_0x588f69['offset'];var _0x3a47f7=_0x2b5f9c?_0x3b096c[_0x51c5('0x1f')]:_0x588f69[_0x51c5('0x1c')]+_0x588f69['limit'];var _0x30d516;if(_0x3a47f7>=_0x2b59e0){_0x3a47f7=_0x2b59e0;_0x30d516=0xc8;}else{_0x30d516=0xce;}_0x2f7f4d[_0x51c5('0x1a')](_0x30d516);return _0x2f7f4d[_0x51c5('0x20')](_0x51c5('0x21'),_0x1d2fa7+'-'+_0x3a47f7+'/'+_0x2b59e0)[_0x51c5('0x1b')](_0x3b096c);}return null;};}function patchUpdates(_0x7bd6b1){return function(_0x54410c){try{jsonpatch[_0x51c5('0x22')](_0x54410c,_0x7bd6b1,!![]);}catch(_0x1b332d){return BPromise['reject'](_0x1b332d);}return _0x54410c[_0x51c5('0x23')]();};}function saveUpdates(_0x184d37,_0x3398e6){return function(_0x5c833f){if(_0x5c833f){return _0x5c833f['update'](_0x184d37)[_0x51c5('0x24')](function(_0x458346){return _0x458346;});}return null;};}function removeEntity(_0x1abde0,_0x5dca41){return function(_0x567f1){if(_0x567f1){return _0x567f1['destroy']()['then'](function(){_0x1abde0[_0x51c5('0x1a')](0xcc)[_0x51c5('0x25')]();});}};}function handleEntityNotFound(_0x2f324e,_0x2d2205){return function(_0x33f0ae){if(!_0x33f0ae){_0x2f324e[_0x51c5('0x19')](0x194);}return _0x33f0ae;};}function handleError(_0x24ecef,_0x689ed2){_0x689ed2=_0x689ed2||0x1f4;return function(_0xbc8ad5){logger[_0x51c5('0x26')](_0xbc8ad5[_0x51c5('0x27')]);if(_0xbc8ad5[_0x51c5('0x28')]){delete _0xbc8ad5[_0x51c5('0x28')];}_0x24ecef['status'](_0x689ed2)[_0x51c5('0x29')](_0xbc8ad5);};}exports[_0x51c5('0x2a')]=function(_0x482cb4,_0x4219bd){var _0x83420c={},_0x2eecf7={},_0x9cefab={'count':0x0,'rows':[]};var _0x3cbac8=_[_0x51c5('0x2b')](db[_0x51c5('0x2c')]['rawAttributes'],function(_0x1e47ca){return{'name':_0x1e47ca[_0x51c5('0x2d')],'type':_0x1e47ca[_0x51c5('0x2e')]['key']};});_0x2eecf7[_0x51c5('0x2f')]=_[_0x51c5('0x2b')](_0x3cbac8,_0x51c5('0x28'));_0x2eecf7[_0x51c5('0x30')]=_[_0x51c5('0x31')](_0x482cb4[_0x51c5('0x30')]);_0x2eecf7[_0x51c5('0x32')]=_[_0x51c5('0x33')](_0x2eecf7[_0x51c5('0x2f')],_0x2eecf7[_0x51c5('0x30')]);_0x83420c[_0x51c5('0x34')]=_[_0x51c5('0x33')](_0x2eecf7[_0x51c5('0x2f')],qs['fields'](_0x482cb4[_0x51c5('0x30')][_0x51c5('0x35')]));_0x83420c[_0x51c5('0x34')]=_0x83420c[_0x51c5('0x34')]['length']?_0x83420c[_0x51c5('0x34')]:_0x2eecf7[_0x51c5('0x2f')];if(!_0x482cb4[_0x51c5('0x30')][_0x51c5('0x36')]('nolimit')){_0x83420c[_0x51c5('0x1e')]=qs[_0x51c5('0x1e')](_0x482cb4['query'][_0x51c5('0x1e')]);_0x83420c[_0x51c5('0x1c')]=qs['offset'](_0x482cb4[_0x51c5('0x30')]['offset']);}_0x83420c[_0x51c5('0x37')]=qs['sort'](_0x482cb4[_0x51c5('0x30')][_0x51c5('0x38')]);_0x83420c[_0x51c5('0x39')]=qs[_0x51c5('0x32')](_[_0x51c5('0x3a')](_0x482cb4['query'],_0x2eecf7[_0x51c5('0x32')]),_0x3cbac8);if(_0x482cb4[_0x51c5('0x30')][_0x51c5('0x3b')]){_0x83420c[_0x51c5('0x39')]=_[_0x51c5('0x3c')](_0x83420c[_0x51c5('0x39')],{'$or':_[_0x51c5('0x2b')](_0x3cbac8,function(_0x9af33d){if(_0x9af33d[_0x51c5('0x2e')]!==_0x51c5('0x3d')){var _0x27bf58={};_0x27bf58[_0x9af33d[_0x51c5('0x28')]]={'$like':'%'+_0x482cb4[_0x51c5('0x30')][_0x51c5('0x3b')]+'%'};return _0x27bf58;}})});}_0x83420c=_[_0x51c5('0x3c')]({},_0x83420c,_0x482cb4[_0x51c5('0x3e')]);var _0x4af1e5={'where':_0x83420c[_0x51c5('0x39')]};return db[_0x51c5('0x2c')][_0x51c5('0x1f')](_0x4af1e5)[_0x51c5('0x24')](function(_0x581b21){_0x9cefab['count']=_0x581b21;if(_0x482cb4[_0x51c5('0x30')][_0x51c5('0x3f')]){_0x83420c[_0x51c5('0x40')]=[{'all':!![]}];}return db[_0x51c5('0x2c')][_0x51c5('0x41')](_0x83420c);})['then'](function(_0x492814){_0x9cefab[_0x51c5('0x42')]=_0x492814;return _0x9cefab;})['then'](respondWithFilteredResult(_0x4219bd,_0x83420c))[_0x51c5('0x43')](handleError(_0x4219bd,null));};exports[_0x51c5('0x44')]=function(_0x317c27,_0x19a562){var _0x660e92={'raw':![],'where':{'id':_0x317c27[_0x51c5('0x45')]['id']}},_0x262215={};_0x262215['model']=_[_0x51c5('0x31')](db['VtigerAccount'][_0x51c5('0x46')]);_0x262215[_0x51c5('0x30')]=_[_0x51c5('0x31')](_0x317c27['query']);_0x262215[_0x51c5('0x32')]=_[_0x51c5('0x33')](_0x262215['model'],_0x262215[_0x51c5('0x30')]);_0x660e92[_0x51c5('0x34')]=_[_0x51c5('0x33')](_0x262215[_0x51c5('0x2f')],qs[_0x51c5('0x35')](_0x317c27[_0x51c5('0x30')][_0x51c5('0x35')]));_0x660e92['attributes']=_0x660e92['attributes'][_0x51c5('0x47')]?_0x660e92['attributes']:_0x262215['model'];if(_0x317c27['query'][_0x51c5('0x3f')]){_0x660e92['include']=[{'all':!![]}];}_0x660e92=_[_0x51c5('0x3c')]({},_0x660e92,_0x317c27[_0x51c5('0x3e')]);return db[_0x51c5('0x2c')][_0x51c5('0x48')](_0x660e92)[_0x51c5('0x24')](handleEntityNotFound(_0x19a562,null))[_0x51c5('0x24')](respondWithResult(_0x19a562,null))['catch'](handleError(_0x19a562,null));};exports[_0x51c5('0x49')]=function(_0x17e2ef,_0x58a89c){return db[_0x51c5('0x2c')][_0x51c5('0x49')](_0x17e2ef['body'],{})['then'](respondWithResult(_0x58a89c,0xc9))[_0x51c5('0x43')](handleError(_0x58a89c,null));};exports['update']=function(_0x40bd6d,_0x2ac76b){if(_0x40bd6d['body']['id']){delete _0x40bd6d[_0x51c5('0x4a')]['id'];}return db[_0x51c5('0x2c')][_0x51c5('0x48')]({'where':{'id':_0x40bd6d[_0x51c5('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ac76b,null))['then'](saveUpdates(_0x40bd6d[_0x51c5('0x4a')],null))[_0x51c5('0x24')](respondWithResult(_0x2ac76b,null))['catch'](handleError(_0x2ac76b,null));};exports['destroy']=function(_0x5a1508,_0x11cad3){return db['VtigerAccount']['find']({'where':{'id':_0x5a1508[_0x51c5('0x45')]['id']}})[_0x51c5('0x24')](handleEntityNotFound(_0x11cad3,null))[_0x51c5('0x24')](removeEntity(_0x11cad3,null))[_0x51c5('0x43')](handleError(_0x11cad3,null));};exports[_0x51c5('0x4b')]=function(_0x39f594,_0x23be3f,_0x98133e){var _0x21c06b={};var _0x2be05c={};var _0x25bccb;var _0xfc2706;return db[_0x51c5('0x2c')][_0x51c5('0x4c')]({'where':{'id':_0x39f594[_0x51c5('0x45')]['id']}})[_0x51c5('0x24')](handleEntityNotFound(_0x23be3f,null))[_0x51c5('0x24')](function(_0x164599){if(_0x164599){_0x25bccb=_0x164599;_0x2be05c[_0x51c5('0x2f')]=_['keys'](db['VtigerConfiguration'][_0x51c5('0x46')]);_0x2be05c[_0x51c5('0x30')]=_[_0x51c5('0x31')](_0x39f594['query']);_0x2be05c[_0x51c5('0x32')]=_['intersection'](_0x2be05c['model'],_0x2be05c[_0x51c5('0x30')]);_0x21c06b[_0x51c5('0x34')]=_['intersection'](_0x2be05c[_0x51c5('0x2f')],qs['fields'](_0x39f594[_0x51c5('0x30')][_0x51c5('0x35')]));_0x21c06b[_0x51c5('0x34')]=_0x21c06b[_0x51c5('0x34')][_0x51c5('0x47')]?_0x21c06b[_0x51c5('0x34')]:_0x2be05c[_0x51c5('0x2f')];_0x21c06b[_0x51c5('0x37')]=qs[_0x51c5('0x38')](_0x39f594['query'][_0x51c5('0x38')]);_0x21c06b['where']=qs[_0x51c5('0x32')](_[_0x51c5('0x3a')](_0x39f594[_0x51c5('0x30')],_0x2be05c['filters']));if(_0x39f594[_0x51c5('0x30')][_0x51c5('0x3b')]){_0x21c06b[_0x51c5('0x39')]=_[_0x51c5('0x3c')](_0x21c06b[_0x51c5('0x39')],{'$or':_['map'](_0x21c06b[_0x51c5('0x34')],function(_0x55609c){var _0x19fa28={};_0x19fa28[_0x55609c]={'$like':'%'+_0x39f594[_0x51c5('0x30')]['filter']+'%'};return _0x19fa28;})});}_0x21c06b=_[_0x51c5('0x3c')]({},_0x21c06b,_0x39f594[_0x51c5('0x3e')]);return _0x25bccb['getConfigurations'](_0x21c06b);}})[_0x51c5('0x24')](function(_0x3200a5){if(_0x3200a5){_0xfc2706=_0x3200a5[_0x51c5('0x47')];if(!_0x39f594[_0x51c5('0x30')][_0x51c5('0x36')](_0x51c5('0x4d'))){_0x21c06b[_0x51c5('0x1e')]=qs[_0x51c5('0x1e')](_0x39f594['query']['limit']);_0x21c06b['offset']=qs['offset'](_0x39f594[_0x51c5('0x30')][_0x51c5('0x1c')]);}return _0x25bccb[_0x51c5('0x4b')](_0x21c06b);}})['then'](function(_0x36b028){if(_0x36b028){return _0x36b028?{'count':_0xfc2706,'rows':_0x36b028}:null;}})[_0x51c5('0x24')](respondWithResult(_0x23be3f,null))['catch'](handleError(_0x23be3f,null));};exports[_0x51c5('0x4e')]=function(_0x71c35a,_0x4d4096,_0x412eba){if(_0x71c35a[_0x51c5('0x4a')]['id']){delete _0x71c35a[_0x51c5('0x4a')]['id'];}return db[_0x51c5('0x2c')][_0x51c5('0x4c')]({'where':{'id':_0x71c35a[_0x51c5('0x45')]['id']}})[_0x51c5('0x24')](handleEntityNotFound(_0x4d4096,null))[_0x51c5('0x24')](function(_0x287fa1){if(_0x287fa1){_0x71c35a['body']['AccountId']=_0x287fa1['id'];_0x71c35a[_0x51c5('0x4a')]['Subjects']=integrations['getSubjects'](_0x71c35a['body'][_0x51c5('0x4f')],_0x71c35a[_0x51c5('0x4a')][_0x51c5('0x2e')]);_0x71c35a['body'][_0x51c5('0x50')]=integrations['getDescriptions'](_0x71c35a[_0x51c5('0x4a')]['channel'],_0x71c35a[_0x51c5('0x4a')][_0x51c5('0x2e')]);return db[_0x51c5('0x51')][_0x51c5('0x49')](_0x71c35a[_0x51c5('0x4a')],{'include':[{'model':db[_0x51c5('0x52')],'as':'Subjects'},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x51c5('0x24')](respondWithResult(_0x4d4096,null))[_0x51c5('0x43')](handleError(_0x4d4096,null));};var md5=require('md5');exports[_0x51c5('0x53')]=function(_0x59d570,_0x37f6a7,_0x3839cd){var _0x435700=null;var _0x1250e4=null;var _0x230acd=null;var _0x1c1677=null;var _0x219dd0='';return db['VtigerAccount'][_0x51c5('0x4c')]({'where':{'id':_0x59d570['params']['id']},'attributes':['id',_0x51c5('0x28'),_0x51c5('0x54'),_0x51c5('0x55'),'moduleName',_0x51c5('0x56'),_0x51c5('0x57'),_0x51c5('0x58')]})['then'](handleEntityNotFound(_0x37f6a7,null))[_0x51c5('0x24')](function(_0xc0253e){if(_0xc0253e){_0x435700=_0xc0253e[_0x51c5('0x54')];_0x1250e4=_0xc0253e[_0x51c5('0x58')];_0x230acd=_0xc0253e['moduleName'];_0x219dd0=_0xc0253e[_0x51c5('0x56')];var _0x51e660=_0x219dd0['slice'](-0x1);if(_0x51e660==='/'){_0x219dd0=_0x219dd0['substring'](0x0,_0x219dd0['lastIndexOf'](_0x51e660));}_0x1c1677=util[_0x51c5('0x59')](_0x51c5('0x5a'),_0x219dd0);var _0xca165d={'method':_0x51c5('0x5b'),'uri':_0x1c1677,'qs':{'operation':_0x51c5('0x5c'),'username':_0xc0253e[_0x51c5('0x54')]},'json':!![]};return rp(_0xca165d);}})[_0x51c5('0x24')](function(_0x4d8641){if(_0x4d8641[_0x51c5('0x5d')]){var _0x31ddcf={'method':_0x51c5('0x5e'),'uri':_0x1c1677,'form':{'operation':_0x51c5('0x5f'),'username':_0x435700,'accessKey':md5(_0x4d8641[_0x51c5('0x60')][_0x51c5('0x61')]+_0x1250e4)},'json':!![]};return rp(_0x31ddcf);}})[_0x51c5('0x24')](function(_0x4466bf){if(_0x4466bf[_0x51c5('0x5d')]){var _0x212c45={'method':_0x51c5('0x5b'),'uri':_0x1c1677,'qs':{'operation':_0x51c5('0x62'),'username':_0x435700,'sessionName':_0x4466bf[_0x51c5('0x60')]['sessionName'],'elementType':_0x230acd},'json':!![]};return rp(_0x212c45);}})['then'](function(_0x43e954){if(_0x43e954[_0x51c5('0x5d')]){var _0x2a882e=[_0x51c5('0x63'),'reference',_0x51c5('0x64')];_[_0x51c5('0x65')](_0x43e954[_0x51c5('0x60')]['fields'],function(_0x7b39d9){return _0x2a882e['includes'](_0x7b39d9[_0x51c5('0x2e')]['name']);});_[_0x51c5('0x65')](_0x43e954[_0x51c5('0x60')][_0x51c5('0x35')],function(_0xb8659b){return _0xb8659b[_0x51c5('0x66')]==='false';});return{'count':_0x43e954[_0x51c5('0x60')][_0x51c5('0x35')]['length'],'rows':_[_0x51c5('0x2b')](_0x43e954['result'][_0x51c5('0x35')],function(_0x3c1ce2){return{'id':_0x3c1ce2['name'],'name':_0x3c1ce2[_0x51c5('0x67')],'custom':_[_0x51c5('0x68')](_0x3c1ce2['name'],_0x51c5('0x69'))?!![]:![],'options':_0x3c1ce2['type']['name']===_0x51c5('0x6a')&&_0x3c1ce2[_0x51c5('0x2e')][_0x51c5('0x6b')][_0x51c5('0x47')]>0x0?_[_0x51c5('0x2b')](_0x3c1ce2[_0x51c5('0x2e')][_0x51c5('0x6b')],function(_0x6d89dd){return{'name':_0x6d89dd['label'],'value':_0x6d89dd[_0x51c5('0x6c')]};}):[]};})};}})[_0x51c5('0x24')](respondWithResult(_0x37f6a7,null))[_0x51c5('0x43')](function(_0x4ea9aa){console[_0x51c5('0x6d')](_0x51c5('0x6e')+_0x4ea9aa);var _0x49935f=_0x59d570[_0x51c5('0x30')][_0x51c5('0x6f')]?0x1f4:_0x4ea9aa[_0x51c5('0x70')]||0x1f4;logger['error'](_0x51c5('0x71'),'getFields',_0x49935f,JSON[_0x51c5('0x72')](_0x4ea9aa));delete _0x4ea9aa['name'];if(_0x49935f===0x191){_0x49935f=0x190;}_0x37f6a7[_0x51c5('0x1a')](_0x49935f)[_0x51c5('0x29')](_0x59d570[_0x51c5('0x30')][_0x51c5('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x4ea9aa['statusCode']}:_0x4ea9aa);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index d690775..d2c7039 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 _0xf296=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x713fbe,_0x49d0ea){var _0x19486e=function(_0x3b09a8){while(--_0x3b09a8){_0x713fbe['push'](_0x713fbe['shift']());}};_0x19486e(++_0x49d0ea);}(_0xf296,0x1a8));var _0x6f29=function(_0x3b22e9,_0x354406){_0x3b22e9=_0x3b22e9-0x0;var _0x230314=_0xf296[_0x3b22e9];return _0x230314;};'use strict';var _=require(_0x6f29('0x0'));var util=require(_0x6f29('0x1'));var logger=require(_0x6f29('0x2'))(_0x6f29('0x3'));var moment=require('moment');var BPromise=require(_0x6f29('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6f29('0x5'));var config=require(_0x6f29('0x6'));var attributes=require(_0x6f29('0x7'));var integrations=require(_0x6f29('0x8'));module[_0x6f29('0x9')]=function(_0x3dace4,_0x410232){return _0x3dace4[_0x6f29('0xa')](_0x6f29('0xb'),attributes,{'tableName':_0x6f29('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb429=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','api','moment','bluebird'];(function(_0x26a08c,_0x58de7f){var _0x12e4e4=function(_0x1d20d6){while(--_0x1d20d6){_0x26a08c['push'](_0x26a08c['shift']());}};_0x12e4e4(++_0x58de7f);}(_0xb429,0x13e));var _0x9b42=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xb429[_0x43d11d];return _0x38cd08;};'use strict';var _=require('lodash');var util=require(_0x9b42('0x0'));var logger=require('../../config/logger')(_0x9b42('0x1'));var moment=require(_0x9b42('0x2'));var BPromise=require(_0x9b42('0x3'));var rp=require(_0x9b42('0x4'));var fs=require('fs');var path=require(_0x9b42('0x5'));var rimraf=require(_0x9b42('0x6'));var config=require(_0x9b42('0x7'));var attributes=require(_0x9b42('0x8'));var integrations=require(_0x9b42('0x9'));module[_0x9b42('0xa')]=function(_0x1dd1d6,_0x39d7f4){return _0x1dd1d6[_0x9b42('0xb')](_0x9b42('0xc'),attributes,{'tableName':_0x9b42('0xd'),'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 3c2ae3e..b2668ac 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 _0x96cc=['model','map','debug','ShowVtigerAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0xf94131,_0x58b63d){var _0xdf5c19=function(_0xa00801){while(--_0xa00801){_0xf94131['push'](_0xf94131['shift']());}};_0xdf5c19(++_0x58b63d);}(_0x96cc,0x16c));var _0xc96c=function(_0x436981,_0x371571){_0x436981=_0x436981-0x0;var _0x2e4f86=_0x96cc[_0x436981];return _0x2e4f86;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});}exports[_0xc96c('0x17')]=function(_0x99c402){var _0x16b6ce=this;return new Promise(function(_0x2ae19a,_0x4aa6a3){return db[_0xc96c('0x18')][_0xc96c('0x19')]({'raw':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1b')]===undefined?!![]:![]:!![],'where':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1c')]||null:null,'attributes':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1d')]||null:null,'limit':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1e')]||null:null,'include':_0x99c402[_0xc96c('0x1a')]?_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1f')]?_['map'](_0x99c402[_0xc96c('0x1a')][_0xc96c('0x1f')],function(_0x4456bf){return{'model':db[_0x4456bf[_0xc96c('0x20')]],'as':_0x4456bf['as'],'attributes':_0x4456bf[_0xc96c('0x1d')],'include':_0x4456bf[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x4456bf[_0xc96c('0x1f')],function(_0x1a77df){return{'model':db[_0x1a77df[_0xc96c('0x20')]],'as':_0x1a77df['as'],'attributes':_0x1a77df['attributes'],'include':_0x1a77df[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x1a77df[_0xc96c('0x1f')],function(_0x294fee){return{'model':db[_0x294fee['model']],'as':_0x294fee['as'],'attributes':_0x294fee['attributes']};}):[]};}):[]};}):[]:[]})[_0xc96c('0xc')](function(_0x12c293){logger[_0xc96c('0xd')](_0xc96c('0x17'),_0x99c402);logger[_0xc96c('0x22')](_0xc96c('0x17'),_0x99c402,JSON[_0xc96c('0x11')](_0x12c293));_0x2ae19a(_0x12c293);})[_0xc96c('0x16')](function(_0xa0efbc){logger[_0xc96c('0x12')](_0xc96c('0x17'),_0xa0efbc[_0xc96c('0x14')],_0x99c402);_0x4aa6a3(_0x16b6ce[_0xc96c('0x12')](0x1f4,_0xa0efbc[_0xc96c('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x3aa436){var _0x53c994=this;return new Promise(function(_0x3f4b0e,_0x442c7f){return db[_0xc96c('0x18')]['find']({'raw':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436['options']['where']||null:null,'attributes':_0x3aa436[_0xc96c('0x1a')]?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1d')]||null:null,'include':_0x3aa436['options']?_0x3aa436[_0xc96c('0x1a')][_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x3aa436[_0xc96c('0x1a')]['include'],function(_0x4132a9){return{'model':db[_0x4132a9[_0xc96c('0x20')]],'as':_0x4132a9['as'],'attributes':_0x4132a9['attributes'],'include':_0x4132a9[_0xc96c('0x1f')]?_[_0xc96c('0x21')](_0x4132a9[_0xc96c('0x1f')],function(_0x2d2595){return{'model':db[_0x2d2595[_0xc96c('0x20')]],'as':_0x2d2595['as'],'attributes':_0x2d2595[_0xc96c('0x1d')],'include':_0x2d2595['include']?_[_0xc96c('0x21')](_0x2d2595[_0xc96c('0x1f')],function(_0x15b68b){return{'model':db[_0x15b68b[_0xc96c('0x20')]],'as':_0x15b68b['as'],'attributes':_0x15b68b[_0xc96c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc96c('0xc')](function(_0x52d4a2){logger['info'](_0xc96c('0x23'),_0x3aa436);logger[_0xc96c('0x22')]('ShowVtigerAccount',_0x3aa436,JSON['stringify'](_0x52d4a2));_0x3f4b0e(_0x52d4a2);})[_0xc96c('0x16')](function(_0x1df393){logger[_0xc96c('0x12')](_0xc96c('0x23'),_0x1df393[_0xc96c('0x14')],_0x3aa436);_0x442c7f(_0x53c994[_0xc96c('0x12')](0x1f4,_0x1df393[_0xc96c('0x14')]));});});}; \ No newline at end of file +var _0xbaf0=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','model','map','ShowVtigerAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x6c0b0a,_0x496391){var _0x5f456a=function(_0x5ae918){while(--_0x5ae918){_0x6c0b0a['push'](_0x6c0b0a['shift']());}};_0x5f456a(++_0x496391);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetVtigerAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowVtigerAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 6ba27ee..851b5ce 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 _0x3b17=['put','delete','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create'];(function(_0x5138f8,_0x523adb){var _0x1f75fb=function(_0x61b9bc){while(--_0x61b9bc){_0x5138f8['push'](_0x5138f8['shift']());}};_0x1f75fb(++_0x523adb);}(_0x3b17,0xfe));var _0x73b1=function(_0x45667f,_0x121c63){_0x45667f=_0x45667f-0x0;var _0x141c69=_0x3b17[_0x45667f];return _0x141c69;};'use strict';var multer=require('multer');var util=require(_0x73b1('0x0'));var path=require(_0x73b1('0x1'));var timeout=require(_0x73b1('0x2'));var express=require('express');var router=express[_0x73b1('0x3')]();var fs_extra=require(_0x73b1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x73b1('0x5'));var config=require(_0x73b1('0x6'));var controller=require(_0x73b1('0x7'));router[_0x73b1('0x8')]('/',auth[_0x73b1('0x9')](),controller[_0x73b1('0xa')]);router['get'](_0x73b1('0xb'),auth[_0x73b1('0x9')](),controller[_0x73b1('0xc')]);router[_0x73b1('0x8')](_0x73b1('0xd'),auth[_0x73b1('0x9')](),controller[_0x73b1('0xe')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x73b1('0x8')](_0x73b1('0xf'),auth[_0x73b1('0x9')](),controller[_0x73b1('0x10')]);router[_0x73b1('0x11')]('/',auth[_0x73b1('0x9')](),controller[_0x73b1('0x12')]);router[_0x73b1('0x13')](_0x73b1('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x73b1('0x14')](_0x73b1('0xb'),auth[_0x73b1('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe825=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','getDescriptions','create','put','update','delete','destroy'];(function(_0x23ec37,_0x4d02b8){var _0x3a4470=function(_0x4d6aac){while(--_0x4d6aac){_0x23ec37['push'](_0x23ec37['shift']());}};_0x3a4470(++_0x4d02b8);}(_0xe825,0x105));var _0x5e82=function(_0x3bce42,_0x5caf64){_0x3bce42=_0x3bce42-0x0;var _0x2ce0a2=_0xe825[_0x3bce42];return _0x2ce0a2;};'use strict';var multer=require(_0x5e82('0x0'));var util=require(_0x5e82('0x1'));var path=require(_0x5e82('0x2'));var timeout=require(_0x5e82('0x3'));var express=require(_0x5e82('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5e82('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5e82('0x6'));var controller=require(_0x5e82('0x7'));router[_0x5e82('0x8')]('/',auth[_0x5e82('0x9')](),controller[_0x5e82('0xa')]);router['get'](_0x5e82('0xb'),auth[_0x5e82('0x9')](),controller[_0x5e82('0xc')]);router[_0x5e82('0x8')]('/:id/fields',auth[_0x5e82('0x9')](),controller['getFields']);router[_0x5e82('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5e82('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e82('0xe')]);router[_0x5e82('0xf')](_0x5e82('0xb'),auth['isAuthenticated'](),controller[_0x5e82('0x10')]);router[_0x5e82('0x11')](_0x5e82('0xb'),auth[_0x5e82('0x9')](),controller[_0x5e82('0x12')]);module[_0x5e82('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index baa2f76..0f2138f 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 _0x60a5=['STRING','sequelize','exports'];(function(_0x47624f,_0x487c1f){var _0x2174d7=function(_0x1a69d2){while(--_0x1a69d2){_0x47624f['push'](_0x47624f['shift']());}};_0x2174d7(++_0x487c1f);}(_0x60a5,0x14e));var _0x560a=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x60a5[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x560a('0x0'));module[_0x560a('0x1')]={'name':{'type':Sequelize[_0x560a('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5adc=['exports','STRING'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x5adc,0x184));var _0xc5ad=function(_0x4eee76,_0x2780c9){_0x4eee76=_0x4eee76-0x0;var _0x47fb6b=_0x5adc[_0x4eee76];return _0x47fb6b;};'use strict';var Sequelize=require('sequelize');module[_0xc5ad('0x0')]={'name':{'type':Sequelize[_0xc5ad('0x1')]},'description':{'type':Sequelize[_0xc5ad('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 5c4277e..7955614 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 _0xf491=['mustache','path','sox','to-csv','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','destroy','error','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','VtigerConfiguration','then','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','findOne','VtigerField','order','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf491,0x178));var _0x1f49=function(_0xc471c0,_0xd91b0){_0xc471c0=_0xc471c0-0x0;var _0x46b386=_0xf491[_0xc471c0];return _0x46b386;};'use strict';var emlformat=require(_0x1f49('0x0'));var rimraf=require(_0x1f49('0x1'));var zipdir=require(_0x1f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1f49('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1f49('0x4'));var util=require('util');var path=require(_0x1f49('0x5'));var sox=require(_0x1f49('0x6'));var csv=require(_0x1f49('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1f49('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1f49('0x9'));var toCsv=require(_0x1f49('0x7'));var querystring=require(_0x1f49('0xa'));var Papa=require('papaparse');var Redis=require(_0x1f49('0xb'));var authService=require(_0x1f49('0xc'));var qs=require(_0x1f49('0xd'));var as=require(_0x1f49('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f49('0xf'))(_0x1f49('0x10'));var utils=require(_0x1f49('0x11'));var config=require(_0x1f49('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb0b1cc,_0x1a0737){_0x1a0737=_0x1a0737||0xcc;return function(_0x12e6df){if(_0x12e6df){return _0xb0b1cc[_0x1f49('0x13')](_0x1a0737);}return _0xb0b1cc[_0x1f49('0x14')](_0x1a0737)[_0x1f49('0x15')]();};}function respondWithResult(_0x275086,_0x3dba60){_0x3dba60=_0x3dba60||0xc8;return function(_0x1121a2){if(_0x1121a2){return _0x275086[_0x1f49('0x14')](_0x3dba60)['json'](_0x1121a2);}};}function respondWithFilteredResult(_0x516b5d,_0x57890c){return function(_0xb65054){if(_0xb65054){var _0x37948a=typeof _0x57890c[_0x1f49('0x16')]===_0x1f49('0x17')&&typeof _0x57890c['limit']==='undefined';var _0x8c2793=_0xb65054[_0x1f49('0x18')];var _0x5acdd1=_0x37948a?0x0:_0x57890c[_0x1f49('0x16')];var _0x3e21a7=_0x37948a?_0xb65054[_0x1f49('0x18')]:_0x57890c[_0x1f49('0x16')]+_0x57890c[_0x1f49('0x19')];var _0x2c95b6;if(_0x3e21a7>=_0x8c2793){_0x3e21a7=_0x8c2793;_0x2c95b6=0xc8;}else{_0x2c95b6=0xce;}_0x516b5d['status'](_0x2c95b6);return _0x516b5d[_0x1f49('0x1a')]('Content-Range',_0x5acdd1+'-'+_0x3e21a7+'/'+_0x8c2793)[_0x1f49('0x1b')](_0xb65054);}return null;};}function patchUpdates(_0x4d8e93){return function(_0x274ae2){try{jsonpatch[_0x1f49('0x1c')](_0x274ae2,_0x4d8e93,!![]);}catch(_0x51f8f7){return BPromise[_0x1f49('0x1d')](_0x51f8f7);}return _0x274ae2[_0x1f49('0x1e')]();};}function saveUpdates(_0xc27a85,_0x5eca89){return function(_0x286785){if(_0x286785){return _0x286785[_0x1f49('0x1f')](_0xc27a85)['then'](function(_0xa29936){return _0xa29936;});}return null;};}function removeEntity(_0x552eb3,_0x3a05b3){return function(_0xbb97c){if(_0xbb97c){return _0xbb97c[_0x1f49('0x20')]()['then'](function(){_0x552eb3[_0x1f49('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fbd63,_0x1d022d){return function(_0x1077ac){if(!_0x1077ac){_0x3fbd63[_0x1f49('0x13')](0x194);}return _0x1077ac;};}function handleError(_0x374142,_0x4f0355){_0x4f0355=_0x4f0355||0x1f4;return function(_0x20c586){logger[_0x1f49('0x21')](_0x20c586['stack']);if(_0x20c586[_0x1f49('0x22')]){delete _0x20c586[_0x1f49('0x22')];}_0x374142['status'](_0x4f0355)[_0x1f49('0x23')](_0x20c586);};}exports[_0x1f49('0x24')]=function(_0x362f7f,_0x480331){var _0x1034d2={},_0x5e5134={},_0x310763={'count':0x0,'rows':[]};var _0x21f15e=_[_0x1f49('0x25')](db['VtigerConfiguration']['rawAttributes'],function(_0x270f08){return{'name':_0x270f08[_0x1f49('0x26')],'type':_0x270f08[_0x1f49('0x27')][_0x1f49('0x28')]};});_0x5e5134['model']=_[_0x1f49('0x25')](_0x21f15e,_0x1f49('0x22'));_0x5e5134[_0x1f49('0x29')]=_[_0x1f49('0x2a')](_0x362f7f[_0x1f49('0x29')]);_0x5e5134[_0x1f49('0x2b')]=_[_0x1f49('0x2c')](_0x5e5134[_0x1f49('0x2d')],_0x5e5134[_0x1f49('0x29')]);_0x1034d2[_0x1f49('0x2e')]=_['intersection'](_0x5e5134['model'],qs[_0x1f49('0x2f')](_0x362f7f[_0x1f49('0x29')][_0x1f49('0x2f')]));_0x1034d2[_0x1f49('0x2e')]=_0x1034d2[_0x1f49('0x2e')][_0x1f49('0x30')]?_0x1034d2['attributes']:_0x5e5134[_0x1f49('0x2d')];if(!_0x362f7f[_0x1f49('0x29')][_0x1f49('0x31')](_0x1f49('0x32'))){_0x1034d2[_0x1f49('0x19')]=qs[_0x1f49('0x19')](_0x362f7f['query']['limit']);_0x1034d2[_0x1f49('0x16')]=qs[_0x1f49('0x16')](_0x362f7f['query'][_0x1f49('0x16')]);}_0x1034d2['order']=qs[_0x1f49('0x33')](_0x362f7f[_0x1f49('0x29')]['sort']);_0x1034d2['where']=qs[_0x1f49('0x2b')](_['pick'](_0x362f7f[_0x1f49('0x29')],_0x5e5134[_0x1f49('0x2b')]),_0x21f15e);if(_0x362f7f['query'][_0x1f49('0x34')]){_0x1034d2[_0x1f49('0x35')]=_[_0x1f49('0x36')](_0x1034d2[_0x1f49('0x35')],{'$or':_['map'](_0x21f15e,function(_0x78515d){if(_0x78515d[_0x1f49('0x27')]!==_0x1f49('0x37')){var _0x510301={};_0x510301[_0x78515d['name']]={'$like':'%'+_0x362f7f[_0x1f49('0x29')][_0x1f49('0x34')]+'%'};return _0x510301;}})});}_0x1034d2=_['merge']({},_0x1034d2,_0x362f7f[_0x1f49('0x38')]);var _0xf3220c={'where':_0x1034d2[_0x1f49('0x35')]};return db[_0x1f49('0x39')][_0x1f49('0x18')](_0xf3220c)[_0x1f49('0x3a')](function(_0x229665){_0x310763[_0x1f49('0x18')]=_0x229665;if(_0x362f7f[_0x1f49('0x29')][_0x1f49('0x3b')]){_0x1034d2[_0x1f49('0x3c')]=[{'all':!![]}];}return db[_0x1f49('0x39')][_0x1f49('0x3d')](_0x1034d2);})[_0x1f49('0x3a')](function(_0x3d61d0){_0x310763[_0x1f49('0x3e')]=_0x3d61d0;return _0x310763;})[_0x1f49('0x3a')](respondWithFilteredResult(_0x480331,_0x1034d2))[_0x1f49('0x3f')](handleError(_0x480331,null));};exports['show']=function(_0x274d27,_0x4d173f){var _0x3f347d={'raw':![],'where':{'id':_0x274d27['params']['id']}},_0x49e77c={};_0x49e77c[_0x1f49('0x2d')]=_['keys'](db[_0x1f49('0x39')][_0x1f49('0x40')]);_0x49e77c['query']=_['keys'](_0x274d27[_0x1f49('0x29')]);_0x49e77c[_0x1f49('0x2b')]=_[_0x1f49('0x2c')](_0x49e77c[_0x1f49('0x2d')],_0x49e77c[_0x1f49('0x29')]);_0x3f347d[_0x1f49('0x2e')]=_['intersection'](_0x49e77c['model'],qs['fields'](_0x274d27[_0x1f49('0x29')][_0x1f49('0x2f')]));_0x3f347d[_0x1f49('0x2e')]=_0x3f347d['attributes'][_0x1f49('0x30')]?_0x3f347d[_0x1f49('0x2e')]:_0x49e77c[_0x1f49('0x2d')];if(_0x274d27[_0x1f49('0x29')]['includeAll']){_0x3f347d[_0x1f49('0x3c')]=[{'all':!![]}];}_0x3f347d=_[_0x1f49('0x36')]({},_0x3f347d,_0x274d27[_0x1f49('0x38')]);return db[_0x1f49('0x39')][_0x1f49('0x41')](_0x3f347d)[_0x1f49('0x3a')](handleEntityNotFound(_0x4d173f,null))[_0x1f49('0x3a')](respondWithResult(_0x4d173f,null))['catch'](handleError(_0x4d173f,null));};exports[_0x1f49('0x42')]=function(_0x3ee921,_0x145ebe){return db[_0x1f49('0x39')][_0x1f49('0x42')](_0x3ee921[_0x1f49('0x43')],{})[_0x1f49('0x3a')](respondWithResult(_0x145ebe,0xc9))[_0x1f49('0x3f')](handleError(_0x145ebe,null));};exports[_0x1f49('0x1f')]=function(_0x50cd72,_0x5c844a){if(_0x50cd72[_0x1f49('0x43')]['id']){delete _0x50cd72[_0x1f49('0x43')]['id'];}return db[_0x1f49('0x39')]['find']({'where':{'id':_0x50cd72[_0x1f49('0x44')]['id']}})[_0x1f49('0x3a')](handleEntityNotFound(_0x5c844a,null))[_0x1f49('0x3a')](saveUpdates(_0x50cd72[_0x1f49('0x43')],null))['then'](respondWithResult(_0x5c844a,null))[_0x1f49('0x3f')](handleError(_0x5c844a,null));};exports['destroy']=function(_0x213f6a,_0x4f1c65){return db['VtigerConfiguration'][_0x1f49('0x41')]({'where':{'id':_0x213f6a[_0x1f49('0x44')]['id']}})[_0x1f49('0x3a')](handleEntityNotFound(_0x4f1c65,null))[_0x1f49('0x3a')](removeEntity(_0x4f1c65,null))[_0x1f49('0x3f')](handleError(_0x4f1c65,null));};exports['getFields']=function(_0x1d5af4,_0x37035d,_0x163cff){var _0x4373ec={};var _0x558f03={};var _0x14ab4c;var _0x3bd2f2;return db[_0x1f49('0x39')][_0x1f49('0x45')]({'where':{'id':_0x1d5af4[_0x1f49('0x44')]['id']}})[_0x1f49('0x3a')](handleEntityNotFound(_0x37035d,null))[_0x1f49('0x3a')](function(_0x2b683c){if(_0x2b683c){_0x14ab4c=_0x2b683c;_0x558f03['model']=_[_0x1f49('0x2a')](db[_0x1f49('0x46')][_0x1f49('0x40')]);_0x558f03[_0x1f49('0x29')]=_[_0x1f49('0x2a')](_0x1d5af4['query']);_0x558f03['filters']=_['intersection'](_0x558f03[_0x1f49('0x2d')],_0x558f03[_0x1f49('0x29')]);_0x4373ec[_0x1f49('0x2e')]=_[_0x1f49('0x2c')](_0x558f03[_0x1f49('0x2d')],qs[_0x1f49('0x2f')](_0x1d5af4['query'][_0x1f49('0x2f')]));_0x4373ec[_0x1f49('0x2e')]=_0x4373ec[_0x1f49('0x2e')][_0x1f49('0x30')]?_0x4373ec[_0x1f49('0x2e')]:_0x558f03[_0x1f49('0x2d')];_0x4373ec[_0x1f49('0x47')]=qs[_0x1f49('0x33')](_0x1d5af4[_0x1f49('0x29')][_0x1f49('0x33')]);_0x4373ec[_0x1f49('0x35')]=qs[_0x1f49('0x2b')](_[_0x1f49('0x48')](_0x1d5af4[_0x1f49('0x29')],_0x558f03[_0x1f49('0x2b')]));if(_0x1d5af4[_0x1f49('0x29')][_0x1f49('0x34')]){_0x4373ec[_0x1f49('0x35')]=_[_0x1f49('0x36')](_0x4373ec['where'],{'$or':_[_0x1f49('0x25')](_0x4373ec[_0x1f49('0x2e')],function(_0x1a97b4){var _0x19f796={};_0x19f796[_0x1a97b4]={'$like':'%'+_0x1d5af4[_0x1f49('0x29')][_0x1f49('0x34')]+'%'};return _0x19f796;})});}_0x4373ec=_['merge']({},_0x4373ec,_0x1d5af4[_0x1f49('0x38')]);return _0x14ab4c[_0x1f49('0x49')](_0x4373ec);}})[_0x1f49('0x3a')](function(_0x3fb24d){if(_0x3fb24d){_0x3bd2f2=_0x3fb24d[_0x1f49('0x30')];if(!_0x1d5af4[_0x1f49('0x29')][_0x1f49('0x31')](_0x1f49('0x32'))){_0x4373ec[_0x1f49('0x19')]=qs[_0x1f49('0x19')](_0x1d5af4[_0x1f49('0x29')]['limit']);_0x4373ec['offset']=qs[_0x1f49('0x16')](_0x1d5af4[_0x1f49('0x29')][_0x1f49('0x16')]);}return _0x14ab4c[_0x1f49('0x49')](_0x4373ec);}})['then'](function(_0x40c39d){if(_0x40c39d){return _0x40c39d?{'count':_0x3bd2f2,'rows':_0x40c39d}:null;}})[_0x1f49('0x3a')](respondWithResult(_0x37035d,null))['catch'](handleError(_0x37035d,null));};exports['getSubjects']=function(_0x3de8d6,_0x297d8f,_0x1e1f0e){var _0x58a99b={};var _0x40d993={};var _0x459560;var _0x69f9db;return db[_0x1f49('0x39')][_0x1f49('0x45')]({'where':{'id':_0x3de8d6[_0x1f49('0x44')]['id']}})[_0x1f49('0x3a')](handleEntityNotFound(_0x297d8f,null))['then'](function(_0x156d71){if(_0x156d71){_0x459560=_0x156d71;_0x40d993[_0x1f49('0x2d')]=_[_0x1f49('0x2a')](db['VtigerField'][_0x1f49('0x40')]);_0x40d993[_0x1f49('0x29')]=_[_0x1f49('0x2a')](_0x3de8d6['query']);_0x40d993[_0x1f49('0x2b')]=_[_0x1f49('0x2c')](_0x40d993[_0x1f49('0x2d')],_0x40d993[_0x1f49('0x29')]);_0x58a99b[_0x1f49('0x2e')]=_[_0x1f49('0x2c')](_0x40d993[_0x1f49('0x2d')],qs[_0x1f49('0x2f')](_0x3de8d6[_0x1f49('0x29')][_0x1f49('0x2f')]));_0x58a99b[_0x1f49('0x2e')]=_0x58a99b[_0x1f49('0x2e')][_0x1f49('0x30')]?_0x58a99b[_0x1f49('0x2e')]:_0x40d993[_0x1f49('0x2d')];_0x58a99b[_0x1f49('0x47')]=qs['sort'](_0x3de8d6[_0x1f49('0x29')][_0x1f49('0x33')]);_0x58a99b['where']=qs[_0x1f49('0x2b')](_[_0x1f49('0x48')](_0x3de8d6[_0x1f49('0x29')],_0x40d993['filters']));if(_0x3de8d6[_0x1f49('0x29')][_0x1f49('0x34')]){_0x58a99b[_0x1f49('0x35')]=_[_0x1f49('0x36')](_0x58a99b[_0x1f49('0x35')],{'$or':_['map'](_0x58a99b[_0x1f49('0x2e')],function(_0x425526){var _0x57ee02={};_0x57ee02[_0x425526]={'$like':'%'+_0x3de8d6[_0x1f49('0x29')]['filter']+'%'};return _0x57ee02;})});}_0x58a99b=_[_0x1f49('0x36')]({},_0x58a99b,_0x3de8d6['options']);return _0x459560[_0x1f49('0x4a')](_0x58a99b);}})[_0x1f49('0x3a')](function(_0x15fa74){if(_0x15fa74){_0x69f9db=_0x15fa74[_0x1f49('0x30')];if(!_0x3de8d6[_0x1f49('0x29')][_0x1f49('0x31')](_0x1f49('0x32'))){_0x58a99b['limit']=qs[_0x1f49('0x19')](_0x3de8d6[_0x1f49('0x29')]['limit']);_0x58a99b[_0x1f49('0x16')]=qs[_0x1f49('0x16')](_0x3de8d6[_0x1f49('0x29')][_0x1f49('0x16')]);}return _0x459560[_0x1f49('0x4a')](_0x58a99b);}})[_0x1f49('0x3a')](function(_0x2ab68){if(_0x2ab68){return _0x2ab68?{'count':_0x69f9db,'rows':_0x2ab68}:null;}})[_0x1f49('0x3a')](respondWithResult(_0x297d8f,null))[_0x1f49('0x3f')](handleError(_0x297d8f,null));};exports['getDescriptions']=function(_0x4f5610,_0x4ab42c,_0x50ad99){var _0x76f108={};var _0x372a91={};var _0x52b16b;var _0x196e8a;return db['VtigerConfiguration'][_0x1f49('0x45')]({'where':{'id':_0x4f5610[_0x1f49('0x44')]['id']}})['then'](handleEntityNotFound(_0x4ab42c,null))[_0x1f49('0x3a')](function(_0x85af1f){if(_0x85af1f){_0x52b16b=_0x85af1f;_0x372a91['model']=_[_0x1f49('0x2a')](db[_0x1f49('0x46')][_0x1f49('0x40')]);_0x372a91[_0x1f49('0x29')]=_[_0x1f49('0x2a')](_0x4f5610[_0x1f49('0x29')]);_0x372a91[_0x1f49('0x2b')]=_['intersection'](_0x372a91['model'],_0x372a91[_0x1f49('0x29')]);_0x76f108[_0x1f49('0x2e')]=_[_0x1f49('0x2c')](_0x372a91[_0x1f49('0x2d')],qs[_0x1f49('0x2f')](_0x4f5610['query'][_0x1f49('0x2f')]));_0x76f108[_0x1f49('0x2e')]=_0x76f108['attributes'][_0x1f49('0x30')]?_0x76f108[_0x1f49('0x2e')]:_0x372a91['model'];_0x76f108[_0x1f49('0x47')]=qs['sort'](_0x4f5610[_0x1f49('0x29')][_0x1f49('0x33')]);_0x76f108[_0x1f49('0x35')]=qs[_0x1f49('0x2b')](_[_0x1f49('0x48')](_0x4f5610[_0x1f49('0x29')],_0x372a91['filters']));if(_0x4f5610[_0x1f49('0x29')][_0x1f49('0x34')]){_0x76f108[_0x1f49('0x35')]=_['merge'](_0x76f108[_0x1f49('0x35')],{'$or':_[_0x1f49('0x25')](_0x76f108['attributes'],function(_0x55cacf){var _0x3634b8={};_0x3634b8[_0x55cacf]={'$like':'%'+_0x4f5610['query'][_0x1f49('0x34')]+'%'};return _0x3634b8;})});}_0x76f108=_[_0x1f49('0x36')]({},_0x76f108,_0x4f5610['options']);return _0x52b16b[_0x1f49('0x4b')](_0x76f108);}})['then'](function(_0x44f539){if(_0x44f539){_0x196e8a=_0x44f539[_0x1f49('0x30')];if(!_0x4f5610[_0x1f49('0x29')][_0x1f49('0x31')]('nolimit')){_0x76f108[_0x1f49('0x19')]=qs['limit'](_0x4f5610[_0x1f49('0x29')][_0x1f49('0x19')]);_0x76f108[_0x1f49('0x16')]=qs[_0x1f49('0x16')](_0x4f5610['query'][_0x1f49('0x16')]);}return _0x52b16b['getDescriptions'](_0x76f108);}})['then'](function(_0x376de2){if(_0x376de2){return _0x376de2?{'count':_0x196e8a,'rows':_0x376de2}:null;}})['then'](respondWithResult(_0x4ab42c,null))[_0x1f49('0x3f')](handleError(_0x4ab42c,null));}; \ No newline at end of file +var _0x8801=['hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','destroy','getFields','findOne','VtigerField','intersection','pick','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','key','model','filters','query','attributes','fields','length'];(function(_0x1889e8,_0x30b3df){var _0x3a8bac=function(_0x1f2e64){while(--_0x1f2e64){_0x1889e8['push'](_0x1889e8['shift']());}};_0x3a8bac(++_0x30b3df);}(_0x8801,0x116));var _0x1880=function(_0xc1245f,_0x931ed1){_0xc1245f=_0xc1245f-0x0;var _0x1085cf=_0x8801[_0xc1245f];return _0x1085cf;};'use strict';var emlformat=require(_0x1880('0x0'));var rimraf=require(_0x1880('0x1'));var zipdir=require(_0x1880('0x2'));var jsonpatch=require(_0x1880('0x3'));var rp=require(_0x1880('0x4'));var moment=require(_0x1880('0x5'));var BPromise=require(_0x1880('0x6'));var Mustache=require(_0x1880('0x7'));var util=require(_0x1880('0x8'));var path=require(_0x1880('0x9'));var sox=require(_0x1880('0xa'));var csv=require(_0x1880('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1880('0xc'));var _=require('lodash');var squel=require(_0x1880('0xd'));var crypto=require(_0x1880('0xe'));var jsforce=require(_0x1880('0xf'));var deskjs=require(_0x1880('0x10'));var toCsv=require(_0x1880('0xb'));var querystring=require(_0x1880('0x11'));var Papa=require(_0x1880('0x12'));var Redis=require(_0x1880('0x13'));var authService=require(_0x1880('0x14'));var qs=require(_0x1880('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1880('0x16'));var logger=require(_0x1880('0x17'))(_0x1880('0x18'));var utils=require('../../config/utils');var config=require(_0x1880('0x19'));var licenseUtil=require(_0x1880('0x1a'));var db=require(_0x1880('0x1b'))['db'];function respondWithStatusCode(_0x6ba8ec,_0x187119){_0x187119=_0x187119||0xcc;return function(_0x2ae070){if(_0x2ae070){return _0x6ba8ec['sendStatus'](_0x187119);}return _0x6ba8ec[_0x1880('0x1c')](_0x187119)['end']();};}function respondWithResult(_0x31c5a5,_0xcf3c10){_0xcf3c10=_0xcf3c10||0xc8;return function(_0x18f695){if(_0x18f695){return _0x31c5a5['status'](_0xcf3c10)[_0x1880('0x1d')](_0x18f695);}};}function respondWithFilteredResult(_0x483037,_0x1738c9){return function(_0x3894d2){if(_0x3894d2){var _0x33f22f=typeof _0x1738c9[_0x1880('0x1e')]===_0x1880('0x1f')&&typeof _0x1738c9[_0x1880('0x20')]==='undefined';var _0x44779=_0x3894d2['count'];var _0x1d5b22=_0x33f22f?0x0:_0x1738c9['offset'];var _0x21e338=_0x33f22f?_0x3894d2[_0x1880('0x21')]:_0x1738c9[_0x1880('0x1e')]+_0x1738c9[_0x1880('0x20')];var _0x157fde;if(_0x21e338>=_0x44779){_0x21e338=_0x44779;_0x157fde=0xc8;}else{_0x157fde=0xce;}_0x483037['status'](_0x157fde);return _0x483037['set'](_0x1880('0x22'),_0x1d5b22+'-'+_0x21e338+'/'+_0x44779)['json'](_0x3894d2);}return null;};}function patchUpdates(_0x48f87d){return function(_0x3ef800){try{jsonpatch[_0x1880('0x23')](_0x3ef800,_0x48f87d,!![]);}catch(_0x4a6656){return BPromise[_0x1880('0x24')](_0x4a6656);}return _0x3ef800[_0x1880('0x25')]();};}function saveUpdates(_0x51c231,_0x1bf2ba){return function(_0x3a553e){if(_0x3a553e){return _0x3a553e[_0x1880('0x26')](_0x51c231)[_0x1880('0x27')](function(_0x547b88){return _0x547b88;});}return null;};}function removeEntity(_0x1a03cf,_0x296e74){return function(_0x291b60){if(_0x291b60){return _0x291b60['destroy']()[_0x1880('0x27')](function(){_0x1a03cf[_0x1880('0x1c')](0xcc)[_0x1880('0x28')]();});}};}function handleEntityNotFound(_0x27d693,_0x26f0a3){return function(_0x20a706){if(!_0x20a706){_0x27d693[_0x1880('0x29')](0x194);}return _0x20a706;};}function handleError(_0xaa6cbb,_0x37f70e){_0x37f70e=_0x37f70e||0x1f4;return function(_0x1f6fb4){logger[_0x1880('0x2a')](_0x1f6fb4[_0x1880('0x2b')]);if(_0x1f6fb4[_0x1880('0x2c')]){delete _0x1f6fb4['name'];}_0xaa6cbb[_0x1880('0x1c')](_0x37f70e)[_0x1880('0x2d')](_0x1f6fb4);};}exports[_0x1880('0x2e')]=function(_0x11ca44,_0x323f23){var _0x11f2d5={},_0x159a9d={},_0x1f56c0={'count':0x0,'rows':[]};var _0xbadce3=_[_0x1880('0x2f')](db[_0x1880('0x30')][_0x1880('0x31')],function(_0x9a1a64){return{'name':_0x9a1a64['fieldName'],'type':_0x9a1a64[_0x1880('0x32')][_0x1880('0x33')]};});_0x159a9d[_0x1880('0x34')]=_['map'](_0xbadce3,_0x1880('0x2c'));_0x159a9d['query']=_['keys'](_0x11ca44['query']);_0x159a9d[_0x1880('0x35')]=_['intersection'](_0x159a9d[_0x1880('0x34')],_0x159a9d[_0x1880('0x36')]);_0x11f2d5[_0x1880('0x37')]=_['intersection'](_0x159a9d[_0x1880('0x34')],qs[_0x1880('0x38')](_0x11ca44[_0x1880('0x36')][_0x1880('0x38')]));_0x11f2d5[_0x1880('0x37')]=_0x11f2d5[_0x1880('0x37')][_0x1880('0x39')]?_0x11f2d5['attributes']:_0x159a9d[_0x1880('0x34')];if(!_0x11ca44[_0x1880('0x36')][_0x1880('0x3a')]('nolimit')){_0x11f2d5['limit']=qs[_0x1880('0x20')](_0x11ca44[_0x1880('0x36')][_0x1880('0x20')]);_0x11f2d5[_0x1880('0x1e')]=qs[_0x1880('0x1e')](_0x11ca44['query'][_0x1880('0x1e')]);}_0x11f2d5[_0x1880('0x3b')]=qs[_0x1880('0x3c')](_0x11ca44[_0x1880('0x36')][_0x1880('0x3c')]);_0x11f2d5[_0x1880('0x3d')]=qs['filters'](_['pick'](_0x11ca44['query'],_0x159a9d[_0x1880('0x35')]),_0xbadce3);if(_0x11ca44['query'][_0x1880('0x3e')]){_0x11f2d5[_0x1880('0x3d')]=_['merge'](_0x11f2d5[_0x1880('0x3d')],{'$or':_['map'](_0xbadce3,function(_0x6b54aa){if(_0x6b54aa['type']!==_0x1880('0x3f')){var _0x102f11={};_0x102f11[_0x6b54aa[_0x1880('0x2c')]]={'$like':'%'+_0x11ca44[_0x1880('0x36')]['filter']+'%'};return _0x102f11;}})});}_0x11f2d5=_[_0x1880('0x40')]({},_0x11f2d5,_0x11ca44[_0x1880('0x41')]);var _0x38c544={'where':_0x11f2d5[_0x1880('0x3d')]};return db[_0x1880('0x30')]['count'](_0x38c544)['then'](function(_0x3107a3){_0x1f56c0[_0x1880('0x21')]=_0x3107a3;if(_0x11ca44[_0x1880('0x36')][_0x1880('0x42')]){_0x11f2d5[_0x1880('0x43')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x1880('0x44')](_0x11f2d5);})[_0x1880('0x27')](function(_0x422cf8){_0x1f56c0['rows']=_0x422cf8;return _0x1f56c0;})[_0x1880('0x27')](respondWithFilteredResult(_0x323f23,_0x11f2d5))[_0x1880('0x45')](handleError(_0x323f23,null));};exports[_0x1880('0x46')]=function(_0xb894ba,_0x3713f2){var _0x44e57f={'raw':![],'where':{'id':_0xb894ba[_0x1880('0x47')]['id']}},_0x434dd4={};_0x434dd4[_0x1880('0x34')]=_[_0x1880('0x48')](db[_0x1880('0x30')][_0x1880('0x31')]);_0x434dd4[_0x1880('0x36')]=_[_0x1880('0x48')](_0xb894ba[_0x1880('0x36')]);_0x434dd4[_0x1880('0x35')]=_['intersection'](_0x434dd4[_0x1880('0x34')],_0x434dd4[_0x1880('0x36')]);_0x44e57f[_0x1880('0x37')]=_['intersection'](_0x434dd4[_0x1880('0x34')],qs[_0x1880('0x38')](_0xb894ba[_0x1880('0x36')][_0x1880('0x38')]));_0x44e57f[_0x1880('0x37')]=_0x44e57f['attributes'][_0x1880('0x39')]?_0x44e57f[_0x1880('0x37')]:_0x434dd4[_0x1880('0x34')];if(_0xb894ba[_0x1880('0x36')][_0x1880('0x42')]){_0x44e57f[_0x1880('0x43')]=[{'all':!![]}];}_0x44e57f=_[_0x1880('0x40')]({},_0x44e57f,_0xb894ba[_0x1880('0x41')]);return db[_0x1880('0x30')][_0x1880('0x49')](_0x44e57f)[_0x1880('0x27')](handleEntityNotFound(_0x3713f2,null))['then'](respondWithResult(_0x3713f2,null))[_0x1880('0x45')](handleError(_0x3713f2,null));};exports[_0x1880('0x4a')]=function(_0xf48c9b,_0x42d874){return db[_0x1880('0x30')]['create'](_0xf48c9b[_0x1880('0x4b')],{})[_0x1880('0x27')](respondWithResult(_0x42d874,0xc9))[_0x1880('0x45')](handleError(_0x42d874,null));};exports[_0x1880('0x26')]=function(_0x1c15a8,_0x9983a9){if(_0x1c15a8[_0x1880('0x4b')]['id']){delete _0x1c15a8[_0x1880('0x4b')]['id'];}return db[_0x1880('0x30')][_0x1880('0x49')]({'where':{'id':_0x1c15a8[_0x1880('0x47')]['id']}})[_0x1880('0x27')](handleEntityNotFound(_0x9983a9,null))['then'](saveUpdates(_0x1c15a8[_0x1880('0x4b')],null))['then'](respondWithResult(_0x9983a9,null))[_0x1880('0x45')](handleError(_0x9983a9,null));};exports[_0x1880('0x4c')]=function(_0x4585d0,_0x335922){return db[_0x1880('0x30')][_0x1880('0x49')]({'where':{'id':_0x4585d0[_0x1880('0x47')]['id']}})[_0x1880('0x27')](handleEntityNotFound(_0x335922,null))[_0x1880('0x27')](removeEntity(_0x335922,null))[_0x1880('0x45')](handleError(_0x335922,null));};exports[_0x1880('0x4d')]=function(_0x321d11,_0x13e7e6,_0x549d11){var _0x5cae6f={};var _0x5281cf={};var _0x15544e;var _0x16668d;return db[_0x1880('0x30')][_0x1880('0x4e')]({'where':{'id':_0x321d11['params']['id']}})[_0x1880('0x27')](handleEntityNotFound(_0x13e7e6,null))[_0x1880('0x27')](function(_0x40b228){if(_0x40b228){_0x15544e=_0x40b228;_0x5281cf[_0x1880('0x34')]=_['keys'](db[_0x1880('0x4f')]['rawAttributes']);_0x5281cf[_0x1880('0x36')]=_[_0x1880('0x48')](_0x321d11[_0x1880('0x36')]);_0x5281cf[_0x1880('0x35')]=_[_0x1880('0x50')](_0x5281cf[_0x1880('0x34')],_0x5281cf[_0x1880('0x36')]);_0x5cae6f[_0x1880('0x37')]=_[_0x1880('0x50')](_0x5281cf[_0x1880('0x34')],qs[_0x1880('0x38')](_0x321d11['query'][_0x1880('0x38')]));_0x5cae6f[_0x1880('0x37')]=_0x5cae6f[_0x1880('0x37')][_0x1880('0x39')]?_0x5cae6f[_0x1880('0x37')]:_0x5281cf['model'];_0x5cae6f[_0x1880('0x3b')]=qs[_0x1880('0x3c')](_0x321d11[_0x1880('0x36')][_0x1880('0x3c')]);_0x5cae6f[_0x1880('0x3d')]=qs[_0x1880('0x35')](_[_0x1880('0x51')](_0x321d11[_0x1880('0x36')],_0x5281cf[_0x1880('0x35')]));if(_0x321d11[_0x1880('0x36')][_0x1880('0x3e')]){_0x5cae6f['where']=_['merge'](_0x5cae6f['where'],{'$or':_[_0x1880('0x2f')](_0x5cae6f[_0x1880('0x37')],function(_0x42a48d){var _0x2b2634={};_0x2b2634[_0x42a48d]={'$like':'%'+_0x321d11[_0x1880('0x36')][_0x1880('0x3e')]+'%'};return _0x2b2634;})});}_0x5cae6f=_[_0x1880('0x40')]({},_0x5cae6f,_0x321d11['options']);return _0x15544e['getFields'](_0x5cae6f);}})['then'](function(_0x71086e){if(_0x71086e){_0x16668d=_0x71086e[_0x1880('0x39')];if(!_0x321d11['query']['hasOwnProperty'](_0x1880('0x52'))){_0x5cae6f[_0x1880('0x20')]=qs[_0x1880('0x20')](_0x321d11[_0x1880('0x36')][_0x1880('0x20')]);_0x5cae6f[_0x1880('0x1e')]=qs['offset'](_0x321d11['query'][_0x1880('0x1e')]);}return _0x15544e['getFields'](_0x5cae6f);}})[_0x1880('0x27')](function(_0x457581){if(_0x457581){return _0x457581?{'count':_0x16668d,'rows':_0x457581}:null;}})['then'](respondWithResult(_0x13e7e6,null))[_0x1880('0x45')](handleError(_0x13e7e6,null));};exports['getSubjects']=function(_0x391a70,_0xd6e352,_0x244673){var _0x4b5ebf={};var _0x18320c={};var _0x193782;var _0x4d83dc;return db[_0x1880('0x30')][_0x1880('0x4e')]({'where':{'id':_0x391a70[_0x1880('0x47')]['id']}})[_0x1880('0x27')](handleEntityNotFound(_0xd6e352,null))[_0x1880('0x27')](function(_0x4bc05e){if(_0x4bc05e){_0x193782=_0x4bc05e;_0x18320c[_0x1880('0x34')]=_['keys'](db[_0x1880('0x4f')][_0x1880('0x31')]);_0x18320c[_0x1880('0x36')]=_[_0x1880('0x48')](_0x391a70[_0x1880('0x36')]);_0x18320c[_0x1880('0x35')]=_['intersection'](_0x18320c[_0x1880('0x34')],_0x18320c['query']);_0x4b5ebf['attributes']=_[_0x1880('0x50')](_0x18320c[_0x1880('0x34')],qs[_0x1880('0x38')](_0x391a70[_0x1880('0x36')][_0x1880('0x38')]));_0x4b5ebf['attributes']=_0x4b5ebf[_0x1880('0x37')][_0x1880('0x39')]?_0x4b5ebf[_0x1880('0x37')]:_0x18320c[_0x1880('0x34')];_0x4b5ebf[_0x1880('0x3b')]=qs[_0x1880('0x3c')](_0x391a70['query'][_0x1880('0x3c')]);_0x4b5ebf[_0x1880('0x3d')]=qs[_0x1880('0x35')](_[_0x1880('0x51')](_0x391a70['query'],_0x18320c[_0x1880('0x35')]));if(_0x391a70[_0x1880('0x36')]['filter']){_0x4b5ebf[_0x1880('0x3d')]=_[_0x1880('0x40')](_0x4b5ebf[_0x1880('0x3d')],{'$or':_[_0x1880('0x2f')](_0x4b5ebf[_0x1880('0x37')],function(_0x38dbbc){var _0x269c3e={};_0x269c3e[_0x38dbbc]={'$like':'%'+_0x391a70['query'][_0x1880('0x3e')]+'%'};return _0x269c3e;})});}_0x4b5ebf=_['merge']({},_0x4b5ebf,_0x391a70[_0x1880('0x41')]);return _0x193782['getSubjects'](_0x4b5ebf);}})[_0x1880('0x27')](function(_0x5664dc){if(_0x5664dc){_0x4d83dc=_0x5664dc[_0x1880('0x39')];if(!_0x391a70['query']['hasOwnProperty'](_0x1880('0x52'))){_0x4b5ebf[_0x1880('0x20')]=qs['limit'](_0x391a70[_0x1880('0x36')][_0x1880('0x20')]);_0x4b5ebf[_0x1880('0x1e')]=qs[_0x1880('0x1e')](_0x391a70['query'][_0x1880('0x1e')]);}return _0x193782['getSubjects'](_0x4b5ebf);}})[_0x1880('0x27')](function(_0x20f1df){if(_0x20f1df){return _0x20f1df?{'count':_0x4d83dc,'rows':_0x20f1df}:null;}})[_0x1880('0x27')](respondWithResult(_0xd6e352,null))[_0x1880('0x45')](handleError(_0xd6e352,null));};exports[_0x1880('0x53')]=function(_0x3a5041,_0x490e83,_0x536460){var _0xc24739={};var _0x4f2a61={};var _0x1c91c3;var _0x1c0309;return db[_0x1880('0x30')]['findOne']({'where':{'id':_0x3a5041[_0x1880('0x47')]['id']}})[_0x1880('0x27')](handleEntityNotFound(_0x490e83,null))['then'](function(_0x42e491){if(_0x42e491){_0x1c91c3=_0x42e491;_0x4f2a61['model']=_['keys'](db[_0x1880('0x4f')][_0x1880('0x31')]);_0x4f2a61[_0x1880('0x36')]=_[_0x1880('0x48')](_0x3a5041['query']);_0x4f2a61['filters']=_[_0x1880('0x50')](_0x4f2a61[_0x1880('0x34')],_0x4f2a61['query']);_0xc24739[_0x1880('0x37')]=_[_0x1880('0x50')](_0x4f2a61[_0x1880('0x34')],qs[_0x1880('0x38')](_0x3a5041[_0x1880('0x36')][_0x1880('0x38')]));_0xc24739[_0x1880('0x37')]=_0xc24739['attributes'][_0x1880('0x39')]?_0xc24739['attributes']:_0x4f2a61[_0x1880('0x34')];_0xc24739[_0x1880('0x3b')]=qs[_0x1880('0x3c')](_0x3a5041[_0x1880('0x36')][_0x1880('0x3c')]);_0xc24739[_0x1880('0x3d')]=qs[_0x1880('0x35')](_['pick'](_0x3a5041[_0x1880('0x36')],_0x4f2a61[_0x1880('0x35')]));if(_0x3a5041[_0x1880('0x36')]['filter']){_0xc24739[_0x1880('0x3d')]=_[_0x1880('0x40')](_0xc24739[_0x1880('0x3d')],{'$or':_['map'](_0xc24739[_0x1880('0x37')],function(_0x59e363){var _0x34f744={};_0x34f744[_0x59e363]={'$like':'%'+_0x3a5041[_0x1880('0x36')][_0x1880('0x3e')]+'%'};return _0x34f744;})});}_0xc24739=_[_0x1880('0x40')]({},_0xc24739,_0x3a5041[_0x1880('0x41')]);return _0x1c91c3[_0x1880('0x53')](_0xc24739);}})[_0x1880('0x27')](function(_0x422ad8){if(_0x422ad8){_0x1c0309=_0x422ad8[_0x1880('0x39')];if(!_0x3a5041['query'][_0x1880('0x3a')](_0x1880('0x52'))){_0xc24739['limit']=qs['limit'](_0x3a5041[_0x1880('0x36')][_0x1880('0x20')]);_0xc24739[_0x1880('0x1e')]=qs[_0x1880('0x1e')](_0x3a5041[_0x1880('0x36')][_0x1880('0x1e')]);}return _0x1c91c3[_0x1880('0x53')](_0xc24739);}})['then'](function(_0x151c79){if(_0x151c79){return _0x151c79?{'count':_0x1c0309,'rows':_0x151c79}:null;}})[_0x1880('0x27')](respondWithResult(_0x490e83,null))[_0x1880('0x45')](handleError(_0x490e83,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1512f3c..dd72c5d 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 _0x97d5=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','api','request-promise','path','rimraf'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x97d5,0x14f));var _0x597d=function(_0x5ea099,_0x30ec16){_0x5ea099=_0x5ea099-0x0;var _0x4ed1e1=_0x97d5[_0x5ea099];return _0x4ed1e1;};'use strict';var _=require(_0x597d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x597d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x597d('0x2'));var fs=require('fs');var path=require(_0x597d('0x3'));var rimraf=require(_0x597d('0x4'));var config=require(_0x597d('0x5'));var attributes=require(_0x597d('0x6'));module[_0x597d('0x7')]=function(_0x2e1342,_0x4de43d){return _0x2e1342[_0x597d('0x8')]('VtigerConfiguration',attributes,{'tableName':_0x597d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8288=['define','VtigerConfiguration','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x2861b4,_0x17bc7d){var _0x5814d6=function(_0x594c87){while(--_0x594c87){_0x2861b4['push'](_0x2861b4['shift']());}};_0x5814d6(++_0x17bc7d);}(_0x8288,0x70));var _0x8828=function(_0x2f5392,_0x5c074f){_0x2f5392=_0x2f5392-0x0;var _0x13fd19=_0x8288[_0x2f5392];return _0x13fd19;};'use strict';var _=require(_0x8828('0x0'));var util=require(_0x8828('0x1'));var logger=require('../../config/logger')(_0x8828('0x2'));var moment=require(_0x8828('0x3'));var BPromise=require(_0x8828('0x4'));var rp=require(_0x8828('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8828('0x6'));var config=require(_0x8828('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x8828('0x8')]=function(_0x3e2d68,_0x576018){return _0x3e2d68[_0x8828('0x9')](_0x8828('0xa'),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 39f3b58..34e36b2 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 _0xa233=['message','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x11e256,_0x5647fa){var _0x48035a=function(_0x3736f2){while(--_0x3736f2){_0x11e256['push'](_0x11e256['shift']());}};_0x48035a(++_0x5647fa);}(_0xa233,0x1cf));var _0x3a23=function(_0x578341,_0x53d8d6){_0x578341=_0x578341-0x0;var _0x2e79d7=_0xa233[_0x578341];return _0x2e79d7;};'use strict';var _=require(_0x3a23('0x0'));var util=require('util');var moment=require(_0x3a23('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a23('0x2'));var db=require(_0x3a23('0x3'))['db'];var utils=require(_0x3a23('0x4'));var logger=require(_0x3a23('0x5'))(_0x3a23('0x6'));var config=require(_0x3a23('0x7'));var jayson=require(_0x3a23('0x8'));var client=jayson[_0x3a23('0x9')][_0x3a23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c87ab,_0x5f1cc1,_0x430d4c){return new BPromise(function(_0x37b4e5,_0x1c43ad){return client[_0x3a23('0xb')](_0x1c87ab,_0x430d4c)[_0x3a23('0xc')](function(_0x424382){logger[_0x3a23('0xd')](_0x3a23('0xe'),_0x5f1cc1,'request\x20sent');logger[_0x3a23('0xf')](_0x3a23('0x10'),_0x5f1cc1,_0x3a23('0x11'),JSON[_0x3a23('0x12')](_0x424382));if(_0x424382[_0x3a23('0x13')]){if(_0x424382[_0x3a23('0x13')][_0x3a23('0x14')]===0x1f4){logger['error'](_0x3a23('0xe'),_0x5f1cc1,_0x424382[_0x3a23('0x13')][_0x3a23('0x15')]);return _0x1c43ad(_0x424382[_0x3a23('0x13')][_0x3a23('0x15')]);}logger[_0x3a23('0x13')](_0x3a23('0xe'),_0x5f1cc1,_0x424382[_0x3a23('0x13')][_0x3a23('0x15')]);return _0x37b4e5(_0x424382[_0x3a23('0x13')]['message']);}else{logger['info'](_0x3a23('0xe'),_0x5f1cc1,_0x3a23('0x11'));_0x37b4e5(_0x424382['result']['message']);}})['catch'](function(_0x4d42d1){logger[_0x3a23('0x13')](_0x3a23('0xe'),_0x5f1cc1,_0x4d42d1);_0x1c43ad(_0x4d42d1);});});} \ No newline at end of file +var _0xb277=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4038d3,_0x11ba20){var _0x3f4551=function(_0x54ad00){while(--_0x54ad00){_0x4038d3['push'](_0x4038d3['shift']());}};_0x3f4551(++_0x11ba20);}(_0xb277,0x119));var _0x7b27=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xb277[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x7b27('0x0'));var util=require(_0x7b27('0x1'));var moment=require(_0x7b27('0x2'));var BPromise=require(_0x7b27('0x3'));var rs=require(_0x7b27('0x4'));var fs=require('fs');var Redis=require(_0x7b27('0x5'));var db=require(_0x7b27('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b27('0x7'))('rpc');var config=require(_0x7b27('0x8'));var jayson=require(_0x7b27('0x9'));var client=jayson[_0x7b27('0xa')][_0x7b27('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ec408,_0x47af5a,_0x2c125e){return new BPromise(function(_0xa3246,_0x426fb9){return client[_0x7b27('0xc')](_0x3ec408,_0x2c125e)[_0x7b27('0xd')](function(_0x173284){logger[_0x7b27('0xe')](_0x7b27('0xf'),_0x47af5a,_0x7b27('0x10'));logger[_0x7b27('0x11')](_0x7b27('0x12'),_0x47af5a,'request\x20sent',JSON[_0x7b27('0x13')](_0x173284));if(_0x173284[_0x7b27('0x14')]){if(_0x173284[_0x7b27('0x14')]['code']===0x1f4){logger['error'](_0x7b27('0xf'),_0x47af5a,_0x173284[_0x7b27('0x14')][_0x7b27('0x15')]);return _0x426fb9(_0x173284['error'][_0x7b27('0x15')]);}logger['error'](_0x7b27('0xf'),_0x47af5a,_0x173284[_0x7b27('0x14')]['message']);return _0xa3246(_0x173284[_0x7b27('0x14')][_0x7b27('0x15')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x47af5a,_0x7b27('0x10'));_0xa3246(_0x173284['result'][_0x7b27('0x15')]);}})[_0x7b27('0x16')](function(_0x5c15a9){logger[_0x7b27('0x14')](_0x7b27('0xf'),_0x47af5a,_0x5c15a9);_0x426fb9(_0x5c15a9);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ad53329..160b8c7 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 _0x8d5b=['util','path','connect-timeout','express','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports'];(function(_0x1ae8ab,_0x6e5c2a){var _0x1ad705=function(_0x1dfa15){while(--_0x1dfa15){_0x1ae8ab['push'](_0x1ae8ab['shift']());}};_0x1ad705(++_0x6e5c2a);}(_0x8d5b,0x165));var _0xb8d5=function(_0x53e297,_0x53189b){_0x53e297=_0x53e297-0x0;var _0x4380ff=_0x8d5b[_0x53e297];return _0x4380ff;};'use strict';var multer=require('multer');var util=require(_0xb8d5('0x0'));var path=require(_0xb8d5('0x1'));var timeout=require(_0xb8d5('0x2'));var express=require(_0xb8d5('0x3'));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(_0xb8d5('0x4'));var controller=require(_0xb8d5('0x5'));router['get']('/',auth[_0xb8d5('0x6')](),controller[_0xb8d5('0x7')]);router[_0xb8d5('0x8')](_0xb8d5('0x9'),auth[_0xb8d5('0x6')](),controller[_0xb8d5('0xa')]);router[_0xb8d5('0xb')]('/',auth['isAuthenticated'](),controller[_0xb8d5('0xc')]);router[_0xb8d5('0xd')](_0xb8d5('0x9'),auth[_0xb8d5('0x6')](),controller[_0xb8d5('0xe')]);router[_0xb8d5('0xf')]('/:id',auth[_0xb8d5('0x6')](),controller['destroy']);module[_0xb8d5('0x10')]=router; \ No newline at end of file +var _0x2f9e=['./intVtigerField.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f9e,0xe8));var _0xe2f9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2f9e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xe2f9('0x0'));var path=require(_0xe2f9('0x1'));var timeout=require(_0xe2f9('0x2'));var express=require(_0xe2f9('0x3'));var router=express['Router']();var fs_extra=require(_0xe2f9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe2f9('0x5'));var controller=require(_0xe2f9('0x6'));router[_0xe2f9('0x7')]('/',auth[_0xe2f9('0x8')](),controller[_0xe2f9('0x9')]);router[_0xe2f9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xe2f9('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe2f9('0xb')]);router[_0xe2f9('0xc')](_0xe2f9('0xd'),auth[_0xe2f9('0x8')](),controller[_0xe2f9('0xe')]);router[_0xe2f9('0xf')](_0xe2f9('0xd'),auth[_0xe2f9('0x8')](),controller[_0xe2f9('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 71cbbce..2dc17e4 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 _0xb766=['BOOLEAN','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x564dce,_0x4f9004){var _0x1e7dd1=function(_0x1c2e67){while(--_0x1c2e67){_0x564dce['push'](_0x564dce['shift']());}};_0x1e7dd1(++_0x4f9004);}(_0xb766,0x135));var _0x6b76=function(_0x867b0a,_0x587ccf){_0x867b0a=_0x867b0a-0x0;var _0x137438=_0xb766[_0x867b0a];return _0x137438;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6b76('0x0')](_0x6b76('0x1'),'variable',_0x6b76('0x2'),_0x6b76('0x3'),'picklist'),'defaultValue':_0x6b76('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6b76('0x4')]},'keyType':{'type':Sequelize[_0x6b76('0x0')](_0x6b76('0x1'),_0x6b76('0x5'),_0x6b76('0x2'))},'keyContent':{'type':Sequelize[_0x6b76('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6b76('0x4')]},'customField':{'type':Sequelize[_0x6b76('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6b76('0x4')]}}; \ No newline at end of file +var _0x00af=['variable','ENUM','string','customVariable','picklist','STRING'];(function(_0x4cf3d0,_0x6f7dc0){var _0x346e9a=function(_0x4ccfb1){while(--_0x4ccfb1){_0x4cf3d0['push'](_0x4cf3d0['shift']());}};_0x346e9a(++_0x6f7dc0);}(_0x00af,0x11b));var _0xf00a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00af[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xf00a('0x0')](_0xf00a('0x1'),'variable',_0xf00a('0x2'),'keyValue',_0xf00a('0x3')),'defaultValue':_0xf00a('0x1')},'content':{'type':Sequelize[_0xf00a('0x4')]},'key':{'type':Sequelize[_0xf00a('0x4')]},'keyType':{'type':Sequelize['ENUM']('string',_0xf00a('0x5'),_0xf00a('0x2'))},'keyContent':{'type':Sequelize[_0xf00a('0x4')]},'idField':{'type':Sequelize[_0xf00a('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf00a('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 7f5ba17..4afc303 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 _0x2ffe=['name','index','map','VtigerField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x2ce9c3,_0x20a165){var _0x109b3a=function(_0xfd90e2){while(--_0xfd90e2){_0x2ce9c3['push'](_0x2ce9c3['shift']());}};_0x109b3a(++_0x20a165);}(_0x2ffe,0x155));var _0xe2ff=function(_0x2dc592,_0x275729){_0x2dc592=_0x2dc592-0x0;var _0x566979=_0x2ffe[_0x2dc592];return _0x566979;};'use strict';var emlformat=require(_0xe2ff('0x0'));var rimraf=require(_0xe2ff('0x1'));var zipdir=require(_0xe2ff('0x2'));var jsonpatch=require(_0xe2ff('0x3'));var rp=require(_0xe2ff('0x4'));var moment=require('moment');var BPromise=require(_0xe2ff('0x5'));var Mustache=require(_0xe2ff('0x6'));var util=require(_0xe2ff('0x7'));var path=require(_0xe2ff('0x8'));var sox=require(_0xe2ff('0x9'));var csv=require(_0xe2ff('0xa'));var ejs=require(_0xe2ff('0xb'));var fs=require('fs');var fs_extra=require(_0xe2ff('0xc'));var _=require('lodash');var squel=require(_0xe2ff('0xd'));var crypto=require(_0xe2ff('0xe'));var jsforce=require(_0xe2ff('0xf'));var deskjs=require(_0xe2ff('0x10'));var toCsv=require(_0xe2ff('0xa'));var querystring=require('querystring');var Papa=require(_0xe2ff('0x11'));var Redis=require('ioredis');var authService=require(_0xe2ff('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe2ff('0x13'));var hardwareService=require(_0xe2ff('0x14'));var logger=require(_0xe2ff('0x15'))(_0xe2ff('0x16'));var utils=require(_0xe2ff('0x17'));var config=require(_0xe2ff('0x18'));var licenseUtil=require(_0xe2ff('0x19'));var db=require(_0xe2ff('0x1a'))['db'];function respondWithStatusCode(_0x5ee8e3,_0x1945ab){_0x1945ab=_0x1945ab||0xcc;return function(_0x5960bc){if(_0x5960bc){return _0x5ee8e3[_0xe2ff('0x1b')](_0x1945ab);}return _0x5ee8e3[_0xe2ff('0x1c')](_0x1945ab)[_0xe2ff('0x1d')]();};}function respondWithResult(_0xb0ebdf,_0x586fa9){_0x586fa9=_0x586fa9||0xc8;return function(_0x2b275f){if(_0x2b275f){return _0xb0ebdf['status'](_0x586fa9)[_0xe2ff('0x1e')](_0x2b275f);}};}function respondWithFilteredResult(_0x217ecc,_0xaa72e2){return function(_0x4a0aa3){if(_0x4a0aa3){var _0x57ba9=typeof _0xaa72e2['offset']===_0xe2ff('0x1f')&&typeof _0xaa72e2[_0xe2ff('0x20')]===_0xe2ff('0x1f');var _0x260630=_0x4a0aa3[_0xe2ff('0x21')];var _0x1d5e5a=_0x57ba9?0x0:_0xaa72e2[_0xe2ff('0x22')];var _0x4f6855=_0x57ba9?_0x4a0aa3[_0xe2ff('0x21')]:_0xaa72e2[_0xe2ff('0x22')]+_0xaa72e2['limit'];var _0x12aa77;if(_0x4f6855>=_0x260630){_0x4f6855=_0x260630;_0x12aa77=0xc8;}else{_0x12aa77=0xce;}_0x217ecc['status'](_0x12aa77);return _0x217ecc[_0xe2ff('0x23')](_0xe2ff('0x24'),_0x1d5e5a+'-'+_0x4f6855+'/'+_0x260630)[_0xe2ff('0x1e')](_0x4a0aa3);}return null;};}function patchUpdates(_0x12e2ab){return function(_0x371435){try{jsonpatch[_0xe2ff('0x25')](_0x371435,_0x12e2ab,!![]);}catch(_0x372859){return BPromise[_0xe2ff('0x26')](_0x372859);}return _0x371435[_0xe2ff('0x27')]();};}function saveUpdates(_0x587bec,_0x7e942a){return function(_0x5ba013){if(_0x5ba013){return _0x5ba013[_0xe2ff('0x28')](_0x587bec)[_0xe2ff('0x29')](function(_0x4f19f3){return _0x4f19f3;});}return null;};}function removeEntity(_0x43e839,_0x3bfea3){return function(_0x4efdc9){if(_0x4efdc9){return _0x4efdc9['destroy']()[_0xe2ff('0x29')](function(){_0x43e839['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b0330,_0x306025){return function(_0x5de594){if(!_0x5de594){_0x1b0330[_0xe2ff('0x1b')](0x194);}return _0x5de594;};}function handleError(_0x340bae,_0x39839d){_0x39839d=_0x39839d||0x1f4;return function(_0x152503){logger[_0xe2ff('0x2a')](_0x152503[_0xe2ff('0x2b')]);if(_0x152503[_0xe2ff('0x2c')]){delete _0x152503[_0xe2ff('0x2c')];}_0x340bae[_0xe2ff('0x1c')](_0x39839d)['send'](_0x152503);};}exports[_0xe2ff('0x2d')]=function(_0x118a1d,_0x114a01){var _0x37b9aa={},_0x346800={},_0x47192a={'count':0x0,'rows':[]};var _0x4f45b3=_[_0xe2ff('0x2e')](db[_0xe2ff('0x2f')][_0xe2ff('0x30')],function(_0x24711f){return{'name':_0x24711f[_0xe2ff('0x31')],'type':_0x24711f[_0xe2ff('0x32')]['key']};});_0x346800[_0xe2ff('0x33')]=_[_0xe2ff('0x2e')](_0x4f45b3,_0xe2ff('0x2c'));_0x346800[_0xe2ff('0x34')]=_[_0xe2ff('0x35')](_0x118a1d['query']);_0x346800[_0xe2ff('0x36')]=_[_0xe2ff('0x37')](_0x346800['model'],_0x346800['query']);_0x37b9aa['attributes']=_['intersection'](_0x346800[_0xe2ff('0x33')],qs[_0xe2ff('0x38')](_0x118a1d[_0xe2ff('0x34')][_0xe2ff('0x38')]));_0x37b9aa['attributes']=_0x37b9aa[_0xe2ff('0x39')][_0xe2ff('0x3a')]?_0x37b9aa['attributes']:_0x346800['model'];if(!_0x118a1d[_0xe2ff('0x34')]['hasOwnProperty']('nolimit')){_0x37b9aa[_0xe2ff('0x20')]=qs[_0xe2ff('0x20')](_0x118a1d['query'][_0xe2ff('0x20')]);_0x37b9aa[_0xe2ff('0x22')]=qs[_0xe2ff('0x22')](_0x118a1d[_0xe2ff('0x34')][_0xe2ff('0x22')]);}_0x37b9aa['order']=qs[_0xe2ff('0x3b')](_0x118a1d[_0xe2ff('0x34')][_0xe2ff('0x3b')]);_0x37b9aa[_0xe2ff('0x3c')]=qs[_0xe2ff('0x36')](_[_0xe2ff('0x3d')](_0x118a1d[_0xe2ff('0x34')],_0x346800[_0xe2ff('0x36')]),_0x4f45b3);if(_0x118a1d[_0xe2ff('0x34')][_0xe2ff('0x3e')]){_0x37b9aa['where']=_[_0xe2ff('0x3f')](_0x37b9aa[_0xe2ff('0x3c')],{'$or':_[_0xe2ff('0x2e')](_0x4f45b3,function(_0x1ec9ae){if(_0x1ec9ae['type']!==_0xe2ff('0x40')){var _0x7f934a={};_0x7f934a[_0x1ec9ae[_0xe2ff('0x2c')]]={'$like':'%'+_0x118a1d[_0xe2ff('0x34')][_0xe2ff('0x3e')]+'%'};return _0x7f934a;}})});}_0x37b9aa=_['merge']({},_0x37b9aa,_0x118a1d[_0xe2ff('0x41')]);var _0x60f302={'where':_0x37b9aa[_0xe2ff('0x3c')]};return db[_0xe2ff('0x2f')][_0xe2ff('0x21')](_0x60f302)[_0xe2ff('0x29')](function(_0x2f1880){_0x47192a['count']=_0x2f1880;if(_0x118a1d['query'][_0xe2ff('0x42')]){_0x37b9aa[_0xe2ff('0x43')]=[{'all':!![]}];}return db['VtigerField'][_0xe2ff('0x44')](_0x37b9aa);})[_0xe2ff('0x29')](function(_0xd604c1){_0x47192a[_0xe2ff('0x45')]=_0xd604c1;return _0x47192a;})[_0xe2ff('0x29')](respondWithFilteredResult(_0x114a01,_0x37b9aa))[_0xe2ff('0x46')](handleError(_0x114a01,null));};exports[_0xe2ff('0x47')]=function(_0x482f80,_0x149965){var _0x3a5110={'raw':!![],'where':{'id':_0x482f80[_0xe2ff('0x48')]['id']}},_0x48f850={};_0x48f850[_0xe2ff('0x33')]=_[_0xe2ff('0x35')](db[_0xe2ff('0x2f')][_0xe2ff('0x30')]);_0x48f850[_0xe2ff('0x34')]=_[_0xe2ff('0x35')](_0x482f80[_0xe2ff('0x34')]);_0x48f850[_0xe2ff('0x36')]=_[_0xe2ff('0x37')](_0x48f850[_0xe2ff('0x33')],_0x48f850['query']);_0x3a5110[_0xe2ff('0x39')]=_[_0xe2ff('0x37')](_0x48f850[_0xe2ff('0x33')],qs[_0xe2ff('0x38')](_0x482f80[_0xe2ff('0x34')][_0xe2ff('0x38')]));_0x3a5110[_0xe2ff('0x39')]=_0x3a5110[_0xe2ff('0x39')][_0xe2ff('0x3a')]?_0x3a5110[_0xe2ff('0x39')]:_0x48f850[_0xe2ff('0x33')];if(_0x482f80['query'][_0xe2ff('0x42')]){_0x3a5110[_0xe2ff('0x43')]=[{'all':!![]}];}_0x3a5110=_[_0xe2ff('0x3f')]({},_0x3a5110,_0x482f80['options']);return db[_0xe2ff('0x2f')][_0xe2ff('0x49')](_0x3a5110)[_0xe2ff('0x29')](handleEntityNotFound(_0x149965,null))[_0xe2ff('0x29')](respondWithResult(_0x149965,null))[_0xe2ff('0x46')](handleError(_0x149965,null));};exports['create']=function(_0x44f422,_0x43c636){return db[_0xe2ff('0x2f')][_0xe2ff('0x4a')](_0x44f422[_0xe2ff('0x4b')],{})[_0xe2ff('0x29')](respondWithResult(_0x43c636,0xc9))['catch'](handleError(_0x43c636,null));};exports[_0xe2ff('0x28')]=function(_0x874d2,_0x8e44b1){if(_0x874d2[_0xe2ff('0x4b')]['id']){delete _0x874d2[_0xe2ff('0x4b')]['id'];}return db['VtigerField'][_0xe2ff('0x49')]({'where':{'id':_0x874d2[_0xe2ff('0x48')]['id']}})['then'](handleEntityNotFound(_0x8e44b1,null))['then'](saveUpdates(_0x874d2['body'],null))['then'](respondWithResult(_0x8e44b1,null))[_0xe2ff('0x46')](handleError(_0x8e44b1,null));};exports[_0xe2ff('0x4c')]=function(_0x5be505,_0x4cc3df){return db[_0xe2ff('0x2f')][_0xe2ff('0x49')]({'where':{'id':_0x5be505[_0xe2ff('0x48')]['id']}})[_0xe2ff('0x29')](handleEntityNotFound(_0x4cc3df,null))['then'](removeEntity(_0x4cc3df,null))[_0xe2ff('0x46')](handleError(_0x4cc3df,null));}; \ No newline at end of file +var _0x5ed8=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','end','error','name','send','index','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','merge','options','VtigerField','includeAll','include','findAll','params','keys','rawAttributes','find','catch','create','body'];(function(_0x1b0467,_0x47cffd){var _0x96b657=function(_0x493c46){while(--_0x493c46){_0x1b0467['push'](_0x1b0467['shift']());}};_0x96b657(++_0x47cffd);}(_0x5ed8,0x1b6));var _0x85ed=function(_0x1db7fb,_0x54396b){_0x1db7fb=_0x1db7fb-0x0;var _0x5dd4c7=_0x5ed8[_0x1db7fb];return _0x5dd4c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x85ed('0x0'));var zipdir=require(_0x85ed('0x1'));var jsonpatch=require(_0x85ed('0x2'));var rp=require(_0x85ed('0x3'));var moment=require(_0x85ed('0x4'));var BPromise=require(_0x85ed('0x5'));var Mustache=require('mustache');var util=require(_0x85ed('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x85ed('0x7'));var ejs=require(_0x85ed('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x85ed('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x85ed('0xa'));var deskjs=require(_0x85ed('0xb'));var toCsv=require(_0x85ed('0x7'));var querystring=require(_0x85ed('0xc'));var Papa=require(_0x85ed('0xd'));var Redis=require(_0x85ed('0xe'));var authService=require(_0x85ed('0xf'));var qs=require(_0x85ed('0x10'));var as=require(_0x85ed('0x11'));var hardwareService=require(_0x85ed('0x12'));var logger=require(_0x85ed('0x13'))(_0x85ed('0x14'));var utils=require(_0x85ed('0x15'));var config=require(_0x85ed('0x16'));var licenseUtil=require(_0x85ed('0x17'));var db=require(_0x85ed('0x18'))['db'];function respondWithStatusCode(_0x1a0002,_0x23d29f){_0x23d29f=_0x23d29f||0xcc;return function(_0x251997){if(_0x251997){return _0x1a0002[_0x85ed('0x19')](_0x23d29f);}return _0x1a0002[_0x85ed('0x1a')](_0x23d29f)['end']();};}function respondWithResult(_0x3043ba,_0x5575a4){_0x5575a4=_0x5575a4||0xc8;return function(_0x52f763){if(_0x52f763){return _0x3043ba[_0x85ed('0x1a')](_0x5575a4)[_0x85ed('0x1b')](_0x52f763);}};}function respondWithFilteredResult(_0x265879,_0x9639c3){return function(_0x371d4b){if(_0x371d4b){var _0x3fd797=typeof _0x9639c3[_0x85ed('0x1c')]===_0x85ed('0x1d')&&typeof _0x9639c3['limit']===_0x85ed('0x1d');var _0x3cacdf=_0x371d4b[_0x85ed('0x1e')];var _0x4533c6=_0x3fd797?0x0:_0x9639c3[_0x85ed('0x1c')];var _0x20fffe=_0x3fd797?_0x371d4b[_0x85ed('0x1e')]:_0x9639c3[_0x85ed('0x1c')]+_0x9639c3[_0x85ed('0x1f')];var _0x54f4ee;if(_0x20fffe>=_0x3cacdf){_0x20fffe=_0x3cacdf;_0x54f4ee=0xc8;}else{_0x54f4ee=0xce;}_0x265879[_0x85ed('0x1a')](_0x54f4ee);return _0x265879[_0x85ed('0x20')]('Content-Range',_0x4533c6+'-'+_0x20fffe+'/'+_0x3cacdf)['json'](_0x371d4b);}return null;};}function patchUpdates(_0x2fabb4){return function(_0x38e1ac){try{jsonpatch['apply'](_0x38e1ac,_0x2fabb4,!![]);}catch(_0x4306dc){return BPromise[_0x85ed('0x21')](_0x4306dc);}return _0x38e1ac[_0x85ed('0x22')]();};}function saveUpdates(_0x4b1e2b,_0x196d15){return function(_0x585cc8){if(_0x585cc8){return _0x585cc8[_0x85ed('0x23')](_0x4b1e2b)['then'](function(_0x3aed92){return _0x3aed92;});}return null;};}function removeEntity(_0xf9599e,_0x59d941){return function(_0x278695){if(_0x278695){return _0x278695[_0x85ed('0x24')]()[_0x85ed('0x25')](function(){_0xf9599e[_0x85ed('0x1a')](0xcc)[_0x85ed('0x26')]();});}};}function handleEntityNotFound(_0x75f3fb,_0x504403){return function(_0x5ca4ce){if(!_0x5ca4ce){_0x75f3fb['sendStatus'](0x194);}return _0x5ca4ce;};}function handleError(_0x49158e,_0x37e45e){_0x37e45e=_0x37e45e||0x1f4;return function(_0x1cf663){logger[_0x85ed('0x27')](_0x1cf663['stack']);if(_0x1cf663['name']){delete _0x1cf663[_0x85ed('0x28')];}_0x49158e[_0x85ed('0x1a')](_0x37e45e)[_0x85ed('0x29')](_0x1cf663);};}exports[_0x85ed('0x2a')]=function(_0x4b0213,_0x9e52b5){var _0x55fd38={},_0x41c64a={},_0x5d50ee={'count':0x0,'rows':[]};var _0x4e3c23=_['map'](db['VtigerField']['rawAttributes'],function(_0x55f04a){return{'name':_0x55f04a[_0x85ed('0x2b')],'type':_0x55f04a[_0x85ed('0x2c')][_0x85ed('0x2d')]};});_0x41c64a[_0x85ed('0x2e')]=_['map'](_0x4e3c23,_0x85ed('0x28'));_0x41c64a[_0x85ed('0x2f')]=_['keys'](_0x4b0213[_0x85ed('0x2f')]);_0x41c64a[_0x85ed('0x30')]=_[_0x85ed('0x31')](_0x41c64a[_0x85ed('0x2e')],_0x41c64a[_0x85ed('0x2f')]);_0x55fd38[_0x85ed('0x32')]=_[_0x85ed('0x31')](_0x41c64a[_0x85ed('0x2e')],qs['fields'](_0x4b0213[_0x85ed('0x2f')][_0x85ed('0x33')]));_0x55fd38['attributes']=_0x55fd38[_0x85ed('0x32')][_0x85ed('0x34')]?_0x55fd38[_0x85ed('0x32')]:_0x41c64a['model'];if(!_0x4b0213[_0x85ed('0x2f')]['hasOwnProperty'](_0x85ed('0x35'))){_0x55fd38[_0x85ed('0x1f')]=qs[_0x85ed('0x1f')](_0x4b0213['query'][_0x85ed('0x1f')]);_0x55fd38['offset']=qs[_0x85ed('0x1c')](_0x4b0213[_0x85ed('0x2f')]['offset']);}_0x55fd38[_0x85ed('0x36')]=qs[_0x85ed('0x37')](_0x4b0213[_0x85ed('0x2f')][_0x85ed('0x37')]);_0x55fd38['where']=qs['filters'](_[_0x85ed('0x38')](_0x4b0213[_0x85ed('0x2f')],_0x41c64a[_0x85ed('0x30')]),_0x4e3c23);if(_0x4b0213['query'][_0x85ed('0x39')]){_0x55fd38[_0x85ed('0x3a')]=_['merge'](_0x55fd38[_0x85ed('0x3a')],{'$or':_[_0x85ed('0x3b')](_0x4e3c23,function(_0x383f4a){if(_0x383f4a[_0x85ed('0x2c')]!=='VIRTUAL'){var _0x29feb4={};_0x29feb4[_0x383f4a[_0x85ed('0x28')]]={'$like':'%'+_0x4b0213['query'][_0x85ed('0x39')]+'%'};return _0x29feb4;}})});}_0x55fd38=_[_0x85ed('0x3c')]({},_0x55fd38,_0x4b0213[_0x85ed('0x3d')]);var _0x11262a={'where':_0x55fd38[_0x85ed('0x3a')]};return db[_0x85ed('0x3e')][_0x85ed('0x1e')](_0x11262a)[_0x85ed('0x25')](function(_0xffcc7e){_0x5d50ee[_0x85ed('0x1e')]=_0xffcc7e;if(_0x4b0213[_0x85ed('0x2f')][_0x85ed('0x3f')]){_0x55fd38[_0x85ed('0x40')]=[{'all':!![]}];}return db['VtigerField'][_0x85ed('0x41')](_0x55fd38);})['then'](function(_0x349800){_0x5d50ee['rows']=_0x349800;return _0x5d50ee;})[_0x85ed('0x25')](respondWithFilteredResult(_0x9e52b5,_0x55fd38))['catch'](handleError(_0x9e52b5,null));};exports['show']=function(_0x199f82,_0x34ba3d){var _0x56523d={'raw':!![],'where':{'id':_0x199f82[_0x85ed('0x42')]['id']}},_0x15dde3={};_0x15dde3[_0x85ed('0x2e')]=_[_0x85ed('0x43')](db[_0x85ed('0x3e')][_0x85ed('0x44')]);_0x15dde3[_0x85ed('0x2f')]=_[_0x85ed('0x43')](_0x199f82[_0x85ed('0x2f')]);_0x15dde3[_0x85ed('0x30')]=_[_0x85ed('0x31')](_0x15dde3['model'],_0x15dde3['query']);_0x56523d[_0x85ed('0x32')]=_[_0x85ed('0x31')](_0x15dde3[_0x85ed('0x2e')],qs['fields'](_0x199f82[_0x85ed('0x2f')][_0x85ed('0x33')]));_0x56523d[_0x85ed('0x32')]=_0x56523d['attributes']['length']?_0x56523d[_0x85ed('0x32')]:_0x15dde3[_0x85ed('0x2e')];if(_0x199f82[_0x85ed('0x2f')]['includeAll']){_0x56523d[_0x85ed('0x40')]=[{'all':!![]}];}_0x56523d=_['merge']({},_0x56523d,_0x199f82[_0x85ed('0x3d')]);return db[_0x85ed('0x3e')][_0x85ed('0x45')](_0x56523d)[_0x85ed('0x25')](handleEntityNotFound(_0x34ba3d,null))[_0x85ed('0x25')](respondWithResult(_0x34ba3d,null))[_0x85ed('0x46')](handleError(_0x34ba3d,null));};exports[_0x85ed('0x47')]=function(_0x3b9250,_0x370cd0){return db['VtigerField'][_0x85ed('0x47')](_0x3b9250[_0x85ed('0x48')],{})['then'](respondWithResult(_0x370cd0,0xc9))[_0x85ed('0x46')](handleError(_0x370cd0,null));};exports[_0x85ed('0x23')]=function(_0x2ab3d8,_0x4a4555){if(_0x2ab3d8[_0x85ed('0x48')]['id']){delete _0x2ab3d8['body']['id'];}return db[_0x85ed('0x3e')][_0x85ed('0x45')]({'where':{'id':_0x2ab3d8['params']['id']}})[_0x85ed('0x25')](handleEntityNotFound(_0x4a4555,null))[_0x85ed('0x25')](saveUpdates(_0x2ab3d8['body'],null))['then'](respondWithResult(_0x4a4555,null))[_0x85ed('0x46')](handleError(_0x4a4555,null));};exports[_0x85ed('0x24')]=function(_0x293245,_0x272dc9){return db['VtigerField'][_0x85ed('0x45')]({'where':{'id':_0x293245[_0x85ed('0x42')]['id']}})['then'](handleEntityNotFound(_0x272dc9,null))['then'](removeEntity(_0x272dc9,null))[_0x85ed('0x46')](handleError(_0x272dc9,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index cd86984..910e617 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 _0xdfa9=['vtiger_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VtigerField','int_vtiger_fields'];(function(_0x227ca1,_0x102c98){var _0xb27a73=function(_0x421eb3){while(--_0x421eb3){_0x227ca1['push'](_0x227ca1['shift']());}};_0xb27a73(++_0x102c98);}(_0xdfa9,0x72));var _0x9dfa=function(_0x1f2f49,_0x2ff8a5){_0x1f2f49=_0x1f2f49-0x0;var _0x7ef041=_0xdfa9[_0x1f2f49];return _0x7ef041;};'use strict';var _=require('lodash');var util=require(_0x9dfa('0x0'));var logger=require(_0x9dfa('0x1'))(_0x9dfa('0x2'));var moment=require(_0x9dfa('0x3'));var BPromise=require(_0x9dfa('0x4'));var rp=require(_0x9dfa('0x5'));var fs=require('fs');var path=require(_0x9dfa('0x6'));var rimraf=require(_0x9dfa('0x7'));var config=require(_0x9dfa('0x8'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x42e96d,_0x5673bd){return _0x42e96d[_0x9dfa('0x9')](_0x9dfa('0xa'),attributes,{'tableName':_0x9dfa('0xb'),'paranoid':![],'indexes':[{'name':_0x9dfa('0xc'),'fields':['idField',_0x9dfa('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0254=['../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x59ddb0,_0x2081c3){var _0x1dba64=function(_0x54b409){while(--_0x54b409){_0x59ddb0['push'](_0x59ddb0['shift']());}};_0x1dba64(++_0x2081c3);}(_0x0254,0x116));var _0x4025=function(_0x9ddcc6,_0x1c9c78){_0x9ddcc6=_0x9ddcc6-0x0;var _0x3a8ac8=_0x0254[_0x9ddcc6];return _0x3a8ac8;};'use strict';var _=require(_0x4025('0x0'));var util=require('util');var logger=require(_0x4025('0x1'))(_0x4025('0x2'));var moment=require(_0x4025('0x3'));var BPromise=require('bluebird');var rp=require(_0x4025('0x4'));var fs=require('fs');var path=require(_0x4025('0x5'));var rimraf=require(_0x4025('0x6'));var config=require(_0x4025('0x7'));var attributes=require(_0x4025('0x8'));module[_0x4025('0x9')]=function(_0x1ea9b6,_0x1415db){return _0x1ea9b6[_0x4025('0xa')](_0x4025('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x4025('0xc'),'fields':[_0x4025('0xd'),_0x4025('0xe')],'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 391c031..375e231 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 _0x5366=['http','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x37c028,_0x123307){var _0x4627a4=function(_0x27fa4c){while(--_0x27fa4c){_0x37c028['push'](_0x37c028['shift']());}};_0x4627a4(++_0x123307);}(_0x5366,0x137));var _0x6536=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0x5366[_0x4347ec];return _0x4c8314;};'use strict';var _=require(_0x6536('0x0'));var util=require(_0x6536('0x1'));var moment=require(_0x6536('0x2'));var BPromise=require(_0x6536('0x3'));var rs=require(_0x6536('0x4'));var fs=require('fs');var Redis=require(_0x6536('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6536('0x6'));var logger=require(_0x6536('0x7'))('rpc');var config=require(_0x6536('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6536('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17edbb,_0x34469a,_0x2dc2f0){return new BPromise(function(_0x5db4fb,_0x520388){return client['request'](_0x17edbb,_0x2dc2f0)['then'](function(_0x109400){logger[_0x6536('0xa')](_0x6536('0xb'),_0x34469a,_0x6536('0xc'));logger[_0x6536('0xd')](_0x6536('0xe'),_0x34469a,_0x6536('0xc'),JSON['stringify'](_0x109400));if(_0x109400[_0x6536('0xf')]){if(_0x109400[_0x6536('0xf')][_0x6536('0x10')]===0x1f4){logger[_0x6536('0xf')](_0x6536('0xb'),_0x34469a,_0x109400[_0x6536('0xf')][_0x6536('0x11')]);return _0x520388(_0x109400['error'][_0x6536('0x11')]);}logger[_0x6536('0xf')]('VtigerField,\x20%s,\x20%s',_0x34469a,_0x109400[_0x6536('0xf')]['message']);return _0x5db4fb(_0x109400['error'][_0x6536('0x11')]);}else{logger[_0x6536('0xa')]('VtigerField,\x20%s,\x20%s',_0x34469a,_0x6536('0xc'));_0x5db4fb(_0x109400[_0x6536('0x12')][_0x6536('0x11')]);}})[_0x6536('0x13')](function(_0x555311){logger['error'](_0x6536('0xb'),_0x34469a,_0x555311);_0x520388(_0x555311);});});} \ No newline at end of file +var _0x6d04=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','../../config/utils'];(function(_0x9cb3a8,_0x42950d){var _0x24a5f6=function(_0x4d0083){while(--_0x4d0083){_0x9cb3a8['push'](_0x9cb3a8['shift']());}};_0x24a5f6(++_0x42950d);}(_0x6d04,0x74));var _0x46d0=function(_0x5b952e,_0x26158d){_0x5b952e=_0x5b952e-0x0;var _0x34d8f1=_0x6d04[_0x5b952e];return _0x34d8f1;};'use strict';var _=require(_0x46d0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x46d0('0x1'));var rs=require(_0x46d0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x46d0('0x3'));var logger=require(_0x46d0('0x4'))(_0x46d0('0x5'));var config=require(_0x46d0('0x6'));var jayson=require(_0x46d0('0x7'));var client=jayson[_0x46d0('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d66b4,_0x5e0a1e,_0x5a621b){return new BPromise(function(_0x52bd79,_0x39c99a){return client[_0x46d0('0x9')](_0x4d66b4,_0x5a621b)[_0x46d0('0xa')](function(_0x419912){logger[_0x46d0('0xb')](_0x46d0('0xc'),_0x5e0a1e,_0x46d0('0xd'));logger['debug'](_0x46d0('0xe'),_0x5e0a1e,_0x46d0('0xd'),JSON[_0x46d0('0xf')](_0x419912));if(_0x419912[_0x46d0('0x10')]){if(_0x419912[_0x46d0('0x10')][_0x46d0('0x11')]===0x1f4){logger[_0x46d0('0x10')](_0x46d0('0xc'),_0x5e0a1e,_0x419912[_0x46d0('0x10')]['message']);return _0x39c99a(_0x419912[_0x46d0('0x10')][_0x46d0('0x12')]);}logger[_0x46d0('0x10')](_0x46d0('0xc'),_0x5e0a1e,_0x419912[_0x46d0('0x10')][_0x46d0('0x12')]);return _0x52bd79(_0x419912['error'][_0x46d0('0x12')]);}else{logger[_0x46d0('0xb')](_0x46d0('0xc'),_0x5e0a1e,_0x46d0('0xd'));_0x52bd79(_0x419912['result']['message']);}})[_0x46d0('0x13')](function(_0xc6d5ae){logger['error'](_0x46d0('0xc'),_0x5e0a1e,_0xc6d5ae);_0x39c99a(_0xc6d5ae);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 4cff52e..6b30e62 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 _0x58ef=['isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get'];(function(_0x23c4a9,_0x15eaf1){var _0xf708c5=function(_0x22f2be){while(--_0x22f2be){_0x23c4a9['push'](_0x23c4a9['shift']());}};_0xf708c5(++_0x15eaf1);}(_0x58ef,0x100));var _0xf58e=function(_0x5b2a3f,_0x2fe8df){_0x5b2a3f=_0x5b2a3f-0x0;var _0x40e48a=_0x58ef[_0x5b2a3f];return _0x40e48a;};'use strict';var multer=require('multer');var util=require(_0xf58e('0x0'));var path=require(_0xf58e('0x1'));var timeout=require(_0xf58e('0x2'));var express=require(_0xf58e('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf58e('0x4'));var interaction=require(_0xf58e('0x5'));var config=require('../../config/environment');var controller=require(_0xf58e('0x6'));router[_0xf58e('0x7')]('/',auth[_0xf58e('0x8')](),controller['index']);router[_0xf58e('0x7')](_0xf58e('0x9'),auth[_0xf58e('0x8')](),controller['show']);router['get'](_0xf58e('0xa'),auth[_0xf58e('0x8')](),controller[_0xf58e('0xb')]);router[_0xf58e('0x7')](_0xf58e('0xc'),auth['isAuthenticated'](),controller[_0xf58e('0xd')]);router['post']('/',auth[_0xf58e('0x8')](),controller[_0xf58e('0xe')]);router[_0xf58e('0xf')](_0xf58e('0xa'),auth[_0xf58e('0x8')](),controller[_0xf58e('0x10')]);router[_0xf58e('0x11')](_0xf58e('0x9'),auth['isAuthenticated'](),controller[_0xf58e('0x12')]);router[_0xf58e('0x13')](_0xf58e('0x9'),auth[_0xf58e('0x8')](),controller[_0xf58e('0x14')]);module[_0xf58e('0x15')]=router; \ No newline at end of file +var _0x0e33=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x56a469,_0x3b6292){var _0x5f0ca6=function(_0xcae04d){while(--_0xcae04d){_0x56a469['push'](_0x56a469['shift']());}};_0x5f0ca6(++_0x3b6292);}(_0x0e33,0xf8));var _0x30e3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0e33[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x30e3('0x0'));var util=require(_0x30e3('0x1'));var path=require('path');var timeout=require(_0x30e3('0x2'));var express=require(_0x30e3('0x3'));var router=express[_0x30e3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x30e3('0x5'));var interaction=require(_0x30e3('0x6'));var config=require(_0x30e3('0x7'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x30e3('0x8')](),controller[_0x30e3('0x9')]);router[_0x30e3('0xa')](_0x30e3('0xb'),auth['isAuthenticated'](),controller[_0x30e3('0xc')]);router[_0x30e3('0xa')](_0x30e3('0xd'),auth[_0x30e3('0x8')](),controller[_0x30e3('0xe')]);router['get'](_0x30e3('0xf'),auth[_0x30e3('0x8')](),controller[_0x30e3('0x10')]);router[_0x30e3('0x11')]('/',auth[_0x30e3('0x8')](),controller[_0x30e3('0x12')]);router['post'](_0x30e3('0xd'),auth[_0x30e3('0x8')](),controller['addConfiguration']);router[_0x30e3('0x13')](_0x30e3('0xb'),auth[_0x30e3('0x8')](),controller['update']);router[_0x30e3('0x14')](_0x30e3('0xb'),auth['isAuthenticated'](),controller[_0x30e3('0x15')]);module[_0x30e3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index fc17e88..afcdc66 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 _0x15b2=['ENUM','integrationTab','newTab','exports','STRING','remoteUri','password'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x15b2,0x145));var _0x215b=function(_0x50d5b1,_0x3716b4){_0x50d5b1=_0x50d5b1-0x0;var _0x96ec42=_0x15b2[_0x50d5b1];return _0x96ec42;};'use strict';var Sequelize=require('sequelize');module[_0x215b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x215b('0x1')]},'username':{'type':Sequelize[_0x215b('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x215b('0x1')]},'token':{'type':Sequelize[_0x215b('0x1')]},'remoteUri':{'type':Sequelize[_0x215b('0x1')],'unique':_0x215b('0x2')},'authType':{'type':Sequelize['ENUM'](_0x215b('0x3'),'token'),'defaultValue':_0x215b('0x3')},'serverUrl':{'type':Sequelize[_0x215b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x215b('0x4')](_0x215b('0x5'),_0x215b('0x6')),'defaultValue':_0x215b('0x5')}}; \ No newline at end of file +var _0x2ace=['password','token','integrationTab','newTab','exports','STRING','username','remoteUri','ENUM'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x2ace,0x17e));var _0xe2ac=function(_0x4fd82a,_0x29d9d5){_0x4fd82a=_0x4fd82a-0x0;var _0x21d2a8=_0x2ace[_0x4fd82a];return _0x21d2a8;};'use strict';var Sequelize=require('sequelize');module[_0xe2ac('0x0')]={'name':{'type':Sequelize[_0xe2ac('0x1')]},'description':{'type':Sequelize[_0xe2ac('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0xe2ac('0x2')},'password':{'type':Sequelize[_0xe2ac('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe2ac('0x1')],'unique':_0xe2ac('0x3')},'authType':{'type':Sequelize[_0xe2ac('0x4')](_0xe2ac('0x5'),_0xe2ac('0x6')),'defaultValue':_0xe2ac('0x5')},'serverUrl':{'type':Sequelize[_0xe2ac('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe2ac('0x4')](_0xe2ac('0x7'),_0xe2ac('0x8')),'defaultValue':_0xe2ac('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 4c8bb69..7e0899f 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 _0x4483=['fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','ZendeskAccount','includeAll','include','findAll','then','rows','catch','params','rawAttributes','length','merge','find','create','body','update','getConfigurations','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','authType','remoteUri','slice','lastIndexOf','format','%s/%s','password','headers','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Sequelize','ValidationError','subject','description','group','assignee','ticket_fields','includes','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','filters','intersection','model','attributes'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0x4483,0x1a3));var _0x3448=function(_0x4d95b4,_0xcb8aa6){_0x4d95b4=_0x4d95b4-0x0;var _0x2a64a3=_0x4483[_0x4d95b4];return _0x2a64a3;};'use strict';var emlformat=require(_0x3448('0x0'));var rimraf=require(_0x3448('0x1'));var zipdir=require(_0x3448('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3448('0x3'));var moment=require(_0x3448('0x4'));var BPromise=require(_0x3448('0x5'));var Mustache=require(_0x3448('0x6'));var util=require(_0x3448('0x7'));var path=require('path');var sox=require(_0x3448('0x8'));var csv=require(_0x3448('0x9'));var ejs=require(_0x3448('0xa'));var fs=require('fs');var fs_extra=require(_0x3448('0xb'));var _=require(_0x3448('0xc'));var squel=require(_0x3448('0xd'));var crypto=require(_0x3448('0xe'));var jsforce=require(_0x3448('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3448('0x10'));var Papa=require(_0x3448('0x11'));var Redis=require(_0x3448('0x12'));var authService=require(_0x3448('0x13'));var qs=require(_0x3448('0x14'));var as=require(_0x3448('0x15'));var hardwareService=require(_0x3448('0x16'));var logger=require(_0x3448('0x17'))(_0x3448('0x18'));var utils=require(_0x3448('0x19'));var config=require(_0x3448('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x3448('0x1b'));function respondWithStatusCode(_0x38fbb1,_0x5f52bd){_0x5f52bd=_0x5f52bd||0xcc;return function(_0x2661e1){if(_0x2661e1){return _0x38fbb1[_0x3448('0x1c')](_0x5f52bd);}return _0x38fbb1[_0x3448('0x1d')](_0x5f52bd)['end']();};}function respondWithResult(_0x14104c,_0x2952a6){_0x2952a6=_0x2952a6||0xc8;return function(_0x4daf3e){if(_0x4daf3e){return _0x14104c[_0x3448('0x1d')](_0x2952a6)[_0x3448('0x1e')](_0x4daf3e);}};}function respondWithFilteredResult(_0x46784f,_0x4fc70f){return function(_0x472518){if(_0x472518){var _0x28f5b9=typeof _0x4fc70f[_0x3448('0x1f')]===_0x3448('0x20')&&typeof _0x4fc70f[_0x3448('0x21')]===_0x3448('0x20');var _0x247d1a=_0x472518[_0x3448('0x22')];var _0x4a348c=_0x28f5b9?0x0:_0x4fc70f[_0x3448('0x1f')];var _0x5b410d=_0x28f5b9?_0x472518['count']:_0x4fc70f['offset']+_0x4fc70f[_0x3448('0x21')];var _0x278736;if(_0x5b410d>=_0x247d1a){_0x5b410d=_0x247d1a;_0x278736=0xc8;}else{_0x278736=0xce;}_0x46784f[_0x3448('0x1d')](_0x278736);return _0x46784f['set'](_0x3448('0x23'),_0x4a348c+'-'+_0x5b410d+'/'+_0x247d1a)[_0x3448('0x1e')](_0x472518);}return null;};}function patchUpdates(_0x317de6){return function(_0x18608e){try{jsonpatch[_0x3448('0x24')](_0x18608e,_0x317de6,!![]);}catch(_0x715c3){return BPromise['reject'](_0x715c3);}return _0x18608e['save']();};}function saveUpdates(_0x4e6716,_0x1b3d5a){return function(_0x200f72){if(_0x200f72){return _0x200f72['update'](_0x4e6716)['then'](function(_0x2dcd40){return _0x2dcd40;});}return null;};}function removeEntity(_0x4371d6,_0x22ad5c){return function(_0x4368c7){if(_0x4368c7){return _0x4368c7[_0x3448('0x25')]()['then'](function(){_0x4371d6[_0x3448('0x1d')](0xcc)[_0x3448('0x26')]();});}};}function handleEntityNotFound(_0x114244,_0x2088de){return function(_0x951811){if(!_0x951811){_0x114244['sendStatus'](0x194);}return _0x951811;};}function handleError(_0x329947,_0x393081){_0x393081=_0x393081||0x1f4;return function(_0x52c163){logger[_0x3448('0x27')](_0x52c163[_0x3448('0x28')]);if(_0x52c163[_0x3448('0x29')]){delete _0x52c163[_0x3448('0x29')];}_0x329947[_0x3448('0x1d')](_0x393081)[_0x3448('0x2a')](_0x52c163);};}exports[_0x3448('0x2b')]=function(_0x95714e,_0x5911b8){var _0x3307dc={},_0x450704={},_0xcfdc5={'count':0x0,'rows':[]};var _0x52c09d=_[_0x3448('0x2c')](db['ZendeskAccount']['rawAttributes'],function(_0x493898){return{'name':_0x493898[_0x3448('0x2d')],'type':_0x493898[_0x3448('0x2e')]['key']};});_0x450704['model']=_[_0x3448('0x2c')](_0x52c09d,_0x3448('0x29'));_0x450704[_0x3448('0x2f')]=_[_0x3448('0x30')](_0x95714e['query']);_0x450704[_0x3448('0x31')]=_[_0x3448('0x32')](_0x450704[_0x3448('0x33')],_0x450704['query']);_0x3307dc[_0x3448('0x34')]=_[_0x3448('0x32')](_0x450704['model'],qs['fields'](_0x95714e[_0x3448('0x2f')][_0x3448('0x35')]));_0x3307dc[_0x3448('0x34')]=_0x3307dc[_0x3448('0x34')]['length']?_0x3307dc[_0x3448('0x34')]:_0x450704[_0x3448('0x33')];if(!_0x95714e[_0x3448('0x2f')][_0x3448('0x36')]('nolimit')){_0x3307dc[_0x3448('0x21')]=qs[_0x3448('0x21')](_0x95714e['query'][_0x3448('0x21')]);_0x3307dc[_0x3448('0x1f')]=qs[_0x3448('0x1f')](_0x95714e[_0x3448('0x2f')][_0x3448('0x1f')]);}_0x3307dc[_0x3448('0x37')]=qs[_0x3448('0x38')](_0x95714e[_0x3448('0x2f')][_0x3448('0x38')]);_0x3307dc['where']=qs['filters'](_[_0x3448('0x39')](_0x95714e['query'],_0x450704[_0x3448('0x31')]),_0x52c09d);if(_0x95714e[_0x3448('0x2f')][_0x3448('0x3a')]){_0x3307dc[_0x3448('0x3b')]=_['merge'](_0x3307dc[_0x3448('0x3b')],{'$or':_[_0x3448('0x2c')](_0x52c09d,function(_0x495d7){if(_0x495d7[_0x3448('0x2e')]!==_0x3448('0x3c')){var _0x249131={};_0x249131[_0x495d7[_0x3448('0x29')]]={'$like':'%'+_0x95714e[_0x3448('0x2f')][_0x3448('0x3a')]+'%'};return _0x249131;}})});}_0x3307dc=_['merge']({},_0x3307dc,_0x95714e[_0x3448('0x3d')]);var _0x3c92e2={'where':_0x3307dc[_0x3448('0x3b')]};return db[_0x3448('0x3e')][_0x3448('0x22')](_0x3c92e2)['then'](function(_0x18b297){_0xcfdc5[_0x3448('0x22')]=_0x18b297;if(_0x95714e[_0x3448('0x2f')][_0x3448('0x3f')]){_0x3307dc[_0x3448('0x40')]=[{'all':!![]}];}return db[_0x3448('0x3e')][_0x3448('0x41')](_0x3307dc);})[_0x3448('0x42')](function(_0x4a8f80){_0xcfdc5[_0x3448('0x43')]=_0x4a8f80;return _0xcfdc5;})[_0x3448('0x42')](respondWithFilteredResult(_0x5911b8,_0x3307dc))[_0x3448('0x44')](handleError(_0x5911b8,null));};exports['show']=function(_0x2465ff,_0x1d2a7c){var _0x21f989={'raw':![],'where':{'id':_0x2465ff[_0x3448('0x45')]['id']}},_0x26d6b8={};_0x26d6b8[_0x3448('0x33')]=_[_0x3448('0x30')](db['ZendeskAccount'][_0x3448('0x46')]);_0x26d6b8[_0x3448('0x2f')]=_[_0x3448('0x30')](_0x2465ff[_0x3448('0x2f')]);_0x26d6b8[_0x3448('0x31')]=_[_0x3448('0x32')](_0x26d6b8['model'],_0x26d6b8[_0x3448('0x2f')]);_0x21f989['attributes']=_['intersection'](_0x26d6b8[_0x3448('0x33')],qs[_0x3448('0x35')](_0x2465ff['query'][_0x3448('0x35')]));_0x21f989[_0x3448('0x34')]=_0x21f989['attributes'][_0x3448('0x47')]?_0x21f989[_0x3448('0x34')]:_0x26d6b8['model'];if(_0x2465ff[_0x3448('0x2f')][_0x3448('0x3f')]){_0x21f989[_0x3448('0x40')]=[{'all':!![]}];}_0x21f989=_[_0x3448('0x48')]({},_0x21f989,_0x2465ff[_0x3448('0x3d')]);return db[_0x3448('0x3e')][_0x3448('0x49')](_0x21f989)['then'](handleEntityNotFound(_0x1d2a7c,null))['then'](respondWithResult(_0x1d2a7c,null))[_0x3448('0x44')](handleError(_0x1d2a7c,null));};exports[_0x3448('0x4a')]=function(_0x1b82e7,_0x3f48e3){return db['ZendeskAccount'][_0x3448('0x4a')](_0x1b82e7[_0x3448('0x4b')],{})[_0x3448('0x42')](respondWithResult(_0x3f48e3,0xc9))[_0x3448('0x44')](handleError(_0x3f48e3,null));};exports[_0x3448('0x4c')]=function(_0x5d942b,_0x3edd60){if(_0x5d942b['body']['id']){delete _0x5d942b[_0x3448('0x4b')]['id'];}return db[_0x3448('0x3e')]['find']({'where':{'id':_0x5d942b[_0x3448('0x45')]['id']}})[_0x3448('0x42')](handleEntityNotFound(_0x3edd60,null))[_0x3448('0x42')](saveUpdates(_0x5d942b[_0x3448('0x4b')],null))[_0x3448('0x42')](respondWithResult(_0x3edd60,null))[_0x3448('0x44')](handleError(_0x3edd60,null));};exports[_0x3448('0x25')]=function(_0x53236c,_0x23dbda){return db[_0x3448('0x3e')]['find']({'where':{'id':_0x53236c['params']['id']}})[_0x3448('0x42')](handleEntityNotFound(_0x23dbda,null))[_0x3448('0x42')](removeEntity(_0x23dbda,null))['catch'](handleError(_0x23dbda,null));};exports['getConfigurations']=function(_0x371e8a,_0xb6c293,_0x2f795d){var _0x430e74={};var _0x176e60={};var _0x39db50;var _0x2aea70;return db['ZendeskAccount']['findOne']({'where':{'id':_0x371e8a['params']['id']}})[_0x3448('0x42')](handleEntityNotFound(_0xb6c293,null))[_0x3448('0x42')](function(_0x5cf3fe){if(_0x5cf3fe){_0x39db50=_0x5cf3fe;_0x176e60[_0x3448('0x33')]=_[_0x3448('0x30')](db['ZendeskConfiguration'][_0x3448('0x46')]);_0x176e60[_0x3448('0x2f')]=_['keys'](_0x371e8a[_0x3448('0x2f')]);_0x176e60[_0x3448('0x31')]=_[_0x3448('0x32')](_0x176e60[_0x3448('0x33')],_0x176e60[_0x3448('0x2f')]);_0x430e74[_0x3448('0x34')]=_[_0x3448('0x32')](_0x176e60[_0x3448('0x33')],qs[_0x3448('0x35')](_0x371e8a['query'][_0x3448('0x35')]));_0x430e74['attributes']=_0x430e74[_0x3448('0x34')][_0x3448('0x47')]?_0x430e74[_0x3448('0x34')]:_0x176e60[_0x3448('0x33')];_0x430e74[_0x3448('0x37')]=qs[_0x3448('0x38')](_0x371e8a['query'][_0x3448('0x38')]);_0x430e74['where']=qs[_0x3448('0x31')](_[_0x3448('0x39')](_0x371e8a[_0x3448('0x2f')],_0x176e60[_0x3448('0x31')]));if(_0x371e8a[_0x3448('0x2f')]['filter']){_0x430e74['where']=_[_0x3448('0x48')](_0x430e74[_0x3448('0x3b')],{'$or':_[_0x3448('0x2c')](_0x430e74['attributes'],function(_0x7c00fe){var _0x3eb57b={};_0x3eb57b[_0x7c00fe]={'$like':'%'+_0x371e8a[_0x3448('0x2f')][_0x3448('0x3a')]+'%'};return _0x3eb57b;})});}_0x430e74=_[_0x3448('0x48')]({},_0x430e74,_0x371e8a[_0x3448('0x3d')]);return _0x39db50[_0x3448('0x4d')](_0x430e74);}})[_0x3448('0x42')](function(_0x36a151){if(_0x36a151){_0x2aea70=_0x36a151[_0x3448('0x47')];if(!_0x371e8a[_0x3448('0x2f')][_0x3448('0x36')](_0x3448('0x4e'))){_0x430e74[_0x3448('0x21')]=qs[_0x3448('0x21')](_0x371e8a[_0x3448('0x2f')][_0x3448('0x21')]);_0x430e74[_0x3448('0x1f')]=qs['offset'](_0x371e8a[_0x3448('0x2f')]['offset']);}return _0x39db50[_0x3448('0x4d')](_0x430e74);}})['then'](function(_0x1f1e3c){if(_0x1f1e3c){return _0x1f1e3c?{'count':_0x2aea70,'rows':_0x1f1e3c}:null;}})[_0x3448('0x42')](respondWithResult(_0xb6c293,null))['catch'](handleError(_0xb6c293,null));};exports[_0x3448('0x4f')]=function(_0x2f6517,_0x54cddd,_0x4f6902){if(_0x2f6517[_0x3448('0x4b')]['id']){delete _0x2f6517['body']['id'];}return db['ZendeskAccount'][_0x3448('0x50')]({'where':{'id':_0x2f6517[_0x3448('0x45')]['id']}})['then'](handleEntityNotFound(_0x54cddd,null))['then'](function(_0x1385b9){if(_0x1385b9){_0x2f6517[_0x3448('0x4b')][_0x3448('0x51')]=_0x1385b9['id'];_0x2f6517[_0x3448('0x4b')][_0x3448('0x52')]=integrations[_0x3448('0x53')](_0x2f6517[_0x3448('0x4b')][_0x3448('0x54')],_0x2f6517[_0x3448('0x4b')][_0x3448('0x2e')]);_0x2f6517[_0x3448('0x4b')][_0x3448('0x55')]=integrations[_0x3448('0x56')](_0x2f6517[_0x3448('0x4b')]['channel'],_0x2f6517[_0x3448('0x4b')][_0x3448('0x2e')]);return db['ZendeskConfiguration'][_0x3448('0x4a')](_0x2f6517[_0x3448('0x4b')],{'include':[{'model':db['ZendeskField'],'as':_0x3448('0x52')},{'model':db[_0x3448('0x57')],'as':_0x3448('0x55')}]});}return null;})['then'](respondWithResult(_0x54cddd,null))['catch'](handleError(_0x54cddd,null));};exports[_0x3448('0x58')]=function(_0x489b70,_0x31dfc5,_0x42c146){var _0x5d952a='';return db['ZendeskAccount'][_0x3448('0x50')]({'where':{'id':_0x489b70[_0x3448('0x45')]['id']},'attributes':['id',_0x3448('0x59'),'password','token',_0x3448('0x5a'),_0x3448('0x5b')]})[_0x3448('0x42')](handleEntityNotFound(_0x31dfc5,null))[_0x3448('0x42')](function(_0x29dd31){if(_0x29dd31){_0x5d952a=_0x29dd31[_0x3448('0x5b')];var _0x526f38=_0x5d952a[_0x3448('0x5c')](-0x1);if(_0x526f38==='/'){_0x5d952a=_0x5d952a['substring'](0x0,_0x5d952a[_0x3448('0x5d')](_0x526f38));}var _0x2cca2f={'method':'GET','uri':util[_0x3448('0x5e')](_0x3448('0x5f'),_0x5d952a,'ticket_fields'),'json':!![]};switch(_0x29dd31['authType']){case _0x3448('0x60'):_0x2cca2f[_0x3448('0x61')]={'Authorization':util[_0x3448('0x5e')](_0x3448('0x62'),new Buffer(util[_0x3448('0x5e')](_0x3448('0x63'),_0x29dd31[_0x3448('0x59')],_0x29dd31[_0x3448('0x60')]))[_0x3448('0x64')](_0x3448('0x65')))};break;case _0x3448('0x66'):_0x2cca2f[_0x3448('0x61')]={'Authorization':util[_0x3448('0x5e')](_0x3448('0x62'),new Buffer(util[_0x3448('0x5e')](_0x3448('0x67'),_0x29dd31['username'],_0x29dd31['token']))[_0x3448('0x64')]('base64'))};break;default:throw new db[(_0x3448('0x68'))][(_0x3448('0x69'))]('Unknown\x20authentication\x20type');}return rp(_0x2cca2f);}})[_0x3448('0x42')](function(_0x5f4352){if(_0x5f4352){var _0x15d898=[_0x3448('0x6a'),_0x3448('0x6b'),_0x3448('0x6c'),_0x3448('0x6d')];_['remove'](_0x5f4352[_0x3448('0x6e')],function(_0x2e2b73){return _0x15d898[_0x3448('0x6f')](_0x2e2b73['type']);});return{'count':_0x5f4352[_0x3448('0x6e')][_0x3448('0x47')],'rows':_[_0x3448('0x2c')](_0x5f4352['ticket_fields'],function(_0xdb5d71){return{'id':_0xdb5d71['id'],'name':_0xdb5d71['position']>0x7?_0xdb5d71['title']:_0xdb5d71[_0x3448('0x2e')],'custom':_0xdb5d71['position']>0x7?!![]:![],'options':_0xdb5d71[_0x3448('0x70')]?_0xdb5d71['system_field_options']:_0xdb5d71[_0x3448('0x71')]?_0xdb5d71[_0x3448('0x71')]:[]};})};}})['then'](respondWithResult(_0x31dfc5,null))['catch'](function(_0x2a3e76){var _0x287e21=_0x489b70['query'][_0x3448('0x72')]?0x1f4:_0x2a3e76[_0x3448('0x73')]||0x1f4;logger['error'](_0x3448('0x74'),_0x3448('0x58'),_0x287e21,JSON[_0x3448('0x75')](_0x2a3e76));delete _0x2a3e76[_0x3448('0x29')];if(_0x287e21===0x191){_0x287e21=0x190;}_0x31dfc5['status'](_0x287e21)[_0x3448('0x2a')](_0x489b70['query'][_0x3448('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x2a3e76[_0x3448('0x73')]}:_0x2a3e76);});}; \ No newline at end of file +var _0x84a0=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','show','length','include','find','catch','create','body','update','params','findOne','ZendeskConfiguration','order','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','username','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','password','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','token','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x51b752,_0x14926a){var _0x2b807c=function(_0xf25820){while(--_0xf25820){_0x51b752['push'](_0x51b752['shift']());}};_0x2b807c(++_0x14926a);}(_0x84a0,0x66));var _0x084a=function(_0x52930a,_0x419035){_0x52930a=_0x52930a-0x0;var _0x26b0c0=_0x84a0[_0x52930a];return _0x26b0c0;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];var integrations=require(_0x084a('0x18'));function respondWithStatusCode(_0xec90a5,_0x9245b1){_0x9245b1=_0x9245b1||0xcc;return function(_0x1bdfb8){if(_0x1bdfb8){return _0xec90a5[_0x084a('0x19')](_0x9245b1);}return _0xec90a5[_0x084a('0x1a')](_0x9245b1)[_0x084a('0x1b')]();};}function respondWithResult(_0x5aef40,_0x4277c9){_0x4277c9=_0x4277c9||0xc8;return function(_0x4b9cc5){if(_0x4b9cc5){return _0x5aef40[_0x084a('0x1a')](_0x4277c9)[_0x084a('0x1c')](_0x4b9cc5);}};}function respondWithFilteredResult(_0x366624,_0x2d35b8){return function(_0xd20527){if(_0xd20527){var _0x4cbd16=typeof _0x2d35b8[_0x084a('0x1d')]==='undefined'&&typeof _0x2d35b8[_0x084a('0x1e')]===_0x084a('0x1f');var _0x4af43e=_0xd20527[_0x084a('0x20')];var _0x32c729=_0x4cbd16?0x0:_0x2d35b8[_0x084a('0x1d')];var _0x14bb19=_0x4cbd16?_0xd20527[_0x084a('0x20')]:_0x2d35b8[_0x084a('0x1d')]+_0x2d35b8[_0x084a('0x1e')];var _0x34e86e;if(_0x14bb19>=_0x4af43e){_0x14bb19=_0x4af43e;_0x34e86e=0xc8;}else{_0x34e86e=0xce;}_0x366624[_0x084a('0x1a')](_0x34e86e);return _0x366624[_0x084a('0x21')](_0x084a('0x22'),_0x32c729+'-'+_0x14bb19+'/'+_0x4af43e)[_0x084a('0x1c')](_0xd20527);}return null;};}function patchUpdates(_0x116328){return function(_0x126efb){try{jsonpatch[_0x084a('0x23')](_0x126efb,_0x116328,!![]);}catch(_0x506f71){return BPromise[_0x084a('0x24')](_0x506f71);}return _0x126efb[_0x084a('0x25')]();};}function saveUpdates(_0x41a90f,_0x2d62bf){return function(_0x1c3f6c){if(_0x1c3f6c){return _0x1c3f6c['update'](_0x41a90f)[_0x084a('0x26')](function(_0x288e9e){return _0x288e9e;});}return null;};}function removeEntity(_0x6346a5,_0x1f2c9f){return function(_0x18b43d){if(_0x18b43d){return _0x18b43d[_0x084a('0x27')]()['then'](function(){_0x6346a5[_0x084a('0x1a')](0xcc)[_0x084a('0x1b')]();});}};}function handleEntityNotFound(_0x54233b,_0x5b1474){return function(_0x8806d5){if(!_0x8806d5){_0x54233b[_0x084a('0x19')](0x194);}return _0x8806d5;};}function handleError(_0xfc9b8c,_0x4c5658){_0x4c5658=_0x4c5658||0x1f4;return function(_0x5596ac){logger['error'](_0x5596ac['stack']);if(_0x5596ac[_0x084a('0x28')]){delete _0x5596ac['name'];}_0xfc9b8c['status'](_0x4c5658)['send'](_0x5596ac);};}exports[_0x084a('0x29')]=function(_0x4651e6,_0x388062){var _0x2c4149={},_0x3be7a6={},_0x25a2a1={'count':0x0,'rows':[]};var _0x378de6=_[_0x084a('0x2a')](db['ZendeskAccount'][_0x084a('0x2b')],function(_0x3b2b38){return{'name':_0x3b2b38['fieldName'],'type':_0x3b2b38[_0x084a('0x2c')][_0x084a('0x2d')]};});_0x3be7a6[_0x084a('0x2e')]=_[_0x084a('0x2a')](_0x378de6,_0x084a('0x28'));_0x3be7a6[_0x084a('0x2f')]=_[_0x084a('0x30')](_0x4651e6[_0x084a('0x2f')]);_0x3be7a6[_0x084a('0x31')]=_[_0x084a('0x32')](_0x3be7a6[_0x084a('0x2e')],_0x3be7a6[_0x084a('0x2f')]);_0x2c4149[_0x084a('0x33')]=_['intersection'](_0x3be7a6['model'],qs[_0x084a('0x34')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x34')]));_0x2c4149[_0x084a('0x33')]=_0x2c4149[_0x084a('0x33')]['length']?_0x2c4149[_0x084a('0x33')]:_0x3be7a6[_0x084a('0x2e')];if(!_0x4651e6[_0x084a('0x2f')]['hasOwnProperty'](_0x084a('0x35'))){_0x2c4149[_0x084a('0x1e')]=qs[_0x084a('0x1e')](_0x4651e6['query']['limit']);_0x2c4149['offset']=qs[_0x084a('0x1d')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x1d')]);}_0x2c4149['order']=qs[_0x084a('0x36')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x36')]);_0x2c4149[_0x084a('0x37')]=qs[_0x084a('0x31')](_[_0x084a('0x38')](_0x4651e6[_0x084a('0x2f')],_0x3be7a6[_0x084a('0x31')]),_0x378de6);if(_0x4651e6[_0x084a('0x2f')][_0x084a('0x39')]){_0x2c4149[_0x084a('0x37')]=_[_0x084a('0x3a')](_0x2c4149[_0x084a('0x37')],{'$or':_[_0x084a('0x2a')](_0x378de6,function(_0x10983f){if(_0x10983f['type']!==_0x084a('0x3b')){var _0x1dada8={};_0x1dada8[_0x10983f[_0x084a('0x28')]]={'$like':'%'+_0x4651e6[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x1dada8;}})});}_0x2c4149=_[_0x084a('0x3a')]({},_0x2c4149,_0x4651e6[_0x084a('0x3c')]);var _0x183e10={'where':_0x2c4149[_0x084a('0x37')]};return db['ZendeskAccount'][_0x084a('0x20')](_0x183e10)[_0x084a('0x26')](function(_0x25a081){_0x25a2a1[_0x084a('0x20')]=_0x25a081;if(_0x4651e6[_0x084a('0x2f')][_0x084a('0x3d')]){_0x2c4149['include']=[{'all':!![]}];}return db[_0x084a('0x3e')][_0x084a('0x3f')](_0x2c4149);})['then'](function(_0x410fdb){_0x25a2a1[_0x084a('0x40')]=_0x410fdb;return _0x25a2a1;})[_0x084a('0x26')](respondWithFilteredResult(_0x388062,_0x2c4149))['catch'](handleError(_0x388062,null));};exports[_0x084a('0x41')]=function(_0xba1081,_0x4fe9c2){var _0x3e2b92={'raw':![],'where':{'id':_0xba1081['params']['id']}},_0xfb565c={};_0xfb565c['model']=_[_0x084a('0x30')](db[_0x084a('0x3e')][_0x084a('0x2b')]);_0xfb565c[_0x084a('0x2f')]=_[_0x084a('0x30')](_0xba1081[_0x084a('0x2f')]);_0xfb565c[_0x084a('0x31')]=_[_0x084a('0x32')](_0xfb565c[_0x084a('0x2e')],_0xfb565c[_0x084a('0x2f')]);_0x3e2b92[_0x084a('0x33')]=_['intersection'](_0xfb565c['model'],qs[_0x084a('0x34')](_0xba1081[_0x084a('0x2f')][_0x084a('0x34')]));_0x3e2b92['attributes']=_0x3e2b92[_0x084a('0x33')][_0x084a('0x42')]?_0x3e2b92[_0x084a('0x33')]:_0xfb565c[_0x084a('0x2e')];if(_0xba1081[_0x084a('0x2f')]['includeAll']){_0x3e2b92[_0x084a('0x43')]=[{'all':!![]}];}_0x3e2b92=_['merge']({},_0x3e2b92,_0xba1081[_0x084a('0x3c')]);return db[_0x084a('0x3e')][_0x084a('0x44')](_0x3e2b92)['then'](handleEntityNotFound(_0x4fe9c2,null))['then'](respondWithResult(_0x4fe9c2,null))[_0x084a('0x45')](handleError(_0x4fe9c2,null));};exports[_0x084a('0x46')]=function(_0x505965,_0x29d8c2){return db[_0x084a('0x3e')][_0x084a('0x46')](_0x505965[_0x084a('0x47')],{})['then'](respondWithResult(_0x29d8c2,0xc9))[_0x084a('0x45')](handleError(_0x29d8c2,null));};exports[_0x084a('0x48')]=function(_0x31677b,_0x10856d){if(_0x31677b['body']['id']){delete _0x31677b[_0x084a('0x47')]['id'];}return db[_0x084a('0x3e')][_0x084a('0x44')]({'where':{'id':_0x31677b[_0x084a('0x49')]['id']}})['then'](handleEntityNotFound(_0x10856d,null))['then'](saveUpdates(_0x31677b[_0x084a('0x47')],null))[_0x084a('0x26')](respondWithResult(_0x10856d,null))[_0x084a('0x45')](handleError(_0x10856d,null));};exports[_0x084a('0x27')]=function(_0xf936e,_0x3b2df4){return db[_0x084a('0x3e')][_0x084a('0x44')]({'where':{'id':_0xf936e[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x3b2df4,null))[_0x084a('0x26')](removeEntity(_0x3b2df4,null))[_0x084a('0x45')](handleError(_0x3b2df4,null));};exports['getConfigurations']=function(_0xcdd5b,_0x37fce4,_0x29fa4b){var _0x39edc1={};var _0x2091b1={};var _0x1c972c;var _0xa5362;return db['ZendeskAccount'][_0x084a('0x4a')]({'where':{'id':_0xcdd5b[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x37fce4,null))['then'](function(_0x54ca1f){if(_0x54ca1f){_0x1c972c=_0x54ca1f;_0x2091b1[_0x084a('0x2e')]=_['keys'](db[_0x084a('0x4b')][_0x084a('0x2b')]);_0x2091b1['query']=_[_0x084a('0x30')](_0xcdd5b['query']);_0x2091b1['filters']=_[_0x084a('0x32')](_0x2091b1[_0x084a('0x2e')],_0x2091b1[_0x084a('0x2f')]);_0x39edc1[_0x084a('0x33')]=_[_0x084a('0x32')](_0x2091b1[_0x084a('0x2e')],qs[_0x084a('0x34')](_0xcdd5b['query'][_0x084a('0x34')]));_0x39edc1[_0x084a('0x33')]=_0x39edc1[_0x084a('0x33')]['length']?_0x39edc1[_0x084a('0x33')]:_0x2091b1[_0x084a('0x2e')];_0x39edc1[_0x084a('0x4c')]=qs[_0x084a('0x36')](_0xcdd5b['query'][_0x084a('0x36')]);_0x39edc1['where']=qs[_0x084a('0x31')](_[_0x084a('0x38')](_0xcdd5b[_0x084a('0x2f')],_0x2091b1['filters']));if(_0xcdd5b['query'][_0x084a('0x39')]){_0x39edc1[_0x084a('0x37')]=_['merge'](_0x39edc1[_0x084a('0x37')],{'$or':_['map'](_0x39edc1['attributes'],function(_0x195ae2){var _0x3f3fd7={};_0x3f3fd7[_0x195ae2]={'$like':'%'+_0xcdd5b[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x3f3fd7;})});}_0x39edc1=_[_0x084a('0x3a')]({},_0x39edc1,_0xcdd5b[_0x084a('0x3c')]);return _0x1c972c[_0x084a('0x4d')](_0x39edc1);}})[_0x084a('0x26')](function(_0x114aa5){if(_0x114aa5){_0xa5362=_0x114aa5['length'];if(!_0xcdd5b[_0x084a('0x2f')][_0x084a('0x4e')](_0x084a('0x35'))){_0x39edc1['limit']=qs[_0x084a('0x1e')](_0xcdd5b[_0x084a('0x2f')]['limit']);_0x39edc1[_0x084a('0x1d')]=qs['offset'](_0xcdd5b['query'][_0x084a('0x1d')]);}return _0x1c972c['getConfigurations'](_0x39edc1);}})['then'](function(_0x2368f5){if(_0x2368f5){return _0x2368f5?{'count':_0xa5362,'rows':_0x2368f5}:null;}})[_0x084a('0x26')](respondWithResult(_0x37fce4,null))[_0x084a('0x45')](handleError(_0x37fce4,null));};exports['addConfiguration']=function(_0xff6c9e,_0xbd063c,_0x2311f5){if(_0xff6c9e[_0x084a('0x47')]['id']){delete _0xff6c9e[_0x084a('0x47')]['id'];}return db[_0x084a('0x3e')][_0x084a('0x4a')]({'where':{'id':_0xff6c9e['params']['id']}})['then'](handleEntityNotFound(_0xbd063c,null))[_0x084a('0x26')](function(_0x36ba24){if(_0x36ba24){_0xff6c9e['body'][_0x084a('0x4f')]=_0x36ba24['id'];_0xff6c9e[_0x084a('0x47')][_0x084a('0x50')]=integrations[_0x084a('0x51')](_0xff6c9e['body'][_0x084a('0x52')],_0xff6c9e[_0x084a('0x47')][_0x084a('0x2c')]);_0xff6c9e['body']['Descriptions']=integrations[_0x084a('0x53')](_0xff6c9e[_0x084a('0x47')][_0x084a('0x52')],_0xff6c9e[_0x084a('0x47')][_0x084a('0x2c')]);return db[_0x084a('0x4b')][_0x084a('0x46')](_0xff6c9e['body'],{'include':[{'model':db[_0x084a('0x54')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x084a('0x55')}]});}return null;})[_0x084a('0x26')](respondWithResult(_0xbd063c,null))[_0x084a('0x45')](handleError(_0xbd063c,null));};exports['getFields']=function(_0x163a5d,_0x57729c,_0x1eb7be){var _0x1054ea='';return db[_0x084a('0x3e')][_0x084a('0x4a')]({'where':{'id':_0x163a5d[_0x084a('0x49')]['id']},'attributes':['id',_0x084a('0x56'),'password','token',_0x084a('0x57'),_0x084a('0x58')]})[_0x084a('0x26')](handleEntityNotFound(_0x57729c,null))[_0x084a('0x26')](function(_0x22abf5){if(_0x22abf5){_0x1054ea=_0x22abf5[_0x084a('0x58')];var _0x5c655f=_0x1054ea[_0x084a('0x59')](-0x1);if(_0x5c655f==='/'){_0x1054ea=_0x1054ea[_0x084a('0x5a')](0x0,_0x1054ea[_0x084a('0x5b')](_0x5c655f));}var _0x33c040={'method':_0x084a('0x5c'),'uri':util[_0x084a('0x5d')](_0x084a('0x5e'),_0x1054ea,'ticket_fields'),'json':!![]};switch(_0x22abf5[_0x084a('0x57')]){case _0x084a('0x5f'):_0x33c040[_0x084a('0x60')]={'Authorization':util[_0x084a('0x5d')](_0x084a('0x61'),new Buffer(util[_0x084a('0x5d')](_0x084a('0x62'),_0x22abf5[_0x084a('0x56')],_0x22abf5[_0x084a('0x5f')]))[_0x084a('0x63')]('base64'))};break;case'token':_0x33c040['headers']={'Authorization':util[_0x084a('0x5d')](_0x084a('0x61'),new Buffer(util['format'](_0x084a('0x64'),_0x22abf5[_0x084a('0x56')],_0x22abf5[_0x084a('0x65')]))[_0x084a('0x63')]('base64'))};break;default:throw new db['Sequelize'][(_0x084a('0x66'))](_0x084a('0x67'));}return rp(_0x33c040);}})[_0x084a('0x26')](function(_0x37d05a){if(_0x37d05a){var _0x155450=[_0x084a('0x68'),_0x084a('0x69'),'group',_0x084a('0x6a')];_[_0x084a('0x6b')](_0x37d05a[_0x084a('0x6c')],function(_0x137bba){return _0x155450[_0x084a('0x6d')](_0x137bba[_0x084a('0x2c')]);});return{'count':_0x37d05a[_0x084a('0x6c')]['length'],'rows':_[_0x084a('0x2a')](_0x37d05a[_0x084a('0x6c')],function(_0x26a88c){return{'id':_0x26a88c['id'],'name':_0x26a88c[_0x084a('0x6e')]>0x7?_0x26a88c[_0x084a('0x6f')]:_0x26a88c[_0x084a('0x2c')],'custom':_0x26a88c[_0x084a('0x6e')]>0x7?!![]:![],'options':_0x26a88c[_0x084a('0x70')]?_0x26a88c[_0x084a('0x70')]:_0x26a88c[_0x084a('0x71')]?_0x26a88c[_0x084a('0x71')]:[]};})};}})['then'](respondWithResult(_0x57729c,null))[_0x084a('0x45')](function(_0x29916a){var _0x4b8f1f=_0x163a5d[_0x084a('0x2f')]['test']?0x1f4:_0x29916a['statusCode']||0x1f4;logger[_0x084a('0x72')](_0x084a('0x73'),'getFields',_0x4b8f1f,JSON[_0x084a('0x74')](_0x29916a));delete _0x29916a[_0x084a('0x28')];if(_0x4b8f1f===0x191){_0x4b8f1f=0x190;}_0x57729c[_0x084a('0x1a')](_0x4b8f1f)[_0x084a('0x75')](_0x163a5d[_0x084a('0x2f')][_0x084a('0x76')]?{'message':_0x084a('0x77'),'statusCode':_0x29916a[_0x084a('0x78')]}:_0x29916a);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 993e238..60bfca5 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 _0x7c1a=['bluebird','path','rimraf','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','moment'];(function(_0x48068f,_0x57d27f){var _0x38fa17=function(_0x611efc){while(--_0x611efc){_0x48068f['push'](_0x48068f['shift']());}};_0x38fa17(++_0x57d27f);}(_0x7c1a,0x80));var _0xa7c1=function(_0x1d5af8,_0x4f041b){_0x1d5af8=_0x1d5af8-0x0;var _0x427556=_0x7c1a[_0x1d5af8];return _0x427556;};'use strict';var _=require(_0xa7c1('0x0'));var util=require('util');var logger=require(_0xa7c1('0x1'))(_0xa7c1('0x2'));var moment=require(_0xa7c1('0x3'));var BPromise=require(_0xa7c1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7c1('0x5'));var rimraf=require(_0xa7c1('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xa7c1('0x7'));module['exports']=function(_0x596cf1,_0x1086ef){return _0x596cf1[_0xa7c1('0x8')](_0xa7c1('0x9'),attributes,{'tableName':_0xa7c1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe190=['ZendeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x319dcb,_0x574449){var _0x40c004=function(_0x305960){while(--_0x305960){_0x319dcb['push'](_0x319dcb['shift']());}};_0x40c004(++_0x574449);}(_0xe190,0xdd));var _0x0e19=function(_0x4ba8c3,_0x33c457){_0x4ba8c3=_0x4ba8c3-0x0;var _0xf65364=_0xe190[_0x4ba8c3];return _0xf65364;};'use strict';var _=require(_0x0e19('0x0'));var util=require(_0x0e19('0x1'));var logger=require(_0x0e19('0x2'))(_0x0e19('0x3'));var moment=require(_0x0e19('0x4'));var BPromise=require(_0x0e19('0x5'));var rp=require(_0x0e19('0x6'));var fs=require('fs');var path=require(_0x0e19('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0e19('0x8')]=function(_0x2b6e17,_0x1e49ee){return _0x2b6e17['define'](_0x0e19('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index e2942cf..c8772bb 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 _0x9d1c=['jayson/promise','client','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','options','raw','where','attributes','limit','include','map','model','then','ShowZendeskAccount','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x1b2916,_0x54c8b8){var _0x386928=function(_0x1064ec){while(--_0x1064ec){_0x1b2916['push'](_0x1b2916['shift']());}};_0x386928(++_0x54c8b8);}(_0x9d1c,0xb9));var _0xc9d1=function(_0x5904d2,_0x259561){_0x5904d2=_0x5904d2-0x0;var _0x3ecff7=_0x9d1c[_0x5904d2];return _0x3ecff7;};'use strict';var _=require(_0xc9d1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc9d1('0x1'));var rs=require(_0xc9d1('0x2'));var fs=require('fs');var Redis=require(_0xc9d1('0x3'));var db=require(_0xc9d1('0x4'))['db'];var utils=require(_0xc9d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xc9d1('0x6'));var jayson=require(_0xc9d1('0x7'));var client=jayson[_0xc9d1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39e563,_0xeea3a0,_0x2d476c){return new BPromise(function(_0x32b599,_0x1607ec){return client[_0xc9d1('0x9')](_0x39e563,_0x2d476c)['then'](function(_0x38da4d){logger[_0xc9d1('0xa')]('ZendeskAccount,\x20%s,\x20%s',_0xeea3a0,_0xc9d1('0xb'));logger[_0xc9d1('0xc')](_0xc9d1('0xd'),_0xeea3a0,_0xc9d1('0xb'),JSON['stringify'](_0x38da4d));if(_0x38da4d[_0xc9d1('0xe')]){if(_0x38da4d[_0xc9d1('0xe')][_0xc9d1('0xf')]===0x1f4){logger[_0xc9d1('0xe')](_0xc9d1('0x10'),_0xeea3a0,_0x38da4d['error'][_0xc9d1('0x11')]);return _0x1607ec(_0x38da4d['error'][_0xc9d1('0x11')]);}logger[_0xc9d1('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0xeea3a0,_0x38da4d[_0xc9d1('0xe')][_0xc9d1('0x11')]);return _0x32b599(_0x38da4d[_0xc9d1('0xe')][_0xc9d1('0x11')]);}else{logger[_0xc9d1('0xa')](_0xc9d1('0x10'),_0xeea3a0,'request\x20sent');_0x32b599(_0x38da4d[_0xc9d1('0x12')][_0xc9d1('0x11')]);}})[_0xc9d1('0x13')](function(_0x140894){logger['error'](_0xc9d1('0x10'),_0xeea3a0,_0x140894);_0x1607ec(_0x140894);});});}exports[_0xc9d1('0x14')]=function(_0x347159){var _0x3dadb0=this;return new Promise(function(_0x51ef10,_0x38e92e){return db['ZendeskAccount']['findAll']({'raw':_0x347159[_0xc9d1('0x15')]?_0x347159[_0xc9d1('0x15')][_0xc9d1('0x16')]===undefined?!![]:![]:!![],'where':_0x347159[_0xc9d1('0x15')]?_0x347159['options'][_0xc9d1('0x17')]||null:null,'attributes':_0x347159[_0xc9d1('0x15')]?_0x347159[_0xc9d1('0x15')][_0xc9d1('0x18')]||null:null,'limit':_0x347159[_0xc9d1('0x15')]?_0x347159[_0xc9d1('0x15')][_0xc9d1('0x19')]||null:null,'include':_0x347159[_0xc9d1('0x15')]?_0x347159[_0xc9d1('0x15')][_0xc9d1('0x1a')]?_[_0xc9d1('0x1b')](_0x347159['options']['include'],function(_0x3e6dd5){return{'model':db[_0x3e6dd5[_0xc9d1('0x1c')]],'as':_0x3e6dd5['as'],'attributes':_0x3e6dd5['attributes'],'include':_0x3e6dd5[_0xc9d1('0x1a')]?_['map'](_0x3e6dd5[_0xc9d1('0x1a')],function(_0x4e13f8){return{'model':db[_0x4e13f8[_0xc9d1('0x1c')]],'as':_0x4e13f8['as'],'attributes':_0x4e13f8[_0xc9d1('0x18')],'include':_0x4e13f8[_0xc9d1('0x1a')]?_['map'](_0x4e13f8['include'],function(_0x560000){return{'model':db[_0x560000[_0xc9d1('0x1c')]],'as':_0x560000['as'],'attributes':_0x560000[_0xc9d1('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc9d1('0x1d')](function(_0x21e28a){logger['info'](_0xc9d1('0x14'),_0x347159);logger[_0xc9d1('0xc')](_0xc9d1('0x14'),_0x347159,JSON['stringify'](_0x21e28a));_0x51ef10(_0x21e28a);})[_0xc9d1('0x13')](function(_0x3aa879){logger[_0xc9d1('0xe')]('GetZendeskAccount',_0x3aa879['message'],_0x347159);_0x38e92e(_0x3dadb0[_0xc9d1('0xe')](0x1f4,_0x3aa879[_0xc9d1('0x11')]));});});};exports[_0xc9d1('0x1e')]=function(_0x869124){var _0x3199c4=this;return new Promise(function(_0x16682a,_0x519a0e){return db['ZendeskAccount']['find']({'raw':_0x869124[_0xc9d1('0x15')]?_0x869124['options'][_0xc9d1('0x16')]===undefined?!![]:![]:!![],'where':_0x869124[_0xc9d1('0x15')]?_0x869124['options']['where']||null:null,'attributes':_0x869124['options']?_0x869124[_0xc9d1('0x15')][_0xc9d1('0x18')]||null:null,'include':_0x869124[_0xc9d1('0x15')]?_0x869124[_0xc9d1('0x15')]['include']?_[_0xc9d1('0x1b')](_0x869124['options'][_0xc9d1('0x1a')],function(_0x35b6e7){return{'model':db[_0x35b6e7[_0xc9d1('0x1c')]],'as':_0x35b6e7['as'],'attributes':_0x35b6e7['attributes'],'include':_0x35b6e7[_0xc9d1('0x1a')]?_[_0xc9d1('0x1b')](_0x35b6e7['include'],function(_0x2d6b15){return{'model':db[_0x2d6b15['model']],'as':_0x2d6b15['as'],'attributes':_0x2d6b15[_0xc9d1('0x18')],'include':_0x2d6b15['include']?_[_0xc9d1('0x1b')](_0x2d6b15[_0xc9d1('0x1a')],function(_0x403f13){return{'model':db[_0x403f13[_0xc9d1('0x1c')]],'as':_0x403f13['as'],'attributes':_0x403f13[_0xc9d1('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58d042){logger[_0xc9d1('0xa')](_0xc9d1('0x1e'),_0x869124);logger[_0xc9d1('0xc')](_0xc9d1('0x1e'),_0x869124,JSON[_0xc9d1('0x1f')](_0x58d042));_0x16682a(_0x58d042);})[_0xc9d1('0x13')](function(_0xe064d9){logger[_0xc9d1('0xe')]('ShowZendeskAccount',_0xe064d9[_0xc9d1('0x11')],_0x869124);_0x519a0e(_0x3199c4[_0xc9d1('0xe')](0x1f4,_0xe064d9[_0xc9d1('0x11')]));});});}; \ No newline at end of file +var _0xcb09=['../../config/environment','jayson/promise','client','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','options','raw','where','attributes','include','map','model','ShowZendeskAccount','ZendeskAccount','find','lodash','util','randomstring','ioredis'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xcb09,0x1a0));var _0x9cb0=function(_0x4465c1,_0x224513){_0x4465c1=_0x4465c1-0x0;var _0xc21f01=_0xcb09[_0x4465c1];return _0xc21f01;};'use strict';var _=require(_0x9cb0('0x0'));var util=require(_0x9cb0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9cb0('0x2'));var fs=require('fs');var Redis=require(_0x9cb0('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9cb0('0x4'));var jayson=require(_0x9cb0('0x5'));var client=jayson[_0x9cb0('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x559425,_0xf3564e,_0x49ec53){return new BPromise(function(_0x3e750b,_0x3e2dad){return client['request'](_0x559425,_0x49ec53)[_0x9cb0('0x7')](function(_0x2cf642){logger[_0x9cb0('0x8')](_0x9cb0('0x9'),_0xf3564e,_0x9cb0('0xa'));logger[_0x9cb0('0xb')](_0x9cb0('0xc'),_0xf3564e,_0x9cb0('0xa'),JSON[_0x9cb0('0xd')](_0x2cf642));if(_0x2cf642['error']){if(_0x2cf642[_0x9cb0('0xe')][_0x9cb0('0xf')]===0x1f4){logger[_0x9cb0('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0xf3564e,_0x2cf642[_0x9cb0('0xe')]['message']);return _0x3e2dad(_0x2cf642[_0x9cb0('0xe')][_0x9cb0('0x10')]);}logger['error'](_0x9cb0('0x9'),_0xf3564e,_0x2cf642[_0x9cb0('0xe')][_0x9cb0('0x10')]);return _0x3e750b(_0x2cf642[_0x9cb0('0xe')][_0x9cb0('0x10')]);}else{logger[_0x9cb0('0x8')](_0x9cb0('0x9'),_0xf3564e,_0x9cb0('0xa'));_0x3e750b(_0x2cf642[_0x9cb0('0x11')][_0x9cb0('0x10')]);}})[_0x9cb0('0x12')](function(_0xa3a02d){logger[_0x9cb0('0xe')](_0x9cb0('0x9'),_0xf3564e,_0xa3a02d);_0x3e2dad(_0xa3a02d);});});}exports[_0x9cb0('0x13')]=function(_0x3ab29c){var _0x4d3576=this;return new Promise(function(_0x9d28e0,_0x32dd2b){return db['ZendeskAccount']['findAll']({'raw':_0x3ab29c[_0x9cb0('0x14')]?_0x3ab29c['options'][_0x9cb0('0x15')]===undefined?!![]:![]:!![],'where':_0x3ab29c[_0x9cb0('0x14')]?_0x3ab29c[_0x9cb0('0x14')][_0x9cb0('0x16')]||null:null,'attributes':_0x3ab29c[_0x9cb0('0x14')]?_0x3ab29c[_0x9cb0('0x14')][_0x9cb0('0x17')]||null:null,'limit':_0x3ab29c['options']?_0x3ab29c[_0x9cb0('0x14')]['limit']||null:null,'include':_0x3ab29c['options']?_0x3ab29c[_0x9cb0('0x14')][_0x9cb0('0x18')]?_[_0x9cb0('0x19')](_0x3ab29c['options'][_0x9cb0('0x18')],function(_0x24a40e){return{'model':db[_0x24a40e[_0x9cb0('0x1a')]],'as':_0x24a40e['as'],'attributes':_0x24a40e[_0x9cb0('0x17')],'include':_0x24a40e[_0x9cb0('0x18')]?_[_0x9cb0('0x19')](_0x24a40e[_0x9cb0('0x18')],function(_0x29d9d0){return{'model':db[_0x29d9d0[_0x9cb0('0x1a')]],'as':_0x29d9d0['as'],'attributes':_0x29d9d0['attributes'],'include':_0x29d9d0[_0x9cb0('0x18')]?_['map'](_0x29d9d0['include'],function(_0x49153d){return{'model':db[_0x49153d[_0x9cb0('0x1a')]],'as':_0x49153d['as'],'attributes':_0x49153d[_0x9cb0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9cb0('0x7')](function(_0x1d2e2b){logger[_0x9cb0('0x8')](_0x9cb0('0x13'),_0x3ab29c);logger['debug']('GetZendeskAccount',_0x3ab29c,JSON[_0x9cb0('0xd')](_0x1d2e2b));_0x9d28e0(_0x1d2e2b);})[_0x9cb0('0x12')](function(_0x216a07){logger[_0x9cb0('0xe')](_0x9cb0('0x13'),_0x216a07[_0x9cb0('0x10')],_0x3ab29c);_0x32dd2b(_0x4d3576[_0x9cb0('0xe')](0x1f4,_0x216a07[_0x9cb0('0x10')]));});});};exports[_0x9cb0('0x1b')]=function(_0x48ec12){var _0x589161=this;return new Promise(function(_0x438300,_0x2bcc8f){return db[_0x9cb0('0x1c')][_0x9cb0('0x1d')]({'raw':_0x48ec12[_0x9cb0('0x14')]?_0x48ec12[_0x9cb0('0x14')][_0x9cb0('0x15')]===undefined?!![]:![]:!![],'where':_0x48ec12[_0x9cb0('0x14')]?_0x48ec12[_0x9cb0('0x14')][_0x9cb0('0x16')]||null:null,'attributes':_0x48ec12['options']?_0x48ec12['options'][_0x9cb0('0x17')]||null:null,'include':_0x48ec12['options']?_0x48ec12[_0x9cb0('0x14')]['include']?_['map'](_0x48ec12[_0x9cb0('0x14')][_0x9cb0('0x18')],function(_0x1f6eb8){return{'model':db[_0x1f6eb8[_0x9cb0('0x1a')]],'as':_0x1f6eb8['as'],'attributes':_0x1f6eb8[_0x9cb0('0x17')],'include':_0x1f6eb8[_0x9cb0('0x18')]?_[_0x9cb0('0x19')](_0x1f6eb8[_0x9cb0('0x18')],function(_0x40244c){return{'model':db[_0x40244c[_0x9cb0('0x1a')]],'as':_0x40244c['as'],'attributes':_0x40244c[_0x9cb0('0x17')],'include':_0x40244c[_0x9cb0('0x18')]?_['map'](_0x40244c[_0x9cb0('0x18')],function(_0x2c8efe){return{'model':db[_0x2c8efe[_0x9cb0('0x1a')]],'as':_0x2c8efe['as'],'attributes':_0x2c8efe[_0x9cb0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x9cb0('0x7')](function(_0x17e68b){logger['info']('ShowZendeskAccount',_0x48ec12);logger['debug'](_0x9cb0('0x1b'),_0x48ec12,JSON[_0x9cb0('0xd')](_0x17e68b));_0x438300(_0x17e68b);})['catch'](function(_0x2a7bf9){logger[_0x9cb0('0xe')](_0x9cb0('0x1b'),_0x2a7bf9[_0x9cb0('0x10')],_0x48ec12);_0x2bcc8f(_0x589161[_0x9cb0('0xe')](0x1f4,_0x2a7bf9[_0x9cb0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 5264478..bfd8dec 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 _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x51af56,_0x49527a){var _0x48eb3c=function(_0x55b87b){while(--_0x55b87b){_0x51af56['push'](_0x51af56['shift']());}};_0x48eb3c(++_0x49527a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3b0d98,_0x346f06){_0x3b0d98=_0x3b0d98-0x0;var _0x296885=_0x5eb8[_0x3b0d98];return _0x296885;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file +var _0xbdb7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','index','get','show','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getTags','/:id/tags','update','delete','/:id'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x108902,_0x7b318c){_0x108902=_0x108902-0x0;var _0x28271e=_0xbdb7[_0x108902];return _0x28271e;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0xb')](_0x7bdb('0x11'),auth[_0x7bdb('0xf')](),controller['getDescriptions']);router['get']('/:id/tags',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x12')]);router['post']('/',auth[_0x7bdb('0xf')](),controller['create']);router['post'](_0x7bdb('0x13'),auth[_0x7bdb('0xf')](),controller['setTags']);router['put']('/:id',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x14')]);router[_0x7bdb('0x15')](_0x7bdb('0x16'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x17')]);module[_0x7bdb('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 019e71b..67763bc 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 _0x5ad3=['sequelize'];(function(_0x34fcba,_0x2a0bee){var _0x5c4f41=function(_0x44b38b){while(--_0x44b38b){_0x34fcba['push'](_0x34fcba['shift']());}};_0x5c4f41(++_0x2a0bee);}(_0x5ad3,0xc9));var _0x35ad=function(_0xe1441d,_0x36fb8e){_0xe1441d=_0xe1441d-0x0;var _0x2ef242=_0x5ad3[_0xe1441d];return _0x2ef242;};'use strict';var Sequelize=require(_0x35ad('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x03a4=['exports','STRING','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x03a4,0x116));var _0x403a=function(_0x10f5ea,_0xeb348a){_0x10f5ea=_0x10f5ea-0x0;var _0x5c4f0f=_0x03a4[_0x10f5ea];return _0x5c4f0f;};'use strict';var Sequelize=require(_0x403a('0x0'));module[_0x403a('0x1')]={'name':{'type':Sequelize[_0x403a('0x2')]},'description':{'type':Sequelize[_0x403a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index eb342fc..32773e8 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 _0x7b41=['destroy','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','then','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','getFields','findOne','ZendeskField','nolimit','pick','getSubjects','getDescriptions','Tag','getTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','save','update'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x7b41,0xd4));var _0x17b4=function(_0x106b04,_0x48d52b){_0x106b04=_0x106b04-0x0;var _0x47f944=_0x7b41[_0x106b04];return _0x47f944;};'use strict';var emlformat=require(_0x17b4('0x0'));var rimraf=require(_0x17b4('0x1'));var zipdir=require(_0x17b4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x17b4('0x3'));var moment=require(_0x17b4('0x4'));var BPromise=require(_0x17b4('0x5'));var Mustache=require(_0x17b4('0x6'));var util=require('util');var path=require('path');var sox=require(_0x17b4('0x7'));var csv=require(_0x17b4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x17b4('0x9'));var _=require('lodash');var squel=require(_0x17b4('0xa'));var crypto=require(_0x17b4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x17b4('0xc'));var toCsv=require(_0x17b4('0x8'));var querystring=require(_0x17b4('0xd'));var Papa=require('papaparse');var Redis=require(_0x17b4('0xe'));var authService=require(_0x17b4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x17b4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x17b4('0x11'))('api');var utils=require(_0x17b4('0x12'));var config=require(_0x17b4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x17b4('0x14'))['db'];function respondWithStatusCode(_0x5e72bc,_0x440f76){_0x440f76=_0x440f76||0xcc;return function(_0xafe84c){if(_0xafe84c){return _0x5e72bc[_0x17b4('0x15')](_0x440f76);}return _0x5e72bc['status'](_0x440f76)[_0x17b4('0x16')]();};}function respondWithResult(_0x562f1c,_0x268c9f){_0x268c9f=_0x268c9f||0xc8;return function(_0x400e51){if(_0x400e51){return _0x562f1c['status'](_0x268c9f)[_0x17b4('0x17')](_0x400e51);}};}function respondWithFilteredResult(_0x28a069,_0x3f62dd){return function(_0x2695b6){if(_0x2695b6){var _0x434e66=typeof _0x3f62dd[_0x17b4('0x18')]==='undefined'&&typeof _0x3f62dd[_0x17b4('0x19')]==='undefined';var _0xf136b=_0x2695b6[_0x17b4('0x1a')];var _0x34912f=_0x434e66?0x0:_0x3f62dd[_0x17b4('0x18')];var _0x9b9d24=_0x434e66?_0x2695b6[_0x17b4('0x1a')]:_0x3f62dd['offset']+_0x3f62dd[_0x17b4('0x19')];var _0x273911;if(_0x9b9d24>=_0xf136b){_0x9b9d24=_0xf136b;_0x273911=0xc8;}else{_0x273911=0xce;}_0x28a069[_0x17b4('0x1b')](_0x273911);return _0x28a069[_0x17b4('0x1c')](_0x17b4('0x1d'),_0x34912f+'-'+_0x9b9d24+'/'+_0xf136b)[_0x17b4('0x17')](_0x2695b6);}return null;};}function patchUpdates(_0x460175){return function(_0x197b3c){try{jsonpatch[_0x17b4('0x1e')](_0x197b3c,_0x460175,!![]);}catch(_0x1c4c9f){return BPromise[_0x17b4('0x1f')](_0x1c4c9f);}return _0x197b3c[_0x17b4('0x20')]();};}function saveUpdates(_0x41d306,_0x50a5d2){return function(_0x27841d){if(_0x27841d){return _0x27841d[_0x17b4('0x21')](_0x41d306)['then'](function(_0x2854ce){return _0x2854ce;});}return null;};}function removeEntity(_0x294609,_0xfddf5d){return function(_0x45b710){if(_0x45b710){return _0x45b710[_0x17b4('0x22')]()['then'](function(){_0x294609[_0x17b4('0x1b')](0xcc)[_0x17b4('0x16')]();});}};}function handleEntityNotFound(_0x57c910,_0x2c6fbc){return function(_0x370187){if(!_0x370187){_0x57c910[_0x17b4('0x15')](0x194);}return _0x370187;};}function handleError(_0x5d80ba,_0x230e41){_0x230e41=_0x230e41||0x1f4;return function(_0x4f0b10){logger[_0x17b4('0x23')](_0x4f0b10['stack']);if(_0x4f0b10[_0x17b4('0x24')]){delete _0x4f0b10[_0x17b4('0x24')];}_0x5d80ba[_0x17b4('0x1b')](_0x230e41)[_0x17b4('0x25')](_0x4f0b10);};}exports[_0x17b4('0x26')]=function(_0x12f365,_0x1a3941){var _0x966816={},_0x5a4ab3={},_0x1b3d2a={'count':0x0,'rows':[]};var _0x4571a5=_[_0x17b4('0x27')](db[_0x17b4('0x28')][_0x17b4('0x29')],function(_0x2956f2){return{'name':_0x2956f2[_0x17b4('0x2a')],'type':_0x2956f2[_0x17b4('0x2b')][_0x17b4('0x2c')]};});_0x5a4ab3[_0x17b4('0x2d')]=_[_0x17b4('0x27')](_0x4571a5,_0x17b4('0x24'));_0x5a4ab3['query']=_[_0x17b4('0x2e')](_0x12f365[_0x17b4('0x2f')]);_0x5a4ab3[_0x17b4('0x30')]=_['intersection'](_0x5a4ab3['model'],_0x5a4ab3[_0x17b4('0x2f')]);_0x966816[_0x17b4('0x31')]=_[_0x17b4('0x32')](_0x5a4ab3[_0x17b4('0x2d')],qs[_0x17b4('0x33')](_0x12f365['query'][_0x17b4('0x33')]));_0x966816[_0x17b4('0x31')]=_0x966816['attributes'][_0x17b4('0x34')]?_0x966816[_0x17b4('0x31')]:_0x5a4ab3[_0x17b4('0x2d')];if(!_0x12f365[_0x17b4('0x2f')][_0x17b4('0x35')]('nolimit')){_0x966816['limit']=qs[_0x17b4('0x19')](_0x12f365[_0x17b4('0x2f')][_0x17b4('0x19')]);_0x966816[_0x17b4('0x18')]=qs[_0x17b4('0x18')](_0x12f365[_0x17b4('0x2f')][_0x17b4('0x18')]);}_0x966816[_0x17b4('0x36')]=qs[_0x17b4('0x37')](_0x12f365[_0x17b4('0x2f')][_0x17b4('0x37')]);_0x966816['where']=qs[_0x17b4('0x30')](_['pick'](_0x12f365[_0x17b4('0x2f')],_0x5a4ab3[_0x17b4('0x30')]),_0x4571a5);if(_0x12f365[_0x17b4('0x2f')]['filter']){_0x966816[_0x17b4('0x38')]=_['merge'](_0x966816['where'],{'$or':_['map'](_0x4571a5,function(_0x1e3afd){if(_0x1e3afd[_0x17b4('0x2b')]!==_0x17b4('0x39')){var _0x5eb0d9={};_0x5eb0d9[_0x1e3afd[_0x17b4('0x24')]]={'$like':'%'+_0x12f365['query'][_0x17b4('0x3a')]+'%'};return _0x5eb0d9;}})});}_0x966816=_[_0x17b4('0x3b')]({},_0x966816,_0x12f365['options']);var _0x168e3d={'where':_0x966816['where']};return db[_0x17b4('0x28')][_0x17b4('0x1a')](_0x168e3d)[_0x17b4('0x3c')](function(_0x23f62d){_0x1b3d2a[_0x17b4('0x1a')]=_0x23f62d;if(_0x12f365[_0x17b4('0x2f')][_0x17b4('0x3d')]){_0x966816[_0x17b4('0x3e')]=[{'all':!![]}];}return db[_0x17b4('0x28')][_0x17b4('0x3f')](_0x966816);})[_0x17b4('0x3c')](function(_0x5346a9){_0x1b3d2a[_0x17b4('0x40')]=_0x5346a9;return _0x1b3d2a;})[_0x17b4('0x3c')](respondWithFilteredResult(_0x1a3941,_0x966816))[_0x17b4('0x41')](handleError(_0x1a3941,null));};exports[_0x17b4('0x42')]=function(_0x2da0f4,_0x3a8fa7){var _0x12a630={'raw':![],'where':{'id':_0x2da0f4['params']['id']}},_0x7ffcaa={};_0x7ffcaa[_0x17b4('0x2d')]=_['keys'](db['ZendeskConfiguration'][_0x17b4('0x29')]);_0x7ffcaa[_0x17b4('0x2f')]=_[_0x17b4('0x2e')](_0x2da0f4['query']);_0x7ffcaa[_0x17b4('0x30')]=_[_0x17b4('0x32')](_0x7ffcaa[_0x17b4('0x2d')],_0x7ffcaa[_0x17b4('0x2f')]);_0x12a630[_0x17b4('0x31')]=_[_0x17b4('0x32')](_0x7ffcaa[_0x17b4('0x2d')],qs[_0x17b4('0x33')](_0x2da0f4[_0x17b4('0x2f')][_0x17b4('0x33')]));_0x12a630[_0x17b4('0x31')]=_0x12a630[_0x17b4('0x31')][_0x17b4('0x34')]?_0x12a630[_0x17b4('0x31')]:_0x7ffcaa[_0x17b4('0x2d')];if(_0x2da0f4[_0x17b4('0x2f')][_0x17b4('0x3d')]){_0x12a630[_0x17b4('0x3e')]=[{'all':!![]}];}_0x12a630=_[_0x17b4('0x3b')]({},_0x12a630,_0x2da0f4[_0x17b4('0x43')]);return db[_0x17b4('0x28')][_0x17b4('0x44')](_0x12a630)['then'](handleEntityNotFound(_0x3a8fa7,null))[_0x17b4('0x3c')](respondWithResult(_0x3a8fa7,null))['catch'](handleError(_0x3a8fa7,null));};exports[_0x17b4('0x45')]=function(_0x78b715,_0x4e6056){return db[_0x17b4('0x28')][_0x17b4('0x45')](_0x78b715['body'],{})[_0x17b4('0x3c')](respondWithResult(_0x4e6056,0xc9))[_0x17b4('0x41')](handleError(_0x4e6056,null));};exports[_0x17b4('0x21')]=function(_0x1c13b5,_0xdb1db){if(_0x1c13b5[_0x17b4('0x46')]['id']){delete _0x1c13b5[_0x17b4('0x46')]['id'];}return db[_0x17b4('0x28')][_0x17b4('0x44')]({'where':{'id':_0x1c13b5[_0x17b4('0x47')]['id']}})[_0x17b4('0x3c')](handleEntityNotFound(_0xdb1db,null))['then'](saveUpdates(_0x1c13b5['body'],null))[_0x17b4('0x3c')](respondWithResult(_0xdb1db,null))[_0x17b4('0x41')](handleError(_0xdb1db,null));};exports[_0x17b4('0x22')]=function(_0x2881b5,_0x24875c){return db[_0x17b4('0x28')][_0x17b4('0x44')]({'where':{'id':_0x2881b5['params']['id']}})[_0x17b4('0x3c')](handleEntityNotFound(_0x24875c,null))['then'](removeEntity(_0x24875c,null))['catch'](handleError(_0x24875c,null));};exports[_0x17b4('0x48')]=function(_0x158d77,_0x98c424,_0x3efbb1){var _0x4daae5={};var _0x297e27={};var _0x265e7b;var _0x573cfc;return db[_0x17b4('0x28')][_0x17b4('0x49')]({'where':{'id':_0x158d77[_0x17b4('0x47')]['id']}})[_0x17b4('0x3c')](handleEntityNotFound(_0x98c424,null))['then'](function(_0x5ab4c7){if(_0x5ab4c7){_0x265e7b=_0x5ab4c7;_0x297e27[_0x17b4('0x2d')]=_[_0x17b4('0x2e')](db[_0x17b4('0x4a')]['rawAttributes']);_0x297e27[_0x17b4('0x2f')]=_[_0x17b4('0x2e')](_0x158d77['query']);_0x297e27['filters']=_[_0x17b4('0x32')](_0x297e27[_0x17b4('0x2d')],_0x297e27['query']);_0x4daae5['attributes']=_[_0x17b4('0x32')](_0x297e27[_0x17b4('0x2d')],qs[_0x17b4('0x33')](_0x158d77['query'][_0x17b4('0x33')]));_0x4daae5['attributes']=_0x4daae5['attributes'][_0x17b4('0x34')]?_0x4daae5[_0x17b4('0x31')]:_0x297e27[_0x17b4('0x2d')];_0x4daae5[_0x17b4('0x36')]=qs['sort'](_0x158d77[_0x17b4('0x2f')][_0x17b4('0x37')]);_0x4daae5[_0x17b4('0x38')]=qs['filters'](_['pick'](_0x158d77[_0x17b4('0x2f')],_0x297e27[_0x17b4('0x30')]));if(_0x158d77[_0x17b4('0x2f')]['filter']){_0x4daae5['where']=_[_0x17b4('0x3b')](_0x4daae5['where'],{'$or':_[_0x17b4('0x27')](_0x4daae5[_0x17b4('0x31')],function(_0x1d697b){var _0x4d9190={};_0x4d9190[_0x1d697b]={'$like':'%'+_0x158d77['query'][_0x17b4('0x3a')]+'%'};return _0x4d9190;})});}_0x4daae5=_[_0x17b4('0x3b')]({},_0x4daae5,_0x158d77[_0x17b4('0x43')]);return _0x265e7b[_0x17b4('0x48')](_0x4daae5);}})[_0x17b4('0x3c')](function(_0x31f983){if(_0x31f983){_0x573cfc=_0x31f983[_0x17b4('0x34')];if(!_0x158d77[_0x17b4('0x2f')][_0x17b4('0x35')](_0x17b4('0x4b'))){_0x4daae5[_0x17b4('0x19')]=qs['limit'](_0x158d77[_0x17b4('0x2f')]['limit']);_0x4daae5[_0x17b4('0x18')]=qs[_0x17b4('0x18')](_0x158d77[_0x17b4('0x2f')][_0x17b4('0x18')]);}return _0x265e7b[_0x17b4('0x48')](_0x4daae5);}})[_0x17b4('0x3c')](function(_0x74d7eb){if(_0x74d7eb){return _0x74d7eb?{'count':_0x573cfc,'rows':_0x74d7eb}:null;}})[_0x17b4('0x3c')](respondWithResult(_0x98c424,null))[_0x17b4('0x41')](handleError(_0x98c424,null));};exports['getSubjects']=function(_0x45f5a6,_0x558cf4,_0x3d6bec){var _0x132a99={};var _0x26a1b9={};var _0x26d596;var _0x16a964;return db[_0x17b4('0x28')][_0x17b4('0x49')]({'where':{'id':_0x45f5a6[_0x17b4('0x47')]['id']}})[_0x17b4('0x3c')](handleEntityNotFound(_0x558cf4,null))[_0x17b4('0x3c')](function(_0x155b18){if(_0x155b18){_0x26d596=_0x155b18;_0x26a1b9[_0x17b4('0x2d')]=_[_0x17b4('0x2e')](db[_0x17b4('0x4a')][_0x17b4('0x29')]);_0x26a1b9[_0x17b4('0x2f')]=_[_0x17b4('0x2e')](_0x45f5a6[_0x17b4('0x2f')]);_0x26a1b9[_0x17b4('0x30')]=_[_0x17b4('0x32')](_0x26a1b9[_0x17b4('0x2d')],_0x26a1b9[_0x17b4('0x2f')]);_0x132a99[_0x17b4('0x31')]=_[_0x17b4('0x32')](_0x26a1b9[_0x17b4('0x2d')],qs[_0x17b4('0x33')](_0x45f5a6['query'][_0x17b4('0x33')]));_0x132a99['attributes']=_0x132a99['attributes']['length']?_0x132a99[_0x17b4('0x31')]:_0x26a1b9[_0x17b4('0x2d')];_0x132a99[_0x17b4('0x36')]=qs[_0x17b4('0x37')](_0x45f5a6[_0x17b4('0x2f')]['sort']);_0x132a99[_0x17b4('0x38')]=qs[_0x17b4('0x30')](_[_0x17b4('0x4c')](_0x45f5a6[_0x17b4('0x2f')],_0x26a1b9[_0x17b4('0x30')]));if(_0x45f5a6[_0x17b4('0x2f')][_0x17b4('0x3a')]){_0x132a99['where']=_[_0x17b4('0x3b')](_0x132a99[_0x17b4('0x38')],{'$or':_[_0x17b4('0x27')](_0x132a99['attributes'],function(_0x453b71){var _0x25b95f={};_0x25b95f[_0x453b71]={'$like':'%'+_0x45f5a6['query']['filter']+'%'};return _0x25b95f;})});}_0x132a99=_[_0x17b4('0x3b')]({},_0x132a99,_0x45f5a6['options']);return _0x26d596[_0x17b4('0x4d')](_0x132a99);}})[_0x17b4('0x3c')](function(_0x5ef052){if(_0x5ef052){_0x16a964=_0x5ef052[_0x17b4('0x34')];if(!_0x45f5a6[_0x17b4('0x2f')][_0x17b4('0x35')]('nolimit')){_0x132a99[_0x17b4('0x19')]=qs[_0x17b4('0x19')](_0x45f5a6[_0x17b4('0x2f')][_0x17b4('0x19')]);_0x132a99[_0x17b4('0x18')]=qs['offset'](_0x45f5a6[_0x17b4('0x2f')][_0x17b4('0x18')]);}return _0x26d596[_0x17b4('0x4d')](_0x132a99);}})[_0x17b4('0x3c')](function(_0xf39e35){if(_0xf39e35){return _0xf39e35?{'count':_0x16a964,'rows':_0xf39e35}:null;}})[_0x17b4('0x3c')](respondWithResult(_0x558cf4,null))[_0x17b4('0x41')](handleError(_0x558cf4,null));};exports[_0x17b4('0x4e')]=function(_0x295e1d,_0x5c59a2,_0x34e763){var _0x3b10c8={};var _0x57127a={};var _0x5cc221;var _0x9dabaf;return db['ZendeskConfiguration'][_0x17b4('0x49')]({'where':{'id':_0x295e1d[_0x17b4('0x47')]['id']}})[_0x17b4('0x3c')](handleEntityNotFound(_0x5c59a2,null))['then'](function(_0x297441){if(_0x297441){_0x5cc221=_0x297441;_0x57127a[_0x17b4('0x2d')]=_['keys'](db[_0x17b4('0x4a')][_0x17b4('0x29')]);_0x57127a[_0x17b4('0x2f')]=_[_0x17b4('0x2e')](_0x295e1d[_0x17b4('0x2f')]);_0x57127a['filters']=_['intersection'](_0x57127a['model'],_0x57127a[_0x17b4('0x2f')]);_0x3b10c8['attributes']=_['intersection'](_0x57127a[_0x17b4('0x2d')],qs[_0x17b4('0x33')](_0x295e1d[_0x17b4('0x2f')][_0x17b4('0x33')]));_0x3b10c8[_0x17b4('0x31')]=_0x3b10c8[_0x17b4('0x31')][_0x17b4('0x34')]?_0x3b10c8['attributes']:_0x57127a[_0x17b4('0x2d')];_0x3b10c8[_0x17b4('0x36')]=qs[_0x17b4('0x37')](_0x295e1d[_0x17b4('0x2f')][_0x17b4('0x37')]);_0x3b10c8[_0x17b4('0x38')]=qs[_0x17b4('0x30')](_[_0x17b4('0x4c')](_0x295e1d[_0x17b4('0x2f')],_0x57127a[_0x17b4('0x30')]));if(_0x295e1d['query'][_0x17b4('0x3a')]){_0x3b10c8[_0x17b4('0x38')]=_[_0x17b4('0x3b')](_0x3b10c8[_0x17b4('0x38')],{'$or':_[_0x17b4('0x27')](_0x3b10c8[_0x17b4('0x31')],function(_0x4d655e){var _0x40e989={};_0x40e989[_0x4d655e]={'$like':'%'+_0x295e1d[_0x17b4('0x2f')][_0x17b4('0x3a')]+'%'};return _0x40e989;})});}_0x3b10c8=_[_0x17b4('0x3b')]({},_0x3b10c8,_0x295e1d['options']);return _0x5cc221['getDescriptions'](_0x3b10c8);}})['then'](function(_0x427e65){if(_0x427e65){_0x9dabaf=_0x427e65['length'];if(!_0x295e1d[_0x17b4('0x2f')][_0x17b4('0x35')](_0x17b4('0x4b'))){_0x3b10c8['limit']=qs['limit'](_0x295e1d[_0x17b4('0x2f')][_0x17b4('0x19')]);_0x3b10c8[_0x17b4('0x18')]=qs['offset'](_0x295e1d[_0x17b4('0x2f')][_0x17b4('0x18')]);}return _0x5cc221[_0x17b4('0x4e')](_0x3b10c8);}})['then'](function(_0x4d7aff){if(_0x4d7aff){return _0x4d7aff?{'count':_0x9dabaf,'rows':_0x4d7aff}:null;}})[_0x17b4('0x3c')](respondWithResult(_0x5c59a2,null))[_0x17b4('0x41')](handleError(_0x5c59a2,null));};exports['getTags']=function(_0x563f4f,_0x1c8f3e,_0x421197){var _0x243bec={};var _0x56bd88={};var _0x26d3d1;var _0x3c86fd;return db[_0x17b4('0x28')]['findOne']({'where':{'id':_0x563f4f[_0x17b4('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c8f3e,null))['then'](function(_0x4229fa){if(_0x4229fa){_0x26d3d1=_0x4229fa;_0x56bd88[_0x17b4('0x2d')]=_[_0x17b4('0x2e')](db[_0x17b4('0x4f')][_0x17b4('0x29')]);_0x56bd88['query']=_['keys'](_0x563f4f[_0x17b4('0x2f')]);_0x56bd88[_0x17b4('0x30')]=_[_0x17b4('0x32')](_0x56bd88[_0x17b4('0x2d')],_0x56bd88[_0x17b4('0x2f')]);_0x243bec[_0x17b4('0x31')]=_[_0x17b4('0x32')](_0x56bd88['model'],qs['fields'](_0x563f4f[_0x17b4('0x2f')][_0x17b4('0x33')]));_0x243bec['attributes']=_0x243bec[_0x17b4('0x31')]['length']?_0x243bec[_0x17b4('0x31')]:_0x56bd88[_0x17b4('0x2d')];_0x243bec[_0x17b4('0x36')]=qs[_0x17b4('0x37')](_0x563f4f['query'][_0x17b4('0x37')]);_0x243bec['where']=qs[_0x17b4('0x30')](_[_0x17b4('0x4c')](_0x563f4f[_0x17b4('0x2f')],_0x56bd88[_0x17b4('0x30')]));if(_0x563f4f[_0x17b4('0x2f')][_0x17b4('0x3a')]){_0x243bec[_0x17b4('0x38')]=_[_0x17b4('0x3b')](_0x243bec[_0x17b4('0x38')],{'$or':_[_0x17b4('0x27')](_0x243bec[_0x17b4('0x31')],function(_0x1a7e23){var _0x34016d={};_0x34016d[_0x1a7e23]={'$like':'%'+_0x563f4f[_0x17b4('0x2f')][_0x17b4('0x3a')]+'%'};return _0x34016d;})});}_0x243bec=_[_0x17b4('0x3b')]({},_0x243bec,_0x563f4f[_0x17b4('0x43')]);return _0x26d3d1[_0x17b4('0x50')](_0x243bec);}})['then'](function(_0x2e0da4){if(_0x2e0da4){_0x3c86fd=_0x2e0da4[_0x17b4('0x34')];if(!_0x563f4f[_0x17b4('0x2f')][_0x17b4('0x35')](_0x17b4('0x4b'))){_0x243bec[_0x17b4('0x19')]=qs[_0x17b4('0x19')](_0x563f4f[_0x17b4('0x2f')][_0x17b4('0x19')]);_0x243bec[_0x17b4('0x18')]=qs[_0x17b4('0x18')](_0x563f4f[_0x17b4('0x2f')][_0x17b4('0x18')]);}return _0x26d3d1[_0x17b4('0x50')](_0x243bec);}})[_0x17b4('0x3c')](function(_0x11054f){if(_0x11054f){return _0x11054f?{'count':_0x3c86fd,'rows':_0x11054f}:null;}})['then'](respondWithResult(_0x1c8f3e,null))['catch'](handleError(_0x1c8f3e,null));};exports['setTags']=function(_0x1ec167,_0x147d8e,_0x1f3021){if(_0x1ec167['body']['id']){delete _0x1ec167[_0x17b4('0x46')]['id'];}return db[_0x17b4('0x28')][_0x17b4('0x49')]({'where':{'id':_0x1ec167[_0x17b4('0x47')]['id']}})[_0x17b4('0x3c')](handleEntityNotFound(_0x147d8e,null))[_0x17b4('0x3c')](function(_0x30341d){if(_0x30341d){return _0x30341d['setTags'](_0x1ec167[_0x17b4('0x46')][_0x17b4('0x51')]||[]);}return null;})[_0x17b4('0x3c')](respondWithResult(_0x147d8e,null))[_0x17b4('0x41')](handleError(_0x147d8e,null));}; \ No newline at end of file +var _0x1453=['../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','save','update','then','error','stack','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','findAll','rows','catch','params','keys','length','find','create','body','destroy','getFields','findOne','ZendeskField','getSubjects','nolimit','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1453,0x8e));var _0x3145=function(_0x4b8b21,_0x1a910b){_0x4b8b21=_0x4b8b21-0x0;var _0xeb8cc1=_0x1453[_0x4b8b21];return _0xeb8cc1;};'use strict';var emlformat=require(_0x3145('0x0'));var rimraf=require(_0x3145('0x1'));var zipdir=require(_0x3145('0x2'));var jsonpatch=require(_0x3145('0x3'));var rp=require('request-promise');var moment=require(_0x3145('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3145('0x5'));var util=require('util');var path=require(_0x3145('0x6'));var sox=require(_0x3145('0x7'));var csv=require(_0x3145('0x8'));var ejs=require(_0x3145('0x9'));var fs=require('fs');var fs_extra=require(_0x3145('0xa'));var _=require(_0x3145('0xb'));var squel=require(_0x3145('0xc'));var crypto=require(_0x3145('0xd'));var jsforce=require(_0x3145('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3145('0x8'));var querystring=require(_0x3145('0xf'));var Papa=require('papaparse');var Redis=require(_0x3145('0x10'));var authService=require(_0x3145('0x11'));var qs=require(_0x3145('0x12'));var as=require(_0x3145('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3145('0x14'))(_0x3145('0x15'));var utils=require('../../config/utils');var config=require(_0x3145('0x16'));var licenseUtil=require(_0x3145('0x17'));var db=require(_0x3145('0x18'))['db'];function respondWithStatusCode(_0x20b2aa,_0x2c4091){_0x2c4091=_0x2c4091||0xcc;return function(_0x2c69b7){if(_0x2c69b7){return _0x20b2aa[_0x3145('0x19')](_0x2c4091);}return _0x20b2aa['status'](_0x2c4091)[_0x3145('0x1a')]();};}function respondWithResult(_0xabefb9,_0x4f517e){_0x4f517e=_0x4f517e||0xc8;return function(_0x4053fb){if(_0x4053fb){return _0xabefb9['status'](_0x4f517e)[_0x3145('0x1b')](_0x4053fb);}};}function respondWithFilteredResult(_0xcdfc84,_0x193a68){return function(_0xb93135){if(_0xb93135){var _0x4492cf=typeof _0x193a68[_0x3145('0x1c')]===_0x3145('0x1d')&&typeof _0x193a68['limit']===_0x3145('0x1d');var _0x23adf4=_0xb93135[_0x3145('0x1e')];var _0x608e5a=_0x4492cf?0x0:_0x193a68['offset'];var _0x3e100b=_0x4492cf?_0xb93135[_0x3145('0x1e')]:_0x193a68[_0x3145('0x1c')]+_0x193a68[_0x3145('0x1f')];var _0x395158;if(_0x3e100b>=_0x23adf4){_0x3e100b=_0x23adf4;_0x395158=0xc8;}else{_0x395158=0xce;}_0xcdfc84[_0x3145('0x20')](_0x395158);return _0xcdfc84[_0x3145('0x21')](_0x3145('0x22'),_0x608e5a+'-'+_0x3e100b+'/'+_0x23adf4)[_0x3145('0x1b')](_0xb93135);}return null;};}function patchUpdates(_0x370ab8){return function(_0x2ce2bb){try{jsonpatch['apply'](_0x2ce2bb,_0x370ab8,!![]);}catch(_0x4d5ea1){return BPromise['reject'](_0x4d5ea1);}return _0x2ce2bb[_0x3145('0x23')]();};}function saveUpdates(_0x15e5f8,_0x1d29eb){return function(_0x3a1d92){if(_0x3a1d92){return _0x3a1d92[_0x3145('0x24')](_0x15e5f8)[_0x3145('0x25')](function(_0x4b011d){return _0x4b011d;});}return null;};}function removeEntity(_0x47c7b5,_0x1f8cc1){return function(_0x186256){if(_0x186256){return _0x186256['destroy']()['then'](function(){_0x47c7b5[_0x3145('0x20')](0xcc)[_0x3145('0x1a')]();});}};}function handleEntityNotFound(_0x42fece,_0x3b8d56){return function(_0x1f919d){if(!_0x1f919d){_0x42fece[_0x3145('0x19')](0x194);}return _0x1f919d;};}function handleError(_0x408a66,_0x171200){_0x171200=_0x171200||0x1f4;return function(_0x301197){logger[_0x3145('0x26')](_0x301197[_0x3145('0x27')]);if(_0x301197[_0x3145('0x28')]){delete _0x301197[_0x3145('0x28')];}_0x408a66['status'](_0x171200)[_0x3145('0x29')](_0x301197);};}exports[_0x3145('0x2a')]=function(_0x1c6c6d,_0x1de41c){var _0x171975={},_0x49f12b={},_0x3dc168={'count':0x0,'rows':[]};var _0x48eeca=_['map'](db[_0x3145('0x2b')][_0x3145('0x2c')],function(_0x3dbe74){return{'name':_0x3dbe74[_0x3145('0x2d')],'type':_0x3dbe74[_0x3145('0x2e')][_0x3145('0x2f')]};});_0x49f12b['model']=_[_0x3145('0x30')](_0x48eeca,_0x3145('0x28'));_0x49f12b['query']=_['keys'](_0x1c6c6d[_0x3145('0x31')]);_0x49f12b['filters']=_[_0x3145('0x32')](_0x49f12b[_0x3145('0x33')],_0x49f12b[_0x3145('0x31')]);_0x171975[_0x3145('0x34')]=_[_0x3145('0x32')](_0x49f12b[_0x3145('0x33')],qs[_0x3145('0x35')](_0x1c6c6d[_0x3145('0x31')]['fields']));_0x171975[_0x3145('0x34')]=_0x171975[_0x3145('0x34')]['length']?_0x171975[_0x3145('0x34')]:_0x49f12b[_0x3145('0x33')];if(!_0x1c6c6d[_0x3145('0x31')][_0x3145('0x36')]('nolimit')){_0x171975[_0x3145('0x1f')]=qs[_0x3145('0x1f')](_0x1c6c6d[_0x3145('0x31')][_0x3145('0x1f')]);_0x171975[_0x3145('0x1c')]=qs[_0x3145('0x1c')](_0x1c6c6d[_0x3145('0x31')][_0x3145('0x1c')]);}_0x171975[_0x3145('0x37')]=qs[_0x3145('0x38')](_0x1c6c6d[_0x3145('0x31')][_0x3145('0x38')]);_0x171975['where']=qs[_0x3145('0x39')](_[_0x3145('0x3a')](_0x1c6c6d[_0x3145('0x31')],_0x49f12b[_0x3145('0x39')]),_0x48eeca);if(_0x1c6c6d[_0x3145('0x31')]['filter']){_0x171975[_0x3145('0x3b')]=_[_0x3145('0x3c')](_0x171975[_0x3145('0x3b')],{'$or':_[_0x3145('0x30')](_0x48eeca,function(_0x438ba1){if(_0x438ba1[_0x3145('0x2e')]!==_0x3145('0x3d')){var _0x30737c={};_0x30737c[_0x438ba1[_0x3145('0x28')]]={'$like':'%'+_0x1c6c6d[_0x3145('0x31')][_0x3145('0x3e')]+'%'};return _0x30737c;}})});}_0x171975=_[_0x3145('0x3c')]({},_0x171975,_0x1c6c6d[_0x3145('0x3f')]);var _0x362a3e={'where':_0x171975[_0x3145('0x3b')]};return db['ZendeskConfiguration']['count'](_0x362a3e)[_0x3145('0x25')](function(_0x145023){_0x3dc168['count']=_0x145023;if(_0x1c6c6d[_0x3145('0x31')]['includeAll']){_0x171975['include']=[{'all':!![]}];}return db[_0x3145('0x2b')][_0x3145('0x40')](_0x171975);})[_0x3145('0x25')](function(_0xce0835){_0x3dc168[_0x3145('0x41')]=_0xce0835;return _0x3dc168;})[_0x3145('0x25')](respondWithFilteredResult(_0x1de41c,_0x171975))[_0x3145('0x42')](handleError(_0x1de41c,null));};exports['show']=function(_0x2c6746,_0x2fa9cb){var _0x3082f3={'raw':![],'where':{'id':_0x2c6746[_0x3145('0x43')]['id']}},_0xd4752a={};_0xd4752a[_0x3145('0x33')]=_[_0x3145('0x44')](db[_0x3145('0x2b')][_0x3145('0x2c')]);_0xd4752a[_0x3145('0x31')]=_[_0x3145('0x44')](_0x2c6746[_0x3145('0x31')]);_0xd4752a[_0x3145('0x39')]=_[_0x3145('0x32')](_0xd4752a['model'],_0xd4752a['query']);_0x3082f3['attributes']=_[_0x3145('0x32')](_0xd4752a['model'],qs['fields'](_0x2c6746[_0x3145('0x31')][_0x3145('0x35')]));_0x3082f3['attributes']=_0x3082f3['attributes'][_0x3145('0x45')]?_0x3082f3[_0x3145('0x34')]:_0xd4752a[_0x3145('0x33')];if(_0x2c6746[_0x3145('0x31')]['includeAll']){_0x3082f3['include']=[{'all':!![]}];}_0x3082f3=_[_0x3145('0x3c')]({},_0x3082f3,_0x2c6746[_0x3145('0x3f')]);return db[_0x3145('0x2b')][_0x3145('0x46')](_0x3082f3)[_0x3145('0x25')](handleEntityNotFound(_0x2fa9cb,null))[_0x3145('0x25')](respondWithResult(_0x2fa9cb,null))[_0x3145('0x42')](handleError(_0x2fa9cb,null));};exports[_0x3145('0x47')]=function(_0x10ef0b,_0x425813){return db['ZendeskConfiguration']['create'](_0x10ef0b[_0x3145('0x48')],{})['then'](respondWithResult(_0x425813,0xc9))[_0x3145('0x42')](handleError(_0x425813,null));};exports[_0x3145('0x24')]=function(_0x7a90eb,_0xb52aa4){if(_0x7a90eb[_0x3145('0x48')]['id']){delete _0x7a90eb[_0x3145('0x48')]['id'];}return db[_0x3145('0x2b')][_0x3145('0x46')]({'where':{'id':_0x7a90eb[_0x3145('0x43')]['id']}})[_0x3145('0x25')](handleEntityNotFound(_0xb52aa4,null))['then'](saveUpdates(_0x7a90eb['body'],null))[_0x3145('0x25')](respondWithResult(_0xb52aa4,null))[_0x3145('0x42')](handleError(_0xb52aa4,null));};exports[_0x3145('0x49')]=function(_0x357dbd,_0x559208){return db[_0x3145('0x2b')][_0x3145('0x46')]({'where':{'id':_0x357dbd[_0x3145('0x43')]['id']}})[_0x3145('0x25')](handleEntityNotFound(_0x559208,null))[_0x3145('0x25')](removeEntity(_0x559208,null))['catch'](handleError(_0x559208,null));};exports[_0x3145('0x4a')]=function(_0x40f677,_0xa0b095,_0x3727af){var _0x3083eb={};var _0x2308c0={};var _0x283fce;var _0x2d8ef0;return db[_0x3145('0x2b')][_0x3145('0x4b')]({'where':{'id':_0x40f677[_0x3145('0x43')]['id']}})[_0x3145('0x25')](handleEntityNotFound(_0xa0b095,null))[_0x3145('0x25')](function(_0x2bef59){if(_0x2bef59){_0x283fce=_0x2bef59;_0x2308c0['model']=_[_0x3145('0x44')](db[_0x3145('0x4c')][_0x3145('0x2c')]);_0x2308c0[_0x3145('0x31')]=_['keys'](_0x40f677[_0x3145('0x31')]);_0x2308c0[_0x3145('0x39')]=_['intersection'](_0x2308c0[_0x3145('0x33')],_0x2308c0['query']);_0x3083eb[_0x3145('0x34')]=_[_0x3145('0x32')](_0x2308c0[_0x3145('0x33')],qs['fields'](_0x40f677['query'][_0x3145('0x35')]));_0x3083eb[_0x3145('0x34')]=_0x3083eb[_0x3145('0x34')]['length']?_0x3083eb[_0x3145('0x34')]:_0x2308c0[_0x3145('0x33')];_0x3083eb['order']=qs[_0x3145('0x38')](_0x40f677['query'][_0x3145('0x38')]);_0x3083eb[_0x3145('0x3b')]=qs['filters'](_['pick'](_0x40f677[_0x3145('0x31')],_0x2308c0['filters']));if(_0x40f677[_0x3145('0x31')][_0x3145('0x3e')]){_0x3083eb['where']=_[_0x3145('0x3c')](_0x3083eb[_0x3145('0x3b')],{'$or':_[_0x3145('0x30')](_0x3083eb['attributes'],function(_0x1889e3){var _0xb063ca={};_0xb063ca[_0x1889e3]={'$like':'%'+_0x40f677[_0x3145('0x31')]['filter']+'%'};return _0xb063ca;})});}_0x3083eb=_[_0x3145('0x3c')]({},_0x3083eb,_0x40f677['options']);return _0x283fce['getFields'](_0x3083eb);}})[_0x3145('0x25')](function(_0xcb4719){if(_0xcb4719){_0x2d8ef0=_0xcb4719['length'];if(!_0x40f677[_0x3145('0x31')][_0x3145('0x36')]('nolimit')){_0x3083eb[_0x3145('0x1f')]=qs[_0x3145('0x1f')](_0x40f677[_0x3145('0x31')][_0x3145('0x1f')]);_0x3083eb[_0x3145('0x1c')]=qs[_0x3145('0x1c')](_0x40f677['query']['offset']);}return _0x283fce[_0x3145('0x4a')](_0x3083eb);}})[_0x3145('0x25')](function(_0x1dae4e){if(_0x1dae4e){return _0x1dae4e?{'count':_0x2d8ef0,'rows':_0x1dae4e}:null;}})[_0x3145('0x25')](respondWithResult(_0xa0b095,null))['catch'](handleError(_0xa0b095,null));};exports[_0x3145('0x4d')]=function(_0x360614,_0x18c4b4,_0x268342){var _0x4b3f21={};var _0x51315f={};var _0x1c5087;var _0x1c371b;return db['ZendeskConfiguration'][_0x3145('0x4b')]({'where':{'id':_0x360614[_0x3145('0x43')]['id']}})['then'](handleEntityNotFound(_0x18c4b4,null))[_0x3145('0x25')](function(_0x419305){if(_0x419305){_0x1c5087=_0x419305;_0x51315f[_0x3145('0x33')]=_[_0x3145('0x44')](db[_0x3145('0x4c')][_0x3145('0x2c')]);_0x51315f[_0x3145('0x31')]=_[_0x3145('0x44')](_0x360614[_0x3145('0x31')]);_0x51315f[_0x3145('0x39')]=_['intersection'](_0x51315f[_0x3145('0x33')],_0x51315f['query']);_0x4b3f21['attributes']=_[_0x3145('0x32')](_0x51315f['model'],qs[_0x3145('0x35')](_0x360614[_0x3145('0x31')][_0x3145('0x35')]));_0x4b3f21[_0x3145('0x34')]=_0x4b3f21['attributes'][_0x3145('0x45')]?_0x4b3f21['attributes']:_0x51315f[_0x3145('0x33')];_0x4b3f21[_0x3145('0x37')]=qs[_0x3145('0x38')](_0x360614['query'][_0x3145('0x38')]);_0x4b3f21[_0x3145('0x3b')]=qs[_0x3145('0x39')](_[_0x3145('0x3a')](_0x360614[_0x3145('0x31')],_0x51315f['filters']));if(_0x360614[_0x3145('0x31')][_0x3145('0x3e')]){_0x4b3f21['where']=_[_0x3145('0x3c')](_0x4b3f21[_0x3145('0x3b')],{'$or':_[_0x3145('0x30')](_0x4b3f21['attributes'],function(_0x4879f6){var _0xfae379={};_0xfae379[_0x4879f6]={'$like':'%'+_0x360614[_0x3145('0x31')][_0x3145('0x3e')]+'%'};return _0xfae379;})});}_0x4b3f21=_[_0x3145('0x3c')]({},_0x4b3f21,_0x360614[_0x3145('0x3f')]);return _0x1c5087[_0x3145('0x4d')](_0x4b3f21);}})['then'](function(_0x42e557){if(_0x42e557){_0x1c371b=_0x42e557[_0x3145('0x45')];if(!_0x360614['query'][_0x3145('0x36')](_0x3145('0x4e'))){_0x4b3f21[_0x3145('0x1f')]=qs[_0x3145('0x1f')](_0x360614['query'][_0x3145('0x1f')]);_0x4b3f21[_0x3145('0x1c')]=qs[_0x3145('0x1c')](_0x360614[_0x3145('0x31')]['offset']);}return _0x1c5087[_0x3145('0x4d')](_0x4b3f21);}})[_0x3145('0x25')](function(_0x25522c){if(_0x25522c){return _0x25522c?{'count':_0x1c371b,'rows':_0x25522c}:null;}})[_0x3145('0x25')](respondWithResult(_0x18c4b4,null))[_0x3145('0x42')](handleError(_0x18c4b4,null));};exports['getDescriptions']=function(_0x98ab5a,_0x5befe9,_0x3d90dc){var _0x266217={};var _0x4abc08={};var _0x366409;var _0x1c6ee7;return db[_0x3145('0x2b')][_0x3145('0x4b')]({'where':{'id':_0x98ab5a[_0x3145('0x43')]['id']}})[_0x3145('0x25')](handleEntityNotFound(_0x5befe9,null))[_0x3145('0x25')](function(_0x1b149a){if(_0x1b149a){_0x366409=_0x1b149a;_0x4abc08[_0x3145('0x33')]=_[_0x3145('0x44')](db[_0x3145('0x4c')][_0x3145('0x2c')]);_0x4abc08[_0x3145('0x31')]=_[_0x3145('0x44')](_0x98ab5a[_0x3145('0x31')]);_0x4abc08[_0x3145('0x39')]=_['intersection'](_0x4abc08[_0x3145('0x33')],_0x4abc08[_0x3145('0x31')]);_0x266217[_0x3145('0x34')]=_[_0x3145('0x32')](_0x4abc08[_0x3145('0x33')],qs[_0x3145('0x35')](_0x98ab5a[_0x3145('0x31')]['fields']));_0x266217[_0x3145('0x34')]=_0x266217[_0x3145('0x34')][_0x3145('0x45')]?_0x266217['attributes']:_0x4abc08['model'];_0x266217[_0x3145('0x37')]=qs[_0x3145('0x38')](_0x98ab5a[_0x3145('0x31')][_0x3145('0x38')]);_0x266217[_0x3145('0x3b')]=qs[_0x3145('0x39')](_[_0x3145('0x3a')](_0x98ab5a['query'],_0x4abc08['filters']));if(_0x98ab5a[_0x3145('0x31')]['filter']){_0x266217[_0x3145('0x3b')]=_[_0x3145('0x3c')](_0x266217[_0x3145('0x3b')],{'$or':_[_0x3145('0x30')](_0x266217['attributes'],function(_0xe91aec){var _0x1b5979={};_0x1b5979[_0xe91aec]={'$like':'%'+_0x98ab5a[_0x3145('0x31')][_0x3145('0x3e')]+'%'};return _0x1b5979;})});}_0x266217=_[_0x3145('0x3c')]({},_0x266217,_0x98ab5a[_0x3145('0x3f')]);return _0x366409['getDescriptions'](_0x266217);}})['then'](function(_0x59455d){if(_0x59455d){_0x1c6ee7=_0x59455d['length'];if(!_0x98ab5a['query'][_0x3145('0x36')](_0x3145('0x4e'))){_0x266217[_0x3145('0x1f')]=qs[_0x3145('0x1f')](_0x98ab5a[_0x3145('0x31')][_0x3145('0x1f')]);_0x266217['offset']=qs['offset'](_0x98ab5a[_0x3145('0x31')][_0x3145('0x1c')]);}return _0x366409['getDescriptions'](_0x266217);}})[_0x3145('0x25')](function(_0x2a3310){if(_0x2a3310){return _0x2a3310?{'count':_0x1c6ee7,'rows':_0x2a3310}:null;}})[_0x3145('0x25')](respondWithResult(_0x5befe9,null))[_0x3145('0x42')](handleError(_0x5befe9,null));};exports[_0x3145('0x4f')]=function(_0x498448,_0xb9a461,_0x2ebc4b){var _0x4c71a3={};var _0x5c55d5={};var _0x5124bc;var _0xfee21a;return db[_0x3145('0x2b')][_0x3145('0x4b')]({'where':{'id':_0x498448[_0x3145('0x43')]['id']}})[_0x3145('0x25')](handleEntityNotFound(_0xb9a461,null))[_0x3145('0x25')](function(_0x7fdbce){if(_0x7fdbce){_0x5124bc=_0x7fdbce;_0x5c55d5['model']=_[_0x3145('0x44')](db[_0x3145('0x50')]['rawAttributes']);_0x5c55d5[_0x3145('0x31')]=_[_0x3145('0x44')](_0x498448['query']);_0x5c55d5['filters']=_[_0x3145('0x32')](_0x5c55d5[_0x3145('0x33')],_0x5c55d5['query']);_0x4c71a3['attributes']=_[_0x3145('0x32')](_0x5c55d5[_0x3145('0x33')],qs['fields'](_0x498448['query'][_0x3145('0x35')]));_0x4c71a3[_0x3145('0x34')]=_0x4c71a3['attributes']['length']?_0x4c71a3['attributes']:_0x5c55d5['model'];_0x4c71a3['order']=qs['sort'](_0x498448[_0x3145('0x31')][_0x3145('0x38')]);_0x4c71a3[_0x3145('0x3b')]=qs['filters'](_[_0x3145('0x3a')](_0x498448[_0x3145('0x31')],_0x5c55d5[_0x3145('0x39')]));if(_0x498448[_0x3145('0x31')][_0x3145('0x3e')]){_0x4c71a3[_0x3145('0x3b')]=_[_0x3145('0x3c')](_0x4c71a3[_0x3145('0x3b')],{'$or':_[_0x3145('0x30')](_0x4c71a3['attributes'],function(_0x37e247){var _0x5dd192={};_0x5dd192[_0x37e247]={'$like':'%'+_0x498448[_0x3145('0x31')][_0x3145('0x3e')]+'%'};return _0x5dd192;})});}_0x4c71a3=_[_0x3145('0x3c')]({},_0x4c71a3,_0x498448[_0x3145('0x3f')]);return _0x5124bc[_0x3145('0x4f')](_0x4c71a3);}})[_0x3145('0x25')](function(_0x2e67d5){if(_0x2e67d5){_0xfee21a=_0x2e67d5['length'];if(!_0x498448[_0x3145('0x31')][_0x3145('0x36')](_0x3145('0x4e'))){_0x4c71a3['limit']=qs[_0x3145('0x1f')](_0x498448[_0x3145('0x31')][_0x3145('0x1f')]);_0x4c71a3[_0x3145('0x1c')]=qs[_0x3145('0x1c')](_0x498448[_0x3145('0x31')][_0x3145('0x1c')]);}return _0x5124bc[_0x3145('0x4f')](_0x4c71a3);}})[_0x3145('0x25')](function(_0x2eceb8){if(_0x2eceb8){return _0x2eceb8?{'count':_0xfee21a,'rows':_0x2eceb8}:null;}})['then'](respondWithResult(_0xb9a461,null))['catch'](handleError(_0xb9a461,null));};exports[_0x3145('0x51')]=function(_0x480e62,_0x3489a0,_0x1cce4c){if(_0x480e62[_0x3145('0x48')]['id']){delete _0x480e62[_0x3145('0x48')]['id'];}return db[_0x3145('0x2b')][_0x3145('0x4b')]({'where':{'id':_0x480e62[_0x3145('0x43')]['id']}})['then'](handleEntityNotFound(_0x3489a0,null))['then'](function(_0x53f945){if(_0x53f945){return _0x53f945[_0x3145('0x51')](_0x480e62[_0x3145('0x48')][_0x3145('0x52')]||[]);}return null;})[_0x3145('0x25')](respondWithResult(_0x3489a0,null))[_0x3145('0x42')](handleError(_0x3489a0,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 73068a3..408555a 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 _0x0abf=['define','int_zendesk_configurations','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports'];(function(_0x19eb5d,_0x539b8a){var _0x3d76b6=function(_0x523aaf){while(--_0x523aaf){_0x19eb5d['push'](_0x19eb5d['shift']());}};_0x3d76b6(++_0x539b8a);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var logger=require(_0xf0ab('0x1'))(_0xf0ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf0ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var attributes=require(_0xf0ab('0x6'));module[_0xf0ab('0x7')]=function(_0x2ab7d6,_0x4d2ea8){return _0x2ab7d6[_0xf0ab('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0xf0ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab40=['rimraf','../../config/environment','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','bluebird','request-promise','path'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0xab40,0xcd));var _0x0ab4=function(_0x1ac361,_0x25b199){_0x1ac361=_0x1ac361-0x0;var _0x4a1ca3=_0xab40[_0x1ac361];return _0x4a1ca3;};'use strict';var _=require(_0x0ab4('0x0'));var util=require(_0x0ab4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0ab4('0x2'));var rp=require(_0x0ab4('0x3'));var fs=require('fs');var path=require(_0x0ab4('0x4'));var rimraf=require(_0x0ab4('0x5'));var config=require(_0x0ab4('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x28b17a,_0x4ba9d2){return _0x28b17a[_0x0ab4('0x7')](_0x0ab4('0x8'),attributes,{'tableName':_0x0ab4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 929f8a7..40bfe43 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 _0xec47=['http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x41cec7,_0x2e1f4a){var _0x5ed26a=function(_0x447ad7){while(--_0x447ad7){_0x41cec7['push'](_0x41cec7['shift']());}};_0x5ed26a(++_0x2e1f4a);}(_0xec47,0x1c5));var _0x7ec4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec47[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7ec4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7ec4('0x1'));var rs=require(_0x7ec4('0x2'));var fs=require('fs');var Redis=require(_0x7ec4('0x3'));var db=require(_0x7ec4('0x4'))['db'];var utils=require(_0x7ec4('0x5'));var logger=require('../../config/logger')(_0x7ec4('0x6'));var config=require(_0x7ec4('0x7'));var jayson=require(_0x7ec4('0x8'));var client=jayson['client'][_0x7ec4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df28d,_0xd62287,_0x4abc2e){return new BPromise(function(_0x1e6f16,_0x2d3f9a){return client[_0x7ec4('0xa')](_0x3df28d,_0x4abc2e)[_0x7ec4('0xb')](function(_0x1da00f){logger[_0x7ec4('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0xd62287,_0x7ec4('0xd'));logger[_0x7ec4('0xe')](_0x7ec4('0xf'),_0xd62287,_0x7ec4('0xd'),JSON[_0x7ec4('0x10')](_0x1da00f));if(_0x1da00f[_0x7ec4('0x11')]){if(_0x1da00f[_0x7ec4('0x11')]['code']===0x1f4){logger[_0x7ec4('0x11')](_0x7ec4('0x12'),_0xd62287,_0x1da00f['error']['message']);return _0x2d3f9a(_0x1da00f['error']['message']);}logger[_0x7ec4('0x11')](_0x7ec4('0x12'),_0xd62287,_0x1da00f['error']['message']);return _0x1e6f16(_0x1da00f[_0x7ec4('0x11')][_0x7ec4('0x13')]);}else{logger[_0x7ec4('0xc')](_0x7ec4('0x12'),_0xd62287,_0x7ec4('0xd'));_0x1e6f16(_0x1da00f[_0x7ec4('0x14')][_0x7ec4('0x13')]);}})[_0x7ec4('0x15')](function(_0x6a3343){logger[_0x7ec4('0x11')](_0x7ec4('0x12'),_0xd62287,_0x6a3343);_0x2d3f9a(_0x6a3343);});});} \ No newline at end of file +var _0x1788=['code','ZendeskConfiguration,\x20%s,\x20%s','message','catch','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','error'];(function(_0x25813b,_0x5716c0){var _0x887fa=function(_0x344370){while(--_0x344370){_0x25813b['push'](_0x25813b['shift']());}};_0x887fa(++_0x5716c0);}(_0x1788,0x1c4));var _0x8178=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x1788[_0x45d55e];return _0x29812a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8178('0x0'));var rs=require(_0x8178('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8178('0x2'))['db'];var utils=require(_0x8178('0x3'));var logger=require(_0x8178('0x4'))('rpc');var config=require(_0x8178('0x5'));var jayson=require(_0x8178('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x41c717,_0x3aa0e4,_0x364278){return new BPromise(function(_0x4368b2,_0x3796c0){return client[_0x8178('0x7')](_0x41c717,_0x364278)[_0x8178('0x8')](function(_0x267d98){logger[_0x8178('0x9')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3aa0e4,_0x8178('0xa'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3aa0e4,'request\x20sent',JSON['stringify'](_0x267d98));if(_0x267d98['error']){if(_0x267d98[_0x8178('0xb')][_0x8178('0xc')]===0x1f4){logger[_0x8178('0xb')](_0x8178('0xd'),_0x3aa0e4,_0x267d98[_0x8178('0xb')]['message']);return _0x3796c0(_0x267d98['error'][_0x8178('0xe')]);}logger[_0x8178('0xb')](_0x8178('0xd'),_0x3aa0e4,_0x267d98[_0x8178('0xb')][_0x8178('0xe')]);return _0x4368b2(_0x267d98[_0x8178('0xb')][_0x8178('0xe')]);}else{logger[_0x8178('0x9')](_0x8178('0xd'),_0x3aa0e4,_0x8178('0xa'));_0x4368b2(_0x267d98['result']['message']);}})[_0x8178('0xf')](function(_0x58ecf2){logger[_0x8178('0xb')](_0x8178('0xd'),_0x3aa0e4,_0x58ecf2);_0x3796c0(_0x58ecf2);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5d67c6f..9be5e41 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 _0xf6ca=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0xf2bff9,_0x326685){var _0x4ab791=function(_0x2c7b47){while(--_0x2c7b47){_0xf2bff9['push'](_0xf2bff9['shift']());}};_0x4ab791(++_0x326685);}(_0xf6ca,0x1c1));var _0xaf6c=function(_0xa52f07,_0x2e3a4e){_0xa52f07=_0xa52f07-0x0;var _0x4647ac=_0xf6ca[_0xa52f07];return _0x4647ac;};'use strict';var multer=require('multer');var util=require(_0xaf6c('0x0'));var path=require(_0xaf6c('0x1'));var timeout=require('connect-timeout');var express=require(_0xaf6c('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaf6c('0x3'));var interaction=require(_0xaf6c('0x4'));var config=require(_0xaf6c('0x5'));var controller=require('./intZendeskField.controller');router[_0xaf6c('0x6')]('/',auth[_0xaf6c('0x7')](),controller[_0xaf6c('0x8')]);router[_0xaf6c('0x6')](_0xaf6c('0x9'),auth[_0xaf6c('0x7')](),controller[_0xaf6c('0xa')]);router[_0xaf6c('0xb')]('/',auth['isAuthenticated'](),controller[_0xaf6c('0xc')]);router[_0xaf6c('0xd')](_0xaf6c('0x9'),auth[_0xaf6c('0x7')](),controller[_0xaf6c('0xe')]);router[_0xaf6c('0xf')]('/:id',auth[_0xaf6c('0x7')](),controller[_0xaf6c('0x10')]);module[_0xaf6c('0x11')]=router; \ No newline at end of file +var _0x49ce=['../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x54f8b6,_0x5e675f){var _0x2ff157=function(_0x37828b){while(--_0x37828b){_0x54f8b6['push'](_0x54f8b6['shift']());}};_0x2ff157(++_0x5e675f);}(_0x49ce,0xe4));var _0xe49c=function(_0x597834,_0x159bb6){_0x597834=_0x597834-0x0;var _0x12da6c=_0x49ce[_0x597834];return _0x12da6c;};'use strict';var multer=require(_0xe49c('0x0'));var util=require(_0xe49c('0x1'));var path=require(_0xe49c('0x2'));var timeout=require(_0xe49c('0x3'));var express=require('express');var router=express[_0xe49c('0x4')]();var fs_extra=require(_0xe49c('0x5'));var auth=require(_0xe49c('0x6'));var interaction=require(_0xe49c('0x7'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0xe49c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe49c('0x8')](_0xe49c('0x9'),auth[_0xe49c('0xa')](),controller[_0xe49c('0xb')]);router['post']('/',auth[_0xe49c('0xa')](),controller[_0xe49c('0xc')]);router[_0xe49c('0xd')](_0xe49c('0x9'),auth['isAuthenticated'](),controller[_0xe49c('0xe')]);router[_0xe49c('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe49c('0x10')]);module[_0xe49c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 776f75e..e4fbda5 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 _0x9033=['STRING','customVariable','BOOLEAN','sequelize','ENUM','variable','picklist','string'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x9033,0x173));var _0x3903=function(_0x2405e7,_0x39a4ef){_0x2405e7=_0x2405e7-0x0;var _0x2763b8=_0x9033[_0x2405e7];return _0x2763b8;};'use strict';var Sequelize=require(_0x3903('0x0'));module['exports']={'type':{'type':Sequelize[_0x3903('0x1')]('string',_0x3903('0x2'),'customVariable','keyValue',_0x3903('0x3')),'defaultValue':_0x3903('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3903('0x5')]},'keyType':{'type':Sequelize[_0x3903('0x1')]('string','variable',_0x3903('0x6'))},'keyContent':{'type':Sequelize[_0x3903('0x5')]},'idField':{'type':Sequelize[_0x3903('0x5')]},'nameField':{'type':Sequelize[_0x3903('0x5')]},'customField':{'type':Sequelize[_0x3903('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3903('0x5')]}}; \ No newline at end of file +var _0x51ae=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN'];(function(_0x5472b2,_0x40c0b9){var _0x1c0886=function(_0x1b9ea5){while(--_0x1b9ea5){_0x5472b2['push'](_0x5472b2['shift']());}};_0x1c0886(++_0x40c0b9);}(_0x51ae,0x70));var _0xe51a=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x51ae[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require('sequelize');module[_0xe51a('0x0')]={'type':{'type':Sequelize[_0xe51a('0x1')]('string',_0xe51a('0x2'),_0xe51a('0x3'),_0xe51a('0x4'),'picklist'),'defaultValue':_0xe51a('0x5')},'content':{'type':Sequelize[_0xe51a('0x6')]},'key':{'type':Sequelize[_0xe51a('0x6')]},'keyType':{'type':Sequelize[_0xe51a('0x1')](_0xe51a('0x5'),_0xe51a('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xe51a('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe51a('0x6')]},'customField':{'type':Sequelize[_0xe51a('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 1e1988a..3af4aa0 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 _0x5dd5=['length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','find','create','body','params','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','status','end','undefined','limit','count','offset','set','json','apply','reject','update','then','sendStatus','stack','name','send','index','map','ZendeskField','fieldName','key','keys','filters','intersection','model','query','attributes','fields'];(function(_0x12da7f,_0x493dc4){var _0x3329a6=function(_0x590fb7){while(--_0x590fb7){_0x12da7f['push'](_0x12da7f['shift']());}};_0x3329a6(++_0x493dc4);}(_0x5dd5,0x1a0));var _0x55dd=function(_0x4e6618,_0x26149d){_0x4e6618=_0x4e6618-0x0;var _0x13a2c8=_0x5dd5[_0x4e6618];return _0x13a2c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x55dd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x55dd('0x1'));var moment=require(_0x55dd('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x55dd('0x3'));var util=require(_0x55dd('0x4'));var path=require('path');var sox=require(_0x55dd('0x5'));var csv=require(_0x55dd('0x6'));var ejs=require(_0x55dd('0x7'));var fs=require('fs');var fs_extra=require(_0x55dd('0x8'));var _=require(_0x55dd('0x9'));var squel=require(_0x55dd('0xa'));var crypto=require(_0x55dd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x55dd('0xc'));var toCsv=require(_0x55dd('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x55dd('0xd'));var qs=require(_0x55dd('0xe'));var as=require(_0x55dd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55dd('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x55dd('0x11'))['db'];function respondWithStatusCode(_0x1f06ee,_0x2e743d){_0x2e743d=_0x2e743d||0xcc;return function(_0x515ac9){if(_0x515ac9){return _0x1f06ee['sendStatus'](_0x2e743d);}return _0x1f06ee[_0x55dd('0x12')](_0x2e743d)[_0x55dd('0x13')]();};}function respondWithResult(_0x1c2759,_0x331e4d){_0x331e4d=_0x331e4d||0xc8;return function(_0x175341){if(_0x175341){return _0x1c2759['status'](_0x331e4d)['json'](_0x175341);}};}function respondWithFilteredResult(_0x38e99f,_0x2d07a2){return function(_0x10fd0d){if(_0x10fd0d){var _0x48e062=typeof _0x2d07a2['offset']===_0x55dd('0x14')&&typeof _0x2d07a2[_0x55dd('0x15')]===_0x55dd('0x14');var _0x10effc=_0x10fd0d[_0x55dd('0x16')];var _0x1b075f=_0x48e062?0x0:_0x2d07a2[_0x55dd('0x17')];var _0x4cd157=_0x48e062?_0x10fd0d['count']:_0x2d07a2[_0x55dd('0x17')]+_0x2d07a2[_0x55dd('0x15')];var _0xd2096a;if(_0x4cd157>=_0x10effc){_0x4cd157=_0x10effc;_0xd2096a=0xc8;}else{_0xd2096a=0xce;}_0x38e99f[_0x55dd('0x12')](_0xd2096a);return _0x38e99f[_0x55dd('0x18')]('Content-Range',_0x1b075f+'-'+_0x4cd157+'/'+_0x10effc)[_0x55dd('0x19')](_0x10fd0d);}return null;};}function patchUpdates(_0x36b777){return function(_0x22b006){try{jsonpatch[_0x55dd('0x1a')](_0x22b006,_0x36b777,!![]);}catch(_0x4d2343){return BPromise[_0x55dd('0x1b')](_0x4d2343);}return _0x22b006['save']();};}function saveUpdates(_0x45dbd5,_0x509df1){return function(_0xe16a09){if(_0xe16a09){return _0xe16a09[_0x55dd('0x1c')](_0x45dbd5)['then'](function(_0x4cc020){return _0x4cc020;});}return null;};}function removeEntity(_0x139f8f,_0x20f049){return function(_0x4f7872){if(_0x4f7872){return _0x4f7872['destroy']()[_0x55dd('0x1d')](function(){_0x139f8f[_0x55dd('0x12')](0xcc)[_0x55dd('0x13')]();});}};}function handleEntityNotFound(_0x572829,_0x3699b4){return function(_0x6961c8){if(!_0x6961c8){_0x572829[_0x55dd('0x1e')](0x194);}return _0x6961c8;};}function handleError(_0x5ccb02,_0x237a5e){_0x237a5e=_0x237a5e||0x1f4;return function(_0x6c75f6){logger['error'](_0x6c75f6[_0x55dd('0x1f')]);if(_0x6c75f6[_0x55dd('0x20')]){delete _0x6c75f6[_0x55dd('0x20')];}_0x5ccb02['status'](_0x237a5e)[_0x55dd('0x21')](_0x6c75f6);};}exports[_0x55dd('0x22')]=function(_0x524b71,_0x43f235){var _0x2567e2={},_0x52988a={},_0x2e629e={'count':0x0,'rows':[]};var _0x5220a2=_[_0x55dd('0x23')](db[_0x55dd('0x24')]['rawAttributes'],function(_0x2d06ed){return{'name':_0x2d06ed[_0x55dd('0x25')],'type':_0x2d06ed['type'][_0x55dd('0x26')]};});_0x52988a['model']=_['map'](_0x5220a2,_0x55dd('0x20'));_0x52988a['query']=_[_0x55dd('0x27')](_0x524b71['query']);_0x52988a[_0x55dd('0x28')]=_[_0x55dd('0x29')](_0x52988a[_0x55dd('0x2a')],_0x52988a[_0x55dd('0x2b')]);_0x2567e2[_0x55dd('0x2c')]=_['intersection'](_0x52988a[_0x55dd('0x2a')],qs[_0x55dd('0x2d')](_0x524b71[_0x55dd('0x2b')][_0x55dd('0x2d')]));_0x2567e2['attributes']=_0x2567e2[_0x55dd('0x2c')][_0x55dd('0x2e')]?_0x2567e2['attributes']:_0x52988a[_0x55dd('0x2a')];if(!_0x524b71[_0x55dd('0x2b')][_0x55dd('0x2f')]('nolimit')){_0x2567e2[_0x55dd('0x15')]=qs[_0x55dd('0x15')](_0x524b71[_0x55dd('0x2b')][_0x55dd('0x15')]);_0x2567e2[_0x55dd('0x17')]=qs['offset'](_0x524b71[_0x55dd('0x2b')][_0x55dd('0x17')]);}_0x2567e2[_0x55dd('0x30')]=qs[_0x55dd('0x31')](_0x524b71['query'][_0x55dd('0x31')]);_0x2567e2['where']=qs[_0x55dd('0x28')](_[_0x55dd('0x32')](_0x524b71['query'],_0x52988a[_0x55dd('0x28')]),_0x5220a2);if(_0x524b71[_0x55dd('0x2b')][_0x55dd('0x33')]){_0x2567e2[_0x55dd('0x34')]=_[_0x55dd('0x35')](_0x2567e2['where'],{'$or':_[_0x55dd('0x23')](_0x5220a2,function(_0x56c9db){if(_0x56c9db[_0x55dd('0x36')]!==_0x55dd('0x37')){var _0x2fc894={};_0x2fc894[_0x56c9db['name']]={'$like':'%'+_0x524b71[_0x55dd('0x2b')]['filter']+'%'};return _0x2fc894;}})});}_0x2567e2=_[_0x55dd('0x35')]({},_0x2567e2,_0x524b71[_0x55dd('0x38')]);var _0x24d970={'where':_0x2567e2[_0x55dd('0x34')]};return db['ZendeskField']['count'](_0x24d970)[_0x55dd('0x1d')](function(_0x5e3c02){_0x2e629e[_0x55dd('0x16')]=_0x5e3c02;if(_0x524b71[_0x55dd('0x2b')][_0x55dd('0x39')]){_0x2567e2[_0x55dd('0x3a')]=[{'all':!![]}];}return db[_0x55dd('0x24')]['findAll'](_0x2567e2);})[_0x55dd('0x1d')](function(_0x263f18){_0x2e629e['rows']=_0x263f18;return _0x2e629e;})[_0x55dd('0x1d')](respondWithFilteredResult(_0x43f235,_0x2567e2))[_0x55dd('0x3b')](handleError(_0x43f235,null));};exports[_0x55dd('0x3c')]=function(_0x133c40,_0x21e233){var _0x58e391={'raw':!![],'where':{'id':_0x133c40['params']['id']}},_0x3ada78={};_0x3ada78[_0x55dd('0x2a')]=_[_0x55dd('0x27')](db[_0x55dd('0x24')][_0x55dd('0x3d')]);_0x3ada78['query']=_[_0x55dd('0x27')](_0x133c40[_0x55dd('0x2b')]);_0x3ada78['filters']=_[_0x55dd('0x29')](_0x3ada78[_0x55dd('0x2a')],_0x3ada78[_0x55dd('0x2b')]);_0x58e391['attributes']=_[_0x55dd('0x29')](_0x3ada78[_0x55dd('0x2a')],qs['fields'](_0x133c40[_0x55dd('0x2b')][_0x55dd('0x2d')]));_0x58e391['attributes']=_0x58e391['attributes'][_0x55dd('0x2e')]?_0x58e391['attributes']:_0x3ada78['model'];if(_0x133c40[_0x55dd('0x2b')][_0x55dd('0x39')]){_0x58e391[_0x55dd('0x3a')]=[{'all':!![]}];}_0x58e391=_[_0x55dd('0x35')]({},_0x58e391,_0x133c40[_0x55dd('0x38')]);return db[_0x55dd('0x24')][_0x55dd('0x3e')](_0x58e391)[_0x55dd('0x1d')](handleEntityNotFound(_0x21e233,null))['then'](respondWithResult(_0x21e233,null))[_0x55dd('0x3b')](handleError(_0x21e233,null));};exports[_0x55dd('0x3f')]=function(_0x8446cc,_0x181558){return db['ZendeskField'][_0x55dd('0x3f')](_0x8446cc['body'],{})[_0x55dd('0x1d')](respondWithResult(_0x181558,0xc9))[_0x55dd('0x3b')](handleError(_0x181558,null));};exports[_0x55dd('0x1c')]=function(_0x540267,_0x406ab9){if(_0x540267[_0x55dd('0x40')]['id']){delete _0x540267['body']['id'];}return db['ZendeskField']['find']({'where':{'id':_0x540267[_0x55dd('0x41')]['id']}})[_0x55dd('0x1d')](handleEntityNotFound(_0x406ab9,null))[_0x55dd('0x1d')](saveUpdates(_0x540267[_0x55dd('0x40')],null))[_0x55dd('0x1d')](respondWithResult(_0x406ab9,null))[_0x55dd('0x3b')](handleError(_0x406ab9,null));};exports['destroy']=function(_0x2b2aef,_0x1e3fee){return db[_0x55dd('0x24')][_0x55dd('0x3e')]({'where':{'id':_0x2b2aef[_0x55dd('0x41')]['id']}})[_0x55dd('0x1d')](handleEntityNotFound(_0x1e3fee,null))['then'](removeEntity(_0x1e3fee,null))[_0x55dd('0x3b')](handleError(_0x1e3fee,null));}; \ No newline at end of file +var _0x17e5=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','filter','where','type','VIRTUAL','merge','findAll','rows','catch','show','params','options'];(function(_0x1c1b32,_0x43e565){var _0x35252d=function(_0x3aa9b1){while(--_0x3aa9b1){_0x1c1b32['push'](_0x1c1b32['shift']());}};_0x35252d(++_0x43e565);}(_0x17e5,0xdb));var _0x517e=function(_0x4498c3,_0x947819){_0x4498c3=_0x4498c3-0x0;var _0x158542=_0x17e5[_0x4498c3];return _0x158542;};'use strict';var emlformat=require(_0x517e('0x0'));var rimraf=require(_0x517e('0x1'));var zipdir=require(_0x517e('0x2'));var jsonpatch=require(_0x517e('0x3'));var rp=require(_0x517e('0x4'));var moment=require('moment');var BPromise=require(_0x517e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x517e('0x6'));var sox=require(_0x517e('0x7'));var csv=require(_0x517e('0x8'));var ejs=require(_0x517e('0x9'));var fs=require('fs');var fs_extra=require(_0x517e('0xa'));var _=require(_0x517e('0xb'));var squel=require(_0x517e('0xc'));var crypto=require(_0x517e('0xd'));var jsforce=require(_0x517e('0xe'));var deskjs=require(_0x517e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x517e('0x10'));var Papa=require('papaparse');var Redis=require(_0x517e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x517e('0x12'));var hardwareService=require(_0x517e('0x13'));var logger=require(_0x517e('0x14'))(_0x517e('0x15'));var utils=require(_0x517e('0x16'));var config=require(_0x517e('0x17'));var licenseUtil=require(_0x517e('0x18'));var db=require(_0x517e('0x19'))['db'];function respondWithStatusCode(_0x4951f8,_0x5a4265){_0x5a4265=_0x5a4265||0xcc;return function(_0x46627a){if(_0x46627a){return _0x4951f8[_0x517e('0x1a')](_0x5a4265);}return _0x4951f8[_0x517e('0x1b')](_0x5a4265)[_0x517e('0x1c')]();};}function respondWithResult(_0x4784d9,_0x2012d5){_0x2012d5=_0x2012d5||0xc8;return function(_0x942d3d){if(_0x942d3d){return _0x4784d9[_0x517e('0x1b')](_0x2012d5)[_0x517e('0x1d')](_0x942d3d);}};}function respondWithFilteredResult(_0x47d49c,_0x601027){return function(_0x47d8ca){if(_0x47d8ca){var _0x20640b=typeof _0x601027[_0x517e('0x1e')]==='undefined'&&typeof _0x601027[_0x517e('0x1f')]==='undefined';var _0x1e8ff1=_0x47d8ca['count'];var _0x20a023=_0x20640b?0x0:_0x601027['offset'];var _0x290909=_0x20640b?_0x47d8ca[_0x517e('0x20')]:_0x601027[_0x517e('0x1e')]+_0x601027[_0x517e('0x1f')];var _0x49ebc4;if(_0x290909>=_0x1e8ff1){_0x290909=_0x1e8ff1;_0x49ebc4=0xc8;}else{_0x49ebc4=0xce;}_0x47d49c['status'](_0x49ebc4);return _0x47d49c['set'](_0x517e('0x21'),_0x20a023+'-'+_0x290909+'/'+_0x1e8ff1)['json'](_0x47d8ca);}return null;};}function patchUpdates(_0x34125f){return function(_0x38eeb4){try{jsonpatch[_0x517e('0x22')](_0x38eeb4,_0x34125f,!![]);}catch(_0x1e1dc7){return BPromise['reject'](_0x1e1dc7);}return _0x38eeb4['save']();};}function saveUpdates(_0x1972f8,_0x1d89d7){return function(_0x5c1326){if(_0x5c1326){return _0x5c1326[_0x517e('0x23')](_0x1972f8)[_0x517e('0x24')](function(_0x1fb54c){return _0x1fb54c;});}return null;};}function removeEntity(_0x22f8a6,_0x1c5f2e){return function(_0x27d4e2){if(_0x27d4e2){return _0x27d4e2[_0x517e('0x25')]()[_0x517e('0x24')](function(){_0x22f8a6[_0x517e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x575bcc,_0x5c4957){return function(_0x364467){if(!_0x364467){_0x575bcc[_0x517e('0x1a')](0x194);}return _0x364467;};}function handleError(_0x5aa46b,_0x2e068a){_0x2e068a=_0x2e068a||0x1f4;return function(_0x38ef34){logger[_0x517e('0x26')](_0x38ef34[_0x517e('0x27')]);if(_0x38ef34[_0x517e('0x28')]){delete _0x38ef34[_0x517e('0x28')];}_0x5aa46b[_0x517e('0x1b')](_0x2e068a)[_0x517e('0x29')](_0x38ef34);};}exports[_0x517e('0x2a')]=function(_0x453941,_0x342ee3){var _0x3a512b={},_0x1d27a5={},_0x37c98f={'count':0x0,'rows':[]};var _0x3b3143=_[_0x517e('0x2b')](db[_0x517e('0x2c')][_0x517e('0x2d')],function(_0x4764df){return{'name':_0x4764df[_0x517e('0x2e')],'type':_0x4764df['type'][_0x517e('0x2f')]};});_0x1d27a5[_0x517e('0x30')]=_[_0x517e('0x2b')](_0x3b3143,_0x517e('0x28'));_0x1d27a5['query']=_[_0x517e('0x31')](_0x453941[_0x517e('0x32')]);_0x1d27a5[_0x517e('0x33')]=_[_0x517e('0x34')](_0x1d27a5['model'],_0x1d27a5[_0x517e('0x32')]);_0x3a512b[_0x517e('0x35')]=_['intersection'](_0x1d27a5[_0x517e('0x30')],qs[_0x517e('0x36')](_0x453941[_0x517e('0x32')][_0x517e('0x36')]));_0x3a512b['attributes']=_0x3a512b[_0x517e('0x35')]['length']?_0x3a512b[_0x517e('0x35')]:_0x1d27a5[_0x517e('0x30')];if(!_0x453941[_0x517e('0x32')]['hasOwnProperty'](_0x517e('0x37'))){_0x3a512b['limit']=qs[_0x517e('0x1f')](_0x453941[_0x517e('0x32')][_0x517e('0x1f')]);_0x3a512b[_0x517e('0x1e')]=qs[_0x517e('0x1e')](_0x453941[_0x517e('0x32')]['offset']);}_0x3a512b[_0x517e('0x38')]=qs[_0x517e('0x39')](_0x453941['query']['sort']);_0x3a512b['where']=qs[_0x517e('0x33')](_['pick'](_0x453941[_0x517e('0x32')],_0x1d27a5[_0x517e('0x33')]),_0x3b3143);if(_0x453941[_0x517e('0x32')][_0x517e('0x3a')]){_0x3a512b[_0x517e('0x3b')]=_['merge'](_0x3a512b[_0x517e('0x3b')],{'$or':_[_0x517e('0x2b')](_0x3b3143,function(_0x5c3c4a){if(_0x5c3c4a[_0x517e('0x3c')]!==_0x517e('0x3d')){var _0x5b47dd={};_0x5b47dd[_0x5c3c4a['name']]={'$like':'%'+_0x453941['query'][_0x517e('0x3a')]+'%'};return _0x5b47dd;}})});}_0x3a512b=_[_0x517e('0x3e')]({},_0x3a512b,_0x453941['options']);var _0x8b874f={'where':_0x3a512b['where']};return db[_0x517e('0x2c')][_0x517e('0x20')](_0x8b874f)[_0x517e('0x24')](function(_0x4699a2){_0x37c98f['count']=_0x4699a2;if(_0x453941['query']['includeAll']){_0x3a512b['include']=[{'all':!![]}];}return db[_0x517e('0x2c')][_0x517e('0x3f')](_0x3a512b);})[_0x517e('0x24')](function(_0xb2e066){_0x37c98f[_0x517e('0x40')]=_0xb2e066;return _0x37c98f;})[_0x517e('0x24')](respondWithFilteredResult(_0x342ee3,_0x3a512b))[_0x517e('0x41')](handleError(_0x342ee3,null));};exports[_0x517e('0x42')]=function(_0x25cad8,_0x139d98){var _0x123fea={'raw':!![],'where':{'id':_0x25cad8[_0x517e('0x43')]['id']}},_0x44802c={};_0x44802c[_0x517e('0x30')]=_[_0x517e('0x31')](db['ZendeskField'][_0x517e('0x2d')]);_0x44802c[_0x517e('0x32')]=_[_0x517e('0x31')](_0x25cad8[_0x517e('0x32')]);_0x44802c[_0x517e('0x33')]=_[_0x517e('0x34')](_0x44802c[_0x517e('0x30')],_0x44802c[_0x517e('0x32')]);_0x123fea['attributes']=_[_0x517e('0x34')](_0x44802c[_0x517e('0x30')],qs[_0x517e('0x36')](_0x25cad8['query'][_0x517e('0x36')]));_0x123fea['attributes']=_0x123fea['attributes']['length']?_0x123fea[_0x517e('0x35')]:_0x44802c['model'];if(_0x25cad8['query']['includeAll']){_0x123fea['include']=[{'all':!![]}];}_0x123fea=_[_0x517e('0x3e')]({},_0x123fea,_0x25cad8[_0x517e('0x44')]);return db[_0x517e('0x2c')][_0x517e('0x45')](_0x123fea)[_0x517e('0x24')](handleEntityNotFound(_0x139d98,null))['then'](respondWithResult(_0x139d98,null))[_0x517e('0x41')](handleError(_0x139d98,null));};exports[_0x517e('0x46')]=function(_0x4f810b,_0x1e1b6e){return db['ZendeskField'][_0x517e('0x46')](_0x4f810b[_0x517e('0x47')],{})['then'](respondWithResult(_0x1e1b6e,0xc9))['catch'](handleError(_0x1e1b6e,null));};exports['update']=function(_0x5426e0,_0x2e8dec){if(_0x5426e0[_0x517e('0x47')]['id']){delete _0x5426e0[_0x517e('0x47')]['id'];}return db[_0x517e('0x2c')][_0x517e('0x45')]({'where':{'id':_0x5426e0['params']['id']}})[_0x517e('0x24')](handleEntityNotFound(_0x2e8dec,null))[_0x517e('0x24')](saveUpdates(_0x5426e0[_0x517e('0x47')],null))[_0x517e('0x24')](respondWithResult(_0x2e8dec,null))[_0x517e('0x41')](handleError(_0x2e8dec,null));};exports[_0x517e('0x25')]=function(_0x55e432,_0x48279f){return db[_0x517e('0x2c')][_0x517e('0x45')]({'where':{'id':_0x55e432[_0x517e('0x43')]['id']}})[_0x517e('0x24')](handleEntityNotFound(_0x48279f,null))[_0x517e('0x24')](removeEntity(_0x48279f,null))['catch'](handleError(_0x48279f,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index be2b52e..f8b290a 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 _0x6b83=['idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','zendesk_unique_index'];(function(_0x54c984,_0x5052e3){var _0x4c8d1c=function(_0x54828e){while(--_0x54828e){_0x54c984['push'](_0x54c984['shift']());}};_0x4c8d1c(++_0x5052e3);}(_0x6b83,0x16a));var _0x36b8=function(_0xbd6f8e,_0x10c174){_0xbd6f8e=_0xbd6f8e-0x0;var _0x57b158=_0x6b83[_0xbd6f8e];return _0x57b158;};'use strict';var _=require(_0x36b8('0x0'));var util=require('util');var logger=require(_0x36b8('0x1'))('api');var moment=require(_0x36b8('0x2'));var BPromise=require(_0x36b8('0x3'));var rp=require(_0x36b8('0x4'));var fs=require('fs');var path=require(_0x36b8('0x5'));var rimraf=require(_0x36b8('0x6'));var config=require(_0x36b8('0x7'));var attributes=require(_0x36b8('0x8'));module[_0x36b8('0x9')]=function(_0x436380,_0x412ccf){return _0x436380[_0x36b8('0xa')]('ZendeskField',attributes,{'tableName':_0x36b8('0xb'),'paranoid':![],'indexes':[{'name':_0x36b8('0xc'),'fields':[_0x36b8('0xd'),_0x36b8('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x41f9=['path','rimraf','../../config/environment','exports','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x42997d,_0xa0b875){var _0x42a209=function(_0x4af94c){while(--_0x4af94c){_0x42997d['push'](_0x42997d['shift']());}};_0x42a209(++_0xa0b875);}(_0x41f9,0x1ce));var _0x941f=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0x41f9[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x941f('0x0'));var util=require(_0x941f('0x1'));var logger=require(_0x941f('0x2'))(_0x941f('0x3'));var moment=require(_0x941f('0x4'));var BPromise=require('bluebird');var rp=require(_0x941f('0x5'));var fs=require('fs');var path=require(_0x941f('0x6'));var rimraf=require(_0x941f('0x7'));var config=require(_0x941f('0x8'));var attributes=require('./intZendeskField.attributes');module[_0x941f('0x9')]=function(_0x7d6c03,_0x427079){return _0x7d6c03['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x941f('0xa'),_0x941f('0xb')],'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 854b26d..c42ec07 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 _0xf453=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','info'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xf453,0x6c));var _0x3f45=function(_0x902641,_0x55e5d7){_0x902641=_0x902641-0x0;var _0xb01cc9=_0xf453[_0x902641];return _0xb01cc9;};'use strict';var _=require(_0x3f45('0x0'));var util=require(_0x3f45('0x1'));var moment=require(_0x3f45('0x2'));var BPromise=require(_0x3f45('0x3'));var rs=require(_0x3f45('0x4'));var fs=require('fs');var Redis=require(_0x3f45('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f45('0x6'));var logger=require(_0x3f45('0x7'))(_0x3f45('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3f45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x280262,_0x2a3c4a,_0x501006){return new BPromise(function(_0x2f6a78,_0x53f0ae){return client[_0x3f45('0xa')](_0x280262,_0x501006)['then'](function(_0x4ab2b3){logger[_0x3f45('0xb')](_0x3f45('0xc'),_0x2a3c4a,_0x3f45('0xd'));logger[_0x3f45('0xe')](_0x3f45('0xf'),_0x2a3c4a,'request\x20sent',JSON[_0x3f45('0x10')](_0x4ab2b3));if(_0x4ab2b3[_0x3f45('0x11')]){if(_0x4ab2b3['error']['code']===0x1f4){logger['error'](_0x3f45('0xc'),_0x2a3c4a,_0x4ab2b3[_0x3f45('0x11')][_0x3f45('0x12')]);return _0x53f0ae(_0x4ab2b3[_0x3f45('0x11')][_0x3f45('0x12')]);}logger[_0x3f45('0x11')]('ZendeskField,\x20%s,\x20%s',_0x2a3c4a,_0x4ab2b3[_0x3f45('0x11')]['message']);return _0x2f6a78(_0x4ab2b3[_0x3f45('0x11')][_0x3f45('0x12')]);}else{logger[_0x3f45('0xb')](_0x3f45('0xc'),_0x2a3c4a,_0x3f45('0xd'));_0x2f6a78(_0x4ab2b3[_0x3f45('0x13')][_0x3f45('0x12')]);}})['catch'](function(_0x32dc04){logger[_0x3f45('0x11')](_0x3f45('0xc'),_0x2a3c4a,_0x32dc04);_0x53f0ae(_0x32dc04);});});} \ No newline at end of file +var _0x4a58=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x4a58,0x146));var _0x84a5=function(_0x261b08,_0x563d91){_0x261b08=_0x261b08-0x0;var _0xeeaf84=_0x4a58[_0x261b08];return _0xeeaf84;};'use strict';var _=require(_0x84a5('0x0'));var util=require(_0x84a5('0x1'));var moment=require(_0x84a5('0x2'));var BPromise=require(_0x84a5('0x3'));var rs=require(_0x84a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x84a5('0x5'))['db'];var utils=require(_0x84a5('0x6'));var logger=require(_0x84a5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x84a5('0x8'));var client=jayson[_0x84a5('0x9')][_0x84a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc17412,_0x1db705,_0x5179e2){return new BPromise(function(_0x2c9fd6,_0x5a327e){return client['request'](_0xc17412,_0x5179e2)[_0x84a5('0xb')](function(_0x4f680a){logger['info'](_0x84a5('0xc'),_0x1db705,'request\x20sent');logger[_0x84a5('0xd')](_0x84a5('0xe'),_0x1db705,_0x84a5('0xf'),JSON[_0x84a5('0x10')](_0x4f680a));if(_0x4f680a['error']){if(_0x4f680a[_0x84a5('0x11')][_0x84a5('0x12')]===0x1f4){logger[_0x84a5('0x11')](_0x84a5('0xc'),_0x1db705,_0x4f680a['error'][_0x84a5('0x13')]);return _0x5a327e(_0x4f680a[_0x84a5('0x11')][_0x84a5('0x13')]);}logger[_0x84a5('0x11')](_0x84a5('0xc'),_0x1db705,_0x4f680a[_0x84a5('0x11')][_0x84a5('0x13')]);return _0x2c9fd6(_0x4f680a['error'][_0x84a5('0x13')]);}else{logger[_0x84a5('0x14')]('ZendeskField,\x20%s,\x20%s',_0x1db705,'request\x20sent');_0x2c9fd6(_0x4f680a['result'][_0x84a5('0x13')]);}})[_0x84a5('0x15')](function(_0x393a8f){logger[_0x84a5('0x11')](_0x84a5('0xc'),_0x1db705,_0x393a8f);_0x5a327e(_0x393a8f);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 444a730..4c03df1 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 _0x7015=['post','addConfiguration','update','delete','/:id','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id/configurations','getConfigurations','getFields'];(function(_0x4de877,_0x340170){var _0xb2cfeb=function(_0x488634){while(--_0x488634){_0x4de877['push'](_0x4de877['shift']());}};_0xb2cfeb(++_0x340170);}(_0x7015,0x70));var _0x5701=function(_0x596490,_0x2a2aec){_0x596490=_0x596490-0x0;var _0x3fb0d9=_0x7015[_0x596490];return _0x3fb0d9;};'use strict';var multer=require('multer');var util=require(_0x5701('0x0'));var path=require(_0x5701('0x1'));var timeout=require(_0x5701('0x2'));var express=require('express');var router=express[_0x5701('0x3')]();var fs_extra=require(_0x5701('0x4'));var auth=require(_0x5701('0x5'));var interaction=require(_0x5701('0x6'));var config=require(_0x5701('0x7'));var controller=require(_0x5701('0x8'));router[_0x5701('0x9')]('/',auth[_0x5701('0xa')](),controller['index']);router[_0x5701('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5701('0x9')](_0x5701('0xb'),auth['isAuthenticated'](),controller[_0x5701('0xc')]);router[_0x5701('0x9')]('/:id/fields',auth[_0x5701('0xa')](),controller[_0x5701('0xd')]);router[_0x5701('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x5701('0xa')](),controller[_0x5701('0xf')]);router['put']('/:id',auth[_0x5701('0xa')](),controller[_0x5701('0x10')]);router[_0x5701('0x11')](_0x5701('0x12'),auth[_0x5701('0xa')](),controller[_0x5701('0x13')]);module[_0x5701('0x14')]=router; \ No newline at end of file +var _0x1964=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show','getConfigurations','/:id/fields','create','post','/:id/configurations','/:id','update','exports','multer','util','path','connect-timeout','express'];(function(_0x1ec9af,_0x4eef08){var _0xb4a880=function(_0x57192a){while(--_0x57192a){_0x1ec9af['push'](_0x1ec9af['shift']());}};_0xb4a880(++_0x4eef08);}(_0x1964,0xe1));var _0x4196=function(_0x160be6,_0x38b648){_0x160be6=_0x160be6-0x0;var _0x36de35=_0x1964[_0x160be6];return _0x36de35;};'use strict';var multer=require(_0x4196('0x0'));var util=require(_0x4196('0x1'));var path=require(_0x4196('0x2'));var timeout=require(_0x4196('0x3'));var express=require(_0x4196('0x4'));var router=express[_0x4196('0x5')]();var fs_extra=require(_0x4196('0x6'));var auth=require(_0x4196('0x7'));var interaction=require(_0x4196('0x8'));var config=require(_0x4196('0x9'));var controller=require(_0x4196('0xa'));router['get']('/',auth[_0x4196('0xb')](),controller[_0x4196('0xc')]);router[_0x4196('0xd')]('/:id',auth[_0x4196('0xb')](),controller[_0x4196('0xe')]);router[_0x4196('0xd')]('/:id/configurations',auth[_0x4196('0xb')](),controller[_0x4196('0xf')]);router[_0x4196('0xd')](_0x4196('0x10'),auth[_0x4196('0xb')](),controller['getFields']);router['post']('/',auth[_0x4196('0xb')](),controller[_0x4196('0x11')]);router[_0x4196('0x12')](_0x4196('0x13'),auth[_0x4196('0xb')](),controller['addConfiguration']);router['put'](_0x4196('0x14'),auth[_0x4196('0xb')](),controller[_0x4196('0x15')]);router['delete'](_0x4196('0x14'),auth[_0x4196('0xb')](),controller['destroy']);module[_0x4196('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a8ee54b..94b8a1a 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 _0x22fb=['STRING'];(function(_0xe25baa,_0x317f8f){var _0x4f8f48=function(_0x53fd96){while(--_0x53fd96){_0xe25baa['push'](_0xe25baa['shift']());}};_0x4f8f48(++_0x317f8f);}(_0x22fb,0x192));var _0xb22f=function(_0x540f14,_0x2f78dd){_0x540f14=_0x540f14-0x0;var _0x3ab6d8=_0x22fb[_0x540f14];return _0x3ab6d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb22f('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb22f('0x0')]},'zone':{'type':Sequelize[_0xb22f('0x0')]},'clientId':{'type':Sequelize[_0xb22f('0x0')]},'clientSecret':{'type':Sequelize[_0xb22f('0x0')]},'serverUrl':{'type':Sequelize[_0xb22f('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb22f('0x0')]}}; \ No newline at end of file +var _0xaa88=['exports','STRING','sequelize'];(function(_0x541886,_0x12d2b0){var _0x599f78=function(_0x4a68c7){while(--_0x4a68c7){_0x541886['push'](_0x541886['shift']());}};_0x599f78(++_0x12d2b0);}(_0xaa88,0x137));var _0x8aa8=function(_0x2e7f96,_0x2ffe43){_0x2e7f96=_0x2e7f96-0x0;var _0x315277=_0xaa88[_0x2e7f96];return _0x315277;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'name':{'type':Sequelize[_0x8aa8('0x2')]},'description':{'type':Sequelize[_0x8aa8('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8aa8('0x2')]},'clientId':{'type':Sequelize[_0x8aa8('0x2')]},'clientSecret':{'type':Sequelize[_0x8aa8('0x2')]},'serverUrl':{'type':Sequelize[_0x8aa8('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8aa8('0x2')]},'refreshToken':{'type':Sequelize[_0x8aa8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7a5182b..0bd4647 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 _0x640d=['offset','undefined','count','limit','status','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','ZohoAccount','findAll','rows','catch','show','find','create','body','params','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','findOne','host','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','WhoId','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json'];(function(_0x20216f,_0xc9fdd4){var _0x23e7f4=function(_0x1d3c17){while(--_0x1d3c17){_0x20216f['push'](_0x20216f['shift']());}};_0x23e7f4(++_0xc9fdd4);}(_0x640d,0x166));var _0xd640=function(_0x514af5,_0x3ebcba){_0x514af5=_0x514af5-0x0;var _0x1f049a=_0x640d[_0x514af5];return _0x1f049a;};'use strict';var emlformat=require(_0xd640('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd640('0x1'));var jsonpatch=require(_0xd640('0x2'));var rp=require(_0xd640('0x3'));var moment=require(_0xd640('0x4'));var BPromise=require(_0xd640('0x5'));var Mustache=require(_0xd640('0x6'));var util=require(_0xd640('0x7'));var path=require(_0xd640('0x8'));var sox=require('sox');var csv=require(_0xd640('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd640('0xa'));var squel=require('squel');var crypto=require(_0xd640('0xb'));var jsforce=require(_0xd640('0xc'));var deskjs=require(_0xd640('0xd'));var toCsv=require(_0xd640('0x9'));var querystring=require(_0xd640('0xe'));var Papa=require('papaparse');var Redis=require(_0xd640('0xf'));var authService=require(_0xd640('0x10'));var qs=require(_0xd640('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd640('0x12'));var logger=require('../../config/logger')(_0xd640('0x13'));var utils=require('../../config/utils');var config=require(_0xd640('0x14'));var licenseUtil=require(_0xd640('0x15'));var db=require(_0xd640('0x16'))['db'];var integrations=require(_0xd640('0x17'));function respondWithStatusCode(_0x1d6508,_0x44eec8){_0x44eec8=_0x44eec8||0xcc;return function(_0x20329b){if(_0x20329b){return _0x1d6508['sendStatus'](_0x44eec8);}return _0x1d6508['status'](_0x44eec8)[_0xd640('0x18')]();};}function respondWithResult(_0x1c4eeb,_0x43534c){_0x43534c=_0x43534c||0xc8;return function(_0x52acc1){if(_0x52acc1){return _0x1c4eeb['status'](_0x43534c)[_0xd640('0x19')](_0x52acc1);}};}function respondWithFilteredResult(_0xfbdfaa,_0x1d70fe){return function(_0x3baaa3){if(_0x3baaa3){var _0x2d4b8c=typeof _0x1d70fe[_0xd640('0x1a')]==='undefined'&&typeof _0x1d70fe['limit']===_0xd640('0x1b');var _0x1469fa=_0x3baaa3[_0xd640('0x1c')];var _0x59b01e=_0x2d4b8c?0x0:_0x1d70fe[_0xd640('0x1a')];var _0x2194e3=_0x2d4b8c?_0x3baaa3['count']:_0x1d70fe['offset']+_0x1d70fe[_0xd640('0x1d')];var _0x3694cb;if(_0x2194e3>=_0x1469fa){_0x2194e3=_0x1469fa;_0x3694cb=0xc8;}else{_0x3694cb=0xce;}_0xfbdfaa[_0xd640('0x1e')](_0x3694cb);return _0xfbdfaa[_0xd640('0x1f')](_0xd640('0x20'),_0x59b01e+'-'+_0x2194e3+'/'+_0x1469fa)[_0xd640('0x19')](_0x3baaa3);}return null;};}function patchUpdates(_0x2bca20){return function(_0x51c835){try{jsonpatch['apply'](_0x51c835,_0x2bca20,!![]);}catch(_0x45d169){return BPromise['reject'](_0x45d169);}return _0x51c835[_0xd640('0x21')]();};}function saveUpdates(_0x296e57,_0x35f034){return function(_0x3a2b83){if(_0x3a2b83){return _0x3a2b83[_0xd640('0x22')](_0x296e57)[_0xd640('0x23')](function(_0x4e9de6){return _0x4e9de6;});}return null;};}function removeEntity(_0x33991c,_0x28355c){return function(_0x218309){if(_0x218309){return _0x218309[_0xd640('0x24')]()[_0xd640('0x23')](function(){_0x33991c['status'](0xcc)[_0xd640('0x18')]();});}};}function handleEntityNotFound(_0x1beaa9,_0x89124c){return function(_0x2a4b0e){if(!_0x2a4b0e){_0x1beaa9[_0xd640('0x25')](0x194);}return _0x2a4b0e;};}function handleError(_0x37eb77,_0x195f58){_0x195f58=_0x195f58||0x1f4;return function(_0x38ab17){logger['error'](_0x38ab17[_0xd640('0x26')]);if(_0x38ab17[_0xd640('0x27')]){delete _0x38ab17[_0xd640('0x27')];}_0x37eb77[_0xd640('0x1e')](_0x195f58)['send'](_0x38ab17);};}exports[_0xd640('0x28')]=function(_0x1c8726,_0xfa1bf2){var _0x5c4a1b={},_0x29c55f={},_0x3c0041={'count':0x0,'rows':[]};var _0x37fd71=_[_0xd640('0x29')](db['ZohoAccount'][_0xd640('0x2a')],function(_0x253b5a){return{'name':_0x253b5a[_0xd640('0x2b')],'type':_0x253b5a['type'][_0xd640('0x2c')]};});_0x29c55f['model']=_[_0xd640('0x29')](_0x37fd71,_0xd640('0x27'));_0x29c55f[_0xd640('0x2d')]=_[_0xd640('0x2e')](_0x1c8726[_0xd640('0x2d')]);_0x29c55f['filters']=_[_0xd640('0x2f')](_0x29c55f[_0xd640('0x30')],_0x29c55f['query']);_0x5c4a1b[_0xd640('0x31')]=_[_0xd640('0x2f')](_0x29c55f['model'],qs[_0xd640('0x32')](_0x1c8726[_0xd640('0x2d')][_0xd640('0x32')]));_0x5c4a1b[_0xd640('0x31')]=_0x5c4a1b['attributes'][_0xd640('0x33')]?_0x5c4a1b['attributes']:_0x29c55f['model'];if(!_0x1c8726[_0xd640('0x2d')][_0xd640('0x34')](_0xd640('0x35'))){_0x5c4a1b[_0xd640('0x1d')]=qs['limit'](_0x1c8726[_0xd640('0x2d')]['limit']);_0x5c4a1b[_0xd640('0x1a')]=qs[_0xd640('0x1a')](_0x1c8726['query'][_0xd640('0x1a')]);}_0x5c4a1b[_0xd640('0x36')]=qs[_0xd640('0x37')](_0x1c8726[_0xd640('0x2d')][_0xd640('0x37')]);_0x5c4a1b[_0xd640('0x38')]=qs[_0xd640('0x39')](_[_0xd640('0x3a')](_0x1c8726[_0xd640('0x2d')],_0x29c55f['filters']),_0x37fd71);if(_0x1c8726[_0xd640('0x2d')][_0xd640('0x3b')]){_0x5c4a1b['where']=_[_0xd640('0x3c')](_0x5c4a1b[_0xd640('0x38')],{'$or':_[_0xd640('0x29')](_0x37fd71,function(_0x334cbb){if(_0x334cbb[_0xd640('0x3d')]!==_0xd640('0x3e')){var _0x10ea4c={};_0x10ea4c[_0x334cbb[_0xd640('0x27')]]={'$like':'%'+_0x1c8726['query'][_0xd640('0x3b')]+'%'};return _0x10ea4c;}})});}_0x5c4a1b=_[_0xd640('0x3c')]({},_0x5c4a1b,_0x1c8726[_0xd640('0x3f')]);var _0x563151={'where':_0x5c4a1b['where']};return db['ZohoAccount']['count'](_0x563151)[_0xd640('0x23')](function(_0x518404){_0x3c0041[_0xd640('0x1c')]=_0x518404;if(_0x1c8726[_0xd640('0x2d')][_0xd640('0x40')]){_0x5c4a1b[_0xd640('0x41')]=[{'all':!![]}];}return db[_0xd640('0x42')][_0xd640('0x43')](_0x5c4a1b);})['then'](function(_0x477524){_0x3c0041[_0xd640('0x44')]=_0x477524;return _0x3c0041;})[_0xd640('0x23')](respondWithFilteredResult(_0xfa1bf2,_0x5c4a1b))[_0xd640('0x45')](handleError(_0xfa1bf2,null));};exports[_0xd640('0x46')]=function(_0x2e26c5,_0x39d760){var _0xc40a83={'raw':![],'where':{'id':_0x2e26c5['params']['id']}},_0x405580={};_0x405580['model']=_[_0xd640('0x2e')](db[_0xd640('0x42')][_0xd640('0x2a')]);_0x405580[_0xd640('0x2d')]=_['keys'](_0x2e26c5[_0xd640('0x2d')]);_0x405580['filters']=_[_0xd640('0x2f')](_0x405580['model'],_0x405580['query']);_0xc40a83['attributes']=_[_0xd640('0x2f')](_0x405580[_0xd640('0x30')],qs['fields'](_0x2e26c5[_0xd640('0x2d')]['fields']));_0xc40a83['attributes']=_0xc40a83[_0xd640('0x31')][_0xd640('0x33')]?_0xc40a83['attributes']:_0x405580[_0xd640('0x30')];if(_0x2e26c5[_0xd640('0x2d')][_0xd640('0x40')]){_0xc40a83['include']=[{'all':!![]}];}_0xc40a83=_[_0xd640('0x3c')]({},_0xc40a83,_0x2e26c5[_0xd640('0x3f')]);return db[_0xd640('0x42')][_0xd640('0x47')](_0xc40a83)[_0xd640('0x23')](handleEntityNotFound(_0x39d760,null))['then'](respondWithResult(_0x39d760,null))['catch'](handleError(_0x39d760,null));};exports[_0xd640('0x48')]=function(_0x2c139a,_0x253b00){return db[_0xd640('0x42')][_0xd640('0x48')](_0x2c139a[_0xd640('0x49')],{})['then'](respondWithResult(_0x253b00,0xc9))[_0xd640('0x45')](handleError(_0x253b00,null));};exports[_0xd640('0x22')]=function(_0x3e8c8a,_0x366a0f){if(_0x3e8c8a[_0xd640('0x49')]['id']){delete _0x3e8c8a[_0xd640('0x49')]['id'];}return db[_0xd640('0x42')][_0xd640('0x47')]({'where':{'id':_0x3e8c8a[_0xd640('0x4a')]['id']}})['then'](handleEntityNotFound(_0x366a0f,null))[_0xd640('0x23')](saveUpdates(_0x3e8c8a[_0xd640('0x49')],null))['then'](respondWithResult(_0x366a0f,null))['catch'](handleError(_0x366a0f,null));};exports[_0xd640('0x24')]=function(_0x4432fe,_0x2921ac){return db[_0xd640('0x42')][_0xd640('0x47')]({'where':{'id':_0x4432fe[_0xd640('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2921ac,null))[_0xd640('0x23')](removeEntity(_0x2921ac,null))[_0xd640('0x45')](handleError(_0x2921ac,null));};exports[_0xd640('0x4b')]=function(_0x5c76be,_0x5a8537,_0x43c705){var _0x3d9f2e={};var _0x5c76fb={};var _0x2b877d;var _0x497ff1;return db['ZohoAccount']['findOne']({'where':{'id':_0x5c76be[_0xd640('0x4a')]['id']}})[_0xd640('0x23')](handleEntityNotFound(_0x5a8537,null))[_0xd640('0x23')](function(_0x1cd638){if(_0x1cd638){_0x2b877d=_0x1cd638;_0x5c76fb['model']=_['keys'](db['ZohoConfiguration'][_0xd640('0x2a')]);_0x5c76fb['query']=_[_0xd640('0x2e')](_0x5c76be[_0xd640('0x2d')]);_0x5c76fb[_0xd640('0x39')]=_[_0xd640('0x2f')](_0x5c76fb[_0xd640('0x30')],_0x5c76fb[_0xd640('0x2d')]);_0x3d9f2e[_0xd640('0x31')]=_[_0xd640('0x2f')](_0x5c76fb[_0xd640('0x30')],qs[_0xd640('0x32')](_0x5c76be['query'][_0xd640('0x32')]));_0x3d9f2e['attributes']=_0x3d9f2e[_0xd640('0x31')]['length']?_0x3d9f2e[_0xd640('0x31')]:_0x5c76fb[_0xd640('0x30')];_0x3d9f2e[_0xd640('0x36')]=qs[_0xd640('0x37')](_0x5c76be[_0xd640('0x2d')][_0xd640('0x37')]);_0x3d9f2e[_0xd640('0x38')]=qs[_0xd640('0x39')](_[_0xd640('0x3a')](_0x5c76be[_0xd640('0x2d')],_0x5c76fb[_0xd640('0x39')]));if(_0x5c76be[_0xd640('0x2d')][_0xd640('0x3b')]){_0x3d9f2e['where']=_[_0xd640('0x3c')](_0x3d9f2e[_0xd640('0x38')],{'$or':_[_0xd640('0x29')](_0x3d9f2e[_0xd640('0x31')],function(_0x2bac2c){var _0x4ce958={};_0x4ce958[_0x2bac2c]={'$like':'%'+_0x5c76be[_0xd640('0x2d')][_0xd640('0x3b')]+'%'};return _0x4ce958;})});}_0x3d9f2e=_[_0xd640('0x3c')]({},_0x3d9f2e,_0x5c76be['options']);return _0x2b877d[_0xd640('0x4b')](_0x3d9f2e);}})[_0xd640('0x23')](function(_0x3a2669){if(_0x3a2669){_0x497ff1=_0x3a2669['length'];if(!_0x5c76be[_0xd640('0x2d')][_0xd640('0x34')](_0xd640('0x35'))){_0x3d9f2e['limit']=qs[_0xd640('0x1d')](_0x5c76be['query']['limit']);_0x3d9f2e['offset']=qs[_0xd640('0x1a')](_0x5c76be[_0xd640('0x2d')][_0xd640('0x1a')]);}return _0x2b877d[_0xd640('0x4b')](_0x3d9f2e);}})[_0xd640('0x23')](function(_0x56970d){if(_0x56970d){return _0x56970d?{'count':_0x497ff1,'rows':_0x56970d}:null;}})[_0xd640('0x23')](respondWithResult(_0x5a8537,null))[_0xd640('0x45')](handleError(_0x5a8537,null));};exports['addConfiguration']=function(_0x370dd9,_0x7dd60a,_0xa1fdcb){if(_0x370dd9[_0xd640('0x49')]['id']){delete _0x370dd9[_0xd640('0x49')]['id'];}return db[_0xd640('0x42')]['findOne']({'where':{'id':_0x370dd9[_0xd640('0x4a')]['id']}})[_0xd640('0x23')](handleEntityNotFound(_0x7dd60a,null))[_0xd640('0x23')](function(_0x21ad98){if(_0x21ad98){_0x370dd9[_0xd640('0x49')][_0xd640('0x4c')]=_0x21ad98['id'];_0x370dd9[_0xd640('0x49')][_0xd640('0x4d')]=integrations[_0xd640('0x4e')](_0x370dd9['body']['channel'],_0x370dd9[_0xd640('0x49')][_0xd640('0x3d')]);_0x370dd9['body'][_0xd640('0x4f')]=integrations[_0xd640('0x50')](_0x370dd9['body'][_0xd640('0x51')],_0x370dd9[_0xd640('0x49')][_0xd640('0x3d')]);return db[_0xd640('0x52')][_0xd640('0x48')](_0x370dd9[_0xd640('0x49')],{'include':[{'model':db['ZohoField'],'as':_0xd640('0x4d')},{'model':db[_0xd640('0x53')],'as':_0xd640('0x4f')}]});}return null;})[_0xd640('0x23')](respondWithResult(_0x7dd60a,null))[_0xd640('0x45')](handleError(_0x7dd60a,null));};function getAccessToken(_0x38f360){return new Promise(function(_0x2e6edb,_0x1d6007){var _0x12f969;switch(_0x38f360[_0xd640('0x54')]){case'US':_0x12f969='https://accounts.zoho.com';break;case'AU':_0x12f969='https://accounts.zoho.com.au';break;case'EU':_0x12f969=_0xd640('0x55');break;case'IN':_0x12f969=_0xd640('0x56');break;case'CN':_0x12f969='https://accounts.zoho.com.cn';break;default:_0x12f969=_0xd640('0x55');break;}var _0x679700={'method':_0xd640('0x57'),'uri':_0x12f969+'/oauth/v2/token','qs':{'refresh_token':_0x38f360[_0xd640('0x58')],'client_id':_0x38f360[_0xd640('0x59')],'client_secret':_0x38f360[_0xd640('0x5a')],'grant_type':_0xd640('0x5b')},'json':!![]};return rp(_0x679700)[_0xd640('0x23')](function(_0x835142){if(_0x835142[_0xd640('0x5c')]){_0x2e6edb(_0x835142[_0xd640('0x5c')]);}else{_0x1d6007(_0xd640('0x5d'));}})[_0xd640('0x45')](function(_0x28516c){_0x1d6007(_0x28516c);});});}exports['getFields']=function(_0x1e3d45,_0x2fed2f,_0x49d191){var _0x3ce8c6,_0x4450ab,_0x22657c,_0x22b139,_0x29f43d;return db[_0xd640('0x42')][_0xd640('0x5e')]({'where':{'id':_0x1e3d45['params']['id']},'attributes':['id',_0xd640('0x5f'),_0xd640('0x54'),'clientId','clientSecret',_0xd640('0x60'),_0xd640('0x61'),_0xd640('0x58')]})[_0xd640('0x23')](handleEntityNotFound(_0x2fed2f,null))[_0xd640('0x23')](function(_0x529bf6){_0x29f43d=_0x529bf6;_0x3ce8c6=_0x29f43d[_0xd640('0x5f')];_0x4450ab=_0x3ce8c6===_0xd640('0x62')?'eu':'com';_0x22657c=_0x29f43d['serverUrl'];var _0x52f46b=_0x22657c[_0xd640('0x63')](-0x1);if(_0x52f46b==='/'||_0x52f46b==='\x5c'||_0x52f46b===':'){_0x22657c=_0x22657c[_0xd640('0x64')](0x0,_0x22657c[_0xd640('0x65')](_0x52f46b));}if(!_0x29f43d[_0xd640('0x58')]){throw new Error(_0xd640('0x66'));}return getAccessToken(_0x29f43d);})[_0xd640('0x23')](function(_0x25830d){if(_0x25830d){return rp({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4450ab),'qs':{'module':_0xd640('0x67')},'headers':{'Authorization':_0xd640('0x68')+_0x25830d},'json':!![]});}})[_0xd640('0x23')](function(_0x2fc898){if(_0x2fc898){if(_0x2fc898[_0xd640('0x69')]&&_0x2fc898[_0xd640('0x69')][_0xd640('0x6a')]){throw new Error(_0x2fc898['response']['error'][_0xd640('0x6b')]);}var _0x2af029=[];var _0x59cf38=[];var _0x25e6a3=[_0xd640('0x6c'),_0xd640('0x6d'),'Description',_0xd640('0x6e'),'Call_Duration','Call_Result','Call_Start_Time',_0xd640('0x6f')];_0x59cf38=_[_0xd640('0x70')](_0x2fc898[_0xd640('0x32')],function(_0x414ed1){return _0x25e6a3[_0xd640('0x71')](_0x414ed1[_0xd640('0x72')]);});for(var _0x4086c1=0x0;_0x4086c1<_0x59cf38['length'];_0x4086c1++){if(_0x59cf38[_0x4086c1][_0xd640('0x73')]===![]){_0x2af029[_0xd640('0x74')]({'id':_0x59cf38[_0x4086c1]['id'],'name':_0x59cf38[_0x4086c1][_0xd640('0x75')],'custom':_0x59cf38[_0x4086c1]['custom_field'],'options':_0x59cf38[_0x4086c1][_0xd640('0x76')]===_0xd640('0x77')&&_0x59cf38[_0x4086c1]['pick_list_values'][_0xd640('0x33')]>-0x1?_[_0xd640('0x29')](_0x59cf38[_0x4086c1][_0xd640('0x78')],function(_0x1cb0c1){return{'name':_0x1cb0c1,'value':_0x1cb0c1};}):[]});}}return{'count':_0x2af029[_0xd640('0x33')],'rows':_0x2af029};}else{return{'count':0x0,'rows':[]};}})[_0xd640('0x23')](respondWithResult(_0x2fed2f,null))[_0xd640('0x45')](function(_0x169590){var _0x164eef=_0x1e3d45[_0xd640('0x2d')][_0xd640('0x79')]?0x1f4:_0x169590[_0xd640('0x7a')]||0x1f4;logger[_0xd640('0x6a')](_0xd640('0x7b'),_0xd640('0x7c'),_0x164eef,JSON[_0xd640('0x7d')](_0x169590));delete _0x169590[_0xd640('0x27')];if(_0x164eef===0x191){_0x164eef=0x190;}_0x2fed2f['status'](_0x164eef)[_0xd640('0x7e')](_0x1e3d45[_0xd640('0x2d')][_0xd640('0x79')]?{'message':_0xd640('0x7f'),'statusCode':_0x169590['statusCode']}:_0x169590);});}; \ No newline at end of file +var _0x3d0d=['catch','params','intersection','create','body','find','getConfigurations','findOne','ZohoConfiguration','rawAttributes','pick','addConfiguration','AccountId','getSubjects','channel','ZohoField','zone','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','limit','count','offset','Content-Range','json','reject','save','update','then','error','name','send','index','map','ZohoAccount','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3d0d,0x1ab));var _0xd3d0=function(_0x3cda00,_0x561897){_0x3cda00=_0x3cda00-0x0;var _0x59ba22=_0x3d0d[_0x3cda00];return _0x59ba22;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd3d0('0x0'));var zipdir=require(_0xd3d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3d0('0x2'));var moment=require('moment');var BPromise=require(_0xd3d0('0x3'));var Mustache=require(_0xd3d0('0x4'));var util=require(_0xd3d0('0x5'));var path=require(_0xd3d0('0x6'));var sox=require(_0xd3d0('0x7'));var csv=require(_0xd3d0('0x8'));var ejs=require(_0xd3d0('0x9'));var fs=require('fs');var fs_extra=require(_0xd3d0('0xa'));var _=require(_0xd3d0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd3d0('0xc'));var deskjs=require(_0xd3d0('0xd'));var toCsv=require(_0xd3d0('0x8'));var querystring=require(_0xd3d0('0xe'));var Papa=require(_0xd3d0('0xf'));var Redis=require(_0xd3d0('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd3d0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd3d0('0x12'))(_0xd3d0('0x13'));var utils=require(_0xd3d0('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd3d0('0x15'));function respondWithStatusCode(_0x9efe3b,_0x2122a0){_0x2122a0=_0x2122a0||0xcc;return function(_0x34e30c){if(_0x34e30c){return _0x9efe3b[_0xd3d0('0x16')](_0x2122a0);}return _0x9efe3b[_0xd3d0('0x17')](_0x2122a0)[_0xd3d0('0x18')]();};}function respondWithResult(_0x4ec3e2,_0x300aef){_0x300aef=_0x300aef||0xc8;return function(_0x3ad5cf){if(_0x3ad5cf){return _0x4ec3e2[_0xd3d0('0x17')](_0x300aef)['json'](_0x3ad5cf);}};}function respondWithFilteredResult(_0x17b8ca,_0x24b37c){return function(_0x4642e9){if(_0x4642e9){var _0x280e79=typeof _0x24b37c['offset']==='undefined'&&typeof _0x24b37c[_0xd3d0('0x19')]==='undefined';var _0xb0cffe=_0x4642e9[_0xd3d0('0x1a')];var _0x2706c2=_0x280e79?0x0:_0x24b37c[_0xd3d0('0x1b')];var _0x2eba9f=_0x280e79?_0x4642e9[_0xd3d0('0x1a')]:_0x24b37c['offset']+_0x24b37c[_0xd3d0('0x19')];var _0x55e488;if(_0x2eba9f>=_0xb0cffe){_0x2eba9f=_0xb0cffe;_0x55e488=0xc8;}else{_0x55e488=0xce;}_0x17b8ca[_0xd3d0('0x17')](_0x55e488);return _0x17b8ca['set'](_0xd3d0('0x1c'),_0x2706c2+'-'+_0x2eba9f+'/'+_0xb0cffe)[_0xd3d0('0x1d')](_0x4642e9);}return null;};}function patchUpdates(_0x22dcad){return function(_0x3d7254){try{jsonpatch['apply'](_0x3d7254,_0x22dcad,!![]);}catch(_0x501b75){return BPromise[_0xd3d0('0x1e')](_0x501b75);}return _0x3d7254[_0xd3d0('0x1f')]();};}function saveUpdates(_0x295a72,_0x302d53){return function(_0x8fd06e){if(_0x8fd06e){return _0x8fd06e[_0xd3d0('0x20')](_0x295a72)[_0xd3d0('0x21')](function(_0x30ed4d){return _0x30ed4d;});}return null;};}function removeEntity(_0x507533,_0x5e2661){return function(_0x59774d){if(_0x59774d){return _0x59774d['destroy']()[_0xd3d0('0x21')](function(){_0x507533[_0xd3d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ad5fb,_0x2eb9fc){return function(_0x1779b9){if(!_0x1779b9){_0x2ad5fb['sendStatus'](0x194);}return _0x1779b9;};}function handleError(_0x25a5a9,_0x1150be){_0x1150be=_0x1150be||0x1f4;return function(_0x6729d5){logger[_0xd3d0('0x22')](_0x6729d5['stack']);if(_0x6729d5['name']){delete _0x6729d5[_0xd3d0('0x23')];}_0x25a5a9[_0xd3d0('0x17')](_0x1150be)[_0xd3d0('0x24')](_0x6729d5);};}exports[_0xd3d0('0x25')]=function(_0x1e9fc7,_0x7330c8){var _0x3cfb3c={},_0x50c9f3={},_0xfb85a4={'count':0x0,'rows':[]};var _0x4dee1f=_[_0xd3d0('0x26')](db[_0xd3d0('0x27')]['rawAttributes'],function(_0x54b9a0){return{'name':_0x54b9a0[_0xd3d0('0x28')],'type':_0x54b9a0['type'][_0xd3d0('0x29')]};});_0x50c9f3[_0xd3d0('0x2a')]=_[_0xd3d0('0x26')](_0x4dee1f,'name');_0x50c9f3[_0xd3d0('0x2b')]=_[_0xd3d0('0x2c')](_0x1e9fc7[_0xd3d0('0x2b')]);_0x50c9f3[_0xd3d0('0x2d')]=_['intersection'](_0x50c9f3[_0xd3d0('0x2a')],_0x50c9f3['query']);_0x3cfb3c['attributes']=_['intersection'](_0x50c9f3['model'],qs['fields'](_0x1e9fc7['query'][_0xd3d0('0x2e')]));_0x3cfb3c[_0xd3d0('0x2f')]=_0x3cfb3c['attributes'][_0xd3d0('0x30')]?_0x3cfb3c[_0xd3d0('0x2f')]:_0x50c9f3['model'];if(!_0x1e9fc7[_0xd3d0('0x2b')][_0xd3d0('0x31')](_0xd3d0('0x32'))){_0x3cfb3c[_0xd3d0('0x19')]=qs[_0xd3d0('0x19')](_0x1e9fc7['query'][_0xd3d0('0x19')]);_0x3cfb3c[_0xd3d0('0x1b')]=qs['offset'](_0x1e9fc7[_0xd3d0('0x2b')][_0xd3d0('0x1b')]);}_0x3cfb3c[_0xd3d0('0x33')]=qs[_0xd3d0('0x34')](_0x1e9fc7[_0xd3d0('0x2b')][_0xd3d0('0x34')]);_0x3cfb3c[_0xd3d0('0x35')]=qs[_0xd3d0('0x2d')](_['pick'](_0x1e9fc7[_0xd3d0('0x2b')],_0x50c9f3[_0xd3d0('0x2d')]),_0x4dee1f);if(_0x1e9fc7[_0xd3d0('0x2b')][_0xd3d0('0x36')]){_0x3cfb3c['where']=_[_0xd3d0('0x37')](_0x3cfb3c[_0xd3d0('0x35')],{'$or':_[_0xd3d0('0x26')](_0x4dee1f,function(_0x481e1d){if(_0x481e1d[_0xd3d0('0x38')]!==_0xd3d0('0x39')){var _0x318c55={};_0x318c55[_0x481e1d['name']]={'$like':'%'+_0x1e9fc7[_0xd3d0('0x2b')][_0xd3d0('0x36')]+'%'};return _0x318c55;}})});}_0x3cfb3c=_[_0xd3d0('0x37')]({},_0x3cfb3c,_0x1e9fc7[_0xd3d0('0x3a')]);var _0x3332da={'where':_0x3cfb3c[_0xd3d0('0x35')]};return db[_0xd3d0('0x27')][_0xd3d0('0x1a')](_0x3332da)[_0xd3d0('0x21')](function(_0x4ef380){_0xfb85a4[_0xd3d0('0x1a')]=_0x4ef380;if(_0x1e9fc7['query'][_0xd3d0('0x3b')]){_0x3cfb3c[_0xd3d0('0x3c')]=[{'all':!![]}];}return db[_0xd3d0('0x27')]['findAll'](_0x3cfb3c);})[_0xd3d0('0x21')](function(_0x596862){_0xfb85a4['rows']=_0x596862;return _0xfb85a4;})[_0xd3d0('0x21')](respondWithFilteredResult(_0x7330c8,_0x3cfb3c))[_0xd3d0('0x3d')](handleError(_0x7330c8,null));};exports['show']=function(_0x40f069,_0x46e52a){var _0x19b972={'raw':![],'where':{'id':_0x40f069[_0xd3d0('0x3e')]['id']}},_0x219ec1={};_0x219ec1[_0xd3d0('0x2a')]=_[_0xd3d0('0x2c')](db[_0xd3d0('0x27')]['rawAttributes']);_0x219ec1[_0xd3d0('0x2b')]=_[_0xd3d0('0x2c')](_0x40f069[_0xd3d0('0x2b')]);_0x219ec1[_0xd3d0('0x2d')]=_['intersection'](_0x219ec1[_0xd3d0('0x2a')],_0x219ec1[_0xd3d0('0x2b')]);_0x19b972[_0xd3d0('0x2f')]=_[_0xd3d0('0x3f')](_0x219ec1[_0xd3d0('0x2a')],qs[_0xd3d0('0x2e')](_0x40f069[_0xd3d0('0x2b')][_0xd3d0('0x2e')]));_0x19b972[_0xd3d0('0x2f')]=_0x19b972[_0xd3d0('0x2f')][_0xd3d0('0x30')]?_0x19b972[_0xd3d0('0x2f')]:_0x219ec1['model'];if(_0x40f069[_0xd3d0('0x2b')][_0xd3d0('0x3b')]){_0x19b972[_0xd3d0('0x3c')]=[{'all':!![]}];}_0x19b972=_[_0xd3d0('0x37')]({},_0x19b972,_0x40f069['options']);return db[_0xd3d0('0x27')]['find'](_0x19b972)[_0xd3d0('0x21')](handleEntityNotFound(_0x46e52a,null))['then'](respondWithResult(_0x46e52a,null))[_0xd3d0('0x3d')](handleError(_0x46e52a,null));};exports[_0xd3d0('0x40')]=function(_0x587f0a,_0x15fdf0){return db[_0xd3d0('0x27')][_0xd3d0('0x40')](_0x587f0a[_0xd3d0('0x41')],{})[_0xd3d0('0x21')](respondWithResult(_0x15fdf0,0xc9))['catch'](handleError(_0x15fdf0,null));};exports['update']=function(_0x92ee3c,_0x25e897){if(_0x92ee3c[_0xd3d0('0x41')]['id']){delete _0x92ee3c[_0xd3d0('0x41')]['id'];}return db['ZohoAccount'][_0xd3d0('0x42')]({'where':{'id':_0x92ee3c[_0xd3d0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x25e897,null))['then'](saveUpdates(_0x92ee3c[_0xd3d0('0x41')],null))[_0xd3d0('0x21')](respondWithResult(_0x25e897,null))[_0xd3d0('0x3d')](handleError(_0x25e897,null));};exports['destroy']=function(_0x35f7ab,_0x25f3c6){return db[_0xd3d0('0x27')][_0xd3d0('0x42')]({'where':{'id':_0x35f7ab[_0xd3d0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x25f3c6,null))[_0xd3d0('0x21')](removeEntity(_0x25f3c6,null))['catch'](handleError(_0x25f3c6,null));};exports[_0xd3d0('0x43')]=function(_0x4983c3,_0xa3757d,_0x3cdcff){var _0x2ce968={};var _0x24bf33={};var _0x5301f2;var _0x15a0de;return db[_0xd3d0('0x27')][_0xd3d0('0x44')]({'where':{'id':_0x4983c3[_0xd3d0('0x3e')]['id']}})[_0xd3d0('0x21')](handleEntityNotFound(_0xa3757d,null))[_0xd3d0('0x21')](function(_0x2a4bdb){if(_0x2a4bdb){_0x5301f2=_0x2a4bdb;_0x24bf33['model']=_[_0xd3d0('0x2c')](db[_0xd3d0('0x45')][_0xd3d0('0x46')]);_0x24bf33[_0xd3d0('0x2b')]=_[_0xd3d0('0x2c')](_0x4983c3[_0xd3d0('0x2b')]);_0x24bf33[_0xd3d0('0x2d')]=_[_0xd3d0('0x3f')](_0x24bf33['model'],_0x24bf33[_0xd3d0('0x2b')]);_0x2ce968[_0xd3d0('0x2f')]=_[_0xd3d0('0x3f')](_0x24bf33['model'],qs[_0xd3d0('0x2e')](_0x4983c3[_0xd3d0('0x2b')][_0xd3d0('0x2e')]));_0x2ce968[_0xd3d0('0x2f')]=_0x2ce968[_0xd3d0('0x2f')]['length']?_0x2ce968[_0xd3d0('0x2f')]:_0x24bf33[_0xd3d0('0x2a')];_0x2ce968[_0xd3d0('0x33')]=qs[_0xd3d0('0x34')](_0x4983c3[_0xd3d0('0x2b')]['sort']);_0x2ce968[_0xd3d0('0x35')]=qs[_0xd3d0('0x2d')](_[_0xd3d0('0x47')](_0x4983c3['query'],_0x24bf33[_0xd3d0('0x2d')]));if(_0x4983c3['query']['filter']){_0x2ce968['where']=_[_0xd3d0('0x37')](_0x2ce968[_0xd3d0('0x35')],{'$or':_[_0xd3d0('0x26')](_0x2ce968[_0xd3d0('0x2f')],function(_0x4e50ba){var _0x160bfe={};_0x160bfe[_0x4e50ba]={'$like':'%'+_0x4983c3['query'][_0xd3d0('0x36')]+'%'};return _0x160bfe;})});}_0x2ce968=_[_0xd3d0('0x37')]({},_0x2ce968,_0x4983c3['options']);return _0x5301f2[_0xd3d0('0x43')](_0x2ce968);}})['then'](function(_0x369927){if(_0x369927){_0x15a0de=_0x369927['length'];if(!_0x4983c3['query'][_0xd3d0('0x31')](_0xd3d0('0x32'))){_0x2ce968[_0xd3d0('0x19')]=qs[_0xd3d0('0x19')](_0x4983c3['query'][_0xd3d0('0x19')]);_0x2ce968[_0xd3d0('0x1b')]=qs['offset'](_0x4983c3[_0xd3d0('0x2b')][_0xd3d0('0x1b')]);}return _0x5301f2[_0xd3d0('0x43')](_0x2ce968);}})[_0xd3d0('0x21')](function(_0x34fb95){if(_0x34fb95){return _0x34fb95?{'count':_0x15a0de,'rows':_0x34fb95}:null;}})[_0xd3d0('0x21')](respondWithResult(_0xa3757d,null))['catch'](handleError(_0xa3757d,null));};exports[_0xd3d0('0x48')]=function(_0x1774a0,_0x9fabc1,_0x1d0d3f){if(_0x1774a0['body']['id']){delete _0x1774a0[_0xd3d0('0x41')]['id'];}return db[_0xd3d0('0x27')][_0xd3d0('0x44')]({'where':{'id':_0x1774a0[_0xd3d0('0x3e')]['id']}})[_0xd3d0('0x21')](handleEntityNotFound(_0x9fabc1,null))[_0xd3d0('0x21')](function(_0x451574){if(_0x451574){_0x1774a0[_0xd3d0('0x41')][_0xd3d0('0x49')]=_0x451574['id'];_0x1774a0[_0xd3d0('0x41')]['Subjects']=integrations[_0xd3d0('0x4a')](_0x1774a0[_0xd3d0('0x41')][_0xd3d0('0x4b')],_0x1774a0[_0xd3d0('0x41')][_0xd3d0('0x38')]);_0x1774a0['body']['Descriptions']=integrations['getDescriptions'](_0x1774a0[_0xd3d0('0x41')][_0xd3d0('0x4b')],_0x1774a0[_0xd3d0('0x41')]['type']);return db['ZohoConfiguration'][_0xd3d0('0x40')](_0x1774a0[_0xd3d0('0x41')],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xd3d0('0x4c')],'as':'Descriptions'}]});}return null;})[_0xd3d0('0x21')](respondWithResult(_0x9fabc1,null))[_0xd3d0('0x3d')](handleError(_0x9fabc1,null));};function getAccessToken(_0x4de71d){return new Promise(function(_0x5b79ed,_0x536870){var _0x521ae3;switch(_0x4de71d[_0xd3d0('0x4d')]){case'US':_0x521ae3='https://accounts.zoho.com';break;case'AU':_0x521ae3=_0xd3d0('0x4e');break;case'EU':_0x521ae3='https://accounts.zoho.eu';break;case'IN':_0x521ae3='https://accounts.zoho.in';break;case'CN':_0x521ae3=_0xd3d0('0x4f');break;default:_0x521ae3=_0xd3d0('0x50');break;}var _0x4b83e2={'method':_0xd3d0('0x51'),'uri':_0x521ae3+_0xd3d0('0x52'),'qs':{'refresh_token':_0x4de71d[_0xd3d0('0x53')],'client_id':_0x4de71d[_0xd3d0('0x54')],'client_secret':_0x4de71d[_0xd3d0('0x55')],'grant_type':_0xd3d0('0x56')},'json':!![]};return rp(_0x4b83e2)[_0xd3d0('0x21')](function(_0x4c1619){if(_0x4c1619[_0xd3d0('0x57')]){_0x5b79ed(_0x4c1619[_0xd3d0('0x57')]);}else{_0x536870(_0xd3d0('0x58'));}})[_0xd3d0('0x3d')](function(_0x15e066){_0x536870(_0x15e066);});});}exports[_0xd3d0('0x59')]=function(_0x115f77,_0x31a4d2,_0xb897c2){var _0x544055,_0x3217ee,_0xe24d0d,_0x478c3,_0x2ac2b0;return db[_0xd3d0('0x27')]['findOne']({'where':{'id':_0x115f77[_0xd3d0('0x3e')]['id']},'attributes':['id',_0xd3d0('0x5a'),'zone',_0xd3d0('0x54'),_0xd3d0('0x55'),_0xd3d0('0x5b'),_0xd3d0('0x5c'),_0xd3d0('0x53')]})[_0xd3d0('0x21')](handleEntityNotFound(_0x31a4d2,null))[_0xd3d0('0x21')](function(_0x59b992){_0x2ac2b0=_0x59b992;_0x544055=_0x2ac2b0[_0xd3d0('0x5a')];_0x3217ee=_0x544055===_0xd3d0('0x5d')?'eu':'com';_0xe24d0d=_0x2ac2b0[_0xd3d0('0x5b')];var _0x5eee35=_0xe24d0d[_0xd3d0('0x5e')](-0x1);if(_0x5eee35==='/'||_0x5eee35==='\x5c'||_0x5eee35===':'){_0xe24d0d=_0xe24d0d[_0xd3d0('0x5f')](0x0,_0xe24d0d['lastIndexOf'](_0x5eee35));}if(!_0x2ac2b0[_0xd3d0('0x53')]){throw new Error(_0xd3d0('0x60'));}return getAccessToken(_0x2ac2b0);})[_0xd3d0('0x21')](function(_0x443eef){if(_0x443eef){return rp({'method':_0xd3d0('0x61'),'uri':util['format'](_0xd3d0('0x62'),_0x3217ee),'qs':{'module':_0xd3d0('0x63')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x443eef},'json':!![]});}})[_0xd3d0('0x21')](function(_0x55c67f){if(_0x55c67f){if(_0x55c67f[_0xd3d0('0x64')]&&_0x55c67f[_0xd3d0('0x64')]['error']){throw new Error(_0x55c67f[_0xd3d0('0x64')][_0xd3d0('0x22')][_0xd3d0('0x65')]);}var _0x4c970e=[];var _0x5a3286=[];var _0x579350=[_0xd3d0('0x66'),_0xd3d0('0x67'),_0xd3d0('0x68'),_0xd3d0('0x69'),_0xd3d0('0x6a'),_0xd3d0('0x6b'),_0xd3d0('0x6c'),_0xd3d0('0x6d')];_0x5a3286=_['remove'](_0x55c67f[_0xd3d0('0x2e')],function(_0x486369){return _0x579350[_0xd3d0('0x6e')](_0x486369[_0xd3d0('0x6f')]);});for(var _0xa02d24=0x0;_0xa02d24<_0x5a3286[_0xd3d0('0x30')];_0xa02d24++){if(_0x5a3286[_0xa02d24][_0xd3d0('0x70')]===![]){_0x4c970e[_0xd3d0('0x71')]({'id':_0x5a3286[_0xa02d24]['id'],'name':_0x5a3286[_0xa02d24][_0xd3d0('0x72')],'custom':_0x5a3286[_0xa02d24]['custom_field'],'options':_0x5a3286[_0xa02d24]['data_type']===_0xd3d0('0x73')&&_0x5a3286[_0xa02d24][_0xd3d0('0x74')][_0xd3d0('0x30')]>-0x1?_[_0xd3d0('0x26')](_0x5a3286[_0xa02d24]['pick_list_values'],function(_0x597eeb){return{'name':_0x597eeb,'value':_0x597eeb};}):[]});}}return{'count':_0x4c970e[_0xd3d0('0x30')],'rows':_0x4c970e};}else{return{'count':0x0,'rows':[]};}})[_0xd3d0('0x21')](respondWithResult(_0x31a4d2,null))['catch'](function(_0x563f08){var _0x5b9b48=_0x115f77[_0xd3d0('0x2b')][_0xd3d0('0x75')]?0x1f4:_0x563f08['statusCode']||0x1f4;logger[_0xd3d0('0x22')](_0xd3d0('0x76'),'getFields',_0x5b9b48,JSON[_0xd3d0('0x77')](_0x563f08));delete _0x563f08[_0xd3d0('0x23')];if(_0x5b9b48===0x191){_0x5b9b48=0x190;}_0x31a4d2['status'](_0x5b9b48)[_0xd3d0('0x24')](_0x115f77[_0xd3d0('0x2b')][_0xd3d0('0x75')]?{'message':_0xd3d0('0x78'),'statusCode':_0x563f08[_0xd3d0('0x79')]}:_0x563f08);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 27cc920..b1d9de6 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 _0x588b=['info','format','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','https://accounts.zoho.eu','authorization_code','refreshToken','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','define','ZohoAccount','zone','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x588b,0x122));var _0xb588=function(_0x352fdd,_0x3a4118){_0x352fdd=_0x352fdd-0x0;var _0x1a0bac=_0x588b[_0x352fdd];return _0x1a0bac;};'use strict';var _=require(_0xb588('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb588('0x1'));var moment=require(_0xb588('0x2'));var BPromise=require(_0xb588('0x3'));var rp=require(_0xb588('0x4'));var fs=require('fs');var path=require(_0xb588('0x5'));var rimraf=require(_0xb588('0x6'));var config=require(_0xb588('0x7'));var attributes=require(_0xb588('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5530bc,_0x191c56){return _0x5530bc[_0xb588('0x9')](_0xb588('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x55e6ac,_0x4eb8ff,_0x3b509c){if(_0x55e6ac['changed'](_0xb588('0xb'))||_0x55e6ac[_0xb588('0xc')](_0xb588('0xd'))||_0x55e6ac['changed'](_0xb588('0xe'))||_0x55e6ac[_0xb588('0xc')](_0xb588('0xf'))||_0x55e6ac[_0xb588('0xc')](_0xb588('0x10'))||_0x55e6ac[_0xb588('0xc')](_0xb588('0x11'))){var _0x2c3a19,_0x58ee33;_0x2c3a19=_0x55e6ac['serverUrl'];var _0x1de484=_0x2c3a19[_0xb588('0x12')](-0x1);if(_0x1de484==='/'||_0x1de484==='\x5c'||_0x1de484===':'){_0x2c3a19=_0x2c3a19[_0xb588('0x13')](0x0,_0x2c3a19['lastIndexOf'](_0x1de484));}switch(_0x55e6ac['zone']){case'US':_0x58ee33=_0xb588('0x14');break;case'AU':_0x58ee33=_0xb588('0x15');break;case'IN':_0x58ee33=_0xb588('0x16');break;case'CN':_0x58ee33=_0xb588('0x17');break;default:_0x58ee33='https://accounts.zoho.eu';break;}var _0x18d461={'method':_0xb588('0x18'),'uri':_0x58ee33+_0xb588('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x55e6ac[_0xb588('0xe')],'client_secret':_0x55e6ac['clientSecret'],'redirect_uri':_0x55e6ac['serverUrl'],'code':_0x55e6ac[_0xb588('0x10')]},'headers':{'Content-Type':_0xb588('0x1a')}};return rp(_0x18d461)[_0xb588('0x1b')](function(_0x44d25d){var _0x26e593=JSON[_0xb588('0x1c')](_0x44d25d);if(_0x26e593[_0xb588('0x1d')]){_0x55e6ac['refreshToken']=_0x26e593[_0xb588('0x1d')];logger[_0xb588('0x1e')](util[_0xb588('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x55e6ac[_0xb588('0x20')],_0x55e6ac['id']));}else{logger[_0xb588('0x21')](util[_0xb588('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x55e6ac[_0xb588('0x20')],_0x55e6ac['id']),util[_0xb588('0x22')](_0x26e593,{'showHidden':![],'depth':null}));}return _0x3b509c(null,_0x4eb8ff);})[_0xb588('0x23')](function(_0x280af5){logger[_0xb588('0x21')](util[_0xb588('0x1f')](_0xb588('0x24'),_0x55e6ac[_0xb588('0x20')],_0x55e6ac['id']),util[_0xb588('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x3b509c(_0x280af5);});}else{return _0x3b509c(null,_0x4eb8ff);}},'beforeUpdate':function(_0x487b85,_0x176fc5,_0x124fcd){if(_0x487b85[_0xb588('0xc')](_0xb588('0xb'))||_0x487b85[_0xb588('0xc')]('serverUrl')||_0x487b85['changed']('clientId')||_0x487b85[_0xb588('0xc')]('clientSecret')||_0x487b85[_0xb588('0xc')](_0xb588('0x10'))||_0x487b85[_0xb588('0xc')](_0xb588('0x11'))){var _0x206e5e,_0x4ba7c5;_0x206e5e=_0x487b85[_0xb588('0xd')];var _0x1a6e5a=_0x206e5e['slice'](-0x1);if(_0x1a6e5a==='/'||_0x1a6e5a==='\x5c'||_0x1a6e5a===':'){_0x206e5e=_0x206e5e[_0xb588('0x13')](0x0,_0x206e5e['lastIndexOf'](_0x1a6e5a));}switch(_0x487b85[_0xb588('0xb')]){case'US':_0x4ba7c5=_0xb588('0x14');break;case'AU':_0x4ba7c5=_0xb588('0x15');break;case'IN':_0x4ba7c5='https://accounts.zoho.in';break;case'CN':_0x4ba7c5='https://accounts.zoho.com.cn';break;default:_0x4ba7c5=_0xb588('0x25');break;}var _0x3f345d={'method':_0xb588('0x18'),'uri':_0x4ba7c5+_0xb588('0x19'),'form':{'grant_type':_0xb588('0x26'),'client_id':_0x487b85[_0xb588('0xe')],'client_secret':_0x487b85['clientSecret'],'redirect_uri':_0x487b85[_0xb588('0xd')],'code':_0x487b85['code']},'headers':{'Content-Type':_0xb588('0x1a')}};return rp(_0x3f345d)['then'](function(_0x157522){var _0xee6374=JSON[_0xb588('0x1c')](_0x157522);if(_0xee6374[_0xb588('0x1d')]){_0x487b85[_0xb588('0x27')]=_0xee6374[_0xb588('0x1d')];logger[_0xb588('0x1e')](util[_0xb588('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x487b85[_0xb588('0x20')],_0x487b85['id']));}else{logger['error'](util[_0xb588('0x1f')](_0xb588('0x24'),_0x487b85[_0xb588('0x20')],_0x487b85['id']),util[_0xb588('0x22')](_0xee6374,{'showHidden':![],'depth':null}));}return _0x124fcd(null,_0x176fc5);})[_0xb588('0x23')](function(_0x493df8){logger[_0xb588('0x21')](util[_0xb588('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x487b85['name'],_0x487b85['id']),util[_0xb588('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x124fcd(_0x493df8);});}else{return _0x124fcd(null,_0x176fc5);}}}});}; \ No newline at end of file +var _0x6efc=['then','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','host','substring','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','info','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','clientSecret','code','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','/oauth/v2/token','clientId','serverUrl','application/x-www-form-urlencoded'];(function(_0x21253b,_0x2dab16){var _0x1302f9=function(_0x339722){while(--_0x339722){_0x21253b['push'](_0x21253b['shift']());}};_0x1302f9(++_0x2dab16);}(_0x6efc,0x14c));var _0xc6ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6efc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xc6ef('0x0'));var logger=require(_0xc6ef('0x1'))(_0xc6ef('0x2'));var moment=require(_0xc6ef('0x3'));var BPromise=require(_0xc6ef('0x4'));var rp=require(_0xc6ef('0x5'));var fs=require('fs');var path=require(_0xc6ef('0x6'));var rimraf=require(_0xc6ef('0x7'));var config=require(_0xc6ef('0x8'));var attributes=require(_0xc6ef('0x9'));var integrations=require(_0xc6ef('0xa'));module[_0xc6ef('0xb')]=function(_0x21ea7b,_0x5181dd){return _0x21ea7b[_0xc6ef('0xc')](_0xc6ef('0xd'),attributes,{'tableName':_0xc6ef('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x7e8f8e,_0x38ed47,_0x210cdc){if(_0x7e8f8e['changed'](_0xc6ef('0xf'))||_0x7e8f8e[_0xc6ef('0x10')]('serverUrl')||_0x7e8f8e[_0xc6ef('0x10')]('clientId')||_0x7e8f8e[_0xc6ef('0x10')](_0xc6ef('0x11'))||_0x7e8f8e[_0xc6ef('0x10')](_0xc6ef('0x12'))||_0x7e8f8e[_0xc6ef('0x10')]('host')){var _0x5968a4,_0x191a6d;_0x5968a4=_0x7e8f8e['serverUrl'];var _0x16f6cb=_0x5968a4[_0xc6ef('0x13')](-0x1);if(_0x16f6cb==='/'||_0x16f6cb==='\x5c'||_0x16f6cb===':'){_0x5968a4=_0x5968a4['substring'](0x0,_0x5968a4[_0xc6ef('0x14')](_0x16f6cb));}switch(_0x7e8f8e[_0xc6ef('0xf')]){case'US':_0x191a6d=_0xc6ef('0x15');break;case'AU':_0x191a6d=_0xc6ef('0x16');break;case'IN':_0x191a6d=_0xc6ef('0x17');break;case'CN':_0x191a6d='https://accounts.zoho.com.cn';break;default:_0x191a6d='https://accounts.zoho.eu';break;}var _0x3c5b13={'method':'POST','uri':_0x191a6d+_0xc6ef('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x7e8f8e[_0xc6ef('0x19')],'client_secret':_0x7e8f8e[_0xc6ef('0x11')],'redirect_uri':_0x7e8f8e[_0xc6ef('0x1a')],'code':_0x7e8f8e['code']},'headers':{'Content-Type':_0xc6ef('0x1b')}};return rp(_0x3c5b13)[_0xc6ef('0x1c')](function(_0x505235){var _0x4b0970=JSON[_0xc6ef('0x1d')](_0x505235);if(_0x4b0970[_0xc6ef('0x1e')]){_0x7e8f8e[_0xc6ef('0x1f')]=_0x4b0970[_0xc6ef('0x1e')];logger['info'](util[_0xc6ef('0x20')](_0xc6ef('0x21'),_0x7e8f8e[_0xc6ef('0x22')],_0x7e8f8e['id']));}else{logger[_0xc6ef('0x23')](util[_0xc6ef('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x7e8f8e['name'],_0x7e8f8e['id']),util[_0xc6ef('0x24')](_0x4b0970,{'showHidden':![],'depth':null}));}return _0x210cdc(null,_0x38ed47);})[_0xc6ef('0x25')](function(_0x3cdc28){logger[_0xc6ef('0x23')](util[_0xc6ef('0x20')](_0xc6ef('0x26'),_0x7e8f8e[_0xc6ef('0x22')],_0x7e8f8e['id']),util[_0xc6ef('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x210cdc(_0x3cdc28);});}else{return _0x210cdc(null,_0x38ed47);}},'beforeUpdate':function(_0x70b158,_0x572969,_0x399780){if(_0x70b158[_0xc6ef('0x10')]('zone')||_0x70b158[_0xc6ef('0x10')](_0xc6ef('0x1a'))||_0x70b158['changed'](_0xc6ef('0x19'))||_0x70b158['changed']('clientSecret')||_0x70b158[_0xc6ef('0x10')](_0xc6ef('0x12'))||_0x70b158['changed'](_0xc6ef('0x27'))){var _0x529d9b,_0x34b145;_0x529d9b=_0x70b158[_0xc6ef('0x1a')];var _0x2f6f80=_0x529d9b[_0xc6ef('0x13')](-0x1);if(_0x2f6f80==='/'||_0x2f6f80==='\x5c'||_0x2f6f80===':'){_0x529d9b=_0x529d9b[_0xc6ef('0x28')](0x0,_0x529d9b[_0xc6ef('0x14')](_0x2f6f80));}switch(_0x70b158[_0xc6ef('0xf')]){case'US':_0x34b145=_0xc6ef('0x15');break;case'AU':_0x34b145=_0xc6ef('0x16');break;case'IN':_0x34b145=_0xc6ef('0x17');break;case'CN':_0x34b145=_0xc6ef('0x29');break;default:_0x34b145=_0xc6ef('0x2a');break;}var _0x45b9cc={'method':_0xc6ef('0x2b'),'uri':_0x34b145+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x70b158[_0xc6ef('0x19')],'client_secret':_0x70b158[_0xc6ef('0x11')],'redirect_uri':_0x70b158[_0xc6ef('0x1a')],'code':_0x70b158[_0xc6ef('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x45b9cc)[_0xc6ef('0x1c')](function(_0x28ccef){var _0x4af188=JSON[_0xc6ef('0x1d')](_0x28ccef);if(_0x4af188[_0xc6ef('0x1e')]){_0x70b158['refreshToken']=_0x4af188[_0xc6ef('0x1e')];logger[_0xc6ef('0x2c')](util[_0xc6ef('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x70b158[_0xc6ef('0x22')],_0x70b158['id']));}else{logger[_0xc6ef('0x23')](util[_0xc6ef('0x20')](_0xc6ef('0x26'),_0x70b158[_0xc6ef('0x22')],_0x70b158['id']),util[_0xc6ef('0x24')](_0x4af188,{'showHidden':![],'depth':null}));}return _0x399780(null,_0x572969);})['catch'](function(_0x54c81f){logger['error'](util[_0xc6ef('0x20')](_0xc6ef('0x26'),_0x70b158[_0xc6ef('0x22')],_0x70b158['id']),util[_0xc6ef('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x399780(_0x54c81f);});}else{return _0x399780(null,_0x572969);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index dca431c..f8a5293 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 _0x5f7b=['GetZohoAccount','stringify','catch','ShowZohoAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','ZohoAccount','findAll','options','raw','attributes','limit','map','include','model'];(function(_0x50f738,_0x1f0cef){var _0x4950fa=function(_0x2285ba){while(--_0x2285ba){_0x50f738['push'](_0x50f738['shift']());}};_0x4950fa(++_0x1f0cef);}(_0x5f7b,0x14a));var _0xb5f7=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5f7b[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xb5f7('0x0'));var util=require(_0xb5f7('0x1'));var moment=require('moment');var BPromise=require(_0xb5f7('0x2'));var rs=require(_0xb5f7('0x3'));var fs=require('fs');var Redis=require(_0xb5f7('0x4'));var db=require(_0xb5f7('0x5'))['db'];var utils=require(_0xb5f7('0x6'));var logger=require(_0xb5f7('0x7'))(_0xb5f7('0x8'));var config=require('../../config/environment');var jayson=require(_0xb5f7('0x9'));var client=jayson['client'][_0xb5f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x725cc9,_0x580816,_0x3087a5){return new BPromise(function(_0x2d49ba,_0x4e09dd){return client[_0xb5f7('0xb')](_0x725cc9,_0x3087a5)[_0xb5f7('0xc')](function(_0x1b04ee){logger[_0xb5f7('0xd')](_0xb5f7('0xe'),_0x580816,_0xb5f7('0xf'));logger[_0xb5f7('0x10')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x580816,_0xb5f7('0xf'),JSON['stringify'](_0x1b04ee));if(_0x1b04ee['error']){if(_0x1b04ee[_0xb5f7('0x11')][_0xb5f7('0x12')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x580816,_0x1b04ee[_0xb5f7('0x11')][_0xb5f7('0x13')]);return _0x4e09dd(_0x1b04ee[_0xb5f7('0x11')][_0xb5f7('0x13')]);}logger[_0xb5f7('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x580816,_0x1b04ee[_0xb5f7('0x11')][_0xb5f7('0x13')]);return _0x2d49ba(_0x1b04ee[_0xb5f7('0x11')][_0xb5f7('0x13')]);}else{logger[_0xb5f7('0xd')](_0xb5f7('0xe'),_0x580816,'request\x20sent');_0x2d49ba(_0x1b04ee[_0xb5f7('0x14')][_0xb5f7('0x13')]);}})['catch'](function(_0x45e8c2){logger[_0xb5f7('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x580816,_0x45e8c2);_0x4e09dd(_0x45e8c2);});});}exports['GetZohoAccount']=function(_0x286b7f){var _0x23e296=this;return new Promise(function(_0x48215b,_0xa96416){return db[_0xb5f7('0x15')][_0xb5f7('0x16')]({'raw':_0x286b7f[_0xb5f7('0x17')]?_0x286b7f[_0xb5f7('0x17')][_0xb5f7('0x18')]===undefined?!![]:![]:!![],'where':_0x286b7f[_0xb5f7('0x17')]?_0x286b7f[_0xb5f7('0x17')]['where']||null:null,'attributes':_0x286b7f[_0xb5f7('0x17')]?_0x286b7f[_0xb5f7('0x17')][_0xb5f7('0x19')]||null:null,'limit':_0x286b7f[_0xb5f7('0x17')]?_0x286b7f[_0xb5f7('0x17')][_0xb5f7('0x1a')]||null:null,'include':_0x286b7f['options']?_0x286b7f[_0xb5f7('0x17')]['include']?_[_0xb5f7('0x1b')](_0x286b7f[_0xb5f7('0x17')]['include'],function(_0x1176fa){return{'model':db[_0x1176fa['model']],'as':_0x1176fa['as'],'attributes':_0x1176fa[_0xb5f7('0x19')],'include':_0x1176fa[_0xb5f7('0x1c')]?_[_0xb5f7('0x1b')](_0x1176fa['include'],function(_0x6aacf5){return{'model':db[_0x6aacf5[_0xb5f7('0x1d')]],'as':_0x6aacf5['as'],'attributes':_0x6aacf5['attributes'],'include':_0x6aacf5[_0xb5f7('0x1c')]?_[_0xb5f7('0x1b')](_0x6aacf5[_0xb5f7('0x1c')],function(_0x2e0299){return{'model':db[_0x2e0299[_0xb5f7('0x1d')]],'as':_0x2e0299['as'],'attributes':_0x2e0299['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c4d35){logger[_0xb5f7('0xd')](_0xb5f7('0x1e'),_0x286b7f);logger[_0xb5f7('0x10')](_0xb5f7('0x1e'),_0x286b7f,JSON[_0xb5f7('0x1f')](_0x2c4d35));_0x48215b(_0x2c4d35);})[_0xb5f7('0x20')](function(_0x4b9575){logger[_0xb5f7('0x11')](_0xb5f7('0x1e'),_0x4b9575[_0xb5f7('0x13')],_0x286b7f);_0xa96416(_0x23e296['error'](0x1f4,_0x4b9575['message']));});});};exports[_0xb5f7('0x21')]=function(_0x1fec8e){var _0x2b0db9=this;return new Promise(function(_0xf8e211,_0xb98a3){return db['ZohoAccount'][_0xb5f7('0x22')]({'raw':_0x1fec8e[_0xb5f7('0x17')]?_0x1fec8e['options'][_0xb5f7('0x18')]===undefined?!![]:![]:!![],'where':_0x1fec8e[_0xb5f7('0x17')]?_0x1fec8e[_0xb5f7('0x17')][_0xb5f7('0x23')]||null:null,'attributes':_0x1fec8e[_0xb5f7('0x17')]?_0x1fec8e['options']['attributes']||null:null,'include':_0x1fec8e[_0xb5f7('0x17')]?_0x1fec8e[_0xb5f7('0x17')][_0xb5f7('0x1c')]?_['map'](_0x1fec8e[_0xb5f7('0x17')][_0xb5f7('0x1c')],function(_0x7f9a96){return{'model':db[_0x7f9a96['model']],'as':_0x7f9a96['as'],'attributes':_0x7f9a96[_0xb5f7('0x19')],'include':_0x7f9a96[_0xb5f7('0x1c')]?_[_0xb5f7('0x1b')](_0x7f9a96[_0xb5f7('0x1c')],function(_0x6d5bce){return{'model':db[_0x6d5bce[_0xb5f7('0x1d')]],'as':_0x6d5bce['as'],'attributes':_0x6d5bce['attributes'],'include':_0x6d5bce[_0xb5f7('0x1c')]?_[_0xb5f7('0x1b')](_0x6d5bce[_0xb5f7('0x1c')],function(_0x20a6ea){return{'model':db[_0x20a6ea['model']],'as':_0x20a6ea['as'],'attributes':_0x20a6ea[_0xb5f7('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb5f7('0xc')](function(_0xcb4ad2){logger[_0xb5f7('0xd')](_0xb5f7('0x21'),_0x1fec8e);logger[_0xb5f7('0x10')]('ShowZohoAccount',_0x1fec8e,JSON[_0xb5f7('0x1f')](_0xcb4ad2));_0xf8e211(_0xcb4ad2);})[_0xb5f7('0x20')](function(_0xac0a2a){logger[_0xb5f7('0x11')](_0xb5f7('0x21'),_0xac0a2a['message'],_0x1fec8e);_0xb98a3(_0x2b0db9[_0xb5f7('0x11')](0x1f4,_0xac0a2a[_0xb5f7('0x13')]));});});}; \ No newline at end of file +var _0x505d=['limit','include','map','model','then','GetZohoAccount','debug','ShowZohoAccount','find','raw','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount,\x20%s,\x20%s','catch','ZohoAccount','findAll','options','attributes'];(function(_0x545b71,_0x4f44eb){var _0x26e587=function(_0x293b81){while(--_0x293b81){_0x545b71['push'](_0x545b71['shift']());}};_0x26e587(++_0x4f44eb);}(_0x505d,0x93));var _0xd505=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x505d[_0x11ca63];return _0x41f1f6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd505('0x0'));var BPromise=require(_0xd505('0x1'));var rs=require(_0xd505('0x2'));var fs=require('fs');var Redis=require(_0xd505('0x3'));var db=require(_0xd505('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd505('0x5'))(_0xd505('0x6'));var config=require(_0xd505('0x7'));var jayson=require(_0xd505('0x8'));var client=jayson['client'][_0xd505('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d4f8d,_0x2bc4e7,_0x162ee2){return new BPromise(function(_0x543c42,_0x2abf26){return client[_0xd505('0xa')](_0x5d4f8d,_0x162ee2)['then'](function(_0x47b37a){logger[_0xd505('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x2bc4e7,_0xd505('0xc'));logger['debug'](_0xd505('0xd'),_0x2bc4e7,'request\x20sent',JSON[_0xd505('0xe')](_0x47b37a));if(_0x47b37a['error']){if(_0x47b37a['error']['code']===0x1f4){logger[_0xd505('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x2abf26(_0x47b37a['error']['message']);}logger[_0xd505('0xf')](_0xd505('0x11'),_0x2bc4e7,_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);return _0x543c42(_0x47b37a[_0xd505('0xf')][_0xd505('0x10')]);}else{logger[_0xd505('0xb')](_0xd505('0x11'),_0x2bc4e7,_0xd505('0xc'));_0x543c42(_0x47b37a['result'][_0xd505('0x10')]);}})[_0xd505('0x12')](function(_0x8013f2){logger['error'](_0xd505('0x11'),_0x2bc4e7,_0x8013f2);_0x2abf26(_0x8013f2);});});}exports['GetZohoAccount']=function(_0x561c71){var _0x3b03cb=this;return new Promise(function(_0x52401f,_0x33f5f4){return db[_0xd505('0x13')][_0xd505('0x14')]({'raw':_0x561c71[_0xd505('0x15')]?_0x561c71[_0xd505('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x561c71[_0xd505('0x15')]?_0x561c71[_0xd505('0x15')]['where']||null:null,'attributes':_0x561c71['options']?_0x561c71['options'][_0xd505('0x16')]||null:null,'limit':_0x561c71[_0xd505('0x15')]?_0x561c71['options'][_0xd505('0x17')]||null:null,'include':_0x561c71['options']?_0x561c71['options'][_0xd505('0x18')]?_[_0xd505('0x19')](_0x561c71['options'][_0xd505('0x18')],function(_0x50ebfa){return{'model':db[_0x50ebfa['model']],'as':_0x50ebfa['as'],'attributes':_0x50ebfa[_0xd505('0x16')],'include':_0x50ebfa[_0xd505('0x18')]?_[_0xd505('0x19')](_0x50ebfa['include'],function(_0x4f1839){return{'model':db[_0x4f1839[_0xd505('0x1a')]],'as':_0x4f1839['as'],'attributes':_0x4f1839['attributes'],'include':_0x4f1839['include']?_[_0xd505('0x19')](_0x4f1839[_0xd505('0x18')],function(_0xeb2af1){return{'model':db[_0xeb2af1[_0xd505('0x1a')]],'as':_0xeb2af1['as'],'attributes':_0xeb2af1[_0xd505('0x16')]};}):[]};}):[]};}):[]:[]})[_0xd505('0x1b')](function(_0x3c01f0){logger['info'](_0xd505('0x1c'),_0x561c71);logger[_0xd505('0x1d')](_0xd505('0x1c'),_0x561c71,JSON[_0xd505('0xe')](_0x3c01f0));_0x52401f(_0x3c01f0);})['catch'](function(_0x2d8d67){logger[_0xd505('0xf')]('GetZohoAccount',_0x2d8d67['message'],_0x561c71);_0x33f5f4(_0x3b03cb['error'](0x1f4,_0x2d8d67[_0xd505('0x10')]));});});};exports[_0xd505('0x1e')]=function(_0x2425c0){var _0x4e5c2e=this;return new Promise(function(_0x548934,_0x4fb8fa){return db[_0xd505('0x13')][_0xd505('0x1f')]({'raw':_0x2425c0[_0xd505('0x15')]?_0x2425c0['options'][_0xd505('0x20')]===undefined?!![]:![]:!![],'where':_0x2425c0[_0xd505('0x15')]?_0x2425c0['options'][_0xd505('0x21')]||null:null,'attributes':_0x2425c0[_0xd505('0x15')]?_0x2425c0[_0xd505('0x15')][_0xd505('0x16')]||null:null,'include':_0x2425c0['options']?_0x2425c0['options'][_0xd505('0x18')]?_[_0xd505('0x19')](_0x2425c0[_0xd505('0x15')][_0xd505('0x18')],function(_0x2d8abd){return{'model':db[_0x2d8abd[_0xd505('0x1a')]],'as':_0x2d8abd['as'],'attributes':_0x2d8abd['attributes'],'include':_0x2d8abd[_0xd505('0x18')]?_['map'](_0x2d8abd[_0xd505('0x18')],function(_0x592898){return{'model':db[_0x592898[_0xd505('0x1a')]],'as':_0x592898['as'],'attributes':_0x592898[_0xd505('0x16')],'include':_0x592898[_0xd505('0x18')]?_[_0xd505('0x19')](_0x592898[_0xd505('0x18')],function(_0x81120b){return{'model':db[_0x81120b[_0xd505('0x1a')]],'as':_0x81120b['as'],'attributes':_0x81120b[_0xd505('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b53b2){logger[_0xd505('0xb')](_0xd505('0x1e'),_0x2425c0);logger[_0xd505('0x1d')]('ShowZohoAccount',_0x2425c0,JSON[_0xd505('0xe')](_0x4b53b2));_0x548934(_0x4b53b2);})[_0xd505('0x12')](function(_0x290f53){logger[_0xd505('0xf')](_0xd505('0x1e'),_0x290f53[_0xd505('0x10')],_0x2425c0);_0x4fb8fa(_0x4e5c2e[_0xd505('0xf')](0x1f4,_0x290f53[_0xd505('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 81588bc..111e80d 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 _0x28f8=['post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x28f8,0x85));var _0x828f=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0x28f8[_0x5a27e8];return _0x4e38f7;};'use strict';var multer=require('multer');var util=require(_0x828f('0x0'));var path=require(_0x828f('0x1'));var timeout=require(_0x828f('0x2'));var express=require(_0x828f('0x3'));var router=express['Router']();var fs_extra=require(_0x828f('0x4'));var auth=require(_0x828f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x828f('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0x828f('0x7')]('/',auth[_0x828f('0x8')](),controller[_0x828f('0x9')]);router['get']('/:id',auth[_0x828f('0x8')](),controller[_0x828f('0xa')]);router['get'](_0x828f('0xb'),auth[_0x828f('0x8')](),controller[_0x828f('0xc')]);router[_0x828f('0x7')](_0x828f('0xd'),auth[_0x828f('0x8')](),controller[_0x828f('0xe')]);router[_0x828f('0x7')](_0x828f('0xf'),auth[_0x828f('0x8')](),controller[_0x828f('0x10')]);router[_0x828f('0x11')]('/',auth['isAuthenticated'](),controller[_0x828f('0x12')]);router[_0x828f('0x13')](_0x828f('0x14'),auth[_0x828f('0x8')](),controller[_0x828f('0x15')]);router[_0x828f('0x16')](_0x828f('0x14'),auth[_0x828f('0x8')](),controller[_0x828f('0x17')]);module[_0x828f('0x18')]=router; \ No newline at end of file +var _0xe670=['/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x414e48,_0x272c86){var _0x120139=function(_0x33ace1){while(--_0x33ace1){_0x414e48['push'](_0x414e48['shift']());}};_0x120139(++_0x272c86);}(_0xe670,0x1c1));var _0x0e67=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xe670[_0x710815];return _0x5b3b89;};'use strict';var multer=require(_0x0e67('0x0'));var util=require(_0x0e67('0x1'));var path=require(_0x0e67('0x2'));var timeout=require(_0x0e67('0x3'));var express=require(_0x0e67('0x4'));var router=express[_0x0e67('0x5')]();var fs_extra=require(_0x0e67('0x6'));var auth=require(_0x0e67('0x7'));var interaction=require(_0x0e67('0x8'));var config=require(_0x0e67('0x9'));var controller=require('./intZohoConfiguration.controller');router[_0x0e67('0xa')]('/',auth[_0x0e67('0xb')](),controller[_0x0e67('0xc')]);router[_0x0e67('0xa')](_0x0e67('0xd'),auth[_0x0e67('0xb')](),controller[_0x0e67('0xe')]);router[_0x0e67('0xa')](_0x0e67('0xf'),auth['isAuthenticated'](),controller[_0x0e67('0x10')]);router[_0x0e67('0xa')](_0x0e67('0x11'),auth[_0x0e67('0xb')](),controller[_0x0e67('0x12')]);router[_0x0e67('0xa')](_0x0e67('0x13'),auth[_0x0e67('0xb')](),controller[_0x0e67('0x14')]);router[_0x0e67('0x15')]('/',auth[_0x0e67('0xb')](),controller['create']);router['put']('/:id',auth[_0x0e67('0xb')](),controller[_0x0e67('0x16')]);router[_0x0e67('0x17')]('/:id',auth[_0x0e67('0xb')](),controller[_0x0e67('0x18')]);module[_0x0e67('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 98394c5..aff504a 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 _0x9932=['contact','nothing','contact_lead','exports','STRING','ENUM','lead'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x9932,0xc0));var _0x2993=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x9932[_0x174ef5];return _0x1cc379;};'use strict';var Sequelize=require('sequelize');module[_0x2993('0x0')]={'name':{'type':Sequelize[_0x2993('0x1')]},'moduleCreate':{'type':Sequelize[_0x2993('0x2')](_0x2993('0x3'),_0x2993('0x4'),_0x2993('0x5')),'defaultValue':_0x2993('0x3')},'moduleSearch':{'type':Sequelize[_0x2993('0x2')](_0x2993('0x6'),_0x2993('0x4'),_0x2993('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x2993('0x1')]}}; \ No newline at end of file +var _0x1217=['contact','lead','contact_lead','sequelize','exports','ENUM'];(function(_0x16be20,_0x3f7898){var _0x38f195=function(_0x2bdad1){while(--_0x2bdad1){_0x16be20['push'](_0x16be20['shift']());}};_0x38f195(++_0x3f7898);}(_0x1217,0xb1));var _0x7121=function(_0x46fa6a,_0x51681c){_0x46fa6a=_0x46fa6a-0x0;var _0x7bd379=_0x1217[_0x46fa6a];return _0x7bd379;};'use strict';var Sequelize=require(_0x7121('0x0'));module[_0x7121('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x7121('0x2')]('lead',_0x7121('0x3'),'nothing'),'defaultValue':_0x7121('0x4')},'moduleSearch':{'type':Sequelize[_0x7121('0x2')](_0x7121('0x5'),_0x7121('0x3'),_0x7121('0x4')),'defaultValue':_0x7121('0x5')},'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 51006a2..ebca61b 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 _0x782f=['options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ZohoField','order','sort','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','send','ZohoConfiguration','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','filter'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_0x782f,0x64));var _0xf782=function(_0x43f872,_0x10318f){_0x43f872=_0x43f872-0x0;var _0x3375e3=_0x782f[_0x43f872];return _0x3375e3;};'use strict';var emlformat=require(_0xf782('0x0'));var rimraf=require(_0xf782('0x1'));var zipdir=require(_0xf782('0x2'));var jsonpatch=require(_0xf782('0x3'));var rp=require(_0xf782('0x4'));var moment=require(_0xf782('0x5'));var BPromise=require(_0xf782('0x6'));var Mustache=require(_0xf782('0x7'));var util=require(_0xf782('0x8'));var path=require(_0xf782('0x9'));var sox=require(_0xf782('0xa'));var csv=require(_0xf782('0xb'));var ejs=require(_0xf782('0xc'));var fs=require('fs');var fs_extra=require(_0xf782('0xd'));var _=require(_0xf782('0xe'));var squel=require(_0xf782('0xf'));var crypto=require(_0xf782('0x10'));var jsforce=require(_0xf782('0x11'));var deskjs=require(_0xf782('0x12'));var toCsv=require(_0xf782('0xb'));var querystring=require('querystring');var Papa=require(_0xf782('0x13'));var Redis=require(_0xf782('0x14'));var authService=require(_0xf782('0x15'));var qs=require(_0xf782('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf782('0x17'));var logger=require(_0xf782('0x18'))('api');var utils=require(_0xf782('0x19'));var config=require(_0xf782('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ed491,_0x32e60e){_0x32e60e=_0x32e60e||0xcc;return function(_0xb3c536){if(_0xb3c536){return _0x5ed491[_0xf782('0x1b')](_0x32e60e);}return _0x5ed491[_0xf782('0x1c')](_0x32e60e)['end']();};}function respondWithResult(_0x23945e,_0x4b6a28){_0x4b6a28=_0x4b6a28||0xc8;return function(_0x2ff973){if(_0x2ff973){return _0x23945e[_0xf782('0x1c')](_0x4b6a28)['json'](_0x2ff973);}};}function respondWithFilteredResult(_0x422d71,_0x232d19){return function(_0x24354e){if(_0x24354e){var _0x398e9a=typeof _0x232d19['offset']===_0xf782('0x1d')&&typeof _0x232d19[_0xf782('0x1e')]===_0xf782('0x1d');var _0xcb4d7b=_0x24354e[_0xf782('0x1f')];var _0x34f580=_0x398e9a?0x0:_0x232d19[_0xf782('0x20')];var _0x364bf2=_0x398e9a?_0x24354e[_0xf782('0x1f')]:_0x232d19[_0xf782('0x20')]+_0x232d19[_0xf782('0x1e')];var _0x2932a7;if(_0x364bf2>=_0xcb4d7b){_0x364bf2=_0xcb4d7b;_0x2932a7=0xc8;}else{_0x2932a7=0xce;}_0x422d71['status'](_0x2932a7);return _0x422d71[_0xf782('0x21')](_0xf782('0x22'),_0x34f580+'-'+_0x364bf2+'/'+_0xcb4d7b)['json'](_0x24354e);}return null;};}function patchUpdates(_0x437770){return function(_0x30eb34){try{jsonpatch[_0xf782('0x23')](_0x30eb34,_0x437770,!![]);}catch(_0xf409de){return BPromise[_0xf782('0x24')](_0xf409de);}return _0x30eb34[_0xf782('0x25')]();};}function saveUpdates(_0x43bb3d,_0x5b4567){return function(_0x3d5ab6){if(_0x3d5ab6){return _0x3d5ab6[_0xf782('0x26')](_0x43bb3d)['then'](function(_0x112fdc){return _0x112fdc;});}return null;};}function removeEntity(_0x5c758c,_0x5a07b8){return function(_0x4e5153){if(_0x4e5153){return _0x4e5153[_0xf782('0x27')]()[_0xf782('0x28')](function(){_0x5c758c[_0xf782('0x1c')](0xcc)[_0xf782('0x29')]();});}};}function handleEntityNotFound(_0x5b03bb,_0x4be4ac){return function(_0x39a7b8){if(!_0x39a7b8){_0x5b03bb[_0xf782('0x1b')](0x194);}return _0x39a7b8;};}function handleError(_0x486af7,_0x538302){_0x538302=_0x538302||0x1f4;return function(_0x451816){logger[_0xf782('0x2a')](_0x451816[_0xf782('0x2b')]);if(_0x451816['name']){delete _0x451816['name'];}_0x486af7[_0xf782('0x1c')](_0x538302)[_0xf782('0x2c')](_0x451816);};}exports['index']=function(_0x3b4df8,_0x5ba11e){var _0xcc3079={},_0xfc3b8={},_0x150c61={'count':0x0,'rows':[]};var _0x4cbc47=_['map'](db[_0xf782('0x2d')][_0xf782('0x2e')],function(_0x28b706){return{'name':_0x28b706[_0xf782('0x2f')],'type':_0x28b706[_0xf782('0x30')][_0xf782('0x31')]};});_0xfc3b8[_0xf782('0x32')]=_[_0xf782('0x33')](_0x4cbc47,_0xf782('0x34'));_0xfc3b8['query']=_[_0xf782('0x35')](_0x3b4df8[_0xf782('0x36')]);_0xfc3b8[_0xf782('0x37')]=_[_0xf782('0x38')](_0xfc3b8['model'],_0xfc3b8['query']);_0xcc3079[_0xf782('0x39')]=_[_0xf782('0x38')](_0xfc3b8['model'],qs[_0xf782('0x3a')](_0x3b4df8[_0xf782('0x36')][_0xf782('0x3a')]));_0xcc3079['attributes']=_0xcc3079[_0xf782('0x39')][_0xf782('0x3b')]?_0xcc3079['attributes']:_0xfc3b8[_0xf782('0x32')];if(!_0x3b4df8['query'][_0xf782('0x3c')](_0xf782('0x3d'))){_0xcc3079[_0xf782('0x1e')]=qs['limit'](_0x3b4df8[_0xf782('0x36')][_0xf782('0x1e')]);_0xcc3079['offset']=qs[_0xf782('0x20')](_0x3b4df8[_0xf782('0x36')]['offset']);}_0xcc3079['order']=qs['sort'](_0x3b4df8[_0xf782('0x36')]['sort']);_0xcc3079[_0xf782('0x3e')]=qs[_0xf782('0x37')](_[_0xf782('0x3f')](_0x3b4df8[_0xf782('0x36')],_0xfc3b8[_0xf782('0x37')]),_0x4cbc47);if(_0x3b4df8[_0xf782('0x36')]['filter']){_0xcc3079[_0xf782('0x3e')]=_[_0xf782('0x40')](_0xcc3079[_0xf782('0x3e')],{'$or':_[_0xf782('0x33')](_0x4cbc47,function(_0x3cada6){if(_0x3cada6[_0xf782('0x30')]!=='VIRTUAL'){var _0x8932f6={};_0x8932f6[_0x3cada6[_0xf782('0x34')]]={'$like':'%'+_0x3b4df8[_0xf782('0x36')][_0xf782('0x41')]+'%'};return _0x8932f6;}})});}_0xcc3079=_[_0xf782('0x40')]({},_0xcc3079,_0x3b4df8[_0xf782('0x42')]);var _0x129588={'where':_0xcc3079[_0xf782('0x3e')]};return db['ZohoConfiguration'][_0xf782('0x1f')](_0x129588)[_0xf782('0x28')](function(_0x158192){_0x150c61[_0xf782('0x1f')]=_0x158192;if(_0x3b4df8['query'][_0xf782('0x43')]){_0xcc3079[_0xf782('0x44')]=[{'all':!![]}];}return db[_0xf782('0x2d')][_0xf782('0x45')](_0xcc3079);})[_0xf782('0x28')](function(_0x4ffd65){_0x150c61[_0xf782('0x46')]=_0x4ffd65;return _0x150c61;})[_0xf782('0x28')](respondWithFilteredResult(_0x5ba11e,_0xcc3079))[_0xf782('0x47')](handleError(_0x5ba11e,null));};exports['show']=function(_0x4149af,_0x1f2d34){var _0x19de11={'raw':![],'where':{'id':_0x4149af[_0xf782('0x48')]['id']}},_0x1d1e39={};_0x1d1e39[_0xf782('0x32')]=_[_0xf782('0x35')](db[_0xf782('0x2d')][_0xf782('0x2e')]);_0x1d1e39[_0xf782('0x36')]=_[_0xf782('0x35')](_0x4149af[_0xf782('0x36')]);_0x1d1e39[_0xf782('0x37')]=_[_0xf782('0x38')](_0x1d1e39[_0xf782('0x32')],_0x1d1e39['query']);_0x19de11[_0xf782('0x39')]=_['intersection'](_0x1d1e39[_0xf782('0x32')],qs[_0xf782('0x3a')](_0x4149af['query'][_0xf782('0x3a')]));_0x19de11[_0xf782('0x39')]=_0x19de11['attributes'][_0xf782('0x3b')]?_0x19de11['attributes']:_0x1d1e39['model'];if(_0x4149af[_0xf782('0x36')]['includeAll']){_0x19de11['include']=[{'all':!![]}];}_0x19de11=_[_0xf782('0x40')]({},_0x19de11,_0x4149af['options']);return db[_0xf782('0x2d')][_0xf782('0x49')](_0x19de11)['then'](handleEntityNotFound(_0x1f2d34,null))[_0xf782('0x28')](respondWithResult(_0x1f2d34,null))[_0xf782('0x47')](handleError(_0x1f2d34,null));};exports[_0xf782('0x4a')]=function(_0x475d6d,_0x409f51){return db['ZohoConfiguration'][_0xf782('0x4a')](_0x475d6d['body'],{})[_0xf782('0x28')](respondWithResult(_0x409f51,0xc9))[_0xf782('0x47')](handleError(_0x409f51,null));};exports['update']=function(_0x8b5f5f,_0x395653){if(_0x8b5f5f['body']['id']){delete _0x8b5f5f['body']['id'];}return db[_0xf782('0x2d')]['find']({'where':{'id':_0x8b5f5f[_0xf782('0x48')]['id']}})[_0xf782('0x28')](handleEntityNotFound(_0x395653,null))['then'](saveUpdates(_0x8b5f5f[_0xf782('0x4b')],null))[_0xf782('0x28')](respondWithResult(_0x395653,null))[_0xf782('0x47')](handleError(_0x395653,null));};exports[_0xf782('0x27')]=function(_0x34beed,_0x155566){return db[_0xf782('0x2d')][_0xf782('0x49')]({'where':{'id':_0x34beed[_0xf782('0x48')]['id']}})[_0xf782('0x28')](handleEntityNotFound(_0x155566,null))['then'](removeEntity(_0x155566,null))[_0xf782('0x47')](handleError(_0x155566,null));};exports[_0xf782('0x4c')]=function(_0x1b8352,_0x431d9c,_0x5ced25){var _0x41e0d1={};var _0x52c704={};var _0x3ad9cf;var _0x2b91eb;return db[_0xf782('0x2d')][_0xf782('0x4d')]({'where':{'id':_0x1b8352[_0xf782('0x48')]['id']}})[_0xf782('0x28')](handleEntityNotFound(_0x431d9c,null))['then'](function(_0x117d21){if(_0x117d21){_0x3ad9cf=_0x117d21;_0x52c704['model']=_[_0xf782('0x35')](db[_0xf782('0x4e')][_0xf782('0x2e')]);_0x52c704[_0xf782('0x36')]=_[_0xf782('0x35')](_0x1b8352[_0xf782('0x36')]);_0x52c704[_0xf782('0x37')]=_[_0xf782('0x38')](_0x52c704[_0xf782('0x32')],_0x52c704[_0xf782('0x36')]);_0x41e0d1[_0xf782('0x39')]=_[_0xf782('0x38')](_0x52c704[_0xf782('0x32')],qs[_0xf782('0x3a')](_0x1b8352[_0xf782('0x36')][_0xf782('0x3a')]));_0x41e0d1['attributes']=_0x41e0d1[_0xf782('0x39')]['length']?_0x41e0d1[_0xf782('0x39')]:_0x52c704[_0xf782('0x32')];_0x41e0d1[_0xf782('0x4f')]=qs[_0xf782('0x50')](_0x1b8352[_0xf782('0x36')][_0xf782('0x50')]);_0x41e0d1['where']=qs[_0xf782('0x37')](_[_0xf782('0x3f')](_0x1b8352[_0xf782('0x36')],_0x52c704[_0xf782('0x37')]));if(_0x1b8352[_0xf782('0x36')][_0xf782('0x41')]){_0x41e0d1[_0xf782('0x3e')]=_[_0xf782('0x40')](_0x41e0d1[_0xf782('0x3e')],{'$or':_[_0xf782('0x33')](_0x41e0d1[_0xf782('0x39')],function(_0x30cf37){var _0x414579={};_0x414579[_0x30cf37]={'$like':'%'+_0x1b8352[_0xf782('0x36')][_0xf782('0x41')]+'%'};return _0x414579;})});}_0x41e0d1=_['merge']({},_0x41e0d1,_0x1b8352[_0xf782('0x42')]);return _0x3ad9cf[_0xf782('0x4c')](_0x41e0d1);}})[_0xf782('0x28')](function(_0x55bb9e){if(_0x55bb9e){_0x2b91eb=_0x55bb9e['length'];if(!_0x1b8352[_0xf782('0x36')][_0xf782('0x3c')](_0xf782('0x3d'))){_0x41e0d1[_0xf782('0x1e')]=qs[_0xf782('0x1e')](_0x1b8352[_0xf782('0x36')][_0xf782('0x1e')]);_0x41e0d1[_0xf782('0x20')]=qs[_0xf782('0x20')](_0x1b8352[_0xf782('0x36')][_0xf782('0x20')]);}return _0x3ad9cf[_0xf782('0x4c')](_0x41e0d1);}})[_0xf782('0x28')](function(_0x37e406){if(_0x37e406){return _0x37e406?{'count':_0x2b91eb,'rows':_0x37e406}:null;}})[_0xf782('0x28')](respondWithResult(_0x431d9c,null))[_0xf782('0x47')](handleError(_0x431d9c,null));};exports['getSubjects']=function(_0xce9a3e,_0x5e9aac,_0x395794){var _0x1523ed={};var _0x361d12={};var _0xe6ccc7;var _0x5b3a6c;return db[_0xf782('0x2d')]['findOne']({'where':{'id':_0xce9a3e[_0xf782('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e9aac,null))[_0xf782('0x28')](function(_0x53561f){if(_0x53561f){_0xe6ccc7=_0x53561f;_0x361d12[_0xf782('0x32')]=_['keys'](db[_0xf782('0x4e')]['rawAttributes']);_0x361d12[_0xf782('0x36')]=_[_0xf782('0x35')](_0xce9a3e[_0xf782('0x36')]);_0x361d12[_0xf782('0x37')]=_['intersection'](_0x361d12[_0xf782('0x32')],_0x361d12[_0xf782('0x36')]);_0x1523ed[_0xf782('0x39')]=_[_0xf782('0x38')](_0x361d12[_0xf782('0x32')],qs[_0xf782('0x3a')](_0xce9a3e[_0xf782('0x36')][_0xf782('0x3a')]));_0x1523ed[_0xf782('0x39')]=_0x1523ed['attributes'][_0xf782('0x3b')]?_0x1523ed['attributes']:_0x361d12['model'];_0x1523ed['order']=qs[_0xf782('0x50')](_0xce9a3e[_0xf782('0x36')]['sort']);_0x1523ed[_0xf782('0x3e')]=qs[_0xf782('0x37')](_[_0xf782('0x3f')](_0xce9a3e[_0xf782('0x36')],_0x361d12[_0xf782('0x37')]));if(_0xce9a3e['query'][_0xf782('0x41')]){_0x1523ed['where']=_['merge'](_0x1523ed['where'],{'$or':_['map'](_0x1523ed[_0xf782('0x39')],function(_0x15cd9d){var _0xf39f05={};_0xf39f05[_0x15cd9d]={'$like':'%'+_0xce9a3e[_0xf782('0x36')][_0xf782('0x41')]+'%'};return _0xf39f05;})});}_0x1523ed=_['merge']({},_0x1523ed,_0xce9a3e[_0xf782('0x42')]);return _0xe6ccc7['getSubjects'](_0x1523ed);}})[_0xf782('0x28')](function(_0x43626d){if(_0x43626d){_0x5b3a6c=_0x43626d[_0xf782('0x3b')];if(!_0xce9a3e[_0xf782('0x36')][_0xf782('0x3c')]('nolimit')){_0x1523ed[_0xf782('0x1e')]=qs[_0xf782('0x1e')](_0xce9a3e[_0xf782('0x36')]['limit']);_0x1523ed[_0xf782('0x20')]=qs[_0xf782('0x20')](_0xce9a3e[_0xf782('0x36')][_0xf782('0x20')]);}return _0xe6ccc7[_0xf782('0x51')](_0x1523ed);}})[_0xf782('0x28')](function(_0x252c7e){if(_0x252c7e){return _0x252c7e?{'count':_0x5b3a6c,'rows':_0x252c7e}:null;}})[_0xf782('0x28')](respondWithResult(_0x5e9aac,null))['catch'](handleError(_0x5e9aac,null));};exports[_0xf782('0x52')]=function(_0x4d55e7,_0x4d5312,_0x185c80){var _0x693b93={};var _0x189e08={};var _0x106530;var _0x5e5b30;return db['ZohoConfiguration'][_0xf782('0x4d')]({'where':{'id':_0x4d55e7['params']['id']}})[_0xf782('0x28')](handleEntityNotFound(_0x4d5312,null))['then'](function(_0x5046c4){if(_0x5046c4){_0x106530=_0x5046c4;_0x189e08[_0xf782('0x32')]=_[_0xf782('0x35')](db[_0xf782('0x4e')][_0xf782('0x2e')]);_0x189e08[_0xf782('0x36')]=_[_0xf782('0x35')](_0x4d55e7[_0xf782('0x36')]);_0x189e08[_0xf782('0x37')]=_[_0xf782('0x38')](_0x189e08[_0xf782('0x32')],_0x189e08['query']);_0x693b93[_0xf782('0x39')]=_['intersection'](_0x189e08[_0xf782('0x32')],qs[_0xf782('0x3a')](_0x4d55e7['query'][_0xf782('0x3a')]));_0x693b93[_0xf782('0x39')]=_0x693b93[_0xf782('0x39')][_0xf782('0x3b')]?_0x693b93[_0xf782('0x39')]:_0x189e08[_0xf782('0x32')];_0x693b93[_0xf782('0x4f')]=qs[_0xf782('0x50')](_0x4d55e7['query'][_0xf782('0x50')]);_0x693b93[_0xf782('0x3e')]=qs[_0xf782('0x37')](_[_0xf782('0x3f')](_0x4d55e7[_0xf782('0x36')],_0x189e08[_0xf782('0x37')]));if(_0x4d55e7[_0xf782('0x36')]['filter']){_0x693b93[_0xf782('0x3e')]=_[_0xf782('0x40')](_0x693b93[_0xf782('0x3e')],{'$or':_[_0xf782('0x33')](_0x693b93[_0xf782('0x39')],function(_0x26d79d){var _0xf9555a={};_0xf9555a[_0x26d79d]={'$like':'%'+_0x4d55e7['query']['filter']+'%'};return _0xf9555a;})});}_0x693b93=_[_0xf782('0x40')]({},_0x693b93,_0x4d55e7['options']);return _0x106530[_0xf782('0x52')](_0x693b93);}})[_0xf782('0x28')](function(_0x327335){if(_0x327335){_0x5e5b30=_0x327335['length'];if(!_0x4d55e7['query'][_0xf782('0x3c')](_0xf782('0x3d'))){_0x693b93[_0xf782('0x1e')]=qs['limit'](_0x4d55e7['query']['limit']);_0x693b93[_0xf782('0x20')]=qs[_0xf782('0x20')](_0x4d55e7[_0xf782('0x36')][_0xf782('0x20')]);}return _0x106530['getDescriptions'](_0x693b93);}})[_0xf782('0x28')](function(_0x32e536){if(_0x32e536){return _0x32e536?{'count':_0x5e5b30,'rows':_0x32e536}:null;}})[_0xf782('0x28')](respondWithResult(_0x4d5312,null))[_0xf782('0x47')](handleError(_0x4d5312,null));}; \ No newline at end of file +var _0x993a=['keys','ZohoField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','limit','offset','count','status','Content-Range','reject','save','update','then','destroy','error','stack','name','index','ZohoConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','map','filter','options','where','includeAll','findAll','rows','catch','show','params','length','include','merge','create','body','find','getFields','findOne'];(function(_0x57b971,_0x5e5d73){var _0xdbb32e=function(_0x55c16d){while(--_0x55c16d){_0x57b971['push'](_0x57b971['shift']());}};_0xdbb32e(++_0x5e5d73);}(_0x993a,0x18f));var _0xa993=function(_0x1bc2ce,_0x422e96){_0x1bc2ce=_0x1bc2ce-0x0;var _0xd8aadb=_0x993a[_0x1bc2ce];return _0xd8aadb;};'use strict';var emlformat=require(_0xa993('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa993('0x1'));var jsonpatch=require(_0xa993('0x2'));var rp=require(_0xa993('0x3'));var moment=require(_0xa993('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa993('0x5'));var util=require(_0xa993('0x6'));var path=require(_0xa993('0x7'));var sox=require(_0xa993('0x8'));var csv=require(_0xa993('0x9'));var ejs=require(_0xa993('0xa'));var fs=require('fs');var fs_extra=require(_0xa993('0xb'));var _=require(_0xa993('0xc'));var squel=require(_0xa993('0xd'));var crypto=require('crypto');var jsforce=require(_0xa993('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa993('0xf'));var Papa=require(_0xa993('0x10'));var Redis=require(_0xa993('0x11'));var authService=require(_0xa993('0x12'));var qs=require(_0xa993('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa993('0x14'));var logger=require('../../config/logger')(_0xa993('0x15'));var utils=require(_0xa993('0x16'));var config=require(_0xa993('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa993('0x18'))['db'];function respondWithStatusCode(_0x1a0c11,_0x3d0bd4){_0x3d0bd4=_0x3d0bd4||0xcc;return function(_0x73fc80){if(_0x73fc80){return _0x1a0c11[_0xa993('0x19')](_0x3d0bd4);}return _0x1a0c11['status'](_0x3d0bd4)[_0xa993('0x1a')]();};}function respondWithResult(_0x404217,_0x3c4016){_0x3c4016=_0x3c4016||0xc8;return function(_0x54a628){if(_0x54a628){return _0x404217['status'](_0x3c4016)[_0xa993('0x1b')](_0x54a628);}};}function respondWithFilteredResult(_0x2f94e5,_0x57ecf9){return function(_0x5a96af){if(_0x5a96af){var _0x15ed36=typeof _0x57ecf9['offset']==='undefined'&&typeof _0x57ecf9[_0xa993('0x1c')]==='undefined';var _0x4ab2b8=_0x5a96af['count'];var _0x2b5bb6=_0x15ed36?0x0:_0x57ecf9[_0xa993('0x1d')];var _0x38858b=_0x15ed36?_0x5a96af[_0xa993('0x1e')]:_0x57ecf9[_0xa993('0x1d')]+_0x57ecf9[_0xa993('0x1c')];var _0x5c2569;if(_0x38858b>=_0x4ab2b8){_0x38858b=_0x4ab2b8;_0x5c2569=0xc8;}else{_0x5c2569=0xce;}_0x2f94e5[_0xa993('0x1f')](_0x5c2569);return _0x2f94e5['set'](_0xa993('0x20'),_0x2b5bb6+'-'+_0x38858b+'/'+_0x4ab2b8)[_0xa993('0x1b')](_0x5a96af);}return null;};}function patchUpdates(_0x283dd4){return function(_0x2c8989){try{jsonpatch['apply'](_0x2c8989,_0x283dd4,!![]);}catch(_0x16a0c3){return BPromise[_0xa993('0x21')](_0x16a0c3);}return _0x2c8989[_0xa993('0x22')]();};}function saveUpdates(_0xf6788,_0xcae8a1){return function(_0x279a88){if(_0x279a88){return _0x279a88[_0xa993('0x23')](_0xf6788)[_0xa993('0x24')](function(_0x3f5902){return _0x3f5902;});}return null;};}function removeEntity(_0x342852,_0x168a13){return function(_0x1a9454){if(_0x1a9454){return _0x1a9454[_0xa993('0x25')]()[_0xa993('0x24')](function(){_0x342852['status'](0xcc)[_0xa993('0x1a')]();});}};}function handleEntityNotFound(_0x57de73,_0x2ef3d6){return function(_0x3fc14e){if(!_0x3fc14e){_0x57de73['sendStatus'](0x194);}return _0x3fc14e;};}function handleError(_0x107d3f,_0xb5a89c){_0xb5a89c=_0xb5a89c||0x1f4;return function(_0x2569a8){logger[_0xa993('0x26')](_0x2569a8[_0xa993('0x27')]);if(_0x2569a8['name']){delete _0x2569a8[_0xa993('0x28')];}_0x107d3f[_0xa993('0x1f')](_0xb5a89c)['send'](_0x2569a8);};}exports[_0xa993('0x29')]=function(_0x3b9c17,_0x46f4a7){var _0x4d6401={},_0x58f4cf={},_0x47af35={'count':0x0,'rows':[]};var _0x3eddf0=_['map'](db[_0xa993('0x2a')][_0xa993('0x2b')],function(_0x5df4d5){return{'name':_0x5df4d5[_0xa993('0x2c')],'type':_0x5df4d5['type'][_0xa993('0x2d')]};});_0x58f4cf[_0xa993('0x2e')]=_['map'](_0x3eddf0,'name');_0x58f4cf[_0xa993('0x2f')]=_['keys'](_0x3b9c17['query']);_0x58f4cf[_0xa993('0x30')]=_[_0xa993('0x31')](_0x58f4cf['model'],_0x58f4cf['query']);_0x4d6401['attributes']=_[_0xa993('0x31')](_0x58f4cf[_0xa993('0x2e')],qs[_0xa993('0x32')](_0x3b9c17['query'][_0xa993('0x32')]));_0x4d6401[_0xa993('0x33')]=_0x4d6401[_0xa993('0x33')]['length']?_0x4d6401[_0xa993('0x33')]:_0x58f4cf['model'];if(!_0x3b9c17[_0xa993('0x2f')][_0xa993('0x34')](_0xa993('0x35'))){_0x4d6401[_0xa993('0x1c')]=qs[_0xa993('0x1c')](_0x3b9c17[_0xa993('0x2f')][_0xa993('0x1c')]);_0x4d6401[_0xa993('0x1d')]=qs[_0xa993('0x1d')](_0x3b9c17[_0xa993('0x2f')][_0xa993('0x1d')]);}_0x4d6401[_0xa993('0x36')]=qs[_0xa993('0x37')](_0x3b9c17['query'][_0xa993('0x37')]);_0x4d6401['where']=qs['filters'](_[_0xa993('0x38')](_0x3b9c17[_0xa993('0x2f')],_0x58f4cf[_0xa993('0x30')]),_0x3eddf0);if(_0x3b9c17['query']['filter']){_0x4d6401['where']=_['merge'](_0x4d6401['where'],{'$or':_[_0xa993('0x39')](_0x3eddf0,function(_0x3ea220){if(_0x3ea220['type']!=='VIRTUAL'){var _0x720c67={};_0x720c67[_0x3ea220[_0xa993('0x28')]]={'$like':'%'+_0x3b9c17[_0xa993('0x2f')][_0xa993('0x3a')]+'%'};return _0x720c67;}})});}_0x4d6401=_['merge']({},_0x4d6401,_0x3b9c17[_0xa993('0x3b')]);var _0x4566a7={'where':_0x4d6401[_0xa993('0x3c')]};return db[_0xa993('0x2a')][_0xa993('0x1e')](_0x4566a7)[_0xa993('0x24')](function(_0x4041d0){_0x47af35['count']=_0x4041d0;if(_0x3b9c17[_0xa993('0x2f')][_0xa993('0x3d')]){_0x4d6401['include']=[{'all':!![]}];}return db[_0xa993('0x2a')][_0xa993('0x3e')](_0x4d6401);})[_0xa993('0x24')](function(_0x3d30c9){_0x47af35[_0xa993('0x3f')]=_0x3d30c9;return _0x47af35;})['then'](respondWithFilteredResult(_0x46f4a7,_0x4d6401))[_0xa993('0x40')](handleError(_0x46f4a7,null));};exports[_0xa993('0x41')]=function(_0x17b8cb,_0x227813){var _0x3b1225={'raw':![],'where':{'id':_0x17b8cb[_0xa993('0x42')]['id']}},_0x1c4d60={};_0x1c4d60['model']=_['keys'](db['ZohoConfiguration'][_0xa993('0x2b')]);_0x1c4d60[_0xa993('0x2f')]=_['keys'](_0x17b8cb[_0xa993('0x2f')]);_0x1c4d60[_0xa993('0x30')]=_[_0xa993('0x31')](_0x1c4d60[_0xa993('0x2e')],_0x1c4d60[_0xa993('0x2f')]);_0x3b1225[_0xa993('0x33')]=_[_0xa993('0x31')](_0x1c4d60[_0xa993('0x2e')],qs[_0xa993('0x32')](_0x17b8cb[_0xa993('0x2f')][_0xa993('0x32')]));_0x3b1225[_0xa993('0x33')]=_0x3b1225[_0xa993('0x33')][_0xa993('0x43')]?_0x3b1225['attributes']:_0x1c4d60[_0xa993('0x2e')];if(_0x17b8cb[_0xa993('0x2f')]['includeAll']){_0x3b1225[_0xa993('0x44')]=[{'all':!![]}];}_0x3b1225=_[_0xa993('0x45')]({},_0x3b1225,_0x17b8cb[_0xa993('0x3b')]);return db[_0xa993('0x2a')]['find'](_0x3b1225)[_0xa993('0x24')](handleEntityNotFound(_0x227813,null))[_0xa993('0x24')](respondWithResult(_0x227813,null))['catch'](handleError(_0x227813,null));};exports[_0xa993('0x46')]=function(_0x268ff1,_0x49ecbb){return db[_0xa993('0x2a')][_0xa993('0x46')](_0x268ff1[_0xa993('0x47')],{})[_0xa993('0x24')](respondWithResult(_0x49ecbb,0xc9))[_0xa993('0x40')](handleError(_0x49ecbb,null));};exports[_0xa993('0x23')]=function(_0x5bd8f3,_0x4398e6){if(_0x5bd8f3['body']['id']){delete _0x5bd8f3['body']['id'];}return db[_0xa993('0x2a')][_0xa993('0x48')]({'where':{'id':_0x5bd8f3['params']['id']}})['then'](handleEntityNotFound(_0x4398e6,null))[_0xa993('0x24')](saveUpdates(_0x5bd8f3[_0xa993('0x47')],null))[_0xa993('0x24')](respondWithResult(_0x4398e6,null))['catch'](handleError(_0x4398e6,null));};exports[_0xa993('0x25')]=function(_0x53c565,_0x21908b){return db[_0xa993('0x2a')][_0xa993('0x48')]({'where':{'id':_0x53c565[_0xa993('0x42')]['id']}})[_0xa993('0x24')](handleEntityNotFound(_0x21908b,null))[_0xa993('0x24')](removeEntity(_0x21908b,null))['catch'](handleError(_0x21908b,null));};exports[_0xa993('0x49')]=function(_0x25b7ad,_0x57fee7,_0x35928d){var _0x54613f={};var _0x154dae={};var _0xf372c8;var _0xf9cd52;return db[_0xa993('0x2a')][_0xa993('0x4a')]({'where':{'id':_0x25b7ad[_0xa993('0x42')]['id']}})[_0xa993('0x24')](handleEntityNotFound(_0x57fee7,null))[_0xa993('0x24')](function(_0x49427e){if(_0x49427e){_0xf372c8=_0x49427e;_0x154dae[_0xa993('0x2e')]=_[_0xa993('0x4b')](db[_0xa993('0x4c')][_0xa993('0x2b')]);_0x154dae[_0xa993('0x2f')]=_[_0xa993('0x4b')](_0x25b7ad[_0xa993('0x2f')]);_0x154dae[_0xa993('0x30')]=_[_0xa993('0x31')](_0x154dae[_0xa993('0x2e')],_0x154dae[_0xa993('0x2f')]);_0x54613f[_0xa993('0x33')]=_[_0xa993('0x31')](_0x154dae[_0xa993('0x2e')],qs[_0xa993('0x32')](_0x25b7ad[_0xa993('0x2f')][_0xa993('0x32')]));_0x54613f['attributes']=_0x54613f[_0xa993('0x33')][_0xa993('0x43')]?_0x54613f[_0xa993('0x33')]:_0x154dae[_0xa993('0x2e')];_0x54613f['order']=qs[_0xa993('0x37')](_0x25b7ad[_0xa993('0x2f')][_0xa993('0x37')]);_0x54613f[_0xa993('0x3c')]=qs[_0xa993('0x30')](_[_0xa993('0x38')](_0x25b7ad[_0xa993('0x2f')],_0x154dae['filters']));if(_0x25b7ad[_0xa993('0x2f')]['filter']){_0x54613f[_0xa993('0x3c')]=_['merge'](_0x54613f['where'],{'$or':_[_0xa993('0x39')](_0x54613f['attributes'],function(_0x39e96f){var _0x354cfb={};_0x354cfb[_0x39e96f]={'$like':'%'+_0x25b7ad[_0xa993('0x2f')]['filter']+'%'};return _0x354cfb;})});}_0x54613f=_[_0xa993('0x45')]({},_0x54613f,_0x25b7ad['options']);return _0xf372c8['getFields'](_0x54613f);}})['then'](function(_0x349c34){if(_0x349c34){_0xf9cd52=_0x349c34['length'];if(!_0x25b7ad[_0xa993('0x2f')][_0xa993('0x34')](_0xa993('0x35'))){_0x54613f[_0xa993('0x1c')]=qs[_0xa993('0x1c')](_0x25b7ad['query'][_0xa993('0x1c')]);_0x54613f[_0xa993('0x1d')]=qs[_0xa993('0x1d')](_0x25b7ad['query'][_0xa993('0x1d')]);}return _0xf372c8[_0xa993('0x49')](_0x54613f);}})['then'](function(_0x3b668d){if(_0x3b668d){return _0x3b668d?{'count':_0xf9cd52,'rows':_0x3b668d}:null;}})[_0xa993('0x24')](respondWithResult(_0x57fee7,null))[_0xa993('0x40')](handleError(_0x57fee7,null));};exports[_0xa993('0x4d')]=function(_0x47adc7,_0x36b9fc,_0x5d4f10){var _0x2d5fb={};var _0x349a82={};var _0x3ddbcc;var _0x3f8109;return db[_0xa993('0x2a')][_0xa993('0x4a')]({'where':{'id':_0x47adc7[_0xa993('0x42')]['id']}})[_0xa993('0x24')](handleEntityNotFound(_0x36b9fc,null))[_0xa993('0x24')](function(_0x507489){if(_0x507489){_0x3ddbcc=_0x507489;_0x349a82[_0xa993('0x2e')]=_[_0xa993('0x4b')](db[_0xa993('0x4c')][_0xa993('0x2b')]);_0x349a82['query']=_[_0xa993('0x4b')](_0x47adc7[_0xa993('0x2f')]);_0x349a82['filters']=_[_0xa993('0x31')](_0x349a82[_0xa993('0x2e')],_0x349a82[_0xa993('0x2f')]);_0x2d5fb[_0xa993('0x33')]=_['intersection'](_0x349a82[_0xa993('0x2e')],qs[_0xa993('0x32')](_0x47adc7[_0xa993('0x2f')]['fields']));_0x2d5fb[_0xa993('0x33')]=_0x2d5fb['attributes'][_0xa993('0x43')]?_0x2d5fb['attributes']:_0x349a82['model'];_0x2d5fb['order']=qs['sort'](_0x47adc7[_0xa993('0x2f')][_0xa993('0x37')]);_0x2d5fb['where']=qs[_0xa993('0x30')](_['pick'](_0x47adc7[_0xa993('0x2f')],_0x349a82[_0xa993('0x30')]));if(_0x47adc7[_0xa993('0x2f')][_0xa993('0x3a')]){_0x2d5fb[_0xa993('0x3c')]=_['merge'](_0x2d5fb[_0xa993('0x3c')],{'$or':_[_0xa993('0x39')](_0x2d5fb[_0xa993('0x33')],function(_0x270928){var _0x265042={};_0x265042[_0x270928]={'$like':'%'+_0x47adc7[_0xa993('0x2f')][_0xa993('0x3a')]+'%'};return _0x265042;})});}_0x2d5fb=_[_0xa993('0x45')]({},_0x2d5fb,_0x47adc7['options']);return _0x3ddbcc[_0xa993('0x4d')](_0x2d5fb);}})['then'](function(_0x327aae){if(_0x327aae){_0x3f8109=_0x327aae['length'];if(!_0x47adc7[_0xa993('0x2f')][_0xa993('0x34')](_0xa993('0x35'))){_0x2d5fb[_0xa993('0x1c')]=qs[_0xa993('0x1c')](_0x47adc7[_0xa993('0x2f')]['limit']);_0x2d5fb[_0xa993('0x1d')]=qs[_0xa993('0x1d')](_0x47adc7['query'][_0xa993('0x1d')]);}return _0x3ddbcc[_0xa993('0x4d')](_0x2d5fb);}})['then'](function(_0x282312){if(_0x282312){return _0x282312?{'count':_0x3f8109,'rows':_0x282312}:null;}})['then'](respondWithResult(_0x36b9fc,null))[_0xa993('0x40')](handleError(_0x36b9fc,null));};exports[_0xa993('0x4e')]=function(_0x1aa73e,_0x14fa2f,_0x53867c){var _0x1abd32={};var _0x136134={};var _0x202476;var _0x1085a5;return db[_0xa993('0x2a')][_0xa993('0x4a')]({'where':{'id':_0x1aa73e[_0xa993('0x42')]['id']}})[_0xa993('0x24')](handleEntityNotFound(_0x14fa2f,null))[_0xa993('0x24')](function(_0x4d8515){if(_0x4d8515){_0x202476=_0x4d8515;_0x136134[_0xa993('0x2e')]=_[_0xa993('0x4b')](db[_0xa993('0x4c')][_0xa993('0x2b')]);_0x136134[_0xa993('0x2f')]=_[_0xa993('0x4b')](_0x1aa73e[_0xa993('0x2f')]);_0x136134[_0xa993('0x30')]=_['intersection'](_0x136134[_0xa993('0x2e')],_0x136134['query']);_0x1abd32[_0xa993('0x33')]=_[_0xa993('0x31')](_0x136134[_0xa993('0x2e')],qs[_0xa993('0x32')](_0x1aa73e['query'][_0xa993('0x32')]));_0x1abd32['attributes']=_0x1abd32[_0xa993('0x33')][_0xa993('0x43')]?_0x1abd32[_0xa993('0x33')]:_0x136134[_0xa993('0x2e')];_0x1abd32[_0xa993('0x36')]=qs['sort'](_0x1aa73e['query']['sort']);_0x1abd32[_0xa993('0x3c')]=qs[_0xa993('0x30')](_[_0xa993('0x38')](_0x1aa73e[_0xa993('0x2f')],_0x136134[_0xa993('0x30')]));if(_0x1aa73e[_0xa993('0x2f')][_0xa993('0x3a')]){_0x1abd32[_0xa993('0x3c')]=_[_0xa993('0x45')](_0x1abd32[_0xa993('0x3c')],{'$or':_['map'](_0x1abd32['attributes'],function(_0x383477){var _0x1a9065={};_0x1a9065[_0x383477]={'$like':'%'+_0x1aa73e['query'][_0xa993('0x3a')]+'%'};return _0x1a9065;})});}_0x1abd32=_[_0xa993('0x45')]({},_0x1abd32,_0x1aa73e[_0xa993('0x3b')]);return _0x202476[_0xa993('0x4e')](_0x1abd32);}})[_0xa993('0x24')](function(_0x18ee4f){if(_0x18ee4f){_0x1085a5=_0x18ee4f[_0xa993('0x43')];if(!_0x1aa73e['query'][_0xa993('0x34')](_0xa993('0x35'))){_0x1abd32[_0xa993('0x1c')]=qs['limit'](_0x1aa73e[_0xa993('0x2f')][_0xa993('0x1c')]);_0x1abd32[_0xa993('0x1d')]=qs[_0xa993('0x1d')](_0x1aa73e[_0xa993('0x2f')][_0xa993('0x1d')]);}return _0x202476[_0xa993('0x4e')](_0x1abd32);}})[_0xa993('0x24')](function(_0x331c84){if(_0x331c84){return _0x331c84?{'count':_0x1085a5,'rows':_0x331c84}:null;}})[_0xa993('0x24')](respondWithResult(_0x14fa2f,null))[_0xa993('0x40')](handleError(_0x14fa2f,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d4d1516..c51fe45 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 _0x5754=['int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','ZohoConfiguration'];(function(_0x6c010c,_0x53d2ed){var _0x16e337=function(_0xa8ee27){while(--_0xa8ee27){_0x6c010c['push'](_0x6c010c['shift']());}};_0x16e337(++_0x53d2ed);}(_0x5754,0x145));var _0x4575=function(_0x598b74,_0xeacf55){_0x598b74=_0x598b74-0x0;var _0x2b1e6c=_0x5754[_0x598b74];return _0x2b1e6c;};'use strict';var _=require(_0x4575('0x0'));var util=require(_0x4575('0x1'));var logger=require(_0x4575('0x2'))(_0x4575('0x3'));var moment=require(_0x4575('0x4'));var BPromise=require(_0x4575('0x5'));var rp=require(_0x4575('0x6'));var fs=require('fs');var path=require(_0x4575('0x7'));var rimraf=require(_0x4575('0x8'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x4575('0x9')]=function(_0x237e8e,_0x506969){return _0x237e8e['define'](_0x4575('0xa'),attributes,{'tableName':_0x4575('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8321=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ZohoConfiguration','int_zoho_configurations'];(function(_0x553bf7,_0x4acdaa){var _0x24437f=function(_0x499e83){while(--_0x499e83){_0x553bf7['push'](_0x553bf7['shift']());}};_0x24437f(++_0x4acdaa);}(_0x8321,0x78));var _0x1832=function(_0x4996cc,_0x368ea3){_0x4996cc=_0x4996cc-0x0;var _0x37df6c=_0x8321[_0x4996cc];return _0x37df6c;};'use strict';var _=require(_0x1832('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1832('0x1'));var moment=require(_0x1832('0x2'));var BPromise=require(_0x1832('0x3'));var rp=require(_0x1832('0x4'));var fs=require('fs');var path=require(_0x1832('0x5'));var rimraf=require(_0x1832('0x6'));var config=require(_0x1832('0x7'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x26a9a2,_0x1397ec){return _0x26a9a2['define'](_0x1832('0x8'),attributes,{'tableName':_0x1832('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 fc34529..5b8639c 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 _0x7759=['code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x7759,0xe1));var _0x9775=function(_0x5c5b3f,_0x451d2f){_0x5c5b3f=_0x5c5b3f-0x0;var _0x567a0e=_0x7759[_0x5c5b3f];return _0x567a0e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9775('0x0'));var rs=require(_0x9775('0x1'));var fs=require('fs');var Redis=require(_0x9775('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9775('0x3'))('rpc');var config=require(_0x9775('0x4'));var jayson=require(_0x9775('0x5'));var client=jayson[_0x9775('0x6')][_0x9775('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3ba38a,_0x4ed211,_0x33de36){return new BPromise(function(_0x5c7604,_0x569717){return client[_0x9775('0x8')](_0x3ba38a,_0x33de36)[_0x9775('0x9')](function(_0x1beeff){logger[_0x9775('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x4ed211,_0x9775('0xb'));logger[_0x9775('0xc')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4ed211,_0x9775('0xb'),JSON[_0x9775('0xd')](_0x1beeff));if(_0x1beeff[_0x9775('0xe')]){if(_0x1beeff[_0x9775('0xe')][_0x9775('0xf')]===0x1f4){logger['error'](_0x9775('0x10'),_0x4ed211,_0x1beeff[_0x9775('0xe')]['message']);return _0x569717(_0x1beeff['error']['message']);}logger[_0x9775('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x4ed211,_0x1beeff[_0x9775('0xe')]['message']);return _0x5c7604(_0x1beeff['error'][_0x9775('0x11')]);}else{logger[_0x9775('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x4ed211,_0x9775('0xb'));_0x5c7604(_0x1beeff[_0x9775('0x12')][_0x9775('0x11')]);}})[_0x9775('0x13')](function(_0x56b8fd){logger[_0x9775('0xe')](_0x9775('0x10'),_0x4ed211,_0x56b8fd);_0x569717(_0x56b8fd);});});} \ No newline at end of file +var _0x1171=['info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x1171,0x153));var _0x1117=function(_0x1bb0b6,_0x1734b7){_0x1bb0b6=_0x1bb0b6-0x0;var _0x45f16b=_0x1171[_0x1bb0b6];return _0x45f16b;};'use strict';var _=require(_0x1117('0x0'));var util=require(_0x1117('0x1'));var moment=require(_0x1117('0x2'));var BPromise=require('bluebird');var rs=require(_0x1117('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1117('0x4'))['db'];var utils=require(_0x1117('0x5'));var logger=require(_0x1117('0x6'))(_0x1117('0x7'));var config=require(_0x1117('0x8'));var jayson=require(_0x1117('0x9'));var client=jayson[_0x1117('0xa')][_0x1117('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x508d5c,_0x4439af,_0x275d79){return new BPromise(function(_0x1c0dd7,_0x3ce174){return client[_0x1117('0xc')](_0x508d5c,_0x275d79)[_0x1117('0xd')](function(_0x2fb9c7){logger['info'](_0x1117('0xe'),_0x4439af,_0x1117('0xf'));logger[_0x1117('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x4439af,_0x1117('0xf'),JSON[_0x1117('0x11')](_0x2fb9c7));if(_0x2fb9c7[_0x1117('0x12')]){if(_0x2fb9c7[_0x1117('0x12')][_0x1117('0x13')]===0x1f4){logger['error'](_0x1117('0xe'),_0x4439af,_0x2fb9c7[_0x1117('0x12')][_0x1117('0x14')]);return _0x3ce174(_0x2fb9c7[_0x1117('0x12')]['message']);}logger[_0x1117('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4439af,_0x2fb9c7[_0x1117('0x12')][_0x1117('0x14')]);return _0x1c0dd7(_0x2fb9c7['error'][_0x1117('0x14')]);}else{logger[_0x1117('0x15')]('ZohoConfiguration,\x20%s,\x20%s',_0x4439af,_0x1117('0xf'));_0x1c0dd7(_0x2fb9c7[_0x1117('0x16')][_0x1117('0x14')]);}})[_0x1117('0x17')](function(_0x2537e1){logger[_0x1117('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x4439af,_0x2537e1);_0x3ce174(_0x2537e1);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index d4ff964..c07ffec 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 _0xb24b=['update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x4d2263,_0x3fbf0d){var _0x24aba0=function(_0x389a59){while(--_0x389a59){_0x4d2263['push'](_0x4d2263['shift']());}};_0x24aba0(++_0x3fbf0d);}(_0xb24b,0x158));var _0xbb24=function(_0x1d9378,_0xb3dd8b){_0x1d9378=_0x1d9378-0x0;var _0x307c99=_0xb24b[_0x1d9378];return _0x307c99;};'use strict';var multer=require(_0xbb24('0x0'));var util=require('util');var path=require(_0xbb24('0x1'));var timeout=require(_0xbb24('0x2'));var express=require(_0xbb24('0x3'));var router=express[_0xbb24('0x4')]();var fs_extra=require(_0xbb24('0x5'));var auth=require(_0xbb24('0x6'));var interaction=require(_0xbb24('0x7'));var config=require(_0xbb24('0x8'));var controller=require(_0xbb24('0x9'));router[_0xbb24('0xa')]('/',auth[_0xbb24('0xb')](),controller[_0xbb24('0xc')]);router[_0xbb24('0xa')](_0xbb24('0xd'),auth[_0xbb24('0xb')](),controller['show']);router[_0xbb24('0xe')]('/',auth[_0xbb24('0xb')](),controller[_0xbb24('0xf')]);router[_0xbb24('0x10')]('/:id',auth[_0xbb24('0xb')](),controller[_0xbb24('0x11')]);router['delete']('/:id',auth[_0xbb24('0xb')](),controller['destroy']);module[_0xbb24('0x12')]=router; \ No newline at end of file +var _0x76e4=['../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x1bd893,_0x45bf29){var _0x4e6e46=function(_0x3d0424){while(--_0x3d0424){_0x1bd893['push'](_0x1bd893['shift']());}};_0x4e6e46(++_0x45bf29);}(_0x76e4,0xb8));var _0x476e=function(_0xe2d6a0,_0x5d4ee2){_0xe2d6a0=_0xe2d6a0-0x0;var _0x17b9c3=_0x76e4[_0xe2d6a0];return _0x17b9c3;};'use strict';var multer=require(_0x476e('0x0'));var util=require(_0x476e('0x1'));var path=require(_0x476e('0x2'));var timeout=require(_0x476e('0x3'));var express=require('express');var router=express[_0x476e('0x4')]();var fs_extra=require(_0x476e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x476e('0x6'));var config=require('../../config/environment');var controller=require(_0x476e('0x7'));router[_0x476e('0x8')]('/',auth[_0x476e('0x9')](),controller[_0x476e('0xa')]);router[_0x476e('0x8')](_0x476e('0xb'),auth[_0x476e('0x9')](),controller[_0x476e('0xc')]);router[_0x476e('0xd')]('/',auth[_0x476e('0x9')](),controller[_0x476e('0xe')]);router[_0x476e('0xf')](_0x476e('0xb'),auth['isAuthenticated'](),controller[_0x476e('0x10')]);router[_0x476e('0x11')]('/:id',auth[_0x476e('0x9')](),controller['destroy']);module[_0x476e('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 3cab890..1c802bf 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 _0xcdb3=['customVariable','keyValue','picklist','STRING','sequelize','exports','string','variable'];(function(_0x14d250,_0x4b2e12){var _0xb991d8=function(_0x4ea76d){while(--_0x4ea76d){_0x14d250['push'](_0x14d250['shift']());}};_0xb991d8(++_0x4b2e12);}(_0xcdb3,0x12c));var _0x3cdb=function(_0x3aac0e,_0x14d5cb){_0x3aac0e=_0x3aac0e-0x0;var _0x57bd99=_0xcdb3[_0x3aac0e];return _0x57bd99;};'use strict';var Sequelize=require(_0x3cdb('0x0'));module[_0x3cdb('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3cdb('0x2'),_0x3cdb('0x3'),_0x3cdb('0x4'),_0x3cdb('0x5'),_0x3cdb('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3cdb('0x7')]},'key':{'type':Sequelize[_0x3cdb('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x3cdb('0x2'),_0x3cdb('0x3'),_0x3cdb('0x4'))},'keyContent':{'type':Sequelize[_0x3cdb('0x7')]},'idField':{'type':Sequelize[_0x3cdb('0x7')]},'nameField':{'type':Sequelize[_0x3cdb('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3cdb('0x7')]}}; \ No newline at end of file +var _0x773f=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2d4c2d,_0x3a7895){var _0x25f284=function(_0x38c119){while(--_0x38c119){_0x2d4c2d['push'](_0x2d4c2d['shift']());}};_0x25f284(++_0x3a7895);}(_0x773f,0x15e));var _0xf773=function(_0x1ce236,_0xca922e){_0x1ce236=_0x1ce236-0x0;var _0x241819=_0x773f[_0x1ce236];return _0x241819;};'use strict';var Sequelize=require(_0xf773('0x0'));module[_0xf773('0x1')]={'type':{'type':Sequelize[_0xf773('0x2')](_0xf773('0x3'),_0xf773('0x4'),_0xf773('0x5'),_0xf773('0x6'),_0xf773('0x7')),'defaultValue':_0xf773('0x3')},'content':{'type':Sequelize[_0xf773('0x8')]},'key':{'type':Sequelize[_0xf773('0x8')]},'keyType':{'type':Sequelize[_0xf773('0x2')](_0xf773('0x3'),_0xf773('0x4'),_0xf773('0x5'))},'keyContent':{'type':Sequelize[_0xf773('0x8')]},'idField':{'type':Sequelize[_0xf773('0x8')]},'nameField':{'type':Sequelize[_0xf773('0x8')]},'customField':{'type':Sequelize[_0xf773('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf773('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a8eddd0..2fe8832 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 _0xe354=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','apply','save','update','destroy','then','status','error','stack','index','map','ZohoField','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe354,0x12d));var _0x4e35=function(_0x46647a,_0x36fcfd){_0x46647a=_0x46647a-0x0;var _0xcd199b=_0xe354[_0x46647a];return _0xcd199b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4e35('0x0'));var rp=require(_0x4e35('0x1'));var moment=require(_0x4e35('0x2'));var BPromise=require(_0x4e35('0x3'));var Mustache=require(_0x4e35('0x4'));var util=require(_0x4e35('0x5'));var path=require(_0x4e35('0x6'));var sox=require('sox');var csv=require(_0x4e35('0x7'));var ejs=require(_0x4e35('0x8'));var fs=require('fs');var fs_extra=require(_0x4e35('0x9'));var _=require(_0x4e35('0xa'));var squel=require('squel');var crypto=require(_0x4e35('0xb'));var jsforce=require(_0x4e35('0xc'));var deskjs=require(_0x4e35('0xd'));var toCsv=require(_0x4e35('0x7'));var querystring=require(_0x4e35('0xe'));var Papa=require(_0x4e35('0xf'));var Redis=require(_0x4e35('0x10'));var authService=require(_0x4e35('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4e35('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e35('0x13'))(_0x4e35('0x14'));var utils=require(_0x4e35('0x15'));var config=require(_0x4e35('0x16'));var licenseUtil=require(_0x4e35('0x17'));var db=require(_0x4e35('0x18'))['db'];function respondWithStatusCode(_0x191ec0,_0x553a25){_0x553a25=_0x553a25||0xcc;return function(_0x382fd0){if(_0x382fd0){return _0x191ec0[_0x4e35('0x19')](_0x553a25);}return _0x191ec0['status'](_0x553a25)['end']();};}function respondWithResult(_0x2a98e1,_0x47b937){_0x47b937=_0x47b937||0xc8;return function(_0x28d542){if(_0x28d542){return _0x2a98e1['status'](_0x47b937)[_0x4e35('0x1a')](_0x28d542);}};}function respondWithFilteredResult(_0x20aff2,_0x900d99){return function(_0x569f7a){if(_0x569f7a){var _0x44eb7d=typeof _0x900d99[_0x4e35('0x1b')]===_0x4e35('0x1c')&&typeof _0x900d99[_0x4e35('0x1d')]===_0x4e35('0x1c');var _0x5b1d4b=_0x569f7a['count'];var _0x31f249=_0x44eb7d?0x0:_0x900d99[_0x4e35('0x1b')];var _0x39cf18=_0x44eb7d?_0x569f7a[_0x4e35('0x1e')]:_0x900d99[_0x4e35('0x1b')]+_0x900d99[_0x4e35('0x1d')];var _0x1815c7;if(_0x39cf18>=_0x5b1d4b){_0x39cf18=_0x5b1d4b;_0x1815c7=0xc8;}else{_0x1815c7=0xce;}_0x20aff2['status'](_0x1815c7);return _0x20aff2['set']('Content-Range',_0x31f249+'-'+_0x39cf18+'/'+_0x5b1d4b)['json'](_0x569f7a);}return null;};}function patchUpdates(_0x1f11b5){return function(_0x44f937){try{jsonpatch[_0x4e35('0x1f')](_0x44f937,_0x1f11b5,!![]);}catch(_0x30d8ad){return BPromise['reject'](_0x30d8ad);}return _0x44f937[_0x4e35('0x20')]();};}function saveUpdates(_0x43e394,_0x15760b){return function(_0x3ea943){if(_0x3ea943){return _0x3ea943[_0x4e35('0x21')](_0x43e394)['then'](function(_0x41d244){return _0x41d244;});}return null;};}function removeEntity(_0x2afd81,_0x59c536){return function(_0x1fabcb){if(_0x1fabcb){return _0x1fabcb[_0x4e35('0x22')]()[_0x4e35('0x23')](function(){_0x2afd81[_0x4e35('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x173914,_0x1ba284){return function(_0x243fa3){if(!_0x243fa3){_0x173914[_0x4e35('0x19')](0x194);}return _0x243fa3;};}function handleError(_0x3b75e5,_0x234602){_0x234602=_0x234602||0x1f4;return function(_0x41ab41){logger[_0x4e35('0x25')](_0x41ab41[_0x4e35('0x26')]);if(_0x41ab41['name']){delete _0x41ab41['name'];}_0x3b75e5['status'](_0x234602)['send'](_0x41ab41);};}exports[_0x4e35('0x27')]=function(_0x3f3104,_0x46150f){var _0x33632f={},_0x47d28b={},_0x49c0d6={'count':0x0,'rows':[]};var _0x55ad9e=_[_0x4e35('0x28')](db[_0x4e35('0x29')]['rawAttributes'],function(_0x2ed07f){return{'name':_0x2ed07f[_0x4e35('0x2a')],'type':_0x2ed07f[_0x4e35('0x2b')][_0x4e35('0x2c')]};});_0x47d28b[_0x4e35('0x2d')]=_[_0x4e35('0x28')](_0x55ad9e,_0x4e35('0x2e'));_0x47d28b[_0x4e35('0x2f')]=_[_0x4e35('0x30')](_0x3f3104[_0x4e35('0x2f')]);_0x47d28b[_0x4e35('0x31')]=_[_0x4e35('0x32')](_0x47d28b[_0x4e35('0x2d')],_0x47d28b[_0x4e35('0x2f')]);_0x33632f[_0x4e35('0x33')]=_[_0x4e35('0x32')](_0x47d28b[_0x4e35('0x2d')],qs[_0x4e35('0x34')](_0x3f3104[_0x4e35('0x2f')]['fields']));_0x33632f['attributes']=_0x33632f[_0x4e35('0x33')]['length']?_0x33632f[_0x4e35('0x33')]:_0x47d28b[_0x4e35('0x2d')];if(!_0x3f3104[_0x4e35('0x2f')][_0x4e35('0x35')](_0x4e35('0x36'))){_0x33632f[_0x4e35('0x1d')]=qs[_0x4e35('0x1d')](_0x3f3104[_0x4e35('0x2f')][_0x4e35('0x1d')]);_0x33632f[_0x4e35('0x1b')]=qs[_0x4e35('0x1b')](_0x3f3104[_0x4e35('0x2f')][_0x4e35('0x1b')]);}_0x33632f['order']=qs[_0x4e35('0x37')](_0x3f3104[_0x4e35('0x2f')][_0x4e35('0x37')]);_0x33632f[_0x4e35('0x38')]=qs['filters'](_['pick'](_0x3f3104[_0x4e35('0x2f')],_0x47d28b[_0x4e35('0x31')]),_0x55ad9e);if(_0x3f3104['query'][_0x4e35('0x39')]){_0x33632f[_0x4e35('0x38')]=_['merge'](_0x33632f['where'],{'$or':_[_0x4e35('0x28')](_0x55ad9e,function(_0x563b36){if(_0x563b36['type']!==_0x4e35('0x3a')){var _0xbd8a17={};_0xbd8a17[_0x563b36[_0x4e35('0x2e')]]={'$like':'%'+_0x3f3104[_0x4e35('0x2f')]['filter']+'%'};return _0xbd8a17;}})});}_0x33632f=_['merge']({},_0x33632f,_0x3f3104[_0x4e35('0x3b')]);var _0x1e2ad9={'where':_0x33632f[_0x4e35('0x38')]};return db[_0x4e35('0x29')]['count'](_0x1e2ad9)['then'](function(_0x1ca4a8){_0x49c0d6[_0x4e35('0x1e')]=_0x1ca4a8;if(_0x3f3104[_0x4e35('0x2f')][_0x4e35('0x3c')]){_0x33632f[_0x4e35('0x3d')]=[{'all':!![]}];}return db[_0x4e35('0x29')][_0x4e35('0x3e')](_0x33632f);})[_0x4e35('0x23')](function(_0x2a0cbc){_0x49c0d6[_0x4e35('0x3f')]=_0x2a0cbc;return _0x49c0d6;})[_0x4e35('0x23')](respondWithFilteredResult(_0x46150f,_0x33632f))[_0x4e35('0x40')](handleError(_0x46150f,null));};exports[_0x4e35('0x41')]=function(_0x3947a3,_0x382477){var _0x420a56={'raw':!![],'where':{'id':_0x3947a3[_0x4e35('0x42')]['id']}},_0x6f29e2={};_0x6f29e2[_0x4e35('0x2d')]=_[_0x4e35('0x30')](db[_0x4e35('0x29')][_0x4e35('0x43')]);_0x6f29e2[_0x4e35('0x2f')]=_['keys'](_0x3947a3[_0x4e35('0x2f')]);_0x6f29e2[_0x4e35('0x31')]=_['intersection'](_0x6f29e2['model'],_0x6f29e2[_0x4e35('0x2f')]);_0x420a56[_0x4e35('0x33')]=_[_0x4e35('0x32')](_0x6f29e2[_0x4e35('0x2d')],qs[_0x4e35('0x34')](_0x3947a3[_0x4e35('0x2f')]['fields']));_0x420a56[_0x4e35('0x33')]=_0x420a56['attributes'][_0x4e35('0x44')]?_0x420a56[_0x4e35('0x33')]:_0x6f29e2[_0x4e35('0x2d')];if(_0x3947a3[_0x4e35('0x2f')][_0x4e35('0x3c')]){_0x420a56[_0x4e35('0x3d')]=[{'all':!![]}];}_0x420a56=_['merge']({},_0x420a56,_0x3947a3['options']);return db[_0x4e35('0x29')]['find'](_0x420a56)['then'](handleEntityNotFound(_0x382477,null))['then'](respondWithResult(_0x382477,null))['catch'](handleError(_0x382477,null));};exports[_0x4e35('0x45')]=function(_0x90e065,_0x2ef4a4){return db[_0x4e35('0x29')]['create'](_0x90e065['body'],{})['then'](respondWithResult(_0x2ef4a4,0xc9))[_0x4e35('0x40')](handleError(_0x2ef4a4,null));};exports[_0x4e35('0x21')]=function(_0x1f98a6,_0x295238){if(_0x1f98a6[_0x4e35('0x46')]['id']){delete _0x1f98a6[_0x4e35('0x46')]['id'];}return db['ZohoField'][_0x4e35('0x47')]({'where':{'id':_0x1f98a6[_0x4e35('0x42')]['id']}})[_0x4e35('0x23')](handleEntityNotFound(_0x295238,null))['then'](saveUpdates(_0x1f98a6[_0x4e35('0x46')],null))[_0x4e35('0x23')](respondWithResult(_0x295238,null))[_0x4e35('0x40')](handleError(_0x295238,null));};exports[_0x4e35('0x22')]=function(_0x1e6537,_0x305a30){return db[_0x4e35('0x29')]['find']({'where':{'id':_0x1e6537[_0x4e35('0x42')]['id']}})[_0x4e35('0x23')](handleEntityNotFound(_0x305a30,null))[_0x4e35('0x23')](removeEntity(_0x305a30,null))['catch'](handleError(_0x305a30,null));}; \ No newline at end of file +var _0xe667=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','ZohoField','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x47a54c,_0x22229c){var _0x33abad=function(_0x1b7816){while(--_0x1b7816){_0x47a54c['push'](_0x47a54c['shift']());}};_0x33abad(++_0x22229c);}(_0xe667,0x10c));var _0x7e66=function(_0x466a2f,_0x1ff91d){_0x466a2f=_0x466a2f-0x0;var _0x16be9c=_0xe667[_0x466a2f];return _0x16be9c;};'use strict';var emlformat=require(_0x7e66('0x0'));var rimraf=require(_0x7e66('0x1'));var zipdir=require(_0x7e66('0x2'));var jsonpatch=require(_0x7e66('0x3'));var rp=require('request-promise');var moment=require(_0x7e66('0x4'));var BPromise=require(_0x7e66('0x5'));var Mustache=require(_0x7e66('0x6'));var util=require(_0x7e66('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7e66('0x8'));var fs=require('fs');var fs_extra=require(_0x7e66('0x9'));var _=require('lodash');var squel=require(_0x7e66('0xa'));var crypto=require(_0x7e66('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e66('0xc'));var querystring=require('querystring');var Papa=require(_0x7e66('0xd'));var Redis=require('ioredis');var authService=require(_0x7e66('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7e66('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7e66('0x10'))(_0x7e66('0x11'));var utils=require(_0x7e66('0x12'));var config=require(_0x7e66('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e66('0x14'))['db'];function respondWithStatusCode(_0x58660c,_0x5d6824){_0x5d6824=_0x5d6824||0xcc;return function(_0x3b0895){if(_0x3b0895){return _0x58660c[_0x7e66('0x15')](_0x5d6824);}return _0x58660c['status'](_0x5d6824)[_0x7e66('0x16')]();};}function respondWithResult(_0x35e0ce,_0x3468b9){_0x3468b9=_0x3468b9||0xc8;return function(_0x3315db){if(_0x3315db){return _0x35e0ce['status'](_0x3468b9)['json'](_0x3315db);}};}function respondWithFilteredResult(_0x33fb7b,_0x48d320){return function(_0x581693){if(_0x581693){var _0x540131=typeof _0x48d320[_0x7e66('0x17')]===_0x7e66('0x18')&&typeof _0x48d320[_0x7e66('0x19')]===_0x7e66('0x18');var _0x1ab2e8=_0x581693[_0x7e66('0x1a')];var _0x3d8f44=_0x540131?0x0:_0x48d320[_0x7e66('0x17')];var _0x1b1b3d=_0x540131?_0x581693[_0x7e66('0x1a')]:_0x48d320['offset']+_0x48d320[_0x7e66('0x19')];var _0x1864d7;if(_0x1b1b3d>=_0x1ab2e8){_0x1b1b3d=_0x1ab2e8;_0x1864d7=0xc8;}else{_0x1864d7=0xce;}_0x33fb7b[_0x7e66('0x1b')](_0x1864d7);return _0x33fb7b['set'](_0x7e66('0x1c'),_0x3d8f44+'-'+_0x1b1b3d+'/'+_0x1ab2e8)[_0x7e66('0x1d')](_0x581693);}return null;};}function patchUpdates(_0x175e6d){return function(_0xeb4ea0){try{jsonpatch[_0x7e66('0x1e')](_0xeb4ea0,_0x175e6d,!![]);}catch(_0x4e03cc){return BPromise['reject'](_0x4e03cc);}return _0xeb4ea0[_0x7e66('0x1f')]();};}function saveUpdates(_0x3e3db3,_0x112a26){return function(_0x1b774e){if(_0x1b774e){return _0x1b774e[_0x7e66('0x20')](_0x3e3db3)[_0x7e66('0x21')](function(_0x365c34){return _0x365c34;});}return null;};}function removeEntity(_0x275d0d,_0x1c4e13){return function(_0x2433c1){if(_0x2433c1){return _0x2433c1[_0x7e66('0x22')]()[_0x7e66('0x21')](function(){_0x275d0d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4db287,_0x46d755){return function(_0x113b5f){if(!_0x113b5f){_0x4db287['sendStatus'](0x194);}return _0x113b5f;};}function handleError(_0xda4008,_0x3696a1){_0x3696a1=_0x3696a1||0x1f4;return function(_0x2cef06){logger[_0x7e66('0x23')](_0x2cef06[_0x7e66('0x24')]);if(_0x2cef06[_0x7e66('0x25')]){delete _0x2cef06[_0x7e66('0x25')];}_0xda4008[_0x7e66('0x1b')](_0x3696a1)[_0x7e66('0x26')](_0x2cef06);};}exports[_0x7e66('0x27')]=function(_0xb5880b,_0x42f8ed){var _0x2e6042={},_0x1afd74={},_0x1ad945={'count':0x0,'rows':[]};var _0x211683=_['map'](db[_0x7e66('0x28')]['rawAttributes'],function(_0x59f8d2){return{'name':_0x59f8d2[_0x7e66('0x29')],'type':_0x59f8d2[_0x7e66('0x2a')][_0x7e66('0x2b')]};});_0x1afd74[_0x7e66('0x2c')]=_[_0x7e66('0x2d')](_0x211683,_0x7e66('0x25'));_0x1afd74[_0x7e66('0x2e')]=_['keys'](_0xb5880b[_0x7e66('0x2e')]);_0x1afd74[_0x7e66('0x2f')]=_['intersection'](_0x1afd74[_0x7e66('0x2c')],_0x1afd74['query']);_0x2e6042['attributes']=_[_0x7e66('0x30')](_0x1afd74['model'],qs[_0x7e66('0x31')](_0xb5880b[_0x7e66('0x2e')][_0x7e66('0x31')]));_0x2e6042[_0x7e66('0x32')]=_0x2e6042[_0x7e66('0x32')][_0x7e66('0x33')]?_0x2e6042[_0x7e66('0x32')]:_0x1afd74[_0x7e66('0x2c')];if(!_0xb5880b['query'][_0x7e66('0x34')](_0x7e66('0x35'))){_0x2e6042[_0x7e66('0x19')]=qs['limit'](_0xb5880b[_0x7e66('0x2e')]['limit']);_0x2e6042[_0x7e66('0x17')]=qs['offset'](_0xb5880b[_0x7e66('0x2e')][_0x7e66('0x17')]);}_0x2e6042[_0x7e66('0x36')]=qs[_0x7e66('0x37')](_0xb5880b[_0x7e66('0x2e')][_0x7e66('0x37')]);_0x2e6042[_0x7e66('0x38')]=qs[_0x7e66('0x2f')](_['pick'](_0xb5880b[_0x7e66('0x2e')],_0x1afd74[_0x7e66('0x2f')]),_0x211683);if(_0xb5880b[_0x7e66('0x2e')][_0x7e66('0x39')]){_0x2e6042[_0x7e66('0x38')]=_[_0x7e66('0x3a')](_0x2e6042[_0x7e66('0x38')],{'$or':_[_0x7e66('0x2d')](_0x211683,function(_0x270516){if(_0x270516['type']!==_0x7e66('0x3b')){var _0x2b87a2={};_0x2b87a2[_0x270516[_0x7e66('0x25')]]={'$like':'%'+_0xb5880b[_0x7e66('0x2e')]['filter']+'%'};return _0x2b87a2;}})});}_0x2e6042=_[_0x7e66('0x3a')]({},_0x2e6042,_0xb5880b[_0x7e66('0x3c')]);var _0x2f140e={'where':_0x2e6042[_0x7e66('0x38')]};return db[_0x7e66('0x28')][_0x7e66('0x1a')](_0x2f140e)[_0x7e66('0x21')](function(_0x3a292a){_0x1ad945[_0x7e66('0x1a')]=_0x3a292a;if(_0xb5880b[_0x7e66('0x2e')][_0x7e66('0x3d')]){_0x2e6042[_0x7e66('0x3e')]=[{'all':!![]}];}return db[_0x7e66('0x28')][_0x7e66('0x3f')](_0x2e6042);})[_0x7e66('0x21')](function(_0x7d3b34){_0x1ad945['rows']=_0x7d3b34;return _0x1ad945;})[_0x7e66('0x21')](respondWithFilteredResult(_0x42f8ed,_0x2e6042))[_0x7e66('0x40')](handleError(_0x42f8ed,null));};exports['show']=function(_0x217a35,_0x1c3af9){var _0xb447ab={'raw':!![],'where':{'id':_0x217a35[_0x7e66('0x41')]['id']}},_0xafa651={};_0xafa651[_0x7e66('0x2c')]=_[_0x7e66('0x42')](db['ZohoField'][_0x7e66('0x43')]);_0xafa651['query']=_[_0x7e66('0x42')](_0x217a35[_0x7e66('0x2e')]);_0xafa651[_0x7e66('0x2f')]=_[_0x7e66('0x30')](_0xafa651[_0x7e66('0x2c')],_0xafa651[_0x7e66('0x2e')]);_0xb447ab[_0x7e66('0x32')]=_[_0x7e66('0x30')](_0xafa651[_0x7e66('0x2c')],qs[_0x7e66('0x31')](_0x217a35[_0x7e66('0x2e')]['fields']));_0xb447ab[_0x7e66('0x32')]=_0xb447ab[_0x7e66('0x32')][_0x7e66('0x33')]?_0xb447ab[_0x7e66('0x32')]:_0xafa651[_0x7e66('0x2c')];if(_0x217a35[_0x7e66('0x2e')][_0x7e66('0x3d')]){_0xb447ab['include']=[{'all':!![]}];}_0xb447ab=_['merge']({},_0xb447ab,_0x217a35[_0x7e66('0x3c')]);return db[_0x7e66('0x28')][_0x7e66('0x44')](_0xb447ab)['then'](handleEntityNotFound(_0x1c3af9,null))['then'](respondWithResult(_0x1c3af9,null))[_0x7e66('0x40')](handleError(_0x1c3af9,null));};exports['create']=function(_0x5f2727,_0x324594){return db[_0x7e66('0x28')][_0x7e66('0x45')](_0x5f2727[_0x7e66('0x46')],{})[_0x7e66('0x21')](respondWithResult(_0x324594,0xc9))[_0x7e66('0x40')](handleError(_0x324594,null));};exports[_0x7e66('0x20')]=function(_0x2911c6,_0x412340){if(_0x2911c6[_0x7e66('0x46')]['id']){delete _0x2911c6[_0x7e66('0x46')]['id'];}return db['ZohoField'][_0x7e66('0x44')]({'where':{'id':_0x2911c6['params']['id']}})[_0x7e66('0x21')](handleEntityNotFound(_0x412340,null))[_0x7e66('0x21')](saveUpdates(_0x2911c6['body'],null))[_0x7e66('0x21')](respondWithResult(_0x412340,null))['catch'](handleError(_0x412340,null));};exports[_0x7e66('0x22')]=function(_0x12248a,_0x3b8f5a){return db[_0x7e66('0x28')][_0x7e66('0x44')]({'where':{'id':_0x12248a['params']['id']}})[_0x7e66('0x21')](handleEntityNotFound(_0x3b8f5a,null))[_0x7e66('0x21')](removeEntity(_0x3b8f5a,null))[_0x7e66('0x40')](handleError(_0x3b8f5a,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 49db744..5c4dab6 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 _0x01d9=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xf'),_0x901d('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x32b6=['int_zoho_fields','idField','FieldId','lodash','util','api','moment','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField'];(function(_0x15b1cd,_0x2db0c5){var _0x73f160=function(_0x23dd5c){while(--_0x23dd5c){_0x15b1cd['push'](_0x15b1cd['shift']());}};_0x73f160(++_0x2db0c5);}(_0x32b6,0x1d1));var _0x632b=function(_0x479d81,_0x401ddb){_0x479d81=_0x479d81-0x0;var _0x1edf66=_0x32b6[_0x479d81];return _0x1edf66;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));module[_0x632b('0x8')]=function(_0x122768,_0x24ceab){return _0x122768[_0x632b('0x9')](_0x632b('0xa'),attributes,{'tableName':_0x632b('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x632b('0xc'),_0x632b('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 6be6dd2..d033801 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 _0xd997=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','message','error','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xd997,0x1f2));var _0x7d99=function(_0x394879,_0x147fb3){_0x394879=_0x394879-0x0;var _0x5186f8=_0xd997[_0x394879];return _0x5186f8;};'use strict';var _=require(_0x7d99('0x0'));var util=require(_0x7d99('0x1'));var moment=require(_0x7d99('0x2'));var BPromise=require(_0x7d99('0x3'));var rs=require(_0x7d99('0x4'));var fs=require('fs');var Redis=require(_0x7d99('0x5'));var db=require(_0x7d99('0x6'))['db'];var utils=require(_0x7d99('0x7'));var logger=require(_0x7d99('0x8'))(_0x7d99('0x9'));var config=require(_0x7d99('0xa'));var jayson=require(_0x7d99('0xb'));var client=jayson['client'][_0x7d99('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cf0f7,_0x3c5a9e,_0x16d0a6){return new BPromise(function(_0x2ac551,_0x4e37c8){return client[_0x7d99('0xd')](_0x1cf0f7,_0x16d0a6)['then'](function(_0x4210fe){logger[_0x7d99('0xe')](_0x7d99('0xf'),_0x3c5a9e,_0x7d99('0x10'));logger['debug'](_0x7d99('0x11'),_0x3c5a9e,_0x7d99('0x10'),JSON[_0x7d99('0x12')](_0x4210fe));if(_0x4210fe['error']){if(_0x4210fe['error']['code']===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x3c5a9e,_0x4210fe['error'][_0x7d99('0x13')]);return _0x4e37c8(_0x4210fe[_0x7d99('0x14')][_0x7d99('0x13')]);}logger[_0x7d99('0x14')](_0x7d99('0xf'),_0x3c5a9e,_0x4210fe[_0x7d99('0x14')][_0x7d99('0x13')]);return _0x2ac551(_0x4210fe[_0x7d99('0x14')][_0x7d99('0x13')]);}else{logger[_0x7d99('0xe')]('ZohoField,\x20%s,\x20%s',_0x3c5a9e,_0x7d99('0x10'));_0x2ac551(_0x4210fe[_0x7d99('0x15')][_0x7d99('0x13')]);}})['catch'](function(_0x536122){logger['error'](_0x7d99('0xf'),_0x3c5a9e,_0x536122);_0x4e37c8(_0x536122);});});} \ No newline at end of file +var _0x37bd=['message','info','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x322410,_0x1bce3a){var _0x4f31cd=function(_0x565777){while(--_0x565777){_0x322410['push'](_0x322410['shift']());}};_0x4f31cd(++_0x1bce3a);}(_0x37bd,0x1a0));var _0xd37b=function(_0x52ff7d,_0x8d1675){_0x52ff7d=_0x52ff7d-0x0;var _0x5142a4=_0x37bd[_0x52ff7d];return _0x5142a4;};'use strict';var _=require(_0xd37b('0x0'));var util=require(_0xd37b('0x1'));var moment=require(_0xd37b('0x2'));var BPromise=require(_0xd37b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd37b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd37b('0x5'));var logger=require(_0xd37b('0x6'))(_0xd37b('0x7'));var config=require(_0xd37b('0x8'));var jayson=require(_0xd37b('0x9'));var client=jayson[_0xd37b('0xa')][_0xd37b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4906c7,_0x3743be,_0x3b2677){return new BPromise(function(_0x24fedd,_0x42ed9a){return client[_0xd37b('0xc')](_0x4906c7,_0x3b2677)[_0xd37b('0xd')](function(_0x2a5048){logger['info'](_0xd37b('0xe'),_0x3743be,_0xd37b('0xf'));logger[_0xd37b('0x10')](_0xd37b('0x11'),_0x3743be,_0xd37b('0xf'),JSON[_0xd37b('0x12')](_0x2a5048));if(_0x2a5048[_0xd37b('0x13')]){if(_0x2a5048['error'][_0xd37b('0x14')]===0x1f4){logger[_0xd37b('0x13')]('ZohoField,\x20%s,\x20%s',_0x3743be,_0x2a5048['error'][_0xd37b('0x15')]);return _0x42ed9a(_0x2a5048[_0xd37b('0x13')][_0xd37b('0x15')]);}logger[_0xd37b('0x13')](_0xd37b('0xe'),_0x3743be,_0x2a5048[_0xd37b('0x13')][_0xd37b('0x15')]);return _0x24fedd(_0x2a5048[_0xd37b('0x13')][_0xd37b('0x15')]);}else{logger[_0xd37b('0x16')](_0xd37b('0xe'),_0x3743be,'request\x20sent');_0x24fedd(_0x2a5048['result'][_0xd37b('0x15')]);}})['catch'](function(_0x20096a){logger[_0xd37b('0x13')]('ZohoField,\x20%s,\x20%s',_0x3743be,_0x20096a);_0x42ed9a(_0x20096a);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 65fcaf8..27b3ca2 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x28696b,_0x2b4d7f){var _0xe388ed=function(_0x1ed713){while(--_0x1ed713){_0x28696b['push'](_0x28696b['shift']());}};_0xe388ed(++_0x2b4d7f);}(_0x70e0,0x17b));var _0x070e=function(_0x5b62a2,_0x4dfd6b){_0x5b62a2=_0x5b62a2-0x0;var _0x5adc36=_0x70e0[_0x5b62a2];return _0x5adc36;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4b4340,_0x295fc0){var _0x4cdb42=function(_0x1a7231){while(--_0x1a7231){_0x4b4340['push'](_0x4b4340['shift']());}};_0x4cdb42(++_0x295fc0);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 5e359fa..2c1d506 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 _0x8149=['exports','unique_name_and_version','STRING','app.js','BOOLEAN','state','sequelize'];(function(_0x21a30a,_0xfc0e8f){var _0x443cc9=function(_0x31a817){while(--_0x31a817){_0x21a30a['push'](_0x21a30a['shift']());}};_0x443cc9(++_0xfc0e8f);}(_0x8149,0xe6));var _0x9814=function(_0x28fcdc,_0x17e930){_0x28fcdc=_0x28fcdc-0x0;var _0x80bd4c=_0x8149[_0x28fcdc];return _0x80bd4c;};'use strict';var Sequelize=require(_0x9814('0x0'));module[_0x9814('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9814('0x2')},'version':{'type':Sequelize[_0x9814('0x3')],'allowNull':![],'unique':_0x9814('0x2')},'main':{'type':Sequelize[_0x9814('0x3')],'defaultValue':_0x9814('0x4')},'filename':{'type':Sequelize[_0x9814('0x3')]},'path':{'type':Sequelize[_0x9814('0x3')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x9814('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x9814('0x3')]},'logo':{'type':Sequelize[_0x9814('0x3')]},'state':{'type':Sequelize[_0x9814('0x3')],'unique':_0x9814('0x6')},'description':{'type':Sequelize[_0x9814('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x9814('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0xb49a=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x58c147,_0x1b3535){var _0x404af6=function(_0x33d2c9){while(--_0x33d2c9){_0x58c147['push'](_0x58c147['shift']());}};_0x404af6(++_0x1b3535);}(_0xb49a,0xfb));var _0xab49=function(_0x531a94,_0xbf2864){_0x531a94=_0x531a94-0x0;var _0x4ad3e1=_0xb49a[_0x531a94];return _0x4ad3e1;};'use strict';var Sequelize=require(_0xab49('0x0'));module[_0xab49('0x1')]={'name':{'type':Sequelize[_0xab49('0x2')],'allowNull':![],'unique':_0xab49('0x3')},'version':{'type':Sequelize[_0xab49('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xab49('0x2')],'defaultValue':_0xab49('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xab49('0x2')]},'size':{'type':Sequelize[_0xab49('0x5')]},'active':{'type':Sequelize[_0xab49('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xab49('0x2')]},'logo':{'type':Sequelize[_0xab49('0x2')]},'state':{'type':Sequelize[_0xab49('0x2')],'unique':_0xab49('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xab49('0x2')]},'remoteUri':{'type':Sequelize[_0xab49('0x2')]},'link':{'type':Sequelize[_0xab49('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 d38d6d9..1d13ab4 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 _0xc6ac=['type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','Integration','rawAttributes','fieldName'];(function(_0xbe05c8,_0x26be13){var _0xbd60ca=function(_0x202473){while(--_0x202473){_0xbe05c8['push'](_0xbe05c8['shift']());}};_0xbd60ca(++_0x26be13);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1a3eb1,_0x1d986e){_0x1a3eb1=_0x1a3eb1-0x0;var _0x457e46=_0xc6ac[_0x1a3eb1];return _0x457e46;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['Integration'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));}; \ No newline at end of file +var _0xc2c7=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','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','Integration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2c7,0x134));var _0x7c2c=function(_0x55ba98,_0x366c41){_0x55ba98=_0x55ba98-0x0;var _0x5d0af9=_0xc2c7[_0x55ba98];return _0x5d0af9;};'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['Integration'][_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['Integration'][_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));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index abfadb2..9e29b44 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 _0xe1b7=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','integrations'];(function(_0x42bb7b,_0x136321){var _0x54566a=function(_0x320023){while(--_0x320023){_0x42bb7b['push'](_0x42bb7b['shift']());}};_0x54566a(++_0x136321);}(_0xe1b7,0x1e4));var _0x7e1b=function(_0x461f4c,_0x4c293d){_0x461f4c=_0x461f4c-0x0;var _0x299260=_0xe1b7[_0x461f4c];return _0x299260;};'use strict';var _=require('lodash');var util=require(_0x7e1b('0x0'));var logger=require(_0x7e1b('0x1'))(_0x7e1b('0x2'));var moment=require(_0x7e1b('0x3'));var BPromise=require(_0x7e1b('0x4'));var rp=require(_0x7e1b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e1b('0x6'));var config=require(_0x7e1b('0x7'));var attributes=require('./integration.attributes');module[_0x7e1b('0x8')]=function(_0x898a59,_0x44c261){return _0x898a59[_0x7e1b('0x9')]('Integration',attributes,{'tableName':_0x7e1b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x215f=['./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x3066ef,_0x4f25a1){var _0x569e9d=function(_0x5ad49a){while(--_0x5ad49a){_0x3066ef['push'](_0x3066ef['shift']());}};_0x569e9d(++_0x4f25a1);}(_0x215f,0xa1));var _0xf215=function(_0x465f20,_0x5f4e24){_0x465f20=_0x465f20-0x0;var _0x445402=_0x215f[_0x465f20];return _0x445402;};'use strict';var _=require(_0xf215('0x0'));var util=require(_0xf215('0x1'));var logger=require(_0xf215('0x2'))(_0xf215('0x3'));var moment=require(_0xf215('0x4'));var BPromise=require(_0xf215('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf215('0x6'));var config=require(_0xf215('0x7'));var attributes=require(_0xf215('0x8'));module[_0xf215('0x9')]=function(_0xe52db8,_0xf9dd86){return _0xe52db8[_0xf215('0xa')](_0xf215('0xb'),attributes,{'tableName':_0xf215('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index ace171a..8d1a6ba 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xc2c7,0x134));var _0x7c2c=function(_0x2c0705,_0xe7ad25){_0x2c0705=_0x2c0705-0x0;var _0x56f604=_0xc2c7[_0x2c0705];return _0x56f604;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('Integration,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index b3e6102..91124bc 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 _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(_0x317d84,_0x55f8f8){var _0x220da2=function(_0x278ffa){while(--_0x278ffa){_0x317d84['push'](_0x317d84['shift']());}};_0x220da2(++_0x55f8f8);}(_0xba34,0x119));var _0x4ba3=function(_0x3fc274,_0x1cd584){_0x3fc274=_0x3fc274-0x0;var _0x3772f3=_0xba34[_0x3fc274];return _0x3772f3;};'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 +var _0x4137=['show','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x4137,0xf8));var _0x7413=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4137[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['describe']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xf'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xf'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index dd4e037..8cd440e 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 _0x8376=['RECEIVED','FAILED','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENDING'];(function(_0x3efa80,_0x13743e){var _0xfaf149=function(_0x34304c){while(--_0x34304c){_0x3efa80['push'](_0x3efa80['shift']());}};_0xfaf149(++_0x13743e);}(_0x8376,0x1df));var _0x6837=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8376[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x6837('0x0')]},'eventChannel':{'type':Sequelize[_0x6837('0x0')]},'exitStatus':{'type':Sequelize[_0x6837('0x0')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x6837('0x1')]},'contacts':{'type':Sequelize[_0x6837('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6837('0x0')]},'calleridname':{'type':Sequelize[_0x6837('0x0')]},'queue':{'type':Sequelize[_0x6837('0x0')]},'interface':{'type':Sequelize[_0x6837('0x0')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x6837('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x6837('0x1')]},'agentcomplete':{'type':Sequelize[_0x6837('0x3')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x6837('0x1')]},'agentacw':{'type':Sequelize[_0x6837('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x6837('0x0')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x6837('0x2')]},'agentdump':{'type':Sequelize[_0x6837('0x3')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x6837('0x2')]},'lastevent':{'type':Sequelize[_0x6837('0x0')]},'channel':{'type':Sequelize[_0x6837('0x0')]},'channelstate':{'type':Sequelize[_0x6837('0x1')]},'channelstatedesc':{'type':Sequelize[_0x6837('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x6837('0x0')]},'language':{'type':Sequelize[_0x6837('0x0')]},'accountcode':{'type':Sequelize[_0x6837('0x0')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6837('0x0')]},'priority':{'type':Sequelize[_0x6837('0x0')]},'destchannel':{'type':Sequelize[_0x6837('0x0')]},'destchannelstate':{'type':Sequelize[_0x6837('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x6837('0x0')]},'destcalleridnum':{'type':Sequelize[_0x6837('0x0')]},'destcalleridname':{'type':Sequelize[_0x6837('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x6837('0x0')]},'destlanguage':{'type':Sequelize[_0x6837('0x0')]},'destaccountcode':{'type':Sequelize[_0x6837('0x0')]},'destcontext':{'type':Sequelize[_0x6837('0x0')]},'destexten':{'type':Sequelize[_0x6837('0x0')]},'destpriority':{'type':Sequelize[_0x6837('0x0')]},'destuniqueid':{'type':Sequelize[_0x6837('0x0')]},'messageId':{'type':Sequelize[_0x6837('0x0')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x6837('0x0')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x6837('0x0')]},'cc':{'type':Sequelize[_0x6837('0x0')]},'attachment':{'type':Sequelize[_0x6837('0x4')]},'html':{'type':Sequelize[_0x6837('0x4')]},'text':{'type':Sequelize[_0x6837('0x4')]},'status':{'type':Sequelize[_0x6837('0x5')]('SENT',_0x6837('0x6'),_0x6837('0x7'),_0x6837('0x8'))},'url':{'type':Sequelize[_0x6837('0x0')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x6837('0x1')]}}; \ No newline at end of file +var _0xeb07=['ENUM','SENT','RECEIVED','FAILED','sequelize','STRING','DATE','INTEGER','BOOLEAN','TEXT'];(function(_0x58761b,_0x138b99){var _0xd29b0a=function(_0x4c3e52){while(--_0x4c3e52){_0x58761b['push'](_0x58761b['shift']());}};_0xd29b0a(++_0x138b99);}(_0xeb07,0x68));var _0x7eb0=function(_0x5e4a52,_0x28b093){_0x5e4a52=_0x5e4a52-0x0;var _0x310550=_0xeb07[_0x5e4a52];return _0x310550;};'use strict';var Sequelize=require(_0x7eb0('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x7eb0('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x7eb0('0x1')]},'uniqueid':{'type':Sequelize[_0x7eb0('0x1')]},'calleridnum':{'type':Sequelize[_0x7eb0('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7eb0('0x1')]},'interface':{'type':Sequelize[_0x7eb0('0x1')]},'membername':{'type':Sequelize[_0x7eb0('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7eb0('0x2')]},'agentconnectAt':{'type':Sequelize[_0x7eb0('0x2')]},'holdtime':{'type':Sequelize[_0x7eb0('0x3')]},'agentcomplete':{'type':Sequelize[_0x7eb0('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x7eb0('0x3')]},'agentacw':{'type':Sequelize[_0x7eb0('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x7eb0('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x7eb0('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7eb0('0x2')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7eb0('0x2')]},'lastevent':{'type':Sequelize[_0x7eb0('0x1')]},'channel':{'type':Sequelize[_0x7eb0('0x1')]},'channelstate':{'type':Sequelize[_0x7eb0('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7eb0('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7eb0('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7eb0('0x1')]},'accountcode':{'type':Sequelize[_0x7eb0('0x1')]},'context':{'type':Sequelize[_0x7eb0('0x1')]},'exten':{'type':Sequelize[_0x7eb0('0x1')]},'priority':{'type':Sequelize[_0x7eb0('0x1')]},'destchannel':{'type':Sequelize[_0x7eb0('0x1')]},'destchannelstate':{'type':Sequelize[_0x7eb0('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7eb0('0x1')]},'destcalleridname':{'type':Sequelize[_0x7eb0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7eb0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7eb0('0x1')]},'destlanguage':{'type':Sequelize[_0x7eb0('0x1')]},'destaccountcode':{'type':Sequelize[_0x7eb0('0x1')]},'destcontext':{'type':Sequelize[_0x7eb0('0x1')]},'destexten':{'type':Sequelize[_0x7eb0('0x1')]},'destpriority':{'type':Sequelize[_0x7eb0('0x1')]},'destuniqueid':{'type':Sequelize[_0x7eb0('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x7eb0('0x1')]},'subject':{'type':Sequelize[_0x7eb0('0x1')]},'from':{'type':Sequelize[_0x7eb0('0x1')]},'to':{'type':Sequelize[_0x7eb0('0x1')]},'cc':{'type':Sequelize[_0x7eb0('0x1')]},'attachment':{'type':Sequelize[_0x7eb0('0x5')]},'html':{'type':Sequelize[_0x7eb0('0x5')]},'text':{'type':Sequelize[_0x7eb0('0x5')]},'status':{'type':Sequelize[_0x7eb0('0x6')](_0x7eb0('0x7'),'SENDING',_0x7eb0('0x8'),_0x7eb0('0x9'))},'url':{'type':Sequelize[_0x7eb0('0x1')]},'app':{'type':Sequelize[_0x7eb0('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x7eb0('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 7812637..d6307b6 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 _0x9936=['includeAll','include','rows','catch','keys','find','create','body','params','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','stack','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0xa38cf2,_0x13e769){var _0x1c9a57=function(_0x3fdbd5){while(--_0x3fdbd5){_0xa38cf2['push'](_0xa38cf2['shift']());}};_0x1c9a57(++_0x13e769);}(_0x9936,0x1cd));var _0x6993=function(_0x29e3e4,_0x370df9){_0x29e3e4=_0x29e3e4-0x0;var _0x4f98e7=_0x9936[_0x29e3e4];return _0x4f98e7;};'use strict';var emlformat=require(_0x6993('0x0'));var rimraf=require(_0x6993('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6993('0x2'));var moment=require(_0x6993('0x3'));var BPromise=require(_0x6993('0x4'));var Mustache=require(_0x6993('0x5'));var util=require(_0x6993('0x6'));var path=require(_0x6993('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6993('0x8'));var fs=require('fs');var fs_extra=require(_0x6993('0x9'));var _=require(_0x6993('0xa'));var squel=require('squel');var crypto=require(_0x6993('0xb'));var jsforce=require(_0x6993('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6993('0xd'));var querystring=require(_0x6993('0xe'));var Papa=require(_0x6993('0xf'));var Redis=require(_0x6993('0x10'));var authService=require(_0x6993('0x11'));var qs=require(_0x6993('0x12'));var as=require(_0x6993('0x13'));var hardwareService=require(_0x6993('0x14'));var logger=require(_0x6993('0x15'))(_0x6993('0x16'));var utils=require('../../config/utils');var config=require(_0x6993('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x292a0e,_0x4deddc){_0x4deddc=_0x4deddc||0xcc;return function(_0x6c3db4){if(_0x6c3db4){return _0x292a0e[_0x6993('0x18')](_0x4deddc);}return _0x292a0e[_0x6993('0x19')](_0x4deddc)[_0x6993('0x1a')]();};}function respondWithResult(_0x563dc8,_0x44384c){_0x44384c=_0x44384c||0xc8;return function(_0x368517){if(_0x368517){return _0x563dc8['status'](_0x44384c)[_0x6993('0x1b')](_0x368517);}};}function respondWithFilteredResult(_0x13917a,_0x53d910){return function(_0x5f4587){if(_0x5f4587){var _0x14c18f=typeof _0x53d910[_0x6993('0x1c')]===_0x6993('0x1d')&&typeof _0x53d910[_0x6993('0x1e')]===_0x6993('0x1d');var _0x58f935=_0x5f4587['count'];var _0x1c2c0f=_0x14c18f?0x0:_0x53d910[_0x6993('0x1c')];var _0x53b6de=_0x14c18f?_0x5f4587[_0x6993('0x1f')]:_0x53d910[_0x6993('0x1c')]+_0x53d910[_0x6993('0x1e')];var _0x2eed7f;if(_0x53b6de>=_0x58f935){_0x53b6de=_0x58f935;_0x2eed7f=0xc8;}else{_0x2eed7f=0xce;}_0x13917a[_0x6993('0x19')](_0x2eed7f);return _0x13917a['set'](_0x6993('0x20'),_0x1c2c0f+'-'+_0x53b6de+'/'+_0x58f935)[_0x6993('0x1b')](_0x5f4587);}return null;};}function patchUpdates(_0x45f035){return function(_0x54ab5b){try{jsonpatch[_0x6993('0x21')](_0x54ab5b,_0x45f035,!![]);}catch(_0x4f6494){return BPromise[_0x6993('0x22')](_0x4f6494);}return _0x54ab5b['save']();};}function saveUpdates(_0x365c0d,_0x16d537){return function(_0x370bd4){if(_0x370bd4){return _0x370bd4[_0x6993('0x23')](_0x365c0d)[_0x6993('0x24')](function(_0x250f13){return _0x250f13;});}return null;};}function removeEntity(_0x2901ba,_0xc2ecb2){return function(_0x2f33e4){if(_0x2f33e4){return _0x2f33e4['destroy']()['then'](function(){_0x2901ba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20d195,_0x3e9385){return function(_0x2fd9ea){if(!_0x2fd9ea){_0x20d195[_0x6993('0x18')](0x194);}return _0x2fd9ea;};}function handleError(_0x215a3f,_0x39180e){_0x39180e=_0x39180e||0x1f4;return function(_0x28dddf){logger[_0x6993('0x25')](_0x28dddf[_0x6993('0x26')]);if(_0x28dddf['name']){delete _0x28dddf['name'];}_0x215a3f[_0x6993('0x19')](_0x39180e)[_0x6993('0x27')](_0x28dddf);};}exports[_0x6993('0x28')]=function(_0x44cf19,_0x2cfd3f){var _0x196176={},_0x406149={},_0x1ffd93={'count':0x0,'rows':[]};var _0x478bfd=_[_0x6993('0x29')](db[_0x6993('0x2a')][_0x6993('0x2b')],function(_0x5148a3){return{'name':_0x5148a3[_0x6993('0x2c')],'type':_0x5148a3[_0x6993('0x2d')][_0x6993('0x2e')]};});_0x406149['model']=_[_0x6993('0x29')](_0x478bfd,_0x6993('0x2f'));_0x406149[_0x6993('0x30')]=_['keys'](_0x44cf19[_0x6993('0x30')]);_0x406149[_0x6993('0x31')]=_[_0x6993('0x32')](_0x406149[_0x6993('0x33')],_0x406149['query']);_0x196176[_0x6993('0x34')]=_[_0x6993('0x32')](_0x406149[_0x6993('0x33')],qs[_0x6993('0x35')](_0x44cf19[_0x6993('0x30')]['fields']));_0x196176[_0x6993('0x34')]=_0x196176[_0x6993('0x34')][_0x6993('0x36')]?_0x196176[_0x6993('0x34')]:_0x406149[_0x6993('0x33')];if(!_0x44cf19[_0x6993('0x30')][_0x6993('0x37')]('nolimit')){_0x196176[_0x6993('0x1e')]=qs[_0x6993('0x1e')](_0x44cf19['query']['limit']);_0x196176[_0x6993('0x1c')]=qs[_0x6993('0x1c')](_0x44cf19['query'][_0x6993('0x1c')]);}_0x196176[_0x6993('0x38')]=qs[_0x6993('0x39')](_0x44cf19[_0x6993('0x30')][_0x6993('0x39')]);_0x196176[_0x6993('0x3a')]=qs[_0x6993('0x31')](_[_0x6993('0x3b')](_0x44cf19[_0x6993('0x30')],_0x406149['filters']),_0x478bfd);if(_0x44cf19['query'][_0x6993('0x3c')]){_0x196176[_0x6993('0x3a')]=_[_0x6993('0x3d')](_0x196176[_0x6993('0x3a')],{'$or':_[_0x6993('0x29')](_0x478bfd,function(_0x161b75){if(_0x161b75[_0x6993('0x2d')]!==_0x6993('0x3e')){var _0x1df7f8={};_0x1df7f8[_0x161b75['name']]={'$like':'%'+_0x44cf19[_0x6993('0x30')][_0x6993('0x3c')]+'%'};return _0x1df7f8;}})});}_0x196176=_[_0x6993('0x3d')]({},_0x196176,_0x44cf19[_0x6993('0x3f')]);var _0x31fc8c={'where':_0x196176['where']};return db[_0x6993('0x2a')][_0x6993('0x1f')](_0x31fc8c)[_0x6993('0x24')](function(_0x296dd4){_0x1ffd93[_0x6993('0x1f')]=_0x296dd4;if(_0x44cf19['query'][_0x6993('0x40')]){_0x196176[_0x6993('0x41')]=[{'all':!![]}];}return db[_0x6993('0x2a')]['findAll'](_0x196176);})[_0x6993('0x24')](function(_0x1d4590){_0x1ffd93[_0x6993('0x42')]=_0x1d4590;return _0x1ffd93;})[_0x6993('0x24')](respondWithFilteredResult(_0x2cfd3f,_0x196176))[_0x6993('0x43')](handleError(_0x2cfd3f,null));};exports['show']=function(_0x1e3185,_0x4db646){var _0x867cb9={'raw':![],'where':{'id':_0x1e3185['params']['id']}},_0x394a96={};_0x394a96[_0x6993('0x33')]=_['keys'](db[_0x6993('0x2a')]['rawAttributes']);_0x394a96['query']=_[_0x6993('0x44')](_0x1e3185[_0x6993('0x30')]);_0x394a96[_0x6993('0x31')]=_['intersection'](_0x394a96[_0x6993('0x33')],_0x394a96[_0x6993('0x30')]);_0x867cb9[_0x6993('0x34')]=_[_0x6993('0x32')](_0x394a96[_0x6993('0x33')],qs[_0x6993('0x35')](_0x1e3185[_0x6993('0x30')][_0x6993('0x35')]));_0x867cb9[_0x6993('0x34')]=_0x867cb9[_0x6993('0x34')][_0x6993('0x36')]?_0x867cb9['attributes']:_0x394a96[_0x6993('0x33')];if(_0x1e3185['query']['includeAll']){_0x867cb9[_0x6993('0x41')]=[{'all':!![]}];}_0x867cb9=_[_0x6993('0x3d')]({},_0x867cb9,_0x1e3185[_0x6993('0x3f')]);return db[_0x6993('0x2a')][_0x6993('0x45')](_0x867cb9)['then'](handleEntityNotFound(_0x4db646,null))[_0x6993('0x24')](respondWithResult(_0x4db646,null))[_0x6993('0x43')](handleError(_0x4db646,null));};exports[_0x6993('0x46')]=function(_0xefa85c,_0x215c74){return db[_0x6993('0x2a')][_0x6993('0x46')](_0xefa85c[_0x6993('0x47')],{})['then'](respondWithResult(_0x215c74,0xc9))[_0x6993('0x43')](handleError(_0x215c74,null));};exports[_0x6993('0x23')]=function(_0x44fbee,_0x370134){if(_0x44fbee[_0x6993('0x47')]['id']){delete _0x44fbee[_0x6993('0x47')]['id'];}return db[_0x6993('0x2a')][_0x6993('0x45')]({'where':{'id':_0x44fbee[_0x6993('0x48')]['id']}})['then'](handleEntityNotFound(_0x370134,null))[_0x6993('0x24')](saveUpdates(_0x44fbee[_0x6993('0x47')],null))[_0x6993('0x24')](respondWithResult(_0x370134,null))[_0x6993('0x43')](handleError(_0x370134,null));};exports[_0x6993('0x49')]=function(_0x219bb1,_0x524982){return db[_0x6993('0x2a')][_0x6993('0x45')]({'where':{'id':_0x219bb1[_0x6993('0x48')]['id']}})[_0x6993('0x24')](handleEntityNotFound(_0x524982,null))[_0x6993('0x24')](removeEntity(_0x524982,null))['catch'](handleError(_0x524982,null));};exports[_0x6993('0x4a')]=function(_0x47e583,_0x5698aa){return db[_0x6993('0x2a')][_0x6993('0x4a')]()[_0x6993('0x24')](respondWithResult(_0x5698aa,null))['catch'](handleError(_0x5698aa,null));}; \ No newline at end of file +var _0x7954=['nolimit','order','sort','where','filters','pick','merge','map','type','VIRTUAL','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','error','stack','name','index','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x401611,_0xb9a501){var _0x26c75e=function(_0x474e4b){while(--_0x474e4b){_0x401611['push'](_0x401611['shift']());}};_0x26c75e(++_0xb9a501);}(_0x7954,0x148));var _0x4795=function(_0x3f7111,_0x3c0988){_0x3f7111=_0x3f7111-0x0;var _0x216d7d=_0x7954[_0x3f7111];return _0x216d7d;};'use strict';var emlformat=require(_0x4795('0x0'));var rimraf=require(_0x4795('0x1'));var zipdir=require(_0x4795('0x2'));var jsonpatch=require(_0x4795('0x3'));var rp=require(_0x4795('0x4'));var moment=require(_0x4795('0x5'));var BPromise=require(_0x4795('0x6'));var Mustache=require('mustache');var util=require(_0x4795('0x7'));var path=require('path');var sox=require(_0x4795('0x8'));var csv=require(_0x4795('0x9'));var ejs=require(_0x4795('0xa'));var fs=require('fs');var fs_extra=require(_0x4795('0xb'));var _=require(_0x4795('0xc'));var squel=require(_0x4795('0xd'));var crypto=require('crypto');var jsforce=require(_0x4795('0xe'));var deskjs=require(_0x4795('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4795('0x10'));var Papa=require(_0x4795('0x11'));var Redis=require(_0x4795('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4795('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4795('0x14'))(_0x4795('0x15'));var utils=require(_0x4795('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4795('0x17'))['db'];function respondWithStatusCode(_0x45ecd1,_0x3cfbe3){_0x3cfbe3=_0x3cfbe3||0xcc;return function(_0x5b6c10){if(_0x5b6c10){return _0x45ecd1[_0x4795('0x18')](_0x3cfbe3);}return _0x45ecd1[_0x4795('0x19')](_0x3cfbe3)[_0x4795('0x1a')]();};}function respondWithResult(_0x2de6eb,_0x4b7350){_0x4b7350=_0x4b7350||0xc8;return function(_0x47cfde){if(_0x47cfde){return _0x2de6eb['status'](_0x4b7350)['json'](_0x47cfde);}};}function respondWithFilteredResult(_0x37b372,_0x3e58d4){return function(_0x5ea782){if(_0x5ea782){var _0x19bbbf=typeof _0x3e58d4[_0x4795('0x1b')]==='undefined'&&typeof _0x3e58d4[_0x4795('0x1c')]===_0x4795('0x1d');var _0x24aef9=_0x5ea782[_0x4795('0x1e')];var _0x41a644=_0x19bbbf?0x0:_0x3e58d4[_0x4795('0x1b')];var _0x2f137c=_0x19bbbf?_0x5ea782['count']:_0x3e58d4[_0x4795('0x1b')]+_0x3e58d4[_0x4795('0x1c')];var _0x439d21;if(_0x2f137c>=_0x24aef9){_0x2f137c=_0x24aef9;_0x439d21=0xc8;}else{_0x439d21=0xce;}_0x37b372[_0x4795('0x19')](_0x439d21);return _0x37b372[_0x4795('0x1f')](_0x4795('0x20'),_0x41a644+'-'+_0x2f137c+'/'+_0x24aef9)[_0x4795('0x21')](_0x5ea782);}return null;};}function patchUpdates(_0xc1e253){return function(_0x4d0f1e){try{jsonpatch[_0x4795('0x22')](_0x4d0f1e,_0xc1e253,!![]);}catch(_0x1d6575){return BPromise['reject'](_0x1d6575);}return _0x4d0f1e[_0x4795('0x23')]();};}function saveUpdates(_0x516ffa,_0xe66259){return function(_0x1d1409){if(_0x1d1409){return _0x1d1409[_0x4795('0x24')](_0x516ffa)[_0x4795('0x25')](function(_0x184161){return _0x184161;});}return null;};}function removeEntity(_0x1c0503,_0x38d152){return function(_0x2ab44d){if(_0x2ab44d){return _0x2ab44d['destroy']()[_0x4795('0x25')](function(){_0x1c0503[_0x4795('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x73e321,_0x41bcee){return function(_0x2a3815){if(!_0x2a3815){_0x73e321[_0x4795('0x18')](0x194);}return _0x2a3815;};}function handleError(_0x4ef9b7,_0x328d0d){_0x328d0d=_0x328d0d||0x1f4;return function(_0x528766){logger[_0x4795('0x26')](_0x528766[_0x4795('0x27')]);if(_0x528766[_0x4795('0x28')]){delete _0x528766[_0x4795('0x28')];}_0x4ef9b7[_0x4795('0x19')](_0x328d0d)['send'](_0x528766);};}exports[_0x4795('0x29')]=function(_0x15849c,_0x2588c7){var _0x429024={},_0x39b610={},_0x35ea66={'count':0x0,'rows':[]};var _0xb218e0=_['map'](db['IntegrationReport'][_0x4795('0x2a')],function(_0x4c3e83){return{'name':_0x4c3e83[_0x4795('0x2b')],'type':_0x4c3e83['type'][_0x4795('0x2c')]};});_0x39b610['model']=_['map'](_0xb218e0,_0x4795('0x28'));_0x39b610[_0x4795('0x2d')]=_['keys'](_0x15849c[_0x4795('0x2d')]);_0x39b610['filters']=_[_0x4795('0x2e')](_0x39b610[_0x4795('0x2f')],_0x39b610[_0x4795('0x2d')]);_0x429024[_0x4795('0x30')]=_[_0x4795('0x2e')](_0x39b610[_0x4795('0x2f')],qs[_0x4795('0x31')](_0x15849c[_0x4795('0x2d')][_0x4795('0x31')]));_0x429024[_0x4795('0x30')]=_0x429024[_0x4795('0x30')][_0x4795('0x32')]?_0x429024['attributes']:_0x39b610[_0x4795('0x2f')];if(!_0x15849c[_0x4795('0x2d')][_0x4795('0x33')](_0x4795('0x34'))){_0x429024[_0x4795('0x1c')]=qs[_0x4795('0x1c')](_0x15849c[_0x4795('0x2d')][_0x4795('0x1c')]);_0x429024['offset']=qs[_0x4795('0x1b')](_0x15849c['query'][_0x4795('0x1b')]);}_0x429024[_0x4795('0x35')]=qs[_0x4795('0x36')](_0x15849c[_0x4795('0x2d')][_0x4795('0x36')]);_0x429024[_0x4795('0x37')]=qs[_0x4795('0x38')](_[_0x4795('0x39')](_0x15849c[_0x4795('0x2d')],_0x39b610[_0x4795('0x38')]),_0xb218e0);if(_0x15849c[_0x4795('0x2d')]['filter']){_0x429024[_0x4795('0x37')]=_[_0x4795('0x3a')](_0x429024[_0x4795('0x37')],{'$or':_[_0x4795('0x3b')](_0xb218e0,function(_0x5a0058){if(_0x5a0058[_0x4795('0x3c')]!==_0x4795('0x3d')){var _0x53adce={};_0x53adce[_0x5a0058[_0x4795('0x28')]]={'$like':'%'+_0x15849c['query']['filter']+'%'};return _0x53adce;}})});}_0x429024=_['merge']({},_0x429024,_0x15849c['options']);var _0x2f0e08={'where':_0x429024[_0x4795('0x37')]};return db[_0x4795('0x3e')][_0x4795('0x1e')](_0x2f0e08)['then'](function(_0x1e8138){_0x35ea66[_0x4795('0x1e')]=_0x1e8138;if(_0x15849c[_0x4795('0x2d')][_0x4795('0x3f')]){_0x429024[_0x4795('0x40')]=[{'all':!![]}];}return db[_0x4795('0x3e')][_0x4795('0x41')](_0x429024);})['then'](function(_0x44152f){_0x35ea66[_0x4795('0x42')]=_0x44152f;return _0x35ea66;})[_0x4795('0x25')](respondWithFilteredResult(_0x2588c7,_0x429024))[_0x4795('0x43')](handleError(_0x2588c7,null));};exports[_0x4795('0x44')]=function(_0x2cc2e6,_0x4efa8b){var _0x2fb11e={'raw':![],'where':{'id':_0x2cc2e6[_0x4795('0x45')]['id']}},_0x5de596={};_0x5de596[_0x4795('0x2f')]=_[_0x4795('0x46')](db[_0x4795('0x3e')][_0x4795('0x2a')]);_0x5de596[_0x4795('0x2d')]=_[_0x4795('0x46')](_0x2cc2e6[_0x4795('0x2d')]);_0x5de596[_0x4795('0x38')]=_[_0x4795('0x2e')](_0x5de596[_0x4795('0x2f')],_0x5de596['query']);_0x2fb11e[_0x4795('0x30')]=_[_0x4795('0x2e')](_0x5de596[_0x4795('0x2f')],qs[_0x4795('0x31')](_0x2cc2e6['query'][_0x4795('0x31')]));_0x2fb11e[_0x4795('0x30')]=_0x2fb11e[_0x4795('0x30')]['length']?_0x2fb11e[_0x4795('0x30')]:_0x5de596[_0x4795('0x2f')];if(_0x2cc2e6[_0x4795('0x2d')][_0x4795('0x3f')]){_0x2fb11e['include']=[{'all':!![]}];}_0x2fb11e=_[_0x4795('0x3a')]({},_0x2fb11e,_0x2cc2e6[_0x4795('0x47')]);return db[_0x4795('0x3e')][_0x4795('0x48')](_0x2fb11e)['then'](handleEntityNotFound(_0x4efa8b,null))[_0x4795('0x25')](respondWithResult(_0x4efa8b,null))['catch'](handleError(_0x4efa8b,null));};exports[_0x4795('0x49')]=function(_0x3d506a,_0x267322){return db[_0x4795('0x3e')][_0x4795('0x49')](_0x3d506a[_0x4795('0x4a')],{})['then'](respondWithResult(_0x267322,0xc9))[_0x4795('0x43')](handleError(_0x267322,null));};exports[_0x4795('0x24')]=function(_0x51cadb,_0x5dae27){if(_0x51cadb[_0x4795('0x4a')]['id']){delete _0x51cadb[_0x4795('0x4a')]['id'];}return db[_0x4795('0x3e')][_0x4795('0x48')]({'where':{'id':_0x51cadb[_0x4795('0x45')]['id']}})[_0x4795('0x25')](handleEntityNotFound(_0x5dae27,null))[_0x4795('0x25')](saveUpdates(_0x51cadb[_0x4795('0x4a')],null))[_0x4795('0x25')](respondWithResult(_0x5dae27,null))[_0x4795('0x43')](handleError(_0x5dae27,null));};exports['destroy']=function(_0x46d221,_0x4daf19){return db[_0x4795('0x3e')]['find']({'where':{'id':_0x46d221[_0x4795('0x45')]['id']}})[_0x4795('0x25')](handleEntityNotFound(_0x4daf19,null))[_0x4795('0x25')](removeEntity(_0x4daf19,null))[_0x4795('0x43')](handleError(_0x4daf19,null));};exports[_0x4795('0x4b')]=function(_0x4eb8cd,_0x1292b1){return db[_0x4795('0x3e')][_0x4795('0x4b')]()[_0x4795('0x25')](respondWithResult(_0x1292b1,null))[_0x4795('0x43')](handleError(_0x1292b1,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 6ce6744..427a71d 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 _0xc782=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','IntegrationReport','report_integration'];(function(_0xbacbce,_0x5a00d2){var _0x1d6985=function(_0x2d3793){while(--_0x2d3793){_0xbacbce['push'](_0xbacbce['shift']());}};_0x1d6985(++_0x5a00d2);}(_0xc782,0x78));var _0x2c78=function(_0x32bce8,_0x54f965){_0x32bce8=_0x32bce8-0x0;var _0x38badc=_0xc782[_0x32bce8];return _0x38badc;};'use strict';var _=require(_0x2c78('0x0'));var util=require('util');var logger=require(_0x2c78('0x1'))(_0x2c78('0x2'));var moment=require(_0x2c78('0x3'));var BPromise=require(_0x2c78('0x4'));var rp=require(_0x2c78('0x5'));var fs=require('fs');var path=require(_0x2c78('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x2c78('0x7')]=function(_0x4663d0,_0x150bd7){return _0x4663d0['define'](_0x2c78('0x8'),attributes,{'tableName':_0x2c78('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a39=['report_integration','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x3ab928,_0x2b990b){var _0xf47692=function(_0x311b8e){while(--_0x311b8e){_0x3ab928['push'](_0x3ab928['shift']());}};_0xf47692(++_0x2b990b);}(_0x3a39,0x139));var _0x93a3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3a39[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x93a3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x93a3('0x1'));var BPromise=require(_0x93a3('0x2'));var rp=require(_0x93a3('0x3'));var fs=require('fs');var path=require(_0x93a3('0x4'));var rimraf=require(_0x93a3('0x5'));var config=require(_0x93a3('0x6'));var attributes=require(_0x93a3('0x7'));module[_0x93a3('0x8')]=function(_0x134723,_0x2766f1){return _0x134723[_0x93a3('0x9')](_0x93a3('0xa'),attributes,{'tableName':_0x93a3('0xb'),'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 932d8c5..06e5f36 100644 --- a/server/api/integrationReport/integrationReport.rpc.js +++ b/server/api/integrationReport/integrationReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x53ec,0x192));var _0xc53e=function(_0xe1b2a8,_0x38f786){_0xe1b2a8=_0xe1b2a8-0x0;var _0x554804=_0x53ec[_0xe1b2a8];return _0x554804;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x4975,0x86));var _0x5497=function(_0x32aeb9,_0x1caccb){_0x32aeb9=_0x32aeb9-0x0;var _0x1f3ca0=_0x4975[_0x32aeb9];return _0x1f3ca0;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('IntegrationReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index b0dc93a..efef01b 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 _0xbc61=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update'];(function(_0x40ed25,_0x98647b){var _0x2ab31f=function(_0x1dc3b9){while(--_0x1dc3b9){_0x40ed25['push'](_0x40ed25['shift']());}};_0x2ab31f(++_0x98647b);}(_0xbc61,0x1b2));var _0x1bc6=function(_0x485c7e,_0x5aff76){_0x485c7e=_0x485c7e-0x0;var _0x3808f7=_0xbc61[_0x485c7e];return _0x3808f7;};'use strict';var multer=require(_0x1bc6('0x0'));var util=require(_0x1bc6('0x1'));var path=require(_0x1bc6('0x2'));var timeout=require(_0x1bc6('0x3'));var express=require('express');var router=express[_0x1bc6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1bc6('0x5'));var interaction=require(_0x1bc6('0x6'));var config=require('../../config/environment');var controller=require(_0x1bc6('0x7'));router[_0x1bc6('0x8')]('/',auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xa')]);router['get'](_0x1bc6('0xb'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xc')]);router[_0x1bc6('0x8')](_0x1bc6('0xd'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xe')]);router['post']('/',auth[_0x1bc6('0x9')](),controller[_0x1bc6('0xf')]);router[_0x1bc6('0x10')](_0x1bc6('0xd'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0x11')]);router[_0x1bc6('0x10')](_0x1bc6('0x12'),auth[_0x1bc6('0x9')](),controller[_0x1bc6('0x13')]);router[_0x1bc6('0x14')](_0x1bc6('0xb'),auth['isAuthenticated'](),controller[_0x1bc6('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1bc6('0x16')]);module[_0x1bc6('0x17')]=router; \ No newline at end of file +var _0xc69b=['express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','multer','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc69b,0xcf));var _0xbc69=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0xc69b[_0x5cc8];return _0x450661;};'use strict';var multer=require(_0xbc69('0x0'));var util=require('util');var path=require(_0xbc69('0x1'));var timeout=require('connect-timeout');var express=require(_0xbc69('0x2'));var router=express[_0xbc69('0x3')]();var fs_extra=require(_0xbc69('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbc69('0x5'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0xbc69('0x6')]('/',auth[_0xbc69('0x7')](),controller['index']);router[_0xbc69('0x6')](_0xbc69('0x8'),auth[_0xbc69('0x7')](),controller['show']);router[_0xbc69('0x6')](_0xbc69('0x9'),auth[_0xbc69('0x7')](),controller[_0xbc69('0xa')]);router[_0xbc69('0xb')]('/',auth['isAuthenticated'](),controller[_0xbc69('0xc')]);router[_0xbc69('0xb')](_0xbc69('0x9'),auth[_0xbc69('0x7')](),controller[_0xbc69('0xd')]);router['post'](_0xbc69('0xe'),auth[_0xbc69('0x7')](),controller[_0xbc69('0xf')]);router[_0xbc69('0x10')]('/:id',auth[_0xbc69('0x7')](),controller['update']);router[_0xbc69('0x11')]('/:id',auth[_0xbc69('0x7')](),controller[_0xbc69('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index cb37082..a738289 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 _0xfcd8=['sequelize','exports','STRING'];(function(_0x5977f2,_0x1a8641){var _0x2ac84f=function(_0x32274c){while(--_0x32274c){_0x5977f2['push'](_0x5977f2['shift']());}};_0x2ac84f(++_0x1a8641);}(_0xfcd8,0xa5));var _0x8fcd=function(_0x592f7d,_0x51b79a){_0x592f7d=_0x592f7d-0x0;var _0x3f9008=_0xfcd8[_0x592f7d];return _0x3f9008;};'use strict';var Sequelize=require(_0x8fcd('0x0'));module[_0x8fcd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8fcd('0x2')]},'interval':{'type':Sequelize[_0x8fcd('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xaa0e=['STRING','sequelize','exports'];(function(_0x1153f7,_0x564f8b){var _0x49380f=function(_0x52fd92){while(--_0x52fd92){_0x1153f7['push'](_0x1153f7['shift']());}};_0x49380f(++_0x564f8b);}(_0xaa0e,0x1a2));var _0xeaa0=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0xaa0e[_0x5311e8];return _0x582ad8;};'use strict';var Sequelize=require(_0xeaa0('0x0'));module[_0xeaa0('0x1')]={'name':{'type':Sequelize[_0xeaa0('0x2')]},'description':{'type':Sequelize[_0xeaa0('0x2')]},'interval':{'type':Sequelize[_0xeaa0('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 8c35d19..4a5c821 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 _0xaead=['addInterval','getIntervals','findOne','length','sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Intervals','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xaead,0x66));var _0xdaea=function(_0x4a74b8,_0x1ed4a2){_0x4a74b8=_0x4a74b8-0x0;var _0x252dab=_0xaead[_0x4a74b8];return _0x252dab;};'use strict';var emlformat=require(_0xdaea('0x0'));var rimraf=require(_0xdaea('0x1'));var zipdir=require(_0xdaea('0x2'));var jsonpatch=require(_0xdaea('0x3'));var rp=require(_0xdaea('0x4'));var moment=require('moment');var BPromise=require(_0xdaea('0x5'));var Mustache=require('mustache');var util=require(_0xdaea('0x6'));var path=require(_0xdaea('0x7'));var sox=require(_0xdaea('0x8'));var csv=require(_0xdaea('0x9'));var ejs=require(_0xdaea('0xa'));var fs=require('fs');var fs_extra=require(_0xdaea('0xb'));var _=require('lodash');var squel=require(_0xdaea('0xc'));var crypto=require('crypto');var jsforce=require(_0xdaea('0xd'));var deskjs=require(_0xdaea('0xe'));var toCsv=require(_0xdaea('0x9'));var querystring=require(_0xdaea('0xf'));var Papa=require(_0xdaea('0x10'));var Redis=require('ioredis');var authService=require(_0xdaea('0x11'));var qs=require(_0xdaea('0x12'));var as=require(_0xdaea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaea('0x14'))(_0xdaea('0x15'));var utils=require('../../config/utils');var config=require(_0xdaea('0x16'));var licenseUtil=require(_0xdaea('0x17'));var db=require(_0xdaea('0x18'))['db'];var extensions=require(_0xdaea('0x19'));function respondWithStatusCode(_0x6fa2a5,_0x3309ab){_0x3309ab=_0x3309ab||0xcc;return function(_0x24ad6e){if(_0x24ad6e){return _0x6fa2a5[_0xdaea('0x1a')](_0x3309ab);}return _0x6fa2a5[_0xdaea('0x1b')](_0x3309ab)[_0xdaea('0x1c')]();};}function respondWithResult(_0x3471de,_0x5e6d30){_0x5e6d30=_0x5e6d30||0xc8;return function(_0xb0b05b){if(_0xb0b05b){return _0x3471de[_0xdaea('0x1b')](_0x5e6d30)[_0xdaea('0x1d')](_0xb0b05b);}};}function respondWithFilteredResult(_0x5c791d,_0x2f4af8){return function(_0x1f9101){if(_0x1f9101){var _0x26a6dc=typeof _0x2f4af8['offset']===_0xdaea('0x1e')&&typeof _0x2f4af8[_0xdaea('0x1f')]===_0xdaea('0x1e');var _0x3f63e1=_0x1f9101[_0xdaea('0x20')];var _0x1bd719=_0x26a6dc?0x0:_0x2f4af8['offset'];var _0x394bd0=_0x26a6dc?_0x1f9101[_0xdaea('0x20')]:_0x2f4af8[_0xdaea('0x21')]+_0x2f4af8[_0xdaea('0x1f')];var _0x41795a;if(_0x394bd0>=_0x3f63e1){_0x394bd0=_0x3f63e1;_0x41795a=0xc8;}else{_0x41795a=0xce;}_0x5c791d[_0xdaea('0x1b')](_0x41795a);return _0x5c791d[_0xdaea('0x22')](_0xdaea('0x23'),_0x1bd719+'-'+_0x394bd0+'/'+_0x3f63e1)[_0xdaea('0x1d')](_0x1f9101);}return null;};}function patchUpdates(_0x30e51f){return function(_0xf584f6){try{jsonpatch[_0xdaea('0x24')](_0xf584f6,_0x30e51f,!![]);}catch(_0x440fc5){return BPromise[_0xdaea('0x25')](_0x440fc5);}return _0xf584f6[_0xdaea('0x26')]();};}function saveUpdates(_0x5a252c,_0x43bf05){return function(_0x34daaa){if(_0x34daaa){return _0x34daaa[_0xdaea('0x27')](_0x5a252c)[_0xdaea('0x28')](function(_0x3d9da0){return _0x3d9da0;});}return null;};}function removeEntity(_0x56f030,_0x54aefe){return function(_0x3c020d){if(_0x3c020d){return _0x3c020d[_0xdaea('0x29')]()['then'](function(){var _0x590289=_0x3c020d[_0xdaea('0x2a')]({'plain':!![]});var _0x4160b0='Intervals';return db['UserProfileResource'][_0xdaea('0x29')]({'where':{'type':_0x4160b0,'resourceId':_0x590289['id']}})[_0xdaea('0x28')](function(){return _0x3c020d;});})['then'](function(){_0x56f030[_0xdaea('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x578a02,_0x2faf93){return function(_0x27b27e){if(!_0x27b27e){_0x578a02['sendStatus'](0x194);}return _0x27b27e;};}function handleError(_0xd7d476,_0x3ec795){_0x3ec795=_0x3ec795||0x1f4;return function(_0x571c96){logger[_0xdaea('0x2b')](_0x571c96[_0xdaea('0x2c')]);if(_0x571c96[_0xdaea('0x2d')]){delete _0x571c96[_0xdaea('0x2d')];}_0xd7d476[_0xdaea('0x1b')](_0x3ec795)[_0xdaea('0x2e')](_0x571c96);};}exports[_0xdaea('0x2f')]=function(_0x38da76,_0x5d7f24){var _0x1d93ff={},_0x4b7bdf={},_0x3ca463={'count':0x0,'rows':[]};var _0x1acef2=_[_0xdaea('0x30')](db[_0xdaea('0x31')][_0xdaea('0x32')],function(_0x381f91){return{'name':_0x381f91[_0xdaea('0x33')],'type':_0x381f91[_0xdaea('0x34')][_0xdaea('0x35')]};});_0x4b7bdf['model']=_[_0xdaea('0x30')](_0x1acef2,_0xdaea('0x2d'));_0x4b7bdf[_0xdaea('0x36')]=_[_0xdaea('0x37')](_0x38da76[_0xdaea('0x36')]);_0x4b7bdf[_0xdaea('0x38')]=_[_0xdaea('0x39')](_0x4b7bdf[_0xdaea('0x3a')],_0x4b7bdf[_0xdaea('0x36')]);_0x1d93ff[_0xdaea('0x3b')]=_[_0xdaea('0x39')](_0x4b7bdf[_0xdaea('0x3a')],qs[_0xdaea('0x3c')](_0x38da76[_0xdaea('0x36')][_0xdaea('0x3c')]));_0x1d93ff['attributes']=_0x1d93ff[_0xdaea('0x3b')]['length']?_0x1d93ff['attributes']:_0x4b7bdf[_0xdaea('0x3a')];if(!_0x38da76[_0xdaea('0x36')][_0xdaea('0x3d')]('nolimit')){_0x1d93ff[_0xdaea('0x1f')]=qs[_0xdaea('0x1f')](_0x38da76[_0xdaea('0x36')][_0xdaea('0x1f')]);_0x1d93ff[_0xdaea('0x21')]=qs['offset'](_0x38da76[_0xdaea('0x36')]['offset']);}_0x1d93ff[_0xdaea('0x3e')]=qs['sort'](_0x38da76[_0xdaea('0x36')][_0xdaea('0x3f')]);_0x1d93ff[_0xdaea('0x40')]=qs[_0xdaea('0x38')](_[_0xdaea('0x41')](_0x38da76[_0xdaea('0x36')],_0x4b7bdf[_0xdaea('0x38')]),_0x1acef2);if(_0x38da76['query'][_0xdaea('0x42')]){_0x1d93ff[_0xdaea('0x40')]=_[_0xdaea('0x43')](_0x1d93ff[_0xdaea('0x40')],{'$or':_[_0xdaea('0x30')](_0x1acef2,function(_0x3d7d74){if(_0x3d7d74['type']!=='VIRTUAL'){var _0x21a88c={};_0x21a88c[_0x3d7d74[_0xdaea('0x2d')]]={'$like':'%'+_0x38da76[_0xdaea('0x36')][_0xdaea('0x42')]+'%'};return _0x21a88c;}})});}_0x1d93ff=_[_0xdaea('0x43')]({},_0x1d93ff,_0x38da76[_0xdaea('0x44')]);var _0x54e331={'where':_0x1d93ff[_0xdaea('0x40')]};return db[_0xdaea('0x31')]['count'](_0x54e331)[_0xdaea('0x28')](function(_0x2eb352){_0x3ca463[_0xdaea('0x20')]=_0x2eb352;if(_0x38da76['query'][_0xdaea('0x45')]){_0x1d93ff[_0xdaea('0x46')]=[{'all':!![]}];}return db[_0xdaea('0x31')][_0xdaea('0x47')](_0x1d93ff);})[_0xdaea('0x28')](function(_0x40323f){_0x3ca463[_0xdaea('0x48')]=_0x40323f;return _0x3ca463;})[_0xdaea('0x28')](respondWithFilteredResult(_0x5d7f24,_0x1d93ff))[_0xdaea('0x49')](handleError(_0x5d7f24,null));};exports[_0xdaea('0x4a')]=function(_0x10d721,_0x439b36){var _0x39770f={'raw':!![],'where':{'id':_0x10d721[_0xdaea('0x4b')]['id']}},_0x4a1a0b={};_0x4a1a0b[_0xdaea('0x3a')]=_[_0xdaea('0x37')](db['Interval'][_0xdaea('0x32')]);_0x4a1a0b[_0xdaea('0x36')]=_[_0xdaea('0x37')](_0x10d721[_0xdaea('0x36')]);_0x4a1a0b[_0xdaea('0x38')]=_['intersection'](_0x4a1a0b[_0xdaea('0x3a')],_0x4a1a0b[_0xdaea('0x36')]);_0x39770f[_0xdaea('0x3b')]=_[_0xdaea('0x39')](_0x4a1a0b[_0xdaea('0x3a')],qs['fields'](_0x10d721[_0xdaea('0x36')][_0xdaea('0x3c')]));_0x39770f[_0xdaea('0x3b')]=_0x39770f[_0xdaea('0x3b')]['length']?_0x39770f['attributes']:_0x4a1a0b[_0xdaea('0x3a')];if(_0x10d721[_0xdaea('0x36')][_0xdaea('0x45')]){_0x39770f[_0xdaea('0x46')]=[{'all':!![]}];}_0x39770f=_[_0xdaea('0x43')]({},_0x39770f,_0x10d721[_0xdaea('0x44')]);return db[_0xdaea('0x31')][_0xdaea('0x4c')](_0x39770f)[_0xdaea('0x28')](handleEntityNotFound(_0x439b36,null))[_0xdaea('0x28')](respondWithResult(_0x439b36,null))[_0xdaea('0x49')](handleError(_0x439b36,null));};exports[_0xdaea('0x4d')]=function(_0xe66707,_0x38a7dd){return db[_0xdaea('0x31')]['create'](_0xe66707[_0xdaea('0x4e')],{})[_0xdaea('0x28')](function(_0x514030){var _0x39ead7=_0xe66707[_0xdaea('0x4f')][_0xdaea('0x2a')]({'plain':!![]});if(!_0x39ead7)throw new Error(_0xdaea('0x50'));if(_0x39ead7['role']===_0xdaea('0x4f')){var _0x43f31c=_0x514030['get']({'plain':!![]});var _0x2ae8a5=_0xdaea('0x51');return db[_0xdaea('0x52')][_0xdaea('0x4c')]({'where':{'name':_0x2ae8a5,'userProfileId':_0x39ead7[_0xdaea('0x53')]},'raw':!![]})[_0xdaea('0x28')](function(_0x14b333){if(_0x14b333&&_0x14b333[_0xdaea('0x54')]===0x0){return db[_0xdaea('0x55')][_0xdaea('0x4d')]({'name':_0x43f31c['name'],'resourceId':_0x43f31c['id'],'type':_0x14b333[_0xdaea('0x2d')],'sectionId':_0x14b333['id']},{})['then'](function(){return _0x514030;});}else{return _0x514030;}})[_0xdaea('0x49')](function(_0x8a83e7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x8a83e7);throw _0x8a83e7;});}return _0x514030;})[_0xdaea('0x28')](respondWithResult(_0x38a7dd,0xc9))[_0xdaea('0x49')](handleError(_0x38a7dd,null));};exports[_0xdaea('0x27')]=function(_0x2b4a27,_0x31579c){if(_0x2b4a27['body']['id']){delete _0x2b4a27[_0xdaea('0x4e')]['id'];}return db[_0xdaea('0x31')][_0xdaea('0x4c')]({'where':{'id':_0x2b4a27['params']['id']}})[_0xdaea('0x28')](handleEntityNotFound(_0x31579c,null))['then'](saveUpdates(_0x2b4a27['body'],null))['then'](respondWithResult(_0x31579c,null))[_0xdaea('0x49')](handleError(_0x31579c,null));};exports[_0xdaea('0x29')]=function(_0x322016,_0x268f2d){return db[_0xdaea('0x31')]['find']({'where':{'id':_0x322016[_0xdaea('0x4b')]['id']}})['then'](handleEntityNotFound(_0x268f2d,null))['then'](removeEntity(_0x268f2d,null))['catch'](handleError(_0x268f2d,null));};exports[_0xdaea('0x56')]=function(_0x5491e6,_0x2457f1,_0x346895){if(_0x5491e6[_0xdaea('0x4e')]['id']){delete _0x5491e6[_0xdaea('0x4e')]['id'];}return db['Interval'][_0xdaea('0x4c')]({'where':{'id':_0x5491e6[_0xdaea('0x4b')]['id']}})[_0xdaea('0x28')](handleEntityNotFound(_0x2457f1,null))[_0xdaea('0x28')](function(_0x5ddd7d){if(_0x5ddd7d){_0x5491e6['body']['IntervalId']=_0x5ddd7d['id'];return db['Interval'][_0xdaea('0x4d')](_0x5491e6[_0xdaea('0x4e')]);}})[_0xdaea('0x28')](respondWithResult(_0x2457f1,null))['catch'](handleError(_0x2457f1,null));};exports[_0xdaea('0x57')]=function(_0x38a786,_0x128bfc,_0x2c6189){var _0x20b837={};var _0x971be8={};var _0x5d302a;var _0x4a8d1d;return db[_0xdaea('0x31')][_0xdaea('0x58')]({'where':{'id':_0x38a786[_0xdaea('0x4b')]['id']}})[_0xdaea('0x28')](handleEntityNotFound(_0x128bfc,null))[_0xdaea('0x28')](function(_0x3e3744){if(_0x3e3744){_0x5d302a=_0x3e3744;_0x971be8[_0xdaea('0x3a')]=_['keys'](db[_0xdaea('0x31')]['rawAttributes']);_0x971be8['query']=_[_0xdaea('0x37')](_0x38a786[_0xdaea('0x36')]);_0x971be8['filters']=_[_0xdaea('0x39')](_0x971be8[_0xdaea('0x3a')],_0x971be8['query']);_0x20b837['attributes']=_[_0xdaea('0x39')](_0x971be8[_0xdaea('0x3a')],qs[_0xdaea('0x3c')](_0x38a786['query'][_0xdaea('0x3c')]));_0x20b837[_0xdaea('0x3b')]=_0x20b837[_0xdaea('0x3b')]['length']?_0x20b837[_0xdaea('0x3b')]:_0x971be8[_0xdaea('0x3a')];_0x20b837[_0xdaea('0x3e')]=qs['sort'](_0x38a786[_0xdaea('0x36')][_0xdaea('0x3f')]);_0x20b837[_0xdaea('0x40')]=qs['filters'](_['pick'](_0x38a786[_0xdaea('0x36')],_0x971be8[_0xdaea('0x38')]));if(_0x38a786[_0xdaea('0x36')]['filter']){_0x20b837[_0xdaea('0x40')]=_['merge'](_0x20b837[_0xdaea('0x40')],{'$or':_[_0xdaea('0x30')](_0x20b837[_0xdaea('0x3b')],function(_0x2cf254){var _0x1e9f7d={};_0x1e9f7d[_0x2cf254]={'$like':'%'+_0x38a786[_0xdaea('0x36')][_0xdaea('0x42')]+'%'};return _0x1e9f7d;})});}_0x20b837=_[_0xdaea('0x43')]({},_0x20b837,_0x38a786[_0xdaea('0x44')]);return _0x5d302a[_0xdaea('0x57')](_0x20b837);}})['then'](function(_0x59353b){if(_0x59353b){_0x4a8d1d=_0x59353b[_0xdaea('0x59')];if(!_0x38a786['query'][_0xdaea('0x3d')]('nolimit')){_0x20b837[_0xdaea('0x1f')]=qs['limit'](_0x38a786[_0xdaea('0x36')][_0xdaea('0x1f')]);_0x20b837[_0xdaea('0x21')]=qs[_0xdaea('0x21')](_0x38a786[_0xdaea('0x36')][_0xdaea('0x21')]);}return _0x5d302a[_0xdaea('0x57')](_0x20b837);}})[_0xdaea('0x28')](function(_0x2fca53){if(_0x2fca53){return _0x2fca53?{'count':_0x4a8d1d,'rows':_0x2fca53}:null;}})['then'](respondWithResult(_0x128bfc,null))['catch'](handleError(_0x128bfc,null));};exports['addIntervals']=function(_0x4a6b31,_0xce07ca,_0x3d398d){return db['Interval'][_0xdaea('0x58')]({'where':{'id':_0x4a6b31[_0xdaea('0x4b')]['id']}})[_0xdaea('0x28')](handleEntityNotFound(_0xce07ca,null))[_0xdaea('0x28')](function(_0x5e7d8d){if(_0x5e7d8d){return db[_0xdaea('0x5a')][_0xdaea('0x5b')](function(_0x595567){return db[_0xdaea('0x31')][_0xdaea('0x29')]({'where':{'IntervalId':_0x4a6b31[_0xdaea('0x4b')]['id']},'transaction':_0x595567})[_0xdaea('0x28')](function(_0x291de3){var _0x1d5743=_[_0xdaea('0x30')](_0x4a6b31[_0xdaea('0x4e')],function(_0x37749f){delete _0x37749f['id'];_0x37749f[_0xdaea('0x5c')]=_0x4a6b31[_0xdaea('0x4b')]['id'];return _0x37749f;});return db[_0xdaea('0x31')][_0xdaea('0x5d')](_0x1d5743,{'transaction':_0x595567});});})[_0xdaea('0x28')](function(){return db['Interval'][_0xdaea('0x47')]({'where':{'IntervalId':_0x4a6b31[_0xdaea('0x4b')]['id']}});});}})[_0xdaea('0x28')](respondWithResult(_0xce07ca,null))['catch'](handleError(_0xce07ca,null));}; \ No newline at end of file +var _0xaf96=['path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','Interval','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','user','role','Intervals','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','IntervalId','getIntervals','findOne','order','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','moment','bluebird','mustache'];(function(_0x437ec0,_0x309ee7){var _0x344a18=function(_0x8ef23){while(--_0x8ef23){_0x437ec0['push'](_0x437ec0['shift']());}};_0x344a18(++_0x309ee7);}(_0xaf96,0x16b));var _0x6af9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf96[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6af9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6af9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6af9('0x2'));var BPromise=require(_0x6af9('0x3'));var Mustache=require(_0x6af9('0x4'));var util=require('util');var path=require(_0x6af9('0x5'));var sox=require(_0x6af9('0x6'));var csv=require(_0x6af9('0x7'));var ejs=require(_0x6af9('0x8'));var fs=require('fs');var fs_extra=require(_0x6af9('0x9'));var _=require(_0x6af9('0xa'));var squel=require(_0x6af9('0xb'));var crypto=require(_0x6af9('0xc'));var jsforce=require(_0x6af9('0xd'));var deskjs=require(_0x6af9('0xe'));var toCsv=require(_0x6af9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6af9('0xf'));var authService=require(_0x6af9('0x10'));var qs=require(_0x6af9('0x11'));var as=require(_0x6af9('0x12'));var hardwareService=require(_0x6af9('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6af9('0x14'));var licenseUtil=require(_0x6af9('0x15'));var db=require('../../mysqldb')['db'];var extensions=require(_0x6af9('0x16'));function respondWithStatusCode(_0x552fbc,_0x405b86){_0x405b86=_0x405b86||0xcc;return function(_0x4359b4){if(_0x4359b4){return _0x552fbc[_0x6af9('0x17')](_0x405b86);}return _0x552fbc[_0x6af9('0x18')](_0x405b86)[_0x6af9('0x19')]();};}function respondWithResult(_0xfabf92,_0x3ec3df){_0x3ec3df=_0x3ec3df||0xc8;return function(_0x5d39c0){if(_0x5d39c0){return _0xfabf92[_0x6af9('0x18')](_0x3ec3df)[_0x6af9('0x1a')](_0x5d39c0);}};}function respondWithFilteredResult(_0x25d018,_0x190b0a){return function(_0x256669){if(_0x256669){var _0x498362=typeof _0x190b0a[_0x6af9('0x1b')]===_0x6af9('0x1c')&&typeof _0x190b0a['limit']===_0x6af9('0x1c');var _0x3bad7d=_0x256669[_0x6af9('0x1d')];var _0xa55b89=_0x498362?0x0:_0x190b0a[_0x6af9('0x1b')];var _0x4c9c15=_0x498362?_0x256669[_0x6af9('0x1d')]:_0x190b0a[_0x6af9('0x1b')]+_0x190b0a[_0x6af9('0x1e')];var _0x215a02;if(_0x4c9c15>=_0x3bad7d){_0x4c9c15=_0x3bad7d;_0x215a02=0xc8;}else{_0x215a02=0xce;}_0x25d018[_0x6af9('0x18')](_0x215a02);return _0x25d018[_0x6af9('0x1f')](_0x6af9('0x20'),_0xa55b89+'-'+_0x4c9c15+'/'+_0x3bad7d)['json'](_0x256669);}return null;};}function patchUpdates(_0x7d851e){return function(_0x48cae8){try{jsonpatch[_0x6af9('0x21')](_0x48cae8,_0x7d851e,!![]);}catch(_0x1438db){return BPromise[_0x6af9('0x22')](_0x1438db);}return _0x48cae8[_0x6af9('0x23')]();};}function saveUpdates(_0x51a80f,_0x2443a4){return function(_0x3dbacc){if(_0x3dbacc){return _0x3dbacc['update'](_0x51a80f)[_0x6af9('0x24')](function(_0x1fdd9f){return _0x1fdd9f;});}return null;};}function removeEntity(_0x4fcb5c,_0x2e96ce){return function(_0x108b4b){if(_0x108b4b){return _0x108b4b[_0x6af9('0x25')]()[_0x6af9('0x24')](function(){var _0x24a677=_0x108b4b[_0x6af9('0x26')]({'plain':!![]});var _0x20d133='Intervals';return db[_0x6af9('0x27')]['destroy']({'where':{'type':_0x20d133,'resourceId':_0x24a677['id']}})[_0x6af9('0x24')](function(){return _0x108b4b;});})[_0x6af9('0x24')](function(){_0x4fcb5c[_0x6af9('0x18')](0xcc)[_0x6af9('0x19')]();});}};}function handleEntityNotFound(_0x551d39,_0x21e6d8){return function(_0xe68ef3){if(!_0xe68ef3){_0x551d39[_0x6af9('0x17')](0x194);}return _0xe68ef3;};}function handleError(_0x21a65a,_0x3b93d9){_0x3b93d9=_0x3b93d9||0x1f4;return function(_0x343071){logger[_0x6af9('0x28')](_0x343071[_0x6af9('0x29')]);if(_0x343071[_0x6af9('0x2a')]){delete _0x343071[_0x6af9('0x2a')];}_0x21a65a[_0x6af9('0x18')](_0x3b93d9)[_0x6af9('0x2b')](_0x343071);};}exports[_0x6af9('0x2c')]=function(_0x343fd3,_0x4776e8){var _0x3704ef={},_0x42e53c={},_0x3191ef={'count':0x0,'rows':[]};var _0x3a3854=_['map'](db['Interval'][_0x6af9('0x2d')],function(_0x186679){return{'name':_0x186679[_0x6af9('0x2e')],'type':_0x186679[_0x6af9('0x2f')][_0x6af9('0x30')]};});_0x42e53c[_0x6af9('0x31')]=_['map'](_0x3a3854,_0x6af9('0x2a'));_0x42e53c[_0x6af9('0x32')]=_[_0x6af9('0x33')](_0x343fd3[_0x6af9('0x32')]);_0x42e53c[_0x6af9('0x34')]=_[_0x6af9('0x35')](_0x42e53c[_0x6af9('0x31')],_0x42e53c[_0x6af9('0x32')]);_0x3704ef[_0x6af9('0x36')]=_['intersection'](_0x42e53c['model'],qs[_0x6af9('0x37')](_0x343fd3['query'][_0x6af9('0x37')]));_0x3704ef[_0x6af9('0x36')]=_0x3704ef[_0x6af9('0x36')]['length']?_0x3704ef[_0x6af9('0x36')]:_0x42e53c['model'];if(!_0x343fd3['query'][_0x6af9('0x38')](_0x6af9('0x39'))){_0x3704ef['limit']=qs['limit'](_0x343fd3[_0x6af9('0x32')][_0x6af9('0x1e')]);_0x3704ef[_0x6af9('0x1b')]=qs[_0x6af9('0x1b')](_0x343fd3[_0x6af9('0x32')]['offset']);}_0x3704ef['order']=qs[_0x6af9('0x3a')](_0x343fd3[_0x6af9('0x32')]['sort']);_0x3704ef['where']=qs[_0x6af9('0x34')](_[_0x6af9('0x3b')](_0x343fd3[_0x6af9('0x32')],_0x42e53c[_0x6af9('0x34')]),_0x3a3854);if(_0x343fd3[_0x6af9('0x32')][_0x6af9('0x3c')]){_0x3704ef[_0x6af9('0x3d')]=_[_0x6af9('0x3e')](_0x3704ef[_0x6af9('0x3d')],{'$or':_[_0x6af9('0x3f')](_0x3a3854,function(_0xf85a94){if(_0xf85a94['type']!=='VIRTUAL'){var _0x201d7b={};_0x201d7b[_0xf85a94[_0x6af9('0x2a')]]={'$like':'%'+_0x343fd3[_0x6af9('0x32')][_0x6af9('0x3c')]+'%'};return _0x201d7b;}})});}_0x3704ef=_[_0x6af9('0x3e')]({},_0x3704ef,_0x343fd3['options']);var _0x54513f={'where':_0x3704ef[_0x6af9('0x3d')]};return db[_0x6af9('0x40')][_0x6af9('0x1d')](_0x54513f)['then'](function(_0x1ecbbd){_0x3191ef[_0x6af9('0x1d')]=_0x1ecbbd;if(_0x343fd3[_0x6af9('0x32')][_0x6af9('0x41')]){_0x3704ef[_0x6af9('0x42')]=[{'all':!![]}];}return db[_0x6af9('0x40')][_0x6af9('0x43')](_0x3704ef);})[_0x6af9('0x24')](function(_0x191018){_0x3191ef[_0x6af9('0x44')]=_0x191018;return _0x3191ef;})[_0x6af9('0x24')](respondWithFilteredResult(_0x4776e8,_0x3704ef))[_0x6af9('0x45')](handleError(_0x4776e8,null));};exports[_0x6af9('0x46')]=function(_0x10f213,_0x83664d){var _0x31603a={'raw':!![],'where':{'id':_0x10f213[_0x6af9('0x47')]['id']}},_0xdc14a7={};_0xdc14a7[_0x6af9('0x31')]=_['keys'](db['Interval'][_0x6af9('0x2d')]);_0xdc14a7[_0x6af9('0x32')]=_[_0x6af9('0x33')](_0x10f213[_0x6af9('0x32')]);_0xdc14a7[_0x6af9('0x34')]=_[_0x6af9('0x35')](_0xdc14a7[_0x6af9('0x31')],_0xdc14a7[_0x6af9('0x32')]);_0x31603a['attributes']=_[_0x6af9('0x35')](_0xdc14a7[_0x6af9('0x31')],qs[_0x6af9('0x37')](_0x10f213[_0x6af9('0x32')][_0x6af9('0x37')]));_0x31603a[_0x6af9('0x36')]=_0x31603a[_0x6af9('0x36')][_0x6af9('0x48')]?_0x31603a[_0x6af9('0x36')]:_0xdc14a7[_0x6af9('0x31')];if(_0x10f213[_0x6af9('0x32')][_0x6af9('0x41')]){_0x31603a[_0x6af9('0x42')]=[{'all':!![]}];}_0x31603a=_[_0x6af9('0x3e')]({},_0x31603a,_0x10f213[_0x6af9('0x49')]);return db[_0x6af9('0x40')][_0x6af9('0x4a')](_0x31603a)[_0x6af9('0x24')](handleEntityNotFound(_0x83664d,null))['then'](respondWithResult(_0x83664d,null))[_0x6af9('0x45')](handleError(_0x83664d,null));};exports[_0x6af9('0x4b')]=function(_0x436692,_0xf81096){return db[_0x6af9('0x40')]['create'](_0x436692[_0x6af9('0x4c')],{})[_0x6af9('0x24')](function(_0x58fb00){var _0x17c8ed=_0x436692[_0x6af9('0x4d')]['get']({'plain':!![]});if(!_0x17c8ed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17c8ed[_0x6af9('0x4e')]===_0x6af9('0x4d')){var _0x8bd5b0=_0x58fb00['get']({'plain':!![]});var _0x4d7abe=_0x6af9('0x4f');return db[_0x6af9('0x50')][_0x6af9('0x4a')]({'where':{'name':_0x4d7abe,'userProfileId':_0x17c8ed['userProfileId']},'raw':!![]})[_0x6af9('0x24')](function(_0x2d1dbe){if(_0x2d1dbe&&_0x2d1dbe[_0x6af9('0x51')]===0x0){return db['UserProfileResource'][_0x6af9('0x4b')]({'name':_0x8bd5b0[_0x6af9('0x2a')],'resourceId':_0x8bd5b0['id'],'type':_0x2d1dbe[_0x6af9('0x2a')],'sectionId':_0x2d1dbe['id']},{})['then'](function(){return _0x58fb00;});}else{return _0x58fb00;}})[_0x6af9('0x45')](function(_0x282025){logger[_0x6af9('0x28')](_0x6af9('0x52'),_0x282025);throw _0x282025;});}return _0x58fb00;})['then'](respondWithResult(_0xf81096,0xc9))[_0x6af9('0x45')](handleError(_0xf81096,null));};exports[_0x6af9('0x53')]=function(_0x25c97e,_0x1effa2){if(_0x25c97e[_0x6af9('0x4c')]['id']){delete _0x25c97e['body']['id'];}return db[_0x6af9('0x40')]['find']({'where':{'id':_0x25c97e[_0x6af9('0x47')]['id']}})[_0x6af9('0x24')](handleEntityNotFound(_0x1effa2,null))['then'](saveUpdates(_0x25c97e['body'],null))[_0x6af9('0x24')](respondWithResult(_0x1effa2,null))[_0x6af9('0x45')](handleError(_0x1effa2,null));};exports[_0x6af9('0x25')]=function(_0x36f244,_0x1099b0){return db[_0x6af9('0x40')]['find']({'where':{'id':_0x36f244[_0x6af9('0x47')]['id']}})['then'](handleEntityNotFound(_0x1099b0,null))['then'](removeEntity(_0x1099b0,null))[_0x6af9('0x45')](handleError(_0x1099b0,null));};exports['addInterval']=function(_0x253cc3,_0x2e150b,_0x536e8d){if(_0x253cc3[_0x6af9('0x4c')]['id']){delete _0x253cc3[_0x6af9('0x4c')]['id'];}return db[_0x6af9('0x40')]['find']({'where':{'id':_0x253cc3[_0x6af9('0x47')]['id']}})[_0x6af9('0x24')](handleEntityNotFound(_0x2e150b,null))['then'](function(_0x66acb6){if(_0x66acb6){_0x253cc3[_0x6af9('0x4c')][_0x6af9('0x54')]=_0x66acb6['id'];return db[_0x6af9('0x40')]['create'](_0x253cc3[_0x6af9('0x4c')]);}})[_0x6af9('0x24')](respondWithResult(_0x2e150b,null))[_0x6af9('0x45')](handleError(_0x2e150b,null));};exports[_0x6af9('0x55')]=function(_0x3146e5,_0xa1e317,_0xc4ebc9){var _0x4f7219={};var _0x19d1a2={};var _0x8a5792;var _0x15c00f;return db[_0x6af9('0x40')][_0x6af9('0x56')]({'where':{'id':_0x3146e5['params']['id']}})[_0x6af9('0x24')](handleEntityNotFound(_0xa1e317,null))[_0x6af9('0x24')](function(_0x59fb2e){if(_0x59fb2e){_0x8a5792=_0x59fb2e;_0x19d1a2['model']=_[_0x6af9('0x33')](db[_0x6af9('0x40')][_0x6af9('0x2d')]);_0x19d1a2[_0x6af9('0x32')]=_[_0x6af9('0x33')](_0x3146e5[_0x6af9('0x32')]);_0x19d1a2[_0x6af9('0x34')]=_[_0x6af9('0x35')](_0x19d1a2['model'],_0x19d1a2[_0x6af9('0x32')]);_0x4f7219['attributes']=_[_0x6af9('0x35')](_0x19d1a2[_0x6af9('0x31')],qs['fields'](_0x3146e5[_0x6af9('0x32')]['fields']));_0x4f7219[_0x6af9('0x36')]=_0x4f7219['attributes'][_0x6af9('0x48')]?_0x4f7219[_0x6af9('0x36')]:_0x19d1a2['model'];_0x4f7219[_0x6af9('0x57')]=qs[_0x6af9('0x3a')](_0x3146e5[_0x6af9('0x32')][_0x6af9('0x3a')]);_0x4f7219[_0x6af9('0x3d')]=qs['filters'](_[_0x6af9('0x3b')](_0x3146e5[_0x6af9('0x32')],_0x19d1a2['filters']));if(_0x3146e5[_0x6af9('0x32')][_0x6af9('0x3c')]){_0x4f7219['where']=_['merge'](_0x4f7219['where'],{'$or':_[_0x6af9('0x3f')](_0x4f7219[_0x6af9('0x36')],function(_0x4f4869){var _0x4a2043={};_0x4a2043[_0x4f4869]={'$like':'%'+_0x3146e5[_0x6af9('0x32')][_0x6af9('0x3c')]+'%'};return _0x4a2043;})});}_0x4f7219=_[_0x6af9('0x3e')]({},_0x4f7219,_0x3146e5['options']);return _0x8a5792['getIntervals'](_0x4f7219);}})[_0x6af9('0x24')](function(_0x1c213b){if(_0x1c213b){_0x15c00f=_0x1c213b[_0x6af9('0x48')];if(!_0x3146e5[_0x6af9('0x32')][_0x6af9('0x38')]('nolimit')){_0x4f7219[_0x6af9('0x1e')]=qs[_0x6af9('0x1e')](_0x3146e5[_0x6af9('0x32')][_0x6af9('0x1e')]);_0x4f7219[_0x6af9('0x1b')]=qs[_0x6af9('0x1b')](_0x3146e5['query'][_0x6af9('0x1b')]);}return _0x8a5792['getIntervals'](_0x4f7219);}})[_0x6af9('0x24')](function(_0x40e294){if(_0x40e294){return _0x40e294?{'count':_0x15c00f,'rows':_0x40e294}:null;}})['then'](respondWithResult(_0xa1e317,null))[_0x6af9('0x45')](handleError(_0xa1e317,null));};exports[_0x6af9('0x58')]=function(_0x4dc248,_0x43fa06,_0x30643a){return db[_0x6af9('0x40')][_0x6af9('0x56')]({'where':{'id':_0x4dc248[_0x6af9('0x47')]['id']}})[_0x6af9('0x24')](handleEntityNotFound(_0x43fa06,null))[_0x6af9('0x24')](function(_0x3f3201){if(_0x3f3201){return db[_0x6af9('0x59')][_0x6af9('0x5a')](function(_0x25f59a){return db[_0x6af9('0x40')][_0x6af9('0x25')]({'where':{'IntervalId':_0x4dc248[_0x6af9('0x47')]['id']},'transaction':_0x25f59a})[_0x6af9('0x24')](function(_0x1637bc){var _0x30767a=_[_0x6af9('0x3f')](_0x4dc248[_0x6af9('0x4c')],function(_0x3cdd28){delete _0x3cdd28['id'];_0x3cdd28[_0x6af9('0x54')]=_0x4dc248[_0x6af9('0x47')]['id'];return _0x3cdd28;});return db[_0x6af9('0x40')][_0x6af9('0x5b')](_0x30767a,{'transaction':_0x25f59a});});})['then'](function(){return db['Interval'][_0x6af9('0x43')]({'where':{'IntervalId':_0x4dc248[_0x6af9('0x47')]['id']}});});}})[_0x6af9('0x24')](respondWithResult(_0x43fa06,null))[_0x6af9('0x45')](handleError(_0x43fa06,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index b082381..ca32d01 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 _0x2ba0=['path','rimraf','./interval.attributes','define','Interval','tools_intervals','rewrite','util','../../config/logger','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2ba0,0x1dd));var _0x02ba=function(_0x446341,_0xae27c6){_0x446341=_0x446341-0x0;var _0x195911=_0x2ba0[_0x446341];return _0x195911;};'use strict';var _=require('lodash');var util=require(_0x02ba('0x0'));var logger=require(_0x02ba('0x1'))('api');var moment=require('moment');var BPromise=require(_0x02ba('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02ba('0x3'));var rimraf=require(_0x02ba('0x4'));var config=require('../../config/environment');var attributes=require(_0x02ba('0x5'));var extensions=require('../../components/extensions/rewrite');module['exports']=function(_0x3a924d,_0x4e1bfc){return _0x3a924d[_0x02ba('0x6')](_0x02ba('0x7'),attributes,{'tableName':_0x02ba('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5817f9,_0x392ea0){extensions[_0x02ba('0x9')](_0x3a924d,_0x5817f9);},'afterBulkCreate':function(_0x2c1c72,_0x574a41,_0x45c487){_0x45c487();extensions[_0x02ba('0x9')](_0x3a924d,_0x2c1c72[0x0]);},'afterUpdate':function(_0x4635bb,_0x396b32){extensions[_0x02ba('0x9')](_0x3a924d,_0x4635bb);},'afterDestroy':function(_0x5eff87,_0x3f7478){extensions[_0x02ba('0x9')](_0x3a924d,_0x5eff87);}}});}; \ No newline at end of file +var _0x2304=['api','request-promise','../../config/environment','../../components/extensions/rewrite','tools_intervals','rewrite','lodash','util','../../config/logger'];(function(_0x4d6db7,_0x31d090){var _0x4ed49d=function(_0x2335de){while(--_0x2335de){_0x4d6db7['push'](_0x4d6db7['shift']());}};_0x4ed49d(++_0x31d090);}(_0x2304,0x192));var _0x4230=function(_0x5940b8,_0xdb8f8c){_0x5940b8=_0x5940b8-0x0;var _0x32a185=_0x2304[_0x5940b8];return _0x32a185;};'use strict';var _=require(_0x4230('0x0'));var util=require(_0x4230('0x1'));var logger=require(_0x4230('0x2'))(_0x4230('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4230('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4230('0x5'));var attributes=require('./interval.attributes');var extensions=require(_0x4230('0x6'));module['exports']=function(_0x4ac158,_0x3c32dd){return _0x4ac158['define']('Interval',attributes,{'tableName':_0x4230('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d8c93,_0xc4fcc){extensions['rewrite'](_0x4ac158,_0x5d8c93);},'afterBulkCreate':function(_0x2e63e2,_0x59c96f,_0x18b8f6){_0x18b8f6();extensions[_0x4230('0x8')](_0x4ac158,_0x2e63e2[0x0]);},'afterUpdate':function(_0x262a37,_0x89fc3b){extensions['rewrite'](_0x4ac158,_0x262a37);},'afterDestroy':function(_0xdc2729,_0x56164b){extensions[_0x4230('0x8')](_0x4ac158,_0xdc2729);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 9c9f812..0e159f1 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 4576753..bda84ba 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x3cccf3,_0x372fc9){var _0xecac1c=function(_0xbe2a05){while(--_0xbe2a05){_0x3cccf3['push'](_0x3cccf3['shift']());}};_0xecac1c(++_0x372fc9);}(_0xadb5,0xad));var _0x5adb=function(_0x442f74,_0x1486cc){_0x442f74=_0x442f74-0x0;var _0x342d70=_0xadb5[_0x442f74];return _0x342d70;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x59dc64,_0xd7dbdf){var _0xdcbf81=function(_0x4f8b55){while(--_0x4f8b55){_0x59dc64['push'](_0x59dc64['shift']());}};_0xdcbf81(++_0xd7dbdf);}(_0xadb5,0xad));var _0x5adb=function(_0x285d60,_0x3d6c2f){_0x285d60=_0x285d60-0x0;var _0x31440f=_0xadb5[_0x285d60];return _0x31440f;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 34e1137..c0aa043 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 _0x9e6d=['3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','POST','application/json','toString','base64','setEncoding','utf8','data','end','status','statusCode','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','connection','remoteAddress','socket','https','../../config/logger','api','support'];(function(_0x1222a6,_0x2a692d){var _0x46cca5=function(_0x1883a1){while(--_0x1883a1){_0x1222a6['push'](_0x1222a6['shift']());}};_0x46cca5(++_0x2a692d);}(_0x9e6d,0x1aa));var _0xd9e6=function(_0x36c128,_0x32fed3){_0x36c128=_0x36c128-0x0;var _0x40ef4c=_0x9e6d[_0x36c128];return _0x40ef4c;};'use strict';var BPromise=require('bluebird');var https=require(_0xd9e6('0x0'));var logger=require(_0xd9e6('0x1'))(_0xd9e6('0x2'));var USERNAME=_0xd9e6('0x3');var PASSWORD=_0xd9e6('0x4');function openIssue(_0x2ca0b3,_0x451f98){var _0x354752={'fields':{'project':{'key':_0x2ca0b3[_0xd9e6('0x5')]||_0xd9e6('0x6')},'summary':(_0x2ca0b3[_0xd9e6('0x7')]||_0xd9e6('0x8'))+_0xd9e6('0x9')+_0x2ca0b3['ip'],'description':_0x2ca0b3[_0xd9e6('0xa')]||JSON[_0xd9e6('0xb')](_0x2ca0b3),'issuetype':{'name':_0x2ca0b3[_0xd9e6('0xc')]||_0xd9e6('0xd')}}};_0x354752[_0xd9e6('0xe')][_0xd9e6('0xf')]=_0x2ca0b3[_0xd9e6('0x10')];_0x354752[_0xd9e6('0xe')][_0xd9e6('0x11')]=_0x2ca0b3[_0xd9e6('0x12')];_0x354752[_0xd9e6('0xe')][_0xd9e6('0x13')]=_0x2ca0b3['newToken'];_0x354752[_0xd9e6('0xe')][_0xd9e6('0x14')]=_0x2ca0b3[_0xd9e6('0x15')];_0x354752[_0xd9e6('0xe')][_0xd9e6('0x16')]=_0x2ca0b3[_0xd9e6('0x17')];_0x354752[_0xd9e6('0xe')]['customfield_10102']=_0x2ca0b3['ip'];var _0x1a2da4={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0xd9e6('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xd9e6('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xd9e6('0x1a')](_0xd9e6('0x1b'))}};var _0x3524b8=JSON['stringify'](_0x354752);var _0x4bfb11=https['request'](_0x1a2da4,function(_0x185e2a){_0x185e2a[_0xd9e6('0x1c')](_0xd9e6('0x1d'));var _0x57af9f='';_0x185e2a['on'](_0xd9e6('0x1e'),function(_0xbafd77){_0x57af9f+=_0xbafd77;});_0x185e2a['on'](_0xd9e6('0x1f'),function(){if(_0x451f98){return _0x451f98[_0xd9e6('0x20')](_0x185e2a[_0xd9e6('0x21')])['json'](JSON['parse'](_0x57af9f));}});});_0x4bfb11['on'](_0xd9e6('0x22'),function(_0x4ce5ea){if(_0x451f98){return _0x451f98[_0xd9e6('0x20')](0x1f4)[_0xd9e6('0x23')]({'errors':[{'message':_0xd9e6('0x24'),'type':'api.jira'}]});}});_0x4bfb11[_0xd9e6('0x25')](_0x3524b8);_0x4bfb11['end']();}exports[_0xd9e6('0x26')]=openIssue;exports[_0xd9e6('0x27')]=function(_0x1feeac,_0x2c20a8){_0x1feeac['body']['ip']=_0x1feeac['headers']['x-forwarded-for']||_0x1feeac[_0xd9e6('0x28')][_0xd9e6('0x29')]||_0x1feeac[_0xd9e6('0x2a')][_0xd9e6('0x29')]||_0x1feeac[_0xd9e6('0x28')][_0xd9e6('0x2a')][_0xd9e6('0x29')];return openIssue(_0x1feeac['body'],_0x2c20a8);}; \ No newline at end of file +var _0xfa65=['track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','fields','customfield_11500','email','oldToken','customfield_11502','customfield_11503','name','customfield_11504','reason','customfield_10102'];(function(_0x408746,_0x2e34b8){var _0xd5158b=function(_0x3d39b0){while(--_0x3d39b0){_0x408746['push'](_0x408746['shift']());}};_0xd5158b(++_0x2e34b8);}(_0xfa65,0xa2));var _0x5fa6=function(_0x9164da,_0x1aaffe){_0x9164da=_0x9164da-0x0;var _0x52247d=_0xfa65[_0x9164da];return _0x52247d;};'use strict';var BPromise=require(_0x5fa6('0x0'));var https=require(_0x5fa6('0x1'));var logger=require('../../config/logger')(_0x5fa6('0x2'));var USERNAME=_0x5fa6('0x3');var PASSWORD=_0x5fa6('0x4');function openIssue(_0x317ac3,_0x15ad10){var _0x23eee0={'fields':{'project':{'key':_0x317ac3['key']||_0x5fa6('0x5')},'summary':(_0x317ac3[_0x5fa6('0x6')]||'Report')+_0x5fa6('0x7')+_0x317ac3['ip'],'description':_0x317ac3['description']||JSON['stringify'](_0x317ac3),'issuetype':{'name':_0x317ac3['issuetype']||'Bug'}}};_0x23eee0[_0x5fa6('0x8')][_0x5fa6('0x9')]=_0x317ac3[_0x5fa6('0xa')];_0x23eee0['fields']['customfield_11501']=_0x317ac3[_0x5fa6('0xb')];_0x23eee0[_0x5fa6('0x8')][_0x5fa6('0xc')]=_0x317ac3['newToken'];_0x23eee0[_0x5fa6('0x8')][_0x5fa6('0xd')]=_0x317ac3[_0x5fa6('0xe')];_0x23eee0[_0x5fa6('0x8')][_0x5fa6('0xf')]=_0x317ac3[_0x5fa6('0x10')];_0x23eee0[_0x5fa6('0x8')][_0x5fa6('0x11')]=_0x317ac3['ip'];var _0x54af0d={'host':_0x5fa6('0x12'),'port':0x1bb,'path':_0x5fa6('0x13'),'method':_0x5fa6('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x5fa6('0x15'),'Authorization':_0x5fa6('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x5fa6('0x17')](_0x5fa6('0x18'))}};var _0x3b9a56=JSON[_0x5fa6('0x19')](_0x23eee0);var _0x2864e2=https[_0x5fa6('0x1a')](_0x54af0d,function(_0x51f59d){_0x51f59d[_0x5fa6('0x1b')](_0x5fa6('0x1c'));var _0x191f5f='';_0x51f59d['on'](_0x5fa6('0x1d'),function(_0x52fa45){_0x191f5f+=_0x52fa45;});_0x51f59d['on'](_0x5fa6('0x1e'),function(){if(_0x15ad10){return _0x15ad10[_0x5fa6('0x1f')](_0x51f59d[_0x5fa6('0x20')])[_0x5fa6('0x21')](JSON['parse'](_0x191f5f));}});});_0x2864e2['on'](_0x5fa6('0x22'),function(_0x4afcd6){if(_0x15ad10){return _0x15ad10[_0x5fa6('0x1f')](0x1f4)[_0x5fa6('0x21')]({'errors':[{'message':_0x5fa6('0x23'),'type':_0x5fa6('0x24')}]});}});_0x2864e2[_0x5fa6('0x25')](_0x3b9a56);_0x2864e2[_0x5fa6('0x1e')]();}exports[_0x5fa6('0x26')]=openIssue;exports['send']=function(_0x4b695e,_0x5ce333){_0x4b695e[_0x5fa6('0x27')]['ip']=_0x4b695e[_0x5fa6('0x28')][_0x5fa6('0x29')]||_0x4b695e[_0x5fa6('0x2a')][_0x5fa6('0x2b')]||_0x4b695e['socket']['remoteAddress']||_0x4b695e[_0x5fa6('0x2a')][_0x5fa6('0x2c')][_0x5fa6('0x2b')];return openIssue(_0x4b695e[_0x5fa6('0x27')],_0x5ce333);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 2b03484..e2dca8b 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 _0x878f=['./jscriptyAnswerReport.controller','get','/describe','/:id','post','isAuthenticated','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a2299,_0x3e2922){var _0xedff0f=function(_0x1624cb){while(--_0x1624cb){_0x5a2299['push'](_0x5a2299['shift']());}};_0xedff0f(++_0x3e2922);}(_0x878f,0x173));var _0xf878=function(_0x40c36e,_0x1c07e0){_0x40c36e=_0x40c36e-0x0;var _0x48fe55=_0x878f[_0x40c36e];return _0x48fe55;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xd')]('/',auth[_0xf878('0xe')](),controller[_0xf878('0xf')]);router['put'](_0xf878('0xc'),auth[_0xf878('0xe')](),controller['update']);router[_0xf878('0x10')]('/:id',auth[_0xf878('0xe')](),controller[_0xf878('0x11')]);module[_0xf878('0x12')]=router; \ No newline at end of file +var _0xb821=['../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','Router','../../components/interaction/service'];(function(_0x3ea84a,_0x312fdf){var _0x8dbea6=function(_0x384066){while(--_0x384066){_0x3ea84a['push'](_0x3ea84a['shift']());}};_0x8dbea6(++_0x312fdf);}(_0xb821,0xa7));var _0x1b82=function(_0x46279d,_0x42576c){_0x46279d=_0x46279d-0x0;var _0x2f4b7b=_0xb821[_0x46279d];return _0x2f4b7b;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xa')]);router[_0x1b82('0x6')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xc')]);router['post']('/',auth[_0x1b82('0x9')](),controller[_0x1b82('0xd')]);router[_0x1b82('0xe')](_0x1b82('0xb'),auth[_0x1b82('0x9')](),controller[_0x1b82('0xf')]);router[_0x1b82('0x10')](_0x1b82('0xb'),auth['isAuthenticated'](),controller[_0x1b82('0x11')]);module[_0x1b82('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 f5c1b0e..2819d84 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(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7a54,0x106));var _0x47a5=function(_0x245d29,_0x3ecd24){_0x245d29=_0x245d29-0x0;var _0x588850=_0x7a54[_0x245d29];return _0x588850;};'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(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7a54,0x106));var _0x47a5=function(_0x2b048f,_0x46241a){_0x2b048f=_0x2b048f-0x0;var _0x282127=_0x7a54[_0x2b048f];return _0x282127;};'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 a978cd3..ee25bfc 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 _0x535f=['sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','JscriptyAnswerReport','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','fields','options','find','catch','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path'];(function(_0xc00e84,_0x1e7a16){var _0x51f197=function(_0x195368){while(--_0x195368){_0xc00e84['push'](_0xc00e84['shift']());}};_0x51f197(++_0x1e7a16);}(_0x535f,0x111));var _0xf535=function(_0x2cb05c,_0x2ab0d6){_0x2cb05c=_0x2cb05c-0x0;var _0x1ae777=_0x535f[_0x2cb05c];return _0x1ae777;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf535('0x0'));var zipdir=require(_0xf535('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf535('0x2'));var moment=require(_0xf535('0x3'));var BPromise=require(_0xf535('0x4'));var Mustache=require(_0xf535('0x5'));var util=require('util');var path=require(_0xf535('0x6'));var sox=require(_0xf535('0x7'));var csv=require(_0xf535('0x8'));var ejs=require(_0xf535('0x9'));var fs=require('fs');var fs_extra=require(_0xf535('0xa'));var _=require(_0xf535('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf535('0xc'));var deskjs=require(_0xf535('0xd'));var toCsv=require(_0xf535('0x8'));var querystring=require('querystring');var Papa=require(_0xf535('0xe'));var Redis=require(_0xf535('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf535('0x10'));var hardwareService=require(_0xf535('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf535('0x12'));var config=require(_0xf535('0x13'));var licenseUtil=require(_0xf535('0x14'));var db=require(_0xf535('0x15'))['db'];function respondWithStatusCode(_0x471d53,_0x5e4cbd){_0x5e4cbd=_0x5e4cbd||0xcc;return function(_0x11928e){if(_0x11928e){return _0x471d53[_0xf535('0x16')](_0x5e4cbd);}return _0x471d53[_0xf535('0x17')](_0x5e4cbd)[_0xf535('0x18')]();};}function respondWithResult(_0x46792d,_0x338f06){_0x338f06=_0x338f06||0xc8;return function(_0x183049){if(_0x183049){return _0x46792d[_0xf535('0x17')](_0x338f06)[_0xf535('0x19')](_0x183049);}};}function respondWithFilteredResult(_0xb52d7f,_0xc3db30){return function(_0x4dacbb){if(_0x4dacbb){var _0x938e7f=typeof _0xc3db30[_0xf535('0x1a')]===_0xf535('0x1b')&&typeof _0xc3db30[_0xf535('0x1c')]===_0xf535('0x1b');var _0x1fb901=_0x4dacbb[_0xf535('0x1d')];var _0x33a8c3=_0x938e7f?0x0:_0xc3db30[_0xf535('0x1a')];var _0x477c1d=_0x938e7f?_0x4dacbb['count']:_0xc3db30[_0xf535('0x1a')]+_0xc3db30[_0xf535('0x1c')];var _0x6f757f;if(_0x477c1d>=_0x1fb901){_0x477c1d=_0x1fb901;_0x6f757f=0xc8;}else{_0x6f757f=0xce;}_0xb52d7f[_0xf535('0x17')](_0x6f757f);return _0xb52d7f['set'](_0xf535('0x1e'),_0x33a8c3+'-'+_0x477c1d+'/'+_0x1fb901)[_0xf535('0x19')](_0x4dacbb);}return null;};}function patchUpdates(_0x5c45bf){return function(_0x4ff009){try{jsonpatch['apply'](_0x4ff009,_0x5c45bf,!![]);}catch(_0x12f5d0){return BPromise[_0xf535('0x1f')](_0x12f5d0);}return _0x4ff009[_0xf535('0x20')]();};}function saveUpdates(_0x5e0ff4,_0x5b4980){return function(_0x438cb1){if(_0x438cb1){return _0x438cb1[_0xf535('0x21')](_0x5e0ff4)[_0xf535('0x22')](function(_0x16bd23){return _0x16bd23;});}return null;};}function removeEntity(_0x138cbd,_0x273ad0){return function(_0x358c91){if(_0x358c91){return _0x358c91[_0xf535('0x23')]()[_0xf535('0x22')](function(){_0x138cbd[_0xf535('0x17')](0xcc)[_0xf535('0x18')]();});}};}function handleEntityNotFound(_0x5b3917,_0x44ce19){return function(_0x28e761){if(!_0x28e761){_0x5b3917[_0xf535('0x16')](0x194);}return _0x28e761;};}function handleError(_0x46ce43,_0x407c5b){_0x407c5b=_0x407c5b||0x1f4;return function(_0x1250a0){logger[_0xf535('0x24')](_0x1250a0[_0xf535('0x25')]);if(_0x1250a0[_0xf535('0x26')]){delete _0x1250a0[_0xf535('0x26')];}_0x46ce43[_0xf535('0x17')](_0x407c5b)[_0xf535('0x27')](_0x1250a0);};}exports['index']=function(_0x5d1887,_0x47151e){var _0x12a94a={},_0xfba892={},_0x2fceb0={'count':0x0,'rows':[]};var _0x3e2cfe=_['map'](db[_0xf535('0x28')]['rawAttributes'],function(_0x508e77){return{'name':_0x508e77[_0xf535('0x29')],'type':_0x508e77[_0xf535('0x2a')][_0xf535('0x2b')]};});_0xfba892[_0xf535('0x2c')]=_[_0xf535('0x2d')](_0x3e2cfe,_0xf535('0x26'));_0xfba892['query']=_[_0xf535('0x2e')](_0x5d1887[_0xf535('0x2f')]);_0xfba892[_0xf535('0x30')]=_[_0xf535('0x31')](_0xfba892[_0xf535('0x2c')],_0xfba892[_0xf535('0x2f')]);_0x12a94a[_0xf535('0x32')]=_[_0xf535('0x31')](_0xfba892[_0xf535('0x2c')],qs['fields'](_0x5d1887[_0xf535('0x2f')]['fields']));_0x12a94a['attributes']=_0x12a94a['attributes'][_0xf535('0x33')]?_0x12a94a[_0xf535('0x32')]:_0xfba892[_0xf535('0x2c')];if(!_0x5d1887['query'][_0xf535('0x34')](_0xf535('0x35'))){_0x12a94a[_0xf535('0x1c')]=qs[_0xf535('0x1c')](_0x5d1887[_0xf535('0x2f')][_0xf535('0x1c')]);_0x12a94a['offset']=qs['offset'](_0x5d1887['query']['offset']);}_0x12a94a['order']=qs['sort'](_0x5d1887['query']['sort']);_0x12a94a[_0xf535('0x36')]=qs[_0xf535('0x30')](_['pick'](_0x5d1887[_0xf535('0x2f')],_0xfba892[_0xf535('0x30')]),_0x3e2cfe);if(_0x5d1887['query'][_0xf535('0x37')]){_0x12a94a[_0xf535('0x36')]=_[_0xf535('0x38')](_0x12a94a['where'],{'$or':_[_0xf535('0x2d')](_0x3e2cfe,function(_0x241685){if(_0x241685[_0xf535('0x2a')]!==_0xf535('0x39')){var _0x4945ef={};_0x4945ef[_0x241685[_0xf535('0x26')]]={'$like':'%'+_0x5d1887[_0xf535('0x2f')][_0xf535('0x37')]+'%'};return _0x4945ef;}})});}_0x12a94a=_[_0xf535('0x38')]({},_0x12a94a,_0x5d1887['options']);var _0x1c8198={'where':_0x12a94a[_0xf535('0x36')]};return db['JscriptyAnswerReport'][_0xf535('0x1d')](_0x1c8198)[_0xf535('0x22')](function(_0x506f27){_0x2fceb0['count']=_0x506f27;if(_0x5d1887[_0xf535('0x2f')][_0xf535('0x3a')]){_0x12a94a[_0xf535('0x3b')]=[{'all':!![]}];}return db[_0xf535('0x28')][_0xf535('0x3c')](_0x12a94a);})[_0xf535('0x22')](function(_0x3ab527){_0x2fceb0['rows']=_0x3ab527;return _0x2fceb0;})[_0xf535('0x22')](respondWithFilteredResult(_0x47151e,_0x12a94a))['catch'](handleError(_0x47151e,null));};exports[_0xf535('0x3d')]=function(_0x5eb910,_0x3583ca){var _0x598359={'raw':!![],'where':{'id':_0x5eb910[_0xf535('0x3e')]['id']}},_0x4fb589={};_0x4fb589['model']=_[_0xf535('0x2e')](db['JscriptyAnswerReport'][_0xf535('0x3f')]);_0x4fb589['query']=_[_0xf535('0x2e')](_0x5eb910[_0xf535('0x2f')]);_0x4fb589['filters']=_['intersection'](_0x4fb589[_0xf535('0x2c')],_0x4fb589[_0xf535('0x2f')]);_0x598359[_0xf535('0x32')]=_['intersection'](_0x4fb589['model'],qs[_0xf535('0x40')](_0x5eb910['query'][_0xf535('0x40')]));_0x598359['attributes']=_0x598359[_0xf535('0x32')]['length']?_0x598359[_0xf535('0x32')]:_0x4fb589['model'];if(_0x5eb910[_0xf535('0x2f')][_0xf535('0x3a')]){_0x598359[_0xf535('0x3b')]=[{'all':!![]}];}_0x598359=_[_0xf535('0x38')]({},_0x598359,_0x5eb910[_0xf535('0x41')]);return db[_0xf535('0x28')][_0xf535('0x42')](_0x598359)['then'](handleEntityNotFound(_0x3583ca,null))[_0xf535('0x22')](respondWithResult(_0x3583ca,null))[_0xf535('0x43')](handleError(_0x3583ca,null));};exports[_0xf535('0x44')]=function(_0x55fe82,_0x3ac295){return db[_0xf535('0x28')]['create'](_0x55fe82['body'],{})['then'](respondWithResult(_0x3ac295,0xc9))[_0xf535('0x43')](handleError(_0x3ac295,null));};exports[_0xf535('0x21')]=function(_0x42751b,_0x3096ff){if(_0x42751b[_0xf535('0x45')]['id']){delete _0x42751b[_0xf535('0x45')]['id'];}return db[_0xf535('0x28')]['find']({'where':{'id':_0x42751b['params']['id']}})[_0xf535('0x22')](handleEntityNotFound(_0x3096ff,null))[_0xf535('0x22')](saveUpdates(_0x42751b[_0xf535('0x45')],null))[_0xf535('0x22')](respondWithResult(_0x3096ff,null))['catch'](handleError(_0x3096ff,null));};exports[_0xf535('0x23')]=function(_0x499156,_0x132904){return db[_0xf535('0x28')][_0xf535('0x42')]({'where':{'id':_0x499156[_0xf535('0x3e')]['id']}})[_0xf535('0x22')](handleEntityNotFound(_0x132904,null))[_0xf535('0x22')](removeEntity(_0x132904,null))[_0xf535('0x43')](handleError(_0x132904,null));};exports['describe']=function(_0xdff8aa,_0x100982){return db[_0xf535('0x28')]['describe']()[_0xf535('0x22')](respondWithResult(_0x100982,null))[_0xf535('0x43')](handleError(_0x100982,null));}; \ No newline at end of file +var _0x34aa=['apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','show','params','rawAttributes','length','include','find','create','body','catch','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range'];(function(_0x3b534c,_0x2c614f){var _0x449ef9=function(_0x285279){while(--_0x285279){_0x3b534c['push'](_0x3b534c['shift']());}};_0x449ef9(++_0x2c614f);}(_0x34aa,0x171));var _0xa34a=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0x34aa[_0x456a4b];return _0x42957c;};'use strict';var emlformat=require(_0xa34a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa34a('0x1'));var jsonpatch=require(_0xa34a('0x2'));var rp=require(_0xa34a('0x3'));var moment=require(_0xa34a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa34a('0x5'));var util=require(_0xa34a('0x6'));var path=require(_0xa34a('0x7'));var sox=require(_0xa34a('0x8'));var csv=require(_0xa34a('0x9'));var ejs=require(_0xa34a('0xa'));var fs=require('fs');var fs_extra=require(_0xa34a('0xb'));var _=require(_0xa34a('0xc'));var squel=require(_0xa34a('0xd'));var crypto=require(_0xa34a('0xe'));var jsforce=require(_0xa34a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa34a('0x9'));var querystring=require(_0xa34a('0x10'));var Papa=require(_0xa34a('0x11'));var Redis=require(_0xa34a('0x12'));var authService=require(_0xa34a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa34a('0x14'));var hardwareService=require(_0xa34a('0x15'));var logger=require(_0xa34a('0x16'))(_0xa34a('0x17'));var utils=require(_0xa34a('0x18'));var config=require(_0xa34a('0x19'));var licenseUtil=require(_0xa34a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3145e9,_0x33e150){_0x33e150=_0x33e150||0xcc;return function(_0x1c2972){if(_0x1c2972){return _0x3145e9['sendStatus'](_0x33e150);}return _0x3145e9[_0xa34a('0x1b')](_0x33e150)[_0xa34a('0x1c')]();};}function respondWithResult(_0x525eff,_0x2f5ded){_0x2f5ded=_0x2f5ded||0xc8;return function(_0x3d5926){if(_0x3d5926){return _0x525eff['status'](_0x2f5ded)[_0xa34a('0x1d')](_0x3d5926);}};}function respondWithFilteredResult(_0x7ac9a2,_0x19580a){return function(_0xfd0d79){if(_0xfd0d79){var _0x41b9bb=typeof _0x19580a['offset']===_0xa34a('0x1e')&&typeof _0x19580a['limit']===_0xa34a('0x1e');var _0x14837d=_0xfd0d79[_0xa34a('0x1f')];var _0x181dcc=_0x41b9bb?0x0:_0x19580a['offset'];var _0x27ad19=_0x41b9bb?_0xfd0d79[_0xa34a('0x1f')]:_0x19580a[_0xa34a('0x20')]+_0x19580a[_0xa34a('0x21')];var _0xaa360e;if(_0x27ad19>=_0x14837d){_0x27ad19=_0x14837d;_0xaa360e=0xc8;}else{_0xaa360e=0xce;}_0x7ac9a2['status'](_0xaa360e);return _0x7ac9a2[_0xa34a('0x22')](_0xa34a('0x23'),_0x181dcc+'-'+_0x27ad19+'/'+_0x14837d)[_0xa34a('0x1d')](_0xfd0d79);}return null;};}function patchUpdates(_0x5a641c){return function(_0x14a18b){try{jsonpatch[_0xa34a('0x24')](_0x14a18b,_0x5a641c,!![]);}catch(_0x36749d){return BPromise[_0xa34a('0x25')](_0x36749d);}return _0x14a18b[_0xa34a('0x26')]();};}function saveUpdates(_0x14e24c,_0x4f9342){return function(_0x28249a){if(_0x28249a){return _0x28249a[_0xa34a('0x27')](_0x14e24c)['then'](function(_0x13135a){return _0x13135a;});}return null;};}function removeEntity(_0x377c4a,_0x746078){return function(_0x254b75){if(_0x254b75){return _0x254b75[_0xa34a('0x28')]()[_0xa34a('0x29')](function(){_0x377c4a[_0xa34a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x351b9e,_0xb314d2){return function(_0x473c15){if(!_0x473c15){_0x351b9e[_0xa34a('0x2a')](0x194);}return _0x473c15;};}function handleError(_0x502b4d,_0x1ab30a){_0x1ab30a=_0x1ab30a||0x1f4;return function(_0x7ecf44){logger[_0xa34a('0x2b')](_0x7ecf44[_0xa34a('0x2c')]);if(_0x7ecf44['name']){delete _0x7ecf44[_0xa34a('0x2d')];}_0x502b4d[_0xa34a('0x1b')](_0x1ab30a)[_0xa34a('0x2e')](_0x7ecf44);};}exports[_0xa34a('0x2f')]=function(_0x48e428,_0x2b03a7){var _0x82350e={},_0x196681={},_0x3d351a={'count':0x0,'rows':[]};var _0x4e08e6=_[_0xa34a('0x30')](db[_0xa34a('0x31')]['rawAttributes'],function(_0x163190){return{'name':_0x163190[_0xa34a('0x32')],'type':_0x163190['type']['key']};});_0x196681[_0xa34a('0x33')]=_[_0xa34a('0x30')](_0x4e08e6,_0xa34a('0x2d'));_0x196681[_0xa34a('0x34')]=_[_0xa34a('0x35')](_0x48e428[_0xa34a('0x34')]);_0x196681['filters']=_[_0xa34a('0x36')](_0x196681[_0xa34a('0x33')],_0x196681['query']);_0x82350e[_0xa34a('0x37')]=_[_0xa34a('0x36')](_0x196681[_0xa34a('0x33')],qs[_0xa34a('0x38')](_0x48e428['query'][_0xa34a('0x38')]));_0x82350e[_0xa34a('0x37')]=_0x82350e[_0xa34a('0x37')]['length']?_0x82350e[_0xa34a('0x37')]:_0x196681[_0xa34a('0x33')];if(!_0x48e428[_0xa34a('0x34')][_0xa34a('0x39')](_0xa34a('0x3a'))){_0x82350e[_0xa34a('0x21')]=qs['limit'](_0x48e428['query']['limit']);_0x82350e[_0xa34a('0x20')]=qs[_0xa34a('0x20')](_0x48e428[_0xa34a('0x34')][_0xa34a('0x20')]);}_0x82350e[_0xa34a('0x3b')]=qs[_0xa34a('0x3c')](_0x48e428['query'][_0xa34a('0x3c')]);_0x82350e[_0xa34a('0x3d')]=qs[_0xa34a('0x3e')](_[_0xa34a('0x3f')](_0x48e428[_0xa34a('0x34')],_0x196681[_0xa34a('0x3e')]),_0x4e08e6);if(_0x48e428['query'][_0xa34a('0x40')]){_0x82350e[_0xa34a('0x3d')]=_['merge'](_0x82350e[_0xa34a('0x3d')],{'$or':_['map'](_0x4e08e6,function(_0x41a4d5){if(_0x41a4d5[_0xa34a('0x41')]!==_0xa34a('0x42')){var _0x3cc290={};_0x3cc290[_0x41a4d5[_0xa34a('0x2d')]]={'$like':'%'+_0x48e428[_0xa34a('0x34')][_0xa34a('0x40')]+'%'};return _0x3cc290;}})});}_0x82350e=_[_0xa34a('0x43')]({},_0x82350e,_0x48e428[_0xa34a('0x44')]);var _0x4a055e={'where':_0x82350e['where']};return db[_0xa34a('0x31')][_0xa34a('0x1f')](_0x4a055e)['then'](function(_0x47766b){_0x3d351a[_0xa34a('0x1f')]=_0x47766b;if(_0x48e428[_0xa34a('0x34')][_0xa34a('0x45')]){_0x82350e['include']=[{'all':!![]}];}return db[_0xa34a('0x31')][_0xa34a('0x46')](_0x82350e);})[_0xa34a('0x29')](function(_0x10960b){_0x3d351a['rows']=_0x10960b;return _0x3d351a;})['then'](respondWithFilteredResult(_0x2b03a7,_0x82350e))['catch'](handleError(_0x2b03a7,null));};exports[_0xa34a('0x47')]=function(_0x54b5ec,_0x6722d5){var _0xa17285={'raw':!![],'where':{'id':_0x54b5ec[_0xa34a('0x48')]['id']}},_0x1be7e4={};_0x1be7e4[_0xa34a('0x33')]=_['keys'](db[_0xa34a('0x31')][_0xa34a('0x49')]);_0x1be7e4[_0xa34a('0x34')]=_[_0xa34a('0x35')](_0x54b5ec[_0xa34a('0x34')]);_0x1be7e4[_0xa34a('0x3e')]=_['intersection'](_0x1be7e4[_0xa34a('0x33')],_0x1be7e4[_0xa34a('0x34')]);_0xa17285[_0xa34a('0x37')]=_[_0xa34a('0x36')](_0x1be7e4[_0xa34a('0x33')],qs[_0xa34a('0x38')](_0x54b5ec['query'][_0xa34a('0x38')]));_0xa17285['attributes']=_0xa17285[_0xa34a('0x37')][_0xa34a('0x4a')]?_0xa17285[_0xa34a('0x37')]:_0x1be7e4['model'];if(_0x54b5ec[_0xa34a('0x34')]['includeAll']){_0xa17285[_0xa34a('0x4b')]=[{'all':!![]}];}_0xa17285=_['merge']({},_0xa17285,_0x54b5ec[_0xa34a('0x44')]);return db[_0xa34a('0x31')][_0xa34a('0x4c')](_0xa17285)[_0xa34a('0x29')](handleEntityNotFound(_0x6722d5,null))[_0xa34a('0x29')](respondWithResult(_0x6722d5,null))['catch'](handleError(_0x6722d5,null));};exports[_0xa34a('0x4d')]=function(_0x50b05a,_0x87b76d){return db[_0xa34a('0x31')][_0xa34a('0x4d')](_0x50b05a[_0xa34a('0x4e')],{})[_0xa34a('0x29')](respondWithResult(_0x87b76d,0xc9))[_0xa34a('0x4f')](handleError(_0x87b76d,null));};exports[_0xa34a('0x27')]=function(_0xde8a7,_0x4be0d0){if(_0xde8a7[_0xa34a('0x4e')]['id']){delete _0xde8a7['body']['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0xde8a7[_0xa34a('0x48')]['id']}})['then'](handleEntityNotFound(_0x4be0d0,null))[_0xa34a('0x29')](saveUpdates(_0xde8a7[_0xa34a('0x4e')],null))['then'](respondWithResult(_0x4be0d0,null))[_0xa34a('0x4f')](handleError(_0x4be0d0,null));};exports['destroy']=function(_0x262803,_0xa7cbc4){return db[_0xa34a('0x31')][_0xa34a('0x4c')]({'where':{'id':_0x262803['params']['id']}})['then'](handleEntityNotFound(_0xa7cbc4,null))[_0xa34a('0x29')](removeEntity(_0xa7cbc4,null))[_0xa34a('0x4f')](handleError(_0xa7cbc4,null));};exports[_0xa34a('0x50')]=function(_0x1a9468,_0x44ab8){return db[_0xa34a('0x31')][_0xa34a('0x50')]()[_0xa34a('0x29')](respondWithResult(_0x44ab8,null))[_0xa34a('0x4f')](handleError(_0x44ab8,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index a9bf806..a383f05 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 _0x5fe4=['exports','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x5fe4,0xa1));var _0x45fe=function(_0x13b98a,_0x1adc46){_0x13b98a=_0x13b98a-0x0;var _0x2f4f7b=_0x5fe4[_0x13b98a];return _0x2f4f7b;};'use strict';var _=require(_0x45fe('0x0'));var util=require(_0x45fe('0x1'));var logger=require(_0x45fe('0x2'))(_0x45fe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x45fe('0x4'));var fs=require('fs');var path=require(_0x45fe('0x5'));var rimraf=require(_0x45fe('0x6'));var config=require(_0x45fe('0x7'));var attributes=require(_0x45fe('0x8'));module[_0x45fe('0x9')]=function(_0x129f5,_0x3f186f){return _0x129f5['define']('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ba3=['./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x41d7e3,_0x556db9){var _0x7d83ae=function(_0x447ee6){while(--_0x447ee6){_0x41d7e3['push'](_0x41d7e3['shift']());}};_0x7d83ae(++_0x556db9);}(_0x1ba3,0xe3));var _0x31ba=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x1ba3[_0x4226d6];return _0x19655b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x31ba('0x0'));var moment=require(_0x31ba('0x1'));var BPromise=require('bluebird');var rp=require(_0x31ba('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31ba('0x3'));var config=require(_0x31ba('0x4'));var attributes=require(_0x31ba('0x5'));module[_0x31ba('0x6')]=function(_0x48bfdf,_0x560a65){return _0x48bfdf['define'](_0x31ba('0x7'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 3c751d3..f754e28 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 _0xe6ec=['JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x32b2f1,_0x40b77e){var _0x1fe50e=function(_0x265b47){while(--_0x265b47){_0x32b2f1['push'](_0x32b2f1['shift']());}};_0x1fe50e(++_0x40b77e);}(_0xe6ec,0xc3));var _0xce6e=function(_0x2f4f2e,_0x1b9f57){_0x2f4f2e=_0x2f4f2e-0x0;var _0x306632=_0xe6ec[_0x2f4f2e];return _0x306632;};'use strict';var _=require(_0xce6e('0x0'));var util=require(_0xce6e('0x1'));var moment=require(_0xce6e('0x2'));var BPromise=require(_0xce6e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce6e('0x4'));var db=require(_0xce6e('0x5'))['db'];var utils=require(_0xce6e('0x6'));var logger=require(_0xce6e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xce6e('0x8'));var client=jayson['client'][_0xce6e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x425852,_0xe1059,_0x4604ab){return new BPromise(function(_0x441dc0,_0x20ccef){return client[_0xce6e('0xa')](_0x425852,_0x4604ab)['then'](function(_0x328189){logger[_0xce6e('0xb')](_0xce6e('0xc'),_0xe1059,_0xce6e('0xd'));logger[_0xce6e('0xe')](_0xce6e('0xf'),_0xe1059,'request\x20sent',JSON[_0xce6e('0x10')](_0x328189));if(_0x328189[_0xce6e('0x11')]){if(_0x328189[_0xce6e('0x11')][_0xce6e('0x12')]===0x1f4){logger['error'](_0xce6e('0xc'),_0xe1059,_0x328189['error'][_0xce6e('0x13')]);return _0x20ccef(_0x328189[_0xce6e('0x11')][_0xce6e('0x13')]);}logger[_0xce6e('0x11')](_0xce6e('0xc'),_0xe1059,_0x328189[_0xce6e('0x11')][_0xce6e('0x13')]);return _0x441dc0(_0x328189['error'][_0xce6e('0x13')]);}else{logger[_0xce6e('0xb')](_0xce6e('0xc'),_0xe1059,_0xce6e('0xd'));_0x441dc0(_0x328189[_0xce6e('0x14')][_0xce6e('0x13')]);}})['catch'](function(_0x424438){logger[_0xce6e('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xe1059,_0x424438);_0x20ccef(_0x424438);});});} \ No newline at end of file +var _0x6f41=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x36e066,_0x1ef6a0){var _0x5a1e44=function(_0x33382e){while(--_0x33382e){_0x36e066['push'](_0x36e066['shift']());}};_0x5a1e44(++_0x1ef6a0);}(_0x6f41,0xea));var _0x16f4=function(_0x3f5f64,_0x4ed60a){_0x3f5f64=_0x3f5f64-0x0;var _0x539d68=_0x6f41[_0x3f5f64];return _0x539d68;};'use strict';var _=require(_0x16f4('0x0'));var util=require(_0x16f4('0x1'));var moment=require('moment');var BPromise=require(_0x16f4('0x2'));var rs=require(_0x16f4('0x3'));var fs=require('fs');var Redis=require(_0x16f4('0x4'));var db=require(_0x16f4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x16f4('0x6'))(_0x16f4('0x7'));var config=require(_0x16f4('0x8'));var jayson=require(_0x16f4('0x9'));var client=jayson['client'][_0x16f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4619fe,_0x5bb798,_0x3b5417){return new BPromise(function(_0x5ba581,_0x5311a2){return client['request'](_0x4619fe,_0x3b5417)[_0x16f4('0xb')](function(_0x32d87f){logger[_0x16f4('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5bb798,_0x16f4('0xd'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5bb798,_0x16f4('0xd'),JSON[_0x16f4('0xe')](_0x32d87f));if(_0x32d87f[_0x16f4('0xf')]){if(_0x32d87f[_0x16f4('0xf')][_0x16f4('0x10')]===0x1f4){logger[_0x16f4('0xf')](_0x16f4('0x11'),_0x5bb798,_0x32d87f['error'][_0x16f4('0x12')]);return _0x5311a2(_0x32d87f[_0x16f4('0xf')][_0x16f4('0x12')]);}logger[_0x16f4('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5bb798,_0x32d87f[_0x16f4('0xf')]['message']);return _0x5ba581(_0x32d87f[_0x16f4('0xf')][_0x16f4('0x12')]);}else{logger['info'](_0x16f4('0x11'),_0x5bb798,_0x16f4('0xd'));_0x5ba581(_0x32d87f['result'][_0x16f4('0x12')]);}})[_0x16f4('0x13')](function(_0x5e6772){logger[_0x16f4('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5bb798,_0x5e6772);_0x5311a2(_0x5e6772);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index bf18f07..2b62786 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 _0x91e1=['post','clone','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x91e1,0x156));var _0x191e=function(_0x2e0553,_0xfeed5b){_0x2e0553=_0x2e0553-0x0;var _0x5139ed=_0x91e1[_0x2e0553];return _0x5139ed;};'use strict';var multer=require(_0x191e('0x0'));var util=require(_0x191e('0x1'));var path=require(_0x191e('0x2'));var timeout=require('connect-timeout');var express=require(_0x191e('0x3'));var router=express[_0x191e('0x4')]();var fs_extra=require(_0x191e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x191e('0x6'));var controller=require(_0x191e('0x7'));router[_0x191e('0x8')]('/',auth[_0x191e('0x9')](),controller[_0x191e('0xa')]);router[_0x191e('0x8')](_0x191e('0xb'),auth[_0x191e('0x9')](),controller['show']);router[_0x191e('0x8')](_0x191e('0xc'),auth[_0x191e('0x9')](),controller[_0x191e('0xd')]);router[_0x191e('0x8')](_0x191e('0xe'),auth['isAuthenticated'](),controller[_0x191e('0xf')]);router[_0x191e('0x8')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x191e('0x10')),controller[_0x191e('0x11')]);router[_0x191e('0x12')]('/',auth[_0x191e('0x9')](),controller['create']);router['post']('/:id/clone',auth[_0x191e('0x9')](),controller[_0x191e('0x13')]);router[_0x191e('0x14')]('/:id',auth[_0x191e('0x9')](),controller[_0x191e('0x15')]);router[_0x191e('0x16')]('/:id',auth[_0x191e('0x9')](),controller['destroy']);module[_0x191e('0x17')]=router; \ No newline at end of file +var _0x9f01=['create','/:id/clone','clone','put','/:id','update','delete','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post'];(function(_0x7d8ac,_0x564b51){var _0x12ae51=function(_0x308777){while(--_0x308777){_0x7d8ac['push'](_0x7d8ac['shift']());}};_0x12ae51(++_0x564b51);}(_0x9f01,0x1a0));var _0x19f0=function(_0x4003b1,_0x20d42b){_0x4003b1=_0x4003b1-0x0;var _0x4bf25e=_0x9f01[_0x4003b1];return _0x4bf25e;};'use strict';var multer=require('multer');var util=require(_0x19f0('0x0'));var path=require(_0x19f0('0x1'));var timeout=require(_0x19f0('0x2'));var express=require('express');var router=express[_0x19f0('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x19f0('0x4'));var config=require(_0x19f0('0x5'));var controller=require('./jscriptyProject.controller');router[_0x19f0('0x6')]('/',auth[_0x19f0('0x7')](),controller['index']);router[_0x19f0('0x6')]('/:id',auth[_0x19f0('0x7')](),controller[_0x19f0('0x8')]);router[_0x19f0('0x6')](_0x19f0('0x9'),auth[_0x19f0('0x7')](),controller[_0x19f0('0xa')]);router['get'](_0x19f0('0xb'),auth['isAuthenticated'](),controller[_0x19f0('0xc')]);router[_0x19f0('0x6')](_0x19f0('0xd'),auth[_0x19f0('0x7')](),timeout('30s'),controller[_0x19f0('0xe')]);router[_0x19f0('0xf')]('/',auth[_0x19f0('0x7')](),controller[_0x19f0('0x10')]);router[_0x19f0('0xf')](_0x19f0('0x11'),auth[_0x19f0('0x7')](),controller[_0x19f0('0x12')]);router[_0x19f0('0x13')](_0x19f0('0x14'),auth['isAuthenticated'](),controller[_0x19f0('0x15')]);router[_0x19f0('0x16')](_0x19f0('0x14'),auth[_0x19f0('0x7')](),controller['destroy']);module[_0x19f0('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index f206a68..defd6f7 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 _0x00b9=['getDataValue','name','description','BOOLEAN','lodash','util','exports','STRING','TEXT','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x00b9,0xe4));var _0x900b=function(_0x39cdba,_0x85880a){_0x39cdba=_0x39cdba-0x0;var _0x4c9895=_0x00b9[_0x39cdba];return _0x4c9895;};'use strict';var Sequelize=require('sequelize');var _=require(_0x900b('0x0'));var util=require(_0x900b('0x1'));module[_0x900b('0x2')]={'name':{'type':Sequelize[_0x900b('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x900b('0x3')]},'formData':{'type':Sequelize[_0x900b('0x4')]('long'),'set':function(_0x1d6dfc){if(_[_0x900b('0x5')](_0x1d6dfc)){this['setDataValue'](_0x900b('0x6'),JSON[_0x900b('0x7')](_0x1d6dfc));}else if(_[_0x900b('0x8')](_0x1d6dfc)){this['setDataValue'](_0x900b('0x6'),_0x1d6dfc);}else{this[_0x900b('0x9')](_0x900b('0x6'),util[_0x900b('0xa')](_0x900b('0xb'),this[_0x900b('0xc')](_0x900b('0xd'))||'',this[_0x900b('0xc')](_0x900b('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x900b('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x49bd=['formData','stringify','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','lodash','util','exports','STRING','name','TEXT','long'];(function(_0xd76586,_0x2bf0b1){var _0xfc594e=function(_0x4a27a1){while(--_0x4a27a1){_0xd76586['push'](_0xd76586['shift']());}};_0xfc594e(++_0x2bf0b1);}(_0x49bd,0x69));var _0xd49b=function(_0x4d3605,_0x344ab3){_0x4d3605=_0x4d3605-0x0;var _0x273784=_0x49bd[_0x4d3605];return _0x273784;};'use strict';var Sequelize=require('sequelize');var _=require(_0xd49b('0x0'));var util=require(_0xd49b('0x1'));module[_0xd49b('0x2')]={'name':{'type':Sequelize[_0xd49b('0x3')],'unique':_0xd49b('0x4')},'description':{'type':Sequelize[_0xd49b('0x3')]},'formData':{'type':Sequelize[_0xd49b('0x5')](_0xd49b('0x6')),'set':function(_0x216672){if(_['isObjectLike'](_0x216672)){this['setDataValue'](_0xd49b('0x7'),JSON[_0xd49b('0x8')](_0x216672));}else if(_['isString'](_0x216672)){this['setDataValue']('formData',_0x216672);}else{this[_0xd49b('0x9')]('formData',util[_0xd49b('0xa')](_0xd49b('0xb'),this[_0xd49b('0xc')](_0xd49b('0x4'))||'',this['getDataValue'](_0xd49b('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 255941c..68c7c6c 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 _0x08ca=['fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','createdAt','updatedAt','omit','Projects','getSessions','findOne','JscriptySessionReport','order','ProjectId','JscriptyAnswerReport','toString','indexOf','replace','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','get','UserProfileResource','then','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','model','query','keys','intersection','attributes'];(function(_0x361d9b,_0x30e890){var _0x2934a6=function(_0x2bcab4){while(--_0x2bcab4){_0x361d9b['push'](_0x361d9b['shift']());}};_0x2934a6(++_0x30e890);}(_0x08ca,0xb2));var _0xa08c=function(_0x5a1150,_0x1f14bd){_0x5a1150=_0x5a1150-0x0;var _0x228910=_0x08ca[_0x5a1150];return _0x228910;};'use strict';var emlformat=require(_0xa08c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa08c('0x1'));var jsonpatch=require(_0xa08c('0x2'));var rp=require(_0xa08c('0x3'));var moment=require(_0xa08c('0x4'));var BPromise=require(_0xa08c('0x5'));var Mustache=require(_0xa08c('0x6'));var util=require(_0xa08c('0x7'));var path=require(_0xa08c('0x8'));var sox=require(_0xa08c('0x9'));var csv=require(_0xa08c('0xa'));var ejs=require(_0xa08c('0xb'));var fs=require('fs');var fs_extra=require(_0xa08c('0xc'));var _=require('lodash');var squel=require(_0xa08c('0xd'));var crypto=require(_0xa08c('0xe'));var jsforce=require(_0xa08c('0xf'));var deskjs=require(_0xa08c('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa08c('0x11'));var Papa=require('papaparse');var Redis=require(_0xa08c('0x12'));var authService=require(_0xa08c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa08c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa08c('0x15'));var utils=require(_0xa08c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa08c('0x17'));var db=require(_0xa08c('0x18'))['db'];function respondWithStatusCode(_0x441998,_0x4ed55f){_0x4ed55f=_0x4ed55f||0xcc;return function(_0x1fda54){if(_0x1fda54){return _0x441998[_0xa08c('0x19')](_0x4ed55f);}return _0x441998['status'](_0x4ed55f)[_0xa08c('0x1a')]();};}function respondWithResult(_0x2e5629,_0x15186a){_0x15186a=_0x15186a||0xc8;return function(_0x306435){if(_0x306435){return _0x2e5629[_0xa08c('0x1b')](_0x15186a)[_0xa08c('0x1c')](_0x306435);}};}function respondWithFilteredResult(_0xff73e7,_0x26e44e){return function(_0x1a2d32){if(_0x1a2d32){var _0x41d1f0=typeof _0x26e44e['offset']===_0xa08c('0x1d')&&typeof _0x26e44e[_0xa08c('0x1e')]===_0xa08c('0x1d');var _0x42c5ea=_0x1a2d32[_0xa08c('0x1f')];var _0x1b2097=_0x41d1f0?0x0:_0x26e44e[_0xa08c('0x20')];var _0x3ea4f3=_0x41d1f0?_0x1a2d32[_0xa08c('0x1f')]:_0x26e44e[_0xa08c('0x20')]+_0x26e44e[_0xa08c('0x1e')];var _0x294a75;if(_0x3ea4f3>=_0x42c5ea){_0x3ea4f3=_0x42c5ea;_0x294a75=0xc8;}else{_0x294a75=0xce;}_0xff73e7['status'](_0x294a75);return _0xff73e7[_0xa08c('0x21')]('Content-Range',_0x1b2097+'-'+_0x3ea4f3+'/'+_0x42c5ea)[_0xa08c('0x1c')](_0x1a2d32);}return null;};}function patchUpdates(_0x43236b){return function(_0x153b1a){try{jsonpatch[_0xa08c('0x22')](_0x153b1a,_0x43236b,!![]);}catch(_0x5dac00){return BPromise[_0xa08c('0x23')](_0x5dac00);}return _0x153b1a[_0xa08c('0x24')]();};}function saveUpdates(_0x500bd4,_0x456d45){return function(_0x22ed38){if(_0x22ed38){return _0x22ed38[_0xa08c('0x25')](_0x500bd4)['then'](function(_0x34fa7b){return _0x34fa7b;});}return null;};}function removeEntity(_0x5473b8,_0x561b0c){return function(_0x3c46fc){if(_0x3c46fc){return _0x3c46fc[_0xa08c('0x26')]()['then'](function(){var _0x381821=_0x3c46fc[_0xa08c('0x27')]({'plain':!![]});var _0x491cb0='Projects';return db[_0xa08c('0x28')][_0xa08c('0x26')]({'where':{'type':_0x491cb0,'resourceId':_0x381821['id']}})[_0xa08c('0x29')](function(){return _0x3c46fc;});})['then'](function(){_0x5473b8[_0xa08c('0x1b')](0xcc)[_0xa08c('0x1a')]();});}};}function handleEntityNotFound(_0x22dc7c,_0x415291){return function(_0x2dbd27){if(!_0x2dbd27){_0x22dc7c[_0xa08c('0x19')](0x194);}return _0x2dbd27;};}function handleError(_0x494823,_0x5bb673){_0x5bb673=_0x5bb673||0x1f4;return function(_0x22260e){logger['error'](_0x22260e[_0xa08c('0x2a')]);if(_0x22260e[_0xa08c('0x2b')]){delete _0x22260e[_0xa08c('0x2b')];}_0x494823[_0xa08c('0x1b')](_0x5bb673)[_0xa08c('0x2c')](_0x22260e);};}exports[_0xa08c('0x2d')]=function(_0x3e8d8d,_0x9eaddd){var _0x35d3bc={},_0x56c0ca={},_0x300430={'count':0x0,'rows':[]};var _0x4ea6fb=_[_0xa08c('0x2e')](db[_0xa08c('0x2f')][_0xa08c('0x30')],function(_0x5780de){return{'name':_0x5780de['fieldName'],'type':_0x5780de[_0xa08c('0x31')][_0xa08c('0x32')]};});_0x56c0ca[_0xa08c('0x33')]=_[_0xa08c('0x2e')](_0x4ea6fb,_0xa08c('0x2b'));_0x56c0ca[_0xa08c('0x34')]=_[_0xa08c('0x35')](_0x3e8d8d[_0xa08c('0x34')]);_0x56c0ca['filters']=_[_0xa08c('0x36')](_0x56c0ca[_0xa08c('0x33')],_0x56c0ca['query']);_0x35d3bc[_0xa08c('0x37')]=_[_0xa08c('0x36')](_0x56c0ca[_0xa08c('0x33')],qs[_0xa08c('0x38')](_0x3e8d8d[_0xa08c('0x34')]['fields']));_0x35d3bc[_0xa08c('0x37')]=_0x35d3bc[_0xa08c('0x37')][_0xa08c('0x39')]?_0x35d3bc[_0xa08c('0x37')]:_0x56c0ca[_0xa08c('0x33')];if(!_0x3e8d8d[_0xa08c('0x34')][_0xa08c('0x3a')](_0xa08c('0x3b'))){_0x35d3bc[_0xa08c('0x1e')]=qs['limit'](_0x3e8d8d[_0xa08c('0x34')][_0xa08c('0x1e')]);_0x35d3bc[_0xa08c('0x20')]=qs[_0xa08c('0x20')](_0x3e8d8d[_0xa08c('0x34')][_0xa08c('0x20')]);}_0x35d3bc['order']=qs[_0xa08c('0x3c')](_0x3e8d8d[_0xa08c('0x34')][_0xa08c('0x3c')]);_0x35d3bc['where']=qs[_0xa08c('0x3d')](_[_0xa08c('0x3e')](_0x3e8d8d[_0xa08c('0x34')],_0x56c0ca[_0xa08c('0x3d')]),_0x4ea6fb);if(_0x3e8d8d['query'][_0xa08c('0x3f')]){_0x35d3bc['where']=_[_0xa08c('0x40')](_0x35d3bc[_0xa08c('0x41')],{'$or':_[_0xa08c('0x2e')](_0x4ea6fb,function(_0x58a43b){if(_0x58a43b[_0xa08c('0x31')]!==_0xa08c('0x42')){var _0x12e787={};_0x12e787[_0x58a43b[_0xa08c('0x2b')]]={'$like':'%'+_0x3e8d8d['query'][_0xa08c('0x3f')]+'%'};return _0x12e787;}})});}_0x35d3bc=_[_0xa08c('0x40')]({},_0x35d3bc,_0x3e8d8d[_0xa08c('0x43')]);var _0x19cf46={'where':_0x35d3bc['where']};return db[_0xa08c('0x2f')][_0xa08c('0x1f')](_0x19cf46)[_0xa08c('0x29')](function(_0x39b313){_0x300430[_0xa08c('0x1f')]=_0x39b313;if(_0x3e8d8d[_0xa08c('0x34')][_0xa08c('0x44')]){_0x35d3bc[_0xa08c('0x45')]=[{'all':!![]}];}return db['JscriptyProject'][_0xa08c('0x46')](_0x35d3bc);})['then'](function(_0x250cea){_0x300430[_0xa08c('0x47')]=_0x250cea;return _0x300430;})[_0xa08c('0x29')](respondWithFilteredResult(_0x9eaddd,_0x35d3bc))[_0xa08c('0x48')](handleError(_0x9eaddd,null));};exports['show']=function(_0x3b7e00,_0x37d10b){var _0x4ca408={'raw':![],'where':{'id':_0x3b7e00['params']['id']}},_0x5111d6={};_0x5111d6[_0xa08c('0x33')]=_[_0xa08c('0x35')](db[_0xa08c('0x2f')][_0xa08c('0x30')]);_0x5111d6[_0xa08c('0x34')]=_[_0xa08c('0x35')](_0x3b7e00[_0xa08c('0x34')]);_0x5111d6['filters']=_[_0xa08c('0x36')](_0x5111d6[_0xa08c('0x33')],_0x5111d6[_0xa08c('0x34')]);_0x4ca408[_0xa08c('0x37')]=_[_0xa08c('0x36')](_0x5111d6[_0xa08c('0x33')],qs['fields'](_0x3b7e00[_0xa08c('0x34')][_0xa08c('0x38')]));_0x4ca408[_0xa08c('0x37')]=_0x4ca408[_0xa08c('0x37')][_0xa08c('0x39')]?_0x4ca408[_0xa08c('0x37')]:_0x5111d6[_0xa08c('0x33')];if(_0x3b7e00[_0xa08c('0x34')][_0xa08c('0x44')]){_0x4ca408[_0xa08c('0x45')]=[{'all':!![]}];}_0x4ca408=_[_0xa08c('0x40')]({},_0x4ca408,_0x3b7e00[_0xa08c('0x43')]);return db['JscriptyProject'][_0xa08c('0x49')](_0x4ca408)[_0xa08c('0x29')](handleEntityNotFound(_0x37d10b,null))[_0xa08c('0x29')](respondWithResult(_0x37d10b,null))['catch'](handleError(_0x37d10b,null));};exports[_0xa08c('0x4a')]=function(_0x186fce,_0x1c8234){return db['JscriptyProject'][_0xa08c('0x4a')](_0x186fce[_0xa08c('0x4b')],{})[_0xa08c('0x29')](function(_0x160b22){var _0x225e28=_0x186fce[_0xa08c('0x4c')][_0xa08c('0x27')]({'plain':!![]});if(!_0x225e28)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x225e28[_0xa08c('0x4d')]===_0xa08c('0x4c')){var _0x303396=_0x160b22['get']({'plain':!![]});var _0x586885='Projects';return db[_0xa08c('0x4e')][_0xa08c('0x49')]({'where':{'name':_0x586885,'userProfileId':_0x225e28[_0xa08c('0x4f')]},'raw':!![]})[_0xa08c('0x29')](function(_0x39f70f){if(_0x39f70f&&_0x39f70f[_0xa08c('0x50')]===0x0){return db['UserProfileResource'][_0xa08c('0x4a')]({'name':_0x303396[_0xa08c('0x2b')],'resourceId':_0x303396['id'],'type':_0x39f70f['name'],'sectionId':_0x39f70f['id']},{})['then'](function(){return _0x160b22;});}else{return _0x160b22;}})[_0xa08c('0x48')](function(_0x4544d6){logger[_0xa08c('0x51')](_0xa08c('0x52'),_0x4544d6);throw _0x4544d6;});}return _0x160b22;})[_0xa08c('0x29')](respondWithResult(_0x1c8234,0xc9))[_0xa08c('0x48')](handleError(_0x1c8234,null));};exports[_0xa08c('0x53')]=function(_0x437e35,_0x1acc1e){var _0xde5fe8={'where':{'id':_0x437e35[_0xa08c('0x54')]['id']}},_0x59a387={};_0x59a387[_0xa08c('0x33')]=_[_0xa08c('0x35')](db[_0xa08c('0x2f')]['rawAttributes']);_0xde5fe8['attributes']=_[_0xa08c('0x36')](_0x59a387[_0xa08c('0x33')],qs[_0xa08c('0x38')](_0x437e35[_0xa08c('0x34')][_0xa08c('0x38')]));_0xde5fe8[_0xa08c('0x37')]=_0xde5fe8[_0xa08c('0x37')][_0xa08c('0x39')]?_0xde5fe8['attributes']:_0x59a387[_0xa08c('0x33')];if(_0x437e35[_0xa08c('0x34')][_0xa08c('0x44')]){_0xde5fe8[_0xa08c('0x45')]=[{'all':!![]}];}_0xde5fe8=_[_0xa08c('0x40')]({},_0xde5fe8,_0x437e35[_0xa08c('0x43')]);return db[_0xa08c('0x2f')][_0xa08c('0x49')](_0xde5fe8)[_0xa08c('0x29')](handleEntityNotFound(_0x1acc1e,null))[_0xa08c('0x29')](function(_0x1271a4){if(_0x1271a4){var _0x492ff1=_0x1271a4[_0xa08c('0x27')]({'plain':!![]});_0x492ff1=qs['omit'](_0x492ff1,['id',_0xa08c('0x55'),_0xa08c('0x56')]);_0x437e35[_0xa08c('0x4b')]=_[_0xa08c('0x57')](_0x437e35['body'],['id',_0xa08c('0x55'),'updatedAt']);return db['JscriptyProject'][_0xa08c('0x4a')](_['merge'](_0x492ff1,_0x437e35[_0xa08c('0x4b')]),{'include':_0x437e35[_0xa08c('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0xa08c('0x29')](function(_0x544745){var _0x85a661=_0x437e35[_0xa08c('0x4c')][_0xa08c('0x27')]({'plain':!![]});if(!_0x85a661)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x85a661[_0xa08c('0x4d')]===_0xa08c('0x4c')){var _0xed8059=_0x544745[_0xa08c('0x27')]({'plain':!![]});var _0x1029f7=_0xa08c('0x58');return db[_0xa08c('0x4e')][_0xa08c('0x49')]({'where':{'name':_0x1029f7,'userProfileId':_0x85a661[_0xa08c('0x4f')]},'raw':!![]})[_0xa08c('0x29')](function(_0x184506){if(_0x184506&&_0x184506['autoAssociation']===0x0){return db[_0xa08c('0x28')][_0xa08c('0x4a')]({'name':_0xed8059[_0xa08c('0x2b')],'resourceId':_0xed8059['id'],'type':_0x184506[_0xa08c('0x2b')],'sectionId':_0x184506['id']},{})[_0xa08c('0x29')](function(){return _0x544745;});}else{return _0x544745;}})['catch'](function(_0x49d5ef){logger[_0xa08c('0x51')](_0xa08c('0x52'),_0x49d5ef);throw _0x49d5ef;});}return _0x544745;});}})['then'](respondWithResult(_0x1acc1e,0xc9))['catch'](handleError(_0x1acc1e,null));};exports[_0xa08c('0x25')]=function(_0x25248d,_0x2f296a){if(_0x25248d[_0xa08c('0x4b')]['id']){delete _0x25248d[_0xa08c('0x4b')]['id'];}return db[_0xa08c('0x2f')][_0xa08c('0x49')]({'where':{'id':_0x25248d[_0xa08c('0x54')]['id']}})[_0xa08c('0x29')](handleEntityNotFound(_0x2f296a,null))[_0xa08c('0x29')](saveUpdates(_0x25248d[_0xa08c('0x4b')],null))[_0xa08c('0x29')](respondWithResult(_0x2f296a,null))[_0xa08c('0x48')](handleError(_0x2f296a,null));};exports['destroy']=function(_0x565b71,_0x3d9715){return db[_0xa08c('0x2f')][_0xa08c('0x49')]({'where':{'id':_0x565b71[_0xa08c('0x54')]['id']}})[_0xa08c('0x29')](handleEntityNotFound(_0x3d9715,null))['then'](removeEntity(_0x3d9715,null))[_0xa08c('0x48')](handleError(_0x3d9715,null));};exports[_0xa08c('0x59')]=function(_0x98a2f0,_0x1207bb,_0x102c39){var _0x4c14a0={'raw':!![],'where':{}};var _0x358104={};var _0x42d715={'count':0x0,'rows':[]};return db[_0xa08c('0x2f')][_0xa08c('0x5a')]({'where':{'id':_0x98a2f0[_0xa08c('0x54')]['id']}})[_0xa08c('0x29')](handleEntityNotFound(_0x1207bb,null))['then'](function(_0x18473f){if(_0x18473f){_0x358104[_0xa08c('0x33')]=_[_0xa08c('0x35')](db[_0xa08c('0x5b')][_0xa08c('0x30')]);_0x358104[_0xa08c('0x34')]=_[_0xa08c('0x35')](_0x98a2f0[_0xa08c('0x34')]);_0x358104[_0xa08c('0x3d')]=_['intersection'](_0x358104[_0xa08c('0x33')],_0x358104[_0xa08c('0x34')]);_0x4c14a0[_0xa08c('0x37')]=_['intersection'](_0x358104['model'],qs[_0xa08c('0x38')](_0x98a2f0['query'][_0xa08c('0x38')]));_0x4c14a0[_0xa08c('0x37')]=_0x4c14a0['attributes'][_0xa08c('0x39')]?_0x4c14a0[_0xa08c('0x37')]:_0x358104[_0xa08c('0x33')];if(!_0x98a2f0[_0xa08c('0x34')][_0xa08c('0x3a')](_0xa08c('0x3b'))){_0x4c14a0[_0xa08c('0x1e')]=qs[_0xa08c('0x1e')](_0x98a2f0[_0xa08c('0x34')][_0xa08c('0x1e')]);_0x4c14a0[_0xa08c('0x20')]=qs['offset'](_0x98a2f0[_0xa08c('0x34')][_0xa08c('0x20')]);}_0x4c14a0[_0xa08c('0x5c')]=qs[_0xa08c('0x3c')](_0x98a2f0[_0xa08c('0x34')]['sort']);_0x4c14a0[_0xa08c('0x41')]=qs[_0xa08c('0x3d')](_[_0xa08c('0x3e')](_0x98a2f0[_0xa08c('0x34')],_0x358104[_0xa08c('0x3d')]));_0x4c14a0[_0xa08c('0x41')][_0xa08c('0x5d')]=_0x18473f['id'];if(_0x98a2f0['query'][_0xa08c('0x3f')]){_0x4c14a0[_0xa08c('0x41')]=_[_0xa08c('0x40')](_0x4c14a0[_0xa08c('0x41')],{'$or':_[_0xa08c('0x2e')](_0x4c14a0['attributes'],function(_0x3d14d8){var _0x2e563a={};_0x2e563a[_0x3d14d8]={'$like':'%'+_0x98a2f0['query'][_0xa08c('0x3f')]+'%'};return _0x2e563a;})});}_0x4c14a0=_[_0xa08c('0x40')]({},_0x4c14a0,_0x98a2f0[_0xa08c('0x43')]);return db[_0xa08c('0x5b')][_0xa08c('0x1f')]({'where':_0x4c14a0[_0xa08c('0x41')]})['then'](function(_0x48009a){_0x42d715[_0xa08c('0x1f')]=_0x48009a;if(_0x98a2f0[_0xa08c('0x34')][_0xa08c('0x44')]){_0x4c14a0[_0xa08c('0x45')]=[{'all':!![]}];}return db[_0xa08c('0x5b')][_0xa08c('0x46')](_0x4c14a0);})[_0xa08c('0x29')](function(_0x4b6116){_0x42d715[_0xa08c('0x47')]=_0x4b6116;return _0x42d715;});}})[_0xa08c('0x29')](respondWithFilteredResult(_0x1207bb,_0x4c14a0))['catch'](handleError(_0x1207bb,null));};exports['getAnswers']=function(_0x2949de,_0x2dd1fa,_0x128ba1){var _0x1e5491={'raw':!![],'where':{}};var _0x107c27={};var _0x23ec21={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x2949de[_0xa08c('0x54')]['id']}})[_0xa08c('0x29')](handleEntityNotFound(_0x2dd1fa,null))[_0xa08c('0x29')](function(_0x4fbffa){if(_0x4fbffa){_0x107c27[_0xa08c('0x33')]=_[_0xa08c('0x35')](db[_0xa08c('0x5e')][_0xa08c('0x30')]);_0x107c27[_0xa08c('0x34')]=_[_0xa08c('0x35')](_0x2949de[_0xa08c('0x34')]);_0x107c27[_0xa08c('0x3d')]=_[_0xa08c('0x36')](_0x107c27[_0xa08c('0x33')],_0x107c27['query']);_0x1e5491[_0xa08c('0x37')]=_[_0xa08c('0x36')](_0x107c27['model'],qs[_0xa08c('0x38')](_0x2949de[_0xa08c('0x34')][_0xa08c('0x38')]));_0x1e5491[_0xa08c('0x37')]=_0x1e5491[_0xa08c('0x37')][_0xa08c('0x39')]?_0x1e5491[_0xa08c('0x37')]:_0x107c27[_0xa08c('0x33')];if(!_0x2949de[_0xa08c('0x34')][_0xa08c('0x3a')](_0xa08c('0x3b'))){_0x1e5491['limit']=qs['limit'](_0x2949de[_0xa08c('0x34')]['limit']);_0x1e5491[_0xa08c('0x20')]=qs[_0xa08c('0x20')](_0x2949de[_0xa08c('0x34')][_0xa08c('0x20')]);}_0x1e5491[_0xa08c('0x5c')]=qs[_0xa08c('0x3c')](_0x2949de[_0xa08c('0x34')][_0xa08c('0x3c')]);_0x1e5491[_0xa08c('0x41')]=qs['filters'](_[_0xa08c('0x3e')](_0x2949de[_0xa08c('0x34')],_0x107c27[_0xa08c('0x3d')]));_0x1e5491[_0xa08c('0x41')][_0xa08c('0x5d')]=_0x4fbffa['id'];if(_0x2949de[_0xa08c('0x34')][_0xa08c('0x3f')]){_0x1e5491[_0xa08c('0x41')]=_[_0xa08c('0x40')](_0x1e5491[_0xa08c('0x41')],{'$or':_[_0xa08c('0x2e')](_0x1e5491[_0xa08c('0x37')],function(_0x442ce7){var _0x13ab6a={};_0x13ab6a[_0x442ce7]={'$like':'%'+_0x2949de['query']['filter']+'%'};return _0x13ab6a;})});}_0x1e5491=_['merge']({},_0x1e5491,_0x2949de[_0xa08c('0x43')]);return db[_0xa08c('0x5e')]['count']({'where':_0x1e5491['where']})['then'](function(_0x3309f0){_0x23ec21[_0xa08c('0x1f')]=_0x3309f0;if(_0x2949de[_0xa08c('0x34')]['includeAll']){_0x1e5491[_0xa08c('0x45')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa08c('0x46')](_0x1e5491);})[_0xa08c('0x29')](function(_0x4a015f){_0x23ec21['rows']=_0x4a015f;return _0x23ec21;});}})[_0xa08c('0x29')](respondWithFilteredResult(_0x2dd1fa,_0x1e5491))[_0xa08c('0x48')](handleError(_0x2dd1fa,null));};function char(_0x252d4c){return'number'===typeof _0x252d4c?String['fromCharCode'][_0xa08c('0x22')](null,arguments):_0x252d4c;}function needsEncapsulation(_0x4a1f5c){return!!_0x4a1f5c&&(_0x4a1f5c[_0xa08c('0x5f')]()[_0xa08c('0x60')](char(0xd))>=0x0||_0x4a1f5c[_0xa08c('0x5f')]()[_0xa08c('0x60')](char(0xa))>=0x0||_0x4a1f5c[_0xa08c('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x4a1f5c['toString']()[_0xa08c('0x60')](char(0x22))>=0x0);}function encapsulate(_0x53c520){var _0x3b808d=char(0x22),_0x50a1da='\x5c'+char(0x22),_0x5b9ed5=_0x53c520[_0xa08c('0x5f')]()[_0xa08c('0x61')](new RegExp(_0x3b808d,'g'),_0x50a1da);return _0x3b808d+_0x5b9ed5+_0x3b808d;}exports['getSummary']=function(_0x2ef363,_0x412a10,_0x4b7038){var _0x3c1a39,_0x244f3f;var _0x44ebbb={'where':{'ProjectId':_0x2ef363[_0xa08c('0x54')]['id']}};if(_0x2ef363['query']['startTime']){_0x44ebbb[_0xa08c('0x41')]['starttime']=JSON[_0xa08c('0x62')](_0x2ef363['query'][_0xa08c('0x63')]);}return db[_0xa08c('0x5b')][_0xa08c('0x46')](_0x44ebbb)[_0xa08c('0x29')](handleEntityNotFound(_0x412a10,null))[_0xa08c('0x29')](function(_0x1374bc){if(_0x1374bc){_0x3c1a39=_0x1374bc;return db[_0xa08c('0x64')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x3c1a39,'id')},'ProjectId':_0x2ef363['params']['id']},'order':_0xa08c('0x65')});}})[_0xa08c('0x29')](handleEntityNotFound(_0x412a10,null))[_0xa08c('0x29')](function(_0x10058a){if(_0x10058a){_0x244f3f=_0x10058a;var _0x55a278={};for(var _0x5559b6=0x0,_0x37e501=_0x244f3f[_0xa08c('0x39')];_0x5559b6<_0x37e501;_0x5559b6++){if(!_0x55a278['hasOwnProperty'](_0x244f3f[_0x5559b6][_0xa08c('0x66')])){_0x55a278[_0x244f3f[_0x5559b6][_0xa08c('0x66')]]=needsEncapsulation(_0x244f3f[_0x5559b6][_0xa08c('0x67')])?encapsulate(_0x244f3f[_0x5559b6][_0xa08c('0x67')]):_0x244f3f[_0x5559b6][_0xa08c('0x67')];}}var _0x5a208e=[],_0x479f6a={};for(var _0x23a17a=0x0,_0x5c7843=_0x3c1a39[_0xa08c('0x39')];_0x23a17a<_0x5c7843;_0x23a17a++){_0x479f6a={'ProjectId':_0x2ef363['params']['id'],'SessionId':_0x3c1a39[_0x23a17a]['id'],'StartTime':moment(_0x3c1a39[_0x23a17a][_0xa08c('0x68')])[_0xa08c('0x69')](_0xa08c('0x6a'))};for(var _0x419595=0x0,_0x2602a3=_0x244f3f[_0xa08c('0x39')];_0x419595<_0x2602a3;_0x419595++){if(_0x244f3f[_0x419595][_0xa08c('0x6b')]==_0x3c1a39[_0x23a17a]['id']&&_0x55a278[_0xa08c('0x3a')](_0x244f3f[_0x419595][_0xa08c('0x66')])){_0x479f6a[_0x55a278[_0x244f3f[_0x419595]['questionId']]]=_0x244f3f[_0x419595][_0xa08c('0x6c')];}}for(var _0x3ae665 in _0x55a278){if(!_0x479f6a[_0xa08c('0x3a')](_0x55a278[_0x3ae665])){_0x479f6a[_0x55a278[_0x3ae665]]=null;}}_0x5a208e[_0xa08c('0x6d')](_0x479f6a);}return _0x5a208e;}})['then'](function(_0x10c02b){if(!_['isEmpty'](_0x10c02b)){var _0x3d5c77=toCsv(_0x10c02b);var _0x2ae318=Date[_0xa08c('0x6e')]();fs['writeFileSync'](util[_0xa08c('0x69')](_0xa08c('0x6f'),_0x2ef363[_0xa08c('0x54')]['id'],_0x2ae318),_0x3d5c77);_0x412a10[_0xa08c('0x70')]('Content-disposition','attachment;\x20filename='+util[_0xa08c('0x69')](_0xa08c('0x71'),_0x2ef363[_0xa08c('0x54')]['id'],_0x2ae318));_0x412a10[_0xa08c('0x70')](_0xa08c('0x72'),_0xa08c('0x73'));return _0x412a10[_0xa08c('0x74')](util[_0xa08c('0x69')](_0xa08c('0x6f'),_0x2ef363[_0xa08c('0x54')]['id'],_0x2ae318));}else{return _0x412a10[_0xa08c('0x19')](0xcc);}})['catch'](handleError(_0x412a10,null));}; \ No newline at end of file +var _0xbbdd=['reject','save','update','then','get','Projects','UserProfileResource','destroy','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','omit','createdAt','updatedAt','UserProfileSection','userProfileId','pick','JscriptySessionReport','getAnswers','findOne','ProjectId','JscriptyAnswerReport','findAll','number','fromCharCode','toString','indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply'];(function(_0x5c9f10,_0x2d6fac){var _0x55ed6a=function(_0xa1f353){while(--_0xa1f353){_0x5c9f10['push'](_0x5c9f10['shift']());}};_0x55ed6a(++_0x2d6fac);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xbbdd[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbbd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbbd('0x1'));var rp=require(_0xdbbd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbbd('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xdbbd('0x4'));var ejs=require(_0xdbbd('0x5'));var fs=require('fs');var fs_extra=require(_0xdbbd('0x6'));var _=require(_0xdbbd('0x7'));var squel=require('squel');var crypto=require(_0xdbbd('0x8'));var jsforce=require(_0xdbbd('0x9'));var deskjs=require(_0xdbbd('0xa'));var toCsv=require(_0xdbbd('0x4'));var querystring=require(_0xdbbd('0xb'));var Papa=require(_0xdbbd('0xc'));var Redis=require(_0xdbbd('0xd'));var authService=require(_0xdbbd('0xe'));var qs=require(_0xdbbd('0xf'));var as=require(_0xdbbd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbbd('0x11'))(_0xdbbd('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x452ca8,_0xac66ed){_0xac66ed=_0xac66ed||0xcc;return function(_0x408ca9){if(_0x408ca9){return _0x452ca8[_0xdbbd('0x13')](_0xac66ed);}return _0x452ca8[_0xdbbd('0x14')](_0xac66ed)[_0xdbbd('0x15')]();};}function respondWithResult(_0x3f4907,_0x56e1b4){_0x56e1b4=_0x56e1b4||0xc8;return function(_0x2e231d){if(_0x2e231d){return _0x3f4907[_0xdbbd('0x14')](_0x56e1b4)['json'](_0x2e231d);}};}function respondWithFilteredResult(_0x38dc82,_0x1a64d9){return function(_0x2c76ad){if(_0x2c76ad){var _0x31a654=typeof _0x1a64d9['offset']===_0xdbbd('0x16')&&typeof _0x1a64d9[_0xdbbd('0x17')]==='undefined';var _0x87438c=_0x2c76ad[_0xdbbd('0x18')];var _0x26eb4c=_0x31a654?0x0:_0x1a64d9[_0xdbbd('0x19')];var _0x322ffc=_0x31a654?_0x2c76ad['count']:_0x1a64d9['offset']+_0x1a64d9['limit'];var _0x397210;if(_0x322ffc>=_0x87438c){_0x322ffc=_0x87438c;_0x397210=0xc8;}else{_0x397210=0xce;}_0x38dc82[_0xdbbd('0x14')](_0x397210);return _0x38dc82[_0xdbbd('0x1a')](_0xdbbd('0x1b'),_0x26eb4c+'-'+_0x322ffc+'/'+_0x87438c)[_0xdbbd('0x1c')](_0x2c76ad);}return null;};}function patchUpdates(_0x5bdddc){return function(_0x20c59b){try{jsonpatch[_0xdbbd('0x1d')](_0x20c59b,_0x5bdddc,!![]);}catch(_0x388209){return BPromise[_0xdbbd('0x1e')](_0x388209);}return _0x20c59b[_0xdbbd('0x1f')]();};}function saveUpdates(_0x3302ac,_0x492cb8){return function(_0x4a8899){if(_0x4a8899){return _0x4a8899[_0xdbbd('0x20')](_0x3302ac)['then'](function(_0x2ec3c2){return _0x2ec3c2;});}return null;};}function removeEntity(_0x1a6759,_0x14eccf){return function(_0x3d1c91){if(_0x3d1c91){return _0x3d1c91['destroy']()[_0xdbbd('0x21')](function(){var _0xef52b4=_0x3d1c91[_0xdbbd('0x22')]({'plain':!![]});var _0x5f3f4d=_0xdbbd('0x23');return db[_0xdbbd('0x24')][_0xdbbd('0x25')]({'where':{'type':_0x5f3f4d,'resourceId':_0xef52b4['id']}})[_0xdbbd('0x21')](function(){return _0x3d1c91;});})[_0xdbbd('0x21')](function(){_0x1a6759[_0xdbbd('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xeaa316,_0x44062a){return function(_0xb11f5d){if(!_0xb11f5d){_0xeaa316[_0xdbbd('0x13')](0x194);}return _0xb11f5d;};}function handleError(_0x2772c8,_0x457e54){_0x457e54=_0x457e54||0x1f4;return function(_0x22d6cc){logger['error'](_0x22d6cc[_0xdbbd('0x26')]);if(_0x22d6cc['name']){delete _0x22d6cc[_0xdbbd('0x27')];}_0x2772c8['status'](_0x457e54)[_0xdbbd('0x28')](_0x22d6cc);};}exports[_0xdbbd('0x29')]=function(_0x49aeab,_0x24da65){var _0x2ce1eb={},_0x107c08={},_0x369540={'count':0x0,'rows':[]};var _0x40df71=_[_0xdbbd('0x2a')](db[_0xdbbd('0x2b')][_0xdbbd('0x2c')],function(_0x25e7e4){return{'name':_0x25e7e4[_0xdbbd('0x2d')],'type':_0x25e7e4['type'][_0xdbbd('0x2e')]};});_0x107c08[_0xdbbd('0x2f')]=_[_0xdbbd('0x2a')](_0x40df71,_0xdbbd('0x27'));_0x107c08[_0xdbbd('0x30')]=_['keys'](_0x49aeab[_0xdbbd('0x30')]);_0x107c08[_0xdbbd('0x31')]=_[_0xdbbd('0x32')](_0x107c08[_0xdbbd('0x2f')],_0x107c08[_0xdbbd('0x30')]);_0x2ce1eb['attributes']=_[_0xdbbd('0x32')](_0x107c08[_0xdbbd('0x2f')],qs[_0xdbbd('0x33')](_0x49aeab[_0xdbbd('0x30')][_0xdbbd('0x33')]));_0x2ce1eb['attributes']=_0x2ce1eb[_0xdbbd('0x34')]['length']?_0x2ce1eb[_0xdbbd('0x34')]:_0x107c08[_0xdbbd('0x2f')];if(!_0x49aeab['query'][_0xdbbd('0x35')](_0xdbbd('0x36'))){_0x2ce1eb[_0xdbbd('0x17')]=qs[_0xdbbd('0x17')](_0x49aeab['query']['limit']);_0x2ce1eb[_0xdbbd('0x19')]=qs[_0xdbbd('0x19')](_0x49aeab[_0xdbbd('0x30')][_0xdbbd('0x19')]);}_0x2ce1eb[_0xdbbd('0x37')]=qs[_0xdbbd('0x38')](_0x49aeab['query']['sort']);_0x2ce1eb[_0xdbbd('0x39')]=qs[_0xdbbd('0x31')](_['pick'](_0x49aeab[_0xdbbd('0x30')],_0x107c08[_0xdbbd('0x31')]),_0x40df71);if(_0x49aeab['query'][_0xdbbd('0x3a')]){_0x2ce1eb[_0xdbbd('0x39')]=_[_0xdbbd('0x3b')](_0x2ce1eb['where'],{'$or':_[_0xdbbd('0x2a')](_0x40df71,function(_0x15840f){if(_0x15840f['type']!=='VIRTUAL'){var _0xc61d6f={};_0xc61d6f[_0x15840f[_0xdbbd('0x27')]]={'$like':'%'+_0x49aeab[_0xdbbd('0x30')][_0xdbbd('0x3a')]+'%'};return _0xc61d6f;}})});}_0x2ce1eb=_[_0xdbbd('0x3b')]({},_0x2ce1eb,_0x49aeab[_0xdbbd('0x3c')]);var _0x1eb27f={'where':_0x2ce1eb[_0xdbbd('0x39')]};return db[_0xdbbd('0x2b')][_0xdbbd('0x18')](_0x1eb27f)[_0xdbbd('0x21')](function(_0x1bf934){_0x369540[_0xdbbd('0x18')]=_0x1bf934;if(_0x49aeab[_0xdbbd('0x30')][_0xdbbd('0x3d')]){_0x2ce1eb[_0xdbbd('0x3e')]=[{'all':!![]}];}return db[_0xdbbd('0x2b')]['findAll'](_0x2ce1eb);})[_0xdbbd('0x21')](function(_0x5df96c){_0x369540[_0xdbbd('0x3f')]=_0x5df96c;return _0x369540;})['then'](respondWithFilteredResult(_0x24da65,_0x2ce1eb))[_0xdbbd('0x40')](handleError(_0x24da65,null));};exports['show']=function(_0x1f2839,_0x17735f){var _0x58fda1={'raw':![],'where':{'id':_0x1f2839[_0xdbbd('0x41')]['id']}},_0x340324={};_0x340324[_0xdbbd('0x2f')]=_['keys'](db[_0xdbbd('0x2b')][_0xdbbd('0x2c')]);_0x340324[_0xdbbd('0x30')]=_['keys'](_0x1f2839['query']);_0x340324[_0xdbbd('0x31')]=_[_0xdbbd('0x32')](_0x340324[_0xdbbd('0x2f')],_0x340324[_0xdbbd('0x30')]);_0x58fda1[_0xdbbd('0x34')]=_[_0xdbbd('0x32')](_0x340324['model'],qs[_0xdbbd('0x33')](_0x1f2839[_0xdbbd('0x30')][_0xdbbd('0x33')]));_0x58fda1[_0xdbbd('0x34')]=_0x58fda1['attributes'][_0xdbbd('0x42')]?_0x58fda1['attributes']:_0x340324[_0xdbbd('0x2f')];if(_0x1f2839[_0xdbbd('0x30')]['includeAll']){_0x58fda1[_0xdbbd('0x3e')]=[{'all':!![]}];}_0x58fda1=_[_0xdbbd('0x3b')]({},_0x58fda1,_0x1f2839[_0xdbbd('0x3c')]);return db[_0xdbbd('0x2b')][_0xdbbd('0x43')](_0x58fda1)['then'](handleEntityNotFound(_0x17735f,null))[_0xdbbd('0x21')](respondWithResult(_0x17735f,null))[_0xdbbd('0x40')](handleError(_0x17735f,null));};exports[_0xdbbd('0x44')]=function(_0x54f75d,_0x23183e){return db[_0xdbbd('0x2b')][_0xdbbd('0x44')](_0x54f75d[_0xdbbd('0x45')],{})[_0xdbbd('0x21')](function(_0x13f4a1){var _0x2c9bda=_0x54f75d['user'][_0xdbbd('0x22')]({'plain':!![]});if(!_0x2c9bda)throw new Error(_0xdbbd('0x46'));if(_0x2c9bda[_0xdbbd('0x47')]===_0xdbbd('0x48')){var _0x52a0d2=_0x13f4a1['get']({'plain':!![]});var _0x214cb6='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x214cb6,'userProfileId':_0x2c9bda['userProfileId']},'raw':!![]})[_0xdbbd('0x21')](function(_0x54c1ae){if(_0x54c1ae&&_0x54c1ae[_0xdbbd('0x49')]===0x0){return db[_0xdbbd('0x24')][_0xdbbd('0x44')]({'name':_0x52a0d2[_0xdbbd('0x27')],'resourceId':_0x52a0d2['id'],'type':_0x54c1ae[_0xdbbd('0x27')],'sectionId':_0x54c1ae['id']},{})[_0xdbbd('0x21')](function(){return _0x13f4a1;});}else{return _0x13f4a1;}})['catch'](function(_0x32329){logger[_0xdbbd('0x4a')](_0xdbbd('0x4b'),_0x32329);throw _0x32329;});}return _0x13f4a1;})[_0xdbbd('0x21')](respondWithResult(_0x23183e,0xc9))['catch'](handleError(_0x23183e,null));};exports[_0xdbbd('0x4c')]=function(_0x190a14,_0x184a62){var _0xbf6a8e={'where':{'id':_0x190a14[_0xdbbd('0x41')]['id']}},_0x4bd45e={};_0x4bd45e['model']=_[_0xdbbd('0x4d')](db[_0xdbbd('0x2b')]['rawAttributes']);_0xbf6a8e[_0xdbbd('0x34')]=_['intersection'](_0x4bd45e[_0xdbbd('0x2f')],qs[_0xdbbd('0x33')](_0x190a14[_0xdbbd('0x30')]['fields']));_0xbf6a8e[_0xdbbd('0x34')]=_0xbf6a8e[_0xdbbd('0x34')][_0xdbbd('0x42')]?_0xbf6a8e['attributes']:_0x4bd45e[_0xdbbd('0x2f')];if(_0x190a14[_0xdbbd('0x30')]['includeAll']){_0xbf6a8e[_0xdbbd('0x3e')]=[{'all':!![]}];}_0xbf6a8e=_['merge']({},_0xbf6a8e,_0x190a14[_0xdbbd('0x3c')]);return db[_0xdbbd('0x2b')][_0xdbbd('0x43')](_0xbf6a8e)[_0xdbbd('0x21')](handleEntityNotFound(_0x184a62,null))['then'](function(_0x462eb7){if(_0x462eb7){var _0x1abc46=_0x462eb7['get']({'plain':!![]});_0x1abc46=qs[_0xdbbd('0x4e')](_0x1abc46,['id',_0xdbbd('0x4f'),_0xdbbd('0x50')]);_0x190a14[_0xdbbd('0x45')]=_[_0xdbbd('0x4e')](_0x190a14[_0xdbbd('0x45')],['id','createdAt',_0xdbbd('0x50')]);return db[_0xdbbd('0x2b')]['create'](_[_0xdbbd('0x3b')](_0x1abc46,_0x190a14[_0xdbbd('0x45')]),{'include':_0x190a14['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x1a44ec){var _0x92d532=_0x190a14[_0xdbbd('0x48')][_0xdbbd('0x22')]({'plain':!![]});if(!_0x92d532)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x92d532[_0xdbbd('0x47')]===_0xdbbd('0x48')){var _0x56a2ed=_0x1a44ec[_0xdbbd('0x22')]({'plain':!![]});var _0xf46f6f=_0xdbbd('0x23');return db[_0xdbbd('0x51')][_0xdbbd('0x43')]({'where':{'name':_0xf46f6f,'userProfileId':_0x92d532[_0xdbbd('0x52')]},'raw':!![]})[_0xdbbd('0x21')](function(_0x2401fe){if(_0x2401fe&&_0x2401fe[_0xdbbd('0x49')]===0x0){return db[_0xdbbd('0x24')][_0xdbbd('0x44')]({'name':_0x56a2ed[_0xdbbd('0x27')],'resourceId':_0x56a2ed['id'],'type':_0x2401fe['name'],'sectionId':_0x2401fe['id']},{})['then'](function(){return _0x1a44ec;});}else{return _0x1a44ec;}})[_0xdbbd('0x40')](function(_0x3456bd){logger[_0xdbbd('0x4a')](_0xdbbd('0x4b'),_0x3456bd);throw _0x3456bd;});}return _0x1a44ec;});}})[_0xdbbd('0x21')](respondWithResult(_0x184a62,0xc9))[_0xdbbd('0x40')](handleError(_0x184a62,null));};exports['update']=function(_0x3e89c2,_0x37b295){if(_0x3e89c2[_0xdbbd('0x45')]['id']){delete _0x3e89c2[_0xdbbd('0x45')]['id'];}return db[_0xdbbd('0x2b')]['find']({'where':{'id':_0x3e89c2['params']['id']}})[_0xdbbd('0x21')](handleEntityNotFound(_0x37b295,null))[_0xdbbd('0x21')](saveUpdates(_0x3e89c2[_0xdbbd('0x45')],null))[_0xdbbd('0x21')](respondWithResult(_0x37b295,null))[_0xdbbd('0x40')](handleError(_0x37b295,null));};exports[_0xdbbd('0x25')]=function(_0x1c86fc,_0x2fb938){return db[_0xdbbd('0x2b')]['find']({'where':{'id':_0x1c86fc['params']['id']}})['then'](handleEntityNotFound(_0x2fb938,null))[_0xdbbd('0x21')](removeEntity(_0x2fb938,null))[_0xdbbd('0x40')](handleError(_0x2fb938,null));};exports['getSessions']=function(_0x348744,_0x3a2d6a,_0x555def){var _0x5cff66={'raw':!![],'where':{}};var _0x2e4344={};var _0x59c60f={'count':0x0,'rows':[]};return db[_0xdbbd('0x2b')]['findOne']({'where':{'id':_0x348744['params']['id']}})[_0xdbbd('0x21')](handleEntityNotFound(_0x3a2d6a,null))['then'](function(_0x33d5f3){if(_0x33d5f3){_0x2e4344[_0xdbbd('0x2f')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x2e4344[_0xdbbd('0x30')]=_[_0xdbbd('0x4d')](_0x348744[_0xdbbd('0x30')]);_0x2e4344['filters']=_['intersection'](_0x2e4344[_0xdbbd('0x2f')],_0x2e4344[_0xdbbd('0x30')]);_0x5cff66[_0xdbbd('0x34')]=_[_0xdbbd('0x32')](_0x2e4344[_0xdbbd('0x2f')],qs[_0xdbbd('0x33')](_0x348744[_0xdbbd('0x30')][_0xdbbd('0x33')]));_0x5cff66[_0xdbbd('0x34')]=_0x5cff66[_0xdbbd('0x34')][_0xdbbd('0x42')]?_0x5cff66[_0xdbbd('0x34')]:_0x2e4344['model'];if(!_0x348744[_0xdbbd('0x30')][_0xdbbd('0x35')]('nolimit')){_0x5cff66['limit']=qs[_0xdbbd('0x17')](_0x348744[_0xdbbd('0x30')][_0xdbbd('0x17')]);_0x5cff66[_0xdbbd('0x19')]=qs['offset'](_0x348744['query'][_0xdbbd('0x19')]);}_0x5cff66[_0xdbbd('0x37')]=qs[_0xdbbd('0x38')](_0x348744['query'][_0xdbbd('0x38')]);_0x5cff66[_0xdbbd('0x39')]=qs['filters'](_[_0xdbbd('0x53')](_0x348744[_0xdbbd('0x30')],_0x2e4344[_0xdbbd('0x31')]));_0x5cff66['where']['ProjectId']=_0x33d5f3['id'];if(_0x348744['query'][_0xdbbd('0x3a')]){_0x5cff66[_0xdbbd('0x39')]=_[_0xdbbd('0x3b')](_0x5cff66[_0xdbbd('0x39')],{'$or':_['map'](_0x5cff66[_0xdbbd('0x34')],function(_0x23be6b){var _0x28c212={};_0x28c212[_0x23be6b]={'$like':'%'+_0x348744[_0xdbbd('0x30')][_0xdbbd('0x3a')]+'%'};return _0x28c212;})});}_0x5cff66=_['merge']({},_0x5cff66,_0x348744[_0xdbbd('0x3c')]);return db[_0xdbbd('0x54')][_0xdbbd('0x18')]({'where':_0x5cff66['where']})['then'](function(_0x3242d9){_0x59c60f['count']=_0x3242d9;if(_0x348744[_0xdbbd('0x30')][_0xdbbd('0x3d')]){_0x5cff66[_0xdbbd('0x3e')]=[{'all':!![]}];}return db[_0xdbbd('0x54')]['findAll'](_0x5cff66);})[_0xdbbd('0x21')](function(_0x578186){_0x59c60f[_0xdbbd('0x3f')]=_0x578186;return _0x59c60f;});}})[_0xdbbd('0x21')](respondWithFilteredResult(_0x3a2d6a,_0x5cff66))[_0xdbbd('0x40')](handleError(_0x3a2d6a,null));};exports[_0xdbbd('0x55')]=function(_0x16e665,_0x58c506,_0x53aa21){var _0x52dfba={'raw':!![],'where':{}};var _0x50a3af={};var _0x209fd8={'count':0x0,'rows':[]};return db[_0xdbbd('0x2b')][_0xdbbd('0x56')]({'where':{'id':_0x16e665['params']['id']}})['then'](handleEntityNotFound(_0x58c506,null))[_0xdbbd('0x21')](function(_0x128d26){if(_0x128d26){_0x50a3af[_0xdbbd('0x2f')]=_['keys'](db['JscriptyAnswerReport'][_0xdbbd('0x2c')]);_0x50a3af[_0xdbbd('0x30')]=_['keys'](_0x16e665['query']);_0x50a3af[_0xdbbd('0x31')]=_['intersection'](_0x50a3af['model'],_0x50a3af[_0xdbbd('0x30')]);_0x52dfba[_0xdbbd('0x34')]=_[_0xdbbd('0x32')](_0x50a3af['model'],qs[_0xdbbd('0x33')](_0x16e665['query'][_0xdbbd('0x33')]));_0x52dfba[_0xdbbd('0x34')]=_0x52dfba[_0xdbbd('0x34')][_0xdbbd('0x42')]?_0x52dfba['attributes']:_0x50a3af[_0xdbbd('0x2f')];if(!_0x16e665['query'][_0xdbbd('0x35')]('nolimit')){_0x52dfba[_0xdbbd('0x17')]=qs[_0xdbbd('0x17')](_0x16e665[_0xdbbd('0x30')][_0xdbbd('0x17')]);_0x52dfba[_0xdbbd('0x19')]=qs['offset'](_0x16e665[_0xdbbd('0x30')]['offset']);}_0x52dfba[_0xdbbd('0x37')]=qs[_0xdbbd('0x38')](_0x16e665[_0xdbbd('0x30')][_0xdbbd('0x38')]);_0x52dfba[_0xdbbd('0x39')]=qs[_0xdbbd('0x31')](_[_0xdbbd('0x53')](_0x16e665[_0xdbbd('0x30')],_0x50a3af[_0xdbbd('0x31')]));_0x52dfba[_0xdbbd('0x39')][_0xdbbd('0x57')]=_0x128d26['id'];if(_0x16e665[_0xdbbd('0x30')][_0xdbbd('0x3a')]){_0x52dfba['where']=_[_0xdbbd('0x3b')](_0x52dfba['where'],{'$or':_[_0xdbbd('0x2a')](_0x52dfba[_0xdbbd('0x34')],function(_0x47127c){var _0x3e6591={};_0x3e6591[_0x47127c]={'$like':'%'+_0x16e665[_0xdbbd('0x30')][_0xdbbd('0x3a')]+'%'};return _0x3e6591;})});}_0x52dfba=_[_0xdbbd('0x3b')]({},_0x52dfba,_0x16e665[_0xdbbd('0x3c')]);return db[_0xdbbd('0x58')]['count']({'where':_0x52dfba[_0xdbbd('0x39')]})[_0xdbbd('0x21')](function(_0x17f25e){_0x209fd8[_0xdbbd('0x18')]=_0x17f25e;if(_0x16e665[_0xdbbd('0x30')][_0xdbbd('0x3d')]){_0x52dfba['include']=[{'all':!![]}];}return db[_0xdbbd('0x58')][_0xdbbd('0x59')](_0x52dfba);})[_0xdbbd('0x21')](function(_0x542f96){_0x209fd8[_0xdbbd('0x3f')]=_0x542f96;return _0x209fd8;});}})[_0xdbbd('0x21')](respondWithFilteredResult(_0x58c506,_0x52dfba))[_0xdbbd('0x40')](handleError(_0x58c506,null));};function char(_0x4b7391){return _0xdbbd('0x5a')===typeof _0x4b7391?String[_0xdbbd('0x5b')]['apply'](null,arguments):_0x4b7391;}function needsEncapsulation(_0x2c95af){return!!_0x2c95af&&(_0x2c95af[_0xdbbd('0x5c')]()[_0xdbbd('0x5d')](char(0xd))>=0x0||_0x2c95af[_0xdbbd('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x2c95af['toString']()[_0xdbbd('0x5d')](char(0x2c))>=0x0||_0x2c95af[_0xdbbd('0x5c')]()[_0xdbbd('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x22485c){var _0x1d1471=char(0x22),_0xefdb93='\x5c'+char(0x22),_0x5ee9eb=_0x22485c['toString']()[_0xdbbd('0x5e')](new RegExp(_0x1d1471,'g'),_0xefdb93);return _0x1d1471+_0x5ee9eb+_0x1d1471;}exports[_0xdbbd('0x5f')]=function(_0xbe141,_0x2b2631,_0x590d20){var _0xc8570,_0x547fed;var _0x2af1b3={'where':{'ProjectId':_0xbe141[_0xdbbd('0x41')]['id']}};if(_0xbe141[_0xdbbd('0x30')]['startTime']){_0x2af1b3['where'][_0xdbbd('0x60')]=JSON[_0xdbbd('0x61')](_0xbe141[_0xdbbd('0x30')][_0xdbbd('0x62')]);}return db['JscriptySessionReport']['findAll'](_0x2af1b3)[_0xdbbd('0x21')](handleEntityNotFound(_0x2b2631,null))[_0xdbbd('0x21')](function(_0x2e02d2){if(_0x2e02d2){_0xc8570=_0x2e02d2;return db[_0xdbbd('0x63')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0xc8570,'id')},'ProjectId':_0xbe141['params']['id']},'order':'-createdAt'});}})[_0xdbbd('0x21')](handleEntityNotFound(_0x2b2631,null))['then'](function(_0x1ef01b){if(_0x1ef01b){_0x547fed=_0x1ef01b;var _0x340fe0={};for(var _0x5af96e=0x0,_0x1523d8=_0x547fed['length'];_0x5af96e<_0x1523d8;_0x5af96e++){if(!_0x340fe0[_0xdbbd('0x35')](_0x547fed[_0x5af96e]['questionId'])){_0x340fe0[_0x547fed[_0x5af96e][_0xdbbd('0x64')]]=needsEncapsulation(_0x547fed[_0x5af96e][_0xdbbd('0x65')])?encapsulate(_0x547fed[_0x5af96e][_0xdbbd('0x65')]):_0x547fed[_0x5af96e]['question'];}}var _0x5ec7b3=[],_0x41ea03={};for(var _0x173dab=0x0,_0x4e946d=_0xc8570[_0xdbbd('0x42')];_0x173dab<_0x4e946d;_0x173dab++){_0x41ea03={'ProjectId':_0xbe141[_0xdbbd('0x41')]['id'],'SessionId':_0xc8570[_0x173dab]['id'],'StartTime':moment(_0xc8570[_0x173dab][_0xdbbd('0x60')])[_0xdbbd('0x66')](_0xdbbd('0x67'))};for(var _0x4813ce=0x0,_0x3b765e=_0x547fed['length'];_0x4813ce<_0x3b765e;_0x4813ce++){if(_0x547fed[_0x4813ce][_0xdbbd('0x68')]==_0xc8570[_0x173dab]['id']&&_0x340fe0[_0xdbbd('0x35')](_0x547fed[_0x4813ce][_0xdbbd('0x64')])){_0x41ea03[_0x340fe0[_0x547fed[_0x4813ce][_0xdbbd('0x64')]]]=_0x547fed[_0x4813ce][_0xdbbd('0x69')];}}for(var _0x590079 in _0x340fe0){if(!_0x41ea03[_0xdbbd('0x35')](_0x340fe0[_0x590079])){_0x41ea03[_0x340fe0[_0x590079]]=null;}}_0x5ec7b3[_0xdbbd('0x6a')](_0x41ea03);}return _0x5ec7b3;}})[_0xdbbd('0x21')](function(_0x1aeb1c){if(!_[_0xdbbd('0x6b')](_0x1aeb1c)){var _0x1c1820=toCsv(_0x1aeb1c);var _0xfabd7c=Date[_0xdbbd('0x6c')]();fs[_0xdbbd('0x6d')](util[_0xdbbd('0x66')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xbe141[_0xdbbd('0x41')]['id'],_0xfabd7c),_0x1c1820);_0x2b2631[_0xdbbd('0x6e')](_0xdbbd('0x6f'),_0xdbbd('0x70')+util[_0xdbbd('0x66')](_0xdbbd('0x71'),_0xbe141[_0xdbbd('0x41')]['id'],_0xfabd7c));_0x2b2631[_0xdbbd('0x6e')](_0xdbbd('0x72'),_0xdbbd('0x73'));return _0x2b2631[_0xdbbd('0x74')](util[_0xdbbd('0x66')](_0xdbbd('0x75'),_0xbe141['params']['id'],_0xfabd7c));}else{return _0x2b2631[_0xdbbd('0x13')](0xcc);}})[_0xdbbd('0x40')](handleError(_0x2b2631,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 787a5bd..d8ed791 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 _0x89c3=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3a6aa2,_0x5e8f53){var _0x3b111e=function(_0x3367f0){while(--_0x3367f0){_0x3a6aa2['push'](_0x3a6aa2['shift']());}};_0x3b111e(++_0x5e8f53);}(_0x89c3,0xff));var _0x389c=function(_0x75d99b,_0x4e7cd5){_0x75d99b=_0x75d99b-0x0;var _0x50a448=_0x89c3[_0x75d99b];return _0x50a448;};'use strict';var _=require(_0x389c('0x0'));var util=require(_0x389c('0x1'));var logger=require(_0x389c('0x2'))(_0x389c('0x3'));var moment=require(_0x389c('0x4'));var BPromise=require(_0x389c('0x5'));var rp=require(_0x389c('0x6'));var fs=require('fs');var path=require(_0x389c('0x7'));var rimraf=require('rimraf');var config=require(_0x389c('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x389c('0x9')]=function(_0x4bece6,_0x51f5f5){return _0x4bece6[_0x389c('0xa')]('JscriptyProject',attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa2b=['../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x28ee06,_0x418a08){_0x28ee06=_0x28ee06-0x0;var _0x124567=_0xfa2b[_0x28ee06];return _0x124567;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var logger=require(_0xbfa2('0x2'))(_0xbfa2('0x3'));var moment=require(_0xbfa2('0x4'));var BPromise=require(_0xbfa2('0x5'));var rp=require(_0xbfa2('0x6'));var fs=require('fs');var path=require(_0xbfa2('0x7'));var rimraf=require(_0xbfa2('0x8'));var config=require(_0xbfa2('0x9'));var attributes=require(_0xbfa2('0xa'));module[_0xbfa2('0xb')]=function(_0x12d71e,_0x237a99){return _0x12d71e[_0xbfa2('0xc')](_0xbfa2('0xd'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 29591ac..b504d24 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x206b07,_0x30ee32){var _0x55de27=function(_0x82ff93){while(--_0x82ff93){_0x206b07['push'](_0x206b07['shift']());}};_0x55de27(++_0x30ee32);}(_0xaa88,0x137));var _0x8aa8=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xaa88[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x7373f4,_0x1b3715){var _0xa2dc37=function(_0x2e49a1){while(--_0x2e49a1){_0x7373f4['push'](_0x7373f4['shift']());}};_0xa2dc37(++_0x1b3715);}(_0xf4eb,0xec));var _0xbf4e=function(_0x2048cb,_0x27b130){_0x2048cb=_0x2048cb-0x0;var _0x1626bd=_0xf4eb[_0x2048cb];return _0x1626bd;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 73f429a..fc1c380 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 _0xed67=['index','/describe','describe','/:id','create','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated'];(function(_0x5cf3c0,_0x4363c1){var _0x39a680=function(_0x2a10f1){while(--_0x2a10f1){_0x5cf3c0['push'](_0x5cf3c0['shift']());}};_0x39a680(++_0x4363c1);}(_0xed67,0xe0));var _0x7ed6=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0xed67[_0x3b632f];return _0x10e788;};'use strict';var multer=require(_0x7ed6('0x0'));var util=require('util');var path=require(_0x7ed6('0x1'));var timeout=require(_0x7ed6('0x2'));var express=require(_0x7ed6('0x3'));var router=express[_0x7ed6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7ed6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7ed6('0x6'));var controller=require(_0x7ed6('0x7'));router[_0x7ed6('0x8')]('/',auth[_0x7ed6('0x9')](),controller[_0x7ed6('0xa')]);router[_0x7ed6('0x8')](_0x7ed6('0xb'),auth[_0x7ed6('0x9')](),controller[_0x7ed6('0xc')]);router[_0x7ed6('0x8')](_0x7ed6('0xd'),auth[_0x7ed6('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x7ed6('0xe')]);router['put'](_0x7ed6('0xd'),auth['isAuthenticated'](),controller[_0x7ed6('0xf')]);router['delete']('/:id',auth[_0x7ed6('0x9')](),controller[_0x7ed6('0x10')]);module[_0x7ed6('0x11')]=router; \ No newline at end of file +var _0xe613=['./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','/:id','show','update','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3126e0,_0x15cf3d){var _0x5750ec=function(_0xc9e556){while(--_0xc9e556){_0x3126e0['push'](_0x3126e0['shift']());}};_0x5750ec(++_0x15cf3d);}(_0xe613,0xcb));var _0x3e61=function(_0x1738ca,_0x452c3c){_0x1738ca=_0x1738ca-0x0;var _0xbd1db1=_0xe613[_0x1738ca];return _0xbd1db1;};'use strict';var multer=require('multer');var util=require(_0x3e61('0x0'));var path=require(_0x3e61('0x1'));var timeout=require('connect-timeout');var express=require(_0x3e61('0x2'));var router=express[_0x3e61('0x3')]();var fs_extra=require(_0x3e61('0x4'));var auth=require(_0x3e61('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3e61('0x6'));var controller=require(_0x3e61('0x7'));router[_0x3e61('0x8')]('/',auth[_0x3e61('0x9')](),controller['index']);router[_0x3e61('0x8')](_0x3e61('0xa'),auth[_0x3e61('0x9')](),controller['describe']);router[_0x3e61('0x8')](_0x3e61('0xb'),auth['isAuthenticated'](),controller[_0x3e61('0xc')]);router['post']('/',auth[_0x3e61('0x9')](),controller['create']);router['put']('/:id',auth[_0x3e61('0x9')](),controller[_0x3e61('0xd')]);router['delete'](_0x3e61('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x3e61('0xe')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 59e7b6e..b55c37d 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(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x7a54,0x106));var _0x47a5=function(_0x50075c,_0x2d3610){_0x50075c=_0x50075c-0x0;var _0x3d83b1=_0x7a54[_0x50075c];return _0x3d83b1;};'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(_0x1ddf19,_0x3afb4a){_0x1ddf19=_0x1ddf19-0x0;var _0x3bbc41=_0x7a54[_0x1ddf19];return _0x3bbc41;};'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 7fe4333..dbee938 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 _0xea92=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','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/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport','count','includeAll','rows','catch','show','params','include','find','body'];(function(_0x4d53ed,_0x2ec650){var _0x18637b=function(_0x2230e9){while(--_0x2230e9){_0x4d53ed['push'](_0x4d53ed['shift']());}};_0x18637b(++_0x2ec650);}(_0xea92,0x95));var _0x2ea9=function(_0x420575,_0x24b7a0){_0x420575=_0x420575-0x0;var _0x514503=_0xea92[_0x420575];return _0x514503;};'use strict';var emlformat=require(_0x2ea9('0x0'));var rimraf=require(_0x2ea9('0x1'));var zipdir=require(_0x2ea9('0x2'));var jsonpatch=require(_0x2ea9('0x3'));var rp=require(_0x2ea9('0x4'));var moment=require('moment');var BPromise=require(_0x2ea9('0x5'));var Mustache=require(_0x2ea9('0x6'));var util=require(_0x2ea9('0x7'));var path=require('path');var sox=require(_0x2ea9('0x8'));var csv=require('to-csv');var ejs=require(_0x2ea9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ea9('0xa'));var squel=require(_0x2ea9('0xb'));var crypto=require(_0x2ea9('0xc'));var jsforce=require(_0x2ea9('0xd'));var deskjs=require(_0x2ea9('0xe'));var toCsv=require(_0x2ea9('0xf'));var querystring=require(_0x2ea9('0x10'));var Papa=require(_0x2ea9('0x11'));var Redis=require(_0x2ea9('0x12'));var authService=require(_0x2ea9('0x13'));var qs=require(_0x2ea9('0x14'));var as=require(_0x2ea9('0x15'));var hardwareService=require(_0x2ea9('0x16'));var logger=require(_0x2ea9('0x17'))(_0x2ea9('0x18'));var utils=require('../../config/utils');var config=require(_0x2ea9('0x19'));var licenseUtil=require(_0x2ea9('0x1a'));var db=require(_0x2ea9('0x1b'))['db'];function respondWithStatusCode(_0x138937,_0x1d381b){_0x1d381b=_0x1d381b||0xcc;return function(_0x35af3a){if(_0x35af3a){return _0x138937['sendStatus'](_0x1d381b);}return _0x138937[_0x2ea9('0x1c')](_0x1d381b)[_0x2ea9('0x1d')]();};}function respondWithResult(_0x85fc40,_0x577113){_0x577113=_0x577113||0xc8;return function(_0x3aa750){if(_0x3aa750){return _0x85fc40[_0x2ea9('0x1c')](_0x577113)[_0x2ea9('0x1e')](_0x3aa750);}};}function respondWithFilteredResult(_0x56a1f8,_0x2be79c){return function(_0x893978){if(_0x893978){var _0x22f222=typeof _0x2be79c[_0x2ea9('0x1f')]===_0x2ea9('0x20')&&typeof _0x2be79c[_0x2ea9('0x21')]==='undefined';var _0x1d512e=_0x893978['count'];var _0x4daa23=_0x22f222?0x0:_0x2be79c['offset'];var _0x4c254b=_0x22f222?_0x893978['count']:_0x2be79c[_0x2ea9('0x1f')]+_0x2be79c[_0x2ea9('0x21')];var _0x4cec1f;if(_0x4c254b>=_0x1d512e){_0x4c254b=_0x1d512e;_0x4cec1f=0xc8;}else{_0x4cec1f=0xce;}_0x56a1f8[_0x2ea9('0x1c')](_0x4cec1f);return _0x56a1f8['set']('Content-Range',_0x4daa23+'-'+_0x4c254b+'/'+_0x1d512e)[_0x2ea9('0x1e')](_0x893978);}return null;};}function patchUpdates(_0x46c4e7){return function(_0x49b898){try{jsonpatch['apply'](_0x49b898,_0x46c4e7,!![]);}catch(_0x6e1e07){return BPromise['reject'](_0x6e1e07);}return _0x49b898[_0x2ea9('0x22')]();};}function saveUpdates(_0x9682ec,_0x88aa58){return function(_0x46f0d0){if(_0x46f0d0){return _0x46f0d0[_0x2ea9('0x23')](_0x9682ec)[_0x2ea9('0x24')](function(_0x3b19c6){return _0x3b19c6;});}return null;};}function removeEntity(_0xfa67ae,_0x2fdda4){return function(_0x5e13dd){if(_0x5e13dd){return _0x5e13dd[_0x2ea9('0x25')]()[_0x2ea9('0x24')](function(){_0xfa67ae[_0x2ea9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa9cc47,_0x56e1c0){return function(_0x295d9c){if(!_0x295d9c){_0xa9cc47['sendStatus'](0x194);}return _0x295d9c;};}function handleError(_0x160f94,_0x266ce4){_0x266ce4=_0x266ce4||0x1f4;return function(_0x5b4cb3){logger[_0x2ea9('0x26')](_0x5b4cb3[_0x2ea9('0x27')]);if(_0x5b4cb3[_0x2ea9('0x28')]){delete _0x5b4cb3['name'];}_0x160f94[_0x2ea9('0x1c')](_0x266ce4)['send'](_0x5b4cb3);};}exports[_0x2ea9('0x29')]=function(_0x587fc6,_0x12dbd6){var _0x5df3ab={},_0xb67aa2={},_0x3549b9={'count':0x0,'rows':[]};var _0x534e00=_[_0x2ea9('0x2a')](db['JscriptyQuestionReport'][_0x2ea9('0x2b')],function(_0x429adf){return{'name':_0x429adf[_0x2ea9('0x2c')],'type':_0x429adf[_0x2ea9('0x2d')]['key']};});_0xb67aa2[_0x2ea9('0x2e')]=_['map'](_0x534e00,_0x2ea9('0x28'));_0xb67aa2['query']=_[_0x2ea9('0x2f')](_0x587fc6[_0x2ea9('0x30')]);_0xb67aa2[_0x2ea9('0x31')]=_[_0x2ea9('0x32')](_0xb67aa2[_0x2ea9('0x2e')],_0xb67aa2['query']);_0x5df3ab[_0x2ea9('0x33')]=_[_0x2ea9('0x32')](_0xb67aa2[_0x2ea9('0x2e')],qs[_0x2ea9('0x34')](_0x587fc6[_0x2ea9('0x30')]['fields']));_0x5df3ab[_0x2ea9('0x33')]=_0x5df3ab[_0x2ea9('0x33')][_0x2ea9('0x35')]?_0x5df3ab[_0x2ea9('0x33')]:_0xb67aa2[_0x2ea9('0x2e')];if(!_0x587fc6[_0x2ea9('0x30')]['hasOwnProperty'](_0x2ea9('0x36'))){_0x5df3ab[_0x2ea9('0x21')]=qs[_0x2ea9('0x21')](_0x587fc6[_0x2ea9('0x30')][_0x2ea9('0x21')]);_0x5df3ab['offset']=qs[_0x2ea9('0x1f')](_0x587fc6['query'][_0x2ea9('0x1f')]);}_0x5df3ab[_0x2ea9('0x37')]=qs[_0x2ea9('0x38')](_0x587fc6['query'][_0x2ea9('0x38')]);_0x5df3ab[_0x2ea9('0x39')]=qs[_0x2ea9('0x31')](_[_0x2ea9('0x3a')](_0x587fc6[_0x2ea9('0x30')],_0xb67aa2[_0x2ea9('0x31')]),_0x534e00);if(_0x587fc6[_0x2ea9('0x30')][_0x2ea9('0x3b')]){_0x5df3ab[_0x2ea9('0x39')]=_[_0x2ea9('0x3c')](_0x5df3ab[_0x2ea9('0x39')],{'$or':_['map'](_0x534e00,function(_0x4176b5){if(_0x4176b5[_0x2ea9('0x2d')]!==_0x2ea9('0x3d')){var _0x29515c={};_0x29515c[_0x4176b5[_0x2ea9('0x28')]]={'$like':'%'+_0x587fc6[_0x2ea9('0x30')][_0x2ea9('0x3b')]+'%'};return _0x29515c;}})});}_0x5df3ab=_[_0x2ea9('0x3c')]({},_0x5df3ab,_0x587fc6[_0x2ea9('0x3e')]);var _0x5c98b0={'where':_0x5df3ab['where']};return db[_0x2ea9('0x3f')][_0x2ea9('0x40')](_0x5c98b0)[_0x2ea9('0x24')](function(_0x3ee390){_0x3549b9[_0x2ea9('0x40')]=_0x3ee390;if(_0x587fc6[_0x2ea9('0x30')][_0x2ea9('0x41')]){_0x5df3ab['include']=[{'all':!![]}];}return db[_0x2ea9('0x3f')]['findAll'](_0x5df3ab);})['then'](function(_0x543777){_0x3549b9[_0x2ea9('0x42')]=_0x543777;return _0x3549b9;})[_0x2ea9('0x24')](respondWithFilteredResult(_0x12dbd6,_0x5df3ab))[_0x2ea9('0x43')](handleError(_0x12dbd6,null));};exports[_0x2ea9('0x44')]=function(_0x1ecbcd,_0x506ded){var _0x2a2ebf={'raw':!![],'where':{'id':_0x1ecbcd[_0x2ea9('0x45')]['id']}},_0x21db20={};_0x21db20[_0x2ea9('0x2e')]=_['keys'](db[_0x2ea9('0x3f')][_0x2ea9('0x2b')]);_0x21db20['query']=_['keys'](_0x1ecbcd[_0x2ea9('0x30')]);_0x21db20[_0x2ea9('0x31')]=_[_0x2ea9('0x32')](_0x21db20[_0x2ea9('0x2e')],_0x21db20['query']);_0x2a2ebf['attributes']=_['intersection'](_0x21db20[_0x2ea9('0x2e')],qs[_0x2ea9('0x34')](_0x1ecbcd[_0x2ea9('0x30')][_0x2ea9('0x34')]));_0x2a2ebf[_0x2ea9('0x33')]=_0x2a2ebf['attributes'][_0x2ea9('0x35')]?_0x2a2ebf[_0x2ea9('0x33')]:_0x21db20[_0x2ea9('0x2e')];if(_0x1ecbcd[_0x2ea9('0x30')][_0x2ea9('0x41')]){_0x2a2ebf[_0x2ea9('0x46')]=[{'all':!![]}];}_0x2a2ebf=_[_0x2ea9('0x3c')]({},_0x2a2ebf,_0x1ecbcd['options']);return db[_0x2ea9('0x3f')][_0x2ea9('0x47')](_0x2a2ebf)[_0x2ea9('0x24')](handleEntityNotFound(_0x506ded,null))['then'](respondWithResult(_0x506ded,null))[_0x2ea9('0x43')](handleError(_0x506ded,null));};exports['create']=function(_0x5009b6,_0x3ef473){return db[_0x2ea9('0x3f')]['create'](_0x5009b6[_0x2ea9('0x48')],{})[_0x2ea9('0x24')](respondWithResult(_0x3ef473,0xc9))[_0x2ea9('0x43')](handleError(_0x3ef473,null));};exports[_0x2ea9('0x23')]=function(_0x4cdc3a,_0x54c2e8){if(_0x4cdc3a[_0x2ea9('0x48')]['id']){delete _0x4cdc3a[_0x2ea9('0x48')]['id'];}return db[_0x2ea9('0x3f')]['find']({'where':{'id':_0x4cdc3a[_0x2ea9('0x45')]['id']}})[_0x2ea9('0x24')](handleEntityNotFound(_0x54c2e8,null))[_0x2ea9('0x24')](saveUpdates(_0x4cdc3a[_0x2ea9('0x48')],null))['then'](respondWithResult(_0x54c2e8,null))[_0x2ea9('0x43')](handleError(_0x54c2e8,null));};exports[_0x2ea9('0x25')]=function(_0x5229a1,_0x5bb5c9){return db[_0x2ea9('0x3f')]['find']({'where':{'id':_0x5229a1['params']['id']}})[_0x2ea9('0x24')](handleEntityNotFound(_0x5bb5c9,null))['then'](removeEntity(_0x5bb5c9,null))[_0x2ea9('0x43')](handleError(_0x5bb5c9,null));};exports[_0x2ea9('0x49')]=function(_0x3a3ffb,_0x23e5ad){return db['JscriptyQuestionReport'][_0x2ea9('0x49')]()[_0x2ea9('0x24')](respondWithResult(_0x23e5ad,null))[_0x2ea9('0x43')](handleError(_0x23e5ad,null));}; \ No newline at end of file +var _0xc457=['sendStatus','error','stack','name','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','JscriptyQuestionReport','includeAll','include','rows','catch','show','params','intersection','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','end'];(function(_0x31627d,_0xb25b20){var _0x432628=function(_0xc90ebf){while(--_0xc90ebf){_0x31627d['push'](_0x31627d['shift']());}};_0x432628(++_0xb25b20);}(_0xc457,0xbb));var _0x7c45=function(_0x569bc6,_0x22c305){_0x569bc6=_0x569bc6-0x0;var _0x115107=_0xc457[_0x569bc6];return _0x115107;};'use strict';var emlformat=require(_0x7c45('0x0'));var rimraf=require(_0x7c45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7c45('0x2'));var rp=require(_0x7c45('0x3'));var moment=require(_0x7c45('0x4'));var BPromise=require(_0x7c45('0x5'));var Mustache=require(_0x7c45('0x6'));var util=require(_0x7c45('0x7'));var path=require(_0x7c45('0x8'));var sox=require(_0x7c45('0x9'));var csv=require('to-csv');var ejs=require(_0x7c45('0xa'));var fs=require('fs');var fs_extra=require(_0x7c45('0xb'));var _=require(_0x7c45('0xc'));var squel=require(_0x7c45('0xd'));var crypto=require(_0x7c45('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7c45('0xf'));var Papa=require(_0x7c45('0x10'));var Redis=require(_0x7c45('0x11'));var authService=require(_0x7c45('0x12'));var qs=require(_0x7c45('0x13'));var as=require(_0x7c45('0x14'));var hardwareService=require(_0x7c45('0x15'));var logger=require(_0x7c45('0x16'))(_0x7c45('0x17'));var utils=require(_0x7c45('0x18'));var config=require(_0x7c45('0x19'));var licenseUtil=require(_0x7c45('0x1a'));var db=require(_0x7c45('0x1b'))['db'];function respondWithStatusCode(_0x2aee27,_0x308a94){_0x308a94=_0x308a94||0xcc;return function(_0x393dc3){if(_0x393dc3){return _0x2aee27['sendStatus'](_0x308a94);}return _0x2aee27['status'](_0x308a94)['end']();};}function respondWithResult(_0x25bdcf,_0x3313d2){_0x3313d2=_0x3313d2||0xc8;return function(_0xe8ceb3){if(_0xe8ceb3){return _0x25bdcf[_0x7c45('0x1c')](_0x3313d2)[_0x7c45('0x1d')](_0xe8ceb3);}};}function respondWithFilteredResult(_0x4814f7,_0x35a015){return function(_0x29bde8){if(_0x29bde8){var _0x445254=typeof _0x35a015[_0x7c45('0x1e')]===_0x7c45('0x1f')&&typeof _0x35a015[_0x7c45('0x20')]===_0x7c45('0x1f');var _0x374096=_0x29bde8[_0x7c45('0x21')];var _0x54c5ce=_0x445254?0x0:_0x35a015['offset'];var _0x3a39f8=_0x445254?_0x29bde8[_0x7c45('0x21')]:_0x35a015[_0x7c45('0x1e')]+_0x35a015[_0x7c45('0x20')];var _0xde9a78;if(_0x3a39f8>=_0x374096){_0x3a39f8=_0x374096;_0xde9a78=0xc8;}else{_0xde9a78=0xce;}_0x4814f7[_0x7c45('0x1c')](_0xde9a78);return _0x4814f7[_0x7c45('0x22')]('Content-Range',_0x54c5ce+'-'+_0x3a39f8+'/'+_0x374096)[_0x7c45('0x1d')](_0x29bde8);}return null;};}function patchUpdates(_0x3970fc){return function(_0x5082c5){try{jsonpatch[_0x7c45('0x23')](_0x5082c5,_0x3970fc,!![]);}catch(_0x2e5a5b){return BPromise[_0x7c45('0x24')](_0x2e5a5b);}return _0x5082c5[_0x7c45('0x25')]();};}function saveUpdates(_0x46ebe4,_0x4c6cf2){return function(_0x5b1219){if(_0x5b1219){return _0x5b1219['update'](_0x46ebe4)[_0x7c45('0x26')](function(_0xd9047c){return _0xd9047c;});}return null;};}function removeEntity(_0x1a09e0,_0x45e5ca){return function(_0x4d4542){if(_0x4d4542){return _0x4d4542[_0x7c45('0x27')]()[_0x7c45('0x26')](function(){_0x1a09e0[_0x7c45('0x1c')](0xcc)[_0x7c45('0x28')]();});}};}function handleEntityNotFound(_0x174b13,_0x5d0146){return function(_0x43d2c7){if(!_0x43d2c7){_0x174b13[_0x7c45('0x29')](0x194);}return _0x43d2c7;};}function handleError(_0xf99b44,_0x11a2ee){_0x11a2ee=_0x11a2ee||0x1f4;return function(_0x449331){logger[_0x7c45('0x2a')](_0x449331[_0x7c45('0x2b')]);if(_0x449331[_0x7c45('0x2c')]){delete _0x449331[_0x7c45('0x2c')];}_0xf99b44['status'](_0x11a2ee)['send'](_0x449331);};}exports['index']=function(_0xbe484c,_0x4daf14){var _0x450c85={},_0x4a98b9={},_0x76bba9={'count':0x0,'rows':[]};var _0x2cf627=_[_0x7c45('0x2d')](db['JscriptyQuestionReport'][_0x7c45('0x2e')],function(_0x19d552){return{'name':_0x19d552['fieldName'],'type':_0x19d552[_0x7c45('0x2f')][_0x7c45('0x30')]};});_0x4a98b9[_0x7c45('0x31')]=_['map'](_0x2cf627,_0x7c45('0x2c'));_0x4a98b9[_0x7c45('0x32')]=_[_0x7c45('0x33')](_0xbe484c[_0x7c45('0x32')]);_0x4a98b9[_0x7c45('0x34')]=_['intersection'](_0x4a98b9[_0x7c45('0x31')],_0x4a98b9[_0x7c45('0x32')]);_0x450c85[_0x7c45('0x35')]=_['intersection'](_0x4a98b9[_0x7c45('0x31')],qs[_0x7c45('0x36')](_0xbe484c['query'][_0x7c45('0x36')]));_0x450c85['attributes']=_0x450c85['attributes'][_0x7c45('0x37')]?_0x450c85[_0x7c45('0x35')]:_0x4a98b9[_0x7c45('0x31')];if(!_0xbe484c['query'][_0x7c45('0x38')](_0x7c45('0x39'))){_0x450c85['limit']=qs[_0x7c45('0x20')](_0xbe484c[_0x7c45('0x32')][_0x7c45('0x20')]);_0x450c85[_0x7c45('0x1e')]=qs['offset'](_0xbe484c[_0x7c45('0x32')]['offset']);}_0x450c85['order']=qs[_0x7c45('0x3a')](_0xbe484c[_0x7c45('0x32')][_0x7c45('0x3a')]);_0x450c85[_0x7c45('0x3b')]=qs[_0x7c45('0x34')](_['pick'](_0xbe484c[_0x7c45('0x32')],_0x4a98b9['filters']),_0x2cf627);if(_0xbe484c[_0x7c45('0x32')][_0x7c45('0x3c')]){_0x450c85[_0x7c45('0x3b')]=_['merge'](_0x450c85['where'],{'$or':_[_0x7c45('0x2d')](_0x2cf627,function(_0x4317cb){if(_0x4317cb[_0x7c45('0x2f')]!==_0x7c45('0x3d')){var _0x306e0a={};_0x306e0a[_0x4317cb[_0x7c45('0x2c')]]={'$like':'%'+_0xbe484c[_0x7c45('0x32')]['filter']+'%'};return _0x306e0a;}})});}_0x450c85=_[_0x7c45('0x3e')]({},_0x450c85,_0xbe484c['options']);var _0x58dd83={'where':_0x450c85[_0x7c45('0x3b')]};return db[_0x7c45('0x3f')]['count'](_0x58dd83)[_0x7c45('0x26')](function(_0x43224a){_0x76bba9['count']=_0x43224a;if(_0xbe484c[_0x7c45('0x32')][_0x7c45('0x40')]){_0x450c85[_0x7c45('0x41')]=[{'all':!![]}];}return db[_0x7c45('0x3f')]['findAll'](_0x450c85);})[_0x7c45('0x26')](function(_0x4b340c){_0x76bba9[_0x7c45('0x42')]=_0x4b340c;return _0x76bba9;})[_0x7c45('0x26')](respondWithFilteredResult(_0x4daf14,_0x450c85))[_0x7c45('0x43')](handleError(_0x4daf14,null));};exports[_0x7c45('0x44')]=function(_0x566ace,_0x495ce1){var _0x36714a={'raw':!![],'where':{'id':_0x566ace[_0x7c45('0x45')]['id']}},_0x3dea36={};_0x3dea36[_0x7c45('0x31')]=_[_0x7c45('0x33')](db[_0x7c45('0x3f')]['rawAttributes']);_0x3dea36[_0x7c45('0x32')]=_[_0x7c45('0x33')](_0x566ace['query']);_0x3dea36[_0x7c45('0x34')]=_[_0x7c45('0x46')](_0x3dea36[_0x7c45('0x31')],_0x3dea36[_0x7c45('0x32')]);_0x36714a[_0x7c45('0x35')]=_['intersection'](_0x3dea36[_0x7c45('0x31')],qs[_0x7c45('0x36')](_0x566ace['query'][_0x7c45('0x36')]));_0x36714a['attributes']=_0x36714a[_0x7c45('0x35')][_0x7c45('0x37')]?_0x36714a[_0x7c45('0x35')]:_0x3dea36[_0x7c45('0x31')];if(_0x566ace['query']['includeAll']){_0x36714a[_0x7c45('0x41')]=[{'all':!![]}];}_0x36714a=_['merge']({},_0x36714a,_0x566ace[_0x7c45('0x47')]);return db[_0x7c45('0x3f')][_0x7c45('0x48')](_0x36714a)[_0x7c45('0x26')](handleEntityNotFound(_0x495ce1,null))['then'](respondWithResult(_0x495ce1,null))[_0x7c45('0x43')](handleError(_0x495ce1,null));};exports[_0x7c45('0x49')]=function(_0x15e9ff,_0x257dab){return db[_0x7c45('0x3f')]['create'](_0x15e9ff[_0x7c45('0x4a')],{})['then'](respondWithResult(_0x257dab,0xc9))[_0x7c45('0x43')](handleError(_0x257dab,null));};exports['update']=function(_0x179200,_0x59ff92){if(_0x179200[_0x7c45('0x4a')]['id']){delete _0x179200[_0x7c45('0x4a')]['id'];}return db[_0x7c45('0x3f')][_0x7c45('0x48')]({'where':{'id':_0x179200[_0x7c45('0x45')]['id']}})[_0x7c45('0x26')](handleEntityNotFound(_0x59ff92,null))[_0x7c45('0x26')](saveUpdates(_0x179200['body'],null))[_0x7c45('0x26')](respondWithResult(_0x59ff92,null))['catch'](handleError(_0x59ff92,null));};exports[_0x7c45('0x27')]=function(_0x13f296,_0x58ad90){return db['JscriptyQuestionReport'][_0x7c45('0x48')]({'where':{'id':_0x13f296[_0x7c45('0x45')]['id']}})[_0x7c45('0x26')](handleEntityNotFound(_0x58ad90,null))[_0x7c45('0x26')](removeEntity(_0x58ad90,null))[_0x7c45('0x43')](handleError(_0x58ad90,null));};exports[_0x7c45('0x4b')]=function(_0x559e5d,_0x59d5c6){return db['JscriptyQuestionReport']['describe']()[_0x7c45('0x26')](respondWithResult(_0x59d5c6,null))[_0x7c45('0x43')](handleError(_0x59d5c6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 629c4d5..852d0e6 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 _0x50bf=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','moment','path','./jscriptyQuestionReport.attributes'];(function(_0x316aa0,_0x1b2366){var _0x58f76b=function(_0x4a7270){while(--_0x4a7270){_0x316aa0['push'](_0x316aa0['shift']());}};_0x58f76b(++_0x1b2366);}(_0x50bf,0xe5));var _0xf50b=function(_0x58e8c9,_0x158e0e){_0x58e8c9=_0x58e8c9-0x0;var _0x5d905a=_0x50bf[_0x58e8c9];return _0x5d905a;};'use strict';var _=require(_0xf50b('0x0'));var util=require('util');var logger=require(_0xf50b('0x1'))('api');var moment=require(_0xf50b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf50b('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf50b('0x4'));module[_0xf50b('0x5')]=function(_0x8b15c6,_0x3fd70d){return _0x8b15c6[_0xf50b('0x6')](_0xf50b('0x7'),attributes,{'tableName':_0xf50b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde64=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','path','./jscriptyQuestionReport.attributes'];(function(_0x89b9ae,_0x1bf879){var _0x2ca3ed=function(_0x146104){while(--_0x146104){_0x89b9ae['push'](_0x89b9ae['shift']());}};_0x2ca3ed(++_0x1bf879);}(_0xde64,0x192));var _0x4de6=function(_0x5b9f0d,_0x9aac59){_0x5b9f0d=_0x5b9f0d-0x0;var _0x847ae8=_0xde64[_0x5b9f0d];return _0x847ae8;};'use strict';var _=require(_0x4de6('0x0'));var util=require(_0x4de6('0x1'));var logger=require(_0x4de6('0x2'))(_0x4de6('0x3'));var moment=require(_0x4de6('0x4'));var BPromise=require(_0x4de6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4de6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4de6('0x7'));module[_0x4de6('0x8')]=function(_0x2991db,_0x3bde0f){return _0x2991db[_0x4de6('0x9')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index be5be0a..e0fd63a 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 _0xf1c5=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x5626da,_0x163f7f){var _0x448fd7=function(_0x2c5956){while(--_0x2c5956){_0x5626da['push'](_0x5626da['shift']());}};_0x448fd7(++_0x163f7f);}(_0xf1c5,0x10a));var _0x5f1c=function(_0x18b447,_0x5d0ed9){_0x18b447=_0x18b447-0x0;var _0x132815=_0xf1c5[_0x18b447];return _0x132815;};'use strict';var _=require(_0x5f1c('0x0'));var util=require(_0x5f1c('0x1'));var moment=require(_0x5f1c('0x2'));var BPromise=require(_0x5f1c('0x3'));var rs=require(_0x5f1c('0x4'));var fs=require('fs');var Redis=require(_0x5f1c('0x5'));var db=require(_0x5f1c('0x6'))['db'];var utils=require(_0x5f1c('0x7'));var logger=require('../../config/logger')(_0x5f1c('0x8'));var config=require('../../config/environment');var jayson=require(_0x5f1c('0x9'));var client=jayson[_0x5f1c('0xa')][_0x5f1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc71279,_0x11293d,_0x16ec58){return new BPromise(function(_0x3275e6,_0x409488){return client['request'](_0xc71279,_0x16ec58)[_0x5f1c('0xc')](function(_0x4cf70a){logger[_0x5f1c('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x11293d,'request\x20sent');logger[_0x5f1c('0xe')](_0x5f1c('0xf'),_0x11293d,_0x5f1c('0x10'),JSON['stringify'](_0x4cf70a));if(_0x4cf70a[_0x5f1c('0x11')]){if(_0x4cf70a[_0x5f1c('0x11')][_0x5f1c('0x12')]===0x1f4){logger[_0x5f1c('0x11')](_0x5f1c('0x13'),_0x11293d,_0x4cf70a[_0x5f1c('0x11')][_0x5f1c('0x14')]);return _0x409488(_0x4cf70a[_0x5f1c('0x11')]['message']);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x11293d,_0x4cf70a[_0x5f1c('0x11')][_0x5f1c('0x14')]);return _0x3275e6(_0x4cf70a[_0x5f1c('0x11')][_0x5f1c('0x14')]);}else{logger[_0x5f1c('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x11293d,_0x5f1c('0x10'));_0x3275e6(_0x4cf70a[_0x5f1c('0x15')][_0x5f1c('0x14')]);}})['catch'](function(_0x47869e){logger[_0x5f1c('0x11')](_0x5f1c('0x13'),_0x11293d,_0x47869e);_0x409488(_0x47869e);});});} \ No newline at end of file +var _0x4b1b=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4b1b,0xd8));var _0xb4b1=function(_0x640cc5,_0x3535e7){_0x640cc5=_0x640cc5-0x0;var _0x3eede9=_0x4b1b[_0x640cc5];return _0x3eede9;};'use strict';var _=require(_0xb4b1('0x0'));var util=require(_0xb4b1('0x1'));var moment=require(_0xb4b1('0x2'));var BPromise=require(_0xb4b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb4b1('0x5'));var logger=require(_0xb4b1('0x6'))(_0xb4b1('0x7'));var config=require(_0xb4b1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb4b1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe84dc8,_0x2ccbc1,_0x1e0a90){return new BPromise(function(_0x16598c,_0x5234d1){return client[_0xb4b1('0xa')](_0xe84dc8,_0x1e0a90)['then'](function(_0x8d66cf){logger[_0xb4b1('0xb')](_0xb4b1('0xc'),_0x2ccbc1,_0xb4b1('0xd'));logger[_0xb4b1('0xe')](_0xb4b1('0xf'),_0x2ccbc1,_0xb4b1('0xd'),JSON['stringify'](_0x8d66cf));if(_0x8d66cf[_0xb4b1('0x10')]){if(_0x8d66cf['error'][_0xb4b1('0x11')]===0x1f4){logger[_0xb4b1('0x10')](_0xb4b1('0xc'),_0x2ccbc1,_0x8d66cf[_0xb4b1('0x10')]['message']);return _0x5234d1(_0x8d66cf['error'][_0xb4b1('0x12')]);}logger[_0xb4b1('0x10')](_0xb4b1('0xc'),_0x2ccbc1,_0x8d66cf['error'][_0xb4b1('0x12')]);return _0x16598c(_0x8d66cf[_0xb4b1('0x10')][_0xb4b1('0x12')]);}else{logger['info'](_0xb4b1('0xc'),_0x2ccbc1,_0xb4b1('0xd'));_0x16598c(_0x8d66cf[_0xb4b1('0x13')][_0xb4b1('0x12')]);}})[_0xb4b1('0x14')](function(_0x283700){logger[_0xb4b1('0x10')](_0xb4b1('0xc'),_0x2ccbc1,_0x283700);_0x5234d1(_0x283700);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index b085f91..575a5ac 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 _0xcdb5=['get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','./jscriptySessionReport.controller'];(function(_0x141fe1,_0x2b7d8f){var _0x4df046=function(_0xf14552){while(--_0xf14552){_0x141fe1['push'](_0x141fe1['shift']());}};_0x4df046(++_0x2b7d8f);}(_0xcdb5,0x173));var _0x5cdb=function(_0x34e5ef,_0x2df43f){_0x34e5ef=_0x34e5ef-0x0;var _0xa28403=_0xcdb5[_0x34e5ef];return _0xa28403;};'use strict';var multer=require(_0x5cdb('0x0'));var util=require(_0x5cdb('0x1'));var path=require(_0x5cdb('0x2'));var timeout=require('connect-timeout');var express=require(_0x5cdb('0x3'));var router=express['Router']();var fs_extra=require(_0x5cdb('0x4'));var auth=require(_0x5cdb('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5cdb('0x6'));router[_0x5cdb('0x7')]('/',auth[_0x5cdb('0x8')](),controller[_0x5cdb('0x9')]);router[_0x5cdb('0x7')]('/describe',auth[_0x5cdb('0x8')](),controller[_0x5cdb('0xa')]);router[_0x5cdb('0x7')](_0x5cdb('0xb'),auth[_0x5cdb('0x8')](),controller[_0x5cdb('0xc')]);router[_0x5cdb('0x7')](_0x5cdb('0xd'),auth[_0x5cdb('0x8')](),controller[_0x5cdb('0xe')]);router[_0x5cdb('0xf')]('/',auth['isAuthenticated'](),controller[_0x5cdb('0x10')]);router[_0x5cdb('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x5cdb('0x12')]);router[_0x5cdb('0x13')]('/:id',auth[_0x5cdb('0x8')](),controller['destroy']);module[_0x5cdb('0x14')]=router; \ No newline at end of file +var _0x1ac8=['index','/describe','describe','/:id','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated'];(function(_0x4cbca6,_0x49ee64){var _0x2ef994=function(_0x125609){while(--_0x125609){_0x4cbca6['push'](_0x4cbca6['shift']());}};_0x2ef994(++_0x49ee64);}(_0x1ac8,0xa3));var _0x81ac=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1ac8[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x81ac('0x0'));var util=require(_0x81ac('0x1'));var path=require(_0x81ac('0x2'));var timeout=require('connect-timeout');var express=require(_0x81ac('0x3'));var router=express[_0x81ac('0x4')]();var fs_extra=require(_0x81ac('0x5'));var auth=require(_0x81ac('0x6'));var interaction=require(_0x81ac('0x7'));var config=require(_0x81ac('0x8'));var controller=require(_0x81ac('0x9'));router[_0x81ac('0xa')]('/',auth[_0x81ac('0xb')](),controller[_0x81ac('0xc')]);router[_0x81ac('0xa')](_0x81ac('0xd'),auth[_0x81ac('0xb')](),controller[_0x81ac('0xe')]);router[_0x81ac('0xa')](_0x81ac('0xf'),auth['isAuthenticated'](),controller['show']);router['get'](_0x81ac('0x10'),auth[_0x81ac('0xb')](),controller[_0x81ac('0x11')]);router[_0x81ac('0x12')]('/',auth[_0x81ac('0xb')](),controller[_0x81ac('0x13')]);router[_0x81ac('0x14')](_0x81ac('0xf'),auth[_0x81ac('0xb')](),controller[_0x81ac('0x15')]);router[_0x81ac('0x16')](_0x81ac('0xf'),auth[_0x81ac('0xb')](),controller[_0x81ac('0x17')]);module[_0x81ac('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 9906dc2..3fcf9b7 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 _0xc586=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc586,0x1b0));var _0x6c58=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc586[_0x1928c9];return _0x51b5fb;};'use strict';var moment=require(_0x6c58('0x0'));var Sequelize=require(_0x6c58('0x1'));module[_0x6c58('0x2')]={'starttime':{'type':Sequelize[_0x6c58('0x3')],'set':function(_0x2978e5){this[_0x6c58('0x4')](_0x6c58('0x5'),_0x2978e5);this['setDataValue'](_0x6c58('0x6'),moment()['format'](_0x6c58('0x7')));}},'endtime':{'type':Sequelize[_0x6c58('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x6c58('0x8')]},'uniqueid':{'type':Sequelize[_0x6c58('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x6c58('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x0348=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','DATE','starttime','setDataValue','endtime','format'];(function(_0x2f8bc6,_0x4dc869){var _0x2d008a=function(_0x276072){while(--_0x276072){_0x2f8bc6['push'](_0x2f8bc6['shift']());}};_0x2d008a(++_0x4dc869);}(_0x0348,0x1e9));var _0x8034=function(_0x49a982,_0x129a07){_0x49a982=_0x49a982-0x0;var _0x2a0bc9=_0x0348[_0x49a982];return _0x2a0bc9;};'use strict';var moment=require('moment');var Sequelize=require(_0x8034('0x0'));module['exports']={'starttime':{'type':Sequelize[_0x8034('0x1')],'set':function(_0x3a60bd){this['setDataValue'](_0x8034('0x2'),_0x3a60bd);this[_0x8034('0x3')](_0x8034('0x4'),moment()[_0x8034('0x5')](_0x8034('0x6')));}},'endtime':{'type':Sequelize[_0x8034('0x1')]},'membername':{'type':Sequelize[_0x8034('0x7')]},'projectname':{'type':Sequelize[_0x8034('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8034('0x7')]},'calleridname':{'type':Sequelize[_0x8034('0x7')]},'calleridnum':{'type':Sequelize[_0x8034('0x7')]},'completed':{'type':Sequelize[_0x8034('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 02097db..d16974d 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 _0xfe7e=['squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','JscriptySessionReport','count','includeAll','include','findAll','rows','show','options','find','create','body','params','catch','describe','getQuestions','JscriptyQuestionReport','order','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0xfe7e,0x96));var _0xefe7=function(_0x7b6010,_0xecd819){_0x7b6010=_0x7b6010-0x0;var _0x253940=_0xfe7e[_0x7b6010];return _0x253940;};'use strict';var emlformat=require(_0xefe7('0x0'));var rimraf=require(_0xefe7('0x1'));var zipdir=require(_0xefe7('0x2'));var jsonpatch=require(_0xefe7('0x3'));var rp=require('request-promise');var moment=require(_0xefe7('0x4'));var BPromise=require(_0xefe7('0x5'));var Mustache=require(_0xefe7('0x6'));var util=require(_0xefe7('0x7'));var path=require(_0xefe7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xefe7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xefe7('0xa'));var crypto=require('crypto');var jsforce=require(_0xefe7('0xb'));var deskjs=require(_0xefe7('0xc'));var toCsv=require(_0xefe7('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xefe7('0xe'));var authService=require(_0xefe7('0xf'));var qs=require(_0xefe7('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefe7('0x11'));var logger=require(_0xefe7('0x12'))(_0xefe7('0x13'));var utils=require(_0xefe7('0x14'));var config=require(_0xefe7('0x15'));var licenseUtil=require(_0xefe7('0x16'));var db=require(_0xefe7('0x17'))['db'];function respondWithStatusCode(_0x3b7a1a,_0x464d47){_0x464d47=_0x464d47||0xcc;return function(_0x1122f1){if(_0x1122f1){return _0x3b7a1a['sendStatus'](_0x464d47);}return _0x3b7a1a[_0xefe7('0x18')](_0x464d47)[_0xefe7('0x19')]();};}function respondWithResult(_0x2811ca,_0x5d716b){_0x5d716b=_0x5d716b||0xc8;return function(_0x4139da){if(_0x4139da){return _0x2811ca[_0xefe7('0x18')](_0x5d716b)[_0xefe7('0x1a')](_0x4139da);}};}function respondWithFilteredResult(_0x5da530,_0x37808b){return function(_0x4dd86d){if(_0x4dd86d){var _0x759cbe=typeof _0x37808b[_0xefe7('0x1b')]==='undefined'&&typeof _0x37808b['limit']==='undefined';var _0x41f77c=_0x4dd86d['count'];var _0x15ee5c=_0x759cbe?0x0:_0x37808b[_0xefe7('0x1b')];var _0x4c0610=_0x759cbe?_0x4dd86d['count']:_0x37808b[_0xefe7('0x1b')]+_0x37808b[_0xefe7('0x1c')];var _0x499ee5;if(_0x4c0610>=_0x41f77c){_0x4c0610=_0x41f77c;_0x499ee5=0xc8;}else{_0x499ee5=0xce;}_0x5da530['status'](_0x499ee5);return _0x5da530[_0xefe7('0x1d')]('Content-Range',_0x15ee5c+'-'+_0x4c0610+'/'+_0x41f77c)[_0xefe7('0x1a')](_0x4dd86d);}return null;};}function patchUpdates(_0x3a0c85){return function(_0x4d0ef7){try{jsonpatch[_0xefe7('0x1e')](_0x4d0ef7,_0x3a0c85,!![]);}catch(_0x16622e){return BPromise['reject'](_0x16622e);}return _0x4d0ef7[_0xefe7('0x1f')]();};}function saveUpdates(_0x4fb652,_0x537ab1){return function(_0x5b3dc0){if(_0x5b3dc0){return _0x5b3dc0[_0xefe7('0x20')](_0x4fb652)['then'](function(_0x5c78c5){return _0x5c78c5;});}return null;};}function removeEntity(_0x183cc2,_0x38407b){return function(_0x4e82d1){if(_0x4e82d1){return _0x4e82d1[_0xefe7('0x21')]()[_0xefe7('0x22')](function(){_0x183cc2['status'](0xcc)[_0xefe7('0x19')]();});}};}function handleEntityNotFound(_0x52d8aa,_0x1a788c){return function(_0x4724cd){if(!_0x4724cd){_0x52d8aa[_0xefe7('0x23')](0x194);}return _0x4724cd;};}function handleError(_0x57650f,_0x47109d){_0x47109d=_0x47109d||0x1f4;return function(_0x4433b8){logger[_0xefe7('0x24')](_0x4433b8[_0xefe7('0x25')]);if(_0x4433b8['name']){delete _0x4433b8[_0xefe7('0x26')];}_0x57650f[_0xefe7('0x18')](_0x47109d)[_0xefe7('0x27')](_0x4433b8);};}exports[_0xefe7('0x28')]=function(_0x3eff0c,_0x4187d7){var _0x281816={},_0x268aa0={},_0x19b890={'count':0x0,'rows':[]};var _0x1f74f3=_[_0xefe7('0x29')](db['JscriptySessionReport'][_0xefe7('0x2a')],function(_0xe7b542){return{'name':_0xe7b542[_0xefe7('0x2b')],'type':_0xe7b542['type'][_0xefe7('0x2c')]};});_0x268aa0[_0xefe7('0x2d')]=_['map'](_0x1f74f3,_0xefe7('0x26'));_0x268aa0[_0xefe7('0x2e')]=_[_0xefe7('0x2f')](_0x3eff0c[_0xefe7('0x2e')]);_0x268aa0[_0xefe7('0x30')]=_[_0xefe7('0x31')](_0x268aa0[_0xefe7('0x2d')],_0x268aa0[_0xefe7('0x2e')]);_0x281816[_0xefe7('0x32')]=_['intersection'](_0x268aa0[_0xefe7('0x2d')],qs['fields'](_0x3eff0c[_0xefe7('0x2e')][_0xefe7('0x33')]));_0x281816['attributes']=_0x281816[_0xefe7('0x32')][_0xefe7('0x34')]?_0x281816[_0xefe7('0x32')]:_0x268aa0[_0xefe7('0x2d')];if(!_0x3eff0c[_0xefe7('0x2e')][_0xefe7('0x35')](_0xefe7('0x36'))){_0x281816['limit']=qs[_0xefe7('0x1c')](_0x3eff0c[_0xefe7('0x2e')][_0xefe7('0x1c')]);_0x281816[_0xefe7('0x1b')]=qs[_0xefe7('0x1b')](_0x3eff0c[_0xefe7('0x2e')]['offset']);}_0x281816['order']=qs['sort'](_0x3eff0c[_0xefe7('0x2e')][_0xefe7('0x37')]);_0x281816[_0xefe7('0x38')]=qs[_0xefe7('0x30')](_[_0xefe7('0x39')](_0x3eff0c['query'],_0x268aa0['filters']),_0x1f74f3);if(_0x3eff0c[_0xefe7('0x2e')]['filter']){_0x281816['where']=_[_0xefe7('0x3a')](_0x281816[_0xefe7('0x38')],{'$or':_['map'](_0x1f74f3,function(_0x315e3d){if(_0x315e3d[_0xefe7('0x3b')]!==_0xefe7('0x3c')){var _0x31a665={};_0x31a665[_0x315e3d[_0xefe7('0x26')]]={'$like':'%'+_0x3eff0c[_0xefe7('0x2e')][_0xefe7('0x3d')]+'%'};return _0x31a665;}})});}_0x281816=_[_0xefe7('0x3a')]({},_0x281816,_0x3eff0c['options']);var _0x1ab8d7={'where':_0x281816[_0xefe7('0x38')]};return db[_0xefe7('0x3e')][_0xefe7('0x3f')](_0x1ab8d7)['then'](function(_0x43f094){_0x19b890[_0xefe7('0x3f')]=_0x43f094;if(_0x3eff0c[_0xefe7('0x2e')][_0xefe7('0x40')]){_0x281816[_0xefe7('0x41')]=[{'all':!![]}];}return db[_0xefe7('0x3e')][_0xefe7('0x42')](_0x281816);})[_0xefe7('0x22')](function(_0x567861){_0x19b890[_0xefe7('0x43')]=_0x567861;return _0x19b890;})[_0xefe7('0x22')](respondWithFilteredResult(_0x4187d7,_0x281816))['catch'](handleError(_0x4187d7,null));};exports[_0xefe7('0x44')]=function(_0x47b832,_0x152e3a){var _0x5b6256={'raw':!![],'where':{'id':_0x47b832['params']['id']}},_0x1bc02c={};_0x1bc02c['model']=_[_0xefe7('0x2f')](db['JscriptySessionReport']['rawAttributes']);_0x1bc02c[_0xefe7('0x2e')]=_[_0xefe7('0x2f')](_0x47b832['query']);_0x1bc02c['filters']=_[_0xefe7('0x31')](_0x1bc02c[_0xefe7('0x2d')],_0x1bc02c[_0xefe7('0x2e')]);_0x5b6256[_0xefe7('0x32')]=_[_0xefe7('0x31')](_0x1bc02c[_0xefe7('0x2d')],qs[_0xefe7('0x33')](_0x47b832[_0xefe7('0x2e')][_0xefe7('0x33')]));_0x5b6256['attributes']=_0x5b6256[_0xefe7('0x32')]['length']?_0x5b6256[_0xefe7('0x32')]:_0x1bc02c[_0xefe7('0x2d')];if(_0x47b832[_0xefe7('0x2e')]['includeAll']){_0x5b6256[_0xefe7('0x41')]=[{'all':!![]}];}_0x5b6256=_[_0xefe7('0x3a')]({},_0x5b6256,_0x47b832[_0xefe7('0x45')]);return db[_0xefe7('0x3e')][_0xefe7('0x46')](_0x5b6256)[_0xefe7('0x22')](handleEntityNotFound(_0x152e3a,null))['then'](respondWithResult(_0x152e3a,null))['catch'](handleError(_0x152e3a,null));};exports[_0xefe7('0x47')]=function(_0x252cee,_0x21c9f1){return db[_0xefe7('0x3e')][_0xefe7('0x47')](_0x252cee[_0xefe7('0x48')],{})[_0xefe7('0x22')](respondWithResult(_0x21c9f1,0xc9))['catch'](handleError(_0x21c9f1,null));};exports[_0xefe7('0x20')]=function(_0x339efb,_0x44f92c){if(_0x339efb[_0xefe7('0x48')]['id']){delete _0x339efb['body']['id'];}return db[_0xefe7('0x3e')][_0xefe7('0x46')]({'where':{'id':_0x339efb[_0xefe7('0x49')]['id']}})[_0xefe7('0x22')](handleEntityNotFound(_0x44f92c,null))['then'](saveUpdates(_0x339efb[_0xefe7('0x48')],null))['then'](respondWithResult(_0x44f92c,null))[_0xefe7('0x4a')](handleError(_0x44f92c,null));};exports[_0xefe7('0x21')]=function(_0x5d6dad,_0x29dec6){return db[_0xefe7('0x3e')][_0xefe7('0x46')]({'where':{'id':_0x5d6dad[_0xefe7('0x49')]['id']}})[_0xefe7('0x22')](handleEntityNotFound(_0x29dec6,null))[_0xefe7('0x22')](removeEntity(_0x29dec6,null))[_0xefe7('0x4a')](handleError(_0x29dec6,null));};exports[_0xefe7('0x4b')]=function(_0x42bd3b,_0x22b3fd){return db[_0xefe7('0x3e')][_0xefe7('0x4b')]()['then'](respondWithResult(_0x22b3fd,null))['catch'](handleError(_0x22b3fd,null));};exports[_0xefe7('0x4c')]=function(_0x10a342,_0x4125ee,_0x212c6c){var _0x59a856={'raw':!![],'where':{}};var _0x45b94a={};var _0x2b11aa={'count':0x0,'rows':[]};return db[_0xefe7('0x3e')]['findOne']({'where':{'id':_0x10a342[_0xefe7('0x49')]['id']}})[_0xefe7('0x22')](handleEntityNotFound(_0x4125ee,null))[_0xefe7('0x22')](function(_0x5c4c38){if(_0x5c4c38){_0x45b94a[_0xefe7('0x2d')]=_['keys'](db[_0xefe7('0x4d')][_0xefe7('0x2a')]);_0x45b94a[_0xefe7('0x2e')]=_[_0xefe7('0x2f')](_0x10a342[_0xefe7('0x2e')]);_0x45b94a[_0xefe7('0x30')]=_[_0xefe7('0x31')](_0x45b94a['model'],_0x45b94a[_0xefe7('0x2e')]);_0x59a856[_0xefe7('0x32')]=_[_0xefe7('0x31')](_0x45b94a['model'],qs[_0xefe7('0x33')](_0x10a342['query']['fields']));_0x59a856[_0xefe7('0x32')]=_0x59a856[_0xefe7('0x32')][_0xefe7('0x34')]?_0x59a856['attributes']:_0x45b94a['model'];if(!_0x10a342[_0xefe7('0x2e')][_0xefe7('0x35')](_0xefe7('0x36'))){_0x59a856[_0xefe7('0x1c')]=qs[_0xefe7('0x1c')](_0x10a342[_0xefe7('0x2e')][_0xefe7('0x1c')]);_0x59a856['offset']=qs[_0xefe7('0x1b')](_0x10a342[_0xefe7('0x2e')]['offset']);}_0x59a856[_0xefe7('0x4e')]=qs[_0xefe7('0x37')](_0x10a342[_0xefe7('0x2e')][_0xefe7('0x37')]);_0x59a856[_0xefe7('0x38')]=qs[_0xefe7('0x30')](_[_0xefe7('0x39')](_0x10a342['query'],_0x45b94a[_0xefe7('0x30')]));_0x59a856[_0xefe7('0x38')][_0xefe7('0x4f')]=_0x5c4c38['id'];if(_0x10a342[_0xefe7('0x2e')][_0xefe7('0x3d')]){_0x59a856[_0xefe7('0x38')]=_[_0xefe7('0x3a')](_0x59a856[_0xefe7('0x38')],{'$or':_[_0xefe7('0x29')](_0x59a856[_0xefe7('0x32')],function(_0x3e92f2){var _0x9a4f92={};_0x9a4f92[_0x3e92f2]={'$like':'%'+_0x10a342[_0xefe7('0x2e')][_0xefe7('0x3d')]+'%'};return _0x9a4f92;})});}_0x59a856=_[_0xefe7('0x3a')]({},_0x59a856,_0x10a342[_0xefe7('0x45')]);return db['JscriptyQuestionReport'][_0xefe7('0x3f')]({'where':_0x59a856['where']})[_0xefe7('0x22')](function(_0x5607f0){_0x2b11aa['count']=_0x5607f0;if(_0x10a342[_0xefe7('0x2e')]['includeAll']){_0x59a856[_0xefe7('0x41')]=[{'all':!![]}];}return db[_0xefe7('0x4d')][_0xefe7('0x42')](_0x59a856);})[_0xefe7('0x22')](function(_0x2b7d3c){_0x2b11aa[_0xefe7('0x43')]=_0x2b7d3c;return _0x2b11aa;});}})['then'](respondWithFilteredResult(_0x4125ee,_0x59a856))['catch'](handleError(_0x4125ee,null));}; \ No newline at end of file +var _0x6bca=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','show','catch','create','body','find','params','destroy','describe','findOne','JscriptyQuestionReport','pick','SessionId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto'];(function(_0x36c493,_0x58dc21){var _0x445d9f=function(_0x59e01b){while(--_0x59e01b){_0x36c493['push'](_0x36c493['shift']());}};_0x445d9f(++_0x58dc21);}(_0x6bca,0x1da));var _0xa6bc=function(_0x27e52a,_0x45ac63){_0x27e52a=_0x27e52a-0x0;var _0x3f1c9c=_0x6bca[_0x27e52a];return _0x3f1c9c;};'use strict';var emlformat=require(_0xa6bc('0x0'));var rimraf=require(_0xa6bc('0x1'));var zipdir=require(_0xa6bc('0x2'));var jsonpatch=require(_0xa6bc('0x3'));var rp=require('request-promise');var moment=require(_0xa6bc('0x4'));var BPromise=require(_0xa6bc('0x5'));var Mustache=require('mustache');var util=require(_0xa6bc('0x6'));var path=require('path');var sox=require(_0xa6bc('0x7'));var csv=require(_0xa6bc('0x8'));var ejs=require(_0xa6bc('0x9'));var fs=require('fs');var fs_extra=require(_0xa6bc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa6bc('0xb'));var jsforce=require(_0xa6bc('0xc'));var deskjs=require(_0xa6bc('0xd'));var toCsv=require(_0xa6bc('0x8'));var querystring=require(_0xa6bc('0xe'));var Papa=require(_0xa6bc('0xf'));var Redis=require(_0xa6bc('0x10'));var authService=require(_0xa6bc('0x11'));var qs=require(_0xa6bc('0x12'));var as=require(_0xa6bc('0x13'));var hardwareService=require(_0xa6bc('0x14'));var logger=require(_0xa6bc('0x15'))(_0xa6bc('0x16'));var utils=require('../../config/utils');var config=require(_0xa6bc('0x17'));var licenseUtil=require(_0xa6bc('0x18'));var db=require(_0xa6bc('0x19'))['db'];function respondWithStatusCode(_0x35e346,_0xc15676){_0xc15676=_0xc15676||0xcc;return function(_0x4e0052){if(_0x4e0052){return _0x35e346[_0xa6bc('0x1a')](_0xc15676);}return _0x35e346['status'](_0xc15676)[_0xa6bc('0x1b')]();};}function respondWithResult(_0x425553,_0x8429b1){_0x8429b1=_0x8429b1||0xc8;return function(_0x37f25b){if(_0x37f25b){return _0x425553[_0xa6bc('0x1c')](_0x8429b1)[_0xa6bc('0x1d')](_0x37f25b);}};}function respondWithFilteredResult(_0xad9a80,_0xc65bd1){return function(_0x4011c7){if(_0x4011c7){var _0x20cffa=typeof _0xc65bd1[_0xa6bc('0x1e')]===_0xa6bc('0x1f')&&typeof _0xc65bd1[_0xa6bc('0x20')]===_0xa6bc('0x1f');var _0x4209b9=_0x4011c7[_0xa6bc('0x21')];var _0x5380f1=_0x20cffa?0x0:_0xc65bd1[_0xa6bc('0x1e')];var _0xec8d79=_0x20cffa?_0x4011c7[_0xa6bc('0x21')]:_0xc65bd1[_0xa6bc('0x1e')]+_0xc65bd1[_0xa6bc('0x20')];var _0x1880ea;if(_0xec8d79>=_0x4209b9){_0xec8d79=_0x4209b9;_0x1880ea=0xc8;}else{_0x1880ea=0xce;}_0xad9a80[_0xa6bc('0x1c')](_0x1880ea);return _0xad9a80[_0xa6bc('0x22')](_0xa6bc('0x23'),_0x5380f1+'-'+_0xec8d79+'/'+_0x4209b9)[_0xa6bc('0x1d')](_0x4011c7);}return null;};}function patchUpdates(_0x4051b1){return function(_0x32b797){try{jsonpatch[_0xa6bc('0x24')](_0x32b797,_0x4051b1,!![]);}catch(_0x3302de){return BPromise[_0xa6bc('0x25')](_0x3302de);}return _0x32b797['save']();};}function saveUpdates(_0x64b52d,_0x1c52de){return function(_0xd3f4ff){if(_0xd3f4ff){return _0xd3f4ff[_0xa6bc('0x26')](_0x64b52d)[_0xa6bc('0x27')](function(_0x17ed92){return _0x17ed92;});}return null;};}function removeEntity(_0x2d2402,_0x58bf56){return function(_0x10ff0b){if(_0x10ff0b){return _0x10ff0b['destroy']()[_0xa6bc('0x27')](function(){_0x2d2402[_0xa6bc('0x1c')](0xcc)[_0xa6bc('0x1b')]();});}};}function handleEntityNotFound(_0x49c6e9,_0x2f2c86){return function(_0x13fa80){if(!_0x13fa80){_0x49c6e9[_0xa6bc('0x1a')](0x194);}return _0x13fa80;};}function handleError(_0x347272,_0x3e036f){_0x3e036f=_0x3e036f||0x1f4;return function(_0x1e2124){logger[_0xa6bc('0x28')](_0x1e2124[_0xa6bc('0x29')]);if(_0x1e2124[_0xa6bc('0x2a')]){delete _0x1e2124['name'];}_0x347272[_0xa6bc('0x1c')](_0x3e036f)[_0xa6bc('0x2b')](_0x1e2124);};}exports['index']=function(_0x5821bc,_0x4b4e1a){var _0x57ff1e={},_0x59f6d5={},_0x18628e={'count':0x0,'rows':[]};var _0x5b8ecc=_[_0xa6bc('0x2c')](db['JscriptySessionReport'][_0xa6bc('0x2d')],function(_0x252b82){return{'name':_0x252b82[_0xa6bc('0x2e')],'type':_0x252b82[_0xa6bc('0x2f')][_0xa6bc('0x30')]};});_0x59f6d5[_0xa6bc('0x31')]=_[_0xa6bc('0x2c')](_0x5b8ecc,'name');_0x59f6d5[_0xa6bc('0x32')]=_[_0xa6bc('0x33')](_0x5821bc['query']);_0x59f6d5[_0xa6bc('0x34')]=_['intersection'](_0x59f6d5[_0xa6bc('0x31')],_0x59f6d5['query']);_0x57ff1e[_0xa6bc('0x35')]=_[_0xa6bc('0x36')](_0x59f6d5['model'],qs[_0xa6bc('0x37')](_0x5821bc['query']['fields']));_0x57ff1e[_0xa6bc('0x35')]=_0x57ff1e[_0xa6bc('0x35')][_0xa6bc('0x38')]?_0x57ff1e[_0xa6bc('0x35')]:_0x59f6d5[_0xa6bc('0x31')];if(!_0x5821bc['query'][_0xa6bc('0x39')](_0xa6bc('0x3a'))){_0x57ff1e[_0xa6bc('0x20')]=qs[_0xa6bc('0x20')](_0x5821bc['query'][_0xa6bc('0x20')]);_0x57ff1e[_0xa6bc('0x1e')]=qs[_0xa6bc('0x1e')](_0x5821bc[_0xa6bc('0x32')]['offset']);}_0x57ff1e['order']=qs['sort'](_0x5821bc[_0xa6bc('0x32')][_0xa6bc('0x3b')]);_0x57ff1e[_0xa6bc('0x3c')]=qs[_0xa6bc('0x34')](_['pick'](_0x5821bc[_0xa6bc('0x32')],_0x59f6d5[_0xa6bc('0x34')]),_0x5b8ecc);if(_0x5821bc['query'][_0xa6bc('0x3d')]){_0x57ff1e[_0xa6bc('0x3c')]=_[_0xa6bc('0x3e')](_0x57ff1e[_0xa6bc('0x3c')],{'$or':_[_0xa6bc('0x2c')](_0x5b8ecc,function(_0x18b88c){if(_0x18b88c['type']!=='VIRTUAL'){var _0x23594e={};_0x23594e[_0x18b88c[_0xa6bc('0x2a')]]={'$like':'%'+_0x5821bc[_0xa6bc('0x32')][_0xa6bc('0x3d')]+'%'};return _0x23594e;}})});}_0x57ff1e=_[_0xa6bc('0x3e')]({},_0x57ff1e,_0x5821bc[_0xa6bc('0x3f')]);var _0x47982c={'where':_0x57ff1e[_0xa6bc('0x3c')]};return db[_0xa6bc('0x40')][_0xa6bc('0x21')](_0x47982c)['then'](function(_0x4caeae){_0x18628e['count']=_0x4caeae;if(_0x5821bc[_0xa6bc('0x32')][_0xa6bc('0x41')]){_0x57ff1e[_0xa6bc('0x42')]=[{'all':!![]}];}return db[_0xa6bc('0x40')][_0xa6bc('0x43')](_0x57ff1e);})[_0xa6bc('0x27')](function(_0x4eb814){_0x18628e[_0xa6bc('0x44')]=_0x4eb814;return _0x18628e;})[_0xa6bc('0x27')](respondWithFilteredResult(_0x4b4e1a,_0x57ff1e))['catch'](handleError(_0x4b4e1a,null));};exports[_0xa6bc('0x45')]=function(_0x3a83fd,_0x1fa0fb){var _0x49eea1={'raw':!![],'where':{'id':_0x3a83fd['params']['id']}},_0x3a3601={};_0x3a3601[_0xa6bc('0x31')]=_[_0xa6bc('0x33')](db['JscriptySessionReport']['rawAttributes']);_0x3a3601['query']=_[_0xa6bc('0x33')](_0x3a83fd[_0xa6bc('0x32')]);_0x3a3601[_0xa6bc('0x34')]=_[_0xa6bc('0x36')](_0x3a3601[_0xa6bc('0x31')],_0x3a3601[_0xa6bc('0x32')]);_0x49eea1['attributes']=_[_0xa6bc('0x36')](_0x3a3601[_0xa6bc('0x31')],qs[_0xa6bc('0x37')](_0x3a83fd[_0xa6bc('0x32')][_0xa6bc('0x37')]));_0x49eea1[_0xa6bc('0x35')]=_0x49eea1[_0xa6bc('0x35')]['length']?_0x49eea1[_0xa6bc('0x35')]:_0x3a3601[_0xa6bc('0x31')];if(_0x3a83fd[_0xa6bc('0x32')][_0xa6bc('0x41')]){_0x49eea1['include']=[{'all':!![]}];}_0x49eea1=_[_0xa6bc('0x3e')]({},_0x49eea1,_0x3a83fd[_0xa6bc('0x3f')]);return db['JscriptySessionReport']['find'](_0x49eea1)[_0xa6bc('0x27')](handleEntityNotFound(_0x1fa0fb,null))[_0xa6bc('0x27')](respondWithResult(_0x1fa0fb,null))[_0xa6bc('0x46')](handleError(_0x1fa0fb,null));};exports['create']=function(_0x5a5b99,_0x338301){return db['JscriptySessionReport'][_0xa6bc('0x47')](_0x5a5b99['body'],{})[_0xa6bc('0x27')](respondWithResult(_0x338301,0xc9))['catch'](handleError(_0x338301,null));};exports['update']=function(_0x2e11e5,_0x119693){if(_0x2e11e5[_0xa6bc('0x48')]['id']){delete _0x2e11e5[_0xa6bc('0x48')]['id'];}return db['JscriptySessionReport'][_0xa6bc('0x49')]({'where':{'id':_0x2e11e5[_0xa6bc('0x4a')]['id']}})[_0xa6bc('0x27')](handleEntityNotFound(_0x119693,null))[_0xa6bc('0x27')](saveUpdates(_0x2e11e5[_0xa6bc('0x48')],null))['then'](respondWithResult(_0x119693,null))[_0xa6bc('0x46')](handleError(_0x119693,null));};exports[_0xa6bc('0x4b')]=function(_0x2d996f,_0x5dcb43){return db[_0xa6bc('0x40')][_0xa6bc('0x49')]({'where':{'id':_0x2d996f[_0xa6bc('0x4a')]['id']}})[_0xa6bc('0x27')](handleEntityNotFound(_0x5dcb43,null))[_0xa6bc('0x27')](removeEntity(_0x5dcb43,null))[_0xa6bc('0x46')](handleError(_0x5dcb43,null));};exports['describe']=function(_0x9c4764,_0x39b263){return db[_0xa6bc('0x40')][_0xa6bc('0x4c')]()['then'](respondWithResult(_0x39b263,null))[_0xa6bc('0x46')](handleError(_0x39b263,null));};exports['getQuestions']=function(_0x1177db,_0x3b5210,_0x128622){var _0x56fc82={'raw':!![],'where':{}};var _0x1de654={};var _0x2d7960={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xa6bc('0x4d')]({'where':{'id':_0x1177db[_0xa6bc('0x4a')]['id']}})[_0xa6bc('0x27')](handleEntityNotFound(_0x3b5210,null))['then'](function(_0xc7851c){if(_0xc7851c){_0x1de654[_0xa6bc('0x31')]=_['keys'](db[_0xa6bc('0x4e')][_0xa6bc('0x2d')]);_0x1de654[_0xa6bc('0x32')]=_[_0xa6bc('0x33')](_0x1177db[_0xa6bc('0x32')]);_0x1de654['filters']=_['intersection'](_0x1de654[_0xa6bc('0x31')],_0x1de654[_0xa6bc('0x32')]);_0x56fc82[_0xa6bc('0x35')]=_[_0xa6bc('0x36')](_0x1de654['model'],qs[_0xa6bc('0x37')](_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x37')]));_0x56fc82[_0xa6bc('0x35')]=_0x56fc82[_0xa6bc('0x35')][_0xa6bc('0x38')]?_0x56fc82[_0xa6bc('0x35')]:_0x1de654[_0xa6bc('0x31')];if(!_0x1177db[_0xa6bc('0x32')]['hasOwnProperty'](_0xa6bc('0x3a'))){_0x56fc82[_0xa6bc('0x20')]=qs[_0xa6bc('0x20')](_0x1177db['query'][_0xa6bc('0x20')]);_0x56fc82[_0xa6bc('0x1e')]=qs[_0xa6bc('0x1e')](_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x1e')]);}_0x56fc82['order']=qs['sort'](_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x3b')]);_0x56fc82[_0xa6bc('0x3c')]=qs['filters'](_[_0xa6bc('0x4f')](_0x1177db[_0xa6bc('0x32')],_0x1de654[_0xa6bc('0x34')]));_0x56fc82[_0xa6bc('0x3c')][_0xa6bc('0x50')]=_0xc7851c['id'];if(_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x3d')]){_0x56fc82['where']=_['merge'](_0x56fc82['where'],{'$or':_['map'](_0x56fc82[_0xa6bc('0x35')],function(_0x4533a5){var _0x47cc50={};_0x47cc50[_0x4533a5]={'$like':'%'+_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x3d')]+'%'};return _0x47cc50;})});}_0x56fc82=_[_0xa6bc('0x3e')]({},_0x56fc82,_0x1177db['options']);return db[_0xa6bc('0x4e')][_0xa6bc('0x21')]({'where':_0x56fc82[_0xa6bc('0x3c')]})[_0xa6bc('0x27')](function(_0x3c7879){_0x2d7960[_0xa6bc('0x21')]=_0x3c7879;if(_0x1177db[_0xa6bc('0x32')][_0xa6bc('0x41')]){_0x56fc82[_0xa6bc('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x56fc82);})[_0xa6bc('0x27')](function(_0x23f0fa){_0x2d7960[_0xa6bc('0x44')]=_0x23f0fa;return _0x2d7960;});}})['then'](respondWithFilteredResult(_0x3b5210,_0x56fc82))[_0xa6bc('0x46')](handleError(_0x3b5210,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 831634b..5c04629 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 _0x11e5=['path','../../config/environment','define','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x5536fa,_0x3e0200){var _0x6f03b5=function(_0x8c1e66){while(--_0x8c1e66){_0x5536fa['push'](_0x5536fa['shift']());}};_0x6f03b5(++_0x3e0200);}(_0x11e5,0x8b));var _0x511e=function(_0xa0be1c,_0x152d5d){_0xa0be1c=_0xa0be1c-0x0;var _0x546eec=_0x11e5[_0xa0be1c];return _0x546eec;};'use strict';var _=require(_0x511e('0x0'));var util=require('util');var logger=require(_0x511e('0x1'))(_0x511e('0x2'));var moment=require('moment');var BPromise=require(_0x511e('0x3'));var rp=require(_0x511e('0x4'));var fs=require('fs');var path=require(_0x511e('0x5'));var rimraf=require('rimraf');var config=require(_0x511e('0x6'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x342539,_0x323f8c){return _0x342539[_0x511e('0x7')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31f0=['./jscriptySessionReport.attributes','define','report_jscripty_sessions','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x297205,_0x1c75bf){var _0xc4e891=function(_0x39e918){while(--_0x39e918){_0x297205['push'](_0x297205['shift']());}};_0xc4e891(++_0x1c75bf);}(_0x31f0,0xb7));var _0x031f=function(_0x45ad4f,_0x11bbfe){_0x45ad4f=_0x45ad4f-0x0;var _0x166d01=_0x31f0[_0x45ad4f];return _0x166d01;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var logger=require(_0x031f('0x1'))('api');var moment=require(_0x031f('0x2'));var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require('rimraf');var config=require(_0x031f('0x6'));var attributes=require(_0x031f('0x7'));module['exports']=function(_0x4c0f94,_0x56328c){return _0x4c0f94[_0x031f('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x031f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 4f5431a..06a6e23 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 _0xd943=['info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x252749,_0x3c1691){var _0x411ea0=function(_0x3c3795){while(--_0x3c3795){_0x252749['push'](_0x252749['shift']());}};_0x411ea0(++_0x3c1691);}(_0xd943,0x15d));var _0x3d94=function(_0x537cc5,_0x2a0984){_0x537cc5=_0x537cc5-0x0;var _0x449139=_0xd943[_0x537cc5];return _0x449139;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file +var _0x7b84=['jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x44d664,_0x393ed8){var _0x5e6b3e=function(_0x418e5f){while(--_0x418e5f){_0x44d664['push'](_0x44d664['shift']());}};_0x5e6b3e(++_0x393ed8);}(_0x7b84,0x17c));var _0x47b8=function(_0x21e09c,_0x3e49a1){_0x21e09c=_0x21e09c-0x0;var _0xd893eb=_0x7b84[_0x21e09c];return _0xd893eb;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('JscriptySessionReport,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 2bd0ff0..bcbf747 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 _0x2fe3=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','put','update','get','isAuthenticated','exports','multer','util'];(function(_0x16cf82,_0x483dde){var _0x85bf86=function(_0x4b5bca){while(--_0x4b5bca){_0x16cf82['push'](_0x16cf82['shift']());}};_0x85bf86(++_0x483dde);}(_0x2fe3,0x1be));var _0x32fe=function(_0xe1f087,_0x19f979){_0xe1f087=_0xe1f087-0x0;var _0x2ddb79=_0x2fe3[_0xe1f087];return _0x2ddb79;};'use strict';var multer=require(_0x32fe('0x0'));var util=require(_0x32fe('0x1'));var path=require(_0x32fe('0x2'));var timeout=require(_0x32fe('0x3'));var express=require(_0x32fe('0x4'));var router=express[_0x32fe('0x5')]();var fs_extra=require(_0x32fe('0x6'));var auth=require(_0x32fe('0x7'));var interaction=require(_0x32fe('0x8'));var config=require(_0x32fe('0x9'));var controller=require(_0x32fe('0xa'));router['get']('/',controller['index']);router[_0x32fe('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x32fe('0xc')]);router[_0x32fe('0xd')]('/download_log_file',auth[_0x32fe('0xe')](),controller['downloadLogFile']);module[_0x32fe('0xf')]=router; \ No newline at end of file +var _0x3003=['get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','multer','path','connect-timeout','express','fs-extra','./license.controller'];(function(_0x388f1b,_0x1b6254){var _0x36ac35=function(_0x18a203){while(--_0x18a203){_0x388f1b['push'](_0x388f1b['shift']());}};_0x36ac35(++_0x1b6254);}(_0x3003,0x14a));var _0x3300=function(_0x1b5460,_0x5eb83f){_0x1b5460=_0x1b5460-0x0;var _0x498418=_0x3003[_0x1b5460];return _0x498418;};'use strict';var multer=require(_0x3300('0x0'));var util=require('util');var path=require(_0x3300('0x1'));var timeout=require(_0x3300('0x2'));var express=require(_0x3300('0x3'));var router=express['Router']();var fs_extra=require(_0x3300('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3300('0x5'));router[_0x3300('0x6')]('/',controller[_0x3300('0x7')]);router[_0x3300('0x8')](_0x3300('0x9'),auth[_0x3300('0xa')](),controller[_0x3300('0xb')]);router['get'](_0x3300('0xc'),auth[_0x3300('0xa')](),controller[_0x3300('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index ae62d76..590c658 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 _0x14e8=['exports','STRING','sequelize'];(function(_0x30e941,_0x24a9ef){var _0x45f43f=function(_0x22aba1){while(--_0x22aba1){_0x30e941['push'](_0x30e941['shift']());}};_0x45f43f(++_0x24a9ef);}(_0x14e8,0x1b8));var _0x814e=function(_0x51abbb,_0x17b74b){_0x51abbb=_0x51abbb-0x0;var _0x520cf9=_0x14e8[_0x51abbb];return _0x520cf9;};'use strict';var Sequelize=require(_0x814e('0x0'));module[_0x814e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x814e('0x2')]},'data2':{'type':Sequelize[_0x814e('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcdc3=['sequelize','exports','TEXT','STRING','INTEGER'];(function(_0x168aef,_0x20d38e){var _0x1d88d6=function(_0xc9d623){while(--_0xc9d623){_0x168aef['push'](_0x168aef['shift']());}};_0x1d88d6(++_0x20d38e);}(_0xcdc3,0x1db));var _0x3cdc=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xcdc3[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0x3cdc('0x0'));module[_0x3cdc('0x1')]={'license':{'type':Sequelize[_0x3cdc('0x2')]},'data1':{'type':Sequelize[_0x3cdc('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x3cdc('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 d337108..3bb3fb7 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 _0xb85d=['body','find','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','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','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','model','keys','License','rawAttributes','query','filters','attributes','fields','length','getLicense','catch'];(function(_0x5639ef,_0x1176fe){var _0x5a4b8e=function(_0x5332d0){while(--_0x5332d0){_0x5639ef['push'](_0x5639ef['shift']());}};_0x5a4b8e(++_0x1176fe);}(_0xb85d,0xa0));var _0xdb85=function(_0x15bd6b,_0x3edd5d){_0x15bd6b=_0x15bd6b-0x0;var _0x187319=_0xb85d[_0x15bd6b];return _0x187319;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb85('0x0'));var zipdir=require(_0xdb85('0x1'));var jsonpatch=require(_0xdb85('0x2'));var rp=require(_0xdb85('0x3'));var moment=require('moment');var BPromise=require(_0xdb85('0x4'));var Mustache=require('mustache');var util=require(_0xdb85('0x5'));var path=require(_0xdb85('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb85('0x7'));var _=require(_0xdb85('0x8'));var squel=require(_0xdb85('0x9'));var crypto=require(_0xdb85('0xa'));var jsforce=require(_0xdb85('0xb'));var deskjs=require(_0xdb85('0xc'));var toCsv=require(_0xdb85('0xd'));var querystring=require(_0xdb85('0xe'));var Papa=require(_0xdb85('0xf'));var Redis=require(_0xdb85('0x10'));var authService=require(_0xdb85('0x11'));var qs=require(_0xdb85('0x12'));var as=require(_0xdb85('0x13'));var hardwareService=require(_0xdb85('0x14'));var logger=require(_0xdb85('0x15'))(_0xdb85('0x16'));var utils=require(_0xdb85('0x17'));var config=require(_0xdb85('0x18'));var licenseUtil=require(_0xdb85('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x372073,_0x4f6a6e){_0x4f6a6e=_0x4f6a6e||0xcc;return function(_0x50c15b){if(_0x50c15b){return _0x372073['sendStatus'](_0x4f6a6e);}return _0x372073['status'](_0x4f6a6e)['end']();};}function respondWithResult(_0x5aa063,_0x170635){_0x170635=_0x170635||0xc8;return function(_0x5efbd1){if(_0x5efbd1){return _0x5aa063[_0xdb85('0x1a')](_0x170635)[_0xdb85('0x1b')](_0x5efbd1);}};}function respondWithFilteredResult(_0x2434dc,_0x4ea21a){return function(_0x444918){if(_0x444918){var _0x317565=typeof _0x4ea21a[_0xdb85('0x1c')]===_0xdb85('0x1d')&&typeof _0x4ea21a[_0xdb85('0x1e')]==='undefined';var _0x247a29=_0x444918[_0xdb85('0x1f')];var _0x378681=_0x317565?0x0:_0x4ea21a['offset'];var _0x442fab=_0x317565?_0x444918[_0xdb85('0x1f')]:_0x4ea21a['offset']+_0x4ea21a['limit'];var _0x516e27;if(_0x442fab>=_0x247a29){_0x442fab=_0x247a29;_0x516e27=0xc8;}else{_0x516e27=0xce;}_0x2434dc[_0xdb85('0x1a')](_0x516e27);return _0x2434dc[_0xdb85('0x20')](_0xdb85('0x21'),_0x378681+'-'+_0x442fab+'/'+_0x247a29)[_0xdb85('0x1b')](_0x444918);}return null;};}function patchUpdates(_0x5e9828){return function(_0x11105e){try{jsonpatch[_0xdb85('0x22')](_0x11105e,_0x5e9828,!![]);}catch(_0x5be710){return BPromise['reject'](_0x5be710);}return _0x11105e[_0xdb85('0x23')]();};}function saveUpdates(_0x4af9f2,_0x33cbc0){return function(_0x2f7238){if(_0x2f7238){return _0x2f7238[_0xdb85('0x24')](_0x4af9f2)[_0xdb85('0x25')](function(_0x313bc6){return _0x313bc6;});}return null;};}function removeEntity(_0x984f37,_0xc86eb4){return function(_0x18bef7){if(_0x18bef7){return _0x18bef7[_0xdb85('0x26')]()[_0xdb85('0x25')](function(){_0x984f37[_0xdb85('0x1a')](0xcc)[_0xdb85('0x27')]();});}};}function handleEntityNotFound(_0x302966,_0x30737a){return function(_0x56d98e){if(!_0x56d98e){_0x302966[_0xdb85('0x28')](0x194);}return _0x56d98e;};}function handleError(_0x120546,_0x56284c){_0x56284c=_0x56284c||0x1f4;return function(_0xc6d67b){logger[_0xdb85('0x29')](_0xc6d67b[_0xdb85('0x2a')]);if(_0xc6d67b[_0xdb85('0x2b')]){delete _0xc6d67b[_0xdb85('0x2b')];}_0x120546['status'](_0x56284c)[_0xdb85('0x2c')](_0xc6d67b);};}var utilLicense=require(_0xdb85('0x19'));exports['index']=function(_0x360491,_0x5f1d56){var _0x38efbc={'raw':!![],'where':{'id':0x1}},_0x2c5645={};_0x2c5645[_0xdb85('0x2d')]=_[_0xdb85('0x2e')](db[_0xdb85('0x2f')][_0xdb85('0x30')]);_0x2c5645[_0xdb85('0x31')]=_[_0xdb85('0x2e')](_0x360491['query']);_0x2c5645[_0xdb85('0x32')]=_['intersection'](_0x2c5645[_0xdb85('0x2d')],_0x2c5645[_0xdb85('0x31')]);_0x38efbc[_0xdb85('0x33')]=_['intersection'](_0x2c5645[_0xdb85('0x2d')],qs[_0xdb85('0x34')](_0x360491['query']['fields']));_0x38efbc['attributes']=_0x38efbc['attributes'][_0xdb85('0x35')]?_0x38efbc['attributes']:_0x2c5645[_0xdb85('0x2d')];_0x38efbc=_['merge']({},_0x38efbc,_0x360491['options']);return utilLicense[_0xdb85('0x36')](_0x38efbc)[_0xdb85('0x25')](respondWithResult(_0x5f1d56,null))[_0xdb85('0x37')](handleError(_0x5f1d56,null));};exports['update']=function(_0x2422f7,_0x2ce542){if(_0x2422f7[_0xdb85('0x38')]['id']){delete _0x2422f7[_0xdb85('0x38')]['id'];}return db['License'][_0xdb85('0x39')]({'where':{'id':_0x2422f7['params']['id']}})[_0xdb85('0x25')](handleEntityNotFound(_0x2ce542,null))[_0xdb85('0x25')](function(_0x29168e){var _0xe42bef=_0x29168e['get']({'plain':!![]});return utilLicense[_0xdb85('0x3a')](_0xe42bef,_0x2422f7[_0xdb85('0x38')][_0xdb85('0x3b')]);})[_0xdb85('0x25')](function(_0x18d996){if(!_0x18d996[_0xdb85('0x3c')]){return saveUpdates(_0x2422f7[_0xdb85('0x38')],null);}return _0x18d996;})['then'](respondWithResult(_0x2ce542,null))[_0xdb85('0x37')](handleError(_0x2ce542,null));};exports[_0xdb85('0x3d')]=function(_0x814e87,_0xee64b4){var _0x157320=_0xdb85('0x3e');var _0x5124b0=path[_0xdb85('0x3f')](_0xdb85('0x40'),_0xdb85('0x41'),'xcally',_0x157320);_0xee64b4[_0xdb85('0x42')](_0xdb85('0x43'),_0xdb85('0x44')+_0x157320);_0xee64b4[_0xdb85('0x20')](_0xdb85('0x45'),_0xdb85('0x46'));_0xee64b4[_0xdb85('0x47')](_0x5124b0);}; \ No newline at end of file +var _0x6890=['fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','name','send','index','model','keys','License','query','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','demo','downloadLogFile','license-info.log','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir'];(function(_0x1ca7c2,_0x135593){var _0x5a5152=function(_0x4acb60){while(--_0x4acb60){_0x1ca7c2['push'](_0x1ca7c2['shift']());}};_0x5a5152(++_0x135593);}(_0x6890,0xc0));var _0x0689=function(_0x2ec9ac,_0x3a02c6){_0x2ec9ac=_0x2ec9ac-0x0;var _0x3bd406=_0x6890[_0x2ec9ac];return _0x3bd406;};'use strict';var emlformat=require(_0x0689('0x0'));var rimraf=require(_0x0689('0x1'));var zipdir=require(_0x0689('0x2'));var jsonpatch=require(_0x0689('0x3'));var rp=require(_0x0689('0x4'));var moment=require('moment');var BPromise=require(_0x0689('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0689('0x6'));var sox=require(_0x0689('0x7'));var csv=require(_0x0689('0x8'));var ejs=require(_0x0689('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0689('0xa'));var jsforce=require(_0x0689('0xb'));var deskjs=require(_0x0689('0xc'));var toCsv=require(_0x0689('0x8'));var querystring=require('querystring');var Papa=require(_0x0689('0xd'));var Redis=require(_0x0689('0xe'));var authService=require(_0x0689('0xf'));var qs=require(_0x0689('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0689('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0689('0x12'));var config=require(_0x0689('0x13'));var licenseUtil=require(_0x0689('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45e0cf,_0x39e478){_0x39e478=_0x39e478||0xcc;return function(_0x590f07){if(_0x590f07){return _0x45e0cf[_0x0689('0x15')](_0x39e478);}return _0x45e0cf[_0x0689('0x16')](_0x39e478)[_0x0689('0x17')]();};}function respondWithResult(_0xcb5215,_0x1fe860){_0x1fe860=_0x1fe860||0xc8;return function(_0x534f50){if(_0x534f50){return _0xcb5215[_0x0689('0x16')](_0x1fe860)[_0x0689('0x18')](_0x534f50);}};}function respondWithFilteredResult(_0xa29c61,_0x2782b2){return function(_0x56b4ed){if(_0x56b4ed){var _0x128d13=typeof _0x2782b2[_0x0689('0x19')]===_0x0689('0x1a')&&typeof _0x2782b2[_0x0689('0x1b')]===_0x0689('0x1a');var _0x2166cb=_0x56b4ed[_0x0689('0x1c')];var _0x4eaf71=_0x128d13?0x0:_0x2782b2[_0x0689('0x19')];var _0x8ef317=_0x128d13?_0x56b4ed['count']:_0x2782b2[_0x0689('0x19')]+_0x2782b2[_0x0689('0x1b')];var _0x3dfaa9;if(_0x8ef317>=_0x2166cb){_0x8ef317=_0x2166cb;_0x3dfaa9=0xc8;}else{_0x3dfaa9=0xce;}_0xa29c61[_0x0689('0x16')](_0x3dfaa9);return _0xa29c61[_0x0689('0x1d')](_0x0689('0x1e'),_0x4eaf71+'-'+_0x8ef317+'/'+_0x2166cb)[_0x0689('0x18')](_0x56b4ed);}return null;};}function patchUpdates(_0x5f2470){return function(_0x18d076){try{jsonpatch['apply'](_0x18d076,_0x5f2470,!![]);}catch(_0x188948){return BPromise['reject'](_0x188948);}return _0x18d076[_0x0689('0x1f')]();};}function saveUpdates(_0x1636ae,_0x4d4a9e){return function(_0x31303d){if(_0x31303d){return _0x31303d[_0x0689('0x20')](_0x1636ae)['then'](function(_0x3d657){return _0x3d657;});}return null;};}function removeEntity(_0x980aa0,_0x3cb973){return function(_0x304304){if(_0x304304){return _0x304304['destroy']()[_0x0689('0x21')](function(){_0x980aa0[_0x0689('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41020e,_0x524345){return function(_0xb77b9){if(!_0xb77b9){_0x41020e[_0x0689('0x15')](0x194);}return _0xb77b9;};}function handleError(_0x443f57,_0x45e1c3){_0x45e1c3=_0x45e1c3||0x1f4;return function(_0x1053c7){logger[_0x0689('0x22')](_0x1053c7['stack']);if(_0x1053c7['name']){delete _0x1053c7[_0x0689('0x23')];}_0x443f57[_0x0689('0x16')](_0x45e1c3)[_0x0689('0x24')](_0x1053c7);};}var utilLicense=require(_0x0689('0x14'));exports[_0x0689('0x25')]=function(_0x5019a7,_0x37318d){var _0x2f6c35={'raw':!![],'where':{'id':0x1}},_0x313cec={};_0x313cec[_0x0689('0x26')]=_[_0x0689('0x27')](db[_0x0689('0x28')]['rawAttributes']);_0x313cec[_0x0689('0x29')]=_[_0x0689('0x27')](_0x5019a7['query']);_0x313cec['filters']=_[_0x0689('0x2a')](_0x313cec['model'],_0x313cec[_0x0689('0x29')]);_0x2f6c35[_0x0689('0x2b')]=_['intersection'](_0x313cec[_0x0689('0x26')],qs['fields'](_0x5019a7[_0x0689('0x29')][_0x0689('0x2c')]));_0x2f6c35[_0x0689('0x2b')]=_0x2f6c35[_0x0689('0x2b')][_0x0689('0x2d')]?_0x2f6c35[_0x0689('0x2b')]:_0x313cec['model'];_0x2f6c35=_[_0x0689('0x2e')]({},_0x2f6c35,_0x5019a7[_0x0689('0x2f')]);return utilLicense[_0x0689('0x30')](_0x2f6c35)['then'](respondWithResult(_0x37318d,null))[_0x0689('0x31')](handleError(_0x37318d,null));};exports[_0x0689('0x20')]=function(_0xf5c5d4,_0x124704){if(_0xf5c5d4[_0x0689('0x32')]['id']){delete _0xf5c5d4[_0x0689('0x32')]['id'];}return db[_0x0689('0x28')][_0x0689('0x33')]({'where':{'id':_0xf5c5d4['params']['id']}})['then'](handleEntityNotFound(_0x124704,null))[_0x0689('0x21')](function(_0xc53d8f){var _0x4734fb=_0xc53d8f[_0x0689('0x34')]({'plain':!![]});return utilLicense[_0x0689('0x35')](_0x4734fb,_0xf5c5d4[_0x0689('0x32')]['key']);})[_0x0689('0x21')](function(_0x373194){if(!_0x373194[_0x0689('0x36')]){return saveUpdates(_0xf5c5d4['body'],null);}return _0x373194;})['then'](respondWithResult(_0x124704,null))['catch'](handleError(_0x124704,null));};exports[_0x0689('0x37')]=function(_0x10b2fe,_0x4ec89f){var _0x15a5d9=_0x0689('0x38');var _0x3342ce=path['join']('/var',_0x0689('0x39'),_0x0689('0x3a'),_0x15a5d9);_0x4ec89f[_0x0689('0x3b')](_0x0689('0x3c'),_0x0689('0x3d')+_0x15a5d9);_0x4ec89f[_0x0689('0x1d')](_0x0689('0x3e'),_0x0689('0x3f'));_0x4ec89f[_0x0689('0x40')](_0x3342ce);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d209137..22ef79a 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 _0x4cad=['../../config/environment','./license.attributes','exports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xac4f65,_0x41a048){var _0x42a67d=function(_0x399646){while(--_0x399646){_0xac4f65['push'](_0xac4f65['shift']());}};_0x42a67d(++_0x41a048);}(_0x4cad,0x179));var _0xd4ca=function(_0x5e3107,_0x4cc707){_0x5e3107=_0x5e3107-0x0;var _0x193cb4=_0x4cad[_0x5e3107];return _0x193cb4;};'use strict';var _=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var logger=require(_0xd4ca('0x2'))(_0xd4ca('0x3'));var moment=require(_0xd4ca('0x4'));var BPromise=require('bluebird');var rp=require(_0xd4ca('0x5'));var fs=require('fs');var path=require(_0xd4ca('0x6'));var rimraf=require(_0xd4ca('0x7'));var config=require(_0xd4ca('0x8'));var attributes=require(_0xd4ca('0x9'));module[_0xd4ca('0xa')]=function(_0x501c28,_0x4d0d8d){return _0x501c28['define']('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9650=['lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','License','license'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9650,0x1ce));var _0x0965=function(_0x108d68,_0x9b39de){_0x108d68=_0x108d68-0x0;var _0x11476a=_0x9650[_0x108d68];return _0x11476a;};'use strict';var _=require(_0x0965('0x0'));var util=require(_0x0965('0x1'));var logger=require('../../config/logger')(_0x0965('0x2'));var moment=require(_0x0965('0x3'));var BPromise=require('bluebird');var rp=require(_0x0965('0x4'));var fs=require('fs');var path=require(_0x0965('0x5'));var rimraf=require('rimraf');var config=require(_0x0965('0x6'));var attributes=require('./license.attributes');module[_0x0965('0x7')]=function(_0x5c0f53,_0x207f24){return _0x5c0f53[_0x0965('0x8')](_0x0965('0x9'),attributes,{'tableName':_0x0965('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 17d6b35..04a4909 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 _0xe628=['jayson/promise','http','request','then','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','License,\x20%s,\x20%s','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xe628,0x16e));var _0x8e62=function(_0x233d57,_0x284678){_0x233d57=_0x233d57-0x0;var _0x3eec8c=_0xe628[_0x233d57];return _0x3eec8c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8e62('0x0'));var BPromise=require(_0x8e62('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e62('0x2'));var db=require(_0x8e62('0x3'))['db'];var utils=require(_0x8e62('0x4'));var logger=require(_0x8e62('0x5'))(_0x8e62('0x6'));var config=require(_0x8e62('0x7'));var jayson=require(_0x8e62('0x8'));var client=jayson['client'][_0x8e62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36a30a,_0x52a401,_0x2b6569){return new BPromise(function(_0x1a89a1,_0x4054dd){return client[_0x8e62('0xa')](_0x36a30a,_0x2b6569)[_0x8e62('0xb')](function(_0x1eff88){logger[_0x8e62('0xc')]('License,\x20%s,\x20%s',_0x52a401,_0x8e62('0xd'));logger['debug'](_0x8e62('0xe'),_0x52a401,_0x8e62('0xd'),JSON[_0x8e62('0xf')](_0x1eff88));if(_0x1eff88['error']){if(_0x1eff88[_0x8e62('0x10')][_0x8e62('0x11')]===0x1f4){logger[_0x8e62('0x10')]('License,\x20%s,\x20%s',_0x52a401,_0x1eff88[_0x8e62('0x10')]['message']);return _0x4054dd(_0x1eff88['error'][_0x8e62('0x12')]);}logger[_0x8e62('0x10')](_0x8e62('0x13'),_0x52a401,_0x1eff88[_0x8e62('0x10')][_0x8e62('0x12')]);return _0x1a89a1(_0x1eff88[_0x8e62('0x10')][_0x8e62('0x12')]);}else{logger[_0x8e62('0xc')](_0x8e62('0x13'),_0x52a401,_0x8e62('0xd'));_0x1a89a1(_0x1eff88[_0x8e62('0x14')][_0x8e62('0x12')]);}})[_0x8e62('0x15')](function(_0x30d787){logger[_0x8e62('0x10')](_0x8e62('0x13'),_0x52a401,_0x30d787);_0x4054dd(_0x30d787);});});} \ No newline at end of file +var _0x463f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','code','error','message','License,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b35af,_0x58b687){var _0x551a1e=function(_0x255034){while(--_0x255034){_0x3b35af['push'](_0x3b35af['shift']());}};_0x551a1e(++_0x58b687);}(_0x463f,0xf4));var _0xf463=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x463f[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0xf463('0x0'));var util=require(_0xf463('0x1'));var moment=require('moment');var BPromise=require(_0xf463('0x2'));var rs=require(_0xf463('0x3'));var fs=require('fs');var Redis=require(_0xf463('0x4'));var db=require(_0xf463('0x5'))['db'];var utils=require(_0xf463('0x6'));var logger=require(_0xf463('0x7'))(_0xf463('0x8'));var config=require(_0xf463('0x9'));var jayson=require(_0xf463('0xa'));var client=jayson[_0xf463('0xb')][_0xf463('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1724db,_0x192e1c,_0xe555fc){return new BPromise(function(_0x108d31,_0x2ca62b){return client[_0xf463('0xd')](_0x1724db,_0xe555fc)[_0xf463('0xe')](function(_0x3c538b){logger[_0xf463('0xf')]('License,\x20%s,\x20%s',_0x192e1c,_0xf463('0x10'));logger[_0xf463('0x11')](_0xf463('0x12'),_0x192e1c,_0xf463('0x10'),JSON['stringify'](_0x3c538b));if(_0x3c538b['error']){if(_0x3c538b['error'][_0xf463('0x13')]===0x1f4){logger[_0xf463('0x14')]('License,\x20%s,\x20%s',_0x192e1c,_0x3c538b[_0xf463('0x14')][_0xf463('0x15')]);return _0x2ca62b(_0x3c538b[_0xf463('0x14')][_0xf463('0x15')]);}logger[_0xf463('0x14')](_0xf463('0x16'),_0x192e1c,_0x3c538b[_0xf463('0x14')][_0xf463('0x15')]);return _0x108d31(_0x3c538b[_0xf463('0x14')][_0xf463('0x15')]);}else{logger['info'](_0xf463('0x16'),_0x192e1c,_0xf463('0x10'));_0x108d31(_0x3c538b[_0xf463('0x17')][_0xf463('0x15')]);}})[_0xf463('0x18')](function(_0x58046c){logger['error'](_0xf463('0x16'),_0x192e1c,_0x58046c);_0x2ca62b(_0x58046c);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 13a66cc..7ed3645 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 _0x0cd5=['/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addImap','addInteraction','addApplications','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeAgents','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe'];(function(_0x5d491a,_0x46fe1b){var _0x31b402=function(_0x14854e){while(--_0x14854e){_0x5d491a['push'](_0x5d491a['shift']());}};_0x31b402(++_0x46fe1b);}(_0x0cd5,0x13c));var _0x50cd=function(_0x1a58d1,_0xa90685){_0x1a58d1=_0x1a58d1-0x0;var _0x101adc=_0x0cd5[_0x1a58d1];return _0x101adc;};'use strict';var multer=require('multer');var util=require(_0x50cd('0x0'));var path=require(_0x50cd('0x1'));var timeout=require(_0x50cd('0x2'));var express=require(_0x50cd('0x3'));var router=express['Router']();var fs_extra=require(_0x50cd('0x4'));var auth=require(_0x50cd('0x5'));var interaction=require(_0x50cd('0x6'));var config=require(_0x50cd('0x7'));var controller=require(_0x50cd('0x8'));router[_0x50cd('0x9')]('/',auth[_0x50cd('0xa')](),controller[_0x50cd('0xb')]);router[_0x50cd('0x9')]('/describe',auth[_0x50cd('0xa')](),controller[_0x50cd('0xc')]);router[_0x50cd('0x9')](_0x50cd('0xd'),auth['isAuthenticated'](),controller[_0x50cd('0xe')]);router['get'](_0x50cd('0xf'),auth['isAuthenticated'](),controller[_0x50cd('0x10')]);router[_0x50cd('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x50cd('0x11')]);router['get'](_0x50cd('0x12'),auth[_0x50cd('0xa')](),controller['getImap']);router[_0x50cd('0x9')](_0x50cd('0x13'),auth[_0x50cd('0xa')](),controller['getSmtp']);router['get'](_0x50cd('0x14'),auth[_0x50cd('0xa')](),controller[_0x50cd('0x15')]);router[_0x50cd('0x9')](_0x50cd('0x16'),auth[_0x50cd('0xa')](),controller[_0x50cd('0x17')]);router[_0x50cd('0x9')](_0x50cd('0x18'),auth[_0x50cd('0xa')](),controller[_0x50cd('0x19')]);router['get'](_0x50cd('0x1a'),auth['isAuthenticated'](),controller[_0x50cd('0x1b')]);router[_0x50cd('0x9')]('/:id/users',auth[_0x50cd('0xa')](),controller[_0x50cd('0x1c')]);router[_0x50cd('0x1d')]('/:id/dispositions',auth[_0x50cd('0xa')](),controller[_0x50cd('0x1e')]);router[_0x50cd('0x1d')](_0x50cd('0x1f'),auth['isAuthenticated'](),controller[_0x50cd('0x20')]);router['post']('/',auth['isAuthenticated'](),controller[_0x50cd('0x21')]);router[_0x50cd('0x1d')](_0x50cd('0x12'),auth[_0x50cd('0xa')](),controller[_0x50cd('0x22')]);router[_0x50cd('0x1d')](_0x50cd('0x13'),auth[_0x50cd('0xa')](),controller['addSmtp']);router[_0x50cd('0x1d')](_0x50cd('0x14'),auth[_0x50cd('0xa')](),controller[_0x50cd('0x23')]);router[_0x50cd('0x1d')](_0x50cd('0x16'),auth[_0x50cd('0xa')](),controller[_0x50cd('0x24')]);router[_0x50cd('0x1d')]('/:id/send',auth[_0x50cd('0xa')](),controller[_0x50cd('0x25')]);router[_0x50cd('0x1d')](_0x50cd('0x26'),auth[_0x50cd('0xa')](),controller[_0x50cd('0x27')]);router[_0x50cd('0x28')](_0x50cd('0xd'),auth[_0x50cd('0xa')](),controller[_0x50cd('0x29')]);router[_0x50cd('0x2a')](_0x50cd('0xf'),auth[_0x50cd('0xa')](),controller[_0x50cd('0x2b')]);router[_0x50cd('0x2a')](_0x50cd('0x1f'),auth['isAuthenticated'](),controller[_0x50cd('0x2c')]);router['delete'](_0x50cd('0x12'),auth['isAuthenticated'](),controller[_0x50cd('0x2d')]);router['delete'](_0x50cd('0x13'),auth[_0x50cd('0xa')](),controller['removeSmtp']);router['delete']('/:id',auth[_0x50cd('0xa')](),controller['destroy']);router[_0x50cd('0x2a')](_0x50cd('0x26'),auth['isAuthenticated'](),controller[_0x50cd('0x2e')]);module['exports']=router; \ No newline at end of file +var _0xd16b=['addInteraction','addApplications','/:id/send','send','/:id/users','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','getAgents','post','addAnswer','create','addImap','addSmtp','/:id/interactions'];(function(_0x2730c9,_0x4b9f79){var _0x2f1cf5=function(_0x4bf349){while(--_0x4bf349){_0x2730c9['push'](_0x2730c9['shift']());}};_0x2f1cf5(++_0x4b9f79);}(_0xd16b,0x1b6));var _0xbd16=function(_0x1912fd,_0x2ec304){_0x1912fd=_0x1912fd-0x0;var _0x573fc4=_0xd16b[_0x1912fd];return _0x573fc4;};'use strict';var multer=require(_0xbd16('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbd16('0x1'));var express=require(_0xbd16('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd16('0x3'));var interaction=require(_0xbd16('0x4'));var config=require(_0xbd16('0x5'));var controller=require('./mailAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd16('0x6')]);router[_0xbd16('0x7')](_0xbd16('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xbd16('0x7')](_0xbd16('0x9'),auth[_0xbd16('0xa')](),controller[_0xbd16('0xb')]);router[_0xbd16('0x7')](_0xbd16('0xc'),auth[_0xbd16('0xa')](),controller[_0xbd16('0xd')]);router['get'](_0xbd16('0xe'),auth[_0xbd16('0xa')](),controller['getAnswers']);router['get'](_0xbd16('0xf'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x10')]);router[_0xbd16('0x7')](_0xbd16('0x11'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x12')]);router[_0xbd16('0x7')]('/:id/interactions',auth[_0xbd16('0xa')](),controller[_0xbd16('0x13')]);router[_0xbd16('0x7')](_0xbd16('0x14'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x15')]);router[_0xbd16('0x7')](_0xbd16('0x16'),auth['isAuthenticated'](),controller[_0xbd16('0x17')]);router[_0xbd16('0x7')]('/:id/verify',auth[_0xbd16('0xa')](),controller[_0xbd16('0x18')]);router['get']('/:id/users',auth[_0xbd16('0xa')](),controller[_0xbd16('0x19')]);router[_0xbd16('0x1a')](_0xbd16('0xc'),auth[_0xbd16('0xa')](),controller['addDisposition']);router[_0xbd16('0x1a')](_0xbd16('0xe'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x1b')]);router[_0xbd16('0x1a')]('/',auth[_0xbd16('0xa')](),controller[_0xbd16('0x1c')]);router[_0xbd16('0x1a')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xbd16('0x1d')]);router[_0xbd16('0x1a')](_0xbd16('0x11'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x1e')]);router[_0xbd16('0x1a')](_0xbd16('0x1f'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x20')]);router[_0xbd16('0x1a')]('/:id/applications',auth[_0xbd16('0xa')](),controller[_0xbd16('0x21')]);router[_0xbd16('0x1a')](_0xbd16('0x22'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x23')]);router[_0xbd16('0x1a')](_0xbd16('0x24'),auth['isAuthenticated'](),controller[_0xbd16('0x25')]);router['put'](_0xbd16('0x9'),auth['isAuthenticated'](),controller[_0xbd16('0x26')]);router[_0xbd16('0x27')](_0xbd16('0xc'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x28')]);router[_0xbd16('0x27')](_0xbd16('0xe'),auth['isAuthenticated'](),controller[_0xbd16('0x29')]);router[_0xbd16('0x27')](_0xbd16('0xf'),auth['isAuthenticated'](),controller[_0xbd16('0x2a')]);router['delete']('/:id/out_servers',auth[_0xbd16('0xa')](),controller[_0xbd16('0x2b')]);router[_0xbd16('0x27')]('/:id',auth['isAuthenticated'](),controller[_0xbd16('0x2c')]);router[_0xbd16('0x27')](_0xbd16('0x24'),auth[_0xbd16('0xa')](),controller[_0xbd16('0x2d')]);module[_0xbd16('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index b74ea2d..4db5297 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 _0x15bb=['TEXT','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','getDataValue','provider','custom','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x32908c,_0x3eabbd){var _0x469b9a=function(_0x14fb0f){while(--_0x14fb0f){_0x32908c['push'](_0x32908c['shift']());}};_0x469b9a(++_0x3eabbd);}(_0x15bb,0x8a));var _0xb15b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x15bb[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require('sequelize');module[_0xb15b('0x0')]={'description':{'type':Sequelize[_0xb15b('0x1')]},'name':{'type':Sequelize[_0xb15b('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xb15b('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb15b('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xb15b('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xb15b('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb15b('0x1')],'allowNull':![],'defaultValue':_0xb15b('0x3')},'fontSize':{'type':Sequelize[_0xb15b('0x4')](0x2)[_0xb15b('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb15b('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb15b('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb15b('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xb15b('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb15b('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb15b('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb15b('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb15b('0x2')],'defaultValue':![],'comment':_0xb15b('0x7'),'set':function(_0x16122d){if(!_0x16122d)this['setDataValue'](_0xb15b('0x8'),null);this[_0xb15b('0x9')](_0xb15b('0xa'),_0x16122d);}},'provider':{'type':Sequelize[_0xb15b('0xb')]('gmail',_0xb15b('0xc'),_0xb15b('0xd'),_0xb15b('0xe')),'defaultValue':null,'get':function(){if(!this[_0xb15b('0xf')](_0xb15b('0x10')))return'custom';return this['getDataValue'](_0xb15b('0x10'));},'set':function(_0x44eb88){if(_0x44eb88===_0xb15b('0x11'))_0x44eb88=null;return this[_0xb15b('0x9')](_0xb15b('0x10'),_0x44eb88);}}}; \ No newline at end of file +var _0x93f4=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','hotmail','outlook365','provider','custom','getDataValue','sequelize','exports','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x93f4,0x139));var _0x493f=function(_0x3a30e4,_0x3bfe03){_0x3a30e4=_0x3a30e4-0x0;var _0x290642=_0x93f4[_0x3a30e4];return _0x290642;};'use strict';var Sequelize=require(_0x493f('0x0'));module[_0x493f('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x493f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x493f('0x3')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x493f('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x493f('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0x493f('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x493f('0x3')],'allowNull':![],'defaultValue':_0x493f('0x5')},'fontSize':{'type':Sequelize[_0x493f('0x6')](0x2)[_0x493f('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x493f('0x8');}},'notificationSound':{'type':Sequelize[_0x493f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x493f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x493f('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x493f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x493f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x493f('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x493f('0xa'),'set':function(_0xd9cbf4){if(!_0xd9cbf4)this[_0x493f('0xb')]('mandatoryDispositionPauseId',null);this[_0x493f('0xb')](_0x493f('0xc'),_0xd9cbf4);}},'provider':{'type':Sequelize[_0x493f('0xd')]('gmail',_0x493f('0xe'),'yahoo',_0x493f('0xf')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x493f('0x10')))return _0x493f('0x11');return this[_0x493f('0x12')](_0x493f('0x10'));},'set':function(_0x191b08){if(_0x191b08===_0x493f('0x11'))_0x191b08=null;return this['setDataValue']('provider',_0x191b08);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index fe84ab5..256af55 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 _0x9c15=['findOne','Disposition','length','pick','MailAccountId','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','format','true','split','CmList','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','messageId','subject','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','client','then','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','Unknown\x20email\x20service\x20provider','user','password','modernAuthentication','CloudProviderId','pass','host','port','service','authentication','username','Imap','Smtp','MailServerIn','MailServerOut','Pause','map','MailAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','body','provider','custom','secure','find','mandatoryDispositionPause','Mail\x20Account\x20not\x20found','describe','addDisposition','create','getDispositions'];(function(_0x312ed3,_0x1066fe){var _0xcdea8a=function(_0x1c9b84){while(--_0x1c9b84){_0x312ed3['push'](_0x312ed3['shift']());}};_0xcdea8a(++_0x1066fe);}(_0x9c15,0x1e5));var _0x59c1=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9c15[_0x138adb];return _0x1b27f2;};'use strict';var moment=require('moment');var BPromise=require(_0x59c1('0x0'));var util=require(_0x59c1('0x1'));var path=require(_0x59c1('0x2'));var _=require(_0x59c1('0x3'));var juice=require(_0x59c1('0x4'));var Redis=require(_0x59c1('0x5'));var qs=require(_0x59c1('0x6'));var logger=require('../../config/logger')(_0x59c1('0x7'));var config=require(_0x59c1('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x59c1('0x9')](config[_0x59c1('0xa')],{'host':_0x59c1('0xb'),'port':0x18eb});var socket=require(_0x59c1('0xc'))(new Redis(config[_0x59c1('0xa')]));require(_0x59c1('0xd'))[_0x59c1('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x59c1('0xf')]['http']({'port':0x232b});function respondWithRpcPromise(_0x4b8c15,_0x310259,_0x5b3265,_0x51cd5c){return new BPromise(function(_0x77b746,_0x334d5a){var _0x1eda2a=_0x51cd5c||client;return _0x1eda2a['request'](_0x4b8c15,_0x5b3265)[_0x59c1('0x10')](function(_0x5b957d){logger['info'](_0x59c1('0x11'),_0x310259,_0x59c1('0x12'));logger['debug'](_0x59c1('0x13'),_0x310259,'request\x20sent',JSON['stringify'](_0x5b957d));if(_0x5b957d['error']){if(_0x5b957d['error']['code']===0x1f4){logger[_0x59c1('0x14')](_0x59c1('0x11'),_0x310259,_0x5b957d[_0x59c1('0x14')][_0x59c1('0x15')]);return _0x334d5a(_0x5b957d[_0x59c1('0x14')][_0x59c1('0x15')]);}logger[_0x59c1('0x14')](_0x59c1('0x11'),_0x310259,_0x5b957d['error'][_0x59c1('0x15')]);return _0x77b746(_0x5b957d[_0x59c1('0x14')][_0x59c1('0x15')]);}else{logger[_0x59c1('0x16')](_0x59c1('0x11'),_0x310259,_0x59c1('0x12'));_0x77b746(_0x5b957d[_0x59c1('0x17')][_0x59c1('0x15')]);}})[_0x59c1('0x18')](function(_0x59f0ee){logger['error'](_0x59c1('0x11'),_0x310259,_0x59f0ee);_0x334d5a(_0x59f0ee);});});}function respondWithStatusCode(_0x65e9e1,_0xcf8307){_0xcf8307=_0xcf8307||0xcc;return function(_0x39a2fb){if(_0x39a2fb){return _0x65e9e1[_0x59c1('0x19')](_0xcf8307);}return _0x65e9e1[_0x59c1('0x1a')](_0xcf8307)[_0x59c1('0x1b')]();};}function respondWithResult(_0xe04c35,_0x4fce3c){_0x4fce3c=_0x4fce3c||0xc8;return function(_0x11b46f){if(_0x11b46f){return _0xe04c35[_0x59c1('0x1a')](_0x4fce3c)[_0x59c1('0x1c')](_0x11b46f);}};}function respondWithFilteredResult(_0x10ed7f,_0x51e1c5){return function(_0x47fdd6){if(_0x47fdd6){var _0x3143ad=typeof _0x51e1c5[_0x59c1('0x1d')]==='undefined'&&typeof _0x51e1c5[_0x59c1('0x1e')]===_0x59c1('0x1f');var _0xc84d06=_0x47fdd6['count'];var _0x2cc563=_0x3143ad?0x0:_0x51e1c5[_0x59c1('0x1d')];var _0x3cdd3e=_0x3143ad?_0x47fdd6[_0x59c1('0x20')]:_0x51e1c5[_0x59c1('0x1d')]+_0x51e1c5['limit'];var _0x5049f5;if(_0x3cdd3e>=_0xc84d06){_0x3cdd3e=_0xc84d06;_0x5049f5=0xc8;}else{_0x5049f5=0xce;}_0x10ed7f[_0x59c1('0x1a')](_0x5049f5);return _0x10ed7f[_0x59c1('0x21')](_0x59c1('0x22'),_0x2cc563+'-'+_0x3cdd3e+'/'+_0xc84d06)[_0x59c1('0x1c')](_0x47fdd6);}return null;};}function saveUpdates(_0x3ff547){return function(_0x503ebe){if(_0x503ebe){return _0x503ebe[_0x59c1('0x23')](_0x3ff547)['then'](function(_0x1835da){return _0x1835da;});}return null;};}function removeEntity(_0x9392ac){return function(_0x55d6f6){if(_0x55d6f6){return _0x55d6f6[_0x59c1('0x24')]()['then'](function(){var _0x40b9ff=_0x55d6f6[_0x59c1('0x25')]({'plain':!![]});var _0x2eaad1=_0x59c1('0x26');return db[_0x59c1('0x27')][_0x59c1('0x24')]({'where':{'type':_0x2eaad1,'resourceId':_0x40b9ff['id']}})[_0x59c1('0x10')](function(){return _0x55d6f6;});})[_0x59c1('0x10')](function(){_0x9392ac[_0x59c1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11d484){return function(_0x4a7681){if(!_0x4a7681){_0x11d484[_0x59c1('0x19')](0x194);}return _0x4a7681;};}function handleError(_0x326de0,_0x3b5804){_0x3b5804=_0x3b5804||0x1f4;return function(_0x5becd8){logger['error'](_0x5becd8[_0x59c1('0x28')]);if(_0x5becd8[_0x59c1('0x29')]){delete _0x5becd8[_0x59c1('0x29')];}_0x326de0[_0x59c1('0x1a')](_0x3b5804)[_0x59c1('0x2a')](_0x5becd8);};}function getImapHost(_0x24aac3){switch(_0x24aac3){case _0x59c1('0x2b'):return _0x59c1('0x2c');case _0x59c1('0x2d'):return _0x59c1('0x2e');case _0x59c1('0x2f'):return _0x59c1('0x30');case _0x59c1('0x31'):return _0x59c1('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x24aac3);}function getSmtpHost(_0x250c25){switch(_0x250c25){case _0x59c1('0x2b'):return _0x59c1('0x33');case _0x59c1('0x2d'):return _0x59c1('0x34');case'hotmail':return _0x59c1('0x35');case _0x59c1('0x31'):return'smtp.office365.com';}throw new Error(_0x59c1('0x36'),_0x250c25);}function getAuthenticationOptions(_0x3f9cf8,_0x211cd6){var _0x50bb9e={};var _0x401606={};if(_0x3f9cf8){_0x50bb9e['user']=_0x401606[_0x59c1('0x37')]=_0x211cd6['username'];_0x50bb9e[_0x59c1('0x38')]=_0x401606['pass']=_0x211cd6[_0x59c1('0x38')];if(_0x211cd6['modernAuthentication']){_0x50bb9e[_0x59c1('0x39')]=_0x401606[_0x59c1('0x39')]=!![];_0x50bb9e[_0x59c1('0x3a')]=_0x401606[_0x59c1('0x3a')]=_0x211cd6[_0x59c1('0x3a')];_0x50bb9e['password']=_0x401606[_0x59c1('0x3b')]=null;}else{_0x50bb9e[_0x59c1('0x3a')]=_0x401606[_0x59c1('0x3a')]=null;}_0x50bb9e[_0x59c1('0x3c')]=getImapHost(_0x3f9cf8);_0x50bb9e[_0x59c1('0x3d')]=0x3e1;_0x401606[_0x59c1('0x3c')]=getSmtpHost(_0x3f9cf8);_0x401606[_0x59c1('0x3d')]=0x24b;_0x401606['secure']=![];_0x50bb9e[_0x59c1('0x3e')]=_0x401606[_0x59c1('0x3e')]=null;}else{if(_0x211cd6[_0x59c1('0x3f')]){_0x50bb9e['user']=_0x401606[_0x59c1('0x37')]=_0x211cd6[_0x59c1('0x40')];_0x50bb9e[_0x59c1('0x38')]=_0x401606[_0x59c1('0x3b')]=_0x211cd6['password'];}else{_0x50bb9e[_0x59c1('0x3f')]=_0x401606[_0x59c1('0x3f')]=![];_0x50bb9e[_0x59c1('0x37')]=_0x401606[_0x59c1('0x37')]=null;_0x50bb9e[_0x59c1('0x38')]=_0x401606[_0x59c1('0x3b')]=null;}_0x50bb9e[_0x59c1('0x3c')]=_0x211cd6['Imap'][_0x59c1('0x3c')];_0x50bb9e[_0x59c1('0x3d')]=_0x211cd6[_0x59c1('0x41')][_0x59c1('0x3d')];_0x401606[_0x59c1('0x3c')]=_0x211cd6[_0x59c1('0x42')]['host'];_0x401606[_0x59c1('0x3d')]=_0x211cd6['Smtp'][_0x59c1('0x3d')];}return{'Imap':_0x50bb9e,'Smtp':_0x401606};}exports['index']=function(_0xd14660,_0x460b27){var _0x316559={'include':[{'model':db[_0x59c1('0x43')],'as':_0x59c1('0x41')},{'model':db[_0x59c1('0x44')],'as':_0x59c1('0x42')},{'model':db[_0x59c1('0x45')],'as':'mandatoryDispositionPause'}]},_0xcb56d5={},_0x49e8c1={'count':0x0,'rows':[]};var _0x420de6=_[_0x59c1('0x46')](db[_0x59c1('0x47')][_0x59c1('0x48')],function(_0x2e1620){return{'name':_0x2e1620[_0x59c1('0x49')],'type':_0x2e1620['type'][_0x59c1('0x4a')]};});_0xcb56d5[_0x59c1('0x4b')]=_['map'](_0x420de6,_0x59c1('0x29'));_0xcb56d5[_0x59c1('0x4c')]=_['keys'](_0xd14660[_0x59c1('0x4c')]);_0xcb56d5[_0x59c1('0x4d')]=_[_0x59c1('0x4e')](_0xcb56d5['model'],_0xcb56d5[_0x59c1('0x4c')]);_0x316559[_0x59c1('0x4f')]=_['intersection'](_0xcb56d5[_0x59c1('0x4b')],qs[_0x59c1('0x50')](_0xd14660[_0x59c1('0x4c')][_0x59c1('0x50')]));_0x316559['attributes']=_0x316559['attributes']['length']?_0x316559[_0x59c1('0x4f')]:_0xcb56d5[_0x59c1('0x4b')];if(!_0xd14660[_0x59c1('0x4c')][_0x59c1('0x51')](_0x59c1('0x52'))){_0x316559[_0x59c1('0x1e')]=qs[_0x59c1('0x1e')](_0xd14660['query'][_0x59c1('0x1e')]);_0x316559[_0x59c1('0x1d')]=qs[_0x59c1('0x1d')](_0xd14660[_0x59c1('0x4c')][_0x59c1('0x1d')]);}_0x316559[_0x59c1('0x53')]=qs[_0x59c1('0x54')](_0xd14660[_0x59c1('0x4c')][_0x59c1('0x54')]);_0x316559['where']=qs['filters'](_['pick'](_0xd14660[_0x59c1('0x4c')],_0xcb56d5[_0x59c1('0x4d')]),_0x420de6);if(_0xd14660[_0x59c1('0x4c')][_0x59c1('0x55')]){_0x316559[_0x59c1('0x56')]=_[_0x59c1('0x57')](_0x316559[_0x59c1('0x56')],{'$or':_[_0x59c1('0x46')](_0x420de6,function(_0x1dfe22){if(_0x1dfe22[_0x59c1('0x58')]!==_0x59c1('0x59')){var _0x37427e={};_0x37427e[_0x1dfe22[_0x59c1('0x29')]]={'$like':'%'+_0xd14660['query']['filter']+'%'};return _0x37427e;}})});}_0x316559=_[_0x59c1('0x57')]({},_0x316559,_0xd14660[_0x59c1('0x5a')]);var _0x1e1ca9={'where':_0x316559[_0x59c1('0x56')]};return db['MailAccount']['count'](_0x1e1ca9)[_0x59c1('0x10')](function(_0x47d752){_0x49e8c1[_0x59c1('0x20')]=_0x47d752;if(_0xd14660['query'][_0x59c1('0x5b')]){_0x316559[_0x59c1('0x5c')]=[{'all':!![]}];}return db[_0x59c1('0x47')][_0x59c1('0x5d')](_0x316559);})[_0x59c1('0x10')](function(_0x11daae){_0x49e8c1[_0x59c1('0x5e')]=_0x11daae;return _0x49e8c1;})[_0x59c1('0x10')](respondWithFilteredResult(_0x460b27,_0x316559))[_0x59c1('0x18')](handleError(_0x460b27,null));};exports[_0x59c1('0x5f')]=function(_0x475c67,_0xc6046f){var _0x11eeec={'raw':![],'where':{'id':_0x475c67[_0x59c1('0x60')]['id']},'include':[{'model':db[_0x59c1('0x43')],'as':_0x59c1('0x41')},{'model':db[_0x59c1('0x44')],'as':'Smtp'},{'model':db[_0x59c1('0x45')],'as':'mandatoryDispositionPause'}]},_0x464be6={};_0x464be6[_0x59c1('0x4b')]=_[_0x59c1('0x61')](db[_0x59c1('0x47')][_0x59c1('0x48')]);_0x464be6[_0x59c1('0x4c')]=_[_0x59c1('0x61')](_0x475c67[_0x59c1('0x4c')]);_0x464be6[_0x59c1('0x4d')]=_[_0x59c1('0x4e')](_0x464be6[_0x59c1('0x4b')],_0x464be6[_0x59c1('0x4c')]);_0x11eeec[_0x59c1('0x4f')]=_[_0x59c1('0x4e')](_0x464be6[_0x59c1('0x4b')],qs[_0x59c1('0x50')](_0x475c67['query'][_0x59c1('0x50')]));_0x11eeec[_0x59c1('0x4f')]=_0x11eeec[_0x59c1('0x4f')]['length']?_0x11eeec['attributes']:_0x464be6[_0x59c1('0x4b')];if(_0x475c67[_0x59c1('0x4c')]['includeAll']){_0x11eeec['include']=[{'all':!![]}];}_0x11eeec=_[_0x59c1('0x57')]({},_0x11eeec,_0x475c67[_0x59c1('0x5a')]);return db[_0x59c1('0x47')]['find'](_0x11eeec)['then'](handleEntityNotFound(_0xc6046f,null))['then'](respondWithResult(_0xc6046f,null))[_0x59c1('0x18')](handleError(_0xc6046f,null));};exports[_0x59c1('0x23')]=function(_0x17f506,_0x380141){if(_0x17f506[_0x59c1('0x62')]['id']){delete _0x17f506[_0x59c1('0x62')]['id'];}var _0x361b2d=_0x17f506[_0x59c1('0x62')][_0x59c1('0x63')]===_0x59c1('0x64')?null:_0x17f506['body'][_0x59c1('0x63')];var _0x5a273d=_0x17f506['body']['Imap']||{};var _0x55be0c=_0x17f506['body']['Smtp']||{};if(_0x361b2d){_0x5a273d[_0x59c1('0x3c')]=getImapHost(_0x361b2d);_0x5a273d[_0x59c1('0x3d')]=0x3e1;_0x55be0c[_0x59c1('0x3c')]=getSmtpHost(_0x361b2d);_0x55be0c[_0x59c1('0x3d')]=0x24b;_0x55be0c[_0x59c1('0x65')]=![];}if(_0x55be0c[_0x59c1('0x39')]){_0x55be0c[_0x59c1('0x65')]=![];}else{_0x55be0c[_0x59c1('0x3a')]=null;}if(!_0x5a273d['modernAuthentication'])_0x5a273d[_0x59c1('0x3a')]=null;_0x17f506[_0x59c1('0x62')][_0x59c1('0x41')]=_0x5a273d;_0x17f506['body'][_0x59c1('0x42')]=_0x55be0c;return db['MailAccount'][_0x59c1('0x66')]({'where':{'id':_0x17f506['params']['id']},'include':[{'model':db[_0x59c1('0x43')],'as':'Imap'},{'model':db[_0x59c1('0x44')],'as':_0x59c1('0x42')},{'model':db['Pause'],'as':_0x59c1('0x67')}]})[_0x59c1('0x10')](handleEntityNotFound(_0x380141,null))[_0x59c1('0x10')](function(_0x197257){if(!_0x197257)throw new Error(_0x59c1('0x68'));if(_0x197257[_0x59c1('0x3e')])delete _0x17f506[_0x59c1('0x62')]['Imap'];return _0x197257;})[_0x59c1('0x10')](saveUpdates(_0x17f506['body'],null))['then'](function(_0x4edd3a){if(!_0x17f506['body']['Imap'])return _0x4edd3a;return db['MailServerIn'][_0x59c1('0x23')](_0x17f506[_0x59c1('0x62')][_0x59c1('0x41')],{'where':{'MailAccountId':_0x4edd3a['id']}})[_0x59c1('0x10')](function(){return _0x4edd3a;});})[_0x59c1('0x10')](function(_0xb188f3){if(!_0x17f506[_0x59c1('0x62')]['Smtp'])return _0xb188f3;return db[_0x59c1('0x44')][_0x59c1('0x23')](_0x17f506[_0x59c1('0x62')]['Smtp'],{'where':{'MailAccountId':_0xb188f3['id']}})[_0x59c1('0x10')](function(){return _0xb188f3;});})[_0x59c1('0x10')](respondWithResult(_0x380141,null))[_0x59c1('0x18')](handleError(_0x380141,null));};exports[_0x59c1('0x69')]=function(_0x1482d2,_0x3804aa){return db[_0x59c1('0x47')]['describe']()[_0x59c1('0x10')](respondWithResult(_0x3804aa,null))[_0x59c1('0x18')](handleError(_0x3804aa,null));};exports[_0x59c1('0x6a')]=function(_0x3083c6,_0x2ab1d4){if(_0x3083c6[_0x59c1('0x62')]['id']){delete _0x3083c6['body']['id'];}return db[_0x59c1('0x47')][_0x59c1('0x66')]({'where':{'id':_0x3083c6[_0x59c1('0x60')]['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x2ab1d4,null))[_0x59c1('0x10')](function(_0x54fd20){if(_0x54fd20){_0x3083c6[_0x59c1('0x62')]['MailAccountId']=_0x54fd20['id'];return db['Disposition'][_0x59c1('0x6b')](_0x3083c6['body']);}})[_0x59c1('0x10')](respondWithResult(_0x2ab1d4,null))[_0x59c1('0x18')](handleError(_0x2ab1d4,null));};exports[_0x59c1('0x6c')]=function(_0x852686,_0xe4a9b7){var _0x4be867={'raw':![],'where':{}};var _0x751b58={};var _0xc580c1={'count':0x0,'rows':[]};return db[_0x59c1('0x47')][_0x59c1('0x6d')]({'where':{'id':_0x852686['params']['id']}})['then'](handleEntityNotFound(_0xe4a9b7,null))[_0x59c1('0x10')](function(_0x263510){if(_0x263510){_0x751b58[_0x59c1('0x4b')]=_[_0x59c1('0x61')](db[_0x59c1('0x6e')]['rawAttributes']);_0x751b58[_0x59c1('0x4c')]=_[_0x59c1('0x61')](_0x852686[_0x59c1('0x4c')]);_0x751b58[_0x59c1('0x4d')]=_[_0x59c1('0x4e')](_0x751b58[_0x59c1('0x4b')],_0x751b58[_0x59c1('0x4c')]);_0x4be867[_0x59c1('0x4f')]=_['intersection'](_0x751b58[_0x59c1('0x4b')],qs[_0x59c1('0x50')](_0x852686['query'][_0x59c1('0x50')]));_0x4be867['attributes']=_0x4be867['attributes'][_0x59c1('0x6f')]?_0x4be867[_0x59c1('0x4f')]:_0x751b58[_0x59c1('0x4b')];if(!_0x852686[_0x59c1('0x4c')][_0x59c1('0x51')](_0x59c1('0x52'))){_0x4be867[_0x59c1('0x1e')]=qs['limit'](_0x852686['query'][_0x59c1('0x1e')]);_0x4be867[_0x59c1('0x1d')]=qs[_0x59c1('0x1d')](_0x852686[_0x59c1('0x4c')][_0x59c1('0x1d')]);}_0x4be867[_0x59c1('0x53')]=qs[_0x59c1('0x54')](_0x852686[_0x59c1('0x4c')][_0x59c1('0x54')]);_0x4be867['where']=qs[_0x59c1('0x4d')](_[_0x59c1('0x70')](_0x852686['query'],_0x751b58['filters']));_0x4be867['where'][_0x59c1('0x71')]=_0x263510['id'];if(_0x852686[_0x59c1('0x4c')][_0x59c1('0x55')]){_0x4be867[_0x59c1('0x56')]=_[_0x59c1('0x57')](_0x4be867[_0x59c1('0x56')],{'$or':_[_0x59c1('0x46')](_0x4be867[_0x59c1('0x4f')],function(_0x5760b1){var _0x517588={};_0x517588[_0x5760b1]={'$like':'%'+_0x852686[_0x59c1('0x4c')]['filter']+'%'};return _0x517588;})});}_0x4be867=_[_0x59c1('0x57')]({},_0x4be867,_0x852686[_0x59c1('0x5a')]);return db[_0x59c1('0x6e')]['count']({'where':_0x4be867['where']})['then'](function(_0x310d32){_0xc580c1[_0x59c1('0x20')]=_0x310d32;if(_0x852686['query']['includeAll']){_0x4be867['include']=[{'all':!![]}];}return db[_0x59c1('0x6e')][_0x59c1('0x5d')](_0x4be867);})[_0x59c1('0x10')](function(_0x50f3c5){_0xc580c1['rows']=_0x50f3c5;return _0xc580c1;});}})[_0x59c1('0x10')](respondWithFilteredResult(_0xe4a9b7,_0x4be867))[_0x59c1('0x18')](handleError(_0xe4a9b7,null));};exports[_0x59c1('0x72')]=function(_0x131797,_0x237807){return db[_0x59c1('0x47')][_0x59c1('0x66')]({'where':{'id':_0x131797[_0x59c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x237807,null))[_0x59c1('0x10')](function(_0x699335){if(_0x699335){return _0x699335[_0x59c1('0x72')](_0x131797[_0x59c1('0x4c')]['ids']);}})[_0x59c1('0x10')](respondWithStatusCode(_0x237807,null))['catch'](handleError(_0x237807,null));};exports[_0x59c1('0x73')]=function(_0x12936a,_0x15a2d1){if(_0x12936a[_0x59c1('0x62')]['id']){delete _0x12936a[_0x59c1('0x62')]['id'];}return db[_0x59c1('0x47')][_0x59c1('0x66')]({'where':{'id':_0x12936a[_0x59c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x15a2d1,null))['then'](function(_0x15bf6c){if(_0x15bf6c){_0x12936a[_0x59c1('0x62')]['MailAccountId']=_0x15bf6c['id'];return db['CannedAnswer'][_0x59c1('0x6b')](_0x12936a[_0x59c1('0x62')]);}})[_0x59c1('0x10')](respondWithResult(_0x15a2d1,null))['catch'](handleError(_0x15a2d1,null));};exports[_0x59c1('0x74')]=function(_0x2645cc,_0x4b3ebd){var _0x1be7fe={'raw':![],'where':{}};var _0x4893d8={};var _0x169910={'count':0x0,'rows':[]};return db[_0x59c1('0x47')][_0x59c1('0x6d')]({'where':{'id':_0x2645cc['params']['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x4b3ebd,null))['then'](function(_0xd7f49d){if(_0xd7f49d){_0x4893d8[_0x59c1('0x4b')]=_[_0x59c1('0x61')](db[_0x59c1('0x75')][_0x59c1('0x48')]);_0x4893d8['query']=_['keys'](_0x2645cc[_0x59c1('0x4c')]);_0x4893d8['filters']=_[_0x59c1('0x4e')](_0x4893d8[_0x59c1('0x4b')],_0x4893d8['query']);_0x1be7fe[_0x59c1('0x4f')]=_[_0x59c1('0x4e')](_0x4893d8['model'],qs[_0x59c1('0x50')](_0x2645cc[_0x59c1('0x4c')]['fields']));_0x1be7fe['attributes']=_0x1be7fe[_0x59c1('0x4f')]['length']?_0x1be7fe[_0x59c1('0x4f')]:_0x4893d8[_0x59c1('0x4b')];if(!_0x2645cc[_0x59c1('0x4c')]['hasOwnProperty'](_0x59c1('0x52'))){_0x1be7fe['limit']=qs['limit'](_0x2645cc['query'][_0x59c1('0x1e')]);_0x1be7fe[_0x59c1('0x1d')]=qs[_0x59c1('0x1d')](_0x2645cc[_0x59c1('0x4c')][_0x59c1('0x1d')]);}_0x1be7fe[_0x59c1('0x53')]=qs[_0x59c1('0x54')](_0x2645cc['query'][_0x59c1('0x54')]);_0x1be7fe[_0x59c1('0x56')]=qs['filters'](_[_0x59c1('0x70')](_0x2645cc[_0x59c1('0x4c')],_0x4893d8['filters']));_0x1be7fe[_0x59c1('0x56')][_0x59c1('0x71')]=_0xd7f49d['id'];if(_0x2645cc[_0x59c1('0x4c')][_0x59c1('0x55')]){_0x1be7fe[_0x59c1('0x56')]=_[_0x59c1('0x57')](_0x1be7fe[_0x59c1('0x56')],{'$or':_[_0x59c1('0x46')](_0x1be7fe[_0x59c1('0x4f')],function(_0x24093d){var _0x32077a={};_0x32077a[_0x24093d]={'$like':'%'+_0x2645cc['query'][_0x59c1('0x55')]+'%'};return _0x32077a;})});}_0x1be7fe=_[_0x59c1('0x57')]({},_0x1be7fe,_0x2645cc['options']);return db['CannedAnswer'][_0x59c1('0x20')]({'where':_0x1be7fe[_0x59c1('0x56')]})[_0x59c1('0x10')](function(_0x2bba8f){_0x169910[_0x59c1('0x20')]=_0x2bba8f;if(_0x2645cc[_0x59c1('0x4c')][_0x59c1('0x5b')]){_0x1be7fe[_0x59c1('0x5c')]=[{'all':!![]}];}return db[_0x59c1('0x75')][_0x59c1('0x5d')](_0x1be7fe);})['then'](function(_0x2ed44b){_0x169910[_0x59c1('0x5e')]=_0x2ed44b;return _0x169910;});}})[_0x59c1('0x10')](respondWithFilteredResult(_0x4b3ebd,_0x1be7fe))[_0x59c1('0x18')](handleError(_0x4b3ebd,null));};exports['removeAnswers']=function(_0x2908bc,_0x206cd5){return db[_0x59c1('0x47')][_0x59c1('0x66')]({'where':{'id':_0x2908bc[_0x59c1('0x60')]['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x206cd5,null))['then'](function(_0x3f484d){if(_0x3f484d){return _0x3f484d[_0x59c1('0x76')](_0x2908bc[_0x59c1('0x4c')][_0x59c1('0x77')]);}})[_0x59c1('0x10')](respondWithStatusCode(_0x206cd5,null))[_0x59c1('0x18')](handleError(_0x206cd5,null));};exports[_0x59c1('0x6b')]=function(_0x2b36dc,_0x195ff9){var _0x32b484={'name':_0x2b36dc['body'][_0x59c1('0x29')],'key':_0x2b36dc[_0x59c1('0x62')][_0x59c1('0x4a')],'provider':_0x2b36dc[_0x59c1('0x62')][_0x59c1('0x63')]===_0x59c1('0x64')?null:_0x2b36dc[_0x59c1('0x62')][_0x59c1('0x63')],'email':_0x2b36dc['body'][_0x59c1('0x78')],'ListId':_0x2b36dc[_0x59c1('0x62')][_0x59c1('0x79')],'active':!_[_0x59c1('0x7a')](_0x2b36dc['body'][_0x59c1('0x7b')])?_0x2b36dc['body'][_0x59c1('0x7b')]:!![],'description':_0x2b36dc[_0x59c1('0x62')]['description']||null};var _0x5deec9=getAuthenticationOptions(_0x32b484[_0x59c1('0x63')],_0x2b36dc[_0x59c1('0x62')]);_0x32b484['Imap']=_0x5deec9[_0x59c1('0x41')];_0x32b484[_0x59c1('0x42')]=_0x5deec9[_0x59c1('0x42')];return db[_0x59c1('0x47')][_0x59c1('0x6b')](_0x32b484,{'include':[{'model':db[_0x59c1('0x44')],'as':_0x59c1('0x42')},{'model':db[_0x59c1('0x43')],'as':_0x59c1('0x41')}]})['then'](function(_0x545307){var _0x47c0c3=_0x2b36dc['user'][_0x59c1('0x25')]({'plain':!![]});if(!_0x47c0c3)throw new Error(_0x59c1('0x7c'));if(_0x47c0c3[_0x59c1('0x7d')]===_0x59c1('0x37')){var _0x2e2a59=_0x545307[_0x59c1('0x25')]({'plain':!![]});return db[_0x59c1('0x7e')][_0x59c1('0x66')]({'where':{'name':'MailAccounts','userProfileId':_0x47c0c3[_0x59c1('0x7f')]},'raw':!![]})[_0x59c1('0x10')](function(_0x114f86){if(_0x114f86&&_0x114f86[_0x59c1('0x80')]===0x0){return db[_0x59c1('0x27')][_0x59c1('0x6b')]({'name':_0x2e2a59['name'],'resourceId':_0x2e2a59['id'],'type':_0x114f86['name'],'sectionId':_0x114f86['id']},{})[_0x59c1('0x10')](function(){return _0x545307;});}else{return _0x545307;}})[_0x59c1('0x18')](function(_0x5378ba){logger[_0x59c1('0x14')](_0x59c1('0x81'),_0x5378ba);throw _0x5378ba;});}return _0x545307;})[_0x59c1('0x10')](respondWithResult(_0x195ff9,0xc9))[_0x59c1('0x18')](handleError(_0x195ff9,null));};exports[_0x59c1('0x82')]=function(_0x110267,_0x242517){return db[_0x59c1('0x47')]['findOne']({'where':{'id':_0x110267[_0x59c1('0x60')]['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x242517,null))[_0x59c1('0x10')](function(_0x34fcd6){if(_0x34fcd6){return _0x34fcd6[_0x59c1('0x82')]();}return null;})[_0x59c1('0x10')](respondWithResult(_0x242517,null))[_0x59c1('0x18')](handleError(_0x242517,null));};exports[_0x59c1('0x83')]=function(_0x312975,_0x4a3224){if(_0x312975[_0x59c1('0x62')]['id']){delete _0x312975[_0x59c1('0x62')]['id'];}return db['MailAccount'][_0x59c1('0x66')]({'where':{'id':_0x312975[_0x59c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x4a3224,null))[_0x59c1('0x10')](function(_0x5aa63d){if(_0x5aa63d){_0x312975['body'][_0x59c1('0x71')]=_0x5aa63d['id'];return db['MailServerIn'][_0x59c1('0x6b')](_0x312975[_0x59c1('0x62')]);}})[_0x59c1('0x10')](respondWithResult(_0x4a3224,null))[_0x59c1('0x18')](handleError(_0x4a3224,null));};exports[_0x59c1('0x84')]=function(_0x317fa2,_0x18e462){return db[_0x59c1('0x47')][_0x59c1('0x6d')]({'where':{'id':_0x317fa2[_0x59c1('0x60')]['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x18e462,null))['then'](function(_0x1a6df8){if(_0x1a6df8){return _0x1a6df8['setImap'](null);}return null;})[_0x59c1('0x10')](respondWithStatusCode(_0x18e462,null))[_0x59c1('0x18')](handleError(_0x18e462,null));};exports[_0x59c1('0x85')]=function(_0x56dfe7,_0x1c536d){return db[_0x59c1('0x47')][_0x59c1('0x6d')]({'where':{'id':_0x56dfe7[_0x59c1('0x60')]['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x1c536d,null))['then'](function(_0x378fa9){if(_0x378fa9){return _0x378fa9['getSmtp']();}return null;})[_0x59c1('0x10')](respondWithResult(_0x1c536d,null))[_0x59c1('0x18')](handleError(_0x1c536d,null));};exports[_0x59c1('0x86')]=function(_0x1e51ab,_0x248e44){if(_0x1e51ab[_0x59c1('0x62')]['id']){delete _0x1e51ab[_0x59c1('0x62')]['id'];}return db[_0x59c1('0x47')][_0x59c1('0x66')]({'where':{'id':_0x1e51ab[_0x59c1('0x60')]['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x248e44,null))[_0x59c1('0x10')](function(_0x13b6a6){if(_0x13b6a6){_0x1e51ab['body'][_0x59c1('0x71')]=_0x13b6a6['id'];return db[_0x59c1('0x44')][_0x59c1('0x6b')](_0x1e51ab[_0x59c1('0x62')]);}})[_0x59c1('0x10')](respondWithResult(_0x248e44,null))[_0x59c1('0x18')](handleError(_0x248e44,null));};exports[_0x59c1('0x87')]=function(_0x3df8fc,_0x1c9ca3){return db[_0x59c1('0x47')][_0x59c1('0x6d')]({'where':{'id':_0x3df8fc['params']['id']}})['then'](handleEntityNotFound(_0x1c9ca3,null))['then'](function(_0x44b6f5){if(_0x44b6f5){return _0x44b6f5[_0x59c1('0x88')](null);}return null;})[_0x59c1('0x10')](respondWithStatusCode(_0x1c9ca3,null))[_0x59c1('0x18')](handleError(_0x1c9ca3,null));};exports['addInteraction']=function(_0x5a87ee,_0x3bf02a){return db[_0x59c1('0x89')][_0x59c1('0x66')]({'where':{'id':_0x5a87ee[_0x59c1('0x60')]['id']}})['then'](handleEntityNotFound(_0x3bf02a,null))[_0x59c1('0x10')](function(_0x46be0f){if(_0x46be0f){return _0x46be0f[_0x59c1('0x8a')](_0x5a87ee[_0x59c1('0x62')]['ids'],_[_0x59c1('0x8b')](_0x5a87ee[_0x59c1('0x62')],[_0x59c1('0x77'),'id'])||{});}})[_0x59c1('0x10')](respondWithResult(_0x3bf02a,null))[_0x59c1('0x18')](handleError(_0x3bf02a,null));};exports['getInteractions']=function(_0x1db861,_0x5b4a7a){var _0xeb1059={'raw':![],'where':{}};var _0x247316={};var _0x46d70f={'count':0x0,'rows':[]};return db['MailAccount'][_0x59c1('0x6d')]({'where':{'id':_0x1db861[_0x59c1('0x60')]['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x5b4a7a,null))[_0x59c1('0x10')](function(_0x5a58b3){if(_0x5a58b3){_0x247316[_0x59c1('0x4b')]=_['keys'](db[_0x59c1('0x89')][_0x59c1('0x48')]);_0x247316[_0x59c1('0x4c')]=_['keys'](_0x1db861[_0x59c1('0x4c')]);_0x247316[_0x59c1('0x4d')]=_[_0x59c1('0x4e')](_0x247316[_0x59c1('0x4b')],_0x247316[_0x59c1('0x4c')]);_0xeb1059[_0x59c1('0x4f')]=_[_0x59c1('0x4e')](_0x247316[_0x59c1('0x4b')],qs[_0x59c1('0x50')](_0x1db861['query']['fields']));_0xeb1059[_0x59c1('0x4f')]=_0xeb1059[_0x59c1('0x4f')][_0x59c1('0x6f')]?_0xeb1059[_0x59c1('0x4f')]:_0x247316['model'];if(!_0x1db861[_0x59c1('0x4c')][_0x59c1('0x51')](_0x59c1('0x52'))){_0xeb1059[_0x59c1('0x1e')]=qs[_0x59c1('0x1e')](_0x1db861[_0x59c1('0x4c')][_0x59c1('0x1e')]);_0xeb1059['offset']=qs['offset'](_0x1db861[_0x59c1('0x4c')][_0x59c1('0x1d')]);}_0xeb1059[_0x59c1('0x53')]=qs['sort'](_0x1db861[_0x59c1('0x4c')]['sort']);_0xeb1059[_0x59c1('0x56')]=qs[_0x59c1('0x4d')](_[_0x59c1('0x70')](_0x1db861[_0x59c1('0x4c')],_0x247316[_0x59c1('0x4d')]));_0xeb1059[_0x59c1('0x56')][_0x59c1('0x71')]=_0x5a58b3['id'];if(_0x1db861[_0x59c1('0x4c')][_0x59c1('0x55')]){_0xeb1059[_0x59c1('0x56')]=_['merge'](_0xeb1059[_0x59c1('0x56')],{'$or':_['map'](_0xeb1059[_0x59c1('0x4f')],function(_0x2b69db){var _0x3a7feb={};_0x3a7feb[_0x2b69db]={'$like':'%'+_0x1db861[_0x59c1('0x4c')][_0x59c1('0x55')]+'%'};return _0x3a7feb;})});}_0xeb1059=_[_0x59c1('0x57')]({},_0xeb1059,_0x1db861['options']);return db['MailInteraction']['count']({'where':_0xeb1059['where']})[_0x59c1('0x10')](function(_0x2f6372){_0x46d70f[_0x59c1('0x20')]=_0x2f6372;if(_0x1db861[_0x59c1('0x4c')]['includeAll']){_0xeb1059[_0x59c1('0x5c')]=[{'model':db[_0x59c1('0x8c')],'as':_0x59c1('0x8d'),'required':![]},{'model':db[_0x59c1('0x8e')],'as':_0x59c1('0x8f'),'attributes':['name','fullname',_0x59c1('0x90')],'required':![]},{'model':db[_0x59c1('0x91')],'as':_0x59c1('0x92'),'attributes':['id',_0x59c1('0x29'),_0x59c1('0x93')],'where':_0x1db861[_0x59c1('0x4c')][_0x59c1('0x94')]?{'id':_0x1db861['query'][_0x59c1('0x94')]}:undefined,'required':_0x1db861[_0x59c1('0x4c')][_0x59c1('0x94')]?!![]:![]}];}return db[_0x59c1('0x89')]['findAll'](_0xeb1059);})['then'](function(_0x21b939){_0x46d70f[_0x59c1('0x5e')]=_0x21b939;return _0x46d70f;});}})[_0x59c1('0x10')](respondWithFilteredResult(_0x5b4a7a,_0xeb1059))['catch'](handleError(_0x5b4a7a,null));};exports[_0x59c1('0x95')]=function addApplications(_0x14d2b4,_0x11688f){var _0x251163=_0x14d2b4[_0x59c1('0x60')]['id'];var _0x2aaafa=_0x14d2b4['body'];var _0x164305=0xc8;var _0x3106f7=null;return db[_0x59c1('0x96')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0x59c1('0x97')][_0x59c1('0x98')]},function(_0xc65d24){return db[_0x59c1('0x47')]['findOne']({'where':{'id':_0x251163},'transaction':_0xc65d24})[_0x59c1('0x10')](function(_0x38b029){if(_0x38b029){return db[_0x59c1('0x99')][_0x59c1('0x24')]({'where':{'MailAccountId':_0x251163},'transaction':_0xc65d24})[_0x59c1('0x10')](function(){var _0x59f21e=_[_0x59c1('0x46')](_0x2aaafa,function(_0x2c60bc){_0x2c60bc[_0x59c1('0x71')]=_0x251163;return _0x2c60bc;});return db[_0x59c1('0x99')][_0x59c1('0x9a')](_0x59f21e,{'transaction':_0xc65d24});});}else{_0x164305=0x194;_0x3106f7=[];}});})[_0x59c1('0x10')](function(){if(_0x164305!==0x194){return db[_0x59c1('0x99')][_0x59c1('0x9b')]({'where':{'MailAccountId':_0x251163},'order':_0x59c1('0x9c')})['then'](function(_0x5eaf12){_0x3106f7=_0x5eaf12;});}})[_0x59c1('0x18')](function(_0x45a97f){_0x164305=0x1f4;logger[_0x59c1('0x14')](_0x45a97f['stack']);if(_0x45a97f[_0x59c1('0x29')]){delete _0x45a97f['name'];}_0x3106f7=_0x45a97f;})[_0x59c1('0x9d')](function(){if(_0x3106f7===null){_0x11688f[_0x59c1('0x19')](_0x164305);}else{if(_0x164305===0x1f4){_0x11688f[_0x59c1('0x1a')](_0x164305)['send'](_0x3106f7);}else{_0x11688f[_0x59c1('0x1a')](_0x164305)['json'](_0x3106f7);}}});};exports['getApplications']=function(_0x5b5c12,_0x11eaad){var _0x298e16={};var _0x23cd42={};var _0x5d4d0c;var _0x52fd59;return db[_0x59c1('0x47')][_0x59c1('0x6d')]({'where':{'id':_0x5b5c12[_0x59c1('0x60')]['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x11eaad,null))[_0x59c1('0x10')](function(_0x37f2fb){if(_0x37f2fb){_0x5d4d0c=_0x37f2fb;_0x23cd42['model']=_['keys'](db[_0x59c1('0x99')][_0x59c1('0x48')]);_0x23cd42['query']=_[_0x59c1('0x61')](_0x5b5c12[_0x59c1('0x4c')]);_0x23cd42[_0x59c1('0x4d')]=_[_0x59c1('0x4e')](_0x23cd42[_0x59c1('0x4b')],_0x23cd42[_0x59c1('0x4c')]);_0x298e16[_0x59c1('0x4f')]=_[_0x59c1('0x4e')](_0x23cd42['model'],qs[_0x59c1('0x50')](_0x5b5c12[_0x59c1('0x4c')][_0x59c1('0x50')]));_0x298e16[_0x59c1('0x4f')]=_0x298e16['attributes'][_0x59c1('0x6f')]?_0x298e16[_0x59c1('0x4f')]:_0x23cd42[_0x59c1('0x4b')];_0x298e16['order']=qs[_0x59c1('0x54')](_0x5b5c12[_0x59c1('0x4c')]['sort']);_0x298e16['where']=qs[_0x59c1('0x4d')](_[_0x59c1('0x70')](_0x5b5c12[_0x59c1('0x4c')],_0x23cd42['filters']));if(_0x5b5c12['query'][_0x59c1('0x55')]){_0x298e16[_0x59c1('0x56')]=_['merge'](_0x298e16[_0x59c1('0x56')],{'$or':_[_0x59c1('0x46')](_0x298e16['attributes'],function(_0x29e7c4){var _0x597e9b={};_0x597e9b[_0x29e7c4]={'$like':'%'+_0x5b5c12[_0x59c1('0x4c')][_0x59c1('0x55')]+'%'};return _0x597e9b;})});}_0x298e16=_['merge']({},_0x298e16,_0x5b5c12[_0x59c1('0x5a')]);return _0x5d4d0c[_0x59c1('0x9e')](_0x298e16);}})[_0x59c1('0x10')](function(_0x4c0980){if(_0x4c0980){_0x52fd59=_0x4c0980[_0x59c1('0x6f')];if(!_0x5b5c12[_0x59c1('0x4c')]['hasOwnProperty'](_0x59c1('0x52'))){_0x298e16[_0x59c1('0x1e')]=qs[_0x59c1('0x1e')](_0x5b5c12[_0x59c1('0x4c')][_0x59c1('0x1e')]);_0x298e16['offset']=qs[_0x59c1('0x1d')](_0x5b5c12[_0x59c1('0x4c')][_0x59c1('0x1d')]);}return _0x5d4d0c['getApplications'](_0x298e16);}})[_0x59c1('0x10')](function(_0x106ccd){if(_0x106ccd){return _0x106ccd?{'count':_0x52fd59,'rows':_0x106ccd}:null;}})[_0x59c1('0x10')](respondWithResult(_0x11eaad,null))[_0x59c1('0x18')](handleError(_0x11eaad,null));};exports[_0x59c1('0x9f')]=function(_0x2dd26f,_0x1f2a36){var _0x1e588f={'raw':!![],'where':{}};var _0x263f58={};var _0x38ce6a={'count':0x0,'rows':[]};return db[_0x59c1('0x47')][_0x59c1('0x6d')]({'where':{'id':_0x2dd26f[_0x59c1('0x60')]['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x1f2a36,null))[_0x59c1('0x10')](function(_0x447343){if(_0x447343){_0x263f58['model']=_[_0x59c1('0x61')](db[_0x59c1('0xa0')][_0x59c1('0x48')]);_0x263f58[_0x59c1('0x4c')]=_[_0x59c1('0x61')](_0x2dd26f[_0x59c1('0x4c')]);_0x263f58[_0x59c1('0x4d')]=_[_0x59c1('0x4e')](_0x263f58[_0x59c1('0x4b')],_0x263f58[_0x59c1('0x4c')]);_0x1e588f[_0x59c1('0x4f')]=_[_0x59c1('0x4e')](_0x263f58[_0x59c1('0x4b')],qs[_0x59c1('0x50')](_0x2dd26f[_0x59c1('0x4c')][_0x59c1('0x50')]));_0x1e588f[_0x59c1('0x4f')]=_0x1e588f[_0x59c1('0x4f')][_0x59c1('0x6f')]?_0x1e588f[_0x59c1('0x4f')]:_0x263f58[_0x59c1('0x4b')];if(!_0x2dd26f[_0x59c1('0x4c')]['hasOwnProperty'](_0x59c1('0x52'))){_0x1e588f[_0x59c1('0x1e')]=qs['limit'](_0x2dd26f[_0x59c1('0x4c')][_0x59c1('0x1e')]);_0x1e588f[_0x59c1('0x1d')]=qs[_0x59c1('0x1d')](_0x2dd26f['query'][_0x59c1('0x1d')]);}_0x1e588f[_0x59c1('0x53')]=qs[_0x59c1('0x54')](_0x2dd26f[_0x59c1('0x4c')][_0x59c1('0x54')]);_0x1e588f[_0x59c1('0x56')]=qs[_0x59c1('0x4d')](_[_0x59c1('0x70')](_0x2dd26f[_0x59c1('0x4c')],_0x263f58[_0x59c1('0x4d')]));_0x1e588f[_0x59c1('0x56')][_0x59c1('0x71')]=_0x447343['id'];if(_0x2dd26f[_0x59c1('0x4c')]['filter']){_0x1e588f[_0x59c1('0x56')]=_[_0x59c1('0x57')](_0x1e588f[_0x59c1('0x56')],{'$or':_['map'](_0x1e588f[_0x59c1('0x4f')],function(_0xc18ed5){var _0x33c67e={};_0x33c67e[_0xc18ed5]={'$like':'%'+_0x2dd26f[_0x59c1('0x4c')][_0x59c1('0x55')]+'%'};return _0x33c67e;})});}if(_0x2dd26f[_0x59c1('0x4c')][_0x59c1('0xa1')]){var _0x16957e=_0x2dd26f[_0x59c1('0x4c')][_0x59c1('0xa1')]['split'](',');var _0x5bd176={};_0x5bd176[_0x16957e[0x0]]={'$gte':moment(_0x16957e[0x1])[_0x59c1('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1e588f[_0x59c1('0x56')]=_[_0x59c1('0x57')](_0x1e588f[_0x59c1('0x56')],_0x5bd176);}_0x1e588f=_[_0x59c1('0x57')]({},_0x1e588f,_0x2dd26f[_0x59c1('0x5a')]);return db[_0x59c1('0xa0')][_0x59c1('0x20')]({'where':_0x1e588f[_0x59c1('0x56')]})[_0x59c1('0x10')](function(_0x506ad7){_0x38ce6a[_0x59c1('0x20')]=_0x506ad7;if(_0x2dd26f[_0x59c1('0x4c')]['includeAll']){_0x1e588f[_0x59c1('0x5c')]=[{'all':!![]}];}return db[_0x59c1('0xa0')]['findAll'](_0x1e588f);})[_0x59c1('0x10')](function(_0x2f74cd){if(_0x2dd26f[_0x59c1('0x4c')]['inlineCss']===_0x59c1('0xa3')){for(var _0x25daa0=0x0;_0x25daa0<_0x2f74cd[_0x59c1('0x6f')];_0x25daa0++){_0x2f74cd[_0x25daa0]['body']=juice(_0x2f74cd[_0x25daa0][_0x59c1('0x62')]);}}_0x38ce6a[_0x59c1('0x5e')]=_0x2f74cd;return _0x38ce6a;});}})['then'](respondWithFilteredResult(_0x1f2a36,_0x1e588f))[_0x59c1('0x18')](handleError(_0x1f2a36,null));};exports[_0x59c1('0x2a')]=function(_0x15df5e,_0x203de8){var _0x442f62,_0x261d83={},_0x3974b8;if(_0x15df5e[_0x59c1('0x62')]['to']){_0x3974b8=_0x15df5e[_0x59c1('0x62')]['to'][_0x59c1('0xa4')](',')[0x0];}return db[_0x59c1('0x47')][_0x59c1('0x66')]({'where':{'id':_0x15df5e[_0x59c1('0x60')]['id']},'include':[{'model':db[_0x59c1('0xa5')],'as':'List','include':[{'model':db['CmContact'],'as':_0x59c1('0xa6'),'where':{'email':_0x3974b8},'limit':0x1,'order':[[_0x59c1('0xa7'),_0x59c1('0xa8')]]}]},{'model':db[_0x59c1('0x44')],'as':_0x59c1('0x42'),'raw':!![],'include':[{'model':db[_0x59c1('0xa9')],'as':_0x59c1('0xa9'),'raw':!![]}]}]})[_0x59c1('0x10')](handleEntityNotFound(_0x203de8,null))[_0x59c1('0x10')](function(_0x11df91){if(!_0x11df91)return;_0x442f62=_0x11df91;if(!_0x11df91[_0x59c1('0x42')])throw new Error(_0x59c1('0xaa'));if(_[_0x59c1('0x7a')](_0x15df5e[_0x59c1('0x62')][_0x59c1('0xab')])){_0x15df5e[_0x59c1('0x62')][_0x59c1('0xab')]=util[_0x59c1('0xa2')](_0x59c1('0xac'),_0x11df91[_0x59c1('0x29')],_0x11df91[_0x59c1('0x78')]||_0x11df91[_0x59c1('0x42')][_0x59c1('0x37')]);}if(_0x15df5e['body'][_0x59c1('0xad')]&&_0x15df5e[_0x59c1('0x62')]['attachments'][_0x59c1('0x6f')]){for(var _0x183123=0x0;_0x183123<_0x15df5e[_0x59c1('0x62')][_0x59c1('0xad')][_0x59c1('0x6f')];_0x183123+=0x1){_0x15df5e[_0x59c1('0x62')][_0x59c1('0xad')][_0x183123]={'filename':_0x15df5e[_0x59c1('0x62')][_0x59c1('0xad')][_0x183123][_0x59c1('0x29')],'path':path[_0x59c1('0xae')](config[_0x59c1('0xaf')],_0x59c1('0xb0'),_0x15df5e[_0x59c1('0x62')]['attachments'][_0x183123][_0x59c1('0xb1')])};}}var _0x5ac9e0=_0x11df91[_0x59c1('0xb2')]();return respondWithRpcPromise(_0x59c1('0xb3'),_0x59c1('0xb4'),{'account':_0x5ac9e0,'message':_0x15df5e[_0x59c1('0x62')]});})[_0x59c1('0x10')](function(_0x239eb5){if(!_0x239eb5)return;_0x261d83=_0x239eb5;if(!_0x442f62[_0x59c1('0xb5')])throw new Error(_0x59c1('0xb6'));if(_0x442f62['List'][_0x59c1('0xa6')][_0x59c1('0x6f')])return _0x442f62['List'][_0x59c1('0xa6')][0x0];return db[_0x59c1('0x8c')][_0x59c1('0x6b')](_['defaults'](_0x15df5e['body'],{'firstName':_0x15df5e[_0x59c1('0x62')]['to'],'email':_0x15df5e['body']['to'],'phone':_0x15df5e[_0x59c1('0x62')]['to'],'ListId':_0x442f62[_0x59c1('0x79')]}));})[_0x59c1('0x10')](function(_0x555f2f){if(!_0x555f2f)return;var _0x262436={'UserId':_0x15df5e[_0x59c1('0x37')]['id'],'ContactId':_0x555f2f['id'],'MailAccountId':_0x442f62['id'],'inReplyTo':_0x261d83[_0x59c1('0xb7')],'to':_0x15df5e['body']['from'],'cc':_0x15df5e['body']['cc'],'subject':_0x15df5e[_0x59c1('0x62')][_0x59c1('0xb8')],'attach':_0x15df5e[_0x59c1('0x62')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x59c1('0xa2')](_0x59c1('0xb9')),'lastMsgDirection':_0x59c1('0xba'),'Messages':[_[_0x59c1('0x57')](_0x15df5e[_0x59c1('0x62')],{'messageId':_0x261d83[_0x59c1('0xb7')],'sentAt':moment()[_0x59c1('0xa2')](_0x59c1('0xb9')),'read':!![],'MailAccountId':_0x442f62['id'],'UserId':_0x15df5e['user']['id'],'ContactId':_0x555f2f['id']})]};if(_0x15df5e[_0x59c1('0x62')][_0x59c1('0xbb')]){_0x262436=_[_0x59c1('0x57')](_0x262436,_0x15df5e[_0x59c1('0x62')]['Interaction']);}return db[_0x59c1('0x89')][_0x59c1('0x6b')](_0x262436,{'include':[{'model':db[_0x59c1('0xa0')],'as':_0x59c1('0xbc')}]});})[_0x59c1('0x10')](respondWithResult(_0x203de8,null))[_0x59c1('0x18')](handleError(_0x203de8,null));};exports[_0x59c1('0xbd')]=function(_0x224b9c,_0x174dd5){return db[_0x59c1('0x47')][_0x59c1('0x66')]({'where':{'id':_0x224b9c['params']['id']},'include':[{'model':db[_0x59c1('0x44')],'as':_0x59c1('0x42'),'raw':!![],'include':[{'model':db[_0x59c1('0xa9')],'as':_0x59c1('0xa9'),'raw':!![]}]}]})[_0x59c1('0x10')](handleEntityNotFound(_0x174dd5,null))[_0x59c1('0x10')](function(_0x278a69){if(!_0x278a69[_0x59c1('0x42')])return;var _0x4878f7=_0x278a69['getSmtpOptions']();return respondWithRpcPromise(_0x59c1('0xbe'),_0x59c1('0xbd'),{'account':_0x4878f7});})[_0x59c1('0x10')](respondWithResult(_0x174dd5,null))[_0x59c1('0x18')](handleError(_0x174dd5,null));};exports[_0x59c1('0x24')]=function(_0x1c48a1,_0x1669ce){return db[_0x59c1('0x47')][_0x59c1('0x66')]({'where':{'id':_0x1c48a1['params']['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x1669ce,null))['then'](function(_0x1e0e0a){if(_0x1e0e0a&&_0x1e0e0a[_0x59c1('0x3e')]){throw new db[(_0x59c1('0xbf'))]['ValidationError']('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x1e0e0a;})[_0x59c1('0x10')](removeEntity(_0x1669ce,null))[_0x59c1('0x18')](handleError(_0x1669ce,null));};exports['addAgents']=function(_0x42bcd9,_0x1e3064){return db[_0x59c1('0x47')][_0x59c1('0x66')]({'where':{'id':_0x42bcd9['params']['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x1e3064,null))[_0x59c1('0x10')](function(_0x31f071){if(_0x31f071){return _0x31f071['addAgents'](_0x42bcd9[_0x59c1('0x62')][_0x59c1('0x77')],_[_0x59c1('0x8b')](_0x42bcd9[_0x59c1('0x62')],[_0x59c1('0x77'),'id'])||{})['spread'](function(_0x2a9c6b){for(var _0x3d7216=0x0;_0x3d7216<_0x42bcd9[_0x59c1('0x62')][_0x59c1('0x77')][_0x59c1('0x6f')];_0x3d7216+=0x1){socket[_0x59c1('0xc0')](_0x59c1('0xc1'),{'UserId':Number(_0x42bcd9[_0x59c1('0x62')][_0x59c1('0x77')][_0x3d7216]),'MailAccountId':Number(_0x42bcd9['params']['id'])});}return _0x2a9c6b;});}})['then'](respondWithResult(_0x1e3064,null))[_0x59c1('0x18')](handleError(_0x1e3064,null));};exports['removeAgents']=function(_0x46ec90,_0x5cfd1f){return db['MailAccount'][_0x59c1('0x66')]({'where':{'id':_0x46ec90[_0x59c1('0x60')]['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x5cfd1f,null))['then'](function(_0x312fd4){if(_0x312fd4){return _0x312fd4[_0x59c1('0xc2')](_0x46ec90[_0x59c1('0x4c')][_0x59c1('0x77')])[_0x59c1('0x10')](function(){if(_[_0x59c1('0xc3')](_0x46ec90[_0x59c1('0x4c')][_0x59c1('0x77')])){for(var _0x515e98=0x0;_0x515e98<_0x46ec90[_0x59c1('0x4c')][_0x59c1('0x77')]['length'];_0x515e98+=0x1){socket[_0x59c1('0xc0')](_0x59c1('0xc4'),{'UserId':Number(_0x46ec90[_0x59c1('0x4c')][_0x59c1('0x77')][_0x515e98]),'MailAccountId':Number(_0x46ec90[_0x59c1('0x60')]['id'])});}}else{socket[_0x59c1('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x46ec90[_0x59c1('0x4c')]['ids']),'MailAccountId':Number(_0x46ec90[_0x59c1('0x60')]['id'])});}});}})[_0x59c1('0x10')](respondWithStatusCode(_0x5cfd1f,null))[_0x59c1('0x18')](handleError(_0x5cfd1f,null));};exports['getAgents']=function(_0x31f5f9,_0x40b1c8){var _0x549767={};var _0x3a85f5={};var _0x96f0eb;var _0x540c7d;return db[_0x59c1('0x47')]['findOne']({'where':{'id':_0x31f5f9[_0x59c1('0x60')]['id']}})[_0x59c1('0x10')](handleEntityNotFound(_0x40b1c8,null))[_0x59c1('0x10')](function(_0x449d60){if(_0x449d60){_0x96f0eb=_0x449d60;_0x3a85f5[_0x59c1('0x4b')]=_[_0x59c1('0x61')](db['User'][_0x59c1('0x48')]);_0x3a85f5[_0x59c1('0x4c')]=_[_0x59c1('0x61')](_0x31f5f9['query']);_0x3a85f5[_0x59c1('0x4d')]=_[_0x59c1('0x4e')](_0x3a85f5[_0x59c1('0x4b')],_0x3a85f5['query']);_0x549767['attributes']=_['intersection'](_0x3a85f5['model'],qs[_0x59c1('0x50')](_0x31f5f9[_0x59c1('0x4c')]['fields']));_0x549767[_0x59c1('0x4f')]=_0x549767['attributes']['length']?_0x549767[_0x59c1('0x4f')]:_0x3a85f5['model'];_0x549767[_0x59c1('0x53')]=qs[_0x59c1('0x54')](_0x31f5f9[_0x59c1('0x4c')]['sort']);_0x549767[_0x59c1('0x56')]=qs[_0x59c1('0x4d')](_[_0x59c1('0x70')](_0x31f5f9[_0x59c1('0x4c')],_0x3a85f5[_0x59c1('0x4d')]));if(_0x31f5f9['query'][_0x59c1('0x55')]){_0x549767[_0x59c1('0x56')]=_[_0x59c1('0x57')](_0x549767[_0x59c1('0x56')],{'$or':_['map'](_0x549767[_0x59c1('0x4f')],function(_0x23926e){var _0x44ecf4={};_0x44ecf4[_0x23926e]={'$like':'%'+_0x31f5f9[_0x59c1('0x4c')][_0x59c1('0x55')]+'%'};return _0x44ecf4;})});}_0x549767=_[_0x59c1('0x57')]({},_0x549767,_0x31f5f9[_0x59c1('0x5a')]);return _0x96f0eb[_0x59c1('0xc5')](_0x549767);}})[_0x59c1('0x10')](function(_0x36e233){if(_0x36e233){_0x540c7d=_0x36e233[_0x59c1('0x6f')];if(!_0x31f5f9[_0x59c1('0x4c')][_0x59c1('0x51')](_0x59c1('0x52'))){_0x549767['limit']=qs[_0x59c1('0x1e')](_0x31f5f9[_0x59c1('0x4c')]['limit']);_0x549767[_0x59c1('0x1d')]=qs['offset'](_0x31f5f9[_0x59c1('0x4c')][_0x59c1('0x1d')]);}return _0x96f0eb[_0x59c1('0xc5')](_0x549767);}})['then'](function(_0x3b4125){if(_0x3b4125){return _0x3b4125?{'count':_0x540c7d,'rows':_0x3b4125}:null;}})[_0x59c1('0x10')](respondWithResult(_0x40b1c8,null))['catch'](handleError(_0x40b1c8,null));}; \ No newline at end of file +var _0x6826=['MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','true','CmList','Contacts','updatedAt','DESC','CloudProvider','from','format','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','SendMail','List','ListId','messageId','subject','out','Interaction','Messages','verifySmtp','getSmtpOptions','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./mailAccount.socket','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','get','destroy','sendStatus','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','port','secure','service','authentication','host','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','key','map','query','keys','filters','attributes','intersection','fields','length','model','order','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','options','body','provider','custom','describe','find','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','MailAccountId','removeDispositions','ids','addAnswer','CannedAnswer','create','pick','include','removeAnswers','isNil','active','description','UserProfileSection','MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','getSmtp','addSmtp','removeSmtp','addInteraction'];(function(_0x2ddd52,_0x4e3b17){var _0x4bb4ec=function(_0x41905f){while(--_0x41905f){_0x2ddd52['push'](_0x2ddd52['shift']());}};_0x4bb4ec(++_0x4e3b17);}(_0x6826,0x1c1));var _0x6682=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0x6826[_0x2c6810];return _0x213881;};'use strict';var moment=require(_0x6682('0x0'));var BPromise=require(_0x6682('0x1'));var util=require('util');var path=require(_0x6682('0x2'));var _=require(_0x6682('0x3'));var juice=require(_0x6682('0x4'));var Redis=require(_0x6682('0x5'));var qs=require(_0x6682('0x6'));var logger=require(_0x6682('0x7'))(_0x6682('0x8'));var config=require(_0x6682('0x9'));var db=require(_0x6682('0xa'))['db'];config[_0x6682('0xb')]=_[_0x6682('0xc')](config[_0x6682('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6682('0xd'))['register'](socket);var jayson=require(_0x6682('0xe'));var client=jayson[_0x6682('0xf')][_0x6682('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x3d6df1,_0x2e690b,_0x351148,_0x4ba97e){return new BPromise(function(_0x542421,_0x16589b){var _0x577dc2=_0x4ba97e||client;return _0x577dc2['request'](_0x3d6df1,_0x351148)[_0x6682('0x11')](function(_0x27ed35){logger[_0x6682('0x12')](_0x6682('0x13'),_0x2e690b,'request\x20sent');logger[_0x6682('0x14')](_0x6682('0x15'),_0x2e690b,_0x6682('0x16'),JSON[_0x6682('0x17')](_0x27ed35));if(_0x27ed35[_0x6682('0x18')]){if(_0x27ed35[_0x6682('0x18')][_0x6682('0x19')]===0x1f4){logger[_0x6682('0x18')]('MailAccount,\x20%s,\x20%s',_0x2e690b,_0x27ed35['error']['message']);return _0x16589b(_0x27ed35[_0x6682('0x18')]['message']);}logger[_0x6682('0x18')](_0x6682('0x13'),_0x2e690b,_0x27ed35['error'][_0x6682('0x1a')]);return _0x542421(_0x27ed35[_0x6682('0x18')]['message']);}else{logger['info'](_0x6682('0x13'),_0x2e690b,_0x6682('0x16'));_0x542421(_0x27ed35[_0x6682('0x1b')][_0x6682('0x1a')]);}})[_0x6682('0x1c')](function(_0x453f46){logger[_0x6682('0x18')]('MailAccount,\x20%s,\x20%s',_0x2e690b,_0x453f46);_0x16589b(_0x453f46);});});}function respondWithStatusCode(_0x5c055a,_0x5196b4){_0x5196b4=_0x5196b4||0xcc;return function(_0x3d46f3){if(_0x3d46f3){return _0x5c055a['sendStatus'](_0x5196b4);}return _0x5c055a[_0x6682('0x1d')](_0x5196b4)[_0x6682('0x1e')]();};}function respondWithResult(_0x2d547c,_0x27a503){_0x27a503=_0x27a503||0xc8;return function(_0x16fe4a){if(_0x16fe4a){return _0x2d547c['status'](_0x27a503)[_0x6682('0x1f')](_0x16fe4a);}};}function respondWithFilteredResult(_0xe40aa2,_0x48b269){return function(_0x5c82dd){if(_0x5c82dd){var _0x14be9c=typeof _0x48b269[_0x6682('0x20')]===_0x6682('0x21')&&typeof _0x48b269[_0x6682('0x22')]===_0x6682('0x21');var _0x2701c1=_0x5c82dd[_0x6682('0x23')];var _0x4e3a6b=_0x14be9c?0x0:_0x48b269['offset'];var _0x6c5e=_0x14be9c?_0x5c82dd['count']:_0x48b269[_0x6682('0x20')]+_0x48b269[_0x6682('0x22')];var _0x2bf8e7;if(_0x6c5e>=_0x2701c1){_0x6c5e=_0x2701c1;_0x2bf8e7=0xc8;}else{_0x2bf8e7=0xce;}_0xe40aa2[_0x6682('0x1d')](_0x2bf8e7);return _0xe40aa2[_0x6682('0x24')](_0x6682('0x25'),_0x4e3a6b+'-'+_0x6c5e+'/'+_0x2701c1)[_0x6682('0x1f')](_0x5c82dd);}return null;};}function saveUpdates(_0x43daf9){return function(_0x46fc04){if(_0x46fc04){return _0x46fc04[_0x6682('0x26')](_0x43daf9)[_0x6682('0x11')](function(_0x18f63f){return _0x18f63f;});}return null;};}function removeEntity(_0x1b8d38){return function(_0xacccfa){if(_0xacccfa){return _0xacccfa['destroy']()['then'](function(){var _0x128162=_0xacccfa[_0x6682('0x27')]({'plain':!![]});var _0x585c5f='MailAccounts';return db['UserProfileResource'][_0x6682('0x28')]({'where':{'type':_0x585c5f,'resourceId':_0x128162['id']}})[_0x6682('0x11')](function(){return _0xacccfa;});})['then'](function(){_0x1b8d38[_0x6682('0x1d')](0xcc)[_0x6682('0x1e')]();});}};}function handleEntityNotFound(_0xf3d2ae){return function(_0x59536f){if(!_0x59536f){_0xf3d2ae[_0x6682('0x29')](0x194);}return _0x59536f;};}function handleError(_0x2e0cc6,_0x28564e){_0x28564e=_0x28564e||0x1f4;return function(_0x56211b){logger['error'](_0x56211b['stack']);if(_0x56211b[_0x6682('0x2a')]){delete _0x56211b[_0x6682('0x2a')];}_0x2e0cc6[_0x6682('0x1d')](_0x28564e)[_0x6682('0x2b')](_0x56211b);};}function getImapHost(_0x35e640){switch(_0x35e640){case _0x6682('0x2c'):return _0x6682('0x2d');case _0x6682('0x2e'):return _0x6682('0x2f');case _0x6682('0x30'):return _0x6682('0x31');case _0x6682('0x32'):return'outlook.office365.com';}throw new Error(_0x6682('0x33'),_0x35e640);}function getSmtpHost(_0x562c7b){switch(_0x562c7b){case _0x6682('0x2c'):return _0x6682('0x34');case _0x6682('0x2e'):return _0x6682('0x35');case _0x6682('0x30'):return'smtp-mail.outlook.com';case _0x6682('0x32'):return _0x6682('0x36');}throw new Error(_0x6682('0x33'),_0x562c7b);}function getAuthenticationOptions(_0x16be04,_0x39c188){var _0x19e015={};var _0x19afb9={};if(_0x16be04){_0x19e015[_0x6682('0x37')]=_0x19afb9['user']=_0x39c188['username'];_0x19e015[_0x6682('0x38')]=_0x19afb9['pass']=_0x39c188[_0x6682('0x38')];if(_0x39c188[_0x6682('0x39')]){_0x19e015[_0x6682('0x39')]=_0x19afb9[_0x6682('0x39')]=!![];_0x19e015['CloudProviderId']=_0x19afb9[_0x6682('0x3a')]=_0x39c188['CloudProviderId'];_0x19e015[_0x6682('0x38')]=_0x19afb9[_0x6682('0x3b')]=null;}else{_0x19e015['CloudProviderId']=_0x19afb9[_0x6682('0x3a')]=null;}_0x19e015['host']=getImapHost(_0x16be04);_0x19e015[_0x6682('0x3c')]=0x3e1;_0x19afb9['host']=getSmtpHost(_0x16be04);_0x19afb9[_0x6682('0x3c')]=0x24b;_0x19afb9[_0x6682('0x3d')]=![];_0x19e015['service']=_0x19afb9[_0x6682('0x3e')]=null;}else{if(_0x39c188['authentication']){_0x19e015[_0x6682('0x37')]=_0x19afb9[_0x6682('0x37')]=_0x39c188['username'];_0x19e015['password']=_0x19afb9['pass']=_0x39c188['password'];}else{_0x19e015[_0x6682('0x3f')]=_0x19afb9['authentication']=![];_0x19e015['user']=_0x19afb9[_0x6682('0x37')]=null;_0x19e015[_0x6682('0x38')]=_0x19afb9[_0x6682('0x3b')]=null;}_0x19e015[_0x6682('0x40')]=_0x39c188[_0x6682('0x41')][_0x6682('0x40')];_0x19e015[_0x6682('0x3c')]=_0x39c188[_0x6682('0x41')][_0x6682('0x3c')];_0x19afb9['host']=_0x39c188[_0x6682('0x42')][_0x6682('0x40')];_0x19afb9[_0x6682('0x3c')]=_0x39c188[_0x6682('0x42')]['port'];}return{'Imap':_0x19e015,'Smtp':_0x19afb9};}exports[_0x6682('0x43')]=function(_0x4088cb,_0xc218b8){var _0x557966={'include':[{'model':db[_0x6682('0x44')],'as':_0x6682('0x41')},{'model':db[_0x6682('0x45')],'as':'Smtp'},{'model':db[_0x6682('0x46')],'as':_0x6682('0x47')}]},_0x30f2aa={},_0x5ed81b={'count':0x0,'rows':[]};var _0x7f3c02=_['map'](db[_0x6682('0x48')][_0x6682('0x49')],function(_0xf1a36a){return{'name':_0xf1a36a[_0x6682('0x4a')],'type':_0xf1a36a['type'][_0x6682('0x4b')]};});_0x30f2aa['model']=_[_0x6682('0x4c')](_0x7f3c02,'name');_0x30f2aa[_0x6682('0x4d')]=_[_0x6682('0x4e')](_0x4088cb[_0x6682('0x4d')]);_0x30f2aa[_0x6682('0x4f')]=_['intersection'](_0x30f2aa['model'],_0x30f2aa['query']);_0x557966[_0x6682('0x50')]=_[_0x6682('0x51')](_0x30f2aa['model'],qs[_0x6682('0x52')](_0x4088cb['query'][_0x6682('0x52')]));_0x557966[_0x6682('0x50')]=_0x557966[_0x6682('0x50')][_0x6682('0x53')]?_0x557966[_0x6682('0x50')]:_0x30f2aa[_0x6682('0x54')];if(!_0x4088cb[_0x6682('0x4d')]['hasOwnProperty']('nolimit')){_0x557966[_0x6682('0x22')]=qs[_0x6682('0x22')](_0x4088cb[_0x6682('0x4d')][_0x6682('0x22')]);_0x557966[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x4088cb['query'][_0x6682('0x20')]);}_0x557966[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x4088cb['query'][_0x6682('0x56')]);_0x557966[_0x6682('0x57')]=qs[_0x6682('0x4f')](_['pick'](_0x4088cb[_0x6682('0x4d')],_0x30f2aa[_0x6682('0x4f')]),_0x7f3c02);if(_0x4088cb[_0x6682('0x4d')][_0x6682('0x58')]){_0x557966[_0x6682('0x57')]=_[_0x6682('0x59')](_0x557966[_0x6682('0x57')],{'$or':_['map'](_0x7f3c02,function(_0x4cbec7){if(_0x4cbec7[_0x6682('0x5a')]!==_0x6682('0x5b')){var _0x236a7e={};_0x236a7e[_0x4cbec7[_0x6682('0x2a')]]={'$like':'%'+_0x4088cb[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x236a7e;}})});}_0x557966=_[_0x6682('0x59')]({},_0x557966,_0x4088cb['options']);var _0xe3ece4={'where':_0x557966['where']};return db[_0x6682('0x48')][_0x6682('0x23')](_0xe3ece4)[_0x6682('0x11')](function(_0x34e698){_0x5ed81b[_0x6682('0x23')]=_0x34e698;if(_0x4088cb[_0x6682('0x4d')][_0x6682('0x5c')]){_0x557966['include']=[{'all':!![]}];}return db[_0x6682('0x48')][_0x6682('0x5d')](_0x557966);})[_0x6682('0x11')](function(_0x266e2f){_0x5ed81b[_0x6682('0x5e')]=_0x266e2f;return _0x5ed81b;})[_0x6682('0x11')](respondWithFilteredResult(_0xc218b8,_0x557966))[_0x6682('0x1c')](handleError(_0xc218b8,null));};exports[_0x6682('0x5f')]=function(_0x75ca37,_0x331822){var _0x5aac46={'raw':![],'where':{'id':_0x75ca37[_0x6682('0x60')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x6682('0x41')},{'model':db['MailServerOut'],'as':_0x6682('0x42')},{'model':db[_0x6682('0x46')],'as':_0x6682('0x47')}]},_0x2e9579={};_0x2e9579['model']=_[_0x6682('0x4e')](db['MailAccount'][_0x6682('0x49')]);_0x2e9579[_0x6682('0x4d')]=_[_0x6682('0x4e')](_0x75ca37['query']);_0x2e9579[_0x6682('0x4f')]=_['intersection'](_0x2e9579['model'],_0x2e9579['query']);_0x5aac46['attributes']=_['intersection'](_0x2e9579[_0x6682('0x54')],qs['fields'](_0x75ca37[_0x6682('0x4d')][_0x6682('0x52')]));_0x5aac46['attributes']=_0x5aac46[_0x6682('0x50')][_0x6682('0x53')]?_0x5aac46[_0x6682('0x50')]:_0x2e9579[_0x6682('0x54')];if(_0x75ca37[_0x6682('0x4d')]['includeAll']){_0x5aac46['include']=[{'all':!![]}];}_0x5aac46=_[_0x6682('0x59')]({},_0x5aac46,_0x75ca37[_0x6682('0x61')]);return db[_0x6682('0x48')]['find'](_0x5aac46)[_0x6682('0x11')](handleEntityNotFound(_0x331822,null))['then'](respondWithResult(_0x331822,null))['catch'](handleError(_0x331822,null));};exports[_0x6682('0x26')]=function(_0x560e84,_0x567b7b){if(_0x560e84[_0x6682('0x62')]['id']){delete _0x560e84['body']['id'];}var _0x38ec6c=_0x560e84[_0x6682('0x62')][_0x6682('0x63')]===_0x6682('0x64')?null:_0x560e84['body'][_0x6682('0x63')];var _0xee2bef=_0x560e84[_0x6682('0x62')]['Imap']||{};var _0x66ac1d=_0x560e84[_0x6682('0x62')][_0x6682('0x42')]||{};if(_0x38ec6c){_0xee2bef['host']=getImapHost(_0x38ec6c);_0xee2bef[_0x6682('0x3c')]=0x3e1;_0x66ac1d['host']=getSmtpHost(_0x38ec6c);_0x66ac1d['port']=0x24b;_0x66ac1d[_0x6682('0x3d')]=![];}if(_0x66ac1d[_0x6682('0x39')]){_0x66ac1d['secure']=![];}else{_0x66ac1d[_0x6682('0x3a')]=null;}if(!_0xee2bef[_0x6682('0x39')])_0xee2bef[_0x6682('0x3a')]=null;_0x560e84[_0x6682('0x62')][_0x6682('0x41')]=_0xee2bef;_0x560e84['body'][_0x6682('0x42')]=_0x66ac1d;return db[_0x6682('0x48')]['find']({'where':{'id':_0x560e84[_0x6682('0x60')]['id']},'include':[{'model':db[_0x6682('0x44')],'as':_0x6682('0x41')},{'model':db[_0x6682('0x45')],'as':_0x6682('0x42')},{'model':db[_0x6682('0x46')],'as':_0x6682('0x47')}]})[_0x6682('0x11')](handleEntityNotFound(_0x567b7b,null))[_0x6682('0x11')](function(_0x54c54b){if(!_0x54c54b)throw new Error('Mail\x20Account\x20not\x20found');if(_0x54c54b['service'])delete _0x560e84[_0x6682('0x62')][_0x6682('0x41')];return _0x54c54b;})[_0x6682('0x11')](saveUpdates(_0x560e84['body'],null))[_0x6682('0x11')](function(_0x3839d7){if(!_0x560e84[_0x6682('0x62')][_0x6682('0x41')])return _0x3839d7;return db[_0x6682('0x44')]['update'](_0x560e84['body']['Imap'],{'where':{'MailAccountId':_0x3839d7['id']}})['then'](function(){return _0x3839d7;});})[_0x6682('0x11')](function(_0x5393ea){if(!_0x560e84[_0x6682('0x62')][_0x6682('0x42')])return _0x5393ea;return db['MailServerOut']['update'](_0x560e84['body']['Smtp'],{'where':{'MailAccountId':_0x5393ea['id']}})[_0x6682('0x11')](function(){return _0x5393ea;});})[_0x6682('0x11')](respondWithResult(_0x567b7b,null))['catch'](handleError(_0x567b7b,null));};exports[_0x6682('0x65')]=function(_0x3073f3,_0x13c83a){return db[_0x6682('0x48')]['describe']()[_0x6682('0x11')](respondWithResult(_0x13c83a,null))[_0x6682('0x1c')](handleError(_0x13c83a,null));};exports['addDisposition']=function(_0x39aebb,_0x3d444d){if(_0x39aebb[_0x6682('0x62')]['id']){delete _0x39aebb[_0x6682('0x62')]['id'];}return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x39aebb[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x3d444d,null))[_0x6682('0x11')](function(_0x4ce7a){if(_0x4ce7a){_0x39aebb['body']['MailAccountId']=_0x4ce7a['id'];return db[_0x6682('0x67')]['create'](_0x39aebb['body']);}})[_0x6682('0x11')](respondWithResult(_0x3d444d,null))['catch'](handleError(_0x3d444d,null));};exports[_0x6682('0x68')]=function(_0x308ed6,_0x44752b){var _0x1d94e7={'raw':![],'where':{}};var _0x543774={};var _0x48cfed={'count':0x0,'rows':[]};return db[_0x6682('0x48')][_0x6682('0x69')]({'where':{'id':_0x308ed6['params']['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x44752b,null))['then'](function(_0x2fa01f){if(_0x2fa01f){_0x543774[_0x6682('0x54')]=_[_0x6682('0x4e')](db['Disposition'][_0x6682('0x49')]);_0x543774['query']=_[_0x6682('0x4e')](_0x308ed6[_0x6682('0x4d')]);_0x543774[_0x6682('0x4f')]=_[_0x6682('0x51')](_0x543774[_0x6682('0x54')],_0x543774[_0x6682('0x4d')]);_0x1d94e7[_0x6682('0x50')]=_['intersection'](_0x543774[_0x6682('0x54')],qs[_0x6682('0x52')](_0x308ed6[_0x6682('0x4d')][_0x6682('0x52')]));_0x1d94e7[_0x6682('0x50')]=_0x1d94e7['attributes'][_0x6682('0x53')]?_0x1d94e7[_0x6682('0x50')]:_0x543774['model'];if(!_0x308ed6['query'][_0x6682('0x6a')](_0x6682('0x6b'))){_0x1d94e7['limit']=qs['limit'](_0x308ed6['query'][_0x6682('0x22')]);_0x1d94e7['offset']=qs[_0x6682('0x20')](_0x308ed6[_0x6682('0x4d')][_0x6682('0x20')]);}_0x1d94e7[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x308ed6[_0x6682('0x4d')]['sort']);_0x1d94e7[_0x6682('0x57')]=qs[_0x6682('0x4f')](_['pick'](_0x308ed6[_0x6682('0x4d')],_0x543774['filters']));_0x1d94e7[_0x6682('0x57')][_0x6682('0x6c')]=_0x2fa01f['id'];if(_0x308ed6[_0x6682('0x4d')][_0x6682('0x58')]){_0x1d94e7[_0x6682('0x57')]=_['merge'](_0x1d94e7['where'],{'$or':_[_0x6682('0x4c')](_0x1d94e7[_0x6682('0x50')],function(_0x4e214f){var _0x140b58={};_0x140b58[_0x4e214f]={'$like':'%'+_0x308ed6[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x140b58;})});}_0x1d94e7=_['merge']({},_0x1d94e7,_0x308ed6[_0x6682('0x61')]);return db[_0x6682('0x67')][_0x6682('0x23')]({'where':_0x1d94e7[_0x6682('0x57')]})[_0x6682('0x11')](function(_0x21737c){_0x48cfed[_0x6682('0x23')]=_0x21737c;if(_0x308ed6[_0x6682('0x4d')][_0x6682('0x5c')]){_0x1d94e7['include']=[{'all':!![]}];}return db[_0x6682('0x67')][_0x6682('0x5d')](_0x1d94e7);})['then'](function(_0x5d05fc){_0x48cfed[_0x6682('0x5e')]=_0x5d05fc;return _0x48cfed;});}})['then'](respondWithFilteredResult(_0x44752b,_0x1d94e7))['catch'](handleError(_0x44752b,null));};exports[_0x6682('0x6d')]=function(_0x2a427d,_0x1ce4fc){return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x2a427d['params']['id']}})['then'](handleEntityNotFound(_0x1ce4fc,null))[_0x6682('0x11')](function(_0x45f566){if(_0x45f566){return _0x45f566[_0x6682('0x6d')](_0x2a427d[_0x6682('0x4d')][_0x6682('0x6e')]);}})['then'](respondWithStatusCode(_0x1ce4fc,null))['catch'](handleError(_0x1ce4fc,null));};exports[_0x6682('0x6f')]=function(_0xecdbe4,_0x43622f){if(_0xecdbe4['body']['id']){delete _0xecdbe4[_0x6682('0x62')]['id'];}return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0xecdbe4['params']['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x43622f,null))[_0x6682('0x11')](function(_0x3fcbf7){if(_0x3fcbf7){_0xecdbe4[_0x6682('0x62')]['MailAccountId']=_0x3fcbf7['id'];return db[_0x6682('0x70')][_0x6682('0x71')](_0xecdbe4[_0x6682('0x62')]);}})['then'](respondWithResult(_0x43622f,null))[_0x6682('0x1c')](handleError(_0x43622f,null));};exports['getAnswers']=function(_0x21a544,_0x4f609f){var _0x47694d={'raw':![],'where':{}};var _0x5d540a={};var _0x150074={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x21a544[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x4f609f,null))[_0x6682('0x11')](function(_0xc09433){if(_0xc09433){_0x5d540a[_0x6682('0x54')]=_[_0x6682('0x4e')](db[_0x6682('0x70')]['rawAttributes']);_0x5d540a['query']=_['keys'](_0x21a544[_0x6682('0x4d')]);_0x5d540a[_0x6682('0x4f')]=_['intersection'](_0x5d540a[_0x6682('0x54')],_0x5d540a[_0x6682('0x4d')]);_0x47694d[_0x6682('0x50')]=_['intersection'](_0x5d540a['model'],qs['fields'](_0x21a544[_0x6682('0x4d')][_0x6682('0x52')]));_0x47694d[_0x6682('0x50')]=_0x47694d['attributes'][_0x6682('0x53')]?_0x47694d[_0x6682('0x50')]:_0x5d540a[_0x6682('0x54')];if(!_0x21a544[_0x6682('0x4d')][_0x6682('0x6a')]('nolimit')){_0x47694d[_0x6682('0x22')]=qs[_0x6682('0x22')](_0x21a544[_0x6682('0x4d')][_0x6682('0x22')]);_0x47694d[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x21a544[_0x6682('0x4d')][_0x6682('0x20')]);}_0x47694d[_0x6682('0x55')]=qs['sort'](_0x21a544[_0x6682('0x4d')][_0x6682('0x56')]);_0x47694d[_0x6682('0x57')]=qs[_0x6682('0x4f')](_[_0x6682('0x72')](_0x21a544[_0x6682('0x4d')],_0x5d540a[_0x6682('0x4f')]));_0x47694d['where']['MailAccountId']=_0xc09433['id'];if(_0x21a544[_0x6682('0x4d')][_0x6682('0x58')]){_0x47694d[_0x6682('0x57')]=_['merge'](_0x47694d[_0x6682('0x57')],{'$or':_['map'](_0x47694d['attributes'],function(_0x55342e){var _0x35828e={};_0x35828e[_0x55342e]={'$like':'%'+_0x21a544['query'][_0x6682('0x58')]+'%'};return _0x35828e;})});}_0x47694d=_[_0x6682('0x59')]({},_0x47694d,_0x21a544['options']);return db[_0x6682('0x70')][_0x6682('0x23')]({'where':_0x47694d[_0x6682('0x57')]})[_0x6682('0x11')](function(_0x22bdd3){_0x150074[_0x6682('0x23')]=_0x22bdd3;if(_0x21a544[_0x6682('0x4d')][_0x6682('0x5c')]){_0x47694d[_0x6682('0x73')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6682('0x5d')](_0x47694d);})['then'](function(_0x4ebc6f){_0x150074['rows']=_0x4ebc6f;return _0x150074;});}})['then'](respondWithFilteredResult(_0x4f609f,_0x47694d))[_0x6682('0x1c')](handleError(_0x4f609f,null));};exports[_0x6682('0x74')]=function(_0x372a3b,_0x34b30b){return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x372a3b[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x34b30b,null))[_0x6682('0x11')](function(_0x5d093a){if(_0x5d093a){return _0x5d093a[_0x6682('0x74')](_0x372a3b[_0x6682('0x4d')]['ids']);}})[_0x6682('0x11')](respondWithStatusCode(_0x34b30b,null))[_0x6682('0x1c')](handleError(_0x34b30b,null));};exports[_0x6682('0x71')]=function(_0x59c211,_0x30d554){var _0xd67f0a={'name':_0x59c211[_0x6682('0x62')][_0x6682('0x2a')],'key':_0x59c211[_0x6682('0x62')][_0x6682('0x4b')],'provider':_0x59c211[_0x6682('0x62')][_0x6682('0x63')]===_0x6682('0x64')?null:_0x59c211['body']['provider'],'email':_0x59c211[_0x6682('0x62')]['email'],'ListId':_0x59c211[_0x6682('0x62')]['ListId'],'active':!_[_0x6682('0x75')](_0x59c211[_0x6682('0x62')][_0x6682('0x76')])?_0x59c211[_0x6682('0x62')]['active']:!![],'description':_0x59c211['body'][_0x6682('0x77')]||null};var _0x4fda0f=getAuthenticationOptions(_0xd67f0a[_0x6682('0x63')],_0x59c211[_0x6682('0x62')]);_0xd67f0a['Imap']=_0x4fda0f[_0x6682('0x41')];_0xd67f0a[_0x6682('0x42')]=_0x4fda0f['Smtp'];return db[_0x6682('0x48')][_0x6682('0x71')](_0xd67f0a,{'include':[{'model':db[_0x6682('0x45')],'as':'Smtp'},{'model':db[_0x6682('0x44')],'as':_0x6682('0x41')}]})[_0x6682('0x11')](function(_0x403548){var _0x2c3489=_0x59c211[_0x6682('0x37')][_0x6682('0x27')]({'plain':!![]});if(!_0x2c3489)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c3489['role']===_0x6682('0x37')){var _0x55b579=_0x403548[_0x6682('0x27')]({'plain':!![]});return db[_0x6682('0x78')][_0x6682('0x66')]({'where':{'name':_0x6682('0x79'),'userProfileId':_0x2c3489['userProfileId']},'raw':!![]})[_0x6682('0x11')](function(_0x298cdd){if(_0x298cdd&&_0x298cdd[_0x6682('0x7a')]===0x0){return db['UserProfileResource']['create']({'name':_0x55b579[_0x6682('0x2a')],'resourceId':_0x55b579['id'],'type':_0x298cdd[_0x6682('0x2a')],'sectionId':_0x298cdd['id']},{})[_0x6682('0x11')](function(){return _0x403548;});}else{return _0x403548;}})[_0x6682('0x1c')](function(_0x33cfe4){logger['error'](_0x6682('0x7b'),_0x33cfe4);throw _0x33cfe4;});}return _0x403548;})[_0x6682('0x11')](respondWithResult(_0x30d554,0xc9))['catch'](handleError(_0x30d554,null));};exports[_0x6682('0x7c')]=function(_0x55928c,_0x4c67a6){return db[_0x6682('0x48')][_0x6682('0x69')]({'where':{'id':_0x55928c[_0x6682('0x60')]['id']}})['then'](handleEntityNotFound(_0x4c67a6,null))[_0x6682('0x11')](function(_0x32939c){if(_0x32939c){return _0x32939c[_0x6682('0x7c')]();}return null;})[_0x6682('0x11')](respondWithResult(_0x4c67a6,null))[_0x6682('0x1c')](handleError(_0x4c67a6,null));};exports[_0x6682('0x7d')]=function(_0xebaa89,_0x5b4caf){if(_0xebaa89[_0x6682('0x62')]['id']){delete _0xebaa89[_0x6682('0x62')]['id'];}return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0xebaa89[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x5b4caf,null))[_0x6682('0x11')](function(_0x511be9){if(_0x511be9){_0xebaa89[_0x6682('0x62')][_0x6682('0x6c')]=_0x511be9['id'];return db[_0x6682('0x44')][_0x6682('0x71')](_0xebaa89[_0x6682('0x62')]);}})['then'](respondWithResult(_0x5b4caf,null))[_0x6682('0x1c')](handleError(_0x5b4caf,null));};exports['removeImap']=function(_0x239359,_0x4a5667){return db['MailAccount'][_0x6682('0x69')]({'where':{'id':_0x239359[_0x6682('0x60')]['id']}})['then'](handleEntityNotFound(_0x4a5667,null))[_0x6682('0x11')](function(_0x30b5a0){if(_0x30b5a0){return _0x30b5a0['setImap'](null);}return null;})[_0x6682('0x11')](respondWithStatusCode(_0x4a5667,null))[_0x6682('0x1c')](handleError(_0x4a5667,null));};exports[_0x6682('0x7e')]=function(_0x4e0f0e,_0x2bbfb5){return db[_0x6682('0x48')]['findOne']({'where':{'id':_0x4e0f0e[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x2bbfb5,null))['then'](function(_0x21ab20){if(_0x21ab20){return _0x21ab20[_0x6682('0x7e')]();}return null;})[_0x6682('0x11')](respondWithResult(_0x2bbfb5,null))['catch'](handleError(_0x2bbfb5,null));};exports[_0x6682('0x7f')]=function(_0x350885,_0x169940){if(_0x350885['body']['id']){delete _0x350885[_0x6682('0x62')]['id'];}return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x350885[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x169940,null))[_0x6682('0x11')](function(_0x18cd3b){if(_0x18cd3b){_0x350885[_0x6682('0x62')][_0x6682('0x6c')]=_0x18cd3b['id'];return db['MailServerOut'][_0x6682('0x71')](_0x350885[_0x6682('0x62')]);}})['then'](respondWithResult(_0x169940,null))[_0x6682('0x1c')](handleError(_0x169940,null));};exports[_0x6682('0x80')]=function(_0x3f8f52,_0x1425c4){return db['MailAccount'][_0x6682('0x69')]({'where':{'id':_0x3f8f52[_0x6682('0x60')]['id']}})['then'](handleEntityNotFound(_0x1425c4,null))[_0x6682('0x11')](function(_0x102f01){if(_0x102f01){return _0x102f01['setSmtp'](null);}return null;})[_0x6682('0x11')](respondWithStatusCode(_0x1425c4,null))[_0x6682('0x1c')](handleError(_0x1425c4,null));};exports[_0x6682('0x81')]=function(_0xcddb57,_0x2df4f1){return db[_0x6682('0x82')][_0x6682('0x66')]({'where':{'id':_0xcddb57['params']['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x2df4f1,null))[_0x6682('0x11')](function(_0x3a3264){if(_0x3a3264){return _0x3a3264[_0x6682('0x81')](_0xcddb57['body'][_0x6682('0x6e')],_[_0x6682('0x83')](_0xcddb57['body'],[_0x6682('0x6e'),'id'])||{});}})[_0x6682('0x11')](respondWithResult(_0x2df4f1,null))[_0x6682('0x1c')](handleError(_0x2df4f1,null));};exports[_0x6682('0x84')]=function(_0x12d36c,_0x59e9c2){var _0x310846={'raw':![],'where':{}};var _0x202dec={};var _0x1cc647={'count':0x0,'rows':[]};return db[_0x6682('0x48')]['findOne']({'where':{'id':_0x12d36c[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x59e9c2,null))[_0x6682('0x11')](function(_0x3d5914){if(_0x3d5914){_0x202dec[_0x6682('0x54')]=_['keys'](db['MailInteraction'][_0x6682('0x49')]);_0x202dec[_0x6682('0x4d')]=_[_0x6682('0x4e')](_0x12d36c[_0x6682('0x4d')]);_0x202dec['filters']=_[_0x6682('0x51')](_0x202dec[_0x6682('0x54')],_0x202dec['query']);_0x310846[_0x6682('0x50')]=_[_0x6682('0x51')](_0x202dec[_0x6682('0x54')],qs['fields'](_0x12d36c[_0x6682('0x4d')][_0x6682('0x52')]));_0x310846[_0x6682('0x50')]=_0x310846[_0x6682('0x50')][_0x6682('0x53')]?_0x310846['attributes']:_0x202dec[_0x6682('0x54')];if(!_0x12d36c[_0x6682('0x4d')][_0x6682('0x6a')](_0x6682('0x6b'))){_0x310846[_0x6682('0x22')]=qs[_0x6682('0x22')](_0x12d36c[_0x6682('0x4d')][_0x6682('0x22')]);_0x310846[_0x6682('0x20')]=qs['offset'](_0x12d36c['query'][_0x6682('0x20')]);}_0x310846[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x12d36c['query'][_0x6682('0x56')]);_0x310846['where']=qs[_0x6682('0x4f')](_['pick'](_0x12d36c['query'],_0x202dec[_0x6682('0x4f')]));_0x310846[_0x6682('0x57')][_0x6682('0x6c')]=_0x3d5914['id'];if(_0x12d36c[_0x6682('0x4d')][_0x6682('0x58')]){_0x310846[_0x6682('0x57')]=_[_0x6682('0x59')](_0x310846[_0x6682('0x57')],{'$or':_[_0x6682('0x4c')](_0x310846[_0x6682('0x50')],function(_0x5162bb){var _0x3cdc4c={};_0x3cdc4c[_0x5162bb]={'$like':'%'+_0x12d36c[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x3cdc4c;})});}_0x310846=_[_0x6682('0x59')]({},_0x310846,_0x12d36c[_0x6682('0x61')]);return db['MailInteraction'][_0x6682('0x23')]({'where':_0x310846[_0x6682('0x57')]})[_0x6682('0x11')](function(_0x579cdc){_0x1cc647[_0x6682('0x23')]=_0x579cdc;if(_0x12d36c[_0x6682('0x4d')][_0x6682('0x5c')]){_0x310846[_0x6682('0x73')]=[{'model':db[_0x6682('0x85')],'as':_0x6682('0x86'),'required':![]},{'model':db[_0x6682('0x87')],'as':_0x6682('0x88'),'attributes':[_0x6682('0x2a'),_0x6682('0x89'),_0x6682('0x8a')],'required':![]},{'model':db[_0x6682('0x8b')],'as':'Tags','attributes':['id',_0x6682('0x2a'),_0x6682('0x8c')],'where':_0x12d36c[_0x6682('0x4d')]['tag']?{'id':_0x12d36c[_0x6682('0x4d')]['tag']}:undefined,'required':_0x12d36c['query'][_0x6682('0x8d')]?!![]:![]}];}return db['MailInteraction'][_0x6682('0x5d')](_0x310846);})[_0x6682('0x11')](function(_0x338da4){_0x1cc647[_0x6682('0x5e')]=_0x338da4;return _0x1cc647;});}})[_0x6682('0x11')](respondWithFilteredResult(_0x59e9c2,_0x310846))[_0x6682('0x1c')](handleError(_0x59e9c2,null));};exports[_0x6682('0x8e')]=function addApplications(_0x51a4b9,_0x5a3b76){var _0x206a12=_0x51a4b9['params']['id'];var _0x46568e=_0x51a4b9['body'];var _0x422711=0xc8;var _0x5f5811=null;return db[_0x6682('0x8f')][_0x6682('0x90')]({'isolationLevel':db[_0x6682('0x8f')][_0x6682('0x91')][_0x6682('0x92')][_0x6682('0x93')]},function(_0x460a37){return db[_0x6682('0x48')]['findOne']({'where':{'id':_0x206a12},'transaction':_0x460a37})[_0x6682('0x11')](function(_0xc6117b){if(_0xc6117b){return db[_0x6682('0x94')][_0x6682('0x28')]({'where':{'MailAccountId':_0x206a12},'transaction':_0x460a37})[_0x6682('0x11')](function(){var _0x54df20=_[_0x6682('0x4c')](_0x46568e,function(_0x25f2d2){_0x25f2d2[_0x6682('0x6c')]=_0x206a12;return _0x25f2d2;});return db[_0x6682('0x94')][_0x6682('0x95')](_0x54df20,{'transaction':_0x460a37});});}else{_0x422711=0x194;_0x5f5811=[];}});})[_0x6682('0x11')](function(){if(_0x422711!==0x194){return db[_0x6682('0x94')]['findAndCountAll']({'where':{'MailAccountId':_0x206a12},'order':_0x6682('0x96')})[_0x6682('0x11')](function(_0x3b4970){_0x5f5811=_0x3b4970;});}})['catch'](function(_0xa78f7d){_0x422711=0x1f4;logger[_0x6682('0x18')](_0xa78f7d[_0x6682('0x97')]);if(_0xa78f7d[_0x6682('0x2a')]){delete _0xa78f7d[_0x6682('0x2a')];}_0x5f5811=_0xa78f7d;})[_0x6682('0x98')](function(){if(_0x5f5811===null){_0x5a3b76[_0x6682('0x29')](_0x422711);}else{if(_0x422711===0x1f4){_0x5a3b76['status'](_0x422711)[_0x6682('0x2b')](_0x5f5811);}else{_0x5a3b76[_0x6682('0x1d')](_0x422711)[_0x6682('0x1f')](_0x5f5811);}}});};exports[_0x6682('0x99')]=function(_0x226d1c,_0xce4a00){var _0x43fbfe={};var _0x1dc397={};var _0x2ae39a;var _0x119c38;return db['MailAccount'][_0x6682('0x69')]({'where':{'id':_0x226d1c[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0xce4a00,null))[_0x6682('0x11')](function(_0x594f73){if(_0x594f73){_0x2ae39a=_0x594f73;_0x1dc397[_0x6682('0x54')]=_[_0x6682('0x4e')](db['MailApplication']['rawAttributes']);_0x1dc397[_0x6682('0x4d')]=_['keys'](_0x226d1c['query']);_0x1dc397[_0x6682('0x4f')]=_[_0x6682('0x51')](_0x1dc397[_0x6682('0x54')],_0x1dc397[_0x6682('0x4d')]);_0x43fbfe[_0x6682('0x50')]=_[_0x6682('0x51')](_0x1dc397[_0x6682('0x54')],qs['fields'](_0x226d1c['query'][_0x6682('0x52')]));_0x43fbfe[_0x6682('0x50')]=_0x43fbfe[_0x6682('0x50')][_0x6682('0x53')]?_0x43fbfe[_0x6682('0x50')]:_0x1dc397[_0x6682('0x54')];_0x43fbfe[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x226d1c[_0x6682('0x4d')][_0x6682('0x56')]);_0x43fbfe[_0x6682('0x57')]=qs['filters'](_[_0x6682('0x72')](_0x226d1c[_0x6682('0x4d')],_0x1dc397['filters']));if(_0x226d1c[_0x6682('0x4d')][_0x6682('0x58')]){_0x43fbfe[_0x6682('0x57')]=_[_0x6682('0x59')](_0x43fbfe[_0x6682('0x57')],{'$or':_['map'](_0x43fbfe[_0x6682('0x50')],function(_0x3cefaf){var _0x146c65={};_0x146c65[_0x3cefaf]={'$like':'%'+_0x226d1c[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x146c65;})});}_0x43fbfe=_['merge']({},_0x43fbfe,_0x226d1c[_0x6682('0x61')]);return _0x2ae39a[_0x6682('0x99')](_0x43fbfe);}})[_0x6682('0x11')](function(_0x941caf){if(_0x941caf){_0x119c38=_0x941caf['length'];if(!_0x226d1c[_0x6682('0x4d')]['hasOwnProperty'](_0x6682('0x6b'))){_0x43fbfe[_0x6682('0x22')]=qs[_0x6682('0x22')](_0x226d1c[_0x6682('0x4d')][_0x6682('0x22')]);_0x43fbfe[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x226d1c[_0x6682('0x4d')][_0x6682('0x20')]);}return _0x2ae39a[_0x6682('0x99')](_0x43fbfe);}})[_0x6682('0x11')](function(_0x36bb50){if(_0x36bb50){return _0x36bb50?{'count':_0x119c38,'rows':_0x36bb50}:null;}})['then'](respondWithResult(_0xce4a00,null))[_0x6682('0x1c')](handleError(_0xce4a00,null));};exports[_0x6682('0x9a')]=function(_0x1140dc,_0x1290c0){var _0x5b4127={'raw':!![],'where':{}};var _0x1b0772={};var _0x59f087={'count':0x0,'rows':[]};return db['MailAccount'][_0x6682('0x69')]({'where':{'id':_0x1140dc[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x1290c0,null))['then'](function(_0x3feae8){if(_0x3feae8){_0x1b0772['model']=_[_0x6682('0x4e')](db[_0x6682('0x9b')][_0x6682('0x49')]);_0x1b0772['query']=_[_0x6682('0x4e')](_0x1140dc['query']);_0x1b0772[_0x6682('0x4f')]=_[_0x6682('0x51')](_0x1b0772['model'],_0x1b0772[_0x6682('0x4d')]);_0x5b4127['attributes']=_[_0x6682('0x51')](_0x1b0772['model'],qs[_0x6682('0x52')](_0x1140dc[_0x6682('0x4d')]['fields']));_0x5b4127[_0x6682('0x50')]=_0x5b4127[_0x6682('0x50')][_0x6682('0x53')]?_0x5b4127['attributes']:_0x1b0772['model'];if(!_0x1140dc['query'][_0x6682('0x6a')](_0x6682('0x6b'))){_0x5b4127[_0x6682('0x22')]=qs['limit'](_0x1140dc['query'][_0x6682('0x22')]);_0x5b4127['offset']=qs[_0x6682('0x20')](_0x1140dc[_0x6682('0x4d')][_0x6682('0x20')]);}_0x5b4127[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x1140dc[_0x6682('0x4d')][_0x6682('0x56')]);_0x5b4127['where']=qs[_0x6682('0x4f')](_[_0x6682('0x72')](_0x1140dc[_0x6682('0x4d')],_0x1b0772['filters']));_0x5b4127[_0x6682('0x57')][_0x6682('0x6c')]=_0x3feae8['id'];if(_0x1140dc[_0x6682('0x4d')]['filter']){_0x5b4127[_0x6682('0x57')]=_[_0x6682('0x59')](_0x5b4127['where'],{'$or':_[_0x6682('0x4c')](_0x5b4127['attributes'],function(_0x146271){var _0x413175={};_0x413175[_0x146271]={'$like':'%'+_0x1140dc[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x413175;})});}if(_0x1140dc[_0x6682('0x4d')][_0x6682('0x9c')]){var _0x256979=_0x1140dc[_0x6682('0x4d')][_0x6682('0x9c')][_0x6682('0x9d')](',');var _0x2dce45={};_0x2dce45[_0x256979[0x0]]={'$gte':moment(_0x256979[0x1])['format'](_0x6682('0x9e'))};_0x5b4127[_0x6682('0x57')]=_['merge'](_0x5b4127['where'],_0x2dce45);}_0x5b4127=_['merge']({},_0x5b4127,_0x1140dc['options']);return db['MailMessage']['count']({'where':_0x5b4127[_0x6682('0x57')]})[_0x6682('0x11')](function(_0x3871c5){_0x59f087['count']=_0x3871c5;if(_0x1140dc[_0x6682('0x4d')]['includeAll']){_0x5b4127[_0x6682('0x73')]=[{'all':!![]}];}return db[_0x6682('0x9b')][_0x6682('0x5d')](_0x5b4127);})['then'](function(_0x25aa3f){if(_0x1140dc[_0x6682('0x4d')]['inlineCss']===_0x6682('0x9f')){for(var _0x4b2783=0x0;_0x4b2783<_0x25aa3f[_0x6682('0x53')];_0x4b2783++){_0x25aa3f[_0x4b2783][_0x6682('0x62')]=juice(_0x25aa3f[_0x4b2783][_0x6682('0x62')]);}}_0x59f087[_0x6682('0x5e')]=_0x25aa3f;return _0x59f087;});}})['then'](respondWithFilteredResult(_0x1290c0,_0x5b4127))[_0x6682('0x1c')](handleError(_0x1290c0,null));};exports[_0x6682('0x2b')]=function(_0x1bfd8d,_0x5e017a){var _0x2d0831,_0x492b2e={},_0x4e0f33;if(_0x1bfd8d[_0x6682('0x62')]['to']){_0x4e0f33=_0x1bfd8d[_0x6682('0x62')]['to'][_0x6682('0x9d')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x1bfd8d['params']['id']},'include':[{'model':db[_0x6682('0xa0')],'as':'List','include':[{'model':db[_0x6682('0x85')],'as':_0x6682('0xa1'),'where':{'email':_0x4e0f33},'limit':0x1,'order':[[_0x6682('0xa2'),_0x6682('0xa3')]]}]},{'model':db[_0x6682('0x45')],'as':_0x6682('0x42'),'raw':!![],'include':[{'model':db[_0x6682('0xa4')],'as':_0x6682('0xa4'),'raw':!![]}]}]})[_0x6682('0x11')](handleEntityNotFound(_0x5e017a,null))[_0x6682('0x11')](function(_0x5abf23){if(!_0x5abf23)return;_0x2d0831=_0x5abf23;if(!_0x5abf23[_0x6682('0x42')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x6682('0x75')](_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa5')])){_0x1bfd8d['body'][_0x6682('0xa5')]=util[_0x6682('0xa6')](_0x6682('0xa7'),_0x5abf23[_0x6682('0x2a')],_0x5abf23[_0x6682('0xa8')]||_0x5abf23[_0x6682('0x42')][_0x6682('0x37')]);}if(_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa9')]&&_0x1bfd8d[_0x6682('0x62')]['attachments']['length']){for(var _0x406057=0x0;_0x406057<_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa9')]['length'];_0x406057+=0x1){_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa9')][_0x406057]={'filename':_0x1bfd8d['body'][_0x6682('0xa9')][_0x406057][_0x6682('0x2a')],'path':path[_0x6682('0xaa')](config[_0x6682('0xab')],_0x6682('0xac'),_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa9')][_0x406057][_0x6682('0xad')])};}}var _0x2f8408=_0x5abf23['getSmtpOptions']();return respondWithRpcPromise(_0x6682('0xae'),'sendMail',{'account':_0x2f8408,'message':_0x1bfd8d[_0x6682('0x62')]});})['then'](function(_0x418d9a){if(!_0x418d9a)return;_0x492b2e=_0x418d9a;if(!_0x2d0831[_0x6682('0xaf')])throw new Error('List\x20not\x20found');if(_0x2d0831[_0x6682('0xaf')][_0x6682('0xa1')]['length'])return _0x2d0831[_0x6682('0xaf')][_0x6682('0xa1')][0x0];return db['CmContact'][_0x6682('0x71')](_[_0x6682('0xc')](_0x1bfd8d[_0x6682('0x62')],{'firstName':_0x1bfd8d[_0x6682('0x62')]['to'],'email':_0x1bfd8d[_0x6682('0x62')]['to'],'phone':_0x1bfd8d[_0x6682('0x62')]['to'],'ListId':_0x2d0831[_0x6682('0xb0')]}));})[_0x6682('0x11')](function(_0x5db7b3){if(!_0x5db7b3)return;var _0x4a621a={'UserId':_0x1bfd8d[_0x6682('0x37')]['id'],'ContactId':_0x5db7b3['id'],'MailAccountId':_0x2d0831['id'],'inReplyTo':_0x492b2e[_0x6682('0xb1')],'to':_0x1bfd8d[_0x6682('0x62')][_0x6682('0xa5')],'cc':_0x1bfd8d[_0x6682('0x62')]['cc'],'subject':_0x1bfd8d[_0x6682('0x62')][_0x6682('0xb2')],'attach':_0x1bfd8d[_0x6682('0x62')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x6682('0xa6')](_0x6682('0x9e')),'lastMsgDirection':_0x6682('0xb3'),'Messages':[_[_0x6682('0x59')](_0x1bfd8d[_0x6682('0x62')],{'messageId':_0x492b2e[_0x6682('0xb1')],'sentAt':moment()[_0x6682('0xa6')](_0x6682('0x9e')),'read':!![],'MailAccountId':_0x2d0831['id'],'UserId':_0x1bfd8d[_0x6682('0x37')]['id'],'ContactId':_0x5db7b3['id']})]};if(_0x1bfd8d[_0x6682('0x62')][_0x6682('0xb4')]){_0x4a621a=_[_0x6682('0x59')](_0x4a621a,_0x1bfd8d[_0x6682('0x62')][_0x6682('0xb4')]);}return db[_0x6682('0x82')]['create'](_0x4a621a,{'include':[{'model':db[_0x6682('0x9b')],'as':_0x6682('0xb5')}]});})[_0x6682('0x11')](respondWithResult(_0x5e017a,null))['catch'](handleError(_0x5e017a,null));};exports[_0x6682('0xb6')]=function(_0x105ce0,_0x1c0e9b){return db['MailAccount']['find']({'where':{'id':_0x105ce0['params']['id']},'include':[{'model':db[_0x6682('0x45')],'as':_0x6682('0x42'),'raw':!![],'include':[{'model':db[_0x6682('0xa4')],'as':_0x6682('0xa4'),'raw':!![]}]}]})[_0x6682('0x11')](handleEntityNotFound(_0x1c0e9b,null))[_0x6682('0x11')](function(_0x23e9ea){if(!_0x23e9ea['Smtp'])return;var _0x2af136=_0x23e9ea[_0x6682('0xb7')]();return respondWithRpcPromise('VerifySmtp',_0x6682('0xb6'),{'account':_0x2af136});})['then'](respondWithResult(_0x1c0e9b,null))[_0x6682('0x1c')](handleError(_0x1c0e9b,null));};exports[_0x6682('0x28')]=function(_0x268b82,_0x2b8fec){return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x268b82[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x2b8fec,null))[_0x6682('0x11')](function(_0x51f39e){if(_0x51f39e&&_0x51f39e[_0x6682('0x3e')]){throw new db['Sequelize'][(_0x6682('0xb8'))](_0x6682('0xb9'));}return _0x51f39e;})[_0x6682('0x11')](removeEntity(_0x2b8fec,null))['catch'](handleError(_0x2b8fec,null));};exports['addAgents']=function(_0x56a61d,_0x341e53){return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x56a61d['params']['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x341e53,null))[_0x6682('0x11')](function(_0x435158){if(_0x435158){return _0x435158['addAgents'](_0x56a61d[_0x6682('0x62')][_0x6682('0x6e')],_[_0x6682('0x83')](_0x56a61d[_0x6682('0x62')],[_0x6682('0x6e'),'id'])||{})[_0x6682('0xba')](function(_0x207801){for(var _0x372170=0x0;_0x372170<_0x56a61d[_0x6682('0x62')][_0x6682('0x6e')][_0x6682('0x53')];_0x372170+=0x1){socket[_0x6682('0xbb')](_0x6682('0xbc'),{'UserId':Number(_0x56a61d['body'][_0x6682('0x6e')][_0x372170]),'MailAccountId':Number(_0x56a61d['params']['id'])});}return _0x207801;});}})[_0x6682('0x11')](respondWithResult(_0x341e53,null))['catch'](handleError(_0x341e53,null));};exports[_0x6682('0xbd')]=function(_0x14380e,_0x3842a8){return db[_0x6682('0x48')][_0x6682('0x66')]({'where':{'id':_0x14380e['params']['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x3842a8,null))['then'](function(_0x5430d5){if(_0x5430d5){return _0x5430d5[_0x6682('0xbd')](_0x14380e['query'][_0x6682('0x6e')])[_0x6682('0x11')](function(){if(_[_0x6682('0xbe')](_0x14380e['query'][_0x6682('0x6e')])){for(var _0x282130=0x0;_0x282130<_0x14380e[_0x6682('0x4d')][_0x6682('0x6e')]['length'];_0x282130+=0x1){socket[_0x6682('0xbb')](_0x6682('0xbf'),{'UserId':Number(_0x14380e[_0x6682('0x4d')][_0x6682('0x6e')][_0x282130]),'MailAccountId':Number(_0x14380e[_0x6682('0x60')]['id'])});}}else{socket[_0x6682('0xbb')]('userMailAccount:remove',{'UserId':Number(_0x14380e[_0x6682('0x4d')][_0x6682('0x6e')]),'MailAccountId':Number(_0x14380e['params']['id'])});}});}})[_0x6682('0x11')](respondWithStatusCode(_0x3842a8,null))[_0x6682('0x1c')](handleError(_0x3842a8,null));};exports[_0x6682('0xc0')]=function(_0x2febec,_0x24af56){var _0x1e6cfe={};var _0x3341be={};var _0x30d5f0;var _0xc800cf;return db[_0x6682('0x48')][_0x6682('0x69')]({'where':{'id':_0x2febec[_0x6682('0x60')]['id']}})[_0x6682('0x11')](handleEntityNotFound(_0x24af56,null))['then'](function(_0x407cf7){if(_0x407cf7){_0x30d5f0=_0x407cf7;_0x3341be['model']=_['keys'](db[_0x6682('0x87')][_0x6682('0x49')]);_0x3341be[_0x6682('0x4d')]=_['keys'](_0x2febec[_0x6682('0x4d')]);_0x3341be[_0x6682('0x4f')]=_[_0x6682('0x51')](_0x3341be[_0x6682('0x54')],_0x3341be['query']);_0x1e6cfe[_0x6682('0x50')]=_[_0x6682('0x51')](_0x3341be['model'],qs[_0x6682('0x52')](_0x2febec['query'][_0x6682('0x52')]));_0x1e6cfe[_0x6682('0x50')]=_0x1e6cfe[_0x6682('0x50')][_0x6682('0x53')]?_0x1e6cfe[_0x6682('0x50')]:_0x3341be[_0x6682('0x54')];_0x1e6cfe[_0x6682('0x55')]=qs[_0x6682('0x56')](_0x2febec['query']['sort']);_0x1e6cfe[_0x6682('0x57')]=qs[_0x6682('0x4f')](_['pick'](_0x2febec[_0x6682('0x4d')],_0x3341be[_0x6682('0x4f')]));if(_0x2febec[_0x6682('0x4d')][_0x6682('0x58')]){_0x1e6cfe[_0x6682('0x57')]=_[_0x6682('0x59')](_0x1e6cfe['where'],{'$or':_[_0x6682('0x4c')](_0x1e6cfe['attributes'],function(_0x1966e6){var _0x5d44af={};_0x5d44af[_0x1966e6]={'$like':'%'+_0x2febec[_0x6682('0x4d')][_0x6682('0x58')]+'%'};return _0x5d44af;})});}_0x1e6cfe=_[_0x6682('0x59')]({},_0x1e6cfe,_0x2febec['options']);return _0x30d5f0['getAgents'](_0x1e6cfe);}})['then'](function(_0x5215ce){if(_0x5215ce){_0xc800cf=_0x5215ce[_0x6682('0x53')];if(!_0x2febec[_0x6682('0x4d')][_0x6682('0x6a')](_0x6682('0x6b'))){_0x1e6cfe[_0x6682('0x22')]=qs[_0x6682('0x22')](_0x2febec[_0x6682('0x4d')][_0x6682('0x22')]);_0x1e6cfe[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x2febec[_0x6682('0x4d')][_0x6682('0x20')]);}return _0x30d5f0['getAgents'](_0x1e6cfe);}})[_0x6682('0x11')](function(_0x3d963){if(_0x3d963){return _0x3d963?{'count':_0xc800cf,'rows':_0x3d963}:null;}})['then'](respondWithResult(_0x24af56,null))[_0x6682('0x1c')](handleError(_0x24af56,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index eaef583..8753604 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 _0x00b3=['hasOwnProperty','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x00b3,0x157));var _0x300b=function(_0x4fcb47,_0x33bc86){_0x4fcb47=_0x4fcb47-0x0;var _0x379527=_0x00b3[_0x4fcb47];return _0x379527;};'use strict';var EventEmitter=require(_0x300b('0x0'));var MailAccount=require(_0x300b('0x1'))['db'][_0x300b('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x300b('0x3')](0x0);var events={'afterCreate':_0x300b('0x4'),'afterUpdate':_0x300b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x968375){return function(_0x204f71,_0x494436,_0x2f3a41){MailAccountEvents['emit'](_0x968375+':'+_0x204f71['id'],_0x204f71);MailAccountEvents[_0x300b('0x6')](_0x968375,_0x204f71);_0x2f3a41(null);};}for(var e in events){if(events[_0x300b('0x7')](e)){var event=events[e];MailAccount[_0x300b('0x8')](e,emitEvent(event));}}module[_0x300b('0x9')]=MailAccountEvents; \ No newline at end of file +var _0xda2d=['remove','emit','hook','exports','../../mysqldb','MailAccount','save'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0xda2d,0xb3));var _0xdda2=function(_0x159229,_0x57af10){_0x159229=_0x159229-0x0;var _0x21b019=_0xda2d[_0x159229];return _0x21b019;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xdda2('0x0'))['db'][_0xdda2('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdda2('0x2'),'afterUpdate':'update','afterDestroy':_0xdda2('0x3')};function emitEvent(_0x5f2940){return function(_0x6f07af,_0x30f5e0,_0x12e325){MailAccountEvents[_0xdda2('0x4')](_0x5f2940+':'+_0x6f07af['id'],_0x6f07af);MailAccountEvents[_0xdda2('0x4')](_0x5f2940,_0x6f07af);_0x12e325(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xdda2('0x5')](e,emitEvent(event));}}module[_0xdda2('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 605776e..7014a4b 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 _0x3938=['port','secure','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','user','data5','pass','exports','define','MailAccount','custom','service','Smtp','host'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x3938,0x1c9));var _0x8393=function(_0x2c2317,_0x193b09){_0x2c2317=_0x2c2317-0x0;var _0x23209b=_0x3938[_0x2c2317];return _0x23209b;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x8393('0x0')]=function(_0x569626){return _0x569626[_0x8393('0x1')](_0x8393('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x9c4739=this;var _0x5c8680={'id':_0x9c4739['id'],'tls':{'rejectUnauthorized':![]}};if(_0x9c4739['provider']!==_0x8393('0x3')){_0x5c8680[_0x8393('0x4')]=_0x9c4739['provider'];}else{_0x5c8680['host']=_0x9c4739[_0x8393('0x5')][_0x8393('0x6')];_0x5c8680[_0x8393('0x7')]=_0x9c4739[_0x8393('0x5')][_0x8393('0x7')];_0x5c8680[_0x8393('0x8')]=_0x9c4739[_0x8393('0x5')][_0x8393('0x8')];}if(_0x9c4739['Smtp'][_0x8393('0x9')]){if(_0x9c4739['Smtp']['modernAuthentication']){if(!_0x9c4739[_0x8393('0x5')][_0x8393('0xa')])throw new Error(_0x8393('0xb'));_0x5c8680[_0x8393('0xc')]={'type':'OAuth2','user':_0x9c4739['Smtp'][_0x8393('0xd')],'accessToken':_0x9c4739[_0x8393('0x5')][_0x8393('0xa')][_0x8393('0xe')]};}else{_0x5c8680[_0x8393('0xc')]={'user':_0x9c4739['Smtp'][_0x8393('0xd')],'pass':_0x9c4739['Smtp'][_0x8393('0xf')]};}}return _0x5c8680;}}});}; \ No newline at end of file +var _0x5bea=['Smtp','port','authentication','modernAuthentication','CloudProvider','auth','OAuth2','exports','mail_accounts','provider','custom','service','host'];(function(_0x5ef061,_0x11915f){var _0x44ec9c=function(_0x26d044){while(--_0x26d044){_0x5ef061['push'](_0x5ef061['shift']());}};_0x44ec9c(++_0x11915f);}(_0x5bea,0x166));var _0xa5be=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x5bea[_0x1cc8fe];return _0x230054;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xa5be('0x0')]=function(_0x40e8f7){return _0x40e8f7['define']('MailAccount',attributes,{'tableName':_0xa5be('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x39fc62=this;var _0x4da3ca={'id':_0x39fc62['id'],'tls':{'rejectUnauthorized':![]}};if(_0x39fc62[_0xa5be('0x2')]!==_0xa5be('0x3')){_0x4da3ca[_0xa5be('0x4')]=_0x39fc62['provider'];}else{_0x4da3ca[_0xa5be('0x5')]=_0x39fc62[_0xa5be('0x6')][_0xa5be('0x5')];_0x4da3ca[_0xa5be('0x7')]=_0x39fc62[_0xa5be('0x6')][_0xa5be('0x7')];_0x4da3ca['secure']=_0x39fc62[_0xa5be('0x6')]['secure'];}if(_0x39fc62[_0xa5be('0x6')][_0xa5be('0x8')]){if(_0x39fc62[_0xa5be('0x6')][_0xa5be('0x9')]){if(!_0x39fc62['Smtp'][_0xa5be('0xa')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x4da3ca[_0xa5be('0xb')]={'type':_0xa5be('0xc'),'user':_0x39fc62[_0xa5be('0x6')]['user'],'accessToken':_0x39fc62['Smtp'][_0xa5be('0xa')]['data5']};}else{_0x4da3ca['auth']={'user':_0x39fc62[_0xa5be('0x6')]['user'],'pass':_0x39fc62[_0xa5be('0x6')]['pass']};}}return _0x4da3ca;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index e6d9d32..975e459 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 _0x5f2f=['Attachments','UserId','User','agent','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMailAccount','options','where','limit','include','model','attributes','map','MailAccount','find','raw','then','smtp','smtpOptions','getSmtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','updatedAt','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','CmContact','DESC','MailApplication','MailServerOut','Smtp','CloudProvider','get','omit','applications','Applications','priority','asc','autoclose','push','close','Contacts','length','create','messageId','subject','format','MailMessage','Messages','inReplyTo','MailInteraction','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','contact','attachments','originCc','originChannel','Email','ChatOfflineMessageId','Attachment'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5f2f,0x73));var _0xf5f2=function(_0x557178,_0x249c2e){_0x557178=_0x557178-0x0;var _0x5aefb4=_0x5f2f[_0x557178];return _0x5aefb4;};'use strict';var _=require(_0xf5f2('0x0'));var moment=require(_0xf5f2('0x1'));var BPromise=require(_0xf5f2('0x2'));var rs=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var db=require(_0xf5f2('0x5'))['db'];var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5f2('0x8')][_0xf5f2('0x9')]({'port':0x232c});config[_0xf5f2('0xa')]=_[_0xf5f2('0xb')](config[_0xf5f2('0xa')],{'host':_0xf5f2('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f2('0xa')]));require(_0xf5f2('0xd'))[_0xf5f2('0xe')](socket);function respondWithRpcPromise(_0x56a69f,_0x375da4,_0x15dd7c){return new BPromise(function(_0x218ae3,_0x4e0e6b){return client[_0xf5f2('0xf')](_0x56a69f,_0x15dd7c)['then'](function(_0x53fb33){logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,'request\x20sent');logger[_0xf5f2('0x12')](_0xf5f2('0x13'),_0x375da4,_0xf5f2('0x14'),JSON[_0xf5f2('0x15')](_0x53fb33));if(_0x53fb33[_0xf5f2('0x16')]){if(_0x53fb33[_0xf5f2('0x16')]['code']===0x1f4){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x4e0e6b(_0x53fb33[_0xf5f2('0x16')]['message']);}logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);return _0x218ae3(_0x53fb33[_0xf5f2('0x16')][_0xf5f2('0x17')]);}else{logger[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x375da4,_0xf5f2('0x14'));_0x218ae3(_0x53fb33[_0xf5f2('0x18')][_0xf5f2('0x17')]);}})[_0xf5f2('0x19')](function(_0x4ff59b){logger[_0xf5f2('0x16')](_0xf5f2('0x11'),_0x375da4,_0x4ff59b);_0x4e0e6b(_0x4ff59b);});});}exports[_0xf5f2('0x1a')]=function(_0x1bf655){var _0x56acc5=this;return new Promise(function(_0x34706d,_0x47101e){return db['MailAccount']['findAll']({'raw':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1c')]||null:null,'attributes':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['attributes']||null:null,'limit':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1d')]||null:null,'include':_0x1bf655[_0xf5f2('0x1b')]?_0x1bf655[_0xf5f2('0x1b')]['include']?_['map'](_0x1bf655[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')],'include':_0x294414[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x294414[_0xf5f2('0x1e')],function(_0x198c73){return{'model':db[_0x198c73[_0xf5f2('0x1f')]],'as':_0x198c73['as'],'attributes':_0x198c73['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22c826){logger[_0xf5f2('0x10')](_0xf5f2('0x1a'),_0x1bf655);logger['debug']('GetMailAccount',_0x1bf655,JSON[_0xf5f2('0x15')](_0x22c826));_0x34706d(_0x22c826);})[_0xf5f2('0x19')](function(_0x17394a){logger[_0xf5f2('0x16')](_0xf5f2('0x1a'),_0x17394a['message'],_0x1bf655);_0x47101e(_0x56acc5['error'](0x1f4,_0x17394a[_0xf5f2('0x17')]));});});};exports['ShowMailAccount']=function(_0xb744b9){var _0x58a4df=this;return new Promise(function(_0x45b643,_0x31087c){return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'raw':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x24')]===undefined?!![]:![]:!![],'where':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9['options'][_0xf5f2('0x1c')]||null:null,'attributes':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null,'include':_0xb744b9[_0xf5f2('0x1b')]?_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')]?_['map'](_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes'],'include':_0x2e3cca[_0xf5f2('0x1e')]?_[_0xf5f2('0x21')](_0x2e3cca[_0xf5f2('0x1e')],function(_0x4ec8fb){return{'model':db[_0x4ec8fb[_0xf5f2('0x1f')]],'as':_0x4ec8fb['as'],'attributes':_0x4ec8fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x25')](function(_0x566c47){if(_0xb744b9[_0xf5f2('0x1b')][_0xf5f2('0x26')]===!![])_0x566c47['setDataValue'](_0xf5f2('0x27'),_0x566c47[_0xf5f2('0x28')]());logger[_0xf5f2('0x10')](_0xf5f2('0x29'),_0xb744b9);logger['debug']('ShowMailAccount',_0xb744b9,JSON[_0xf5f2('0x15')](_0x566c47));_0x45b643(_0x566c47);})[_0xf5f2('0x19')](function(_0x22b20c){logger[_0xf5f2('0x16')](_0xf5f2('0x29'),_0x22b20c[_0xf5f2('0x17')],_0xb744b9);_0x31087c(_0x58a4df[_0xf5f2('0x16')](0x1f4,_0x22b20c['message']));});});};exports[_0xf5f2('0x2a')]=function(_0x3b4ea6){var _0x536501=this;return new Promise(function(_0xc6a1ae,_0x3f3895){var _0x71b0e7={'body':_0x3b4ea6[_0xf5f2('0x2b')],'channel':_0xf5f2('0x2c')};var _0x3b6372=_[_0xf5f2('0x2d')](_[_0xf5f2('0x2e')](db['CmContact'][_0xf5f2('0x2f')]),[_0xf5f2('0x30'),_0xf5f2('0x31'),'CompanyId','ListId']);var _0x59eb00=![];if(_0x3b4ea6[_0xf5f2('0x2b')]['id']){delete _0x3b4ea6[_0xf5f2('0x2b')]['id'];}if(_['isNil'](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x33')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')])||_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')]===''){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x35')));}if(_[_0xf5f2('0x34')](_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501['error'](0x1f4,_0xf5f2('0x37')+_0x3b6372));}if(!_['includes'](_0x3b6372,_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x36')])){return _0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0xf5f2('0x38')+_0x3b6372));}var _0x31bf0e={};_0x31bf0e[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x22')][_0xf5f2('0x23')]({'where':{'id':_0x3b4ea6[_0xf5f2('0x39')]['id']},'include':[{'model':db[_0xf5f2('0x3a')],'as':_0xf5f2('0x3b'),'include':[{'model':db[_0xf5f2('0x3c')],'as':'Contacts','where':_0x31bf0e,'limit':0x1,'order':[[_0xf5f2('0x31'),_0xf5f2('0x3d')]]}]},{'model':db[_0xf5f2('0x3e')],'as':'Applications'},{'model':db[_0xf5f2('0x3f')],'as':_0xf5f2('0x40'),'include':[{'model':db[_0xf5f2('0x41')],'as':'CloudProvider'}]}]})['then'](function(_0x7bb942){if(_0x7bb942&&_0x7bb942[_0xf5f2('0x3b')]){var _0x5db519=_0x7bb942[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7['account']=_[_0xf5f2('0x43')](_0x5db519,['Applications',_0xf5f2('0x3b')]);_0x71b0e7['account'][_0xf5f2('0x27')]=_0x7bb942[_0xf5f2('0x28')]();_0x71b0e7[_0xf5f2('0x44')]=_0x5db519[_0xf5f2('0x45')];_0x71b0e7['list']=_0x5db519[_0xf5f2('0x3b')];_0x71b0e7[_0xf5f2('0x44')]=_['orderBy'](_0x71b0e7['applications'],[_0xf5f2('0x46')],[_0xf5f2('0x47')]);if(_0x71b0e7['account']&&_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x48')]){_0x71b0e7[_0xf5f2('0x44')][_0xf5f2('0x49')]({'id':0x0,'priority':_0x71b0e7['applications']['length']+0x1,'app':_0xf5f2('0x4a'),'appdata':_0xf5f2('0x48'),'interval':'*,*,*,*'});}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')]){delete _0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x45')];}if(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x3b')]){delete _0x71b0e7[_0xf5f2('0x39')]['List'];}if(_0x5db519['List'][_0xf5f2('0x4b')][_0xf5f2('0x4c')]){return _0x5db519[_0xf5f2('0x3b')][_0xf5f2('0x4b')][0x0];}var _0x21b0d3=_['defaults'](_0x3b4ea6[_0xf5f2('0x2b')],{'firstName':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')],'ListId':_0x5db519['ListId']});_0x21b0d3[_0x3b4ea6[_0xf5f2('0x2b')]['mapKey']]=_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x32')];return db[_0xf5f2('0x3c')][_0xf5f2('0x4d')](_0x21b0d3);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x756f1f){_0x71b0e7['contact']=_0x756f1f;if(_0x756f1f){if(!_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['messageId']){_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4e')]=rs['generate']()+'\x20'+_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')];}var _0x4579f4={'ContactId':_0x756f1f['id'],'MailAccountId':_0x3b4ea6['account']['id'],'inReplyTo':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'cc':_0x3b4ea6[_0xf5f2('0x2b')]['message']['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['attach'],'lastMsgAt':moment()[_0xf5f2('0x50')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xf5f2('0x23')]({'where':{'closed':![],'MailAccountId':_0x3b4ea6['account']['id']},'include':[{'model':db[_0xf5f2('0x51')],'as':_0xf5f2('0x52'),'attributes':[_0xf5f2('0x4e')],'where':{'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x53')]}}]})[_0xf5f2('0x25')](function(_0x1ec682){if(_0x1ec682){return[_0x1ec682,![]];}return db[_0xf5f2('0x54')][_0xf5f2('0x4d')](_0x4579f4)[_0xf5f2('0x25')](function(_0x158768){return[_0x158768,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xf5f2('0x55')](function(_0x2d171d,_0xb39a6e){if(_0x2d171d){_0x59eb00=_0xb39a6e;if(!_0xb39a6e){return _0x2d171d[_0xf5f2('0x56')]({'inReplyTo':_0x3b4ea6['body'][_0xf5f2('0x17')]['messageId'],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['from'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x2d171d['attach']?_0x2d171d[_0xf5f2('0x57')]:_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x57')],'substatus':null,'substatusAt':moment()[_0xf5f2('0x50')](_0xf5f2('0x58')),'lastMsgAt':moment()['format'](_0xf5f2('0x58')),'lastMsgDirection':'in'});}else{return _0x2d171d;}}})[_0xf5f2('0x25')](function(_0x4800fe){_0x71b0e7[_0xf5f2('0x59')]=_0x4800fe[_0xf5f2('0x42')]({'plain':!![]});_0x71b0e7[_0xf5f2('0x59')]['created']=_0x59eb00;return db['MailMessage']['create']({'body':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x2b')],'MailAccountId':_0x3b4ea6[_0xf5f2('0x39')]['id'],'MailInteractionId':_0x4800fe['id'],'direction':'in','ContactId':_0x71b0e7[_0xf5f2('0x5a')]['id'],'messageId':_0x3b4ea6[_0xf5f2('0x2b')]['message'][_0xf5f2('0x4e')],'from':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x32')],'to':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['to'],'cc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['cc'],'subject':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x4f')],'attach':_0x3b4ea6['body']['message']['attach'],'Attachments':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5b')],'originTo':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['originTo'],'originCc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5c')],'bcc':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['bcc'],'ChatWebsiteId':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')]['ChatWebsiteId']||null,'originChannel':_0x3b4ea6[_0xf5f2('0x2b')][_0xf5f2('0x17')][_0xf5f2('0x5d')]||_0xf5f2('0x5e'),'ChatOfflineMessageId':_0x3b4ea6['body'][_0xf5f2('0x17')][_0xf5f2('0x5f')]||null},{'include':[{'model':db[_0xf5f2('0x60')],'as':_0xf5f2('0x61')}]});})[_0xf5f2('0x25')](function(_0x4f47e1){_0x71b0e7['message']=_0x4f47e1;if(_0x71b0e7[_0xf5f2('0x59')][_0xf5f2('0x62')]){return db[_0xf5f2('0x63')][_0xf5f2('0x23')]({'attributes':['id','name'],'where':{'id':_0x71b0e7['interaction'][_0xf5f2('0x62')]}})['then'](function(_0x4c4420){if(_0x4c4420){_0x71b0e7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xf5f2('0x64'),'appdata':_0x4c4420[_0xf5f2('0x65')]+','+(_0x71b0e7[_0xf5f2('0x39')][_0xf5f2('0x66')]||0xa),'interval':_0xf5f2('0x67')});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);});}return respondWithRpcPromise(_0xf5f2('0x68'),_0xf5f2('0x69'),_0x71b0e7);})[_0xf5f2('0x25')](function(_0x9afb3c){_0xc6a1ae(_0x9afb3c);})[_0xf5f2('0x19')](function(_0x1ba503){_0x3f3895(_0x536501[_0xf5f2('0x16')](0x1f4,_0x1ba503[_0xf5f2('0x17')]));});});}; \ No newline at end of file +var _0x5f66=['../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','request\x20sent','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','where','limit','include','map','model','attributes','stringify','find','smtp','smtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','getSmtpOptions','list','applications','orderBy','priority','autoclose','push','close','defaults','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','MailMessage','create','attachments','originTo','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','name','unshift','agent','*,*,*,*','startRouting','Start','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var BPromise=require('bluebird');var rs=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var db=require(_0x65f6('0x3'))['db'];var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x6'));var client=jayson['client'][_0x65f6('0x7')]({'port':0x232c});config[_0x65f6('0x8')]=_['defaults'](config['redis'],{'host':_0x65f6('0x9'),'port':0x18eb});var socket=require(_0x65f6('0xa'))(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0xb'))[_0x65f6('0xc')](socket);function respondWithRpcPromise(_0x14f4c7,_0x48d85c,_0x5123ee){return new BPromise(function(_0x18fea1,_0x2f6d5b){return client[_0x65f6('0xd')](_0x14f4c7,_0x5123ee)[_0x65f6('0xe')](function(_0x50d26d){logger[_0x65f6('0xf')]('MailAccount,\x20%s,\x20%s',_0x48d85c,'request\x20sent');logger[_0x65f6('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x48d85c,_0x65f6('0x11'),JSON['stringify'](_0x50d26d));if(_0x50d26d[_0x65f6('0x12')]){if(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x13')]===0x1f4){logger[_0x65f6('0x12')](_0x65f6('0x14'),_0x48d85c,_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);return _0x2f6d5b(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);}logger[_0x65f6('0x12')]('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x50d26d[_0x65f6('0x12')]['message']);return _0x18fea1(_0x50d26d['error'][_0x65f6('0x15')]);}else{logger[_0x65f6('0xf')](_0x65f6('0x14'),_0x48d85c,_0x65f6('0x11'));_0x18fea1(_0x50d26d[_0x65f6('0x16')][_0x65f6('0x15')]);}})[_0x65f6('0x17')](function(_0x18380e){logger['error']('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x18380e);_0x2f6d5b(_0x18380e);});});}exports[_0x65f6('0x18')]=function(_0x5b4055){var _0x4c81f3=this;return new Promise(function(_0x5c5b91,_0x365159){return db[_0x65f6('0x19')]['findAll']({'raw':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1c')]||null:null,'attributes':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')]['attributes']||null:null,'limit':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1d')]||null:null,'include':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x5b4055[_0x65f6('0x1a')]['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x20')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x21')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x20')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes'],'include':_0x29abdb[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x29abdb['include'],function(_0x325cb4){return{'model':db[_0x325cb4[_0x65f6('0x20')]],'as':_0x325cb4['as'],'attributes':_0x325cb4[_0x65f6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ac04b){logger['info'](_0x65f6('0x18'),_0x5b4055);logger[_0x65f6('0x10')](_0x65f6('0x18'),_0x5b4055,JSON[_0x65f6('0x22')](_0x4ac04b));_0x5c5b91(_0x4ac04b);})[_0x65f6('0x17')](function(_0x14a387){logger[_0x65f6('0x12')]('GetMailAccount',_0x14a387['message'],_0x5b4055);_0x365159(_0x4c81f3[_0x65f6('0x12')](0x1f4,_0x14a387[_0x65f6('0x15')]));});});};exports['ShowMailAccount']=function(_0x4e50c0){var _0x10b368=this;return new Promise(function(_0x1ce43c,_0x11fe3b){return db[_0x65f6('0x19')][_0x65f6('0x23')]({'raw':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0['options'][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')]['where']||null:null,'attributes':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x21')]||null:null,'include':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')]?_['map'](_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x20')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1e')]?_['map'](_0x4f3e22[_0x65f6('0x1e')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x21')],'include':_0x24f7fd[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x24f7fd['include'],function(_0x582c7e){return{'model':db[_0x582c7e[_0x65f6('0x20')]],'as':_0x582c7e['as'],'attributes':_0x582c7e['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xe')](function(_0x4e6653){if(_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x24')]===!![])_0x4e6653['setDataValue'](_0x65f6('0x25'),_0x4e6653['getSmtpOptions']());logger['info'](_0x65f6('0x26'),_0x4e50c0);logger[_0x65f6('0x10')](_0x65f6('0x26'),_0x4e50c0,JSON[_0x65f6('0x22')](_0x4e6653));_0x1ce43c(_0x4e6653);})[_0x65f6('0x17')](function(_0x28845a){logger[_0x65f6('0x12')](_0x65f6('0x26'),_0x28845a['message'],_0x4e50c0);_0x11fe3b(_0x10b368[_0x65f6('0x12')](0x1f4,_0x28845a['message']));});});};exports[_0x65f6('0x27')]=function(_0xa4394a){var _0x4ba7db=this;return new Promise(function(_0x2ea7f7,_0x5ef5c2){var _0x32148f={'body':_0xa4394a[_0x65f6('0x28')],'channel':_0x65f6('0x29')};var _0x3fb1c6=_[_0x65f6('0x2a')](_[_0x65f6('0x2b')](db[_0x65f6('0x2c')][_0x65f6('0x2d')]),[_0x65f6('0x2e'),'updatedAt',_0x65f6('0x2f'),_0x65f6('0x30')]);var _0x377ae5=![];if(_0xa4394a[_0x65f6('0x28')]['id']){delete _0xa4394a[_0x65f6('0x28')]['id'];}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x65f6('0x33')));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')])||_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')]===''){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3fb1c6));}if(!_[_0x65f6('0x35')](_0x3fb1c6,_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db['error'](0x1f4,_0x65f6('0x36')+_0x3fb1c6));}var _0x3386a2={};_0x3386a2[_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')]]=_0xa4394a['body'][_0x65f6('0x32')];return db['MailAccount'][_0x65f6('0x23')]({'where':{'id':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x65f6('0x38'),'include':[{'model':db['CmContact'],'as':_0x65f6('0x39'),'where':_0x3386a2,'limit':0x1,'order':[[_0x65f6('0x3a'),_0x65f6('0x3b')]]}]},{'model':db[_0x65f6('0x3c')],'as':_0x65f6('0x3d')},{'model':db[_0x65f6('0x3e')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x65f6('0x3f')}]}]})[_0x65f6('0xe')](function(_0x3b647a){if(_0x3b647a&&_0x3b647a[_0x65f6('0x38')]){var _0x3b907c=_0x3b647a[_0x65f6('0x40')]({'plain':!![]});_0x32148f[_0x65f6('0x37')]=_[_0x65f6('0x41')](_0x3b907c,[_0x65f6('0x3d'),'List']);_0x32148f[_0x65f6('0x37')][_0x65f6('0x25')]=_0x3b647a[_0x65f6('0x42')]();_0x32148f['applications']=_0x3b907c[_0x65f6('0x3d')];_0x32148f[_0x65f6('0x43')]=_0x3b907c['List'];_0x32148f[_0x65f6('0x44')]=_[_0x65f6('0x45')](_0x32148f['applications'],[_0x65f6('0x46')],['asc']);if(_0x32148f[_0x65f6('0x37')]&&_0x32148f[_0x65f6('0x37')][_0x65f6('0x47')]){_0x32148f['applications'][_0x65f6('0x48')]({'id':0x0,'priority':_0x32148f[_0x65f6('0x44')]['length']+0x1,'app':_0x65f6('0x49'),'appdata':_0x65f6('0x47'),'interval':'*,*,*,*'});}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')];}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x38')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x38')];}if(_0x3b907c['List']['Contacts']['length']){return _0x3b907c[_0x65f6('0x38')][_0x65f6('0x39')][0x0];}var _0x111a8a=_[_0x65f6('0x4a')](_0xa4394a['body'],{'firstName':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')],'ListId':_0x3b907c[_0x65f6('0x30')]});_0x111a8a[_0xa4394a['body'][_0x65f6('0x34')]]=_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')];return db['CmContact']['create'](_0x111a8a);}else{throw new Error(_0x65f6('0x4b'));}})[_0x65f6('0xe')](function(_0x4125cb){_0x32148f[_0x65f6('0x4c')]=_0x4125cb;if(_0x4125cb){if(!_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]){_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]=rs[_0x65f6('0x4e')]()+'\x20'+_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')];}var _0x5ba9c6={'ContactId':_0x4125cb['id'],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a[_0x65f6('0x28')]['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x50')],'lastMsgAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x65f6('0x52')][_0x65f6('0x23')]({'where':{'closed':![],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':_0x65f6('0x53'),'attributes':[_0x65f6('0x4d')],'where':{'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x54')]}}]})[_0x65f6('0xe')](function(_0x5e4759){if(_0x5e4759){return[_0x5e4759,![]];}return db['MailInteraction']['create'](_0x5ba9c6)[_0x65f6('0xe')](function(_0x367d95){return[_0x367d95,!![]];});});}else{throw new Error(_0x65f6('0x55'));}})[_0x65f6('0x56')](function(_0xab6f0,_0x304cf9){if(_0xab6f0){_0x377ae5=_0x304cf9;if(!_0x304cf9){return _0xab6f0['update']({'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a['body'][_0x65f6('0x15')]['cc'],'subject':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x4f')],'attach':_0xab6f0[_0x65f6('0x50')]?_0xab6f0[_0x65f6('0x50')]:_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'substatus':null,'substatusAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x65f6('0x57')),'lastMsgDirection':'in'});}else{return _0xab6f0;}}})[_0x65f6('0xe')](function(_0x4a9524){_0x32148f[_0x65f6('0x58')]=_0x4a9524['get']({'plain':!![]});_0x32148f[_0x65f6('0x58')]['created']=_0x377ae5;return db[_0x65f6('0x59')][_0x65f6('0x5a')]({'body':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'MailInteractionId':_0x4a9524['id'],'direction':'in','ContactId':_0x32148f[_0x65f6('0x4c')]['id'],'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')],'from':_0xa4394a['body']['message'][_0x65f6('0x32')],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['to'],'cc':_0xa4394a['body']['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'Attachments':_0xa4394a['body']['message'][_0x65f6('0x5b')],'originTo':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x5c')],'originCc':_0xa4394a['body'][_0x65f6('0x15')][_0x65f6('0x5d')],'bcc':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['bcc'],'ChatWebsiteId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x5e')]||null,'originChannel':_0xa4394a['body']['message'][_0x65f6('0x5f')]||'Email','ChatOfflineMessageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x60')]||null},{'include':[{'model':db[_0x65f6('0x61')],'as':'Attachments'}]});})['then'](function(_0x56f7f1){_0x32148f[_0x65f6('0x15')]=_0x56f7f1;if(_0x32148f[_0x65f6('0x58')][_0x65f6('0x62')]){return db['User'][_0x65f6('0x23')]({'attributes':['id',_0x65f6('0x63')],'where':{'id':_0x32148f[_0x65f6('0x58')]['UserId']}})[_0x65f6('0xe')](function(_0x15809e){if(_0x15809e){_0x32148f['applications'][_0x65f6('0x64')]({'id':0x0,'priority':0x0,'app':_0x65f6('0x65'),'appdata':_0x15809e['name']+','+(_0x32148f[_0x65f6('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x65f6('0x66')});}return respondWithRpcPromise('Start',_0x65f6('0x67'),_0x32148f);});}return respondWithRpcPromise(_0x65f6('0x68'),'startRouting',_0x32148f);})[_0x65f6('0xe')](function(_0x442e25){_0x2ea7f7(_0x442e25);})[_0x65f6('0x17')](function(_0x299b85){_0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x299b85[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a98136e..a70a68d 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 _0x0805=['length','mailAccount:','./mailAccount.events','save','remove','update','register'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x0805,0x1c9));var _0x5080=function(_0x4fe36e,_0x52b659){_0x4fe36e=_0x4fe36e-0x0;var _0x3160d7=_0x0805[_0x4fe36e];return _0x3160d7;};'use strict';var MailAccountEvents=require(_0x5080('0x0'));var events=[_0x5080('0x1'),_0x5080('0x2'),_0x5080('0x3')];function createListener(_0x3bb211,_0x1cab64){return function(_0x385a6e){_0x1cab64['emit'](_0x3bb211,_0x385a6e);};}function removeListener(_0x226c2b,_0x1c2e95){return function(){MailAccountEvents['removeListener'](_0x226c2b,_0x1c2e95);};}exports[_0x5080('0x4')]=function(_0x4a6c8b){for(var _0x1aaff8=0x0,_0x51526e=events[_0x5080('0x5')];_0x1aaff8<_0x51526e;_0x1aaff8++){var _0x2b5ded=events[_0x1aaff8];var _0x50d5ec=createListener(_0x5080('0x6')+_0x2b5ded,_0x4a6c8b);MailAccountEvents['on'](_0x2b5ded,_0x50d5ec);}}; \ No newline at end of file +var _0x1ab2=['register','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x1b85d3,_0x30e03d){var _0x5a5d80=function(_0x481275){while(--_0x481275){_0x1b85d3['push'](_0x1b85d3['shift']());}};_0x5a5d80(++_0x30e03d);}(_0x1ab2,0x198));var _0x21ab=function(_0x167d7a,_0x171205){_0x167d7a=_0x167d7a-0x0;var _0x40b744=_0x1ab2[_0x167d7a];return _0x40b744;};'use strict';var MailAccountEvents=require(_0x21ab('0x0'));var events=[_0x21ab('0x1'),_0x21ab('0x2'),_0x21ab('0x3')];function createListener(_0x3bbe68,_0x4e1889){return function(_0x23361e){_0x4e1889[_0x21ab('0x4')](_0x3bbe68,_0x23361e);};}function removeListener(_0x3ec3cb,_0x11613e){return function(){MailAccountEvents['removeListener'](_0x3ec3cb,_0x11613e);};}exports[_0x21ab('0x5')]=function(_0x26d8fa){for(var _0x2a6592=0x0,_0x506332=events['length'];_0x2a6592<_0x506332;_0x2a6592++){var _0x5ab675=events[_0x2a6592];var _0x3251c4=createListener(_0x21ab('0x6')+_0x5ab675,_0x26d8fa);MailAccountEvents['on'](_0x5ab675,_0x3251c4);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 3be4cb3..687a401 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 _0x1f5f=['/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get'];(function(_0x278e8d,_0x1dc1ec){var _0x2c2ad7=function(_0x11ecec){while(--_0x11ecec){_0x278e8d['push'](_0x278e8d['shift']());}};_0x2c2ad7(++_0x1dc1ec);}(_0x1f5f,0x128));var _0xf1f5=function(_0x2af2b2,_0x552de4){_0x2af2b2=_0x2af2b2-0x0;var _0x54d6fd=_0x1f5f[_0x2af2b2];return _0x54d6fd;};'use strict';var multer=require('multer');var util=require(_0xf1f5('0x0'));var path=require(_0xf1f5('0x1'));var timeout=require(_0xf1f5('0x2'));var express=require(_0xf1f5('0x3'));var router=express[_0xf1f5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf1f5('0x5'));var interaction=require(_0xf1f5('0x6'));var config=require(_0xf1f5('0x7'));var controller=require(_0xf1f5('0x8'));router[_0xf1f5('0x9')](_0xf1f5('0xa'),auth[_0xf1f5('0xb')](),controller[_0xf1f5('0xc')]);router[_0xf1f5('0xd')](_0xf1f5('0xa'),auth[_0xf1f5('0xb')](),controller[_0xf1f5('0xe')]);router[_0xf1f5('0xf')](_0xf1f5('0xa'),auth[_0xf1f5('0xb')](),controller[_0xf1f5('0x10')]);module[_0xf1f5('0x11')]=router; \ No newline at end of file +var _0xd36e=['fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd36e,0x1a3));var _0xed36=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xd36e[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xed36('0x0'));var util=require(_0xed36('0x1'));var path=require(_0xed36('0x2'));var timeout=require(_0xed36('0x3'));var express=require(_0xed36('0x4'));var router=express[_0xed36('0x5')]();var fs_extra=require(_0xed36('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xed36('0x7'));var config=require(_0xed36('0x8'));var controller=require(_0xed36('0x9'));router[_0xed36('0xa')](_0xed36('0xb'),auth[_0xed36('0xc')](),controller[_0xed36('0xd')]);router[_0xed36('0xe')](_0xed36('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xed36('0xb'),auth[_0xed36('0xc')](),controller[_0xed36('0xf')]);module[_0xed36('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index ad40f9f..4aef458 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 _0xdde5=['STRING','*,*,*,*','sequelize','exports','INTEGER','noop','TEXT'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdde5,0x87));var _0x5dde=function(_0x4e0863,_0x1ec822){_0x4e0863=_0x4e0863-0x0;var _0x3133d7=_0xdde5[_0x4e0863];return _0x3133d7;};'use strict';var Sequelize=require(_0x5dde('0x0'));module[_0x5dde('0x1')]={'priority':{'type':Sequelize[_0x5dde('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5dde('0x3')},'appdata':{'type':Sequelize[_0x5dde('0x4')]()},'description':{'type':Sequelize[_0x5dde('0x5')]},'interval':{'type':Sequelize[_0x5dde('0x5')],'defaultValue':_0x5dde('0x6')}}; \ No newline at end of file +var _0x1e96=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x2918eb,_0x3f0e4e){var _0x1502e0=function(_0x16409f){while(--_0x16409f){_0x2918eb['push'](_0x2918eb['shift']());}};_0x1502e0(++_0x3f0e4e);}(_0x1e96,0x106));var _0x61e9=function(_0x271582,_0x1476e4){_0x271582=_0x271582-0x0;var _0x32d488=_0x1e96[_0x271582];return _0x32d488;};'use strict';var Sequelize=require(_0x61e9('0x0'));module[_0x61e9('0x1')]={'priority':{'type':Sequelize[_0x61e9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x61e9('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x61e9('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x61e9('0x3')],'defaultValue':_0x61e9('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4913721..e883ed5 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 _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x416fab,_0x147ad9){var _0x13f8a0=function(_0x3282d7){while(--_0x3282d7){_0x416fab['push'](_0x416fab['shift']());}};_0x13f8a0(++_0x147ad9);}(_0xb43b,0x1b2));var _0xbb43=function(_0xaeff09,_0x4396a4){_0xaeff09=_0xaeff09-0x0;var _0x27a1bd=_0xb43b[_0xaeff09];return _0x27a1bd;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x5ccd41,_0x520533){var _0x4133d6=function(_0x485cd5){while(--_0x485cd5){_0x5ccd41['push'](_0x5ccd41['shift']());}};_0x4133d6(++_0x520533);}(_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={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index b32f54e..a21463c 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 _0xeea8=['rimraf','../../config/environment','./mailApplication.attributes','exports','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0xeea8,0x17a));var _0x8eea=function(_0xdd76e8,_0x2691f0){_0xdd76e8=_0xdd76e8-0x0;var _0x36747e=_0xeea8[_0xdd76e8];return _0x36747e;};'use strict';var _=require(_0x8eea('0x0'));var util=require(_0x8eea('0x1'));var logger=require(_0x8eea('0x2'))('api');var moment=require(_0x8eea('0x3'));var BPromise=require('bluebird');var rp=require(_0x8eea('0x4'));var fs=require('fs');var path=require(_0x8eea('0x5'));var rimraf=require(_0x8eea('0x6'));var config=require(_0x8eea('0x7'));var attributes=require(_0x8eea('0x8'));module[_0x8eea('0x9')]=function(_0x2dcff2,_0x3b2d68){return _0x2dcff2['define']('MailApplication',attributes,{'tableName':_0x8eea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8eea('0xb')});}; \ No newline at end of file +var _0x73fb=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x2dfde6,_0x34742c){var _0x553edd=function(_0x3836b4){while(--_0x3836b4){_0x2dfde6['push'](_0x2dfde6['shift']());}};_0x553edd(++_0x34742c);}(_0x73fb,0xd0));var _0xb73f=function(_0x3d21e1,_0x50f53e){_0x3d21e1=_0x3d21e1-0x0;var _0x73df13=_0x73fb[_0x3d21e1];return _0x73df13;};'use strict';var _=require(_0xb73f('0x0'));var util=require('util');var logger=require(_0xb73f('0x1'))(_0xb73f('0x2'));var moment=require(_0xb73f('0x3'));var BPromise=require(_0xb73f('0x4'));var rp=require(_0xb73f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb73f('0x6'));var config=require(_0xb73f('0x7'));var attributes=require(_0xb73f('0x8'));module[_0xb73f('0x9')]=function(_0x579f40,_0xadf0fb){return _0x579f40[_0xb73f('0xa')](_0xb73f('0xb'),attributes,{'tableName':_0xb73f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb73f('0xd'),'collate':_0xb73f('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index dfca49b..9aaa2cf 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 _0x484c=['code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2cc3a9,_0x52b696){var _0x3ab208=function(_0x14a9aa){while(--_0x14a9aa){_0x2cc3a9['push'](_0x2cc3a9['shift']());}};_0x3ab208(++_0x52b696);}(_0x484c,0x198));var _0xc484=function(_0x5a735f,_0x2e5b5e){_0x5a735f=_0x5a735f-0x0;var _0x1635c0=_0x484c[_0x5a735f];return _0x1635c0;};'use strict';var _=require(_0xc484('0x0'));var util=require(_0xc484('0x1'));var moment=require(_0xc484('0x2'));var BPromise=require(_0xc484('0x3'));var rs=require(_0xc484('0x4'));var fs=require('fs');var Redis=require(_0xc484('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc484('0x6'))(_0xc484('0x7'));var config=require(_0xc484('0x8'));var jayson=require(_0xc484('0x9'));var client=jayson[_0xc484('0xa')][_0xc484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43c525,_0x526cef,_0x594a2d){return new BPromise(function(_0x57ec67,_0x3b366c){return client[_0xc484('0xc')](_0x43c525,_0x594a2d)[_0xc484('0xd')](function(_0x542d73){logger[_0xc484('0xe')](_0xc484('0xf'),_0x526cef,'request\x20sent');logger[_0xc484('0x10')](_0xc484('0x11'),_0x526cef,_0xc484('0x12'),JSON[_0xc484('0x13')](_0x542d73));if(_0x542d73[_0xc484('0x14')]){if(_0x542d73['error'][_0xc484('0x15')]===0x1f4){logger[_0xc484('0x14')](_0xc484('0xf'),_0x526cef,_0x542d73[_0xc484('0x14')][_0xc484('0x16')]);return _0x3b366c(_0x542d73[_0xc484('0x14')][_0xc484('0x16')]);}logger[_0xc484('0x14')](_0xc484('0xf'),_0x526cef,_0x542d73['error'][_0xc484('0x16')]);return _0x57ec67(_0x542d73[_0xc484('0x14')][_0xc484('0x16')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x526cef,_0xc484('0x12'));_0x57ec67(_0x542d73[_0xc484('0x17')][_0xc484('0x16')]);}})[_0xc484('0x18')](function(_0x4891d1){logger['error'](_0xc484('0xf'),_0x526cef,_0x4891d1);_0x3b366c(_0x4891d1);});});}exports[_0xc484('0x19')]=function(_0xdab6e5){var _0x3991a9=this;return new Promise(function(_0x471ec4,_0x187808){return db[_0xc484('0x1a')][_0xc484('0x1b')](_0xdab6e5[_0xc484('0x1c')],{'raw':_0xdab6e5[_0xc484('0x1d')]?_0xdab6e5[_0xc484('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdab6e5['options']?_0xdab6e5[_0xc484('0x1d')][_0xc484('0x1e')]||null:null,'attributes':_0xdab6e5[_0xc484('0x1d')]?_0xdab6e5['options'][_0xc484('0x1f')]||null:null,'limit':_0xdab6e5[_0xc484('0x1d')]?_0xdab6e5[_0xc484('0x1d')][_0xc484('0x20')]||null:null})['then'](function(_0x2d7931){logger[_0xc484('0xe')](_0xc484('0x19'),_0xdab6e5);logger[_0xc484('0x10')](_0xc484('0x19'),_0xdab6e5,JSON['stringify'](_0x2d7931));_0x471ec4(_0x2d7931);})[_0xc484('0x18')](function(_0x36de31){logger['error'](_0xc484('0x19'),_0x36de31[_0xc484('0x16')],_0xdab6e5);_0x187808(_0x3991a9[_0xc484('0x14')](0x1f4,_0x36de31[_0xc484('0x16')]));});});}; \ No newline at end of file +var _0x8595=['stringify','error','code','message','info','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','MailApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x493759,_0x154e45){var _0x2f3a77=function(_0x1a5506){while(--_0x1a5506){_0x493759['push'](_0x493759['shift']());}};_0x2f3a77(++_0x154e45);}(_0x8595,0xc9));var _0x5859=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x8595[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0x5859('0x0'));var util=require(_0x5859('0x1'));var moment=require(_0x5859('0x2'));var BPromise=require(_0x5859('0x3'));var rs=require(_0x5859('0x4'));var fs=require('fs');var Redis=require(_0x5859('0x5'));var db=require(_0x5859('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5859('0x7'))('rpc');var config=require(_0x5859('0x8'));var jayson=require(_0x5859('0x9'));var client=jayson[_0x5859('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ee885,_0x546411,_0x573a73){return new BPromise(function(_0x685aa8,_0x2f8fad){return client[_0x5859('0xb')](_0x4ee885,_0x573a73)[_0x5859('0xc')](function(_0x39aa29){logger['info'](_0x5859('0xd'),_0x546411,'request\x20sent');logger[_0x5859('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x546411,_0x5859('0xf'),JSON[_0x5859('0x10')](_0x39aa29));if(_0x39aa29[_0x5859('0x11')]){if(_0x39aa29[_0x5859('0x11')][_0x5859('0x12')]===0x1f4){logger[_0x5859('0x11')]('MailApplication,\x20%s,\x20%s',_0x546411,_0x39aa29['error'][_0x5859('0x13')]);return _0x2f8fad(_0x39aa29[_0x5859('0x11')][_0x5859('0x13')]);}logger[_0x5859('0x11')](_0x5859('0xd'),_0x546411,_0x39aa29[_0x5859('0x11')]['message']);return _0x685aa8(_0x39aa29[_0x5859('0x11')]['message']);}else{logger[_0x5859('0x14')](_0x5859('0xd'),_0x546411,_0x5859('0xf'));_0x685aa8(_0x39aa29[_0x5859('0x15')][_0x5859('0x13')]);}})[_0x5859('0x16')](function(_0x1e17bd){logger[_0x5859('0x11')]('MailApplication,\x20%s,\x20%s',_0x546411,_0x1e17bd);_0x2f8fad(_0x1e17bd);});});}exports[_0x5859('0x17')]=function(_0x5da1eb){var _0x42c43c=this;return new Promise(function(_0x16c229,_0x1d5db8){return db['MailApplication'][_0x5859('0x18')](_0x5da1eb[_0x5859('0x19')],{'raw':_0x5da1eb[_0x5859('0x1a')]?_0x5da1eb[_0x5859('0x1a')][_0x5859('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5da1eb[_0x5859('0x1a')]?_0x5da1eb[_0x5859('0x1a')][_0x5859('0x1c')]||null:null,'attributes':_0x5da1eb[_0x5859('0x1a')]?_0x5da1eb[_0x5859('0x1a')][_0x5859('0x1d')]||null:null,'limit':_0x5da1eb['options']?_0x5da1eb[_0x5859('0x1a')][_0x5859('0x1e')]||null:null})[_0x5859('0xc')](function(_0x348683){logger[_0x5859('0x14')](_0x5859('0x17'),_0x5da1eb);logger['debug'](_0x5859('0x17'),_0x5da1eb,JSON[_0x5859('0x10')](_0x348683));_0x16c229(_0x348683);})[_0x5859('0x16')](function(_0x52307d){logger[_0x5859('0x11')]('UpdateMailApplication',_0x52307d[_0x5859('0x13')],_0x5da1eb);_0x1d5db8(_0x42c43c[_0x5859('0x11')](0x1f4,_0x52307d[_0x5859('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 384e40e..6446b86 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 _0xf7d7=['delete','mailinteraction:destroy','destroy','/:id/tags','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','/describe','describe','/:id','isAuthenticated','/:id/messages','/:id/download','post','addMessage','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update'];(function(_0x50d7b4,_0x140e59){var _0x3a1cab=function(_0x4f6461){while(--_0x4f6461){_0x50d7b4['push'](_0x50d7b4['shift']());}};_0x3a1cab(++_0x140e59);}(_0xf7d7,0xa2));var _0x7f7d=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xf7d7[_0x2fc012];return _0x2891f9;};'use strict';var express=require(_0x7f7d('0x0'));var router=express[_0x7f7d('0x1')]();var auth=require(_0x7f7d('0x2'));var interaction=require(_0x7f7d('0x3'));var controller=require(_0x7f7d('0x4'));router[_0x7f7d('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7f7d('0x5')](_0x7f7d('0x6'),auth['isAuthenticated'](),controller[_0x7f7d('0x7')]);router['get'](_0x7f7d('0x8'),auth[_0x7f7d('0x9')](),controller['show']);router[_0x7f7d('0x5')](_0x7f7d('0xa'),auth[_0x7f7d('0x9')](),controller['getMessages']);router['get'](_0x7f7d('0xb'),auth['isAuthenticated'](),controller['download']);router[_0x7f7d('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7f7d('0xa'),auth[_0x7f7d('0x9')](),controller[_0x7f7d('0xd')]);router[_0x7f7d('0xc')]('/:id/tags',auth[_0x7f7d('0x9')](),interaction[_0x7f7d('0xe')](_0x7f7d('0xf'),_0x7f7d('0x10')),controller['addTags']);router[_0x7f7d('0x11')](_0x7f7d('0x8'),auth[_0x7f7d('0x9')](),interaction[_0x7f7d('0xe')]('mail',_0x7f7d('0x12')),controller[_0x7f7d('0x13')]);router[_0x7f7d('0x14')](_0x7f7d('0x8'),auth[_0x7f7d('0x9')](),interaction[_0x7f7d('0xe')](_0x7f7d('0xf'),_0x7f7d('0x15')),controller[_0x7f7d('0x16')]);router['delete'](_0x7f7d('0x17'),auth[_0x7f7d('0x9')](),controller[_0x7f7d('0x18')]);module[_0x7f7d('0x19')]=router; \ No newline at end of file +var _0x2f88=['exports','express','Router','../../components/interaction/service','./mailInteraction.controller','isAuthenticated','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','/:id','update','mailinteraction:destroy'];(function(_0x434e80,_0x3f4bd0){var _0x5014f7=function(_0x3263df){while(--_0x3263df){_0x434e80['push'](_0x434e80['shift']());}};_0x5014f7(++_0x3f4bd0);}(_0x2f88,0x15a));var _0x82f8=function(_0x4af643,_0x37bcc1){_0x4af643=_0x4af643-0x0;var _0x27beba=_0x2f88[_0x4af643];return _0x27beba;};'use strict';var express=require(_0x82f8('0x0'));var router=express[_0x82f8('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x82f8('0x2'));var controller=require(_0x82f8('0x3'));router['get']('/',auth[_0x82f8('0x4')](),controller['index']);router[_0x82f8('0x5')](_0x82f8('0x6'),auth['isAuthenticated'](),controller[_0x82f8('0x7')]);router[_0x82f8('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x82f8('0x8')]);router[_0x82f8('0x5')](_0x82f8('0x9'),auth[_0x82f8('0x4')](),controller[_0x82f8('0xa')]);router['get'](_0x82f8('0xb'),auth[_0x82f8('0x4')](),controller['download']);router[_0x82f8('0xc')]('/',auth[_0x82f8('0x4')](),controller['create']);router['post'](_0x82f8('0x9'),auth[_0x82f8('0x4')](),controller[_0x82f8('0xd')]);router[_0x82f8('0xc')](_0x82f8('0xe'),auth[_0x82f8('0x4')](),interaction[_0x82f8('0xf')](_0x82f8('0x10'),_0x82f8('0x11')),controller[_0x82f8('0x12')]);router['put'](_0x82f8('0x13'),auth[_0x82f8('0x4')](),interaction[_0x82f8('0xf')](_0x82f8('0x10'),'mailinteraction:update'),controller[_0x82f8('0x14')]);router['delete']('/:id',auth[_0x82f8('0x4')](),interaction[_0x82f8('0xf')](_0x82f8('0x10'),_0x82f8('0x15')),controller['destroy']);router['delete'](_0x82f8('0xe'),auth[_0x82f8('0x4')](),controller['removeTags']);module[_0x82f8('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 77b6559..2b01640 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 _0x53cc=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','out','ENUM'];(function(_0x114dbf,_0x3dd101){var _0x5953c9=function(_0x39aeb0){while(--_0x39aeb0){_0x114dbf['push'](_0x114dbf['shift']());}};_0x5953c9(++_0x3dd101);}(_0x53cc,0x178));var _0xc53c=function(_0x10b2d5,_0x5a7743){_0x10b2d5=_0x10b2d5-0x0;var _0x14b8d1=_0x53cc[_0x10b2d5];return _0x14b8d1;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xc53c('0x0'));module[_0xc53c('0x1')]={'closed':{'type':Sequelize[_0xc53c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc53c('0x3')]},'disposition':{'type':Sequelize[_0xc53c('0x4')]},'secondDisposition':{'type':Sequelize[_0xc53c('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc53c('0x4')]},'note':{'type':Sequelize[_0xc53c('0x4')]},'inReplyTo':{'type':Sequelize[_0xc53c('0x4')](0x1fe)},'to':{'type':Sequelize[_0xc53c('0x4')]},'cc':{'type':Sequelize[_0xc53c('0x5')]('long')},'subject':{'type':Sequelize[_0xc53c('0x5')]()},'attach':{'type':Sequelize[_0xc53c('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc53c('0x3')]},'substatus':{'type':Sequelize[_0xc53c('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xc53c('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc53c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc53c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc53c('0x7')]('in',_0xc53c('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8511=['sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x3aab9a,_0x4ce012){var _0x58dbc9=function(_0x5b9bc5){while(--_0x5b9bc5){_0x3aab9a['push'](_0x3aab9a['shift']());}};_0x58dbc9(++_0x4ce012);}(_0x8511,0xf0));var _0x1851=function(_0x1213c0,_0x21ad41){_0x1213c0=_0x1213c0-0x0;var _0x8ac347=_0x8511[_0x1213c0];return _0x8ac347;};'use strict';var Sequelize=require(_0x1851('0x0'));var iconv=require(_0x1851('0x1'));module[_0x1851('0x2')]={'closed':{'type':Sequelize[_0x1851('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1851('0x4')]},'disposition':{'type':Sequelize[_0x1851('0x5')]},'secondDisposition':{'type':Sequelize[_0x1851('0x5')]},'thirdDisposition':{'type':Sequelize[_0x1851('0x5')]},'note':{'type':Sequelize[_0x1851('0x5')]},'inReplyTo':{'type':Sequelize[_0x1851('0x5')](0x1fe)},'to':{'type':Sequelize[_0x1851('0x5')]},'cc':{'type':Sequelize[_0x1851('0x6')](_0x1851('0x7'))},'subject':{'type':Sequelize[_0x1851('0x6')]()},'attach':{'type':Sequelize[_0x1851('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1851('0x4')]},'substatus':{'type':Sequelize[_0x1851('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x1851('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1851('0x8')]('in',_0x1851('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1851('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1851('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 08c7224..06f3813 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 _0x0aee=['MailInteraction','rawAttributes','type','findAll','mail','user','catch','show','keys','query','intersection','model','attributes','fields','includeAll','merge','options','find','create','body','update','destroy','params','describe','addMessage','MailMessage','ids','getMessages','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','rows','addTags','setTags','omit','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','bluebird','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','error','name','send','index','map'];(function(_0x3ce9a6,_0x24ac73){var _0x1720db=function(_0x92bfcb){while(--_0x92bfcb){_0x3ce9a6['push'](_0x3ce9a6['shift']());}};_0x1720db(++_0x24ac73);}(_0x0aee,0x1a3));var _0xe0ae=function(_0x4c9f6a,_0xcb2cb2){_0x4c9f6a=_0x4c9f6a-0x0;var _0x5df5b9=_0x0aee[_0x4c9f6a];return _0x5df5b9;};'use strict';var emlformat=require(_0xe0ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0ae('0x1'));var moment=require('moment');var BPromise=require(_0xe0ae('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xe0ae('0x3'));var juice=require(_0xe0ae('0x4'));var Redis=require(_0xe0ae('0x5'));var interaction=require('../../components/interaction/service');var qs=require(_0xe0ae('0x6'));var logger=require(_0xe0ae('0x7'))(_0xe0ae('0x8'));var config=require(_0xe0ae('0x9'));var db=require(_0xe0ae('0xa'))['db'];var htmlEntities=require(_0xe0ae('0xb'));config[_0xe0ae('0xc')]=_[_0xe0ae('0xd')](config[_0xe0ae('0xc')],{'host':_0xe0ae('0xe'),'port':0x18eb});var socket=require(_0xe0ae('0xf'))(new Redis(config[_0xe0ae('0xc')]));require('./mailInteraction.socket')[_0xe0ae('0x10')](socket);function respondWithStatusCode(_0x1ecdb0,_0x308eaf){_0x308eaf=_0x308eaf||0xcc;return function(_0x2fdb28){if(_0x2fdb28){return _0x1ecdb0[_0xe0ae('0x11')](_0x308eaf);}return _0x1ecdb0[_0xe0ae('0x12')](_0x308eaf)[_0xe0ae('0x13')]();};}function respondWithResult(_0x2b61b3,_0x3da8ac){_0x3da8ac=_0x3da8ac||0xc8;return function(_0x35c2c4){if(_0x35c2c4){return _0x2b61b3[_0xe0ae('0x12')](_0x3da8ac)[_0xe0ae('0x14')](_0x35c2c4);}};}function respondWithFilteredResult(_0xd6e08f,_0x36125f){return function(_0x2434fa){if(_0x2434fa){var _0x41f551=typeof _0x36125f[_0xe0ae('0x15')]===_0xe0ae('0x16')&&typeof _0x36125f[_0xe0ae('0x17')]===_0xe0ae('0x16');var _0x460b37=_0x2434fa[_0xe0ae('0x18')];var _0x374d63=_0x41f551?0x0:_0x36125f[_0xe0ae('0x15')];var _0x1e85e3=_0x41f551?_0x2434fa[_0xe0ae('0x18')]:_0x36125f[_0xe0ae('0x15')]+_0x36125f[_0xe0ae('0x17')];var _0x389c27;if(_0x1e85e3>=_0x460b37){_0x1e85e3=_0x460b37;_0x389c27=0xc8;}else{_0x389c27=0xce;}_0xd6e08f['status'](_0x389c27);return _0xd6e08f[_0xe0ae('0x19')](_0xe0ae('0x1a'),_0x374d63+'-'+_0x1e85e3+'/'+_0x460b37)[_0xe0ae('0x14')](_0x2434fa);}return null;};}function saveUpdates(_0x529404){return function(_0x38054b){if(_0x38054b){return _0x38054b['update'](_0x529404)['then'](function(_0x4aa9da){return _0x4aa9da;});}return null;};}function removeEntity(_0x5761bc){return function(_0x4fa7cb){if(_0x4fa7cb){return _0x4fa7cb['destroy']()[_0xe0ae('0x1b')](function(){_0x5761bc[_0xe0ae('0x12')](0xcc)[_0xe0ae('0x13')]();});}};}function handleEntityNotFound(_0x33ce62){return function(_0x5765f6){if(!_0x5765f6){_0x33ce62[_0xe0ae('0x11')](0x194);}return _0x5765f6;};}function handleError(_0x35dd73,_0x49c632){_0x49c632=_0x49c632||0x1f4;return function(_0x310060){logger[_0xe0ae('0x1c')](_0x310060['stack']);if(_0x310060[_0xe0ae('0x1d')]){delete _0x310060['name'];}_0x35dd73[_0xe0ae('0x12')](_0x49c632)[_0xe0ae('0x1e')](_0x310060);};}exports[_0xe0ae('0x1f')]=function(_0x27479e,_0x21bd46){var _0x5dfa79={};var _0x363614=_[_0xe0ae('0x20')](db[_0xe0ae('0x21')][_0xe0ae('0x22')],function(_0x5cfa33){return{'name':_0x5cfa33['fieldName'],'type':_0x5cfa33[_0xe0ae('0x23')]['key']};});_0x5dfa79=qs['getOptions'](_0x363614,_0x27479e);return interaction[_0xe0ae('0x24')](_0xe0ae('0x25'),_0x27479e['query'],_0x27479e[_0xe0ae('0x26')],_0x5dfa79,_0x363614)['then'](respondWithFilteredResult(_0x21bd46,_0x5dfa79))[_0xe0ae('0x27')](handleError(_0x21bd46,null));};exports[_0xe0ae('0x28')]=function(_0x2e9b62,_0x249afa){var _0x18d0d2={'raw':![],'where':{'id':_0x2e9b62['params']['id']}},_0x575d5e={};_0x575d5e['model']=_[_0xe0ae('0x29')](db['MailInteraction'][_0xe0ae('0x22')]);_0x575d5e['query']=_['keys'](_0x2e9b62[_0xe0ae('0x2a')]);_0x575d5e['filters']=_[_0xe0ae('0x2b')](_0x575d5e[_0xe0ae('0x2c')],_0x575d5e[_0xe0ae('0x2a')]);_0x18d0d2[_0xe0ae('0x2d')]=_[_0xe0ae('0x2b')](_0x575d5e[_0xe0ae('0x2c')],qs[_0xe0ae('0x2e')](_0x2e9b62[_0xe0ae('0x2a')][_0xe0ae('0x2e')]));_0x18d0d2[_0xe0ae('0x2d')]=_0x18d0d2[_0xe0ae('0x2d')]['length']?_0x18d0d2['attributes']:_0x575d5e['model'];if(_0x2e9b62[_0xe0ae('0x2a')][_0xe0ae('0x2f')]){_0x18d0d2['include']=[{'all':!![]}];}_0x18d0d2=_[_0xe0ae('0x30')]({},_0x18d0d2,_0x2e9b62[_0xe0ae('0x31')]);return db['MailInteraction'][_0xe0ae('0x32')](_0x18d0d2)[_0xe0ae('0x1b')](handleEntityNotFound(_0x249afa,null))[_0xe0ae('0x1b')](respondWithResult(_0x249afa,null))[_0xe0ae('0x27')](handleError(_0x249afa,null));};exports[_0xe0ae('0x33')]=function(_0x5610d9,_0x4a02ed){return db['MailInteraction'][_0xe0ae('0x33')](_0x5610d9[_0xe0ae('0x34')],{})[_0xe0ae('0x1b')](respondWithResult(_0x4a02ed,0xc9))['catch'](handleError(_0x4a02ed,null));};exports[_0xe0ae('0x35')]=function(_0x3ac826,_0x3d8db7){if(_0x3ac826[_0xe0ae('0x34')]['id']){delete _0x3ac826['body']['id'];}return db[_0xe0ae('0x21')]['find']({'where':{'id':_0x3ac826['params']['id']}})[_0xe0ae('0x1b')](handleEntityNotFound(_0x3d8db7,null))['then'](saveUpdates(_0x3ac826[_0xe0ae('0x34')],null))[_0xe0ae('0x1b')](respondWithResult(_0x3d8db7,null))[_0xe0ae('0x27')](handleError(_0x3d8db7,null));};exports[_0xe0ae('0x36')]=function(_0x20606d,_0x45cdf8){return db[_0xe0ae('0x21')][_0xe0ae('0x32')]({'where':{'id':_0x20606d[_0xe0ae('0x37')]['id']}})['then'](handleEntityNotFound(_0x45cdf8,null))['then'](removeEntity(_0x45cdf8,null))[_0xe0ae('0x27')](handleError(_0x45cdf8,null));};exports[_0xe0ae('0x38')]=function(_0x529742,_0x391e6e){return db[_0xe0ae('0x21')][_0xe0ae('0x38')]()[_0xe0ae('0x1b')](respondWithResult(_0x391e6e,null))[_0xe0ae('0x27')](handleError(_0x391e6e,null));};exports[_0xe0ae('0x39')]=function(_0x2e2632,_0x4becc5){return db[_0xe0ae('0x3a')][_0xe0ae('0x32')]({'where':{'id':_0x2e2632['params']['id']}})[_0xe0ae('0x1b')](handleEntityNotFound(_0x4becc5,null))['then'](function(_0xe817b5){if(_0xe817b5){return _0xe817b5['addMessage'](_0x2e2632['body'][_0xe0ae('0x3b')],_['omit'](_0x2e2632[_0xe0ae('0x34')],['ids','id'])||{});}})[_0xe0ae('0x1b')](respondWithResult(_0x4becc5,null))[_0xe0ae('0x27')](handleError(_0x4becc5,null));};exports[_0xe0ae('0x3c')]=function(_0x2d6ed0,_0x458ac0){var _0x3b9659={'raw':![],'where':{}};var _0x1ad510={};var _0x4527fa={'count':0x0,'rows':[]};return db[_0xe0ae('0x21')]['findOne']({'where':{'id':_0x2d6ed0['params']['id']}})['then'](handleEntityNotFound(_0x458ac0,null))['then'](function(_0x29eca2){if(_0x29eca2){_0x1ad510[_0xe0ae('0x2c')]=_[_0xe0ae('0x29')](db[_0xe0ae('0x3a')][_0xe0ae('0x22')]);_0x1ad510['query']=_[_0xe0ae('0x29')](_0x2d6ed0[_0xe0ae('0x2a')]);_0x1ad510['filters']=_['intersection'](_0x1ad510[_0xe0ae('0x2c')],_0x1ad510[_0xe0ae('0x2a')]);_0x3b9659[_0xe0ae('0x2d')]=_[_0xe0ae('0x2b')](_0x1ad510[_0xe0ae('0x2c')],qs[_0xe0ae('0x2e')](_0x2d6ed0[_0xe0ae('0x2a')][_0xe0ae('0x2e')]));_0x3b9659[_0xe0ae('0x2d')]=_0x3b9659[_0xe0ae('0x2d')][_0xe0ae('0x3d')]?_0x3b9659[_0xe0ae('0x2d')]:_0x1ad510[_0xe0ae('0x2c')];if(!_0x2d6ed0[_0xe0ae('0x2a')][_0xe0ae('0x3e')](_0xe0ae('0x3f'))){_0x3b9659['limit']=qs[_0xe0ae('0x17')](_0x2d6ed0[_0xe0ae('0x2a')][_0xe0ae('0x17')]);_0x3b9659[_0xe0ae('0x15')]=qs[_0xe0ae('0x15')](_0x2d6ed0[_0xe0ae('0x2a')][_0xe0ae('0x15')]);}_0x3b9659[_0xe0ae('0x40')]=qs[_0xe0ae('0x41')](_0x2d6ed0[_0xe0ae('0x2a')][_0xe0ae('0x41')]);_0x3b9659[_0xe0ae('0x42')]=qs[_0xe0ae('0x43')](_[_0xe0ae('0x44')](_0x2d6ed0['query'],_0x1ad510['filters']));_0x3b9659['where'][_0xe0ae('0x45')]=_0x29eca2['id'];if(_0x2d6ed0['query'][_0xe0ae('0x46')]){_0x3b9659[_0xe0ae('0x42')]=_[_0xe0ae('0x30')](_0x3b9659[_0xe0ae('0x42')],{'$or':_[_0xe0ae('0x20')](_0x3b9659['attributes'],function(_0x5018c7){var _0x463925={};_0x463925[_0x5018c7]={'$like':'%'+_0x2d6ed0['query'][_0xe0ae('0x46')]+'%'};return _0x463925;})});}if(_0x2d6ed0[_0xe0ae('0x2a')][_0xe0ae('0x47')]){var _0x26469e=_0x2d6ed0[_0xe0ae('0x2a')][_0xe0ae('0x47')][_0xe0ae('0x48')](',');var _0x56f46c={};_0x56f46c[_0x26469e[0x0]]={'$gte':moment(_0x26469e[0x1])['format'](_0xe0ae('0x49'))};_0x3b9659['where']=_[_0xe0ae('0x30')](_0x3b9659[_0xe0ae('0x42')],_0x56f46c);}_0x3b9659=_[_0xe0ae('0x30')]({},_0x3b9659,_0x2d6ed0[_0xe0ae('0x31')]);return db[_0xe0ae('0x3a')]['count']({'where':_0x3b9659[_0xe0ae('0x42')]})['then'](function(_0x3eb9db){_0x4527fa['count']=_0x3eb9db;if(_0x2d6ed0[_0xe0ae('0x2a')][_0xe0ae('0x2f')]){_0x3b9659[_0xe0ae('0x4a')]=[{'all':!![]}];}return db[_0xe0ae('0x3a')]['findAll'](_0x3b9659);})[_0xe0ae('0x1b')](function(_0x58377e){if(_0x2d6ed0[_0xe0ae('0x2a')][_0xe0ae('0x4b')]==='true'){for(var _0x4ec366=0x0;_0x4ec366<_0x58377e[_0xe0ae('0x3d')];_0x4ec366++){_0x58377e[_0x4ec366][_0xe0ae('0x34')]=juice(_0x58377e[_0x4ec366][_0xe0ae('0x34')]);}}_0x4527fa[_0xe0ae('0x4c')]=_0x58377e;return _0x4527fa;});}})[_0xe0ae('0x1b')](respondWithFilteredResult(_0x458ac0,_0x3b9659))[_0xe0ae('0x27')](handleError(_0x458ac0,null));};exports[_0xe0ae('0x4d')]=function(_0x21921c,_0x5e964a){return db['MailInteraction'][_0xe0ae('0x32')]({'where':{'id':_0x21921c[_0xe0ae('0x37')]['id']}})[_0xe0ae('0x1b')](handleEntityNotFound(_0x5e964a,null))[_0xe0ae('0x1b')](function(_0xbb3bb7){if(_0xbb3bb7){return _0xbb3bb7[_0xe0ae('0x4e')](_0x21921c[_0xe0ae('0x34')][_0xe0ae('0x3b')],_[_0xe0ae('0x4f')](_0x21921c[_0xe0ae('0x34')],[_0xe0ae('0x3b'),'id'])||{})[_0xe0ae('0x50')](function(){return db[_0xe0ae('0x51')]['findAll']({'attributes':['id',_0xe0ae('0x1d'),_0xe0ae('0x52')],'where':{'id':_0x21921c['body'][_0xe0ae('0x3b')]}});})[_0xe0ae('0x1b')](function(_0xde499c){socket[_0xe0ae('0x53')](_0xe0ae('0x54'),{'id':Number(_0x21921c[_0xe0ae('0x37')]['id']),'tags':_0xde499c||[]});return{'id':Number(_0x21921c['params']['id']),'tags':_0xde499c||[]};});}})[_0xe0ae('0x1b')](respondWithResult(_0x5e964a,null))[_0xe0ae('0x27')](handleError(_0x5e964a,null));};exports[_0xe0ae('0x55')]=function(_0x2c4a69,_0x41d394){return db[_0xe0ae('0x21')][_0xe0ae('0x32')]({'where':{'id':_0x2c4a69['params']['id']}})[_0xe0ae('0x1b')](handleEntityNotFound(_0x41d394,null))[_0xe0ae('0x1b')](function(_0x341efc){if(_0x341efc){return _0x341efc[_0xe0ae('0x55')](_0x2c4a69['query']['ids']);}})[_0xe0ae('0x1b')](respondWithStatusCode(_0x41d394,null))['catch'](handleError(_0x41d394,null));};exports[_0xe0ae('0x56')]=function(_0x3f4bc5,_0xbe5a99){var _0x477cf9=moment()['unix']()['toString']();var _0x179258=path[_0xe0ae('0x57')](config[_0xe0ae('0x58')],_0xe0ae('0x59'),_0xe0ae('0x5a'),_0xe0ae('0x5b'));var _0x432070=path[_0xe0ae('0x57')](config['root'],_0xe0ae('0x59'),_0xe0ae('0x5a'),_0xe0ae('0x5c'));var _0x15554c=path['join'](_0x179258,_0x477cf9);var _0x205495=util[_0xe0ae('0x5d')](_0xe0ae('0x5e'),_0x3f4bc5['params']['id'],_0x477cf9);var _0x22cb55=path['join'](_0x179258,_0x205495);var _0x1cbe00=[];if(_0x3f4bc5[_0xe0ae('0x2a')][_0xe0ae('0x5c')]){_0x1cbe00[_0xe0ae('0x5f')]({'model':db[_0xe0ae('0x60')],'as':_0xe0ae('0x61'),'raw':!![]});}var _0xf1ae29=[{'model':db['MailMessage'],'as':_0xe0ae('0x62'),'attributes':['id',_0xe0ae('0x34'),_0xe0ae('0x63'),'to','cc',_0xe0ae('0x64'),_0xe0ae('0x65'),_0xe0ae('0x66')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x1cbe00}];return db[_0xe0ae('0x21')][_0xe0ae('0x32')]({'where':{'id':_0x3f4bc5[_0xe0ae('0x37')]['id']},'include':_0xf1ae29})[_0xe0ae('0x1b')](handleEntityNotFound(_0xbe5a99,null))[_0xe0ae('0x1b')](function(_0xa04da){if(_0xa04da&&_0xa04da[_0xe0ae('0x62')]){var _0x4e73e2=_0xa04da[_0xe0ae('0x67')]({'plain':!![]});fs[_0xe0ae('0x68')](_0x15554c);return BPromise[_0xe0ae('0x69')](_0x4e73e2[_0xe0ae('0x62')],function(_0x2dc5ca,_0x2c6929){var _0x18ba65={'from':_0x2dc5ca[_0xe0ae('0x63')],'to':_0x2dc5ca['to'],'subject':_0x2dc5ca[_0xe0ae('0x65')],'html':htmlEntities['decode'](_0x2dc5ca[_0xe0ae('0x34')]),'headers':{'Date':moment(_0x2dc5ca[_0xe0ae('0x66')])[_0xe0ae('0x5d')](_0xe0ae('0x6a'))},'attachments':[]};if(_0x2dc5ca['cc']){_0x18ba65[_0xe0ae('0x6b')]['Cc']=_0x2dc5ca['cc'];}if(_0x2dc5ca[_0xe0ae('0x64')]){_0x18ba65[_0xe0ae('0x6b')][_0xe0ae('0x6c')]=_0x2dc5ca[_0xe0ae('0x64')];}return new BPromise(function(_0x24ed91,_0x2efb02){if(_0x2dc5ca[_0xe0ae('0x61')]){for(var _0x3109eb=0x0;_0x3109eb<_0x2dc5ca[_0xe0ae('0x61')][_0xe0ae('0x3d')];_0x3109eb++){var _0x1ea555=_0x2dc5ca[_0xe0ae('0x61')][_0x3109eb];var _0x4a1b59=path['join'](_0x432070,_0x1ea555['basename']);if(fs[_0xe0ae('0x6d')](_0x4a1b59)){_0x18ba65['attachments'][_0xe0ae('0x5f')]({'name':_0x1ea555[_0xe0ae('0x1d')],'contentType':_0x1ea555['type'],'data':fs['readFileSync'](_0x4a1b59)});}}}emlformat[_0xe0ae('0x6e')](_0x18ba65,function(_0x236891,_0x2f4705){if(_0x236891)return _0x2efb02(_0x236891);fs['writeFileSync'](path['join'](_0x15554c,util[_0xe0ae('0x5d')](_0xe0ae('0x6f'),_0x2c6929)),_0x2f4705);return _0x24ed91(_0x2f4705);});});})[_0xe0ae('0x1b')](function(){return new BPromise(function(_0x18faed,_0x2c48a4){zipdir(_0x15554c,{'saveTo':_0x22cb55},function(_0x3fd499,_0x48452a){if(_0x3fd499)return _0x2c48a4(_0x3fd499);return _0x18faed(_0x48452a);});})[_0xe0ae('0x1b')](function(){return new BPromise(function(_0x441450,_0x1fddf5){rimraf(_0x15554c,function(_0x8e9ded){if(_0x8e9ded)_0x1fddf5(_0x8e9ded);return _0x441450();});});})[_0xe0ae('0x1b')](function(){return _0xbe5a99[_0xe0ae('0x56')](_0x22cb55,_0x205495,function(_0x148580){if(!_0x148580)fs[_0xe0ae('0x70')](_0x22cb55);});});});}else{return _0xbe5a99['sendStatus'](0xc8);}})[_0xe0ae('0x27')](handleError(_0xbe5a99,null));}; \ No newline at end of file +var _0x289c=['where','MailInteractionId','filter','$gte','split','includeAll','inlineCss','true','rows','addTags','setTags','ids','spread','Tag','emit','removeTags','download','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','Messages','subject','createdAt','get','mkdirSync','each','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','format','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','juice','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','error','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','getOptions','findAll','mail','query','catch','params','model','keys','intersection','attributes','fields','length','include','merge','options','find','create','body','describe','addMessage','MailMessage','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x5a9898,_0x308478){var _0x2bac37=function(_0x5c76af){while(--_0x5c76af){_0x5a9898['push'](_0x5a9898['shift']());}};_0x2bac37(++_0x308478);}(_0x289c,0x110));var _0xc289=function(_0xa713b0,_0x2af37a){_0xa713b0=_0xa713b0-0x0;var _0x40d7f5=_0x289c[_0xa713b0];return _0x40d7f5;};'use strict';var emlformat=require(_0xc289('0x0'));var rimraf=require(_0xc289('0x1'));var zipdir=require(_0xc289('0x2'));var moment=require(_0xc289('0x3'));var BPromise=require('bluebird');var util=require(_0xc289('0x4'));var path=require(_0xc289('0x5'));var fs=require('fs');var _=require('lodash');var juice=require(_0xc289('0x6'));var Redis=require(_0xc289('0x7'));var interaction=require(_0xc289('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xc289('0x9'))(_0xc289('0xa'));var config=require(_0xc289('0xb'));var db=require(_0xc289('0xc'))['db'];var htmlEntities=require(_0xc289('0xd'));config[_0xc289('0xe')]=_[_0xc289('0xf')](config[_0xc289('0xe')],{'host':_0xc289('0x10'),'port':0x18eb});var socket=require(_0xc289('0x11'))(new Redis(config['redis']));require(_0xc289('0x12'))['register'](socket);function respondWithStatusCode(_0x194aa4,_0x50de8e){_0x50de8e=_0x50de8e||0xcc;return function(_0x407a2d){if(_0x407a2d){return _0x194aa4[_0xc289('0x13')](_0x50de8e);}return _0x194aa4[_0xc289('0x14')](_0x50de8e)['end']();};}function respondWithResult(_0x240e62,_0x5321a9){_0x5321a9=_0x5321a9||0xc8;return function(_0x3e9a6f){if(_0x3e9a6f){return _0x240e62['status'](_0x5321a9)[_0xc289('0x15')](_0x3e9a6f);}};}function respondWithFilteredResult(_0x1c3c0f,_0x4a3fdf){return function(_0x3eb520){if(_0x3eb520){var _0x55da56=typeof _0x4a3fdf[_0xc289('0x16')]===_0xc289('0x17')&&typeof _0x4a3fdf['limit']===_0xc289('0x17');var _0x2eb8d2=_0x3eb520[_0xc289('0x18')];var _0x4e1643=_0x55da56?0x0:_0x4a3fdf['offset'];var _0x36dc90=_0x55da56?_0x3eb520['count']:_0x4a3fdf[_0xc289('0x16')]+_0x4a3fdf[_0xc289('0x19')];var _0x3ec4bc;if(_0x36dc90>=_0x2eb8d2){_0x36dc90=_0x2eb8d2;_0x3ec4bc=0xc8;}else{_0x3ec4bc=0xce;}_0x1c3c0f['status'](_0x3ec4bc);return _0x1c3c0f[_0xc289('0x1a')](_0xc289('0x1b'),_0x4e1643+'-'+_0x36dc90+'/'+_0x2eb8d2)[_0xc289('0x15')](_0x3eb520);}return null;};}function saveUpdates(_0xf5f3b){return function(_0x27d064){if(_0x27d064){return _0x27d064[_0xc289('0x1c')](_0xf5f3b)[_0xc289('0x1d')](function(_0x3506a2){return _0x3506a2;});}return null;};}function removeEntity(_0x38f5f1){return function(_0x13063c){if(_0x13063c){return _0x13063c[_0xc289('0x1e')]()[_0xc289('0x1d')](function(){_0x38f5f1['status'](0xcc)[_0xc289('0x1f')]();});}};}function handleEntityNotFound(_0x1f9772){return function(_0x57b1ad){if(!_0x57b1ad){_0x1f9772[_0xc289('0x13')](0x194);}return _0x57b1ad;};}function handleError(_0x5c77de,_0x4491fb){_0x4491fb=_0x4491fb||0x1f4;return function(_0x413f30){logger[_0xc289('0x20')](_0x413f30['stack']);if(_0x413f30['name']){delete _0x413f30[_0xc289('0x21')];}_0x5c77de[_0xc289('0x14')](_0x4491fb)[_0xc289('0x22')](_0x413f30);};}exports[_0xc289('0x23')]=function(_0x5b4869,_0x3e487d){var _0x4d4869={};var _0x58425a=_[_0xc289('0x24')](db[_0xc289('0x25')][_0xc289('0x26')],function(_0x477f55){return{'name':_0x477f55[_0xc289('0x27')],'type':_0x477f55[_0xc289('0x28')]['key']};});_0x4d4869=qs[_0xc289('0x29')](_0x58425a,_0x5b4869);return interaction[_0xc289('0x2a')](_0xc289('0x2b'),_0x5b4869[_0xc289('0x2c')],_0x5b4869['user'],_0x4d4869,_0x58425a)[_0xc289('0x1d')](respondWithFilteredResult(_0x3e487d,_0x4d4869))[_0xc289('0x2d')](handleError(_0x3e487d,null));};exports['show']=function(_0x313a90,_0x525665){var _0x106030={'raw':![],'where':{'id':_0x313a90[_0xc289('0x2e')]['id']}},_0x3d762d={};_0x3d762d[_0xc289('0x2f')]=_['keys'](db[_0xc289('0x25')][_0xc289('0x26')]);_0x3d762d[_0xc289('0x2c')]=_[_0xc289('0x30')](_0x313a90['query']);_0x3d762d['filters']=_[_0xc289('0x31')](_0x3d762d[_0xc289('0x2f')],_0x3d762d[_0xc289('0x2c')]);_0x106030[_0xc289('0x32')]=_[_0xc289('0x31')](_0x3d762d[_0xc289('0x2f')],qs[_0xc289('0x33')](_0x313a90[_0xc289('0x2c')][_0xc289('0x33')]));_0x106030[_0xc289('0x32')]=_0x106030[_0xc289('0x32')][_0xc289('0x34')]?_0x106030[_0xc289('0x32')]:_0x3d762d['model'];if(_0x313a90[_0xc289('0x2c')]['includeAll']){_0x106030[_0xc289('0x35')]=[{'all':!![]}];}_0x106030=_[_0xc289('0x36')]({},_0x106030,_0x313a90[_0xc289('0x37')]);return db['MailInteraction'][_0xc289('0x38')](_0x106030)[_0xc289('0x1d')](handleEntityNotFound(_0x525665,null))['then'](respondWithResult(_0x525665,null))[_0xc289('0x2d')](handleError(_0x525665,null));};exports[_0xc289('0x39')]=function(_0x50f029,_0x47ffc3){return db['MailInteraction'][_0xc289('0x39')](_0x50f029[_0xc289('0x3a')],{})[_0xc289('0x1d')](respondWithResult(_0x47ffc3,0xc9))[_0xc289('0x2d')](handleError(_0x47ffc3,null));};exports[_0xc289('0x1c')]=function(_0x59d274,_0x491259){if(_0x59d274[_0xc289('0x3a')]['id']){delete _0x59d274[_0xc289('0x3a')]['id'];}return db[_0xc289('0x25')][_0xc289('0x38')]({'where':{'id':_0x59d274[_0xc289('0x2e')]['id']}})['then'](handleEntityNotFound(_0x491259,null))[_0xc289('0x1d')](saveUpdates(_0x59d274[_0xc289('0x3a')],null))[_0xc289('0x1d')](respondWithResult(_0x491259,null))[_0xc289('0x2d')](handleError(_0x491259,null));};exports[_0xc289('0x1e')]=function(_0x13de67,_0xde6c15){return db[_0xc289('0x25')][_0xc289('0x38')]({'where':{'id':_0x13de67[_0xc289('0x2e')]['id']}})['then'](handleEntityNotFound(_0xde6c15,null))[_0xc289('0x1d')](removeEntity(_0xde6c15,null))['catch'](handleError(_0xde6c15,null));};exports[_0xc289('0x3b')]=function(_0x47e1c2,_0x145266){return db[_0xc289('0x25')][_0xc289('0x3b')]()[_0xc289('0x1d')](respondWithResult(_0x145266,null))['catch'](handleError(_0x145266,null));};exports[_0xc289('0x3c')]=function(_0x5d7fe5,_0x19462b){return db[_0xc289('0x3d')][_0xc289('0x38')]({'where':{'id':_0x5d7fe5['params']['id']}})[_0xc289('0x1d')](handleEntityNotFound(_0x19462b,null))[_0xc289('0x1d')](function(_0x2e13aa){if(_0x2e13aa){return _0x2e13aa[_0xc289('0x3c')](_0x5d7fe5[_0xc289('0x3a')]['ids'],_[_0xc289('0x3e')](_0x5d7fe5[_0xc289('0x3a')],['ids','id'])||{});}})[_0xc289('0x1d')](respondWithResult(_0x19462b,null))[_0xc289('0x2d')](handleError(_0x19462b,null));};exports[_0xc289('0x3f')]=function(_0x15243b,_0x130445){var _0x30eb75={'raw':![],'where':{}};var _0x311b89={};var _0xfa4672={'count':0x0,'rows':[]};return db[_0xc289('0x25')]['findOne']({'where':{'id':_0x15243b[_0xc289('0x2e')]['id']}})[_0xc289('0x1d')](handleEntityNotFound(_0x130445,null))['then'](function(_0xcf5ab7){if(_0xcf5ab7){_0x311b89['model']=_['keys'](db[_0xc289('0x3d')][_0xc289('0x26')]);_0x311b89[_0xc289('0x2c')]=_[_0xc289('0x30')](_0x15243b[_0xc289('0x2c')]);_0x311b89[_0xc289('0x40')]=_[_0xc289('0x31')](_0x311b89[_0xc289('0x2f')],_0x311b89[_0xc289('0x2c')]);_0x30eb75['attributes']=_[_0xc289('0x31')](_0x311b89[_0xc289('0x2f')],qs['fields'](_0x15243b[_0xc289('0x2c')][_0xc289('0x33')]));_0x30eb75[_0xc289('0x32')]=_0x30eb75[_0xc289('0x32')][_0xc289('0x34')]?_0x30eb75[_0xc289('0x32')]:_0x311b89[_0xc289('0x2f')];if(!_0x15243b[_0xc289('0x2c')][_0xc289('0x41')](_0xc289('0x42'))){_0x30eb75[_0xc289('0x19')]=qs[_0xc289('0x19')](_0x15243b[_0xc289('0x2c')][_0xc289('0x19')]);_0x30eb75['offset']=qs['offset'](_0x15243b[_0xc289('0x2c')][_0xc289('0x16')]);}_0x30eb75[_0xc289('0x43')]=qs[_0xc289('0x44')](_0x15243b[_0xc289('0x2c')]['sort']);_0x30eb75['where']=qs[_0xc289('0x40')](_[_0xc289('0x45')](_0x15243b[_0xc289('0x2c')],_0x311b89[_0xc289('0x40')]));_0x30eb75[_0xc289('0x46')][_0xc289('0x47')]=_0xcf5ab7['id'];if(_0x15243b['query'][_0xc289('0x48')]){_0x30eb75[_0xc289('0x46')]=_[_0xc289('0x36')](_0x30eb75[_0xc289('0x46')],{'$or':_['map'](_0x30eb75['attributes'],function(_0x4cd811){var _0x2bc47d={};_0x2bc47d[_0x4cd811]={'$like':'%'+_0x15243b[_0xc289('0x2c')][_0xc289('0x48')]+'%'};return _0x2bc47d;})});}if(_0x15243b[_0xc289('0x2c')][_0xc289('0x49')]){var _0x12433b=_0x15243b[_0xc289('0x2c')][_0xc289('0x49')][_0xc289('0x4a')](',');var _0x4df324={};_0x4df324[_0x12433b[0x0]]={'$gte':moment(_0x12433b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x30eb75[_0xc289('0x46')]=_[_0xc289('0x36')](_0x30eb75[_0xc289('0x46')],_0x4df324);}_0x30eb75=_[_0xc289('0x36')]({},_0x30eb75,_0x15243b[_0xc289('0x37')]);return db[_0xc289('0x3d')][_0xc289('0x18')]({'where':_0x30eb75[_0xc289('0x46')]})[_0xc289('0x1d')](function(_0x1e3185){_0xfa4672['count']=_0x1e3185;if(_0x15243b[_0xc289('0x2c')][_0xc289('0x4b')]){_0x30eb75[_0xc289('0x35')]=[{'all':!![]}];}return db[_0xc289('0x3d')]['findAll'](_0x30eb75);})[_0xc289('0x1d')](function(_0x2a2711){if(_0x15243b[_0xc289('0x2c')][_0xc289('0x4c')]===_0xc289('0x4d')){for(var _0x37a8bc=0x0;_0x37a8bc<_0x2a2711[_0xc289('0x34')];_0x37a8bc++){_0x2a2711[_0x37a8bc][_0xc289('0x3a')]=juice(_0x2a2711[_0x37a8bc][_0xc289('0x3a')]);}}_0xfa4672[_0xc289('0x4e')]=_0x2a2711;return _0xfa4672;});}})['then'](respondWithFilteredResult(_0x130445,_0x30eb75))[_0xc289('0x2d')](handleError(_0x130445,null));};exports[_0xc289('0x4f')]=function(_0x78e7de,_0x4d16c0){return db[_0xc289('0x25')][_0xc289('0x38')]({'where':{'id':_0x78e7de[_0xc289('0x2e')]['id']}})[_0xc289('0x1d')](handleEntityNotFound(_0x4d16c0,null))[_0xc289('0x1d')](function(_0x24707d){if(_0x24707d){return _0x24707d[_0xc289('0x50')](_0x78e7de[_0xc289('0x3a')]['ids'],_[_0xc289('0x3e')](_0x78e7de[_0xc289('0x3a')],[_0xc289('0x51'),'id'])||{})[_0xc289('0x52')](function(){return db[_0xc289('0x53')][_0xc289('0x2a')]({'attributes':['id','name','color'],'where':{'id':_0x78e7de[_0xc289('0x3a')][_0xc289('0x51')]}});})[_0xc289('0x1d')](function(_0x48cffe){socket[_0xc289('0x54')]('mailInteractionTags:save',{'id':Number(_0x78e7de[_0xc289('0x2e')]['id']),'tags':_0x48cffe||[]});return{'id':Number(_0x78e7de[_0xc289('0x2e')]['id']),'tags':_0x48cffe||[]};});}})['then'](respondWithResult(_0x4d16c0,null))[_0xc289('0x2d')](handleError(_0x4d16c0,null));};exports['removeTags']=function(_0x476d8c,_0x1d2371){return db['MailInteraction'][_0xc289('0x38')]({'where':{'id':_0x476d8c['params']['id']}})[_0xc289('0x1d')](handleEntityNotFound(_0x1d2371,null))[_0xc289('0x1d')](function(_0x33ce31){if(_0x33ce31){return _0x33ce31[_0xc289('0x55')](_0x476d8c[_0xc289('0x2c')]['ids']);}})[_0xc289('0x1d')](respondWithStatusCode(_0x1d2371,null))['catch'](handleError(_0x1d2371,null));};exports[_0xc289('0x56')]=function(_0x4aec86,_0x59574a){var _0x44951a=moment()['unix']()[_0xc289('0x57')]();var _0x51aa51=path[_0xc289('0x58')](config[_0xc289('0x59')],_0xc289('0x5a'),'files',_0xc289('0x5b'));var _0x404e03=path[_0xc289('0x58')](config[_0xc289('0x59')],_0xc289('0x5a'),_0xc289('0x5c'),_0xc289('0x5d'));var _0x4e2fdf=path[_0xc289('0x58')](_0x51aa51,_0x44951a);var _0x491be0=util['format'](_0xc289('0x5e'),_0x4aec86['params']['id'],_0x44951a);var _0xef6051=path[_0xc289('0x58')](_0x51aa51,_0x491be0);var _0x4ce86f=[];if(_0x4aec86['query'][_0xc289('0x5d')]){_0x4ce86f[_0xc289('0x5f')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x515d29=[{'model':db[_0xc289('0x3d')],'as':_0xc289('0x60'),'attributes':['id',_0xc289('0x3a'),'from','to','cc','bcc',_0xc289('0x61'),_0xc289('0x62')],'where':{'secret':![]},'order':qs[_0xc289('0x44')]('id'),'include':_0x4ce86f}];return db[_0xc289('0x25')][_0xc289('0x38')]({'where':{'id':_0x4aec86['params']['id']},'include':_0x515d29})[_0xc289('0x1d')](handleEntityNotFound(_0x59574a,null))[_0xc289('0x1d')](function(_0x43e0f7){if(_0x43e0f7&&_0x43e0f7['Messages']){var _0x5bf3e6=_0x43e0f7[_0xc289('0x63')]({'plain':!![]});fs[_0xc289('0x64')](_0x4e2fdf);return BPromise[_0xc289('0x65')](_0x5bf3e6[_0xc289('0x60')],function(_0x18b0fc,_0x3d5058){var _0x12dc81={'from':_0x18b0fc[_0xc289('0x66')],'to':_0x18b0fc['to'],'subject':_0x18b0fc[_0xc289('0x61')],'html':htmlEntities[_0xc289('0x67')](_0x18b0fc[_0xc289('0x3a')]),'headers':{'Date':moment(_0x18b0fc[_0xc289('0x62')])['format'](_0xc289('0x68'))},'attachments':[]};if(_0x18b0fc['cc']){_0x12dc81[_0xc289('0x69')]['Cc']=_0x18b0fc['cc'];}if(_0x18b0fc['bcc']){_0x12dc81[_0xc289('0x69')][_0xc289('0x6a')]=_0x18b0fc['bcc'];}return new BPromise(function(_0x209e01,_0x599ce0){if(_0x18b0fc[_0xc289('0x6b')]){for(var _0x2418fd=0x0;_0x2418fd<_0x18b0fc[_0xc289('0x6b')]['length'];_0x2418fd++){var _0x2431f0=_0x18b0fc['Attachments'][_0x2418fd];var _0x589d61=path['join'](_0x404e03,_0x2431f0[_0xc289('0x6c')]);if(fs[_0xc289('0x6d')](_0x589d61)){_0x12dc81[_0xc289('0x5d')][_0xc289('0x5f')]({'name':_0x2431f0[_0xc289('0x21')],'contentType':_0x2431f0[_0xc289('0x28')],'data':fs[_0xc289('0x6e')](_0x589d61)});}}}emlformat[_0xc289('0x6f')](_0x12dc81,function(_0x1e331f,_0x27d1e4){if(_0x1e331f)return _0x599ce0(_0x1e331f);fs['writeFileSync'](path[_0xc289('0x58')](_0x4e2fdf,util[_0xc289('0x70')]('message%d.eml',_0x3d5058)),_0x27d1e4);return _0x209e01(_0x27d1e4);});});})[_0xc289('0x1d')](function(){return new BPromise(function(_0x59e9fa,_0x4af61b){zipdir(_0x4e2fdf,{'saveTo':_0xef6051},function(_0x130ee5,_0x100b36){if(_0x130ee5)return _0x4af61b(_0x130ee5);return _0x59e9fa(_0x100b36);});})[_0xc289('0x1d')](function(){return new BPromise(function(_0x582ddb,_0x5f469d){rimraf(_0x4e2fdf,function(_0x26cf88){if(_0x26cf88)_0x5f469d(_0x26cf88);return _0x582ddb();});});})[_0xc289('0x1d')](function(){return _0x59574a[_0xc289('0x56')](_0xef6051,_0x491be0,function(_0x4403ee){if(!_0x4403ee)fs[_0xc289('0x71')](_0xef6051);});});});}else{return _0x59574a[_0xc289('0x13')](0xc8);}})[_0xc289('0x2d')](handleError(_0x59574a,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 1bd1946..4980324 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 _0x8834=['setMaxListeners','save','update','remove','getUsers','Users','findAll','then','length','emit','catch','hasOwnProperty','exports','MailInteraction','../../mysqldb'];(function(_0x4d7c8c,_0x4e9006){var _0x2f42a3=function(_0x521f4c){while(--_0x521f4c){_0x4d7c8c['push'](_0x4d7c8c['shift']());}};_0x2f42a3(++_0x4e9006);}(_0x8834,0x148));var _0x4883=function(_0x5addd5,_0x42cccb){_0x5addd5=_0x5addd5-0x0;var _0x1d3d93=_0x8834[_0x5addd5];return _0x1d3d93;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x4883('0x0')];var MailMessage=require(_0x4883('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4883('0x2')](0x0);var events={'afterCreate':_0x4883('0x3'),'afterUpdate':_0x4883('0x4'),'afterDestroy':_0x4883('0x5')};function emitEvent(_0x171e87){return function(_0x228847,_0x4c7866,_0x5667d6){_0x228847[_0x4883('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x375182){_0x228847['setDataValue'](_0x4883('0x7'),_0x375182['map'](function(_0x223ffb){return{'id':_0x223ffb['id']};}));return MailMessage[_0x4883('0x8')]({'where':{'MailInteractionId':_0x228847['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4883('0x9')](function(_0x323bdd){_0x228847['setDataValue']('unreadMessages',_0x323bdd[_0x4883('0xa')]);MailInteractionEvents[_0x4883('0xb')](_0x171e87+':'+_0x228847['id'],_0x228847);MailInteractionEvents[_0x4883('0xb')](_0x171e87,_0x228847);_0x5667d6(null);})[_0x4883('0xc')](_0x5667d6(null));};}for(var e in events){if(events[_0x4883('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x4883('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xe4f5=['setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','../../mysqldb','MailMessage','setMaxListeners','remove','getUsers','then'];(function(_0xa9e3ac,_0x52d22f){var _0x2b0830=function(_0xd3f7d9){while(--_0xd3f7d9){_0xa9e3ac['push'](_0xa9e3ac['shift']());}};_0x2b0830(++_0x52d22f);}(_0xe4f5,0x182));var _0x5e4f=function(_0x5f3012,_0x3799fc){_0x5f3012=_0x5f3012-0x0;var _0x55927d=_0xe4f5[_0x5f3012];return _0x55927d;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x5e4f('0x0'))['db']['MailInteraction'];var MailMessage=require(_0x5e4f('0x0'))['db'][_0x5e4f('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5e4f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5e4f('0x3')};function emitEvent(_0x20e2d3){return function(_0x3d51ea,_0x4a7b6f,_0x5a1ace){_0x3d51ea[_0x5e4f('0x4')]({'attributes':['id'],'raw':!![]})[_0x5e4f('0x5')](function(_0x54720c){_0x3d51ea[_0x5e4f('0x6')](_0x5e4f('0x7'),_0x54720c[_0x5e4f('0x8')](function(_0x3fad4b){return{'id':_0x3fad4b['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x3d51ea['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5e4f('0x5')](function(_0x337032){_0x3d51ea['setDataValue'](_0x5e4f('0x9'),_0x337032[_0x5e4f('0xa')]);MailInteractionEvents[_0x5e4f('0xb')](_0x20e2d3+':'+_0x3d51ea['id'],_0x3d51ea);MailInteractionEvents['emit'](_0x20e2d3,_0x3d51ea);_0x5a1ace(null);})[_0x5e4f('0xc')](_0x5a1ace(null));};}for(var e in events){if(events[_0x5e4f('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index d62e64e..04f340c 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 _0x75e8=['subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','models','get','MailMessage','update','then','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','MailInteraction','fti_mail_interactions'];(function(_0x233404,_0x33e3ab){var _0x5787ba=function(_0xe86ec0){while(--_0xe86ec0){_0x233404['push'](_0x233404['shift']());}};_0x5787ba(++_0x33e3ab);}(_0x75e8,0x1a6));var _0x875e=function(_0x1d1402,_0x5a048f){_0x1d1402=_0x1d1402-0x0;var _0x1bdc2d=_0x75e8[_0x1d1402];return _0x1bdc2d;};'use strict';var _=require(_0x875e('0x0'));var util=require('util');var logger=require(_0x875e('0x1'))(_0x875e('0x2'));var moment=require('moment');var BPromise=require(_0x875e('0x3'));var rp=require(_0x875e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x875e('0x5'));var config=require(_0x875e('0x6'));var attributes=require('./mailInteraction.attributes');module[_0x875e('0x7')]=function(_0x50ab7d,_0x10ddb6){return _0x50ab7d['define'](_0x875e('0x8'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x875e('0x9'),'fields':[_0x875e('0xa'),'to'],'type':_0x875e('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x160eae,_0x1cb8e2,_0x38b307){if(_0x160eae[_0x875e('0xc')]){_0x160eae[_0x875e('0xd')]=moment()[_0x875e('0xe')](_0x875e('0xf'));}if(_0x160eae[_0x875e('0x10')]){_0x160eae['closedAt']=moment()[_0x875e('0xe')](_0x875e('0xf'));}_0x38b307(null,_0x1cb8e2);},'beforeUpdate':function(_0x9a9e31,_0x4a14d0,_0x59ba0c){if(_0x9a9e31[_0x875e('0x11')]('substatus')){_0x9a9e31[_0x875e('0xd')]=_0x9a9e31[_0x875e('0xc')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x9a9e31['changed'](_0x875e('0x10'))){_0x9a9e31['closedAt']=moment()[_0x875e('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x9a9e31[_0x875e('0xc')]=null;_0x9a9e31[_0x875e('0xd')]=null;}_0x59ba0c(null,_0x9a9e31);},'afterUpdate':function(_0x35a786,_0xf1f9e9,_0x5cb202){var _0x588272=_0x50ab7d[_0x875e('0x12')];var _0x487e46=_0x35a786[_0x875e('0x13')]({'plain':!![]});if(_0x487e46[_0x875e('0x10')]){return _0x588272[_0x875e('0x14')][_0x875e('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x487e46['id']}})[_0x875e('0x16')](function(){_0x5cb202();})['catch'](function(_0x17c080){_0x5cb202(_0x17c080);});}else{_0x5cb202();}}},'charset':_0x875e('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2fab=['MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','define'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x2fab,0x117));var _0xb2fa=function(_0x4eeb6f,_0x1ad1a3){_0x4eeb6f=_0x4eeb6f-0x0;var _0x3b7a99=_0x2fab[_0x4eeb6f];return _0x3b7a99;};'use strict';var _=require(_0xb2fa('0x0'));var util=require(_0xb2fa('0x1'));var logger=require(_0xb2fa('0x2'))(_0xb2fa('0x3'));var moment=require(_0xb2fa('0x4'));var BPromise=require(_0xb2fa('0x5'));var rp=require(_0xb2fa('0x6'));var fs=require('fs');var path=require(_0xb2fa('0x7'));var rimraf=require(_0xb2fa('0x8'));var config=require('../../config/environment');var attributes=require(_0xb2fa('0x9'));module['exports']=function(_0x4b3312,_0x2cbce9){return _0x4b3312[_0xb2fa('0xa')](_0xb2fa('0xb'),attributes,{'tableName':_0xb2fa('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xb2fa('0xd'),'to'],'type':_0xb2fa('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4fc2ce,_0x5de93f,_0x522301){if(_0x4fc2ce[_0xb2fa('0xf')]){_0x4fc2ce[_0xb2fa('0x10')]=moment()[_0xb2fa('0x11')](_0xb2fa('0x12'));}if(_0x4fc2ce[_0xb2fa('0x13')]){_0x4fc2ce[_0xb2fa('0x14')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x522301(null,_0x5de93f);},'beforeUpdate':function(_0x4eea44,_0xfdf899,_0x31dcdf){if(_0x4eea44[_0xb2fa('0x15')](_0xb2fa('0xf'))){_0x4eea44['substatusAt']=_0x4eea44[_0xb2fa('0xf')]?moment()['format'](_0xb2fa('0x12')):null;}if(_0x4eea44[_0xb2fa('0x15')](_0xb2fa('0x13'))){_0x4eea44[_0xb2fa('0x14')]=moment()[_0xb2fa('0x11')](_0xb2fa('0x12'));_0x4eea44[_0xb2fa('0xf')]=null;_0x4eea44[_0xb2fa('0x10')]=null;}_0x31dcdf(null,_0x4eea44);},'afterUpdate':function(_0x375312,_0x5c4890,_0x37f7c3){var _0x7f1e35=_0x4b3312['models'];var _0x14878e=_0x375312[_0xb2fa('0x16')]({'plain':!![]});if(_0x14878e[_0xb2fa('0x13')]){return _0x7f1e35[_0xb2fa('0x17')][_0xb2fa('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x14878e['id']}})[_0xb2fa('0x19')](function(){_0x37f7c3();})[_0xb2fa('0x1a')](function(_0x117996){_0x37f7c3(_0x117996);});}else{_0x37f7c3();}}},'charset':_0xb2fa('0x1b'),'collate':_0xb2fa('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 17e51cc..eb0bdb2 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 _0xcc80=['omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','addTags'];(function(_0x1d9cb8,_0x50100b){var _0x3db3de=function(_0x155e74){while(--_0x155e74){_0x1d9cb8['push'](_0x1d9cb8['shift']());}};_0x3db3de(++_0x50100b);}(_0xcc80,0xb7));var _0x0cc8=function(_0x3befa4,_0x299da7){_0x3befa4=_0x3befa4-0x0;var _0xaabb80=_0xcc80[_0x3befa4];return _0xaabb80;};'use strict';var _=require(_0x0cc8('0x0'));var util=require('util');var moment=require(_0x0cc8('0x1'));var BPromise=require(_0x0cc8('0x2'));var rs=require(_0x0cc8('0x3'));var fs=require('fs');var Redis=require(_0x0cc8('0x4'));var db=require(_0x0cc8('0x5'))['db'];var utils=require(_0x0cc8('0x6'));var logger=require(_0x0cc8('0x7'))(_0x0cc8('0x8'));var config=require(_0x0cc8('0x9'));var jayson=require(_0x0cc8('0xa'));var client=jayson[_0x0cc8('0xb')][_0x0cc8('0xc')]({'port':0x232a});config[_0x0cc8('0xd')]=_[_0x0cc8('0xe')](config[_0x0cc8('0xd')],{'host':_0x0cc8('0xf'),'port':0x18eb});var socket=require(_0x0cc8('0x10'))(new Redis(config[_0x0cc8('0xd')]));require(_0x0cc8('0x11'))['register'](socket);function respondWithRpcPromise(_0x575bea,_0x28167d,_0x398782){return new BPromise(function(_0x2343e4,_0x125900){return client['request'](_0x575bea,_0x398782)[_0x0cc8('0x12')](function(_0x3960a5){logger[_0x0cc8('0x13')](_0x0cc8('0x14'),_0x28167d,_0x0cc8('0x15'));logger[_0x0cc8('0x16')](_0x0cc8('0x17'),_0x28167d,_0x0cc8('0x15'),JSON[_0x0cc8('0x18')](_0x3960a5));if(_0x3960a5[_0x0cc8('0x19')]){if(_0x3960a5[_0x0cc8('0x19')][_0x0cc8('0x1a')]===0x1f4){logger[_0x0cc8('0x19')](_0x0cc8('0x14'),_0x28167d,_0x3960a5[_0x0cc8('0x19')][_0x0cc8('0x1b')]);return _0x125900(_0x3960a5['error'][_0x0cc8('0x1b')]);}logger[_0x0cc8('0x19')](_0x0cc8('0x14'),_0x28167d,_0x3960a5[_0x0cc8('0x19')][_0x0cc8('0x1b')]);return _0x2343e4(_0x3960a5[_0x0cc8('0x19')][_0x0cc8('0x1b')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x28167d,'request\x20sent');_0x2343e4(_0x3960a5[_0x0cc8('0x1c')][_0x0cc8('0x1b')]);}})[_0x0cc8('0x1d')](function(_0x1779aa){logger[_0x0cc8('0x19')](_0x0cc8('0x14'),_0x28167d,_0x1779aa);_0x125900(_0x1779aa);});});}exports[_0x0cc8('0x1e')]=function(_0x2d7f19){var _0x28f4f7=this;return new Promise(function(_0x4db43d,_0xd62204){return db[_0x0cc8('0x1f')][_0x0cc8('0x20')](_0x2d7f19[_0x0cc8('0x21')],{'raw':_0x2d7f19['options']?_0x2d7f19[_0x0cc8('0x22')][_0x0cc8('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d7f19['options']?_0x2d7f19[_0x0cc8('0x22')][_0x0cc8('0x24')]||null:null,'attributes':_0x2d7f19[_0x0cc8('0x22')]?_0x2d7f19['options'][_0x0cc8('0x25')]||null:null,'limit':_0x2d7f19[_0x0cc8('0x22')]?_0x2d7f19[_0x0cc8('0x22')][_0x0cc8('0x26')]||null:null})['then'](function(_0x1fb725){logger[_0x0cc8('0x13')]('UpdateMailInteraction',_0x2d7f19);logger[_0x0cc8('0x16')](_0x0cc8('0x1e'),_0x2d7f19,JSON[_0x0cc8('0x18')](_0x1fb725));_0x4db43d(_0x1fb725);})[_0x0cc8('0x1d')](function(_0x30ccd2){logger['error'](_0x0cc8('0x1e'),_0x30ccd2[_0x0cc8('0x1b')],_0x2d7f19);_0xd62204(_0x28f4f7[_0x0cc8('0x19')](0x1f4,_0x30ccd2[_0x0cc8('0x1b')]));});});};exports[_0x0cc8('0x27')]=function(_0x1c5608){return new Promise(function(_0x5501b8,_0x2a4526){return db[_0x0cc8('0x1f')][_0x0cc8('0x28')]({'where':_0x1c5608[_0x0cc8('0x22')]?_0x1c5608[_0x0cc8('0x22')][_0x0cc8('0x24')]||null:null})[_0x0cc8('0x12')](function(_0x250564){if(_0x250564){return _0x250564[_0x0cc8('0x29')](_0x1c5608['body']['ids'],_[_0x0cc8('0x2a')](_0x1c5608[_0x0cc8('0x21')],['ids','id'])||{});}})[_0x0cc8('0x2b')](function(_0xc950b1){logger[_0x0cc8('0x13')](_0x0cc8('0x2c'),_0x1c5608);logger[_0x0cc8('0x16')](_0x0cc8('0x2c'),_0x1c5608,JSON[_0x0cc8('0x18')](_0xc950b1));_0x5501b8(_0xc950b1);})[_0x0cc8('0x1d')](function(_0x1f3774){logger[_0x0cc8('0x19')]('AddTags',_0x1f3774[_0x0cc8('0x1b')],_0x1c5608);_0x2a4526(_this[_0x0cc8('0x19')](0x1f4,_0x1f3774['message']));});});}; \ No newline at end of file +var _0x2c6e=['UpdateMailInteraction','MailInteraction','options','raw','attributes','AddTagsToMailInteraction','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x32ca5a,_0x44cea7){var _0x8bc078=function(_0x454730){while(--_0x454730){_0x32ca5a['push'](_0x32ca5a['shift']());}};_0x8bc078(++_0x44cea7);}(_0x2c6e,0x161));var _0xe2c6=function(_0x339214,_0x3f4076){_0x339214=_0x339214-0x0;var _0x1427a3=_0x2c6e[_0x339214];return _0x1427a3;};'use strict';var _=require(_0xe2c6('0x0'));var util=require(_0xe2c6('0x1'));var moment=require(_0xe2c6('0x2'));var BPromise=require(_0xe2c6('0x3'));var rs=require(_0xe2c6('0x4'));var fs=require('fs');var Redis=require(_0xe2c6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe2c6('0x6'))(_0xe2c6('0x7'));var config=require(_0xe2c6('0x8'));var jayson=require(_0xe2c6('0x9'));var client=jayson['client'][_0xe2c6('0xa')]({'port':0x232a});config[_0xe2c6('0xb')]=_[_0xe2c6('0xc')](config[_0xe2c6('0xb')],{'host':_0xe2c6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2c6('0xb')]));require(_0xe2c6('0xe'))['register'](socket);function respondWithRpcPromise(_0x43c17a,_0x3eef40,_0x4632c9){return new BPromise(function(_0x4b8499,_0x207f7f){return client[_0xe2c6('0xf')](_0x43c17a,_0x4632c9)[_0xe2c6('0x10')](function(_0xc29680){logger[_0xe2c6('0x11')](_0xe2c6('0x12'),_0x3eef40,_0xe2c6('0x13'));logger[_0xe2c6('0x14')](_0xe2c6('0x15'),_0x3eef40,_0xe2c6('0x13'),JSON[_0xe2c6('0x16')](_0xc29680));if(_0xc29680[_0xe2c6('0x17')]){if(_0xc29680[_0xe2c6('0x17')][_0xe2c6('0x18')]===0x1f4){logger[_0xe2c6('0x17')](_0xe2c6('0x12'),_0x3eef40,_0xc29680[_0xe2c6('0x17')][_0xe2c6('0x19')]);return _0x207f7f(_0xc29680[_0xe2c6('0x17')][_0xe2c6('0x19')]);}logger[_0xe2c6('0x17')]('MailInteraction,\x20%s,\x20%s',_0x3eef40,_0xc29680[_0xe2c6('0x17')]['message']);return _0x4b8499(_0xc29680[_0xe2c6('0x17')][_0xe2c6('0x19')]);}else{logger['info'](_0xe2c6('0x12'),_0x3eef40,_0xe2c6('0x13'));_0x4b8499(_0xc29680['result'][_0xe2c6('0x19')]);}})[_0xe2c6('0x1a')](function(_0x180565){logger[_0xe2c6('0x17')](_0xe2c6('0x12'),_0x3eef40,_0x180565);_0x207f7f(_0x180565);});});}exports[_0xe2c6('0x1b')]=function(_0x31e0ac){var _0x46585d=this;return new Promise(function(_0x4f77be,_0x27c895){return db[_0xe2c6('0x1c')]['update'](_0x31e0ac['body'],{'raw':_0x31e0ac[_0xe2c6('0x1d')]?_0x31e0ac[_0xe2c6('0x1d')][_0xe2c6('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31e0ac['options']?_0x31e0ac[_0xe2c6('0x1d')]['where']||null:null,'attributes':_0x31e0ac[_0xe2c6('0x1d')]?_0x31e0ac[_0xe2c6('0x1d')][_0xe2c6('0x1f')]||null:null,'limit':_0x31e0ac[_0xe2c6('0x1d')]?_0x31e0ac['options']['limit']||null:null})[_0xe2c6('0x10')](function(_0x33bf32){logger[_0xe2c6('0x11')]('UpdateMailInteraction',_0x31e0ac);logger[_0xe2c6('0x14')](_0xe2c6('0x1b'),_0x31e0ac,JSON['stringify'](_0x33bf32));_0x4f77be(_0x33bf32);})[_0xe2c6('0x1a')](function(_0x2b6d30){logger[_0xe2c6('0x17')]('UpdateMailInteraction',_0x2b6d30[_0xe2c6('0x19')],_0x31e0ac);_0x27c895(_0x46585d[_0xe2c6('0x17')](0x1f4,_0x2b6d30[_0xe2c6('0x19')]));});});};exports[_0xe2c6('0x20')]=function(_0x2da719){return new Promise(function(_0x1eb6e6,_0x1a3d44){return db['MailInteraction']['find']({'where':_0x2da719[_0xe2c6('0x1d')]?_0x2da719[_0xe2c6('0x1d')]['where']||null:null})[_0xe2c6('0x10')](function(_0x3b7083){if(_0x3b7083){return _0x3b7083['addTags'](_0x2da719[_0xe2c6('0x21')][_0xe2c6('0x22')],_[_0xe2c6('0x23')](_0x2da719[_0xe2c6('0x21')],[_0xe2c6('0x22'),'id'])||{});}})[_0xe2c6('0x24')](function(_0x154e5d){logger[_0xe2c6('0x11')](_0xe2c6('0x25'),_0x2da719);logger[_0xe2c6('0x14')](_0xe2c6('0x25'),_0x2da719,JSON[_0xe2c6('0x16')](_0x154e5d));_0x1eb6e6(_0x154e5d);})[_0xe2c6('0x1a')](function(_0x5a1f17){logger[_0xe2c6('0x17')](_0xe2c6('0x25'),_0x5a1f17['message'],_0x2da719);_0x1a3d44(_this[_0xe2c6('0x17')](0x1f4,_0x5a1f17['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 38f3925..af9f9f2 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 _0x2533=['length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','register'];(function(_0x3aa4de,_0x439c0e){var _0xaa0866=function(_0x4be24f){while(--_0x4be24f){_0x3aa4de['push'](_0x3aa4de['shift']());}};_0xaa0866(++_0x439c0e);}(_0x2533,0x1da));var _0x3253=function(_0x3ef2d5,_0x423d46){_0x3ef2d5=_0x3ef2d5-0x0;var _0x2fefb2=_0x2533[_0x3ef2d5];return _0x2fefb2;};'use strict';var MailInteractionEvents=require(_0x3253('0x0'));var events=[_0x3253('0x1'),_0x3253('0x2'),_0x3253('0x3')];function createListener(_0xc0595b,_0x3fa836){return function(_0x291d1d){_0x3fa836[_0x3253('0x4')](_0xc0595b,_0x291d1d);};}function removeListener(_0x33abc7,_0x3a0eb5){return function(){MailInteractionEvents['removeListener'](_0x33abc7,_0x3a0eb5);};}exports[_0x3253('0x5')]=function(_0x40b5fb){for(var _0x3f85b9=0x0,_0xafaa0e=events[_0x3253('0x6')];_0x3f85b9<_0xafaa0e;_0x3f85b9++){var _0x2c1f43=events[_0x3f85b9];var _0x215102=createListener(_0x3253('0x7')+_0x2c1f43,_0x40b5fb);MailInteractionEvents['on'](_0x2c1f43,_0x215102);}}; \ No newline at end of file +var _0x4d80=['save','remove','emit','register','length','mailInteraction:'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0x4d80,0x162));var _0x04d8=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x4d80[_0x199572];return _0x13cfa3;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x04d8('0x0'),_0x04d8('0x1'),'update'];function createListener(_0x24ff43,_0x41ad22){return function(_0x46f3a0){_0x41ad22[_0x04d8('0x2')](_0x24ff43,_0x46f3a0);};}function removeListener(_0x508ea3,_0x4e80d1){return function(){MailInteractionEvents['removeListener'](_0x508ea3,_0x4e80d1);};}exports[_0x04d8('0x3')]=function(_0x5def5d){for(var _0x2b194b=0x0,_0x2e3f64=events[_0x04d8('0x4')];_0x2b194b<_0x2e3f64;_0x2b194b++){var _0x2ba37f=events[_0x2b194b];var _0x32d88f=createListener(_0x04d8('0x5')+_0x2ba37f,_0x5def5d);MailInteractionEvents['on'](_0x2ba37f,_0x32d88f);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 5dcbd32..c8397ae 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 _0x0565=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/download','post','tracked','create','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer'];(function(_0x3a166a,_0x2018be){var _0x1b0279=function(_0x5b98dd){while(--_0x5b98dd){_0x3a166a['push'](_0x3a166a['shift']());}};_0x1b0279(++_0x2018be);}(_0x0565,0xf2));var _0x5056=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x0565[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var path=require(_0x5056('0x2'));var timeout=require(_0x5056('0x3'));var express=require(_0x5056('0x4'));var router=express[_0x5056('0x5')]();var fs_extra=require(_0x5056('0x6'));var auth=require(_0x5056('0x7'));var interaction=require(_0x5056('0x8'));var config=require(_0x5056('0x9'));var controller=require('./mailMessage.controller');router[_0x5056('0xa')]('/',auth[_0x5056('0xb')](),controller[_0x5056('0xc')]);router[_0x5056('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x5056('0xd')]);router[_0x5056('0xa')](_0x5056('0xe'),auth[_0x5056('0xb')](),controller[_0x5056('0xf')]);router[_0x5056('0xa')](_0x5056('0x10'),auth[_0x5056('0xb')](),controller['download']);router[_0x5056('0x11')]('/',auth[_0x5056('0xb')](),interaction[_0x5056('0x12')]('mail','mailmessage:create'),controller[_0x5056('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5056('0x14')]);router['put'](_0x5056('0x15'),auth[_0x5056('0xb')](),controller[_0x5056('0x16')]);router['put'](_0x5056('0x17'),auth[_0x5056('0xb')](),controller[_0x5056('0x18')]);router[_0x5056('0x19')](_0x5056('0xe'),auth[_0x5056('0xb')](),controller['destroy']);module[_0x5056('0x1a')]=router; \ No newline at end of file +var _0x1d2d=['/:id','show','/:id/download','download','post','tracked','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','describe'];(function(_0x452259,_0x580308){var _0x192c46=function(_0x4bd83c){while(--_0x4bd83c){_0x452259['push'](_0x452259['shift']());}};_0x192c46(++_0x580308);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x19cae0,_0x390962){_0x19cae0=_0x19cae0-0x0;var _0xfec11e=_0x1d2d[_0x19cae0];return _0xfec11e;};'use strict';var multer=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var path=require(_0xd1d2('0x2'));var timeout=require(_0xd1d2('0x3'));var express=require(_0xd1d2('0x4'));var router=express['Router']();var fs_extra=require(_0xd1d2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd1d2('0x6'));var controller=require(_0xd1d2('0x7'));router[_0xd1d2('0x8')]('/',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xa')]);router[_0xd1d2('0x8')]('/describe',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xb')]);router[_0xd1d2('0x8')](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xd')]);router[_0xd1d2('0x8')](_0xd1d2('0xe'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xf')]);router[_0xd1d2('0x10')]('/',auth[_0xd1d2('0x9')](),interaction[_0xd1d2('0x11')]('mail',_0xd1d2('0x12')),controller[_0xd1d2('0x13')]);router[_0xd1d2('0x14')](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x15')]);router[_0xd1d2('0x14')](_0xd1d2('0x16'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x17')]);router['put'](_0xd1d2('0x18'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x19')]);router['delete'](_0xd1d2('0xc'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0x1a')]);module[_0xd1d2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 06abf8f..adeedb6 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 _0x6a07=['TEXT','BOOLEAN','ENUM','out','STRING','INTEGER','DATE','Email','Chat','lodash','exports','long'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6a07,0x1ad));var _0x76a0=function(_0x49e454,_0x22328f){_0x49e454=_0x49e454-0x0;var _0x21d045=_0x6a07[_0x49e454];return _0x21d045;};'use strict';var Sequelize=require('sequelize');var _=require(_0x76a0('0x0'));module[_0x76a0('0x1')]={'body':{'type':Sequelize['TEXT'](_0x76a0('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x76a0('0x3')]('medium')},'read':{'type':Sequelize[_0x76a0('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x76a0('0x5')]('in',_0x76a0('0x6')),'defaultValue':_0x76a0('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x76a0('0x7')](0x1fe)},'from':{'type':Sequelize[_0x76a0('0x7')]},'to':{'type':Sequelize[_0x76a0('0x3')](_0x76a0('0x2'))},'cc':{'type':Sequelize[_0x76a0('0x3')](_0x76a0('0x2'))},'bcc':{'type':Sequelize[_0x76a0('0x3')](_0x76a0('0x2'))},'subject':{'type':Sequelize[_0x76a0('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x76a0('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x76a0('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x76a0('0x9')]},'originTo':{'type':Sequelize[_0x76a0('0x3')](_0x76a0('0x2'))},'originCc':{'type':Sequelize[_0x76a0('0x3')](_0x76a0('0x2'))},'originChannel':{'type':Sequelize[_0x76a0('0x5')](_0x76a0('0xa'),_0x76a0('0xb')),'defaultValue':_0x76a0('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xe6c3=['out','DATE','INTEGER','Email','lodash','TEXT','long','medium','ENUM'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xe6c3,0x8b));var _0x3e6c=function(_0x410e47,_0x52b364){_0x410e47=_0x410e47-0x0;var _0x385a9c=_0xe6c3[_0x410e47];return _0x385a9c;};'use strict';var Sequelize=require('sequelize');var _=require(_0x3e6c('0x0'));module['exports']={'body':{'type':Sequelize[_0x3e6c('0x1')](_0x3e6c('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3e6c('0x1')](_0x3e6c('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3e6c('0x4')]('in','out'),'defaultValue':_0x3e6c('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x3e6c('0x1')]('long')},'cc':{'type':Sequelize['TEXT'](_0x3e6c('0x2'))},'bcc':{'type':Sequelize[_0x3e6c('0x1')](_0x3e6c('0x2'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x3e6c('0x6')]},'attach':{'type':Sequelize[_0x3e6c('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x3e6c('0x1')](_0x3e6c('0x2'))},'originCc':{'type':Sequelize[_0x3e6c('0x1')]('long')},'originChannel':{'type':Sequelize[_0x3e6c('0x4')]('Email','Chat'),'defaultValue':_0x3e6c('0x8'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 003d481..827624a 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 _0xab61=['end','sendStatus','stack','name','index','MailMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','body','describe','create','direction','out','secret','findOne','MailAccountId','CmList','List','CmContact','Contacts','DESC','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','fromString','acceptmessage','reject','RejectMessage','EventManager','rejectmessage','download','toString','tmp','files','from','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','mail-interactions','redis','defaults','socket.io-emitter','./mailMessage.socket','register','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','undefined','count','offset','limit','set','Content-Range','json','update'];(function(_0x1e6db1,_0xb90700){var _0x55e924=function(_0x353c27){while(--_0x353c27){_0x1e6db1['push'](_0x1e6db1['shift']());}};_0x55e924(++_0xb90700);}(_0xab61,0x72));var _0x1ab6=function(_0x4deafb,_0x599d29){_0x4deafb=_0x4deafb-0x0;var _0x31e32f=_0xab61[_0x4deafb];return _0x31e32f;};'use strict';var emlformat=require(_0x1ab6('0x0'));var moment=require(_0x1ab6('0x1'));var BPromise=require(_0x1ab6('0x2'));var util=require('util');var path=require(_0x1ab6('0x3'));var fs=require('fs');var _=require(_0x1ab6('0x4'));var Redis=require(_0x1ab6('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x1ab6('0x6'));var logger=require(_0x1ab6('0x7'))(_0x1ab6('0x8'));var interaction_log=require(_0x1ab6('0x7'))(_0x1ab6('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x1ab6('0xa')]=_[_0x1ab6('0xb')](config[_0x1ab6('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ab6('0xc'))(new Redis(config[_0x1ab6('0xa')]));var htmlEntities=require('html-entities');require(_0x1ab6('0xd'))[_0x1ab6('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1ab6('0xf')]['http']({'port':0x232c});var client9003=jayson[_0x1ab6('0xf')][_0x1ab6('0x10')]({'port':0x232b});var client9002=jayson['client'][_0x1ab6('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x2d3cce,_0x346630,_0x1a654c,_0xcbf943){return new BPromise(function(_0x2f4a34,_0x3f3801){var _0x5357f7=_0xcbf943||client;return _0x5357f7[_0x1ab6('0x11')](_0x2d3cce,_0x1a654c)[_0x1ab6('0x12')](function(_0x240906){logger[_0x1ab6('0x13')](_0x1ab6('0x14'),_0x346630,_0x1ab6('0x15'));logger[_0x1ab6('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x346630,'request\x20sent',JSON[_0x1ab6('0x17')](_0x240906));if(_0x240906['error']){if(_0x240906[_0x1ab6('0x18')][_0x1ab6('0x19')]===0x1f4){logger[_0x1ab6('0x18')](_0x1ab6('0x14'),_0x346630,_0x240906[_0x1ab6('0x18')][_0x1ab6('0x1a')]);return _0x3f3801(_0x240906[_0x1ab6('0x18')][_0x1ab6('0x1a')]);}logger[_0x1ab6('0x18')]('MailMessage,\x20%s,\x20%s',_0x346630,_0x240906[_0x1ab6('0x18')][_0x1ab6('0x1a')]);return _0x2f4a34(_0x240906['error']['message']);}else{logger[_0x1ab6('0x13')](_0x1ab6('0x14'),_0x346630,_0x1ab6('0x15'));_0x2f4a34(_0x240906[_0x1ab6('0x1b')][_0x1ab6('0x1a')]);}})[_0x1ab6('0x1c')](function(_0x1cf778){logger[_0x1ab6('0x18')]('MailMessage,\x20%s,\x20%s',_0x346630,_0x1cf778);_0x3f3801(_0x1cf778);});});}function respondWithResult(_0x23192f,_0xb07517){_0xb07517=_0xb07517||0xc8;return function(_0x1278c5){if(_0x1278c5){return _0x23192f[_0x1ab6('0x1d')](_0xb07517)['json'](_0x1278c5);}};}function respondWithFilteredResult(_0x3127b4,_0x5bb60e){return function(_0x169ebe){if(_0x169ebe){var _0x432692=typeof _0x5bb60e['offset']===_0x1ab6('0x1e')&&typeof _0x5bb60e['limit']===_0x1ab6('0x1e');var _0x4238b6=_0x169ebe[_0x1ab6('0x1f')];var _0x2db8e8=_0x432692?0x0:_0x5bb60e[_0x1ab6('0x20')];var _0xd3a4b2=_0x432692?_0x169ebe[_0x1ab6('0x1f')]:_0x5bb60e[_0x1ab6('0x20')]+_0x5bb60e[_0x1ab6('0x21')];var _0x3804e9;if(_0xd3a4b2>=_0x4238b6){_0xd3a4b2=_0x4238b6;_0x3804e9=0xc8;}else{_0x3804e9=0xce;}_0x3127b4[_0x1ab6('0x1d')](_0x3804e9);return _0x3127b4[_0x1ab6('0x22')](_0x1ab6('0x23'),_0x2db8e8+'-'+_0xd3a4b2+'/'+_0x4238b6)[_0x1ab6('0x24')](_0x169ebe);}return null;};}function saveUpdates(_0x14f685){return function(_0x2e3091){if(_0x2e3091){return _0x2e3091[_0x1ab6('0x25')](_0x14f685)[_0x1ab6('0x12')](function(_0x1c5714){return _0x1c5714;});}return null;};}function removeEntity(_0x113606){return function(_0x3120dc){if(_0x3120dc){return _0x3120dc['destroy']()[_0x1ab6('0x12')](function(){_0x113606[_0x1ab6('0x1d')](0xcc)[_0x1ab6('0x26')]();});}};}function handleEntityNotFound(_0x42c50f){return function(_0x1ab130){if(!_0x1ab130){_0x42c50f[_0x1ab6('0x27')](0x194);}return _0x1ab130;};}function handleError(_0x3087cc,_0x47c9e6){_0x47c9e6=_0x47c9e6||0x1f4;return function(_0x265a66){logger[_0x1ab6('0x18')](_0x265a66[_0x1ab6('0x28')]);if(_0x265a66[_0x1ab6('0x29')]){delete _0x265a66[_0x1ab6('0x29')];}_0x3087cc[_0x1ab6('0x1d')](_0x47c9e6)['send'](_0x265a66);};}exports[_0x1ab6('0x2a')]=function(_0x55702c,_0x2358ad){var _0x456b85={},_0x4b146a={},_0x1d8221={'count':0x0,'rows':[]};var _0x54f179=_['map'](db[_0x1ab6('0x2b')][_0x1ab6('0x2c')],function(_0x2b6e76){return{'name':_0x2b6e76['fieldName'],'type':_0x2b6e76[_0x1ab6('0x2d')][_0x1ab6('0x2e')]};});_0x4b146a[_0x1ab6('0x2f')]=_[_0x1ab6('0x30')](_0x54f179,'name');_0x4b146a[_0x1ab6('0x31')]=_[_0x1ab6('0x32')](_0x55702c[_0x1ab6('0x31')]);_0x4b146a[_0x1ab6('0x33')]=_[_0x1ab6('0x34')](_0x4b146a['model'],_0x4b146a[_0x1ab6('0x31')]);_0x456b85['attributes']=_['intersection'](_0x4b146a['model'],qs['fields'](_0x55702c[_0x1ab6('0x31')][_0x1ab6('0x35')]));_0x456b85['attributes']=_0x456b85['attributes'][_0x1ab6('0x36')]?_0x456b85[_0x1ab6('0x37')]:_0x4b146a[_0x1ab6('0x2f')];if(!_0x55702c['query'][_0x1ab6('0x38')](_0x1ab6('0x39'))){_0x456b85[_0x1ab6('0x21')]=qs[_0x1ab6('0x21')](_0x55702c[_0x1ab6('0x31')]['limit']);_0x456b85['offset']=qs[_0x1ab6('0x20')](_0x55702c[_0x1ab6('0x31')][_0x1ab6('0x20')]);}_0x456b85[_0x1ab6('0x3a')]=qs[_0x1ab6('0x3b')](_0x55702c['query']['sort']);_0x456b85[_0x1ab6('0x3c')]=qs[_0x1ab6('0x33')](_[_0x1ab6('0x3d')](_0x55702c[_0x1ab6('0x31')],_0x4b146a['filters']),_0x54f179);if(_0x55702c[_0x1ab6('0x31')][_0x1ab6('0x3e')]){_0x456b85[_0x1ab6('0x3c')]=_[_0x1ab6('0x3f')](_0x456b85['where'],{'$or':_['map'](_0x54f179,function(_0x3d5fbf){if(_0x3d5fbf[_0x1ab6('0x2d')]!==_0x1ab6('0x40')){var _0x210e21={};_0x210e21[_0x3d5fbf['name']]={'$like':'%'+_0x55702c[_0x1ab6('0x31')][_0x1ab6('0x3e')]+'%'};return _0x210e21;}})});}_0x456b85=_[_0x1ab6('0x3f')]({},_0x456b85,_0x55702c[_0x1ab6('0x41')]);var _0x1c94b6={'where':_0x456b85[_0x1ab6('0x3c')]};return db['MailMessage'][_0x1ab6('0x1f')](_0x1c94b6)[_0x1ab6('0x12')](function(_0x266e73){_0x1d8221[_0x1ab6('0x1f')]=_0x266e73;if(_0x55702c[_0x1ab6('0x31')][_0x1ab6('0x42')]){_0x456b85[_0x1ab6('0x43')]=[{'all':!![]}];}return db[_0x1ab6('0x2b')][_0x1ab6('0x44')](_0x456b85);})[_0x1ab6('0x12')](function(_0x3010d5){_0x1d8221[_0x1ab6('0x45')]=_0x3010d5;return _0x1d8221;})[_0x1ab6('0x12')](respondWithFilteredResult(_0x2358ad,_0x456b85))[_0x1ab6('0x1c')](handleError(_0x2358ad,null));};exports[_0x1ab6('0x46')]=function(_0x355ab7,_0xef5946){var _0x2df090={'raw':!![],'where':{'id':_0x355ab7[_0x1ab6('0x47')]['id']}},_0x3d49a8={};_0x3d49a8[_0x1ab6('0x2f')]=_[_0x1ab6('0x32')](db[_0x1ab6('0x2b')][_0x1ab6('0x2c')]);_0x3d49a8['query']=_['keys'](_0x355ab7['query']);_0x3d49a8[_0x1ab6('0x33')]=_['intersection'](_0x3d49a8[_0x1ab6('0x2f')],_0x3d49a8[_0x1ab6('0x31')]);_0x2df090['attributes']=_[_0x1ab6('0x34')](_0x3d49a8['model'],qs[_0x1ab6('0x35')](_0x355ab7[_0x1ab6('0x31')][_0x1ab6('0x35')]));_0x2df090[_0x1ab6('0x37')]=_0x2df090[_0x1ab6('0x37')][_0x1ab6('0x36')]?_0x2df090[_0x1ab6('0x37')]:_0x3d49a8[_0x1ab6('0x2f')];if(_0x355ab7[_0x1ab6('0x31')][_0x1ab6('0x42')]){_0x2df090[_0x1ab6('0x43')]=[{'all':!![]}];}_0x2df090=_[_0x1ab6('0x3f')]({},_0x2df090,_0x355ab7['options']);return db[_0x1ab6('0x2b')][_0x1ab6('0x48')](_0x2df090)[_0x1ab6('0x12')](handleEntityNotFound(_0xef5946,null))[_0x1ab6('0x12')](respondWithResult(_0xef5946,null))[_0x1ab6('0x1c')](handleError(_0xef5946,null));};exports[_0x1ab6('0x25')]=function(_0x36ce9e,_0xbcd62){if(_0x36ce9e[_0x1ab6('0x49')]['id']){delete _0x36ce9e[_0x1ab6('0x49')]['id'];}return db[_0x1ab6('0x2b')]['find']({'where':{'id':_0x36ce9e[_0x1ab6('0x47')]['id']}})['then'](handleEntityNotFound(_0xbcd62,null))[_0x1ab6('0x12')](saveUpdates(_0x36ce9e[_0x1ab6('0x49')],null))['then'](respondWithResult(_0xbcd62,null))['catch'](handleError(_0xbcd62,null));};exports['destroy']=function(_0x1fa3bb,_0x723e81){return db['MailMessage'][_0x1ab6('0x48')]({'where':{'id':_0x1fa3bb[_0x1ab6('0x47')]['id']}})[_0x1ab6('0x12')](handleEntityNotFound(_0x723e81,null))[_0x1ab6('0x12')](removeEntity(_0x723e81,null))[_0x1ab6('0x1c')](handleError(_0x723e81,null));};exports[_0x1ab6('0x4a')]=function(_0x8b4cd5,_0xbca1e8){return db[_0x1ab6('0x2b')]['describe']()[_0x1ab6('0x12')](respondWithResult(_0xbca1e8,null))[_0x1ab6('0x1c')](handleError(_0xbca1e8,null));};exports[_0x1ab6('0x4b')]=function(_0x1d16aa,_0x42fe93){return db[_0x1ab6('0x2b')][_0x1ab6('0x4b')](_0x1d16aa[_0x1ab6('0x49')])['then'](function(_0x2d0193){if(_0x2d0193){if(_0x2d0193[_0x1ab6('0x4c')]===_0x1ab6('0x4d')&&!_0x2d0193[_0x1ab6('0x4e')]){var _0x4dc2af,_0x388adb,_0xb7758e;if(_0x1d16aa['body']['to']){_0x388adb=_0x1d16aa['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x1ab6('0x4f')]({'where':{'id':_0x2d0193[_0x1ab6('0x50')]},'include':[{'model':db[_0x1ab6('0x51')],'as':_0x1ab6('0x52'),'include':[{'model':db[_0x1ab6('0x53')],'as':_0x1ab6('0x54'),'where':{'email':_0x388adb},'limit':0x1,'order':[['updatedAt',_0x1ab6('0x55')]]}]},{'model':db['MailServerOut'],'as':_0x1ab6('0x56'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1ab6('0x57'),'raw':!![]}]}]})[_0x1ab6('0x12')](function(_0x3de0b1){_0x4dc2af=_0x3de0b1;if(!_0x4dc2af||!_0x4dc2af[_0x1ab6('0x56')])return;var _0x18e833=_0x4dc2af[_0x1ab6('0x58')]();if(_0x1d16aa[_0x1ab6('0x49')][_0x1ab6('0x59')]&&_0x1d16aa['body'][_0x1ab6('0x59')]['length']){for(var _0xb56df9=0x0;_0xb56df9<_0x1d16aa[_0x1ab6('0x49')][_0x1ab6('0x59')]['length'];_0xb56df9+=0x1){_0x1d16aa['body'][_0x1ab6('0x59')][_0xb56df9]={'filename':_0x1d16aa[_0x1ab6('0x49')]['attachments'][_0xb56df9]['name'],'path':path[_0x1ab6('0x5a')](config[_0x1ab6('0x5b')],_0x1ab6('0x5c'),_0x1d16aa[_0x1ab6('0x49')][_0x1ab6('0x59')][_0xb56df9][_0x1ab6('0x5d')])};}}_0xb7758e={'account':_0x18e833,'message':_0x1d16aa[_0x1ab6('0x49')]};return;})[_0x1ab6('0x12')](function(){if(_0x4dc2af[_0x1ab6('0x52')]){if(_0x4dc2af['List'][_0x1ab6('0x54')][_0x1ab6('0x36')]){return _0x4dc2af[_0x1ab6('0x52')][_0x1ab6('0x54')][0x0];}else{return db[_0x1ab6('0x53')][_0x1ab6('0x4b')](_[_0x1ab6('0xb')](_0x1d16aa[_0x1ab6('0x49')],{'firstName':_0x1d16aa[_0x1ab6('0x49')]['to'],'email':_0x1d16aa[_0x1ab6('0x49')]['to'],'phone':_0x1d16aa['body']['to'],'ListId':_0x4dc2af['ListId']}));}}else{throw new Error(_0x1ab6('0x5e'));}})[_0x1ab6('0x12')](function(){if(_0xb7758e){return respondWithRpcPromise(_0x1ab6('0x5f'),_0x1ab6('0x60'),_0xb7758e,client9003)[_0x1ab6('0x12')](function(_0x3b76dd){return _0x2d0193['update']({'read':!![],'messageId':_0x3b76dd['messageId'],'sentAt':moment()[_0x1ab6('0x61')](_0x1ab6('0x62'))});})[_0x1ab6('0x1c')](function(_0x39cf3c){logger[_0x1ab6('0x18')]('%s',JSON[_0x1ab6('0x17')](_0x39cf3c));return _0x2d0193;});}return _0x2d0193;});}return _0x2d0193;}})[_0x1ab6('0x12')](respondWithResult(_0x42fe93,0xc9))[_0x1ab6('0x1c')](handleError(_0x42fe93,null));};exports[_0x1ab6('0x63')]=function(_0x52797a,_0xb7f7ea){var _0x4c61ea={'agent':{},'channel':_0x1ab6('0x64')};if(_0x52797a[_0x1ab6('0x49')]['id']){delete _0x52797a['body']['id'];}_0x52797a[_0x1ab6('0x49')][_0x1ab6('0x65')]=!![];_0x52797a[_0x1ab6('0x49')][_0x1ab6('0x66')]=moment()['format'](_0x1ab6('0x62'));_0x52797a[_0x1ab6('0x49')][_0x1ab6('0x67')]=_0x52797a[_0x1ab6('0x49')][_0x1ab6('0x67')]||_0x52797a['user']['id'];_0x4c61ea[_0x1ab6('0x68')]['id']=_0x52797a[_0x1ab6('0x49')][_0x1ab6('0x67')];return db[_0x1ab6('0x2b')]['find']({'where':{'id':_0x52797a[_0x1ab6('0x47')]['id'],'UserId':null}})[_0x1ab6('0x12')](handleEntityNotFound(_0xb7f7ea,null))['then'](saveUpdates(_0x52797a['body'],null))[_0x1ab6('0x12')](function(_0x219ba9){if(_0x219ba9){_0x4c61ea[_0x1ab6('0x1a')]=_0x219ba9[_0x1ab6('0x69')]({'plain':!![]});return db[_0x1ab6('0x6a')][_0x1ab6('0x48')]({'where':{'id':_0x219ba9[_0x1ab6('0x6b')]}});}return null;})[_0x1ab6('0x12')](handleEntityNotFound(_0xb7f7ea,null))['then'](function(_0x2dc863){if(_0x2dc863){return _0x2dc863[_0x1ab6('0x25')]({'UserId':_0x52797a[_0x1ab6('0x49')][_0x1ab6('0x67')],'read1stAt':_['isNil'](_0x2dc863['read1stAt'])?moment()[_0x1ab6('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1ab6('0x12')](function(_0x51ae2f){if(_0x51ae2f){_0x4c61ea[_0x1ab6('0x6c')]=_0x51ae2f[_0x1ab6('0x69')]({'plain':!![]});interaction_log[_0x1ab6('0x13')](_0x1ab6('0x6d'),_0x52797a['user']['id'],_0x52797a[_0x1ab6('0x6e')][_0x1ab6('0x29')],_0x52797a[_0x1ab6('0x6e')][_0x1ab6('0x6f')],_0x4c61ea[_0x1ab6('0x6c')]['id'],_0x52797a['body']?JSON[_0x1ab6('0x17')](_0x52797a[_0x1ab6('0x49')]):_0x1ab6('0x70'));return respondWithRpcPromise(_0x1ab6('0x71'),'acceptMessage',_0x4c61ea);}return null;})['then'](function(_0x265805){var _0x2f167f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x265805[_0x1ab6('0x1a')][_0x1ab6('0x72')];return db[_0x1ab6('0x73')][_0x1ab6('0x31')](_0x2f167f,{'type':db[_0x1ab6('0x74')][_0x1ab6('0x75')][_0x1ab6('0x76')],'raw':!![]})[_0x1ab6('0x12')](function(_0x4393f1){return _0x4393f1;});})[_0x1ab6('0x12')](function(_0xee9654){if(_0xee9654){_0x4c61ea[_0x1ab6('0x1a')][_0x1ab6('0x77')]=_0xee9654[0x0];if(!_0x52797a[_0x1ab6('0x49')][_0x1ab6('0x67')])return;return db[_0x1ab6('0x78')][_0x1ab6('0x48')]({'where':{'id':_0x52797a[_0x1ab6('0x49')]['UserId'],'role':_0x1ab6('0x68')},'attributes':['id',_0x1ab6('0x29'),_0x1ab6('0x79'),_0x1ab6('0x7a'),_0x1ab6('0x7b')],'raw':!![]});}return null;})[_0x1ab6('0x12')](function(_0x540ef9){if(!_0x540ef9)return null;_0x4c61ea[_0x1ab6('0x1a')][_0x1ab6('0x68')]=_0x540ef9;return _0x4c61ea;})['then'](function(_0x4a7935){if(_0x4a7935){if(_0x52797a[_0x1ab6('0x49')]['manual']){_0x4c61ea[_0x1ab6('0x1a')][_0x1ab6('0x7c')]=util[_0x1ab6('0x61')](_0x1ab6('0x7d'),_0x52797a[_0x1ab6('0x6e')][_0x1ab6('0x29')]);_0x4c61ea[_0x1ab6('0x1a')][_0x1ab6('0x7e')]=_0x4c61ea['channel'];_0x4c61ea[_0x1ab6('0x1a')][_0x1ab6('0x7f')]=_0x4c61ea['channel'];_0x4c61ea['message'][_0x1ab6('0x80')]=_0x1ab6('0x63');_0x4c61ea[_0x1ab6('0x1a')][_0x1ab6('0x49')]=htmlToText[_0x1ab6('0x81')](_0x4c61ea['message']['body']);return respondWithRpcPromise('EventManager','EventManager',{'event':_0x1ab6('0x82'),'message':_0x4c61ea[_0x1ab6('0x1a')]},client9002)[_0x1ab6('0x12')](function(){return _0x4c61ea;});}return _0x4c61ea;}return null;})[_0x1ab6('0x12')](respondWithResult(_0xb7f7ea,null))[_0x1ab6('0x1c')](handleError(_0xb7f7ea,null));};exports[_0x1ab6('0x83')]=function(_0x48d105,_0x5e6b4a){var _0x2cb233={'agent':{},'channel':_0x1ab6('0x64')};if(_0x48d105['body']['id']){delete _0x48d105[_0x1ab6('0x49')]['id'];}_0x48d105[_0x1ab6('0x49')][_0x1ab6('0x67')]=_0x48d105[_0x1ab6('0x49')][_0x1ab6('0x67')]||_0x48d105[_0x1ab6('0x6e')]['id'];_0x2cb233[_0x1ab6('0x68')]['id']=_0x48d105[_0x1ab6('0x49')][_0x1ab6('0x67')];return db[_0x1ab6('0x2b')][_0x1ab6('0x48')]({'where':{'id':_0x48d105[_0x1ab6('0x47')]['id'],'UserId':null}})[_0x1ab6('0x12')](handleEntityNotFound(_0x5e6b4a,null))[_0x1ab6('0x12')](function(_0x3065f1){if(_0x3065f1){_0x2cb233[_0x1ab6('0x1a')]=_0x3065f1[_0x1ab6('0x69')]({'plain':!![]});return db['MailInteraction'][_0x1ab6('0x48')]({'where':{'id':_0x3065f1[_0x1ab6('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x5e6b4a,null))[_0x1ab6('0x12')](function(_0x429513){if(_0x429513){_0x2cb233[_0x1ab6('0x6c')]=_0x429513[_0x1ab6('0x69')]({'plain':!![]});interaction_log[_0x1ab6('0x13')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x48d105['user']['id'],_0x48d105[_0x1ab6('0x6e')][_0x1ab6('0x29')],_0x48d105[_0x1ab6('0x6e')][_0x1ab6('0x6f')],_0x2cb233['interaction']['id'],_0x48d105[_0x1ab6('0x49')]?JSON[_0x1ab6('0x17')](_0x48d105[_0x1ab6('0x49')]):_0x1ab6('0x70'));return respondWithRpcPromise(_0x1ab6('0x84'),'rejectMessage',_0x2cb233);}return null;})[_0x1ab6('0x12')](function(_0x219585){var _0x90f2c5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x219585[_0x1ab6('0x1a')][_0x1ab6('0x72')];return db[_0x1ab6('0x73')][_0x1ab6('0x31')](_0x90f2c5,{'type':db['Sequelize'][_0x1ab6('0x75')][_0x1ab6('0x76')],'raw':!![]})[_0x1ab6('0x12')](function(_0x5bf6ac){return _0x5bf6ac;});})['then'](function(_0x34aa03){if(_0x34aa03){_0x2cb233[_0x1ab6('0x1a')][_0x1ab6('0x77')]=_0x34aa03[0x0];if(!_0x48d105[_0x1ab6('0x49')][_0x1ab6('0x67')])return;return db[_0x1ab6('0x78')][_0x1ab6('0x48')]({'where':{'id':_0x48d105[_0x1ab6('0x49')]['UserId'],'role':'agent'},'attributes':['id',_0x1ab6('0x29'),_0x1ab6('0x79'),_0x1ab6('0x7a'),_0x1ab6('0x7b')],'raw':!![]});}return null;})[_0x1ab6('0x12')](function(_0x40b24c){if(!_0x40b24c)return null;_0x2cb233['message'][_0x1ab6('0x68')]=_0x40b24c;return _0x2cb233;})[_0x1ab6('0x12')](function(_0x5288d6){if(_0x5288d6){_0x5288d6[_0x1ab6('0x1a')]['interface']=util['format'](_0x1ab6('0x7d'),_0x48d105[_0x1ab6('0x6e')][_0x1ab6('0x29')]);_0x5288d6[_0x1ab6('0x1a')]['channel']=_0x2cb233[_0x1ab6('0x7e')];_0x5288d6[_0x1ab6('0x1a')][_0x1ab6('0x7f')]=_0x2cb233[_0x1ab6('0x7e')];_0x5288d6[_0x1ab6('0x1a')][_0x1ab6('0x80')]='reject';_0x5288d6[_0x1ab6('0x1a')][_0x1ab6('0x49')]=htmlToText['fromString'](_0x2cb233[_0x1ab6('0x1a')][_0x1ab6('0x49')]);respondWithRpcPromise(_0x1ab6('0x85'),_0x1ab6('0x85'),{'event':_0x1ab6('0x86'),'message':_0x5288d6[_0x1ab6('0x1a')]},client9002);return _0x2cb233;}return null;})[_0x1ab6('0x12')](respondWithResult(_0x5e6b4a,null))[_0x1ab6('0x1c')](handleError(_0x5e6b4a,null));};exports[_0x1ab6('0x87')]=function(_0x7a66af,_0x23f556){var _0x561abb=moment()['unix']()[_0x1ab6('0x88')]();var _0x257be8=path[_0x1ab6('0x5a')](config[_0x1ab6('0x5b')],'server','files',_0x1ab6('0x89'));var _0x53f8a3=path[_0x1ab6('0x5a')](config[_0x1ab6('0x5b')],'server',_0x1ab6('0x8a'),_0x1ab6('0x59'));var _0x49352e=util[_0x1ab6('0x61')]('message-%s.eml',_0x561abb);return db[_0x1ab6('0x2b')][_0x1ab6('0x48')]({'where':{'id':_0x7a66af[_0x1ab6('0x47')]['id']},'attributes':['id',_0x1ab6('0x49'),_0x1ab6('0x8b'),'to','cc','bcc',_0x1ab6('0x8c'),_0x1ab6('0x8d')],'include':_0x7a66af['query'][_0x1ab6('0x59')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x23f556,null))['then'](function(_0x3147c9){if(_0x3147c9){var _0x4c4735=_0x3147c9;var _0x4309a4={'from':_0x4c4735[_0x1ab6('0x8b')],'to':_0x4c4735['to'],'subject':_0x4c4735[_0x1ab6('0x8c')],'html':htmlEntities['decode'](_0x4c4735[_0x1ab6('0x49')]),'headers':{'Date':moment(_0x4c4735[_0x1ab6('0x8d')])[_0x1ab6('0x61')](_0x1ab6('0x8e'))},'attachments':[]};if(_0x3147c9['cc']){_0x4309a4[_0x1ab6('0x8f')]['Cc']=_0x3147c9['cc'];}if(_0x3147c9[_0x1ab6('0x90')]){_0x4309a4[_0x1ab6('0x8f')]['Bcc']=_0x3147c9['bcc'];}return new BPromise(function(_0x2a307c,_0x2c0f73){if(_0x3147c9[_0x1ab6('0x91')]){for(var _0x37a02a=0x0;_0x37a02a<_0x3147c9[_0x1ab6('0x91')][_0x1ab6('0x36')];_0x37a02a++){var _0x485d7c=_0x3147c9['Attachments'][_0x37a02a];var _0x42630f=path[_0x1ab6('0x5a')](_0x53f8a3,_0x485d7c[_0x1ab6('0x5d')]);if(fs[_0x1ab6('0x92')](_0x42630f)){_0x4309a4[_0x1ab6('0x59')][_0x1ab6('0x93')]({'name':_0x485d7c[_0x1ab6('0x29')],'contentType':_0x485d7c[_0x1ab6('0x2d')],'data':fs[_0x1ab6('0x94')](_0x42630f)});}}}emlformat[_0x1ab6('0x95')](_0x4309a4,function(_0x320d13,_0x4b47b4){if(_0x320d13)return _0x2c0f73(_0x320d13);fs[_0x1ab6('0x96')](path[_0x1ab6('0x5a')](_0x257be8,_0x49352e),_0x4b47b4);return _0x2a307c(_0x4b47b4);});});}})[_0x1ab6('0x12')](function(_0xa272f2){if(_0xa272f2){return _0x23f556[_0x1ab6('0x87')](path[_0x1ab6('0x5a')](_0x257be8,_0x49352e),_0x49352e,function(_0x6c38ea){if(!_0x6c38ea)fs[_0x1ab6('0x97')](path[_0x1ab6('0x5a')](_0x257be8,_0x49352e));});}})[_0x1ab6('0x1c')](handleError(_0x23f556,null));}; \ No newline at end of file +var _0x669e=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','VIRTUAL','filter','merge','MailMessage','includeAll','rows','show','params','options','find','body','describe','create','direction','out','secret','split','MailAccountId','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','basename','CmContact','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','mail','rejectMessage','motionChannel','event','rejectmessage','download','toString','server','files','tmp','join','message-%s.eml','from','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Attachments','push','readFileSync','writeFileSync','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map'];(function(_0x48c64f,_0x2bc228){var _0x15e8df=function(_0x403a39){while(--_0x403a39){_0x48c64f['push'](_0x48c64f['shift']());}};_0x15e8df(++_0x2bc228);}(_0x669e,0x70));var _0xe669=function(_0xfa7903,_0x1743fe){_0xfa7903=_0xfa7903-0x0;var _0x2d0d8a=_0x669e[_0xfa7903];return _0x2d0d8a;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0xe669('0x0'));var util=require(_0xe669('0x1'));var path=require(_0xe669('0x2'));var fs=require('fs');var _=require(_0xe669('0x3'));var Redis=require(_0xe669('0x4'));var htmlToText=require('html-to-text');var qs=require(_0xe669('0x5'));var logger=require('../../config/logger')(_0xe669('0x6'));var interaction_log=require('../../config/logger')(_0xe669('0x7'));var config=require(_0xe669('0x8'));var db=require(_0xe669('0x9'))['db'];config[_0xe669('0xa')]=_['defaults'](config['redis'],{'host':_0xe669('0xb'),'port':0x18eb});var socket=require(_0xe669('0xc'))(new Redis(config[_0xe669('0xa')]));var htmlEntities=require(_0xe669('0xd'));require(_0xe669('0xe'))[_0xe669('0xf')](socket);var jayson=require(_0xe669('0x10'));var client=jayson[_0xe669('0x11')]['http']({'port':0x232c});var client9003=jayson[_0xe669('0x11')][_0xe669('0x12')]({'port':0x232b});var client9002=jayson['client'][_0xe669('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x140688,_0x303db0,_0xe2f171,_0x1f6990){return new BPromise(function(_0x31aaef,_0x55c439){var _0x5b5116=_0x1f6990||client;return _0x5b5116[_0xe669('0x13')](_0x140688,_0xe2f171)[_0xe669('0x14')](function(_0x4806f9){logger[_0xe669('0x15')]('MailMessage,\x20%s,\x20%s',_0x303db0,_0xe669('0x16'));logger[_0xe669('0x17')](_0xe669('0x18'),_0x303db0,_0xe669('0x16'),JSON[_0xe669('0x19')](_0x4806f9));if(_0x4806f9[_0xe669('0x1a')]){if(_0x4806f9[_0xe669('0x1a')][_0xe669('0x1b')]===0x1f4){logger['error'](_0xe669('0x1c'),_0x303db0,_0x4806f9[_0xe669('0x1a')]['message']);return _0x55c439(_0x4806f9['error'][_0xe669('0x1d')]);}logger[_0xe669('0x1a')](_0xe669('0x1c'),_0x303db0,_0x4806f9['error']['message']);return _0x31aaef(_0x4806f9[_0xe669('0x1a')][_0xe669('0x1d')]);}else{logger[_0xe669('0x15')]('MailMessage,\x20%s,\x20%s',_0x303db0,'request\x20sent');_0x31aaef(_0x4806f9['result'][_0xe669('0x1d')]);}})[_0xe669('0x1e')](function(_0x1f8a2c){logger[_0xe669('0x1a')](_0xe669('0x1c'),_0x303db0,_0x1f8a2c);_0x55c439(_0x1f8a2c);});});}function respondWithResult(_0x2f684c,_0x275901){_0x275901=_0x275901||0xc8;return function(_0x446025){if(_0x446025){return _0x2f684c[_0xe669('0x1f')](_0x275901)[_0xe669('0x20')](_0x446025);}};}function respondWithFilteredResult(_0x44dd7a,_0x46f732){return function(_0xfa1da9){if(_0xfa1da9){var _0x3e0aba=typeof _0x46f732['offset']===_0xe669('0x21')&&typeof _0x46f732['limit']===_0xe669('0x21');var _0x47bc41=_0xfa1da9[_0xe669('0x22')];var _0x17221a=_0x3e0aba?0x0:_0x46f732[_0xe669('0x23')];var _0xb8e487=_0x3e0aba?_0xfa1da9['count']:_0x46f732['offset']+_0x46f732[_0xe669('0x24')];var _0x2e4b9a;if(_0xb8e487>=_0x47bc41){_0xb8e487=_0x47bc41;_0x2e4b9a=0xc8;}else{_0x2e4b9a=0xce;}_0x44dd7a[_0xe669('0x1f')](_0x2e4b9a);return _0x44dd7a[_0xe669('0x25')](_0xe669('0x26'),_0x17221a+'-'+_0xb8e487+'/'+_0x47bc41)[_0xe669('0x20')](_0xfa1da9);}return null;};}function saveUpdates(_0x2487f7){return function(_0x6b0bd1){if(_0x6b0bd1){return _0x6b0bd1[_0xe669('0x27')](_0x2487f7)[_0xe669('0x14')](function(_0x4c2b51){return _0x4c2b51;});}return null;};}function removeEntity(_0x470eff){return function(_0x13a1d5){if(_0x13a1d5){return _0x13a1d5[_0xe669('0x28')]()[_0xe669('0x14')](function(){_0x470eff[_0xe669('0x1f')](0xcc)[_0xe669('0x29')]();});}};}function handleEntityNotFound(_0x43472c){return function(_0x45ecf3){if(!_0x45ecf3){_0x43472c[_0xe669('0x2a')](0x194);}return _0x45ecf3;};}function handleError(_0x80b419,_0xa27a46){_0xa27a46=_0xa27a46||0x1f4;return function(_0x5419d4){logger[_0xe669('0x1a')](_0x5419d4[_0xe669('0x2b')]);if(_0x5419d4['name']){delete _0x5419d4[_0xe669('0x2c')];}_0x80b419['status'](_0xa27a46)['send'](_0x5419d4);};}exports[_0xe669('0x2d')]=function(_0x17b3c3,_0x25bd2d){var _0x3f3a09={},_0x940c57={},_0x2e3248={'count':0x0,'rows':[]};var _0x2c9126=_[_0xe669('0x2e')](db['MailMessage'][_0xe669('0x2f')],function(_0x5442c7){return{'name':_0x5442c7[_0xe669('0x30')],'type':_0x5442c7[_0xe669('0x31')][_0xe669('0x32')]};});_0x940c57[_0xe669('0x33')]=_[_0xe669('0x2e')](_0x2c9126,'name');_0x940c57[_0xe669('0x34')]=_[_0xe669('0x35')](_0x17b3c3['query']);_0x940c57['filters']=_[_0xe669('0x36')](_0x940c57['model'],_0x940c57[_0xe669('0x34')]);_0x3f3a09[_0xe669('0x37')]=_[_0xe669('0x36')](_0x940c57[_0xe669('0x33')],qs[_0xe669('0x38')](_0x17b3c3['query']['fields']));_0x3f3a09['attributes']=_0x3f3a09[_0xe669('0x37')][_0xe669('0x39')]?_0x3f3a09[_0xe669('0x37')]:_0x940c57[_0xe669('0x33')];if(!_0x17b3c3['query'][_0xe669('0x3a')](_0xe669('0x3b'))){_0x3f3a09['limit']=qs[_0xe669('0x24')](_0x17b3c3[_0xe669('0x34')][_0xe669('0x24')]);_0x3f3a09['offset']=qs['offset'](_0x17b3c3[_0xe669('0x34')][_0xe669('0x23')]);}_0x3f3a09['order']=qs[_0xe669('0x3c')](_0x17b3c3[_0xe669('0x34')][_0xe669('0x3c')]);_0x3f3a09['where']=qs[_0xe669('0x3d')](_[_0xe669('0x3e')](_0x17b3c3[_0xe669('0x34')],_0x940c57[_0xe669('0x3d')]),_0x2c9126);if(_0x17b3c3['query']['filter']){_0x3f3a09[_0xe669('0x3f')]=_['merge'](_0x3f3a09[_0xe669('0x3f')],{'$or':_[_0xe669('0x2e')](_0x2c9126,function(_0x7a54a5){if(_0x7a54a5[_0xe669('0x31')]!==_0xe669('0x40')){var _0x4796db={};_0x4796db[_0x7a54a5[_0xe669('0x2c')]]={'$like':'%'+_0x17b3c3[_0xe669('0x34')][_0xe669('0x41')]+'%'};return _0x4796db;}})});}_0x3f3a09=_[_0xe669('0x42')]({},_0x3f3a09,_0x17b3c3['options']);var _0x455b0b={'where':_0x3f3a09[_0xe669('0x3f')]};return db[_0xe669('0x43')][_0xe669('0x22')](_0x455b0b)['then'](function(_0x302785){_0x2e3248[_0xe669('0x22')]=_0x302785;if(_0x17b3c3[_0xe669('0x34')][_0xe669('0x44')]){_0x3f3a09['include']=[{'all':!![]}];}return db[_0xe669('0x43')]['findAll'](_0x3f3a09);})[_0xe669('0x14')](function(_0x264736){_0x2e3248[_0xe669('0x45')]=_0x264736;return _0x2e3248;})[_0xe669('0x14')](respondWithFilteredResult(_0x25bd2d,_0x3f3a09))[_0xe669('0x1e')](handleError(_0x25bd2d,null));};exports[_0xe669('0x46')]=function(_0x1fa48a,_0x46dd10){var _0x20ffc7={'raw':!![],'where':{'id':_0x1fa48a[_0xe669('0x47')]['id']}},_0x20dfd4={};_0x20dfd4[_0xe669('0x33')]=_[_0xe669('0x35')](db[_0xe669('0x43')]['rawAttributes']);_0x20dfd4['query']=_['keys'](_0x1fa48a[_0xe669('0x34')]);_0x20dfd4[_0xe669('0x3d')]=_[_0xe669('0x36')](_0x20dfd4[_0xe669('0x33')],_0x20dfd4[_0xe669('0x34')]);_0x20ffc7[_0xe669('0x37')]=_[_0xe669('0x36')](_0x20dfd4[_0xe669('0x33')],qs[_0xe669('0x38')](_0x1fa48a[_0xe669('0x34')][_0xe669('0x38')]));_0x20ffc7['attributes']=_0x20ffc7[_0xe669('0x37')][_0xe669('0x39')]?_0x20ffc7[_0xe669('0x37')]:_0x20dfd4['model'];if(_0x1fa48a[_0xe669('0x34')][_0xe669('0x44')]){_0x20ffc7['include']=[{'all':!![]}];}_0x20ffc7=_['merge']({},_0x20ffc7,_0x1fa48a[_0xe669('0x48')]);return db['MailMessage'][_0xe669('0x49')](_0x20ffc7)[_0xe669('0x14')](handleEntityNotFound(_0x46dd10,null))[_0xe669('0x14')](respondWithResult(_0x46dd10,null))[_0xe669('0x1e')](handleError(_0x46dd10,null));};exports['update']=function(_0x2970e1,_0x5a97cc){if(_0x2970e1[_0xe669('0x4a')]['id']){delete _0x2970e1[_0xe669('0x4a')]['id'];}return db['MailMessage'][_0xe669('0x49')]({'where':{'id':_0x2970e1[_0xe669('0x47')]['id']}})[_0xe669('0x14')](handleEntityNotFound(_0x5a97cc,null))[_0xe669('0x14')](saveUpdates(_0x2970e1[_0xe669('0x4a')],null))[_0xe669('0x14')](respondWithResult(_0x5a97cc,null))[_0xe669('0x1e')](handleError(_0x5a97cc,null));};exports[_0xe669('0x28')]=function(_0x4d1b09,_0x55d526){return db['MailMessage'][_0xe669('0x49')]({'where':{'id':_0x4d1b09[_0xe669('0x47')]['id']}})['then'](handleEntityNotFound(_0x55d526,null))[_0xe669('0x14')](removeEntity(_0x55d526,null))[_0xe669('0x1e')](handleError(_0x55d526,null));};exports[_0xe669('0x4b')]=function(_0x4b7e96,_0x239878){return db[_0xe669('0x43')][_0xe669('0x4b')]()[_0xe669('0x14')](respondWithResult(_0x239878,null))[_0xe669('0x1e')](handleError(_0x239878,null));};exports[_0xe669('0x4c')]=function(_0x3f700f,_0x3dccab){return db[_0xe669('0x43')][_0xe669('0x4c')](_0x3f700f[_0xe669('0x4a')])[_0xe669('0x14')](function(_0x175468){if(_0x175468){if(_0x175468[_0xe669('0x4d')]===_0xe669('0x4e')&&!_0x175468[_0xe669('0x4f')]){var _0x34153c,_0x37d25a,_0x3b963b;if(_0x3f700f[_0xe669('0x4a')]['to']){_0x37d25a=_0x3f700f[_0xe669('0x4a')]['to'][_0xe669('0x50')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x175468[_0xe669('0x51')]},'include':[{'model':db['CmList'],'as':_0xe669('0x52'),'include':[{'model':db['CmContact'],'as':_0xe669('0x53'),'where':{'email':_0x37d25a},'limit':0x1,'order':[[_0xe669('0x54'),_0xe669('0x55')]]}]},{'model':db[_0xe669('0x56')],'as':_0xe669('0x57'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe669('0x58'),'raw':!![]}]}]})[_0xe669('0x14')](function(_0x50a0cb){_0x34153c=_0x50a0cb;if(!_0x34153c||!_0x34153c['Smtp'])return;var _0x4e2fff=_0x34153c[_0xe669('0x59')]();if(_0x3f700f['body']['attachments']&&_0x3f700f[_0xe669('0x4a')][_0xe669('0x5a')]['length']){for(var _0x20e1aa=0x0;_0x20e1aa<_0x3f700f[_0xe669('0x4a')][_0xe669('0x5a')]['length'];_0x20e1aa+=0x1){_0x3f700f[_0xe669('0x4a')]['attachments'][_0x20e1aa]={'filename':_0x3f700f['body'][_0xe669('0x5a')][_0x20e1aa][_0xe669('0x2c')],'path':path['join'](config[_0xe669('0x5b')],_0xe669('0x5c'),_0x3f700f['body'][_0xe669('0x5a')][_0x20e1aa][_0xe669('0x5d')])};}}_0x3b963b={'account':_0x4e2fff,'message':_0x3f700f[_0xe669('0x4a')]};return;})['then'](function(){if(_0x34153c[_0xe669('0x52')]){if(_0x34153c[_0xe669('0x52')][_0xe669('0x53')][_0xe669('0x39')]){return _0x34153c[_0xe669('0x52')][_0xe669('0x53')][0x0];}else{return db[_0xe669('0x5e')][_0xe669('0x4c')](_[_0xe669('0x5f')](_0x3f700f[_0xe669('0x4a')],{'firstName':_0x3f700f['body']['to'],'email':_0x3f700f[_0xe669('0x4a')]['to'],'phone':_0x3f700f[_0xe669('0x4a')]['to'],'ListId':_0x34153c[_0xe669('0x60')]}));}}else{throw new Error(_0xe669('0x61'));}})[_0xe669('0x14')](function(){if(_0x3b963b){return respondWithRpcPromise(_0xe669('0x62'),_0xe669('0x63'),_0x3b963b,client9003)[_0xe669('0x14')](function(_0x5a7259){return _0x175468['update']({'read':!![],'messageId':_0x5a7259[_0xe669('0x64')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x4192f5){logger['error']('%s',JSON['stringify'](_0x4192f5));return _0x175468;});}return _0x175468;});}return _0x175468;}})[_0xe669('0x14')](respondWithResult(_0x3dccab,0xc9))['catch'](handleError(_0x3dccab,null));};exports[_0xe669('0x65')]=function(_0x287342,_0x18a57c){var _0x5ed40b={'agent':{},'channel':'mail'};if(_0x287342[_0xe669('0x4a')]['id']){delete _0x287342[_0xe669('0x4a')]['id'];}_0x287342['body'][_0xe669('0x66')]=!![];_0x287342[_0xe669('0x4a')][_0xe669('0x67')]=moment()[_0xe669('0x68')](_0xe669('0x69'));_0x287342[_0xe669('0x4a')][_0xe669('0x6a')]=_0x287342[_0xe669('0x4a')]['UserId']||_0x287342[_0xe669('0x6b')]['id'];_0x5ed40b[_0xe669('0x6c')]['id']=_0x287342[_0xe669('0x4a')]['UserId'];return db[_0xe669('0x43')][_0xe669('0x49')]({'where':{'id':_0x287342[_0xe669('0x47')]['id'],'UserId':null}})[_0xe669('0x14')](handleEntityNotFound(_0x18a57c,null))[_0xe669('0x14')](saveUpdates(_0x287342[_0xe669('0x4a')],null))['then'](function(_0x20ab71){if(_0x20ab71){_0x5ed40b[_0xe669('0x1d')]=_0x20ab71[_0xe669('0x6d')]({'plain':!![]});return db[_0xe669('0x6e')][_0xe669('0x49')]({'where':{'id':_0x20ab71[_0xe669('0x6f')]}});}return null;})[_0xe669('0x14')](handleEntityNotFound(_0x18a57c,null))[_0xe669('0x14')](function(_0x539b7a){if(_0x539b7a){return _0x539b7a[_0xe669('0x27')]({'UserId':_0x287342[_0xe669('0x4a')][_0xe669('0x6a')],'read1stAt':_[_0xe669('0x70')](_0x539b7a[_0xe669('0x71')])?moment()[_0xe669('0x68')](_0xe669('0x69')):undefined});}return null;})[_0xe669('0x14')](function(_0x1ffb28){if(_0x1ffb28){_0x5ed40b[_0xe669('0x72')]=_0x1ffb28['get']({'plain':!![]});interaction_log[_0xe669('0x15')](_0xe669('0x73'),_0x287342[_0xe669('0x6b')]['id'],_0x287342[_0xe669('0x6b')][_0xe669('0x2c')],_0x287342[_0xe669('0x6b')][_0xe669('0x74')],_0x5ed40b[_0xe669('0x72')]['id'],_0x287342[_0xe669('0x4a')]?JSON[_0xe669('0x19')](_0x287342[_0xe669('0x4a')]):'null');return respondWithRpcPromise(_0xe669('0x75'),_0xe669('0x76'),_0x5ed40b);}return null;})[_0xe669('0x14')](function(_0x3a5dfb){var _0x3669e1=_0xe669('0x77')+_0x3a5dfb[_0xe669('0x1d')][_0xe669('0x78')];return db[_0xe669('0x79')][_0xe669('0x34')](_0x3669e1,{'type':db['Sequelize'][_0xe669('0x7a')][_0xe669('0x7b')],'raw':!![]})[_0xe669('0x14')](function(_0x1fd450){return _0x1fd450;});})['then'](function(_0x16d7b8){if(_0x16d7b8){_0x5ed40b[_0xe669('0x1d')][_0xe669('0x7c')]=_0x16d7b8[0x0];if(!_0x287342[_0xe669('0x4a')][_0xe669('0x6a')])return;return db[_0xe669('0x7d')][_0xe669('0x49')]({'where':{'id':_0x287342[_0xe669('0x4a')][_0xe669('0x6a')],'role':_0xe669('0x6c')},'attributes':['id',_0xe669('0x2c'),_0xe669('0x7e'),'email',_0xe669('0x7f')],'raw':!![]});}return null;})['then'](function(_0x623f7c){if(!_0x623f7c)return null;_0x5ed40b['message']['agent']=_0x623f7c;return _0x5ed40b;})['then'](function(_0x58c5b0){if(_0x58c5b0){if(_0x287342[_0xe669('0x4a')]['manual']){_0x5ed40b['message'][_0xe669('0x80')]=util[_0xe669('0x68')](_0xe669('0x81'),_0x287342[_0xe669('0x6b')][_0xe669('0x2c')]);_0x5ed40b['message'][_0xe669('0x82')]=_0x5ed40b[_0xe669('0x82')];_0x5ed40b[_0xe669('0x1d')]['motionChannel']=_0x5ed40b[_0xe669('0x82')];_0x5ed40b[_0xe669('0x1d')]['event']=_0xe669('0x65');_0x5ed40b[_0xe669('0x1d')][_0xe669('0x4a')]=htmlToText[_0xe669('0x83')](_0x5ed40b[_0xe669('0x1d')]['body']);return respondWithRpcPromise(_0xe669('0x84'),_0xe669('0x84'),{'event':_0xe669('0x85'),'message':_0x5ed40b[_0xe669('0x1d')]},client9002)[_0xe669('0x14')](function(){return _0x5ed40b;});}return _0x5ed40b;}return null;})[_0xe669('0x14')](respondWithResult(_0x18a57c,null))[_0xe669('0x1e')](handleError(_0x18a57c,null));};exports[_0xe669('0x86')]=function(_0x156ab5,_0x428a4f){var _0x5d8df6={'agent':{},'channel':_0xe669('0x87')};if(_0x156ab5[_0xe669('0x4a')]['id']){delete _0x156ab5[_0xe669('0x4a')]['id'];}_0x156ab5[_0xe669('0x4a')]['UserId']=_0x156ab5[_0xe669('0x4a')][_0xe669('0x6a')]||_0x156ab5[_0xe669('0x6b')]['id'];_0x5d8df6[_0xe669('0x6c')]['id']=_0x156ab5[_0xe669('0x4a')][_0xe669('0x6a')];return db['MailMessage'][_0xe669('0x49')]({'where':{'id':_0x156ab5[_0xe669('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x428a4f,null))[_0xe669('0x14')](function(_0x211d08){if(_0x211d08){_0x5d8df6[_0xe669('0x1d')]=_0x211d08[_0xe669('0x6d')]({'plain':!![]});return db['MailInteraction'][_0xe669('0x49')]({'where':{'id':_0x211d08[_0xe669('0x6f')]}});}return null;})[_0xe669('0x14')](handleEntityNotFound(_0x428a4f,null))[_0xe669('0x14')](function(_0x4d8d3a){if(_0x4d8d3a){_0x5d8df6[_0xe669('0x72')]=_0x4d8d3a[_0xe669('0x6d')]({'plain':!![]});interaction_log[_0xe669('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x156ab5[_0xe669('0x6b')]['id'],_0x156ab5[_0xe669('0x6b')][_0xe669('0x2c')],_0x156ab5[_0xe669('0x6b')][_0xe669('0x74')],_0x5d8df6[_0xe669('0x72')]['id'],_0x156ab5[_0xe669('0x4a')]?JSON['stringify'](_0x156ab5[_0xe669('0x4a')]):'null');return respondWithRpcPromise('RejectMessage',_0xe669('0x88'),_0x5d8df6);}return null;})[_0xe669('0x14')](function(_0x25baf9){var _0x5b6db6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x25baf9[_0xe669('0x1d')]['ContactId'];return db[_0xe669('0x79')][_0xe669('0x34')](_0x5b6db6,{'type':db['Sequelize'][_0xe669('0x7a')][_0xe669('0x7b')],'raw':!![]})[_0xe669('0x14')](function(_0x133d15){return _0x133d15;});})['then'](function(_0x1579aa){if(_0x1579aa){_0x5d8df6['message'][_0xe669('0x7c')]=_0x1579aa[0x0];if(!_0x156ab5['body']['UserId'])return;return db[_0xe669('0x7d')][_0xe669('0x49')]({'where':{'id':_0x156ab5[_0xe669('0x4a')][_0xe669('0x6a')],'role':_0xe669('0x6c')},'attributes':['id',_0xe669('0x2c'),_0xe669('0x7e'),'email',_0xe669('0x7f')],'raw':!![]});}return null;})['then'](function(_0x4fe0a5){if(!_0x4fe0a5)return null;_0x5d8df6[_0xe669('0x1d')][_0xe669('0x6c')]=_0x4fe0a5;return _0x5d8df6;})[_0xe669('0x14')](function(_0x295d5d){if(_0x295d5d){_0x295d5d[_0xe669('0x1d')][_0xe669('0x80')]=util['format'](_0xe669('0x81'),_0x156ab5['user'][_0xe669('0x2c')]);_0x295d5d[_0xe669('0x1d')][_0xe669('0x82')]=_0x5d8df6[_0xe669('0x82')];_0x295d5d['message'][_0xe669('0x89')]=_0x5d8df6[_0xe669('0x82')];_0x295d5d[_0xe669('0x1d')][_0xe669('0x8a')]=_0xe669('0x86');_0x295d5d[_0xe669('0x1d')][_0xe669('0x4a')]=htmlToText[_0xe669('0x83')](_0x5d8df6[_0xe669('0x1d')][_0xe669('0x4a')]);respondWithRpcPromise(_0xe669('0x84'),_0xe669('0x84'),{'event':_0xe669('0x8b'),'message':_0x295d5d[_0xe669('0x1d')]},client9002);return _0x5d8df6;}return null;})[_0xe669('0x14')](respondWithResult(_0x428a4f,null))[_0xe669('0x1e')](handleError(_0x428a4f,null));};exports[_0xe669('0x8c')]=function(_0x5484e1,_0x493b20){var _0x374d13=moment()['unix']()[_0xe669('0x8d')]();var _0x3f0f42=path['join'](config[_0xe669('0x5b')],_0xe669('0x8e'),_0xe669('0x8f'),_0xe669('0x90'));var _0x124fcf=path[_0xe669('0x91')](config[_0xe669('0x5b')],_0xe669('0x8e'),'files','attachments');var _0x549805=util['format'](_0xe669('0x92'),_0x374d13);return db[_0xe669('0x43')][_0xe669('0x49')]({'where':{'id':_0x5484e1[_0xe669('0x47')]['id']},'attributes':['id',_0xe669('0x4a'),_0xe669('0x93'),'to','cc','bcc',_0xe669('0x94'),_0xe669('0x95')],'include':_0x5484e1[_0xe669('0x34')][_0xe669('0x5a')]?[{'model':db[_0xe669('0x96')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x493b20,null))[_0xe669('0x14')](function(_0x5661c4){if(_0x5661c4){var _0x2f5a61=_0x5661c4;var _0x504850={'from':_0x2f5a61[_0xe669('0x93')],'to':_0x2f5a61['to'],'subject':_0x2f5a61['subject'],'html':htmlEntities[_0xe669('0x97')](_0x2f5a61[_0xe669('0x4a')]),'headers':{'Date':moment(_0x2f5a61[_0xe669('0x95')])[_0xe669('0x68')](_0xe669('0x98'))},'attachments':[]};if(_0x5661c4['cc']){_0x504850[_0xe669('0x99')]['Cc']=_0x5661c4['cc'];}if(_0x5661c4[_0xe669('0x9a')]){_0x504850[_0xe669('0x99')]['Bcc']=_0x5661c4['bcc'];}return new BPromise(function(_0x7fb467,_0x41fdf5){if(_0x5661c4['Attachments']){for(var _0x2c7267=0x0;_0x2c7267<_0x5661c4[_0xe669('0x9b')]['length'];_0x2c7267++){var _0xcaca71=_0x5661c4[_0xe669('0x9b')][_0x2c7267];var _0x41e217=path[_0xe669('0x91')](_0x124fcf,_0xcaca71[_0xe669('0x5d')]);if(fs['existsSync'](_0x41e217)){_0x504850[_0xe669('0x5a')][_0xe669('0x9c')]({'name':_0xcaca71[_0xe669('0x2c')],'contentType':_0xcaca71[_0xe669('0x31')],'data':fs[_0xe669('0x9d')](_0x41e217)});}}}emlformat['build'](_0x504850,function(_0x2ef532,_0x536ac3){if(_0x2ef532)return _0x41fdf5(_0x2ef532);fs[_0xe669('0x9e')](path['join'](_0x3f0f42,_0x549805),_0x536ac3);return _0x7fb467(_0x536ac3);});});}})['then'](function(_0x276801){if(_0x276801){return _0x493b20[_0xe669('0x8c')](path['join'](_0x3f0f42,_0x549805),_0x549805,function(_0x57fa33){if(!_0x57fa33)fs['unlinkSync'](path[_0xe669('0x91')](_0x3f0f42,_0x549805));});}})[_0xe669('0x1e')](handleError(_0x493b20,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index c259dd5..e27cc61 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 _0x64b2=['../../mysqldb','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x64b2,0x13b));var _0x264b=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x64b2[_0x2aec52];return _0x3b8835;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x264b('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x264b('0x1'),'afterDestroy':_0x264b('0x2')};function emitEvent(_0x4a1f3d){return function(_0x5d0e09,_0x4a69c4,_0x84aaca){MailMessageEvents[_0x264b('0x3')](_0x4a1f3d+':'+_0x5d0e09['id'],_0x5d0e09);MailMessageEvents[_0x264b('0x3')](_0x4a1f3d,_0x5d0e09);_0x84aaca(null);};}for(var e in events){if(events[_0x264b('0x4')](e)){var event=events[e];MailMessage[_0x264b('0x5')](e,emitEvent(event));}}module[_0x264b('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x7aa0=['MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3592fd,_0x4b490e){var _0x381ae3=function(_0x6cd8ff){while(--_0x6cd8ff){_0x3592fd['push'](_0x3592fd['shift']());}};_0x381ae3(++_0x4b490e);}(_0x7aa0,0xc6));var _0x07aa=function(_0x5a7489,_0x3be9f2){_0x5a7489=_0x5a7489-0x0;var _0x5b1ff3=_0x7aa0[_0x5a7489];return _0x5b1ff3;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x07aa('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x07aa('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x07aa('0x2'),'afterDestroy':_0x07aa('0x3')};function emitEvent(_0x46e9b5){return function(_0x3bd425,_0x4cee32,_0x19e164){MailMessageEvents[_0x07aa('0x4')](_0x46e9b5+':'+_0x3bd425['id'],_0x3bd425);MailMessageEvents['emit'](_0x46e9b5,_0x3bd425);_0x19e164(null);};}for(var e in events){if(events[_0x07aa('0x5')](e)){var event=events[e];MailMessage['hook'](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 33207d3..cff84f7 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 _0x1678=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','FULLTEXT','body','models','get','direction','toLowerCase','secret','UserId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x2e373c,_0x119253){var _0x281c3e=function(_0x2ee547){while(--_0x2ee547){_0x2e373c['push'](_0x2e373c['shift']());}};_0x281c3e(++_0x119253);}(_0x1678,0x133));var _0x8167=function(_0x4d687f,_0x330781){_0x4d687f=_0x4d687f-0x0;var _0x24b077=_0x1678[_0x4d687f];return _0x24b077;};'use strict';var _=require('lodash');var util=require(_0x8167('0x0'));var logger=require(_0x8167('0x1'))(_0x8167('0x2'));var moment=require(_0x8167('0x3'));var BPromise=require(_0x8167('0x4'));var rp=require(_0x8167('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x8167('0x6'));var rimraf=require(_0x8167('0x7'));var config=require(_0x8167('0x8'));var attributes=require(_0x8167('0x9'));module[_0x8167('0xa')]=function(_0x462b5c,_0x4482f1){return _0x462b5c[_0x8167('0xb')](_0x8167('0xc'),attributes,{'tableName':_0x8167('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8167('0xe')]},{'name':_0x8167('0xf'),'fields':[_0x8167('0x10'),'subject'],'type':_0x8167('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x12c2f9,_0x15bf91,_0x279d99){if(_0x12c2f9[_0x8167('0x12')]){_0x12c2f9[_0x8167('0x10')]=htmlToText['fromString'](_0x12c2f9[_0x8167('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x279d99(null,_0x15bf91);},'afterCreate':function(_0x38cd34,_0x1091e1,_0x485e1a){var _0x3303f1=_0x462b5c[_0x8167('0x13')];var _0x59e4bb=_0x38cd34[_0x8167('0x14')]({'plain':!![]});if(_0x59e4bb[_0x8167('0x15')]['toLowerCase']()==='in'||_0x59e4bb[_0x8167('0x15')][_0x8167('0x16')]()==='out'&&!_0x59e4bb[_0x8167('0x17')]&&!_['isNil'](_0x59e4bb[_0x8167('0x18')])){_0x3303f1['MailInteraction']['findOne']({'where':{'id':_0x59e4bb['MailInteractionId']}})['then'](function(_0x4aa1f6){if(_0x4aa1f6){_0x4aa1f6[_0x8167('0x19')]({'lastMsgAt':_0x59e4bb[_0x8167('0x1a')],'lastMsgDirection':_0x59e4bb['direction']['toLowerCase']()});}})[_0x8167('0x1b')](function(_0x1cc9c8){console[_0x8167('0x1c')](_0x1cc9c8);});}_0x485e1a();}},'charset':_0x8167('0x1d'),'collate':_0x8167('0x1e')});}; \ No newline at end of file +var _0xf808=['../../config/environment','exports','mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','catch','api','moment','bluebird','html-to-text'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf808,0x86));var _0x8f80=function(_0x45929d,_0x22f588){_0x45929d=_0x45929d-0x0;var _0x57651c=_0xf808[_0x45929d];return _0x57651c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8f80('0x0'));var moment=require(_0x8f80('0x1'));var BPromise=require(_0x8f80('0x2'));var rp=require('request-promise');var htmlToText=require(_0x8f80('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8f80('0x4'));var attributes=require('./mailMessage.attributes');module[_0x8f80('0x5')]=function(_0x5baec0,_0x30385b){return _0x5baec0['define']('MailMessage',attributes,{'tableName':_0x8f80('0x6'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x8f80('0x7'),_0x8f80('0x8')],'type':_0x8f80('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4eb600,_0x58c4ee,_0x32e4){if(_0x4eb600[_0x8f80('0xa')]){_0x4eb600['plainBody']=htmlToText[_0x8f80('0xb')](_0x4eb600[_0x8f80('0xa')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x32e4(null,_0x58c4ee);},'afterCreate':function(_0x195113,_0x306915,_0x57544f){var _0x21449b=_0x5baec0['models'];var _0x2b1916=_0x195113[_0x8f80('0xc')]({'plain':!![]});if(_0x2b1916[_0x8f80('0xd')]['toLowerCase']()==='in'||_0x2b1916['direction'][_0x8f80('0xe')]()==='out'&&!_0x2b1916[_0x8f80('0xf')]&&!_[_0x8f80('0x10')](_0x2b1916[_0x8f80('0x11')])){_0x21449b[_0x8f80('0x12')][_0x8f80('0x13')]({'where':{'id':_0x2b1916[_0x8f80('0x14')]}})[_0x8f80('0x15')](function(_0x4c20ff){if(_0x4c20ff){_0x4c20ff['update']({'lastMsgAt':_0x2b1916['createdAt'],'lastMsgDirection':_0x2b1916[_0x8f80('0xd')][_0x8f80('0xe')]()});}})[_0x8f80('0x16')](function(_0x2e37b0){console['error'](_0x2e37b0);});}_0x57544f();}},'charset':'utf8mb4','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 e948301..12c95b7 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 _0x7334=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','create','body','options','raw','CreateMailMessage','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3634fb,_0x1fe5cf){var _0x18e34b=function(_0xdc32fc){while(--_0xdc32fc){_0x3634fb['push'](_0x3634fb['shift']());}};_0x18e34b(++_0x1fe5cf);}(_0x7334,0x184));var _0x4733=function(_0xde4964,_0x3e025b){_0xde4964=_0xde4964-0x0;var _0x3c6053=_0x7334[_0xde4964];return _0x3c6053;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});config[_0x4733('0xb')]=_[_0x4733('0xc')](config[_0x4733('0xb')],{'host':_0x4733('0xd'),'port':0x18eb});var socket=require(_0x4733('0xe'))(new Redis(config[_0x4733('0xb')]));require(_0x4733('0xf'))[_0x4733('0x10')](socket);function respondWithRpcPromise(_0x1bc511,_0x2bafad,_0x49032d){return new BPromise(function(_0x42b97f,_0x1e6fcf){return client['request'](_0x1bc511,_0x49032d)[_0x4733('0x11')](function(_0x5240a4){logger[_0x4733('0x12')](_0x4733('0x13'),_0x2bafad,_0x4733('0x14'));logger[_0x4733('0x15')](_0x4733('0x16'),_0x2bafad,_0x4733('0x14'),JSON[_0x4733('0x17')](_0x5240a4));if(_0x5240a4['error']){if(_0x5240a4[_0x4733('0x18')]['code']===0x1f4){logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);return _0x1e6fcf(_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);}logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x5240a4[_0x4733('0x18')]['message']);return _0x42b97f(_0x5240a4[_0x4733('0x18')][_0x4733('0x19')]);}else{logger['info'](_0x4733('0x13'),_0x2bafad,_0x4733('0x14'));_0x42b97f(_0x5240a4[_0x4733('0x1a')][_0x4733('0x19')]);}})['catch'](function(_0x517fbc){logger[_0x4733('0x18')](_0x4733('0x13'),_0x2bafad,_0x517fbc);_0x1e6fcf(_0x517fbc);});});}exports['CreateMailMessage']=function(_0x32f166){var _0x1943bc=this;return new Promise(function(_0x15339c,_0x7a4e0){return db['MailMessage'][_0x4733('0x1b')](_0x32f166[_0x4733('0x1c')],{'raw':_0x32f166['options']?_0x32f166[_0x4733('0x1d')][_0x4733('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x15a291){logger[_0x4733('0x12')](_0x4733('0x1f'),_0x32f166);logger[_0x4733('0x15')](_0x4733('0x1f'),_0x32f166,JSON[_0x4733('0x17')](_0x15a291));_0x15339c(_0x15a291);})[_0x4733('0x20')](function(_0x2bb78f){logger['error'](_0x4733('0x1f'),_0x2bb78f[_0x4733('0x19')],_0x32f166);_0x7a4e0(_0x1943bc[_0x4733('0x18')](0x1f4,_0x2bb78f[_0x4733('0x19')]));});});}; \ No newline at end of file +var _0x1893=['result','MailMessage','body','options','CreateMailMessage','debug','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2ad139,_0x1561ae){var _0x283823=function(_0x373f68){while(--_0x373f68){_0x2ad139['push'](_0x2ad139['shift']());}};_0x283823(++_0x1561ae);}(_0x1893,0xa2));var _0x3189=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0x1893[_0x14477e];return _0x5d4a05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});config[_0x3189('0xb')]=_[_0x3189('0xc')](config[_0x3189('0xb')],{'host':_0x3189('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3189('0xb')]));require('./mailMessage.socket')[_0x3189('0xe')](socket);function respondWithRpcPromise(_0x4ac683,_0x3ec9d0,_0x33cdfb){return new BPromise(function(_0xca480c,_0x176799){return client['request'](_0x4ac683,_0x33cdfb)[_0x3189('0xf')](function(_0x149428){logger[_0x3189('0x10')](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));logger['debug'](_0x3189('0x13'),_0x3ec9d0,_0x3189('0x12'),JSON[_0x3189('0x14')](_0x149428));if(_0x149428[_0x3189('0x15')]){if(_0x149428[_0x3189('0x15')][_0x3189('0x16')]===0x1f4){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0x149428['error'][_0x3189('0x17')]);return _0x176799(_0x149428[_0x3189('0x15')][_0x3189('0x17')]);}logger[_0x3189('0x15')]('MailMessage,\x20%s,\x20%s',_0x3ec9d0,_0x149428[_0x3189('0x15')]['message']);return _0xca480c(_0x149428['error'][_0x3189('0x17')]);}else{logger['info'](_0x3189('0x11'),_0x3ec9d0,_0x3189('0x12'));_0xca480c(_0x149428[_0x3189('0x18')][_0x3189('0x17')]);}})['catch'](function(_0xd3d5a){logger[_0x3189('0x15')](_0x3189('0x11'),_0x3ec9d0,_0xd3d5a);_0x176799(_0xd3d5a);});});}exports['CreateMailMessage']=function(_0x561265){var _0xb0e89b=this;return new Promise(function(_0x306ed3,_0x2c1e59){return db[_0x3189('0x19')]['create'](_0x561265[_0x3189('0x1a')],{'raw':_0x561265[_0x3189('0x1b')]?_0x561265[_0x3189('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3189('0xf')](function(_0x47abb4){logger[_0x3189('0x10')](_0x3189('0x1c'),_0x561265);logger[_0x3189('0x1d')](_0x3189('0x1c'),_0x561265,JSON[_0x3189('0x14')](_0x47abb4));_0x306ed3(_0x47abb4);})[_0x3189('0x1e')](function(_0x5a08dc){logger['error'](_0x3189('0x1c'),_0x5a08dc[_0x3189('0x17')],_0x561265);_0x2c1e59(_0xb0e89b[_0x3189('0x15')](0x1f4,_0x5a08dc[_0x3189('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 55ae691..5fd89b7 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 _0x0af9=['mailMessage:','./mailMessage.events','save','remove','update','removeListener','register','length'];(function(_0x1dff39,_0x1cf83c){var _0x18bc86=function(_0x4971cb){while(--_0x4971cb){_0x1dff39['push'](_0x1dff39['shift']());}};_0x18bc86(++_0x1cf83c);}(_0x0af9,0xb9));var _0x90af=function(_0x40f5fe,_0x208007){_0x40f5fe=_0x40f5fe-0x0;var _0x4a21ae=_0x0af9[_0x40f5fe];return _0x4a21ae;};'use strict';var MailMessageEvents=require(_0x90af('0x0'));var events=[_0x90af('0x1'),_0x90af('0x2'),_0x90af('0x3')];function createListener(_0x5c72cf,_0x2d477d){return function(_0xa1c2cd){_0x2d477d['emit'](_0x5c72cf,_0xa1c2cd);};}function removeListener(_0x98917b,_0x1eb5f4){return function(){MailMessageEvents[_0x90af('0x4')](_0x98917b,_0x1eb5f4);};}exports[_0x90af('0x5')]=function(_0x2ddc2a){for(var _0x29a4c7=0x0,_0xec8217=events[_0x90af('0x6')];_0x29a4c7<_0xec8217;_0x29a4c7++){var _0x5431bc=events[_0x29a4c7];var _0x3569f4=createListener(_0x90af('0x7')+_0x5431bc,_0x2ddc2a);MailMessageEvents['on'](_0x5431bc,_0x3569f4);}}; \ No newline at end of file +var _0x8e63=['save','removeListener','register','length'];(function(_0x4e23c3,_0xe2a070){var _0x4466fa=function(_0xdee7ee){while(--_0xdee7ee){_0x4e23c3['push'](_0x4e23c3['shift']());}};_0x4466fa(++_0xe2a070);}(_0x8e63,0x7c));var _0x38e6=function(_0x17a973,_0x385d62){_0x17a973=_0x17a973-0x0;var _0x3129e8=_0x8e63[_0x17a973];return _0x3129e8;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x38e6('0x0'),'remove','update'];function createListener(_0x3a381c,_0xb2c68b){return function(_0x1c6de7){_0xb2c68b['emit'](_0x3a381c,_0x1c6de7);};}function removeListener(_0x4c85e7,_0xe108a4){return function(){MailMessageEvents[_0x38e6('0x1')](_0x4c85e7,_0xe108a4);};}exports[_0x38e6('0x2')]=function(_0x5af45e){for(var _0x3048c0=0x0,_0x19e7be=events[_0x38e6('0x3')];_0x3048c0<_0x19e7be;_0x3048c0++){var _0x315953=events[_0x3048c0];var _0x51b586=createListener('mailMessage:'+_0x315953,_0x5af45e);MailMessageEvents['on'](_0x315953,_0x51b586);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index bf25bc4..b8f7d1e 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 _0xf6e3=['post','create','put','update','delete','removeTeams','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xf6e3,0x11f));var _0x3f6e=function(_0xcce4c6,_0x1a37c8){_0xcce4c6=_0xcce4c6-0x0;var _0x560f1d=_0xf6e3[_0xcce4c6];return _0x560f1d;};'use strict';var multer=require(_0x3f6e('0x0'));var util=require('util');var path=require(_0x3f6e('0x1'));var timeout=require(_0x3f6e('0x2'));var express=require(_0x3f6e('0x3'));var router=express[_0x3f6e('0x4')]();var fs_extra=require(_0x3f6e('0x5'));var auth=require(_0x3f6e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3f6e('0x7'));var controller=require('./mailQueue.controller');router[_0x3f6e('0x8')]('/',auth[_0x3f6e('0x9')](),controller[_0x3f6e('0xa')]);router[_0x3f6e('0x8')](_0x3f6e('0xb'),auth[_0x3f6e('0x9')](),controller[_0x3f6e('0xc')]);router[_0x3f6e('0x8')](_0x3f6e('0xd'),auth[_0x3f6e('0x9')](),controller[_0x3f6e('0xe')]);router[_0x3f6e('0x8')](_0x3f6e('0xf'),auth['isAuthenticated'](),controller[_0x3f6e('0x10')]);router[_0x3f6e('0x8')](_0x3f6e('0x11'),auth[_0x3f6e('0x9')](),controller[_0x3f6e('0x12')]);router[_0x3f6e('0x8')](_0x3f6e('0x13'),auth[_0x3f6e('0x9')](),controller[_0x3f6e('0x14')]);router[_0x3f6e('0x15')]('/',auth[_0x3f6e('0x9')](),controller[_0x3f6e('0x16')]);router['post'](_0x3f6e('0x11'),auth[_0x3f6e('0x9')](),controller['addTeams']);router[_0x3f6e('0x15')](_0x3f6e('0x13'),auth[_0x3f6e('0x9')](),controller['addAgents']);router[_0x3f6e('0x17')](_0x3f6e('0xd'),auth[_0x3f6e('0x9')](),controller[_0x3f6e('0x18')]);router[_0x3f6e('0x19')]('/:id',auth[_0x3f6e('0x9')](),controller['destroy']);router[_0x3f6e('0x19')](_0x3f6e('0x11'),auth[_0x3f6e('0x9')](),controller[_0x3f6e('0x1a')]);router[_0x3f6e('0x19')](_0x3f6e('0x13'),auth[_0x3f6e('0x9')](),controller[_0x3f6e('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x39c5=['../../components/interaction/service','./mailQueue.controller','index','get','/describe','/:id','show','getMembers','isAuthenticated','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x642b84,_0x461a5c){var _0x906e25=function(_0x2a57e0){while(--_0x2a57e0){_0x642b84['push'](_0x642b84['shift']());}};_0x906e25(++_0x461a5c);}(_0x39c5,0x87));var _0x539c=function(_0xa41df9,_0x20fed0){_0xa41df9=_0xa41df9-0x0;var _0x342a45=_0x39c5[_0xa41df9];return _0x342a45;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x539c('0x0'));var timeout=require(_0x539c('0x1'));var express=require(_0x539c('0x2'));var router=express[_0x539c('0x3')]();var fs_extra=require(_0x539c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x539c('0x5'));var config=require('../../config/environment');var controller=require(_0x539c('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x539c('0x7')]);router[_0x539c('0x8')](_0x539c('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x539c('0xa'),auth['isAuthenticated'](),controller[_0x539c('0xb')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x539c('0xc')]);router[_0x539c('0x8')]('/:id/teams',auth[_0x539c('0xd')](),controller[_0x539c('0xe')]);router[_0x539c('0x8')](_0x539c('0xf'),auth[_0x539c('0xd')](),controller[_0x539c('0x10')]);router[_0x539c('0x11')]('/',auth['isAuthenticated'](),controller[_0x539c('0x12')]);router[_0x539c('0x11')](_0x539c('0x13'),auth[_0x539c('0xd')](),controller['addTeams']);router[_0x539c('0x11')](_0x539c('0xf'),auth[_0x539c('0xd')](),controller[_0x539c('0x14')]);router[_0x539c('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x539c('0x16')]);router[_0x539c('0x17')](_0x539c('0xa'),auth[_0x539c('0xd')](),controller[_0x539c('0x18')]);router[_0x539c('0x17')]('/:id/teams',auth[_0x539c('0xd')](),controller[_0x539c('0x19')]);router['delete'](_0x539c('0xf'),auth[_0x539c('0xd')](),controller[_0x539c('0x1a')]);module[_0x539c('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 2df3848..1e8c8b8 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 _0x8701=['ENUM','beepall','roundrobin','exports','STRING','name','INTEGER'];(function(_0x1f8e3a,_0x53db7f){var _0x43e2b0=function(_0x12e883){while(--_0x12e883){_0x1f8e3a['push'](_0x1f8e3a['shift']());}};_0x43e2b0(++_0x53db7f);}(_0x8701,0x14c));var _0x1870=function(_0x54867e,_0x36fefa){_0x54867e=_0x54867e-0x0;var _0x48a4f1=_0x8701[_0x54867e];return _0x48a4f1;};'use strict';var Sequelize=require('sequelize');module[_0x1870('0x0')]={'name':{'type':Sequelize[_0x1870('0x1')],'unique':_0x1870('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1870('0x1')]},'timeout':{'type':Sequelize[_0x1870('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1870('0x4')]('rrmemory',_0x1870('0x5'),_0x1870('0x6'))}}; \ No newline at end of file +var _0x66fb=['name','INTEGER','ENUM','beepall','roundrobin','exports'];(function(_0x43fc09,_0x11ebe4){var _0x2ee256=function(_0x8a0db2){while(--_0x8a0db2){_0x43fc09['push'](_0x43fc09['shift']());}};_0x2ee256(++_0x11ebe4);}(_0x66fb,0x71));var _0xb66f=function(_0x548898,_0x1db169){_0x548898=_0x548898-0x0;var _0x53fe69=_0x66fb[_0x548898];return _0x53fe69;};'use strict';var Sequelize=require('sequelize');module[_0xb66f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb66f('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb66f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb66f('0x3')]('rrmemory',_0xb66f('0x4'),_0xb66f('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index afd04de..5d6dc16 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 _0x5b45=['QueryTypes','includes','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','userMailQueue:save','isArray','userMailQueue: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','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','MailQueues','UserProfileResource','then','error','name','send','index','map','MailQueue','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','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','UserMailQueue','hasOwnProperty','MailQueueId','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString'];(function(_0xd3b0ac,_0x2f5065){var _0x3d773e=function(_0x2e10d1){while(--_0x2e10d1){_0xd3b0ac['push'](_0xd3b0ac['shift']());}};_0x3d773e(++_0x2f5065);}(_0x5b45,0x1d0));var _0x55b4=function(_0x1ee62e,_0x159bb2){_0x1ee62e=_0x1ee62e-0x0;var _0x27c6c8=_0x5b45[_0x1ee62e];return _0x27c6c8;};'use strict';var emlformat=require(_0x55b4('0x0'));var rimraf=require(_0x55b4('0x1'));var zipdir=require(_0x55b4('0x2'));var jsonpatch=require(_0x55b4('0x3'));var rp=require(_0x55b4('0x4'));var moment=require(_0x55b4('0x5'));var BPromise=require(_0x55b4('0x6'));var Mustache=require(_0x55b4('0x7'));var util=require(_0x55b4('0x8'));var path=require(_0x55b4('0x9'));var sox=require(_0x55b4('0xa'));var csv=require(_0x55b4('0xb'));var ejs=require(_0x55b4('0xc'));var fs=require('fs');var fs_extra=require(_0x55b4('0xd'));var _=require(_0x55b4('0xe'));var squel=require(_0x55b4('0xf'));var crypto=require(_0x55b4('0x10'));var jsforce=require(_0x55b4('0x11'));var deskjs=require(_0x55b4('0x12'));var toCsv=require(_0x55b4('0xb'));var querystring=require(_0x55b4('0x13'));var Papa=require(_0x55b4('0x14'));var Redis=require('ioredis');var authService=require(_0x55b4('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x55b4('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55b4('0x17'))(_0x55b4('0x18'));var utils=require(_0x55b4('0x19'));var config=require(_0x55b4('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x55b4('0x1b'))['db'];config[_0x55b4('0x1c')]=_[_0x55b4('0x1d')](config[_0x55b4('0x1c')],{'host':_0x55b4('0x1e'),'port':0x18eb});var socket=require(_0x55b4('0x1f'))(new Redis(config[_0x55b4('0x1c')]));require(_0x55b4('0x20'))[_0x55b4('0x21')](socket);function respondWithStatusCode(_0x202b28,_0x2ae9fc){_0x2ae9fc=_0x2ae9fc||0xcc;return function(_0x2db230){if(_0x2db230){return _0x202b28[_0x55b4('0x22')](_0x2ae9fc);}return _0x202b28[_0x55b4('0x23')](_0x2ae9fc)[_0x55b4('0x24')]();};}function respondWithResult(_0x329f51,_0x52d727){_0x52d727=_0x52d727||0xc8;return function(_0x102d32){if(_0x102d32){return _0x329f51[_0x55b4('0x23')](_0x52d727)[_0x55b4('0x25')](_0x102d32);}};}function respondWithFilteredResult(_0x3f5bab,_0x69faba){return function(_0xb61776){if(_0xb61776){var _0x3346de=typeof _0x69faba[_0x55b4('0x26')]===_0x55b4('0x27')&&typeof _0x69faba[_0x55b4('0x28')]==='undefined';var _0x2be68a=_0xb61776['count'];var _0x2b0a81=_0x3346de?0x0:_0x69faba['offset'];var _0x38c1ab=_0x3346de?_0xb61776[_0x55b4('0x29')]:_0x69faba['offset']+_0x69faba[_0x55b4('0x28')];var _0x166c6c;if(_0x38c1ab>=_0x2be68a){_0x38c1ab=_0x2be68a;_0x166c6c=0xc8;}else{_0x166c6c=0xce;}_0x3f5bab[_0x55b4('0x23')](_0x166c6c);return _0x3f5bab[_0x55b4('0x2a')](_0x55b4('0x2b'),_0x2b0a81+'-'+_0x38c1ab+'/'+_0x2be68a)[_0x55b4('0x25')](_0xb61776);}return null;};}function patchUpdates(_0x4400cd){return function(_0x364a0e){try{jsonpatch['apply'](_0x364a0e,_0x4400cd,!![]);}catch(_0x528dd2){return BPromise[_0x55b4('0x2c')](_0x528dd2);}return _0x364a0e[_0x55b4('0x2d')]();};}function saveUpdates(_0x3ff8d2,_0x235c36){return function(_0x59d5b7){if(_0x59d5b7){return _0x59d5b7[_0x55b4('0x2e')](_0x3ff8d2)['then'](function(_0x1146d0){return _0x1146d0;});}return null;};}function removeEntity(_0x25a5b9,_0x679f96){return function(_0x10e0e4){if(_0x10e0e4){return _0x10e0e4[_0x55b4('0x2f')]()['then'](function(){var _0x448104=_0x10e0e4[_0x55b4('0x30')]({'plain':!![]});var _0x3ae300=_0x55b4('0x31');return db[_0x55b4('0x32')]['destroy']({'where':{'type':_0x3ae300,'resourceId':_0x448104['id']}})[_0x55b4('0x33')](function(){return _0x10e0e4;});})['then'](function(){_0x25a5b9[_0x55b4('0x23')](0xcc)[_0x55b4('0x24')]();});}};}function handleEntityNotFound(_0x22e05f,_0x1f3706){return function(_0x184cc1){if(!_0x184cc1){_0x22e05f['sendStatus'](0x194);}return _0x184cc1;};}function handleError(_0x1b76a9,_0xee71f8){_0xee71f8=_0xee71f8||0x1f4;return function(_0x6891bd){logger[_0x55b4('0x34')](_0x6891bd['stack']);if(_0x6891bd[_0x55b4('0x35')]){delete _0x6891bd[_0x55b4('0x35')];}_0x1b76a9[_0x55b4('0x23')](_0xee71f8)[_0x55b4('0x36')](_0x6891bd);};}exports[_0x55b4('0x37')]=function(_0x3f01c0,_0x12ac33){var _0x51e309={},_0x7d7c82={},_0x25d533={'count':0x0,'rows':[]};var _0x53e2d5=_[_0x55b4('0x38')](db[_0x55b4('0x39')]['rawAttributes'],function(_0x2ec315){return{'name':_0x2ec315[_0x55b4('0x3a')],'type':_0x2ec315['type'][_0x55b4('0x3b')]};});_0x7d7c82[_0x55b4('0x3c')]=_['map'](_0x53e2d5,'name');_0x7d7c82[_0x55b4('0x3d')]=_[_0x55b4('0x3e')](_0x3f01c0[_0x55b4('0x3d')]);_0x7d7c82[_0x55b4('0x3f')]=_[_0x55b4('0x40')](_0x7d7c82[_0x55b4('0x3c')],_0x7d7c82[_0x55b4('0x3d')]);_0x51e309[_0x55b4('0x41')]=_[_0x55b4('0x40')](_0x7d7c82[_0x55b4('0x3c')],qs[_0x55b4('0x42')](_0x3f01c0[_0x55b4('0x3d')][_0x55b4('0x42')]));_0x51e309[_0x55b4('0x41')]=_0x51e309['attributes'][_0x55b4('0x43')]?_0x51e309[_0x55b4('0x41')]:_0x7d7c82[_0x55b4('0x3c')];if(!_0x3f01c0['query']['hasOwnProperty'](_0x55b4('0x44'))){_0x51e309['limit']=qs[_0x55b4('0x28')](_0x3f01c0[_0x55b4('0x3d')]['limit']);_0x51e309[_0x55b4('0x26')]=qs['offset'](_0x3f01c0[_0x55b4('0x3d')]['offset']);}_0x51e309[_0x55b4('0x45')]=qs['sort'](_0x3f01c0['query'][_0x55b4('0x46')]);_0x51e309[_0x55b4('0x47')]=qs[_0x55b4('0x3f')](_[_0x55b4('0x48')](_0x3f01c0['query'],_0x7d7c82['filters']),_0x53e2d5);if(_0x3f01c0['query'][_0x55b4('0x49')]){_0x51e309[_0x55b4('0x47')]=_[_0x55b4('0x4a')](_0x51e309['where'],{'$or':_['map'](_0x53e2d5,function(_0x44f545){if(_0x44f545[_0x55b4('0x4b')]!=='VIRTUAL'){var _0x404234={};_0x404234[_0x44f545[_0x55b4('0x35')]]={'$like':'%'+_0x3f01c0['query'][_0x55b4('0x49')]+'%'};return _0x404234;}})});}_0x51e309=_[_0x55b4('0x4a')]({},_0x51e309,_0x3f01c0[_0x55b4('0x4c')]);var _0x4ab14b={'where':_0x51e309[_0x55b4('0x47')]};return db[_0x55b4('0x39')][_0x55b4('0x29')](_0x4ab14b)[_0x55b4('0x33')](function(_0x57b5b2){_0x25d533[_0x55b4('0x29')]=_0x57b5b2;if(_0x3f01c0[_0x55b4('0x3d')][_0x55b4('0x4d')]){_0x51e309[_0x55b4('0x4e')]=[{'all':!![]}];}return db[_0x55b4('0x39')][_0x55b4('0x4f')](_0x51e309);})['then'](function(_0x17de9b){_0x25d533[_0x55b4('0x50')]=_0x17de9b;return _0x25d533;})[_0x55b4('0x33')](respondWithFilteredResult(_0x12ac33,_0x51e309))[_0x55b4('0x51')](handleError(_0x12ac33,null));};exports['show']=function(_0x333010,_0x3d7bc9){var _0x5696c1={'raw':!![],'where':{'id':_0x333010[_0x55b4('0x52')]['id']}},_0xe3de14={};_0xe3de14[_0x55b4('0x3c')]=_[_0x55b4('0x3e')](db[_0x55b4('0x39')][_0x55b4('0x53')]);_0xe3de14[_0x55b4('0x3d')]=_['keys'](_0x333010[_0x55b4('0x3d')]);_0xe3de14[_0x55b4('0x3f')]=_[_0x55b4('0x40')](_0xe3de14[_0x55b4('0x3c')],_0xe3de14['query']);_0x5696c1[_0x55b4('0x41')]=_[_0x55b4('0x40')](_0xe3de14[_0x55b4('0x3c')],qs[_0x55b4('0x42')](_0x333010[_0x55b4('0x3d')]['fields']));_0x5696c1['attributes']=_0x5696c1[_0x55b4('0x41')][_0x55b4('0x43')]?_0x5696c1[_0x55b4('0x41')]:_0xe3de14[_0x55b4('0x3c')];if(_0x333010[_0x55b4('0x3d')][_0x55b4('0x4d')]){_0x5696c1['include']=[{'all':!![]}];}_0x5696c1=_[_0x55b4('0x4a')]({},_0x5696c1,_0x333010['options']);return db[_0x55b4('0x39')][_0x55b4('0x54')](_0x5696c1)['then'](handleEntityNotFound(_0x3d7bc9,null))['then'](respondWithResult(_0x3d7bc9,null))[_0x55b4('0x51')](handleError(_0x3d7bc9,null));};exports[_0x55b4('0x55')]=function(_0xb21791,_0x359e4b){return db[_0x55b4('0x39')][_0x55b4('0x55')](_0xb21791[_0x55b4('0x56')],{})[_0x55b4('0x33')](function(_0x134e1c){var _0x187e97=_0xb21791[_0x55b4('0x57')]['get']({'plain':!![]});if(!_0x187e97)throw new Error(_0x55b4('0x58'));if(_0x187e97[_0x55b4('0x59')]===_0x55b4('0x57')){var _0x3a9f6a=_0x134e1c[_0x55b4('0x30')]({'plain':!![]});var _0x319efb=_0x55b4('0x31');return db[_0x55b4('0x5a')][_0x55b4('0x54')]({'where':{'name':_0x319efb,'userProfileId':_0x187e97[_0x55b4('0x5b')]},'raw':!![]})[_0x55b4('0x33')](function(_0x3b2d8c){if(_0x3b2d8c&&_0x3b2d8c[_0x55b4('0x5c')]===0x0){return db[_0x55b4('0x32')][_0x55b4('0x55')]({'name':_0x3a9f6a[_0x55b4('0x35')],'resourceId':_0x3a9f6a['id'],'type':_0x3b2d8c[_0x55b4('0x35')],'sectionId':_0x3b2d8c['id']},{})[_0x55b4('0x33')](function(){return _0x134e1c;});}else{return _0x134e1c;}})[_0x55b4('0x51')](function(_0x116edb){logger['error'](_0x55b4('0x5d'),_0x116edb);throw _0x116edb;});}return _0x134e1c;})['then'](respondWithResult(_0x359e4b,0xc9))[_0x55b4('0x51')](handleError(_0x359e4b,null));};exports[_0x55b4('0x2e')]=function(_0x4b56a0,_0xb9a678){if(_0x4b56a0[_0x55b4('0x56')]['id']){delete _0x4b56a0[_0x55b4('0x56')]['id'];}return db['MailQueue'][_0x55b4('0x54')]({'where':{'id':_0x4b56a0[_0x55b4('0x52')]['id']}})['then'](handleEntityNotFound(_0xb9a678,null))[_0x55b4('0x33')](saveUpdates(_0x4b56a0[_0x55b4('0x56')],null))[_0x55b4('0x33')](respondWithResult(_0xb9a678,null))['catch'](handleError(_0xb9a678,null));};exports[_0x55b4('0x2f')]=function(_0x17aaa5,_0x4adf09){return db[_0x55b4('0x39')][_0x55b4('0x54')]({'where':{'id':_0x17aaa5[_0x55b4('0x52')]['id']}})[_0x55b4('0x33')](handleEntityNotFound(_0x4adf09,null))['then'](removeEntity(_0x4adf09,null))[_0x55b4('0x51')](handleError(_0x4adf09,null));};exports[_0x55b4('0x5e')]=function(_0x5adeb3,_0x32eebf){return db[_0x55b4('0x39')][_0x55b4('0x5e')]()[_0x55b4('0x33')](respondWithResult(_0x32eebf,null))['catch'](handleError(_0x32eebf,null));};exports[_0x55b4('0x5f')]=function(_0xdc589f,_0xc75c71,_0x1001f5){var _0x316cc3={'raw':!![],'where':{}},_0x5bc5e6={},_0x386a3e;return db[_0x55b4('0x39')][_0x55b4('0x60')]({'where':{'id':_0xdc589f[_0x55b4('0x52')]['id']}})[_0x55b4('0x33')](handleEntityNotFound(_0xc75c71,null))[_0x55b4('0x33')](function(_0xea04aa){if(_0xea04aa){_0x386a3e=_0xea04aa[_0x55b4('0x30')]({'plain':!![]});_0x5bc5e6[_0x55b4('0x3c')]=_[_0x55b4('0x3e')](db[_0x55b4('0x61')][_0x55b4('0x53')]);_0x5bc5e6[_0x55b4('0x3d')]=_[_0x55b4('0x3e')](_0xdc589f['query']);_0x5bc5e6[_0x55b4('0x3f')]=_['intersection'](_0x5bc5e6[_0x55b4('0x3c')],_0x5bc5e6['query']);_0x316cc3['attributes']=_[_0x55b4('0x40')](_0x5bc5e6['model'],qs['fields'](_0xdc589f[_0x55b4('0x3d')][_0x55b4('0x42')]));_0x316cc3[_0x55b4('0x41')]=_0x316cc3[_0x55b4('0x41')][_0x55b4('0x43')]?_0x316cc3[_0x55b4('0x41')]:_0x5bc5e6['model'];if(!_0xdc589f[_0x55b4('0x3d')][_0x55b4('0x62')](_0x55b4('0x44'))){_0x316cc3[_0x55b4('0x28')]=qs[_0x55b4('0x28')](_0xdc589f[_0x55b4('0x3d')][_0x55b4('0x28')]);_0x316cc3['offset']=qs[_0x55b4('0x26')](_0xdc589f['query'][_0x55b4('0x26')]);}_0x316cc3['order']=qs['sort'](_0xdc589f[_0x55b4('0x3d')]['sort']);_0x316cc3[_0x55b4('0x47')]=qs[_0x55b4('0x3f')](_[_0x55b4('0x48')](_0xdc589f[_0x55b4('0x3d')],_0x5bc5e6[_0x55b4('0x3f')]));_0x316cc3[_0x55b4('0x47')][_0x55b4('0x63')]=_0xea04aa['id'];if(_0xdc589f[_0x55b4('0x3d')]['filter']){_0x316cc3[_0x55b4('0x47')]=_[_0x55b4('0x4a')](_0x316cc3[_0x55b4('0x47')],{'$or':_[_0x55b4('0x38')](_0x316cc3[_0x55b4('0x41')],function(_0x577bed){var _0x299251={};_0x299251[_0x577bed]={'$like':'%'+_0xdc589f[_0x55b4('0x3d')]['filter']+'%'};return _0x299251;})});}_0x316cc3=_[_0x55b4('0x4a')]({},_0x316cc3,_0xdc589f[_0x55b4('0x4c')]);return db[_0x55b4('0x61')][_0x55b4('0x4f')](_0x316cc3);}})[_0x55b4('0x33')](function(_0x2c29d4){if(_0x2c29d4){return db['User'][_0x55b4('0x64')]({'where':{'id':_[_0x55b4('0x38')](_0x2c29d4,_0x55b4('0x65')),'role':_0x55b4('0x66')},'attributes':['id',_0x55b4('0x35'),_0x55b4('0x67'),'updatedAt',_0x55b4('0x68')]});}})[_0x55b4('0x33')](function(_0x3bff01){if(_0x3bff01){return{'count':_0x3bff01[_0x55b4('0x29')],'rows':_[_0x55b4('0x38')](_0x3bff01['rows'],function(_0x5e2335){return{'membername':_0x5e2335[_0x55b4('0x35')],'UserId':_0x5e2335['id'],'queue_name':_0x386a3e['name'],'MailQueueId':_0x386a3e['id'],'interface':util[_0x55b4('0x69')](_0x55b4('0x6a'),_0x55b4('0x6b'),_0x5e2335['name']),'penalty':0x0,'paused':_0x5e2335[_0x55b4('0x67')],'createdAt':_0x5e2335['createdAt'],'updatedAt':_0x5e2335[_0x55b4('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x55b4('0x33')](respondWithFilteredResult(_0xc75c71,_0x316cc3))[_0x55b4('0x51')](handleError(_0xc75c71,null));};exports[_0x55b4('0x6d')]=function(_0x4b5894,_0x2850a2,_0x63f273){var _0x48505f={};var _0x17add5={};var _0x5d9e00;var _0x1c784c;return db[_0x55b4('0x39')][_0x55b4('0x60')]({'where':{'id':_0x4b5894['params']['id']}})[_0x55b4('0x33')](handleEntityNotFound(_0x2850a2,null))[_0x55b4('0x33')](function(_0x582c09){if(_0x582c09){_0x5d9e00=_0x582c09;_0x17add5[_0x55b4('0x3c')]=_[_0x55b4('0x3e')](db[_0x55b4('0x6e')]['rawAttributes']);_0x17add5[_0x55b4('0x3d')]=_[_0x55b4('0x3e')](_0x4b5894[_0x55b4('0x3d')]);_0x17add5[_0x55b4('0x3f')]=_[_0x55b4('0x40')](_0x17add5[_0x55b4('0x3c')],_0x17add5[_0x55b4('0x3d')]);_0x48505f[_0x55b4('0x41')]=_[_0x55b4('0x40')](_0x17add5[_0x55b4('0x3c')],qs['fields'](_0x4b5894[_0x55b4('0x3d')]['fields']));_0x48505f[_0x55b4('0x41')]=_0x48505f[_0x55b4('0x41')][_0x55b4('0x43')]?_0x48505f[_0x55b4('0x41')]:_0x17add5[_0x55b4('0x3c')];_0x48505f[_0x55b4('0x45')]=qs[_0x55b4('0x46')](_0x4b5894['query'][_0x55b4('0x46')]);_0x48505f[_0x55b4('0x47')]=qs[_0x55b4('0x3f')](_[_0x55b4('0x48')](_0x4b5894[_0x55b4('0x3d')],_0x17add5['filters']));if(_0x4b5894['query']['filter']){_0x48505f[_0x55b4('0x47')]=_[_0x55b4('0x4a')](_0x48505f[_0x55b4('0x47')],{'$or':_[_0x55b4('0x38')](_0x48505f[_0x55b4('0x41')],function(_0x2c1527){var _0x2ec006={};_0x2ec006[_0x2c1527]={'$like':'%'+_0x4b5894['query'][_0x55b4('0x49')]+'%'};return _0x2ec006;})});}_0x48505f=_[_0x55b4('0x4a')]({},_0x48505f,_0x4b5894[_0x55b4('0x4c')]);return _0x5d9e00[_0x55b4('0x6d')](_0x48505f);}})[_0x55b4('0x33')](function(_0x226744){if(_0x226744){_0x1c784c=_0x226744[_0x55b4('0x43')];if(!_0x4b5894[_0x55b4('0x3d')]['hasOwnProperty']('nolimit')){_0x48505f[_0x55b4('0x28')]=qs[_0x55b4('0x28')](_0x4b5894['query'][_0x55b4('0x28')]);_0x48505f[_0x55b4('0x26')]=qs[_0x55b4('0x26')](_0x4b5894['query'][_0x55b4('0x26')]);}return _0x5d9e00[_0x55b4('0x6d')](_0x48505f);}})[_0x55b4('0x33')](function(_0x3c026c){if(_0x3c026c){return _0x3c026c?{'count':_0x1c784c,'rows':_0x3c026c}:null;}})[_0x55b4('0x33')](respondWithResult(_0x2850a2,null))['catch'](handleError(_0x2850a2,null));};exports[_0x55b4('0x6f')]=function(_0xff46fd,_0x2f9827,_0x591fc3){var _0x4b34f8=_0xff46fd[_0x55b4('0x56')]['ids'];return db[_0x55b4('0x6e')][_0x55b4('0x4f')]({'where':{'id':_0x4b34f8},'attributes':['id'],'include':[{'model':db[_0x55b4('0x70')],'as':_0x55b4('0x71'),'attributes':['id',_0x55b4('0x35'),_0x55b4('0x72'),_0x55b4('0x73'),_0x55b4('0x74')],'raw':!![]}]})['then'](function(_0x3c02a2){if(_0x3c02a2){var _0x2c1cac=_['flatMap'](_0x3c02a2,function(_0x4407da){var _0x5d308f=_0x4407da[_0x55b4('0x30')]({'plain':!![]});return _0x5d308f[_0x55b4('0x71')];});return db[_0x55b4('0x39')][_0x55b4('0x54')]({'where':{'id':_0xff46fd[_0x55b4('0x52')]['id']}})['then'](function(_0x339535){return db['sequelize'][_0x55b4('0x75')](function(_0x37b87f){return _0x339535[_0x55b4('0x6f')](_0x4b34f8,{'transaction':_0x37b87f})['then'](function(){return BPromise[_0x55b4('0x76')](_0x2c1cac,function(_0x339977){return db[_0x55b4('0x61')][_0x55b4('0x77')]({'where':{'UserId':_0x339977['id'],'MailQueueId':_0xff46fd[_0x55b4('0x52')]['id']},'transaction':_0x37b87f});});})[_0x55b4('0x33')](function(){_0x2c1cac[_0x55b4('0x78')](function(_0x2ce72f){socket[_0x55b4('0x79')]('userMailQueue:save',{'UserId':_0x2ce72f['id'],'MailQueueId':_0x339535['id']});});});});});}})[_0x55b4('0x33')](respondWithStatusCode(_0x2f9827,null))[_0x55b4('0x51')](handleError(_0x2f9827,null));};exports[_0x55b4('0x7a')]=function(_0x3a128c,_0x436cb,_0x3572c1){return db['Team'][_0x55b4('0x4f')]({'where':{'id':_0x3a128c[_0x55b4('0x3d')][_0x55b4('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x55b4('0x70')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x436cb,null))['then'](function(_0x366371){var _0x5d6b87=_[_0x55b4('0x38')](_0x366371,'id');var _0x175c48=[];var _0x36fcfb=[];var _0x19863d=squel[_0x55b4('0x7c')]();_0x19863d[_0x55b4('0x7d')](_0x55b4('0x7e'))['from'](_0x55b4('0x7f'),'tq')[_0x55b4('0x80')](_0x55b4('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x55b4('0x47')](_0x55b4('0x82'),_0x3a128c['params']['id']);for(var _0xa65010=0x0;_0xa65010<_0x366371[_0x55b4('0x43')];_0xa65010+=0x1){let _0x57a22d=_0x366371[_0xa65010];for(var _0x53282f=0x0;_0x53282f<_0x57a22d[_0x55b4('0x71')][_0x55b4('0x43')];_0x53282f+=0x1){let _0x9bbeec=_0x57a22d[_0x55b4('0x71')][_0x53282f];var _0x3dd6eb=_0x19863d[_0x55b4('0x83')]();_0x3dd6eb[_0x55b4('0x47')](_0x55b4('0x84'),_0x9bbeec['id']);_0x36fcfb[_0x55b4('0x85')](db[_0x55b4('0x86')][_0x55b4('0x3d')](_0x3dd6eb[_0x55b4('0x87')](),{'type':db[_0x55b4('0x86')][_0x55b4('0x88')]['SELECT']})['then'](function(_0x392806){if(_0x392806[_0x55b4('0x43')]===0x1){return _0x9bbeec['id'];}else{var _0x5157a5=_['every'](_['map'](_0x392806,'TeamId'),function(_0x442d2f){return _[_0x55b4('0x89')](_0x5d6b87,_0x442d2f);});if(_0x5157a5){return _0x9bbeec['id'];}}}));}}return BPromise['all'](_0x36fcfb)[_0x55b4('0x33')](function(_0x207daa){_0x175c48=_(_0x175c48)[_0x55b4('0x8a')](_0x207daa)[_0x55b4('0x8b')]()[_0x55b4('0x8c')]();return db[_0x55b4('0x39')][_0x55b4('0x54')]({'where':{'id':_0x3a128c[_0x55b4('0x52')]['id']}})[_0x55b4('0x33')](function(_0x434129){return db['sequelize'][_0x55b4('0x75')](function(_0x5e0c37){return _0x434129['removeTeams'](_0x3a128c[_0x55b4('0x3d')][_0x55b4('0x7b')],{'transaction':_0x5e0c37})[_0x55b4('0x33')](function(){if(!_[_0x55b4('0x8d')](_0x175c48)){return _0x434129[_0x55b4('0x8e')](_0x175c48,{'transaction':_0x5e0c37});}})['then'](function(){_0x175c48['forEach'](function(_0x452535){socket[_0x55b4('0x79')]('userMailQueue:remove',{'UserId':_0x452535,'MailQueueId':_0x434129['id']});});});});});});})[_0x55b4('0x33')](respondWithStatusCode(_0x436cb,null))[_0x55b4('0x51')](handleError(_0x436cb,null));};exports[_0x55b4('0x8f')]=function(_0x10c5e8,_0x3aa04c,_0x157ea7){return db[_0x55b4('0x39')]['find']({'where':{'id':_0x10c5e8[_0x55b4('0x52')]['id']}})[_0x55b4('0x33')](handleEntityNotFound(_0x3aa04c,null))['then'](function(_0x88013){if(_0x88013){return _0x88013['addAgents'](_0x10c5e8[_0x55b4('0x56')][_0x55b4('0x7b')],_[_0x55b4('0x90')](_0x10c5e8[_0x55b4('0x56')],[_0x55b4('0x7b'),'id'])||{})[_0x55b4('0x91')](function(_0x539fd7){for(var _0x11ef44=0x0;_0x11ef44<_0x10c5e8['body'][_0x55b4('0x7b')][_0x55b4('0x43')];_0x11ef44+=0x1){socket['emit'](_0x55b4('0x92'),{'UserId':Number(_0x10c5e8[_0x55b4('0x56')][_0x55b4('0x7b')][_0x11ef44]),'MailQueueId':Number(_0x10c5e8[_0x55b4('0x52')]['id'])});}return _0x539fd7;});}})[_0x55b4('0x33')](respondWithResult(_0x3aa04c,null))[_0x55b4('0x51')](handleError(_0x3aa04c,null));};exports[_0x55b4('0x8e')]=function(_0x5c14f9,_0x32eaae,_0x3bf8c8){return db[_0x55b4('0x39')]['find']({'where':{'id':_0x5c14f9[_0x55b4('0x52')]['id']}})[_0x55b4('0x33')](handleEntityNotFound(_0x32eaae,null))[_0x55b4('0x33')](function(_0x5a60f2){if(_0x5a60f2){return _0x5a60f2['removeAgents'](_0x5c14f9[_0x55b4('0x3d')][_0x55b4('0x7b')])[_0x55b4('0x33')](function(){if(_[_0x55b4('0x93')](_0x5c14f9['query']['ids'])){for(var _0x4027e9=0x0;_0x4027e9<_0x5c14f9[_0x55b4('0x3d')][_0x55b4('0x7b')]['length'];_0x4027e9+=0x1){socket['emit'](_0x55b4('0x94'),{'UserId':Number(_0x5c14f9['query'][_0x55b4('0x7b')][_0x4027e9]),'MailQueueId':Number(_0x5c14f9[_0x55b4('0x52')]['id'])});}}else{socket[_0x55b4('0x79')](_0x55b4('0x94'),{'UserId':Number(_0x5c14f9[_0x55b4('0x3d')][_0x55b4('0x7b')]),'MailQueueId':Number(_0x5c14f9[_0x55b4('0x52')]['id'])});}});}})[_0x55b4('0x33')](respondWithStatusCode(_0x32eaae,null))['catch'](handleError(_0x32eaae,null));};exports[_0x55b4('0x95')]=function(_0xf9b169,_0x355eba,_0x253208){var _0xf0633d={};var _0x43668e={};var _0x29c899;var _0x235557;return db[_0x55b4('0x39')]['findOne']({'where':{'id':_0xf9b169[_0x55b4('0x52')]['id']}})[_0x55b4('0x33')](handleEntityNotFound(_0x355eba,null))[_0x55b4('0x33')](function(_0x346044){if(_0x346044){_0x29c899=_0x346044;_0x43668e['model']=_[_0x55b4('0x3e')](db[_0x55b4('0x70')]['rawAttributes']);_0x43668e['query']=_['keys'](_0xf9b169[_0x55b4('0x3d')]);_0x43668e['filters']=_[_0x55b4('0x40')](_0x43668e[_0x55b4('0x3c')],_0x43668e['query']);_0xf0633d['attributes']=_[_0x55b4('0x40')](_0x43668e[_0x55b4('0x3c')],qs['fields'](_0xf9b169['query'][_0x55b4('0x42')]));_0xf0633d[_0x55b4('0x41')]=_0xf0633d[_0x55b4('0x41')]['length']?_0xf0633d[_0x55b4('0x41')]:_0x43668e['model'];_0xf0633d['order']=qs['sort'](_0xf9b169[_0x55b4('0x3d')][_0x55b4('0x46')]);_0xf0633d[_0x55b4('0x47')]=qs[_0x55b4('0x3f')](_[_0x55b4('0x48')](_0xf9b169[_0x55b4('0x3d')],_0x43668e[_0x55b4('0x3f')]));if(_0xf9b169[_0x55b4('0x3d')]['filter']){_0xf0633d[_0x55b4('0x47')]=_[_0x55b4('0x4a')](_0xf0633d[_0x55b4('0x47')],{'$or':_['map'](_0xf0633d[_0x55b4('0x41')],function(_0x3b7ea6){var _0x29a7cb={};_0x29a7cb[_0x3b7ea6]={'$like':'%'+_0xf9b169[_0x55b4('0x3d')][_0x55b4('0x49')]+'%'};return _0x29a7cb;})});}_0xf0633d=_[_0x55b4('0x4a')]({},_0xf0633d,_0xf9b169[_0x55b4('0x4c')]);return _0x29c899[_0x55b4('0x95')](_0xf0633d);}})[_0x55b4('0x33')](function(_0x15317c){if(_0x15317c){_0x235557=_0x15317c['length'];if(!_0xf9b169[_0x55b4('0x3d')][_0x55b4('0x62')](_0x55b4('0x44'))){_0xf0633d[_0x55b4('0x28')]=qs['limit'](_0xf9b169[_0x55b4('0x3d')][_0x55b4('0x28')]);_0xf0633d[_0x55b4('0x26')]=qs[_0x55b4('0x26')](_0xf9b169['query'][_0x55b4('0x26')]);}return _0x29c899[_0x55b4('0x95')](_0xf0633d);}})[_0x55b4('0x33')](function(_0x17fecd){if(_0x17fecd){return _0x17fecd?{'count':_0x235557,'rows':_0x17fecd}:null;}})[_0x55b4('0x33')](respondWithResult(_0x355eba,null))[_0x55b4('0x51')](handleError(_0x355eba,null));}; \ No newline at end of file +var _0x20a9=['path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','MailQueues','UserProfileResource','destroy','then','end','error','name','send','index','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','MailQueue','includeAll','include','findAll','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMembers','UserMailQueue','rawAttributes','MailQueueId','filter','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','SIP','getTeams','findOne','Team','addTeams','ids','User','Agents','online','voicePause','transaction','each','forEach','emit','removeTeams','select','tq.TeamId','from','join','user_has_teams','MailQueueId\x20=\x20?','clone','sequelize','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xfd983f,_0x2495c2){var _0x5a9986=function(_0x30fbd8){while(--_0x30fbd8){_0xfd983f['push'](_0xfd983f['shift']());}};_0x5a9986(++_0x2495c2);}(_0x20a9,0x113));var _0x920a=function(_0x51d71a,_0x596fda){_0x51d71a=_0x51d71a-0x0;var _0xff01f1=_0x20a9[_0x51d71a];return _0xff01f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x920a('0x0'));var jsonpatch=require(_0x920a('0x1'));var rp=require(_0x920a('0x2'));var moment=require(_0x920a('0x3'));var BPromise=require(_0x920a('0x4'));var Mustache=require(_0x920a('0x5'));var util=require(_0x920a('0x6'));var path=require(_0x920a('0x7'));var sox=require(_0x920a('0x8'));var csv=require(_0x920a('0x9'));var ejs=require(_0x920a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x920a('0xb'));var squel=require(_0x920a('0xc'));var crypto=require('crypto');var jsforce=require(_0x920a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x920a('0x9'));var querystring=require('querystring');var Papa=require(_0x920a('0xe'));var Redis=require(_0x920a('0xf'));var authService=require(_0x920a('0x10'));var qs=require(_0x920a('0x11'));var as=require(_0x920a('0x12'));var hardwareService=require(_0x920a('0x13'));var logger=require(_0x920a('0x14'))(_0x920a('0x15'));var utils=require(_0x920a('0x16'));var config=require(_0x920a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x920a('0x18'))['db'];config[_0x920a('0x19')]=_[_0x920a('0x1a')](config[_0x920a('0x19')],{'host':_0x920a('0x1b'),'port':0x18eb});var socket=require(_0x920a('0x1c'))(new Redis(config[_0x920a('0x19')]));require(_0x920a('0x1d'))[_0x920a('0x1e')](socket);function respondWithStatusCode(_0x2513b1,_0x347103){_0x347103=_0x347103||0xcc;return function(_0x309fb4){if(_0x309fb4){return _0x2513b1[_0x920a('0x1f')](_0x347103);}return _0x2513b1[_0x920a('0x20')](_0x347103)['end']();};}function respondWithResult(_0x5e5605,_0x29ec2a){_0x29ec2a=_0x29ec2a||0xc8;return function(_0x493a92){if(_0x493a92){return _0x5e5605[_0x920a('0x20')](_0x29ec2a)[_0x920a('0x21')](_0x493a92);}};}function respondWithFilteredResult(_0x3871a7,_0x13348e){return function(_0x2349e5){if(_0x2349e5){var _0x2b8953=typeof _0x13348e[_0x920a('0x22')]===_0x920a('0x23')&&typeof _0x13348e[_0x920a('0x24')]===_0x920a('0x23');var _0x430eb6=_0x2349e5[_0x920a('0x25')];var _0x5b446f=_0x2b8953?0x0:_0x13348e[_0x920a('0x22')];var _0x3a39c1=_0x2b8953?_0x2349e5[_0x920a('0x25')]:_0x13348e['offset']+_0x13348e['limit'];var _0x34d78f;if(_0x3a39c1>=_0x430eb6){_0x3a39c1=_0x430eb6;_0x34d78f=0xc8;}else{_0x34d78f=0xce;}_0x3871a7[_0x920a('0x20')](_0x34d78f);return _0x3871a7[_0x920a('0x26')](_0x920a('0x27'),_0x5b446f+'-'+_0x3a39c1+'/'+_0x430eb6)[_0x920a('0x21')](_0x2349e5);}return null;};}function patchUpdates(_0x52532a){return function(_0x568195){try{jsonpatch[_0x920a('0x28')](_0x568195,_0x52532a,!![]);}catch(_0x2b97dc){return BPromise[_0x920a('0x29')](_0x2b97dc);}return _0x568195[_0x920a('0x2a')]();};}function saveUpdates(_0x2fb14e,_0x27811c){return function(_0x2a3010){if(_0x2a3010){return _0x2a3010['update'](_0x2fb14e)['then'](function(_0x420637){return _0x420637;});}return null;};}function removeEntity(_0x4d8852,_0x36d050){return function(_0x118333){if(_0x118333){return _0x118333['destroy']()['then'](function(){var _0x45d0e1=_0x118333['get']({'plain':!![]});var _0xf2653d=_0x920a('0x2b');return db[_0x920a('0x2c')][_0x920a('0x2d')]({'where':{'type':_0xf2653d,'resourceId':_0x45d0e1['id']}})['then'](function(){return _0x118333;});})[_0x920a('0x2e')](function(){_0x4d8852['status'](0xcc)[_0x920a('0x2f')]();});}};}function handleEntityNotFound(_0x304c0b,_0x1aeaba){return function(_0x357cda){if(!_0x357cda){_0x304c0b[_0x920a('0x1f')](0x194);}return _0x357cda;};}function handleError(_0x2ca94d,_0x47cad8){_0x47cad8=_0x47cad8||0x1f4;return function(_0x27e6a3){logger[_0x920a('0x30')](_0x27e6a3['stack']);if(_0x27e6a3['name']){delete _0x27e6a3[_0x920a('0x31')];}_0x2ca94d[_0x920a('0x20')](_0x47cad8)[_0x920a('0x32')](_0x27e6a3);};}exports[_0x920a('0x33')]=function(_0x6d4a14,_0x48dee3){var _0x3f3dd9={},_0x2934bf={},_0x2c492e={'count':0x0,'rows':[]};var _0x2b19a3=_['map'](db['MailQueue']['rawAttributes'],function(_0x10c9fb){return{'name':_0x10c9fb['fieldName'],'type':_0x10c9fb[_0x920a('0x34')][_0x920a('0x35')]};});_0x2934bf[_0x920a('0x36')]=_['map'](_0x2b19a3,_0x920a('0x31'));_0x2934bf['query']=_[_0x920a('0x37')](_0x6d4a14[_0x920a('0x38')]);_0x2934bf[_0x920a('0x39')]=_['intersection'](_0x2934bf[_0x920a('0x36')],_0x2934bf['query']);_0x3f3dd9['attributes']=_[_0x920a('0x3a')](_0x2934bf[_0x920a('0x36')],qs[_0x920a('0x3b')](_0x6d4a14[_0x920a('0x38')][_0x920a('0x3b')]));_0x3f3dd9[_0x920a('0x3c')]=_0x3f3dd9[_0x920a('0x3c')]['length']?_0x3f3dd9[_0x920a('0x3c')]:_0x2934bf[_0x920a('0x36')];if(!_0x6d4a14[_0x920a('0x38')][_0x920a('0x3d')](_0x920a('0x3e'))){_0x3f3dd9[_0x920a('0x24')]=qs[_0x920a('0x24')](_0x6d4a14[_0x920a('0x38')][_0x920a('0x24')]);_0x3f3dd9['offset']=qs[_0x920a('0x22')](_0x6d4a14[_0x920a('0x38')][_0x920a('0x22')]);}_0x3f3dd9[_0x920a('0x3f')]=qs[_0x920a('0x40')](_0x6d4a14['query']['sort']);_0x3f3dd9[_0x920a('0x41')]=qs[_0x920a('0x39')](_[_0x920a('0x42')](_0x6d4a14[_0x920a('0x38')],_0x2934bf[_0x920a('0x39')]),_0x2b19a3);if(_0x6d4a14[_0x920a('0x38')]['filter']){_0x3f3dd9[_0x920a('0x41')]=_[_0x920a('0x43')](_0x3f3dd9['where'],{'$or':_[_0x920a('0x44')](_0x2b19a3,function(_0x4daa7a){if(_0x4daa7a['type']!=='VIRTUAL'){var _0x14ae9d={};_0x14ae9d[_0x4daa7a[_0x920a('0x31')]]={'$like':'%'+_0x6d4a14['query']['filter']+'%'};return _0x14ae9d;}})});}_0x3f3dd9=_['merge']({},_0x3f3dd9,_0x6d4a14[_0x920a('0x45')]);var _0x5d0137={'where':_0x3f3dd9[_0x920a('0x41')]};return db[_0x920a('0x46')][_0x920a('0x25')](_0x5d0137)[_0x920a('0x2e')](function(_0x2383c3){_0x2c492e[_0x920a('0x25')]=_0x2383c3;if(_0x6d4a14[_0x920a('0x38')][_0x920a('0x47')]){_0x3f3dd9[_0x920a('0x48')]=[{'all':!![]}];}return db[_0x920a('0x46')][_0x920a('0x49')](_0x3f3dd9);})[_0x920a('0x2e')](function(_0x5e3562){_0x2c492e['rows']=_0x5e3562;return _0x2c492e;})['then'](respondWithFilteredResult(_0x48dee3,_0x3f3dd9))['catch'](handleError(_0x48dee3,null));};exports['show']=function(_0x3a705d,_0x2d635e){var _0x53e9e4={'raw':!![],'where':{'id':_0x3a705d[_0x920a('0x4a')]['id']}},_0x15d285={};_0x15d285[_0x920a('0x36')]=_['keys'](db[_0x920a('0x46')]['rawAttributes']);_0x15d285['query']=_[_0x920a('0x37')](_0x3a705d[_0x920a('0x38')]);_0x15d285[_0x920a('0x39')]=_[_0x920a('0x3a')](_0x15d285[_0x920a('0x36')],_0x15d285[_0x920a('0x38')]);_0x53e9e4[_0x920a('0x3c')]=_[_0x920a('0x3a')](_0x15d285['model'],qs[_0x920a('0x3b')](_0x3a705d['query'][_0x920a('0x3b')]));_0x53e9e4[_0x920a('0x3c')]=_0x53e9e4[_0x920a('0x3c')][_0x920a('0x4b')]?_0x53e9e4[_0x920a('0x3c')]:_0x15d285[_0x920a('0x36')];if(_0x3a705d[_0x920a('0x38')][_0x920a('0x47')]){_0x53e9e4[_0x920a('0x48')]=[{'all':!![]}];}_0x53e9e4=_[_0x920a('0x43')]({},_0x53e9e4,_0x3a705d[_0x920a('0x45')]);return db[_0x920a('0x46')]['find'](_0x53e9e4)['then'](handleEntityNotFound(_0x2d635e,null))[_0x920a('0x2e')](respondWithResult(_0x2d635e,null))['catch'](handleError(_0x2d635e,null));};exports[_0x920a('0x4c')]=function(_0x5c9694,_0x52eeb2){return db[_0x920a('0x46')][_0x920a('0x4c')](_0x5c9694[_0x920a('0x4d')],{})[_0x920a('0x2e')](function(_0x22fb90){var _0x30c6f5=_0x5c9694[_0x920a('0x4e')][_0x920a('0x4f')]({'plain':!![]});if(!_0x30c6f5)throw new Error(_0x920a('0x50'));if(_0x30c6f5[_0x920a('0x51')]===_0x920a('0x4e')){var _0x5821f6=_0x22fb90[_0x920a('0x4f')]({'plain':!![]});var _0x44b99a=_0x920a('0x2b');return db[_0x920a('0x52')][_0x920a('0x53')]({'where':{'name':_0x44b99a,'userProfileId':_0x30c6f5[_0x920a('0x54')]},'raw':!![]})[_0x920a('0x2e')](function(_0x2a2fc0){if(_0x2a2fc0&&_0x2a2fc0[_0x920a('0x55')]===0x0){return db[_0x920a('0x2c')]['create']({'name':_0x5821f6[_0x920a('0x31')],'resourceId':_0x5821f6['id'],'type':_0x2a2fc0[_0x920a('0x31')],'sectionId':_0x2a2fc0['id']},{})[_0x920a('0x2e')](function(){return _0x22fb90;});}else{return _0x22fb90;}})[_0x920a('0x56')](function(_0x392aba){logger[_0x920a('0x30')](_0x920a('0x57'),_0x392aba);throw _0x392aba;});}return _0x22fb90;})[_0x920a('0x2e')](respondWithResult(_0x52eeb2,0xc9))[_0x920a('0x56')](handleError(_0x52eeb2,null));};exports[_0x920a('0x58')]=function(_0x419b2a,_0xddf13f){if(_0x419b2a[_0x920a('0x4d')]['id']){delete _0x419b2a[_0x920a('0x4d')]['id'];}return db['MailQueue'][_0x920a('0x53')]({'where':{'id':_0x419b2a[_0x920a('0x4a')]['id']}})['then'](handleEntityNotFound(_0xddf13f,null))['then'](saveUpdates(_0x419b2a[_0x920a('0x4d')],null))[_0x920a('0x2e')](respondWithResult(_0xddf13f,null))[_0x920a('0x56')](handleError(_0xddf13f,null));};exports['destroy']=function(_0x3e267a,_0x301e8d){return db['MailQueue'][_0x920a('0x53')]({'where':{'id':_0x3e267a[_0x920a('0x4a')]['id']}})[_0x920a('0x2e')](handleEntityNotFound(_0x301e8d,null))[_0x920a('0x2e')](removeEntity(_0x301e8d,null))[_0x920a('0x56')](handleError(_0x301e8d,null));};exports['describe']=function(_0x4e089d,_0x4e55d7){return db[_0x920a('0x46')]['describe']()['then'](respondWithResult(_0x4e55d7,null))[_0x920a('0x56')](handleError(_0x4e55d7,null));};exports[_0x920a('0x59')]=function(_0x2a9ac1,_0x54b439,_0x22db3a){var _0x4bb081={'raw':!![],'where':{}},_0x13fc04={},_0x1ca828;return db[_0x920a('0x46')]['findOne']({'where':{'id':_0x2a9ac1['params']['id']}})[_0x920a('0x2e')](handleEntityNotFound(_0x54b439,null))[_0x920a('0x2e')](function(_0x35b946){if(_0x35b946){_0x1ca828=_0x35b946[_0x920a('0x4f')]({'plain':!![]});_0x13fc04['model']=_['keys'](db[_0x920a('0x5a')][_0x920a('0x5b')]);_0x13fc04[_0x920a('0x38')]=_[_0x920a('0x37')](_0x2a9ac1['query']);_0x13fc04[_0x920a('0x39')]=_[_0x920a('0x3a')](_0x13fc04['model'],_0x13fc04['query']);_0x4bb081[_0x920a('0x3c')]=_[_0x920a('0x3a')](_0x13fc04[_0x920a('0x36')],qs[_0x920a('0x3b')](_0x2a9ac1['query'][_0x920a('0x3b')]));_0x4bb081[_0x920a('0x3c')]=_0x4bb081[_0x920a('0x3c')]['length']?_0x4bb081[_0x920a('0x3c')]:_0x13fc04[_0x920a('0x36')];if(!_0x2a9ac1['query'][_0x920a('0x3d')]('nolimit')){_0x4bb081[_0x920a('0x24')]=qs['limit'](_0x2a9ac1['query'][_0x920a('0x24')]);_0x4bb081[_0x920a('0x22')]=qs[_0x920a('0x22')](_0x2a9ac1[_0x920a('0x38')]['offset']);}_0x4bb081[_0x920a('0x3f')]=qs[_0x920a('0x40')](_0x2a9ac1['query'][_0x920a('0x40')]);_0x4bb081['where']=qs[_0x920a('0x39')](_[_0x920a('0x42')](_0x2a9ac1['query'],_0x13fc04['filters']));_0x4bb081[_0x920a('0x41')][_0x920a('0x5c')]=_0x35b946['id'];if(_0x2a9ac1['query'][_0x920a('0x5d')]){_0x4bb081['where']=_[_0x920a('0x43')](_0x4bb081[_0x920a('0x41')],{'$or':_[_0x920a('0x44')](_0x4bb081['attributes'],function(_0x18c4a6){var _0x19cc15={};_0x19cc15[_0x18c4a6]={'$like':'%'+_0x2a9ac1['query'][_0x920a('0x5d')]+'%'};return _0x19cc15;})});}_0x4bb081=_[_0x920a('0x43')]({},_0x4bb081,_0x2a9ac1[_0x920a('0x45')]);return db[_0x920a('0x5a')][_0x920a('0x49')](_0x4bb081);}})[_0x920a('0x2e')](function(_0x34d233){if(_0x34d233){return db['User'][_0x920a('0x5e')]({'where':{'id':_[_0x920a('0x44')](_0x34d233,_0x920a('0x5f')),'role':_0x920a('0x60')},'attributes':['id',_0x920a('0x31'),_0x920a('0x61'),_0x920a('0x62'),_0x920a('0x63')]});}})['then'](function(_0x141bcc){if(_0x141bcc){return{'count':_0x141bcc[_0x920a('0x25')],'rows':_[_0x920a('0x44')](_0x141bcc[_0x920a('0x64')],function(_0x994a60){return{'membername':_0x994a60[_0x920a('0x31')],'UserId':_0x994a60['id'],'queue_name':_0x1ca828['name'],'MailQueueId':_0x1ca828['id'],'interface':util[_0x920a('0x65')]('%s/%s',_0x920a('0x66'),_0x994a60[_0x920a('0x31')]),'penalty':0x0,'paused':_0x994a60['mailPause'],'createdAt':_0x994a60['createdAt'],'updatedAt':_0x994a60[_0x920a('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x920a('0x2e')](respondWithFilteredResult(_0x54b439,_0x4bb081))['catch'](handleError(_0x54b439,null));};exports[_0x920a('0x67')]=function(_0x25fb37,_0x47c6ae,_0x2a9179){var _0x487b93={};var _0x2c6c2a={};var _0xf6fe52;var _0x49b9d9;return db['MailQueue'][_0x920a('0x68')]({'where':{'id':_0x25fb37[_0x920a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x47c6ae,null))[_0x920a('0x2e')](function(_0xbe023){if(_0xbe023){_0xf6fe52=_0xbe023;_0x2c6c2a[_0x920a('0x36')]=_[_0x920a('0x37')](db[_0x920a('0x69')][_0x920a('0x5b')]);_0x2c6c2a[_0x920a('0x38')]=_[_0x920a('0x37')](_0x25fb37[_0x920a('0x38')]);_0x2c6c2a[_0x920a('0x39')]=_[_0x920a('0x3a')](_0x2c6c2a[_0x920a('0x36')],_0x2c6c2a[_0x920a('0x38')]);_0x487b93[_0x920a('0x3c')]=_[_0x920a('0x3a')](_0x2c6c2a[_0x920a('0x36')],qs['fields'](_0x25fb37['query'][_0x920a('0x3b')]));_0x487b93[_0x920a('0x3c')]=_0x487b93['attributes'][_0x920a('0x4b')]?_0x487b93[_0x920a('0x3c')]:_0x2c6c2a[_0x920a('0x36')];_0x487b93[_0x920a('0x3f')]=qs['sort'](_0x25fb37['query'][_0x920a('0x40')]);_0x487b93['where']=qs[_0x920a('0x39')](_['pick'](_0x25fb37['query'],_0x2c6c2a[_0x920a('0x39')]));if(_0x25fb37[_0x920a('0x38')][_0x920a('0x5d')]){_0x487b93[_0x920a('0x41')]=_[_0x920a('0x43')](_0x487b93[_0x920a('0x41')],{'$or':_[_0x920a('0x44')](_0x487b93[_0x920a('0x3c')],function(_0x5b502f){var _0x2a3d01={};_0x2a3d01[_0x5b502f]={'$like':'%'+_0x25fb37[_0x920a('0x38')]['filter']+'%'};return _0x2a3d01;})});}_0x487b93=_[_0x920a('0x43')]({},_0x487b93,_0x25fb37[_0x920a('0x45')]);return _0xf6fe52[_0x920a('0x67')](_0x487b93);}})[_0x920a('0x2e')](function(_0x4768e4){if(_0x4768e4){_0x49b9d9=_0x4768e4[_0x920a('0x4b')];if(!_0x25fb37[_0x920a('0x38')][_0x920a('0x3d')](_0x920a('0x3e'))){_0x487b93[_0x920a('0x24')]=qs[_0x920a('0x24')](_0x25fb37[_0x920a('0x38')][_0x920a('0x24')]);_0x487b93[_0x920a('0x22')]=qs[_0x920a('0x22')](_0x25fb37['query'][_0x920a('0x22')]);}return _0xf6fe52['getTeams'](_0x487b93);}})[_0x920a('0x2e')](function(_0xe1557e){if(_0xe1557e){return _0xe1557e?{'count':_0x49b9d9,'rows':_0xe1557e}:null;}})[_0x920a('0x2e')](respondWithResult(_0x47c6ae,null))[_0x920a('0x56')](handleError(_0x47c6ae,null));};exports[_0x920a('0x6a')]=function(_0x3de80f,_0x4c1df3,_0x1eb7d4){var _0x3c7955=_0x3de80f['body'][_0x920a('0x6b')];return db[_0x920a('0x69')][_0x920a('0x49')]({'where':{'id':_0x3c7955},'attributes':['id'],'include':[{'model':db[_0x920a('0x6c')],'as':_0x920a('0x6d'),'attributes':['id',_0x920a('0x31'),_0x920a('0x6e'),_0x920a('0x6f'),'interface'],'raw':!![]}]})[_0x920a('0x2e')](function(_0x1e3257){if(_0x1e3257){var _0x788a51=_['flatMap'](_0x1e3257,function(_0x41e05e){var _0x2a0a6f=_0x41e05e['get']({'plain':!![]});return _0x2a0a6f[_0x920a('0x6d')];});return db[_0x920a('0x46')]['find']({'where':{'id':_0x3de80f[_0x920a('0x4a')]['id']}})['then'](function(_0x29852c){return db['sequelize'][_0x920a('0x70')](function(_0x52b0ce){return _0x29852c[_0x920a('0x6a')](_0x3c7955,{'transaction':_0x52b0ce})[_0x920a('0x2e')](function(){return BPromise[_0x920a('0x71')](_0x788a51,function(_0x1845ef){return db[_0x920a('0x5a')]['findOrCreate']({'where':{'UserId':_0x1845ef['id'],'MailQueueId':_0x3de80f[_0x920a('0x4a')]['id']},'transaction':_0x52b0ce});});})[_0x920a('0x2e')](function(){_0x788a51[_0x920a('0x72')](function(_0xc25a4c){socket[_0x920a('0x73')]('userMailQueue:save',{'UserId':_0xc25a4c['id'],'MailQueueId':_0x29852c['id']});});});});});}})[_0x920a('0x2e')](respondWithStatusCode(_0x4c1df3,null))[_0x920a('0x56')](handleError(_0x4c1df3,null));};exports[_0x920a('0x74')]=function(_0x38aa95,_0x12aa46,_0x151b6b){return db[_0x920a('0x69')][_0x920a('0x49')]({'where':{'id':_0x38aa95[_0x920a('0x38')][_0x920a('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x920a('0x6c')],'as':_0x920a('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x920a('0x2e')](handleEntityNotFound(_0x12aa46,null))[_0x920a('0x2e')](function(_0x4f6f4f){var _0x5703d4=_[_0x920a('0x44')](_0x4f6f4f,'id');var _0x253544=[];var _0x1d80e1=[];var _0xbcd26e=squel[_0x920a('0x75')]();_0xbcd26e['field'](_0x920a('0x76'))[_0x920a('0x77')]('team_has_mail_queues','tq')[_0x920a('0x78')](_0x920a('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x920a('0x41')](_0x920a('0x7a'),_0x38aa95[_0x920a('0x4a')]['id']);for(var _0x499f83=0x0;_0x499f83<_0x4f6f4f['length'];_0x499f83+=0x1){let _0x4cf36e=_0x4f6f4f[_0x499f83];for(var _0x2c2946=0x0;_0x2c2946<_0x4cf36e['Agents'][_0x920a('0x4b')];_0x2c2946+=0x1){let _0x30cd79=_0x4cf36e['Agents'][_0x2c2946];var _0x73ae6d=_0xbcd26e[_0x920a('0x7b')]();_0x73ae6d[_0x920a('0x41')]('ut.UserId\x20=\x20?',_0x30cd79['id']);_0x1d80e1['push'](db[_0x920a('0x7c')][_0x920a('0x38')](_0x73ae6d[_0x920a('0x7d')](),{'type':db[_0x920a('0x7c')]['QueryTypes'][_0x920a('0x7e')]})[_0x920a('0x2e')](function(_0x1b6a07){if(_0x1b6a07[_0x920a('0x4b')]===0x1){return _0x30cd79['id'];}else{var _0x1d45e1=_[_0x920a('0x7f')](_[_0x920a('0x44')](_0x1b6a07,_0x920a('0x80')),function(_0x5f2bab){return _['includes'](_0x5703d4,_0x5f2bab);});if(_0x1d45e1){return _0x30cd79['id'];}}}));}}return BPromise[_0x920a('0x81')](_0x1d80e1)[_0x920a('0x2e')](function(_0xbe505d){_0x253544=_(_0x253544)[_0x920a('0x82')](_0xbe505d)[_0x920a('0x83')]()[_0x920a('0x84')]();return db[_0x920a('0x46')][_0x920a('0x53')]({'where':{'id':_0x38aa95['params']['id']}})[_0x920a('0x2e')](function(_0xc717c0){return db['sequelize'][_0x920a('0x70')](function(_0x12eb8a){return _0xc717c0[_0x920a('0x74')](_0x38aa95['query'][_0x920a('0x6b')],{'transaction':_0x12eb8a})[_0x920a('0x2e')](function(){if(!_[_0x920a('0x85')](_0x253544)){return _0xc717c0[_0x920a('0x86')](_0x253544,{'transaction':_0x12eb8a});}})[_0x920a('0x2e')](function(){_0x253544[_0x920a('0x72')](function(_0x572cc7){socket[_0x920a('0x73')](_0x920a('0x87'),{'UserId':_0x572cc7,'MailQueueId':_0xc717c0['id']});});});});});});})[_0x920a('0x2e')](respondWithStatusCode(_0x12aa46,null))[_0x920a('0x56')](handleError(_0x12aa46,null));};exports[_0x920a('0x88')]=function(_0x1a57da,_0x44df85,_0x595ff4){return db[_0x920a('0x46')]['find']({'where':{'id':_0x1a57da['params']['id']}})['then'](handleEntityNotFound(_0x44df85,null))['then'](function(_0x173262){if(_0x173262){return _0x173262[_0x920a('0x88')](_0x1a57da[_0x920a('0x4d')][_0x920a('0x6b')],_[_0x920a('0x89')](_0x1a57da[_0x920a('0x4d')],['ids','id'])||{})['spread'](function(_0x2ba493){for(var _0x4eff99=0x0;_0x4eff99<_0x1a57da[_0x920a('0x4d')][_0x920a('0x6b')][_0x920a('0x4b')];_0x4eff99+=0x1){socket[_0x920a('0x73')](_0x920a('0x8a'),{'UserId':Number(_0x1a57da['body'][_0x920a('0x6b')][_0x4eff99]),'MailQueueId':Number(_0x1a57da[_0x920a('0x4a')]['id'])});}return _0x2ba493;});}})[_0x920a('0x2e')](respondWithResult(_0x44df85,null))['catch'](handleError(_0x44df85,null));};exports[_0x920a('0x86')]=function(_0x403525,_0x4e0443,_0x14aac1){return db[_0x920a('0x46')][_0x920a('0x53')]({'where':{'id':_0x403525['params']['id']}})[_0x920a('0x2e')](handleEntityNotFound(_0x4e0443,null))[_0x920a('0x2e')](function(_0x530823){if(_0x530823){return _0x530823['removeAgents'](_0x403525[_0x920a('0x38')][_0x920a('0x6b')])[_0x920a('0x2e')](function(){if(_[_0x920a('0x8b')](_0x403525[_0x920a('0x38')][_0x920a('0x6b')])){for(var _0x3a47b9=0x0;_0x3a47b9<_0x403525['query']['ids'][_0x920a('0x4b')];_0x3a47b9+=0x1){socket[_0x920a('0x73')](_0x920a('0x87'),{'UserId':Number(_0x403525[_0x920a('0x38')]['ids'][_0x3a47b9]),'MailQueueId':Number(_0x403525['params']['id'])});}}else{socket[_0x920a('0x73')](_0x920a('0x87'),{'UserId':Number(_0x403525['query'][_0x920a('0x6b')]),'MailQueueId':Number(_0x403525[_0x920a('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e0443,null))[_0x920a('0x56')](handleError(_0x4e0443,null));};exports[_0x920a('0x8c')]=function(_0x3457e9,_0x30f87f,_0x23d060){var _0x5e37f0={};var _0x4efb41={};var _0x49b09a;var _0x5799b3;return db[_0x920a('0x46')][_0x920a('0x68')]({'where':{'id':_0x3457e9['params']['id']}})[_0x920a('0x2e')](handleEntityNotFound(_0x30f87f,null))[_0x920a('0x2e')](function(_0x2624d9){if(_0x2624d9){_0x49b09a=_0x2624d9;_0x4efb41[_0x920a('0x36')]=_[_0x920a('0x37')](db[_0x920a('0x6c')][_0x920a('0x5b')]);_0x4efb41[_0x920a('0x38')]=_[_0x920a('0x37')](_0x3457e9['query']);_0x4efb41[_0x920a('0x39')]=_[_0x920a('0x3a')](_0x4efb41[_0x920a('0x36')],_0x4efb41[_0x920a('0x38')]);_0x5e37f0[_0x920a('0x3c')]=_[_0x920a('0x3a')](_0x4efb41['model'],qs[_0x920a('0x3b')](_0x3457e9[_0x920a('0x38')][_0x920a('0x3b')]));_0x5e37f0[_0x920a('0x3c')]=_0x5e37f0[_0x920a('0x3c')][_0x920a('0x4b')]?_0x5e37f0[_0x920a('0x3c')]:_0x4efb41[_0x920a('0x36')];_0x5e37f0[_0x920a('0x3f')]=qs[_0x920a('0x40')](_0x3457e9[_0x920a('0x38')][_0x920a('0x40')]);_0x5e37f0[_0x920a('0x41')]=qs['filters'](_[_0x920a('0x42')](_0x3457e9[_0x920a('0x38')],_0x4efb41[_0x920a('0x39')]));if(_0x3457e9[_0x920a('0x38')]['filter']){_0x5e37f0['where']=_[_0x920a('0x43')](_0x5e37f0['where'],{'$or':_[_0x920a('0x44')](_0x5e37f0[_0x920a('0x3c')],function(_0x19e88d){var _0x128ab0={};_0x128ab0[_0x19e88d]={'$like':'%'+_0x3457e9[_0x920a('0x38')][_0x920a('0x5d')]+'%'};return _0x128ab0;})});}_0x5e37f0=_[_0x920a('0x43')]({},_0x5e37f0,_0x3457e9['options']);return _0x49b09a['getAgents'](_0x5e37f0);}})[_0x920a('0x2e')](function(_0x3464fa){if(_0x3464fa){_0x5799b3=_0x3464fa['length'];if(!_0x3457e9[_0x920a('0x38')][_0x920a('0x3d')](_0x920a('0x3e'))){_0x5e37f0[_0x920a('0x24')]=qs[_0x920a('0x24')](_0x3457e9[_0x920a('0x38')][_0x920a('0x24')]);_0x5e37f0['offset']=qs[_0x920a('0x22')](_0x3457e9[_0x920a('0x38')][_0x920a('0x22')]);}return _0x49b09a[_0x920a('0x8c')](_0x5e37f0);}})[_0x920a('0x2e')](function(_0x3d86bd){if(_0x3d86bd){return _0x3d86bd?{'count':_0x5799b3,'rows':_0x3d86bd}:null;}})[_0x920a('0x2e')](respondWithResult(_0x30f87f,null))[_0x920a('0x56')](handleError(_0x30f87f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 358e5c5..29775ac 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 _0x3bcd=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x139b41,_0x2e1943){var _0x34101e=function(_0x55d838){while(--_0x55d838){_0x139b41['push'](_0x139b41['shift']());}};_0x34101e(++_0x2e1943);}(_0x3bcd,0x66));var _0xd3bc=function(_0x7a242a,_0x423353){_0x7a242a=_0x7a242a-0x0;var _0x3b20c3=_0x3bcd[_0x7a242a];return _0x3b20c3;};'use strict';var EventEmitter=require(_0xd3bc('0x0'));var MailQueue=require(_0xd3bc('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd3bc('0x2')](0x0);var events={'afterCreate':_0xd3bc('0x3'),'afterUpdate':_0xd3bc('0x4'),'afterDestroy':_0xd3bc('0x5')};function emitEvent(_0x590fe0){return function(_0x3c2543,_0x5dc94d,_0x3f97be){MailQueueEvents[_0xd3bc('0x6')](_0x590fe0+':'+_0x3c2543['id'],_0x3c2543);MailQueueEvents[_0xd3bc('0x6')](_0x590fe0,_0x3c2543);_0x3f97be(null);};}for(var e in events){if(events[_0xd3bc('0x7')](e)){var event=events[e];MailQueue[_0xd3bc('0x8')](e,emitEvent(event));}}module[_0xd3bc('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x08be=['events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x3783dd,_0x159064){var _0x5a71d9=function(_0x2484fa){while(--_0x2484fa){_0x3783dd['push'](_0x3783dd['shift']());}};_0x5a71d9(++_0x159064);}(_0x08be,0x183));var _0xe08b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x08be[_0x1facfa];return _0x9ec701;};'use strict';var EventEmitter=require(_0xe08b('0x0'));var MailQueue=require(_0xe08b('0x1'))['db'][_0xe08b('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xe08b('0x3')](0x0);var events={'afterCreate':_0xe08b('0x4'),'afterUpdate':'update','afterDestroy':_0xe08b('0x5')};function emitEvent(_0xc267a){return function(_0x4515aa,_0xd586c2,_0x4f4e46){MailQueueEvents[_0xe08b('0x6')](_0xc267a+':'+_0x4515aa['id'],_0x4515aa);MailQueueEvents[_0xe08b('0x6')](_0xc267a,_0x4515aa);_0x4f4e46(null);};}for(var e in events){if(events[_0xe08b('0x7')](e)){var event=events[e];MailQueue[_0xe08b('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 31af21f..7474e99 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 _0xab46=['./mailQueue.attributes','exports','define','MailQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3a3d83,_0x419a5a){var _0x2b9c43=function(_0xf5df50){while(--_0xf5df50){_0x3a3d83['push'](_0x3a3d83['shift']());}};_0x2b9c43(++_0x419a5a);}(_0xab46,0x10c));var _0x6ab4=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0xab46[_0xd299c3];return _0x376574;};'use strict';var _=require(_0x6ab4('0x0'));var util=require('util');var logger=require(_0x6ab4('0x1'))(_0x6ab4('0x2'));var moment=require(_0x6ab4('0x3'));var BPromise=require(_0x6ab4('0x4'));var rp=require(_0x6ab4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6ab4('0x6'));var config=require(_0x6ab4('0x7'));var attributes=require(_0x6ab4('0x8'));module[_0x6ab4('0x9')]=function(_0x2355bf,_0x5dc95e){return _0x2355bf[_0x6ab4('0xa')](_0x6ab4('0xb'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ab6=['../../config/logger','api','moment','bluebird','rimraf','./mailQueue.attributes','define','MailQueue','mail_queues','lodash'];(function(_0x47b4b4,_0x1c75ee){var _0x546f72=function(_0xd7fd20){while(--_0xd7fd20){_0x47b4b4['push'](_0x47b4b4['shift']());}};_0x546f72(++_0x1c75ee);}(_0x1ab6,0xbd));var _0x61ab=function(_0x43d016,_0xe5a028){_0x43d016=_0x43d016-0x0;var _0xf45747=_0x1ab6[_0x43d016];return _0xf45747;};'use strict';var _=require(_0x61ab('0x0'));var util=require('util');var logger=require(_0x61ab('0x1'))(_0x61ab('0x2'));var moment=require(_0x61ab('0x3'));var BPromise=require(_0x61ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x61ab('0x5'));var config=require('../../config/environment');var attributes=require(_0x61ab('0x6'));module['exports']=function(_0x19f330,_0x1d02ac){return _0x19f330[_0x61ab('0x7')](_0x61ab('0x8'),attributes,{'tableName':_0x61ab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 24be6f3..2565ed4 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 _0xb93f=['defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','MailQueue,\x20%s,\x20%s','result','catch','MailQueue','findAll','options','raw','attributes','include','map','model','GetMailQueue','ShowMailQueue','find','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http'];(function(_0xad5ac0,_0x45df5a){var _0x544129=function(_0x4db235){while(--_0x4db235){_0xad5ac0['push'](_0xad5ac0['shift']());}};_0x544129(++_0x45df5a);}(_0xb93f,0x67));var _0xfb93=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0xb93f[_0x42c118];return _0x112ebd;};'use strict';var _=require(_0xfb93('0x0'));var util=require(_0xfb93('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb93('0x2'));var db=require(_0xfb93('0x3'))['db'];var utils=require(_0xfb93('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xfb93('0x5'));var jayson=require(_0xfb93('0x6'));var client=jayson['client'][_0xfb93('0x7')]({'port':0x232a});config['redis']=_[_0xfb93('0x8')](config[_0xfb93('0x9')],{'host':_0xfb93('0xa'),'port':0x18eb});var socket=require(_0xfb93('0xb'))(new Redis(config['redis']));require(_0xfb93('0xc'))[_0xfb93('0xd')](socket);function respondWithRpcPromise(_0x576fee,_0x3230b2,_0x37d100){return new BPromise(function(_0x2559f0,_0x49cd44){return client[_0xfb93('0xe')](_0x576fee,_0x37d100)[_0xfb93('0xf')](function(_0x66365d){logger[_0xfb93('0x10')]('MailQueue,\x20%s,\x20%s',_0x3230b2,_0xfb93('0x11'));logger[_0xfb93('0x12')](_0xfb93('0x13'),_0x3230b2,_0xfb93('0x11'),JSON[_0xfb93('0x14')](_0x66365d));if(_0x66365d[_0xfb93('0x15')]){if(_0x66365d[_0xfb93('0x15')]['code']===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x3230b2,_0x66365d[_0xfb93('0x15')][_0xfb93('0x16')]);return _0x49cd44(_0x66365d['error'][_0xfb93('0x16')]);}logger['error'](_0xfb93('0x17'),_0x3230b2,_0x66365d[_0xfb93('0x15')][_0xfb93('0x16')]);return _0x2559f0(_0x66365d['error']['message']);}else{logger[_0xfb93('0x10')]('MailQueue,\x20%s,\x20%s',_0x3230b2,_0xfb93('0x11'));_0x2559f0(_0x66365d[_0xfb93('0x18')][_0xfb93('0x16')]);}})[_0xfb93('0x19')](function(_0x42778f){logger[_0xfb93('0x15')]('MailQueue,\x20%s,\x20%s',_0x3230b2,_0x42778f);_0x49cd44(_0x42778f);});});}exports['GetMailQueue']=function(_0x1299aa){var _0x416ecf=this;return new Promise(function(_0x2d309c,_0x39fdbc){return db[_0xfb93('0x1a')][_0xfb93('0x1b')]({'raw':_0x1299aa[_0xfb93('0x1c')]?_0x1299aa[_0xfb93('0x1c')][_0xfb93('0x1d')]===undefined?!![]:![]:!![],'where':_0x1299aa[_0xfb93('0x1c')]?_0x1299aa[_0xfb93('0x1c')]['where']||null:null,'attributes':_0x1299aa['options']?_0x1299aa[_0xfb93('0x1c')][_0xfb93('0x1e')]||null:null,'limit':_0x1299aa[_0xfb93('0x1c')]?_0x1299aa[_0xfb93('0x1c')]['limit']||null:null,'include':_0x1299aa[_0xfb93('0x1c')]?_0x1299aa[_0xfb93('0x1c')][_0xfb93('0x1f')]?_[_0xfb93('0x20')](_0x1299aa[_0xfb93('0x1c')]['include'],function(_0x545620){return{'model':db[_0x545620['model']],'as':_0x545620['as'],'attributes':_0x545620['attributes'],'include':_0x545620[_0xfb93('0x1f')]?_[_0xfb93('0x20')](_0x545620['include'],function(_0x5a1b6f){return{'model':db[_0x5a1b6f['model']],'as':_0x5a1b6f['as'],'attributes':_0x5a1b6f[_0xfb93('0x1e')],'include':_0x5a1b6f[_0xfb93('0x1f')]?_[_0xfb93('0x20')](_0x5a1b6f[_0xfb93('0x1f')],function(_0x36313e){return{'model':db[_0x36313e[_0xfb93('0x21')]],'as':_0x36313e['as'],'attributes':_0x36313e[_0xfb93('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfb93('0xf')](function(_0x4ab89b){logger['info'](_0xfb93('0x22'),_0x1299aa);logger[_0xfb93('0x12')](_0xfb93('0x22'),_0x1299aa,JSON[_0xfb93('0x14')](_0x4ab89b));_0x2d309c(_0x4ab89b);})[_0xfb93('0x19')](function(_0x3b77d2){logger[_0xfb93('0x15')]('GetMailQueue',_0x3b77d2[_0xfb93('0x16')],_0x1299aa);_0x39fdbc(_0x416ecf[_0xfb93('0x15')](0x1f4,_0x3b77d2[_0xfb93('0x16')]));});});};exports[_0xfb93('0x23')]=function(_0x4bcdd7){var _0x250f64=this;return new Promise(function(_0x5f250e,_0x2b4139){return db[_0xfb93('0x1a')][_0xfb93('0x24')]({'raw':_0x4bcdd7['options']?_0x4bcdd7[_0xfb93('0x1c')][_0xfb93('0x1d')]===undefined?!![]:![]:!![],'where':_0x4bcdd7[_0xfb93('0x1c')]?_0x4bcdd7[_0xfb93('0x1c')]['where']||null:null,'attributes':_0x4bcdd7['options']?_0x4bcdd7[_0xfb93('0x1c')][_0xfb93('0x1e')]||null:null,'include':_0x4bcdd7[_0xfb93('0x1c')]?_0x4bcdd7[_0xfb93('0x1c')]['include']?_['map'](_0x4bcdd7[_0xfb93('0x1c')][_0xfb93('0x1f')],function(_0x3920cd){return{'model':db[_0x3920cd[_0xfb93('0x21')]],'as':_0x3920cd['as'],'attributes':_0x3920cd[_0xfb93('0x1e')],'include':_0x3920cd[_0xfb93('0x1f')]?_[_0xfb93('0x20')](_0x3920cd[_0xfb93('0x1f')],function(_0x232875){return{'model':db[_0x232875[_0xfb93('0x21')]],'as':_0x232875['as'],'attributes':_0x232875[_0xfb93('0x1e')],'include':_0x232875['include']?_[_0xfb93('0x20')](_0x232875[_0xfb93('0x1f')],function(_0x3ede71){return{'model':db[_0x3ede71[_0xfb93('0x21')]],'as':_0x3ede71['as'],'attributes':_0x3ede71[_0xfb93('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfb93('0xf')](function(_0xd379e){logger['info'](_0xfb93('0x23'),_0x4bcdd7);logger[_0xfb93('0x12')](_0xfb93('0x23'),_0x4bcdd7,JSON[_0xfb93('0x14')](_0xd379e));_0x5f250e(_0xd379e);})[_0xfb93('0x19')](function(_0x8505f){logger[_0xfb93('0x15')](_0xfb93('0x23'),_0x8505f[_0xfb93('0x16')],_0x4bcdd7);_0x2b4139(_0x250f64[_0xfb93('0x15')](0x1f4,_0x8505f['message']));});});}; \ No newline at end of file +var _0xa74d=['GetMailQueue','options','raw','attributes','limit','include','map','model','catch','MailQueue','where','ShowMailQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','request','then','info','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','result'];(function(_0x57199a,_0xeee9e2){var _0x352279=function(_0x48b979){while(--_0x48b979){_0x57199a['push'](_0x57199a['shift']());}};_0x352279(++_0xeee9e2);}(_0xa74d,0x1cf));var _0xda74=function(_0x12c9ec,_0x603b97){_0x12c9ec=_0x12c9ec-0x0;var _0x152942=_0xa74d[_0x12c9ec];return _0x152942;};'use strict';var _=require('lodash');var util=require(_0xda74('0x0'));var moment=require(_0xda74('0x1'));var BPromise=require(_0xda74('0x2'));var rs=require(_0xda74('0x3'));var fs=require('fs');var Redis=require(_0xda74('0x4'));var db=require(_0xda74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xda74('0x6'))(_0xda74('0x7'));var config=require(_0xda74('0x8'));var jayson=require(_0xda74('0x9'));var client=jayson[_0xda74('0xa')][_0xda74('0xb')]({'port':0x232a});config[_0xda74('0xc')]=_[_0xda74('0xd')](config['redis'],{'host':_0xda74('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xda74('0xf'))[_0xda74('0x10')](socket);function respondWithRpcPromise(_0x4f7fab,_0x3804cc,_0x3f55ac){return new BPromise(function(_0x3180c3,_0x15fd0d){return client[_0xda74('0x11')](_0x4f7fab,_0x3f55ac)[_0xda74('0x12')](function(_0x25a4b4){logger[_0xda74('0x13')]('MailQueue,\x20%s,\x20%s',_0x3804cc,_0xda74('0x14'));logger[_0xda74('0x15')](_0xda74('0x16'),_0x3804cc,'request\x20sent',JSON[_0xda74('0x17')](_0x25a4b4));if(_0x25a4b4[_0xda74('0x18')]){if(_0x25a4b4[_0xda74('0x18')][_0xda74('0x19')]===0x1f4){logger[_0xda74('0x18')](_0xda74('0x1a'),_0x3804cc,_0x25a4b4[_0xda74('0x18')]['message']);return _0x15fd0d(_0x25a4b4[_0xda74('0x18')][_0xda74('0x1b')]);}logger[_0xda74('0x18')](_0xda74('0x1a'),_0x3804cc,_0x25a4b4[_0xda74('0x18')]['message']);return _0x3180c3(_0x25a4b4[_0xda74('0x18')][_0xda74('0x1b')]);}else{logger[_0xda74('0x13')](_0xda74('0x1a'),_0x3804cc,_0xda74('0x14'));_0x3180c3(_0x25a4b4[_0xda74('0x1c')][_0xda74('0x1b')]);}})['catch'](function(_0x260e33){logger[_0xda74('0x18')](_0xda74('0x1a'),_0x3804cc,_0x260e33);_0x15fd0d(_0x260e33);});});}exports[_0xda74('0x1d')]=function(_0xd07402){var _0x3fb049=this;return new Promise(function(_0x2ba203,_0x291dd6){return db['MailQueue']['findAll']({'raw':_0xd07402['options']?_0xd07402[_0xda74('0x1e')][_0xda74('0x1f')]===undefined?!![]:![]:!![],'where':_0xd07402[_0xda74('0x1e')]?_0xd07402[_0xda74('0x1e')]['where']||null:null,'attributes':_0xd07402['options']?_0xd07402[_0xda74('0x1e')][_0xda74('0x20')]||null:null,'limit':_0xd07402[_0xda74('0x1e')]?_0xd07402[_0xda74('0x1e')][_0xda74('0x21')]||null:null,'include':_0xd07402[_0xda74('0x1e')]?_0xd07402[_0xda74('0x1e')][_0xda74('0x22')]?_[_0xda74('0x23')](_0xd07402[_0xda74('0x1e')][_0xda74('0x22')],function(_0x5a01d4){return{'model':db[_0x5a01d4[_0xda74('0x24')]],'as':_0x5a01d4['as'],'attributes':_0x5a01d4[_0xda74('0x20')],'include':_0x5a01d4['include']?_[_0xda74('0x23')](_0x5a01d4[_0xda74('0x22')],function(_0x1e6083){return{'model':db[_0x1e6083[_0xda74('0x24')]],'as':_0x1e6083['as'],'attributes':_0x1e6083[_0xda74('0x20')],'include':_0x1e6083['include']?_['map'](_0x1e6083[_0xda74('0x22')],function(_0x4d0098){return{'model':db[_0x4d0098[_0xda74('0x24')]],'as':_0x4d0098['as'],'attributes':_0x4d0098[_0xda74('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e0bdb){logger['info'](_0xda74('0x1d'),_0xd07402);logger[_0xda74('0x15')](_0xda74('0x1d'),_0xd07402,JSON['stringify'](_0x2e0bdb));_0x2ba203(_0x2e0bdb);})[_0xda74('0x25')](function(_0x46dee0){logger[_0xda74('0x18')](_0xda74('0x1d'),_0x46dee0['message'],_0xd07402);_0x291dd6(_0x3fb049[_0xda74('0x18')](0x1f4,_0x46dee0[_0xda74('0x1b')]));});});};exports['ShowMailQueue']=function(_0xe6b39){var _0x3f7eed=this;return new Promise(function(_0x3560c3,_0x3a076c){return db[_0xda74('0x26')]['find']({'raw':_0xe6b39[_0xda74('0x1e')]?_0xe6b39[_0xda74('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xe6b39['options']?_0xe6b39[_0xda74('0x1e')][_0xda74('0x27')]||null:null,'attributes':_0xe6b39[_0xda74('0x1e')]?_0xe6b39[_0xda74('0x1e')][_0xda74('0x20')]||null:null,'include':_0xe6b39[_0xda74('0x1e')]?_0xe6b39['options'][_0xda74('0x22')]?_[_0xda74('0x23')](_0xe6b39[_0xda74('0x1e')][_0xda74('0x22')],function(_0x3c2214){return{'model':db[_0x3c2214['model']],'as':_0x3c2214['as'],'attributes':_0x3c2214[_0xda74('0x20')],'include':_0x3c2214[_0xda74('0x22')]?_[_0xda74('0x23')](_0x3c2214[_0xda74('0x22')],function(_0x1361b1){return{'model':db[_0x1361b1[_0xda74('0x24')]],'as':_0x1361b1['as'],'attributes':_0x1361b1[_0xda74('0x20')],'include':_0x1361b1[_0xda74('0x22')]?_[_0xda74('0x23')](_0x1361b1[_0xda74('0x22')],function(_0x5b727e){return{'model':db[_0x5b727e[_0xda74('0x24')]],'as':_0x5b727e['as'],'attributes':_0x5b727e[_0xda74('0x20')]};}):[]};}):[]};}):[]:[]})[_0xda74('0x12')](function(_0x75e614){logger[_0xda74('0x13')]('ShowMailQueue',_0xe6b39);logger[_0xda74('0x15')]('ShowMailQueue',_0xe6b39,JSON[_0xda74('0x17')](_0x75e614));_0x3560c3(_0x75e614);})[_0xda74('0x25')](function(_0x3078a9){logger[_0xda74('0x18')](_0xda74('0x28'),_0x3078a9[_0xda74('0x1b')],_0xe6b39);_0x3a076c(_0x3f7eed[_0xda74('0x18')](0x1f4,_0x3078a9[_0xda74('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9ddc08c..d893093 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 _0xe1e3=['length','mailQueue:','./mailQueue.events','save','update','removeListener','register'];(function(_0x5ca53f,_0x147621){var _0x3c3255=function(_0x143a89){while(--_0x143a89){_0x5ca53f['push'](_0x5ca53f['shift']());}};_0x3c3255(++_0x147621);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x5c4fb6,_0x43254f){_0x5c4fb6=_0x5c4fb6-0x0;var _0x308c89=_0xe1e3[_0x5c4fb6];return _0x308c89;};'use strict';var MailQueueEvents=require(_0x3e1e('0x0'));var events=[_0x3e1e('0x1'),'remove',_0x3e1e('0x2')];function createListener(_0x5e9f9a,_0x498811){return function(_0x90cbb5){_0x498811['emit'](_0x5e9f9a,_0x90cbb5);};}function removeListener(_0x3bacc,_0x5a11ef){return function(){MailQueueEvents[_0x3e1e('0x3')](_0x3bacc,_0x5a11ef);};}exports[_0x3e1e('0x4')]=function(_0x40d6d8){for(var _0x25701f=0x0,_0x55cfba=events[_0x3e1e('0x5')];_0x25701f<_0x55cfba;_0x25701f++){var _0x13926d=events[_0x25701f];var _0x2f0e12=createListener(_0x3e1e('0x6')+_0x13926d,_0x40d6d8);MailQueueEvents['on'](_0x13926d,_0x2f0e12);}}; \ No newline at end of file +var _0x4bab=['save','remove','update','emit','removeListener','length','./mailQueue.events'];(function(_0x567ea1,_0x3cb026){var _0x20964d=function(_0x2a7102){while(--_0x2a7102){_0x567ea1['push'](_0x567ea1['shift']());}};_0x20964d(++_0x3cb026);}(_0x4bab,0x1d4));var _0xb4ba=function(_0x3d37cc,_0x5b355b){_0x3d37cc=_0x3d37cc-0x0;var _0x36b043=_0x4bab[_0x3d37cc];return _0x36b043;};'use strict';var MailQueueEvents=require(_0xb4ba('0x0'));var events=[_0xb4ba('0x1'),_0xb4ba('0x2'),_0xb4ba('0x3')];function createListener(_0x12cda8,_0x1d9a13){return function(_0x1c53e3){_0x1d9a13[_0xb4ba('0x4')](_0x12cda8,_0x1c53e3);};}function removeListener(_0x2f8195,_0x486621){return function(){MailQueueEvents[_0xb4ba('0x5')](_0x2f8195,_0x486621);};}exports['register']=function(_0xa9ea74){for(var _0x46d2a1=0x0,_0x2c846b=events[_0xb4ba('0x6')];_0x46d2a1<_0x2c846b;_0x46d2a1++){var _0x449c72=events[_0x46d2a1];var _0x1a87fe=createListener('mailQueue:'+_0x449c72,_0xa9ea74);MailQueueEvents['on'](_0x449c72,_0x1a87fe);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 0939fa7..44e1325 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 _0xa749=['put','delete','/:id','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xa749,0x1d0));var _0x9a74=function(_0x58a078,_0x9e575f){_0x58a078=_0x58a078-0x0;var _0x8c143e=_0xa749[_0x58a078];return _0x8c143e;};'use strict';var multer=require('multer');var util=require(_0x9a74('0x0'));var path=require(_0x9a74('0x1'));var timeout=require(_0x9a74('0x2'));var express=require(_0x9a74('0x3'));var router=express['Router']();var fs_extra=require(_0x9a74('0x4'));var auth=require(_0x9a74('0x5'));var interaction=require(_0x9a74('0x6'));var config=require(_0x9a74('0x7'));var controller=require('./mailQueueReport.controller');router[_0x9a74('0x8')]('/',auth[_0x9a74('0x9')](),controller[_0x9a74('0xa')]);router[_0x9a74('0x8')](_0x9a74('0xb'),auth[_0x9a74('0x9')](),controller[_0x9a74('0xc')]);router[_0x9a74('0x8')]('/:id',auth[_0x9a74('0x9')](),controller[_0x9a74('0xd')]);router[_0x9a74('0xe')]('/',auth['isAuthenticated'](),controller[_0x9a74('0xf')]);router[_0x9a74('0x10')]('/:id',auth[_0x9a74('0x9')](),controller['update']);router[_0x9a74('0x11')](_0x9a74('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a74('0x13')]=router; \ No newline at end of file +var _0xcd8d=['fs-extra','../../components/interaction/service','./mailQueueReport.controller','get','index','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x43fd4c,_0x1a3efb){var _0x19d45a=function(_0xc1d7bf){while(--_0xc1d7bf){_0x43fd4c['push'](_0x43fd4c['shift']());}};_0x19d45a(++_0x1a3efb);}(_0xcd8d,0x1b0));var _0xdcd8=function(_0x3f465d,_0xbd2037){_0x3f465d=_0x3f465d-0x0;var _0x121ad1=_0xcd8d[_0x3f465d];return _0x121ad1;};'use strict';var multer=require(_0xdcd8('0x0'));var util=require(_0xdcd8('0x1'));var path=require(_0xdcd8('0x2'));var timeout=require(_0xdcd8('0x3'));var express=require('express');var router=express[_0xdcd8('0x4')]();var fs_extra=require(_0xdcd8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdcd8('0x6'));var config=require('../../config/environment');var controller=require(_0xdcd8('0x7'));router[_0xdcd8('0x8')]('/',auth['isAuthenticated'](),controller[_0xdcd8('0x9')]);router['get']('/describe',auth[_0xdcd8('0xa')](),controller['describe']);router[_0xdcd8('0x8')](_0xdcd8('0xb'),auth[_0xdcd8('0xa')](),controller[_0xdcd8('0xc')]);router[_0xdcd8('0xd')]('/',auth[_0xdcd8('0xa')](),controller['create']);router[_0xdcd8('0xe')](_0xdcd8('0xb'),auth[_0xdcd8('0xa')](),controller[_0xdcd8('0xf')]);router[_0xdcd8('0x10')](_0xdcd8('0xb'),auth[_0xdcd8('0xa')](),controller[_0xdcd8('0x11')]);module[_0xdcd8('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 42cfb63..1cfbb11 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 _0x30eb=['STRING','DATE','moment','sequelize','exports'];(function(_0x22285b,_0x11c6cd){var _0x1f436f=function(_0x4006da){while(--_0x4006da){_0x22285b['push'](_0x22285b['shift']());}};_0x1f436f(++_0x11c6cd);}(_0x30eb,0x7f));var _0xb30e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x30eb[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xb30e('0x0'));var Sequelize=require(_0xb30e('0x1'));module[_0xb30e('0x2')]={'uniqueid':{'type':Sequelize[_0xb30e('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb30e('0x4')]},'leaveAt':{'type':Sequelize[_0xb30e('0x4')]},'acceptAt':{'type':Sequelize[_0xb30e('0x4')]},'exitAt':{'type':Sequelize[_0xb30e('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b5a=['exports','STRING','DATE','sequelize'];(function(_0x53df58,_0x35160d){var _0x305aef=function(_0x7c52fd){while(--_0x7c52fd){_0x53df58['push'](_0x53df58['shift']());}};_0x305aef(++_0x35160d);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x5c2cfc,_0x225457){_0x5c2cfc=_0x5c2cfc-0x0;var _0x39ef01=_0x5b5a[_0x5c2cfc];return _0x39ef01;};'use strict';var moment=require('moment');var Sequelize=require(_0xa5b5('0x0'));module[_0xa5b5('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa5b5('0x2')]},'joinAt':{'type':Sequelize[_0xa5b5('0x3')]},'leaveAt':{'type':Sequelize[_0xa5b5('0x3')]},'acceptAt':{'type':Sequelize[_0xa5b5('0x3')]},'exitAt':{'type':Sequelize[_0xa5b5('0x3')]},'reason':{'type':Sequelize[_0xa5b5('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index f7ee865..2bcf2d0 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 _0xd943=['jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','MailQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','merge','includeAll','include','findAll','catch','show','params','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','crypto'];(function(_0x4fb59d,_0x207ff9){var _0x52bf46=function(_0x503018){while(--_0x503018){_0x4fb59d['push'](_0x4fb59d['shift']());}};_0x52bf46(++_0x207ff9);}(_0xd943,0x15d));var _0x3d94=function(_0x1a09a2,_0x5ef211){_0x1a09a2=_0x1a09a2-0x0;var _0x17821a=_0xd943[_0x1a09a2];return _0x17821a;};'use strict';var emlformat=require(_0x3d94('0x0'));var rimraf=require(_0x3d94('0x1'));var zipdir=require(_0x3d94('0x2'));var jsonpatch=require(_0x3d94('0x3'));var rp=require('request-promise');var moment=require(_0x3d94('0x4'));var BPromise=require(_0x3d94('0x5'));var Mustache=require(_0x3d94('0x6'));var util=require(_0x3d94('0x7'));var path=require(_0x3d94('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3d94('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d94('0xa'));var jsforce=require(_0x3d94('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3d94('0xc'));var Papa=require(_0x3d94('0xd'));var Redis=require(_0x3d94('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3d94('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d94('0x10'));var logger=require(_0x3d94('0x11'))('api');var utils=require(_0x3d94('0x12'));var config=require(_0x3d94('0x13'));var licenseUtil=require(_0x3d94('0x14'));var db=require(_0x3d94('0x15'))['db'];function respondWithStatusCode(_0x15a392,_0x548b89){_0x548b89=_0x548b89||0xcc;return function(_0x96c54b){if(_0x96c54b){return _0x15a392[_0x3d94('0x16')](_0x548b89);}return _0x15a392[_0x3d94('0x17')](_0x548b89)['end']();};}function respondWithResult(_0x24e8b9,_0x29608d){_0x29608d=_0x29608d||0xc8;return function(_0x7d6969){if(_0x7d6969){return _0x24e8b9['status'](_0x29608d)[_0x3d94('0x18')](_0x7d6969);}};}function respondWithFilteredResult(_0x340818,_0x292419){return function(_0x34098e){if(_0x34098e){var _0xaf939a=typeof _0x292419[_0x3d94('0x19')]===_0x3d94('0x1a')&&typeof _0x292419[_0x3d94('0x1b')]==='undefined';var _0x22676a=_0x34098e[_0x3d94('0x1c')];var _0x2acee3=_0xaf939a?0x0:_0x292419[_0x3d94('0x19')];var _0x4afc92=_0xaf939a?_0x34098e[_0x3d94('0x1c')]:_0x292419[_0x3d94('0x19')]+_0x292419['limit'];var _0x9bca24;if(_0x4afc92>=_0x22676a){_0x4afc92=_0x22676a;_0x9bca24=0xc8;}else{_0x9bca24=0xce;}_0x340818['status'](_0x9bca24);return _0x340818[_0x3d94('0x1d')](_0x3d94('0x1e'),_0x2acee3+'-'+_0x4afc92+'/'+_0x22676a)[_0x3d94('0x18')](_0x34098e);}return null;};}function patchUpdates(_0x1e9ec2){return function(_0x35a3cc){try{jsonpatch['apply'](_0x35a3cc,_0x1e9ec2,!![]);}catch(_0x578002){return BPromise[_0x3d94('0x1f')](_0x578002);}return _0x35a3cc[_0x3d94('0x20')]();};}function saveUpdates(_0x9c2f2c,_0x4edee4){return function(_0x30af25){if(_0x30af25){return _0x30af25[_0x3d94('0x21')](_0x9c2f2c)[_0x3d94('0x22')](function(_0x384f76){return _0x384f76;});}return null;};}function removeEntity(_0x395133,_0x4093a4){return function(_0x295493){if(_0x295493){return _0x295493[_0x3d94('0x23')]()[_0x3d94('0x22')](function(){_0x395133[_0x3d94('0x17')](0xcc)[_0x3d94('0x24')]();});}};}function handleEntityNotFound(_0x192839,_0x292976){return function(_0x3496c3){if(!_0x3496c3){_0x192839[_0x3d94('0x16')](0x194);}return _0x3496c3;};}function handleError(_0x5b3b31,_0x123183){_0x123183=_0x123183||0x1f4;return function(_0x558fd2){logger[_0x3d94('0x25')](_0x558fd2[_0x3d94('0x26')]);if(_0x558fd2[_0x3d94('0x27')]){delete _0x558fd2[_0x3d94('0x27')];}_0x5b3b31[_0x3d94('0x17')](_0x123183)[_0x3d94('0x28')](_0x558fd2);};}exports[_0x3d94('0x29')]=function(_0x47d6ab,_0x584c4a){var _0x362642={},_0x4813e1={},_0x4dd410={'count':0x0,'rows':[]};var _0x23d20d=_['map'](db[_0x3d94('0x2a')][_0x3d94('0x2b')],function(_0x32403a){return{'name':_0x32403a['fieldName'],'type':_0x32403a[_0x3d94('0x2c')]['key']};});_0x4813e1[_0x3d94('0x2d')]=_['map'](_0x23d20d,_0x3d94('0x27'));_0x4813e1[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x47d6ab[_0x3d94('0x2e')]);_0x4813e1['filters']=_[_0x3d94('0x30')](_0x4813e1['model'],_0x4813e1[_0x3d94('0x2e')]);_0x362642[_0x3d94('0x31')]=_['intersection'](_0x4813e1['model'],qs[_0x3d94('0x32')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x32')]));_0x362642['attributes']=_0x362642[_0x3d94('0x31')][_0x3d94('0x33')]?_0x362642['attributes']:_0x4813e1[_0x3d94('0x2d')];if(!_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x34')](_0x3d94('0x35'))){_0x362642[_0x3d94('0x1b')]=qs['limit'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x1b')]);_0x362642[_0x3d94('0x19')]=qs[_0x3d94('0x19')](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x19')]);}_0x362642['order']=qs['sort'](_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x36')]);_0x362642[_0x3d94('0x37')]=qs[_0x3d94('0x38')](_[_0x3d94('0x39')](_0x47d6ab[_0x3d94('0x2e')],_0x4813e1[_0x3d94('0x38')]),_0x23d20d);if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]){_0x362642[_0x3d94('0x37')]=_['merge'](_0x362642[_0x3d94('0x37')],{'$or':_[_0x3d94('0x3b')](_0x23d20d,function(_0x361fbb){if(_0x361fbb[_0x3d94('0x2c')]!=='VIRTUAL'){var _0xcf7a73={};_0xcf7a73[_0x361fbb[_0x3d94('0x27')]]={'$like':'%'+_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3a')]+'%'};return _0xcf7a73;}})});}_0x362642=_[_0x3d94('0x3c')]({},_0x362642,_0x47d6ab['options']);var _0x217e5e={'where':_0x362642[_0x3d94('0x37')]};return db[_0x3d94('0x2a')]['count'](_0x217e5e)['then'](function(_0x4d8a8f){_0x4dd410['count']=_0x4d8a8f;if(_0x47d6ab[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x362642[_0x3d94('0x3e')]=[{'all':!![]}];}return db[_0x3d94('0x2a')][_0x3d94('0x3f')](_0x362642);})[_0x3d94('0x22')](function(_0x3a3898){_0x4dd410['rows']=_0x3a3898;return _0x4dd410;})['then'](respondWithFilteredResult(_0x584c4a,_0x362642))[_0x3d94('0x40')](handleError(_0x584c4a,null));};exports[_0x3d94('0x41')]=function(_0x512cef,_0x2d0aa2){var _0x4af4b6={'raw':!![],'where':{'id':_0x512cef[_0x3d94('0x42')]['id']}},_0x1361fb={};_0x1361fb[_0x3d94('0x2d')]=_[_0x3d94('0x2f')](db[_0x3d94('0x2a')]['rawAttributes']);_0x1361fb[_0x3d94('0x2e')]=_[_0x3d94('0x2f')](_0x512cef[_0x3d94('0x2e')]);_0x1361fb['filters']=_[_0x3d94('0x30')](_0x1361fb['model'],_0x1361fb['query']);_0x4af4b6[_0x3d94('0x31')]=_[_0x3d94('0x30')](_0x1361fb[_0x3d94('0x2d')],qs[_0x3d94('0x32')](_0x512cef['query'][_0x3d94('0x32')]));_0x4af4b6['attributes']=_0x4af4b6[_0x3d94('0x31')][_0x3d94('0x33')]?_0x4af4b6[_0x3d94('0x31')]:_0x1361fb[_0x3d94('0x2d')];if(_0x512cef[_0x3d94('0x2e')][_0x3d94('0x3d')]){_0x4af4b6[_0x3d94('0x3e')]=[{'all':!![]}];}_0x4af4b6=_['merge']({},_0x4af4b6,_0x512cef[_0x3d94('0x43')]);return db[_0x3d94('0x2a')]['find'](_0x4af4b6)['then'](handleEntityNotFound(_0x2d0aa2,null))[_0x3d94('0x22')](respondWithResult(_0x2d0aa2,null))[_0x3d94('0x40')](handleError(_0x2d0aa2,null));};exports['create']=function(_0x3c8571,_0x13fda9){return db[_0x3d94('0x2a')][_0x3d94('0x44')](_0x3c8571[_0x3d94('0x45')],{})[_0x3d94('0x22')](respondWithResult(_0x13fda9,0xc9))[_0x3d94('0x40')](handleError(_0x13fda9,null));};exports[_0x3d94('0x21')]=function(_0x60279f,_0x2429bc){if(_0x60279f[_0x3d94('0x45')]['id']){delete _0x60279f[_0x3d94('0x45')]['id'];}return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x60279f[_0x3d94('0x42')]['id']}})['then'](handleEntityNotFound(_0x2429bc,null))[_0x3d94('0x22')](saveUpdates(_0x60279f[_0x3d94('0x45')],null))[_0x3d94('0x22')](respondWithResult(_0x2429bc,null))[_0x3d94('0x40')](handleError(_0x2429bc,null));};exports[_0x3d94('0x23')]=function(_0x3ce0be,_0x129783){return db[_0x3d94('0x2a')][_0x3d94('0x46')]({'where':{'id':_0x3ce0be['params']['id']}})[_0x3d94('0x22')](handleEntityNotFound(_0x129783,null))['then'](removeEntity(_0x129783,null))[_0x3d94('0x40')](handleError(_0x129783,null));};exports[_0x3d94('0x47')]=function(_0x4af4c2,_0x255630){return db['MailQueueReport']['describe']()[_0x3d94('0x22')](respondWithResult(_0x255630,null))['catch'](handleError(_0x255630,null));}; \ No newline at end of file +var _0x627e=['limit','count','set','reject','save','then','destroy','error','stack','name','index','MailQueueReport','fieldName','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','rows','catch','params','fields','length','includeAll','include','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x26f32c,_0x15b8a4){var _0x38f54a=function(_0x2f29fc){while(--_0x2f29fc){_0x26f32c['push'](_0x26f32c['shift']());}};_0x38f54a(++_0x15b8a4);}(_0x627e,0x14a));var _0xe627=function(_0x23aede,_0x4f0fec){_0x23aede=_0x23aede-0x0;var _0x2acd47=_0x627e[_0x23aede];return _0x2acd47;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require('moment');var BPromise=require(_0xe627('0x5'));var Mustache=require(_0xe627('0x6'));var util=require(_0xe627('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe627('0x8'));var fs=require('fs');var fs_extra=require(_0xe627('0x9'));var _=require(_0xe627('0xa'));var squel=require(_0xe627('0xb'));var crypto=require(_0xe627('0xc'));var jsforce=require(_0xe627('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe627('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe627('0xf'));var authService=require(_0xe627('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x11'));var logger=require(_0xe627('0x12'))(_0xe627('0x13'));var utils=require(_0xe627('0x14'));var config=require(_0xe627('0x15'));var licenseUtil=require(_0xe627('0x16'));var db=require(_0xe627('0x17'))['db'];function respondWithStatusCode(_0x3919be,_0x1922f5){_0x1922f5=_0x1922f5||0xcc;return function(_0x582190){if(_0x582190){return _0x3919be[_0xe627('0x18')](_0x1922f5);}return _0x3919be[_0xe627('0x19')](_0x1922f5)[_0xe627('0x1a')]();};}function respondWithResult(_0x4be370,_0x42dd1c){_0x42dd1c=_0x42dd1c||0xc8;return function(_0x1e2e62){if(_0x1e2e62){return _0x4be370[_0xe627('0x19')](_0x42dd1c)[_0xe627('0x1b')](_0x1e2e62);}};}function respondWithFilteredResult(_0x62896f,_0x6a9a15){return function(_0x271325){if(_0x271325){var _0x54720a=typeof _0x6a9a15[_0xe627('0x1c')]===_0xe627('0x1d')&&typeof _0x6a9a15[_0xe627('0x1e')]===_0xe627('0x1d');var _0x403982=_0x271325[_0xe627('0x1f')];var _0x56559b=_0x54720a?0x0:_0x6a9a15[_0xe627('0x1c')];var _0x538b22=_0x54720a?_0x271325[_0xe627('0x1f')]:_0x6a9a15['offset']+_0x6a9a15[_0xe627('0x1e')];var _0x565213;if(_0x538b22>=_0x403982){_0x538b22=_0x403982;_0x565213=0xc8;}else{_0x565213=0xce;}_0x62896f['status'](_0x565213);return _0x62896f[_0xe627('0x20')]('Content-Range',_0x56559b+'-'+_0x538b22+'/'+_0x403982)[_0xe627('0x1b')](_0x271325);}return null;};}function patchUpdates(_0x3391ce){return function(_0x4adde7){try{jsonpatch['apply'](_0x4adde7,_0x3391ce,!![]);}catch(_0x4ecfa6){return BPromise[_0xe627('0x21')](_0x4ecfa6);}return _0x4adde7[_0xe627('0x22')]();};}function saveUpdates(_0x4e3338,_0x708a8a){return function(_0x33cb27){if(_0x33cb27){return _0x33cb27['update'](_0x4e3338)[_0xe627('0x23')](function(_0x29221b){return _0x29221b;});}return null;};}function removeEntity(_0x52d492,_0x42f3d1){return function(_0x19adbc){if(_0x19adbc){return _0x19adbc[_0xe627('0x24')]()['then'](function(){_0x52d492[_0xe627('0x19')](0xcc)[_0xe627('0x1a')]();});}};}function handleEntityNotFound(_0x1a5081,_0x3ddd8d){return function(_0x4b9ff9){if(!_0x4b9ff9){_0x1a5081[_0xe627('0x18')](0x194);}return _0x4b9ff9;};}function handleError(_0x1fe192,_0x1635a0){_0x1635a0=_0x1635a0||0x1f4;return function(_0x29eb8e){logger[_0xe627('0x25')](_0x29eb8e[_0xe627('0x26')]);if(_0x29eb8e[_0xe627('0x27')]){delete _0x29eb8e[_0xe627('0x27')];}_0x1fe192[_0xe627('0x19')](_0x1635a0)['send'](_0x29eb8e);};}exports[_0xe627('0x28')]=function(_0x5aeba1,_0x5cd7c8){var _0x1e0bd7={},_0xdf63c8={},_0x5799a3={'count':0x0,'rows':[]};var _0x39c23f=_['map'](db[_0xe627('0x29')]['rawAttributes'],function(_0x262253){return{'name':_0x262253[_0xe627('0x2a')],'type':_0x262253['type'][_0xe627('0x2b')]};});_0xdf63c8['model']=_[_0xe627('0x2c')](_0x39c23f,_0xe627('0x27'));_0xdf63c8[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x5aeba1[_0xe627('0x2d')]);_0xdf63c8[_0xe627('0x2f')]=_[_0xe627('0x30')](_0xdf63c8[_0xe627('0x31')],_0xdf63c8[_0xe627('0x2d')]);_0x1e0bd7[_0xe627('0x32')]=_[_0xe627('0x30')](_0xdf63c8['model'],qs['fields'](_0x5aeba1[_0xe627('0x2d')]['fields']));_0x1e0bd7[_0xe627('0x32')]=_0x1e0bd7['attributes']['length']?_0x1e0bd7[_0xe627('0x32')]:_0xdf63c8['model'];if(!_0x5aeba1['query'][_0xe627('0x33')](_0xe627('0x34'))){_0x1e0bd7[_0xe627('0x1e')]=qs['limit'](_0x5aeba1['query']['limit']);_0x1e0bd7[_0xe627('0x1c')]=qs['offset'](_0x5aeba1[_0xe627('0x2d')][_0xe627('0x1c')]);}_0x1e0bd7['order']=qs[_0xe627('0x35')](_0x5aeba1[_0xe627('0x2d')]['sort']);_0x1e0bd7[_0xe627('0x36')]=qs[_0xe627('0x2f')](_[_0xe627('0x37')](_0x5aeba1[_0xe627('0x2d')],_0xdf63c8[_0xe627('0x2f')]),_0x39c23f);if(_0x5aeba1[_0xe627('0x2d')]['filter']){_0x1e0bd7[_0xe627('0x36')]=_['merge'](_0x1e0bd7[_0xe627('0x36')],{'$or':_['map'](_0x39c23f,function(_0xe90eda){if(_0xe90eda[_0xe627('0x38')]!==_0xe627('0x39')){var _0x21a533={};_0x21a533[_0xe90eda[_0xe627('0x27')]]={'$like':'%'+_0x5aeba1[_0xe627('0x2d')][_0xe627('0x3a')]+'%'};return _0x21a533;}})});}_0x1e0bd7=_[_0xe627('0x3b')]({},_0x1e0bd7,_0x5aeba1[_0xe627('0x3c')]);var _0x415a25={'where':_0x1e0bd7[_0xe627('0x36')]};return db[_0xe627('0x29')][_0xe627('0x1f')](_0x415a25)['then'](function(_0x4ddff5){_0x5799a3['count']=_0x4ddff5;if(_0x5aeba1['query']['includeAll']){_0x1e0bd7['include']=[{'all':!![]}];}return db[_0xe627('0x29')]['findAll'](_0x1e0bd7);})[_0xe627('0x23')](function(_0x59cd6a){_0x5799a3[_0xe627('0x3d')]=_0x59cd6a;return _0x5799a3;})[_0xe627('0x23')](respondWithFilteredResult(_0x5cd7c8,_0x1e0bd7))[_0xe627('0x3e')](handleError(_0x5cd7c8,null));};exports['show']=function(_0x58e110,_0x26064c){var _0x5f3374={'raw':!![],'where':{'id':_0x58e110[_0xe627('0x3f')]['id']}},_0x5e352e={};_0x5e352e['model']=_[_0xe627('0x2e')](db['MailQueueReport']['rawAttributes']);_0x5e352e[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x58e110[_0xe627('0x2d')]);_0x5e352e['filters']=_['intersection'](_0x5e352e[_0xe627('0x31')],_0x5e352e['query']);_0x5f3374['attributes']=_[_0xe627('0x30')](_0x5e352e[_0xe627('0x31')],qs[_0xe627('0x40')](_0x58e110[_0xe627('0x2d')][_0xe627('0x40')]));_0x5f3374[_0xe627('0x32')]=_0x5f3374['attributes'][_0xe627('0x41')]?_0x5f3374[_0xe627('0x32')]:_0x5e352e['model'];if(_0x58e110['query'][_0xe627('0x42')]){_0x5f3374[_0xe627('0x43')]=[{'all':!![]}];}_0x5f3374=_[_0xe627('0x3b')]({},_0x5f3374,_0x58e110[_0xe627('0x3c')]);return db[_0xe627('0x29')][_0xe627('0x44')](_0x5f3374)[_0xe627('0x23')](handleEntityNotFound(_0x26064c,null))['then'](respondWithResult(_0x26064c,null))[_0xe627('0x3e')](handleError(_0x26064c,null));};exports['create']=function(_0x648456,_0xcd19f5){return db[_0xe627('0x29')]['create'](_0x648456[_0xe627('0x45')],{})['then'](respondWithResult(_0xcd19f5,0xc9))[_0xe627('0x3e')](handleError(_0xcd19f5,null));};exports[_0xe627('0x46')]=function(_0x375e05,_0x30e057){if(_0x375e05[_0xe627('0x45')]['id']){delete _0x375e05['body']['id'];}return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x375e05[_0xe627('0x3f')]['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x30e057,null))[_0xe627('0x23')](saveUpdates(_0x375e05[_0xe627('0x45')],null))[_0xe627('0x23')](respondWithResult(_0x30e057,null))[_0xe627('0x3e')](handleError(_0x30e057,null));};exports[_0xe627('0x24')]=function(_0x3824da,_0x550b74){return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x3824da['params']['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x550b74,null))[_0xe627('0x23')](removeEntity(_0x550b74,null))['catch'](handleError(_0x550b74,null));};exports[_0xe627('0x47')]=function(_0x3a827e,_0x542a4c){return db[_0xe627('0x29')][_0xe627('0x47')]()['then'](respondWithResult(_0x542a4c,null))[_0xe627('0x3e')](handleError(_0x542a4c,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index b9d69d3..d57af55 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 _0x06f8=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x4c6dcc,_0x209083){var _0x3f4783=function(_0x1a626b){while(--_0x1a626b){_0x4c6dcc['push'](_0x4c6dcc['shift']());}};_0x3f4783(++_0x209083);}(_0x06f8,0x178));var _0x806f=function(_0x392a06,_0x233e23){_0x392a06=_0x392a06-0x0;var _0x42fb44=_0x06f8[_0x392a06];return _0x42fb44;};'use strict';var _=require(_0x806f('0x0'));var util=require('util');var logger=require(_0x806f('0x1'))(_0x806f('0x2'));var moment=require(_0x806f('0x3'));var BPromise=require(_0x806f('0x4'));var rp=require(_0x806f('0x5'));var fs=require('fs');var path=require(_0x806f('0x6'));var rimraf=require(_0x806f('0x7'));var config=require(_0x806f('0x8'));var attributes=require(_0x806f('0x9'));module[_0x806f('0xa')]=function(_0x1456e5,_0x2a9212){return _0x1456e5[_0x806f('0xb')](_0x806f('0xc'),attributes,{'tableName':_0x806f('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x806f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e4=['rimraf','../../config/environment','exports','define','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x969ba4,_0x3d80f9){var _0xebf7bd=function(_0x3d891d){while(--_0x3d891d){_0x969ba4['push'](_0x969ba4['shift']());}};_0xebf7bd(++_0x3d80f9);}(_0xa9e4,0x89));var _0x4a9e=function(_0x3880ed,_0x27d5af){_0x3880ed=_0x3880ed-0x0;var _0x43ae75=_0xa9e4[_0x3880ed];return _0x43ae75;};'use strict';var _=require(_0x4a9e('0x0'));var util=require(_0x4a9e('0x1'));var logger=require(_0x4a9e('0x2'))(_0x4a9e('0x3'));var moment=require(_0x4a9e('0x4'));var BPromise=require(_0x4a9e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a9e('0x6'));var rimraf=require(_0x4a9e('0x7'));var config=require(_0x4a9e('0x8'));var attributes=require('./mailQueueReport.attributes');module[_0x4a9e('0x9')]=function(_0xa541ce,_0x2cb9a4){return _0xa541ce[_0x4a9e('0xa')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 906ee2b..b040dcd 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x284331,_0x302be9){var _0x365f8a=function(_0x49bee7){while(--_0x49bee7){_0x284331['push'](_0x284331['shift']());}};_0x365f8a(++_0x302be9);}(_0x7a54,0x106));var _0x47a5=function(_0x167681,_0xb105e){_0x167681=_0x167681-0x0;var _0x2cb530=_0x7a54[_0x167681];return _0x2cb530;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x699c68,_0x3c7a67){var _0x4bf728=function(_0x575d9b){while(--_0x575d9b){_0x699c68['push'](_0x699c68['shift']());}};_0x4bf728(++_0x3c7a67);}(_0x326f,0xd1));var _0xf326=function(_0x3414c3,_0x55897c){_0x3414c3=_0x3414c3-0x0;var _0x2d44ef=_0x326f[_0x3414c3];return _0x2d44ef;};'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')]('MailQueueReport,\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')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 97c3c82..84f9bbb 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1567cf,_0x23af83){var _0x48bc34=function(_0x415c8c){while(--_0x415c8c){_0x1567cf['push'](_0x1567cf['shift']());}};_0x48bc34(++_0x23af83);}(_0xedd9,0xfc));var _0x9edd=function(_0x51ff86,_0x54da33){_0x51ff86=_0x51ff86-0x0;var _0x1abbd9=_0xedd9[_0x51ff86];return _0x1abbd9;};'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(_0x3810a2,_0x545ecd){var _0x14f6cf=function(_0x4879e3){while(--_0x4879e3){_0x3810a2['push'](_0x3810a2['shift']());}};_0x14f6cf(++_0x545ecd);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 92dcd43..183e6a6 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 _0xeb03=['INTEGER','INBOX','sequelize','STRING','BOOLEAN'];(function(_0xd9d333,_0x5d32e5){var _0x6c53d1=function(_0x1d09ae){while(--_0x1d09ae){_0xd9d333['push'](_0xd9d333['shift']());}};_0x6c53d1(++_0x5d32e5);}(_0xeb03,0xf7));var _0x3eb0=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xeb03[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0x3eb0('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3eb0('0x1')]},'authentication':{'type':Sequelize[_0x3eb0('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x3eb0('0x1')]},'password':{'type':Sequelize[_0x3eb0('0x1')]},'port':{'type':Sequelize[_0x3eb0('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3eb0('0x1')],'defaultValue':_0x3eb0('0x4')},'connTimeout':{'type':Sequelize[_0x3eb0('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3eb0('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x3eb0('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xa9fa=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x2ceac2,_0x42fbca){var _0x3c47b7=function(_0x1bc4ec){while(--_0x1bc4ec){_0x2ceac2['push'](_0x2ceac2['shift']());}};_0x3c47b7(++_0x42fbca);}(_0xa9fa,0x1e2));var _0xaa9f=function(_0x50fd5d,_0x55fdab){_0x50fd5d=_0x50fd5d-0x0;var _0xc066c8=_0xa9fa[_0x50fd5d];return _0xc066c8;};'use strict';var Sequelize=require(_0xaa9f('0x0'));module[_0xaa9f('0x1')]={'description':{'type':Sequelize[_0xaa9f('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xaa9f('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xaa9f('0x4')]},'tls':{'type':Sequelize[_0xaa9f('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xaa9f('0x5')},'connTimeout':{'type':Sequelize[_0xaa9f('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xaa9f('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0xaa9f('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 0ee42f5..e25afae 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 _0x0038=['define','MailServerIn','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailServerIn.attributes','exports'];(function(_0x17e652,_0x16a06e){var _0x48bcf2=function(_0x1d2c18){while(--_0x1d2c18){_0x17e652['push'](_0x17e652['shift']());}};_0x48bcf2(++_0x16a06e);}(_0x0038,0x154));var _0x8003=function(_0x243bac,_0x274ba3){_0x243bac=_0x243bac-0x0;var _0x3636dc=_0x0038[_0x243bac];return _0x3636dc;};'use strict';var _=require(_0x8003('0x0'));var util=require(_0x8003('0x1'));var logger=require(_0x8003('0x2'))(_0x8003('0x3'));var moment=require(_0x8003('0x4'));var BPromise=require(_0x8003('0x5'));var rp=require(_0x8003('0x6'));var fs=require('fs');var path=require(_0x8003('0x7'));var rimraf=require(_0x8003('0x8'));var config=require('../../config/environment');var attributes=require(_0x8003('0x9'));module[_0x8003('0xa')]=function(_0x26051a,_0x3c14b9){return _0x26051a[_0x8003('0xb')](_0x8003('0xc'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf471=['mail_servers_in','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./mailServerIn.attributes','define','MailServerIn'];(function(_0x4b1233,_0xd1440c){var _0x46d0da=function(_0x12ee8c){while(--_0x12ee8c){_0x4b1233['push'](_0x4b1233['shift']());}};_0x46d0da(++_0xd1440c);}(_0xf471,0x1c4));var _0x1f47=function(_0x192833,_0x3880d1){_0x192833=_0x192833-0x0;var _0x32d5ee=_0xf471[_0x192833];return _0x32d5ee;};'use strict';var _=require(_0x1f47('0x0'));var util=require(_0x1f47('0x1'));var logger=require(_0x1f47('0x2'))('api');var moment=require(_0x1f47('0x3'));var BPromise=require(_0x1f47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f47('0x5'));var rimraf=require('rimraf');var config=require(_0x1f47('0x6'));var attributes=require(_0x1f47('0x7'));module['exports']=function(_0x3daa52,_0x46c365){return _0x3daa52[_0x1f47('0x8')](_0x1f47('0x9'),attributes,{'tableName':_0x1f47('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 5a27bb6..85cb712 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 _0x6d2e=['stringify','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','limit','include','map','model','attributes','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x51bd41,_0x46d277){var _0x2b0082=function(_0x4d458f){while(--_0x4d458f){_0x51bd41['push'](_0x51bd41['shift']());}};_0x2b0082(++_0x46d277);}(_0x6d2e,0x97));var _0xe6d2=function(_0x4ca536,_0x57c8de){_0x4ca536=_0x4ca536-0x0;var _0x3bd35f=_0x6d2e[_0x4ca536];return _0x3bd35f;};'use strict';var _=require('lodash');var util=require(_0xe6d2('0x0'));var moment=require(_0xe6d2('0x1'));var BPromise=require(_0xe6d2('0x2'));var rs=require(_0xe6d2('0x3'));var fs=require('fs');var Redis=require(_0xe6d2('0x4'));var db=require(_0xe6d2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6d2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe6d2('0x7'));var client=jayson[_0xe6d2('0x8')][_0xe6d2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d9c9f,_0x36d6ad,_0x53906e){return new BPromise(function(_0x2e227e,_0x2ce8cb){return client['request'](_0x4d9c9f,_0x53906e)[_0xe6d2('0xa')](function(_0xa7d0e1){logger['info'](_0xe6d2('0xb'),_0x36d6ad,_0xe6d2('0xc'));logger['debug'](_0xe6d2('0xd'),_0x36d6ad,_0xe6d2('0xc'),JSON[_0xe6d2('0xe')](_0xa7d0e1));if(_0xa7d0e1[_0xe6d2('0xf')]){if(_0xa7d0e1['error'][_0xe6d2('0x10')]===0x1f4){logger[_0xe6d2('0xf')]('MailServerIn,\x20%s,\x20%s',_0x36d6ad,_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);return _0x2ce8cb(_0xa7d0e1['error'][_0xe6d2('0x11')]);}logger[_0xe6d2('0xf')](_0xe6d2('0xb'),_0x36d6ad,_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);return _0x2e227e(_0xa7d0e1[_0xe6d2('0xf')][_0xe6d2('0x11')]);}else{logger[_0xe6d2('0x12')](_0xe6d2('0xb'),_0x36d6ad,_0xe6d2('0xc'));_0x2e227e(_0xa7d0e1[_0xe6d2('0x13')][_0xe6d2('0x11')]);}})[_0xe6d2('0x14')](function(_0x2ad072){logger[_0xe6d2('0xf')]('MailServerIn,\x20%s,\x20%s',_0x36d6ad,_0x2ad072);_0x2ce8cb(_0x2ad072);});});}exports[_0xe6d2('0x15')]=function(_0x35cc9c){var _0x38410a=this;return new Promise(function(_0x242bcb,_0x31b572){return db[_0xe6d2('0x16')][_0xe6d2('0x17')]({'raw':_0x35cc9c[_0xe6d2('0x18')]?_0x35cc9c['options'][_0xe6d2('0x19')]===undefined?!![]:![]:!![],'where':_0x35cc9c[_0xe6d2('0x18')]?_0x35cc9c['options'][_0xe6d2('0x1a')]||null:null,'attributes':_0x35cc9c[_0xe6d2('0x18')]?_0x35cc9c[_0xe6d2('0x18')]['attributes']||null:null,'limit':_0x35cc9c[_0xe6d2('0x18')]?_0x35cc9c['options'][_0xe6d2('0x1b')]||null:null,'include':_0x35cc9c[_0xe6d2('0x18')]?_0x35cc9c[_0xe6d2('0x18')][_0xe6d2('0x1c')]?_[_0xe6d2('0x1d')](_0x35cc9c[_0xe6d2('0x18')][_0xe6d2('0x1c')],function(_0x3f5fc1){return{'model':db[_0x3f5fc1[_0xe6d2('0x1e')]],'as':_0x3f5fc1['as'],'attributes':_0x3f5fc1['attributes'],'include':_0x3f5fc1[_0xe6d2('0x1c')]?_[_0xe6d2('0x1d')](_0x3f5fc1[_0xe6d2('0x1c')],function(_0x1de5b3){return{'model':db[_0x1de5b3[_0xe6d2('0x1e')]],'as':_0x1de5b3['as'],'attributes':_0x1de5b3['attributes'],'include':_0x1de5b3['include']?_['map'](_0x1de5b3[_0xe6d2('0x1c')],function(_0x4700b5){return{'model':db[_0x4700b5[_0xe6d2('0x1e')]],'as':_0x4700b5['as'],'attributes':_0x4700b5[_0xe6d2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe6d2('0xa')](function(_0x223992){logger[_0xe6d2('0x12')]('GetMailServerIn',_0x35cc9c);logger[_0xe6d2('0x20')]('GetMailServerIn',_0x35cc9c,JSON[_0xe6d2('0xe')](_0x223992));_0x242bcb(_0x223992);})[_0xe6d2('0x14')](function(_0x15b607){logger[_0xe6d2('0xf')](_0xe6d2('0x15'),_0x15b607[_0xe6d2('0x11')],_0x35cc9c);_0x31b572(_0x38410a[_0xe6d2('0xf')](0x1f4,_0x15b607[_0xe6d2('0x11')]));});});}; \ No newline at end of file +var _0x902b=['debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','findAll','options','raw','attributes','limit','include','map','model','GetMailServerIn','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent'];(function(_0x5eb1b7,_0x5075ab){var _0x147118=function(_0x51e4fc){while(--_0x51e4fc){_0x5eb1b7['push'](_0x5eb1b7['shift']());}};_0x147118(++_0x5075ab);}(_0x902b,0x6a));var _0xb902=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x902b[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xb902('0x0'));var util=require('util');var moment=require(_0xb902('0x1'));var BPromise=require(_0xb902('0x2'));var rs=require(_0xb902('0x3'));var fs=require('fs');var Redis=require(_0xb902('0x4'));var db=require(_0xb902('0x5'))['db'];var utils=require(_0xb902('0x6'));var logger=require('../../config/logger')(_0xb902('0x7'));var config=require('../../config/environment');var jayson=require(_0xb902('0x8'));var client=jayson['client'][_0xb902('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e7240,_0x49f60d,_0x5b0b74){return new BPromise(function(_0x55331d,_0x534c79){return client[_0xb902('0xa')](_0x5e7240,_0x5b0b74)[_0xb902('0xb')](function(_0x573fa5){logger['info'](_0xb902('0xc'),_0x49f60d,_0xb902('0xd'));logger[_0xb902('0xe')](_0xb902('0xf'),_0x49f60d,_0xb902('0xd'),JSON[_0xb902('0x10')](_0x573fa5));if(_0x573fa5[_0xb902('0x11')]){if(_0x573fa5[_0xb902('0x11')]['code']===0x1f4){logger[_0xb902('0x11')](_0xb902('0xc'),_0x49f60d,_0x573fa5[_0xb902('0x11')][_0xb902('0x12')]);return _0x534c79(_0x573fa5['error']['message']);}logger[_0xb902('0x11')](_0xb902('0xc'),_0x49f60d,_0x573fa5['error'][_0xb902('0x12')]);return _0x55331d(_0x573fa5[_0xb902('0x11')][_0xb902('0x12')]);}else{logger[_0xb902('0x13')](_0xb902('0xc'),_0x49f60d,_0xb902('0xd'));_0x55331d(_0x573fa5['result'][_0xb902('0x12')]);}})[_0xb902('0x14')](function(_0x32d4c1){logger[_0xb902('0x11')](_0xb902('0xc'),_0x49f60d,_0x32d4c1);_0x534c79(_0x32d4c1);});});}exports['GetMailServerIn']=function(_0x10bd3a){var _0x15fda2=this;return new Promise(function(_0x271218,_0x22e859){return db['MailServerIn'][_0xb902('0x15')]({'raw':_0x10bd3a['options']?_0x10bd3a[_0xb902('0x16')][_0xb902('0x17')]===undefined?!![]:![]:!![],'where':_0x10bd3a[_0xb902('0x16')]?_0x10bd3a['options']['where']||null:null,'attributes':_0x10bd3a[_0xb902('0x16')]?_0x10bd3a[_0xb902('0x16')][_0xb902('0x18')]||null:null,'limit':_0x10bd3a['options']?_0x10bd3a[_0xb902('0x16')][_0xb902('0x19')]||null:null,'include':_0x10bd3a[_0xb902('0x16')]?_0x10bd3a[_0xb902('0x16')][_0xb902('0x1a')]?_[_0xb902('0x1b')](_0x10bd3a[_0xb902('0x16')][_0xb902('0x1a')],function(_0xcd806b){return{'model':db[_0xcd806b[_0xb902('0x1c')]],'as':_0xcd806b['as'],'attributes':_0xcd806b['attributes'],'include':_0xcd806b[_0xb902('0x1a')]?_[_0xb902('0x1b')](_0xcd806b[_0xb902('0x1a')],function(_0x4fdd9c){return{'model':db[_0x4fdd9c[_0xb902('0x1c')]],'as':_0x4fdd9c['as'],'attributes':_0x4fdd9c['attributes'],'include':_0x4fdd9c[_0xb902('0x1a')]?_[_0xb902('0x1b')](_0x4fdd9c['include'],function(_0x447e06){return{'model':db[_0x447e06[_0xb902('0x1c')]],'as':_0x447e06['as'],'attributes':_0x447e06[_0xb902('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb902('0xb')](function(_0x51b93b){logger[_0xb902('0x13')](_0xb902('0x1d'),_0x10bd3a);logger[_0xb902('0xe')]('GetMailServerIn',_0x10bd3a,JSON[_0xb902('0x10')](_0x51b93b));_0x271218(_0x51b93b);})[_0xb902('0x14')](function(_0xdb81){logger['error']('GetMailServerIn',_0xdb81[_0xb902('0x12')],_0x10bd3a);_0x22e859(_0x15fda2[_0xb902('0x11')](0x1f4,_0xdb81[_0xb902('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ec0fea6..e51cb15 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(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_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('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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x7a54,0x106));var _0x47a5=function(_0x503e0e,_0x57ac51){_0x503e0e=_0x503e0e-0x0;var _0x52a808=_0x7a54[_0x503e0e];return _0x52a808;};'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 94e393e..2fb2027 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 _0xb78e=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xb78e,0x1c9));var _0xeb78=function(_0x45923f,_0xaa32da){_0x45923f=_0x45923f-0x0;var _0x3072f4=_0xb78e[_0x45923f];return _0x3072f4;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xeb78('0x2')]},'user':{'type':Sequelize[_0xeb78('0x2')]},'pass':{'type':Sequelize[_0xeb78('0x2')]},'port':{'type':Sequelize[_0xeb78('0x3')]},'secure':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xeb78('0x2')]},'authentication':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xeb78('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x087b=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x3829c4,_0x5b720c){var _0x40d453=function(_0x14817b){while(--_0x14817b){_0x3829c4['push'](_0x3829c4['shift']());}};_0x40d453(++_0x5b720c);}(_0x087b,0x11a));var _0xb087=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x087b[_0x307d86];return _0x361745;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xb087('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xb087('0x3')]},'secure':{'type':Sequelize[_0xb087('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xb087('0x2')]},'authentication':{'type':Sequelize[_0xb087('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xb087('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index c8566fe..dd9904e 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 _0x6282=['type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailServerOut','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x4b38a,_0x45fdf7){var _0xf0592b=function(_0x400581){while(--_0x400581){_0x4b38a['push'](_0x4b38a['shift']());}};_0xf0592b(++_0x45fdf7);}(_0x6282,0x1cd));var _0x2628=function(_0x11d5a6,_0x3e9648){_0x11d5a6=_0x11d5a6-0x0;var _0x23cabc=_0x6282[_0x11d5a6];return _0x23cabc;};'use strict';var emlformat=require(_0x2628('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2628('0x1'));var jsonpatch=require(_0x2628('0x2'));var rp=require(_0x2628('0x3'));var moment=require(_0x2628('0x4'));var BPromise=require(_0x2628('0x5'));var Mustache=require('mustache');var util=require(_0x2628('0x6'));var path=require('path');var sox=require(_0x2628('0x7'));var csv=require('to-csv');var ejs=require(_0x2628('0x8'));var fs=require('fs');var fs_extra=require(_0x2628('0x9'));var _=require(_0x2628('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2628('0xb'));var deskjs=require(_0x2628('0xc'));var toCsv=require(_0x2628('0xd'));var querystring=require(_0x2628('0xe'));var Papa=require(_0x2628('0xf'));var Redis=require(_0x2628('0x10'));var authService=require(_0x2628('0x11'));var qs=require(_0x2628('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2628('0x13'));var utils=require(_0x2628('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2628('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d89b4,_0x27a4a9){_0x27a4a9=_0x27a4a9||0xcc;return function(_0x155641){if(_0x155641){return _0x5d89b4['sendStatus'](_0x27a4a9);}return _0x5d89b4[_0x2628('0x16')](_0x27a4a9)[_0x2628('0x17')]();};}function respondWithResult(_0xff38b1,_0x186f81){_0x186f81=_0x186f81||0xc8;return function(_0x11f78c){if(_0x11f78c){return _0xff38b1[_0x2628('0x16')](_0x186f81)['json'](_0x11f78c);}};}function respondWithFilteredResult(_0x35732c,_0x163f45){return function(_0x5503f9){if(_0x5503f9){var _0x457ca7=typeof _0x163f45[_0x2628('0x18')]===_0x2628('0x19')&&typeof _0x163f45[_0x2628('0x1a')]==='undefined';var _0x186362=_0x5503f9[_0x2628('0x1b')];var _0x1dcb16=_0x457ca7?0x0:_0x163f45['offset'];var _0x42e890=_0x457ca7?_0x5503f9['count']:_0x163f45[_0x2628('0x18')]+_0x163f45[_0x2628('0x1a')];var _0x4a4883;if(_0x42e890>=_0x186362){_0x42e890=_0x186362;_0x4a4883=0xc8;}else{_0x4a4883=0xce;}_0x35732c['status'](_0x4a4883);return _0x35732c[_0x2628('0x1c')]('Content-Range',_0x1dcb16+'-'+_0x42e890+'/'+_0x186362)['json'](_0x5503f9);}return null;};}function patchUpdates(_0x3d4f15){return function(_0x2a30ec){try{jsonpatch['apply'](_0x2a30ec,_0x3d4f15,!![]);}catch(_0x3bf700){return BPromise[_0x2628('0x1d')](_0x3bf700);}return _0x2a30ec[_0x2628('0x1e')]();};}function saveUpdates(_0x190652,_0x2ba006){return function(_0x3321e8){if(_0x3321e8){return _0x3321e8[_0x2628('0x1f')](_0x190652)[_0x2628('0x20')](function(_0x1e6cd9){return _0x1e6cd9;});}return null;};}function removeEntity(_0x399942,_0x46636d){return function(_0x44cef9){if(_0x44cef9){return _0x44cef9[_0x2628('0x21')]()[_0x2628('0x20')](function(){_0x399942['status'](0xcc)[_0x2628('0x17')]();});}};}function handleEntityNotFound(_0x425320,_0x4a0fe1){return function(_0x133e0c){if(!_0x133e0c){_0x425320[_0x2628('0x22')](0x194);}return _0x133e0c;};}function handleError(_0x17749c,_0x407962){_0x407962=_0x407962||0x1f4;return function(_0x2f5c39){logger[_0x2628('0x23')](_0x2f5c39[_0x2628('0x24')]);if(_0x2f5c39['name']){delete _0x2f5c39[_0x2628('0x25')];}_0x17749c[_0x2628('0x16')](_0x407962)[_0x2628('0x26')](_0x2f5c39);};}exports[_0x2628('0x27')]=function(_0x37044b,_0x2b168b){var _0x52155e={},_0x191a58={},_0x23d385={'count':0x0,'rows':[]};var _0x2cbb8f=_[_0x2628('0x28')](db['MailServerOut'][_0x2628('0x29')],function(_0x5a2545){return{'name':_0x5a2545[_0x2628('0x2a')],'type':_0x5a2545[_0x2628('0x2b')][_0x2628('0x2c')]};});_0x191a58['model']=_['map'](_0x2cbb8f,_0x2628('0x25'));_0x191a58[_0x2628('0x2d')]=_[_0x2628('0x2e')](_0x37044b[_0x2628('0x2d')]);_0x191a58['filters']=_[_0x2628('0x2f')](_0x191a58[_0x2628('0x30')],_0x191a58[_0x2628('0x2d')]);_0x52155e[_0x2628('0x31')]=_['intersection'](_0x191a58[_0x2628('0x30')],qs[_0x2628('0x32')](_0x37044b[_0x2628('0x2d')]['fields']));_0x52155e['attributes']=_0x52155e['attributes'][_0x2628('0x33')]?_0x52155e['attributes']:_0x191a58[_0x2628('0x30')];if(!_0x37044b[_0x2628('0x2d')][_0x2628('0x34')](_0x2628('0x35'))){_0x52155e[_0x2628('0x1a')]=qs['limit'](_0x37044b[_0x2628('0x2d')][_0x2628('0x1a')]);_0x52155e[_0x2628('0x18')]=qs[_0x2628('0x18')](_0x37044b[_0x2628('0x2d')][_0x2628('0x18')]);}_0x52155e['order']=qs[_0x2628('0x36')](_0x37044b[_0x2628('0x2d')][_0x2628('0x36')]);_0x52155e[_0x2628('0x37')]=qs[_0x2628('0x38')](_[_0x2628('0x39')](_0x37044b['query'],_0x191a58[_0x2628('0x38')]),_0x2cbb8f);if(_0x37044b[_0x2628('0x2d')][_0x2628('0x3a')]){_0x52155e[_0x2628('0x37')]=_[_0x2628('0x3b')](_0x52155e[_0x2628('0x37')],{'$or':_[_0x2628('0x28')](_0x2cbb8f,function(_0x588cd8){if(_0x588cd8[_0x2628('0x2b')]!==_0x2628('0x3c')){var _0xd2d9a1={};_0xd2d9a1[_0x588cd8[_0x2628('0x25')]]={'$like':'%'+_0x37044b[_0x2628('0x2d')][_0x2628('0x3a')]+'%'};return _0xd2d9a1;}})});}_0x52155e=_[_0x2628('0x3b')]({},_0x52155e,_0x37044b[_0x2628('0x3d')]);var _0x1b133f={'where':_0x52155e[_0x2628('0x37')]};return db[_0x2628('0x3e')][_0x2628('0x1b')](_0x1b133f)['then'](function(_0xf37db8){_0x23d385['count']=_0xf37db8;if(_0x37044b['query'][_0x2628('0x3f')]){_0x52155e[_0x2628('0x40')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x52155e);})[_0x2628('0x20')](function(_0x4d8d2d){_0x23d385[_0x2628('0x41')]=_0x4d8d2d;return _0x23d385;})[_0x2628('0x20')](respondWithFilteredResult(_0x2b168b,_0x52155e))[_0x2628('0x42')](handleError(_0x2b168b,null));};exports[_0x2628('0x43')]=function(_0xc39de5,_0x2a7a82){var _0x18dbdb={'raw':!![],'where':{'id':_0xc39de5[_0x2628('0x44')]['id']}},_0x4b46e5={};_0x4b46e5['model']=_[_0x2628('0x2e')](db['MailServerOut'][_0x2628('0x29')]);_0x4b46e5[_0x2628('0x2d')]=_['keys'](_0xc39de5['query']);_0x4b46e5[_0x2628('0x38')]=_[_0x2628('0x2f')](_0x4b46e5[_0x2628('0x30')],_0x4b46e5[_0x2628('0x2d')]);_0x18dbdb[_0x2628('0x31')]=_[_0x2628('0x2f')](_0x4b46e5[_0x2628('0x30')],qs[_0x2628('0x32')](_0xc39de5[_0x2628('0x2d')][_0x2628('0x32')]));_0x18dbdb['attributes']=_0x18dbdb[_0x2628('0x31')][_0x2628('0x33')]?_0x18dbdb[_0x2628('0x31')]:_0x4b46e5[_0x2628('0x30')];if(_0xc39de5[_0x2628('0x2d')][_0x2628('0x3f')]){_0x18dbdb['include']=[{'all':!![]}];}_0x18dbdb=_['merge']({},_0x18dbdb,_0xc39de5['options']);return db[_0x2628('0x3e')][_0x2628('0x45')](_0x18dbdb)['then'](handleEntityNotFound(_0x2a7a82,null))[_0x2628('0x20')](respondWithResult(_0x2a7a82,null))[_0x2628('0x42')](handleError(_0x2a7a82,null));};exports[_0x2628('0x46')]=function(_0x22a417,_0x5df008){return db[_0x2628('0x3e')][_0x2628('0x46')](_0x22a417[_0x2628('0x47')],{})[_0x2628('0x20')](respondWithResult(_0x5df008,0xc9))[_0x2628('0x42')](handleError(_0x5df008,null));};exports[_0x2628('0x1f')]=function(_0x3cc93a,_0x2e1a8a){if(_0x3cc93a[_0x2628('0x47')]['id']){delete _0x3cc93a['body']['id'];}return db[_0x2628('0x3e')][_0x2628('0x45')]({'where':{'id':_0x3cc93a[_0x2628('0x44')]['id']}})[_0x2628('0x20')](handleEntityNotFound(_0x2e1a8a,null))['then'](saveUpdates(_0x3cc93a[_0x2628('0x47')],null))['then'](respondWithResult(_0x2e1a8a,null))[_0x2628('0x42')](handleError(_0x2e1a8a,null));};exports[_0x2628('0x21')]=function(_0x5dd82b,_0x20e97b){return db[_0x2628('0x3e')][_0x2628('0x45')]({'where':{'id':_0x5dd82b[_0x2628('0x44')]['id']}})[_0x2628('0x20')](handleEntityNotFound(_0x20e97b,null))[_0x2628('0x20')](removeEntity(_0x20e97b,null))[_0x2628('0x42')](handleError(_0x20e97b,null));}; \ No newline at end of file +var _0xe78f=['ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../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','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','MailServerOut','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv'];(function(_0x1877d0,_0x4fc2ec){var _0x5d5778=function(_0x34e1c2){while(--_0x34e1c2){_0x1877d0['push'](_0x1877d0['shift']());}};_0x5d5778(++_0x4fc2ec);}(_0xe78f,0x8b));var _0xfe78=function(_0x1d6cbc,_0x13b298){_0x1d6cbc=_0x1d6cbc-0x0;var _0x3e1ba3=_0xe78f[_0x1d6cbc];return _0x3e1ba3;};'use strict';var emlformat=require(_0xfe78('0x0'));var rimraf=require(_0xfe78('0x1'));var zipdir=require(_0xfe78('0x2'));var jsonpatch=require(_0xfe78('0x3'));var rp=require(_0xfe78('0x4'));var moment=require(_0xfe78('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xfe78('0x6'));var sox=require(_0xfe78('0x7'));var csv=require(_0xfe78('0x8'));var ejs=require(_0xfe78('0x9'));var fs=require('fs');var fs_extra=require(_0xfe78('0xa'));var _=require(_0xfe78('0xb'));var squel=require(_0xfe78('0xc'));var crypto=require('crypto');var jsforce=require(_0xfe78('0xd'));var deskjs=require(_0xfe78('0xe'));var toCsv=require(_0xfe78('0x8'));var querystring=require('querystring');var Papa=require(_0xfe78('0xf'));var Redis=require(_0xfe78('0x10'));var authService=require(_0xfe78('0x11'));var qs=require(_0xfe78('0x12'));var as=require(_0xfe78('0x13'));var hardwareService=require(_0xfe78('0x14'));var logger=require(_0xfe78('0x15'))(_0xfe78('0x16'));var utils=require('../../config/utils');var config=require(_0xfe78('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe78('0x18'))['db'];function respondWithStatusCode(_0x385145,_0x5b85b7){_0x5b85b7=_0x5b85b7||0xcc;return function(_0x129cb0){if(_0x129cb0){return _0x385145[_0xfe78('0x19')](_0x5b85b7);}return _0x385145['status'](_0x5b85b7)[_0xfe78('0x1a')]();};}function respondWithResult(_0x3952c2,_0x3a5dfb){_0x3a5dfb=_0x3a5dfb||0xc8;return function(_0x25352a){if(_0x25352a){return _0x3952c2[_0xfe78('0x1b')](_0x3a5dfb)[_0xfe78('0x1c')](_0x25352a);}};}function respondWithFilteredResult(_0x468e97,_0x2021e1){return function(_0x55672a){if(_0x55672a){var _0x598d5d=typeof _0x2021e1[_0xfe78('0x1d')]==='undefined'&&typeof _0x2021e1[_0xfe78('0x1e')]===_0xfe78('0x1f');var _0x17c870=_0x55672a['count'];var _0x48b0fb=_0x598d5d?0x0:_0x2021e1['offset'];var _0x6dc79f=_0x598d5d?_0x55672a[_0xfe78('0x20')]:_0x2021e1[_0xfe78('0x1d')]+_0x2021e1['limit'];var _0x141d39;if(_0x6dc79f>=_0x17c870){_0x6dc79f=_0x17c870;_0x141d39=0xc8;}else{_0x141d39=0xce;}_0x468e97[_0xfe78('0x1b')](_0x141d39);return _0x468e97['set'](_0xfe78('0x21'),_0x48b0fb+'-'+_0x6dc79f+'/'+_0x17c870)[_0xfe78('0x1c')](_0x55672a);}return null;};}function patchUpdates(_0x5a03af){return function(_0x3bfbfe){try{jsonpatch[_0xfe78('0x22')](_0x3bfbfe,_0x5a03af,!![]);}catch(_0x5bbdbb){return BPromise[_0xfe78('0x23')](_0x5bbdbb);}return _0x3bfbfe[_0xfe78('0x24')]();};}function saveUpdates(_0x3afe9b,_0x45dcdb){return function(_0x1c28b2){if(_0x1c28b2){return _0x1c28b2[_0xfe78('0x25')](_0x3afe9b)[_0xfe78('0x26')](function(_0x1023f2){return _0x1023f2;});}return null;};}function removeEntity(_0x2e7c41,_0x204ec9){return function(_0x14a21f){if(_0x14a21f){return _0x14a21f[_0xfe78('0x27')]()[_0xfe78('0x26')](function(){_0x2e7c41[_0xfe78('0x1b')](0xcc)[_0xfe78('0x1a')]();});}};}function handleEntityNotFound(_0x98ba3b,_0x3cff69){return function(_0x13a4ba){if(!_0x13a4ba){_0x98ba3b[_0xfe78('0x19')](0x194);}return _0x13a4ba;};}function handleError(_0x3b46e9,_0x29b52a){_0x29b52a=_0x29b52a||0x1f4;return function(_0x32ec63){logger[_0xfe78('0x28')](_0x32ec63['stack']);if(_0x32ec63[_0xfe78('0x29')]){delete _0x32ec63[_0xfe78('0x29')];}_0x3b46e9[_0xfe78('0x1b')](_0x29b52a)[_0xfe78('0x2a')](_0x32ec63);};}exports['index']=function(_0x1c8df1,_0x58a455){var _0x2d3846={},_0x5bdc5e={},_0x2c54fb={'count':0x0,'rows':[]};var _0x5fc2c0=_[_0xfe78('0x2b')](db[_0xfe78('0x2c')][_0xfe78('0x2d')],function(_0x193748){return{'name':_0x193748[_0xfe78('0x2e')],'type':_0x193748['type']['key']};});_0x5bdc5e[_0xfe78('0x2f')]=_[_0xfe78('0x2b')](_0x5fc2c0,_0xfe78('0x29'));_0x5bdc5e[_0xfe78('0x30')]=_[_0xfe78('0x31')](_0x1c8df1['query']);_0x5bdc5e[_0xfe78('0x32')]=_['intersection'](_0x5bdc5e[_0xfe78('0x2f')],_0x5bdc5e[_0xfe78('0x30')]);_0x2d3846['attributes']=_[_0xfe78('0x33')](_0x5bdc5e['model'],qs[_0xfe78('0x34')](_0x1c8df1[_0xfe78('0x30')][_0xfe78('0x34')]));_0x2d3846[_0xfe78('0x35')]=_0x2d3846[_0xfe78('0x35')][_0xfe78('0x36')]?_0x2d3846['attributes']:_0x5bdc5e[_0xfe78('0x2f')];if(!_0x1c8df1[_0xfe78('0x30')][_0xfe78('0x37')](_0xfe78('0x38'))){_0x2d3846[_0xfe78('0x1e')]=qs[_0xfe78('0x1e')](_0x1c8df1['query'][_0xfe78('0x1e')]);_0x2d3846[_0xfe78('0x1d')]=qs[_0xfe78('0x1d')](_0x1c8df1['query']['offset']);}_0x2d3846[_0xfe78('0x39')]=qs[_0xfe78('0x3a')](_0x1c8df1[_0xfe78('0x30')][_0xfe78('0x3a')]);_0x2d3846[_0xfe78('0x3b')]=qs[_0xfe78('0x32')](_['pick'](_0x1c8df1['query'],_0x5bdc5e[_0xfe78('0x32')]),_0x5fc2c0);if(_0x1c8df1['query'][_0xfe78('0x3c')]){_0x2d3846[_0xfe78('0x3b')]=_[_0xfe78('0x3d')](_0x2d3846[_0xfe78('0x3b')],{'$or':_['map'](_0x5fc2c0,function(_0x38f4bd){if(_0x38f4bd[_0xfe78('0x3e')]!==_0xfe78('0x3f')){var _0x11c479={};_0x11c479[_0x38f4bd['name']]={'$like':'%'+_0x1c8df1[_0xfe78('0x30')][_0xfe78('0x3c')]+'%'};return _0x11c479;}})});}_0x2d3846=_[_0xfe78('0x3d')]({},_0x2d3846,_0x1c8df1['options']);var _0xabd5c5={'where':_0x2d3846[_0xfe78('0x3b')]};return db['MailServerOut'][_0xfe78('0x20')](_0xabd5c5)['then'](function(_0x293209){_0x2c54fb[_0xfe78('0x20')]=_0x293209;if(_0x1c8df1[_0xfe78('0x30')][_0xfe78('0x40')]){_0x2d3846[_0xfe78('0x41')]=[{'all':!![]}];}return db[_0xfe78('0x2c')][_0xfe78('0x42')](_0x2d3846);})[_0xfe78('0x26')](function(_0xe50445){_0x2c54fb[_0xfe78('0x43')]=_0xe50445;return _0x2c54fb;})[_0xfe78('0x26')](respondWithFilteredResult(_0x58a455,_0x2d3846))[_0xfe78('0x44')](handleError(_0x58a455,null));};exports[_0xfe78('0x45')]=function(_0x8036af,_0x4edf84){var _0x503e88={'raw':!![],'where':{'id':_0x8036af['params']['id']}},_0x2bb7d0={};_0x2bb7d0['model']=_[_0xfe78('0x31')](db[_0xfe78('0x2c')][_0xfe78('0x2d')]);_0x2bb7d0[_0xfe78('0x30')]=_[_0xfe78('0x31')](_0x8036af[_0xfe78('0x30')]);_0x2bb7d0[_0xfe78('0x32')]=_[_0xfe78('0x33')](_0x2bb7d0[_0xfe78('0x2f')],_0x2bb7d0['query']);_0x503e88['attributes']=_[_0xfe78('0x33')](_0x2bb7d0['model'],qs[_0xfe78('0x34')](_0x8036af['query'][_0xfe78('0x34')]));_0x503e88[_0xfe78('0x35')]=_0x503e88[_0xfe78('0x35')][_0xfe78('0x36')]?_0x503e88[_0xfe78('0x35')]:_0x2bb7d0['model'];if(_0x8036af[_0xfe78('0x30')][_0xfe78('0x40')]){_0x503e88[_0xfe78('0x41')]=[{'all':!![]}];}_0x503e88=_[_0xfe78('0x3d')]({},_0x503e88,_0x8036af[_0xfe78('0x46')]);return db[_0xfe78('0x2c')][_0xfe78('0x47')](_0x503e88)['then'](handleEntityNotFound(_0x4edf84,null))[_0xfe78('0x26')](respondWithResult(_0x4edf84,null))['catch'](handleError(_0x4edf84,null));};exports[_0xfe78('0x48')]=function(_0x5d4cbf,_0x590dd7){return db[_0xfe78('0x2c')][_0xfe78('0x48')](_0x5d4cbf['body'],{})['then'](respondWithResult(_0x590dd7,0xc9))['catch'](handleError(_0x590dd7,null));};exports[_0xfe78('0x25')]=function(_0x215e09,_0x5617b2){if(_0x215e09['body']['id']){delete _0x215e09['body']['id'];}return db[_0xfe78('0x2c')][_0xfe78('0x47')]({'where':{'id':_0x215e09[_0xfe78('0x49')]['id']}})[_0xfe78('0x26')](handleEntityNotFound(_0x5617b2,null))[_0xfe78('0x26')](saveUpdates(_0x215e09['body'],null))[_0xfe78('0x26')](respondWithResult(_0x5617b2,null))[_0xfe78('0x44')](handleError(_0x5617b2,null));};exports[_0xfe78('0x27')]=function(_0x41c7db,_0x20d7eb){return db[_0xfe78('0x2c')][_0xfe78('0x47')]({'where':{'id':_0x41c7db[_0xfe78('0x49')]['id']}})['then'](handleEntityNotFound(_0x20d7eb,null))[_0xfe78('0x26')](removeEntity(_0x20d7eb,null))[_0xfe78('0x44')](handleError(_0x20d7eb,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 57561a3..f08d272 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 _0x49c5=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','api','moment','request-promise','path'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0x49c5,0x132));var _0x549c=function(_0x2043d2,_0x4c39bf){_0x2043d2=_0x2043d2-0x0;var _0x26e4af=_0x49c5[_0x2043d2];return _0x26e4af;};'use strict';var _=require(_0x549c('0x0'));var util=require(_0x549c('0x1'));var logger=require('../../config/logger')(_0x549c('0x2'));var moment=require(_0x549c('0x3'));var BPromise=require('bluebird');var rp=require(_0x549c('0x4'));var fs=require('fs');var path=require(_0x549c('0x5'));var rimraf=require(_0x549c('0x6'));var config=require(_0x549c('0x7'));var attributes=require(_0x549c('0x8'));module[_0x549c('0x9')]=function(_0x415e96,_0x1b95fc){return _0x415e96[_0x549c('0xa')](_0x549c('0xb'),attributes,{'tableName':_0x549c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3060=['exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment','path','rimraf','./mailServerOut.attributes'];(function(_0x5ca17c,_0xc082bd){var _0xf7348b=function(_0x4f2885){while(--_0x4f2885){_0x5ca17c['push'](_0x5ca17c['shift']());}};_0xf7348b(++_0xc082bd);}(_0x3060,0x1d8));var _0x0306=function(_0x3c4016,_0x2e220f){_0x3c4016=_0x3c4016-0x0;var _0x3cebbd=_0x3060[_0x3c4016];return _0x3cebbd;};'use strict';var _=require(_0x0306('0x0'));var util=require(_0x0306('0x1'));var logger=require(_0x0306('0x2'))(_0x0306('0x3'));var moment=require(_0x0306('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0306('0x5'));var rimraf=require(_0x0306('0x6'));var config=require('../../config/environment');var attributes=require(_0x0306('0x7'));module[_0x0306('0x8')]=function(_0xbdeb37,_0x43315a){return _0xbdeb37[_0x0306('0x9')](_0x0306('0xa'),attributes,{'tableName':_0x0306('0xb'),'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 908ca7a..13b6af4 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(_0x57810d,_0x3bb181){var _0x272f76=function(_0x73a492){while(--_0x73a492){_0x57810d['push'](_0x57810d['shift']());}};_0x272f76(++_0x3bb181);}(_0xdb28,0x106));var _0x8db2=function(_0x56cc50,_0x34f09c){_0x56cc50=_0x56cc50-0x0;var _0x37ce83=_0xdb28[_0x56cc50];return _0x37ce83;};'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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x2ef3,0xba));var _0x32ef=function(_0x6041f7,_0x130fd4){_0x6041f7=_0x6041f7-0x0;var _0x460255=_0x2ef3[_0x6041f7];return _0x460255;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 0e27656..01ebfd6 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 _0x748f=['put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x4d7769,_0x12ec53){var _0x30b5ac=function(_0x4bb27d){while(--_0x4bb27d){_0x4d7769['push'](_0x4d7769['shift']());}};_0x30b5ac(++_0x12ec53);}(_0x748f,0x194));var _0xf748=function(_0x3018cb,_0x5cece4){_0x3018cb=_0x3018cb-0x0;var _0x91249=_0x748f[_0x3018cb];return _0x91249;};'use strict';var multer=require(_0xf748('0x0'));var util=require('util');var path=require(_0xf748('0x1'));var timeout=require(_0xf748('0x2'));var express=require('express');var router=express[_0xf748('0x3')]();var fs_extra=require(_0xf748('0x4'));var auth=require(_0xf748('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf748('0x6'));var controller=require(_0xf748('0x7'));router[_0xf748('0x8')]('/',auth[_0xf748('0x9')](),controller['index']);router['get'](_0xf748('0xa'),auth[_0xf748('0x9')](),controller[_0xf748('0xb')]);router['get'](_0xf748('0xc'),auth['isAuthenticated'](),controller[_0xf748('0xd')]);router[_0xf748('0xe')]('/',auth['isAuthenticated'](),controller[_0xf748('0xf')]);router[_0xf748('0x10')](_0xf748('0xc'),auth[_0xf748('0x9')](),controller[_0xf748('0x11')]);router['delete']('/:id',auth[_0xf748('0x9')](),controller[_0xf748('0x12')]);module[_0xf748('0x13')]=router; \ No newline at end of file +var _0xb91a=['../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','/describe','describe','/:id','isAuthenticated','post','create','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0xb91a,0x1c2));var _0xab91=function(_0x393d70,_0x49dffe){_0x393d70=_0x393d70-0x0;var _0x24c2f9=_0xb91a[_0x393d70];return _0x24c2f9;};'use strict';var multer=require(_0xab91('0x0'));var util=require('util');var path=require(_0xab91('0x1'));var timeout=require(_0xab91('0x2'));var express=require(_0xab91('0x3'));var router=express['Router']();var fs_extra=require(_0xab91('0x4'));var auth=require(_0xab91('0x5'));var interaction=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var controller=require(_0xab91('0x8'));router[_0xab91('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xab91('0x9')](_0xab91('0xa'),auth['isAuthenticated'](),controller[_0xab91('0xb')]);router[_0xab91('0x9')](_0xab91('0xc'),auth[_0xab91('0xd')](),controller['show']);router[_0xab91('0xe')]('/',auth[_0xab91('0xd')](),controller[_0xab91('0xf')]);router['put'](_0xab91('0xc'),auth[_0xab91('0xd')](),controller[_0xab91('0x10')]);router[_0xab91('0x11')](_0xab91('0xc'),auth[_0xab91('0xd')](),controller['destroy']);module[_0xab91('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 43c4383..424daf9 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 _0xdfa0=['sequelize','STRING','name'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xdfa0,0x69));var _0x0dfa=function(_0x50a790,_0x2704b4){_0x50a790=_0x50a790-0x0;var _0x35f775=_0xdfa0[_0x50a790];return _0x35f775;};'use strict';var Sequelize=require(_0x0dfa('0x0'));module['exports']={'name':{'type':Sequelize[_0x0dfa('0x1')],'unique':_0x0dfa('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbeea=['sequelize','STRING','name'];(function(_0x2dbc16,_0x18b2f3){var _0x3f3cf5=function(_0x32f64d){while(--_0x32f64d){_0x2dbc16['push'](_0x2dbc16['shift']());}};_0x3f3cf5(++_0x18b2f3);}(_0xbeea,0xb1));var _0xabee=function(_0x1eabe2,_0x24666c){_0x1eabe2=_0x1eabe2-0x0;var _0x39adc0=_0xbeea[_0x1eabe2];return _0x39adc0;};'use strict';var Sequelize=require(_0xabee('0x0'));module['exports']={'name':{'type':Sequelize[_0xabee('0x1')],'unique':_0xabee('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xabee('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 0921c2e..d4df8be 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 _0xd5f5=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','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','destroy','error','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0xfa751f,_0xa94e0e){var _0x42e833=function(_0x239272){while(--_0x239272){_0xfa751f['push'](_0xfa751f['shift']());}};_0x42e833(++_0xa94e0e);}(_0xd5f5,0x103));var _0x5d5f=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd5f5[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x5d5f('0x0'));var rimraf=require(_0x5d5f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5d5f('0x2'));var rp=require(_0x5d5f('0x3'));var moment=require(_0x5d5f('0x4'));var BPromise=require(_0x5d5f('0x5'));var Mustache=require(_0x5d5f('0x6'));var util=require(_0x5d5f('0x7'));var path=require(_0x5d5f('0x8'));var sox=require(_0x5d5f('0x9'));var csv=require('to-csv');var ejs=require(_0x5d5f('0xa'));var fs=require('fs');var fs_extra=require(_0x5d5f('0xb'));var _=require(_0x5d5f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5d5f('0xd'));var deskjs=require(_0x5d5f('0xe'));var toCsv=require(_0x5d5f('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5d5f('0x10'));var authService=require(_0x5d5f('0x11'));var qs=require(_0x5d5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5d5f('0x13'));var logger=require(_0x5d5f('0x14'))(_0x5d5f('0x15'));var utils=require(_0x5d5f('0x16'));var config=require(_0x5d5f('0x17'));var licenseUtil=require(_0x5d5f('0x18'));var db=require(_0x5d5f('0x19'))['db'];function respondWithStatusCode(_0x286784,_0x3e73be){_0x3e73be=_0x3e73be||0xcc;return function(_0x40fb5){if(_0x40fb5){return _0x286784[_0x5d5f('0x1a')](_0x3e73be);}return _0x286784[_0x5d5f('0x1b')](_0x3e73be)[_0x5d5f('0x1c')]();};}function respondWithResult(_0x188d8f,_0x2962){_0x2962=_0x2962||0xc8;return function(_0x30175d){if(_0x30175d){return _0x188d8f[_0x5d5f('0x1b')](_0x2962)[_0x5d5f('0x1d')](_0x30175d);}};}function respondWithFilteredResult(_0x413b1d,_0x5ab9ab){return function(_0x135a7f){if(_0x135a7f){var _0x2a5217=typeof _0x5ab9ab[_0x5d5f('0x1e')]===_0x5d5f('0x1f')&&typeof _0x5ab9ab[_0x5d5f('0x20')]==='undefined';var _0x529e6c=_0x135a7f['count'];var _0x398f34=_0x2a5217?0x0:_0x5ab9ab[_0x5d5f('0x1e')];var _0x2f504e=_0x2a5217?_0x135a7f[_0x5d5f('0x21')]:_0x5ab9ab[_0x5d5f('0x1e')]+_0x5ab9ab[_0x5d5f('0x20')];var _0x1418ab;if(_0x2f504e>=_0x529e6c){_0x2f504e=_0x529e6c;_0x1418ab=0xc8;}else{_0x1418ab=0xce;}_0x413b1d[_0x5d5f('0x1b')](_0x1418ab);return _0x413b1d[_0x5d5f('0x22')](_0x5d5f('0x23'),_0x398f34+'-'+_0x2f504e+'/'+_0x529e6c)[_0x5d5f('0x1d')](_0x135a7f);}return null;};}function patchUpdates(_0x56b950){return function(_0xb0f4fd){try{jsonpatch[_0x5d5f('0x24')](_0xb0f4fd,_0x56b950,!![]);}catch(_0x3b0b69){return BPromise[_0x5d5f('0x25')](_0x3b0b69);}return _0xb0f4fd['save']();};}function saveUpdates(_0x304047,_0x24f9db){return function(_0x2ab30a){if(_0x2ab30a){return _0x2ab30a['update'](_0x304047)['then'](function(_0x114633){return _0x114633;});}return null;};}function removeEntity(_0x2a208f,_0x3d5ce2){return function(_0x2c2e10){if(_0x2c2e10){return _0x2c2e10[_0x5d5f('0x26')]()['then'](function(){_0x2a208f[_0x5d5f('0x1b')](0xcc)[_0x5d5f('0x1c')]();});}};}function handleEntityNotFound(_0x5eb656,_0x44af96){return function(_0x3c1eea){if(!_0x3c1eea){_0x5eb656[_0x5d5f('0x1a')](0x194);}return _0x3c1eea;};}function handleError(_0x3d0a31,_0x2cc774){_0x2cc774=_0x2cc774||0x1f4;return function(_0x144696){logger[_0x5d5f('0x27')](_0x144696[_0x5d5f('0x28')]);if(_0x144696[_0x5d5f('0x29')]){delete _0x144696[_0x5d5f('0x29')];}_0x3d0a31[_0x5d5f('0x1b')](_0x2cc774)[_0x5d5f('0x2a')](_0x144696);};}exports['index']=function(_0x13fd4b,_0x4468d0){var _0x1ce2b2={},_0x501bf7={},_0x4445a8={'count':0x0,'rows':[]};var _0x32c266=_[_0x5d5f('0x2b')](db[_0x5d5f('0x2c')][_0x5d5f('0x2d')],function(_0x376eb8){return{'name':_0x376eb8[_0x5d5f('0x2e')],'type':_0x376eb8[_0x5d5f('0x2f')]['key']};});_0x501bf7[_0x5d5f('0x30')]=_[_0x5d5f('0x2b')](_0x32c266,_0x5d5f('0x29'));_0x501bf7[_0x5d5f('0x31')]=_[_0x5d5f('0x32')](_0x13fd4b[_0x5d5f('0x31')]);_0x501bf7[_0x5d5f('0x33')]=_[_0x5d5f('0x34')](_0x501bf7[_0x5d5f('0x30')],_0x501bf7[_0x5d5f('0x31')]);_0x1ce2b2[_0x5d5f('0x35')]=_[_0x5d5f('0x34')](_0x501bf7[_0x5d5f('0x30')],qs['fields'](_0x13fd4b['query'][_0x5d5f('0x36')]));_0x1ce2b2[_0x5d5f('0x35')]=_0x1ce2b2['attributes']['length']?_0x1ce2b2[_0x5d5f('0x35')]:_0x501bf7[_0x5d5f('0x30')];if(!_0x13fd4b['query'][_0x5d5f('0x37')](_0x5d5f('0x38'))){_0x1ce2b2[_0x5d5f('0x20')]=qs[_0x5d5f('0x20')](_0x13fd4b['query'][_0x5d5f('0x20')]);_0x1ce2b2['offset']=qs['offset'](_0x13fd4b[_0x5d5f('0x31')][_0x5d5f('0x1e')]);}_0x1ce2b2[_0x5d5f('0x39')]=qs[_0x5d5f('0x3a')](_0x13fd4b[_0x5d5f('0x31')]['sort']);_0x1ce2b2[_0x5d5f('0x3b')]=qs[_0x5d5f('0x33')](_[_0x5d5f('0x3c')](_0x13fd4b[_0x5d5f('0x31')],_0x501bf7[_0x5d5f('0x33')]),_0x32c266);if(_0x13fd4b[_0x5d5f('0x31')][_0x5d5f('0x3d')]){_0x1ce2b2[_0x5d5f('0x3b')]=_[_0x5d5f('0x3e')](_0x1ce2b2['where'],{'$or':_[_0x5d5f('0x2b')](_0x32c266,function(_0x1255ac){if(_0x1255ac['type']!==_0x5d5f('0x3f')){var _0x347cc6={};_0x347cc6[_0x1255ac['name']]={'$like':'%'+_0x13fd4b[_0x5d5f('0x31')][_0x5d5f('0x3d')]+'%'};return _0x347cc6;}})});}_0x1ce2b2=_[_0x5d5f('0x3e')]({},_0x1ce2b2,_0x13fd4b[_0x5d5f('0x40')]);var _0xb6aff2={'where':_0x1ce2b2[_0x5d5f('0x3b')]};return db[_0x5d5f('0x2c')]['count'](_0xb6aff2)[_0x5d5f('0x41')](function(_0x132126){_0x4445a8[_0x5d5f('0x21')]=_0x132126;if(_0x13fd4b[_0x5d5f('0x31')][_0x5d5f('0x42')]){_0x1ce2b2[_0x5d5f('0x43')]=[{'all':!![]}];}return db[_0x5d5f('0x2c')][_0x5d5f('0x44')](_0x1ce2b2);})[_0x5d5f('0x41')](function(_0x7a87bd){_0x4445a8[_0x5d5f('0x45')]=_0x7a87bd;return _0x4445a8;})[_0x5d5f('0x41')](respondWithFilteredResult(_0x4468d0,_0x1ce2b2))[_0x5d5f('0x46')](handleError(_0x4468d0,null));};exports[_0x5d5f('0x47')]=function(_0x3d64b5,_0x33d305){var _0x2b2be8={'raw':!![],'where':{'id':_0x3d64b5[_0x5d5f('0x48')]['id']}},_0x199d85={};_0x199d85[_0x5d5f('0x30')]=_['keys'](db[_0x5d5f('0x2c')][_0x5d5f('0x2d')]);_0x199d85[_0x5d5f('0x31')]=_[_0x5d5f('0x32')](_0x3d64b5[_0x5d5f('0x31')]);_0x199d85['filters']=_[_0x5d5f('0x34')](_0x199d85[_0x5d5f('0x30')],_0x199d85[_0x5d5f('0x31')]);_0x2b2be8[_0x5d5f('0x35')]=_[_0x5d5f('0x34')](_0x199d85['model'],qs['fields'](_0x3d64b5[_0x5d5f('0x31')][_0x5d5f('0x36')]));_0x2b2be8['attributes']=_0x2b2be8[_0x5d5f('0x35')][_0x5d5f('0x49')]?_0x2b2be8['attributes']:_0x199d85['model'];if(_0x3d64b5[_0x5d5f('0x31')][_0x5d5f('0x42')]){_0x2b2be8[_0x5d5f('0x43')]=[{'all':!![]}];}_0x2b2be8=_['merge']({},_0x2b2be8,_0x3d64b5[_0x5d5f('0x40')]);return db[_0x5d5f('0x2c')][_0x5d5f('0x4a')](_0x2b2be8)[_0x5d5f('0x41')](handleEntityNotFound(_0x33d305,null))[_0x5d5f('0x41')](respondWithResult(_0x33d305,null))[_0x5d5f('0x46')](handleError(_0x33d305,null));};exports[_0x5d5f('0x4b')]=function(_0x5f4025,_0x8ca033){return db[_0x5d5f('0x2c')][_0x5d5f('0x4b')](_0x5f4025[_0x5d5f('0x4c')],{})['then'](respondWithResult(_0x8ca033,0xc9))[_0x5d5f('0x46')](handleError(_0x8ca033,null));};exports['update']=function(_0x7683e3,_0x2ee74c){if(_0x7683e3[_0x5d5f('0x4c')]['id']){delete _0x7683e3['body']['id'];}return db['MailSubstatus'][_0x5d5f('0x4a')]({'where':{'id':_0x7683e3[_0x5d5f('0x48')]['id']}})[_0x5d5f('0x41')](handleEntityNotFound(_0x2ee74c,null))[_0x5d5f('0x41')](saveUpdates(_0x7683e3['body'],null))['then'](respondWithResult(_0x2ee74c,null))[_0x5d5f('0x46')](handleError(_0x2ee74c,null));};exports[_0x5d5f('0x26')]=function(_0xc96e89,_0x37c7ac){return db[_0x5d5f('0x2c')]['find']({'where':{'id':_0xc96e89[_0x5d5f('0x48')]['id']}})[_0x5d5f('0x41')](handleEntityNotFound(_0x37c7ac,null))[_0x5d5f('0x41')](removeEntity(_0x37c7ac,null))['catch'](handleError(_0x37c7ac,null));};exports[_0x5d5f('0x4d')]=function(_0x370b37,_0xdaf9fb){return db[_0x5d5f('0x2c')][_0x5d5f('0x4d')]()[_0x5d5f('0x41')](respondWithResult(_0xdaf9fb,null))[_0x5d5f('0x46')](handleError(_0xdaf9fb,null));}; \ No newline at end of file +var _0x64e1=['model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','then','params','intersection','length','find','catch','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','end','error','stack','name','send','index','MailSubstatus','rawAttributes','type','key','map','query','keys','filters'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x64e1,0x15f));var _0x164e=function(_0x2dfd53,_0x342eb7){_0x2dfd53=_0x2dfd53-0x0;var _0x4100e7=_0x64e1[_0x2dfd53];return _0x4100e7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x164e('0x0'));var jsonpatch=require(_0x164e('0x1'));var rp=require(_0x164e('0x2'));var moment=require(_0x164e('0x3'));var BPromise=require(_0x164e('0x4'));var Mustache=require(_0x164e('0x5'));var util=require(_0x164e('0x6'));var path=require(_0x164e('0x7'));var sox=require(_0x164e('0x8'));var csv=require(_0x164e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x164e('0xa'));var _=require(_0x164e('0xb'));var squel=require('squel');var crypto=require(_0x164e('0xc'));var jsforce=require(_0x164e('0xd'));var deskjs=require(_0x164e('0xe'));var toCsv=require(_0x164e('0x9'));var querystring=require(_0x164e('0xf'));var Papa=require(_0x164e('0x10'));var Redis=require(_0x164e('0x11'));var authService=require(_0x164e('0x12'));var qs=require(_0x164e('0x13'));var as=require(_0x164e('0x14'));var hardwareService=require(_0x164e('0x15'));var logger=require(_0x164e('0x16'))(_0x164e('0x17'));var utils=require('../../config/utils');var config=require(_0x164e('0x18'));var licenseUtil=require(_0x164e('0x19'));var db=require(_0x164e('0x1a'))['db'];function respondWithStatusCode(_0xbc2198,_0x59f66e){_0x59f66e=_0x59f66e||0xcc;return function(_0x437702){if(_0x437702){return _0xbc2198[_0x164e('0x1b')](_0x59f66e);}return _0xbc2198[_0x164e('0x1c')](_0x59f66e)['end']();};}function respondWithResult(_0xbd2b2f,_0xcb6f03){_0xcb6f03=_0xcb6f03||0xc8;return function(_0xbe4d51){if(_0xbe4d51){return _0xbd2b2f[_0x164e('0x1c')](_0xcb6f03)[_0x164e('0x1d')](_0xbe4d51);}};}function respondWithFilteredResult(_0x8cde4c,_0xc74996){return function(_0x17a9db){if(_0x17a9db){var _0x8c0e9c=typeof _0xc74996[_0x164e('0x1e')]===_0x164e('0x1f')&&typeof _0xc74996[_0x164e('0x20')]==='undefined';var _0x1bd244=_0x17a9db[_0x164e('0x21')];var _0x2ee0ae=_0x8c0e9c?0x0:_0xc74996[_0x164e('0x1e')];var _0x5ecd7a=_0x8c0e9c?_0x17a9db['count']:_0xc74996[_0x164e('0x1e')]+_0xc74996[_0x164e('0x20')];var _0x3a3e7d;if(_0x5ecd7a>=_0x1bd244){_0x5ecd7a=_0x1bd244;_0x3a3e7d=0xc8;}else{_0x3a3e7d=0xce;}_0x8cde4c[_0x164e('0x1c')](_0x3a3e7d);return _0x8cde4c[_0x164e('0x22')](_0x164e('0x23'),_0x2ee0ae+'-'+_0x5ecd7a+'/'+_0x1bd244)[_0x164e('0x1d')](_0x17a9db);}return null;};}function patchUpdates(_0x380a67){return function(_0x45106f){try{jsonpatch[_0x164e('0x24')](_0x45106f,_0x380a67,!![]);}catch(_0x540b13){return BPromise[_0x164e('0x25')](_0x540b13);}return _0x45106f[_0x164e('0x26')]();};}function saveUpdates(_0x550ad8,_0x5e7bd5){return function(_0xf633d5){if(_0xf633d5){return _0xf633d5[_0x164e('0x27')](_0x550ad8)['then'](function(_0x408313){return _0x408313;});}return null;};}function removeEntity(_0x47b27c,_0x5c98fb){return function(_0x666d60){if(_0x666d60){return _0x666d60['destroy']()['then'](function(){_0x47b27c[_0x164e('0x1c')](0xcc)[_0x164e('0x28')]();});}};}function handleEntityNotFound(_0x4ff9af,_0x62ca0f){return function(_0x245bbc){if(!_0x245bbc){_0x4ff9af[_0x164e('0x1b')](0x194);}return _0x245bbc;};}function handleError(_0x4e8813,_0x131958){_0x131958=_0x131958||0x1f4;return function(_0x417508){logger[_0x164e('0x29')](_0x417508[_0x164e('0x2a')]);if(_0x417508[_0x164e('0x2b')]){delete _0x417508[_0x164e('0x2b')];}_0x4e8813['status'](_0x131958)[_0x164e('0x2c')](_0x417508);};}exports[_0x164e('0x2d')]=function(_0x193370,_0x254b14){var _0x9edab2={},_0x1cd585={},_0x1a74dd={'count':0x0,'rows':[]};var _0x5d919d=_['map'](db[_0x164e('0x2e')][_0x164e('0x2f')],function(_0x22c100){return{'name':_0x22c100['fieldName'],'type':_0x22c100[_0x164e('0x30')][_0x164e('0x31')]};});_0x1cd585['model']=_[_0x164e('0x32')](_0x5d919d,'name');_0x1cd585[_0x164e('0x33')]=_[_0x164e('0x34')](_0x193370[_0x164e('0x33')]);_0x1cd585[_0x164e('0x35')]=_['intersection'](_0x1cd585[_0x164e('0x36')],_0x1cd585[_0x164e('0x33')]);_0x9edab2[_0x164e('0x37')]=_['intersection'](_0x1cd585[_0x164e('0x36')],qs[_0x164e('0x38')](_0x193370[_0x164e('0x33')][_0x164e('0x38')]));_0x9edab2[_0x164e('0x37')]=_0x9edab2[_0x164e('0x37')]['length']?_0x9edab2[_0x164e('0x37')]:_0x1cd585[_0x164e('0x36')];if(!_0x193370['query'][_0x164e('0x39')](_0x164e('0x3a'))){_0x9edab2['limit']=qs[_0x164e('0x20')](_0x193370[_0x164e('0x33')]['limit']);_0x9edab2['offset']=qs[_0x164e('0x1e')](_0x193370[_0x164e('0x33')][_0x164e('0x1e')]);}_0x9edab2[_0x164e('0x3b')]=qs[_0x164e('0x3c')](_0x193370[_0x164e('0x33')][_0x164e('0x3c')]);_0x9edab2['where']=qs[_0x164e('0x35')](_[_0x164e('0x3d')](_0x193370[_0x164e('0x33')],_0x1cd585[_0x164e('0x35')]),_0x5d919d);if(_0x193370['query']['filter']){_0x9edab2[_0x164e('0x3e')]=_[_0x164e('0x3f')](_0x9edab2[_0x164e('0x3e')],{'$or':_[_0x164e('0x32')](_0x5d919d,function(_0x14422b){if(_0x14422b[_0x164e('0x30')]!==_0x164e('0x40')){var _0x67f9f={};_0x67f9f[_0x14422b['name']]={'$like':'%'+_0x193370[_0x164e('0x33')][_0x164e('0x41')]+'%'};return _0x67f9f;}})});}_0x9edab2=_[_0x164e('0x3f')]({},_0x9edab2,_0x193370[_0x164e('0x42')]);var _0x4fea8d={'where':_0x9edab2[_0x164e('0x3e')]};return db['MailSubstatus'][_0x164e('0x21')](_0x4fea8d)['then'](function(_0x205a7c){_0x1a74dd[_0x164e('0x21')]=_0x205a7c;if(_0x193370[_0x164e('0x33')][_0x164e('0x43')]){_0x9edab2[_0x164e('0x44')]=[{'all':!![]}];}return db['MailSubstatus'][_0x164e('0x45')](_0x9edab2);})['then'](function(_0x319d97){_0x1a74dd[_0x164e('0x46')]=_0x319d97;return _0x1a74dd;})[_0x164e('0x47')](respondWithFilteredResult(_0x254b14,_0x9edab2))['catch'](handleError(_0x254b14,null));};exports['show']=function(_0x33baaf,_0x26c630){var _0x18bd24={'raw':!![],'where':{'id':_0x33baaf[_0x164e('0x48')]['id']}},_0x42c6c4={};_0x42c6c4[_0x164e('0x36')]=_['keys'](db['MailSubstatus'][_0x164e('0x2f')]);_0x42c6c4[_0x164e('0x33')]=_['keys'](_0x33baaf['query']);_0x42c6c4[_0x164e('0x35')]=_[_0x164e('0x49')](_0x42c6c4['model'],_0x42c6c4['query']);_0x18bd24[_0x164e('0x37')]=_[_0x164e('0x49')](_0x42c6c4[_0x164e('0x36')],qs[_0x164e('0x38')](_0x33baaf[_0x164e('0x33')][_0x164e('0x38')]));_0x18bd24[_0x164e('0x37')]=_0x18bd24['attributes'][_0x164e('0x4a')]?_0x18bd24[_0x164e('0x37')]:_0x42c6c4['model'];if(_0x33baaf[_0x164e('0x33')]['includeAll']){_0x18bd24['include']=[{'all':!![]}];}_0x18bd24=_[_0x164e('0x3f')]({},_0x18bd24,_0x33baaf[_0x164e('0x42')]);return db[_0x164e('0x2e')][_0x164e('0x4b')](_0x18bd24)[_0x164e('0x47')](handleEntityNotFound(_0x26c630,null))['then'](respondWithResult(_0x26c630,null))[_0x164e('0x4c')](handleError(_0x26c630,null));};exports[_0x164e('0x4d')]=function(_0x5c878d,_0x13e1a5){return db[_0x164e('0x2e')][_0x164e('0x4d')](_0x5c878d[_0x164e('0x4e')],{})[_0x164e('0x47')](respondWithResult(_0x13e1a5,0xc9))[_0x164e('0x4c')](handleError(_0x13e1a5,null));};exports['update']=function(_0x4415ea,_0xf5994e){if(_0x4415ea['body']['id']){delete _0x4415ea[_0x164e('0x4e')]['id'];}return db[_0x164e('0x2e')]['find']({'where':{'id':_0x4415ea[_0x164e('0x48')]['id']}})[_0x164e('0x47')](handleEntityNotFound(_0xf5994e,null))['then'](saveUpdates(_0x4415ea['body'],null))[_0x164e('0x47')](respondWithResult(_0xf5994e,null))[_0x164e('0x4c')](handleError(_0xf5994e,null));};exports[_0x164e('0x4f')]=function(_0x44f849,_0x5e102c){return db[_0x164e('0x2e')][_0x164e('0x4b')]({'where':{'id':_0x44f849[_0x164e('0x48')]['id']}})[_0x164e('0x47')](handleEntityNotFound(_0x5e102c,null))['then'](removeEntity(_0x5e102c,null))[_0x164e('0x4c')](handleError(_0x5e102c,null));};exports[_0x164e('0x50')]=function(_0x792cf9,_0x45995d){return db[_0x164e('0x2e')][_0x164e('0x50')]()['then'](respondWithResult(_0x45995d,null))['catch'](handleError(_0x45995d,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 81455b6..6fa94ac 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 _0x14d2=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x239e89,_0x523aab){var _0x4b5cb7=function(_0x17af4a){while(--_0x17af4a){_0x239e89['push'](_0x239e89['shift']());}};_0x4b5cb7(++_0x523aab);}(_0x14d2,0xa2));var _0x214d=function(_0x3c82b3,_0x5ed781){_0x3c82b3=_0x3c82b3-0x0;var _0x2591bd=_0x14d2[_0x3c82b3];return _0x2591bd;};'use strict';var EventEmitter=require(_0x214d('0x0'));var MailSubstatus=require(_0x214d('0x1'))['db'][_0x214d('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x214d('0x3')](0x0);var events={'afterUpdate':_0x214d('0x4')};function emitEvent(_0x578595){return function(_0x3a4761,_0x5b95b1,_0x139596){MailSubstatusEvents['emit'](_0x578595+':'+_0x3a4761['id'],_0x3a4761);MailSubstatusEvents[_0x214d('0x5')](_0x578595,_0x3a4761);_0x139596(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x214d('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x52f4=['MailSubstatus','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x1cbad2,_0x13518b){var _0x4225bd=function(_0xb1e8d7){while(--_0xb1e8d7){_0x1cbad2['push'](_0x1cbad2['shift']());}};_0x4225bd(++_0x13518b);}(_0x52f4,0x19c));var _0x452f=function(_0x3f2f84,_0x1b0291){_0x3f2f84=_0x3f2f84-0x0;var _0x814c03=_0x52f4[_0x3f2f84];return _0x814c03;};'use strict';var EventEmitter=require(_0x452f('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x452f('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x452f('0x2')](0x0);var events={'afterUpdate':_0x452f('0x3')};function emitEvent(_0x3c7ce1){return function(_0x599029,_0x34ebc3,_0x15dfc8){MailSubstatusEvents[_0x452f('0x4')](_0x3c7ce1+':'+_0x599029['id'],_0x599029);MailSubstatusEvents[_0x452f('0x4')](_0x3c7ce1,_0x599029);_0x15dfc8(null);};}for(var e in events){if(events[_0x452f('0x5')](e)){var event=events[e];MailSubstatus[_0x452f('0x6')](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 7f6dfae..5d2e34b 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 _0x41f2=['mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','define','MailSubstatus','Condition','name'];(function(_0x47e8ba,_0x568e04){var _0x54763c=function(_0x178cb7){while(--_0x178cb7){_0x47e8ba['push'](_0x47e8ba['shift']());}};_0x54763c(++_0x568e04);}(_0x41f2,0x17b));var _0x241f=function(_0x362212,_0x392d3e){_0x362212=_0x362212-0x0;var _0x4a46e0=_0x41f2[_0x362212];return _0x4a46e0;};'use strict';var attributes=require(_0x241f('0x0'));module['exports']=function(_0x439ea1){var _0x476fd4=_0x439ea1['models'];return _0x439ea1[_0x241f('0x1')](_0x241f('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2526ba,_0x3b549e,_0x6fa8fb){return _0x476fd4[_0x241f('0x3')]['update']({'value':_0x2526ba[_0x241f('0x4')]},{'where':{'field':_0x241f('0x5'),'value':_0x2526ba[_0x241f('0x6')]['name']}})[_0x241f('0x7')](function(){_0x6fa8fb();})['catch'](function(_0x548b36){_0x6fa8fb(_0x548b36);});}}});}; \ No newline at end of file +var _0x6b55=['define','mail_substatuses','update','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports'];(function(_0x54f241,_0x2b8581){var _0x4ffe7d=function(_0x1d1222){while(--_0x1d1222){_0x54f241['push'](_0x54f241['shift']());}};_0x4ffe7d(++_0x2b8581);}(_0x6b55,0x1f2));var _0x56b5=function(_0x404401,_0x373e5b){_0x404401=_0x404401-0x0;var _0x34c2c9=_0x6b55[_0x404401];return _0x34c2c9;};'use strict';var attributes=require(_0x56b5('0x0'));module[_0x56b5('0x1')]=function(_0x575885){var _0x426f5a=_0x575885['models'];return _0x575885[_0x56b5('0x2')]('MailSubstatus',attributes,{'tableName':_0x56b5('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5f1eb1,_0x1ca8d7,_0xb3fff7){return _0x426f5a['Condition'][_0x56b5('0x4')]({'value':_0x5f1eb1['name']},{'where':{'field':_0x56b5('0x5'),'value':_0x5f1eb1[_0x56b5('0x6')][_0x56b5('0x7')]}})[_0x56b5('0x8')](function(){_0xb3fff7();})[_0x56b5('0x9')](function(_0x45b20a){_0xb3fff7(_0x45b20a);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 7e4ce0d..7a12620 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 _0x741c=['jayson/promise','client','http','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x337d94,_0x50b66f){var _0x4dbf4f=function(_0x42d79f){while(--_0x42d79f){_0x337d94['push'](_0x337d94['shift']());}};_0x4dbf4f(++_0x50b66f);}(_0x741c,0x98));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var moment=require(_0xc741('0x2'));var BPromise=require(_0xc741('0x3'));var rs=require(_0xc741('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc741('0x5'))['db'];var utils=require(_0xc741('0x6'));var logger=require(_0xc741('0x7'))(_0xc741('0x8'));var config=require('../../config/environment');var jayson=require(_0xc741('0x9'));var client=jayson[_0xc741('0xa')][_0xc741('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49e447,_0x5a69e2,_0x5cff27){return new BPromise(function(_0x4300ef,_0x30fba2){return client['request'](_0x49e447,_0x5cff27)['then'](function(_0x3a0b90){logger[_0xc741('0xc')](_0xc741('0xd'),_0x5a69e2,_0xc741('0xe'));logger[_0xc741('0xf')](_0xc741('0x10'),_0x5a69e2,'request\x20sent',JSON[_0xc741('0x11')](_0x3a0b90));if(_0x3a0b90[_0xc741('0x12')]){if(_0x3a0b90[_0xc741('0x12')][_0xc741('0x13')]===0x1f4){logger['error'](_0xc741('0xd'),_0x5a69e2,_0x3a0b90[_0xc741('0x12')][_0xc741('0x14')]);return _0x30fba2(_0x3a0b90[_0xc741('0x12')][_0xc741('0x14')]);}logger[_0xc741('0x12')](_0xc741('0xd'),_0x5a69e2,_0x3a0b90[_0xc741('0x12')][_0xc741('0x14')]);return _0x4300ef(_0x3a0b90[_0xc741('0x12')][_0xc741('0x14')]);}else{logger[_0xc741('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x5a69e2,_0xc741('0xe'));_0x4300ef(_0x3a0b90[_0xc741('0x15')][_0xc741('0x14')]);}})[_0xc741('0x16')](function(_0x374b90){logger[_0xc741('0x12')](_0xc741('0xd'),_0x5a69e2,_0x374b90);_0x30fba2(_0x374b90);});});} \ No newline at end of file +var _0x6b69=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','moment','bluebird','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b69,0x19e));var _0x96b6=function(_0x29aea6,_0x3fe3df){_0x29aea6=_0x29aea6-0x0;var _0x32da51=_0x6b69[_0x29aea6];return _0x32da51;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x96b6('0x0'));var BPromise=require(_0x96b6('0x1'));var rs=require(_0x96b6('0x2'));var fs=require('fs');var Redis=require(_0x96b6('0x3'));var db=require(_0x96b6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x96b6('0x5'))(_0x96b6('0x6'));var config=require(_0x96b6('0x7'));var jayson=require(_0x96b6('0x8'));var client=jayson[_0x96b6('0x9')][_0x96b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a57e6,_0x5585fb,_0x8fa59c){return new BPromise(function(_0x57e59c,_0x2fb074){return client['request'](_0x4a57e6,_0x8fa59c)[_0x96b6('0xb')](function(_0x1260c7){logger['info'](_0x96b6('0xc'),_0x5585fb,'request\x20sent');logger[_0x96b6('0xd')](_0x96b6('0xe'),_0x5585fb,_0x96b6('0xf'),JSON[_0x96b6('0x10')](_0x1260c7));if(_0x1260c7[_0x96b6('0x11')]){if(_0x1260c7[_0x96b6('0x11')][_0x96b6('0x12')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5585fb,_0x1260c7[_0x96b6('0x11')][_0x96b6('0x13')]);return _0x2fb074(_0x1260c7[_0x96b6('0x11')][_0x96b6('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x5585fb,_0x1260c7[_0x96b6('0x11')][_0x96b6('0x13')]);return _0x57e59c(_0x1260c7[_0x96b6('0x11')][_0x96b6('0x13')]);}else{logger[_0x96b6('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x5585fb,_0x96b6('0xf'));_0x57e59c(_0x1260c7['result'][_0x96b6('0x13')]);}})[_0x96b6('0x15')](function(_0x54fe78){logger['error'](_0x96b6('0xc'),_0x5585fb,_0x54fe78);_0x2fb074(_0x54fe78);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index aeb672d..7622fd5 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 _0x24b2=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x119e3f,_0x24e162){var _0x453d58=function(_0x34ffdb){while(--_0x34ffdb){_0x119e3f['push'](_0x119e3f['shift']());}};_0x453d58(++_0x24e162);}(_0x24b2,0x172));var _0x224b=function(_0x4c39f5,_0x109684){_0x4c39f5=_0x4c39f5-0x0;var _0x1db24f=_0x24b2[_0x4c39f5];return _0x1db24f;};'use strict';var multer=require(_0x224b('0x0'));var util=require(_0x224b('0x1'));var path=require(_0x224b('0x2'));var timeout=require(_0x224b('0x3'));var express=require(_0x224b('0x4'));var router=express['Router']();var fs_extra=require(_0x224b('0x5'));var auth=require(_0x224b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x224b('0x7'));var controller=require(_0x224b('0x8'));router[_0x224b('0x9')]('/',auth[_0x224b('0xa')](),controller[_0x224b('0xb')]);router[_0x224b('0x9')](_0x224b('0xc'),auth['isAuthenticated'](),controller[_0x224b('0xd')]);router['get'](_0x224b('0xe'),auth[_0x224b('0xa')](),controller[_0x224b('0xf')]);router[_0x224b('0x10')]('/',auth['isAuthenticated'](),controller[_0x224b('0x11')]);router[_0x224b('0x12')](_0x224b('0xe'),auth[_0x224b('0xa')](),controller[_0x224b('0x13')]);router[_0x224b('0x14')](_0x224b('0xe'),auth[_0x224b('0xa')](),controller[_0x224b('0x15')]);module[_0x224b('0x16')]=router; \ No newline at end of file +var _0xfc8e=['index','describe','show','post','create','put','/:id','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfc8e,0x14b));var _0xefc8=function(_0x19c953,_0x379fde){_0x19c953=_0x19c953-0x0;var _0x47a65d=_0xfc8e[_0x19c953];return _0x47a65d;};'use strict';var multer=require('multer');var util=require(_0xefc8('0x0'));var path=require(_0xefc8('0x1'));var timeout=require(_0xefc8('0x2'));var express=require(_0xefc8('0x3'));var router=express[_0xefc8('0x4')]();var fs_extra=require(_0xefc8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xefc8('0x6'));var config=require(_0xefc8('0x7'));var controller=require(_0xefc8('0x8'));router[_0xefc8('0x9')]('/',auth[_0xefc8('0xa')](),controller[_0xefc8('0xb')]);router['get']('/describe',auth[_0xefc8('0xa')](),controller[_0xefc8('0xc')]);router[_0xefc8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xefc8('0xd')]);router[_0xefc8('0xe')]('/',auth[_0xefc8('0xa')](),controller[_0xefc8('0xf')]);router[_0xefc8('0x10')](_0xefc8('0x11'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d0e5233..a235a5b 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xb43b,0x1b2));var _0xbb43=function(_0xa5b1ab,_0x6a691e){_0xa5b1ab=_0xa5b1ab-0x0;var _0x5a942b=_0xb43b[_0xa5b1ab];return _0x5a942b;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xb43b,0x1b2));var _0xbb43=function(_0x91c1,_0x5d4637){_0x91c1=_0x91c1-0x0;var _0x539cd9=_0xb43b[_0x91c1];return _0x539cd9;};'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/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index ed49940..bf54813 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 _0xe54c=['query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','MailTransferReport','rawAttributes','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','apply','save','update','destroy','then','end','error','stack','name','send','index','map','fieldName','type','model','keys','filters'];(function(_0x15f8ad,_0x5275c3){var _0xc0238a=function(_0x5550c8){while(--_0x5550c8){_0x15f8ad['push'](_0x15f8ad['shift']());}};_0xc0238a(++_0x5275c3);}(_0xe54c,0x1cf));var _0xce54=function(_0x3376bd,_0x4fdb2a){_0x3376bd=_0x3376bd-0x0;var _0x587b0b=_0xe54c[_0x3376bd];return _0x587b0b;};'use strict';var emlformat=require(_0xce54('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce54('0x1'));var jsonpatch=require(_0xce54('0x2'));var rp=require(_0xce54('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xce54('0x4'));var util=require(_0xce54('0x5'));var path=require(_0xce54('0x6'));var sox=require('sox');var csv=require(_0xce54('0x7'));var ejs=require(_0xce54('0x8'));var fs=require('fs');var fs_extra=require(_0xce54('0x9'));var _=require(_0xce54('0xa'));var squel=require(_0xce54('0xb'));var crypto=require('crypto');var jsforce=require(_0xce54('0xc'));var deskjs=require(_0xce54('0xd'));var toCsv=require(_0xce54('0x7'));var querystring=require(_0xce54('0xe'));var Papa=require('papaparse');var Redis=require(_0xce54('0xf'));var authService=require(_0xce54('0x10'));var qs=require(_0xce54('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce54('0x12'));var logger=require(_0xce54('0x13'))(_0xce54('0x14'));var utils=require(_0xce54('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xce54('0x16'));var db=require(_0xce54('0x17'))['db'];function respondWithStatusCode(_0x3535ef,_0x47041e){_0x47041e=_0x47041e||0xcc;return function(_0x22bf58){if(_0x22bf58){return _0x3535ef[_0xce54('0x18')](_0x47041e);}return _0x3535ef[_0xce54('0x19')](_0x47041e)['end']();};}function respondWithResult(_0x4a61f4,_0x1b935d){_0x1b935d=_0x1b935d||0xc8;return function(_0x2577a0){if(_0x2577a0){return _0x4a61f4[_0xce54('0x19')](_0x1b935d)[_0xce54('0x1a')](_0x2577a0);}};}function respondWithFilteredResult(_0x463313,_0x3a6e6c){return function(_0x50962b){if(_0x50962b){var _0x390b69=typeof _0x3a6e6c['offset']===_0xce54('0x1b')&&typeof _0x3a6e6c[_0xce54('0x1c')]===_0xce54('0x1b');var _0x5a2888=_0x50962b['count'];var _0x11f3dc=_0x390b69?0x0:_0x3a6e6c['offset'];var _0x1092a3=_0x390b69?_0x50962b[_0xce54('0x1d')]:_0x3a6e6c[_0xce54('0x1e')]+_0x3a6e6c[_0xce54('0x1c')];var _0x23e00e;if(_0x1092a3>=_0x5a2888){_0x1092a3=_0x5a2888;_0x23e00e=0xc8;}else{_0x23e00e=0xce;}_0x463313[_0xce54('0x19')](_0x23e00e);return _0x463313['set']('Content-Range',_0x11f3dc+'-'+_0x1092a3+'/'+_0x5a2888)[_0xce54('0x1a')](_0x50962b);}return null;};}function patchUpdates(_0x51e9f3){return function(_0x759a71){try{jsonpatch[_0xce54('0x1f')](_0x759a71,_0x51e9f3,!![]);}catch(_0x937fbe){return BPromise['reject'](_0x937fbe);}return _0x759a71[_0xce54('0x20')]();};}function saveUpdates(_0x3b53a0,_0x95e745){return function(_0xdca7dc){if(_0xdca7dc){return _0xdca7dc[_0xce54('0x21')](_0x3b53a0)['then'](function(_0x81fdc){return _0x81fdc;});}return null;};}function removeEntity(_0x154670,_0x53edd3){return function(_0x2c3e96){if(_0x2c3e96){return _0x2c3e96[_0xce54('0x22')]()[_0xce54('0x23')](function(){_0x154670[_0xce54('0x19')](0xcc)[_0xce54('0x24')]();});}};}function handleEntityNotFound(_0x27c354,_0x19c35b){return function(_0x1a642e){if(!_0x1a642e){_0x27c354[_0xce54('0x18')](0x194);}return _0x1a642e;};}function handleError(_0x47e376,_0x4e909b){_0x4e909b=_0x4e909b||0x1f4;return function(_0xe49e09){logger[_0xce54('0x25')](_0xe49e09[_0xce54('0x26')]);if(_0xe49e09['name']){delete _0xe49e09[_0xce54('0x27')];}_0x47e376[_0xce54('0x19')](_0x4e909b)[_0xce54('0x28')](_0xe49e09);};}exports[_0xce54('0x29')]=function(_0xcb6b7d,_0x3e7cff){var _0x1adbc6={},_0x5c49bb={},_0x26eeff={'count':0x0,'rows':[]};var _0x5b9644=_[_0xce54('0x2a')](db['MailTransferReport']['rawAttributes'],function(_0x52785b){return{'name':_0x52785b[_0xce54('0x2b')],'type':_0x52785b[_0xce54('0x2c')]['key']};});_0x5c49bb[_0xce54('0x2d')]=_[_0xce54('0x2a')](_0x5b9644,_0xce54('0x27'));_0x5c49bb['query']=_[_0xce54('0x2e')](_0xcb6b7d['query']);_0x5c49bb[_0xce54('0x2f')]=_['intersection'](_0x5c49bb['model'],_0x5c49bb[_0xce54('0x30')]);_0x1adbc6[_0xce54('0x31')]=_[_0xce54('0x32')](_0x5c49bb[_0xce54('0x2d')],qs[_0xce54('0x33')](_0xcb6b7d[_0xce54('0x30')][_0xce54('0x33')]));_0x1adbc6['attributes']=_0x1adbc6['attributes'][_0xce54('0x34')]?_0x1adbc6[_0xce54('0x31')]:_0x5c49bb[_0xce54('0x2d')];if(!_0xcb6b7d[_0xce54('0x30')][_0xce54('0x35')](_0xce54('0x36'))){_0x1adbc6[_0xce54('0x1c')]=qs[_0xce54('0x1c')](_0xcb6b7d[_0xce54('0x30')][_0xce54('0x1c')]);_0x1adbc6[_0xce54('0x1e')]=qs['offset'](_0xcb6b7d[_0xce54('0x30')]['offset']);}_0x1adbc6[_0xce54('0x37')]=qs[_0xce54('0x38')](_0xcb6b7d[_0xce54('0x30')][_0xce54('0x38')]);_0x1adbc6[_0xce54('0x39')]=qs[_0xce54('0x2f')](_['pick'](_0xcb6b7d['query'],_0x5c49bb['filters']),_0x5b9644);if(_0xcb6b7d['query'][_0xce54('0x3a')]){_0x1adbc6[_0xce54('0x39')]=_[_0xce54('0x3b')](_0x1adbc6[_0xce54('0x39')],{'$or':_[_0xce54('0x2a')](_0x5b9644,function(_0x3d42f4){if(_0x3d42f4[_0xce54('0x2c')]!=='VIRTUAL'){var _0x499453={};_0x499453[_0x3d42f4[_0xce54('0x27')]]={'$like':'%'+_0xcb6b7d[_0xce54('0x30')][_0xce54('0x3a')]+'%'};return _0x499453;}})});}_0x1adbc6=_['merge']({},_0x1adbc6,_0xcb6b7d[_0xce54('0x3c')]);var _0x3c23cb={'where':_0x1adbc6[_0xce54('0x39')]};return db['MailTransferReport'][_0xce54('0x1d')](_0x3c23cb)[_0xce54('0x23')](function(_0x3c2cdb){_0x26eeff[_0xce54('0x1d')]=_0x3c2cdb;if(_0xcb6b7d[_0xce54('0x30')][_0xce54('0x3d')]){_0x1adbc6[_0xce54('0x3e')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x1adbc6);})['then'](function(_0x443da7){_0x26eeff[_0xce54('0x3f')]=_0x443da7;return _0x26eeff;})['then'](respondWithFilteredResult(_0x3e7cff,_0x1adbc6))[_0xce54('0x40')](handleError(_0x3e7cff,null));};exports[_0xce54('0x41')]=function(_0x563026,_0x2528ca){var _0x13358b={'raw':!![],'where':{'id':_0x563026[_0xce54('0x42')]['id']}},_0x508f53={};_0x508f53[_0xce54('0x2d')]=_['keys'](db[_0xce54('0x43')][_0xce54('0x44')]);_0x508f53['query']=_[_0xce54('0x2e')](_0x563026[_0xce54('0x30')]);_0x508f53['filters']=_['intersection'](_0x508f53['model'],_0x508f53['query']);_0x13358b[_0xce54('0x31')]=_[_0xce54('0x32')](_0x508f53['model'],qs[_0xce54('0x33')](_0x563026[_0xce54('0x30')][_0xce54('0x33')]));_0x13358b[_0xce54('0x31')]=_0x13358b[_0xce54('0x31')][_0xce54('0x34')]?_0x13358b[_0xce54('0x31')]:_0x508f53['model'];if(_0x563026['query']['includeAll']){_0x13358b[_0xce54('0x3e')]=[{'all':!![]}];}_0x13358b=_[_0xce54('0x3b')]({},_0x13358b,_0x563026[_0xce54('0x3c')]);return db[_0xce54('0x43')][_0xce54('0x45')](_0x13358b)[_0xce54('0x23')](handleEntityNotFound(_0x2528ca,null))[_0xce54('0x23')](respondWithResult(_0x2528ca,null))['catch'](handleError(_0x2528ca,null));};exports[_0xce54('0x46')]=function(_0x18c362,_0x2871e1){return db[_0xce54('0x43')][_0xce54('0x46')](_0x18c362[_0xce54('0x47')],{})[_0xce54('0x23')](respondWithResult(_0x2871e1,0xc9))[_0xce54('0x40')](handleError(_0x2871e1,null));};exports[_0xce54('0x21')]=function(_0x4f9052,_0x10e02f){if(_0x4f9052[_0xce54('0x47')]['id']){delete _0x4f9052[_0xce54('0x47')]['id'];}return db[_0xce54('0x43')][_0xce54('0x45')]({'where':{'id':_0x4f9052[_0xce54('0x42')]['id']}})[_0xce54('0x23')](handleEntityNotFound(_0x10e02f,null))[_0xce54('0x23')](saveUpdates(_0x4f9052['body'],null))['then'](respondWithResult(_0x10e02f,null))[_0xce54('0x40')](handleError(_0x10e02f,null));};exports[_0xce54('0x22')]=function(_0xd8589a,_0xf4f6d3){return db['MailTransferReport'][_0xce54('0x45')]({'where':{'id':_0xd8589a[_0xce54('0x42')]['id']}})[_0xce54('0x23')](handleEntityNotFound(_0xf4f6d3,null))['then'](removeEntity(_0xf4f6d3,null))[_0xce54('0x40')](handleError(_0xf4f6d3,null));};exports[_0xce54('0x48')]=function(_0x3d48f3,_0x35dc65){return db[_0xce54('0x43')][_0xce54('0x48')]()[_0xce54('0x23')](respondWithResult(_0x35dc65,null))[_0xce54('0x40')](handleError(_0x35dc65,null));}; \ No newline at end of file +var _0x277e=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','MailTransferReport','include','findAll','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x44700b,_0x1cef26){var _0x4af965=function(_0x5dc4fd){while(--_0x5dc4fd){_0x44700b['push'](_0x44700b['shift']());}};_0x4af965(++_0x1cef26);}(_0x277e,0x1a4));var _0xe277=function(_0x2b53bc,_0x4106ef){_0x2b53bc=_0x2b53bc-0x0;var _0x7641af=_0x277e[_0x2b53bc];return _0x7641af;};'use strict';var emlformat=require(_0xe277('0x0'));var rimraf=require(_0xe277('0x1'));var zipdir=require(_0xe277('0x2'));var jsonpatch=require(_0xe277('0x3'));var rp=require(_0xe277('0x4'));var moment=require(_0xe277('0x5'));var BPromise=require(_0xe277('0x6'));var Mustache=require('mustache');var util=require(_0xe277('0x7'));var path=require(_0xe277('0x8'));var sox=require(_0xe277('0x9'));var csv=require(_0xe277('0xa'));var ejs=require(_0xe277('0xb'));var fs=require('fs');var fs_extra=require(_0xe277('0xc'));var _=require(_0xe277('0xd'));var squel=require('squel');var crypto=require(_0xe277('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe277('0xf'));var toCsv=require(_0xe277('0xa'));var querystring=require(_0xe277('0x10'));var Papa=require(_0xe277('0x11'));var Redis=require(_0xe277('0x12'));var authService=require(_0xe277('0x13'));var qs=require(_0xe277('0x14'));var as=require(_0xe277('0x15'));var hardwareService=require(_0xe277('0x16'));var logger=require(_0xe277('0x17'))(_0xe277('0x18'));var utils=require(_0xe277('0x19'));var config=require(_0xe277('0x1a'));var licenseUtil=require(_0xe277('0x1b'));var db=require(_0xe277('0x1c'))['db'];function respondWithStatusCode(_0x20661c,_0x2aa000){_0x2aa000=_0x2aa000||0xcc;return function(_0x344985){if(_0x344985){return _0x20661c[_0xe277('0x1d')](_0x2aa000);}return _0x20661c[_0xe277('0x1e')](_0x2aa000)[_0xe277('0x1f')]();};}function respondWithResult(_0x46e671,_0x39a508){_0x39a508=_0x39a508||0xc8;return function(_0x18cd86){if(_0x18cd86){return _0x46e671[_0xe277('0x1e')](_0x39a508)[_0xe277('0x20')](_0x18cd86);}};}function respondWithFilteredResult(_0xa78a84,_0x309ed7){return function(_0x448eca){if(_0x448eca){var _0x20bcf0=typeof _0x309ed7[_0xe277('0x21')]===_0xe277('0x22')&&typeof _0x309ed7[_0xe277('0x23')]===_0xe277('0x22');var _0x56cfa7=_0x448eca[_0xe277('0x24')];var _0x365094=_0x20bcf0?0x0:_0x309ed7[_0xe277('0x21')];var _0x26fb82=_0x20bcf0?_0x448eca[_0xe277('0x24')]:_0x309ed7[_0xe277('0x21')]+_0x309ed7[_0xe277('0x23')];var _0xfcd4bf;if(_0x26fb82>=_0x56cfa7){_0x26fb82=_0x56cfa7;_0xfcd4bf=0xc8;}else{_0xfcd4bf=0xce;}_0xa78a84[_0xe277('0x1e')](_0xfcd4bf);return _0xa78a84['set'](_0xe277('0x25'),_0x365094+'-'+_0x26fb82+'/'+_0x56cfa7)[_0xe277('0x20')](_0x448eca);}return null;};}function patchUpdates(_0x1224bd){return function(_0x485222){try{jsonpatch[_0xe277('0x26')](_0x485222,_0x1224bd,!![]);}catch(_0x6027c){return BPromise['reject'](_0x6027c);}return _0x485222['save']();};}function saveUpdates(_0x31815e,_0x519c18){return function(_0x236d05){if(_0x236d05){return _0x236d05[_0xe277('0x27')](_0x31815e)[_0xe277('0x28')](function(_0x4c3e16){return _0x4c3e16;});}return null;};}function removeEntity(_0x1532f9,_0x4e215a){return function(_0xaab000){if(_0xaab000){return _0xaab000[_0xe277('0x29')]()['then'](function(){_0x1532f9['status'](0xcc)[_0xe277('0x1f')]();});}};}function handleEntityNotFound(_0x386d5d,_0x2e8285){return function(_0x4d2dc6){if(!_0x4d2dc6){_0x386d5d['sendStatus'](0x194);}return _0x4d2dc6;};}function handleError(_0x12ef3d,_0x3f3d78){_0x3f3d78=_0x3f3d78||0x1f4;return function(_0x437a87){logger[_0xe277('0x2a')](_0x437a87[_0xe277('0x2b')]);if(_0x437a87[_0xe277('0x2c')]){delete _0x437a87['name'];}_0x12ef3d['status'](_0x3f3d78)[_0xe277('0x2d')](_0x437a87);};}exports['index']=function(_0x4eb129,_0x47eaaf){var _0x11c613={},_0x236d59={},_0x5afd6d={'count':0x0,'rows':[]};var _0x4207c2=_[_0xe277('0x2e')](db['MailTransferReport'][_0xe277('0x2f')],function(_0x488ea4){return{'name':_0x488ea4[_0xe277('0x30')],'type':_0x488ea4[_0xe277('0x31')][_0xe277('0x32')]};});_0x236d59['model']=_[_0xe277('0x2e')](_0x4207c2,_0xe277('0x2c'));_0x236d59[_0xe277('0x33')]=_[_0xe277('0x34')](_0x4eb129['query']);_0x236d59[_0xe277('0x35')]=_[_0xe277('0x36')](_0x236d59[_0xe277('0x37')],_0x236d59['query']);_0x11c613[_0xe277('0x38')]=_[_0xe277('0x36')](_0x236d59[_0xe277('0x37')],qs[_0xe277('0x39')](_0x4eb129[_0xe277('0x33')]['fields']));_0x11c613[_0xe277('0x38')]=_0x11c613[_0xe277('0x38')][_0xe277('0x3a')]?_0x11c613[_0xe277('0x38')]:_0x236d59[_0xe277('0x37')];if(!_0x4eb129[_0xe277('0x33')][_0xe277('0x3b')](_0xe277('0x3c'))){_0x11c613[_0xe277('0x23')]=qs['limit'](_0x4eb129[_0xe277('0x33')][_0xe277('0x23')]);_0x11c613['offset']=qs[_0xe277('0x21')](_0x4eb129[_0xe277('0x33')][_0xe277('0x21')]);}_0x11c613[_0xe277('0x3d')]=qs[_0xe277('0x3e')](_0x4eb129['query'][_0xe277('0x3e')]);_0x11c613[_0xe277('0x3f')]=qs[_0xe277('0x35')](_[_0xe277('0x40')](_0x4eb129[_0xe277('0x33')],_0x236d59[_0xe277('0x35')]),_0x4207c2);if(_0x4eb129[_0xe277('0x33')]['filter']){_0x11c613['where']=_['merge'](_0x11c613['where'],{'$or':_[_0xe277('0x2e')](_0x4207c2,function(_0x2c8350){if(_0x2c8350[_0xe277('0x31')]!=='VIRTUAL'){var _0x5b0203={};_0x5b0203[_0x2c8350[_0xe277('0x2c')]]={'$like':'%'+_0x4eb129['query'][_0xe277('0x41')]+'%'};return _0x5b0203;}})});}_0x11c613=_[_0xe277('0x42')]({},_0x11c613,_0x4eb129[_0xe277('0x43')]);var _0x18cc7a={'where':_0x11c613['where']};return db[_0xe277('0x44')][_0xe277('0x24')](_0x18cc7a)['then'](function(_0x3f4437){_0x5afd6d[_0xe277('0x24')]=_0x3f4437;if(_0x4eb129['query']['includeAll']){_0x11c613[_0xe277('0x45')]=[{'all':!![]}];}return db[_0xe277('0x44')][_0xe277('0x46')](_0x11c613);})['then'](function(_0x123704){_0x5afd6d['rows']=_0x123704;return _0x5afd6d;})[_0xe277('0x28')](respondWithFilteredResult(_0x47eaaf,_0x11c613))[_0xe277('0x47')](handleError(_0x47eaaf,null));};exports[_0xe277('0x48')]=function(_0x43c3dc,_0x15c222){var _0x521bb4={'raw':!![],'where':{'id':_0x43c3dc[_0xe277('0x49')]['id']}},_0x85c1f6={};_0x85c1f6['model']=_[_0xe277('0x34')](db[_0xe277('0x44')]['rawAttributes']);_0x85c1f6[_0xe277('0x33')]=_['keys'](_0x43c3dc[_0xe277('0x33')]);_0x85c1f6[_0xe277('0x35')]=_[_0xe277('0x36')](_0x85c1f6['model'],_0x85c1f6[_0xe277('0x33')]);_0x521bb4[_0xe277('0x38')]=_['intersection'](_0x85c1f6[_0xe277('0x37')],qs[_0xe277('0x39')](_0x43c3dc['query'][_0xe277('0x39')]));_0x521bb4['attributes']=_0x521bb4[_0xe277('0x38')][_0xe277('0x3a')]?_0x521bb4[_0xe277('0x38')]:_0x85c1f6[_0xe277('0x37')];if(_0x43c3dc[_0xe277('0x33')][_0xe277('0x4a')]){_0x521bb4[_0xe277('0x45')]=[{'all':!![]}];}_0x521bb4=_[_0xe277('0x42')]({},_0x521bb4,_0x43c3dc['options']);return db['MailTransferReport'][_0xe277('0x4b')](_0x521bb4)[_0xe277('0x28')](handleEntityNotFound(_0x15c222,null))[_0xe277('0x28')](respondWithResult(_0x15c222,null))[_0xe277('0x47')](handleError(_0x15c222,null));};exports['create']=function(_0x33111b,_0x3892f1){return db[_0xe277('0x44')][_0xe277('0x4c')](_0x33111b[_0xe277('0x4d')],{})[_0xe277('0x28')](respondWithResult(_0x3892f1,0xc9))[_0xe277('0x47')](handleError(_0x3892f1,null));};exports[_0xe277('0x27')]=function(_0x39e4d7,_0x296562){if(_0x39e4d7[_0xe277('0x4d')]['id']){delete _0x39e4d7[_0xe277('0x4d')]['id'];}return db[_0xe277('0x44')]['find']({'where':{'id':_0x39e4d7[_0xe277('0x49')]['id']}})['then'](handleEntityNotFound(_0x296562,null))[_0xe277('0x28')](saveUpdates(_0x39e4d7[_0xe277('0x4d')],null))[_0xe277('0x28')](respondWithResult(_0x296562,null))['catch'](handleError(_0x296562,null));};exports[_0xe277('0x29')]=function(_0xe3b5c4,_0x24e2cd){return db[_0xe277('0x44')][_0xe277('0x4b')]({'where':{'id':_0xe3b5c4[_0xe277('0x49')]['id']}})['then'](handleEntityNotFound(_0x24e2cd,null))[_0xe277('0x28')](removeEntity(_0x24e2cd,null))[_0xe277('0x47')](handleError(_0x24e2cd,null));};exports[_0xe277('0x4e')]=function(_0x1691d1,_0x18ad73){return db['MailTransferReport'][_0xe277('0x4e')]()[_0xe277('0x28')](respondWithResult(_0x18ad73,null))['catch'](handleError(_0x18ad73,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 4116443..1804c8f 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 _0x2056=['MailTransferReport','report_mail_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','define'];(function(_0x311cfe,_0x42e904){var _0x40ce33=function(_0x29b0f4){while(--_0x29b0f4){_0x311cfe['push'](_0x311cfe['shift']());}};_0x40ce33(++_0x42e904);}(_0x2056,0x107));var _0x6205=function(_0xeb6b36,_0x159863){_0xeb6b36=_0xeb6b36-0x0;var _0xbac1b2=_0x2056[_0xeb6b36];return _0xbac1b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6205('0x0'))(_0x6205('0x1'));var moment=require(_0x6205('0x2'));var BPromise=require(_0x6205('0x3'));var rp=require(_0x6205('0x4'));var fs=require('fs');var path=require(_0x6205('0x5'));var rimraf=require(_0x6205('0x6'));var config=require(_0x6205('0x7'));var attributes=require(_0x6205('0x8'));module['exports']=function(_0x45afa8,_0x2c555d){return _0x45afa8[_0x6205('0x9')](_0x6205('0xa'),attributes,{'tableName':_0x6205('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6205('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb6a6=['uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','MailTransferReport','report_mail_transfer'];(function(_0x5af1ce,_0x318f6e){var _0x4e7f4f=function(_0x4c4c90){while(--_0x4c4c90){_0x5af1ce['push'](_0x5af1ce['shift']());}};_0x4e7f4f(++_0x318f6e);}(_0xb6a6,0x1ed));var _0x6b6a=function(_0x45ed09,_0x4deb08){_0x45ed09=_0x45ed09-0x0;var _0x1938a5=_0xb6a6[_0x45ed09];return _0x1938a5;};'use strict';var _=require('lodash');var util=require(_0x6b6a('0x0'));var logger=require(_0x6b6a('0x1'))(_0x6b6a('0x2'));var moment=require(_0x6b6a('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b6a('0x4'));var fs=require('fs');var path=require(_0x6b6a('0x5'));var rimraf=require(_0x6b6a('0x6'));var config=require(_0x6b6a('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0xb5bba7,_0x46fc69){return _0xb5bba7[_0x6b6a('0x8')](_0x6b6a('0x9'),attributes,{'tableName':_0x6b6a('0xa'),'paranoid':![],'indexes':[{'name':_0x6b6a('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 4ae3f90..d275b7d 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 _0xa2d2=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2d2,0x16e));var _0x2a2d=function(_0x36427f,_0xe96ae7){_0x36427f=_0x36427f-0x0;var _0x63526e=_0xa2d2[_0x36427f];return _0x63526e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2a2d('0x0'));var BPromise=require(_0x2a2d('0x1'));var rs=require(_0x2a2d('0x2'));var fs=require('fs');var Redis=require(_0x2a2d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2a2d('0x4'));var logger=require(_0x2a2d('0x5'))(_0x2a2d('0x6'));var config=require(_0x2a2d('0x7'));var jayson=require(_0x2a2d('0x8'));var client=jayson[_0x2a2d('0x9')][_0x2a2d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dd538,_0x3143c6,_0x5e2c0c){return new BPromise(function(_0x14832e,_0x17a318){return client[_0x2a2d('0xb')](_0x1dd538,_0x5e2c0c)[_0x2a2d('0xc')](function(_0x4b1a1b){logger[_0x2a2d('0xd')](_0x2a2d('0xe'),_0x3143c6,_0x2a2d('0xf'));logger[_0x2a2d('0x10')](_0x2a2d('0x11'),_0x3143c6,'request\x20sent',JSON[_0x2a2d('0x12')](_0x4b1a1b));if(_0x4b1a1b['error']){if(_0x4b1a1b[_0x2a2d('0x13')][_0x2a2d('0x14')]===0x1f4){logger['error'](_0x2a2d('0xe'),_0x3143c6,_0x4b1a1b[_0x2a2d('0x13')]['message']);return _0x17a318(_0x4b1a1b[_0x2a2d('0x13')][_0x2a2d('0x15')]);}logger[_0x2a2d('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x3143c6,_0x4b1a1b['error'][_0x2a2d('0x15')]);return _0x14832e(_0x4b1a1b['error'][_0x2a2d('0x15')]);}else{logger[_0x2a2d('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x3143c6,'request\x20sent');_0x14832e(_0x4b1a1b['result'][_0x2a2d('0x15')]);}})[_0x2a2d('0x16')](function(_0x5de925){logger[_0x2a2d('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x3143c6,_0x5de925);_0x17a318(_0x5de925);});});} \ No newline at end of file +var _0x1df9=['error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x434752,_0x2985b5){var _0x28b498=function(_0x210cfe){while(--_0x210cfe){_0x434752['push'](_0x434752['shift']());}};_0x28b498(++_0x2985b5);}(_0x1df9,0x9e));var _0x91df=function(_0x5a0769,_0x367f43){_0x5a0769=_0x5a0769-0x0;var _0x131698=_0x1df9[_0x5a0769];return _0x131698;};'use strict';var _=require('lodash');var util=require(_0x91df('0x0'));var moment=require(_0x91df('0x1'));var BPromise=require(_0x91df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91df('0x3'))['db'];var utils=require(_0x91df('0x4'));var logger=require(_0x91df('0x5'))(_0x91df('0x6'));var config=require(_0x91df('0x7'));var jayson=require(_0x91df('0x8'));var client=jayson[_0x91df('0x9')][_0x91df('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f43b5,_0x3516e4,_0x2beae0){return new BPromise(function(_0x5d0e7c,_0x21d15a){return client['request'](_0x2f43b5,_0x2beae0)[_0x91df('0xb')](function(_0x54a6df){logger[_0x91df('0xc')](_0x91df('0xd'),_0x3516e4,_0x91df('0xe'));logger[_0x91df('0xf')](_0x91df('0x10'),_0x3516e4,_0x91df('0xe'),JSON[_0x91df('0x11')](_0x54a6df));if(_0x54a6df[_0x91df('0x12')]){if(_0x54a6df[_0x91df('0x12')][_0x91df('0x13')]===0x1f4){logger[_0x91df('0x12')](_0x91df('0xd'),_0x3516e4,_0x54a6df[_0x91df('0x12')][_0x91df('0x14')]);return _0x21d15a(_0x54a6df[_0x91df('0x12')]['message']);}logger[_0x91df('0x12')](_0x91df('0xd'),_0x3516e4,_0x54a6df['error'][_0x91df('0x14')]);return _0x5d0e7c(_0x54a6df[_0x91df('0x12')][_0x91df('0x14')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x3516e4,_0x91df('0xe'));_0x5d0e7c(_0x54a6df['result'][_0x91df('0x14')]);}})[_0x91df('0x15')](function(_0x3f16a3){logger[_0x91df('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x3516e4,_0x3f16a3);_0x21d15a(_0x3f16a3);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 97bbf8a..2490b5d 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 _0x5656=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','/:id','show','post','create','put','delete','exports','multer'];(function(_0x37c1fe,_0x2c8f88){var _0x11a353=function(_0x18f3e1){while(--_0x18f3e1){_0x37c1fe['push'](_0x37c1fe['shift']());}};_0x11a353(++_0x2c8f88);}(_0x5656,0x76));var _0x6565=function(_0x117d15,_0x4d4ef6){_0x117d15=_0x117d15-0x0;var _0x43459d=_0x5656[_0x117d15];return _0x43459d;};'use strict';var multer=require(_0x6565('0x0'));var util=require(_0x6565('0x1'));var path=require('path');var timeout=require(_0x6565('0x2'));var express=require('express');var router=express[_0x6565('0x3')]();var fs_extra=require(_0x6565('0x4'));var auth=require(_0x6565('0x5'));var interaction=require(_0x6565('0x6'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x6565('0x7')]('/',auth['isAuthenticated'](),controller[_0x6565('0x8')]);router[_0x6565('0x7')]('/describe',auth[_0x6565('0x9')](),controller['describe']);router['get'](_0x6565('0xa'),auth[_0x6565('0x9')](),controller[_0x6565('0xb')]);router[_0x6565('0xc')]('/',auth[_0x6565('0x9')](),controller[_0x6565('0xd')]);router[_0x6565('0xe')](_0x6565('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6565('0xf')](_0x6565('0xa'),auth[_0x6565('0x9')](),controller['destroy']);module[_0x6565('0x10')]=router; \ No newline at end of file +var _0x9508=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index','get','describe','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','path','connect-timeout'];(function(_0x5b0f89,_0x303a8b){var _0x21ae25=function(_0x1726af){while(--_0x1726af){_0x5b0f89['push'](_0x5b0f89['shift']());}};_0x21ae25(++_0x303a8b);}(_0x9508,0xd9));var _0x8950=function(_0xba472,_0x4ffe8e){_0xba472=_0xba472-0x0;var _0x177f2f=_0x9508[_0xba472];return _0x177f2f;};'use strict';var multer=require(_0x8950('0x0'));var util=require('util');var path=require(_0x8950('0x1'));var timeout=require(_0x8950('0x2'));var express=require(_0x8950('0x3'));var router=express[_0x8950('0x4')]();var fs_extra=require(_0x8950('0x5'));var auth=require(_0x8950('0x6'));var interaction=require(_0x8950('0x7'));var config=require(_0x8950('0x8'));var controller=require(_0x8950('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8950('0xa')]);router[_0x8950('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x8950('0xc')]);router['get'](_0x8950('0xd'),auth['isAuthenticated'](),controller[_0x8950('0xe')]);router[_0x8950('0xf')]('/',auth[_0x8950('0x10')](),controller[_0x8950('0x11')]);router[_0x8950('0x12')](_0x8950('0xd'),auth[_0x8950('0x10')](),controller[_0x8950('0x13')]);router[_0x8950('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8950('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 04ed0fc..fab24e6 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 _0xe37c=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration'];(function(_0x65981a,_0x39c0b5){var _0x46f8e5=function(_0x369239){while(--_0x369239){_0x65981a['push'](_0x65981a['shift']());}};_0x46f8e5(++_0x39c0b5);}(_0xe37c,0x164));var _0xce37=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xe37c[_0x5eb22e];return _0x27fed5;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xce37('0x0')]={'channel':{'type':Sequelize[_0xce37('0x1')]},'membername':{'type':Sequelize[_0xce37('0x1')]},'interface':{'type':Sequelize[_0xce37('0x1')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xce37('0x2'),'comment':_0xce37('0x3')},'duration':{'type':Sequelize[_0xce37('0x4')]},'enterAt':{'type':Sequelize[_0xce37('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x1f84ad){var _0x149e23=moment(_0x1f84ad);var _0x5f58ba=moment(this[_0xce37('0x6')](_0xce37('0x7')));var _0x48a8e2=_0x149e23['diff'](_0x5f58ba,_0xce37('0x8'));this[_0xce37('0x9')](_0xce37('0xa'),_0x1f84ad);this[_0xce37('0x9')](_0xce37('0xb'),_0x48a8e2>=0x0?_0x48a8e2:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xce37('0xc')},'data2':{'type':Sequelize[_0xce37('0x1')],'comment':_0xce37('0xd')},'data3':{'type':Sequelize[_0xce37('0x1')],'comment':_0xce37('0xe')},'data4':{'type':Sequelize[_0xce37('0x1')],'comment':_0xce37('0xf')},'data5':{'type':Sequelize[_0xce37('0x1')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xce37('0x1')]},'internal':{'type':Sequelize[_0xce37('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x215e=['enterAt','diff','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue'];(function(_0x42a759,_0x1a42b6){var _0x49a799=function(_0x19be92){while(--_0x19be92){_0x42a759['push'](_0x42a759['shift']());}};_0x49a799(++_0x1a42b6);}(_0x215e,0x6f));var _0xe215=function(_0x5699ed,_0x228b81){_0x5699ed=_0x5699ed-0x0;var _0x164ab5=_0x215e[_0x5699ed];return _0x164ab5;};'use strict';var Sequelize=require(_0xe215('0x0'));var moment=require(_0xe215('0x1'));module[_0xe215('0x2')]={'channel':{'type':Sequelize[_0xe215('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xe215('0x3')]},'type':{'type':Sequelize[_0xe215('0x3')],'defaultValue':_0xe215('0x4'),'comment':_0xe215('0x5')},'duration':{'type':Sequelize[_0xe215('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe215('0x7')],'set':function(_0x213653){var _0xc149b1=moment(_0x213653);var _0x1bfa28=moment(this[_0xe215('0x8')](_0xe215('0x9')));var _0x555a53=_0xc149b1[_0xe215('0xa')](_0x1bfa28,'seconds');this[_0xe215('0xb')](_0xe215('0xc'),_0x213653);this[_0xe215('0xb')]('duration',_0x555a53>=0x0?_0x555a53:null);}},'data1':{'type':Sequelize[_0xe215('0x3')],'comment':_0xe215('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0xe215('0xe')},'data3':{'type':Sequelize[_0xe215('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xe215('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xe215('0x3')]},'internal':{'type':Sequelize[_0xe215('0x6')]},'uniqueid':{'type':Sequelize[_0xe215('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index f5fff03..25eaa59 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x55ca,0x126));var _0xa55c=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x55ca[_0x1d1963];return _0x3f58bb;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x55ca,0x126));var _0xa55c=function(_0xe3f360,_0x203484){_0xe3f360=_0xe3f360-0x0;var _0x4b6d3d=_0x55ca[_0xe3f360];return _0x4b6d3d;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 029de96..ea56df3 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 _0x07f7=['./memberReport.attributes','exports','define','report_member','membername_interface','interface','lodash','util','api','bluebird','request-promise','../../config/environment'];(function(_0x2f479d,_0x1d6836){var _0x300d48=function(_0x338a74){while(--_0x338a74){_0x2f479d['push'](_0x2f479d['shift']());}};_0x300d48(++_0x1d6836);}(_0x07f7,0x7e));var _0x707f=function(_0x5e5c4c,_0x21abba){_0x5e5c4c=_0x5e5c4c-0x0;var _0x176148=_0x07f7[_0x5e5c4c];return _0x176148;};'use strict';var _=require(_0x707f('0x0'));var util=require(_0x707f('0x1'));var logger=require('../../config/logger')(_0x707f('0x2'));var moment=require('moment');var BPromise=require(_0x707f('0x3'));var rp=require(_0x707f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x707f('0x5'));var attributes=require(_0x707f('0x6'));module[_0x707f('0x7')]=function(_0x12bab1,_0x70cf99){return _0x12bab1[_0x707f('0x8')]('MemberReport',attributes,{'tableName':_0x707f('0x9'),'paranoid':![],'indexes':[{'name':_0x707f('0xa'),'fields':['membername',_0x707f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeebc=['membername','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','report_member'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xeebc,0x6f));var _0xceeb=function(_0x3b86da,_0x43cb76){_0x3b86da=_0x3b86da-0x0;var _0x355663=_0xeebc[_0x3b86da];return _0x355663;};'use strict';var _=require(_0xceeb('0x0'));var util=require(_0xceeb('0x1'));var logger=require(_0xceeb('0x2'))(_0xceeb('0x3'));var moment=require('moment');var BPromise=require(_0xceeb('0x4'));var rp=require(_0xceeb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xceeb('0x6'));var config=require(_0xceeb('0x7'));var attributes=require('./memberReport.attributes');module[_0xceeb('0x8')]=function(_0x38d59e,_0x345e92){return _0x38d59e['define']('MemberReport',attributes,{'tableName':_0xceeb('0x9'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xceeb('0xa'),'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 ddc2ef4..844a05e 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 _0x3d49=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMemberReport','MemberReport','findAll','options','where','limit','include','attributes','map','model','catch','CreateMemberReport','create','body','raw','UpdateMemberReport','update','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x333ff4,_0x1e8738){var _0x3442d7=function(_0x252a1d){while(--_0x252a1d){_0x333ff4['push'](_0x333ff4['shift']());}};_0x3442d7(++_0x1e8738);}(_0x3d49,0x151));var _0x93d4=function(_0xf6aec0,_0x51ffd6){_0xf6aec0=_0xf6aec0-0x0;var _0x59a51b=_0x3d49[_0xf6aec0];return _0x59a51b;};'use strict';var _=require('lodash');var util=require(_0x93d4('0x0'));var moment=require(_0x93d4('0x1'));var BPromise=require(_0x93d4('0x2'));var rs=require(_0x93d4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93d4('0x4'))['db'];var utils=require(_0x93d4('0x5'));var logger=require(_0x93d4('0x6'))(_0x93d4('0x7'));var config=require(_0x93d4('0x8'));var jayson=require(_0x93d4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4bee9d,_0x5e2fd9,_0x50c533){return new BPromise(function(_0x4c96b7,_0x1eaf9f){return client[_0x93d4('0xa')](_0x4bee9d,_0x50c533)[_0x93d4('0xb')](function(_0x11bc7a){logger[_0x93d4('0xc')](_0x93d4('0xd'),_0x5e2fd9,_0x93d4('0xe'));logger[_0x93d4('0xf')](_0x93d4('0x10'),_0x5e2fd9,_0x93d4('0xe'),JSON[_0x93d4('0x11')](_0x11bc7a));if(_0x11bc7a[_0x93d4('0x12')]){if(_0x11bc7a['error'][_0x93d4('0x13')]===0x1f4){logger['error'](_0x93d4('0xd'),_0x5e2fd9,_0x11bc7a[_0x93d4('0x12')][_0x93d4('0x14')]);return _0x1eaf9f(_0x11bc7a[_0x93d4('0x12')]['message']);}logger[_0x93d4('0x12')](_0x93d4('0xd'),_0x5e2fd9,_0x11bc7a['error'][_0x93d4('0x14')]);return _0x4c96b7(_0x11bc7a[_0x93d4('0x12')][_0x93d4('0x14')]);}else{logger[_0x93d4('0xc')](_0x93d4('0xd'),_0x5e2fd9,'request\x20sent');_0x4c96b7(_0x11bc7a['result'][_0x93d4('0x14')]);}})['catch'](function(_0x1ffdc5){logger[_0x93d4('0x12')](_0x93d4('0xd'),_0x5e2fd9,_0x1ffdc5);_0x1eaf9f(_0x1ffdc5);});});}exports[_0x93d4('0x15')]=function(_0x19ede1){var _0x266e0a=this;return new Promise(function(_0x56c054,_0x452e98){return db[_0x93d4('0x16')][_0x93d4('0x17')]({'raw':_0x19ede1['options']?_0x19ede1[_0x93d4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x19ede1[_0x93d4('0x18')]?_0x19ede1[_0x93d4('0x18')][_0x93d4('0x19')]||null:null,'attributes':_0x19ede1[_0x93d4('0x18')]?_0x19ede1[_0x93d4('0x18')]['attributes']||null:null,'limit':_0x19ede1[_0x93d4('0x18')]?_0x19ede1[_0x93d4('0x18')][_0x93d4('0x1a')]||null:null,'include':_0x19ede1[_0x93d4('0x18')]?_0x19ede1[_0x93d4('0x18')][_0x93d4('0x1b')]?_['map'](_0x19ede1[_0x93d4('0x18')][_0x93d4('0x1b')],function(_0x26528e){return{'model':db[_0x26528e['model']],'as':_0x26528e['as'],'attributes':_0x26528e[_0x93d4('0x1c')],'include':_0x26528e['include']?_[_0x93d4('0x1d')](_0x26528e[_0x93d4('0x1b')],function(_0x57989a){return{'model':db[_0x57989a[_0x93d4('0x1e')]],'as':_0x57989a['as'],'attributes':_0x57989a[_0x93d4('0x1c')],'include':_0x57989a[_0x93d4('0x1b')]?_['map'](_0x57989a['include'],function(_0x3cf57f){return{'model':db[_0x3cf57f['model']],'as':_0x3cf57f['as'],'attributes':_0x3cf57f[_0x93d4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x93d4('0xb')](function(_0x4dd4d0){logger['info'](_0x93d4('0x15'),_0x19ede1);logger[_0x93d4('0xf')](_0x93d4('0x15'),_0x19ede1,JSON[_0x93d4('0x11')](_0x4dd4d0));_0x56c054(_0x4dd4d0);})[_0x93d4('0x1f')](function(_0x2cfe55){logger[_0x93d4('0x12')](_0x93d4('0x15'),_0x2cfe55[_0x93d4('0x14')],_0x19ede1);_0x452e98(_0x266e0a['error'](0x1f4,_0x2cfe55[_0x93d4('0x14')]));});});};exports[_0x93d4('0x20')]=function(_0x3d5536){var _0x592876=this;return new Promise(function(_0x1baaac,_0x393b63){return db[_0x93d4('0x16')][_0x93d4('0x21')](_0x3d5536[_0x93d4('0x22')],{'raw':_0x3d5536['options']?_0x3d5536[_0x93d4('0x18')][_0x93d4('0x23')]===undefined?!![]:![]:!![]})[_0x93d4('0xb')](function(_0x543d5e){logger[_0x93d4('0xc')](_0x93d4('0x20'),_0x3d5536);logger[_0x93d4('0xf')](_0x93d4('0x20'),_0x3d5536,JSON[_0x93d4('0x11')](_0x543d5e));_0x1baaac(_0x543d5e);})['catch'](function(_0x2cce08){logger[_0x93d4('0x12')](_0x93d4('0x20'),_0x2cce08[_0x93d4('0x14')],_0x3d5536);_0x393b63(_0x592876[_0x93d4('0x12')](0x1f4,_0x2cce08[_0x93d4('0x14')]));});});};exports[_0x93d4('0x24')]=function(_0x23d3aa){var _0x10daa6=this;return new Promise(function(_0x3efdc3,_0x1c3019){return db['MemberReport'][_0x93d4('0x25')](_0x23d3aa['body'],{'raw':_0x23d3aa['options']?_0x23d3aa['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23d3aa[_0x93d4('0x18')]?_0x23d3aa[_0x93d4('0x18')][_0x93d4('0x19')]||null:null,'attributes':_0x23d3aa[_0x93d4('0x18')]?_0x23d3aa[_0x93d4('0x18')][_0x93d4('0x1c')]||null:null,'limit':_0x23d3aa[_0x93d4('0x18')]?_0x23d3aa[_0x93d4('0x18')]['limit']||null:null})[_0x93d4('0xb')](function(_0x2db0c1){logger[_0x93d4('0xc')](_0x93d4('0x24'),_0x23d3aa);logger[_0x93d4('0xf')](_0x93d4('0x24'),_0x23d3aa,JSON[_0x93d4('0x11')](_0x2db0c1));_0x3efdc3(_0x2db0c1);})[_0x93d4('0x1f')](function(_0xeaca44){logger[_0x93d4('0x12')]('UpdateMemberReport',_0xeaca44['message'],_0x23d3aa);_0x1c3019(_0x10daa6[_0x93d4('0x12')](0x1f4,_0xeaca44[_0x93d4('0x14')]));});});}; \ No newline at end of file +var _0x1fcc=['attributes','map','include','model','GetMemberReport','CreateMemberReport','create','then','UpdateMemberReport','update','body','limit','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','MemberReport','findAll','options','raw','where'];(function(_0x5de4b5,_0x20b249){var _0x2b5fa7=function(_0x1b1b80){while(--_0x1b1b80){_0x5de4b5['push'](_0x5de4b5['shift']());}};_0x2b5fa7(++_0x20b249);}(_0x1fcc,0x125));var _0xc1fc=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x1fcc[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0xc1fc('0x0'));var util=require(_0xc1fc('0x1'));var moment=require('moment');var BPromise=require(_0xc1fc('0x2'));var rs=require(_0xc1fc('0x3'));var fs=require('fs');var Redis=require(_0xc1fc('0x4'));var db=require(_0xc1fc('0x5'))['db'];var utils=require(_0xc1fc('0x6'));var logger=require(_0xc1fc('0x7'))(_0xc1fc('0x8'));var config=require('../../config/environment');var jayson=require(_0xc1fc('0x9'));var client=jayson[_0xc1fc('0xa')][_0xc1fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4df2ae,_0x1b8560,_0x1f847d){return new BPromise(function(_0x5ae7b3,_0x3a9ad7){return client[_0xc1fc('0xc')](_0x4df2ae,_0x1f847d)['then'](function(_0x3178de){logger['info'](_0xc1fc('0xd'),_0x1b8560,_0xc1fc('0xe'));logger['debug'](_0xc1fc('0xf'),_0x1b8560,_0xc1fc('0xe'),JSON[_0xc1fc('0x10')](_0x3178de));if(_0x3178de[_0xc1fc('0x11')]){if(_0x3178de[_0xc1fc('0x11')]['code']===0x1f4){logger[_0xc1fc('0x11')](_0xc1fc('0xd'),_0x1b8560,_0x3178de[_0xc1fc('0x11')]['message']);return _0x3a9ad7(_0x3178de[_0xc1fc('0x11')][_0xc1fc('0x12')]);}logger[_0xc1fc('0x11')]('MemberReport,\x20%s,\x20%s',_0x1b8560,_0x3178de[_0xc1fc('0x11')][_0xc1fc('0x12')]);return _0x5ae7b3(_0x3178de[_0xc1fc('0x11')][_0xc1fc('0x12')]);}else{logger[_0xc1fc('0x13')](_0xc1fc('0xd'),_0x1b8560,_0xc1fc('0xe'));_0x5ae7b3(_0x3178de[_0xc1fc('0x14')][_0xc1fc('0x12')]);}})[_0xc1fc('0x15')](function(_0x5823ae){logger[_0xc1fc('0x11')]('MemberReport,\x20%s,\x20%s',_0x1b8560,_0x5823ae);_0x3a9ad7(_0x5823ae);});});}exports['GetMemberReport']=function(_0x6c0e26){var _0x20f4ec=this;return new Promise(function(_0x3fba13,_0x8f5528){return db[_0xc1fc('0x16')][_0xc1fc('0x17')]({'raw':_0x6c0e26[_0xc1fc('0x18')]?_0x6c0e26[_0xc1fc('0x18')][_0xc1fc('0x19')]===undefined?!![]:![]:!![],'where':_0x6c0e26['options']?_0x6c0e26[_0xc1fc('0x18')][_0xc1fc('0x1a')]||null:null,'attributes':_0x6c0e26['options']?_0x6c0e26['options'][_0xc1fc('0x1b')]||null:null,'limit':_0x6c0e26[_0xc1fc('0x18')]?_0x6c0e26[_0xc1fc('0x18')]['limit']||null:null,'include':_0x6c0e26[_0xc1fc('0x18')]?_0x6c0e26['options']['include']?_[_0xc1fc('0x1c')](_0x6c0e26[_0xc1fc('0x18')][_0xc1fc('0x1d')],function(_0x3aacf2){return{'model':db[_0x3aacf2[_0xc1fc('0x1e')]],'as':_0x3aacf2['as'],'attributes':_0x3aacf2[_0xc1fc('0x1b')],'include':_0x3aacf2['include']?_[_0xc1fc('0x1c')](_0x3aacf2['include'],function(_0x27723f){return{'model':db[_0x27723f[_0xc1fc('0x1e')]],'as':_0x27723f['as'],'attributes':_0x27723f['attributes'],'include':_0x27723f[_0xc1fc('0x1d')]?_[_0xc1fc('0x1c')](_0x27723f[_0xc1fc('0x1d')],function(_0x23594f){return{'model':db[_0x23594f[_0xc1fc('0x1e')]],'as':_0x23594f['as'],'attributes':_0x23594f[_0xc1fc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x369914){logger[_0xc1fc('0x13')](_0xc1fc('0x1f'),_0x6c0e26);logger['debug'](_0xc1fc('0x1f'),_0x6c0e26,JSON['stringify'](_0x369914));_0x3fba13(_0x369914);})[_0xc1fc('0x15')](function(_0x1977a4){logger[_0xc1fc('0x11')](_0xc1fc('0x1f'),_0x1977a4[_0xc1fc('0x12')],_0x6c0e26);_0x8f5528(_0x20f4ec[_0xc1fc('0x11')](0x1f4,_0x1977a4['message']));});});};exports[_0xc1fc('0x20')]=function(_0x56f217){var _0x2dd3b5=this;return new Promise(function(_0x346b0d,_0x53d9d1){return db['MemberReport'][_0xc1fc('0x21')](_0x56f217['body'],{'raw':_0x56f217[_0xc1fc('0x18')]?_0x56f217[_0xc1fc('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xc1fc('0x22')](function(_0x4a29cd){logger[_0xc1fc('0x13')](_0xc1fc('0x20'),_0x56f217);logger['debug'](_0xc1fc('0x20'),_0x56f217,JSON[_0xc1fc('0x10')](_0x4a29cd));_0x346b0d(_0x4a29cd);})['catch'](function(_0x459252){logger[_0xc1fc('0x11')]('CreateMemberReport',_0x459252[_0xc1fc('0x12')],_0x56f217);_0x53d9d1(_0x2dd3b5['error'](0x1f4,_0x459252['message']));});});};exports[_0xc1fc('0x23')]=function(_0x28aa90){var _0x485f79=this;return new Promise(function(_0x251e28,_0x46d2a0){return db[_0xc1fc('0x16')][_0xc1fc('0x24')](_0x28aa90[_0xc1fc('0x25')],{'raw':_0x28aa90[_0xc1fc('0x18')]?_0x28aa90[_0xc1fc('0x18')][_0xc1fc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28aa90[_0xc1fc('0x18')]?_0x28aa90['options']['where']||null:null,'attributes':_0x28aa90[_0xc1fc('0x18')]?_0x28aa90['options'][_0xc1fc('0x1b')]||null:null,'limit':_0x28aa90[_0xc1fc('0x18')]?_0x28aa90[_0xc1fc('0x18')][_0xc1fc('0x26')]||null:null})['then'](function(_0x5942c5){logger[_0xc1fc('0x13')](_0xc1fc('0x23'),_0x28aa90);logger[_0xc1fc('0x27')](_0xc1fc('0x23'),_0x28aa90,JSON[_0xc1fc('0x10')](_0x5942c5));_0x251e28(_0x5942c5);})[_0xc1fc('0x15')](function(_0x26f130){logger[_0xc1fc('0x11')]('UpdateMemberReport',_0x26f130['message'],_0x28aa90);_0x46d2a0(_0x485f79[_0xc1fc('0x11')](0x1f4,_0x26f130['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4a4cb99..d881aee 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 _0x793d=['express','Router','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer','util','path'];(function(_0x5e9a69,_0x40c0ec){var _0x5979c8=function(_0x293da2){while(--_0x293da2){_0x5e9a69['push'](_0x5e9a69['shift']());}};_0x5979c8(++_0x40c0ec);}(_0x793d,0x15d));var _0xd793=function(_0x3a4155,_0x1788ee){_0x3a4155=_0x3a4155-0x0;var _0x32bb99=_0x793d[_0x3a4155];return _0x32bb99;};'use strict';var multer=require(_0xd793('0x0'));var util=require(_0xd793('0x1'));var path=require(_0xd793('0x2'));var timeout=require('connect-timeout');var express=require(_0xd793('0x3'));var router=express[_0xd793('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd793('0x5'));var interaction=require(_0xd793('0x6'));var config=require('../../config/environment');var controller=require(_0xd793('0x7'));router[_0xd793('0x8')]('/',controller[_0xd793('0x9')]);module[_0xd793('0xa')]=router; \ No newline at end of file +var _0x43a6=['get','index','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','./migration.controller'];(function(_0x3f6a30,_0x53f3fc){var _0x192186=function(_0x45135e){while(--_0x45135e){_0x3f6a30['push'](_0x3f6a30['shift']());}};_0x192186(++_0x53f3fc);}(_0x43a6,0x9d));var _0x643a=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0x43a6[_0x12d6c2];return _0x1c9825;};'use strict';var multer=require(_0x643a('0x0'));var util=require(_0x643a('0x1'));var path=require(_0x643a('0x2'));var timeout=require('connect-timeout');var express=require(_0x643a('0x3'));var router=express[_0x643a('0x4')]();var fs_extra=require(_0x643a('0x5'));var auth=require(_0x643a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x643a('0x7'));router[_0x643a('0x8')]('/',controller[_0x643a('0x9')]);module[_0x643a('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index f082ccc..16661aa 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 _0x63a1=['exports','version','sequelize'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0x63a1,0xf8));var _0x163a=function(_0x2bb040,_0xfde227){_0x2bb040=_0x2bb040-0x0;var _0x128691=_0x63a1[_0x2bb040];return _0x128691;};'use strict';var Sequelize=require(_0x163a('0x0'));module[_0x163a('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x163a('0x2')}}; \ No newline at end of file +var _0x638c=['exports','STRING','version','sequelize'];(function(_0xab4a7c,_0x28b640){var _0x4b0bd2=function(_0x254009){while(--_0x254009){_0xab4a7c['push'](_0xab4a7c['shift']());}};_0x4b0bd2(++_0x28b640);}(_0x638c,0xf7));var _0xc638=function(_0x2af7e3,_0x1ae648){_0x2af7e3=_0x2af7e3-0x0;var _0x49890b=_0x638c[_0x2af7e3];return _0x49890b;};'use strict';var Sequelize=require(_0xc638('0x0'));module[_0xc638('0x1')]={'version':{'type':Sequelize[_0xc638('0x2')],'unique':_0xc638('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 43987d1..dd82749 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 _0xb5be=['sort','pick','merge','where','type','VIRTUAL','options','includeAll','include','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','Migration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xb5be,0x116));var _0xeb5b=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xb5be[_0x26462c];return _0x509a42;};'use strict';var emlformat=require(_0xeb5b('0x0'));var rimraf=require(_0xeb5b('0x1'));var zipdir=require(_0xeb5b('0x2'));var jsonpatch=require(_0xeb5b('0x3'));var rp=require(_0xeb5b('0x4'));var moment=require(_0xeb5b('0x5'));var BPromise=require(_0xeb5b('0x6'));var Mustache=require(_0xeb5b('0x7'));var util=require(_0xeb5b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xeb5b('0x9'));var ejs=require(_0xeb5b('0xa'));var fs=require('fs');var fs_extra=require(_0xeb5b('0xb'));var _=require(_0xeb5b('0xc'));var squel=require(_0xeb5b('0xd'));var crypto=require(_0xeb5b('0xe'));var jsforce=require(_0xeb5b('0xf'));var deskjs=require(_0xeb5b('0x10'));var toCsv=require(_0xeb5b('0x9'));var querystring=require(_0xeb5b('0x11'));var Papa=require(_0xeb5b('0x12'));var Redis=require(_0xeb5b('0x13'));var authService=require(_0xeb5b('0x14'));var qs=require(_0xeb5b('0x15'));var as=require(_0xeb5b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb5b('0x17'));var utils=require(_0xeb5b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeb5b('0x19'))['db'];function respondWithStatusCode(_0x38f17e,_0x23601d){_0x23601d=_0x23601d||0xcc;return function(_0x1a9554){if(_0x1a9554){return _0x38f17e[_0xeb5b('0x1a')](_0x23601d);}return _0x38f17e[_0xeb5b('0x1b')](_0x23601d)[_0xeb5b('0x1c')]();};}function respondWithResult(_0x245444,_0x5b1978){_0x5b1978=_0x5b1978||0xc8;return function(_0x50815f){if(_0x50815f){return _0x245444['status'](_0x5b1978)[_0xeb5b('0x1d')](_0x50815f);}};}function respondWithFilteredResult(_0xea7345,_0x44ffc5){return function(_0x5a2a8c){if(_0x5a2a8c){var _0x30dea4=typeof _0x44ffc5['offset']===_0xeb5b('0x1e')&&typeof _0x44ffc5['limit']===_0xeb5b('0x1e');var _0x54f48a=_0x5a2a8c[_0xeb5b('0x1f')];var _0x38c129=_0x30dea4?0x0:_0x44ffc5[_0xeb5b('0x20')];var _0x49050a=_0x30dea4?_0x5a2a8c[_0xeb5b('0x1f')]:_0x44ffc5['offset']+_0x44ffc5[_0xeb5b('0x21')];var _0x54722d;if(_0x49050a>=_0x54f48a){_0x49050a=_0x54f48a;_0x54722d=0xc8;}else{_0x54722d=0xce;}_0xea7345[_0xeb5b('0x1b')](_0x54722d);return _0xea7345['set'](_0xeb5b('0x22'),_0x38c129+'-'+_0x49050a+'/'+_0x54f48a)[_0xeb5b('0x1d')](_0x5a2a8c);}return null;};}function patchUpdates(_0x5c7bb4){return function(_0x25f5c7){try{jsonpatch[_0xeb5b('0x23')](_0x25f5c7,_0x5c7bb4,!![]);}catch(_0x8aa5c9){return BPromise[_0xeb5b('0x24')](_0x8aa5c9);}return _0x25f5c7[_0xeb5b('0x25')]();};}function saveUpdates(_0x35f633,_0x563b01){return function(_0x313b5e){if(_0x313b5e){return _0x313b5e[_0xeb5b('0x26')](_0x35f633)[_0xeb5b('0x27')](function(_0x167382){return _0x167382;});}return null;};}function removeEntity(_0xf023bc,_0x3a0cf3){return function(_0x7c3bf4){if(_0x7c3bf4){return _0x7c3bf4['destroy']()['then'](function(){_0xf023bc['status'](0xcc)[_0xeb5b('0x1c')]();});}};}function handleEntityNotFound(_0x4c52e6,_0x4e64ae){return function(_0x2f938e){if(!_0x2f938e){_0x4c52e6['sendStatus'](0x194);}return _0x2f938e;};}function handleError(_0x185616,_0x5e1b7d){_0x5e1b7d=_0x5e1b7d||0x1f4;return function(_0x53fc9b){logger[_0xeb5b('0x28')](_0x53fc9b['stack']);if(_0x53fc9b['name']){delete _0x53fc9b[_0xeb5b('0x29')];}_0x185616[_0xeb5b('0x1b')](_0x5e1b7d)[_0xeb5b('0x2a')](_0x53fc9b);};}exports[_0xeb5b('0x2b')]=function(_0x1c3621,_0x355d14){var _0xe408e7={},_0x9b04c1={},_0xfb8f8={'count':0x0,'rows':[]};var _0x5b82cb=_['map'](db[_0xeb5b('0x2c')][_0xeb5b('0x2d')],function(_0x1a6a9b){return{'name':_0x1a6a9b[_0xeb5b('0x2e')],'type':_0x1a6a9b['type'][_0xeb5b('0x2f')]};});_0x9b04c1[_0xeb5b('0x30')]=_[_0xeb5b('0x31')](_0x5b82cb,_0xeb5b('0x29'));_0x9b04c1[_0xeb5b('0x32')]=_['keys'](_0x1c3621['query']);_0x9b04c1[_0xeb5b('0x33')]=_[_0xeb5b('0x34')](_0x9b04c1[_0xeb5b('0x30')],_0x9b04c1[_0xeb5b('0x32')]);_0xe408e7[_0xeb5b('0x35')]=_['intersection'](_0x9b04c1['model'],qs[_0xeb5b('0x36')](_0x1c3621[_0xeb5b('0x32')][_0xeb5b('0x36')]));_0xe408e7['attributes']=_0xe408e7[_0xeb5b('0x35')][_0xeb5b('0x37')]?_0xe408e7[_0xeb5b('0x35')]:_0x9b04c1['model'];if(!_0x1c3621[_0xeb5b('0x32')]['hasOwnProperty'](_0xeb5b('0x38'))){_0xe408e7[_0xeb5b('0x21')]=qs['limit'](_0x1c3621[_0xeb5b('0x32')][_0xeb5b('0x21')]);_0xe408e7[_0xeb5b('0x20')]=qs['offset'](_0x1c3621[_0xeb5b('0x32')][_0xeb5b('0x20')]);}_0xe408e7['order']=qs[_0xeb5b('0x39')](_0x1c3621[_0xeb5b('0x32')]['sort']);_0xe408e7['where']=qs['filters'](_[_0xeb5b('0x3a')](_0x1c3621['query'],_0x9b04c1[_0xeb5b('0x33')]),_0x5b82cb);if(_0x1c3621[_0xeb5b('0x32')]['filter']){_0xe408e7['where']=_[_0xeb5b('0x3b')](_0xe408e7[_0xeb5b('0x3c')],{'$or':_[_0xeb5b('0x31')](_0x5b82cb,function(_0x5c2258){if(_0x5c2258[_0xeb5b('0x3d')]!==_0xeb5b('0x3e')){var _0x588a2a={};_0x588a2a[_0x5c2258['name']]={'$like':'%'+_0x1c3621[_0xeb5b('0x32')]['filter']+'%'};return _0x588a2a;}})});}_0xe408e7=_[_0xeb5b('0x3b')]({},_0xe408e7,_0x1c3621[_0xeb5b('0x3f')]);var _0x214506={'where':_0xe408e7[_0xeb5b('0x3c')]};return db['Migration'][_0xeb5b('0x1f')](_0x214506)[_0xeb5b('0x27')](function(_0x1c856d){_0xfb8f8[_0xeb5b('0x1f')]=_0x1c856d;if(_0x1c3621[_0xeb5b('0x32')][_0xeb5b('0x40')]){_0xe408e7[_0xeb5b('0x41')]=[{'all':!![]}];}return db['Migration']['findAll'](_0xe408e7);})['then'](function(_0x57ca92){_0xfb8f8['rows']=_0x57ca92;return _0xfb8f8;})[_0xeb5b('0x27')](respondWithFilteredResult(_0x355d14,_0xe408e7))[_0xeb5b('0x42')](handleError(_0x355d14,null));}; \ No newline at end of file +var _0x44e8=['count','includeAll','include','findAll','rows','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','then','destroy','end','error','name','send','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x23a79e,_0x235f89){var _0x3dab57=function(_0x346cf4){while(--_0x346cf4){_0x23a79e['push'](_0x23a79e['shift']());}};_0x3dab57(++_0x235f89);}(_0x44e8,0xd7));var _0x844e=function(_0x2e9a89,_0x54bcf8){_0x2e9a89=_0x2e9a89-0x0;var _0x4c4a6e=_0x44e8[_0x2e9a89];return _0x4c4a6e;};'use strict';var emlformat=require(_0x844e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x844e('0x1'));var rp=require(_0x844e('0x2'));var moment=require(_0x844e('0x3'));var BPromise=require(_0x844e('0x4'));var Mustache=require('mustache');var util=require(_0x844e('0x5'));var path=require(_0x844e('0x6'));var sox=require(_0x844e('0x7'));var csv=require(_0x844e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x844e('0x9'));var _=require(_0x844e('0xa'));var squel=require(_0x844e('0xb'));var crypto=require(_0x844e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x844e('0xd'));var toCsv=require(_0x844e('0x8'));var querystring=require(_0x844e('0xe'));var Papa=require(_0x844e('0xf'));var Redis=require(_0x844e('0x10'));var authService=require(_0x844e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x844e('0x12'));var hardwareService=require(_0x844e('0x13'));var logger=require(_0x844e('0x14'))(_0x844e('0x15'));var utils=require(_0x844e('0x16'));var config=require(_0x844e('0x17'));var licenseUtil=require(_0x844e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8d3bea,_0x23df3f){_0x23df3f=_0x23df3f||0xcc;return function(_0x52ac76){if(_0x52ac76){return _0x8d3bea[_0x844e('0x19')](_0x23df3f);}return _0x8d3bea[_0x844e('0x1a')](_0x23df3f)['end']();};}function respondWithResult(_0x1f48e2,_0x6b542d){_0x6b542d=_0x6b542d||0xc8;return function(_0x1c1689){if(_0x1c1689){return _0x1f48e2['status'](_0x6b542d)[_0x844e('0x1b')](_0x1c1689);}};}function respondWithFilteredResult(_0x465e49,_0x380eb4){return function(_0x935134){if(_0x935134){var _0x2588a3=typeof _0x380eb4[_0x844e('0x1c')]===_0x844e('0x1d')&&typeof _0x380eb4[_0x844e('0x1e')]==='undefined';var _0x36286c=_0x935134['count'];var _0x3c307f=_0x2588a3?0x0:_0x380eb4['offset'];var _0x315c50=_0x2588a3?_0x935134['count']:_0x380eb4[_0x844e('0x1c')]+_0x380eb4[_0x844e('0x1e')];var _0x2d6ba8;if(_0x315c50>=_0x36286c){_0x315c50=_0x36286c;_0x2d6ba8=0xc8;}else{_0x2d6ba8=0xce;}_0x465e49[_0x844e('0x1a')](_0x2d6ba8);return _0x465e49[_0x844e('0x1f')](_0x844e('0x20'),_0x3c307f+'-'+_0x315c50+'/'+_0x36286c)[_0x844e('0x1b')](_0x935134);}return null;};}function patchUpdates(_0x243aeb){return function(_0x4ffb86){try{jsonpatch[_0x844e('0x21')](_0x4ffb86,_0x243aeb,!![]);}catch(_0x50aeec){return BPromise['reject'](_0x50aeec);}return _0x4ffb86[_0x844e('0x22')]();};}function saveUpdates(_0x345dcc,_0x439b26){return function(_0x286fdd){if(_0x286fdd){return _0x286fdd['update'](_0x345dcc)[_0x844e('0x23')](function(_0x3dde07){return _0x3dde07;});}return null;};}function removeEntity(_0x571498,_0x2520f8){return function(_0x13489b){if(_0x13489b){return _0x13489b[_0x844e('0x24')]()[_0x844e('0x23')](function(){_0x571498[_0x844e('0x1a')](0xcc)[_0x844e('0x25')]();});}};}function handleEntityNotFound(_0x498ae0,_0x399a81){return function(_0xadf0d8){if(!_0xadf0d8){_0x498ae0[_0x844e('0x19')](0x194);}return _0xadf0d8;};}function handleError(_0x263702,_0x2c915f){_0x2c915f=_0x2c915f||0x1f4;return function(_0x5d6856){logger[_0x844e('0x26')](_0x5d6856['stack']);if(_0x5d6856['name']){delete _0x5d6856[_0x844e('0x27')];}_0x263702[_0x844e('0x1a')](_0x2c915f)[_0x844e('0x28')](_0x5d6856);};}exports['index']=function(_0x489349,_0x2d4acd){var _0xc3ec93={},_0x54fd73={},_0x228cc1={'count':0x0,'rows':[]};var _0x81d4de=_[_0x844e('0x29')](db[_0x844e('0x2a')][_0x844e('0x2b')],function(_0x799cde){return{'name':_0x799cde[_0x844e('0x2c')],'type':_0x799cde[_0x844e('0x2d')][_0x844e('0x2e')]};});_0x54fd73[_0x844e('0x2f')]=_['map'](_0x81d4de,_0x844e('0x27'));_0x54fd73[_0x844e('0x30')]=_[_0x844e('0x31')](_0x489349[_0x844e('0x30')]);_0x54fd73[_0x844e('0x32')]=_[_0x844e('0x33')](_0x54fd73[_0x844e('0x2f')],_0x54fd73['query']);_0xc3ec93[_0x844e('0x34')]=_[_0x844e('0x33')](_0x54fd73[_0x844e('0x2f')],qs['fields'](_0x489349[_0x844e('0x30')][_0x844e('0x35')]));_0xc3ec93['attributes']=_0xc3ec93[_0x844e('0x34')][_0x844e('0x36')]?_0xc3ec93['attributes']:_0x54fd73[_0x844e('0x2f')];if(!_0x489349[_0x844e('0x30')][_0x844e('0x37')](_0x844e('0x38'))){_0xc3ec93[_0x844e('0x1e')]=qs[_0x844e('0x1e')](_0x489349[_0x844e('0x30')]['limit']);_0xc3ec93[_0x844e('0x1c')]=qs[_0x844e('0x1c')](_0x489349[_0x844e('0x30')][_0x844e('0x1c')]);}_0xc3ec93[_0x844e('0x39')]=qs[_0x844e('0x3a')](_0x489349[_0x844e('0x30')][_0x844e('0x3a')]);_0xc3ec93[_0x844e('0x3b')]=qs[_0x844e('0x32')](_[_0x844e('0x3c')](_0x489349['query'],_0x54fd73['filters']),_0x81d4de);if(_0x489349[_0x844e('0x30')][_0x844e('0x3d')]){_0xc3ec93[_0x844e('0x3b')]=_[_0x844e('0x3e')](_0xc3ec93[_0x844e('0x3b')],{'$or':_[_0x844e('0x29')](_0x81d4de,function(_0x6f902e){if(_0x6f902e[_0x844e('0x2d')]!==_0x844e('0x3f')){var _0x539077={};_0x539077[_0x6f902e[_0x844e('0x27')]]={'$like':'%'+_0x489349['query'][_0x844e('0x3d')]+'%'};return _0x539077;}})});}_0xc3ec93=_['merge']({},_0xc3ec93,_0x489349[_0x844e('0x40')]);var _0x5dc530={'where':_0xc3ec93[_0x844e('0x3b')]};return db[_0x844e('0x2a')][_0x844e('0x41')](_0x5dc530)[_0x844e('0x23')](function(_0x2eb412){_0x228cc1[_0x844e('0x41')]=_0x2eb412;if(_0x489349[_0x844e('0x30')][_0x844e('0x42')]){_0xc3ec93[_0x844e('0x43')]=[{'all':!![]}];}return db[_0x844e('0x2a')][_0x844e('0x44')](_0xc3ec93);})['then'](function(_0x3ecb60){_0x228cc1[_0x844e('0x45')]=_0x3ecb60;return _0x228cc1;})[_0x844e('0x23')](respondWithFilteredResult(_0x2d4acd,_0xc3ec93))['catch'](handleError(_0x2d4acd,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b478e5a..e19dab5 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 _0x9d64=['bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','../../config/logger'];(function(_0x3895d3,_0x2273d8){var _0x2610af=function(_0x1d6dfa){while(--_0x1d6dfa){_0x3895d3['push'](_0x3895d3['shift']());}};_0x2610af(++_0x2273d8);}(_0x9d64,0x13d));var _0x49d6=function(_0x1a0632,_0x5e9263){_0x1a0632=_0x1a0632-0x0;var _0x72a142=_0x9d64[_0x1a0632];return _0x72a142;};'use strict';var _=require(_0x49d6('0x0'));var util=require('util');var logger=require(_0x49d6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x49d6('0x2'));var rp=require(_0x49d6('0x3'));var fs=require('fs');var path=require(_0x49d6('0x4'));var rimraf=require(_0x49d6('0x5'));var config=require(_0x49d6('0x6'));var attributes=require(_0x49d6('0x7'));module[_0x49d6('0x8')]=function(_0x499138,_0x50183b){return _0x499138[_0x49d6('0x9')]('Migration',attributes,{'tableName':_0x49d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7cf=['request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','migrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x156dee,_0xaa7c23){var _0x1a6e5f=function(_0x56cfe4){while(--_0x56cfe4){_0x156dee['push'](_0x156dee['shift']());}};_0x1a6e5f(++_0xaa7c23);}(_0xe7cf,0x1c1));var _0xfe7c=function(_0x568427,_0x742280){_0x568427=_0x568427-0x0;var _0x3c2f86=_0xe7cf[_0x568427];return _0x3c2f86;};'use strict';var _=require(_0xfe7c('0x0'));var util=require(_0xfe7c('0x1'));var logger=require(_0xfe7c('0x2'))(_0xfe7c('0x3'));var moment=require(_0xfe7c('0x4'));var BPromise=require(_0xfe7c('0x5'));var rp=require(_0xfe7c('0x6'));var fs=require('fs');var path=require(_0xfe7c('0x7'));var rimraf=require(_0xfe7c('0x8'));var config=require(_0xfe7c('0x9'));var attributes=require(_0xfe7c('0xa'));module[_0xfe7c('0xb')]=function(_0x3fa120,_0x11791b){return _0x3fa120['define']('Migration',attributes,{'tableName':_0xfe7c('0xc'),'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 e9a6f47..d9fbaed 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 _0x8ec7=['error','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x8ec7,0x1f1));var _0x78ec=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x8ec7[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x78ec('0x0'));var util=require(_0x78ec('0x1'));var moment=require('moment');var BPromise=require(_0x78ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78ec('0x3'))['db'];var utils=require(_0x78ec('0x4'));var logger=require('../../config/logger')(_0x78ec('0x5'));var config=require(_0x78ec('0x6'));var jayson=require(_0x78ec('0x7'));var client=jayson[_0x78ec('0x8')][_0x78ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d2780,_0x21e3f7,_0x4ca55e){return new BPromise(function(_0x372108,_0x268c50){return client[_0x78ec('0xa')](_0x5d2780,_0x4ca55e)['then'](function(_0x367c80){logger[_0x78ec('0xb')](_0x78ec('0xc'),_0x21e3f7,_0x78ec('0xd'));logger[_0x78ec('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x21e3f7,'request\x20sent',JSON[_0x78ec('0xf')](_0x367c80));if(_0x367c80[_0x78ec('0x10')]){if(_0x367c80[_0x78ec('0x10')]['code']===0x1f4){logger[_0x78ec('0x10')](_0x78ec('0xc'),_0x21e3f7,_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);return _0x268c50(_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);}logger[_0x78ec('0x10')](_0x78ec('0xc'),_0x21e3f7,_0x367c80[_0x78ec('0x10')][_0x78ec('0x11')]);return _0x372108(_0x367c80[_0x78ec('0x10')]['message']);}else{logger[_0x78ec('0xb')](_0x78ec('0xc'),_0x21e3f7,_0x78ec('0xd'));_0x372108(_0x367c80[_0x78ec('0x12')][_0x78ec('0x11')]);}})['catch'](function(_0x4f9ffd){logger['error']('Migration,\x20%s,\x20%s',_0x21e3f7,_0x4f9ffd);_0x268c50(_0x4f9ffd);});});} \ No newline at end of file +var _0x4ffe=['../../config/environment','jayson/promise','client','request','info','Migration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x571852,_0x34ae1f){var _0x1ec365=function(_0x398fe5){while(--_0x398fe5){_0x571852['push'](_0x571852['shift']());}};_0x1ec365(++_0x34ae1f);}(_0x4ffe,0x172));var _0xe4ff=function(_0x3efe9b,_0x5b41a8){_0x3efe9b=_0x3efe9b-0x0;var _0x132073=_0x4ffe[_0x3efe9b];return _0x132073;};'use strict';var _=require(_0xe4ff('0x0'));var util=require(_0xe4ff('0x1'));var moment=require(_0xe4ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4ff('0x3'));var fs=require('fs');var Redis=require(_0xe4ff('0x4'));var db=require(_0xe4ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4ff('0x6'))(_0xe4ff('0x7'));var config=require(_0xe4ff('0x8'));var jayson=require(_0xe4ff('0x9'));var client=jayson[_0xe4ff('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eed52,_0x455874,_0x227be1){return new BPromise(function(_0x2aa67c,_0x5b9a40){return client[_0xe4ff('0xb')](_0x5eed52,_0x227be1)['then'](function(_0xc992bd){logger[_0xe4ff('0xc')](_0xe4ff('0xd'),_0x455874,_0xe4ff('0xe'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x455874,_0xe4ff('0xe'),JSON[_0xe4ff('0xf')](_0xc992bd));if(_0xc992bd[_0xe4ff('0x10')]){if(_0xc992bd[_0xe4ff('0x10')][_0xe4ff('0x11')]===0x1f4){logger[_0xe4ff('0x10')]('Migration,\x20%s,\x20%s',_0x455874,_0xc992bd[_0xe4ff('0x10')][_0xe4ff('0x12')]);return _0x5b9a40(_0xc992bd['error'][_0xe4ff('0x12')]);}logger['error'](_0xe4ff('0xd'),_0x455874,_0xc992bd[_0xe4ff('0x10')]['message']);return _0x2aa67c(_0xc992bd[_0xe4ff('0x10')][_0xe4ff('0x12')]);}else{logger[_0xe4ff('0xc')](_0xe4ff('0xd'),_0x455874,_0xe4ff('0xe'));_0x2aa67c(_0xc992bd[_0xe4ff('0x13')]['message']);}})[_0xe4ff('0x14')](function(_0x5344ed){logger[_0xe4ff('0x10')](_0xe4ff('0xd'),_0x455874,_0x5344ed);_0x5b9a40(_0x5344ed);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 011c596..925e411 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 _0x8be3=['exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','/:id','isAuthenticated','create','put','update'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x8be3,0xd1));var _0x38be=function(_0x4d9d1a,_0xf2b6ce){_0x4d9d1a=_0x4d9d1a-0x0;var _0x116fa3=_0x8be3[_0x4d9d1a];return _0x116fa3;};'use strict';var multer=require('multer');var util=require(_0x38be('0x0'));var path=require(_0x38be('0x1'));var timeout=require(_0x38be('0x2'));var express=require('express');var router=express[_0x38be('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x38be('0x4'));var interaction=require(_0x38be('0x5'));var config=require(_0x38be('0x6'));var controller=require(_0x38be('0x7'));router[_0x38be('0x8')]('/',auth['isAuthenticated'](),controller[_0x38be('0x9')]);router[_0x38be('0x8')](_0x38be('0xa'),auth[_0x38be('0xb')](),controller['show']);router['post']('/',auth[_0x38be('0xb')](),controller[_0x38be('0xc')]);router[_0x38be('0xd')](_0x38be('0xa'),auth[_0x38be('0xb')](),controller[_0x38be('0xe')]);router['delete'](_0x38be('0xa'),auth[_0x38be('0xb')](),controller['destroy']);module[_0x38be('0xf')]=router; \ No newline at end of file +var _0x4b36=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b36,0xcb));var _0x64b3=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x4b36[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0x64b3('0x0'));var util=require('util');var path=require(_0x64b3('0x1'));var timeout=require(_0x64b3('0x2'));var express=require(_0x64b3('0x3'));var router=express[_0x64b3('0x4')]();var fs_extra=require(_0x64b3('0x5'));var auth=require(_0x64b3('0x6'));var interaction=require(_0x64b3('0x7'));var config=require(_0x64b3('0x8'));var controller=require('./network.controller');router[_0x64b3('0x9')]('/',auth[_0x64b3('0xa')](),controller[_0x64b3('0xb')]);router['get'](_0x64b3('0xc'),auth[_0x64b3('0xa')](),controller[_0x64b3('0xd')]);router['post']('/',auth[_0x64b3('0xa')](),controller[_0x64b3('0xe')]);router[_0x64b3('0xf')]('/:id',auth[_0x64b3('0xa')](),controller[_0x64b3('0x10')]);router[_0x64b3('0x11')](_0x64b3('0xc'),auth[_0x64b3('0xa')](),controller[_0x64b3('0x12')]);module[_0x64b3('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c8777fa..2e15ed2 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 _0x5d3d=['externip','stun','turn','STRING','sequelize','exports'];(function(_0x43464b,_0x2d3f14){var _0x4de9b8=function(_0x3e8e50){while(--_0x3e8e50){_0x43464b['push'](_0x43464b['shift']());}};_0x4de9b8(++_0x2d3f14);}(_0x5d3d,0x1c0));var _0xd5d3=function(_0x5ee410,_0x2a6a05){_0x5ee410=_0x5ee410-0x0;var _0x26f01c=_0x5d3d[_0x5ee410];return _0x26f01c;};'use strict';var Sequelize=require(_0xd5d3('0x0'));module[_0xd5d3('0x1')]={'type':{'type':Sequelize['ENUM']('localnet',_0xd5d3('0x2'),_0xd5d3('0x3'),_0xd5d3('0x4'))},'value':{'type':Sequelize[_0xd5d3('0x5')]},'username':{'type':Sequelize[_0xd5d3('0x5')]},'password':{'type':Sequelize[_0xd5d3('0x5')]}}; \ No newline at end of file +var _0xaa9c=['turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xaa9c,0x1ac));var _0xcaa9=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xaa9c[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0xcaa9('0x0'));module[_0xcaa9('0x1')]={'type':{'type':Sequelize[_0xcaa9('0x2')](_0xcaa9('0x3'),'externip','stun',_0xcaa9('0x4'))},'value':{'type':Sequelize[_0xcaa9('0x5')]},'username':{'type':Sequelize[_0xcaa9('0x5')]},'password':{'type':Sequelize[_0xcaa9('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index e1b70a6..9b82421 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 _0x0d59=['type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','toUpperCase','root','server/files/templates/stun_multiple.ejs','utf8','Reload','join','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','readFileSync','server/files/templates/network.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/stun_xcally.conf','TURN','format','STUN','path','lodash','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','name','send','map','Network','rawAttributes','fieldName'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x0d59,0xdc));var _0x90d5=function(_0x53a7af,_0x1408a5){_0x53a7af=_0x53a7af-0x0;var _0x3cc7f6=_0x0d59[_0x53a7af];return _0x3cc7f6;};'use strict';var util=require('util');var path=require(_0x90d5('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x90d5('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x90d5('0x2'))(_0x90d5('0x3'));var config=require(_0x90d5('0x4'));var db=require(_0x90d5('0x5'))['db'];var jayson=require(_0x90d5('0x6'));var client=jayson['client'][_0x90d5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x25e925,_0x4b39b4,_0xaf8ee2,_0x495375){return new Promise(function(_0x1ba8fb,_0x9eed81){var _0x13e2c3=_0x495375||client;return _0x13e2c3[_0x90d5('0x8')](_0x25e925,_0xaf8ee2)[_0x90d5('0x9')](function(_0x26c563){logger[_0x90d5('0xa')]('Network,\x20%s,\x20%s',_0x4b39b4,_0x90d5('0xb'));logger['debug'](_0x90d5('0xc'),_0x4b39b4,'request\x20sent',JSON[_0x90d5('0xd')](_0x26c563));if(_0x26c563[_0x90d5('0xe')]){if(_0x26c563[_0x90d5('0xe')][_0x90d5('0xf')]===0x1f4){logger[_0x90d5('0xe')](_0x90d5('0x10'),_0x4b39b4,_0x26c563[_0x90d5('0xe')][_0x90d5('0x11')]);return _0x9eed81(_0x26c563[_0x90d5('0xe')][_0x90d5('0x11')]);}logger[_0x90d5('0xe')]('Network,\x20%s,\x20%s',_0x4b39b4,_0x26c563[_0x90d5('0xe')][_0x90d5('0x11')]);return _0x1ba8fb(_0x26c563[_0x90d5('0xe')][_0x90d5('0x11')]);}else{logger[_0x90d5('0xa')](_0x90d5('0x10'),_0x4b39b4,_0x90d5('0xb'));_0x1ba8fb(_0x26c563[_0x90d5('0x12')][_0x90d5('0x11')]);}})[_0x90d5('0x13')](function(_0x200827){logger[_0x90d5('0xe')](_0x90d5('0x10'),_0x4b39b4,_0x200827);_0x9eed81(_0x200827);});});}function respondWithResult(_0x1107d9,_0x274b21){_0x274b21=_0x274b21||0xc8;return function(_0x16e243){if(_0x16e243){return _0x1107d9[_0x90d5('0x14')](_0x274b21)[_0x90d5('0x15')](_0x16e243);}};}function respondWithFilteredResult(_0x5c2ce8,_0xf49a8d){return function(_0x5e0bf5){if(_0x5e0bf5){var _0x1c1717=typeof _0xf49a8d[_0x90d5('0x16')]===_0x90d5('0x17')&&typeof _0xf49a8d[_0x90d5('0x18')]===_0x90d5('0x17');var _0x3cf42e=_0x5e0bf5[_0x90d5('0x19')];var _0x21097f=_0x1c1717?0x0:_0xf49a8d[_0x90d5('0x16')];var _0xdf0483=_0x1c1717?_0x5e0bf5[_0x90d5('0x19')]:_0xf49a8d[_0x90d5('0x16')]+_0xf49a8d[_0x90d5('0x18')];var _0x1eec8f;if(_0xdf0483>=_0x3cf42e){_0xdf0483=_0x3cf42e;_0x1eec8f=0xc8;}else{_0x1eec8f=0xce;}_0x5c2ce8[_0x90d5('0x14')](_0x1eec8f);return _0x5c2ce8[_0x90d5('0x1a')]('Content-Range',_0x21097f+'-'+_0xdf0483+'/'+_0x3cf42e)[_0x90d5('0x15')](_0x5e0bf5);}return null;};}function saveUpdates(_0x47ddae){return function(_0x5b8123){if(_0x5b8123){return _0x5b8123[_0x90d5('0x1b')](_0x47ddae)[_0x90d5('0x9')](function(_0x676b46){return _0x676b46;});}return null;};}function removeEntity(_0x556e16){return function(_0x3c1599){if(_0x3c1599){return _0x3c1599[_0x90d5('0x1c')]()[_0x90d5('0x9')](function(){_0x556e16[_0x90d5('0x14')](0xcc)[_0x90d5('0x1d')]();});}};}function handleEntityNotFound(_0x29f08a){return function(_0x4ab6fc){if(!_0x4ab6fc){_0x29f08a[_0x90d5('0x1e')](0x194);}return _0x4ab6fc;};}function handleError(_0x486dca,_0x5214eb){_0x5214eb=_0x5214eb||0x1f4;return function(_0x27c22a){logger[_0x90d5('0xe')](_0x27c22a[_0x90d5('0x1f')]);if(_0x27c22a[_0x90d5('0x20')]){delete _0x27c22a[_0x90d5('0x20')];}_0x486dca[_0x90d5('0x14')](_0x5214eb)[_0x90d5('0x21')](_0x27c22a);};}exports['index']=function(_0x13ca13,_0x3c2432){var _0x29d8b1={},_0x4bad02={},_0x169dd3={'count':0x0,'rows':[]};var _0x5e05a7=_[_0x90d5('0x22')](db[_0x90d5('0x23')][_0x90d5('0x24')],function(_0x181d4c){return{'name':_0x181d4c[_0x90d5('0x25')],'type':_0x181d4c[_0x90d5('0x26')]['key']};});_0x4bad02[_0x90d5('0x27')]=_[_0x90d5('0x22')](_0x5e05a7,_0x90d5('0x20'));_0x4bad02['query']=_[_0x90d5('0x28')](_0x13ca13[_0x90d5('0x29')]);_0x4bad02[_0x90d5('0x2a')]=_[_0x90d5('0x2b')](_0x4bad02[_0x90d5('0x27')],_0x4bad02[_0x90d5('0x29')]);_0x29d8b1['attributes']=_['intersection'](_0x4bad02[_0x90d5('0x27')],qs[_0x90d5('0x2c')](_0x13ca13[_0x90d5('0x29')][_0x90d5('0x2c')]));_0x29d8b1[_0x90d5('0x2d')]=_0x29d8b1['attributes'][_0x90d5('0x2e')]?_0x29d8b1[_0x90d5('0x2d')]:_0x4bad02[_0x90d5('0x27')];if(!_0x13ca13['query'][_0x90d5('0x2f')](_0x90d5('0x30'))){_0x29d8b1[_0x90d5('0x18')]=qs[_0x90d5('0x18')](_0x13ca13[_0x90d5('0x29')][_0x90d5('0x18')]);_0x29d8b1[_0x90d5('0x16')]=qs['offset'](_0x13ca13[_0x90d5('0x29')][_0x90d5('0x16')]);}_0x29d8b1[_0x90d5('0x31')]=qs['sort'](_0x13ca13[_0x90d5('0x29')][_0x90d5('0x32')]);_0x29d8b1[_0x90d5('0x33')]=qs[_0x90d5('0x2a')](_[_0x90d5('0x34')](_0x13ca13['query'],_0x4bad02[_0x90d5('0x2a')]),_0x5e05a7);if(_0x13ca13['query']['filter']){_0x29d8b1[_0x90d5('0x33')]=_[_0x90d5('0x35')](_0x29d8b1['where'],{'$or':_[_0x90d5('0x22')](_0x5e05a7,function(_0x218102){if(_0x218102[_0x90d5('0x26')]!==_0x90d5('0x36')){var _0x3c91bc={};_0x3c91bc[_0x218102[_0x90d5('0x20')]]={'$like':'%'+_0x13ca13[_0x90d5('0x29')][_0x90d5('0x37')]+'%'};return _0x3c91bc;}})});}_0x29d8b1=_['merge']({},_0x29d8b1,_0x13ca13[_0x90d5('0x38')]);var _0x2163be={'where':_0x29d8b1['where']};return db[_0x90d5('0x23')][_0x90d5('0x19')](_0x2163be)[_0x90d5('0x9')](function(_0x4e2774){_0x169dd3[_0x90d5('0x19')]=_0x4e2774;if(_0x13ca13[_0x90d5('0x29')][_0x90d5('0x39')]){_0x29d8b1[_0x90d5('0x3a')]=[{'all':!![]}];}return db[_0x90d5('0x23')][_0x90d5('0x3b')](_0x29d8b1);})[_0x90d5('0x9')](function(_0x58aa8a){_0x169dd3[_0x90d5('0x3c')]=_0x58aa8a;return _0x169dd3;})[_0x90d5('0x9')](respondWithFilteredResult(_0x3c2432,_0x29d8b1))[_0x90d5('0x13')](handleError(_0x3c2432,null));};exports[_0x90d5('0x3d')]=function(_0x474175,_0x2dc318){var _0x540ce6={'raw':!![],'where':{'id':_0x474175[_0x90d5('0x3e')]['id']}},_0x3be2a9={};_0x3be2a9['model']=_[_0x90d5('0x28')](db['Network'][_0x90d5('0x24')]);_0x3be2a9[_0x90d5('0x29')]=_['keys'](_0x474175[_0x90d5('0x29')]);_0x3be2a9[_0x90d5('0x2a')]=_[_0x90d5('0x2b')](_0x3be2a9[_0x90d5('0x27')],_0x3be2a9[_0x90d5('0x29')]);_0x540ce6['attributes']=_['intersection'](_0x3be2a9[_0x90d5('0x27')],qs[_0x90d5('0x2c')](_0x474175[_0x90d5('0x29')][_0x90d5('0x2c')]));_0x540ce6['attributes']=_0x540ce6[_0x90d5('0x2d')][_0x90d5('0x2e')]?_0x540ce6[_0x90d5('0x2d')]:_0x3be2a9[_0x90d5('0x27')];if(_0x474175[_0x90d5('0x29')][_0x90d5('0x39')]){_0x540ce6[_0x90d5('0x3a')]=[{'all':!![]}];}_0x540ce6=_['merge']({},_0x540ce6,_0x474175[_0x90d5('0x38')]);return db[_0x90d5('0x23')][_0x90d5('0x3f')](_0x540ce6)['then'](handleEntityNotFound(_0x2dc318,null))[_0x90d5('0x9')](respondWithResult(_0x2dc318,null))['catch'](handleError(_0x2dc318,null));};exports[_0x90d5('0x40')]=function(_0x554e9f,_0x5e9c26){var _0x1c541a;return db[_0x90d5('0x23')][_0x90d5('0x40')](_0x554e9f[_0x90d5('0x41')],{'raw':!![]})[_0x90d5('0x9')](function(_0x3c7f0d){_0x1c541a=_0x3c7f0d;return db[_0x90d5('0x23')]['findAll']({'where':{'type':_0x554e9f['body'][_0x90d5('0x26')]},'raw':!![]});})[_0x90d5('0x9')](function(_0xf7d77a){if(_0x1c541a['type'][_0x90d5('0x42')]()=='STUN'){var _0x50ba91=fs['readFileSync'](path['join'](config[_0x90d5('0x43')],_0x90d5('0x44')),_0x90d5('0x45'));var _0x20ca73=ejs['render'](_0x50ba91,{'networks':_0xf7d77a||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x20ca73);return respondWithRpcPromise(_0x90d5('0x46'),'create',{'module':'res_stun_monitor.so'});}else if(_0x1c541a[_0x90d5('0x26')][_0x90d5('0x42')]()=='TURN'){var _0x44d1c1=fs['readFileSync'](path[_0x90d5('0x47')](config[_0x90d5('0x43')],_0x90d5('0x48')),_0x90d5('0x45'));var _0x2d9364=ejs['render'](_0x44d1c1,{'networks':_0xf7d77a||[]});fs['writeFileSync'](_0x90d5('0x49'),_0x2d9364);return respondWithRpcPromise(_0x90d5('0x46'),_0x90d5('0x40'),{'module':_0x90d5('0x4a')});}else{var _0x64b4ea=fs[_0x90d5('0x4b')](path[_0x90d5('0x47')](config['root'],_0x90d5('0x4c')),_0x90d5('0x45'));var _0x4cf2ec=ejs[_0x90d5('0x4d')](_0x64b4ea,{'networks':_0xf7d77a||[]});fs[_0x90d5('0x4e')](util['format'](_0x90d5('0x4f'),_0x554e9f['body'][_0x90d5('0x26')][_0x90d5('0x50')]()),_0x4cf2ec);return respondWithRpcPromise(_0x90d5('0x46'),'create',{'module':_0x90d5('0x51')});}})[_0x90d5('0x9')](function(){return _0x1c541a;})['then'](respondWithResult(_0x5e9c26,0xc9))[_0x90d5('0x13')](handleError(_0x5e9c26,null));};exports['update']=function(_0x50d2b5,_0x3e9e92){var _0x208a36;return db[_0x90d5('0x23')][_0x90d5('0x3f')]({'where':{'id':_0x50d2b5[_0x90d5('0x3e')]['id']}})[_0x90d5('0x9')](handleEntityNotFound(_0x3e9e92,null))['then'](saveUpdates(_0x50d2b5[_0x90d5('0x41')],null))[_0x90d5('0x9')](function(_0x175325){if(_0x175325){_0x208a36=_0x175325;return db[_0x90d5('0x23')][_0x90d5('0x3b')]({'where':{'type':_0x208a36[_0x90d5('0x26')]},'raw':!![]});}return null;})[_0x90d5('0x9')](function(_0x43686c){if(_0x208a36[_0x90d5('0x26')][_0x90d5('0x42')]()=='STUN'){var _0x34a2e8=fs['readFileSync'](path[_0x90d5('0x47')](config[_0x90d5('0x43')],_0x90d5('0x44')),_0x90d5('0x45'));var _0x1f4385=ejs['render'](_0x34a2e8,{'networks':_0x43686c||[]});fs[_0x90d5('0x4e')](_0x90d5('0x52'),_0x1f4385);return respondWithRpcPromise(_0x90d5('0x46'),'update',{'module':_0x90d5('0x4a')});}else if(_0x208a36[_0x90d5('0x26')][_0x90d5('0x42')]()==_0x90d5('0x53')){var _0x591adf=fs['readFileSync'](path[_0x90d5('0x47')](config[_0x90d5('0x43')],_0x90d5('0x48')),_0x90d5('0x45'));var _0x2a11e9=ejs[_0x90d5('0x4d')](_0x591adf,{'networks':_0x43686c||[]});fs['writeFileSync'](_0x90d5('0x49'),_0x2a11e9);return respondWithRpcPromise('Reload',_0x90d5('0x1b'),{'module':_0x90d5('0x4a')});}else{var _0x3788af=fs[_0x90d5('0x4b')](path[_0x90d5('0x47')](config[_0x90d5('0x43')],'server/files/templates/network.ejs'),_0x90d5('0x45'));var _0x25b071=ejs[_0x90d5('0x4d')](_0x3788af,{'networks':_0x43686c||[]});fs[_0x90d5('0x4e')](util[_0x90d5('0x54')](_0x90d5('0x4f'),_0x50d2b5[_0x90d5('0x41')][_0x90d5('0x26')][_0x90d5('0x50')]()),_0x25b071);return respondWithRpcPromise(_0x90d5('0x46'),_0x90d5('0x1b'),{'module':_0x90d5('0x51')});}})[_0x90d5('0x9')](function(_0x2de0bb){if(_0x2de0bb){return _0x208a36;}return null;})[_0x90d5('0x9')](respondWithResult(_0x3e9e92,null))[_0x90d5('0x13')](handleError(_0x3e9e92,null));};exports['destroy']=function(_0x466865,_0x1fc1c6){var _0x14a17d;return db[_0x90d5('0x23')][_0x90d5('0x3f')]({'where':{'id':_0x466865['params']['id']}})[_0x90d5('0x9')](function(_0x2f7307){_0x14a17d=_0x2f7307;return _0x2f7307;})['then'](handleEntityNotFound(_0x1fc1c6,null))[_0x90d5('0x9')](removeEntity(_0x1fc1c6,null))[_0x90d5('0x9')](function(){if(_0x14a17d){return db[_0x90d5('0x23')][_0x90d5('0x3b')]({'where':{'type':_0x14a17d[_0x90d5('0x26')]},'raw':!![]});}})[_0x90d5('0x9')](function(_0x93f085){if(_0x14a17d[_0x90d5('0x26')][_0x90d5('0x42')]()==_0x90d5('0x55')){var _0x1abf46=fs['readFileSync'](path[_0x90d5('0x47')](config[_0x90d5('0x43')],_0x90d5('0x44')),_0x90d5('0x45'));var _0x3abf44=ejs[_0x90d5('0x4d')](_0x1abf46,{'networks':_0x93f085||[]});fs[_0x90d5('0x4e')](_0x90d5('0x52'),_0x3abf44);return respondWithRpcPromise(_0x90d5('0x46'),_0x90d5('0x1c'),{'module':_0x90d5('0x4a')});}else if(_0x14a17d[_0x90d5('0x26')][_0x90d5('0x42')]()==_0x90d5('0x53')){var _0x3ab395=fs[_0x90d5('0x4b')](path[_0x90d5('0x47')](config[_0x90d5('0x43')],_0x90d5('0x48')),_0x90d5('0x45'));var _0x53d9aa=ejs[_0x90d5('0x4d')](_0x3ab395,{'networks':_0x93f085||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x53d9aa);return respondWithRpcPromise(_0x90d5('0x46'),_0x90d5('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x36297c=fs['readFileSync'](path['join'](config[_0x90d5('0x43')],_0x90d5('0x4c')),'utf8');var _0x48fb84=ejs[_0x90d5('0x4d')](_0x36297c,{'networks':_0x93f085||[]});fs['writeFileSync'](util[_0x90d5('0x54')](_0x90d5('0x4f'),_0x14a17d[_0x90d5('0x26')]['toLowerCase']()),_0x48fb84);return respondWithRpcPromise(_0x90d5('0x46'),'destroy',{'module':_0x90d5('0x51')});}})[_0x90d5('0x13')](handleError(_0x1fc1c6,null));}; \ No newline at end of file +var _0x0a58=['api','../../config/environment','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','offset','undefined','limit','count','Content-Range','update','destroy','then','end','sendStatus','stack','status','index','map','Network','rawAttributes','fieldName','key','name','query','filters','intersection','model','attributes','fields','length','order','sort','where','filter','type','VIRTUAL','merge','includeAll','findAll','rows','params','keys','include','find','create','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','toLowerCase','chan_sip.so','TURN','server/files/templates/network.ejs','format','STUN','util','path','ejs'];(function(_0x551b7a,_0x49d738){var _0x1180ef=function(_0x20e80d){while(--_0x20e80d){_0x551b7a['push'](_0x551b7a['shift']());}};_0x1180ef(++_0x49d738);}(_0x0a58,0x192));var _0x80a5=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0a58[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0x80a5('0x0'));var path=require(_0x80a5('0x1'));var ejs=require(_0x80a5('0x2'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x80a5('0x3'));var config=require(_0x80a5('0x4'));var db=require('../../mysqldb')['db'];var jayson=require(_0x80a5('0x5'));var client=jayson[_0x80a5('0x6')][_0x80a5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x100a5d,_0x257a6a,_0xee29d8,_0x2ff219){return new Promise(function(_0x12393f,_0x3d61b4){var _0x31c2dc=_0x2ff219||client;return _0x31c2dc[_0x80a5('0x8')](_0x100a5d,_0xee29d8)['then'](function(_0x20236d){logger[_0x80a5('0x9')](_0x80a5('0xa'),_0x257a6a,_0x80a5('0xb'));logger[_0x80a5('0xc')](_0x80a5('0xd'),_0x257a6a,_0x80a5('0xb'),JSON['stringify'](_0x20236d));if(_0x20236d[_0x80a5('0xe')]){if(_0x20236d['error'][_0x80a5('0xf')]===0x1f4){logger['error'](_0x80a5('0xa'),_0x257a6a,_0x20236d['error'][_0x80a5('0x10')]);return _0x3d61b4(_0x20236d[_0x80a5('0xe')][_0x80a5('0x10')]);}logger[_0x80a5('0xe')](_0x80a5('0xa'),_0x257a6a,_0x20236d[_0x80a5('0xe')]['message']);return _0x12393f(_0x20236d[_0x80a5('0xe')][_0x80a5('0x10')]);}else{logger[_0x80a5('0x9')]('Network,\x20%s,\x20%s',_0x257a6a,_0x80a5('0xb'));_0x12393f(_0x20236d[_0x80a5('0x11')][_0x80a5('0x10')]);}})[_0x80a5('0x12')](function(_0x1a6d39){logger[_0x80a5('0xe')](_0x80a5('0xa'),_0x257a6a,_0x1a6d39);_0x3d61b4(_0x1a6d39);});});}function respondWithResult(_0x1efd8a,_0x34c109){_0x34c109=_0x34c109||0xc8;return function(_0x333e6f){if(_0x333e6f){return _0x1efd8a['status'](_0x34c109)[_0x80a5('0x13')](_0x333e6f);}};}function respondWithFilteredResult(_0x170569,_0x549136){return function(_0x5cf1e5){if(_0x5cf1e5){var _0x73152f=typeof _0x549136[_0x80a5('0x14')]===_0x80a5('0x15')&&typeof _0x549136[_0x80a5('0x16')]==='undefined';var _0x163b88=_0x5cf1e5[_0x80a5('0x17')];var _0x5e3852=_0x73152f?0x0:_0x549136[_0x80a5('0x14')];var _0x5bae02=_0x73152f?_0x5cf1e5['count']:_0x549136[_0x80a5('0x14')]+_0x549136[_0x80a5('0x16')];var _0x4beb35;if(_0x5bae02>=_0x163b88){_0x5bae02=_0x163b88;_0x4beb35=0xc8;}else{_0x4beb35=0xce;}_0x170569['status'](_0x4beb35);return _0x170569['set'](_0x80a5('0x18'),_0x5e3852+'-'+_0x5bae02+'/'+_0x163b88)[_0x80a5('0x13')](_0x5cf1e5);}return null;};}function saveUpdates(_0x3a5178){return function(_0xdf0e25){if(_0xdf0e25){return _0xdf0e25[_0x80a5('0x19')](_0x3a5178)['then'](function(_0x50a774){return _0x50a774;});}return null;};}function removeEntity(_0x37a53c){return function(_0x4f4ccc){if(_0x4f4ccc){return _0x4f4ccc[_0x80a5('0x1a')]()[_0x80a5('0x1b')](function(){_0x37a53c['status'](0xcc)[_0x80a5('0x1c')]();});}};}function handleEntityNotFound(_0x48ae4a){return function(_0x16b4d4){if(!_0x16b4d4){_0x48ae4a[_0x80a5('0x1d')](0x194);}return _0x16b4d4;};}function handleError(_0x4d5569,_0x41d402){_0x41d402=_0x41d402||0x1f4;return function(_0x294b44){logger[_0x80a5('0xe')](_0x294b44[_0x80a5('0x1e')]);if(_0x294b44['name']){delete _0x294b44['name'];}_0x4d5569[_0x80a5('0x1f')](_0x41d402)['send'](_0x294b44);};}exports[_0x80a5('0x20')]=function(_0x2cb680,_0x7e456f){var _0x3185d1={},_0x2a7167={},_0x247f61={'count':0x0,'rows':[]};var _0x2a1507=_[_0x80a5('0x21')](db[_0x80a5('0x22')][_0x80a5('0x23')],function(_0x40f0f6){return{'name':_0x40f0f6[_0x80a5('0x24')],'type':_0x40f0f6['type'][_0x80a5('0x25')]};});_0x2a7167['model']=_[_0x80a5('0x21')](_0x2a1507,_0x80a5('0x26'));_0x2a7167[_0x80a5('0x27')]=_['keys'](_0x2cb680[_0x80a5('0x27')]);_0x2a7167[_0x80a5('0x28')]=_[_0x80a5('0x29')](_0x2a7167[_0x80a5('0x2a')],_0x2a7167['query']);_0x3185d1[_0x80a5('0x2b')]=_[_0x80a5('0x29')](_0x2a7167[_0x80a5('0x2a')],qs[_0x80a5('0x2c')](_0x2cb680['query'][_0x80a5('0x2c')]));_0x3185d1['attributes']=_0x3185d1['attributes'][_0x80a5('0x2d')]?_0x3185d1[_0x80a5('0x2b')]:_0x2a7167[_0x80a5('0x2a')];if(!_0x2cb680['query']['hasOwnProperty']('nolimit')){_0x3185d1['limit']=qs[_0x80a5('0x16')](_0x2cb680[_0x80a5('0x27')][_0x80a5('0x16')]);_0x3185d1[_0x80a5('0x14')]=qs[_0x80a5('0x14')](_0x2cb680[_0x80a5('0x27')][_0x80a5('0x14')]);}_0x3185d1[_0x80a5('0x2e')]=qs[_0x80a5('0x2f')](_0x2cb680[_0x80a5('0x27')][_0x80a5('0x2f')]);_0x3185d1[_0x80a5('0x30')]=qs['filters'](_['pick'](_0x2cb680[_0x80a5('0x27')],_0x2a7167[_0x80a5('0x28')]),_0x2a1507);if(_0x2cb680[_0x80a5('0x27')][_0x80a5('0x31')]){_0x3185d1['where']=_['merge'](_0x3185d1[_0x80a5('0x30')],{'$or':_[_0x80a5('0x21')](_0x2a1507,function(_0x2eb6d6){if(_0x2eb6d6[_0x80a5('0x32')]!==_0x80a5('0x33')){var _0x507c48={};_0x507c48[_0x2eb6d6['name']]={'$like':'%'+_0x2cb680[_0x80a5('0x27')]['filter']+'%'};return _0x507c48;}})});}_0x3185d1=_[_0x80a5('0x34')]({},_0x3185d1,_0x2cb680['options']);var _0x2f2d2f={'where':_0x3185d1[_0x80a5('0x30')]};return db[_0x80a5('0x22')][_0x80a5('0x17')](_0x2f2d2f)[_0x80a5('0x1b')](function(_0x44ce77){_0x247f61[_0x80a5('0x17')]=_0x44ce77;if(_0x2cb680[_0x80a5('0x27')][_0x80a5('0x35')]){_0x3185d1['include']=[{'all':!![]}];}return db[_0x80a5('0x22')][_0x80a5('0x36')](_0x3185d1);})[_0x80a5('0x1b')](function(_0x5948fc){_0x247f61[_0x80a5('0x37')]=_0x5948fc;return _0x247f61;})[_0x80a5('0x1b')](respondWithFilteredResult(_0x7e456f,_0x3185d1))[_0x80a5('0x12')](handleError(_0x7e456f,null));};exports['show']=function(_0x49dbdf,_0x510169){var _0x55a9c1={'raw':!![],'where':{'id':_0x49dbdf[_0x80a5('0x38')]['id']}},_0x2f64e2={};_0x2f64e2['model']=_[_0x80a5('0x39')](db['Network'][_0x80a5('0x23')]);_0x2f64e2['query']=_[_0x80a5('0x39')](_0x49dbdf['query']);_0x2f64e2[_0x80a5('0x28')]=_[_0x80a5('0x29')](_0x2f64e2['model'],_0x2f64e2[_0x80a5('0x27')]);_0x55a9c1['attributes']=_['intersection'](_0x2f64e2[_0x80a5('0x2a')],qs[_0x80a5('0x2c')](_0x49dbdf[_0x80a5('0x27')][_0x80a5('0x2c')]));_0x55a9c1[_0x80a5('0x2b')]=_0x55a9c1[_0x80a5('0x2b')][_0x80a5('0x2d')]?_0x55a9c1[_0x80a5('0x2b')]:_0x2f64e2[_0x80a5('0x2a')];if(_0x49dbdf[_0x80a5('0x27')]['includeAll']){_0x55a9c1[_0x80a5('0x3a')]=[{'all':!![]}];}_0x55a9c1=_[_0x80a5('0x34')]({},_0x55a9c1,_0x49dbdf['options']);return db['Network'][_0x80a5('0x3b')](_0x55a9c1)[_0x80a5('0x1b')](handleEntityNotFound(_0x510169,null))[_0x80a5('0x1b')](respondWithResult(_0x510169,null))[_0x80a5('0x12')](handleError(_0x510169,null));};exports[_0x80a5('0x3c')]=function(_0x3481f6,_0x1d314d){var _0x26221c;return db[_0x80a5('0x22')]['create'](_0x3481f6[_0x80a5('0x3d')],{'raw':!![]})[_0x80a5('0x1b')](function(_0x1d527b){_0x26221c=_0x1d527b;return db[_0x80a5('0x22')]['findAll']({'where':{'type':_0x3481f6['body'][_0x80a5('0x32')]},'raw':!![]});})[_0x80a5('0x1b')](function(_0x5beb2f){if(_0x26221c[_0x80a5('0x32')][_0x80a5('0x3e')]()=='STUN'){var _0x454b95=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x42')),_0x80a5('0x43'));var _0x1843d=ejs['render'](_0x454b95,{'networks':_0x5beb2f||[]});fs[_0x80a5('0x44')](_0x80a5('0x45'),_0x1843d);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x3c'),{'module':_0x80a5('0x47')});}else if(_0x26221c[_0x80a5('0x32')][_0x80a5('0x3e')]()=='TURN'){var _0x4e9c95=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x48')),_0x80a5('0x43'));var _0x4a36a2=ejs[_0x80a5('0x49')](_0x4e9c95,{'networks':_0x5beb2f||[]});fs[_0x80a5('0x44')](_0x80a5('0x4a'),_0x4a36a2);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x3c'),{'module':_0x80a5('0x47')});}else{var _0x58a967=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],'server/files/templates/network.ejs'),_0x80a5('0x43'));var _0x3ffd84=ejs[_0x80a5('0x49')](_0x58a967,{'networks':_0x5beb2f||[]});fs[_0x80a5('0x44')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x3481f6[_0x80a5('0x3d')][_0x80a5('0x32')][_0x80a5('0x4b')]()),_0x3ffd84);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x3c'),{'module':_0x80a5('0x4c')});}})['then'](function(){return _0x26221c;})[_0x80a5('0x1b')](respondWithResult(_0x1d314d,0xc9))[_0x80a5('0x12')](handleError(_0x1d314d,null));};exports[_0x80a5('0x19')]=function(_0x51428c,_0xfbeff4){var _0x3beae2;return db[_0x80a5('0x22')][_0x80a5('0x3b')]({'where':{'id':_0x51428c[_0x80a5('0x38')]['id']}})['then'](handleEntityNotFound(_0xfbeff4,null))[_0x80a5('0x1b')](saveUpdates(_0x51428c['body'],null))['then'](function(_0x47ae3c){if(_0x47ae3c){_0x3beae2=_0x47ae3c;return db[_0x80a5('0x22')]['findAll']({'where':{'type':_0x3beae2[_0x80a5('0x32')]},'raw':!![]});}return null;})[_0x80a5('0x1b')](function(_0x19c725){if(_0x3beae2[_0x80a5('0x32')][_0x80a5('0x3e')]()=='STUN'){var _0x5df61c=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x42')),'utf8');var _0x52a88f=ejs[_0x80a5('0x49')](_0x5df61c,{'networks':_0x19c725||[]});fs[_0x80a5('0x44')](_0x80a5('0x45'),_0x52a88f);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x19'),{'module':'res_stun_monitor.so'});}else if(_0x3beae2[_0x80a5('0x32')][_0x80a5('0x3e')]()==_0x80a5('0x4d')){var _0x32501b=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config['root'],_0x80a5('0x48')),'utf8');var _0x2f7286=ejs[_0x80a5('0x49')](_0x32501b,{'networks':_0x19c725||[]});fs[_0x80a5('0x44')](_0x80a5('0x4a'),_0x2f7286);return respondWithRpcPromise('Reload',_0x80a5('0x19'),{'module':_0x80a5('0x47')});}else{var _0x1af86d=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x4e')),_0x80a5('0x43'));var _0x4524cf=ejs['render'](_0x1af86d,{'networks':_0x19c725||[]});fs[_0x80a5('0x44')](util[_0x80a5('0x4f')]('/etc/asterisk/sip_xcally_%s.conf',_0x51428c['body'][_0x80a5('0x32')]['toLowerCase']()),_0x4524cf);return respondWithRpcPromise(_0x80a5('0x46'),'update',{'module':_0x80a5('0x4c')});}})[_0x80a5('0x1b')](function(_0x433623){if(_0x433623){return _0x3beae2;}return null;})[_0x80a5('0x1b')](respondWithResult(_0xfbeff4,null))[_0x80a5('0x12')](handleError(_0xfbeff4,null));};exports[_0x80a5('0x1a')]=function(_0xda5f21,_0x5b89f7){var _0x2319ba;return db[_0x80a5('0x22')][_0x80a5('0x3b')]({'where':{'id':_0xda5f21[_0x80a5('0x38')]['id']}})[_0x80a5('0x1b')](function(_0x4db2d9){_0x2319ba=_0x4db2d9;return _0x4db2d9;})[_0x80a5('0x1b')](handleEntityNotFound(_0x5b89f7,null))['then'](removeEntity(_0x5b89f7,null))['then'](function(){if(_0x2319ba){return db[_0x80a5('0x22')][_0x80a5('0x36')]({'where':{'type':_0x2319ba[_0x80a5('0x32')]},'raw':!![]});}})[_0x80a5('0x1b')](function(_0x4d047e){if(_0x2319ba[_0x80a5('0x32')][_0x80a5('0x3e')]()==_0x80a5('0x50')){var _0x56aaac=fs[_0x80a5('0x3f')](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x42')),_0x80a5('0x43'));var _0x537f22=ejs[_0x80a5('0x49')](_0x56aaac,{'networks':_0x4d047e||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x537f22);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x1a'),{'module':_0x80a5('0x47')});}else if(_0x2319ba[_0x80a5('0x32')]['toUpperCase']()==_0x80a5('0x4d')){var _0x7e4e5=fs[_0x80a5('0x3f')](path['join'](config[_0x80a5('0x41')],_0x80a5('0x48')),_0x80a5('0x43'));var _0xe58da8=ejs['render'](_0x7e4e5,{'networks':_0x4d047e||[]});fs[_0x80a5('0x44')](_0x80a5('0x4a'),_0xe58da8);return respondWithRpcPromise(_0x80a5('0x46'),_0x80a5('0x1a'),{'module':_0x80a5('0x47')});}else{var _0x2beb52=fs['readFileSync'](path[_0x80a5('0x40')](config[_0x80a5('0x41')],_0x80a5('0x4e')),_0x80a5('0x43'));var _0x1fbb12=ejs[_0x80a5('0x49')](_0x2beb52,{'networks':_0x4d047e||[]});fs[_0x80a5('0x44')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x2319ba[_0x80a5('0x32')][_0x80a5('0x4b')]()),_0x1fbb12);return respondWithRpcPromise('Reload',_0x80a5('0x1a'),{'module':_0x80a5('0x4c')});}})['catch'](handleError(_0x5b89f7,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index eb0ca1a..b7e5c6c 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 _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Network','network','../../config/logger','api'];(function(_0x286467,_0x59dd6a){var _0x19a6b1=function(_0x29e40e){while(--_0x29e40e){_0x286467['push'](_0x286467['shift']());}};_0x19a6b1(++_0x59dd6a);}(_0x1339,0x1ed));var _0x9133=function(_0x50229a,_0x20cb46){_0x50229a=_0x50229a-0x0;var _0x56599c=_0x1339[_0x50229a];return _0x56599c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./network.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9567=['lodash','util','../../config/logger','api','moment','path','rimraf','./network.attributes','define','Network'];(function(_0x3a2d96,_0x5d2628){var _0x1420f1=function(_0x40a988){while(--_0x40a988){_0x3a2d96['push'](_0x3a2d96['shift']());}};_0x1420f1(++_0x5d2628);}(_0x9567,0xdc));var _0x7956=function(_0x1f91e6,_0x1d7aa8){_0x1f91e6=_0x1f91e6-0x0;var _0x5e6030=_0x9567[_0x1f91e6];return _0x5e6030;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var logger=require(_0x7956('0x2'))(_0x7956('0x3'));var moment=require(_0x7956('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7956('0x5'));var rimraf=require(_0x7956('0x6'));var config=require('../../config/environment');var attributes=require(_0x7956('0x7'));module['exports']=function(_0x12c09e,_0x48c4b6){return _0x12c09e[_0x7956('0x8')](_0x7956('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 808974f..2e8e67c 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(_0x152748,_0x32a79f){var _0x2f825c=function(_0x567be1){while(--_0x567be1){_0x152748['push'](_0x152748['shift']());}};_0x2f825c(++_0x32a79f);}(_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 _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x34323a,_0x4d2f37){_0x34323a=_0x34323a-0x0;var _0xe34579=_0x7a54[_0x34323a];return _0xe34579;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index ed51328..30a6ed5 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 _0xbd92=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','isAuthenticated','describe','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','getInteractions','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports'];(function(_0x34ce1a,_0x331198){var _0x654759=function(_0x5771d4){while(--_0x5771d4){_0x34ce1a['push'](_0x34ce1a['shift']());}};_0x654759(++_0x331198);}(_0xbd92,0x1ec));var _0x2bd9=function(_0x13eca4,_0x1f693b){_0x13eca4=_0x13eca4-0x0;var _0x5bd965=_0xbd92[_0x13eca4];return _0x5bd965;};'use strict';var multer=require(_0x2bd9('0x0'));var util=require(_0x2bd9('0x1'));var path=require(_0x2bd9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2bd9('0x3')]();var fs_extra=require(_0x2bd9('0x4'));var auth=require(_0x2bd9('0x5'));var interaction=require(_0x2bd9('0x6'));var config=require(_0x2bd9('0x7'));var controller=require(_0x2bd9('0x8'));router[_0x2bd9('0x9')]('/',auth['isAuthenticated'](),controller[_0x2bd9('0xa')]);router[_0x2bd9('0x9')]('/describe',auth[_0x2bd9('0xb')](),controller[_0x2bd9('0xc')]);router[_0x2bd9('0x9')]('/:id',auth[_0x2bd9('0xb')](),controller[_0x2bd9('0xd')]);router[_0x2bd9('0x9')]('/:id/dispositions',auth[_0x2bd9('0xb')](),controller[_0x2bd9('0xe')]);router['get'](_0x2bd9('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x2bd9('0x9')](_0x2bd9('0x10'),auth['isAuthenticated'](),controller[_0x2bd9('0x11')]);router[_0x2bd9('0x9')]('/:id/interactions',auth[_0x2bd9('0xb')](),controller[_0x2bd9('0x12')]);router[_0x2bd9('0x9')]('/:id/users',auth[_0x2bd9('0xb')](),controller[_0x2bd9('0x13')]);router[_0x2bd9('0x14')]('/',auth[_0x2bd9('0xb')](),controller[_0x2bd9('0x15')]);router['post'](_0x2bd9('0x16'),auth[_0x2bd9('0xb')](),controller[_0x2bd9('0x17')]);router[_0x2bd9('0x14')](_0x2bd9('0xf'),auth[_0x2bd9('0xb')](),controller[_0x2bd9('0x18')]);router[_0x2bd9('0x14')](_0x2bd9('0x19'),controller[_0x2bd9('0x1a')]);router[_0x2bd9('0x14')](_0x2bd9('0x10'),auth[_0x2bd9('0xb')](),controller[_0x2bd9('0x1b')]);router['post'](_0x2bd9('0x1c'),auth[_0x2bd9('0xb')](),controller[_0x2bd9('0x1d')]);router['post'](_0x2bd9('0x1e'),auth['isAuthenticated'](),controller[_0x2bd9('0x1f')]);router[_0x2bd9('0x20')](_0x2bd9('0x21'),auth['isAuthenticated'](),controller[_0x2bd9('0x22')]);router['delete'](_0x2bd9('0x21'),auth[_0x2bd9('0xb')](),controller[_0x2bd9('0x23')]);router[_0x2bd9('0x24')](_0x2bd9('0x16'),auth[_0x2bd9('0xb')](),controller[_0x2bd9('0x25')]);router['delete'](_0x2bd9('0xf'),auth[_0x2bd9('0xb')](),controller[_0x2bd9('0x26')]);router[_0x2bd9('0x24')](_0x2bd9('0x1c'),auth[_0x2bd9('0xb')](),controller[_0x2bd9('0x27')]);module[_0x2bd9('0x28')]=router; \ No newline at end of file +var _0xbd79=['/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','addApplications','addAgents','/:id/send','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications'];(function(_0x2df4cc,_0x1233c6){var _0x40af8d=function(_0x5e0f2a){while(--_0x5e0f2a){_0x2df4cc['push'](_0x2df4cc['shift']());}};_0x40af8d(++_0x1233c6);}(_0xbd79,0x81));var _0x9bd7=function(_0x1282a0,_0x58b2f9){_0x1282a0=_0x1282a0-0x0;var _0x18af0c=_0xbd79[_0x1282a0];return _0x18af0c;};'use strict';var multer=require('multer');var util=require(_0x9bd7('0x0'));var path=require(_0x9bd7('0x1'));var timeout=require(_0x9bd7('0x2'));var express=require(_0x9bd7('0x3'));var router=express[_0x9bd7('0x4')]();var fs_extra=require(_0x9bd7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9bd7('0x6'));var controller=require(_0x9bd7('0x7'));router[_0x9bd7('0x8')]('/',auth['isAuthenticated'](),controller[_0x9bd7('0x9')]);router[_0x9bd7('0x8')](_0x9bd7('0xa'),auth[_0x9bd7('0xb')](),controller['describe']);router['get'](_0x9bd7('0xc'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0xd')]);router[_0x9bd7('0x8')](_0x9bd7('0xe'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x9bd7('0x8')](_0x9bd7('0xf'),auth['isAuthenticated'](),controller[_0x9bd7('0x10')]);router['get'](_0x9bd7('0x11'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x12')]);router['get'](_0x9bd7('0x13'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x14')]);router['get'](_0x9bd7('0x15'),auth['isAuthenticated'](),controller[_0x9bd7('0x16')]);router[_0x9bd7('0x17')]('/',auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x18')]);router[_0x9bd7('0x17')](_0x9bd7('0xe'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x19')]);router[_0x9bd7('0x17')](_0x9bd7('0xf'),auth['isAuthenticated'](),controller[_0x9bd7('0x1a')]);router[_0x9bd7('0x17')]('/:id/notify',controller['notify']);router[_0x9bd7('0x17')](_0x9bd7('0x11'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x1b')]);router[_0x9bd7('0x17')]('/:id/users',auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x1c')]);router[_0x9bd7('0x17')](_0x9bd7('0x1d'),auth[_0x9bd7('0xb')](),controller['send']);router[_0x9bd7('0x1e')]('/:id',auth[_0x9bd7('0xb')](),controller['update']);router['delete'](_0x9bd7('0xc'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x1f')]);router[_0x9bd7('0x20')](_0x9bd7('0xe'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x21')]);router[_0x9bd7('0x20')]('/:id/canned_answers',auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x22')]);router[_0x9bd7('0x20')](_0x9bd7('0x15'),auth[_0x9bd7('0xb')](),controller[_0x9bd7('0x23')]);module[_0x9bd7('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index c042fd2..3d38381 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 _0x0e86=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x74c6c6,_0x54d54e){var _0x56ba8b=function(_0x2c885f){while(--_0x2c885f){_0x74c6c6['push'](_0x74c6c6['shift']());}};_0x56ba8b(++_0x54d54e);}(_0x0e86,0x1ee));var _0x60e8=function(_0x22c169,_0x3298a6){_0x22c169=_0x22c169-0x0;var _0x30cc6f=_0x0e86[_0x22c169];return _0x30cc6f;};'use strict';var Sequelize=require(_0x60e8('0x0'));var rs=require(_0x60e8('0x1'));module[_0x60e8('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x60e8('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x60e8('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x60e8('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x60e8('0x5')],'defaultValue':function(){return _0x60e8('0x6');}},'notificationSound':{'type':Sequelize[_0x60e8('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x60e8('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x60e8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x60e8('0x3')]},'queueTransfer':{'type':Sequelize[_0x60e8('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x60e8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x60e8('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x60e8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x60e8('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x60e8('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x60e8('0x7')],'defaultValue':![],'comment':_0x60e8('0xa'),'set':function(_0x358c67){if(!_0x358c67)this[_0x60e8('0xb')](_0x60e8('0xc'),null);this[_0x60e8('0xb')](_0x60e8('0xd'),_0x358c67);}}}; \ No newline at end of file +var _0x72a9=['mandatoryDisposition','sequelize','randomstring','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'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x72a9,0x1cf));var _0x972a=function(_0x1b3c82,_0x4cf0ca){_0x1b3c82=_0x1b3c82-0x0;var _0x435a72=_0x72a9[_0x1b3c82];return _0x435a72;};'use strict';var Sequelize=require(_0x972a('0x0'));var rs=require(_0x972a('0x1'));module['exports']={'name':{'type':Sequelize[_0x972a('0x2')],'unique':_0x972a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x972a('0x2')]},'token':{'type':Sequelize[_0x972a('0x2')],'defaultValue':function(){return rs[_0x972a('0x4')]();}},'replyUri':{'type':Sequelize[_0x972a('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x972a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x972a('0x5')],'defaultValue':function(){return _0x972a('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x972a('0x2')]},'queueTransfer':{'type':Sequelize[_0x972a('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x972a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x972a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x972a('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x972a('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x972a('0x7')],'defaultValue':![],'comment':_0x972a('0xa'),'set':function(_0x3ef0b5){if(!_0x3ef0b5)this[_0x972a('0xb')](_0x972a('0xc'),null);this[_0x972a('0xb')](_0x972a('0xd'),_0x3ef0b5);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ebefe71..96ad3e4 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 _0x4322=['emit','getAgents','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','register','jayson/promise','http','client','request','then','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','include','findAll','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','OpenchannelApplication','account','Applications','list','applications','priority','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','OpenchannelMessage','AttachmentId','UserId','User','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray'];(function(_0x245d76,_0x1c2c6f){var _0x4516f7=function(_0x5e7c49){while(--_0x5e7c49){_0x245d76['push'](_0x245d76['shift']());}};_0x4516f7(++_0x1c2c6f);}(_0x4322,0x174));var _0x2432=function(_0x6ca1db,_0x569d05){_0x6ca1db=_0x6ca1db-0x0;var _0x5bcc1b=_0x4322[_0x6ca1db];return _0x5bcc1b;};'use strict';var emlformat=require(_0x2432('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2432('0x1'));var jsonpatch=require(_0x2432('0x2'));var rp=require(_0x2432('0x3'));var moment=require(_0x2432('0x4'));var BPromise=require(_0x2432('0x5'));var Mustache=require(_0x2432('0x6'));var util=require(_0x2432('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2432('0x8'));var fs=require('fs');var fs_extra=require(_0x2432('0x9'));var _=require('lodash');var squel=require(_0x2432('0xa'));var crypto=require(_0x2432('0xb'));var jsforce=require(_0x2432('0xc'));var deskjs=require(_0x2432('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2432('0xe'));var Redis=require('ioredis');var authService=require(_0x2432('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2432('0x10'));var hardwareService=require(_0x2432('0x11'));var logger=require(_0x2432('0x12'))(_0x2432('0x13'));var utils=require('../../config/utils');var config=require(_0x2432('0x14'));var licenseUtil=require(_0x2432('0x15'));var db=require('../../mysqldb')['db'];config[_0x2432('0x16')]=_[_0x2432('0x17')](config[_0x2432('0x16')],{'host':_0x2432('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2432('0x16')]));require('./openchannelAccount.socket')[_0x2432('0x19')](socket);var jayson=require(_0x2432('0x1a'));var client=jayson['client'][_0x2432('0x1b')]({'port':0x232c});var client9002=jayson[_0x2432('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ab8e2,_0x49fbd,_0x354665,_0x335191){return new BPromise(function(_0x372f84,_0x5e0ffc){var _0x1e65ea=_0x335191||client;return _0x1e65ea[_0x2432('0x1d')](_0x3ab8e2,_0x354665)[_0x2432('0x1e')](function(_0x3fade9){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x49fbd,_0x2432('0x1f'));logger['debug'](_0x2432('0x20'),_0x49fbd,_0x2432('0x1f'),JSON[_0x2432('0x21')](_0x3fade9));if(_0x3fade9['error']){if(_0x3fade9['error'][_0x2432('0x22')]===0x1f4){logger[_0x2432('0x23')](_0x2432('0x24'),_0x49fbd,_0x3fade9['error'][_0x2432('0x25')]);return _0x5e0ffc(_0x3fade9[_0x2432('0x23')][_0x2432('0x25')]);}logger[_0x2432('0x23')](_0x2432('0x24'),_0x49fbd,_0x3fade9[_0x2432('0x23')][_0x2432('0x25')]);return _0x372f84(_0x3fade9[_0x2432('0x23')][_0x2432('0x25')]);}else{logger[_0x2432('0x26')](_0x2432('0x24'),_0x49fbd,'request\x20sent');_0x372f84(_0x3fade9[_0x2432('0x27')][_0x2432('0x25')]);}})[_0x2432('0x28')](function(_0x573f53){logger[_0x2432('0x23')](_0x2432('0x24'),_0x49fbd,_0x573f53);_0x5e0ffc(_0x573f53);});});}function respondWithStatusCode(_0xd7102b,_0x483f88){_0x483f88=_0x483f88||0xcc;return function(_0x50b559){if(_0x50b559){return _0xd7102b['sendStatus'](_0x483f88);}return _0xd7102b['status'](_0x483f88)['end']();};}function respondWithResult(_0x5913ee,_0x4270df){_0x4270df=_0x4270df||0xc8;return function(_0x1596ed){if(_0x1596ed){return _0x5913ee[_0x2432('0x29')](_0x4270df)['json'](_0x1596ed);}};}function respondWithFilteredResult(_0x5ae44a,_0x474ec8){return function(_0x533511){if(_0x533511){var _0x3e19be=typeof _0x474ec8[_0x2432('0x2a')]===_0x2432('0x2b')&&typeof _0x474ec8[_0x2432('0x2c')]==='undefined';var _0x309310=_0x533511[_0x2432('0x2d')];var _0x53eda4=_0x3e19be?0x0:_0x474ec8[_0x2432('0x2a')];var _0x141f44=_0x3e19be?_0x533511[_0x2432('0x2d')]:_0x474ec8[_0x2432('0x2a')]+_0x474ec8[_0x2432('0x2c')];var _0xd47467;if(_0x141f44>=_0x309310){_0x141f44=_0x309310;_0xd47467=0xc8;}else{_0xd47467=0xce;}_0x5ae44a[_0x2432('0x29')](_0xd47467);return _0x5ae44a[_0x2432('0x2e')](_0x2432('0x2f'),_0x53eda4+'-'+_0x141f44+'/'+_0x309310)[_0x2432('0x30')](_0x533511);}return null;};}function patchUpdates(_0x27c4f6){return function(_0x3c3a15){try{jsonpatch[_0x2432('0x31')](_0x3c3a15,_0x27c4f6,!![]);}catch(_0x3bdd4f){return BPromise[_0x2432('0x32')](_0x3bdd4f);}return _0x3c3a15[_0x2432('0x33')]();};}function saveUpdates(_0x3c3988,_0x17454b){return function(_0x3689dd){if(_0x3689dd){return _0x3689dd[_0x2432('0x34')](_0x3c3988)[_0x2432('0x1e')](function(_0x15e8d5){return _0x15e8d5;});}return null;};}function removeEntity(_0x1bd3a8,_0x2b1d54){return function(_0x48f790){if(_0x48f790){return _0x48f790[_0x2432('0x35')]()[_0x2432('0x1e')](function(){var _0x47b937=_0x48f790[_0x2432('0x36')]({'plain':!![]});var _0xe198d6=_0x2432('0x37');return db[_0x2432('0x38')][_0x2432('0x35')]({'where':{'type':_0xe198d6,'resourceId':_0x47b937['id']}})['then'](function(){return _0x48f790;});})[_0x2432('0x1e')](function(){_0x1bd3a8['status'](0xcc)[_0x2432('0x39')]();});}};}function handleEntityNotFound(_0x28f36d,_0xe19318){return function(_0x4a1125){if(!_0x4a1125){_0x28f36d[_0x2432('0x3a')](0x194);}return _0x4a1125;};}function handleError(_0x7c121,_0x53f63d){_0x53f63d=_0x53f63d||0x1f4;return function(_0x4fea89){logger[_0x2432('0x23')](_0x4fea89[_0x2432('0x3b')]);if(_0x4fea89[_0x2432('0x3c')]){delete _0x4fea89[_0x2432('0x3c')];}_0x7c121['status'](_0x53f63d)[_0x2432('0x3d')](_0x4fea89);};}exports[_0x2432('0x3e')]=function(_0x1c53ee,_0x890548){var _0x48ee56={'include':[{'model':db[_0x2432('0x3f')],'as':_0x2432('0x40')}]},_0x2a7ac1={},_0x1719f3={'count':0x0,'rows':[]};var _0x3b67d4=_['map'](db[_0x2432('0x41')]['rawAttributes'],function(_0x588a73){return{'name':_0x588a73['fieldName'],'type':_0x588a73[_0x2432('0x42')][_0x2432('0x43')]};});_0x2a7ac1[_0x2432('0x44')]=_[_0x2432('0x45')](_0x3b67d4,_0x2432('0x3c'));_0x2a7ac1[_0x2432('0x46')]=_[_0x2432('0x47')](_0x1c53ee[_0x2432('0x46')]);_0x2a7ac1[_0x2432('0x48')]=_[_0x2432('0x49')](_0x2a7ac1[_0x2432('0x44')],_0x2a7ac1['query']);_0x48ee56[_0x2432('0x4a')]=_['intersection'](_0x2a7ac1['model'],qs['fields'](_0x1c53ee['query'][_0x2432('0x4b')]));_0x48ee56[_0x2432('0x4a')]=_0x48ee56[_0x2432('0x4a')][_0x2432('0x4c')]?_0x48ee56[_0x2432('0x4a')]:_0x2a7ac1['model'];if(!_0x1c53ee[_0x2432('0x46')]['hasOwnProperty'](_0x2432('0x4d'))){_0x48ee56[_0x2432('0x2c')]=qs[_0x2432('0x2c')](_0x1c53ee['query'][_0x2432('0x2c')]);_0x48ee56[_0x2432('0x2a')]=qs[_0x2432('0x2a')](_0x1c53ee[_0x2432('0x46')][_0x2432('0x2a')]);}_0x48ee56[_0x2432('0x4e')]=qs[_0x2432('0x4f')](_0x1c53ee[_0x2432('0x46')][_0x2432('0x4f')]);_0x48ee56[_0x2432('0x50')]=qs['filters'](_[_0x2432('0x51')](_0x1c53ee['query'],_0x2a7ac1['filters']),_0x3b67d4);if(_0x1c53ee[_0x2432('0x46')][_0x2432('0x52')]){_0x48ee56[_0x2432('0x50')]=_[_0x2432('0x53')](_0x48ee56[_0x2432('0x50')],{'$or':_[_0x2432('0x45')](_0x3b67d4,function(_0x5cfb9a){if(_0x5cfb9a[_0x2432('0x42')]!==_0x2432('0x54')){var _0x29f99f={};_0x29f99f[_0x5cfb9a[_0x2432('0x3c')]]={'$like':'%'+_0x1c53ee[_0x2432('0x46')][_0x2432('0x52')]+'%'};return _0x29f99f;}})});}_0x48ee56=_['merge']({},_0x48ee56,_0x1c53ee[_0x2432('0x55')]);var _0x2432e3={'where':_0x48ee56[_0x2432('0x50')]};return db['OpenchannelAccount'][_0x2432('0x2d')](_0x2432e3)[_0x2432('0x1e')](function(_0x34803e){_0x1719f3[_0x2432('0x2d')]=_0x34803e;if(_0x1c53ee[_0x2432('0x46')][_0x2432('0x56')]){_0x48ee56['include']=[{'all':!![]}];}return db[_0x2432('0x41')]['findAll'](_0x48ee56);})[_0x2432('0x1e')](function(_0x38bb21){_0x1719f3[_0x2432('0x57')]=_0x38bb21;return _0x1719f3;})['then'](respondWithFilteredResult(_0x890548,_0x48ee56))[_0x2432('0x28')](handleError(_0x890548,null));};exports['show']=function(_0x29f732,_0x203d88){var _0x589afe={'raw':![],'where':{'id':_0x29f732[_0x2432('0x58')]['id']},'include':[{'model':db[_0x2432('0x3f')],'as':'mandatoryDispositionPause'}]},_0x105203={};_0x105203[_0x2432('0x44')]=_['keys'](db['OpenchannelAccount'][_0x2432('0x59')]);_0x105203['query']=_[_0x2432('0x47')](_0x29f732[_0x2432('0x46')]);_0x105203[_0x2432('0x48')]=_[_0x2432('0x49')](_0x105203[_0x2432('0x44')],_0x105203[_0x2432('0x46')]);_0x589afe['attributes']=_[_0x2432('0x49')](_0x105203['model'],qs[_0x2432('0x4b')](_0x29f732['query'][_0x2432('0x4b')]));_0x589afe['attributes']=_0x589afe[_0x2432('0x4a')][_0x2432('0x4c')]?_0x589afe[_0x2432('0x4a')]:_0x105203[_0x2432('0x44')];if(_0x29f732[_0x2432('0x46')][_0x2432('0x56')]){_0x589afe['include']=[{'all':!![]}];}_0x589afe=_[_0x2432('0x53')]({},_0x589afe,_0x29f732[_0x2432('0x55')]);return db[_0x2432('0x41')][_0x2432('0x5a')](_0x589afe)[_0x2432('0x1e')](handleEntityNotFound(_0x203d88,null))['then'](respondWithResult(_0x203d88,null))[_0x2432('0x28')](handleError(_0x203d88,null));};exports[_0x2432('0x5b')]=function(_0x1af8ad,_0x30db77){return db[_0x2432('0x41')][_0x2432('0x5b')](_0x1af8ad[_0x2432('0x5c')],{})['then'](function(_0x829f88){var _0x2b218e=_0x1af8ad[_0x2432('0x5d')][_0x2432('0x36')]({'plain':!![]});if(!_0x2b218e)throw new Error(_0x2432('0x5e'));if(_0x2b218e[_0x2432('0x5f')]===_0x2432('0x5d')){var _0x57cb0a=_0x829f88[_0x2432('0x36')]({'plain':!![]});var _0x29628f=_0x2432('0x37');return db['UserProfileSection'][_0x2432('0x5a')]({'where':{'name':_0x29628f,'userProfileId':_0x2b218e['userProfileId']},'raw':!![]})['then'](function(_0xfd1cb3){if(_0xfd1cb3&&_0xfd1cb3[_0x2432('0x60')]===0x0){return db[_0x2432('0x38')][_0x2432('0x5b')]({'name':_0x57cb0a['name'],'resourceId':_0x57cb0a['id'],'type':_0xfd1cb3[_0x2432('0x3c')],'sectionId':_0xfd1cb3['id']},{})[_0x2432('0x1e')](function(){return _0x829f88;});}else{return _0x829f88;}})[_0x2432('0x28')](function(_0x1f6d55){logger[_0x2432('0x23')](_0x2432('0x61'),_0x1f6d55);throw _0x1f6d55;});}return _0x829f88;})[_0x2432('0x1e')](respondWithResult(_0x30db77,0xc9))[_0x2432('0x28')](handleError(_0x30db77,null));};exports['update']=function(_0x94f16c,_0xf579a0){if(_0x94f16c[_0x2432('0x5c')]['id']){delete _0x94f16c[_0x2432('0x5c')]['id'];}return db[_0x2432('0x41')][_0x2432('0x5a')]({'where':{'id':_0x94f16c['params']['id']},'include':[{'model':db[_0x2432('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0xf579a0,null))[_0x2432('0x1e')](saveUpdates(_0x94f16c[_0x2432('0x5c')],null))[_0x2432('0x1e')](respondWithResult(_0xf579a0,null))['catch'](handleError(_0xf579a0,null));};exports[_0x2432('0x35')]=function(_0x26544f,_0x583896){return db[_0x2432('0x41')][_0x2432('0x5a')]({'where':{'id':_0x26544f[_0x2432('0x58')]['id']}})[_0x2432('0x1e')](handleEntityNotFound(_0x583896,null))[_0x2432('0x1e')](removeEntity(_0x583896,null))['catch'](handleError(_0x583896,null));};exports['describe']=function(_0x32a7f5,_0x1acd67){return db[_0x2432('0x41')][_0x2432('0x62')]()[_0x2432('0x1e')](respondWithResult(_0x1acd67,null))[_0x2432('0x28')](handleError(_0x1acd67,null));};exports[_0x2432('0x63')]=function(_0x52c15,_0x91d85,_0xd84b7a){if(_0x52c15['body']['id']){delete _0x52c15[_0x2432('0x5c')]['id'];}return db[_0x2432('0x41')][_0x2432('0x5a')]({'where':{'id':_0x52c15['params']['id']}})['then'](handleEntityNotFound(_0x91d85,null))[_0x2432('0x1e')](function(_0x504434){if(_0x504434){_0x52c15[_0x2432('0x5c')][_0x2432('0x64')]=_0x504434['id'];return db[_0x2432('0x65')][_0x2432('0x5b')](_0x52c15['body']);}})[_0x2432('0x1e')](respondWithResult(_0x91d85,null))['catch'](handleError(_0x91d85,null));};exports[_0x2432('0x66')]=function(_0x5bcc7d,_0xdc8bde,_0x38d7d1){var _0x4a7787={'raw':![],'where':{}};var _0x1570e9={};var _0x227bb4={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x2432('0x67')]({'where':{'id':_0x5bcc7d['params']['id']}})[_0x2432('0x1e')](handleEntityNotFound(_0xdc8bde,null))[_0x2432('0x1e')](function(_0x30a3eb){if(_0x30a3eb){_0x1570e9[_0x2432('0x44')]=_[_0x2432('0x47')](db[_0x2432('0x65')][_0x2432('0x59')]);_0x1570e9[_0x2432('0x46')]=_[_0x2432('0x47')](_0x5bcc7d[_0x2432('0x46')]);_0x1570e9[_0x2432('0x48')]=_[_0x2432('0x49')](_0x1570e9['model'],_0x1570e9[_0x2432('0x46')]);_0x4a7787[_0x2432('0x4a')]=_['intersection'](_0x1570e9[_0x2432('0x44')],qs['fields'](_0x5bcc7d['query']['fields']));_0x4a7787[_0x2432('0x4a')]=_0x4a7787['attributes'][_0x2432('0x4c')]?_0x4a7787[_0x2432('0x4a')]:_0x1570e9[_0x2432('0x44')];if(!_0x5bcc7d[_0x2432('0x46')][_0x2432('0x68')](_0x2432('0x4d'))){_0x4a7787[_0x2432('0x2c')]=qs['limit'](_0x5bcc7d[_0x2432('0x46')][_0x2432('0x2c')]);_0x4a7787[_0x2432('0x2a')]=qs['offset'](_0x5bcc7d['query']['offset']);}_0x4a7787[_0x2432('0x4e')]=qs[_0x2432('0x4f')](_0x5bcc7d[_0x2432('0x46')][_0x2432('0x4f')]);_0x4a7787[_0x2432('0x50')]=qs[_0x2432('0x48')](_[_0x2432('0x51')](_0x5bcc7d['query'],_0x1570e9['filters']));_0x4a7787[_0x2432('0x50')][_0x2432('0x64')]=_0x30a3eb['id'];if(_0x5bcc7d['query'][_0x2432('0x52')]){_0x4a7787['where']=_[_0x2432('0x53')](_0x4a7787[_0x2432('0x50')],{'$or':_[_0x2432('0x45')](_0x4a7787[_0x2432('0x4a')],function(_0xe2d2c2){var _0x44c946={};_0x44c946[_0xe2d2c2]={'$like':'%'+_0x5bcc7d['query'][_0x2432('0x52')]+'%'};return _0x44c946;})});}_0x4a7787=_[_0x2432('0x53')]({},_0x4a7787,_0x5bcc7d['options']);return db[_0x2432('0x65')]['count']({'where':_0x4a7787[_0x2432('0x50')]})[_0x2432('0x1e')](function(_0x186d7d){_0x227bb4[_0x2432('0x2d')]=_0x186d7d;if(_0x5bcc7d[_0x2432('0x46')][_0x2432('0x56')]){_0x4a7787[_0x2432('0x69')]=[{'all':!![]}];}return db['Disposition'][_0x2432('0x6a')](_0x4a7787);})['then'](function(_0x1f4ddb){_0x227bb4[_0x2432('0x57')]=_0x1f4ddb;return _0x227bb4;});}})['then'](respondWithFilteredResult(_0xdc8bde,_0x4a7787))['catch'](handleError(_0xdc8bde,null));};exports[_0x2432('0x6b')]=function(_0xce4439,_0x294db0,_0x439944){return db[_0x2432('0x41')][_0x2432('0x5a')]({'where':{'id':_0xce4439[_0x2432('0x58')]['id']}})[_0x2432('0x1e')](handleEntityNotFound(_0x294db0,null))[_0x2432('0x1e')](function(_0x5a4d3e){if(_0x5a4d3e){return _0x5a4d3e['removeDispositions'](_0xce4439['query']['ids']);}})[_0x2432('0x1e')](respondWithStatusCode(_0x294db0,null))[_0x2432('0x28')](handleError(_0x294db0,null));};exports['addAnswer']=function(_0x30a7e3,_0x54e41c,_0x584898){if(_0x30a7e3[_0x2432('0x5c')]['id']){delete _0x30a7e3[_0x2432('0x5c')]['id'];}return db['OpenchannelAccount'][_0x2432('0x5a')]({'where':{'id':_0x30a7e3[_0x2432('0x58')]['id']}})[_0x2432('0x1e')](handleEntityNotFound(_0x54e41c,null))['then'](function(_0x344759){if(_0x344759){_0x30a7e3['body'][_0x2432('0x64')]=_0x344759['id'];return db['CannedAnswer'][_0x2432('0x5b')](_0x30a7e3['body']);}})[_0x2432('0x1e')](respondWithResult(_0x54e41c,null))[_0x2432('0x28')](handleError(_0x54e41c,null));};exports[_0x2432('0x6c')]=function(_0x3eed07,_0x1d9876,_0x298b8a){var _0x5c3215={'raw':![],'where':{}};var _0x163966={};var _0x584514={'count':0x0,'rows':[]};return db[_0x2432('0x41')][_0x2432('0x67')]({'where':{'id':_0x3eed07[_0x2432('0x58')]['id']}})[_0x2432('0x1e')](handleEntityNotFound(_0x1d9876,null))['then'](function(_0x1b6523){if(_0x1b6523){_0x163966[_0x2432('0x44')]=_[_0x2432('0x47')](db[_0x2432('0x6d')]['rawAttributes']);_0x163966['query']=_[_0x2432('0x47')](_0x3eed07[_0x2432('0x46')]);_0x163966['filters']=_[_0x2432('0x49')](_0x163966[_0x2432('0x44')],_0x163966[_0x2432('0x46')]);_0x5c3215[_0x2432('0x4a')]=_[_0x2432('0x49')](_0x163966[_0x2432('0x44')],qs[_0x2432('0x4b')](_0x3eed07['query'][_0x2432('0x4b')]));_0x5c3215['attributes']=_0x5c3215['attributes'][_0x2432('0x4c')]?_0x5c3215[_0x2432('0x4a')]:_0x163966[_0x2432('0x44')];if(!_0x3eed07[_0x2432('0x46')]['hasOwnProperty'](_0x2432('0x4d'))){_0x5c3215[_0x2432('0x2c')]=qs[_0x2432('0x2c')](_0x3eed07[_0x2432('0x46')]['limit']);_0x5c3215[_0x2432('0x2a')]=qs[_0x2432('0x2a')](_0x3eed07[_0x2432('0x46')][_0x2432('0x2a')]);}_0x5c3215['order']=qs[_0x2432('0x4f')](_0x3eed07[_0x2432('0x46')][_0x2432('0x4f')]);_0x5c3215[_0x2432('0x50')]=qs['filters'](_[_0x2432('0x51')](_0x3eed07['query'],_0x163966['filters']));_0x5c3215[_0x2432('0x50')][_0x2432('0x64')]=_0x1b6523['id'];if(_0x3eed07[_0x2432('0x46')]['filter']){_0x5c3215[_0x2432('0x50')]=_[_0x2432('0x53')](_0x5c3215[_0x2432('0x50')],{'$or':_[_0x2432('0x45')](_0x5c3215['attributes'],function(_0x38403b){var _0x5d9039={};_0x5d9039[_0x38403b]={'$like':'%'+_0x3eed07['query']['filter']+'%'};return _0x5d9039;})});}_0x5c3215=_[_0x2432('0x53')]({},_0x5c3215,_0x3eed07[_0x2432('0x55')]);return db[_0x2432('0x6d')][_0x2432('0x2d')]({'where':_0x5c3215[_0x2432('0x50')]})['then'](function(_0x575961){_0x584514[_0x2432('0x2d')]=_0x575961;if(_0x3eed07['query'][_0x2432('0x56')]){_0x5c3215[_0x2432('0x69')]=[{'all':!![]}];}return db[_0x2432('0x6d')][_0x2432('0x6a')](_0x5c3215);})[_0x2432('0x1e')](function(_0x15daff){_0x584514[_0x2432('0x57')]=_0x15daff;return _0x584514;});}})[_0x2432('0x1e')](respondWithFilteredResult(_0x1d9876,_0x5c3215))[_0x2432('0x28')](handleError(_0x1d9876,null));};exports[_0x2432('0x6e')]=function(_0x3da787,_0x3f60e6,_0x509f1f){return db[_0x2432('0x41')]['find']({'where':{'id':_0x3da787[_0x2432('0x58')]['id']}})[_0x2432('0x1e')](handleEntityNotFound(_0x3f60e6,null))[_0x2432('0x1e')](function(_0xd480cb){if(_0xd480cb){return _0xd480cb[_0x2432('0x6e')](_0x3da787['query'][_0x2432('0x6f')]);}})['then'](respondWithStatusCode(_0x3f60e6,null))[_0x2432('0x28')](handleError(_0x3f60e6,null));};exports[_0x2432('0x70')]=function(_0x2fdc0b,_0x67bc0,_0x33750a){var _0x23749b={'body':_0x2fdc0b['body'],'channel':_0x2432('0x71')};var _0x37aa7f=[];var _0x1f2228=[];var _0x13d1c1={};var _0x4dc9ee=![];return db[_0x2432('0x72')][_0x2432('0x62')]()[_0x2432('0x1e')](function(_0x57ac8a){if(!_0x57ac8a){throw new db['Sequelize'][(_0x2432('0x73'))](_0x2432('0x74'));}_0x37aa7f=_[_0x2432('0x75')](_[_0x2432('0x47')](_0x57ac8a),[_0x2432('0x76'),_0x2432('0x77')]);_0x1f2228=_['difference'](_[_0x2432('0x47')](_0x57ac8a),['createdAt','updatedAt','CompanyId',_0x2432('0x78')]);if(_0x2fdc0b['body']['id']){delete _0x2fdc0b[_0x2432('0x5c')]['id'];}if(_[_0x2432('0x79')](_0x2fdc0b[_0x2432('0x5c')]['from'])){throw new db['Sequelize'][(_0x2432('0x73'))](_0x2432('0x7a'));}if(_[_0x2432('0x79')](_0x2fdc0b[_0x2432('0x5c')]['body'])||_0x2fdc0b[_0x2432('0x5c')][_0x2432('0x5c')]===''){throw new db[(_0x2432('0x7b'))][(_0x2432('0x73'))](_0x2432('0x7c'));}if(_[_0x2432('0x79')](_0x2fdc0b['body']['mapKey'])){throw new db['Sequelize'][(_0x2432('0x73'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f2228);}if(!_['includes'](_0x1f2228,_0x2fdc0b['body'][_0x2432('0x7d')])){throw new db[(_0x2432('0x7b'))][(_0x2432('0x73'))](_0x2432('0x7e')+_0x1f2228);}_0x13d1c1[_0x2fdc0b[_0x2432('0x5c')]['mapKey']]=_0x2fdc0b['body'][_0x2432('0x7f')];})['then'](function(){return db[_0x2432('0x41')][_0x2432('0x5a')]({'where':{'id':_0x2fdc0b[_0x2432('0x58')]['id']},'include':[{'model':db[_0x2432('0x80')],'as':_0x2432('0x81'),'include':[{'model':db[_0x2432('0x72')],'as':_0x2432('0x82'),'where':_0x13d1c1,'limit':0x1,'order':[[_0x2432('0x77'),_0x2432('0x83')]]}]},{'model':db[_0x2432('0x84')],'as':'Applications'}]});})[_0x2432('0x1e')](handleEntityNotFound(_0x67bc0,null))[_0x2432('0x1e')](function(_0x13f591){if(_0x13f591&&_0x13f591['List']){_0x23749b[_0x2432('0x85')]=_0x13f591;_0x23749b['applications']=_0x13f591[_0x2432('0x86')];_0x23749b[_0x2432('0x87')]=_0x13f591[_0x2432('0x81')];_0x23749b[_0x2432('0x88')]=_['orderBy'](_0x23749b['applications'],[_0x2432('0x89')],['asc']);if(_0x23749b['account']['Applications']){delete _0x23749b[_0x2432('0x85')]['Applications'];}if(_0x23749b[_0x2432('0x85')][_0x2432('0x81')]&&_0x23749b[_0x2432('0x85')][_0x2432('0x81')][_0x2432('0x82')][_0x2432('0x4c')]){return _0x23749b[_0x2432('0x85')]['List'][_0x2432('0x82')][0x0];}var _0xda5ebd=_['defaults'](_0x2fdc0b[_0x2432('0x5c')],{'firstName':_0x2fdc0b[_0x2432('0x5c')][_0x2432('0x7f')],'ListId':_0x13f591[_0x2432('0x78')]});_0xda5ebd[_0x2fdc0b['body'][_0x2432('0x7d')]]=_0x2fdc0b[_0x2432('0x5c')]['from'];return db[_0x2432('0x72')][_0x2432('0x5b')](_0xda5ebd,{'fields':_0x37aa7f,'raw':!![]});}})[_0x2432('0x1e')](handleEntityNotFound(_0x67bc0,null))['then'](function(_0x4009b8){_0x23749b[_0x2432('0x8a')]=_0x4009b8;if(_0x4009b8){var _0xa94d92={'ContactId':_0x4009b8['id'],'OpenchannelAccountId':_0x2fdc0b[_0x2432('0x58')]['id'],'from':(_0x4009b8[_0x2432('0x8b')]||'')+'\x20'+(_0x4009b8[_0x2432('0x8c')]||'')};var _0x2563aa={'OpenchannelAccountId':_0x2fdc0b[_0x2432('0x58')]['id'],'closed':![]};if(_0x2fdc0b[_0x2432('0x5c')][_0x2432('0x8d')]){_0x2563aa[_0x2432('0x8d')]=_0x2fdc0b[_0x2432('0x5c')]['threadId'];return db[_0x2432('0x8e')][_0x2432('0x5a')]({'where':_0x2563aa})[_0x2432('0x1e')](function(_0x1c7d3d){if(_0x1c7d3d){return[_0x1c7d3d,![]];}_0xa94d92[_0x2432('0x8d')]=_0x2fdc0b[_0x2432('0x5c')][_0x2432('0x8d')];_0xa94d92[_0x2432('0x8f')]=_0x2fdc0b[_0x2432('0x5c')][_0x2432('0x8f')];return db[_0x2432('0x8e')][_0x2432('0x5b')](_0xa94d92)[_0x2432('0x1e')](function(_0x188e29){return[_0x188e29,!![]];});});}else{_0x2563aa['threadId']=null;}_0x2563aa[_0x2432('0x90')]=_0x4009b8['id'];return db[_0x2432('0x8e')][_0x2432('0x5a')]({'where':_0x2563aa})[_0x2432('0x1e')](function(_0x48d511){if(_0x48d511){return[_0x48d511,![]];}return db['OpenchannelInteraction'][_0x2432('0x5b')](_0xa94d92)[_0x2432('0x1e')](function(_0x32a38c){return[_0x32a38c,!![]];});});}})[_0x2432('0x91')](function(_0x54af52,_0x14c60d){if(_0x54af52){_0x4dc9ee=_0x14c60d;if(!_0x14c60d){var _0x2ce1d8={'from':(_0x23749b[_0x2432('0x8a')]['firstName']||'')+'\x20'+(_0x23749b['contact'][_0x2432('0x8c')]||'')};if(_0x2fdc0b[_0x2432('0x5c')]['threadId']&&_0x2fdc0b[_0x2432('0x5c')][_0x2432('0x92')]&&_0x2fdc0b[_0x2432('0x5c')]['threadId']!=_0x2fdc0b['body'][_0x2432('0x92')]){_0x2ce1d8[_0x2432('0x8d')]=_0x2fdc0b[_0x2432('0x5c')][_0x2432('0x92')];}return _0x54af52[_0x2432('0x34')](_0x2ce1d8);}else{return _0x54af52;}}})[_0x2432('0x1e')](function(_0x145eae){_0x23749b[_0x2432('0x93')]=_0x145eae['get']({'plain':!![]});_0x23749b[_0x2432('0x93')][_0x2432('0x94')]=_0x4dc9ee;if(_0x23749b[_0x2432('0x93')][_0x2432('0x94')]){if(_0x23749b[_0x2432('0x85')][_0x2432('0x95')]){_0x23749b['applications'][_0x2432('0x96')]({'id':0x0,'priority':_0x23749b[_0x2432('0x88')][_0x2432('0x4c')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x2432('0x97')][_0x2432('0x5b')]({'body':_0x2fdc0b[_0x2432('0x5c')][_0x2432('0x5c')],'OpenchannelAccountId':_0x2fdc0b[_0x2432('0x58')]['id'],'OpenchannelInteractionId':_0x145eae['id'],'direction':'in','ContactId':_0x23749b[_0x2432('0x8a')]['id'],'AttachmentId':_0x2fdc0b['body'][_0x2432('0x98')]});})[_0x2432('0x1e')](function(_0xd4ab9c){_0x23749b[_0x2432('0x25')]=_0xd4ab9c;if(_0x23749b[_0x2432('0x93')][_0x2432('0x99')]){return db[_0x2432('0x9a')][_0x2432('0x5a')]({'attributes':['id',_0x2432('0x3c')],'where':{'id':_0x23749b[_0x2432('0x93')][_0x2432('0x99')]}})[_0x2432('0x1e')](function(_0x1104cf){if(_0x1104cf){_0x23749b[_0x2432('0x88')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1104cf[_0x2432('0x3c')]+','+(_0x23749b[_0x2432('0x85')][_0x2432('0x9b')]||0xa),'interval':'*,*,*,*'});_0x23749b[_0x2432('0x9c')]=![];}return respondWithRpcPromise(_0x2432('0x9d'),'startRouting',_0x23749b);});}return respondWithRpcPromise(_0x2432('0x9d'),_0x2432('0x9e'),_0x23749b);})[_0x2432('0x1e')](function(_0x536c3b){respondWithRpcPromise(_0x2432('0x9f'),_0x2432('0x9f'),{'event':_0x2432('0x70'),'message':_0x536c3b},client9002);return _0x536c3b;})[_0x2432('0x1e')](respondWithResult(_0x67bc0,null))[_0x2432('0x28')](handleError(_0x67bc0,null));};exports['addApplications']=function(_0x36bac6,_0x54cd80){var _0x58441f=_0x36bac6['params']['id'];var _0x357f07=_0x36bac6[_0x2432('0x5c')];var _0x5f43b0=0xc8;var _0x40004d=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2432('0xa0')][_0x2432('0xa1')][_0x2432('0xa2')]['READ_COMMITTED']},function(_0x2b33c2){return db[_0x2432('0x41')][_0x2432('0x67')]({'where':{'id':_0x58441f},'transaction':_0x2b33c2})[_0x2432('0x1e')](function(_0x505eba){if(_0x505eba){return db[_0x2432('0x84')][_0x2432('0x35')]({'where':{'OpenchannelAccountId':_0x58441f},'transaction':_0x2b33c2})[_0x2432('0x1e')](function(){var _0xa1d787=_['map'](_0x357f07,function(_0x55dac4){_0x55dac4['OpenchannelAccountId']=_0x58441f;return _0x55dac4;});return db[_0x2432('0x84')][_0x2432('0xa3')](_0xa1d787,{'transaction':_0x2b33c2});});}else{_0x5f43b0=0x194;_0x40004d=[];}});})['then'](function(){if(_0x5f43b0!==0x194){return db[_0x2432('0x84')][_0x2432('0xa4')]({'where':{'OpenchannelAccountId':_0x58441f},'order':_0x2432('0x89')})['then'](function(_0x16c101){_0x40004d=_0x16c101;});}})['catch'](function(_0x50420f){_0x5f43b0=0x1f4;logger[_0x2432('0x23')](_0x50420f[_0x2432('0x3b')]);if(_0x50420f[_0x2432('0x3c')]){delete _0x50420f[_0x2432('0x3c')];}_0x40004d=_0x50420f;})[_0x2432('0xa5')](function(){if(_0x40004d===null){_0x54cd80[_0x2432('0x3a')](_0x5f43b0);}else{if(_0x5f43b0===0x1f4){_0x54cd80[_0x2432('0x29')](_0x5f43b0)[_0x2432('0x3d')](_0x40004d);}else{_0x54cd80[_0x2432('0x29')](_0x5f43b0)['json'](_0x40004d);}}});};exports[_0x2432('0xa6')]=function(_0x22c7c2,_0x2d5e26,_0x527e83){var _0x55cf9a={};var _0x43de73={};var _0x2d8664;var _0xb53834;return db[_0x2432('0x41')]['findOne']({'where':{'id':_0x22c7c2[_0x2432('0x58')]['id']}})[_0x2432('0x1e')](handleEntityNotFound(_0x2d5e26,null))[_0x2432('0x1e')](function(_0x1bb41f){if(_0x1bb41f){_0x2d8664=_0x1bb41f;_0x43de73[_0x2432('0x44')]=_[_0x2432('0x47')](db[_0x2432('0x84')][_0x2432('0x59')]);_0x43de73[_0x2432('0x46')]=_[_0x2432('0x47')](_0x22c7c2[_0x2432('0x46')]);_0x43de73['filters']=_[_0x2432('0x49')](_0x43de73[_0x2432('0x44')],_0x43de73['query']);_0x55cf9a[_0x2432('0x4a')]=_[_0x2432('0x49')](_0x43de73[_0x2432('0x44')],qs[_0x2432('0x4b')](_0x22c7c2[_0x2432('0x46')][_0x2432('0x4b')]));_0x55cf9a[_0x2432('0x4a')]=_0x55cf9a['attributes'][_0x2432('0x4c')]?_0x55cf9a[_0x2432('0x4a')]:_0x43de73[_0x2432('0x44')];_0x55cf9a['order']=qs['sort'](_0x22c7c2[_0x2432('0x46')][_0x2432('0x4f')]);_0x55cf9a[_0x2432('0x50')]=qs['filters'](_[_0x2432('0x51')](_0x22c7c2[_0x2432('0x46')],_0x43de73[_0x2432('0x48')]));if(_0x22c7c2[_0x2432('0x46')][_0x2432('0x52')]){_0x55cf9a[_0x2432('0x50')]=_['merge'](_0x55cf9a['where'],{'$or':_[_0x2432('0x45')](_0x55cf9a['attributes'],function(_0x3d8d60){var _0x333d4a={};_0x333d4a[_0x3d8d60]={'$like':'%'+_0x22c7c2[_0x2432('0x46')][_0x2432('0x52')]+'%'};return _0x333d4a;})});}_0x55cf9a=_[_0x2432('0x53')]({},_0x55cf9a,_0x22c7c2[_0x2432('0x55')]);return _0x2d8664[_0x2432('0xa6')](_0x55cf9a);}})[_0x2432('0x1e')](function(_0xc1c7e){if(_0xc1c7e){_0xb53834=_0xc1c7e[_0x2432('0x4c')];if(!_0x22c7c2[_0x2432('0x46')][_0x2432('0x68')](_0x2432('0x4d'))){_0x55cf9a['limit']=qs[_0x2432('0x2c')](_0x22c7c2['query'][_0x2432('0x2c')]);_0x55cf9a[_0x2432('0x2a')]=qs[_0x2432('0x2a')](_0x22c7c2['query'][_0x2432('0x2a')]);}return _0x2d8664[_0x2432('0xa6')](_0x55cf9a);}})[_0x2432('0x1e')](function(_0x1db49f){if(_0x1db49f){return _0x1db49f?{'count':_0xb53834,'rows':_0x1db49f}:null;}})[_0x2432('0x1e')](respondWithResult(_0x2d5e26,null))['catch'](handleError(_0x2d5e26,null));};exports[_0x2432('0xa7')]=function(_0x1f71aa,_0x230ada,_0x36413f){var _0x571ffb={'raw':![],'where':{}};var _0x39a82d={};var _0x33bbe3={'count':0x0,'rows':[]};return db[_0x2432('0x41')]['findOne']({'where':{'id':_0x1f71aa[_0x2432('0x58')]['id']}})[_0x2432('0x1e')](handleEntityNotFound(_0x230ada,null))[_0x2432('0x1e')](function(_0x5cf9ad){if(_0x5cf9ad){_0x39a82d['model']=_[_0x2432('0x47')](db['OpenchannelInteraction']['rawAttributes']);_0x39a82d[_0x2432('0x46')]=_[_0x2432('0x47')](_0x1f71aa[_0x2432('0x46')]);_0x39a82d[_0x2432('0x48')]=_['intersection'](_0x39a82d[_0x2432('0x44')],_0x39a82d[_0x2432('0x46')]);_0x571ffb[_0x2432('0x4a')]=_[_0x2432('0x49')](_0x39a82d[_0x2432('0x44')],qs[_0x2432('0x4b')](_0x1f71aa[_0x2432('0x46')][_0x2432('0x4b')]));_0x571ffb[_0x2432('0x4a')]=_0x571ffb['attributes'][_0x2432('0x4c')]?_0x571ffb[_0x2432('0x4a')]:_0x39a82d['model'];if(!_0x1f71aa[_0x2432('0x46')]['hasOwnProperty'](_0x2432('0x4d'))){_0x571ffb[_0x2432('0x2c')]=qs[_0x2432('0x2c')](_0x1f71aa[_0x2432('0x46')]['limit']);_0x571ffb[_0x2432('0x2a')]=qs[_0x2432('0x2a')](_0x1f71aa['query']['offset']);}_0x571ffb['order']=qs[_0x2432('0x4f')](_0x1f71aa[_0x2432('0x46')][_0x2432('0x4f')]);_0x571ffb[_0x2432('0x50')]=qs['filters'](_[_0x2432('0x51')](_0x1f71aa[_0x2432('0x46')],_0x39a82d[_0x2432('0x48')]));_0x571ffb[_0x2432('0x50')]['OpenchannelAccountId']=_0x5cf9ad['id'];if(_0x1f71aa['query'][_0x2432('0x52')]){_0x571ffb[_0x2432('0x50')]=_[_0x2432('0x53')](_0x571ffb[_0x2432('0x50')],{'$or':_[_0x2432('0x45')](_0x571ffb['attributes'],function(_0x590d83){var _0x39f8c2={};_0x39f8c2[_0x590d83]={'$like':'%'+_0x1f71aa[_0x2432('0x46')]['filter']+'%'};return _0x39f8c2;})});}_0x571ffb=_[_0x2432('0x53')]({},_0x571ffb,_0x1f71aa[_0x2432('0x55')]);return db[_0x2432('0x8e')]['count']({'where':_0x571ffb[_0x2432('0x50')]})[_0x2432('0x1e')](function(_0x5cd216){_0x33bbe3[_0x2432('0x2d')]=_0x5cd216;if(_0x1f71aa['query'][_0x2432('0x56')]){_0x571ffb[_0x2432('0x69')]=[{'model':db[_0x2432('0x72')],'as':_0x2432('0xa8'),'required':![]},{'model':db[_0x2432('0x9a')],'as':_0x2432('0xa9'),'attributes':[_0x2432('0x3c'),_0x2432('0xaa'),_0x2432('0xab')],'required':![]},{'model':db['Tag'],'as':_0x2432('0xac'),'attributes':['id','name',_0x2432('0xad')],'where':_0x1f71aa[_0x2432('0x46')]['tag']?{'id':_0x1f71aa[_0x2432('0x46')][_0x2432('0xae')]}:undefined,'required':_0x1f71aa[_0x2432('0x46')]['tag']?!![]:![]}];}return db[_0x2432('0x8e')][_0x2432('0x6a')](_0x571ffb);})[_0x2432('0x1e')](function(_0x2242cf){_0x33bbe3[_0x2432('0x57')]=_0x2242cf;return _0x33bbe3;});}})[_0x2432('0x1e')](respondWithFilteredResult(_0x230ada,_0x571ffb))[_0x2432('0x28')](handleError(_0x230ada,null));};exports[_0x2432('0xaf')]=function(_0x56d11c,_0x2f3b4e,_0x463cda){return db[_0x2432('0x41')][_0x2432('0x5a')]({'where':{'id':_0x56d11c[_0x2432('0x58')]['id']}})[_0x2432('0x1e')](handleEntityNotFound(_0x2f3b4e,null))[_0x2432('0x1e')](function(_0x553ad1){if(_0x553ad1){return _0x553ad1['addAgents'](_0x56d11c['body']['ids'],_[_0x2432('0xb0')](_0x56d11c['body'],[_0x2432('0x6f'),'id'])||{})['spread'](function(_0x2f1b66){for(var _0x4c34d7=0x0;_0x4c34d7<_0x56d11c['body']['ids'][_0x2432('0x4c')];_0x4c34d7+=0x1){socket['emit'](_0x2432('0xb1'),{'UserId':Number(_0x56d11c[_0x2432('0x5c')][_0x2432('0x6f')][_0x4c34d7]),'OpenchannelAccountId':Number(_0x56d11c['params']['id'])});}return _0x2f1b66;});}})['then'](respondWithResult(_0x2f3b4e,null))['catch'](handleError(_0x2f3b4e,null));};exports['removeAgents']=function(_0x4e2708,_0x436a1f,_0x3db44f){return db[_0x2432('0x41')]['find']({'where':{'id':_0x4e2708[_0x2432('0x58')]['id']}})[_0x2432('0x1e')](handleEntityNotFound(_0x436a1f,null))['then'](function(_0x14960e){if(_0x14960e){return _0x14960e[_0x2432('0xb2')](_0x4e2708[_0x2432('0x46')][_0x2432('0x6f')])[_0x2432('0x1e')](function(){if(_[_0x2432('0xb3')](_0x4e2708[_0x2432('0x46')][_0x2432('0x6f')])){for(var _0x41fbef=0x0;_0x41fbef<_0x4e2708[_0x2432('0x46')][_0x2432('0x6f')][_0x2432('0x4c')];_0x41fbef+=0x1){socket[_0x2432('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4e2708['query'][_0x2432('0x6f')][_0x41fbef]),'OpenchannelAccountId':Number(_0x4e2708[_0x2432('0x58')]['id'])});}}else{socket[_0x2432('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4e2708[_0x2432('0x46')][_0x2432('0x6f')]),'OpenchannelAccountId':Number(_0x4e2708[_0x2432('0x58')]['id'])});}});}})[_0x2432('0x1e')](respondWithStatusCode(_0x436a1f,null))[_0x2432('0x28')](handleError(_0x436a1f,null));};exports[_0x2432('0xb5')]=function(_0x46b69a,_0x4d3c85,_0x1c6dcb){var _0x566afa={};var _0x116bbb={};var _0x221b33;var _0x244131;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x46b69a[_0x2432('0x58')]['id']}})['then'](handleEntityNotFound(_0x4d3c85,null))['then'](function(_0x16b7b7){if(_0x16b7b7){_0x221b33=_0x16b7b7;_0x116bbb[_0x2432('0x44')]=_['keys'](db[_0x2432('0x9a')][_0x2432('0x59')]);_0x116bbb[_0x2432('0x46')]=_[_0x2432('0x47')](_0x46b69a['query']);_0x116bbb[_0x2432('0x48')]=_[_0x2432('0x49')](_0x116bbb[_0x2432('0x44')],_0x116bbb[_0x2432('0x46')]);_0x566afa['attributes']=_[_0x2432('0x49')](_0x116bbb['model'],qs[_0x2432('0x4b')](_0x46b69a[_0x2432('0x46')][_0x2432('0x4b')]));_0x566afa[_0x2432('0x4a')]=_0x566afa[_0x2432('0x4a')][_0x2432('0x4c')]?_0x566afa[_0x2432('0x4a')]:_0x116bbb[_0x2432('0x44')];_0x566afa['order']=qs[_0x2432('0x4f')](_0x46b69a['query'][_0x2432('0x4f')]);_0x566afa['where']=qs[_0x2432('0x48')](_[_0x2432('0x51')](_0x46b69a[_0x2432('0x46')],_0x116bbb[_0x2432('0x48')]));if(_0x46b69a[_0x2432('0x46')][_0x2432('0x52')]){_0x566afa[_0x2432('0x50')]=_['merge'](_0x566afa[_0x2432('0x50')],{'$or':_[_0x2432('0x45')](_0x566afa[_0x2432('0x4a')],function(_0x4276b8){var _0x119b1b={};_0x119b1b[_0x4276b8]={'$like':'%'+_0x46b69a[_0x2432('0x46')][_0x2432('0x52')]+'%'};return _0x119b1b;})});}_0x566afa=_[_0x2432('0x53')]({},_0x566afa,_0x46b69a[_0x2432('0x55')]);return _0x221b33[_0x2432('0xb5')](_0x566afa);}})[_0x2432('0x1e')](function(_0x98ab8f){if(_0x98ab8f){_0x244131=_0x98ab8f['length'];if(!_0x46b69a[_0x2432('0x46')][_0x2432('0x68')](_0x2432('0x4d'))){_0x566afa[_0x2432('0x2c')]=qs[_0x2432('0x2c')](_0x46b69a[_0x2432('0x46')]['limit']);_0x566afa['offset']=qs['offset'](_0x46b69a[_0x2432('0x46')][_0x2432('0x2a')]);}return _0x221b33[_0x2432('0xb5')](_0x566afa);}})[_0x2432('0x1e')](function(_0x1da955){if(_0x1da955){return _0x1da955?{'count':_0x244131,'rows':_0x1da955}:null;}})[_0x2432('0x1e')](respondWithResult(_0x4d3c85,null))['catch'](handleError(_0x4d3c85,null));};exports[_0x2432('0x3d')]=function(_0x18ceb5,_0x1d9346,_0x113c7c){var _0x50b2fe,_0x4cac2f,_0xcc1ab5;if(_[_0x2432('0x79')](_0x18ceb5[_0x2432('0x5c')]['body'])||_0x18ceb5[_0x2432('0x5c')][_0x2432('0x5c')]===''){throw new db[(_0x2432('0x7b'))][(_0x2432('0x73'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2432('0x79')](_0x18ceb5['body']['to'])){}_0x50b2fe=_0x18ceb5[_0x2432('0x5c')]['to'];return db[_0x2432('0x41')][_0x2432('0x67')]({'where':{'id':_0x18ceb5[_0x2432('0x58')]['id']}})[_0x2432('0x1e')](handleEntityNotFound(_0x1d9346,null))[_0x2432('0x1e')](function(_0x270173){if(_0x270173){return db[_0x2432('0x41')][_0x2432('0x5a')]({'where':{'id':_0x270173['id']},'include':[{'model':db[_0x2432('0x80')],'as':_0x2432('0x81'),'include':[{'model':db[_0x2432('0x72')],'as':'Contacts','where':{[_0x270173[_0x2432('0x7d')]]:_0x50b2fe},'limit':0x1,'order':[[_0x2432('0x77'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1d9346,null))[_0x2432('0x1e')](function(_0x2e9db3){if(_0x2e9db3&&_0x2e9db3[_0x2432('0x81')]){_0x4cac2f=_0x2e9db3['get']({'plain':!![]});if(_0x4cac2f[_0x2432('0x81')]&&_0x4cac2f[_0x2432('0x81')]['Contacts']['length']){return _0x4cac2f['List'][_0x2432('0x82')][0x0];}return db[_0x2432('0x72')][_0x2432('0x5b')](_[_0x2432('0x17')](_0x18ceb5['body'],{'firstName':_0x50b2fe,[_0x2e9db3[_0x2432('0x7d')]]:_0x50b2fe,'phone':_0x50b2fe,'ListId':_0x4cac2f[_0x2432('0x78')]}));}})[_0x2432('0x1e')](handleEntityNotFound(_0x1d9346,null))[_0x2432('0x1e')](function(_0x4100ba){if(_0x4100ba){_0xcc1ab5=_0x4100ba;return db[_0x2432('0x8e')][_0x2432('0x5a')]({'where':{'ContactId':_0xcc1ab5['id'],'closed':![],'OpenchannelAccountId':_0x4cac2f['id']}})[_0x2432('0x1e')](function(_0xd7acbb){if(_0xd7acbb){return[_0xd7acbb,![]];}return db[_0x2432('0x8e')][_0x2432('0x5b')]({'UserId':_0x18ceb5['user']['id'],'ContactId':_0xcc1ab5['id'],'OpenchannelAccountId':_0x4cac2f['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x2432('0x53')](_0x18ceb5['body'],{'read':![],'body':_0x18ceb5[_0x2432('0x5c')][_0x2432('0x5c')],'OpenchannelAccountId':_0x4cac2f['id'],'UserId':_0x18ceb5['user']['id'],'ContactId':_0xcc1ab5['id']})]},{'include':[{'model':db[_0x2432('0x97')],'as':_0x2432('0xb6')}]})[_0x2432('0x1e')](function(_0x4add6f){return[_0x4add6f,!![]];});});}})[_0x2432('0x91')](function(_0x33528f,_0x42aadb){if(_0x42aadb){return _0x33528f;}return db['OpenchannelMessage'][_0x2432('0x5b')](_['merge'](_0x18ceb5['body'],{'read':![],'body':_0x18ceb5[_0x2432('0x5c')][_0x2432('0x5c')],'OpenchannelAccountId':_0x4cac2f['id'],'OpenchannelInteractionId':_0x33528f['id'],'UserId':_0x18ceb5[_0x2432('0x5d')]['id'],'ContactId':_0xcc1ab5['id']}))[_0x2432('0x1e')](function(_0x5120fc){_0x33528f[_0x2432('0xb7')][_0x2432('0xb6')]=[];_0x33528f[_0x2432('0xb7')]['Messages'][_0x2432('0x96')](_0x5120fc[_0x2432('0xb7')]);return _0x33528f;});});}})[_0x2432('0x1e')](respondWithResult(_0x1d9346,null))[_0x2432('0x28')](handleError(_0x1d9346,null));}; \ No newline at end of file +var _0x9ec3=['internal','Tag','Tags','color','tag','addAgents','ids','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','out','OpenchannelMessage','dataValues','push','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','OpenchannelAccount','includeAll','include','findAll','rows','show','params','keys','intersection','options','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','body','describe','addDisposition','OpenchannelAccountId','getDispositions','Disposition','order','removeDispositions','CannedAnswer','getAnswers','findOne','pick','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','defaults','ListId','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findAndCountAll','finally','getApplications','getInteractions','Contact','User','Owner'];(function(_0x521c2d,_0x60b836){var _0xda5ea4=function(_0x258b8a){while(--_0x258b8a){_0x521c2d['push'](_0x521c2d['shift']());}};_0xda5ea4(++_0x60b836);}(_0x9ec3,0xcd));var _0x39ec=function(_0x5cc3b6,_0x249e4f){_0x5cc3b6=_0x5cc3b6-0x0;var _0x3ea2e0=_0x9ec3[_0x5cc3b6];return _0x3ea2e0;};'use strict';var emlformat=require(_0x39ec('0x0'));var rimraf=require(_0x39ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x39ec('0x2'));var moment=require('moment');var BPromise=require(_0x39ec('0x3'));var Mustache=require(_0x39ec('0x4'));var util=require(_0x39ec('0x5'));var path=require(_0x39ec('0x6'));var sox=require(_0x39ec('0x7'));var csv=require(_0x39ec('0x8'));var ejs=require(_0x39ec('0x9'));var fs=require('fs');var fs_extra=require(_0x39ec('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x39ec('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x39ec('0xc'));var toCsv=require(_0x39ec('0x8'));var querystring=require(_0x39ec('0xd'));var Papa=require('papaparse');var Redis=require(_0x39ec('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x39ec('0xf'));var as=require(_0x39ec('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39ec('0x11'))(_0x39ec('0x12'));var utils=require(_0x39ec('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x39ec('0x14'))['db'];config[_0x39ec('0x15')]=_['defaults'](config[_0x39ec('0x15')],{'host':_0x39ec('0x16'),'port':0x18eb});var socket=require(_0x39ec('0x17'))(new Redis(config['redis']));require(_0x39ec('0x18'))[_0x39ec('0x19')](socket);var jayson=require(_0x39ec('0x1a'));var client=jayson[_0x39ec('0x1b')][_0x39ec('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x39ec('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe6b518,_0x57cc39,_0x1e0fe1,_0x53d2a9){return new BPromise(function(_0x303173,_0x390fa5){var _0x2ada19=_0x53d2a9||client;return _0x2ada19['request'](_0xe6b518,_0x1e0fe1)[_0x39ec('0x1d')](function(_0x233ef4){logger[_0x39ec('0x1e')](_0x39ec('0x1f'),_0x57cc39,_0x39ec('0x20'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x57cc39,_0x39ec('0x20'),JSON['stringify'](_0x233ef4));if(_0x233ef4[_0x39ec('0x21')]){if(_0x233ef4[_0x39ec('0x21')][_0x39ec('0x22')]===0x1f4){logger[_0x39ec('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x57cc39,_0x233ef4[_0x39ec('0x21')]['message']);return _0x390fa5(_0x233ef4['error'][_0x39ec('0x23')]);}logger[_0x39ec('0x21')](_0x39ec('0x1f'),_0x57cc39,_0x233ef4[_0x39ec('0x21')][_0x39ec('0x23')]);return _0x303173(_0x233ef4[_0x39ec('0x21')][_0x39ec('0x23')]);}else{logger[_0x39ec('0x1e')](_0x39ec('0x1f'),_0x57cc39,_0x39ec('0x20'));_0x303173(_0x233ef4['result']['message']);}})[_0x39ec('0x24')](function(_0x1c5351){logger[_0x39ec('0x21')](_0x39ec('0x1f'),_0x57cc39,_0x1c5351);_0x390fa5(_0x1c5351);});});}function respondWithStatusCode(_0x3c1b00,_0x547993){_0x547993=_0x547993||0xcc;return function(_0x1cda73){if(_0x1cda73){return _0x3c1b00[_0x39ec('0x25')](_0x547993);}return _0x3c1b00[_0x39ec('0x26')](_0x547993)[_0x39ec('0x27')]();};}function respondWithResult(_0x554388,_0xd17e54){_0xd17e54=_0xd17e54||0xc8;return function(_0x100224){if(_0x100224){return _0x554388[_0x39ec('0x26')](_0xd17e54)['json'](_0x100224);}};}function respondWithFilteredResult(_0x403e30,_0x307ee2){return function(_0x4fde69){if(_0x4fde69){var _0x33d071=typeof _0x307ee2[_0x39ec('0x28')]===_0x39ec('0x29')&&typeof _0x307ee2[_0x39ec('0x2a')]===_0x39ec('0x29');var _0x1aac60=_0x4fde69[_0x39ec('0x2b')];var _0x49d9c0=_0x33d071?0x0:_0x307ee2[_0x39ec('0x28')];var _0x3d5020=_0x33d071?_0x4fde69[_0x39ec('0x2b')]:_0x307ee2[_0x39ec('0x28')]+_0x307ee2['limit'];var _0x240384;if(_0x3d5020>=_0x1aac60){_0x3d5020=_0x1aac60;_0x240384=0xc8;}else{_0x240384=0xce;}_0x403e30[_0x39ec('0x26')](_0x240384);return _0x403e30[_0x39ec('0x2c')](_0x39ec('0x2d'),_0x49d9c0+'-'+_0x3d5020+'/'+_0x1aac60)[_0x39ec('0x2e')](_0x4fde69);}return null;};}function patchUpdates(_0x5786c2){return function(_0x760ec9){try{jsonpatch[_0x39ec('0x2f')](_0x760ec9,_0x5786c2,!![]);}catch(_0x5bb5da){return BPromise[_0x39ec('0x30')](_0x5bb5da);}return _0x760ec9[_0x39ec('0x31')]();};}function saveUpdates(_0x54985d,_0x58002e){return function(_0xe67ebc){if(_0xe67ebc){return _0xe67ebc[_0x39ec('0x32')](_0x54985d)[_0x39ec('0x1d')](function(_0x65175c){return _0x65175c;});}return null;};}function removeEntity(_0x13abba,_0x4a36b6){return function(_0x4ac930){if(_0x4ac930){return _0x4ac930[_0x39ec('0x33')]()[_0x39ec('0x1d')](function(){var _0x5e1bdd=_0x4ac930[_0x39ec('0x34')]({'plain':!![]});var _0x3b49d0='OpenchannelAccounts';return db[_0x39ec('0x35')][_0x39ec('0x33')]({'where':{'type':_0x3b49d0,'resourceId':_0x5e1bdd['id']}})[_0x39ec('0x1d')](function(){return _0x4ac930;});})[_0x39ec('0x1d')](function(){_0x13abba[_0x39ec('0x26')](0xcc)[_0x39ec('0x27')]();});}};}function handleEntityNotFound(_0x46c859,_0x4e96bc){return function(_0x306231){if(!_0x306231){_0x46c859[_0x39ec('0x25')](0x194);}return _0x306231;};}function handleError(_0x62803,_0x6d0c36){_0x6d0c36=_0x6d0c36||0x1f4;return function(_0x1958ee){logger['error'](_0x1958ee[_0x39ec('0x36')]);if(_0x1958ee[_0x39ec('0x37')]){delete _0x1958ee[_0x39ec('0x37')];}_0x62803[_0x39ec('0x26')](_0x6d0c36)[_0x39ec('0x38')](_0x1958ee);};}exports[_0x39ec('0x39')]=function(_0x24df3c,_0x4abc34){var _0x5aa209={'include':[{'model':db[_0x39ec('0x3a')],'as':_0x39ec('0x3b')}]},_0xe0e25b={},_0xfb656c={'count':0x0,'rows':[]};var _0x1d4502=_[_0x39ec('0x3c')](db['OpenchannelAccount'][_0x39ec('0x3d')],function(_0x353ab5){return{'name':_0x353ab5[_0x39ec('0x3e')],'type':_0x353ab5['type'][_0x39ec('0x3f')]};});_0xe0e25b['model']=_[_0x39ec('0x3c')](_0x1d4502,'name');_0xe0e25b[_0x39ec('0x40')]=_['keys'](_0x24df3c['query']);_0xe0e25b['filters']=_['intersection'](_0xe0e25b['model'],_0xe0e25b[_0x39ec('0x40')]);_0x5aa209[_0x39ec('0x41')]=_['intersection'](_0xe0e25b['model'],qs[_0x39ec('0x42')](_0x24df3c[_0x39ec('0x40')]['fields']));_0x5aa209[_0x39ec('0x41')]=_0x5aa209[_0x39ec('0x41')][_0x39ec('0x43')]?_0x5aa209[_0x39ec('0x41')]:_0xe0e25b[_0x39ec('0x44')];if(!_0x24df3c['query'][_0x39ec('0x45')](_0x39ec('0x46'))){_0x5aa209['limit']=qs['limit'](_0x24df3c[_0x39ec('0x40')]['limit']);_0x5aa209[_0x39ec('0x28')]=qs[_0x39ec('0x28')](_0x24df3c[_0x39ec('0x40')][_0x39ec('0x28')]);}_0x5aa209['order']=qs[_0x39ec('0x47')](_0x24df3c['query'][_0x39ec('0x47')]);_0x5aa209[_0x39ec('0x48')]=qs[_0x39ec('0x49')](_['pick'](_0x24df3c['query'],_0xe0e25b['filters']),_0x1d4502);if(_0x24df3c['query'][_0x39ec('0x4a')]){_0x5aa209[_0x39ec('0x48')]=_[_0x39ec('0x4b')](_0x5aa209[_0x39ec('0x48')],{'$or':_[_0x39ec('0x3c')](_0x1d4502,function(_0x2159e9){if(_0x2159e9[_0x39ec('0x4c')]!==_0x39ec('0x4d')){var _0x902df2={};_0x902df2[_0x2159e9[_0x39ec('0x37')]]={'$like':'%'+_0x24df3c[_0x39ec('0x40')][_0x39ec('0x4a')]+'%'};return _0x902df2;}})});}_0x5aa209=_[_0x39ec('0x4b')]({},_0x5aa209,_0x24df3c['options']);var _0x497de8={'where':_0x5aa209[_0x39ec('0x48')]};return db[_0x39ec('0x4e')][_0x39ec('0x2b')](_0x497de8)['then'](function(_0x3ad831){_0xfb656c[_0x39ec('0x2b')]=_0x3ad831;if(_0x24df3c[_0x39ec('0x40')][_0x39ec('0x4f')]){_0x5aa209[_0x39ec('0x50')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x39ec('0x51')](_0x5aa209);})[_0x39ec('0x1d')](function(_0x1eca59){_0xfb656c[_0x39ec('0x52')]=_0x1eca59;return _0xfb656c;})[_0x39ec('0x1d')](respondWithFilteredResult(_0x4abc34,_0x5aa209))[_0x39ec('0x24')](handleError(_0x4abc34,null));};exports[_0x39ec('0x53')]=function(_0x5b11e0,_0x24bff4){var _0x38f2ed={'raw':![],'where':{'id':_0x5b11e0[_0x39ec('0x54')]['id']},'include':[{'model':db[_0x39ec('0x3a')],'as':_0x39ec('0x3b')}]},_0xde0881={};_0xde0881[_0x39ec('0x44')]=_[_0x39ec('0x55')](db['OpenchannelAccount']['rawAttributes']);_0xde0881[_0x39ec('0x40')]=_[_0x39ec('0x55')](_0x5b11e0[_0x39ec('0x40')]);_0xde0881[_0x39ec('0x49')]=_[_0x39ec('0x56')](_0xde0881[_0x39ec('0x44')],_0xde0881[_0x39ec('0x40')]);_0x38f2ed[_0x39ec('0x41')]=_[_0x39ec('0x56')](_0xde0881[_0x39ec('0x44')],qs[_0x39ec('0x42')](_0x5b11e0[_0x39ec('0x40')][_0x39ec('0x42')]));_0x38f2ed[_0x39ec('0x41')]=_0x38f2ed[_0x39ec('0x41')][_0x39ec('0x43')]?_0x38f2ed[_0x39ec('0x41')]:_0xde0881['model'];if(_0x5b11e0[_0x39ec('0x40')][_0x39ec('0x4f')]){_0x38f2ed[_0x39ec('0x50')]=[{'all':!![]}];}_0x38f2ed=_[_0x39ec('0x4b')]({},_0x38f2ed,_0x5b11e0[_0x39ec('0x57')]);return db[_0x39ec('0x4e')]['find'](_0x38f2ed)[_0x39ec('0x1d')](handleEntityNotFound(_0x24bff4,null))[_0x39ec('0x1d')](respondWithResult(_0x24bff4,null))[_0x39ec('0x24')](handleError(_0x24bff4,null));};exports[_0x39ec('0x58')]=function(_0x98e01c,_0x47dbe8){return db[_0x39ec('0x4e')][_0x39ec('0x58')](_0x98e01c['body'],{})['then'](function(_0x184007){var _0x47939d=_0x98e01c[_0x39ec('0x59')][_0x39ec('0x34')]({'plain':!![]});if(!_0x47939d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x47939d[_0x39ec('0x5a')]===_0x39ec('0x59')){var _0x1a8ea0=_0x184007['get']({'plain':!![]});var _0x51cac2='OpenchannelAccounts';return db[_0x39ec('0x5b')][_0x39ec('0x5c')]({'where':{'name':_0x51cac2,'userProfileId':_0x47939d[_0x39ec('0x5d')]},'raw':!![]})[_0x39ec('0x1d')](function(_0x5163b8){if(_0x5163b8&&_0x5163b8[_0x39ec('0x5e')]===0x0){return db[_0x39ec('0x35')]['create']({'name':_0x1a8ea0['name'],'resourceId':_0x1a8ea0['id'],'type':_0x5163b8[_0x39ec('0x37')],'sectionId':_0x5163b8['id']},{})[_0x39ec('0x1d')](function(){return _0x184007;});}else{return _0x184007;}})[_0x39ec('0x24')](function(_0x2759c9){logger[_0x39ec('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2759c9);throw _0x2759c9;});}return _0x184007;})[_0x39ec('0x1d')](respondWithResult(_0x47dbe8,0xc9))['catch'](handleError(_0x47dbe8,null));};exports[_0x39ec('0x32')]=function(_0x481ce5,_0x36f5a8){if(_0x481ce5[_0x39ec('0x5f')]['id']){delete _0x481ce5[_0x39ec('0x5f')]['id'];}return db['OpenchannelAccount'][_0x39ec('0x5c')]({'where':{'id':_0x481ce5[_0x39ec('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x39ec('0x3b')}]})['then'](handleEntityNotFound(_0x36f5a8,null))[_0x39ec('0x1d')](saveUpdates(_0x481ce5['body'],null))['then'](respondWithResult(_0x36f5a8,null))[_0x39ec('0x24')](handleError(_0x36f5a8,null));};exports['destroy']=function(_0x15c6ba,_0x5e72c0){return db[_0x39ec('0x4e')][_0x39ec('0x5c')]({'where':{'id':_0x15c6ba[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x5e72c0,null))[_0x39ec('0x1d')](removeEntity(_0x5e72c0,null))['catch'](handleError(_0x5e72c0,null));};exports[_0x39ec('0x60')]=function(_0x97136d,_0x59b788){return db['OpenchannelAccount'][_0x39ec('0x60')]()['then'](respondWithResult(_0x59b788,null))[_0x39ec('0x24')](handleError(_0x59b788,null));};exports[_0x39ec('0x61')]=function(_0xcad5d9,_0x37d1a6,_0x2cd7b3){if(_0xcad5d9[_0x39ec('0x5f')]['id']){delete _0xcad5d9['body']['id'];}return db[_0x39ec('0x4e')][_0x39ec('0x5c')]({'where':{'id':_0xcad5d9['params']['id']}})['then'](handleEntityNotFound(_0x37d1a6,null))[_0x39ec('0x1d')](function(_0x4b3e0a){if(_0x4b3e0a){_0xcad5d9[_0x39ec('0x5f')][_0x39ec('0x62')]=_0x4b3e0a['id'];return db['Disposition'][_0x39ec('0x58')](_0xcad5d9[_0x39ec('0x5f')]);}})[_0x39ec('0x1d')](respondWithResult(_0x37d1a6,null))[_0x39ec('0x24')](handleError(_0x37d1a6,null));};exports[_0x39ec('0x63')]=function(_0x913bd6,_0x125189,_0x496c23){var _0x1d8470={'raw':![],'where':{}};var _0x45f368={};var _0x334f8e={'count':0x0,'rows':[]};return db[_0x39ec('0x4e')]['findOne']({'where':{'id':_0x913bd6[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x125189,null))[_0x39ec('0x1d')](function(_0xae6aa5){if(_0xae6aa5){_0x45f368[_0x39ec('0x44')]=_[_0x39ec('0x55')](db[_0x39ec('0x64')][_0x39ec('0x3d')]);_0x45f368['query']=_[_0x39ec('0x55')](_0x913bd6['query']);_0x45f368[_0x39ec('0x49')]=_[_0x39ec('0x56')](_0x45f368['model'],_0x45f368[_0x39ec('0x40')]);_0x1d8470[_0x39ec('0x41')]=_['intersection'](_0x45f368[_0x39ec('0x44')],qs[_0x39ec('0x42')](_0x913bd6[_0x39ec('0x40')][_0x39ec('0x42')]));_0x1d8470[_0x39ec('0x41')]=_0x1d8470[_0x39ec('0x41')][_0x39ec('0x43')]?_0x1d8470[_0x39ec('0x41')]:_0x45f368[_0x39ec('0x44')];if(!_0x913bd6['query']['hasOwnProperty'](_0x39ec('0x46'))){_0x1d8470['limit']=qs[_0x39ec('0x2a')](_0x913bd6[_0x39ec('0x40')]['limit']);_0x1d8470['offset']=qs[_0x39ec('0x28')](_0x913bd6[_0x39ec('0x40')][_0x39ec('0x28')]);}_0x1d8470[_0x39ec('0x65')]=qs[_0x39ec('0x47')](_0x913bd6[_0x39ec('0x40')][_0x39ec('0x47')]);_0x1d8470[_0x39ec('0x48')]=qs[_0x39ec('0x49')](_['pick'](_0x913bd6['query'],_0x45f368['filters']));_0x1d8470[_0x39ec('0x48')]['OpenchannelAccountId']=_0xae6aa5['id'];if(_0x913bd6['query'][_0x39ec('0x4a')]){_0x1d8470['where']=_['merge'](_0x1d8470['where'],{'$or':_[_0x39ec('0x3c')](_0x1d8470[_0x39ec('0x41')],function(_0x58f748){var _0x15a505={};_0x15a505[_0x58f748]={'$like':'%'+_0x913bd6[_0x39ec('0x40')][_0x39ec('0x4a')]+'%'};return _0x15a505;})});}_0x1d8470=_[_0x39ec('0x4b')]({},_0x1d8470,_0x913bd6[_0x39ec('0x57')]);return db['Disposition'][_0x39ec('0x2b')]({'where':_0x1d8470[_0x39ec('0x48')]})[_0x39ec('0x1d')](function(_0x7af973){_0x334f8e[_0x39ec('0x2b')]=_0x7af973;if(_0x913bd6[_0x39ec('0x40')][_0x39ec('0x4f')]){_0x1d8470['include']=[{'all':!![]}];}return db[_0x39ec('0x64')]['findAll'](_0x1d8470);})[_0x39ec('0x1d')](function(_0x190e5d){_0x334f8e['rows']=_0x190e5d;return _0x334f8e;});}})[_0x39ec('0x1d')](respondWithFilteredResult(_0x125189,_0x1d8470))[_0x39ec('0x24')](handleError(_0x125189,null));};exports[_0x39ec('0x66')]=function(_0x36bd14,_0x59462e,_0x4af6b8){return db['OpenchannelAccount']['find']({'where':{'id':_0x36bd14[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x59462e,null))[_0x39ec('0x1d')](function(_0x3ec4d4){if(_0x3ec4d4){return _0x3ec4d4[_0x39ec('0x66')](_0x36bd14[_0x39ec('0x40')]['ids']);}})[_0x39ec('0x1d')](respondWithStatusCode(_0x59462e,null))['catch'](handleError(_0x59462e,null));};exports['addAnswer']=function(_0xbe83e7,_0xd6689,_0x440908){if(_0xbe83e7[_0x39ec('0x5f')]['id']){delete _0xbe83e7[_0x39ec('0x5f')]['id'];}return db['OpenchannelAccount'][_0x39ec('0x5c')]({'where':{'id':_0xbe83e7[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0xd6689,null))[_0x39ec('0x1d')](function(_0x7c7720){if(_0x7c7720){_0xbe83e7[_0x39ec('0x5f')][_0x39ec('0x62')]=_0x7c7720['id'];return db[_0x39ec('0x67')][_0x39ec('0x58')](_0xbe83e7[_0x39ec('0x5f')]);}})[_0x39ec('0x1d')](respondWithResult(_0xd6689,null))[_0x39ec('0x24')](handleError(_0xd6689,null));};exports[_0x39ec('0x68')]=function(_0x5d4ca0,_0x2c843a,_0x2ad1ed){var _0x285e09={'raw':![],'where':{}};var _0x27b07b={};var _0x37dd3d={'count':0x0,'rows':[]};return db[_0x39ec('0x4e')][_0x39ec('0x69')]({'where':{'id':_0x5d4ca0['params']['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x2c843a,null))[_0x39ec('0x1d')](function(_0x3389ec){if(_0x3389ec){_0x27b07b['model']=_[_0x39ec('0x55')](db[_0x39ec('0x67')][_0x39ec('0x3d')]);_0x27b07b[_0x39ec('0x40')]=_[_0x39ec('0x55')](_0x5d4ca0[_0x39ec('0x40')]);_0x27b07b[_0x39ec('0x49')]=_[_0x39ec('0x56')](_0x27b07b['model'],_0x27b07b[_0x39ec('0x40')]);_0x285e09[_0x39ec('0x41')]=_[_0x39ec('0x56')](_0x27b07b['model'],qs['fields'](_0x5d4ca0[_0x39ec('0x40')][_0x39ec('0x42')]));_0x285e09[_0x39ec('0x41')]=_0x285e09[_0x39ec('0x41')]['length']?_0x285e09[_0x39ec('0x41')]:_0x27b07b['model'];if(!_0x5d4ca0[_0x39ec('0x40')]['hasOwnProperty']('nolimit')){_0x285e09[_0x39ec('0x2a')]=qs[_0x39ec('0x2a')](_0x5d4ca0[_0x39ec('0x40')][_0x39ec('0x2a')]);_0x285e09[_0x39ec('0x28')]=qs[_0x39ec('0x28')](_0x5d4ca0[_0x39ec('0x40')]['offset']);}_0x285e09[_0x39ec('0x65')]=qs[_0x39ec('0x47')](_0x5d4ca0[_0x39ec('0x40')]['sort']);_0x285e09['where']=qs[_0x39ec('0x49')](_[_0x39ec('0x6a')](_0x5d4ca0[_0x39ec('0x40')],_0x27b07b[_0x39ec('0x49')]));_0x285e09[_0x39ec('0x48')]['OpenchannelAccountId']=_0x3389ec['id'];if(_0x5d4ca0[_0x39ec('0x40')][_0x39ec('0x4a')]){_0x285e09[_0x39ec('0x48')]=_[_0x39ec('0x4b')](_0x285e09[_0x39ec('0x48')],{'$or':_[_0x39ec('0x3c')](_0x285e09[_0x39ec('0x41')],function(_0x5c78c8){var _0x3f7174={};_0x3f7174[_0x5c78c8]={'$like':'%'+_0x5d4ca0['query']['filter']+'%'};return _0x3f7174;})});}_0x285e09=_['merge']({},_0x285e09,_0x5d4ca0[_0x39ec('0x57')]);return db['CannedAnswer']['count']({'where':_0x285e09['where']})[_0x39ec('0x1d')](function(_0x20c074){_0x37dd3d[_0x39ec('0x2b')]=_0x20c074;if(_0x5d4ca0[_0x39ec('0x40')][_0x39ec('0x4f')]){_0x285e09[_0x39ec('0x50')]=[{'all':!![]}];}return db[_0x39ec('0x67')][_0x39ec('0x51')](_0x285e09);})[_0x39ec('0x1d')](function(_0x284c90){_0x37dd3d[_0x39ec('0x52')]=_0x284c90;return _0x37dd3d;});}})[_0x39ec('0x1d')](respondWithFilteredResult(_0x2c843a,_0x285e09))[_0x39ec('0x24')](handleError(_0x2c843a,null));};exports['removeAnswers']=function(_0x170b78,_0x21ad72,_0x474be5){return db['OpenchannelAccount'][_0x39ec('0x5c')]({'where':{'id':_0x170b78[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x21ad72,null))['then'](function(_0x3e77a3){if(_0x3e77a3){return _0x3e77a3[_0x39ec('0x6b')](_0x170b78['query']['ids']);}})[_0x39ec('0x1d')](respondWithStatusCode(_0x21ad72,null))[_0x39ec('0x24')](handleError(_0x21ad72,null));};exports[_0x39ec('0x6c')]=function(_0x5cfbe8,_0x8c27fa,_0x472e3d){var _0x17bc45={'body':_0x5cfbe8[_0x39ec('0x5f')],'channel':_0x39ec('0x6d')};var _0x57d11a=[];var _0x4a13dd=[];var _0x1178c3={};var _0x152f7a=![];return db[_0x39ec('0x6e')][_0x39ec('0x60')]()[_0x39ec('0x1d')](function(_0x5108e7){if(!_0x5108e7){throw new db[(_0x39ec('0x6f'))][(_0x39ec('0x70'))](_0x39ec('0x71'));}_0x57d11a=_[_0x39ec('0x72')](_['keys'](_0x5108e7),[_0x39ec('0x73'),'updatedAt']);_0x4a13dd=_[_0x39ec('0x72')](_[_0x39ec('0x55')](_0x5108e7),[_0x39ec('0x73'),_0x39ec('0x74'),_0x39ec('0x75'),'ListId']);if(_0x5cfbe8[_0x39ec('0x5f')]['id']){delete _0x5cfbe8[_0x39ec('0x5f')]['id'];}if(_[_0x39ec('0x76')](_0x5cfbe8['body'][_0x39ec('0x77')])){throw new db[(_0x39ec('0x6f'))][(_0x39ec('0x70'))](_0x39ec('0x78'));}if(_[_0x39ec('0x76')](_0x5cfbe8[_0x39ec('0x5f')]['body'])||_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x5f')]===''){throw new db[(_0x39ec('0x6f'))][(_0x39ec('0x70'))](_0x39ec('0x79'));}if(_['isNil'](_0x5cfbe8['body'][_0x39ec('0x7a')])){throw new db[(_0x39ec('0x6f'))][(_0x39ec('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a13dd);}if(!_[_0x39ec('0x7b')](_0x4a13dd,_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x7a')])){throw new db[(_0x39ec('0x6f'))][(_0x39ec('0x70'))](_0x39ec('0x7c')+_0x4a13dd);}_0x1178c3[_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x7a')]]=_0x5cfbe8['body']['from'];})[_0x39ec('0x1d')](function(){return db[_0x39ec('0x4e')][_0x39ec('0x5c')]({'where':{'id':_0x5cfbe8[_0x39ec('0x54')]['id']},'include':[{'model':db[_0x39ec('0x7d')],'as':_0x39ec('0x7e'),'include':[{'model':db[_0x39ec('0x6e')],'as':_0x39ec('0x7f'),'where':_0x1178c3,'limit':0x1,'order':[[_0x39ec('0x74'),_0x39ec('0x80')]]}]},{'model':db[_0x39ec('0x81')],'as':_0x39ec('0x82')}]});})[_0x39ec('0x1d')](handleEntityNotFound(_0x8c27fa,null))[_0x39ec('0x1d')](function(_0x5d2136){if(_0x5d2136&&_0x5d2136['List']){_0x17bc45[_0x39ec('0x83')]=_0x5d2136;_0x17bc45[_0x39ec('0x84')]=_0x5d2136['Applications'];_0x17bc45['list']=_0x5d2136[_0x39ec('0x7e')];_0x17bc45[_0x39ec('0x84')]=_[_0x39ec('0x85')](_0x17bc45[_0x39ec('0x84')],[_0x39ec('0x86')],['asc']);if(_0x17bc45[_0x39ec('0x83')][_0x39ec('0x82')]){delete _0x17bc45[_0x39ec('0x83')][_0x39ec('0x82')];}if(_0x17bc45[_0x39ec('0x83')][_0x39ec('0x7e')]&&_0x17bc45[_0x39ec('0x83')]['List'][_0x39ec('0x7f')]['length']){return _0x17bc45['account'][_0x39ec('0x7e')]['Contacts'][0x0];}var _0x5dfa6c=_[_0x39ec('0x87')](_0x5cfbe8[_0x39ec('0x5f')],{'firstName':_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x77')],'ListId':_0x5d2136[_0x39ec('0x88')]});_0x5dfa6c[_0x5cfbe8[_0x39ec('0x5f')]['mapKey']]=_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x77')];return db[_0x39ec('0x6e')][_0x39ec('0x58')](_0x5dfa6c,{'fields':_0x57d11a,'raw':!![]});}})[_0x39ec('0x1d')](handleEntityNotFound(_0x8c27fa,null))[_0x39ec('0x1d')](function(_0x16ab98){_0x17bc45[_0x39ec('0x89')]=_0x16ab98;if(_0x16ab98){var _0x1a4621={'ContactId':_0x16ab98['id'],'OpenchannelAccountId':_0x5cfbe8[_0x39ec('0x54')]['id'],'from':(_0x16ab98[_0x39ec('0x8a')]||'')+'\x20'+(_0x16ab98['lastName']||'')};var _0x44bde7={'OpenchannelAccountId':_0x5cfbe8[_0x39ec('0x54')]['id'],'closed':![]};if(_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x8b')]){_0x44bde7[_0x39ec('0x8b')]=_0x5cfbe8[_0x39ec('0x5f')]['threadId'];return db[_0x39ec('0x8c')][_0x39ec('0x5c')]({'where':_0x44bde7})[_0x39ec('0x1d')](function(_0x80575a){if(_0x80575a){return[_0x80575a,![]];}_0x1a4621[_0x39ec('0x8b')]=_0x5cfbe8['body'][_0x39ec('0x8b')];_0x1a4621['externalUrl']=_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x8d')];return db[_0x39ec('0x8c')]['create'](_0x1a4621)[_0x39ec('0x1d')](function(_0x47f3d8){return[_0x47f3d8,!![]];});});}else{_0x44bde7[_0x39ec('0x8b')]=null;}_0x44bde7[_0x39ec('0x8e')]=_0x16ab98['id'];return db[_0x39ec('0x8c')][_0x39ec('0x5c')]({'where':_0x44bde7})[_0x39ec('0x1d')](function(_0x58d2d5){if(_0x58d2d5){return[_0x58d2d5,![]];}return db[_0x39ec('0x8c')][_0x39ec('0x58')](_0x1a4621)['then'](function(_0x36267e){return[_0x36267e,!![]];});});}})[_0x39ec('0x8f')](function(_0x26b2f9,_0x174939){if(_0x26b2f9){_0x152f7a=_0x174939;if(!_0x174939){var _0x565eec={'from':(_0x17bc45[_0x39ec('0x89')][_0x39ec('0x8a')]||'')+'\x20'+(_0x17bc45[_0x39ec('0x89')][_0x39ec('0x90')]||'')};if(_0x5cfbe8[_0x39ec('0x5f')]['threadId']&&_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x91')]&&_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x8b')]!=_0x5cfbe8['body'][_0x39ec('0x91')]){_0x565eec['threadId']=_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x91')];}return _0x26b2f9['update'](_0x565eec);}else{return _0x26b2f9;}}})[_0x39ec('0x1d')](function(_0x323202){_0x17bc45['interaction']=_0x323202[_0x39ec('0x34')]({'plain':!![]});_0x17bc45[_0x39ec('0x92')]['created']=_0x152f7a;if(_0x17bc45[_0x39ec('0x92')][_0x39ec('0x93')]){if(_0x17bc45[_0x39ec('0x83')][_0x39ec('0x94')]){_0x17bc45[_0x39ec('0x84')]['push']({'id':0x0,'priority':_0x17bc45[_0x39ec('0x84')]['length']+0x1,'app':_0x39ec('0x95'),'appdata':_0x39ec('0x96'),'interval':_0x39ec('0x97')});}}return db['OpenchannelMessage']['create']({'body':_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x5f')],'OpenchannelAccountId':_0x5cfbe8['params']['id'],'OpenchannelInteractionId':_0x323202['id'],'direction':'in','ContactId':_0x17bc45['contact']['id'],'AttachmentId':_0x5cfbe8[_0x39ec('0x5f')][_0x39ec('0x98')]});})[_0x39ec('0x1d')](function(_0x664e6){_0x17bc45[_0x39ec('0x23')]=_0x664e6;if(_0x17bc45[_0x39ec('0x92')][_0x39ec('0x99')]){return db['User'][_0x39ec('0x5c')]({'attributes':['id',_0x39ec('0x37')],'where':{'id':_0x17bc45[_0x39ec('0x92')][_0x39ec('0x99')]}})[_0x39ec('0x1d')](function(_0x8236b9){if(_0x8236b9){_0x17bc45['applications'][_0x39ec('0x9a')]({'id':0x0,'priority':0x0,'app':_0x39ec('0x9b'),'appdata':_0x8236b9[_0x39ec('0x37')]+','+(_0x17bc45[_0x39ec('0x83')][_0x39ec('0x9c')]||0xa),'interval':_0x39ec('0x97')});_0x17bc45[_0x39ec('0x9d')]=![];}return respondWithRpcPromise(_0x39ec('0x9e'),_0x39ec('0x9f'),_0x17bc45);});}return respondWithRpcPromise(_0x39ec('0x9e'),'startRouting',_0x17bc45);})['then'](function(_0x1ec3d7){respondWithRpcPromise(_0x39ec('0xa0'),_0x39ec('0xa0'),{'event':'notify','message':_0x1ec3d7},client9002);return _0x1ec3d7;})['then'](respondWithResult(_0x8c27fa,null))[_0x39ec('0x24')](handleError(_0x8c27fa,null));};exports[_0x39ec('0xa1')]=function(_0x3f189f,_0x661e7){var _0x4b696f=_0x3f189f[_0x39ec('0x54')]['id'];var _0x1cb3b5=_0x3f189f[_0x39ec('0x5f')];var _0x33313a=0xc8;var _0x4ccad2=null;return db[_0x39ec('0xa2')][_0x39ec('0xa3')]({'isolationLevel':db[_0x39ec('0xa2')][_0x39ec('0xa4')][_0x39ec('0xa5')]['READ_COMMITTED']},function(_0x42f137){return db[_0x39ec('0x4e')][_0x39ec('0x69')]({'where':{'id':_0x4b696f},'transaction':_0x42f137})[_0x39ec('0x1d')](function(_0x434ad1){if(_0x434ad1){return db[_0x39ec('0x81')]['destroy']({'where':{'OpenchannelAccountId':_0x4b696f},'transaction':_0x42f137})[_0x39ec('0x1d')](function(){var _0x4952f0=_[_0x39ec('0x3c')](_0x1cb3b5,function(_0x1e3697){_0x1e3697[_0x39ec('0x62')]=_0x4b696f;return _0x1e3697;});return db['OpenchannelApplication']['bulkCreate'](_0x4952f0,{'transaction':_0x42f137});});}else{_0x33313a=0x194;_0x4ccad2=[];}});})['then'](function(){if(_0x33313a!==0x194){return db[_0x39ec('0x81')][_0x39ec('0xa6')]({'where':{'OpenchannelAccountId':_0x4b696f},'order':'priority'})['then'](function(_0x486a92){_0x4ccad2=_0x486a92;});}})[_0x39ec('0x24')](function(_0x5a3afe){_0x33313a=0x1f4;logger[_0x39ec('0x21')](_0x5a3afe[_0x39ec('0x36')]);if(_0x5a3afe[_0x39ec('0x37')]){delete _0x5a3afe[_0x39ec('0x37')];}_0x4ccad2=_0x5a3afe;})[_0x39ec('0xa7')](function(){if(_0x4ccad2===null){_0x661e7[_0x39ec('0x25')](_0x33313a);}else{if(_0x33313a===0x1f4){_0x661e7[_0x39ec('0x26')](_0x33313a)['send'](_0x4ccad2);}else{_0x661e7[_0x39ec('0x26')](_0x33313a)['json'](_0x4ccad2);}}});};exports[_0x39ec('0xa8')]=function(_0xccade5,_0x14fe00,_0x5ca0ad){var _0xce83e={};var _0x3ce239={};var _0xd32348;var _0x34d12f;return db[_0x39ec('0x4e')][_0x39ec('0x69')]({'where':{'id':_0xccade5[_0x39ec('0x54')]['id']}})['then'](handleEntityNotFound(_0x14fe00,null))['then'](function(_0x6b0923){if(_0x6b0923){_0xd32348=_0x6b0923;_0x3ce239[_0x39ec('0x44')]=_[_0x39ec('0x55')](db[_0x39ec('0x81')][_0x39ec('0x3d')]);_0x3ce239['query']=_[_0x39ec('0x55')](_0xccade5[_0x39ec('0x40')]);_0x3ce239[_0x39ec('0x49')]=_[_0x39ec('0x56')](_0x3ce239['model'],_0x3ce239[_0x39ec('0x40')]);_0xce83e['attributes']=_[_0x39ec('0x56')](_0x3ce239[_0x39ec('0x44')],qs['fields'](_0xccade5[_0x39ec('0x40')]['fields']));_0xce83e[_0x39ec('0x41')]=_0xce83e[_0x39ec('0x41')]['length']?_0xce83e['attributes']:_0x3ce239[_0x39ec('0x44')];_0xce83e[_0x39ec('0x65')]=qs[_0x39ec('0x47')](_0xccade5['query'][_0x39ec('0x47')]);_0xce83e[_0x39ec('0x48')]=qs['filters'](_[_0x39ec('0x6a')](_0xccade5[_0x39ec('0x40')],_0x3ce239[_0x39ec('0x49')]));if(_0xccade5['query']['filter']){_0xce83e[_0x39ec('0x48')]=_[_0x39ec('0x4b')](_0xce83e[_0x39ec('0x48')],{'$or':_[_0x39ec('0x3c')](_0xce83e[_0x39ec('0x41')],function(_0x154a03){var _0x95d2d7={};_0x95d2d7[_0x154a03]={'$like':'%'+_0xccade5[_0x39ec('0x40')][_0x39ec('0x4a')]+'%'};return _0x95d2d7;})});}_0xce83e=_[_0x39ec('0x4b')]({},_0xce83e,_0xccade5[_0x39ec('0x57')]);return _0xd32348[_0x39ec('0xa8')](_0xce83e);}})[_0x39ec('0x1d')](function(_0x226966){if(_0x226966){_0x34d12f=_0x226966[_0x39ec('0x43')];if(!_0xccade5[_0x39ec('0x40')]['hasOwnProperty']('nolimit')){_0xce83e['limit']=qs[_0x39ec('0x2a')](_0xccade5['query']['limit']);_0xce83e[_0x39ec('0x28')]=qs[_0x39ec('0x28')](_0xccade5[_0x39ec('0x40')][_0x39ec('0x28')]);}return _0xd32348[_0x39ec('0xa8')](_0xce83e);}})['then'](function(_0x434c04){if(_0x434c04){return _0x434c04?{'count':_0x34d12f,'rows':_0x434c04}:null;}})[_0x39ec('0x1d')](respondWithResult(_0x14fe00,null))['catch'](handleError(_0x14fe00,null));};exports[_0x39ec('0xa9')]=function(_0xa29710,_0x4ec295,_0x1c9e51){var _0x51b37b={'raw':![],'where':{}};var _0xa66627={};var _0x46e872={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x39ec('0x69')]({'where':{'id':_0xa29710[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x4ec295,null))[_0x39ec('0x1d')](function(_0x50c63e){if(_0x50c63e){_0xa66627[_0x39ec('0x44')]=_[_0x39ec('0x55')](db['OpenchannelInteraction'][_0x39ec('0x3d')]);_0xa66627[_0x39ec('0x40')]=_[_0x39ec('0x55')](_0xa29710[_0x39ec('0x40')]);_0xa66627[_0x39ec('0x49')]=_[_0x39ec('0x56')](_0xa66627[_0x39ec('0x44')],_0xa66627[_0x39ec('0x40')]);_0x51b37b[_0x39ec('0x41')]=_[_0x39ec('0x56')](_0xa66627[_0x39ec('0x44')],qs[_0x39ec('0x42')](_0xa29710[_0x39ec('0x40')][_0x39ec('0x42')]));_0x51b37b[_0x39ec('0x41')]=_0x51b37b['attributes'][_0x39ec('0x43')]?_0x51b37b[_0x39ec('0x41')]:_0xa66627[_0x39ec('0x44')];if(!_0xa29710[_0x39ec('0x40')][_0x39ec('0x45')]('nolimit')){_0x51b37b[_0x39ec('0x2a')]=qs[_0x39ec('0x2a')](_0xa29710[_0x39ec('0x40')][_0x39ec('0x2a')]);_0x51b37b[_0x39ec('0x28')]=qs[_0x39ec('0x28')](_0xa29710['query']['offset']);}_0x51b37b[_0x39ec('0x65')]=qs[_0x39ec('0x47')](_0xa29710[_0x39ec('0x40')]['sort']);_0x51b37b[_0x39ec('0x48')]=qs[_0x39ec('0x49')](_['pick'](_0xa29710['query'],_0xa66627['filters']));_0x51b37b[_0x39ec('0x48')][_0x39ec('0x62')]=_0x50c63e['id'];if(_0xa29710['query'][_0x39ec('0x4a')]){_0x51b37b[_0x39ec('0x48')]=_[_0x39ec('0x4b')](_0x51b37b['where'],{'$or':_[_0x39ec('0x3c')](_0x51b37b[_0x39ec('0x41')],function(_0x97341c){var _0x3ad8ca={};_0x3ad8ca[_0x97341c]={'$like':'%'+_0xa29710['query'][_0x39ec('0x4a')]+'%'};return _0x3ad8ca;})});}_0x51b37b=_[_0x39ec('0x4b')]({},_0x51b37b,_0xa29710[_0x39ec('0x57')]);return db[_0x39ec('0x8c')][_0x39ec('0x2b')]({'where':_0x51b37b['where']})[_0x39ec('0x1d')](function(_0x2d55ef){_0x46e872[_0x39ec('0x2b')]=_0x2d55ef;if(_0xa29710[_0x39ec('0x40')][_0x39ec('0x4f')]){_0x51b37b['include']=[{'model':db['CmContact'],'as':_0x39ec('0xaa'),'required':![]},{'model':db[_0x39ec('0xab')],'as':_0x39ec('0xac'),'attributes':['name','fullname',_0x39ec('0xad')],'required':![]},{'model':db[_0x39ec('0xae')],'as':_0x39ec('0xaf'),'attributes':['id',_0x39ec('0x37'),_0x39ec('0xb0')],'where':_0xa29710['query'][_0x39ec('0xb1')]?{'id':_0xa29710[_0x39ec('0x40')]['tag']}:undefined,'required':_0xa29710['query']['tag']?!![]:![]}];}return db[_0x39ec('0x8c')][_0x39ec('0x51')](_0x51b37b);})[_0x39ec('0x1d')](function(_0x1df9dd){_0x46e872[_0x39ec('0x52')]=_0x1df9dd;return _0x46e872;});}})['then'](respondWithFilteredResult(_0x4ec295,_0x51b37b))[_0x39ec('0x24')](handleError(_0x4ec295,null));};exports[_0x39ec('0xb2')]=function(_0x53fd3c,_0x24ae47,_0xde4eb){return db['OpenchannelAccount']['find']({'where':{'id':_0x53fd3c[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x24ae47,null))[_0x39ec('0x1d')](function(_0x27b016){if(_0x27b016){return _0x27b016[_0x39ec('0xb2')](_0x53fd3c[_0x39ec('0x5f')][_0x39ec('0xb3')],_['omit'](_0x53fd3c[_0x39ec('0x5f')],[_0x39ec('0xb3'),'id'])||{})['spread'](function(_0x12378f){for(var _0x18cad7=0x0;_0x18cad7<_0x53fd3c[_0x39ec('0x5f')][_0x39ec('0xb3')][_0x39ec('0x43')];_0x18cad7+=0x1){socket['emit'](_0x39ec('0xb4'),{'UserId':Number(_0x53fd3c[_0x39ec('0x5f')][_0x39ec('0xb3')][_0x18cad7]),'OpenchannelAccountId':Number(_0x53fd3c[_0x39ec('0x54')]['id'])});}return _0x12378f;});}})[_0x39ec('0x1d')](respondWithResult(_0x24ae47,null))[_0x39ec('0x24')](handleError(_0x24ae47,null));};exports['removeAgents']=function(_0x37e2f1,_0x57d374,_0x3262cc){return db[_0x39ec('0x4e')][_0x39ec('0x5c')]({'where':{'id':_0x37e2f1['params']['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x57d374,null))[_0x39ec('0x1d')](function(_0x4fa4a9){if(_0x4fa4a9){return _0x4fa4a9[_0x39ec('0xb5')](_0x37e2f1['query'][_0x39ec('0xb3')])['then'](function(){if(_[_0x39ec('0xb6')](_0x37e2f1[_0x39ec('0x40')][_0x39ec('0xb3')])){for(var _0xf0a300=0x0;_0xf0a300<_0x37e2f1[_0x39ec('0x40')][_0x39ec('0xb3')]['length'];_0xf0a300+=0x1){socket[_0x39ec('0xb7')](_0x39ec('0xb8'),{'UserId':Number(_0x37e2f1[_0x39ec('0x40')][_0x39ec('0xb3')][_0xf0a300]),'OpenchannelAccountId':Number(_0x37e2f1['params']['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x37e2f1[_0x39ec('0x40')][_0x39ec('0xb3')]),'OpenchannelAccountId':Number(_0x37e2f1['params']['id'])});}});}})[_0x39ec('0x1d')](respondWithStatusCode(_0x57d374,null))[_0x39ec('0x24')](handleError(_0x57d374,null));};exports['getAgents']=function(_0x152d8c,_0x481aa5,_0xe88c15){var _0x3fd23c={};var _0x2b64aa={};var _0x50dcfa;var _0x29719b;return db[_0x39ec('0x4e')][_0x39ec('0x69')]({'where':{'id':_0x152d8c[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x481aa5,null))[_0x39ec('0x1d')](function(_0x4c4df9){if(_0x4c4df9){_0x50dcfa=_0x4c4df9;_0x2b64aa[_0x39ec('0x44')]=_[_0x39ec('0x55')](db[_0x39ec('0xab')][_0x39ec('0x3d')]);_0x2b64aa[_0x39ec('0x40')]=_[_0x39ec('0x55')](_0x152d8c['query']);_0x2b64aa[_0x39ec('0x49')]=_['intersection'](_0x2b64aa[_0x39ec('0x44')],_0x2b64aa[_0x39ec('0x40')]);_0x3fd23c[_0x39ec('0x41')]=_[_0x39ec('0x56')](_0x2b64aa[_0x39ec('0x44')],qs[_0x39ec('0x42')](_0x152d8c[_0x39ec('0x40')][_0x39ec('0x42')]));_0x3fd23c[_0x39ec('0x41')]=_0x3fd23c[_0x39ec('0x41')][_0x39ec('0x43')]?_0x3fd23c[_0x39ec('0x41')]:_0x2b64aa['model'];_0x3fd23c['order']=qs[_0x39ec('0x47')](_0x152d8c[_0x39ec('0x40')][_0x39ec('0x47')]);_0x3fd23c['where']=qs['filters'](_[_0x39ec('0x6a')](_0x152d8c['query'],_0x2b64aa[_0x39ec('0x49')]));if(_0x152d8c['query'][_0x39ec('0x4a')]){_0x3fd23c['where']=_[_0x39ec('0x4b')](_0x3fd23c['where'],{'$or':_[_0x39ec('0x3c')](_0x3fd23c[_0x39ec('0x41')],function(_0xa0142){var _0x1b9110={};_0x1b9110[_0xa0142]={'$like':'%'+_0x152d8c[_0x39ec('0x40')]['filter']+'%'};return _0x1b9110;})});}_0x3fd23c=_[_0x39ec('0x4b')]({},_0x3fd23c,_0x152d8c['options']);return _0x50dcfa['getAgents'](_0x3fd23c);}})[_0x39ec('0x1d')](function(_0x542b2f){if(_0x542b2f){_0x29719b=_0x542b2f[_0x39ec('0x43')];if(!_0x152d8c[_0x39ec('0x40')][_0x39ec('0x45')](_0x39ec('0x46'))){_0x3fd23c[_0x39ec('0x2a')]=qs[_0x39ec('0x2a')](_0x152d8c[_0x39ec('0x40')]['limit']);_0x3fd23c['offset']=qs[_0x39ec('0x28')](_0x152d8c['query'][_0x39ec('0x28')]);}return _0x50dcfa['getAgents'](_0x3fd23c);}})[_0x39ec('0x1d')](function(_0x2a7dbb){if(_0x2a7dbb){return _0x2a7dbb?{'count':_0x29719b,'rows':_0x2a7dbb}:null;}})[_0x39ec('0x1d')](respondWithResult(_0x481aa5,null))[_0x39ec('0x24')](handleError(_0x481aa5,null));};exports['send']=function(_0x6c1e0f,_0x566082,_0x2bb067){var _0x402d1f,_0x30bce2,_0x3855a8;if(_[_0x39ec('0x76')](_0x6c1e0f[_0x39ec('0x5f')][_0x39ec('0x5f')])||_0x6c1e0f[_0x39ec('0x5f')][_0x39ec('0x5f')]===''){throw new db['Sequelize'][(_0x39ec('0x70'))](_0x39ec('0x79'));}if(_['isNil'](_0x6c1e0f[_0x39ec('0x5f')]['to'])){}_0x402d1f=_0x6c1e0f[_0x39ec('0x5f')]['to'];return db[_0x39ec('0x4e')][_0x39ec('0x69')]({'where':{'id':_0x6c1e0f[_0x39ec('0x54')]['id']}})[_0x39ec('0x1d')](handleEntityNotFound(_0x566082,null))[_0x39ec('0x1d')](function(_0x1c2441){if(_0x1c2441){return db[_0x39ec('0x4e')][_0x39ec('0x5c')]({'where':{'id':_0x1c2441['id']},'include':[{'model':db[_0x39ec('0x7d')],'as':_0x39ec('0x7e'),'include':[{'model':db['CmContact'],'as':_0x39ec('0x7f'),'where':{[_0x1c2441[_0x39ec('0x7a')]]:_0x402d1f},'limit':0x1,'order':[[_0x39ec('0x74'),_0x39ec('0x80')]]}]}]})[_0x39ec('0x1d')](handleEntityNotFound(_0x566082,null))['then'](function(_0x165928){if(_0x165928&&_0x165928[_0x39ec('0x7e')]){_0x30bce2=_0x165928[_0x39ec('0x34')]({'plain':!![]});if(_0x30bce2[_0x39ec('0x7e')]&&_0x30bce2[_0x39ec('0x7e')][_0x39ec('0x7f')][_0x39ec('0x43')]){return _0x30bce2[_0x39ec('0x7e')][_0x39ec('0x7f')][0x0];}return db[_0x39ec('0x6e')]['create'](_[_0x39ec('0x87')](_0x6c1e0f['body'],{'firstName':_0x402d1f,[_0x165928['mapKey']]:_0x402d1f,'phone':_0x402d1f,'ListId':_0x30bce2[_0x39ec('0x88')]}));}})[_0x39ec('0x1d')](handleEntityNotFound(_0x566082,null))[_0x39ec('0x1d')](function(_0x17ad30){if(_0x17ad30){_0x3855a8=_0x17ad30;return db[_0x39ec('0x8c')][_0x39ec('0x5c')]({'where':{'ContactId':_0x3855a8['id'],'closed':![],'OpenchannelAccountId':_0x30bce2['id']}})['then'](function(_0x1f54a9){if(_0x1f54a9){return[_0x1f54a9,![]];}return db[_0x39ec('0x8c')][_0x39ec('0x58')]({'UserId':_0x6c1e0f[_0x39ec('0x59')]['id'],'ContactId':_0x3855a8['id'],'OpenchannelAccountId':_0x30bce2['id'],'lastMsgDirection':_0x39ec('0xb9'),'firstMsgDirection':_0x39ec('0xb9'),'Messages':[_['merge'](_0x6c1e0f[_0x39ec('0x5f')],{'read':![],'body':_0x6c1e0f[_0x39ec('0x5f')][_0x39ec('0x5f')],'OpenchannelAccountId':_0x30bce2['id'],'UserId':_0x6c1e0f['user']['id'],'ContactId':_0x3855a8['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x39ec('0x1d')](function(_0x470502){return[_0x470502,!![]];});});}})['spread'](function(_0x3e5dd8,_0x30b65c){if(_0x30b65c){return _0x3e5dd8;}return db[_0x39ec('0xba')][_0x39ec('0x58')](_[_0x39ec('0x4b')](_0x6c1e0f['body'],{'read':![],'body':_0x6c1e0f[_0x39ec('0x5f')][_0x39ec('0x5f')],'OpenchannelAccountId':_0x30bce2['id'],'OpenchannelInteractionId':_0x3e5dd8['id'],'UserId':_0x6c1e0f[_0x39ec('0x59')]['id'],'ContactId':_0x3855a8['id']}))['then'](function(_0x2e8181){_0x3e5dd8['dataValues']['Messages']=[];_0x3e5dd8[_0x39ec('0xbb')]['Messages'][_0x39ec('0xbc')](_0x2e8181['dataValues']);return _0x3e5dd8;});});}})[_0x39ec('0x1d')](respondWithResult(_0x566082,null))[_0x39ec('0x24')](handleError(_0x566082,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 4afa199..178aca2 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 _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update'];(function(_0x51ceb9,_0x121770){var _0x500977=function(_0x229d5f){while(--_0x229d5f){_0x51ceb9['push'](_0x51ceb9['shift']());}};_0x500977(++_0x121770);}(_0x54ef,0x112));var _0xf54e=function(_0x4e76e7,_0x31117c){_0x4e76e7=_0x4e76e7-0x0;var _0x49958f=_0x54ef[_0x4e76e7];return _0x49958f;};'use strict';var EventEmitter=require(_0xf54e('0x0'));var OpenchannelAccount=require(_0xf54e('0x1'))['db'][_0xf54e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf54e('0x3'),'afterUpdate':_0xf54e('0x4'),'afterDestroy':_0xf54e('0x5')};function emitEvent(_0x42b9b2){return function(_0x8b6bb6,_0x431e36,_0x12d43f){OpenchannelAccountEvents['emit'](_0x42b9b2+':'+_0x8b6bb6['id'],_0x8b6bb6);OpenchannelAccountEvents['emit'](_0x42b9b2,_0x8b6bb6);_0x12d43f(null);};}for(var e in events){if(events[_0xf54e('0x6')](e)){var event=events[e];OpenchannelAccount[_0xf54e('0x7')](e,emitEvent(event));}}module[_0xf54e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','update','emit'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var OpenchannelAccount=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){OpenchannelAccountEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);OpenchannelAccountEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];OpenchannelAccount[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index aaadf38..5f943d8 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(_0xe21e56,_0x3b9948){var _0x5e1e13=function(_0x1166bc){while(--_0x1166bc){_0xe21e56['push'](_0xe21e56['shift']());}};_0x5e1e13(++_0x3b9948);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x5296aa,_0x12e1bc){var _0x49169b=function(_0x295d0c){while(--_0x295d0c){_0x5296aa['push'](_0x5296aa['shift']());}};_0x49169b(++_0x12e1bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 9fd8eeb..ae01ca0 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 _0x2f3a=['http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x4f518d,_0x311497){var _0x3d47fd=function(_0x5677bf){while(--_0x5677bf){_0x4f518d['push'](_0x4f518d['shift']());}};_0x3d47fd(++_0x311497);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x295bc8,_0x5e8b6e){_0x295bc8=_0x295bc8-0x0;var _0x55ecd1=_0x2f3a[_0x295bc8];return _0x55ecd1;};'use strict';var _=require(_0xa2f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2f3('0x1'));var rs=require(_0xa2f3('0x2'));var fs=require('fs');var Redis=require(_0xa2f3('0x3'));var db=require(_0xa2f3('0x4'))['db'];var utils=require(_0xa2f3('0x5'));var logger=require(_0xa2f3('0x6'))('rpc');var config=require(_0xa2f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa2f3('0x8')][_0xa2f3('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa2f3('0xa')],{'host':_0xa2f3('0xb'),'port':0x18eb});var socket=require(_0xa2f3('0xc'))(new Redis(config[_0xa2f3('0xa')]));require('./openchannelAccount.socket')[_0xa2f3('0xd')](socket);function respondWithRpcPromise(_0x6373f7,_0x1fce68,_0x41a90c){return new BPromise(function(_0x214f68,_0x55ff83){return client[_0xa2f3('0xe')](_0x6373f7,_0x41a90c)[_0xa2f3('0xf')](function(_0x52aabd){logger[_0xa2f3('0x10')](_0xa2f3('0x11'),_0x1fce68,_0xa2f3('0x12'));logger['debug'](_0xa2f3('0x13'),_0x1fce68,_0xa2f3('0x12'),JSON[_0xa2f3('0x14')](_0x52aabd));if(_0x52aabd[_0xa2f3('0x15')]){if(_0x52aabd[_0xa2f3('0x15')][_0xa2f3('0x16')]===0x1f4){logger[_0xa2f3('0x15')](_0xa2f3('0x11'),_0x1fce68,_0x52aabd[_0xa2f3('0x15')]['message']);return _0x55ff83(_0x52aabd[_0xa2f3('0x15')][_0xa2f3('0x17')]);}logger[_0xa2f3('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x1fce68,_0x52aabd[_0xa2f3('0x15')][_0xa2f3('0x17')]);return _0x214f68(_0x52aabd['error']['message']);}else{logger[_0xa2f3('0x10')](_0xa2f3('0x11'),_0x1fce68,_0xa2f3('0x12'));_0x214f68(_0x52aabd[_0xa2f3('0x18')][_0xa2f3('0x17')]);}})[_0xa2f3('0x19')](function(_0x30be69){logger[_0xa2f3('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x1fce68,_0x30be69);_0x55ff83(_0x30be69);});});} \ No newline at end of file +var _0x3f8c=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x312634,_0x165c8e){var _0x34a887=function(_0x319519){while(--_0x319519){_0x312634['push'](_0x312634['shift']());}};_0x34a887(++_0x165c8e);}(_0x3f8c,0x104));var _0xc3f8=function(_0x4acfa4,_0x5f21d5){_0x4acfa4=_0x4acfa4-0x0;var _0x246be4=_0x3f8c[_0x4acfa4];return _0x246be4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});config[_0xc3f8('0x7')]=_[_0xc3f8('0x8')](config[_0xc3f8('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xc3f8('0x9'))(new Redis(config[_0xc3f8('0x7')]));require(_0xc3f8('0xa'))[_0xc3f8('0xb')](socket);function respondWithRpcPromise(_0x148e6f,_0x67f688,_0x445299){return new BPromise(function(_0x55ea74,_0x22736b){return client[_0xc3f8('0xc')](_0x148e6f,_0x445299)[_0xc3f8('0xd')](function(_0x4303aa){logger['info'](_0xc3f8('0xe'),_0x67f688,_0xc3f8('0xf'));logger[_0xc3f8('0x10')](_0xc3f8('0x11'),_0x67f688,'request\x20sent',JSON[_0xc3f8('0x12')](_0x4303aa));if(_0x4303aa[_0xc3f8('0x13')]){if(_0x4303aa[_0xc3f8('0x13')][_0xc3f8('0x14')]===0x1f4){logger[_0xc3f8('0x13')](_0xc3f8('0xe'),_0x67f688,_0x4303aa[_0xc3f8('0x13')][_0xc3f8('0x15')]);return _0x22736b(_0x4303aa[_0xc3f8('0x13')][_0xc3f8('0x15')]);}logger[_0xc3f8('0x13')](_0xc3f8('0xe'),_0x67f688,_0x4303aa[_0xc3f8('0x13')]['message']);return _0x55ea74(_0x4303aa[_0xc3f8('0x13')]['message']);}else{logger['info'](_0xc3f8('0xe'),_0x67f688,_0xc3f8('0xf'));_0x55ea74(_0x4303aa[_0xc3f8('0x16')][_0xc3f8('0x15')]);}})['catch'](function(_0x3e75a4){logger[_0xc3f8('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x67f688,_0x3e75a4);_0x22736b(_0x3e75a4);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 4154b13..b2ab1cb 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 _0x3ae9=['register','length','openchannelAccount:','remove','update','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3ae9,0xdb));var _0x93ae=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3ae9[_0x432682];return _0x463d05;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x93ae('0x0'),_0x93ae('0x1')];function createListener(_0x189f64,_0x4a724f){return function(_0x946abf){_0x4a724f[_0x93ae('0x2')](_0x189f64,_0x946abf);};}function removeListener(_0x2dc540,_0x2af5aa){return function(){OpenchannelAccountEvents['removeListener'](_0x2dc540,_0x2af5aa);};}exports[_0x93ae('0x3')]=function(_0x51e450){for(var _0x3a9a9c=0x0,_0x32564c=events[_0x93ae('0x4')];_0x3a9a9c<_0x32564c;_0x3a9a9c++){var _0x36e141=events[_0x3a9a9c];var _0x22761c=createListener(_0x93ae('0x5')+_0x36e141,_0x51e450);OpenchannelAccountEvents['on'](_0x36e141,_0x22761c);}}; \ No newline at end of file +var _0xff96=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x3300db,_0x373ecd){var _0x41ff14=function(_0x341553){while(--_0x341553){_0x3300db['push'](_0x3300db['shift']());}};_0x41ff14(++_0x373ecd);}(_0xff96,0x179));var _0x6ff9=function(_0x36d183,_0x321974){_0x36d183=_0x36d183-0x0;var _0x442e71=_0xff96[_0x36d183];return _0x442e71;};'use strict';var OpenchannelAccountEvents=require(_0x6ff9('0x0'));var events=[_0x6ff9('0x1'),_0x6ff9('0x2'),_0x6ff9('0x3')];function createListener(_0xa3cf6b,_0x19b956){return function(_0xc1de29){_0x19b956[_0x6ff9('0x4')](_0xa3cf6b,_0xc1de29);};}function removeListener(_0x3561d7,_0x207c06){return function(){OpenchannelAccountEvents[_0x6ff9('0x5')](_0x3561d7,_0x207c06);};}exports[_0x6ff9('0x6')]=function(_0x4adb77){for(var _0x3efaff=0x0,_0x5509ee=events['length'];_0x3efaff<_0x5509ee;_0x3efaff++){var _0x4f982b=events[_0x3efaff];var _0x5d56f4=createListener(_0x6ff9('0x7')+_0x4f982b,_0x4adb77);OpenchannelAccountEvents['on'](_0x4f982b,_0x5d56f4);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 0d08c97..079c7f0 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 _0x6b61=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','post','put','destroy','exports','multer','path'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6b61,0xce));var _0x16b6=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x6b61[_0x37a9d7];return _0x1343d3;};'use strict';var multer=require(_0x16b6('0x0'));var util=require('util');var path=require(_0x16b6('0x1'));var timeout=require(_0x16b6('0x2'));var express=require(_0x16b6('0x3'));var router=express[_0x16b6('0x4')]();var fs_extra=require(_0x16b6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x16b6('0x6'));var config=require(_0x16b6('0x7'));var controller=require('./openchannelApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x16b6('0x8')]);router['get'](_0x16b6('0x9'),auth[_0x16b6('0xa')](),controller[_0x16b6('0xb')]);router[_0x16b6('0xc')]('/',auth[_0x16b6('0xa')](),controller['create']);router[_0x16b6('0xd')](_0x16b6('0x9'),auth[_0x16b6('0xa')](),controller['update']);router['delete'](_0x16b6('0x9'),auth['isAuthenticated'](),controller[_0x16b6('0xe')]);module[_0x16b6('0xf')]=router; \ No newline at end of file +var _0xb7a1=['show','create','put','destroy','exports','util','path','fs-extra','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','/:id'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xb7a1,0x14a));var _0x1b7a=function(_0x154b09,_0xdb71b3){_0x154b09=_0x154b09-0x0;var _0x56fac2=_0xb7a1[_0x154b09];return _0x56fac2;};'use strict';var multer=require('multer');var util=require(_0x1b7a('0x0'));var path=require(_0x1b7a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b7a('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1b7a('0x3'));var config=require('../../config/environment');var controller=require(_0x1b7a('0x4'));router[_0x1b7a('0x5')]('/',auth[_0x1b7a('0x6')](),controller['index']);router[_0x1b7a('0x5')](_0x1b7a('0x7'),auth[_0x1b7a('0x6')](),controller[_0x1b7a('0x8')]);router['post']('/',auth[_0x1b7a('0x6')](),controller[_0x1b7a('0x9')]);router[_0x1b7a('0xa')](_0x1b7a('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1b7a('0x7'),auth[_0x1b7a('0x6')](),controller[_0x1b7a('0xb')]);module[_0x1b7a('0xc')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index ff2bf53..b55b089 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 _0xd3c5=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd3c5,0x1a1));var _0x5d3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd3c5[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5d3c('0x0'));module['exports']={'priority':{'type':Sequelize[_0x5d3c('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x5d3c('0x2')],'allowNull':![],'defaultValue':_0x5d3c('0x3')},'appdata':{'type':Sequelize[_0x5d3c('0x4')]()},'description':{'type':Sequelize[_0x5d3c('0x2')]},'interval':{'type':Sequelize[_0x5d3c('0x2')],'defaultValue':_0x5d3c('0x5')}}; \ No newline at end of file +var _0x2182=['exports','TEXT','STRING'];(function(_0x2d721c,_0x235bba){var _0x2168b0=function(_0x5d3861){while(--_0x5d3861){_0x2d721c['push'](_0x2d721c['shift']());}};_0x2168b0(++_0x235bba);}(_0x2182,0x1c5));var _0x2218=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2182[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x2218('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x2218('0x1')]()},'description':{'type':Sequelize[_0x2218('0x2')]},'interval':{'type':Sequelize[_0x2218('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6bfad69..559c81b 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 _0xed5b=['moment','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','create','body','update','params','find','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0xed5b,0x15a));var _0xbed5=function(_0x12ad5d,_0x2e63ed){_0x12ad5d=_0x12ad5d-0x0;var _0x45a98b=_0xed5b[_0x12ad5d];return _0x45a98b;};'use strict';var emlformat=require(_0xbed5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbed5('0x1'));var jsonpatch=require(_0xbed5('0x2'));var rp=require(_0xbed5('0x3'));var moment=require(_0xbed5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbed5('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbed5('0x6'));var _=require(_0xbed5('0x7'));var squel=require(_0xbed5('0x8'));var crypto=require(_0xbed5('0x9'));var jsforce=require(_0xbed5('0xa'));var deskjs=require(_0xbed5('0xb'));var toCsv=require(_0xbed5('0xc'));var querystring=require('querystring');var Papa=require(_0xbed5('0xd'));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(_0xbed5('0xe'));var logger=require(_0xbed5('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xbed5('0x10'));var licenseUtil=require(_0xbed5('0x11'));var db=require(_0xbed5('0x12'))['db'];function respondWithStatusCode(_0x1eb061,_0x5f1e22){_0x5f1e22=_0x5f1e22||0xcc;return function(_0x5983b6){if(_0x5983b6){return _0x1eb061[_0xbed5('0x13')](_0x5f1e22);}return _0x1eb061['status'](_0x5f1e22)[_0xbed5('0x14')]();};}function respondWithResult(_0x11284e,_0x48fb3d){_0x48fb3d=_0x48fb3d||0xc8;return function(_0x27ce86){if(_0x27ce86){return _0x11284e[_0xbed5('0x15')](_0x48fb3d)[_0xbed5('0x16')](_0x27ce86);}};}function respondWithFilteredResult(_0x112f89,_0x4f7995){return function(_0x5ee4dd){if(_0x5ee4dd){var _0x490cfa=typeof _0x4f7995[_0xbed5('0x17')]==='undefined'&&typeof _0x4f7995[_0xbed5('0x18')]===_0xbed5('0x19');var _0x44e748=_0x5ee4dd['count'];var _0xb51373=_0x490cfa?0x0:_0x4f7995['offset'];var _0xba8993=_0x490cfa?_0x5ee4dd[_0xbed5('0x1a')]:_0x4f7995[_0xbed5('0x17')]+_0x4f7995[_0xbed5('0x18')];var _0x19e3f3;if(_0xba8993>=_0x44e748){_0xba8993=_0x44e748;_0x19e3f3=0xc8;}else{_0x19e3f3=0xce;}_0x112f89[_0xbed5('0x15')](_0x19e3f3);return _0x112f89[_0xbed5('0x1b')](_0xbed5('0x1c'),_0xb51373+'-'+_0xba8993+'/'+_0x44e748)['json'](_0x5ee4dd);}return null;};}function patchUpdates(_0x5275c9){return function(_0x39ca70){try{jsonpatch['apply'](_0x39ca70,_0x5275c9,!![]);}catch(_0x13e6ea){return BPromise[_0xbed5('0x1d')](_0x13e6ea);}return _0x39ca70[_0xbed5('0x1e')]();};}function saveUpdates(_0x30164a,_0x379db){return function(_0x4d97b6){if(_0x4d97b6){return _0x4d97b6['update'](_0x30164a)[_0xbed5('0x1f')](function(_0xfc1683){return _0xfc1683;});}return null;};}function removeEntity(_0x5141e4,_0x5acb53){return function(_0x5604ba){if(_0x5604ba){return _0x5604ba[_0xbed5('0x20')]()['then'](function(){_0x5141e4[_0xbed5('0x15')](0xcc)[_0xbed5('0x14')]();});}};}function handleEntityNotFound(_0xa85f86,_0xee8fa5){return function(_0x4b14da){if(!_0x4b14da){_0xa85f86[_0xbed5('0x13')](0x194);}return _0x4b14da;};}function handleError(_0x5d55d8,_0x3f38b8){_0x3f38b8=_0x3f38b8||0x1f4;return function(_0x250533){logger[_0xbed5('0x21')](_0x250533[_0xbed5('0x22')]);if(_0x250533[_0xbed5('0x23')]){delete _0x250533[_0xbed5('0x23')];}_0x5d55d8[_0xbed5('0x15')](_0x3f38b8)[_0xbed5('0x24')](_0x250533);};}exports[_0xbed5('0x25')]=function(_0xe080b4,_0x20f77a){var _0x52ab0f={},_0x25fa68={},_0x3c5a6b={'count':0x0,'rows':[]};var _0x3348cf=_[_0xbed5('0x26')](db[_0xbed5('0x27')][_0xbed5('0x28')],function(_0x2accea){return{'name':_0x2accea[_0xbed5('0x29')],'type':_0x2accea[_0xbed5('0x2a')][_0xbed5('0x2b')]};});_0x25fa68[_0xbed5('0x2c')]=_[_0xbed5('0x26')](_0x3348cf,_0xbed5('0x23'));_0x25fa68['query']=_[_0xbed5('0x2d')](_0xe080b4[_0xbed5('0x2e')]);_0x25fa68['filters']=_[_0xbed5('0x2f')](_0x25fa68['model'],_0x25fa68['query']);_0x52ab0f['attributes']=_[_0xbed5('0x2f')](_0x25fa68[_0xbed5('0x2c')],qs[_0xbed5('0x30')](_0xe080b4[_0xbed5('0x2e')][_0xbed5('0x30')]));_0x52ab0f[_0xbed5('0x31')]=_0x52ab0f[_0xbed5('0x31')][_0xbed5('0x32')]?_0x52ab0f[_0xbed5('0x31')]:_0x25fa68['model'];if(!_0xe080b4[_0xbed5('0x2e')][_0xbed5('0x33')]('nolimit')){_0x52ab0f[_0xbed5('0x18')]=qs[_0xbed5('0x18')](_0xe080b4[_0xbed5('0x2e')][_0xbed5('0x18')]);_0x52ab0f['offset']=qs[_0xbed5('0x17')](_0xe080b4[_0xbed5('0x2e')][_0xbed5('0x17')]);}_0x52ab0f[_0xbed5('0x34')]=qs['sort'](_0xe080b4[_0xbed5('0x2e')][_0xbed5('0x35')]);_0x52ab0f[_0xbed5('0x36')]=qs[_0xbed5('0x37')](_[_0xbed5('0x38')](_0xe080b4[_0xbed5('0x2e')],_0x25fa68[_0xbed5('0x37')]),_0x3348cf);if(_0xe080b4[_0xbed5('0x2e')][_0xbed5('0x39')]){_0x52ab0f[_0xbed5('0x36')]=_['merge'](_0x52ab0f[_0xbed5('0x36')],{'$or':_[_0xbed5('0x26')](_0x3348cf,function(_0x5351d3){if(_0x5351d3[_0xbed5('0x2a')]!==_0xbed5('0x3a')){var _0x1f84a8={};_0x1f84a8[_0x5351d3['name']]={'$like':'%'+_0xe080b4['query']['filter']+'%'};return _0x1f84a8;}})});}_0x52ab0f=_[_0xbed5('0x3b')]({},_0x52ab0f,_0xe080b4[_0xbed5('0x3c')]);var _0x5c9aa3={'where':_0x52ab0f['where']};return db['OpenchannelApplication'][_0xbed5('0x1a')](_0x5c9aa3)[_0xbed5('0x1f')](function(_0xbc0198){_0x3c5a6b['count']=_0xbc0198;if(_0xe080b4[_0xbed5('0x2e')][_0xbed5('0x3d')]){_0x52ab0f['include']=[{'all':!![]}];}return db[_0xbed5('0x27')][_0xbed5('0x3e')](_0x52ab0f);})[_0xbed5('0x1f')](function(_0x39fde1){_0x3c5a6b[_0xbed5('0x3f')]=_0x39fde1;return _0x3c5a6b;})['then'](respondWithFilteredResult(_0x20f77a,_0x52ab0f))[_0xbed5('0x40')](handleError(_0x20f77a,null));};exports['show']=function(_0x246ff3,_0x321d1a){var _0x4a0afd={'raw':!![],'where':{'id':_0x246ff3['params']['id']}},_0x459610={};_0x459610[_0xbed5('0x2c')]=_[_0xbed5('0x2d')](db[_0xbed5('0x27')][_0xbed5('0x28')]);_0x459610[_0xbed5('0x2e')]=_[_0xbed5('0x2d')](_0x246ff3[_0xbed5('0x2e')]);_0x459610[_0xbed5('0x37')]=_['intersection'](_0x459610[_0xbed5('0x2c')],_0x459610['query']);_0x4a0afd[_0xbed5('0x31')]=_['intersection'](_0x459610[_0xbed5('0x2c')],qs[_0xbed5('0x30')](_0x246ff3[_0xbed5('0x2e')]['fields']));_0x4a0afd['attributes']=_0x4a0afd[_0xbed5('0x31')]['length']?_0x4a0afd[_0xbed5('0x31')]:_0x459610[_0xbed5('0x2c')];if(_0x246ff3[_0xbed5('0x2e')][_0xbed5('0x3d')]){_0x4a0afd['include']=[{'all':!![]}];}_0x4a0afd=_[_0xbed5('0x3b')]({},_0x4a0afd,_0x246ff3[_0xbed5('0x3c')]);return db[_0xbed5('0x27')]['find'](_0x4a0afd)[_0xbed5('0x1f')](handleEntityNotFound(_0x321d1a,null))[_0xbed5('0x1f')](respondWithResult(_0x321d1a,null))[_0xbed5('0x40')](handleError(_0x321d1a,null));};exports[_0xbed5('0x41')]=function(_0x30720a,_0x3132af){return db[_0xbed5('0x27')][_0xbed5('0x41')](_0x30720a[_0xbed5('0x42')],{})[_0xbed5('0x1f')](respondWithResult(_0x3132af,0xc9))[_0xbed5('0x40')](handleError(_0x3132af,null));};exports[_0xbed5('0x43')]=function(_0x255cfc,_0x3f72a){if(_0x255cfc[_0xbed5('0x42')]['id']){delete _0x255cfc[_0xbed5('0x42')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x255cfc[_0xbed5('0x44')]['id']}})[_0xbed5('0x1f')](handleEntityNotFound(_0x3f72a,null))[_0xbed5('0x1f')](saveUpdates(_0x255cfc['body'],null))[_0xbed5('0x1f')](respondWithResult(_0x3f72a,null))['catch'](handleError(_0x3f72a,null));};exports[_0xbed5('0x20')]=function(_0x17776f,_0x4aef3c){return db[_0xbed5('0x27')][_0xbed5('0x45')]({'where':{'id':_0x17776f[_0xbed5('0x44')]['id']}})[_0xbed5('0x1f')](handleEntityNotFound(_0x4aef3c,null))[_0xbed5('0x1f')](removeEntity(_0x4aef3c,null))[_0xbed5('0x40')](handleError(_0x4aef3c,null));}; \ No newline at end of file +var _0xf539=['limit','count','set','apply','reject','save','then','destroy','stack','name','send','index','map','OpenchannelApplication','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','options','include','findAll','catch','show','params','includeAll','merge','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','undefined'];(function(_0x1bd7b7,_0x18e7c4){var _0x46a408=function(_0x447563){while(--_0x447563){_0x1bd7b7['push'](_0x1bd7b7['shift']());}};_0x46a408(++_0x18e7c4);}(_0xf539,0x18e));var _0x9f53=function(_0x4bcf51,_0x3ad51a){_0x4bcf51=_0x4bcf51-0x0;var _0x25e17c=_0xf539[_0x4bcf51];return _0x25e17c;};'use strict';var emlformat=require(_0x9f53('0x0'));var rimraf=require(_0x9f53('0x1'));var zipdir=require(_0x9f53('0x2'));var jsonpatch=require(_0x9f53('0x3'));var rp=require(_0x9f53('0x4'));var moment=require(_0x9f53('0x5'));var BPromise=require(_0x9f53('0x6'));var Mustache=require('mustache');var util=require(_0x9f53('0x7'));var path=require('path');var sox=require(_0x9f53('0x8'));var csv=require('to-csv');var ejs=require(_0x9f53('0x9'));var fs=require('fs');var fs_extra=require(_0x9f53('0xa'));var _=require(_0x9f53('0xb'));var squel=require(_0x9f53('0xc'));var crypto=require('crypto');var jsforce=require(_0x9f53('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9f53('0xe'));var querystring=require(_0x9f53('0xf'));var Papa=require(_0x9f53('0x10'));var Redis=require(_0x9f53('0x11'));var authService=require(_0x9f53('0x12'));var qs=require(_0x9f53('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f53('0x14'))('api');var utils=require(_0x9f53('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9f53('0x16'))['db'];function respondWithStatusCode(_0xb07b9a,_0x311741){_0x311741=_0x311741||0xcc;return function(_0x2669c0){if(_0x2669c0){return _0xb07b9a['sendStatus'](_0x311741);}return _0xb07b9a[_0x9f53('0x17')](_0x311741)[_0x9f53('0x18')]();};}function respondWithResult(_0x31f56c,_0x24c2ef){_0x24c2ef=_0x24c2ef||0xc8;return function(_0x40724d){if(_0x40724d){return _0x31f56c[_0x9f53('0x17')](_0x24c2ef)[_0x9f53('0x19')](_0x40724d);}};}function respondWithFilteredResult(_0x5f5d6e,_0x166f06){return function(_0x469d1f){if(_0x469d1f){var _0x1af840=typeof _0x166f06[_0x9f53('0x1a')]===_0x9f53('0x1b')&&typeof _0x166f06[_0x9f53('0x1c')]===_0x9f53('0x1b');var _0x33fc2b=_0x469d1f[_0x9f53('0x1d')];var _0x587dd7=_0x1af840?0x0:_0x166f06[_0x9f53('0x1a')];var _0x23fb25=_0x1af840?_0x469d1f['count']:_0x166f06['offset']+_0x166f06[_0x9f53('0x1c')];var _0x206f25;if(_0x23fb25>=_0x33fc2b){_0x23fb25=_0x33fc2b;_0x206f25=0xc8;}else{_0x206f25=0xce;}_0x5f5d6e[_0x9f53('0x17')](_0x206f25);return _0x5f5d6e[_0x9f53('0x1e')]('Content-Range',_0x587dd7+'-'+_0x23fb25+'/'+_0x33fc2b)['json'](_0x469d1f);}return null;};}function patchUpdates(_0x5b4a68){return function(_0x355a16){try{jsonpatch[_0x9f53('0x1f')](_0x355a16,_0x5b4a68,!![]);}catch(_0x1ed87f){return BPromise[_0x9f53('0x20')](_0x1ed87f);}return _0x355a16[_0x9f53('0x21')]();};}function saveUpdates(_0x3a71d6,_0x3b5c86){return function(_0x1a5650){if(_0x1a5650){return _0x1a5650['update'](_0x3a71d6)[_0x9f53('0x22')](function(_0x1c1393){return _0x1c1393;});}return null;};}function removeEntity(_0x5f3b52,_0x361037){return function(_0x55efe4){if(_0x55efe4){return _0x55efe4[_0x9f53('0x23')]()['then'](function(){_0x5f3b52[_0x9f53('0x17')](0xcc)[_0x9f53('0x18')]();});}};}function handleEntityNotFound(_0x469146,_0x3cddfe){return function(_0x103a56){if(!_0x103a56){_0x469146['sendStatus'](0x194);}return _0x103a56;};}function handleError(_0x236fcb,_0x532493){_0x532493=_0x532493||0x1f4;return function(_0x551ade){logger['error'](_0x551ade[_0x9f53('0x24')]);if(_0x551ade['name']){delete _0x551ade[_0x9f53('0x25')];}_0x236fcb[_0x9f53('0x17')](_0x532493)[_0x9f53('0x26')](_0x551ade);};}exports[_0x9f53('0x27')]=function(_0x49b70a,_0x5906d6){var _0x268807={},_0x100732={},_0x3e5173={'count':0x0,'rows':[]};var _0x2ba4ef=_[_0x9f53('0x28')](db[_0x9f53('0x29')][_0x9f53('0x2a')],function(_0x4024fa){return{'name':_0x4024fa['fieldName'],'type':_0x4024fa['type'][_0x9f53('0x2b')]};});_0x100732[_0x9f53('0x2c')]=_['map'](_0x2ba4ef,_0x9f53('0x25'));_0x100732[_0x9f53('0x2d')]=_[_0x9f53('0x2e')](_0x49b70a[_0x9f53('0x2d')]);_0x100732[_0x9f53('0x2f')]=_[_0x9f53('0x30')](_0x100732[_0x9f53('0x2c')],_0x100732[_0x9f53('0x2d')]);_0x268807[_0x9f53('0x31')]=_[_0x9f53('0x30')](_0x100732[_0x9f53('0x2c')],qs[_0x9f53('0x32')](_0x49b70a['query'][_0x9f53('0x32')]));_0x268807['attributes']=_0x268807['attributes'][_0x9f53('0x33')]?_0x268807[_0x9f53('0x31')]:_0x100732[_0x9f53('0x2c')];if(!_0x49b70a[_0x9f53('0x2d')][_0x9f53('0x34')](_0x9f53('0x35'))){_0x268807['limit']=qs[_0x9f53('0x1c')](_0x49b70a[_0x9f53('0x2d')][_0x9f53('0x1c')]);_0x268807['offset']=qs[_0x9f53('0x1a')](_0x49b70a['query'][_0x9f53('0x1a')]);}_0x268807['order']=qs[_0x9f53('0x36')](_0x49b70a['query'][_0x9f53('0x36')]);_0x268807['where']=qs[_0x9f53('0x2f')](_[_0x9f53('0x37')](_0x49b70a[_0x9f53('0x2d')],_0x100732[_0x9f53('0x2f')]),_0x2ba4ef);if(_0x49b70a[_0x9f53('0x2d')][_0x9f53('0x38')]){_0x268807['where']=_['merge'](_0x268807[_0x9f53('0x39')],{'$or':_[_0x9f53('0x28')](_0x2ba4ef,function(_0x59d92f){if(_0x59d92f[_0x9f53('0x3a')]!=='VIRTUAL'){var _0x231156={};_0x231156[_0x59d92f['name']]={'$like':'%'+_0x49b70a[_0x9f53('0x2d')][_0x9f53('0x38')]+'%'};return _0x231156;}})});}_0x268807=_['merge']({},_0x268807,_0x49b70a[_0x9f53('0x3b')]);var _0x4fe6bc={'where':_0x268807['where']};return db['OpenchannelApplication'][_0x9f53('0x1d')](_0x4fe6bc)[_0x9f53('0x22')](function(_0x2deaa2){_0x3e5173['count']=_0x2deaa2;if(_0x49b70a[_0x9f53('0x2d')]['includeAll']){_0x268807[_0x9f53('0x3c')]=[{'all':!![]}];}return db[_0x9f53('0x29')][_0x9f53('0x3d')](_0x268807);})['then'](function(_0x2d2d1a){_0x3e5173['rows']=_0x2d2d1a;return _0x3e5173;})[_0x9f53('0x22')](respondWithFilteredResult(_0x5906d6,_0x268807))[_0x9f53('0x3e')](handleError(_0x5906d6,null));};exports[_0x9f53('0x3f')]=function(_0x15e7d7,_0x5ab426){var _0x5457e9={'raw':!![],'where':{'id':_0x15e7d7[_0x9f53('0x40')]['id']}},_0x559df9={};_0x559df9[_0x9f53('0x2c')]=_[_0x9f53('0x2e')](db['OpenchannelApplication'][_0x9f53('0x2a')]);_0x559df9[_0x9f53('0x2d')]=_['keys'](_0x15e7d7['query']);_0x559df9[_0x9f53('0x2f')]=_[_0x9f53('0x30')](_0x559df9[_0x9f53('0x2c')],_0x559df9[_0x9f53('0x2d')]);_0x5457e9[_0x9f53('0x31')]=_[_0x9f53('0x30')](_0x559df9[_0x9f53('0x2c')],qs[_0x9f53('0x32')](_0x15e7d7[_0x9f53('0x2d')][_0x9f53('0x32')]));_0x5457e9[_0x9f53('0x31')]=_0x5457e9[_0x9f53('0x31')][_0x9f53('0x33')]?_0x5457e9[_0x9f53('0x31')]:_0x559df9[_0x9f53('0x2c')];if(_0x15e7d7[_0x9f53('0x2d')][_0x9f53('0x41')]){_0x5457e9[_0x9f53('0x3c')]=[{'all':!![]}];}_0x5457e9=_[_0x9f53('0x42')]({},_0x5457e9,_0x15e7d7[_0x9f53('0x3b')]);return db[_0x9f53('0x29')][_0x9f53('0x43')](_0x5457e9)[_0x9f53('0x22')](handleEntityNotFound(_0x5ab426,null))[_0x9f53('0x22')](respondWithResult(_0x5ab426,null))[_0x9f53('0x3e')](handleError(_0x5ab426,null));};exports[_0x9f53('0x44')]=function(_0x26c478,_0x2f7766){return db[_0x9f53('0x29')][_0x9f53('0x44')](_0x26c478[_0x9f53('0x45')],{})[_0x9f53('0x22')](respondWithResult(_0x2f7766,0xc9))[_0x9f53('0x3e')](handleError(_0x2f7766,null));};exports[_0x9f53('0x46')]=function(_0x1b6b4d,_0x1bf2bf){if(_0x1b6b4d[_0x9f53('0x45')]['id']){delete _0x1b6b4d[_0x9f53('0x45')]['id'];}return db[_0x9f53('0x29')]['find']({'where':{'id':_0x1b6b4d[_0x9f53('0x40')]['id']}})[_0x9f53('0x22')](handleEntityNotFound(_0x1bf2bf,null))['then'](saveUpdates(_0x1b6b4d[_0x9f53('0x45')],null))[_0x9f53('0x22')](respondWithResult(_0x1bf2bf,null))['catch'](handleError(_0x1bf2bf,null));};exports[_0x9f53('0x23')]=function(_0x4e2e4d,_0x352164){return db[_0x9f53('0x29')][_0x9f53('0x43')]({'where':{'id':_0x4e2e4d['params']['id']}})['then'](handleEntityNotFound(_0x352164,null))['then'](removeEntity(_0x352164,null))[_0x9f53('0x3e')](handleError(_0x352164,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 82cf91b..e37604b 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 _0xba0d=['util','api','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x377996,_0x40a743){var _0x5cd9de=function(_0x4de56f){while(--_0x4de56f){_0x377996['push'](_0x377996['shift']());}};_0x5cd9de(++_0x40a743);}(_0xba0d,0x15d));var _0xdba0=function(_0x3ba5db,_0x25b506){_0x3ba5db=_0x3ba5db-0x0;var _0x49977c=_0xba0d[_0x3ba5db];return _0x49977c;};'use strict';var _=require(_0xdba0('0x0'));var util=require(_0xdba0('0x1'));var logger=require('../../config/logger')(_0xdba0('0x2'));var moment=require(_0xdba0('0x3'));var BPromise=require(_0xdba0('0x4'));var rp=require(_0xdba0('0x5'));var fs=require('fs');var path=require(_0xdba0('0x6'));var rimraf=require(_0xdba0('0x7'));var config=require('../../config/environment');var attributes=require(_0xdba0('0x8'));module['exports']=function(_0xce1aca,_0x27662b){return _0xce1aca[_0xdba0('0x9')](_0xdba0('0xa'),attributes,{'tableName':_0xdba0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdba0('0xc'),'collate':_0xdba0('0xd')});}; \ No newline at end of file +var _0x07ad=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x283b84,_0x18dba0){var _0x3c53b7=function(_0x10b183){while(--_0x10b183){_0x283b84['push'](_0x283b84['shift']());}};_0x3c53b7(++_0x18dba0);}(_0x07ad,0x176));var _0xd07a=function(_0x16e2a0,_0x499f26){_0x16e2a0=_0x16e2a0-0x0;var _0x582f15=_0x07ad[_0x16e2a0];return _0x582f15;};'use strict';var _=require(_0xd07a('0x0'));var util=require(_0xd07a('0x1'));var logger=require('../../config/logger')(_0xd07a('0x2'));var moment=require(_0xd07a('0x3'));var BPromise=require(_0xd07a('0x4'));var rp=require(_0xd07a('0x5'));var fs=require('fs');var path=require(_0xd07a('0x6'));var rimraf=require(_0xd07a('0x7'));var config=require(_0xd07a('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0xd07a('0x9')]=function(_0x3cf393,_0x551ba6){return _0x3cf393[_0xd07a('0xa')](_0xd07a('0xb'),attributes,{'tableName':_0xd07a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd07a('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 1c3a716..717f4d9 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 _0x0c3e=['stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','debug','lodash','util','ioredis','../../config/utils','rpc','jayson/promise','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s'];(function(_0x1d7b57,_0x57d302){var _0x135faa=function(_0x43c50d){while(--_0x43c50d){_0x1d7b57['push'](_0x1d7b57['shift']());}};_0x135faa(++_0x57d302);}(_0x0c3e,0x1ae));var _0xe0c3=function(_0x4e82c8,_0x563887){_0x4e82c8=_0x4e82c8-0x0;var _0x4b9718=_0x0c3e[_0x4e82c8];return _0x4b9718;};'use strict';var _=require(_0xe0c3('0x0'));var util=require(_0xe0c3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0c3('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe0c3('0x3'));var logger=require('../../config/logger')(_0xe0c3('0x4'));var config=require('../../config/environment');var jayson=require(_0xe0c3('0x5'));var client=jayson['client'][_0xe0c3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x29705d,_0x41f674,_0x2f6afa){return new BPromise(function(_0x5349ef,_0x39e166){return client[_0xe0c3('0x7')](_0x29705d,_0x2f6afa)['then'](function(_0x13261b){logger[_0xe0c3('0x8')](_0xe0c3('0x9'),_0x41f674,_0xe0c3('0xa'));logger['debug'](_0xe0c3('0xb'),_0x41f674,_0xe0c3('0xa'),JSON[_0xe0c3('0xc')](_0x13261b));if(_0x13261b[_0xe0c3('0xd')]){if(_0x13261b[_0xe0c3('0xd')][_0xe0c3('0xe')]===0x1f4){logger[_0xe0c3('0xd')](_0xe0c3('0x9'),_0x41f674,_0x13261b['error'][_0xe0c3('0xf')]);return _0x39e166(_0x13261b['error'][_0xe0c3('0xf')]);}logger[_0xe0c3('0xd')](_0xe0c3('0x9'),_0x41f674,_0x13261b['error'][_0xe0c3('0xf')]);return _0x5349ef(_0x13261b[_0xe0c3('0xd')]['message']);}else{logger[_0xe0c3('0x8')](_0xe0c3('0x9'),_0x41f674,'request\x20sent');_0x5349ef(_0x13261b[_0xe0c3('0x10')]['message']);}})[_0xe0c3('0x11')](function(_0x7b820b){logger['error'](_0xe0c3('0x9'),_0x41f674,_0x7b820b);_0x39e166(_0x7b820b);});});}exports[_0xe0c3('0x12')]=function(_0x5cd8a8){var _0x66046a=this;return new Promise(function(_0x4a47e5,_0x34e2b7){return db[_0xe0c3('0x13')][_0xe0c3('0x14')](_0x5cd8a8['body'],{'raw':_0x5cd8a8[_0xe0c3('0x15')]?_0x5cd8a8['options'][_0xe0c3('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cd8a8[_0xe0c3('0x15')]?_0x5cd8a8[_0xe0c3('0x15')][_0xe0c3('0x17')]||null:null,'attributes':_0x5cd8a8[_0xe0c3('0x15')]?_0x5cd8a8[_0xe0c3('0x15')][_0xe0c3('0x18')]||null:null,'limit':_0x5cd8a8[_0xe0c3('0x15')]?_0x5cd8a8[_0xe0c3('0x15')]['limit']||null:null})['then'](function(_0x36ee88){logger['info'](_0xe0c3('0x12'),_0x5cd8a8);logger[_0xe0c3('0x19')](_0xe0c3('0x12'),_0x5cd8a8,JSON[_0xe0c3('0xc')](_0x36ee88));_0x4a47e5(_0x36ee88);})[_0xe0c3('0x11')](function(_0x1d8fc7){logger['error'](_0xe0c3('0x12'),_0x1d8fc7[_0xe0c3('0xf')],_0x5cd8a8);_0x34e2b7(_0x66046a['error'](0x1f4,_0x1d8fc7['message']));});});}; \ No newline at end of file +var _0x29ab=['UpdateOpenchannelApplication','update','body','options','raw','limit','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x29ab,0x1e2));var _0xb29a=function(_0x55baf4,_0x1dc93a){_0x55baf4=_0x55baf4-0x0;var _0x4c5fd1=_0x29ab[_0x55baf4];return _0x4c5fd1;};'use strict';var _=require(_0xb29a('0x0'));var util=require(_0xb29a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb29a('0x2'));var db=require(_0xb29a('0x3'))['db'];var utils=require(_0xb29a('0x4'));var logger=require(_0xb29a('0x5'))(_0xb29a('0x6'));var config=require(_0xb29a('0x7'));var jayson=require(_0xb29a('0x8'));var client=jayson[_0xb29a('0x9')][_0xb29a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5561cf,_0x50632e,_0x580627){return new BPromise(function(_0x2d7891,_0x53dce6){return client['request'](_0x5561cf,_0x580627)[_0xb29a('0xb')](function(_0x41898d){logger['info'](_0xb29a('0xc'),_0x50632e,_0xb29a('0xd'));logger[_0xb29a('0xe')](_0xb29a('0xf'),_0x50632e,'request\x20sent',JSON[_0xb29a('0x10')](_0x41898d));if(_0x41898d[_0xb29a('0x11')]){if(_0x41898d[_0xb29a('0x11')]['code']===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x50632e,_0x41898d['error']['message']);return _0x53dce6(_0x41898d[_0xb29a('0x11')][_0xb29a('0x12')]);}logger[_0xb29a('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x50632e,_0x41898d[_0xb29a('0x11')][_0xb29a('0x12')]);return _0x2d7891(_0x41898d[_0xb29a('0x11')][_0xb29a('0x12')]);}else{logger[_0xb29a('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x50632e,_0xb29a('0xd'));_0x2d7891(_0x41898d[_0xb29a('0x14')][_0xb29a('0x12')]);}})[_0xb29a('0x15')](function(_0x496a1b){logger[_0xb29a('0x11')](_0xb29a('0xc'),_0x50632e,_0x496a1b);_0x53dce6(_0x496a1b);});});}exports[_0xb29a('0x16')]=function(_0x54e54f){var _0x224e2e=this;return new Promise(function(_0x2af36b,_0x3f6514){return db['OpenchannelApplication'][_0xb29a('0x17')](_0x54e54f[_0xb29a('0x18')],{'raw':_0x54e54f[_0xb29a('0x19')]?_0x54e54f[_0xb29a('0x19')][_0xb29a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54e54f['options']?_0x54e54f['options']['where']||null:null,'attributes':_0x54e54f[_0xb29a('0x19')]?_0x54e54f['options']['attributes']||null:null,'limit':_0x54e54f['options']?_0x54e54f[_0xb29a('0x19')][_0xb29a('0x1b')]||null:null})['then'](function(_0x3596f8){logger[_0xb29a('0x13')](_0xb29a('0x16'),_0x54e54f);logger['debug'](_0xb29a('0x16'),_0x54e54f,JSON['stringify'](_0x3596f8));_0x2af36b(_0x3596f8);})['catch'](function(_0x38fda5){logger['error'](_0xb29a('0x16'),_0x38fda5[_0xb29a('0x12')],_0x54e54f);_0x3f6514(_0x224e2e[_0xb29a('0x11')](0x1f4,_0x38fda5[_0xb29a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 17947da..51fb690 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 _0xe2ad=['connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','removeTags','exports','multer','util','path'];(function(_0x4782b9,_0x11caf1){var _0x33abe5=function(_0x1b3cd0){while(--_0x1b3cd0){_0x4782b9['push'](_0x4782b9['shift']());}};_0x33abe5(++_0x11caf1);}(_0xe2ad,0x93));var _0xde2a=function(_0x2fe7b9,_0x1bcf21){_0x2fe7b9=_0x2fe7b9-0x0;var _0x1836e1=_0xe2ad[_0x2fe7b9];return _0x1836e1;};'use strict';var multer=require(_0xde2a('0x0'));var util=require(_0xde2a('0x1'));var path=require(_0xde2a('0x2'));var timeout=require(_0xde2a('0x3'));var express=require('express');var router=express[_0xde2a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xde2a('0x5'));var config=require(_0xde2a('0x6'));var controller=require('./openchannelInteraction.controller');router[_0xde2a('0x7')]('/',auth[_0xde2a('0x8')](),controller['index']);router['get'](_0xde2a('0x9'),auth[_0xde2a('0x8')](),controller[_0xde2a('0xa')]);router[_0xde2a('0x7')](_0xde2a('0xb'),auth[_0xde2a('0x8')](),controller[_0xde2a('0xc')]);router['get'](_0xde2a('0xd'),auth['isAuthenticated'](),controller[_0xde2a('0xe')]);router['get'](_0xde2a('0xf'),auth['isAuthenticated'](),controller[_0xde2a('0x10')]);router['post']('/',auth[_0xde2a('0x8')](),controller['create']);router[_0xde2a('0x11')](_0xde2a('0xd'),auth[_0xde2a('0x8')](),controller[_0xde2a('0x12')]);router['post'](_0xde2a('0x13'),auth[_0xde2a('0x8')](),interaction[_0xde2a('0x14')]('openchannel',_0xde2a('0x15')),controller['addTags']);router[_0xde2a('0x16')](_0xde2a('0xb'),auth[_0xde2a('0x8')](),interaction[_0xde2a('0x14')]('openchannel',_0xde2a('0x17')),controller[_0xde2a('0x18')]);router[_0xde2a('0x19')](_0xde2a('0xb'),auth[_0xde2a('0x8')](),interaction['tracked'](_0xde2a('0x1a'),_0xde2a('0x1b')),controller['destroy']);router['delete'](_0xde2a('0x13'),auth[_0xde2a('0x8')](),controller[_0xde2a('0x1c')]);module[_0xde2a('0x1d')]=router; \ No newline at end of file +var _0xdd48=['/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xdd48,0x1d3));var _0x8dd4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xdd48[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x8dd4('0x0'));var util=require(_0x8dd4('0x1'));var path=require(_0x8dd4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8dd4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8dd4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8dd4('0x5'));var controller=require(_0x8dd4('0x6'));router[_0x8dd4('0x7')]('/',auth[_0x8dd4('0x8')](),controller['index']);router[_0x8dd4('0x7')](_0x8dd4('0x9'),auth[_0x8dd4('0x8')](),controller[_0x8dd4('0xa')]);router[_0x8dd4('0x7')](_0x8dd4('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8dd4('0x7')](_0x8dd4('0xc'),auth[_0x8dd4('0x8')](),controller[_0x8dd4('0xd')]);router[_0x8dd4('0x7')](_0x8dd4('0xe'),auth[_0x8dd4('0x8')](),controller['download']);router[_0x8dd4('0xf')]('/',auth[_0x8dd4('0x8')](),controller[_0x8dd4('0x10')]);router[_0x8dd4('0xf')](_0x8dd4('0xc'),auth[_0x8dd4('0x8')](),controller[_0x8dd4('0x11')]);router[_0x8dd4('0xf')](_0x8dd4('0x12'),auth[_0x8dd4('0x8')](),interaction[_0x8dd4('0x13')](_0x8dd4('0x14'),_0x8dd4('0x15')),controller[_0x8dd4('0x16')]);router[_0x8dd4('0x17')](_0x8dd4('0xb'),auth[_0x8dd4('0x8')](),interaction[_0x8dd4('0x13')](_0x8dd4('0x14'),_0x8dd4('0x18')),controller['update']);router[_0x8dd4('0x19')](_0x8dd4('0xb'),auth[_0x8dd4('0x8')](),interaction[_0x8dd4('0x13')](_0x8dd4('0x14'),'openchannelinteraction:destroy'),controller[_0x8dd4('0x1a')]);router['delete'](_0x8dd4('0x12'),auth[_0x8dd4('0x8')](),controller['removeTags']);module[_0x8dd4('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 0250088..f261889 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 _0x12cc=['out','ENUM','exports','BOOLEAN','DATE','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x12cc,0xc2));var _0xc12c=function(_0x1468b3,_0xb14791){_0x1468b3=_0x1468b3-0x0;var _0x41ddb8=_0x12cc[_0x1468b3];return _0x41ddb8;};'use strict';var Sequelize=require('sequelize');module[_0xc12c('0x0')]={'closed':{'type':Sequelize[_0xc12c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc12c('0x2')]},'disposition':{'type':Sequelize[_0xc12c('0x3')]},'secondDisposition':{'type':Sequelize[_0xc12c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc12c('0x2')]},'threadId':{'type':Sequelize[_0xc12c('0x3')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc12c('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xc12c('0x5')]('in',_0xc12c('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc820=['out','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x54bdc9,_0x1996ad){var _0x4e8743=function(_0x1fd121){while(--_0x1fd121){_0x54bdc9['push'](_0x54bdc9['shift']());}};_0x4e8743(++_0x1996ad);}(_0xc820,0x13f));var _0x0c82=function(_0xd4252e,_0x1e8065){_0xd4252e=_0xd4252e-0x0;var _0x4842dd=_0xc820[_0xd4252e];return _0x4842dd;};'use strict';var Sequelize=require('sequelize');module[_0x0c82('0x0')]={'closed':{'type':Sequelize[_0x0c82('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0c82('0x2')]},'disposition':{'type':Sequelize[_0x0c82('0x3')]},'secondDisposition':{'type':Sequelize[_0x0c82('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0c82('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x0c82('0x3')]},'externalUrl':{'type':Sequelize[_0x0c82('0x3')]},'lastMsgAt':{'type':Sequelize[_0x0c82('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x0c82('0x4')]('in',_0x0c82('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x0c82('0x4')]('in',_0x0c82('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x0c82('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x0c82('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index f3e4f33..6c1bf5e 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 _0xe72a=['Account','get','mkdirSync','Openchannel','closed','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','pipe','createWriteStream','out','System','read','value','renderFile','views','createPdfFromHTML','rimraf','zip-dir','util','path','ejs','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','user','catch','from','params','keys','OpenchannelInteraction','filters','model','attributes','fields','length','includeAll','include','options','find','create','body','update','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','intersection','hasOwnProperty','nolimit','order','sort','where','OpenchannelInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','findAll','rows','setTags','Tag','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','push','User','fullname','Contact','firstName','lastName','attachments','Attachment','createdAt','direction','secret','OpenchannelAccount'];(function(_0x4cf0b7,_0x560029){var _0x545f10=function(_0x993533){while(--_0x993533){_0x4cf0b7['push'](_0x4cf0b7['shift']());}};_0x545f10(++_0x560029);}(_0xe72a,0x17b));var _0xae72=function(_0x3b8c5a,_0x5ecc86){_0x3b8c5a=_0x3b8c5a-0x0;var _0x3e0e23=_0xe72a[_0x3b8c5a];return _0x3e0e23;};'use strict';var rimraf=require(_0xae72('0x0'));var zipdir=require(_0xae72('0x1'));var moment=require('moment');var util=require(_0xae72('0x2'));var path=require(_0xae72('0x3'));var ejs=require(_0xae72('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xae72('0x5'));var qs=require(_0xae72('0x6'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xae72('0x7'));var config=require('../../config/environment');var db=require(_0xae72('0x8'))['db'];config['redis']=_[_0xae72('0x9')](config['redis'],{'host':_0xae72('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xae72('0xb'))[_0xae72('0xc')](socket);function respondWithStatusCode(_0x2af5a3,_0x2f8a1e){_0x2f8a1e=_0x2f8a1e||0xcc;return function(_0x95b8ef){if(_0x95b8ef){return _0x2af5a3[_0xae72('0xd')](_0x2f8a1e);}return _0x2af5a3[_0xae72('0xe')](_0x2f8a1e)[_0xae72('0xf')]();};}function respondWithResult(_0x79ecac,_0x7ed035){_0x7ed035=_0x7ed035||0xc8;return function(_0x53a3b8){if(_0x53a3b8){return _0x79ecac['status'](_0x7ed035)[_0xae72('0x10')](_0x53a3b8);}};}function respondWithFilteredResult(_0x321026,_0x58636a){return function(_0x31a267){if(_0x31a267){var _0x55fdc4=typeof _0x58636a['offset']===_0xae72('0x11')&&typeof _0x58636a['limit']==='undefined';var _0x20c1a6=_0x31a267['count'];var _0x13940e=_0x55fdc4?0x0:_0x58636a[_0xae72('0x12')];var _0x2bcbbd=_0x55fdc4?_0x31a267['count']:_0x58636a[_0xae72('0x12')]+_0x58636a[_0xae72('0x13')];var _0x550184;if(_0x2bcbbd>=_0x20c1a6){_0x2bcbbd=_0x20c1a6;_0x550184=0xc8;}else{_0x550184=0xce;}_0x321026[_0xae72('0xe')](_0x550184);return _0x321026[_0xae72('0x14')](_0xae72('0x15'),_0x13940e+'-'+_0x2bcbbd+'/'+_0x20c1a6)[_0xae72('0x10')](_0x31a267);}return null;};}function saveUpdates(_0x39bef3){return function(_0x3f0bb0){if(_0x3f0bb0){return _0x3f0bb0['update'](_0x39bef3)[_0xae72('0x16')](function(_0x22ed0d){return _0x22ed0d;});}return null;};}function removeEntity(_0x31e4b6){return function(_0x4b4b20){if(_0x4b4b20){return _0x4b4b20['destroy']()['then'](function(){_0x31e4b6[_0xae72('0xe')](0xcc)[_0xae72('0xf')]();});}};}function handleEntityNotFound(_0x42ba7e){return function(_0x3db6c6){if(!_0x3db6c6){_0x42ba7e[_0xae72('0xd')](0x194);}return _0x3db6c6;};}function handleError(_0x2dd155,_0x369650){_0x369650=_0x369650||0x1f4;return function(_0x5bb93f){logger[_0xae72('0x17')](_0x5bb93f[_0xae72('0x18')]);if(_0x5bb93f[_0xae72('0x19')]){delete _0x5bb93f[_0xae72('0x19')];}_0x2dd155[_0xae72('0xe')](_0x369650)[_0xae72('0x1a')](_0x5bb93f);};}exports[_0xae72('0x1b')]=function(_0x21170a,_0x239c6a){var _0x4c3a39={};var _0x21b777=_[_0xae72('0x1c')](db['OpenchannelInteraction'][_0xae72('0x1d')],function(_0x278638){return{'name':_0x278638[_0xae72('0x1e')],'type':_0x278638[_0xae72('0x1f')]['key']};});_0x4c3a39=qs['getOptions'](_0x21b777,_0x21170a);return interaction['findAll']('openchannel',_0x21170a[_0xae72('0x20')],_0x21170a[_0xae72('0x21')],_0x4c3a39,_0x21b777)[_0xae72('0x16')](respondWithFilteredResult(_0x239c6a,_0x4c3a39))[_0xae72('0x22')](handleError(_0x239c6a,null));};exports['show']=function(_0xdb36c0,_0x4298c0){var _0x38987c={};if(_0xdb36c0[_0xae72('0x20')][_0xae72('0x1f')]&&_0xdb36c0[_0xae72('0x20')][_0xae72('0x1f')]==='from'){_0x38987c[_0xae72('0x23')]=_0xdb36c0[_0xae72('0x24')]['id'];}else{_0x38987c['id']=_0xdb36c0[_0xae72('0x24')]['id'];}var _0xf86a6b={'raw':![],'where':_0x38987c},_0x3a5033={};_0x3a5033['model']=_[_0xae72('0x25')](db[_0xae72('0x26')][_0xae72('0x1d')]);_0x3a5033[_0xae72('0x20')]=_[_0xae72('0x25')](_0xdb36c0['query']);_0x3a5033[_0xae72('0x27')]=_['intersection'](_0x3a5033[_0xae72('0x28')],_0x3a5033['query']);_0xf86a6b[_0xae72('0x29')]=_['intersection'](_0x3a5033['model'],qs[_0xae72('0x2a')](_0xdb36c0[_0xae72('0x20')][_0xae72('0x2a')]));_0xf86a6b[_0xae72('0x29')]=_0xf86a6b[_0xae72('0x29')][_0xae72('0x2b')]?_0xf86a6b[_0xae72('0x29')]:_0x3a5033[_0xae72('0x28')];if(_0xdb36c0[_0xae72('0x20')][_0xae72('0x2c')]){_0xf86a6b[_0xae72('0x2d')]=[{'all':!![]}];}_0xf86a6b=_['merge']({},_0xf86a6b,_0xdb36c0[_0xae72('0x2e')]);return db[_0xae72('0x26')][_0xae72('0x2f')](_0xf86a6b)[_0xae72('0x16')](handleEntityNotFound(_0x4298c0,null))['then'](respondWithResult(_0x4298c0,null))[_0xae72('0x22')](handleError(_0x4298c0,null));};exports[_0xae72('0x30')]=function(_0x4a9321,_0x465a32){return db['OpenchannelInteraction'][_0xae72('0x30')](_0x4a9321[_0xae72('0x31')],{})[_0xae72('0x16')](respondWithResult(_0x465a32,0xc9))[_0xae72('0x22')](handleError(_0x465a32,null));};exports[_0xae72('0x32')]=function(_0x3990a2,_0x189a06){if(_0x3990a2[_0xae72('0x31')]['id']){delete _0x3990a2['body']['id'];}return db['OpenchannelInteraction'][_0xae72('0x2f')]({'where':{'id':_0x3990a2[_0xae72('0x24')]['id']}})[_0xae72('0x16')](handleEntityNotFound(_0x189a06,null))[_0xae72('0x16')](saveUpdates(_0x3990a2[_0xae72('0x31')],null))['then'](respondWithResult(_0x189a06,null))[_0xae72('0x22')](handleError(_0x189a06,null));};exports['destroy']=function(_0x57d596,_0x40c799){return db['OpenchannelInteraction'][_0xae72('0x2f')]({'where':{'id':_0x57d596[_0xae72('0x24')]['id']}})[_0xae72('0x16')](handleEntityNotFound(_0x40c799,null))[_0xae72('0x16')](removeEntity(_0x40c799,null))['catch'](handleError(_0x40c799,null));};exports[_0xae72('0x33')]=function(_0x11d45b,_0xfb8971){return db[_0xae72('0x26')][_0xae72('0x33')]()[_0xae72('0x16')](respondWithResult(_0xfb8971,null))[_0xae72('0x22')](handleError(_0xfb8971,null));};exports[_0xae72('0x34')]=function(_0x9ba40f,_0x5cb841){return db['OpenchannelMessage'][_0xae72('0x2f')]({'where':{'id':_0x9ba40f[_0xae72('0x24')]['id']}})[_0xae72('0x16')](handleEntityNotFound(_0x5cb841,null))[_0xae72('0x16')](function(_0x24b377){if(_0x24b377){return _0x24b377[_0xae72('0x34')](_0x9ba40f[_0xae72('0x31')][_0xae72('0x35')],_[_0xae72('0x36')](_0x9ba40f['body'],[_0xae72('0x35'),'id'])||{});}})[_0xae72('0x16')](respondWithResult(_0x5cb841,null))[_0xae72('0x22')](handleError(_0x5cb841,null));};exports[_0xae72('0x37')]=function(_0x51633b,_0x78f92e){var _0x2c05cd={'raw':![],'where':{}};var _0x34bbb2={};var _0x2b49d9={'count':0x0,'rows':[]};return db[_0xae72('0x26')][_0xae72('0x38')]({'where':{'id':_0x51633b['params']['id']}})[_0xae72('0x16')](handleEntityNotFound(_0x78f92e,null))[_0xae72('0x16')](function(_0x346174){if(_0x346174){_0x34bbb2[_0xae72('0x28')]=_['keys'](db[_0xae72('0x39')]['rawAttributes']);_0x34bbb2['query']=_[_0xae72('0x25')](_0x51633b[_0xae72('0x20')]);_0x34bbb2[_0xae72('0x27')]=_['intersection'](_0x34bbb2[_0xae72('0x28')],_0x34bbb2[_0xae72('0x20')]);_0x2c05cd[_0xae72('0x29')]=_[_0xae72('0x3a')](_0x34bbb2['model'],qs[_0xae72('0x2a')](_0x51633b[_0xae72('0x20')][_0xae72('0x2a')]));_0x2c05cd[_0xae72('0x29')]=_0x2c05cd[_0xae72('0x29')]['length']?_0x2c05cd['attributes']:_0x34bbb2[_0xae72('0x28')];if(!_0x51633b[_0xae72('0x20')][_0xae72('0x3b')](_0xae72('0x3c'))){_0x2c05cd['limit']=qs[_0xae72('0x13')](_0x51633b[_0xae72('0x20')][_0xae72('0x13')]);_0x2c05cd['offset']=qs[_0xae72('0x12')](_0x51633b[_0xae72('0x20')][_0xae72('0x12')]);}_0x2c05cd[_0xae72('0x3d')]=qs[_0xae72('0x3e')](_0x51633b['query'][_0xae72('0x3e')]);_0x2c05cd[_0xae72('0x3f')]=qs[_0xae72('0x27')](_['pick'](_0x51633b[_0xae72('0x20')],_0x34bbb2[_0xae72('0x27')]));_0x2c05cd['where'][_0xae72('0x40')]=_0x346174['id'];if(_0x51633b[_0xae72('0x20')][_0xae72('0x41')]){_0x2c05cd[_0xae72('0x3f')]=_[_0xae72('0x42')](_0x2c05cd[_0xae72('0x3f')],{'$or':_[_0xae72('0x1c')](_0x2c05cd[_0xae72('0x29')],function(_0x537b16){var _0x24e330={};_0x24e330[_0x537b16]={'$like':'%'+_0x51633b['query']['filter']+'%'};return _0x24e330;})});}if(_0x51633b['query'][_0xae72('0x43')]){var _0x4c4c44=_0x51633b['query']['$gte'][_0xae72('0x44')](',');var _0x4b1871={};_0x4b1871[_0x4c4c44[0x0]]={'$gte':moment(_0x4c4c44[0x1])[_0xae72('0x45')](_0xae72('0x46'))};_0x2c05cd[_0xae72('0x3f')]=_['merge'](_0x2c05cd[_0xae72('0x3f')],_0x4b1871);}_0x2c05cd=_[_0xae72('0x42')]({},_0x2c05cd,_0x51633b['options']);return db['OpenchannelMessage'][_0xae72('0x47')]({'where':_0x2c05cd['where']})[_0xae72('0x16')](function(_0x517c7c){_0x2b49d9[_0xae72('0x47')]=_0x517c7c;if(_0x51633b[_0xae72('0x20')][_0xae72('0x2c')]){_0x2c05cd[_0xae72('0x2d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xae72('0x48')](_0x2c05cd);})['then'](function(_0x31bd0a){_0x2b49d9[_0xae72('0x49')]=_0x31bd0a;return _0x2b49d9;});}})[_0xae72('0x16')](respondWithFilteredResult(_0x78f92e,_0x2c05cd))[_0xae72('0x22')](handleError(_0x78f92e,null));};exports['addTags']=function(_0x591525,_0xe70674){return db[_0xae72('0x26')][_0xae72('0x2f')]({'where':{'id':_0x591525[_0xae72('0x24')]['id']}})[_0xae72('0x16')](handleEntityNotFound(_0xe70674,null))[_0xae72('0x16')](function(_0x3256dd){if(_0x3256dd){return _0x3256dd[_0xae72('0x4a')](_0x591525[_0xae72('0x31')][_0xae72('0x35')],_[_0xae72('0x36')](_0x591525[_0xae72('0x31')],['ids','id'])||{})['spread'](function(){return db[_0xae72('0x4b')][_0xae72('0x48')]({'attributes':['id',_0xae72('0x19'),'color'],'where':{'id':_0x591525['body'][_0xae72('0x35')]}});})[_0xae72('0x16')](function(_0xc721d2){socket['emit'](_0xae72('0x4c'),{'id':Number(_0x591525[_0xae72('0x24')]['id']),'tags':_0xc721d2||[]});return{'id':Number(_0x591525['params']['id']),'tags':_0xc721d2||[]};});}})[_0xae72('0x16')](respondWithResult(_0xe70674,null))[_0xae72('0x22')](handleError(_0xe70674,null));};exports[_0xae72('0x4d')]=function(_0x2c9cb8,_0x429e55){return db[_0xae72('0x26')][_0xae72('0x2f')]({'where':{'id':_0x2c9cb8[_0xae72('0x24')]['id']}})[_0xae72('0x16')](handleEntityNotFound(_0x429e55,null))['then'](function(_0x296377){if(_0x296377){return _0x296377[_0xae72('0x4d')](_0x2c9cb8[_0xae72('0x20')][_0xae72('0x35')]);}})[_0xae72('0x16')](respondWithStatusCode(_0x429e55,null))[_0xae72('0x22')](handleError(_0x429e55,null));};exports[_0xae72('0x4e')]=function(_0x331de3,_0x55e8b7){var _0xe33086=moment()[_0xae72('0x4f')]()[_0xae72('0x50')]();var _0x4a0f69=path[_0xae72('0x51')](config[_0xae72('0x52')],_0xae72('0x53'),_0xae72('0x54'),'tmp');var _0x5c639b=path[_0xae72('0x51')](config[_0xae72('0x52')],'server','files','attachments');var _0x3cea96=path[_0xae72('0x51')](_0x4a0f69,_0xe33086);var _0x25b308=util[_0xae72('0x45')]('transcript-%d-%s.zip',_0x331de3[_0xae72('0x24')]['id'],_0xe33086);var _0x34f0a2=path['join'](_0x4a0f69,_0x25b308);var _0x1a19d3=[];_0x1a19d3[_0xae72('0x55')]({'model':db[_0xae72('0x56')],'as':_0xae72('0x56'),'attributes':['id',_0xae72('0x57')],'raw':!![]});_0x1a19d3[_0xae72('0x55')]({'model':db['CmContact'],'as':_0xae72('0x58'),'attributes':['id',_0xae72('0x59'),_0xae72('0x5a')],'raw':!![]});if(_0x331de3[_0xae72('0x20')][_0xae72('0x5b')]){_0x1a19d3['push']({'model':db[_0xae72('0x5c')],'as':'Attachment','raw':!![]});}var _0x4145d5=[{'model':db[_0xae72('0x39')],'as':'Messages','attributes':['id',_0xae72('0x31'),_0xae72('0x5d'),_0xae72('0x5e'),_0xae72('0x5f'),'read'],'include':_0x1a19d3}];_0x4145d5[_0xae72('0x55')]({'model':db[_0xae72('0x60')],'as':_0xae72('0x61'),'attributes':['id',_0xae72('0x19')]});_0x4145d5['push']({'model':db[_0xae72('0x56')],'as':'Owner','attributes':['id',_0xae72('0x57')]});return db[_0xae72('0x26')]['find']({'where':{'id':_0x331de3['params']['id']},'include':_0x4145d5})['then'](handleEntityNotFound(_0x55e8b7,null))['then'](function(_0x367a43){if(_0x367a43){var _0x4cce9c=_0x367a43[_0xae72('0x62')]({'plain':!![]});fs[_0xae72('0x63')](_0x3cea96);var _0x2ea618={'channel':_0xae72('0x64'),'account':_0x4cce9c[_0xae72('0x61')][_0xae72('0x19')],'agent':_0x4cce9c['Owner']?_0x4cce9c['Owner'][_0xae72('0x57')]:'N.A.','createdAt':moment(_0x4cce9c[_0xae72('0x5d')])[_0xae72('0x45')](_0xae72('0x46'))[_0xae72('0x50')](),'closedAt':_0x4cce9c[_0xae72('0x65')]?moment(_0x4cce9c[_0xae72('0x66')])[_0xae72('0x45')](_0xae72('0x46'))[_0xae72('0x50')]():'','disposition':_0x4cce9c[_0xae72('0x67')],'visibility':_0x4cce9c[_0xae72('0x68')]?_0xae72('0x69'):_0xae72('0x6a'),'messages':_(_0x4cce9c[_0xae72('0x6b')])[_0xae72('0x41')]({'secret':![]})[_0xae72('0x1c')](function(_0x1eeef4){if(_0x1eeef4[_0xae72('0x5c')]){var _0x1a7fca=path[_0xae72('0x51')](_0x5c639b,_0x1eeef4['Attachment'][_0xae72('0x6c')]);if(fs[_0xae72('0x6d')](_0x1a7fca)){fs['createReadStream'](_0x1a7fca)[_0xae72('0x6e')](fs[_0xae72('0x6f')](path[_0xae72('0x51')](_0x3cea96,_0x1eeef4[_0xae72('0x5c')][_0xae72('0x6c')])));}}return{'date':moment(_0x1eeef4['createdAt'])[_0xae72('0x45')](_0xae72('0x46'))[_0xae72('0x50')](),'sender':_0x1eeef4[_0xae72('0x5e')]===_0xae72('0x70')?_0x1eeef4[_0xae72('0x56')]?_0x1eeef4['User']['fullname']:_0xae72('0x71'):_0x1eeef4[_0xae72('0x58')][_0xae72('0x59')]+(_0x1eeef4['Contact'][_0xae72('0x5a')]?'\x20'+_0x1eeef4[_0xae72('0x58')]['lastName']:''),'body':_0x1eeef4['Attachment']?_0x1eeef4['Attachment'][_0xae72('0x6c')]:_0x1eeef4[_0xae72('0x31')],'direction':_0x1eeef4['direction']===_0xae72('0x70')?'A':'C','secret':_0x1eeef4[_0xae72('0x5f')],'read':_0x1eeef4[_0xae72('0x72')],'attachment':_0x1eeef4['Attachment']};})[_0xae72('0x73')]()};return ejs[_0xae72('0x74')](path[_0xae72('0x51')](config['root'],_0xae72('0x53'),_0xae72('0x75'),'downloadInteraction.ejs'),{'interaction':_0x2ea618})[_0xae72('0x16')](function(_0x5b7599){var _0x5a0614=path[_0xae72('0x51')](_0x3cea96,'transcript-'+_0x4cce9c['id']+'-'+_0xe33086+'.pdf');var _0x28da1e={'path':_0x5a0614,'channel':_0xae72('0x64'),'interactionId':_0x4cce9c['id']};return pdf[_0xae72('0x76')](_0x5b7599,_0x28da1e);})['then'](function(){return new Promise(function(_0x2e0f52,_0x4e9e94){zipdir(_0x3cea96,{'saveTo':_0x34f0a2},function(_0x37f005,_0x307463){if(_0x37f005)return _0x4e9e94(_0x37f005);return _0x2e0f52(_0x307463);});})[_0xae72('0x16')](function(){return new Promise(function(_0x2c5957,_0x4c8f99){rimraf(_0x3cea96,function(_0x38934e){if(_0x38934e)_0x4c8f99(_0x38934e);return _0x2c5957();});});})[_0xae72('0x16')](function(){return _0x55e8b7[_0xae72('0x4e')](_0x34f0a2,_0x25b308,function(_0x18c6b5){if(_0x18c6b5){logger[_0xae72('0x17')]('Unable\x20to\x20delete\x20zip\x20file',_0x18c6b5);}else{fs['unlinkSync'](_0x34f0a2);}});});});}else{return _0x55e8b7['sendStatus'](0xc8);}})[_0xae72('0x22')](handleError(_0x55e8b7,null));}; \ No newline at end of file +var _0xadfc=['Account','User','Owner','Openchannel','N.A.','createdAt','closed','disposition','threadId','Public','Private','existsSync','pipe','createWriteStream','basename','out','System','lastName','value','renderFile','transcript-','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','then','error','stack','name','send','index','map','rawAttributes','type','key','findAll','openchannel','query','show','from','params','model','keys','OpenchannelInteraction','filters','attributes','intersection','fields','length','includeAll','include','merge','catch','create','body','update','find','destroy','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','toString','root','server','files','join','format','transcript-%d-%s.zip','push','fullname','CmContact','Contact','firstName','attachments','Attachment','Messages','direction','secret','read','OpenchannelAccount'];(function(_0x11569c,_0x1bea63){var _0x55e1ae=function(_0x5c4a3d){while(--_0x5c4a3d){_0x11569c['push'](_0x11569c['shift']());}};_0x55e1ae(++_0x1bea63);}(_0xadfc,0x9a));var _0xcadf=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xadfc[_0x55f8b4];return _0x2475f9;};'use strict';var rimraf=require(_0xcadf('0x0'));var zipdir=require(_0xcadf('0x1'));var moment=require(_0xcadf('0x2'));var util=require('util');var path=require(_0xcadf('0x3'));var ejs=require(_0xcadf('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xcadf('0x5'));var interaction=require(_0xcadf('0x6'));var qs=require(_0xcadf('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xcadf('0x8'))(_0xcadf('0x9'));var config=require(_0xcadf('0xa'));var db=require(_0xcadf('0xb'))['db'];config[_0xcadf('0xc')]=_[_0xcadf('0xd')](config['redis'],{'host':_0xcadf('0xe'),'port':0x18eb});var socket=require(_0xcadf('0xf'))(new Redis(config[_0xcadf('0xc')]));require(_0xcadf('0x10'))[_0xcadf('0x11')](socket);function respondWithStatusCode(_0x2f376c,_0x46cf38){_0x46cf38=_0x46cf38||0xcc;return function(_0x5b06a1){if(_0x5b06a1){return _0x2f376c[_0xcadf('0x12')](_0x46cf38);}return _0x2f376c['status'](_0x46cf38)[_0xcadf('0x13')]();};}function respondWithResult(_0x25baca,_0x10f583){_0x10f583=_0x10f583||0xc8;return function(_0x19d0ba){if(_0x19d0ba){return _0x25baca[_0xcadf('0x14')](_0x10f583)[_0xcadf('0x15')](_0x19d0ba);}};}function respondWithFilteredResult(_0x3b27c5,_0x12c209){return function(_0x6f1793){if(_0x6f1793){var _0x50080e=typeof _0x12c209[_0xcadf('0x16')]===_0xcadf('0x17')&&typeof _0x12c209[_0xcadf('0x18')]==='undefined';var _0x111143=_0x6f1793[_0xcadf('0x19')];var _0x1fc2e5=_0x50080e?0x0:_0x12c209[_0xcadf('0x16')];var _0xd88201=_0x50080e?_0x6f1793['count']:_0x12c209[_0xcadf('0x16')]+_0x12c209['limit'];var _0x36b02c;if(_0xd88201>=_0x111143){_0xd88201=_0x111143;_0x36b02c=0xc8;}else{_0x36b02c=0xce;}_0x3b27c5['status'](_0x36b02c);return _0x3b27c5['set']('Content-Range',_0x1fc2e5+'-'+_0xd88201+'/'+_0x111143)[_0xcadf('0x15')](_0x6f1793);}return null;};}function saveUpdates(_0x349067){return function(_0x4ad3e1){if(_0x4ad3e1){return _0x4ad3e1['update'](_0x349067)[_0xcadf('0x1a')](function(_0x5f2068){return _0x5f2068;});}return null;};}function removeEntity(_0x379c55){return function(_0x3eb846){if(_0x3eb846){return _0x3eb846['destroy']()[_0xcadf('0x1a')](function(){_0x379c55[_0xcadf('0x14')](0xcc)[_0xcadf('0x13')]();});}};}function handleEntityNotFound(_0x4f508d){return function(_0x183fab){if(!_0x183fab){_0x4f508d[_0xcadf('0x12')](0x194);}return _0x183fab;};}function handleError(_0x124a7d,_0x31f5db){_0x31f5db=_0x31f5db||0x1f4;return function(_0x39e586){logger[_0xcadf('0x1b')](_0x39e586[_0xcadf('0x1c')]);if(_0x39e586['name']){delete _0x39e586[_0xcadf('0x1d')];}_0x124a7d['status'](_0x31f5db)[_0xcadf('0x1e')](_0x39e586);};}exports[_0xcadf('0x1f')]=function(_0x35722e,_0x4d894c){var _0x32a47d={};var _0x399188=_[_0xcadf('0x20')](db['OpenchannelInteraction'][_0xcadf('0x21')],function(_0x5e751b){return{'name':_0x5e751b['fieldName'],'type':_0x5e751b[_0xcadf('0x22')][_0xcadf('0x23')]};});_0x32a47d=qs['getOptions'](_0x399188,_0x35722e);return interaction[_0xcadf('0x24')](_0xcadf('0x25'),_0x35722e[_0xcadf('0x26')],_0x35722e['user'],_0x32a47d,_0x399188)[_0xcadf('0x1a')](respondWithFilteredResult(_0x4d894c,_0x32a47d))['catch'](handleError(_0x4d894c,null));};exports[_0xcadf('0x27')]=function(_0x56c9c7,_0x3e0222){var _0x4f4d99={};if(_0x56c9c7[_0xcadf('0x26')][_0xcadf('0x22')]&&_0x56c9c7[_0xcadf('0x26')][_0xcadf('0x22')]==='from'){_0x4f4d99[_0xcadf('0x28')]=_0x56c9c7[_0xcadf('0x29')]['id'];}else{_0x4f4d99['id']=_0x56c9c7[_0xcadf('0x29')]['id'];}var _0x41ae62={'raw':![],'where':_0x4f4d99},_0xe80c3d={};_0xe80c3d[_0xcadf('0x2a')]=_[_0xcadf('0x2b')](db[_0xcadf('0x2c')]['rawAttributes']);_0xe80c3d['query']=_[_0xcadf('0x2b')](_0x56c9c7[_0xcadf('0x26')]);_0xe80c3d[_0xcadf('0x2d')]=_['intersection'](_0xe80c3d['model'],_0xe80c3d['query']);_0x41ae62[_0xcadf('0x2e')]=_[_0xcadf('0x2f')](_0xe80c3d[_0xcadf('0x2a')],qs[_0xcadf('0x30')](_0x56c9c7[_0xcadf('0x26')][_0xcadf('0x30')]));_0x41ae62[_0xcadf('0x2e')]=_0x41ae62[_0xcadf('0x2e')][_0xcadf('0x31')]?_0x41ae62['attributes']:_0xe80c3d[_0xcadf('0x2a')];if(_0x56c9c7[_0xcadf('0x26')][_0xcadf('0x32')]){_0x41ae62[_0xcadf('0x33')]=[{'all':!![]}];}_0x41ae62=_[_0xcadf('0x34')]({},_0x41ae62,_0x56c9c7['options']);return db[_0xcadf('0x2c')]['find'](_0x41ae62)[_0xcadf('0x1a')](handleEntityNotFound(_0x3e0222,null))[_0xcadf('0x1a')](respondWithResult(_0x3e0222,null))[_0xcadf('0x35')](handleError(_0x3e0222,null));};exports[_0xcadf('0x36')]=function(_0x18cd74,_0x5e3b90){return db[_0xcadf('0x2c')]['create'](_0x18cd74[_0xcadf('0x37')],{})[_0xcadf('0x1a')](respondWithResult(_0x5e3b90,0xc9))[_0xcadf('0x35')](handleError(_0x5e3b90,null));};exports[_0xcadf('0x38')]=function(_0x1c1ea7,_0xb7076d){if(_0x1c1ea7[_0xcadf('0x37')]['id']){delete _0x1c1ea7['body']['id'];}return db[_0xcadf('0x2c')][_0xcadf('0x39')]({'where':{'id':_0x1c1ea7[_0xcadf('0x29')]['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0xb7076d,null))[_0xcadf('0x1a')](saveUpdates(_0x1c1ea7[_0xcadf('0x37')],null))['then'](respondWithResult(_0xb7076d,null))[_0xcadf('0x35')](handleError(_0xb7076d,null));};exports[_0xcadf('0x3a')]=function(_0x26f74f,_0x43d95c){return db[_0xcadf('0x2c')][_0xcadf('0x39')]({'where':{'id':_0x26f74f[_0xcadf('0x29')]['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0x43d95c,null))['then'](removeEntity(_0x43d95c,null))[_0xcadf('0x35')](handleError(_0x43d95c,null));};exports[_0xcadf('0x3b')]=function(_0x181264,_0x1b0f5f){return db[_0xcadf('0x2c')][_0xcadf('0x3b')]()[_0xcadf('0x1a')](respondWithResult(_0x1b0f5f,null))[_0xcadf('0x35')](handleError(_0x1b0f5f,null));};exports[_0xcadf('0x3c')]=function(_0x39587b,_0x9ff752){return db[_0xcadf('0x3d')][_0xcadf('0x39')]({'where':{'id':_0x39587b['params']['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0x9ff752,null))['then'](function(_0x5d0008){if(_0x5d0008){return _0x5d0008[_0xcadf('0x3c')](_0x39587b[_0xcadf('0x37')][_0xcadf('0x3e')],_['omit'](_0x39587b[_0xcadf('0x37')],[_0xcadf('0x3e'),'id'])||{});}})[_0xcadf('0x1a')](respondWithResult(_0x9ff752,null))['catch'](handleError(_0x9ff752,null));};exports[_0xcadf('0x3f')]=function(_0xf0acc8,_0x5bc81a){var _0x2fa20={'raw':![],'where':{}};var _0x7a6962={};var _0x1282e6={'count':0x0,'rows':[]};return db[_0xcadf('0x2c')][_0xcadf('0x40')]({'where':{'id':_0xf0acc8[_0xcadf('0x29')]['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0x5bc81a,null))[_0xcadf('0x1a')](function(_0x33eba5){if(_0x33eba5){_0x7a6962['model']=_[_0xcadf('0x2b')](db[_0xcadf('0x3d')][_0xcadf('0x21')]);_0x7a6962['query']=_[_0xcadf('0x2b')](_0xf0acc8[_0xcadf('0x26')]);_0x7a6962['filters']=_[_0xcadf('0x2f')](_0x7a6962[_0xcadf('0x2a')],_0x7a6962[_0xcadf('0x26')]);_0x2fa20[_0xcadf('0x2e')]=_[_0xcadf('0x2f')](_0x7a6962[_0xcadf('0x2a')],qs['fields'](_0xf0acc8['query'][_0xcadf('0x30')]));_0x2fa20[_0xcadf('0x2e')]=_0x2fa20['attributes'][_0xcadf('0x31')]?_0x2fa20[_0xcadf('0x2e')]:_0x7a6962[_0xcadf('0x2a')];if(!_0xf0acc8[_0xcadf('0x26')][_0xcadf('0x41')](_0xcadf('0x42'))){_0x2fa20[_0xcadf('0x18')]=qs[_0xcadf('0x18')](_0xf0acc8['query'][_0xcadf('0x18')]);_0x2fa20[_0xcadf('0x16')]=qs['offset'](_0xf0acc8[_0xcadf('0x26')][_0xcadf('0x16')]);}_0x2fa20[_0xcadf('0x43')]=qs[_0xcadf('0x44')](_0xf0acc8['query']['sort']);_0x2fa20[_0xcadf('0x45')]=qs[_0xcadf('0x2d')](_[_0xcadf('0x46')](_0xf0acc8[_0xcadf('0x26')],_0x7a6962[_0xcadf('0x2d')]));_0x2fa20[_0xcadf('0x45')][_0xcadf('0x47')]=_0x33eba5['id'];if(_0xf0acc8['query'][_0xcadf('0x48')]){_0x2fa20[_0xcadf('0x45')]=_[_0xcadf('0x34')](_0x2fa20[_0xcadf('0x45')],{'$or':_[_0xcadf('0x20')](_0x2fa20[_0xcadf('0x2e')],function(_0x521e31){var _0x184266={};_0x184266[_0x521e31]={'$like':'%'+_0xf0acc8['query'][_0xcadf('0x48')]+'%'};return _0x184266;})});}if(_0xf0acc8['query']['$gte']){var _0x35b4e2=_0xf0acc8[_0xcadf('0x26')][_0xcadf('0x49')][_0xcadf('0x4a')](',');var _0x40da1b={};_0x40da1b[_0x35b4e2[0x0]]={'$gte':moment(_0x35b4e2[0x1])['format'](_0xcadf('0x4b'))};_0x2fa20[_0xcadf('0x45')]=_[_0xcadf('0x34')](_0x2fa20['where'],_0x40da1b);}_0x2fa20=_['merge']({},_0x2fa20,_0xf0acc8[_0xcadf('0x4c')]);return db[_0xcadf('0x3d')][_0xcadf('0x19')]({'where':_0x2fa20[_0xcadf('0x45')]})[_0xcadf('0x1a')](function(_0x52cf0b){_0x1282e6['count']=_0x52cf0b;if(_0xf0acc8[_0xcadf('0x26')][_0xcadf('0x32')]){_0x2fa20[_0xcadf('0x33')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xcadf('0x24')](_0x2fa20);})['then'](function(_0x10d8e9){_0x1282e6[_0xcadf('0x4d')]=_0x10d8e9;return _0x1282e6;});}})[_0xcadf('0x1a')](respondWithFilteredResult(_0x5bc81a,_0x2fa20))[_0xcadf('0x35')](handleError(_0x5bc81a,null));};exports[_0xcadf('0x4e')]=function(_0x1f1866,_0x272577){return db[_0xcadf('0x2c')]['find']({'where':{'id':_0x1f1866[_0xcadf('0x29')]['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0x272577,null))[_0xcadf('0x1a')](function(_0x4dc179){if(_0x4dc179){return _0x4dc179[_0xcadf('0x4f')](_0x1f1866[_0xcadf('0x37')][_0xcadf('0x3e')],_['omit'](_0x1f1866[_0xcadf('0x37')],[_0xcadf('0x3e'),'id'])||{})[_0xcadf('0x50')](function(){return db[_0xcadf('0x51')][_0xcadf('0x24')]({'attributes':['id',_0xcadf('0x1d'),_0xcadf('0x52')],'where':{'id':_0x1f1866[_0xcadf('0x37')][_0xcadf('0x3e')]}});})['then'](function(_0x59043f){socket[_0xcadf('0x53')](_0xcadf('0x54'),{'id':Number(_0x1f1866[_0xcadf('0x29')]['id']),'tags':_0x59043f||[]});return{'id':Number(_0x1f1866[_0xcadf('0x29')]['id']),'tags':_0x59043f||[]};});}})[_0xcadf('0x1a')](respondWithResult(_0x272577,null))['catch'](handleError(_0x272577,null));};exports['removeTags']=function(_0x52e928,_0x2d2e4e){return db['OpenchannelInteraction'][_0xcadf('0x39')]({'where':{'id':_0x52e928[_0xcadf('0x29')]['id']}})[_0xcadf('0x1a')](handleEntityNotFound(_0x2d2e4e,null))[_0xcadf('0x1a')](function(_0x4c0e85){if(_0x4c0e85){return _0x4c0e85['removeTags'](_0x52e928[_0xcadf('0x26')][_0xcadf('0x3e')]);}})[_0xcadf('0x1a')](respondWithStatusCode(_0x2d2e4e,null))[_0xcadf('0x35')](handleError(_0x2d2e4e,null));};exports['download']=function(_0xa3c838,_0x47953b){var _0x523be4=moment()['unix']()[_0xcadf('0x55')]();var _0x58bf90=path['join'](config[_0xcadf('0x56')],_0xcadf('0x57'),_0xcadf('0x58'),'tmp');var _0x18cae0=path['join'](config[_0xcadf('0x56')],_0xcadf('0x57'),'files','attachments');var _0x1bc894=path[_0xcadf('0x59')](_0x58bf90,_0x523be4);var _0x3675b2=util[_0xcadf('0x5a')](_0xcadf('0x5b'),_0xa3c838['params']['id'],_0x523be4);var _0x5da63b=path[_0xcadf('0x59')](_0x58bf90,_0x3675b2);var _0xdc371d=[];_0xdc371d[_0xcadf('0x5c')]({'model':db['User'],'as':'User','attributes':['id',_0xcadf('0x5d')],'raw':!![]});_0xdc371d['push']({'model':db[_0xcadf('0x5e')],'as':_0xcadf('0x5f'),'attributes':['id',_0xcadf('0x60'),'lastName'],'raw':!![]});if(_0xa3c838['query'][_0xcadf('0x61')]){_0xdc371d[_0xcadf('0x5c')]({'model':db[_0xcadf('0x62')],'as':_0xcadf('0x62'),'raw':!![]});}var _0x2927b2=[{'model':db[_0xcadf('0x3d')],'as':_0xcadf('0x63'),'attributes':['id',_0xcadf('0x37'),'createdAt',_0xcadf('0x64'),_0xcadf('0x65'),_0xcadf('0x66')],'include':_0xdc371d}];_0x2927b2['push']({'model':db[_0xcadf('0x67')],'as':_0xcadf('0x68'),'attributes':['id',_0xcadf('0x1d')]});_0x2927b2['push']({'model':db[_0xcadf('0x69')],'as':_0xcadf('0x6a'),'attributes':['id',_0xcadf('0x5d')]});return db[_0xcadf('0x2c')][_0xcadf('0x39')]({'where':{'id':_0xa3c838['params']['id']},'include':_0x2927b2})[_0xcadf('0x1a')](handleEntityNotFound(_0x47953b,null))[_0xcadf('0x1a')](function(_0x149650){if(_0x149650){var _0x1aa0c5=_0x149650['get']({'plain':!![]});fs['mkdirSync'](_0x1bc894);var _0xd2993d={'channel':_0xcadf('0x6b'),'account':_0x1aa0c5[_0xcadf('0x68')][_0xcadf('0x1d')],'agent':_0x1aa0c5[_0xcadf('0x6a')]?_0x1aa0c5[_0xcadf('0x6a')]['fullname']:_0xcadf('0x6c'),'createdAt':moment(_0x1aa0c5[_0xcadf('0x6d')])[_0xcadf('0x5a')](_0xcadf('0x4b'))[_0xcadf('0x55')](),'closedAt':_0x1aa0c5[_0xcadf('0x6e')]?moment(_0x1aa0c5['closedAt'])[_0xcadf('0x5a')](_0xcadf('0x4b'))[_0xcadf('0x55')]():'','disposition':_0x1aa0c5[_0xcadf('0x6f')],'visibility':_0x1aa0c5[_0xcadf('0x70')]?_0xcadf('0x71'):_0xcadf('0x72'),'messages':_(_0x1aa0c5['Messages'])[_0xcadf('0x48')]({'secret':![]})[_0xcadf('0x20')](function(_0x5ca5f1){if(_0x5ca5f1[_0xcadf('0x62')]){var _0x35c5fd=path[_0xcadf('0x59')](_0x18cae0,_0x5ca5f1[_0xcadf('0x62')]['basename']);if(fs[_0xcadf('0x73')](_0x35c5fd)){fs['createReadStream'](_0x35c5fd)[_0xcadf('0x74')](fs[_0xcadf('0x75')](path[_0xcadf('0x59')](_0x1bc894,_0x5ca5f1[_0xcadf('0x62')][_0xcadf('0x76')])));}}return{'date':moment(_0x5ca5f1['createdAt'])[_0xcadf('0x5a')](_0xcadf('0x4b'))[_0xcadf('0x55')](),'sender':_0x5ca5f1[_0xcadf('0x64')]===_0xcadf('0x77')?_0x5ca5f1[_0xcadf('0x69')]?_0x5ca5f1['User']['fullname']:_0xcadf('0x78'):_0x5ca5f1[_0xcadf('0x5f')]['firstName']+(_0x5ca5f1[_0xcadf('0x5f')][_0xcadf('0x79')]?'\x20'+_0x5ca5f1[_0xcadf('0x5f')][_0xcadf('0x79')]:''),'body':_0x5ca5f1[_0xcadf('0x62')]?_0x5ca5f1[_0xcadf('0x62')][_0xcadf('0x76')]:_0x5ca5f1[_0xcadf('0x37')],'direction':_0x5ca5f1['direction']===_0xcadf('0x77')?'A':'C','secret':_0x5ca5f1['secret'],'read':_0x5ca5f1['read'],'attachment':_0x5ca5f1[_0xcadf('0x62')]};})[_0xcadf('0x7a')]()};return ejs[_0xcadf('0x7b')](path[_0xcadf('0x59')](config[_0xcadf('0x56')],_0xcadf('0x57'),'views','downloadInteraction.ejs'),{'interaction':_0xd2993d})[_0xcadf('0x1a')](function(_0x44a258){var _0x277446=path[_0xcadf('0x59')](_0x1bc894,_0xcadf('0x7c')+_0x1aa0c5['id']+'-'+_0x523be4+_0xcadf('0x7d'));var _0x356449={'path':_0x277446,'channel':_0xcadf('0x6b'),'interactionId':_0x1aa0c5['id']};return pdf[_0xcadf('0x7e')](_0x44a258,_0x356449);})['then'](function(){return new Promise(function(_0xf960d1,_0x51b93b){zipdir(_0x1bc894,{'saveTo':_0x5da63b},function(_0x5c020f,_0x3ee112){if(_0x5c020f)return _0x51b93b(_0x5c020f);return _0xf960d1(_0x3ee112);});})[_0xcadf('0x1a')](function(){return new Promise(function(_0x2948e1,_0x32b0f9){rimraf(_0x1bc894,function(_0xb65971){if(_0xb65971)_0x32b0f9(_0xb65971);return _0x2948e1();});});})[_0xcadf('0x1a')](function(){return _0x47953b[_0xcadf('0x7f')](_0x5da63b,_0x3675b2,function(_0x196bfb){if(_0x196bfb){logger['error'](_0xcadf('0x80'),_0x196bfb);}else{fs['unlinkSync'](_0x5da63b);}});});});}else{return _0x47953b[_0xcadf('0x12')](0xc8);}})[_0xcadf('0x35')](handleError(_0x47953b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index d9e8846..e22f5f6 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 _0xf5c8=['exports','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5c8,0x1d2));var _0x8f5c=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0xf5c8[_0x2a8c21];return _0x5f3061;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x8f5c('0x0')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x8f5c('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x8f5c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8f5c('0x3'),'afterDestroy':_0x8f5c('0x4')};function emitEvent(_0x4a7f46){return function(_0x51ba35,_0x31b3af,_0x58718b){_0x51ba35['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x43414c){_0x51ba35['setDataValue'](_0x8f5c('0x5'),_0x43414c['map'](function(_0x5e4179){return{'id':_0x5e4179['id']};}));return OpenchannelMessage[_0x8f5c('0x6')]({'where':{'OpenchannelInteractionId':_0x51ba35['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8f5c('0x7')](function(_0x54c156){_0x51ba35['setDataValue'](_0x8f5c('0x8'),_0x54c156[_0x8f5c('0x9')]);OpenchannelInteractionEvents[_0x8f5c('0xa')](_0x4a7f46+':'+_0x51ba35['id'],_0x51ba35);OpenchannelInteractionEvents['emit'](_0x4a7f46,_0x51ba35);_0x58718b(null);})[_0x8f5c('0xb')](_0x58718b(null));};}for(var e in events){if(events[_0x8f5c('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x8f5c('0xd')](e,emitEvent(event));}}module[_0x8f5c('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x0d0d=['hook','events','OpenchannelInteraction','../../mysqldb','setMaxListeners','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch'];(function(_0x4925d0,_0x2e3683){var _0x936f8a=function(_0x46d2cb){while(--_0x46d2cb){_0x4925d0['push'](_0x4925d0['shift']());}};_0x936f8a(++_0x2e3683);}(_0x0d0d,0x171));var _0xd0d0=function(_0x32f7ac,_0x1d3170){_0x32f7ac=_0x32f7ac-0x0;var _0x4727c3=_0x0d0d[_0x32f7ac];return _0x4727c3;};'use strict';var EventEmitter=require(_0xd0d0('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xd0d0('0x1')];var OpenchannelMessage=require(_0xd0d0('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd0d0('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd0d0('0x4'),'afterDestroy':_0xd0d0('0x5')};function emitEvent(_0x19849b){return function(_0x1be549,_0x116809,_0x70463b){_0x1be549[_0xd0d0('0x6')]({'attributes':['id'],'raw':!![]})[_0xd0d0('0x7')](function(_0x30ef40){_0x1be549[_0xd0d0('0x8')]('Users',_0x30ef40[_0xd0d0('0x9')](function(_0x273fcc){return{'id':_0x273fcc['id']};}));return OpenchannelMessage[_0xd0d0('0xa')]({'where':{'OpenchannelInteractionId':_0x1be549['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd0d0('0x7')](function(_0x57b153){_0x1be549[_0xd0d0('0x8')](_0xd0d0('0xb'),_0x57b153[_0xd0d0('0xc')]);OpenchannelInteractionEvents[_0xd0d0('0xd')](_0x19849b+':'+_0x1be549['id'],_0x1be549);OpenchannelInteractionEvents[_0xd0d0('0xd')](_0x19849b,_0x1be549);_0x70463b(null);})[_0xd0d0('0xe')](_0x70463b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xd0d0('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 6f9c64b..1610bab 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 _0x27fa=['bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','lodash','util','../../config/logger','api','moment'];(function(_0x4bc67b,_0x51449f){var _0x2f4288=function(_0x26752a){while(--_0x26752a){_0x4bc67b['push'](_0x4bc67b['shift']());}};_0x2f4288(++_0x51449f);}(_0x27fa,0x1c3));var _0xa27f=function(_0x195907,_0x5ed072){_0x195907=_0x195907-0x0;var _0x1820f2=_0x27fa[_0x195907];return _0x1820f2;};'use strict';var _=require(_0xa27f('0x0'));var util=require(_0xa27f('0x1'));var logger=require(_0xa27f('0x2'))(_0xa27f('0x3'));var moment=require(_0xa27f('0x4'));var BPromise=require(_0xa27f('0x5'));var rp=require(_0xa27f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa27f('0x7'));var config=require(_0xa27f('0x8'));var attributes=require(_0xa27f('0x9'));module[_0xa27f('0xa')]=function(_0x8d23f8,_0x4c369a){return _0x8d23f8[_0xa27f('0xb')](_0xa27f('0xc'),attributes,{'tableName':_0xa27f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa27f('0xe'),'collate':_0xa27f('0xf'),'hooks':{'beforeUpdate':function(_0x53b310,_0x428cd6,_0x79db41){if(_0x53b310[_0xa27f('0x10')]('closed')){_0x53b310[_0xa27f('0x11')]=moment()[_0xa27f('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x79db41(null,_0x53b310);}}});}; \ No newline at end of file +var _0x16dc=['bluebird','rimraf','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','lodash','util','../../config/logger','api','moment'];(function(_0x1a3bf3,_0x30e0b4){var _0x234602=function(_0x28f0d0){while(--_0x28f0d0){_0x1a3bf3['push'](_0x1a3bf3['shift']());}};_0x234602(++_0x30e0b4);}(_0x16dc,0x113));var _0xc16d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x16dc[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc16d('0x0'));var util=require(_0xc16d('0x1'));var logger=require(_0xc16d('0x2'))(_0xc16d('0x3'));var moment=require(_0xc16d('0x4'));var BPromise=require(_0xc16d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc16d('0x6'));var config=require('../../config/environment');var attributes=require(_0xc16d('0x7'));module['exports']=function(_0x5b0e83,_0x1ad2fd){return _0x5b0e83[_0xc16d('0x8')](_0xc16d('0x9'),attributes,{'tableName':_0xc16d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc16d('0xb'),'hooks':{'beforeUpdate':function(_0x85da1,_0x3928fa,_0x1ed345){if(_0x85da1[_0xc16d('0xc')](_0xc16d('0xd'))){_0x85da1['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1ed345(null,_0x85da1);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 6c0afda..aad942c 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 _0xc233=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc233,0x1ec));var _0x3c23=function(_0x1305e3,_0x43a724){_0x1305e3=_0x1305e3-0x0;var _0x1068e9=_0xc233[_0x1305e3];return _0x1068e9;};'use strict';var _=require(_0x3c23('0x0'));var util=require(_0x3c23('0x1'));var moment=require(_0x3c23('0x2'));var BPromise=require(_0x3c23('0x3'));var rs=require(_0x3c23('0x4'));var fs=require('fs');var Redis=require(_0x3c23('0x5'));var db=require(_0x3c23('0x6'))['db'];var utils=require(_0x3c23('0x7'));var logger=require(_0x3c23('0x8'))(_0x3c23('0x9'));var config=require(_0x3c23('0xa'));var jayson=require(_0x3c23('0xb'));var client=jayson[_0x3c23('0xc')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3c23('0xd')],{'host':_0x3c23('0xe'),'port':0x18eb});var socket=require(_0x3c23('0xf'))(new Redis(config['redis']));require(_0x3c23('0x10'))[_0x3c23('0x11')](socket);function respondWithRpcPromise(_0x8ff751,_0x3de2d1,_0x4281cc){return new BPromise(function(_0x4dd5d0,_0x3fd2fe){return client[_0x3c23('0x12')](_0x8ff751,_0x4281cc)[_0x3c23('0x13')](function(_0x1475b5){logger[_0x3c23('0x14')](_0x3c23('0x15'),_0x3de2d1,'request\x20sent');logger[_0x3c23('0x16')](_0x3c23('0x17'),_0x3de2d1,_0x3c23('0x18'),JSON[_0x3c23('0x19')](_0x1475b5));if(_0x1475b5['error']){if(_0x1475b5[_0x3c23('0x1a')][_0x3c23('0x1b')]===0x1f4){logger[_0x3c23('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3de2d1,_0x1475b5[_0x3c23('0x1a')]['message']);return _0x3fd2fe(_0x1475b5[_0x3c23('0x1a')][_0x3c23('0x1c')]);}logger[_0x3c23('0x1a')](_0x3c23('0x15'),_0x3de2d1,_0x1475b5[_0x3c23('0x1a')][_0x3c23('0x1c')]);return _0x4dd5d0(_0x1475b5[_0x3c23('0x1a')]['message']);}else{logger[_0x3c23('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3de2d1,_0x3c23('0x18'));_0x4dd5d0(_0x1475b5['result'][_0x3c23('0x1c')]);}})[_0x3c23('0x1d')](function(_0x296a1c){logger[_0x3c23('0x1a')](_0x3c23('0x15'),_0x3de2d1,_0x296a1c);_0x3fd2fe(_0x296a1c);});});}exports[_0x3c23('0x1e')]=function(_0x3ee09e){var _0x580a4e=this;return new Promise(function(_0x3ee1e8,_0xdebada){return db[_0x3c23('0x1f')][_0x3c23('0x20')](_0x3ee09e[_0x3c23('0x21')],{'raw':_0x3ee09e[_0x3c23('0x22')]?_0x3ee09e[_0x3c23('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ee09e[_0x3c23('0x22')]?_0x3ee09e[_0x3c23('0x22')][_0x3c23('0x23')]||null:null,'attributes':_0x3ee09e[_0x3c23('0x22')]?_0x3ee09e[_0x3c23('0x22')][_0x3c23('0x24')]||null:null,'limit':_0x3ee09e[_0x3c23('0x22')]?_0x3ee09e[_0x3c23('0x22')][_0x3c23('0x25')]||null:null})[_0x3c23('0x13')](function(_0x1ccf06){logger[_0x3c23('0x14')](_0x3c23('0x1e'),_0x3ee09e);logger['debug'](_0x3c23('0x1e'),_0x3ee09e,JSON[_0x3c23('0x19')](_0x1ccf06));_0x3ee1e8(_0x1ccf06);})['catch'](function(_0x227841){logger[_0x3c23('0x1a')](_0x3c23('0x1e'),_0x227841[_0x3c23('0x1c')],_0x3ee09e);_0xdebada(_0x580a4e[_0x3c23('0x1a')](0x1f4,_0x227841['message']));});});};exports[_0x3c23('0x26')]=function(_0x3654af){return new Promise(function(_0x37808a,_0x4afe5c){return db[_0x3c23('0x1f')][_0x3c23('0x27')]({'where':_0x3654af[_0x3c23('0x22')]?_0x3654af[_0x3c23('0x22')]['where']||null:null})['then'](function(_0x2462b9){if(_0x2462b9){return _0x2462b9[_0x3c23('0x28')](_0x3654af[_0x3c23('0x21')][_0x3c23('0x29')],_[_0x3c23('0x2a')](_0x3654af[_0x3c23('0x21')],['ids','id'])||{});}})[_0x3c23('0x2b')](function(_0x266e13){logger[_0x3c23('0x14')](_0x3c23('0x2c'),_0x3654af);logger[_0x3c23('0x16')](_0x3c23('0x2c'),_0x3654af,JSON['stringify'](_0x266e13));_0x37808a(_0x266e13);})['catch'](function(_0x77f6f5){logger[_0x3c23('0x1a')](_0x3c23('0x2c'),_0x77f6f5[_0x3c23('0x1c')],_0x3654af);_0x4afe5c(_this[_0x3c23('0x1a')](0x1f4,_0x77f6f5[_0x3c23('0x1c')]));});});}; \ No newline at end of file +var _0x5100=['options','limit','catch','find','where','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body'];(function(_0x67ad7,_0x35567e){var _0x50dab2=function(_0x59c2e3){while(--_0x59c2e3){_0x67ad7['push'](_0x67ad7['shift']());}};_0x50dab2(++_0x35567e);}(_0x5100,0xac));var _0x0510=function(_0xf46a96,_0xc6539){_0xf46a96=_0xf46a96-0x0;var _0x464aad=_0x5100[_0xf46a96];return _0x464aad;};'use strict';var _=require(_0x0510('0x0'));var util=require(_0x0510('0x1'));var moment=require(_0x0510('0x2'));var BPromise=require(_0x0510('0x3'));var rs=require(_0x0510('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0510('0x5'))['db'];var utils=require(_0x0510('0x6'));var logger=require(_0x0510('0x7'))(_0x0510('0x8'));var config=require(_0x0510('0x9'));var jayson=require(_0x0510('0xa'));var client=jayson[_0x0510('0xb')][_0x0510('0xc')]({'port':0x232a});config[_0x0510('0xd')]=_[_0x0510('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0510('0xf'))(new Redis(config[_0x0510('0xd')]));require(_0x0510('0x10'))[_0x0510('0x11')](socket);function respondWithRpcPromise(_0x2eefcd,_0xee3553,_0xcc006a){return new BPromise(function(_0x2f09b2,_0x3c627c){return client['request'](_0x2eefcd,_0xcc006a)[_0x0510('0x12')](function(_0x370e2c){logger[_0x0510('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0xee3553,_0x0510('0x14'));logger[_0x0510('0x15')](_0x0510('0x16'),_0xee3553,_0x0510('0x14'),JSON[_0x0510('0x17')](_0x370e2c));if(_0x370e2c[_0x0510('0x18')]){if(_0x370e2c[_0x0510('0x18')][_0x0510('0x19')]===0x1f4){logger[_0x0510('0x18')](_0x0510('0x1a'),_0xee3553,_0x370e2c[_0x0510('0x18')][_0x0510('0x1b')]);return _0x3c627c(_0x370e2c[_0x0510('0x18')][_0x0510('0x1b')]);}logger[_0x0510('0x18')](_0x0510('0x1a'),_0xee3553,_0x370e2c[_0x0510('0x18')][_0x0510('0x1b')]);return _0x2f09b2(_0x370e2c[_0x0510('0x18')]['message']);}else{logger[_0x0510('0x13')](_0x0510('0x1a'),_0xee3553,_0x0510('0x14'));_0x2f09b2(_0x370e2c[_0x0510('0x1c')][_0x0510('0x1b')]);}})['catch'](function(_0x2ae922){logger[_0x0510('0x18')](_0x0510('0x1a'),_0xee3553,_0x2ae922);_0x3c627c(_0x2ae922);});});}exports[_0x0510('0x1d')]=function(_0x3db72f){var _0xfca31c=this;return new Promise(function(_0x21ef2a,_0x3e0861){return db[_0x0510('0x1e')][_0x0510('0x1f')](_0x3db72f[_0x0510('0x20')],{'raw':_0x3db72f[_0x0510('0x21')]?_0x3db72f[_0x0510('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3db72f[_0x0510('0x21')]?_0x3db72f[_0x0510('0x21')]['where']||null:null,'attributes':_0x3db72f[_0x0510('0x21')]?_0x3db72f[_0x0510('0x21')]['attributes']||null:null,'limit':_0x3db72f[_0x0510('0x21')]?_0x3db72f[_0x0510('0x21')][_0x0510('0x22')]||null:null})[_0x0510('0x12')](function(_0x5990b0){logger['info']('UpdateOpenchannelInteraction',_0x3db72f);logger[_0x0510('0x15')](_0x0510('0x1d'),_0x3db72f,JSON[_0x0510('0x17')](_0x5990b0));_0x21ef2a(_0x5990b0);})[_0x0510('0x23')](function(_0x3d2602){logger[_0x0510('0x18')](_0x0510('0x1d'),_0x3d2602['message'],_0x3db72f);_0x3e0861(_0xfca31c[_0x0510('0x18')](0x1f4,_0x3d2602['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x473739){return new Promise(function(_0x3e3683,_0x5f16b4){return db['OpenchannelInteraction'][_0x0510('0x24')]({'where':_0x473739[_0x0510('0x21')]?_0x473739[_0x0510('0x21')][_0x0510('0x25')]||null:null})[_0x0510('0x12')](function(_0x3a39d3){if(_0x3a39d3){return _0x3a39d3['addTags'](_0x473739[_0x0510('0x20')][_0x0510('0x26')],_[_0x0510('0x27')](_0x473739[_0x0510('0x20')],[_0x0510('0x26'),'id'])||{});}})['spread'](function(_0x18c917){logger['info'](_0x0510('0x28'),_0x473739);logger[_0x0510('0x15')](_0x0510('0x28'),_0x473739,JSON[_0x0510('0x17')](_0x18c917));_0x3e3683(_0x18c917);})[_0x0510('0x23')](function(_0x4f16df){logger[_0x0510('0x18')](_0x0510('0x28'),_0x4f16df[_0x0510('0x1b')],_0x473739);_0x5f16b4(_this[_0x0510('0x18')](0x1f4,_0x4f16df[_0x0510('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b352469..786390b 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 _0x5239=['emit','register','length','./openchannelInteraction.events','save','update'];(function(_0x52f1cb,_0x1f5a5f){var _0x285deb=function(_0x322f88){while(--_0x322f88){_0x52f1cb['push'](_0x52f1cb['shift']());}};_0x285deb(++_0x1f5a5f);}(_0x5239,0x19b));var _0x9523=function(_0x49d4c7,_0x1c4305){_0x49d4c7=_0x49d4c7-0x0;var _0x36bee4=_0x5239[_0x49d4c7];return _0x36bee4;};'use strict';var OpenchannelInteractionEvents=require(_0x9523('0x0'));var events=[_0x9523('0x1'),'remove',_0x9523('0x2')];function createListener(_0x41168a,_0x291bb9){return function(_0x212460){_0x291bb9[_0x9523('0x3')](_0x41168a,_0x212460);};}function removeListener(_0x44a48d,_0xa507eb){return function(){OpenchannelInteractionEvents['removeListener'](_0x44a48d,_0xa507eb);};}exports[_0x9523('0x4')]=function(_0x521a6e){for(var _0x113484=0x0,_0x36f2c2=events[_0x9523('0x5')];_0x113484<_0x36f2c2;_0x113484++){var _0x5dc891=events[_0x113484];var _0x59a9b7=createListener('openchannelInteraction:'+_0x5dc891,_0x521a6e);OpenchannelInteractionEvents['on'](_0x5dc891,_0x59a9b7);}}; \ No newline at end of file +var _0x9e48=['openchannelInteraction:','./openchannelInteraction.events','save','remove','emit','removeListener','register','length'];(function(_0x3392d3,_0x345d5e){var _0x17d2a6=function(_0xd58efc){while(--_0xd58efc){_0x3392d3['push'](_0x3392d3['shift']());}};_0x17d2a6(++_0x345d5e);}(_0x9e48,0x179));var _0x89e4=function(_0x28d1c7,_0x20ef51){_0x28d1c7=_0x28d1c7-0x0;var _0x584a72=_0x9e48[_0x28d1c7];return _0x584a72;};'use strict';var OpenchannelInteractionEvents=require(_0x89e4('0x0'));var events=[_0x89e4('0x1'),_0x89e4('0x2'),'update'];function createListener(_0x4ab581,_0x5942b4){return function(_0x2c89bc){_0x5942b4[_0x89e4('0x3')](_0x4ab581,_0x2c89bc);};}function removeListener(_0x1c2a2c,_0x29b660){return function(){OpenchannelInteractionEvents[_0x89e4('0x4')](_0x1c2a2c,_0x29b660);};}exports[_0x89e4('0x5')]=function(_0x161a92){for(var _0x2d5b7e=0x0,_0xaf1cbd=events[_0x89e4('0x6')];_0x2d5b7e<_0xaf1cbd;_0x2d5b7e++){var _0x71623a=events[_0x2d5b7e];var _0x470531=createListener(_0x89e4('0x7')+_0x71623a,_0x161a92);OpenchannelInteractionEvents['on'](_0x71623a,_0x470531);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index d3becdd..4de35b3 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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x53c68b,_0x465db7){_0x53c68b=_0x53c68b-0x0;var _0xdfd4b=_0x70e0[_0x53c68b];return _0xdfd4b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x49cdcf,_0x3a82b5){var _0x286d74=function(_0xb0ceb8){while(--_0xb0ceb8){_0x49cdcf['push'](_0x49cdcf['shift']());}};_0x286d74(++_0x3a82b5);}(_0xedd9,0xfc));var _0x9edd=function(_0x2042a4,_0x16f91e){_0x2042a4=_0x2042a4-0x0;var _0x233995=_0xedd9[_0x2042a4];return _0x233995;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 9caccb7..1b47778 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 _0x0901=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x0901,0x134));var _0x1090=function(_0x168fd1,_0x1c1aad){_0x168fd1=_0x168fd1-0x0;var _0x3b7a89=_0x0901[_0x168fd1];return _0x3b7a89;};'use strict';var Sequelize=require(_0x1090('0x0'));module[_0x1090('0x1')]={'body':{'type':Sequelize[_0x1090('0x2')](_0x1090('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1090('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1090('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x1090('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x1090('0x6')]},'providerName':{'type':Sequelize[_0x1090('0x7')]},'providerResponse':{'type':Sequelize[_0x1090('0x2')]}}; \ No newline at end of file +var _0xa321=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x119841,_0x5009c2){var _0x5bc7cb=function(_0x3df78c){while(--_0x3df78c){_0x119841['push'](_0x119841['shift']());}};_0x5bc7cb(++_0x5009c2);}(_0xa321,0x9d));var _0x1a32=function(_0x279ab1,_0x527374){_0x279ab1=_0x279ab1-0x0;var _0x8ba87c=_0xa321[_0x279ab1];return _0x8ba87c;};'use strict';var Sequelize=require(_0x1a32('0x0'));module[_0x1a32('0x1')]={'body':{'type':Sequelize[_0x1a32('0x2')](_0x1a32('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x1a32('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1a32('0x5')]('in','out'),'defaultValue':_0x1a32('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x1a32('0x7')]},'providerName':{'type':Sequelize['STRING']},'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 8a8016c..4d5969c 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 _0x1b20=['localhost','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','reject','update','stack','name','send','map','OpenchannelMessage','rawAttributes','key','query','keys','intersection','model','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','show','options','find','create','body','params','describe','openchannel-interactions','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','get','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','sequelize','User','internal','interface','rejectmessage','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults'];(function(_0x3bab7d,_0x1f711b){var _0x22bbb1=function(_0x147a48){while(--_0x147a48){_0x3bab7d['push'](_0x3bab7d['shift']());}};_0x22bbb1(++_0x1f711b);}(_0x1b20,0x66));var _0x01b2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1b20[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01b2('0x0'));var zipdir=require(_0x01b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x01b2('0x2'));var BPromise=require(_0x01b2('0x3'));var Mustache=require(_0x01b2('0x4'));var util=require(_0x01b2('0x5'));var path=require(_0x01b2('0x6'));var sox=require(_0x01b2('0x7'));var csv=require(_0x01b2('0x8'));var ejs=require(_0x01b2('0x9'));var fs=require('fs');var fs_extra=require(_0x01b2('0xa'));var _=require(_0x01b2('0xb'));var squel=require(_0x01b2('0xc'));var crypto=require(_0x01b2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x01b2('0xe'));var toCsv=require('to-csv');var querystring=require(_0x01b2('0xf'));var Papa=require(_0x01b2('0x10'));var Redis=require(_0x01b2('0x11'));var authService=require(_0x01b2('0x12'));var qs=require(_0x01b2('0x13'));var as=require(_0x01b2('0x14'));var hardwareService=require(_0x01b2('0x15'));var logger=require(_0x01b2('0x16'))('api');var utils=require(_0x01b2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x01b2('0x18'));var db=require('../../mysqldb')['db'];config[_0x01b2('0x19')]=_[_0x01b2('0x1a')](config[_0x01b2('0x19')],{'host':_0x01b2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01b2('0x19')]));require(_0x01b2('0x1c'))[_0x01b2('0x1d')](socket);var jayson=require(_0x01b2('0x1e'));var client=jayson[_0x01b2('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x01b2('0x1f')][_0x01b2('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1a9734,_0x3f68a8,_0x50eb39,_0x523b80){return new BPromise(function(_0x2a8458,_0x3c0e03){var _0x588dbe=_0x523b80||client;return _0x588dbe[_0x01b2('0x21')](_0x1a9734,_0x50eb39)[_0x01b2('0x22')](function(_0x27a0bc){logger['info'](_0x01b2('0x23'),_0x3f68a8,_0x01b2('0x24'));logger[_0x01b2('0x25')](_0x01b2('0x26'),_0x3f68a8,_0x01b2('0x24'),JSON['stringify'](_0x27a0bc));if(_0x27a0bc[_0x01b2('0x27')]){if(_0x27a0bc['error'][_0x01b2('0x28')]===0x1f4){logger['error'](_0x01b2('0x23'),_0x3f68a8,_0x27a0bc[_0x01b2('0x27')][_0x01b2('0x29')]);return _0x3c0e03(_0x27a0bc['error'][_0x01b2('0x29')]);}logger[_0x01b2('0x27')](_0x01b2('0x23'),_0x3f68a8,_0x27a0bc[_0x01b2('0x27')][_0x01b2('0x29')]);return _0x2a8458(_0x27a0bc['error'][_0x01b2('0x29')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x3f68a8,_0x01b2('0x24'));_0x2a8458(_0x27a0bc[_0x01b2('0x2a')][_0x01b2('0x29')]);}})[_0x01b2('0x2b')](function(_0x2e32c1){logger[_0x01b2('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x3f68a8,_0x2e32c1);_0x3c0e03(_0x2e32c1);});});}function respondWithStatusCode(_0x2cb5f1,_0x239543){_0x239543=_0x239543||0xcc;return function(_0x424cfd){if(_0x424cfd){return _0x2cb5f1[_0x01b2('0x2c')](_0x239543);}return _0x2cb5f1['status'](_0x239543)[_0x01b2('0x2d')]();};}function respondWithResult(_0x586814,_0x122925){_0x122925=_0x122925||0xc8;return function(_0x1e6ac2){if(_0x1e6ac2){return _0x586814['status'](_0x122925)[_0x01b2('0x2e')](_0x1e6ac2);}};}function respondWithFilteredResult(_0x5efdda,_0x487c49){return function(_0x291d56){if(_0x291d56){var _0x4363ec=typeof _0x487c49['offset']===_0x01b2('0x2f')&&typeof _0x487c49[_0x01b2('0x30')]===_0x01b2('0x2f');var _0x2cf50f=_0x291d56[_0x01b2('0x31')];var _0xd7ad6b=_0x4363ec?0x0:_0x487c49[_0x01b2('0x32')];var _0x3169f5=_0x4363ec?_0x291d56[_0x01b2('0x31')]:_0x487c49[_0x01b2('0x32')]+_0x487c49[_0x01b2('0x30')];var _0x5e6981;if(_0x3169f5>=_0x2cf50f){_0x3169f5=_0x2cf50f;_0x5e6981=0xc8;}else{_0x5e6981=0xce;}_0x5efdda[_0x01b2('0x33')](_0x5e6981);return _0x5efdda[_0x01b2('0x34')](_0x01b2('0x35'),_0xd7ad6b+'-'+_0x3169f5+'/'+_0x2cf50f)[_0x01b2('0x2e')](_0x291d56);}return null;};}function patchUpdates(_0x306666){return function(_0x11dd4e){try{jsonpatch['apply'](_0x11dd4e,_0x306666,!![]);}catch(_0x480fa7){return BPromise[_0x01b2('0x36')](_0x480fa7);}return _0x11dd4e['save']();};}function saveUpdates(_0x50ec09,_0x2c2d51){return function(_0x176849){if(_0x176849){return _0x176849[_0x01b2('0x37')](_0x50ec09)[_0x01b2('0x22')](function(_0x520b4c){return _0x520b4c;});}return null;};}function removeEntity(_0x42c3f8,_0x5a954a){return function(_0xcd6801){if(_0xcd6801){return _0xcd6801['destroy']()['then'](function(){_0x42c3f8['status'](0xcc)[_0x01b2('0x2d')]();});}};}function handleEntityNotFound(_0x29532e,_0x8f8433){return function(_0x12725b){if(!_0x12725b){_0x29532e['sendStatus'](0x194);}return _0x12725b;};}function handleError(_0x11504a,_0x2bd252){_0x2bd252=_0x2bd252||0x1f4;return function(_0x5865a3){logger[_0x01b2('0x27')](_0x5865a3[_0x01b2('0x38')]);if(_0x5865a3[_0x01b2('0x39')]){delete _0x5865a3[_0x01b2('0x39')];}_0x11504a[_0x01b2('0x33')](_0x2bd252)[_0x01b2('0x3a')](_0x5865a3);};}exports['index']=function(_0x2fb530,_0x2258ed){var _0x51f947={},_0x5576d8={},_0x44e338={'count':0x0,'rows':[]};var _0x3d7e77=_[_0x01b2('0x3b')](db[_0x01b2('0x3c')][_0x01b2('0x3d')],function(_0x3b0cc7){return{'name':_0x3b0cc7['fieldName'],'type':_0x3b0cc7['type'][_0x01b2('0x3e')]};});_0x5576d8['model']=_[_0x01b2('0x3b')](_0x3d7e77,_0x01b2('0x39'));_0x5576d8[_0x01b2('0x3f')]=_[_0x01b2('0x40')](_0x2fb530[_0x01b2('0x3f')]);_0x5576d8['filters']=_[_0x01b2('0x41')](_0x5576d8[_0x01b2('0x42')],_0x5576d8[_0x01b2('0x3f')]);_0x51f947['attributes']=_[_0x01b2('0x41')](_0x5576d8[_0x01b2('0x42')],qs[_0x01b2('0x43')](_0x2fb530['query'][_0x01b2('0x43')]));_0x51f947['attributes']=_0x51f947[_0x01b2('0x44')][_0x01b2('0x45')]?_0x51f947['attributes']:_0x5576d8[_0x01b2('0x42')];if(!_0x2fb530[_0x01b2('0x3f')]['hasOwnProperty'](_0x01b2('0x46'))){_0x51f947[_0x01b2('0x30')]=qs[_0x01b2('0x30')](_0x2fb530[_0x01b2('0x3f')][_0x01b2('0x30')]);_0x51f947['offset']=qs[_0x01b2('0x32')](_0x2fb530[_0x01b2('0x3f')][_0x01b2('0x32')]);}_0x51f947['order']=qs[_0x01b2('0x47')](_0x2fb530[_0x01b2('0x3f')][_0x01b2('0x47')]);_0x51f947[_0x01b2('0x48')]=qs[_0x01b2('0x49')](_[_0x01b2('0x4a')](_0x2fb530[_0x01b2('0x3f')],_0x5576d8[_0x01b2('0x49')]),_0x3d7e77);if(_0x2fb530['query'][_0x01b2('0x4b')]){_0x51f947[_0x01b2('0x48')]=_[_0x01b2('0x4c')](_0x51f947[_0x01b2('0x48')],{'$or':_[_0x01b2('0x3b')](_0x3d7e77,function(_0x3469b3){if(_0x3469b3[_0x01b2('0x4d')]!=='VIRTUAL'){var _0x1e9c10={};_0x1e9c10[_0x3469b3[_0x01b2('0x39')]]={'$like':'%'+_0x2fb530[_0x01b2('0x3f')][_0x01b2('0x4b')]+'%'};return _0x1e9c10;}})});}_0x51f947=_['merge']({},_0x51f947,_0x2fb530['options']);var _0x241bd0={'where':_0x51f947[_0x01b2('0x48')]};return db[_0x01b2('0x3c')]['count'](_0x241bd0)[_0x01b2('0x22')](function(_0x17a8fe){_0x44e338[_0x01b2('0x31')]=_0x17a8fe;if(_0x2fb530[_0x01b2('0x3f')][_0x01b2('0x4e')]){_0x51f947[_0x01b2('0x4f')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x01b2('0x50')](_0x51f947);})['then'](function(_0x272d0d){_0x44e338['rows']=_0x272d0d;return _0x44e338;})['then'](respondWithFilteredResult(_0x2258ed,_0x51f947))[_0x01b2('0x2b')](handleError(_0x2258ed,null));};exports[_0x01b2('0x51')]=function(_0x3dda96,_0x25d72e){var _0x20cc59={'raw':!![],'where':{'id':_0x3dda96['params']['id']}},_0x496dd3={};_0x496dd3[_0x01b2('0x42')]=_[_0x01b2('0x40')](db[_0x01b2('0x3c')][_0x01b2('0x3d')]);_0x496dd3[_0x01b2('0x3f')]=_[_0x01b2('0x40')](_0x3dda96['query']);_0x496dd3[_0x01b2('0x49')]=_[_0x01b2('0x41')](_0x496dd3[_0x01b2('0x42')],_0x496dd3[_0x01b2('0x3f')]);_0x20cc59[_0x01b2('0x44')]=_[_0x01b2('0x41')](_0x496dd3[_0x01b2('0x42')],qs['fields'](_0x3dda96[_0x01b2('0x3f')][_0x01b2('0x43')]));_0x20cc59[_0x01b2('0x44')]=_0x20cc59[_0x01b2('0x44')][_0x01b2('0x45')]?_0x20cc59[_0x01b2('0x44')]:_0x496dd3['model'];if(_0x3dda96[_0x01b2('0x3f')][_0x01b2('0x4e')]){_0x20cc59[_0x01b2('0x4f')]=[{'all':!![]}];}_0x20cc59=_[_0x01b2('0x4c')]({},_0x20cc59,_0x3dda96[_0x01b2('0x52')]);return db[_0x01b2('0x3c')][_0x01b2('0x53')](_0x20cc59)[_0x01b2('0x22')](handleEntityNotFound(_0x25d72e,null))[_0x01b2('0x22')](respondWithResult(_0x25d72e,null))[_0x01b2('0x2b')](handleError(_0x25d72e,null));};exports[_0x01b2('0x54')]=function(_0x43f453,_0x11a8a0){return db[_0x01b2('0x3c')]['create'](_0x43f453['body'],{})['then'](respondWithResult(_0x11a8a0,0xc9))['catch'](handleError(_0x11a8a0,null));};exports[_0x01b2('0x37')]=function(_0x36ab3b,_0x9daac7){if(_0x36ab3b['body']['id']){delete _0x36ab3b[_0x01b2('0x55')]['id'];}return db['OpenchannelMessage'][_0x01b2('0x53')]({'where':{'id':_0x36ab3b[_0x01b2('0x56')]['id']}})[_0x01b2('0x22')](handleEntityNotFound(_0x9daac7,null))[_0x01b2('0x22')](saveUpdates(_0x36ab3b[_0x01b2('0x55')],null))['then'](respondWithResult(_0x9daac7,null))[_0x01b2('0x2b')](handleError(_0x9daac7,null));};exports['destroy']=function(_0x469a08,_0x7533be){return db['OpenchannelMessage'][_0x01b2('0x53')]({'where':{'id':_0x469a08['params']['id']}})[_0x01b2('0x22')](handleEntityNotFound(_0x7533be,null))[_0x01b2('0x22')](removeEntity(_0x7533be,null))[_0x01b2('0x2b')](handleError(_0x7533be,null));};exports[_0x01b2('0x57')]=function(_0x6b1e60,_0x422b20){return db[_0x01b2('0x3c')][_0x01b2('0x57')]()[_0x01b2('0x22')](respondWithResult(_0x422b20,null))[_0x01b2('0x2b')](handleError(_0x422b20,null));};var interaction_log=require('../../config/logger')(_0x01b2('0x58'));exports['accept']=function(_0x3039a1,_0x3c0f66,_0xf66ade){var _0x58c8de={'agent':{},'channel':_0x01b2('0x59')};if(_0x3039a1['body']['id']){delete _0x3039a1['body']['id'];}_0x3039a1[_0x01b2('0x55')][_0x01b2('0x5a')]=!![];_0x3039a1[_0x01b2('0x55')]['readAt']=moment()[_0x01b2('0x5b')](_0x01b2('0x5c'));_0x3039a1[_0x01b2('0x55')]['UserId']=_0x3039a1[_0x01b2('0x55')][_0x01b2('0x5d')]||_0x3039a1[_0x01b2('0x5e')]['id'];_0x58c8de[_0x01b2('0x5f')]['id']=_0x3039a1[_0x01b2('0x55')][_0x01b2('0x5d')];return db[_0x01b2('0x3c')]['find']({'where':{'id':_0x3039a1['params']['id'],'UserId':null}})[_0x01b2('0x22')](handleEntityNotFound(_0x3c0f66,null))['then'](saveUpdates(_0x3039a1['body'],null))[_0x01b2('0x22')](function(_0x4ca277){if(_0x4ca277){_0x58c8de[_0x01b2('0x29')]=_0x4ca277['get']({'plain':!![]});return db[_0x01b2('0x60')][_0x01b2('0x53')]({'where':{'id':_0x4ca277[_0x01b2('0x61')]}});}return null;})[_0x01b2('0x22')](handleEntityNotFound(_0x3c0f66,null))['then'](function(_0x2d6d43){if(_0x2d6d43){return _0x2d6d43['update']({'UserId':_0x3039a1[_0x01b2('0x55')]['UserId'],'read1stAt':_[_0x01b2('0x62')](_0x2d6d43['read1stAt'])?moment()[_0x01b2('0x5b')](_0x01b2('0x5c')):undefined});}return null;})['then'](function(_0x2446f4){if(_0x2446f4){_0x58c8de[_0x01b2('0x63')]=_0x2446f4[_0x01b2('0x64')]({'plain':!![]});interaction_log[_0x01b2('0x65')](_0x01b2('0x66'),_0x3039a1[_0x01b2('0x5e')]['id'],_0x3039a1[_0x01b2('0x5e')][_0x01b2('0x39')],_0x3039a1[_0x01b2('0x5e')][_0x01b2('0x67')],_0x58c8de[_0x01b2('0x63')]['id'],_0x3039a1[_0x01b2('0x55')]?JSON[_0x01b2('0x68')](_0x3039a1['body']):'null');return respondWithRpcPromise(_0x01b2('0x69'),_0x01b2('0x6a'),_0x58c8de);}return null;})[_0x01b2('0x22')](function(_0x427358){var _0x21cecf=_0x01b2('0x6b')+_0x427358[_0x01b2('0x29')][_0x01b2('0x6c')];return db['sequelize'][_0x01b2('0x3f')](_0x21cecf,{'type':db[_0x01b2('0x6d')][_0x01b2('0x6e')][_0x01b2('0x6f')],'raw':!![]})[_0x01b2('0x22')](function(_0x32f099){return _0x32f099;});})[_0x01b2('0x22')](function(_0x502f28){if(_0x502f28){_0x58c8de['message'][_0x01b2('0x70')]=_0x502f28[0x0];if(!_0x3039a1[_0x01b2('0x55')][_0x01b2('0x5d')])return;return db['User'][_0x01b2('0x53')]({'where':{'id':_0x3039a1[_0x01b2('0x55')][_0x01b2('0x5d')],'role':'agent'},'attributes':['id',_0x01b2('0x39'),_0x01b2('0x71'),_0x01b2('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2a820d){if(!_0x2a820d)return null;_0x58c8de['message'][_0x01b2('0x5f')]=_0x2a820d;return _0x58c8de;})[_0x01b2('0x22')](function(_0x2f41b6){if(_0x2f41b6){if(_0x3039a1[_0x01b2('0x55')][_0x01b2('0x73')]){_0x58c8de[_0x01b2('0x29')]['interface']=util[_0x01b2('0x5b')](_0x01b2('0x74'),_0x3039a1[_0x01b2('0x5e')][_0x01b2('0x39')]);_0x58c8de[_0x01b2('0x29')][_0x01b2('0x75')]=_0x58c8de['channel'];_0x58c8de[_0x01b2('0x29')][_0x01b2('0x76')]=_0x58c8de[_0x01b2('0x75')];_0x58c8de[_0x01b2('0x29')][_0x01b2('0x77')]=_0x01b2('0x78');return respondWithRpcPromise('EventManager',_0x01b2('0x79'),{'event':'acceptmessage','message':_0x58c8de[_0x01b2('0x29')]},client9002)['then'](function(){return _0x58c8de;});}return _0x58c8de;}return null;})['then'](respondWithResult(_0x3c0f66,null))[_0x01b2('0x2b')](handleError(_0x3c0f66,null));};var interaction_log=require(_0x01b2('0x16'))('openchannel-interactions');exports[_0x01b2('0x36')]=function(_0x4015e2,_0x288e34,_0x270479){var _0x59b6a0={'agent':{},'channel':_0x01b2('0x59')};if(_0x4015e2[_0x01b2('0x55')]['id']){delete _0x4015e2[_0x01b2('0x55')]['id'];}_0x4015e2[_0x01b2('0x55')][_0x01b2('0x5d')]=_0x4015e2[_0x01b2('0x55')][_0x01b2('0x5d')]||_0x4015e2[_0x01b2('0x5e')]['id'];_0x59b6a0[_0x01b2('0x5f')]['id']=_0x4015e2[_0x01b2('0x55')][_0x01b2('0x5d')];return db['OpenchannelMessage'][_0x01b2('0x53')]({'where':{'id':_0x4015e2[_0x01b2('0x56')]['id'],'UserId':null}})[_0x01b2('0x22')](handleEntityNotFound(_0x288e34,null))[_0x01b2('0x22')](function(_0x903a9f){if(_0x903a9f){_0x59b6a0[_0x01b2('0x29')]=_0x903a9f[_0x01b2('0x64')]({'plain':!![]});return db[_0x01b2('0x60')]['find']({'where':{'id':_0x903a9f['OpenchannelInteractionId']}});}return null;})[_0x01b2('0x22')](handleEntityNotFound(_0x288e34,null))[_0x01b2('0x22')](function(_0x455c73){if(_0x455c73){_0x59b6a0[_0x01b2('0x63')]=_0x455c73[_0x01b2('0x64')]({'plain':!![]});interaction_log[_0x01b2('0x65')](_0x01b2('0x7a'),_0x4015e2[_0x01b2('0x5e')]['id'],_0x4015e2['user'][_0x01b2('0x39')],_0x4015e2[_0x01b2('0x5e')][_0x01b2('0x67')],_0x59b6a0['interaction']['id'],_0x4015e2[_0x01b2('0x55')]?JSON[_0x01b2('0x68')](_0x4015e2[_0x01b2('0x55')]):_0x01b2('0x7b'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x59b6a0);}return null;})['then'](function(_0x2cee2e){var _0x511fdc=_0x01b2('0x6b')+_0x2cee2e[_0x01b2('0x29')][_0x01b2('0x6c')];return db[_0x01b2('0x7c')][_0x01b2('0x3f')](_0x511fdc,{'type':db[_0x01b2('0x6d')][_0x01b2('0x6e')][_0x01b2('0x6f')],'raw':!![]})[_0x01b2('0x22')](function(_0x1f5244){return _0x1f5244;});})['then'](function(_0x1d48f2){if(_0x1d48f2){_0x59b6a0[_0x01b2('0x29')][_0x01b2('0x70')]=_0x1d48f2[0x0];if(!_0x4015e2[_0x01b2('0x55')][_0x01b2('0x5d')])return;return db[_0x01b2('0x7d')][_0x01b2('0x53')]({'where':{'id':_0x4015e2[_0x01b2('0x55')][_0x01b2('0x5d')],'role':'agent'},'attributes':['id','name',_0x01b2('0x71'),_0x01b2('0x72'),_0x01b2('0x7e')],'raw':!![]});}return null;})['then'](function(_0xf36eb0){if(!_0xf36eb0)return null;_0x59b6a0[_0x01b2('0x29')][_0x01b2('0x5f')]=_0xf36eb0;return _0x59b6a0;})[_0x01b2('0x22')](function(_0x2fd064){if(_0x2fd064){_0x2fd064[_0x01b2('0x29')][_0x01b2('0x7f')]=util[_0x01b2('0x5b')](_0x01b2('0x74'),_0x4015e2[_0x01b2('0x5e')][_0x01b2('0x39')]);_0x2fd064['message'][_0x01b2('0x75')]=_0x59b6a0[_0x01b2('0x75')];_0x2fd064[_0x01b2('0x29')][_0x01b2('0x76')]=_0x59b6a0[_0x01b2('0x75')];_0x2fd064[_0x01b2('0x29')][_0x01b2('0x77')]=_0x01b2('0x36');respondWithRpcPromise(_0x01b2('0x79'),'EventManager',{'event':_0x01b2('0x80'),'message':_0x2fd064[_0x01b2('0x29')]},client9002);return _0x59b6a0;}return null;})[_0x01b2('0x22')](respondWithResult(_0x288e34,null))[_0x01b2('0x2b')](handleError(_0x288e34,null));}; \ No newline at end of file +var _0x5d87=['body','update','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','sequelize','Sequelize','SELECT','User','agent','fullname','manual','SIP/%s','channel','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','contact','email','internal','interface','event','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','http','request','then','request\x20sent','error','code','message','OpenchannelMessage,\x20%s,\x20%s','info','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create'];(function(_0x464c5a,_0x199c40){var _0x1a4e71=function(_0x434e0b){while(--_0x434e0b){_0x464c5a['push'](_0x464c5a['shift']());}};_0x1a4e71(++_0x199c40);}(_0x5d87,0x1b0));var _0x75d8=function(_0x2fc428,_0x387d42){_0x2fc428=_0x2fc428-0x0;var _0x122cac=_0x5d87[_0x2fc428];return _0x122cac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x75d8('0x0'));var zipdir=require(_0x75d8('0x1'));var jsonpatch=require(_0x75d8('0x2'));var rp=require(_0x75d8('0x3'));var moment=require(_0x75d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x75d8('0x5'));var util=require(_0x75d8('0x6'));var path=require('path');var sox=require(_0x75d8('0x7'));var csv=require(_0x75d8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d8('0x9'));var _=require(_0x75d8('0xa'));var squel=require(_0x75d8('0xb'));var crypto=require(_0x75d8('0xc'));var jsforce=require(_0x75d8('0xd'));var deskjs=require(_0x75d8('0xe'));var toCsv=require(_0x75d8('0x8'));var querystring=require(_0x75d8('0xf'));var Papa=require(_0x75d8('0x10'));var Redis=require(_0x75d8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x75d8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75d8('0x13'));var logger=require(_0x75d8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x75d8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x75d8('0x16'))['db'];config[_0x75d8('0x17')]=_[_0x75d8('0x18')](config[_0x75d8('0x17')],{'host':_0x75d8('0x19'),'port':0x18eb});var socket=require(_0x75d8('0x1a'))(new Redis(config[_0x75d8('0x17')]));require(_0x75d8('0x1b'))['register'](socket);var jayson=require(_0x75d8('0x1c'));var client=jayson['client'][_0x75d8('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x75d8('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xb269b1,_0x12ba5a,_0x2c4ebc,_0x4473e3){return new BPromise(function(_0x598ab1,_0x38785c){var _0x4504d0=_0x4473e3||client;return _0x4504d0[_0x75d8('0x1e')](_0xb269b1,_0x2c4ebc)[_0x75d8('0x1f')](function(_0x4a47e9){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x12ba5a,_0x75d8('0x20'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x12ba5a,'request\x20sent',JSON['stringify'](_0x4a47e9));if(_0x4a47e9[_0x75d8('0x21')]){if(_0x4a47e9[_0x75d8('0x21')][_0x75d8('0x22')]===0x1f4){logger[_0x75d8('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x12ba5a,_0x4a47e9[_0x75d8('0x21')]['message']);return _0x38785c(_0x4a47e9['error'][_0x75d8('0x23')]);}logger['error'](_0x75d8('0x24'),_0x12ba5a,_0x4a47e9[_0x75d8('0x21')][_0x75d8('0x23')]);return _0x598ab1(_0x4a47e9[_0x75d8('0x21')][_0x75d8('0x23')]);}else{logger[_0x75d8('0x25')](_0x75d8('0x24'),_0x12ba5a,_0x75d8('0x20'));_0x598ab1(_0x4a47e9[_0x75d8('0x26')][_0x75d8('0x23')]);}})[_0x75d8('0x27')](function(_0x259b7d){logger[_0x75d8('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x12ba5a,_0x259b7d);_0x38785c(_0x259b7d);});});}function respondWithStatusCode(_0xca4f70,_0x4aac58){_0x4aac58=_0x4aac58||0xcc;return function(_0xb89de3){if(_0xb89de3){return _0xca4f70['sendStatus'](_0x4aac58);}return _0xca4f70[_0x75d8('0x28')](_0x4aac58)[_0x75d8('0x29')]();};}function respondWithResult(_0x171c3c,_0x48cb47){_0x48cb47=_0x48cb47||0xc8;return function(_0x20dd22){if(_0x20dd22){return _0x171c3c[_0x75d8('0x28')](_0x48cb47)[_0x75d8('0x2a')](_0x20dd22);}};}function respondWithFilteredResult(_0x9593ef,_0x4c31ac){return function(_0x417e55){if(_0x417e55){var _0x5625b1=typeof _0x4c31ac[_0x75d8('0x2b')]===_0x75d8('0x2c')&&typeof _0x4c31ac[_0x75d8('0x2d')]===_0x75d8('0x2c');var _0x31c943=_0x417e55[_0x75d8('0x2e')];var _0x527641=_0x5625b1?0x0:_0x4c31ac[_0x75d8('0x2b')];var _0xc4b7d8=_0x5625b1?_0x417e55[_0x75d8('0x2e')]:_0x4c31ac[_0x75d8('0x2b')]+_0x4c31ac[_0x75d8('0x2d')];var _0x469368;if(_0xc4b7d8>=_0x31c943){_0xc4b7d8=_0x31c943;_0x469368=0xc8;}else{_0x469368=0xce;}_0x9593ef[_0x75d8('0x28')](_0x469368);return _0x9593ef[_0x75d8('0x2f')](_0x75d8('0x30'),_0x527641+'-'+_0xc4b7d8+'/'+_0x31c943)[_0x75d8('0x2a')](_0x417e55);}return null;};}function patchUpdates(_0x270730){return function(_0x4e1ad7){try{jsonpatch[_0x75d8('0x31')](_0x4e1ad7,_0x270730,!![]);}catch(_0x1a7053){return BPromise[_0x75d8('0x32')](_0x1a7053);}return _0x4e1ad7[_0x75d8('0x33')]();};}function saveUpdates(_0x4b0d91,_0x58b638){return function(_0x15b6d3){if(_0x15b6d3){return _0x15b6d3['update'](_0x4b0d91)[_0x75d8('0x1f')](function(_0x271665){return _0x271665;});}return null;};}function removeEntity(_0x37ba60,_0x241d8c){return function(_0x4973c7){if(_0x4973c7){return _0x4973c7[_0x75d8('0x34')]()[_0x75d8('0x1f')](function(){_0x37ba60[_0x75d8('0x28')](0xcc)[_0x75d8('0x29')]();});}};}function handleEntityNotFound(_0x3cba3d,_0x3817d2){return function(_0x95bddf){if(!_0x95bddf){_0x3cba3d['sendStatus'](0x194);}return _0x95bddf;};}function handleError(_0x1a703f,_0x4fa5e3){_0x4fa5e3=_0x4fa5e3||0x1f4;return function(_0x47c2c9){logger[_0x75d8('0x21')](_0x47c2c9[_0x75d8('0x35')]);if(_0x47c2c9[_0x75d8('0x36')]){delete _0x47c2c9[_0x75d8('0x36')];}_0x1a703f[_0x75d8('0x28')](_0x4fa5e3)[_0x75d8('0x37')](_0x47c2c9);};}exports[_0x75d8('0x38')]=function(_0x5d9cbd,_0x464f93){var _0x472dab={},_0x58eabe={},_0x4d3745={'count':0x0,'rows':[]};var _0x48bb6c=_[_0x75d8('0x39')](db[_0x75d8('0x3a')][_0x75d8('0x3b')],function(_0x2da7b8){return{'name':_0x2da7b8[_0x75d8('0x3c')],'type':_0x2da7b8[_0x75d8('0x3d')]['key']};});_0x58eabe['model']=_['map'](_0x48bb6c,_0x75d8('0x36'));_0x58eabe['query']=_[_0x75d8('0x3e')](_0x5d9cbd[_0x75d8('0x3f')]);_0x58eabe[_0x75d8('0x40')]=_[_0x75d8('0x41')](_0x58eabe[_0x75d8('0x42')],_0x58eabe[_0x75d8('0x3f')]);_0x472dab['attributes']=_[_0x75d8('0x41')](_0x58eabe[_0x75d8('0x42')],qs[_0x75d8('0x43')](_0x5d9cbd[_0x75d8('0x3f')][_0x75d8('0x43')]));_0x472dab[_0x75d8('0x44')]=_0x472dab[_0x75d8('0x44')][_0x75d8('0x45')]?_0x472dab[_0x75d8('0x44')]:_0x58eabe[_0x75d8('0x42')];if(!_0x5d9cbd['query'][_0x75d8('0x46')](_0x75d8('0x47'))){_0x472dab['limit']=qs['limit'](_0x5d9cbd[_0x75d8('0x3f')][_0x75d8('0x2d')]);_0x472dab[_0x75d8('0x2b')]=qs['offset'](_0x5d9cbd['query'][_0x75d8('0x2b')]);}_0x472dab[_0x75d8('0x48')]=qs['sort'](_0x5d9cbd['query'][_0x75d8('0x49')]);_0x472dab[_0x75d8('0x4a')]=qs[_0x75d8('0x40')](_[_0x75d8('0x4b')](_0x5d9cbd[_0x75d8('0x3f')],_0x58eabe[_0x75d8('0x40')]),_0x48bb6c);if(_0x5d9cbd[_0x75d8('0x3f')][_0x75d8('0x4c')]){_0x472dab['where']=_[_0x75d8('0x4d')](_0x472dab[_0x75d8('0x4a')],{'$or':_[_0x75d8('0x39')](_0x48bb6c,function(_0x3a75a1){if(_0x3a75a1[_0x75d8('0x3d')]!==_0x75d8('0x4e')){var _0x4684b3={};_0x4684b3[_0x3a75a1[_0x75d8('0x36')]]={'$like':'%'+_0x5d9cbd[_0x75d8('0x3f')][_0x75d8('0x4c')]+'%'};return _0x4684b3;}})});}_0x472dab=_[_0x75d8('0x4d')]({},_0x472dab,_0x5d9cbd[_0x75d8('0x4f')]);var _0x4296db={'where':_0x472dab[_0x75d8('0x4a')]};return db[_0x75d8('0x3a')]['count'](_0x4296db)[_0x75d8('0x1f')](function(_0xa06963){_0x4d3745[_0x75d8('0x2e')]=_0xa06963;if(_0x5d9cbd[_0x75d8('0x3f')]['includeAll']){_0x472dab[_0x75d8('0x50')]=[{'all':!![]}];}return db[_0x75d8('0x3a')][_0x75d8('0x51')](_0x472dab);})[_0x75d8('0x1f')](function(_0x2a5442){_0x4d3745[_0x75d8('0x52')]=_0x2a5442;return _0x4d3745;})[_0x75d8('0x1f')](respondWithFilteredResult(_0x464f93,_0x472dab))[_0x75d8('0x27')](handleError(_0x464f93,null));};exports[_0x75d8('0x53')]=function(_0x2f044e,_0x48b4f2){var _0x37daaa={'raw':!![],'where':{'id':_0x2f044e[_0x75d8('0x54')]['id']}},_0x3af12f={};_0x3af12f['model']=_[_0x75d8('0x3e')](db[_0x75d8('0x3a')][_0x75d8('0x3b')]);_0x3af12f[_0x75d8('0x3f')]=_[_0x75d8('0x3e')](_0x2f044e['query']);_0x3af12f[_0x75d8('0x40')]=_['intersection'](_0x3af12f[_0x75d8('0x42')],_0x3af12f['query']);_0x37daaa[_0x75d8('0x44')]=_['intersection'](_0x3af12f[_0x75d8('0x42')],qs[_0x75d8('0x43')](_0x2f044e[_0x75d8('0x3f')][_0x75d8('0x43')]));_0x37daaa[_0x75d8('0x44')]=_0x37daaa[_0x75d8('0x44')][_0x75d8('0x45')]?_0x37daaa[_0x75d8('0x44')]:_0x3af12f[_0x75d8('0x42')];if(_0x2f044e[_0x75d8('0x3f')][_0x75d8('0x55')]){_0x37daaa[_0x75d8('0x50')]=[{'all':!![]}];}_0x37daaa=_['merge']({},_0x37daaa,_0x2f044e[_0x75d8('0x4f')]);return db['OpenchannelMessage'][_0x75d8('0x56')](_0x37daaa)[_0x75d8('0x1f')](handleEntityNotFound(_0x48b4f2,null))[_0x75d8('0x1f')](respondWithResult(_0x48b4f2,null))[_0x75d8('0x27')](handleError(_0x48b4f2,null));};exports[_0x75d8('0x57')]=function(_0x3bb59e,_0x12bbfb){return db[_0x75d8('0x3a')]['create'](_0x3bb59e[_0x75d8('0x58')],{})[_0x75d8('0x1f')](respondWithResult(_0x12bbfb,0xc9))[_0x75d8('0x27')](handleError(_0x12bbfb,null));};exports[_0x75d8('0x59')]=function(_0x54721d,_0x127b3b){if(_0x54721d[_0x75d8('0x58')]['id']){delete _0x54721d[_0x75d8('0x58')]['id'];}return db[_0x75d8('0x3a')][_0x75d8('0x56')]({'where':{'id':_0x54721d['params']['id']}})['then'](handleEntityNotFound(_0x127b3b,null))[_0x75d8('0x1f')](saveUpdates(_0x54721d[_0x75d8('0x58')],null))[_0x75d8('0x1f')](respondWithResult(_0x127b3b,null))[_0x75d8('0x27')](handleError(_0x127b3b,null));};exports[_0x75d8('0x34')]=function(_0x42cc49,_0x3de80d){return db[_0x75d8('0x3a')][_0x75d8('0x56')]({'where':{'id':_0x42cc49[_0x75d8('0x54')]['id']}})['then'](handleEntityNotFound(_0x3de80d,null))[_0x75d8('0x1f')](removeEntity(_0x3de80d,null))[_0x75d8('0x27')](handleError(_0x3de80d,null));};exports[_0x75d8('0x5a')]=function(_0x513f54,_0x110bf6){return db[_0x75d8('0x3a')][_0x75d8('0x5a')]()[_0x75d8('0x1f')](respondWithResult(_0x110bf6,null))[_0x75d8('0x27')](handleError(_0x110bf6,null));};var interaction_log=require(_0x75d8('0x14'))(_0x75d8('0x5b'));exports[_0x75d8('0x5c')]=function(_0x119e7d,_0x32e85e,_0x25fa67){var _0x17e8c9={'agent':{},'channel':'openchannel'};if(_0x119e7d[_0x75d8('0x58')]['id']){delete _0x119e7d['body']['id'];}_0x119e7d['body'][_0x75d8('0x5d')]=!![];_0x119e7d['body'][_0x75d8('0x5e')]=moment()[_0x75d8('0x5f')](_0x75d8('0x60'));_0x119e7d[_0x75d8('0x58')][_0x75d8('0x61')]=_0x119e7d[_0x75d8('0x58')]['UserId']||_0x119e7d['user']['id'];_0x17e8c9['agent']['id']=_0x119e7d['body'][_0x75d8('0x61')];return db[_0x75d8('0x3a')]['find']({'where':{'id':_0x119e7d[_0x75d8('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32e85e,null))[_0x75d8('0x1f')](saveUpdates(_0x119e7d[_0x75d8('0x58')],null))[_0x75d8('0x1f')](function(_0x262667){if(_0x262667){_0x17e8c9[_0x75d8('0x23')]=_0x262667[_0x75d8('0x62')]({'plain':!![]});return db[_0x75d8('0x63')][_0x75d8('0x56')]({'where':{'id':_0x262667[_0x75d8('0x64')]}});}return null;})[_0x75d8('0x1f')](handleEntityNotFound(_0x32e85e,null))[_0x75d8('0x1f')](function(_0x884505){if(_0x884505){return _0x884505['update']({'UserId':_0x119e7d[_0x75d8('0x58')]['UserId'],'read1stAt':_['isNil'](_0x884505['read1stAt'])?moment()[_0x75d8('0x5f')](_0x75d8('0x60')):undefined});}return null;})[_0x75d8('0x1f')](function(_0x38ee02){if(_0x38ee02){_0x17e8c9[_0x75d8('0x65')]=_0x38ee02[_0x75d8('0x62')]({'plain':!![]});interaction_log[_0x75d8('0x25')](_0x75d8('0x66'),_0x119e7d['user']['id'],_0x119e7d[_0x75d8('0x67')][_0x75d8('0x36')],_0x119e7d[_0x75d8('0x67')][_0x75d8('0x68')],_0x17e8c9[_0x75d8('0x65')]['id'],_0x119e7d[_0x75d8('0x58')]?JSON['stringify'](_0x119e7d[_0x75d8('0x58')]):_0x75d8('0x69'));return respondWithRpcPromise(_0x75d8('0x6a'),_0x75d8('0x6b'),_0x17e8c9);}return null;})['then'](function(_0x30f9bd){var _0x3a5f44='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x30f9bd[_0x75d8('0x23')]['ContactId'];return db[_0x75d8('0x6c')]['query'](_0x3a5f44,{'type':db[_0x75d8('0x6d')]['QueryTypes'][_0x75d8('0x6e')],'raw':!![]})['then'](function(_0x2d0b26){return _0x2d0b26;});})['then'](function(_0x402212){if(_0x402212){_0x17e8c9[_0x75d8('0x23')]['contact']=_0x402212[0x0];if(!_0x119e7d[_0x75d8('0x58')][_0x75d8('0x61')])return;return db[_0x75d8('0x6f')][_0x75d8('0x56')]({'where':{'id':_0x119e7d['body'][_0x75d8('0x61')],'role':_0x75d8('0x70')},'attributes':['id',_0x75d8('0x36'),_0x75d8('0x71'),'email','internal'],'raw':!![]});}return null;})[_0x75d8('0x1f')](function(_0x50a18b){if(!_0x50a18b)return null;_0x17e8c9[_0x75d8('0x23')][_0x75d8('0x70')]=_0x50a18b;return _0x17e8c9;})[_0x75d8('0x1f')](function(_0x349558){if(_0x349558){if(_0x119e7d[_0x75d8('0x58')][_0x75d8('0x72')]){_0x17e8c9[_0x75d8('0x23')]['interface']=util[_0x75d8('0x5f')](_0x75d8('0x73'),_0x119e7d[_0x75d8('0x67')][_0x75d8('0x36')]);_0x17e8c9[_0x75d8('0x23')][_0x75d8('0x74')]=_0x17e8c9['channel'];_0x17e8c9[_0x75d8('0x23')]['motionChannel']=_0x17e8c9['channel'];_0x17e8c9[_0x75d8('0x23')]['event']=_0x75d8('0x5c');return respondWithRpcPromise(_0x75d8('0x75'),_0x75d8('0x75'),{'event':_0x75d8('0x76'),'message':_0x17e8c9[_0x75d8('0x23')]},client9002)['then'](function(){return _0x17e8c9;});}return _0x17e8c9;}return null;})['then'](respondWithResult(_0x32e85e,null))[_0x75d8('0x27')](handleError(_0x32e85e,null));};var interaction_log=require(_0x75d8('0x14'))(_0x75d8('0x5b'));exports['reject']=function(_0x55ffec,_0x23eeb9,_0x22a968){var _0x44f170={'agent':{},'channel':_0x75d8('0x77')};if(_0x55ffec[_0x75d8('0x58')]['id']){delete _0x55ffec['body']['id'];}_0x55ffec['body']['UserId']=_0x55ffec[_0x75d8('0x58')][_0x75d8('0x61')]||_0x55ffec['user']['id'];_0x44f170['agent']['id']=_0x55ffec[_0x75d8('0x58')][_0x75d8('0x61')];return db[_0x75d8('0x3a')][_0x75d8('0x56')]({'where':{'id':_0x55ffec[_0x75d8('0x54')]['id'],'UserId':null}})[_0x75d8('0x1f')](handleEntityNotFound(_0x23eeb9,null))[_0x75d8('0x1f')](function(_0x4183a8){if(_0x4183a8){_0x44f170[_0x75d8('0x23')]=_0x4183a8[_0x75d8('0x62')]({'plain':!![]});return db[_0x75d8('0x63')][_0x75d8('0x56')]({'where':{'id':_0x4183a8[_0x75d8('0x64')]}});}return null;})[_0x75d8('0x1f')](handleEntityNotFound(_0x23eeb9,null))[_0x75d8('0x1f')](function(_0x351b04){if(_0x351b04){_0x44f170[_0x75d8('0x65')]=_0x351b04['get']({'plain':!![]});interaction_log[_0x75d8('0x25')](_0x75d8('0x78'),_0x55ffec[_0x75d8('0x67')]['id'],_0x55ffec[_0x75d8('0x67')][_0x75d8('0x36')],_0x55ffec[_0x75d8('0x67')][_0x75d8('0x68')],_0x44f170['interaction']['id'],_0x55ffec[_0x75d8('0x58')]?JSON[_0x75d8('0x79')](_0x55ffec[_0x75d8('0x58')]):'null');return respondWithRpcPromise('RejectMessage',_0x75d8('0x7a'),_0x44f170);}return null;})[_0x75d8('0x1f')](function(_0x455a48){var _0x4dd25d=_0x75d8('0x7b')+_0x455a48[_0x75d8('0x23')]['ContactId'];return db[_0x75d8('0x6c')][_0x75d8('0x3f')](_0x4dd25d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x75d8('0x1f')](function(_0x19c7b0){return _0x19c7b0;});})[_0x75d8('0x1f')](function(_0x2dc04b){if(_0x2dc04b){_0x44f170[_0x75d8('0x23')][_0x75d8('0x7c')]=_0x2dc04b[0x0];if(!_0x55ffec[_0x75d8('0x58')]['UserId'])return;return db[_0x75d8('0x6f')][_0x75d8('0x56')]({'where':{'id':_0x55ffec['body'][_0x75d8('0x61')],'role':_0x75d8('0x70')},'attributes':['id',_0x75d8('0x36'),_0x75d8('0x71'),_0x75d8('0x7d'),_0x75d8('0x7e')],'raw':!![]});}return null;})[_0x75d8('0x1f')](function(_0xfbbf84){if(!_0xfbbf84)return null;_0x44f170[_0x75d8('0x23')][_0x75d8('0x70')]=_0xfbbf84;return _0x44f170;})['then'](function(_0x34bb82){if(_0x34bb82){_0x34bb82[_0x75d8('0x23')][_0x75d8('0x7f')]=util[_0x75d8('0x5f')](_0x75d8('0x73'),_0x55ffec[_0x75d8('0x67')][_0x75d8('0x36')]);_0x34bb82['message'][_0x75d8('0x74')]=_0x44f170[_0x75d8('0x74')];_0x34bb82[_0x75d8('0x23')]['motionChannel']=_0x44f170[_0x75d8('0x74')];_0x34bb82['message'][_0x75d8('0x80')]=_0x75d8('0x32');respondWithRpcPromise(_0x75d8('0x75'),_0x75d8('0x75'),{'event':_0x75d8('0x81'),'message':_0x34bb82[_0x75d8('0x23')]},client9002);return _0x44f170;}return null;})[_0x75d8('0x1f')](respondWithResult(_0x23eeb9,null))[_0x75d8('0x27')](handleError(_0x23eeb9,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index eaed58a..3df69f2 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 _0xee5f=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelMessage'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0xee5f,0xbe));var _0xfee5=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0xee5f[_0x2605dc];return _0x4568c9;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xfee5('0x0'))['db'][_0xfee5('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xfee5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfee5('0x3'),'afterDestroy':_0xfee5('0x4')};function emitEvent(_0xc7254e){return function(_0x3babfa,_0x41f841,_0xc5681e){OpenchannelMessageEvents[_0xfee5('0x5')](_0xc7254e+':'+_0x3babfa['id'],_0x3babfa);OpenchannelMessageEvents[_0xfee5('0x5')](_0xc7254e,_0x3babfa);_0xc5681e(null);};}for(var e in events){if(events[_0xfee5('0x6')](e)){var event=events[e];OpenchannelMessage[_0xfee5('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x260b=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x378db4,_0x35a97f){var _0x3747d5=function(_0x208362){while(--_0x208362){_0x378db4['push'](_0x378db4['shift']());}};_0x3747d5(++_0x35a97f);}(_0x260b,0x8a));var _0xb260=function(_0x39c081,_0x1604cb){_0x39c081=_0x39c081-0x0;var _0x3aed88=_0x260b[_0x39c081];return _0x3aed88;};'use strict';var EventEmitter=require(_0xb260('0x0'));var OpenchannelMessage=require(_0xb260('0x1'))['db'][_0xb260('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xb260('0x3')](0x0);var events={'afterCreate':_0xb260('0x4'),'afterUpdate':_0xb260('0x5'),'afterDestroy':_0xb260('0x6')};function emitEvent(_0x4ffb94){return function(_0x4b3fe2,_0x37b027,_0x32e67a){OpenchannelMessageEvents[_0xb260('0x7')](_0x4ffb94+':'+_0x4b3fe2['id'],_0x4b3fe2);OpenchannelMessageEvents['emit'](_0x4ffb94,_0x4b3fe2);_0x32e67a(null);};}for(var e in events){if(events[_0xb260('0x8')](e)){var event=events[e];OpenchannelMessage[_0xb260('0x9')](e,emitEvent(event));}}module[_0xb260('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 809556f..87e166a 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 _0x71c2=['toLowerCase','secret','isNil','findOne','OpenchannelInteractionId','update','createdAt','catch','error','out','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','GET','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelInteraction','inspect','finally','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','direction'];(function(_0x484d85,_0x198155){var _0x1af0f5=function(_0x43d5fe){while(--_0x43d5fe){_0x484d85['push'](_0x484d85['shift']());}};_0x1af0f5(++_0x198155);}(_0x71c2,0x1d4));var _0x271c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71c2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x271c('0x0'));var util=require('util');var logger=require(_0x271c('0x1'))(_0x271c('0x2'));var moment=require(_0x271c('0x3'));var BPromise=require(_0x271c('0x4'));var rp=require(_0x271c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x271c('0x6'));var config=require(_0x271c('0x7'));var attributes=require(_0x271c('0x8'));module[_0x271c('0x9')]=function(_0x318a6c,_0x3372d7){return _0x318a6c[_0x271c('0xa')](_0x271c('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x271c('0xc'),'fields':[_0x271c('0xd')],'type':_0x271c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2de1ec,_0x592c74,_0x2d8402){var _0x27ea84=_0x318a6c[_0x271c('0xf')];var _0x331910=_0x2de1ec[_0x271c('0x10')]({'plain':!![]});if(_0x331910[_0x271c('0x11')][_0x271c('0x12')]()==='in'||_0x331910['direction'][_0x271c('0x12')]()==='out'&&!_0x331910[_0x271c('0x13')]&&!_[_0x271c('0x14')](_0x331910['UserId'])){_0x27ea84['OpenchannelInteraction'][_0x271c('0x15')]({'where':{'id':_0x331910[_0x271c('0x16')]}})['then'](function(_0x430bc0){if(_0x430bc0){_0x430bc0[_0x271c('0x17')]({'lastMsgAt':_0x331910[_0x271c('0x18')],'lastMsgDirection':_0x331910[_0x271c('0x11')][_0x271c('0x12')]()});}})[_0x271c('0x19')](function(_0x32cc8d){console[_0x271c('0x1a')](_0x32cc8d);});}if(_0x331910[_0x271c('0x11')]===_0x271c('0x1b')&&!_0x331910[_0x271c('0x13')]){var _0x57392e;_0x27ea84[_0x271c('0x1c')][_0x271c('0x1d')]()[_0x271c('0x1e')](function(_0x43c2e3){return _0x27ea84[_0x271c('0x1f')][_0x271c('0x20')]({'where':{'id':_0x331910[_0x271c('0x21')]},'include':[{'model':_0x27ea84['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x331910[_0x271c('0x16')]},'limit':0x1,'include':[{'model':_0x27ea84['CmContact'],'as':_0x271c('0x22'),'attributes':_[_0x271c('0x23')](_0x43c2e3)}]}]});})['then'](function(_0x29f8b1){_0x57392e=_0x29f8b1[_0x271c('0x10')]({'plain':!![]});if(_0x57392e&&_0x57392e[_0x271c('0x24')]){logger[_0x271c('0x25')](_0x271c('0x26'),_0x271c('0x27'),util['format'](_0x271c('0x28'),_0x331910['id'],_0x57392e['replyUri']));if(_0x57392e['Interactions']&&_0x57392e[_0x271c('0x29')][_0x271c('0x2a')]){_0x331910[_0x271c('0x2b')]=_[_0x271c('0x2c')](_0x57392e[_0x271c('0x29')][0x0],_0x271c('0x22'));_0x331910[_0x271c('0x22')]=_0x57392e[_0x271c('0x29')][0x0]['Contact'];}var _0x592c74={'method':_0x271c('0x2d'),'uri':encodeURI(_0x57392e['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x592c74['method']){case _0x271c('0x2e'):_0x592c74['qs']=_0x331910;break;case _0x271c('0x2d'):_0x592c74[_0x271c('0xd')]=_0x331910;break;}return rp(_0x592c74)['then'](function(_0x1ff601){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x271c('0x27'),util[_0x271c('0x2f')](_0x271c('0x30'),_0x331910['id'],_0x57392e[_0x271c('0x24')]));if(_0x1ff601[_0x271c('0xd')]['threadId']&&_0x1ff601[_0x271c('0xd')][_0x271c('0x31')]!=_0x331910[_0x271c('0x2b')][_0x271c('0x31')]){return _0x27ea84[_0x271c('0x32')][_0x271c('0x17')]({'threadId':_0x1ff601[_0x271c('0xd')][_0x271c('0x31')]},{'where':{'id':_0x331910['Interaction']['id']}});}else{return;}})[_0x271c('0x1e')](function(){return _0x2de1ec[_0x271c('0x17')]({'read':!![]});})[_0x271c('0x19')](function(_0x3a8275){logger['error'](_0x271c('0x26'),'afterCreate',util[_0x271c('0x33')](_0x3a8275,{'showHidden':![],'depth':null}));_0x2d8402();});}else{_0x2d8402();}})[_0x271c('0x34')](function(){_0x2d8402();});}else{_0x2d8402();}}},'charset':_0x271c('0x35'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa3ee=['keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','omit','GET','threadId','Interaction','update','OpenchannelMessage,\x20%s,\x20%s','inspect','utf8mb4_unicode_ci','../../config/logger','request-promise','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','catch','OpenchannelAccountId','CmContact','Contact'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa3ee,0xbc));var _0xea3e=function(_0x3d163e,_0x39d438){_0x3d163e=_0x3d163e-0x0;var _0x3e7d89=_0xa3ee[_0x3d163e];return _0x3e7d89;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea3e('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xea3e('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea3e('0x2'));var config=require(_0xea3e('0x3'));var attributes=require('./openchannelMessage.attributes');module[_0xea3e('0x4')]=function(_0x148a30,_0x3e1cab){return _0x148a30[_0xea3e('0x5')](_0xea3e('0x6'),attributes,{'tableName':_0xea3e('0x7'),'paranoid':![],'indexes':[{'name':_0xea3e('0x8'),'fields':[_0xea3e('0x9')],'type':_0xea3e('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c9fce,_0x10000e,_0x8f6703){var _0x40cd84=_0x148a30[_0xea3e('0xb')];var _0x58cf1a=_0x1c9fce[_0xea3e('0xc')]({'plain':!![]});if(_0x58cf1a['direction'][_0xea3e('0xd')]()==='in'||_0x58cf1a[_0xea3e('0xe')]['toLowerCase']()===_0xea3e('0xf')&&!_0x58cf1a[_0xea3e('0x10')]&&!_[_0xea3e('0x11')](_0x58cf1a[_0xea3e('0x12')])){_0x40cd84[_0xea3e('0x13')][_0xea3e('0x14')]({'where':{'id':_0x58cf1a[_0xea3e('0x15')]}})[_0xea3e('0x16')](function(_0x5967de){if(_0x5967de){_0x5967de['update']({'lastMsgAt':_0x58cf1a['createdAt'],'lastMsgDirection':_0x58cf1a['direction'][_0xea3e('0xd')]()});}})[_0xea3e('0x17')](function(_0x3071aa){console['error'](_0x3071aa);});}if(_0x58cf1a[_0xea3e('0xe')]==='out'&&!_0x58cf1a[_0xea3e('0x10')]){var _0x1aecd6;_0x40cd84['CmContact']['describe']()[_0xea3e('0x16')](function(_0x33c718){return _0x40cd84['OpenchannelAccount']['find']({'where':{'id':_0x58cf1a[_0xea3e('0x18')]},'include':[{'model':_0x40cd84['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x58cf1a[_0xea3e('0x15')]},'limit':0x1,'include':[{'model':_0x40cd84[_0xea3e('0x19')],'as':_0xea3e('0x1a'),'attributes':_[_0xea3e('0x1b')](_0x33c718)}]}]});})[_0xea3e('0x16')](function(_0x543636){_0x1aecd6=_0x543636['get']({'plain':!![]});if(_0x1aecd6&&_0x1aecd6[_0xea3e('0x1c')]){logger[_0xea3e('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0xea3e('0x1e'),util[_0xea3e('0x1f')](_0xea3e('0x20'),_0x58cf1a['id'],_0x1aecd6['replyUri']));if(_0x1aecd6[_0xea3e('0x21')]&&_0x1aecd6[_0xea3e('0x21')][_0xea3e('0x22')]){_0x58cf1a['Interaction']=_[_0xea3e('0x23')](_0x1aecd6[_0xea3e('0x21')][0x0],_0xea3e('0x1a'));_0x58cf1a[_0xea3e('0x1a')]=_0x1aecd6[_0xea3e('0x21')][0x0][_0xea3e('0x1a')];}var _0x10000e={'method':'POST','uri':encodeURI(_0x1aecd6['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x10000e['method']){case _0xea3e('0x24'):_0x10000e['qs']=_0x58cf1a;break;case'POST':_0x10000e[_0xea3e('0x9')]=_0x58cf1a;break;}return rp(_0x10000e)['then'](function(_0xdfd31f){logger[_0xea3e('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0xea3e('0x1e'),util[_0xea3e('0x1f')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x58cf1a['id'],_0x1aecd6['replyUri']));if(_0xdfd31f[_0xea3e('0x9')][_0xea3e('0x25')]&&_0xdfd31f[_0xea3e('0x9')][_0xea3e('0x25')]!=_0x58cf1a[_0xea3e('0x26')][_0xea3e('0x25')]){return _0x40cd84['OpenchannelInteraction']['update']({'threadId':_0xdfd31f[_0xea3e('0x9')]['threadId']},{'where':{'id':_0x58cf1a['Interaction']['id']}});}else{return;}})[_0xea3e('0x16')](function(){return _0x1c9fce[_0xea3e('0x27')]({'read':!![]});})['catch'](function(_0x148fee){logger['error'](_0xea3e('0x28'),_0xea3e('0x1e'),util[_0xea3e('0x29')](_0x148fee,{'showHidden':![],'depth':null}));_0x8f6703();});}else{_0x8f6703();}})['finally'](function(){_0x8f6703();});}else{_0x8f6703();}}},'charset':'utf8mb4','collate':_0xea3e('0x2a')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 1167f27..d936251 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x79c9cd,_0x38bda){var _0x1db6d6=function(_0x537cd5){while(--_0x537cd5){_0x79c9cd['push'](_0x79c9cd['shift']());}};_0x1db6d6(++_0x38bda);}(_0x0b0e,0x187));var _0xe0b0=function(_0x176d14,_0x3984ea){_0x176d14=_0x176d14-0x0;var _0x89522c=_0x0b0e[_0x176d14];return _0x89522c;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x260300,_0x4b57e2){var _0x515ebb=function(_0x5750ca){while(--_0x5750ca){_0x260300['push'](_0x260300['shift']());}};_0x515ebb(++_0x4b57e2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'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});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 49cbad0..f896424 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 _0x8cb8=['save','update','emit','register','length','openchannelMessage:'];(function(_0x13b2cb,_0x5bbcbd){var _0x25679d=function(_0xf2b294){while(--_0xf2b294){_0x13b2cb['push'](_0x13b2cb['shift']());}};_0x25679d(++_0x5bbcbd);}(_0x8cb8,0x1da));var _0x88cb=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0x8cb8[_0x546aaf];return _0x1cbf6d;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0x88cb('0x0'),'remove',_0x88cb('0x1')];function createListener(_0x5dcdbe,_0x5937da){return function(_0x310721){_0x5937da[_0x88cb('0x2')](_0x5dcdbe,_0x310721);};}function removeListener(_0x3d0714,_0x535248){return function(){OpenchannelMessageEvents['removeListener'](_0x3d0714,_0x535248);};}exports[_0x88cb('0x3')]=function(_0x31cbd9){for(var _0x5bd916=0x0,_0x47a263=events[_0x88cb('0x4')];_0x5bd916<_0x47a263;_0x5bd916++){var _0x5e23e1=events[_0x5bd916];var _0x549b92=createListener(_0x88cb('0x5')+_0x5e23e1,_0x31cbd9);OpenchannelMessageEvents['on'](_0x5e23e1,_0x549b92);}}; \ No newline at end of file +var _0x66e2=['register','length','openchannelMessage:','./openchannelMessage.events','save','emit'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x66e2,0x105));var _0x266e=function(_0x2142ea,_0x5a8f39){_0x2142ea=_0x2142ea-0x0;var _0x53e2a9=_0x66e2[_0x2142ea];return _0x53e2a9;};'use strict';var OpenchannelMessageEvents=require(_0x266e('0x0'));var events=[_0x266e('0x1'),'remove','update'];function createListener(_0x2196e7,_0x15549b){return function(_0x195c54){_0x15549b[_0x266e('0x2')](_0x2196e7,_0x195c54);};}function removeListener(_0x460288,_0x300cf7){return function(){OpenchannelMessageEvents['removeListener'](_0x460288,_0x300cf7);};}exports[_0x266e('0x3')]=function(_0x25e1ab){for(var _0x288ede=0x0,_0x1107d0=events[_0x266e('0x4')];_0x288ede<_0x1107d0;_0x288ede++){var _0x2ddd10=events[_0x288ede];var _0x51442e=createListener(_0x266e('0x5')+_0x2ddd10,_0x25e1ab);OpenchannelMessageEvents['on'](_0x2ddd10,_0x51442e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 8f335cc..a492f1e 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 _0xe1e8=['Router','fs-extra','../../config/environment','./openchannelQueue.controller','isAuthenticated','describe','get','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','addAgents','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express'];(function(_0x14d39d,_0x585cdc){var _0x3218ba=function(_0x3b7ace){while(--_0x3b7ace){_0x14d39d['push'](_0x14d39d['shift']());}};_0x3218ba(++_0x585cdc);}(_0xe1e8,0x10f));var _0x8e1e=function(_0x197bb4,_0x7848f4){_0x197bb4=_0x197bb4-0x0;var _0xc56627=_0xe1e8[_0x197bb4];return _0xc56627;};'use strict';var multer=require(_0x8e1e('0x0'));var util=require('util');var path=require(_0x8e1e('0x1'));var timeout=require(_0x8e1e('0x2'));var express=require(_0x8e1e('0x3'));var router=express[_0x8e1e('0x4')]();var fs_extra=require(_0x8e1e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e1e('0x6'));var controller=require(_0x8e1e('0x7'));router['get']('/',auth[_0x8e1e('0x8')](),controller['index']);router['get']('/describe',auth[_0x8e1e('0x8')](),controller[_0x8e1e('0x9')]);router[_0x8e1e('0xa')](_0x8e1e('0xb'),auth[_0x8e1e('0x8')](),controller[_0x8e1e('0xc')]);router[_0x8e1e('0xa')]('/:id/members',auth[_0x8e1e('0x8')](),controller[_0x8e1e('0xd')]);router[_0x8e1e('0xa')](_0x8e1e('0xe'),auth[_0x8e1e('0x8')](),controller['getTeams']);router[_0x8e1e('0xa')](_0x8e1e('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x8e1e('0x10')]('/',auth[_0x8e1e('0x8')](),controller[_0x8e1e('0x11')]);router['post'](_0x8e1e('0xe'),auth[_0x8e1e('0x8')](),controller[_0x8e1e('0x12')]);router['post'](_0x8e1e('0xf'),auth['isAuthenticated'](),controller[_0x8e1e('0x13')]);router['put'](_0x8e1e('0xb'),auth[_0x8e1e('0x8')](),controller['update']);router[_0x8e1e('0x14')](_0x8e1e('0xb'),auth[_0x8e1e('0x8')](),controller[_0x8e1e('0x15')]);router[_0x8e1e('0x14')](_0x8e1e('0xe'),auth[_0x8e1e('0x8')](),controller[_0x8e1e('0x16')]);router['delete'](_0x8e1e('0xf'),auth[_0x8e1e('0x8')](),controller[_0x8e1e('0x17')]);module[_0x8e1e('0x18')]=router; \ No newline at end of file +var _0xcc0e=['get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','update','destroy','delete','removeTeams','removeAgents','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller'];(function(_0xc74fbf,_0x59a3e6){var _0x2840cb=function(_0x2ba976){while(--_0x2ba976){_0xc74fbf['push'](_0xc74fbf['shift']());}};_0x2840cb(++_0x59a3e6);}(_0xcc0e,0x1de));var _0xecc0=function(_0x4a4433,_0x4a052f){_0x4a4433=_0x4a4433-0x0;var _0x25af8a=_0xcc0e[_0x4a4433];return _0x25af8a;};'use strict';var multer=require('multer');var util=require(_0xecc0('0x0'));var path=require(_0xecc0('0x1'));var timeout=require(_0xecc0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xecc0('0x3'));var auth=require(_0xecc0('0x4'));var interaction=require(_0xecc0('0x5'));var config=require(_0xecc0('0x6'));var controller=require(_0xecc0('0x7'));router[_0xecc0('0x8')]('/',auth[_0xecc0('0x9')](),controller[_0xecc0('0xa')]);router[_0xecc0('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xecc0('0xb')]);router[_0xecc0('0x8')](_0xecc0('0xc'),auth[_0xecc0('0x9')](),controller[_0xecc0('0xd')]);router['get'](_0xecc0('0xe'),auth['isAuthenticated'](),controller[_0xecc0('0xf')]);router['get'](_0xecc0('0x10'),auth[_0xecc0('0x9')](),controller['getTeams']);router[_0xecc0('0x8')](_0xecc0('0x11'),auth[_0xecc0('0x9')](),controller[_0xecc0('0x12')]);router[_0xecc0('0x13')]('/',auth[_0xecc0('0x9')](),controller[_0xecc0('0x14')]);router[_0xecc0('0x13')](_0xecc0('0x10'),auth[_0xecc0('0x9')](),controller['addTeams']);router[_0xecc0('0x13')](_0xecc0('0x11'),auth['isAuthenticated'](),controller[_0xecc0('0x15')]);router['put'](_0xecc0('0xc'),auth[_0xecc0('0x9')](),controller[_0xecc0('0x16')]);router['delete'](_0xecc0('0xc'),auth['isAuthenticated'](),controller[_0xecc0('0x17')]);router[_0xecc0('0x18')](_0xecc0('0x10'),auth[_0xecc0('0x9')](),controller[_0xecc0('0x19')]);router[_0xecc0('0x18')](_0xecc0('0x11'),auth[_0xecc0('0x9')](),controller[_0xecc0('0x1a')]);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 10fa0c0..ec4571a 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 _0x77f0=['STRING','name','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x1098ff,_0x352a6e){var _0x331233=function(_0x420ea5){while(--_0x420ea5){_0x1098ff['push'](_0x1098ff['shift']());}};_0x331233(++_0x352a6e);}(_0x77f0,0x19b));var _0x077f=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x77f0[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x077f('0x0'));module[_0x077f('0x1')]={'name':{'type':Sequelize[_0x077f('0x2')],'unique':_0x077f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x077f('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x077f('0x4')](_0x077f('0x5'),'beepall',_0x077f('0x6'))}}; \ No newline at end of file +var _0xae3c=['beepall','roundrobin','sequelize','exports','name','STRING','ENUM','rrmemory'];(function(_0x150fa2,_0x156632){var _0x88e6ba=function(_0x23536e){while(--_0x23536e){_0x150fa2['push'](_0x150fa2['shift']());}};_0x88e6ba(++_0x156632);}(_0xae3c,0x1ca));var _0xcae3=function(_0x38ff1e,_0x3b9385){_0x38ff1e=_0x38ff1e-0x0;var _0x3755d4=_0xae3c[_0x38ff1e];return _0x3755d4;};'use strict';var Sequelize=require(_0xcae3('0x0'));module[_0xcae3('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcae3('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcae3('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcae3('0x4')](_0xcae3('0x5'),_0xcae3('0x6'),_0xcae3('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index f62f97d..e382659 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 _0xa83f=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','lodash','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','find','catch','create','role','user','get','UserProfileSection','body','params','describe','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','User','findAndCountAll','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','ids','online','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','addAgents','spread','emit','isArray','userOpenchannelQueue:remove','getAgents','nolimit'];(function(_0x51d23a,_0x44a681){var _0x45245e=function(_0x125e29){while(--_0x125e29){_0x51d23a['push'](_0x51d23a['shift']());}};_0x45245e(++_0x44a681);}(_0xa83f,0x85));var _0xfa83=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa83f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfa83('0x0'));var rimraf=require(_0xfa83('0x1'));var zipdir=require(_0xfa83('0x2'));var jsonpatch=require(_0xfa83('0x3'));var rp=require(_0xfa83('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfa83('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfa83('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfa83('0x7'));var deskjs=require(_0xfa83('0x8'));var toCsv=require(_0xfa83('0x9'));var querystring=require(_0xfa83('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfa83('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xfa83('0xc'));var hardwareService=require(_0xfa83('0xd'));var logger=require('../../config/logger')(_0xfa83('0xe'));var utils=require(_0xfa83('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xfa83('0x10'));var db=require('../../mysqldb')['db'];config[_0xfa83('0x11')]=_['defaults'](config[_0xfa83('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0xfa83('0x12'))(new Redis(config[_0xfa83('0x11')]));require(_0xfa83('0x13'))[_0xfa83('0x14')](socket);function respondWithStatusCode(_0x2d54ed,_0x12867c){_0x12867c=_0x12867c||0xcc;return function(_0x33ac42){if(_0x33ac42){return _0x2d54ed[_0xfa83('0x15')](_0x12867c);}return _0x2d54ed['status'](_0x12867c)[_0xfa83('0x16')]();};}function respondWithResult(_0x4b2e8e,_0x2cab3a){_0x2cab3a=_0x2cab3a||0xc8;return function(_0x5c43c2){if(_0x5c43c2){return _0x4b2e8e[_0xfa83('0x17')](_0x2cab3a)[_0xfa83('0x18')](_0x5c43c2);}};}function respondWithFilteredResult(_0x2c2a57,_0x8a644b){return function(_0x34f342){if(_0x34f342){var _0x51f3e1=typeof _0x8a644b[_0xfa83('0x19')]==='undefined'&&typeof _0x8a644b['limit']===_0xfa83('0x1a');var _0xc41992=_0x34f342[_0xfa83('0x1b')];var _0x2f5d0b=_0x51f3e1?0x0:_0x8a644b[_0xfa83('0x19')];var _0x5ecfc6=_0x51f3e1?_0x34f342['count']:_0x8a644b[_0xfa83('0x19')]+_0x8a644b[_0xfa83('0x1c')];var _0x289018;if(_0x5ecfc6>=_0xc41992){_0x5ecfc6=_0xc41992;_0x289018=0xc8;}else{_0x289018=0xce;}_0x2c2a57[_0xfa83('0x17')](_0x289018);return _0x2c2a57[_0xfa83('0x1d')](_0xfa83('0x1e'),_0x2f5d0b+'-'+_0x5ecfc6+'/'+_0xc41992)[_0xfa83('0x18')](_0x34f342);}return null;};}function patchUpdates(_0x5c3c4d){return function(_0x1bdec9){try{jsonpatch[_0xfa83('0x1f')](_0x1bdec9,_0x5c3c4d,!![]);}catch(_0x35db82){return BPromise['reject'](_0x35db82);}return _0x1bdec9[_0xfa83('0x20')]();};}function saveUpdates(_0x541489,_0x38af32){return function(_0xaa402e){if(_0xaa402e){return _0xaa402e[_0xfa83('0x21')](_0x541489)[_0xfa83('0x22')](function(_0xe3d6a1){return _0xe3d6a1;});}return null;};}function removeEntity(_0x538458,_0x5a073d){return function(_0x57b959){if(_0x57b959){return _0x57b959[_0xfa83('0x23')]()[_0xfa83('0x22')](function(){var _0x239508=_0x57b959['get']({'plain':!![]});var _0x3aa314='OpenchannelQueues';return db[_0xfa83('0x24')]['destroy']({'where':{'type':_0x3aa314,'resourceId':_0x239508['id']}})['then'](function(){return _0x57b959;});})[_0xfa83('0x22')](function(){_0x538458[_0xfa83('0x17')](0xcc)[_0xfa83('0x16')]();});}};}function handleEntityNotFound(_0x117280,_0x1b140d){return function(_0x39c08b){if(!_0x39c08b){_0x117280['sendStatus'](0x194);}return _0x39c08b;};}function handleError(_0x19bf7a,_0x1c4e1e){_0x1c4e1e=_0x1c4e1e||0x1f4;return function(_0x1410a1){logger[_0xfa83('0x25')](_0x1410a1[_0xfa83('0x26')]);if(_0x1410a1[_0xfa83('0x27')]){delete _0x1410a1[_0xfa83('0x27')];}_0x19bf7a['status'](_0x1c4e1e)[_0xfa83('0x28')](_0x1410a1);};}exports[_0xfa83('0x29')]=function(_0x2a7119,_0x9641d){var _0x206f5c={},_0x4c2882={},_0x432509={'count':0x0,'rows':[]};var _0x5a2e6d=_['map'](db[_0xfa83('0x2a')][_0xfa83('0x2b')],function(_0x37b0f1){return{'name':_0x37b0f1[_0xfa83('0x2c')],'type':_0x37b0f1[_0xfa83('0x2d')][_0xfa83('0x2e')]};});_0x4c2882[_0xfa83('0x2f')]=_[_0xfa83('0x30')](_0x5a2e6d,_0xfa83('0x27'));_0x4c2882['query']=_[_0xfa83('0x31')](_0x2a7119[_0xfa83('0x32')]);_0x4c2882[_0xfa83('0x33')]=_[_0xfa83('0x34')](_0x4c2882['model'],_0x4c2882[_0xfa83('0x32')]);_0x206f5c[_0xfa83('0x35')]=_['intersection'](_0x4c2882[_0xfa83('0x2f')],qs[_0xfa83('0x36')](_0x2a7119['query']['fields']));_0x206f5c['attributes']=_0x206f5c['attributes'][_0xfa83('0x37')]?_0x206f5c[_0xfa83('0x35')]:_0x4c2882['model'];if(!_0x2a7119[_0xfa83('0x32')][_0xfa83('0x38')]('nolimit')){_0x206f5c[_0xfa83('0x1c')]=qs[_0xfa83('0x1c')](_0x2a7119[_0xfa83('0x32')]['limit']);_0x206f5c['offset']=qs[_0xfa83('0x19')](_0x2a7119[_0xfa83('0x32')]['offset']);}_0x206f5c[_0xfa83('0x39')]=qs[_0xfa83('0x3a')](_0x2a7119[_0xfa83('0x32')][_0xfa83('0x3a')]);_0x206f5c[_0xfa83('0x3b')]=qs[_0xfa83('0x33')](_['pick'](_0x2a7119[_0xfa83('0x32')],_0x4c2882[_0xfa83('0x33')]),_0x5a2e6d);if(_0x2a7119[_0xfa83('0x32')][_0xfa83('0x3c')]){_0x206f5c[_0xfa83('0x3b')]=_['merge'](_0x206f5c[_0xfa83('0x3b')],{'$or':_[_0xfa83('0x30')](_0x5a2e6d,function(_0x197f3c){if(_0x197f3c[_0xfa83('0x2d')]!=='VIRTUAL'){var _0x49fc3d={};_0x49fc3d[_0x197f3c['name']]={'$like':'%'+_0x2a7119['query'][_0xfa83('0x3c')]+'%'};return _0x49fc3d;}})});}_0x206f5c=_[_0xfa83('0x3d')]({},_0x206f5c,_0x2a7119[_0xfa83('0x3e')]);var _0x3ab0b2={'where':_0x206f5c[_0xfa83('0x3b')]};return db[_0xfa83('0x2a')]['count'](_0x3ab0b2)['then'](function(_0x31699d){_0x432509[_0xfa83('0x1b')]=_0x31699d;if(_0x2a7119[_0xfa83('0x32')][_0xfa83('0x3f')]){_0x206f5c[_0xfa83('0x40')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xfa83('0x41')](_0x206f5c);})[_0xfa83('0x22')](function(_0x144a5a){_0x432509[_0xfa83('0x42')]=_0x144a5a;return _0x432509;})[_0xfa83('0x22')](respondWithFilteredResult(_0x9641d,_0x206f5c))['catch'](handleError(_0x9641d,null));};exports[_0xfa83('0x43')]=function(_0x93025e,_0x474c84){var _0x466600={'raw':!![],'where':{'id':_0x93025e['params']['id']}},_0x56b417={};_0x56b417[_0xfa83('0x2f')]=_[_0xfa83('0x31')](db[_0xfa83('0x2a')]['rawAttributes']);_0x56b417[_0xfa83('0x32')]=_['keys'](_0x93025e['query']);_0x56b417[_0xfa83('0x33')]=_[_0xfa83('0x34')](_0x56b417[_0xfa83('0x2f')],_0x56b417[_0xfa83('0x32')]);_0x466600[_0xfa83('0x35')]=_[_0xfa83('0x34')](_0x56b417[_0xfa83('0x2f')],qs[_0xfa83('0x36')](_0x93025e[_0xfa83('0x32')][_0xfa83('0x36')]));_0x466600['attributes']=_0x466600[_0xfa83('0x35')][_0xfa83('0x37')]?_0x466600['attributes']:_0x56b417[_0xfa83('0x2f')];if(_0x93025e['query'][_0xfa83('0x3f')]){_0x466600[_0xfa83('0x40')]=[{'all':!![]}];}_0x466600=_['merge']({},_0x466600,_0x93025e[_0xfa83('0x3e')]);return db[_0xfa83('0x2a')][_0xfa83('0x44')](_0x466600)[_0xfa83('0x22')](handleEntityNotFound(_0x474c84,null))[_0xfa83('0x22')](respondWithResult(_0x474c84,null))[_0xfa83('0x45')](handleError(_0x474c84,null));};exports[_0xfa83('0x46')]=function(_0x4dfa55,_0x1389f3){return db[_0xfa83('0x2a')]['create'](_0x4dfa55['body'],{})[_0xfa83('0x22')](function(_0x5e6c38){var _0x4d97ec=_0x4dfa55['user']['get']({'plain':!![]});if(!_0x4d97ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d97ec[_0xfa83('0x47')]===_0xfa83('0x48')){var _0x3dc018=_0x5e6c38[_0xfa83('0x49')]({'plain':!![]});var _0x13af6d='OpenchannelQueues';return db[_0xfa83('0x4a')][_0xfa83('0x44')]({'where':{'name':_0x13af6d,'userProfileId':_0x4d97ec['userProfileId']},'raw':!![]})[_0xfa83('0x22')](function(_0x144e7c){if(_0x144e7c&&_0x144e7c['autoAssociation']===0x0){return db[_0xfa83('0x24')]['create']({'name':_0x3dc018[_0xfa83('0x27')],'resourceId':_0x3dc018['id'],'type':_0x144e7c[_0xfa83('0x27')],'sectionId':_0x144e7c['id']},{})[_0xfa83('0x22')](function(){return _0x5e6c38;});}else{return _0x5e6c38;}})[_0xfa83('0x45')](function(_0x539238){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x539238);throw _0x539238;});}return _0x5e6c38;})[_0xfa83('0x22')](respondWithResult(_0x1389f3,0xc9))[_0xfa83('0x45')](handleError(_0x1389f3,null));};exports[_0xfa83('0x21')]=function(_0x2abb87,_0x57539c){if(_0x2abb87['body']['id']){delete _0x2abb87[_0xfa83('0x4b')]['id'];}return db['OpenchannelQueue'][_0xfa83('0x44')]({'where':{'id':_0x2abb87[_0xfa83('0x4c')]['id']}})[_0xfa83('0x22')](handleEntityNotFound(_0x57539c,null))[_0xfa83('0x22')](saveUpdates(_0x2abb87[_0xfa83('0x4b')],null))[_0xfa83('0x22')](respondWithResult(_0x57539c,null))[_0xfa83('0x45')](handleError(_0x57539c,null));};exports[_0xfa83('0x23')]=function(_0x5800d3,_0x409b5f){return db['OpenchannelQueue'][_0xfa83('0x44')]({'where':{'id':_0x5800d3['params']['id']}})['then'](handleEntityNotFound(_0x409b5f,null))[_0xfa83('0x22')](removeEntity(_0x409b5f,null))[_0xfa83('0x45')](handleError(_0x409b5f,null));};exports[_0xfa83('0x4d')]=function(_0x1ab822,_0x4283a3){return db[_0xfa83('0x2a')][_0xfa83('0x4d')]()[_0xfa83('0x22')](respondWithResult(_0x4283a3,null))[_0xfa83('0x45')](handleError(_0x4283a3,null));};exports['getMembers']=function(_0x2672f0,_0x418523,_0x20416e){var _0x675e1c={'raw':!![],'where':{}},_0x5d5b22={},_0x20ef6a;return db[_0xfa83('0x2a')][_0xfa83('0x4e')]({'where':{'id':_0x2672f0[_0xfa83('0x4c')]['id']}})[_0xfa83('0x22')](handleEntityNotFound(_0x418523,null))[_0xfa83('0x22')](function(_0x2aa8ca){if(_0x2aa8ca){_0x20ef6a=_0x2aa8ca[_0xfa83('0x49')]({'plain':!![]});_0x5d5b22['model']=_[_0xfa83('0x31')](db[_0xfa83('0x4f')]['rawAttributes']);_0x5d5b22['query']=_['keys'](_0x2672f0[_0xfa83('0x32')]);_0x5d5b22[_0xfa83('0x33')]=_[_0xfa83('0x34')](_0x5d5b22[_0xfa83('0x2f')],_0x5d5b22[_0xfa83('0x32')]);_0x675e1c[_0xfa83('0x35')]=_[_0xfa83('0x34')](_0x5d5b22[_0xfa83('0x2f')],qs[_0xfa83('0x36')](_0x2672f0[_0xfa83('0x32')]['fields']));_0x675e1c['attributes']=_0x675e1c[_0xfa83('0x35')][_0xfa83('0x37')]?_0x675e1c['attributes']:_0x5d5b22['model'];if(!_0x2672f0[_0xfa83('0x32')]['hasOwnProperty']('nolimit')){_0x675e1c[_0xfa83('0x1c')]=qs['limit'](_0x2672f0[_0xfa83('0x32')][_0xfa83('0x1c')]);_0x675e1c[_0xfa83('0x19')]=qs[_0xfa83('0x19')](_0x2672f0[_0xfa83('0x32')][_0xfa83('0x19')]);}_0x675e1c['order']=qs['sort'](_0x2672f0[_0xfa83('0x32')][_0xfa83('0x3a')]);_0x675e1c[_0xfa83('0x3b')]=qs['filters'](_[_0xfa83('0x50')](_0x2672f0['query'],_0x5d5b22[_0xfa83('0x33')]));_0x675e1c[_0xfa83('0x3b')][_0xfa83('0x51')]=_0x2aa8ca['id'];if(_0x2672f0[_0xfa83('0x32')][_0xfa83('0x3c')]){_0x675e1c['where']=_[_0xfa83('0x3d')](_0x675e1c[_0xfa83('0x3b')],{'$or':_[_0xfa83('0x30')](_0x675e1c[_0xfa83('0x35')],function(_0xc3dedc){var _0x4dab47={};_0x4dab47[_0xc3dedc]={'$like':'%'+_0x2672f0[_0xfa83('0x32')][_0xfa83('0x3c')]+'%'};return _0x4dab47;})});}_0x675e1c=_[_0xfa83('0x3d')]({},_0x675e1c,_0x2672f0[_0xfa83('0x3e')]);return db['UserOpenchannelQueue'][_0xfa83('0x41')](_0x675e1c);}})[_0xfa83('0x22')](function(_0x5eac82){if(_0x5eac82){return db[_0xfa83('0x52')][_0xfa83('0x53')]({'where':{'id':_[_0xfa83('0x30')](_0x5eac82,_0xfa83('0x54')),'role':'agent'},'attributes':['id','name',_0xfa83('0x55'),_0xfa83('0x56'),_0xfa83('0x57')]});}})[_0xfa83('0x22')](function(_0x20f40d){if(_0x20f40d){return{'count':_0x20f40d[_0xfa83('0x1b')],'rows':_[_0xfa83('0x30')](_0x20f40d[_0xfa83('0x42')],function(_0x2720c8){return{'membername':_0x2720c8['name'],'UserId':_0x2720c8['id'],'queue_name':_0x20ef6a['name'],'OpenchannelQueueId':_0x20ef6a['id'],'interface':util[_0xfa83('0x58')](_0xfa83('0x59'),_0xfa83('0x5a'),_0x2720c8['name']),'penalty':0x0,'paused':_0x2720c8['openchannelPause'],'createdAt':_0x2720c8[_0xfa83('0x57')],'updatedAt':_0x2720c8[_0xfa83('0x56')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa83('0x22')](respondWithFilteredResult(_0x418523,_0x675e1c))[_0xfa83('0x45')](handleError(_0x418523,null));};exports[_0xfa83('0x5b')]=function(_0x3c7aed,_0x1f6608,_0x54e185){var _0x47e22d={};var _0x3d9f15={};var _0x30c64f;var _0x3625fd;return db[_0xfa83('0x2a')][_0xfa83('0x4e')]({'where':{'id':_0x3c7aed[_0xfa83('0x4c')]['id']}})[_0xfa83('0x22')](handleEntityNotFound(_0x1f6608,null))[_0xfa83('0x22')](function(_0x28e252){if(_0x28e252){_0x30c64f=_0x28e252;_0x3d9f15[_0xfa83('0x2f')]=_[_0xfa83('0x31')](db[_0xfa83('0x5c')][_0xfa83('0x2b')]);_0x3d9f15[_0xfa83('0x32')]=_[_0xfa83('0x31')](_0x3c7aed[_0xfa83('0x32')]);_0x3d9f15['filters']=_[_0xfa83('0x34')](_0x3d9f15['model'],_0x3d9f15[_0xfa83('0x32')]);_0x47e22d[_0xfa83('0x35')]=_[_0xfa83('0x34')](_0x3d9f15['model'],qs['fields'](_0x3c7aed[_0xfa83('0x32')][_0xfa83('0x36')]));_0x47e22d[_0xfa83('0x35')]=_0x47e22d[_0xfa83('0x35')][_0xfa83('0x37')]?_0x47e22d[_0xfa83('0x35')]:_0x3d9f15[_0xfa83('0x2f')];_0x47e22d[_0xfa83('0x39')]=qs[_0xfa83('0x3a')](_0x3c7aed[_0xfa83('0x32')]['sort']);_0x47e22d['where']=qs[_0xfa83('0x33')](_[_0xfa83('0x50')](_0x3c7aed[_0xfa83('0x32')],_0x3d9f15[_0xfa83('0x33')]));if(_0x3c7aed['query'][_0xfa83('0x3c')]){_0x47e22d[_0xfa83('0x3b')]=_[_0xfa83('0x3d')](_0x47e22d[_0xfa83('0x3b')],{'$or':_[_0xfa83('0x30')](_0x47e22d[_0xfa83('0x35')],function(_0x3c845f){var _0x1b7624={};_0x1b7624[_0x3c845f]={'$like':'%'+_0x3c7aed[_0xfa83('0x32')][_0xfa83('0x3c')]+'%'};return _0x1b7624;})});}_0x47e22d=_[_0xfa83('0x3d')]({},_0x47e22d,_0x3c7aed[_0xfa83('0x3e')]);return _0x30c64f['getTeams'](_0x47e22d);}})[_0xfa83('0x22')](function(_0x42b91c){if(_0x42b91c){_0x3625fd=_0x42b91c[_0xfa83('0x37')];if(!_0x3c7aed[_0xfa83('0x32')][_0xfa83('0x38')]('nolimit')){_0x47e22d[_0xfa83('0x1c')]=qs[_0xfa83('0x1c')](_0x3c7aed['query'][_0xfa83('0x1c')]);_0x47e22d['offset']=qs[_0xfa83('0x19')](_0x3c7aed[_0xfa83('0x32')][_0xfa83('0x19')]);}return _0x30c64f[_0xfa83('0x5b')](_0x47e22d);}})[_0xfa83('0x22')](function(_0x4bc214){if(_0x4bc214){return _0x4bc214?{'count':_0x3625fd,'rows':_0x4bc214}:null;}})['then'](respondWithResult(_0x1f6608,null))[_0xfa83('0x45')](handleError(_0x1f6608,null));};exports['addTeams']=function(_0x351771,_0x22c82f,_0x216b87){var _0x5beab1=_0x351771[_0xfa83('0x4b')][_0xfa83('0x5d')];return db[_0xfa83('0x5c')][_0xfa83('0x41')]({'where':{'id':_0x5beab1},'attributes':['id'],'include':[{'model':db[_0xfa83('0x52')],'as':'Agents','attributes':['id',_0xfa83('0x27'),_0xfa83('0x5e'),'voicePause',_0xfa83('0x5f')],'raw':!![]}]})[_0xfa83('0x22')](function(_0x5a8522){if(_0x5a8522){var _0x1fe128=_[_0xfa83('0x60')](_0x5a8522,function(_0x3282ce){var _0x217921=_0x3282ce['get']({'plain':!![]});return _0x217921[_0xfa83('0x61')];});return db[_0xfa83('0x2a')]['find']({'where':{'id':_0x351771[_0xfa83('0x4c')]['id']}})['then'](function(_0xa380af){return db[_0xfa83('0x62')][_0xfa83('0x63')](function(_0x158c9a){return _0xa380af[_0xfa83('0x64')](_0x5beab1,{'transaction':_0x158c9a})[_0xfa83('0x22')](function(){return BPromise[_0xfa83('0x65')](_0x1fe128,function(_0x21cc02){return db[_0xfa83('0x4f')][_0xfa83('0x66')]({'where':{'UserId':_0x21cc02['id'],'OpenchannelQueueId':_0x351771[_0xfa83('0x4c')]['id']},'transaction':_0x158c9a});});})['then'](function(){_0x1fe128[_0xfa83('0x67')](function(_0x4950ff){socket['emit'](_0xfa83('0x68'),{'UserId':_0x4950ff['id'],'OpenchannelQueueId':_0xa380af['id']});});});});});}})[_0xfa83('0x22')](respondWithStatusCode(_0x22c82f,null))[_0xfa83('0x45')](handleError(_0x22c82f,null));};exports[_0xfa83('0x69')]=function(_0xecc498,_0x45423c,_0x147083){return db[_0xfa83('0x5c')][_0xfa83('0x41')]({'where':{'id':_0xecc498[_0xfa83('0x32')][_0xfa83('0x5d')]},'attributes':['id'],'include':[{'model':db[_0xfa83('0x52')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfa83('0x22')](handleEntityNotFound(_0x45423c,null))[_0xfa83('0x22')](function(_0x5143fe){var _0x551506=_[_0xfa83('0x30')](_0x5143fe,'id');var _0x28bc68=[];var _0x6169c2=[];var _0x1b1a98=squel[_0xfa83('0x6a')]();_0x1b1a98[_0xfa83('0x6b')](_0xfa83('0x6c'))['from'](_0xfa83('0x6d'),'tq')[_0xfa83('0x6e')](_0xfa83('0x6f'),'ut',_0xfa83('0x70'))[_0xfa83('0x3b')](_0xfa83('0x71'),_0xecc498[_0xfa83('0x4c')]['id']);for(var _0x308e96=0x0;_0x308e96<_0x5143fe[_0xfa83('0x37')];_0x308e96+=0x1){let _0x116a58=_0x5143fe[_0x308e96];for(var _0x5758eb=0x0;_0x5758eb<_0x116a58[_0xfa83('0x61')][_0xfa83('0x37')];_0x5758eb+=0x1){let _0x25dfa1=_0x116a58[_0xfa83('0x61')][_0x5758eb];var _0x2edc35=_0x1b1a98['clone']();_0x2edc35[_0xfa83('0x3b')](_0xfa83('0x72'),_0x25dfa1['id']);_0x6169c2['push'](db[_0xfa83('0x62')][_0xfa83('0x32')](_0x2edc35[_0xfa83('0x73')](),{'type':db[_0xfa83('0x62')][_0xfa83('0x74')][_0xfa83('0x75')]})[_0xfa83('0x22')](function(_0x23b1e3){if(_0x23b1e3['length']===0x1){return _0x25dfa1['id'];}else{var _0x6ea4ce=_[_0xfa83('0x76')](_[_0xfa83('0x30')](_0x23b1e3,_0xfa83('0x77')),function(_0x3b76be){return _[_0xfa83('0x78')](_0x551506,_0x3b76be);});if(_0x6ea4ce){return _0x25dfa1['id'];}}}));}}return BPromise[_0xfa83('0x79')](_0x6169c2)[_0xfa83('0x22')](function(_0x286976){_0x28bc68=_(_0x28bc68)[_0xfa83('0x7a')](_0x286976)['compact']()[_0xfa83('0x7b')]();return db[_0xfa83('0x2a')]['find']({'where':{'id':_0xecc498[_0xfa83('0x4c')]['id']}})[_0xfa83('0x22')](function(_0x49d1f3){return db['sequelize'][_0xfa83('0x63')](function(_0x59981e){return _0x49d1f3[_0xfa83('0x69')](_0xecc498[_0xfa83('0x32')]['ids'],{'transaction':_0x59981e})[_0xfa83('0x22')](function(){if(!_[_0xfa83('0x7c')](_0x28bc68)){return _0x49d1f3[_0xfa83('0x7d')](_0x28bc68,{'transaction':_0x59981e});}})[_0xfa83('0x22')](function(){_0x28bc68['forEach'](function(_0x9acc81){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x9acc81,'OpenchannelQueueId':_0x49d1f3['id']});});});});});});})['then'](respondWithStatusCode(_0x45423c,null))[_0xfa83('0x45')](handleError(_0x45423c,null));};exports[_0xfa83('0x7e')]=function(_0x35b83b,_0x4eeb29,_0x1bb04f){return db[_0xfa83('0x2a')][_0xfa83('0x44')]({'where':{'id':_0x35b83b[_0xfa83('0x4c')]['id']}})[_0xfa83('0x22')](handleEntityNotFound(_0x4eeb29,null))[_0xfa83('0x22')](function(_0x31cfe8){if(_0x31cfe8){return _0x31cfe8[_0xfa83('0x7e')](_0x35b83b[_0xfa83('0x4b')][_0xfa83('0x5d')],_['omit'](_0x35b83b[_0xfa83('0x4b')],[_0xfa83('0x5d'),'id'])||{})[_0xfa83('0x7f')](function(_0x47b8e3){for(var _0x18b719=0x0;_0x18b719<_0x35b83b['body'][_0xfa83('0x5d')][_0xfa83('0x37')];_0x18b719+=0x1){socket[_0xfa83('0x80')]('userOpenchannelQueue:save',{'UserId':Number(_0x35b83b[_0xfa83('0x4b')][_0xfa83('0x5d')][_0x18b719]),'OpenchannelQueueId':Number(_0x35b83b[_0xfa83('0x4c')]['id'])});}return _0x47b8e3;});}})[_0xfa83('0x22')](respondWithResult(_0x4eeb29,null))[_0xfa83('0x45')](handleError(_0x4eeb29,null));};exports[_0xfa83('0x7d')]=function(_0x1c5e2f,_0x3031e1,_0xa479d9){return db[_0xfa83('0x2a')][_0xfa83('0x44')]({'where':{'id':_0x1c5e2f[_0xfa83('0x4c')]['id']}})[_0xfa83('0x22')](handleEntityNotFound(_0x3031e1,null))[_0xfa83('0x22')](function(_0x5e13bd){if(_0x5e13bd){return _0x5e13bd['removeAgents'](_0x1c5e2f[_0xfa83('0x32')][_0xfa83('0x5d')])[_0xfa83('0x22')](function(){if(_[_0xfa83('0x81')](_0x1c5e2f[_0xfa83('0x32')]['ids'])){for(var _0x4d4413=0x0;_0x4d4413<_0x1c5e2f[_0xfa83('0x32')][_0xfa83('0x5d')]['length'];_0x4d4413+=0x1){socket['emit'](_0xfa83('0x82'),{'UserId':Number(_0x1c5e2f[_0xfa83('0x32')]['ids'][_0x4d4413]),'OpenchannelQueueId':Number(_0x1c5e2f[_0xfa83('0x4c')]['id'])});}}else{socket[_0xfa83('0x80')](_0xfa83('0x82'),{'UserId':Number(_0x1c5e2f[_0xfa83('0x32')][_0xfa83('0x5d')]),'OpenchannelQueueId':Number(_0x1c5e2f[_0xfa83('0x4c')]['id'])});}});}})[_0xfa83('0x22')](respondWithStatusCode(_0x3031e1,null))[_0xfa83('0x45')](handleError(_0x3031e1,null));};exports[_0xfa83('0x83')]=function(_0x379128,_0xc89db0,_0x2e77e3){var _0x5bb4d1={};var _0x5207f8={};var _0x674e34;var _0x104033;return db['OpenchannelQueue'][_0xfa83('0x4e')]({'where':{'id':_0x379128['params']['id']}})[_0xfa83('0x22')](handleEntityNotFound(_0xc89db0,null))[_0xfa83('0x22')](function(_0x360a5c){if(_0x360a5c){_0x674e34=_0x360a5c;_0x5207f8['model']=_['keys'](db[_0xfa83('0x52')][_0xfa83('0x2b')]);_0x5207f8[_0xfa83('0x32')]=_[_0xfa83('0x31')](_0x379128['query']);_0x5207f8[_0xfa83('0x33')]=_[_0xfa83('0x34')](_0x5207f8[_0xfa83('0x2f')],_0x5207f8['query']);_0x5bb4d1[_0xfa83('0x35')]=_[_0xfa83('0x34')](_0x5207f8['model'],qs[_0xfa83('0x36')](_0x379128[_0xfa83('0x32')]['fields']));_0x5bb4d1[_0xfa83('0x35')]=_0x5bb4d1[_0xfa83('0x35')]['length']?_0x5bb4d1[_0xfa83('0x35')]:_0x5207f8[_0xfa83('0x2f')];_0x5bb4d1['order']=qs[_0xfa83('0x3a')](_0x379128[_0xfa83('0x32')]['sort']);_0x5bb4d1[_0xfa83('0x3b')]=qs[_0xfa83('0x33')](_[_0xfa83('0x50')](_0x379128[_0xfa83('0x32')],_0x5207f8[_0xfa83('0x33')]));if(_0x379128[_0xfa83('0x32')][_0xfa83('0x3c')]){_0x5bb4d1['where']=_[_0xfa83('0x3d')](_0x5bb4d1[_0xfa83('0x3b')],{'$or':_[_0xfa83('0x30')](_0x5bb4d1[_0xfa83('0x35')],function(_0x271131){var _0x1beb1c={};_0x1beb1c[_0x271131]={'$like':'%'+_0x379128['query']['filter']+'%'};return _0x1beb1c;})});}_0x5bb4d1=_[_0xfa83('0x3d')]({},_0x5bb4d1,_0x379128[_0xfa83('0x3e')]);return _0x674e34['getAgents'](_0x5bb4d1);}})[_0xfa83('0x22')](function(_0x264496){if(_0x264496){_0x104033=_0x264496[_0xfa83('0x37')];if(!_0x379128[_0xfa83('0x32')][_0xfa83('0x38')](_0xfa83('0x84'))){_0x5bb4d1[_0xfa83('0x1c')]=qs['limit'](_0x379128[_0xfa83('0x32')][_0xfa83('0x1c')]);_0x5bb4d1[_0xfa83('0x19')]=qs['offset'](_0x379128[_0xfa83('0x32')][_0xfa83('0x19')]);}return _0x674e34[_0xfa83('0x83')](_0x5bb4d1);}})[_0xfa83('0x22')](function(_0x1db90f){if(_0x1db90f){return _0x1db90f?{'count':_0x104033,'rows':_0x1db90f}:null;}})['then'](respondWithResult(_0xc89db0,null))[_0xfa83('0x45')](handleError(_0xc89db0,null));}; \ No newline at end of file +var _0xdf5d=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','where','VIRTUAL','filter','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','sort','OpenchannelQueueId','UserOpenchannelQueue','UserId','agent','createdAt','format','%s/%s','openchannelPause','updatedAt','getTeams','addTeams','ids','Team','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','field','from','team_has_openchannel_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./openchannelQueue.socket','register','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf5d,0x187));var _0xddf5=function(_0x11abba,_0x56a4b6){_0x11abba=_0x11abba-0x0;var _0x1e8081=_0xdf5d[_0x11abba];return _0x1e8081;};'use strict';var emlformat=require(_0xddf5('0x0'));var rimraf=require(_0xddf5('0x1'));var zipdir=require(_0xddf5('0x2'));var jsonpatch=require(_0xddf5('0x3'));var rp=require(_0xddf5('0x4'));var moment=require(_0xddf5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xddf5('0x6'));var util=require(_0xddf5('0x7'));var path=require('path');var sox=require(_0xddf5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xddf5('0x9'));var _=require('lodash');var squel=require(_0xddf5('0xa'));var crypto=require(_0xddf5('0xb'));var jsforce=require(_0xddf5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xddf5('0xd'));var Redis=require(_0xddf5('0xe'));var authService=require(_0xddf5('0xf'));var qs=require(_0xddf5('0x10'));var as=require(_0xddf5('0x11'));var hardwareService=require(_0xddf5('0x12'));var logger=require('../../config/logger')(_0xddf5('0x13'));var utils=require(_0xddf5('0x14'));var config=require(_0xddf5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xddf5('0x16'))['db'];config[_0xddf5('0x17')]=_['defaults'](config[_0xddf5('0x17')],{'host':_0xddf5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xddf5('0x17')]));require(_0xddf5('0x19'))[_0xddf5('0x1a')](socket);function respondWithStatusCode(_0x5a756e,_0x2717be){_0x2717be=_0x2717be||0xcc;return function(_0x6d57dc){if(_0x6d57dc){return _0x5a756e[_0xddf5('0x1b')](_0x2717be);}return _0x5a756e[_0xddf5('0x1c')](_0x2717be)[_0xddf5('0x1d')]();};}function respondWithResult(_0x2573e9,_0xc9245d){_0xc9245d=_0xc9245d||0xc8;return function(_0x59bbae){if(_0x59bbae){return _0x2573e9[_0xddf5('0x1c')](_0xc9245d)[_0xddf5('0x1e')](_0x59bbae);}};}function respondWithFilteredResult(_0x31475f,_0x2c3a7c){return function(_0x2671eb){if(_0x2671eb){var _0x5ee8e7=typeof _0x2c3a7c[_0xddf5('0x1f')]===_0xddf5('0x20')&&typeof _0x2c3a7c[_0xddf5('0x21')]===_0xddf5('0x20');var _0x58b9c7=_0x2671eb[_0xddf5('0x22')];var _0x3cf9ae=_0x5ee8e7?0x0:_0x2c3a7c[_0xddf5('0x1f')];var _0x28e8bc=_0x5ee8e7?_0x2671eb['count']:_0x2c3a7c[_0xddf5('0x1f')]+_0x2c3a7c[_0xddf5('0x21')];var _0x2e6242;if(_0x28e8bc>=_0x58b9c7){_0x28e8bc=_0x58b9c7;_0x2e6242=0xc8;}else{_0x2e6242=0xce;}_0x31475f[_0xddf5('0x1c')](_0x2e6242);return _0x31475f[_0xddf5('0x23')](_0xddf5('0x24'),_0x3cf9ae+'-'+_0x28e8bc+'/'+_0x58b9c7)[_0xddf5('0x1e')](_0x2671eb);}return null;};}function patchUpdates(_0x354279){return function(_0x38d1a8){try{jsonpatch[_0xddf5('0x25')](_0x38d1a8,_0x354279,!![]);}catch(_0x27a2ee){return BPromise[_0xddf5('0x26')](_0x27a2ee);}return _0x38d1a8[_0xddf5('0x27')]();};}function saveUpdates(_0x354b8b,_0x4e89cb){return function(_0x1fd513){if(_0x1fd513){return _0x1fd513[_0xddf5('0x28')](_0x354b8b)[_0xddf5('0x29')](function(_0x572efb){return _0x572efb;});}return null;};}function removeEntity(_0x22621d,_0x104ec9){return function(_0x15dc09){if(_0x15dc09){return _0x15dc09[_0xddf5('0x2a')]()[_0xddf5('0x29')](function(){var _0x20d83b=_0x15dc09[_0xddf5('0x2b')]({'plain':!![]});var _0x400f13=_0xddf5('0x2c');return db['UserProfileResource'][_0xddf5('0x2a')]({'where':{'type':_0x400f13,'resourceId':_0x20d83b['id']}})[_0xddf5('0x29')](function(){return _0x15dc09;});})[_0xddf5('0x29')](function(){_0x22621d[_0xddf5('0x1c')](0xcc)[_0xddf5('0x1d')]();});}};}function handleEntityNotFound(_0x247c1f,_0x3d50fa){return function(_0x219aca){if(!_0x219aca){_0x247c1f[_0xddf5('0x1b')](0x194);}return _0x219aca;};}function handleError(_0x5e21ec,_0x34a5c1){_0x34a5c1=_0x34a5c1||0x1f4;return function(_0x5a0457){logger[_0xddf5('0x2d')](_0x5a0457['stack']);if(_0x5a0457[_0xddf5('0x2e')]){delete _0x5a0457['name'];}_0x5e21ec[_0xddf5('0x1c')](_0x34a5c1)[_0xddf5('0x2f')](_0x5a0457);};}exports[_0xddf5('0x30')]=function(_0x4b7c75,_0x219b01){var _0x5777cc={},_0x7837d5={},_0x4974c9={'count':0x0,'rows':[]};var _0x7fbe62=_[_0xddf5('0x31')](db[_0xddf5('0x32')][_0xddf5('0x33')],function(_0x37025d){return{'name':_0x37025d[_0xddf5('0x34')],'type':_0x37025d[_0xddf5('0x35')][_0xddf5('0x36')]};});_0x7837d5[_0xddf5('0x37')]=_[_0xddf5('0x31')](_0x7fbe62,_0xddf5('0x2e'));_0x7837d5[_0xddf5('0x38')]=_[_0xddf5('0x39')](_0x4b7c75['query']);_0x7837d5[_0xddf5('0x3a')]=_[_0xddf5('0x3b')](_0x7837d5[_0xddf5('0x37')],_0x7837d5['query']);_0x5777cc[_0xddf5('0x3c')]=_[_0xddf5('0x3b')](_0x7837d5['model'],qs[_0xddf5('0x3d')](_0x4b7c75['query'][_0xddf5('0x3d')]));_0x5777cc['attributes']=_0x5777cc[_0xddf5('0x3c')][_0xddf5('0x3e')]?_0x5777cc[_0xddf5('0x3c')]:_0x7837d5[_0xddf5('0x37')];if(!_0x4b7c75[_0xddf5('0x38')]['hasOwnProperty'](_0xddf5('0x3f'))){_0x5777cc[_0xddf5('0x21')]=qs[_0xddf5('0x21')](_0x4b7c75[_0xddf5('0x38')][_0xddf5('0x21')]);_0x5777cc[_0xddf5('0x1f')]=qs[_0xddf5('0x1f')](_0x4b7c75[_0xddf5('0x38')][_0xddf5('0x1f')]);}_0x5777cc[_0xddf5('0x40')]=qs['sort'](_0x4b7c75[_0xddf5('0x38')]['sort']);_0x5777cc['where']=qs['filters'](_[_0xddf5('0x41')](_0x4b7c75['query'],_0x7837d5[_0xddf5('0x3a')]),_0x7fbe62);if(_0x4b7c75[_0xddf5('0x38')]['filter']){_0x5777cc['where']=_['merge'](_0x5777cc[_0xddf5('0x42')],{'$or':_[_0xddf5('0x31')](_0x7fbe62,function(_0x16b667){if(_0x16b667[_0xddf5('0x35')]!==_0xddf5('0x43')){var _0x165248={};_0x165248[_0x16b667[_0xddf5('0x2e')]]={'$like':'%'+_0x4b7c75[_0xddf5('0x38')][_0xddf5('0x44')]+'%'};return _0x165248;}})});}_0x5777cc=_[_0xddf5('0x45')]({},_0x5777cc,_0x4b7c75[_0xddf5('0x46')]);var _0xd50a7d={'where':_0x5777cc[_0xddf5('0x42')]};return db[_0xddf5('0x32')][_0xddf5('0x22')](_0xd50a7d)[_0xddf5('0x29')](function(_0x164648){_0x4974c9[_0xddf5('0x22')]=_0x164648;if(_0x4b7c75[_0xddf5('0x38')]['includeAll']){_0x5777cc['include']=[{'all':!![]}];}return db[_0xddf5('0x32')][_0xddf5('0x47')](_0x5777cc);})['then'](function(_0x3bc51b){_0x4974c9[_0xddf5('0x48')]=_0x3bc51b;return _0x4974c9;})[_0xddf5('0x29')](respondWithFilteredResult(_0x219b01,_0x5777cc))[_0xddf5('0x49')](handleError(_0x219b01,null));};exports[_0xddf5('0x4a')]=function(_0x566a3e,_0x4a56b5){var _0x3f8ae2={'raw':!![],'where':{'id':_0x566a3e[_0xddf5('0x4b')]['id']}},_0x19abe7={};_0x19abe7[_0xddf5('0x37')]=_[_0xddf5('0x39')](db[_0xddf5('0x32')]['rawAttributes']);_0x19abe7['query']=_[_0xddf5('0x39')](_0x566a3e['query']);_0x19abe7[_0xddf5('0x3a')]=_[_0xddf5('0x3b')](_0x19abe7[_0xddf5('0x37')],_0x19abe7[_0xddf5('0x38')]);_0x3f8ae2[_0xddf5('0x3c')]=_[_0xddf5('0x3b')](_0x19abe7['model'],qs[_0xddf5('0x3d')](_0x566a3e[_0xddf5('0x38')][_0xddf5('0x3d')]));_0x3f8ae2[_0xddf5('0x3c')]=_0x3f8ae2[_0xddf5('0x3c')]['length']?_0x3f8ae2[_0xddf5('0x3c')]:_0x19abe7[_0xddf5('0x37')];if(_0x566a3e[_0xddf5('0x38')][_0xddf5('0x4c')]){_0x3f8ae2['include']=[{'all':!![]}];}_0x3f8ae2=_[_0xddf5('0x45')]({},_0x3f8ae2,_0x566a3e['options']);return db[_0xddf5('0x32')][_0xddf5('0x4d')](_0x3f8ae2)[_0xddf5('0x29')](handleEntityNotFound(_0x4a56b5,null))['then'](respondWithResult(_0x4a56b5,null))[_0xddf5('0x49')](handleError(_0x4a56b5,null));};exports[_0xddf5('0x4e')]=function(_0x260b07,_0x5cbfbd){return db['OpenchannelQueue'][_0xddf5('0x4e')](_0x260b07[_0xddf5('0x4f')],{})['then'](function(_0x4bee5c){var _0x5d1752=_0x260b07['user'][_0xddf5('0x2b')]({'plain':!![]});if(!_0x5d1752)throw new Error(_0xddf5('0x50'));if(_0x5d1752[_0xddf5('0x51')]==='user'){var _0x243039=_0x4bee5c['get']({'plain':!![]});var _0x350c8a=_0xddf5('0x2c');return db[_0xddf5('0x52')][_0xddf5('0x4d')]({'where':{'name':_0x350c8a,'userProfileId':_0x5d1752[_0xddf5('0x53')]},'raw':!![]})[_0xddf5('0x29')](function(_0x47731e){if(_0x47731e&&_0x47731e['autoAssociation']===0x0){return db[_0xddf5('0x54')][_0xddf5('0x4e')]({'name':_0x243039[_0xddf5('0x2e')],'resourceId':_0x243039['id'],'type':_0x47731e[_0xddf5('0x2e')],'sectionId':_0x47731e['id']},{})['then'](function(){return _0x4bee5c;});}else{return _0x4bee5c;}})[_0xddf5('0x49')](function(_0x15a855){logger['error'](_0xddf5('0x55'),_0x15a855);throw _0x15a855;});}return _0x4bee5c;})['then'](respondWithResult(_0x5cbfbd,0xc9))[_0xddf5('0x49')](handleError(_0x5cbfbd,null));};exports[_0xddf5('0x28')]=function(_0x4fd674,_0x561eee){if(_0x4fd674[_0xddf5('0x4f')]['id']){delete _0x4fd674[_0xddf5('0x4f')]['id'];}return db[_0xddf5('0x32')][_0xddf5('0x4d')]({'where':{'id':_0x4fd674['params']['id']}})[_0xddf5('0x29')](handleEntityNotFound(_0x561eee,null))['then'](saveUpdates(_0x4fd674[_0xddf5('0x4f')],null))[_0xddf5('0x29')](respondWithResult(_0x561eee,null))[_0xddf5('0x49')](handleError(_0x561eee,null));};exports[_0xddf5('0x2a')]=function(_0x1a953a,_0x32db3b){return db[_0xddf5('0x32')]['find']({'where':{'id':_0x1a953a['params']['id']}})[_0xddf5('0x29')](handleEntityNotFound(_0x32db3b,null))[_0xddf5('0x29')](removeEntity(_0x32db3b,null))[_0xddf5('0x49')](handleError(_0x32db3b,null));};exports[_0xddf5('0x56')]=function(_0x4cf32c,_0x1adea7){return db[_0xddf5('0x32')]['describe']()[_0xddf5('0x29')](respondWithResult(_0x1adea7,null))[_0xddf5('0x49')](handleError(_0x1adea7,null));};exports[_0xddf5('0x57')]=function(_0x509915,_0xfb5569,_0x529b9f){var _0x450267={'raw':!![],'where':{}},_0x2d93df={},_0x33f29b;return db[_0xddf5('0x32')][_0xddf5('0x58')]({'where':{'id':_0x509915[_0xddf5('0x4b')]['id']}})[_0xddf5('0x29')](handleEntityNotFound(_0xfb5569,null))[_0xddf5('0x29')](function(_0x5f074c){if(_0x5f074c){_0x33f29b=_0x5f074c[_0xddf5('0x2b')]({'plain':!![]});_0x2d93df['model']=_[_0xddf5('0x39')](db['UserOpenchannelQueue'][_0xddf5('0x33')]);_0x2d93df[_0xddf5('0x38')]=_[_0xddf5('0x39')](_0x509915[_0xddf5('0x38')]);_0x2d93df[_0xddf5('0x3a')]=_[_0xddf5('0x3b')](_0x2d93df[_0xddf5('0x37')],_0x2d93df[_0xddf5('0x38')]);_0x450267[_0xddf5('0x3c')]=_[_0xddf5('0x3b')](_0x2d93df[_0xddf5('0x37')],qs[_0xddf5('0x3d')](_0x509915[_0xddf5('0x38')][_0xddf5('0x3d')]));_0x450267['attributes']=_0x450267['attributes'][_0xddf5('0x3e')]?_0x450267[_0xddf5('0x3c')]:_0x2d93df['model'];if(!_0x509915[_0xddf5('0x38')][_0xddf5('0x59')](_0xddf5('0x3f'))){_0x450267['limit']=qs[_0xddf5('0x21')](_0x509915[_0xddf5('0x38')]['limit']);_0x450267[_0xddf5('0x1f')]=qs['offset'](_0x509915[_0xddf5('0x38')]['offset']);}_0x450267[_0xddf5('0x40')]=qs[_0xddf5('0x5a')](_0x509915[_0xddf5('0x38')][_0xddf5('0x5a')]);_0x450267[_0xddf5('0x42')]=qs[_0xddf5('0x3a')](_[_0xddf5('0x41')](_0x509915[_0xddf5('0x38')],_0x2d93df[_0xddf5('0x3a')]));_0x450267[_0xddf5('0x42')][_0xddf5('0x5b')]=_0x5f074c['id'];if(_0x509915['query'][_0xddf5('0x44')]){_0x450267['where']=_[_0xddf5('0x45')](_0x450267[_0xddf5('0x42')],{'$or':_[_0xddf5('0x31')](_0x450267[_0xddf5('0x3c')],function(_0x21acbc){var _0xf05566={};_0xf05566[_0x21acbc]={'$like':'%'+_0x509915['query'][_0xddf5('0x44')]+'%'};return _0xf05566;})});}_0x450267=_[_0xddf5('0x45')]({},_0x450267,_0x509915[_0xddf5('0x46')]);return db[_0xddf5('0x5c')][_0xddf5('0x47')](_0x450267);}})['then'](function(_0x5ed436){if(_0x5ed436){return db['User']['findAndCountAll']({'where':{'id':_[_0xddf5('0x31')](_0x5ed436,_0xddf5('0x5d')),'role':_0xddf5('0x5e')},'attributes':['id',_0xddf5('0x2e'),'openchannelPause','updatedAt',_0xddf5('0x5f')]});}})[_0xddf5('0x29')](function(_0x12e69c){if(_0x12e69c){return{'count':_0x12e69c[_0xddf5('0x22')],'rows':_['map'](_0x12e69c[_0xddf5('0x48')],function(_0x141eea){return{'membername':_0x141eea['name'],'UserId':_0x141eea['id'],'queue_name':_0x33f29b[_0xddf5('0x2e')],'OpenchannelQueueId':_0x33f29b['id'],'interface':util[_0xddf5('0x60')](_0xddf5('0x61'),'SIP',_0x141eea['name']),'penalty':0x0,'paused':_0x141eea[_0xddf5('0x62')],'createdAt':_0x141eea[_0xddf5('0x5f')],'updatedAt':_0x141eea[_0xddf5('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xddf5('0x29')](respondWithFilteredResult(_0xfb5569,_0x450267))[_0xddf5('0x49')](handleError(_0xfb5569,null));};exports['getTeams']=function(_0x5ce947,_0x1786ef,_0x5b853c){var _0x58ca53={};var _0xfb90ed={};var _0x4ea300;var _0x11a787;return db[_0xddf5('0x32')][_0xddf5('0x58')]({'where':{'id':_0x5ce947['params']['id']}})['then'](handleEntityNotFound(_0x1786ef,null))[_0xddf5('0x29')](function(_0x5307c8){if(_0x5307c8){_0x4ea300=_0x5307c8;_0xfb90ed[_0xddf5('0x37')]=_[_0xddf5('0x39')](db['Team'][_0xddf5('0x33')]);_0xfb90ed[_0xddf5('0x38')]=_[_0xddf5('0x39')](_0x5ce947[_0xddf5('0x38')]);_0xfb90ed[_0xddf5('0x3a')]=_['intersection'](_0xfb90ed[_0xddf5('0x37')],_0xfb90ed[_0xddf5('0x38')]);_0x58ca53['attributes']=_['intersection'](_0xfb90ed[_0xddf5('0x37')],qs[_0xddf5('0x3d')](_0x5ce947[_0xddf5('0x38')]['fields']));_0x58ca53[_0xddf5('0x3c')]=_0x58ca53['attributes']['length']?_0x58ca53[_0xddf5('0x3c')]:_0xfb90ed[_0xddf5('0x37')];_0x58ca53['order']=qs[_0xddf5('0x5a')](_0x5ce947['query']['sort']);_0x58ca53[_0xddf5('0x42')]=qs['filters'](_[_0xddf5('0x41')](_0x5ce947[_0xddf5('0x38')],_0xfb90ed[_0xddf5('0x3a')]));if(_0x5ce947[_0xddf5('0x38')][_0xddf5('0x44')]){_0x58ca53['where']=_[_0xddf5('0x45')](_0x58ca53['where'],{'$or':_[_0xddf5('0x31')](_0x58ca53[_0xddf5('0x3c')],function(_0x28a6c5){var _0x4dac40={};_0x4dac40[_0x28a6c5]={'$like':'%'+_0x5ce947['query'][_0xddf5('0x44')]+'%'};return _0x4dac40;})});}_0x58ca53=_['merge']({},_0x58ca53,_0x5ce947[_0xddf5('0x46')]);return _0x4ea300[_0xddf5('0x64')](_0x58ca53);}})[_0xddf5('0x29')](function(_0x37ee48){if(_0x37ee48){_0x11a787=_0x37ee48[_0xddf5('0x3e')];if(!_0x5ce947[_0xddf5('0x38')][_0xddf5('0x59')](_0xddf5('0x3f'))){_0x58ca53[_0xddf5('0x21')]=qs['limit'](_0x5ce947['query']['limit']);_0x58ca53[_0xddf5('0x1f')]=qs[_0xddf5('0x1f')](_0x5ce947[_0xddf5('0x38')][_0xddf5('0x1f')]);}return _0x4ea300[_0xddf5('0x64')](_0x58ca53);}})[_0xddf5('0x29')](function(_0x27ffb8){if(_0x27ffb8){return _0x27ffb8?{'count':_0x11a787,'rows':_0x27ffb8}:null;}})[_0xddf5('0x29')](respondWithResult(_0x1786ef,null))[_0xddf5('0x49')](handleError(_0x1786ef,null));};exports[_0xddf5('0x65')]=function(_0x90f8ec,_0xa617be,_0x5b6378){var _0x1bdda8=_0x90f8ec['body'][_0xddf5('0x66')];return db[_0xddf5('0x67')][_0xddf5('0x47')]({'where':{'id':_0x1bdda8},'attributes':['id'],'include':[{'model':db[_0xddf5('0x68')],'as':_0xddf5('0x69'),'attributes':['id',_0xddf5('0x2e'),_0xddf5('0x6a'),'voicePause',_0xddf5('0x6b')],'raw':!![]}]})[_0xddf5('0x29')](function(_0x20194f){if(_0x20194f){var _0x4552df=_[_0xddf5('0x6c')](_0x20194f,function(_0x3772ee){var _0x5e7842=_0x3772ee['get']({'plain':!![]});return _0x5e7842[_0xddf5('0x69')];});return db[_0xddf5('0x32')][_0xddf5('0x4d')]({'where':{'id':_0x90f8ec[_0xddf5('0x4b')]['id']}})['then'](function(_0x1b12a0){return db[_0xddf5('0x6d')][_0xddf5('0x6e')](function(_0x2d41fe){return _0x1b12a0[_0xddf5('0x65')](_0x1bdda8,{'transaction':_0x2d41fe})[_0xddf5('0x29')](function(){return BPromise[_0xddf5('0x6f')](_0x4552df,function(_0x44278a){return db[_0xddf5('0x5c')][_0xddf5('0x70')]({'where':{'UserId':_0x44278a['id'],'OpenchannelQueueId':_0x90f8ec[_0xddf5('0x4b')]['id']},'transaction':_0x2d41fe});});})[_0xddf5('0x29')](function(){_0x4552df[_0xddf5('0x71')](function(_0x1c35b1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x1c35b1['id'],'OpenchannelQueueId':_0x1b12a0['id']});});});});});}})['then'](respondWithStatusCode(_0xa617be,null))[_0xddf5('0x49')](handleError(_0xa617be,null));};exports[_0xddf5('0x72')]=function(_0x46a7c4,_0xf1ca04,_0x1a2ea6){return db[_0xddf5('0x67')]['findAll']({'where':{'id':_0x46a7c4[_0xddf5('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0xddf5('0x68')],'as':_0xddf5('0x69'),'attributes':['id'],'raw':!![]}]})[_0xddf5('0x29')](handleEntityNotFound(_0xf1ca04,null))['then'](function(_0x24a546){var _0x23120a=_[_0xddf5('0x31')](_0x24a546,'id');var _0x5ec701=[];var _0x20beab=[];var _0x4e28fa=squel['select']();_0x4e28fa[_0xddf5('0x73')]('tq.TeamId')[_0xddf5('0x74')](_0xddf5('0x75'),'tq')[_0xddf5('0x76')](_0xddf5('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xddf5('0x42')]('OpenchannelQueueId\x20=\x20?',_0x46a7c4['params']['id']);for(var _0x424548=0x0;_0x424548<_0x24a546[_0xddf5('0x3e')];_0x424548+=0x1){let _0x535196=_0x24a546[_0x424548];for(var _0x36c49b=0x0;_0x36c49b<_0x535196[_0xddf5('0x69')][_0xddf5('0x3e')];_0x36c49b+=0x1){let _0x3b6115=_0x535196[_0xddf5('0x69')][_0x36c49b];var _0x4fd466=_0x4e28fa[_0xddf5('0x78')]();_0x4fd466[_0xddf5('0x42')](_0xddf5('0x79'),_0x3b6115['id']);_0x20beab[_0xddf5('0x7a')](db[_0xddf5('0x6d')][_0xddf5('0x38')](_0x4fd466[_0xddf5('0x7b')](),{'type':db['sequelize']['QueryTypes'][_0xddf5('0x7c')]})[_0xddf5('0x29')](function(_0x2638a8){if(_0x2638a8[_0xddf5('0x3e')]===0x1){return _0x3b6115['id'];}else{var _0xf2c8ed=_[_0xddf5('0x7d')](_[_0xddf5('0x31')](_0x2638a8,_0xddf5('0x7e')),function(_0x5174c7){return _[_0xddf5('0x7f')](_0x23120a,_0x5174c7);});if(_0xf2c8ed){return _0x3b6115['id'];}}}));}}return BPromise[_0xddf5('0x80')](_0x20beab)[_0xddf5('0x29')](function(_0x295264){_0x5ec701=_(_0x5ec701)[_0xddf5('0x81')](_0x295264)[_0xddf5('0x82')]()[_0xddf5('0x83')]();return db[_0xddf5('0x32')][_0xddf5('0x4d')]({'where':{'id':_0x46a7c4[_0xddf5('0x4b')]['id']}})[_0xddf5('0x29')](function(_0x3bc5db){return db[_0xddf5('0x6d')][_0xddf5('0x6e')](function(_0x574334){return _0x3bc5db[_0xddf5('0x72')](_0x46a7c4['query'][_0xddf5('0x66')],{'transaction':_0x574334})[_0xddf5('0x29')](function(){if(!_['isEmpty'](_0x5ec701)){return _0x3bc5db[_0xddf5('0x84')](_0x5ec701,{'transaction':_0x574334});}})[_0xddf5('0x29')](function(){_0x5ec701[_0xddf5('0x71')](function(_0x24d4f5){socket[_0xddf5('0x85')](_0xddf5('0x86'),{'UserId':_0x24d4f5,'OpenchannelQueueId':_0x3bc5db['id']});});});});});});})['then'](respondWithStatusCode(_0xf1ca04,null))['catch'](handleError(_0xf1ca04,null));};exports[_0xddf5('0x87')]=function(_0x12e3b9,_0x226abc,_0x59cd3a){return db[_0xddf5('0x32')][_0xddf5('0x4d')]({'where':{'id':_0x12e3b9[_0xddf5('0x4b')]['id']}})[_0xddf5('0x29')](handleEntityNotFound(_0x226abc,null))[_0xddf5('0x29')](function(_0xce1cfd){if(_0xce1cfd){return _0xce1cfd[_0xddf5('0x87')](_0x12e3b9[_0xddf5('0x4f')][_0xddf5('0x66')],_[_0xddf5('0x88')](_0x12e3b9[_0xddf5('0x4f')],['ids','id'])||{})[_0xddf5('0x89')](function(_0xbbecfd){for(var _0x380393=0x0;_0x380393<_0x12e3b9[_0xddf5('0x4f')][_0xddf5('0x66')]['length'];_0x380393+=0x1){socket[_0xddf5('0x85')](_0xddf5('0x8a'),{'UserId':Number(_0x12e3b9[_0xddf5('0x4f')]['ids'][_0x380393]),'OpenchannelQueueId':Number(_0x12e3b9[_0xddf5('0x4b')]['id'])});}return _0xbbecfd;});}})['then'](respondWithResult(_0x226abc,null))[_0xddf5('0x49')](handleError(_0x226abc,null));};exports[_0xddf5('0x84')]=function(_0x35e5e0,_0x5d51e5,_0x10523e){return db[_0xddf5('0x32')]['find']({'where':{'id':_0x35e5e0['params']['id']}})['then'](handleEntityNotFound(_0x5d51e5,null))['then'](function(_0x4e2244){if(_0x4e2244){return _0x4e2244[_0xddf5('0x84')](_0x35e5e0[_0xddf5('0x38')][_0xddf5('0x66')])[_0xddf5('0x29')](function(){if(_['isArray'](_0x35e5e0[_0xddf5('0x38')][_0xddf5('0x66')])){for(var _0x3b86bc=0x0;_0x3b86bc<_0x35e5e0[_0xddf5('0x38')][_0xddf5('0x66')]['length'];_0x3b86bc+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x35e5e0[_0xddf5('0x38')][_0xddf5('0x66')][_0x3b86bc]),'OpenchannelQueueId':Number(_0x35e5e0['params']['id'])});}}else{socket[_0xddf5('0x85')](_0xddf5('0x86'),{'UserId':Number(_0x35e5e0['query'][_0xddf5('0x66')]),'OpenchannelQueueId':Number(_0x35e5e0[_0xddf5('0x4b')]['id'])});}});}})[_0xddf5('0x29')](respondWithStatusCode(_0x5d51e5,null))[_0xddf5('0x49')](handleError(_0x5d51e5,null));};exports['getAgents']=function(_0x1c7569,_0x3b987e,_0x562fde){var _0x50ed4f={};var _0x14ebbd={};var _0x4c1d17;var _0x57fa82;return db[_0xddf5('0x32')]['findOne']({'where':{'id':_0x1c7569[_0xddf5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3b987e,null))[_0xddf5('0x29')](function(_0x5e5a90){if(_0x5e5a90){_0x4c1d17=_0x5e5a90;_0x14ebbd['model']=_[_0xddf5('0x39')](db['User'][_0xddf5('0x33')]);_0x14ebbd[_0xddf5('0x38')]=_[_0xddf5('0x39')](_0x1c7569[_0xddf5('0x38')]);_0x14ebbd['filters']=_[_0xddf5('0x3b')](_0x14ebbd[_0xddf5('0x37')],_0x14ebbd[_0xddf5('0x38')]);_0x50ed4f[_0xddf5('0x3c')]=_[_0xddf5('0x3b')](_0x14ebbd[_0xddf5('0x37')],qs['fields'](_0x1c7569['query'][_0xddf5('0x3d')]));_0x50ed4f[_0xddf5('0x3c')]=_0x50ed4f[_0xddf5('0x3c')][_0xddf5('0x3e')]?_0x50ed4f[_0xddf5('0x3c')]:_0x14ebbd[_0xddf5('0x37')];_0x50ed4f[_0xddf5('0x40')]=qs['sort'](_0x1c7569['query'][_0xddf5('0x5a')]);_0x50ed4f[_0xddf5('0x42')]=qs['filters'](_['pick'](_0x1c7569[_0xddf5('0x38')],_0x14ebbd[_0xddf5('0x3a')]));if(_0x1c7569['query'][_0xddf5('0x44')]){_0x50ed4f[_0xddf5('0x42')]=_[_0xddf5('0x45')](_0x50ed4f['where'],{'$or':_[_0xddf5('0x31')](_0x50ed4f[_0xddf5('0x3c')],function(_0x158014){var _0x1cf0a0={};_0x1cf0a0[_0x158014]={'$like':'%'+_0x1c7569[_0xddf5('0x38')][_0xddf5('0x44')]+'%'};return _0x1cf0a0;})});}_0x50ed4f=_[_0xddf5('0x45')]({},_0x50ed4f,_0x1c7569[_0xddf5('0x46')]);return _0x4c1d17['getAgents'](_0x50ed4f);}})[_0xddf5('0x29')](function(_0x339805){if(_0x339805){_0x57fa82=_0x339805[_0xddf5('0x3e')];if(!_0x1c7569[_0xddf5('0x38')][_0xddf5('0x59')](_0xddf5('0x3f'))){_0x50ed4f[_0xddf5('0x21')]=qs[_0xddf5('0x21')](_0x1c7569[_0xddf5('0x38')][_0xddf5('0x21')]);_0x50ed4f[_0xddf5('0x1f')]=qs[_0xddf5('0x1f')](_0x1c7569[_0xddf5('0x38')][_0xddf5('0x1f')]);}return _0x4c1d17[_0xddf5('0x8b')](_0x50ed4f);}})[_0xddf5('0x29')](function(_0x313fbf){if(_0x313fbf){return _0x313fbf?{'count':_0x57fa82,'rows':_0x313fbf}:null;}})['then'](respondWithResult(_0x3b987e,null))['catch'](handleError(_0x3b987e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 103e889..3d013c3 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 _0xc6d2=['remove','emit','hook','events','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x5be962,_0x4d5331){var _0x4641b8=function(_0x1c8425){while(--_0x1c8425){_0x5be962['push'](_0x5be962['shift']());}};_0x4641b8(++_0x4d5331);}(_0xc6d2,0x17b));var _0x2c6d=function(_0x4dbf04,_0x58a20){_0x4dbf04=_0x4dbf04-0x0;var _0x4e878d=_0xc6d2[_0x4dbf04];return _0x4e878d;};'use strict';var EventEmitter=require(_0x2c6d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x2c6d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2c6d('0x2')](0x0);var events={'afterCreate':_0x2c6d('0x3'),'afterUpdate':_0x2c6d('0x4'),'afterDestroy':_0x2c6d('0x5')};function emitEvent(_0x1f9c3b){return function(_0x2773ca,_0x5543f7,_0x320ac2){OpenchannelQueueEvents[_0x2c6d('0x6')](_0x1f9c3b+':'+_0x2773ca['id'],_0x2773ca);OpenchannelQueueEvents[_0x2c6d('0x6')](_0x1f9c3b,_0x2773ca);_0x320ac2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x2c6d('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x608b=['events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0x608b,0xbe));var _0xb608=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x608b[_0x39096d];return _0x13da4f;};'use strict';var EventEmitter=require(_0xb608('0x0'));var OpenchannelQueue=require(_0xb608('0x1'))['db'][_0xb608('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb608('0x3')](0x0);var events={'afterCreate':_0xb608('0x4'),'afterUpdate':'update','afterDestroy':_0xb608('0x5')};function emitEvent(_0x194b30){return function(_0x31da3c,_0x4ce14d,_0x59e01b){OpenchannelQueueEvents[_0xb608('0x6')](_0x194b30+':'+_0x31da3c['id'],_0x31da3c);OpenchannelQueueEvents[_0xb608('0x6')](_0x194b30,_0x31da3c);_0x59e01b(null);};}for(var e in events){if(events[_0xb608('0x7')](e)){var event=events[e];OpenchannelQueue[_0xb608('0x8')](e,emitEvent(event));}}module[_0xb608('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 c61151e..c9f496e 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 _0x8d03=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash'];(function(_0x2cb893,_0x3a6b2c){var _0x2474a9=function(_0x508ba0){while(--_0x508ba0){_0x2cb893['push'](_0x2cb893['shift']());}};_0x2474a9(++_0x3a6b2c);}(_0x8d03,0xed));var _0x38d0=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x8d03[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x38d0('0x0'));var util=require('util');var logger=require(_0x38d0('0x1'))(_0x38d0('0x2'));var moment=require(_0x38d0('0x3'));var BPromise=require(_0x38d0('0x4'));var rp=require(_0x38d0('0x5'));var fs=require('fs');var path=require(_0x38d0('0x6'));var rimraf=require(_0x38d0('0x7'));var config=require(_0x38d0('0x8'));var attributes=require(_0x38d0('0x9'));module[_0x38d0('0xa')]=function(_0x1c6141,_0x3a1c0e){return _0x1c6141[_0x38d0('0xb')](_0x38d0('0xc'),attributes,{'tableName':_0x38d0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9c3=['exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x4ff2bc,_0xedd1df){var _0x21751c=function(_0x16d9c2){while(--_0x16d9c2){_0x4ff2bc['push'](_0x4ff2bc['shift']());}};_0x21751c(++_0xedd1df);}(_0xf9c3,0x7d));var _0x3f9c=function(_0x1c31f4,_0x8e8aeb){_0x1c31f4=_0x1c31f4-0x0;var _0x5a3f66=_0xf9c3[_0x1c31f4];return _0x5a3f66;};'use strict';var _=require(_0x3f9c('0x0'));var util=require(_0x3f9c('0x1'));var logger=require(_0x3f9c('0x2'))('api');var moment=require(_0x3f9c('0x3'));var BPromise=require(_0x3f9c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f9c('0x5'));var rimraf=require('rimraf');var config=require(_0x3f9c('0x6'));var attributes=require('./openchannelQueue.attributes');module[_0x3f9c('0x7')]=function(_0x641b9c,_0x4c6f2b){return _0x641b9c[_0x3f9c('0x8')](_0x3f9c('0x9'),attributes,{'tableName':_0x3f9c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 6bed086..c4056ed 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 _0x62f0=['./openchannelQueue.socket','then','info','request\x20sent','error','code','OpenchannelQueue,\x20%s,\x20%s','message','catch','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','limit','include','map','model','debug','ShowOpenchannelQueue','find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter'];(function(_0x34a077,_0x253591){var _0x3b70b8=function(_0x42db5a){while(--_0x42db5a){_0x34a077['push'](_0x34a077['shift']());}};_0x3b70b8(++_0x253591);}(_0x62f0,0x1ba));var _0x062f=function(_0x5e34a4,_0x2e63ed){_0x5e34a4=_0x5e34a4-0x0;var _0x8d41d7=_0x62f0[_0x5e34a4];return _0x8d41d7;};'use strict';var _=require('lodash');var util=require(_0x062f('0x0'));var moment=require(_0x062f('0x1'));var BPromise=require('bluebird');var rs=require(_0x062f('0x2'));var fs=require('fs');var Redis=require(_0x062f('0x3'));var db=require(_0x062f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x062f('0x5'))(_0x062f('0x6'));var config=require(_0x062f('0x7'));var jayson=require(_0x062f('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x062f('0x9')]=_[_0x062f('0xa')](config[_0x062f('0x9')],{'host':_0x062f('0xb'),'port':0x18eb});var socket=require(_0x062f('0xc'))(new Redis(config[_0x062f('0x9')]));require(_0x062f('0xd'))['register'](socket);function respondWithRpcPromise(_0x12237c,_0x13be30,_0x7b3ac6){return new BPromise(function(_0x23a5dd,_0xbdc36a){return client['request'](_0x12237c,_0x7b3ac6)[_0x062f('0xe')](function(_0x25b00b){logger[_0x062f('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x13be30,_0x062f('0x10'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x13be30,'request\x20sent',JSON['stringify'](_0x25b00b));if(_0x25b00b[_0x062f('0x11')]){if(_0x25b00b[_0x062f('0x11')][_0x062f('0x12')]===0x1f4){logger['error'](_0x062f('0x13'),_0x13be30,_0x25b00b[_0x062f('0x11')]['message']);return _0xbdc36a(_0x25b00b[_0x062f('0x11')]['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x13be30,_0x25b00b['error'][_0x062f('0x14')]);return _0x23a5dd(_0x25b00b[_0x062f('0x11')][_0x062f('0x14')]);}else{logger[_0x062f('0xf')](_0x062f('0x13'),_0x13be30,_0x062f('0x10'));_0x23a5dd(_0x25b00b['result'][_0x062f('0x14')]);}})[_0x062f('0x15')](function(_0x48714d){logger[_0x062f('0x11')](_0x062f('0x13'),_0x13be30,_0x48714d);_0xbdc36a(_0x48714d);});});}exports[_0x062f('0x16')]=function(_0x5405cf){var _0x838e8d=this;return new Promise(function(_0x151784,_0x19f278){return db[_0x062f('0x17')]['findAll']({'raw':_0x5405cf['options']?_0x5405cf[_0x062f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5405cf[_0x062f('0x18')]?_0x5405cf[_0x062f('0x18')][_0x062f('0x19')]||null:null,'attributes':_0x5405cf[_0x062f('0x18')]?_0x5405cf[_0x062f('0x18')][_0x062f('0x1a')]||null:null,'limit':_0x5405cf[_0x062f('0x18')]?_0x5405cf[_0x062f('0x18')][_0x062f('0x1b')]||null:null,'include':_0x5405cf[_0x062f('0x18')]?_0x5405cf[_0x062f('0x18')][_0x062f('0x1c')]?_[_0x062f('0x1d')](_0x5405cf['options'][_0x062f('0x1c')],function(_0xf37fea){return{'model':db[_0xf37fea[_0x062f('0x1e')]],'as':_0xf37fea['as'],'attributes':_0xf37fea[_0x062f('0x1a')],'include':_0xf37fea['include']?_[_0x062f('0x1d')](_0xf37fea[_0x062f('0x1c')],function(_0x37824c){return{'model':db[_0x37824c[_0x062f('0x1e')]],'as':_0x37824c['as'],'attributes':_0x37824c[_0x062f('0x1a')],'include':_0x37824c['include']?_[_0x062f('0x1d')](_0x37824c[_0x062f('0x1c')],function(_0x57caa5){return{'model':db[_0x57caa5[_0x062f('0x1e')]],'as':_0x57caa5['as'],'attributes':_0x57caa5[_0x062f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x062f('0xe')](function(_0x8cc103){logger[_0x062f('0xf')](_0x062f('0x16'),_0x5405cf);logger[_0x062f('0x1f')]('GetOpenchannelQueue',_0x5405cf,JSON['stringify'](_0x8cc103));_0x151784(_0x8cc103);})[_0x062f('0x15')](function(_0x3af8e2){logger['error'](_0x062f('0x16'),_0x3af8e2[_0x062f('0x14')],_0x5405cf);_0x19f278(_0x838e8d['error'](0x1f4,_0x3af8e2[_0x062f('0x14')]));});});};exports[_0x062f('0x20')]=function(_0xc368c1){var _0x2f9b1e=this;return new Promise(function(_0x1342ae,_0x217179){return db[_0x062f('0x17')][_0x062f('0x21')]({'raw':_0xc368c1['options']?_0xc368c1[_0x062f('0x18')][_0x062f('0x22')]===undefined?!![]:![]:!![],'where':_0xc368c1[_0x062f('0x18')]?_0xc368c1[_0x062f('0x18')][_0x062f('0x19')]||null:null,'attributes':_0xc368c1['options']?_0xc368c1[_0x062f('0x18')][_0x062f('0x1a')]||null:null,'include':_0xc368c1[_0x062f('0x18')]?_0xc368c1[_0x062f('0x18')][_0x062f('0x1c')]?_[_0x062f('0x1d')](_0xc368c1[_0x062f('0x18')][_0x062f('0x1c')],function(_0x226329){return{'model':db[_0x226329[_0x062f('0x1e')]],'as':_0x226329['as'],'attributes':_0x226329[_0x062f('0x1a')],'include':_0x226329[_0x062f('0x1c')]?_['map'](_0x226329[_0x062f('0x1c')],function(_0x3196e8){return{'model':db[_0x3196e8[_0x062f('0x1e')]],'as':_0x3196e8['as'],'attributes':_0x3196e8[_0x062f('0x1a')],'include':_0x3196e8['include']?_[_0x062f('0x1d')](_0x3196e8[_0x062f('0x1c')],function(_0x3ad0b2){return{'model':db[_0x3ad0b2[_0x062f('0x1e')]],'as':_0x3ad0b2['as'],'attributes':_0x3ad0b2[_0x062f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dcc99){logger['info'](_0x062f('0x20'),_0xc368c1);logger[_0x062f('0x1f')]('ShowOpenchannelQueue',_0xc368c1,JSON['stringify'](_0x4dcc99));_0x1342ae(_0x4dcc99);})[_0x062f('0x15')](function(_0xa64839){logger[_0x062f('0x11')](_0x062f('0x20'),_0xa64839[_0x062f('0x14')],_0xc368c1);_0x217179(_0x2f9b1e[_0x062f('0x11')](0x1f4,_0xa64839[_0x062f('0x14')]));});});}; \ No newline at end of file +var _0xf4b4=['attributes','limit','include','model','map','then','catch','find','where','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw'];(function(_0x1f943a,_0x1b9ec2){var _0x2a56f4=function(_0x18ad49){while(--_0x18ad49){_0x1f943a['push'](_0x1f943a['shift']());}};_0x2a56f4(++_0x1b9ec2);}(_0xf4b4,0x172));var _0x4f4b=function(_0x4f90af,_0x14b70c){_0x4f90af=_0x4f90af-0x0;var _0x5e62c0=_0xf4b4[_0x4f90af];return _0x5e62c0;};'use strict';var _=require('lodash');var util=require(_0x4f4b('0x0'));var moment=require(_0x4f4b('0x1'));var BPromise=require(_0x4f4b('0x2'));var rs=require(_0x4f4b('0x3'));var fs=require('fs');var Redis=require(_0x4f4b('0x4'));var db=require(_0x4f4b('0x5'))['db'];var utils=require(_0x4f4b('0x6'));var logger=require('../../config/logger')(_0x4f4b('0x7'));var config=require(_0x4f4b('0x8'));var jayson=require(_0x4f4b('0x9'));var client=jayson[_0x4f4b('0xa')][_0x4f4b('0xb')]({'port':0x232a});config[_0x4f4b('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4f4b('0xd'))(new Redis(config[_0x4f4b('0xc')]));require('./openchannelQueue.socket')[_0x4f4b('0xe')](socket);function respondWithRpcPromise(_0x430ce0,_0x114a1,_0x24a723){return new BPromise(function(_0x53bb07,_0x3d2362){return client[_0x4f4b('0xf')](_0x430ce0,_0x24a723)['then'](function(_0x3e9b18){logger['info'](_0x4f4b('0x10'),_0x114a1,_0x4f4b('0x11'));logger[_0x4f4b('0x12')](_0x4f4b('0x13'),_0x114a1,_0x4f4b('0x11'),JSON[_0x4f4b('0x14')](_0x3e9b18));if(_0x3e9b18[_0x4f4b('0x15')]){if(_0x3e9b18[_0x4f4b('0x15')]['code']===0x1f4){logger[_0x4f4b('0x15')](_0x4f4b('0x10'),_0x114a1,_0x3e9b18['error'][_0x4f4b('0x16')]);return _0x3d2362(_0x3e9b18['error'][_0x4f4b('0x16')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x114a1,_0x3e9b18[_0x4f4b('0x15')]['message']);return _0x53bb07(_0x3e9b18[_0x4f4b('0x15')]['message']);}else{logger[_0x4f4b('0x17')](_0x4f4b('0x10'),_0x114a1,_0x4f4b('0x11'));_0x53bb07(_0x3e9b18[_0x4f4b('0x18')]['message']);}})['catch'](function(_0x91dfcd){logger[_0x4f4b('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x114a1,_0x91dfcd);_0x3d2362(_0x91dfcd);});});}exports[_0x4f4b('0x19')]=function(_0x24859a){var _0x2c6ba7=this;return new Promise(function(_0x161e83,_0x31abab){return db[_0x4f4b('0x1a')][_0x4f4b('0x1b')]({'raw':_0x24859a[_0x4f4b('0x1c')]?_0x24859a[_0x4f4b('0x1c')][_0x4f4b('0x1d')]===undefined?!![]:![]:!![],'where':_0x24859a[_0x4f4b('0x1c')]?_0x24859a[_0x4f4b('0x1c')]['where']||null:null,'attributes':_0x24859a[_0x4f4b('0x1c')]?_0x24859a[_0x4f4b('0x1c')][_0x4f4b('0x1e')]||null:null,'limit':_0x24859a[_0x4f4b('0x1c')]?_0x24859a[_0x4f4b('0x1c')][_0x4f4b('0x1f')]||null:null,'include':_0x24859a[_0x4f4b('0x1c')]?_0x24859a['options']['include']?_['map'](_0x24859a[_0x4f4b('0x1c')][_0x4f4b('0x20')],function(_0x3c8ba6){return{'model':db[_0x3c8ba6[_0x4f4b('0x21')]],'as':_0x3c8ba6['as'],'attributes':_0x3c8ba6[_0x4f4b('0x1e')],'include':_0x3c8ba6[_0x4f4b('0x20')]?_[_0x4f4b('0x22')](_0x3c8ba6[_0x4f4b('0x20')],function(_0x592a2c){return{'model':db[_0x592a2c['model']],'as':_0x592a2c['as'],'attributes':_0x592a2c['attributes'],'include':_0x592a2c['include']?_[_0x4f4b('0x22')](_0x592a2c[_0x4f4b('0x20')],function(_0x53148d){return{'model':db[_0x53148d[_0x4f4b('0x21')]],'as':_0x53148d['as'],'attributes':_0x53148d[_0x4f4b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f4b('0x23')](function(_0x4c5bdb){logger['info'](_0x4f4b('0x19'),_0x24859a);logger[_0x4f4b('0x12')]('GetOpenchannelQueue',_0x24859a,JSON[_0x4f4b('0x14')](_0x4c5bdb));_0x161e83(_0x4c5bdb);})[_0x4f4b('0x24')](function(_0x284112){logger[_0x4f4b('0x15')](_0x4f4b('0x19'),_0x284112[_0x4f4b('0x16')],_0x24859a);_0x31abab(_0x2c6ba7[_0x4f4b('0x15')](0x1f4,_0x284112['message']));});});};exports['ShowOpenchannelQueue']=function(_0x265316){var _0x293084=this;return new Promise(function(_0x213c8b,_0x1057a2){return db[_0x4f4b('0x1a')][_0x4f4b('0x25')]({'raw':_0x265316[_0x4f4b('0x1c')]?_0x265316[_0x4f4b('0x1c')][_0x4f4b('0x1d')]===undefined?!![]:![]:!![],'where':_0x265316['options']?_0x265316[_0x4f4b('0x1c')][_0x4f4b('0x26')]||null:null,'attributes':_0x265316['options']?_0x265316[_0x4f4b('0x1c')]['attributes']||null:null,'include':_0x265316[_0x4f4b('0x1c')]?_0x265316[_0x4f4b('0x1c')][_0x4f4b('0x20')]?_[_0x4f4b('0x22')](_0x265316['options']['include'],function(_0x3c635e){return{'model':db[_0x3c635e[_0x4f4b('0x21')]],'as':_0x3c635e['as'],'attributes':_0x3c635e[_0x4f4b('0x1e')],'include':_0x3c635e[_0x4f4b('0x20')]?_[_0x4f4b('0x22')](_0x3c635e[_0x4f4b('0x20')],function(_0x523437){return{'model':db[_0x523437[_0x4f4b('0x21')]],'as':_0x523437['as'],'attributes':_0x523437[_0x4f4b('0x1e')],'include':_0x523437[_0x4f4b('0x20')]?_[_0x4f4b('0x22')](_0x523437[_0x4f4b('0x20')],function(_0x5158b2){return{'model':db[_0x5158b2['model']],'as':_0x5158b2['as'],'attributes':_0x5158b2[_0x4f4b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f4b('0x23')](function(_0x11049b){logger['info'](_0x4f4b('0x27'),_0x265316);logger['debug'](_0x4f4b('0x27'),_0x265316,JSON['stringify'](_0x11049b));_0x213c8b(_0x11049b);})['catch'](function(_0xc69f0f){logger[_0x4f4b('0x15')]('ShowOpenchannelQueue',_0xc69f0f[_0x4f4b('0x16')],_0x265316);_0x1057a2(_0x293084['error'](0x1f4,_0xc69f0f[_0x4f4b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 720083f..8df27e9 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 _0x4df5=['length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x3aa12b,_0x1cea89){var _0x1acb6f=function(_0x9dce11){while(--_0x9dce11){_0x3aa12b['push'](_0x3aa12b['shift']());}};_0x1acb6f(++_0x1cea89);}(_0x4df5,0x17a));var _0x54df=function(_0x305df4,_0x1e8a53){_0x305df4=_0x305df4-0x0;var _0x135f1b=_0x4df5[_0x305df4];return _0x135f1b;};'use strict';var OpenchannelQueueEvents=require(_0x54df('0x0'));var events=[_0x54df('0x1'),_0x54df('0x2'),_0x54df('0x3')];function createListener(_0x272db0,_0x259a07){return function(_0x57cd38){_0x259a07[_0x54df('0x4')](_0x272db0,_0x57cd38);};}function removeListener(_0x248fc4,_0xe519cc){return function(){OpenchannelQueueEvents[_0x54df('0x5')](_0x248fc4,_0xe519cc);};}exports['register']=function(_0x496a6d){for(var _0x308a51=0x0,_0x3ba856=events[_0x54df('0x6')];_0x308a51<_0x3ba856;_0x308a51++){var _0x540df3=events[_0x308a51];var _0x12cac2=createListener(_0x54df('0x7')+_0x540df3,_0x496a6d);OpenchannelQueueEvents['on'](_0x540df3,_0x12cac2);}}; \ No newline at end of file +var _0x9aa8=['openchannelQueue:','./openchannelQueue.events','remove','update','emit','removeListener','register','length'];(function(_0x458832,_0x1fdc31){var _0x2b7a6a=function(_0x307027){while(--_0x307027){_0x458832['push'](_0x458832['shift']());}};_0x2b7a6a(++_0x1fdc31);}(_0x9aa8,0x171));var _0x89aa=function(_0x3de849,_0x35af1d){_0x3de849=_0x3de849-0x0;var _0x55e555=_0x9aa8[_0x3de849];return _0x55e555;};'use strict';var OpenchannelQueueEvents=require(_0x89aa('0x0'));var events=['save',_0x89aa('0x1'),_0x89aa('0x2')];function createListener(_0x2cfaa7,_0x39c337){return function(_0x245253){_0x39c337[_0x89aa('0x3')](_0x2cfaa7,_0x245253);};}function removeListener(_0x418e8e,_0x5ec850){return function(){OpenchannelQueueEvents[_0x89aa('0x4')](_0x418e8e,_0x5ec850);};}exports[_0x89aa('0x5')]=function(_0x3e13d4){for(var _0x4c8bd5=0x0,_0x27015c=events[_0x89aa('0x6')];_0x4c8bd5<_0x27015c;_0x4c8bd5++){var _0x380800=events[_0x4c8bd5];var _0x4203a8=createListener(_0x89aa('0x7')+_0x380800,_0x3e13d4);OpenchannelQueueEvents['on'](_0x380800,_0x4203a8);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b562f5d..d63e4b6 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 _0x1ffc=['/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','index','get'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0x1ffc,0xfd));var _0xc1ff=function(_0x12678e,_0x5772b0){_0x12678e=_0x12678e-0x0;var _0x5183cc=_0x1ffc[_0x12678e];return _0x5183cc;};'use strict';var multer=require('multer');var util=require(_0xc1ff('0x0'));var path=require(_0xc1ff('0x1'));var timeout=require(_0xc1ff('0x2'));var express=require('express');var router=express[_0xc1ff('0x3')]();var fs_extra=require(_0xc1ff('0x4'));var auth=require(_0xc1ff('0x5'));var interaction=require(_0xc1ff('0x6'));var config=require(_0xc1ff('0x7'));var controller=require(_0xc1ff('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc1ff('0x9')]);router[_0xc1ff('0xa')](_0xc1ff('0xb'),auth[_0xc1ff('0xc')](),controller[_0xc1ff('0xd')]);router[_0xc1ff('0xa')](_0xc1ff('0xe'),auth[_0xc1ff('0xc')](),controller[_0xc1ff('0xf')]);router[_0xc1ff('0x10')]('/',auth['isAuthenticated'](),controller[_0xc1ff('0x11')]);router[_0xc1ff('0x12')](_0xc1ff('0xe'),auth[_0xc1ff('0xc')](),controller['update']);router[_0xc1ff('0x13')](_0xc1ff('0xe'),auth['isAuthenticated'](),controller[_0xc1ff('0x14')]);module[_0xc1ff('0x15')]=router; \ No newline at end of file +var _0xdcc5=['describe','show','post','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','/describe','isAuthenticated'];(function(_0x514d92,_0x3d85b2){var _0x263f7f=function(_0x262afb){while(--_0x262afb){_0x514d92['push'](_0x514d92['shift']());}};_0x263f7f(++_0x3d85b2);}(_0xdcc5,0x126));var _0x5dcc=function(_0x15e9b7,_0x4307ed){_0x15e9b7=_0x15e9b7-0x0;var _0x58dd3f=_0xdcc5[_0x15e9b7];return _0x58dd3f;};'use strict';var multer=require('multer');var util=require(_0x5dcc('0x0'));var path=require(_0x5dcc('0x1'));var timeout=require(_0x5dcc('0x2'));var express=require(_0x5dcc('0x3'));var router=express[_0x5dcc('0x4')]();var fs_extra=require(_0x5dcc('0x5'));var auth=require(_0x5dcc('0x6'));var interaction=require(_0x5dcc('0x7'));var config=require('../../config/environment');var controller=require(_0x5dcc('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5dcc('0x9')](_0x5dcc('0xa'),auth[_0x5dcc('0xb')](),controller[_0x5dcc('0xc')]);router['get']('/:id',auth[_0x5dcc('0xb')](),controller[_0x5dcc('0xd')]);router[_0x5dcc('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x5dcc('0xf'),auth[_0x5dcc('0xb')](),controller['update']);router['delete'](_0x5dcc('0xf'),auth['isAuthenticated'](),controller[_0x5dcc('0x10')]);module[_0x5dcc('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 23b06bd..c9b27fb 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 _0x8fdd=['exports','STRING','DATE','sequelize'];(function(_0x23dbf3,_0x3eb1f9){var _0x3d49ee=function(_0x118b5c){while(--_0x118b5c){_0x23dbf3['push'](_0x23dbf3['shift']());}};_0x3d49ee(++_0x3eb1f9);}(_0x8fdd,0x1ab));var _0xd8fd=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x8fdd[_0x6d6a66];return _0x11eb6e;};'use strict';var moment=require('moment');var Sequelize=require(_0xd8fd('0x0'));module[_0xd8fd('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd8fd('0x2')]},'joinAt':{'type':Sequelize[_0xd8fd('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd8fd('0x3')]},'reason':{'type':Sequelize[_0xd8fd('0x2')]}}; \ No newline at end of file +var _0x705a=['exports','STRING','DATE','sequelize'];(function(_0x1de0b6,_0xa5e799){var _0x22d61d=function(_0x283a31){while(--_0x283a31){_0x1de0b6['push'](_0x1de0b6['shift']());}};_0x22d61d(++_0xa5e799);}(_0x705a,0x7f));var _0xa705=function(_0x35faef,_0xdc61e7){_0x35faef=_0x35faef-0x0;var _0x30a421=_0x705a[_0x35faef];return _0x30a421;};'use strict';var moment=require('moment');var Sequelize=require(_0xa705('0x0'));module[_0xa705('0x1')]={'uniqueid':{'type':Sequelize[_0xa705('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xa705('0x2')]},'joinAt':{'type':Sequelize[_0xa705('0x3')]},'leaveAt':{'type':Sequelize[_0xa705('0x3')]},'acceptAt':{'type':Sequelize[_0xa705('0x3')]},'exitAt':{'type':Sequelize[_0xa705('0x3')]},'reason':{'type':Sequelize[_0xa705('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 21bf15d..0866a56 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 _0x2083=['ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','include','findAll','rows','catch','show','params','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x581c15,_0x1db063){var _0x1fab5f=function(_0x4bea6a){while(--_0x4bea6a){_0x581c15['push'](_0x581c15['shift']());}};_0x1fab5f(++_0x1db063);}(_0x2083,0x1e8));var _0x3208=function(_0x136408,_0x56a4ae){_0x136408=_0x136408-0x0;var _0x3b93f9=_0x2083[_0x136408];return _0x3b93f9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3208('0x0'));var jsonpatch=require(_0x3208('0x1'));var rp=require(_0x3208('0x2'));var moment=require(_0x3208('0x3'));var BPromise=require(_0x3208('0x4'));var Mustache=require(_0x3208('0x5'));var util=require(_0x3208('0x6'));var path=require('path');var sox=require(_0x3208('0x7'));var csv=require(_0x3208('0x8'));var ejs=require(_0x3208('0x9'));var fs=require('fs');var fs_extra=require(_0x3208('0xa'));var _=require('lodash');var squel=require(_0x3208('0xb'));var crypto=require(_0x3208('0xc'));var jsforce=require(_0x3208('0xd'));var deskjs=require(_0x3208('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3208('0xf'));var Redis=require(_0x3208('0x10'));var authService=require(_0x3208('0x11'));var qs=require(_0x3208('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3208('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3208('0x14'));var config=require(_0x3208('0x15'));var licenseUtil=require(_0x3208('0x16'));var db=require(_0x3208('0x17'))['db'];function respondWithStatusCode(_0x503a73,_0x398e42){_0x398e42=_0x398e42||0xcc;return function(_0x3aabfb){if(_0x3aabfb){return _0x503a73['sendStatus'](_0x398e42);}return _0x503a73[_0x3208('0x18')](_0x398e42)['end']();};}function respondWithResult(_0x57fba7,_0x195093){_0x195093=_0x195093||0xc8;return function(_0x23bc28){if(_0x23bc28){return _0x57fba7[_0x3208('0x18')](_0x195093)['json'](_0x23bc28);}};}function respondWithFilteredResult(_0x40b215,_0x3b74d4){return function(_0x273bc3){if(_0x273bc3){var _0x56f2cc=typeof _0x3b74d4[_0x3208('0x19')]===_0x3208('0x1a')&&typeof _0x3b74d4[_0x3208('0x1b')]===_0x3208('0x1a');var _0x482bd4=_0x273bc3[_0x3208('0x1c')];var _0x53ea3b=_0x56f2cc?0x0:_0x3b74d4['offset'];var _0x32e84e=_0x56f2cc?_0x273bc3[_0x3208('0x1c')]:_0x3b74d4[_0x3208('0x19')]+_0x3b74d4[_0x3208('0x1b')];var _0x2f8ec3;if(_0x32e84e>=_0x482bd4){_0x32e84e=_0x482bd4;_0x2f8ec3=0xc8;}else{_0x2f8ec3=0xce;}_0x40b215[_0x3208('0x18')](_0x2f8ec3);return _0x40b215[_0x3208('0x1d')](_0x3208('0x1e'),_0x53ea3b+'-'+_0x32e84e+'/'+_0x482bd4)[_0x3208('0x1f')](_0x273bc3);}return null;};}function patchUpdates(_0x2d4855){return function(_0x2d8321){try{jsonpatch[_0x3208('0x20')](_0x2d8321,_0x2d4855,!![]);}catch(_0x4de657){return BPromise[_0x3208('0x21')](_0x4de657);}return _0x2d8321[_0x3208('0x22')]();};}function saveUpdates(_0x43a80f,_0x42b483){return function(_0xc61b1){if(_0xc61b1){return _0xc61b1[_0x3208('0x23')](_0x43a80f)['then'](function(_0x3d51ba){return _0x3d51ba;});}return null;};}function removeEntity(_0x4aac63,_0x112777){return function(_0x49f9c7){if(_0x49f9c7){return _0x49f9c7['destroy']()[_0x3208('0x24')](function(){_0x4aac63[_0x3208('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e4f49,_0x5e1ed2){return function(_0x1bbe9d){if(!_0x1bbe9d){_0x3e4f49['sendStatus'](0x194);}return _0x1bbe9d;};}function handleError(_0x1513dd,_0x50285f){_0x50285f=_0x50285f||0x1f4;return function(_0x2682df){logger[_0x3208('0x25')](_0x2682df[_0x3208('0x26')]);if(_0x2682df['name']){delete _0x2682df['name'];}_0x1513dd[_0x3208('0x18')](_0x50285f)['send'](_0x2682df);};}exports['index']=function(_0x2f033c,_0x3df1fb){var _0x164ed2={},_0x437010={},_0x322530={'count':0x0,'rows':[]};var _0x348e86=_[_0x3208('0x27')](db[_0x3208('0x28')][_0x3208('0x29')],function(_0x8e261b){return{'name':_0x8e261b['fieldName'],'type':_0x8e261b[_0x3208('0x2a')][_0x3208('0x2b')]};});_0x437010[_0x3208('0x2c')]=_['map'](_0x348e86,'name');_0x437010[_0x3208('0x2d')]=_[_0x3208('0x2e')](_0x2f033c[_0x3208('0x2d')]);_0x437010[_0x3208('0x2f')]=_['intersection'](_0x437010['model'],_0x437010[_0x3208('0x2d')]);_0x164ed2['attributes']=_[_0x3208('0x30')](_0x437010[_0x3208('0x2c')],qs[_0x3208('0x31')](_0x2f033c[_0x3208('0x2d')][_0x3208('0x31')]));_0x164ed2[_0x3208('0x32')]=_0x164ed2[_0x3208('0x32')][_0x3208('0x33')]?_0x164ed2[_0x3208('0x32')]:_0x437010['model'];if(!_0x2f033c['query'][_0x3208('0x34')]('nolimit')){_0x164ed2[_0x3208('0x1b')]=qs['limit'](_0x2f033c[_0x3208('0x2d')]['limit']);_0x164ed2[_0x3208('0x19')]=qs[_0x3208('0x19')](_0x2f033c[_0x3208('0x2d')][_0x3208('0x19')]);}_0x164ed2[_0x3208('0x35')]=qs[_0x3208('0x36')](_0x2f033c[_0x3208('0x2d')][_0x3208('0x36')]);_0x164ed2[_0x3208('0x37')]=qs['filters'](_[_0x3208('0x38')](_0x2f033c['query'],_0x437010['filters']),_0x348e86);if(_0x2f033c[_0x3208('0x2d')][_0x3208('0x39')]){_0x164ed2[_0x3208('0x37')]=_[_0x3208('0x3a')](_0x164ed2['where'],{'$or':_[_0x3208('0x27')](_0x348e86,function(_0x468d2d){if(_0x468d2d[_0x3208('0x2a')]!==_0x3208('0x3b')){var _0x168249={};_0x168249[_0x468d2d[_0x3208('0x3c')]]={'$like':'%'+_0x2f033c[_0x3208('0x2d')]['filter']+'%'};return _0x168249;}})});}_0x164ed2=_[_0x3208('0x3a')]({},_0x164ed2,_0x2f033c[_0x3208('0x3d')]);var _0x3d61e4={'where':_0x164ed2['where']};return db['OpenchannelQueueReport']['count'](_0x3d61e4)['then'](function(_0x340d25){_0x322530[_0x3208('0x1c')]=_0x340d25;if(_0x2f033c['query']['includeAll']){_0x164ed2[_0x3208('0x3e')]=[{'all':!![]}];}return db[_0x3208('0x28')][_0x3208('0x3f')](_0x164ed2);})[_0x3208('0x24')](function(_0x1a63ef){_0x322530[_0x3208('0x40')]=_0x1a63ef;return _0x322530;})[_0x3208('0x24')](respondWithFilteredResult(_0x3df1fb,_0x164ed2))[_0x3208('0x41')](handleError(_0x3df1fb,null));};exports[_0x3208('0x42')]=function(_0x3c72e7,_0x41a07c){var _0x283970={'raw':!![],'where':{'id':_0x3c72e7[_0x3208('0x43')]['id']}},_0x37034a={};_0x37034a[_0x3208('0x2c')]=_[_0x3208('0x2e')](db['OpenchannelQueueReport'][_0x3208('0x29')]);_0x37034a[_0x3208('0x2d')]=_[_0x3208('0x2e')](_0x3c72e7[_0x3208('0x2d')]);_0x37034a['filters']=_[_0x3208('0x30')](_0x37034a['model'],_0x37034a[_0x3208('0x2d')]);_0x283970[_0x3208('0x32')]=_['intersection'](_0x37034a[_0x3208('0x2c')],qs['fields'](_0x3c72e7[_0x3208('0x2d')][_0x3208('0x31')]));_0x283970['attributes']=_0x283970['attributes'][_0x3208('0x33')]?_0x283970['attributes']:_0x37034a[_0x3208('0x2c')];if(_0x3c72e7['query']['includeAll']){_0x283970[_0x3208('0x3e')]=[{'all':!![]}];}_0x283970=_[_0x3208('0x3a')]({},_0x283970,_0x3c72e7[_0x3208('0x3d')]);return db[_0x3208('0x28')][_0x3208('0x44')](_0x283970)[_0x3208('0x24')](handleEntityNotFound(_0x41a07c,null))[_0x3208('0x24')](respondWithResult(_0x41a07c,null))[_0x3208('0x41')](handleError(_0x41a07c,null));};exports[_0x3208('0x45')]=function(_0x5e00a3,_0x4597c2){return db['OpenchannelQueueReport'][_0x3208('0x45')](_0x5e00a3[_0x3208('0x46')],{})[_0x3208('0x24')](respondWithResult(_0x4597c2,0xc9))[_0x3208('0x41')](handleError(_0x4597c2,null));};exports[_0x3208('0x23')]=function(_0x340732,_0x3f3180){if(_0x340732['body']['id']){delete _0x340732[_0x3208('0x46')]['id'];}return db['OpenchannelQueueReport'][_0x3208('0x44')]({'where':{'id':_0x340732['params']['id']}})[_0x3208('0x24')](handleEntityNotFound(_0x3f3180,null))['then'](saveUpdates(_0x340732['body'],null))[_0x3208('0x24')](respondWithResult(_0x3f3180,null))['catch'](handleError(_0x3f3180,null));};exports['destroy']=function(_0x1a8267,_0x223bf9){return db[_0x3208('0x28')]['find']({'where':{'id':_0x1a8267[_0x3208('0x43')]['id']}})[_0x3208('0x24')](handleEntityNotFound(_0x223bf9,null))[_0x3208('0x24')](removeEntity(_0x223bf9,null))[_0x3208('0x41')](handleError(_0x223bf9,null));};exports['describe']=function(_0x4c90a2,_0x3631b0){return db[_0x3208('0x28')]['describe']()[_0x3208('0x24')](respondWithResult(_0x3631b0,null))[_0x3208('0x41')](handleError(_0x3631b0,null));}; \ No newline at end of file +var _0xfb9f=['catch','show','params','rawAttributes','include','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','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','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','OpenchannelQueueReport','findAll','rows'];(function(_0x469c6c,_0x5daf29){var _0x2e9b29=function(_0x143263){while(--_0x143263){_0x469c6c['push'](_0x469c6c['shift']());}};_0x2e9b29(++_0x5daf29);}(_0xfb9f,0x17c));var _0xffb9=function(_0x52b50b,_0x5d60b8){_0x52b50b=_0x52b50b-0x0;var _0x41d66c=_0xfb9f[_0x52b50b];return _0x41d66c;};'use strict';var emlformat=require(_0xffb9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xffb9('0x1'));var jsonpatch=require(_0xffb9('0x2'));var rp=require(_0xffb9('0x3'));var moment=require('moment');var BPromise=require(_0xffb9('0x4'));var Mustache=require('mustache');var util=require(_0xffb9('0x5'));var path=require(_0xffb9('0x6'));var sox=require(_0xffb9('0x7'));var csv=require(_0xffb9('0x8'));var ejs=require(_0xffb9('0x9'));var fs=require('fs');var fs_extra=require(_0xffb9('0xa'));var _=require(_0xffb9('0xb'));var squel=require('squel');var crypto=require(_0xffb9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xffb9('0xd'));var toCsv=require('to-csv');var querystring=require(_0xffb9('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xffb9('0xf'));var qs=require(_0xffb9('0x10'));var as=require(_0xffb9('0x11'));var hardwareService=require(_0xffb9('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xffb9('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xffb9('0x14'))['db'];function respondWithStatusCode(_0x1aafe0,_0x43e25f){_0x43e25f=_0x43e25f||0xcc;return function(_0x1ebdaf){if(_0x1ebdaf){return _0x1aafe0['sendStatus'](_0x43e25f);}return _0x1aafe0[_0xffb9('0x15')](_0x43e25f)[_0xffb9('0x16')]();};}function respondWithResult(_0x15ddab,_0x41877f){_0x41877f=_0x41877f||0xc8;return function(_0x11f103){if(_0x11f103){return _0x15ddab['status'](_0x41877f)['json'](_0x11f103);}};}function respondWithFilteredResult(_0x3e8fec,_0x518ef5){return function(_0x401fae){if(_0x401fae){var _0x4df98a=typeof _0x518ef5[_0xffb9('0x17')]===_0xffb9('0x18')&&typeof _0x518ef5[_0xffb9('0x19')]===_0xffb9('0x18');var _0xdae423=_0x401fae[_0xffb9('0x1a')];var _0x474ace=_0x4df98a?0x0:_0x518ef5[_0xffb9('0x17')];var _0x2fcb02=_0x4df98a?_0x401fae[_0xffb9('0x1a')]:_0x518ef5[_0xffb9('0x17')]+_0x518ef5[_0xffb9('0x19')];var _0x5b8c71;if(_0x2fcb02>=_0xdae423){_0x2fcb02=_0xdae423;_0x5b8c71=0xc8;}else{_0x5b8c71=0xce;}_0x3e8fec[_0xffb9('0x15')](_0x5b8c71);return _0x3e8fec[_0xffb9('0x1b')](_0xffb9('0x1c'),_0x474ace+'-'+_0x2fcb02+'/'+_0xdae423)[_0xffb9('0x1d')](_0x401fae);}return null;};}function patchUpdates(_0x3926ef){return function(_0x16357e){try{jsonpatch[_0xffb9('0x1e')](_0x16357e,_0x3926ef,!![]);}catch(_0x31809f){return BPromise[_0xffb9('0x1f')](_0x31809f);}return _0x16357e[_0xffb9('0x20')]();};}function saveUpdates(_0xfaa361,_0x4e2c0c){return function(_0x108011){if(_0x108011){return _0x108011[_0xffb9('0x21')](_0xfaa361)[_0xffb9('0x22')](function(_0x29ec0c){return _0x29ec0c;});}return null;};}function removeEntity(_0x546bc7,_0x8168f5){return function(_0x185c56){if(_0x185c56){return _0x185c56['destroy']()[_0xffb9('0x22')](function(){_0x546bc7[_0xffb9('0x15')](0xcc)[_0xffb9('0x16')]();});}};}function handleEntityNotFound(_0x1fc1bc,_0x5077cb){return function(_0x5b5db0){if(!_0x5b5db0){_0x1fc1bc[_0xffb9('0x23')](0x194);}return _0x5b5db0;};}function handleError(_0x3727a9,_0x122789){_0x122789=_0x122789||0x1f4;return function(_0x292615){logger[_0xffb9('0x24')](_0x292615[_0xffb9('0x25')]);if(_0x292615[_0xffb9('0x26')]){delete _0x292615[_0xffb9('0x26')];}_0x3727a9[_0xffb9('0x15')](_0x122789)[_0xffb9('0x27')](_0x292615);};}exports[_0xffb9('0x28')]=function(_0x5e73bd,_0x627ccb){var _0x2a970c={},_0x483afa={},_0x7310d9={'count':0x0,'rows':[]};var _0x3e33d2=_['map'](db['OpenchannelQueueReport']['rawAttributes'],function(_0x5ada83){return{'name':_0x5ada83[_0xffb9('0x29')],'type':_0x5ada83[_0xffb9('0x2a')][_0xffb9('0x2b')]};});_0x483afa[_0xffb9('0x2c')]=_[_0xffb9('0x2d')](_0x3e33d2,'name');_0x483afa[_0xffb9('0x2e')]=_[_0xffb9('0x2f')](_0x5e73bd[_0xffb9('0x2e')]);_0x483afa[_0xffb9('0x30')]=_[_0xffb9('0x31')](_0x483afa[_0xffb9('0x2c')],_0x483afa[_0xffb9('0x2e')]);_0x2a970c['attributes']=_['intersection'](_0x483afa[_0xffb9('0x2c')],qs[_0xffb9('0x32')](_0x5e73bd['query']['fields']));_0x2a970c[_0xffb9('0x33')]=_0x2a970c[_0xffb9('0x33')][_0xffb9('0x34')]?_0x2a970c[_0xffb9('0x33')]:_0x483afa['model'];if(!_0x5e73bd[_0xffb9('0x2e')][_0xffb9('0x35')](_0xffb9('0x36'))){_0x2a970c['limit']=qs[_0xffb9('0x19')](_0x5e73bd['query'][_0xffb9('0x19')]);_0x2a970c['offset']=qs['offset'](_0x5e73bd[_0xffb9('0x2e')][_0xffb9('0x17')]);}_0x2a970c[_0xffb9('0x37')]=qs[_0xffb9('0x38')](_0x5e73bd['query']['sort']);_0x2a970c[_0xffb9('0x39')]=qs[_0xffb9('0x30')](_[_0xffb9('0x3a')](_0x5e73bd[_0xffb9('0x2e')],_0x483afa['filters']),_0x3e33d2);if(_0x5e73bd[_0xffb9('0x2e')]['filter']){_0x2a970c[_0xffb9('0x39')]=_['merge'](_0x2a970c[_0xffb9('0x39')],{'$or':_['map'](_0x3e33d2,function(_0x2f9619){if(_0x2f9619['type']!=='VIRTUAL'){var _0x2cbf00={};_0x2cbf00[_0x2f9619[_0xffb9('0x26')]]={'$like':'%'+_0x5e73bd[_0xffb9('0x2e')][_0xffb9('0x3b')]+'%'};return _0x2cbf00;}})});}_0x2a970c=_['merge']({},_0x2a970c,_0x5e73bd[_0xffb9('0x3c')]);var _0x16ea9f={'where':_0x2a970c[_0xffb9('0x39')]};return db[_0xffb9('0x3d')][_0xffb9('0x1a')](_0x16ea9f)[_0xffb9('0x22')](function(_0x1e4fba){_0x7310d9[_0xffb9('0x1a')]=_0x1e4fba;if(_0x5e73bd['query']['includeAll']){_0x2a970c['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xffb9('0x3e')](_0x2a970c);})[_0xffb9('0x22')](function(_0x8623ff){_0x7310d9[_0xffb9('0x3f')]=_0x8623ff;return _0x7310d9;})['then'](respondWithFilteredResult(_0x627ccb,_0x2a970c))[_0xffb9('0x40')](handleError(_0x627ccb,null));};exports[_0xffb9('0x41')]=function(_0x50c167,_0xfaab07){var _0x2644be={'raw':!![],'where':{'id':_0x50c167[_0xffb9('0x42')]['id']}},_0x417720={};_0x417720['model']=_['keys'](db[_0xffb9('0x3d')][_0xffb9('0x43')]);_0x417720[_0xffb9('0x2e')]=_[_0xffb9('0x2f')](_0x50c167['query']);_0x417720['filters']=_[_0xffb9('0x31')](_0x417720[_0xffb9('0x2c')],_0x417720[_0xffb9('0x2e')]);_0x2644be[_0xffb9('0x33')]=_[_0xffb9('0x31')](_0x417720[_0xffb9('0x2c')],qs[_0xffb9('0x32')](_0x50c167[_0xffb9('0x2e')]['fields']));_0x2644be[_0xffb9('0x33')]=_0x2644be[_0xffb9('0x33')][_0xffb9('0x34')]?_0x2644be['attributes']:_0x417720[_0xffb9('0x2c')];if(_0x50c167[_0xffb9('0x2e')]['includeAll']){_0x2644be[_0xffb9('0x44')]=[{'all':!![]}];}_0x2644be=_['merge']({},_0x2644be,_0x50c167[_0xffb9('0x3c')]);return db[_0xffb9('0x3d')]['find'](_0x2644be)[_0xffb9('0x22')](handleEntityNotFound(_0xfaab07,null))['then'](respondWithResult(_0xfaab07,null))[_0xffb9('0x40')](handleError(_0xfaab07,null));};exports[_0xffb9('0x45')]=function(_0x53b911,_0x4b6907){return db[_0xffb9('0x3d')][_0xffb9('0x45')](_0x53b911[_0xffb9('0x46')],{})[_0xffb9('0x22')](respondWithResult(_0x4b6907,0xc9))[_0xffb9('0x40')](handleError(_0x4b6907,null));};exports[_0xffb9('0x21')]=function(_0x53653c,_0x710bf9){if(_0x53653c[_0xffb9('0x46')]['id']){delete _0x53653c[_0xffb9('0x46')]['id'];}return db[_0xffb9('0x3d')][_0xffb9('0x47')]({'where':{'id':_0x53653c[_0xffb9('0x42')]['id']}})['then'](handleEntityNotFound(_0x710bf9,null))[_0xffb9('0x22')](saveUpdates(_0x53653c['body'],null))[_0xffb9('0x22')](respondWithResult(_0x710bf9,null))[_0xffb9('0x40')](handleError(_0x710bf9,null));};exports[_0xffb9('0x48')]=function(_0x118f16,_0x3e29b7){return db[_0xffb9('0x3d')][_0xffb9('0x47')]({'where':{'id':_0x118f16[_0xffb9('0x42')]['id']}})[_0xffb9('0x22')](handleEntityNotFound(_0x3e29b7,null))[_0xffb9('0x22')](removeEntity(_0x3e29b7,null))[_0xffb9('0x40')](handleError(_0x3e29b7,null));};exports[_0xffb9('0x49')]=function(_0x5d75de,_0x316de2){return db['OpenchannelQueueReport'][_0xffb9('0x49')]()['then'](respondWithResult(_0x316de2,null))[_0xffb9('0x40')](handleError(_0x316de2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index d46d9cd..579be15 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(_0x24d5d9,_0x426993){var _0x1f8e14=function(_0x4f4264){while(--_0x4f4264){_0x24d5d9['push'](_0x24d5d9['shift']());}};_0x1f8e14(++_0x426993);}(_0x1261,0x144));var _0x1126=function(_0x323bf6,_0x19aed6){_0x323bf6=_0x323bf6-0x0;var _0x18da88=_0x1261[_0x323bf6];return _0x18da88;};'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(_0x19f33e,_0x212a54){var _0x23c9ca=function(_0x414a85){while(--_0x414a85){_0x19f33e['push'](_0x19f33e['shift']());}};_0x23c9ca(++_0x212a54);}(_0x7a54,0x106));var _0x47a5=function(_0x34c950,_0x325202){_0x34c950=_0x34c950-0x0;var _0x2d1ac9=_0x7a54[_0x34c950];return _0x2d1ac9;};'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 bd7ced5..4be7efb 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 _0x5204=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','where','attributes','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5518d1,_0x44f1f9){var _0x43d39c=function(_0x51c682){while(--_0x51c682){_0x5518d1['push'](_0x5518d1['shift']());}};_0x43d39c(++_0x44f1f9);}(_0x5204,0xdf));var _0x4520=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x5204[_0x9df3d8];return _0x366da1;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c46c5){logger[_0x4520('0xc')]('CreateOpenchannelQueueReport',_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x4c46c5));_0x4ba69f(_0x4c46c5);})['catch'](function(_0x3199a9){logger[_0x4520('0x12')](_0x4520('0x17'),_0x3199a9['message'],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x3199a9[_0x4520('0x14')]));});});};exports[_0x4520('0x1c')]=function(_0x3a4680){var _0x2a8528=this;return new Promise(function(_0x552da1,_0x3774bd){return db[_0x4520('0x18')][_0x4520('0x1d')](_0x3a4680[_0x4520('0x1a')],{'raw':_0x3a4680['options']?_0x3a4680[_0x4520('0x1b')][_0x4520('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')][_0x4520('0x1f')]||null:null,'attributes':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')][_0x4520('0x20')]||null:null,'limit':_0x3a4680[_0x4520('0x1b')]?_0x3a4680[_0x4520('0x1b')]['limit']||null:null})[_0x4520('0x21')](function(_0x5c1a0b){logger[_0x4520('0xc')](_0x4520('0x1c'),_0x3a4680);logger[_0x4520('0xf')](_0x4520('0x1c'),_0x3a4680,JSON[_0x4520('0x11')](_0x5c1a0b));_0x552da1(_0x5c1a0b);})[_0x4520('0x16')](function(_0x5bb163){logger[_0x4520('0x12')]('UpdateOpenchannelQueueReport',_0x5bb163[_0x4520('0x14')],_0x3a4680);_0x3774bd(_0x2a8528['error'](0x1f4,_0x5bb163[_0x4520('0x14')]));});});}; \ No newline at end of file +var _0x23a3=['debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','raw','UpdateOpenchannelQueueReport','body','options','where','attributes','limit','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0x23a3,0x131));var _0x323a=function(_0x1bdaca,_0x36c243){_0x1bdaca=_0x1bdaca-0x0;var _0x48f486=_0x23a3[_0x1bdaca];return _0x48f486;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x323a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x323a('0x1'));var db=require(_0x323a('0x2'))['db'];var utils=require(_0x323a('0x3'));var logger=require(_0x323a('0x4'))(_0x323a('0x5'));var config=require(_0x323a('0x6'));var jayson=require(_0x323a('0x7'));var client=jayson[_0x323a('0x8')][_0x323a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad5a,_0x3452d3,_0x3544bd){return new BPromise(function(_0x568996,_0x385a54){return client[_0x323a('0xa')](_0x50ad5a,_0x3544bd)[_0x323a('0xb')](function(_0x4a74bd){logger[_0x323a('0xc')](_0x323a('0xd'),_0x3452d3,_0x323a('0xe'));logger[_0x323a('0xf')](_0x323a('0x10'),_0x3452d3,_0x323a('0xe'),JSON[_0x323a('0x11')](_0x4a74bd));if(_0x4a74bd[_0x323a('0x12')]){if(_0x4a74bd[_0x323a('0x12')][_0x323a('0x13')]===0x1f4){logger[_0x323a('0x12')](_0x323a('0xd'),_0x3452d3,_0x4a74bd[_0x323a('0x12')][_0x323a('0x14')]);return _0x385a54(_0x4a74bd['error'][_0x323a('0x14')]);}logger['error'](_0x323a('0xd'),_0x3452d3,_0x4a74bd['error']['message']);return _0x568996(_0x4a74bd[_0x323a('0x12')]['message']);}else{logger[_0x323a('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3452d3,_0x323a('0xe'));_0x568996(_0x4a74bd[_0x323a('0x15')]['message']);}})[_0x323a('0x16')](function(_0x32674f){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3452d3,_0x32674f);_0x385a54(_0x32674f);});});}exports[_0x323a('0x17')]=function(_0x221ae4){var _0x2feed1=this;return new Promise(function(_0x29dd21,_0x303338){return db[_0x323a('0x18')]['create'](_0x221ae4['body'],{'raw':_0x221ae4['options']?_0x221ae4['options'][_0x323a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xc0f3e4){logger[_0x323a('0xc')](_0x323a('0x17'),_0x221ae4);logger[_0x323a('0xf')]('CreateOpenchannelQueueReport',_0x221ae4,JSON[_0x323a('0x11')](_0xc0f3e4));_0x29dd21(_0xc0f3e4);})['catch'](function(_0x12c8d7){logger[_0x323a('0x12')](_0x323a('0x17'),_0x12c8d7['message'],_0x221ae4);_0x303338(_0x2feed1[_0x323a('0x12')](0x1f4,_0x12c8d7[_0x323a('0x14')]));});});};exports[_0x323a('0x1a')]=function(_0x2960e0){var _0x35f8ec=this;return new Promise(function(_0x204f76,_0x5ba015){return db[_0x323a('0x18')]['update'](_0x2960e0[_0x323a('0x1b')],{'raw':_0x2960e0[_0x323a('0x1c')]?_0x2960e0[_0x323a('0x1c')][_0x323a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2960e0[_0x323a('0x1c')]?_0x2960e0['options'][_0x323a('0x1d')]||null:null,'attributes':_0x2960e0[_0x323a('0x1c')]?_0x2960e0[_0x323a('0x1c')][_0x323a('0x1e')]||null:null,'limit':_0x2960e0[_0x323a('0x1c')]?_0x2960e0['options'][_0x323a('0x1f')]||null:null})['then'](function(_0x24747b){logger[_0x323a('0xc')](_0x323a('0x1a'),_0x2960e0);logger[_0x323a('0xf')](_0x323a('0x1a'),_0x2960e0,JSON[_0x323a('0x11')](_0x24747b));_0x204f76(_0x24747b);})['catch'](function(_0x2a1a85){logger[_0x323a('0x12')]('UpdateOpenchannelQueueReport',_0x2a1a85[_0x323a('0x14')],_0x2960e0);_0x5ba015(_0x35f8ec['error'](0x1f4,_0x2a1a85['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index b9ad1aa..8fec178 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 _0xf266=['post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','describe','/:id','show'];(function(_0x41b7e3,_0x410de1){var _0x14e372=function(_0x1cfbad){while(--_0x1cfbad){_0x41b7e3['push'](_0x41b7e3['shift']());}};_0x14e372(++_0x410de1);}(_0xf266,0xed));var _0x6f26=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xf266[_0x10004e];return _0x5af990;};'use strict';var multer=require(_0x6f26('0x0'));var util=require('util');var path=require(_0x6f26('0x1'));var timeout=require(_0x6f26('0x2'));var express=require(_0x6f26('0x3'));var router=express[_0x6f26('0x4')]();var fs_extra=require(_0x6f26('0x5'));var auth=require(_0x6f26('0x6'));var interaction=require(_0x6f26('0x7'));var config=require(_0x6f26('0x8'));var controller=require(_0x6f26('0x9'));router[_0x6f26('0xa')]('/',auth['isAuthenticated'](),controller[_0x6f26('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6f26('0xc')]);router[_0x6f26('0xa')](_0x6f26('0xd'),auth['isAuthenticated'](),controller[_0x6f26('0xe')]);router[_0x6f26('0xf')]('/',auth[_0x6f26('0x10')](),controller['create']);router[_0x6f26('0x11')](_0x6f26('0xd'),auth[_0x6f26('0x10')](),controller['update']);router[_0x6f26('0x12')](_0x6f26('0xd'),auth[_0x6f26('0x10')](),controller[_0x6f26('0x13')]);module[_0x6f26('0x14')]=router; \ No newline at end of file +var _0xf67a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf67a,0x105));var _0xaf67=function(_0x4bebd0,_0x5c549c){_0x4bebd0=_0x4bebd0-0x0;var _0xaf70b4=_0xf67a[_0x4bebd0];return _0xaf70b4;};'use strict';var multer=require(_0xaf67('0x0'));var util=require(_0xaf67('0x1'));var path=require(_0xaf67('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf67('0x3'));var router=express[_0xaf67('0x4')]();var fs_extra=require(_0xaf67('0x5'));var auth=require(_0xaf67('0x6'));var interaction=require(_0xaf67('0x7'));var config=require(_0xaf67('0x8'));var controller=require(_0xaf67('0x9'));router[_0xaf67('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xaf67('0xb'),auth[_0xaf67('0xc')](),controller[_0xaf67('0xd')]);router['get'](_0xaf67('0xe'),auth['isAuthenticated'](),controller[_0xaf67('0xf')]);router[_0xaf67('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaf67('0x11')]('/:id',auth[_0xaf67('0xc')](),controller[_0xaf67('0x12')]);router[_0xaf67('0x13')](_0xaf67('0xe'),auth[_0xaf67('0xc')](),controller[_0xaf67('0x14')]);module[_0xaf67('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 4919b7e..e864856 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x35f1de,_0x4dda19){var _0x4b66d6=function(_0x4ff6c5){while(--_0x4ff6c5){_0x35f1de['push'](_0x35f1de['shift']());}};_0x4b66d6(++_0x4dda19);}(_0x54ef,0x112));var _0xf54e=function(_0xa2d910,_0x40f3f9){_0xa2d910=_0xa2d910-0x0;var _0x5b09c3=_0x54ef[_0xa2d910];return _0x5b09c3;};'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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x413bab,_0x3be4a6){var _0x283f04=function(_0x452fd2){while(--_0x452fd2){_0x413bab['push'](_0x413bab['shift']());}};_0x283f04(++_0x3be4a6);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3b8f2e,_0x5a99a8){_0x3b8f2e=_0x3b8f2e-0x0;var _0x1433d5=_0xf3cd[_0x3b8f2e];return _0x1433d5;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 1fade90..09448e6 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 _0x5d15=['attributes','fields','length','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply','reject','then','destroy','sendStatus','error','name','send','index','map','fieldName','key','query','keys','intersection','model'];(function(_0x21d6fa,_0x5e623a){var _0x405b62=function(_0x54f24a){while(--_0x54f24a){_0x21d6fa['push'](_0x21d6fa['shift']());}};_0x405b62(++_0x5e623a);}(_0x5d15,0xb7));var _0x55d1=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0x5d15[_0x3fa296];return _0x10b19f;};'use strict';var emlformat=require(_0x55d1('0x0'));var rimraf=require(_0x55d1('0x1'));var zipdir=require(_0x55d1('0x2'));var jsonpatch=require(_0x55d1('0x3'));var rp=require(_0x55d1('0x4'));var moment=require(_0x55d1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x55d1('0x6'));var util=require(_0x55d1('0x7'));var path=require(_0x55d1('0x8'));var sox=require(_0x55d1('0x9'));var csv=require(_0x55d1('0xa'));var ejs=require(_0x55d1('0xb'));var fs=require('fs');var fs_extra=require(_0x55d1('0xc'));var _=require(_0x55d1('0xd'));var squel=require(_0x55d1('0xe'));var crypto=require(_0x55d1('0xf'));var jsforce=require(_0x55d1('0x10'));var deskjs=require(_0x55d1('0x11'));var toCsv=require(_0x55d1('0xa'));var querystring=require(_0x55d1('0x12'));var Papa=require('papaparse');var Redis=require(_0x55d1('0x13'));var authService=require(_0x55d1('0x14'));var qs=require(_0x55d1('0x15'));var as=require(_0x55d1('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55d1('0x17'))(_0x55d1('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x55d1('0x19'));var db=require(_0x55d1('0x1a'))['db'];function respondWithStatusCode(_0x378c60,_0x340e9b){_0x340e9b=_0x340e9b||0xcc;return function(_0x25c7e4){if(_0x25c7e4){return _0x378c60['sendStatus'](_0x340e9b);}return _0x378c60['status'](_0x340e9b)[_0x55d1('0x1b')]();};}function respondWithResult(_0x23c8b0,_0x5a78bc){_0x5a78bc=_0x5a78bc||0xc8;return function(_0xd8dec2){if(_0xd8dec2){return _0x23c8b0[_0x55d1('0x1c')](_0x5a78bc)['json'](_0xd8dec2);}};}function respondWithFilteredResult(_0x52a7f0,_0xa86de3){return function(_0x45be20){if(_0x45be20){var _0xc81932=typeof _0xa86de3[_0x55d1('0x1d')]===_0x55d1('0x1e')&&typeof _0xa86de3[_0x55d1('0x1f')]==='undefined';var _0x30871e=_0x45be20[_0x55d1('0x20')];var _0x276606=_0xc81932?0x0:_0xa86de3[_0x55d1('0x1d')];var _0x16d0cb=_0xc81932?_0x45be20[_0x55d1('0x20')]:_0xa86de3[_0x55d1('0x1d')]+_0xa86de3['limit'];var _0x1d5e9f;if(_0x16d0cb>=_0x30871e){_0x16d0cb=_0x30871e;_0x1d5e9f=0xc8;}else{_0x1d5e9f=0xce;}_0x52a7f0[_0x55d1('0x1c')](_0x1d5e9f);return _0x52a7f0[_0x55d1('0x21')]('Content-Range',_0x276606+'-'+_0x16d0cb+'/'+_0x30871e)[_0x55d1('0x22')](_0x45be20);}return null;};}function patchUpdates(_0x1f47b){return function(_0x1346ce){try{jsonpatch[_0x55d1('0x23')](_0x1346ce,_0x1f47b,!![]);}catch(_0xf15c00){return BPromise[_0x55d1('0x24')](_0xf15c00);}return _0x1346ce['save']();};}function saveUpdates(_0x54322f,_0x3d535b){return function(_0x2f54e8){if(_0x2f54e8){return _0x2f54e8['update'](_0x54322f)[_0x55d1('0x25')](function(_0x4c2127){return _0x4c2127;});}return null;};}function removeEntity(_0x5149b4,_0x5d0eff){return function(_0x42b87c){if(_0x42b87c){return _0x42b87c[_0x55d1('0x26')]()[_0x55d1('0x25')](function(){_0x5149b4['status'](0xcc)[_0x55d1('0x1b')]();});}};}function handleEntityNotFound(_0x1d69ab,_0x37de2c){return function(_0x59ac7d){if(!_0x59ac7d){_0x1d69ab[_0x55d1('0x27')](0x194);}return _0x59ac7d;};}function handleError(_0xffc25,_0x1b6494){_0x1b6494=_0x1b6494||0x1f4;return function(_0x438ab1){logger[_0x55d1('0x28')](_0x438ab1['stack']);if(_0x438ab1[_0x55d1('0x29')]){delete _0x438ab1[_0x55d1('0x29')];}_0xffc25[_0x55d1('0x1c')](_0x1b6494)[_0x55d1('0x2a')](_0x438ab1);};}exports[_0x55d1('0x2b')]=function(_0x240026,_0x330162){var _0xca2467={},_0x2e043b={},_0x3c550b={'count':0x0,'rows':[]};var _0x126af0=_[_0x55d1('0x2c')](db['OpenchannelTransferReport']['rawAttributes'],function(_0x4f8c12){return{'name':_0x4f8c12[_0x55d1('0x2d')],'type':_0x4f8c12['type'][_0x55d1('0x2e')]};});_0x2e043b['model']=_[_0x55d1('0x2c')](_0x126af0,_0x55d1('0x29'));_0x2e043b[_0x55d1('0x2f')]=_[_0x55d1('0x30')](_0x240026[_0x55d1('0x2f')]);_0x2e043b['filters']=_[_0x55d1('0x31')](_0x2e043b[_0x55d1('0x32')],_0x2e043b[_0x55d1('0x2f')]);_0xca2467[_0x55d1('0x33')]=_[_0x55d1('0x31')](_0x2e043b[_0x55d1('0x32')],qs['fields'](_0x240026['query'][_0x55d1('0x34')]));_0xca2467[_0x55d1('0x33')]=_0xca2467[_0x55d1('0x33')][_0x55d1('0x35')]?_0xca2467['attributes']:_0x2e043b[_0x55d1('0x32')];if(!_0x240026['query']['hasOwnProperty']('nolimit')){_0xca2467[_0x55d1('0x1f')]=qs[_0x55d1('0x1f')](_0x240026[_0x55d1('0x2f')][_0x55d1('0x1f')]);_0xca2467[_0x55d1('0x1d')]=qs['offset'](_0x240026[_0x55d1('0x2f')][_0x55d1('0x1d')]);}_0xca2467[_0x55d1('0x36')]=qs[_0x55d1('0x37')](_0x240026[_0x55d1('0x2f')][_0x55d1('0x37')]);_0xca2467[_0x55d1('0x38')]=qs[_0x55d1('0x39')](_[_0x55d1('0x3a')](_0x240026[_0x55d1('0x2f')],_0x2e043b[_0x55d1('0x39')]),_0x126af0);if(_0x240026['query'][_0x55d1('0x3b')]){_0xca2467[_0x55d1('0x38')]=_[_0x55d1('0x3c')](_0xca2467[_0x55d1('0x38')],{'$or':_['map'](_0x126af0,function(_0x182fa6){if(_0x182fa6[_0x55d1('0x3d')]!==_0x55d1('0x3e')){var _0x1a038f={};_0x1a038f[_0x182fa6[_0x55d1('0x29')]]={'$like':'%'+_0x240026['query'][_0x55d1('0x3b')]+'%'};return _0x1a038f;}})});}_0xca2467=_['merge']({},_0xca2467,_0x240026[_0x55d1('0x3f')]);var _0x4a218a={'where':_0xca2467[_0x55d1('0x38')]};return db[_0x55d1('0x40')][_0x55d1('0x20')](_0x4a218a)[_0x55d1('0x25')](function(_0x29dd89){_0x3c550b[_0x55d1('0x20')]=_0x29dd89;if(_0x240026['query'][_0x55d1('0x41')]){_0xca2467[_0x55d1('0x42')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x55d1('0x43')](_0xca2467);})[_0x55d1('0x25')](function(_0x3dfb64){_0x3c550b[_0x55d1('0x44')]=_0x3dfb64;return _0x3c550b;})[_0x55d1('0x25')](respondWithFilteredResult(_0x330162,_0xca2467))[_0x55d1('0x45')](handleError(_0x330162,null));};exports[_0x55d1('0x46')]=function(_0x3fa5df,_0x4480a1){var _0x5209ec={'raw':!![],'where':{'id':_0x3fa5df[_0x55d1('0x47')]['id']}},_0x2c1857={};_0x2c1857[_0x55d1('0x32')]=_['keys'](db['OpenchannelTransferReport'][_0x55d1('0x48')]);_0x2c1857[_0x55d1('0x2f')]=_[_0x55d1('0x30')](_0x3fa5df[_0x55d1('0x2f')]);_0x2c1857['filters']=_[_0x55d1('0x31')](_0x2c1857[_0x55d1('0x32')],_0x2c1857[_0x55d1('0x2f')]);_0x5209ec[_0x55d1('0x33')]=_[_0x55d1('0x31')](_0x2c1857[_0x55d1('0x32')],qs['fields'](_0x3fa5df[_0x55d1('0x2f')][_0x55d1('0x34')]));_0x5209ec[_0x55d1('0x33')]=_0x5209ec[_0x55d1('0x33')][_0x55d1('0x35')]?_0x5209ec[_0x55d1('0x33')]:_0x2c1857[_0x55d1('0x32')];if(_0x3fa5df[_0x55d1('0x2f')][_0x55d1('0x41')]){_0x5209ec[_0x55d1('0x42')]=[{'all':!![]}];}_0x5209ec=_['merge']({},_0x5209ec,_0x3fa5df[_0x55d1('0x3f')]);return db[_0x55d1('0x40')]['find'](_0x5209ec)[_0x55d1('0x25')](handleEntityNotFound(_0x4480a1,null))[_0x55d1('0x25')](respondWithResult(_0x4480a1,null))[_0x55d1('0x45')](handleError(_0x4480a1,null));};exports[_0x55d1('0x49')]=function(_0x4d1f5b,_0x19e508){return db[_0x55d1('0x40')][_0x55d1('0x49')](_0x4d1f5b[_0x55d1('0x4a')],{})[_0x55d1('0x25')](respondWithResult(_0x19e508,0xc9))[_0x55d1('0x45')](handleError(_0x19e508,null));};exports[_0x55d1('0x4b')]=function(_0x1c52dc,_0x4057ac){if(_0x1c52dc[_0x55d1('0x4a')]['id']){delete _0x1c52dc['body']['id'];}return db[_0x55d1('0x40')][_0x55d1('0x4c')]({'where':{'id':_0x1c52dc['params']['id']}})[_0x55d1('0x25')](handleEntityNotFound(_0x4057ac,null))[_0x55d1('0x25')](saveUpdates(_0x1c52dc[_0x55d1('0x4a')],null))['then'](respondWithResult(_0x4057ac,null))[_0x55d1('0x45')](handleError(_0x4057ac,null));};exports[_0x55d1('0x26')]=function(_0x524a42,_0x141799){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x524a42[_0x55d1('0x47')]['id']}})[_0x55d1('0x25')](handleEntityNotFound(_0x141799,null))[_0x55d1('0x25')](removeEntity(_0x141799,null))[_0x55d1('0x45')](handleError(_0x141799,null));};exports[_0x55d1('0x4d')]=function(_0x5030ce,_0x12e3f4){return db[_0x55d1('0x40')][_0x55d1('0x4d')]()['then'](respondWithResult(_0x12e3f4,null))[_0x55d1('0x45')](handleError(_0x12e3f4,null));}; \ No newline at end of file +var _0xdc50=['filter','merge','where','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc50,0x143));var _0x0dc5=function(_0x3e8a51,_0x564b40){_0x3e8a51=_0x3e8a51-0x0;var _0x1ecac3=_0xdc50[_0x3e8a51];return _0x1ecac3;};'use strict';var emlformat=require(_0x0dc5('0x0'));var rimraf=require(_0x0dc5('0x1'));var zipdir=require(_0x0dc5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0dc5('0x3'));var moment=require('moment');var BPromise=require(_0x0dc5('0x4'));var Mustache=require(_0x0dc5('0x5'));var util=require('util');var path=require(_0x0dc5('0x6'));var sox=require(_0x0dc5('0x7'));var csv=require(_0x0dc5('0x8'));var ejs=require(_0x0dc5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0dc5('0xa'));var squel=require(_0x0dc5('0xb'));var crypto=require(_0x0dc5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0dc5('0x8'));var querystring=require(_0x0dc5('0xd'));var Papa=require(_0x0dc5('0xe'));var Redis=require('ioredis');var authService=require(_0x0dc5('0xf'));var qs=require(_0x0dc5('0x10'));var as=require(_0x0dc5('0x11'));var hardwareService=require(_0x0dc5('0x12'));var logger=require(_0x0dc5('0x13'))('api');var utils=require(_0x0dc5('0x14'));var config=require(_0x0dc5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0dc5('0x16'))['db'];function respondWithStatusCode(_0x4d8ef9,_0x176da2){_0x176da2=_0x176da2||0xcc;return function(_0x589e37){if(_0x589e37){return _0x4d8ef9['sendStatus'](_0x176da2);}return _0x4d8ef9['status'](_0x176da2)[_0x0dc5('0x17')]();};}function respondWithResult(_0x37fb8f,_0x52a360){_0x52a360=_0x52a360||0xc8;return function(_0x35b3ed){if(_0x35b3ed){return _0x37fb8f[_0x0dc5('0x18')](_0x52a360)[_0x0dc5('0x19')](_0x35b3ed);}};}function respondWithFilteredResult(_0x5738ee,_0x53dde1){return function(_0x4fe3e7){if(_0x4fe3e7){var _0x5ad37c=typeof _0x53dde1[_0x0dc5('0x1a')]===_0x0dc5('0x1b')&&typeof _0x53dde1[_0x0dc5('0x1c')]==='undefined';var _0x763893=_0x4fe3e7[_0x0dc5('0x1d')];var _0x3f2d9b=_0x5ad37c?0x0:_0x53dde1[_0x0dc5('0x1a')];var _0x40b93b=_0x5ad37c?_0x4fe3e7[_0x0dc5('0x1d')]:_0x53dde1[_0x0dc5('0x1a')]+_0x53dde1[_0x0dc5('0x1c')];var _0x515c43;if(_0x40b93b>=_0x763893){_0x40b93b=_0x763893;_0x515c43=0xc8;}else{_0x515c43=0xce;}_0x5738ee['status'](_0x515c43);return _0x5738ee[_0x0dc5('0x1e')](_0x0dc5('0x1f'),_0x3f2d9b+'-'+_0x40b93b+'/'+_0x763893)[_0x0dc5('0x19')](_0x4fe3e7);}return null;};}function patchUpdates(_0x1f68af){return function(_0x58a864){try{jsonpatch['apply'](_0x58a864,_0x1f68af,!![]);}catch(_0x31e3ce){return BPromise[_0x0dc5('0x20')](_0x31e3ce);}return _0x58a864[_0x0dc5('0x21')]();};}function saveUpdates(_0x1cd2a5,_0x1ebab9){return function(_0x4c9a9d){if(_0x4c9a9d){return _0x4c9a9d[_0x0dc5('0x22')](_0x1cd2a5)[_0x0dc5('0x23')](function(_0x4602b3){return _0x4602b3;});}return null;};}function removeEntity(_0x4ed77c,_0x556ea2){return function(_0x2b3aae){if(_0x2b3aae){return _0x2b3aae[_0x0dc5('0x24')]()[_0x0dc5('0x23')](function(){_0x4ed77c['status'](0xcc)[_0x0dc5('0x17')]();});}};}function handleEntityNotFound(_0x55fc5c,_0x1b31a0){return function(_0x2dab64){if(!_0x2dab64){_0x55fc5c[_0x0dc5('0x25')](0x194);}return _0x2dab64;};}function handleError(_0x4dd164,_0x21321c){_0x21321c=_0x21321c||0x1f4;return function(_0xfc048e){logger[_0x0dc5('0x26')](_0xfc048e[_0x0dc5('0x27')]);if(_0xfc048e[_0x0dc5('0x28')]){delete _0xfc048e[_0x0dc5('0x28')];}_0x4dd164['status'](_0x21321c)[_0x0dc5('0x29')](_0xfc048e);};}exports[_0x0dc5('0x2a')]=function(_0x38f960,_0x4ef4af){var _0x159186={},_0x1f9481={},_0x100c86={'count':0x0,'rows':[]};var _0x739cc6=_[_0x0dc5('0x2b')](db[_0x0dc5('0x2c')][_0x0dc5('0x2d')],function(_0x5be98f){return{'name':_0x5be98f[_0x0dc5('0x2e')],'type':_0x5be98f[_0x0dc5('0x2f')][_0x0dc5('0x30')]};});_0x1f9481[_0x0dc5('0x31')]=_[_0x0dc5('0x2b')](_0x739cc6,_0x0dc5('0x28'));_0x1f9481[_0x0dc5('0x32')]=_[_0x0dc5('0x33')](_0x38f960[_0x0dc5('0x32')]);_0x1f9481[_0x0dc5('0x34')]=_[_0x0dc5('0x35')](_0x1f9481[_0x0dc5('0x31')],_0x1f9481[_0x0dc5('0x32')]);_0x159186[_0x0dc5('0x36')]=_[_0x0dc5('0x35')](_0x1f9481[_0x0dc5('0x31')],qs[_0x0dc5('0x37')](_0x38f960[_0x0dc5('0x32')][_0x0dc5('0x37')]));_0x159186[_0x0dc5('0x36')]=_0x159186[_0x0dc5('0x36')][_0x0dc5('0x38')]?_0x159186[_0x0dc5('0x36')]:_0x1f9481['model'];if(!_0x38f960['query'][_0x0dc5('0x39')](_0x0dc5('0x3a'))){_0x159186[_0x0dc5('0x1c')]=qs[_0x0dc5('0x1c')](_0x38f960['query'][_0x0dc5('0x1c')]);_0x159186[_0x0dc5('0x1a')]=qs[_0x0dc5('0x1a')](_0x38f960['query']['offset']);}_0x159186[_0x0dc5('0x3b')]=qs[_0x0dc5('0x3c')](_0x38f960[_0x0dc5('0x32')]['sort']);_0x159186['where']=qs['filters'](_[_0x0dc5('0x3d')](_0x38f960[_0x0dc5('0x32')],_0x1f9481[_0x0dc5('0x34')]),_0x739cc6);if(_0x38f960[_0x0dc5('0x32')][_0x0dc5('0x3e')]){_0x159186['where']=_[_0x0dc5('0x3f')](_0x159186[_0x0dc5('0x40')],{'$or':_[_0x0dc5('0x2b')](_0x739cc6,function(_0xbc66d1){if(_0xbc66d1['type']!==_0x0dc5('0x41')){var _0x3d1406={};_0x3d1406[_0xbc66d1[_0x0dc5('0x28')]]={'$like':'%'+_0x38f960[_0x0dc5('0x32')]['filter']+'%'};return _0x3d1406;}})});}_0x159186=_[_0x0dc5('0x3f')]({},_0x159186,_0x38f960[_0x0dc5('0x42')]);var _0x27ed8a={'where':_0x159186[_0x0dc5('0x40')]};return db[_0x0dc5('0x2c')][_0x0dc5('0x1d')](_0x27ed8a)[_0x0dc5('0x23')](function(_0x1b3cc0){_0x100c86[_0x0dc5('0x1d')]=_0x1b3cc0;if(_0x38f960['query'][_0x0dc5('0x43')]){_0x159186['include']=[{'all':!![]}];}return db[_0x0dc5('0x2c')]['findAll'](_0x159186);})['then'](function(_0x3d7933){_0x100c86[_0x0dc5('0x44')]=_0x3d7933;return _0x100c86;})[_0x0dc5('0x23')](respondWithFilteredResult(_0x4ef4af,_0x159186))[_0x0dc5('0x45')](handleError(_0x4ef4af,null));};exports[_0x0dc5('0x46')]=function(_0x2b8da5,_0x3d5a06){var _0x308944={'raw':!![],'where':{'id':_0x2b8da5[_0x0dc5('0x47')]['id']}},_0x1f5808={};_0x1f5808['model']=_[_0x0dc5('0x33')](db['OpenchannelTransferReport'][_0x0dc5('0x2d')]);_0x1f5808['query']=_['keys'](_0x2b8da5[_0x0dc5('0x32')]);_0x1f5808[_0x0dc5('0x34')]=_[_0x0dc5('0x35')](_0x1f5808[_0x0dc5('0x31')],_0x1f5808[_0x0dc5('0x32')]);_0x308944['attributes']=_[_0x0dc5('0x35')](_0x1f5808[_0x0dc5('0x31')],qs[_0x0dc5('0x37')](_0x2b8da5[_0x0dc5('0x32')][_0x0dc5('0x37')]));_0x308944[_0x0dc5('0x36')]=_0x308944[_0x0dc5('0x36')][_0x0dc5('0x38')]?_0x308944[_0x0dc5('0x36')]:_0x1f5808[_0x0dc5('0x31')];if(_0x2b8da5[_0x0dc5('0x32')]['includeAll']){_0x308944[_0x0dc5('0x48')]=[{'all':!![]}];}_0x308944=_[_0x0dc5('0x3f')]({},_0x308944,_0x2b8da5['options']);return db[_0x0dc5('0x2c')][_0x0dc5('0x49')](_0x308944)[_0x0dc5('0x23')](handleEntityNotFound(_0x3d5a06,null))['then'](respondWithResult(_0x3d5a06,null))[_0x0dc5('0x45')](handleError(_0x3d5a06,null));};exports[_0x0dc5('0x4a')]=function(_0x4782cc,_0x87a099){return db[_0x0dc5('0x2c')]['create'](_0x4782cc[_0x0dc5('0x4b')],{})['then'](respondWithResult(_0x87a099,0xc9))['catch'](handleError(_0x87a099,null));};exports[_0x0dc5('0x22')]=function(_0x27a27c,_0x589902){if(_0x27a27c[_0x0dc5('0x4b')]['id']){delete _0x27a27c[_0x0dc5('0x4b')]['id'];}return db[_0x0dc5('0x2c')][_0x0dc5('0x49')]({'where':{'id':_0x27a27c[_0x0dc5('0x47')]['id']}})[_0x0dc5('0x23')](handleEntityNotFound(_0x589902,null))[_0x0dc5('0x23')](saveUpdates(_0x27a27c[_0x0dc5('0x4b')],null))[_0x0dc5('0x23')](respondWithResult(_0x589902,null))[_0x0dc5('0x45')](handleError(_0x589902,null));};exports[_0x0dc5('0x24')]=function(_0x2c67d0,_0x52a50d){return db['OpenchannelTransferReport'][_0x0dc5('0x49')]({'where':{'id':_0x2c67d0['params']['id']}})[_0x0dc5('0x23')](handleEntityNotFound(_0x52a50d,null))[_0x0dc5('0x23')](removeEntity(_0x52a50d,null))[_0x0dc5('0x45')](handleError(_0x52a50d,null));};exports['describe']=function(_0x2d6132,_0x4f7fb0){return db[_0x0dc5('0x2c')][_0x0dc5('0x4c')]()[_0x0dc5('0x23')](respondWithResult(_0x4f7fb0,null))[_0x0dc5('0x45')](handleError(_0x4f7fb0,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f4254d1..022c4ad 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 _0x1877=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x11fd7b,_0x416d45){var _0x26bb3b=function(_0x34fd23){while(--_0x34fd23){_0x11fd7b['push'](_0x11fd7b['shift']());}};_0x26bb3b(++_0x416d45);}(_0x1877,0x1cc));var _0x7187=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0x1877[_0x2bddf9];return _0x3f3ae9;};'use strict';var _=require(_0x7187('0x0'));var util=require(_0x7187('0x1'));var logger=require('../../config/logger')(_0x7187('0x2'));var moment=require(_0x7187('0x3'));var BPromise=require(_0x7187('0x4'));var rp=require(_0x7187('0x5'));var fs=require('fs');var path=require(_0x7187('0x6'));var rimraf=require(_0x7187('0x7'));var config=require(_0x7187('0x8'));var attributes=require(_0x7187('0x9'));module[_0x7187('0xa')]=function(_0x337224,_0x4acc4f){return _0x337224['define'](_0x7187('0xb'),attributes,{'tableName':_0x7187('0xc'),'paranoid':![],'indexes':[{'name':_0x7187('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7435=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x13819e,_0x48e8d4){var _0x5cf21a=function(_0x207828){while(--_0x207828){_0x13819e['push'](_0x13819e['shift']());}};_0x5cf21a(++_0x48e8d4);}(_0x7435,0x14e));var _0x5743=function(_0x5914e1,_0x283f8e){_0x5914e1=_0x5914e1-0x0;var _0x1abc2f=_0x7435[_0x5914e1];return _0x1abc2f;};'use strict';var _=require(_0x5743('0x0'));var util=require(_0x5743('0x1'));var logger=require(_0x5743('0x2'))(_0x5743('0x3'));var moment=require(_0x5743('0x4'));var BPromise=require('bluebird');var rp=require(_0x5743('0x5'));var fs=require('fs');var path=require(_0x5743('0x6'));var rimraf=require(_0x5743('0x7'));var config=require(_0x5743('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x5743('0x9')]=function(_0x1b4afe,_0x3226b0){return _0x1b4afe[_0x5743('0xa')](_0x5743('0xb'),attributes,{'tableName':_0x5743('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5743('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index d0698b9..095474a 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 _0x31f0=['../../config/environment','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5f4777,_0x1df9ba){var _0x187998=function(_0x1458f7){while(--_0x1458f7){_0x5f4777['push'](_0x5f4777['shift']());}};_0x187998(++_0x1df9ba);}(_0x31f0,0xb7));var _0x031f=function(_0x28a36b,_0x5f3a09){_0x28a36b=_0x28a36b-0x0;var _0x41da91=_0x31f0[_0x28a36b];return _0x41da91;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file +var _0x9f02=['request\x20sent','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','debug','error','message','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x481aa5,_0x3bedde){var _0x28c250=function(_0x549be3){while(--_0x549be3){_0x481aa5['push'](_0x481aa5['shift']());}};_0x28c250(++_0x3bedde);}(_0x9f02,0x68));var _0x29f0=function(_0x312c67,_0x407ce3){_0x312c67=_0x312c67-0x0;var _0x1aa3e4=_0x9f02[_0x312c67];return _0x1aa3e4;};'use strict';var _=require(_0x29f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x29f0('0x1'));var fs=require('fs');var Redis=require(_0x29f0('0x2'));var db=require(_0x29f0('0x3'))['db'];var utils=require(_0x29f0('0x4'));var logger=require(_0x29f0('0x5'))('rpc');var config=require(_0x29f0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x29f0('0x7')][_0x29f0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d4852,_0x53d629,_0x4d47b3){return new BPromise(function(_0x594e30,_0x1da49e){return client['request'](_0x2d4852,_0x4d47b3)[_0x29f0('0x9')](function(_0x232592){logger[_0x29f0('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x53d629,'request\x20sent');logger[_0x29f0('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x53d629,'request\x20sent',JSON['stringify'](_0x232592));if(_0x232592['error']){if(_0x232592[_0x29f0('0xc')]['code']===0x1f4){logger[_0x29f0('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x53d629,_0x232592[_0x29f0('0xc')][_0x29f0('0xd')]);return _0x1da49e(_0x232592[_0x29f0('0xc')][_0x29f0('0xd')]);}logger['error'](_0x29f0('0xe'),_0x53d629,_0x232592[_0x29f0('0xc')]['message']);return _0x594e30(_0x232592[_0x29f0('0xc')]['message']);}else{logger[_0x29f0('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x53d629,_0x29f0('0xf'));_0x594e30(_0x232592[_0x29f0('0x10')]['message']);}})['catch'](function(_0x58e4e2){logger[_0x29f0('0xc')](_0x29f0('0xe'),_0x53d629,_0x58e4e2);_0x1da49e(_0x58e4e2);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 49dd4d0..5d1d7d6 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 _0xf08f=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','create','/:id','update','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf08f,0x1c3));var _0xff08=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0xf08f[_0x2f2360];return _0x1cc8d3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xff08('0x0'));var timeout=require(_0xff08('0x1'));var express=require(_0xff08('0x2'));var router=express[_0xff08('0x3')]();var fs_extra=require(_0xff08('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xff08('0x5'));var config=require(_0xff08('0x6'));var controller=require('./pause.controller');router['get']('/',auth[_0xff08('0x7')](),controller[_0xff08('0x8')]);router[_0xff08('0x9')]('/:id',auth[_0xff08('0x7')](),controller['show']);router['post']('/',auth[_0xff08('0x7')](),controller[_0xff08('0xa')]);router['put'](_0xff08('0xb'),auth[_0xff08('0x7')](),controller[_0xff08('0xc')]);router['delete'](_0xff08('0xb'),auth['isAuthenticated'](),controller[_0xff08('0xd')]);module[_0xff08('0xe')]=router; \ No newline at end of file +var _0xddaa=['../../config/environment','get','isAuthenticated','index','/:id','show','post','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x48e315,_0x5f4c6b){var _0x4c6122=function(_0x5abfed){while(--_0x5abfed){_0x48e315['push'](_0x48e315['shift']());}};_0x4c6122(++_0x5f4c6b);}(_0xddaa,0xb5));var _0xadda=function(_0x472053,_0x271ca5){_0x472053=_0x472053-0x0;var _0x16ff04=_0xddaa[_0x472053];return _0x16ff04;};'use strict';var multer=require(_0xadda('0x0'));var util=require(_0xadda('0x1'));var path=require(_0xadda('0x2'));var timeout=require(_0xadda('0x3'));var express=require(_0xadda('0x4'));var router=express[_0xadda('0x5')]();var fs_extra=require(_0xadda('0x6'));var auth=require(_0xadda('0x7'));var interaction=require(_0xadda('0x8'));var config=require(_0xadda('0x9'));var controller=require('./pause.controller');router[_0xadda('0xa')]('/',auth[_0xadda('0xb')](),controller[_0xadda('0xc')]);router[_0xadda('0xa')](_0xadda('0xd'),auth[_0xadda('0xb')](),controller[_0xadda('0xe')]);router[_0xadda('0xf')]('/',auth[_0xadda('0xb')](),controller['create']);router['put'](_0xadda('0xd'),auth[_0xadda('0xb')](),controller['update']);router[_0xadda('0x10')](_0xadda('0xd'),auth[_0xadda('0xb')](),controller[_0xadda('0x11')]);module[_0xadda('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index f049b3b..2afc32b 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 _0xd45a=['exports','STRING','name'];(function(_0x3b69e3,_0x40bb88){var _0x1f5b5e=function(_0x4fdd01){while(--_0x4fdd01){_0x3b69e3['push'](_0x3b69e3['shift']());}};_0x1f5b5e(++_0x40bb88);}(_0xd45a,0x1ef));var _0xad45=function(_0x27fbe0,_0x20f158){_0x27fbe0=_0x27fbe0-0x0;var _0x38ee34=_0xd45a[_0x27fbe0];return _0x38ee34;};'use strict';var Sequelize=require('sequelize');module[_0xad45('0x0')]={'name':{'type':Sequelize[_0xad45('0x1')],'unique':_0xad45('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xad45('0x1')]}}; \ No newline at end of file +var _0xc9c9=['STRING','name'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xc9c9,0x10c));var _0x9c9c=function(_0x5805a2,_0x3cb76b){_0x5805a2=_0x5805a2-0x0;var _0x542db2=_0xc9c9[_0x5805a2];return _0x542db2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9c9c('0x0')],'unique':_0x9c9c('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x9c9c('0x0')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 5458dc5..e232ff8 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 _0x5d1b=['save','then','get','UserProfileResource','name','send','map','Pause','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply'];(function(_0x29ca3a,_0x118266){var _0x45371e=function(_0x3fe942){while(--_0x3fe942){_0x29ca3a['push'](_0x29ca3a['shift']());}};_0x45371e(++_0x118266);}(_0x5d1b,0x118));var _0xb5d1=function(_0x5f4699,_0x5d9944){_0x5f4699=_0x5f4699-0x0;var _0x4f0548=_0x5d1b[_0x5f4699];return _0x4f0548;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb5d1('0x0'));var jsonpatch=require(_0xb5d1('0x1'));var rp=require(_0xb5d1('0x2'));var moment=require(_0xb5d1('0x3'));var BPromise=require(_0xb5d1('0x4'));var Mustache=require('mustache');var util=require(_0xb5d1('0x5'));var path=require('path');var sox=require(_0xb5d1('0x6'));var csv=require(_0xb5d1('0x7'));var ejs=require(_0xb5d1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb5d1('0x9'));var squel=require(_0xb5d1('0xa'));var crypto=require(_0xb5d1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb5d1('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb5d1('0xd'));var Papa=require(_0xb5d1('0xe'));var Redis=require(_0xb5d1('0xf'));var authService=require(_0xb5d1('0x10'));var qs=require(_0xb5d1('0x11'));var as=require(_0xb5d1('0x12'));var hardwareService=require(_0xb5d1('0x13'));var logger=require(_0xb5d1('0x14'))(_0xb5d1('0x15'));var utils=require(_0xb5d1('0x16'));var config=require(_0xb5d1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb5d1('0x18'))['db'];function respondWithStatusCode(_0x16456b,_0x194b17){_0x194b17=_0x194b17||0xcc;return function(_0x43dfab){if(_0x43dfab){return _0x16456b[_0xb5d1('0x19')](_0x194b17);}return _0x16456b[_0xb5d1('0x1a')](_0x194b17)[_0xb5d1('0x1b')]();};}function respondWithResult(_0x1ffd22,_0x1d4194){_0x1d4194=_0x1d4194||0xc8;return function(_0x20e842){if(_0x20e842){return _0x1ffd22[_0xb5d1('0x1a')](_0x1d4194)['json'](_0x20e842);}};}function respondWithFilteredResult(_0x310cf7,_0xee5dba){return function(_0x4ad0d3){if(_0x4ad0d3){var _0x1f2c64=typeof _0xee5dba[_0xb5d1('0x1c')]===_0xb5d1('0x1d')&&typeof _0xee5dba['limit']===_0xb5d1('0x1d');var _0x1240eb=_0x4ad0d3['count'];var _0x1730e1=_0x1f2c64?0x0:_0xee5dba[_0xb5d1('0x1c')];var _0x3d3073=_0x1f2c64?_0x4ad0d3[_0xb5d1('0x1e')]:_0xee5dba[_0xb5d1('0x1c')]+_0xee5dba[_0xb5d1('0x1f')];var _0x2f07a1;if(_0x3d3073>=_0x1240eb){_0x3d3073=_0x1240eb;_0x2f07a1=0xc8;}else{_0x2f07a1=0xce;}_0x310cf7[_0xb5d1('0x1a')](_0x2f07a1);return _0x310cf7[_0xb5d1('0x20')](_0xb5d1('0x21'),_0x1730e1+'-'+_0x3d3073+'/'+_0x1240eb)[_0xb5d1('0x22')](_0x4ad0d3);}return null;};}function patchUpdates(_0x44dc03){return function(_0x56894e){try{jsonpatch[_0xb5d1('0x23')](_0x56894e,_0x44dc03,!![]);}catch(_0x4e6c08){return BPromise['reject'](_0x4e6c08);}return _0x56894e[_0xb5d1('0x24')]();};}function saveUpdates(_0x2380d2,_0x1850c1){return function(_0x41ef94){if(_0x41ef94){return _0x41ef94['update'](_0x2380d2)[_0xb5d1('0x25')](function(_0x25716a){return _0x25716a;});}return null;};}function removeEntity(_0x131833,_0x5a50a8){return function(_0x30f2d7){if(_0x30f2d7){return _0x30f2d7['destroy']()[_0xb5d1('0x25')](function(){var _0x2f0418=_0x30f2d7[_0xb5d1('0x26')]({'plain':!![]});var _0x308e1d='Pauses';return db[_0xb5d1('0x27')]['destroy']({'where':{'type':_0x308e1d,'resourceId':_0x2f0418['id']}})[_0xb5d1('0x25')](function(){return _0x30f2d7;});})[_0xb5d1('0x25')](function(){_0x131833[_0xb5d1('0x1a')](0xcc)[_0xb5d1('0x1b')]();});}};}function handleEntityNotFound(_0x2dd489,_0x2da4d4){return function(_0x1de91a){if(!_0x1de91a){_0x2dd489['sendStatus'](0x194);}return _0x1de91a;};}function handleError(_0x156b1d,_0x13345d){_0x13345d=_0x13345d||0x1f4;return function(_0x34aead){logger['error'](_0x34aead['stack']);if(_0x34aead[_0xb5d1('0x28')]){delete _0x34aead['name'];}_0x156b1d['status'](_0x13345d)[_0xb5d1('0x29')](_0x34aead);};}exports['index']=function(_0x3391ad,_0x3ff8e5){var _0x4fc619={},_0x14ad0c={},_0x3e2044={'count':0x0,'rows':[]};var _0x57c8a6=_[_0xb5d1('0x2a')](db[_0xb5d1('0x2b')][_0xb5d1('0x2c')],function(_0x2f5a43){return{'name':_0x2f5a43[_0xb5d1('0x2d')],'type':_0x2f5a43['type']['key']};});_0x14ad0c[_0xb5d1('0x2e')]=_[_0xb5d1('0x2a')](_0x57c8a6,_0xb5d1('0x28'));_0x14ad0c[_0xb5d1('0x2f')]=_[_0xb5d1('0x30')](_0x3391ad[_0xb5d1('0x2f')]);_0x14ad0c[_0xb5d1('0x31')]=_[_0xb5d1('0x32')](_0x14ad0c[_0xb5d1('0x2e')],_0x14ad0c['query']);_0x4fc619[_0xb5d1('0x33')]=_['intersection'](_0x14ad0c['model'],qs['fields'](_0x3391ad[_0xb5d1('0x2f')][_0xb5d1('0x34')]));_0x4fc619['attributes']=_0x4fc619['attributes'][_0xb5d1('0x35')]?_0x4fc619[_0xb5d1('0x33')]:_0x14ad0c['model'];if(!_0x3391ad['query'][_0xb5d1('0x36')](_0xb5d1('0x37'))){_0x4fc619[_0xb5d1('0x1f')]=qs[_0xb5d1('0x1f')](_0x3391ad[_0xb5d1('0x2f')][_0xb5d1('0x1f')]);_0x4fc619['offset']=qs[_0xb5d1('0x1c')](_0x3391ad[_0xb5d1('0x2f')][_0xb5d1('0x1c')]);}_0x4fc619[_0xb5d1('0x38')]=qs['sort'](_0x3391ad[_0xb5d1('0x2f')][_0xb5d1('0x39')]);_0x4fc619['where']=qs['filters'](_['pick'](_0x3391ad[_0xb5d1('0x2f')],_0x14ad0c[_0xb5d1('0x31')]),_0x57c8a6);if(_0x3391ad[_0xb5d1('0x2f')][_0xb5d1('0x3a')]){_0x4fc619[_0xb5d1('0x3b')]=_[_0xb5d1('0x3c')](_0x4fc619[_0xb5d1('0x3b')],{'$or':_[_0xb5d1('0x2a')](_0x57c8a6,function(_0xbc045c){if(_0xbc045c['type']!=='VIRTUAL'){var _0xdabc40={};_0xdabc40[_0xbc045c[_0xb5d1('0x28')]]={'$like':'%'+_0x3391ad[_0xb5d1('0x2f')][_0xb5d1('0x3a')]+'%'};return _0xdabc40;}})});}_0x4fc619=_[_0xb5d1('0x3c')]({},_0x4fc619,_0x3391ad[_0xb5d1('0x3d')]);var _0x818d81={'where':_0x4fc619[_0xb5d1('0x3b')]};return db[_0xb5d1('0x2b')][_0xb5d1('0x1e')](_0x818d81)[_0xb5d1('0x25')](function(_0xe8744d){_0x3e2044['count']=_0xe8744d;if(_0x3391ad[_0xb5d1('0x2f')][_0xb5d1('0x3e')]){_0x4fc619[_0xb5d1('0x3f')]=[{'all':!![]}];}return db[_0xb5d1('0x2b')][_0xb5d1('0x40')](_0x4fc619);})[_0xb5d1('0x25')](function(_0x4885e0){_0x3e2044[_0xb5d1('0x41')]=_0x4885e0;return _0x3e2044;})['then'](respondWithFilteredResult(_0x3ff8e5,_0x4fc619))[_0xb5d1('0x42')](handleError(_0x3ff8e5,null));};exports[_0xb5d1('0x43')]=function(_0x27c2c8,_0x3117ab){var _0x30339f={'raw':!![],'where':{'id':_0x27c2c8['params']['id']}},_0x2ea1c8={};_0x2ea1c8['model']=_['keys'](db[_0xb5d1('0x2b')][_0xb5d1('0x2c')]);_0x2ea1c8[_0xb5d1('0x2f')]=_[_0xb5d1('0x30')](_0x27c2c8['query']);_0x2ea1c8[_0xb5d1('0x31')]=_[_0xb5d1('0x32')](_0x2ea1c8[_0xb5d1('0x2e')],_0x2ea1c8[_0xb5d1('0x2f')]);_0x30339f[_0xb5d1('0x33')]=_['intersection'](_0x2ea1c8[_0xb5d1('0x2e')],qs[_0xb5d1('0x34')](_0x27c2c8[_0xb5d1('0x2f')][_0xb5d1('0x34')]));_0x30339f[_0xb5d1('0x33')]=_0x30339f[_0xb5d1('0x33')][_0xb5d1('0x35')]?_0x30339f[_0xb5d1('0x33')]:_0x2ea1c8[_0xb5d1('0x2e')];if(_0x27c2c8[_0xb5d1('0x2f')][_0xb5d1('0x3e')]){_0x30339f[_0xb5d1('0x3f')]=[{'all':!![]}];}_0x30339f=_[_0xb5d1('0x3c')]({},_0x30339f,_0x27c2c8[_0xb5d1('0x3d')]);return db[_0xb5d1('0x2b')][_0xb5d1('0x44')](_0x30339f)['then'](handleEntityNotFound(_0x3117ab,null))[_0xb5d1('0x25')](respondWithResult(_0x3117ab,null))[_0xb5d1('0x42')](handleError(_0x3117ab,null));};exports['create']=function(_0x112c80,_0x248de2){return db['Pause']['create'](_0x112c80[_0xb5d1('0x45')],{})[_0xb5d1('0x25')](function(_0x5b5cbc){var _0x275ad3=_0x112c80['user'][_0xb5d1('0x26')]({'plain':!![]});if(!_0x275ad3)throw new Error(_0xb5d1('0x46'));if(_0x275ad3[_0xb5d1('0x47')]===_0xb5d1('0x48')){var _0x733c8f=_0x5b5cbc[_0xb5d1('0x26')]({'plain':!![]});var _0x369595='Pauses';return db[_0xb5d1('0x49')]['find']({'where':{'name':_0x369595,'userProfileId':_0x275ad3['userProfileId']},'raw':!![]})[_0xb5d1('0x25')](function(_0x4526b9){if(_0x4526b9&&_0x4526b9[_0xb5d1('0x4a')]===0x0){return db[_0xb5d1('0x27')]['create']({'name':_0x733c8f['name'],'resourceId':_0x733c8f['id'],'type':_0x4526b9['name'],'sectionId':_0x4526b9['id']},{})[_0xb5d1('0x25')](function(){return _0x5b5cbc;});}else{return _0x5b5cbc;}})['catch'](function(_0x3a8e1a){logger[_0xb5d1('0x4b')](_0xb5d1('0x4c'),_0x3a8e1a);throw _0x3a8e1a;});}return _0x5b5cbc;})[_0xb5d1('0x25')](respondWithResult(_0x248de2,0xc9))[_0xb5d1('0x42')](handleError(_0x248de2,null));};exports[_0xb5d1('0x4d')]=function(_0x4fabcb,_0x52a548){if(_0x4fabcb[_0xb5d1('0x45')]['id']){delete _0x4fabcb[_0xb5d1('0x45')]['id'];}return db[_0xb5d1('0x2b')][_0xb5d1('0x44')]({'where':{'id':_0x4fabcb[_0xb5d1('0x4e')]['id']}})[_0xb5d1('0x25')](handleEntityNotFound(_0x52a548,null))[_0xb5d1('0x25')](saveUpdates(_0x4fabcb[_0xb5d1('0x45')],null))[_0xb5d1('0x25')](respondWithResult(_0x52a548,null))[_0xb5d1('0x42')](handleError(_0x52a548,null));};exports['destroy']=function(_0x4d952b,_0x569d70){return db['Pause'][_0xb5d1('0x44')]({'where':{'id':_0x4d952b[_0xb5d1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x569d70,null))[_0xb5d1('0x25')](removeEntity(_0x569d70,null))[_0xb5d1('0x42')](handleError(_0x569d70,null));}; \ No newline at end of file +var _0xec88=['index','Pause','rawAttributes','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','rows','catch','show','params','keys','includeAll','find','create','body','user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send'];(function(_0x4cc1af,_0x22c39e){var _0x2ec7f7=function(_0x3eab17){while(--_0x3eab17){_0x4cc1af['push'](_0x4cc1af['shift']());}};_0x2ec7f7(++_0x22c39e);}(_0xec88,0xc8));var _0x8ec8=function(_0x4cdaa3,_0x3227fa){_0x4cdaa3=_0x4cdaa3-0x0;var _0x288cbb=_0xec88[_0x4cdaa3];return _0x288cbb;};'use strict';var emlformat=require(_0x8ec8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ec8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8ec8('0x2'));var BPromise=require(_0x8ec8('0x3'));var Mustache=require(_0x8ec8('0x4'));var util=require(_0x8ec8('0x5'));var path=require('path');var sox=require(_0x8ec8('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ec8('0x7'));var _=require(_0x8ec8('0x8'));var squel=require(_0x8ec8('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ec8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ec8('0xb'));var Redis=require(_0x8ec8('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x8ec8('0xd'));var as=require(_0x8ec8('0xe'));var hardwareService=require(_0x8ec8('0xf'));var logger=require(_0x8ec8('0x10'))(_0x8ec8('0x11'));var utils=require(_0x8ec8('0x12'));var config=require(_0x8ec8('0x13'));var licenseUtil=require(_0x8ec8('0x14'));var db=require(_0x8ec8('0x15'))['db'];function respondWithStatusCode(_0x8be9e0,_0x3da7e6){_0x3da7e6=_0x3da7e6||0xcc;return function(_0xba849d){if(_0xba849d){return _0x8be9e0[_0x8ec8('0x16')](_0x3da7e6);}return _0x8be9e0[_0x8ec8('0x17')](_0x3da7e6)[_0x8ec8('0x18')]();};}function respondWithResult(_0x152529,_0x19dcec){_0x19dcec=_0x19dcec||0xc8;return function(_0x266004){if(_0x266004){return _0x152529[_0x8ec8('0x17')](_0x19dcec)[_0x8ec8('0x19')](_0x266004);}};}function respondWithFilteredResult(_0x17385a,_0xb7a9b8){return function(_0x35ae65){if(_0x35ae65){var _0x56d7ec=typeof _0xb7a9b8[_0x8ec8('0x1a')]==='undefined'&&typeof _0xb7a9b8['limit']===_0x8ec8('0x1b');var _0x214f7c=_0x35ae65[_0x8ec8('0x1c')];var _0x2c6012=_0x56d7ec?0x0:_0xb7a9b8[_0x8ec8('0x1a')];var _0x204b1d=_0x56d7ec?_0x35ae65[_0x8ec8('0x1c')]:_0xb7a9b8[_0x8ec8('0x1a')]+_0xb7a9b8[_0x8ec8('0x1d')];var _0x1e960f;if(_0x204b1d>=_0x214f7c){_0x204b1d=_0x214f7c;_0x1e960f=0xc8;}else{_0x1e960f=0xce;}_0x17385a[_0x8ec8('0x17')](_0x1e960f);return _0x17385a[_0x8ec8('0x1e')](_0x8ec8('0x1f'),_0x2c6012+'-'+_0x204b1d+'/'+_0x214f7c)[_0x8ec8('0x19')](_0x35ae65);}return null;};}function patchUpdates(_0x4ad54d){return function(_0x24768a){try{jsonpatch[_0x8ec8('0x20')](_0x24768a,_0x4ad54d,!![]);}catch(_0x38b313){return BPromise['reject'](_0x38b313);}return _0x24768a[_0x8ec8('0x21')]();};}function saveUpdates(_0x38c21d,_0xd5a050){return function(_0x4cb7a3){if(_0x4cb7a3){return _0x4cb7a3[_0x8ec8('0x22')](_0x38c21d)[_0x8ec8('0x23')](function(_0x1638c6){return _0x1638c6;});}return null;};}function removeEntity(_0x19254f,_0x221881){return function(_0x1de881){if(_0x1de881){return _0x1de881[_0x8ec8('0x24')]()[_0x8ec8('0x23')](function(){var _0x568160=_0x1de881[_0x8ec8('0x25')]({'plain':!![]});var _0x4cfc42='Pauses';return db[_0x8ec8('0x26')][_0x8ec8('0x24')]({'where':{'type':_0x4cfc42,'resourceId':_0x568160['id']}})['then'](function(){return _0x1de881;});})['then'](function(){_0x19254f[_0x8ec8('0x17')](0xcc)[_0x8ec8('0x18')]();});}};}function handleEntityNotFound(_0x59b4b0,_0x32f8cb){return function(_0x13e2b3){if(!_0x13e2b3){_0x59b4b0['sendStatus'](0x194);}return _0x13e2b3;};}function handleError(_0x58fba6,_0x53f475){_0x53f475=_0x53f475||0x1f4;return function(_0x340dc0){logger[_0x8ec8('0x27')](_0x340dc0[_0x8ec8('0x28')]);if(_0x340dc0[_0x8ec8('0x29')]){delete _0x340dc0[_0x8ec8('0x29')];}_0x58fba6[_0x8ec8('0x17')](_0x53f475)[_0x8ec8('0x2a')](_0x340dc0);};}exports[_0x8ec8('0x2b')]=function(_0x32f524,_0x4ecb5e){var _0x4fbb64={},_0x20912c={},_0xf8c88={'count':0x0,'rows':[]};var _0x501696=_['map'](db[_0x8ec8('0x2c')][_0x8ec8('0x2d')],function(_0x38ada5){return{'name':_0x38ada5[_0x8ec8('0x2e')],'type':_0x38ada5[_0x8ec8('0x2f')][_0x8ec8('0x30')]};});_0x20912c['model']=_[_0x8ec8('0x31')](_0x501696,_0x8ec8('0x29'));_0x20912c[_0x8ec8('0x32')]=_['keys'](_0x32f524[_0x8ec8('0x32')]);_0x20912c['filters']=_[_0x8ec8('0x33')](_0x20912c[_0x8ec8('0x34')],_0x20912c[_0x8ec8('0x32')]);_0x4fbb64[_0x8ec8('0x35')]=_[_0x8ec8('0x33')](_0x20912c[_0x8ec8('0x34')],qs[_0x8ec8('0x36')](_0x32f524['query'][_0x8ec8('0x36')]));_0x4fbb64[_0x8ec8('0x35')]=_0x4fbb64[_0x8ec8('0x35')][_0x8ec8('0x37')]?_0x4fbb64['attributes']:_0x20912c[_0x8ec8('0x34')];if(!_0x32f524[_0x8ec8('0x32')][_0x8ec8('0x38')](_0x8ec8('0x39'))){_0x4fbb64[_0x8ec8('0x1d')]=qs[_0x8ec8('0x1d')](_0x32f524[_0x8ec8('0x32')][_0x8ec8('0x1d')]);_0x4fbb64[_0x8ec8('0x1a')]=qs[_0x8ec8('0x1a')](_0x32f524['query']['offset']);}_0x4fbb64['order']=qs[_0x8ec8('0x3a')](_0x32f524['query'][_0x8ec8('0x3a')]);_0x4fbb64[_0x8ec8('0x3b')]=qs[_0x8ec8('0x3c')](_[_0x8ec8('0x3d')](_0x32f524['query'],_0x20912c['filters']),_0x501696);if(_0x32f524[_0x8ec8('0x32')][_0x8ec8('0x3e')]){_0x4fbb64[_0x8ec8('0x3b')]=_[_0x8ec8('0x3f')](_0x4fbb64[_0x8ec8('0x3b')],{'$or':_[_0x8ec8('0x31')](_0x501696,function(_0x38501d){if(_0x38501d['type']!=='VIRTUAL'){var _0x557ca3={};_0x557ca3[_0x38501d['name']]={'$like':'%'+_0x32f524[_0x8ec8('0x32')][_0x8ec8('0x3e')]+'%'};return _0x557ca3;}})});}_0x4fbb64=_[_0x8ec8('0x3f')]({},_0x4fbb64,_0x32f524[_0x8ec8('0x40')]);var _0xfcfbc6={'where':_0x4fbb64['where']};return db[_0x8ec8('0x2c')][_0x8ec8('0x1c')](_0xfcfbc6)[_0x8ec8('0x23')](function(_0x2aae75){_0xf8c88['count']=_0x2aae75;if(_0x32f524[_0x8ec8('0x32')]['includeAll']){_0x4fbb64[_0x8ec8('0x41')]=[{'all':!![]}];}return db[_0x8ec8('0x2c')]['findAll'](_0x4fbb64);})['then'](function(_0x4543a9){_0xf8c88[_0x8ec8('0x42')]=_0x4543a9;return _0xf8c88;})[_0x8ec8('0x23')](respondWithFilteredResult(_0x4ecb5e,_0x4fbb64))[_0x8ec8('0x43')](handleError(_0x4ecb5e,null));};exports[_0x8ec8('0x44')]=function(_0x5a3212,_0x339620){var _0x4b4427={'raw':!![],'where':{'id':_0x5a3212[_0x8ec8('0x45')]['id']}},_0x2aba0d={};_0x2aba0d['model']=_[_0x8ec8('0x46')](db['Pause'][_0x8ec8('0x2d')]);_0x2aba0d['query']=_[_0x8ec8('0x46')](_0x5a3212[_0x8ec8('0x32')]);_0x2aba0d[_0x8ec8('0x3c')]=_[_0x8ec8('0x33')](_0x2aba0d[_0x8ec8('0x34')],_0x2aba0d[_0x8ec8('0x32')]);_0x4b4427[_0x8ec8('0x35')]=_[_0x8ec8('0x33')](_0x2aba0d['model'],qs[_0x8ec8('0x36')](_0x5a3212[_0x8ec8('0x32')][_0x8ec8('0x36')]));_0x4b4427[_0x8ec8('0x35')]=_0x4b4427[_0x8ec8('0x35')][_0x8ec8('0x37')]?_0x4b4427[_0x8ec8('0x35')]:_0x2aba0d['model'];if(_0x5a3212[_0x8ec8('0x32')][_0x8ec8('0x47')]){_0x4b4427['include']=[{'all':!![]}];}_0x4b4427=_['merge']({},_0x4b4427,_0x5a3212[_0x8ec8('0x40')]);return db[_0x8ec8('0x2c')][_0x8ec8('0x48')](_0x4b4427)[_0x8ec8('0x23')](handleEntityNotFound(_0x339620,null))[_0x8ec8('0x23')](respondWithResult(_0x339620,null))[_0x8ec8('0x43')](handleError(_0x339620,null));};exports[_0x8ec8('0x49')]=function(_0x462f34,_0x3e9946){return db[_0x8ec8('0x2c')][_0x8ec8('0x49')](_0x462f34[_0x8ec8('0x4a')],{})[_0x8ec8('0x23')](function(_0x2e21c7){var _0x3373aa=_0x462f34[_0x8ec8('0x4b')]['get']({'plain':!![]});if(!_0x3373aa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3373aa[_0x8ec8('0x4c')]==='user'){var _0x25ce67=_0x2e21c7[_0x8ec8('0x25')]({'plain':!![]});var _0x20528d=_0x8ec8('0x4d');return db[_0x8ec8('0x4e')][_0x8ec8('0x48')]({'where':{'name':_0x20528d,'userProfileId':_0x3373aa[_0x8ec8('0x4f')]},'raw':!![]})[_0x8ec8('0x23')](function(_0x47ad04){if(_0x47ad04&&_0x47ad04[_0x8ec8('0x50')]===0x0){return db[_0x8ec8('0x26')][_0x8ec8('0x49')]({'name':_0x25ce67['name'],'resourceId':_0x25ce67['id'],'type':_0x47ad04[_0x8ec8('0x29')],'sectionId':_0x47ad04['id']},{})[_0x8ec8('0x23')](function(){return _0x2e21c7;});}else{return _0x2e21c7;}})['catch'](function(_0x2c13d4){logger[_0x8ec8('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c13d4);throw _0x2c13d4;});}return _0x2e21c7;})[_0x8ec8('0x23')](respondWithResult(_0x3e9946,0xc9))[_0x8ec8('0x43')](handleError(_0x3e9946,null));};exports[_0x8ec8('0x22')]=function(_0x578de4,_0x72e65f){if(_0x578de4[_0x8ec8('0x4a')]['id']){delete _0x578de4['body']['id'];}return db[_0x8ec8('0x2c')][_0x8ec8('0x48')]({'where':{'id':_0x578de4[_0x8ec8('0x45')]['id']}})[_0x8ec8('0x23')](handleEntityNotFound(_0x72e65f,null))[_0x8ec8('0x23')](saveUpdates(_0x578de4[_0x8ec8('0x4a')],null))[_0x8ec8('0x23')](respondWithResult(_0x72e65f,null))['catch'](handleError(_0x72e65f,null));};exports['destroy']=function(_0x5f0138,_0x5ca3de){return db[_0x8ec8('0x2c')][_0x8ec8('0x48')]({'where':{'id':_0x5f0138['params']['id']}})['then'](handleEntityNotFound(_0x5ca3de,null))[_0x8ec8('0x23')](removeEntity(_0x5ca3de,null))[_0x8ec8('0x43')](handleError(_0x5ca3de,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 006c593..8bde706 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 _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6aa7,0x178));var _0x76aa=function(_0x44aa14,_0x3c46fb){_0x44aa14=_0x44aa14-0x0;var _0x1bb303=_0x6aa7[_0x44aa14];return _0x1bb303;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x507369,_0x2e9f03){var _0x4fc4cd=function(_0x30ced8){while(--_0x30ced8){_0x507369['push'](_0x507369['shift']());}};_0x4fc4cd(++_0x2e9f03);}(_0x326f,0xd1));var _0xf326=function(_0x4c0632,_0x311207){_0x4c0632=_0x4c0632-0x0;var _0x2d7897=_0x326f[_0x4c0632];return _0x2d7897;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 751b886..b20bb05 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(_0x32182c,_0x139684){var _0x5f46fd=function(_0x2bbfce){while(--_0x2bbfce){_0x32182c['push'](_0x32182c['shift']());}};_0x5f46fd(++_0x139684);}(_0x7a54,0x106));var _0x47a5=function(_0x8c7d72,_0x137949){_0x8c7d72=_0x8c7d72-0x0;var _0x5c0355=_0x7a54[_0x8c7d72];return _0x5c0355;};'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 _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(_0x20d81d,_0x506609){var _0x16d7ca=function(_0x468c4e){while(--_0x468c4e){_0x20d81d['push'](_0x20d81d['shift']());}};_0x16d7ca(++_0x506609);}(_0x7a54,0x106));var _0x47a5=function(_0x23aa8b,_0x589840){_0x23aa8b=_0x23aa8b-0x0;var _0x51dd6d=_0x7a54[_0x23aa8b];return _0x51dd6d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 5c0fab7..44f77f8 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 _0xe14d=['isAuthenticated','index','webhookGet','/:id','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','single','file','upload','/webhook','webhookPost','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./plugin.controller','get'];(function(_0x1ef9d,_0x24333e){var _0x2a374b=function(_0x3edbeb){while(--_0x3edbeb){_0x1ef9d['push'](_0x1ef9d['shift']());}};_0x2a374b(++_0x24333e);}(_0xe14d,0x1ee));var _0xde14=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xe14d[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var path=require(_0xde14('0x2'));var timeout=require(_0xde14('0x3'));var express=require('express');var router=express[_0xde14('0x4')]();var fs_extra=require(_0xde14('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var controller=require(_0xde14('0x8'));router[_0xde14('0x9')]('/',auth[_0xde14('0xa')](),controller[_0xde14('0xb')]);router['get']('/webhook',controller[_0xde14('0xc')]);router[_0xde14('0x9')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller[_0xde14('0xe')]);router[_0xde14('0x9')](_0xde14('0xf'),auth[_0xde14('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xde14('0x10')]({'destination':function(_0xe785fb,_0x417269,_0x4357c7){_0x4357c7(null,path[_0xde14('0x11')](config[_0xde14('0x12')],_0xde14('0x13')));},'filename':function(_0x3d5a29,_0x34e28f,_0x29e3ca){_0x34e28f[_0xde14('0x14')]=_0x34e28f[_0xde14('0x14')][_0xde14('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x29e3ca(null,util[_0xde14('0x16')](_0xde14('0x17'),path['basename'](_0x34e28f['originalname'],path[_0xde14('0x18')](_0x34e28f[_0xde14('0x14')])),Date[_0xde14('0x19')](),path['extname'](_0x34e28f[_0xde14('0x14')])));}})});router[_0xde14('0x1a')]('/',upload[_0xde14('0x1b')](_0xde14('0x1c')),controller[_0xde14('0x1d')]);router[_0xde14('0x1a')](_0xde14('0x1e'),controller[_0xde14('0x1f')]);router[_0xde14('0x20')](_0xde14('0xd'),auth['isAuthenticated'](),controller[_0xde14('0x21')]);router[_0xde14('0x22')](_0xde14('0xd'),auth[_0xde14('0xa')](),controller['delete']);module[_0xde14('0x23')]=router; \ No newline at end of file +var _0xc874=['originalname','extname','now','post','single','webhookPost','/:id','update','delete','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','get','index','/webhook','webhookGet','isAuthenticated','/:id/download','download','diskStorage','root','server/files/plugins','format','%s-%s%s','basename'];(function(_0x4beb57,_0x35a937){var _0x365108=function(_0xe04e26){while(--_0xe04e26){_0x4beb57['push'](_0x4beb57['shift']());}};_0x365108(++_0x35a937);}(_0xc874,0x154));var _0x4c87=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0xc874[_0x11155f];return _0xd07e48;};'use strict';var multer=require(_0x4c87('0x0'));var util=require('util');var path=require(_0x4c87('0x1'));var timeout=require(_0x4c87('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c87('0x3'));var auth=require(_0x4c87('0x4'));var interaction=require(_0x4c87('0x5'));var config=require('../../config/environment');var controller=require(_0x4c87('0x6'));router[_0x4c87('0x7')]('/',auth['isAuthenticated'](),controller[_0x4c87('0x8')]);router[_0x4c87('0x7')](_0x4c87('0x9'),controller[_0x4c87('0xa')]);router[_0x4c87('0x7')]('/:id',auth[_0x4c87('0xb')](),controller['show']);router[_0x4c87('0x7')](_0x4c87('0xc'),auth[_0x4c87('0xb')](),controller[_0x4c87('0xd')]);var upload=multer({'storage':multer[_0x4c87('0xe')]({'destination':function(_0x548e1a,_0x1fcc99,_0x2b82cb){_0x2b82cb(null,path['join'](config[_0x4c87('0xf')],_0x4c87('0x10')));},'filename':function(_0x1e0530,_0x3b01bb,_0x3a2aa2){_0x3b01bb['originalname']=_0x3b01bb['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3a2aa2(null,util[_0x4c87('0x11')](_0x4c87('0x12'),path[_0x4c87('0x13')](_0x3b01bb[_0x4c87('0x14')],path[_0x4c87('0x15')](_0x3b01bb[_0x4c87('0x14')])),Date[_0x4c87('0x16')](),path[_0x4c87('0x15')](_0x3b01bb['originalname'])));}})});router[_0x4c87('0x17')]('/',upload[_0x4c87('0x18')]('file'),controller['upload']);router[_0x4c87('0x17')](_0x4c87('0x9'),controller[_0x4c87('0x19')]);router['put'](_0x4c87('0x1a'),auth['isAuthenticated'](),controller[_0x4c87('0x1b')]);router[_0x4c87('0x1c')](_0x4c87('0x1a'),auth[_0x4c87('0xb')](),controller['delete']);module[_0x4c87('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 89eda2e..74cbb88 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 _0x1003=['ENUM','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','html','script','TEXT','STRING','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1003,0x84));var _0x3100=function(_0x4176df,_0x2f0e73){_0x4176df=_0x4176df-0x0;var _0x331bfe=_0x1003[_0x4176df];return _0x331bfe;};'use strict';var Sequelize=require(_0x3100('0x0'));module[_0x3100('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x3100('0x2'),_0x3100('0x3'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x3100('0x4')]},'path':{'type':Sequelize[_0x3100('0x5')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x3100('0x6')],'defaultValue':0x0,'comment':_0x3100('0x7')},'sidebar':{'type':Sequelize[_0x3100('0x8')](_0x3100('0x9'),_0x3100('0xa'),_0x3100('0xb'),_0x3100('0xc')),'defaultValue':_0x3100('0xb'),'comment':_0x3100('0xd')},'icon':{'type':Sequelize[_0x3100('0x5')]},'adminUrl':{'type':Sequelize[_0x3100('0x5')]},'agentUrl':{'type':Sequelize[_0x3100('0x5')]},'scriptName':{'type':Sequelize[_0x3100('0x5')]},'scriptPath':{'type':Sequelize[_0x3100('0x5')]}}; \ No newline at end of file +var _0x8fde=['agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','adminOnly'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x8fde,0x17d));var _0xe8fd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8fde[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0xe8fd('0x0')]={'name':{'type':Sequelize[_0xe8fd('0x1')]},'type':{'type':Sequelize['ENUM'](_0xe8fd('0x2'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xe8fd('0x3')]},'path':{'type':Sequelize[_0xe8fd('0x1')],'comment':_0xe8fd('0x4')},'active':{'type':Sequelize[_0xe8fd('0x5')],'defaultValue':0x0,'comment':_0xe8fd('0x6')},'sidebar':{'type':Sequelize[_0xe8fd('0x7')](_0xe8fd('0x8'),_0xe8fd('0x9'),'always',_0xe8fd('0xa')),'defaultValue':_0xe8fd('0xb'),'comment':_0xe8fd('0xc')},'icon':{'type':Sequelize[_0xe8fd('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xe8fd('0x1')]},'scriptName':{'type':Sequelize[_0xe8fd('0x1')]},'scriptPath':{'type':Sequelize[_0xe8fd('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index a34048f..46d1e3c 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 _0xcfbc=['Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','admin','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','always','icon','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','method','content-type','set','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./plugin.socket','register','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','Plugins','UserProfileResource','error','stack','name','index','map','Plugin','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','show','include','options','find','catch','download','params','server/files/plugins','format','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','root','join','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','basename','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','manifest.json'];(function(_0x567312,_0x33020e){var _0xea4df1=function(_0x4a9ada){while(--_0x4a9ada){_0x567312['push'](_0x567312['shift']());}};_0xea4df1(++_0x33020e);}(_0xcfbc,0x1a0));var _0xccfb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcfbc[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xccfb('0x0'));var jsonpatch=require(_0xccfb('0x1'));var rp=require(_0xccfb('0x2'));var moment=require(_0xccfb('0x3'));var BPromise=require(_0xccfb('0x4'));var Mustache=require('mustache');var util=require(_0xccfb('0x5'));var path=require(_0xccfb('0x6'));var sox=require('sox');var csv=require(_0xccfb('0x7'));var ejs=require(_0xccfb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xccfb('0x9'));var squel=require(_0xccfb('0xa'));var crypto=require(_0xccfb('0xb'));var jsforce=require(_0xccfb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xccfb('0x7'));var querystring=require(_0xccfb('0xd'));var Papa=require(_0xccfb('0xe'));var extract=require('extract-zip');var rimraf=require(_0xccfb('0xf'));var archiver=require(_0xccfb('0x10'));var Redis=require(_0xccfb('0x11'));var authService=require(_0xccfb('0x12'));var qs=require(_0xccfb('0x13'));var as=require(_0xccfb('0x14'));var hardwareService=require(_0xccfb('0x15'));var logger=require('../../config/logger')(_0xccfb('0x16'));var utils=require(_0xccfb('0x17'));var config=require(_0xccfb('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xccfb('0x19'))['db'];config[_0xccfb('0x1a')]=_['defaults'](config[_0xccfb('0x1a')],{'host':_0xccfb('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xccfb('0x1a')]));require(_0xccfb('0x1c'))[_0xccfb('0x1d')](socket);function respondWithStatusCode(_0x2dfec7,_0x367405){_0x367405=_0x367405||0xcc;return function(_0x2ee4d9){if(_0x2ee4d9){return _0x2dfec7[_0xccfb('0x1e')](_0x367405);}return _0x2dfec7[_0xccfb('0x1f')](_0x367405)[_0xccfb('0x20')]();};}function respondWithResult(_0x4cf4b7,_0x3bf90f){_0x3bf90f=_0x3bf90f||0xc8;return function(_0x28df4c){if(_0x28df4c){return _0x4cf4b7['status'](_0x3bf90f)[_0xccfb('0x21')](_0x28df4c);}};}function respondWithFilteredResult(_0x1323d7,_0x38e852){return function(_0x596a39){if(_0x596a39){var _0x3bb643=typeof _0x38e852[_0xccfb('0x22')]==='undefined'&&typeof _0x38e852[_0xccfb('0x23')]==='undefined';var _0x423554=_0x596a39['count'];var _0x39df4b=_0x3bb643?0x0:_0x38e852[_0xccfb('0x22')];var _0x5caf34=_0x3bb643?_0x596a39[_0xccfb('0x24')]:_0x38e852[_0xccfb('0x22')]+_0x38e852['limit'];var _0x289349;if(_0x5caf34>=_0x423554){_0x5caf34=_0x423554;_0x289349=0xc8;}else{_0x289349=0xce;}_0x1323d7['status'](_0x289349);return _0x1323d7['set'](_0xccfb('0x25'),_0x39df4b+'-'+_0x5caf34+'/'+_0x423554)[_0xccfb('0x21')](_0x596a39);}return null;};}function patchUpdates(_0x2c00bc){return function(_0x3c2bd3){try{jsonpatch['apply'](_0x3c2bd3,_0x2c00bc,!![]);}catch(_0x588c22){return BPromise[_0xccfb('0x26')](_0x588c22);}return _0x3c2bd3[_0xccfb('0x27')]();};}function saveUpdates(_0x4a67a9,_0x59ecf5){return function(_0x567b9b){if(_0x567b9b){return _0x567b9b[_0xccfb('0x28')](_0x4a67a9)[_0xccfb('0x29')](function(_0x9c65c8){return _0x9c65c8;});}return null;};}function removeEntity(_0x3a901a,_0xe3a759){return function(_0x4f8a8d){if(_0x4f8a8d){return _0x4f8a8d[_0xccfb('0x2a')]()[_0xccfb('0x29')](function(){var _0x313e04=_0x4f8a8d['get']({'plain':!![]});var _0x1ab9e6=_0xccfb('0x2b');return db[_0xccfb('0x2c')][_0xccfb('0x2a')]({'where':{'type':_0x1ab9e6,'resourceId':_0x313e04['id']}})['then'](function(){return _0x4f8a8d;});})['then'](function(){_0x3a901a[_0xccfb('0x1f')](0xcc)[_0xccfb('0x20')]();});}};}function handleEntityNotFound(_0x357ca1,_0x1d098d){return function(_0xe7a9bf){if(!_0xe7a9bf){_0x357ca1['sendStatus'](0x194);}return _0xe7a9bf;};}function handleError(_0x4d2786,_0x5585b1){_0x5585b1=_0x5585b1||0x1f4;return function(_0x4cf8ca){logger[_0xccfb('0x2d')](_0x4cf8ca[_0xccfb('0x2e')]);if(_0x4cf8ca[_0xccfb('0x2f')]){delete _0x4cf8ca['name'];}_0x4d2786['status'](_0x5585b1)['send'](_0x4cf8ca);};}exports[_0xccfb('0x30')]=function(_0x56938a,_0x3085a8){var _0x479579={},_0x28cd4b={},_0x398612={'count':0x0,'rows':[]};var _0x56e20b=_[_0xccfb('0x31')](db[_0xccfb('0x32')][_0xccfb('0x33')],function(_0x79df6c){return{'name':_0x79df6c[_0xccfb('0x34')],'type':_0x79df6c['type'][_0xccfb('0x35')]};});_0x28cd4b[_0xccfb('0x36')]=_['map'](_0x56e20b,_0xccfb('0x2f'));_0x28cd4b[_0xccfb('0x37')]=_[_0xccfb('0x38')](_0x56938a['query']);_0x28cd4b['filters']=_[_0xccfb('0x39')](_0x28cd4b[_0xccfb('0x36')],_0x28cd4b[_0xccfb('0x37')]);_0x479579[_0xccfb('0x3a')]=_[_0xccfb('0x39')](_0x28cd4b['model'],qs[_0xccfb('0x3b')](_0x56938a[_0xccfb('0x37')][_0xccfb('0x3b')]));_0x479579[_0xccfb('0x3a')]=_0x479579[_0xccfb('0x3a')][_0xccfb('0x3c')]?_0x479579[_0xccfb('0x3a')]:_0x28cd4b[_0xccfb('0x36')];if(!_0x56938a[_0xccfb('0x37')][_0xccfb('0x3d')]('nolimit')){_0x479579[_0xccfb('0x23')]=qs['limit'](_0x56938a[_0xccfb('0x37')]['limit']);_0x479579[_0xccfb('0x22')]=qs[_0xccfb('0x22')](_0x56938a[_0xccfb('0x37')][_0xccfb('0x22')]);}_0x479579['order']=qs[_0xccfb('0x3e')](_0x56938a[_0xccfb('0x37')][_0xccfb('0x3e')]);_0x479579[_0xccfb('0x3f')]=qs[_0xccfb('0x40')](_['pick'](_0x56938a[_0xccfb('0x37')],_0x28cd4b['filters']),_0x56e20b);if(_0x56938a[_0xccfb('0x37')][_0xccfb('0x41')]){_0x479579[_0xccfb('0x3f')]=_[_0xccfb('0x42')](_0x479579['where'],{'$or':_['map'](_0x56e20b,function(_0x40b0b8){if(_0x40b0b8['type']!==_0xccfb('0x43')){var _0xf4cee7={};_0xf4cee7[_0x40b0b8[_0xccfb('0x2f')]]={'$like':'%'+_0x56938a[_0xccfb('0x37')][_0xccfb('0x41')]+'%'};return _0xf4cee7;}})});}_0x479579=_['merge']({},_0x479579,_0x56938a['options']);var _0x376ae6={'where':_0x479579['where']};return db[_0xccfb('0x32')]['count'](_0x376ae6)['then'](function(_0x78e28){_0x398612['count']=_0x78e28;if(_0x56938a[_0xccfb('0x37')][_0xccfb('0x44')]){_0x479579['include']=[{'all':!![]}];}return db['Plugin'][_0xccfb('0x45')](_0x479579);})[_0xccfb('0x29')](function(_0x4edac2){_0x398612[_0xccfb('0x46')]=_0x4edac2;return _0x398612;})['then'](respondWithFilteredResult(_0x3085a8,_0x479579))['catch'](handleError(_0x3085a8,null));};exports[_0xccfb('0x47')]=function(_0x35a54d,_0x1612fa){var _0x19d46d={'raw':!![],'where':{'id':_0x35a54d['params']['id']}},_0x40bb28={};_0x40bb28[_0xccfb('0x36')]=_[_0xccfb('0x38')](db[_0xccfb('0x32')][_0xccfb('0x33')]);_0x40bb28[_0xccfb('0x37')]=_['keys'](_0x35a54d[_0xccfb('0x37')]);_0x40bb28[_0xccfb('0x40')]=_['intersection'](_0x40bb28['model'],_0x40bb28['query']);_0x19d46d[_0xccfb('0x3a')]=_[_0xccfb('0x39')](_0x40bb28['model'],qs[_0xccfb('0x3b')](_0x35a54d[_0xccfb('0x37')][_0xccfb('0x3b')]));_0x19d46d[_0xccfb('0x3a')]=_0x19d46d[_0xccfb('0x3a')][_0xccfb('0x3c')]?_0x19d46d[_0xccfb('0x3a')]:_0x40bb28[_0xccfb('0x36')];if(_0x35a54d[_0xccfb('0x37')]['includeAll']){_0x19d46d[_0xccfb('0x48')]=[{'all':!![]}];}_0x19d46d=_[_0xccfb('0x42')]({},_0x19d46d,_0x35a54d[_0xccfb('0x49')]);return db[_0xccfb('0x32')][_0xccfb('0x4a')](_0x19d46d)['then'](handleEntityNotFound(_0x1612fa,null))[_0xccfb('0x29')](respondWithResult(_0x1612fa,null))[_0xccfb('0x4b')](handleError(_0x1612fa,null));};exports[_0xccfb('0x4c')]=function(_0x5ca39b,_0x26666d,_0x38d74e){return db[_0xccfb('0x32')][_0xccfb('0x4a')]({'where':{'id':_0x5ca39b[_0xccfb('0x4d')]['id']},'attributes':[_0xccfb('0x2f'),'path'],'raw':!![]})[_0xccfb('0x29')](handleEntityNotFound(_0x26666d,null))[_0xccfb('0x29')](function(_0x480e6c){if(_0x480e6c){var _0x45ef83=path['join'](config['root'],_0xccfb('0x4e'),util[_0xccfb('0x4f')]('%s.zip',path['basename'](_0x480e6c['path'])));var _0x15c4a0=fs[_0xccfb('0x50')](_0x45ef83);var _0x5504cd=archiver(_0xccfb('0x51'),{'zlib':{'level':0x9}});_0x5504cd['on'](_0xccfb('0x52'),function(_0x1825c5){if(_0x1825c5[_0xccfb('0x53')]===_0xccfb('0x54')){logger['error'](_0x1825c5);}else{throw new db[(_0xccfb('0x55'))]['Error'](_0xccfb('0x56'));}});_0x5504cd['on'](_0xccfb('0x2d'),function(_0x5c48fc){throw new db[(_0xccfb('0x55'))][(_0xccfb('0x57'))](_0xccfb('0x56'));});_0x5504cd['pipe'](_0x15c4a0);_0x5504cd[_0xccfb('0x58')](_0xccfb('0x59'),{'cwd':path['join'](config[_0xccfb('0x5a')],_0xccfb('0x4e'),path['dirname'](_0x480e6c[_0xccfb('0x6')])),'ignore':[path[_0xccfb('0x5b')](path['basename'](_0x480e6c[_0xccfb('0x6')]),_0xccfb('0x5c')),path['join'](path['basename'](_0x480e6c[_0xccfb('0x6')]),_0xccfb('0x5d'))],'nodir':!![]})[_0xccfb('0x5e')]();_0x15c4a0['on']('close',function(){if(!fs[_0xccfb('0x5f')](_0x45ef83)){throw new db[(_0xccfb('0x55'))]['Error'](_0xccfb('0x60'));}return _0x26666d[_0xccfb('0x4c')](_0x45ef83,util['format'](_0xccfb('0x61'),path[_0xccfb('0x62')](_0x480e6c['path'])),function(_0x2819ef){if(_0x2819ef){throw new db['Sequelize'][(_0xccfb('0x57'))](_0xccfb('0x63'));}fs[_0xccfb('0x64')](_0x45ef83);logger[_0xccfb('0x65')](_0xccfb('0x66'));logger[_0xccfb('0x65')](_0xccfb('0x67'));});});}return null;})[_0xccfb('0x4b')](handleError(_0x26666d,null));};exports[_0xccfb('0x68')]=function(_0x2fc1d6,_0x546d10,_0x176848){var _0x29102d=path[_0xccfb('0x62')](_0x2fc1d6['file']['filename'],path['extname'](_0x2fc1d6[_0xccfb('0x69')][_0xccfb('0x6a')]));var _0x967d9b=path[_0xccfb('0x5b')](config[_0xccfb('0x5a')],_0xccfb('0x4e'),_0x2fc1d6[_0xccfb('0x69')][_0xccfb('0x6a')]);var _0x12e9d9=path[_0xccfb('0x5b')](config['root'],_0xccfb('0x4e'),_0x29102d);logger[_0xccfb('0x65')](_0xccfb('0x6b'),_0x967d9b);logger[_0xccfb('0x65')]('Plugin\x20upload\x20destination:\x20%s',_0x12e9d9);try{fs[_0xccfb('0x6c')](_0x967d9b,parseInt(_0xccfb('0x6d'),0x8));extract(_0x967d9b,{'dir':_0x12e9d9},function(_0x43569d){if(_0x43569d){logger[_0xccfb('0x2d')](_0x43569d);handleError(_0x43569d,!![]);};var _0x2ad0e4=fs['readdirSync'](_0x12e9d9);if(_0x2ad0e4['length']>0x1){removeReferences(_0x967d9b,_0x12e9d9);logger[_0xccfb('0x2d')]('Invalid\x20plugin\x20structure');return _0x176848(new Error(_0xccfb('0x6e')));}var _0x1aefca=fs[_0xccfb('0x6f')](path['join'](_0x12e9d9,_0x2ad0e4[0x0]));if(_0x1aefca[_0xccfb('0x70')]()){removeReferences(_0x967d9b,_0x12e9d9);logger[_0xccfb('0x2d')]('Invalid\x20plugin\x20structure');return _0x176848(new Error('Invalid\x20plugin\x20structure'));}if(_0x1aefca['isDirectory']()){var _0x25d589=fs[_0xccfb('0x71')](path[_0xccfb('0x5b')](_0x12e9d9,_0x2ad0e4[0x0]));if(_0x25d589[_0xccfb('0x3c')]===0x0){removeReferences(_0x967d9b,_0x12e9d9);logger[_0xccfb('0x2d')](_0xccfb('0x6e'));return _0x176848(new Error('Invalid\x20plugin\x20structure'));}var _0xc5ba07=_0x25d589['some'](function(_0x29f3e8){return _0x29f3e8===_0xccfb('0x72');});if(!_0xc5ba07){return _0x176848(new Error(_0xccfb('0x73')));}var _0x12602d=fs[_0xccfb('0x74')](path[_0xccfb('0x5b')](_0x12e9d9,_0x2ad0e4[0x0],'manifest.json'));var _0x54f03d=JSON[_0xccfb('0x75')](_0x12602d);if(_0xccfb('0x76')==typeof _0x54f03d[_0xccfb('0x2f')]){return _0x176848(new Error(_0xccfb('0x77')));}if('undefined'==typeof _0x54f03d[_0xccfb('0x78')]){return _0x176848(new Error(_0xccfb('0x79')));}if(_0xccfb('0x76')==typeof _0x54f03d['version']){return _0x176848(new Error(_0xccfb('0x7a')));}if('undefined'==typeof _0x54f03d[_0xccfb('0x7b')]){return _0x176848(new Error(_0xccfb('0x7c')));}if(_0x54f03d[_0xccfb('0x78')]===_0xccfb('0x7d')){if(_0xccfb('0x76')==typeof _0x54f03d[_0xccfb('0x7b')]['views']){return _0x176848(new Error(_0xccfb('0x7e')));}if('undefined'==typeof _0x54f03d['parameters'][_0xccfb('0x7f')][_0xccfb('0x80')]&&'undefined'==typeof _0x54f03d[_0xccfb('0x7b')][_0xccfb('0x7f')][_0xccfb('0x81')]){return _0x176848(new Error(_0xccfb('0x82')));}}else if(_0x54f03d[_0xccfb('0x78')]===_0xccfb('0x83')){if(_0xccfb('0x76')==typeof _0x54f03d[_0xccfb('0x7b')][_0xccfb('0x84')]){return _0x176848(new Error(_0xccfb('0x85')));}if(_0xccfb('0x76')==typeof _0x54f03d[_0xccfb('0x7b')][_0xccfb('0x86')]){return _0x176848(new Error(_0xccfb('0x87')));}}else{return _0x176848(new Error(_0xccfb('0x88')));}var _0x27f75b=_0x54f03d[_0xccfb('0x2f')];var _0x2f1baf=_0x54f03d[_0xccfb('0x89')];var _0x19058a=_0x54f03d[_0xccfb('0x78')];var _0xe1a649=_0x54f03d[_0xccfb('0x8a')]?_0x54f03d[_0xccfb('0x8a')]:_0xccfb('0x8b');var _0x1996de=_0x54f03d[_0xccfb('0x8c')]?_0x54f03d[_0xccfb('0x8c')]:'icon-apps';var _0x4ec4ec='';var _0x531afc='';var _0x486c45='';var _0x376923='';var _0x4788be=_0x54f03d[_0xccfb('0x8d')];if(_0x19058a==='html'){if('undefined'!=typeof _0x54f03d[_0xccfb('0x7b')][_0xccfb('0x7f')][_0xccfb('0x80')]){var _0x187838=_0x54f03d[_0xccfb('0x7b')]['views'][_0xccfb('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xccfb('0x8e')](_0x187838)){_0x4ec4ec=path['join'](_0xccfb('0x8f'),_0x29102d,_0x2ad0e4[0x0],_0x187838);}else{_0x4ec4ec=_0x187838;}}else{logger[_0xccfb('0x65')](_0xccfb('0x90'));}if(_0xccfb('0x76')!=typeof _0x54f03d[_0xccfb('0x7b')]['views'][_0xccfb('0x81')]){var _0xc3fe68=_0x54f03d[_0xccfb('0x7b')][_0xccfb('0x7f')][_0xccfb('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xccfb('0x8e')](_0xc3fe68)){_0x531afc=path['join'](_0xccfb('0x8f'),_0x29102d,_0x2ad0e4[0x0],_0xc3fe68);}else{_0x531afc=_0xc3fe68;}}else{logger[_0xccfb('0x65')](_0xccfb('0x91'));}}else if(_0x19058a==='script'){_0x486c45=_0x54f03d['parameters']['scriptName'];_0x376923=_0x54f03d[_0xccfb('0x7b')][_0xccfb('0x86')];if('undefined'!=typeof _0x54f03d[_0xccfb('0x7b')][_0xccfb('0x7f')]){if(_0xccfb('0x76')!=typeof _0x54f03d[_0xccfb('0x7b')]['views'][_0xccfb('0x80')]){var _0x187838=_0x54f03d['parameters'][_0xccfb('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xccfb('0x8e')](_0x187838)){_0x4ec4ec=path['join'](_0xccfb('0x8f'),_0x29102d,_0x2ad0e4[0x0],_0x187838);}else{_0x4ec4ec=_0x187838;}}if(_0xccfb('0x76')!=typeof _0x54f03d['parameters'][_0xccfb('0x7f')]['agent']){var _0xc3fe68=_0x54f03d['parameters'][_0xccfb('0x7f')][_0xccfb('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0xc3fe68)){_0x531afc=path[_0xccfb('0x5b')](_0xccfb('0x8f'),_0x29102d,_0x2ad0e4[0x0],_0xc3fe68);}else{_0x531afc=_0xc3fe68;}}}}var _0x547c2b={'name':_0x27f75b,'description':_0x2f1baf,'path':path['join'](_0x29102d,_0x2ad0e4[0x0]),'type':_0x19058a,'sidebar':_0xe1a649,'icon':_0x1996de,'adminUrl':_0x4ec4ec,'agentUrl':_0x531afc,'scriptName':_0x486c45,'scriptPath':_0x376923,'version':_0x4788be};removeReferences(_0x967d9b,null);return db[_0xccfb('0x32')][_0xccfb('0x92')](_0x547c2b)['then'](function(_0x19b0b0){var _0x4ec2d7={'role':_0x2fc1d6[_0xccfb('0x93')][_0xccfb('0x94')],'userProfileId':_0x2fc1d6[_0xccfb('0x93')][_0xccfb('0x95')]};if(!_0x4ec2d7)throw new Error(_0xccfb('0x96'));if(_0x4ec2d7['role']===_0xccfb('0x97')){var _0x8abc50=_0x19b0b0['get']({'plain':!![]});return db[_0xccfb('0x98')]['find']({'where':{'name':_0xccfb('0x2b'),'userProfileId':_0x4ec2d7['userProfileId']},'raw':!![]})[_0xccfb('0x29')](function(_0xdb4c82){if(_0xdb4c82&&_0xdb4c82[_0xccfb('0x99')]===0x0){return db[_0xccfb('0x2c')][_0xccfb('0x92')]({'name':_0x8abc50['name'],'resourceId':_0x8abc50['id'],'type':_0xdb4c82[_0xccfb('0x2f')],'sectionId':_0xdb4c82['id']},{})[_0xccfb('0x29')](function(){return _0x19b0b0;});}else{return _0x19b0b0;}})[_0xccfb('0x4b')](function(_0x454cc7){logger[_0xccfb('0x2d')](_0xccfb('0x9a'),_0x454cc7);throw _0x454cc7;});}return _0x19b0b0;})[_0xccfb('0x29')](respondWithResult(_0x546d10,null))[_0xccfb('0x4b')](handleError(_0x546d10,null));}});}catch(_0xfbc67b){_0x546d10['status'](0x1f4)[_0xccfb('0x9b')](_0xfbc67b);}};function removeReferences(_0x55599d,_0x2aaa97){try{if(_0x55599d){fs['unlinkSync'](_0x55599d);logger[_0xccfb('0x65')](_0xccfb('0x9c'));}if(_0x2aaa97){rimraf(_0x2aaa97,function(){});logger['info'](_0xccfb('0x9d'));}}catch(_0x5b58cf){logger[_0xccfb('0x2d')](_0x5b58cf);}}exports[_0xccfb('0x28')]=function(_0x361199,_0x25dcc7,_0x4f587a){return db[_0xccfb('0x32')]['find']({'where':{'id':_0x361199[_0xccfb('0x4d')]['id']}})[_0xccfb('0x29')](handleEntityNotFound(_0x25dcc7,null))[_0xccfb('0x29')](saveUpdates(_0x361199[_0xccfb('0x93')],null))[_0xccfb('0x29')](respondWithResult(_0x25dcc7,null))['catch'](handleError(_0x25dcc7,null));};exports[_0xccfb('0x9e')]=function(_0x22f48e,_0x3382f9,_0x34265b){return db['Plugin']['find']({'where':{'id':_0x22f48e[_0xccfb('0x4d')]['id']}})[_0xccfb('0x29')](function(_0x5c2235){if(_0x5c2235){return _0x5c2235[_0xccfb('0x2a')]();}})[_0xccfb('0x29')](function(_0x3c85a9){rimraf(path[_0xccfb('0x5b')](config[_0xccfb('0x5a')],_0xccfb('0x4e'),path[_0xccfb('0x9f')](_0x3c85a9[_0xccfb('0x6')])),function(){});return _0x3c85a9;})[_0xccfb('0x29')](handleEntityNotFound(_0x3382f9,null))[_0xccfb('0x29')](respondWithStatusCode(_0x3382f9,null))[_0xccfb('0x4b')](handleError(_0x3382f9,null));};exports[_0xccfb('0xa0')]=function(_0x2c941f,_0x533301,_0x4279bb){return BPromise[_0xccfb('0xa1')]()['then'](function(){if(!_0x2c941f['query'][_0xccfb('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2c941f[_0xccfb('0x37')][_0xccfb('0xa2')]){throw new Error(_0xccfb('0xa3'));}var _0x21b6b8=_0x2c941f['query']['hostname']?_0x2c941f[_0xccfb('0x37')][_0xccfb('0xa4')]+':'+_0x2c941f[_0xccfb('0x37')][_0xccfb('0xa2')]:_0xccfb('0xa5')+_0x2c941f[_0xccfb('0x37')][_0xccfb('0xa2')];var _0x332b4d=_0x2c941f[_0xccfb('0x37')][_0xccfb('0x21')]?_0x2c941f[_0xccfb('0x37')][_0xccfb('0x21')]:!![];var _0x2f35ed=_0x2c941f[_0xccfb('0x37')][_0xccfb('0xa6')]?_0x2c941f['query'][_0xccfb('0xa6')]:null;var _0x228291={'method':_0x2c941f['method'],'uri':util[_0xccfb('0x4f')](_0xccfb('0xa7'),_0x21b6b8,_0x2c941f[_0xccfb('0x37')][_0xccfb('0x6')]),'json':_0x332b4d,'resolveWithFullResponse':!![],'encoding':_0x2f35ed,'qs':_0x2c941f[_0xccfb('0x37')]};if(_0x2c941f[_0xccfb('0xa8')]){_0x228291[_0xccfb('0xa8')]=_0x2c941f['headers'];if(_0x228291[_0xccfb('0xa8')][_0xccfb('0xa9')]){delete _0x228291[_0xccfb('0xa8')][_0xccfb('0xa9')];}}if(_0x228291[_0xccfb('0xa8')]['content-type']){delete _0x228291[_0xccfb('0xa8')]['content-type'];}return rp(_0x228291);})['then'](function(_0x4a245b){if(_0x4a245b){_0x533301['set'](_0x4a245b[_0xccfb('0xa8')]);logger[_0xccfb('0x65')](_0x4a245b[_0xccfb('0x93')]);if(_[_0xccfb('0xaa')](_0x2c941f[_0xccfb('0x37')]['path'],'download')&&_0x4a245b['statusCode']==0x1f4){return _0x533301[_0xccfb('0x1e')](_0x4a245b[_0xccfb('0xab')]);}else{return _0x533301[_0xccfb('0x1f')](_0x4a245b[_0xccfb('0xab')])[_0xccfb('0x9b')](_0x4a245b[_0xccfb('0x93')]);}}else{return _0x533301[_0xccfb('0x1e')](0xc8);}})[_0xccfb('0x4b')](handleError(_0x533301,null));};exports[_0xccfb('0xac')]=function(_0x5a14d2,_0x2c1c9b,_0x50136c){return BPromise['resolve']()['then'](function(){if(!_0x5a14d2[_0xccfb('0x37')]['path']){throw new Error(_0xccfb('0xad'));}if(!_0x5a14d2['query'][_0xccfb('0xa2')]){throw new Error(_0xccfb('0xa3'));}var _0x48963f=_0x5a14d2['query']['hostname']?_0x5a14d2[_0xccfb('0x37')][_0xccfb('0xa4')]+':'+_0x5a14d2[_0xccfb('0x37')][_0xccfb('0xa2')]:_0xccfb('0xa5')+_0x5a14d2[_0xccfb('0x37')][_0xccfb('0xa2')];var _0x374502=_0x5a14d2[_0xccfb('0x37')][_0xccfb('0x21')]?_0x5a14d2[_0xccfb('0x37')][_0xccfb('0x21')]:!![];var _0x57e4f6=_0x5a14d2[_0xccfb('0x37')][_0xccfb('0xa6')]?_0x5a14d2[_0xccfb('0x37')][_0xccfb('0xa6')]:null;var _0x2a8fcf={'method':_0x5a14d2[_0xccfb('0xae')],'uri':util[_0xccfb('0x4f')](_0xccfb('0xa7'),_0x48963f,_0x5a14d2[_0xccfb('0x37')]['path']),'json':_0x374502,'resolveWithFullResponse':!![],'encoding':_0x57e4f6,'body':_0x5a14d2[_0xccfb('0x93')]};if(_0x5a14d2['headers']){_0x2a8fcf[_0xccfb('0xa8')]=_0x5a14d2[_0xccfb('0xa8')];if(_0x2a8fcf['headers'][_0xccfb('0xa9')]){delete _0x2a8fcf[_0xccfb('0xa8')][_0xccfb('0xa9')];}}if(_0x2a8fcf['headers']['content-type']){delete _0x2a8fcf[_0xccfb('0xa8')][_0xccfb('0xaf')];}return rp(_0x2a8fcf);})[_0xccfb('0x29')](function(_0xac7728){if(_0xac7728){_0x2c1c9b[_0xccfb('0xb0')](_0xac7728['headers']);logger[_0xccfb('0x65')](_0xac7728['body']);return _0x2c1c9b[_0xccfb('0x1f')](_0xac7728['statusCode'])[_0xccfb('0x9b')](_0xac7728['body']);}else{return _0x2c1c9b[_0xccfb('0x1e')](0xc8);}})[_0xccfb('0x4b')](handleError(_0x2c1c9b,null));}; \ No newline at end of file +var _0x2b28=['find','download','join','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','dirname','basename','node_modules/**/*','attachments/**/*','finalize','existsSync','Sequelize','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','upload','file','filename','root','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','unlinkSync','Extracted\x20folder\x20removed','update','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','port','\x27PORT\x27\x20parameter\x20not\x20specified','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','json','then','get','UserProfileResource','destroy','error','stack','name','send','map','Plugin','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','catch','params'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2b28,0x192));var _0x82b2=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x2b28[_0x2c1dcd];return _0x158ce5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82b2('0x0'));var zipdir=require(_0x82b2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82b2('0x2'));var moment=require(_0x82b2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x82b2('0x4'));var path=require(_0x82b2('0x5'));var sox=require(_0x82b2('0x6'));var csv=require('to-csv');var ejs=require(_0x82b2('0x7'));var fs=require('fs');var fs_extra=require(_0x82b2('0x8'));var _=require(_0x82b2('0x9'));var squel=require(_0x82b2('0xa'));var crypto=require(_0x82b2('0xb'));var jsforce=require(_0x82b2('0xc'));var deskjs=require(_0x82b2('0xd'));var toCsv=require(_0x82b2('0xe'));var querystring=require(_0x82b2('0xf'));var Papa=require(_0x82b2('0x10'));var extract=require(_0x82b2('0x11'));var rimraf=require(_0x82b2('0x0'));var archiver=require(_0x82b2('0x12'));var Redis=require(_0x82b2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x82b2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x82b2('0x15'));var logger=require(_0x82b2('0x16'))(_0x82b2('0x17'));var utils=require(_0x82b2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x82b2('0x19')]=_[_0x82b2('0x1a')](config[_0x82b2('0x19')],{'host':_0x82b2('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x82b2('0x19')]));require(_0x82b2('0x1c'))[_0x82b2('0x1d')](socket);function respondWithStatusCode(_0x1ebb20,_0x140ba6){_0x140ba6=_0x140ba6||0xcc;return function(_0x1b61f8){if(_0x1b61f8){return _0x1ebb20[_0x82b2('0x1e')](_0x140ba6);}return _0x1ebb20[_0x82b2('0x1f')](_0x140ba6)[_0x82b2('0x20')]();};}function respondWithResult(_0x2740ac,_0x44d49f){_0x44d49f=_0x44d49f||0xc8;return function(_0x3531d4){if(_0x3531d4){return _0x2740ac[_0x82b2('0x1f')](_0x44d49f)['json'](_0x3531d4);}};}function respondWithFilteredResult(_0x2fcf3b,_0x38b8cf){return function(_0x49fc4e){if(_0x49fc4e){var _0x483462=typeof _0x38b8cf[_0x82b2('0x21')]==='undefined'&&typeof _0x38b8cf[_0x82b2('0x22')]==='undefined';var _0x17dc37=_0x49fc4e['count'];var _0x4a9bd3=_0x483462?0x0:_0x38b8cf[_0x82b2('0x21')];var _0x5d37c8=_0x483462?_0x49fc4e['count']:_0x38b8cf[_0x82b2('0x21')]+_0x38b8cf[_0x82b2('0x22')];var _0xb0f39a;if(_0x5d37c8>=_0x17dc37){_0x5d37c8=_0x17dc37;_0xb0f39a=0xc8;}else{_0xb0f39a=0xce;}_0x2fcf3b['status'](_0xb0f39a);return _0x2fcf3b[_0x82b2('0x23')](_0x82b2('0x24'),_0x4a9bd3+'-'+_0x5d37c8+'/'+_0x17dc37)[_0x82b2('0x25')](_0x49fc4e);}return null;};}function patchUpdates(_0x53c4bb){return function(_0x17bdd3){try{jsonpatch['apply'](_0x17bdd3,_0x53c4bb,!![]);}catch(_0x444dd4){return BPromise['reject'](_0x444dd4);}return _0x17bdd3['save']();};}function saveUpdates(_0x58caea,_0x117228){return function(_0x202309){if(_0x202309){return _0x202309['update'](_0x58caea)[_0x82b2('0x26')](function(_0x3e42e1){return _0x3e42e1;});}return null;};}function removeEntity(_0x5c831,_0x480d2e){return function(_0x3c51e9){if(_0x3c51e9){return _0x3c51e9['destroy']()[_0x82b2('0x26')](function(){var _0x11074c=_0x3c51e9[_0x82b2('0x27')]({'plain':!![]});var _0x2ae6b0='Plugins';return db[_0x82b2('0x28')][_0x82b2('0x29')]({'where':{'type':_0x2ae6b0,'resourceId':_0x11074c['id']}})[_0x82b2('0x26')](function(){return _0x3c51e9;});})[_0x82b2('0x26')](function(){_0x5c831['status'](0xcc)[_0x82b2('0x20')]();});}};}function handleEntityNotFound(_0x2e30c6,_0x2d5384){return function(_0x3eda1c){if(!_0x3eda1c){_0x2e30c6[_0x82b2('0x1e')](0x194);}return _0x3eda1c;};}function handleError(_0x2229b9,_0x5a7897){_0x5a7897=_0x5a7897||0x1f4;return function(_0x294eb1){logger[_0x82b2('0x2a')](_0x294eb1[_0x82b2('0x2b')]);if(_0x294eb1[_0x82b2('0x2c')]){delete _0x294eb1[_0x82b2('0x2c')];}_0x2229b9[_0x82b2('0x1f')](_0x5a7897)[_0x82b2('0x2d')](_0x294eb1);};}exports['index']=function(_0x3625f9,_0x3c291a){var _0xed8478={},_0x109f0d={},_0x35fc41={'count':0x0,'rows':[]};var _0x225580=_[_0x82b2('0x2e')](db[_0x82b2('0x2f')][_0x82b2('0x30')],function(_0x4c63e5){return{'name':_0x4c63e5[_0x82b2('0x31')],'type':_0x4c63e5['type']['key']};});_0x109f0d['model']=_[_0x82b2('0x2e')](_0x225580,_0x82b2('0x2c'));_0x109f0d[_0x82b2('0x32')]=_[_0x82b2('0x33')](_0x3625f9[_0x82b2('0x32')]);_0x109f0d[_0x82b2('0x34')]=_[_0x82b2('0x35')](_0x109f0d['model'],_0x109f0d[_0x82b2('0x32')]);_0xed8478['attributes']=_[_0x82b2('0x35')](_0x109f0d[_0x82b2('0x36')],qs[_0x82b2('0x37')](_0x3625f9[_0x82b2('0x32')]['fields']));_0xed8478[_0x82b2('0x38')]=_0xed8478[_0x82b2('0x38')][_0x82b2('0x39')]?_0xed8478[_0x82b2('0x38')]:_0x109f0d['model'];if(!_0x3625f9[_0x82b2('0x32')][_0x82b2('0x3a')](_0x82b2('0x3b'))){_0xed8478[_0x82b2('0x22')]=qs[_0x82b2('0x22')](_0x3625f9[_0x82b2('0x32')][_0x82b2('0x22')]);_0xed8478['offset']=qs['offset'](_0x3625f9[_0x82b2('0x32')][_0x82b2('0x21')]);}_0xed8478[_0x82b2('0x3c')]=qs[_0x82b2('0x3d')](_0x3625f9[_0x82b2('0x32')][_0x82b2('0x3d')]);_0xed8478['where']=qs[_0x82b2('0x34')](_['pick'](_0x3625f9[_0x82b2('0x32')],_0x109f0d[_0x82b2('0x34')]),_0x225580);if(_0x3625f9['query'][_0x82b2('0x3e')]){_0xed8478['where']=_[_0x82b2('0x3f')](_0xed8478[_0x82b2('0x40')],{'$or':_['map'](_0x225580,function(_0x431c0e){if(_0x431c0e[_0x82b2('0x41')]!==_0x82b2('0x42')){var _0x3f875d={};_0x3f875d[_0x431c0e[_0x82b2('0x2c')]]={'$like':'%'+_0x3625f9['query'][_0x82b2('0x3e')]+'%'};return _0x3f875d;}})});}_0xed8478=_[_0x82b2('0x3f')]({},_0xed8478,_0x3625f9['options']);var _0xb89016={'where':_0xed8478[_0x82b2('0x40')]};return db['Plugin']['count'](_0xb89016)['then'](function(_0x1949b7){_0x35fc41['count']=_0x1949b7;if(_0x3625f9[_0x82b2('0x32')][_0x82b2('0x43')]){_0xed8478[_0x82b2('0x44')]=[{'all':!![]}];}return db[_0x82b2('0x2f')][_0x82b2('0x45')](_0xed8478);})[_0x82b2('0x26')](function(_0x1ab2a9){_0x35fc41['rows']=_0x1ab2a9;return _0x35fc41;})['then'](respondWithFilteredResult(_0x3c291a,_0xed8478))[_0x82b2('0x46')](handleError(_0x3c291a,null));};exports['show']=function(_0x5d89ea,_0x111c80){var _0x4686f1={'raw':!![],'where':{'id':_0x5d89ea[_0x82b2('0x47')]['id']}},_0x2f41b0={};_0x2f41b0[_0x82b2('0x36')]=_[_0x82b2('0x33')](db[_0x82b2('0x2f')][_0x82b2('0x30')]);_0x2f41b0['query']=_[_0x82b2('0x33')](_0x5d89ea[_0x82b2('0x32')]);_0x2f41b0[_0x82b2('0x34')]=_['intersection'](_0x2f41b0[_0x82b2('0x36')],_0x2f41b0[_0x82b2('0x32')]);_0x4686f1[_0x82b2('0x38')]=_[_0x82b2('0x35')](_0x2f41b0[_0x82b2('0x36')],qs[_0x82b2('0x37')](_0x5d89ea[_0x82b2('0x32')]['fields']));_0x4686f1[_0x82b2('0x38')]=_0x4686f1[_0x82b2('0x38')][_0x82b2('0x39')]?_0x4686f1[_0x82b2('0x38')]:_0x2f41b0[_0x82b2('0x36')];if(_0x5d89ea[_0x82b2('0x32')][_0x82b2('0x43')]){_0x4686f1['include']=[{'all':!![]}];}_0x4686f1=_['merge']({},_0x4686f1,_0x5d89ea['options']);return db[_0x82b2('0x2f')][_0x82b2('0x48')](_0x4686f1)[_0x82b2('0x26')](handleEntityNotFound(_0x111c80,null))[_0x82b2('0x26')](respondWithResult(_0x111c80,null))[_0x82b2('0x46')](handleError(_0x111c80,null));};exports[_0x82b2('0x49')]=function(_0x104cb8,_0x238cd3,_0x2f5ba1){return db[_0x82b2('0x2f')][_0x82b2('0x48')]({'where':{'id':_0x104cb8[_0x82b2('0x47')]['id']},'attributes':[_0x82b2('0x2c'),_0x82b2('0x5')],'raw':!![]})[_0x82b2('0x26')](handleEntityNotFound(_0x238cd3,null))[_0x82b2('0x26')](function(_0x1cfc03){if(_0x1cfc03){var _0x399bf9=path[_0x82b2('0x4a')](config['root'],_0x82b2('0x4b'),util[_0x82b2('0x4c')](_0x82b2('0x4d'),path['basename'](_0x1cfc03[_0x82b2('0x5')])));var _0x3f5cc7=fs[_0x82b2('0x4e')](_0x399bf9);var _0x43eab1=archiver(_0x82b2('0x4f'),{'zlib':{'level':0x9}});_0x43eab1['on'](_0x82b2('0x50'),function(_0x21e9b5){if(_0x21e9b5[_0x82b2('0x51')]==='ENOENT'){logger[_0x82b2('0x2a')](_0x21e9b5);}else{throw new db['Sequelize'][(_0x82b2('0x52'))](_0x82b2('0x53'));}});_0x43eab1['on'](_0x82b2('0x2a'),function(_0x37ba3e){throw new db['Sequelize'][(_0x82b2('0x52'))](_0x82b2('0x53'));});_0x43eab1[_0x82b2('0x54')](_0x3f5cc7);_0x43eab1['glob']('**/*',{'cwd':path['join'](config['root'],_0x82b2('0x4b'),path[_0x82b2('0x55')](_0x1cfc03[_0x82b2('0x5')])),'ignore':[path[_0x82b2('0x4a')](path[_0x82b2('0x56')](_0x1cfc03['path']),_0x82b2('0x57')),path[_0x82b2('0x4a')](path['basename'](_0x1cfc03[_0x82b2('0x5')]),_0x82b2('0x58'))],'nodir':!![]})[_0x82b2('0x59')]();_0x3f5cc7['on']('close',function(){if(!fs[_0x82b2('0x5a')](_0x399bf9)){throw new db[(_0x82b2('0x5b'))][(_0x82b2('0x52'))]('Plugin\x20not\x20found');}return _0x238cd3[_0x82b2('0x49')](_0x399bf9,util[_0x82b2('0x4c')](_0x82b2('0x4d'),path[_0x82b2('0x56')](_0x1cfc03[_0x82b2('0x5')])),function(_0x56f2ab){if(_0x56f2ab){throw new db[(_0x82b2('0x5b'))]['Error'](_0x82b2('0x5c'));}fs['unlinkSync'](_0x399bf9);logger[_0x82b2('0x5d')]('Download\x20completed');logger[_0x82b2('0x5d')](_0x82b2('0x5e'));});});}return null;})[_0x82b2('0x46')](handleError(_0x238cd3,null));};exports[_0x82b2('0x5f')]=function(_0x434f74,_0x1c0d53,_0x3eeabe){var _0x50cd99=path[_0x82b2('0x56')](_0x434f74[_0x82b2('0x60')][_0x82b2('0x61')],path['extname'](_0x434f74[_0x82b2('0x60')]['filename']));var _0x162b02=path[_0x82b2('0x4a')](config[_0x82b2('0x62')],'server/files/plugins',_0x434f74[_0x82b2('0x60')][_0x82b2('0x61')]);var _0x160048=path[_0x82b2('0x4a')](config['root'],_0x82b2('0x4b'),_0x50cd99);logger[_0x82b2('0x5d')](_0x82b2('0x63'),_0x162b02);logger[_0x82b2('0x5d')](_0x82b2('0x64'),_0x160048);try{fs['chmodSync'](_0x162b02,parseInt(_0x82b2('0x65'),0x8));extract(_0x162b02,{'dir':_0x160048},function(_0x256412){if(_0x256412){logger[_0x82b2('0x2a')](_0x256412);handleError(_0x256412,!![]);};var _0x161b42=fs[_0x82b2('0x66')](_0x160048);if(_0x161b42[_0x82b2('0x39')]>0x1){removeReferences(_0x162b02,_0x160048);logger['error'](_0x82b2('0x67'));return _0x3eeabe(new Error(_0x82b2('0x67')));}var _0x13130f=fs['lstatSync'](path[_0x82b2('0x4a')](_0x160048,_0x161b42[0x0]));if(_0x13130f[_0x82b2('0x68')]()){removeReferences(_0x162b02,_0x160048);logger[_0x82b2('0x2a')](_0x82b2('0x67'));return _0x3eeabe(new Error(_0x82b2('0x67')));}if(_0x13130f['isDirectory']()){var _0x2d1bb0=fs[_0x82b2('0x66')](path[_0x82b2('0x4a')](_0x160048,_0x161b42[0x0]));if(_0x2d1bb0[_0x82b2('0x39')]===0x0){removeReferences(_0x162b02,_0x160048);logger[_0x82b2('0x2a')](_0x82b2('0x67'));return _0x3eeabe(new Error(_0x82b2('0x67')));}var _0x423909=_0x2d1bb0[_0x82b2('0x69')](function(_0x4b1e79){return _0x4b1e79===_0x82b2('0x6a');});if(!_0x423909){return _0x3eeabe(new Error('Plugin\x20manifest\x20missing'));}var _0x512573=fs[_0x82b2('0x6b')](path[_0x82b2('0x4a')](_0x160048,_0x161b42[0x0],_0x82b2('0x6a')));var _0x5d29a6=JSON[_0x82b2('0x6c')](_0x512573);if(_0x82b2('0x6d')==typeof _0x5d29a6[_0x82b2('0x2c')]){return _0x3eeabe(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x5d29a6[_0x82b2('0x41')]){return _0x3eeabe(new Error(_0x82b2('0x6e')));}if(_0x82b2('0x6d')==typeof _0x5d29a6[_0x82b2('0x6f')]){return _0x3eeabe(new Error(_0x82b2('0x70')));}if(_0x82b2('0x6d')==typeof _0x5d29a6[_0x82b2('0x71')]){return _0x3eeabe(new Error(_0x82b2('0x72')));}if(_0x5d29a6[_0x82b2('0x41')]===_0x82b2('0x73')){if(_0x82b2('0x6d')==typeof _0x5d29a6['parameters']['views']){return _0x3eeabe(new Error(_0x82b2('0x74')));}if('undefined'==typeof _0x5d29a6[_0x82b2('0x71')]['views']['admin']&&_0x82b2('0x6d')==typeof _0x5d29a6[_0x82b2('0x71')][_0x82b2('0x75')][_0x82b2('0x76')]){return _0x3eeabe(new Error(_0x82b2('0x77')));}}else if(_0x5d29a6['type']===_0x82b2('0x78')){if(_0x82b2('0x6d')==typeof _0x5d29a6[_0x82b2('0x71')][_0x82b2('0x79')]){return _0x3eeabe(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x82b2('0x6d')==typeof _0x5d29a6['parameters'][_0x82b2('0x7a')]){return _0x3eeabe(new Error(_0x82b2('0x7b')));}}else{return _0x3eeabe(new Error(_0x82b2('0x7c')));}var _0x37f8cd=_0x5d29a6[_0x82b2('0x2c')];var _0x4de4bb=_0x5d29a6['description'];var _0x1591b6=_0x5d29a6[_0x82b2('0x41')];var _0x5f1ec3=_0x5d29a6[_0x82b2('0x7d')]?_0x5d29a6[_0x82b2('0x7d')]:_0x82b2('0x7e');var _0x4fa101=_0x5d29a6[_0x82b2('0x7f')]?_0x5d29a6['icon']:'icon-apps';var _0x45d281='';var _0x38470d='';var _0x5cfbc0='';var _0x4785bf='';var _0x34db15=_0x5d29a6['version'];if(_0x1591b6===_0x82b2('0x73')){if('undefined'!=typeof _0x5d29a6[_0x82b2('0x71')][_0x82b2('0x75')]['admin']){var _0x3d32f4=_0x5d29a6['parameters'][_0x82b2('0x75')][_0x82b2('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x82b2('0x81')](_0x3d32f4)){_0x45d281=path[_0x82b2('0x4a')](_0x82b2('0x82'),_0x50cd99,_0x161b42[0x0],_0x3d32f4);}else{_0x45d281=_0x3d32f4;}}else{logger[_0x82b2('0x5d')](_0x82b2('0x83'));}if(_0x82b2('0x6d')!=typeof _0x5d29a6['parameters'][_0x82b2('0x75')][_0x82b2('0x76')]){var _0x3a85e8=_0x5d29a6[_0x82b2('0x71')][_0x82b2('0x75')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x82b2('0x81')](_0x3a85e8)){_0x38470d=path[_0x82b2('0x4a')](_0x82b2('0x82'),_0x50cd99,_0x161b42[0x0],_0x3a85e8);}else{_0x38470d=_0x3a85e8;}}else{logger[_0x82b2('0x5d')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x1591b6===_0x82b2('0x78')){_0x5cfbc0=_0x5d29a6['parameters'][_0x82b2('0x79')];_0x4785bf=_0x5d29a6[_0x82b2('0x71')][_0x82b2('0x7a')];if('undefined'!=typeof _0x5d29a6['parameters'][_0x82b2('0x75')]){if('undefined'!=typeof _0x5d29a6[_0x82b2('0x71')]['views'][_0x82b2('0x80')]){var _0x3d32f4=_0x5d29a6['parameters'][_0x82b2('0x75')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x82b2('0x81')](_0x3d32f4)){_0x45d281=path[_0x82b2('0x4a')](_0x82b2('0x82'),_0x50cd99,_0x161b42[0x0],_0x3d32f4);}else{_0x45d281=_0x3d32f4;}}if('undefined'!=typeof _0x5d29a6[_0x82b2('0x71')][_0x82b2('0x75')][_0x82b2('0x76')]){var _0x3a85e8=_0x5d29a6[_0x82b2('0x71')][_0x82b2('0x75')][_0x82b2('0x76')];if(!/^(f|ht)tps?:\/\//i[_0x82b2('0x81')](_0x3a85e8)){_0x38470d=path[_0x82b2('0x4a')](_0x82b2('0x82'),_0x50cd99,_0x161b42[0x0],_0x3a85e8);}else{_0x38470d=_0x3a85e8;}}}}var _0x103568={'name':_0x37f8cd,'description':_0x4de4bb,'path':path[_0x82b2('0x4a')](_0x50cd99,_0x161b42[0x0]),'type':_0x1591b6,'sidebar':_0x5f1ec3,'icon':_0x4fa101,'adminUrl':_0x45d281,'agentUrl':_0x38470d,'scriptName':_0x5cfbc0,'scriptPath':_0x4785bf,'version':_0x34db15};removeReferences(_0x162b02,null);return db[_0x82b2('0x2f')][_0x82b2('0x84')](_0x103568)[_0x82b2('0x26')](function(_0x2fbba5){var _0x5a84a1={'role':_0x434f74[_0x82b2('0x85')][_0x82b2('0x86')],'userProfileId':_0x434f74[_0x82b2('0x85')]['userProfileId']};if(!_0x5a84a1)throw new Error(_0x82b2('0x87'));if(_0x5a84a1[_0x82b2('0x86')]===_0x82b2('0x88')){var _0x541497=_0x2fbba5[_0x82b2('0x27')]({'plain':!![]});return db[_0x82b2('0x89')]['find']({'where':{'name':'Plugins','userProfileId':_0x5a84a1[_0x82b2('0x8a')]},'raw':!![]})[_0x82b2('0x26')](function(_0x2ec953){if(_0x2ec953&&_0x2ec953[_0x82b2('0x8b')]===0x0){return db[_0x82b2('0x28')]['create']({'name':_0x541497['name'],'resourceId':_0x541497['id'],'type':_0x2ec953['name'],'sectionId':_0x2ec953['id']},{})[_0x82b2('0x26')](function(){return _0x2fbba5;});}else{return _0x2fbba5;}})[_0x82b2('0x46')](function(_0x13eb72){logger[_0x82b2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13eb72);throw _0x13eb72;});}return _0x2fbba5;})[_0x82b2('0x26')](respondWithResult(_0x1c0d53,null))[_0x82b2('0x46')](handleError(_0x1c0d53,null));}});}catch(_0x93be4d){_0x1c0d53[_0x82b2('0x1f')](0x1f4)[_0x82b2('0x2d')](_0x93be4d);}};function removeReferences(_0x485cf1,_0x145119){try{if(_0x485cf1){fs[_0x82b2('0x8c')](_0x485cf1);logger[_0x82b2('0x5d')]('Zip\x20archive\x20removed');}if(_0x145119){rimraf(_0x145119,function(){});logger['info'](_0x82b2('0x8d'));}}catch(_0xb15675){logger['error'](_0xb15675);}}exports[_0x82b2('0x8e')]=function(_0x3b740f,_0x41425e,_0x52cd9f){return db[_0x82b2('0x2f')]['find']({'where':{'id':_0x3b740f[_0x82b2('0x47')]['id']}})[_0x82b2('0x26')](handleEntityNotFound(_0x41425e,null))[_0x82b2('0x26')](saveUpdates(_0x3b740f['body'],null))[_0x82b2('0x26')](respondWithResult(_0x41425e,null))['catch'](handleError(_0x41425e,null));};exports['delete']=function(_0x8896b8,_0x462db1,_0x8368c5){return db[_0x82b2('0x2f')][_0x82b2('0x48')]({'where':{'id':_0x8896b8['params']['id']}})[_0x82b2('0x26')](function(_0x3410e1){if(_0x3410e1){return _0x3410e1[_0x82b2('0x29')]();}})['then'](function(_0x4850c1){rimraf(path['join'](config[_0x82b2('0x62')],_0x82b2('0x4b'),path[_0x82b2('0x55')](_0x4850c1[_0x82b2('0x5')])),function(){});return _0x4850c1;})[_0x82b2('0x26')](handleEntityNotFound(_0x462db1,null))[_0x82b2('0x26')](respondWithStatusCode(_0x462db1,null))['catch'](handleError(_0x462db1,null));};exports[_0x82b2('0x8f')]=function(_0x5d1a95,_0x4dac7d,_0x400553){return BPromise[_0x82b2('0x90')]()['then'](function(){if(!_0x5d1a95['query'][_0x82b2('0x5')]){throw new Error(_0x82b2('0x91'));}if(!_0x5d1a95[_0x82b2('0x32')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x38065f=_0x5d1a95[_0x82b2('0x32')][_0x82b2('0x92')]?_0x5d1a95['query'][_0x82b2('0x92')]+':'+_0x5d1a95[_0x82b2('0x32')]['port']:_0x82b2('0x93')+_0x5d1a95[_0x82b2('0x32')]['port'];var _0x312235=_0x5d1a95[_0x82b2('0x32')]['json']?_0x5d1a95[_0x82b2('0x32')]['json']:!![];var _0x38d81a=_0x5d1a95[_0x82b2('0x32')][_0x82b2('0x94')]?_0x5d1a95[_0x82b2('0x32')][_0x82b2('0x94')]:null;var _0x25af79={'method':_0x5d1a95[_0x82b2('0x95')],'uri':util['format'](_0x82b2('0x96'),_0x38065f,_0x5d1a95[_0x82b2('0x32')][_0x82b2('0x5')]),'json':_0x312235,'resolveWithFullResponse':!![],'encoding':_0x38d81a,'qs':_0x5d1a95[_0x82b2('0x32')]};if(_0x5d1a95[_0x82b2('0x97')]){_0x25af79['headers']=_0x5d1a95[_0x82b2('0x97')];if(_0x25af79['headers']['content-length']){delete _0x25af79[_0x82b2('0x97')][_0x82b2('0x98')];}}if(_0x25af79[_0x82b2('0x97')][_0x82b2('0x99')]){delete _0x25af79['headers'][_0x82b2('0x99')];}return rp(_0x25af79);})[_0x82b2('0x26')](function(_0x32ebda){if(_0x32ebda){_0x4dac7d[_0x82b2('0x23')](_0x32ebda[_0x82b2('0x97')]);logger['info'](_0x32ebda['body']);if(_['endsWith'](_0x5d1a95['query'][_0x82b2('0x5')],'download')&&_0x32ebda['statusCode']==0x1f4){return _0x4dac7d[_0x82b2('0x1e')](_0x32ebda[_0x82b2('0x9a')]);}else{return _0x4dac7d['status'](_0x32ebda[_0x82b2('0x9a')])[_0x82b2('0x2d')](_0x32ebda[_0x82b2('0x85')]);}}else{return _0x4dac7d['sendStatus'](0xc8);}})[_0x82b2('0x46')](handleError(_0x4dac7d,null));};exports[_0x82b2('0x9b')]=function(_0x2b0fff,_0x4255f8,_0x32b682){return BPromise[_0x82b2('0x90')]()[_0x82b2('0x26')](function(){if(!_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x5')]){throw new Error(_0x82b2('0x91'));}if(!_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x9c')]){throw new Error(_0x82b2('0x9d'));}var _0x4e0348=_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x92')]?_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x92')]+':'+_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x9c')]:'http://localhost:'+_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x9c')];var _0x31dccd=_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x25')]?_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x25')]:!![];var _0x38a907=_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x94')]?_0x2b0fff[_0x82b2('0x32')][_0x82b2('0x94')]:null;var _0x250332={'method':_0x2b0fff['method'],'uri':util[_0x82b2('0x4c')]('%s%s',_0x4e0348,_0x2b0fff[_0x82b2('0x32')]['path']),'json':_0x31dccd,'resolveWithFullResponse':!![],'encoding':_0x38a907,'body':_0x2b0fff['body']};if(_0x2b0fff['headers']){_0x250332[_0x82b2('0x97')]=_0x2b0fff[_0x82b2('0x97')];if(_0x250332[_0x82b2('0x97')][_0x82b2('0x98')]){delete _0x250332[_0x82b2('0x97')][_0x82b2('0x98')];}}if(_0x250332[_0x82b2('0x97')][_0x82b2('0x99')]){delete _0x250332[_0x82b2('0x97')][_0x82b2('0x99')];}return rp(_0x250332);})[_0x82b2('0x26')](function(_0x2a692c){if(_0x2a692c){_0x4255f8[_0x82b2('0x23')](_0x2a692c[_0x82b2('0x97')]);logger['info'](_0x2a692c['body']);return _0x4255f8[_0x82b2('0x1f')](_0x2a692c[_0x82b2('0x9a')])[_0x82b2('0x2d')](_0x2a692c[_0x82b2('0x85')]);}else{return _0x4255f8[_0x82b2('0x1e')](0xc8);}})[_0x82b2('0x46')](handleError(_0x4255f8,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index b591590..5de1ae5 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 _0x7919=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7919,0xeb));var _0x9791=function(_0x1bf841,_0x3f90f8){_0x1bf841=_0x1bf841-0x0;var _0x5123ae=_0x7919[_0x1bf841];return _0x5123ae;};'use strict';var EventEmitter=require(_0x9791('0x0'));var Plugin=require(_0x9791('0x1'))['db'][_0x9791('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x9791('0x3')](0x0);var events={'afterCreate':_0x9791('0x4'),'afterUpdate':_0x9791('0x5'),'afterDestroy':_0x9791('0x6')};function emitEvent(_0x54b9c0){return function(_0x13a1a5,_0x193919,_0x4b484f){PluginEvents[_0x9791('0x7')](_0x54b9c0+':'+_0x13a1a5['id'],_0x13a1a5);PluginEvents[_0x9791('0x7')](_0x54b9c0,_0x13a1a5);_0x4b484f(null);};}for(var e in events){if(events[_0x9791('0x8')](e)){var event=events[e];Plugin[_0x9791('0x9')](e,emitEvent(event));}}module[_0x9791('0xa')]=PluginEvents; \ No newline at end of file +var _0xbeea=['emit','exports','events','Plugin','setMaxListeners','save','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbeea,0xb1));var _0xabee=function(_0x44068d,_0x32310a){_0x44068d=_0x44068d-0x0;var _0x208dd7=_0xbeea[_0x44068d];return _0x208dd7;};'use strict';var EventEmitter=require(_0xabee('0x0'));var Plugin=require('../../mysqldb')['db'][_0xabee('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xabee('0x2')](0x0);var events={'afterCreate':_0xabee('0x3'),'afterUpdate':'update','afterDestroy':_0xabee('0x4')};function emitEvent(_0x59e264){return function(_0x58afa7,_0x33571e,_0x2fb6d9){PluginEvents[_0xabee('0x5')](_0x59e264+':'+_0x58afa7['id'],_0x58afa7);PluginEvents[_0xabee('0x5')](_0x59e264,_0x58afa7);_0x2fb6d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xabee('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 9fd97c6..b598b64 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 _0xceb1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','api'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xceb1,0x10a));var _0x1ceb=function(_0x579ce2,_0x1d01bc){_0x579ce2=_0x579ce2-0x0;var _0x32df33=_0xceb1[_0x579ce2];return _0x32df33;};'use strict';var _=require(_0x1ceb('0x0'));var util=require(_0x1ceb('0x1'));var logger=require(_0x1ceb('0x2'))(_0x1ceb('0x3'));var moment=require(_0x1ceb('0x4'));var BPromise=require(_0x1ceb('0x5'));var rp=require(_0x1ceb('0x6'));var fs=require('fs');var path=require(_0x1ceb('0x7'));var rimraf=require(_0x1ceb('0x8'));var config=require(_0x1ceb('0x9'));var attributes=require(_0x1ceb('0xa'));module[_0x1ceb('0xb')]=function(_0x3e49e3,_0x1c0515){return _0x3e49e3[_0x1ceb('0xc')](_0x1ceb('0xd'),attributes,{'tableName':_0x1ceb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91f4=['exports','define','plugins','util','bluebird','path'];(function(_0x3d856e,_0x4e22a1){var _0x2b1aa4=function(_0x32d10b){while(--_0x32d10b){_0x3d856e['push'](_0x3d856e['shift']());}};_0x2b1aa4(++_0x4e22a1);}(_0x91f4,0xc9));var _0x491f=function(_0x39cc0c,_0x18786f){_0x39cc0c=_0x39cc0c-0x0;var _0x15691b=_0x91f4[_0x39cc0c];return _0x15691b;};'use strict';var _=require('lodash');var util=require(_0x491f('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x491f('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x491f('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x491f('0x3')]=function(_0x54d45c,_0x37df6a){return _0x54d45c[_0x491f('0x4')]('Plugin',attributes,{'tableName':_0x491f('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 482f82a..f7f407b 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 _0x9813=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','Plugin','create','body','options','raw','CreatePlugin','lodash','util','moment','bluebird','randomstring'];(function(_0x43018e,_0x19e301){var _0x3be1af=function(_0x3df6ce){while(--_0x3df6ce){_0x43018e['push'](_0x43018e['shift']());}};_0x3be1af(++_0x19e301);}(_0x9813,0x112));var _0x3981=function(_0x4a77e4,_0x556f71){_0x4a77e4=_0x4a77e4-0x0;var _0x1c68d8=_0x9813[_0x4a77e4];return _0x1c68d8;};'use strict';var _=require(_0x3981('0x0'));var util=require(_0x3981('0x1'));var moment=require(_0x3981('0x2'));var BPromise=require(_0x3981('0x3'));var rs=require(_0x3981('0x4'));var fs=require('fs');var Redis=require(_0x3981('0x5'));var db=require(_0x3981('0x6'))['db'];var utils=require(_0x3981('0x7'));var logger=require('../../config/logger')(_0x3981('0x8'));var config=require(_0x3981('0x9'));var jayson=require(_0x3981('0xa'));var client=jayson[_0x3981('0xb')]['http']({'port':0x232a});config[_0x3981('0xc')]=_['defaults'](config[_0x3981('0xc')],{'host':_0x3981('0xd'),'port':0x18eb});var socket=require(_0x3981('0xe'))(new Redis(config[_0x3981('0xc')]));require(_0x3981('0xf'))[_0x3981('0x10')](socket);function respondWithRpcPromise(_0x39c4e1,_0x1dbb62,_0x3eaea3){return new BPromise(function(_0x36e4f9,_0x2199d8){return client['request'](_0x39c4e1,_0x3eaea3)[_0x3981('0x11')](function(_0x479ef9){logger[_0x3981('0x12')](_0x3981('0x13'),_0x1dbb62,_0x3981('0x14'));logger[_0x3981('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x1dbb62,_0x3981('0x14'),JSON[_0x3981('0x16')](_0x479ef9));if(_0x479ef9[_0x3981('0x17')]){if(_0x479ef9[_0x3981('0x17')]['code']===0x1f4){logger[_0x3981('0x17')](_0x3981('0x13'),_0x1dbb62,_0x479ef9['error'][_0x3981('0x18')]);return _0x2199d8(_0x479ef9[_0x3981('0x17')][_0x3981('0x18')]);}logger[_0x3981('0x17')](_0x3981('0x13'),_0x1dbb62,_0x479ef9[_0x3981('0x17')][_0x3981('0x18')]);return _0x36e4f9(_0x479ef9[_0x3981('0x17')]['message']);}else{logger[_0x3981('0x12')]('Plugin,\x20%s,\x20%s',_0x1dbb62,'request\x20sent');_0x36e4f9(_0x479ef9['result'][_0x3981('0x18')]);}})['catch'](function(_0x5b7350){logger[_0x3981('0x17')](_0x3981('0x13'),_0x1dbb62,_0x5b7350);_0x2199d8(_0x5b7350);});});}exports['CreatePlugin']=function(_0x13a57e){var _0x119419=this;return new Promise(function(_0x2305f6,_0x4fd294){return db[_0x3981('0x19')][_0x3981('0x1a')](_0x13a57e[_0x3981('0x1b')],{'raw':_0x13a57e['options']?_0x13a57e[_0x3981('0x1c')][_0x3981('0x1d')]===undefined?!![]:![]:!![]})[_0x3981('0x11')](function(_0x4e5d5d){logger['info'](_0x3981('0x1e'),_0x13a57e);logger[_0x3981('0x15')](_0x3981('0x1e'),_0x13a57e,JSON['stringify'](_0x4e5d5d));_0x2305f6(_0x4e5d5d);})['catch'](function(_0x5e0707){logger[_0x3981('0x17')](_0x3981('0x1e'),_0x5e0707[_0x3981('0x18')],_0x13a57e);_0x4fd294(_0x119419[_0x3981('0x17')](0x1f4,_0x5e0707['message']));});});}; \ No newline at end of file +var _0x413f=['http','defaults','redis','localhost','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','CreatePlugin','Plugin','create','body','options','raw','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x6095cd,_0x4ee7a3){var _0x227728=function(_0x1538a9){while(--_0x1538a9){_0x6095cd['push'](_0x6095cd['shift']());}};_0x227728(++_0x4ee7a3);}(_0x413f,0xd7));var _0xf413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x413f[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xf413('0x0'));var moment=require(_0xf413('0x1'));var BPromise=require(_0xf413('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf413('0x3'));var db=require(_0xf413('0x4'))['db'];var utils=require(_0xf413('0x5'));var logger=require('../../config/logger')(_0xf413('0x6'));var config=require(_0xf413('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf413('0x8')][_0xf413('0x9')]({'port':0x232a});config['redis']=_[_0xf413('0xa')](config[_0xf413('0xb')],{'host':_0xf413('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf413('0xb')]));require('./plugin.socket')[_0xf413('0xd')](socket);function respondWithRpcPromise(_0x4335d8,_0xbcd42a,_0x1d27c5){return new BPromise(function(_0x1deaad,_0x524fe9){return client[_0xf413('0xe')](_0x4335d8,_0x1d27c5)[_0xf413('0xf')](function(_0x3f4113){logger[_0xf413('0x10')](_0xf413('0x11'),_0xbcd42a,_0xf413('0x12'));logger[_0xf413('0x13')](_0xf413('0x14'),_0xbcd42a,'request\x20sent',JSON['stringify'](_0x3f4113));if(_0x3f4113[_0xf413('0x15')]){if(_0x3f4113['error'][_0xf413('0x16')]===0x1f4){logger[_0xf413('0x15')](_0xf413('0x11'),_0xbcd42a,_0x3f4113[_0xf413('0x15')][_0xf413('0x17')]);return _0x524fe9(_0x3f4113['error'][_0xf413('0x17')]);}logger[_0xf413('0x15')]('Plugin,\x20%s,\x20%s',_0xbcd42a,_0x3f4113[_0xf413('0x15')]['message']);return _0x1deaad(_0x3f4113['error']['message']);}else{logger[_0xf413('0x10')](_0xf413('0x11'),_0xbcd42a,_0xf413('0x12'));_0x1deaad(_0x3f4113[_0xf413('0x18')][_0xf413('0x17')]);}})['catch'](function(_0x3586c7){logger['error'](_0xf413('0x11'),_0xbcd42a,_0x3586c7);_0x524fe9(_0x3586c7);});});}exports[_0xf413('0x19')]=function(_0x40632e){var _0x44754a=this;return new Promise(function(_0x3fdf2d,_0xfe3ae4){return db[_0xf413('0x1a')][_0xf413('0x1b')](_0x40632e[_0xf413('0x1c')],{'raw':_0x40632e[_0xf413('0x1d')]?_0x40632e[_0xf413('0x1d')][_0xf413('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x51a8e){logger['info'](_0xf413('0x19'),_0x40632e);logger[_0xf413('0x13')](_0xf413('0x19'),_0x40632e,JSON['stringify'](_0x51a8e));_0x3fdf2d(_0x51a8e);})[_0xf413('0x1f')](function(_0x5d1ef6){logger['error']('CreatePlugin',_0x5d1ef6[_0xf413('0x17')],_0x40632e);_0xfe3ae4(_0x44754a['error'](0x1f4,_0x5d1ef6['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 2ed00c1..cd11260 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 _0x1d34=['save','remove','removeListener','register','plugin:','./plugin.events'];(function(_0x8b9662,_0x5137e3){var _0xab92ed=function(_0x13fc7f){while(--_0x13fc7f){_0x8b9662['push'](_0x8b9662['shift']());}};_0xab92ed(++_0x5137e3);}(_0x1d34,0x7d));var _0x41d3=function(_0x30fff6,_0xaa8715){_0x30fff6=_0x30fff6-0x0;var _0x5c147b=_0x1d34[_0x30fff6];return _0x5c147b;};'use strict';var PluginEvents=require(_0x41d3('0x0'));var events=[_0x41d3('0x1'),_0x41d3('0x2'),'update'];function createListener(_0x3a6faa,_0x216d4c){return function(_0x2098bf){_0x216d4c['emit'](_0x3a6faa,_0x2098bf);};}function removeListener(_0x59037c,_0x46ce24){return function(){PluginEvents[_0x41d3('0x3')](_0x59037c,_0x46ce24);};}exports[_0x41d3('0x4')]=function(_0xb199cd){for(var _0x54bd24=0x0,_0x24f9be=events['length'];_0x54bd24<_0x24f9be;_0x54bd24++){var _0x186da3=events[_0x54bd24];var _0x16c187=createListener(_0x41d3('0x5')+_0x186da3,_0xb199cd);PluginEvents['on'](_0x186da3,_0x16c187);}}; \ No newline at end of file +var _0x9ed8=['remove','register','plugin:','./plugin.events','save'];(function(_0x2d26b6,_0x4c560e){var _0x4ee601=function(_0x2ad07d){while(--_0x2ad07d){_0x2d26b6['push'](_0x2d26b6['shift']());}};_0x4ee601(++_0x4c560e);}(_0x9ed8,0xda));var _0x89ed=function(_0x1a286b,_0x5ac202){_0x1a286b=_0x1a286b-0x0;var _0x59021d=_0x9ed8[_0x1a286b];return _0x59021d;};'use strict';var PluginEvents=require(_0x89ed('0x0'));var events=[_0x89ed('0x1'),_0x89ed('0x2'),'update'];function createListener(_0x2fae1d,_0x549ae4){return function(_0x51b1f3){_0x549ae4['emit'](_0x2fae1d,_0x51b1f3);};}function removeListener(_0x5bae4b,_0x687a8e){return function(){PluginEvents['removeListener'](_0x5bae4b,_0x687a8e);};}exports[_0x89ed('0x3')]=function(_0x2fb03f){for(var _0xc6e70c=0x0,_0x26d952=events['length'];_0xc6e70c<_0x26d952;_0xc6e70c++){var _0x20daea=events[_0xc6e70c];var _0x1d4c87=createListener(_0x89ed('0x4')+_0x20daea,_0x2fb03f);PluginEvents['on'](_0x20daea,_0x1d4c87);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index b1eba5f..384ff0b 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(_0x165055,_0x25440a){var _0x285076=function(_0xb87790){while(--_0xb87790){_0x165055['push'](_0x165055['shift']());}};_0x285076(++_0x25440a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x102fc6,_0x19d7ee){var _0x290711=function(_0x1777bf){while(--_0x1777bf){_0x102fc6['push'](_0x102fc6['shift']());}};_0x290711(++_0x19d7ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 9a43753..e9d96de 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 _0x5ff3=['Unknown\x20id','../../config/pm2','api','child_process','exec','bluebird','sendStatus','json','error','name','status','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','delete'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x5ff3,0x17d));var _0x35ff=function(_0x20f111,_0x2624bb){_0x20f111=_0x20f111-0x0;var _0x54c06e=_0x5ff3[_0x20f111];return _0x54c06e;};'use strict';var _=require('lodash');var pm2=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var path=require('path');var exec=require(_0x35ff('0x2'))[_0x35ff('0x3')];var BPromise=require(_0x35ff('0x4'));function handleEntityNotFound(_0xd0846d,_0x551514){return function(_0x2fcb74){if(!_0x2fcb74){_0xd0846d[_0x35ff('0x5')](0x194);;}return _0x2fcb74;};}function respondWithResult(_0x2e9873,_0x11e738){_0x11e738=_0x11e738||0xc8;return function(_0x30c3ff){if(_0x30c3ff){return _0x2e9873['status'](_0x11e738)[_0x35ff('0x6')](_0x30c3ff);}return null;};}function handleError(_0x4c9fab,_0x2e7470){_0x2e7470=_0x2e7470||0x1f4;return function(_0xfcec34){logger[_0x35ff('0x7')](_0xfcec34['stack']);if(_0xfcec34[_0x35ff('0x8')]){delete _0xfcec34['name'];}_0x4c9fab[_0x35ff('0x9')](_0x2e7470)[_0x35ff('0xa')](_0xfcec34);};}function execChildProcess(){return new BPromise(function(_0x57ad20,_0x5c3131){exec(_0x35ff('0xb'),function(_0x574c81,_0x592295,_0x567080){logger[_0x35ff('0xc')](_0x592295);logger[_0x35ff('0xc')](_0x567080);if(_0x574c81){logger[_0x35ff('0x7')](_0x574c81);return _0x5c3131(_0x574c81);}return _0x57ad20(_0x592295);});});}exports[_0x35ff('0xd')]=function(_0x559e33,_0x33154f){return pm2[_0x35ff('0xe')]()[_0x35ff('0xf')](function(_0x4d1d41){if(_0x4d1d41){var _0xff8ac=_[_0x35ff('0x10')](_0x4d1d41,function(_0x254975){return _0x254975[_0x35ff('0x8')]===_0x35ff('0x11')||_0x254975[_0x35ff('0x8')]===_0x35ff('0x12');});return{'rows':_0xff8ac,'count':_0xff8ac[_0x35ff('0x13')]};}return null;})[_0x35ff('0xf')](respondWithResult(_0x33154f,null))[_0x35ff('0x14')](handleError(_0x33154f,null));};exports[_0x35ff('0x15')]=function(_0x3430e2,_0x37ea06){return pm2[_0x35ff('0x16')](_0x3430e2[_0x35ff('0x17')]['id'])['then'](respondWithResult(_0x37ea06,null))[_0x35ff('0xf')](handleEntityNotFound(_0x37ea06,null))[_0x35ff('0x14')](handleError(_0x37ea06,null));};exports[_0x35ff('0x18')]=function(_0x1c0d8c,_0x567bcb){if(_0x1c0d8c['body'][_0x35ff('0x8')]&&_0x1c0d8c[_0x35ff('0x19')]['script']){var _0x238f65=path[_0x35ff('0x1a')](__dirname,_0x35ff('0x1b'),_0x1c0d8c[_0x35ff('0x19')]['script']);var _0x3d60b4=process['cwd']();process[_0x35ff('0x1c')](path[_0x35ff('0x1d')](_0x238f65));return execChildProcess()[_0x35ff('0xf')](function(_0x16a5a0){process[_0x35ff('0x1c')](_0x3d60b4);return pm2[_0x35ff('0x1e')]({'name':_0x1c0d8c[_0x35ff('0x19')]['name'],'script':_0x238f65});})[_0x35ff('0xf')](function(_0x2ffcb){pm2['dump']();return _0x2ffcb[0x0];})[_0x35ff('0xf')](respondWithResult(_0x567bcb,0xc9))['catch'](handleError(_0x567bcb,null));}else{return _0x567bcb['status'](0x1f4)[_0x35ff('0xa')]({'message':_0x35ff('0x1f')});}};exports[_0x35ff('0x20')]=function(_0x11a5eb,_0x302d5a){if(_0x11a5eb['body']['id']){delete _0x11a5eb[_0x35ff('0x19')]['id'];}var _0x412873={'online':_0x35ff('0x21'),'stopped':'stop'};if(_0x412873[_0x35ff('0x22')](_0x11a5eb[_0x35ff('0x19')][_0x35ff('0x9')])){return pm2[_0x412873[_0x11a5eb[_0x35ff('0x19')][_0x35ff('0x9')]]](_0x11a5eb[_0x35ff('0x17')]['id'])[_0x35ff('0xf')](respondWithResult(_0x302d5a,0xc8))[_0x35ff('0x14')](handleError(_0x302d5a,null));}else{return _0x302d5a[_0x35ff('0x9')](0x1f4)['send']({'message':_0x35ff('0x23')});}};exports['destroy']=function(_0x1cb370,_0x257501){if(_0x1cb370[_0x35ff('0x19')]['id']){delete _0x1cb370[_0x35ff('0x19')]['id'];}if(_0x1cb370['params']['id']){return pm2[_0x35ff('0x24')](_0x1cb370['params']['id'])[_0x35ff('0xf')](function(_0xf88865){pm2['dump']();return _0xf88865[0x0];})['then'](respondWithResult(_0x257501,null))[_0x35ff('0x14')](handleError(_0x257501,null));}else{return _0x257501[_0x35ff('0x9')](0x1f4)['send']({'message':_0x35ff('0x25')});}}; \ No newline at end of file +var _0x16d2=['cwd','chdir','start','dump','update','stop','send','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','index','list','express','motion2','length','then','catch','show','params','create','body','script','join'];(function(_0x49e0f7,_0xc274c3){var _0x5b54cf=function(_0x533982){while(--_0x533982){_0x49e0f7['push'](_0x49e0f7['shift']());}};_0x5b54cf(++_0xc274c3);}(_0x16d2,0x123));var _0x216d=function(_0x5acaea,_0x442cb0){_0x5acaea=_0x5acaea-0x0;var _0x509dfa=_0x16d2[_0x5acaea];return _0x509dfa;};'use strict';var _=require(_0x216d('0x0'));var pm2=require(_0x216d('0x1'));var logger=require(_0x216d('0x2'))(_0x216d('0x3'));var path=require(_0x216d('0x4'));var exec=require(_0x216d('0x5'))[_0x216d('0x6')];var BPromise=require(_0x216d('0x7'));function handleEntityNotFound(_0xfd7306,_0x593bb0){return function(_0x2c662d){if(!_0x2c662d){_0xfd7306[_0x216d('0x8')](0x194);;}return _0x2c662d;};}function respondWithResult(_0xef687c,_0x205101){_0x205101=_0x205101||0xc8;return function(_0x1dd8e2){if(_0x1dd8e2){return _0xef687c[_0x216d('0x9')](_0x205101)[_0x216d('0xa')](_0x1dd8e2);}return null;};}function handleError(_0x28da14,_0x57accc){_0x57accc=_0x57accc||0x1f4;return function(_0x22c7b3){logger[_0x216d('0xb')](_0x22c7b3[_0x216d('0xc')]);if(_0x22c7b3[_0x216d('0xd')]){delete _0x22c7b3[_0x216d('0xd')];}_0x28da14[_0x216d('0x9')](_0x57accc)['send'](_0x22c7b3);};}function execChildProcess(){return new BPromise(function(_0x7ca9c9,_0x50db30){exec(_0x216d('0xe'),function(_0x2e02ce,_0x332e30,_0x398970){logger[_0x216d('0xf')](_0x332e30);logger[_0x216d('0xf')](_0x398970);if(_0x2e02ce){logger['error'](_0x2e02ce);return _0x50db30(_0x2e02ce);}return _0x7ca9c9(_0x332e30);});});}exports[_0x216d('0x10')]=function(_0x4c07d0,_0x271bb1){return pm2[_0x216d('0x11')]()['then'](function(_0x165c19){if(_0x165c19){var _0x322e4b=_['reject'](_0x165c19,function(_0x1b3215){return _0x1b3215['name']===_0x216d('0x12')||_0x1b3215[_0x216d('0xd')]===_0x216d('0x13');});return{'rows':_0x322e4b,'count':_0x322e4b[_0x216d('0x14')]};}return null;})[_0x216d('0x15')](respondWithResult(_0x271bb1,null))[_0x216d('0x16')](handleError(_0x271bb1,null));};exports[_0x216d('0x17')]=function(_0x1496fe,_0x19fdac){return pm2['describe'](_0x1496fe[_0x216d('0x18')]['id'])['then'](respondWithResult(_0x19fdac,null))['then'](handleEntityNotFound(_0x19fdac,null))[_0x216d('0x16')](handleError(_0x19fdac,null));};exports[_0x216d('0x19')]=function(_0x574758,_0x3f32e0){if(_0x574758[_0x216d('0x1a')]['name']&&_0x574758[_0x216d('0x1a')][_0x216d('0x1b')]){var _0x430e81=path[_0x216d('0x1c')](__dirname,'../../files/plugins',_0x574758[_0x216d('0x1a')][_0x216d('0x1b')]);var _0x10f299=process[_0x216d('0x1d')]();process[_0x216d('0x1e')](path['dirname'](_0x430e81));return execChildProcess()[_0x216d('0x15')](function(_0x1bd4db){process[_0x216d('0x1e')](_0x10f299);return pm2[_0x216d('0x1f')]({'name':_0x574758[_0x216d('0x1a')]['name'],'script':_0x430e81});})[_0x216d('0x15')](function(_0xab672){pm2[_0x216d('0x20')]();return _0xab672[0x0];})['then'](respondWithResult(_0x3f32e0,0xc9))['catch'](handleError(_0x3f32e0,null));}else{return _0x3f32e0['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x216d('0x21')]=function(_0x470d8a,_0x189413){if(_0x470d8a[_0x216d('0x1a')]['id']){delete _0x470d8a[_0x216d('0x1a')]['id'];}var _0x47fa6d={'online':'restart','stopped':_0x216d('0x22')};if(_0x47fa6d['hasOwnProperty'](_0x470d8a[_0x216d('0x1a')][_0x216d('0x9')])){return pm2[_0x47fa6d[_0x470d8a[_0x216d('0x1a')][_0x216d('0x9')]]](_0x470d8a[_0x216d('0x18')]['id'])[_0x216d('0x15')](respondWithResult(_0x189413,0xc8))[_0x216d('0x16')](handleError(_0x189413,null));}else{return _0x189413[_0x216d('0x9')](0x1f4)[_0x216d('0x23')]({'message':_0x216d('0x24')});}};exports[_0x216d('0x25')]=function(_0x260134,_0x4537fd){if(_0x260134['body']['id']){delete _0x260134[_0x216d('0x1a')]['id'];}if(_0x260134[_0x216d('0x18')]['id']){return pm2[_0x216d('0x26')](_0x260134['params']['id'])[_0x216d('0x15')](function(_0x1743ee){pm2[_0x216d('0x20')]();return _0x1743ee[0x0];})[_0x216d('0x15')](respondWithResult(_0x4537fd,null))['catch'](handleError(_0x4537fd,null));}else{return _0x4537fd[_0x216d('0x9')](0x1f4)[_0x216d('0x23')]({'message':_0x216d('0x27')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e728c70..86b2650 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 _0x0358=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues','express','Router'];(function(_0x187718,_0x427383){var _0x29ddf4=function(_0x2ec62a){while(--_0x2ec62a){_0x187718['push'](_0x187718['shift']());}};_0x29ddf4(++_0x427383);}(_0x0358,0x184));var _0x8035=function(_0x5eb625,_0xc09dbf){_0x5eb625=_0x5eb625-0x0;var _0x4e9462=_0x0358[_0x5eb625];return _0x4e9462;};'use strict';var express=require(_0x8035('0x0'));var router=express[_0x8035('0x1')]();var auth=require(_0x8035('0x2'));var controller=require(_0x8035('0x3'));router[_0x8035('0x4')](_0x8035('0x5'),auth[_0x8035('0x6')](),controller[_0x8035('0x7')]);router[_0x8035('0x4')](_0x8035('0x8'),auth['isAuthenticated'](),controller[_0x8035('0x9')]);module['exports']=router; \ No newline at end of file +var _0xb119=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','express','Router'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0xb119,0x73));var _0x9b11=function(_0x39dceb,_0x260486){_0x39dceb=_0x39dceb-0x0;var _0x5a3d9d=_0xb119[_0x39dceb];return _0x5a3d9d;};'use strict';var express=require(_0x9b11('0x0'));var router=express[_0x9b11('0x1')]();var auth=require(_0x9b11('0x2'));var controller=require(_0x9b11('0x3'));router[_0x9b11('0x4')](_0x9b11('0x5'),auth[_0x9b11('0x6')](),controller[_0x9b11('0x7')]);router[_0x9b11('0x4')](_0x9b11('0x8'),auth[_0x9b11('0x6')](),controller['getQueues']);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 213ad9b..bbc7bfa 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 _0x48b0=['getChannels','includes','Invalid\x20channel','toLowerCase','getAgents','globalQueueFilter','globalStatusFilter','query','pauseTypeFilter','*pause','resolve','channel','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','rawAttributes','fieldName','key','role','agent','raw','literal','forEach','user','userProfileId','Agents','assign','getResources','rows','filterAgentAttributes','getAgentStatus','pause','Status','sortAgentsByStatus','Queue','getOptions','type','QueueCampaigns','findAndCountAll','all','util','lodash','../../components/realtime/agents','../../config/utils','../../config/logger','../../mysqldb','client','http','offset','undefined','limit','count','Content-Range','json','error','name','status','send','request','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','VoiceQueuesChannels','then','result','loggedIn','available','waiting','talking','paused','voice','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','map','agents','loggedInDb','find','merge','pick','filter','queue','busy','getMembers','UserId','accountcode','online','voiceStatus','User','Pause','findAll','QueueId','length'];(function(_0xbb47ab,_0x489a9a){var _0x2a2e48=function(_0x4ea51e){while(--_0x4ea51e){_0xbb47ab['push'](_0xbb47ab['shift']());}};_0x2a2e48(++_0x489a9a);}(_0x48b0,0x187));var _0x048b=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x48b0[_0xfae23b];return _0x200640;};'use strict';var util=require(_0x048b('0x0'));var _=require(_0x048b('0x1'));var jayson=require('jayson/promise');var rta=require(_0x048b('0x2'));var qs=require('../../components/parsers/qs');var utils=require(_0x048b('0x3'));var logger=require(_0x048b('0x4'))('api');var db=require(_0x048b('0x5'))['db'];var amiClient=jayson[_0x048b('0x6')][_0x048b('0x7')]({'port':0x232a});var routingClient=jayson[_0x048b('0x6')]['http']({'port':0x232c});function respondWithFilteredResult(_0x2f9a37,_0x10c207){return function(_0x41ff08){if(_0x41ff08){var _0x172236=typeof _0x10c207[_0x048b('0x8')]===_0x048b('0x9')&&typeof _0x10c207[_0x048b('0xa')]===_0x048b('0x9');var _0x19d63e=_0x41ff08[_0x048b('0xb')];var _0x14ac18=_0x172236?0x0:_0x10c207['offset'];var _0x5d448a=_0x172236?_0x41ff08[_0x048b('0xb')]:_0x10c207[_0x048b('0x8')]+_0x10c207['limit'];var _0x4c2920;if(_0x5d448a>=_0x19d63e){_0x5d448a=_0x19d63e;_0x4c2920=0xc8;}else{_0x4c2920=0xce;}_0x2f9a37['status'](_0x4c2920);return _0x2f9a37['set'](_0x048b('0xc'),_0x14ac18+'-'+_0x5d448a+'/'+_0x19d63e)[_0x048b('0xd')](_0x41ff08);}return null;};}function handleError(_0x47741a,_0x398ce6){_0x398ce6=_0x398ce6||0x1f4;return function(_0x51cde6){logger[_0x048b('0xe')](_0x51cde6['stack']);if(_0x51cde6[_0x048b('0xf')]){delete _0x51cde6[_0x048b('0xf')];}_0x47741a[_0x048b('0x10')](_0x398ce6)[_0x048b('0x11')](_0x51cde6);};}function getRealtimeQueues(_0x2b169f,_0x186292){return new Promise(function(_0x344197,_0x674356){var _0x2d0797=_0x186292==='voice'?amiClient:routingClient;return _0x2d0797[_0x048b('0x12')](_[_0x048b('0x13')](_0x186292)+_0x048b('0x14'),_0x2b169f)['then'](function(_0x47094d){if(_0x47094d[_0x048b('0xe')])throw new Error(util[_0x048b('0x15')](_0x048b('0x16'),_0x186292));return _0x344197(_0x47094d['result']);})[_0x048b('0x17')](function(_0x203a7f){_0x674356(_0x203a7f);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x1d3b3d,_0x433b32){return amiClient[_0x048b('0x12')](_0x048b('0x18'),{})[_0x048b('0x19')](function(_0x70d62a){if(_0x70d62a[_0x048b('0xe')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x1d3b3d(_0x70d62a[_0x048b('0x1a')]);})['catch'](function(_0x122a25){_0x433b32(_0x122a25);});});}function initializeQueues(_0x518735,_0x42cd75,_0x5527fb,_0x46f09d){var _0xe7ea6d=[_0x048b('0x1b'),_0x048b('0x1c'),_0x048b('0x1d'),_0x048b('0x1e'),_0x048b('0x1f')];if(_0x5527fb===_0x048b('0x20')&&_0x46f09d===_0x048b('0x21')){_0xe7ea6d[_0x048b('0x22')](_0x048b('0x23'),_0x048b('0x24'),_0x048b('0x25'),_0x048b('0x26'),_0x048b('0x27'),_0x048b('0x28'),'startPredictive',_0x048b('0x29'),_0x048b('0x2a'),_0x048b('0x2b'),'erlangAbandonmentRate',_0x048b('0x2c'),_0x048b('0x2d'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x048b('0x2e'),'predictiveIntervalTotalCalls',_0x048b('0x2f'),'predictiveIntervalDroppedCallsTimeout',_0x048b('0x30'),'predictiveIntervalAvgHoldtime',_0x048b('0x31'));}return _0x518735[_0x048b('0x32')](function(_0x15168d){var _0x19d2b4=_0x15168d['get']({'plain':!![]});_0x19d2b4[_0x048b('0x33')]=[];_0x19d2b4[_0x048b('0x1f')]=0x0;_0x19d2b4[_0x048b('0x34')]=0x0;_0x19d2b4[_0x048b('0x1b')]=0x0;_0x19d2b4['available']=0x0;_0x19d2b4[_0x048b('0x1d')]=0x0;if(_0x5527fb===_0x048b('0x20')){_0x19d2b4['talking']=0x0;_0x19d2b4['busy']=0x0;if(_0x46f09d===_0x048b('0x21')){_0x19d2b4[_0x048b('0x23')]=0x0;_0x19d2b4[_0x048b('0x24')]=0x0;}}var _0x4f964c=_[_0x048b('0x35')](_0x42cd75,['id',_0x19d2b4['id']]);if(_0x4f964c)_[_0x048b('0x36')](_0x19d2b4,_[_0x048b('0x37')](_0x4f964c,_0xe7ea6d));return _0x19d2b4;});}function updateAgentVoiceStatus(_0x24126f,_0x5caa3d,_0x1179b8){var _0x3ad204=_[_0x048b('0x38')](_0x1179b8,[_0x048b('0x39'),_0x5caa3d['name']]);if(_0x3ad204['length']===0x0)return _0x24126f[_0x048b('0x3a')]=!![];if(_['some'](_0x3ad204,['connectedlinenum',_0x24126f['internal']['toString']()]))return _0x24126f['talking']=!![];if(!_0x24126f['talking'])return _0x24126f[_0x048b('0x3a')]=!![];}function getVoiceQueueAgents(_0x483370,_0x2bf81a,_0x31bd73,_0x3c923f){var _0x269645=_[_0x048b('0x35')](_0x2bf81a,['id',_0x483370['id']]);if(!_0x269645)return _0x483370;return _0x269645[_0x048b('0x3b')]({'raw':!![]})[_0x048b('0x19')](function(_0x1ee228){for(var _0x58e779=0x0;_0x58e779<_0x1ee228['length'];_0x58e779++){var _0x45bb71=_[_0x048b('0x35')](_0x31bd73,['id',_0x1ee228[_0x58e779][_0x048b('0x3c')]]);if(!_0x45bb71){_0x45bb71={'id':_0x1ee228[_0x58e779][_0x048b('0x3c')],'name':_0x1ee228[_0x58e779][_0x048b('0x3c')],'accountcode':'','online':![]};}var _0x27c1f6={'id':_0x45bb71['id'],'name':_0x45bb71[_0x048b('0xf')],'internal':_0x45bb71[_0x048b('0x3d')],'online':Boolean(_0x45bb71[_0x048b('0x3e')]),'paused':Boolean(_0x1ee228[_0x58e779][_0x048b('0x1f')])};if(_0x45bb71[_0x048b('0x3f')]===_0x048b('0x1e'))updateAgentVoiceStatus(_0x27c1f6,_0x483370,_0x3c923f);if(_0x27c1f6[_0x048b('0x3e')])_0x483370['loggedInDb']++;if(_0x27c1f6[_0x048b('0x3a')])_0x483370[_0x048b('0x3a')]++;if(_0x27c1f6[_0x048b('0x1f')]&&!_0x27c1f6[_0x048b('0x3a')]&&!_0x27c1f6[_0x048b('0x1e')])_0x483370[_0x048b('0x1f')]++;_0x483370[_0x048b('0x33')]['push'](_0x27c1f6);}return _0x483370;});}function getQueueAgents(_0x4f800a,_0x978ecd,_0x57a6f5){var _0x2d2718=_0x048b('0x40')+_[_0x048b('0x13')](_0x57a6f5)+'Queue';var _0x53e185=_0x57a6f5+_0x048b('0x41');return db[_0x2d2718][_0x048b('0x42')]({'where':{[_[_0x048b('0x13')](_0x57a6f5)+_0x048b('0x43')]:_0x4f800a['id']},'raw':!![]})[_0x048b('0x19')](function(_0x93b49e){for(var _0x4709f1=0x0;_0x4709f1<_0x93b49e[_0x048b('0x44')];_0x4709f1++){var _0x23a7b0=_[_0x048b('0x35')](_0x978ecd,['id',_0x93b49e[_0x4709f1][_0x048b('0x3c')]]);if(!_0x23a7b0){_0x23a7b0={'id':_0x93b49e[_0x4709f1][_0x048b('0x3c')],'name':_0x93b49e[_0x4709f1][_0x048b('0x3c')],'online':![],['pauseField']:![]};}var _0x96338={'id':_0x23a7b0['id'],'name':_0x23a7b0['name'],'online':Boolean(_0x23a7b0[_0x048b('0x3e')]),'paused':Boolean(_0x23a7b0[_0x53e185])};if(_0x96338['online'])_0x4f800a[_0x048b('0x34')]++;_0x4f800a[_0x048b('0x33')]['push'](_0x96338);}return _0x4f800a;});}function validateChannel(_0x5efbd8){var _0x58c34e=utils[_0x048b('0x45')]();if(!_[_0x048b('0x46')](_0x58c34e,_0x5efbd8['toLowerCase']()))throw new Error(_0x048b('0x47'));return _0x5efbd8[_0x048b('0x48')]();}exports[_0x048b('0x49')]=function(_0x4fbe47,_0x1a4aff){var _0x240deb={'count':0x0,'rows':[]};var _0x596803={};var _0x320ce2;var _0x292184;var _0x502a0f;var _0x44defd;var _0x69388b=utils[_0x048b('0x45')]();var _0x3e8f6e=_0x4fbe47['query'][_0x048b('0x4a')];var _0x18c618=_0x4fbe47['query'][_0x048b('0x4b')];var _0x1f774a=_0x4fbe47[_0x048b('0x4c')][_0x048b('0x4d')];var _0x52d52d=_0x18c618==='pause'||_0x18c618===_0x048b('0x4e')?!![]:![];var _0xa5881=[];var _0x19ddde;Promise[_0x048b('0x4f')]()['then'](function(){if(_0x4fbe47[_0x048b('0x4c')][_0x048b('0x50')]){_0x320ce2=validateChannel(_0x4fbe47[_0x048b('0x4c')]['channel']);}if(!_0x4fbe47['query'][_0x048b('0x51')]||!_0x4fbe47[_0x048b('0x4c')]['sort'][_0x048b('0x46')](_0x048b('0x52'))){_0x4fbe47[_0x048b('0x4c')]['sort']=rta[_0x048b('0x53')](_0x4fbe47['query'][_0x048b('0x51')]);return;}var _0x46b2d3=rta[_0x048b('0x54')](_0x4fbe47[_0x048b('0x4c')]['sort']);_0x4fbe47['query'][_0x048b('0x51')]=_0x46b2d3[_0x048b('0x55')]['join'](',');_0x292184=_0x46b2d3[_0x048b('0x56')];})['then'](function(){if(!_0x3e8f6e){return[];}return rta[_0x048b('0x57')](_0x3e8f6e,_0x320ce2);})['then'](function(_0x584212){_0xa5881=_0x584212;return rta[_0x048b('0x58')]();})[_0x048b('0x19')](function(_0x4dae93){_0x44defd=_0x4dae93['rows'];if((!_0x18c618||_0x52d52d)&&!_0x292184){return _0xa5881;}if(_0x292184&&!_0x18c618){return rta[_0x048b('0x59')](_0x44defd,_0xa5881,_0x292184);}else{return rta['getAgentIdsByStatus'](_0x44defd,_0xa5881,_0x18c618);}})[_0x048b('0x19')](function(_0x1416ef){_0xa5881=_0x1416ef;var _0x188598=![];if(_0xa5881['length']===0x0){if(_0x3e8f6e||_0x18c618){_0x188598=!![];}if(_0x52d52d){_0x188598=![];}}if(_0x188598){return _0x240deb;}var _0x354463=_['map'](db[_0x048b('0x40')][_0x048b('0x5a')],function(_0x4c0645){return{'name':_0x4c0645[_0x048b('0x5b')],'type':_0x4c0645['type'][_0x048b('0x5c')]};});_0x4fbe47['query'][_0x048b('0x5d')]=_0x048b('0x5e');_0x4fbe47[_0x048b('0x4c')][_0x048b('0x3e')]=!![];_0x596803=qs['getOptions'](_0x354463,_0x4fbe47);_0x596803[_0x048b('0x5f')]=!![];var _0x3518f7=[];if(_0xa5881[_0x048b('0x44')]>0x0){_0x3518f7[_0x048b('0x22')]({'id':{'$in':_0xa5881}});if(_0x292184&&!_0x18c618){_0x19ddde=[db['sequelize'][_0x048b('0x60')]('FIELD(id,'+_0xa5881+')')];_0x596803['order']=_0x19ddde;}}if(_0x52d52d){_0x69388b[_0x048b('0x61')](function(_0x426d1f){var _0x4247d6=!![];if(_0x18c618===_0x048b('0x4e')&&_0x320ce2!==_0x426d1f){_0x4247d6=![];}_0x3518f7['push']({[_0x426d1f+_0x048b('0x41')]:_0x4247d6});});if(_0x1f774a){_0x3518f7[_0x048b('0x22')]({'pauseType':_0x1f774a});}}else if(_0x18c618){_0x69388b[_0x048b('0x61')](function(_0x44e167){_0x3518f7[_0x048b('0x22')]({[_0x44e167+_0x048b('0x41')]:![]});});}_0x596803['where']=_[_0x048b('0x36')](_0x596803['where'],{'$and':_0x3518f7});if(_0x4fbe47[_0x048b('0x62')]['role']===_0x048b('0x62')){var _0x2c9324={'params':{'id':_0x4fbe47['user'][_0x048b('0x63')]},'query':{'section':_0x048b('0x64'),'role':'agent','online':!![],'raw':!![],'ids':_0xa5881,'customSorting':_0x19ddde}};if(_0x52d52d){_0x2c9324[_0x048b('0x4c')]['extraQueryConditions']=_0x3518f7;}_0x2c9324[_0x048b('0x4c')]=Object[_0x048b('0x65')](_0x2c9324[_0x048b('0x4c')],_0x4fbe47[_0x048b('0x4c')]);delete _0x2c9324[_0x048b('0x4c')]['id'];return db['UserProfile'][_0x048b('0x66')](_0x2c9324);}return db['User']['findAndCountAll'](_0x596803);})[_0x048b('0x19')](function(_0x42b753){_0x240deb[_0x048b('0xb')]=_0x42b753[_0x048b('0xb')];_0x502a0f=_0x42b753[_0x048b('0x67')];return _0x502a0f[_0x048b('0x32')](function(_0x426fa9){var _0x26ab07=_['find'](_0x44defd,['id',_0x426fa9['id']]);if(_0x26ab07){var _0x15d0e5=rta[_0x048b('0x68')](_0x26ab07);_['merge'](_0x426fa9,_0x15d0e5);}_0x426fa9['globalStatus']=rta[_0x048b('0x69')](_0x426fa9);if(_0x426fa9[_0x048b('0x52')][_0x048b('0x46')](_0x048b('0x6a'))){_0x69388b[_0x048b('0x61')](function(_0x430959){if(_0x426fa9[_0x430959+_0x048b('0x41')]){_0x426fa9[_0x430959+_0x048b('0x6b')]=_0x048b('0x6a');}});}return _0x426fa9;});})[_0x048b('0x19')](function(_0x2410ea){if(!_0x292184||_0x19ddde){return _0x2410ea;}return rta[_0x048b('0x6c')](_0x2410ea,_0x292184);})['then'](function(_0x10e60f){_0x240deb[_0x048b('0x67')]=_0x10e60f;return _0x240deb;})[_0x048b('0x19')](respondWithFilteredResult(_0x1a4aff,_0x596803))[_0x048b('0x17')](handleError(_0x1a4aff,null));};exports['getQueues']=function(_0x2c518a,_0x3b49eb){var _0xf58686={'count':0x0,'rows':[]},_0x17db63={},_0xc35b03,_0x10b01b,_0x4a023a,_0x49ef41,_0x42db41;Promise['resolve']()['then'](function(){if(_0x2c518a[_0x048b('0x4c')][_0x048b('0x50')])_0xc35b03=validateChannel(_0x2c518a[_0x048b('0x4c')][_0x048b('0x50')]);var _0x4700bf=_[_0x048b('0x13')](_0xc35b03)+_0x048b('0x6d');var _0x343120=_['map'](db[_0x4700bf][_0x048b('0x5a')],function(_0x48474c){return{'name':_0x48474c[_0x048b('0x5b')],'type':_0x48474c['type'][_0x048b('0x5c')]};});_0x17db63=qs[_0x048b('0x6e')](_0x343120,_0x2c518a);if(_0x2c518a[_0x048b('0x62')]['role']===_0x048b('0x62')){var _0x5165ea={'params':{'id':_0x2c518a[_0x048b('0x62')][_0x048b('0x63')]},'query':{'section':_0xc35b03===_0x048b('0x20')&&_0x2c518a[_0x048b('0x4c')][_0x048b('0x6f')]===_0x048b('0x21')?_0x048b('0x70'):_['startCase'](_0xc35b03)+'Queues','type':_0x2c518a[_0x048b('0x4c')][_0x048b('0x6f')],'nolimit':!![],'sort':_0x048b('0xf'),'filter':_0x2c518a['query']['filter']}};return db['UserProfile'][_0x048b('0x66')](_0x5165ea);}return db[_0x4700bf][_0x048b('0x71')](_0x17db63);})[_0x048b('0x19')](function(_0x55c470){_0xf58686[_0x048b('0xb')]=_0x55c470[_0x048b('0xb')];_0x10b01b=_0x55c470[_0x048b('0x67')];return getRealtimeQueues(_0x2c518a,_0xc35b03);})[_0x048b('0x19')](function(_0x2048a0){_0x49ef41=_0x2048a0['rows'];return rta[_0x048b('0x58')]();})[_0x048b('0x19')](function(_0x17a1e5){_0x4a023a=_0x17a1e5['rows'];if(_0xc35b03!=_0x048b('0x20'))return;return getRealtimeVoiceQueueChannels();})[_0x048b('0x19')](function(_0x165f5d){_0x42db41=_0x165f5d?_0x165f5d[_0x048b('0x67')]:[];return initializeQueues(_0x10b01b,_0x49ef41,_0xc35b03,_0x2c518a[_0x048b('0x4c')]['type']);})[_0x048b('0x19')](function(_0x2eebd7){var _0xf2e038=_0x2eebd7[_0x048b('0x32')](function(_0x3d01da){if(_0xc35b03===_0x048b('0x20'))return getVoiceQueueAgents(_0x3d01da,_0x10b01b,_0x4a023a,_0x42db41);else return getQueueAgents(_0x3d01da,_0x4a023a,_0xc35b03);});return Promise[_0x048b('0x72')](_0xf2e038);})[_0x048b('0x19')](function(_0x1df6bb){_0xf58686[_0x048b('0x67')]=_0x1df6bb;return _0xf58686;})[_0x048b('0x19')](respondWithFilteredResult(_0x3b49eb,_0x17db63))[_0x048b('0x17')](handleError(_0x3b49eb,null));}; \ No newline at end of file +var _0xea04=['toLowerCase','getAgents','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','*pause','resolve','channel','sort','globalStatus','validateSortParameter','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','rawAttributes','type','key','agent','raw','sequelize','literal','forEach','where','role','user','userProfileId','extraQueryConditions','assign','UserProfile','User','findAndCountAll','filterAgentAttributes','getAgentStatus','pause','sortAgentsByStatus','getQueues','fieldName','getOptions','getResources','all','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','undefined','limit','count','offset','set','Content-Range','json','error','stack','name','status','send','request','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','catch','loggedIn','available','waiting','talking','paused','outbound','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','voice','pTalking','originated','find','merge','pick','filter','queue','busy','some','connectedlinenum','internal','toString','getMembers','length','UserId','accountcode','online','voiceStatus','agents','push','startCase','Queue','Pause','loggedInDb','getChannels','includes'];(function(_0x3b1f27,_0x40188b){var _0x5b8dd3=function(_0x4cdd20){while(--_0x4cdd20){_0x3b1f27['push'](_0x3b1f27['shift']());}};_0x5b8dd3(++_0x40188b);}(_0xea04,0x19f));var _0x4ea0=function(_0x48df04,_0x1522b1){_0x48df04=_0x48df04-0x0;var _0x4de5fa=_0xea04[_0x48df04];return _0x4de5fa;};'use strict';var util=require(_0x4ea0('0x0'));var _=require(_0x4ea0('0x1'));var jayson=require(_0x4ea0('0x2'));var rta=require('../../components/realtime/agents');var qs=require(_0x4ea0('0x3'));var utils=require('../../config/utils');var logger=require(_0x4ea0('0x4'))(_0x4ea0('0x5'));var db=require(_0x4ea0('0x6'))['db'];var amiClient=jayson[_0x4ea0('0x7')][_0x4ea0('0x8')]({'port':0x232a});var routingClient=jayson[_0x4ea0('0x7')]['http']({'port':0x232c});function respondWithFilteredResult(_0xab5eeb,_0x1ba777){return function(_0x664149){if(_0x664149){var _0x39485a=typeof _0x1ba777['offset']===_0x4ea0('0x9')&&typeof _0x1ba777[_0x4ea0('0xa')]===_0x4ea0('0x9');var _0x5e3bd1=_0x664149[_0x4ea0('0xb')];var _0x5e7c9b=_0x39485a?0x0:_0x1ba777[_0x4ea0('0xc')];var _0x18cf04=_0x39485a?_0x664149[_0x4ea0('0xb')]:_0x1ba777['offset']+_0x1ba777[_0x4ea0('0xa')];var _0x32971d;if(_0x18cf04>=_0x5e3bd1){_0x18cf04=_0x5e3bd1;_0x32971d=0xc8;}else{_0x32971d=0xce;}_0xab5eeb['status'](_0x32971d);return _0xab5eeb[_0x4ea0('0xd')](_0x4ea0('0xe'),_0x5e7c9b+'-'+_0x18cf04+'/'+_0x5e3bd1)[_0x4ea0('0xf')](_0x664149);}return null;};}function handleError(_0x199751,_0xc3abc5){_0xc3abc5=_0xc3abc5||0x1f4;return function(_0x251f95){logger[_0x4ea0('0x10')](_0x251f95[_0x4ea0('0x11')]);if(_0x251f95[_0x4ea0('0x12')]){delete _0x251f95[_0x4ea0('0x12')];}_0x199751[_0x4ea0('0x13')](_0xc3abc5)[_0x4ea0('0x14')](_0x251f95);};}function getRealtimeQueues(_0x4a0063,_0x4b1a91){return new Promise(function(_0x204e5a,_0x12def4){var _0x43c860=_0x4b1a91==='voice'?amiClient:routingClient;return _0x43c860[_0x4ea0('0x15')](_['startCase'](_0x4b1a91)+_0x4ea0('0x16'),_0x4a0063)[_0x4ea0('0x17')](function(_0x4b5ca0){if(_0x4b5ca0[_0x4ea0('0x10')])throw new Error(util[_0x4ea0('0x18')](_0x4ea0('0x19'),_0x4b1a91));return _0x204e5a(_0x4b5ca0[_0x4ea0('0x1a')]);})['catch'](function(_0x14ddeb){_0x12def4(_0x14ddeb);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x5aa547,_0x3e53b8){return amiClient[_0x4ea0('0x15')](_0x4ea0('0x1b'),{})['then'](function(_0x19fa79){if(_0x19fa79['error'])throw new Error(_0x4ea0('0x1c'));return _0x5aa547(_0x19fa79[_0x4ea0('0x1a')]);})[_0x4ea0('0x1d')](function(_0x221ad0){_0x3e53b8(_0x221ad0);});});}function initializeQueues(_0x2e5e7f,_0x1c9682,_0x3a120e,_0x3e8084){var _0x171eb2=[_0x4ea0('0x1e'),_0x4ea0('0x1f'),_0x4ea0('0x20'),_0x4ea0('0x21'),_0x4ea0('0x22')];if(_0x3a120e==='voice'&&_0x3e8084===_0x4ea0('0x23')){_0x171eb2['push']('pTalking','originated','message','dialActive',_0x4ea0('0x24'),'Trunk',_0x4ea0('0x25'),_0x4ea0('0x26'),_0x4ea0('0x27'),_0x4ea0('0x28'),_0x4ea0('0x29'),_0x4ea0('0x2a'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x4ea0('0x2b'),_0x4ea0('0x2c'),_0x4ea0('0x2d'),'predictiveIntervalAnsweredCalls',_0x4ea0('0x2e'),_0x4ea0('0x2f'),_0x4ea0('0x30'),'predictiveIntervalAvgTalktime');}return _0x2e5e7f[_0x4ea0('0x31')](function(_0x3d7573){var _0x28ceb3=_0x3d7573['get']({'plain':!![]});_0x28ceb3['agents']=[];_0x28ceb3[_0x4ea0('0x22')]=0x0;_0x28ceb3['loggedInDb']=0x0;_0x28ceb3[_0x4ea0('0x1e')]=0x0;_0x28ceb3['available']=0x0;_0x28ceb3[_0x4ea0('0x20')]=0x0;if(_0x3a120e===_0x4ea0('0x32')){_0x28ceb3['talking']=0x0;_0x28ceb3['busy']=0x0;if(_0x3e8084===_0x4ea0('0x23')){_0x28ceb3[_0x4ea0('0x33')]=0x0;_0x28ceb3[_0x4ea0('0x34')]=0x0;}}var _0x4cdf50=_[_0x4ea0('0x35')](_0x1c9682,['id',_0x28ceb3['id']]);if(_0x4cdf50)_[_0x4ea0('0x36')](_0x28ceb3,_[_0x4ea0('0x37')](_0x4cdf50,_0x171eb2));return _0x28ceb3;});}function updateAgentVoiceStatus(_0x2e5623,_0x6ab614,_0xe65ddd){var _0x530682=_[_0x4ea0('0x38')](_0xe65ddd,[_0x4ea0('0x39'),_0x6ab614['name']]);if(_0x530682['length']===0x0)return _0x2e5623[_0x4ea0('0x3a')]=!![];if(_[_0x4ea0('0x3b')](_0x530682,[_0x4ea0('0x3c'),_0x2e5623[_0x4ea0('0x3d')][_0x4ea0('0x3e')]()]))return _0x2e5623['talking']=!![];if(!_0x2e5623[_0x4ea0('0x21')])return _0x2e5623[_0x4ea0('0x3a')]=!![];}function getVoiceQueueAgents(_0x425030,_0x4add0c,_0x2a6a9e,_0x19ccf5){var _0x5b859b=_[_0x4ea0('0x35')](_0x4add0c,['id',_0x425030['id']]);if(!_0x5b859b)return _0x425030;return _0x5b859b[_0x4ea0('0x3f')]({'raw':!![]})[_0x4ea0('0x17')](function(_0xef345b){for(var _0x31c6f4=0x0;_0x31c6f4<_0xef345b[_0x4ea0('0x40')];_0x31c6f4++){var _0x2b5b41=_[_0x4ea0('0x35')](_0x2a6a9e,['id',_0xef345b[_0x31c6f4][_0x4ea0('0x41')]]);if(!_0x2b5b41){_0x2b5b41={'id':_0xef345b[_0x31c6f4]['UserId'],'name':_0xef345b[_0x31c6f4][_0x4ea0('0x41')],'accountcode':'','online':![]};}var _0x53cefc={'id':_0x2b5b41['id'],'name':_0x2b5b41[_0x4ea0('0x12')],'internal':_0x2b5b41[_0x4ea0('0x42')],'online':Boolean(_0x2b5b41[_0x4ea0('0x43')]),'paused':Boolean(_0xef345b[_0x31c6f4][_0x4ea0('0x22')])};if(_0x2b5b41[_0x4ea0('0x44')]==='talking')updateAgentVoiceStatus(_0x53cefc,_0x425030,_0x19ccf5);if(_0x53cefc[_0x4ea0('0x43')])_0x425030['loggedInDb']++;if(_0x53cefc[_0x4ea0('0x3a')])_0x425030[_0x4ea0('0x3a')]++;if(_0x53cefc[_0x4ea0('0x22')]&&!_0x53cefc['busy']&&!_0x53cefc[_0x4ea0('0x21')])_0x425030[_0x4ea0('0x22')]++;_0x425030[_0x4ea0('0x45')][_0x4ea0('0x46')](_0x53cefc);}return _0x425030;});}function getQueueAgents(_0x328340,_0x494d80,_0x154e38){var _0x1755d3='User'+_[_0x4ea0('0x47')](_0x154e38)+_0x4ea0('0x48');var _0x2926ad=_0x154e38+_0x4ea0('0x49');return db[_0x1755d3]['findAll']({'where':{[_[_0x4ea0('0x47')](_0x154e38)+'QueueId']:_0x328340['id']},'raw':!![]})[_0x4ea0('0x17')](function(_0x3f1484){for(var _0x52f955=0x0;_0x52f955<_0x3f1484[_0x4ea0('0x40')];_0x52f955++){var _0x57c90f=_[_0x4ea0('0x35')](_0x494d80,['id',_0x3f1484[_0x52f955][_0x4ea0('0x41')]]);if(!_0x57c90f){_0x57c90f={'id':_0x3f1484[_0x52f955][_0x4ea0('0x41')],'name':_0x3f1484[_0x52f955]['UserId'],'online':![],['pauseField']:![]};}var _0x3fa9d9={'id':_0x57c90f['id'],'name':_0x57c90f['name'],'online':Boolean(_0x57c90f[_0x4ea0('0x43')]),'paused':Boolean(_0x57c90f[_0x2926ad])};if(_0x3fa9d9[_0x4ea0('0x43')])_0x328340[_0x4ea0('0x4a')]++;_0x328340[_0x4ea0('0x45')]['push'](_0x3fa9d9);}return _0x328340;});}function validateChannel(_0x4ec594){var _0x37bb8e=utils[_0x4ea0('0x4b')]();if(!_[_0x4ea0('0x4c')](_0x37bb8e,_0x4ec594[_0x4ea0('0x4d')]()))throw new Error('Invalid\x20channel');return _0x4ec594[_0x4ea0('0x4d')]();}exports[_0x4ea0('0x4e')]=function(_0x1ea5c4,_0x293e30){var _0x1e1176={'count':0x0,'rows':[]};var _0x2952fa={};var _0x34f995;var _0x4d6670;var _0x42dc60;var _0x6e5c61;var _0x23e45a=utils['getChannels']();var _0x48fdf1=_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x50')];var _0x327f3c=_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x51')];var _0x484212=_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x52')];var _0x366415=_0x327f3c==='pause'||_0x327f3c===_0x4ea0('0x53')?!![]:![];var _0x13cc63=[];var _0x2e29ed;Promise[_0x4ea0('0x54')]()['then'](function(){if(_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x55')]){_0x34f995=validateChannel(_0x1ea5c4['query'][_0x4ea0('0x55')]);}if(!_0x1ea5c4['query'][_0x4ea0('0x56')]||!_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x56')][_0x4ea0('0x4c')](_0x4ea0('0x57'))){_0x1ea5c4['query'][_0x4ea0('0x56')]=rta[_0x4ea0('0x58')](_0x1ea5c4['query'][_0x4ea0('0x56')]);return;}var _0x534359=rta['getUpdatedSortOptions'](_0x1ea5c4['query'][_0x4ea0('0x56')]);_0x1ea5c4[_0x4ea0('0x4f')][_0x4ea0('0x56')]=_0x534359[_0x4ea0('0x59')][_0x4ea0('0x5a')](',');_0x4d6670=_0x534359[_0x4ea0('0x5b')];})[_0x4ea0('0x17')](function(){if(!_0x48fdf1){return[];}return rta[_0x4ea0('0x5c')](_0x48fdf1,_0x34f995);})['then'](function(_0x14fcc5){_0x13cc63=_0x14fcc5;return rta[_0x4ea0('0x5d')]();})[_0x4ea0('0x17')](function(_0x162640){_0x6e5c61=_0x162640[_0x4ea0('0x5e')];if((!_0x327f3c||_0x366415)&&!_0x4d6670){return _0x13cc63;}if(_0x4d6670&&!_0x327f3c){return rta[_0x4ea0('0x5f')](_0x6e5c61,_0x13cc63,_0x4d6670);}else{return rta[_0x4ea0('0x60')](_0x6e5c61,_0x13cc63,_0x327f3c);}})[_0x4ea0('0x17')](function(_0x61ce3d){_0x13cc63=_0x61ce3d;var _0x2d6677=![];if(_0x13cc63[_0x4ea0('0x40')]===0x0){if(_0x48fdf1||_0x327f3c){_0x2d6677=!![];}if(_0x366415){_0x2d6677=![];}}if(_0x2d6677){return _0x1e1176;}var _0x4b2842=_[_0x4ea0('0x31')](db['User'][_0x4ea0('0x61')],function(_0x3d4bd){return{'name':_0x3d4bd['fieldName'],'type':_0x3d4bd[_0x4ea0('0x62')][_0x4ea0('0x63')]};});_0x1ea5c4[_0x4ea0('0x4f')]['role']=_0x4ea0('0x64');_0x1ea5c4[_0x4ea0('0x4f')]['online']=!![];_0x2952fa=qs['getOptions'](_0x4b2842,_0x1ea5c4);_0x2952fa[_0x4ea0('0x65')]=!![];var _0x4f398e=[];if(_0x13cc63[_0x4ea0('0x40')]>0x0){_0x4f398e['push']({'id':{'$in':_0x13cc63}});if(_0x4d6670&&!_0x327f3c){_0x2e29ed=[db[_0x4ea0('0x66')][_0x4ea0('0x67')]('FIELD(id,'+_0x13cc63+')')];_0x2952fa[_0x4ea0('0x5b')]=_0x2e29ed;}}if(_0x366415){_0x23e45a[_0x4ea0('0x68')](function(_0x57d1ab){var _0x3dc95a=!![];if(_0x327f3c==='*pause'&&_0x34f995!==_0x57d1ab){_0x3dc95a=![];}_0x4f398e['push']({[_0x57d1ab+'Pause']:_0x3dc95a});});if(_0x484212){_0x4f398e[_0x4ea0('0x46')]({'pauseType':_0x484212});}}else if(_0x327f3c){_0x23e45a[_0x4ea0('0x68')](function(_0x280895){_0x4f398e[_0x4ea0('0x46')]({[_0x280895+'Pause']:![]});});}_0x2952fa[_0x4ea0('0x69')]=_[_0x4ea0('0x36')](_0x2952fa[_0x4ea0('0x69')],{'$and':_0x4f398e});if(_0x1ea5c4['user'][_0x4ea0('0x6a')]===_0x4ea0('0x6b')){var _0x145334={'params':{'id':_0x1ea5c4[_0x4ea0('0x6b')][_0x4ea0('0x6c')]},'query':{'section':'Agents','role':_0x4ea0('0x64'),'online':!![],'raw':!![],'ids':_0x13cc63,'customSorting':_0x2e29ed}};if(_0x366415){_0x145334[_0x4ea0('0x4f')][_0x4ea0('0x6d')]=_0x4f398e;}_0x145334['query']=Object[_0x4ea0('0x6e')](_0x145334[_0x4ea0('0x4f')],_0x1ea5c4[_0x4ea0('0x4f')]);delete _0x145334[_0x4ea0('0x4f')]['id'];return db[_0x4ea0('0x6f')]['getResources'](_0x145334);}return db[_0x4ea0('0x70')][_0x4ea0('0x71')](_0x2952fa);})[_0x4ea0('0x17')](function(_0x3a0afb){_0x1e1176[_0x4ea0('0xb')]=_0x3a0afb[_0x4ea0('0xb')];_0x42dc60=_0x3a0afb[_0x4ea0('0x5e')];return _0x42dc60['map'](function(_0x5a540b){var _0x400b1e=_[_0x4ea0('0x35')](_0x6e5c61,['id',_0x5a540b['id']]);if(_0x400b1e){var _0x2d9f90=rta[_0x4ea0('0x72')](_0x400b1e);_[_0x4ea0('0x36')](_0x5a540b,_0x2d9f90);}_0x5a540b[_0x4ea0('0x57')]=rta[_0x4ea0('0x73')](_0x5a540b);if(_0x5a540b['globalStatus'][_0x4ea0('0x4c')]('pause')){_0x23e45a['forEach'](function(_0x498c05){if(_0x5a540b[_0x498c05+'Pause']){_0x5a540b[_0x498c05+'Status']=_0x4ea0('0x74');}});}return _0x5a540b;});})['then'](function(_0x4b80c1){if(!_0x4d6670||_0x2e29ed){return _0x4b80c1;}return rta[_0x4ea0('0x75')](_0x4b80c1,_0x4d6670);})['then'](function(_0x32f2e6){_0x1e1176[_0x4ea0('0x5e')]=_0x32f2e6;return _0x1e1176;})[_0x4ea0('0x17')](respondWithFilteredResult(_0x293e30,_0x2952fa))[_0x4ea0('0x1d')](handleError(_0x293e30,null));};exports[_0x4ea0('0x76')]=function(_0x5a3406,_0x31464a){var _0x5d24de={'count':0x0,'rows':[]},_0x322bc6={},_0x26b807,_0x278d41,_0x18b563,_0x155173,_0x46bbb0;Promise[_0x4ea0('0x54')]()[_0x4ea0('0x17')](function(){if(_0x5a3406['query'][_0x4ea0('0x55')])_0x26b807=validateChannel(_0x5a3406[_0x4ea0('0x4f')][_0x4ea0('0x55')]);var _0x5be858=_[_0x4ea0('0x47')](_0x26b807)+_0x4ea0('0x48');var _0x408448=_['map'](db[_0x5be858][_0x4ea0('0x61')],function(_0x81403f){return{'name':_0x81403f[_0x4ea0('0x77')],'type':_0x81403f[_0x4ea0('0x62')][_0x4ea0('0x63')]};});_0x322bc6=qs[_0x4ea0('0x78')](_0x408448,_0x5a3406);if(_0x5a3406[_0x4ea0('0x6b')][_0x4ea0('0x6a')]===_0x4ea0('0x6b')){var _0x455f90={'params':{'id':_0x5a3406['user'][_0x4ea0('0x6c')]},'query':{'section':_0x26b807===_0x4ea0('0x32')&&_0x5a3406['query']['type']===_0x4ea0('0x23')?'QueueCampaigns':_[_0x4ea0('0x47')](_0x26b807)+'Queues','type':_0x5a3406['query'][_0x4ea0('0x62')],'nolimit':!![],'sort':_0x4ea0('0x12'),'filter':_0x5a3406[_0x4ea0('0x4f')][_0x4ea0('0x38')]}};return db[_0x4ea0('0x6f')][_0x4ea0('0x79')](_0x455f90);}return db[_0x5be858][_0x4ea0('0x71')](_0x322bc6);})['then'](function(_0x4433ce){_0x5d24de[_0x4ea0('0xb')]=_0x4433ce[_0x4ea0('0xb')];_0x278d41=_0x4433ce[_0x4ea0('0x5e')];return getRealtimeQueues(_0x5a3406,_0x26b807);})[_0x4ea0('0x17')](function(_0x51e82c){_0x155173=_0x51e82c[_0x4ea0('0x5e')];return rta[_0x4ea0('0x5d')]();})[_0x4ea0('0x17')](function(_0x2943ee){_0x18b563=_0x2943ee[_0x4ea0('0x5e')];if(_0x26b807!='voice')return;return getRealtimeVoiceQueueChannels();})[_0x4ea0('0x17')](function(_0xb2d7c1){_0x46bbb0=_0xb2d7c1?_0xb2d7c1[_0x4ea0('0x5e')]:[];return initializeQueues(_0x278d41,_0x155173,_0x26b807,_0x5a3406[_0x4ea0('0x4f')]['type']);})[_0x4ea0('0x17')](function(_0x1cebe4){var _0x282d18=_0x1cebe4['map'](function(_0x165432){if(_0x26b807===_0x4ea0('0x32'))return getVoiceQueueAgents(_0x165432,_0x278d41,_0x18b563,_0x46bbb0);else return getQueueAgents(_0x165432,_0x18b563,_0x26b807);});return Promise[_0x4ea0('0x7a')](_0x282d18);})[_0x4ea0('0x17')](function(_0x34a7f3){_0x5d24de[_0x4ea0('0x5e')]=_0x34a7f3;return _0x5d24de;})[_0x4ea0('0x17')](respondWithFilteredResult(_0x31464a,_0x322bc6))['catch'](handleError(_0x31464a,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 0556da2..e71e2b4 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x59e21c,_0x4d77b9){var _0x199b4c=function(_0x3034f0){while(--_0x3034f0){_0x59e21c['push'](_0x59e21c['shift']());}};_0x199b4c(++_0x4d77b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2c0931,_0x503573){var _0x3d781f=function(_0x3f84ac){while(--_0x3f84ac){_0x2c0931['push'](_0x2c0931['shift']());}};_0x3d781f(++_0x503573);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 3f285a3..4c78eb2 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 _0x02ca=['INTEGER','STRING','DATE','sequelize'];(function(_0x4183f2,_0x361455){var _0x28def4=function(_0x54ad9a){while(--_0x54ad9a){_0x4183f2['push'](_0x4183f2['shift']());}};_0x28def4(++_0x361455);}(_0x02ca,0x97));var _0xa02c=function(_0x3ca9ff,_0x416bb1){_0x3ca9ff=_0x3ca9ff-0x0;var _0x5cd656=_0x02ca[_0x3ca9ff];return _0x5cd656;};'use strict';var Sequelize=require(_0xa02c('0x0'));module['exports']={'state':{'type':Sequelize[_0xa02c('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa02c('0x2')]},'scheduledat':{'type':Sequelize[_0xa02c('0x3')]},'uniqueid':{'type':Sequelize[_0xa02c('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa02c('0x3')]},'ringtime':{'type':Sequelize[_0xa02c('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xa02c('0x2')]},'campaigntype':{'type':Sequelize[_0xa02c('0x2')]},'membername':{'type':Sequelize[_0xa02c('0x2')]}}; \ No newline at end of file +var _0x2e88=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0xc2dde6,_0x1cccc9){var _0x9fc29c=function(_0x54ba28){while(--_0x54ba28){_0xc2dde6['push'](_0xc2dde6['shift']());}};_0x9fc29c(++_0x1cccc9);}(_0x2e88,0x95));var _0x82e8=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0x2e88[_0x8af54b];return _0x27d8f0;};'use strict';var Sequelize=require(_0x82e8('0x0'));module[_0x82e8('0x1')]={'state':{'type':Sequelize[_0x82e8('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x82e8('0x3')]},'scheduledat':{'type':Sequelize[_0x82e8('0x4')]},'uniqueid':{'type':Sequelize[_0x82e8('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x82e8('0x4')]},'ringtime':{'type':Sequelize[_0x82e8('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x82e8('0x3')]},'membername':{'type':Sequelize[_0x82e8('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index ba45e6b..febded0 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 _0x9b39=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x55c428,_0x50fc79){var _0x2d3846=function(_0x467356){while(--_0x467356){_0x55c428['push'](_0x55c428['shift']());}};_0x2d3846(++_0x50fc79);}(_0x9b39,0x125));var _0x99b3=function(_0x302aea,_0x16e445){_0x302aea=_0x302aea-0x0;var _0x3112be=_0x9b39[_0x302aea];return _0x3112be;};'use strict';var _=require('lodash');var util=require(_0x99b3('0x0'));var logger=require(_0x99b3('0x1'))('api');var moment=require(_0x99b3('0x2'));var BPromise=require('bluebird');var rp=require(_0x99b3('0x3'));var fs=require('fs');var path=require(_0x99b3('0x4'));var rimraf=require(_0x99b3('0x5'));var config=require(_0x99b3('0x6'));var attributes=require(_0x99b3('0x7'));module[_0x99b3('0x8')]=function(_0x5a9674,_0x3ae759){return _0x5a9674[_0x99b3('0x9')](_0x99b3('0xa'),attributes,{'tableName':_0x99b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40f0=['api','moment','bluebird','request-promise','path','rimraf','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x4f7bd5,_0x5dc0ad){var _0x4a7c11=function(_0x589f16){while(--_0x589f16){_0x4f7bd5['push'](_0x4f7bd5['shift']());}};_0x4a7c11(++_0x5dc0ad);}(_0x40f0,0xd5));var _0x040f=function(_0x34885c,_0x5241ab){_0x34885c=_0x34885c-0x0;var _0x2381e1=_0x40f0[_0x34885c];return _0x2381e1;};'use strict';var _=require(_0x040f('0x0'));var util=require(_0x040f('0x1'));var logger=require(_0x040f('0x2'))(_0x040f('0x3'));var moment=require(_0x040f('0x4'));var BPromise=require(_0x040f('0x5'));var rp=require(_0x040f('0x6'));var fs=require('fs');var path=require(_0x040f('0x7'));var rimraf=require(_0x040f('0x8'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x8df3f6,_0x377732){return _0x8df3f6[_0x040f('0x9')](_0x040f('0xa'),attributes,{'tableName':_0x040f('0xb'),'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 7b2f232..121b27d 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 _0x4a73=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','debug','util'];(function(_0x53c371,_0x55a560){var _0x5b5bbb=function(_0x58c754){while(--_0x58c754){_0x53c371['push'](_0x53c371['shift']());}};_0x5b5bbb(++_0x55a560);}(_0x4a73,0x103));var _0x34a7=function(_0x48c97e,_0x5d8172){_0x48c97e=_0x48c97e-0x0;var _0x4cddda=_0x4a73[_0x48c97e];return _0x4cddda;};'use strict';var _=require('lodash');var util=require(_0x34a7('0x0'));var moment=require(_0x34a7('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34a7('0x2'));var db=require(_0x34a7('0x3'))['db'];var utils=require(_0x34a7('0x4'));var logger=require(_0x34a7('0x5'))('rpc');var config=require(_0x34a7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x34a7('0x7')][_0x34a7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c0091,_0x50088a,_0x2582ae){return new BPromise(function(_0x32c9bb,_0x428e5f){return client[_0x34a7('0x9')](_0x5c0091,_0x2582ae)[_0x34a7('0xa')](function(_0x7da44d){logger[_0x34a7('0xb')](_0x34a7('0xc'),_0x50088a,'request\x20sent');logger['debug'](_0x34a7('0xd'),_0x50088a,_0x34a7('0xe'),JSON[_0x34a7('0xf')](_0x7da44d));if(_0x7da44d[_0x34a7('0x10')]){if(_0x7da44d['error'][_0x34a7('0x11')]===0x1f4){logger['error'](_0x34a7('0xc'),_0x50088a,_0x7da44d[_0x34a7('0x10')][_0x34a7('0x12')]);return _0x428e5f(_0x7da44d['error'][_0x34a7('0x12')]);}logger['error'](_0x34a7('0xc'),_0x50088a,_0x7da44d[_0x34a7('0x10')][_0x34a7('0x12')]);return _0x32c9bb(_0x7da44d[_0x34a7('0x10')][_0x34a7('0x12')]);}else{logger['info'](_0x34a7('0xc'),_0x50088a,_0x34a7('0xe'));_0x32c9bb(_0x7da44d['result'][_0x34a7('0x12')]);}})[_0x34a7('0x13')](function(_0x261e64){logger[_0x34a7('0x10')](_0x34a7('0xc'),_0x50088a,_0x261e64);_0x428e5f(_0x261e64);});});}exports[_0x34a7('0x14')]=function(_0x1fc433){var _0x57d25a=this;return new Promise(function(_0x1c0532,_0x204ac9){return db[_0x34a7('0x15')][_0x34a7('0x16')](_0x1fc433['body'],{'raw':_0x1fc433['options']?_0x1fc433[_0x34a7('0x17')][_0x34a7('0x18')]===undefined?!![]:![]:!![]})[_0x34a7('0xa')](function(_0xae0cde){logger[_0x34a7('0xb')](_0x34a7('0x14'),_0x1fc433);logger[_0x34a7('0x19')]('CreateReportAgentPreview',_0x1fc433,JSON[_0x34a7('0xf')](_0xae0cde));_0x1c0532(_0xae0cde);})[_0x34a7('0x13')](function(_0x4278e2){logger[_0x34a7('0x10')]('CreateReportAgentPreview',_0x4278e2[_0x34a7('0x12')],_0x1fc433);_0x204ac9(_0x57d25a[_0x34a7('0x10')](0x1f4,_0x4278e2[_0x34a7('0x12')]));});});}; \ No newline at end of file +var _0xdc94=['then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ReportAgentPreview,\x20%s,\x20%s','CreateReportAgentPreview','create','body','options','raw','debug','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x18a782,_0x5a07c3){var _0x23732d=function(_0x1d390e){while(--_0x1d390e){_0x18a782['push'](_0x18a782['shift']());}};_0x23732d(++_0x5a07c3);}(_0xdc94,0x16f));var _0x4dc9=function(_0x3fa996,_0x357d29){_0x3fa996=_0x3fa996-0x0;var _0x8f48da=_0xdc94[_0x3fa996];return _0x8f48da;};'use strict';var _=require('lodash');var util=require(_0x4dc9('0x0'));var moment=require('moment');var BPromise=require(_0x4dc9('0x1'));var rs=require(_0x4dc9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4dc9('0x3'));var logger=require(_0x4dc9('0x4'))(_0x4dc9('0x5'));var config=require(_0x4dc9('0x6'));var jayson=require(_0x4dc9('0x7'));var client=jayson[_0x4dc9('0x8')][_0x4dc9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f255f,_0x1ab036,_0xd942){return new BPromise(function(_0x5f50a8,_0x15cad8){return client[_0x4dc9('0xa')](_0x5f255f,_0xd942)[_0x4dc9('0xb')](function(_0x567fb8){logger[_0x4dc9('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x1ab036,_0x4dc9('0xd'));logger['debug'](_0x4dc9('0xe'),_0x1ab036,_0x4dc9('0xd'),JSON[_0x4dc9('0xf')](_0x567fb8));if(_0x567fb8[_0x4dc9('0x10')]){if(_0x567fb8[_0x4dc9('0x10')]['code']===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x1ab036,_0x567fb8[_0x4dc9('0x10')][_0x4dc9('0x11')]);return _0x15cad8(_0x567fb8[_0x4dc9('0x10')][_0x4dc9('0x11')]);}logger[_0x4dc9('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x1ab036,_0x567fb8['error'][_0x4dc9('0x11')]);return _0x5f50a8(_0x567fb8['error'][_0x4dc9('0x11')]);}else{logger[_0x4dc9('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x1ab036,'request\x20sent');_0x5f50a8(_0x567fb8[_0x4dc9('0x12')]['message']);}})[_0x4dc9('0x13')](function(_0x4ff920){logger['error'](_0x4dc9('0x14'),_0x1ab036,_0x4ff920);_0x15cad8(_0x4ff920);});});}exports[_0x4dc9('0x15')]=function(_0x3bfd97){var _0x44f69a=this;return new Promise(function(_0x3839ee,_0x9318e5){return db['ReportAgentPreview'][_0x4dc9('0x16')](_0x3bfd97[_0x4dc9('0x17')],{'raw':_0x3bfd97[_0x4dc9('0x18')]?_0x3bfd97[_0x4dc9('0x18')][_0x4dc9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x211033){logger[_0x4dc9('0xc')]('CreateReportAgentPreview',_0x3bfd97);logger[_0x4dc9('0x1a')]('CreateReportAgentPreview',_0x3bfd97,JSON[_0x4dc9('0xf')](_0x211033));_0x3839ee(_0x211033);})[_0x4dc9('0x13')](function(_0x21617e){logger[_0x4dc9('0x10')](_0x4dc9('0x15'),_0x21617e[_0x4dc9('0x11')],_0x3bfd97);_0x9318e5(_0x44f69a[_0x4dc9('0x10')](0x1f4,_0x21617e[_0x4dc9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 1c0d9ec..1334ba2 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 _0xb4b4=['showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','showVoiceQueues','put','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xb4b4,0xb1));var _0x4b4b=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xb4b4[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x4b4b('0x0'));var util=require(_0x4b4b('0x1'));var path=require(_0x4b4b('0x2'));var express=require('express');var router=express[_0x4b4b('0x3')]();var auth=require(_0x4b4b('0x4'));var controller=require(_0x4b4b('0x5'));router[_0x4b4b('0x6')]('/voice/channels',auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x8')]);router[_0x4b4b('0x6')](_0x4b4b('0x9'),auth['isAuthenticated'](),controller[_0x4b4b('0xa')]);router[_0x4b4b('0x6')](_0x4b4b('0xb'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0xc')]);router[_0x4b4b('0x6')]('/voice/queues',auth[_0x4b4b('0x7')](),controller[_0x4b4b('0xd')]);router[_0x4b4b('0x6')](_0x4b4b('0xe'),auth['isAuthenticated'](),controller[_0x4b4b('0xf')]);router['get']('/mail/queues',auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x10')]);router[_0x4b4b('0x6')](_0x4b4b('0x11'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x12')]);router['get'](_0x4b4b('0x13'),auth['isAuthenticated'](),controller[_0x4b4b('0x14')]);router[_0x4b4b('0x6')]('/sms/queues',auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x15')]);router[_0x4b4b('0x6')](_0x4b4b('0x16'),auth[_0x4b4b('0x7')](),controller['whatsappQueues']);router[_0x4b4b('0x6')](_0x4b4b('0x17'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x18')]);router['get'](_0x4b4b('0x19'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x1a')]);router[_0x4b4b('0x6')](_0x4b4b('0x1b'),auth['isAuthenticated'](),controller[_0x4b4b('0x1c')]);router['get'](_0x4b4b('0x1d'),auth[_0x4b4b('0x7')](),controller['voiceQueuesChannel']);router['get'](_0x4b4b('0x1e'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x4b4b('0x6')]('/voice/queues/:id',auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x20')]);router[_0x4b4b('0x21')](_0x4b4b('0x22'),auth[_0x4b4b('0x7')](),controller['updateVoiceQueue']);router[_0x4b4b('0x6')](_0x4b4b('0x23'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x24')]);router[_0x4b4b('0x6')](_0x4b4b('0x25'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x26')]);router['get'](_0x4b4b('0x27'),auth['isAuthenticated'](),controller['agents']);router[_0x4b4b('0x21')](_0x4b4b('0x28'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x29')]);router[_0x4b4b('0x6')](_0x4b4b('0x2a'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x2b')]);router['get'](_0x4b4b('0x2c'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x2d')]);router['get'](_0x4b4b('0x2e'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x2f')]);router[_0x4b4b('0x6')](_0x4b4b('0x30'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0x4b4b('0x6')]('/chat/queues/waitinginteractions',auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x31')]);router[_0x4b4b('0x6')](_0x4b4b('0x32'),auth[_0x4b4b('0x7')](),controller['mailQueuesWaitingInteractions']);router[_0x4b4b('0x6')](_0x4b4b('0x33'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x34')]);router[_0x4b4b('0x6')](_0x4b4b('0x35'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x36')]);router[_0x4b4b('0x6')](_0x4b4b('0x37'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x38')]);router[_0x4b4b('0x6')](_0x4b4b('0x39'),auth['isAuthenticated'](),controller[_0x4b4b('0x3a')]);router[_0x4b4b('0x6')](_0x4b4b('0x3b'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x4b4b('0x3c')](_0x4b4b('0x3d'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x3e')](_0x4b4b('0x3f')));router[_0x4b4b('0x6')](_0x4b4b('0x40'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x41')]);router[_0x4b4b('0x3c')](_0x4b4b('0x42'),auth['isAuthenticated'](),controller[_0x4b4b('0x3e')](_0x4b4b('0x43')));router[_0x4b4b('0x6')](_0x4b4b('0x44'),auth[_0x4b4b('0x7')](),controller['showChatQueues']);router[_0x4b4b('0x3c')](_0x4b4b('0x45'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x3e')](_0x4b4b('0x46')));router[_0x4b4b('0x6')](_0x4b4b('0x47'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x48')]);router['post'](_0x4b4b('0x49'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x3e')](_0x4b4b('0x4a')));router[_0x4b4b('0x6')](_0x4b4b('0x4b'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x4c')]);router[_0x4b4b('0x3c')]('/sms/queues/:id/notify',auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x3e')](_0x4b4b('0x4d')));router['post'](_0x4b4b('0x4e'),auth[_0x4b4b('0x7')](),controller['queueNotify'](_0x4b4b('0x4f')));router[_0x4b4b('0x6')](_0x4b4b('0x50'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x51')]);router[_0x4b4b('0x6')]('/whatsapp/queues/:id',auth['isAuthenticated'](),controller[_0x4b4b('0x52')]);router['post'](_0x4b4b('0x53'),auth[_0x4b4b('0x7')](),controller[_0x4b4b('0x54')]);module[_0x4b4b('0x55')]=router; \ No newline at end of file +var _0x1254=['/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','trunks','/campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor'];(function(_0x52597a,_0xc693e9){var _0x5f431d=function(_0x176c3b){while(--_0x176c3b){_0x52597a['push'](_0x52597a['shift']());}};_0x5f431d(++_0xc693e9);}(_0x1254,0x1e2));var _0x4125=function(_0x33ff1e,_0x15dcd8){_0x33ff1e=_0x33ff1e-0x0;var _0x3d7f08=_0x1254[_0x33ff1e];return _0x3d7f08;};'use strict';var multer=require(_0x4125('0x0'));var util=require(_0x4125('0x1'));var path=require(_0x4125('0x2'));var express=require('express');var router=express[_0x4125('0x3')]();var auth=require(_0x4125('0x4'));var controller=require(_0x4125('0x5'));router[_0x4125('0x6')]('/voice/channels',auth[_0x4125('0x7')](),controller[_0x4125('0x8')]);router['get'](_0x4125('0x9'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x4125('0x6')](_0x4125('0xa'),auth[_0x4125('0x7')](),controller[_0x4125('0xb')]);router[_0x4125('0x6')](_0x4125('0xc'),auth[_0x4125('0x7')](),controller[_0x4125('0xd')]);router[_0x4125('0x6')](_0x4125('0xe'),auth['isAuthenticated'](),controller[_0x4125('0xf')]);router[_0x4125('0x6')](_0x4125('0x10'),auth[_0x4125('0x7')](),controller[_0x4125('0x11')]);router[_0x4125('0x6')](_0x4125('0x12'),auth[_0x4125('0x7')](),controller[_0x4125('0x13')]);router['get'](_0x4125('0x14'),auth[_0x4125('0x7')](),controller[_0x4125('0x15')]);router[_0x4125('0x6')](_0x4125('0x16'),auth[_0x4125('0x7')](),controller['smsQueues']);router[_0x4125('0x6')](_0x4125('0x17'),auth[_0x4125('0x7')](),controller['whatsappQueues']);router[_0x4125('0x6')](_0x4125('0x18'),auth['isAuthenticated'](),controller[_0x4125('0x19')]);router[_0x4125('0x6')](_0x4125('0x1a'),auth['isAuthenticated'](),controller[_0x4125('0x1b')]);router['get'](_0x4125('0x1c'),auth[_0x4125('0x7')](),controller[_0x4125('0x1d')]);router[_0x4125('0x6')](_0x4125('0x1e'),auth[_0x4125('0x7')](),controller[_0x4125('0x1f')]);router[_0x4125('0x6')](_0x4125('0x20'),auth[_0x4125('0x7')](),controller[_0x4125('0x21')]);router[_0x4125('0x6')](_0x4125('0x22'),auth[_0x4125('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x4125('0x6')](_0x4125('0x23'),auth[_0x4125('0x7')](),controller[_0x4125('0x24')]);router[_0x4125('0x25')](_0x4125('0x23'),auth[_0x4125('0x7')](),controller[_0x4125('0x26')]);router[_0x4125('0x6')](_0x4125('0x27'),auth[_0x4125('0x7')](),controller[_0x4125('0x28')]);router['get'](_0x4125('0x29'),auth['isAuthenticated'](),controller[_0x4125('0x2a')]);router[_0x4125('0x6')](_0x4125('0x2b'),auth['isAuthenticated'](),controller['agents']);router[_0x4125('0x25')](_0x4125('0x2c'),auth[_0x4125('0x7')](),controller[_0x4125('0x2d')]);router[_0x4125('0x6')](_0x4125('0x2e'),auth[_0x4125('0x7')](),controller['telephones']);router[_0x4125('0x6')]('/trunks',auth[_0x4125('0x7')](),controller[_0x4125('0x2f')]);router[_0x4125('0x6')](_0x4125('0x30'),auth[_0x4125('0x7')](),controller['campaigns']);router[_0x4125('0x6')]('/fax/accounts',auth[_0x4125('0x7')](),controller['faxAccounts']);router[_0x4125('0x6')](_0x4125('0x31'),auth[_0x4125('0x7')](),controller[_0x4125('0x32')]);router[_0x4125('0x6')](_0x4125('0x33'),auth[_0x4125('0x7')](),controller[_0x4125('0x34')]);router[_0x4125('0x6')](_0x4125('0x35'),auth[_0x4125('0x7')](),controller[_0x4125('0x36')]);router[_0x4125('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x4125('0x7')](),controller[_0x4125('0x37')]);router[_0x4125('0x6')](_0x4125('0x38'),auth[_0x4125('0x7')](),controller[_0x4125('0x39')]);router[_0x4125('0x6')](_0x4125('0x3a'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x4125('0x6')](_0x4125('0x3b'),auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x4125('0x3c')](_0x4125('0x3d'),auth[_0x4125('0x7')](),controller[_0x4125('0x3e')](_0x4125('0x3f')));router['get'](_0x4125('0x40'),auth['isAuthenticated'](),controller[_0x4125('0x41')]);router['post'](_0x4125('0x42'),auth[_0x4125('0x7')](),controller['queueNotify'](_0x4125('0x43')));router[_0x4125('0x6')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0x4125('0x3c')](_0x4125('0x44'),auth[_0x4125('0x7')](),controller[_0x4125('0x3e')]('fax'));router['get']('/fax/queues/:id',auth['isAuthenticated'](),controller[_0x4125('0x45')]);router[_0x4125('0x3c')](_0x4125('0x46'),auth['isAuthenticated'](),controller[_0x4125('0x3e')](_0x4125('0x47')));router[_0x4125('0x6')](_0x4125('0x48'),auth[_0x4125('0x7')](),controller['showOpenchannelQueues']);router['post'](_0x4125('0x49'),auth[_0x4125('0x7')](),controller[_0x4125('0x3e')]('sms'));router['post'](_0x4125('0x4a'),auth[_0x4125('0x7')](),controller[_0x4125('0x3e')](_0x4125('0x4b')));router[_0x4125('0x6')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x4125('0x4c')]);router[_0x4125('0x6')](_0x4125('0x4d'),auth[_0x4125('0x7')](),controller[_0x4125('0x4e')]);router[_0x4125('0x3c')](_0x4125('0x4f'),auth[_0x4125('0x7')](),controller[_0x4125('0x50')]);module[_0x4125('0x51')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 9641df5..c30902a 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 _0x7217=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','rows','map','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','Message','findOne','messageId','Interaction','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','channel','Channel\x20field\x20is\x20mandatory','\x20Message\x20not\x20found','update','agentTransferTimeout','*,*,*,*','bluebird','lodash','util','../../mysqldb','../../config/logger','api','http','client','request','then','error','code','message','result','catch','json','sendStatus','stack','send','isNil','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','name','hasOwnProperty','MemberReport','findAll','length','format','updateAttributes','findOrCreate','SIP/%s','INTERACTION','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'use strict';var BPromise=require(_0x7721('0x0'));var moment=require('moment');var _=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var db=require(_0x7721('0x3'))['db'];var logger=require(_0x7721('0x4'))(_0x7721('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x7721('0x6')]({'port':0x232a});var mailClient=jayson[_0x7721('0x7')][_0x7721('0x6')]({'port':0x232b});var routingClient=jayson[_0x7721('0x7')][_0x7721('0x6')]({'port':0x232c});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){var _0x3e6368=_0x21f680?_0x21f680:amiClient;return _0x3e6368[_0x7721('0x8')](_0xf7ff37,_0x18ab6b)[_0x7721('0x9')](function(_0x138740){if(_0x138740[_0x7721('0xa')]){if(_0x138740['error'][_0x7721('0xb')]===0x1f4){return _0x2f99ed(_0x138740[_0x7721('0xa')][_0x7721('0xc')]);}return _0x225610(_0x138740[_0x7721('0xa')][_0x7721('0xc')]);}else{_0x225610(_0x138740[_0x7721('0xd')]);}})[_0x7721('0xe')](function(_0x27b36b){_0x2f99ed(_0x27b36b);});});}function respondWithResult(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xc8;return function(_0x199930){if(_0x199930){return _0x55b4ca['status'](_0x2911ec)[_0x7721('0xf')](_0x199930);}return _0x55b4ca[_0x7721('0x10')](0x194);};}function handleError(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0x1f4;return function(_0x5069da){logger[_0x7721('0xa')](_0x5069da[_0x7721('0x11')]);if(_0x5069da['name']){delete _0x5069da['name'];}_0x3f01c5['status'](_0x2e9752)[_0x7721('0x12')](_0x5069da);};}function findById(_0x25a628){return function(_0x3cc909){if(!_[_0x7721('0x13')](_0x25a628)&&!_['isNil'](_0x3cc909)&&!_[_0x7721('0x13')](_0x3cc909['rows'])){return _[_0x7721('0x14')](_0x3cc909['rows'],function(_0xfec626){return _0xfec626['id']==_0x25a628;});}return null;};}exports[_0x7721('0x15')]=function(_0x3ab5a5,_0x3e140d){return respondWithRpcPromise(_0x7721('0x16'),_0x3ab5a5[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x3e140d,null))[_0x7721('0xe')](handleError(_0x3e140d,null));};exports[_0x7721('0x18')]=function(_0xaeccc4,_0x4ce1db){return respondWithRpcPromise(_0x7721('0x19'),_[_0x7721('0x1a')](_0xaeccc4[_0x7721('0x17')],_0xaeccc4[_0x7721('0x1b')]))['then'](respondWithResult(_0x4ce1db,null))[_0x7721('0xe')](handleError(_0x4ce1db,null));};exports['voiceChannelStopMixMonitor']=function(_0xb9e9dd,_0x288e3a){return respondWithRpcPromise(_0x7721('0x1c'),_[_0x7721('0x1a')](_0xb9e9dd[_0x7721('0x17')],_0xb9e9dd[_0x7721('0x1b')]))[_0x7721('0x9')](respondWithResult(_0x288e3a,null))['catch'](handleError(_0x288e3a,null));};exports[_0x7721('0x1d')]=function(_0x1abedb,_0x125564){return respondWithRpcPromise(_0x7721('0x1e'),_0x1abedb[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x125564,null))[_0x7721('0xe')](handleError(_0x125564,null));};exports[_0x7721('0x1f')]=function(_0x40f367,_0x52316e){return respondWithRpcPromise(_0x7721('0x1e'),_0x40f367['query'])['then'](findById(_0x40f367[_0x7721('0x1b')]['id']))[_0x7721('0x9')](respondWithResult(_0x52316e,null))[_0x7721('0xe')](handleError(_0x52316e,null));};exports[_0x7721('0x20')]=function(_0x1ea4d,_0x37b9f0){return respondWithRpcPromise(_0x7721('0x21'),_[_0x7721('0x1a')](_0x1ea4d['body'],_0x1ea4d[_0x7721('0x1b')]))[_0x7721('0x9')](respondWithResult(_0x37b9f0,null))['catch'](handleError(_0x37b9f0,null));};exports['voiceQueuesPreview']=function(_0xfde9ec,_0x220bbf){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x7721('0x1a')](_0xfde9ec[_0x7721('0x17')],_0xfde9ec[_0x7721('0x1b')]))['then'](respondWithResult(_0x220bbf,null))[_0x7721('0xe')](handleError(_0x220bbf,null));};exports[_0x7721('0x22')]=function(_0x1492d4,_0x3f15e2){return respondWithRpcPromise(_0x7721('0x23'),_0x1492d4['query'])[_0x7721('0x9')](respondWithResult(_0x3f15e2,null))[_0x7721('0xe')](handleError(_0x3f15e2,null));};exports[_0x7721('0x24')]=function(_0x5c5b33,_0x35de7a){return respondWithRpcPromise(_0x7721('0x25'),_['merge'](_0x5c5b33[_0x7721('0x17')],_0x5c5b33['params']))[_0x7721('0x9')](respondWithResult(_0x35de7a,null))[_0x7721('0xe')](handleError(_0x35de7a,null));};exports[_0x7721('0x26')]=function(_0x1d894b,_0x1c84c0){return respondWithRpcPromise(_0x7721('0x27'),_[_0x7721('0x1a')](_0x1d894b[_0x7721('0x17')],_0x1d894b[_0x7721('0x1b')]))[_0x7721('0x9')](respondWithResult(_0x1c84c0,null))[_0x7721('0xe')](handleError(_0x1c84c0,null));};exports['voiceQueuesChannelRedirect']=function(_0xd1df68,_0x5e6663){return respondWithRpcPromise(_0x7721('0x28'),_[_0x7721('0x1a')](_0xd1df68[_0x7721('0x17')],_0xd1df68[_0x7721('0x1b')]))[_0x7721('0x9')](respondWithResult(_0x5e6663,null))[_0x7721('0xe')](handleError(_0x5e6663,null));};exports['outbound']=function(_0x557c34,_0x4cadef){return respondWithRpcPromise('Outbound',_0x557c34[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x4cadef,null))[_0x7721('0xe')](handleError(_0x4cadef,null));};exports[_0x7721('0x29')]=function(_0x4a90ce,_0xa389fa){return respondWithRpcPromise('OutboundChannels',_0x4a90ce[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0xa389fa,null))['catch'](handleError(_0xa389fa,null));};exports[_0x7721('0x2a')]=function(_0x3a47c8,_0x4e77ff){var _0x4d0111;return respondWithRpcPromise(_0x7721('0x2b'),_0x3a47c8[_0x7721('0x17')])[_0x7721('0x9')](function(_0x15e34d){_0x4d0111=_0x15e34d;return respondWithRpcPromise('Agents',_0x3a47c8[_0x7721('0x17')],routingClient);})[_0x7721('0x9')](function(_0x40ce8c){return _[_0x7721('0x1a')]({},_0x40ce8c,_0x4d0111);})[_0x7721('0x9')](respondWithResult(_0x4e77ff,null))['catch'](handleError(_0x4e77ff,null));};exports[_0x7721('0x2c')]=function(_0x4a2c28,_0xaa3216){if(_0x4a2c28['body']&&_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')]&&_0x4a2c28[_0x7721('0x2f')]&&_0x4a2c28['user'][_0x7721('0x30')]){for(var _0x11d853 in _0x4a2c28[_0x7721('0x2d')]['interaction']){if(_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')][_0x7721('0x31')](_0x11d853)){db[_0x7721('0x32')][_0x7721('0x33')]({'where':{'channel':_0x11d853,'membername':_0x4a2c28[_0x7721('0x2f')][_0x7721('0x30')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4a2c28['body'][_0x7721('0x2e')][_0x11d853]&&_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')][_0x11d853][_0x7721('0x34')]?{'$notIn':_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')][_0x11d853]}:{'$ne':null}}})[_0x7721('0x9')](function(_0x2966fe){var _0xa601bc=moment()[_0x7721('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x578867=0x0,_0x5ed70d=_0x2966fe[_0x7721('0x34')];_0x578867<_0x5ed70d;_0x578867+=0x1){_0x2966fe[_0x578867][_0x7721('0x36')]({'exitAt':_0xa601bc});}});for(var _0x219c9f=0x0;_0x219c9f<_0x4a2c28['body'][_0x7721('0x2e')][_0x11d853][_0x7721('0x34')];_0x219c9f+=0x1){db['MemberReport'][_0x7721('0x37')]({'where':{'channel':_0x11d853,'membername':_0x4a2c28['user'][_0x7721('0x30')],'type':'INTERACTION','uniqueid':_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')][_0x11d853][_0x219c9f],'exitAt':null},'defaults':{'channel':_0x11d853,'membername':_0x4a2c28[_0x7721('0x2f')]['name'],'interface':_[_0x7721('0x13')](_0x4a2c28[_0x7721('0x2f')]['interface'])?util[_0x7721('0x35')](_0x7721('0x38'),_0x4a2c28[_0x7721('0x2f')]['name']):_0x4a2c28[_0x7721('0x2f')]['interface'],'type':_0x7721('0x39'),'enterAt':moment()[_0x7721('0x35')](_0x7721('0x3a')),'role':_0x7721('0x3b'),'internal':_0x4a2c28[_0x7721('0x2f')][_0x7721('0x3c')],'uniqueid':_0x4a2c28[_0x7721('0x2d')][_0x7721('0x2e')][_0x11d853][_0x219c9f]}});}}}}return respondWithRpcPromise(_0x7721('0x3d'),{'id':_0x4a2c28[_0x7721('0x1b')]['id'],'capacity':_0x4a2c28[_0x7721('0x2d')][_0x7721('0x3e')]},routingClient)[_0x7721('0x9')](respondWithResult(_0xaa3216,null))[_0x7721('0xe')](handleError(_0xaa3216,null));};exports[_0x7721('0x3f')]=function(_0x5b741d,_0x474f32){return respondWithRpcPromise(_0x7721('0x40'),_0x5b741d[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x474f32,null))[_0x7721('0xe')](handleError(_0x474f32,null));};exports[_0x7721('0x41')]=function(_0x267f5e,_0x57484c){return respondWithRpcPromise(_0x7721('0x42'),_0x267f5e[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x57484c,null))[_0x7721('0xe')](handleError(_0x57484c,null));};exports[_0x7721('0x43')]=function(_0x9c0d4,_0x7fbd6c){return respondWithRpcPromise(_0x7721('0x44'),_0x9c0d4[_0x7721('0x17')])[_0x7721('0x9')](respondWithResult(_0x7fbd6c,null))[_0x7721('0xe')](handleError(_0x7fbd6c,null));};exports['chatQueues']=function(_0x421c27,_0xadb365){return respondWithRpcPromise(_0x7721('0x45'),_0x421c27[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0xadb365,null))[_0x7721('0xe')](handleError(_0xadb365,null));};exports[_0x7721('0x46')]=function(_0x36fe6f,_0x360882){return respondWithRpcPromise(_0x7721('0x45'),_0x36fe6f[_0x7721('0x17')],routingClient)[_0x7721('0x9')](findById(_0x36fe6f[_0x7721('0x1b')]['id']))[_0x7721('0x9')](respondWithResult(_0x360882,null))[_0x7721('0xe')](handleError(_0x360882,null));};exports['mailQueues']=function(_0x50e9e9,_0x4e112e){return respondWithRpcPromise(_0x7721('0x47'),_0x50e9e9['query'],routingClient)['then'](respondWithResult(_0x4e112e,null))['catch'](handleError(_0x4e112e,null));};exports['showMailQueues']=function(_0x47925a,_0x219181){return respondWithRpcPromise(_0x7721('0x47'),_0x47925a['query'],routingClient)[_0x7721('0x9')](findById(_0x47925a['params']['id']))['then'](respondWithResult(_0x219181,null))['catch'](handleError(_0x219181,null));};exports[_0x7721('0x48')]=function(_0x4f0d38,_0x48e7e3){return respondWithRpcPromise('MailAccounts',_0x4f0d38[_0x7721('0x17')],mailClient)[_0x7721('0x9')](respondWithResult(_0x48e7e3,null))[_0x7721('0xe')](handleError(_0x48e7e3,null));};exports['openchannelQueues']=function(_0x2a025c,_0x1f1890){return respondWithRpcPromise(_0x7721('0x49'),_0x2a025c[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0x1f1890,null))[_0x7721('0xe')](handleError(_0x1f1890,null));};exports[_0x7721('0x4a')]=function(_0x3e3301,_0x127f46){return respondWithRpcPromise(_0x7721('0x49'),_0x3e3301[_0x7721('0x17')],routingClient)[_0x7721('0x9')](findById(_0x3e3301[_0x7721('0x1b')]['id']))[_0x7721('0x9')](respondWithResult(_0x127f46,null))[_0x7721('0xe')](handleError(_0x127f46,null));};exports['smsQueues']=function(_0x233e5d,_0x2c93b0){return respondWithRpcPromise(_0x7721('0x4b'),_0x233e5d[_0x7721('0x17')],routingClient)['then'](respondWithResult(_0x2c93b0,null))[_0x7721('0xe')](handleError(_0x2c93b0,null));};exports[_0x7721('0x4c')]=function(_0x4c8284,_0x3e7df3){return respondWithRpcPromise('SmsQueues',_0x4c8284[_0x7721('0x17')],routingClient)[_0x7721('0x9')](findById(_0x4c8284[_0x7721('0x1b')]['id']))[_0x7721('0x9')](respondWithResult(_0x3e7df3,null))[_0x7721('0xe')](handleError(_0x3e7df3,null));};exports[_0x7721('0x4d')]=function(_0x3121e0,_0x167ce7){return respondWithRpcPromise(_0x7721('0x4e'),_0x3121e0['query'],routingClient)[_0x7721('0x9')](respondWithResult(_0x167ce7,null))[_0x7721('0xe')](handleError(_0x167ce7,null));};exports[_0x7721('0x4f')]=function(_0x3a11e2,_0x56a988){return respondWithRpcPromise(_0x7721('0x4e'),_0x3a11e2[_0x7721('0x17')],routingClient)['then'](findById(_0x3a11e2[_0x7721('0x1b')]['id']))[_0x7721('0x9')](respondWithResult(_0x56a988,null))['catch'](handleError(_0x56a988,null));};exports[_0x7721('0x50')]=function(_0x565c49,_0x14b543){return respondWithRpcPromise(_0x7721('0x51'),_0x565c49[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0x14b543,null))[_0x7721('0xe')](handleError(_0x14b543,null));};exports[_0x7721('0x52')]=function(_0x258c57,_0x5dca04){return respondWithRpcPromise(_0x7721('0x51'),_0x258c57[_0x7721('0x17')],routingClient)[_0x7721('0x9')](findById(_0x258c57['params']['id']))['then'](respondWithResult(_0x5dca04,null))['catch'](handleError(_0x5dca04,null));};exports['faxAccounts']=function(_0x5e966f,_0x1fc5f7){return respondWithRpcPromise(_0x7721('0x53'),_0x5e966f['query'])[_0x7721('0x9')](respondWithResult(_0x1fc5f7,null))[_0x7721('0xe')](handleError(_0x1fc5f7,null));};exports[_0x7721('0x54')]=function(_0x4593e1,_0x53ebb1){return respondWithRpcPromise(_0x7721('0x55'),_0x4593e1[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0x53ebb1,null))[_0x7721('0xe')](handleError(_0x53ebb1,null));};exports[_0x7721('0x56')]=function(_0x53adb1,_0x29ac64){return respondWithRpcPromise(_0x7721('0x57'),_0x53adb1[_0x7721('0x17')],routingClient)['then'](respondWithResult(_0x29ac64,null))['catch'](handleError(_0x29ac64,null));};exports[_0x7721('0x58')]=function(_0x752564,_0x423040){return respondWithRpcPromise(_0x7721('0x59'),_0x752564[_0x7721('0x17')],routingClient)['then'](respondWithResult(_0x423040,null))['catch'](handleError(_0x423040,null));};exports[_0x7721('0x5a')]=function(_0x1bd97e,_0x68de4){return respondWithRpcPromise(_0x7721('0x59'),_0x1bd97e[_0x7721('0x17')],routingClient)[_0x7721('0x9')](function(_0x34187f){if(_0x1bd97e['query'][_0x7721('0x5b')]!==undefined){var _0x413185=_(_0x34187f[_0x7721('0x5c')])['filter']([_0x1bd97e[_0x7721('0x17')][_0x7721('0x5b')],_0x1bd97e[_0x7721('0x1b')]['id']])[_0x7721('0x5d')]('queue_id')['uniq']()[_0x7721('0x5e')]();return _0x34187f[_0x7721('0x5c')][_0x7721('0x5f')](function(_0x42c849){return _0x413185[_0x7721('0x60')](_0x42c849[_0x7721('0x61')])>-0x1;});}else{return _0x34187f['rows'][_0x7721('0x5f')](function(_0x42bb5a){return _0x42bb5a[_0x7721('0x61')]===parseInt(_0x1bd97e['params']['id']);});}})[_0x7721('0x9')](respondWithResult(_0x68de4,null))[_0x7721('0xe')](handleError(_0x68de4,null));};exports[_0x7721('0x62')]=function(_0xc20188,_0x457d7f){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0xc20188[_0x7721('0x17')],routingClient)['then'](respondWithResult(_0x457d7f,null))[_0x7721('0xe')](handleError(_0x457d7f,null));};exports[_0x7721('0x63')]=function(_0x2d5433,_0x7f0598){return respondWithRpcPromise(_0x7721('0x64'),_0x2d5433[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0x7f0598,null))[_0x7721('0xe')](handleError(_0x7f0598,null));};exports[_0x7721('0x65')]=function(_0x3b78f5,_0x2c74d8){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x3b78f5[_0x7721('0x17')],routingClient)[_0x7721('0x9')](respondWithResult(_0x2c74d8,null))[_0x7721('0xe')](handleError(_0x2c74d8,null));};exports['queueNotify']=function(_0x94af20){return function(_0x26b2cc,_0x139517){var _0xc9761e,_0xcd9f0d;var _0x594059=_[_0x7721('0x66')](_0x94af20);var _0x22f15a=_0x94af20===_0x7721('0x67')?_0x7721('0x68'):_0x7721('0x69');return db[_0x594059+_0x7721('0x6a')]['findOne']({'raw':!![],'where':{'id':_0x26b2cc[_0x7721('0x1b')]['id']}})[_0x7721('0x9')](function(_0x480a03){if(_[_0x7721('0x13')](_0x480a03)){throw new Error(_0x594059+'\x20Queue\x20not\x20found');}_0xc9761e=_0x480a03;return db[_0x594059+_0x7721('0x6b')][_0x7721('0x6c')]({'where':{'id':_0x26b2cc['body'][_0x7721('0x6d')]},'include':[{'model':db[_0x594059+'Interaction'],'as':'Interaction'},{'model':db[_0x594059+_0x22f15a],'as':'Account'}]});})[_0x7721('0x9')](function(_0x20f12e){if(_[_0x7721('0x13')](_0x20f12e)){throw new Error(_0x594059+'\x20Message\x20not\x20found');}_0xcd9f0d=_0x20f12e;return _0x20f12e['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x355aa8={'uniqueid':_0x94af20+'.'+_0xcd9f0d['id']+'.'+_0xcd9f0d[_0x7721('0x6e')]['id'],'FromUserId':_0x26b2cc[_0x7721('0x2f')]['id'],'type':_0x7721('0x6f')};_0x355aa8[_0x594059+_0x7721('0x70')]=_0xcd9f0d['id'];_0x355aa8[_0x594059+_0x7721('0x71')]=_0xcd9f0d['Interaction']['id'];_0x355aa8[_0x7721('0x72')+_0x594059+_0x22f15a+'Id']=_0xcd9f0d[_0x7721('0x69')]['id'];_0x355aa8['To'+_0x594059+_0x7721('0x73')]=_0xc9761e['id'];return db[_0x594059+_0x7721('0x74')][_0x7721('0x75')](_0x355aa8);})[_0x7721('0x9')](function(){return respondWithRpcPromise(_0x7721('0x76'),{'channel':_0x94af20,'interaction':_0xcd9f0d[_0x7721('0x6e')],'message':_0xcd9f0d,'account':_0xcd9f0d[_0x7721('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7721('0x6f'),'appdata':_0xc9761e[_0x7721('0x30')]+','+(_0xcd9f0d[_0x7721('0x69')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x7721('0x9')](respondWithResult(_0x139517,null))[_0x7721('0xe')](handleError(_0x139517,null));};};exports['agentNotify']=function(_0x167e05,_0x570cf4){var _0x4e3c93,_0x154b4b;if(_['isNil'](_0x167e05['body'][_0x7721('0x77')])){throw new Error(_0x7721('0x78'));}var _0x28e123=_0x167e05[_0x7721('0x2d')][_0x7721('0x77')];var _0x494c5e=_[_0x7721('0x66')](_0x28e123);var _0xcf2c06=_0x28e123===_0x7721('0x67')?_0x7721('0x68'):'Account';return db['User'][_0x7721('0x6c')]({'raw':!![],'where':{'id':_0x167e05[_0x7721('0x1b')]['id'],'role':'agent'}})[_0x7721('0x9')](function(_0x13dc8a){if(_['isNil'](_0x13dc8a)){throw new Error('Agent\x20not\x20found');}_0x4e3c93=_0x13dc8a;return db[_0x494c5e+_0x7721('0x6b')][_0x7721('0x6c')]({'where':{'id':_0x167e05[_0x7721('0x2d')][_0x7721('0x6d')]},'include':[{'model':db[_0x494c5e+_0x7721('0x6e')],'as':_0x7721('0x6e')},{'model':db[_0x494c5e+_0xcf2c06],'as':_0x7721('0x69')}]});})[_0x7721('0x9')](function(_0x59de30){if(_[_0x7721('0x13')](_0x59de30)){throw new Error(_0x494c5e+_0x7721('0x79'));}_0x154b4b=_0x59de30;return _0x59de30[_0x7721('0x7a')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7721('0x9')](function(){var _0xe1c795={'uniqueid':_0x28e123+'.'+_0x154b4b['id']+'.'+_0x154b4b[_0x7721('0x6e')]['id'],'FromUserId':_0x167e05[_0x7721('0x2f')]['id'],'type':'queue','ToUserId':_0x4e3c93['id']};_0xe1c795[_0x494c5e+_0x7721('0x70')]=_0x154b4b['id'];_0xe1c795[_0x494c5e+_0x7721('0x71')]=_0x154b4b['Interaction']['id'];_0xe1c795[_0x7721('0x72')+_0x494c5e+_0xcf2c06+'Id']=_0x154b4b[_0x7721('0x69')]['id'];return db[_0x494c5e+_0x7721('0x74')][_0x7721('0x75')](_0xe1c795);})[_0x7721('0x9')](function(){return respondWithRpcPromise(_0x7721('0x76'),{'channel':_0x28e123,'interaction':_0x154b4b[_0x7721('0x6e')],'message':_0x154b4b,'account':_0x154b4b[_0x7721('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7721('0x3b'),'appdata':_0x4e3c93[_0x7721('0x30')]+','+(_0x154b4b['Account'][_0x7721('0x7b')]||0x12c),'interval':_0x7721('0x7c')}]},routingClient);})[_0x7721('0x9')](respondWithResult(_0x570cf4,null))[_0x7721('0xe')](handleError(_0x570cf4,null));}; \ No newline at end of file +var _0x1cb9=['query','params','voiceChannelStopMixMonitor','voiceQueues','VoiceQueues','updateVoiceQueue','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelRedirect','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','length','findOrCreate','agent','AgentCapacity','telephones','trunks','Trunks','campaigns','Campaigns','ChatQueues','showChatQueues','MailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','findOne','\x20Queue\x20not\x20found','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','bluebird','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','then','error','code','message','result','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','merge'];(function(_0x5ec634,_0xa835b9){var _0x5b94a9=function(_0x3a720e){while(--_0x3a720e){_0x5ec634['push'](_0x5ec634['shift']());}};_0x5b94a9(++_0xa835b9);}(_0x1cb9,0x14e));var _0x91cb=function(_0x49d9a6,_0x5a5291){_0x49d9a6=_0x49d9a6-0x0;var _0x28195d=_0x1cb9[_0x49d9a6];return _0x28195d;};'use strict';var BPromise=require(_0x91cb('0x0'));var moment=require('moment');var _=require(_0x91cb('0x1'));var util=require(_0x91cb('0x2'));var db=require(_0x91cb('0x3'))['db'];var logger=require(_0x91cb('0x4'))('api');var jayson=require(_0x91cb('0x5'));var amiClient=jayson[_0x91cb('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0x91cb('0x6')][_0x91cb('0x7')]({'port':0x232b});var routingClient=jayson[_0x91cb('0x6')][_0x91cb('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){var _0x2fdfce=_0x4c1f56?_0x4c1f56:amiClient;return _0x2fdfce['request'](_0x3b9d98,_0x8f8a3b)[_0x91cb('0x8')](function(_0x317df0){if(_0x317df0[_0x91cb('0x9')]){if(_0x317df0[_0x91cb('0x9')][_0x91cb('0xa')]===0x1f4){return _0x5bda2f(_0x317df0[_0x91cb('0x9')][_0x91cb('0xb')]);}return _0x15c517(_0x317df0[_0x91cb('0x9')][_0x91cb('0xb')]);}else{_0x15c517(_0x317df0[_0x91cb('0xc')]);}})['catch'](function(_0x3c1f56){_0x5bda2f(_0x3c1f56);});});}function respondWithResult(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xc8;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0xd')](_0x4ba2f2)[_0x91cb('0xe')](_0x20e6e0);}return _0x366f09[_0x91cb('0xf')](0x194);};}function handleError(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0x1f4;return function(_0x4aae25){logger[_0x91cb('0x9')](_0x4aae25['stack']);if(_0x4aae25['name']){delete _0x4aae25[_0x91cb('0x10')];}_0x4a7d45[_0x91cb('0xd')](_0x4cc6ef)[_0x91cb('0x11')](_0x4aae25);};}function findById(_0x5ea796){return function(_0x238f11){if(!_[_0x91cb('0x12')](_0x5ea796)&&!_['isNil'](_0x238f11)&&!_[_0x91cb('0x12')](_0x238f11[_0x91cb('0x13')])){return _[_0x91cb('0x14')](_0x238f11[_0x91cb('0x13')],function(_0x5cc1c3){return _0x5cc1c3['id']==_0x5ea796;});}return null;};}exports[_0x91cb('0x15')]=function(_0x7dcf60,_0x4ca8e8){return respondWithRpcPromise(_0x91cb('0x16'),_0x7dcf60['query'])['then'](respondWithResult(_0x4ca8e8,null))[_0x91cb('0x17')](handleError(_0x4ca8e8,null));};exports[_0x91cb('0x18')]=function(_0x56e409,_0x51a1d5){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x91cb('0x19')](_0x56e409[_0x91cb('0x1a')],_0x56e409[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x51a1d5,null))['catch'](handleError(_0x51a1d5,null));};exports[_0x91cb('0x1c')]=function(_0x43881c,_0x1fa837){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x91cb('0x19')](_0x43881c[_0x91cb('0x1a')],_0x43881c[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x1fa837,null))[_0x91cb('0x17')](handleError(_0x1fa837,null));};exports[_0x91cb('0x1d')]=function(_0x414e60,_0x423c4f){return respondWithRpcPromise(_0x91cb('0x1e'),_0x414e60['query'])['then'](respondWithResult(_0x423c4f,null))[_0x91cb('0x17')](handleError(_0x423c4f,null));};exports['showVoiceQueues']=function(_0x1c67d2,_0x34d372){return respondWithRpcPromise(_0x91cb('0x1e'),_0x1c67d2['query'])[_0x91cb('0x8')](findById(_0x1c67d2['params']['id']))[_0x91cb('0x8')](respondWithResult(_0x34d372,null))[_0x91cb('0x17')](handleError(_0x34d372,null));};exports[_0x91cb('0x1f')]=function(_0x2fb473,_0x468908){return respondWithRpcPromise('UpdateVoiceQueue',_[_0x91cb('0x19')](_0x2fb473['body'],_0x2fb473[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x468908,null))[_0x91cb('0x17')](handleError(_0x468908,null));};exports['voiceQueuesPreview']=function(_0x775c25,_0x146e1f){return respondWithRpcPromise(_0x91cb('0x20'),_[_0x91cb('0x19')](_0x775c25[_0x91cb('0x1a')],_0x775c25[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x146e1f,null))[_0x91cb('0x17')](handleError(_0x146e1f,null));};exports[_0x91cb('0x21')]=function(_0x5e6ed3,_0x2ccf6e){return respondWithRpcPromise(_0x91cb('0x22'),_0x5e6ed3[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x2ccf6e,null))[_0x91cb('0x17')](handleError(_0x2ccf6e,null));};exports['voiceQueuesChannel']=function(_0x2409d3,_0x74b443){return respondWithRpcPromise(_0x91cb('0x23'),_[_0x91cb('0x19')](_0x2409d3[_0x91cb('0x1a')],_0x2409d3['params']))[_0x91cb('0x8')](respondWithResult(_0x74b443,null))['catch'](handleError(_0x74b443,null));};exports['voiceQueuesChannelHangup']=function(_0x479968,_0x2011fc){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x91cb('0x19')](_0x479968['query'],_0x479968['params']))[_0x91cb('0x8')](respondWithResult(_0x2011fc,null))[_0x91cb('0x17')](handleError(_0x2011fc,null));};exports[_0x91cb('0x24')]=function(_0x14319b,_0x2d8fb9){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x91cb('0x19')](_0x14319b[_0x91cb('0x1a')],_0x14319b[_0x91cb('0x1b')]))[_0x91cb('0x8')](respondWithResult(_0x2d8fb9,null))['catch'](handleError(_0x2d8fb9,null));};exports['outbound']=function(_0x1eed21,_0x135bf1){return respondWithRpcPromise('Outbound',_0x1eed21[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x135bf1,null))['catch'](handleError(_0x135bf1,null));};exports[_0x91cb('0x25')]=function(_0xddc409,_0x5f456c){return respondWithRpcPromise(_0x91cb('0x26'),_0xddc409['query'])[_0x91cb('0x8')](respondWithResult(_0x5f456c,null))[_0x91cb('0x17')](handleError(_0x5f456c,null));};exports[_0x91cb('0x27')]=function(_0x279ad5,_0x51d0ea){var _0x20bf50;return respondWithRpcPromise('Agents',_0x279ad5[_0x91cb('0x1a')])[_0x91cb('0x8')](function(_0x4e5b4b){_0x20bf50=_0x4e5b4b;return respondWithRpcPromise(_0x91cb('0x28'),_0x279ad5['query'],routingClient);})[_0x91cb('0x8')](function(_0x2eac87){return _[_0x91cb('0x19')]({},_0x2eac87,_0x20bf50);})[_0x91cb('0x8')](respondWithResult(_0x51d0ea,null))['catch'](handleError(_0x51d0ea,null));};exports[_0x91cb('0x29')]=function(_0x5af0e6,_0x2cf27e){if(_0x5af0e6[_0x91cb('0x2a')]&&_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')]&&_0x5af0e6[_0x91cb('0x2c')]&&_0x5af0e6[_0x91cb('0x2c')][_0x91cb('0x10')]){for(var _0x3cc4c1 in _0x5af0e6['body'][_0x91cb('0x2b')]){if(_0x5af0e6['body'][_0x91cb('0x2b')]['hasOwnProperty'](_0x3cc4c1)){db[_0x91cb('0x2d')]['findAll']({'where':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')][_0x91cb('0x10')],'type':_0x91cb('0x2e'),'exitAt':null,'uniqueid':_0x5af0e6[_0x91cb('0x2a')]['interaction'][_0x3cc4c1]&&_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1]['length']?{'$notIn':_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1]}:{'$ne':null}}})[_0x91cb('0x8')](function(_0x32517d){var _0x267efb=moment()[_0x91cb('0x2f')](_0x91cb('0x30'));for(var _0x29d5a1=0x0,_0x396b81=_0x32517d['length'];_0x29d5a1<_0x396b81;_0x29d5a1+=0x1){_0x32517d[_0x29d5a1][_0x91cb('0x31')]({'exitAt':_0x267efb});}});for(var _0x3e20d1=0x0;_0x3e20d1<_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1][_0x91cb('0x32')];_0x3e20d1+=0x1){db[_0x91cb('0x2d')][_0x91cb('0x33')]({'where':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')]['name'],'type':_0x91cb('0x2e'),'uniqueid':_0x5af0e6[_0x91cb('0x2a')][_0x91cb('0x2b')][_0x3cc4c1][_0x3e20d1],'exitAt':null},'defaults':{'channel':_0x3cc4c1,'membername':_0x5af0e6[_0x91cb('0x2c')]['name'],'interface':_[_0x91cb('0x12')](_0x5af0e6[_0x91cb('0x2c')]['interface'])?util[_0x91cb('0x2f')]('SIP/%s',_0x5af0e6[_0x91cb('0x2c')]['name']):_0x5af0e6['user']['interface'],'type':_0x91cb('0x2e'),'enterAt':moment()[_0x91cb('0x2f')](_0x91cb('0x30')),'role':_0x91cb('0x34'),'internal':_0x5af0e6[_0x91cb('0x2c')]['internal'],'uniqueid':_0x5af0e6['body'][_0x91cb('0x2b')][_0x3cc4c1][_0x3e20d1]}});}}}}return respondWithRpcPromise(_0x91cb('0x35'),{'id':_0x5af0e6[_0x91cb('0x1b')]['id'],'capacity':_0x5af0e6[_0x91cb('0x2a')]['capacity']},routingClient)['then'](respondWithResult(_0x2cf27e,null))['catch'](handleError(_0x2cf27e,null));};exports[_0x91cb('0x36')]=function(_0x490417,_0x3f22a1){return respondWithRpcPromise('Telephones',_0x490417[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x3f22a1,null))[_0x91cb('0x17')](handleError(_0x3f22a1,null));};exports[_0x91cb('0x37')]=function(_0x1884bc,_0x362532){return respondWithRpcPromise(_0x91cb('0x38'),_0x1884bc[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x362532,null))[_0x91cb('0x17')](handleError(_0x362532,null));};exports[_0x91cb('0x39')]=function(_0x5752ed,_0x1e445a){return respondWithRpcPromise(_0x91cb('0x3a'),_0x5752ed['query'])[_0x91cb('0x8')](respondWithResult(_0x1e445a,null))[_0x91cb('0x17')](handleError(_0x1e445a,null));};exports['chatQueues']=function(_0x2f5311,_0x166eeb){return respondWithRpcPromise(_0x91cb('0x3b'),_0x2f5311[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x166eeb,null))[_0x91cb('0x17')](handleError(_0x166eeb,null));};exports[_0x91cb('0x3c')]=function(_0x274fff,_0x3320bd){return respondWithRpcPromise(_0x91cb('0x3b'),_0x274fff[_0x91cb('0x1a')],routingClient)['then'](findById(_0x274fff[_0x91cb('0x1b')]['id']))['then'](respondWithResult(_0x3320bd,null))[_0x91cb('0x17')](handleError(_0x3320bd,null));};exports['mailQueues']=function(_0x3dfff9,_0x1b2fec){return respondWithRpcPromise(_0x91cb('0x3d'),_0x3dfff9['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1b2fec,null))[_0x91cb('0x17')](handleError(_0x1b2fec,null));};exports['showMailQueues']=function(_0xef4754,_0x102025){return respondWithRpcPromise(_0x91cb('0x3d'),_0xef4754[_0x91cb('0x1a')],routingClient)['then'](findById(_0xef4754[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x102025,null))[_0x91cb('0x17')](handleError(_0x102025,null));};exports[_0x91cb('0x3e')]=function(_0x55a0e3,_0x11025a){return respondWithRpcPromise(_0x91cb('0x3f'),_0x55a0e3['query'],mailClient)['then'](respondWithResult(_0x11025a,null))[_0x91cb('0x17')](handleError(_0x11025a,null));};exports['openchannelQueues']=function(_0x1180ac,_0x1237fd){return respondWithRpcPromise('OpenchannelQueues',_0x1180ac['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1237fd,null))['catch'](handleError(_0x1237fd,null));};exports[_0x91cb('0x40')]=function(_0x961ebf,_0x33de58){return respondWithRpcPromise('OpenchannelQueues',_0x961ebf[_0x91cb('0x1a')],routingClient)['then'](findById(_0x961ebf[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x33de58,null))[_0x91cb('0x17')](handleError(_0x33de58,null));};exports[_0x91cb('0x41')]=function(_0x483172,_0xb37f8e){return respondWithRpcPromise(_0x91cb('0x42'),_0x483172[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0xb37f8e,null))[_0x91cb('0x17')](handleError(_0xb37f8e,null));};exports[_0x91cb('0x43')]=function(_0x14114d,_0x2785f9){return respondWithRpcPromise(_0x91cb('0x42'),_0x14114d[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x14114d[_0x91cb('0x1b')]['id']))['then'](respondWithResult(_0x2785f9,null))[_0x91cb('0x17')](handleError(_0x2785f9,null));};exports[_0x91cb('0x44')]=function(_0x474682,_0x51ab8a){return respondWithRpcPromise(_0x91cb('0x45'),_0x474682[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x51ab8a,null))['catch'](handleError(_0x51ab8a,null));};exports[_0x91cb('0x46')]=function(_0x5a3c7d,_0x4484d6){return respondWithRpcPromise(_0x91cb('0x45'),_0x5a3c7d[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x5a3c7d['params']['id']))[_0x91cb('0x8')](respondWithResult(_0x4484d6,null))[_0x91cb('0x17')](handleError(_0x4484d6,null));};exports[_0x91cb('0x47')]=function(_0x404b50,_0x1bb16f){return respondWithRpcPromise(_0x91cb('0x48'),_0x404b50['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x1bb16f,null))[_0x91cb('0x17')](handleError(_0x1bb16f,null));};exports[_0x91cb('0x49')]=function(_0x1f0ba2,_0x891569){return respondWithRpcPromise(_0x91cb('0x48'),_0x1f0ba2[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](findById(_0x1f0ba2[_0x91cb('0x1b')]['id']))[_0x91cb('0x8')](respondWithResult(_0x891569,null))[_0x91cb('0x17')](handleError(_0x891569,null));};exports[_0x91cb('0x4a')]=function(_0xda123b,_0x3eead5){return respondWithRpcPromise(_0x91cb('0x4b'),_0xda123b[_0x91cb('0x1a')])[_0x91cb('0x8')](respondWithResult(_0x3eead5,null))['catch'](handleError(_0x3eead5,null));};exports[_0x91cb('0x4c')]=function(_0x1455cd,_0x4b639d){return respondWithRpcPromise(_0x91cb('0x4d'),_0x1455cd[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x4b639d,null))['catch'](handleError(_0x4b639d,null));};exports[_0x91cb('0x4e')]=function(_0x6ecba8,_0x5cd31c){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x6ecba8[_0x91cb('0x1a')],routingClient)['then'](respondWithResult(_0x5cd31c,null))[_0x91cb('0x17')](handleError(_0x5cd31c,null));};exports[_0x91cb('0x4f')]=function(_0x4e11e3,_0x43a8b1){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4e11e3[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x43a8b1,null))['catch'](handleError(_0x43a8b1,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x16a21f,_0x43be3e){return respondWithRpcPromise(_0x91cb('0x50'),_0x16a21f['query'],routingClient)[_0x91cb('0x8')](function(_0x23a458){if(_0x16a21f[_0x91cb('0x1a')][_0x91cb('0x51')]!==undefined){var _0x570f6b=_(_0x23a458[_0x91cb('0x13')])['filter']([_0x16a21f[_0x91cb('0x1a')][_0x91cb('0x51')],_0x16a21f[_0x91cb('0x1b')]['id']])[_0x91cb('0x52')]('queue_id')['uniq']()[_0x91cb('0x53')]();return _0x23a458['rows'][_0x91cb('0x54')](function(_0x3dc6f9){return _0x570f6b[_0x91cb('0x55')](_0x3dc6f9[_0x91cb('0x56')])>-0x1;});}else{return _0x23a458[_0x91cb('0x13')][_0x91cb('0x54')](function(_0x12d3d1){return _0x12d3d1['queue_id']===parseInt(_0x16a21f[_0x91cb('0x1b')]['id']);});}})[_0x91cb('0x8')](respondWithResult(_0x43be3e,null))['catch'](handleError(_0x43be3e,null));};exports[_0x91cb('0x57')]=function(_0x4d5862,_0x35525c){return respondWithRpcPromise(_0x91cb('0x58'),_0x4d5862[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x35525c,null))[_0x91cb('0x17')](handleError(_0x35525c,null));};exports[_0x91cb('0x59')]=function(_0x1459c4,_0x30259d){return respondWithRpcPromise(_0x91cb('0x5a'),_0x1459c4[_0x91cb('0x1a')],routingClient)[_0x91cb('0x8')](respondWithResult(_0x30259d,null))[_0x91cb('0x17')](handleError(_0x30259d,null));};exports[_0x91cb('0x5b')]=function(_0x14882d,_0x22ba54){return respondWithRpcPromise(_0x91cb('0x5c'),_0x14882d['query'],routingClient)[_0x91cb('0x8')](respondWithResult(_0x22ba54,null))['catch'](handleError(_0x22ba54,null));};exports[_0x91cb('0x5d')]=function(_0x123d72){return function(_0x13f358,_0x422928){var _0x319289,_0x1fa3c7;var _0x324bdb=_[_0x91cb('0x5e')](_0x123d72);var _0x569df1=_0x123d72===_0x91cb('0x5f')?_0x91cb('0x60'):'Account';return db[_0x324bdb+'Queue'][_0x91cb('0x61')]({'raw':!![],'where':{'id':_0x13f358['params']['id']}})['then'](function(_0x95f2de){if(_['isNil'](_0x95f2de)){throw new Error(_0x324bdb+_0x91cb('0x62'));}_0x319289=_0x95f2de;return db[_0x324bdb+'Message'][_0x91cb('0x61')]({'where':{'id':_0x13f358[_0x91cb('0x2a')][_0x91cb('0x63')]},'include':[{'model':db[_0x324bdb+_0x91cb('0x64')],'as':'Interaction'},{'model':db[_0x324bdb+_0x569df1],'as':_0x91cb('0x65')}]});})[_0x91cb('0x8')](function(_0x42d07b){if(_[_0x91cb('0x12')](_0x42d07b)){throw new Error(_0x324bdb+_0x91cb('0x66'));}_0x1fa3c7=_0x42d07b;return _0x42d07b[_0x91cb('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x91cb('0x8')](function(){var _0x3cf8c5={'uniqueid':_0x123d72+'.'+_0x1fa3c7['id']+'.'+_0x1fa3c7[_0x91cb('0x64')]['id'],'FromUserId':_0x13f358[_0x91cb('0x2c')]['id'],'type':_0x91cb('0x68')};_0x3cf8c5[_0x324bdb+_0x91cb('0x69')]=_0x1fa3c7['id'];_0x3cf8c5[_0x324bdb+_0x91cb('0x6a')]=_0x1fa3c7[_0x91cb('0x64')]['id'];_0x3cf8c5[_0x91cb('0x6b')+_0x324bdb+_0x569df1+'Id']=_0x1fa3c7[_0x91cb('0x65')]['id'];_0x3cf8c5['To'+_0x324bdb+_0x91cb('0x6c')]=_0x319289['id'];return db[_0x324bdb+_0x91cb('0x6d')][_0x91cb('0x6e')](_0x3cf8c5);})[_0x91cb('0x8')](function(){return respondWithRpcPromise(_0x91cb('0x6f'),{'channel':_0x123d72,'interaction':_0x1fa3c7[_0x91cb('0x64')],'message':_0x1fa3c7,'account':_0x1fa3c7[_0x91cb('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x91cb('0x68'),'appdata':_0x319289[_0x91cb('0x10')]+','+(_0x1fa3c7['Account'][_0x91cb('0x70')]||0x12c),'interval':_0x91cb('0x71')}]},routingClient);})[_0x91cb('0x8')](respondWithResult(_0x422928,null))[_0x91cb('0x17')](handleError(_0x422928,null));};};exports[_0x91cb('0x72')]=function(_0x650ac9,_0x404457){var _0xa9de8b,_0x3bf154;if(_[_0x91cb('0x12')](_0x650ac9[_0x91cb('0x2a')]['channel'])){throw new Error(_0x91cb('0x73'));}var _0x4c459a=_0x650ac9['body'][_0x91cb('0x74')];var _0x265ffb=_[_0x91cb('0x5e')](_0x4c459a);var _0x446738=_0x4c459a===_0x91cb('0x5f')?_0x91cb('0x60'):_0x91cb('0x65');return db[_0x91cb('0x75')][_0x91cb('0x61')]({'raw':!![],'where':{'id':_0x650ac9[_0x91cb('0x1b')]['id'],'role':'agent'}})[_0x91cb('0x8')](function(_0xb784d5){if(_['isNil'](_0xb784d5)){throw new Error(_0x91cb('0x76'));}_0xa9de8b=_0xb784d5;return db[_0x265ffb+_0x91cb('0x77')]['findOne']({'where':{'id':_0x650ac9[_0x91cb('0x2a')][_0x91cb('0x63')]},'include':[{'model':db[_0x265ffb+_0x91cb('0x64')],'as':_0x91cb('0x64')},{'model':db[_0x265ffb+_0x446738],'as':_0x91cb('0x65')}]});})[_0x91cb('0x8')](function(_0x65c551){if(_[_0x91cb('0x12')](_0x65c551)){throw new Error(_0x265ffb+_0x91cb('0x66'));}_0x3bf154=_0x65c551;return _0x65c551[_0x91cb('0x67')]({'read':0x0,'readAt':null,'UserId':null});})[_0x91cb('0x8')](function(){var _0x378cd0={'uniqueid':_0x4c459a+'.'+_0x3bf154['id']+'.'+_0x3bf154['Interaction']['id'],'FromUserId':_0x650ac9['user']['id'],'type':_0x91cb('0x68'),'ToUserId':_0xa9de8b['id']};_0x378cd0[_0x265ffb+_0x91cb('0x69')]=_0x3bf154['id'];_0x378cd0[_0x265ffb+_0x91cb('0x6a')]=_0x3bf154[_0x91cb('0x64')]['id'];_0x378cd0[_0x91cb('0x6b')+_0x265ffb+_0x446738+'Id']=_0x3bf154[_0x91cb('0x65')]['id'];return db[_0x265ffb+_0x91cb('0x6d')]['create'](_0x378cd0);})[_0x91cb('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x4c459a,'interaction':_0x3bf154[_0x91cb('0x64')],'message':_0x3bf154,'account':_0x3bf154[_0x91cb('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0x91cb('0x34'),'appdata':_0xa9de8b[_0x91cb('0x10')]+','+(_0x3bf154[_0x91cb('0x65')]['agentTransferTimeout']||0x12c),'interval':_0x91cb('0x71')}]},routingClient);})[_0x91cb('0x8')](respondWithResult(_0x404457,null))[_0x91cb('0x17')](handleError(_0x404457,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 030af31..d090390 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 _0x8c98=['update','delete','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','/:id','show','get','/:id/run','run','post','create','put'];(function(_0x2958f8,_0x1b8fda){var _0x1a02c0=function(_0x47642c){while(--_0x47642c){_0x2958f8['push'](_0x2958f8['shift']());}};_0x1a02c0(++_0x1b8fda);}(_0x8c98,0x16b));var _0x88c9=function(_0x4fd5d3,_0x214090){_0x4fd5d3=_0x4fd5d3-0x0;var _0xf62a8b=_0x8c98[_0x4fd5d3];return _0xf62a8b;};'use strict';var multer=require(_0x88c9('0x0'));var util=require('util');var path=require(_0x88c9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x88c9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x88c9('0x3'));var interaction=require(_0x88c9('0x4'));var config=require(_0x88c9('0x5'));var controller=require(_0x88c9('0x6'));router['get']('/',auth[_0x88c9('0x7')](),controller[_0x88c9('0x8')]);router['get'](_0x88c9('0x9'),auth[_0x88c9('0x7')](),controller[_0x88c9('0xa')]);router[_0x88c9('0xb')](_0x88c9('0xc'),auth[_0x88c9('0x7')](),controller[_0x88c9('0xd')]);router[_0x88c9('0xe')]('/',auth[_0x88c9('0x7')](),controller[_0x88c9('0xf')]);router[_0x88c9('0x10')](_0x88c9('0x9'),auth[_0x88c9('0x7')](),controller[_0x88c9('0x11')]);router[_0x88c9('0x12')](_0x88c9('0x9'),auth[_0x88c9('0x7')](),controller[_0x88c9('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2e8c=['run','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','show','/:id/run'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2e8c,0xd9));var _0xc2e8=function(_0x181a6c,_0xdb9a9c){_0x181a6c=_0x181a6c-0x0;var _0x22e3c4=_0x2e8c[_0x181a6c];return _0x22e3c4;};'use strict';var multer=require(_0xc2e8('0x0'));var util=require(_0xc2e8('0x1'));var path=require(_0xc2e8('0x2'));var timeout=require(_0xc2e8('0x3'));var express=require(_0xc2e8('0x4'));var router=express[_0xc2e8('0x5')]();var fs_extra=require(_0xc2e8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc2e8('0x7'));var config=require(_0xc2e8('0x8'));var controller=require(_0xc2e8('0x9'));router[_0xc2e8('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc2e8('0xa')]('/:id',auth[_0xc2e8('0xb')](),controller[_0xc2e8('0xc')]);router[_0xc2e8('0xa')](_0xc2e8('0xd'),auth['isAuthenticated'](),controller[_0xc2e8('0xe')]);router['post']('/',auth[_0xc2e8('0xb')](),controller[_0xc2e8('0xf')]);router[_0xc2e8('0x10')](_0xc2e8('0x11'),auth[_0xc2e8('0xb')](),controller[_0xc2e8('0x12')]);router[_0xc2e8('0x13')](_0xc2e8('0x11'),auth[_0xc2e8('0xb')](),controller[_0xc2e8('0x14')]);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 77252ce..6fddd35 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 _0x8ec2=['BOOLEAN','0\x200\x20*\x20*\x20*','INTEGER','ENUM','years','quarters','months','weeks','hours','minutes','days','csv','pdf','custom','default','TEXT','sequelize','exports','STRING'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8ec2,0xf4));var _0x28ec=function(_0x11f8bb,_0x5cc37f){_0x11f8bb=_0x11f8bb-0x0;var _0x2f6f88=_0x8ec2[_0x11f8bb];return _0x2f6f88;};'use strict';var Sequelize=require(_0x28ec('0x0'));module[_0x28ec('0x1')]={'name':{'type':Sequelize[_0x28ec('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x28ec('0x2')]},'active':{'type':Sequelize[_0x28ec('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x28ec('0x2')],'allowNull':![],'defaultValue':_0x28ec('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x28ec('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x28ec('0x6')](_0x28ec('0x7'),_0x28ec('0x8'),_0x28ec('0x9'),_0x28ec('0xa'),'days',_0x28ec('0xb'),_0x28ec('0xc')),'allowNull':![],'defaultValue':_0x28ec('0xd')},'output':{'type':Sequelize['ENUM'](_0x28ec('0xe'),_0x28ec('0xf'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x28ec('0x6')](_0x28ec('0x10'),_0x28ec('0x11')),'allowNull':![],'defaultValue':_0x28ec('0x10')},'sendMail':{'type':Sequelize[_0x28ec('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x28ec('0x2')]},'cc':{'type':Sequelize[_0x28ec('0x12')]},'bcc':{'type':Sequelize[_0x28ec('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x28ec('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4e13=['days','hours','minutes','csv','pdf','xlsx','default','custom','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks'];(function(_0x382168,_0xe03b6a){var _0x3ecf7e=function(_0x17b089){while(--_0x17b089){_0x382168['push'](_0x382168['shift']());}};_0x3ecf7e(++_0xe03b6a);}(_0x4e13,0x1a0));var _0x34e1=function(_0x471a85,_0x239e8d){_0x471a85=_0x471a85-0x0;var _0x5f2039=_0x4e13[_0x471a85];return _0x5f2039;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x34e1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x34e1('0x0')]},'active':{'type':Sequelize[_0x34e1('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x34e1('0x0')],'allowNull':![],'defaultValue':_0x34e1('0x2')},'startAt':{'type':Sequelize[_0x34e1('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x34e1('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x34e1('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x34e1('0x5')]('years',_0x34e1('0x6'),_0x34e1('0x7'),_0x34e1('0x8'),_0x34e1('0x9'),_0x34e1('0xa'),_0x34e1('0xb')),'allowNull':![],'defaultValue':_0x34e1('0x9')},'output':{'type':Sequelize[_0x34e1('0x5')](_0x34e1('0xc'),_0x34e1('0xd'),_0x34e1('0xe')),'allowNull':![],'defaultValue':_0x34e1('0xc')},'type':{'type':Sequelize[_0x34e1('0x5')]('custom',_0x34e1('0xf')),'allowNull':![],'defaultValue':_0x34e1('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x34e1('0x0')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x34e1('0x1')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 32bd63c..b4d7e53 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 _0x2d9a=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','error','stack','name','Schedule','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x486ab6,_0x257c0a){var _0x1ce5ea=function(_0x1443a5){while(--_0x1443a5){_0x486ab6['push'](_0x486ab6['shift']());}};_0x1ce5ea(++_0x257c0a);}(_0x2d9a,0x1b7));var _0xa2d9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2d9a[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xa2d9('0x0'));var rimraf=require(_0xa2d9('0x1'));var zipdir=require(_0xa2d9('0x2'));var jsonpatch=require(_0xa2d9('0x3'));var rp=require(_0xa2d9('0x4'));var moment=require(_0xa2d9('0x5'));var BPromise=require(_0xa2d9('0x6'));var Mustache=require(_0xa2d9('0x7'));var util=require(_0xa2d9('0x8'));var path=require(_0xa2d9('0x9'));var sox=require(_0xa2d9('0xa'));var csv=require('to-csv');var ejs=require(_0xa2d9('0xb'));var fs=require('fs');var fs_extra=require(_0xa2d9('0xc'));var _=require(_0xa2d9('0xd'));var squel=require(_0xa2d9('0xe'));var crypto=require(_0xa2d9('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa2d9('0x10'));var toCsv=require(_0xa2d9('0x11'));var querystring=require(_0xa2d9('0x12'));var Papa=require(_0xa2d9('0x13'));var Redis=require(_0xa2d9('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xa2d9('0x15'));var as=require(_0xa2d9('0x16'));var hardwareService=require(_0xa2d9('0x17'));var logger=require(_0xa2d9('0x18'))(_0xa2d9('0x19'));var utils=require(_0xa2d9('0x1a'));var config=require(_0xa2d9('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2d9('0x1c'))['db'];function respondWithStatusCode(_0x5c8e17,_0x2a7c68){_0x2a7c68=_0x2a7c68||0xcc;return function(_0x26c5e2){if(_0x26c5e2){return _0x5c8e17[_0xa2d9('0x1d')](_0x2a7c68);}return _0x5c8e17[_0xa2d9('0x1e')](_0x2a7c68)[_0xa2d9('0x1f')]();};}function respondWithResult(_0x3202d1,_0xee77d5){_0xee77d5=_0xee77d5||0xc8;return function(_0x16b9f6){if(_0x16b9f6){return _0x3202d1[_0xa2d9('0x1e')](_0xee77d5)[_0xa2d9('0x20')](_0x16b9f6);}};}function respondWithFilteredResult(_0x1cb849,_0x277034){return function(_0x52a53e){if(_0x52a53e){var _0x29b516=typeof _0x277034[_0xa2d9('0x21')]===_0xa2d9('0x22')&&typeof _0x277034[_0xa2d9('0x23')]==='undefined';var _0xd59a77=_0x52a53e[_0xa2d9('0x24')];var _0x1bcaf1=_0x29b516?0x0:_0x277034[_0xa2d9('0x21')];var _0x16c4bb=_0x29b516?_0x52a53e[_0xa2d9('0x24')]:_0x277034[_0xa2d9('0x21')]+_0x277034[_0xa2d9('0x23')];var _0x53d2b2;if(_0x16c4bb>=_0xd59a77){_0x16c4bb=_0xd59a77;_0x53d2b2=0xc8;}else{_0x53d2b2=0xce;}_0x1cb849[_0xa2d9('0x1e')](_0x53d2b2);return _0x1cb849[_0xa2d9('0x25')](_0xa2d9('0x26'),_0x1bcaf1+'-'+_0x16c4bb+'/'+_0xd59a77)[_0xa2d9('0x20')](_0x52a53e);}return null;};}function patchUpdates(_0x5ec324){return function(_0x4f8e9b){try{jsonpatch[_0xa2d9('0x27')](_0x4f8e9b,_0x5ec324,!![]);}catch(_0x58e60c){return BPromise[_0xa2d9('0x28')](_0x58e60c);}return _0x4f8e9b[_0xa2d9('0x29')]();};}function saveUpdates(_0x160cdb,_0x3247dd){return function(_0x4b47ae){if(_0x4b47ae){return _0x4b47ae[_0xa2d9('0x2a')](_0x160cdb)[_0xa2d9('0x2b')](function(_0x5751ef){return _0x5751ef;});}return null;};}function removeEntity(_0x5858e3,_0x8df4a0){return function(_0x547a8e){if(_0x547a8e){return _0x547a8e['destroy']()[_0xa2d9('0x2b')](function(){var _0x148c91=_0x547a8e[_0xa2d9('0x2c')]({'plain':!![]});var _0x57a4b1=_0xa2d9('0x2d');return db[_0xa2d9('0x2e')]['destroy']({'where':{'type':_0x57a4b1,'resourceId':_0x148c91['id']}})[_0xa2d9('0x2b')](function(){return _0x547a8e;});})[_0xa2d9('0x2b')](function(){_0x5858e3[_0xa2d9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46eec3,_0x1ac77b){return function(_0x53582b){if(!_0x53582b){_0x46eec3[_0xa2d9('0x1d')](0x194);}return _0x53582b;};}function handleError(_0xc805ef,_0x28c14a){_0x28c14a=_0x28c14a||0x1f4;return function(_0x4d28a7){logger[_0xa2d9('0x2f')](_0x4d28a7[_0xa2d9('0x30')]);if(_0x4d28a7[_0xa2d9('0x31')]){delete _0x4d28a7[_0xa2d9('0x31')];}_0xc805ef[_0xa2d9('0x1e')](_0x28c14a)['send'](_0x4d28a7);};}exports['index']=function(_0x23fee5,_0xe80144){var _0x32b639={},_0x2be41e={},_0x20b63d={'count':0x0,'rows':[]};var _0x2667db=_['map'](db[_0xa2d9('0x32')][_0xa2d9('0x33')],function(_0x461af3){return{'name':_0x461af3[_0xa2d9('0x34')],'type':_0x461af3[_0xa2d9('0x35')][_0xa2d9('0x36')]};});_0x2be41e[_0xa2d9('0x37')]=_[_0xa2d9('0x38')](_0x2667db,_0xa2d9('0x31'));_0x2be41e[_0xa2d9('0x39')]=_[_0xa2d9('0x3a')](_0x23fee5['query']);_0x2be41e[_0xa2d9('0x3b')]=_[_0xa2d9('0x3c')](_0x2be41e[_0xa2d9('0x37')],_0x2be41e[_0xa2d9('0x39')]);_0x32b639[_0xa2d9('0x3d')]=_[_0xa2d9('0x3c')](_0x2be41e[_0xa2d9('0x37')],qs[_0xa2d9('0x3e')](_0x23fee5[_0xa2d9('0x39')][_0xa2d9('0x3e')]));_0x32b639[_0xa2d9('0x3d')]=_0x32b639[_0xa2d9('0x3d')][_0xa2d9('0x3f')]?_0x32b639[_0xa2d9('0x3d')]:_0x2be41e[_0xa2d9('0x37')];if(!_0x23fee5['query'][_0xa2d9('0x40')](_0xa2d9('0x41'))){_0x32b639[_0xa2d9('0x23')]=qs['limit'](_0x23fee5[_0xa2d9('0x39')][_0xa2d9('0x23')]);_0x32b639[_0xa2d9('0x21')]=qs[_0xa2d9('0x21')](_0x23fee5[_0xa2d9('0x39')][_0xa2d9('0x21')]);}_0x32b639['order']=qs[_0xa2d9('0x42')](_0x23fee5['query']['sort']);_0x32b639[_0xa2d9('0x43')]=qs['filters'](_[_0xa2d9('0x44')](_0x23fee5['query'],_0x2be41e['filters']),_0x2667db);if(_0x23fee5[_0xa2d9('0x39')]['filter']){_0x32b639[_0xa2d9('0x43')]=_[_0xa2d9('0x45')](_0x32b639[_0xa2d9('0x43')],{'$or':_[_0xa2d9('0x38')](_0x2667db,function(_0x42629c){if(_0x42629c[_0xa2d9('0x35')]!==_0xa2d9('0x46')){var _0x496476={};_0x496476[_0x42629c[_0xa2d9('0x31')]]={'$like':'%'+_0x23fee5[_0xa2d9('0x39')][_0xa2d9('0x47')]+'%'};return _0x496476;}})});}_0x32b639=_[_0xa2d9('0x45')]({},_0x32b639,_0x23fee5[_0xa2d9('0x48')]);var _0x30f701={'where':_0x32b639[_0xa2d9('0x43')]};return db[_0xa2d9('0x32')][_0xa2d9('0x24')](_0x30f701)[_0xa2d9('0x2b')](function(_0x45b0c0){_0x20b63d['count']=_0x45b0c0;if(_0x23fee5[_0xa2d9('0x39')][_0xa2d9('0x49')]){_0x32b639['include']=[{'all':!![]}];}return db[_0xa2d9('0x32')][_0xa2d9('0x4a')](_0x32b639);})[_0xa2d9('0x2b')](function(_0x1a9242){_0x20b63d[_0xa2d9('0x4b')]=_0x1a9242;return _0x20b63d;})[_0xa2d9('0x2b')](respondWithFilteredResult(_0xe80144,_0x32b639))[_0xa2d9('0x4c')](handleError(_0xe80144,null));};exports[_0xa2d9('0x4d')]=function(_0x2cd49d,_0x34634a){var _0x1a6479={'raw':![],'where':{'id':_0x2cd49d[_0xa2d9('0x4e')]['id']}},_0x157546={};_0x157546[_0xa2d9('0x37')]=_['keys'](db[_0xa2d9('0x32')][_0xa2d9('0x33')]);_0x157546[_0xa2d9('0x39')]=_[_0xa2d9('0x3a')](_0x2cd49d['query']);_0x157546[_0xa2d9('0x3b')]=_[_0xa2d9('0x3c')](_0x157546['model'],_0x157546['query']);_0x1a6479[_0xa2d9('0x3d')]=_[_0xa2d9('0x3c')](_0x157546[_0xa2d9('0x37')],qs['fields'](_0x2cd49d['query'][_0xa2d9('0x3e')]));_0x1a6479[_0xa2d9('0x3d')]=_0x1a6479['attributes'][_0xa2d9('0x3f')]?_0x1a6479['attributes']:_0x157546[_0xa2d9('0x37')];if(_0x2cd49d[_0xa2d9('0x39')][_0xa2d9('0x49')]){_0x1a6479['include']=[{'all':!![]}];}_0x1a6479=_['merge']({},_0x1a6479,_0x2cd49d['options']);return db['Schedule'][_0xa2d9('0x4f')](_0x1a6479)['then'](handleEntityNotFound(_0x34634a,null))[_0xa2d9('0x2b')](respondWithResult(_0x34634a,null))['catch'](handleError(_0x34634a,null));};exports['create']=function(_0x24d7aa,_0x36b79e){return db[_0xa2d9('0x32')][_0xa2d9('0x50')](_0x24d7aa['body'],{})['then'](function(_0x16ac4f){var _0x20f55e=_0x24d7aa[_0xa2d9('0x51')][_0xa2d9('0x2c')]({'plain':!![]});if(!_0x20f55e)throw new Error(_0xa2d9('0x52'));if(_0x20f55e['role']===_0xa2d9('0x51')){var _0x5b8f17=_0x16ac4f['get']({'plain':!![]});var _0x3318de=_0xa2d9('0x2d');return db[_0xa2d9('0x53')][_0xa2d9('0x4f')]({'where':{'name':_0x3318de,'userProfileId':_0x20f55e[_0xa2d9('0x54')]},'raw':!![]})[_0xa2d9('0x2b')](function(_0x4b9f7d){if(_0x4b9f7d&&_0x4b9f7d[_0xa2d9('0x55')]===0x0){return db[_0xa2d9('0x2e')][_0xa2d9('0x50')]({'name':_0x5b8f17[_0xa2d9('0x31')],'resourceId':_0x5b8f17['id'],'type':_0x4b9f7d[_0xa2d9('0x31')],'sectionId':_0x4b9f7d['id']},{})[_0xa2d9('0x2b')](function(){return _0x16ac4f;});}else{return _0x16ac4f;}})[_0xa2d9('0x4c')](function(_0x54a9c2){logger['error'](_0xa2d9('0x56'),_0x54a9c2);throw _0x54a9c2;});}return _0x16ac4f;})[_0xa2d9('0x2b')](respondWithResult(_0x36b79e,0xc9))[_0xa2d9('0x4c')](handleError(_0x36b79e,null));};exports['update']=function(_0x662cbc,_0x3d8ac5){if(_0x662cbc['body']['id']){delete _0x662cbc['body']['id'];}return db[_0xa2d9('0x32')][_0xa2d9('0x4f')]({'where':{'id':_0x662cbc[_0xa2d9('0x4e')]['id']}})[_0xa2d9('0x2b')](handleEntityNotFound(_0x3d8ac5,null))[_0xa2d9('0x2b')](saveUpdates(_0x662cbc[_0xa2d9('0x57')],null))[_0xa2d9('0x2b')](respondWithResult(_0x3d8ac5,null))[_0xa2d9('0x4c')](handleError(_0x3d8ac5,null));};exports['destroy']=function(_0x95c31c,_0x792adb){return db[_0xa2d9('0x32')][_0xa2d9('0x4f')]({'where':{'id':_0x95c31c[_0xa2d9('0x4e')]['id']}})[_0xa2d9('0x2b')](handleEntityNotFound(_0x792adb,null))['then'](removeEntity(_0x792adb,null))[_0xa2d9('0x4c')](handleError(_0x792adb,null));};exports[_0xa2d9('0x58')]=function(_0x279a1a,_0x2cb121,_0x41f4a9){var _0x1e3ce1=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x279a1a['params']['id']},'raw':!![]})[_0xa2d9('0x2b')](handleEntityNotFound(_0x2cb121,null))['then'](function(){_0x1e3ce1['run'](_0x279a1a[_0xa2d9('0x4e')]['id']);})['then'](respondWithStatusCode(_0x2cb121,null))[_0xa2d9('0x4c')](handleError(_0x2cb121,null));}; \ No newline at end of file +var _0xd3dd=['get','Scheduler','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Schedule','includeAll','include','rows','show','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy'];(function(_0xfb4753,_0x38a20a){var _0xd14352=function(_0x3ab5ac){while(--_0x3ab5ac){_0xfb4753['push'](_0xfb4753['shift']());}};_0xd14352(++_0x38a20a);}(_0xd3dd,0x89));var _0xdd3d=function(_0x515652,_0x18657c){_0x515652=_0x515652-0x0;var _0x3a8ea5=_0xd3dd[_0x515652];return _0x3a8ea5;};'use strict';var emlformat=require(_0xdd3d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd3d('0x1'));var jsonpatch=require(_0xdd3d('0x2'));var rp=require(_0xdd3d('0x3'));var moment=require(_0xdd3d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdd3d('0x5'));var util=require(_0xdd3d('0x6'));var path=require(_0xdd3d('0x7'));var sox=require(_0xdd3d('0x8'));var csv=require(_0xdd3d('0x9'));var ejs=require(_0xdd3d('0xa'));var fs=require('fs');var fs_extra=require(_0xdd3d('0xb'));var _=require(_0xdd3d('0xc'));var squel=require(_0xdd3d('0xd'));var crypto=require('crypto');var jsforce=require(_0xdd3d('0xe'));var deskjs=require(_0xdd3d('0xf'));var toCsv=require(_0xdd3d('0x9'));var querystring=require(_0xdd3d('0x10'));var Papa=require(_0xdd3d('0x11'));var Redis=require(_0xdd3d('0x12'));var authService=require(_0xdd3d('0x13'));var qs=require(_0xdd3d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd3d('0x15'));var logger=require(_0xdd3d('0x16'))(_0xdd3d('0x17'));var utils=require(_0xdd3d('0x18'));var config=require(_0xdd3d('0x19'));var licenseUtil=require(_0xdd3d('0x1a'));var db=require(_0xdd3d('0x1b'))['db'];function respondWithStatusCode(_0x34a7ba,_0x2be8d4){_0x2be8d4=_0x2be8d4||0xcc;return function(_0x363529){if(_0x363529){return _0x34a7ba[_0xdd3d('0x1c')](_0x2be8d4);}return _0x34a7ba[_0xdd3d('0x1d')](_0x2be8d4)['end']();};}function respondWithResult(_0xdd4071,_0x3f5c1a){_0x3f5c1a=_0x3f5c1a||0xc8;return function(_0x1476b4){if(_0x1476b4){return _0xdd4071[_0xdd3d('0x1d')](_0x3f5c1a)[_0xdd3d('0x1e')](_0x1476b4);}};}function respondWithFilteredResult(_0x155eda,_0x329f7a){return function(_0x43bfd6){if(_0x43bfd6){var _0x5587f7=typeof _0x329f7a[_0xdd3d('0x1f')]===_0xdd3d('0x20')&&typeof _0x329f7a[_0xdd3d('0x21')]===_0xdd3d('0x20');var _0x34f903=_0x43bfd6[_0xdd3d('0x22')];var _0x4379b5=_0x5587f7?0x0:_0x329f7a[_0xdd3d('0x1f')];var _0x5d5b15=_0x5587f7?_0x43bfd6[_0xdd3d('0x22')]:_0x329f7a[_0xdd3d('0x1f')]+_0x329f7a[_0xdd3d('0x21')];var _0x27cb69;if(_0x5d5b15>=_0x34f903){_0x5d5b15=_0x34f903;_0x27cb69=0xc8;}else{_0x27cb69=0xce;}_0x155eda[_0xdd3d('0x1d')](_0x27cb69);return _0x155eda[_0xdd3d('0x23')](_0xdd3d('0x24'),_0x4379b5+'-'+_0x5d5b15+'/'+_0x34f903)['json'](_0x43bfd6);}return null;};}function patchUpdates(_0x2a1679){return function(_0x4e0101){try{jsonpatch['apply'](_0x4e0101,_0x2a1679,!![]);}catch(_0x94c787){return BPromise['reject'](_0x94c787);}return _0x4e0101[_0xdd3d('0x25')]();};}function saveUpdates(_0x260233,_0x237f46){return function(_0x1f3104){if(_0x1f3104){return _0x1f3104[_0xdd3d('0x26')](_0x260233)[_0xdd3d('0x27')](function(_0x110571){return _0x110571;});}return null;};}function removeEntity(_0x30c08c,_0x301527){return function(_0x5838e6){if(_0x5838e6){return _0x5838e6[_0xdd3d('0x28')]()[_0xdd3d('0x27')](function(){var _0x55f0c7=_0x5838e6[_0xdd3d('0x29')]({'plain':!![]});var _0x21b0e5=_0xdd3d('0x2a');return db[_0xdd3d('0x2b')][_0xdd3d('0x28')]({'where':{'type':_0x21b0e5,'resourceId':_0x55f0c7['id']}})[_0xdd3d('0x27')](function(){return _0x5838e6;});})[_0xdd3d('0x27')](function(){_0x30c08c[_0xdd3d('0x1d')](0xcc)[_0xdd3d('0x2c')]();});}};}function handleEntityNotFound(_0x2b5107,_0x311d22){return function(_0x27fd0f){if(!_0x27fd0f){_0x2b5107['sendStatus'](0x194);}return _0x27fd0f;};}function handleError(_0xc5e6d3,_0x21741c){_0x21741c=_0x21741c||0x1f4;return function(_0x281eca){logger['error'](_0x281eca['stack']);if(_0x281eca[_0xdd3d('0x2d')]){delete _0x281eca[_0xdd3d('0x2d')];}_0xc5e6d3[_0xdd3d('0x1d')](_0x21741c)[_0xdd3d('0x2e')](_0x281eca);};}exports[_0xdd3d('0x2f')]=function(_0x4002a1,_0x26e5af){var _0xe0550c={},_0x1ddd87={},_0x14b28b={'count':0x0,'rows':[]};var _0x348979=_[_0xdd3d('0x30')](db['Schedule'][_0xdd3d('0x31')],function(_0x6c72){return{'name':_0x6c72[_0xdd3d('0x32')],'type':_0x6c72[_0xdd3d('0x33')][_0xdd3d('0x34')]};});_0x1ddd87[_0xdd3d('0x35')]=_['map'](_0x348979,'name');_0x1ddd87[_0xdd3d('0x36')]=_[_0xdd3d('0x37')](_0x4002a1[_0xdd3d('0x36')]);_0x1ddd87[_0xdd3d('0x38')]=_['intersection'](_0x1ddd87[_0xdd3d('0x35')],_0x1ddd87[_0xdd3d('0x36')]);_0xe0550c['attributes']=_[_0xdd3d('0x39')](_0x1ddd87['model'],qs[_0xdd3d('0x3a')](_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x3a')]));_0xe0550c['attributes']=_0xe0550c[_0xdd3d('0x3b')]['length']?_0xe0550c['attributes']:_0x1ddd87['model'];if(!_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x3c')]('nolimit')){_0xe0550c[_0xdd3d('0x21')]=qs[_0xdd3d('0x21')](_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x21')]);_0xe0550c[_0xdd3d('0x1f')]=qs['offset'](_0x4002a1['query'][_0xdd3d('0x1f')]);}_0xe0550c[_0xdd3d('0x3d')]=qs[_0xdd3d('0x3e')](_0x4002a1[_0xdd3d('0x36')]['sort']);_0xe0550c[_0xdd3d('0x3f')]=qs['filters'](_[_0xdd3d('0x40')](_0x4002a1[_0xdd3d('0x36')],_0x1ddd87[_0xdd3d('0x38')]),_0x348979);if(_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x41')]){_0xe0550c[_0xdd3d('0x3f')]=_[_0xdd3d('0x42')](_0xe0550c['where'],{'$or':_['map'](_0x348979,function(_0x4120c7){if(_0x4120c7[_0xdd3d('0x33')]!==_0xdd3d('0x43')){var _0x447815={};_0x447815[_0x4120c7[_0xdd3d('0x2d')]]={'$like':'%'+_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x41')]+'%'};return _0x447815;}})});}_0xe0550c=_[_0xdd3d('0x42')]({},_0xe0550c,_0x4002a1[_0xdd3d('0x44')]);var _0x16f46a={'where':_0xe0550c[_0xdd3d('0x3f')]};return db[_0xdd3d('0x45')][_0xdd3d('0x22')](_0x16f46a)[_0xdd3d('0x27')](function(_0x2e7e09){_0x14b28b[_0xdd3d('0x22')]=_0x2e7e09;if(_0x4002a1[_0xdd3d('0x36')][_0xdd3d('0x46')]){_0xe0550c[_0xdd3d('0x47')]=[{'all':!![]}];}return db[_0xdd3d('0x45')]['findAll'](_0xe0550c);})[_0xdd3d('0x27')](function(_0x55ca04){_0x14b28b[_0xdd3d('0x48')]=_0x55ca04;return _0x14b28b;})[_0xdd3d('0x27')](respondWithFilteredResult(_0x26e5af,_0xe0550c))['catch'](handleError(_0x26e5af,null));};exports[_0xdd3d('0x49')]=function(_0x32c95f,_0x172ffe){var _0x118221={'raw':![],'where':{'id':_0x32c95f['params']['id']}},_0x267b40={};_0x267b40['model']=_[_0xdd3d('0x37')](db[_0xdd3d('0x45')][_0xdd3d('0x31')]);_0x267b40[_0xdd3d('0x36')]=_['keys'](_0x32c95f[_0xdd3d('0x36')]);_0x267b40[_0xdd3d('0x38')]=_[_0xdd3d('0x39')](_0x267b40['model'],_0x267b40[_0xdd3d('0x36')]);_0x118221[_0xdd3d('0x3b')]=_['intersection'](_0x267b40[_0xdd3d('0x35')],qs[_0xdd3d('0x3a')](_0x32c95f['query'][_0xdd3d('0x3a')]));_0x118221['attributes']=_0x118221[_0xdd3d('0x3b')][_0xdd3d('0x4a')]?_0x118221[_0xdd3d('0x3b')]:_0x267b40[_0xdd3d('0x35')];if(_0x32c95f[_0xdd3d('0x36')][_0xdd3d('0x46')]){_0x118221['include']=[{'all':!![]}];}_0x118221=_[_0xdd3d('0x42')]({},_0x118221,_0x32c95f['options']);return db[_0xdd3d('0x45')][_0xdd3d('0x4b')](_0x118221)[_0xdd3d('0x27')](handleEntityNotFound(_0x172ffe,null))[_0xdd3d('0x27')](respondWithResult(_0x172ffe,null))[_0xdd3d('0x4c')](handleError(_0x172ffe,null));};exports[_0xdd3d('0x4d')]=function(_0x5cce7d,_0x319c76){return db[_0xdd3d('0x45')][_0xdd3d('0x4d')](_0x5cce7d[_0xdd3d('0x4e')],{})[_0xdd3d('0x27')](function(_0x2fa5c2){var _0x4198d5=_0x5cce7d[_0xdd3d('0x4f')]['get']({'plain':!![]});if(!_0x4198d5)throw new Error(_0xdd3d('0x50'));if(_0x4198d5['role']===_0xdd3d('0x4f')){var _0x34aab6=_0x2fa5c2['get']({'plain':!![]});var _0x5c2aa5='Scheduler';return db[_0xdd3d('0x51')]['find']({'where':{'name':_0x5c2aa5,'userProfileId':_0x4198d5[_0xdd3d('0x52')]},'raw':!![]})[_0xdd3d('0x27')](function(_0x11f18d){if(_0x11f18d&&_0x11f18d[_0xdd3d('0x53')]===0x0){return db[_0xdd3d('0x2b')][_0xdd3d('0x4d')]({'name':_0x34aab6[_0xdd3d('0x2d')],'resourceId':_0x34aab6['id'],'type':_0x11f18d[_0xdd3d('0x2d')],'sectionId':_0x11f18d['id']},{})[_0xdd3d('0x27')](function(){return _0x2fa5c2;});}else{return _0x2fa5c2;}})['catch'](function(_0x2b0439){logger[_0xdd3d('0x54')](_0xdd3d('0x55'),_0x2b0439);throw _0x2b0439;});}return _0x2fa5c2;})[_0xdd3d('0x27')](respondWithResult(_0x319c76,0xc9))[_0xdd3d('0x4c')](handleError(_0x319c76,null));};exports['update']=function(_0x229e79,_0x19e8d9){if(_0x229e79[_0xdd3d('0x4e')]['id']){delete _0x229e79['body']['id'];}return db[_0xdd3d('0x45')][_0xdd3d('0x4b')]({'where':{'id':_0x229e79[_0xdd3d('0x56')]['id']}})[_0xdd3d('0x27')](handleEntityNotFound(_0x19e8d9,null))[_0xdd3d('0x27')](saveUpdates(_0x229e79[_0xdd3d('0x4e')],null))[_0xdd3d('0x27')](respondWithResult(_0x19e8d9,null))[_0xdd3d('0x4c')](handleError(_0x19e8d9,null));};exports['destroy']=function(_0x3feaa0,_0x300eda){return db[_0xdd3d('0x45')][_0xdd3d('0x4b')]({'where':{'id':_0x3feaa0['params']['id']}})[_0xdd3d('0x27')](handleEntityNotFound(_0x300eda,null))[_0xdd3d('0x27')](removeEntity(_0x300eda,null))[_0xdd3d('0x4c')](handleError(_0x300eda,null));};exports[_0xdd3d('0x57')]=function(_0x300518,_0x23b2c6,_0x43e260){var _0x2a3350=require(_0xdd3d('0x58'));return db[_0xdd3d('0x45')][_0xdd3d('0x4b')]({'where':{'id':_0x300518[_0xdd3d('0x56')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x23b2c6,null))[_0xdd3d('0x27')](function(){_0x2a3350[_0xdd3d('0x57')](_0x300518['params']['id']);})[_0xdd3d('0x27')](respondWithStatusCode(_0x23b2c6,null))[_0xdd3d('0x4c')](handleError(_0x23b2c6,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 8916649..42d2b46 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 _0x4fb0=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x4fb0,0xb2));var _0x04fb=function(_0x34b453,_0x45779b){_0x34b453=_0x34b453-0x0;var _0x280913=_0x4fb0[_0x34b453];return _0x280913;};'use strict';var _=require(_0x04fb('0x0'));var util=require(_0x04fb('0x1'));var logger=require(_0x04fb('0x2'))(_0x04fb('0x3'));var moment=require(_0x04fb('0x4'));var BPromise=require(_0x04fb('0x5'));var rp=require(_0x04fb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x04fb('0x7'));var attributes=require(_0x04fb('0x8'));module[_0x04fb('0x9')]=function(_0x305d0c,_0xa6bb54){return _0x305d0c[_0x04fb('0xa')](_0x04fb('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf26b=['Schedule','tools_schedules','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./schedule.attributes','exports','define'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf26b,0x7a));var _0xbf26=function(_0x5dbf38,_0x1ff06d){_0x5dbf38=_0x5dbf38-0x0;var _0x4ea452=_0xf26b[_0x5dbf38];return _0x4ea452;};'use strict';var _=require(_0xbf26('0x0'));var util=require(_0xbf26('0x1'));var logger=require(_0xbf26('0x2'))('api');var moment=require(_0xbf26('0x3'));var BPromise=require('bluebird');var rp=require(_0xbf26('0x4'));var fs=require('fs');var path=require(_0xbf26('0x5'));var rimraf=require('rimraf');var config=require(_0xbf26('0x6'));var attributes=require(_0xbf26('0x7'));module[_0xbf26('0x8')]=function(_0x47f392,_0x10a572){return _0x47f392[_0xbf26('0x9')](_0xbf26('0xa'),attributes,{'tableName':_0xbf26('0xb'),'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 383d2f4..d616464 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 _0x4135=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4135,0x74));var _0x5413=function(_0x17c2c1,_0x134ca3){_0x17c2c1=_0x17c2c1-0x0;var _0x2f5830=_0x4135[_0x17c2c1];return _0x2f5830;};'use strict';var _=require(_0x5413('0x0'));var util=require(_0x5413('0x1'));var moment=require(_0x5413('0x2'));var BPromise=require(_0x5413('0x3'));var rs=require(_0x5413('0x4'));var fs=require('fs');var Redis=require(_0x5413('0x5'));var db=require(_0x5413('0x6'))['db'];var utils=require(_0x5413('0x7'));var logger=require(_0x5413('0x8'))(_0x5413('0x9'));var config=require(_0x5413('0xa'));var jayson=require(_0x5413('0xb'));var client=jayson[_0x5413('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x537595,_0x292121,_0x4fdd2e){return new BPromise(function(_0x259279,_0x4c2c4b){return client[_0x5413('0xd')](_0x537595,_0x4fdd2e)[_0x5413('0xe')](function(_0x23e53a){logger[_0x5413('0xf')](_0x5413('0x10'),_0x292121,_0x5413('0x11'));logger[_0x5413('0x12')](_0x5413('0x13'),_0x292121,_0x5413('0x11'),JSON['stringify'](_0x23e53a));if(_0x23e53a[_0x5413('0x14')]){if(_0x23e53a['error'][_0x5413('0x15')]===0x1f4){logger['error'](_0x5413('0x10'),_0x292121,_0x23e53a[_0x5413('0x14')]['message']);return _0x4c2c4b(_0x23e53a[_0x5413('0x14')][_0x5413('0x16')]);}logger['error'](_0x5413('0x10'),_0x292121,_0x23e53a['error'][_0x5413('0x16')]);return _0x259279(_0x23e53a[_0x5413('0x14')]['message']);}else{logger['info'](_0x5413('0x10'),_0x292121,'request\x20sent');_0x259279(_0x23e53a[_0x5413('0x17')]['message']);}})['catch'](function(_0x3b5886){logger[_0x5413('0x14')](_0x5413('0x10'),_0x292121,_0x3b5886);_0x4c2c4b(_0x3b5886);});});} \ No newline at end of file +var _0x4f6d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','Schedule,\x20%s,\x20%s','message','result','lodash','moment'];(function(_0x546867,_0x1cab21){var _0x43cafe=function(_0x255204){while(--_0x255204){_0x546867['push'](_0x546867['shift']());}};_0x43cafe(++_0x1cab21);}(_0x4f6d,0x112));var _0xd4f6=function(_0x2fbe18,_0x4620b5){_0x2fbe18=_0x2fbe18-0x0;var _0x2f8808=_0x4f6d[_0x2fbe18];return _0x2f8808;};'use strict';var _=require(_0xd4f6('0x0'));var util=require('util');var moment=require(_0xd4f6('0x1'));var BPromise=require(_0xd4f6('0x2'));var rs=require(_0xd4f6('0x3'));var fs=require('fs');var Redis=require(_0xd4f6('0x4'));var db=require(_0xd4f6('0x5'))['db'];var utils=require(_0xd4f6('0x6'));var logger=require(_0xd4f6('0x7'))(_0xd4f6('0x8'));var config=require(_0xd4f6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd4f6('0xa')][_0xd4f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25218c,_0x451599,_0x20e808){return new BPromise(function(_0x91919e,_0x12cf2b){return client[_0xd4f6('0xc')](_0x25218c,_0x20e808)[_0xd4f6('0xd')](function(_0x29ca1a){logger[_0xd4f6('0xe')]('Schedule,\x20%s,\x20%s',_0x451599,_0xd4f6('0xf'));logger[_0xd4f6('0x10')](_0xd4f6('0x11'),_0x451599,'request\x20sent',JSON['stringify'](_0x29ca1a));if(_0x29ca1a[_0xd4f6('0x12')]){if(_0x29ca1a[_0xd4f6('0x12')][_0xd4f6('0x13')]===0x1f4){logger[_0xd4f6('0x12')](_0xd4f6('0x14'),_0x451599,_0x29ca1a[_0xd4f6('0x12')][_0xd4f6('0x15')]);return _0x12cf2b(_0x29ca1a[_0xd4f6('0x12')]['message']);}logger[_0xd4f6('0x12')](_0xd4f6('0x14'),_0x451599,_0x29ca1a[_0xd4f6('0x12')][_0xd4f6('0x15')]);return _0x91919e(_0x29ca1a['error'][_0xd4f6('0x15')]);}else{logger[_0xd4f6('0xe')](_0xd4f6('0x14'),_0x451599,'request\x20sent');_0x91919e(_0x29ca1a[_0xd4f6('0x16')]['message']);}})['catch'](function(_0xebc6fa){logger[_0xd4f6('0x12')](_0xd4f6('0x14'),_0x451599,_0xebc6fa);_0x12cf2b(_0xebc6fa);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e91a018..731868a 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 _0xf106=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','create','delete','destroy','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf106,0x7c));var _0x6f10=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0xf106[_0x500c0];return _0xdd146f;};'use strict';var multer=require(_0x6f10('0x0'));var util=require(_0x6f10('0x1'));var path=require(_0x6f10('0x2'));var timeout=require(_0x6f10('0x3'));var express=require(_0x6f10('0x4'));var router=express[_0x6f10('0x5')]();var fs_extra=require(_0x6f10('0x6'));var auth=require(_0x6f10('0x7'));var interaction=require(_0x6f10('0x8'));var config=require(_0x6f10('0x9'));var controller=require(_0x6f10('0xa'));router[_0x6f10('0xb')]('/',auth[_0x6f10('0xc')](),controller[_0x6f10('0xd')]);router[_0x6f10('0xb')](_0x6f10('0xe'),auth['isAuthenticated'](),controller[_0x6f10('0xf')]);router[_0x6f10('0xb')](_0x6f10('0x10'),auth[_0x6f10('0xc')](),controller[_0x6f10('0x11')]);router['get'](_0x6f10('0x12'),auth['isAuthenticated'](),controller[_0x6f10('0x13')]);router[_0x6f10('0x14')]('/',auth['isAuthenticated'](),controller[_0x6f10('0x15')]);router['put'](_0x6f10('0x10'),auth[_0x6f10('0xc')](),controller['update']);router[_0x6f10('0x16')](_0x6f10('0x10'),auth[_0x6f10('0xc')](),controller[_0x6f10('0x17')]);module[_0x6f10('0x18')]=router; \ No newline at end of file +var _0xbc4b=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','create','/:id','destroy','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbc4b,0x15e));var _0xbbc4=function(_0x3f6b79,_0x4b1ab4){_0x3f6b79=_0x3f6b79-0x0;var _0xf983f7=_0xbc4b[_0x3f6b79];return _0xf983f7;};'use strict';var multer=require(_0xbbc4('0x0'));var util=require(_0xbbc4('0x1'));var path=require(_0xbbc4('0x2'));var timeout=require(_0xbbc4('0x3'));var express=require(_0xbbc4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbbc4('0x5'));var interaction=require(_0xbbc4('0x6'));var config=require(_0xbbc4('0x7'));var controller=require(_0xbbc4('0x8'));router[_0xbbc4('0x9')]('/',auth[_0xbbc4('0xa')](),controller[_0xbbc4('0xb')]);router['get'](_0xbbc4('0xc'),auth['isAuthenticated'](),controller[_0xbbc4('0xd')]);router[_0xbbc4('0x9')]('/:id',auth[_0xbbc4('0xa')](),controller[_0xbbc4('0xe')]);router['get'](_0xbbc4('0xf'),auth[_0xbbc4('0xa')](),controller[_0xbbc4('0x10')]);router[_0xbbc4('0x11')]('/',auth[_0xbbc4('0xa')](),controller[_0xbbc4('0x12')]);router['put'](_0xbbc4('0x13'),auth[_0xbbc4('0xa')](),controller['update']);router['delete'](_0xbbc4('0x13'),auth[_0xbbc4('0xa')](),controller[_0xbbc4('0x14')]);module[_0xbbc4('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 7047e57..8ce561a 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 _0x79d7=['VIRTUAL','getDataValue','value','STRING','replace','setDataValue','startedAt','subtract','closedAt','duration','format','toString','DATE','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','path','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79d7,0x9c));var _0x779d=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x79d7[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x779d('0x0'));var moment=require('moment');var path=require(_0x779d('0x1'));var config=require(_0x779d('0x2'));module[_0x779d('0x3')]={'format':{'type':Sequelize[_0x779d('0x4')],'get':function(){return this[_0x779d('0x5')](_0x779d('0x6'))?path['extname'](this[_0x779d('0x5')](_0x779d('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x779d('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x227c87){var _0x4c7fb4=_0x227c87[_0x779d('0x8')](/\\/g,'/');this[_0x779d('0x9')]('value',_0x4c7fb4);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x5b4ef2){this[_0x779d('0x9')](_0x779d('0xa'),moment()[_0x779d('0xb')](_0x5b4ef2,'ms'));this['setDataValue'](_0x779d('0xc'),moment());this['setDataValue'](_0x779d('0xd'),_0x5b4ef2);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x779d('0x5')](_0x779d('0xa')))[_0x779d('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x779d('0xf')]();}},'closedAt':{'type':Sequelize[_0x779d('0x10')],'get':function(){return moment(this[_0x779d('0x5')](_0x779d('0xc')))[_0x779d('0xe')](_0x779d('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x779d('0x10')],'get':function(){return moment(this[_0x779d('0x5')](_0x779d('0x12')))[_0x779d('0xe')](_0x779d('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x779d('0x10')],'get':function(){return moment(this[_0x779d('0x5')](_0x779d('0x13')))['format'](_0x779d('0x11'))[_0x779d('0xf')]();}}}; \ No newline at end of file +var _0x7d06=['format','DATE','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','subtract','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7d06,0x158));var _0x67d0=function(_0x51c3e1,_0x4463b7){_0x51c3e1=_0x51c3e1-0x0;var _0x3db8b8=_0x7d06[_0x51c3e1];return _0x3db8b8;};'use strict';var Sequelize=require(_0x67d0('0x0'));var moment=require(_0x67d0('0x1'));var path=require(_0x67d0('0x2'));var config=require(_0x67d0('0x3'));module[_0x67d0('0x4')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x67d0('0x5')](_0x67d0('0x6'))?path[_0x67d0('0x7')](this['getDataValue'](_0x67d0('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x67d0('0x8')]},'value':{'type':Sequelize[_0x67d0('0x8')],'set':function(_0x367f1d){var _0xe4789b=_0x367f1d[_0x67d0('0x9')](/\\/g,'/');this['setDataValue'](_0x67d0('0x6'),_0xe4789b);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x67d0('0xa')],'set':function(_0x5916d0){this[_0x67d0('0xb')](_0x67d0('0xc'),moment()[_0x67d0('0xd')](_0x5916d0,'ms'));this[_0x67d0('0xb')]('closedAt',moment());this[_0x67d0('0xb')]('duration',_0x5916d0);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x67d0('0x5')](_0x67d0('0xc')))['format'](_0x67d0('0xe'))[_0x67d0('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x67d0('0x5')]('closedAt'))[_0x67d0('0x10')](_0x67d0('0xe'))[_0x67d0('0xf')]();}},'createdAt':{'type':Sequelize[_0x67d0('0x11')],'get':function(){return moment(this[_0x67d0('0x5')](_0x67d0('0x12')))[_0x67d0('0x10')](_0x67d0('0xe'))[_0x67d0('0xf')]();}},'updatedAt':{'type':Sequelize[_0x67d0('0x11')],'get':function(){return moment(this['getDataValue'](_0x67d0('0x13')))[_0x67d0('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x67d0('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 77eb0d7..c6567e2 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 _0x8d0e=['name','send','map','fieldName','type','key','format','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','rows','catch','show','includeAll','include','ScreenRecording','find','create','body','duration','value','params','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','filename','unlink','ScreenRecording\x20not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','stack'];(function(_0x31980e,_0x2bb678){var _0x106113=function(_0x441575){while(--_0x441575){_0x31980e['push'](_0x31980e['shift']());}};_0x106113(++_0x2bb678);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x3f9330,_0x3d5531){_0x3f9330=_0x3f9330-0x0;var _0x397364=_0x8d0e[_0x3f9330];return _0x397364;};'use strict';var emlformat=require(_0xe8d0('0x0'));var rimraf=require(_0xe8d0('0x1'));var zipdir=require(_0xe8d0('0x2'));var jsonpatch=require(_0xe8d0('0x3'));var rp=require(_0xe8d0('0x4'));var moment=require(_0xe8d0('0x5'));var BPromise=require(_0xe8d0('0x6'));var Mustache=require(_0xe8d0('0x7'));var util=require(_0xe8d0('0x8'));var path=require('path');var sox=require(_0xe8d0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8d0('0xa'));var _=require(_0xe8d0('0xb'));var squel=require(_0xe8d0('0xc'));var crypto=require(_0xe8d0('0xd'));var jsforce=require(_0xe8d0('0xe'));var deskjs=require(_0xe8d0('0xf'));var toCsv=require(_0xe8d0('0x10'));var querystring=require(_0xe8d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xe8d0('0x12'));var authService=require(_0xe8d0('0x13'));var qs=require(_0xe8d0('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8d0('0x15'))(_0xe8d0('0x16'));var utils=require(_0xe8d0('0x17'));var config=require(_0xe8d0('0x18'));var licenseUtil=require(_0xe8d0('0x19'));var db=require(_0xe8d0('0x1a'))['db'];function respondWithStatusCode(_0x5934b2,_0x38fac0){_0x38fac0=_0x38fac0||0xcc;return function(_0x15b9e5){if(_0x15b9e5){return _0x5934b2['sendStatus'](_0x38fac0);}return _0x5934b2[_0xe8d0('0x1b')](_0x38fac0)['end']();};}function respondWithResult(_0x59b4b7,_0x90a1ea){_0x90a1ea=_0x90a1ea||0xc8;return function(_0x2aa906){if(_0x2aa906){return _0x59b4b7[_0xe8d0('0x1b')](_0x90a1ea)[_0xe8d0('0x1c')](_0x2aa906);}};}function respondWithFilteredResult(_0x15d3a1,_0x7151c6){return function(_0x52818a){if(_0x52818a){var _0x6ccffa=typeof _0x7151c6['offset']===_0xe8d0('0x1d')&&typeof _0x7151c6[_0xe8d0('0x1e')]===_0xe8d0('0x1d');var _0x4d1db4=_0x52818a['count'];var _0x47c67a=_0x6ccffa?0x0:_0x7151c6[_0xe8d0('0x1f')];var _0x384854=_0x6ccffa?_0x52818a[_0xe8d0('0x20')]:_0x7151c6[_0xe8d0('0x1f')]+_0x7151c6[_0xe8d0('0x1e')];var _0x588133;if(_0x384854>=_0x4d1db4){_0x384854=_0x4d1db4;_0x588133=0xc8;}else{_0x588133=0xce;}_0x15d3a1[_0xe8d0('0x1b')](_0x588133);return _0x15d3a1[_0xe8d0('0x21')]('Content-Range',_0x47c67a+'-'+_0x384854+'/'+_0x4d1db4)['json'](_0x52818a);}return null;};}function patchUpdates(_0x554402){return function(_0x384a60){try{jsonpatch[_0xe8d0('0x22')](_0x384a60,_0x554402,!![]);}catch(_0x25363b){return BPromise[_0xe8d0('0x23')](_0x25363b);}return _0x384a60[_0xe8d0('0x24')]();};}function saveUpdates(_0x23a945,_0x1bd25c){return function(_0x28a6b5){if(_0x28a6b5){return _0x28a6b5[_0xe8d0('0x25')](_0x23a945)['then'](function(_0xed8f2e){return _0xed8f2e;});}return null;};}function removeEntity(_0x9f747,_0x572c25){return function(_0x106614){if(_0x106614){return _0x106614[_0xe8d0('0x26')]()[_0xe8d0('0x27')](function(){_0x9f747[_0xe8d0('0x1b')](0xcc)[_0xe8d0('0x28')]();});}};}function handleEntityNotFound(_0x149dfd,_0x31519b){return function(_0x32f0c1){if(!_0x32f0c1){_0x149dfd[_0xe8d0('0x29')](0x194);}return _0x32f0c1;};}function handleError(_0x2dee67,_0x264de4){_0x264de4=_0x264de4||0x1f4;return function(_0x539548){logger[_0xe8d0('0x2a')](_0x539548[_0xe8d0('0x2b')]);if(_0x539548[_0xe8d0('0x2c')]){delete _0x539548['name'];}_0x2dee67[_0xe8d0('0x1b')](_0x264de4)[_0xe8d0('0x2d')](_0x539548);};}exports['index']=function(_0x1519e2,_0x3ffcb7){var _0x11fcf2={},_0x9eec0e={},_0x3cf3d6={'count':0x0,'rows':[]};var _0x495064=_[_0xe8d0('0x2e')](db['ScreenRecording']['rawAttributes'],function(_0x50ad3c){return{'name':_0x50ad3c[_0xe8d0('0x2f')],'type':_0x50ad3c[_0xe8d0('0x30')][_0xe8d0('0x31')]};});_0x9eec0e['model']=_['differenceBy'](_[_0xe8d0('0x2e')](_0x495064,'name'),[_0xe8d0('0x32')]);_0x9eec0e[_0xe8d0('0x33')]=_[_0xe8d0('0x34')](_0x1519e2[_0xe8d0('0x33')]);_0x9eec0e[_0xe8d0('0x35')]=_['intersection'](_0x9eec0e[_0xe8d0('0x36')],_0x9eec0e[_0xe8d0('0x33')]);_0x11fcf2[_0xe8d0('0x37')]=_[_0xe8d0('0x38')](_0x9eec0e['model'],qs[_0xe8d0('0x39')](_0x1519e2[_0xe8d0('0x33')]['fields']));_0x11fcf2[_0xe8d0('0x37')]=_0x11fcf2['attributes'][_0xe8d0('0x3a')]?_0x11fcf2['attributes']:_0x9eec0e[_0xe8d0('0x36')];if(!_0x1519e2['query'][_0xe8d0('0x3b')](_0xe8d0('0x3c'))){_0x11fcf2[_0xe8d0('0x1e')]=qs[_0xe8d0('0x1e')](_0x1519e2['query'][_0xe8d0('0x1e')]);_0x11fcf2[_0xe8d0('0x1f')]=qs[_0xe8d0('0x1f')](_0x1519e2['query'][_0xe8d0('0x1f')]);}_0x11fcf2[_0xe8d0('0x3d')]=qs[_0xe8d0('0x3e')](_0x1519e2[_0xe8d0('0x33')][_0xe8d0('0x3e')]);_0x11fcf2['where']=qs[_0xe8d0('0x35')](_[_0xe8d0('0x3f')](_0x1519e2[_0xe8d0('0x33')],_0x9eec0e[_0xe8d0('0x35')]),_0x495064);if(_0x1519e2[_0xe8d0('0x33')][_0xe8d0('0x40')]){_0x11fcf2[_0xe8d0('0x41')]=_[_0xe8d0('0x42')](_0x11fcf2['where'],{'$or':_['map'](_0x495064,function(_0xdca203){if(_0xdca203[_0xe8d0('0x30')]!==_0xe8d0('0x43')){var _0x377dc1={};_0x377dc1[_0xdca203[_0xe8d0('0x2c')]]={'$like':'%'+_0x1519e2['query'][_0xe8d0('0x40')]+'%'};return _0x377dc1;}})});}_0x11fcf2=_['merge']({},_0x11fcf2,_0x1519e2[_0xe8d0('0x44')]);var _0x458294={'where':_0x11fcf2[_0xe8d0('0x41')]};return db['ScreenRecording'][_0xe8d0('0x20')](_0x458294)[_0xe8d0('0x27')](function(_0x731382){_0x3cf3d6[_0xe8d0('0x20')]=_0x731382;if(_0x1519e2[_0xe8d0('0x33')]['includeAll']){_0x11fcf2['include']=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x11fcf2);})[_0xe8d0('0x27')](function(_0x52f288){_0x3cf3d6[_0xe8d0('0x45')]=_0x52f288;return _0x3cf3d6;})[_0xe8d0('0x27')](respondWithFilteredResult(_0x3ffcb7,_0x11fcf2))[_0xe8d0('0x46')](handleError(_0x3ffcb7,null));};exports[_0xe8d0('0x47')]=function(_0x2fd21e,_0x1156da){var _0x1b41c7={'raw':![],'where':{'id':_0x2fd21e['params']['id']}},_0x3cbca5={};_0x3cbca5[_0xe8d0('0x36')]=_[_0xe8d0('0x34')](db['ScreenRecording']['rawAttributes']);_0x3cbca5[_0xe8d0('0x33')]=_[_0xe8d0('0x34')](_0x2fd21e[_0xe8d0('0x33')]);_0x3cbca5['filters']=_[_0xe8d0('0x38')](_0x3cbca5[_0xe8d0('0x36')],_0x3cbca5['query']);_0x1b41c7[_0xe8d0('0x37')]=_[_0xe8d0('0x38')](_0x3cbca5['model'],qs[_0xe8d0('0x39')](_0x2fd21e[_0xe8d0('0x33')][_0xe8d0('0x39')]));_0x1b41c7[_0xe8d0('0x37')]=_0x1b41c7[_0xe8d0('0x37')][_0xe8d0('0x3a')]?_0x1b41c7[_0xe8d0('0x37')]:_0x3cbca5[_0xe8d0('0x36')];if(_0x2fd21e['query'][_0xe8d0('0x48')]){_0x1b41c7[_0xe8d0('0x49')]=[{'all':!![]}];}_0x1b41c7=_[_0xe8d0('0x42')]({},_0x1b41c7,_0x2fd21e[_0xe8d0('0x44')]);return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')](_0x1b41c7)[_0xe8d0('0x27')](handleEntityNotFound(_0x1156da,null))[_0xe8d0('0x27')](respondWithResult(_0x1156da,null))[_0xe8d0('0x46')](handleError(_0x1156da,null));};exports[_0xe8d0('0x4c')]=function(_0x361e3d,_0x3a5987){return db['ScreenRecording'][_0xe8d0('0x4c')](_0x361e3d[_0xe8d0('0x4d')],{})[_0xe8d0('0x27')](respondWithResult(_0x3a5987,0xc9))[_0xe8d0('0x46')](handleError(_0x3a5987,null));};exports[_0xe8d0('0x25')]=function(_0x2e4caf,_0x5a0c7e){if(_0x2e4caf['body']['id']){delete _0x2e4caf[_0xe8d0('0x4d')]['id'];}delete _0x2e4caf[_0xe8d0('0x4d')][_0xe8d0('0x4e')];delete _0x2e4caf[_0xe8d0('0x4d')]['createdAt'];delete _0x2e4caf[_0xe8d0('0x4d')]['closedAt'];delete _0x2e4caf[_0xe8d0('0x4d')][_0xe8d0('0x4f')];return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')]({'where':{'id':_0x2e4caf[_0xe8d0('0x50')]['id']}})[_0xe8d0('0x27')](handleEntityNotFound(_0x5a0c7e,null))[_0xe8d0('0x27')](saveUpdates(_0x2e4caf['body'],null))[_0xe8d0('0x27')](respondWithResult(_0x5a0c7e,null))['catch'](handleError(_0x5a0c7e,null));};exports['describe']=function(_0x35138a,_0x5516ad){return db[_0xe8d0('0x4a')]['describe']()[_0xe8d0('0x27')](respondWithResult(_0x5516ad,null))[_0xe8d0('0x46')](handleError(_0x5516ad,null));};exports[_0xe8d0('0x51')]=function(_0xcf4642,_0x555a56,_0x3088b1){var _0xbd55db=require(_0xe8d0('0x52'));var _0x2e3f1d=![];var _0x18cc14={};if(_0xcf4642['query'][_0xe8d0('0x30')]&&_0xcf4642[_0xe8d0('0x33')][_0xe8d0('0x30')]==='uniqueid'){_0x18cc14[_0xe8d0('0x53')]=_0xcf4642['params']['id'];}else{_0x18cc14['id']=_0xcf4642['params']['id'];}return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')]({'where':_0x18cc14,'attributes':['id','value'],'raw':!![]})[_0xe8d0('0x27')](handleEntityNotFound(_0x555a56,null))[_0xe8d0('0x27')](function(_0x47893d){if(_0x47893d){var _0x2a54c1=path[_0xe8d0('0x54')](config[_0xe8d0('0x55')],_0xe8d0('0x56'),_0x47893d['value']);var _0x20f6c2=util[_0xe8d0('0x32')](_0xe8d0('0x57'),_0x2a54c1);if(fs[_0xe8d0('0x58')](_0x20f6c2)){_0x2e3f1d=!![];return _0xbd55db['decryptFile'](_0x20f6c2,_0x2a54c1,config[_0xe8d0('0x59')][_0xe8d0('0x5a')])[_0xe8d0('0x27')](function(){return _0x47893d;});}return _0x47893d;}})[_0xe8d0('0x27')](function(_0x1a74d0){if(_0x1a74d0){var _0x29667c=path['join'](config['root'],_0xe8d0('0x56'),_0x1a74d0['value']);if(!fs[_0xe8d0('0x58')](_0x29667c)){throw new db[(_0xe8d0('0x5b'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x1a74d0[_0xe8d0('0x5c')]){return _0x555a56['download'](_0x29667c,_0x1a74d0[_0xe8d0('0x5c')]+path['extname'](_0x29667c),function(){if(_0x2e3f1d){fs[_0xe8d0('0x5d')](_0x29667c);}});}else{return _0x555a56[_0xe8d0('0x51')](_0x29667c,function(_0x13b9f0){if(_0x2e3f1d){fs['unlink'](_0x29667c);}});}}})[_0xe8d0('0x46')](function(_0x3cbc9f){if(_0x3cbc9f['message']===_0xe8d0('0x5e')){_0x555a56['status'](0x194)[_0xe8d0('0x2d')]('Not\x20found');}else{return handleError(_0x555a56,null);}});};exports[_0xe8d0('0x26')]=function(_0x17afc2,_0x29467d){return db[_0xe8d0('0x4a')][_0xe8d0('0x4b')]({'where':{'id':_0x17afc2['params']['id']}})['then'](function(_0xd7d433){if(_['isNil'](_0xd7d433)){throw new ReferenceError(_0xe8d0('0x5f'));}return _0xd7d433;})[_0xe8d0('0x27')](function(_0xbbe457){var _0x95565d=path[_0xe8d0('0x54')](config[_0xe8d0('0x55')],_0xe8d0('0x56'),_0xbbe457[_0xe8d0('0x4f')]);logger[_0xe8d0('0x60')](_0xe8d0('0x61'),_0x95565d);if(!_[_0xe8d0('0x62')](_0xbbe457[_0xe8d0('0x4f')])&&fs[_0xe8d0('0x58')](_0x95565d)){logger[_0xe8d0('0x60')](_0xe8d0('0x63')+_0x95565d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe8d0('0x64')](_0x95565d);}_0x95565d=_0x95565d+_0xe8d0('0x65');if(!_[_0xe8d0('0x62')](_0xbbe457[_0xe8d0('0x4f')])&&fs[_0xe8d0('0x58')](_0x95565d)){logger['info'](_0xe8d0('0x63')+_0x95565d+_0xe8d0('0x66'));fs[_0xe8d0('0x64')](_0x95565d);}return _0xbbe457;})[_0xe8d0('0x27')](function(_0x360633){if(!_0x360633)throw new InternalError();return _0x360633[_0xe8d0('0x26')]();})[_0xe8d0('0x27')](function(){_0x29467d[_0xe8d0('0x1b')](0xcc)[_0xe8d0('0x28')]();})[_0xe8d0('0x46')](handleError(_0x29467d,null));}; \ No newline at end of file +var _0x33c5=['download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','catch','create','body','duration','createdAt','closedAt','value','describe'];(function(_0x3f7188,_0x458aca){var _0x5197b2=function(_0x5918f5){while(--_0x5918f5){_0x3f7188['push'](_0x3f7188['shift']());}};_0x5197b2(++_0x458aca);}(_0x33c5,0xe6));var _0x533c=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0x33c5[_0x3a9635];return _0x10d08c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x34')](_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c')),[_0x533c('0x35')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x425f60[_0x533c('0x36')]);_0x38d886[_0x533c('0x38')]=_[_0x533c('0x39')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x36')]);_0x212d1b[_0x533c('0x3a')]=_['intersection'](_0x38d886[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x425f60[_0x533c('0x36')][_0x533c('0x3b')]));_0x212d1b['attributes']=_0x212d1b[_0x533c('0x3a')][_0x533c('0x3c')]?_0x212d1b[_0x533c('0x3a')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x36')]['hasOwnProperty']('nolimit')){_0x212d1b['limit']=qs['limit'](_0x425f60['query'][_0x533c('0x22')]);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b[_0x533c('0x3d')]=qs[_0x533c('0x3e')](_0x425f60['query'][_0x533c('0x3e')]);_0x212d1b[_0x533c('0x3f')]=qs[_0x533c('0x38')](_['pick'](_0x425f60[_0x533c('0x36')],_0x38d886[_0x533c('0x38')]),_0x2fc7fa);if(_0x425f60[_0x533c('0x36')]['filter']){_0x212d1b[_0x533c('0x3f')]=_[_0x533c('0x40')](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x454dbc){if(_0x454dbc[_0x533c('0x31')]!==_0x533c('0x41')){var _0x2dbd81={};_0x2dbd81[_0x454dbc[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x36')][_0x533c('0x42')]+'%'};return _0x2dbd81;}})});}_0x212d1b=_['merge']({},_0x212d1b,_0x425f60[_0x533c('0x43')]);var _0x784493={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x784493)[_0x533c('0x29')](function(_0x5d2bf9){_0x3c559b[_0x533c('0x23')]=_0x5d2bf9;if(_0x425f60[_0x533c('0x36')][_0x533c('0x44')]){_0x212d1b['include']=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x45')](_0x212d1b);})[_0x533c('0x29')](function(_0x1abd47){_0x3c559b['rows']=_0x1abd47;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x39034e,_0x55a372){var _0x3f4015={'raw':![],'where':{'id':_0x39034e[_0x533c('0x47')]['id']}},_0x3f1e47={};_0x3f1e47['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f1e47[_0x533c('0x36')]=_['keys'](_0x39034e[_0x533c('0x36')]);_0x3f1e47['filters']=_[_0x533c('0x39')](_0x3f1e47['model'],_0x3f1e47[_0x533c('0x36')]);_0x3f4015[_0x533c('0x3a')]=_['intersection'](_0x3f1e47[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x39034e[_0x533c('0x36')][_0x533c('0x3b')]));_0x3f4015[_0x533c('0x3a')]=_0x3f4015['attributes'][_0x533c('0x3c')]?_0x3f4015[_0x533c('0x3a')]:_0x3f1e47[_0x533c('0x33')];if(_0x39034e[_0x533c('0x36')]['includeAll']){_0x3f4015[_0x533c('0x48')]=[{'all':!![]}];}_0x3f4015=_[_0x533c('0x40')]({},_0x3f4015,_0x39034e['options']);return db['ScreenRecording'][_0x533c('0x49')](_0x3f4015)['then'](handleEntityNotFound(_0x55a372,null))[_0x533c('0x29')](respondWithResult(_0x55a372,null))[_0x533c('0x4a')](handleError(_0x55a372,null));};exports[_0x533c('0x4b')]=function(_0x471c59,_0xe9354a){return db[_0x533c('0x30')][_0x533c('0x4b')](_0x471c59[_0x533c('0x4c')],{})['then'](respondWithResult(_0xe9354a,0xc9))[_0x533c('0x4a')](handleError(_0xe9354a,null));};exports[_0x533c('0x28')]=function(_0xaaf682,_0x57c6c6){if(_0xaaf682[_0x533c('0x4c')]['id']){delete _0xaaf682[_0x533c('0x4c')]['id'];}delete _0xaaf682['body'][_0x533c('0x4d')];delete _0xaaf682['body'][_0x533c('0x4e')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x4f')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x50')];return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0xaaf682['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x57c6c6,null))[_0x533c('0x29')](saveUpdates(_0xaaf682[_0x533c('0x4c')],null))[_0x533c('0x29')](respondWithResult(_0x57c6c6,null))[_0x533c('0x4a')](handleError(_0x57c6c6,null));};exports[_0x533c('0x51')]=function(_0x3eb174,_0x50d5a2){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x50d5a2,null))[_0x533c('0x4a')](handleError(_0x50d5a2,null));};exports[_0x533c('0x52')]=function(_0x5c5dd0,_0xac086b,_0x1da579){var _0x2f6794=require('../../components/encryptor');var _0x1de19e=![];var _0x564a31={};if(_0x5c5dd0['query'][_0x533c('0x31')]&&_0x5c5dd0[_0x533c('0x36')][_0x533c('0x31')]===_0x533c('0x53')){_0x564a31[_0x533c('0x53')]=_0x5c5dd0[_0x533c('0x47')]['id'];}else{_0x564a31['id']=_0x5c5dd0[_0x533c('0x47')]['id'];}return db['ScreenRecording'][_0x533c('0x49')]({'where':_0x564a31,'attributes':['id','value'],'raw':!![]})[_0x533c('0x29')](handleEntityNotFound(_0xac086b,null))[_0x533c('0x29')](function(_0x274686){if(_0x274686){var _0x2c7600=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x274686[_0x533c('0x50')]);var _0x58f528=util[_0x533c('0x35')](_0x533c('0x57'),_0x2c7600);if(fs[_0x533c('0x58')](_0x58f528)){_0x1de19e=!![];return _0x2f6794[_0x533c('0x59')](_0x58f528,_0x2c7600,config[_0x533c('0x5a')][_0x533c('0x5b')])['then'](function(){return _0x274686;});}return _0x274686;}})[_0x533c('0x29')](function(_0x554a9f){if(_0x554a9f){var _0x43383e=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x554a9f[_0x533c('0x50')]);if(!fs[_0x533c('0x58')](_0x43383e)){throw new db['Sequelize']['ValidationError'](_0x533c('0x5c'));}if(_0x554a9f[_0x533c('0x5d')]){return _0xac086b[_0x533c('0x52')](_0x43383e,_0x554a9f[_0x533c('0x5d')]+path['extname'](_0x43383e),function(){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}else{return _0xac086b[_0x533c('0x52')](_0x43383e,function(_0x8e04c7){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}}})[_0x533c('0x4a')](function(_0x2f2863){if(_0x2f2863[_0x533c('0x5f')]===_0x533c('0x5c')){_0xac086b[_0x533c('0x1d')](0x194)[_0x533c('0x2d')](_0x533c('0x60'));}else{return handleError(_0xac086b,null);}});};exports[_0x533c('0x2a')]=function(_0x13a7f2,_0xea6ea2){return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0x13a7f2[_0x533c('0x47')]['id']}})['then'](function(_0x31bba1){if(_['isNil'](_0x31bba1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x31bba1;})[_0x533c('0x29')](function(_0xb23f94){var _0x965b85=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0xb23f94[_0x533c('0x50')]);logger['info'](_0x533c('0x61'),_0x965b85);if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')](_0x533c('0x64')+_0x965b85+_0x533c('0x65'));fs['unlinkSync'](_0x965b85);}_0x965b85=_0x965b85+_0x533c('0x66');if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')]('File:\x20\x22'+_0x965b85+_0x533c('0x65'));fs[_0x533c('0x67')](_0x965b85);}return _0xb23f94;})['then'](function(_0x444f46){if(!_0x444f46)throw new InternalError();return _0x444f46['destroy']();})['then'](function(){_0xea6ea2[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();})[_0x533c('0x4a')](handleError(_0xea6ea2,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 4a5e8e0..5ab08b4 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 _0xb683=['exports','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x51ce61,_0x404d33){var _0x242cad=function(_0xb47c9e){while(--_0xb47c9e){_0x51ce61['push'](_0x51ce61['shift']());}};_0x242cad(++_0x404d33);}(_0xb683,0x197));var _0x3b68=function(_0x355543,_0x2338dd){_0x355543=_0x355543-0x0;var _0x468604=_0xb683[_0x355543];return _0x468604;};'use strict';var _=require('lodash');var util=require(_0x3b68('0x0'));var logger=require(_0x3b68('0x1'))('api');var moment=require(_0x3b68('0x2'));var BPromise=require(_0x3b68('0x3'));var rp=require(_0x3b68('0x4'));var fs=require('fs');var path=require(_0x3b68('0x5'));var rimraf=require(_0x3b68('0x6'));var config=require(_0x3b68('0x7'));var attributes=require(_0x3b68('0x8'));module[_0x3b68('0x9')]=function(_0x3cac5c,_0x2e8b25){return _0x3cac5c['define'](_0x3b68('0xa'),attributes,{'tableName':_0x3b68('0xb'),'paranoid':![],'indexes':[{'name':_0x3b68('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c28=['api','moment','bluebird','path','rimraf','./screenRecording.attributes','exports','define','interactionid','../../config/logger'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4c28,0xf9));var _0x84c2=function(_0x570ad8,_0x425ec5){_0x570ad8=_0x570ad8-0x0;var _0x1eb874=_0x4c28[_0x570ad8];return _0x1eb874;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x84c2('0x0'))(_0x84c2('0x1'));var moment=require(_0x84c2('0x2'));var BPromise=require(_0x84c2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84c2('0x4'));var rimraf=require(_0x84c2('0x5'));var config=require('../../config/environment');var attributes=require(_0x84c2('0x6'));module[_0x84c2('0x7')]=function(_0x6fa29f,_0x4b596d){return _0x6fa29f[_0x84c2('0x8')]('ScreenRecording',attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x84c2('0x9'),'fields':[_0x84c2('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 10c0ced..8753cbc 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 _0x3db7=['info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x3db7,0x198));var _0x73db=function(_0x1d3d58,_0x13bc04){_0x1d3d58=_0x1d3d58-0x0;var _0x3cce7a=_0x3db7[_0x1d3d58];return _0x3cce7a;};'use strict';var _=require(_0x73db('0x0'));var util=require(_0x73db('0x1'));var moment=require('moment');var BPromise=require(_0x73db('0x2'));var rs=require(_0x73db('0x3'));var fs=require('fs');var Redis=require(_0x73db('0x4'));var db=require(_0x73db('0x5'))['db'];var utils=require(_0x73db('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x73db('0x7'));var jayson=require(_0x73db('0x8'));var client=jayson['client'][_0x73db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c8516,_0x4421ac,_0x16d4d0){return new BPromise(function(_0x34a5ed,_0xe7e0f8){return client[_0x73db('0xa')](_0x2c8516,_0x16d4d0)[_0x73db('0xb')](function(_0x50cf14){logger[_0x73db('0xc')](_0x73db('0xd'),_0x4421ac,_0x73db('0xe'));logger[_0x73db('0xf')](_0x73db('0x10'),_0x4421ac,_0x73db('0xe'),JSON['stringify'](_0x50cf14));if(_0x50cf14[_0x73db('0x11')]){if(_0x50cf14[_0x73db('0x11')]['code']===0x1f4){logger['error'](_0x73db('0xd'),_0x4421ac,_0x50cf14[_0x73db('0x11')]['message']);return _0xe7e0f8(_0x50cf14[_0x73db('0x11')][_0x73db('0x12')]);}logger['error'](_0x73db('0xd'),_0x4421ac,_0x50cf14[_0x73db('0x11')][_0x73db('0x12')]);return _0x34a5ed(_0x50cf14['error'][_0x73db('0x12')]);}else{logger[_0x73db('0xc')](_0x73db('0xd'),_0x4421ac,'request\x20sent');_0x34a5ed(_0x50cf14['result'][_0x73db('0x12')]);}})[_0x73db('0x13')](function(_0xc26c80){logger[_0x73db('0x11')](_0x73db('0xd'),_0x4421ac,_0xc26c80);_0xe7e0f8(_0xc26c80);});});} \ No newline at end of file +var _0x88ae=['then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x274f14,_0x27dd7f){var _0x13b97e=function(_0x7d9432){while(--_0x7d9432){_0x274f14['push'](_0x274f14['shift']());}};_0x13b97e(++_0x27dd7f);}(_0x88ae,0x107));var _0xe88a=function(_0x4e4de9,_0x14bd2e){_0x4e4de9=_0x4e4de9-0x0;var _0x2939b9=_0x88ae[_0x4e4de9];return _0x2939b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe88a('0x0'));var db=require(_0xe88a('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xe88a('0x2'))('rpc');var config=require(_0xe88a('0x3'));var jayson=require(_0xe88a('0x4'));var client=jayson[_0xe88a('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53ab89,_0x549fae,_0x293597){return new BPromise(function(_0x5b0009,_0x40f43f){return client[_0xe88a('0x6')](_0x53ab89,_0x293597)[_0xe88a('0x7')](function(_0x1eaf86){logger[_0xe88a('0x8')](_0xe88a('0x9'),_0x549fae,'request\x20sent');logger[_0xe88a('0xa')](_0xe88a('0xb'),_0x549fae,'request\x20sent',JSON[_0xe88a('0xc')](_0x1eaf86));if(_0x1eaf86[_0xe88a('0xd')]){if(_0x1eaf86[_0xe88a('0xd')]['code']===0x1f4){logger[_0xe88a('0xd')](_0xe88a('0x9'),_0x549fae,_0x1eaf86[_0xe88a('0xd')][_0xe88a('0xe')]);return _0x40f43f(_0x1eaf86[_0xe88a('0xd')]['message']);}logger[_0xe88a('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x549fae,_0x1eaf86[_0xe88a('0xd')]['message']);return _0x5b0009(_0x1eaf86[_0xe88a('0xd')][_0xe88a('0xe')]);}else{logger[_0xe88a('0x8')](_0xe88a('0x9'),_0x549fae,_0xe88a('0xf'));_0x5b0009(_0x1eaf86[_0xe88a('0x10')][_0xe88a('0xe')]);}})[_0xe88a('0x11')](function(_0x4634e4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x549fae,_0x4634e4);_0x40f43f(_0x4634e4);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 6b32f3d..95f094b 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 _0x4f0a=['/:id/favicon','join','root','server/files/images/logos/','format','%s%s','logo','originalname','post','single','file','addLogo','diskStorage','logologin','extname','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred'];(function(_0x317d4c,_0x391e9d){var _0x433884=function(_0x366dd4){while(--_0x366dd4){_0x317d4c['push'](_0x317d4c['shift']());}};_0x433884(++_0x391e9d);}(_0x4f0a,0x159));var _0xa4f0=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0x4f0a[_0x3db122];return _0x325b67;};'use strict';var multer=require(_0xa4f0('0x0'));var util=require('util');var path=require(_0xa4f0('0x1'));var timeout=require(_0xa4f0('0x2'));var express=require(_0xa4f0('0x3'));var router=express[_0xa4f0('0x4')]();var fs_extra=require(_0xa4f0('0x5'));var auth=require(_0xa4f0('0x6'));var interaction=require(_0xa4f0('0x7'));var config=require(_0xa4f0('0x8'));var controller=require(_0xa4f0('0x9'));router[_0xa4f0('0xa')]('/',auth[_0xa4f0('0xb')](),controller['index']);router['get'](_0xa4f0('0xc'),controller[_0xa4f0('0xd')]);router['get']('/:id',controller[_0xa4f0('0xe')]);router[_0xa4f0('0xa')](_0xa4f0('0xf'),controller[_0xa4f0('0x10')]);router['get'](_0xa4f0('0x11'),controller[_0xa4f0('0x12')]);router[_0xa4f0('0xa')](_0xa4f0('0x13'),controller[_0xa4f0('0x14')]);router[_0xa4f0('0xa')](_0xa4f0('0x15'),controller[_0xa4f0('0x16')]);router['get'](_0xa4f0('0x17'),controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4026ad,_0x571a38,_0x334e27){_0x334e27(null,path[_0xa4f0('0x18')](config[_0xa4f0('0x19')],_0xa4f0('0x1a')));},'filename':function(_0x4bc826,_0x1a1a63,_0x5304a8){_0x5304a8(null,util[_0xa4f0('0x1b')](_0xa4f0('0x1c'),_0xa4f0('0x1d'),path['extname'](_0x1a1a63[_0xa4f0('0x1e')])));}})});router[_0xa4f0('0x1f')]('/:id/logo',upload[_0xa4f0('0x20')](_0xa4f0('0x21')),controller[_0xa4f0('0x22')]);var upload=multer({'storage':multer[_0xa4f0('0x23')]({'destination':function(_0x2e69f2,_0x90896d,_0x6dd1d4){_0x6dd1d4(null,path[_0xa4f0('0x18')](config[_0xa4f0('0x19')],_0xa4f0('0x1a')));},'filename':function(_0x5af9d9,_0x2cc49b,_0x195937){_0x195937(null,util['format'](_0xa4f0('0x1c'),_0xa4f0('0x24'),path[_0xa4f0('0x25')](_0x2cc49b[_0xa4f0('0x1e')])));}})});router['post'](_0xa4f0('0x11'),upload[_0xa4f0('0x20')](_0xa4f0('0x21')),controller[_0xa4f0('0x26')]);var upload=multer({'storage':multer[_0xa4f0('0x23')]({'destination':function(_0x1986fa,_0x2a4a87,_0xa30dc7){_0xa30dc7(null,path[_0xa4f0('0x18')](config[_0xa4f0('0x19')],_0xa4f0('0x1a')));},'filename':function(_0x5a697d,_0x498519,_0x4a88d8){_0x4a88d8(null,util[_0xa4f0('0x1b')]('%s%s',_0xa4f0('0x27'),path[_0xa4f0('0x25')](_0x498519['originalname'])));}})});router[_0xa4f0('0x1f')](_0xa4f0('0x15'),upload[_0xa4f0('0x20')](_0xa4f0('0x21')),controller[_0xa4f0('0x28')]);var upload=multer({'storage':multer[_0xa4f0('0x23')]({'destination':function(_0xb0adb2,_0x1cc91d,_0x2118b7){_0x2118b7(null,path['join'](config[_0xa4f0('0x19')],_0xa4f0('0x1a')));},'filename':function(_0x3615fa,_0x151582,_0xa03284){_0xa03284(null,util['format']('%s%s',_0xa4f0('0x29'),path['extname'](_0x151582[_0xa4f0('0x1e')])));}})});router[_0xa4f0('0x1f')]('/:id/favicon',upload['single'](_0xa4f0('0x21')),controller[_0xa4f0('0x2a')]);router[_0xa4f0('0x2b')]('/:id',auth[_0xa4f0('0xb')](),controller[_0xa4f0('0x2c')]);module[_0xa4f0('0x2d')]=router; \ No newline at end of file +var _0x0186=['server/files/images/logos/','format','logo','extname','originalname','/:id/logo','single','file','addLogo','join','%s%s','logologin','post','/:id/logo_login','addLogoLogin','/:id/preferred','addPreferred','favicon','addFavicon','isAuthenticated','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/now','getDate','show','getLogoLogin','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','root'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x0186,0x1b0));var _0x6018=function(_0x260927,_0xd4deee){_0x260927=_0x260927-0x0;var _0x5e5515=_0x0186[_0x260927];return _0x5e5515;};'use strict';var multer=require(_0x6018('0x0'));var util=require('util');var path=require(_0x6018('0x1'));var timeout=require(_0x6018('0x2'));var express=require(_0x6018('0x3'));var router=express[_0x6018('0x4')]();var fs_extra=require(_0x6018('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6018('0x6'));var config=require(_0x6018('0x7'));var controller=require('./setting.controller');router[_0x6018('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6018('0x8')](_0x6018('0x9'),controller[_0x6018('0xa')]);router[_0x6018('0x8')]('/:id',controller[_0x6018('0xb')]);router[_0x6018('0x8')]('/:id/logo',controller['getLogo']);router[_0x6018('0x8')]('/:id/logo_login',controller[_0x6018('0xc')]);router[_0x6018('0x8')]('/:id/gdpr',controller[_0x6018('0xd')]);router[_0x6018('0x8')]('/:id/preferred',controller[_0x6018('0xe')]);router[_0x6018('0x8')](_0x6018('0xf'),controller[_0x6018('0x10')]);var upload=multer({'storage':multer[_0x6018('0x11')]({'destination':function(_0x4b9102,_0x3fa7c3,_0x2faf1e){_0x2faf1e(null,path['join'](config[_0x6018('0x12')],_0x6018('0x13')));},'filename':function(_0x5873cb,_0x484411,_0x1a9b84){_0x1a9b84(null,util[_0x6018('0x14')]('%s%s',_0x6018('0x15'),path[_0x6018('0x16')](_0x484411[_0x6018('0x17')])));}})});router['post'](_0x6018('0x18'),upload[_0x6018('0x19')](_0x6018('0x1a')),controller[_0x6018('0x1b')]);var upload=multer({'storage':multer[_0x6018('0x11')]({'destination':function(_0x51028e,_0xdf9e10,_0xba756b){_0xba756b(null,path[_0x6018('0x1c')](config[_0x6018('0x12')],_0x6018('0x13')));},'filename':function(_0x5cebdd,_0x54023f,_0x1b0775){_0x1b0775(null,util[_0x6018('0x14')](_0x6018('0x1d'),_0x6018('0x1e'),path[_0x6018('0x16')](_0x54023f[_0x6018('0x17')])));}})});router[_0x6018('0x1f')](_0x6018('0x20'),upload[_0x6018('0x19')](_0x6018('0x1a')),controller[_0x6018('0x21')]);var upload=multer({'storage':multer[_0x6018('0x11')]({'destination':function(_0x38bf9a,_0x4554bb,_0x3f1496){_0x3f1496(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x2ddaa5,_0x2d0640,_0xcedeaa){_0xcedeaa(null,util[_0x6018('0x14')](_0x6018('0x1d'),'preferred',path[_0x6018('0x16')](_0x2d0640[_0x6018('0x17')])));}})});router['post'](_0x6018('0x22'),upload[_0x6018('0x19')](_0x6018('0x1a')),controller[_0x6018('0x23')]);var upload=multer({'storage':multer[_0x6018('0x11')]({'destination':function(_0x810df1,_0xb573f4,_0x12cf7d){_0x12cf7d(null,path[_0x6018('0x1c')](config[_0x6018('0x12')],_0x6018('0x13')));},'filename':function(_0x24b1c5,_0x486521,_0x505eea){_0x505eea(null,util[_0x6018('0x14')](_0x6018('0x1d'),_0x6018('0x24'),path['extname'](_0x486521[_0x6018('0x17')])));}})});router[_0x6018('0x1f')](_0x6018('0xf'),upload[_0x6018('0x19')]('file'),controller[_0x6018('0x25')]);router['put']('/:id',auth[_0x6018('0x26')](),controller[_0x6018('0x27')]);module[_0x6018('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 04e8830..6fe946f 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(_0x46d74d,_0x2ac23b){var _0xe05d6c=function(_0x308ff1){while(--_0x308ff1){_0x46d74d['push'](_0x46d74d['shift']());}};_0xe05d6c(++_0x2ac23b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x58c02b,_0x325036){var _0x42e22c=function(_0x145a22){while(--_0x145a22){_0x58c02b['push'](_0x58c02b['shift']());}};_0x42e22c(++_0x325036);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 6785b4e..179b113 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 _0xf352=['keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','Setting','includeAll','include','rows','catch','show','find','body','params','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','custom','Sequelize','download','getLogoLogin','preferred','default_loginLogo.svg','ValidationError','\x20not\x20found','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','name','send','map','rawAttributes','fieldName','type','model'];(function(_0x15442a,_0x3e90d7){var _0x1f1c08=function(_0x4b6604){while(--_0x4b6604){_0x15442a['push'](_0x15442a['shift']());}};_0x1f1c08(++_0x3e90d7);}(_0xf352,0x1ac));var _0x2f35=function(_0x49ab88,_0xcdfc80){_0x49ab88=_0x49ab88-0x0;var _0x5509bc=_0xf352[_0x49ab88];return _0x5509bc;};'use strict';var emlformat=require(_0x2f35('0x0'));var rimraf=require(_0x2f35('0x1'));var zipdir=require(_0x2f35('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2f35('0x3'));var BPromise=require(_0x2f35('0x4'));var Mustache=require(_0x2f35('0x5'));var util=require(_0x2f35('0x6'));var path=require(_0x2f35('0x7'));var sox=require(_0x2f35('0x8'));var csv=require(_0x2f35('0x9'));var ejs=require(_0x2f35('0xa'));var fs=require('fs');var fs_extra=require(_0x2f35('0xb'));var _=require(_0x2f35('0xc'));var squel=require(_0x2f35('0xd'));var crypto=require(_0x2f35('0xe'));var jsforce=require(_0x2f35('0xf'));var deskjs=require(_0x2f35('0x10'));var toCsv=require(_0x2f35('0x9'));var querystring=require(_0x2f35('0x11'));var Papa=require('papaparse');var Redis=require(_0x2f35('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2f35('0x13'));var as=require(_0x2f35('0x14'));var hardwareService=require(_0x2f35('0x15'));var logger=require(_0x2f35('0x16'))('api');var utils=require(_0x2f35('0x17'));var config=require(_0x2f35('0x18'));var licenseUtil=require(_0x2f35('0x19'));var db=require(_0x2f35('0x1a'))['db'];var jayson=require(_0x2f35('0x1b'));var client=jayson[_0x2f35('0x1c')][_0x2f35('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x9744c1,_0x3a154,_0x3ad5db,_0x11a433){return new BPromise(function(_0x100f13,_0x3f7bcb){var _0x3282ce=_0x11a433||client;return _0x3282ce[_0x2f35('0x1e')](_0x9744c1,_0x3ad5db)[_0x2f35('0x1f')](function(_0x55f85c){logger[_0x2f35('0x20')](_0x2f35('0x21'),_0x3a154,_0x2f35('0x22'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x3a154,_0x2f35('0x22'),JSON[_0x2f35('0x23')](_0x55f85c));if(_0x55f85c[_0x2f35('0x24')]){if(_0x55f85c[_0x2f35('0x24')]['code']===0x1f4){logger[_0x2f35('0x24')]('Setting,\x20%s,\x20%s',_0x3a154,_0x55f85c[_0x2f35('0x24')][_0x2f35('0x25')]);return _0x3f7bcb(_0x55f85c[_0x2f35('0x24')][_0x2f35('0x25')]);}logger[_0x2f35('0x24')](_0x2f35('0x21'),_0x3a154,_0x55f85c[_0x2f35('0x24')][_0x2f35('0x25')]);return _0x100f13(_0x55f85c['error'][_0x2f35('0x25')]);}else{logger[_0x2f35('0x20')](_0x2f35('0x21'),_0x3a154,_0x2f35('0x22'));_0x100f13(_0x55f85c[_0x2f35('0x26')][_0x2f35('0x25')]);}})['catch'](function(_0x55cbf8){logger[_0x2f35('0x24')](_0x2f35('0x21'),_0x3a154,_0x55cbf8);_0x3f7bcb(_0x55cbf8);});});}function respondWithStatusCode(_0x4e603a,_0x49347c){_0x49347c=_0x49347c||0xcc;return function(_0x49bd2b){if(_0x49bd2b){return _0x4e603a[_0x2f35('0x27')](_0x49347c);}return _0x4e603a['status'](_0x49347c)[_0x2f35('0x28')]();};}function respondWithResult(_0x4fb387,_0x292f05){_0x292f05=_0x292f05||0xc8;return function(_0x4d5987){if(_0x4d5987){return _0x4fb387[_0x2f35('0x29')](_0x292f05)[_0x2f35('0x2a')](_0x4d5987);}};}function respondWithFilteredResult(_0xdc5bdf,_0x44a693){return function(_0x3198f8){if(_0x3198f8){var _0x29cee2=typeof _0x44a693[_0x2f35('0x2b')]===_0x2f35('0x2c')&&typeof _0x44a693[_0x2f35('0x2d')]===_0x2f35('0x2c');var _0x47ca75=_0x3198f8[_0x2f35('0x2e')];var _0x2d765c=_0x29cee2?0x0:_0x44a693[_0x2f35('0x2b')];var _0x71001b=_0x29cee2?_0x3198f8[_0x2f35('0x2e')]:_0x44a693[_0x2f35('0x2b')]+_0x44a693['limit'];var _0x120f30;if(_0x71001b>=_0x47ca75){_0x71001b=_0x47ca75;_0x120f30=0xc8;}else{_0x120f30=0xce;}_0xdc5bdf[_0x2f35('0x29')](_0x120f30);return _0xdc5bdf[_0x2f35('0x2f')](_0x2f35('0x30'),_0x2d765c+'-'+_0x71001b+'/'+_0x47ca75)[_0x2f35('0x2a')](_0x3198f8);}return null;};}function patchUpdates(_0x1a1bf4){return function(_0x21531b){try{jsonpatch[_0x2f35('0x31')](_0x21531b,_0x1a1bf4,!![]);}catch(_0x142013){return BPromise[_0x2f35('0x32')](_0x142013);}return _0x21531b[_0x2f35('0x33')]();};}function saveUpdates(_0x5d2bd5,_0x12bd5e){return function(_0x481628){if(_0x481628){return _0x481628[_0x2f35('0x34')](_0x5d2bd5)['then'](function(_0x51256e){return _0x51256e;});}return null;};}function removeEntity(_0x1f0b94,_0x2bbb53){return function(_0x1550a7){if(_0x1550a7){return _0x1550a7['destroy']()[_0x2f35('0x1f')](function(){_0x1f0b94[_0x2f35('0x29')](0xcc)[_0x2f35('0x28')]();});}};}function handleEntityNotFound(_0x2a912d,_0x57c471){return function(_0x14e9aa){if(!_0x14e9aa){_0x2a912d[_0x2f35('0x27')](0x194);}return _0x14e9aa;};}function handleError(_0x4d4989,_0x6a87c5){_0x6a87c5=_0x6a87c5||0x1f4;return function(_0x58a1ff){logger[_0x2f35('0x24')](_0x58a1ff['stack']);if(_0x58a1ff[_0x2f35('0x35')]){delete _0x58a1ff['name'];}_0x4d4989[_0x2f35('0x29')](_0x6a87c5)[_0x2f35('0x36')](_0x58a1ff);};}exports['index']=function(_0xa5a3a3,_0x1d48ba){var _0x1910aa={},_0x2333d5={},_0x3a022a={'count':0x0,'rows':[]};var _0x9a3dae=_[_0x2f35('0x37')](db['Setting'][_0x2f35('0x38')],function(_0x318b6f){return{'name':_0x318b6f[_0x2f35('0x39')],'type':_0x318b6f[_0x2f35('0x3a')]['key']};});_0x2333d5[_0x2f35('0x3b')]=_[_0x2f35('0x37')](_0x9a3dae,_0x2f35('0x35'));_0x2333d5['query']=_[_0x2f35('0x3c')](_0xa5a3a3[_0x2f35('0x3d')]);_0x2333d5[_0x2f35('0x3e')]=_[_0x2f35('0x3f')](_0x2333d5[_0x2f35('0x3b')],_0x2333d5['query']);_0x1910aa[_0x2f35('0x40')]=_[_0x2f35('0x3f')](_0x2333d5[_0x2f35('0x3b')],qs[_0x2f35('0x41')](_0xa5a3a3[_0x2f35('0x3d')][_0x2f35('0x41')]));_0x1910aa[_0x2f35('0x40')]=_0x1910aa[_0x2f35('0x40')][_0x2f35('0x42')]?_0x1910aa[_0x2f35('0x40')]:_0x2333d5[_0x2f35('0x3b')];if(!_0xa5a3a3[_0x2f35('0x3d')]['hasOwnProperty']('nolimit')){_0x1910aa['limit']=qs[_0x2f35('0x2d')](_0xa5a3a3[_0x2f35('0x3d')][_0x2f35('0x2d')]);_0x1910aa[_0x2f35('0x2b')]=qs[_0x2f35('0x2b')](_0xa5a3a3[_0x2f35('0x3d')][_0x2f35('0x2b')]);}_0x1910aa[_0x2f35('0x43')]=qs[_0x2f35('0x44')](_0xa5a3a3[_0x2f35('0x3d')][_0x2f35('0x44')]);_0x1910aa[_0x2f35('0x45')]=qs[_0x2f35('0x3e')](_[_0x2f35('0x46')](_0xa5a3a3[_0x2f35('0x3d')],_0x2333d5[_0x2f35('0x3e')]),_0x9a3dae);if(_0xa5a3a3[_0x2f35('0x3d')][_0x2f35('0x47')]){_0x1910aa[_0x2f35('0x45')]=_['merge'](_0x1910aa[_0x2f35('0x45')],{'$or':_[_0x2f35('0x37')](_0x9a3dae,function(_0x3209fe){if(_0x3209fe[_0x2f35('0x3a')]!==_0x2f35('0x48')){var _0x297efc={};_0x297efc[_0x3209fe[_0x2f35('0x35')]]={'$like':'%'+_0xa5a3a3[_0x2f35('0x3d')]['filter']+'%'};return _0x297efc;}})});}_0x1910aa=_[_0x2f35('0x49')]({},_0x1910aa,_0xa5a3a3['options']);var _0x4fe554={'where':_0x1910aa[_0x2f35('0x45')]};return db[_0x2f35('0x4a')][_0x2f35('0x2e')](_0x4fe554)[_0x2f35('0x1f')](function(_0x37bd6a){_0x3a022a[_0x2f35('0x2e')]=_0x37bd6a;if(_0xa5a3a3[_0x2f35('0x3d')][_0x2f35('0x4b')]){_0x1910aa[_0x2f35('0x4c')]=[{'all':!![]}];}return db[_0x2f35('0x4a')]['findAll'](_0x1910aa);})[_0x2f35('0x1f')](function(_0x1d047e){_0x3a022a[_0x2f35('0x4d')]=_0x1d047e;return _0x3a022a;})[_0x2f35('0x1f')](respondWithFilteredResult(_0x1d48ba,_0x1910aa))[_0x2f35('0x4e')](handleError(_0x1d48ba,null));};exports[_0x2f35('0x4f')]=function(_0x5b22de,_0x37d9f6){var _0x1f5140={'raw':![],'where':{'id':_0x5b22de['params']['id']}},_0x2c5327={};_0x2c5327[_0x2f35('0x3b')]=_[_0x2f35('0x3c')](db[_0x2f35('0x4a')][_0x2f35('0x38')]);_0x2c5327['query']=_['keys'](_0x5b22de[_0x2f35('0x3d')]);_0x2c5327[_0x2f35('0x3e')]=_['intersection'](_0x2c5327[_0x2f35('0x3b')],_0x2c5327[_0x2f35('0x3d')]);_0x1f5140[_0x2f35('0x40')]=_[_0x2f35('0x3f')](_0x2c5327[_0x2f35('0x3b')],qs[_0x2f35('0x41')](_0x5b22de['query'][_0x2f35('0x41')]));_0x1f5140[_0x2f35('0x40')]=_0x1f5140[_0x2f35('0x40')]['length']?_0x1f5140['attributes']:_0x2c5327['model'];if(_0x5b22de[_0x2f35('0x3d')][_0x2f35('0x4b')]){_0x1f5140[_0x2f35('0x4c')]=[{'all':!![]}];}_0x1f5140=_[_0x2f35('0x49')]({},_0x1f5140,_0x5b22de['options']);return db[_0x2f35('0x4a')][_0x2f35('0x50')](_0x1f5140)['then'](handleEntityNotFound(_0x37d9f6,null))[_0x2f35('0x1f')](respondWithResult(_0x37d9f6,null))[_0x2f35('0x4e')](handleError(_0x37d9f6,null));};exports['update']=function(_0xe727b,_0x1c38e2){if(_0xe727b[_0x2f35('0x51')]['id']){delete _0xe727b['body']['id'];}return db[_0x2f35('0x4a')]['find']({'where':{'id':_0xe727b[_0x2f35('0x52')]['id']}})['then'](handleEntityNotFound(_0x1c38e2,null))[_0x2f35('0x1f')](saveUpdates(_0xe727b[_0x2f35('0x51')],null))['then'](respondWithResult(_0x1c38e2,null))[_0x2f35('0x4e')](handleError(_0x1c38e2,null));};exports['addLogo']=function(_0x34741f,_0x34c383,_0x2728a1){if(_0x34741f['file']&&_0x34741f[_0x2f35('0x53')][_0x2f35('0x54')]){_0x34741f[_0x2f35('0x51')]['logo']=_0x34741f['file'][_0x2f35('0x54')];}return db[_0x2f35('0x4a')]['find']({'where':{'id':_0x34741f[_0x2f35('0x52')]['id']}})['then'](handleEntityNotFound(_0x34c383,null))[_0x2f35('0x1f')](saveUpdates(_0x34741f[_0x2f35('0x51')],null))[_0x2f35('0x1f')](respondWithResult(_0x34c383,null))[_0x2f35('0x4e')](handleError(_0x34c383,null));};exports[_0x2f35('0x55')]=function(_0x38a079,_0x33a3d3,_0x49480c){if(_0x38a079['file']&&_0x38a079[_0x2f35('0x53')][_0x2f35('0x54')]){_0x38a079[_0x2f35('0x51')][_0x2f35('0x56')]=_0x38a079['file']['filename'];}return db[_0x2f35('0x4a')][_0x2f35('0x50')]({'where':{'id':_0x38a079['params']['id']}})[_0x2f35('0x1f')](handleEntityNotFound(_0x33a3d3,null))[_0x2f35('0x1f')](saveUpdates(_0x38a079[_0x2f35('0x51')],null))[_0x2f35('0x1f')](respondWithResult(_0x33a3d3,null))['catch'](handleError(_0x33a3d3,null));};var utilLicense=require('../../config/license/util');exports[_0x2f35('0x57')]=function(_0x28a3e3,_0x137635,_0x3bbdf7){var _0x5ce73d=_0x2f35('0x58');var _0x41e69e={'custom':![]};return utilLicense[_0x2f35('0x59')]()[_0x2f35('0x1f')](function(_0x333f74){if(_0x333f74){_0x41e69e=_0x333f74;}return db[_0x2f35('0x4a')][_0x2f35('0x50')]({'where':{'id':_0x28a3e3[_0x2f35('0x52')]['id']},'attributes':[_0x2f35('0x5a'),_0x2f35('0x56'),'preferred',_0x2f35('0x5b'),_0x2f35('0x5c'),_0x2f35('0x5d'),_0x2f35('0x5e'),_0x2f35('0x5f')],'raw':!![]});})[_0x2f35('0x1f')](handleEntityNotFound(_0x137635,null))[_0x2f35('0x1f')](function(_0x3abeaa){if(_0x3abeaa){var _0x1ec987=_0x3abeaa[_0x2f35('0x5a')]&&fs[_0x2f35('0x60')](path[_0x2f35('0x61')](config['root'],_0x5ce73d,_[_0x2f35('0x62')](_0x3abeaa[_0x2f35('0x5a')])))?path[_0x2f35('0x61')](config[_0x2f35('0x63')],_0x5ce73d,_[_0x2f35('0x62')](_0x3abeaa['logo'])):path[_0x2f35('0x61')](config[_0x2f35('0x63')],_0x5ce73d,_[_0x2f35('0x62')](_0x2f35('0x64')));var _0x49ae87=_0x2f35('0x65')+_[_0x2f35('0x66')](_0x2f35('0x5a'));if(_0x3abeaa[_0x49ae87]||!_0x41e69e[_0x2f35('0x67')]){_0x1ec987=path['join'](config[_0x2f35('0x63')],_0x5ce73d,_['toLower']('default_logo.svg'));}if(!fs[_0x2f35('0x60')](_0x1ec987)){throw new db[(_0x2f35('0x68'))]['ValidationError'](_[_0x2f35('0x66')](_0x2f35('0x5a'))+'\x20not\x20found');}return _0x137635[_0x2f35('0x69')](_0x1ec987);}})[_0x2f35('0x4e')](handleError(_0x137635,null));};var utilLicense=require(_0x2f35('0x19'));exports[_0x2f35('0x6a')]=function(_0x57c4f5,_0x50ca4f,_0x51e594){var _0x4877df=_0x2f35('0x58');var _0x434371={'custom':![]};return utilLicense[_0x2f35('0x59')]()[_0x2f35('0x1f')](function(_0x2a8b52){if(_0x2a8b52){_0x434371=_0x2a8b52;}return db[_0x2f35('0x4a')][_0x2f35('0x50')]({'where':{'id':_0x57c4f5[_0x2f35('0x52')]['id']},'attributes':['logo',_0x2f35('0x56'),_0x2f35('0x6b'),_0x2f35('0x5b'),_0x2f35('0x5c'),'defaultLoginLogo',_0x2f35('0x5e'),_0x2f35('0x5f')],'raw':!![]});})[_0x2f35('0x1f')](handleEntityNotFound(_0x50ca4f,null))[_0x2f35('0x1f')](function(_0x1269f9){if(_0x1269f9){var _0x500a63=_0x1269f9[_0x2f35('0x56')]&&fs[_0x2f35('0x60')](path[_0x2f35('0x61')](config[_0x2f35('0x63')],_0x4877df,_[_0x2f35('0x62')](_0x1269f9[_0x2f35('0x56')])))?path[_0x2f35('0x61')](config['root'],_0x4877df,_['toLower'](_0x1269f9[_0x2f35('0x56')])):path[_0x2f35('0x61')](config['root'],_0x4877df,_['toLower'](_0x2f35('0x6c')));var _0x43c651=_0x2f35('0x65')+_['upperFirst'](_0x2f35('0x56'));if(_0x1269f9[_0x43c651]||!_0x434371['custom']){_0x500a63=path[_0x2f35('0x61')](config['root'],_0x4877df,_[_0x2f35('0x62')](_0x2f35('0x6c')));}if(!fs['existsSync'](_0x500a63)){throw new db[(_0x2f35('0x68'))][(_0x2f35('0x6d'))](_['upperFirst']('loginLogo')+_0x2f35('0x6e'));}return _0x50ca4f[_0x2f35('0x69')](_0x500a63);}})[_0x2f35('0x4e')](handleError(_0x50ca4f,null));};exports[_0x2f35('0x6f')]=function(_0x187787,_0x264ed4){return db[_0x2f35('0x4a')]['find']({'where':{'id':_0x187787['params']['id']},'attributes':[_0x2f35('0x70')]})[_0x2f35('0x1f')](respondWithResult(_0x264ed4,null))[_0x2f35('0x4e')](handleError(_0x264ed4,null));};exports[_0x2f35('0x71')]=function(_0x3a3663,_0x3d0515,_0x37c48e){if(_0x3a3663[_0x2f35('0x53')]&&_0x3a3663[_0x2f35('0x53')]['filename']){_0x3a3663[_0x2f35('0x51')][_0x2f35('0x6b')]=_0x3a3663[_0x2f35('0x53')]['filename'];}return db[_0x2f35('0x4a')]['find']({'where':{'id':_0x3a3663['params']['id']}})[_0x2f35('0x1f')](handleEntityNotFound(_0x3d0515,null))['then'](saveUpdates(_0x3a3663[_0x2f35('0x51')],null))[_0x2f35('0x1f')](respondWithResult(_0x3d0515,null))[_0x2f35('0x4e')](handleError(_0x3d0515,null));};var utilLicense=require(_0x2f35('0x19'));exports['getPreferred']=function(_0x4eccf0,_0x56ac24,_0x2a9811){var _0x11afb0=_0x2f35('0x58');var _0x426e02={'custom':![]};return utilLicense[_0x2f35('0x59')]()['then'](function(_0x60c2d4){if(_0x60c2d4){_0x426e02=_0x60c2d4;}return db[_0x2f35('0x4a')][_0x2f35('0x50')]({'where':{'id':_0x4eccf0[_0x2f35('0x52')]['id']},'attributes':[_0x2f35('0x5a'),_0x2f35('0x56'),'preferred','favicon',_0x2f35('0x5c'),_0x2f35('0x5d'),'defaultPreferred',_0x2f35('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x56ac24,null))['then'](function(_0x23e174){if(_0x23e174){var _0x1ac12c=_0x23e174[_0x2f35('0x6b')]&&fs[_0x2f35('0x60')](path['join'](config[_0x2f35('0x63')],_0x11afb0,_[_0x2f35('0x62')](_0x23e174[_0x2f35('0x6b')])))?path[_0x2f35('0x61')](config[_0x2f35('0x63')],_0x11afb0,_[_0x2f35('0x62')](_0x23e174['preferred'])):path[_0x2f35('0x61')](config[_0x2f35('0x63')],_0x11afb0,_[_0x2f35('0x62')](_0x2f35('0x72')));var _0x4e2b1f='default'+_['upperFirst'](_0x2f35('0x6b'));if(_0x23e174[_0x4e2b1f]||!_0x426e02[_0x2f35('0x67')]||!_0x426e02[_0x2f35('0x6b')]){_0x1ac12c=path[_0x2f35('0x61')](config['root'],_0x11afb0,_[_0x2f35('0x62')](_0x2f35('0x72')));}if(!fs['existsSync'](_0x1ac12c)){throw new db[(_0x2f35('0x68'))][(_0x2f35('0x6d'))](_['upperFirst'](_0x2f35('0x6b'))+_0x2f35('0x6e'));}return _0x56ac24[_0x2f35('0x69')](_0x1ac12c);}})[_0x2f35('0x4e')](handleError(_0x56ac24,null));};exports[_0x2f35('0x73')]=function(_0x329c6c,_0x15bae3,_0x571186){if(_0x329c6c[_0x2f35('0x53')]&&_0x329c6c[_0x2f35('0x53')][_0x2f35('0x54')]){_0x329c6c[_0x2f35('0x51')][_0x2f35('0x5b')]=_0x329c6c['file'][_0x2f35('0x54')];}return db[_0x2f35('0x4a')][_0x2f35('0x50')]({'where':{'id':_0x329c6c[_0x2f35('0x52')]['id']}})[_0x2f35('0x1f')](handleEntityNotFound(_0x15bae3,null))[_0x2f35('0x1f')](saveUpdates(_0x329c6c[_0x2f35('0x51')],null))['then'](respondWithResult(_0x15bae3,null))[_0x2f35('0x4e')](handleError(_0x15bae3,null));};var utilLicense=require(_0x2f35('0x19'));exports[_0x2f35('0x74')]=function(_0x1b8bea,_0x4860cb,_0x20de71){var _0x592501=_0x2f35('0x58');var _0x8639a1={'custom':![]};return utilLicense[_0x2f35('0x59')]()['then'](function(_0x53d488){if(_0x53d488){_0x8639a1=_0x53d488;}return db[_0x2f35('0x4a')]['find']({'where':{'id':_0x1b8bea[_0x2f35('0x52')]['id']},'attributes':[_0x2f35('0x5a'),_0x2f35('0x56'),_0x2f35('0x6b'),_0x2f35('0x5b'),_0x2f35('0x5c'),'defaultLoginLogo','defaultPreferred',_0x2f35('0x5f')],'raw':!![]});})[_0x2f35('0x1f')](handleEntityNotFound(_0x4860cb,null))[_0x2f35('0x1f')](function(_0x587361){if(_0x587361){var _0x4dc6a8=_0x587361[_0x2f35('0x5b')]&&fs[_0x2f35('0x60')](path[_0x2f35('0x61')](config[_0x2f35('0x63')],_0x592501,_[_0x2f35('0x62')](_0x587361['favicon'])))?path['join'](config['root'],_0x592501,_['toLower'](_0x587361[_0x2f35('0x5b')])):path['join'](config['root'],_0x592501,_['toLower'](_0x2f35('0x75')));var _0x39a1d8=_0x2f35('0x65')+_['upperFirst'](_0x2f35('0x5b'));if(_0x587361[_0x39a1d8]||!_0x8639a1[_0x2f35('0x67')]){_0x4dc6a8=path[_0x2f35('0x61')](config[_0x2f35('0x63')],_0x592501,_[_0x2f35('0x62')]('default_favicon.ico'));}if(!fs[_0x2f35('0x60')](_0x4dc6a8)){throw new db[(_0x2f35('0x68'))]['ValidationError'](_[_0x2f35('0x66')](_0x2f35('0x5b'))+_0x2f35('0x6e'));}return _0x4860cb[_0x2f35('0x69')](_0x4dc6a8);}})[_0x2f35('0x4e')](handleError(_0x4860cb,null));};exports[_0x2f35('0x76')]=function(_0x5b41ab,_0x493d05){var _0x4baa40={'offset':moment()[_0x2f35('0x77')]()};_0x4baa40['now']=moment()[_0x2f35('0x77')](_0x4baa40[_0x2f35('0x2b')])[_0x2f35('0x78')](_0x2f35('0x79'));return _0x493d05[_0x2f35('0x29')](0xc8)[_0x2f35('0x36')](_0x4baa40);}; \ No newline at end of file +var _0xecd5=['preferred','favicon','defaultLoginLogo','existsSync','join','root','toLower','logo','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','defaultLogo','defaultPreferred','defaultFavicon','default_loginLogo.svg','securePassword','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','moment','bluebird','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/license/hardware','api','../../config/license/util','../../mysqldb','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','name','send','index','map','Setting','rawAttributes','fieldName','type','key','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','keys','find','body','addLogo','file','filename','loginLogo','getLogo','server/files/images/logos','getLicense'];(function(_0x22eca5,_0x3fa0e5){var _0x384d73=function(_0x139588){while(--_0x139588){_0x22eca5['push'](_0x22eca5['shift']());}};_0x384d73(++_0x3fa0e5);}(_0xecd5,0x110));var _0x5ecd=function(_0x500f77,_0x854b68){_0x500f77=_0x500f77-0x0;var _0x3979d5=_0xecd5[_0x500f77];return _0x3979d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ecd('0x0'));var zipdir=require(_0x5ecd('0x1'));var jsonpatch=require(_0x5ecd('0x2'));var rp=require('request-promise');var moment=require(_0x5ecd('0x3'));var BPromise=require(_0x5ecd('0x4'));var Mustache=require(_0x5ecd('0x5'));var util=require(_0x5ecd('0x6'));var path=require('path');var sox=require(_0x5ecd('0x7'));var csv=require('to-csv');var ejs=require(_0x5ecd('0x8'));var fs=require('fs');var fs_extra=require(_0x5ecd('0x9'));var _=require('lodash');var squel=require(_0x5ecd('0xa'));var crypto=require(_0x5ecd('0xb'));var jsforce=require(_0x5ecd('0xc'));var deskjs=require(_0x5ecd('0xd'));var toCsv=require(_0x5ecd('0xe'));var querystring=require(_0x5ecd('0xf'));var Papa=require(_0x5ecd('0x10'));var Redis=require(_0x5ecd('0x11'));var authService=require(_0x5ecd('0x12'));var qs=require(_0x5ecd('0x13'));var as=require(_0x5ecd('0x14'));var hardwareService=require(_0x5ecd('0x15'));var logger=require('../../config/logger')(_0x5ecd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5ecd('0x17'));var db=require(_0x5ecd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x5ecd('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2106a0,_0x47cf02,_0x37bfe1,_0x57bd97){return new BPromise(function(_0x3b918c,_0x3b54f1){var _0x50e11c=_0x57bd97||client;return _0x50e11c[_0x5ecd('0x1a')](_0x2106a0,_0x37bfe1)[_0x5ecd('0x1b')](function(_0x48442a){logger[_0x5ecd('0x1c')]('Setting,\x20%s,\x20%s',_0x47cf02,_0x5ecd('0x1d'));logger[_0x5ecd('0x1e')](_0x5ecd('0x1f'),_0x47cf02,_0x5ecd('0x1d'),JSON[_0x5ecd('0x20')](_0x48442a));if(_0x48442a[_0x5ecd('0x21')]){if(_0x48442a[_0x5ecd('0x21')][_0x5ecd('0x22')]===0x1f4){logger[_0x5ecd('0x21')](_0x5ecd('0x23'),_0x47cf02,_0x48442a[_0x5ecd('0x21')][_0x5ecd('0x24')]);return _0x3b54f1(_0x48442a['error'][_0x5ecd('0x24')]);}logger[_0x5ecd('0x21')](_0x5ecd('0x23'),_0x47cf02,_0x48442a[_0x5ecd('0x21')][_0x5ecd('0x24')]);return _0x3b918c(_0x48442a['error'][_0x5ecd('0x24')]);}else{logger['info'](_0x5ecd('0x23'),_0x47cf02,_0x5ecd('0x1d'));_0x3b918c(_0x48442a[_0x5ecd('0x25')][_0x5ecd('0x24')]);}})[_0x5ecd('0x26')](function(_0x4becfd){logger[_0x5ecd('0x21')](_0x5ecd('0x23'),_0x47cf02,_0x4becfd);_0x3b54f1(_0x4becfd);});});}function respondWithStatusCode(_0x1d9161,_0x57168b){_0x57168b=_0x57168b||0xcc;return function(_0xe80905){if(_0xe80905){return _0x1d9161[_0x5ecd('0x27')](_0x57168b);}return _0x1d9161[_0x5ecd('0x28')](_0x57168b)[_0x5ecd('0x29')]();};}function respondWithResult(_0x29f8c0,_0x20f134){_0x20f134=_0x20f134||0xc8;return function(_0x3d0086){if(_0x3d0086){return _0x29f8c0[_0x5ecd('0x28')](_0x20f134)['json'](_0x3d0086);}};}function respondWithFilteredResult(_0x1e3902,_0x5ae414){return function(_0x12a109){if(_0x12a109){var _0x36d964=typeof _0x5ae414[_0x5ecd('0x2a')]===_0x5ecd('0x2b')&&typeof _0x5ae414[_0x5ecd('0x2c')]==='undefined';var _0x446324=_0x12a109[_0x5ecd('0x2d')];var _0x33ca9e=_0x36d964?0x0:_0x5ae414[_0x5ecd('0x2a')];var _0x389b88=_0x36d964?_0x12a109[_0x5ecd('0x2d')]:_0x5ae414[_0x5ecd('0x2a')]+_0x5ae414[_0x5ecd('0x2c')];var _0x253b1b;if(_0x389b88>=_0x446324){_0x389b88=_0x446324;_0x253b1b=0xc8;}else{_0x253b1b=0xce;}_0x1e3902[_0x5ecd('0x28')](_0x253b1b);return _0x1e3902[_0x5ecd('0x2e')](_0x5ecd('0x2f'),_0x33ca9e+'-'+_0x389b88+'/'+_0x446324)[_0x5ecd('0x30')](_0x12a109);}return null;};}function patchUpdates(_0xd2711e){return function(_0x3055eb){try{jsonpatch[_0x5ecd('0x31')](_0x3055eb,_0xd2711e,!![]);}catch(_0x3da093){return BPromise['reject'](_0x3da093);}return _0x3055eb[_0x5ecd('0x32')]();};}function saveUpdates(_0x4252d5,_0x37fdaa){return function(_0x179c63){if(_0x179c63){return _0x179c63[_0x5ecd('0x33')](_0x4252d5)['then'](function(_0x3cca00){return _0x3cca00;});}return null;};}function removeEntity(_0x169fa3,_0xabe8b5){return function(_0x195641){if(_0x195641){return _0x195641[_0x5ecd('0x34')]()['then'](function(){_0x169fa3[_0x5ecd('0x28')](0xcc)[_0x5ecd('0x29')]();});}};}function handleEntityNotFound(_0x46148e,_0x507a3d){return function(_0x3d18fe){if(!_0x3d18fe){_0x46148e[_0x5ecd('0x27')](0x194);}return _0x3d18fe;};}function handleError(_0x2c738b,_0x46fb84){_0x46fb84=_0x46fb84||0x1f4;return function(_0x27b8e5){logger[_0x5ecd('0x21')](_0x27b8e5['stack']);if(_0x27b8e5[_0x5ecd('0x35')]){delete _0x27b8e5['name'];}_0x2c738b['status'](_0x46fb84)[_0x5ecd('0x36')](_0x27b8e5);};}exports[_0x5ecd('0x37')]=function(_0x1dd54c,_0x29d265){var _0x38809f={},_0x41975e={},_0x4f3373={'count':0x0,'rows':[]};var _0x58561f=_[_0x5ecd('0x38')](db[_0x5ecd('0x39')][_0x5ecd('0x3a')],function(_0x3df69c){return{'name':_0x3df69c[_0x5ecd('0x3b')],'type':_0x3df69c[_0x5ecd('0x3c')][_0x5ecd('0x3d')]};});_0x41975e['model']=_[_0x5ecd('0x38')](_0x58561f,_0x5ecd('0x35'));_0x41975e[_0x5ecd('0x3e')]=_['keys'](_0x1dd54c[_0x5ecd('0x3e')]);_0x41975e[_0x5ecd('0x3f')]=_[_0x5ecd('0x40')](_0x41975e['model'],_0x41975e['query']);_0x38809f['attributes']=_[_0x5ecd('0x40')](_0x41975e['model'],qs[_0x5ecd('0x41')](_0x1dd54c[_0x5ecd('0x3e')]['fields']));_0x38809f[_0x5ecd('0x42')]=_0x38809f[_0x5ecd('0x42')][_0x5ecd('0x43')]?_0x38809f['attributes']:_0x41975e[_0x5ecd('0x44')];if(!_0x1dd54c[_0x5ecd('0x3e')][_0x5ecd('0x45')](_0x5ecd('0x46'))){_0x38809f[_0x5ecd('0x2c')]=qs['limit'](_0x1dd54c[_0x5ecd('0x3e')][_0x5ecd('0x2c')]);_0x38809f['offset']=qs['offset'](_0x1dd54c[_0x5ecd('0x3e')][_0x5ecd('0x2a')]);}_0x38809f[_0x5ecd('0x47')]=qs['sort'](_0x1dd54c[_0x5ecd('0x3e')]['sort']);_0x38809f[_0x5ecd('0x48')]=qs['filters'](_['pick'](_0x1dd54c['query'],_0x41975e[_0x5ecd('0x3f')]),_0x58561f);if(_0x1dd54c[_0x5ecd('0x3e')][_0x5ecd('0x49')]){_0x38809f['where']=_['merge'](_0x38809f[_0x5ecd('0x48')],{'$or':_['map'](_0x58561f,function(_0x3546a0){if(_0x3546a0[_0x5ecd('0x3c')]!==_0x5ecd('0x4a')){var _0x5aec2a={};_0x5aec2a[_0x3546a0['name']]={'$like':'%'+_0x1dd54c['query']['filter']+'%'};return _0x5aec2a;}})});}_0x38809f=_[_0x5ecd('0x4b')]({},_0x38809f,_0x1dd54c['options']);var _0x4aed1c={'where':_0x38809f[_0x5ecd('0x48')]};return db[_0x5ecd('0x39')]['count'](_0x4aed1c)[_0x5ecd('0x1b')](function(_0x173947){_0x4f3373[_0x5ecd('0x2d')]=_0x173947;if(_0x1dd54c['query'][_0x5ecd('0x4c')]){_0x38809f[_0x5ecd('0x4d')]=[{'all':!![]}];}return db[_0x5ecd('0x39')][_0x5ecd('0x4e')](_0x38809f);})[_0x5ecd('0x1b')](function(_0x3e6504){_0x4f3373[_0x5ecd('0x4f')]=_0x3e6504;return _0x4f3373;})[_0x5ecd('0x1b')](respondWithFilteredResult(_0x29d265,_0x38809f))[_0x5ecd('0x26')](handleError(_0x29d265,null));};exports['show']=function(_0x11487f,_0x13fed0){var _0xda9406={'raw':![],'where':{'id':_0x11487f[_0x5ecd('0x50')]['id']}},_0x35b68e={};_0x35b68e[_0x5ecd('0x44')]=_[_0x5ecd('0x51')](db[_0x5ecd('0x39')]['rawAttributes']);_0x35b68e[_0x5ecd('0x3e')]=_[_0x5ecd('0x51')](_0x11487f['query']);_0x35b68e[_0x5ecd('0x3f')]=_[_0x5ecd('0x40')](_0x35b68e['model'],_0x35b68e[_0x5ecd('0x3e')]);_0xda9406[_0x5ecd('0x42')]=_[_0x5ecd('0x40')](_0x35b68e['model'],qs[_0x5ecd('0x41')](_0x11487f[_0x5ecd('0x3e')][_0x5ecd('0x41')]));_0xda9406[_0x5ecd('0x42')]=_0xda9406['attributes'][_0x5ecd('0x43')]?_0xda9406['attributes']:_0x35b68e[_0x5ecd('0x44')];if(_0x11487f[_0x5ecd('0x3e')][_0x5ecd('0x4c')]){_0xda9406[_0x5ecd('0x4d')]=[{'all':!![]}];}_0xda9406=_[_0x5ecd('0x4b')]({},_0xda9406,_0x11487f['options']);return db[_0x5ecd('0x39')][_0x5ecd('0x52')](_0xda9406)[_0x5ecd('0x1b')](handleEntityNotFound(_0x13fed0,null))[_0x5ecd('0x1b')](respondWithResult(_0x13fed0,null))[_0x5ecd('0x26')](handleError(_0x13fed0,null));};exports[_0x5ecd('0x33')]=function(_0x4374fd,_0x47b260){if(_0x4374fd[_0x5ecd('0x53')]['id']){delete _0x4374fd['body']['id'];}return db[_0x5ecd('0x39')][_0x5ecd('0x52')]({'where':{'id':_0x4374fd[_0x5ecd('0x50')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x47b260,null))['then'](saveUpdates(_0x4374fd[_0x5ecd('0x53')],null))[_0x5ecd('0x1b')](respondWithResult(_0x47b260,null))[_0x5ecd('0x26')](handleError(_0x47b260,null));};exports[_0x5ecd('0x54')]=function(_0x1dbf89,_0x433bac,_0x3dbc04){if(_0x1dbf89[_0x5ecd('0x55')]&&_0x1dbf89[_0x5ecd('0x55')][_0x5ecd('0x56')]){_0x1dbf89['body']['logo']=_0x1dbf89[_0x5ecd('0x55')]['filename'];}return db[_0x5ecd('0x39')][_0x5ecd('0x52')]({'where':{'id':_0x1dbf89['params']['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x433bac,null))[_0x5ecd('0x1b')](saveUpdates(_0x1dbf89['body'],null))['then'](respondWithResult(_0x433bac,null))[_0x5ecd('0x26')](handleError(_0x433bac,null));};exports['addLogoLogin']=function(_0x13048c,_0x368dc7,_0x27aabb){if(_0x13048c[_0x5ecd('0x55')]&&_0x13048c[_0x5ecd('0x55')][_0x5ecd('0x56')]){_0x13048c[_0x5ecd('0x53')][_0x5ecd('0x57')]=_0x13048c['file'][_0x5ecd('0x56')];}return db[_0x5ecd('0x39')][_0x5ecd('0x52')]({'where':{'id':_0x13048c[_0x5ecd('0x50')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x368dc7,null))[_0x5ecd('0x1b')](saveUpdates(_0x13048c[_0x5ecd('0x53')],null))[_0x5ecd('0x1b')](respondWithResult(_0x368dc7,null))[_0x5ecd('0x26')](handleError(_0x368dc7,null));};var utilLicense=require(_0x5ecd('0x17'));exports[_0x5ecd('0x58')]=function(_0x12f301,_0x32b4c1,_0x243931){var _0x3a15ca=_0x5ecd('0x59');var _0x1755ca={'custom':![]};return utilLicense[_0x5ecd('0x5a')]()[_0x5ecd('0x1b')](function(_0x1f6261){if(_0x1f6261){_0x1755ca=_0x1f6261;}return db['Setting'][_0x5ecd('0x52')]({'where':{'id':_0x12f301['params']['id']},'attributes':['logo',_0x5ecd('0x57'),_0x5ecd('0x5b'),_0x5ecd('0x5c'),'defaultLogo',_0x5ecd('0x5d'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x5ecd('0x1b')](handleEntityNotFound(_0x32b4c1,null))[_0x5ecd('0x1b')](function(_0x5b1801){if(_0x5b1801){var _0x41f6b6=_0x5b1801['logo']&&fs[_0x5ecd('0x5e')](path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3a15ca,_[_0x5ecd('0x61')](_0x5b1801[_0x5ecd('0x62')])))?path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3a15ca,_['toLower'](_0x5b1801[_0x5ecd('0x62')])):path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3a15ca,_[_0x5ecd('0x61')](_0x5ecd('0x63')));var _0x3606ee=_0x5ecd('0x64')+_[_0x5ecd('0x65')](_0x5ecd('0x62'));if(_0x5b1801[_0x3606ee]||!_0x1755ca['custom']){_0x41f6b6=path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3a15ca,_['toLower'](_0x5ecd('0x63')));}if(!fs[_0x5ecd('0x5e')](_0x41f6b6)){throw new db[(_0x5ecd('0x66'))][(_0x5ecd('0x67'))](_[_0x5ecd('0x65')](_0x5ecd('0x62'))+_0x5ecd('0x68'));}return _0x32b4c1[_0x5ecd('0x69')](_0x41f6b6);}})['catch'](handleError(_0x32b4c1,null));};var utilLicense=require('../../config/license/util');exports[_0x5ecd('0x6a')]=function(_0x1ede54,_0x320ed9,_0xc43ff9){var _0x3ee317=_0x5ecd('0x59');var _0xacf40a={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1bdfbc){if(_0x1bdfbc){_0xacf40a=_0x1bdfbc;}return db['Setting'][_0x5ecd('0x52')]({'where':{'id':_0x1ede54[_0x5ecd('0x50')]['id']},'attributes':[_0x5ecd('0x62'),_0x5ecd('0x57'),_0x5ecd('0x5b'),_0x5ecd('0x5c'),_0x5ecd('0x6b'),'defaultLoginLogo',_0x5ecd('0x6c'),_0x5ecd('0x6d')],'raw':!![]});})[_0x5ecd('0x1b')](handleEntityNotFound(_0x320ed9,null))[_0x5ecd('0x1b')](function(_0x46a40a){if(_0x46a40a){var _0x49c478=_0x46a40a[_0x5ecd('0x57')]&&fs['existsSync'](path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3ee317,_['toLower'](_0x46a40a[_0x5ecd('0x57')])))?path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3ee317,_['toLower'](_0x46a40a[_0x5ecd('0x57')])):path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x3ee317,_[_0x5ecd('0x61')](_0x5ecd('0x6e')));var _0x23277f=_0x5ecd('0x64')+_['upperFirst'](_0x5ecd('0x57'));if(_0x46a40a[_0x23277f]||!_0xacf40a['custom']){_0x49c478=path['join'](config[_0x5ecd('0x60')],_0x3ee317,_[_0x5ecd('0x61')](_0x5ecd('0x6e')));}if(!fs[_0x5ecd('0x5e')](_0x49c478)){throw new db['Sequelize']['ValidationError'](_[_0x5ecd('0x65')]('loginLogo')+_0x5ecd('0x68'));}return _0x320ed9['download'](_0x49c478);}})['catch'](handleError(_0x320ed9,null));};exports['gdpr']=function(_0x52acc7,_0xe6da16){return db[_0x5ecd('0x39')]['find']({'where':{'id':_0x52acc7[_0x5ecd('0x50')]['id']},'attributes':[_0x5ecd('0x6f')]})[_0x5ecd('0x1b')](respondWithResult(_0xe6da16,null))[_0x5ecd('0x26')](handleError(_0xe6da16,null));};exports['addPreferred']=function(_0x523748,_0x41787d,_0xde93a9){if(_0x523748[_0x5ecd('0x55')]&&_0x523748[_0x5ecd('0x55')][_0x5ecd('0x56')]){_0x523748['body'][_0x5ecd('0x5b')]=_0x523748['file'][_0x5ecd('0x56')];}return db['Setting']['find']({'where':{'id':_0x523748[_0x5ecd('0x50')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x41787d,null))['then'](saveUpdates(_0x523748['body'],null))[_0x5ecd('0x1b')](respondWithResult(_0x41787d,null))['catch'](handleError(_0x41787d,null));};var utilLicense=require(_0x5ecd('0x17'));exports['getPreferred']=function(_0x25413e,_0x13e38a,_0xb4bfb1){var _0x138be8=_0x5ecd('0x59');var _0xffef89={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x515936){if(_0x515936){_0xffef89=_0x515936;}return db['Setting'][_0x5ecd('0x52')]({'where':{'id':_0x25413e[_0x5ecd('0x50')]['id']},'attributes':['logo',_0x5ecd('0x57'),_0x5ecd('0x5b'),_0x5ecd('0x5c'),_0x5ecd('0x6b'),_0x5ecd('0x5d'),_0x5ecd('0x6c'),'defaultFavicon'],'raw':!![]});})[_0x5ecd('0x1b')](handleEntityNotFound(_0x13e38a,null))[_0x5ecd('0x1b')](function(_0x48d95d){if(_0x48d95d){var _0x3f7d05=_0x48d95d['preferred']&&fs['existsSync'](path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x138be8,_[_0x5ecd('0x61')](_0x48d95d['preferred'])))?path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x138be8,_[_0x5ecd('0x61')](_0x48d95d[_0x5ecd('0x5b')])):path['join'](config[_0x5ecd('0x60')],_0x138be8,_[_0x5ecd('0x61')]('default_preferred.png'));var _0x500d2f=_0x5ecd('0x64')+_['upperFirst'](_0x5ecd('0x5b'));if(_0x48d95d[_0x500d2f]||!_0xffef89[_0x5ecd('0x70')]||!_0xffef89[_0x5ecd('0x5b')]){_0x3f7d05=path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x138be8,_['toLower']('default_preferred.png'));}if(!fs[_0x5ecd('0x5e')](_0x3f7d05)){throw new db['Sequelize']['ValidationError'](_[_0x5ecd('0x65')]('preferred')+_0x5ecd('0x68'));}return _0x13e38a[_0x5ecd('0x69')](_0x3f7d05);}})[_0x5ecd('0x26')](handleError(_0x13e38a,null));};exports[_0x5ecd('0x71')]=function(_0x1b4cc5,_0x4e6a22,_0x3ddc6c){if(_0x1b4cc5[_0x5ecd('0x55')]&&_0x1b4cc5['file'][_0x5ecd('0x56')]){_0x1b4cc5[_0x5ecd('0x53')][_0x5ecd('0x5c')]=_0x1b4cc5[_0x5ecd('0x55')]['filename'];}return db[_0x5ecd('0x39')][_0x5ecd('0x52')]({'where':{'id':_0x1b4cc5[_0x5ecd('0x50')]['id']}})[_0x5ecd('0x1b')](handleEntityNotFound(_0x4e6a22,null))[_0x5ecd('0x1b')](saveUpdates(_0x1b4cc5[_0x5ecd('0x53')],null))['then'](respondWithResult(_0x4e6a22,null))['catch'](handleError(_0x4e6a22,null));};var utilLicense=require(_0x5ecd('0x17'));exports[_0x5ecd('0x72')]=function(_0x544a8d,_0x7d69dd,_0x292eaa){var _0x1bfaff=_0x5ecd('0x59');var _0x5acea2={'custom':![]};return utilLicense[_0x5ecd('0x5a')]()['then'](function(_0x3814fb){if(_0x3814fb){_0x5acea2=_0x3814fb;}return db[_0x5ecd('0x39')][_0x5ecd('0x52')]({'where':{'id':_0x544a8d['params']['id']},'attributes':[_0x5ecd('0x62'),_0x5ecd('0x57'),_0x5ecd('0x5b'),_0x5ecd('0x5c'),_0x5ecd('0x6b'),_0x5ecd('0x5d'),_0x5ecd('0x6c'),_0x5ecd('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x7d69dd,null))[_0x5ecd('0x1b')](function(_0x5d4db1){if(_0x5d4db1){var _0x5ba799=_0x5d4db1['favicon']&&fs[_0x5ecd('0x5e')](path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x1bfaff,_[_0x5ecd('0x61')](_0x5d4db1[_0x5ecd('0x5c')])))?path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x1bfaff,_['toLower'](_0x5d4db1[_0x5ecd('0x5c')])):path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x1bfaff,_[_0x5ecd('0x61')](_0x5ecd('0x73')));var _0x4dc2f8='default'+_[_0x5ecd('0x65')](_0x5ecd('0x5c'));if(_0x5d4db1[_0x4dc2f8]||!_0x5acea2[_0x5ecd('0x70')]){_0x5ba799=path[_0x5ecd('0x5f')](config[_0x5ecd('0x60')],_0x1bfaff,_[_0x5ecd('0x61')](_0x5ecd('0x73')));}if(!fs[_0x5ecd('0x5e')](_0x5ba799)){throw new db[(_0x5ecd('0x66'))][(_0x5ecd('0x67'))](_[_0x5ecd('0x65')]('favicon')+_0x5ecd('0x68'));}return _0x7d69dd[_0x5ecd('0x69')](_0x5ba799);}})[_0x5ecd('0x26')](handleError(_0x7d69dd,null));};exports[_0x5ecd('0x74')]=function(_0x2a192a,_0x152522){var _0x298b5b={'offset':moment()[_0x5ecd('0x75')]()};_0x298b5b[_0x5ecd('0x76')]=moment()[_0x5ecd('0x75')](_0x298b5b[_0x5ecd('0x2a')])[_0x5ecd('0x77')](_0x5ecd('0x78'));return _0x152522[_0x5ecd('0x28')](0xc8)[_0x5ecd('0x36')](_0x298b5b);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 40b14ad..26d584f 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x008c,0x188));var _0xc008=function(_0x411dc3,_0x47a8e4){_0x411dc3=_0x411dc3-0x0;var _0x5b870b=_0x008c[_0x411dc3];return _0x5b870b;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x22dca5,_0x298b56){var _0x4737fa=function(_0x4b721b){while(--_0x4b721b){_0x22dca5['push'](_0x22dca5['shift']());}};_0x4737fa(++_0x298b56);}(_0x34e8,0x12c));var _0x834e=function(_0x11aed9,_0x126166){_0x11aed9=_0x11aed9-0x0;var _0x115799=_0x34e8[_0x11aed9];return _0x115799;};'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/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 60b7a02..89031f9 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 _0x041f=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','ShowSetting','Setting','find','options','raw','where','attributes','include','model','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug'];(function(_0x5c26dd,_0x3920e2){var _0x448e82=function(_0x482f0c){while(--_0x482f0c){_0x5c26dd['push'](_0x5c26dd['shift']());}};_0x448e82(++_0x3920e2);}(_0x041f,0x1e0));var _0xf041=function(_0x3c98f1,_0x4d71d3){_0x3c98f1=_0x3c98f1-0x0;var _0x542bf5=_0x041f[_0x3c98f1];return _0x542bf5;};'use strict';var _=require(_0xf041('0x0'));var util=require(_0xf041('0x1'));var moment=require(_0xf041('0x2'));var BPromise=require('bluebird');var rs=require(_0xf041('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf041('0x4'))(_0xf041('0x5'));var config=require(_0xf041('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf041('0x7')][_0xf041('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b0154,_0x2d6e2b,_0x418502){return new BPromise(function(_0x5f5cc8,_0x4187b1){return client['request'](_0x4b0154,_0x418502)[_0xf041('0x9')](function(_0x4960ed){logger[_0xf041('0xa')]('Setting,\x20%s,\x20%s',_0x2d6e2b,_0xf041('0xb'));logger[_0xf041('0xc')](_0xf041('0xd'),_0x2d6e2b,_0xf041('0xb'),JSON[_0xf041('0xe')](_0x4960ed));if(_0x4960ed[_0xf041('0xf')]){if(_0x4960ed[_0xf041('0xf')][_0xf041('0x10')]===0x1f4){logger[_0xf041('0xf')](_0xf041('0x11'),_0x2d6e2b,_0x4960ed[_0xf041('0xf')][_0xf041('0x12')]);return _0x4187b1(_0x4960ed['error'][_0xf041('0x12')]);}logger[_0xf041('0xf')](_0xf041('0x11'),_0x2d6e2b,_0x4960ed[_0xf041('0xf')][_0xf041('0x12')]);return _0x5f5cc8(_0x4960ed[_0xf041('0xf')][_0xf041('0x12')]);}else{logger[_0xf041('0xa')](_0xf041('0x11'),_0x2d6e2b,_0xf041('0xb'));_0x5f5cc8(_0x4960ed[_0xf041('0x13')]['message']);}})['catch'](function(_0x442730){logger[_0xf041('0xf')](_0xf041('0x11'),_0x2d6e2b,_0x442730);_0x4187b1(_0x442730);});});}exports[_0xf041('0x14')]=function(_0xf673d7){var _0x50ac04=this;return new Promise(function(_0x1af594,_0x193c91){return db[_0xf041('0x15')][_0xf041('0x16')]({'raw':_0xf673d7[_0xf041('0x17')]?_0xf673d7[_0xf041('0x17')][_0xf041('0x18')]===undefined?!![]:![]:!![],'where':_0xf673d7[_0xf041('0x17')]?_0xf673d7['options'][_0xf041('0x19')]||null:null,'attributes':_0xf673d7[_0xf041('0x17')]?_0xf673d7[_0xf041('0x17')][_0xf041('0x1a')]||null:null,'include':_0xf673d7[_0xf041('0x17')]?_0xf673d7[_0xf041('0x17')][_0xf041('0x1b')]?_['map'](_0xf673d7[_0xf041('0x17')][_0xf041('0x1b')],function(_0x37809e){return{'model':db[_0x37809e[_0xf041('0x1c')]],'as':_0x37809e['as'],'attributes':_0x37809e[_0xf041('0x1a')],'include':_0x37809e[_0xf041('0x1b')]?_['map'](_0x37809e[_0xf041('0x1b')],function(_0x31c514){return{'model':db[_0x31c514[_0xf041('0x1c')]],'as':_0x31c514['as'],'attributes':_0x31c514[_0xf041('0x1a')],'include':_0x31c514[_0xf041('0x1b')]?_['map'](_0x31c514[_0xf041('0x1b')],function(_0x2e5026){return{'model':db[_0x2e5026['model']],'as':_0x2e5026['as'],'attributes':_0x2e5026[_0xf041('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf041('0x9')](function(_0x3c64c){logger[_0xf041('0xa')](_0xf041('0x14'),_0xf673d7);logger[_0xf041('0xc')]('ShowSetting',_0xf673d7,JSON[_0xf041('0xe')](_0x3c64c));_0x1af594(_0x3c64c);})['catch'](function(_0x3a915b){logger[_0xf041('0xf')]('ShowSetting',_0x3a915b[_0xf041('0x12')],_0xf673d7);_0x193c91(_0x50ac04['error'](0x1f4,_0x3a915b[_0xf041('0x12')]));});});}; \ No newline at end of file +var _0x1c41=['error','code','message','catch','ShowSetting','Setting','options','attributes','include','map','model','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1cbaf8,_0x50354b){var _0x135f7a=function(_0x132a60){while(--_0x132a60){_0x1cbaf8['push'](_0x1cbaf8['shift']());}};_0x135f7a(++_0x50354b);}(_0x1c41,0xa7));var _0x11c4=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0x1c41[_0x11155f];return _0xd07e48;};'use strict';var _=require(_0x11c4('0x0'));var util=require(_0x11c4('0x1'));var moment=require('moment');var BPromise=require(_0x11c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11c4('0x3'));var db=require(_0x11c4('0x4'))['db'];var utils=require(_0x11c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x11c4('0x6'));var client=jayson[_0x11c4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4223f7,_0x57873e,_0x5c36f8){return new BPromise(function(_0x5d5531,_0x30efec){return client[_0x11c4('0x8')](_0x4223f7,_0x5c36f8)[_0x11c4('0x9')](function(_0x4632ee){logger[_0x11c4('0xa')](_0x11c4('0xb'),_0x57873e,_0x11c4('0xc'));logger[_0x11c4('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x57873e,_0x11c4('0xc'),JSON[_0x11c4('0xe')](_0x4632ee));if(_0x4632ee[_0x11c4('0xf')]){if(_0x4632ee['error'][_0x11c4('0x10')]===0x1f4){logger[_0x11c4('0xf')](_0x11c4('0xb'),_0x57873e,_0x4632ee[_0x11c4('0xf')][_0x11c4('0x11')]);return _0x30efec(_0x4632ee[_0x11c4('0xf')][_0x11c4('0x11')]);}logger[_0x11c4('0xf')]('Setting,\x20%s,\x20%s',_0x57873e,_0x4632ee[_0x11c4('0xf')]['message']);return _0x5d5531(_0x4632ee[_0x11c4('0xf')][_0x11c4('0x11')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x57873e,_0x11c4('0xc'));_0x5d5531(_0x4632ee['result'][_0x11c4('0x11')]);}})[_0x11c4('0x12')](function(_0x46e26f){logger['error'](_0x11c4('0xb'),_0x57873e,_0x46e26f);_0x30efec(_0x46e26f);});});}exports[_0x11c4('0x13')]=function(_0x3f9fc2){var _0x486fea=this;return new Promise(function(_0x5e8a24,_0x135e1a){return db[_0x11c4('0x14')]['find']({'raw':_0x3f9fc2[_0x11c4('0x15')]?_0x3f9fc2[_0x11c4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3f9fc2[_0x11c4('0x15')]?_0x3f9fc2['options']['where']||null:null,'attributes':_0x3f9fc2[_0x11c4('0x15')]?_0x3f9fc2[_0x11c4('0x15')][_0x11c4('0x16')]||null:null,'include':_0x3f9fc2[_0x11c4('0x15')]?_0x3f9fc2['options'][_0x11c4('0x17')]?_[_0x11c4('0x18')](_0x3f9fc2['options'][_0x11c4('0x17')],function(_0x399fb6){return{'model':db[_0x399fb6[_0x11c4('0x19')]],'as':_0x399fb6['as'],'attributes':_0x399fb6[_0x11c4('0x16')],'include':_0x399fb6[_0x11c4('0x17')]?_[_0x11c4('0x18')](_0x399fb6[_0x11c4('0x17')],function(_0x3927c7){return{'model':db[_0x3927c7[_0x11c4('0x19')]],'as':_0x3927c7['as'],'attributes':_0x3927c7[_0x11c4('0x16')],'include':_0x3927c7['include']?_['map'](_0x3927c7[_0x11c4('0x17')],function(_0x110061){return{'model':db[_0x110061[_0x11c4('0x19')]],'as':_0x110061['as'],'attributes':_0x110061[_0x11c4('0x16')]};}):[]};}):[]};}):[]:[]})[_0x11c4('0x9')](function(_0x3ce9a2){logger[_0x11c4('0xa')](_0x11c4('0x13'),_0x3f9fc2);logger['debug'](_0x11c4('0x13'),_0x3f9fc2,JSON['stringify'](_0x3ce9a2));_0x5e8a24(_0x3ce9a2);})['catch'](function(_0x5bc270){logger[_0x11c4('0xf')](_0x11c4('0x13'),_0x5bc270['message'],_0x3f9fc2);_0x135e1a(_0x486fea[_0x11c4('0xf')](0x1f4,_0x5bc270['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 961f2cf..72ef638 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 _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x1f94ac,_0x1b880c){var _0x5b0e9d=function(_0x22a14e){while(--_0x22a14e){_0x1f94ac['push'](_0x1f94ac['shift']());}};_0x5b0e9d(++_0x1b880c);}(_0x6aa7,0x178));var _0x76aa=function(_0x575536,_0x9ec086){_0x575536=_0x575536-0x0;var _0x5d762c=_0x6aa7[_0x575536];return _0x5d762c;};'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('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file +var _0x7fbe=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','post','create','/:id/notify','notify','put','delete','removeAnswers','path','connect-timeout','express'];(function(_0x39e982,_0x431e35){var _0x45bb57=function(_0x4cf829){while(--_0x4cf829){_0x39e982['push'](_0x39e982['shift']());}};_0x45bb57(++_0x431e35);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x452450,_0x40b419){_0x452450=_0x452450-0x0;var _0x448b19=_0x7fbe[_0x452450];return _0x448b19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['show']);router['get'](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x10')]);router[_0xe7fb('0x9')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x12')]);router[_0xe7fb('0x9')](_0xe7fb('0x13'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x14')]);router[_0xe7fb('0x9')](_0xe7fb('0x15'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x16')]);router['get'](_0xe7fb('0x17'),controller[_0xe7fb('0x18')]);router['get'](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['getAgents']);router[_0xe7fb('0x1a')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0x1b')]);router[_0xe7fb('0x1a')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['addDisposition']);router[_0xe7fb('0x1a')]('/:id/canned_answers',auth[_0xe7fb('0xa')](),controller['addAnswer']);router[_0xe7fb('0x1a')](_0xe7fb('0x1c'),controller[_0xe7fb('0x1d')]);router[_0xe7fb('0x1a')]('/:id/applications',auth[_0xe7fb('0xa')](),controller['addApplications']);router[_0xe7fb('0x1a')]('/:id/send',auth[_0xe7fb('0xa')](),controller['send']);router[_0xe7fb('0x1a')](_0xe7fb('0x17'),controller['status']);router[_0xe7fb('0x1a')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['addAgents']);router[_0xe7fb('0x1e')](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe7fb('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0xe7fb('0x1f')](_0xe7fb('0xf'),auth[_0xe7fb('0xa')](),controller['removeDispositions']);router[_0xe7fb('0x1f')](_0xe7fb('0x11'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x20')]);router[_0xe7fb('0x1f')](_0xe7fb('0x19'),auth[_0xe7fb('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 7bc887c..b4a9b14 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 _0x0bfd=['connectel','clickatell','bandwidth','csc','infobip','intelepeer','ENUM','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','twilio'];(function(_0x5d29c0,_0x1a25bb){var _0x40c899=function(_0x2fb6b0){while(--_0x2fb6b0){_0x5d29c0['push'](_0x5d29c0['shift']());}};_0x40c899(++_0x1a25bb);}(_0x0bfd,0x1a5));var _0xd0bf=function(_0x2b69b3,_0x8f67e4){_0x2b69b3=_0x2b69b3-0x0;var _0x628801=_0x0bfd[_0x2b69b3];return _0x628801;};'use strict';var Sequelize=require(_0xd0bf('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xd0bf('0x1')],'unique':_0xd0bf('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xd0bf('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xd0bf('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xd0bf('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd0bf('0x1')]},'type':{'type':Sequelize['ENUM'](_0xd0bf('0x3'),'skebby',_0xd0bf('0x4'),'clicksend','plivo',_0xd0bf('0x5'),_0xd0bf('0x6'),_0xd0bf('0x7'),_0xd0bf('0x8'),_0xd0bf('0x9'))},'accountSid':{'type':Sequelize[_0xd0bf('0x1')]},'authId':{'type':Sequelize[_0xd0bf('0x1')]},'authToken':{'type':Sequelize[_0xd0bf('0x1')]},'smsMethod':{'type':Sequelize[_0xd0bf('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0xd0bf('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xd0bf('0x1')]},'applicationId':{'type':Sequelize[_0xd0bf('0x1')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xd0bf('0x1')]},'deliveryReport':{'type':Sequelize[_0xd0bf('0xb')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd0bf('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd0bf('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd0bf('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd0bf('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd0bf('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xd0bf('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd0bf('0xc')],'comment':_0xd0bf('0xd')},'mandatoryDisposition':{'type':Sequelize[_0xd0bf('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x355e66){if(!_0x355e66)this[_0xd0bf('0xe')](_0xd0bf('0xf'),null);this[_0xd0bf('0xe')](_0xd0bf('0x10'),_0x355e66);}}}; \ No newline at end of file +var _0xf7df=['infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','skebby','plivo','clickatell','bandwidth','csc'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0xf7df,0x10e));var _0xff7d=function(_0x4e288d,_0x155efe){_0x4e288d=_0x4e288d-0x0;var _0x58baf6=_0xf7df[_0x4e288d];return _0x58baf6;};'use strict';var Sequelize=require(_0xff7d('0x0'));var rs=require('randomstring');module[_0xff7d('0x1')]={'name':{'type':Sequelize[_0xff7d('0x2')],'unique':_0xff7d('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xff7d('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xff7d('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xff7d('0x2')]},'type':{'type':Sequelize[_0xff7d('0x4')]('twilio',_0xff7d('0x5'),'connectel','clicksend',_0xff7d('0x6'),_0xff7d('0x7'),_0xff7d('0x8'),_0xff7d('0x9'),_0xff7d('0xa'),_0xff7d('0xb'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xff7d('0x2')]},'authToken':{'type':Sequelize[_0xff7d('0x2')]},'smsMethod':{'type':Sequelize[_0xff7d('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0xff7d('0x2')]},'password':{'type':Sequelize[_0xff7d('0x2')]},'apiKey':{'type':Sequelize[_0xff7d('0x2')]},'applicationId':{'type':Sequelize[_0xff7d('0x2')]},'accountId':{'type':Sequelize[_0xff7d('0x2')]},'senderString':{'type':Sequelize[_0xff7d('0x2')]},'deliveryReport':{'type':Sequelize[_0xff7d('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xff7d('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xff7d('0xd');}},'notificationSound':{'type':Sequelize[_0xff7d('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xff7d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xff7d('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xff7d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xff7d('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xff7d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xff7d('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xff7d('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xff7d('0xc')],'defaultValue':![],'comment':_0xff7d('0x10'),'set':function(_0x14d6b3){if(!_0x14d6b3)this[_0xff7d('0x11')](_0xff7d('0x12'),null);this[_0xff7d('0x11')](_0xff7d('0x13'),_0x14d6b3);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index cd675f9..50fde33 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 _0xc2fd=['Body','MessageSid','skebby','sender','text','connectel','from','messageId','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','refid','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','spread','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','interaction','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','\x0a','addApplications','sequelize','transaction','Transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','intelepeer','redif','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','offset','count','limit','set','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','filters','attributes','intersection','model','fields','length','nolimit','order','sort','where','pick','filter','merge','options','SmsAccount','includeAll','include','findAll','rows','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','SmsApplication','Applications','account','orderBy','priority','asc','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','type','From'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc2fd,0x69));var _0xdc2f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc2fd[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xdc2f('0x0'));var rimraf=require(_0xdc2f('0x1'));var zipdir=require(_0xdc2f('0x2'));var jsonpatch=require(_0xdc2f('0x3'));var rp=require(_0xdc2f('0x4'));var moment=require(_0xdc2f('0x5'));var BPromise=require(_0xdc2f('0x6'));var Mustache=require(_0xdc2f('0x7'));var util=require(_0xdc2f('0x8'));var path=require(_0xdc2f('0x9'));var sox=require('sox');var csv=require(_0xdc2f('0xa'));var ejs=require(_0xdc2f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdc2f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdc2f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdc2f('0xe'));var Papa=require(_0xdc2f('0xf'));var Redis=require(_0xdc2f('0x10'));var authService=require(_0xdc2f('0x11'));var qs=require(_0xdc2f('0x12'));var as=require(_0xdc2f('0x13'));var hardwareService=require(_0xdc2f('0x14'));var logger=require('../../config/logger')(_0xdc2f('0x15'));var utils=require(_0xdc2f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdc2f('0x17'));var db=require(_0xdc2f('0x18'))['db'];config[_0xdc2f('0x19')]=_[_0xdc2f('0x1a')](config['redis'],{'host':_0xdc2f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc2f('0x19')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0xdc2f('0x1c'));var client=jayson[_0xdc2f('0x1d')][_0xdc2f('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x553650,_0x4e42d6,_0x276ba5,_0x538fba){return new BPromise(function(_0x40b016,_0x462237){var _0x8bdbb3=_0x538fba||client;return _0x8bdbb3['request'](_0x553650,_0x276ba5)[_0xdc2f('0x1f')](function(_0xae8852){logger[_0xdc2f('0x20')](_0xdc2f('0x21'),_0x4e42d6,'request\x20sent');logger[_0xdc2f('0x22')](_0xdc2f('0x23'),_0x4e42d6,_0xdc2f('0x24'),JSON[_0xdc2f('0x25')](_0xae8852));if(_0xae8852[_0xdc2f('0x26')]){if(_0xae8852[_0xdc2f('0x26')][_0xdc2f('0x27')]===0x1f4){logger[_0xdc2f('0x26')]('SmsAccount,\x20%s,\x20%s',_0x4e42d6,_0xae8852['error'][_0xdc2f('0x28')]);return _0x462237(_0xae8852[_0xdc2f('0x26')]['message']);}logger[_0xdc2f('0x26')](_0xdc2f('0x21'),_0x4e42d6,_0xae8852[_0xdc2f('0x26')][_0xdc2f('0x28')]);return _0x40b016(_0xae8852[_0xdc2f('0x26')][_0xdc2f('0x28')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x4e42d6,_0xdc2f('0x24'));_0x40b016(_0xae8852[_0xdc2f('0x29')][_0xdc2f('0x28')]);}})[_0xdc2f('0x2a')](function(_0x135752){logger[_0xdc2f('0x26')](_0xdc2f('0x21'),_0x4e42d6,_0x135752);_0x462237(_0x135752);});});}function respondWithStatusCode(_0xb51155,_0x3df284){_0x3df284=_0x3df284||0xcc;return function(_0x3bee89){if(_0x3bee89){return _0xb51155[_0xdc2f('0x2b')](_0x3df284);}return _0xb51155['status'](_0x3df284)[_0xdc2f('0x2c')]();};}function respondWithResult(_0x15c5ae,_0x323190){_0x323190=_0x323190||0xc8;return function(_0x277680){if(_0x277680){return _0x15c5ae[_0xdc2f('0x2d')](_0x323190)[_0xdc2f('0x2e')](_0x277680);}};}function respondWithFilteredResult(_0x1ac18c,_0x10dc78){return function(_0x496ba6){if(_0x496ba6){var _0x1d659d=typeof _0x10dc78['offset']===_0xdc2f('0x2f')&&typeof _0x10dc78['limit']===_0xdc2f('0x2f');var _0x3d48b6=_0x496ba6['count'];var _0xace61b=_0x1d659d?0x0:_0x10dc78[_0xdc2f('0x30')];var _0x4c8eb3=_0x1d659d?_0x496ba6[_0xdc2f('0x31')]:_0x10dc78['offset']+_0x10dc78[_0xdc2f('0x32')];var _0x5216ca;if(_0x4c8eb3>=_0x3d48b6){_0x4c8eb3=_0x3d48b6;_0x5216ca=0xc8;}else{_0x5216ca=0xce;}_0x1ac18c[_0xdc2f('0x2d')](_0x5216ca);return _0x1ac18c[_0xdc2f('0x33')]('Content-Range',_0xace61b+'-'+_0x4c8eb3+'/'+_0x3d48b6)[_0xdc2f('0x2e')](_0x496ba6);}return null;};}function patchUpdates(_0x3bc6e7){return function(_0x5b905d){try{jsonpatch[_0xdc2f('0x34')](_0x5b905d,_0x3bc6e7,!![]);}catch(_0x30aa88){return BPromise[_0xdc2f('0x35')](_0x30aa88);}return _0x5b905d['save']();};}function saveUpdates(_0xd508a6,_0x4991e9){return function(_0x446954){if(_0x446954){return _0x446954[_0xdc2f('0x36')](_0xd508a6)[_0xdc2f('0x1f')](function(_0x55c920){return _0x55c920;});}return null;};}function removeEntity(_0xfb4990,_0x46a6e7){return function(_0x31e388){if(_0x31e388){return _0x31e388[_0xdc2f('0x37')]()[_0xdc2f('0x1f')](function(){var _0x441b25=_0x31e388[_0xdc2f('0x38')]({'plain':!![]});var _0x10b426=_0xdc2f('0x39');return db[_0xdc2f('0x3a')][_0xdc2f('0x37')]({'where':{'type':_0x10b426,'resourceId':_0x441b25['id']}})[_0xdc2f('0x1f')](function(){return _0x31e388;});})[_0xdc2f('0x1f')](function(){_0xfb4990['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a4005,_0x3b4643){return function(_0x31aba9){if(!_0x31aba9){_0x4a4005[_0xdc2f('0x2b')](0x194);}return _0x31aba9;};}function handleError(_0x1f3eb6,_0x4a3351){_0x4a3351=_0x4a3351||0x1f4;return function(_0x32f07f){logger[_0xdc2f('0x26')](_0x32f07f['stack']);if(_0x32f07f['name']){delete _0x32f07f[_0xdc2f('0x3b')];}_0x1f3eb6[_0xdc2f('0x2d')](_0x4a3351)[_0xdc2f('0x3c')](_0x32f07f);};}exports['index']=function(_0x2b0d01,_0xe717b0){var _0x1f413a={'include':[{'model':db[_0xdc2f('0x3d')],'as':_0xdc2f('0x3e')}]},_0xc3f93b={},_0x49c0a5={'count':0x0,'rows':[]};var _0x23e5a3=_[_0xdc2f('0x3f')](db['SmsAccount'][_0xdc2f('0x40')],function(_0x4bd18d){return{'name':_0x4bd18d[_0xdc2f('0x41')],'type':_0x4bd18d['type'][_0xdc2f('0x42')]};});_0xc3f93b['model']=_[_0xdc2f('0x3f')](_0x23e5a3,_0xdc2f('0x3b'));_0xc3f93b[_0xdc2f('0x43')]=_['keys'](_0x2b0d01[_0xdc2f('0x43')]);_0xc3f93b[_0xdc2f('0x44')]=_['intersection'](_0xc3f93b['model'],_0xc3f93b['query']);_0x1f413a[_0xdc2f('0x45')]=_[_0xdc2f('0x46')](_0xc3f93b[_0xdc2f('0x47')],qs[_0xdc2f('0x48')](_0x2b0d01[_0xdc2f('0x43')]['fields']));_0x1f413a[_0xdc2f('0x45')]=_0x1f413a[_0xdc2f('0x45')][_0xdc2f('0x49')]?_0x1f413a[_0xdc2f('0x45')]:_0xc3f93b[_0xdc2f('0x47')];if(!_0x2b0d01[_0xdc2f('0x43')]['hasOwnProperty'](_0xdc2f('0x4a'))){_0x1f413a[_0xdc2f('0x32')]=qs[_0xdc2f('0x32')](_0x2b0d01[_0xdc2f('0x43')][_0xdc2f('0x32')]);_0x1f413a[_0xdc2f('0x30')]=qs['offset'](_0x2b0d01[_0xdc2f('0x43')][_0xdc2f('0x30')]);}_0x1f413a[_0xdc2f('0x4b')]=qs[_0xdc2f('0x4c')](_0x2b0d01[_0xdc2f('0x43')][_0xdc2f('0x4c')]);_0x1f413a[_0xdc2f('0x4d')]=qs['filters'](_[_0xdc2f('0x4e')](_0x2b0d01['query'],_0xc3f93b['filters']),_0x23e5a3);if(_0x2b0d01[_0xdc2f('0x43')][_0xdc2f('0x4f')]){_0x1f413a[_0xdc2f('0x4d')]=_[_0xdc2f('0x50')](_0x1f413a[_0xdc2f('0x4d')],{'$or':_[_0xdc2f('0x3f')](_0x23e5a3,function(_0x4dc76e){if(_0x4dc76e['type']!=='VIRTUAL'){var _0x2848a0={};_0x2848a0[_0x4dc76e[_0xdc2f('0x3b')]]={'$like':'%'+_0x2b0d01[_0xdc2f('0x43')]['filter']+'%'};return _0x2848a0;}})});}_0x1f413a=_[_0xdc2f('0x50')]({},_0x1f413a,_0x2b0d01[_0xdc2f('0x51')]);var _0x1219ee={'where':_0x1f413a[_0xdc2f('0x4d')]};return db[_0xdc2f('0x52')][_0xdc2f('0x31')](_0x1219ee)['then'](function(_0x3c0387){_0x49c0a5[_0xdc2f('0x31')]=_0x3c0387;if(_0x2b0d01['query'][_0xdc2f('0x53')]){_0x1f413a[_0xdc2f('0x54')]=[{'all':!![]}];}return db['SmsAccount'][_0xdc2f('0x55')](_0x1f413a);})[_0xdc2f('0x1f')](function(_0xb7907c){_0x49c0a5[_0xdc2f('0x56')]=_0xb7907c;return _0x49c0a5;})[_0xdc2f('0x1f')](respondWithFilteredResult(_0xe717b0,_0x1f413a))['catch'](handleError(_0xe717b0,null));};exports['show']=function(_0x4c630d,_0xbe291d){var _0x4eeb88={'raw':![],'where':{'id':_0x4c630d[_0xdc2f('0x57')]['id']},'include':[{'model':db[_0xdc2f('0x3d')],'as':_0xdc2f('0x3e')}]},_0x34f783={};_0x34f783[_0xdc2f('0x47')]=_['keys'](db[_0xdc2f('0x52')]['rawAttributes']);_0x34f783[_0xdc2f('0x43')]=_[_0xdc2f('0x58')](_0x4c630d['query']);_0x34f783[_0xdc2f('0x44')]=_[_0xdc2f('0x46')](_0x34f783[_0xdc2f('0x47')],_0x34f783[_0xdc2f('0x43')]);_0x4eeb88[_0xdc2f('0x45')]=_['intersection'](_0x34f783[_0xdc2f('0x47')],qs['fields'](_0x4c630d[_0xdc2f('0x43')][_0xdc2f('0x48')]));_0x4eeb88[_0xdc2f('0x45')]=_0x4eeb88['attributes'][_0xdc2f('0x49')]?_0x4eeb88[_0xdc2f('0x45')]:_0x34f783['model'];if(_0x4c630d[_0xdc2f('0x43')][_0xdc2f('0x53')]){_0x4eeb88['include']=[{'all':!![]}];}_0x4eeb88=_['merge']({},_0x4eeb88,_0x4c630d[_0xdc2f('0x51')]);return db[_0xdc2f('0x52')]['find'](_0x4eeb88)[_0xdc2f('0x1f')](handleEntityNotFound(_0xbe291d,null))['then'](respondWithResult(_0xbe291d,null))['catch'](handleError(_0xbe291d,null));};exports[_0xdc2f('0x59')]=function(_0x56c8d9,_0x386075){return db['SmsAccount'][_0xdc2f('0x59')](_0x56c8d9[_0xdc2f('0x5a')],{})[_0xdc2f('0x1f')](function(_0x152ab7){var _0x3e939c=_0x56c8d9[_0xdc2f('0x5b')][_0xdc2f('0x38')]({'plain':!![]});if(!_0x3e939c)throw new Error(_0xdc2f('0x5c'));if(_0x3e939c['role']===_0xdc2f('0x5b')){var _0x1761a2=_0x152ab7['get']({'plain':!![]});var _0x7625e3=_0xdc2f('0x39');return db[_0xdc2f('0x5d')]['find']({'where':{'name':_0x7625e3,'userProfileId':_0x3e939c[_0xdc2f('0x5e')]},'raw':!![]})[_0xdc2f('0x1f')](function(_0x2d1cbb){if(_0x2d1cbb&&_0x2d1cbb[_0xdc2f('0x5f')]===0x0){return db[_0xdc2f('0x3a')][_0xdc2f('0x59')]({'name':_0x1761a2[_0xdc2f('0x3b')],'resourceId':_0x1761a2['id'],'type':_0x2d1cbb['name'],'sectionId':_0x2d1cbb['id']},{})[_0xdc2f('0x1f')](function(){return _0x152ab7;});}else{return _0x152ab7;}})[_0xdc2f('0x2a')](function(_0x2ab92f){logger[_0xdc2f('0x26')](_0xdc2f('0x60'),_0x2ab92f);throw _0x2ab92f;});}return _0x152ab7;})[_0xdc2f('0x1f')](respondWithResult(_0x386075,0xc9))['catch'](handleError(_0x386075,null));};exports[_0xdc2f('0x36')]=function(_0xff3ad2,_0x5c8c61){if(_0xff3ad2[_0xdc2f('0x5a')]['id']){delete _0xff3ad2['body']['id'];}return db[_0xdc2f('0x52')][_0xdc2f('0x61')]({'where':{'id':_0xff3ad2[_0xdc2f('0x57')]['id']},'include':[{'model':db[_0xdc2f('0x3d')],'as':_0xdc2f('0x3e')}]})[_0xdc2f('0x1f')](handleEntityNotFound(_0x5c8c61,null))[_0xdc2f('0x1f')](saveUpdates(_0xff3ad2[_0xdc2f('0x5a')],null))[_0xdc2f('0x1f')](respondWithResult(_0x5c8c61,null))[_0xdc2f('0x2a')](handleError(_0x5c8c61,null));};exports[_0xdc2f('0x37')]=function(_0x462c3b,_0x21d950){return db[_0xdc2f('0x52')][_0xdc2f('0x61')]({'where':{'id':_0x462c3b[_0xdc2f('0x57')]['id']}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x21d950,null))['then'](removeEntity(_0x21d950,null))[_0xdc2f('0x2a')](handleError(_0x21d950,null));};exports[_0xdc2f('0x62')]=function(_0x1a9868,_0x58ded8){return db[_0xdc2f('0x52')][_0xdc2f('0x62')]()[_0xdc2f('0x1f')](respondWithResult(_0x58ded8,null))['catch'](handleError(_0x58ded8,null));};exports['addDisposition']=function(_0x18878e,_0x547682,_0x26ecc9){if(_0x18878e['body']['id']){delete _0x18878e[_0xdc2f('0x5a')]['id'];}return db['SmsAccount'][_0xdc2f('0x61')]({'where':{'id':_0x18878e[_0xdc2f('0x57')]['id']}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x547682,null))['then'](function(_0x301df1){if(_0x301df1){_0x18878e[_0xdc2f('0x5a')][_0xdc2f('0x63')]=_0x301df1['id'];return db[_0xdc2f('0x64')][_0xdc2f('0x59')](_0x18878e['body']);}})[_0xdc2f('0x1f')](respondWithResult(_0x547682,null))[_0xdc2f('0x2a')](handleError(_0x547682,null));};exports[_0xdc2f('0x65')]=function(_0x5f5be4,_0x523c65,_0x270330){var _0x312a9e={'raw':![],'where':{}};var _0x5636b3={};var _0x4c8b2e={'count':0x0,'rows':[]};return db[_0xdc2f('0x52')][_0xdc2f('0x66')]({'where':{'id':_0x5f5be4[_0xdc2f('0x57')]['id']}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x523c65,null))['then'](function(_0x25671e){if(_0x25671e){_0x5636b3[_0xdc2f('0x47')]=_[_0xdc2f('0x58')](db[_0xdc2f('0x64')][_0xdc2f('0x40')]);_0x5636b3[_0xdc2f('0x43')]=_[_0xdc2f('0x58')](_0x5f5be4[_0xdc2f('0x43')]);_0x5636b3[_0xdc2f('0x44')]=_['intersection'](_0x5636b3[_0xdc2f('0x47')],_0x5636b3[_0xdc2f('0x43')]);_0x312a9e[_0xdc2f('0x45')]=_[_0xdc2f('0x46')](_0x5636b3[_0xdc2f('0x47')],qs['fields'](_0x5f5be4[_0xdc2f('0x43')]['fields']));_0x312a9e[_0xdc2f('0x45')]=_0x312a9e[_0xdc2f('0x45')][_0xdc2f('0x49')]?_0x312a9e[_0xdc2f('0x45')]:_0x5636b3[_0xdc2f('0x47')];if(!_0x5f5be4[_0xdc2f('0x43')][_0xdc2f('0x67')](_0xdc2f('0x4a'))){_0x312a9e[_0xdc2f('0x32')]=qs[_0xdc2f('0x32')](_0x5f5be4['query'][_0xdc2f('0x32')]);_0x312a9e[_0xdc2f('0x30')]=qs[_0xdc2f('0x30')](_0x5f5be4['query'][_0xdc2f('0x30')]);}_0x312a9e[_0xdc2f('0x4b')]=qs[_0xdc2f('0x4c')](_0x5f5be4['query'][_0xdc2f('0x4c')]);_0x312a9e[_0xdc2f('0x4d')]=qs[_0xdc2f('0x44')](_[_0xdc2f('0x4e')](_0x5f5be4[_0xdc2f('0x43')],_0x5636b3['filters']));_0x312a9e[_0xdc2f('0x4d')][_0xdc2f('0x63')]=_0x25671e['id'];if(_0x5f5be4[_0xdc2f('0x43')][_0xdc2f('0x4f')]){_0x312a9e[_0xdc2f('0x4d')]=_['merge'](_0x312a9e[_0xdc2f('0x4d')],{'$or':_[_0xdc2f('0x3f')](_0x312a9e[_0xdc2f('0x45')],function(_0x161cd9){var _0x21e1f1={};_0x21e1f1[_0x161cd9]={'$like':'%'+_0x5f5be4['query'][_0xdc2f('0x4f')]+'%'};return _0x21e1f1;})});}_0x312a9e=_['merge']({},_0x312a9e,_0x5f5be4[_0xdc2f('0x51')]);return db[_0xdc2f('0x64')]['count']({'where':_0x312a9e[_0xdc2f('0x4d')]})[_0xdc2f('0x1f')](function(_0x1d79e8){_0x4c8b2e[_0xdc2f('0x31')]=_0x1d79e8;if(_0x5f5be4[_0xdc2f('0x43')]['includeAll']){_0x312a9e[_0xdc2f('0x54')]=[{'all':!![]}];}return db[_0xdc2f('0x64')][_0xdc2f('0x55')](_0x312a9e);})[_0xdc2f('0x1f')](function(_0x1fa669){_0x4c8b2e[_0xdc2f('0x56')]=_0x1fa669;return _0x4c8b2e;});}})[_0xdc2f('0x1f')](respondWithFilteredResult(_0x523c65,_0x312a9e))['catch'](handleError(_0x523c65,null));};exports[_0xdc2f('0x68')]=function(_0x3a04fa,_0x46ea5f,_0x392707){return db[_0xdc2f('0x52')]['find']({'where':{'id':_0x3a04fa['params']['id']}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x46ea5f,null))[_0xdc2f('0x1f')](function(_0x8958b7){if(_0x8958b7){return _0x8958b7[_0xdc2f('0x68')](_0x3a04fa[_0xdc2f('0x43')][_0xdc2f('0x69')]);}})['then'](respondWithStatusCode(_0x46ea5f,null))[_0xdc2f('0x2a')](handleError(_0x46ea5f,null));};exports[_0xdc2f('0x6a')]=function(_0xb9b59c,_0x5349b1,_0x43a544){if(_0xb9b59c['body']['id']){delete _0xb9b59c['body']['id'];}return db[_0xdc2f('0x52')][_0xdc2f('0x61')]({'where':{'id':_0xb9b59c[_0xdc2f('0x57')]['id']}})['then'](handleEntityNotFound(_0x5349b1,null))[_0xdc2f('0x1f')](function(_0x505577){if(_0x505577){_0xb9b59c['body'][_0xdc2f('0x63')]=_0x505577['id'];return db['CannedAnswer'][_0xdc2f('0x59')](_0xb9b59c[_0xdc2f('0x5a')]);}})[_0xdc2f('0x1f')](respondWithResult(_0x5349b1,null))['catch'](handleError(_0x5349b1,null));};exports[_0xdc2f('0x6b')]=function(_0x2b15fd,_0x48467f,_0x2270ea){var _0x6878c6={'raw':![],'where':{}};var _0x15590c={};var _0x419ab7={'count':0x0,'rows':[]};return db['SmsAccount'][_0xdc2f('0x66')]({'where':{'id':_0x2b15fd[_0xdc2f('0x57')]['id']}})['then'](handleEntityNotFound(_0x48467f,null))['then'](function(_0x4f5f9a){if(_0x4f5f9a){_0x15590c[_0xdc2f('0x47')]=_[_0xdc2f('0x58')](db[_0xdc2f('0x6c')]['rawAttributes']);_0x15590c[_0xdc2f('0x43')]=_[_0xdc2f('0x58')](_0x2b15fd[_0xdc2f('0x43')]);_0x15590c[_0xdc2f('0x44')]=_[_0xdc2f('0x46')](_0x15590c[_0xdc2f('0x47')],_0x15590c[_0xdc2f('0x43')]);_0x6878c6[_0xdc2f('0x45')]=_[_0xdc2f('0x46')](_0x15590c[_0xdc2f('0x47')],qs[_0xdc2f('0x48')](_0x2b15fd[_0xdc2f('0x43')]['fields']));_0x6878c6[_0xdc2f('0x45')]=_0x6878c6[_0xdc2f('0x45')][_0xdc2f('0x49')]?_0x6878c6[_0xdc2f('0x45')]:_0x15590c[_0xdc2f('0x47')];if(!_0x2b15fd[_0xdc2f('0x43')][_0xdc2f('0x67')]('nolimit')){_0x6878c6['limit']=qs[_0xdc2f('0x32')](_0x2b15fd[_0xdc2f('0x43')][_0xdc2f('0x32')]);_0x6878c6[_0xdc2f('0x30')]=qs[_0xdc2f('0x30')](_0x2b15fd[_0xdc2f('0x43')][_0xdc2f('0x30')]);}_0x6878c6[_0xdc2f('0x4b')]=qs[_0xdc2f('0x4c')](_0x2b15fd[_0xdc2f('0x43')][_0xdc2f('0x4c')]);_0x6878c6['where']=qs[_0xdc2f('0x44')](_[_0xdc2f('0x4e')](_0x2b15fd[_0xdc2f('0x43')],_0x15590c[_0xdc2f('0x44')]));_0x6878c6['where'][_0xdc2f('0x63')]=_0x4f5f9a['id'];if(_0x2b15fd[_0xdc2f('0x43')][_0xdc2f('0x4f')]){_0x6878c6[_0xdc2f('0x4d')]=_[_0xdc2f('0x50')](_0x6878c6[_0xdc2f('0x4d')],{'$or':_[_0xdc2f('0x3f')](_0x6878c6[_0xdc2f('0x45')],function(_0x470705){var _0x568b83={};_0x568b83[_0x470705]={'$like':'%'+_0x2b15fd['query'][_0xdc2f('0x4f')]+'%'};return _0x568b83;})});}_0x6878c6=_['merge']({},_0x6878c6,_0x2b15fd[_0xdc2f('0x51')]);return db[_0xdc2f('0x6c')][_0xdc2f('0x31')]({'where':_0x6878c6[_0xdc2f('0x4d')]})[_0xdc2f('0x1f')](function(_0xa7167e){_0x419ab7[_0xdc2f('0x31')]=_0xa7167e;if(_0x2b15fd[_0xdc2f('0x43')][_0xdc2f('0x53')]){_0x6878c6['include']=[{'all':!![]}];}return db[_0xdc2f('0x6c')][_0xdc2f('0x55')](_0x6878c6);})['then'](function(_0xb2b0ea){_0x419ab7['rows']=_0xb2b0ea;return _0x419ab7;});}})[_0xdc2f('0x1f')](respondWithFilteredResult(_0x48467f,_0x6878c6))[_0xdc2f('0x2a')](handleError(_0x48467f,null));};exports[_0xdc2f('0x6d')]=function(_0x2bede4,_0x26f2db,_0x3c24fc){return db[_0xdc2f('0x52')]['find']({'where':{'id':_0x2bede4[_0xdc2f('0x57')]['id']}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x26f2db,null))[_0xdc2f('0x1f')](function(_0x2fe365){if(_0x2fe365){return _0x2fe365['removeAnswers'](_0x2bede4[_0xdc2f('0x43')][_0xdc2f('0x69')]);}})['then'](respondWithStatusCode(_0x26f2db,null))[_0xdc2f('0x2a')](handleError(_0x26f2db,null));};exports[_0xdc2f('0x6e')]=function(_0x2e0cf0,_0xb5c51c,_0x3209d7){var _0x4f1e3e={'channel':'sms'};var _0x12a0a8=[];var _0x4fdce5=[];var _0x24d07e={};return db['SmsAccount'][_0xdc2f('0x61')]({'where':{'id':_0x2e0cf0['params']['id']},'include':[{'model':db[_0xdc2f('0x6f')],'as':_0xdc2f('0x70')}]})['then'](handleEntityNotFound(_0xb5c51c,null))[_0xdc2f('0x1f')](function(_0x14ea76){_0x4f1e3e[_0xdc2f('0x71')]=_0x14ea76;_0x4f1e3e['applications']=_[_0xdc2f('0x72')](_0x14ea76[_0xdc2f('0x70')],[_0xdc2f('0x73')],[_0xdc2f('0x74')]);if(_0x4f1e3e[_0xdc2f('0x71')][_0xdc2f('0x70')]){delete _0x4f1e3e[_0xdc2f('0x71')][_0xdc2f('0x70')];}return db['CmContact']['describe']();})['then'](function(_0x484d73){if(!_0x484d73){throw new db['Sequelize'][(_0xdc2f('0x75'))](_0xdc2f('0x76'));}_0x12a0a8=_[_0xdc2f('0x77')](_[_0xdc2f('0x58')](_0x484d73),[_0xdc2f('0x78'),_0xdc2f('0x79')]);_0x4fdce5=_[_0xdc2f('0x77')](_['keys'](_0x484d73),[_0xdc2f('0x78'),_0xdc2f('0x79'),'CompanyId',_0xdc2f('0x7a')]);_0x4f1e3e[_0xdc2f('0x5a')]={'mapKey':_0xdc2f('0x7b')};if(_0x4f1e3e[_0xdc2f('0x71')][_0xdc2f('0x7c')]){switch(_0x4f1e3e[_0xdc2f('0x71')][_0xdc2f('0x7c')]){case'twilio':_0x4f1e3e['body']['from']=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x7d')];_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x5a')]=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x7e')];_0x4f1e3e['body']['messageId']=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x7f')];break;case _0xdc2f('0x80'):_0x4f1e3e[_0xdc2f('0x5a')]['from']='+'+_0x2e0cf0['body'][_0xdc2f('0x81')];_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x5a')]=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x82')];break;case _0xdc2f('0x83'):_0x4f1e3e[_0xdc2f('0x5a')]['from']=_0x2e0cf0['body']['from'];_0x4f1e3e['body'][_0xdc2f('0x5a')]=_0x2e0cf0['body'][_0xdc2f('0x28')];break;case'clicksend':_0x4f1e3e['body'][_0xdc2f('0x84')]=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x84')];_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x5a')]=_0x2e0cf0['body']['body'];_0x4f1e3e['body'][_0xdc2f('0x85')]=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x86')];break;case _0xdc2f('0x87'):_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x84')]=_0x2e0cf0['body'][_0xdc2f('0x7d')];_0x4f1e3e['body'][_0xdc2f('0x5a')]=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x88')];_0x4f1e3e['body'][_0xdc2f('0x85')]=_0x2e0cf0['body'][_0xdc2f('0x89')];break;case _0xdc2f('0x8a'):_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x84')]='+'+_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x8b')][0x0]['from'];_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x5a')]=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x8b')][0x0]['text'];_0x4f1e3e['body']['messageId']=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x8b')][0x0][_0xdc2f('0x85')];break;case _0xdc2f('0x8c'):_0x4f1e3e['body'][_0xdc2f('0x84')]=_0x2e0cf0['body'][_0xdc2f('0x8d')];_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x5a')]=_0x2e0cf0['body'][_0xdc2f('0x8e')]['message'];break;case _0xdc2f('0x8f'):_0x4f1e3e[_0xdc2f('0x5a')]['from']=_0x2e0cf0[_0xdc2f('0x5a')]['fromNumber'];_0x4f1e3e['body'][_0xdc2f('0x5a')]=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x82')];_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x85')]=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x90')];break;case _0xdc2f('0x91'):_0x4f1e3e[_0xdc2f('0x5a')]['messageId']=_0x2e0cf0[_0xdc2f('0x5a')][0x0][_0xdc2f('0x28')]['id'];_0x4f1e3e[_0xdc2f('0x5a')]['from']=_0x2e0cf0['body'][0x0]['message']['from'];_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x5a')]=_0x2e0cf0[_0xdc2f('0x5a')][0x0][_0xdc2f('0x28')][_0xdc2f('0x82')];break;case'intelepeer':_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x84')]=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x84')];_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x5a')]=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x28')];_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x85')]=_0x2e0cf0[_0xdc2f('0x5a')][_0xdc2f('0x92')];break;}}if(_0x4f1e3e['body']['id']){delete _0x4f1e3e[_0xdc2f('0x5a')]['id'];}if(_['isNil'](_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x84')])){throw new db['Sequelize'][(_0xdc2f('0x75'))]('from\x20is\x20mandatory');}if(_[_0xdc2f('0x93')](_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x5a')])||_0x4f1e3e[_0xdc2f('0x5a')]['body']===''){throw new db[(_0xdc2f('0x94'))]['ValidationError'](_0xdc2f('0x95'));}if(_['isNil'](_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x96')])){throw new db['Sequelize'][(_0xdc2f('0x75'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4fdce5);}if(!_[_0xdc2f('0x97')](_0x4fdce5,_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x96')])){throw new db[(_0xdc2f('0x94'))]['ValidationError'](_0xdc2f('0x98')+_0x4fdce5);}_0x24d07e[_0x4f1e3e['body'][_0xdc2f('0x96')]]=_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x84')];return db[_0xdc2f('0x99')][_0xdc2f('0x61')]({'where':{'id':_0x4f1e3e['account'][_0xdc2f('0x7a')]},'include':[{'model':db[_0xdc2f('0x9a')],'as':_0xdc2f('0x9b'),'where':_0x24d07e,'limit':0x1,'order':[[_0xdc2f('0x79'),_0xdc2f('0x9c')]]}]});})[_0xdc2f('0x1f')](handleEntityNotFound(_0xb5c51c,null))[_0xdc2f('0x1f')](function(_0x2b4261){if(_0x2b4261){_0x4f1e3e[_0xdc2f('0x9d')]=_[_0xdc2f('0x9e')](_0x2b4261,['Contacts']);if(_0x2b4261['Contacts'][_0xdc2f('0x49')]){return _0x2b4261[_0xdc2f('0x9b')][0x0];}var _0x3829f1=_[_0xdc2f('0x1a')](_0x4f1e3e[_0xdc2f('0x5a')],{'firstName':_0x4f1e3e[_0xdc2f('0x5a')]['from'],'ListId':_0x2b4261['id']});_0x3829f1[_0x4f1e3e['body']['mapKey']]=_0x4f1e3e['body'][_0xdc2f('0x84')];return db['CmContact'][_0xdc2f('0x59')](_0x3829f1,{'fields':_0x12a0a8,'raw':!![]});}})['then'](handleEntityNotFound(_0xb5c51c,null))[_0xdc2f('0x1f')](function(_0x4b3694){if(_0x4b3694){_0x4f1e3e[_0xdc2f('0x9f')]=_0x4b3694;var _0x297af9={'ContactId':_0x4b3694['id'],'phone':_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x84')],'SmsAccountId':_0x2e0cf0[_0xdc2f('0x57')]['id']};var _0x445413={'ContactId':_0x4b3694['id'],'SmsAccountId':_0x2e0cf0['params']['id'],'closed':![]};return db[_0xdc2f('0xa0')]['find']({'where':_0x445413})[_0xdc2f('0x1f')](function(_0x5304bc){if(_0x5304bc){return[_0x5304bc,![]];}return db[_0xdc2f('0xa0')]['create'](_0x297af9)[_0xdc2f('0x1f')](function(_0x319bfb){return[_0x319bfb,!![]];});});}})[_0xdc2f('0xa1')](function(_0x177b54,_0x1dfcce){_0x4f1e3e['interaction']=_0x177b54[_0xdc2f('0x38')]({'plain':!![]});_0x4f1e3e['interaction'][_0xdc2f('0xa2')]=![];if(_0x1dfcce){if(_0x4f1e3e[_0xdc2f('0x71')][_0xdc2f('0xa3')]){_0x4f1e3e[_0xdc2f('0xa4')][_0xdc2f('0xa5')]({'id':0x0,'priority':_0x4f1e3e['applications']['length']+0x1,'app':_0xdc2f('0xa6'),'appdata':_0xdc2f('0xa7'),'interval':_0xdc2f('0xa8')});}_0x4f1e3e['interaction'][_0xdc2f('0xa2')]=!![];}return db[_0xdc2f('0xa9')][_0xdc2f('0x59')]({'phone':_0x4f1e3e[_0xdc2f('0x5a')][_0xdc2f('0x84')],'messageId':_0x4f1e3e['body'][_0xdc2f('0x85')],'body':_0x4f1e3e['body'][_0xdc2f('0x5a')],'SmsAccountId':_0x2e0cf0[_0xdc2f('0x57')]['id'],'SmsInteractionId':_0x177b54['id'],'direction':'in','ContactId':_0x177b54[_0xdc2f('0xaa')],'AttachmentId':_0x4f1e3e['body'][_0xdc2f('0xab')]});})[_0xdc2f('0x1f')](function(_0x5d3065){_0x4f1e3e[_0xdc2f('0x28')]=_0x5d3065;if(_0x4f1e3e[_0xdc2f('0xac')][_0xdc2f('0xad')]){return db[_0xdc2f('0xae')][_0xdc2f('0x61')]({'attributes':['id',_0xdc2f('0x3b')],'where':{'id':_0x4f1e3e[_0xdc2f('0xac')][_0xdc2f('0xad')]}})[_0xdc2f('0x1f')](function(_0x4e31ca){if(_0x4e31ca){_0x4f1e3e[_0xdc2f('0xa4')][_0xdc2f('0xaf')]({'id':0x0,'priority':0x0,'app':_0xdc2f('0xb0'),'appdata':_0x4e31ca['name']+','+(_0x4f1e3e['account'][_0xdc2f('0xb1')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xdc2f('0xb2'),_0x4f1e3e);});}return respondWithRpcPromise(_0xdc2f('0xb3'),_0xdc2f('0xb2'),_0x4f1e3e);})['then'](function(_0x2cf4a3){if(_0x2cf4a3){var _0x2d4e42=0xc8;var _0x41072c='receiveMessage';logger['info'](_0xdc2f('0x23'),_0x41072c,_0x2d4e42,'entity\x20found');logger[_0xdc2f('0x22')](_0xdc2f('0xb4'),_0x41072c,_0x2d4e42,_0xdc2f('0xb5'),JSON[_0xdc2f('0x25')](_0x2cf4a3));if(_0x4f1e3e[_0xdc2f('0x71')][_0xdc2f('0x7c')]===_0xdc2f('0xb6')){return _0xb5c51c[_0xdc2f('0x2d')](_0x2d4e42)[_0xdc2f('0x33')]('Content-Type','text/xml')[_0xdc2f('0x3c')](_0xdc2f('0xb7'));}else{return _0xb5c51c[_0xdc2f('0x2d')](_0x2d4e42)['json'](_0x2cf4a3);}}})[_0xdc2f('0x2a')](handleError(_0xb5c51c,null));};exports[_0xdc2f('0xb8')]=function(_0x27150c,_0x2a4719){var _0x5c7623=_0x27150c['params']['id'];var _0x45ad92=_0x27150c[_0xdc2f('0x5a')];var _0x22f35c=0xc8;var _0x18712f=null;return db[_0xdc2f('0xb9')][_0xdc2f('0xba')]({'isolationLevel':db[_0xdc2f('0xb9')][_0xdc2f('0xbb')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3e1f27){return db['SmsAccount'][_0xdc2f('0x66')]({'where':{'id':_0x5c7623},'transaction':_0x3e1f27})[_0xdc2f('0x1f')](function(_0x21493f){if(_0x21493f){return db[_0xdc2f('0x6f')][_0xdc2f('0x37')]({'where':{'SmsAccountId':_0x5c7623},'transaction':_0x3e1f27})[_0xdc2f('0x1f')](function(){var _0x20439c=_['map'](_0x45ad92,function(_0x151a3d){_0x151a3d[_0xdc2f('0x63')]=_0x5c7623;return _0x151a3d;});return db[_0xdc2f('0x6f')][_0xdc2f('0xbc')](_0x20439c,{'transaction':_0x3e1f27});});}else{_0x22f35c=0x194;_0x18712f=[];}});})[_0xdc2f('0x1f')](function(){if(_0x22f35c!==0x194){return db[_0xdc2f('0x6f')][_0xdc2f('0xbd')]({'where':{'SmsAccountId':_0x5c7623},'order':'priority'})['then'](function(_0x319b01){_0x18712f=_0x319b01;});}})[_0xdc2f('0x2a')](function(_0xc5c172){_0x22f35c=0x1f4;logger['error'](_0xc5c172['stack']);if(_0xc5c172['name']){delete _0xc5c172[_0xdc2f('0x3b')];}_0x18712f=_0xc5c172;})['finally'](function(){if(_0x18712f===null){_0x2a4719[_0xdc2f('0x2b')](_0x22f35c);}else{if(_0x22f35c===0x1f4){_0x2a4719['status'](_0x22f35c)[_0xdc2f('0x3c')](_0x18712f);}else{_0x2a4719[_0xdc2f('0x2d')](_0x22f35c)[_0xdc2f('0x2e')](_0x18712f);}}});};exports['getApplications']=function(_0x4534a6,_0x5d20a8,_0x32f46c){var _0x464eff={};var _0x469184={};var _0x46ab11;var _0x4370e4;return db[_0xdc2f('0x52')][_0xdc2f('0x66')]({'where':{'id':_0x4534a6[_0xdc2f('0x57')]['id']}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x5d20a8,null))[_0xdc2f('0x1f')](function(_0x259cbc){if(_0x259cbc){_0x46ab11=_0x259cbc;_0x469184['model']=_[_0xdc2f('0x58')](db['SmsApplication']['rawAttributes']);_0x469184[_0xdc2f('0x43')]=_[_0xdc2f('0x58')](_0x4534a6['query']);_0x469184['filters']=_['intersection'](_0x469184['model'],_0x469184[_0xdc2f('0x43')]);_0x464eff[_0xdc2f('0x45')]=_['intersection'](_0x469184['model'],qs['fields'](_0x4534a6['query']['fields']));_0x464eff['attributes']=_0x464eff[_0xdc2f('0x45')][_0xdc2f('0x49')]?_0x464eff[_0xdc2f('0x45')]:_0x469184[_0xdc2f('0x47')];_0x464eff[_0xdc2f('0x4b')]=qs['sort'](_0x4534a6[_0xdc2f('0x43')][_0xdc2f('0x4c')]);_0x464eff['where']=qs[_0xdc2f('0x44')](_['pick'](_0x4534a6[_0xdc2f('0x43')],_0x469184['filters']));if(_0x4534a6[_0xdc2f('0x43')]['filter']){_0x464eff[_0xdc2f('0x4d')]=_[_0xdc2f('0x50')](_0x464eff[_0xdc2f('0x4d')],{'$or':_[_0xdc2f('0x3f')](_0x464eff['attributes'],function(_0x1f6eab){var _0x5f150f={};_0x5f150f[_0x1f6eab]={'$like':'%'+_0x4534a6[_0xdc2f('0x43')]['filter']+'%'};return _0x5f150f;})});}_0x464eff=_[_0xdc2f('0x50')]({},_0x464eff,_0x4534a6[_0xdc2f('0x51')]);return _0x46ab11['getApplications'](_0x464eff);}})['then'](function(_0x48904c){if(_0x48904c){_0x4370e4=_0x48904c[_0xdc2f('0x49')];if(!_0x4534a6[_0xdc2f('0x43')][_0xdc2f('0x67')](_0xdc2f('0x4a'))){_0x464eff[_0xdc2f('0x32')]=qs[_0xdc2f('0x32')](_0x4534a6[_0xdc2f('0x43')]['limit']);_0x464eff[_0xdc2f('0x30')]=qs['offset'](_0x4534a6[_0xdc2f('0x43')][_0xdc2f('0x30')]);}return _0x46ab11[_0xdc2f('0xbe')](_0x464eff);}})['then'](function(_0x5b2c3f){if(_0x5b2c3f){return _0x5b2c3f?{'count':_0x4370e4,'rows':_0x5b2c3f}:null;}})[_0xdc2f('0x1f')](respondWithResult(_0x5d20a8,null))[_0xdc2f('0x2a')](handleError(_0x5d20a8,null));};exports[_0xdc2f('0xbf')]=function(_0x15875a,_0x4fe67c,_0x3179b9){var _0x27bb73={'raw':![],'where':{}};var _0x406ee2={};var _0x92d631={'count':0x0,'rows':[]};return db[_0xdc2f('0x52')]['findOne']({'where':{'id':_0x15875a[_0xdc2f('0x57')]['id']}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x4fe67c,null))[_0xdc2f('0x1f')](function(_0x352a36){if(_0x352a36){_0x406ee2[_0xdc2f('0x47')]=_[_0xdc2f('0x58')](db['SmsInteraction'][_0xdc2f('0x40')]);_0x406ee2[_0xdc2f('0x43')]=_[_0xdc2f('0x58')](_0x15875a[_0xdc2f('0x43')]);_0x406ee2['filters']=_[_0xdc2f('0x46')](_0x406ee2[_0xdc2f('0x47')],_0x406ee2[_0xdc2f('0x43')]);_0x27bb73[_0xdc2f('0x45')]=_[_0xdc2f('0x46')](_0x406ee2['model'],qs[_0xdc2f('0x48')](_0x15875a['query']['fields']));_0x27bb73[_0xdc2f('0x45')]=_0x27bb73['attributes'][_0xdc2f('0x49')]?_0x27bb73[_0xdc2f('0x45')]:_0x406ee2[_0xdc2f('0x47')];if(!_0x15875a[_0xdc2f('0x43')]['hasOwnProperty']('nolimit')){_0x27bb73[_0xdc2f('0x32')]=qs['limit'](_0x15875a['query'][_0xdc2f('0x32')]);_0x27bb73[_0xdc2f('0x30')]=qs[_0xdc2f('0x30')](_0x15875a[_0xdc2f('0x43')][_0xdc2f('0x30')]);}_0x27bb73[_0xdc2f('0x4b')]=qs[_0xdc2f('0x4c')](_0x15875a[_0xdc2f('0x43')][_0xdc2f('0x4c')]);_0x27bb73[_0xdc2f('0x4d')]=qs[_0xdc2f('0x44')](_['pick'](_0x15875a['query'],_0x406ee2['filters']));_0x27bb73[_0xdc2f('0x4d')][_0xdc2f('0x63')]=_0x352a36['id'];if(_0x15875a[_0xdc2f('0x43')][_0xdc2f('0x4f')]){_0x27bb73[_0xdc2f('0x4d')]=_[_0xdc2f('0x50')](_0x27bb73[_0xdc2f('0x4d')],{'$or':_['map'](_0x27bb73[_0xdc2f('0x45')],function(_0x217917){var _0x53c01c={};_0x53c01c[_0x217917]={'$like':'%'+_0x15875a[_0xdc2f('0x43')][_0xdc2f('0x4f')]+'%'};return _0x53c01c;})});}_0x27bb73=_[_0xdc2f('0x50')]({},_0x27bb73,_0x15875a[_0xdc2f('0x51')]);return db[_0xdc2f('0xa0')][_0xdc2f('0x31')]({'where':_0x27bb73[_0xdc2f('0x4d')]})[_0xdc2f('0x1f')](function(_0xbc66d5){_0x92d631[_0xdc2f('0x31')]=_0xbc66d5;if(_0x15875a[_0xdc2f('0x43')][_0xdc2f('0x53')]){_0x27bb73[_0xdc2f('0x54')]=[{'model':db['CmContact'],'as':_0xdc2f('0xc0'),'required':![]},{'model':db[_0xdc2f('0xae')],'as':_0xdc2f('0xc1'),'attributes':[_0xdc2f('0x3b'),_0xdc2f('0xc2'),_0xdc2f('0xc3')],'required':![]},{'model':db[_0xdc2f('0xc4')],'as':_0xdc2f('0xc5'),'attributes':['id',_0xdc2f('0x3b'),_0xdc2f('0xc6')],'where':_0x15875a['query']['tag']?{'id':_0x15875a['query']['tag']}:undefined,'required':_0x15875a['query'][_0xdc2f('0xc7')]?!![]:![]}];}return db[_0xdc2f('0xa0')][_0xdc2f('0x55')](_0x27bb73);})[_0xdc2f('0x1f')](function(_0x3d7e34){_0x92d631[_0xdc2f('0x56')]=_0x3d7e34;return _0x92d631;});}})[_0xdc2f('0x1f')](respondWithFilteredResult(_0x4fe67c,_0x27bb73))[_0xdc2f('0x2a')](handleError(_0x4fe67c,null));};exports[_0xdc2f('0x3c')]=function(_0x1d9eb5,_0x45d7ff,_0x55c0b7){var _0x461003,_0x21821f,_0x509f76;if(_[_0xdc2f('0x93')](_0x1d9eb5[_0xdc2f('0x5a')][_0xdc2f('0x5a')])||_0x1d9eb5[_0xdc2f('0x5a')][_0xdc2f('0x5a')]===''){throw new db['Sequelize']['ValidationError'](_0xdc2f('0x95'));}if(_[_0xdc2f('0x93')](_0x1d9eb5['body']['to'])){throw new db[(_0xdc2f('0x94'))][(_0xdc2f('0x75'))](_0xdc2f('0xc8'));}_0x461003=_0x1d9eb5[_0xdc2f('0x5a')]['to'];return db['SmsAccount'][_0xdc2f('0x61')]({'where':{'id':_0x1d9eb5['params']['id']},'include':[{'model':db[_0xdc2f('0x99')],'as':_0xdc2f('0xc9'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x461003},'limit':0x1,'order':[[_0xdc2f('0x79'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x45d7ff,null))[_0xdc2f('0x1f')](function(_0x1022a0){if(_0x1022a0&&_0x1022a0[_0xdc2f('0xc9')]){_0x21821f=_0x1022a0[_0xdc2f('0x38')]({'plain':!![]});if(_0x21821f[_0xdc2f('0xc9')]&&_0x21821f[_0xdc2f('0xc9')][_0xdc2f('0x9b')][_0xdc2f('0x49')]){return _0x21821f[_0xdc2f('0xc9')][_0xdc2f('0x9b')][0x0];}return db[_0xdc2f('0x9a')][_0xdc2f('0x59')](_[_0xdc2f('0x1a')](_0x1d9eb5[_0xdc2f('0x5a')],{'firstName':_0x461003,'mobile':_0x461003,'phone':_0x461003,'ListId':_0x21821f[_0xdc2f('0x7a')]}));}})['then'](handleEntityNotFound(_0x45d7ff,null))[_0xdc2f('0x1f')](function(_0x1d40d6){if(_0x1d40d6){_0x509f76=_0x1d40d6;return db[_0xdc2f('0xa0')][_0xdc2f('0x61')]({'where':{'ContactId':_0x509f76['id'],'closed':![],'SmsAccountId':_0x21821f['id']}})[_0xdc2f('0x1f')](function(_0x5a4cda){if(_0x5a4cda){return[_0x5a4cda,![]];}return db[_0xdc2f('0xa0')]['create']({'UserId':_0x1d9eb5[_0xdc2f('0x5b')]['id'],'ContactId':_0x509f76['id'],'SmsAccountId':_0x21821f['id'],'phone':_0x461003,'firstMsgDirection':_0xdc2f('0xca'),'Messages':[_[_0xdc2f('0x50')](_0x1d9eb5[_0xdc2f('0x5a')],{'read':![],'body':_0x1d9eb5['body']['body'],'phone':_0x461003,'SmsAccountId':_0x21821f['id'],'UserId':_0x1d9eb5['user']['id'],'ContactId':_0x509f76['id']})]},{'include':[{'model':db[_0xdc2f('0xa9')],'as':_0xdc2f('0xcb')}]})[_0xdc2f('0x1f')](function(_0x548607){return[_0x548607,!![]];});});}})[_0xdc2f('0xa1')](function(_0xda6928,_0x272b54){if(_0x272b54){return _0xda6928;}return db[_0xdc2f('0xa9')][_0xdc2f('0x59')](_[_0xdc2f('0x50')](_0x1d9eb5[_0xdc2f('0x5a')],{'read':![],'body':_0x1d9eb5[_0xdc2f('0x5a')][_0xdc2f('0x5a')],'phone':_0x461003,'SmsAccountId':_0x21821f['id'],'SmsInteractionId':_0xda6928['id'],'UserId':_0x1d9eb5[_0xdc2f('0x5b')]['id'],'ContactId':_0x509f76['id']}))[_0xdc2f('0x1f')](function(_0x5cf975){_0xda6928['dataValues'][_0xdc2f('0xcb')]=[];_0xda6928[_0xdc2f('0xcc')][_0xdc2f('0xcb')]['push'](_0x5cf975[_0xdc2f('0xcc')]);return _0xda6928;});})[_0xdc2f('0x1f')](respondWithResult(_0x45d7ff,null))[_0xdc2f('0x2a')](handleError(_0x45d7ff,null));};exports[_0xdc2f('0x2d')]=function(_0x42cb2b,_0x21f4b6,_0x3933a6){if(_0x42cb2b['body']['id']){delete _0x42cb2b[_0xdc2f('0x5a')]['id'];}var _0x2d4007,_0x25b151,_0x5645e1;return db[_0xdc2f('0x52')]['find']({'where':{'id':_0x42cb2b[_0xdc2f('0x57')]['id']}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x21f4b6,null))[_0xdc2f('0x1f')](function(_0x10088e){if(_0x10088e){_0x5645e1=_0x10088e;logger[_0xdc2f('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdc2f('0x2d'),'received\x20delivery\x20report\x20from',_0x10088e['type'],util['inspect'](_0x42cb2b[_0xdc2f('0x5a')],{'showHidden':![],'depth':null}));switch(_0x10088e[_0xdc2f('0x7c')]){case _0xdc2f('0x80'):if(_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0xcd')]&&_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0x2d')]){_0x25b151=_0x42cb2b[_0xdc2f('0x5a')]['status'];return db['SmsMessage'][_0xdc2f('0x61')]({'where':{'messageId':_0x42cb2b[_0xdc2f('0x5a')]['skebby_dispatch_id']}});}break;case _0xdc2f('0x83'):if(_0x42cb2b['body'][_0xdc2f('0xce')]&&_0x42cb2b[_0xdc2f('0x5a')]['statusInt']){_0x25b151=_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0xcf')];return db[_0xdc2f('0xa9')][_0xdc2f('0x61')]({'where':{'messageId':_0x42cb2b['body'][_0xdc2f('0xce')]}});}break;case _0xdc2f('0xd0'):if(_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0x86')]&&_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0xd1')]){_0x25b151=_0x42cb2b['body'][_0xdc2f('0xd1')];return db[_0xdc2f('0xa9')][_0xdc2f('0x61')]({'where':{'messageId':_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0x86')]}});}break;case'infobip':var _0x2f4d0a=_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0x8b')][0x0];if(_0x2f4d0a[_0xdc2f('0x85')]&&_0x2f4d0a[_0xdc2f('0x2d')][_0xdc2f('0xd2')]==='DELIVERED'){_0x25b151=_0x2f4d0a[_0xdc2f('0x2d')]['groupName'];return db[_0xdc2f('0xa9')][_0xdc2f('0x61')]({'where':{'messageId':_0x2f4d0a[_0xdc2f('0x85')]}});}break;case _0xdc2f('0x8f'):if(_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0x85')]&&_0x42cb2b['body']['status']){_0x25b151=_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0x2d')];return db[_0xdc2f('0xa9')][_0xdc2f('0x61')]({'where':{'messageId':_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0x85')]}});}break;case _0xdc2f('0x91'):if(_0x42cb2b[_0xdc2f('0x5a')][0x0][_0xdc2f('0x28')]['id']){_0x25b151=_0x42cb2b[_0xdc2f('0x5a')][0x0][_0xdc2f('0x7c')];return db[_0xdc2f('0xa9')][_0xdc2f('0x61')]({'where':{'messageId':_0x42cb2b[_0xdc2f('0x5a')][0x0][_0xdc2f('0x28')]['id']}});}break;case _0xdc2f('0xd3'):if(_0x42cb2b[_0xdc2f('0x5a')]['redif']&&_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0x2d')]){_0x25b151=_0x42cb2b['body'][_0xdc2f('0x2d')];return db[_0xdc2f('0xa9')][_0xdc2f('0x61')]({'where':{'messageId':_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0xd4')]}});}break;}}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x21f4b6,null))[_0xdc2f('0x1f')](function(_0x517501){if(_0x517501){_0x2d4007=_0x517501;switch(_0x5645e1[_0xdc2f('0x7c')]){case'skebby':if(_0x25b151===_0xdc2f('0xd5')){return _0x2d4007['update']({'read':!![]});}else{logger[_0xdc2f('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdc2f('0x2d'),_0xdc2f('0x80'),util[_0xdc2f('0xd6')](_0x42cb2b['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x25b151==='1'){return _0x2d4007[_0xdc2f('0x36')]({'read':!![]});}else{logger[_0xdc2f('0x26')](_0xdc2f('0x23'),_0xdc2f('0x2d'),_0xdc2f('0x80'),util[_0xdc2f('0xd6')](_0x42cb2b[_0xdc2f('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xdc2f('0xd0'):if(!_0x42cb2b[_0xdc2f('0x5a')][_0xdc2f('0xd7')]&&_0x25b151>=0xc8&&_0x25b151<=0xce){return _0x2d4007[_0xdc2f('0x36')]({'read':!![]});}else{logger[_0xdc2f('0x26')](_0xdc2f('0x23'),_0xdc2f('0x2d'),_0xdc2f('0xd0'),util[_0xdc2f('0xd6')](_0x42cb2b[_0xdc2f('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x278469=_0x42cb2b['body'][_0xdc2f('0x8b')][0x0];if(_0x278469[_0xdc2f('0x2d')][_0xdc2f('0xd2')]===_0xdc2f('0xd5')){return _0x2d4007[_0xdc2f('0x36')]({'read':!![]});}else{logger[_0xdc2f('0x26')](_0xdc2f('0x23'),_0xdc2f('0x2d'),_0xdc2f('0x8a'),util[_0xdc2f('0xd6')](_0x42cb2b[_0xdc2f('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xdc2f('0x8f'):if(_0x25b151==_0xdc2f('0xd8')||_0x25b151==_0xdc2f('0xd9')){return _0x2d4007['update']({'read':!![]});}else{logger['error'](_0xdc2f('0x23'),_0xdc2f('0x2d'),_0xdc2f('0x8f'),util[_0xdc2f('0xd6')](_0x42cb2b[_0xdc2f('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xdc2f('0x91'):if(_0x25b151=='message-delivered'){return _0x2d4007['update']({'read':!![]});}else{logger['error'](_0xdc2f('0x23'),_0xdc2f('0x2d'),_0xdc2f('0x91'),util['inspect'](_0x42cb2b[_0xdc2f('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xdc2f('0xd3'):if(_0x25b151===_0xdc2f('0xda')||_0x25b151===_0xdc2f('0xdb')){return _0x2d4007[_0xdc2f('0x36')]({'read':!![]});}else{logger['error'](_0xdc2f('0x23'),_0xdc2f('0x2d'),_0xdc2f('0xd3'),util[_0xdc2f('0xd6')](_0x42cb2b[_0xdc2f('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x2d4007;}})[_0xdc2f('0x1f')](respondWithResult(_0x21f4b6,null))[_0xdc2f('0x2a')](handleError(_0x21f4b6,null));};exports[_0xdc2f('0xdc')]=function(_0x59a2b6,_0x1b2145,_0x2cc6e9){var _0x4df5a0,_0x24f2a3,_0x3f66e5;return db[_0xdc2f('0x52')][_0xdc2f('0x61')]({'where':{'id':_0x59a2b6[_0xdc2f('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b2145,null))[_0xdc2f('0x1f')](function(_0x23f84a){if(_0x23f84a){_0x3f66e5=_0x23f84a;logger['debug'](_0xdc2f('0x23'),'status',_0xdc2f('0xdd'),_0x23f84a[_0xdc2f('0x7c')],util[_0xdc2f('0xd6')](_0x59a2b6[_0xdc2f('0x43')],{'showHidden':![],'depth':null}));switch(_0x23f84a[_0xdc2f('0x7c')]){case _0xdc2f('0x8c'):if(_0x59a2b6[_0xdc2f('0x43')][_0xdc2f('0xde')]&&_0x59a2b6['query']['state']){_0x24f2a3=_0x59a2b6[_0xdc2f('0x43')][_0xdc2f('0xdf')];return db[_0xdc2f('0xa9')][_0xdc2f('0x61')]({'where':{'messageId':_0x59a2b6[_0xdc2f('0x43')]['message-id']}});}break;}}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x1b2145,null))[_0xdc2f('0x1f')](function(_0xfc8a97){if(_0xfc8a97){_0x4df5a0=_0xfc8a97;switch(_0x3f66e5['type']){case _0xdc2f('0x8c'):if(_0x24f2a3==='2'||_0x24f2a3==='6'){return _0x4df5a0['update']({'read':!![]});}else{logger[_0xdc2f('0x26')](_0xdc2f('0x23'),_0xdc2f('0x2d'),'csc',util[_0xdc2f('0xd6')](_0x59a2b6[_0xdc2f('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x4df5a0;}})[_0xdc2f('0x1f')](respondWithResult(_0x1b2145,null))[_0xdc2f('0x2a')](handleError(_0x1b2145,null));};exports[_0xdc2f('0xe0')]=function(_0x57bc93,_0x2cf147,_0x4b69eb){return db['SmsAccount']['find']({'where':{'id':_0x57bc93[_0xdc2f('0x57')]['id']}})['then'](handleEntityNotFound(_0x2cf147,null))[_0xdc2f('0x1f')](function(_0x19966f){if(_0x19966f){return _0x19966f[_0xdc2f('0xe0')](_0x57bc93[_0xdc2f('0x5a')][_0xdc2f('0x69')],_['omit'](_0x57bc93[_0xdc2f('0x5a')],[_0xdc2f('0x69'),'id'])||{})[_0xdc2f('0xa1')](function(_0x1cdddd){for(var _0x5b048f=0x0;_0x5b048f<_0x57bc93['body'][_0xdc2f('0x69')]['length'];_0x5b048f+=0x1){socket[_0xdc2f('0xe1')](_0xdc2f('0xe2'),{'UserId':Number(_0x57bc93[_0xdc2f('0x5a')]['ids'][_0x5b048f]),'SmsAccountId':Number(_0x57bc93[_0xdc2f('0x57')]['id'])});}return _0x1cdddd;});}})[_0xdc2f('0x1f')](respondWithResult(_0x2cf147,null))[_0xdc2f('0x2a')](handleError(_0x2cf147,null));};exports['removeAgents']=function(_0x5eebd9,_0x4299a4,_0x2cc303){return db[_0xdc2f('0x52')]['find']({'where':{'id':_0x5eebd9[_0xdc2f('0x57')]['id']}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x4299a4,null))[_0xdc2f('0x1f')](function(_0x214cd3){if(_0x214cd3){return _0x214cd3[_0xdc2f('0xe3')](_0x5eebd9['query'][_0xdc2f('0x69')])[_0xdc2f('0x1f')](function(){if(_[_0xdc2f('0xe4')](_0x5eebd9[_0xdc2f('0x43')][_0xdc2f('0x69')])){for(var _0x5c9358=0x0;_0x5c9358<_0x5eebd9[_0xdc2f('0x43')][_0xdc2f('0x69')][_0xdc2f('0x49')];_0x5c9358+=0x1){socket[_0xdc2f('0xe1')](_0xdc2f('0xe5'),{'UserId':Number(_0x5eebd9[_0xdc2f('0x43')]['ids'][_0x5c9358]),'SmsAccountId':Number(_0x5eebd9[_0xdc2f('0x57')]['id'])});}}else{socket[_0xdc2f('0xe1')](_0xdc2f('0xe5'),{'UserId':Number(_0x5eebd9[_0xdc2f('0x43')]['ids']),'SmsAccountId':Number(_0x5eebd9['params']['id'])});}});}})[_0xdc2f('0x1f')](respondWithStatusCode(_0x4299a4,null))[_0xdc2f('0x2a')](handleError(_0x4299a4,null));};exports[_0xdc2f('0xe6')]=function(_0x1702f8,_0x375ed7,_0x4001b7){var _0x510923={};var _0x4a932c={};var _0x11881e;var _0x3cd843;return db[_0xdc2f('0x52')][_0xdc2f('0x66')]({'where':{'id':_0x1702f8['params']['id']}})[_0xdc2f('0x1f')](handleEntityNotFound(_0x375ed7,null))[_0xdc2f('0x1f')](function(_0x25e0f6){if(_0x25e0f6){_0x11881e=_0x25e0f6;_0x4a932c[_0xdc2f('0x47')]=_[_0xdc2f('0x58')](db['User']['rawAttributes']);_0x4a932c[_0xdc2f('0x43')]=_[_0xdc2f('0x58')](_0x1702f8['query']);_0x4a932c[_0xdc2f('0x44')]=_[_0xdc2f('0x46')](_0x4a932c[_0xdc2f('0x47')],_0x4a932c['query']);_0x510923[_0xdc2f('0x45')]=_[_0xdc2f('0x46')](_0x4a932c[_0xdc2f('0x47')],qs[_0xdc2f('0x48')](_0x1702f8[_0xdc2f('0x43')][_0xdc2f('0x48')]));_0x510923[_0xdc2f('0x45')]=_0x510923[_0xdc2f('0x45')][_0xdc2f('0x49')]?_0x510923['attributes']:_0x4a932c[_0xdc2f('0x47')];_0x510923[_0xdc2f('0x4b')]=qs[_0xdc2f('0x4c')](_0x1702f8[_0xdc2f('0x43')][_0xdc2f('0x4c')]);_0x510923[_0xdc2f('0x4d')]=qs[_0xdc2f('0x44')](_[_0xdc2f('0x4e')](_0x1702f8[_0xdc2f('0x43')],_0x4a932c[_0xdc2f('0x44')]));if(_0x1702f8['query']['filter']){_0x510923['where']=_[_0xdc2f('0x50')](_0x510923[_0xdc2f('0x4d')],{'$or':_['map'](_0x510923[_0xdc2f('0x45')],function(_0xb0b9f9){var _0x1b70f8={};_0x1b70f8[_0xb0b9f9]={'$like':'%'+_0x1702f8[_0xdc2f('0x43')]['filter']+'%'};return _0x1b70f8;})});}_0x510923=_['merge']({},_0x510923,_0x1702f8['options']);return _0x11881e[_0xdc2f('0xe6')](_0x510923);}})[_0xdc2f('0x1f')](function(_0x57fbee){if(_0x57fbee){_0x3cd843=_0x57fbee[_0xdc2f('0x49')];if(!_0x1702f8['query']['hasOwnProperty'](_0xdc2f('0x4a'))){_0x510923[_0xdc2f('0x32')]=qs['limit'](_0x1702f8['query'][_0xdc2f('0x32')]);_0x510923['offset']=qs['offset'](_0x1702f8['query'][_0xdc2f('0x30')]);}return _0x11881e[_0xdc2f('0xe6')](_0x510923);}})[_0xdc2f('0x1f')](function(_0x110596){if(_0x110596){return _0x110596?{'count':_0x3cd843,'rows':_0x110596}:null;}})[_0xdc2f('0x1f')](respondWithResult(_0x375ed7,null))['catch'](handleError(_0x375ed7,null));}; \ No newline at end of file +var _0x97f2=['groupName','DELIVERED','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','keys','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','body','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','order','ids','CannedAnswer','getAnswers','removeAnswers','notify','Applications','applications','priority','asc','account','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','text','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','DESC','list','omit','Contacts','SmsInteraction','interaction','created','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','SmsApplication','findAndCountAll','stack','finally','getApplications','Contact','Owner','fullname','internal','color','tag','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','status_code'];(function(_0x8afaa9,_0x4c3138){var _0x3c1ad0=function(_0x5d1817){while(--_0x5d1817){_0x8afaa9['push'](_0x8afaa9['shift']());}};_0x3c1ad0(++_0x4c3138);}(_0x97f2,0xf3));var _0x297f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x97f2[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x297f('0x0'));var zipdir=require(_0x297f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x297f('0x2'));var BPromise=require(_0x297f('0x3'));var Mustache=require(_0x297f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x297f('0x5'));var csv=require(_0x297f('0x6'));var ejs=require(_0x297f('0x7'));var fs=require('fs');var fs_extra=require(_0x297f('0x8'));var _=require(_0x297f('0x9'));var squel=require(_0x297f('0xa'));var crypto=require(_0x297f('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x297f('0x6'));var querystring=require('querystring');var Papa=require(_0x297f('0xc'));var Redis=require(_0x297f('0xd'));var authService=require(_0x297f('0xe'));var qs=require(_0x297f('0xf'));var as=require(_0x297f('0x10'));var hardwareService=require(_0x297f('0x11'));var logger=require(_0x297f('0x12'))(_0x297f('0x13'));var utils=require(_0x297f('0x14'));var config=require(_0x297f('0x15'));var licenseUtil=require(_0x297f('0x16'));var db=require(_0x297f('0x17'))['db'];config[_0x297f('0x18')]=_[_0x297f('0x19')](config[_0x297f('0x18')],{'host':_0x297f('0x1a'),'port':0x18eb});var socket=require(_0x297f('0x1b'))(new Redis(config[_0x297f('0x18')]));require(_0x297f('0x1c'))[_0x297f('0x1d')](socket);var jayson=require(_0x297f('0x1e'));var client=jayson['client'][_0x297f('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x343bf9,_0x3dcc2b,_0x3283c9,_0x68b465){return new BPromise(function(_0x5bcdcf,_0x49b3bd){var _0xc718b8=_0x68b465||client;return _0xc718b8['request'](_0x343bf9,_0x3283c9)[_0x297f('0x20')](function(_0x43aa89){logger[_0x297f('0x21')]('SmsAccount,\x20%s,\x20%s',_0x3dcc2b,'request\x20sent');logger[_0x297f('0x22')](_0x297f('0x23'),_0x3dcc2b,_0x297f('0x24'),JSON['stringify'](_0x43aa89));if(_0x43aa89[_0x297f('0x25')]){if(_0x43aa89[_0x297f('0x25')][_0x297f('0x26')]===0x1f4){logger[_0x297f('0x25')](_0x297f('0x27'),_0x3dcc2b,_0x43aa89['error'][_0x297f('0x28')]);return _0x49b3bd(_0x43aa89[_0x297f('0x25')][_0x297f('0x28')]);}logger['error'](_0x297f('0x27'),_0x3dcc2b,_0x43aa89['error'][_0x297f('0x28')]);return _0x5bcdcf(_0x43aa89['error'][_0x297f('0x28')]);}else{logger['info'](_0x297f('0x27'),_0x3dcc2b,'request\x20sent');_0x5bcdcf(_0x43aa89[_0x297f('0x29')][_0x297f('0x28')]);}})[_0x297f('0x2a')](function(_0x1f95fe){logger['error'](_0x297f('0x27'),_0x3dcc2b,_0x1f95fe);_0x49b3bd(_0x1f95fe);});});}function respondWithStatusCode(_0x1922e1,_0x54c1c4){_0x54c1c4=_0x54c1c4||0xcc;return function(_0x1aeea6){if(_0x1aeea6){return _0x1922e1[_0x297f('0x2b')](_0x54c1c4);}return _0x1922e1[_0x297f('0x2c')](_0x54c1c4)[_0x297f('0x2d')]();};}function respondWithResult(_0x3c8026,_0x3f0326){_0x3f0326=_0x3f0326||0xc8;return function(_0x263c83){if(_0x263c83){return _0x3c8026[_0x297f('0x2c')](_0x3f0326)[_0x297f('0x2e')](_0x263c83);}};}function respondWithFilteredResult(_0x36e05e,_0x3ba925){return function(_0x40a59b){if(_0x40a59b){var _0x48a7e8=typeof _0x3ba925[_0x297f('0x2f')]===_0x297f('0x30')&&typeof _0x3ba925['limit']===_0x297f('0x30');var _0x31ffb1=_0x40a59b[_0x297f('0x31')];var _0xc2607b=_0x48a7e8?0x0:_0x3ba925[_0x297f('0x2f')];var _0x1d07c9=_0x48a7e8?_0x40a59b[_0x297f('0x31')]:_0x3ba925[_0x297f('0x2f')]+_0x3ba925[_0x297f('0x32')];var _0x471b21;if(_0x1d07c9>=_0x31ffb1){_0x1d07c9=_0x31ffb1;_0x471b21=0xc8;}else{_0x471b21=0xce;}_0x36e05e[_0x297f('0x2c')](_0x471b21);return _0x36e05e['set']('Content-Range',_0xc2607b+'-'+_0x1d07c9+'/'+_0x31ffb1)[_0x297f('0x2e')](_0x40a59b);}return null;};}function patchUpdates(_0xcc9826){return function(_0x3dd142){try{jsonpatch[_0x297f('0x33')](_0x3dd142,_0xcc9826,!![]);}catch(_0xd00dc6){return BPromise[_0x297f('0x34')](_0xd00dc6);}return _0x3dd142[_0x297f('0x35')]();};}function saveUpdates(_0x10ff17,_0x27154f){return function(_0x235777){if(_0x235777){return _0x235777[_0x297f('0x36')](_0x10ff17)['then'](function(_0x4ba0e2){return _0x4ba0e2;});}return null;};}function removeEntity(_0x386e86,_0x4adae3){return function(_0x451100){if(_0x451100){return _0x451100['destroy']()[_0x297f('0x20')](function(){var _0x3c385b=_0x451100[_0x297f('0x37')]({'plain':!![]});var _0x4219e1=_0x297f('0x38');return db[_0x297f('0x39')][_0x297f('0x3a')]({'where':{'type':_0x4219e1,'resourceId':_0x3c385b['id']}})[_0x297f('0x20')](function(){return _0x451100;});})[_0x297f('0x20')](function(){_0x386e86[_0x297f('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf37724,_0x3a3575){return function(_0x30a0fa){if(!_0x30a0fa){_0xf37724[_0x297f('0x2b')](0x194);}return _0x30a0fa;};}function handleError(_0x12486e,_0x13cb07){_0x13cb07=_0x13cb07||0x1f4;return function(_0x39298d){logger['error'](_0x39298d['stack']);if(_0x39298d[_0x297f('0x3b')]){delete _0x39298d[_0x297f('0x3b')];}_0x12486e[_0x297f('0x2c')](_0x13cb07)[_0x297f('0x3c')](_0x39298d);};}exports[_0x297f('0x3d')]=function(_0x3cf7f0,_0x5d1343){var _0x40601c={'include':[{'model':db['Pause'],'as':_0x297f('0x3e')}]},_0x12b128={},_0x4455be={'count':0x0,'rows':[]};var _0x37340c=_[_0x297f('0x3f')](db[_0x297f('0x40')][_0x297f('0x41')],function(_0x4d636e){return{'name':_0x4d636e['fieldName'],'type':_0x4d636e[_0x297f('0x42')][_0x297f('0x43')]};});_0x12b128[_0x297f('0x44')]=_[_0x297f('0x3f')](_0x37340c,_0x297f('0x3b'));_0x12b128[_0x297f('0x45')]=_['keys'](_0x3cf7f0[_0x297f('0x45')]);_0x12b128[_0x297f('0x46')]=_['intersection'](_0x12b128[_0x297f('0x44')],_0x12b128['query']);_0x40601c[_0x297f('0x47')]=_[_0x297f('0x48')](_0x12b128[_0x297f('0x44')],qs[_0x297f('0x49')](_0x3cf7f0[_0x297f('0x45')][_0x297f('0x49')]));_0x40601c[_0x297f('0x47')]=_0x40601c[_0x297f('0x47')][_0x297f('0x4a')]?_0x40601c[_0x297f('0x47')]:_0x12b128[_0x297f('0x44')];if(!_0x3cf7f0[_0x297f('0x45')][_0x297f('0x4b')](_0x297f('0x4c'))){_0x40601c[_0x297f('0x32')]=qs[_0x297f('0x32')](_0x3cf7f0['query'][_0x297f('0x32')]);_0x40601c['offset']=qs[_0x297f('0x2f')](_0x3cf7f0['query'][_0x297f('0x2f')]);}_0x40601c['order']=qs[_0x297f('0x4d')](_0x3cf7f0['query'][_0x297f('0x4d')]);_0x40601c[_0x297f('0x4e')]=qs[_0x297f('0x46')](_[_0x297f('0x4f')](_0x3cf7f0[_0x297f('0x45')],_0x12b128[_0x297f('0x46')]),_0x37340c);if(_0x3cf7f0[_0x297f('0x45')][_0x297f('0x50')]){_0x40601c[_0x297f('0x4e')]=_[_0x297f('0x51')](_0x40601c[_0x297f('0x4e')],{'$or':_['map'](_0x37340c,function(_0x1b3193){if(_0x1b3193[_0x297f('0x42')]!==_0x297f('0x52')){var _0x3b65ad={};_0x3b65ad[_0x1b3193[_0x297f('0x3b')]]={'$like':'%'+_0x3cf7f0[_0x297f('0x45')]['filter']+'%'};return _0x3b65ad;}})});}_0x40601c=_['merge']({},_0x40601c,_0x3cf7f0[_0x297f('0x53')]);var _0x394b82={'where':_0x40601c[_0x297f('0x4e')]};return db[_0x297f('0x40')][_0x297f('0x31')](_0x394b82)[_0x297f('0x20')](function(_0x2b91cc){_0x4455be[_0x297f('0x31')]=_0x2b91cc;if(_0x3cf7f0[_0x297f('0x45')][_0x297f('0x54')]){_0x40601c[_0x297f('0x55')]=[{'all':!![]}];}return db[_0x297f('0x40')][_0x297f('0x56')](_0x40601c);})['then'](function(_0xf07ba7){_0x4455be[_0x297f('0x57')]=_0xf07ba7;return _0x4455be;})[_0x297f('0x20')](respondWithFilteredResult(_0x5d1343,_0x40601c))[_0x297f('0x2a')](handleError(_0x5d1343,null));};exports[_0x297f('0x58')]=function(_0x568086,_0x3214cd){var _0x5aafab={'raw':![],'where':{'id':_0x568086[_0x297f('0x59')]['id']},'include':[{'model':db[_0x297f('0x5a')],'as':_0x297f('0x3e')}]},_0x8ce9f7={};_0x8ce9f7[_0x297f('0x44')]=_[_0x297f('0x5b')](db[_0x297f('0x40')]['rawAttributes']);_0x8ce9f7[_0x297f('0x45')]=_[_0x297f('0x5b')](_0x568086[_0x297f('0x45')]);_0x8ce9f7[_0x297f('0x46')]=_[_0x297f('0x48')](_0x8ce9f7[_0x297f('0x44')],_0x8ce9f7[_0x297f('0x45')]);_0x5aafab[_0x297f('0x47')]=_['intersection'](_0x8ce9f7[_0x297f('0x44')],qs[_0x297f('0x49')](_0x568086[_0x297f('0x45')]['fields']));_0x5aafab['attributes']=_0x5aafab['attributes'][_0x297f('0x4a')]?_0x5aafab[_0x297f('0x47')]:_0x8ce9f7[_0x297f('0x44')];if(_0x568086['query']['includeAll']){_0x5aafab['include']=[{'all':!![]}];}_0x5aafab=_[_0x297f('0x51')]({},_0x5aafab,_0x568086['options']);return db['SmsAccount']['find'](_0x5aafab)[_0x297f('0x20')](handleEntityNotFound(_0x3214cd,null))['then'](respondWithResult(_0x3214cd,null))[_0x297f('0x2a')](handleError(_0x3214cd,null));};exports['create']=function(_0x5e0ba8,_0x78004f){return db[_0x297f('0x40')][_0x297f('0x5c')](_0x5e0ba8['body'],{})['then'](function(_0x1ce6e0){var _0x363d15=_0x5e0ba8[_0x297f('0x5d')][_0x297f('0x37')]({'plain':!![]});if(!_0x363d15)throw new Error(_0x297f('0x5e'));if(_0x363d15['role']===_0x297f('0x5d')){var _0x2e245=_0x1ce6e0['get']({'plain':!![]});var _0x52a61a=_0x297f('0x38');return db[_0x297f('0x5f')][_0x297f('0x60')]({'where':{'name':_0x52a61a,'userProfileId':_0x363d15[_0x297f('0x61')]},'raw':!![]})[_0x297f('0x20')](function(_0x1e3d19){if(_0x1e3d19&&_0x1e3d19[_0x297f('0x62')]===0x0){return db[_0x297f('0x39')]['create']({'name':_0x2e245[_0x297f('0x3b')],'resourceId':_0x2e245['id'],'type':_0x1e3d19[_0x297f('0x3b')],'sectionId':_0x1e3d19['id']},{})[_0x297f('0x20')](function(){return _0x1ce6e0;});}else{return _0x1ce6e0;}})['catch'](function(_0x532cb9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x532cb9);throw _0x532cb9;});}return _0x1ce6e0;})[_0x297f('0x20')](respondWithResult(_0x78004f,0xc9))[_0x297f('0x2a')](handleError(_0x78004f,null));};exports[_0x297f('0x36')]=function(_0x230c5a,_0x155765){if(_0x230c5a['body']['id']){delete _0x230c5a['body']['id'];}return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x230c5a[_0x297f('0x59')]['id']},'include':[{'model':db[_0x297f('0x5a')],'as':_0x297f('0x3e')}]})[_0x297f('0x20')](handleEntityNotFound(_0x155765,null))[_0x297f('0x20')](saveUpdates(_0x230c5a[_0x297f('0x63')],null))[_0x297f('0x20')](respondWithResult(_0x155765,null))[_0x297f('0x2a')](handleError(_0x155765,null));};exports[_0x297f('0x3a')]=function(_0xe7a31a,_0x3803b3){return db[_0x297f('0x40')]['find']({'where':{'id':_0xe7a31a[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x3803b3,null))[_0x297f('0x20')](removeEntity(_0x3803b3,null))['catch'](handleError(_0x3803b3,null));};exports[_0x297f('0x64')]=function(_0x4033d7,_0xbb9686){return db[_0x297f('0x40')][_0x297f('0x64')]()['then'](respondWithResult(_0xbb9686,null))[_0x297f('0x2a')](handleError(_0xbb9686,null));};exports[_0x297f('0x65')]=function(_0x417777,_0x4d55f9,_0x1183f0){if(_0x417777[_0x297f('0x63')]['id']){delete _0x417777[_0x297f('0x63')]['id'];}return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x417777['params']['id']}})['then'](handleEntityNotFound(_0x4d55f9,null))[_0x297f('0x20')](function(_0x30cb47){if(_0x30cb47){_0x417777[_0x297f('0x63')][_0x297f('0x66')]=_0x30cb47['id'];return db['Disposition'][_0x297f('0x5c')](_0x417777[_0x297f('0x63')]);}})['then'](respondWithResult(_0x4d55f9,null))[_0x297f('0x2a')](handleError(_0x4d55f9,null));};exports[_0x297f('0x67')]=function(_0x758711,_0x1b64f0,_0x242c7c){var _0x36d22c={'raw':![],'where':{}};var _0x56b571={};var _0x1bae83={'count':0x0,'rows':[]};return db[_0x297f('0x40')][_0x297f('0x68')]({'where':{'id':_0x758711['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x1b64f0,null))[_0x297f('0x20')](function(_0x12edd4){if(_0x12edd4){_0x56b571[_0x297f('0x44')]=_[_0x297f('0x5b')](db[_0x297f('0x69')][_0x297f('0x41')]);_0x56b571['query']=_['keys'](_0x758711['query']);_0x56b571[_0x297f('0x46')]=_['intersection'](_0x56b571[_0x297f('0x44')],_0x56b571['query']);_0x36d22c[_0x297f('0x47')]=_['intersection'](_0x56b571['model'],qs['fields'](_0x758711['query']['fields']));_0x36d22c['attributes']=_0x36d22c[_0x297f('0x47')][_0x297f('0x4a')]?_0x36d22c[_0x297f('0x47')]:_0x56b571[_0x297f('0x44')];if(!_0x758711[_0x297f('0x45')][_0x297f('0x4b')](_0x297f('0x4c'))){_0x36d22c[_0x297f('0x32')]=qs[_0x297f('0x32')](_0x758711[_0x297f('0x45')][_0x297f('0x32')]);_0x36d22c[_0x297f('0x2f')]=qs[_0x297f('0x2f')](_0x758711[_0x297f('0x45')][_0x297f('0x2f')]);}_0x36d22c[_0x297f('0x6a')]=qs[_0x297f('0x4d')](_0x758711['query'][_0x297f('0x4d')]);_0x36d22c[_0x297f('0x4e')]=qs[_0x297f('0x46')](_[_0x297f('0x4f')](_0x758711['query'],_0x56b571[_0x297f('0x46')]));_0x36d22c[_0x297f('0x4e')]['SmsAccountId']=_0x12edd4['id'];if(_0x758711['query'][_0x297f('0x50')]){_0x36d22c[_0x297f('0x4e')]=_[_0x297f('0x51')](_0x36d22c[_0x297f('0x4e')],{'$or':_[_0x297f('0x3f')](_0x36d22c[_0x297f('0x47')],function(_0x46c4df){var _0x42349f={};_0x42349f[_0x46c4df]={'$like':'%'+_0x758711[_0x297f('0x45')][_0x297f('0x50')]+'%'};return _0x42349f;})});}_0x36d22c=_['merge']({},_0x36d22c,_0x758711[_0x297f('0x53')]);return db[_0x297f('0x69')][_0x297f('0x31')]({'where':_0x36d22c[_0x297f('0x4e')]})[_0x297f('0x20')](function(_0x1445d0){_0x1bae83[_0x297f('0x31')]=_0x1445d0;if(_0x758711[_0x297f('0x45')][_0x297f('0x54')]){_0x36d22c[_0x297f('0x55')]=[{'all':!![]}];}return db[_0x297f('0x69')][_0x297f('0x56')](_0x36d22c);})[_0x297f('0x20')](function(_0x307984){_0x1bae83[_0x297f('0x57')]=_0x307984;return _0x1bae83;});}})[_0x297f('0x20')](respondWithFilteredResult(_0x1b64f0,_0x36d22c))[_0x297f('0x2a')](handleError(_0x1b64f0,null));};exports['removeDispositions']=function(_0x2d99a7,_0x2c5d05,_0x298b76){return db['SmsAccount'][_0x297f('0x60')]({'where':{'id':_0x2d99a7[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x2c5d05,null))[_0x297f('0x20')](function(_0x9af0c9){if(_0x9af0c9){return _0x9af0c9['removeDispositions'](_0x2d99a7[_0x297f('0x45')][_0x297f('0x6b')]);}})[_0x297f('0x20')](respondWithStatusCode(_0x2c5d05,null))[_0x297f('0x2a')](handleError(_0x2c5d05,null));};exports['addAnswer']=function(_0x56adae,_0x14b7d1,_0x49f90c){if(_0x56adae[_0x297f('0x63')]['id']){delete _0x56adae['body']['id'];}return db[_0x297f('0x40')]['find']({'where':{'id':_0x56adae[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x14b7d1,null))[_0x297f('0x20')](function(_0x6b5431){if(_0x6b5431){_0x56adae[_0x297f('0x63')]['SmsAccountId']=_0x6b5431['id'];return db[_0x297f('0x6c')][_0x297f('0x5c')](_0x56adae[_0x297f('0x63')]);}})[_0x297f('0x20')](respondWithResult(_0x14b7d1,null))[_0x297f('0x2a')](handleError(_0x14b7d1,null));};exports[_0x297f('0x6d')]=function(_0x562423,_0x287c88,_0x24a81e){var _0x183426={'raw':![],'where':{}};var _0x8328e6={};var _0x214140={'count':0x0,'rows':[]};return db['SmsAccount'][_0x297f('0x68')]({'where':{'id':_0x562423['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x287c88,null))[_0x297f('0x20')](function(_0x26b471){if(_0x26b471){_0x8328e6['model']=_[_0x297f('0x5b')](db[_0x297f('0x6c')][_0x297f('0x41')]);_0x8328e6['query']=_['keys'](_0x562423[_0x297f('0x45')]);_0x8328e6[_0x297f('0x46')]=_[_0x297f('0x48')](_0x8328e6[_0x297f('0x44')],_0x8328e6[_0x297f('0x45')]);_0x183426['attributes']=_['intersection'](_0x8328e6['model'],qs['fields'](_0x562423['query'][_0x297f('0x49')]));_0x183426[_0x297f('0x47')]=_0x183426[_0x297f('0x47')]['length']?_0x183426[_0x297f('0x47')]:_0x8328e6[_0x297f('0x44')];if(!_0x562423['query'][_0x297f('0x4b')]('nolimit')){_0x183426[_0x297f('0x32')]=qs[_0x297f('0x32')](_0x562423[_0x297f('0x45')][_0x297f('0x32')]);_0x183426['offset']=qs[_0x297f('0x2f')](_0x562423[_0x297f('0x45')][_0x297f('0x2f')]);}_0x183426[_0x297f('0x6a')]=qs['sort'](_0x562423['query'][_0x297f('0x4d')]);_0x183426[_0x297f('0x4e')]=qs[_0x297f('0x46')](_['pick'](_0x562423[_0x297f('0x45')],_0x8328e6[_0x297f('0x46')]));_0x183426['where']['SmsAccountId']=_0x26b471['id'];if(_0x562423['query'][_0x297f('0x50')]){_0x183426[_0x297f('0x4e')]=_[_0x297f('0x51')](_0x183426[_0x297f('0x4e')],{'$or':_['map'](_0x183426[_0x297f('0x47')],function(_0x2c890a){var _0x2238f8={};_0x2238f8[_0x2c890a]={'$like':'%'+_0x562423[_0x297f('0x45')][_0x297f('0x50')]+'%'};return _0x2238f8;})});}_0x183426=_['merge']({},_0x183426,_0x562423['options']);return db[_0x297f('0x6c')][_0x297f('0x31')]({'where':_0x183426[_0x297f('0x4e')]})[_0x297f('0x20')](function(_0x4e35e7){_0x214140[_0x297f('0x31')]=_0x4e35e7;if(_0x562423[_0x297f('0x45')][_0x297f('0x54')]){_0x183426[_0x297f('0x55')]=[{'all':!![]}];}return db[_0x297f('0x6c')][_0x297f('0x56')](_0x183426);})[_0x297f('0x20')](function(_0x2bfc87){_0x214140[_0x297f('0x57')]=_0x2bfc87;return _0x214140;});}})[_0x297f('0x20')](respondWithFilteredResult(_0x287c88,_0x183426))['catch'](handleError(_0x287c88,null));};exports['removeAnswers']=function(_0x555dcb,_0x765b06,_0x446656){return db['SmsAccount'][_0x297f('0x60')]({'where':{'id':_0x555dcb[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x765b06,null))[_0x297f('0x20')](function(_0x5ba40a){if(_0x5ba40a){return _0x5ba40a[_0x297f('0x6e')](_0x555dcb[_0x297f('0x45')][_0x297f('0x6b')]);}})['then'](respondWithStatusCode(_0x765b06,null))[_0x297f('0x2a')](handleError(_0x765b06,null));};exports[_0x297f('0x6f')]=function(_0x4c5087,_0x448e01,_0x5291e6){var _0x3dca90={'channel':'sms'};var _0x455c57=[];var _0x249921=[];var _0x183d56={};return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x4c5087[_0x297f('0x59')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x297f('0x70')}]})[_0x297f('0x20')](handleEntityNotFound(_0x448e01,null))['then'](function(_0x743d2a){_0x3dca90['account']=_0x743d2a;_0x3dca90[_0x297f('0x71')]=_['orderBy'](_0x743d2a[_0x297f('0x70')],[_0x297f('0x72')],[_0x297f('0x73')]);if(_0x3dca90[_0x297f('0x74')][_0x297f('0x70')]){delete _0x3dca90[_0x297f('0x74')]['Applications'];}return db[_0x297f('0x75')][_0x297f('0x64')]();})[_0x297f('0x20')](function(_0x4fbd06){if(!_0x4fbd06){throw new db[(_0x297f('0x76'))][(_0x297f('0x77'))]('no\x20available\x20attributes');}_0x455c57=_[_0x297f('0x78')](_[_0x297f('0x5b')](_0x4fbd06),['createdAt',_0x297f('0x79')]);_0x249921=_['difference'](_[_0x297f('0x5b')](_0x4fbd06),[_0x297f('0x7a'),_0x297f('0x79'),_0x297f('0x7b'),'ListId']);_0x3dca90[_0x297f('0x63')]={'mapKey':_0x297f('0x7c')};if(_0x3dca90[_0x297f('0x74')]['type']){switch(_0x3dca90[_0x297f('0x74')][_0x297f('0x42')]){case _0x297f('0x7d'):_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x7f')];_0x3dca90[_0x297f('0x63')][_0x297f('0x63')]=_0x4c5087['body'][_0x297f('0x80')];_0x3dca90[_0x297f('0x63')][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x82')];break;case _0x297f('0x83'):_0x3dca90[_0x297f('0x63')]['from']='+'+_0x4c5087[_0x297f('0x63')][_0x297f('0x84')];_0x3dca90['body']['body']=_0x4c5087[_0x297f('0x63')]['text'];break;case _0x297f('0x85'):_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087['body'][_0x297f('0x7e')];_0x3dca90[_0x297f('0x63')]['body']=_0x4c5087[_0x297f('0x63')][_0x297f('0x28')];break;case _0x297f('0x86'):_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087['body'][_0x297f('0x7e')];_0x3dca90[_0x297f('0x63')][_0x297f('0x63')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x63')];_0x3dca90[_0x297f('0x63')][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x87')];break;case'plivo':_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x7f')];_0x3dca90[_0x297f('0x63')][_0x297f('0x63')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x88')];_0x3dca90[_0x297f('0x63')][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x89')];break;case _0x297f('0x8a'):_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]='+'+_0x4c5087[_0x297f('0x63')][_0x297f('0x8b')][0x0][_0x297f('0x7e')];_0x3dca90[_0x297f('0x63')][_0x297f('0x63')]=_0x4c5087['body']['results'][0x0][_0x297f('0x8c')];_0x3dca90['body']['messageId']=_0x4c5087[_0x297f('0x63')][_0x297f('0x8b')][0x0][_0x297f('0x81')];break;case _0x297f('0x8d'):_0x3dca90['body'][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')]['originatingAddress'];_0x3dca90['body'][_0x297f('0x63')]=_0x4c5087['body'][_0x297f('0x8e')][_0x297f('0x28')];break;case _0x297f('0x8f'):_0x3dca90['body'][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x90')];_0x3dca90['body']['body']=_0x4c5087[_0x297f('0x63')][_0x297f('0x8c')];_0x3dca90['body'][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x91')];break;case _0x297f('0x92'):_0x3dca90[_0x297f('0x63')][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][0x0]['message']['id'];_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')][0x0][_0x297f('0x28')][_0x297f('0x7e')];_0x3dca90['body'][_0x297f('0x63')]=_0x4c5087[_0x297f('0x63')][0x0][_0x297f('0x28')][_0x297f('0x8c')];break;case'intelepeer':_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x7e')];_0x3dca90[_0x297f('0x63')][_0x297f('0x63')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x28')];_0x3dca90[_0x297f('0x63')][_0x297f('0x81')]=_0x4c5087[_0x297f('0x63')][_0x297f('0x93')];break;}}if(_0x3dca90[_0x297f('0x63')]['id']){delete _0x3dca90[_0x297f('0x63')]['id'];}if(_['isNil'](_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')])){throw new db[(_0x297f('0x76'))][(_0x297f('0x77'))](_0x297f('0x94'));}if(_[_0x297f('0x95')](_0x3dca90[_0x297f('0x63')][_0x297f('0x63')])||_0x3dca90['body'][_0x297f('0x63')]===''){throw new db[(_0x297f('0x76'))]['ValidationError'](_0x297f('0x96'));}if(_[_0x297f('0x95')](_0x3dca90[_0x297f('0x63')]['mapKey'])){throw new db['Sequelize'][(_0x297f('0x77'))](_0x297f('0x97')+_0x249921);}if(!_['includes'](_0x249921,_0x3dca90[_0x297f('0x63')][_0x297f('0x98')])){throw new db['Sequelize'][(_0x297f('0x77'))](_0x297f('0x99')+_0x249921);}_0x183d56[_0x3dca90['body'][_0x297f('0x98')]]=_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')];return db['CmList'][_0x297f('0x60')]({'where':{'id':_0x3dca90[_0x297f('0x74')][_0x297f('0x9a')]},'include':[{'model':db[_0x297f('0x75')],'as':'Contacts','where':_0x183d56,'limit':0x1,'order':[[_0x297f('0x79'),_0x297f('0x9b')]]}]});})[_0x297f('0x20')](handleEntityNotFound(_0x448e01,null))[_0x297f('0x20')](function(_0x37f48f){if(_0x37f48f){_0x3dca90[_0x297f('0x9c')]=_[_0x297f('0x9d')](_0x37f48f,['Contacts']);if(_0x37f48f[_0x297f('0x9e')][_0x297f('0x4a')]){return _0x37f48f[_0x297f('0x9e')][0x0];}var _0x36005a=_['defaults'](_0x3dca90[_0x297f('0x63')],{'firstName':_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')],'ListId':_0x37f48f['id']});_0x36005a[_0x3dca90[_0x297f('0x63')][_0x297f('0x98')]]=_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')];return db[_0x297f('0x75')][_0x297f('0x5c')](_0x36005a,{'fields':_0x455c57,'raw':!![]});}})[_0x297f('0x20')](handleEntityNotFound(_0x448e01,null))['then'](function(_0x50936b){if(_0x50936b){_0x3dca90['contact']=_0x50936b;var _0x2993a8={'ContactId':_0x50936b['id'],'phone':_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')],'SmsAccountId':_0x4c5087[_0x297f('0x59')]['id']};var _0xedb2e9={'ContactId':_0x50936b['id'],'SmsAccountId':_0x4c5087[_0x297f('0x59')]['id'],'closed':![]};return db[_0x297f('0x9f')][_0x297f('0x60')]({'where':_0xedb2e9})[_0x297f('0x20')](function(_0x5295e8){if(_0x5295e8){return[_0x5295e8,![]];}return db[_0x297f('0x9f')]['create'](_0x2993a8)[_0x297f('0x20')](function(_0x33f842){return[_0x33f842,!![]];});});}})['spread'](function(_0xc2f8d6,_0x47ac3d){_0x3dca90[_0x297f('0xa0')]=_0xc2f8d6[_0x297f('0x37')]({'plain':!![]});_0x3dca90[_0x297f('0xa0')][_0x297f('0xa1')]=![];if(_0x47ac3d){if(_0x3dca90[_0x297f('0x74')]['autoclose']){_0x3dca90[_0x297f('0x71')][_0x297f('0xa2')]({'id':0x0,'priority':_0x3dca90['applications'][_0x297f('0x4a')]+0x1,'app':_0x297f('0xa3'),'appdata':_0x297f('0xa4'),'interval':'*,*,*,*'});}_0x3dca90[_0x297f('0xa0')]['created']=!![];}return db[_0x297f('0xa5')]['create']({'phone':_0x3dca90[_0x297f('0x63')][_0x297f('0x7e')],'messageId':_0x3dca90[_0x297f('0x63')][_0x297f('0x81')],'body':_0x3dca90[_0x297f('0x63')]['body'],'SmsAccountId':_0x4c5087[_0x297f('0x59')]['id'],'SmsInteractionId':_0xc2f8d6['id'],'direction':'in','ContactId':_0xc2f8d6[_0x297f('0xa6')],'AttachmentId':_0x3dca90[_0x297f('0x63')][_0x297f('0xa7')]});})[_0x297f('0x20')](function(_0x1b679e){_0x3dca90[_0x297f('0x28')]=_0x1b679e;if(_0x3dca90['interaction'][_0x297f('0xa8')]){return db[_0x297f('0xa9')][_0x297f('0x60')]({'attributes':['id','name'],'where':{'id':_0x3dca90['interaction'][_0x297f('0xa8')]}})[_0x297f('0x20')](function(_0x2ace5f){if(_0x2ace5f){_0x3dca90[_0x297f('0x71')][_0x297f('0xaa')]({'id':0x0,'priority':0x0,'app':_0x297f('0xab'),'appdata':_0x2ace5f[_0x297f('0x3b')]+','+(_0x3dca90[_0x297f('0x74')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x297f('0xac'),_0x297f('0xad'),_0x3dca90);});}return respondWithRpcPromise(_0x297f('0xac'),'startRouting',_0x3dca90);})['then'](function(_0xe62b73){if(_0xe62b73){var _0x598b84=0xc8;var _0x5a366b=_0x297f('0xae');logger[_0x297f('0x21')](_0x297f('0x23'),_0x5a366b,_0x598b84,_0x297f('0xaf'));logger[_0x297f('0x22')](_0x297f('0xb0'),_0x5a366b,_0x598b84,'entity\x20found',JSON[_0x297f('0xb1')](_0xe62b73));if(_0x3dca90[_0x297f('0x74')][_0x297f('0x42')]===_0x297f('0x7d')){return _0x448e01[_0x297f('0x2c')](_0x598b84)[_0x297f('0xb2')](_0x297f('0xb3'),_0x297f('0xb4'))[_0x297f('0x3c')](_0x297f('0xb5'));}else{return _0x448e01[_0x297f('0x2c')](_0x598b84)[_0x297f('0x2e')](_0xe62b73);}}})[_0x297f('0x2a')](handleError(_0x448e01,null));};exports[_0x297f('0xb6')]=function(_0x2c4d94,_0x5084a1){var _0x193394=_0x2c4d94['params']['id'];var _0x250a14=_0x2c4d94[_0x297f('0x63')];var _0x47cfee=0xc8;var _0x2f6a7c=null;return db[_0x297f('0xb7')][_0x297f('0xb8')]({'isolationLevel':db[_0x297f('0xb7')][_0x297f('0xb9')][_0x297f('0xba')]['READ_COMMITTED']},function(_0x47c43a){return db['SmsAccount'][_0x297f('0x68')]({'where':{'id':_0x193394},'transaction':_0x47c43a})['then'](function(_0x3d1d21){if(_0x3d1d21){return db[_0x297f('0xbb')][_0x297f('0x3a')]({'where':{'SmsAccountId':_0x193394},'transaction':_0x47c43a})['then'](function(){var _0x38a326=_[_0x297f('0x3f')](_0x250a14,function(_0x3b5fc6){_0x3b5fc6[_0x297f('0x66')]=_0x193394;return _0x3b5fc6;});return db[_0x297f('0xbb')]['bulkCreate'](_0x38a326,{'transaction':_0x47c43a});});}else{_0x47cfee=0x194;_0x2f6a7c=[];}});})['then'](function(){if(_0x47cfee!==0x194){return db[_0x297f('0xbb')][_0x297f('0xbc')]({'where':{'SmsAccountId':_0x193394},'order':_0x297f('0x72')})[_0x297f('0x20')](function(_0x1ec314){_0x2f6a7c=_0x1ec314;});}})[_0x297f('0x2a')](function(_0x1a35ba){_0x47cfee=0x1f4;logger[_0x297f('0x25')](_0x1a35ba[_0x297f('0xbd')]);if(_0x1a35ba[_0x297f('0x3b')]){delete _0x1a35ba[_0x297f('0x3b')];}_0x2f6a7c=_0x1a35ba;})[_0x297f('0xbe')](function(){if(_0x2f6a7c===null){_0x5084a1['sendStatus'](_0x47cfee);}else{if(_0x47cfee===0x1f4){_0x5084a1[_0x297f('0x2c')](_0x47cfee)['send'](_0x2f6a7c);}else{_0x5084a1[_0x297f('0x2c')](_0x47cfee)['json'](_0x2f6a7c);}}});};exports[_0x297f('0xbf')]=function(_0x226092,_0x3b4d7d,_0xa71389){var _0x4057cb={};var _0x2158af={};var _0x166e20;var _0x238100;return db[_0x297f('0x40')][_0x297f('0x68')]({'where':{'id':_0x226092['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x3b4d7d,null))[_0x297f('0x20')](function(_0x2789ae){if(_0x2789ae){_0x166e20=_0x2789ae;_0x2158af[_0x297f('0x44')]=_[_0x297f('0x5b')](db['SmsApplication'][_0x297f('0x41')]);_0x2158af[_0x297f('0x45')]=_[_0x297f('0x5b')](_0x226092['query']);_0x2158af[_0x297f('0x46')]=_[_0x297f('0x48')](_0x2158af[_0x297f('0x44')],_0x2158af[_0x297f('0x45')]);_0x4057cb[_0x297f('0x47')]=_[_0x297f('0x48')](_0x2158af[_0x297f('0x44')],qs[_0x297f('0x49')](_0x226092[_0x297f('0x45')][_0x297f('0x49')]));_0x4057cb[_0x297f('0x47')]=_0x4057cb['attributes'][_0x297f('0x4a')]?_0x4057cb[_0x297f('0x47')]:_0x2158af[_0x297f('0x44')];_0x4057cb[_0x297f('0x6a')]=qs[_0x297f('0x4d')](_0x226092['query'][_0x297f('0x4d')]);_0x4057cb[_0x297f('0x4e')]=qs[_0x297f('0x46')](_[_0x297f('0x4f')](_0x226092[_0x297f('0x45')],_0x2158af[_0x297f('0x46')]));if(_0x226092[_0x297f('0x45')][_0x297f('0x50')]){_0x4057cb[_0x297f('0x4e')]=_[_0x297f('0x51')](_0x4057cb[_0x297f('0x4e')],{'$or':_[_0x297f('0x3f')](_0x4057cb[_0x297f('0x47')],function(_0x5bbf6d){var _0x3d9c1b={};_0x3d9c1b[_0x5bbf6d]={'$like':'%'+_0x226092['query'][_0x297f('0x50')]+'%'};return _0x3d9c1b;})});}_0x4057cb=_[_0x297f('0x51')]({},_0x4057cb,_0x226092[_0x297f('0x53')]);return _0x166e20[_0x297f('0xbf')](_0x4057cb);}})[_0x297f('0x20')](function(_0x48f73e){if(_0x48f73e){_0x238100=_0x48f73e['length'];if(!_0x226092['query'][_0x297f('0x4b')](_0x297f('0x4c'))){_0x4057cb[_0x297f('0x32')]=qs[_0x297f('0x32')](_0x226092[_0x297f('0x45')][_0x297f('0x32')]);_0x4057cb['offset']=qs[_0x297f('0x2f')](_0x226092['query'][_0x297f('0x2f')]);}return _0x166e20['getApplications'](_0x4057cb);}})[_0x297f('0x20')](function(_0x5328d4){if(_0x5328d4){return _0x5328d4?{'count':_0x238100,'rows':_0x5328d4}:null;}})[_0x297f('0x20')](respondWithResult(_0x3b4d7d,null))[_0x297f('0x2a')](handleError(_0x3b4d7d,null));};exports['getInteractions']=function(_0x5971d4,_0x429589,_0x3e7bee){var _0x5dabf2={'raw':![],'where':{}};var _0x5c11df={};var _0x17ed09={'count':0x0,'rows':[]};return db[_0x297f('0x40')]['findOne']({'where':{'id':_0x5971d4[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x429589,null))['then'](function(_0x291655){if(_0x291655){_0x5c11df[_0x297f('0x44')]=_['keys'](db[_0x297f('0x9f')]['rawAttributes']);_0x5c11df['query']=_[_0x297f('0x5b')](_0x5971d4[_0x297f('0x45')]);_0x5c11df[_0x297f('0x46')]=_['intersection'](_0x5c11df[_0x297f('0x44')],_0x5c11df['query']);_0x5dabf2[_0x297f('0x47')]=_['intersection'](_0x5c11df['model'],qs[_0x297f('0x49')](_0x5971d4['query'][_0x297f('0x49')]));_0x5dabf2[_0x297f('0x47')]=_0x5dabf2[_0x297f('0x47')][_0x297f('0x4a')]?_0x5dabf2[_0x297f('0x47')]:_0x5c11df['model'];if(!_0x5971d4[_0x297f('0x45')][_0x297f('0x4b')](_0x297f('0x4c'))){_0x5dabf2[_0x297f('0x32')]=qs['limit'](_0x5971d4[_0x297f('0x45')]['limit']);_0x5dabf2[_0x297f('0x2f')]=qs['offset'](_0x5971d4[_0x297f('0x45')]['offset']);}_0x5dabf2['order']=qs[_0x297f('0x4d')](_0x5971d4[_0x297f('0x45')][_0x297f('0x4d')]);_0x5dabf2[_0x297f('0x4e')]=qs[_0x297f('0x46')](_[_0x297f('0x4f')](_0x5971d4[_0x297f('0x45')],_0x5c11df[_0x297f('0x46')]));_0x5dabf2[_0x297f('0x4e')][_0x297f('0x66')]=_0x291655['id'];if(_0x5971d4[_0x297f('0x45')][_0x297f('0x50')]){_0x5dabf2['where']=_[_0x297f('0x51')](_0x5dabf2[_0x297f('0x4e')],{'$or':_[_0x297f('0x3f')](_0x5dabf2[_0x297f('0x47')],function(_0x5003a1){var _0x3c490f={};_0x3c490f[_0x5003a1]={'$like':'%'+_0x5971d4[_0x297f('0x45')][_0x297f('0x50')]+'%'};return _0x3c490f;})});}_0x5dabf2=_[_0x297f('0x51')]({},_0x5dabf2,_0x5971d4[_0x297f('0x53')]);return db[_0x297f('0x9f')][_0x297f('0x31')]({'where':_0x5dabf2[_0x297f('0x4e')]})['then'](function(_0x13cfbf){_0x17ed09[_0x297f('0x31')]=_0x13cfbf;if(_0x5971d4[_0x297f('0x45')][_0x297f('0x54')]){_0x5dabf2[_0x297f('0x55')]=[{'model':db['CmContact'],'as':_0x297f('0xc0'),'required':![]},{'model':db['User'],'as':_0x297f('0xc1'),'attributes':['name',_0x297f('0xc2'),_0x297f('0xc3')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x297f('0x3b'),_0x297f('0xc4')],'where':_0x5971d4['query'][_0x297f('0xc5')]?{'id':_0x5971d4[_0x297f('0x45')][_0x297f('0xc5')]}:undefined,'required':_0x5971d4[_0x297f('0x45')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x297f('0x56')](_0x5dabf2);})['then'](function(_0x6f4e50){_0x17ed09[_0x297f('0x57')]=_0x6f4e50;return _0x17ed09;});}})[_0x297f('0x20')](respondWithFilteredResult(_0x429589,_0x5dabf2))[_0x297f('0x2a')](handleError(_0x429589,null));};exports['send']=function(_0x4bd141,_0x3084a7,_0x17a17c){var _0x3764be,_0x2d5ba4,_0xf7e9ab;if(_[_0x297f('0x95')](_0x4bd141[_0x297f('0x63')][_0x297f('0x63')])||_0x4bd141[_0x297f('0x63')][_0x297f('0x63')]===''){throw new db[(_0x297f('0x76'))][(_0x297f('0x77'))](_0x297f('0x96'));}if(_['isNil'](_0x4bd141[_0x297f('0x63')]['to'])){throw new db['Sequelize'][(_0x297f('0x77'))](_0x297f('0xc6'));}_0x3764be=_0x4bd141['body']['to'];return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x4bd141[_0x297f('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x297f('0x75')],'as':_0x297f('0x9e'),'where':{'mobile':_0x3764be},'limit':0x1,'order':[[_0x297f('0x79'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3084a7,null))[_0x297f('0x20')](function(_0x308434){if(_0x308434&&_0x308434['List']){_0x2d5ba4=_0x308434[_0x297f('0x37')]({'plain':!![]});if(_0x2d5ba4[_0x297f('0xc7')]&&_0x2d5ba4['List'][_0x297f('0x9e')][_0x297f('0x4a')]){return _0x2d5ba4['List'][_0x297f('0x9e')][0x0];}return db['CmContact'][_0x297f('0x5c')](_[_0x297f('0x19')](_0x4bd141[_0x297f('0x63')],{'firstName':_0x3764be,'mobile':_0x3764be,'phone':_0x3764be,'ListId':_0x2d5ba4[_0x297f('0x9a')]}));}})[_0x297f('0x20')](handleEntityNotFound(_0x3084a7,null))['then'](function(_0x46adc3){if(_0x46adc3){_0xf7e9ab=_0x46adc3;return db[_0x297f('0x9f')][_0x297f('0x60')]({'where':{'ContactId':_0xf7e9ab['id'],'closed':![],'SmsAccountId':_0x2d5ba4['id']}})[_0x297f('0x20')](function(_0x4ca2a4){if(_0x4ca2a4){return[_0x4ca2a4,![]];}return db[_0x297f('0x9f')][_0x297f('0x5c')]({'UserId':_0x4bd141[_0x297f('0x5d')]['id'],'ContactId':_0xf7e9ab['id'],'SmsAccountId':_0x2d5ba4['id'],'phone':_0x3764be,'firstMsgDirection':_0x297f('0xc8'),'Messages':[_['merge'](_0x4bd141[_0x297f('0x63')],{'read':![],'body':_0x4bd141[_0x297f('0x63')][_0x297f('0x63')],'phone':_0x3764be,'SmsAccountId':_0x2d5ba4['id'],'UserId':_0x4bd141[_0x297f('0x5d')]['id'],'ContactId':_0xf7e9ab['id']})]},{'include':[{'model':db[_0x297f('0xa5')],'as':_0x297f('0xc9')}]})[_0x297f('0x20')](function(_0x38a5ca){return[_0x38a5ca,!![]];});});}})[_0x297f('0xca')](function(_0x575950,_0x2ed0e8){if(_0x2ed0e8){return _0x575950;}return db['SmsMessage']['create'](_['merge'](_0x4bd141[_0x297f('0x63')],{'read':![],'body':_0x4bd141[_0x297f('0x63')][_0x297f('0x63')],'phone':_0x3764be,'SmsAccountId':_0x2d5ba4['id'],'SmsInteractionId':_0x575950['id'],'UserId':_0x4bd141[_0x297f('0x5d')]['id'],'ContactId':_0xf7e9ab['id']}))[_0x297f('0x20')](function(_0x57e66e){_0x575950[_0x297f('0xcb')]['Messages']=[];_0x575950[_0x297f('0xcb')][_0x297f('0xc9')][_0x297f('0xa2')](_0x57e66e[_0x297f('0xcb')]);return _0x575950;});})[_0x297f('0x20')](respondWithResult(_0x3084a7,null))['catch'](handleError(_0x3084a7,null));};exports[_0x297f('0x2c')]=function(_0x2ad9f7,_0x1a25aa,_0x5bcee8){if(_0x2ad9f7['body']['id']){delete _0x2ad9f7[_0x297f('0x63')]['id'];}var _0x10cceb,_0x398ee8,_0x185279;return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x2ad9f7['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x1a25aa,null))[_0x297f('0x20')](function(_0x569068){if(_0x569068){_0x185279=_0x569068;logger[_0x297f('0x22')](_0x297f('0x23'),'status',_0x297f('0xcc'),_0x569068['type'],util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));switch(_0x569068[_0x297f('0x42')]){case _0x297f('0x83'):if(_0x2ad9f7[_0x297f('0x63')]['skebby_dispatch_id']&&_0x2ad9f7[_0x297f('0x63')]['status']){_0x398ee8=_0x2ad9f7[_0x297f('0x63')][_0x297f('0x2c')];return db[_0x297f('0xa5')][_0x297f('0x60')]({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')][_0x297f('0xce')]}});}break;case'connectel':if(_0x2ad9f7[_0x297f('0x63')]['requestid']&&_0x2ad9f7[_0x297f('0x63')][_0x297f('0xcf')]){_0x398ee8=_0x2ad9f7[_0x297f('0x63')][_0x297f('0xcf')];return db[_0x297f('0xa5')]['find']({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')]['requestid']}});}break;case _0x297f('0x86'):if(_0x2ad9f7[_0x297f('0x63')]['message_id']&&_0x2ad9f7['body'][_0x297f('0xd0')]){_0x398ee8=_0x2ad9f7['body']['status_code'];return db[_0x297f('0xa5')][_0x297f('0x60')]({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')][_0x297f('0x87')]}});}break;case _0x297f('0x8a'):var _0x2b5686=_0x2ad9f7['body']['results'][0x0];if(_0x2b5686[_0x297f('0x81')]&&_0x2b5686['status'][_0x297f('0xd1')]===_0x297f('0xd2')){_0x398ee8=_0x2b5686[_0x297f('0x2c')]['groupName'];return db['SmsMessage'][_0x297f('0x60')]({'where':{'messageId':_0x2b5686[_0x297f('0x81')]}});}break;case _0x297f('0x8f'):if(_0x2ad9f7[_0x297f('0x63')]['messageId']&&_0x2ad9f7[_0x297f('0x63')][_0x297f('0x2c')]){_0x398ee8=_0x2ad9f7[_0x297f('0x63')][_0x297f('0x2c')];return db[_0x297f('0xa5')]['find']({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')][_0x297f('0x81')]}});}break;case'bandwidth':if(_0x2ad9f7[_0x297f('0x63')][0x0][_0x297f('0x28')]['id']){_0x398ee8=_0x2ad9f7[_0x297f('0x63')][0x0][_0x297f('0x42')];return db['SmsMessage'][_0x297f('0x60')]({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')][0x0][_0x297f('0x28')]['id']}});}break;case _0x297f('0xd3'):if(_0x2ad9f7[_0x297f('0x63')][_0x297f('0xd4')]&&_0x2ad9f7[_0x297f('0x63')]['status']){_0x398ee8=_0x2ad9f7[_0x297f('0x63')]['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x2ad9f7[_0x297f('0x63')][_0x297f('0xd4')]}});}break;}}})[_0x297f('0x20')](handleEntityNotFound(_0x1a25aa,null))['then'](function(_0x5bac1f){if(_0x5bac1f){_0x10cceb=_0x5bac1f;switch(_0x185279['type']){case _0x297f('0x83'):if(_0x398ee8===_0x297f('0xd2')){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')](_0x297f('0x23'),_0x297f('0x2c'),'skebby',util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x398ee8==='1'){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger['error'](_0x297f('0x23'),'status',_0x297f('0x83'),util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case _0x297f('0x86'):if(!_0x2ad9f7[_0x297f('0x63')][_0x297f('0xd5')]&&_0x398ee8>=0xc8&&_0x398ee8<=0xce){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case _0x297f('0x8a'):var _0x3d95e9=_0x2ad9f7['body']['results'][0x0];if(_0x3d95e9[_0x297f('0x2c')][_0x297f('0xd1')]===_0x297f('0xd2')){return _0x10cceb['update']({'read':!![]});}else{logger[_0x297f('0x25')](_0x297f('0x23'),_0x297f('0x2c'),_0x297f('0x8a'),util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case _0x297f('0x8f'):if(_0x398ee8==_0x297f('0xd6')||_0x398ee8=='RECEIVED_BY_RECIPIENT'){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x297f('0x2c'),'clickatell',util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x398ee8==_0x297f('0xd7')){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')](_0x297f('0x23'),_0x297f('0x2c'),_0x297f('0x92'),util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x398ee8===_0x297f('0xd8')||_0x398ee8==='ACCEPTD'){return _0x10cceb[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')](_0x297f('0x23'),_0x297f('0x2c'),_0x297f('0xd3'),util[_0x297f('0xcd')](_0x2ad9f7[_0x297f('0x63')],{'showHidden':![],'depth':null}));}break;}return _0x10cceb;}})[_0x297f('0x20')](respondWithResult(_0x1a25aa,null))['catch'](handleError(_0x1a25aa,null));};exports['statusGet']=function(_0x1cd329,_0x4f1473,_0x45eae0){var _0xd46eed,_0x255367,_0x366fcf;return db[_0x297f('0x40')]['find']({'where':{'id':_0x1cd329[_0x297f('0x59')]['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x4f1473,null))['then'](function(_0x57f01c){if(_0x57f01c){_0x366fcf=_0x57f01c;logger[_0x297f('0x22')](_0x297f('0x23'),_0x297f('0x2c'),_0x297f('0xcc'),_0x57f01c[_0x297f('0x42')],util['inspect'](_0x1cd329[_0x297f('0x45')],{'showHidden':![],'depth':null}));switch(_0x57f01c[_0x297f('0x42')]){case _0x297f('0x8d'):if(_0x1cd329['query'][_0x297f('0xd9')]&&_0x1cd329['query'][_0x297f('0xda')]){_0x255367=_0x1cd329[_0x297f('0x45')][_0x297f('0xda')];return db[_0x297f('0xa5')][_0x297f('0x60')]({'where':{'messageId':_0x1cd329['query'][_0x297f('0xd9')]}});}break;}}})[_0x297f('0x20')](handleEntityNotFound(_0x4f1473,null))['then'](function(_0x1f9fcd){if(_0x1f9fcd){_0xd46eed=_0x1f9fcd;switch(_0x366fcf[_0x297f('0x42')]){case _0x297f('0x8d'):if(_0x255367==='2'||_0x255367==='6'){return _0xd46eed[_0x297f('0x36')]({'read':!![]});}else{logger[_0x297f('0x25')](_0x297f('0x23'),_0x297f('0x2c'),_0x297f('0x8d'),util[_0x297f('0xcd')](_0x1cd329[_0x297f('0x45')],{'showHidden':![],'depth':null}));};break;}return _0xd46eed;}})[_0x297f('0x20')](respondWithResult(_0x4f1473,null))['catch'](handleError(_0x4f1473,null));};exports[_0x297f('0xdb')]=function(_0x4bbee0,_0x1e0a43,_0x2c99ea){return db[_0x297f('0x40')][_0x297f('0x60')]({'where':{'id':_0x4bbee0['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x1e0a43,null))[_0x297f('0x20')](function(_0x5a7efa){if(_0x5a7efa){return _0x5a7efa[_0x297f('0xdb')](_0x4bbee0[_0x297f('0x63')][_0x297f('0x6b')],_[_0x297f('0x9d')](_0x4bbee0['body'],['ids','id'])||{})['spread'](function(_0x25cec1){for(var _0xd5370d=0x0;_0xd5370d<_0x4bbee0[_0x297f('0x63')]['ids']['length'];_0xd5370d+=0x1){socket[_0x297f('0xdc')](_0x297f('0xdd'),{'UserId':Number(_0x4bbee0[_0x297f('0x63')][_0x297f('0x6b')][_0xd5370d]),'SmsAccountId':Number(_0x4bbee0[_0x297f('0x59')]['id'])});}return _0x25cec1;});}})['then'](respondWithResult(_0x1e0a43,null))[_0x297f('0x2a')](handleError(_0x1e0a43,null));};exports[_0x297f('0xde')]=function(_0xa9db2,_0x545949,_0x46529c){return db['SmsAccount'][_0x297f('0x60')]({'where':{'id':_0xa9db2['params']['id']}})[_0x297f('0x20')](handleEntityNotFound(_0x545949,null))['then'](function(_0x42cba5){if(_0x42cba5){return _0x42cba5['removeAgents'](_0xa9db2['query'][_0x297f('0x6b')])['then'](function(){if(_[_0x297f('0xdf')](_0xa9db2[_0x297f('0x45')][_0x297f('0x6b')])){for(var _0x433b31=0x0;_0x433b31<_0xa9db2['query'][_0x297f('0x6b')]['length'];_0x433b31+=0x1){socket[_0x297f('0xdc')](_0x297f('0xe0'),{'UserId':Number(_0xa9db2[_0x297f('0x45')][_0x297f('0x6b')][_0x433b31]),'SmsAccountId':Number(_0xa9db2['params']['id'])});}}else{socket[_0x297f('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0xa9db2['query'][_0x297f('0x6b')]),'SmsAccountId':Number(_0xa9db2[_0x297f('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x545949,null))['catch'](handleError(_0x545949,null));};exports[_0x297f('0xe1')]=function(_0x1fc8bf,_0x4b347d,_0x2172b3){var _0x7e2b80={};var _0x120d22={};var _0x272441;var _0x289aee;return db[_0x297f('0x40')][_0x297f('0x68')]({'where':{'id':_0x1fc8bf[_0x297f('0x59')]['id']}})['then'](handleEntityNotFound(_0x4b347d,null))[_0x297f('0x20')](function(_0x36f5cb){if(_0x36f5cb){_0x272441=_0x36f5cb;_0x120d22['model']=_[_0x297f('0x5b')](db[_0x297f('0xa9')][_0x297f('0x41')]);_0x120d22[_0x297f('0x45')]=_[_0x297f('0x5b')](_0x1fc8bf['query']);_0x120d22[_0x297f('0x46')]=_['intersection'](_0x120d22[_0x297f('0x44')],_0x120d22[_0x297f('0x45')]);_0x7e2b80[_0x297f('0x47')]=_['intersection'](_0x120d22[_0x297f('0x44')],qs['fields'](_0x1fc8bf[_0x297f('0x45')][_0x297f('0x49')]));_0x7e2b80[_0x297f('0x47')]=_0x7e2b80[_0x297f('0x47')][_0x297f('0x4a')]?_0x7e2b80[_0x297f('0x47')]:_0x120d22[_0x297f('0x44')];_0x7e2b80[_0x297f('0x6a')]=qs[_0x297f('0x4d')](_0x1fc8bf['query'][_0x297f('0x4d')]);_0x7e2b80['where']=qs[_0x297f('0x46')](_[_0x297f('0x4f')](_0x1fc8bf[_0x297f('0x45')],_0x120d22['filters']));if(_0x1fc8bf[_0x297f('0x45')][_0x297f('0x50')]){_0x7e2b80[_0x297f('0x4e')]=_[_0x297f('0x51')](_0x7e2b80[_0x297f('0x4e')],{'$or':_['map'](_0x7e2b80['attributes'],function(_0xa6de33){var _0x22962f={};_0x22962f[_0xa6de33]={'$like':'%'+_0x1fc8bf[_0x297f('0x45')][_0x297f('0x50')]+'%'};return _0x22962f;})});}_0x7e2b80=_[_0x297f('0x51')]({},_0x7e2b80,_0x1fc8bf['options']);return _0x272441[_0x297f('0xe1')](_0x7e2b80);}})['then'](function(_0xdc0d54){if(_0xdc0d54){_0x289aee=_0xdc0d54['length'];if(!_0x1fc8bf[_0x297f('0x45')][_0x297f('0x4b')]('nolimit')){_0x7e2b80[_0x297f('0x32')]=qs[_0x297f('0x32')](_0x1fc8bf['query'][_0x297f('0x32')]);_0x7e2b80['offset']=qs[_0x297f('0x2f')](_0x1fc8bf[_0x297f('0x45')]['offset']);}return _0x272441[_0x297f('0xe1')](_0x7e2b80);}})[_0x297f('0x20')](function(_0x238875){if(_0x238875){return _0x238875?{'count':_0x289aee,'rows':_0x238875}:null;}})[_0x297f('0x20')](respondWithResult(_0x4b347d,null))[_0x297f('0x2a')](handleError(_0x4b347d,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 8636a5e..9a7b5d2 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 _0x6896=['emit','hasOwnProperty','hook','SmsAccount','setMaxListeners','save','update','remove'];(function(_0xa4938d,_0x56b190){var _0x27c150=function(_0x1ddc13){while(--_0x1ddc13){_0xa4938d['push'](_0xa4938d['shift']());}};_0x27c150(++_0x56b190);}(_0x6896,0x17b));var _0x6689=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x6896[_0x1035c1];return _0x308d67;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x6689('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6689('0x1')](0x0);var events={'afterCreate':_0x6689('0x2'),'afterUpdate':_0x6689('0x3'),'afterDestroy':_0x6689('0x4')};function emitEvent(_0x8c470c){return function(_0x5f26fc,_0x20987c,_0x216a81){SmsAccountEvents[_0x6689('0x5')](_0x8c470c+':'+_0x5f26fc['id'],_0x5f26fc);SmsAccountEvents[_0x6689('0x5')](_0x8c470c,_0x5f26fc);_0x216a81(null);};}for(var e in events){if(events[_0x6689('0x6')](e)){var event=events[e];SmsAccount[_0x6689('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x5787=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','save','remove'];(function(_0x4ad4ab,_0x2cf84a){var _0x104b07=function(_0x26dbf5){while(--_0x26dbf5){_0x4ad4ab['push'](_0x4ad4ab['shift']());}};_0x104b07(++_0x2cf84a);}(_0x5787,0x1f3));var _0x7578=function(_0x2b0ccc,_0x2d6371){_0x2b0ccc=_0x2b0ccc-0x0;var _0x1fea1b=_0x5787[_0x2b0ccc];return _0x1fea1b;};'use strict';var EventEmitter=require(_0x7578('0x0'));var SmsAccount=require(_0x7578('0x1'))['db'][_0x7578('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7578('0x3'),'afterUpdate':'update','afterDestroy':_0x7578('0x4')};function emitEvent(_0x5532e9){return function(_0x202e97,_0x509429,_0x2bfa31){SmsAccountEvents[_0x7578('0x5')](_0x5532e9+':'+_0x202e97['id'],_0x202e97);SmsAccountEvents['emit'](_0x5532e9,_0x202e97);_0x2bfa31(null);};}for(var e in events){if(events[_0x7578('0x6')](e)){var event=events[e];SmsAccount[_0x7578('0x7')](e,emitEvent(event));}}module[_0x7578('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f2392bf..7327a82 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 _0x8a30=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','util','../../config/logger'];(function(_0x2be64a,_0x59cefb){var _0x47bcac=function(_0x4ba950){while(--_0x4ba950){_0x2be64a['push'](_0x2be64a['shift']());}};_0x47bcac(++_0x59cefb);}(_0x8a30,0x15c));var _0x08a3=function(_0x5d2e00,_0x1bf91e){_0x5d2e00=_0x5d2e00-0x0;var _0x2fd804=_0x8a30[_0x5d2e00];return _0x2fd804;};'use strict';var _=require(_0x08a3('0x0'));var util=require(_0x08a3('0x1'));var logger=require(_0x08a3('0x2'))('api');var moment=require(_0x08a3('0x3'));var BPromise=require(_0x08a3('0x4'));var rp=require(_0x08a3('0x5'));var fs=require('fs');var path=require(_0x08a3('0x6'));var rimraf=require(_0x08a3('0x7'));var config=require(_0x08a3('0x8'));var attributes=require(_0x08a3('0x9'));module[_0x08a3('0xa')]=function(_0x5832d8,_0x3ebd3f){return _0x5832d8['define'](_0x08a3('0xb'),attributes,{'tableName':_0x08a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0484=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','define','SmsAccount','sms_accounts'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x0484,0x1ce));var _0x4048=function(_0x463331,_0x529b64){_0x463331=_0x463331-0x0;var _0x156fd1=_0x0484[_0x463331];return _0x156fd1;};'use strict';var _=require(_0x4048('0x0'));var util=require(_0x4048('0x1'));var logger=require(_0x4048('0x2'))(_0x4048('0x3'));var moment=require(_0x4048('0x4'));var BPromise=require(_0x4048('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4048('0x6'));var rimraf=require(_0x4048('0x7'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x10b7ec,_0x12e7ce){return _0x10b7ec[_0x4048('0x8')](_0x4048('0x9'),attributes,{'tableName':_0x4048('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 7c65a40..66f8457 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 _0x2dae=['map','model','then','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include'];(function(_0x5500b2,_0xc9a0a5){var _0x580f8e=function(_0x9cd8ad){while(--_0x9cd8ad){_0x5500b2['push'](_0x5500b2['shift']());}};_0x580f8e(++_0xc9a0a5);}(_0x2dae,0x13c));var _0xe2da=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0x2dae[_0x133277];return _0x5b4a22;};'use strict';var _=require('lodash');var util=require(_0xe2da('0x0'));var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require(_0xe2da('0x6'));var logger=require(_0xe2da('0x7'))('rpc');var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson[_0xe2da('0xa')][_0xe2da('0xb')]({'port':0x232a});config['redis']=_[_0xe2da('0xc')](config[_0xe2da('0xd')],{'host':_0xe2da('0xe'),'port':0x18eb});var socket=require(_0xe2da('0xf'))(new Redis(config['redis']));require(_0xe2da('0x10'))[_0xe2da('0x11')](socket);function respondWithRpcPromise(_0x3564a2,_0xfe4ae4,_0x705d4e){return new BPromise(function(_0x17610a,_0x2e658a){return client[_0xe2da('0x12')](_0x3564a2,_0x705d4e)['then'](function(_0x54f8fa){logger[_0xe2da('0x13')](_0xe2da('0x14'),_0xfe4ae4,_0xe2da('0x15'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfe4ae4,_0xe2da('0x15'),JSON[_0xe2da('0x16')](_0x54f8fa));if(_0x54f8fa[_0xe2da('0x17')]){if(_0x54f8fa[_0xe2da('0x17')]['code']===0x1f4){logger[_0xe2da('0x17')]('SmsAccount,\x20%s,\x20%s',_0xfe4ae4,_0x54f8fa['error'][_0xe2da('0x18')]);return _0x2e658a(_0x54f8fa[_0xe2da('0x17')][_0xe2da('0x18')]);}logger['error'](_0xe2da('0x14'),_0xfe4ae4,_0x54f8fa[_0xe2da('0x17')][_0xe2da('0x18')]);return _0x17610a(_0x54f8fa[_0xe2da('0x17')][_0xe2da('0x18')]);}else{logger['info'](_0xe2da('0x14'),_0xfe4ae4,_0xe2da('0x15'));_0x17610a(_0x54f8fa[_0xe2da('0x19')][_0xe2da('0x18')]);}})[_0xe2da('0x1a')](function(_0x366451){logger[_0xe2da('0x17')]('SmsAccount,\x20%s,\x20%s',_0xfe4ae4,_0x366451);_0x2e658a(_0x366451);});});}exports[_0xe2da('0x1b')]=function(_0x4ac8f5){var _0x124caa=this;return new Promise(function(_0x4b1546,_0x511d24){return db[_0xe2da('0x1c')][_0xe2da('0x1d')]({'raw':_0x4ac8f5[_0xe2da('0x1e')]?_0x4ac8f5[_0xe2da('0x1e')][_0xe2da('0x1f')]===undefined?!![]:![]:!![],'where':_0x4ac8f5[_0xe2da('0x1e')]?_0x4ac8f5['options'][_0xe2da('0x20')]||null:null,'attributes':_0x4ac8f5[_0xe2da('0x1e')]?_0x4ac8f5['options'][_0xe2da('0x21')]||null:null,'include':_0x4ac8f5[_0xe2da('0x1e')]?_0x4ac8f5[_0xe2da('0x1e')][_0xe2da('0x22')]?_[_0xe2da('0x23')](_0x4ac8f5[_0xe2da('0x1e')][_0xe2da('0x22')],function(_0x1b5dcd){return{'model':db[_0x1b5dcd['model']],'as':_0x1b5dcd['as'],'attributes':_0x1b5dcd[_0xe2da('0x21')],'include':_0x1b5dcd[_0xe2da('0x22')]?_[_0xe2da('0x23')](_0x1b5dcd[_0xe2da('0x22')],function(_0x3ce2e8){return{'model':db[_0x3ce2e8[_0xe2da('0x24')]],'as':_0x3ce2e8['as'],'attributes':_0x3ce2e8[_0xe2da('0x21')],'include':_0x3ce2e8['include']?_[_0xe2da('0x23')](_0x3ce2e8[_0xe2da('0x22')],function(_0x373b2c){return{'model':db[_0x373b2c[_0xe2da('0x24')]],'as':_0x373b2c['as'],'attributes':_0x373b2c[_0xe2da('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe2da('0x25')](function(_0x5660e9){logger[_0xe2da('0x13')]('ShowSmsAccount',_0x4ac8f5);logger[_0xe2da('0x26')]('ShowSmsAccount',_0x4ac8f5,JSON[_0xe2da('0x16')](_0x5660e9));_0x4b1546(_0x5660e9);})[_0xe2da('0x1a')](function(_0x18f080){logger['error'](_0xe2da('0x1b'),_0x18f080[_0xe2da('0x18')],_0x4ac8f5);_0x511d24(_0x124caa['error'](0x1f4,_0x18f080[_0xe2da('0x18')]));});});}; \ No newline at end of file +var _0x418a=['info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','request\x20sent','result','catch','ShowSmsAccount','find','raw','where','options','attributes','include','map','model','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','then'];(function(_0x20eca8,_0x5cf63f){var _0x1dd774=function(_0x85e754){while(--_0x85e754){_0x20eca8['push'](_0x20eca8['shift']());}};_0x1dd774(++_0x5cf63f);}(_0x418a,0x1d0));var _0xa418=function(_0xc3b473,_0x25d929){_0xc3b473=_0xc3b473-0x0;var _0x1fa818=_0x418a[_0xc3b473];return _0x1fa818;};'use strict';var _=require(_0xa418('0x0'));var util=require(_0xa418('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa418('0x2'));var fs=require('fs');var Redis=require(_0xa418('0x3'));var db=require(_0xa418('0x4'))['db'];var utils=require(_0xa418('0x5'));var logger=require(_0xa418('0x6'))(_0xa418('0x7'));var config=require(_0xa418('0x8'));var jayson=require(_0xa418('0x9'));var client=jayson['client'][_0xa418('0xa')]({'port':0x232a});config[_0xa418('0xb')]=_[_0xa418('0xc')](config['redis'],{'host':_0xa418('0xd'),'port':0x18eb});var socket=require(_0xa418('0xe'))(new Redis(config[_0xa418('0xb')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x447b61,_0xca200d,_0x201ac7){return new BPromise(function(_0x3ac4fb,_0x36ccbe){return client[_0xa418('0xf')](_0x447b61,_0x201ac7)[_0xa418('0x10')](function(_0x3aa979){logger[_0xa418('0x11')]('SmsAccount,\x20%s,\x20%s',_0xca200d,'request\x20sent');logger[_0xa418('0x12')](_0xa418('0x13'),_0xca200d,'request\x20sent',JSON[_0xa418('0x14')](_0x3aa979));if(_0x3aa979[_0xa418('0x15')]){if(_0x3aa979[_0xa418('0x15')][_0xa418('0x16')]===0x1f4){logger[_0xa418('0x15')]('SmsAccount,\x20%s,\x20%s',_0xca200d,_0x3aa979[_0xa418('0x15')][_0xa418('0x17')]);return _0x36ccbe(_0x3aa979[_0xa418('0x15')][_0xa418('0x17')]);}logger[_0xa418('0x15')](_0xa418('0x18'),_0xca200d,_0x3aa979['error'][_0xa418('0x17')]);return _0x3ac4fb(_0x3aa979['error'][_0xa418('0x17')]);}else{logger[_0xa418('0x11')](_0xa418('0x18'),_0xca200d,_0xa418('0x19'));_0x3ac4fb(_0x3aa979[_0xa418('0x1a')][_0xa418('0x17')]);}})[_0xa418('0x1b')](function(_0x34d58d){logger[_0xa418('0x15')](_0xa418('0x18'),_0xca200d,_0x34d58d);_0x36ccbe(_0x34d58d);});});}exports[_0xa418('0x1c')]=function(_0x589dc4){var _0x3c68f5=this;return new Promise(function(_0x405b34,_0x5c3b85){return db['SmsAccount'][_0xa418('0x1d')]({'raw':_0x589dc4['options']?_0x589dc4['options'][_0xa418('0x1e')]===undefined?!![]:![]:!![],'where':_0x589dc4['options']?_0x589dc4['options'][_0xa418('0x1f')]||null:null,'attributes':_0x589dc4[_0xa418('0x20')]?_0x589dc4[_0xa418('0x20')][_0xa418('0x21')]||null:null,'include':_0x589dc4[_0xa418('0x20')]?_0x589dc4[_0xa418('0x20')][_0xa418('0x22')]?_[_0xa418('0x23')](_0x589dc4[_0xa418('0x20')][_0xa418('0x22')],function(_0x42e0eb){return{'model':db[_0x42e0eb[_0xa418('0x24')]],'as':_0x42e0eb['as'],'attributes':_0x42e0eb[_0xa418('0x21')],'include':_0x42e0eb[_0xa418('0x22')]?_[_0xa418('0x23')](_0x42e0eb[_0xa418('0x22')],function(_0x453b09){return{'model':db[_0x453b09[_0xa418('0x24')]],'as':_0x453b09['as'],'attributes':_0x453b09[_0xa418('0x21')],'include':_0x453b09[_0xa418('0x22')]?_[_0xa418('0x23')](_0x453b09[_0xa418('0x22')],function(_0x572a0a){return{'model':db[_0x572a0a[_0xa418('0x24')]],'as':_0x572a0a['as'],'attributes':_0x572a0a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa418('0x10')](function(_0x3e6650){logger['info'](_0xa418('0x1c'),_0x589dc4);logger[_0xa418('0x12')](_0xa418('0x1c'),_0x589dc4,JSON[_0xa418('0x14')](_0x3e6650));_0x405b34(_0x3e6650);})[_0xa418('0x1b')](function(_0x4272c4){logger[_0xa418('0x15')](_0xa418('0x1c'),_0x4272c4[_0xa418('0x17')],_0x589dc4);_0x5c3b85(_0x3c68f5[_0xa418('0x15')](0x1f4,_0x4272c4[_0xa418('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 6ef2be1..82457e6 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(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 f811e4c..98c1723 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x5a0349,_0xaa3aac){var _0x2b3020=function(_0x3fd692){while(--_0x3fd692){_0x5a0349['push'](_0x5a0349['shift']());}};_0x2b3020(++_0xaa3aac);}(_0x3e74,0x175));var _0x43e7=function(_0xd2b5d5,_0x433198){_0xd2b5d5=_0xd2b5d5-0x0;var _0x164fbc=_0x3e74[_0xd2b5d5];return _0x164fbc;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x7217=['Router','fs-extra','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x395aa5,_0x12eb4c){var _0x53f4ac=function(_0x2d80da){while(--_0x2d80da){_0x395aa5['push'](_0x395aa5['shift']());}};_0x53f4ac(++_0x12eb4c);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index eb23913..d0db57c 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 _0x4c77=['INTEGER','noop','STRING','*,*,*,*','exports'];(function(_0x5d6193,_0x13e0be){var _0x238207=function(_0x533d1a){while(--_0x533d1a){_0x5d6193['push'](_0x5d6193['shift']());}};_0x238207(++_0x13e0be);}(_0x4c77,0x1cb));var _0x74c7=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4c77[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require('sequelize');module[_0x74c7('0x0')]={'priority':{'type':Sequelize[_0x74c7('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x74c7('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x74c7('0x3')]},'interval':{'type':Sequelize[_0x74c7('0x3')],'defaultValue':_0x74c7('0x4')}}; \ No newline at end of file +var _0xf709=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3fa1c7,_0x13d816){var _0x21e45d=function(_0x390c64){while(--_0x390c64){_0x3fa1c7['push'](_0x3fa1c7['shift']());}};_0x21e45d(++_0x13d816);}(_0xf709,0x18e));var _0x9f70=function(_0x544036,_0x4b17c7){_0x544036=_0x544036-0x0;var _0x5a53d1=_0xf709[_0x544036];return _0x5a53d1;};'use strict';var Sequelize=require(_0x9f70('0x0'));module[_0x9f70('0x1')]={'priority':{'type':Sequelize[_0x9f70('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9f70('0x3')],'allowNull':![],'defaultValue':_0x9f70('0x4')},'appdata':{'type':Sequelize[_0x9f70('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9f70('0x3')],'defaultValue':_0x9f70('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e3a4fd3..2ff175d 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 _0xde35=['crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../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','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x503226,_0x17b9c1){var _0x339b76=function(_0x257714){while(--_0x257714){_0x503226['push'](_0x503226['shift']());}};_0x339b76(++_0x17b9c1);}(_0xde35,0x170));var _0x5de3=function(_0x4a188d,_0x403e5b){_0x4a188d=_0x4a188d-0x0;var _0x3f216d=_0xde35[_0x4a188d];return _0x3f216d;};'use strict';var emlformat=require(_0x5de3('0x0'));var rimraf=require(_0x5de3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5de3('0x2'));var moment=require('moment');var BPromise=require(_0x5de3('0x3'));var Mustache=require('mustache');var util=require(_0x5de3('0x4'));var path=require(_0x5de3('0x5'));var sox=require(_0x5de3('0x6'));var csv=require(_0x5de3('0x7'));var ejs=require(_0x5de3('0x8'));var fs=require('fs');var fs_extra=require(_0x5de3('0x9'));var _=require(_0x5de3('0xa'));var squel=require(_0x5de3('0xb'));var crypto=require(_0x5de3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5de3('0xd'));var toCsv=require(_0x5de3('0x7'));var querystring=require(_0x5de3('0xe'));var Papa=require(_0x5de3('0xf'));var Redis=require('ioredis');var authService=require(_0x5de3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5de3('0x11'));var logger=require(_0x5de3('0x12'))(_0x5de3('0x13'));var utils=require(_0x5de3('0x14'));var config=require(_0x5de3('0x15'));var licenseUtil=require(_0x5de3('0x16'));var db=require(_0x5de3('0x17'))['db'];function respondWithStatusCode(_0x12deb2,_0x3e3b0f){_0x3e3b0f=_0x3e3b0f||0xcc;return function(_0x4cfb9d){if(_0x4cfb9d){return _0x12deb2['sendStatus'](_0x3e3b0f);}return _0x12deb2['status'](_0x3e3b0f)['end']();};}function respondWithResult(_0x501b8a,_0x5ee20f){_0x5ee20f=_0x5ee20f||0xc8;return function(_0x1db207){if(_0x1db207){return _0x501b8a[_0x5de3('0x18')](_0x5ee20f)[_0x5de3('0x19')](_0x1db207);}};}function respondWithFilteredResult(_0x49d289,_0x20da25){return function(_0x1367b5){if(_0x1367b5){var _0x4229b9=typeof _0x20da25[_0x5de3('0x1a')]===_0x5de3('0x1b')&&typeof _0x20da25[_0x5de3('0x1c')]==='undefined';var _0x128038=_0x1367b5['count'];var _0x487c69=_0x4229b9?0x0:_0x20da25['offset'];var _0x3924a3=_0x4229b9?_0x1367b5[_0x5de3('0x1d')]:_0x20da25[_0x5de3('0x1a')]+_0x20da25[_0x5de3('0x1c')];var _0x449e32;if(_0x3924a3>=_0x128038){_0x3924a3=_0x128038;_0x449e32=0xc8;}else{_0x449e32=0xce;}_0x49d289[_0x5de3('0x18')](_0x449e32);return _0x49d289[_0x5de3('0x1e')](_0x5de3('0x1f'),_0x487c69+'-'+_0x3924a3+'/'+_0x128038)[_0x5de3('0x19')](_0x1367b5);}return null;};}function patchUpdates(_0x30d8c0){return function(_0x5862f2){try{jsonpatch['apply'](_0x5862f2,_0x30d8c0,!![]);}catch(_0x25d8ed){return BPromise[_0x5de3('0x20')](_0x25d8ed);}return _0x5862f2[_0x5de3('0x21')]();};}function saveUpdates(_0x278eb9,_0x32c463){return function(_0x1dbb4b){if(_0x1dbb4b){return _0x1dbb4b[_0x5de3('0x22')](_0x278eb9)[_0x5de3('0x23')](function(_0x424c0c){return _0x424c0c;});}return null;};}function removeEntity(_0x4a3e1a,_0x36b197){return function(_0x2fb4ab){if(_0x2fb4ab){return _0x2fb4ab[_0x5de3('0x24')]()[_0x5de3('0x23')](function(){_0x4a3e1a[_0x5de3('0x18')](0xcc)[_0x5de3('0x25')]();});}};}function handleEntityNotFound(_0x57026b,_0x4567cc){return function(_0x5a3067){if(!_0x5a3067){_0x57026b[_0x5de3('0x26')](0x194);}return _0x5a3067;};}function handleError(_0x2a8bf0,_0x59d642){_0x59d642=_0x59d642||0x1f4;return function(_0xa794f2){logger[_0x5de3('0x27')](_0xa794f2[_0x5de3('0x28')]);if(_0xa794f2[_0x5de3('0x29')]){delete _0xa794f2['name'];}_0x2a8bf0[_0x5de3('0x18')](_0x59d642)[_0x5de3('0x2a')](_0xa794f2);};}exports['index']=function(_0x34c0e1,_0x240854){var _0x51de9e={},_0x5046af={},_0x370ae1={'count':0x0,'rows':[]};var _0x1ad99d=_[_0x5de3('0x2b')](db[_0x5de3('0x2c')][_0x5de3('0x2d')],function(_0x20751a){return{'name':_0x20751a[_0x5de3('0x2e')],'type':_0x20751a[_0x5de3('0x2f')][_0x5de3('0x30')]};});_0x5046af[_0x5de3('0x31')]=_[_0x5de3('0x2b')](_0x1ad99d,_0x5de3('0x29'));_0x5046af[_0x5de3('0x32')]=_[_0x5de3('0x33')](_0x34c0e1[_0x5de3('0x32')]);_0x5046af[_0x5de3('0x34')]=_['intersection'](_0x5046af[_0x5de3('0x31')],_0x5046af['query']);_0x51de9e[_0x5de3('0x35')]=_[_0x5de3('0x36')](_0x5046af[_0x5de3('0x31')],qs[_0x5de3('0x37')](_0x34c0e1['query'][_0x5de3('0x37')]));_0x51de9e[_0x5de3('0x35')]=_0x51de9e[_0x5de3('0x35')][_0x5de3('0x38')]?_0x51de9e[_0x5de3('0x35')]:_0x5046af[_0x5de3('0x31')];if(!_0x34c0e1['query'][_0x5de3('0x39')](_0x5de3('0x3a'))){_0x51de9e['limit']=qs[_0x5de3('0x1c')](_0x34c0e1[_0x5de3('0x32')][_0x5de3('0x1c')]);_0x51de9e['offset']=qs[_0x5de3('0x1a')](_0x34c0e1['query']['offset']);}_0x51de9e[_0x5de3('0x3b')]=qs['sort'](_0x34c0e1[_0x5de3('0x32')][_0x5de3('0x3c')]);_0x51de9e[_0x5de3('0x3d')]=qs[_0x5de3('0x34')](_[_0x5de3('0x3e')](_0x34c0e1['query'],_0x5046af['filters']),_0x1ad99d);if(_0x34c0e1[_0x5de3('0x32')][_0x5de3('0x3f')]){_0x51de9e[_0x5de3('0x3d')]=_[_0x5de3('0x40')](_0x51de9e[_0x5de3('0x3d')],{'$or':_[_0x5de3('0x2b')](_0x1ad99d,function(_0x286972){if(_0x286972[_0x5de3('0x2f')]!==_0x5de3('0x41')){var _0x3a3286={};_0x3a3286[_0x286972[_0x5de3('0x29')]]={'$like':'%'+_0x34c0e1[_0x5de3('0x32')][_0x5de3('0x3f')]+'%'};return _0x3a3286;}})});}_0x51de9e=_['merge']({},_0x51de9e,_0x34c0e1[_0x5de3('0x42')]);var _0x2802a9={'where':_0x51de9e[_0x5de3('0x3d')]};return db['SmsApplication'][_0x5de3('0x1d')](_0x2802a9)[_0x5de3('0x23')](function(_0x541aa6){_0x370ae1[_0x5de3('0x1d')]=_0x541aa6;if(_0x34c0e1['query']['includeAll']){_0x51de9e[_0x5de3('0x43')]=[{'all':!![]}];}return db[_0x5de3('0x2c')]['findAll'](_0x51de9e);})['then'](function(_0x407f38){_0x370ae1[_0x5de3('0x44')]=_0x407f38;return _0x370ae1;})[_0x5de3('0x23')](respondWithFilteredResult(_0x240854,_0x51de9e))[_0x5de3('0x45')](handleError(_0x240854,null));};exports[_0x5de3('0x46')]=function(_0x2933ef,_0x1adc20){var _0x3b38b4={'raw':!![],'where':{'id':_0x2933ef[_0x5de3('0x47')]['id']}},_0x163a28={};_0x163a28[_0x5de3('0x31')]=_[_0x5de3('0x33')](db[_0x5de3('0x2c')][_0x5de3('0x2d')]);_0x163a28[_0x5de3('0x32')]=_['keys'](_0x2933ef['query']);_0x163a28[_0x5de3('0x34')]=_[_0x5de3('0x36')](_0x163a28[_0x5de3('0x31')],_0x163a28[_0x5de3('0x32')]);_0x3b38b4[_0x5de3('0x35')]=_[_0x5de3('0x36')](_0x163a28['model'],qs[_0x5de3('0x37')](_0x2933ef[_0x5de3('0x32')][_0x5de3('0x37')]));_0x3b38b4[_0x5de3('0x35')]=_0x3b38b4[_0x5de3('0x35')][_0x5de3('0x38')]?_0x3b38b4['attributes']:_0x163a28[_0x5de3('0x31')];if(_0x2933ef['query'][_0x5de3('0x48')]){_0x3b38b4[_0x5de3('0x43')]=[{'all':!![]}];}_0x3b38b4=_[_0x5de3('0x40')]({},_0x3b38b4,_0x2933ef['options']);return db[_0x5de3('0x2c')]['find'](_0x3b38b4)[_0x5de3('0x23')](handleEntityNotFound(_0x1adc20,null))['then'](respondWithResult(_0x1adc20,null))[_0x5de3('0x45')](handleError(_0x1adc20,null));};exports[_0x5de3('0x49')]=function(_0x527290,_0x1ff2b6){return db['SmsApplication'][_0x5de3('0x49')](_0x527290[_0x5de3('0x4a')],{})[_0x5de3('0x23')](respondWithResult(_0x1ff2b6,0xc9))[_0x5de3('0x45')](handleError(_0x1ff2b6,null));};exports['update']=function(_0x52ed9e,_0x204771){if(_0x52ed9e['body']['id']){delete _0x52ed9e['body']['id'];}return db[_0x5de3('0x2c')][_0x5de3('0x4b')]({'where':{'id':_0x52ed9e['params']['id']}})[_0x5de3('0x23')](handleEntityNotFound(_0x204771,null))['then'](saveUpdates(_0x52ed9e[_0x5de3('0x4a')],null))['then'](respondWithResult(_0x204771,null))[_0x5de3('0x45')](handleError(_0x204771,null));};exports[_0x5de3('0x24')]=function(_0xbd0f2d,_0x3ef8f3){return db[_0x5de3('0x2c')][_0x5de3('0x4b')]({'where':{'id':_0xbd0f2d[_0x5de3('0x47')]['id']}})[_0x5de3('0x23')](handleEntityNotFound(_0x3ef8f3,null))[_0x5de3('0x23')](removeEntity(_0x3ef8f3,null))[_0x5de3('0x45')](handleError(_0x3ef8f3,null));}; \ No newline at end of file +var _0x633f=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','status','name','index','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','SmsApplication','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x15e098,_0x539cfc){var _0x2ab697=function(_0x53a216){while(--_0x53a216){_0x15e098['push'](_0x15e098['shift']());}};_0x2ab697(++_0x539cfc);}(_0x633f,0x1c0));var _0xf633=function(_0x4e9f9f,_0x1f5c62){_0x4e9f9f=_0x4e9f9f-0x0;var _0x5ada14=_0x633f[_0x4e9f9f];return _0x5ada14;};'use strict';var emlformat=require(_0xf633('0x0'));var rimraf=require(_0xf633('0x1'));var zipdir=require(_0xf633('0x2'));var jsonpatch=require(_0xf633('0x3'));var rp=require(_0xf633('0x4'));var moment=require(_0xf633('0x5'));var BPromise=require(_0xf633('0x6'));var Mustache=require(_0xf633('0x7'));var util=require('util');var path=require(_0xf633('0x8'));var sox=require(_0xf633('0x9'));var csv=require(_0xf633('0xa'));var ejs=require(_0xf633('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf633('0xc'));var squel=require(_0xf633('0xd'));var crypto=require(_0xf633('0xe'));var jsforce=require(_0xf633('0xf'));var deskjs=require(_0xf633('0x10'));var toCsv=require(_0xf633('0xa'));var querystring=require(_0xf633('0x11'));var Papa=require(_0xf633('0x12'));var Redis=require(_0xf633('0x13'));var authService=require(_0xf633('0x14'));var qs=require(_0xf633('0x15'));var as=require(_0xf633('0x16'));var hardwareService=require(_0xf633('0x17'));var logger=require(_0xf633('0x18'))(_0xf633('0x19'));var utils=require('../../config/utils');var config=require(_0xf633('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf633('0x1b'))['db'];function respondWithStatusCode(_0x42f6b8,_0x5c84a4){_0x5c84a4=_0x5c84a4||0xcc;return function(_0x5bb3a5){if(_0x5bb3a5){return _0x42f6b8[_0xf633('0x1c')](_0x5c84a4);}return _0x42f6b8['status'](_0x5c84a4)[_0xf633('0x1d')]();};}function respondWithResult(_0xff14a3,_0x1a70b8){_0x1a70b8=_0x1a70b8||0xc8;return function(_0x369ed2){if(_0x369ed2){return _0xff14a3['status'](_0x1a70b8)[_0xf633('0x1e')](_0x369ed2);}};}function respondWithFilteredResult(_0x5983d5,_0x276198){return function(_0x2492d8){if(_0x2492d8){var _0x4c9a75=typeof _0x276198[_0xf633('0x1f')]===_0xf633('0x20')&&typeof _0x276198[_0xf633('0x21')]===_0xf633('0x20');var _0x1f0d63=_0x2492d8['count'];var _0x301c17=_0x4c9a75?0x0:_0x276198[_0xf633('0x1f')];var _0x1647cc=_0x4c9a75?_0x2492d8[_0xf633('0x22')]:_0x276198[_0xf633('0x1f')]+_0x276198[_0xf633('0x21')];var _0x7e1fb1;if(_0x1647cc>=_0x1f0d63){_0x1647cc=_0x1f0d63;_0x7e1fb1=0xc8;}else{_0x7e1fb1=0xce;}_0x5983d5['status'](_0x7e1fb1);return _0x5983d5['set'](_0xf633('0x23'),_0x301c17+'-'+_0x1647cc+'/'+_0x1f0d63)[_0xf633('0x1e')](_0x2492d8);}return null;};}function patchUpdates(_0x4b6c43){return function(_0x3f11f7){try{jsonpatch[_0xf633('0x24')](_0x3f11f7,_0x4b6c43,!![]);}catch(_0x47d8c5){return BPromise[_0xf633('0x25')](_0x47d8c5);}return _0x3f11f7[_0xf633('0x26')]();};}function saveUpdates(_0x361576,_0x27f958){return function(_0x166394){if(_0x166394){return _0x166394['update'](_0x361576)['then'](function(_0x5a5926){return _0x5a5926;});}return null;};}function removeEntity(_0x1d0e87,_0x57947d){return function(_0x450347){if(_0x450347){return _0x450347[_0xf633('0x27')]()[_0xf633('0x28')](function(){_0x1d0e87[_0xf633('0x29')](0xcc)[_0xf633('0x1d')]();});}};}function handleEntityNotFound(_0x33ac03,_0x28bdf0){return function(_0x17b869){if(!_0x17b869){_0x33ac03['sendStatus'](0x194);}return _0x17b869;};}function handleError(_0x2beafb,_0x7199fa){_0x7199fa=_0x7199fa||0x1f4;return function(_0x1eac07){logger['error'](_0x1eac07['stack']);if(_0x1eac07[_0xf633('0x2a')]){delete _0x1eac07[_0xf633('0x2a')];}_0x2beafb[_0xf633('0x29')](_0x7199fa)['send'](_0x1eac07);};}exports[_0xf633('0x2b')]=function(_0x4971e7,_0x2cc24f){var _0x187c02={},_0x470a24={},_0x332cfb={'count':0x0,'rows':[]};var _0x162798=_['map'](db['SmsApplication'][_0xf633('0x2c')],function(_0x4fe981){return{'name':_0x4fe981[_0xf633('0x2d')],'type':_0x4fe981[_0xf633('0x2e')][_0xf633('0x2f')]};});_0x470a24[_0xf633('0x30')]=_[_0xf633('0x31')](_0x162798,_0xf633('0x2a'));_0x470a24[_0xf633('0x32')]=_['keys'](_0x4971e7[_0xf633('0x32')]);_0x470a24['filters']=_['intersection'](_0x470a24[_0xf633('0x30')],_0x470a24[_0xf633('0x32')]);_0x187c02[_0xf633('0x33')]=_[_0xf633('0x34')](_0x470a24[_0xf633('0x30')],qs['fields'](_0x4971e7['query'][_0xf633('0x35')]));_0x187c02[_0xf633('0x33')]=_0x187c02[_0xf633('0x33')][_0xf633('0x36')]?_0x187c02['attributes']:_0x470a24[_0xf633('0x30')];if(!_0x4971e7[_0xf633('0x32')][_0xf633('0x37')](_0xf633('0x38'))){_0x187c02[_0xf633('0x21')]=qs[_0xf633('0x21')](_0x4971e7[_0xf633('0x32')][_0xf633('0x21')]);_0x187c02[_0xf633('0x1f')]=qs[_0xf633('0x1f')](_0x4971e7[_0xf633('0x32')][_0xf633('0x1f')]);}_0x187c02[_0xf633('0x39')]=qs['sort'](_0x4971e7[_0xf633('0x32')][_0xf633('0x3a')]);_0x187c02[_0xf633('0x3b')]=qs['filters'](_[_0xf633('0x3c')](_0x4971e7[_0xf633('0x32')],_0x470a24[_0xf633('0x3d')]),_0x162798);if(_0x4971e7[_0xf633('0x32')][_0xf633('0x3e')]){_0x187c02[_0xf633('0x3b')]=_[_0xf633('0x3f')](_0x187c02['where'],{'$or':_['map'](_0x162798,function(_0x1a8f87){if(_0x1a8f87[_0xf633('0x2e')]!=='VIRTUAL'){var _0x2d0c99={};_0x2d0c99[_0x1a8f87[_0xf633('0x2a')]]={'$like':'%'+_0x4971e7[_0xf633('0x32')][_0xf633('0x3e')]+'%'};return _0x2d0c99;}})});}_0x187c02=_[_0xf633('0x3f')]({},_0x187c02,_0x4971e7['options']);var _0x26c89e={'where':_0x187c02[_0xf633('0x3b')]};return db[_0xf633('0x40')][_0xf633('0x22')](_0x26c89e)[_0xf633('0x28')](function(_0x49eafc){_0x332cfb[_0xf633('0x22')]=_0x49eafc;if(_0x4971e7[_0xf633('0x32')][_0xf633('0x41')]){_0x187c02[_0xf633('0x42')]=[{'all':!![]}];}return db[_0xf633('0x40')][_0xf633('0x43')](_0x187c02);})[_0xf633('0x28')](function(_0x502905){_0x332cfb[_0xf633('0x44')]=_0x502905;return _0x332cfb;})[_0xf633('0x28')](respondWithFilteredResult(_0x2cc24f,_0x187c02))[_0xf633('0x45')](handleError(_0x2cc24f,null));};exports[_0xf633('0x46')]=function(_0xa8177c,_0x11af93){var _0x2eff66={'raw':!![],'where':{'id':_0xa8177c[_0xf633('0x47')]['id']}},_0x14a70a={};_0x14a70a['model']=_[_0xf633('0x48')](db[_0xf633('0x40')]['rawAttributes']);_0x14a70a[_0xf633('0x32')]=_[_0xf633('0x48')](_0xa8177c[_0xf633('0x32')]);_0x14a70a[_0xf633('0x3d')]=_[_0xf633('0x34')](_0x14a70a['model'],_0x14a70a[_0xf633('0x32')]);_0x2eff66[_0xf633('0x33')]=_[_0xf633('0x34')](_0x14a70a[_0xf633('0x30')],qs['fields'](_0xa8177c['query'][_0xf633('0x35')]));_0x2eff66[_0xf633('0x33')]=_0x2eff66[_0xf633('0x33')][_0xf633('0x36')]?_0x2eff66[_0xf633('0x33')]:_0x14a70a[_0xf633('0x30')];if(_0xa8177c[_0xf633('0x32')][_0xf633('0x41')]){_0x2eff66[_0xf633('0x42')]=[{'all':!![]}];}_0x2eff66=_[_0xf633('0x3f')]({},_0x2eff66,_0xa8177c[_0xf633('0x49')]);return db[_0xf633('0x40')]['find'](_0x2eff66)['then'](handleEntityNotFound(_0x11af93,null))[_0xf633('0x28')](respondWithResult(_0x11af93,null))['catch'](handleError(_0x11af93,null));};exports[_0xf633('0x4a')]=function(_0x222d0e,_0x1a1df5){return db[_0xf633('0x40')][_0xf633('0x4a')](_0x222d0e[_0xf633('0x4b')],{})['then'](respondWithResult(_0x1a1df5,0xc9))[_0xf633('0x45')](handleError(_0x1a1df5,null));};exports[_0xf633('0x4c')]=function(_0x3aab14,_0x1ea1e5){if(_0x3aab14[_0xf633('0x4b')]['id']){delete _0x3aab14['body']['id'];}return db[_0xf633('0x40')]['find']({'where':{'id':_0x3aab14[_0xf633('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ea1e5,null))[_0xf633('0x28')](saveUpdates(_0x3aab14[_0xf633('0x4b')],null))[_0xf633('0x28')](respondWithResult(_0x1ea1e5,null))[_0xf633('0x45')](handleError(_0x1ea1e5,null));};exports[_0xf633('0x27')]=function(_0x1707bc,_0x3ba2cd){return db['SmsApplication'][_0xf633('0x4d')]({'where':{'id':_0x1707bc[_0xf633('0x47')]['id']}})[_0xf633('0x28')](handleEntityNotFound(_0x3ba2cd,null))[_0xf633('0x28')](removeEntity(_0x3ba2cd,null))[_0xf633('0x45')](handleError(_0x3ba2cd,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 95ba847..821b1fc 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 _0x4bc6=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','utf8mb4_unicode_ci','util'];(function(_0x43db53,_0x34cd0c){var _0x5a9872=function(_0x3c84b2){while(--_0x3c84b2){_0x43db53['push'](_0x43db53['shift']());}};_0x5a9872(++_0x34cd0c);}(_0x4bc6,0xd0));var _0x64bc=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4bc6[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x64bc('0x0'));var logger=require(_0x64bc('0x1'))('api');var moment=require(_0x64bc('0x2'));var BPromise=require('bluebird');var rp=require(_0x64bc('0x3'));var fs=require('fs');var path=require(_0x64bc('0x4'));var rimraf=require(_0x64bc('0x5'));var config=require(_0x64bc('0x6'));var attributes=require(_0x64bc('0x7'));module[_0x64bc('0x8')]=function(_0x1e5c2b,_0x2443d7){return _0x1e5c2b[_0x64bc('0x9')]('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x64bc('0xa')});}; \ No newline at end of file +var _0xeedf=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','sms_applications','utf8mb4_unicode_ci'];(function(_0x3cb152,_0x57eb54){var _0x4f54c3=function(_0x273a45){while(--_0x273a45){_0x3cb152['push'](_0x3cb152['shift']());}};_0x4f54c3(++_0x57eb54);}(_0xeedf,0x12c));var _0xfeed=function(_0x4aab96,_0x59db9c){_0x4aab96=_0x4aab96-0x0;var _0x2a8eb3=_0xeedf[_0x4aab96];return _0x2a8eb3;};'use strict';var _=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var logger=require(_0xfeed('0x2'))('api');var moment=require(_0xfeed('0x3'));var BPromise=require('bluebird');var rp=require(_0xfeed('0x4'));var fs=require('fs');var path=require(_0xfeed('0x5'));var rimraf=require(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var attributes=require('./smsApplication.attributes');module[_0xfeed('0x8')]=function(_0x2c211d,_0x5df4fe){return _0x2c211d[_0xfeed('0x9')]('SmsApplication',attributes,{'tableName':_0xfeed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfeed('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index cdc0c2c..668fede 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 _0x639a=['debug','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent'];(function(_0x1fd44c,_0x3e60d1){var _0x5ed0a2=function(_0x2bc4ed){while(--_0x2bc4ed){_0x1fd44c['push'](_0x1fd44c['shift']());}};_0x5ed0a2(++_0x3e60d1);}(_0x639a,0x1e8));var _0xa639=function(_0x234eb0,_0x544f22){_0x234eb0=_0x234eb0-0x0;var _0x819faa=_0x639a[_0x234eb0];return _0x819faa;};'use strict';var _=require(_0xa639('0x0'));var util=require(_0xa639('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa639('0x2'));var fs=require('fs');var Redis=require(_0xa639('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa639('0x4'));var logger=require(_0xa639('0x5'))(_0xa639('0x6'));var config=require(_0xa639('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa639('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x276815,_0x38b779,_0x277b76){return new BPromise(function(_0x2f4bce,_0x41a185){return client['request'](_0x276815,_0x277b76)[_0xa639('0x9')](function(_0x16d090){logger[_0xa639('0xa')]('SmsApplication,\x20%s,\x20%s',_0x38b779,_0xa639('0xb'));logger[_0xa639('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x38b779,_0xa639('0xb'),JSON[_0xa639('0xd')](_0x16d090));if(_0x16d090['error']){if(_0x16d090[_0xa639('0xe')][_0xa639('0xf')]===0x1f4){logger['error'](_0xa639('0x10'),_0x38b779,_0x16d090[_0xa639('0xe')][_0xa639('0x11')]);return _0x41a185(_0x16d090[_0xa639('0xe')][_0xa639('0x11')]);}logger[_0xa639('0xe')](_0xa639('0x10'),_0x38b779,_0x16d090['error'][_0xa639('0x11')]);return _0x2f4bce(_0x16d090[_0xa639('0xe')][_0xa639('0x11')]);}else{logger[_0xa639('0xa')](_0xa639('0x10'),_0x38b779,_0xa639('0xb'));_0x2f4bce(_0x16d090[_0xa639('0x12')][_0xa639('0x11')]);}})[_0xa639('0x13')](function(_0x58eded){logger[_0xa639('0xe')](_0xa639('0x10'),_0x38b779,_0x58eded);_0x41a185(_0x58eded);});});} \ No newline at end of file +var _0xceef=['jayson/promise','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x567dc7,_0x4e0e9c){var _0x5bb553=function(_0x21e776){while(--_0x21e776){_0x567dc7['push'](_0x567dc7['shift']());}};_0x5bb553(++_0x4e0e9c);}(_0xceef,0xf6));var _0xfcee=function(_0x1e53ca,_0x2692ed){_0x1e53ca=_0x1e53ca-0x0;var _0x55e658=_0xceef[_0x1e53ca];return _0x55e658;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcee('0x0'));var BPromise=require(_0xfcee('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcee('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfcee('0x3'));var logger=require(_0xfcee('0x4'))('rpc');var config=require(_0xfcee('0x5'));var jayson=require(_0xfcee('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35234a,_0xfbfb75,_0xd69040){return new BPromise(function(_0x5b0d2c,_0x513a59){return client[_0xfcee('0x7')](_0x35234a,_0xd69040)[_0xfcee('0x8')](function(_0xcea858){logger[_0xfcee('0x9')](_0xfcee('0xa'),_0xfbfb75,_0xfcee('0xb'));logger[_0xfcee('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0xfbfb75,_0xfcee('0xb'),JSON[_0xfcee('0xd')](_0xcea858));if(_0xcea858[_0xfcee('0xe')]){if(_0xcea858[_0xfcee('0xe')][_0xfcee('0xf')]===0x1f4){logger[_0xfcee('0xe')](_0xfcee('0xa'),_0xfbfb75,_0xcea858[_0xfcee('0xe')][_0xfcee('0x10')]);return _0x513a59(_0xcea858['error'][_0xfcee('0x10')]);}logger[_0xfcee('0xe')]('SmsApplication,\x20%s,\x20%s',_0xfbfb75,_0xcea858['error'][_0xfcee('0x10')]);return _0x5b0d2c(_0xcea858[_0xfcee('0xe')][_0xfcee('0x10')]);}else{logger[_0xfcee('0x9')](_0xfcee('0xa'),_0xfbfb75,_0xfcee('0xb'));_0x5b0d2c(_0xcea858['result'][_0xfcee('0x10')]);}})[_0xfcee('0x11')](function(_0x38a971){logger['error'](_0xfcee('0xa'),_0xfbfb75,_0x38a971);_0x513a59(_0x38a971);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 67d9d1f..7d2acad 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 _0xe511=['addTags','put','update','smsinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','describe','show','/:id/messages','isAuthenticated','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xe511,0x16f));var _0x1e51=function(_0xe1c87f,_0x35000d){_0xe1c87f=_0xe1c87f-0x0;var _0x2960ae=_0xe511[_0xe1c87f];return _0x2960ae;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0x8')]('/:id/download',auth[_0x1e51('0xd')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')]('/',auth[_0x1e51('0xd')](),controller[_0x1e51('0x11')]);router[_0x1e51('0x10')]('/:id/messages',auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x10')](_0x1e51('0x13'),auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x16')),controller[_0x1e51('0x17')]);router[_0x1e51('0x18')]('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),'smsinteraction:update'),controller[_0x1e51('0x19')]);router['delete']('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x1a')),controller[_0x1e51('0x1b')]);router[_0x1e51('0x1c')]('/:id/tags',auth[_0x1e51('0xd')](),controller['removeTags']);module[_0x1e51('0x1d')]=router; \ No newline at end of file +var _0x2547=['/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5821c8,_0x3d83d4){var _0x24718c=function(_0x3f85fc){while(--_0x3f85fc){_0x5821c8['push'](_0x5821c8['shift']());}};_0x24718c(++_0x3d83d4);}(_0x2547,0x1cd));var _0x7254=function(_0x2177c8,_0x1e06be){_0x2177c8=_0x2177c8-0x0;var _0x169301=_0x2547[_0x2177c8];return _0x169301;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x9')](_0x7254('0x11'),auth[_0x7254('0xa')](),controller['download']);router[_0x7254('0x12')]('/',auth['isAuthenticated'](),controller[_0x7254('0x13')]);router['post'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x14')]);router[_0x7254('0x12')](_0x7254('0x15'),auth[_0x7254('0xa')](),interaction[_0x7254('0x16')](_0x7254('0x17'),_0x7254('0x18')),controller[_0x7254('0x19')]);router[_0x7254('0x1a')](_0x7254('0xe'),auth[_0x7254('0xa')](),interaction['tracked'](_0x7254('0x17'),_0x7254('0x1b')),controller[_0x7254('0x1c')]);router[_0x7254('0x1d')](_0x7254('0xe'),auth[_0x7254('0xa')](),interaction[_0x7254('0x16')]('sms',_0x7254('0x1e')),controller[_0x7254('0x1f')]);router[_0x7254('0x1d')](_0x7254('0x15'),auth[_0x7254('0xa')](),controller[_0x7254('0x20')]);module[_0x7254('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index a6615eb..bd307ce 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 _0x22e3=['ENUM','out','BOOLEAN','sequelize','moment','exports','DATE','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22e3,0xf3));var _0x322e=function(_0x186f8f,_0x1a0ebd){_0x186f8f=_0x186f8f-0x0;var _0x1af754=_0x22e3[_0x186f8f];return _0x1af754;};'use strict';var Sequelize=require(_0x322e('0x0'));var moment=require(_0x322e('0x1'));module[_0x322e('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x322e('0x3')]},'disposition':{'type':Sequelize[_0x322e('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x322e('0x4')]},'note':{'type':Sequelize[_0x322e('0x4')]},'phone':{'type':Sequelize[_0x322e('0x4')]},'read1stAt':{'type':Sequelize[_0x322e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x322e('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x322e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x322e('0x5')]('in',_0x322e('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x322e('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x4813=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x1e418c,_0x3cb809){var _0x456465=function(_0x3043d8){while(--_0x3043d8){_0x1e418c['push'](_0x1e418c['shift']());}};_0x456465(++_0x3cb809);}(_0x4813,0x14e));var _0x3481=function(_0x90ae83,_0x3faf05){_0x90ae83=_0x90ae83-0x0;var _0x4fde13=_0x4813[_0x90ae83];return _0x4fde13;};'use strict';var Sequelize=require(_0x3481('0x0'));var moment=require(_0x3481('0x1'));module[_0x3481('0x2')]={'closed':{'type':Sequelize[_0x3481('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3481('0x4')]},'disposition':{'type':Sequelize[_0x3481('0x5')]},'secondDisposition':{'type':Sequelize[_0x3481('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3481('0x5')]},'phone':{'type':Sequelize[_0x3481('0x5')]},'read1stAt':{'type':Sequelize[_0x3481('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x3481('0x6')]('in',_0x3481('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3481('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index e83f01f..92b4ac8 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 _0x33ba=['./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','type','getOptions','findAll','query','user','params','model','keys','SmsInteraction','filters','intersection','fields','attributes','length','includeAll','options','catch','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','nolimit','order','sort','pick','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','format','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','Messages','createdAt','direction','secret','read','SmsAccount','Owner','get','mkdirSync','Account','N.A.','closedAt','disposition','out','fullname','System','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','redis','localhost'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x33ba,0x164));var _0xa33b=function(_0x3b5db5,_0x2ec255){_0x3b5db5=_0x3b5db5-0x0;var _0x227c97=_0x33ba[_0x3b5db5];return _0x227c97;};'use strict';var rimraf=require(_0xa33b('0x0'));var zipdir=require(_0xa33b('0x1'));var moment=require('moment');var BPromise=require(_0xa33b('0x2'));var util=require(_0xa33b('0x3'));var path=require(_0xa33b('0x4'));var ejs=require(_0xa33b('0x5'));var fs=require('fs');var _=require(_0xa33b('0x6'));var Redis=require(_0xa33b('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0xa33b('0x8'));var pdf=require(_0xa33b('0x9'));var logger=require(_0xa33b('0xa'))(_0xa33b('0xb'));var config=require('../../config/environment');var db=require(_0xa33b('0xc'))['db'];config['redis']=_[_0xa33b('0xd')](config[_0xa33b('0xe')],{'host':_0xa33b('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa33b('0xe')]));require(_0xa33b('0x10'))[_0xa33b('0x11')](socket);function respondWithStatusCode(_0x160d8a,_0x2b85bc){_0x2b85bc=_0x2b85bc||0xcc;return function(_0x2e5b6d){if(_0x2e5b6d){return _0x160d8a[_0xa33b('0x12')](_0x2b85bc);}return _0x160d8a[_0xa33b('0x13')](_0x2b85bc)['end']();};}function respondWithResult(_0x28f8b6,_0x28f53d){_0x28f53d=_0x28f53d||0xc8;return function(_0x301727){if(_0x301727){return _0x28f8b6[_0xa33b('0x13')](_0x28f53d)[_0xa33b('0x14')](_0x301727);}};}function respondWithFilteredResult(_0x12f298,_0x53dd2c){return function(_0x569e52){if(_0x569e52){var _0x3a3e5c=typeof _0x53dd2c[_0xa33b('0x15')]===_0xa33b('0x16')&&typeof _0x53dd2c[_0xa33b('0x17')]==='undefined';var _0x598820=_0x569e52['count'];var _0x4dc849=_0x3a3e5c?0x0:_0x53dd2c[_0xa33b('0x15')];var _0x1a3858=_0x3a3e5c?_0x569e52[_0xa33b('0x18')]:_0x53dd2c[_0xa33b('0x15')]+_0x53dd2c['limit'];var _0x54627a;if(_0x1a3858>=_0x598820){_0x1a3858=_0x598820;_0x54627a=0xc8;}else{_0x54627a=0xce;}_0x12f298['status'](_0x54627a);return _0x12f298[_0xa33b('0x19')]('Content-Range',_0x4dc849+'-'+_0x1a3858+'/'+_0x598820)[_0xa33b('0x14')](_0x569e52);}return null;};}function saveUpdates(_0x243e4f){return function(_0x48892a){if(_0x48892a){return _0x48892a[_0xa33b('0x1a')](_0x243e4f)[_0xa33b('0x1b')](function(_0x15ace4){return _0x15ace4;});}return null;};}function removeEntity(_0x1db7c3){return function(_0x1e0049){if(_0x1e0049){return _0x1e0049[_0xa33b('0x1c')]()[_0xa33b('0x1b')](function(){_0x1db7c3[_0xa33b('0x13')](0xcc)[_0xa33b('0x1d')]();});}};}function handleEntityNotFound(_0x113c89){return function(_0x25b7bf){if(!_0x25b7bf){_0x113c89[_0xa33b('0x12')](0x194);}return _0x25b7bf;};}function handleError(_0x592636,_0x4c2599){_0x4c2599=_0x4c2599||0x1f4;return function(_0x13533d){logger[_0xa33b('0x1e')](_0x13533d[_0xa33b('0x1f')]);if(_0x13533d[_0xa33b('0x20')]){delete _0x13533d[_0xa33b('0x20')];}_0x592636[_0xa33b('0x13')](_0x4c2599)['send'](_0x13533d);};}exports['index']=function(_0x21c86b,_0x193fef){var _0x56aff1={};var _0x5dcdf8=_[_0xa33b('0x21')](db['SmsInteraction'][_0xa33b('0x22')],function(_0x185d71){return{'name':_0x185d71[_0xa33b('0x23')],'type':_0x185d71[_0xa33b('0x24')]['key']};});_0x56aff1=qs[_0xa33b('0x25')](_0x5dcdf8,_0x21c86b);return interaction[_0xa33b('0x26')]('sms',_0x21c86b[_0xa33b('0x27')],_0x21c86b[_0xa33b('0x28')],_0x56aff1,_0x5dcdf8)['then'](respondWithFilteredResult(_0x193fef,_0x56aff1))['catch'](handleError(_0x193fef,null));};exports['show']=function(_0x367a1e,_0x4a4f92){var _0x1ef714={'raw':![],'where':{'id':_0x367a1e[_0xa33b('0x29')]['id']}},_0x35a512={};_0x35a512[_0xa33b('0x2a')]=_[_0xa33b('0x2b')](db[_0xa33b('0x2c')][_0xa33b('0x22')]);_0x35a512['query']=_[_0xa33b('0x2b')](_0x367a1e[_0xa33b('0x27')]);_0x35a512[_0xa33b('0x2d')]=_[_0xa33b('0x2e')](_0x35a512[_0xa33b('0x2a')],_0x35a512[_0xa33b('0x27')]);_0x1ef714['attributes']=_[_0xa33b('0x2e')](_0x35a512[_0xa33b('0x2a')],qs['fields'](_0x367a1e['query'][_0xa33b('0x2f')]));_0x1ef714[_0xa33b('0x30')]=_0x1ef714['attributes'][_0xa33b('0x31')]?_0x1ef714['attributes']:_0x35a512[_0xa33b('0x2a')];if(_0x367a1e[_0xa33b('0x27')][_0xa33b('0x32')]){_0x1ef714['include']=[{'all':!![]}];}_0x1ef714=_['merge']({},_0x1ef714,_0x367a1e[_0xa33b('0x33')]);return db['SmsInteraction']['find'](_0x1ef714)['then'](handleEntityNotFound(_0x4a4f92,null))[_0xa33b('0x1b')](respondWithResult(_0x4a4f92,null))[_0xa33b('0x34')](handleError(_0x4a4f92,null));};exports['create']=function(_0x12897c,_0x3c56d2){return db['SmsInteraction'][_0xa33b('0x35')](_0x12897c[_0xa33b('0x36')],{})['then'](respondWithResult(_0x3c56d2,0xc9))[_0xa33b('0x34')](handleError(_0x3c56d2,null));};exports[_0xa33b('0x1a')]=function(_0x4efe27,_0x458f3c){if(_0x4efe27[_0xa33b('0x36')]['id']){delete _0x4efe27[_0xa33b('0x36')]['id'];}return db[_0xa33b('0x2c')][_0xa33b('0x37')]({'where':{'id':_0x4efe27['params']['id']}})[_0xa33b('0x1b')](handleEntityNotFound(_0x458f3c,null))[_0xa33b('0x1b')](saveUpdates(_0x4efe27[_0xa33b('0x36')],null))[_0xa33b('0x1b')](respondWithResult(_0x458f3c,null))['catch'](handleError(_0x458f3c,null));};exports['destroy']=function(_0x334a15,_0x4e828e){return db[_0xa33b('0x2c')][_0xa33b('0x37')]({'where':{'id':_0x334a15['params']['id']}})[_0xa33b('0x1b')](handleEntityNotFound(_0x4e828e,null))[_0xa33b('0x1b')](removeEntity(_0x4e828e,null))['catch'](handleError(_0x4e828e,null));};exports[_0xa33b('0x38')]=function(_0x196d1d,_0x5ab87a){return db[_0xa33b('0x2c')]['describe']()[_0xa33b('0x1b')](respondWithResult(_0x5ab87a,null))['catch'](handleError(_0x5ab87a,null));};exports[_0xa33b('0x39')]=function(_0x1dc91e,_0x192f87){return db['SmsMessage'][_0xa33b('0x37')]({'where':{'id':_0x1dc91e[_0xa33b('0x29')]['id']}})[_0xa33b('0x1b')](handleEntityNotFound(_0x192f87,null))[_0xa33b('0x1b')](function(_0x529b05){if(_0x529b05){return _0x529b05[_0xa33b('0x39')](_0x1dc91e[_0xa33b('0x36')][_0xa33b('0x3a')],_[_0xa33b('0x3b')](_0x1dc91e[_0xa33b('0x36')],[_0xa33b('0x3a'),'id'])||{});}})[_0xa33b('0x1b')](respondWithResult(_0x192f87,null))[_0xa33b('0x34')](handleError(_0x192f87,null));};exports[_0xa33b('0x3c')]=function(_0x292a80,_0x42b03f){var _0x6d5ff4={'raw':![],'where':{}};var _0x141654={};var _0x5daf38={'count':0x0,'rows':[]};return db[_0xa33b('0x2c')][_0xa33b('0x3d')]({'where':{'id':_0x292a80['params']['id']}})[_0xa33b('0x1b')](handleEntityNotFound(_0x42b03f,null))[_0xa33b('0x1b')](function(_0x16736b){if(_0x16736b){_0x141654['model']=_[_0xa33b('0x2b')](db[_0xa33b('0x3e')][_0xa33b('0x22')]);_0x141654[_0xa33b('0x27')]=_[_0xa33b('0x2b')](_0x292a80['query']);_0x141654[_0xa33b('0x2d')]=_[_0xa33b('0x2e')](_0x141654['model'],_0x141654[_0xa33b('0x27')]);_0x6d5ff4[_0xa33b('0x30')]=_[_0xa33b('0x2e')](_0x141654['model'],qs['fields'](_0x292a80[_0xa33b('0x27')]['fields']));_0x6d5ff4[_0xa33b('0x30')]=_0x6d5ff4[_0xa33b('0x30')][_0xa33b('0x31')]?_0x6d5ff4[_0xa33b('0x30')]:_0x141654[_0xa33b('0x2a')];if(!_0x292a80[_0xa33b('0x27')][_0xa33b('0x3f')](_0xa33b('0x40'))){_0x6d5ff4[_0xa33b('0x17')]=qs['limit'](_0x292a80['query'][_0xa33b('0x17')]);_0x6d5ff4[_0xa33b('0x15')]=qs['offset'](_0x292a80[_0xa33b('0x27')][_0xa33b('0x15')]);}_0x6d5ff4[_0xa33b('0x41')]=qs[_0xa33b('0x42')](_0x292a80[_0xa33b('0x27')][_0xa33b('0x42')]);_0x6d5ff4['where']=qs['filters'](_[_0xa33b('0x43')](_0x292a80['query'],_0x141654['filters']));_0x6d5ff4[_0xa33b('0x44')]['SmsInteractionId']=_0x16736b['id'];if(_0x292a80[_0xa33b('0x27')][_0xa33b('0x45')]){_0x6d5ff4[_0xa33b('0x44')]=_['merge'](_0x6d5ff4[_0xa33b('0x44')],{'$or':_[_0xa33b('0x21')](_0x6d5ff4['attributes'],function(_0x3ba97e){var _0x3da55e={};_0x3da55e[_0x3ba97e]={'$like':'%'+_0x292a80[_0xa33b('0x27')][_0xa33b('0x45')]+'%'};return _0x3da55e;})});}if(_0x292a80[_0xa33b('0x27')][_0xa33b('0x46')]){var _0x246d83=_0x292a80['query'][_0xa33b('0x46')][_0xa33b('0x47')](',');var _0x36eb86={};_0x36eb86[_0x246d83[0x0]]={'$gte':moment(_0x246d83[0x1])['format'](_0xa33b('0x48'))};_0x6d5ff4[_0xa33b('0x44')]=_[_0xa33b('0x49')](_0x6d5ff4[_0xa33b('0x44')],_0x36eb86);}_0x6d5ff4=_[_0xa33b('0x49')]({},_0x6d5ff4,_0x292a80[_0xa33b('0x33')]);return db['SmsMessage'][_0xa33b('0x18')]({'where':_0x6d5ff4[_0xa33b('0x44')]})['then'](function(_0x36a140){_0x5daf38['count']=_0x36a140;if(_0x292a80['query']['includeAll']){_0x6d5ff4['include']=[{'all':!![]}];}return db['SmsMessage'][_0xa33b('0x26')](_0x6d5ff4);})[_0xa33b('0x1b')](function(_0x5ca3af){_0x5daf38[_0xa33b('0x4a')]=_0x5ca3af;return _0x5daf38;});}})['then'](respondWithFilteredResult(_0x42b03f,_0x6d5ff4))[_0xa33b('0x34')](handleError(_0x42b03f,null));};exports[_0xa33b('0x4b')]=function(_0x579e8f,_0x33c9a8){return db[_0xa33b('0x2c')][_0xa33b('0x37')]({'where':{'id':_0x579e8f[_0xa33b('0x29')]['id']}})[_0xa33b('0x1b')](handleEntityNotFound(_0x33c9a8,null))['then'](function(_0x790d81){if(_0x790d81){return _0x790d81[_0xa33b('0x4c')](_0x579e8f['body'][_0xa33b('0x3a')],_['omit'](_0x579e8f['body'],[_0xa33b('0x3a'),'id'])||{})[_0xa33b('0x4d')](function(){return db[_0xa33b('0x4e')][_0xa33b('0x26')]({'attributes':['id',_0xa33b('0x20'),'color'],'where':{'id':_0x579e8f['body'][_0xa33b('0x3a')]}});})[_0xa33b('0x1b')](function(_0x48ffb1){socket[_0xa33b('0x4f')](_0xa33b('0x50'),{'id':Number(_0x579e8f[_0xa33b('0x29')]['id']),'tags':_0x48ffb1||[]});return{'id':Number(_0x579e8f[_0xa33b('0x29')]['id']),'tags':_0x48ffb1||[]};});}})[_0xa33b('0x1b')](respondWithResult(_0x33c9a8,null))[_0xa33b('0x34')](handleError(_0x33c9a8,null));};exports['removeTags']=function(_0xe20693,_0x198977){return db[_0xa33b('0x2c')]['find']({'where':{'id':_0xe20693[_0xa33b('0x29')]['id']}})[_0xa33b('0x1b')](handleEntityNotFound(_0x198977,null))[_0xa33b('0x1b')](function(_0x4fe900){if(_0x4fe900){return _0x4fe900[_0xa33b('0x51')](_0xe20693[_0xa33b('0x27')][_0xa33b('0x3a')]);}})[_0xa33b('0x1b')](respondWithStatusCode(_0x198977,null))[_0xa33b('0x34')](handleError(_0x198977,null));};exports[_0xa33b('0x52')]=function(_0x2966f1,_0xfa5e98){var _0x40fd39=moment()[_0xa33b('0x53')]()[_0xa33b('0x54')]();var _0x29bc59=path[_0xa33b('0x55')](config[_0xa33b('0x56')],_0xa33b('0x57'),_0xa33b('0x58'),_0xa33b('0x59'));var _0x216904=path[_0xa33b('0x55')](_0x29bc59,_0x40fd39);var _0x8bb3a3=util[_0xa33b('0x5a')](_0xa33b('0x5b'),_0x2966f1['params']['id'],_0x40fd39);var _0x310ab9=path['join'](_0x29bc59,_0x8bb3a3);var _0x2a8b5=[];_0x2a8b5[_0xa33b('0x5c')]({'model':db[_0xa33b('0x5d')],'as':_0xa33b('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x2a8b5['push']({'model':db[_0xa33b('0x5e')],'as':_0xa33b('0x5f'),'attributes':['id',_0xa33b('0x60'),'lastName'],'raw':!![]});var _0x367886=[{'model':db[_0xa33b('0x3e')],'as':_0xa33b('0x61'),'attributes':['id',_0xa33b('0x36'),_0xa33b('0x62'),_0xa33b('0x63'),_0xa33b('0x64'),_0xa33b('0x65')],'include':_0x2a8b5}];_0x367886[_0xa33b('0x5c')]({'model':db[_0xa33b('0x66')],'as':'Account','attributes':['id',_0xa33b('0x20')]});_0x367886[_0xa33b('0x5c')]({'model':db['User'],'as':_0xa33b('0x67'),'attributes':['id','fullname']});return db[_0xa33b('0x2c')][_0xa33b('0x37')]({'where':{'id':_0x2966f1['params']['id']},'include':_0x367886})[_0xa33b('0x1b')](handleEntityNotFound(_0xfa5e98,null))['then'](function(_0xdb059d){if(_0xdb059d){var _0x57072e=_0xdb059d[_0xa33b('0x68')]({'plain':!![]});fs[_0xa33b('0x69')](_0x216904);var _0x3b3657={'channel':'Sms','account':_0x57072e[_0xa33b('0x6a')]['name'],'agent':_0x57072e[_0xa33b('0x67')]?_0x57072e[_0xa33b('0x67')]['fullname']:_0xa33b('0x6b'),'createdAt':moment(_0x57072e[_0xa33b('0x62')])[_0xa33b('0x5a')](_0xa33b('0x48'))[_0xa33b('0x54')](),'closedAt':_0x57072e['closed']?moment(_0x57072e[_0xa33b('0x6c')])['format'](_0xa33b('0x48'))[_0xa33b('0x54')]():'','disposition':_0x57072e[_0xa33b('0x6d')],'messages':_(_0x57072e[_0xa33b('0x61')])[_0xa33b('0x45')]({'secret':![]})[_0xa33b('0x21')](function(_0x42539d){return{'date':moment(_0x42539d[_0xa33b('0x62')])[_0xa33b('0x5a')](_0xa33b('0x48'))[_0xa33b('0x54')](),'sender':_0x42539d[_0xa33b('0x63')]===_0xa33b('0x6e')?_0x42539d[_0xa33b('0x5d')]?_0x42539d[_0xa33b('0x5d')][_0xa33b('0x6f')]:_0xa33b('0x70'):_0x42539d[_0xa33b('0x5f')]['firstName']+(_0x42539d[_0xa33b('0x5f')][_0xa33b('0x71')]?'\x20'+_0x42539d[_0xa33b('0x5f')]['lastName']:''),'body':_0x42539d[_0xa33b('0x36')],'direction':_0x42539d[_0xa33b('0x63')]===_0xa33b('0x6e')?'A':'C','secret':_0x42539d['secret'],'read':_0x42539d[_0xa33b('0x65')]};})[_0xa33b('0x72')]()};return ejs[_0xa33b('0x73')](path[_0xa33b('0x55')](config['root'],'server',_0xa33b('0x74'),_0xa33b('0x75')),{'interaction':_0x3b3657})[_0xa33b('0x1b')](function(_0x1bf7c7){var _0x10130d=path[_0xa33b('0x55')](_0x216904,_0xa33b('0x76')+_0x57072e['id']+'-'+_0x40fd39+'.pdf');var _0x5bc9c4={'path':_0x10130d,'channel':_0xa33b('0x77'),'interactionId':_0x57072e['id']};return pdf[_0xa33b('0x78')](_0x1bf7c7,_0x5bc9c4);})[_0xa33b('0x1b')](function(){return new BPromise(function(_0x5e0f91,_0x4ac971){zipdir(_0x216904,{'saveTo':_0x310ab9},function(_0x1a1388,_0x4838fa){if(_0x1a1388)return _0x4ac971(_0x1a1388);return _0x5e0f91(_0x4838fa);});})[_0xa33b('0x1b')](function(){return new BPromise(function(_0x42d5db,_0x367407){rimraf(_0x216904,function(_0x28b298){if(_0x28b298)_0x367407(_0x28b298);return _0x42d5db();});});})['then'](function(){return _0xfa5e98[_0xa33b('0x52')](_0x310ab9,_0x8bb3a3,function(_0x5bbfe4){if(_0x5bbfe4){console[_0xa33b('0x79')](_0xa33b('0x7a'),_0x5bbfe4);}else{fs[_0xa33b('0x7b')](_0x310ab9);}});});});}else{return _0xfa5e98[_0xa33b('0x12')](0xc8);}})['catch'](handleError(_0xfa5e98,null));}; \ No newline at end of file +var _0x12cb=['body','describe','addMessage','SmsMessage','ids','omit','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsInteractionId','filter','where','$gte','split','format','options','count','includeAll','rows','addTags','setTags','Tag','color','emit','smsInteractionTags:save','removeTags','find','unix','toString','server','files','tmp','transcript-%d-%s.zip','join','push','User','fullname','CmContact','Contact','firstName','lastName','createdAt','direction','secret','read','get','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','out','value','renderFile','root','views','downloadInteraction.ejs','transcript-','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','update','then','destroy','error','stack','name','index','map','fieldName','type','key','findAll','sms','query','catch','params','keys','SmsInteraction','filters','intersection','attributes','model','fields','length','merge'];(function(_0x44e827,_0x145ed8){var _0xa19d97=function(_0x3a1176){while(--_0x3a1176){_0x44e827['push'](_0x44e827['shift']());}};_0xa19d97(++_0x145ed8);}(_0x12cb,0xb9));var _0xb12c=function(_0x3b83b7,_0x1214a3){_0x3b83b7=_0x3b83b7-0x0;var _0x2d7d1f=_0x12cb[_0x3b83b7];return _0x2d7d1f;};'use strict';var rimraf=require(_0xb12c('0x0'));var zipdir=require(_0xb12c('0x1'));var moment=require(_0xb12c('0x2'));var BPromise=require(_0xb12c('0x3'));var util=require(_0xb12c('0x4'));var path=require(_0xb12c('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb12c('0x6'));var Redis=require('ioredis');var interaction=require(_0xb12c('0x7'));var qs=require(_0xb12c('0x8'));var pdf=require(_0xb12c('0x9'));var logger=require(_0xb12c('0xa'))(_0xb12c('0xb'));var config=require(_0xb12c('0xc'));var db=require('../../mysqldb')['db'];config[_0xb12c('0xd')]=_[_0xb12c('0xe')](config[_0xb12c('0xd')],{'host':_0xb12c('0xf'),'port':0x18eb});var socket=require(_0xb12c('0x10'))(new Redis(config[_0xb12c('0xd')]));require(_0xb12c('0x11'))[_0xb12c('0x12')](socket);function respondWithStatusCode(_0xf76df4,_0x1db74d){_0x1db74d=_0x1db74d||0xcc;return function(_0x5da7d1){if(_0x5da7d1){return _0xf76df4[_0xb12c('0x13')](_0x1db74d);}return _0xf76df4['status'](_0x1db74d)[_0xb12c('0x14')]();};}function respondWithResult(_0x8b7919,_0x90440a){_0x90440a=_0x90440a||0xc8;return function(_0x3fe6af){if(_0x3fe6af){return _0x8b7919[_0xb12c('0x15')](_0x90440a)[_0xb12c('0x16')](_0x3fe6af);}};}function respondWithFilteredResult(_0x933577,_0x382411){return function(_0x1bb3ad){if(_0x1bb3ad){var _0x4ee77f=typeof _0x382411[_0xb12c('0x17')]==='undefined'&&typeof _0x382411[_0xb12c('0x18')]===_0xb12c('0x19');var _0x364132=_0x1bb3ad['count'];var _0x2a8d54=_0x4ee77f?0x0:_0x382411['offset'];var _0x2a22cf=_0x4ee77f?_0x1bb3ad['count']:_0x382411[_0xb12c('0x17')]+_0x382411[_0xb12c('0x18')];var _0x1de6e9;if(_0x2a22cf>=_0x364132){_0x2a22cf=_0x364132;_0x1de6e9=0xc8;}else{_0x1de6e9=0xce;}_0x933577['status'](_0x1de6e9);return _0x933577[_0xb12c('0x1a')](_0xb12c('0x1b'),_0x2a8d54+'-'+_0x2a22cf+'/'+_0x364132)[_0xb12c('0x16')](_0x1bb3ad);}return null;};}function saveUpdates(_0x878a09){return function(_0x144c28){if(_0x144c28){return _0x144c28[_0xb12c('0x1c')](_0x878a09)[_0xb12c('0x1d')](function(_0x105b5d){return _0x105b5d;});}return null;};}function removeEntity(_0x2f8224){return function(_0x9126a3){if(_0x9126a3){return _0x9126a3[_0xb12c('0x1e')]()[_0xb12c('0x1d')](function(){_0x2f8224['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14db6f){return function(_0x4f35af){if(!_0x4f35af){_0x14db6f[_0xb12c('0x13')](0x194);}return _0x4f35af;};}function handleError(_0x461fb3,_0x308aa8){_0x308aa8=_0x308aa8||0x1f4;return function(_0xc81f1a){logger[_0xb12c('0x1f')](_0xc81f1a[_0xb12c('0x20')]);if(_0xc81f1a[_0xb12c('0x21')]){delete _0xc81f1a[_0xb12c('0x21')];}_0x461fb3['status'](_0x308aa8)['send'](_0xc81f1a);};}exports[_0xb12c('0x22')]=function(_0x5af27d,_0x38c997){var _0x5e70c9={};var _0x3cf42e=_[_0xb12c('0x23')](db['SmsInteraction']['rawAttributes'],function(_0x321c71){return{'name':_0x321c71[_0xb12c('0x24')],'type':_0x321c71[_0xb12c('0x25')][_0xb12c('0x26')]};});_0x5e70c9=qs['getOptions'](_0x3cf42e,_0x5af27d);return interaction[_0xb12c('0x27')](_0xb12c('0x28'),_0x5af27d[_0xb12c('0x29')],_0x5af27d['user'],_0x5e70c9,_0x3cf42e)[_0xb12c('0x1d')](respondWithFilteredResult(_0x38c997,_0x5e70c9))[_0xb12c('0x2a')](handleError(_0x38c997,null));};exports['show']=function(_0x1ccd5a,_0x3c2621){var _0x58cd02={'raw':![],'where':{'id':_0x1ccd5a[_0xb12c('0x2b')]['id']}},_0x5ec83d={};_0x5ec83d['model']=_[_0xb12c('0x2c')](db[_0xb12c('0x2d')]['rawAttributes']);_0x5ec83d[_0xb12c('0x29')]=_[_0xb12c('0x2c')](_0x1ccd5a['query']);_0x5ec83d[_0xb12c('0x2e')]=_[_0xb12c('0x2f')](_0x5ec83d['model'],_0x5ec83d[_0xb12c('0x29')]);_0x58cd02[_0xb12c('0x30')]=_['intersection'](_0x5ec83d[_0xb12c('0x31')],qs[_0xb12c('0x32')](_0x1ccd5a['query']['fields']));_0x58cd02[_0xb12c('0x30')]=_0x58cd02[_0xb12c('0x30')][_0xb12c('0x33')]?_0x58cd02[_0xb12c('0x30')]:_0x5ec83d[_0xb12c('0x31')];if(_0x1ccd5a[_0xb12c('0x29')]['includeAll']){_0x58cd02['include']=[{'all':!![]}];}_0x58cd02=_[_0xb12c('0x34')]({},_0x58cd02,_0x1ccd5a['options']);return db[_0xb12c('0x2d')]['find'](_0x58cd02)[_0xb12c('0x1d')](handleEntityNotFound(_0x3c2621,null))[_0xb12c('0x1d')](respondWithResult(_0x3c2621,null))[_0xb12c('0x2a')](handleError(_0x3c2621,null));};exports['create']=function(_0x8d417c,_0x311277){return db[_0xb12c('0x2d')]['create'](_0x8d417c[_0xb12c('0x35')],{})[_0xb12c('0x1d')](respondWithResult(_0x311277,0xc9))['catch'](handleError(_0x311277,null));};exports[_0xb12c('0x1c')]=function(_0x5ab16b,_0x3162e8){if(_0x5ab16b[_0xb12c('0x35')]['id']){delete _0x5ab16b[_0xb12c('0x35')]['id'];}return db[_0xb12c('0x2d')]['find']({'where':{'id':_0x5ab16b['params']['id']}})[_0xb12c('0x1d')](handleEntityNotFound(_0x3162e8,null))[_0xb12c('0x1d')](saveUpdates(_0x5ab16b[_0xb12c('0x35')],null))['then'](respondWithResult(_0x3162e8,null))[_0xb12c('0x2a')](handleError(_0x3162e8,null));};exports['destroy']=function(_0x613b47,_0x384a1a){return db[_0xb12c('0x2d')]['find']({'where':{'id':_0x613b47[_0xb12c('0x2b')]['id']}})[_0xb12c('0x1d')](handleEntityNotFound(_0x384a1a,null))['then'](removeEntity(_0x384a1a,null))['catch'](handleError(_0x384a1a,null));};exports['describe']=function(_0x7ff6a9,_0x280900){return db[_0xb12c('0x2d')][_0xb12c('0x36')]()[_0xb12c('0x1d')](respondWithResult(_0x280900,null))[_0xb12c('0x2a')](handleError(_0x280900,null));};exports[_0xb12c('0x37')]=function(_0x521a14,_0x5cfa22){return db[_0xb12c('0x38')]['find']({'where':{'id':_0x521a14['params']['id']}})[_0xb12c('0x1d')](handleEntityNotFound(_0x5cfa22,null))[_0xb12c('0x1d')](function(_0x501a0c){if(_0x501a0c){return _0x501a0c[_0xb12c('0x37')](_0x521a14['body'][_0xb12c('0x39')],_[_0xb12c('0x3a')](_0x521a14['body'],['ids','id'])||{});}})[_0xb12c('0x1d')](respondWithResult(_0x5cfa22,null))[_0xb12c('0x2a')](handleError(_0x5cfa22,null));};exports['getMessages']=function(_0x2ca378,_0x235480){var _0x355d0a={'raw':![],'where':{}};var _0x342552={};var _0x455b59={'count':0x0,'rows':[]};return db[_0xb12c('0x2d')]['findOne']({'where':{'id':_0x2ca378['params']['id']}})['then'](handleEntityNotFound(_0x235480,null))[_0xb12c('0x1d')](function(_0x1db4d5){if(_0x1db4d5){_0x342552['model']=_[_0xb12c('0x2c')](db[_0xb12c('0x38')][_0xb12c('0x3b')]);_0x342552[_0xb12c('0x29')]=_['keys'](_0x2ca378[_0xb12c('0x29')]);_0x342552[_0xb12c('0x2e')]=_[_0xb12c('0x2f')](_0x342552[_0xb12c('0x31')],_0x342552['query']);_0x355d0a['attributes']=_[_0xb12c('0x2f')](_0x342552[_0xb12c('0x31')],qs[_0xb12c('0x32')](_0x2ca378[_0xb12c('0x29')][_0xb12c('0x32')]));_0x355d0a[_0xb12c('0x30')]=_0x355d0a['attributes'][_0xb12c('0x33')]?_0x355d0a[_0xb12c('0x30')]:_0x342552[_0xb12c('0x31')];if(!_0x2ca378[_0xb12c('0x29')][_0xb12c('0x3c')](_0xb12c('0x3d'))){_0x355d0a[_0xb12c('0x18')]=qs[_0xb12c('0x18')](_0x2ca378[_0xb12c('0x29')][_0xb12c('0x18')]);_0x355d0a[_0xb12c('0x17')]=qs['offset'](_0x2ca378[_0xb12c('0x29')][_0xb12c('0x17')]);}_0x355d0a[_0xb12c('0x3e')]=qs['sort'](_0x2ca378[_0xb12c('0x29')][_0xb12c('0x3f')]);_0x355d0a['where']=qs['filters'](_['pick'](_0x2ca378[_0xb12c('0x29')],_0x342552[_0xb12c('0x2e')]));_0x355d0a['where'][_0xb12c('0x40')]=_0x1db4d5['id'];if(_0x2ca378[_0xb12c('0x29')][_0xb12c('0x41')]){_0x355d0a[_0xb12c('0x42')]=_[_0xb12c('0x34')](_0x355d0a[_0xb12c('0x42')],{'$or':_[_0xb12c('0x23')](_0x355d0a[_0xb12c('0x30')],function(_0x500725){var _0x5db6ba={};_0x5db6ba[_0x500725]={'$like':'%'+_0x2ca378[_0xb12c('0x29')][_0xb12c('0x41')]+'%'};return _0x5db6ba;})});}if(_0x2ca378['query'][_0xb12c('0x43')]){var _0x5d3df4=_0x2ca378['query'][_0xb12c('0x43')][_0xb12c('0x44')](',');var _0x57b43b={};_0x57b43b[_0x5d3df4[0x0]]={'$gte':moment(_0x5d3df4[0x1])[_0xb12c('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x355d0a[_0xb12c('0x42')]=_[_0xb12c('0x34')](_0x355d0a['where'],_0x57b43b);}_0x355d0a=_['merge']({},_0x355d0a,_0x2ca378[_0xb12c('0x46')]);return db[_0xb12c('0x38')][_0xb12c('0x47')]({'where':_0x355d0a[_0xb12c('0x42')]})[_0xb12c('0x1d')](function(_0x3a609b){_0x455b59[_0xb12c('0x47')]=_0x3a609b;if(_0x2ca378[_0xb12c('0x29')][_0xb12c('0x48')]){_0x355d0a['include']=[{'all':!![]}];}return db[_0xb12c('0x38')][_0xb12c('0x27')](_0x355d0a);})[_0xb12c('0x1d')](function(_0x13d0ce){_0x455b59[_0xb12c('0x49')]=_0x13d0ce;return _0x455b59;});}})['then'](respondWithFilteredResult(_0x235480,_0x355d0a))[_0xb12c('0x2a')](handleError(_0x235480,null));};exports[_0xb12c('0x4a')]=function(_0x436903,_0x709632){return db[_0xb12c('0x2d')]['find']({'where':{'id':_0x436903[_0xb12c('0x2b')]['id']}})[_0xb12c('0x1d')](handleEntityNotFound(_0x709632,null))[_0xb12c('0x1d')](function(_0x2c0445){if(_0x2c0445){return _0x2c0445[_0xb12c('0x4b')](_0x436903[_0xb12c('0x35')][_0xb12c('0x39')],_[_0xb12c('0x3a')](_0x436903[_0xb12c('0x35')],[_0xb12c('0x39'),'id'])||{})['spread'](function(){return db[_0xb12c('0x4c')][_0xb12c('0x27')]({'attributes':['id',_0xb12c('0x21'),_0xb12c('0x4d')],'where':{'id':_0x436903[_0xb12c('0x35')]['ids']}});})[_0xb12c('0x1d')](function(_0x1b4222){socket[_0xb12c('0x4e')](_0xb12c('0x4f'),{'id':Number(_0x436903[_0xb12c('0x2b')]['id']),'tags':_0x1b4222||[]});return{'id':Number(_0x436903[_0xb12c('0x2b')]['id']),'tags':_0x1b4222||[]};});}})['then'](respondWithResult(_0x709632,null))['catch'](handleError(_0x709632,null));};exports[_0xb12c('0x50')]=function(_0x600fa0,_0x24d910){return db['SmsInteraction'][_0xb12c('0x51')]({'where':{'id':_0x600fa0[_0xb12c('0x2b')]['id']}})[_0xb12c('0x1d')](handleEntityNotFound(_0x24d910,null))['then'](function(_0x60e601){if(_0x60e601){return _0x60e601[_0xb12c('0x50')](_0x600fa0[_0xb12c('0x29')][_0xb12c('0x39')]);}})['then'](respondWithStatusCode(_0x24d910,null))[_0xb12c('0x2a')](handleError(_0x24d910,null));};exports['download']=function(_0x135a93,_0x3987e3){var _0x31ac43=moment()[_0xb12c('0x52')]()[_0xb12c('0x53')]();var _0x167d9e=path['join'](config['root'],_0xb12c('0x54'),_0xb12c('0x55'),_0xb12c('0x56'));var _0x23edb5=path['join'](_0x167d9e,_0x31ac43);var _0x2beec8=util['format'](_0xb12c('0x57'),_0x135a93['params']['id'],_0x31ac43);var _0x4052b6=path[_0xb12c('0x58')](_0x167d9e,_0x2beec8);var _0x26ff85=[];_0x26ff85[_0xb12c('0x59')]({'model':db[_0xb12c('0x5a')],'as':_0xb12c('0x5a'),'attributes':['id',_0xb12c('0x5b')],'raw':!![]});_0x26ff85[_0xb12c('0x59')]({'model':db[_0xb12c('0x5c')],'as':_0xb12c('0x5d'),'attributes':['id',_0xb12c('0x5e'),_0xb12c('0x5f')],'raw':!![]});var _0x160852=[{'model':db[_0xb12c('0x38')],'as':'Messages','attributes':['id','body',_0xb12c('0x60'),_0xb12c('0x61'),_0xb12c('0x62'),_0xb12c('0x63')],'include':_0x26ff85}];_0x160852['push']({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0xb12c('0x21')]});_0x160852[_0xb12c('0x59')]({'model':db[_0xb12c('0x5a')],'as':'Owner','attributes':['id',_0xb12c('0x5b')]});return db['SmsInteraction'][_0xb12c('0x51')]({'where':{'id':_0x135a93[_0xb12c('0x2b')]['id']},'include':_0x160852})[_0xb12c('0x1d')](handleEntityNotFound(_0x3987e3,null))[_0xb12c('0x1d')](function(_0x431090){if(_0x431090){var _0x197c81=_0x431090[_0xb12c('0x64')]({'plain':!![]});fs['mkdirSync'](_0x23edb5);var _0x3644c0={'channel':'Sms','account':_0x197c81['Account'][_0xb12c('0x21')],'agent':_0x197c81[_0xb12c('0x65')]?_0x197c81['Owner'][_0xb12c('0x5b')]:_0xb12c('0x66'),'createdAt':moment(_0x197c81[_0xb12c('0x60')])[_0xb12c('0x45')](_0xb12c('0x67'))[_0xb12c('0x53')](),'closedAt':_0x197c81[_0xb12c('0x68')]?moment(_0x197c81[_0xb12c('0x69')])['format'](_0xb12c('0x67'))[_0xb12c('0x53')]():'','disposition':_0x197c81[_0xb12c('0x6a')],'messages':_(_0x197c81['Messages'])['filter']({'secret':![]})['map'](function(_0x2d9de5){return{'date':moment(_0x2d9de5[_0xb12c('0x60')])['format'](_0xb12c('0x67'))[_0xb12c('0x53')](),'sender':_0x2d9de5[_0xb12c('0x61')]===_0xb12c('0x6b')?_0x2d9de5[_0xb12c('0x5a')]?_0x2d9de5['User']['fullname']:'System':_0x2d9de5['Contact'][_0xb12c('0x5e')]+(_0x2d9de5[_0xb12c('0x5d')][_0xb12c('0x5f')]?'\x20'+_0x2d9de5[_0xb12c('0x5d')][_0xb12c('0x5f')]:''),'body':_0x2d9de5[_0xb12c('0x35')],'direction':_0x2d9de5['direction']===_0xb12c('0x6b')?'A':'C','secret':_0x2d9de5[_0xb12c('0x62')],'read':_0x2d9de5['read']};})[_0xb12c('0x6c')]()};return ejs[_0xb12c('0x6d')](path['join'](config[_0xb12c('0x6e')],_0xb12c('0x54'),_0xb12c('0x6f'),_0xb12c('0x70')),{'interaction':_0x3644c0})[_0xb12c('0x1d')](function(_0x207823){var _0x59a474=path[_0xb12c('0x58')](_0x23edb5,_0xb12c('0x71')+_0x197c81['id']+'-'+_0x31ac43+'.pdf');var _0x1a0d24={'path':_0x59a474,'channel':_0xb12c('0x72'),'interactionId':_0x197c81['id']};return pdf[_0xb12c('0x73')](_0x207823,_0x1a0d24);})[_0xb12c('0x1d')](function(){return new BPromise(function(_0x1ead13,_0x5e5ff8){zipdir(_0x23edb5,{'saveTo':_0x4052b6},function(_0x308909,_0xf265ef){if(_0x308909)return _0x5e5ff8(_0x308909);return _0x1ead13(_0xf265ef);});})['then'](function(){return new BPromise(function(_0x281eb3,_0x26a00e){rimraf(_0x23edb5,function(_0xf184e3){if(_0xf184e3)_0x26a00e(_0xf184e3);return _0x281eb3();});});})[_0xb12c('0x1d')](function(){return _0x3987e3['download'](_0x4052b6,_0x2beec8,function(_0xa16152){if(_0xa16152){console[_0xb12c('0x74')](_0xb12c('0x75'),_0xa16152);}else{fs[_0xb12c('0x76')](_0x4052b6);}});});});}else{return _0x3987e3[_0xb12c('0x13')](0xc8);}})[_0xb12c('0x2a')](handleError(_0x3987e3,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 72483e8..79d1f12 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 _0x0598=['catch','hasOwnProperty','events','../../mysqldb','save','update','setDataValue','Users','map','then','unreadMessages','length'];(function(_0x39f3ed,_0x48bc5e){var _0x3b1802=function(_0x3ca4aa){while(--_0x3ca4aa){_0x39f3ed['push'](_0x39f3ed['shift']());}};_0x3b1802(++_0x48bc5e);}(_0x0598,0x92));var _0x8059=function(_0x4f9124,_0x3ef0f7){_0x4f9124=_0x4f9124-0x0;var _0x518f7c=_0x0598[_0x4f9124];return _0x518f7c;};'use strict';var EventEmitter=require(_0x8059('0x0'));var SmsInteraction=require(_0x8059('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x8059('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8059('0x2'),'afterUpdate':_0x8059('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54f42f){return function(_0x555fb5,_0x467206,_0xa7d7c1){_0x555fb5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x248273){_0x555fb5[_0x8059('0x4')](_0x8059('0x5'),_0x248273[_0x8059('0x6')](function(_0x5df268){return{'id':_0x5df268['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x555fb5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8059('0x7')](function(_0x1bf5fd){_0x555fb5[_0x8059('0x4')](_0x8059('0x8'),_0x1bf5fd[_0x8059('0x9')]);SmsInteractionEvents['emit'](_0x54f42f+':'+_0x555fb5['id'],_0x555fb5);SmsInteractionEvents['emit'](_0x54f42f,_0x555fb5);_0xa7d7c1(null);})[_0x8059('0xa')](_0xa7d7c1(null));};}for(var e in events){if(events[_0x8059('0xb')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x5fdc=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','map'];(function(_0x5627ac,_0x487bbb){var _0x2748b9=function(_0x5843f4){while(--_0x5843f4){_0x5627ac['push'](_0x5627ac['shift']());}};_0x2748b9(++_0x487bbb);}(_0x5fdc,0x127));var _0xc5fd=function(_0x233708,_0x1e5461){_0x233708=_0x233708-0x0;var _0x111a6c=_0x5fdc[_0x233708];return _0x111a6c;};'use strict';var EventEmitter=require(_0xc5fd('0x0'));var SmsInteraction=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x2')];var SmsMessage=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5fd('0x4')](0x0);var events={'afterCreate':_0xc5fd('0x5'),'afterUpdate':_0xc5fd('0x6'),'afterDestroy':_0xc5fd('0x7')};function emitEvent(_0x1b6205){return function(_0xca27a0,_0xea5748,_0x44722b){_0xca27a0[_0xc5fd('0x8')]({'attributes':['id'],'raw':!![]})[_0xc5fd('0x9')](function(_0x5a2eb4){_0xca27a0['setDataValue']('Users',_0x5a2eb4[_0xc5fd('0xa')](function(_0x46bce3){return{'id':_0x46bce3['id']};}));return SmsMessage[_0xc5fd('0xb')]({'where':{'SmsInteractionId':_0xca27a0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5fd('0x9')](function(_0x4e6d35){_0xca27a0['setDataValue'](_0xc5fd('0xc'),_0x4e6d35[_0xc5fd('0xd')]);SmsInteractionEvents[_0xc5fd('0xe')](_0x1b6205+':'+_0xca27a0['id'],_0xca27a0);SmsInteractionEvents[_0xc5fd('0xe')](_0x1b6205,_0xca27a0);_0x44722b(null);})[_0xc5fd('0xf')](_0x44722b(null));};}for(var e in events){if(events[_0xc5fd('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc5fd('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 e491ccf..fde5b5b 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 _0x3f0d=['request-promise','path','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1838e1,_0x791615){var _0x49a5bb=function(_0x27a669){while(--_0x27a669){_0x1838e1['push'](_0x1838e1['shift']());}};_0x49a5bb(++_0x791615);}(_0x3f0d,0xe8));var _0xd3f0=function(_0x3613d5,_0x3dd247){_0x3613d5=_0x3613d5-0x0;var _0x2d9874=_0x3f0d[_0x3613d5];return _0x2d9874;};'use strict';var _=require(_0xd3f0('0x0'));var util=require(_0xd3f0('0x1'));var logger=require(_0xd3f0('0x2'))(_0xd3f0('0x3'));var moment=require(_0xd3f0('0x4'));var BPromise=require(_0xd3f0('0x5'));var rp=require(_0xd3f0('0x6'));var fs=require('fs');var path=require(_0xd3f0('0x7'));var rimraf=require('rimraf');var config=require(_0xd3f0('0x8'));var attributes=require(_0xd3f0('0x9'));module[_0xd3f0('0xa')]=function(_0x5c4eaf,_0x4de23e){return _0x5c4eaf[_0xd3f0('0xb')](_0xd3f0('0xc'),attributes,{'tableName':_0xd3f0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fc653,_0x586989,_0xd0e1b5){if(_0x2fc653[_0xd3f0('0xe')]('closed')){_0x2fc653[_0xd3f0('0xf')]=moment()[_0xd3f0('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0xd0e1b5(null,_0x2fc653);}}});}; \ No newline at end of file +var _0x9486=['../../config/logger','moment','bluebird','request-promise','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x3da8e3,_0x5785ba){var _0x5ce634=function(_0x48027e){while(--_0x48027e){_0x3da8e3['push'](_0x3da8e3['shift']());}};_0x5ce634(++_0x5785ba);}(_0x9486,0xca));var _0x6948=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9486[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x6948('0x0'));var util=require(_0x6948('0x1'));var logger=require(_0x6948('0x2'))('api');var moment=require(_0x6948('0x3'));var BPromise=require(_0x6948('0x4'));var rp=require(_0x6948('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6948('0x6'));var attributes=require(_0x6948('0x7'));module[_0x6948('0x8')]=function(_0x496445,_0x1fbc87){return _0x496445[_0x6948('0x9')](_0x6948('0xa'),attributes,{'tableName':_0x6948('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a5fa0,_0x3c670d,_0x1c3947){if(_0x1a5fa0[_0x6948('0xc')](_0x6948('0xd'))){_0x1a5fa0[_0x6948('0xe')]=moment()[_0x6948('0xf')](_0x6948('0x10'));}_0x1c3947(null,_0x1a5fa0);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 0b5dd32..59ba8a0 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 _0xd805=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsInteraction.socket','request','then','request\x20sent','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','result','catch','SmsInteraction','update','options','raw','attributes','limit','UpdateSmsInteraction','debug','find','where','body','ids','spread','AddTags','util'];(function(_0x5b3518,_0x3b6617){var _0xf53d53=function(_0x52877e){while(--_0x52877e){_0x5b3518['push'](_0x5b3518['shift']());}};_0xf53d53(++_0x3b6617);}(_0xd805,0x77));var _0x5d80=function(_0x263f81,_0x490cad){_0x263f81=_0x263f81-0x0;var _0xf2563=_0xd805[_0x263f81];return _0xf2563;};'use strict';var _=require('lodash');var util=require(_0x5d80('0x0'));var moment=require(_0x5d80('0x1'));var BPromise=require(_0x5d80('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d80('0x3'));var db=require(_0x5d80('0x4'))['db'];var utils=require(_0x5d80('0x5'));var logger=require('../../config/logger')(_0x5d80('0x6'));var config=require(_0x5d80('0x7'));var jayson=require(_0x5d80('0x8'));var client=jayson[_0x5d80('0x9')][_0x5d80('0xa')]({'port':0x232a});config[_0x5d80('0xb')]=_['defaults'](config[_0x5d80('0xb')],{'host':_0x5d80('0xc'),'port':0x18eb});var socket=require(_0x5d80('0xd'))(new Redis(config[_0x5d80('0xb')]));require(_0x5d80('0xe'))['register'](socket);function respondWithRpcPromise(_0x4e4636,_0x49abb4,_0x4e690d){return new BPromise(function(_0x1969f4,_0x3e6472){return client[_0x5d80('0xf')](_0x4e4636,_0x4e690d)[_0x5d80('0x10')](function(_0x1988f6){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x49abb4,_0x5d80('0x11'));logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x49abb4,_0x5d80('0x11'),JSON[_0x5d80('0x12')](_0x1988f6));if(_0x1988f6['error']){if(_0x1988f6[_0x5d80('0x13')][_0x5d80('0x14')]===0x1f4){logger[_0x5d80('0x13')](_0x5d80('0x15'),_0x49abb4,_0x1988f6['error'][_0x5d80('0x16')]);return _0x3e6472(_0x1988f6[_0x5d80('0x13')][_0x5d80('0x16')]);}logger[_0x5d80('0x13')](_0x5d80('0x15'),_0x49abb4,_0x1988f6[_0x5d80('0x13')][_0x5d80('0x16')]);return _0x1969f4(_0x1988f6[_0x5d80('0x13')]['message']);}else{logger[_0x5d80('0x17')](_0x5d80('0x15'),_0x49abb4,_0x5d80('0x11'));_0x1969f4(_0x1988f6[_0x5d80('0x18')][_0x5d80('0x16')]);}})[_0x5d80('0x19')](function(_0xd09c4f){logger[_0x5d80('0x13')](_0x5d80('0x15'),_0x49abb4,_0xd09c4f);_0x3e6472(_0xd09c4f);});});}exports['UpdateSmsInteraction']=function(_0x437b3e){var _0x41e530=this;return new Promise(function(_0x49384a,_0x39e86a){return db[_0x5d80('0x1a')][_0x5d80('0x1b')](_0x437b3e['body'],{'raw':_0x437b3e[_0x5d80('0x1c')]?_0x437b3e[_0x5d80('0x1c')][_0x5d80('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x437b3e[_0x5d80('0x1c')]?_0x437b3e[_0x5d80('0x1c')]['where']||null:null,'attributes':_0x437b3e['options']?_0x437b3e['options'][_0x5d80('0x1e')]||null:null,'limit':_0x437b3e[_0x5d80('0x1c')]?_0x437b3e[_0x5d80('0x1c')][_0x5d80('0x1f')]||null:null})[_0x5d80('0x10')](function(_0x39afd8){logger[_0x5d80('0x17')](_0x5d80('0x20'),_0x437b3e);logger[_0x5d80('0x21')]('UpdateSmsInteraction',_0x437b3e,JSON['stringify'](_0x39afd8));_0x49384a(_0x39afd8);})[_0x5d80('0x19')](function(_0x2d7b01){logger[_0x5d80('0x13')]('UpdateSmsInteraction',_0x2d7b01['message'],_0x437b3e);_0x39e86a(_0x41e530[_0x5d80('0x13')](0x1f4,_0x2d7b01[_0x5d80('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0xad7c11){return new Promise(function(_0xb0fbd8,_0x5f0239){return db[_0x5d80('0x1a')][_0x5d80('0x22')]({'where':_0xad7c11['options']?_0xad7c11[_0x5d80('0x1c')][_0x5d80('0x23')]||null:null})[_0x5d80('0x10')](function(_0x26f6c9){if(_0x26f6c9){return _0x26f6c9['addTags'](_0xad7c11[_0x5d80('0x24')][_0x5d80('0x25')],_['omit'](_0xad7c11[_0x5d80('0x24')],[_0x5d80('0x25'),'id'])||{});}})[_0x5d80('0x26')](function(_0x51dd22){logger[_0x5d80('0x17')](_0x5d80('0x27'),_0xad7c11);logger[_0x5d80('0x21')](_0x5d80('0x27'),_0xad7c11,JSON['stringify'](_0x51dd22));_0xb0fbd8(_0x51dd22);})[_0x5d80('0x19')](function(_0x367d59){logger[_0x5d80('0x13')](_0x5d80('0x27'),_0x367d59['message'],_0xad7c11);_0x5f0239(_this[_0x5d80('0x13')](0x1f4,_0x367d59[_0x5d80('0x16')]));});});}; \ No newline at end of file +var _0xbfd4=['stringify','AddTagsToSmsInteraction','find','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','defaults','redis','localhost','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where'];(function(_0x5df033,_0x29458b){var _0x445829=function(_0x2c795b){while(--_0x2c795b){_0x5df033['push'](_0x5df033['shift']());}};_0x445829(++_0x29458b);}(_0xbfd4,0x1aa));var _0x4bfd=function(_0x43926d,_0x335f6b){_0x43926d=_0x43926d-0x0;var _0x596e4c=_0xbfd4[_0x43926d];return _0x596e4c;};'use strict';var _=require(_0x4bfd('0x0'));var util=require(_0x4bfd('0x1'));var moment=require(_0x4bfd('0x2'));var BPromise=require(_0x4bfd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4bfd('0x4'));var db=require(_0x4bfd('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4bfd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4bfd('0x7'));var client=jayson[_0x4bfd('0x8')]['http']({'port':0x232a});config['redis']=_[_0x4bfd('0x9')](config[_0x4bfd('0xa')],{'host':_0x4bfd('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4bfd('0xc'))['register'](socket);function respondWithRpcPromise(_0x48870a,_0x43a814,_0x3f3974){return new BPromise(function(_0x30ddbb,_0x53475a){return client[_0x4bfd('0xd')](_0x48870a,_0x3f3974)[_0x4bfd('0xe')](function(_0x53f035){logger[_0x4bfd('0xf')](_0x4bfd('0x10'),_0x43a814,_0x4bfd('0x11'));logger[_0x4bfd('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x43a814,_0x4bfd('0x11'),JSON['stringify'](_0x53f035));if(_0x53f035['error']){if(_0x53f035['error']['code']===0x1f4){logger[_0x4bfd('0x13')](_0x4bfd('0x10'),_0x43a814,_0x53f035['error'][_0x4bfd('0x14')]);return _0x53475a(_0x53f035[_0x4bfd('0x13')]['message']);}logger[_0x4bfd('0x13')](_0x4bfd('0x10'),_0x43a814,_0x53f035[_0x4bfd('0x13')][_0x4bfd('0x14')]);return _0x30ddbb(_0x53f035['error'][_0x4bfd('0x14')]);}else{logger[_0x4bfd('0xf')](_0x4bfd('0x10'),_0x43a814,_0x4bfd('0x11'));_0x30ddbb(_0x53f035[_0x4bfd('0x15')][_0x4bfd('0x14')]);}})[_0x4bfd('0x16')](function(_0x1f1019){logger[_0x4bfd('0x13')](_0x4bfd('0x10'),_0x43a814,_0x1f1019);_0x53475a(_0x1f1019);});});}exports[_0x4bfd('0x17')]=function(_0xbde7b5){var _0x54fb42=this;return new Promise(function(_0x28cb73,_0xd1c8ac){return db[_0x4bfd('0x18')][_0x4bfd('0x19')](_0xbde7b5[_0x4bfd('0x1a')],{'raw':_0xbde7b5[_0x4bfd('0x1b')]?_0xbde7b5[_0x4bfd('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbde7b5[_0x4bfd('0x1b')]?_0xbde7b5[_0x4bfd('0x1b')][_0x4bfd('0x1c')]||null:null,'attributes':_0xbde7b5[_0x4bfd('0x1b')]?_0xbde7b5[_0x4bfd('0x1b')]['attributes']||null:null,'limit':_0xbde7b5[_0x4bfd('0x1b')]?_0xbde7b5[_0x4bfd('0x1b')]['limit']||null:null})[_0x4bfd('0xe')](function(_0x219968){logger[_0x4bfd('0xf')](_0x4bfd('0x17'),_0xbde7b5);logger[_0x4bfd('0x12')](_0x4bfd('0x17'),_0xbde7b5,JSON[_0x4bfd('0x1d')](_0x219968));_0x28cb73(_0x219968);})['catch'](function(_0x4bef8c){logger[_0x4bfd('0x13')](_0x4bfd('0x17'),_0x4bef8c[_0x4bfd('0x14')],_0xbde7b5);_0xd1c8ac(_0x54fb42[_0x4bfd('0x13')](0x1f4,_0x4bef8c[_0x4bfd('0x14')]));});});};exports[_0x4bfd('0x1e')]=function(_0x5338f3){return new Promise(function(_0x1762c4,_0x5cb7eb){return db[_0x4bfd('0x18')][_0x4bfd('0x1f')]({'where':_0x5338f3['options']?_0x5338f3[_0x4bfd('0x1b')][_0x4bfd('0x1c')]||null:null})[_0x4bfd('0xe')](function(_0x496f5e){if(_0x496f5e){return _0x496f5e['addTags'](_0x5338f3[_0x4bfd('0x1a')][_0x4bfd('0x20')],_[_0x4bfd('0x21')](_0x5338f3['body'],['ids','id'])||{});}})['spread'](function(_0x598fc4){logger[_0x4bfd('0xf')](_0x4bfd('0x22'),_0x5338f3);logger['debug'](_0x4bfd('0x22'),_0x5338f3,JSON[_0x4bfd('0x1d')](_0x598fc4));_0x1762c4(_0x598fc4);})[_0x4bfd('0x16')](function(_0x52da4a){logger['error'](_0x4bfd('0x22'),_0x52da4a[_0x4bfd('0x14')],_0x5338f3);_0x5cb7eb(_this['error'](0x1f4,_0x52da4a[_0x4bfd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e408e4e..fb4c6de 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 _0x3882=['save','update','emit','register','length','smsInteraction:'];(function(_0x1602da,_0x1525c7){var _0x3c079c=function(_0x4588c5){while(--_0x4588c5){_0x1602da['push'](_0x1602da['shift']());}};_0x3c079c(++_0x1525c7);}(_0x3882,0x114));var _0x2388=function(_0x930896,_0x15eed1){_0x930896=_0x930896-0x0;var _0x4a29f7=_0x3882[_0x930896];return _0x4a29f7;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2388('0x0'),'remove',_0x2388('0x1')];function createListener(_0x239b5b,_0x2f6a4e){return function(_0x5926a0){_0x2f6a4e[_0x2388('0x2')](_0x239b5b,_0x5926a0);};}function removeListener(_0x441bd4,_0x155d86){return function(){SmsInteractionEvents['removeListener'](_0x441bd4,_0x155d86);};}exports[_0x2388('0x3')]=function(_0x8ff721){for(var _0x18eaaa=0x0,_0x2f9c62=events[_0x2388('0x4')];_0x18eaaa<_0x2f9c62;_0x18eaaa++){var _0x27fcab=events[_0x18eaaa];var _0x1971f2=createListener(_0x2388('0x5')+_0x27fcab,_0x8ff721);SmsInteractionEvents['on'](_0x27fcab,_0x1971f2);}}; \ No newline at end of file +var _0x8555=['save','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8555,0x1cf));var _0x5855=function(_0x22310b,_0x26e861){_0x22310b=_0x22310b-0x0;var _0xeb089e=_0x8555[_0x22310b];return _0xeb089e;};'use strict';var SmsInteractionEvents=require(_0x5855('0x0'));var events=[_0x5855('0x1'),'remove',_0x5855('0x2')];function createListener(_0x26e021,_0x23f31a){return function(_0x37e4b7){_0x23f31a[_0x5855('0x3')](_0x26e021,_0x37e4b7);};}function removeListener(_0x3eeab6,_0x1ead0a){return function(){SmsInteractionEvents[_0x5855('0x4')](_0x3eeab6,_0x1ead0a);};}exports[_0x5855('0x5')]=function(_0x5523ac){for(var _0x965d17=0x0,_0x3de12f=events[_0x5855('0x6')];_0x965d17<_0x3de12f;_0x965d17++){var _0x435ede=events[_0x965d17];var _0x595521=createListener(_0x5855('0x7')+_0x435ede,_0x5523ac);SmsInteractionEvents['on'](_0x435ede,_0x595521);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index bee5bfd..a6ab5d2 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 _0x707b=['update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','describe','show','sms','create','post','/:id/status','status','put','/:id'];(function(_0x4344a7,_0x157f6d){var _0x1a8b6d=function(_0x5141d2){while(--_0x5141d2){_0x4344a7['push'](_0x4344a7['shift']());}};_0x1a8b6d(++_0x157f6d);}(_0x707b,0xdf));var _0xb707=function(_0x50bca7,_0xb23979){_0x50bca7=_0x50bca7-0x0;var _0x40e5ee=_0x707b[_0x50bca7];return _0x40e5ee;};'use strict';var multer=require(_0xb707('0x0'));var util=require(_0xb707('0x1'));var path=require(_0xb707('0x2'));var timeout=require('connect-timeout');var express=require(_0xb707('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb707('0x4'));var interaction=require(_0xb707('0x5'));var config=require(_0xb707('0x6'));var controller=require(_0xb707('0x7'));router[_0xb707('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb707('0x9'),auth[_0xb707('0xa')](),controller[_0xb707('0xb')]);router[_0xb707('0x8')]('/:id',auth[_0xb707('0xa')](),controller[_0xb707('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xb707('0xd'),'smsmessage:create'),controller[_0xb707('0xe')]);router[_0xb707('0xf')](_0xb707('0x10'),controller[_0xb707('0x11')]);router[_0xb707('0x12')](_0xb707('0x13'),auth[_0xb707('0xa')](),controller[_0xb707('0x14')]);router['put'](_0xb707('0x15'),auth[_0xb707('0xa')](),controller[_0xb707('0x16')]);router['put'](_0xb707('0x17'),auth['isAuthenticated'](),controller[_0xb707('0x18')]);router[_0xb707('0x19')](_0xb707('0x13'),auth[_0xb707('0xa')](),controller[_0xb707('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x7341=['update','/:id/reject','reject','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','sms','create','status','put'];(function(_0x1a8bed,_0x181288){var _0x5a00e4=function(_0x418740){while(--_0x418740){_0x1a8bed['push'](_0x1a8bed['shift']());}};_0x5a00e4(++_0x181288);}(_0x7341,0x1d1));var _0x1734=function(_0x26437b,_0x183315){_0x26437b=_0x26437b-0x0;var _0x452c52=_0x7341[_0x26437b];return _0x452c52;};'use strict';var multer=require(_0x1734('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1734('0x1'));var express=require('express');var router=express[_0x1734('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x1734('0x3'));var interaction=require(_0x1734('0x4'));var config=require(_0x1734('0x5'));var controller=require(_0x1734('0x6'));router[_0x1734('0x7')]('/',auth[_0x1734('0x8')](),controller['index']);router['get'](_0x1734('0x9'),auth[_0x1734('0x8')](),controller[_0x1734('0xa')]);router['get'](_0x1734('0xb'),auth[_0x1734('0x8')](),controller[_0x1734('0xc')]);router[_0x1734('0xd')]('/',auth[_0x1734('0x8')](),interaction[_0x1734('0xe')](_0x1734('0xf'),'smsmessage:create'),controller[_0x1734('0x10')]);router['post']('/:id/status',controller[_0x1734('0x11')]);router[_0x1734('0x12')](_0x1734('0xb'),auth[_0x1734('0x8')](),controller[_0x1734('0x13')]);router['put']('/:id/accept',auth[_0x1734('0x8')](),controller['accept']);router['put'](_0x1734('0x14'),auth['isAuthenticated'](),controller[_0x1734('0x15')]);router['delete'](_0x1734('0xb'),auth['isAuthenticated'](),controller['destroy']);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 2b7dbf4..4a3848e 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 _0xdf32=['exports','TEXT','ENUM','out','STRING','DATE'];(function(_0x203670,_0x52d68c){var _0x41042a=function(_0x5dbd39){while(--_0x5dbd39){_0x203670['push'](_0x203670['shift']());}};_0x41042a(++_0x52d68c);}(_0xdf32,0x1bc));var _0x2df3=function(_0x1d6449,_0x16cbb3){_0x1d6449=_0x1d6449-0x0;var _0x4072a8=_0xdf32[_0x1d6449];return _0x4072a8;};'use strict';var Sequelize=require('sequelize');module[_0x2df3('0x0')]={'body':{'type':Sequelize[_0x2df3('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x2df3('0x2')]('in',_0x2df3('0x3')),'defaultValue':_0x2df3('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x2df3('0x4')]},'readAt':{'type':Sequelize[_0x2df3('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x2df3('0x1')]}}; \ No newline at end of file +var _0xd73c=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x255754,_0x3945c4){var _0x3bab9c=function(_0xcf700c){while(--_0xcf700c){_0x255754['push'](_0x255754['shift']());}};_0x3bab9c(++_0x3945c4);}(_0xd73c,0x134));var _0xcd73=function(_0x5c6b8e,_0x320a0e){_0x5c6b8e=_0x5c6b8e-0x0;var _0x226933=_0xd73c[_0x5c6b8e];return _0x226933;};'use strict';var Sequelize=require(_0xcd73('0x0'));module[_0xcd73('0x1')]={'body':{'type':Sequelize[_0xcd73('0x2')](_0xcd73('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xcd73('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd73('0x5')]('in',_0xcd73('0x6')),'defaultValue':_0xcd73('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcd73('0x7')](0xbe)},'phone':{'type':Sequelize[_0xcd73('0x7')]},'readAt':{'type':Sequelize[_0xcd73('0x8')]},'secret':{'type':Sequelize[_0xcd73('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcd73('0x7')]},'providerResponse':{'type':Sequelize[_0xcd73('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 56761e5..ac76f56 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 _0x0936=['rawAttributes','include','find','create','body','update','params','describe','../../config/logger','sms-interactions','accept','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','contact','User','agent','fullname','internal','interface','SIP/%s','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','Sequelize','QueryTypes','email','motionChannel','rejectmessage','SmsAccount','SmsAccountId','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','name','send','index','SmsMessage','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x0936,0xde));var _0x6093=function(_0x2b065c,_0x1ca369){_0x2b065c=_0x2b065c-0x0;var _0x42ef61=_0x0936[_0x2b065c];return _0x42ef61;};'use strict';var emlformat=require(_0x6093('0x0'));var rimraf=require(_0x6093('0x1'));var zipdir=require(_0x6093('0x2'));var jsonpatch=require(_0x6093('0x3'));var rp=require(_0x6093('0x4'));var moment=require(_0x6093('0x5'));var BPromise=require(_0x6093('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6093('0x7'));var sox=require(_0x6093('0x8'));var csv=require(_0x6093('0x9'));var ejs=require(_0x6093('0xa'));var fs=require('fs');var fs_extra=require(_0x6093('0xb'));var _=require(_0x6093('0xc'));var squel=require(_0x6093('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6093('0xe'));var toCsv=require(_0x6093('0x9'));var querystring=require(_0x6093('0xf'));var Papa=require(_0x6093('0x10'));var Redis=require(_0x6093('0x11'));var authService=require(_0x6093('0x12'));var qs=require(_0x6093('0x13'));var as=require(_0x6093('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6093('0x15'));var utils=require(_0x6093('0x16'));var config=require(_0x6093('0x17'));var licenseUtil=require(_0x6093('0x18'));var db=require(_0x6093('0x19'))['db'];config[_0x6093('0x1a')]=_[_0x6093('0x1b')](config[_0x6093('0x1a')],{'host':_0x6093('0x1c'),'port':0x18eb});var socket=require(_0x6093('0x1d'))(new Redis(config[_0x6093('0x1a')]));require(_0x6093('0x1e'))[_0x6093('0x1f')](socket);var jayson=require(_0x6093('0x20'));var client=jayson[_0x6093('0x21')][_0x6093('0x22')]({'port':0x232c});var client9002=jayson[_0x6093('0x21')][_0x6093('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x1205e2,_0x214118,_0xb8c9c5,_0x396c2c){return new BPromise(function(_0x5c8f2a,_0x5f2f3b){var _0x141516=_0x396c2c||client;return _0x141516[_0x6093('0x23')](_0x1205e2,_0xb8c9c5)[_0x6093('0x24')](function(_0x13afe7){logger[_0x6093('0x25')](_0x6093('0x26'),_0x214118,'request\x20sent');logger[_0x6093('0x27')](_0x6093('0x28'),_0x214118,_0x6093('0x29'),JSON[_0x6093('0x2a')](_0x13afe7));if(_0x13afe7['error']){if(_0x13afe7[_0x6093('0x2b')][_0x6093('0x2c')]===0x1f4){logger['error'](_0x6093('0x26'),_0x214118,_0x13afe7[_0x6093('0x2b')][_0x6093('0x2d')]);return _0x5f2f3b(_0x13afe7[_0x6093('0x2b')][_0x6093('0x2d')]);}logger['error'](_0x6093('0x26'),_0x214118,_0x13afe7[_0x6093('0x2b')]['message']);return _0x5c8f2a(_0x13afe7[_0x6093('0x2b')][_0x6093('0x2d')]);}else{logger['info'](_0x6093('0x26'),_0x214118,'request\x20sent');_0x5c8f2a(_0x13afe7['result'][_0x6093('0x2d')]);}})[_0x6093('0x2e')](function(_0x543aed){logger[_0x6093('0x2b')]('SmsMessage,\x20%s,\x20%s',_0x214118,_0x543aed);_0x5f2f3b(_0x543aed);});});}function respondWithStatusCode(_0x15f926,_0x68ba4){_0x68ba4=_0x68ba4||0xcc;return function(_0x62278e){if(_0x62278e){return _0x15f926[_0x6093('0x2f')](_0x68ba4);}return _0x15f926[_0x6093('0x30')](_0x68ba4)[_0x6093('0x31')]();};}function respondWithResult(_0x412409,_0x36cc99){_0x36cc99=_0x36cc99||0xc8;return function(_0x6e837c){if(_0x6e837c){return _0x412409['status'](_0x36cc99)[_0x6093('0x32')](_0x6e837c);}};}function respondWithFilteredResult(_0x605f57,_0x4e582e){return function(_0x3a86ad){if(_0x3a86ad){var _0x44e657=typeof _0x4e582e[_0x6093('0x33')]===_0x6093('0x34')&&typeof _0x4e582e[_0x6093('0x35')]===_0x6093('0x34');var _0x44b238=_0x3a86ad[_0x6093('0x36')];var _0x49cd16=_0x44e657?0x0:_0x4e582e[_0x6093('0x33')];var _0x426e81=_0x44e657?_0x3a86ad[_0x6093('0x36')]:_0x4e582e[_0x6093('0x33')]+_0x4e582e[_0x6093('0x35')];var _0x55f5f2;if(_0x426e81>=_0x44b238){_0x426e81=_0x44b238;_0x55f5f2=0xc8;}else{_0x55f5f2=0xce;}_0x605f57[_0x6093('0x30')](_0x55f5f2);return _0x605f57[_0x6093('0x37')](_0x6093('0x38'),_0x49cd16+'-'+_0x426e81+'/'+_0x44b238)['json'](_0x3a86ad);}return null;};}function patchUpdates(_0xcf71df){return function(_0x4a7b79){try{jsonpatch['apply'](_0x4a7b79,_0xcf71df,!![]);}catch(_0x115f56){return BPromise[_0x6093('0x39')](_0x115f56);}return _0x4a7b79[_0x6093('0x3a')]();};}function saveUpdates(_0x3ba5f9,_0x2168bd){return function(_0x5602f8){if(_0x5602f8){return _0x5602f8['update'](_0x3ba5f9)[_0x6093('0x24')](function(_0x1fd4c9){return _0x1fd4c9;});}return null;};}function removeEntity(_0x1b6ae0,_0xc9ba11){return function(_0xa5a8ba){if(_0xa5a8ba){return _0xa5a8ba[_0x6093('0x3b')]()[_0x6093('0x24')](function(){_0x1b6ae0['status'](0xcc)[_0x6093('0x31')]();});}};}function handleEntityNotFound(_0x307439,_0x38e616){return function(_0x22262b){if(!_0x22262b){_0x307439[_0x6093('0x2f')](0x194);}return _0x22262b;};}function handleError(_0x547320,_0x3c849d){_0x3c849d=_0x3c849d||0x1f4;return function(_0x4572bb){logger[_0x6093('0x2b')](_0x4572bb['stack']);if(_0x4572bb[_0x6093('0x3c')]){delete _0x4572bb[_0x6093('0x3c')];}_0x547320[_0x6093('0x30')](_0x3c849d)[_0x6093('0x3d')](_0x4572bb);};}exports[_0x6093('0x3e')]=function(_0xbce376,_0x3e4f2b){var _0x401b0c={},_0x48a159={},_0x28116c={'count':0x0,'rows':[]};var _0x4a9b0b=_['map'](db[_0x6093('0x3f')]['rawAttributes'],function(_0x5df9c7){return{'name':_0x5df9c7['fieldName'],'type':_0x5df9c7['type'][_0x6093('0x40')]};});_0x48a159[_0x6093('0x41')]=_[_0x6093('0x42')](_0x4a9b0b,_0x6093('0x3c'));_0x48a159['query']=_[_0x6093('0x43')](_0xbce376[_0x6093('0x44')]);_0x48a159['filters']=_['intersection'](_0x48a159[_0x6093('0x41')],_0x48a159[_0x6093('0x44')]);_0x401b0c['attributes']=_[_0x6093('0x45')](_0x48a159[_0x6093('0x41')],qs['fields'](_0xbce376[_0x6093('0x44')][_0x6093('0x46')]));_0x401b0c['attributes']=_0x401b0c[_0x6093('0x47')][_0x6093('0x48')]?_0x401b0c['attributes']:_0x48a159[_0x6093('0x41')];if(!_0xbce376[_0x6093('0x44')][_0x6093('0x49')]('nolimit')){_0x401b0c['limit']=qs[_0x6093('0x35')](_0xbce376[_0x6093('0x44')][_0x6093('0x35')]);_0x401b0c['offset']=qs[_0x6093('0x33')](_0xbce376[_0x6093('0x44')]['offset']);}_0x401b0c[_0x6093('0x4a')]=qs[_0x6093('0x4b')](_0xbce376[_0x6093('0x44')]['sort']);_0x401b0c[_0x6093('0x4c')]=qs[_0x6093('0x4d')](_[_0x6093('0x4e')](_0xbce376[_0x6093('0x44')],_0x48a159[_0x6093('0x4d')]),_0x4a9b0b);if(_0xbce376['query'][_0x6093('0x4f')]){_0x401b0c[_0x6093('0x4c')]=_[_0x6093('0x50')](_0x401b0c['where'],{'$or':_[_0x6093('0x42')](_0x4a9b0b,function(_0x9edaad){if(_0x9edaad[_0x6093('0x51')]!==_0x6093('0x52')){var _0x32786c={};_0x32786c[_0x9edaad['name']]={'$like':'%'+_0xbce376[_0x6093('0x44')][_0x6093('0x4f')]+'%'};return _0x32786c;}})});}_0x401b0c=_[_0x6093('0x50')]({},_0x401b0c,_0xbce376[_0x6093('0x53')]);var _0x2e0548={'where':_0x401b0c[_0x6093('0x4c')]};return db[_0x6093('0x3f')][_0x6093('0x36')](_0x2e0548)[_0x6093('0x24')](function(_0x26d9d6){_0x28116c[_0x6093('0x36')]=_0x26d9d6;if(_0xbce376['query'][_0x6093('0x54')]){_0x401b0c['include']=[{'all':!![]}];}return db['SmsMessage'][_0x6093('0x55')](_0x401b0c);})[_0x6093('0x24')](function(_0xe6f33f){_0x28116c[_0x6093('0x56')]=_0xe6f33f;return _0x28116c;})[_0x6093('0x24')](respondWithFilteredResult(_0x3e4f2b,_0x401b0c))[_0x6093('0x2e')](handleError(_0x3e4f2b,null));};exports[_0x6093('0x57')]=function(_0x468250,_0x293d63){var _0x214034={'raw':!![],'where':{'id':_0x468250['params']['id']}},_0x1ac324={};_0x1ac324[_0x6093('0x41')]=_[_0x6093('0x43')](db['SmsMessage'][_0x6093('0x58')]);_0x1ac324['query']=_['keys'](_0x468250[_0x6093('0x44')]);_0x1ac324[_0x6093('0x4d')]=_[_0x6093('0x45')](_0x1ac324[_0x6093('0x41')],_0x1ac324[_0x6093('0x44')]);_0x214034['attributes']=_[_0x6093('0x45')](_0x1ac324[_0x6093('0x41')],qs[_0x6093('0x46')](_0x468250['query'][_0x6093('0x46')]));_0x214034[_0x6093('0x47')]=_0x214034[_0x6093('0x47')][_0x6093('0x48')]?_0x214034[_0x6093('0x47')]:_0x1ac324[_0x6093('0x41')];if(_0x468250[_0x6093('0x44')][_0x6093('0x54')]){_0x214034[_0x6093('0x59')]=[{'all':!![]}];}_0x214034=_[_0x6093('0x50')]({},_0x214034,_0x468250[_0x6093('0x53')]);return db[_0x6093('0x3f')][_0x6093('0x5a')](_0x214034)[_0x6093('0x24')](handleEntityNotFound(_0x293d63,null))[_0x6093('0x24')](respondWithResult(_0x293d63,null))[_0x6093('0x2e')](handleError(_0x293d63,null));};exports[_0x6093('0x5b')]=function(_0x21b936,_0x470023){return db[_0x6093('0x3f')][_0x6093('0x5b')](_0x21b936[_0x6093('0x5c')],{})[_0x6093('0x24')](respondWithResult(_0x470023,0xc9))['catch'](handleError(_0x470023,null));};exports[_0x6093('0x5d')]=function(_0x4dee18,_0xd24aa2){if(_0x4dee18[_0x6093('0x5c')]['id']){delete _0x4dee18[_0x6093('0x5c')]['id'];}return db[_0x6093('0x3f')][_0x6093('0x5a')]({'where':{'id':_0x4dee18['params']['id']}})[_0x6093('0x24')](handleEntityNotFound(_0xd24aa2,null))['then'](saveUpdates(_0x4dee18[_0x6093('0x5c')],null))['then'](respondWithResult(_0xd24aa2,null))[_0x6093('0x2e')](handleError(_0xd24aa2,null));};exports[_0x6093('0x3b')]=function(_0x1abe6e,_0x3310b9){return db[_0x6093('0x3f')][_0x6093('0x5a')]({'where':{'id':_0x1abe6e[_0x6093('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3310b9,null))[_0x6093('0x24')](removeEntity(_0x3310b9,null))[_0x6093('0x2e')](handleError(_0x3310b9,null));};exports[_0x6093('0x5f')]=function(_0x5ba62e,_0x596042){return db[_0x6093('0x3f')][_0x6093('0x5f')]()[_0x6093('0x24')](respondWithResult(_0x596042,null))[_0x6093('0x2e')](handleError(_0x596042,null));};var interaction_log=require(_0x6093('0x60'))(_0x6093('0x61'));exports[_0x6093('0x62')]=function(_0x13c5ad,_0x206c86,_0x33418d){var _0x12f6a3={'agent':{},'channel':_0x6093('0x63')};if(_0x13c5ad[_0x6093('0x5c')]['id']){delete _0x13c5ad[_0x6093('0x5c')]['id'];}_0x13c5ad['body'][_0x6093('0x64')]=!![];_0x13c5ad[_0x6093('0x5c')]['readAt']=moment()[_0x6093('0x65')](_0x6093('0x66'));_0x13c5ad[_0x6093('0x5c')][_0x6093('0x67')]=_0x13c5ad[_0x6093('0x5c')][_0x6093('0x67')]||_0x13c5ad[_0x6093('0x68')]['id'];_0x12f6a3['agent']['id']=_0x13c5ad[_0x6093('0x5c')][_0x6093('0x67')];return db[_0x6093('0x3f')][_0x6093('0x5a')]({'where':{'id':_0x13c5ad[_0x6093('0x5e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x206c86,null))[_0x6093('0x24')](saveUpdates(_0x13c5ad[_0x6093('0x5c')],null))['then'](function(_0x17da2b){if(_0x17da2b){_0x12f6a3['message']=_0x17da2b['get']({'plain':!![]});return db[_0x6093('0x69')]['find']({'where':{'id':_0x17da2b[_0x6093('0x6a')]}});}return null;})[_0x6093('0x24')](handleEntityNotFound(_0x206c86,null))[_0x6093('0x24')](function(_0x3abfda){if(_0x3abfda){return _0x3abfda[_0x6093('0x5d')]({'UserId':_0x13c5ad[_0x6093('0x5c')][_0x6093('0x67')],'read1stAt':_[_0x6093('0x6b')](_0x3abfda[_0x6093('0x6c')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6093('0x24')](function(_0x3b02a2){if(_0x3b02a2){_0x12f6a3[_0x6093('0x6d')]=_0x3b02a2[_0x6093('0x6e')]({'plain':!![]});interaction_log[_0x6093('0x25')](_0x6093('0x6f'),_0x13c5ad[_0x6093('0x68')]['id'],_0x13c5ad['user'][_0x6093('0x3c')],_0x13c5ad[_0x6093('0x68')][_0x6093('0x70')],_0x12f6a3[_0x6093('0x6d')]['id'],_0x13c5ad['body']?JSON[_0x6093('0x2a')](_0x13c5ad['body']):_0x6093('0x71'));return respondWithRpcPromise(_0x6093('0x72'),_0x6093('0x73'),_0x12f6a3);}return null;})[_0x6093('0x24')](function(_0x3cd210){var _0x2001cc=_0x6093('0x74')+_0x3cd210[_0x6093('0x2d')]['ContactId'];return db[_0x6093('0x75')][_0x6093('0x44')](_0x2001cc,{'type':db['Sequelize']['QueryTypes'][_0x6093('0x76')],'raw':!![]})[_0x6093('0x24')](function(_0x17ff51){return _0x17ff51;});})['then'](function(_0x47dd34){if(_0x47dd34){_0x12f6a3[_0x6093('0x2d')][_0x6093('0x77')]=_0x47dd34[0x0];if(!_0x13c5ad[_0x6093('0x5c')][_0x6093('0x67')])return;return db[_0x6093('0x78')]['find']({'where':{'id':_0x13c5ad[_0x6093('0x5c')]['UserId'],'role':_0x6093('0x79')},'attributes':['id',_0x6093('0x3c'),_0x6093('0x7a'),'email',_0x6093('0x7b')],'raw':!![]});}return null;})[_0x6093('0x24')](function(_0x3ac058){if(!_0x3ac058)return null;_0x12f6a3[_0x6093('0x2d')][_0x6093('0x79')]=_0x3ac058;return _0x12f6a3;})[_0x6093('0x24')](function(_0x4bce7a){if(_0x4bce7a){if(_0x13c5ad[_0x6093('0x5c')]['manual']){_0x12f6a3[_0x6093('0x2d')][_0x6093('0x7c')]=util[_0x6093('0x65')](_0x6093('0x7d'),_0x13c5ad[_0x6093('0x68')][_0x6093('0x3c')]);_0x12f6a3[_0x6093('0x2d')][_0x6093('0x7e')]=_0x12f6a3['channel'];_0x12f6a3[_0x6093('0x2d')]['motionChannel']=_0x12f6a3[_0x6093('0x7e')];_0x12f6a3[_0x6093('0x2d')][_0x6093('0x7f')]=_0x6093('0x62');return respondWithRpcPromise(_0x6093('0x80'),_0x6093('0x80'),{'event':_0x6093('0x81'),'message':_0x12f6a3['message']},client9002)['then'](function(){return _0x12f6a3;});}return _0x12f6a3;}return null;})[_0x6093('0x24')](respondWithResult(_0x206c86,null))[_0x6093('0x2e')](handleError(_0x206c86,null));};var interaction_log=require(_0x6093('0x60'))(_0x6093('0x61'));exports['reject']=function(_0x2368de,_0x9bd84a,_0x210f25){var _0x327fdd={'agent':{},'channel':_0x6093('0x63')};if(_0x2368de[_0x6093('0x5c')]['id']){delete _0x2368de[_0x6093('0x5c')]['id'];}_0x2368de[_0x6093('0x5c')][_0x6093('0x67')]=_0x2368de[_0x6093('0x5c')][_0x6093('0x67')]||_0x2368de[_0x6093('0x68')]['id'];_0x327fdd['agent']['id']=_0x2368de[_0x6093('0x5c')][_0x6093('0x67')];return db['SmsMessage'][_0x6093('0x5a')]({'where':{'id':_0x2368de[_0x6093('0x5e')]['id'],'UserId':null}})[_0x6093('0x24')](handleEntityNotFound(_0x9bd84a,null))[_0x6093('0x24')](function(_0x526bb9){if(_0x526bb9){_0x327fdd['message']=_0x526bb9[_0x6093('0x6e')]({'plain':!![]});return db[_0x6093('0x69')][_0x6093('0x5a')]({'where':{'id':_0x526bb9[_0x6093('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x9bd84a,null))['then'](function(_0x58e523){if(_0x58e523){_0x327fdd[_0x6093('0x6d')]=_0x58e523[_0x6093('0x6e')]({'plain':!![]});interaction_log[_0x6093('0x25')](_0x6093('0x82'),_0x2368de['user']['id'],_0x2368de[_0x6093('0x68')]['name'],_0x2368de[_0x6093('0x68')][_0x6093('0x70')],_0x327fdd[_0x6093('0x6d')]['id'],_0x2368de[_0x6093('0x5c')]?JSON['stringify'](_0x2368de[_0x6093('0x5c')]):_0x6093('0x71'));return respondWithRpcPromise('RejectMessage',_0x6093('0x83'),_0x327fdd);}return null;})[_0x6093('0x24')](function(_0x412f04){var _0x2384b3=_0x6093('0x74')+_0x412f04[_0x6093('0x2d')][_0x6093('0x84')];return db[_0x6093('0x75')][_0x6093('0x44')](_0x2384b3,{'type':db[_0x6093('0x85')][_0x6093('0x86')][_0x6093('0x76')],'raw':!![]})['then'](function(_0x1503f1){return _0x1503f1;});})['then'](function(_0x4c645f){if(_0x4c645f){_0x327fdd[_0x6093('0x2d')][_0x6093('0x77')]=_0x4c645f[0x0];if(!_0x2368de[_0x6093('0x5c')]['UserId'])return;return db[_0x6093('0x78')]['find']({'where':{'id':_0x2368de[_0x6093('0x5c')][_0x6093('0x67')],'role':_0x6093('0x79')},'attributes':['id',_0x6093('0x3c'),'fullname',_0x6093('0x87'),_0x6093('0x7b')],'raw':!![]});}return null;})[_0x6093('0x24')](function(_0x29e191){if(!_0x29e191)return null;_0x327fdd[_0x6093('0x2d')][_0x6093('0x79')]=_0x29e191;return _0x327fdd;})[_0x6093('0x24')](function(_0x5dd6d4){if(_0x5dd6d4){_0x5dd6d4[_0x6093('0x2d')][_0x6093('0x7c')]=util[_0x6093('0x65')](_0x6093('0x7d'),_0x2368de[_0x6093('0x68')][_0x6093('0x3c')]);_0x5dd6d4[_0x6093('0x2d')]['channel']=_0x327fdd[_0x6093('0x7e')];_0x5dd6d4[_0x6093('0x2d')][_0x6093('0x88')]=_0x327fdd[_0x6093('0x7e')];_0x5dd6d4['message'][_0x6093('0x7f')]=_0x6093('0x39');respondWithRpcPromise(_0x6093('0x80'),'EventManager',{'event':_0x6093('0x89'),'message':_0x5dd6d4[_0x6093('0x2d')]},client9002);return _0x327fdd;}return null;})['then'](respondWithResult(_0x9bd84a,null))['catch'](handleError(_0x9bd84a,null));};exports['status']=function(_0x4e9bf2,_0x20ada3,_0x5a0166){if(_0x4e9bf2[_0x6093('0x5c')]['id']){delete _0x4e9bf2[_0x6093('0x5c')]['id'];}var _0x36ad28;return db[_0x6093('0x3f')][_0x6093('0x5a')]({'where':{'id':_0x4e9bf2[_0x6093('0x5e')]['id']}})[_0x6093('0x24')](handleEntityNotFound(_0x20ada3,null))[_0x6093('0x24')](function(_0x42b281){if(_0x42b281){_0x36ad28=_0x42b281;return db[_0x6093('0x8a')]['find']({'where':{'id':_0x42b281[_0x6093('0x8b')]}});}})['then'](handleEntityNotFound(_0x20ada3,null))[_0x6093('0x24')](function(_0x14cffb){if(_0x14cffb){logger[_0x6093('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6093('0x30'),'received\x20delivery\x20report\x20from',_0x14cffb[_0x6093('0x51')],util[_0x6093('0x8c')](_0x4e9bf2['body'],{'showHidden':![],'depth':null}));switch(_0x14cffb['type']){case'twilio':if(_0x4e9bf2['body'][_0x6093('0x8d')]&&_0x4e9bf2[_0x6093('0x5c')]['MessageSid']===_0x36ad28[_0x6093('0x8e')]){return _0x36ad28[_0x6093('0x5d')]({'read':!![]});}else{logger['error'](_0x6093('0x8f'),_0x6093('0x30'),_0x6093('0x90'),util[_0x6093('0x8c')](_0x4e9bf2[_0x6093('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6093('0x91'):if(_0x4e9bf2[_0x6093('0x5c')][_0x6093('0x92')]&&_0x4e9bf2['body']['MessageUUID']===_0x36ad28[_0x6093('0x8e')]&&_[_0x6093('0x93')]([_0x6093('0x94'),_0x6093('0x95')],_0x4e9bf2[_0x6093('0x5c')][_0x6093('0x96')])>=0x0){return _0x36ad28[_0x6093('0x5d')]({'read':!![]});}else{logger[_0x6093('0x2b')](_0x6093('0x8f'),_0x6093('0x30'),_0x6093('0x97'),util[_0x6093('0x8c')](_0x4e9bf2[_0x6093('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x6093('0x98'):var _0x3f1ec8=_0x4e9bf2['body']['results'][0x0];if(_0x3f1ec8[_0x6093('0x30')][_0x6093('0x99')]===_0x6093('0x9a')){return _0x36ad28[_0x6093('0x5d')]({'read':!![]});}else{logger[_0x6093('0x2b')](_0x6093('0x8f'),'status','infobip',util[_0x6093('0x8c')](_0x4e9bf2['body'],{'showHidden':![],'depth':null}));}break;}return _0x36ad28;}})[_0x6093('0x24')](respondWithResult(_0x20ada3,null))['catch'](handleError(_0x20ada3,null));}; \ No newline at end of file +var _0x2fc9=['YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','event','accept','EventManager','acceptmessage','rejectMessage','ContactId','SIP/%s','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','plivio','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','map','SmsMessage','fieldName','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','keys','rawAttributes','find','create','body','params','sms-interactions','sms','read','format'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x2fc9,0xc2));var _0x92fc=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x2fc9[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92fc('0x0'));var zipdir=require(_0x92fc('0x1'));var jsonpatch=require(_0x92fc('0x2'));var rp=require(_0x92fc('0x3'));var moment=require(_0x92fc('0x4'));var BPromise=require(_0x92fc('0x5'));var Mustache=require(_0x92fc('0x6'));var util=require(_0x92fc('0x7'));var path=require(_0x92fc('0x8'));var sox=require(_0x92fc('0x9'));var csv=require(_0x92fc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x92fc('0xb'));var crypto=require(_0x92fc('0xc'));var jsforce=require(_0x92fc('0xd'));var deskjs=require(_0x92fc('0xe'));var toCsv=require(_0x92fc('0xa'));var querystring=require(_0x92fc('0xf'));var Papa=require(_0x92fc('0x10'));var Redis=require('ioredis');var authService=require(_0x92fc('0x11'));var qs=require(_0x92fc('0x12'));var as=require(_0x92fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92fc('0x14'))(_0x92fc('0x15'));var utils=require(_0x92fc('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x92fc('0x17'))['db'];config[_0x92fc('0x18')]=_['defaults'](config[_0x92fc('0x18')],{'host':_0x92fc('0x19'),'port':0x18eb});var socket=require(_0x92fc('0x1a'))(new Redis(config[_0x92fc('0x18')]));require(_0x92fc('0x1b'))['register'](socket);var jayson=require(_0x92fc('0x1c'));var client=jayson[_0x92fc('0x1d')][_0x92fc('0x1e')]({'port':0x232c});var client9002=jayson[_0x92fc('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c45f3,_0x111f42,_0x6de681,_0x510e12){return new BPromise(function(_0x3370c9,_0x1eb0ec){var _0x90f874=_0x510e12||client;return _0x90f874['request'](_0x4c45f3,_0x6de681)[_0x92fc('0x1f')](function(_0x346ee8){logger[_0x92fc('0x20')](_0x92fc('0x21'),_0x111f42,_0x92fc('0x22'));logger[_0x92fc('0x23')](_0x92fc('0x24'),_0x111f42,_0x92fc('0x22'),JSON['stringify'](_0x346ee8));if(_0x346ee8[_0x92fc('0x25')]){if(_0x346ee8['error'][_0x92fc('0x26')]===0x1f4){logger[_0x92fc('0x25')](_0x92fc('0x21'),_0x111f42,_0x346ee8[_0x92fc('0x25')][_0x92fc('0x27')]);return _0x1eb0ec(_0x346ee8[_0x92fc('0x25')][_0x92fc('0x27')]);}logger['error'](_0x92fc('0x21'),_0x111f42,_0x346ee8[_0x92fc('0x25')][_0x92fc('0x27')]);return _0x3370c9(_0x346ee8['error'][_0x92fc('0x27')]);}else{logger[_0x92fc('0x20')](_0x92fc('0x21'),_0x111f42,'request\x20sent');_0x3370c9(_0x346ee8[_0x92fc('0x28')][_0x92fc('0x27')]);}})[_0x92fc('0x29')](function(_0x4052d5){logger[_0x92fc('0x25')](_0x92fc('0x21'),_0x111f42,_0x4052d5);_0x1eb0ec(_0x4052d5);});});}function respondWithStatusCode(_0x8fbd62,_0x27346a){_0x27346a=_0x27346a||0xcc;return function(_0x186d35){if(_0x186d35){return _0x8fbd62[_0x92fc('0x2a')](_0x27346a);}return _0x8fbd62[_0x92fc('0x2b')](_0x27346a)[_0x92fc('0x2c')]();};}function respondWithResult(_0x215e98,_0x4ef103){_0x4ef103=_0x4ef103||0xc8;return function(_0x373851){if(_0x373851){return _0x215e98[_0x92fc('0x2b')](_0x4ef103)[_0x92fc('0x2d')](_0x373851);}};}function respondWithFilteredResult(_0x391c71,_0x7cb643){return function(_0x32a54b){if(_0x32a54b){var _0x129bcf=typeof _0x7cb643['offset']===_0x92fc('0x2e')&&typeof _0x7cb643[_0x92fc('0x2f')]===_0x92fc('0x2e');var _0x57ad3a=_0x32a54b[_0x92fc('0x30')];var _0x1607ab=_0x129bcf?0x0:_0x7cb643[_0x92fc('0x31')];var _0x265b38=_0x129bcf?_0x32a54b[_0x92fc('0x30')]:_0x7cb643['offset']+_0x7cb643[_0x92fc('0x2f')];var _0x10b687;if(_0x265b38>=_0x57ad3a){_0x265b38=_0x57ad3a;_0x10b687=0xc8;}else{_0x10b687=0xce;}_0x391c71[_0x92fc('0x2b')](_0x10b687);return _0x391c71['set'](_0x92fc('0x32'),_0x1607ab+'-'+_0x265b38+'/'+_0x57ad3a)[_0x92fc('0x2d')](_0x32a54b);}return null;};}function patchUpdates(_0x31d5f9){return function(_0x281c92){try{jsonpatch[_0x92fc('0x33')](_0x281c92,_0x31d5f9,!![]);}catch(_0x4b1ae8){return BPromise[_0x92fc('0x34')](_0x4b1ae8);}return _0x281c92[_0x92fc('0x35')]();};}function saveUpdates(_0x16a0fa,_0x2f0e45){return function(_0x4e781c){if(_0x4e781c){return _0x4e781c[_0x92fc('0x36')](_0x16a0fa)['then'](function(_0x5e3202){return _0x5e3202;});}return null;};}function removeEntity(_0xff7992,_0x3fc0ba){return function(_0x2e0774){if(_0x2e0774){return _0x2e0774[_0x92fc('0x37')]()[_0x92fc('0x1f')](function(){_0xff7992['status'](0xcc)[_0x92fc('0x2c')]();});}};}function handleEntityNotFound(_0x93aab7,_0x306be5){return function(_0x42e849){if(!_0x42e849){_0x93aab7['sendStatus'](0x194);}return _0x42e849;};}function handleError(_0x971c24,_0x1f62c6){_0x1f62c6=_0x1f62c6||0x1f4;return function(_0x189950){logger[_0x92fc('0x25')](_0x189950[_0x92fc('0x38')]);if(_0x189950[_0x92fc('0x39')]){delete _0x189950[_0x92fc('0x39')];}_0x971c24['status'](_0x1f62c6)['send'](_0x189950);};}exports['index']=function(_0x121fc3,_0x6e2b42){var _0x2e3230={},_0x5ef89c={},_0x434fa4={'count':0x0,'rows':[]};var _0x1fc3c3=_[_0x92fc('0x3a')](db[_0x92fc('0x3b')]['rawAttributes'],function(_0x459eba){return{'name':_0x459eba[_0x92fc('0x3c')],'type':_0x459eba['type']['key']};});_0x5ef89c['model']=_[_0x92fc('0x3a')](_0x1fc3c3,_0x92fc('0x39'));_0x5ef89c[_0x92fc('0x3d')]=_['keys'](_0x121fc3[_0x92fc('0x3d')]);_0x5ef89c['filters']=_[_0x92fc('0x3e')](_0x5ef89c[_0x92fc('0x3f')],_0x5ef89c[_0x92fc('0x3d')]);_0x2e3230[_0x92fc('0x40')]=_['intersection'](_0x5ef89c[_0x92fc('0x3f')],qs[_0x92fc('0x41')](_0x121fc3[_0x92fc('0x3d')][_0x92fc('0x41')]));_0x2e3230['attributes']=_0x2e3230[_0x92fc('0x40')]['length']?_0x2e3230[_0x92fc('0x40')]:_0x5ef89c[_0x92fc('0x3f')];if(!_0x121fc3['query'][_0x92fc('0x42')](_0x92fc('0x43'))){_0x2e3230[_0x92fc('0x2f')]=qs[_0x92fc('0x2f')](_0x121fc3[_0x92fc('0x3d')][_0x92fc('0x2f')]);_0x2e3230[_0x92fc('0x31')]=qs[_0x92fc('0x31')](_0x121fc3['query'][_0x92fc('0x31')]);}_0x2e3230[_0x92fc('0x44')]=qs['sort'](_0x121fc3[_0x92fc('0x3d')][_0x92fc('0x45')]);_0x2e3230[_0x92fc('0x46')]=qs[_0x92fc('0x47')](_[_0x92fc('0x48')](_0x121fc3[_0x92fc('0x3d')],_0x5ef89c['filters']),_0x1fc3c3);if(_0x121fc3['query'][_0x92fc('0x49')]){_0x2e3230[_0x92fc('0x46')]=_[_0x92fc('0x4a')](_0x2e3230[_0x92fc('0x46')],{'$or':_[_0x92fc('0x3a')](_0x1fc3c3,function(_0x453f0a){if(_0x453f0a[_0x92fc('0x4b')]!=='VIRTUAL'){var _0x43d0f9={};_0x43d0f9[_0x453f0a[_0x92fc('0x39')]]={'$like':'%'+_0x121fc3[_0x92fc('0x3d')][_0x92fc('0x49')]+'%'};return _0x43d0f9;}})});}_0x2e3230=_['merge']({},_0x2e3230,_0x121fc3[_0x92fc('0x4c')]);var _0x42f97c={'where':_0x2e3230[_0x92fc('0x46')]};return db[_0x92fc('0x3b')]['count'](_0x42f97c)['then'](function(_0x24a86f){_0x434fa4['count']=_0x24a86f;if(_0x121fc3[_0x92fc('0x3d')][_0x92fc('0x4d')]){_0x2e3230[_0x92fc('0x4e')]=[{'all':!![]}];}return db[_0x92fc('0x3b')][_0x92fc('0x4f')](_0x2e3230);})[_0x92fc('0x1f')](function(_0x9e5cc5){_0x434fa4['rows']=_0x9e5cc5;return _0x434fa4;})[_0x92fc('0x1f')](respondWithFilteredResult(_0x6e2b42,_0x2e3230))[_0x92fc('0x29')](handleError(_0x6e2b42,null));};exports['show']=function(_0x28ad1c,_0x509464){var _0x2777db={'raw':!![],'where':{'id':_0x28ad1c['params']['id']}},_0x4f3e0={};_0x4f3e0['model']=_[_0x92fc('0x50')](db[_0x92fc('0x3b')][_0x92fc('0x51')]);_0x4f3e0[_0x92fc('0x3d')]=_['keys'](_0x28ad1c[_0x92fc('0x3d')]);_0x4f3e0[_0x92fc('0x47')]=_[_0x92fc('0x3e')](_0x4f3e0[_0x92fc('0x3f')],_0x4f3e0[_0x92fc('0x3d')]);_0x2777db[_0x92fc('0x40')]=_['intersection'](_0x4f3e0['model'],qs['fields'](_0x28ad1c[_0x92fc('0x3d')][_0x92fc('0x41')]));_0x2777db['attributes']=_0x2777db[_0x92fc('0x40')]['length']?_0x2777db['attributes']:_0x4f3e0[_0x92fc('0x3f')];if(_0x28ad1c[_0x92fc('0x3d')][_0x92fc('0x4d')]){_0x2777db[_0x92fc('0x4e')]=[{'all':!![]}];}_0x2777db=_[_0x92fc('0x4a')]({},_0x2777db,_0x28ad1c[_0x92fc('0x4c')]);return db[_0x92fc('0x3b')][_0x92fc('0x52')](_0x2777db)[_0x92fc('0x1f')](handleEntityNotFound(_0x509464,null))['then'](respondWithResult(_0x509464,null))['catch'](handleError(_0x509464,null));};exports[_0x92fc('0x53')]=function(_0x18c7cf,_0x3a5e72){return db['SmsMessage'][_0x92fc('0x53')](_0x18c7cf['body'],{})[_0x92fc('0x1f')](respondWithResult(_0x3a5e72,0xc9))[_0x92fc('0x29')](handleError(_0x3a5e72,null));};exports[_0x92fc('0x36')]=function(_0x5c9197,_0x4fe5be){if(_0x5c9197['body']['id']){delete _0x5c9197[_0x92fc('0x54')]['id'];}return db['SmsMessage'][_0x92fc('0x52')]({'where':{'id':_0x5c9197[_0x92fc('0x55')]['id']}})['then'](handleEntityNotFound(_0x4fe5be,null))[_0x92fc('0x1f')](saveUpdates(_0x5c9197[_0x92fc('0x54')],null))[_0x92fc('0x1f')](respondWithResult(_0x4fe5be,null))[_0x92fc('0x29')](handleError(_0x4fe5be,null));};exports[_0x92fc('0x37')]=function(_0x181dc4,_0x34d9cc){return db[_0x92fc('0x3b')][_0x92fc('0x52')]({'where':{'id':_0x181dc4[_0x92fc('0x55')]['id']}})[_0x92fc('0x1f')](handleEntityNotFound(_0x34d9cc,null))[_0x92fc('0x1f')](removeEntity(_0x34d9cc,null))[_0x92fc('0x29')](handleError(_0x34d9cc,null));};exports['describe']=function(_0x3ef611,_0x4b6101){return db[_0x92fc('0x3b')]['describe']()['then'](respondWithResult(_0x4b6101,null))[_0x92fc('0x29')](handleError(_0x4b6101,null));};var interaction_log=require('../../config/logger')(_0x92fc('0x56'));exports['accept']=function(_0x55da06,_0x319c2a,_0x3d47c5){var _0x16a180={'agent':{},'channel':_0x92fc('0x57')};if(_0x55da06[_0x92fc('0x54')]['id']){delete _0x55da06[_0x92fc('0x54')]['id'];}_0x55da06[_0x92fc('0x54')][_0x92fc('0x58')]=!![];_0x55da06['body']['readAt']=moment()[_0x92fc('0x59')](_0x92fc('0x5a'));_0x55da06[_0x92fc('0x54')][_0x92fc('0x5b')]=_0x55da06[_0x92fc('0x54')][_0x92fc('0x5b')]||_0x55da06[_0x92fc('0x5c')]['id'];_0x16a180['agent']['id']=_0x55da06['body'][_0x92fc('0x5b')];return db[_0x92fc('0x3b')][_0x92fc('0x52')]({'where':{'id':_0x55da06[_0x92fc('0x55')]['id'],'UserId':null}})[_0x92fc('0x1f')](handleEntityNotFound(_0x319c2a,null))[_0x92fc('0x1f')](saveUpdates(_0x55da06[_0x92fc('0x54')],null))[_0x92fc('0x1f')](function(_0x422f85){if(_0x422f85){_0x16a180[_0x92fc('0x27')]=_0x422f85[_0x92fc('0x5d')]({'plain':!![]});return db[_0x92fc('0x5e')][_0x92fc('0x52')]({'where':{'id':_0x422f85[_0x92fc('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x319c2a,null))[_0x92fc('0x1f')](function(_0x58d417){if(_0x58d417){return _0x58d417['update']({'UserId':_0x55da06[_0x92fc('0x54')][_0x92fc('0x5b')],'read1stAt':_[_0x92fc('0x60')](_0x58d417[_0x92fc('0x61')])?moment()[_0x92fc('0x59')](_0x92fc('0x5a')):undefined});}return null;})['then'](function(_0xdf6a47){if(_0xdf6a47){_0x16a180['interaction']=_0xdf6a47[_0x92fc('0x5d')]({'plain':!![]});interaction_log[_0x92fc('0x20')](_0x92fc('0x62'),_0x55da06[_0x92fc('0x5c')]['id'],_0x55da06[_0x92fc('0x5c')][_0x92fc('0x39')],_0x55da06['user'][_0x92fc('0x63')],_0x16a180[_0x92fc('0x64')]['id'],_0x55da06[_0x92fc('0x54')]?JSON[_0x92fc('0x65')](_0x55da06[_0x92fc('0x54')]):'null');return respondWithRpcPromise(_0x92fc('0x66'),_0x92fc('0x67'),_0x16a180);}return null;})[_0x92fc('0x1f')](function(_0xa18bc8){var _0x4149bb=_0x92fc('0x68')+_0xa18bc8[_0x92fc('0x27')]['ContactId'];return db[_0x92fc('0x69')]['query'](_0x4149bb,{'type':db[_0x92fc('0x6a')][_0x92fc('0x6b')][_0x92fc('0x6c')],'raw':!![]})['then'](function(_0x37f973){return _0x37f973;});})[_0x92fc('0x1f')](function(_0x465970){if(_0x465970){_0x16a180[_0x92fc('0x27')]['contact']=_0x465970[0x0];if(!_0x55da06['body']['UserId'])return;return db[_0x92fc('0x6d')][_0x92fc('0x52')]({'where':{'id':_0x55da06[_0x92fc('0x54')][_0x92fc('0x5b')],'role':_0x92fc('0x6e')},'attributes':['id',_0x92fc('0x39'),_0x92fc('0x6f'),_0x92fc('0x70'),_0x92fc('0x71')],'raw':!![]});}return null;})[_0x92fc('0x1f')](function(_0x4a6dbf){if(!_0x4a6dbf)return null;_0x16a180[_0x92fc('0x27')][_0x92fc('0x6e')]=_0x4a6dbf;return _0x16a180;})[_0x92fc('0x1f')](function(_0x284786){if(_0x284786){if(_0x55da06['body'][_0x92fc('0x72')]){_0x16a180[_0x92fc('0x27')][_0x92fc('0x73')]=util['format']('SIP/%s',_0x55da06[_0x92fc('0x5c')][_0x92fc('0x39')]);_0x16a180[_0x92fc('0x27')][_0x92fc('0x74')]=_0x16a180[_0x92fc('0x74')];_0x16a180[_0x92fc('0x27')][_0x92fc('0x75')]=_0x16a180[_0x92fc('0x74')];_0x16a180['message'][_0x92fc('0x76')]=_0x92fc('0x77');return respondWithRpcPromise(_0x92fc('0x78'),_0x92fc('0x78'),{'event':_0x92fc('0x79'),'message':_0x16a180[_0x92fc('0x27')]},client9002)[_0x92fc('0x1f')](function(){return _0x16a180;});}return _0x16a180;}return null;})[_0x92fc('0x1f')](respondWithResult(_0x319c2a,null))['catch'](handleError(_0x319c2a,null));};var interaction_log=require(_0x92fc('0x14'))('sms-interactions');exports['reject']=function(_0x338ca6,_0x254aca,_0x22a255){var _0x4f9f75={'agent':{},'channel':_0x92fc('0x57')};if(_0x338ca6['body']['id']){delete _0x338ca6[_0x92fc('0x54')]['id'];}_0x338ca6[_0x92fc('0x54')][_0x92fc('0x5b')]=_0x338ca6[_0x92fc('0x54')][_0x92fc('0x5b')]||_0x338ca6[_0x92fc('0x5c')]['id'];_0x4f9f75[_0x92fc('0x6e')]['id']=_0x338ca6[_0x92fc('0x54')]['UserId'];return db[_0x92fc('0x3b')][_0x92fc('0x52')]({'where':{'id':_0x338ca6[_0x92fc('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x254aca,null))[_0x92fc('0x1f')](function(_0x1f2ffc){if(_0x1f2ffc){_0x4f9f75[_0x92fc('0x27')]=_0x1f2ffc[_0x92fc('0x5d')]({'plain':!![]});return db['SmsInteraction'][_0x92fc('0x52')]({'where':{'id':_0x1f2ffc['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x254aca,null))['then'](function(_0x3c82f2){if(_0x3c82f2){_0x4f9f75[_0x92fc('0x64')]=_0x3c82f2['get']({'plain':!![]});interaction_log[_0x92fc('0x20')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x338ca6[_0x92fc('0x5c')]['id'],_0x338ca6[_0x92fc('0x5c')][_0x92fc('0x39')],_0x338ca6[_0x92fc('0x5c')][_0x92fc('0x63')],_0x4f9f75['interaction']['id'],_0x338ca6['body']?JSON[_0x92fc('0x65')](_0x338ca6[_0x92fc('0x54')]):'null');return respondWithRpcPromise('RejectMessage',_0x92fc('0x7a'),_0x4f9f75);}return null;})['then'](function(_0x2dab55){var _0x311fe0=_0x92fc('0x68')+_0x2dab55[_0x92fc('0x27')][_0x92fc('0x7b')];return db[_0x92fc('0x69')][_0x92fc('0x3d')](_0x311fe0,{'type':db[_0x92fc('0x6a')][_0x92fc('0x6b')][_0x92fc('0x6c')],'raw':!![]})[_0x92fc('0x1f')](function(_0x5af37d){return _0x5af37d;});})[_0x92fc('0x1f')](function(_0x55bb6b){if(_0x55bb6b){_0x4f9f75['message']['contact']=_0x55bb6b[0x0];if(!_0x338ca6['body'][_0x92fc('0x5b')])return;return db[_0x92fc('0x6d')][_0x92fc('0x52')]({'where':{'id':_0x338ca6[_0x92fc('0x54')][_0x92fc('0x5b')],'role':'agent'},'attributes':['id',_0x92fc('0x39'),_0x92fc('0x6f'),'email',_0x92fc('0x71')],'raw':!![]});}return null;})['then'](function(_0x382137){if(!_0x382137)return null;_0x4f9f75['message']['agent']=_0x382137;return _0x4f9f75;})[_0x92fc('0x1f')](function(_0x3664df){if(_0x3664df){_0x3664df[_0x92fc('0x27')]['interface']=util[_0x92fc('0x59')](_0x92fc('0x7c'),_0x338ca6[_0x92fc('0x5c')][_0x92fc('0x39')]);_0x3664df[_0x92fc('0x27')]['channel']=_0x4f9f75[_0x92fc('0x74')];_0x3664df[_0x92fc('0x27')][_0x92fc('0x75')]=_0x4f9f75['channel'];_0x3664df[_0x92fc('0x27')][_0x92fc('0x76')]=_0x92fc('0x34');respondWithRpcPromise(_0x92fc('0x78'),_0x92fc('0x78'),{'event':_0x92fc('0x7d'),'message':_0x3664df[_0x92fc('0x27')]},client9002);return _0x4f9f75;}return null;})[_0x92fc('0x1f')](respondWithResult(_0x254aca,null))[_0x92fc('0x29')](handleError(_0x254aca,null));};exports[_0x92fc('0x2b')]=function(_0x3ec9c1,_0x5d2296,_0x2c2d53){if(_0x3ec9c1[_0x92fc('0x54')]['id']){delete _0x3ec9c1[_0x92fc('0x54')]['id'];}var _0xe8d44d;return db[_0x92fc('0x3b')][_0x92fc('0x52')]({'where':{'id':_0x3ec9c1[_0x92fc('0x55')]['id']}})[_0x92fc('0x1f')](handleEntityNotFound(_0x5d2296,null))[_0x92fc('0x1f')](function(_0x2f8e4b){if(_0x2f8e4b){_0xe8d44d=_0x2f8e4b;return db['SmsAccount'][_0x92fc('0x52')]({'where':{'id':_0x2f8e4b[_0x92fc('0x7e')]}});}})[_0x92fc('0x1f')](handleEntityNotFound(_0x5d2296,null))[_0x92fc('0x1f')](function(_0x20fb87){if(_0x20fb87){logger['debug'](_0x92fc('0x24'),_0x92fc('0x2b'),'received\x20delivery\x20report\x20from',_0x20fb87['type'],util[_0x92fc('0x7f')](_0x3ec9c1[_0x92fc('0x54')],{'showHidden':![],'depth':null}));switch(_0x20fb87[_0x92fc('0x4b')]){case _0x92fc('0x80'):if(_0x3ec9c1[_0x92fc('0x54')][_0x92fc('0x81')]&&_0x3ec9c1[_0x92fc('0x54')][_0x92fc('0x81')]===_0xe8d44d['messageId']){return _0xe8d44d[_0x92fc('0x36')]({'read':!![]});}else{logger[_0x92fc('0x25')](_0x92fc('0x82'),'status',_0x92fc('0x80'),util[_0x92fc('0x7f')](_0x3ec9c1[_0x92fc('0x54')],{'showHidden':![],'depth':null}));}break;case _0x92fc('0x83'):if(_0x3ec9c1[_0x92fc('0x54')][_0x92fc('0x84')]&&_0x3ec9c1[_0x92fc('0x54')]['MessageUUID']===_0xe8d44d[_0x92fc('0x85')]&&_[_0x92fc('0x86')]([_0x92fc('0x87'),_0x92fc('0x88')],_0x3ec9c1[_0x92fc('0x54')]['Status'])>=0x0){return _0xe8d44d[_0x92fc('0x36')]({'read':!![]});}else{logger[_0x92fc('0x25')](_0x92fc('0x82'),_0x92fc('0x2b'),_0x92fc('0x89'),util[_0x92fc('0x7f')](_0x3ec9c1[_0x92fc('0x54')],{'showHidden':![],'depth':null}));}break;case _0x92fc('0x8a'):var _0x282813=_0x3ec9c1[_0x92fc('0x54')][_0x92fc('0x8b')][0x0];if(_0x282813[_0x92fc('0x2b')][_0x92fc('0x8c')]===_0x92fc('0x8d')){return _0xe8d44d[_0x92fc('0x36')]({'read':!![]});}else{logger['error'](_0x92fc('0x82'),_0x92fc('0x2b'),'infobip',util[_0x92fc('0x7f')](_0x3ec9c1['body'],{'showHidden':![],'depth':null}));}break;}return _0xe8d44d;}})['then'](respondWithResult(_0x5d2296,null))[_0x92fc('0x29')](handleError(_0x5d2296,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ab3c18b..cab7b56 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 _0xd4c0=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd4c0,0x1e6));var _0x0d4c=function(_0x15c8ec,_0x86c823){_0x15c8ec=_0x15c8ec-0x0;var _0x2cfefc=_0xd4c0[_0x15c8ec];return _0x2cfefc;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x0d4c('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0d4c('0x1')](0x0);var events={'afterCreate':_0x0d4c('0x2'),'afterUpdate':_0x0d4c('0x3'),'afterDestroy':_0x0d4c('0x4')};function emitEvent(_0x404252){return function(_0x27753d,_0xc028ab,_0x50e7fb){SmsMessageEvents[_0x0d4c('0x5')](_0x404252+':'+_0x27753d['id'],_0x27753d);SmsMessageEvents[_0x0d4c('0x5')](_0x404252,_0x27753d);_0x50e7fb(null);};}for(var e in events){if(events[_0x0d4c('0x6')](e)){var event=events[e];SmsMessage[_0x0d4c('0x7')](e,emitEvent(event));}}module[_0x0d4c('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x34b5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x59d07e,_0x58383e){var _0x229c0b=function(_0x14144f){while(--_0x14144f){_0x59d07e['push'](_0x59d07e['shift']());}};_0x229c0b(++_0x58383e);}(_0x34b5,0x88));var _0x534b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x34b5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x534b('0x0'));var SmsMessage=require(_0x534b('0x1'))['db'][_0x534b('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x534b('0x3')](0x0);var events={'afterCreate':_0x534b('0x4'),'afterUpdate':_0x534b('0x5'),'afterDestroy':_0x534b('0x6')};function emitEvent(_0x1257f1){return function(_0x6c1df5,_0x503234,_0x3de976){SmsMessageEvents[_0x534b('0x7')](_0x1257f1+':'+_0x6c1df5['id'],_0x6c1df5);SmsMessageEvents[_0x534b('0x7')](_0x1257f1,_0x6c1df5);_0x3de976(null);};}for(var e in events){if(events[_0x534b('0x8')](e)){var event=events[e];SmsMessage[_0x534b('0x9')](e,emitEvent(event));}}module[_0x534b('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 2e3e0a8..22a9629 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 _0x1285=['uuid','apiMessageId','clickatell','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','refid','status','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','findOne','SmsInteractionId','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','/status?token=','then','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','password','smsMethod','login?username=','username','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','senderString','%s:%s','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','timestamp','keys','createHash','digest','hex','signature=','/external/get/send.php?','https://platform.clickatell.com/messages'];(function(_0x27d460,_0x3656d0){var _0x1ec9b0=function(_0x3a95c4){while(--_0x3a95c4){_0x27d460['push'](_0x27d460['shift']());}};_0x1ec9b0(++_0x3656d0);}(_0x1285,0x8c));var _0x5128=function(_0x6fe240,_0x1827a6){_0x6fe240=_0x6fe240-0x0;var _0x2fc18b=_0x1285[_0x6fe240];return _0x2fc18b;};'use strict';var _=require(_0x5128('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5128('0x1'));var moment=require(_0x5128('0x2'));var BPromise=require(_0x5128('0x3'));var rp=require(_0x5128('0x4'));var fs=require('fs');var path=require(_0x5128('0x5'));var rimraf=require(_0x5128('0x6'));var config=require('../../config/environment');var attributes=require(_0x5128('0x7'));module[_0x5128('0x8')]=function(_0x4cae8b,_0x2ad52a){return _0x4cae8b[_0x5128('0x9')]('SmsMessage',attributes,{'tableName':_0x5128('0xa'),'paranoid':![],'indexes':[{'name':_0x5128('0xb'),'fields':['messageId']},{'name':_0x5128('0xc'),'fields':[_0x5128('0xd')],'type':_0x5128('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41bb8a,_0x49da18,_0x1a4084){var _0x5c56fd=_0x4cae8b['models'];var _0x478d72=_0x41bb8a[_0x5128('0xf')]({'plain':!![]});if(_0x478d72['direction'][_0x5128('0x10')]()==='in'||_0x478d72[_0x5128('0x11')][_0x5128('0x10')]()==='out'&&!_0x478d72[_0x5128('0x12')]&&!_[_0x5128('0x13')](_0x478d72['UserId'])&&!_[_0x5128('0x13')](_0x478d72['SmsInteractionId'])){_0x5c56fd['SmsInteraction'][_0x5128('0x14')]({'where':{'id':_0x478d72[_0x5128('0x15')]}})['then'](function(_0x1629e3){if(_0x1629e3){_0x1629e3[_0x5128('0x16')]({'lastMsgAt':_0x478d72[_0x5128('0x17')],'lastMsgDirection':_0x478d72['direction'][_0x5128('0x10')]()});}})[_0x5128('0x18')](function(_0x16322f){console[_0x5128('0x19')](_0x16322f);});}if(_0x478d72[_0x5128('0x11')]==='out'&&!_0x478d72[_0x5128('0x12')]){var _0x4cfa99;_0x5c56fd[_0x5128('0x1a')][_0x5128('0x1b')]({'where':{'id':_0x478d72[_0x5128('0x1c')]},'raw':!![]})['then'](function(_0x1bd2a3){_0x4cfa99=_0x1bd2a3;if(_0x4cfa99&&_0x4cfa99[_0x5128('0x1d')]){switch(_0x4cfa99[_0x5128('0x1d')]){case _0x5128('0x1e'):var _0x431cd1=require(_0x5128('0x1e'));if(_0x4cfa99[_0x5128('0x1f')]&&_0x4cfa99['authToken']&&_0x4cfa99[_0x5128('0x20')]){var _0x512ad9=new _0x431cd1(_0x4cfa99['accountSid'],_0x4cfa99[_0x5128('0x21')]);_0x512ad9[_0x5128('0x22')][_0x5128('0x23')]({'body':_0x478d72[_0x5128('0xd')],'to':_0x478d72[_0x5128('0x20')],'from':_0x4cfa99[_0x5128('0x20')],'statusCallback':_0x4cfa99[_0x5128('0x24')]+_0x5128('0x25')+_0x478d72['id']+_0x5128('0x26')+_0x4cfa99['token']})[_0x5128('0x27')](function(_0x201843){if(_0x201843[_0x5128('0x28')]){return _0x41bb8a[_0x5128('0x16')]({'messageId':_0x201843[_0x5128('0x28')]});}})[_0x5128('0x18')](function(_0x8905fb){logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x1e'),util[_0x5128('0x2b')](_0x8905fb,{'showHidden':![],'depth':null}));});}else{logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),'twilio',_0x5128('0x2c'));}break;case _0x5128('0x2d'):var _0x4b92d6='https://api.skebby.it/API/v1.0/REST/';if(_0x4cfa99['username']&&_0x4cfa99[_0x5128('0x2e')]){var _0x28140e={'recipient':[_0x478d72['phone']],'message':_0x478d72[_0x5128('0xd')],'message_type':_0x4cfa99[_0x5128('0x2f')]};if(_0x4cfa99['smsMethod']&&_0x4cfa99['smsMethod']!=='SI'){_0x28140e['sender']=_0x4cfa99[_0x5128('0x20')];}var _0x185bf1={'url':_0x4b92d6+_0x5128('0x30')+_0x4cfa99[_0x5128('0x31')]+_0x5128('0x32')+_0x4cfa99[_0x5128('0x2e')],'method':_0x5128('0x33')};rp(_0x185bf1)[_0x5128('0x27')](function(_0x467055){var _0x36cbb0=_0x467055[_0x5128('0x34')](';');var _0x6a7463={'user_key':_0x36cbb0[0x0],'session_key':_0x36cbb0[0x1]};_0x185bf1={'url':_0x4b92d6+_0x5128('0x35'),'method':_0x5128('0x36'),'headers':{'user_key':_0x6a7463[_0x5128('0x37')],'Session_key':_0x6a7463['session_key']},'json':!![],'body':_0x28140e};return rp(_0x185bf1);})[_0x5128('0x27')](function(_0x136fc4){if(_0x136fc4[_0x5128('0x38')]>=0x1){var _0x2545f3={'messageId':_0x136fc4[_0x5128('0x39')]};if(_0x4cfa99[_0x5128('0x2f')]!=='GP'||!_0x4cfa99[_0x5128('0x3a')]){_0x2545f3[_0x5128('0x3b')]=!![];}return _0x41bb8a[_0x5128('0x16')](_0x2545f3);}else{return logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x2d'),util[_0x5128('0x2b')](_0x136fc4,{'showHidden':![],'depth':null}));}})[_0x5128('0x18')](function(_0x1850a1){return logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),'skebby',util['inspect'](_0x1850a1,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5128('0x2a'),_0x5128('0x2d'),_0x5128('0x3c'));}break;case _0x5128('0x3d'):if(_0x4cfa99[_0x5128('0x21')]){var _0x3dac11={'recipient':_0x478d72[_0x5128('0x20')],'message':_0x478d72[_0x5128('0xd')],'sender':_0x4cfa99['senderString']||_0x4cfa99[_0x5128('0x20')],'authorization':_0x4cfa99[_0x5128('0x21')]};var _0x49da18={'method':'POST','uri':_0x5128('0x3e'),'body':_0x3dac11,'json':!![]};rp(_0x49da18)['then'](function(_0xe497c4){var _0x237f11={'messageId':_0xe497c4[_0x5128('0x3f')]};if(!_0x4cfa99['deliveryReport']){_0x237f11[_0x5128('0x3b')]=!![];}return _0x41bb8a[_0x5128('0x16')](_0x237f11);})[_0x5128('0x18')](function(_0x491bcd){logger['error'](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x3d'),util[_0x5128('0x2b')](_0x491bcd,{'showHidden':![],'depth':null}));});}else{logger[_0x5128('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5128('0x2a'),_0x5128('0x3d'),'Missing\x20parameters:\x20authToken');}break;case _0x5128('0x40'):if(_0x4cfa99[_0x5128('0x31')]&&_0x4cfa99[_0x5128('0x2e')]){var _0x3dac11={'messages':[{'source':'xCALLY\x20Motion','to':_0x478d72[_0x5128('0x20')],'body':_0x478d72[_0x5128('0xd')],'from':_0x4cfa99[_0x5128('0x41')]||_0x4cfa99['phone']}]};var _0x5eefd8=util['format'](_0x5128('0x42'),_0x4cfa99['username'],_0x4cfa99[_0x5128('0x2e')]);var _0x49da18={'method':_0x5128('0x36'),'uri':_0x5128('0x43'),'body':_0x3dac11,'headers':{'Authorization':util[_0x5128('0x44')]('Basic\x20%s',new Buffer(_0x5eefd8)[_0x5128('0x45')](_0x5128('0x46')))},'json':!![]};rp(_0x49da18)['then'](function(_0x43e93b){if(_0x43e93b['http_code']>=0xc8&&_0x43e93b[_0x5128('0x47')]<=0xce){if(_0x43e93b[_0x5128('0x48')]&&_0x43e93b[_0x5128('0x48')][_0x5128('0x49')]>0x0){var _0x2c7a26=_[_0x5128('0x4a')](_0x43e93b[_0x5128('0x48')][_0x5128('0x22')]);var _0x43b445={'messageId':_0x2c7a26[_0x5128('0x4b')]};if(!_0x4cfa99[_0x5128('0x3a')]){_0x43b445['read']=!![];}return _0x41bb8a[_0x5128('0x16')](_0x43b445);}else{logger[_0x5128('0x19')](_0x5128('0x29'),'afterCreate',_0x5128('0x4c'),util[_0x5128('0x2b')](_0x43e93b,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x5128('0x2b')](_0x43e93b,{'showHidden':![],'depth':null}));}})[_0x5128('0x18')](function(_0x12f107){logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),'clickSend',util['inspect'](_0x12f107,{'showHidden':![],'depth':null}));});}else{logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),'clickSend',_0x5128('0x3c'));}break;case _0x5128('0x4d'):if(_0x4cfa99[_0x5128('0x4e')]&&_0x4cfa99[_0x5128('0x21')]){var _0x3dac11={'dst':_0x478d72[_0x5128('0x20')],'text':_0x478d72['body'],'src':_0x4cfa99[_0x5128('0x41')]||_0x4cfa99[_0x5128('0x20')],'url':_0x4cfa99[_0x5128('0x24')]+'/api/sms/messages/'+_0x478d72['id']+_0x5128('0x26')+_0x4cfa99[_0x5128('0x4f')]};var _0x5eefd8=util[_0x5128('0x44')](_0x5128('0x42'),_0x4cfa99[_0x5128('0x4e')],_0x4cfa99[_0x5128('0x21')]);var _0x49da18={'method':_0x5128('0x36'),'uri':util[_0x5128('0x44')](_0x5128('0x50'),_0x4cfa99['authId']),'body':_0x3dac11,'headers':{'Authorization':util[_0x5128('0x44')](_0x5128('0x51'),new Buffer(_0x5eefd8)[_0x5128('0x45')](_0x5128('0x46')))},'json':!![]};rp(_0x49da18)['then'](function(_0x4da188){var _0x151478={'messageId':_0x4da188[_0x5128('0x52')][0x0]};return _0x41bb8a[_0x5128('0x16')](_0x151478);})[_0x5128('0x18')](function(_0x17e2b4){logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x4d'),util[_0x5128('0x2b')](_0x17e2b4,{'showHidden':![],'depth':null}));});}else{logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x5128('0x53'):if(_0x4cfa99['username']&&_0x4cfa99[_0x5128('0x2e')]){if(_0x4cfa99['baseUrl']){var _0x14e51c={'method':'POST','uri':_0x4cfa99[_0x5128('0x54')]+_0x5128('0x55'),'body':{'username':_0x4cfa99[_0x5128('0x31')],'password':_0x4cfa99[_0x5128('0x2e')]},'json':!![]};return rp(_0x14e51c)[_0x5128('0x27')](function(_0x59a37c){var _0x1b0079={'method':_0x5128('0x36'),'uri':_0x4cfa99['baseUrl']+_0x5128('0x56'),'body':{'messages':[{'from':_0x4cfa99[_0x5128('0x20')],'destinations':[{'to':_0x478d72[_0x5128('0x20')]}],'text':_0x478d72[_0x5128('0xd')],'notifyUrl':_0x4cfa99[_0x5128('0x24')]+_0x5128('0x25')+_0x478d72['id']+_0x5128('0x26')+_0x4cfa99[_0x5128('0x4f')],'notifyContentType':_0x5128('0x57'),'callbackData':_0x4cfa99[_0x5128('0x20')]+';'+_0x478d72['body']}]},'headers':{'Authorization':_0x5128('0x58')+_0x59a37c[_0x5128('0x4f')]},'json':!![]};return rp(_0x1b0079)['then'](function(_0x481dd2){if(_0x481dd2[_0x5128('0x22')]){var _0xf8dfdb={'messageId':_0x481dd2[_0x5128('0x22')][0x0][_0x5128('0xb')]};if(!_0x4cfa99[_0x5128('0x3a')]){_0xf8dfdb[_0x5128('0x3b')]=!![];}return _0x41bb8a[_0x5128('0x16')](_0xf8dfdb);}else{return logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x53'),util[_0x5128('0x2b')](_0x481dd2,{'showHidden':![],'depth':null}));}});})[_0x5128('0x18')](function(_0x41a686){return logger['error'](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x53'),util[_0x5128('0x2b')](_0x41a686,{'showHidden':![],'depth':null}));});}else{logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x53'),_0x5128('0x59'));}}else{logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x53'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x5128('0x5a'):var _0x1db36b=require(_0x5128('0x5b'));if(_0x4cfa99[_0x5128('0x5c')]){var _0x1768e3={};_0x1768e3[_0x5128('0x5d')]=_0x4cfa99['username'];_0x1768e3[_0x5128('0x20')]=_0x478d72[_0x5128('0x20')];_0x1768e3[_0x5128('0x5e')]=_0x4cfa99[_0x5128('0x20')];_0x1768e3[_0x5128('0x5f')]=_0x478d72[_0x5128('0xd')];_0x1768e3[_0x5128('0x60')]=+new Date();var _0x28bd04='';var _0x138719='';var _0x8be9e2=Object[_0x5128('0x61')](_0x1768e3);_0x8be9e2['sort']();for(var _0x3ab586=0x0;_0x3ab586<_0x8be9e2['length'];_0x3ab586++){if(_0x28bd04!=''){_0x28bd04+='&';}_0x28bd04+=_0x8be9e2[_0x3ab586]+'='+encodeURIComponent(_0x1768e3[_0x8be9e2[_0x3ab586]]);_0x138719+=_0x1768e3[_0x8be9e2[_0x3ab586]];}_0x138719+=_0x4cfa99[_0x5128('0x5c')];_0x138719=_0x1db36b[_0x5128('0x62')]('md5')[_0x5128('0x16')](_0x138719)[_0x5128('0x63')](_0x5128('0x64'));if(_0x28bd04!==''){_0x28bd04+='&';}_0x28bd04+=_0x5128('0x65')+_0x138719;var _0x185bf1={'method':_0x5128('0x33'),'uri':_0x4cfa99['baseUrl']+_0x5128('0x66')+_0x28bd04,'json':!![]};return rp(_0x185bf1)[_0x5128('0x27')](function(_0x50f693){var _0x535782=Object[_0x5128('0x61')](_0x50f693);if(_0x50f693[_0x535782[0x0]][_0x5128('0x19')]&&parseInt(_0x50f693[_0x535782[0x0]]['error'])===0x0){var _0x41f19f={'messageId':_0x50f693[_0x535782[0x0]]['id_sms']};if(!_0x4cfa99[_0x5128('0x3a')]){_0x41f19f[_0x5128('0x3b')]=!![];}return _0x41bb8a[_0x5128('0x16')](_0x41f19f);}else{return logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x5a'),util[_0x5128('0x2b')](_0x50f693[_0x5128('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x49a762){return logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x5a'),util[_0x5128('0x2b')](_0x49a762,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5128('0x2a'),_0x5128('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0x4cfa99[_0x5128('0x5c')]){var _0xedefa1={'method':_0x5128('0x36'),'uri':_0x5128('0x67'),'headers':{'Authorization':_0x4cfa99[_0x5128('0x5c')]},'body':{'content':_0x478d72[_0x5128('0xd')],'to':[_0x478d72[_0x5128('0x20')]],'from':_0x4cfa99[_0x5128('0x20')],'binary':![],'clientMessageId':_0x5128('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0xedefa1)[_0x5128('0x27')](function(_0x3c73fd){if(!_0x3c73fd[_0x5128('0x19')]){var _0x260161={'messageId':_0x3c73fd[_0x5128('0x22')][0x0][_0x5128('0x69')]};if(!_0x4cfa99[_0x5128('0x3a')]){_0x260161[_0x5128('0x3b')]=!![];}return _0x41bb8a[_0x5128('0x16')](_0x260161);}else{return logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x6a'),util['inspect'](_0x3c73fd['error'],{'showHidden':![],'depth':null}));}})[_0x5128('0x18')](function(_0x46958f){return logger['error'](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x6a'),util[_0x5128('0x2b')](_0x46958f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5128('0x2a'),_0x5128('0x6a'),_0x5128('0x6b'));}break;case'bandwidth':if(_0x4cfa99[_0x5128('0x31')]&&_0x4cfa99[_0x5128('0x2e')]){var _0x5eefd8=util[_0x5128('0x44')](_0x5128('0x42'),_0x4cfa99[_0x5128('0x31')],_0x4cfa99[_0x5128('0x2e')]);var _0x49da18={'method':_0x5128('0x36'),'uri':_0x5128('0x6c')+_0x4cfa99['accountId']+_0x5128('0x6d'),'body':{'to':[_0x478d72[_0x5128('0x20')]],'text':_0x478d72[_0x5128('0xd')],'from':_0x4cfa99[_0x5128('0x20')],'applicationId':_0x4cfa99[_0x5128('0x6e')]},'headers':{'Authorization':util[_0x5128('0x44')](_0x5128('0x51'),new Buffer(_0x5eefd8)[_0x5128('0x45')](_0x5128('0x46')))},'json':!![]};rp(_0x49da18)['then'](function(_0x1a2fe1){if(_0x1a2fe1['id']){var _0x194833={'messageId':_0x1a2fe1['id']};return _0x41bb8a['update'](_0x194833);}else{logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x6f'),util[_0x5128('0x2b')](_0x1a2fe1,{'showHidden':![],'depth':null}));}})[_0x5128('0x18')](function(_0x4c42e1){logger['error'](_0x5128('0x29'),'afterCreate',_0x5128('0x6f'),util['inspect'](_0x4c42e1,{'showHidden':![],'depth':null}));});}else{logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),'bandwidth',_0x5128('0x3c'));}break;case _0x5128('0x70'):if(_0x4cfa99[_0x5128('0x5c')]){var _0x56e191={};var _0x185bf1={'method':'POST','uri':_0x5128('0x71'),'headers':{'Authorization':_0x5128('0x72')+_0x4cfa99[_0x5128('0x5c')],'Content-Type':'application/json'},'body':{'from':_0x4cfa99[_0x5128('0x20')],'to':_0x478d72[_0x5128('0x20')],'text':_0x478d72['body']},'json':!![]};return rp(_0x185bf1)[_0x5128('0x27')](function(_0x1bedfc){if(_0x1bedfc[_0x5128('0x73')]==0xca){_0x56e191[_0x5128('0x74')]=_0x1bedfc;var _0x109bb0={'method':_0x5128('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x5128('0x72')+_0x4cfa99[_0x5128('0x5c')],'Content-Type':_0x5128('0x57')},'body':{'refid':_0x56e191[_0x5128('0x74')][_0x5128('0x75')]},'json':!![]};return rp(_0x109bb0)[_0x5128('0x27')](function(_0x374d85){_0x56e191[_0x5128('0x76')]=_0x374d85;var _0x3ca792={'messageId':_0x56e191[_0x5128('0x74')][_0x5128('0x75')],'read':!![]};return _0x41bb8a[_0x5128('0x16')](_0x3ca792);});}else{return logger[_0x5128('0x19')](_0x5128('0x29'),_0x5128('0x2a'),_0x5128('0x70'),util[_0x5128('0x2b')](_0x1bedfc,{'showHidden':![],'depth':null}));}})[_0x5128('0x18')](function(_0x4c76cd){return logger[_0x5128('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5128('0x2a'),_0x5128('0x70'),util[_0x5128('0x2b')](_0x4c76cd,{'showHidden':![],'depth':null}));});}else{return logger[_0x5128('0x19')](_0x5128('0x29'),'afterCreate',_0x5128('0x70'),_0x5128('0x77'));}break;}}})[_0x5128('0x78')](function(){_0x1a4084();});}else{_0x1a4084();}}},'charset':'utf8mb4','collate':_0x5128('0x79')});}; \ No newline at end of file +var _0x5390=['apiKey','https://platform.clickatell.com/messages','UTF-8','clickatell','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','utf8mb4','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','body','remote','/api/sms/messages/','/status?token=','token','sid','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','queued_count','data','message_id','clickSend','plivo','authId','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','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','login','text','timestamp','keys','createHash','md5','digest','hex','/external/get/send.php?'];(function(_0x45aaf9,_0x222e1b){var _0x5aca09=function(_0x4c8f18){while(--_0x4c8f18){_0x45aaf9['push'](_0x45aaf9['shift']());}};_0x5aca09(++_0x222e1b);}(_0x5390,0x8d));var _0x0539=function(_0x2c012b,_0x5b3f5c){_0x2c012b=_0x2c012b-0x0;var _0x380a13=_0x5390[_0x2c012b];return _0x380a13;};'use strict';var _=require(_0x0539('0x0'));var util=require(_0x0539('0x1'));var logger=require('../../config/logger')(_0x0539('0x2'));var moment=require(_0x0539('0x3'));var BPromise=require(_0x0539('0x4'));var rp=require(_0x0539('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0539('0x6'));var attributes=require(_0x0539('0x7'));module['exports']=function(_0x8a834e,_0x565c53){return _0x8a834e[_0x0539('0x8')](_0x0539('0x9'),attributes,{'tableName':_0x0539('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x0539('0xb')]},{'name':_0x0539('0xc'),'fields':['body'],'type':_0x0539('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fe683,_0x5d845a,_0x9f72e5){var _0x22014a=_0x8a834e[_0x0539('0xe')];var _0x4d36e6=_0x1fe683[_0x0539('0xf')]({'plain':!![]});if(_0x4d36e6['direction'][_0x0539('0x10')]()==='in'||_0x4d36e6[_0x0539('0x11')][_0x0539('0x10')]()===_0x0539('0x12')&&!_0x4d36e6[_0x0539('0x13')]&&!_[_0x0539('0x14')](_0x4d36e6[_0x0539('0x15')])&&!_[_0x0539('0x14')](_0x4d36e6['SmsInteractionId'])){_0x22014a[_0x0539('0x16')][_0x0539('0x17')]({'where':{'id':_0x4d36e6[_0x0539('0x18')]}})[_0x0539('0x19')](function(_0x546199){if(_0x546199){_0x546199[_0x0539('0x1a')]({'lastMsgAt':_0x4d36e6[_0x0539('0x1b')],'lastMsgDirection':_0x4d36e6[_0x0539('0x11')][_0x0539('0x10')]()});}})[_0x0539('0x1c')](function(_0x4bb856){console[_0x0539('0x1d')](_0x4bb856);});}if(_0x4d36e6[_0x0539('0x11')]===_0x0539('0x12')&&!_0x4d36e6[_0x0539('0x13')]){var _0xcc57df;_0x22014a['SmsAccount'][_0x0539('0x1e')]({'where':{'id':_0x4d36e6[_0x0539('0x1f')]},'raw':!![]})[_0x0539('0x19')](function(_0x5bc68a){_0xcc57df=_0x5bc68a;if(_0xcc57df&&_0xcc57df[_0x0539('0x20')]){switch(_0xcc57df[_0x0539('0x20')]){case _0x0539('0x21'):var _0x3c22b3=require(_0x0539('0x21'));if(_0xcc57df['accountSid']&&_0xcc57df[_0x0539('0x22')]&&_0xcc57df[_0x0539('0x23')]){var _0x145951=new _0x3c22b3(_0xcc57df[_0x0539('0x24')],_0xcc57df['authToken']);_0x145951[_0x0539('0x25')]['create']({'body':_0x4d36e6[_0x0539('0x26')],'to':_0x4d36e6[_0x0539('0x23')],'from':_0xcc57df[_0x0539('0x23')],'statusCallback':_0xcc57df[_0x0539('0x27')]+_0x0539('0x28')+_0x4d36e6['id']+_0x0539('0x29')+_0xcc57df[_0x0539('0x2a')]})[_0x0539('0x19')](function(_0x572ed7){if(_0x572ed7['sid']){return _0x1fe683[_0x0539('0x1a')]({'messageId':_0x572ed7[_0x0539('0x2b')]});}})[_0x0539('0x1c')](function(_0x20aa82){logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0539('0x21'),util[_0x0539('0x2c')](_0x20aa82,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x21'),_0x0539('0x2f'));}break;case _0x0539('0x30'):var _0x43e49d=_0x0539('0x31');if(_0xcc57df['username']&&_0xcc57df[_0x0539('0x32')]){var _0x3654ca={'recipient':[_0x4d36e6['phone']],'message':_0x4d36e6['body'],'message_type':_0xcc57df['smsMethod']};if(_0xcc57df['smsMethod']&&_0xcc57df[_0x0539('0x33')]!=='SI'){_0x3654ca[_0x0539('0x34')]=_0xcc57df[_0x0539('0x23')];}var _0x352c06={'url':_0x43e49d+_0x0539('0x35')+_0xcc57df[_0x0539('0x36')]+_0x0539('0x37')+_0xcc57df['password'],'method':_0x0539('0x38')};rp(_0x352c06)[_0x0539('0x19')](function(_0x5615b2){var _0x3c120d=_0x5615b2[_0x0539('0x39')](';');var _0x10bb61={'user_key':_0x3c120d[0x0],'session_key':_0x3c120d[0x1]};_0x352c06={'url':_0x43e49d+_0x0539('0x3a'),'method':'POST','headers':{'user_key':_0x10bb61['user_key'],'Session_key':_0x10bb61[_0x0539('0x3b')]},'json':!![],'body':_0x3654ca};return rp(_0x352c06);})[_0x0539('0x19')](function(_0x371e55){if(_0x371e55[_0x0539('0x3c')]>=0x1){var _0x873455={'messageId':_0x371e55[_0x0539('0x3d')]};if(_0xcc57df[_0x0539('0x33')]!=='GP'||!_0xcc57df[_0x0539('0x3e')]){_0x873455[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x873455);}else{return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x30'),util[_0x0539('0x2c')](_0x371e55,{'showHidden':![],'depth':null}));}})[_0x0539('0x1c')](function(_0x29d05b){return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x30'),util[_0x0539('0x2c')](_0x29d05b,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),'skebby',_0x0539('0x40'));}break;case _0x0539('0x41'):if(_0xcc57df[_0x0539('0x22')]){var _0x45f519={'recipient':_0x4d36e6[_0x0539('0x23')],'message':_0x4d36e6[_0x0539('0x26')],'sender':_0xcc57df[_0x0539('0x42')]||_0xcc57df[_0x0539('0x23')],'authorization':_0xcc57df[_0x0539('0x22')]};var _0x5d845a={'method':_0x0539('0x43'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x45f519,'json':!![]};rp(_0x5d845a)[_0x0539('0x19')](function(_0x3773c3){var _0x406e5a={'messageId':_0x3773c3[_0x0539('0x44')]};if(!_0xcc57df['deliveryReport']){_0x406e5a[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x406e5a);})[_0x0539('0x1c')](function(_0x3e69b7){logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),'connectel',util[_0x0539('0x2c')](_0x3e69b7,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x41'),_0x0539('0x45'));}break;case _0x0539('0x46'):if(_0xcc57df[_0x0539('0x36')]&&_0xcc57df[_0x0539('0x32')]){var _0x45f519={'messages':[{'source':_0x0539('0x47'),'to':_0x4d36e6[_0x0539('0x23')],'body':_0x4d36e6[_0x0539('0x26')],'from':_0xcc57df['senderString']||_0xcc57df[_0x0539('0x23')]}]};var _0xbb4d7d=util[_0x0539('0x48')](_0x0539('0x49'),_0xcc57df[_0x0539('0x36')],_0xcc57df[_0x0539('0x32')]);var _0x5d845a={'method':_0x0539('0x43'),'uri':_0x0539('0x4a'),'body':_0x45f519,'headers':{'Authorization':util[_0x0539('0x48')](_0x0539('0x4b'),new Buffer(_0xbb4d7d)['toString'](_0x0539('0x4c')))},'json':!![]};rp(_0x5d845a)[_0x0539('0x19')](function(_0x3b0839){if(_0x3b0839[_0x0539('0x4d')]>=0xc8&&_0x3b0839[_0x0539('0x4d')]<=0xce){if(_0x3b0839['data']&&_0x3b0839['data'][_0x0539('0x4e')]>0x0){var _0x57706d=_['head'](_0x3b0839[_0x0539('0x4f')]['messages']);var _0x4054df={'messageId':_0x57706d[_0x0539('0x50')]};if(!_0xcc57df['deliveryReport']){_0x4054df[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x4054df);}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x51'),util[_0x0539('0x2c')](_0x3b0839,{'showHidden':![],'depth':null}));}}else{logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x51'),util[_0x0539('0x2c')](_0x3b0839,{'showHidden':![],'depth':null}));}})['catch'](function(_0x44bf7e){logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x51'),util['inspect'](_0x44bf7e,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x51'),_0x0539('0x40'));}break;case _0x0539('0x52'):if(_0xcc57df[_0x0539('0x53')]&&_0xcc57df['authToken']){var _0x45f519={'dst':_0x4d36e6[_0x0539('0x23')],'text':_0x4d36e6[_0x0539('0x26')],'src':_0xcc57df[_0x0539('0x42')]||_0xcc57df[_0x0539('0x23')],'url':_0xcc57df[_0x0539('0x27')]+_0x0539('0x28')+_0x4d36e6['id']+_0x0539('0x29')+_0xcc57df[_0x0539('0x2a')]};var _0xbb4d7d=util['format'](_0x0539('0x49'),_0xcc57df[_0x0539('0x53')],_0xcc57df[_0x0539('0x22')]);var _0x5d845a={'method':_0x0539('0x43'),'uri':util[_0x0539('0x48')](_0x0539('0x54'),_0xcc57df[_0x0539('0x53')]),'body':_0x45f519,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0xbb4d7d)[_0x0539('0x55')](_0x0539('0x4c')))},'json':!![]};rp(_0x5d845a)[_0x0539('0x19')](function(_0x478888){var _0x24f360={'messageId':_0x478888[_0x0539('0x56')][0x0]};return _0x1fe683['update'](_0x24f360);})['catch'](function(_0x20e999){logger['error'](_0x0539('0x2d'),_0x0539('0x2e'),'plivo',util[_0x0539('0x2c')](_0x20e999,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),'afterCreate','plivo',_0x0539('0x57'));}break;case _0x0539('0x58'):if(_0xcc57df['username']&&_0xcc57df[_0x0539('0x32')]){if(_0xcc57df[_0x0539('0x59')]){var _0xd076db={'method':_0x0539('0x43'),'uri':_0xcc57df['baseUrl']+_0x0539('0x5a'),'body':{'username':_0xcc57df['username'],'password':_0xcc57df[_0x0539('0x32')]},'json':!![]};return rp(_0xd076db)['then'](function(_0x21ccd6){var _0x2cbc9e={'method':'POST','uri':_0xcc57df[_0x0539('0x59')]+_0x0539('0x5b'),'body':{'messages':[{'from':_0xcc57df[_0x0539('0x23')],'destinations':[{'to':_0x4d36e6[_0x0539('0x23')]}],'text':_0x4d36e6['body'],'notifyUrl':_0xcc57df[_0x0539('0x27')]+_0x0539('0x28')+_0x4d36e6['id']+_0x0539('0x29')+_0xcc57df[_0x0539('0x2a')],'notifyContentType':_0x0539('0x5c'),'callbackData':_0xcc57df[_0x0539('0x23')]+';'+_0x4d36e6[_0x0539('0x26')]}]},'headers':{'Authorization':_0x0539('0x5d')+_0x21ccd6['token']},'json':!![]};return rp(_0x2cbc9e)[_0x0539('0x19')](function(_0x4c9723){if(_0x4c9723[_0x0539('0x25')]){var _0x30e475={'messageId':_0x4c9723['messages'][0x0]['messageId']};if(!_0xcc57df[_0x0539('0x3e')]){_0x30e475[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x30e475);}else{return logger[_0x0539('0x1d')](_0x0539('0x2d'),'afterCreate',_0x0539('0x58'),util[_0x0539('0x2c')](_0x4c9723,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x2b5160){return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x58'),util[_0x0539('0x2c')](_0x2b5160,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),'afterCreate',_0x0539('0x58'),_0x0539('0x5e'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x58'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x0539('0x5f'):var _0xa7bd6a=require('crypto');if(_0xcc57df['apiKey']){var _0x30a183={};_0x30a183[_0x0539('0x60')]=_0xcc57df['username'];_0x30a183[_0x0539('0x23')]=_0x4d36e6['phone'];_0x30a183[_0x0539('0x34')]=_0xcc57df[_0x0539('0x23')];_0x30a183[_0x0539('0x61')]=_0x4d36e6[_0x0539('0x26')];_0x30a183[_0x0539('0x62')]=+new Date();var _0x258fce='';var _0x40425e='';var _0x286e42=Object[_0x0539('0x63')](_0x30a183);_0x286e42['sort']();for(var _0x4d741e=0x0;_0x4d741e<_0x286e42['length'];_0x4d741e++){if(_0x258fce!=''){_0x258fce+='&';}_0x258fce+=_0x286e42[_0x4d741e]+'='+encodeURIComponent(_0x30a183[_0x286e42[_0x4d741e]]);_0x40425e+=_0x30a183[_0x286e42[_0x4d741e]];}_0x40425e+=_0xcc57df['apiKey'];_0x40425e=_0xa7bd6a[_0x0539('0x64')](_0x0539('0x65'))['update'](_0x40425e)[_0x0539('0x66')](_0x0539('0x67'));if(_0x258fce!==''){_0x258fce+='&';}_0x258fce+='signature='+_0x40425e;var _0x352c06={'method':_0x0539('0x38'),'uri':_0xcc57df['baseUrl']+_0x0539('0x68')+_0x258fce,'json':!![]};return rp(_0x352c06)[_0x0539('0x19')](function(_0x30a743){var _0xe4a110=Object[_0x0539('0x63')](_0x30a743);if(_0x30a743[_0xe4a110[0x0]][_0x0539('0x1d')]&&parseInt(_0x30a743[_0xe4a110[0x0]][_0x0539('0x1d')])===0x0){var _0x5b698f={'messageId':_0x30a743[_0xe4a110[0x0]]['id_sms']};if(!_0xcc57df['deliveryReport']){_0x5b698f[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x5b698f);}else{return logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x5f'),util[_0x0539('0x2c')](_0x30a743[_0x0539('0x1d')],{'showHidden':![],'depth':null}));}})[_0x0539('0x1c')](function(_0x2337b0){return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),'csc',util[_0x0539('0x2c')](_0x2337b0,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x5f'),'Missing\x20parameters:\x20apiKey');}break;case'clickatell':if(_0xcc57df[_0x0539('0x69')]){var _0x443496={'method':_0x0539('0x43'),'uri':_0x0539('0x6a'),'headers':{'Authorization':_0xcc57df[_0x0539('0x69')]},'body':{'content':_0x4d36e6['body'],'to':[_0x4d36e6[_0x0539('0x23')]],'from':_0xcc57df['phone'],'binary':![],'clientMessageId':'uuid','charset':_0x0539('0x6b')},'json':!![]};rp(_0x443496)['then'](function(_0x3f4f23){if(!_0x3f4f23[_0x0539('0x1d')]){var _0x5412cf={'messageId':_0x3f4f23['messages'][0x0]['apiMessageId']};if(!_0xcc57df[_0x0539('0x3e')]){_0x5412cf[_0x0539('0x3f')]=!![];}return _0x1fe683[_0x0539('0x1a')](_0x5412cf);}else{return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x6c'),util[_0x0539('0x2c')](_0x3f4f23[_0x0539('0x1d')],{'showHidden':![],'depth':null}));}})[_0x0539('0x1c')](function(_0x400458){return logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util['inspect'](_0x400458,{'showHidden':![],'depth':null}));});}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x6c'),_0x0539('0x6d'));}break;case _0x0539('0x6e'):if(_0xcc57df[_0x0539('0x36')]&&_0xcc57df[_0x0539('0x32')]){var _0xbb4d7d=util[_0x0539('0x48')](_0x0539('0x49'),_0xcc57df[_0x0539('0x36')],_0xcc57df[_0x0539('0x32')]);var _0x5d845a={'method':_0x0539('0x43'),'uri':_0x0539('0x6f')+_0xcc57df[_0x0539('0x70')]+'/messages','body':{'to':[_0x4d36e6[_0x0539('0x23')]],'text':_0x4d36e6[_0x0539('0x26')],'from':_0xcc57df[_0x0539('0x23')],'applicationId':_0xcc57df[_0x0539('0x71')]},'headers':{'Authorization':util[_0x0539('0x48')]('Basic\x20%s',new Buffer(_0xbb4d7d)[_0x0539('0x55')](_0x0539('0x4c')))},'json':!![]};rp(_0x5d845a)[_0x0539('0x19')](function(_0x279483){if(_0x279483['id']){var _0x43d9b0={'messageId':_0x279483['id']};return _0x1fe683['update'](_0x43d9b0);}else{logger[_0x0539('0x1d')](_0x0539('0x2d'),'afterCreate',_0x0539('0x6e'),util[_0x0539('0x2c')](_0x279483,{'showHidden':![],'depth':null}));}})[_0x0539('0x1c')](function(_0x2d9504){logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x6e'),util[_0x0539('0x2c')](_0x2d9504,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x6e'),_0x0539('0x40'));}break;case _0x0539('0x72'):if(_0xcc57df[_0x0539('0x69')]){var _0x188140={};var _0x352c06={'method':_0x0539('0x43'),'uri':_0x0539('0x73'),'headers':{'Authorization':_0x0539('0x74')+_0xcc57df['apiKey'],'Content-Type':_0x0539('0x5c')},'body':{'from':_0xcc57df['phone'],'to':_0x4d36e6[_0x0539('0x23')],'text':_0x4d36e6[_0x0539('0x26')]},'json':!![]};return rp(_0x352c06)[_0x0539('0x19')](function(_0x5c1066){if(_0x5c1066['code']==0xca){_0x188140[_0x0539('0x75')]=_0x5c1066;var _0x4a35d6={'method':_0x0539('0x43'),'uri':_0x0539('0x76'),'headers':{'Authorization':_0x0539('0x74')+_0xcc57df['apiKey'],'Content-Type':_0x0539('0x5c')},'body':{'refid':_0x188140[_0x0539('0x75')][_0x0539('0x77')]},'json':!![]};return rp(_0x4a35d6)[_0x0539('0x19')](function(_0x3f7049){_0x188140[_0x0539('0x78')]=_0x3f7049;var _0x8590de={'messageId':_0x188140[_0x0539('0x75')][_0x0539('0x77')],'read':!![]};return _0x1fe683[_0x0539('0x1a')](_0x8590de);});}else{return logger[_0x0539('0x1d')](_0x0539('0x2d'),_0x0539('0x2e'),_0x0539('0x72'),util[_0x0539('0x2c')](_0x5c1066,{'showHidden':![],'depth':null}));}})[_0x0539('0x1c')](function(_0x559811){return logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x0539('0x72'),util[_0x0539('0x2c')](_0x559811,{'showHidden':![],'depth':null}));});}else{return logger[_0x0539('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0539('0x2e'),_0x0539('0x72'),_0x0539('0x79'));}break;}}})['finally'](function(){_0x9f72e5();});}else{_0x9f72e5();}}},'charset':_0x0539('0x7a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 8783fe0..75f7682 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 _0x1a27=['message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x371ecd,_0x143709){var _0x879e1c=function(_0x3ec06a){while(--_0x3ec06a){_0x371ecd['push'](_0x371ecd['shift']());}};_0x879e1c(++_0x143709);}(_0x1a27,0x69));var _0x71a2=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x1a27[_0xbb091];return _0x467a04;};'use strict';var _=require('lodash');var util=require(_0x71a2('0x0'));var moment=require(_0x71a2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x71a2('0x2'));var db=require(_0x71a2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x71a2('0x4'))(_0x71a2('0x5'));var config=require(_0x71a2('0x6'));var jayson=require(_0x71a2('0x7'));var client=jayson[_0x71a2('0x8')][_0x71a2('0x9')]({'port':0x232a});config[_0x71a2('0xa')]=_[_0x71a2('0xb')](config[_0x71a2('0xa')],{'host':_0x71a2('0xc'),'port':0x18eb});var socket=require(_0x71a2('0xd'))(new Redis(config[_0x71a2('0xa')]));require(_0x71a2('0xe'))['register'](socket);function respondWithRpcPromise(_0x4b76df,_0x5275c0,_0x444a13){return new BPromise(function(_0x137594,_0xdd86ca){return client['request'](_0x4b76df,_0x444a13)[_0x71a2('0xf')](function(_0x72c90){logger[_0x71a2('0x10')](_0x71a2('0x11'),_0x5275c0,_0x71a2('0x12'));logger[_0x71a2('0x13')](_0x71a2('0x14'),_0x5275c0,_0x71a2('0x12'),JSON[_0x71a2('0x15')](_0x72c90));if(_0x72c90['error']){if(_0x72c90['error']['code']===0x1f4){logger[_0x71a2('0x16')](_0x71a2('0x11'),_0x5275c0,_0x72c90['error'][_0x71a2('0x17')]);return _0xdd86ca(_0x72c90[_0x71a2('0x16')]['message']);}logger[_0x71a2('0x16')]('SmsMessage,\x20%s,\x20%s',_0x5275c0,_0x72c90[_0x71a2('0x16')][_0x71a2('0x17')]);return _0x137594(_0x72c90[_0x71a2('0x16')][_0x71a2('0x17')]);}else{logger[_0x71a2('0x10')](_0x71a2('0x11'),_0x5275c0,_0x71a2('0x12'));_0x137594(_0x72c90[_0x71a2('0x18')][_0x71a2('0x17')]);}})[_0x71a2('0x19')](function(_0x18d2ef){logger['error']('SmsMessage,\x20%s,\x20%s',_0x5275c0,_0x18d2ef);_0xdd86ca(_0x18d2ef);});});}exports[_0x71a2('0x1a')]=function(_0x121689){var _0x328857=this;return new Promise(function(_0x4ca9f1,_0x16db12){return db[_0x71a2('0x1b')][_0x71a2('0x1c')](_0x121689[_0x71a2('0x1d')],{'raw':_0x121689['options']?_0x121689[_0x71a2('0x1e')][_0x71a2('0x1f')]===undefined?!![]:![]:!![]})[_0x71a2('0xf')](function(_0xb63c0){logger['info']('CreateSmsMessage',_0x121689);logger[_0x71a2('0x13')](_0x71a2('0x1a'),_0x121689,JSON[_0x71a2('0x15')](_0xb63c0));_0x4ca9f1(_0xb63c0);})[_0x71a2('0x19')](function(_0x7d357){logger[_0x71a2('0x16')](_0x71a2('0x1a'),_0x7d357[_0x71a2('0x17')],_0x121689);_0x16db12(_0x328857[_0x71a2('0x16')](0x1f4,_0x7d357[_0x71a2('0x17')]));});});}; \ No newline at end of file +var _0x5e5f=['util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsMessage.socket','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','create','body','options','raw','then','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e5f,0x9f));var _0xf5e5=function(_0x159d58,_0x1908e9){_0x159d58=_0x159d58-0x0;var _0x2ab047=_0x5e5f[_0x159d58];return _0x2ab047;};'use strict';var _=require(_0xf5e5('0x0'));var util=require(_0xf5e5('0x1'));var moment=require('moment');var BPromise=require(_0xf5e5('0x2'));var rs=require(_0xf5e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf5e5('0x4'))['db'];var utils=require(_0xf5e5('0x5'));var logger=require('../../config/logger')(_0xf5e5('0x6'));var config=require(_0xf5e5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf5e5('0x8')][_0xf5e5('0x9')]({'port':0x232a});config[_0xf5e5('0xa')]=_[_0xf5e5('0xb')](config[_0xf5e5('0xa')],{'host':_0xf5e5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf5e5('0xd'))['register'](socket);function respondWithRpcPromise(_0x108757,_0x4ec380,_0x2885bb){return new BPromise(function(_0x3be706,_0x552603){return client[_0xf5e5('0xe')](_0x108757,_0x2885bb)['then'](function(_0x30e549){logger[_0xf5e5('0xf')](_0xf5e5('0x10'),_0x4ec380,_0xf5e5('0x11'));logger[_0xf5e5('0x12')](_0xf5e5('0x13'),_0x4ec380,_0xf5e5('0x11'),JSON[_0xf5e5('0x14')](_0x30e549));if(_0x30e549[_0xf5e5('0x15')]){if(_0x30e549['error'][_0xf5e5('0x16')]===0x1f4){logger['error'](_0xf5e5('0x10'),_0x4ec380,_0x30e549[_0xf5e5('0x15')][_0xf5e5('0x17')]);return _0x552603(_0x30e549['error'][_0xf5e5('0x17')]);}logger[_0xf5e5('0x15')](_0xf5e5('0x10'),_0x4ec380,_0x30e549[_0xf5e5('0x15')][_0xf5e5('0x17')]);return _0x3be706(_0x30e549[_0xf5e5('0x15')][_0xf5e5('0x17')]);}else{logger['info'](_0xf5e5('0x10'),_0x4ec380,'request\x20sent');_0x3be706(_0x30e549[_0xf5e5('0x18')][_0xf5e5('0x17')]);}})[_0xf5e5('0x19')](function(_0x1d178f){logger[_0xf5e5('0x15')]('SmsMessage,\x20%s,\x20%s',_0x4ec380,_0x1d178f);_0x552603(_0x1d178f);});});}exports[_0xf5e5('0x1a')]=function(_0x2afcee){var _0x1199f3=this;return new Promise(function(_0x591dce,_0x20da05){return db['SmsMessage'][_0xf5e5('0x1b')](_0x2afcee[_0xf5e5('0x1c')],{'raw':_0x2afcee[_0xf5e5('0x1d')]?_0x2afcee[_0xf5e5('0x1d')][_0xf5e5('0x1e')]===undefined?!![]:![]:!![]})[_0xf5e5('0x1f')](function(_0x58990a){logger[_0xf5e5('0xf')](_0xf5e5('0x1a'),_0x2afcee);logger['debug'](_0xf5e5('0x1a'),_0x2afcee,JSON['stringify'](_0x58990a));_0x591dce(_0x58990a);})[_0xf5e5('0x19')](function(_0x24ea21){logger[_0xf5e5('0x15')](_0xf5e5('0x1a'),_0x24ea21['message'],_0x2afcee);_0x20da05(_0x1199f3[_0xf5e5('0x15')](0x1f4,_0x24ea21[_0xf5e5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index f7e5b0d..1aae2b4 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 _0xb7f9=['remove','update','emit','removeListener','register','length','smsMessage:','save'];(function(_0xcaf223,_0xd39f07){var _0x17e00d=function(_0xe2852e){while(--_0xe2852e){_0xcaf223['push'](_0xcaf223['shift']());}};_0x17e00d(++_0xd39f07);}(_0xb7f9,0x147));var _0x9b7f=function(_0x4e4e83,_0x2f29a7){_0x4e4e83=_0x4e4e83-0x0;var _0x4cbeb6=_0xb7f9[_0x4e4e83];return _0x4cbeb6;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x9b7f('0x0'),_0x9b7f('0x1'),_0x9b7f('0x2')];function createListener(_0x2784af,_0x4117d4){return function(_0x73a253){_0x4117d4[_0x9b7f('0x3')](_0x2784af,_0x73a253);};}function removeListener(_0x3a689e,_0x103a28){return function(){SmsMessageEvents[_0x9b7f('0x4')](_0x3a689e,_0x103a28);};}exports[_0x9b7f('0x5')]=function(_0x4e2ec2){for(var _0x39bef7=0x0,_0x431899=events[_0x9b7f('0x6')];_0x39bef7<_0x431899;_0x39bef7++){var _0x12389a=events[_0x39bef7];var _0x233328=createListener(_0x9b7f('0x7')+_0x12389a,_0x4e2ec2);SmsMessageEvents['on'](_0x12389a,_0x233328);}}; \ No newline at end of file +var _0x8056=['./smsMessage.events','save','update','emit','register','length','smsMessage:'];(function(_0x8aa083,_0x12b9af){var _0x47ae04=function(_0x465334){while(--_0x465334){_0x8aa083['push'](_0x8aa083['shift']());}};_0x47ae04(++_0x12b9af);}(_0x8056,0xe0));var _0x6805=function(_0x743ca2,_0x3ef14b){_0x743ca2=_0x743ca2-0x0;var _0x1d4b58=_0x8056[_0x743ca2];return _0x1d4b58;};'use strict';var SmsMessageEvents=require(_0x6805('0x0'));var events=[_0x6805('0x1'),'remove',_0x6805('0x2')];function createListener(_0x5c458e,_0x17a824){return function(_0x3a5c94){_0x17a824[_0x6805('0x3')](_0x5c458e,_0x3a5c94);};}function removeListener(_0x23cd47,_0x17eed1){return function(){SmsMessageEvents['removeListener'](_0x23cd47,_0x17eed1);};}exports[_0x6805('0x4')]=function(_0x32c432){for(var _0x3d3f26=0x0,_0x29e83b=events[_0x6805('0x5')];_0x3d3f26<_0x29e83b;_0x3d3f26++){var _0x8dc082=events[_0x3d3f26];var _0x3f806f=createListener(_0x6805('0x6')+_0x8dc082,_0x32c432);SmsMessageEvents['on'](_0x8dc082,_0x3f806f);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index b48aba9..96f8542 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 _0xd022=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','index','get','/describe','isAuthenticated','describe','show','getMembers','getTeams','post','create','/:id/teams','addAgents','/:id','update','delete','destroy','removeTeams','/:id/users','removeAgents','multer','util','path'];(function(_0x18879e,_0x278693){var _0x113cce=function(_0x48cf96){while(--_0x48cf96){_0x18879e['push'](_0x18879e['shift']());}};_0x113cce(++_0x278693);}(_0xd022,0x1b0));var _0x2d02=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xd022[_0x21549c];return _0x426cbd;};'use strict';var multer=require(_0x2d02('0x0'));var util=require(_0x2d02('0x1'));var path=require(_0x2d02('0x2'));var timeout=require(_0x2d02('0x3'));var express=require(_0x2d02('0x4'));var router=express[_0x2d02('0x5')]();var fs_extra=require(_0x2d02('0x6'));var auth=require(_0x2d02('0x7'));var interaction=require(_0x2d02('0x8'));var config=require('../../config/environment');var controller=require(_0x2d02('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2d02('0xa')]);router[_0x2d02('0xb')](_0x2d02('0xc'),auth[_0x2d02('0xd')](),controller[_0x2d02('0xe')]);router['get']('/:id',auth[_0x2d02('0xd')](),controller[_0x2d02('0xf')]);router[_0x2d02('0xb')]('/:id/members',auth[_0x2d02('0xd')](),controller[_0x2d02('0x10')]);router[_0x2d02('0xb')]('/:id/teams',auth[_0x2d02('0xd')](),controller[_0x2d02('0x11')]);router[_0x2d02('0xb')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x2d02('0x12')]('/',auth[_0x2d02('0xd')](),controller[_0x2d02('0x13')]);router[_0x2d02('0x12')](_0x2d02('0x14'),auth[_0x2d02('0xd')](),controller['addTeams']);router[_0x2d02('0x12')]('/:id/users',auth[_0x2d02('0xd')](),controller[_0x2d02('0x15')]);router['put'](_0x2d02('0x16'),auth[_0x2d02('0xd')](),controller[_0x2d02('0x17')]);router[_0x2d02('0x18')](_0x2d02('0x16'),auth[_0x2d02('0xd')](),controller[_0x2d02('0x19')]);router['delete']('/:id/teams',auth[_0x2d02('0xd')](),controller[_0x2d02('0x1a')]);router[_0x2d02('0x18')](_0x2d02('0x1b'),auth[_0x2d02('0xd')](),controller[_0x2d02('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xcde6=['delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','show','/:id/members','getMembers','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','/:id','removeTeams'];(function(_0x214129,_0x1bcd7d){var _0xf7ae2b=function(_0x53b0c8){while(--_0x53b0c8){_0x214129['push'](_0x214129['shift']());}};_0xf7ae2b(++_0x1bcd7d);}(_0xcde6,0xf3));var _0x6cde=function(_0x3bb030,_0xc6ba75){_0x3bb030=_0x3bb030-0x0;var _0x2d5f96=_0xcde6[_0x3bb030];return _0x2d5f96;};'use strict';var multer=require(_0x6cde('0x0'));var util=require(_0x6cde('0x1'));var path=require(_0x6cde('0x2'));var timeout=require(_0x6cde('0x3'));var express=require(_0x6cde('0x4'));var router=express[_0x6cde('0x5')]();var fs_extra=require(_0x6cde('0x6'));var auth=require(_0x6cde('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6cde('0x8'));var controller=require(_0x6cde('0x9'));router[_0x6cde('0xa')]('/',auth[_0x6cde('0xb')](),controller[_0x6cde('0xc')]);router[_0x6cde('0xa')]('/describe',auth[_0x6cde('0xb')](),controller['describe']);router['get']('/:id',auth[_0x6cde('0xb')](),controller[_0x6cde('0xd')]);router[_0x6cde('0xa')](_0x6cde('0xe'),auth['isAuthenticated'](),controller[_0x6cde('0xf')]);router[_0x6cde('0xa')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x6cde('0xa')](_0x6cde('0x10'),auth[_0x6cde('0xb')](),controller[_0x6cde('0x11')]);router[_0x6cde('0x12')]('/',auth[_0x6cde('0xb')](),controller[_0x6cde('0x13')]);router['post'](_0x6cde('0x14'),auth['isAuthenticated'](),controller[_0x6cde('0x15')]);router[_0x6cde('0x12')](_0x6cde('0x10'),auth['isAuthenticated'](),controller[_0x6cde('0x16')]);router[_0x6cde('0x17')]('/:id',auth[_0x6cde('0xb')](),controller[_0x6cde('0x18')]);router['delete'](_0x6cde('0x19'),auth[_0x6cde('0xb')](),controller['destroy']);router['delete'](_0x6cde('0x14'),auth[_0x6cde('0xb')](),controller[_0x6cde('0x1a')]);router[_0x6cde('0x1b')](_0x6cde('0x10'),auth['isAuthenticated'](),controller[_0x6cde('0x1c')]);module[_0x6cde('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index d997146..02fd539 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 _0x3b77=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x29068e,_0x599ac0){var _0x1cda11=function(_0x338042){while(--_0x338042){_0x29068e['push'](_0x29068e['shift']());}};_0x1cda11(++_0x599ac0);}(_0x3b77,0x112));var _0x73b7=function(_0x4282ff,_0x970096){_0x4282ff=_0x4282ff-0x0;var _0x14c25a=_0x3b77[_0x4282ff];return _0x14c25a;};'use strict';var Sequelize=require(_0x73b7('0x0'));module[_0x73b7('0x1')]={'name':{'type':Sequelize[_0x73b7('0x2')],'unique':_0x73b7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x73b7('0x2')]},'timeout':{'type':Sequelize[_0x73b7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x73b7('0x5')](_0x73b7('0x6'),_0x73b7('0x7'),_0x73b7('0x8'))}}; \ No newline at end of file +var _0xa00e=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5bfeac,_0x1c787f){var _0x5f596e=function(_0x6c605f){while(--_0x6c605f){_0x5bfeac['push'](_0x5bfeac['shift']());}};_0x5f596e(++_0x1c787f);}(_0xa00e,0x1e3));var _0xea00=function(_0x435245,_0x3c9fa2){_0x435245=_0x435245-0x0;var _0x325180=_0xa00e[_0x435245];return _0x325180;};'use strict';var Sequelize=require(_0xea00('0x0'));module[_0xea00('0x1')]={'name':{'type':Sequelize[_0xea00('0x2')],'unique':_0xea00('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea00('0x2')]},'timeout':{'type':Sequelize[_0xea00('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea00('0x5')](_0xea00('0x6'),_0xea00('0x7'),_0xea00('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 59398df..0dabb7a 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 _0xe306=['filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','pick','SmsQueueId','findAndCountAll','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','options','ids','User','online','voicePause','interface','flatMap','transaction','each','userSmsQueue:save','removeTeams','Agents','tq.TeamId','from','team_has_sms_queues','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeAgents','userSmsQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./smsQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','SmsQueues','UserProfileResource','stack','name','index','map','SmsQueue','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe306,0x149));var _0x6e30=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xe306[_0x139a3c];return _0x2b375b;};'use strict';var emlformat=require(_0x6e30('0x0'));var rimraf=require(_0x6e30('0x1'));var zipdir=require(_0x6e30('0x2'));var jsonpatch=require(_0x6e30('0x3'));var rp=require(_0x6e30('0x4'));var moment=require(_0x6e30('0x5'));var BPromise=require(_0x6e30('0x6'));var Mustache=require(_0x6e30('0x7'));var util=require(_0x6e30('0x8'));var path=require(_0x6e30('0x9'));var sox=require(_0x6e30('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e30('0xb'));var _=require(_0x6e30('0xc'));var squel=require(_0x6e30('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6e30('0xe'));var toCsv=require(_0x6e30('0xf'));var querystring=require('querystring');var Papa=require(_0x6e30('0x10'));var Redis=require('ioredis');var authService=require(_0x6e30('0x11'));var qs=require(_0x6e30('0x12'));var as=require(_0x6e30('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e30('0x14'))('api');var utils=require(_0x6e30('0x15'));var config=require(_0x6e30('0x16'));var licenseUtil=require(_0x6e30('0x17'));var db=require(_0x6e30('0x18'))['db'];config[_0x6e30('0x19')]=_['defaults'](config[_0x6e30('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6e30('0x1a'))['register'](socket);function respondWithStatusCode(_0x47ef00,_0x103801){_0x103801=_0x103801||0xcc;return function(_0x471e64){if(_0x471e64){return _0x47ef00[_0x6e30('0x1b')](_0x103801);}return _0x47ef00['status'](_0x103801)[_0x6e30('0x1c')]();};}function respondWithResult(_0x32464f,_0x87f8fd){_0x87f8fd=_0x87f8fd||0xc8;return function(_0x4a44dc){if(_0x4a44dc){return _0x32464f[_0x6e30('0x1d')](_0x87f8fd)[_0x6e30('0x1e')](_0x4a44dc);}};}function respondWithFilteredResult(_0x5c9424,_0x2abf99){return function(_0x54dec4){if(_0x54dec4){var _0x478514=typeof _0x2abf99[_0x6e30('0x1f')]===_0x6e30('0x20')&&typeof _0x2abf99[_0x6e30('0x21')]===_0x6e30('0x20');var _0x5c8424=_0x54dec4['count'];var _0x4eb109=_0x478514?0x0:_0x2abf99['offset'];var _0x36c6e5=_0x478514?_0x54dec4[_0x6e30('0x22')]:_0x2abf99[_0x6e30('0x1f')]+_0x2abf99[_0x6e30('0x21')];var _0x5847ad;if(_0x36c6e5>=_0x5c8424){_0x36c6e5=_0x5c8424;_0x5847ad=0xc8;}else{_0x5847ad=0xce;}_0x5c9424['status'](_0x5847ad);return _0x5c9424['set']('Content-Range',_0x4eb109+'-'+_0x36c6e5+'/'+_0x5c8424)[_0x6e30('0x1e')](_0x54dec4);}return null;};}function patchUpdates(_0x1d4de3){return function(_0x265bdc){try{jsonpatch['apply'](_0x265bdc,_0x1d4de3,!![]);}catch(_0x23e399){return BPromise[_0x6e30('0x23')](_0x23e399);}return _0x265bdc[_0x6e30('0x24')]();};}function saveUpdates(_0x456f33,_0x4ded2a){return function(_0x3fa2fb){if(_0x3fa2fb){return _0x3fa2fb[_0x6e30('0x25')](_0x456f33)[_0x6e30('0x26')](function(_0x3a1be2){return _0x3a1be2;});}return null;};}function removeEntity(_0x667028,_0x50569e){return function(_0x21af0c){if(_0x21af0c){return _0x21af0c[_0x6e30('0x27')]()[_0x6e30('0x26')](function(){var _0x10e9b2=_0x21af0c['get']({'plain':!![]});var _0x1686e4=_0x6e30('0x28');return db[_0x6e30('0x29')][_0x6e30('0x27')]({'where':{'type':_0x1686e4,'resourceId':_0x10e9b2['id']}})[_0x6e30('0x26')](function(){return _0x21af0c;});})[_0x6e30('0x26')](function(){_0x667028[_0x6e30('0x1d')](0xcc)[_0x6e30('0x1c')]();});}};}function handleEntityNotFound(_0xabeadd,_0x20a269){return function(_0xfb4a1d){if(!_0xfb4a1d){_0xabeadd[_0x6e30('0x1b')](0x194);}return _0xfb4a1d;};}function handleError(_0x46b50c,_0x32f75d){_0x32f75d=_0x32f75d||0x1f4;return function(_0x50bca4){logger['error'](_0x50bca4[_0x6e30('0x2a')]);if(_0x50bca4[_0x6e30('0x2b')]){delete _0x50bca4[_0x6e30('0x2b')];}_0x46b50c[_0x6e30('0x1d')](_0x32f75d)['send'](_0x50bca4);};}exports[_0x6e30('0x2c')]=function(_0x5612ec,_0x2317dc){var _0x2682b5={},_0x19a73d={},_0x4eb795={'count':0x0,'rows':[]};var _0x21ca3e=_[_0x6e30('0x2d')](db[_0x6e30('0x2e')][_0x6e30('0x2f')],function(_0x282013){return{'name':_0x282013['fieldName'],'type':_0x282013[_0x6e30('0x30')]['key']};});_0x19a73d[_0x6e30('0x31')]=_['map'](_0x21ca3e,'name');_0x19a73d['query']=_[_0x6e30('0x32')](_0x5612ec[_0x6e30('0x33')]);_0x19a73d['filters']=_[_0x6e30('0x34')](_0x19a73d[_0x6e30('0x31')],_0x19a73d[_0x6e30('0x33')]);_0x2682b5[_0x6e30('0x35')]=_[_0x6e30('0x34')](_0x19a73d[_0x6e30('0x31')],qs[_0x6e30('0x36')](_0x5612ec[_0x6e30('0x33')][_0x6e30('0x36')]));_0x2682b5[_0x6e30('0x35')]=_0x2682b5['attributes'][_0x6e30('0x37')]?_0x2682b5[_0x6e30('0x35')]:_0x19a73d[_0x6e30('0x31')];if(!_0x5612ec[_0x6e30('0x33')][_0x6e30('0x38')](_0x6e30('0x39'))){_0x2682b5['limit']=qs['limit'](_0x5612ec[_0x6e30('0x33')][_0x6e30('0x21')]);_0x2682b5['offset']=qs[_0x6e30('0x1f')](_0x5612ec[_0x6e30('0x33')][_0x6e30('0x1f')]);}_0x2682b5[_0x6e30('0x3a')]=qs[_0x6e30('0x3b')](_0x5612ec[_0x6e30('0x33')]['sort']);_0x2682b5[_0x6e30('0x3c')]=qs[_0x6e30('0x3d')](_['pick'](_0x5612ec['query'],_0x19a73d['filters']),_0x21ca3e);if(_0x5612ec[_0x6e30('0x33')]['filter']){_0x2682b5[_0x6e30('0x3c')]=_[_0x6e30('0x3e')](_0x2682b5[_0x6e30('0x3c')],{'$or':_['map'](_0x21ca3e,function(_0x1f904d){if(_0x1f904d['type']!==_0x6e30('0x3f')){var _0x48606c={};_0x48606c[_0x1f904d[_0x6e30('0x2b')]]={'$like':'%'+_0x5612ec[_0x6e30('0x33')][_0x6e30('0x40')]+'%'};return _0x48606c;}})});}_0x2682b5=_[_0x6e30('0x3e')]({},_0x2682b5,_0x5612ec['options']);var _0x17763e={'where':_0x2682b5[_0x6e30('0x3c')]};return db[_0x6e30('0x2e')][_0x6e30('0x22')](_0x17763e)[_0x6e30('0x26')](function(_0x49ff89){_0x4eb795[_0x6e30('0x22')]=_0x49ff89;if(_0x5612ec[_0x6e30('0x33')][_0x6e30('0x41')]){_0x2682b5[_0x6e30('0x42')]=[{'all':!![]}];}return db['SmsQueue'][_0x6e30('0x43')](_0x2682b5);})['then'](function(_0x38ee16){_0x4eb795[_0x6e30('0x44')]=_0x38ee16;return _0x4eb795;})[_0x6e30('0x26')](respondWithFilteredResult(_0x2317dc,_0x2682b5))[_0x6e30('0x45')](handleError(_0x2317dc,null));};exports[_0x6e30('0x46')]=function(_0x13d470,_0x5f2b3d){var _0x33ccf4={'raw':!![],'where':{'id':_0x13d470[_0x6e30('0x47')]['id']}},_0x354e78={};_0x354e78['model']=_['keys'](db[_0x6e30('0x2e')]['rawAttributes']);_0x354e78['query']=_[_0x6e30('0x32')](_0x13d470[_0x6e30('0x33')]);_0x354e78[_0x6e30('0x3d')]=_[_0x6e30('0x34')](_0x354e78[_0x6e30('0x31')],_0x354e78[_0x6e30('0x33')]);_0x33ccf4[_0x6e30('0x35')]=_[_0x6e30('0x34')](_0x354e78[_0x6e30('0x31')],qs['fields'](_0x13d470[_0x6e30('0x33')][_0x6e30('0x36')]));_0x33ccf4[_0x6e30('0x35')]=_0x33ccf4['attributes'][_0x6e30('0x37')]?_0x33ccf4[_0x6e30('0x35')]:_0x354e78[_0x6e30('0x31')];if(_0x13d470[_0x6e30('0x33')][_0x6e30('0x41')]){_0x33ccf4[_0x6e30('0x42')]=[{'all':!![]}];}_0x33ccf4=_[_0x6e30('0x3e')]({},_0x33ccf4,_0x13d470['options']);return db[_0x6e30('0x2e')][_0x6e30('0x48')](_0x33ccf4)[_0x6e30('0x26')](handleEntityNotFound(_0x5f2b3d,null))['then'](respondWithResult(_0x5f2b3d,null))['catch'](handleError(_0x5f2b3d,null));};exports[_0x6e30('0x49')]=function(_0xbc4de2,_0x518567){return db[_0x6e30('0x2e')][_0x6e30('0x49')](_0xbc4de2[_0x6e30('0x4a')],{})[_0x6e30('0x26')](function(_0x2ded57){var _0x3aa097=_0xbc4de2[_0x6e30('0x4b')][_0x6e30('0x4c')]({'plain':!![]});if(!_0x3aa097)throw new Error(_0x6e30('0x4d'));if(_0x3aa097['role']==='user'){var _0x4695c9=_0x2ded57[_0x6e30('0x4c')]({'plain':!![]});var _0x3ad21a=_0x6e30('0x28');return db[_0x6e30('0x4e')][_0x6e30('0x48')]({'where':{'name':_0x3ad21a,'userProfileId':_0x3aa097['userProfileId']},'raw':!![]})['then'](function(_0x5f0331){if(_0x5f0331&&_0x5f0331['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x4695c9[_0x6e30('0x2b')],'resourceId':_0x4695c9['id'],'type':_0x5f0331[_0x6e30('0x2b')],'sectionId':_0x5f0331['id']},{})[_0x6e30('0x26')](function(){return _0x2ded57;});}else{return _0x2ded57;}})[_0x6e30('0x45')](function(_0x387b06){logger[_0x6e30('0x4f')](_0x6e30('0x50'),_0x387b06);throw _0x387b06;});}return _0x2ded57;})[_0x6e30('0x26')](respondWithResult(_0x518567,0xc9))[_0x6e30('0x45')](handleError(_0x518567,null));};exports['update']=function(_0x377db4,_0x56c74e){if(_0x377db4['body']['id']){delete _0x377db4[_0x6e30('0x4a')]['id'];}return db['SmsQueue'][_0x6e30('0x48')]({'where':{'id':_0x377db4[_0x6e30('0x47')]['id']}})[_0x6e30('0x26')](handleEntityNotFound(_0x56c74e,null))[_0x6e30('0x26')](saveUpdates(_0x377db4[_0x6e30('0x4a')],null))[_0x6e30('0x26')](respondWithResult(_0x56c74e,null))['catch'](handleError(_0x56c74e,null));};exports[_0x6e30('0x27')]=function(_0x520c66,_0x28ee7d){return db[_0x6e30('0x2e')][_0x6e30('0x48')]({'where':{'id':_0x520c66[_0x6e30('0x47')]['id']}})[_0x6e30('0x26')](handleEntityNotFound(_0x28ee7d,null))['then'](removeEntity(_0x28ee7d,null))[_0x6e30('0x45')](handleError(_0x28ee7d,null));};exports[_0x6e30('0x51')]=function(_0x4a5a46,_0xa37dec){return db[_0x6e30('0x2e')]['describe']()[_0x6e30('0x26')](respondWithResult(_0xa37dec,null))[_0x6e30('0x45')](handleError(_0xa37dec,null));};exports[_0x6e30('0x52')]=function(_0x49de4f,_0x198b45,_0x548acd){var _0x2f1d3e={'raw':!![],'where':{}},_0x163d58={},_0x264686;return db['SmsQueue'][_0x6e30('0x53')]({'where':{'id':_0x49de4f['params']['id']}})[_0x6e30('0x26')](handleEntityNotFound(_0x198b45,null))[_0x6e30('0x26')](function(_0x3be426){if(_0x3be426){_0x264686=_0x3be426[_0x6e30('0x4c')]({'plain':!![]});_0x163d58[_0x6e30('0x31')]=_[_0x6e30('0x32')](db['UserSmsQueue']['rawAttributes']);_0x163d58[_0x6e30('0x33')]=_[_0x6e30('0x32')](_0x49de4f[_0x6e30('0x33')]);_0x163d58['filters']=_[_0x6e30('0x34')](_0x163d58[_0x6e30('0x31')],_0x163d58[_0x6e30('0x33')]);_0x2f1d3e['attributes']=_['intersection'](_0x163d58[_0x6e30('0x31')],qs['fields'](_0x49de4f['query'][_0x6e30('0x36')]));_0x2f1d3e['attributes']=_0x2f1d3e[_0x6e30('0x35')][_0x6e30('0x37')]?_0x2f1d3e[_0x6e30('0x35')]:_0x163d58[_0x6e30('0x31')];if(!_0x49de4f[_0x6e30('0x33')][_0x6e30('0x38')]('nolimit')){_0x2f1d3e['limit']=qs['limit'](_0x49de4f[_0x6e30('0x33')][_0x6e30('0x21')]);_0x2f1d3e[_0x6e30('0x1f')]=qs[_0x6e30('0x1f')](_0x49de4f[_0x6e30('0x33')]['offset']);}_0x2f1d3e[_0x6e30('0x3a')]=qs[_0x6e30('0x3b')](_0x49de4f[_0x6e30('0x33')][_0x6e30('0x3b')]);_0x2f1d3e[_0x6e30('0x3c')]=qs[_0x6e30('0x3d')](_[_0x6e30('0x54')](_0x49de4f['query'],_0x163d58['filters']));_0x2f1d3e[_0x6e30('0x3c')][_0x6e30('0x55')]=_0x3be426['id'];if(_0x49de4f[_0x6e30('0x33')][_0x6e30('0x40')]){_0x2f1d3e['where']=_['merge'](_0x2f1d3e[_0x6e30('0x3c')],{'$or':_['map'](_0x2f1d3e[_0x6e30('0x35')],function(_0x3c60e7){var _0x3e393f={};_0x3e393f[_0x3c60e7]={'$like':'%'+_0x49de4f[_0x6e30('0x33')]['filter']+'%'};return _0x3e393f;})});}_0x2f1d3e=_['merge']({},_0x2f1d3e,_0x49de4f['options']);return db['UserSmsQueue']['findAll'](_0x2f1d3e);}})['then'](function(_0x2eb93b){if(_0x2eb93b){return db['User'][_0x6e30('0x56')]({'where':{'id':_[_0x6e30('0x2d')](_0x2eb93b,'UserId'),'role':_0x6e30('0x57')},'attributes':['id','name',_0x6e30('0x58'),_0x6e30('0x59'),_0x6e30('0x5a')]});}})['then'](function(_0x1b45ec){if(_0x1b45ec){return{'count':_0x1b45ec[_0x6e30('0x22')],'rows':_[_0x6e30('0x2d')](_0x1b45ec['rows'],function(_0x585b45){return{'membername':_0x585b45[_0x6e30('0x2b')],'UserId':_0x585b45['id'],'queue_name':_0x264686[_0x6e30('0x2b')],'SmsQueueId':_0x264686['id'],'interface':util[_0x6e30('0x5b')](_0x6e30('0x5c'),_0x6e30('0x5d'),_0x585b45[_0x6e30('0x2b')]),'penalty':0x0,'paused':_0x585b45[_0x6e30('0x58')],'createdAt':_0x585b45['createdAt'],'updatedAt':_0x585b45[_0x6e30('0x59')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x198b45,_0x2f1d3e))[_0x6e30('0x45')](handleError(_0x198b45,null));};exports[_0x6e30('0x5e')]=function(_0x48f2ba,_0x396004,_0x563c89){var _0x543268={};var _0x4f82c8={};var _0x25e2f4;var _0x48d58b;return db[_0x6e30('0x2e')][_0x6e30('0x53')]({'where':{'id':_0x48f2ba[_0x6e30('0x47')]['id']}})[_0x6e30('0x26')](handleEntityNotFound(_0x396004,null))[_0x6e30('0x26')](function(_0x5f1ee8){if(_0x5f1ee8){_0x25e2f4=_0x5f1ee8;_0x4f82c8['model']=_[_0x6e30('0x32')](db[_0x6e30('0x5f')][_0x6e30('0x2f')]);_0x4f82c8[_0x6e30('0x33')]=_[_0x6e30('0x32')](_0x48f2ba[_0x6e30('0x33')]);_0x4f82c8[_0x6e30('0x3d')]=_[_0x6e30('0x34')](_0x4f82c8[_0x6e30('0x31')],_0x4f82c8['query']);_0x543268[_0x6e30('0x35')]=_[_0x6e30('0x34')](_0x4f82c8['model'],qs[_0x6e30('0x36')](_0x48f2ba[_0x6e30('0x33')]['fields']));_0x543268[_0x6e30('0x35')]=_0x543268[_0x6e30('0x35')][_0x6e30('0x37')]?_0x543268[_0x6e30('0x35')]:_0x4f82c8[_0x6e30('0x31')];_0x543268['order']=qs[_0x6e30('0x3b')](_0x48f2ba[_0x6e30('0x33')]['sort']);_0x543268['where']=qs['filters'](_[_0x6e30('0x54')](_0x48f2ba[_0x6e30('0x33')],_0x4f82c8['filters']));if(_0x48f2ba[_0x6e30('0x33')][_0x6e30('0x40')]){_0x543268[_0x6e30('0x3c')]=_[_0x6e30('0x3e')](_0x543268[_0x6e30('0x3c')],{'$or':_[_0x6e30('0x2d')](_0x543268[_0x6e30('0x35')],function(_0x1013bb){var _0x30214b={};_0x30214b[_0x1013bb]={'$like':'%'+_0x48f2ba[_0x6e30('0x33')][_0x6e30('0x40')]+'%'};return _0x30214b;})});}_0x543268=_['merge']({},_0x543268,_0x48f2ba[_0x6e30('0x60')]);return _0x25e2f4[_0x6e30('0x5e')](_0x543268);}})['then'](function(_0x48d7c6){if(_0x48d7c6){_0x48d58b=_0x48d7c6['length'];if(!_0x48f2ba['query'][_0x6e30('0x38')](_0x6e30('0x39'))){_0x543268[_0x6e30('0x21')]=qs['limit'](_0x48f2ba[_0x6e30('0x33')][_0x6e30('0x21')]);_0x543268[_0x6e30('0x1f')]=qs[_0x6e30('0x1f')](_0x48f2ba[_0x6e30('0x33')][_0x6e30('0x1f')]);}return _0x25e2f4['getTeams'](_0x543268);}})[_0x6e30('0x26')](function(_0x2096a9){if(_0x2096a9){return _0x2096a9?{'count':_0x48d58b,'rows':_0x2096a9}:null;}})[_0x6e30('0x26')](respondWithResult(_0x396004,null))[_0x6e30('0x45')](handleError(_0x396004,null));};exports['addTeams']=function(_0x43b84b,_0x30b050,_0x2faa79){var _0x21f1ae=_0x43b84b[_0x6e30('0x4a')][_0x6e30('0x61')];return db[_0x6e30('0x5f')]['findAll']({'where':{'id':_0x21f1ae},'attributes':['id'],'include':[{'model':db[_0x6e30('0x62')],'as':'Agents','attributes':['id',_0x6e30('0x2b'),_0x6e30('0x63'),_0x6e30('0x64'),_0x6e30('0x65')],'raw':!![]}]})[_0x6e30('0x26')](function(_0x34f747){if(_0x34f747){var _0x3fcdaf=_[_0x6e30('0x66')](_0x34f747,function(_0x105cc3){var _0x333262=_0x105cc3[_0x6e30('0x4c')]({'plain':!![]});return _0x333262['Agents'];});return db[_0x6e30('0x2e')][_0x6e30('0x48')]({'where':{'id':_0x43b84b['params']['id']}})[_0x6e30('0x26')](function(_0xd52645){return db['sequelize'][_0x6e30('0x67')](function(_0x4bfe13){return _0xd52645['addTeams'](_0x21f1ae,{'transaction':_0x4bfe13})[_0x6e30('0x26')](function(){return BPromise[_0x6e30('0x68')](_0x3fcdaf,function(_0x497634){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x497634['id'],'SmsQueueId':_0x43b84b[_0x6e30('0x47')]['id']},'transaction':_0x4bfe13});});})[_0x6e30('0x26')](function(){_0x3fcdaf['forEach'](function(_0x2ec9c9){socket['emit'](_0x6e30('0x69'),{'UserId':_0x2ec9c9['id'],'SmsQueueId':_0xd52645['id']});});});});});}})['then'](respondWithStatusCode(_0x30b050,null))[_0x6e30('0x45')](handleError(_0x30b050,null));};exports[_0x6e30('0x6a')]=function(_0x948866,_0x45694c,_0x4bb923){return db[_0x6e30('0x5f')][_0x6e30('0x43')]({'where':{'id':_0x948866[_0x6e30('0x33')][_0x6e30('0x61')]},'attributes':['id'],'include':[{'model':db[_0x6e30('0x62')],'as':_0x6e30('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x45694c,null))[_0x6e30('0x26')](function(_0x2cbbbe){var _0x344bf5=_[_0x6e30('0x2d')](_0x2cbbbe,'id');var _0x49dafc=[];var _0x54a3c8=[];var _0x16a710=squel['select']();_0x16a710['field'](_0x6e30('0x6c'))[_0x6e30('0x6d')](_0x6e30('0x6e'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948866['params']['id']);for(var _0x51387e=0x0;_0x51387e<_0x2cbbbe[_0x6e30('0x37')];_0x51387e+=0x1){let _0x25084e=_0x2cbbbe[_0x51387e];for(var _0x3204b6=0x0;_0x3204b6<_0x25084e[_0x6e30('0x6b')][_0x6e30('0x37')];_0x3204b6+=0x1){let _0x30f8f8=_0x25084e['Agents'][_0x3204b6];var _0x266f9a=_0x16a710[_0x6e30('0x6f')]();_0x266f9a['where'](_0x6e30('0x70'),_0x30f8f8['id']);_0x54a3c8[_0x6e30('0x71')](db['sequelize'][_0x6e30('0x33')](_0x266f9a[_0x6e30('0x72')](),{'type':db[_0x6e30('0x73')][_0x6e30('0x74')][_0x6e30('0x75')]})[_0x6e30('0x26')](function(_0x2b2e30){if(_0x2b2e30[_0x6e30('0x37')]===0x1){return _0x30f8f8['id'];}else{var _0x336bb2=_['every'](_['map'](_0x2b2e30,_0x6e30('0x76')),function(_0x4eff69){return _[_0x6e30('0x77')](_0x344bf5,_0x4eff69);});if(_0x336bb2){return _0x30f8f8['id'];}}}));}}return BPromise[_0x6e30('0x78')](_0x54a3c8)[_0x6e30('0x26')](function(_0x1830ce){_0x49dafc=_(_0x49dafc)[_0x6e30('0x79')](_0x1830ce)[_0x6e30('0x7a')]()['value']();return db['SmsQueue']['find']({'where':{'id':_0x948866[_0x6e30('0x47')]['id']}})[_0x6e30('0x26')](function(_0x5f1ed9){return db[_0x6e30('0x73')][_0x6e30('0x67')](function(_0x10f3ca){return _0x5f1ed9[_0x6e30('0x6a')](_0x948866[_0x6e30('0x33')][_0x6e30('0x61')],{'transaction':_0x10f3ca})[_0x6e30('0x26')](function(){if(!_['isEmpty'](_0x49dafc)){return _0x5f1ed9[_0x6e30('0x7b')](_0x49dafc,{'transaction':_0x10f3ca});}})[_0x6e30('0x26')](function(){_0x49dafc['forEach'](function(_0x5c2b3b){socket['emit'](_0x6e30('0x7c'),{'UserId':_0x5c2b3b,'SmsQueueId':_0x5f1ed9['id']});});});});});});})[_0x6e30('0x26')](respondWithStatusCode(_0x45694c,null))['catch'](handleError(_0x45694c,null));};exports[_0x6e30('0x7d')]=function(_0xef7847,_0x426652,_0x3f836c){return db[_0x6e30('0x2e')][_0x6e30('0x48')]({'where':{'id':_0xef7847[_0x6e30('0x47')]['id']}})[_0x6e30('0x26')](handleEntityNotFound(_0x426652,null))[_0x6e30('0x26')](function(_0x18a72a){if(_0x18a72a){return _0x18a72a[_0x6e30('0x7d')](_0xef7847['body'][_0x6e30('0x61')],_[_0x6e30('0x7e')](_0xef7847[_0x6e30('0x4a')],[_0x6e30('0x61'),'id'])||{})[_0x6e30('0x7f')](function(_0x4e94da){for(var _0x24e3bf=0x0;_0x24e3bf<_0xef7847['body'][_0x6e30('0x61')]['length'];_0x24e3bf+=0x1){socket[_0x6e30('0x80')](_0x6e30('0x69'),{'UserId':Number(_0xef7847[_0x6e30('0x4a')]['ids'][_0x24e3bf]),'SmsQueueId':Number(_0xef7847[_0x6e30('0x47')]['id'])});}return _0x4e94da;});}})[_0x6e30('0x26')](respondWithResult(_0x426652,null))['catch'](handleError(_0x426652,null));};exports[_0x6e30('0x7b')]=function(_0x541104,_0x228fe4,_0x275ce4){return db[_0x6e30('0x2e')]['find']({'where':{'id':_0x541104[_0x6e30('0x47')]['id']}})[_0x6e30('0x26')](handleEntityNotFound(_0x228fe4,null))[_0x6e30('0x26')](function(_0x30f75f){if(_0x30f75f){return _0x30f75f[_0x6e30('0x7b')](_0x541104[_0x6e30('0x33')][_0x6e30('0x61')])['then'](function(){if(_[_0x6e30('0x81')](_0x541104[_0x6e30('0x33')][_0x6e30('0x61')])){for(var _0x1be5e3=0x0;_0x1be5e3<_0x541104[_0x6e30('0x33')][_0x6e30('0x61')]['length'];_0x1be5e3+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x541104[_0x6e30('0x33')][_0x6e30('0x61')][_0x1be5e3]),'SmsQueueId':Number(_0x541104['params']['id'])});}}else{socket[_0x6e30('0x80')]('userSmsQueue:remove',{'UserId':Number(_0x541104[_0x6e30('0x33')][_0x6e30('0x61')]),'SmsQueueId':Number(_0x541104[_0x6e30('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x228fe4,null))['catch'](handleError(_0x228fe4,null));};exports[_0x6e30('0x82')]=function(_0x56fcb9,_0x1c63b1,_0x2071b0){var _0x1637ea={};var _0xb5d1c7={};var _0x3d646d;var _0x3a23b2;return db['SmsQueue'][_0x6e30('0x53')]({'where':{'id':_0x56fcb9[_0x6e30('0x47')]['id']}})[_0x6e30('0x26')](handleEntityNotFound(_0x1c63b1,null))[_0x6e30('0x26')](function(_0x2cd46e){if(_0x2cd46e){_0x3d646d=_0x2cd46e;_0xb5d1c7[_0x6e30('0x31')]=_[_0x6e30('0x32')](db[_0x6e30('0x62')][_0x6e30('0x2f')]);_0xb5d1c7[_0x6e30('0x33')]=_[_0x6e30('0x32')](_0x56fcb9[_0x6e30('0x33')]);_0xb5d1c7[_0x6e30('0x3d')]=_[_0x6e30('0x34')](_0xb5d1c7['model'],_0xb5d1c7[_0x6e30('0x33')]);_0x1637ea['attributes']=_['intersection'](_0xb5d1c7[_0x6e30('0x31')],qs[_0x6e30('0x36')](_0x56fcb9[_0x6e30('0x33')][_0x6e30('0x36')]));_0x1637ea[_0x6e30('0x35')]=_0x1637ea['attributes'][_0x6e30('0x37')]?_0x1637ea[_0x6e30('0x35')]:_0xb5d1c7['model'];_0x1637ea['order']=qs[_0x6e30('0x3b')](_0x56fcb9[_0x6e30('0x33')][_0x6e30('0x3b')]);_0x1637ea['where']=qs[_0x6e30('0x3d')](_[_0x6e30('0x54')](_0x56fcb9[_0x6e30('0x33')],_0xb5d1c7[_0x6e30('0x3d')]));if(_0x56fcb9['query'][_0x6e30('0x40')]){_0x1637ea[_0x6e30('0x3c')]=_[_0x6e30('0x3e')](_0x1637ea[_0x6e30('0x3c')],{'$or':_['map'](_0x1637ea[_0x6e30('0x35')],function(_0x621911){var _0x5c69e9={};_0x5c69e9[_0x621911]={'$like':'%'+_0x56fcb9[_0x6e30('0x33')]['filter']+'%'};return _0x5c69e9;})});}_0x1637ea=_[_0x6e30('0x3e')]({},_0x1637ea,_0x56fcb9[_0x6e30('0x60')]);return _0x3d646d[_0x6e30('0x82')](_0x1637ea);}})['then'](function(_0x4ff1fc){if(_0x4ff1fc){_0x3a23b2=_0x4ff1fc[_0x6e30('0x37')];if(!_0x56fcb9['query']['hasOwnProperty'](_0x6e30('0x39'))){_0x1637ea[_0x6e30('0x21')]=qs[_0x6e30('0x21')](_0x56fcb9[_0x6e30('0x33')][_0x6e30('0x21')]);_0x1637ea['offset']=qs[_0x6e30('0x1f')](_0x56fcb9[_0x6e30('0x33')][_0x6e30('0x1f')]);}return _0x3d646d[_0x6e30('0x82')](_0x1637ea);}})[_0x6e30('0x26')](function(_0x364f30){if(_0x364f30){return _0x364f30?{'count':_0x3a23b2,'rows':_0x364f30}:null;}})[_0x6e30('0x26')](respondWithResult(_0x1c63b1,null))['catch'](handleError(_0x1c63b1,null));}; \ No newline at end of file +var _0xc275=['keys','include','catch','create','body','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','omit','getAgents','hasOwnProperty','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','SmsQueues','UserProfileResource','error','name','send','index','map','SmsQueue','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','filter','options','includeAll','findAll','rows','show','params'];(function(_0x2baf49,_0xea3f8c){var _0x112aa0=function(_0x1c7060){while(--_0x1c7060){_0x2baf49['push'](_0x2baf49['shift']());}};_0x112aa0(++_0xea3f8c);}(_0xc275,0x1c5));var _0x5c27=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xc275[_0x16b9ed];return _0x66b1f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c27('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5c27('0x1'));var util=require(_0x5c27('0x2'));var path=require(_0x5c27('0x3'));var sox=require(_0x5c27('0x4'));var csv=require(_0x5c27('0x5'));var ejs=require(_0x5c27('0x6'));var fs=require('fs');var fs_extra=require(_0x5c27('0x7'));var _=require(_0x5c27('0x8'));var squel=require(_0x5c27('0x9'));var crypto=require('crypto');var jsforce=require(_0x5c27('0xa'));var deskjs=require(_0x5c27('0xb'));var toCsv=require(_0x5c27('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5c27('0xc'));var authService=require(_0x5c27('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c27('0xe'))(_0x5c27('0xf'));var utils=require(_0x5c27('0x10'));var config=require(_0x5c27('0x11'));var licenseUtil=require(_0x5c27('0x12'));var db=require('../../mysqldb')['db'];config[_0x5c27('0x13')]=_[_0x5c27('0x14')](config[_0x5c27('0x13')],{'host':_0x5c27('0x15'),'port':0x18eb});var socket=require(_0x5c27('0x16'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x5c27('0x17')](socket);function respondWithStatusCode(_0x234857,_0x43bea3){_0x43bea3=_0x43bea3||0xcc;return function(_0x12b4ff){if(_0x12b4ff){return _0x234857[_0x5c27('0x18')](_0x43bea3);}return _0x234857['status'](_0x43bea3)[_0x5c27('0x19')]();};}function respondWithResult(_0x876ab8,_0x12cb23){_0x12cb23=_0x12cb23||0xc8;return function(_0x4e820a){if(_0x4e820a){return _0x876ab8[_0x5c27('0x1a')](_0x12cb23)['json'](_0x4e820a);}};}function respondWithFilteredResult(_0x28aff9,_0x19d376){return function(_0x1d1518){if(_0x1d1518){var _0x381d7f=typeof _0x19d376[_0x5c27('0x1b')]===_0x5c27('0x1c')&&typeof _0x19d376['limit']==='undefined';var _0x59014f=_0x1d1518[_0x5c27('0x1d')];var _0x193d73=_0x381d7f?0x0:_0x19d376['offset'];var _0x2afc25=_0x381d7f?_0x1d1518['count']:_0x19d376[_0x5c27('0x1b')]+_0x19d376[_0x5c27('0x1e')];var _0x58595f;if(_0x2afc25>=_0x59014f){_0x2afc25=_0x59014f;_0x58595f=0xc8;}else{_0x58595f=0xce;}_0x28aff9[_0x5c27('0x1a')](_0x58595f);return _0x28aff9[_0x5c27('0x1f')](_0x5c27('0x20'),_0x193d73+'-'+_0x2afc25+'/'+_0x59014f)[_0x5c27('0x21')](_0x1d1518);}return null;};}function patchUpdates(_0x2c9df9){return function(_0x37094e){try{jsonpatch[_0x5c27('0x22')](_0x37094e,_0x2c9df9,!![]);}catch(_0x3d52f0){return BPromise[_0x5c27('0x23')](_0x3d52f0);}return _0x37094e['save']();};}function saveUpdates(_0x4efa0c,_0x5721e7){return function(_0x3ff293){if(_0x3ff293){return _0x3ff293[_0x5c27('0x24')](_0x4efa0c)[_0x5c27('0x25')](function(_0x41e7f8){return _0x41e7f8;});}return null;};}function removeEntity(_0x1779aa,_0x1a6141){return function(_0x5d5591){if(_0x5d5591){return _0x5d5591[_0x5c27('0x26')]()[_0x5c27('0x25')](function(){var _0x372181=_0x5d5591[_0x5c27('0x27')]({'plain':!![]});var _0x194829=_0x5c27('0x28');return db[_0x5c27('0x29')]['destroy']({'where':{'type':_0x194829,'resourceId':_0x372181['id']}})['then'](function(){return _0x5d5591;});})[_0x5c27('0x25')](function(){_0x1779aa[_0x5c27('0x1a')](0xcc)[_0x5c27('0x19')]();});}};}function handleEntityNotFound(_0xc38e46,_0x1d0af7){return function(_0x3bacfe){if(!_0x3bacfe){_0xc38e46['sendStatus'](0x194);}return _0x3bacfe;};}function handleError(_0x28c3f3,_0x2b4eac){_0x2b4eac=_0x2b4eac||0x1f4;return function(_0x52e90c){logger[_0x5c27('0x2a')](_0x52e90c['stack']);if(_0x52e90c[_0x5c27('0x2b')]){delete _0x52e90c[_0x5c27('0x2b')];}_0x28c3f3[_0x5c27('0x1a')](_0x2b4eac)[_0x5c27('0x2c')](_0x52e90c);};}exports[_0x5c27('0x2d')]=function(_0x4f6523,_0x36cc46){var _0x1bebd7={},_0x4cc02a={},_0x320754={'count':0x0,'rows':[]};var _0x4ee368=_[_0x5c27('0x2e')](db[_0x5c27('0x2f')][_0x5c27('0x30')],function(_0x404c0b){return{'name':_0x404c0b['fieldName'],'type':_0x404c0b[_0x5c27('0x31')][_0x5c27('0x32')]};});_0x4cc02a[_0x5c27('0x33')]=_[_0x5c27('0x2e')](_0x4ee368,_0x5c27('0x2b'));_0x4cc02a[_0x5c27('0x34')]=_['keys'](_0x4f6523[_0x5c27('0x34')]);_0x4cc02a[_0x5c27('0x35')]=_[_0x5c27('0x36')](_0x4cc02a[_0x5c27('0x33')],_0x4cc02a[_0x5c27('0x34')]);_0x1bebd7[_0x5c27('0x37')]=_[_0x5c27('0x36')](_0x4cc02a[_0x5c27('0x33')],qs[_0x5c27('0x38')](_0x4f6523[_0x5c27('0x34')]['fields']));_0x1bebd7[_0x5c27('0x37')]=_0x1bebd7[_0x5c27('0x37')][_0x5c27('0x39')]?_0x1bebd7[_0x5c27('0x37')]:_0x4cc02a[_0x5c27('0x33')];if(!_0x4f6523[_0x5c27('0x34')]['hasOwnProperty'](_0x5c27('0x3a'))){_0x1bebd7[_0x5c27('0x1e')]=qs[_0x5c27('0x1e')](_0x4f6523[_0x5c27('0x34')][_0x5c27('0x1e')]);_0x1bebd7[_0x5c27('0x1b')]=qs[_0x5c27('0x1b')](_0x4f6523[_0x5c27('0x34')]['offset']);}_0x1bebd7[_0x5c27('0x3b')]=qs[_0x5c27('0x3c')](_0x4f6523[_0x5c27('0x34')]['sort']);_0x1bebd7['where']=qs[_0x5c27('0x35')](_[_0x5c27('0x3d')](_0x4f6523[_0x5c27('0x34')],_0x4cc02a[_0x5c27('0x35')]),_0x4ee368);if(_0x4f6523[_0x5c27('0x34')]['filter']){_0x1bebd7[_0x5c27('0x3e')]=_[_0x5c27('0x3f')](_0x1bebd7[_0x5c27('0x3e')],{'$or':_[_0x5c27('0x2e')](_0x4ee368,function(_0x57b973){if(_0x57b973['type']!=='VIRTUAL'){var _0x324a48={};_0x324a48[_0x57b973[_0x5c27('0x2b')]]={'$like':'%'+_0x4f6523[_0x5c27('0x34')][_0x5c27('0x40')]+'%'};return _0x324a48;}})});}_0x1bebd7=_['merge']({},_0x1bebd7,_0x4f6523[_0x5c27('0x41')]);var _0x5a6d62={'where':_0x1bebd7[_0x5c27('0x3e')]};return db[_0x5c27('0x2f')][_0x5c27('0x1d')](_0x5a6d62)['then'](function(_0x100717){_0x320754[_0x5c27('0x1d')]=_0x100717;if(_0x4f6523[_0x5c27('0x34')][_0x5c27('0x42')]){_0x1bebd7['include']=[{'all':!![]}];}return db['SmsQueue'][_0x5c27('0x43')](_0x1bebd7);})[_0x5c27('0x25')](function(_0x437cd4){_0x320754[_0x5c27('0x44')]=_0x437cd4;return _0x320754;})['then'](respondWithFilteredResult(_0x36cc46,_0x1bebd7))['catch'](handleError(_0x36cc46,null));};exports[_0x5c27('0x45')]=function(_0x2f957f,_0x5d82c4){var _0x10fee7={'raw':!![],'where':{'id':_0x2f957f[_0x5c27('0x46')]['id']}},_0x3ae902={};_0x3ae902[_0x5c27('0x33')]=_[_0x5c27('0x47')](db[_0x5c27('0x2f')][_0x5c27('0x30')]);_0x3ae902[_0x5c27('0x34')]=_[_0x5c27('0x47')](_0x2f957f[_0x5c27('0x34')]);_0x3ae902['filters']=_[_0x5c27('0x36')](_0x3ae902[_0x5c27('0x33')],_0x3ae902[_0x5c27('0x34')]);_0x10fee7['attributes']=_[_0x5c27('0x36')](_0x3ae902[_0x5c27('0x33')],qs[_0x5c27('0x38')](_0x2f957f[_0x5c27('0x34')][_0x5c27('0x38')]));_0x10fee7[_0x5c27('0x37')]=_0x10fee7[_0x5c27('0x37')][_0x5c27('0x39')]?_0x10fee7[_0x5c27('0x37')]:_0x3ae902[_0x5c27('0x33')];if(_0x2f957f['query'][_0x5c27('0x42')]){_0x10fee7[_0x5c27('0x48')]=[{'all':!![]}];}_0x10fee7=_[_0x5c27('0x3f')]({},_0x10fee7,_0x2f957f[_0x5c27('0x41')]);return db['SmsQueue']['find'](_0x10fee7)[_0x5c27('0x25')](handleEntityNotFound(_0x5d82c4,null))['then'](respondWithResult(_0x5d82c4,null))[_0x5c27('0x49')](handleError(_0x5d82c4,null));};exports['create']=function(_0x2af072,_0x357782){return db[_0x5c27('0x2f')][_0x5c27('0x4a')](_0x2af072[_0x5c27('0x4b')],{})[_0x5c27('0x25')](function(_0x4b7921){var _0x36228b=_0x2af072[_0x5c27('0x4c')]['get']({'plain':!![]});if(!_0x36228b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36228b['role']==='user'){var _0x3dda45=_0x4b7921['get']({'plain':!![]});var _0x290108=_0x5c27('0x28');return db[_0x5c27('0x4d')][_0x5c27('0x4e')]({'where':{'name':_0x290108,'userProfileId':_0x36228b['userProfileId']},'raw':!![]})[_0x5c27('0x25')](function(_0x564354){if(_0x564354&&_0x564354[_0x5c27('0x4f')]===0x0){return db[_0x5c27('0x29')][_0x5c27('0x4a')]({'name':_0x3dda45['name'],'resourceId':_0x3dda45['id'],'type':_0x564354[_0x5c27('0x2b')],'sectionId':_0x564354['id']},{})['then'](function(){return _0x4b7921;});}else{return _0x4b7921;}})[_0x5c27('0x49')](function(_0x46942b){logger[_0x5c27('0x2a')](_0x5c27('0x50'),_0x46942b);throw _0x46942b;});}return _0x4b7921;})[_0x5c27('0x25')](respondWithResult(_0x357782,0xc9))['catch'](handleError(_0x357782,null));};exports[_0x5c27('0x24')]=function(_0x5b0f0b,_0x25de71){if(_0x5b0f0b[_0x5c27('0x4b')]['id']){delete _0x5b0f0b[_0x5c27('0x4b')]['id'];}return db['SmsQueue'][_0x5c27('0x4e')]({'where':{'id':_0x5b0f0b[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](handleEntityNotFound(_0x25de71,null))[_0x5c27('0x25')](saveUpdates(_0x5b0f0b[_0x5c27('0x4b')],null))[_0x5c27('0x25')](respondWithResult(_0x25de71,null))[_0x5c27('0x49')](handleError(_0x25de71,null));};exports[_0x5c27('0x26')]=function(_0x5d0751,_0x3bf8e7){return db[_0x5c27('0x2f')]['find']({'where':{'id':_0x5d0751['params']['id']}})[_0x5c27('0x25')](handleEntityNotFound(_0x3bf8e7,null))['then'](removeEntity(_0x3bf8e7,null))[_0x5c27('0x49')](handleError(_0x3bf8e7,null));};exports[_0x5c27('0x51')]=function(_0x12060a,_0x56ecc0){return db['SmsQueue'][_0x5c27('0x51')]()[_0x5c27('0x25')](respondWithResult(_0x56ecc0,null))[_0x5c27('0x49')](handleError(_0x56ecc0,null));};exports[_0x5c27('0x52')]=function(_0x308d04,_0x203c5f,_0x279b85){var _0x55e093={'raw':!![],'where':{}},_0x4d9ada={},_0x47d4c6;return db[_0x5c27('0x2f')][_0x5c27('0x53')]({'where':{'id':_0x308d04['params']['id']}})['then'](handleEntityNotFound(_0x203c5f,null))[_0x5c27('0x25')](function(_0x5851bc){if(_0x5851bc){_0x47d4c6=_0x5851bc[_0x5c27('0x27')]({'plain':!![]});_0x4d9ada['model']=_['keys'](db[_0x5c27('0x54')][_0x5c27('0x30')]);_0x4d9ada[_0x5c27('0x34')]=_[_0x5c27('0x47')](_0x308d04['query']);_0x4d9ada[_0x5c27('0x35')]=_[_0x5c27('0x36')](_0x4d9ada[_0x5c27('0x33')],_0x4d9ada[_0x5c27('0x34')]);_0x55e093['attributes']=_['intersection'](_0x4d9ada[_0x5c27('0x33')],qs['fields'](_0x308d04[_0x5c27('0x34')][_0x5c27('0x38')]));_0x55e093[_0x5c27('0x37')]=_0x55e093['attributes']['length']?_0x55e093['attributes']:_0x4d9ada[_0x5c27('0x33')];if(!_0x308d04[_0x5c27('0x34')]['hasOwnProperty']('nolimit')){_0x55e093[_0x5c27('0x1e')]=qs[_0x5c27('0x1e')](_0x308d04[_0x5c27('0x34')]['limit']);_0x55e093[_0x5c27('0x1b')]=qs[_0x5c27('0x1b')](_0x308d04['query'][_0x5c27('0x1b')]);}_0x55e093[_0x5c27('0x3b')]=qs['sort'](_0x308d04[_0x5c27('0x34')][_0x5c27('0x3c')]);_0x55e093[_0x5c27('0x3e')]=qs[_0x5c27('0x35')](_['pick'](_0x308d04['query'],_0x4d9ada[_0x5c27('0x35')]));_0x55e093[_0x5c27('0x3e')][_0x5c27('0x55')]=_0x5851bc['id'];if(_0x308d04[_0x5c27('0x34')][_0x5c27('0x40')]){_0x55e093[_0x5c27('0x3e')]=_[_0x5c27('0x3f')](_0x55e093['where'],{'$or':_[_0x5c27('0x2e')](_0x55e093['attributes'],function(_0x56bf88){var _0x56dcac={};_0x56dcac[_0x56bf88]={'$like':'%'+_0x308d04[_0x5c27('0x34')][_0x5c27('0x40')]+'%'};return _0x56dcac;})});}_0x55e093=_[_0x5c27('0x3f')]({},_0x55e093,_0x308d04[_0x5c27('0x41')]);return db[_0x5c27('0x54')][_0x5c27('0x43')](_0x55e093);}})[_0x5c27('0x25')](function(_0x3ba1dd){if(_0x3ba1dd){return db[_0x5c27('0x56')]['findAndCountAll']({'where':{'id':_[_0x5c27('0x2e')](_0x3ba1dd,_0x5c27('0x57')),'role':_0x5c27('0x58')},'attributes':['id',_0x5c27('0x2b'),_0x5c27('0x59'),_0x5c27('0x5a'),_0x5c27('0x5b')]});}})[_0x5c27('0x25')](function(_0x105325){if(_0x105325){return{'count':_0x105325[_0x5c27('0x1d')],'rows':_['map'](_0x105325[_0x5c27('0x44')],function(_0x9aebd6){return{'membername':_0x9aebd6[_0x5c27('0x2b')],'UserId':_0x9aebd6['id'],'queue_name':_0x47d4c6[_0x5c27('0x2b')],'SmsQueueId':_0x47d4c6['id'],'interface':util[_0x5c27('0x5c')](_0x5c27('0x5d'),'SIP',_0x9aebd6['name']),'penalty':0x0,'paused':_0x9aebd6['smsPause'],'createdAt':_0x9aebd6[_0x5c27('0x5b')],'updatedAt':_0x9aebd6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x5c27('0x25')](respondWithFilteredResult(_0x203c5f,_0x55e093))['catch'](handleError(_0x203c5f,null));};exports[_0x5c27('0x5e')]=function(_0x590677,_0x458404,_0x5b6688){var _0x37c9e3={};var _0x285937={};var _0x557cc2;var _0x41495b;return db[_0x5c27('0x2f')][_0x5c27('0x53')]({'where':{'id':_0x590677[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](handleEntityNotFound(_0x458404,null))[_0x5c27('0x25')](function(_0x5781a3){if(_0x5781a3){_0x557cc2=_0x5781a3;_0x285937[_0x5c27('0x33')]=_[_0x5c27('0x47')](db['Team'][_0x5c27('0x30')]);_0x285937['query']=_[_0x5c27('0x47')](_0x590677['query']);_0x285937[_0x5c27('0x35')]=_[_0x5c27('0x36')](_0x285937[_0x5c27('0x33')],_0x285937['query']);_0x37c9e3[_0x5c27('0x37')]=_[_0x5c27('0x36')](_0x285937[_0x5c27('0x33')],qs['fields'](_0x590677[_0x5c27('0x34')][_0x5c27('0x38')]));_0x37c9e3['attributes']=_0x37c9e3[_0x5c27('0x37')][_0x5c27('0x39')]?_0x37c9e3[_0x5c27('0x37')]:_0x285937['model'];_0x37c9e3[_0x5c27('0x3b')]=qs[_0x5c27('0x3c')](_0x590677['query'][_0x5c27('0x3c')]);_0x37c9e3[_0x5c27('0x3e')]=qs[_0x5c27('0x35')](_['pick'](_0x590677[_0x5c27('0x34')],_0x285937[_0x5c27('0x35')]));if(_0x590677[_0x5c27('0x34')]['filter']){_0x37c9e3[_0x5c27('0x3e')]=_[_0x5c27('0x3f')](_0x37c9e3['where'],{'$or':_[_0x5c27('0x2e')](_0x37c9e3['attributes'],function(_0xd7c9b0){var _0x4d1574={};_0x4d1574[_0xd7c9b0]={'$like':'%'+_0x590677[_0x5c27('0x34')][_0x5c27('0x40')]+'%'};return _0x4d1574;})});}_0x37c9e3=_[_0x5c27('0x3f')]({},_0x37c9e3,_0x590677['options']);return _0x557cc2[_0x5c27('0x5e')](_0x37c9e3);}})[_0x5c27('0x25')](function(_0xa95e71){if(_0xa95e71){_0x41495b=_0xa95e71[_0x5c27('0x39')];if(!_0x590677['query']['hasOwnProperty']('nolimit')){_0x37c9e3[_0x5c27('0x1e')]=qs[_0x5c27('0x1e')](_0x590677[_0x5c27('0x34')][_0x5c27('0x1e')]);_0x37c9e3[_0x5c27('0x1b')]=qs[_0x5c27('0x1b')](_0x590677[_0x5c27('0x34')][_0x5c27('0x1b')]);}return _0x557cc2['getTeams'](_0x37c9e3);}})[_0x5c27('0x25')](function(_0x5dd1db){if(_0x5dd1db){return _0x5dd1db?{'count':_0x41495b,'rows':_0x5dd1db}:null;}})[_0x5c27('0x25')](respondWithResult(_0x458404,null))[_0x5c27('0x49')](handleError(_0x458404,null));};exports[_0x5c27('0x5f')]=function(_0x218150,_0x5d6a69,_0x3d1c73){var _0x4e0ec0=_0x218150[_0x5c27('0x4b')][_0x5c27('0x60')];return db[_0x5c27('0x61')][_0x5c27('0x43')]({'where':{'id':_0x4e0ec0},'attributes':['id'],'include':[{'model':db[_0x5c27('0x56')],'as':_0x5c27('0x62'),'attributes':['id',_0x5c27('0x2b'),_0x5c27('0x63'),_0x5c27('0x64'),_0x5c27('0x65')],'raw':!![]}]})[_0x5c27('0x25')](function(_0x287f2a){if(_0x287f2a){var _0x366fb9=_[_0x5c27('0x66')](_0x287f2a,function(_0x491582){var _0x34ac3b=_0x491582[_0x5c27('0x27')]({'plain':!![]});return _0x34ac3b[_0x5c27('0x62')];});return db[_0x5c27('0x2f')][_0x5c27('0x4e')]({'where':{'id':_0x218150[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](function(_0x45968c){return db['sequelize'][_0x5c27('0x67')](function(_0x4c51fa){return _0x45968c[_0x5c27('0x5f')](_0x4e0ec0,{'transaction':_0x4c51fa})[_0x5c27('0x25')](function(){return BPromise['each'](_0x366fb9,function(_0x343ab5){return db[_0x5c27('0x54')][_0x5c27('0x68')]({'where':{'UserId':_0x343ab5['id'],'SmsQueueId':_0x218150[_0x5c27('0x46')]['id']},'transaction':_0x4c51fa});});})[_0x5c27('0x25')](function(){_0x366fb9['forEach'](function(_0x549eb7){socket[_0x5c27('0x69')](_0x5c27('0x6a'),{'UserId':_0x549eb7['id'],'SmsQueueId':_0x45968c['id']});});});});});}})[_0x5c27('0x25')](respondWithStatusCode(_0x5d6a69,null))[_0x5c27('0x49')](handleError(_0x5d6a69,null));};exports[_0x5c27('0x6b')]=function(_0x3cab23,_0x17080e,_0x496a0a){return db['Team'][_0x5c27('0x43')]({'where':{'id':_0x3cab23['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x5c27('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5c27('0x25')](handleEntityNotFound(_0x17080e,null))[_0x5c27('0x25')](function(_0x1202fb){var _0x30171f=_[_0x5c27('0x2e')](_0x1202fb,'id');var _0x77b760=[];var _0x18c732=[];var _0x36b8ad=squel[_0x5c27('0x6c')]();_0x36b8ad[_0x5c27('0x6d')](_0x5c27('0x6e'))[_0x5c27('0x6f')](_0x5c27('0x70'),'tq')[_0x5c27('0x71')](_0x5c27('0x72'),'ut',_0x5c27('0x73'))[_0x5c27('0x3e')]('SmsQueueId\x20=\x20?',_0x3cab23[_0x5c27('0x46')]['id']);for(var _0x85b355=0x0;_0x85b355<_0x1202fb[_0x5c27('0x39')];_0x85b355+=0x1){let _0x399184=_0x1202fb[_0x85b355];for(var _0x29fb4e=0x0;_0x29fb4e<_0x399184['Agents'][_0x5c27('0x39')];_0x29fb4e+=0x1){let _0x2db523=_0x399184[_0x5c27('0x62')][_0x29fb4e];var _0x165246=_0x36b8ad['clone']();_0x165246[_0x5c27('0x3e')](_0x5c27('0x74'),_0x2db523['id']);_0x18c732['push'](db[_0x5c27('0x75')][_0x5c27('0x34')](_0x165246['toString'](),{'type':db['sequelize'][_0x5c27('0x76')][_0x5c27('0x77')]})['then'](function(_0x359e59){if(_0x359e59[_0x5c27('0x39')]===0x1){return _0x2db523['id'];}else{var _0x227013=_[_0x5c27('0x78')](_[_0x5c27('0x2e')](_0x359e59,_0x5c27('0x79')),function(_0x3367e3){return _['includes'](_0x30171f,_0x3367e3);});if(_0x227013){return _0x2db523['id'];}}}));}}return BPromise[_0x5c27('0x7a')](_0x18c732)[_0x5c27('0x25')](function(_0x4b2601){_0x77b760=_(_0x77b760)['union'](_0x4b2601)[_0x5c27('0x7b')]()[_0x5c27('0x7c')]();return db['SmsQueue']['find']({'where':{'id':_0x3cab23[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](function(_0x51367b){return db[_0x5c27('0x75')][_0x5c27('0x67')](function(_0x243cd7){return _0x51367b[_0x5c27('0x6b')](_0x3cab23[_0x5c27('0x34')]['ids'],{'transaction':_0x243cd7})[_0x5c27('0x25')](function(){if(!_[_0x5c27('0x7d')](_0x77b760)){return _0x51367b[_0x5c27('0x7e')](_0x77b760,{'transaction':_0x243cd7});}})['then'](function(){_0x77b760['forEach'](function(_0x22463e){socket[_0x5c27('0x69')](_0x5c27('0x7f'),{'UserId':_0x22463e,'SmsQueueId':_0x51367b['id']});});});});});});})[_0x5c27('0x25')](respondWithStatusCode(_0x17080e,null))[_0x5c27('0x49')](handleError(_0x17080e,null));};exports['addAgents']=function(_0x42317f,_0x56d5e3,_0x3387cc){return db['SmsQueue'][_0x5c27('0x4e')]({'where':{'id':_0x42317f[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](handleEntityNotFound(_0x56d5e3,null))['then'](function(_0x4e149e){if(_0x4e149e){return _0x4e149e['addAgents'](_0x42317f[_0x5c27('0x4b')][_0x5c27('0x60')],_[_0x5c27('0x80')](_0x42317f['body'],[_0x5c27('0x60'),'id'])||{})['spread'](function(_0x33bcad){for(var _0x5a76f4=0x0;_0x5a76f4<_0x42317f[_0x5c27('0x4b')][_0x5c27('0x60')][_0x5c27('0x39')];_0x5a76f4+=0x1){socket[_0x5c27('0x69')](_0x5c27('0x6a'),{'UserId':Number(_0x42317f[_0x5c27('0x4b')][_0x5c27('0x60')][_0x5a76f4]),'SmsQueueId':Number(_0x42317f[_0x5c27('0x46')]['id'])});}return _0x33bcad;});}})[_0x5c27('0x25')](respondWithResult(_0x56d5e3,null))[_0x5c27('0x49')](handleError(_0x56d5e3,null));};exports[_0x5c27('0x7e')]=function(_0x1df89c,_0x187f20,_0x449315){return db[_0x5c27('0x2f')][_0x5c27('0x4e')]({'where':{'id':_0x1df89c['params']['id']}})['then'](handleEntityNotFound(_0x187f20,null))[_0x5c27('0x25')](function(_0x8e4916){if(_0x8e4916){return _0x8e4916['removeAgents'](_0x1df89c[_0x5c27('0x34')][_0x5c27('0x60')])[_0x5c27('0x25')](function(){if(_['isArray'](_0x1df89c['query'][_0x5c27('0x60')])){for(var _0xa74469=0x0;_0xa74469<_0x1df89c['query'][_0x5c27('0x60')][_0x5c27('0x39')];_0xa74469+=0x1){socket[_0x5c27('0x69')](_0x5c27('0x7f'),{'UserId':Number(_0x1df89c[_0x5c27('0x34')][_0x5c27('0x60')][_0xa74469]),'SmsQueueId':Number(_0x1df89c[_0x5c27('0x46')]['id'])});}}else{socket[_0x5c27('0x69')](_0x5c27('0x7f'),{'UserId':Number(_0x1df89c[_0x5c27('0x34')][_0x5c27('0x60')]),'SmsQueueId':Number(_0x1df89c[_0x5c27('0x46')]['id'])});}});}})[_0x5c27('0x25')](respondWithStatusCode(_0x187f20,null))['catch'](handleError(_0x187f20,null));};exports[_0x5c27('0x81')]=function(_0x55a28d,_0x298ec2,_0x26f38d){var _0x5a81bf={};var _0x3a822e={};var _0x2cf4da;var _0x49948a;return db[_0x5c27('0x2f')][_0x5c27('0x53')]({'where':{'id':_0x55a28d[_0x5c27('0x46')]['id']}})[_0x5c27('0x25')](handleEntityNotFound(_0x298ec2,null))[_0x5c27('0x25')](function(_0x24f408){if(_0x24f408){_0x2cf4da=_0x24f408;_0x3a822e[_0x5c27('0x33')]=_[_0x5c27('0x47')](db[_0x5c27('0x56')]['rawAttributes']);_0x3a822e[_0x5c27('0x34')]=_['keys'](_0x55a28d['query']);_0x3a822e[_0x5c27('0x35')]=_[_0x5c27('0x36')](_0x3a822e[_0x5c27('0x33')],_0x3a822e[_0x5c27('0x34')]);_0x5a81bf[_0x5c27('0x37')]=_[_0x5c27('0x36')](_0x3a822e[_0x5c27('0x33')],qs[_0x5c27('0x38')](_0x55a28d[_0x5c27('0x34')]['fields']));_0x5a81bf['attributes']=_0x5a81bf[_0x5c27('0x37')][_0x5c27('0x39')]?_0x5a81bf['attributes']:_0x3a822e[_0x5c27('0x33')];_0x5a81bf[_0x5c27('0x3b')]=qs[_0x5c27('0x3c')](_0x55a28d[_0x5c27('0x34')][_0x5c27('0x3c')]);_0x5a81bf[_0x5c27('0x3e')]=qs[_0x5c27('0x35')](_[_0x5c27('0x3d')](_0x55a28d['query'],_0x3a822e[_0x5c27('0x35')]));if(_0x55a28d[_0x5c27('0x34')][_0x5c27('0x40')]){_0x5a81bf['where']=_['merge'](_0x5a81bf[_0x5c27('0x3e')],{'$or':_[_0x5c27('0x2e')](_0x5a81bf['attributes'],function(_0x150534){var _0x3b6672={};_0x3b6672[_0x150534]={'$like':'%'+_0x55a28d['query'][_0x5c27('0x40')]+'%'};return _0x3b6672;})});}_0x5a81bf=_[_0x5c27('0x3f')]({},_0x5a81bf,_0x55a28d['options']);return _0x2cf4da[_0x5c27('0x81')](_0x5a81bf);}})[_0x5c27('0x25')](function(_0x570dfc){if(_0x570dfc){_0x49948a=_0x570dfc[_0x5c27('0x39')];if(!_0x55a28d[_0x5c27('0x34')][_0x5c27('0x82')](_0x5c27('0x3a'))){_0x5a81bf[_0x5c27('0x1e')]=qs[_0x5c27('0x1e')](_0x55a28d[_0x5c27('0x34')][_0x5c27('0x1e')]);_0x5a81bf[_0x5c27('0x1b')]=qs[_0x5c27('0x1b')](_0x55a28d[_0x5c27('0x34')]['offset']);}return _0x2cf4da['getAgents'](_0x5a81bf);}})[_0x5c27('0x25')](function(_0x11c39c){if(_0x11c39c){return _0x11c39c?{'count':_0x49948a,'rows':_0x11c39c}:null;}})[_0x5c27('0x25')](respondWithResult(_0x298ec2,null))['catch'](handleError(_0x298ec2,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index d9baa66..bca7231 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 _0x1033=['update','remove','emit','hasOwnProperty','hook','exports','SmsQueue','setMaxListeners','save'];(function(_0x71a7e7,_0x505d3f){var _0x5dfb36=function(_0x495031){while(--_0x495031){_0x71a7e7['push'](_0x71a7e7['shift']());}};_0x5dfb36(++_0x505d3f);}(_0x1033,0x11d));var _0x3103=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x1033[_0x11005e];return _0x29338f;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x3103('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3103('0x1')](0x0);var events={'afterCreate':_0x3103('0x2'),'afterUpdate':_0x3103('0x3'),'afterDestroy':_0x3103('0x4')};function emitEvent(_0x4b7881){return function(_0x592134,_0x431007,_0x5b10c1){SmsQueueEvents['emit'](_0x4b7881+':'+_0x592134['id'],_0x592134);SmsQueueEvents[_0x3103('0x5')](_0x4b7881,_0x592134);_0x5b10c1(null);};}for(var e in events){if(events[_0x3103('0x6')](e)){var event=events[e];SmsQueue[_0x3103('0x7')](e,emitEvent(event));}}module[_0x3103('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xa6b1=['SmsQueue','setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0x20bb22,_0x78e38f){var _0xe48619=function(_0x4d6237){while(--_0x4d6237){_0x20bb22['push'](_0x20bb22['shift']());}};_0xe48619(++_0x78e38f);}(_0xa6b1,0x6e));var _0x1a6b=function(_0x463049,_0x2c1d0c){_0x463049=_0x463049-0x0;var _0x39b25a=_0xa6b1[_0x463049];return _0x39b25a;};'use strict';var EventEmitter=require(_0x1a6b('0x0'));var SmsQueue=require(_0x1a6b('0x1'))['db'][_0x1a6b('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1a6b('0x3')](0x0);var events={'afterCreate':_0x1a6b('0x4'),'afterUpdate':'update','afterDestroy':_0x1a6b('0x5')};function emitEvent(_0x129f8c){return function(_0x4a34da,_0x56b2aa,_0x398eeb){SmsQueueEvents[_0x1a6b('0x6')](_0x129f8c+':'+_0x4a34da['id'],_0x4a34da);SmsQueueEvents['emit'](_0x129f8c,_0x4a34da);_0x398eeb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x1a6b('0x7')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index cf8d11c..9f7b182 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 _0xdcfd=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util'];(function(_0x38825d,_0x2fbc52){var _0x5aff0e=function(_0x18ac13){while(--_0x18ac13){_0x38825d['push'](_0x38825d['shift']());}};_0x5aff0e(++_0x2fbc52);}(_0xdcfd,0x186));var _0xddcf=function(_0x545b71,_0x4f44eb){_0x545b71=_0x545b71-0x0;var _0x26e587=_0xdcfd[_0x545b71];return _0x26e587;};'use strict';var _=require(_0xddcf('0x0'));var util=require(_0xddcf('0x1'));var logger=require(_0xddcf('0x2'))(_0xddcf('0x3'));var moment=require(_0xddcf('0x4'));var BPromise=require('bluebird');var rp=require(_0xddcf('0x5'));var fs=require('fs');var path=require(_0xddcf('0x6'));var rimraf=require(_0xddcf('0x7'));var config=require(_0xddcf('0x8'));var attributes=require(_0xddcf('0x9'));module[_0xddcf('0xa')]=function(_0x1f5f17,_0x37e76e){return _0x1f5f17[_0xddcf('0xb')](_0xddcf('0xc'),attributes,{'tableName':_0xddcf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b16=['../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0x3b16,0x1b2));var _0x63b1=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x3b16[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0x63b1('0x0'));var logger=require(_0x63b1('0x1'))(_0x63b1('0x2'));var moment=require(_0x63b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x63b1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63b1('0x5'));var config=require(_0x63b1('0x6'));var attributes=require(_0x63b1('0x7'));module[_0x63b1('0x8')]=function(_0xe09d5,_0x31ac91){return _0xe09d5[_0x63b1('0x9')](_0x63b1('0xa'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index abfbdcc..d9ebfbf 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 _0x7fba=['raw','where','attributes','include','map','model','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetSmsQueue','SmsQueue','findAll','options'];(function(_0x290c34,_0x3758e6){var _0x383db3=function(_0x504c74){while(--_0x504c74){_0x290c34['push'](_0x290c34['shift']());}};_0x383db3(++_0x3758e6);}(_0x7fba,0x137));var _0xa7fb=function(_0x278380,_0x42ffbb){_0x278380=_0x278380-0x0;var _0x145f90=_0x7fba[_0x278380];return _0x145f90;};'use strict';var _=require(_0xa7fb('0x0'));var util=require(_0xa7fb('0x1'));var moment=require(_0xa7fb('0x2'));var BPromise=require(_0xa7fb('0x3'));var rs=require(_0xa7fb('0x4'));var fs=require('fs');var Redis=require(_0xa7fb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7fb('0x6'));var logger=require(_0xa7fb('0x7'))('rpc');var config=require(_0xa7fb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa7fb('0x9')][_0xa7fb('0xa')]({'port':0x232a});config['redis']=_[_0xa7fb('0xb')](config[_0xa7fb('0xc')],{'host':_0xa7fb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa7fb('0xc')]));require(_0xa7fb('0xe'))[_0xa7fb('0xf')](socket);function respondWithRpcPromise(_0x5001d0,_0x4206d8,_0x4b5723){return new BPromise(function(_0x76fe1e,_0x309e81){return client[_0xa7fb('0x10')](_0x5001d0,_0x4b5723)[_0xa7fb('0x11')](function(_0x173f26){logger[_0xa7fb('0x12')](_0xa7fb('0x13'),_0x4206d8,'request\x20sent');logger[_0xa7fb('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x4206d8,_0xa7fb('0x15'),JSON[_0xa7fb('0x16')](_0x173f26));if(_0x173f26[_0xa7fb('0x17')]){if(_0x173f26[_0xa7fb('0x17')]['code']===0x1f4){logger['error'](_0xa7fb('0x13'),_0x4206d8,_0x173f26[_0xa7fb('0x17')][_0xa7fb('0x18')]);return _0x309e81(_0x173f26[_0xa7fb('0x17')][_0xa7fb('0x18')]);}logger[_0xa7fb('0x17')](_0xa7fb('0x13'),_0x4206d8,_0x173f26[_0xa7fb('0x17')]['message']);return _0x76fe1e(_0x173f26[_0xa7fb('0x17')][_0xa7fb('0x18')]);}else{logger[_0xa7fb('0x12')](_0xa7fb('0x13'),_0x4206d8,_0xa7fb('0x15'));_0x76fe1e(_0x173f26[_0xa7fb('0x19')][_0xa7fb('0x18')]);}})[_0xa7fb('0x1a')](function(_0x74efb2){logger[_0xa7fb('0x17')]('SmsQueue,\x20%s,\x20%s',_0x4206d8,_0x74efb2);_0x309e81(_0x74efb2);});});}exports[_0xa7fb('0x1b')]=function(_0x11b336){var _0x454023=this;return new Promise(function(_0x5def8a,_0x54d17d){return db[_0xa7fb('0x1c')][_0xa7fb('0x1d')]({'raw':_0x11b336[_0xa7fb('0x1e')]?_0x11b336['options'][_0xa7fb('0x1f')]===undefined?!![]:![]:!![],'where':_0x11b336['options']?_0x11b336[_0xa7fb('0x1e')][_0xa7fb('0x20')]||null:null,'attributes':_0x11b336[_0xa7fb('0x1e')]?_0x11b336['options'][_0xa7fb('0x21')]||null:null,'limit':_0x11b336[_0xa7fb('0x1e')]?_0x11b336[_0xa7fb('0x1e')]['limit']||null:null,'include':_0x11b336['options']?_0x11b336['options'][_0xa7fb('0x22')]?_[_0xa7fb('0x23')](_0x11b336[_0xa7fb('0x1e')][_0xa7fb('0x22')],function(_0x1a7f3c){return{'model':db[_0x1a7f3c[_0xa7fb('0x24')]],'as':_0x1a7f3c['as'],'attributes':_0x1a7f3c[_0xa7fb('0x21')],'include':_0x1a7f3c[_0xa7fb('0x22')]?_['map'](_0x1a7f3c[_0xa7fb('0x22')],function(_0x249285){return{'model':db[_0x249285[_0xa7fb('0x24')]],'as':_0x249285['as'],'attributes':_0x249285['attributes'],'include':_0x249285[_0xa7fb('0x22')]?_[_0xa7fb('0x23')](_0x249285[_0xa7fb('0x22')],function(_0x347463){return{'model':db[_0x347463[_0xa7fb('0x24')]],'as':_0x347463['as'],'attributes':_0x347463['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a4fa1){logger[_0xa7fb('0x12')](_0xa7fb('0x1b'),_0x11b336);logger['debug']('GetSmsQueue',_0x11b336,JSON[_0xa7fb('0x16')](_0x4a4fa1));_0x5def8a(_0x4a4fa1);})[_0xa7fb('0x1a')](function(_0xc0d362){logger['error']('GetSmsQueue',_0xc0d362[_0xa7fb('0x18')],_0x11b336);_0x54d17d(_0x454023['error'](0x1f4,_0xc0d362['message']));});});};exports[_0xa7fb('0x25')]=function(_0x4c3863){var _0x5d8176=this;return new Promise(function(_0x2522de,_0x1780a8){return db[_0xa7fb('0x1c')]['find']({'raw':_0x4c3863['options']?_0x4c3863['options'][_0xa7fb('0x1f')]===undefined?!![]:![]:!![],'where':_0x4c3863[_0xa7fb('0x1e')]?_0x4c3863[_0xa7fb('0x1e')]['where']||null:null,'attributes':_0x4c3863[_0xa7fb('0x1e')]?_0x4c3863[_0xa7fb('0x1e')][_0xa7fb('0x21')]||null:null,'include':_0x4c3863[_0xa7fb('0x1e')]?_0x4c3863['options'][_0xa7fb('0x22')]?_[_0xa7fb('0x23')](_0x4c3863[_0xa7fb('0x1e')][_0xa7fb('0x22')],function(_0x2557c0){return{'model':db[_0x2557c0[_0xa7fb('0x24')]],'as':_0x2557c0['as'],'attributes':_0x2557c0['attributes'],'include':_0x2557c0['include']?_['map'](_0x2557c0[_0xa7fb('0x22')],function(_0x346dc4){return{'model':db[_0x346dc4['model']],'as':_0x346dc4['as'],'attributes':_0x346dc4[_0xa7fb('0x21')],'include':_0x346dc4[_0xa7fb('0x22')]?_[_0xa7fb('0x23')](_0x346dc4[_0xa7fb('0x22')],function(_0x2fd439){return{'model':db[_0x2fd439[_0xa7fb('0x24')]],'as':_0x2fd439['as'],'attributes':_0x2fd439[_0xa7fb('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa7fb('0x11')](function(_0x209960){logger[_0xa7fb('0x12')]('ShowSmsQueue',_0x4c3863);logger[_0xa7fb('0x14')]('ShowSmsQueue',_0x4c3863,JSON[_0xa7fb('0x16')](_0x209960));_0x2522de(_0x209960);})[_0xa7fb('0x1a')](function(_0x2ee10d){logger[_0xa7fb('0x17')](_0xa7fb('0x25'),_0x2ee10d[_0xa7fb('0x18')],_0x4c3863);_0x1780a8(_0x5d8176['error'](0x1f4,_0x2ee10d[_0xa7fb('0x18')]));});});}; \ No newline at end of file +var _0xb74c=['localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetSmsQueue','ShowSmsQueue','SmsQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x157298,_0x2f1dd2){var _0x43368c=function(_0x5848ff){while(--_0x5848ff){_0x157298['push'](_0x157298['shift']());}};_0x43368c(++_0x2f1dd2);}(_0xb74c,0x111));var _0xcb74=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb74c[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xcb74('0x0'));var util=require(_0xcb74('0x1'));var moment=require(_0xcb74('0x2'));var BPromise=require(_0xcb74('0x3'));var rs=require(_0xcb74('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb74('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb74('0x6'))(_0xcb74('0x7'));var config=require(_0xcb74('0x8'));var jayson=require(_0xcb74('0x9'));var client=jayson[_0xcb74('0xa')][_0xcb74('0xb')]({'port':0x232a});config[_0xcb74('0xc')]=_[_0xcb74('0xd')](config[_0xcb74('0xc')],{'host':_0xcb74('0xe'),'port':0x18eb});var socket=require(_0xcb74('0xf'))(new Redis(config[_0xcb74('0xc')]));require(_0xcb74('0x10'))[_0xcb74('0x11')](socket);function respondWithRpcPromise(_0x71f14d,_0x2574f5,_0x4c87b5){return new BPromise(function(_0x4a7b8b,_0x19424f){return client[_0xcb74('0x12')](_0x71f14d,_0x4c87b5)[_0xcb74('0x13')](function(_0x1ef4ea){logger[_0xcb74('0x14')](_0xcb74('0x15'),_0x2574f5,'request\x20sent');logger[_0xcb74('0x16')](_0xcb74('0x17'),_0x2574f5,_0xcb74('0x18'),JSON[_0xcb74('0x19')](_0x1ef4ea));if(_0x1ef4ea['error']){if(_0x1ef4ea[_0xcb74('0x1a')]['code']===0x1f4){logger[_0xcb74('0x1a')](_0xcb74('0x15'),_0x2574f5,_0x1ef4ea[_0xcb74('0x1a')][_0xcb74('0x1b')]);return _0x19424f(_0x1ef4ea[_0xcb74('0x1a')][_0xcb74('0x1b')]);}logger[_0xcb74('0x1a')](_0xcb74('0x15'),_0x2574f5,_0x1ef4ea[_0xcb74('0x1a')][_0xcb74('0x1b')]);return _0x4a7b8b(_0x1ef4ea[_0xcb74('0x1a')][_0xcb74('0x1b')]);}else{logger[_0xcb74('0x14')]('SmsQueue,\x20%s,\x20%s',_0x2574f5,_0xcb74('0x18'));_0x4a7b8b(_0x1ef4ea[_0xcb74('0x1c')][_0xcb74('0x1b')]);}})[_0xcb74('0x1d')](function(_0x1b70fd){logger[_0xcb74('0x1a')](_0xcb74('0x15'),_0x2574f5,_0x1b70fd);_0x19424f(_0x1b70fd);});});}exports['GetSmsQueue']=function(_0x132a6e){var _0x299a6e=this;return new Promise(function(_0xab35d1,_0x158fe1){return db['SmsQueue'][_0xcb74('0x1e')]({'raw':_0x132a6e[_0xcb74('0x1f')]?_0x132a6e[_0xcb74('0x1f')][_0xcb74('0x20')]===undefined?!![]:![]:!![],'where':_0x132a6e[_0xcb74('0x1f')]?_0x132a6e[_0xcb74('0x1f')][_0xcb74('0x21')]||null:null,'attributes':_0x132a6e[_0xcb74('0x1f')]?_0x132a6e[_0xcb74('0x1f')][_0xcb74('0x22')]||null:null,'limit':_0x132a6e[_0xcb74('0x1f')]?_0x132a6e[_0xcb74('0x1f')]['limit']||null:null,'include':_0x132a6e[_0xcb74('0x1f')]?_0x132a6e[_0xcb74('0x1f')][_0xcb74('0x23')]?_[_0xcb74('0x24')](_0x132a6e['options'][_0xcb74('0x23')],function(_0x4a37f2){return{'model':db[_0x4a37f2['model']],'as':_0x4a37f2['as'],'attributes':_0x4a37f2[_0xcb74('0x22')],'include':_0x4a37f2[_0xcb74('0x23')]?_[_0xcb74('0x24')](_0x4a37f2[_0xcb74('0x23')],function(_0x47ed09){return{'model':db[_0x47ed09[_0xcb74('0x25')]],'as':_0x47ed09['as'],'attributes':_0x47ed09[_0xcb74('0x22')],'include':_0x47ed09[_0xcb74('0x23')]?_[_0xcb74('0x24')](_0x47ed09[_0xcb74('0x23')],function(_0x4cfb86){return{'model':db[_0x4cfb86[_0xcb74('0x25')]],'as':_0x4cfb86['as'],'attributes':_0x4cfb86[_0xcb74('0x22')]};}):[]};}):[]};}):[]:[]})[_0xcb74('0x13')](function(_0xf9c42f){logger['info'](_0xcb74('0x26'),_0x132a6e);logger[_0xcb74('0x16')](_0xcb74('0x26'),_0x132a6e,JSON[_0xcb74('0x19')](_0xf9c42f));_0xab35d1(_0xf9c42f);})['catch'](function(_0x2ef8d6){logger[_0xcb74('0x1a')]('GetSmsQueue',_0x2ef8d6[_0xcb74('0x1b')],_0x132a6e);_0x158fe1(_0x299a6e[_0xcb74('0x1a')](0x1f4,_0x2ef8d6[_0xcb74('0x1b')]));});});};exports[_0xcb74('0x27')]=function(_0x44cf55){var _0x1fc1ba=this;return new Promise(function(_0x1fe32e,_0x1fba73){return db[_0xcb74('0x28')]['find']({'raw':_0x44cf55[_0xcb74('0x1f')]?_0x44cf55[_0xcb74('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x44cf55[_0xcb74('0x1f')]?_0x44cf55[_0xcb74('0x1f')]['where']||null:null,'attributes':_0x44cf55[_0xcb74('0x1f')]?_0x44cf55[_0xcb74('0x1f')][_0xcb74('0x22')]||null:null,'include':_0x44cf55['options']?_0x44cf55[_0xcb74('0x1f')]['include']?_[_0xcb74('0x24')](_0x44cf55[_0xcb74('0x1f')][_0xcb74('0x23')],function(_0x37ca53){return{'model':db[_0x37ca53[_0xcb74('0x25')]],'as':_0x37ca53['as'],'attributes':_0x37ca53[_0xcb74('0x22')],'include':_0x37ca53[_0xcb74('0x23')]?_[_0xcb74('0x24')](_0x37ca53['include'],function(_0x4b2fb8){return{'model':db[_0x4b2fb8[_0xcb74('0x25')]],'as':_0x4b2fb8['as'],'attributes':_0x4b2fb8['attributes'],'include':_0x4b2fb8[_0xcb74('0x23')]?_[_0xcb74('0x24')](_0x4b2fb8[_0xcb74('0x23')],function(_0x5f555d){return{'model':db[_0x5f555d[_0xcb74('0x25')]],'as':_0x5f555d['as'],'attributes':_0x5f555d[_0xcb74('0x22')]};}):[]};}):[]};}):[]:[]})[_0xcb74('0x13')](function(_0x4e5b3a){logger[_0xcb74('0x14')](_0xcb74('0x27'),_0x44cf55);logger[_0xcb74('0x16')](_0xcb74('0x27'),_0x44cf55,JSON[_0xcb74('0x19')](_0x4e5b3a));_0x1fe32e(_0x4e5b3a);})['catch'](function(_0x1beb55){logger[_0xcb74('0x1a')](_0xcb74('0x27'),_0x1beb55[_0xcb74('0x1b')],_0x44cf55);_0x1fba73(_0x1fc1ba[_0xcb74('0x1a')](0x1f4,_0x1beb55[_0xcb74('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ed51019..d5c180d 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 _0xb5d4=['./smsQueue.events','save','remove','update','removeListener','length','smsQueue:'];(function(_0x43505f,_0x21a118){var _0x271c6b=function(_0x3bd654){while(--_0x3bd654){_0x43505f['push'](_0x43505f['shift']());}};_0x271c6b(++_0x21a118);}(_0xb5d4,0xd2));var _0x4b5d=function(_0x40392b,_0x2f310f){_0x40392b=_0x40392b-0x0;var _0x2dbb59=_0xb5d4[_0x40392b];return _0x2dbb59;};'use strict';var SmsQueueEvents=require(_0x4b5d('0x0'));var events=[_0x4b5d('0x1'),_0x4b5d('0x2'),_0x4b5d('0x3')];function createListener(_0x3a8615,_0x47735b){return function(_0x20d443){_0x47735b['emit'](_0x3a8615,_0x20d443);};}function removeListener(_0x1b4e7c,_0x52c975){return function(){SmsQueueEvents[_0x4b5d('0x4')](_0x1b4e7c,_0x52c975);};}exports['register']=function(_0x81d9b){for(var _0x1c7733=0x0,_0x30d96e=events[_0x4b5d('0x5')];_0x1c7733<_0x30d96e;_0x1c7733++){var _0x30ff78=events[_0x1c7733];var _0x12db34=createListener(_0x4b5d('0x6')+_0x30ff78,_0x81d9b);SmsQueueEvents['on'](_0x30ff78,_0x12db34);}}; \ No newline at end of file +var _0x77ba=['update','removeListener','register','smsQueue:','./smsQueue.events','remove'];(function(_0x20a8a2,_0x1f0093){var _0x160826=function(_0xc3d34c){while(--_0xc3d34c){_0x20a8a2['push'](_0x20a8a2['shift']());}};_0x160826(++_0x1f0093);}(_0x77ba,0x1ea));var _0xa77b=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0x77ba[_0x137d1d];return _0x485108;};'use strict';var SmsQueueEvents=require(_0xa77b('0x0'));var events=['save',_0xa77b('0x1'),_0xa77b('0x2')];function createListener(_0x42e43a,_0x329b4f){return function(_0x17a42d){_0x329b4f['emit'](_0x42e43a,_0x17a42d);};}function removeListener(_0x37bdea,_0x2e9d60){return function(){SmsQueueEvents[_0xa77b('0x3')](_0x37bdea,_0x2e9d60);};}exports[_0xa77b('0x4')]=function(_0x48c759){for(var _0x48a29c=0x0,_0x3e608d=events['length'];_0x48a29c<_0x3e608d;_0x48a29c++){var _0x19e2fa=events[_0x48a29c];var _0x216182=createListener(_0xa77b('0x5')+_0x19e2fa,_0x48c759);SmsQueueEvents['on'](_0x19e2fa,_0x216182);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 51166a5..c35ebf3 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 _0x053b=['show','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','index','get','/describe','isAuthenticated'];(function(_0x3be43b,_0x3c10b3){var _0x2dc567=function(_0x2c33e8){while(--_0x2c33e8){_0x3be43b['push'](_0x3be43b['shift']());}};_0x2dc567(++_0x3c10b3);}(_0x053b,0x120));var _0xb053=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x053b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xb053('0x0'));var path=require(_0xb053('0x1'));var timeout=require(_0xb053('0x2'));var express=require(_0xb053('0x3'));var router=express['Router']();var fs_extra=require(_0xb053('0x4'));var auth=require(_0xb053('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb053('0x6'));var controller=require(_0xb053('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb053('0x8')]);router[_0xb053('0x9')](_0xb053('0xa'),auth[_0xb053('0xb')](),controller['describe']);router[_0xb053('0x9')]('/:id',auth[_0xb053('0xb')](),controller[_0xb053('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb053('0xd')]);router[_0xb053('0xe')](_0xb053('0xf'),auth[_0xb053('0xb')](),controller[_0xb053('0x10')]);router[_0xb053('0x11')](_0xb053('0xf'),auth[_0xb053('0xb')](),controller[_0xb053('0x12')]);module[_0xb053('0x13')]=router; \ No newline at end of file +var _0xdd0c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','util','path','connect-timeout','Router'];(function(_0x7a4a03,_0x91417c){var _0xfe0c7a=function(_0x2bbf81){while(--_0x2bbf81){_0x7a4a03['push'](_0x7a4a03['shift']());}};_0xfe0c7a(++_0x91417c);}(_0xdd0c,0x165));var _0xcdd0=function(_0xffdbac,_0x1bc1a5){_0xffdbac=_0xffdbac-0x0;var _0x10f9dd=_0xdd0c[_0xffdbac];return _0x10f9dd;};'use strict';var multer=require('multer');var util=require(_0xcdd0('0x0'));var path=require(_0xcdd0('0x1'));var timeout=require(_0xcdd0('0x2'));var express=require('express');var router=express[_0xcdd0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcdd0('0x4'));var interaction=require(_0xcdd0('0x5'));var config=require(_0xcdd0('0x6'));var controller=require(_0xcdd0('0x7'));router[_0xcdd0('0x8')]('/',auth['isAuthenticated'](),controller[_0xcdd0('0x9')]);router[_0xcdd0('0x8')](_0xcdd0('0xa'),auth[_0xcdd0('0xb')](),controller[_0xcdd0('0xc')]);router['get'](_0xcdd0('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xcdd0('0xe')]('/',auth[_0xcdd0('0xb')](),controller[_0xcdd0('0xf')]);router[_0xcdd0('0x10')](_0xcdd0('0xd'),auth[_0xcdd0('0xb')](),controller[_0xcdd0('0x11')]);router[_0xcdd0('0x12')](_0xcdd0('0xd'),auth[_0xcdd0('0xb')](),controller['destroy']);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 d8ececc..5bd45d8 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 _0xd729=['sequelize','exports','STRING','DATE','moment'];(function(_0x1e6db1,_0xb90700){var _0x55e924=function(_0x353c27){while(--_0x353c27){_0x1e6db1['push'](_0x1e6db1['shift']());}};_0x55e924(++_0xb90700);}(_0xd729,0x1bc));var _0x9d72=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xd729[_0x4b2436];return _0x4f5ab2;};'use strict';var moment=require(_0x9d72('0x0'));var Sequelize=require(_0x9d72('0x1'));module[_0x9d72('0x2')]={'uniqueid':{'type':Sequelize[_0x9d72('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9d72('0x3')]},'joinAt':{'type':Sequelize[_0x9d72('0x4')]},'leaveAt':{'type':Sequelize[_0x9d72('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9d72('0x4')]},'reason':{'type':Sequelize[_0x9d72('0x3')]}}; \ No newline at end of file +var _0x3770=['moment','sequelize','exports','DATE'];(function(_0x5ba23f,_0x3ce99e){var _0x392def=function(_0x174b74){while(--_0x174b74){_0x5ba23f['push'](_0x5ba23f['shift']());}};_0x392def(++_0x3ce99e);}(_0x3770,0x13c));var _0x0377=function(_0x365590,_0x22e645){_0x365590=_0x365590-0x0;var _0x5ce0f3=_0x3770[_0x365590];return _0x5ce0f3;};'use strict';var moment=require(_0x0377('0x0'));var Sequelize=require(_0x0377('0x1'));module[_0x0377('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0377('0x3')]},'leaveAt':{'type':Sequelize[_0x0377('0x3')]},'acceptAt':{'type':Sequelize[_0x0377('0x3')]},'exitAt':{'type':Sequelize[_0x0377('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 6193b08..f02fd84 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 _0x7392=['limit','count','set','Content-Range','reject','save','update','then','destroy','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x409251,_0x40f525){var _0x216f47=function(_0x517895){while(--_0x517895){_0x409251['push'](_0x409251['shift']());}};_0x216f47(++_0x40f525);}(_0x7392,0x1e8));var _0x2739=function(_0x1bded3,_0x15cd8c){_0x1bded3=_0x1bded3-0x0;var _0x337564=_0x7392[_0x1bded3];return _0x337564;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2739('0x0'));var zipdir=require(_0x2739('0x1'));var jsonpatch=require(_0x2739('0x2'));var rp=require(_0x2739('0x3'));var moment=require(_0x2739('0x4'));var BPromise=require(_0x2739('0x5'));var Mustache=require(_0x2739('0x6'));var util=require(_0x2739('0x7'));var path=require(_0x2739('0x8'));var sox=require(_0x2739('0x9'));var csv=require(_0x2739('0xa'));var ejs=require(_0x2739('0xb'));var fs=require('fs');var fs_extra=require(_0x2739('0xc'));var _=require(_0x2739('0xd'));var squel=require('squel');var crypto=require(_0x2739('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2739('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2739('0x10'));var Redis=require(_0x2739('0x11'));var authService=require(_0x2739('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2739('0x13'));var logger=require('../../config/logger')(_0x2739('0x14'));var utils=require('../../config/utils');var config=require(_0x2739('0x15'));var licenseUtil=require(_0x2739('0x16'));var db=require(_0x2739('0x17'))['db'];function respondWithStatusCode(_0x5a11a6,_0x139a89){_0x139a89=_0x139a89||0xcc;return function(_0x34e8b9){if(_0x34e8b9){return _0x5a11a6[_0x2739('0x18')](_0x139a89);}return _0x5a11a6[_0x2739('0x19')](_0x139a89)[_0x2739('0x1a')]();};}function respondWithResult(_0x4791f0,_0x1e14fb){_0x1e14fb=_0x1e14fb||0xc8;return function(_0x206505){if(_0x206505){return _0x4791f0[_0x2739('0x19')](_0x1e14fb)[_0x2739('0x1b')](_0x206505);}};}function respondWithFilteredResult(_0x59935d,_0x489633){return function(_0x39b675){if(_0x39b675){var _0x3abc1e=typeof _0x489633[_0x2739('0x1c')]===_0x2739('0x1d')&&typeof _0x489633[_0x2739('0x1e')]===_0x2739('0x1d');var _0x2b68f0=_0x39b675[_0x2739('0x1f')];var _0x2b8d12=_0x3abc1e?0x0:_0x489633[_0x2739('0x1c')];var _0x67873c=_0x3abc1e?_0x39b675[_0x2739('0x1f')]:_0x489633[_0x2739('0x1c')]+_0x489633[_0x2739('0x1e')];var _0x1d12cf;if(_0x67873c>=_0x2b68f0){_0x67873c=_0x2b68f0;_0x1d12cf=0xc8;}else{_0x1d12cf=0xce;}_0x59935d[_0x2739('0x19')](_0x1d12cf);return _0x59935d[_0x2739('0x20')](_0x2739('0x21'),_0x2b8d12+'-'+_0x67873c+'/'+_0x2b68f0)['json'](_0x39b675);}return null;};}function patchUpdates(_0x5a1d82){return function(_0x44476e){try{jsonpatch['apply'](_0x44476e,_0x5a1d82,!![]);}catch(_0x55a5ea){return BPromise[_0x2739('0x22')](_0x55a5ea);}return _0x44476e[_0x2739('0x23')]();};}function saveUpdates(_0x5a023c,_0x5ef27d){return function(_0x3cb3ba){if(_0x3cb3ba){return _0x3cb3ba[_0x2739('0x24')](_0x5a023c)[_0x2739('0x25')](function(_0x180ed9){return _0x180ed9;});}return null;};}function removeEntity(_0x2c129f,_0x1632f7){return function(_0x391704){if(_0x391704){return _0x391704[_0x2739('0x26')]()[_0x2739('0x25')](function(){_0x2c129f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed9400,_0x539841){return function(_0x203924){if(!_0x203924){_0xed9400['sendStatus'](0x194);}return _0x203924;};}function handleError(_0x4b0f74,_0x180782){_0x180782=_0x180782||0x1f4;return function(_0x2f58bc){logger['error'](_0x2f58bc['stack']);if(_0x2f58bc['name']){delete _0x2f58bc['name'];}_0x4b0f74[_0x2739('0x19')](_0x180782)[_0x2739('0x27')](_0x2f58bc);};}exports[_0x2739('0x28')]=function(_0x505e7e,_0x1ce7b0){var _0x44bc9d={},_0x566203={},_0x781337={'count':0x0,'rows':[]};var _0x412b3b=_[_0x2739('0x29')](db[_0x2739('0x2a')][_0x2739('0x2b')],function(_0x3a78e0){return{'name':_0x3a78e0[_0x2739('0x2c')],'type':_0x3a78e0['type'][_0x2739('0x2d')]};});_0x566203[_0x2739('0x2e')]=_[_0x2739('0x29')](_0x412b3b,_0x2739('0x2f'));_0x566203[_0x2739('0x30')]=_[_0x2739('0x31')](_0x505e7e['query']);_0x566203['filters']=_['intersection'](_0x566203[_0x2739('0x2e')],_0x566203[_0x2739('0x30')]);_0x44bc9d[_0x2739('0x32')]=_[_0x2739('0x33')](_0x566203[_0x2739('0x2e')],qs[_0x2739('0x34')](_0x505e7e['query'][_0x2739('0x34')]));_0x44bc9d[_0x2739('0x32')]=_0x44bc9d[_0x2739('0x32')][_0x2739('0x35')]?_0x44bc9d['attributes']:_0x566203[_0x2739('0x2e')];if(!_0x505e7e[_0x2739('0x30')][_0x2739('0x36')]('nolimit')){_0x44bc9d['limit']=qs[_0x2739('0x1e')](_0x505e7e[_0x2739('0x30')][_0x2739('0x1e')]);_0x44bc9d[_0x2739('0x1c')]=qs['offset'](_0x505e7e[_0x2739('0x30')]['offset']);}_0x44bc9d[_0x2739('0x37')]=qs[_0x2739('0x38')](_0x505e7e[_0x2739('0x30')][_0x2739('0x38')]);_0x44bc9d['where']=qs[_0x2739('0x39')](_['pick'](_0x505e7e[_0x2739('0x30')],_0x566203[_0x2739('0x39')]),_0x412b3b);if(_0x505e7e[_0x2739('0x30')][_0x2739('0x3a')]){_0x44bc9d[_0x2739('0x3b')]=_[_0x2739('0x3c')](_0x44bc9d['where'],{'$or':_[_0x2739('0x29')](_0x412b3b,function(_0x21561c){if(_0x21561c[_0x2739('0x3d')]!==_0x2739('0x3e')){var _0x1d033a={};_0x1d033a[_0x21561c[_0x2739('0x2f')]]={'$like':'%'+_0x505e7e[_0x2739('0x30')][_0x2739('0x3a')]+'%'};return _0x1d033a;}})});}_0x44bc9d=_[_0x2739('0x3c')]({},_0x44bc9d,_0x505e7e[_0x2739('0x3f')]);var _0x4dc044={'where':_0x44bc9d[_0x2739('0x3b')]};return db[_0x2739('0x2a')][_0x2739('0x1f')](_0x4dc044)[_0x2739('0x25')](function(_0x260dd2){_0x781337[_0x2739('0x1f')]=_0x260dd2;if(_0x505e7e[_0x2739('0x30')][_0x2739('0x40')]){_0x44bc9d[_0x2739('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x2739('0x42')](_0x44bc9d);})['then'](function(_0x29cc1f){_0x781337[_0x2739('0x43')]=_0x29cc1f;return _0x781337;})[_0x2739('0x25')](respondWithFilteredResult(_0x1ce7b0,_0x44bc9d))[_0x2739('0x44')](handleError(_0x1ce7b0,null));};exports[_0x2739('0x45')]=function(_0x2cc8d5,_0x413af4){var _0x10d751={'raw':!![],'where':{'id':_0x2cc8d5[_0x2739('0x46')]['id']}},_0x52f46a={};_0x52f46a[_0x2739('0x2e')]=_[_0x2739('0x31')](db['SmsQueueReport'][_0x2739('0x2b')]);_0x52f46a[_0x2739('0x30')]=_[_0x2739('0x31')](_0x2cc8d5['query']);_0x52f46a[_0x2739('0x39')]=_[_0x2739('0x33')](_0x52f46a['model'],_0x52f46a[_0x2739('0x30')]);_0x10d751[_0x2739('0x32')]=_[_0x2739('0x33')](_0x52f46a['model'],qs['fields'](_0x2cc8d5[_0x2739('0x30')][_0x2739('0x34')]));_0x10d751[_0x2739('0x32')]=_0x10d751[_0x2739('0x32')][_0x2739('0x35')]?_0x10d751[_0x2739('0x32')]:_0x52f46a[_0x2739('0x2e')];if(_0x2cc8d5['query'][_0x2739('0x40')]){_0x10d751[_0x2739('0x41')]=[{'all':!![]}];}_0x10d751=_[_0x2739('0x3c')]({},_0x10d751,_0x2cc8d5[_0x2739('0x3f')]);return db[_0x2739('0x2a')][_0x2739('0x47')](_0x10d751)[_0x2739('0x25')](handleEntityNotFound(_0x413af4,null))[_0x2739('0x25')](respondWithResult(_0x413af4,null))['catch'](handleError(_0x413af4,null));};exports['create']=function(_0x34a39f,_0x1aec37){return db[_0x2739('0x2a')]['create'](_0x34a39f[_0x2739('0x48')],{})[_0x2739('0x25')](respondWithResult(_0x1aec37,0xc9))[_0x2739('0x44')](handleError(_0x1aec37,null));};exports[_0x2739('0x24')]=function(_0x3e34ce,_0x2a5e13){if(_0x3e34ce[_0x2739('0x48')]['id']){delete _0x3e34ce[_0x2739('0x48')]['id'];}return db[_0x2739('0x2a')][_0x2739('0x47')]({'where':{'id':_0x3e34ce[_0x2739('0x46')]['id']}})[_0x2739('0x25')](handleEntityNotFound(_0x2a5e13,null))[_0x2739('0x25')](saveUpdates(_0x3e34ce[_0x2739('0x48')],null))[_0x2739('0x25')](respondWithResult(_0x2a5e13,null))['catch'](handleError(_0x2a5e13,null));};exports['destroy']=function(_0x1bf6c8,_0xa12a23){return db[_0x2739('0x2a')][_0x2739('0x47')]({'where':{'id':_0x1bf6c8[_0x2739('0x46')]['id']}})[_0x2739('0x25')](handleEntityNotFound(_0xa12a23,null))['then'](removeEntity(_0xa12a23,null))[_0x2739('0x44')](handleError(_0xa12a23,null));};exports['describe']=function(_0x302793,_0x11d20d){return db['SmsQueueReport'][_0x2739('0x49')]()[_0x2739('0x25')](respondWithResult(_0x11d20d,null))[_0x2739('0x44')](handleError(_0x11d20d,null));}; \ No newline at end of file +var _0x3914=['fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','where','filter','type','VIRTUAL','includeAll','include','show','params','intersection','merge','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','destroy','then','end','error','stack','name','send','map','SmsQueueReport','rawAttributes'];(function(_0x26ddd9,_0x128536){var _0x2dafd9=function(_0x382f0b){while(--_0x382f0b){_0x26ddd9['push'](_0x26ddd9['shift']());}};_0x2dafd9(++_0x128536);}(_0x3914,0x1d7));var _0x4391=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0x3914[_0x3f6c29];return _0x4af959;};'use strict';var emlformat=require(_0x4391('0x0'));var rimraf=require(_0x4391('0x1'));var zipdir=require(_0x4391('0x2'));var jsonpatch=require(_0x4391('0x3'));var rp=require(_0x4391('0x4'));var moment=require(_0x4391('0x5'));var BPromise=require(_0x4391('0x6'));var Mustache=require(_0x4391('0x7'));var util=require(_0x4391('0x8'));var path=require(_0x4391('0x9'));var sox=require('sox');var csv=require(_0x4391('0xa'));var ejs=require(_0x4391('0xb'));var fs=require('fs');var fs_extra=require(_0x4391('0xc'));var _=require(_0x4391('0xd'));var squel=require(_0x4391('0xe'));var crypto=require('crypto');var jsforce=require(_0x4391('0xf'));var deskjs=require(_0x4391('0x10'));var toCsv=require(_0x4391('0xa'));var querystring=require('querystring');var Papa=require(_0x4391('0x11'));var Redis=require('ioredis');var authService=require(_0x4391('0x12'));var qs=require(_0x4391('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4391('0x14'))(_0x4391('0x15'));var utils=require('../../config/utils');var config=require(_0x4391('0x16'));var licenseUtil=require(_0x4391('0x17'));var db=require(_0x4391('0x18'))['db'];function respondWithStatusCode(_0x2ef564,_0x398f7b){_0x398f7b=_0x398f7b||0xcc;return function(_0xd2cc9d){if(_0xd2cc9d){return _0x2ef564[_0x4391('0x19')](_0x398f7b);}return _0x2ef564[_0x4391('0x1a')](_0x398f7b)['end']();};}function respondWithResult(_0x384a32,_0x3eb9ae){_0x3eb9ae=_0x3eb9ae||0xc8;return function(_0xe9924a){if(_0xe9924a){return _0x384a32[_0x4391('0x1a')](_0x3eb9ae)['json'](_0xe9924a);}};}function respondWithFilteredResult(_0x5545c0,_0x40972d){return function(_0x3cd75c){if(_0x3cd75c){var _0x3b7c7e=typeof _0x40972d['offset']===_0x4391('0x1b')&&typeof _0x40972d[_0x4391('0x1c')]==='undefined';var _0x1bc89d=_0x3cd75c[_0x4391('0x1d')];var _0x51f5d8=_0x3b7c7e?0x0:_0x40972d[_0x4391('0x1e')];var _0x426c4c=_0x3b7c7e?_0x3cd75c[_0x4391('0x1d')]:_0x40972d['offset']+_0x40972d[_0x4391('0x1c')];var _0x39f057;if(_0x426c4c>=_0x1bc89d){_0x426c4c=_0x1bc89d;_0x39f057=0xc8;}else{_0x39f057=0xce;}_0x5545c0[_0x4391('0x1a')](_0x39f057);return _0x5545c0[_0x4391('0x1f')](_0x4391('0x20'),_0x51f5d8+'-'+_0x426c4c+'/'+_0x1bc89d)[_0x4391('0x21')](_0x3cd75c);}return null;};}function patchUpdates(_0x514635){return function(_0x4e01a3){try{jsonpatch[_0x4391('0x22')](_0x4e01a3,_0x514635,!![]);}catch(_0x43c0f7){return BPromise[_0x4391('0x23')](_0x43c0f7);}return _0x4e01a3['save']();};}function saveUpdates(_0x2aed64,_0x13c43d){return function(_0xc190ba){if(_0xc190ba){return _0xc190ba[_0x4391('0x24')](_0x2aed64)['then'](function(_0x4be850){return _0x4be850;});}return null;};}function removeEntity(_0x45b7cb,_0x462a13){return function(_0x4ff3ff){if(_0x4ff3ff){return _0x4ff3ff[_0x4391('0x25')]()[_0x4391('0x26')](function(){_0x45b7cb[_0x4391('0x1a')](0xcc)[_0x4391('0x27')]();});}};}function handleEntityNotFound(_0xd36d2d,_0x3d1c6b){return function(_0x20a72f){if(!_0x20a72f){_0xd36d2d[_0x4391('0x19')](0x194);}return _0x20a72f;};}function handleError(_0x662bde,_0x1283e4){_0x1283e4=_0x1283e4||0x1f4;return function(_0x3020a7){logger[_0x4391('0x28')](_0x3020a7[_0x4391('0x29')]);if(_0x3020a7[_0x4391('0x2a')]){delete _0x3020a7[_0x4391('0x2a')];}_0x662bde[_0x4391('0x1a')](_0x1283e4)[_0x4391('0x2b')](_0x3020a7);};}exports['index']=function(_0x378d9e,_0x5a039f){var _0x4cd76a={},_0x4cc685={},_0x273f5f={'count':0x0,'rows':[]};var _0x3cce85=_[_0x4391('0x2c')](db[_0x4391('0x2d')][_0x4391('0x2e')],function(_0x6ab554){return{'name':_0x6ab554[_0x4391('0x2f')],'type':_0x6ab554['type'][_0x4391('0x30')]};});_0x4cc685[_0x4391('0x31')]=_['map'](_0x3cce85,_0x4391('0x2a'));_0x4cc685[_0x4391('0x32')]=_[_0x4391('0x33')](_0x378d9e['query']);_0x4cc685[_0x4391('0x34')]=_['intersection'](_0x4cc685[_0x4391('0x31')],_0x4cc685[_0x4391('0x32')]);_0x4cd76a[_0x4391('0x35')]=_['intersection'](_0x4cc685[_0x4391('0x31')],qs[_0x4391('0x36')](_0x378d9e['query']['fields']));_0x4cd76a['attributes']=_0x4cd76a[_0x4391('0x35')][_0x4391('0x37')]?_0x4cd76a[_0x4391('0x35')]:_0x4cc685['model'];if(!_0x378d9e[_0x4391('0x32')][_0x4391('0x38')](_0x4391('0x39'))){_0x4cd76a[_0x4391('0x1c')]=qs[_0x4391('0x1c')](_0x378d9e[_0x4391('0x32')]['limit']);_0x4cd76a[_0x4391('0x1e')]=qs[_0x4391('0x1e')](_0x378d9e[_0x4391('0x32')][_0x4391('0x1e')]);}_0x4cd76a['order']=qs['sort'](_0x378d9e['query']['sort']);_0x4cd76a[_0x4391('0x3a')]=qs[_0x4391('0x34')](_['pick'](_0x378d9e[_0x4391('0x32')],_0x4cc685[_0x4391('0x34')]),_0x3cce85);if(_0x378d9e[_0x4391('0x32')][_0x4391('0x3b')]){_0x4cd76a['where']=_['merge'](_0x4cd76a[_0x4391('0x3a')],{'$or':_[_0x4391('0x2c')](_0x3cce85,function(_0x1fd718){if(_0x1fd718[_0x4391('0x3c')]!==_0x4391('0x3d')){var _0x15c7c4={};_0x15c7c4[_0x1fd718[_0x4391('0x2a')]]={'$like':'%'+_0x378d9e[_0x4391('0x32')][_0x4391('0x3b')]+'%'};return _0x15c7c4;}})});}_0x4cd76a=_['merge']({},_0x4cd76a,_0x378d9e['options']);var _0x5e5b81={'where':_0x4cd76a[_0x4391('0x3a')]};return db[_0x4391('0x2d')][_0x4391('0x1d')](_0x5e5b81)[_0x4391('0x26')](function(_0x162e9d){_0x273f5f[_0x4391('0x1d')]=_0x162e9d;if(_0x378d9e[_0x4391('0x32')][_0x4391('0x3e')]){_0x4cd76a[_0x4391('0x3f')]=[{'all':!![]}];}return db[_0x4391('0x2d')]['findAll'](_0x4cd76a);})[_0x4391('0x26')](function(_0x586eab){_0x273f5f['rows']=_0x586eab;return _0x273f5f;})[_0x4391('0x26')](respondWithFilteredResult(_0x5a039f,_0x4cd76a))['catch'](handleError(_0x5a039f,null));};exports[_0x4391('0x40')]=function(_0x494b0a,_0x5aa1eb){var _0x146246={'raw':!![],'where':{'id':_0x494b0a[_0x4391('0x41')]['id']}},_0x2e8b52={};_0x2e8b52[_0x4391('0x31')]=_[_0x4391('0x33')](db[_0x4391('0x2d')][_0x4391('0x2e')]);_0x2e8b52[_0x4391('0x32')]=_[_0x4391('0x33')](_0x494b0a['query']);_0x2e8b52[_0x4391('0x34')]=_[_0x4391('0x42')](_0x2e8b52[_0x4391('0x31')],_0x2e8b52[_0x4391('0x32')]);_0x146246[_0x4391('0x35')]=_[_0x4391('0x42')](_0x2e8b52[_0x4391('0x31')],qs['fields'](_0x494b0a[_0x4391('0x32')][_0x4391('0x36')]));_0x146246[_0x4391('0x35')]=_0x146246[_0x4391('0x35')][_0x4391('0x37')]?_0x146246[_0x4391('0x35')]:_0x2e8b52['model'];if(_0x494b0a[_0x4391('0x32')][_0x4391('0x3e')]){_0x146246['include']=[{'all':!![]}];}_0x146246=_[_0x4391('0x43')]({},_0x146246,_0x494b0a[_0x4391('0x44')]);return db['SmsQueueReport'][_0x4391('0x45')](_0x146246)[_0x4391('0x26')](handleEntityNotFound(_0x5aa1eb,null))[_0x4391('0x26')](respondWithResult(_0x5aa1eb,null))[_0x4391('0x46')](handleError(_0x5aa1eb,null));};exports[_0x4391('0x47')]=function(_0x4ffee1,_0x526706){return db['SmsQueueReport'][_0x4391('0x47')](_0x4ffee1['body'],{})[_0x4391('0x26')](respondWithResult(_0x526706,0xc9))[_0x4391('0x46')](handleError(_0x526706,null));};exports[_0x4391('0x24')]=function(_0xe6ab27,_0x5d7baf){if(_0xe6ab27[_0x4391('0x48')]['id']){delete _0xe6ab27[_0x4391('0x48')]['id'];}return db[_0x4391('0x2d')][_0x4391('0x45')]({'where':{'id':_0xe6ab27[_0x4391('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d7baf,null))['then'](saveUpdates(_0xe6ab27['body'],null))['then'](respondWithResult(_0x5d7baf,null))[_0x4391('0x46')](handleError(_0x5d7baf,null));};exports[_0x4391('0x25')]=function(_0x44e106,_0x346361){return db[_0x4391('0x2d')][_0x4391('0x45')]({'where':{'id':_0x44e106['params']['id']}})[_0x4391('0x26')](handleEntityNotFound(_0x346361,null))[_0x4391('0x26')](removeEntity(_0x346361,null))[_0x4391('0x46')](handleError(_0x346361,null));};exports[_0x4391('0x49')]=function(_0x3b71e0,_0x15ab73){return db[_0x4391('0x2d')][_0x4391('0x49')]()[_0x4391('0x26')](respondWithResult(_0x15ab73,null))[_0x4391('0x46')](handleError(_0x15ab73,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 4bb1174..545571e 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x4ea018,_0x292020){var _0x3eef98=function(_0x16d996){while(--_0x16d996){_0x4ea018['push'](_0x4ea018['shift']());}};_0x3eef98(++_0x292020);}(_0x70e0,0x17b));var _0x070e=function(_0x42c180,_0x2a47b7){_0x42c180=_0x42c180-0x0;var _0x128a7b=_0x70e0[_0x42c180];return _0x128a7b;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 96d36c4..2107b31 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 _0xa643=['request\x20sent','debug','stringify','error','code','message','info','SmsQueueReport','create','body','options','raw','then','CreateSmsQueueReport','catch','UpdateSmsQueueReport','update','where','attributes','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','SmsQueueReport,\x20%s,\x20%s'];(function(_0x2c0beb,_0x5d4ee1){var _0x279fee=function(_0x158e58){while(--_0x158e58){_0x2c0beb['push'](_0x2c0beb['shift']());}};_0x279fee(++_0x5d4ee1);}(_0xa643,0x12b));var _0x3a64=function(_0x3f0e5a,_0x52391a){_0x3f0e5a=_0x3f0e5a-0x0;var _0x1cbecb=_0xa643[_0x3f0e5a];return _0x1cbecb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x3a64('0x0'));var rs=require(_0x3a64('0x1'));var fs=require('fs');var Redis=require(_0x3a64('0x2'));var db=require(_0x3a64('0x3'))['db'];var utils=require(_0x3a64('0x4'));var logger=require(_0x3a64('0x5'))('rpc');var config=require(_0x3a64('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3a64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x355a30,_0x24b126,_0xabc231){return new BPromise(function(_0xcf22,_0x2672e3){return client['request'](_0x355a30,_0xabc231)['then'](function(_0x1aabe2){logger['info'](_0x3a64('0x8'),_0x24b126,_0x3a64('0x9'));logger[_0x3a64('0xa')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x24b126,_0x3a64('0x9'),JSON[_0x3a64('0xb')](_0x1aabe2));if(_0x1aabe2[_0x3a64('0xc')]){if(_0x1aabe2[_0x3a64('0xc')][_0x3a64('0xd')]===0x1f4){logger[_0x3a64('0xc')](_0x3a64('0x8'),_0x24b126,_0x1aabe2[_0x3a64('0xc')]['message']);return _0x2672e3(_0x1aabe2[_0x3a64('0xc')]['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x24b126,_0x1aabe2[_0x3a64('0xc')]['message']);return _0xcf22(_0x1aabe2[_0x3a64('0xc')][_0x3a64('0xe')]);}else{logger[_0x3a64('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x24b126,_0x3a64('0x9'));_0xcf22(_0x1aabe2['result'][_0x3a64('0xe')]);}})['catch'](function(_0x1e8c76){logger[_0x3a64('0xc')](_0x3a64('0x8'),_0x24b126,_0x1e8c76);_0x2672e3(_0x1e8c76);});});}exports['CreateSmsQueueReport']=function(_0x18e3c7){var _0x59da32=this;return new Promise(function(_0x511d26,_0x39ff22){return db[_0x3a64('0x10')][_0x3a64('0x11')](_0x18e3c7[_0x3a64('0x12')],{'raw':_0x18e3c7[_0x3a64('0x13')]?_0x18e3c7[_0x3a64('0x13')][_0x3a64('0x14')]===undefined?!![]:![]:!![]})[_0x3a64('0x15')](function(_0x1ed50f){logger['info']('CreateSmsQueueReport',_0x18e3c7);logger[_0x3a64('0xa')](_0x3a64('0x16'),_0x18e3c7,JSON['stringify'](_0x1ed50f));_0x511d26(_0x1ed50f);})[_0x3a64('0x17')](function(_0x2fa151){logger[_0x3a64('0xc')](_0x3a64('0x16'),_0x2fa151[_0x3a64('0xe')],_0x18e3c7);_0x39ff22(_0x59da32[_0x3a64('0xc')](0x1f4,_0x2fa151[_0x3a64('0xe')]));});});};exports[_0x3a64('0x18')]=function(_0x23438c){var _0x820356=this;return new Promise(function(_0x103a06,_0x25269e){return db['SmsQueueReport'][_0x3a64('0x19')](_0x23438c[_0x3a64('0x12')],{'raw':_0x23438c[_0x3a64('0x13')]?_0x23438c[_0x3a64('0x13')][_0x3a64('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23438c[_0x3a64('0x13')]?_0x23438c[_0x3a64('0x13')][_0x3a64('0x1a')]||null:null,'attributes':_0x23438c['options']?_0x23438c[_0x3a64('0x13')][_0x3a64('0x1b')]||null:null,'limit':_0x23438c['options']?_0x23438c[_0x3a64('0x13')]['limit']||null:null})['then'](function(_0x568652){logger[_0x3a64('0xf')](_0x3a64('0x18'),_0x23438c);logger[_0x3a64('0xa')](_0x3a64('0x18'),_0x23438c,JSON[_0x3a64('0xb')](_0x568652));_0x103a06(_0x568652);})[_0x3a64('0x17')](function(_0x418865){logger[_0x3a64('0xc')](_0x3a64('0x18'),_0x418865[_0x3a64('0xe')],_0x23438c);_0x25269e(_0x820356[_0x3a64('0xc')](0x1f4,_0x418865['message']));});});}; \ No newline at end of file +var _0xd581=['http','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','options','debug','UpdateSmsQueueReport','body','raw','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x37115c,_0x57791a){var _0x2e2501=function(_0x30eca8){while(--_0x30eca8){_0x37115c['push'](_0x37115c['shift']());}};_0x2e2501(++_0x57791a);}(_0xd581,0x10c));var _0x1d58=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xd581[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x1d58('0x0'));var util=require(_0x1d58('0x1'));var moment=require(_0x1d58('0x2'));var BPromise=require(_0x1d58('0x3'));var rs=require(_0x1d58('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d58('0x5'))['db'];var utils=require(_0x1d58('0x6'));var logger=require('../../config/logger')(_0x1d58('0x7'));var config=require(_0x1d58('0x8'));var jayson=require(_0x1d58('0x9'));var client=jayson[_0x1d58('0xa')][_0x1d58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1194d6,_0x1db637,_0x3e51ef){return new BPromise(function(_0x334b75,_0x47506c){return client['request'](_0x1194d6,_0x3e51ef)[_0x1d58('0xc')](function(_0x5c539b){logger['info'](_0x1d58('0xd'),_0x1db637,_0x1d58('0xe'));logger['debug'](_0x1d58('0xf'),_0x1db637,'request\x20sent',JSON[_0x1d58('0x10')](_0x5c539b));if(_0x5c539b[_0x1d58('0x11')]){if(_0x5c539b[_0x1d58('0x11')][_0x1d58('0x12')]===0x1f4){logger[_0x1d58('0x11')](_0x1d58('0xd'),_0x1db637,_0x5c539b['error'][_0x1d58('0x13')]);return _0x47506c(_0x5c539b['error'][_0x1d58('0x13')]);}logger[_0x1d58('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x1db637,_0x5c539b['error'][_0x1d58('0x13')]);return _0x334b75(_0x5c539b['error'][_0x1d58('0x13')]);}else{logger[_0x1d58('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x1db637,_0x1d58('0xe'));_0x334b75(_0x5c539b[_0x1d58('0x15')][_0x1d58('0x13')]);}})[_0x1d58('0x16')](function(_0x1fe1dc){logger['error'](_0x1d58('0xd'),_0x1db637,_0x1fe1dc);_0x47506c(_0x1fe1dc);});});}exports[_0x1d58('0x17')]=function(_0x29a865){var _0x820fe=this;return new Promise(function(_0x1e145c,_0xe0c5eb){return db[_0x1d58('0x18')]['create'](_0x29a865['body'],{'raw':_0x29a865[_0x1d58('0x19')]?_0x29a865[_0x1d58('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x1d58('0xc')](function(_0x1862b3){logger['info'](_0x1d58('0x17'),_0x29a865);logger[_0x1d58('0x1a')](_0x1d58('0x17'),_0x29a865,JSON[_0x1d58('0x10')](_0x1862b3));_0x1e145c(_0x1862b3);})[_0x1d58('0x16')](function(_0x36b62a){logger['error'](_0x1d58('0x17'),_0x36b62a['message'],_0x29a865);_0xe0c5eb(_0x820fe[_0x1d58('0x11')](0x1f4,_0x36b62a[_0x1d58('0x13')]));});});};exports[_0x1d58('0x1b')]=function(_0x4bd961){var _0x42fd8d=this;return new Promise(function(_0x20209c,_0x2ab6ad){return db[_0x1d58('0x18')]['update'](_0x4bd961[_0x1d58('0x1c')],{'raw':_0x4bd961[_0x1d58('0x19')]?_0x4bd961['options'][_0x1d58('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bd961[_0x1d58('0x19')]?_0x4bd961[_0x1d58('0x19')]['where']||null:null,'attributes':_0x4bd961[_0x1d58('0x19')]?_0x4bd961['options'][_0x1d58('0x1e')]||null:null,'limit':_0x4bd961['options']?_0x4bd961['options']['limit']||null:null})[_0x1d58('0xc')](function(_0x24eb3f){logger['info'](_0x1d58('0x1b'),_0x4bd961);logger[_0x1d58('0x1a')](_0x1d58('0x1b'),_0x4bd961,JSON[_0x1d58('0x10')](_0x24eb3f));_0x20209c(_0x24eb3f);})[_0x1d58('0x16')](function(_0x49425b){logger[_0x1d58('0x11')](_0x1d58('0x1b'),_0x49425b[_0x1d58('0x13')],_0x4bd961);_0x2ab6ad(_0x42fd8d[_0x1d58('0x11')](0x1f4,_0x49425b[_0x1d58('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 23a5383..8d22931 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 _0x2494=['express','Router','fs-extra','../../components/auth/service','./smsTransferReport.controller','isAuthenticated','index','get','describe','show','post','create','put','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0xc2f22b,_0x246ce9){var _0x46fcf4=function(_0x2b6351){while(--_0x2b6351){_0xc2f22b['push'](_0xc2f22b['shift']());}};_0x46fcf4(++_0x246ce9);}(_0x2494,0x82));var _0x4249=function(_0xb0dd48,_0x52d10d){_0xb0dd48=_0xb0dd48-0x0;var _0x1ca339=_0x2494[_0xb0dd48];return _0x1ca339;};'use strict';var multer=require(_0x4249('0x0'));var util=require('util');var path=require(_0x4249('0x1'));var timeout=require(_0x4249('0x2'));var express=require(_0x4249('0x3'));var router=express[_0x4249('0x4')]();var fs_extra=require(_0x4249('0x5'));var auth=require(_0x4249('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4249('0x7'));router['get']('/',auth[_0x4249('0x8')](),controller[_0x4249('0x9')]);router[_0x4249('0xa')]('/describe',auth[_0x4249('0x8')](),controller[_0x4249('0xb')]);router[_0x4249('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4249('0xc')]);router[_0x4249('0xd')]('/',auth[_0x4249('0x8')](),controller[_0x4249('0xe')]);router[_0x4249('0xf')](_0x4249('0x10'),auth[_0x4249('0x8')](),controller['update']);router['delete'](_0x4249('0x10'),auth['isAuthenticated'](),controller[_0x4249('0x11')]);module[_0x4249('0x12')]=router; \ No newline at end of file +var _0x950a=['/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','index','describe'];(function(_0x5c8d53,_0x40c3d6){var _0xb48c76=function(_0x3152c6){while(--_0x3152c6){_0x5c8d53['push'](_0x5c8d53['shift']());}};_0xb48c76(++_0x40c3d6);}(_0x950a,0x111));var _0xa950=function(_0x785ff7,_0x3ad00a){_0x785ff7=_0x785ff7-0x0;var _0x519dfd=_0x950a[_0x785ff7];return _0x519dfd;};'use strict';var multer=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var path=require(_0xa950('0x2'));var timeout=require(_0xa950('0x3'));var express=require('express');var router=express[_0xa950('0x4')]();var fs_extra=require(_0xa950('0x5'));var auth=require(_0xa950('0x6'));var interaction=require(_0xa950('0x7'));var config=require('../../config/environment');var controller=require(_0xa950('0x8'));router[_0xa950('0x9')]('/',auth['isAuthenticated'](),controller[_0xa950('0xa')]);router[_0xa950('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa950('0xb')]);router[_0xa950('0x9')](_0xa950('0xc'),auth[_0xa950('0xd')](),controller[_0xa950('0xe')]);router[_0xa950('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('0x10')]);router[_0xa950('0x11')](_0xa950('0xc'),auth['isAuthenticated'](),controller[_0xa950('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 b6b10dd..08471bd 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x420aa4,_0x3f83fe){var _0x17d6e4=function(_0x2583af){while(--_0x2583af){_0x420aa4['push'](_0x420aa4['shift']());}};_0x17d6e4(++_0x3f83fe);}(_0x70e0,0x17b));var _0x070e=function(_0x1d0e98,_0x53a125){_0x1d0e98=_0x1d0e98-0x0;var _0xc90e77=_0x70e0[_0x1d0e98];return _0xc90e77;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1c1fda,_0x1b076d){var _0xd76da7=function(_0x1b30b8){while(--_0x1b30b8){_0x1c1fda['push'](_0x1c1fda['shift']());}};_0xd76da7(++_0x1b076d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 97d2264..ab4d614 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 _0xfef4=['count','Content-Range','save','update','then','destroy','end','stack','name','index','map','SmsTransferReport','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','rawAttributes','include','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','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','status','json','offset','undefined','limit'];(function(_0x2ba8cc,_0x2ccb6d){var _0x53b54c=function(_0x37042a){while(--_0x37042a){_0x2ba8cc['push'](_0x2ba8cc['shift']());}};_0x53b54c(++_0x2ccb6d);}(_0xfef4,0x141));var _0x4fef=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0xfef4[_0x173113];return _0x3bea89;};'use strict';var emlformat=require(_0x4fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4fef('0x1'));var jsonpatch=require(_0x4fef('0x2'));var rp=require('request-promise');var moment=require(_0x4fef('0x3'));var BPromise=require(_0x4fef('0x4'));var Mustache=require(_0x4fef('0x5'));var util=require(_0x4fef('0x6'));var path=require(_0x4fef('0x7'));var sox=require('sox');var csv=require(_0x4fef('0x8'));var ejs=require(_0x4fef('0x9'));var fs=require('fs');var fs_extra=require(_0x4fef('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4fef('0xb'));var deskjs=require(_0x4fef('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4fef('0xd'));var Papa=require(_0x4fef('0xe'));var Redis=require(_0x4fef('0xf'));var authService=require(_0x4fef('0x10'));var qs=require(_0x4fef('0x11'));var as=require(_0x4fef('0x12'));var hardwareService=require(_0x4fef('0x13'));var logger=require(_0x4fef('0x14'))(_0x4fef('0x15'));var utils=require('../../config/utils');var config=require(_0x4fef('0x16'));var licenseUtil=require(_0x4fef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbc3f2e,_0x50cb46){_0x50cb46=_0x50cb46||0xcc;return function(_0x78ed3d){if(_0x78ed3d){return _0xbc3f2e['sendStatus'](_0x50cb46);}return _0xbc3f2e[_0x4fef('0x18')](_0x50cb46)['end']();};}function respondWithResult(_0x1a6621,_0x4a4fdf){_0x4a4fdf=_0x4a4fdf||0xc8;return function(_0x484c7f){if(_0x484c7f){return _0x1a6621[_0x4fef('0x18')](_0x4a4fdf)[_0x4fef('0x19')](_0x484c7f);}};}function respondWithFilteredResult(_0xaa1f14,_0x38159c){return function(_0x5c66e9){if(_0x5c66e9){var _0x2b68df=typeof _0x38159c[_0x4fef('0x1a')]===_0x4fef('0x1b')&&typeof _0x38159c[_0x4fef('0x1c')]==='undefined';var _0x34ce55=_0x5c66e9[_0x4fef('0x1d')];var _0x2daaed=_0x2b68df?0x0:_0x38159c['offset'];var _0x84a584=_0x2b68df?_0x5c66e9[_0x4fef('0x1d')]:_0x38159c['offset']+_0x38159c[_0x4fef('0x1c')];var _0x43014c;if(_0x84a584>=_0x34ce55){_0x84a584=_0x34ce55;_0x43014c=0xc8;}else{_0x43014c=0xce;}_0xaa1f14[_0x4fef('0x18')](_0x43014c);return _0xaa1f14['set'](_0x4fef('0x1e'),_0x2daaed+'-'+_0x84a584+'/'+_0x34ce55)[_0x4fef('0x19')](_0x5c66e9);}return null;};}function patchUpdates(_0x17f49d){return function(_0x623f02){try{jsonpatch['apply'](_0x623f02,_0x17f49d,!![]);}catch(_0x1b951c){return BPromise['reject'](_0x1b951c);}return _0x623f02[_0x4fef('0x1f')]();};}function saveUpdates(_0x2d927e,_0x496370){return function(_0x1d5429){if(_0x1d5429){return _0x1d5429[_0x4fef('0x20')](_0x2d927e)[_0x4fef('0x21')](function(_0x4e483d){return _0x4e483d;});}return null;};}function removeEntity(_0x17c12e,_0x330e2d){return function(_0x51351f){if(_0x51351f){return _0x51351f[_0x4fef('0x22')]()[_0x4fef('0x21')](function(){_0x17c12e['status'](0xcc)[_0x4fef('0x23')]();});}};}function handleEntityNotFound(_0x4d6782,_0x2b7d36){return function(_0xb5edc8){if(!_0xb5edc8){_0x4d6782['sendStatus'](0x194);}return _0xb5edc8;};}function handleError(_0x474726,_0x27bfd7){_0x27bfd7=_0x27bfd7||0x1f4;return function(_0x290b62){logger['error'](_0x290b62[_0x4fef('0x24')]);if(_0x290b62['name']){delete _0x290b62[_0x4fef('0x25')];}_0x474726[_0x4fef('0x18')](_0x27bfd7)['send'](_0x290b62);};}exports[_0x4fef('0x26')]=function(_0x392bb4,_0x2202a8){var _0x3625ee={},_0x47643f={},_0x9e4404={'count':0x0,'rows':[]};var _0x596217=_[_0x4fef('0x27')](db[_0x4fef('0x28')]['rawAttributes'],function(_0x1f21d2){return{'name':_0x1f21d2[_0x4fef('0x29')],'type':_0x1f21d2['type'][_0x4fef('0x2a')]};});_0x47643f[_0x4fef('0x2b')]=_[_0x4fef('0x27')](_0x596217,_0x4fef('0x25'));_0x47643f[_0x4fef('0x2c')]=_[_0x4fef('0x2d')](_0x392bb4[_0x4fef('0x2c')]);_0x47643f['filters']=_['intersection'](_0x47643f[_0x4fef('0x2b')],_0x47643f[_0x4fef('0x2c')]);_0x3625ee[_0x4fef('0x2e')]=_[_0x4fef('0x2f')](_0x47643f[_0x4fef('0x2b')],qs['fields'](_0x392bb4[_0x4fef('0x2c')][_0x4fef('0x30')]));_0x3625ee['attributes']=_0x3625ee[_0x4fef('0x2e')][_0x4fef('0x31')]?_0x3625ee[_0x4fef('0x2e')]:_0x47643f[_0x4fef('0x2b')];if(!_0x392bb4[_0x4fef('0x2c')]['hasOwnProperty'](_0x4fef('0x32'))){_0x3625ee[_0x4fef('0x1c')]=qs['limit'](_0x392bb4[_0x4fef('0x2c')]['limit']);_0x3625ee[_0x4fef('0x1a')]=qs['offset'](_0x392bb4[_0x4fef('0x2c')][_0x4fef('0x1a')]);}_0x3625ee['order']=qs[_0x4fef('0x33')](_0x392bb4[_0x4fef('0x2c')][_0x4fef('0x33')]);_0x3625ee[_0x4fef('0x34')]=qs[_0x4fef('0x35')](_[_0x4fef('0x36')](_0x392bb4[_0x4fef('0x2c')],_0x47643f[_0x4fef('0x35')]),_0x596217);if(_0x392bb4[_0x4fef('0x2c')][_0x4fef('0x37')]){_0x3625ee['where']=_[_0x4fef('0x38')](_0x3625ee['where'],{'$or':_['map'](_0x596217,function(_0x41276a){if(_0x41276a[_0x4fef('0x39')]!==_0x4fef('0x3a')){var _0x30a60b={};_0x30a60b[_0x41276a['name']]={'$like':'%'+_0x392bb4[_0x4fef('0x2c')]['filter']+'%'};return _0x30a60b;}})});}_0x3625ee=_[_0x4fef('0x38')]({},_0x3625ee,_0x392bb4[_0x4fef('0x3b')]);var _0x1a7041={'where':_0x3625ee[_0x4fef('0x34')]};return db[_0x4fef('0x28')]['count'](_0x1a7041)[_0x4fef('0x21')](function(_0x42dce9){_0x9e4404['count']=_0x42dce9;if(_0x392bb4[_0x4fef('0x2c')][_0x4fef('0x3c')]){_0x3625ee['include']=[{'all':!![]}];}return db[_0x4fef('0x28')][_0x4fef('0x3d')](_0x3625ee);})[_0x4fef('0x21')](function(_0x46ea08){_0x9e4404['rows']=_0x46ea08;return _0x9e4404;})['then'](respondWithFilteredResult(_0x2202a8,_0x3625ee))[_0x4fef('0x3e')](handleError(_0x2202a8,null));};exports['show']=function(_0x3a54f8,_0x11275b){var _0x28e087={'raw':!![],'where':{'id':_0x3a54f8['params']['id']}},_0x454ffb={};_0x454ffb[_0x4fef('0x2b')]=_[_0x4fef('0x2d')](db[_0x4fef('0x28')][_0x4fef('0x3f')]);_0x454ffb[_0x4fef('0x2c')]=_['keys'](_0x3a54f8[_0x4fef('0x2c')]);_0x454ffb[_0x4fef('0x35')]=_['intersection'](_0x454ffb[_0x4fef('0x2b')],_0x454ffb[_0x4fef('0x2c')]);_0x28e087[_0x4fef('0x2e')]=_[_0x4fef('0x2f')](_0x454ffb['model'],qs[_0x4fef('0x30')](_0x3a54f8[_0x4fef('0x2c')][_0x4fef('0x30')]));_0x28e087[_0x4fef('0x2e')]=_0x28e087[_0x4fef('0x2e')][_0x4fef('0x31')]?_0x28e087['attributes']:_0x454ffb['model'];if(_0x3a54f8['query'][_0x4fef('0x3c')]){_0x28e087[_0x4fef('0x40')]=[{'all':!![]}];}_0x28e087=_[_0x4fef('0x38')]({},_0x28e087,_0x3a54f8[_0x4fef('0x3b')]);return db[_0x4fef('0x28')][_0x4fef('0x41')](_0x28e087)['then'](handleEntityNotFound(_0x11275b,null))[_0x4fef('0x21')](respondWithResult(_0x11275b,null))[_0x4fef('0x3e')](handleError(_0x11275b,null));};exports[_0x4fef('0x42')]=function(_0x1530ab,_0x378f0a){return db[_0x4fef('0x28')][_0x4fef('0x42')](_0x1530ab[_0x4fef('0x43')],{})[_0x4fef('0x21')](respondWithResult(_0x378f0a,0xc9))[_0x4fef('0x3e')](handleError(_0x378f0a,null));};exports['update']=function(_0x59b157,_0x4c1d85){if(_0x59b157[_0x4fef('0x43')]['id']){delete _0x59b157['body']['id'];}return db[_0x4fef('0x28')][_0x4fef('0x41')]({'where':{'id':_0x59b157[_0x4fef('0x44')]['id']}})['then'](handleEntityNotFound(_0x4c1d85,null))[_0x4fef('0x21')](saveUpdates(_0x59b157[_0x4fef('0x43')],null))[_0x4fef('0x21')](respondWithResult(_0x4c1d85,null))[_0x4fef('0x3e')](handleError(_0x4c1d85,null));};exports[_0x4fef('0x22')]=function(_0x45e5a6,_0x87caf9){return db[_0x4fef('0x28')][_0x4fef('0x41')]({'where':{'id':_0x45e5a6[_0x4fef('0x44')]['id']}})[_0x4fef('0x21')](handleEntityNotFound(_0x87caf9,null))[_0x4fef('0x21')](removeEntity(_0x87caf9,null))[_0x4fef('0x3e')](handleError(_0x87caf9,null));};exports[_0x4fef('0x45')]=function(_0x5d95ec,_0x2f331d){return db[_0x4fef('0x28')]['describe']()['then'](respondWithResult(_0x2f331d,null))[_0x4fef('0x3e')](handleError(_0x2f331d,null));}; \ No newline at end of file +var _0x6191=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','then','destroy','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','merge','where','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x4fdd16,_0x3174cb){var _0x553370=function(_0x52b021){while(--_0x52b021){_0x4fdd16['push'](_0x4fdd16['shift']());}};_0x553370(++_0x3174cb);}(_0x6191,0xd0));var _0x1619=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x6191[_0x310504];return _0x5b36d0;};'use strict';var emlformat=require(_0x1619('0x0'));var rimraf=require(_0x1619('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1619('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1619('0x3'));var Mustache=require(_0x1619('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1619('0x5'));var csv=require(_0x1619('0x6'));var ejs=require(_0x1619('0x7'));var fs=require('fs');var fs_extra=require(_0x1619('0x8'));var _=require(_0x1619('0x9'));var squel=require(_0x1619('0xa'));var crypto=require(_0x1619('0xb'));var jsforce=require(_0x1619('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1619('0x6'));var querystring=require(_0x1619('0xd'));var Papa=require('papaparse');var Redis=require(_0x1619('0xe'));var authService=require(_0x1619('0xf'));var qs=require(_0x1619('0x10'));var as=require(_0x1619('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1619('0x12'))(_0x1619('0x13'));var utils=require(_0x1619('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1619('0x15'));var db=require(_0x1619('0x16'))['db'];function respondWithStatusCode(_0x3d988e,_0x4ec6e8){_0x4ec6e8=_0x4ec6e8||0xcc;return function(_0x40e2ae){if(_0x40e2ae){return _0x3d988e[_0x1619('0x17')](_0x4ec6e8);}return _0x3d988e[_0x1619('0x18')](_0x4ec6e8)[_0x1619('0x19')]();};}function respondWithResult(_0x5905ba,_0xea0517){_0xea0517=_0xea0517||0xc8;return function(_0x5b0a21){if(_0x5b0a21){return _0x5905ba[_0x1619('0x18')](_0xea0517)[_0x1619('0x1a')](_0x5b0a21);}};}function respondWithFilteredResult(_0x264bc6,_0x4e0274){return function(_0x21addd){if(_0x21addd){var _0x31b1c9=typeof _0x4e0274[_0x1619('0x1b')]===_0x1619('0x1c')&&typeof _0x4e0274['limit']===_0x1619('0x1c');var _0x170565=_0x21addd[_0x1619('0x1d')];var _0x2807cd=_0x31b1c9?0x0:_0x4e0274[_0x1619('0x1b')];var _0x3395f5=_0x31b1c9?_0x21addd[_0x1619('0x1d')]:_0x4e0274[_0x1619('0x1b')]+_0x4e0274[_0x1619('0x1e')];var _0x5afaa4;if(_0x3395f5>=_0x170565){_0x3395f5=_0x170565;_0x5afaa4=0xc8;}else{_0x5afaa4=0xce;}_0x264bc6[_0x1619('0x18')](_0x5afaa4);return _0x264bc6[_0x1619('0x1f')](_0x1619('0x20'),_0x2807cd+'-'+_0x3395f5+'/'+_0x170565)[_0x1619('0x1a')](_0x21addd);}return null;};}function patchUpdates(_0x20875e){return function(_0x48663c){try{jsonpatch['apply'](_0x48663c,_0x20875e,!![]);}catch(_0xba79f2){return BPromise['reject'](_0xba79f2);}return _0x48663c[_0x1619('0x21')]();};}function saveUpdates(_0x20ff0d,_0x7751e9){return function(_0x2b92ec){if(_0x2b92ec){return _0x2b92ec['update'](_0x20ff0d)[_0x1619('0x22')](function(_0x42ba6b){return _0x42ba6b;});}return null;};}function removeEntity(_0x4e97d8,_0x35d62a){return function(_0x3f85b5){if(_0x3f85b5){return _0x3f85b5[_0x1619('0x23')]()[_0x1619('0x22')](function(){_0x4e97d8[_0x1619('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29a9a3,_0x4bdc9d){return function(_0x15ecad){if(!_0x15ecad){_0x29a9a3['sendStatus'](0x194);}return _0x15ecad;};}function handleError(_0x287bd5,_0x18cb86){_0x18cb86=_0x18cb86||0x1f4;return function(_0x3433f9){logger[_0x1619('0x24')](_0x3433f9[_0x1619('0x25')]);if(_0x3433f9[_0x1619('0x26')]){delete _0x3433f9[_0x1619('0x26')];}_0x287bd5['status'](_0x18cb86)[_0x1619('0x27')](_0x3433f9);};}exports['index']=function(_0x4dc904,_0x352aef){var _0x132704={},_0x531645={},_0x4476be={'count':0x0,'rows':[]};var _0x176d37=_['map'](db[_0x1619('0x28')][_0x1619('0x29')],function(_0x1c079d){return{'name':_0x1c079d[_0x1619('0x2a')],'type':_0x1c079d['type'][_0x1619('0x2b')]};});_0x531645[_0x1619('0x2c')]=_['map'](_0x176d37,_0x1619('0x26'));_0x531645[_0x1619('0x2d')]=_[_0x1619('0x2e')](_0x4dc904[_0x1619('0x2d')]);_0x531645[_0x1619('0x2f')]=_['intersection'](_0x531645[_0x1619('0x2c')],_0x531645[_0x1619('0x2d')]);_0x132704[_0x1619('0x30')]=_[_0x1619('0x31')](_0x531645[_0x1619('0x2c')],qs[_0x1619('0x32')](_0x4dc904[_0x1619('0x2d')][_0x1619('0x32')]));_0x132704[_0x1619('0x30')]=_0x132704[_0x1619('0x30')][_0x1619('0x33')]?_0x132704[_0x1619('0x30')]:_0x531645[_0x1619('0x2c')];if(!_0x4dc904[_0x1619('0x2d')][_0x1619('0x34')]('nolimit')){_0x132704[_0x1619('0x1e')]=qs[_0x1619('0x1e')](_0x4dc904[_0x1619('0x2d')][_0x1619('0x1e')]);_0x132704['offset']=qs[_0x1619('0x1b')](_0x4dc904['query']['offset']);}_0x132704[_0x1619('0x35')]=qs['sort'](_0x4dc904[_0x1619('0x2d')][_0x1619('0x36')]);_0x132704['where']=qs[_0x1619('0x2f')](_[_0x1619('0x37')](_0x4dc904['query'],_0x531645['filters']),_0x176d37);if(_0x4dc904[_0x1619('0x2d')]['filter']){_0x132704['where']=_[_0x1619('0x38')](_0x132704[_0x1619('0x39')],{'$or':_[_0x1619('0x3a')](_0x176d37,function(_0x95828f){if(_0x95828f[_0x1619('0x3b')]!==_0x1619('0x3c')){var _0x291026={};_0x291026[_0x95828f[_0x1619('0x26')]]={'$like':'%'+_0x4dc904[_0x1619('0x2d')]['filter']+'%'};return _0x291026;}})});}_0x132704=_[_0x1619('0x38')]({},_0x132704,_0x4dc904[_0x1619('0x3d')]);var _0x3b1b22={'where':_0x132704[_0x1619('0x39')]};return db[_0x1619('0x28')][_0x1619('0x1d')](_0x3b1b22)[_0x1619('0x22')](function(_0x1f7fa4){_0x4476be['count']=_0x1f7fa4;if(_0x4dc904[_0x1619('0x2d')][_0x1619('0x3e')]){_0x132704[_0x1619('0x3f')]=[{'all':!![]}];}return db[_0x1619('0x28')][_0x1619('0x40')](_0x132704);})[_0x1619('0x22')](function(_0x44b88a){_0x4476be[_0x1619('0x41')]=_0x44b88a;return _0x4476be;})[_0x1619('0x22')](respondWithFilteredResult(_0x352aef,_0x132704))[_0x1619('0x42')](handleError(_0x352aef,null));};exports[_0x1619('0x43')]=function(_0x538284,_0x20629c){var _0x397679={'raw':!![],'where':{'id':_0x538284[_0x1619('0x44')]['id']}},_0x33d84d={};_0x33d84d[_0x1619('0x2c')]=_['keys'](db[_0x1619('0x28')]['rawAttributes']);_0x33d84d[_0x1619('0x2d')]=_['keys'](_0x538284[_0x1619('0x2d')]);_0x33d84d[_0x1619('0x2f')]=_['intersection'](_0x33d84d['model'],_0x33d84d[_0x1619('0x2d')]);_0x397679[_0x1619('0x30')]=_[_0x1619('0x31')](_0x33d84d[_0x1619('0x2c')],qs[_0x1619('0x32')](_0x538284[_0x1619('0x2d')][_0x1619('0x32')]));_0x397679['attributes']=_0x397679[_0x1619('0x30')][_0x1619('0x33')]?_0x397679[_0x1619('0x30')]:_0x33d84d[_0x1619('0x2c')];if(_0x538284[_0x1619('0x2d')][_0x1619('0x3e')]){_0x397679[_0x1619('0x3f')]=[{'all':!![]}];}_0x397679=_[_0x1619('0x38')]({},_0x397679,_0x538284['options']);return db['SmsTransferReport'][_0x1619('0x45')](_0x397679)[_0x1619('0x22')](handleEntityNotFound(_0x20629c,null))[_0x1619('0x22')](respondWithResult(_0x20629c,null))[_0x1619('0x42')](handleError(_0x20629c,null));};exports[_0x1619('0x46')]=function(_0x131705,_0x354523){return db[_0x1619('0x28')]['create'](_0x131705[_0x1619('0x47')],{})[_0x1619('0x22')](respondWithResult(_0x354523,0xc9))[_0x1619('0x42')](handleError(_0x354523,null));};exports['update']=function(_0x1d0ffc,_0x1bcfea){if(_0x1d0ffc[_0x1619('0x47')]['id']){delete _0x1d0ffc['body']['id'];}return db[_0x1619('0x28')]['find']({'where':{'id':_0x1d0ffc[_0x1619('0x44')]['id']}})[_0x1619('0x22')](handleEntityNotFound(_0x1bcfea,null))[_0x1619('0x22')](saveUpdates(_0x1d0ffc[_0x1619('0x47')],null))[_0x1619('0x22')](respondWithResult(_0x1bcfea,null))[_0x1619('0x42')](handleError(_0x1bcfea,null));};exports[_0x1619('0x23')]=function(_0x551391,_0x5f2bfd){return db[_0x1619('0x28')][_0x1619('0x45')]({'where':{'id':_0x551391[_0x1619('0x44')]['id']}})[_0x1619('0x22')](handleEntityNotFound(_0x5f2bfd,null))[_0x1619('0x22')](removeEntity(_0x5f2bfd,null))[_0x1619('0x42')](handleError(_0x5f2bfd,null));};exports[_0x1619('0x48')]=function(_0x720844,_0x3eba60){return db[_0x1619('0x28')][_0x1619('0x48')]()[_0x1619('0x22')](respondWithResult(_0x3eba60,null))[_0x1619('0x42')](handleError(_0x3eba60,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 94fd110..20121ee 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 _0x0f50=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','lodash','util','../../config/logger'];(function(_0x224b36,_0x23d709){var _0x56a569=function(_0x3e55e8){while(--_0x3e55e8){_0x224b36['push'](_0x224b36['shift']());}};_0x56a569(++_0x23d709);}(_0x0f50,0x1ce));var _0x00f5=function(_0x54c06a,_0x443b29){_0x54c06a=_0x54c06a-0x0;var _0x27d653=_0x0f50[_0x54c06a];return _0x27d653;};'use strict';var _=require(_0x00f5('0x0'));var util=require(_0x00f5('0x1'));var logger=require(_0x00f5('0x2'))(_0x00f5('0x3'));var moment=require(_0x00f5('0x4'));var BPromise=require(_0x00f5('0x5'));var rp=require(_0x00f5('0x6'));var fs=require('fs');var path=require(_0x00f5('0x7'));var rimraf=require(_0x00f5('0x8'));var config=require(_0x00f5('0x9'));var attributes=require(_0x00f5('0xa'));module[_0x00f5('0xb')]=function(_0x5427a1,_0x3d8c10){return _0x5427a1[_0x00f5('0xc')](_0x00f5('0xd'),attributes,{'tableName':_0x00f5('0xe'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x34aa=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x44406f,_0x428cc6){var _0x59dfaf=function(_0x14f87b){while(--_0x14f87b){_0x44406f['push'](_0x44406f['shift']());}};_0x59dfaf(++_0x428cc6);}(_0x34aa,0x171));var _0xa34a=function(_0x3050ca,_0x3e36b0){_0x3050ca=_0x3050ca-0x0;var _0x1eed1d=_0x34aa[_0x3050ca];return _0x1eed1d;};'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':[{'name':_0xa34a('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 69b66a3..1a3ca61 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 _0x943c=['stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0xf46f31,_0x4785da){var _0x49f7b9=function(_0x498c53){while(--_0x498c53){_0xf46f31['push'](_0xf46f31['shift']());}};_0x49f7b9(++_0x4785da);}(_0x943c,0xd8));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var moment=require(_0xc943('0x2'));var BPromise=require(_0xc943('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc943('0x4'))['db'];var utils=require(_0xc943('0x5'));var logger=require(_0xc943('0x6'))('rpc');var config=require(_0xc943('0x7'));var jayson=require(_0xc943('0x8'));var client=jayson[_0xc943('0x9')][_0xc943('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b73ad,_0x4091fd,_0x3f718f){return new BPromise(function(_0x56e665,_0x3ec7da){return client[_0xc943('0xb')](_0x1b73ad,_0x3f718f)[_0xc943('0xc')](function(_0x455eed){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x4091fd,_0xc943('0xd'));logger[_0xc943('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x4091fd,'request\x20sent',JSON[_0xc943('0xf')](_0x455eed));if(_0x455eed[_0xc943('0x10')]){if(_0x455eed[_0xc943('0x10')][_0xc943('0x11')]===0x1f4){logger[_0xc943('0x10')](_0xc943('0x12'),_0x4091fd,_0x455eed['error'][_0xc943('0x13')]);return _0x3ec7da(_0x455eed[_0xc943('0x10')]['message']);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4091fd,_0x455eed[_0xc943('0x10')][_0xc943('0x13')]);return _0x56e665(_0x455eed['error'][_0xc943('0x13')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x4091fd,_0xc943('0xd'));_0x56e665(_0x455eed['result'][_0xc943('0x13')]);}})[_0xc943('0x14')](function(_0x1eb50a){logger[_0xc943('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x4091fd,_0x1eb50a);_0x3ec7da(_0x1eb50a);});});} \ No newline at end of file +var _0xf6c1=['jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x595f13,_0x20fac7){var _0x401219=function(_0x15b372){while(--_0x15b372){_0x595f13['push'](_0x595f13['shift']());}};_0x401219(++_0x20fac7);}(_0xf6c1,0x99));var _0x1f6c=function(_0x487d73,_0x115ab2){_0x487d73=_0x487d73-0x0;var _0x470ea2=_0xf6c1[_0x487d73];return _0x470ea2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f6c('0x0'));var BPromise=require(_0x1f6c('0x1'));var rs=require(_0x1f6c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f6c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f6c('0x4'))(_0x1f6c('0x5'));var config=require(_0x1f6c('0x6'));var jayson=require(_0x1f6c('0x7'));var client=jayson[_0x1f6c('0x8')][_0x1f6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x530b25,_0x3c7569,_0x1385de){return new BPromise(function(_0xade159,_0xcf5c23){return client[_0x1f6c('0xa')](_0x530b25,_0x1385de)[_0x1f6c('0xb')](function(_0x1e7287){logger[_0x1f6c('0xc')](_0x1f6c('0xd'),_0x3c7569,'request\x20sent');logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3c7569,_0x1f6c('0xe'),JSON[_0x1f6c('0xf')](_0x1e7287));if(_0x1e7287[_0x1f6c('0x10')]){if(_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x11')]===0x1f4){logger[_0x1f6c('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x3c7569,_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x12')]);return _0xcf5c23(_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x12')]);}logger[_0x1f6c('0x10')](_0x1f6c('0xd'),_0x3c7569,_0x1e7287[_0x1f6c('0x10')][_0x1f6c('0x12')]);return _0xade159(_0x1e7287['error'][_0x1f6c('0x12')]);}else{logger[_0x1f6c('0xc')](_0x1f6c('0xd'),_0x3c7569,_0x1f6c('0xe'));_0xade159(_0x1e7287[_0x1f6c('0x13')][_0x1f6c('0x12')]);}})['catch'](function(_0x521c4c){logger[_0x1f6c('0x10')](_0x1f6c('0xd'),_0x3c7569,_0x521c4c);_0xcf5c23(_0x521c4c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 90eb7ff..12ae478 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 _0x005c=['extname','now','post','file','create','put','update','/:id','delete','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/download','download','join','server/files/sounds/original/','originalname','replace','format','basename'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x005c,0x175));var _0xc005=function(_0x50c8d0,_0x2bd38e){_0x50c8d0=_0x50c8d0-0x0;var _0x3bddfc=_0x005c[_0x50c8d0];return _0x3bddfc;};'use strict';var multer=require(_0xc005('0x0'));var util=require('util');var path=require(_0xc005('0x1'));var timeout=require(_0xc005('0x2'));var express=require(_0xc005('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc005('0x4'));var interaction=require(_0xc005('0x5'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xc005('0x6')]('/',auth[_0xc005('0x7')](),controller[_0xc005('0x8')]);router[_0xc005('0x6')]('/:id',auth[_0xc005('0x7')](),controller['show']);router[_0xc005('0x6')](_0xc005('0x9'),auth[_0xc005('0x7')](),controller[_0xc005('0xa')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x34752e,_0xbcb504,_0x593fdf){_0x593fdf(null,path[_0xc005('0xb')](config['root'],_0xc005('0xc')));},'filename':function(_0x391605,_0x28ee30,_0x23b615){_0x28ee30[_0xc005('0xd')]=_0x28ee30[_0xc005('0xd')][_0xc005('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23b615(null,util[_0xc005('0xf')]('%s-%s%s',path[_0xc005('0x10')](_0x28ee30[_0xc005('0xd')],path[_0xc005('0x11')](_0x28ee30['originalname'])),Date[_0xc005('0x12')](),path[_0xc005('0x11')](_0x28ee30['originalname'])));}})});router[_0xc005('0x13')]('/',upload['single'](_0xc005('0x14')),controller[_0xc005('0x15')]);router[_0xc005('0x16')]('/:id',auth[_0xc005('0x7')](),controller[_0xc005('0x17')]);router['delete'](_0xc005('0x18'),auth[_0xc005('0x7')](),controller[_0xc005('0x19')]);module['exports']=router; \ No newline at end of file +var _0x9da1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','get','/:id','show','/:id/download','download','root','server/files/sounds/original/','originalname','replace','%s-%s%s','extname','single','file','create','put','update','delete','exports','multer','util','connect-timeout','express'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9da1,0x14c));var _0x19da=function(_0x37f6d8,_0x444925){_0x37f6d8=_0x37f6d8-0x0;var _0x49f67b=_0x9da1[_0x37f6d8];return _0x49f67b;};'use strict';var multer=require(_0x19da('0x0'));var util=require(_0x19da('0x1'));var path=require('path');var timeout=require(_0x19da('0x2'));var express=require(_0x19da('0x3'));var router=express['Router']();var fs_extra=require(_0x19da('0x4'));var auth=require(_0x19da('0x5'));var interaction=require(_0x19da('0x6'));var config=require(_0x19da('0x7'));var controller=require(_0x19da('0x8'));router['get']('/',auth[_0x19da('0x9')](),controller['index']);router[_0x19da('0xa')](_0x19da('0xb'),auth[_0x19da('0x9')](),controller[_0x19da('0xc')]);router['get'](_0x19da('0xd'),auth[_0x19da('0x9')](),controller[_0x19da('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x507ba5,_0x472aa2,_0x5bb450){_0x5bb450(null,path['join'](config[_0x19da('0xf')],_0x19da('0x10')));},'filename':function(_0x56e2d4,_0x1477cb,_0x16aa7c){_0x1477cb[_0x19da('0x11')]=_0x1477cb['originalname'][_0x19da('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x16aa7c(null,util['format'](_0x19da('0x13'),path['basename'](_0x1477cb[_0x19da('0x11')],path['extname'](_0x1477cb[_0x19da('0x11')])),Date['now'](),path[_0x19da('0x14')](_0x1477cb[_0x19da('0x11')])));}})});router['post']('/',upload[_0x19da('0x15')](_0x19da('0x16')),controller[_0x19da('0x17')]);router[_0x19da('0x18')](_0x19da('0xb'),auth['isAuthenticated'](),controller[_0x19da('0x19')]);router[_0x19da('0x1a')](_0x19da('0xb'),auth[_0x19da('0x9')](),controller[_0x19da('0x1a')]);module[_0x19da('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 5f17058..4b5d30b 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 _0x89ac=['FLOAT','INTEGER','BIGINT','name','STRING'];(function(_0x14289f,_0xc0b72b){var _0x52bb8f=function(_0xfa1ea2){while(--_0xfa1ea2){_0x14289f['push'](_0x14289f['shift']());}};_0x52bb8f(++_0xc0b72b);}(_0x89ac,0x111));var _0xc89a=function(_0x1623a3,_0xd41524){_0x1623a3=_0x1623a3-0x0;var _0x41ed31=_0x89ac[_0x1623a3];return _0x41ed31;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc89a('0x0'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xc89a('0x1')]},'original_format':{'type':Sequelize[_0xc89a('0x1')]},'original_duration':{'type':Sequelize[_0xc89a('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xc89a('0x3')]},'original_bitRate':{'type':Sequelize[_0xc89a('0x4')]},'original_sampleRate':{'type':Sequelize[_0xc89a('0x3')]},'converted_format':{'type':Sequelize[_0xc89a('0x1')]},'converted_duration':{'type':Sequelize[_0xc89a('0x2')]},'converted_sampleCount':{'type':Sequelize[_0xc89a('0x4')]},'converted_channelCount':{'type':Sequelize[_0xc89a('0x3')]},'converted_bitRate':{'type':Sequelize[_0xc89a('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xc89a('0x3')]}}; \ No newline at end of file +var _0x87df=['sequelize','exports','STRING','name','FLOAT','INTEGER','BIGINT'];(function(_0x21c23e,_0x1d33e3){var _0xa7b7e2=function(_0x6ac2a8){while(--_0x6ac2a8){_0x21c23e['push'](_0x21c23e['shift']());}};_0xa7b7e2(++_0x1d33e3);}(_0x87df,0xb6));var _0xf87d=function(_0x20410e,_0x11ea83){_0x20410e=_0x20410e-0x0;var _0x18e1cc=_0x87df[_0x20410e];return _0x18e1cc;};'use strict';var Sequelize=require(_0xf87d('0x0'));module[_0xf87d('0x1')]={'name':{'type':Sequelize[_0xf87d('0x2')],'unique':_0xf87d('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xf87d('0x2')]},'display_name':{'type':Sequelize[_0xf87d('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xf87d('0x2')]},'original_format':{'type':Sequelize[_0xf87d('0x2')]},'original_duration':{'type':Sequelize[_0xf87d('0x4')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xf87d('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xf87d('0x5')]},'converted_format':{'type':Sequelize[_0xf87d('0x2')]},'converted_duration':{'type':Sequelize[_0xf87d('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xf87d('0x5')]},'converted_bitRate':{'type':Sequelize[_0xf87d('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xf87d('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index fa0bd7e..7bec7f9 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 _0x99a7=['info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','delete','format','original_format','save_name','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','offset','limit','undefined','status','json','apply','reject','save','then','destroy','get','Sounds','sendStatus','error','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','Sound','count','includeAll','include','rows','catch','show','params','download','find','existsSync','root','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','%s.%s','create','basename','extname','file','filename','substring','wav','server/files/sounds/original','join'];(function(_0x5a433c,_0x423be6){var _0x310003=function(_0x293dc2){while(--_0x293dc2){_0x5a433c['push'](_0x5a433c['shift']());}};_0x310003(++_0x423be6);}(_0x99a7,0xa0));var _0x799a=function(_0x5df061,_0x400a05){_0x5df061=_0x5df061-0x0;var _0x5a4ef6=_0x99a7[_0x5df061];return _0x5a4ef6;};'use strict';var emlformat=require(_0x799a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x799a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x799a('0x2'));var moment=require(_0x799a('0x3'));var BPromise=require(_0x799a('0x4'));var Mustache=require(_0x799a('0x5'));var util=require('util');var path=require(_0x799a('0x6'));var sox=require(_0x799a('0x7'));var csv=require(_0x799a('0x8'));var ejs=require(_0x799a('0x9'));var fs=require('fs');var fs_extra=require(_0x799a('0xa'));var _=require(_0x799a('0xb'));var squel=require(_0x799a('0xc'));var crypto=require(_0x799a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x799a('0xe'));var toCsv=require(_0x799a('0x8'));var querystring=require(_0x799a('0xf'));var Papa=require('papaparse');var Redis=require(_0x799a('0x10'));var authService=require(_0x799a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x799a('0x12'));var hardwareService=require(_0x799a('0x13'));var logger=require('../../config/logger')(_0x799a('0x14'));var utils=require(_0x799a('0x15'));var config=require(_0x799a('0x16'));var licenseUtil=require(_0x799a('0x17'));var db=require(_0x799a('0x18'))['db'];function respondWithStatusCode(_0xeaa722,_0x37cf6e){_0x37cf6e=_0x37cf6e||0xcc;return function(_0xad009c){if(_0xad009c){return _0xeaa722['sendStatus'](_0x37cf6e);}return _0xeaa722['status'](_0x37cf6e)[_0x799a('0x19')]();};}function respondWithResult(_0x34e61f,_0x4569a3){_0x4569a3=_0x4569a3||0xc8;return function(_0x3b8739){if(_0x3b8739){return _0x34e61f['status'](_0x4569a3)['json'](_0x3b8739);}};}function respondWithFilteredResult(_0x4ae711,_0x1917d5){return function(_0x159516){if(_0x159516){var _0x56560b=typeof _0x1917d5[_0x799a('0x1a')]==='undefined'&&typeof _0x1917d5[_0x799a('0x1b')]===_0x799a('0x1c');var _0x4ed3bb=_0x159516['count'];var _0x4748df=_0x56560b?0x0:_0x1917d5['offset'];var _0x5e063a=_0x56560b?_0x159516['count']:_0x1917d5[_0x799a('0x1a')]+_0x1917d5[_0x799a('0x1b')];var _0xdac7e3;if(_0x5e063a>=_0x4ed3bb){_0x5e063a=_0x4ed3bb;_0xdac7e3=0xc8;}else{_0xdac7e3=0xce;}_0x4ae711[_0x799a('0x1d')](_0xdac7e3);return _0x4ae711['set']('Content-Range',_0x4748df+'-'+_0x5e063a+'/'+_0x4ed3bb)[_0x799a('0x1e')](_0x159516);}return null;};}function patchUpdates(_0x3c911b){return function(_0x360291){try{jsonpatch[_0x799a('0x1f')](_0x360291,_0x3c911b,!![]);}catch(_0x2f8c7a){return BPromise[_0x799a('0x20')](_0x2f8c7a);}return _0x360291[_0x799a('0x21')]();};}function saveUpdates(_0x916c6,_0x52cf73){return function(_0x481a2e){if(_0x481a2e){return _0x481a2e['update'](_0x916c6)[_0x799a('0x22')](function(_0x32013b){return _0x32013b;});}return null;};}function removeEntity(_0x41c48c,_0x302a13){return function(_0x5981e3){if(_0x5981e3){return _0x5981e3[_0x799a('0x23')]()[_0x799a('0x22')](function(){var _0x48df04=_0x5981e3[_0x799a('0x24')]({'plain':!![]});var _0x1756a1=_0x799a('0x25');return db['UserProfileResource'][_0x799a('0x23')]({'where':{'type':_0x1756a1,'resourceId':_0x48df04['id']}})[_0x799a('0x22')](function(){return _0x5981e3;});})[_0x799a('0x22')](function(){_0x41c48c['status'](0xcc)[_0x799a('0x19')]();});}};}function handleEntityNotFound(_0x2caf68,_0x249e7e){return function(_0x1bd71b){if(!_0x1bd71b){_0x2caf68[_0x799a('0x26')](0x194);}return _0x1bd71b;};}function handleError(_0xecedf8,_0x12948e){_0x12948e=_0x12948e||0x1f4;return function(_0x4ef259){logger[_0x799a('0x27')](_0x4ef259['stack']);if(_0x4ef259[_0x799a('0x28')]){delete _0x4ef259[_0x799a('0x28')];}_0xecedf8[_0x799a('0x1d')](_0x12948e)[_0x799a('0x29')](_0x4ef259);};}exports[_0x799a('0x2a')]=function(_0x84e899,_0x5ecfcc){var _0x1dd2ca={},_0x3c8316={},_0x2ef95a={'count':0x0,'rows':[]};var _0x21fedf=_[_0x799a('0x2b')](db['Sound']['rawAttributes'],function(_0x4f6417){return{'name':_0x4f6417[_0x799a('0x2c')],'type':_0x4f6417[_0x799a('0x2d')][_0x799a('0x2e')]};});_0x3c8316['model']=_[_0x799a('0x2b')](_0x21fedf,_0x799a('0x28'));_0x3c8316[_0x799a('0x2f')]=_[_0x799a('0x30')](_0x84e899[_0x799a('0x2f')]);_0x3c8316[_0x799a('0x31')]=_[_0x799a('0x32')](_0x3c8316[_0x799a('0x33')],_0x3c8316[_0x799a('0x2f')]);_0x1dd2ca['attributes']=_['intersection'](_0x3c8316[_0x799a('0x33')],qs['fields'](_0x84e899['query'][_0x799a('0x34')]));_0x1dd2ca[_0x799a('0x35')]=_0x1dd2ca['attributes'][_0x799a('0x36')]?_0x1dd2ca[_0x799a('0x35')]:_0x3c8316[_0x799a('0x33')];if(!_0x84e899[_0x799a('0x2f')]['hasOwnProperty'](_0x799a('0x37'))){_0x1dd2ca[_0x799a('0x1b')]=qs[_0x799a('0x1b')](_0x84e899[_0x799a('0x2f')][_0x799a('0x1b')]);_0x1dd2ca['offset']=qs[_0x799a('0x1a')](_0x84e899['query']['offset']);}_0x1dd2ca['order']=qs[_0x799a('0x38')](_0x84e899['query'][_0x799a('0x38')]);_0x1dd2ca[_0x799a('0x39')]=qs[_0x799a('0x31')](_[_0x799a('0x3a')](_0x84e899[_0x799a('0x2f')],_0x3c8316['filters']),_0x21fedf);if(_0x84e899['query'][_0x799a('0x3b')]){_0x1dd2ca[_0x799a('0x39')]=_['merge'](_0x1dd2ca[_0x799a('0x39')],{'$or':_[_0x799a('0x2b')](_0x21fedf,function(_0x3cf171){if(_0x3cf171[_0x799a('0x2d')]!==_0x799a('0x3c')){var _0x3df801={};_0x3df801[_0x3cf171[_0x799a('0x28')]]={'$like':'%'+_0x84e899[_0x799a('0x2f')][_0x799a('0x3b')]+'%'};return _0x3df801;}})});}_0x1dd2ca=_[_0x799a('0x3d')]({},_0x1dd2ca,_0x84e899[_0x799a('0x3e')]);var _0xf36227={'where':_0x1dd2ca[_0x799a('0x39')]};return db[_0x799a('0x3f')][_0x799a('0x40')](_0xf36227)[_0x799a('0x22')](function(_0x174921){_0x2ef95a[_0x799a('0x40')]=_0x174921;if(_0x84e899[_0x799a('0x2f')][_0x799a('0x41')]){_0x1dd2ca[_0x799a('0x42')]=[{'all':!![]}];}return db[_0x799a('0x3f')]['findAll'](_0x1dd2ca);})[_0x799a('0x22')](function(_0x35df0b){_0x2ef95a[_0x799a('0x43')]=_0x35df0b;return _0x2ef95a;})[_0x799a('0x22')](respondWithFilteredResult(_0x5ecfcc,_0x1dd2ca))[_0x799a('0x44')](handleError(_0x5ecfcc,null));};exports[_0x799a('0x45')]=function(_0x246f87,_0x4f5f7a){var _0x1f38ee={'raw':!![],'where':{'id':_0x246f87[_0x799a('0x46')]['id']}},_0x2345d8={};_0x2345d8['model']=_['keys'](db[_0x799a('0x3f')]['rawAttributes']);_0x2345d8[_0x799a('0x2f')]=_[_0x799a('0x30')](_0x246f87['query']);_0x2345d8[_0x799a('0x31')]=_['intersection'](_0x2345d8[_0x799a('0x33')],_0x2345d8[_0x799a('0x2f')]);_0x1f38ee['attributes']=_[_0x799a('0x32')](_0x2345d8[_0x799a('0x33')],qs[_0x799a('0x34')](_0x246f87['query'][_0x799a('0x34')]));_0x1f38ee[_0x799a('0x35')]=_0x1f38ee[_0x799a('0x35')][_0x799a('0x36')]?_0x1f38ee[_0x799a('0x35')]:_0x2345d8[_0x799a('0x33')];if(_0x246f87[_0x799a('0x2f')][_0x799a('0x41')]){_0x1f38ee['include']=[{'all':!![]}];}_0x1f38ee=_[_0x799a('0x3d')]({},_0x1f38ee,_0x246f87[_0x799a('0x3e')]);return db[_0x799a('0x3f')]['find'](_0x1f38ee)[_0x799a('0x22')](handleEntityNotFound(_0x4f5f7a,null))[_0x799a('0x22')](respondWithResult(_0x4f5f7a,null))['catch'](handleError(_0x4f5f7a,null));};exports[_0x799a('0x47')]=function(_0x40f2a0,_0xcbebcb,_0x74a132){return db[_0x799a('0x3f')][_0x799a('0x48')]({'where':{'id':_0x40f2a0['params']['id']},'attributes':['name','save_name','converted_format'],'raw':!![]})[_0x799a('0x22')](handleEntityNotFound(_0xcbebcb,null))[_0x799a('0x22')](function(_0x4bf83a){if(_0x4bf83a){if(!fs[_0x799a('0x49')](path['join'](config[_0x799a('0x4a')],'server/files/sounds/converted',_0x4bf83a['save_name']+'.'+_0x4bf83a[_0x799a('0x4b')]))){throw new db[(_0x799a('0x4c'))][(_0x799a('0x4d'))](_0x799a('0x4e'));}return _0xcbebcb[_0x799a('0x47')](path['join'](config[_0x799a('0x4a')],_0x799a('0x4f'),util['format'](_0x799a('0x50'),_0x4bf83a['save_name'],_0x4bf83a[_0x799a('0x4b')])),util['format'](_0x799a('0x50'),_0x4bf83a[_0x799a('0x28')],_0x4bf83a['converted_format']));}return null;})['catch'](handleError(_0xcbebcb,null));};exports[_0x799a('0x51')]=function(_0x42eb7f,_0x25d7e2,_0x5f40b3){var _0x36fcc={'name':path[_0x799a('0x52')](_0x42eb7f['file']['originalname'],path[_0x799a('0x53')](_0x42eb7f['file']['originalname'])),'save_name':path['basename'](_0x42eb7f[_0x799a('0x54')][_0x799a('0x55')],path['extname'](_0x42eb7f[_0x799a('0x54')]['filename'])),'original_format':path['extname'](_0x42eb7f[_0x799a('0x54')]['originalname'])[_0x799a('0x56')](0x1),'converted_format':_0x799a('0x57')};var _0x2d7861=path['join'](config[_0x799a('0x4a')],_0x799a('0x58'),_0x42eb7f[_0x799a('0x54')]['filename']);var _0x53c5b5=path[_0x799a('0x59')](config[_0x799a('0x4a')],_0x799a('0x4f'),util['format']('%s.%s',path[_0x799a('0x52')](_0x42eb7f[_0x799a('0x54')][_0x799a('0x55')],path['extname'](_0x42eb7f[_0x799a('0x54')][_0x799a('0x55')])),_0x36fcc['converted_format']));logger[_0x799a('0x5a')](_0x799a('0x5b'),_0x2d7861);logger[_0x799a('0x5a')]('Sound\x20upload\x20destination:\x20%s',_0x53c5b5);try{fs[_0x799a('0x5c')](_0x2d7861,parseInt(_0x799a('0x5d'),0x8));var _0x1b2e4a=sox[_0x799a('0x5e')](_0x2d7861,_0x53c5b5,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1b2e4a['on'](_0x799a('0x27'),function(_0x481ed3){fs[_0x799a('0x5f')](_0x2d7861);_0x25d7e2[_0x799a('0x1d')](0x1f4)['send'](_0x481ed3);});_0x1b2e4a['on']('src',function(_0xaad5cc){_0x36fcc[_0x799a('0x60')]=isNaN(_0xaad5cc[_0x799a('0x61')])?null:_0xaad5cc[_0x799a('0x61')]*0x3e8;_0x36fcc[_0x799a('0x62')]=isNaN(_0xaad5cc[_0x799a('0x63')])?null:_0xaad5cc['sampleCount'];_0x36fcc['original_channelCount']=isNaN(_0xaad5cc[_0x799a('0x64')])?null:_0xaad5cc['channelCount'];_0x36fcc[_0x799a('0x65')]=isNaN(_0xaad5cc[_0x799a('0x66')])?null:_0xaad5cc['bitRate'];_0x36fcc[_0x799a('0x67')]=isNaN(_0xaad5cc['sampleRate'])?null:_0xaad5cc['sampleRate'];});_0x1b2e4a['on']('dest',function(_0x6f2488){_0x36fcc['converted_duration']=isNaN(_0x6f2488[_0x799a('0x61')])?null:_0x6f2488['duration']*0x3e8;_0x36fcc[_0x799a('0x68')]=isNaN(_0x6f2488['sampleCount'])?null:_0x6f2488['sampleCount'];_0x36fcc[_0x799a('0x69')]=isNaN(_0x6f2488[_0x799a('0x64')])?null:_0x6f2488[_0x799a('0x64')];_0x36fcc[_0x799a('0x6a')]=isNaN(_0x6f2488[_0x799a('0x66')])?null:_0x6f2488['bitRate'];_0x36fcc[_0x799a('0x6b')]=isNaN(_0x6f2488[_0x799a('0x6c')])?null:_0x6f2488[_0x799a('0x6c')];});_0x1b2e4a['on'](_0x799a('0x19'),function(){fs[_0x799a('0x5c')](_0x53c5b5,parseInt(_0x799a('0x5d'),0x8));return db[_0x799a('0x3f')][_0x799a('0x51')](_0x36fcc)['then'](function(_0x1a813d){var _0x22575d={'role':_0x42eb7f['body'][_0x799a('0x6d')],'userProfileId':_0x42eb7f[_0x799a('0x6e')][_0x799a('0x6f')]};if(!_0x22575d)throw new Error(_0x799a('0x70'));if(_0x22575d[_0x799a('0x6d')]===_0x799a('0x71')){var _0x4f7324=_0x1a813d[_0x799a('0x24')]({'plain':!![]});return db[_0x799a('0x72')][_0x799a('0x48')]({'where':{'name':_0x799a('0x25'),'userProfileId':_0x22575d[_0x799a('0x6f')]},'raw':!![]})['then'](function(_0x594db8){if(_0x594db8&&_0x594db8[_0x799a('0x73')]===0x0){return db[_0x799a('0x74')]['create']({'name':_0x4f7324[_0x799a('0x28')],'resourceId':_0x4f7324['id'],'type':_0x594db8[_0x799a('0x28')],'sectionId':_0x594db8['id']},{})[_0x799a('0x22')](function(){return _0x1a813d;});}else{return _0x1a813d;}})[_0x799a('0x44')](function(_0x47fa5a){logger[_0x799a('0x27')](_0x799a('0x75'),_0x47fa5a);throw _0x47fa5a;});}return _0x1a813d;})['then'](respondWithResult(_0x25d7e2,null))['catch'](handleError(_0x25d7e2,null));});_0x1b2e4a[_0x799a('0x76')]();}catch(_0x4afaa6){_0x25d7e2[_0x799a('0x1d')](0x1f4)[_0x799a('0x29')](_0x4afaa6);}};exports[_0x799a('0x77')]=function(_0x5e58ee,_0x2aec2a,_0x252ca9){return db['Sound'][_0x799a('0x48')]({'where':{'id':_0x5e58ee[_0x799a('0x46')]['id']}})[_0x799a('0x22')](handleEntityNotFound(_0x2aec2a,null))['then'](saveUpdates(_[_0x799a('0x3a')](_0x5e58ee[_0x799a('0x6e')],[_0x799a('0x28'),_0x799a('0x78')]),null))[_0x799a('0x22')](respondWithResult(_0x2aec2a,null))[_0x799a('0x44')](handleError(_0x2aec2a,null));};exports[_0x799a('0x79')]=function(_0x5eca53,_0x33061d,_0x25e164){return db['Sound'][_0x799a('0x48')]({'where':{'id':_0x5eca53[_0x799a('0x46')]['id']}})[_0x799a('0x22')](function(_0x2e5a2a){if(_0x2e5a2a){return _0x2e5a2a[_0x799a('0x23')]();}})['then'](function(_0x108a30){var _0x2507cd=path[_0x799a('0x59')](config[_0x799a('0x4a')],_0x799a('0x58'),util[_0x799a('0x7a')](_0x799a('0x50'),_0x108a30['save_name'],_0x108a30[_0x799a('0x7b')]));var _0x4a97f2=path['join'](config[_0x799a('0x4a')],_0x799a('0x4f'),util[_0x799a('0x7a')](_0x799a('0x50'),_0x108a30[_0x799a('0x7c')],_0x108a30[_0x799a('0x4b')]));fs[_0x799a('0x5f')](_0x2507cd);fs[_0x799a('0x5f')](_0x4a97f2);return _0x108a30;})[_0x799a('0x22')](function(_0x4bea82){if(_0x4bea82){return _0x33061d['status'](0xcc)['end']();}})[_0x799a('0x22')](handleEntityNotFound(_0x33061d,null))[_0x799a('0x44')](handleError(_0x33061d,null));}; \ No newline at end of file +var _0x4fbb=['update','destroy','then','get','Sounds','UserProfileResource','end','stack','name','send','index','Sound','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','include','findAll','rows','catch','show','keys','rawAttributes','length','includeAll','options','download','find','params','save_name','converted_format','existsSync','server/files/sounds/converted','Sequelize','ValidationError','join','root','format','%s.%s','create','basename','originalname','file','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','start','description','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x238e37,_0x498228){var _0xa42004=function(_0x205447){while(--_0x205447){_0x238e37['push'](_0x238e37['shift']());}};_0xa42004(++_0x498228);}(_0x4fbb,0xdc));var _0xb4fb=function(_0x37ae2e,_0x35be3a){_0x37ae2e=_0x37ae2e-0x0;var _0x19c50f=_0x4fbb[_0x37ae2e];return _0x19c50f;};'use strict';var emlformat=require(_0xb4fb('0x0'));var rimraf=require(_0xb4fb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb4fb('0x2'));var rp=require(_0xb4fb('0x3'));var moment=require(_0xb4fb('0x4'));var BPromise=require(_0xb4fb('0x5'));var Mustache=require(_0xb4fb('0x6'));var util=require(_0xb4fb('0x7'));var path=require(_0xb4fb('0x8'));var sox=require(_0xb4fb('0x9'));var csv=require(_0xb4fb('0xa'));var ejs=require(_0xb4fb('0xb'));var fs=require('fs');var fs_extra=require(_0xb4fb('0xc'));var _=require(_0xb4fb('0xd'));var squel=require(_0xb4fb('0xe'));var crypto=require(_0xb4fb('0xf'));var jsforce=require(_0xb4fb('0x10'));var deskjs=require(_0xb4fb('0x11'));var toCsv=require(_0xb4fb('0xa'));var querystring=require('querystring');var Papa=require(_0xb4fb('0x12'));var Redis=require(_0xb4fb('0x13'));var authService=require(_0xb4fb('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb4fb('0x15'));var hardwareService=require(_0xb4fb('0x16'));var logger=require(_0xb4fb('0x17'))(_0xb4fb('0x18'));var utils=require(_0xb4fb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb4fb('0x1a'));var db=require(_0xb4fb('0x1b'))['db'];function respondWithStatusCode(_0x107b84,_0x414e57){_0x414e57=_0x414e57||0xcc;return function(_0x4ea455){if(_0x4ea455){return _0x107b84[_0xb4fb('0x1c')](_0x414e57);}return _0x107b84[_0xb4fb('0x1d')](_0x414e57)['end']();};}function respondWithResult(_0x40055f,_0x29f8a5){_0x29f8a5=_0x29f8a5||0xc8;return function(_0x430a72){if(_0x430a72){return _0x40055f[_0xb4fb('0x1d')](_0x29f8a5)[_0xb4fb('0x1e')](_0x430a72);}};}function respondWithFilteredResult(_0x4e515b,_0x3cdad1){return function(_0x2a214c){if(_0x2a214c){var _0x1475ce=typeof _0x3cdad1[_0xb4fb('0x1f')]===_0xb4fb('0x20')&&typeof _0x3cdad1[_0xb4fb('0x21')]==='undefined';var _0x5f44cc=_0x2a214c['count'];var _0x2447c9=_0x1475ce?0x0:_0x3cdad1[_0xb4fb('0x1f')];var _0x219269=_0x1475ce?_0x2a214c[_0xb4fb('0x22')]:_0x3cdad1[_0xb4fb('0x1f')]+_0x3cdad1['limit'];var _0x4a674c;if(_0x219269>=_0x5f44cc){_0x219269=_0x5f44cc;_0x4a674c=0xc8;}else{_0x4a674c=0xce;}_0x4e515b[_0xb4fb('0x1d')](_0x4a674c);return _0x4e515b[_0xb4fb('0x23')](_0xb4fb('0x24'),_0x2447c9+'-'+_0x219269+'/'+_0x5f44cc)[_0xb4fb('0x1e')](_0x2a214c);}return null;};}function patchUpdates(_0x44d328){return function(_0x29369c){try{jsonpatch[_0xb4fb('0x25')](_0x29369c,_0x44d328,!![]);}catch(_0x651f15){return BPromise[_0xb4fb('0x26')](_0x651f15);}return _0x29369c[_0xb4fb('0x27')]();};}function saveUpdates(_0x4ddac7,_0x431cea){return function(_0x3be287){if(_0x3be287){return _0x3be287[_0xb4fb('0x28')](_0x4ddac7)['then'](function(_0x5c6722){return _0x5c6722;});}return null;};}function removeEntity(_0x10607e,_0x55ee47){return function(_0x11398a){if(_0x11398a){return _0x11398a[_0xb4fb('0x29')]()[_0xb4fb('0x2a')](function(){var _0x2b9e1c=_0x11398a[_0xb4fb('0x2b')]({'plain':!![]});var _0x42c739=_0xb4fb('0x2c');return db[_0xb4fb('0x2d')][_0xb4fb('0x29')]({'where':{'type':_0x42c739,'resourceId':_0x2b9e1c['id']}})['then'](function(){return _0x11398a;});})[_0xb4fb('0x2a')](function(){_0x10607e[_0xb4fb('0x1d')](0xcc)[_0xb4fb('0x2e')]();});}};}function handleEntityNotFound(_0x400506,_0x1cf5ed){return function(_0x120e47){if(!_0x120e47){_0x400506[_0xb4fb('0x1c')](0x194);}return _0x120e47;};}function handleError(_0x85b56a,_0x30241f){_0x30241f=_0x30241f||0x1f4;return function(_0x2cda27){logger['error'](_0x2cda27[_0xb4fb('0x2f')]);if(_0x2cda27[_0xb4fb('0x30')]){delete _0x2cda27['name'];}_0x85b56a[_0xb4fb('0x1d')](_0x30241f)[_0xb4fb('0x31')](_0x2cda27);};}exports[_0xb4fb('0x32')]=function(_0x4597b9,_0x47518f){var _0x4c8106={},_0x24bd55={},_0x56a64f={'count':0x0,'rows':[]};var _0x10ff64=_['map'](db[_0xb4fb('0x33')]['rawAttributes'],function(_0x1f3cb8){return{'name':_0x1f3cb8[_0xb4fb('0x34')],'type':_0x1f3cb8[_0xb4fb('0x35')][_0xb4fb('0x36')]};});_0x24bd55['model']=_[_0xb4fb('0x37')](_0x10ff64,'name');_0x24bd55[_0xb4fb('0x38')]=_['keys'](_0x4597b9[_0xb4fb('0x38')]);_0x24bd55[_0xb4fb('0x39')]=_[_0xb4fb('0x3a')](_0x24bd55[_0xb4fb('0x3b')],_0x24bd55[_0xb4fb('0x38')]);_0x4c8106[_0xb4fb('0x3c')]=_[_0xb4fb('0x3a')](_0x24bd55[_0xb4fb('0x3b')],qs[_0xb4fb('0x3d')](_0x4597b9[_0xb4fb('0x38')][_0xb4fb('0x3d')]));_0x4c8106[_0xb4fb('0x3c')]=_0x4c8106[_0xb4fb('0x3c')]['length']?_0x4c8106[_0xb4fb('0x3c')]:_0x24bd55[_0xb4fb('0x3b')];if(!_0x4597b9[_0xb4fb('0x38')][_0xb4fb('0x3e')](_0xb4fb('0x3f'))){_0x4c8106[_0xb4fb('0x21')]=qs[_0xb4fb('0x21')](_0x4597b9['query']['limit']);_0x4c8106[_0xb4fb('0x1f')]=qs[_0xb4fb('0x1f')](_0x4597b9[_0xb4fb('0x38')]['offset']);}_0x4c8106['order']=qs['sort'](_0x4597b9[_0xb4fb('0x38')][_0xb4fb('0x40')]);_0x4c8106[_0xb4fb('0x41')]=qs[_0xb4fb('0x39')](_[_0xb4fb('0x42')](_0x4597b9[_0xb4fb('0x38')],_0x24bd55[_0xb4fb('0x39')]),_0x10ff64);if(_0x4597b9[_0xb4fb('0x38')]['filter']){_0x4c8106[_0xb4fb('0x41')]=_[_0xb4fb('0x43')](_0x4c8106[_0xb4fb('0x41')],{'$or':_['map'](_0x10ff64,function(_0x2b02f4){if(_0x2b02f4[_0xb4fb('0x35')]!==_0xb4fb('0x44')){var _0x236ee0={};_0x236ee0[_0x2b02f4[_0xb4fb('0x30')]]={'$like':'%'+_0x4597b9[_0xb4fb('0x38')]['filter']+'%'};return _0x236ee0;}})});}_0x4c8106=_[_0xb4fb('0x43')]({},_0x4c8106,_0x4597b9['options']);var _0x432345={'where':_0x4c8106['where']};return db[_0xb4fb('0x33')][_0xb4fb('0x22')](_0x432345)['then'](function(_0x2e1922){_0x56a64f[_0xb4fb('0x22')]=_0x2e1922;if(_0x4597b9[_0xb4fb('0x38')]['includeAll']){_0x4c8106[_0xb4fb('0x45')]=[{'all':!![]}];}return db[_0xb4fb('0x33')][_0xb4fb('0x46')](_0x4c8106);})[_0xb4fb('0x2a')](function(_0x465eff){_0x56a64f[_0xb4fb('0x47')]=_0x465eff;return _0x56a64f;})['then'](respondWithFilteredResult(_0x47518f,_0x4c8106))[_0xb4fb('0x48')](handleError(_0x47518f,null));};exports[_0xb4fb('0x49')]=function(_0x33453a,_0x968656){var _0x372f74={'raw':!![],'where':{'id':_0x33453a['params']['id']}},_0x5e1d57={};_0x5e1d57['model']=_[_0xb4fb('0x4a')](db[_0xb4fb('0x33')][_0xb4fb('0x4b')]);_0x5e1d57['query']=_[_0xb4fb('0x4a')](_0x33453a['query']);_0x5e1d57[_0xb4fb('0x39')]=_[_0xb4fb('0x3a')](_0x5e1d57[_0xb4fb('0x3b')],_0x5e1d57[_0xb4fb('0x38')]);_0x372f74[_0xb4fb('0x3c')]=_[_0xb4fb('0x3a')](_0x5e1d57[_0xb4fb('0x3b')],qs['fields'](_0x33453a[_0xb4fb('0x38')]['fields']));_0x372f74['attributes']=_0x372f74[_0xb4fb('0x3c')][_0xb4fb('0x4c')]?_0x372f74['attributes']:_0x5e1d57[_0xb4fb('0x3b')];if(_0x33453a[_0xb4fb('0x38')][_0xb4fb('0x4d')]){_0x372f74[_0xb4fb('0x45')]=[{'all':!![]}];}_0x372f74=_[_0xb4fb('0x43')]({},_0x372f74,_0x33453a[_0xb4fb('0x4e')]);return db[_0xb4fb('0x33')]['find'](_0x372f74)[_0xb4fb('0x2a')](handleEntityNotFound(_0x968656,null))[_0xb4fb('0x2a')](respondWithResult(_0x968656,null))[_0xb4fb('0x48')](handleError(_0x968656,null));};exports[_0xb4fb('0x4f')]=function(_0x3f69e6,_0x599894,_0x34ca88){return db[_0xb4fb('0x33')][_0xb4fb('0x50')]({'where':{'id':_0x3f69e6[_0xb4fb('0x51')]['id']},'attributes':[_0xb4fb('0x30'),_0xb4fb('0x52'),_0xb4fb('0x53')],'raw':!![]})[_0xb4fb('0x2a')](handleEntityNotFound(_0x599894,null))['then'](function(_0x4245ab){if(_0x4245ab){if(!fs[_0xb4fb('0x54')](path['join'](config['root'],_0xb4fb('0x55'),_0x4245ab['save_name']+'.'+_0x4245ab['converted_format']))){throw new db[(_0xb4fb('0x56'))][(_0xb4fb('0x57'))]('Sound\x20not\x20found');}return _0x599894[_0xb4fb('0x4f')](path[_0xb4fb('0x58')](config[_0xb4fb('0x59')],_0xb4fb('0x55'),util[_0xb4fb('0x5a')](_0xb4fb('0x5b'),_0x4245ab['save_name'],_0x4245ab[_0xb4fb('0x53')])),util[_0xb4fb('0x5a')](_0xb4fb('0x5b'),_0x4245ab['name'],_0x4245ab[_0xb4fb('0x53')]));}return null;})[_0xb4fb('0x48')](handleError(_0x599894,null));};exports[_0xb4fb('0x5c')]=function(_0x1c2eef,_0x4de2b1,_0x2b381f){var _0x3fc8b0={'name':path[_0xb4fb('0x5d')](_0x1c2eef['file'][_0xb4fb('0x5e')],path['extname'](_0x1c2eef[_0xb4fb('0x5f')]['originalname'])),'save_name':path[_0xb4fb('0x5d')](_0x1c2eef[_0xb4fb('0x5f')][_0xb4fb('0x60')],path[_0xb4fb('0x61')](_0x1c2eef['file']['filename'])),'original_format':path[_0xb4fb('0x61')](_0x1c2eef[_0xb4fb('0x5f')][_0xb4fb('0x5e')])[_0xb4fb('0x62')](0x1),'converted_format':_0xb4fb('0x63')};var _0x418848=path[_0xb4fb('0x58')](config[_0xb4fb('0x59')],_0xb4fb('0x64'),_0x1c2eef[_0xb4fb('0x5f')]['filename']);var _0x4d0ade=path[_0xb4fb('0x58')](config['root'],'server/files/sounds/converted',util['format'](_0xb4fb('0x5b'),path[_0xb4fb('0x5d')](_0x1c2eef[_0xb4fb('0x5f')][_0xb4fb('0x60')],path['extname'](_0x1c2eef[_0xb4fb('0x5f')][_0xb4fb('0x60')])),_0x3fc8b0['converted_format']));logger[_0xb4fb('0x65')]('Sound\x20upload\x20filepath:\x20%s',_0x418848);logger[_0xb4fb('0x65')](_0xb4fb('0x66'),_0x4d0ade);try{fs[_0xb4fb('0x67')](_0x418848,parseInt('0777',0x8));var _0x5757a4=sox[_0xb4fb('0x68')](_0x418848,_0x4d0ade,{'sampleRate':0x1f40,'format':_0xb4fb('0x63'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5757a4['on']('error',function(_0x1ca29b){fs[_0xb4fb('0x69')](_0x418848);_0x4de2b1[_0xb4fb('0x1d')](0x1f4)[_0xb4fb('0x31')](_0x1ca29b);});_0x5757a4['on'](_0xb4fb('0x6a'),function(_0x17ba29){_0x3fc8b0[_0xb4fb('0x6b')]=isNaN(_0x17ba29[_0xb4fb('0x6c')])?null:_0x17ba29[_0xb4fb('0x6c')]*0x3e8;_0x3fc8b0[_0xb4fb('0x6d')]=isNaN(_0x17ba29[_0xb4fb('0x6e')])?null:_0x17ba29['sampleCount'];_0x3fc8b0[_0xb4fb('0x6f')]=isNaN(_0x17ba29[_0xb4fb('0x70')])?null:_0x17ba29['channelCount'];_0x3fc8b0[_0xb4fb('0x71')]=isNaN(_0x17ba29[_0xb4fb('0x72')])?null:_0x17ba29[_0xb4fb('0x72')];_0x3fc8b0[_0xb4fb('0x73')]=isNaN(_0x17ba29[_0xb4fb('0x74')])?null:_0x17ba29[_0xb4fb('0x74')];});_0x5757a4['on']('dest',function(_0x1dc9a8){_0x3fc8b0[_0xb4fb('0x75')]=isNaN(_0x1dc9a8['duration'])?null:_0x1dc9a8[_0xb4fb('0x6c')]*0x3e8;_0x3fc8b0[_0xb4fb('0x76')]=isNaN(_0x1dc9a8['sampleCount'])?null:_0x1dc9a8['sampleCount'];_0x3fc8b0[_0xb4fb('0x77')]=isNaN(_0x1dc9a8[_0xb4fb('0x70')])?null:_0x1dc9a8[_0xb4fb('0x70')];_0x3fc8b0[_0xb4fb('0x78')]=isNaN(_0x1dc9a8['bitRate'])?null:_0x1dc9a8[_0xb4fb('0x72')];_0x3fc8b0[_0xb4fb('0x79')]=isNaN(_0x1dc9a8[_0xb4fb('0x74')])?null:_0x1dc9a8['sampleRate'];});_0x5757a4['on'](_0xb4fb('0x2e'),function(){fs['chmodSync'](_0x4d0ade,parseInt('0777',0x8));return db[_0xb4fb('0x33')]['create'](_0x3fc8b0)[_0xb4fb('0x2a')](function(_0x1db443){var _0x5ca0f3={'role':_0x1c2eef[_0xb4fb('0x7a')][_0xb4fb('0x7b')],'userProfileId':_0x1c2eef['body'][_0xb4fb('0x7c')]};if(!_0x5ca0f3)throw new Error(_0xb4fb('0x7d'));if(_0x5ca0f3['role']==='user'){var _0x923a58=_0x1db443[_0xb4fb('0x2b')]({'plain':!![]});return db[_0xb4fb('0x7e')][_0xb4fb('0x50')]({'where':{'name':'Sounds','userProfileId':_0x5ca0f3[_0xb4fb('0x7c')]},'raw':!![]})[_0xb4fb('0x2a')](function(_0x395a57){if(_0x395a57&&_0x395a57['autoAssociation']===0x0){return db[_0xb4fb('0x2d')][_0xb4fb('0x5c')]({'name':_0x923a58[_0xb4fb('0x30')],'resourceId':_0x923a58['id'],'type':_0x395a57[_0xb4fb('0x30')],'sectionId':_0x395a57['id']},{})[_0xb4fb('0x2a')](function(){return _0x1db443;});}else{return _0x1db443;}})[_0xb4fb('0x48')](function(_0xcd71e2){logger[_0xb4fb('0x7f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcd71e2);throw _0xcd71e2;});}return _0x1db443;})[_0xb4fb('0x2a')](respondWithResult(_0x4de2b1,null))[_0xb4fb('0x48')](handleError(_0x4de2b1,null));});_0x5757a4[_0xb4fb('0x80')]();}catch(_0x2a65e5){_0x4de2b1[_0xb4fb('0x1d')](0x1f4)[_0xb4fb('0x31')](_0x2a65e5);}};exports['update']=function(_0x35794d,_0x4f8f0d,_0x5cb2d2){return db[_0xb4fb('0x33')][_0xb4fb('0x50')]({'where':{'id':_0x35794d[_0xb4fb('0x51')]['id']}})['then'](handleEntityNotFound(_0x4f8f0d,null))[_0xb4fb('0x2a')](saveUpdates(_['pick'](_0x35794d['body'],[_0xb4fb('0x30'),_0xb4fb('0x81')]),null))[_0xb4fb('0x2a')](respondWithResult(_0x4f8f0d,null))[_0xb4fb('0x48')](handleError(_0x4f8f0d,null));};exports['delete']=function(_0x389572,_0x5a8388,_0x176f48){return db[_0xb4fb('0x33')][_0xb4fb('0x50')]({'where':{'id':_0x389572['params']['id']}})['then'](function(_0x1467e4){if(_0x1467e4){return _0x1467e4[_0xb4fb('0x29')]();}})[_0xb4fb('0x2a')](function(_0x487ec1){var _0x1935c7=path['join'](config[_0xb4fb('0x59')],_0xb4fb('0x64'),util[_0xb4fb('0x5a')](_0xb4fb('0x5b'),_0x487ec1['save_name'],_0x487ec1['original_format']));var _0x2b0976=path['join'](config[_0xb4fb('0x59')],_0xb4fb('0x55'),util['format'](_0xb4fb('0x5b'),_0x487ec1[_0xb4fb('0x52')],_0x487ec1[_0xb4fb('0x53')]));fs[_0xb4fb('0x69')](_0x1935c7);fs[_0xb4fb('0x69')](_0x2b0976);return _0x487ec1;})[_0xb4fb('0x2a')](function(_0x546100){if(_0x546100){return _0x5a8388['status'](0xcc)[_0xb4fb('0x2e')]();}})['then'](handleEntityNotFound(_0x5a8388,null))[_0xb4fb('0x48')](handleError(_0x5a8388,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 41dbc9e..7cb206b 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 _0xf967=['moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','lodash','util','api'];(function(_0x5c5931,_0x209e4a){var _0x2c6a5b=function(_0x55ab55){while(--_0x55ab55){_0x5c5931['push'](_0x5c5931['shift']());}};_0x2c6a5b(++_0x209e4a);}(_0xf967,0xd9));var _0x7f96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf967[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7f96('0x0'));var util=require(_0x7f96('0x1'));var logger=require('../../config/logger')(_0x7f96('0x2'));var moment=require(_0x7f96('0x3'));var BPromise=require(_0x7f96('0x4'));var rp=require(_0x7f96('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f96('0x6'));var config=require(_0x7f96('0x7'));var attributes=require(_0x7f96('0x8'));module[_0x7f96('0x9')]=function(_0x38f072,_0x52525c){return _0x38f072[_0x7f96('0xa')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b64=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','util'];(function(_0x1dbbdb,_0x390cd3){var _0x57cea2=function(_0x4229c1){while(--_0x4229c1){_0x1dbbdb['push'](_0x1dbbdb['shift']());}};_0x57cea2(++_0x390cd3);}(_0x6b64,0x1af));var _0x46b6=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0x6b64[_0x117f4c];return _0x2b24e9;};'use strict';var _=require('lodash');var util=require(_0x46b6('0x0'));var logger=require(_0x46b6('0x1'))(_0x46b6('0x2'));var moment=require(_0x46b6('0x3'));var BPromise=require('bluebird');var rp=require(_0x46b6('0x4'));var fs=require('fs');var path=require(_0x46b6('0x5'));var rimraf=require(_0x46b6('0x6'));var config=require(_0x46b6('0x7'));var attributes=require(_0x46b6('0x8'));module[_0x46b6('0x9')]=function(_0x226136,_0x45d594){return _0x226136[_0x46b6('0xa')](_0x46b6('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 015bea8..9a808c1 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 _0xd877=['info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','ShowSound','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x596981,_0x57742a){var _0x5ef6d0=function(_0x294ced){while(--_0x294ced){_0x596981['push'](_0x596981['shift']());}};_0x5ef6d0(++_0x57742a);}(_0xd877,0x13e));var _0x7d87=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xd877[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x7d87('0x0'));var util=require(_0x7d87('0x1'));var moment=require(_0x7d87('0x2'));var BPromise=require(_0x7d87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d87('0x4'));var db=require(_0x7d87('0x5'))['db'];var utils=require(_0x7d87('0x6'));var logger=require(_0x7d87('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7d87('0x8'));var client=jayson[_0x7d87('0x9')][_0x7d87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a76c0,_0x11d70e,_0xc9510d){return new BPromise(function(_0x131d8a,_0x232a93){return client[_0x7d87('0xb')](_0x4a76c0,_0xc9510d)['then'](function(_0x4232ca){logger[_0x7d87('0xc')](_0x7d87('0xd'),_0x11d70e,'request\x20sent');logger[_0x7d87('0xe')]('Sound,\x20%s,\x20%s,\x20%s',_0x11d70e,_0x7d87('0xf'),JSON[_0x7d87('0x10')](_0x4232ca));if(_0x4232ca['error']){if(_0x4232ca[_0x7d87('0x11')]['code']===0x1f4){logger['error'](_0x7d87('0xd'),_0x11d70e,_0x4232ca[_0x7d87('0x11')][_0x7d87('0x12')]);return _0x232a93(_0x4232ca[_0x7d87('0x11')][_0x7d87('0x12')]);}logger[_0x7d87('0x11')](_0x7d87('0xd'),_0x11d70e,_0x4232ca['error'][_0x7d87('0x12')]);return _0x131d8a(_0x4232ca['error'][_0x7d87('0x12')]);}else{logger['info'](_0x7d87('0xd'),_0x11d70e,'request\x20sent');_0x131d8a(_0x4232ca['result']['message']);}})[_0x7d87('0x13')](function(_0x165dad){logger['error'](_0x7d87('0xd'),_0x11d70e,_0x165dad);_0x232a93(_0x165dad);});});}exports[_0x7d87('0x14')]=function(_0x4ff148){var _0x588d4d=this;return new Promise(function(_0x2b0c72,_0x2d5549){return db['Sound'][_0x7d87('0x15')]({'raw':_0x4ff148[_0x7d87('0x16')]?_0x4ff148[_0x7d87('0x16')][_0x7d87('0x17')]===undefined?!![]:![]:!![],'where':_0x4ff148[_0x7d87('0x16')]?_0x4ff148[_0x7d87('0x16')][_0x7d87('0x18')]||null:null,'attributes':_0x4ff148['options']?_0x4ff148[_0x7d87('0x16')][_0x7d87('0x19')]||null:null,'include':_0x4ff148[_0x7d87('0x16')]?_0x4ff148[_0x7d87('0x16')][_0x7d87('0x1a')]?_[_0x7d87('0x1b')](_0x4ff148[_0x7d87('0x16')][_0x7d87('0x1a')],function(_0x33a9e1){return{'model':db[_0x33a9e1[_0x7d87('0x1c')]],'as':_0x33a9e1['as'],'attributes':_0x33a9e1[_0x7d87('0x19')],'include':_0x33a9e1[_0x7d87('0x1a')]?_[_0x7d87('0x1b')](_0x33a9e1[_0x7d87('0x1a')],function(_0xd182d5){return{'model':db[_0xd182d5['model']],'as':_0xd182d5['as'],'attributes':_0xd182d5[_0x7d87('0x19')],'include':_0xd182d5[_0x7d87('0x1a')]?_['map'](_0xd182d5[_0x7d87('0x1a')],function(_0x15917d){return{'model':db[_0x15917d[_0x7d87('0x1c')]],'as':_0x15917d['as'],'attributes':_0x15917d[_0x7d87('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7d87('0x1d')](function(_0x49b080){logger[_0x7d87('0xc')](_0x7d87('0x14'),_0x4ff148);logger[_0x7d87('0xe')]('ShowSound',_0x4ff148,JSON[_0x7d87('0x10')](_0x49b080));_0x2b0c72(_0x49b080);})['catch'](function(_0x40001d){logger[_0x7d87('0x11')]('ShowSound',_0x40001d[_0x7d87('0x12')],_0x4ff148);_0x2d5549(_0x588d4d[_0x7d87('0x11')](0x1f4,_0x40001d[_0x7d87('0x12')]));});});}; \ No newline at end of file +var _0x503f=['map','include','model','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSound','Sound','options','raw','attributes'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x503f,0xff));var _0xf503=function(_0x3f4d77,_0x4759a0){_0x3f4d77=_0x3f4d77-0x0;var _0x4073dc=_0x503f[_0x3f4d77];return _0x4073dc;};'use strict';var _=require('lodash');var util=require(_0xf503('0x0'));var moment=require('moment');var BPromise=require(_0xf503('0x1'));var rs=require(_0xf503('0x2'));var fs=require('fs');var Redis=require(_0xf503('0x3'));var db=require(_0xf503('0x4'))['db'];var utils=require(_0xf503('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf503('0x6'));var jayson=require(_0xf503('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x535dfb,_0x486701,_0x5e0415){return new BPromise(function(_0x5216f9,_0x4e954d){return client[_0xf503('0x8')](_0x535dfb,_0x5e0415)[_0xf503('0x9')](function(_0x3bd2cb){logger[_0xf503('0xa')](_0xf503('0xb'),_0x486701,_0xf503('0xc'));logger[_0xf503('0xd')](_0xf503('0xe'),_0x486701,_0xf503('0xc'),JSON[_0xf503('0xf')](_0x3bd2cb));if(_0x3bd2cb[_0xf503('0x10')]){if(_0x3bd2cb[_0xf503('0x10')]['code']===0x1f4){logger[_0xf503('0x10')](_0xf503('0xb'),_0x486701,_0x3bd2cb[_0xf503('0x10')][_0xf503('0x11')]);return _0x4e954d(_0x3bd2cb[_0xf503('0x10')]['message']);}logger['error'](_0xf503('0xb'),_0x486701,_0x3bd2cb[_0xf503('0x10')][_0xf503('0x11')]);return _0x5216f9(_0x3bd2cb[_0xf503('0x10')][_0xf503('0x11')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x486701,_0xf503('0xc'));_0x5216f9(_0x3bd2cb[_0xf503('0x12')]['message']);}})[_0xf503('0x13')](function(_0x5a7eca){logger[_0xf503('0x10')](_0xf503('0xb'),_0x486701,_0x5a7eca);_0x4e954d(_0x5a7eca);});});}exports[_0xf503('0x14')]=function(_0x3860fe){var _0x18dc38=this;return new Promise(function(_0x12c032,_0xe782ec){return db[_0xf503('0x15')]['find']({'raw':_0x3860fe[_0xf503('0x16')]?_0x3860fe[_0xf503('0x16')][_0xf503('0x17')]===undefined?!![]:![]:!![],'where':_0x3860fe[_0xf503('0x16')]?_0x3860fe[_0xf503('0x16')]['where']||null:null,'attributes':_0x3860fe[_0xf503('0x16')]?_0x3860fe['options'][_0xf503('0x18')]||null:null,'include':_0x3860fe[_0xf503('0x16')]?_0x3860fe[_0xf503('0x16')]['include']?_[_0xf503('0x19')](_0x3860fe[_0xf503('0x16')][_0xf503('0x1a')],function(_0x570a28){return{'model':db[_0x570a28[_0xf503('0x1b')]],'as':_0x570a28['as'],'attributes':_0x570a28['attributes'],'include':_0x570a28[_0xf503('0x1a')]?_[_0xf503('0x19')](_0x570a28['include'],function(_0x547bfa){return{'model':db[_0x547bfa[_0xf503('0x1b')]],'as':_0x547bfa['as'],'attributes':_0x547bfa[_0xf503('0x18')],'include':_0x547bfa[_0xf503('0x1a')]?_['map'](_0x547bfa[_0xf503('0x1a')],function(_0x159f71){return{'model':db[_0x159f71[_0xf503('0x1b')]],'as':_0x159f71['as'],'attributes':_0x159f71[_0xf503('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf503('0x9')](function(_0x5ad3b7){logger['info']('ShowSound',_0x3860fe);logger['debug'](_0xf503('0x14'),_0x3860fe,JSON[_0xf503('0xf')](_0x5ad3b7));_0x12c032(_0x5ad3b7);})['catch'](function(_0x4875ab){logger[_0xf503('0x10')](_0xf503('0x14'),_0x4875ab['message'],_0x3860fe);_0xe782ec(_0x18dc38[_0xf503('0x10')](0x1f4,_0x4875ab[_0xf503('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 4cb6edf..84eb43a 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 _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x22ab82,_0x2e11f4){var _0x4234bd=function(_0x525797){while(--_0x525797){_0x22ab82['push'](_0x22ab82['shift']());}};_0x4234bd(++_0x2e11f4);}(_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('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./squareMessage.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0x8603,0x190));var _0x3860=function(_0x454546,_0x144f1a){_0x454546=_0x454546-0x0;var _0x4bc707=_0x8603[_0x454546];return _0x4bc707;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 5f129e6..b4921ea 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 _0xf664=['TEXT','STRING','medium','out'];(function(_0x12609e,_0x4a34d1){var _0x3faa1a=function(_0x4ae9aa){while(--_0x4ae9aa){_0x12609e['push'](_0x12609e['shift']());}};_0x3faa1a(++_0x4a34d1);}(_0xf664,0x12d));var _0x4f66=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0xf664[_0x74892f];return _0x10ee61;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4f66('0x0')]},'body':{'type':Sequelize['TEXT'](_0x4f66('0x1')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4f66('0x2')),'defaultValue':_0x4f66('0x2'),'allowNull':![]},'providerName':{'type':Sequelize[_0x4f66('0x0')]},'providerResponse':{'type':Sequelize[_0x4f66('0x3')]}}; \ No newline at end of file +var _0x656e=['out','TEXT','sequelize','exports','STRING','ENUM'];(function(_0x59923b,_0x3b510c){var _0x2b786c=function(_0xc1e09c){while(--_0xc1e09c){_0x59923b['push'](_0x59923b['shift']());}};_0x2b786c(++_0x3b510c);}(_0x656e,0x194));var _0xe656=function(_0x560546,_0x25f996){_0x560546=_0x560546-0x0;var _0x5318d8=_0x656e[_0x560546];return _0x5318d8;};'use strict';var Sequelize=require(_0xe656('0x0'));module[_0xe656('0x1')]={'uniqueid':{'type':Sequelize[_0xe656('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xe656('0x3')]('in',_0xe656('0x4')),'defaultValue':_0xe656('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe656('0x2')]},'providerResponse':{'type':Sequelize[_0xe656('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 5948cc8..3973d1a 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 _0x1fed=['stack','index','SquareMessage','fieldName','type','key','model','map','name','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','rawAttributes','length','create','body','catch','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1fed,0x1d3));var _0xd1fe=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0x1fed[_0x1347f8];return _0x218368;};'use strict';var emlformat=require(_0xd1fe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1fe('0x1'));var jsonpatch=require(_0xd1fe('0x2'));var rp=require(_0xd1fe('0x3'));var moment=require(_0xd1fe('0x4'));var BPromise=require(_0xd1fe('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1fe('0x6'));var sox=require('sox');var csv=require(_0xd1fe('0x7'));var ejs=require(_0xd1fe('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd1fe('0x9'));var deskjs=require(_0xd1fe('0xa'));var toCsv=require(_0xd1fe('0x7'));var querystring=require(_0xd1fe('0xb'));var Papa=require(_0xd1fe('0xc'));var Redis=require('ioredis');var authService=require(_0xd1fe('0xd'));var qs=require(_0xd1fe('0xe'));var as=require(_0xd1fe('0xf'));var hardwareService=require(_0xd1fe('0x10'));var logger=require(_0xd1fe('0x11'))('api');var utils=require(_0xd1fe('0x12'));var config=require(_0xd1fe('0x13'));var licenseUtil=require(_0xd1fe('0x14'));var db=require(_0xd1fe('0x15'))['db'];function respondWithStatusCode(_0x2225bb,_0x50a4de){_0x50a4de=_0x50a4de||0xcc;return function(_0x380a81){if(_0x380a81){return _0x2225bb[_0xd1fe('0x16')](_0x50a4de);}return _0x2225bb['status'](_0x50a4de)[_0xd1fe('0x17')]();};}function respondWithResult(_0x597075,_0x7b3411){_0x7b3411=_0x7b3411||0xc8;return function(_0x2f0796){if(_0x2f0796){return _0x597075[_0xd1fe('0x18')](_0x7b3411)[_0xd1fe('0x19')](_0x2f0796);}};}function respondWithFilteredResult(_0x1d14d3,_0x5c08a2){return function(_0x402b55){if(_0x402b55){var _0x3036cc=typeof _0x5c08a2['offset']==='undefined'&&typeof _0x5c08a2[_0xd1fe('0x1a')]==='undefined';var _0x2f44a1=_0x402b55[_0xd1fe('0x1b')];var _0x22ae0b=_0x3036cc?0x0:_0x5c08a2[_0xd1fe('0x1c')];var _0x1155bb=_0x3036cc?_0x402b55[_0xd1fe('0x1b')]:_0x5c08a2[_0xd1fe('0x1c')]+_0x5c08a2[_0xd1fe('0x1a')];var _0x5ce356;if(_0x1155bb>=_0x2f44a1){_0x1155bb=_0x2f44a1;_0x5ce356=0xc8;}else{_0x5ce356=0xce;}_0x1d14d3['status'](_0x5ce356);return _0x1d14d3['set'](_0xd1fe('0x1d'),_0x22ae0b+'-'+_0x1155bb+'/'+_0x2f44a1)[_0xd1fe('0x19')](_0x402b55);}return null;};}function patchUpdates(_0x108ef3){return function(_0xb69c7f){try{jsonpatch[_0xd1fe('0x1e')](_0xb69c7f,_0x108ef3,!![]);}catch(_0x415352){return BPromise[_0xd1fe('0x1f')](_0x415352);}return _0xb69c7f[_0xd1fe('0x20')]();};}function saveUpdates(_0x18d109,_0x34ebab){return function(_0x4ac933){if(_0x4ac933){return _0x4ac933[_0xd1fe('0x21')](_0x18d109)['then'](function(_0x5cd548){return _0x5cd548;});}return null;};}function removeEntity(_0x6caff0,_0x1c5e78){return function(_0x109c4d){if(_0x109c4d){return _0x109c4d[_0xd1fe('0x22')]()[_0xd1fe('0x23')](function(){_0x6caff0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb57e72,_0xe77dfa){return function(_0x4a2c8f){if(!_0x4a2c8f){_0xb57e72[_0xd1fe('0x16')](0x194);}return _0x4a2c8f;};}function handleError(_0x364413,_0x3a0610){_0x3a0610=_0x3a0610||0x1f4;return function(_0x5c5782){logger[_0xd1fe('0x24')](_0x5c5782[_0xd1fe('0x25')]);if(_0x5c5782['name']){delete _0x5c5782['name'];}_0x364413['status'](_0x3a0610)['send'](_0x5c5782);};}exports[_0xd1fe('0x26')]=function(_0x55138d,_0x2858ea){var _0x56510c={},_0x4f366d={},_0x577a30={'count':0x0,'rows':[]};var _0x890b58=_['map'](db[_0xd1fe('0x27')]['rawAttributes'],function(_0x30460c){return{'name':_0x30460c[_0xd1fe('0x28')],'type':_0x30460c[_0xd1fe('0x29')][_0xd1fe('0x2a')]};});_0x4f366d[_0xd1fe('0x2b')]=_[_0xd1fe('0x2c')](_0x890b58,_0xd1fe('0x2d'));_0x4f366d[_0xd1fe('0x2e')]=_['keys'](_0x55138d[_0xd1fe('0x2e')]);_0x4f366d[_0xd1fe('0x2f')]=_[_0xd1fe('0x30')](_0x4f366d[_0xd1fe('0x2b')],_0x4f366d[_0xd1fe('0x2e')]);_0x56510c['attributes']=_['intersection'](_0x4f366d[_0xd1fe('0x2b')],qs[_0xd1fe('0x31')](_0x55138d[_0xd1fe('0x2e')]['fields']));_0x56510c[_0xd1fe('0x32')]=_0x56510c['attributes']['length']?_0x56510c[_0xd1fe('0x32')]:_0x4f366d[_0xd1fe('0x2b')];if(!_0x55138d['query']['hasOwnProperty'](_0xd1fe('0x33'))){_0x56510c['limit']=qs['limit'](_0x55138d['query'][_0xd1fe('0x1a')]);_0x56510c[_0xd1fe('0x1c')]=qs[_0xd1fe('0x1c')](_0x55138d['query'][_0xd1fe('0x1c')]);}_0x56510c[_0xd1fe('0x34')]=qs[_0xd1fe('0x35')](_0x55138d[_0xd1fe('0x2e')][_0xd1fe('0x35')]);_0x56510c[_0xd1fe('0x36')]=qs['filters'](_[_0xd1fe('0x37')](_0x55138d[_0xd1fe('0x2e')],_0x4f366d['filters']),_0x890b58);if(_0x55138d['query'][_0xd1fe('0x38')]){_0x56510c[_0xd1fe('0x36')]=_[_0xd1fe('0x39')](_0x56510c[_0xd1fe('0x36')],{'$or':_[_0xd1fe('0x2c')](_0x890b58,function(_0x394858){if(_0x394858[_0xd1fe('0x29')]!==_0xd1fe('0x3a')){var _0x3b7e73={};_0x3b7e73[_0x394858[_0xd1fe('0x2d')]]={'$like':'%'+_0x55138d[_0xd1fe('0x2e')][_0xd1fe('0x38')]+'%'};return _0x3b7e73;}})});}_0x56510c=_['merge']({},_0x56510c,_0x55138d[_0xd1fe('0x3b')]);var _0x1c7cca={'where':_0x56510c[_0xd1fe('0x36')]};return db['SquareMessage'][_0xd1fe('0x1b')](_0x1c7cca)[_0xd1fe('0x23')](function(_0x5c8466){_0x577a30[_0xd1fe('0x1b')]=_0x5c8466;if(_0x55138d[_0xd1fe('0x2e')][_0xd1fe('0x3c')]){_0x56510c[_0xd1fe('0x3d')]=[{'all':!![]}];}return db[_0xd1fe('0x27')][_0xd1fe('0x3e')](_0x56510c);})[_0xd1fe('0x23')](function(_0x24021e){_0x577a30['rows']=_0x24021e;return _0x577a30;})[_0xd1fe('0x23')](respondWithFilteredResult(_0x2858ea,_0x56510c))['catch'](handleError(_0x2858ea,null));};exports[_0xd1fe('0x3f')]=function(_0x24cc00,_0x358414){var _0x2dbf99={'raw':!![],'where':{'id':_0x24cc00[_0xd1fe('0x40')]['id']}},_0x31e97a={};_0x31e97a['model']=_[_0xd1fe('0x41')](db[_0xd1fe('0x27')][_0xd1fe('0x42')]);_0x31e97a[_0xd1fe('0x2e')]=_[_0xd1fe('0x41')](_0x24cc00[_0xd1fe('0x2e')]);_0x31e97a[_0xd1fe('0x2f')]=_[_0xd1fe('0x30')](_0x31e97a[_0xd1fe('0x2b')],_0x31e97a[_0xd1fe('0x2e')]);_0x2dbf99[_0xd1fe('0x32')]=_[_0xd1fe('0x30')](_0x31e97a['model'],qs[_0xd1fe('0x31')](_0x24cc00[_0xd1fe('0x2e')]['fields']));_0x2dbf99[_0xd1fe('0x32')]=_0x2dbf99['attributes'][_0xd1fe('0x43')]?_0x2dbf99[_0xd1fe('0x32')]:_0x31e97a['model'];if(_0x24cc00['query']['includeAll']){_0x2dbf99[_0xd1fe('0x3d')]=[{'all':!![]}];}_0x2dbf99=_[_0xd1fe('0x39')]({},_0x2dbf99,_0x24cc00[_0xd1fe('0x3b')]);return db['SquareMessage']['find'](_0x2dbf99)['then'](handleEntityNotFound(_0x358414,null))[_0xd1fe('0x23')](respondWithResult(_0x358414,null))['catch'](handleError(_0x358414,null));};exports[_0xd1fe('0x44')]=function(_0x481378,_0xe86918){return db[_0xd1fe('0x27')][_0xd1fe('0x44')](_0x481378[_0xd1fe('0x45')],{})[_0xd1fe('0x23')](respondWithResult(_0xe86918,0xc9))[_0xd1fe('0x46')](handleError(_0xe86918,null));};exports['update']=function(_0x29a45,_0x5dee55){if(_0x29a45[_0xd1fe('0x45')]['id']){delete _0x29a45['body']['id'];}return db[_0xd1fe('0x27')][_0xd1fe('0x47')]({'where':{'id':_0x29a45[_0xd1fe('0x40')]['id']}})[_0xd1fe('0x23')](handleEntityNotFound(_0x5dee55,null))[_0xd1fe('0x23')](saveUpdates(_0x29a45['body'],null))[_0xd1fe('0x23')](respondWithResult(_0x5dee55,null))[_0xd1fe('0x46')](handleError(_0x5dee55,null));};exports[_0xd1fe('0x22')]=function(_0xadc85,_0x31f64b){return db['SquareMessage'][_0xd1fe('0x47')]({'where':{'id':_0xadc85['params']['id']}})['then'](handleEntityNotFound(_0x31f64b,null))[_0xd1fe('0x23')](removeEntity(_0x31f64b,null))[_0xd1fe('0x46')](handleError(_0x31f64b,null));}; \ No newline at end of file +var _0x3f72=['stack','name','index','map','SquareMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','length','create','body','find','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','update','then','error'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x3f72,0xaf));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x23f7('0x0'));var rimraf=require(_0x23f7('0x1'));var zipdir=require(_0x23f7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x23f7('0x3'));var BPromise=require(_0x23f7('0x4'));var Mustache=require(_0x23f7('0x5'));var util=require(_0x23f7('0x6'));var path=require(_0x23f7('0x7'));var sox=require('sox');var csv=require(_0x23f7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x23f7('0x9'));var _=require('lodash');var squel=require(_0x23f7('0xa'));var crypto=require(_0x23f7('0xb'));var jsforce=require(_0x23f7('0xc'));var deskjs=require(_0x23f7('0xd'));var toCsv=require(_0x23f7('0x8'));var querystring=require(_0x23f7('0xe'));var Papa=require(_0x23f7('0xf'));var Redis=require(_0x23f7('0x10'));var authService=require(_0x23f7('0x11'));var qs=require(_0x23f7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23f7('0x13'));var logger=require(_0x23f7('0x14'))(_0x23f7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x23f7('0x16'));var db=require(_0x23f7('0x17'))['db'];function respondWithStatusCode(_0x35c62e,_0x304748){_0x304748=_0x304748||0xcc;return function(_0x37510b){if(_0x37510b){return _0x35c62e['sendStatus'](_0x304748);}return _0x35c62e[_0x23f7('0x18')](_0x304748)[_0x23f7('0x19')]();};}function respondWithResult(_0x2dc34c,_0x39ac2d){_0x39ac2d=_0x39ac2d||0xc8;return function(_0x594887){if(_0x594887){return _0x2dc34c[_0x23f7('0x18')](_0x39ac2d)[_0x23f7('0x1a')](_0x594887);}};}function respondWithFilteredResult(_0x1c88ce,_0x2fab15){return function(_0x15a35d){if(_0x15a35d){var _0x436512=typeof _0x2fab15[_0x23f7('0x1b')]==='undefined'&&typeof _0x2fab15[_0x23f7('0x1c')]===_0x23f7('0x1d');var _0x4e125c=_0x15a35d['count'];var _0x10d8d2=_0x436512?0x0:_0x2fab15[_0x23f7('0x1b')];var _0x2f8f6a=_0x436512?_0x15a35d[_0x23f7('0x1e')]:_0x2fab15[_0x23f7('0x1b')]+_0x2fab15[_0x23f7('0x1c')];var _0x3748bb;if(_0x2f8f6a>=_0x4e125c){_0x2f8f6a=_0x4e125c;_0x3748bb=0xc8;}else{_0x3748bb=0xce;}_0x1c88ce[_0x23f7('0x18')](_0x3748bb);return _0x1c88ce['set'](_0x23f7('0x1f'),_0x10d8d2+'-'+_0x2f8f6a+'/'+_0x4e125c)[_0x23f7('0x1a')](_0x15a35d);}return null;};}function patchUpdates(_0x1811bf){return function(_0x5e8b7f){try{jsonpatch['apply'](_0x5e8b7f,_0x1811bf,!![]);}catch(_0xfc8726){return BPromise['reject'](_0xfc8726);}return _0x5e8b7f['save']();};}function saveUpdates(_0x1f82d4,_0x34a5e4){return function(_0x5441e2){if(_0x5441e2){return _0x5441e2[_0x23f7('0x20')](_0x1f82d4)[_0x23f7('0x21')](function(_0x59260b){return _0x59260b;});}return null;};}function removeEntity(_0x2333ca,_0x373421){return function(_0x3ebc73){if(_0x3ebc73){return _0x3ebc73['destroy']()['then'](function(){_0x2333ca[_0x23f7('0x18')](0xcc)[_0x23f7('0x19')]();});}};}function handleEntityNotFound(_0x3dad05,_0x4861de){return function(_0x26bdf6){if(!_0x26bdf6){_0x3dad05['sendStatus'](0x194);}return _0x26bdf6;};}function handleError(_0x23dd01,_0x1cc5e4){_0x1cc5e4=_0x1cc5e4||0x1f4;return function(_0x57d6e6){logger[_0x23f7('0x22')](_0x57d6e6[_0x23f7('0x23')]);if(_0x57d6e6[_0x23f7('0x24')]){delete _0x57d6e6[_0x23f7('0x24')];}_0x23dd01[_0x23f7('0x18')](_0x1cc5e4)['send'](_0x57d6e6);};}exports[_0x23f7('0x25')]=function(_0x2422d2,_0x310fa8){var _0x45513e={},_0x4165ed={},_0x3669fc={'count':0x0,'rows':[]};var _0x77d50f=_[_0x23f7('0x26')](db[_0x23f7('0x27')][_0x23f7('0x28')],function(_0xf0da88){return{'name':_0xf0da88[_0x23f7('0x29')],'type':_0xf0da88['type'][_0x23f7('0x2a')]};});_0x4165ed[_0x23f7('0x2b')]=_[_0x23f7('0x26')](_0x77d50f,'name');_0x4165ed[_0x23f7('0x2c')]=_[_0x23f7('0x2d')](_0x2422d2[_0x23f7('0x2c')]);_0x4165ed[_0x23f7('0x2e')]=_[_0x23f7('0x2f')](_0x4165ed[_0x23f7('0x2b')],_0x4165ed['query']);_0x45513e[_0x23f7('0x30')]=_[_0x23f7('0x2f')](_0x4165ed[_0x23f7('0x2b')],qs[_0x23f7('0x31')](_0x2422d2[_0x23f7('0x2c')][_0x23f7('0x31')]));_0x45513e[_0x23f7('0x30')]=_0x45513e[_0x23f7('0x30')]['length']?_0x45513e[_0x23f7('0x30')]:_0x4165ed[_0x23f7('0x2b')];if(!_0x2422d2[_0x23f7('0x2c')][_0x23f7('0x32')]('nolimit')){_0x45513e['limit']=qs[_0x23f7('0x1c')](_0x2422d2['query'][_0x23f7('0x1c')]);_0x45513e[_0x23f7('0x1b')]=qs[_0x23f7('0x1b')](_0x2422d2[_0x23f7('0x2c')]['offset']);}_0x45513e['order']=qs[_0x23f7('0x33')](_0x2422d2['query']['sort']);_0x45513e[_0x23f7('0x34')]=qs[_0x23f7('0x2e')](_[_0x23f7('0x35')](_0x2422d2[_0x23f7('0x2c')],_0x4165ed[_0x23f7('0x2e')]),_0x77d50f);if(_0x2422d2[_0x23f7('0x2c')][_0x23f7('0x36')]){_0x45513e[_0x23f7('0x34')]=_['merge'](_0x45513e[_0x23f7('0x34')],{'$or':_[_0x23f7('0x26')](_0x77d50f,function(_0x42a3c5){if(_0x42a3c5[_0x23f7('0x37')]!==_0x23f7('0x38')){var _0x8db080={};_0x8db080[_0x42a3c5['name']]={'$like':'%'+_0x2422d2['query'][_0x23f7('0x36')]+'%'};return _0x8db080;}})});}_0x45513e=_[_0x23f7('0x39')]({},_0x45513e,_0x2422d2[_0x23f7('0x3a')]);var _0x37cd61={'where':_0x45513e[_0x23f7('0x34')]};return db[_0x23f7('0x27')]['count'](_0x37cd61)[_0x23f7('0x21')](function(_0x1d852d){_0x3669fc[_0x23f7('0x1e')]=_0x1d852d;if(_0x2422d2[_0x23f7('0x2c')][_0x23f7('0x3b')]){_0x45513e[_0x23f7('0x3c')]=[{'all':!![]}];}return db[_0x23f7('0x27')][_0x23f7('0x3d')](_0x45513e);})['then'](function(_0x5e2b2d){_0x3669fc['rows']=_0x5e2b2d;return _0x3669fc;})[_0x23f7('0x21')](respondWithFilteredResult(_0x310fa8,_0x45513e))[_0x23f7('0x3e')](handleError(_0x310fa8,null));};exports[_0x23f7('0x3f')]=function(_0x36ce93,_0x272bac){var _0x25aaf6={'raw':!![],'where':{'id':_0x36ce93['params']['id']}},_0x4092b3={};_0x4092b3[_0x23f7('0x2b')]=_[_0x23f7('0x2d')](db[_0x23f7('0x27')][_0x23f7('0x28')]);_0x4092b3[_0x23f7('0x2c')]=_[_0x23f7('0x2d')](_0x36ce93['query']);_0x4092b3[_0x23f7('0x2e')]=_[_0x23f7('0x2f')](_0x4092b3['model'],_0x4092b3[_0x23f7('0x2c')]);_0x25aaf6[_0x23f7('0x30')]=_[_0x23f7('0x2f')](_0x4092b3[_0x23f7('0x2b')],qs['fields'](_0x36ce93[_0x23f7('0x2c')][_0x23f7('0x31')]));_0x25aaf6[_0x23f7('0x30')]=_0x25aaf6[_0x23f7('0x30')][_0x23f7('0x40')]?_0x25aaf6['attributes']:_0x4092b3[_0x23f7('0x2b')];if(_0x36ce93[_0x23f7('0x2c')][_0x23f7('0x3b')]){_0x25aaf6[_0x23f7('0x3c')]=[{'all':!![]}];}_0x25aaf6=_['merge']({},_0x25aaf6,_0x36ce93[_0x23f7('0x3a')]);return db[_0x23f7('0x27')]['find'](_0x25aaf6)[_0x23f7('0x21')](handleEntityNotFound(_0x272bac,null))['then'](respondWithResult(_0x272bac,null))[_0x23f7('0x3e')](handleError(_0x272bac,null));};exports['create']=function(_0x439d18,_0x5553e8){return db[_0x23f7('0x27')][_0x23f7('0x41')](_0x439d18[_0x23f7('0x42')],{})[_0x23f7('0x21')](respondWithResult(_0x5553e8,0xc9))[_0x23f7('0x3e')](handleError(_0x5553e8,null));};exports['update']=function(_0x3066f9,_0x3cc29c){if(_0x3066f9[_0x23f7('0x42')]['id']){delete _0x3066f9['body']['id'];}return db[_0x23f7('0x27')][_0x23f7('0x43')]({'where':{'id':_0x3066f9[_0x23f7('0x44')]['id']}})[_0x23f7('0x21')](handleEntityNotFound(_0x3cc29c,null))[_0x23f7('0x21')](saveUpdates(_0x3066f9[_0x23f7('0x42')],null))[_0x23f7('0x21')](respondWithResult(_0x3cc29c,null))['catch'](handleError(_0x3cc29c,null));};exports[_0x23f7('0x45')]=function(_0x1a5a4f,_0x226810){return db['SquareMessage'][_0x23f7('0x43')]({'where':{'id':_0x1a5a4f[_0x23f7('0x44')]['id']}})[_0x23f7('0x21')](handleEntityNotFound(_0x226810,null))[_0x23f7('0x21')](removeEntity(_0x226810,null))[_0x23f7('0x3e')](handleError(_0x226810,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f02572d..cd86377 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 _0xc4f0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xc4f0,0x1b1));var _0x0c4f=function(_0x4c2d9b,_0x21f0de){_0x4c2d9b=_0x4c2d9b-0x0;var _0x11346b=_0xc4f0[_0x4c2d9b];return _0x11346b;};'use strict';var _=require(_0x0c4f('0x0'));var util=require(_0x0c4f('0x1'));var logger=require(_0x0c4f('0x2'))(_0x0c4f('0x3'));var moment=require(_0x0c4f('0x4'));var BPromise=require(_0x0c4f('0x5'));var rp=require(_0x0c4f('0x6'));var fs=require('fs');var path=require(_0x0c4f('0x7'));var rimraf=require(_0x0c4f('0x8'));var config=require(_0x0c4f('0x9'));var attributes=require(_0x0c4f('0xa'));module[_0x0c4f('0xb')]=function(_0x937d74,_0xf38974){return _0x937d74[_0x0c4f('0xc')](_0x0c4f('0xd'),attributes,{'tableName':_0x0c4f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc289=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','../../config/logger'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0xc289,0x7c));var _0x9c28=function(_0x4dab69,_0x5b51d1){_0x4dab69=_0x4dab69-0x0;var _0xfdaa9c=_0xc289[_0x4dab69];return _0xfdaa9c;};'use strict';var _=require(_0x9c28('0x0'));var util=require('util');var logger=require(_0x9c28('0x1'))(_0x9c28('0x2'));var moment=require(_0x9c28('0x3'));var BPromise=require(_0x9c28('0x4'));var rp=require(_0x9c28('0x5'));var fs=require('fs');var path=require(_0x9c28('0x6'));var rimraf=require(_0x9c28('0x7'));var config=require(_0x9c28('0x8'));var attributes=require(_0x9c28('0x9'));module[_0x9c28('0xa')]=function(_0x55faca,_0xf051c){return _0x55faca[_0x9c28('0xb')](_0x9c28('0xc'),attributes,{'tableName':_0x9c28('0xd'),'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 79d899a..e3bcad6 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 _0x6ebe=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','error','code','message','result','catch','SquareMessage,\x20%s,\x20%s','SquareMessage','create','options','then','CreateSquareMessage','stringify','lodash','util'];(function(_0x1ee293,_0x465cda){var _0x161342=function(_0xf08e2f){while(--_0xf08e2f){_0x1ee293['push'](_0x1ee293['shift']());}};_0x161342(++_0x465cda);}(_0x6ebe,0x1ec));var _0xe6eb=function(_0x4df62f,_0x25445b){_0x4df62f=_0x4df62f-0x0;var _0x316c7c=_0x6ebe[_0x4df62f];return _0x316c7c;};'use strict';var _=require(_0xe6eb('0x0'));var util=require(_0xe6eb('0x1'));var moment=require(_0xe6eb('0x2'));var BPromise=require(_0xe6eb('0x3'));var rs=require(_0xe6eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe6eb('0x5'));var logger=require(_0xe6eb('0x6'))(_0xe6eb('0x7'));var config=require('../../config/environment');var jayson=require(_0xe6eb('0x8'));var client=jayson[_0xe6eb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52c5d6,_0x441277,_0x2dd869){return new BPromise(function(_0x3adeaf,_0x309662){return client[_0xe6eb('0xa')](_0x52c5d6,_0x2dd869)['then'](function(_0x16eb81){logger[_0xe6eb('0xb')]('SquareMessage,\x20%s,\x20%s',_0x441277,_0xe6eb('0xc'));logger[_0xe6eb('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x441277,_0xe6eb('0xc'),JSON['stringify'](_0x16eb81));if(_0x16eb81[_0xe6eb('0xe')]){if(_0x16eb81['error'][_0xe6eb('0xf')]===0x1f4){logger[_0xe6eb('0xe')]('SquareMessage,\x20%s,\x20%s',_0x441277,_0x16eb81[_0xe6eb('0xe')][_0xe6eb('0x10')]);return _0x309662(_0x16eb81[_0xe6eb('0xe')][_0xe6eb('0x10')]);}logger[_0xe6eb('0xe')]('SquareMessage,\x20%s,\x20%s',_0x441277,_0x16eb81[_0xe6eb('0xe')][_0xe6eb('0x10')]);return _0x3adeaf(_0x16eb81[_0xe6eb('0xe')][_0xe6eb('0x10')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x441277,'request\x20sent');_0x3adeaf(_0x16eb81[_0xe6eb('0x11')]['message']);}})[_0xe6eb('0x12')](function(_0x125cfe){logger[_0xe6eb('0xe')](_0xe6eb('0x13'),_0x441277,_0x125cfe);_0x309662(_0x125cfe);});});}exports['CreateSquareMessage']=function(_0x187abf){var _0x26d1e0=this;return new Promise(function(_0x233b04,_0x1745b8){return db[_0xe6eb('0x14')][_0xe6eb('0x15')](_0x187abf['body'],{'raw':_0x187abf[_0xe6eb('0x16')]?_0x187abf[_0xe6eb('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xe6eb('0x17')](function(_0x4a67b2){logger[_0xe6eb('0xb')](_0xe6eb('0x18'),_0x187abf);logger[_0xe6eb('0xd')](_0xe6eb('0x18'),_0x187abf,JSON[_0xe6eb('0x19')](_0x4a67b2));_0x233b04(_0x4a67b2);})[_0xe6eb('0x12')](function(_0x40db22){logger['error'](_0xe6eb('0x18'),_0x40db22[_0xe6eb('0x10')],_0x187abf);_0x1745b8(_0x26d1e0[_0xe6eb('0xe')](0x1f4,_0x40db22[_0xe6eb('0x10')]));});});}; \ No newline at end of file +var _0xbcd6=['SquareMessage','create','body','options','raw','stringify','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSquareMessage'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0xbcd6,0x1c0));var _0x6bcd=function(_0x27c194,_0xedf3fa){_0x27c194=_0x27c194-0x0;var _0x451015=_0xbcd6[_0x27c194];return _0x451015;};'use strict';var _=require(_0x6bcd('0x0'));var util=require('util');var moment=require(_0x6bcd('0x1'));var BPromise=require('bluebird');var rs=require(_0x6bcd('0x2'));var fs=require('fs');var Redis=require(_0x6bcd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6bcd('0x4'));var logger=require(_0x6bcd('0x5'))(_0x6bcd('0x6'));var config=require(_0x6bcd('0x7'));var jayson=require(_0x6bcd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23c362,_0x4429ec,_0x167fc5){return new BPromise(function(_0x10fd58,_0x5dfb9c){return client['request'](_0x23c362,_0x167fc5)[_0x6bcd('0x9')](function(_0x5ee5ee){logger[_0x6bcd('0xa')](_0x6bcd('0xb'),_0x4429ec,_0x6bcd('0xc'));logger[_0x6bcd('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4429ec,_0x6bcd('0xc'),JSON['stringify'](_0x5ee5ee));if(_0x5ee5ee[_0x6bcd('0xe')]){if(_0x5ee5ee[_0x6bcd('0xe')][_0x6bcd('0xf')]===0x1f4){logger[_0x6bcd('0xe')](_0x6bcd('0xb'),_0x4429ec,_0x5ee5ee[_0x6bcd('0xe')][_0x6bcd('0x10')]);return _0x5dfb9c(_0x5ee5ee[_0x6bcd('0xe')][_0x6bcd('0x10')]);}logger[_0x6bcd('0xe')](_0x6bcd('0xb'),_0x4429ec,_0x5ee5ee['error'][_0x6bcd('0x10')]);return _0x10fd58(_0x5ee5ee[_0x6bcd('0xe')][_0x6bcd('0x10')]);}else{logger[_0x6bcd('0xa')](_0x6bcd('0xb'),_0x4429ec,'request\x20sent');_0x10fd58(_0x5ee5ee[_0x6bcd('0x11')]['message']);}})[_0x6bcd('0x12')](function(_0x3c3d50){logger[_0x6bcd('0xe')](_0x6bcd('0xb'),_0x4429ec,_0x3c3d50);_0x5dfb9c(_0x3c3d50);});});}exports[_0x6bcd('0x13')]=function(_0x144cca){var _0x59301c=this;return new Promise(function(_0x5a5ee6,_0x4e645c){return db[_0x6bcd('0x14')][_0x6bcd('0x15')](_0x144cca[_0x6bcd('0x16')],{'raw':_0x144cca['options']?_0x144cca[_0x6bcd('0x17')][_0x6bcd('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3a5481){logger[_0x6bcd('0xa')](_0x6bcd('0x13'),_0x144cca);logger[_0x6bcd('0xd')]('CreateSquareMessage',_0x144cca,JSON[_0x6bcd('0x19')](_0x3a5481));_0x5a5ee6(_0x3a5481);})[_0x6bcd('0x12')](function(_0x4426d1){logger[_0x6bcd('0xe')](_0x6bcd('0x13'),_0x4426d1['message'],_0x144cca);_0x4e645c(_0x59301c[_0x6bcd('0xe')](0x1f4,_0x4426d1[_0x6bcd('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 9b7d4cb..d14570d 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 _0xa2b1=['test','create','put','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0xa2b1,0x1e6));var _0x1a2b=function(_0x419fac,_0x2f2409){_0x419fac=_0x419fac-0x0;var _0x5b598b=_0xa2b1[_0x419fac];return _0x5b598b;};'use strict';var multer=require('multer');var util=require(_0x1a2b('0x0'));var path=require(_0x1a2b('0x1'));var timeout=require(_0x1a2b('0x2'));var express=require(_0x1a2b('0x3'));var router=express['Router']();var fs_extra=require(_0x1a2b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1a2b('0x5'));var config=require(_0x1a2b('0x6'));var controller=require(_0x1a2b('0x7'));router[_0x1a2b('0x8')]('/',auth[_0x1a2b('0x9')](),controller[_0x1a2b('0xa')]);router[_0x1a2b('0x8')](_0x1a2b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1a2b('0x8')](_0x1a2b('0xc'),auth[_0x1a2b('0x9')](),timeout(_0x1a2b('0xd')),controller[_0x1a2b('0xe')]);router['post']('/',auth[_0x1a2b('0x9')](),controller[_0x1a2b('0xf')]);router[_0x1a2b('0x10')](_0x1a2b('0xb'),auth['isAuthenticated'](),controller[_0x1a2b('0x11')]);router['delete'](_0x1a2b('0xb'),auth[_0x1a2b('0x9')](),controller[_0x1a2b('0x12')]);module[_0x1a2b('0x13')]=router; \ No newline at end of file +var _0x5648=['isAuthenticated','15s','test','post','put','/:id','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','index'];(function(_0x2017fe,_0x3e5598){var _0x46ac2b=function(_0x40673a){while(--_0x40673a){_0x2017fe['push'](_0x2017fe['shift']());}};_0x46ac2b(++_0x3e5598);}(_0x5648,0x14d));var _0x8564=function(_0x1d2e11,_0x38fc4f){_0x1d2e11=_0x1d2e11-0x0;var _0x5e9bb0=_0x5648[_0x1d2e11];return _0x5e9bb0;};'use strict';var multer=require('multer');var util=require(_0x8564('0x0'));var path=require('path');var timeout=require(_0x8564('0x1'));var express=require(_0x8564('0x2'));var router=express['Router']();var fs_extra=require(_0x8564('0x3'));var auth=require(_0x8564('0x4'));var interaction=require(_0x8564('0x5'));var config=require('../../config/environment');var controller=require(_0x8564('0x6'));router[_0x8564('0x7')]('/',auth['isAuthenticated'](),controller[_0x8564('0x8')]);router[_0x8564('0x7')]('/:id',auth[_0x8564('0x9')](),controller['show']);router[_0x8564('0x7')]('/:id/test',auth[_0x8564('0x9')](),timeout(_0x8564('0xa')),controller[_0x8564('0xb')]);router[_0x8564('0xc')]('/',auth[_0x8564('0x9')](),controller['create']);router[_0x8564('0xd')](_0x8564('0xe'),auth['isAuthenticated'](),controller[_0x8564('0xf')]);router[_0x8564('0x10')](_0x8564('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x8564('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index bf2387d..fe25738 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 _0x8a13=['exports','STRING','name','sequelize'];(function(_0x2662e1,_0x3b84b1){var _0x11d068=function(_0x20e0f6){while(--_0x20e0f6){_0x2662e1['push'](_0x2662e1['shift']());}};_0x11d068(++_0x3b84b1);}(_0x8a13,0xd7));var _0x38a1=function(_0x1f34d3,_0x3e2bb7){_0x1f34d3=_0x1f34d3-0x0;var _0x42313a=_0x8a13[_0x1f34d3];return _0x42313a;};'use strict';var Sequelize=require(_0x38a1('0x0'));module[_0x38a1('0x1')]={'name':{'type':Sequelize[_0x38a1('0x2')],'unique':_0x38a1('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x38a1('0x2')]},'description':{'type':Sequelize[_0x38a1('0x2')]}}; \ No newline at end of file +var _0x65b6=['name','sequelize','exports','STRING'];(function(_0x18c28a,_0x173c42){var _0x4745fe=function(_0x2d4e72){while(--_0x2d4e72){_0x18c28a['push'](_0x18c28a['shift']());}};_0x4745fe(++_0x173c42);}(_0x65b6,0xa9));var _0x665b=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0x65b6[_0x126f47];return _0x49508a;};'use strict';var Sequelize=require(_0x665b('0x0'));module[_0x665b('0x1')]={'name':{'type':Sequelize[_0x665b('0x2')],'unique':_0x665b('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x665b('0x2')]},'description':{'type':Sequelize[_0x665b('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index a51cf9e..0841b38 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 _0xe801=['stack','name','map','SquareOdbc','rawAttributes','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ODBC','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','dsn','closeSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','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','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xe801,0x1ec));var _0x1e80=function(_0x2d9df5,_0x1f717b){_0x2d9df5=_0x2d9df5-0x0;var _0x520b1d=_0xe801[_0x2d9df5];return _0x520b1d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e80('0x0'));var zipdir=require(_0x1e80('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e80('0x2'));var moment=require(_0x1e80('0x3'));var BPromise=require(_0x1e80('0x4'));var Mustache=require(_0x1e80('0x5'));var util=require(_0x1e80('0x6'));var path=require(_0x1e80('0x7'));var sox=require(_0x1e80('0x8'));var csv=require('to-csv');var ejs=require(_0x1e80('0x9'));var fs=require('fs');var fs_extra=require(_0x1e80('0xa'));var _=require(_0x1e80('0xb'));var squel=require(_0x1e80('0xc'));var crypto=require('crypto');var jsforce=require(_0x1e80('0xd'));var deskjs=require(_0x1e80('0xe'));var toCsv=require(_0x1e80('0xf'));var querystring=require('querystring');var Papa=require(_0x1e80('0x10'));var Redis=require('ioredis');var authService=require(_0x1e80('0x11'));var qs=require(_0x1e80('0x12'));var as=require(_0x1e80('0x13'));var hardwareService=require(_0x1e80('0x14'));var logger=require(_0x1e80('0x15'))('api');var utils=require(_0x1e80('0x16'));var config=require(_0x1e80('0x17'));var licenseUtil=require(_0x1e80('0x18'));var db=require(_0x1e80('0x19'))['db'];function respondWithStatusCode(_0x4cf60d,_0x4d40d0){_0x4d40d0=_0x4d40d0||0xcc;return function(_0x368faa){if(_0x368faa){return _0x4cf60d[_0x1e80('0x1a')](_0x4d40d0);}return _0x4cf60d[_0x1e80('0x1b')](_0x4d40d0)[_0x1e80('0x1c')]();};}function respondWithResult(_0xaeb985,_0x55d903){_0x55d903=_0x55d903||0xc8;return function(_0x31c1a0){if(_0x31c1a0){return _0xaeb985[_0x1e80('0x1b')](_0x55d903)[_0x1e80('0x1d')](_0x31c1a0);}};}function respondWithFilteredResult(_0x504ccb,_0x187518){return function(_0x1f63e4){if(_0x1f63e4){var _0x3fedfb=typeof _0x187518[_0x1e80('0x1e')]==='undefined'&&typeof _0x187518[_0x1e80('0x1f')]===_0x1e80('0x20');var _0x45ec8d=_0x1f63e4['count'];var _0x5ad3a1=_0x3fedfb?0x0:_0x187518[_0x1e80('0x1e')];var _0x1d1484=_0x3fedfb?_0x1f63e4[_0x1e80('0x21')]:_0x187518[_0x1e80('0x1e')]+_0x187518[_0x1e80('0x1f')];var _0x3d39b5;if(_0x1d1484>=_0x45ec8d){_0x1d1484=_0x45ec8d;_0x3d39b5=0xc8;}else{_0x3d39b5=0xce;}_0x504ccb[_0x1e80('0x1b')](_0x3d39b5);return _0x504ccb['set'](_0x1e80('0x22'),_0x5ad3a1+'-'+_0x1d1484+'/'+_0x45ec8d)[_0x1e80('0x1d')](_0x1f63e4);}return null;};}function patchUpdates(_0x377759){return function(_0x12bbe7){try{jsonpatch[_0x1e80('0x23')](_0x12bbe7,_0x377759,!![]);}catch(_0x55e98f){return BPromise[_0x1e80('0x24')](_0x55e98f);}return _0x12bbe7[_0x1e80('0x25')]();};}function saveUpdates(_0x8686b8,_0xc70477){return function(_0x2ffcc0){if(_0x2ffcc0){return _0x2ffcc0[_0x1e80('0x26')](_0x8686b8)[_0x1e80('0x27')](function(_0x5f98f9){return _0x5f98f9;});}return null;};}function removeEntity(_0x328096,_0x494d7a){return function(_0x43a4b5){if(_0x43a4b5){return _0x43a4b5[_0x1e80('0x28')]()[_0x1e80('0x27')](function(){var _0x34d14c=_0x43a4b5['get']({'plain':!![]});var _0x767ea2='ODBC';return db[_0x1e80('0x29')]['destroy']({'where':{'type':_0x767ea2,'resourceId':_0x34d14c['id']}})[_0x1e80('0x27')](function(){return _0x43a4b5;});})[_0x1e80('0x27')](function(){_0x328096[_0x1e80('0x1b')](0xcc)[_0x1e80('0x1c')]();});}};}function handleEntityNotFound(_0x190767,_0x2fe0f9){return function(_0x3b23fe){if(!_0x3b23fe){_0x190767[_0x1e80('0x1a')](0x194);}return _0x3b23fe;};}function handleError(_0x23043c,_0x486fe7){_0x486fe7=_0x486fe7||0x1f4;return function(_0x30de21){logger['error'](_0x30de21[_0x1e80('0x2a')]);if(_0x30de21[_0x1e80('0x2b')]){delete _0x30de21[_0x1e80('0x2b')];}_0x23043c[_0x1e80('0x1b')](_0x486fe7)['send'](_0x30de21);};}exports['index']=function(_0x132722,_0x1c622e){var _0xfb1fc1={},_0x59f806={},_0x4eef5c={'count':0x0,'rows':[]};var _0x308c76=_[_0x1e80('0x2c')](db[_0x1e80('0x2d')][_0x1e80('0x2e')],function(_0x321e2){return{'name':_0x321e2['fieldName'],'type':_0x321e2[_0x1e80('0x2f')][_0x1e80('0x30')]};});_0x59f806['model']=_[_0x1e80('0x2c')](_0x308c76,_0x1e80('0x2b'));_0x59f806[_0x1e80('0x31')]=_[_0x1e80('0x32')](_0x132722[_0x1e80('0x31')]);_0x59f806['filters']=_[_0x1e80('0x33')](_0x59f806['model'],_0x59f806[_0x1e80('0x31')]);_0xfb1fc1[_0x1e80('0x34')]=_[_0x1e80('0x33')](_0x59f806['model'],qs[_0x1e80('0x35')](_0x132722['query'][_0x1e80('0x35')]));_0xfb1fc1[_0x1e80('0x34')]=_0xfb1fc1[_0x1e80('0x34')][_0x1e80('0x36')]?_0xfb1fc1[_0x1e80('0x34')]:_0x59f806[_0x1e80('0x37')];if(!_0x132722[_0x1e80('0x31')][_0x1e80('0x38')](_0x1e80('0x39'))){_0xfb1fc1[_0x1e80('0x1f')]=qs[_0x1e80('0x1f')](_0x132722[_0x1e80('0x31')][_0x1e80('0x1f')]);_0xfb1fc1[_0x1e80('0x1e')]=qs[_0x1e80('0x1e')](_0x132722[_0x1e80('0x31')]['offset']);}_0xfb1fc1[_0x1e80('0x3a')]=qs[_0x1e80('0x3b')](_0x132722[_0x1e80('0x31')]['sort']);_0xfb1fc1[_0x1e80('0x3c')]=qs[_0x1e80('0x3d')](_[_0x1e80('0x3e')](_0x132722[_0x1e80('0x31')],_0x59f806['filters']),_0x308c76);if(_0x132722[_0x1e80('0x31')][_0x1e80('0x3f')]){_0xfb1fc1[_0x1e80('0x3c')]=_['merge'](_0xfb1fc1[_0x1e80('0x3c')],{'$or':_[_0x1e80('0x2c')](_0x308c76,function(_0x3d309e){if(_0x3d309e[_0x1e80('0x2f')]!==_0x1e80('0x40')){var _0xb7da1b={};_0xb7da1b[_0x3d309e[_0x1e80('0x2b')]]={'$like':'%'+_0x132722[_0x1e80('0x31')][_0x1e80('0x3f')]+'%'};return _0xb7da1b;}})});}_0xfb1fc1=_[_0x1e80('0x41')]({},_0xfb1fc1,_0x132722[_0x1e80('0x42')]);var _0x364406={'where':_0xfb1fc1[_0x1e80('0x3c')]};return db['SquareOdbc'][_0x1e80('0x21')](_0x364406)['then'](function(_0x13e0a9){_0x4eef5c[_0x1e80('0x21')]=_0x13e0a9;if(_0x132722[_0x1e80('0x31')][_0x1e80('0x43')]){_0xfb1fc1[_0x1e80('0x44')]=[{'all':!![]}];}return db['SquareOdbc'][_0x1e80('0x45')](_0xfb1fc1);})['then'](function(_0x5e8584){_0x4eef5c['rows']=_0x5e8584;return _0x4eef5c;})[_0x1e80('0x27')](respondWithFilteredResult(_0x1c622e,_0xfb1fc1))['catch'](handleError(_0x1c622e,null));};exports[_0x1e80('0x46')]=function(_0x9b831,_0x4a0086){var _0x4b256={'raw':!![],'where':{'id':_0x9b831[_0x1e80('0x47')]['id']}},_0x24f320={};_0x24f320[_0x1e80('0x37')]=_[_0x1e80('0x32')](db[_0x1e80('0x2d')]['rawAttributes']);_0x24f320[_0x1e80('0x31')]=_[_0x1e80('0x32')](_0x9b831['query']);_0x24f320[_0x1e80('0x3d')]=_['intersection'](_0x24f320['model'],_0x24f320[_0x1e80('0x31')]);_0x4b256[_0x1e80('0x34')]=_[_0x1e80('0x33')](_0x24f320['model'],qs['fields'](_0x9b831[_0x1e80('0x31')][_0x1e80('0x35')]));_0x4b256[_0x1e80('0x34')]=_0x4b256[_0x1e80('0x34')][_0x1e80('0x36')]?_0x4b256['attributes']:_0x24f320[_0x1e80('0x37')];if(_0x9b831[_0x1e80('0x31')][_0x1e80('0x43')]){_0x4b256[_0x1e80('0x44')]=[{'all':!![]}];}_0x4b256=_['merge']({},_0x4b256,_0x9b831[_0x1e80('0x42')]);return db[_0x1e80('0x2d')]['find'](_0x4b256)['then'](handleEntityNotFound(_0x4a0086,null))[_0x1e80('0x27')](respondWithResult(_0x4a0086,null))[_0x1e80('0x48')](handleError(_0x4a0086,null));};exports['create']=function(_0x48c8e7,_0xc85a78){return db[_0x1e80('0x2d')][_0x1e80('0x49')](_0x48c8e7['body'],{})[_0x1e80('0x27')](function(_0x45c90c){var _0x183a11=_0x48c8e7[_0x1e80('0x4a')][_0x1e80('0x4b')]({'plain':!![]});if(!_0x183a11)throw new Error(_0x1e80('0x4c'));if(_0x183a11['role']===_0x1e80('0x4a')){var _0x308d41=_0x45c90c[_0x1e80('0x4b')]({'plain':!![]});var _0x4e471c=_0x1e80('0x4d');return db[_0x1e80('0x4e')][_0x1e80('0x4f')]({'where':{'name':_0x4e471c,'userProfileId':_0x183a11[_0x1e80('0x50')]},'raw':!![]})[_0x1e80('0x27')](function(_0x3f0f0b){if(_0x3f0f0b&&_0x3f0f0b[_0x1e80('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x308d41[_0x1e80('0x2b')],'resourceId':_0x308d41['id'],'type':_0x3f0f0b['name'],'sectionId':_0x3f0f0b['id']},{})['then'](function(){return _0x45c90c;});}else{return _0x45c90c;}})[_0x1e80('0x48')](function(_0x3ec521){logger[_0x1e80('0x52')](_0x1e80('0x53'),_0x3ec521);throw _0x3ec521;});}return _0x45c90c;})[_0x1e80('0x27')](respondWithResult(_0xc85a78,0xc9))[_0x1e80('0x48')](handleError(_0xc85a78,null));};exports[_0x1e80('0x26')]=function(_0x38420d,_0x1a4248){if(_0x38420d['body']['id']){delete _0x38420d['body']['id'];}return db[_0x1e80('0x2d')]['find']({'where':{'id':_0x38420d[_0x1e80('0x47')]['id']}})[_0x1e80('0x27')](handleEntityNotFound(_0x1a4248,null))[_0x1e80('0x27')](saveUpdates(_0x38420d['body'],null))[_0x1e80('0x27')](respondWithResult(_0x1a4248,null))[_0x1e80('0x48')](handleError(_0x1a4248,null));};exports[_0x1e80('0x28')]=function(_0x3671ef,_0xae7d6f){return db[_0x1e80('0x2d')][_0x1e80('0x4f')]({'where':{'id':_0x3671ef[_0x1e80('0x47')]['id']}})['then'](handleEntityNotFound(_0xae7d6f,null))[_0x1e80('0x27')](removeEntity(_0xae7d6f,null))['catch'](handleError(_0xae7d6f,null));};exports[_0x1e80('0x54')]=function(_0x47d276,_0x1df1ab,_0x1188cc){var _0x25fd85;return db['SquareOdbc']['find']({'where':{'id':_0x47d276[_0x1e80('0x47')]['id']},'attributes':['id','dsn']})[_0x1e80('0x27')](handleEntityNotFound(_0x1df1ab,null))[_0x1e80('0x27')](function(_0x50bb88){if(_0x50bb88){var _0x1898e2=require(_0x1e80('0x55'))();_0x1898e2[_0x1e80('0x56')](_0x50bb88[_0x1e80('0x57')]);_0x1898e2[_0x1e80('0x58')]();return _0x50bb88;}})['then'](respondWithResult(_0x1df1ab,null))[_0x1e80('0x48')](handleError(_0x1df1ab,null));}; \ No newline at end of file +var _0xf17c=['json','apply','reject','then','destroy','get','UserProfileResource','end','error','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareOdbc','includeAll','rows','catch','show','params','include','find','create','user','role','ODBC','UserProfileSection','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set'];(function(_0xb3beb1,_0x4a5118){var _0xd1f8e9=function(_0x23c485){while(--_0x23c485){_0xb3beb1['push'](_0xb3beb1['shift']());}};_0xd1f8e9(++_0x4a5118);}(_0xf17c,0x83));var _0xcf17=function(_0x3e5ccd,_0x1d0046){_0x3e5ccd=_0x3e5ccd-0x0;var _0xeb807e=_0xf17c[_0x3e5ccd];return _0xeb807e;};'use strict';var emlformat=require(_0xcf17('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf17('0x1'));var rp=require(_0xcf17('0x2'));var moment=require(_0xcf17('0x3'));var BPromise=require(_0xcf17('0x4'));var Mustache=require('mustache');var util=require(_0xcf17('0x5'));var path=require(_0xcf17('0x6'));var sox=require(_0xcf17('0x7'));var csv=require(_0xcf17('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf17('0x9'));var _=require('lodash');var squel=require(_0xcf17('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcf17('0x8'));var querystring=require(_0xcf17('0xb'));var Papa=require('papaparse');var Redis=require(_0xcf17('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xcf17('0xd'));var as=require(_0xcf17('0xe'));var hardwareService=require(_0xcf17('0xf'));var logger=require('../../config/logger')(_0xcf17('0x10'));var utils=require(_0xcf17('0x11'));var config=require(_0xcf17('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf17('0x13'))['db'];function respondWithStatusCode(_0x434b8d,_0x1131f7){_0x1131f7=_0x1131f7||0xcc;return function(_0x13d51f){if(_0x13d51f){return _0x434b8d[_0xcf17('0x14')](_0x1131f7);}return _0x434b8d['status'](_0x1131f7)['end']();};}function respondWithResult(_0x59b7a3,_0x82b0d1){_0x82b0d1=_0x82b0d1||0xc8;return function(_0x2bdf54){if(_0x2bdf54){return _0x59b7a3[_0xcf17('0x15')](_0x82b0d1)['json'](_0x2bdf54);}};}function respondWithFilteredResult(_0x3b487a,_0x56e8ee){return function(_0x12c625){if(_0x12c625){var _0x12a4cb=typeof _0x56e8ee[_0xcf17('0x16')]==='undefined'&&typeof _0x56e8ee[_0xcf17('0x17')]===_0xcf17('0x18');var _0x78e5ff=_0x12c625[_0xcf17('0x19')];var _0x1c8af2=_0x12a4cb?0x0:_0x56e8ee[_0xcf17('0x16')];var _0x29e66b=_0x12a4cb?_0x12c625[_0xcf17('0x19')]:_0x56e8ee[_0xcf17('0x16')]+_0x56e8ee['limit'];var _0x43eb05;if(_0x29e66b>=_0x78e5ff){_0x29e66b=_0x78e5ff;_0x43eb05=0xc8;}else{_0x43eb05=0xce;}_0x3b487a[_0xcf17('0x15')](_0x43eb05);return _0x3b487a[_0xcf17('0x1a')]('Content-Range',_0x1c8af2+'-'+_0x29e66b+'/'+_0x78e5ff)[_0xcf17('0x1b')](_0x12c625);}return null;};}function patchUpdates(_0x3a80c2){return function(_0x4baf11){try{jsonpatch[_0xcf17('0x1c')](_0x4baf11,_0x3a80c2,!![]);}catch(_0x378d4a){return BPromise[_0xcf17('0x1d')](_0x378d4a);}return _0x4baf11['save']();};}function saveUpdates(_0x5311c3,_0x2a69fd){return function(_0x17f335){if(_0x17f335){return _0x17f335['update'](_0x5311c3)[_0xcf17('0x1e')](function(_0x26ff82){return _0x26ff82;});}return null;};}function removeEntity(_0x27b324,_0xdcf62c){return function(_0x45f5aa){if(_0x45f5aa){return _0x45f5aa[_0xcf17('0x1f')]()[_0xcf17('0x1e')](function(){var _0x48bc44=_0x45f5aa[_0xcf17('0x20')]({'plain':!![]});var _0x34f380='ODBC';return db[_0xcf17('0x21')]['destroy']({'where':{'type':_0x34f380,'resourceId':_0x48bc44['id']}})[_0xcf17('0x1e')](function(){return _0x45f5aa;});})[_0xcf17('0x1e')](function(){_0x27b324[_0xcf17('0x15')](0xcc)[_0xcf17('0x22')]();});}};}function handleEntityNotFound(_0x5de865,_0x4ff60a){return function(_0x503884){if(!_0x503884){_0x5de865['sendStatus'](0x194);}return _0x503884;};}function handleError(_0x385b70,_0xc2274b){_0xc2274b=_0xc2274b||0x1f4;return function(_0x4dd2a6){logger[_0xcf17('0x23')](_0x4dd2a6['stack']);if(_0x4dd2a6['name']){delete _0x4dd2a6['name'];}_0x385b70[_0xcf17('0x15')](_0xc2274b)['send'](_0x4dd2a6);};}exports['index']=function(_0x51723c,_0x5852bb){var _0x361442={},_0x19ec3c={},_0x32862d={'count':0x0,'rows':[]};var _0x4afb02=_[_0xcf17('0x24')](db['SquareOdbc'][_0xcf17('0x25')],function(_0x4105b0){return{'name':_0x4105b0[_0xcf17('0x26')],'type':_0x4105b0[_0xcf17('0x27')][_0xcf17('0x28')]};});_0x19ec3c[_0xcf17('0x29')]=_[_0xcf17('0x24')](_0x4afb02,'name');_0x19ec3c['query']=_[_0xcf17('0x2a')](_0x51723c['query']);_0x19ec3c[_0xcf17('0x2b')]=_[_0xcf17('0x2c')](_0x19ec3c['model'],_0x19ec3c[_0xcf17('0x2d')]);_0x361442[_0xcf17('0x2e')]=_['intersection'](_0x19ec3c[_0xcf17('0x29')],qs[_0xcf17('0x2f')](_0x51723c[_0xcf17('0x2d')][_0xcf17('0x2f')]));_0x361442[_0xcf17('0x2e')]=_0x361442[_0xcf17('0x2e')][_0xcf17('0x30')]?_0x361442[_0xcf17('0x2e')]:_0x19ec3c['model'];if(!_0x51723c['query'][_0xcf17('0x31')](_0xcf17('0x32'))){_0x361442[_0xcf17('0x17')]=qs['limit'](_0x51723c[_0xcf17('0x2d')][_0xcf17('0x17')]);_0x361442['offset']=qs[_0xcf17('0x16')](_0x51723c[_0xcf17('0x2d')][_0xcf17('0x16')]);}_0x361442['order']=qs['sort'](_0x51723c[_0xcf17('0x2d')][_0xcf17('0x33')]);_0x361442[_0xcf17('0x34')]=qs[_0xcf17('0x2b')](_[_0xcf17('0x35')](_0x51723c[_0xcf17('0x2d')],_0x19ec3c[_0xcf17('0x2b')]),_0x4afb02);if(_0x51723c[_0xcf17('0x2d')][_0xcf17('0x36')]){_0x361442[_0xcf17('0x34')]=_[_0xcf17('0x37')](_0x361442['where'],{'$or':_[_0xcf17('0x24')](_0x4afb02,function(_0x2833a4){if(_0x2833a4[_0xcf17('0x27')]!==_0xcf17('0x38')){var _0xf22bac={};_0xf22bac[_0x2833a4['name']]={'$like':'%'+_0x51723c['query'][_0xcf17('0x36')]+'%'};return _0xf22bac;}})});}_0x361442=_[_0xcf17('0x37')]({},_0x361442,_0x51723c[_0xcf17('0x39')]);var _0x237919={'where':_0x361442[_0xcf17('0x34')]};return db[_0xcf17('0x3a')]['count'](_0x237919)[_0xcf17('0x1e')](function(_0x3c8bd9){_0x32862d['count']=_0x3c8bd9;if(_0x51723c[_0xcf17('0x2d')][_0xcf17('0x3b')]){_0x361442['include']=[{'all':!![]}];}return db[_0xcf17('0x3a')]['findAll'](_0x361442);})[_0xcf17('0x1e')](function(_0x558af7){_0x32862d[_0xcf17('0x3c')]=_0x558af7;return _0x32862d;})[_0xcf17('0x1e')](respondWithFilteredResult(_0x5852bb,_0x361442))[_0xcf17('0x3d')](handleError(_0x5852bb,null));};exports[_0xcf17('0x3e')]=function(_0x22052b,_0x225b88){var _0x231bd9={'raw':!![],'where':{'id':_0x22052b[_0xcf17('0x3f')]['id']}},_0x5b44ef={};_0x5b44ef[_0xcf17('0x29')]=_['keys'](db[_0xcf17('0x3a')][_0xcf17('0x25')]);_0x5b44ef[_0xcf17('0x2d')]=_['keys'](_0x22052b[_0xcf17('0x2d')]);_0x5b44ef['filters']=_[_0xcf17('0x2c')](_0x5b44ef['model'],_0x5b44ef['query']);_0x231bd9['attributes']=_[_0xcf17('0x2c')](_0x5b44ef[_0xcf17('0x29')],qs[_0xcf17('0x2f')](_0x22052b['query']['fields']));_0x231bd9[_0xcf17('0x2e')]=_0x231bd9['attributes']['length']?_0x231bd9[_0xcf17('0x2e')]:_0x5b44ef[_0xcf17('0x29')];if(_0x22052b[_0xcf17('0x2d')]['includeAll']){_0x231bd9[_0xcf17('0x40')]=[{'all':!![]}];}_0x231bd9=_['merge']({},_0x231bd9,_0x22052b[_0xcf17('0x39')]);return db[_0xcf17('0x3a')][_0xcf17('0x41')](_0x231bd9)['then'](handleEntityNotFound(_0x225b88,null))['then'](respondWithResult(_0x225b88,null))['catch'](handleError(_0x225b88,null));};exports[_0xcf17('0x42')]=function(_0x2b95b1,_0x804d61){return db['SquareOdbc'][_0xcf17('0x42')](_0x2b95b1['body'],{})[_0xcf17('0x1e')](function(_0x1b4bb3){var _0xff0753=_0x2b95b1[_0xcf17('0x43')][_0xcf17('0x20')]({'plain':!![]});if(!_0xff0753)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xff0753[_0xcf17('0x44')]==='user'){var _0x3cacee=_0x1b4bb3[_0xcf17('0x20')]({'plain':!![]});var _0x5df4ef=_0xcf17('0x45');return db[_0xcf17('0x46')][_0xcf17('0x41')]({'where':{'name':_0x5df4ef,'userProfileId':_0xff0753['userProfileId']},'raw':!![]})[_0xcf17('0x1e')](function(_0x4c4b78){if(_0x4c4b78&&_0x4c4b78[_0xcf17('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x3cacee[_0xcf17('0x48')],'resourceId':_0x3cacee['id'],'type':_0x4c4b78[_0xcf17('0x48')],'sectionId':_0x4c4b78['id']},{})[_0xcf17('0x1e')](function(){return _0x1b4bb3;});}else{return _0x1b4bb3;}})[_0xcf17('0x3d')](function(_0x57e8ff){logger['error'](_0xcf17('0x49'),_0x57e8ff);throw _0x57e8ff;});}return _0x1b4bb3;})[_0xcf17('0x1e')](respondWithResult(_0x804d61,0xc9))[_0xcf17('0x3d')](handleError(_0x804d61,null));};exports['update']=function(_0x1e5cd9,_0x17c38b){if(_0x1e5cd9['body']['id']){delete _0x1e5cd9[_0xcf17('0x4a')]['id'];}return db[_0xcf17('0x3a')][_0xcf17('0x41')]({'where':{'id':_0x1e5cd9['params']['id']}})[_0xcf17('0x1e')](handleEntityNotFound(_0x17c38b,null))[_0xcf17('0x1e')](saveUpdates(_0x1e5cd9[_0xcf17('0x4a')],null))[_0xcf17('0x1e')](respondWithResult(_0x17c38b,null))[_0xcf17('0x3d')](handleError(_0x17c38b,null));};exports['destroy']=function(_0x5e508c,_0x2bb21d){return db['SquareOdbc'][_0xcf17('0x41')]({'where':{'id':_0x5e508c[_0xcf17('0x3f')]['id']}})[_0xcf17('0x1e')](handleEntityNotFound(_0x2bb21d,null))[_0xcf17('0x1e')](removeEntity(_0x2bb21d,null))[_0xcf17('0x3d')](handleError(_0x2bb21d,null));};exports[_0xcf17('0x4b')]=function(_0x3bd658,_0x4048fb,_0xc56bcf){var _0x37f44c;return db[_0xcf17('0x3a')][_0xcf17('0x41')]({'where':{'id':_0x3bd658[_0xcf17('0x3f')]['id']},'attributes':['id',_0xcf17('0x4c')]})[_0xcf17('0x1e')](handleEntityNotFound(_0x4048fb,null))[_0xcf17('0x1e')](function(_0xd30701){if(_0xd30701){var _0x522924=require(_0xcf17('0x4d'))();_0x522924[_0xcf17('0x4e')](_0xd30701['dsn']);_0x522924['closeSync']();return _0xd30701;}})['then'](respondWithResult(_0x4048fb,null))[_0xcf17('0x3d')](handleError(_0x4048fb,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0dabac1..95d1191 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 _0x4343=['square_odbc','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4343,0x1ae));var _0x3434=function(_0x450289,_0xa76428){_0x450289=_0x450289-0x0;var _0x41ff32=_0x4343[_0x450289];return _0x41ff32;};'use strict';var _=require(_0x3434('0x0'));var util=require('util');var logger=require(_0x3434('0x1'))('api');var moment=require(_0x3434('0x2'));var BPromise=require(_0x3434('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3434('0x4'));var rimraf=require('rimraf');var config=require(_0x3434('0x5'));var attributes=require(_0x3434('0x6'));module[_0x3434('0x7')]=function(_0x4193e9,_0x25dc89){return _0x4193e9[_0x3434('0x8')](_0x3434('0x9'),attributes,{'tableName':_0x3434('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x531a=['lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x36c6e3,_0x2de454){var _0x4b9514=function(_0x52b8e0){while(--_0x52b8e0){_0x36c6e3['push'](_0x36c6e3['shift']());}};_0x4b9514(++_0x2de454);}(_0x531a,0x79));var _0xa531=function(_0x30df37,_0x48ad64){_0x30df37=_0x30df37-0x0;var _0x41ab55=_0x531a[_0x30df37];return _0x41ab55;};'use strict';var _=require(_0xa531('0x0'));var util=require('util');var logger=require(_0xa531('0x1'))(_0xa531('0x2'));var moment=require(_0xa531('0x3'));var BPromise=require(_0xa531('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa531('0x5'));var config=require(_0xa531('0x6'));var attributes=require(_0xa531('0x7'));module[_0xa531('0x8')]=function(_0x571560,_0x4b5f6c){return _0x571560[_0xa531('0x9')](_0xa531('0xa'),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 6a3710c..edf1ada 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 _0x1d00=['request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','debug','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','SquareOdbc,\x20%s,\x20%s'];(function(_0x3efcd0,_0x4181d6){var _0x341b6d=function(_0x26fa22){while(--_0x26fa22){_0x3efcd0['push'](_0x3efcd0['shift']());}};_0x341b6d(++_0x4181d6);}(_0x1d00,0x1b6));var _0x01d0=function(_0x4065fe,_0x416e26){_0x4065fe=_0x4065fe-0x0;var _0xe882ce=_0x1d00[_0x4065fe];return _0xe882ce;};'use strict';var _=require(_0x01d0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x01d0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01d0('0x2'));var db=require(_0x01d0('0x3'))['db'];var utils=require(_0x01d0('0x4'));var logger=require('../../config/logger')(_0x01d0('0x5'));var config=require(_0x01d0('0x6'));var jayson=require(_0x01d0('0x7'));var client=jayson[_0x01d0('0x8')][_0x01d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32df49,_0x1a5523,_0x60ebe2){return new BPromise(function(_0x40ea56,_0x2abebc){return client['request'](_0x32df49,_0x60ebe2)[_0x01d0('0xa')](function(_0x4888f4){logger['info'](_0x01d0('0xb'),_0x1a5523,_0x01d0('0xc'));logger['debug'](_0x01d0('0xd'),_0x1a5523,'request\x20sent',JSON[_0x01d0('0xe')](_0x4888f4));if(_0x4888f4[_0x01d0('0xf')]){if(_0x4888f4[_0x01d0('0xf')][_0x01d0('0x10')]===0x1f4){logger['error'](_0x01d0('0xb'),_0x1a5523,_0x4888f4[_0x01d0('0xf')][_0x01d0('0x11')]);return _0x2abebc(_0x4888f4['error']['message']);}logger[_0x01d0('0xf')](_0x01d0('0xb'),_0x1a5523,_0x4888f4[_0x01d0('0xf')][_0x01d0('0x11')]);return _0x40ea56(_0x4888f4['error']['message']);}else{logger[_0x01d0('0x12')](_0x01d0('0xb'),_0x1a5523,_0x01d0('0xc'));_0x40ea56(_0x4888f4['result']['message']);}})[_0x01d0('0x13')](function(_0x7a7db7){logger['error'](_0x01d0('0xb'),_0x1a5523,_0x7a7db7);_0x2abebc(_0x7a7db7);});});}exports[_0x01d0('0x14')]=function(_0x1f5931){var _0x2a17b5=this;return new Promise(function(_0xb52c86,_0x5bb719){return db[_0x01d0('0x15')]['find']({'raw':_0x1f5931[_0x01d0('0x16')]?_0x1f5931[_0x01d0('0x16')][_0x01d0('0x17')]===undefined?!![]:![]:!![],'where':_0x1f5931['options']?_0x1f5931[_0x01d0('0x16')][_0x01d0('0x18')]||null:null,'attributes':_0x1f5931['options']?_0x1f5931[_0x01d0('0x16')][_0x01d0('0x19')]||null:null,'include':_0x1f5931[_0x01d0('0x16')]?_0x1f5931[_0x01d0('0x16')][_0x01d0('0x1a')]?_[_0x01d0('0x1b')](_0x1f5931[_0x01d0('0x16')]['include'],function(_0x3f753d){return{'model':db[_0x3f753d[_0x01d0('0x1c')]],'as':_0x3f753d['as'],'attributes':_0x3f753d[_0x01d0('0x19')],'include':_0x3f753d[_0x01d0('0x1a')]?_['map'](_0x3f753d[_0x01d0('0x1a')],function(_0x4e5e2){return{'model':db[_0x4e5e2[_0x01d0('0x1c')]],'as':_0x4e5e2['as'],'attributes':_0x4e5e2[_0x01d0('0x19')],'include':_0x4e5e2[_0x01d0('0x1a')]?_[_0x01d0('0x1b')](_0x4e5e2[_0x01d0('0x1a')],function(_0x12ab3c){return{'model':db[_0x12ab3c[_0x01d0('0x1c')]],'as':_0x12ab3c['as'],'attributes':_0x12ab3c[_0x01d0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x01d0('0xa')](function(_0x3242e1){logger[_0x01d0('0x12')](_0x01d0('0x14'),_0x1f5931);logger[_0x01d0('0x1d')](_0x01d0('0x14'),_0x1f5931,JSON['stringify'](_0x3242e1));_0xb52c86(_0x3242e1);})[_0x01d0('0x13')](function(_0x36e559){logger[_0x01d0('0xf')](_0x01d0('0x14'),_0x36e559['message'],_0x1f5931);_0x5bb719(_0x2a17b5[_0x01d0('0xf')](0x1f4,_0x36e559[_0x01d0('0x11')]));});});}; \ No newline at end of file +var _0x36d4=['code','message','info','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','attributes','model','debug','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3019c9,_0x1a8453){var _0x3d884d=function(_0x513a46){while(--_0x513a46){_0x3019c9['push'](_0x3019c9['shift']());}};_0x3d884d(++_0x1a8453);}(_0x36d4,0x118));var _0x436d=function(_0x3c3b57,_0x5c6241){_0x3c3b57=_0x3c3b57-0x0;var _0x630592=_0x36d4[_0x3c3b57];return _0x630592;};'use strict';var _=require('lodash');var util=require(_0x436d('0x0'));var moment=require(_0x436d('0x1'));var BPromise=require(_0x436d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x436d('0x3'));var db=require(_0x436d('0x4'))['db'];var utils=require(_0x436d('0x5'));var logger=require(_0x436d('0x6'))(_0x436d('0x7'));var config=require(_0x436d('0x8'));var jayson=require(_0x436d('0x9'));var client=jayson[_0x436d('0xa')][_0x436d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d4479,_0x2140d9,_0x5151c3){return new BPromise(function(_0x5a8cbf,_0x542194){return client[_0x436d('0xc')](_0x5d4479,_0x5151c3)[_0x436d('0xd')](function(_0x146e90){logger['info'](_0x436d('0xe'),_0x2140d9,'request\x20sent');logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x2140d9,_0x436d('0xf'),JSON['stringify'](_0x146e90));if(_0x146e90['error']){if(_0x146e90[_0x436d('0x10')][_0x436d('0x11')]===0x1f4){logger[_0x436d('0x10')](_0x436d('0xe'),_0x2140d9,_0x146e90[_0x436d('0x10')][_0x436d('0x12')]);return _0x542194(_0x146e90[_0x436d('0x10')][_0x436d('0x12')]);}logger[_0x436d('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x2140d9,_0x146e90[_0x436d('0x10')]['message']);return _0x5a8cbf(_0x146e90[_0x436d('0x10')][_0x436d('0x12')]);}else{logger[_0x436d('0x13')](_0x436d('0xe'),_0x2140d9,_0x436d('0xf'));_0x5a8cbf(_0x146e90['result']['message']);}})[_0x436d('0x14')](function(_0x262452){logger['error'](_0x436d('0xe'),_0x2140d9,_0x262452);_0x542194(_0x262452);});});}exports[_0x436d('0x15')]=function(_0x57e85f){var _0x57027e=this;return new Promise(function(_0x303a47,_0x53d9c4){return db[_0x436d('0x16')][_0x436d('0x17')]({'raw':_0x57e85f['options']?_0x57e85f[_0x436d('0x18')][_0x436d('0x19')]===undefined?!![]:![]:!![],'where':_0x57e85f[_0x436d('0x18')]?_0x57e85f[_0x436d('0x18')][_0x436d('0x1a')]||null:null,'attributes':_0x57e85f[_0x436d('0x18')]?_0x57e85f['options']['attributes']||null:null,'include':_0x57e85f[_0x436d('0x18')]?_0x57e85f[_0x436d('0x18')][_0x436d('0x1b')]?_[_0x436d('0x1c')](_0x57e85f[_0x436d('0x18')][_0x436d('0x1b')],function(_0x1a0018){return{'model':db[_0x1a0018['model']],'as':_0x1a0018['as'],'attributes':_0x1a0018[_0x436d('0x1d')],'include':_0x1a0018[_0x436d('0x1b')]?_[_0x436d('0x1c')](_0x1a0018[_0x436d('0x1b')],function(_0x933af){return{'model':db[_0x933af[_0x436d('0x1e')]],'as':_0x933af['as'],'attributes':_0x933af[_0x436d('0x1d')],'include':_0x933af[_0x436d('0x1b')]?_[_0x436d('0x1c')](_0x933af[_0x436d('0x1b')],function(_0x509314){return{'model':db[_0x509314[_0x436d('0x1e')]],'as':_0x509314['as'],'attributes':_0x509314[_0x436d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x436d('0xd')](function(_0x4edc67){logger[_0x436d('0x13')](_0x436d('0x15'),_0x57e85f);logger[_0x436d('0x1f')](_0x436d('0x15'),_0x57e85f,JSON[_0x436d('0x20')](_0x4edc67));_0x303a47(_0x4edc67);})[_0x436d('0x14')](function(_0x149a3d){logger[_0x436d('0x10')](_0x436d('0x15'),_0x149a3d[_0x436d('0x12')],_0x57e85f);_0x53d9c4(_0x57027e['error'](0x1f4,_0x149a3d[_0x436d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 64d6d0e..9b51c51 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 _0xd3c8=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','create','post','addUsers','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1c17fb,_0x17a1c9){var _0x9977f3=function(_0x5eac87){while(--_0x5eac87){_0x1c17fb['push'](_0x1c17fb['shift']());}};_0x9977f3(++_0x17a1c9);}(_0xd3c8,0x161));var _0x8d3c=function(_0x2b6e5c,_0x588da6){_0x2b6e5c=_0x2b6e5c-0x0;var _0x54b491=_0xd3c8[_0x2b6e5c];return _0x54b491;};'use strict';var multer=require(_0x8d3c('0x0'));var util=require(_0x8d3c('0x1'));var path=require(_0x8d3c('0x2'));var timeout=require(_0x8d3c('0x3'));var express=require(_0x8d3c('0x4'));var router=express['Router']();var fs_extra=require(_0x8d3c('0x5'));var auth=require(_0x8d3c('0x6'));var interaction=require(_0x8d3c('0x7'));var config=require(_0x8d3c('0x8'));var controller=require('./squareProject.controller');router[_0x8d3c('0x9')]('/',auth[_0x8d3c('0xa')](),controller[_0x8d3c('0xb')]);router[_0x8d3c('0x9')](_0x8d3c('0xc'),auth[_0x8d3c('0xa')](),controller[_0x8d3c('0xd')]);router[_0x8d3c('0x9')](_0x8d3c('0xe'),auth[_0x8d3c('0xa')](),controller['getUsers']);router['post']('/',auth['isAuthenticated'](),controller[_0x8d3c('0xf')]);router[_0x8d3c('0x10')](_0x8d3c('0xe'),auth[_0x8d3c('0xa')](),controller[_0x8d3c('0x11')]);router[_0x8d3c('0x12')](_0x8d3c('0xc'),auth[_0x8d3c('0xa')](),controller[_0x8d3c('0x13')]);router[_0x8d3c('0x14')](_0x8d3c('0xc'),auth[_0x8d3c('0xa')](),controller[_0x8d3c('0x15')]);router[_0x8d3c('0x14')](_0x8d3c('0xe'),auth[_0x8d3c('0xa')](),controller[_0x8d3c('0x16')]);module[_0x8d3c('0x17')]=router; \ No newline at end of file +var _0x9fa2=['path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','create','post','addUsers','put','update','delete','exports','multer','util'];(function(_0xf28b42,_0x5a976f){var _0x4f1265=function(_0x37a26d){while(--_0x37a26d){_0xf28b42['push'](_0xf28b42['shift']());}};_0x4f1265(++_0x5a976f);}(_0x9fa2,0x67));var _0x29fa=function(_0x51bb38,_0x4e57a0){_0x51bb38=_0x51bb38-0x0;var _0x51c09b=_0x9fa2[_0x51bb38];return _0x51c09b;};'use strict';var multer=require(_0x29fa('0x0'));var util=require(_0x29fa('0x1'));var path=require(_0x29fa('0x2'));var timeout=require(_0x29fa('0x3'));var express=require(_0x29fa('0x4'));var router=express['Router']();var fs_extra=require(_0x29fa('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29fa('0x6'));var controller=require('./squareProject.controller');router[_0x29fa('0x7')]('/',auth[_0x29fa('0x8')](),controller[_0x29fa('0x9')]);router[_0x29fa('0x7')](_0x29fa('0xa'),auth[_0x29fa('0x8')](),controller[_0x29fa('0xb')]);router[_0x29fa('0x7')](_0x29fa('0xc'),auth['isAuthenticated'](),controller[_0x29fa('0xd')]);router['post']('/',auth[_0x29fa('0x8')](),controller[_0x29fa('0xe')]);router[_0x29fa('0xf')]('/:id/users',auth[_0x29fa('0x8')](),controller[_0x29fa('0x10')]);router[_0x29fa('0x11')](_0x29fa('0xa'),auth[_0x29fa('0x8')](),controller[_0x29fa('0x12')]);router['delete'](_0x29fa('0xa'),auth[_0x29fa('0x8')](),controller['destroy']);router[_0x29fa('0x13')](_0x29fa('0xc'),auth[_0x29fa('0x8')](),controller['removeUsers']);module[_0x29fa('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 9488b19..a6b08ef 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 _0x62b8=['production','utf8','DATE','sequelize','exports','name','long','getDataValue','preproduction','toString','BLOB'];(function(_0x1a0571,_0x10200b){var _0x4c7572=function(_0x19ece3){while(--_0x19ece3){_0x1a0571['push'](_0x1a0571['shift']());}};_0x4c7572(++_0x10200b);}(_0x62b8,0x142));var _0x862b=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0x62b8[_0x54defc];return _0x1955d3;};'use strict';var Sequelize=require(_0x862b('0x0'));module[_0x862b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x862b('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x862b('0x3')),'get':function(){if(this[_0x862b('0x4')](_0x862b('0x5'))){return this['getDataValue'](_0x862b('0x5'))[_0x862b('0x6')]('utf8');}}},'production':{'type':Sequelize[_0x862b('0x7')](_0x862b('0x3')),'get':function(){if(this[_0x862b('0x4')](_0x862b('0x8'))){return this[_0x862b('0x4')](_0x862b('0x8'))['toString'](_0x862b('0x9'));}}},'savedAt':{'type':Sequelize[_0x862b('0xa')]},'publishedAt':{'type':Sequelize[_0x862b('0xa')]}}; \ No newline at end of file +var _0xd997=['sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString','production','utf8','DATE'];(function(_0x46c1d5,_0x5ca335){var _0x40fe7b=function(_0x34cb99){while(--_0x34cb99){_0x46c1d5['push'](_0x46c1d5['shift']());}};_0x40fe7b(++_0x5ca335);}(_0xd997,0x1a0));var _0x7d99=function(_0x4a0238,_0x497945){_0x4a0238=_0x4a0238-0x0;var _0x3b1441=_0xd997[_0x4a0238];return _0x3b1441;};'use strict';var Sequelize=require(_0x7d99('0x0'));module[_0x7d99('0x1')]={'name':{'type':Sequelize[_0x7d99('0x2')],'unique':_0x7d99('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7d99('0x2')]},'notes':{'type':Sequelize[_0x7d99('0x4')]},'preproduction':{'type':Sequelize[_0x7d99('0x5')](_0x7d99('0x6')),'get':function(){if(this[_0x7d99('0x7')](_0x7d99('0x8'))){return this[_0x7d99('0x7')]('preproduction')[_0x7d99('0x9')]('utf8');}}},'production':{'type':Sequelize[_0x7d99('0x5')](_0x7d99('0x6')),'get':function(){if(this[_0x7d99('0x7')](_0x7d99('0xa'))){return this[_0x7d99('0x7')](_0x7d99('0xa'))[_0x7d99('0x9')](_0x7d99('0xb'));}}},'savedAt':{'type':Sequelize[_0x7d99('0xc')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index db6e189..a009891 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 _0x6d38=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','production','addUsers','ids','removeUsers','isArray','userSquareProject:remove','getUsers','findOne','User','rawAttributes','filter','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','defaults','redis','localhost','./squareProject.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','then','destroy','get','UserProfileResource','publish','agi','stringify','error','name','send','index','SquareProject','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SquareProjects','userProfileId'];(function(_0x472516,_0x507cad){var _0x3819c0=function(_0x6482e5){while(--_0x6482e5){_0x472516['push'](_0x472516['shift']());}};_0x3819c0(++_0x507cad);}(_0x6d38,0x1ef));var _0x86d3=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6d38[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var Redis=require(_0x86d3('0x0'));var qs=require(_0x86d3('0x1'));var logger=require(_0x86d3('0x2'))('api');var config=require('../../config/environment');var db=require(_0x86d3('0x3'))['db'];config['redis']=_[_0x86d3('0x4')](config[_0x86d3('0x5')],{'host':_0x86d3('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x86d3('0x5')]));require(_0x86d3('0x7'))[_0x86d3('0x8')](socket);function respondWithStatusCode(_0x2eaa15,_0x47e654){_0x47e654=_0x47e654||0xcc;return function(_0x552b07){if(_0x552b07){return _0x2eaa15[_0x86d3('0x9')](_0x47e654);}return _0x2eaa15[_0x86d3('0xa')](_0x47e654)[_0x86d3('0xb')]();};}function respondWithResult(_0x499640,_0x4a277e){_0x4a277e=_0x4a277e||0xc8;return function(_0x3ed317){if(_0x3ed317){return _0x499640[_0x86d3('0xa')](_0x4a277e)['json'](_0x3ed317);}};}function respondWithFilteredResult(_0x5606eb,_0x4300e2){return function(_0x4dc834){if(_0x4dc834){var _0x4f216c=typeof _0x4300e2[_0x86d3('0xc')]==='undefined'&&typeof _0x4300e2[_0x86d3('0xd')]===_0x86d3('0xe');var _0x440a55=_0x4dc834[_0x86d3('0xf')];var _0xe1b3d7=_0x4f216c?0x0:_0x4300e2[_0x86d3('0xc')];var _0xbbca86=_0x4f216c?_0x4dc834[_0x86d3('0xf')]:_0x4300e2['offset']+_0x4300e2[_0x86d3('0xd')];var _0x1f35cf;if(_0xbbca86>=_0x440a55){_0xbbca86=_0x440a55;_0x1f35cf=0xc8;}else{_0x1f35cf=0xce;}_0x5606eb[_0x86d3('0xa')](_0x1f35cf);return _0x5606eb[_0x86d3('0x10')](_0x86d3('0x11'),_0xe1b3d7+'-'+_0xbbca86+'/'+_0x440a55)[_0x86d3('0x12')](_0x4dc834);}return null;};}function saveUpdates(_0x1ff008){return function(_0x44436d){if(_0x44436d){return _0x44436d['update'](_0x1ff008)[_0x86d3('0x13')](function(_0x281da0){return _0x281da0;});}return null;};}function removeEntity(_0x431b3f){return function(_0xa26ea2){if(_0xa26ea2){return _0xa26ea2[_0x86d3('0x14')]()[_0x86d3('0x13')](function(){var _0x33e459=_0xa26ea2[_0x86d3('0x15')]({'plain':!![]});var _0x9b76f2='SquareProjects';return db[_0x86d3('0x16')]['destroy']({'where':{'type':_0x9b76f2,'resourceId':_0x33e459['id']}})[_0x86d3('0x13')](function(){return _0xa26ea2;});})['then'](function(){var _0x52293e=new Redis(config[_0x86d3('0x5')]);_0x52293e[_0x86d3('0x17')](_0x86d3('0x18'),JSON[_0x86d3('0x19')]({'id':_0xa26ea2['id'],'deleted':!![]}));})['then'](function(){_0x431b3f[_0x86d3('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36e0fa){return function(_0x3fdf67){if(!_0x3fdf67){_0x36e0fa[_0x86d3('0x9')](0x194);}return _0x3fdf67;};}function handleError(_0x5b990d,_0x39d819){_0x39d819=_0x39d819||0x1f4;return function(_0x72b3d4){logger[_0x86d3('0x1a')](_0x72b3d4['stack']);if(_0x72b3d4['name']){delete _0x72b3d4[_0x86d3('0x1b')];}_0x5b990d['status'](_0x39d819)[_0x86d3('0x1c')](_0x72b3d4);};}exports[_0x86d3('0x1d')]=function(_0x3dfecd,_0x3c5fe4){var _0x48b3ff={},_0x481077={},_0x3359e4={'count':0x0,'rows':[]};var _0x611764=_['map'](db[_0x86d3('0x1e')]['rawAttributes'],function(_0x42413c){return{'name':_0x42413c[_0x86d3('0x1f')],'type':_0x42413c[_0x86d3('0x20')][_0x86d3('0x21')]};});_0x481077[_0x86d3('0x22')]=_[_0x86d3('0x23')](_0x611764,_0x86d3('0x1b'));_0x481077[_0x86d3('0x24')]=_[_0x86d3('0x25')](_0x3dfecd[_0x86d3('0x24')]);_0x481077[_0x86d3('0x26')]=_[_0x86d3('0x27')](_0x481077[_0x86d3('0x22')],_0x481077[_0x86d3('0x24')]);_0x48b3ff['attributes']=_[_0x86d3('0x27')](_0x481077[_0x86d3('0x22')],qs[_0x86d3('0x28')](_0x3dfecd[_0x86d3('0x24')][_0x86d3('0x28')]));_0x48b3ff[_0x86d3('0x29')]=_0x48b3ff['attributes'][_0x86d3('0x2a')]?_0x48b3ff['attributes']:_0x481077['model'];if(!_0x3dfecd[_0x86d3('0x24')][_0x86d3('0x2b')](_0x86d3('0x2c'))){_0x48b3ff['limit']=qs[_0x86d3('0xd')](_0x3dfecd[_0x86d3('0x24')]['limit']);_0x48b3ff[_0x86d3('0xc')]=qs[_0x86d3('0xc')](_0x3dfecd[_0x86d3('0x24')][_0x86d3('0xc')]);}_0x48b3ff[_0x86d3('0x2d')]=qs[_0x86d3('0x2e')](_0x3dfecd[_0x86d3('0x24')][_0x86d3('0x2e')]);_0x48b3ff['where']=qs['filters'](_['pick'](_0x3dfecd[_0x86d3('0x24')],_0x481077['filters']),_0x611764);if(_0x3dfecd[_0x86d3('0x24')]['filter']){_0x48b3ff[_0x86d3('0x2f')]=_[_0x86d3('0x30')](_0x48b3ff[_0x86d3('0x2f')],{'$or':_[_0x86d3('0x23')](_0x611764,function(_0x1e22c2){if(_0x1e22c2[_0x86d3('0x20')]!==_0x86d3('0x31')){var _0x4f5875={};_0x4f5875[_0x1e22c2[_0x86d3('0x1b')]]={'$like':'%'+_0x3dfecd[_0x86d3('0x24')]['filter']+'%'};return _0x4f5875;}})});}_0x48b3ff=_[_0x86d3('0x30')]({},_0x48b3ff,_0x3dfecd[_0x86d3('0x32')]);var _0x3ff0fd={'where':_0x48b3ff[_0x86d3('0x2f')]};return db['SquareProject'][_0x86d3('0xf')](_0x3ff0fd)[_0x86d3('0x13')](function(_0x2e01ff){_0x3359e4['count']=_0x2e01ff;if(_0x3dfecd[_0x86d3('0x24')][_0x86d3('0x33')]){_0x48b3ff[_0x86d3('0x34')]=[{'all':!![]}];}return db[_0x86d3('0x1e')][_0x86d3('0x35')](_0x48b3ff);})[_0x86d3('0x13')](function(_0x3666fc){_0x3359e4[_0x86d3('0x36')]=_0x3666fc;return _0x3359e4;})['then'](respondWithFilteredResult(_0x3c5fe4,_0x48b3ff))[_0x86d3('0x37')](handleError(_0x3c5fe4,null));};exports[_0x86d3('0x38')]=function(_0x2bdc67,_0x461052){var _0x5ebb4d={'raw':![],'where':{'id':_0x2bdc67[_0x86d3('0x39')]['id']}},_0x1231ee={};_0x1231ee[_0x86d3('0x22')]=_[_0x86d3('0x25')](db['SquareProject']['rawAttributes']);_0x1231ee[_0x86d3('0x24')]=_['keys'](_0x2bdc67['query']);_0x1231ee[_0x86d3('0x26')]=_[_0x86d3('0x27')](_0x1231ee[_0x86d3('0x22')],_0x1231ee[_0x86d3('0x24')]);_0x5ebb4d[_0x86d3('0x29')]=_['intersection'](_0x1231ee[_0x86d3('0x22')],qs[_0x86d3('0x28')](_0x2bdc67[_0x86d3('0x24')]['fields']));_0x5ebb4d[_0x86d3('0x29')]=_0x5ebb4d[_0x86d3('0x29')]['length']?_0x5ebb4d[_0x86d3('0x29')]:_0x1231ee[_0x86d3('0x22')];if(_0x2bdc67['query']['includeAll']){_0x5ebb4d['include']=[{'all':!![]}];}_0x5ebb4d=_[_0x86d3('0x30')]({},_0x5ebb4d,_0x2bdc67[_0x86d3('0x32')]);return db[_0x86d3('0x1e')][_0x86d3('0x3a')](_0x5ebb4d)[_0x86d3('0x13')](handleEntityNotFound(_0x461052,null))[_0x86d3('0x13')](respondWithResult(_0x461052,null))['catch'](handleError(_0x461052,null));};exports[_0x86d3('0x3b')]=function(_0x879842,_0x5d9dad){return db[_0x86d3('0x1e')][_0x86d3('0x3b')](_0x879842[_0x86d3('0x3c')],{})[_0x86d3('0x13')](function(_0x45db98){var _0x25c253=_0x879842['user'][_0x86d3('0x15')]({'plain':!![]});if(!_0x25c253)throw new Error(_0x86d3('0x3d'));if(_0x25c253['role']===_0x86d3('0x3e')){var _0x412d0e=_0x45db98[_0x86d3('0x15')]({'plain':!![]});var _0x390f23=_0x86d3('0x3f');return db['UserProfileSection'][_0x86d3('0x3a')]({'where':{'name':_0x390f23,'userProfileId':_0x25c253[_0x86d3('0x40')]},'raw':!![]})[_0x86d3('0x13')](function(_0x14fa58){if(_0x14fa58&&_0x14fa58[_0x86d3('0x41')]===0x0){return db[_0x86d3('0x16')][_0x86d3('0x3b')]({'name':_0x412d0e[_0x86d3('0x1b')],'resourceId':_0x412d0e['id'],'type':_0x14fa58[_0x86d3('0x1b')],'sectionId':_0x14fa58['id']},{})[_0x86d3('0x13')](function(){return _0x45db98;});}else{return _0x45db98;}})[_0x86d3('0x37')](function(_0x1236ea){logger['error'](_0x86d3('0x42'),_0x1236ea);throw _0x1236ea;});}return _0x45db98;})[_0x86d3('0x13')](respondWithResult(_0x5d9dad,0xc9))['catch'](handleError(_0x5d9dad,null));};exports[_0x86d3('0x43')]=function(_0x23a6ee,_0x197047){if(_0x23a6ee[_0x86d3('0x3c')]['id']){delete _0x23a6ee[_0x86d3('0x3c')]['id'];}return db[_0x86d3('0x1e')]['find']({'where':{'id':_0x23a6ee['params']['id']}})['then'](handleEntityNotFound(_0x197047,null))['then'](saveUpdates(_0x23a6ee[_0x86d3('0x3c')],null))[_0x86d3('0x13')](function(_0x2ca2a4){if(!_0x2ca2a4)return;var _0x123a8e=_0x2ca2a4[_0x86d3('0x15')]({'plain':!![]});return _0x123a8e;})[_0x86d3('0x13')](function(_0x24d59e){var _0x4c0509=new Redis(config[_0x86d3('0x5')]);_0x4c0509[_0x86d3('0x17')](_0x86d3('0x18'),JSON[_0x86d3('0x19')](_[_0x86d3('0x44')](_0x24d59e,['id',_0x86d3('0x1b'),_0x86d3('0x45')])));return _0x24d59e;})['then'](respondWithResult(_0x197047,null))[_0x86d3('0x37')](handleError(_0x197047,null));};exports['destroy']=function(_0x1f3c25,_0x43dc47){return db[_0x86d3('0x1e')][_0x86d3('0x3a')]({'where':{'id':_0x1f3c25[_0x86d3('0x39')]['id']}})['then'](handleEntityNotFound(_0x43dc47,null))[_0x86d3('0x13')](removeEntity(_0x43dc47,null))[_0x86d3('0x37')](handleError(_0x43dc47,null));};exports[_0x86d3('0x46')]=function(_0x4e10d9,_0x4ad164){return db['SquareProject'][_0x86d3('0x3a')]({'where':{'id':_0x4e10d9['params']['id']}})[_0x86d3('0x13')](handleEntityNotFound(_0x4ad164,null))[_0x86d3('0x13')](function(_0x1fbd25){if(_0x1fbd25){return _0x1fbd25[_0x86d3('0x46')](_0x4e10d9['body']['ids'],_['omit'](_0x4e10d9[_0x86d3('0x3c')],[_0x86d3('0x47'),'id'])||{});}})['then'](respondWithResult(_0x4ad164,null))[_0x86d3('0x37')](handleError(_0x4ad164,null));};exports[_0x86d3('0x48')]=function(_0xa085b2,_0x4584e5){return db[_0x86d3('0x1e')]['find']({'where':{'id':_0xa085b2[_0x86d3('0x39')]['id']}})[_0x86d3('0x13')](handleEntityNotFound(_0x4584e5,null))[_0x86d3('0x13')](function(_0x3c038b){if(_0x3c038b){return _0x3c038b['removeUsers'](_0xa085b2[_0x86d3('0x24')][_0x86d3('0x47')])['then'](function(){if(_[_0x86d3('0x49')](_0xa085b2[_0x86d3('0x24')][_0x86d3('0x47')])){for(var _0x29bdee=0x0;_0x29bdee<_0xa085b2[_0x86d3('0x24')][_0x86d3('0x47')][_0x86d3('0x2a')];_0x29bdee+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0xa085b2[_0x86d3('0x24')]['ids'][_0x29bdee]),'SquareProjectId':Number(_0xa085b2['params']['id'])});}}else{socket['emit'](_0x86d3('0x4a'),{'UserId':Number(_0xa085b2['query'][_0x86d3('0x47')]),'SquareProjectId':Number(_0xa085b2['params']['id'])});}});}})[_0x86d3('0x13')](respondWithStatusCode(_0x4584e5,null))[_0x86d3('0x37')](handleError(_0x4584e5,null));};exports[_0x86d3('0x4b')]=function(_0x4797b5,_0x4c3e66){var _0x4639bb={};var _0xf2c179={};var _0x1864bd;var _0x202c2a;return db[_0x86d3('0x1e')][_0x86d3('0x4c')]({'where':{'id':_0x4797b5[_0x86d3('0x39')]['id']}})[_0x86d3('0x13')](handleEntityNotFound(_0x4c3e66,null))[_0x86d3('0x13')](function(_0x1285a4){if(_0x1285a4){_0x1864bd=_0x1285a4;_0xf2c179[_0x86d3('0x22')]=_[_0x86d3('0x25')](db[_0x86d3('0x4d')][_0x86d3('0x4e')]);_0xf2c179[_0x86d3('0x24')]=_[_0x86d3('0x25')](_0x4797b5[_0x86d3('0x24')]);_0xf2c179[_0x86d3('0x26')]=_['intersection'](_0xf2c179[_0x86d3('0x22')],_0xf2c179[_0x86d3('0x24')]);_0x4639bb[_0x86d3('0x29')]=_['intersection'](_0xf2c179[_0x86d3('0x22')],qs[_0x86d3('0x28')](_0x4797b5[_0x86d3('0x24')][_0x86d3('0x28')]));_0x4639bb['attributes']=_0x4639bb[_0x86d3('0x29')]['length']?_0x4639bb[_0x86d3('0x29')]:_0xf2c179[_0x86d3('0x22')];_0x4639bb[_0x86d3('0x2d')]=qs[_0x86d3('0x2e')](_0x4797b5[_0x86d3('0x24')]['sort']);_0x4639bb[_0x86d3('0x2f')]=qs['filters'](_[_0x86d3('0x44')](_0x4797b5[_0x86d3('0x24')],_0xf2c179['filters']));if(_0x4797b5[_0x86d3('0x24')][_0x86d3('0x4f')]){_0x4639bb[_0x86d3('0x2f')]=_[_0x86d3('0x30')](_0x4639bb[_0x86d3('0x2f')],{'$or':_[_0x86d3('0x23')](_0x4639bb[_0x86d3('0x29')],function(_0x5ee4a3){var _0x19f9e1={};_0x19f9e1[_0x5ee4a3]={'$like':'%'+_0x4797b5[_0x86d3('0x24')][_0x86d3('0x4f')]+'%'};return _0x19f9e1;})});}_0x4639bb=_[_0x86d3('0x30')]({},_0x4639bb,_0x4797b5[_0x86d3('0x32')]);return _0x1864bd['getUsers'](_0x4639bb);}})[_0x86d3('0x13')](function(_0x9444e5){if(_0x9444e5){_0x202c2a=_0x9444e5['length'];if(!_0x4797b5[_0x86d3('0x24')][_0x86d3('0x2b')](_0x86d3('0x2c'))){_0x4639bb[_0x86d3('0xd')]=qs[_0x86d3('0xd')](_0x4797b5[_0x86d3('0x24')][_0x86d3('0xd')]);_0x4639bb[_0x86d3('0xc')]=qs[_0x86d3('0xc')](_0x4797b5[_0x86d3('0x24')][_0x86d3('0xc')]);}return _0x1864bd[_0x86d3('0x4b')](_0x4639bb);}})[_0x86d3('0x13')](function(_0xab8a80){if(_0xab8a80){return _0xab8a80?{'count':_0x202c2a,'rows':_0xab8a80}:null;}})['then'](respondWithResult(_0x4c3e66,null))[_0x86d3('0x37')](handleError(_0x4c3e66,null));}; \ No newline at end of file +var _0x0598=['autoAssociation','body','destroy','addUsers','ids','isArray','emit','getUsers','User','nolimit','lodash','ioredis','../../config/logger','../../mysqldb','redis','socket.io-emitter','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','update','then','get','UserProfileResource','publish','agi','stringify','end','error','name','send','map','SquareProject','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','VIRTUAL','options','where','include','findAll','params','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection'];(function(_0x124926,_0x42eb6b){var _0x5eb241=function(_0x53a498){while(--_0x53a498){_0x124926['push'](_0x124926['shift']());}};_0x5eb241(++_0x42eb6b);}(_0x0598,0x92));var _0x8059=function(_0x373044,_0x247089){_0x373044=_0x373044-0x0;var _0x5e1b13=_0x0598[_0x373044];return _0x5e1b13;};'use strict';var _=require(_0x8059('0x0'));var Redis=require(_0x8059('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x8059('0x2'))('api');var config=require('../../config/environment');var db=require(_0x8059('0x3'))['db'];config[_0x8059('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8059('0x5'))(new Redis(config[_0x8059('0x4')]));require('./squareProject.socket')['register'](socket);function respondWithStatusCode(_0x248273,_0x347f1b){_0x347f1b=_0x347f1b||0xcc;return function(_0x4610d2){if(_0x4610d2){return _0x248273[_0x8059('0x6')](_0x347f1b);}return _0x248273['status'](_0x347f1b)['end']();};}function respondWithResult(_0x89dda1,_0x1bf5fd){_0x1bf5fd=_0x1bf5fd||0xc8;return function(_0x336f85){if(_0x336f85){return _0x89dda1[_0x8059('0x7')](_0x1bf5fd)[_0x8059('0x8')](_0x336f85);}};}function respondWithFilteredResult(_0x52a60d,_0x551d9e){return function(_0x2a60d7){if(_0x2a60d7){var _0x4109a9=typeof _0x551d9e['offset']==='undefined'&&typeof _0x551d9e['limit']===_0x8059('0x9');var _0x2d26e2=_0x2a60d7[_0x8059('0xa')];var _0x12d6ce=_0x4109a9?0x0:_0x551d9e[_0x8059('0xb')];var _0x4eb4c5=_0x4109a9?_0x2a60d7[_0x8059('0xa')]:_0x551d9e['offset']+_0x551d9e[_0x8059('0xc')];var _0x5c916e;if(_0x4eb4c5>=_0x2d26e2){_0x4eb4c5=_0x2d26e2;_0x5c916e=0xc8;}else{_0x5c916e=0xce;}_0x52a60d[_0x8059('0x7')](_0x5c916e);return _0x52a60d[_0x8059('0xd')](_0x8059('0xe'),_0x12d6ce+'-'+_0x4eb4c5+'/'+_0x2d26e2)['json'](_0x2a60d7);}return null;};}function saveUpdates(_0x516c1f){return function(_0x5cda43){if(_0x5cda43){return _0x5cda43[_0x8059('0xf')](_0x516c1f)[_0x8059('0x10')](function(_0x2ffebf){return _0x2ffebf;});}return null;};}function removeEntity(_0x246c9d){return function(_0x3abfe8){if(_0x3abfe8){return _0x3abfe8['destroy']()[_0x8059('0x10')](function(){var _0x2bb670=_0x3abfe8[_0x8059('0x11')]({'plain':!![]});var _0x1c4566='SquareProjects';return db[_0x8059('0x12')]['destroy']({'where':{'type':_0x1c4566,'resourceId':_0x2bb670['id']}})[_0x8059('0x10')](function(){return _0x3abfe8;});})['then'](function(){var _0x1857c1=new Redis(config['redis']);_0x1857c1[_0x8059('0x13')](_0x8059('0x14'),JSON[_0x8059('0x15')]({'id':_0x3abfe8['id'],'deleted':!![]}));})['then'](function(){_0x246c9d['status'](0xcc)[_0x8059('0x16')]();});}};}function handleEntityNotFound(_0x232f1b){return function(_0x32aeda){if(!_0x32aeda){_0x232f1b[_0x8059('0x6')](0x194);}return _0x32aeda;};}function handleError(_0x4c6234,_0x3bc226){_0x3bc226=_0x3bc226||0x1f4;return function(_0x21ac82){logger[_0x8059('0x17')](_0x21ac82['stack']);if(_0x21ac82[_0x8059('0x18')]){delete _0x21ac82[_0x8059('0x18')];}_0x4c6234[_0x8059('0x7')](_0x3bc226)[_0x8059('0x19')](_0x21ac82);};}exports['index']=function(_0x140f64,_0x2cd179){var _0x4781e2={},_0x3e2d2b={},_0x202b30={'count':0x0,'rows':[]};var _0x54b88b=_[_0x8059('0x1a')](db[_0x8059('0x1b')][_0x8059('0x1c')],function(_0x4a294f){return{'name':_0x4a294f['fieldName'],'type':_0x4a294f['type'][_0x8059('0x1d')]};});_0x3e2d2b[_0x8059('0x1e')]=_[_0x8059('0x1a')](_0x54b88b,_0x8059('0x18'));_0x3e2d2b['query']=_[_0x8059('0x1f')](_0x140f64['query']);_0x3e2d2b[_0x8059('0x20')]=_[_0x8059('0x21')](_0x3e2d2b['model'],_0x3e2d2b[_0x8059('0x22')]);_0x4781e2[_0x8059('0x23')]=_[_0x8059('0x21')](_0x3e2d2b[_0x8059('0x1e')],qs[_0x8059('0x24')](_0x140f64[_0x8059('0x22')][_0x8059('0x24')]));_0x4781e2[_0x8059('0x23')]=_0x4781e2['attributes'][_0x8059('0x25')]?_0x4781e2[_0x8059('0x23')]:_0x3e2d2b[_0x8059('0x1e')];if(!_0x140f64[_0x8059('0x22')][_0x8059('0x26')]('nolimit')){_0x4781e2[_0x8059('0xc')]=qs[_0x8059('0xc')](_0x140f64[_0x8059('0x22')][_0x8059('0xc')]);_0x4781e2[_0x8059('0xb')]=qs[_0x8059('0xb')](_0x140f64[_0x8059('0x22')][_0x8059('0xb')]);}_0x4781e2[_0x8059('0x27')]=qs[_0x8059('0x28')](_0x140f64['query'][_0x8059('0x28')]);_0x4781e2['where']=qs[_0x8059('0x20')](_['pick'](_0x140f64['query'],_0x3e2d2b[_0x8059('0x20')]),_0x54b88b);if(_0x140f64['query'][_0x8059('0x29')]){_0x4781e2['where']=_[_0x8059('0x2a')](_0x4781e2['where'],{'$or':_[_0x8059('0x1a')](_0x54b88b,function(_0x5c4aa0){if(_0x5c4aa0['type']!==_0x8059('0x2b')){var _0x7961af={};_0x7961af[_0x5c4aa0[_0x8059('0x18')]]={'$like':'%'+_0x140f64['query'][_0x8059('0x29')]+'%'};return _0x7961af;}})});}_0x4781e2=_['merge']({},_0x4781e2,_0x140f64[_0x8059('0x2c')]);var _0x50a685={'where':_0x4781e2[_0x8059('0x2d')]};return db[_0x8059('0x1b')][_0x8059('0xa')](_0x50a685)[_0x8059('0x10')](function(_0x4db4e1){_0x202b30[_0x8059('0xa')]=_0x4db4e1;if(_0x140f64['query']['includeAll']){_0x4781e2[_0x8059('0x2e')]=[{'all':!![]}];}return db[_0x8059('0x1b')][_0x8059('0x2f')](_0x4781e2);})[_0x8059('0x10')](function(_0x2f68b0){_0x202b30['rows']=_0x2f68b0;return _0x202b30;})['then'](respondWithFilteredResult(_0x2cd179,_0x4781e2))['catch'](handleError(_0x2cd179,null));};exports['show']=function(_0x373e10,_0x126ec1){var _0xc84f04={'raw':![],'where':{'id':_0x373e10[_0x8059('0x30')]['id']}},_0x4a0323={};_0x4a0323[_0x8059('0x1e')]=_['keys'](db[_0x8059('0x1b')][_0x8059('0x1c')]);_0x4a0323[_0x8059('0x22')]=_['keys'](_0x373e10[_0x8059('0x22')]);_0x4a0323[_0x8059('0x20')]=_['intersection'](_0x4a0323[_0x8059('0x1e')],_0x4a0323[_0x8059('0x22')]);_0xc84f04[_0x8059('0x23')]=_[_0x8059('0x21')](_0x4a0323[_0x8059('0x1e')],qs[_0x8059('0x24')](_0x373e10[_0x8059('0x22')][_0x8059('0x24')]));_0xc84f04[_0x8059('0x23')]=_0xc84f04[_0x8059('0x23')][_0x8059('0x25')]?_0xc84f04[_0x8059('0x23')]:_0x4a0323[_0x8059('0x1e')];if(_0x373e10[_0x8059('0x22')][_0x8059('0x31')]){_0xc84f04[_0x8059('0x2e')]=[{'all':!![]}];}_0xc84f04=_[_0x8059('0x2a')]({},_0xc84f04,_0x373e10[_0x8059('0x2c')]);return db[_0x8059('0x1b')][_0x8059('0x32')](_0xc84f04)[_0x8059('0x10')](handleEntityNotFound(_0x126ec1,null))[_0x8059('0x10')](respondWithResult(_0x126ec1,null))[_0x8059('0x33')](handleError(_0x126ec1,null));};exports['create']=function(_0x38ec09,_0x5655d9){return db['SquareProject'][_0x8059('0x34')](_0x38ec09['body'],{})[_0x8059('0x10')](function(_0x5e5c2c){var _0xf4bc19=_0x38ec09[_0x8059('0x35')][_0x8059('0x11')]({'plain':!![]});if(!_0xf4bc19)throw new Error(_0x8059('0x36'));if(_0xf4bc19[_0x8059('0x37')]===_0x8059('0x35')){var _0x538ab6=_0x5e5c2c[_0x8059('0x11')]({'plain':!![]});var _0x518517=_0x8059('0x38');return db[_0x8059('0x39')][_0x8059('0x32')]({'where':{'name':_0x518517,'userProfileId':_0xf4bc19['userProfileId']},'raw':!![]})[_0x8059('0x10')](function(_0x120665){if(_0x120665&&_0x120665[_0x8059('0x3a')]===0x0){return db[_0x8059('0x12')]['create']({'name':_0x538ab6[_0x8059('0x18')],'resourceId':_0x538ab6['id'],'type':_0x120665[_0x8059('0x18')],'sectionId':_0x120665['id']},{})[_0x8059('0x10')](function(){return _0x5e5c2c;});}else{return _0x5e5c2c;}})['catch'](function(_0x2ba3f1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ba3f1);throw _0x2ba3f1;});}return _0x5e5c2c;})[_0x8059('0x10')](respondWithResult(_0x5655d9,0xc9))['catch'](handleError(_0x5655d9,null));};exports[_0x8059('0xf')]=function(_0x54d2d2,_0x261967){if(_0x54d2d2[_0x8059('0x3b')]['id']){delete _0x54d2d2['body']['id'];}return db[_0x8059('0x1b')]['find']({'where':{'id':_0x54d2d2[_0x8059('0x30')]['id']}})[_0x8059('0x10')](handleEntityNotFound(_0x261967,null))[_0x8059('0x10')](saveUpdates(_0x54d2d2['body'],null))[_0x8059('0x10')](function(_0x5035a9){if(!_0x5035a9)return;var _0x21ceef=_0x5035a9[_0x8059('0x11')]({'plain':!![]});return _0x21ceef;})[_0x8059('0x10')](function(_0xb63fee){var _0x48ab33=new Redis(config[_0x8059('0x4')]);_0x48ab33[_0x8059('0x13')]('agi',JSON[_0x8059('0x15')](_['pick'](_0xb63fee,['id',_0x8059('0x18'),'production'])));return _0xb63fee;})['then'](respondWithResult(_0x261967,null))[_0x8059('0x33')](handleError(_0x261967,null));};exports[_0x8059('0x3c')]=function(_0x15ed31,_0x3afe66){return db[_0x8059('0x1b')][_0x8059('0x32')]({'where':{'id':_0x15ed31[_0x8059('0x30')]['id']}})['then'](handleEntityNotFound(_0x3afe66,null))['then'](removeEntity(_0x3afe66,null))['catch'](handleError(_0x3afe66,null));};exports['addUsers']=function(_0x37c254,_0x21d53c){return db['SquareProject'][_0x8059('0x32')]({'where':{'id':_0x37c254['params']['id']}})['then'](handleEntityNotFound(_0x21d53c,null))[_0x8059('0x10')](function(_0x55cb8d){if(_0x55cb8d){return _0x55cb8d[_0x8059('0x3d')](_0x37c254[_0x8059('0x3b')][_0x8059('0x3e')],_['omit'](_0x37c254['body'],[_0x8059('0x3e'),'id'])||{});}})[_0x8059('0x10')](respondWithResult(_0x21d53c,null))[_0x8059('0x33')](handleError(_0x21d53c,null));};exports['removeUsers']=function(_0x501f2c,_0x1260b1){return db['SquareProject']['find']({'where':{'id':_0x501f2c[_0x8059('0x30')]['id']}})['then'](handleEntityNotFound(_0x1260b1,null))[_0x8059('0x10')](function(_0x1c4015){if(_0x1c4015){return _0x1c4015['removeUsers'](_0x501f2c['query'][_0x8059('0x3e')])[_0x8059('0x10')](function(){if(_[_0x8059('0x3f')](_0x501f2c['query'][_0x8059('0x3e')])){for(var _0x4452ab=0x0;_0x4452ab<_0x501f2c[_0x8059('0x22')][_0x8059('0x3e')]['length'];_0x4452ab+=0x1){socket[_0x8059('0x40')]('userSquareProject:remove',{'UserId':Number(_0x501f2c[_0x8059('0x22')][_0x8059('0x3e')][_0x4452ab]),'SquareProjectId':Number(_0x501f2c['params']['id'])});}}else{socket[_0x8059('0x40')]('userSquareProject:remove',{'UserId':Number(_0x501f2c[_0x8059('0x22')][_0x8059('0x3e')]),'SquareProjectId':Number(_0x501f2c[_0x8059('0x30')]['id'])});}});}})[_0x8059('0x10')](respondWithStatusCode(_0x1260b1,null))[_0x8059('0x33')](handleError(_0x1260b1,null));};exports[_0x8059('0x41')]=function(_0x28b466,_0x410bf4){var _0x352e51={};var _0x471cb3={};var _0x4449b3;var _0x20e9d7;return db[_0x8059('0x1b')]['findOne']({'where':{'id':_0x28b466[_0x8059('0x30')]['id']}})[_0x8059('0x10')](handleEntityNotFound(_0x410bf4,null))[_0x8059('0x10')](function(_0x421682){if(_0x421682){_0x4449b3=_0x421682;_0x471cb3[_0x8059('0x1e')]=_['keys'](db[_0x8059('0x42')][_0x8059('0x1c')]);_0x471cb3[_0x8059('0x22')]=_[_0x8059('0x1f')](_0x28b466[_0x8059('0x22')]);_0x471cb3[_0x8059('0x20')]=_[_0x8059('0x21')](_0x471cb3[_0x8059('0x1e')],_0x471cb3[_0x8059('0x22')]);_0x352e51['attributes']=_[_0x8059('0x21')](_0x471cb3[_0x8059('0x1e')],qs[_0x8059('0x24')](_0x28b466['query']['fields']));_0x352e51[_0x8059('0x23')]=_0x352e51[_0x8059('0x23')][_0x8059('0x25')]?_0x352e51[_0x8059('0x23')]:_0x471cb3[_0x8059('0x1e')];_0x352e51[_0x8059('0x27')]=qs[_0x8059('0x28')](_0x28b466['query'][_0x8059('0x28')]);_0x352e51[_0x8059('0x2d')]=qs[_0x8059('0x20')](_['pick'](_0x28b466[_0x8059('0x22')],_0x471cb3[_0x8059('0x20')]));if(_0x28b466[_0x8059('0x22')][_0x8059('0x29')]){_0x352e51['where']=_['merge'](_0x352e51[_0x8059('0x2d')],{'$or':_[_0x8059('0x1a')](_0x352e51['attributes'],function(_0x2662a5){var _0x1c19b0={};_0x1c19b0[_0x2662a5]={'$like':'%'+_0x28b466[_0x8059('0x22')][_0x8059('0x29')]+'%'};return _0x1c19b0;})});}_0x352e51=_[_0x8059('0x2a')]({},_0x352e51,_0x28b466[_0x8059('0x2c')]);return _0x4449b3['getUsers'](_0x352e51);}})[_0x8059('0x10')](function(_0x2cdcc4){if(_0x2cdcc4){_0x20e9d7=_0x2cdcc4[_0x8059('0x25')];if(!_0x28b466['query']['hasOwnProperty'](_0x8059('0x43'))){_0x352e51[_0x8059('0xc')]=qs['limit'](_0x28b466[_0x8059('0x22')][_0x8059('0xc')]);_0x352e51[_0x8059('0xb')]=qs[_0x8059('0xb')](_0x28b466[_0x8059('0x22')][_0x8059('0xb')]);}return _0x4449b3[_0x8059('0x41')](_0x352e51);}})[_0x8059('0x10')](function(_0x27a1ca){if(_0x27a1ca){return _0x27a1ca?{'count':_0x20e9d7,'rows':_0x27a1ca}:null;}})[_0x8059('0x10')](respondWithResult(_0x410bf4,null))[_0x8059('0x33')](handleError(_0x410bf4,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 5532f2f..471d097 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 _0x176e=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x6646f8,_0x4cddb3){var _0x9973c8=function(_0x3f5c16){while(--_0x3f5c16){_0x6646f8['push'](_0x6646f8['shift']());}};_0x9973c8(++_0x4cddb3);}(_0x176e,0x8f));var _0xe176=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x176e[_0x2b10c6];return _0x3789d2;};'use strict';var EventEmitter=require(_0xe176('0x0'));var SquareProject=require(_0xe176('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe176('0x2')](0x0);var events={'afterCreate':_0xe176('0x3'),'afterUpdate':_0xe176('0x4'),'afterDestroy':_0xe176('0x5')};function emitEvent(_0x36f6d5){return function(_0x2e5c2a,_0x483f4d,_0x416222){SquareProjectEvents[_0xe176('0x6')](_0x36f6d5+':'+_0x2e5c2a['id'],_0x2e5c2a);SquareProjectEvents[_0xe176('0x6')](_0x36f6d5,_0x2e5c2a);_0x416222(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xe176('0x7')](e,emitEvent(event));}}module[_0xe176('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x2920=['events','../../mysqldb','SquareProject','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4f59f1,_0x4e4090){var _0x372f8d=function(_0x35c767){while(--_0x35c767){_0x4f59f1['push'](_0x4f59f1['shift']());}};_0x372f8d(++_0x4e4090);}(_0x2920,0x80));var _0x0292=function(_0xde11ed,_0x40eaba){_0xde11ed=_0xde11ed-0x0;var _0x173b45=_0x2920[_0xde11ed];return _0x173b45;};'use strict';var EventEmitter=require(_0x0292('0x0'));var SquareProject=require(_0x0292('0x1'))['db'][_0x0292('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0292('0x3')};function emitEvent(_0x231af5){return function(_0x25949d,_0x49fd32,_0x5ca802){SquareProjectEvents[_0x0292('0x4')](_0x231af5+':'+_0x25949d['id'],_0x25949d);SquareProjectEvents['emit'](_0x231af5,_0x25949d);_0x5ca802(null);};}for(var e in events){if(events[_0x0292('0x5')](e)){var event=events[e];SquareProject[_0x0292('0x6')](e,emitEvent(event));}}module[_0x0292('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 7c9cdab..feff86c 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 _0x90bf=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareProject.attributes','exports','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash'];(function(_0x29c8db,_0x530f96){var _0x47a251=function(_0x2825a5){while(--_0x2825a5){_0x29c8db['push'](_0x29c8db['shift']());}};_0x47a251(++_0x530f96);}(_0x90bf,0x153));var _0xf90b=function(_0x5d0031,_0x3314fa){_0x5d0031=_0x5d0031-0x0;var _0x5c5468=_0x90bf[_0x5d0031];return _0x5c5468;};'use strict';var _=require(_0xf90b('0x0'));var util=require('util');var logger=require(_0xf90b('0x1'))(_0xf90b('0x2'));var moment=require(_0xf90b('0x3'));var BPromise=require(_0xf90b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf90b('0x5'));var config=require(_0xf90b('0x6'));var attributes=require(_0xf90b('0x7'));module[_0xf90b('0x8')]=function(_0x237004,_0x47e33e){return _0x237004['define']('SquareProject',attributes,{'tableName':_0xf90b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x548951,_0x366f42,_0x2353a6){if(_0x548951[_0xf90b('0xa')](_0xf90b('0xb'))){_0x548951[_0xf90b('0xc')]=moment()[_0xf90b('0xd')](_0xf90b('0xe'));}if(_0x548951[_0xf90b('0xa')](_0xf90b('0xf'))){_0x548951[_0xf90b('0x10')]=moment()[_0xf90b('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2353a6(null,_0x548951);}}});}; \ No newline at end of file +var _0x635c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports','SquareProject','square_projects','changed','savedAt','production','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x23a314,_0x3fe032){var _0x2dd093=function(_0x24a712){while(--_0x24a712){_0x23a314['push'](_0x23a314['shift']());}};_0x2dd093(++_0x3fe032);}(_0x635c,0x90));var _0xc635=function(_0x4cdaf6,_0xaa38b2){_0x4cdaf6=_0x4cdaf6-0x0;var _0x7f0c64=_0x635c[_0x4cdaf6];return _0x7f0c64;};'use strict';var _=require(_0xc635('0x0'));var util=require(_0xc635('0x1'));var logger=require(_0xc635('0x2'))(_0xc635('0x3'));var moment=require(_0xc635('0x4'));var BPromise=require('bluebird');var rp=require(_0xc635('0x5'));var fs=require('fs');var path=require(_0xc635('0x6'));var rimraf=require(_0xc635('0x7'));var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0xc635('0x8')]=function(_0x116e44,_0x105b45){return _0x116e44['define'](_0xc635('0x9'),attributes,{'tableName':_0xc635('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1e4456,_0x580203,_0x53b88c){if(_0x1e4456[_0xc635('0xb')]('preproduction')){_0x1e4456[_0xc635('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1e4456[_0xc635('0xb')](_0xc635('0xd'))){_0x1e4456['publishedAt']=moment()[_0xc635('0xe')](_0xc635('0xf'));}_0x53b88c(null,_0x1e4456);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index c98b67d..97310d0 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 _0xa2cf=['stringify','catch','message','error','find','then','ShowSquareProject','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','info','GetSquareProjects','debug'];(function(_0x32a9a2,_0x2ad91e){var _0x4140de=function(_0x224f55){while(--_0x224f55){_0x32a9a2['push'](_0x32a9a2['shift']());}};_0x4140de(++_0x2ad91e);}(_0xa2cf,0x7b));var _0xfa2c=function(_0x5d444c,_0x3470f1){_0x5d444c=_0x5d444c-0x0;var _0x1d3899=_0xa2cf[_0x5d444c];return _0x1d3899;};'use strict';var _=require('lodash');var Redis=require(_0xfa2c('0x0'));var db=require(_0xfa2c('0x1'))['db'];var logger=require(_0xfa2c('0x2'))(_0xfa2c('0x3'));var config=require(_0xfa2c('0x4'));config[_0xfa2c('0x5')]=_['defaults'](config[_0xfa2c('0x5')],{'host':_0xfa2c('0x6'),'port':0x18eb});var socket=require(_0xfa2c('0x7'))(new Redis(config['redis']));require(_0xfa2c('0x8'))['register'](socket);exports['GetSquareProjects']=function(_0x557818){var _0x1f1c6d=this;return new Promise(function(_0x3ee4c5,_0xd8f300){return db[_0xfa2c('0x9')][_0xfa2c('0xa')]({'raw':_0x557818[_0xfa2c('0xb')]?_0x557818[_0xfa2c('0xb')][_0xfa2c('0xc')]===undefined?!![]:![]:!![],'where':_0x557818[_0xfa2c('0xb')]?_0x557818['options'][_0xfa2c('0xd')]||null:null,'attributes':_0x557818[_0xfa2c('0xb')]?_0x557818[_0xfa2c('0xb')][_0xfa2c('0xe')]||null:null,'limit':_0x557818['options']?_0x557818[_0xfa2c('0xb')][_0xfa2c('0xf')]||null:null,'include':_0x557818[_0xfa2c('0xb')]?_0x557818[_0xfa2c('0xb')][_0xfa2c('0x10')]?_[_0xfa2c('0x11')](_0x557818[_0xfa2c('0xb')][_0xfa2c('0x10')],function(_0x57544f){return{'model':db[_0x57544f['model']],'as':_0x57544f['as'],'attributes':_0x57544f[_0xfa2c('0xe')],'include':_0x57544f['include']?_[_0xfa2c('0x11')](_0x57544f[_0xfa2c('0x10')],function(_0x4fce5c){return{'model':db[_0x4fce5c[_0xfa2c('0x12')]],'as':_0x4fce5c['as'],'attributes':_0x4fce5c['attributes'],'include':_0x4fce5c[_0xfa2c('0x10')]?_[_0xfa2c('0x11')](_0x4fce5c[_0xfa2c('0x10')],function(_0x336e93){return{'model':db[_0x336e93[_0xfa2c('0x12')]],'as':_0x336e93['as'],'attributes':_0x336e93[_0xfa2c('0xe')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14f617){logger[_0xfa2c('0x13')](_0xfa2c('0x14'),_0x557818);logger[_0xfa2c('0x15')](_0xfa2c('0x14'),_0x557818,JSON[_0xfa2c('0x16')](_0x14f617));_0x3ee4c5(_0x14f617);})[_0xfa2c('0x17')](function(_0x4d8337){logger['error'](_0xfa2c('0x14'),_0x4d8337[_0xfa2c('0x18')],_0x557818);_0xd8f300(_0x1f1c6d[_0xfa2c('0x19')](0x1f4,_0x4d8337[_0xfa2c('0x18')]));});});};exports['ShowSquareProject']=function(_0x2ab409){var _0x2530bd=this;return new Promise(function(_0x578d37,_0x7ee1cf){return db[_0xfa2c('0x9')][_0xfa2c('0x1a')]({'raw':_0x2ab409['options']?_0x2ab409['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ab409[_0xfa2c('0xb')]?_0x2ab409['options'][_0xfa2c('0xd')]||null:null,'attributes':_0x2ab409['options']?_0x2ab409[_0xfa2c('0xb')]['attributes']||null:null,'include':_0x2ab409[_0xfa2c('0xb')]?_0x2ab409['options'][_0xfa2c('0x10')]?_[_0xfa2c('0x11')](_0x2ab409[_0xfa2c('0xb')]['include'],function(_0x3b8723){return{'model':db[_0x3b8723['model']],'as':_0x3b8723['as'],'attributes':_0x3b8723['attributes'],'include':_0x3b8723['include']?_[_0xfa2c('0x11')](_0x3b8723[_0xfa2c('0x10')],function(_0x24f987){return{'model':db[_0x24f987[_0xfa2c('0x12')]],'as':_0x24f987['as'],'attributes':_0x24f987[_0xfa2c('0xe')],'include':_0x24f987[_0xfa2c('0x10')]?_[_0xfa2c('0x11')](_0x24f987[_0xfa2c('0x10')],function(_0x3b96ab){return{'model':db[_0x3b96ab[_0xfa2c('0x12')]],'as':_0x3b96ab['as'],'attributes':_0x3b96ab[_0xfa2c('0xe')]};}):[]};}):[]};}):[]:[]})[_0xfa2c('0x1b')](function(_0x548be9){logger[_0xfa2c('0x13')](_0xfa2c('0x1c'),_0x2ab409);logger[_0xfa2c('0x15')](_0xfa2c('0x1c'),_0x2ab409,JSON[_0xfa2c('0x16')](_0x548be9));_0x578d37(_0x548be9);})[_0xfa2c('0x17')](function(_0xc246a){logger[_0xfa2c('0x19')](_0xfa2c('0x1c'),_0xc246a[_0xfa2c('0x18')],_0x2ab409);_0x7ee1cf(_0x2530bd[_0xfa2c('0x19')](0x1f4,_0xc246a['message']));});});}; \ No newline at end of file +var _0x8ebf=['attributes','limit','include','model','map','then','info','debug','stringify','catch','error','message','ShowSquareProject','SquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','redis','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','where'];(function(_0x531ca7,_0x3cc837){var _0x25d395=function(_0x2b5661){while(--_0x2b5661){_0x531ca7['push'](_0x531ca7['shift']());}};_0x25d395(++_0x3cc837);}(_0x8ebf,0x1b2));var _0xf8eb=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8ebf[_0x432682];return _0x463d05;};'use strict';var _=require(_0xf8eb('0x0'));var Redis=require(_0xf8eb('0x1'));var db=require(_0xf8eb('0x2'))['db'];var logger=require(_0xf8eb('0x3'))(_0xf8eb('0x4'));var config=require('../../config/environment');config[_0xf8eb('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf8eb('0x6'))(new Redis(config[_0xf8eb('0x5')]));require(_0xf8eb('0x7'))[_0xf8eb('0x8')](socket);exports[_0xf8eb('0x9')]=function(_0x34aea0){var _0x4a8b05=this;return new Promise(function(_0x4552ac,_0x51420a){return db['SquareProject'][_0xf8eb('0xa')]({'raw':_0x34aea0[_0xf8eb('0xb')]?_0x34aea0[_0xf8eb('0xb')][_0xf8eb('0xc')]===undefined?!![]:![]:!![],'where':_0x34aea0['options']?_0x34aea0[_0xf8eb('0xb')][_0xf8eb('0xd')]||null:null,'attributes':_0x34aea0[_0xf8eb('0xb')]?_0x34aea0[_0xf8eb('0xb')][_0xf8eb('0xe')]||null:null,'limit':_0x34aea0['options']?_0x34aea0[_0xf8eb('0xb')][_0xf8eb('0xf')]||null:null,'include':_0x34aea0['options']?_0x34aea0[_0xf8eb('0xb')][_0xf8eb('0x10')]?_['map'](_0x34aea0['options']['include'],function(_0x492ccd){return{'model':db[_0x492ccd[_0xf8eb('0x11')]],'as':_0x492ccd['as'],'attributes':_0x492ccd[_0xf8eb('0xe')],'include':_0x492ccd['include']?_[_0xf8eb('0x12')](_0x492ccd['include'],function(_0x1530b8){return{'model':db[_0x1530b8[_0xf8eb('0x11')]],'as':_0x1530b8['as'],'attributes':_0x1530b8[_0xf8eb('0xe')],'include':_0x1530b8['include']?_[_0xf8eb('0x12')](_0x1530b8[_0xf8eb('0x10')],function(_0x4c10b6){return{'model':db[_0x4c10b6[_0xf8eb('0x11')]],'as':_0x4c10b6['as'],'attributes':_0x4c10b6[_0xf8eb('0xe')]};}):[]};}):[]};}):[]:[]})[_0xf8eb('0x13')](function(_0x274aff){logger[_0xf8eb('0x14')](_0xf8eb('0x9'),_0x34aea0);logger[_0xf8eb('0x15')](_0xf8eb('0x9'),_0x34aea0,JSON[_0xf8eb('0x16')](_0x274aff));_0x4552ac(_0x274aff);})[_0xf8eb('0x17')](function(_0x199f1e){logger[_0xf8eb('0x18')](_0xf8eb('0x9'),_0x199f1e[_0xf8eb('0x19')],_0x34aea0);_0x51420a(_0x4a8b05['error'](0x1f4,_0x199f1e[_0xf8eb('0x19')]));});});};exports[_0xf8eb('0x1a')]=function(_0x498c15){var _0x3f1109=this;return new Promise(function(_0x4abe1f,_0x299a29){return db[_0xf8eb('0x1b')]['find']({'raw':_0x498c15[_0xf8eb('0xb')]?_0x498c15[_0xf8eb('0xb')][_0xf8eb('0xc')]===undefined?!![]:![]:!![],'where':_0x498c15[_0xf8eb('0xb')]?_0x498c15['options'][_0xf8eb('0xd')]||null:null,'attributes':_0x498c15['options']?_0x498c15['options'][_0xf8eb('0xe')]||null:null,'include':_0x498c15[_0xf8eb('0xb')]?_0x498c15[_0xf8eb('0xb')][_0xf8eb('0x10')]?_[_0xf8eb('0x12')](_0x498c15['options']['include'],function(_0x5399d5){return{'model':db[_0x5399d5[_0xf8eb('0x11')]],'as':_0x5399d5['as'],'attributes':_0x5399d5[_0xf8eb('0xe')],'include':_0x5399d5[_0xf8eb('0x10')]?_[_0xf8eb('0x12')](_0x5399d5[_0xf8eb('0x10')],function(_0x2e28dd){return{'model':db[_0x2e28dd[_0xf8eb('0x11')]],'as':_0x2e28dd['as'],'attributes':_0x2e28dd[_0xf8eb('0xe')],'include':_0x2e28dd[_0xf8eb('0x10')]?_[_0xf8eb('0x12')](_0x2e28dd[_0xf8eb('0x10')],function(_0x51e722){return{'model':db[_0x51e722[_0xf8eb('0x11')]],'as':_0x51e722['as'],'attributes':_0x51e722[_0xf8eb('0xe')]};}):[]};}):[]};}):[]:[]})[_0xf8eb('0x13')](function(_0x10e8cc){logger[_0xf8eb('0x14')]('ShowSquareProject',_0x498c15);logger[_0xf8eb('0x15')](_0xf8eb('0x1a'),_0x498c15,JSON[_0xf8eb('0x16')](_0x10e8cc));_0x4abe1f(_0x10e8cc);})[_0xf8eb('0x17')](function(_0x1f50fe){logger[_0xf8eb('0x18')]('ShowSquareProject',_0x1f50fe[_0xf8eb('0x19')],_0x498c15);_0x299a29(_0x3f1109[_0xf8eb('0x18')](0x1f4,_0x1f50fe[_0xf8eb('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 0389c66..92a9ff1 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 _0xda61=['emit','removeListener','register','squareProject:','./squareProject.events','save','remove','update'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xda61,0x1d4));var _0x1da6=function(_0x26427c,_0x385f09){_0x26427c=_0x26427c-0x0;var _0x40e152=_0xda61[_0x26427c];return _0x40e152;};'use strict';var SquareProjectEvents=require(_0x1da6('0x0'));var events=[_0x1da6('0x1'),_0x1da6('0x2'),_0x1da6('0x3')];function createListener(_0x1b9f74,_0x5f1a53){return function(_0x2ead00){_0x5f1a53[_0x1da6('0x4')](_0x1b9f74,_0x2ead00);};}function removeListener(_0x5ea635,_0x26e16c){return function(){SquareProjectEvents[_0x1da6('0x5')](_0x5ea635,_0x26e16c);};}exports[_0x1da6('0x6')]=function(_0x2a1669){for(var _0x4d83dd=0x0,_0x3c00b6=events['length'];_0x4d83dd<_0x3c00b6;_0x4d83dd++){var _0x3c5d56=events[_0x4d83dd];var _0xbc104a=createListener(_0x1da6('0x7')+_0x3c5d56,_0x2a1669);SquareProjectEvents['on'](_0x3c5d56,_0xbc104a);}}; \ No newline at end of file +var _0x0f02=['update','emit','removeListener','register','length','squareProject:','save','remove'];(function(_0x31e123,_0x20e3e7){var _0x387415=function(_0xc4e749){while(--_0xc4e749){_0x31e123['push'](_0x31e123['shift']());}};_0x387415(++_0x20e3e7);}(_0x0f02,0x1ae));var _0x20f0=function(_0x25cf97,_0x327a9e){_0x25cf97=_0x25cf97-0x0;var _0x51d584=_0x0f02[_0x25cf97];return _0x51d584;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x20f0('0x0'),_0x20f0('0x1'),_0x20f0('0x2')];function createListener(_0x478e88,_0x2d2014){return function(_0x367bc7){_0x2d2014[_0x20f0('0x3')](_0x478e88,_0x367bc7);};}function removeListener(_0x3eea3b,_0x9a61eb){return function(){SquareProjectEvents[_0x20f0('0x4')](_0x3eea3b,_0x9a61eb);};}exports[_0x20f0('0x5')]=function(_0x4d3ca8){for(var _0x3102f2=0x0,_0x1171e9=events[_0x20f0('0x6')];_0x3102f2<_0x1171e9;_0x3102f2++){var _0xbce052=events[_0x3102f2];var _0x1d204c=createListener(_0x20f0('0x7')+_0xbce052,_0x4d3ca8);SquareProjectEvents['on'](_0xbce052,_0x1d204c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 162daeb..5d77ffa 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 _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x4071ac,_0x576967){var _0x5a4ae8=function(_0x6e9d72){while(--_0x6e9d72){_0x4071ac['push'](_0x4071ac['shift']());}};_0x5a4ae8(++_0x576967);}(_0x326f,0xd1));var _0xf326=function(_0x40b62c,_0x5d5a2e){_0x40b62c=_0x40b62c-0x0;var _0x5c138a=_0x326f[_0x40b62c];return _0x5c138a;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +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(_0x5c65e7,_0x5dc157){var _0x559132=function(_0x3856c5){while(--_0x3856c5){_0x5c65e7['push'](_0x5c65e7['shift']());}};_0x559132(++_0x5dc157);}(_0xf494,0x1c6));var _0x4f49=function(_0x283f68,_0x4cbc63){_0x283f68=_0x283f68-0x0;var _0x51b05b=_0xf494[_0x283f68];return _0x51b05b;};'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 8b82dda..49b6748 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 _0xabce=['sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','lastIndexOf'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xabce,0x103));var _0xeabc=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xabce[_0x257642];return _0x3d813b;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'uniqueid':{'type':Sequelize[_0xeabc('0x2')]},'callerid':{'type':Sequelize[_0xeabc('0x2')]},'calleridname':{'type':Sequelize[_0xeabc('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xeabc('0x2')]},'accountcode':{'type':Sequelize[_0xeabc('0x2')]},'dnid':{'type':Sequelize[_0xeabc('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xeabc('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xeabc('0x3')],'get':function(){var _0x52ede8='';var _0x3bdc29=this[_0xeabc('0x4')](_0xeabc('0x5'));if(_0x3bdc29){_0x52ede8=_0x3bdc29['substring'](_0x3bdc29[_0xeabc('0x6')]('.'));}return _0x52ede8;}}}; \ No newline at end of file +var _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x4bccaf,_0x4bdf3d){var _0x4458b2=function(_0x1c2f7b){while(--_0x1c2f7b){_0x4bccaf['push'](_0x4bccaf['shift']());}};_0x4458b2(++_0x4bdf3d);}(_0x2675,0x75));var _0x5267=function(_0x57eb96,_0x130f9d){_0x57eb96=_0x57eb96-0x0;var _0x13e34a=_0x2675[_0x57eb96];return _0x13e34a;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index a6c82e5..a898a20 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 _0x16db=['unlink','message','Not\x20found','Entity\x20not\x20found','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','info','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','apply','save','update','then','destroy','error','stack','send','index','SquareRecording','rawAttributes','type','key','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0x16db,0x12d));var _0xb16d=function(_0x1c6476,_0x438e0e){_0x1c6476=_0x1c6476-0x0;var _0x9b7648=_0x16db[_0x1c6476];return _0x9b7648;};'use strict';var emlformat=require(_0xb16d('0x0'));var rimraf=require(_0xb16d('0x1'));var zipdir=require(_0xb16d('0x2'));var jsonpatch=require(_0xb16d('0x3'));var rp=require('request-promise');var moment=require(_0xb16d('0x4'));var BPromise=require(_0xb16d('0x5'));var Mustache=require('mustache');var util=require(_0xb16d('0x6'));var path=require(_0xb16d('0x7'));var sox=require(_0xb16d('0x8'));var csv=require(_0xb16d('0x9'));var ejs=require(_0xb16d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb16d('0xb'));var squel=require(_0xb16d('0xc'));var crypto=require('crypto');var jsforce=require(_0xb16d('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb16d('0xe'));var Papa=require(_0xb16d('0xf'));var Redis=require(_0xb16d('0x10'));var authService=require(_0xb16d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb16d('0x12'));var hardwareService=require(_0xb16d('0x13'));var logger=require('../../config/logger')(_0xb16d('0x14'));var utils=require(_0xb16d('0x15'));var config=require(_0xb16d('0x16'));var licenseUtil=require(_0xb16d('0x17'));var db=require(_0xb16d('0x18'))['db'];function respondWithStatusCode(_0x129226,_0x1e0488){_0x1e0488=_0x1e0488||0xcc;return function(_0x43800d){if(_0x43800d){return _0x129226[_0xb16d('0x19')](_0x1e0488);}return _0x129226[_0xb16d('0x1a')](_0x1e0488)[_0xb16d('0x1b')]();};}function respondWithResult(_0x413843,_0x16207e){_0x16207e=_0x16207e||0xc8;return function(_0x22524d){if(_0x22524d){return _0x413843[_0xb16d('0x1a')](_0x16207e)[_0xb16d('0x1c')](_0x22524d);}};}function respondWithFilteredResult(_0x4ec8a0,_0x15eeb2){return function(_0x49d02a){if(_0x49d02a){var _0x11e634=typeof _0x15eeb2['offset']===_0xb16d('0x1d')&&typeof _0x15eeb2['limit']===_0xb16d('0x1d');var _0x369ed5=_0x49d02a['count'];var _0x1285a2=_0x11e634?0x0:_0x15eeb2[_0xb16d('0x1e')];var _0x271205=_0x11e634?_0x49d02a['count']:_0x15eeb2['offset']+_0x15eeb2[_0xb16d('0x1f')];var _0x1a1429;if(_0x271205>=_0x369ed5){_0x271205=_0x369ed5;_0x1a1429=0xc8;}else{_0x1a1429=0xce;}_0x4ec8a0[_0xb16d('0x1a')](_0x1a1429);return _0x4ec8a0[_0xb16d('0x20')]('Content-Range',_0x1285a2+'-'+_0x271205+'/'+_0x369ed5)['json'](_0x49d02a);}return null;};}function patchUpdates(_0x5c24b8){return function(_0xb80434){try{jsonpatch[_0xb16d('0x21')](_0xb80434,_0x5c24b8,!![]);}catch(_0x3cc65c){return BPromise['reject'](_0x3cc65c);}return _0xb80434[_0xb16d('0x22')]();};}function saveUpdates(_0x11fd69,_0x7b6a1a){return function(_0x3b595d){if(_0x3b595d){return _0x3b595d[_0xb16d('0x23')](_0x11fd69)[_0xb16d('0x24')](function(_0x4a6292){return _0x4a6292;});}return null;};}function removeEntity(_0x54474f,_0x5a581f){return function(_0x1eae0b){if(_0x1eae0b){return _0x1eae0b[_0xb16d('0x25')]()[_0xb16d('0x24')](function(){_0x54474f[_0xb16d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227ace,_0x3c44f1){return function(_0x227ff4){if(!_0x227ff4){_0x227ace[_0xb16d('0x19')](0x194);}return _0x227ff4;};}function handleError(_0x3ed795,_0x19e13a){_0x19e13a=_0x19e13a||0x1f4;return function(_0x40575c){logger[_0xb16d('0x26')](_0x40575c[_0xb16d('0x27')]);if(_0x40575c['name']){delete _0x40575c['name'];}_0x3ed795[_0xb16d('0x1a')](_0x19e13a)[_0xb16d('0x28')](_0x40575c);};}exports[_0xb16d('0x29')]=function(_0x5c5a92,_0x299773){var _0x4fe304={},_0xa25c84={},_0x2a20fc={'count':0x0,'rows':[]};var _0x571504=_['map'](db[_0xb16d('0x2a')][_0xb16d('0x2b')],function(_0x492305){return{'name':_0x492305['fieldName'],'type':_0x492305[_0xb16d('0x2c')][_0xb16d('0x2d')]};});_0xa25c84[_0xb16d('0x2e')]=_[_0xb16d('0x2f')](_0x571504,_0xb16d('0x30'));_0xa25c84['query']=_[_0xb16d('0x31')](_0x5c5a92[_0xb16d('0x32')]);_0xa25c84['filters']=_[_0xb16d('0x33')](_0xa25c84[_0xb16d('0x2e')],_0xa25c84[_0xb16d('0x32')]);_0x4fe304[_0xb16d('0x34')]=_[_0xb16d('0x33')](_0xa25c84['model'],qs[_0xb16d('0x35')](_0x5c5a92[_0xb16d('0x32')][_0xb16d('0x35')]));_0x4fe304[_0xb16d('0x34')]=_0x4fe304['attributes'][_0xb16d('0x36')]?_0x4fe304[_0xb16d('0x34')]:_0xa25c84[_0xb16d('0x2e')];if(!_0x5c5a92['query'][_0xb16d('0x37')](_0xb16d('0x38'))){_0x4fe304[_0xb16d('0x1f')]=qs['limit'](_0x5c5a92[_0xb16d('0x32')][_0xb16d('0x1f')]);_0x4fe304[_0xb16d('0x1e')]=qs['offset'](_0x5c5a92[_0xb16d('0x32')]['offset']);}_0x4fe304[_0xb16d('0x39')]=qs['sort'](_0x5c5a92['query'][_0xb16d('0x3a')]);_0x4fe304[_0xb16d('0x3b')]=qs[_0xb16d('0x3c')](_['pick'](_0x5c5a92[_0xb16d('0x32')],_0xa25c84[_0xb16d('0x3c')]),_0x571504);if(_0x5c5a92[_0xb16d('0x32')]['filter']){_0x4fe304[_0xb16d('0x3b')]=_[_0xb16d('0x3d')](_0x4fe304[_0xb16d('0x3b')],{'$or':_[_0xb16d('0x2f')](_0x571504,function(_0x6da568){if(_0x6da568[_0xb16d('0x2c')]!==_0xb16d('0x3e')){var _0x447c8f={};_0x447c8f[_0x6da568['name']]={'$like':'%'+_0x5c5a92['query'][_0xb16d('0x3f')]+'%'};return _0x447c8f;}})});}_0x4fe304=_['merge']({},_0x4fe304,_0x5c5a92[_0xb16d('0x40')]);var _0x3852cc={'where':_0x4fe304['where']};return db[_0xb16d('0x2a')][_0xb16d('0x41')](_0x3852cc)['then'](function(_0x39fad0){_0x2a20fc[_0xb16d('0x41')]=_0x39fad0;if(_0x5c5a92['query'][_0xb16d('0x42')]){_0x4fe304[_0xb16d('0x43')]=[{'all':!![]}];}return db[_0xb16d('0x2a')][_0xb16d('0x44')](_0x4fe304);})[_0xb16d('0x24')](function(_0x45aad2){_0x2a20fc[_0xb16d('0x45')]=_0x45aad2;return _0x2a20fc;})[_0xb16d('0x24')](respondWithFilteredResult(_0x299773,_0x4fe304))['catch'](handleError(_0x299773,null));};exports[_0xb16d('0x46')]=function(_0x4b3040,_0x577d9e){var _0x25db8f={'raw':!![],'where':{'id':_0x4b3040['params']['id']}},_0x516f8f={};_0x516f8f['model']=_['keys'](db[_0xb16d('0x2a')][_0xb16d('0x2b')]);_0x516f8f[_0xb16d('0x32')]=_[_0xb16d('0x31')](_0x4b3040[_0xb16d('0x32')]);_0x516f8f[_0xb16d('0x3c')]=_[_0xb16d('0x33')](_0x516f8f[_0xb16d('0x2e')],_0x516f8f[_0xb16d('0x32')]);_0x25db8f['attributes']=_['intersection'](_0x516f8f[_0xb16d('0x2e')],qs[_0xb16d('0x35')](_0x4b3040[_0xb16d('0x32')][_0xb16d('0x35')]));_0x25db8f['attributes']=_0x25db8f[_0xb16d('0x34')][_0xb16d('0x36')]?_0x25db8f['attributes']:_0x516f8f['model'];if(_0x4b3040[_0xb16d('0x32')][_0xb16d('0x42')]){_0x25db8f[_0xb16d('0x43')]=[{'all':!![]}];}_0x25db8f=_['merge']({},_0x25db8f,_0x4b3040[_0xb16d('0x40')]);return db['SquareRecording'][_0xb16d('0x47')](_0x25db8f)[_0xb16d('0x24')](handleEntityNotFound(_0x577d9e,null))[_0xb16d('0x24')](respondWithResult(_0x577d9e,null))[_0xb16d('0x48')](handleError(_0x577d9e,null));};exports[_0xb16d('0x49')]=function(_0x3c8bab,_0x330807){return db[_0xb16d('0x2a')][_0xb16d('0x49')](_0x3c8bab[_0xb16d('0x4a')],{})['then'](respondWithResult(_0x330807,0xc9))[_0xb16d('0x48')](handleError(_0x330807,null));};exports[_0xb16d('0x23')]=function(_0x1533f8,_0x42c35c){if(_0x1533f8[_0xb16d('0x4a')]['id']){delete _0x1533f8[_0xb16d('0x4a')]['id'];}return db['SquareRecording'][_0xb16d('0x47')]({'where':{'id':_0x1533f8[_0xb16d('0x4b')]['id']}})[_0xb16d('0x24')](handleEntityNotFound(_0x42c35c,null))['then'](saveUpdates(_0x1533f8['body'],null))['then'](respondWithResult(_0x42c35c,null))[_0xb16d('0x48')](handleError(_0x42c35c,null));};exports['download']=function(_0x3b2811,_0x22e05d,_0x4749f9){var _0x481872=require(_0xb16d('0x4c'));var _0x4038d6=![];var _0x299097={};if(_0x3b2811[_0xb16d('0x32')][_0xb16d('0x2c')]&&_0x3b2811[_0xb16d('0x32')][_0xb16d('0x2c')]===_0xb16d('0x4d')){_0x299097['uniqueid']=_0x3b2811[_0xb16d('0x4b')]['id'];}else{_0x299097['id']=_0x3b2811[_0xb16d('0x4b')]['id'];}return db['SquareRecording'][_0xb16d('0x47')]({'where':_0x299097,'attributes':['id',_0xb16d('0x4e'),_0xb16d('0x4f')],'raw':!![]})[_0xb16d('0x24')](handleEntityNotFound(_0x22e05d,null))[_0xb16d('0x24')](function(_0x42f588){if(_0x42f588){var _0x2e1ea8=_0x42f588[_0xb16d('0x4e')];var _0x39bed8=util[_0xb16d('0x50')](_0xb16d('0x51'),_0x2e1ea8);if(fs[_0xb16d('0x52')](_0x39bed8)){_0x4038d6=!![];return _0x481872['decryptFile'](_0x39bed8,_0x2e1ea8,config['secrets']['recording'])[_0xb16d('0x24')](function(){return _0x42f588;});}return _0x42f588;}})[_0xb16d('0x24')](function(_0x2d2c31){if(_0x2d2c31){var _0x2bfc96=_0x2d2c31['savePath'];if(!fs[_0xb16d('0x52')](_0x2bfc96)){throw new db[(_0xb16d('0x53'))][(_0xb16d('0x54'))](_0xb16d('0x55'));}if(_0x2d2c31[_0xb16d('0x4f')]){return _0x22e05d['download'](_0x2bfc96,_0x2d2c31[_0xb16d('0x4f')]+path[_0xb16d('0x56')](_0x2bfc96),function(){if(_0x4038d6){fs[_0xb16d('0x57')](_0x2bfc96);}});}else{return _0x22e05d['download'](_0x2bfc96,function(_0x2c0dcf){if(_0x4038d6){fs[_0xb16d('0x57')](_0x2bfc96);}});}}})[_0xb16d('0x48')](function(_0x28304f){if(_0x28304f[_0xb16d('0x58')]===_0xb16d('0x55')){_0x22e05d[_0xb16d('0x1a')](0x194)['send'](_0xb16d('0x59'));}else{return handleError(_0x22e05d,null);}});};exports[_0xb16d('0x25')]=function(_0xda6897,_0x595064){return db[_0xb16d('0x2a')][_0xb16d('0x47')]({'where':{'id':_0xda6897[_0xb16d('0x4b')]['id']}})['then'](function(_0x2e9633){if(_['isNil'](_0x2e9633)){throw new ReferenceError(_0xb16d('0x5a'));}return _0x2e9633;})[_0xb16d('0x24')](function(_0x1fcf2f){var _0x3aae22=_0x1fcf2f['savePath'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x3aae22);if(!_['isNil'](_0x1fcf2f['savePath'])&&fs[_0xb16d('0x52')](_0x3aae22)){logger['info'](_0xb16d('0x5b')+_0x3aae22+_0xb16d('0x5c'));fs['unlinkSync'](_0x3aae22);}_0x3aae22=_0x3aae22+_0xb16d('0x5d');if(!_[_0xb16d('0x5e')](_0x1fcf2f[_0xb16d('0x4e')])&&fs['existsSync'](_0x3aae22)){logger[_0xb16d('0x5f')]('File:\x20\x22'+_0x3aae22+_0xb16d('0x5c'));fs[_0xb16d('0x60')](_0x3aae22);}return _0x1fcf2f;})[_0xb16d('0x24')](function(_0xe7384a){if(!_0xe7384a)throw new InternalError();return _0xe7384a['destroy']();})[_0xb16d('0x24')](function(){_0x595064[_0xb16d('0x1a')](0xcc)[_0xb16d('0x1b')]();})['catch'](handleError(_0x595064,null));}; \ No newline at end of file +var _0x88e2=['path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','offset','limit','count','set','Content-Range','json','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SquareRecording','include','findAll','rows','catch','show','params','includeAll','options','create','body','download','uniqueid','find','savePath','filename','format','existsSync','decryptFile','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','end','eml-format','zip-dir','request-promise','moment','bluebird','util'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x88e2,0x10e));var _0x288e=function(_0x1d4ee6,_0x3b4c1e){_0x1d4ee6=_0x1d4ee6-0x0;var _0x510683=_0x88e2[_0x1d4ee6];return _0x510683;};'use strict';var emlformat=require(_0x288e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x288e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x288e('0x2'));var moment=require(_0x288e('0x3'));var BPromise=require(_0x288e('0x4'));var Mustache=require('mustache');var util=require(_0x288e('0x5'));var path=require(_0x288e('0x6'));var sox=require(_0x288e('0x7'));var csv=require(_0x288e('0x8'));var ejs=require(_0x288e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x288e('0xa'));var squel=require(_0x288e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x288e('0xc'));var toCsv=require(_0x288e('0x8'));var querystring=require(_0x288e('0xd'));var Papa=require(_0x288e('0xe'));var Redis=require(_0x288e('0xf'));var authService=require(_0x288e('0x10'));var qs=require(_0x288e('0x11'));var as=require(_0x288e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x288e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x288e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x288e('0x15'))['db'];function respondWithStatusCode(_0x13d9fb,_0xceb91){_0xceb91=_0xceb91||0xcc;return function(_0x3a7016){if(_0x3a7016){return _0x13d9fb['sendStatus'](_0xceb91);}return _0x13d9fb[_0x288e('0x16')](_0xceb91)['end']();};}function respondWithResult(_0x5599a1,_0x220689){_0x220689=_0x220689||0xc8;return function(_0x2e789e){if(_0x2e789e){return _0x5599a1['status'](_0x220689)['json'](_0x2e789e);}};}function respondWithFilteredResult(_0x37d8dc,_0x3d7650){return function(_0x4a9086){if(_0x4a9086){var _0x2207e8=typeof _0x3d7650[_0x288e('0x17')]==='undefined'&&typeof _0x3d7650[_0x288e('0x18')]==='undefined';var _0x4931f5=_0x4a9086[_0x288e('0x19')];var _0x21c47a=_0x2207e8?0x0:_0x3d7650[_0x288e('0x17')];var _0x5813f2=_0x2207e8?_0x4a9086['count']:_0x3d7650[_0x288e('0x17')]+_0x3d7650[_0x288e('0x18')];var _0x1388c7;if(_0x5813f2>=_0x4931f5){_0x5813f2=_0x4931f5;_0x1388c7=0xc8;}else{_0x1388c7=0xce;}_0x37d8dc[_0x288e('0x16')](_0x1388c7);return _0x37d8dc[_0x288e('0x1a')](_0x288e('0x1b'),_0x21c47a+'-'+_0x5813f2+'/'+_0x4931f5)[_0x288e('0x1c')](_0x4a9086);}return null;};}function patchUpdates(_0x919a89){return function(_0x1e554e){try{jsonpatch[_0x288e('0x1d')](_0x1e554e,_0x919a89,!![]);}catch(_0x4d27ed){return BPromise['reject'](_0x4d27ed);}return _0x1e554e['save']();};}function saveUpdates(_0x1258c9,_0x1831cf){return function(_0x3c9118){if(_0x3c9118){return _0x3c9118[_0x288e('0x1e')](_0x1258c9)[_0x288e('0x1f')](function(_0x334209){return _0x334209;});}return null;};}function removeEntity(_0x131aed,_0x4f5e38){return function(_0x1922ab){if(_0x1922ab){return _0x1922ab[_0x288e('0x20')]()[_0x288e('0x1f')](function(){_0x131aed[_0x288e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1090cc,_0x7427cc){return function(_0x1d2841){if(!_0x1d2841){_0x1090cc['sendStatus'](0x194);}return _0x1d2841;};}function handleError(_0x40c6f4,_0x2a0161){_0x2a0161=_0x2a0161||0x1f4;return function(_0x249ae3){logger[_0x288e('0x21')](_0x249ae3[_0x288e('0x22')]);if(_0x249ae3['name']){delete _0x249ae3[_0x288e('0x23')];}_0x40c6f4[_0x288e('0x16')](_0x2a0161)['send'](_0x249ae3);};}exports[_0x288e('0x24')]=function(_0x18d746,_0x27951d){var _0x5cd52d={},_0x2e55a3={},_0x489a43={'count':0x0,'rows':[]};var _0x102f92=_[_0x288e('0x25')](db['SquareRecording'][_0x288e('0x26')],function(_0x1ea531){return{'name':_0x1ea531['fieldName'],'type':_0x1ea531[_0x288e('0x27')]['key']};});_0x2e55a3[_0x288e('0x28')]=_[_0x288e('0x25')](_0x102f92,_0x288e('0x23'));_0x2e55a3[_0x288e('0x29')]=_[_0x288e('0x2a')](_0x18d746[_0x288e('0x29')]);_0x2e55a3[_0x288e('0x2b')]=_['intersection'](_0x2e55a3[_0x288e('0x28')],_0x2e55a3[_0x288e('0x29')]);_0x5cd52d[_0x288e('0x2c')]=_[_0x288e('0x2d')](_0x2e55a3[_0x288e('0x28')],qs[_0x288e('0x2e')](_0x18d746[_0x288e('0x29')][_0x288e('0x2e')]));_0x5cd52d['attributes']=_0x5cd52d['attributes'][_0x288e('0x2f')]?_0x5cd52d[_0x288e('0x2c')]:_0x2e55a3[_0x288e('0x28')];if(!_0x18d746['query'][_0x288e('0x30')](_0x288e('0x31'))){_0x5cd52d[_0x288e('0x18')]=qs[_0x288e('0x18')](_0x18d746[_0x288e('0x29')][_0x288e('0x18')]);_0x5cd52d['offset']=qs['offset'](_0x18d746['query']['offset']);}_0x5cd52d[_0x288e('0x32')]=qs['sort'](_0x18d746[_0x288e('0x29')][_0x288e('0x33')]);_0x5cd52d['where']=qs[_0x288e('0x2b')](_[_0x288e('0x34')](_0x18d746[_0x288e('0x29')],_0x2e55a3[_0x288e('0x2b')]),_0x102f92);if(_0x18d746['query'][_0x288e('0x35')]){_0x5cd52d[_0x288e('0x36')]=_[_0x288e('0x37')](_0x5cd52d['where'],{'$or':_[_0x288e('0x25')](_0x102f92,function(_0x2b21a8){if(_0x2b21a8[_0x288e('0x27')]!==_0x288e('0x38')){var _0x38fc5a={};_0x38fc5a[_0x2b21a8[_0x288e('0x23')]]={'$like':'%'+_0x18d746[_0x288e('0x29')][_0x288e('0x35')]+'%'};return _0x38fc5a;}})});}_0x5cd52d=_['merge']({},_0x5cd52d,_0x18d746['options']);var _0x5568d7={'where':_0x5cd52d[_0x288e('0x36')]};return db[_0x288e('0x39')]['count'](_0x5568d7)['then'](function(_0x52e55c){_0x489a43[_0x288e('0x19')]=_0x52e55c;if(_0x18d746['query']['includeAll']){_0x5cd52d[_0x288e('0x3a')]=[{'all':!![]}];}return db[_0x288e('0x39')][_0x288e('0x3b')](_0x5cd52d);})[_0x288e('0x1f')](function(_0x43082e){_0x489a43[_0x288e('0x3c')]=_0x43082e;return _0x489a43;})[_0x288e('0x1f')](respondWithFilteredResult(_0x27951d,_0x5cd52d))[_0x288e('0x3d')](handleError(_0x27951d,null));};exports[_0x288e('0x3e')]=function(_0x19c3c3,_0x17db21){var _0xf701b={'raw':!![],'where':{'id':_0x19c3c3[_0x288e('0x3f')]['id']}},_0x35b7e8={};_0x35b7e8['model']=_[_0x288e('0x2a')](db['SquareRecording']['rawAttributes']);_0x35b7e8[_0x288e('0x29')]=_[_0x288e('0x2a')](_0x19c3c3[_0x288e('0x29')]);_0x35b7e8[_0x288e('0x2b')]=_[_0x288e('0x2d')](_0x35b7e8['model'],_0x35b7e8[_0x288e('0x29')]);_0xf701b[_0x288e('0x2c')]=_[_0x288e('0x2d')](_0x35b7e8[_0x288e('0x28')],qs[_0x288e('0x2e')](_0x19c3c3[_0x288e('0x29')][_0x288e('0x2e')]));_0xf701b[_0x288e('0x2c')]=_0xf701b[_0x288e('0x2c')]['length']?_0xf701b[_0x288e('0x2c')]:_0x35b7e8[_0x288e('0x28')];if(_0x19c3c3[_0x288e('0x29')][_0x288e('0x40')]){_0xf701b[_0x288e('0x3a')]=[{'all':!![]}];}_0xf701b=_[_0x288e('0x37')]({},_0xf701b,_0x19c3c3[_0x288e('0x41')]);return db['SquareRecording']['find'](_0xf701b)[_0x288e('0x1f')](handleEntityNotFound(_0x17db21,null))[_0x288e('0x1f')](respondWithResult(_0x17db21,null))[_0x288e('0x3d')](handleError(_0x17db21,null));};exports['create']=function(_0x4ead54,_0x4cd7b8){return db[_0x288e('0x39')][_0x288e('0x42')](_0x4ead54[_0x288e('0x43')],{})['then'](respondWithResult(_0x4cd7b8,0xc9))[_0x288e('0x3d')](handleError(_0x4cd7b8,null));};exports[_0x288e('0x1e')]=function(_0x5b426b,_0x1fb4b3){if(_0x5b426b[_0x288e('0x43')]['id']){delete _0x5b426b[_0x288e('0x43')]['id'];}return db['SquareRecording']['find']({'where':{'id':_0x5b426b[_0x288e('0x3f')]['id']}})[_0x288e('0x1f')](handleEntityNotFound(_0x1fb4b3,null))['then'](saveUpdates(_0x5b426b['body'],null))[_0x288e('0x1f')](respondWithResult(_0x1fb4b3,null))[_0x288e('0x3d')](handleError(_0x1fb4b3,null));};exports[_0x288e('0x44')]=function(_0x897e1b,_0x26f767,_0x366296){var _0x41b5b6=require('../../components/encryptor');var _0x3d9860=![];var _0x5ec76b={};if(_0x897e1b['query']['type']&&_0x897e1b[_0x288e('0x29')][_0x288e('0x27')]===_0x288e('0x45')){_0x5ec76b[_0x288e('0x45')]=_0x897e1b[_0x288e('0x3f')]['id'];}else{_0x5ec76b['id']=_0x897e1b[_0x288e('0x3f')]['id'];}return db[_0x288e('0x39')][_0x288e('0x46')]({'where':_0x5ec76b,'attributes':['id',_0x288e('0x47'),_0x288e('0x48')],'raw':!![]})[_0x288e('0x1f')](handleEntityNotFound(_0x26f767,null))[_0x288e('0x1f')](function(_0x3f2ba2){if(_0x3f2ba2){var _0x8c5628=_0x3f2ba2[_0x288e('0x47')];var _0x3c30a5=util[_0x288e('0x49')]('%s.cypher',_0x8c5628);if(fs[_0x288e('0x4a')](_0x3c30a5)){_0x3d9860=!![];return _0x41b5b6[_0x288e('0x4b')](_0x3c30a5,_0x8c5628,config['secrets'][_0x288e('0x4c')])[_0x288e('0x1f')](function(){return _0x3f2ba2;});}return _0x3f2ba2;}})[_0x288e('0x1f')](function(_0x252ed6){if(_0x252ed6){var _0xd66a04=_0x252ed6[_0x288e('0x47')];if(!fs[_0x288e('0x4a')](_0xd66a04)){throw new db[(_0x288e('0x4d'))]['ValidationError'](_0x288e('0x4e'));}if(_0x252ed6[_0x288e('0x48')]){return _0x26f767['download'](_0xd66a04,_0x252ed6[_0x288e('0x48')]+path[_0x288e('0x4f')](_0xd66a04),function(){if(_0x3d9860){fs[_0x288e('0x50')](_0xd66a04);}});}else{return _0x26f767[_0x288e('0x44')](_0xd66a04,function(_0x4d4259){if(_0x3d9860){fs[_0x288e('0x50')](_0xd66a04);}});}}})[_0x288e('0x3d')](function(_0x34e66d){if(_0x34e66d[_0x288e('0x51')]===_0x288e('0x4e')){_0x26f767[_0x288e('0x16')](0x194)[_0x288e('0x52')](_0x288e('0x53'));}else{return handleError(_0x26f767,null);}});};exports[_0x288e('0x20')]=function(_0xe9960,_0x506911){return db[_0x288e('0x39')]['find']({'where':{'id':_0xe9960[_0x288e('0x3f')]['id']}})[_0x288e('0x1f')](function(_0x50a8c4){if(_[_0x288e('0x54')](_0x50a8c4)){throw new ReferenceError(_0x288e('0x55'));}return _0x50a8c4;})['then'](function(_0x1079a3){var _0x3e4b37=_0x1079a3['savePath'];logger[_0x288e('0x56')](_0x288e('0x57'),_0x3e4b37);if(!_[_0x288e('0x54')](_0x1079a3[_0x288e('0x47')])&&fs[_0x288e('0x4a')](_0x3e4b37)){logger[_0x288e('0x56')](_0x288e('0x58')+_0x3e4b37+_0x288e('0x59'));fs['unlinkSync'](_0x3e4b37);}_0x3e4b37=_0x3e4b37+_0x288e('0x5a');if(!_[_0x288e('0x54')](_0x1079a3[_0x288e('0x47')])&&fs[_0x288e('0x4a')](_0x3e4b37)){logger[_0x288e('0x56')]('File:\x20\x22'+_0x3e4b37+_0x288e('0x59'));fs['unlinkSync'](_0x3e4b37);}return _0x1079a3;})[_0x288e('0x1f')](function(_0x163ea2){if(!_0x163ea2)throw new InternalError();return _0x163ea2[_0x288e('0x20')]();})[_0x288e('0x1f')](function(){_0x506911[_0x288e('0x16')](0xcc)[_0x288e('0x5b')]();})[_0x288e('0x3d')](handleError(_0x506911,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1f2a84d..36ae115 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 _0x8cad=['SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x1a8572,_0x24b459){var _0x5888ee=function(_0x96aa8){while(--_0x96aa8){_0x1a8572['push'](_0x1a8572['shift']());}};_0x5888ee(++_0x24b459);}(_0x8cad,0xfe));var _0xd8ca=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x8cad[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xd8ca('0x0'));var util=require(_0xd8ca('0x1'));var logger=require(_0xd8ca('0x2'))(_0xd8ca('0x3'));var moment=require(_0xd8ca('0x4'));var BPromise=require(_0xd8ca('0x5'));var rp=require(_0xd8ca('0x6'));var fs=require('fs');var path=require(_0xd8ca('0x7'));var rimraf=require(_0xd8ca('0x8'));var config=require(_0xd8ca('0x9'));var attributes=require(_0xd8ca('0xa'));module[_0xd8ca('0xb')]=function(_0x14c73e,_0x6d5070){return _0x14c73e['define'](_0xd8ca('0xc'),attributes,{'tableName':_0xd8ca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc962=['square_recordings','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x442b41,_0x22dc53){var _0x140d06=function(_0x5afa6d){while(--_0x5afa6d){_0x442b41['push'](_0x442b41['shift']());}};_0x140d06(++_0x22dc53);}(_0xc962,0x6d));var _0x2c96=function(_0x49c852,_0x315ad0){_0x49c852=_0x49c852-0x0;var _0xbdec25=_0xc962[_0x49c852];return _0xbdec25;};'use strict';var _=require(_0x2c96('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2c96('0x1'));var BPromise=require(_0x2c96('0x2'));var rp=require(_0x2c96('0x3'));var fs=require('fs');var path=require(_0x2c96('0x4'));var rimraf=require(_0x2c96('0x5'));var config=require(_0x2c96('0x6'));var attributes=require(_0x2c96('0x7'));module[_0x2c96('0x8')]=function(_0x599a47,_0x1b7ca9){return _0x599a47[_0x2c96('0x9')](_0x2c96('0xa'),attributes,{'tableName':_0x2c96('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index ee1a5a8..e9fbc38 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 _0xb9d2=['options','raw','CreateSquareRecording','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','SquareRecording','body'];(function(_0xe6dd0f,_0x5b731a){var _0x169450=function(_0x3bfe80){while(--_0x3bfe80){_0xe6dd0f['push'](_0xe6dd0f['shift']());}};_0x169450(++_0x5b731a);}(_0xb9d2,0x1d7));var _0x2b9d=function(_0x21fec0,_0x2f9a99){_0x21fec0=_0x21fec0-0x0;var _0xcf272e=_0xb9d2[_0x21fec0];return _0xcf272e;};'use strict';var _=require('lodash');var util=require(_0x2b9d('0x0'));var moment=require(_0x2b9d('0x1'));var BPromise=require(_0x2b9d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2b9d('0x3'));var logger=require(_0x2b9d('0x4'))(_0x2b9d('0x5'));var config=require(_0x2b9d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2b9d('0x7')][_0x2b9d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa4dc17,_0x253430,_0x50d5b1){return new BPromise(function(_0xcbffcc,_0x26d3d0){return client[_0x2b9d('0x9')](_0xa4dc17,_0x50d5b1)[_0x2b9d('0xa')](function(_0xe645c6){logger['info'](_0x2b9d('0xb'),_0x253430,_0x2b9d('0xc'));logger[_0x2b9d('0xd')](_0x2b9d('0xe'),_0x253430,_0x2b9d('0xc'),JSON[_0x2b9d('0xf')](_0xe645c6));if(_0xe645c6[_0x2b9d('0x10')]){if(_0xe645c6[_0x2b9d('0x10')]['code']===0x1f4){logger[_0x2b9d('0x10')](_0x2b9d('0xb'),_0x253430,_0xe645c6[_0x2b9d('0x10')][_0x2b9d('0x11')]);return _0x26d3d0(_0xe645c6[_0x2b9d('0x10')][_0x2b9d('0x11')]);}logger[_0x2b9d('0x10')](_0x2b9d('0xb'),_0x253430,_0xe645c6['error']['message']);return _0xcbffcc(_0xe645c6[_0x2b9d('0x10')][_0x2b9d('0x11')]);}else{logger[_0x2b9d('0x12')](_0x2b9d('0xb'),_0x253430,_0x2b9d('0xc'));_0xcbffcc(_0xe645c6[_0x2b9d('0x13')][_0x2b9d('0x11')]);}})[_0x2b9d('0x14')](function(_0x1f2b49){logger[_0x2b9d('0x10')]('SquareRecording,\x20%s,\x20%s',_0x253430,_0x1f2b49);_0x26d3d0(_0x1f2b49);});});}exports['CreateSquareRecording']=function(_0x440576){var _0x4d7242=this;return new Promise(function(_0x6de6c4,_0x458560){return db[_0x2b9d('0x15')]['create'](_0x440576[_0x2b9d('0x16')],{'raw':_0x440576['options']?_0x440576[_0x2b9d('0x17')][_0x2b9d('0x18')]===undefined?!![]:![]:!![]})[_0x2b9d('0xa')](function(_0x6f7428){logger[_0x2b9d('0x12')]('CreateSquareRecording',_0x440576);logger[_0x2b9d('0xd')](_0x2b9d('0x19'),_0x440576,JSON[_0x2b9d('0xf')](_0x6f7428));_0x6de6c4(_0x6f7428);})[_0x2b9d('0x14')](function(_0x140e31){logger[_0x2b9d('0x10')]('CreateSquareRecording',_0x140e31[_0x2b9d('0x11')],_0x440576);_0x458560(_0x4d7242[_0x2b9d('0x10')](0x1f4,_0x140e31[_0x2b9d('0x11')]));});});}; \ No newline at end of file +var _0xcfac=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','catch','CreateSquareRecording','SquareRecording','options','raw'];(function(_0x4ddf58,_0x5cb9ca){var _0xd68645=function(_0x4d90bb){while(--_0x4d90bb){_0x4ddf58['push'](_0x4ddf58['shift']());}};_0xd68645(++_0x5cb9ca);}(_0xcfac,0x170));var _0xccfa=function(_0x56fc71,_0xc9c743){_0x56fc71=_0x56fc71-0x0;var _0x1efdd5=_0xcfac[_0x56fc71];return _0x1efdd5;};'use strict';var _=require(_0xccfa('0x0'));var util=require(_0xccfa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccfa('0x2'));var db=require(_0xccfa('0x3'))['db'];var utils=require(_0xccfa('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xccfa('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xccfa('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38ea25,_0x5a29db,_0x253f44){return new BPromise(function(_0x3621b1,_0x3ae8e2){return client[_0xccfa('0x7')](_0x38ea25,_0x253f44)[_0xccfa('0x8')](function(_0x5bd60f){logger[_0xccfa('0x9')]('SquareRecording,\x20%s,\x20%s',_0x5a29db,'request\x20sent');logger[_0xccfa('0xa')](_0xccfa('0xb'),_0x5a29db,_0xccfa('0xc'),JSON[_0xccfa('0xd')](_0x5bd60f));if(_0x5bd60f[_0xccfa('0xe')]){if(_0x5bd60f[_0xccfa('0xe')][_0xccfa('0xf')]===0x1f4){logger[_0xccfa('0xe')](_0xccfa('0x10'),_0x5a29db,_0x5bd60f['error'][_0xccfa('0x11')]);return _0x3ae8e2(_0x5bd60f[_0xccfa('0xe')][_0xccfa('0x11')]);}logger[_0xccfa('0xe')](_0xccfa('0x10'),_0x5a29db,_0x5bd60f[_0xccfa('0xe')]['message']);return _0x3621b1(_0x5bd60f['error'][_0xccfa('0x11')]);}else{logger[_0xccfa('0x9')](_0xccfa('0x10'),_0x5a29db,_0xccfa('0xc'));_0x3621b1(_0x5bd60f['result'][_0xccfa('0x11')]);}})[_0xccfa('0x12')](function(_0x4af1f9){logger['error'](_0xccfa('0x10'),_0x5a29db,_0x4af1f9);_0x3ae8e2(_0x4af1f9);});});}exports[_0xccfa('0x13')]=function(_0x518708){var _0x487904=this;return new Promise(function(_0x4d97d4,_0x569b2a){return db[_0xccfa('0x14')]['create'](_0x518708['body'],{'raw':_0x518708[_0xccfa('0x15')]?_0x518708[_0xccfa('0x15')][_0xccfa('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xc7d754){logger[_0xccfa('0x9')](_0xccfa('0x13'),_0x518708);logger[_0xccfa('0xa')](_0xccfa('0x13'),_0x518708,JSON[_0xccfa('0xd')](_0xc7d754));_0x4d97d4(_0xc7d754);})[_0xccfa('0x12')](function(_0x494e3){logger[_0xccfa('0xe')](_0xccfa('0x13'),_0x494e3[_0xccfa('0x11')],_0x518708);_0x569b2a(_0x487904['error'](0x1f4,_0x494e3['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index c9106cd..1ab6f74 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 _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(_0x846ae8,_0x33a70b){var _0x356b00=function(_0xa96f69){while(--_0xa96f69){_0x846ae8['push'](_0x846ae8['shift']());}};_0x356b00(++_0x33a70b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3861c6,_0x18be51){var _0x15f1ce=function(_0x40c276){while(--_0x40c276){_0x3861c6['push'](_0x3861c6['shift']());}};_0x15f1ce(++_0x18be51);}(_0xe706,0xa3));var _0x6e70=function(_0x2633c7,_0x4db8b3){_0x2633c7=_0x2633c7-0x0;var _0xbb644=_0xe706[_0x2633c7];return _0xbb644;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 98382ad..14c3258 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 _0x3c2b=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x14c0e1,_0x527f6f){var _0x1f9d95=function(_0x568176){while(--_0x568176){_0x14c0e1['push'](_0x14c0e1['shift']());}};_0x1f9d95(++_0x527f6f);}(_0x3c2b,0x117));var _0xb3c2=function(_0x317f16,_0x6eb0f9){_0x317f16=_0x317f16-0x0;var _0x4bb899=_0x3c2b[_0x317f16];return _0x4bb899;};'use strict';var Sequelize=require(_0xb3c2('0x0'));module[_0xb3c2('0x1')]={'network':{'type':Sequelize[_0xb3c2('0x2')]},'network_script':{'type':Sequelize[_0xb3c2('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb3c2('0x2')]},'language':{'type':Sequelize[_0xb3c2('0x2')]},'type':{'type':Sequelize[_0xb3c2('0x2')]},'uniqueid':{'type':Sequelize[_0xb3c2('0x2')]},'version':{'type':Sequelize[_0xb3c2('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xb3c2('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xb3c2('0x2')]},'callington':{'type':Sequelize[_0xb3c2('0x2')]},'callingtns':{'type':Sequelize[_0xb3c2('0x2')]},'dnid':{'type':Sequelize[_0xb3c2('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xb3c2('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xb3c2('0x2')]},'accountcode':{'type':Sequelize[_0xb3c2('0x2')]},'threadid':{'type':Sequelize[_0xb3c2('0x2')]},'project_name':{'type':Sequelize[_0xb3c2('0x2')]},'joinAt':{'type':Sequelize[_0xb3c2('0x3')]},'leaveAt':{'type':Sequelize[_0xb3c2('0x3')]},'bot':{'type':Sequelize[_0xb3c2('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x4325=['sequelize','exports','STRING','DATE'];(function(_0x764ad5,_0x12f9ba){var _0x422244=function(_0x21e39c){while(--_0x21e39c){_0x764ad5['push'](_0x764ad5['shift']());}};_0x422244(++_0x12f9ba);}(_0x4325,0x138));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'network':{'type':Sequelize[_0x5432('0x2')]},'network_script':{'type':Sequelize[_0x5432('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5432('0x2')]},'language':{'type':Sequelize[_0x5432('0x2')]},'type':{'type':Sequelize[_0x5432('0x2')]},'uniqueid':{'type':Sequelize[_0x5432('0x2')]},'version':{'type':Sequelize[_0x5432('0x2')]},'callerid':{'type':Sequelize[_0x5432('0x2')]},'calleridname':{'type':Sequelize[_0x5432('0x2')]},'callingpres':{'type':Sequelize[_0x5432('0x2')]},'callingani2':{'type':Sequelize[_0x5432('0x2')]},'callington':{'type':Sequelize[_0x5432('0x2')]},'callingtns':{'type':Sequelize[_0x5432('0x2')]},'dnid':{'type':Sequelize[_0x5432('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5432('0x2')]},'extension':{'type':Sequelize[_0x5432('0x2')]},'priority':{'type':Sequelize[_0x5432('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5432('0x2')]},'threadid':{'type':Sequelize[_0x5432('0x2')]},'project_name':{'type':Sequelize[_0x5432('0x2')]},'joinAt':{'type':Sequelize[_0x5432('0x3')]},'leaveAt':{'type':Sequelize[_0x5432('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2278a6b..2750557 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 _0xddb5=['findAll','rows','length','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','index','map','SquareReport','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x348a2f,_0x304501){var _0x716d26=function(_0x10dd54){while(--_0x10dd54){_0x348a2f['push'](_0x348a2f['shift']());}};_0x716d26(++_0x304501);}(_0xddb5,0x18a));var _0x5ddb=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xddb5[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0x5ddb('0x0'));var rimraf=require(_0x5ddb('0x1'));var zipdir=require(_0x5ddb('0x2'));var jsonpatch=require(_0x5ddb('0x3'));var rp=require('request-promise');var moment=require(_0x5ddb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5ddb('0x5'));var util=require(_0x5ddb('0x6'));var path=require(_0x5ddb('0x7'));var sox=require(_0x5ddb('0x8'));var csv=require(_0x5ddb('0x9'));var ejs=require(_0x5ddb('0xa'));var fs=require('fs');var fs_extra=require(_0x5ddb('0xb'));var _=require(_0x5ddb('0xc'));var squel=require(_0x5ddb('0xd'));var crypto=require('crypto');var jsforce=require(_0x5ddb('0xe'));var deskjs=require(_0x5ddb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5ddb('0x10'));var Papa=require(_0x5ddb('0x11'));var Redis=require('ioredis');var authService=require(_0x5ddb('0x12'));var qs=require(_0x5ddb('0x13'));var as=require(_0x5ddb('0x14'));var hardwareService=require(_0x5ddb('0x15'));var logger=require(_0x5ddb('0x16'))(_0x5ddb('0x17'));var utils=require('../../config/utils');var config=require(_0x5ddb('0x18'));var licenseUtil=require(_0x5ddb('0x19'));var db=require(_0x5ddb('0x1a'))['db'];function respondWithStatusCode(_0x5ac23c,_0x5c7678){_0x5c7678=_0x5c7678||0xcc;return function(_0x15b677){if(_0x15b677){return _0x5ac23c[_0x5ddb('0x1b')](_0x5c7678);}return _0x5ac23c['status'](_0x5c7678)[_0x5ddb('0x1c')]();};}function respondWithResult(_0x390a89,_0x30d262){_0x30d262=_0x30d262||0xc8;return function(_0x23a8c3){if(_0x23a8c3){return _0x390a89['status'](_0x30d262)[_0x5ddb('0x1d')](_0x23a8c3);}};}function respondWithFilteredResult(_0x33f4b3,_0x434569){return function(_0x5a6d72){if(_0x5a6d72){var _0x91355a=typeof _0x434569[_0x5ddb('0x1e')]===_0x5ddb('0x1f')&&typeof _0x434569[_0x5ddb('0x20')]===_0x5ddb('0x1f');var _0x2a7f90=_0x5a6d72['count'];var _0x4de881=_0x91355a?0x0:_0x434569['offset'];var _0x23e22c=_0x91355a?_0x5a6d72[_0x5ddb('0x21')]:_0x434569[_0x5ddb('0x1e')]+_0x434569[_0x5ddb('0x20')];var _0x4618e9;if(_0x23e22c>=_0x2a7f90){_0x23e22c=_0x2a7f90;_0x4618e9=0xc8;}else{_0x4618e9=0xce;}_0x33f4b3['status'](_0x4618e9);return _0x33f4b3[_0x5ddb('0x22')](_0x5ddb('0x23'),_0x4de881+'-'+_0x23e22c+'/'+_0x2a7f90)['json'](_0x5a6d72);}return null;};}function patchUpdates(_0x459ec6){return function(_0x341e4b){try{jsonpatch[_0x5ddb('0x24')](_0x341e4b,_0x459ec6,!![]);}catch(_0x27acc0){return BPromise[_0x5ddb('0x25')](_0x27acc0);}return _0x341e4b[_0x5ddb('0x26')]();};}function saveUpdates(_0x2264b4,_0x17ce6d){return function(_0x434060){if(_0x434060){return _0x434060[_0x5ddb('0x27')](_0x2264b4)[_0x5ddb('0x28')](function(_0x148639){return _0x148639;});}return null;};}function removeEntity(_0x359052,_0x48973f){return function(_0x341f96){if(_0x341f96){return _0x341f96[_0x5ddb('0x29')]()[_0x5ddb('0x28')](function(){_0x359052[_0x5ddb('0x2a')](0xcc)[_0x5ddb('0x1c')]();});}};}function handleEntityNotFound(_0x570167,_0x520a38){return function(_0x4d19d6){if(!_0x4d19d6){_0x570167['sendStatus'](0x194);}return _0x4d19d6;};}function handleError(_0x5a5c21,_0x5849e9){_0x5849e9=_0x5849e9||0x1f4;return function(_0x545416){logger[_0x5ddb('0x2b')](_0x545416[_0x5ddb('0x2c')]);if(_0x545416[_0x5ddb('0x2d')]){delete _0x545416[_0x5ddb('0x2d')];}_0x5a5c21[_0x5ddb('0x2a')](_0x5849e9)['send'](_0x545416);};}exports[_0x5ddb('0x2e')]=function(_0x39810b,_0x1c3ec5){var _0x4f62f0={},_0x31f3c1={},_0x14e75f={'count':0x0,'rows':[]};var _0x324d11=_[_0x5ddb('0x2f')](db[_0x5ddb('0x30')]['rawAttributes'],function(_0x17c4f9){return{'name':_0x17c4f9['fieldName'],'type':_0x17c4f9[_0x5ddb('0x31')][_0x5ddb('0x32')]};});_0x31f3c1[_0x5ddb('0x33')]=_[_0x5ddb('0x2f')](_0x324d11,'name');_0x31f3c1['query']=_[_0x5ddb('0x34')](_0x39810b[_0x5ddb('0x35')]);_0x31f3c1[_0x5ddb('0x36')]=_[_0x5ddb('0x37')](_0x31f3c1[_0x5ddb('0x33')],_0x31f3c1[_0x5ddb('0x35')]);_0x4f62f0[_0x5ddb('0x38')]=_['intersection'](_0x31f3c1['model'],qs[_0x5ddb('0x39')](_0x39810b['query'][_0x5ddb('0x39')]));_0x4f62f0['attributes']=_0x4f62f0[_0x5ddb('0x38')]['length']?_0x4f62f0[_0x5ddb('0x38')]:_0x31f3c1[_0x5ddb('0x33')];if(!_0x39810b[_0x5ddb('0x35')]['hasOwnProperty'](_0x5ddb('0x3a'))){_0x4f62f0[_0x5ddb('0x20')]=qs['limit'](_0x39810b[_0x5ddb('0x35')][_0x5ddb('0x20')]);_0x4f62f0[_0x5ddb('0x1e')]=qs['offset'](_0x39810b[_0x5ddb('0x35')][_0x5ddb('0x1e')]);}_0x4f62f0[_0x5ddb('0x3b')]=qs['sort'](_0x39810b[_0x5ddb('0x35')]['sort']);_0x4f62f0[_0x5ddb('0x3c')]=qs[_0x5ddb('0x36')](_[_0x5ddb('0x3d')](_0x39810b[_0x5ddb('0x35')],_0x31f3c1[_0x5ddb('0x36')]),_0x324d11);if(_0x39810b[_0x5ddb('0x35')][_0x5ddb('0x3e')]){_0x4f62f0[_0x5ddb('0x3c')]=_[_0x5ddb('0x3f')](_0x4f62f0[_0x5ddb('0x3c')],{'$or':_[_0x5ddb('0x2f')](_0x324d11,function(_0x5ef3ac){if(_0x5ef3ac[_0x5ddb('0x31')]!==_0x5ddb('0x40')){var _0x49f5c5={};_0x49f5c5[_0x5ef3ac[_0x5ddb('0x2d')]]={'$like':'%'+_0x39810b[_0x5ddb('0x35')][_0x5ddb('0x3e')]+'%'};return _0x49f5c5;}})});}_0x4f62f0=_[_0x5ddb('0x3f')]({},_0x4f62f0,_0x39810b[_0x5ddb('0x41')]);var _0x4de308={'where':_0x4f62f0[_0x5ddb('0x3c')]};return db['SquareReport']['count'](_0x4de308)[_0x5ddb('0x28')](function(_0x39ac93){_0x14e75f[_0x5ddb('0x21')]=_0x39ac93;if(_0x39810b[_0x5ddb('0x35')][_0x5ddb('0x42')]){_0x4f62f0[_0x5ddb('0x43')]=[{'all':!![]}];}return db[_0x5ddb('0x30')][_0x5ddb('0x44')](_0x4f62f0);})[_0x5ddb('0x28')](function(_0xb4e079){_0x14e75f[_0x5ddb('0x45')]=_0xb4e079;return _0x14e75f;})[_0x5ddb('0x28')](respondWithFilteredResult(_0x1c3ec5,_0x4f62f0))['catch'](handleError(_0x1c3ec5,null));};exports['show']=function(_0x181822,_0x5f4bb4){var _0x199e88={'raw':!![],'where':{'id':_0x181822['params']['id']}},_0x2922d4={};_0x2922d4[_0x5ddb('0x33')]=_['keys'](db[_0x5ddb('0x30')]['rawAttributes']);_0x2922d4['query']=_[_0x5ddb('0x34')](_0x181822[_0x5ddb('0x35')]);_0x2922d4[_0x5ddb('0x36')]=_[_0x5ddb('0x37')](_0x2922d4['model'],_0x2922d4['query']);_0x199e88[_0x5ddb('0x38')]=_['intersection'](_0x2922d4[_0x5ddb('0x33')],qs['fields'](_0x181822[_0x5ddb('0x35')][_0x5ddb('0x39')]));_0x199e88[_0x5ddb('0x38')]=_0x199e88[_0x5ddb('0x38')][_0x5ddb('0x46')]?_0x199e88['attributes']:_0x2922d4[_0x5ddb('0x33')];if(_0x181822[_0x5ddb('0x35')][_0x5ddb('0x42')]){_0x199e88[_0x5ddb('0x43')]=[{'all':!![]}];}_0x199e88=_['merge']({},_0x199e88,_0x181822['options']);return db['SquareReport'][_0x5ddb('0x47')](_0x199e88)[_0x5ddb('0x28')](handleEntityNotFound(_0x5f4bb4,null))['then'](respondWithResult(_0x5f4bb4,null))[_0x5ddb('0x48')](handleError(_0x5f4bb4,null));};exports[_0x5ddb('0x49')]=function(_0x4edffd,_0x41126b){return db['SquareReport']['create'](_0x4edffd[_0x5ddb('0x4a')],{})[_0x5ddb('0x28')](respondWithResult(_0x41126b,0xc9))[_0x5ddb('0x48')](handleError(_0x41126b,null));};exports['update']=function(_0x1903e7,_0x342c49){if(_0x1903e7[_0x5ddb('0x4a')]['id']){delete _0x1903e7['body']['id'];}return db['SquareReport'][_0x5ddb('0x47')]({'where':{'id':_0x1903e7[_0x5ddb('0x4b')]['id']}})[_0x5ddb('0x28')](handleEntityNotFound(_0x342c49,null))['then'](saveUpdates(_0x1903e7[_0x5ddb('0x4a')],null))[_0x5ddb('0x28')](respondWithResult(_0x342c49,null))[_0x5ddb('0x48')](handleError(_0x342c49,null));};exports[_0x5ddb('0x29')]=function(_0x5b130b,_0x135332){return db[_0x5ddb('0x30')]['find']({'where':{'id':_0x5b130b['params']['id']}})[_0x5ddb('0x28')](handleEntityNotFound(_0x135332,null))[_0x5ddb('0x28')](removeEntity(_0x135332,null))[_0x5ddb('0x48')](handleError(_0x135332,null));};exports['describe']=function(_0x353f86,_0x4a5c7a){return db[_0x5ddb('0x30')][_0x5ddb('0x4c')]()[_0x5ddb('0x28')](respondWithResult(_0x4a5c7a,null))[_0x5ddb('0x48')](handleError(_0x4a5c7a,null));}; \ No newline at end of file +var _0x505f=['rawAttributes','keys','intersection','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','save','then','error','name','send','index','map','SquareReport','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','params'];(function(_0x19fd3f,_0x8adcfa){var _0x28ad05=function(_0x3a3ce4){while(--_0x3a3ce4){_0x19fd3f['push'](_0x19fd3f['shift']());}};_0x28ad05(++_0x8adcfa);}(_0x505f,0x16c));var _0xf505=function(_0x4011ee,_0x2f9974){_0x4011ee=_0x4011ee-0x0;var _0xe66073=_0x505f[_0x4011ee];return _0xe66073;};'use strict';var emlformat=require(_0xf505('0x0'));var rimraf=require(_0xf505('0x1'));var zipdir=require(_0xf505('0x2'));var jsonpatch=require(_0xf505('0x3'));var rp=require(_0xf505('0x4'));var moment=require(_0xf505('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf505('0x6'));var path=require(_0xf505('0x7'));var sox=require(_0xf505('0x8'));var csv=require(_0xf505('0x9'));var ejs=require(_0xf505('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf505('0xb'));var squel=require(_0xf505('0xc'));var crypto=require(_0xf505('0xd'));var jsforce=require(_0xf505('0xe'));var deskjs=require(_0xf505('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf505('0x10'));var Redis=require('ioredis');var authService=require(_0xf505('0x11'));var qs=require(_0xf505('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf505('0x13'));var config=require(_0xf505('0x14'));var licenseUtil=require(_0xf505('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x774fbe,_0x3f1c19){_0x3f1c19=_0x3f1c19||0xcc;return function(_0x46f39a){if(_0x46f39a){return _0x774fbe[_0xf505('0x16')](_0x3f1c19);}return _0x774fbe[_0xf505('0x17')](_0x3f1c19)[_0xf505('0x18')]();};}function respondWithResult(_0xf2ed0d,_0x245f35){_0x245f35=_0x245f35||0xc8;return function(_0x137b85){if(_0x137b85){return _0xf2ed0d['status'](_0x245f35)[_0xf505('0x19')](_0x137b85);}};}function respondWithFilteredResult(_0x4285f9,_0x484d61){return function(_0x3c1865){if(_0x3c1865){var _0xb3a1db=typeof _0x484d61[_0xf505('0x1a')]===_0xf505('0x1b')&&typeof _0x484d61[_0xf505('0x1c')]==='undefined';var _0x3210b7=_0x3c1865[_0xf505('0x1d')];var _0x3ba90f=_0xb3a1db?0x0:_0x484d61[_0xf505('0x1a')];var _0xb326fd=_0xb3a1db?_0x3c1865[_0xf505('0x1d')]:_0x484d61[_0xf505('0x1a')]+_0x484d61[_0xf505('0x1c')];var _0x3d185e;if(_0xb326fd>=_0x3210b7){_0xb326fd=_0x3210b7;_0x3d185e=0xc8;}else{_0x3d185e=0xce;}_0x4285f9[_0xf505('0x17')](_0x3d185e);return _0x4285f9[_0xf505('0x1e')]('Content-Range',_0x3ba90f+'-'+_0xb326fd+'/'+_0x3210b7)[_0xf505('0x19')](_0x3c1865);}return null;};}function patchUpdates(_0x177523){return function(_0x34ede9){try{jsonpatch['apply'](_0x34ede9,_0x177523,!![]);}catch(_0x5eebd4){return BPromise['reject'](_0x5eebd4);}return _0x34ede9[_0xf505('0x1f')]();};}function saveUpdates(_0x461cec,_0x10a938){return function(_0x44509e){if(_0x44509e){return _0x44509e['update'](_0x461cec)[_0xf505('0x20')](function(_0x3e2a4c){return _0x3e2a4c;});}return null;};}function removeEntity(_0x285fad,_0x58d125){return function(_0x5cb062){if(_0x5cb062){return _0x5cb062['destroy']()['then'](function(){_0x285fad[_0xf505('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c2194,_0x336ef1){return function(_0x569c90){if(!_0x569c90){_0x6c2194[_0xf505('0x16')](0x194);}return _0x569c90;};}function handleError(_0x3a92d6,_0x30c3dd){_0x30c3dd=_0x30c3dd||0x1f4;return function(_0x472bf7){logger[_0xf505('0x21')](_0x472bf7['stack']);if(_0x472bf7[_0xf505('0x22')]){delete _0x472bf7['name'];}_0x3a92d6[_0xf505('0x17')](_0x30c3dd)[_0xf505('0x23')](_0x472bf7);};}exports[_0xf505('0x24')]=function(_0x4a22e0,_0x4f4779){var _0x15888a={},_0x35a858={},_0x2da17f={'count':0x0,'rows':[]};var _0x111931=_[_0xf505('0x25')](db[_0xf505('0x26')]['rawAttributes'],function(_0x2be9cb){return{'name':_0x2be9cb[_0xf505('0x27')],'type':_0x2be9cb['type'][_0xf505('0x28')]};});_0x35a858[_0xf505('0x29')]=_['map'](_0x111931,_0xf505('0x22'));_0x35a858[_0xf505('0x2a')]=_['keys'](_0x4a22e0[_0xf505('0x2a')]);_0x35a858[_0xf505('0x2b')]=_['intersection'](_0x35a858[_0xf505('0x29')],_0x35a858['query']);_0x15888a[_0xf505('0x2c')]=_['intersection'](_0x35a858[_0xf505('0x29')],qs[_0xf505('0x2d')](_0x4a22e0['query'][_0xf505('0x2d')]));_0x15888a[_0xf505('0x2c')]=_0x15888a[_0xf505('0x2c')][_0xf505('0x2e')]?_0x15888a[_0xf505('0x2c')]:_0x35a858[_0xf505('0x29')];if(!_0x4a22e0[_0xf505('0x2a')][_0xf505('0x2f')](_0xf505('0x30'))){_0x15888a[_0xf505('0x1c')]=qs[_0xf505('0x1c')](_0x4a22e0[_0xf505('0x2a')][_0xf505('0x1c')]);_0x15888a['offset']=qs['offset'](_0x4a22e0[_0xf505('0x2a')][_0xf505('0x1a')]);}_0x15888a[_0xf505('0x31')]=qs[_0xf505('0x32')](_0x4a22e0[_0xf505('0x2a')][_0xf505('0x32')]);_0x15888a[_0xf505('0x33')]=qs[_0xf505('0x2b')](_[_0xf505('0x34')](_0x4a22e0[_0xf505('0x2a')],_0x35a858['filters']),_0x111931);if(_0x4a22e0[_0xf505('0x2a')][_0xf505('0x35')]){_0x15888a[_0xf505('0x33')]=_[_0xf505('0x36')](_0x15888a[_0xf505('0x33')],{'$or':_[_0xf505('0x25')](_0x111931,function(_0x2db6cc){if(_0x2db6cc[_0xf505('0x37')]!==_0xf505('0x38')){var _0x4d71c6={};_0x4d71c6[_0x2db6cc[_0xf505('0x22')]]={'$like':'%'+_0x4a22e0[_0xf505('0x2a')][_0xf505('0x35')]+'%'};return _0x4d71c6;}})});}_0x15888a=_[_0xf505('0x36')]({},_0x15888a,_0x4a22e0[_0xf505('0x39')]);var _0x210fac={'where':_0x15888a[_0xf505('0x33')]};return db[_0xf505('0x26')]['count'](_0x210fac)[_0xf505('0x20')](function(_0x1d5346){_0x2da17f[_0xf505('0x1d')]=_0x1d5346;if(_0x4a22e0['query'][_0xf505('0x3a')]){_0x15888a['include']=[{'all':!![]}];}return db[_0xf505('0x26')]['findAll'](_0x15888a);})[_0xf505('0x20')](function(_0xba293e){_0x2da17f[_0xf505('0x3b')]=_0xba293e;return _0x2da17f;})[_0xf505('0x20')](respondWithFilteredResult(_0x4f4779,_0x15888a))[_0xf505('0x3c')](handleError(_0x4f4779,null));};exports['show']=function(_0x1211da,_0x2086f0){var _0x284ee6={'raw':!![],'where':{'id':_0x1211da[_0xf505('0x3d')]['id']}},_0x581c86={};_0x581c86[_0xf505('0x29')]=_['keys'](db[_0xf505('0x26')][_0xf505('0x3e')]);_0x581c86[_0xf505('0x2a')]=_[_0xf505('0x3f')](_0x1211da[_0xf505('0x2a')]);_0x581c86[_0xf505('0x2b')]=_[_0xf505('0x40')](_0x581c86[_0xf505('0x29')],_0x581c86[_0xf505('0x2a')]);_0x284ee6[_0xf505('0x2c')]=_[_0xf505('0x40')](_0x581c86['model'],qs[_0xf505('0x2d')](_0x1211da[_0xf505('0x2a')][_0xf505('0x2d')]));_0x284ee6[_0xf505('0x2c')]=_0x284ee6[_0xf505('0x2c')][_0xf505('0x2e')]?_0x284ee6[_0xf505('0x2c')]:_0x581c86['model'];if(_0x1211da[_0xf505('0x2a')]['includeAll']){_0x284ee6[_0xf505('0x41')]=[{'all':!![]}];}_0x284ee6=_[_0xf505('0x36')]({},_0x284ee6,_0x1211da[_0xf505('0x39')]);return db[_0xf505('0x26')][_0xf505('0x42')](_0x284ee6)['then'](handleEntityNotFound(_0x2086f0,null))[_0xf505('0x20')](respondWithResult(_0x2086f0,null))[_0xf505('0x3c')](handleError(_0x2086f0,null));};exports[_0xf505('0x43')]=function(_0xe2f38,_0x1c0f5b){return db[_0xf505('0x26')][_0xf505('0x43')](_0xe2f38[_0xf505('0x44')],{})[_0xf505('0x20')](respondWithResult(_0x1c0f5b,0xc9))[_0xf505('0x3c')](handleError(_0x1c0f5b,null));};exports[_0xf505('0x45')]=function(_0x52cbbd,_0x22cbf4){if(_0x52cbbd[_0xf505('0x44')]['id']){delete _0x52cbbd[_0xf505('0x44')]['id'];}return db[_0xf505('0x26')][_0xf505('0x42')]({'where':{'id':_0x52cbbd['params']['id']}})[_0xf505('0x20')](handleEntityNotFound(_0x22cbf4,null))[_0xf505('0x20')](saveUpdates(_0x52cbbd[_0xf505('0x44')],null))['then'](respondWithResult(_0x22cbf4,null))[_0xf505('0x3c')](handleError(_0x22cbf4,null));};exports['destroy']=function(_0x2f30fc,_0xd6e8f6){return db[_0xf505('0x26')]['find']({'where':{'id':_0x2f30fc[_0xf505('0x3d')]['id']}})[_0xf505('0x20')](handleEntityNotFound(_0xd6e8f6,null))[_0xf505('0x20')](removeEntity(_0xd6e8f6,null))['catch'](handleError(_0xd6e8f6,null));};exports[_0xf505('0x46')]=function(_0x1fe8f0,_0x5d25ac){return db[_0xf505('0x26')][_0xf505('0x46')]()[_0xf505('0x20')](respondWithResult(_0x5d25ac,null))[_0xf505('0x3c')](handleError(_0x5d25ac,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b9d6f3a..e0ca4ec 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 _0x8810=['project_name','leaveAt','lodash','util','api','bluebird','request-promise','path','../../config/environment','exports','SquareReport','uniqueid'];(function(_0x383fda,_0xe006ad){var _0x30114e=function(_0x24e0b7){while(--_0x24e0b7){_0x383fda['push'](_0x383fda['shift']());}};_0x30114e(++_0xe006ad);}(_0x8810,0x146));var _0x0881=function(_0x38533a,_0x5ee46e){_0x38533a=_0x38533a-0x0;var _0x144025=_0x8810[_0x38533a];return _0x144025;};'use strict';var _=require(_0x0881('0x0'));var util=require(_0x0881('0x1'));var logger=require('../../config/logger')(_0x0881('0x2'));var moment=require('moment');var BPromise=require(_0x0881('0x3'));var rp=require(_0x0881('0x4'));var fs=require('fs');var path=require(_0x0881('0x5'));var rimraf=require('rimraf');var config=require(_0x0881('0x6'));var attributes=require('./squareReport.attributes');module[_0x0881('0x7')]=function(_0x24070a,_0x2aab01){return _0x24070a['define'](_0x0881('0x8'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x0881('0x9'),_0x0881('0xa')]},{'name':_0x0881('0xb'),'fields':[_0x0881('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa068=['uniqueid','project_name','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa068,0x122));var _0x8a06=function(_0xc8530e,_0x292597){_0xc8530e=_0xc8530e-0x0;var _0x53c7fa=_0xa068[_0xc8530e];return _0x53c7fa;};'use strict';var _=require('lodash');var util=require(_0x8a06('0x0'));var logger=require(_0x8a06('0x1'))(_0x8a06('0x2'));var moment=require(_0x8a06('0x3'));var BPromise=require(_0x8a06('0x4'));var rp=require(_0x8a06('0x5'));var fs=require('fs');var path=require(_0x8a06('0x6'));var rimraf=require(_0x8a06('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a06('0x8'));module[_0x8a06('0x9')]=function(_0x2098df,_0x58f0b9){return _0x2098df[_0x8a06('0xa')](_0x8a06('0xb'),attributes,{'tableName':_0x8a06('0xc'),'paranoid':![],'indexes':[{'name':_0x8a06('0xd'),'fields':[_0x8a06('0xe'),_0x8a06('0xf')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 35f4878..1874340 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 _0x414d=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareReport','SquareReport','body','options','raw','then','info','UpdateSquareReport','update','where','attributes','limit','lodash','util','bluebird','ioredis'];(function(_0x84a97e,_0x59f2f2){var _0x3f980b=function(_0x78a15f){while(--_0x78a15f){_0x84a97e['push'](_0x84a97e['shift']());}};_0x3f980b(++_0x59f2f2);}(_0x414d,0x151));var _0xd414=function(_0x2b38a6,_0x4fbc47){_0x2b38a6=_0x2b38a6-0x0;var _0x118544=_0x414d[_0x2b38a6];return _0x118544;};'use strict';var _=require(_0xd414('0x0'));var util=require(_0xd414('0x1'));var moment=require('moment');var BPromise=require(_0xd414('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd414('0x3'));var db=require(_0xd414('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd414('0x5'))('rpc');var config=require(_0xd414('0x6'));var jayson=require(_0xd414('0x7'));var client=jayson[_0xd414('0x8')][_0xd414('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33cd9e,_0x57ab2d,_0x4583fd){return new BPromise(function(_0x3edee1,_0x225c7b){return client[_0xd414('0xa')](_0x33cd9e,_0x4583fd)['then'](function(_0x57273e){logger['info'](_0xd414('0xb'),_0x57ab2d,_0xd414('0xc'));logger[_0xd414('0xd')](_0xd414('0xe'),_0x57ab2d,_0xd414('0xc'),JSON[_0xd414('0xf')](_0x57273e));if(_0x57273e[_0xd414('0x10')]){if(_0x57273e['error']['code']===0x1f4){logger[_0xd414('0x10')](_0xd414('0xb'),_0x57ab2d,_0x57273e['error']['message']);return _0x225c7b(_0x57273e['error']['message']);}logger[_0xd414('0x10')](_0xd414('0xb'),_0x57ab2d,_0x57273e['error'][_0xd414('0x11')]);return _0x3edee1(_0x57273e[_0xd414('0x10')][_0xd414('0x11')]);}else{logger['info'](_0xd414('0xb'),_0x57ab2d,'request\x20sent');_0x3edee1(_0x57273e['result'][_0xd414('0x11')]);}})[_0xd414('0x12')](function(_0x119803){logger[_0xd414('0x10')](_0xd414('0xb'),_0x57ab2d,_0x119803);_0x225c7b(_0x119803);});});}exports[_0xd414('0x13')]=function(_0x1c9a0f){var _0x28b6a8=this;return new Promise(function(_0x4e83d2,_0x599d4b){return db[_0xd414('0x14')]['create'](_0x1c9a0f[_0xd414('0x15')],{'raw':_0x1c9a0f[_0xd414('0x16')]?_0x1c9a0f[_0xd414('0x16')][_0xd414('0x17')]===undefined?!![]:![]:!![]})[_0xd414('0x18')](function(_0x10e58b){logger[_0xd414('0x19')](_0xd414('0x13'),_0x1c9a0f);logger[_0xd414('0xd')](_0xd414('0x13'),_0x1c9a0f,JSON[_0xd414('0xf')](_0x10e58b));_0x4e83d2(_0x10e58b);})[_0xd414('0x12')](function(_0x3b29f7){logger[_0xd414('0x10')](_0xd414('0x13'),_0x3b29f7['message'],_0x1c9a0f);_0x599d4b(_0x28b6a8[_0xd414('0x10')](0x1f4,_0x3b29f7[_0xd414('0x11')]));});});};exports[_0xd414('0x1a')]=function(_0x30fb40){var _0x5797f2=this;return new Promise(function(_0x2ef37d,_0x21b5ec){return db[_0xd414('0x14')][_0xd414('0x1b')](_0x30fb40[_0xd414('0x15')],{'raw':_0x30fb40['options']?_0x30fb40[_0xd414('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30fb40['options']?_0x30fb40[_0xd414('0x16')][_0xd414('0x1c')]||null:null,'attributes':_0x30fb40['options']?_0x30fb40[_0xd414('0x16')][_0xd414('0x1d')]||null:null,'limit':_0x30fb40['options']?_0x30fb40[_0xd414('0x16')][_0xd414('0x1e')]||null:null})[_0xd414('0x18')](function(_0x11ebce){logger[_0xd414('0x19')](_0xd414('0x1a'),_0x30fb40);logger['debug']('UpdateSquareReport',_0x30fb40,JSON[_0xd414('0xf')](_0x11ebce));_0x2ef37d(_0x11ebce);})[_0xd414('0x12')](function(_0x4c0fd3){logger[_0xd414('0x10')](_0xd414('0x1a'),_0x4c0fd3[_0xd414('0x11')],_0x30fb40);_0x21b5ec(_0x5797f2[_0xd414('0x10')](0x1f4,_0x4c0fd3[_0xd414('0x11')]));});});}; \ No newline at end of file +var _0x6cb9=['SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info'];(function(_0x206403,_0x28a496){var _0x4373ad=function(_0xdcf5f0){while(--_0xdcf5f0){_0x206403['push'](_0x206403['shift']());}};_0x4373ad(++_0x28a496);}(_0x6cb9,0x17e));var _0x96cb=function(_0x3806f7,_0xf20f97){_0x3806f7=_0x3806f7-0x0;var _0x27c67d=_0x6cb9[_0x3806f7];return _0x27c67d;};'use strict';var _=require(_0x96cb('0x0'));var util=require(_0x96cb('0x1'));var moment=require(_0x96cb('0x2'));var BPromise=require(_0x96cb('0x3'));var rs=require(_0x96cb('0x4'));var fs=require('fs');var Redis=require(_0x96cb('0x5'));var db=require(_0x96cb('0x6'))['db'];var utils=require(_0x96cb('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x96cb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x96cb('0x9')][_0x96cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfa40d2,_0x177eb1,_0x4a377f){return new BPromise(function(_0x3a1fbe,_0x3315ca){return client[_0x96cb('0xb')](_0xfa40d2,_0x4a377f)[_0x96cb('0xc')](function(_0x4e1f26){logger[_0x96cb('0xd')](_0x96cb('0xe'),_0x177eb1,'request\x20sent');logger[_0x96cb('0xf')](_0x96cb('0x10'),_0x177eb1,_0x96cb('0x11'),JSON[_0x96cb('0x12')](_0x4e1f26));if(_0x4e1f26[_0x96cb('0x13')]){if(_0x4e1f26['error']['code']===0x1f4){logger[_0x96cb('0x13')](_0x96cb('0xe'),_0x177eb1,_0x4e1f26[_0x96cb('0x13')][_0x96cb('0x14')]);return _0x3315ca(_0x4e1f26[_0x96cb('0x13')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x177eb1,_0x4e1f26[_0x96cb('0x13')][_0x96cb('0x14')]);return _0x3a1fbe(_0x4e1f26[_0x96cb('0x13')][_0x96cb('0x14')]);}else{logger[_0x96cb('0xd')](_0x96cb('0xe'),_0x177eb1,_0x96cb('0x11'));_0x3a1fbe(_0x4e1f26['result'][_0x96cb('0x14')]);}})[_0x96cb('0x15')](function(_0x46cd3e){logger[_0x96cb('0x13')](_0x96cb('0xe'),_0x177eb1,_0x46cd3e);_0x3315ca(_0x46cd3e);});});}exports[_0x96cb('0x16')]=function(_0x39fcba){var _0x119b8c=this;return new Promise(function(_0x280a44,_0x2a1a66){return db[_0x96cb('0x17')][_0x96cb('0x18')](_0x39fcba['body'],{'raw':_0x39fcba[_0x96cb('0x19')]?_0x39fcba['options'][_0x96cb('0x1a')]===undefined?!![]:![]:!![]})[_0x96cb('0xc')](function(_0x28b69e){logger[_0x96cb('0xd')]('CreateSquareReport',_0x39fcba);logger[_0x96cb('0xf')](_0x96cb('0x16'),_0x39fcba,JSON[_0x96cb('0x12')](_0x28b69e));_0x280a44(_0x28b69e);})[_0x96cb('0x15')](function(_0x18e578){logger['error'](_0x96cb('0x16'),_0x18e578[_0x96cb('0x14')],_0x39fcba);_0x2a1a66(_0x119b8c['error'](0x1f4,_0x18e578[_0x96cb('0x14')]));});});};exports[_0x96cb('0x1b')]=function(_0x2914ba){var _0xed8494=this;return new Promise(function(_0x4509c1,_0x1e3c49){return db[_0x96cb('0x17')][_0x96cb('0x1c')](_0x2914ba[_0x96cb('0x1d')],{'raw':_0x2914ba[_0x96cb('0x19')]?_0x2914ba[_0x96cb('0x19')][_0x96cb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2914ba['options']?_0x2914ba['options'][_0x96cb('0x1e')]||null:null,'attributes':_0x2914ba[_0x96cb('0x19')]?_0x2914ba[_0x96cb('0x19')][_0x96cb('0x1f')]||null:null,'limit':_0x2914ba['options']?_0x2914ba[_0x96cb('0x19')][_0x96cb('0x20')]||null:null})['then'](function(_0x52de97){logger[_0x96cb('0xd')](_0x96cb('0x1b'),_0x2914ba);logger['debug']('UpdateSquareReport',_0x2914ba,JSON[_0x96cb('0x12')](_0x52de97));_0x4509c1(_0x52de97);})[_0x96cb('0x15')](function(_0x50a4d2){logger[_0x96cb('0x13')]('UpdateSquareReport',_0x50a4d2[_0x96cb('0x14')],_0x2914ba);_0x1e3c49(_0xed8494['error'](0x1f4,_0x50a4d2[_0x96cb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 8e4004f..cbe6b14 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 _0x4f5f=['put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','index','get','isAuthenticated','describe','/:id','show','post'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x4f5f,0x8a));var _0xf4f5=function(_0x119b3e,_0x588d50){_0x119b3e=_0x119b3e-0x0;var _0x1169ae=_0x4f5f[_0x119b3e];return _0x1169ae;};'use strict';var multer=require('multer');var util=require(_0xf4f5('0x0'));var path=require('path');var timeout=require(_0xf4f5('0x1'));var express=require(_0xf4f5('0x2'));var router=express[_0xf4f5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf4f5('0x4'));var interaction=require(_0xf4f5('0x5'));var config=require('../../config/environment');var controller=require(_0xf4f5('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xf4f5('0x7')]);router[_0xf4f5('0x8')]('/describe',auth[_0xf4f5('0x9')](),controller[_0xf4f5('0xa')]);router['get'](_0xf4f5('0xb'),auth[_0xf4f5('0x9')](),controller[_0xf4f5('0xc')]);router[_0xf4f5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf4f5('0xe')](_0xf4f5('0xb'),auth[_0xf4f5('0x9')](),controller[_0xf4f5('0xf')]);router[_0xf4f5('0x10')](_0xf4f5('0xb'),auth[_0xf4f5('0x9')](),controller[_0xf4f5('0x11')]);module[_0xf4f5('0x12')]=router; \ No newline at end of file +var _0x0ba1=['/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x6180e6,_0x3ff8ec){var _0x3dcd81=function(_0x1c10d7){while(--_0x1c10d7){_0x6180e6['push'](_0x6180e6['shift']());}};_0x3dcd81(++_0x3ff8ec);}(_0x0ba1,0x126));var _0x10ba=function(_0x7ba01,_0xf9c8b9){_0x7ba01=_0x7ba01-0x0;var _0x4be6b4=_0x0ba1[_0x7ba01];return _0x4be6b4;};'use strict';var multer=require('multer');var util=require(_0x10ba('0x0'));var path=require(_0x10ba('0x1'));var timeout=require(_0x10ba('0x2'));var express=require(_0x10ba('0x3'));var router=express[_0x10ba('0x4')]();var fs_extra=require(_0x10ba('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x10ba('0x6'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x10ba('0x7')](),controller[_0x10ba('0x8')]);router[_0x10ba('0x9')](_0x10ba('0xa'),auth[_0x10ba('0x7')](),controller[_0x10ba('0xb')]);router[_0x10ba('0x9')](_0x10ba('0xc'),auth[_0x10ba('0x7')](),controller[_0x10ba('0xd')]);router['post']('/',auth[_0x10ba('0x7')](),controller[_0x10ba('0xe')]);router[_0x10ba('0xf')](_0x10ba('0xc'),auth[_0x10ba('0x7')](),controller['update']);router[_0x10ba('0x10')](_0x10ba('0xc'),auth['isAuthenticated'](),controller[_0x10ba('0x11')]);module[_0x10ba('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 3d8a8a9..a3bdeaa 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 _0xd755=['TEXT','sequelize','STRING'];(function(_0x2f6f3d,_0x642570){var _0x4a284b=function(_0x25cf30){while(--_0x25cf30){_0x2f6f3d['push'](_0x2f6f3d['shift']());}};_0x4a284b(++_0x642570);}(_0xd755,0x1bd));var _0x5d75=function(_0x459847,_0x3d79f4){_0x459847=_0x459847-0x0;var _0x3720fe=_0xd755[_0x459847];return _0x3720fe;};'use strict';var Sequelize=require(_0x5d75('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5d75('0x1')]},'node':{'type':Sequelize[_0x5d75('0x1')]},'application':{'type':Sequelize[_0x5d75('0x1')]},'data':{'type':Sequelize[_0x5d75('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5d75('0x1')]}}; \ No newline at end of file +var _0xe8e6=['STRING','TEXT','exports'];(function(_0x419c87,_0x41bf4d){var _0x3ac07f=function(_0x43240c){while(--_0x43240c){_0x419c87['push'](_0x419c87['shift']());}};_0x3ac07f(++_0x41bf4d);}(_0xe8e6,0x116));var _0x6e8e=function(_0xa26780,_0x269dc3){_0xa26780=_0xa26780-0x0;var _0x39556d=_0xe8e6[_0xa26780];return _0x39556d;};'use strict';var Sequelize=require('sequelize');module[_0x6e8e('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x6e8e('0x1')]},'application':{'type':Sequelize[_0x6e8e('0x1')]},'data':{'type':Sequelize[_0x6e8e('0x2')]},'project_name':{'type':Sequelize[_0x6e8e('0x1')]},'callerid':{'type':Sequelize[_0x6e8e('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 4e1ed92..752afc6 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 _0x20a0=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','../../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','count','limit','set','reject','save','update','then','stack','name','send','SquareDetailsReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','merge','where','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x20a0,0x152));var _0x020a=function(_0x527df7,_0x5e4fc4){_0x527df7=_0x527df7-0x0;var _0x3f4f96=_0x20a0[_0x527df7];return _0x3f4f96;};'use strict';var emlformat=require(_0x020a('0x0'));var rimraf=require(_0x020a('0x1'));var zipdir=require(_0x020a('0x2'));var jsonpatch=require(_0x020a('0x3'));var rp=require(_0x020a('0x4'));var moment=require(_0x020a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x020a('0x6'));var path=require(_0x020a('0x7'));var sox=require('sox');var csv=require(_0x020a('0x8'));var ejs=require(_0x020a('0x9'));var fs=require('fs');var fs_extra=require(_0x020a('0xa'));var _=require(_0x020a('0xb'));var squel=require(_0x020a('0xc'));var crypto=require(_0x020a('0xd'));var jsforce=require(_0x020a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x020a('0xf'));var qs=require(_0x020a('0x10'));var as=require(_0x020a('0x11'));var hardwareService=require(_0x020a('0x12'));var logger=require(_0x020a('0x13'))(_0x020a('0x14'));var utils=require(_0x020a('0x15'));var config=require(_0x020a('0x16'));var licenseUtil=require(_0x020a('0x17'));var db=require(_0x020a('0x18'))['db'];function respondWithStatusCode(_0x292cbd,_0x699b5){_0x699b5=_0x699b5||0xcc;return function(_0x56a6b1){if(_0x56a6b1){return _0x292cbd[_0x020a('0x19')](_0x699b5);}return _0x292cbd['status'](_0x699b5)[_0x020a('0x1a')]();};}function respondWithResult(_0x327b3d,_0x4a01ef){_0x4a01ef=_0x4a01ef||0xc8;return function(_0x22dabf){if(_0x22dabf){return _0x327b3d[_0x020a('0x1b')](_0x4a01ef)['json'](_0x22dabf);}};}function respondWithFilteredResult(_0x2ef60a,_0x17b9e5){return function(_0x29d1a1){if(_0x29d1a1){var _0x387ed9=typeof _0x17b9e5[_0x020a('0x1c')]==='undefined'&&typeof _0x17b9e5['limit']===_0x020a('0x1d');var _0x2b5edc=_0x29d1a1[_0x020a('0x1e')];var _0x195f0f=_0x387ed9?0x0:_0x17b9e5[_0x020a('0x1c')];var _0x5bf501=_0x387ed9?_0x29d1a1[_0x020a('0x1e')]:_0x17b9e5[_0x020a('0x1c')]+_0x17b9e5[_0x020a('0x1f')];var _0x3872fa;if(_0x5bf501>=_0x2b5edc){_0x5bf501=_0x2b5edc;_0x3872fa=0xc8;}else{_0x3872fa=0xce;}_0x2ef60a['status'](_0x3872fa);return _0x2ef60a[_0x020a('0x20')]('Content-Range',_0x195f0f+'-'+_0x5bf501+'/'+_0x2b5edc)['json'](_0x29d1a1);}return null;};}function patchUpdates(_0x5dfa93){return function(_0x15cbaa){try{jsonpatch['apply'](_0x15cbaa,_0x5dfa93,!![]);}catch(_0x2ffb1f){return BPromise[_0x020a('0x21')](_0x2ffb1f);}return _0x15cbaa[_0x020a('0x22')]();};}function saveUpdates(_0x25e2fa,_0xa62cbb){return function(_0x19c2ac){if(_0x19c2ac){return _0x19c2ac[_0x020a('0x23')](_0x25e2fa)[_0x020a('0x24')](function(_0x4a2395){return _0x4a2395;});}return null;};}function removeEntity(_0x9df48,_0x16ed98){return function(_0x3f031d){if(_0x3f031d){return _0x3f031d['destroy']()[_0x020a('0x24')](function(){_0x9df48[_0x020a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16e319,_0x54835e){return function(_0x122303){if(!_0x122303){_0x16e319['sendStatus'](0x194);}return _0x122303;};}function handleError(_0x4fd4ed,_0x191492){_0x191492=_0x191492||0x1f4;return function(_0x15600e){logger['error'](_0x15600e[_0x020a('0x25')]);if(_0x15600e[_0x020a('0x26')]){delete _0x15600e[_0x020a('0x26')];}_0x4fd4ed[_0x020a('0x1b')](_0x191492)[_0x020a('0x27')](_0x15600e);};}exports['index']=function(_0x57adc4,_0x428750){var _0x4d4c62={},_0xa7dae8={},_0x337183={'count':0x0,'rows':[]};var _0x1d18b3=_['map'](db[_0x020a('0x28')][_0x020a('0x29')],function(_0x5b7d76){return{'name':_0x5b7d76['fieldName'],'type':_0x5b7d76[_0x020a('0x2a')][_0x020a('0x2b')]};});_0xa7dae8[_0x020a('0x2c')]=_[_0x020a('0x2d')](_0x1d18b3,_0x020a('0x26'));_0xa7dae8['query']=_[_0x020a('0x2e')](_0x57adc4[_0x020a('0x2f')]);_0xa7dae8[_0x020a('0x30')]=_[_0x020a('0x31')](_0xa7dae8['model'],_0xa7dae8[_0x020a('0x2f')]);_0x4d4c62[_0x020a('0x32')]=_['intersection'](_0xa7dae8[_0x020a('0x2c')],qs['fields'](_0x57adc4[_0x020a('0x2f')][_0x020a('0x33')]));_0x4d4c62['attributes']=_0x4d4c62[_0x020a('0x32')][_0x020a('0x34')]?_0x4d4c62['attributes']:_0xa7dae8[_0x020a('0x2c')];if(!_0x57adc4['query']['hasOwnProperty'](_0x020a('0x35'))){_0x4d4c62[_0x020a('0x1f')]=qs['limit'](_0x57adc4[_0x020a('0x2f')][_0x020a('0x1f')]);_0x4d4c62[_0x020a('0x1c')]=qs[_0x020a('0x1c')](_0x57adc4['query'][_0x020a('0x1c')]);}_0x4d4c62['order']=qs[_0x020a('0x36')](_0x57adc4[_0x020a('0x2f')][_0x020a('0x36')]);_0x4d4c62['where']=qs['filters'](_['pick'](_0x57adc4[_0x020a('0x2f')],_0xa7dae8[_0x020a('0x30')]),_0x1d18b3);if(_0x57adc4['query']['filter']){_0x4d4c62['where']=_[_0x020a('0x37')](_0x4d4c62[_0x020a('0x38')],{'$or':_[_0x020a('0x2d')](_0x1d18b3,function(_0xe6d940){if(_0xe6d940['type']!=='VIRTUAL'){var _0x52f621={};_0x52f621[_0xe6d940[_0x020a('0x26')]]={'$like':'%'+_0x57adc4['query']['filter']+'%'};return _0x52f621;}})});}_0x4d4c62=_[_0x020a('0x37')]({},_0x4d4c62,_0x57adc4[_0x020a('0x39')]);var _0x4d4121={'where':_0x4d4c62['where']};return db[_0x020a('0x28')][_0x020a('0x1e')](_0x4d4121)['then'](function(_0x59dcc5){_0x337183[_0x020a('0x1e')]=_0x59dcc5;if(_0x57adc4['query']['includeAll']){_0x4d4c62[_0x020a('0x3a')]=[{'all':!![]}];}return db[_0x020a('0x28')][_0x020a('0x3b')](_0x4d4c62);})[_0x020a('0x24')](function(_0x5c318a){_0x337183[_0x020a('0x3c')]=_0x5c318a;return _0x337183;})[_0x020a('0x24')](respondWithFilteredResult(_0x428750,_0x4d4c62))[_0x020a('0x3d')](handleError(_0x428750,null));};exports[_0x020a('0x3e')]=function(_0x50b04f,_0x5b22c1){var _0x5b7021={'raw':!![],'where':{'id':_0x50b04f[_0x020a('0x3f')]['id']}},_0x295480={};_0x295480[_0x020a('0x2c')]=_[_0x020a('0x2e')](db[_0x020a('0x28')]['rawAttributes']);_0x295480[_0x020a('0x2f')]=_[_0x020a('0x2e')](_0x50b04f[_0x020a('0x2f')]);_0x295480[_0x020a('0x30')]=_[_0x020a('0x31')](_0x295480[_0x020a('0x2c')],_0x295480[_0x020a('0x2f')]);_0x5b7021[_0x020a('0x32')]=_[_0x020a('0x31')](_0x295480['model'],qs[_0x020a('0x33')](_0x50b04f['query']['fields']));_0x5b7021[_0x020a('0x32')]=_0x5b7021[_0x020a('0x32')]['length']?_0x5b7021[_0x020a('0x32')]:_0x295480[_0x020a('0x2c')];if(_0x50b04f['query'][_0x020a('0x40')]){_0x5b7021[_0x020a('0x3a')]=[{'all':!![]}];}_0x5b7021=_[_0x020a('0x37')]({},_0x5b7021,_0x50b04f[_0x020a('0x39')]);return db[_0x020a('0x28')]['find'](_0x5b7021)[_0x020a('0x24')](handleEntityNotFound(_0x5b22c1,null))[_0x020a('0x24')](respondWithResult(_0x5b22c1,null))[_0x020a('0x3d')](handleError(_0x5b22c1,null));};exports['create']=function(_0x2f2065,_0x480359){return db[_0x020a('0x28')][_0x020a('0x41')](_0x2f2065['body'],{})[_0x020a('0x24')](respondWithResult(_0x480359,0xc9))[_0x020a('0x3d')](handleError(_0x480359,null));};exports[_0x020a('0x23')]=function(_0x2e67d7,_0x5257c2){if(_0x2e67d7['body']['id']){delete _0x2e67d7[_0x020a('0x42')]['id'];}return db[_0x020a('0x28')][_0x020a('0x43')]({'where':{'id':_0x2e67d7[_0x020a('0x3f')]['id']}})[_0x020a('0x24')](handleEntityNotFound(_0x5257c2,null))[_0x020a('0x24')](saveUpdates(_0x2e67d7[_0x020a('0x42')],null))[_0x020a('0x24')](respondWithResult(_0x5257c2,null))[_0x020a('0x3d')](handleError(_0x5257c2,null));};exports['destroy']=function(_0x237f23,_0xab6c2d){return db[_0x020a('0x28')]['find']({'where':{'id':_0x237f23[_0x020a('0x3f')]['id']}})[_0x020a('0x24')](handleEntityNotFound(_0xab6c2d,null))[_0x020a('0x24')](removeEntity(_0xab6c2d,null))[_0x020a('0x3d')](handleError(_0xab6c2d,null));};exports[_0x020a('0x44')]=function(_0x99125c,_0x1cec7e){return db[_0x020a('0x28')]['describe']()[_0x020a('0x24')](respondWithResult(_0x1cec7e,null))[_0x020a('0x3d')](handleError(_0x1cec7e,null));}; \ No newline at end of file +var _0x1936=['create','update','body','find','describe','rimraf','fast-json-patch','bluebird','util','path','sox','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','destroy','then','name','send','index','map','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','SquareDetailsReport','includeAll','include','findAll','rows','params','keys','options','catch'];(function(_0x39cbe4,_0x4a7958){var _0xe76ba7=function(_0x332a08){while(--_0x332a08){_0x39cbe4['push'](_0x39cbe4['shift']());}};_0xe76ba7(++_0x4a7958);}(_0x1936,0x1e1));var _0x6193=function(_0x721e8b,_0x5e679d){_0x721e8b=_0x721e8b-0x0;var _0x3a0b53=_0x1936[_0x721e8b];return _0x3a0b53;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6193('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6193('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6193('0x2'));var Mustache=require('mustache');var util=require(_0x6193('0x3'));var path=require(_0x6193('0x4'));var sox=require(_0x6193('0x5'));var csv=require('to-csv');var ejs=require(_0x6193('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6193('0x7'));var jsforce=require(_0x6193('0x8'));var deskjs=require(_0x6193('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6193('0xa'));var Redis=require(_0x6193('0xb'));var authService=require(_0x6193('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6193('0xd'));var logger=require('../../config/logger')(_0x6193('0xe'));var utils=require(_0x6193('0xf'));var config=require(_0x6193('0x10'));var licenseUtil=require(_0x6193('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe36e77,_0x1bb856){_0x1bb856=_0x1bb856||0xcc;return function(_0x8c0d83){if(_0x8c0d83){return _0xe36e77[_0x6193('0x12')](_0x1bb856);}return _0xe36e77[_0x6193('0x13')](_0x1bb856)[_0x6193('0x14')]();};}function respondWithResult(_0x346bc9,_0x2e60e8){_0x2e60e8=_0x2e60e8||0xc8;return function(_0x7b7fe6){if(_0x7b7fe6){return _0x346bc9[_0x6193('0x13')](_0x2e60e8)[_0x6193('0x15')](_0x7b7fe6);}};}function respondWithFilteredResult(_0x1ed90f,_0x483128){return function(_0x2114bc){if(_0x2114bc){var _0x279d79=typeof _0x483128['offset']===_0x6193('0x16')&&typeof _0x483128['limit']===_0x6193('0x16');var _0x27f02c=_0x2114bc[_0x6193('0x17')];var _0x4b80a2=_0x279d79?0x0:_0x483128['offset'];var _0x2dcb1c=_0x279d79?_0x2114bc[_0x6193('0x17')]:_0x483128[_0x6193('0x18')]+_0x483128[_0x6193('0x19')];var _0x32bd51;if(_0x2dcb1c>=_0x27f02c){_0x2dcb1c=_0x27f02c;_0x32bd51=0xc8;}else{_0x32bd51=0xce;}_0x1ed90f[_0x6193('0x13')](_0x32bd51);return _0x1ed90f['set'](_0x6193('0x1a'),_0x4b80a2+'-'+_0x2dcb1c+'/'+_0x27f02c)[_0x6193('0x15')](_0x2114bc);}return null;};}function patchUpdates(_0x48f729){return function(_0x2e88e1){try{jsonpatch[_0x6193('0x1b')](_0x2e88e1,_0x48f729,!![]);}catch(_0x5f5776){return BPromise[_0x6193('0x1c')](_0x5f5776);}return _0x2e88e1['save']();};}function saveUpdates(_0x5411f7,_0x532849){return function(_0x2c2344){if(_0x2c2344){return _0x2c2344['update'](_0x5411f7)['then'](function(_0x3811ac){return _0x3811ac;});}return null;};}function removeEntity(_0x8f9c32,_0x1d871f){return function(_0x49119a){if(_0x49119a){return _0x49119a[_0x6193('0x1d')]()[_0x6193('0x1e')](function(){_0x8f9c32['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c25a,_0x375658){return function(_0xd25d50){if(!_0xd25d50){_0x46c25a[_0x6193('0x12')](0x194);}return _0xd25d50;};}function handleError(_0x354137,_0x317493){_0x317493=_0x317493||0x1f4;return function(_0x469ba5){logger['error'](_0x469ba5['stack']);if(_0x469ba5[_0x6193('0x1f')]){delete _0x469ba5[_0x6193('0x1f')];}_0x354137['status'](_0x317493)[_0x6193('0x20')](_0x469ba5);};}exports[_0x6193('0x21')]=function(_0x2fe436,_0x33f0bd){var _0x1957e7={},_0x18eff1={},_0x2bf0b7={'count':0x0,'rows':[]};var _0x128a52=_[_0x6193('0x22')](db['SquareDetailsReport'][_0x6193('0x23')],function(_0x2521d7){return{'name':_0x2521d7['fieldName'],'type':_0x2521d7['type'][_0x6193('0x24')]};});_0x18eff1[_0x6193('0x25')]=_[_0x6193('0x22')](_0x128a52,_0x6193('0x1f'));_0x18eff1[_0x6193('0x26')]=_['keys'](_0x2fe436[_0x6193('0x26')]);_0x18eff1[_0x6193('0x27')]=_['intersection'](_0x18eff1['model'],_0x18eff1[_0x6193('0x26')]);_0x1957e7[_0x6193('0x28')]=_[_0x6193('0x29')](_0x18eff1[_0x6193('0x25')],qs[_0x6193('0x2a')](_0x2fe436[_0x6193('0x26')]['fields']));_0x1957e7[_0x6193('0x28')]=_0x1957e7[_0x6193('0x28')][_0x6193('0x2b')]?_0x1957e7['attributes']:_0x18eff1[_0x6193('0x25')];if(!_0x2fe436[_0x6193('0x26')][_0x6193('0x2c')](_0x6193('0x2d'))){_0x1957e7[_0x6193('0x19')]=qs[_0x6193('0x19')](_0x2fe436['query']['limit']);_0x1957e7['offset']=qs[_0x6193('0x18')](_0x2fe436[_0x6193('0x26')]['offset']);}_0x1957e7[_0x6193('0x2e')]=qs[_0x6193('0x2f')](_0x2fe436[_0x6193('0x26')][_0x6193('0x2f')]);_0x1957e7[_0x6193('0x30')]=qs[_0x6193('0x27')](_[_0x6193('0x31')](_0x2fe436['query'],_0x18eff1[_0x6193('0x27')]),_0x128a52);if(_0x2fe436[_0x6193('0x26')][_0x6193('0x32')]){_0x1957e7[_0x6193('0x30')]=_[_0x6193('0x33')](_0x1957e7['where'],{'$or':_[_0x6193('0x22')](_0x128a52,function(_0x19ade8){if(_0x19ade8[_0x6193('0x34')]!==_0x6193('0x35')){var _0x4524a5={};_0x4524a5[_0x19ade8[_0x6193('0x1f')]]={'$like':'%'+_0x2fe436[_0x6193('0x26')][_0x6193('0x32')]+'%'};return _0x4524a5;}})});}_0x1957e7=_[_0x6193('0x33')]({},_0x1957e7,_0x2fe436['options']);var _0x1172ef={'where':_0x1957e7[_0x6193('0x30')]};return db[_0x6193('0x36')]['count'](_0x1172ef)[_0x6193('0x1e')](function(_0x20ef0d){_0x2bf0b7[_0x6193('0x17')]=_0x20ef0d;if(_0x2fe436['query'][_0x6193('0x37')]){_0x1957e7[_0x6193('0x38')]=[{'all':!![]}];}return db[_0x6193('0x36')][_0x6193('0x39')](_0x1957e7);})['then'](function(_0x10babf){_0x2bf0b7[_0x6193('0x3a')]=_0x10babf;return _0x2bf0b7;})['then'](respondWithFilteredResult(_0x33f0bd,_0x1957e7))['catch'](handleError(_0x33f0bd,null));};exports['show']=function(_0xfec6ce,_0x2a1fc3){var _0x4bede5={'raw':!![],'where':{'id':_0xfec6ce[_0x6193('0x3b')]['id']}},_0x391101={};_0x391101[_0x6193('0x25')]=_[_0x6193('0x3c')](db['SquareDetailsReport'][_0x6193('0x23')]);_0x391101['query']=_[_0x6193('0x3c')](_0xfec6ce['query']);_0x391101[_0x6193('0x27')]=_[_0x6193('0x29')](_0x391101[_0x6193('0x25')],_0x391101[_0x6193('0x26')]);_0x4bede5[_0x6193('0x28')]=_[_0x6193('0x29')](_0x391101[_0x6193('0x25')],qs[_0x6193('0x2a')](_0xfec6ce[_0x6193('0x26')][_0x6193('0x2a')]));_0x4bede5[_0x6193('0x28')]=_0x4bede5[_0x6193('0x28')]['length']?_0x4bede5['attributes']:_0x391101[_0x6193('0x25')];if(_0xfec6ce[_0x6193('0x26')][_0x6193('0x37')]){_0x4bede5[_0x6193('0x38')]=[{'all':!![]}];}_0x4bede5=_[_0x6193('0x33')]({},_0x4bede5,_0xfec6ce[_0x6193('0x3d')]);return db[_0x6193('0x36')]['find'](_0x4bede5)[_0x6193('0x1e')](handleEntityNotFound(_0x2a1fc3,null))['then'](respondWithResult(_0x2a1fc3,null))[_0x6193('0x3e')](handleError(_0x2a1fc3,null));};exports['create']=function(_0x11b0d0,_0x1cb8db){return db[_0x6193('0x36')][_0x6193('0x3f')](_0x11b0d0['body'],{})[_0x6193('0x1e')](respondWithResult(_0x1cb8db,0xc9))[_0x6193('0x3e')](handleError(_0x1cb8db,null));};exports[_0x6193('0x40')]=function(_0x1bab58,_0x581074){if(_0x1bab58[_0x6193('0x41')]['id']){delete _0x1bab58['body']['id'];}return db[_0x6193('0x36')][_0x6193('0x42')]({'where':{'id':_0x1bab58[_0x6193('0x3b')]['id']}})['then'](handleEntityNotFound(_0x581074,null))[_0x6193('0x1e')](saveUpdates(_0x1bab58[_0x6193('0x41')],null))[_0x6193('0x1e')](respondWithResult(_0x581074,null))[_0x6193('0x3e')](handleError(_0x581074,null));};exports[_0x6193('0x1d')]=function(_0x1d3ee5,_0x260744){return db[_0x6193('0x36')]['find']({'where':{'id':_0x1d3ee5[_0x6193('0x3b')]['id']}})[_0x6193('0x1e')](handleEntityNotFound(_0x260744,null))[_0x6193('0x1e')](removeEntity(_0x260744,null))[_0x6193('0x3e')](handleError(_0x260744,null));};exports[_0x6193('0x43')]=function(_0x5f2b8a,_0x3c48ea){return db[_0x6193('0x36')][_0x6193('0x43')]()['then'](respondWithResult(_0x3c48ea,null))['catch'](handleError(_0x3c48ea,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index f91b76b..b3573bb 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 _0xc2c0=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','api','bluebird','rimraf'];(function(_0x354d62,_0x4c2044){var _0x4a102c=function(_0x3e4c89){while(--_0x3e4c89){_0x354d62['push'](_0x354d62['shift']());}};_0x4a102c(++_0x4c2044);}(_0xc2c0,0xa7));var _0x0c2c=function(_0x4278e4,_0x179fc5){_0x4278e4=_0x4278e4-0x0;var _0x5668ae=_0xc2c0[_0x4278e4];return _0x5668ae;};'use strict';var _=require(_0x0c2c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0c2c('0x1'));var moment=require('moment');var BPromise=require(_0x0c2c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0c2c('0x3'));var config=require('../../config/environment');var attributes=require(_0x0c2c('0x4'));module[_0x0c2c('0x5')]=function(_0x4e5547,_0x2cc722){return _0x4e5547[_0x0c2c('0x6')](_0x0c2c('0x7'),attributes,{'tableName':_0x0c2c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe48b=['../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x4fec3a,_0x537e56){var _0x4eebe1=function(_0x6f7ddf){while(--_0x6f7ddf){_0x4fec3a['push'](_0x4fec3a['shift']());}};_0x4eebe1(++_0x537e56);}(_0xe48b,0x129));var _0xbe48=function(_0x481f46,_0x221bd5){_0x481f46=_0x481f46-0x0;var _0x3baa47=_0xe48b[_0x481f46];return _0x3baa47;};'use strict';var _=require(_0xbe48('0x0'));var util=require(_0xbe48('0x1'));var logger=require(_0xbe48('0x2'))(_0xbe48('0x3'));var moment=require(_0xbe48('0x4'));var BPromise=require(_0xbe48('0x5'));var rp=require(_0xbe48('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe48('0x7'));var config=require('../../config/environment');var attributes=require(_0xbe48('0x8'));module[_0xbe48('0x9')]=function(_0x52c230,_0x540587){return _0x52c230[_0xbe48('0xa')](_0xbe48('0xb'),attributes,{'tableName':_0xbe48('0xc'),'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 e1a8d77..f87fddf 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 _0x0b7f=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','SquareDetailsReport,\x20%s,\x20%s','message','request\x20sent','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','stringify','catch','lodash','util','bluebird'];(function(_0x2c46a7,_0x14d549){var _0x59fc85=function(_0x1514a5){while(--_0x1514a5){_0x2c46a7['push'](_0x2c46a7['shift']());}};_0x59fc85(++_0x14d549);}(_0x0b7f,0x115));var _0xf0b7=function(_0x17730a,_0x362127){_0x17730a=_0x17730a-0x0;var _0x485db1=_0x0b7f[_0x17730a];return _0x485db1;};'use strict';var _=require(_0xf0b7('0x0'));var util=require(_0xf0b7('0x1'));var moment=require('moment');var BPromise=require(_0xf0b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b7('0x3'));var db=require(_0xf0b7('0x4'))['db'];var utils=require(_0xf0b7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf0b7('0x6'));var jayson=require(_0xf0b7('0x7'));var client=jayson[_0xf0b7('0x8')][_0xf0b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b2de8,_0x5e449a,_0x1408ee){return new BPromise(function(_0x276f09,_0x275a13){return client[_0xf0b7('0xa')](_0x2b2de8,_0x1408ee)[_0xf0b7('0xb')](function(_0x588b46){logger[_0xf0b7('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x5e449a,'request\x20sent');logger['debug'](_0xf0b7('0xd'),_0x5e449a,'request\x20sent',JSON['stringify'](_0x588b46));if(_0x588b46[_0xf0b7('0xe')]){if(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0xf')]===0x1f4){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x275a13(_0x588b46[_0xf0b7('0xe')]['message']);}logger['error'](_0xf0b7('0x10'),_0x5e449a,_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);return _0x276f09(_0x588b46[_0xf0b7('0xe')][_0xf0b7('0x11')]);}else{logger['info'](_0xf0b7('0x10'),_0x5e449a,_0xf0b7('0x12'));_0x276f09(_0x588b46[_0xf0b7('0x13')][_0xf0b7('0x11')]);}})['catch'](function(_0x303db6){logger[_0xf0b7('0xe')](_0xf0b7('0x10'),_0x5e449a,_0x303db6);_0x275a13(_0x303db6);});});}exports[_0xf0b7('0x14')]=function(_0x52b27e){var _0x1e5fc9=this;return new Promise(function(_0x153d23,_0x28fd36){return db[_0xf0b7('0x15')][_0xf0b7('0x16')](_0x52b27e['body'],{'raw':_0x52b27e[_0xf0b7('0x17')]?_0x52b27e['options'][_0xf0b7('0x18')]===undefined?!![]:![]:!![]})[_0xf0b7('0xb')](function(_0x374496){logger['info']('CreateSquareDetailsReport',_0x52b27e);logger[_0xf0b7('0x19')](_0xf0b7('0x14'),_0x52b27e,JSON[_0xf0b7('0x1a')](_0x374496));_0x153d23(_0x374496);})[_0xf0b7('0x1b')](function(_0xb90b3c){logger[_0xf0b7('0xe')](_0xf0b7('0x14'),_0xb90b3c[_0xf0b7('0x11')],_0x52b27e);_0x28fd36(_0x1e5fc9[_0xf0b7('0xe')](0x1f4,_0xb90b3c['message']));});});}; \ No newline at end of file +var _0xde9f=['../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareDetailsReport','options','raw','CreateSquareDetailsReport','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x256827,_0xc5c033){var _0x41efa8=function(_0x5eb4f2){while(--_0x5eb4f2){_0x256827['push'](_0x256827['shift']());}};_0x41efa8(++_0xc5c033);}(_0xde9f,0x118));var _0xfde9=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xde9f[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfde9('0x1'));var rs=require(_0xfde9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfde9('0x3'))['db'];var utils=require(_0xfde9('0x4'));var logger=require('../../config/logger')(_0xfde9('0x5'));var config=require(_0xfde9('0x6'));var jayson=require(_0xfde9('0x7'));var client=jayson[_0xfde9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3e01,_0x179ee0,_0x18a202){return new BPromise(function(_0x5569c2,_0x19a337){return client[_0xfde9('0x9')](_0x4c3e01,_0x18a202)[_0xfde9('0xa')](function(_0x3b775d){logger[_0xfde9('0xb')](_0xfde9('0xc'),_0x179ee0,_0xfde9('0xd'));logger[_0xfde9('0xe')](_0xfde9('0xf'),_0x179ee0,_0xfde9('0xd'),JSON[_0xfde9('0x10')](_0x3b775d));if(_0x3b775d[_0xfde9('0x11')]){if(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x12')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x19a337(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x5569c2(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}else{logger[_0xfde9('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0xfde9('0xd'));_0x5569c2(_0x3b775d[_0xfde9('0x14')][_0xfde9('0x13')]);}})['catch'](function(_0x31b1c7){logger[_0xfde9('0x11')](_0xfde9('0xc'),_0x179ee0,_0x31b1c7);_0x19a337(_0x31b1c7);});});}exports['CreateSquareDetailsReport']=function(_0x4c9f24){var _0x5eb89e=this;return new Promise(function(_0x544f19,_0x166f1c){return db[_0xfde9('0x15')]['create'](_0x4c9f24['body'],{'raw':_0x4c9f24[_0xfde9('0x16')]?_0x4c9f24[_0xfde9('0x16')][_0xfde9('0x17')]===undefined?!![]:![]:!![]})[_0xfde9('0xa')](function(_0x162b07){logger[_0xfde9('0xb')](_0xfde9('0x18'),_0x4c9f24);logger[_0xfde9('0xe')](_0xfde9('0x18'),_0x4c9f24,JSON[_0xfde9('0x10')](_0x162b07));_0x544f19(_0x162b07);})[_0xfde9('0x19')](function(_0x28d189){logger['error'](_0xfde9('0x18'),_0x28d189['message'],_0x4c9f24);_0x166f1c(_0x5eb89e[_0xfde9('0x11')](0x1f4,_0x28d189[_0xfde9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 9b14f98..cfad67e 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 _0x1d2c=['/process/:pid/kill','isAuthenticated','killProcess','express','Router','./system.controller','get'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x1d2c,0x1df));var _0xc1d2=function(_0x43ee73,_0xe2d82a){_0x43ee73=_0x43ee73-0x0;var _0x46c602=_0x1d2c[_0x43ee73];return _0x46c602;};'use strict';var express=require(_0xc1d2('0x0'));var router=express[_0xc1d2('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xc1d2('0x2'));router[_0xc1d2('0x3')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc1d2('0x3')](_0xc1d2('0x4'),auth[_0xc1d2('0x5')](),controller[_0xc1d2('0x6')]);module['exports']=router; \ No newline at end of file +var _0x19b6=['/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router','./system.controller','get'];(function(_0x2ec77a,_0x3ea593){var _0x15d430=function(_0x38721f){while(--_0x38721f){_0x2ec77a['push'](_0x2ec77a['shift']());}};_0x15d430(++_0x3ea593);}(_0x19b6,0x124));var _0x619b=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0x19b6[_0x277721];return _0x286051;};'use strict';var express=require(_0x619b('0x0'));var router=express[_0x619b('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x619b('0x2'));router[_0x619b('0x3')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x619b('0x4'),auth[_0x619b('0x5')](),controller[_0x619b('0x6')]);module[_0x619b('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index feb8700..1fe77f7 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 _0xdd0d=['exec','api','util','lodash','error','inspect','name','send','index','then','status','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','systeminformation','child_process'];(function(_0x3f2cdb,_0x123c97){var _0xe804ee=function(_0x5b63c8){while(--_0x5b63c8){_0x3f2cdb['push'](_0x3f2cdb['shift']());}};_0xe804ee(++_0x123c97);}(_0xdd0d,0x1c0));var _0xddd0=function(_0x569b58,_0xc01048){_0x569b58=_0x569b58-0x0;var _0x40efd2=_0xdd0d[_0x569b58];return _0x40efd2;};'use strict';var info=require(_0xddd0('0x0'));var exec=require(_0xddd0('0x1'))[_0xddd0('0x2')];var logger=require('../../config/logger')(_0xddd0('0x3'));var util=require(_0xddd0('0x4'));var BPromise=require('bluebird');var _=require(_0xddd0('0x5'));function handleError(_0x518ae7,_0x2f73bf,_0x42180f){_0x2f73bf=_0x2f73bf||0x1f4;return function(_0x4d3b83){logger[_0xddd0('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x42180f,_0x2f73bf,util[_0xddd0('0x7')](_0x4d3b83,{'showHidden':![],'depth':null}));delete _0x4d3b83[_0xddd0('0x8')];_0x518ae7['status'](_0x2f73bf)[_0xddd0('0x9')](_0x4d3b83);};}exports[_0xddd0('0xa')]=function(_0x37026e,_0x3ef490){return info['getAllData']()[_0xddd0('0xb')](function(_0x3d4e12){return _0x3ef490[_0xddd0('0xc')](0xc8)['json'](_0x3d4e12);})[_0xddd0('0xd')](function(_0xc251e5){return _0x3ef490[_0xddd0('0xc')](0x1f4)[_0xddd0('0xe')](_0xc251e5);});};exports[_0xddd0('0xf')]=function(_0x19a0c4,_0x54620b){var _0x219e59=[_0xddd0('0x10')];return new BPromise(function(_0x505054,_0x53e044){return exec(util[_0xddd0('0x11')](_0xddd0('0x12'),_0x19a0c4[_0xddd0('0x13')][_0xddd0('0x14')]),function(_0x295c93,_0x25793d,_0x369ff9){if(_0x295c93){return _0x53e044(_0x295c93);}return _0x505054(_0x25793d);});})[_0xddd0('0xb')](function(_0x403b5a){var _0x5ca68f=![];var _0x1bdb27=_0x403b5a[_0xddd0('0x15')](/\n/);for(var _0x176aaa=0x0,_0x172daf=_0x219e59[_0xddd0('0x16')];_0x176aaa<_0x172daf,_0x5ca68f===![];_0x176aaa+=0x1){if(_0x403b5a['indexOf'](_0x219e59[_0x176aaa])>=0x0){_0x5ca68f=!![];}}if(!_0x5ca68f){throw new Error(util[_0xddd0('0x11')](_0xddd0('0x17'),_0x19a0c4[_0xddd0('0x13')][_0xddd0('0x14')]));}process['kill'](_0x19a0c4[_0xddd0('0x13')]['pid'],_0xddd0('0x18'));return _0x54620b[_0xddd0('0xc')](0xc8)[_0xddd0('0xe')]({'message':util[_0xddd0('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x19a0c4[_0xddd0('0x13')][_0xddd0('0x14')])});})[_0xddd0('0xd')](handleError(_0x54620b,null,_0xddd0('0xf')));}; \ No newline at end of file +var _0xb0ee=['length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','then','json','catch','killProcess','components/import/cm','format','params','pid','split'];(function(_0x85f05d,_0x1d6297){var _0x19c315=function(_0x1e689d){while(--_0x1e689d){_0x85f05d['push'](_0x85f05d['shift']());}};_0x19c315(++_0x1d6297);}(_0xb0ee,0x12e));var _0xeb0e=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xb0ee[_0x819464];return _0x49dcc0;};'use strict';var info=require(_0xeb0e('0x0'));var exec=require(_0xeb0e('0x1'))['exec'];var logger=require(_0xeb0e('0x2'))(_0xeb0e('0x3'));var util=require(_0xeb0e('0x4'));var BPromise=require(_0xeb0e('0x5'));var _=require('lodash');function handleError(_0x31dc0e,_0x292e78,_0x102dad){_0x292e78=_0x292e78||0x1f4;return function(_0x22ca01){logger[_0xeb0e('0x6')](_0xeb0e('0x7'),_0x102dad,_0x292e78,util[_0xeb0e('0x8')](_0x22ca01,{'showHidden':![],'depth':null}));delete _0x22ca01[_0xeb0e('0x9')];_0x31dc0e[_0xeb0e('0xa')](_0x292e78)['send'](_0x22ca01);};}exports[_0xeb0e('0xb')]=function(_0x5c866c,_0x375477){return info[_0xeb0e('0xc')]()[_0xeb0e('0xd')](function(_0x18809d){return _0x375477[_0xeb0e('0xa')](0xc8)[_0xeb0e('0xe')](_0x18809d);})[_0xeb0e('0xf')](function(_0x308a02){return _0x375477[_0xeb0e('0xa')](0x1f4)[_0xeb0e('0xe')](_0x308a02);});};exports[_0xeb0e('0x10')]=function(_0x44369f,_0x33c593){var _0xebe593=[_0xeb0e('0x11')];return new BPromise(function(_0x4ee539,_0x4f4afc){return exec(util[_0xeb0e('0x12')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x44369f[_0xeb0e('0x13')][_0xeb0e('0x14')]),function(_0x3dc192,_0x1ab9c2,_0x113ae3){if(_0x3dc192){return _0x4f4afc(_0x3dc192);}return _0x4ee539(_0x1ab9c2);});})['then'](function(_0x3a2320){var _0x107f33=![];var _0x19c69a=_0x3a2320[_0xeb0e('0x15')](/\n/);for(var _0x1dcad7=0x0,_0x2543c8=_0xebe593[_0xeb0e('0x16')];_0x1dcad7<_0x2543c8,_0x107f33===![];_0x1dcad7+=0x1){if(_0x3a2320[_0xeb0e('0x17')](_0xebe593[_0x1dcad7])>=0x0){_0x107f33=!![];}}if(!_0x107f33){throw new Error(util[_0xeb0e('0x12')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x44369f['params'][_0xeb0e('0x14')]));}process[_0xeb0e('0x18')](_0x44369f[_0xeb0e('0x13')][_0xeb0e('0x14')],_0xeb0e('0x19'));return _0x33c593[_0xeb0e('0xa')](0xc8)[_0xeb0e('0xe')]({'message':util['format'](_0xeb0e('0x1a'),_0x44369f[_0xeb0e('0x13')][_0xeb0e('0x14')])});})[_0xeb0e('0xf')](handleError(_0x33c593,null,_0xeb0e('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6d031ed..f461227 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 _0xe961=['fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports','connect-timeout','Router'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0xe961,0x11b));var _0x1e96=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xe961[_0x110c3d];return _0x226d67;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1e96('0x0'));var express=require('express');var router=express[_0x1e96('0x1')]();var fs_extra=require(_0x1e96('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1e96('0x3'));var config=require(_0x1e96('0x4'));var controller=require(_0x1e96('0x5'));router[_0x1e96('0x6')]('/',auth[_0x1e96('0x7')](),controller[_0x1e96('0x8')]);router[_0x1e96('0x6')](_0x1e96('0x9'),auth['isAuthenticated'](),controller[_0x1e96('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1e96('0xb')]);router['put'](_0x1e96('0x9'),auth[_0x1e96('0x7')](),controller[_0x1e96('0xc')]);router[_0x1e96('0xd')](_0x1e96('0x9'),auth[_0x1e96('0x7')](),controller['destroy']);module[_0x1e96('0xe')]=router; \ No newline at end of file +var _0x098b=['update','delete','destroy','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','post','create'];(function(_0x103466,_0x190bb5){var _0x416ba8=function(_0x4854c9){while(--_0x4854c9){_0x103466['push'](_0x103466['shift']());}};_0x416ba8(++_0x190bb5);}(_0x098b,0x6c));var _0xb098=function(_0x40bb04,_0x19f17f){_0x40bb04=_0x40bb04-0x0;var _0xa7bd12=_0x098b[_0x40bb04];return _0xa7bd12;};'use strict';var multer=require(_0xb098('0x0'));var util=require(_0xb098('0x1'));var path=require('path');var timeout=require(_0xb098('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb098('0x3'));var interaction=require(_0xb098('0x4'));var config=require(_0xb098('0x5'));var controller=require(_0xb098('0x6'));router[_0xb098('0x7')]('/',auth[_0xb098('0x8')](),controller['index']);router[_0xb098('0x7')](_0xb098('0x9'),auth[_0xb098('0x8')](),controller['show']);router[_0xb098('0xa')]('/',auth['isAuthenticated'](),controller[_0xb098('0xb')]);router['put']('/:id',auth[_0xb098('0x8')](),controller[_0xb098('0xc')]);router[_0xb098('0xd')](_0xb098('0x9'),auth[_0xb098('0x8')](),controller[_0xb098('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 431eeec..7741347 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 _0xb84e=['STRING','name','exports'];(function(_0x271418,_0xf00f2c){var _0x19bef0=function(_0xc31509){while(--_0xc31509){_0x271418['push'](_0x271418['shift']());}};_0x19bef0(++_0xf00f2c);}(_0xb84e,0xbf));var _0xeb84=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0xb84e[_0x284a61];return _0x220e3c;};'use strict';var Sequelize=require('sequelize');module[_0xeb84('0x0')]={'name':{'type':Sequelize[_0xeb84('0x1')],'unique':_0xeb84('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xeb84('0x1')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x263f=['#0091EA','sequelize','exports','STRING','name'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x263f,0x182));var _0xf263=function(_0x2e1767,_0x2d43e7){_0x2e1767=_0x2e1767-0x0;var _0x1697f6=_0x263f[_0x2e1767];return _0x1697f6;};'use strict';var Sequelize=require(_0xf263('0x0'));module[_0xf263('0x1')]={'name':{'type':Sequelize[_0xf263('0x2')],'unique':_0xf263('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf263('0x2')],'defaultValue':_0xf263('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 80863fb..f8787ec 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 _0xedd9=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','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','get','Tags','end','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','keys','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x198c58,_0x2ea394){var _0x361ce8=function(_0xe62e2f){while(--_0xe62e2f){_0x198c58['push'](_0x198c58['shift']());}};_0x361ce8(++_0x2ea394);}(_0xedd9,0xfc));var _0x9edd=function(_0x3ed583,_0xa0a388){_0x3ed583=_0x3ed583-0x0;var _0x35c84f=_0xedd9[_0x3ed583];return _0x35c84f;};'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(){var _0xeaf55a=_0x339a0d[_0x9edd('0x22')]({'plain':!![]});var _0x2f9f86=_0x9edd('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x2f9f86,'resourceId':_0xeaf55a['id']}})[_0x9edd('0x21')](function(){return _0x339a0d;});})[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x24')]();});}};}function handleEntityNotFound(_0x3c2227,_0x4fe471){return function(_0x57a2cc){if(!_0x57a2cc){_0x3c2227[_0x9edd('0x18')](0x194);}return _0x57a2cc;};}function handleError(_0x257a26,_0x1c762c){_0x1c762c=_0x1c762c||0x1f4;return function(_0x52746a){logger[_0x9edd('0x25')](_0x52746a[_0x9edd('0x26')]);if(_0x52746a[_0x9edd('0x27')]){delete _0x52746a[_0x9edd('0x27')];}_0x257a26['status'](_0x1c762c)[_0x9edd('0x28')](_0x52746a);};}exports[_0x9edd('0x29')]=function(_0xbe87e1,_0x12c1bc){var _0xbbf08f={},_0x42e664={},_0x209aba={'count':0x0,'rows':[]};var _0x1fba7b=_[_0x9edd('0x2a')](db[_0x9edd('0x2b')][_0x9edd('0x2c')],function(_0x138002){return{'name':_0x138002[_0x9edd('0x2d')],'type':_0x138002[_0x9edd('0x2e')][_0x9edd('0x2f')]};});_0x42e664['model']=_[_0x9edd('0x2a')](_0x1fba7b,_0x9edd('0x27'));_0x42e664[_0x9edd('0x30')]=_['keys'](_0xbe87e1[_0x9edd('0x30')]);_0x42e664[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x42e664[_0x9edd('0x33')],_0x42e664[_0x9edd('0x30')]);_0xbbf08f[_0x9edd('0x34')]=_[_0x9edd('0x32')](_0x42e664[_0x9edd('0x33')],qs[_0x9edd('0x35')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x35')]));_0xbbf08f[_0x9edd('0x34')]=_0xbbf08f[_0x9edd('0x34')][_0x9edd('0x36')]?_0xbbf08f['attributes']:_0x42e664[_0x9edd('0x33')];if(!_0xbe87e1['query'][_0x9edd('0x37')](_0x9edd('0x38'))){_0xbbf08f[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0xbe87e1[_0x9edd('0x30')]['limit']);_0xbbf08f[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x1b')]);}_0xbbf08f[_0x9edd('0x39')]=qs[_0x9edd('0x3a')](_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x3a')]);_0xbbf08f[_0x9edd('0x3b')]=qs[_0x9edd('0x31')](_['pick'](_0xbe87e1[_0x9edd('0x30')],_0x42e664['filters']),_0x1fba7b);if(_0xbe87e1[_0x9edd('0x30')]['filter']){_0xbbf08f[_0x9edd('0x3b')]=_[_0x9edd('0x3c')](_0xbbf08f[_0x9edd('0x3b')],{'$or':_['map'](_0x1fba7b,function(_0x2e85aa){if(_0x2e85aa[_0x9edd('0x2e')]!==_0x9edd('0x3d')){var _0x48958a={};_0x48958a[_0x2e85aa[_0x9edd('0x27')]]={'$like':'%'+_0xbe87e1['query'][_0x9edd('0x3e')]+'%'};return _0x48958a;}})});}_0xbbf08f=_[_0x9edd('0x3c')]({},_0xbbf08f,_0xbe87e1['options']);var _0x315f52={'where':_0xbbf08f[_0x9edd('0x3b')]};return db[_0x9edd('0x2b')][_0x9edd('0x1e')](_0x315f52)['then'](function(_0x449f01){_0x209aba['count']=_0x449f01;if(_0xbe87e1[_0x9edd('0x30')][_0x9edd('0x3f')]){_0xbbf08f['include']=[{'all':!![]}];}return db[_0x9edd('0x2b')]['findAll'](_0xbbf08f);})['then'](function(_0x369b69){_0x209aba[_0x9edd('0x40')]=_0x369b69;return _0x209aba;})[_0x9edd('0x21')](respondWithFilteredResult(_0x12c1bc,_0xbbf08f))[_0x9edd('0x41')](handleError(_0x12c1bc,null));};exports[_0x9edd('0x42')]=function(_0x4737ae,_0x3ff512){var _0x75efbe={'raw':!![],'where':{'id':_0x4737ae[_0x9edd('0x43')]['id']}},_0x18c149={};_0x18c149[_0x9edd('0x33')]=_[_0x9edd('0x44')](db[_0x9edd('0x2b')][_0x9edd('0x2c')]);_0x18c149[_0x9edd('0x30')]=_['keys'](_0x4737ae[_0x9edd('0x30')]);_0x18c149[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x18c149[_0x9edd('0x33')],_0x18c149[_0x9edd('0x30')]);_0x75efbe[_0x9edd('0x34')]=_[_0x9edd('0x32')](_0x18c149['model'],qs['fields'](_0x4737ae['query'][_0x9edd('0x35')]));_0x75efbe['attributes']=_0x75efbe[_0x9edd('0x34')][_0x9edd('0x36')]?_0x75efbe[_0x9edd('0x34')]:_0x18c149[_0x9edd('0x33')];if(_0x4737ae[_0x9edd('0x30')]['includeAll']){_0x75efbe[_0x9edd('0x45')]=[{'all':!![]}];}_0x75efbe=_[_0x9edd('0x3c')]({},_0x75efbe,_0x4737ae[_0x9edd('0x46')]);return db['Tag'][_0x9edd('0x47')](_0x75efbe)[_0x9edd('0x21')](handleEntityNotFound(_0x3ff512,null))[_0x9edd('0x21')](respondWithResult(_0x3ff512,null))[_0x9edd('0x41')](handleError(_0x3ff512,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){return db[_0x9edd('0x2b')][_0x9edd('0x48')](_0x35bdec['body'],{})[_0x9edd('0x21')](function(_0x8d8701){var _0x4bb324=_0x35bdec[_0x9edd('0x49')][_0x9edd('0x22')]({'plain':!![]});if(!_0x4bb324)throw new Error(_0x9edd('0x4a'));if(_0x4bb324['role']===_0x9edd('0x49')){var _0x151157=_0x8d8701[_0x9edd('0x22')]({'plain':!![]});var _0x28c7bd='Tags';return db[_0x9edd('0x4b')][_0x9edd('0x47')]({'where':{'name':_0x28c7bd,'userProfileId':_0x4bb324[_0x9edd('0x4c')]},'raw':!![]})['then'](function(_0x16951a){if(_0x16951a&&_0x16951a[_0x9edd('0x4d')]===0x0){return db['UserProfileResource'][_0x9edd('0x48')]({'name':_0x151157['name'],'resourceId':_0x151157['id'],'type':_0x16951a[_0x9edd('0x27')],'sectionId':_0x16951a['id']},{})[_0x9edd('0x21')](function(){return _0x8d8701;});}else{return _0x8d8701;}})[_0x9edd('0x41')](function(_0x3fcdf5){logger[_0x9edd('0x25')](_0x9edd('0x4e'),_0x3fcdf5);throw _0x3fcdf5;});}return _0x8d8701;})[_0x9edd('0x21')](respondWithResult(_0x4d4f33,0xc9))[_0x9edd('0x41')](handleError(_0x4d4f33,null));};exports[_0x9edd('0x4f')]=function(_0x25d9cc,_0x31272d){if(_0x25d9cc['body']['id']){delete _0x25d9cc[_0x9edd('0x50')]['id'];}return db[_0x9edd('0x2b')][_0x9edd('0x47')]({'where':{'id':_0x25d9cc['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x31272d,null))['then'](saveUpdates(_0x25d9cc['body'],null))['then'](respondWithResult(_0x31272d,null))[_0x9edd('0x41')](handleError(_0x31272d,null));};exports[_0x9edd('0x51')]=function(_0x366316,_0x35ddb3){return db['Tag']['find']({'where':{'id':_0x366316['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x35ddb3,null))[_0x9edd('0x21')](removeEntity(_0x35ddb3,null))[_0x9edd('0x41')](handleError(_0x35ddb3,null));}; \ No newline at end of file +var _0x76dc=['where','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','catch','show','params','intersection','includeAll','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','name','send','Tag','fieldName','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x50e30b,_0x216368){var _0x4b7300=function(_0x8f06d7){while(--_0x8f06d7){_0x50e30b['push'](_0x50e30b['shift']());}};_0x4b7300(++_0x216368);}(_0x76dc,0x1f2));var _0xc76d=function(_0x8844e1,_0x3220d3){_0x8844e1=_0x8844e1-0x0;var _0x84782f=_0x76dc[_0x8844e1];return _0x84782f;};'use strict';var emlformat=require(_0xc76d('0x0'));var rimraf=require(_0xc76d('0x1'));var zipdir=require(_0xc76d('0x2'));var jsonpatch=require(_0xc76d('0x3'));var rp=require('request-promise');var moment=require(_0xc76d('0x4'));var BPromise=require(_0xc76d('0x5'));var Mustache=require('mustache');var util=require(_0xc76d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc76d('0x7'));var ejs=require(_0xc76d('0x8'));var fs=require('fs');var fs_extra=require(_0xc76d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];function respondWithStatusCode(_0x2e02e9,_0x1722b3){_0x1722b3=_0x1722b3||0xcc;return function(_0x311814){if(_0x311814){return _0x2e02e9[_0xc76d('0x17')](_0x1722b3);}return _0x2e02e9[_0xc76d('0x18')](_0x1722b3)[_0xc76d('0x19')]();};}function respondWithResult(_0x3ed1bd,_0x5cda20){_0x5cda20=_0x5cda20||0xc8;return function(_0x8696db){if(_0x8696db){return _0x3ed1bd[_0xc76d('0x18')](_0x5cda20)['json'](_0x8696db);}};}function respondWithFilteredResult(_0x4741a4,_0x2d23d2){return function(_0x47a4ee){if(_0x47a4ee){var _0x6f94e=typeof _0x2d23d2['offset']===_0xc76d('0x1a')&&typeof _0x2d23d2['limit']==='undefined';var _0x45a83e=_0x47a4ee[_0xc76d('0x1b')];var _0x339623=_0x6f94e?0x0:_0x2d23d2[_0xc76d('0x1c')];var _0xd1d16f=_0x6f94e?_0x47a4ee['count']:_0x2d23d2[_0xc76d('0x1c')]+_0x2d23d2[_0xc76d('0x1d')];var _0xa0c5b6;if(_0xd1d16f>=_0x45a83e){_0xd1d16f=_0x45a83e;_0xa0c5b6=0xc8;}else{_0xa0c5b6=0xce;}_0x4741a4[_0xc76d('0x18')](_0xa0c5b6);return _0x4741a4[_0xc76d('0x1e')]('Content-Range',_0x339623+'-'+_0xd1d16f+'/'+_0x45a83e)[_0xc76d('0x1f')](_0x47a4ee);}return null;};}function patchUpdates(_0x324db7){return function(_0x5dffde){try{jsonpatch[_0xc76d('0x20')](_0x5dffde,_0x324db7,!![]);}catch(_0x777f22){return BPromise[_0xc76d('0x21')](_0x777f22);}return _0x5dffde[_0xc76d('0x22')]();};}function saveUpdates(_0x18f546,_0x3d357b){return function(_0x42b89c){if(_0x42b89c){return _0x42b89c[_0xc76d('0x23')](_0x18f546)[_0xc76d('0x24')](function(_0x20e09c){return _0x20e09c;});}return null;};}function removeEntity(_0x15328d,_0x5de11f){return function(_0x11b42f){if(_0x11b42f){return _0x11b42f[_0xc76d('0x25')]()['then'](function(){var _0x637d68=_0x11b42f[_0xc76d('0x26')]({'plain':!![]});var _0x55ca79=_0xc76d('0x27');return db[_0xc76d('0x28')][_0xc76d('0x25')]({'where':{'type':_0x55ca79,'resourceId':_0x637d68['id']}})[_0xc76d('0x24')](function(){return _0x11b42f;});})[_0xc76d('0x24')](function(){_0x15328d[_0xc76d('0x18')](0xcc)[_0xc76d('0x19')]();});}};}function handleEntityNotFound(_0x59ebd1,_0x59dabf){return function(_0x285430){if(!_0x285430){_0x59ebd1[_0xc76d('0x17')](0x194);}return _0x285430;};}function handleError(_0x5069ea,_0x31501a){_0x31501a=_0x31501a||0x1f4;return function(_0x52a79a){logger[_0xc76d('0x29')](_0x52a79a['stack']);if(_0x52a79a[_0xc76d('0x2a')]){delete _0x52a79a['name'];}_0x5069ea[_0xc76d('0x18')](_0x31501a)[_0xc76d('0x2b')](_0x52a79a);};}exports['index']=function(_0x3d4076,_0x1c68f3){var _0x9ab96c={},_0x2cf501={},_0x4feeda={'count':0x0,'rows':[]};var _0x283e16=_['map'](db[_0xc76d('0x2c')]['rawAttributes'],function(_0x30769f){return{'name':_0x30769f[_0xc76d('0x2d')],'type':_0x30769f['type']['key']};});_0x2cf501['model']=_['map'](_0x283e16,_0xc76d('0x2a'));_0x2cf501[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x3d4076[_0xc76d('0x2e')]);_0x2cf501[_0xc76d('0x30')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],_0x2cf501['query']);_0x9ab96c[_0xc76d('0x32')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x33')]));_0x9ab96c[_0xc76d('0x32')]=_0x9ab96c['attributes'][_0xc76d('0x34')]?_0x9ab96c[_0xc76d('0x32')]:_0x2cf501[_0xc76d('0x31')];if(!_0x3d4076['query'][_0xc76d('0x35')](_0xc76d('0x36'))){_0x9ab96c[_0xc76d('0x1d')]=qs['limit'](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1d')]);_0x9ab96c[_0xc76d('0x1c')]=qs[_0xc76d('0x1c')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1c')]);}_0x9ab96c['order']=qs['sort'](_0x3d4076[_0xc76d('0x2e')]['sort']);_0x9ab96c[_0xc76d('0x37')]=qs[_0xc76d('0x30')](_[_0xc76d('0x38')](_0x3d4076[_0xc76d('0x2e')],_0x2cf501['filters']),_0x283e16);if(_0x3d4076['query'][_0xc76d('0x39')]){_0x9ab96c[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x9ab96c[_0xc76d('0x37')],{'$or':_[_0xc76d('0x3b')](_0x283e16,function(_0x58c724){if(_0x58c724[_0xc76d('0x3c')]!==_0xc76d('0x3d')){var _0x321989={};_0x321989[_0x58c724[_0xc76d('0x2a')]]={'$like':'%'+_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x39')]+'%'};return _0x321989;}})});}_0x9ab96c=_[_0xc76d('0x3a')]({},_0x9ab96c,_0x3d4076[_0xc76d('0x3e')]);var _0x305f7d={'where':_0x9ab96c[_0xc76d('0x37')]};return db['Tag']['count'](_0x305f7d)[_0xc76d('0x24')](function(_0x2a0759){_0x4feeda[_0xc76d('0x1b')]=_0x2a0759;if(_0x3d4076[_0xc76d('0x2e')]['includeAll']){_0x9ab96c['include']=[{'all':!![]}];}return db[_0xc76d('0x2c')][_0xc76d('0x3f')](_0x9ab96c);})[_0xc76d('0x24')](function(_0x15eb42){_0x4feeda[_0xc76d('0x40')]=_0x15eb42;return _0x4feeda;})[_0xc76d('0x24')](respondWithFilteredResult(_0x1c68f3,_0x9ab96c))[_0xc76d('0x41')](handleError(_0x1c68f3,null));};exports[_0xc76d('0x42')]=function(_0x50e922,_0x7bf0){var _0x95193f={'raw':!![],'where':{'id':_0x50e922[_0xc76d('0x43')]['id']}},_0x1bf8a0={};_0x1bf8a0['model']=_['keys'](db['Tag']['rawAttributes']);_0x1bf8a0['query']=_['keys'](_0x50e922['query']);_0x1bf8a0[_0xc76d('0x30')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],_0x1bf8a0[_0xc76d('0x2e')]);_0x95193f[_0xc76d('0x32')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x50e922['query'][_0xc76d('0x33')]));_0x95193f[_0xc76d('0x32')]=_0x95193f[_0xc76d('0x32')][_0xc76d('0x34')]?_0x95193f[_0xc76d('0x32')]:_0x1bf8a0[_0xc76d('0x31')];if(_0x50e922[_0xc76d('0x2e')][_0xc76d('0x45')]){_0x95193f[_0xc76d('0x46')]=[{'all':!![]}];}_0x95193f=_['merge']({},_0x95193f,_0x50e922['options']);return db[_0xc76d('0x2c')][_0xc76d('0x47')](_0x95193f)[_0xc76d('0x24')](handleEntityNotFound(_0x7bf0,null))[_0xc76d('0x24')](respondWithResult(_0x7bf0,null))[_0xc76d('0x41')](handleError(_0x7bf0,null));};exports['create']=function(_0x25fc9d,_0x1ede13){return db['Tag']['create'](_0x25fc9d[_0xc76d('0x48')],{})[_0xc76d('0x24')](function(_0x48cad0){var _0xe44a25=_0x25fc9d[_0xc76d('0x49')][_0xc76d('0x26')]({'plain':!![]});if(!_0xe44a25)throw new Error(_0xc76d('0x4a'));if(_0xe44a25[_0xc76d('0x4b')]===_0xc76d('0x49')){var _0x25a549=_0x48cad0[_0xc76d('0x26')]({'plain':!![]});var _0x4452a8=_0xc76d('0x27');return db['UserProfileSection'][_0xc76d('0x47')]({'where':{'name':_0x4452a8,'userProfileId':_0xe44a25[_0xc76d('0x4c')]},'raw':!![]})[_0xc76d('0x24')](function(_0x55e3af){if(_0x55e3af&&_0x55e3af[_0xc76d('0x4d')]===0x0){return db[_0xc76d('0x28')]['create']({'name':_0x25a549[_0xc76d('0x2a')],'resourceId':_0x25a549['id'],'type':_0x55e3af['name'],'sectionId':_0x55e3af['id']},{})[_0xc76d('0x24')](function(){return _0x48cad0;});}else{return _0x48cad0;}})[_0xc76d('0x41')](function(_0x316978){logger[_0xc76d('0x29')](_0xc76d('0x4e'),_0x316978);throw _0x316978;});}return _0x48cad0;})['then'](respondWithResult(_0x1ede13,0xc9))['catch'](handleError(_0x1ede13,null));};exports['update']=function(_0x320483,_0x746759){if(_0x320483[_0xc76d('0x48')]['id']){delete _0x320483[_0xc76d('0x48')]['id'];}return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x320483['params']['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x746759,null))[_0xc76d('0x24')](saveUpdates(_0x320483[_0xc76d('0x48')],null))[_0xc76d('0x24')](respondWithResult(_0x746759,null))[_0xc76d('0x41')](handleError(_0x746759,null));};exports['destroy']=function(_0x275dfd,_0x463cbe){return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x275dfd[_0xc76d('0x43')]['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x463cbe,null))['then'](removeEntity(_0x463cbe,null))[_0xc76d('0x41')](handleError(_0x463cbe,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 27f4aeb..a5f9419 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 _0xb56b=['../../config/logger','api','moment','bluebird','path','rimraf','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x54c176,_0x1566b2){var _0x3c912=function(_0x26f0b7){while(--_0x26f0b7){_0x54c176['push'](_0x54c176['shift']());}};_0x3c912(++_0x1566b2);}(_0xb56b,0xdc));var _0xbb56=function(_0x2ee01d,_0x48f7a7){_0x2ee01d=_0x2ee01d-0x0;var _0x24bc9f=_0xb56b[_0x2ee01d];return _0x24bc9f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbb56('0x0'))(_0xbb56('0x1'));var moment=require(_0xbb56('0x2'));var BPromise=require(_0xbb56('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb56('0x4'));var rimraf=require(_0xbb56('0x5'));var config=require('../../config/environment');var attributes=require(_0xbb56('0x6'));module[_0xbb56('0x7')]=function(_0x414691,_0x3dc5ef){return _0x414691[_0xbb56('0x8')](_0xbb56('0x9'),attributes,{'tableName':_0xbb56('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91b0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','lodash','util','../../config/logger','api'];(function(_0x21cb07,_0x1deaac){var _0x18129b=function(_0x21e778){while(--_0x21e778){_0x21cb07['push'](_0x21cb07['shift']());}};_0x18129b(++_0x1deaac);}(_0x91b0,0x1ca));var _0x091b=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x91b0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x091b('0x0'));var util=require(_0x091b('0x1'));var logger=require(_0x091b('0x2'))(_0x091b('0x3'));var moment=require(_0x091b('0x4'));var BPromise=require(_0x091b('0x5'));var rp=require(_0x091b('0x6'));var fs=require('fs');var path=require(_0x091b('0x7'));var rimraf=require(_0x091b('0x8'));var config=require(_0x091b('0x9'));var attributes=require(_0x091b('0xa'));module['exports']=function(_0x4b7c11,_0x58e92f){return _0x4b7c11['define']('Tag',attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 651348a..ee0ccc3 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 _0x99c9=['code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4a52ed,_0x25b476){var _0x2fa11b=function(_0x7fb989){while(--_0x7fb989){_0x4a52ed['push'](_0x4a52ed['shift']());}};_0x2fa11b(++_0x25b476);}(_0x99c9,0x13c));var _0x999c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x99c9[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x999c('0x0'));var util=require(_0x999c('0x1'));var moment=require(_0x999c('0x2'));var BPromise=require(_0x999c('0x3'));var rs=require(_0x999c('0x4'));var fs=require('fs');var Redis=require(_0x999c('0x5'));var db=require(_0x999c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x999c('0x7'))(_0x999c('0x8'));var config=require(_0x999c('0x9'));var jayson=require(_0x999c('0xa'));var client=jayson[_0x999c('0xb')][_0x999c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34f100,_0x651b7e,_0xc8a6b5){return new BPromise(function(_0xb88ec1,_0x329252){return client[_0x999c('0xd')](_0x34f100,_0xc8a6b5)[_0x999c('0xe')](function(_0x395321){logger['info'](_0x999c('0xf'),_0x651b7e,_0x999c('0x10'));logger['debug'](_0x999c('0x11'),_0x651b7e,_0x999c('0x10'),JSON[_0x999c('0x12')](_0x395321));if(_0x395321[_0x999c('0x13')]){if(_0x395321[_0x999c('0x13')][_0x999c('0x14')]===0x1f4){logger[_0x999c('0x13')](_0x999c('0xf'),_0x651b7e,_0x395321[_0x999c('0x13')][_0x999c('0x15')]);return _0x329252(_0x395321[_0x999c('0x13')][_0x999c('0x15')]);}logger['error'](_0x999c('0xf'),_0x651b7e,_0x395321[_0x999c('0x13')]['message']);return _0xb88ec1(_0x395321['error']['message']);}else{logger[_0x999c('0x16')](_0x999c('0xf'),_0x651b7e,_0x999c('0x10'));_0xb88ec1(_0x395321[_0x999c('0x17')][_0x999c('0x15')]);}})['catch'](function(_0x226437){logger[_0x999c('0x13')](_0x999c('0xf'),_0x651b7e,_0x226437);_0x329252(_0x226437);});});} \ No newline at end of file +var _0x8ce3=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird'];(function(_0x283249,_0x1fcf24){var _0xe0c64e=function(_0xd990b9){while(--_0xd990b9){_0x283249['push'](_0x283249['shift']());}};_0xe0c64e(++_0x1fcf24);}(_0x8ce3,0xc3));var _0x38ce=function(_0x51b52e,_0x3c2506){_0x51b52e=_0x51b52e-0x0;var _0x59a011=_0x8ce3[_0x51b52e];return _0x59a011;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var moment=require('moment');var BPromise=require(_0x38ce('0x2'));var rs=require(_0x38ce('0x3'));var fs=require('fs');var Redis=require(_0x38ce('0x4'));var db=require(_0x38ce('0x5'))['db'];var utils=require(_0x38ce('0x6'));var logger=require(_0x38ce('0x7'))(_0x38ce('0x8'));var config=require(_0x38ce('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38ce('0xa')][_0x38ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58074c,_0x262b13,_0xbe7332){return new BPromise(function(_0x3f8011,_0x482955){return client[_0x38ce('0xc')](_0x58074c,_0xbe7332)['then'](function(_0x725d27){logger['info'](_0x38ce('0xd'),_0x262b13,_0x38ce('0xe'));logger[_0x38ce('0xf')](_0x38ce('0x10'),_0x262b13,_0x38ce('0xe'),JSON[_0x38ce('0x11')](_0x725d27));if(_0x725d27[_0x38ce('0x12')]){if(_0x725d27[_0x38ce('0x12')][_0x38ce('0x13')]===0x1f4){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);return _0x482955(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}logger[_0x38ce('0x12')]('Tag,\x20%s,\x20%s',_0x262b13,_0x725d27['error'][_0x38ce('0x14')]);return _0x3f8011(_0x725d27[_0x38ce('0x12')][_0x38ce('0x14')]);}else{logger['info'](_0x38ce('0xd'),_0x262b13,'request\x20sent');_0x3f8011(_0x725d27[_0x38ce('0x15')][_0x38ce('0x14')]);}})['catch'](function(_0x5fc115){logger[_0x38ce('0x12')](_0x38ce('0xd'),_0x262b13,_0x5fc115);_0x482955(_0x5fc115);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 391a285..536df99 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 1053ebf..25e8101 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 _0xd8b0=['exports','sequelize'];(function(_0x264dab,_0x3438a9){var _0x4ef151=function(_0x2766fd){while(--_0x2766fd){_0x264dab['push'](_0x264dab['shift']());}};_0x4ef151(++_0x3438a9);}(_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':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x35bea2,_0x54beb7){var _0x1ef1c9=function(_0x327e2b){while(--_0x327e2b){_0x35bea2['push'](_0x35bea2['shift']());}};_0x1ef1c9(++_0x54beb7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index b445162..fbb894c 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 _0x4ae7=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','index','map','Team','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','findAll','catch','show','params','filters','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','UserVoiceQueue','MailQueueId','UserMailQueue','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','add','ids','removeQueues','remove','Queues','addAgents','Chat','Mail','Fax','Openchannel','Voice','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause','isNil','interface','format','SIP/%s','all','TeamVoicePrefix','spread','removeAgents','isArray','Sms','Whatsapp','emit','Queue:remove','UserVoiceQueueRt','filter','nolimit','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./team.socket','register'];(function(_0x202d3d,_0x5beba3){var _0xc28de5=function(_0x5b197d){while(--_0x5b197d){_0x202d3d['push'](_0x202d3d['shift']());}};_0xc28de5(++_0x5beba3);}(_0x4ae7,0x11e));var _0x74ae=function(_0x39322e,_0x234ff5){_0x39322e=_0x39322e-0x0;var _0x412af8=_0x4ae7[_0x39322e];return _0x412af8;};'use strict';var emlformat=require(_0x74ae('0x0'));var rimraf=require(_0x74ae('0x1'));var zipdir=require(_0x74ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74ae('0x3'));var moment=require(_0x74ae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x74ae('0x5'));var util=require(_0x74ae('0x6'));var path=require(_0x74ae('0x7'));var sox=require(_0x74ae('0x8'));var csv=require(_0x74ae('0x9'));var ejs=require(_0x74ae('0xa'));var fs=require('fs');var fs_extra=require(_0x74ae('0xb'));var _=require(_0x74ae('0xc'));var squel=require(_0x74ae('0xd'));var crypto=require(_0x74ae('0xe'));var jsforce=require(_0x74ae('0xf'));var deskjs=require(_0x74ae('0x10'));var toCsv=require(_0x74ae('0x9'));var querystring=require(_0x74ae('0x11'));var Papa=require('papaparse');var Redis=require(_0x74ae('0x12'));var authService=require(_0x74ae('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x74ae('0x14'));var hardwareService=require(_0x74ae('0x15'));var logger=require(_0x74ae('0x16'))('api');var utils=require(_0x74ae('0x17'));var config=require(_0x74ae('0x18'));var licenseUtil=require(_0x74ae('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x74ae('0x1a')](config[_0x74ae('0x1b')],{'host':_0x74ae('0x1c'),'port':0x18eb});var socket=require(_0x74ae('0x1d'))(new Redis(config[_0x74ae('0x1b')]));require(_0x74ae('0x1e'))[_0x74ae('0x1f')](socket);function respondWithStatusCode(_0x259d92,_0x2fc76e){_0x2fc76e=_0x2fc76e||0xcc;return function(_0x350623){if(_0x350623){return _0x259d92[_0x74ae('0x20')](_0x2fc76e);}return _0x259d92[_0x74ae('0x21')](_0x2fc76e)[_0x74ae('0x22')]();};}function respondWithResult(_0x45e86e,_0x43be1d){_0x43be1d=_0x43be1d||0xc8;return function(_0x3f0bc3){if(_0x3f0bc3){return _0x45e86e[_0x74ae('0x21')](_0x43be1d)[_0x74ae('0x23')](_0x3f0bc3);}};}function respondWithFilteredResult(_0x2a144f,_0x497387){return function(_0x404445){if(_0x404445){var _0x240038=typeof _0x497387[_0x74ae('0x24')]===_0x74ae('0x25')&&typeof _0x497387[_0x74ae('0x26')]===_0x74ae('0x25');var _0x55cf04=_0x404445[_0x74ae('0x27')];var _0x23c746=_0x240038?0x0:_0x497387[_0x74ae('0x24')];var _0x3d234b=_0x240038?_0x404445['count']:_0x497387[_0x74ae('0x24')]+_0x497387[_0x74ae('0x26')];var _0x386a2b;if(_0x3d234b>=_0x55cf04){_0x3d234b=_0x55cf04;_0x386a2b=0xc8;}else{_0x386a2b=0xce;}_0x2a144f[_0x74ae('0x21')](_0x386a2b);return _0x2a144f[_0x74ae('0x28')]('Content-Range',_0x23c746+'-'+_0x3d234b+'/'+_0x55cf04)['json'](_0x404445);}return null;};}function patchUpdates(_0x5008d0){return function(_0x32ea00){try{jsonpatch[_0x74ae('0x29')](_0x32ea00,_0x5008d0,!![]);}catch(_0x5e3ab9){return BPromise[_0x74ae('0x2a')](_0x5e3ab9);}return _0x32ea00[_0x74ae('0x2b')]();};}function saveUpdates(_0x9967f5,_0x582fcc){return function(_0x8c95b5){if(_0x8c95b5){return _0x8c95b5['update'](_0x9967f5)[_0x74ae('0x2c')](function(_0x28950){return _0x28950;});}return null;};}function handleEntityNotFound(_0xe5c88,_0x269c0c){return function(_0x4fc85a){if(!_0x4fc85a){_0xe5c88['sendStatus'](0x194);}return _0x4fc85a;};}function handleError(_0x1d664c,_0x1e57bc){_0x1e57bc=_0x1e57bc||0x1f4;return function(_0x5e5ae1){logger[_0x74ae('0x2d')](_0x5e5ae1[_0x74ae('0x2e')]);if(_0x5e5ae1[_0x74ae('0x2f')]){delete _0x5e5ae1[_0x74ae('0x2f')];}_0x1d664c['status'](_0x1e57bc)['send'](_0x5e5ae1);};}exports[_0x74ae('0x30')]=function(_0x2fa8ce,_0x38a0f8){var _0x5b445e={},_0x209d55={},_0xf34132={'count':0x0,'rows':[]};var _0x724bb3=_[_0x74ae('0x31')](db[_0x74ae('0x32')][_0x74ae('0x33')],function(_0x5e6c7e){return{'name':_0x5e6c7e['fieldName'],'type':_0x5e6c7e[_0x74ae('0x34')][_0x74ae('0x35')]};});_0x209d55[_0x74ae('0x36')]=_[_0x74ae('0x31')](_0x724bb3,_0x74ae('0x2f'));_0x209d55['query']=_[_0x74ae('0x37')](_0x2fa8ce[_0x74ae('0x38')]);_0x209d55['filters']=_[_0x74ae('0x39')](_0x209d55[_0x74ae('0x36')],_0x209d55[_0x74ae('0x38')]);_0x5b445e[_0x74ae('0x3a')]=_['intersection'](_0x209d55['model'],qs[_0x74ae('0x3b')](_0x2fa8ce[_0x74ae('0x38')][_0x74ae('0x3b')]));_0x5b445e['attributes']=_0x5b445e[_0x74ae('0x3a')][_0x74ae('0x3c')]?_0x5b445e[_0x74ae('0x3a')]:_0x209d55[_0x74ae('0x36')];if(!_0x2fa8ce[_0x74ae('0x38')][_0x74ae('0x3d')]('nolimit')){_0x5b445e['limit']=qs[_0x74ae('0x26')](_0x2fa8ce[_0x74ae('0x38')][_0x74ae('0x26')]);_0x5b445e[_0x74ae('0x24')]=qs[_0x74ae('0x24')](_0x2fa8ce[_0x74ae('0x38')]['offset']);}_0x5b445e[_0x74ae('0x3e')]=qs['sort'](_0x2fa8ce[_0x74ae('0x38')][_0x74ae('0x3f')]);_0x5b445e[_0x74ae('0x40')]=qs['filters'](_[_0x74ae('0x41')](_0x2fa8ce['query'],_0x209d55['filters']),_0x724bb3);if(_0x2fa8ce[_0x74ae('0x38')]['filter']){_0x5b445e[_0x74ae('0x40')]=_[_0x74ae('0x42')](_0x5b445e['where'],{'$or':_[_0x74ae('0x31')](_0x724bb3,function(_0x28db87){if(_0x28db87[_0x74ae('0x34')]!=='VIRTUAL'){var _0x2f080e={};_0x2f080e[_0x28db87['name']]={'$like':'%'+_0x2fa8ce[_0x74ae('0x38')]['filter']+'%'};return _0x2f080e;}})});}_0x5b445e=_['merge']({},_0x5b445e,_0x2fa8ce['options']);var _0x400330={'where':_0x5b445e[_0x74ae('0x40')]};return db[_0x74ae('0x32')][_0x74ae('0x27')](_0x400330)['then'](function(_0x256df0){_0xf34132[_0x74ae('0x27')]=_0x256df0;if(_0x2fa8ce[_0x74ae('0x38')]['includeAll']){_0x5b445e['include']=[{'all':!![]}];}return db[_0x74ae('0x32')][_0x74ae('0x43')](_0x5b445e);})['then'](function(_0x3e72a1){_0xf34132['rows']=_0x3e72a1;return _0xf34132;})[_0x74ae('0x2c')](respondWithFilteredResult(_0x38a0f8,_0x5b445e))[_0x74ae('0x44')](handleError(_0x38a0f8,null));};exports[_0x74ae('0x45')]=function(_0x2c21fd,_0x2f57d9){var _0x122662={'raw':![],'where':{'id':_0x2c21fd[_0x74ae('0x46')]['id']}},_0x54695f={};_0x54695f[_0x74ae('0x36')]=_['keys'](db[_0x74ae('0x32')]['rawAttributes']);_0x54695f[_0x74ae('0x38')]=_['keys'](_0x2c21fd[_0x74ae('0x38')]);_0x54695f[_0x74ae('0x47')]=_[_0x74ae('0x39')](_0x54695f[_0x74ae('0x36')],_0x54695f['query']);_0x122662[_0x74ae('0x3a')]=_[_0x74ae('0x39')](_0x54695f[_0x74ae('0x36')],qs[_0x74ae('0x3b')](_0x2c21fd[_0x74ae('0x38')]['fields']));_0x122662[_0x74ae('0x3a')]=_0x122662[_0x74ae('0x3a')]['length']?_0x122662[_0x74ae('0x3a')]:_0x54695f[_0x74ae('0x36')];if(_0x2c21fd['query'][_0x74ae('0x48')]){_0x122662[_0x74ae('0x49')]=[{'all':!![]}];}_0x122662=_[_0x74ae('0x42')]({},_0x122662,_0x2c21fd[_0x74ae('0x4a')]);return db[_0x74ae('0x32')][_0x74ae('0x4b')](_0x122662)[_0x74ae('0x2c')](handleEntityNotFound(_0x2f57d9,null))[_0x74ae('0x2c')](respondWithResult(_0x2f57d9,null))['catch'](handleError(_0x2f57d9,null));};exports[_0x74ae('0x4c')]=function(_0x166c51,_0x252fad){return db[_0x74ae('0x32')][_0x74ae('0x4c')](_0x166c51[_0x74ae('0x4d')],{})[_0x74ae('0x2c')](function(_0x51ee15){var _0x4b237f=_0x166c51[_0x74ae('0x4e')][_0x74ae('0x4f')]({'plain':!![]});if(!_0x4b237f)throw new Error(_0x74ae('0x50'));if(_0x4b237f['role']===_0x74ae('0x4e')){var _0x2a091a=_0x51ee15[_0x74ae('0x4f')]({'plain':!![]});var _0x3d0398=_0x74ae('0x51');return db[_0x74ae('0x52')][_0x74ae('0x4b')]({'where':{'name':_0x3d0398,'userProfileId':_0x4b237f[_0x74ae('0x53')]},'raw':!![]})['then'](function(_0x20fe9e){if(_0x20fe9e&&_0x20fe9e[_0x74ae('0x54')]===0x0){return db[_0x74ae('0x55')][_0x74ae('0x4c')]({'name':_0x2a091a[_0x74ae('0x2f')],'resourceId':_0x2a091a['id'],'type':_0x20fe9e[_0x74ae('0x2f')],'sectionId':_0x20fe9e['id']},{})[_0x74ae('0x2c')](function(){return _0x51ee15;});}else{return _0x51ee15;}})[_0x74ae('0x44')](function(_0x1e2b6b){logger[_0x74ae('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e2b6b);throw _0x1e2b6b;});}return _0x51ee15;})[_0x74ae('0x2c')](respondWithResult(_0x252fad,0xc9))[_0x74ae('0x44')](handleError(_0x252fad,null));};exports[_0x74ae('0x56')]=function(_0x2d8fa1,_0x47ae78){if(_0x2d8fa1[_0x74ae('0x4d')]['id']){delete _0x2d8fa1['body']['id'];}return db[_0x74ae('0x32')][_0x74ae('0x4b')]({'where':{'id':_0x2d8fa1[_0x74ae('0x46')]['id']}})[_0x74ae('0x2c')](handleEntityNotFound(_0x47ae78,null))[_0x74ae('0x2c')](saveUpdates(_0x2d8fa1['body'],null))['then'](respondWithResult(_0x47ae78,null))[_0x74ae('0x44')](handleError(_0x47ae78,null));};exports[_0x74ae('0x57')]=function(_0x29d4f8,_0x46a7c7){var _0xa61f=_0x29d4f8[_0x74ae('0x46')]['id'];var _0x285abe=[];return db[_0x74ae('0x58')][_0x74ae('0x59')](function(_0x862267){var _0x2bfefc=_0x74ae('0x5a')+_0xa61f;return db[_0x74ae('0x58')]['query'](_0x2bfefc,{'type':db[_0x74ae('0x5b')]['QueryTypes'][_0x74ae('0x5c')],'raw':!![],'transaction':_0x862267})[_0x74ae('0x2c')](function(_0x104ae1){_0x285abe=_['map'](_0x104ae1,function(_0x5ca6fe){return Number(_0x5ca6fe['UserId']);});})['then'](function(){var _0x2b1509=_0x74ae('0x5d')+_0xa61f;return db[_0x74ae('0x58')][_0x74ae('0x38')](_0x2b1509,{'type':db[_0x74ae('0x5b')][_0x74ae('0x5e')][_0x74ae('0x5c')],'raw':!![],'transaction':_0x862267});})['then'](function(_0x4c428d){var _0x515949=_['map'](_0x4c428d,function(_0x4d65f3){return Number(_0x4d65f3['VoiceQueueId']);});return db[_0x74ae('0x5f')][_0x74ae('0x57')]({'where':{'UserId':{'$in':_0x285abe},'VoiceQueueId':{'$in':_0x515949}},'transaction':_0x862267});})[_0x74ae('0x2c')](function(){var _0x2fb9ac='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0xa61f;return db['sequelize'][_0x74ae('0x38')](_0x2fb9ac,{'type':db[_0x74ae('0x5b')][_0x74ae('0x5e')][_0x74ae('0x5c')],'raw':!![],'transaction':_0x862267});})[_0x74ae('0x2c')](function(_0x568218){var _0x51bb24=_['map'](_0x568218,function(_0xa87d14){return Number(_0xa87d14[_0x74ae('0x60')]);});return db[_0x74ae('0x61')][_0x74ae('0x57')]({'where':{'UserId':{'$in':_0x285abe},'MailQueueId':{'$in':_0x51bb24}},'transaction':_0x862267});})[_0x74ae('0x2c')](function(){var _0x1eb6c7='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0xa61f;return db[_0x74ae('0x58')]['query'](_0x1eb6c7,{'type':db[_0x74ae('0x5b')][_0x74ae('0x5e')][_0x74ae('0x5c')],'raw':!![],'transaction':_0x862267});})['then'](function(_0x25a8a1){var _0x28b9e7=_[_0x74ae('0x31')](_0x25a8a1,function(_0x3249c7){return Number(_0x3249c7[_0x74ae('0x62')]);});return db[_0x74ae('0x63')][_0x74ae('0x57')]({'where':{'UserId':{'$in':_0x285abe},'SmsQueueId':{'$in':_0x28b9e7}},'transaction':_0x862267});})['then'](function(){var _0x1fdf2d=_0x74ae('0x64')+_0xa61f;return db[_0x74ae('0x58')]['query'](_0x1fdf2d,{'type':db[_0x74ae('0x5b')][_0x74ae('0x5e')][_0x74ae('0x5c')],'raw':!![],'transaction':_0x862267});})[_0x74ae('0x2c')](function(_0x329784){var _0x242eb1=_[_0x74ae('0x31')](_0x329784,function(_0xf0720e){return Number(_0xf0720e[_0x74ae('0x65')]);});return db[_0x74ae('0x66')][_0x74ae('0x57')]({'where':{'UserId':{'$in':_0x285abe},'ChatQueueId':{'$in':_0x242eb1}},'transaction':_0x862267});})[_0x74ae('0x2c')](function(){var _0x37010d=_0x74ae('0x67')+_0xa61f;return db['sequelize'][_0x74ae('0x38')](_0x37010d,{'type':db[_0x74ae('0x5b')][_0x74ae('0x5e')][_0x74ae('0x5c')],'raw':!![],'transaction':_0x862267});})[_0x74ae('0x2c')](function(_0x1cd34){var _0x3f886a=_[_0x74ae('0x31')](_0x1cd34,function(_0x42b365){return Number(_0x42b365[_0x74ae('0x68')]);});return db[_0x74ae('0x69')][_0x74ae('0x57')]({'where':{'UserId':{'$in':_0x285abe},'FaxQueueId':{'$in':_0x3f886a}},'transaction':_0x862267});})['then'](function(){var _0x587fff=_0x74ae('0x6a')+_0xa61f;return db[_0x74ae('0x58')][_0x74ae('0x38')](_0x587fff,{'type':db[_0x74ae('0x5b')][_0x74ae('0x5e')][_0x74ae('0x5c')],'raw':!![],'transaction':_0x862267});})[_0x74ae('0x2c')](function(_0x3cf540){var _0x577134=_[_0x74ae('0x31')](_0x3cf540,function(_0x14f478){return Number(_0x14f478['OpenchannelQueueId']);});return db[_0x74ae('0x6b')][_0x74ae('0x57')]({'where':{'UserId':{'$in':_0x285abe},'OpenchannelQueueId':{'$in':_0x577134}},'transaction':_0x862267});})['then'](function(){var _0x4c27ce=_0x74ae('0x6c')+_0xa61f;return db[_0x74ae('0x58')][_0x74ae('0x38')](_0x4c27ce,{'type':db[_0x74ae('0x5b')][_0x74ae('0x5e')]['SELECT'],'raw':!![],'transaction':_0x862267});})[_0x74ae('0x2c')](function(_0x32cff0){var _0x3261d4=_['map'](_0x32cff0,function(_0x41bfec){return Number(_0x41bfec[_0x74ae('0x6d')]);});return db['UserWhatsappQueue'][_0x74ae('0x57')]({'where':{'UserId':{'$in':_0x285abe},'WhatsappQueueId':{'$in':_0x3261d4}},'transaction':_0x862267});})[_0x74ae('0x2c')](function(){return db['TeamVoicePrefix'][_0x74ae('0x4b')]({'where':{'TeamId':_0xa61f}});})['then'](function(_0xf0d856){if(_0xf0d856===null){return;}return db[_0x74ae('0x6e')][_0x74ae('0x57')]({'where':{'UserId':{'$in':_0x285abe},'VoicePrefixId':_0xf0d856[_0x74ae('0x6f')]},'transaction':_0x862267});})[_0x74ae('0x2c')](function(){return db[_0x74ae('0x32')][_0x74ae('0x57')]({'where':{'id':_0xa61f},'cascade':!![],'transaction':_0x862267});})[_0x74ae('0x2c')](function(_0x59b007){if(_0x59b007===0x0){_0x46a7c7['sendStatus'](0x194);}else{return db[_0x74ae('0x55')][_0x74ae('0x57')]({'where':{'type':_0x74ae('0x51'),'resourceId':_0xa61f},'cascade':!![],'transaction':_0x862267})[_0x74ae('0x2c')](function(){_0x46a7c7[_0x74ae('0x21')](0xcc)['end']();});}})[_0x74ae('0x44')](function(_0x1b6d39){_0x46a7c7[_0x74ae('0x21')](0x1f4)['send'](_0x1b6d39);});});};exports[_0x74ae('0x70')]=function(_0x423660,_0x2324a9,_0x2afdbf){return db['Team'][_0x74ae('0x71')]({'where':{'id':_0x423660[_0x74ae('0x46')]['id']}})['then'](handleEntityNotFound(_0x2324a9,null))[_0x74ae('0x2c')](function(_0xbd686c){if(!_0x423660[_0x74ae('0x38')][_0x74ae('0x72')]||!utils[_0x74ae('0x73')](_0x423660[_0x74ae('0x38')][_0x74ae('0x72')])){throw new db['Sequelize'][(_0x74ae('0x74'))](_0x74ae('0x75'));}var _0x48197e={};var _0x3d492f={};_0x3d492f[_0x74ae('0x36')]=_[_0x74ae('0x37')](db[_[_0x74ae('0x76')](_0x423660[_0x74ae('0x38')][_0x74ae('0x72')][_0x74ae('0x77')]())+_0x74ae('0x78')][_0x74ae('0x33')]);_0x3d492f['query']=_[_0x74ae('0x37')](_0x423660[_0x74ae('0x38')]);_0x3d492f[_0x74ae('0x47')]=_['intersection'](_0x3d492f[_0x74ae('0x36')],_0x3d492f[_0x74ae('0x38')]);_0x48197e[_0x74ae('0x3a')]=_[_0x74ae('0x39')](_0x3d492f[_0x74ae('0x36')],qs[_0x74ae('0x3b')](_0x423660[_0x74ae('0x38')][_0x74ae('0x3b')]));_0x48197e[_0x74ae('0x3a')]=_0x48197e['attributes'][_0x74ae('0x3c')]?_0x48197e['attributes']:_0x3d492f['model'];_0x48197e[_0x74ae('0x26')]=qs['limit'](_0x423660[_0x74ae('0x38')][_0x74ae('0x26')]);_0x48197e[_0x74ae('0x24')]=qs[_0x74ae('0x24')](_0x423660['query'][_0x74ae('0x24')]);_0x48197e[_0x74ae('0x3e')]=qs[_0x74ae('0x3f')](_0x423660[_0x74ae('0x38')][_0x74ae('0x3f')]);_0x48197e[_0x74ae('0x40')]=qs[_0x74ae('0x47')](_['pick'](_0x423660[_0x74ae('0x38')],_0x3d492f[_0x74ae('0x47')]));_0x48197e=_['merge']({},_0x48197e,_0x423660[_0x74ae('0x4a')]);return _0xbd686c[_0x74ae('0x4f')+_[_0x74ae('0x76')](_0x423660['query'][_0x74ae('0x72')]['toLowerCase']())+'Queues'](_0x48197e);})['then'](respondWithResult(_0x2324a9,null))[_0x74ae('0x44')](handleError(_0x2324a9,null));};exports[_0x74ae('0x79')]=function(_0x40a277,_0x454a15,_0x57916d){return db[_0x74ae('0x32')][_0x74ae('0x71')]({'where':{'id':_0x40a277[_0x74ae('0x46')]['id']}})[_0x74ae('0x2c')](function(_0x5d5eea){if(_0x5d5eea){if(!_0x40a277[_0x74ae('0x4d')][_0x74ae('0x72')]||!utils['isValidChannel'](_0x40a277[_0x74ae('0x4d')][_0x74ae('0x72')])){throw new db[(_0x74ae('0x5b'))][(_0x74ae('0x74'))]('Unknown\x20channel');}return _0x5d5eea[_0x74ae('0x7a')+_[_0x74ae('0x76')](_0x40a277['body'][_0x74ae('0x72')][_0x74ae('0x77')]())+'Queues'](_0x40a277[_0x74ae('0x4d')][_0x74ae('0x7b')]);}return null;})[_0x74ae('0x2c')](handleEntityNotFound(_0x454a15,null))[_0x74ae('0x2c')](respondWithStatusCode(_0x454a15,null))[_0x74ae('0x44')](handleError(_0x454a15,null));};exports[_0x74ae('0x7c')]=function(_0x2a8252,_0x59348f,_0x297f09){return db['Team'][_0x74ae('0x71')]({'where':{'id':_0x2a8252[_0x74ae('0x46')]['id']}})[_0x74ae('0x2c')](function(_0x4050c5){if(_0x4050c5){if(!_0x2a8252[_0x74ae('0x38')]['channel']||!utils[_0x74ae('0x73')](_0x2a8252[_0x74ae('0x38')][_0x74ae('0x72')])){throw new db[(_0x74ae('0x5b'))][(_0x74ae('0x74'))]('Unknown\x20channel');}return _0x4050c5[_0x74ae('0x7d')+_['capitalize'](_0x2a8252[_0x74ae('0x38')][_0x74ae('0x72')]['toLowerCase']())+_0x74ae('0x7e')](_0x2a8252[_0x74ae('0x38')][_0x74ae('0x7b')]);}return null;})[_0x74ae('0x2c')](handleEntityNotFound(_0x59348f,null))['then'](respondWithStatusCode(_0x59348f,null))[_0x74ae('0x44')](handleError(_0x59348f,null));};exports[_0x74ae('0x7f')]=function(_0x434618,_0x179f27){var _0x3eb4a0=_['isArray'](_0x434618['body'][_0x74ae('0x7b')])?_0x434618[_0x74ae('0x4d')][_0x74ae('0x7b')]:[_0x434618[_0x74ae('0x4d')][_0x74ae('0x7b')]];var _0x231e4c=_0x434618[_0x74ae('0x46')]['id'];return db[_0x74ae('0x32')]['find']({'where':{'id':_0x231e4c}})[_0x74ae('0x2c')](handleEntityNotFound(_0x179f27,null))[_0x74ae('0x2c')](function(_0x4f88d0){if(_0x4f88d0){var _0x511f99=['Voice',_0x74ae('0x80'),_0x74ae('0x81'),'Sms',_0x74ae('0x82'),_0x74ae('0x83'),'Whatsapp'];return db[_0x74ae('0x58')][_0x74ae('0x59')](function(_0x3256fb){var _0x5e73c8=_[_0x74ae('0x31')](_0x511f99,function(_0x32c23a){var _0x92a988={'attributes':['id',_0x74ae('0x2f')]};if(_0x32c23a===_0x74ae('0x84')){_0x92a988[_0x74ae('0x85')]={'attributes':[_0x74ae('0x86')]};}return _0x4f88d0[_0x74ae('0x4f')+_0x32c23a+_0x74ae('0x7e')](_0x92a988)[_0x74ae('0x2c')](function(_0x5618e8){var _0x5b7d09=_[_0x74ae('0x31')](_0x5618e8,function(_0xa92445){var _0x376834=_['map'](_0x3eb4a0,function(_0x1af993){var _0x21c8c9={'where':{'UserId':_0x1af993,[_0x32c23a+_0x74ae('0x87')]:_0xa92445['id']},'transaction':_0x3256fb};if(_0x32c23a==='Voice'){_0x21c8c9[_0x74ae('0x1a')]={'penalty':_0xa92445[_0x74ae('0x88')]['penalty']};}return db[_0x74ae('0x89')+_0x32c23a+_0x74ae('0x78')][_0x74ae('0x8a')](_0x21c8c9)[_0x74ae('0x2c')](function(){socket['emit'](_0x74ae('0x4e')+_0x32c23a+_0x74ae('0x8b'),{'UserId':_0x1af993,[_0x32c23a+_0x74ae('0x87')]:_0xa92445['id']});if(_0x32c23a!==_0x74ae('0x84')){return;}return db[_0x74ae('0x89')][_0x74ae('0x43')]({'where':{'id':_0x3eb4a0,'online':0x1},'attributes':['id',_0x74ae('0x2f'),_0x74ae('0x8c'),_0x74ae('0x8d'),'interface'],'raw':!![]})['then'](function(_0x1ce92d){var _0x4baf4b=_[_0x74ae('0x31')](_0x1ce92d,function(_0x1fd53c){return db['UserVoiceQueueRt']['upsert']({'membername':_0x1fd53c[_0x74ae('0x2f')],'UserId':_0x1fd53c['id'],'queue_name':_0xa92445[_0x74ae('0x2f')],'VoiceQueueId':_0xa92445['id'],'interface':_[_0x74ae('0x8e')](_0x1fd53c[_0x74ae('0x8f')])?util[_0x74ae('0x90')](_0x74ae('0x91'),_0x1fd53c['name']):_0x1fd53c[_0x74ae('0x8f')],'paused':_0x1fd53c[_0x74ae('0x8d')]||![],'penalty':_0xa92445[_0x74ae('0x88')][_0x74ae('0x86')]},{'transaction':_0x3256fb});});return Promise[_0x74ae('0x92')](_0x4baf4b);});});});return Promise[_0x74ae('0x92')](_0x376834);});return Promise[_0x74ae('0x92')](_0x5b7d09);})['then'](function(){return db[_0x74ae('0x93')][_0x74ae('0x71')]({'where':{'teamId':_0x231e4c}})[_0x74ae('0x2c')](function(_0x47e2da){if(_0x47e2da){var _0x40a5dd=_[_0x74ae('0x31')](_0x3eb4a0,function(_0x4d030e){db[_0x74ae('0x6e')]['upsert']({'UserId':_0x4d030e,'VoicePrefixId':_0x47e2da[_0x74ae('0x6f')]});});return Promise[_0x74ae('0x92')](_0x40a5dd);}});});});return Promise[_0x74ae('0x92')](_0x5e73c8)[_0x74ae('0x2c')](function(){return _0x4f88d0[_0x74ae('0x7f')](_0x3eb4a0,{'transaction':_0x3256fb})[_0x74ae('0x94')](function(_0x4e5693){return _0x4e5693;});});});}})[_0x74ae('0x2c')](respondWithResult(_0x179f27,null))[_0x74ae('0x44')](handleError(_0x179f27,null));};exports[_0x74ae('0x95')]=function(_0x1e420e,_0x3cd22b){var _0x3bdfd5=_[_0x74ae('0x96')](_0x1e420e[_0x74ae('0x38')][_0x74ae('0x7b')])?_0x1e420e[_0x74ae('0x38')][_0x74ae('0x7b')]:[_0x1e420e[_0x74ae('0x38')]['ids']];var _0x1176f0=_0x1e420e[_0x74ae('0x46')]['id'];return db[_0x74ae('0x32')][_0x74ae('0x4b')]({'where':{'id':_0x1176f0}})['then'](handleEntityNotFound(_0x3cd22b,null))[_0x74ae('0x2c')](function(_0x159dfd){if(_0x159dfd){var _0x84dc1e=[_0x74ae('0x84'),_0x74ae('0x80'),_0x74ae('0x81'),_0x74ae('0x97'),_0x74ae('0x82'),_0x74ae('0x83'),_0x74ae('0x98')];return db[_0x74ae('0x58')][_0x74ae('0x59')](function(_0x2e4d95){var _0x13821b=_[_0x74ae('0x31')](_0x84dc1e,function(_0x19d416){var _0x4562c4={'attributes':['id','name']};return _0x159dfd[_0x74ae('0x4f')+_0x19d416+_0x74ae('0x7e')](_0x4562c4)[_0x74ae('0x2c')](function(_0x4eb09e){var _0x12e891=_['map'](_0x4eb09e,function(_0x226a07){return _0x226a07['removeAgents'](_0x3bdfd5,{'transaction':_0x2e4d95})[_0x74ae('0x2c')](function(){var _0x60620f=_['map'](_0x3bdfd5,function(_0x5a5d5a){socket[_0x74ae('0x99')]('user'+_0x19d416+_0x74ae('0x9a'),{'UserId':Number(_0x5a5d5a),[_0x19d416+'QueueId']:_0x226a07['id']});if(_0x19d416!=='Voice'){return;}return db[_0x74ae('0x9b')][_0x74ae('0x57')]({'where':{'VoiceQueueId':_0x226a07['id'],'UserId':_0x5a5d5a},'transaction':_0x2e4d95});});return Promise['all'](_0x60620f);});});return Promise[_0x74ae('0x92')](_0x12e891);});});return Promise[_0x74ae('0x92')](_0x13821b)['then'](function(){return _0x159dfd[_0x74ae('0x95')](_0x3bdfd5,{'transaction':_0x2e4d95});})[_0x74ae('0x2c')](function(){return db[_0x74ae('0x93')][_0x74ae('0x71')]({'where':{'teamId':_0x1176f0}})[_0x74ae('0x2c')](function(_0x52a466){if(_0x52a466){var _0x2ef3d6=_[_0x74ae('0x31')](_0x3bdfd5,function(_0x41eb85){db[_0x74ae('0x6e')]['destroy']({'where':{'UserId':_0x41eb85,'VoicePrefixId':_0x52a466[_0x74ae('0x6f')]}});});return Promise[_0x74ae('0x92')](_0x2ef3d6);}});});});}})[_0x74ae('0x2c')](respondWithStatusCode(_0x3cd22b,null))[_0x74ae('0x44')](handleError(_0x3cd22b,null));};exports['getAgents']=function(_0x34e35d,_0x378ae9,_0x413212){var _0x31609d={};var _0x200a84={};var _0xa4c0ae;var _0x358a8a;return db[_0x74ae('0x32')]['findOne']({'where':{'id':_0x34e35d[_0x74ae('0x46')]['id']}})['then'](handleEntityNotFound(_0x378ae9,null))[_0x74ae('0x2c')](function(_0xd6b7fa){if(_0xd6b7fa){_0xa4c0ae=_0xd6b7fa;_0x200a84[_0x74ae('0x36')]=_[_0x74ae('0x37')](db[_0x74ae('0x89')][_0x74ae('0x33')]);_0x200a84[_0x74ae('0x38')]=_[_0x74ae('0x37')](_0x34e35d[_0x74ae('0x38')]);_0x200a84[_0x74ae('0x47')]=_[_0x74ae('0x39')](_0x200a84[_0x74ae('0x36')],_0x200a84[_0x74ae('0x38')]);_0x31609d[_0x74ae('0x3a')]=_[_0x74ae('0x39')](_0x200a84[_0x74ae('0x36')],qs['fields'](_0x34e35d[_0x74ae('0x38')]['fields']));_0x31609d[_0x74ae('0x3a')]=_0x31609d[_0x74ae('0x3a')][_0x74ae('0x3c')]?_0x31609d['attributes']:_0x200a84[_0x74ae('0x36')];_0x31609d['order']=qs[_0x74ae('0x3f')](_0x34e35d[_0x74ae('0x38')][_0x74ae('0x3f')]);_0x31609d[_0x74ae('0x40')]=qs['filters'](_[_0x74ae('0x41')](_0x34e35d[_0x74ae('0x38')],_0x200a84[_0x74ae('0x47')]));if(_0x34e35d[_0x74ae('0x38')][_0x74ae('0x9c')]){_0x31609d[_0x74ae('0x40')]=_[_0x74ae('0x42')](_0x31609d[_0x74ae('0x40')],{'$or':_[_0x74ae('0x31')](_0x31609d[_0x74ae('0x3a')],function(_0x40730c){var _0x1136d0={};_0x1136d0[_0x40730c]={'$like':'%'+_0x34e35d[_0x74ae('0x38')][_0x74ae('0x9c')]+'%'};return _0x1136d0;})});}_0x31609d=_['merge']({},_0x31609d,_0x34e35d[_0x74ae('0x4a')]);return _0xa4c0ae['getAgents'](_0x31609d);}})[_0x74ae('0x2c')](function(_0x299c37){if(_0x299c37){_0x358a8a=_0x299c37[_0x74ae('0x3c')];if(!_0x34e35d[_0x74ae('0x38')]['hasOwnProperty'](_0x74ae('0x9d'))){_0x31609d['limit']=qs[_0x74ae('0x26')](_0x34e35d['query'][_0x74ae('0x26')]);_0x31609d[_0x74ae('0x24')]=qs[_0x74ae('0x24')](_0x34e35d[_0x74ae('0x38')]['offset']);}return _0xa4c0ae[_0x74ae('0x9e')](_0x31609d);}})[_0x74ae('0x2c')](function(_0x505dda){if(_0x505dda){return _0x505dda?{'count':_0x358a8a,'rows':_0x505dda}:null;}})[_0x74ae('0x2c')](respondWithResult(_0x378ae9,null))[_0x74ae('0x44')](handleError(_0x378ae9,null));}; \ No newline at end of file +var _0x3f23=['emit','getAgents','eml-format','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Team','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','rows','show','params','find','catch','create','body','get','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','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','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','findOne','channel','capitalize','toLowerCase','Queue','rawAttributes','length','pick','Queues','addQueues','isValidChannel','ValidationError','Unknown\x20channel','add','removeQueues','remove','addAgents','isArray','ids','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','findOrCreate','Queue:save','findAll','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','spread','removeAgents'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x3f23,0x13e));var _0x33f2=function(_0x39fdbf,_0x3c7761){_0x39fdbf=_0x39fdbf-0x0;var _0x4a35d8=_0x3f23[_0x39fdbf];return _0x4a35d8;};'use strict';var emlformat=require(_0x33f2('0x0'));var rimraf=require(_0x33f2('0x1'));var zipdir=require(_0x33f2('0x2'));var jsonpatch=require(_0x33f2('0x3'));var rp=require(_0x33f2('0x4'));var moment=require(_0x33f2('0x5'));var BPromise=require(_0x33f2('0x6'));var Mustache=require('mustache');var util=require(_0x33f2('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x33f2('0x8'));var ejs=require(_0x33f2('0x9'));var fs=require('fs');var fs_extra=require(_0x33f2('0xa'));var _=require(_0x33f2('0xb'));var squel=require(_0x33f2('0xc'));var crypto=require(_0x33f2('0xd'));var jsforce=require(_0x33f2('0xe'));var deskjs=require(_0x33f2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x33f2('0x10'));var Papa=require(_0x33f2('0x11'));var Redis=require(_0x33f2('0x12'));var authService=require(_0x33f2('0x13'));var qs=require(_0x33f2('0x14'));var as=require(_0x33f2('0x15'));var hardwareService=require(_0x33f2('0x16'));var logger=require(_0x33f2('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x33f2('0x18'));var licenseUtil=require(_0x33f2('0x19'));var db=require(_0x33f2('0x1a'))['db'];config['redis']=_[_0x33f2('0x1b')](config[_0x33f2('0x1c')],{'host':_0x33f2('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33f2('0x1c')]));require('./team.socket')[_0x33f2('0x1e')](socket);function respondWithStatusCode(_0x1a789a,_0x1e120b){_0x1e120b=_0x1e120b||0xcc;return function(_0x483ce0){if(_0x483ce0){return _0x1a789a[_0x33f2('0x1f')](_0x1e120b);}return _0x1a789a[_0x33f2('0x20')](_0x1e120b)[_0x33f2('0x21')]();};}function respondWithResult(_0x1289e4,_0x473daf){_0x473daf=_0x473daf||0xc8;return function(_0xcd5c78){if(_0xcd5c78){return _0x1289e4['status'](_0x473daf)[_0x33f2('0x22')](_0xcd5c78);}};}function respondWithFilteredResult(_0x21a3b1,_0xd685e3){return function(_0x87ae02){if(_0x87ae02){var _0x40dcee=typeof _0xd685e3['offset']===_0x33f2('0x23')&&typeof _0xd685e3[_0x33f2('0x24')]===_0x33f2('0x23');var _0x494e52=_0x87ae02[_0x33f2('0x25')];var _0x17b91d=_0x40dcee?0x0:_0xd685e3[_0x33f2('0x26')];var _0x11ebc8=_0x40dcee?_0x87ae02['count']:_0xd685e3[_0x33f2('0x26')]+_0xd685e3['limit'];var _0x381daa;if(_0x11ebc8>=_0x494e52){_0x11ebc8=_0x494e52;_0x381daa=0xc8;}else{_0x381daa=0xce;}_0x21a3b1['status'](_0x381daa);return _0x21a3b1['set'](_0x33f2('0x27'),_0x17b91d+'-'+_0x11ebc8+'/'+_0x494e52)['json'](_0x87ae02);}return null;};}function patchUpdates(_0x4d2e90){return function(_0x5e0962){try{jsonpatch['apply'](_0x5e0962,_0x4d2e90,!![]);}catch(_0x2e4bdf){return BPromise[_0x33f2('0x28')](_0x2e4bdf);}return _0x5e0962[_0x33f2('0x29')]();};}function saveUpdates(_0x84ca5e,_0x3fa75a){return function(_0x56a0cd){if(_0x56a0cd){return _0x56a0cd[_0x33f2('0x2a')](_0x84ca5e)[_0x33f2('0x2b')](function(_0x36bfc6){return _0x36bfc6;});}return null;};}function handleEntityNotFound(_0x444ec5,_0x20cc0a){return function(_0x541b2e){if(!_0x541b2e){_0x444ec5['sendStatus'](0x194);}return _0x541b2e;};}function handleError(_0x57f0cf,_0x23934){_0x23934=_0x23934||0x1f4;return function(_0x2906ba){logger[_0x33f2('0x2c')](_0x2906ba[_0x33f2('0x2d')]);if(_0x2906ba['name']){delete _0x2906ba[_0x33f2('0x2e')];}_0x57f0cf[_0x33f2('0x20')](_0x23934)[_0x33f2('0x2f')](_0x2906ba);};}exports[_0x33f2('0x30')]=function(_0x3c92ea,_0x1c194a){var _0x43ffbd={},_0x59f98b={},_0x2f2ba9={'count':0x0,'rows':[]};var _0x3e417f=_[_0x33f2('0x31')](db[_0x33f2('0x32')]['rawAttributes'],function(_0x14c9eb){return{'name':_0x14c9eb[_0x33f2('0x33')],'type':_0x14c9eb[_0x33f2('0x34')]['key']};});_0x59f98b[_0x33f2('0x35')]=_['map'](_0x3e417f,_0x33f2('0x2e'));_0x59f98b[_0x33f2('0x36')]=_[_0x33f2('0x37')](_0x3c92ea[_0x33f2('0x36')]);_0x59f98b['filters']=_[_0x33f2('0x38')](_0x59f98b[_0x33f2('0x35')],_0x59f98b['query']);_0x43ffbd['attributes']=_['intersection'](_0x59f98b['model'],qs[_0x33f2('0x39')](_0x3c92ea[_0x33f2('0x36')][_0x33f2('0x39')]));_0x43ffbd[_0x33f2('0x3a')]=_0x43ffbd['attributes']['length']?_0x43ffbd[_0x33f2('0x3a')]:_0x59f98b[_0x33f2('0x35')];if(!_0x3c92ea[_0x33f2('0x36')][_0x33f2('0x3b')](_0x33f2('0x3c'))){_0x43ffbd[_0x33f2('0x24')]=qs[_0x33f2('0x24')](_0x3c92ea[_0x33f2('0x36')][_0x33f2('0x24')]);_0x43ffbd['offset']=qs['offset'](_0x3c92ea[_0x33f2('0x36')][_0x33f2('0x26')]);}_0x43ffbd[_0x33f2('0x3d')]=qs[_0x33f2('0x3e')](_0x3c92ea['query']['sort']);_0x43ffbd[_0x33f2('0x3f')]=qs[_0x33f2('0x40')](_['pick'](_0x3c92ea['query'],_0x59f98b[_0x33f2('0x40')]),_0x3e417f);if(_0x3c92ea[_0x33f2('0x36')]['filter']){_0x43ffbd[_0x33f2('0x3f')]=_[_0x33f2('0x41')](_0x43ffbd['where'],{'$or':_[_0x33f2('0x31')](_0x3e417f,function(_0x11649a){if(_0x11649a[_0x33f2('0x34')]!=='VIRTUAL'){var _0x1607f3={};_0x1607f3[_0x11649a[_0x33f2('0x2e')]]={'$like':'%'+_0x3c92ea['query'][_0x33f2('0x42')]+'%'};return _0x1607f3;}})});}_0x43ffbd=_[_0x33f2('0x41')]({},_0x43ffbd,_0x3c92ea[_0x33f2('0x43')]);var _0x55b267={'where':_0x43ffbd['where']};return db[_0x33f2('0x32')][_0x33f2('0x25')](_0x55b267)[_0x33f2('0x2b')](function(_0x13ae4b){_0x2f2ba9[_0x33f2('0x25')]=_0x13ae4b;if(_0x3c92ea['query'][_0x33f2('0x44')]){_0x43ffbd[_0x33f2('0x45')]=[{'all':!![]}];}return db[_0x33f2('0x32')]['findAll'](_0x43ffbd);})[_0x33f2('0x2b')](function(_0x4d7a1e){_0x2f2ba9[_0x33f2('0x46')]=_0x4d7a1e;return _0x2f2ba9;})[_0x33f2('0x2b')](respondWithFilteredResult(_0x1c194a,_0x43ffbd))['catch'](handleError(_0x1c194a,null));};exports[_0x33f2('0x47')]=function(_0x218177,_0x11da20){var _0x76c3e4={'raw':![],'where':{'id':_0x218177[_0x33f2('0x48')]['id']}},_0x4313e9={};_0x4313e9[_0x33f2('0x35')]=_[_0x33f2('0x37')](db['Team']['rawAttributes']);_0x4313e9[_0x33f2('0x36')]=_[_0x33f2('0x37')](_0x218177[_0x33f2('0x36')]);_0x4313e9[_0x33f2('0x40')]=_[_0x33f2('0x38')](_0x4313e9[_0x33f2('0x35')],_0x4313e9[_0x33f2('0x36')]);_0x76c3e4[_0x33f2('0x3a')]=_[_0x33f2('0x38')](_0x4313e9[_0x33f2('0x35')],qs['fields'](_0x218177[_0x33f2('0x36')]['fields']));_0x76c3e4[_0x33f2('0x3a')]=_0x76c3e4[_0x33f2('0x3a')]['length']?_0x76c3e4[_0x33f2('0x3a')]:_0x4313e9[_0x33f2('0x35')];if(_0x218177['query'][_0x33f2('0x44')]){_0x76c3e4[_0x33f2('0x45')]=[{'all':!![]}];}_0x76c3e4=_[_0x33f2('0x41')]({},_0x76c3e4,_0x218177['options']);return db[_0x33f2('0x32')][_0x33f2('0x49')](_0x76c3e4)[_0x33f2('0x2b')](handleEntityNotFound(_0x11da20,null))['then'](respondWithResult(_0x11da20,null))[_0x33f2('0x4a')](handleError(_0x11da20,null));};exports[_0x33f2('0x4b')]=function(_0xfbca4c,_0x1951f3){return db[_0x33f2('0x32')][_0x33f2('0x4b')](_0xfbca4c[_0x33f2('0x4c')],{})[_0x33f2('0x2b')](function(_0xba19e5){var _0x1ca566=_0xfbca4c['user'][_0x33f2('0x4d')]({'plain':!![]});if(!_0x1ca566)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ca566[_0x33f2('0x4e')]===_0x33f2('0x4f')){var _0x27cc8d=_0xba19e5[_0x33f2('0x4d')]({'plain':!![]});var _0x487060='Teams';return db[_0x33f2('0x50')][_0x33f2('0x49')]({'where':{'name':_0x487060,'userProfileId':_0x1ca566[_0x33f2('0x51')]},'raw':!![]})[_0x33f2('0x2b')](function(_0x2742a5){if(_0x2742a5&&_0x2742a5['autoAssociation']===0x0){return db[_0x33f2('0x52')][_0x33f2('0x4b')]({'name':_0x27cc8d[_0x33f2('0x2e')],'resourceId':_0x27cc8d['id'],'type':_0x2742a5[_0x33f2('0x2e')],'sectionId':_0x2742a5['id']},{})['then'](function(){return _0xba19e5;});}else{return _0xba19e5;}})[_0x33f2('0x4a')](function(_0x346931){logger['error'](_0x33f2('0x53'),_0x346931);throw _0x346931;});}return _0xba19e5;})['then'](respondWithResult(_0x1951f3,0xc9))[_0x33f2('0x4a')](handleError(_0x1951f3,null));};exports[_0x33f2('0x2a')]=function(_0xcf549d,_0x1c9cab){if(_0xcf549d[_0x33f2('0x4c')]['id']){delete _0xcf549d[_0x33f2('0x4c')]['id'];}return db['Team'][_0x33f2('0x49')]({'where':{'id':_0xcf549d[_0x33f2('0x48')]['id']}})[_0x33f2('0x2b')](handleEntityNotFound(_0x1c9cab,null))[_0x33f2('0x2b')](saveUpdates(_0xcf549d[_0x33f2('0x4c')],null))['then'](respondWithResult(_0x1c9cab,null))[_0x33f2('0x4a')](handleError(_0x1c9cab,null));};exports[_0x33f2('0x54')]=function(_0x3a1559,_0x2ccaf4){var _0x52c500=_0x3a1559[_0x33f2('0x48')]['id'];var _0x3e0a60=[];return db[_0x33f2('0x55')][_0x33f2('0x56')](function(_0x5a0234){var _0xf4803c=_0x33f2('0x57')+_0x52c500;return db[_0x33f2('0x55')]['query'](_0xf4803c,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234})[_0x33f2('0x2b')](function(_0x21fa3c){_0x3e0a60=_[_0x33f2('0x31')](_0x21fa3c,function(_0x11032c){return Number(_0x11032c[_0x33f2('0x5b')]);});})[_0x33f2('0x2b')](function(){var _0x3e6280='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x52c500;return db['sequelize'][_0x33f2('0x36')](_0x3e6280,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')]['SELECT'],'raw':!![],'transaction':_0x5a0234});})['then'](function(_0x19e074){var _0x52e288=_['map'](_0x19e074,function(_0x29ec3c){return Number(_0x29ec3c[_0x33f2('0x5c')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0x3e0a60},'VoiceQueueId':{'$in':_0x52e288}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){var _0x1f1417=_0x33f2('0x5d')+_0x52c500;return db[_0x33f2('0x55')][_0x33f2('0x36')](_0x1f1417,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0x194624){var _0x222f11=_[_0x33f2('0x31')](_0x194624,function(_0x51f2ff){return Number(_0x51f2ff[_0x33f2('0x5e')]);});return db[_0x33f2('0x5f')][_0x33f2('0x54')]({'where':{'UserId':{'$in':_0x3e0a60},'MailQueueId':{'$in':_0x222f11}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){var _0x5a4ce4=_0x33f2('0x60')+_0x52c500;return db['sequelize'][_0x33f2('0x36')](_0x5a4ce4,{'type':db[_0x33f2('0x58')]['QueryTypes'][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0x3b966d){var _0x325cb1=_[_0x33f2('0x31')](_0x3b966d,function(_0x5f0785){return Number(_0x5f0785[_0x33f2('0x61')]);});return db[_0x33f2('0x62')][_0x33f2('0x54')]({'where':{'UserId':{'$in':_0x3e0a60},'SmsQueueId':{'$in':_0x325cb1}},'transaction':_0x5a0234});})['then'](function(){var _0xd0cf5f=_0x33f2('0x63')+_0x52c500;return db[_0x33f2('0x55')]['query'](_0xd0cf5f,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})['then'](function(_0x124674){var _0x339590=_['map'](_0x124674,function(_0x469e27){return Number(_0x469e27['ChatQueueId']);});return db[_0x33f2('0x64')]['destroy']({'where':{'UserId':{'$in':_0x3e0a60},'ChatQueueId':{'$in':_0x339590}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){var _0x26a877=_0x33f2('0x65')+_0x52c500;return db['sequelize'][_0x33f2('0x36')](_0x26a877,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0x3d86c5){var _0x26d814=_[_0x33f2('0x31')](_0x3d86c5,function(_0x4bb0bb){return Number(_0x4bb0bb[_0x33f2('0x66')]);});return db[_0x33f2('0x67')][_0x33f2('0x54')]({'where':{'UserId':{'$in':_0x3e0a60},'FaxQueueId':{'$in':_0x26d814}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){var _0x3ab565=_0x33f2('0x68')+_0x52c500;return db[_0x33f2('0x55')][_0x33f2('0x36')](_0x3ab565,{'type':db[_0x33f2('0x58')][_0x33f2('0x59')][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0x2374e5){var _0x573d80=_[_0x33f2('0x31')](_0x2374e5,function(_0x2e0172){return Number(_0x2e0172[_0x33f2('0x69')]);});return db['UserOpenchannelQueue']['destroy']({'where':{'UserId':{'$in':_0x3e0a60},'OpenchannelQueueId':{'$in':_0x573d80}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){var _0x5c79ce=_0x33f2('0x6a')+_0x52c500;return db[_0x33f2('0x55')][_0x33f2('0x36')](_0x5c79ce,{'type':db['Sequelize']['QueryTypes'][_0x33f2('0x5a')],'raw':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0x1f7ad0){var _0x5052d9=_[_0x33f2('0x31')](_0x1f7ad0,function(_0x4c2ae5){return Number(_0x4c2ae5[_0x33f2('0x6b')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x3e0a60},'WhatsappQueueId':{'$in':_0x5052d9}},'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(){return db[_0x33f2('0x6c')]['find']({'where':{'TeamId':_0x52c500}});})[_0x33f2('0x2b')](function(_0x1f79f8){if(_0x1f79f8===null){return;}return db[_0x33f2('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x3e0a60},'VoicePrefixId':_0x1f79f8[_0x33f2('0x6e')]},'transaction':_0x5a0234});})['then'](function(){return db[_0x33f2('0x32')]['destroy']({'where':{'id':_0x52c500},'cascade':!![],'transaction':_0x5a0234});})[_0x33f2('0x2b')](function(_0xe69258){if(_0xe69258===0x0){_0x2ccaf4[_0x33f2('0x1f')](0x194);}else{return db['UserProfileResource'][_0x33f2('0x54')]({'where':{'type':_0x33f2('0x6f'),'resourceId':_0x52c500},'cascade':!![],'transaction':_0x5a0234})[_0x33f2('0x2b')](function(){_0x2ccaf4[_0x33f2('0x20')](0xcc)[_0x33f2('0x21')]();});}})[_0x33f2('0x4a')](function(_0x109ca6){_0x2ccaf4[_0x33f2('0x20')](0x1f4)[_0x33f2('0x2f')](_0x109ca6);});});};exports['getQueues']=function(_0x2af2c7,_0x55f3b6,_0x4b615b){return db[_0x33f2('0x32')][_0x33f2('0x70')]({'where':{'id':_0x2af2c7[_0x33f2('0x48')]['id']}})[_0x33f2('0x2b')](handleEntityNotFound(_0x55f3b6,null))[_0x33f2('0x2b')](function(_0x26a2ec){if(!_0x2af2c7[_0x33f2('0x36')]['channel']||!utils['isValidChannel'](_0x2af2c7[_0x33f2('0x36')][_0x33f2('0x71')])){throw new db[(_0x33f2('0x58'))]['ValidationError']('Unknown\x20channel');}var _0x50eba9={};var _0x1d0e84={};_0x1d0e84[_0x33f2('0x35')]=_['keys'](db[_[_0x33f2('0x72')](_0x2af2c7[_0x33f2('0x36')]['channel'][_0x33f2('0x73')]())+_0x33f2('0x74')][_0x33f2('0x75')]);_0x1d0e84[_0x33f2('0x36')]=_[_0x33f2('0x37')](_0x2af2c7['query']);_0x1d0e84[_0x33f2('0x40')]=_['intersection'](_0x1d0e84[_0x33f2('0x35')],_0x1d0e84[_0x33f2('0x36')]);_0x50eba9[_0x33f2('0x3a')]=_['intersection'](_0x1d0e84['model'],qs['fields'](_0x2af2c7[_0x33f2('0x36')][_0x33f2('0x39')]));_0x50eba9[_0x33f2('0x3a')]=_0x50eba9[_0x33f2('0x3a')][_0x33f2('0x76')]?_0x50eba9[_0x33f2('0x3a')]:_0x1d0e84[_0x33f2('0x35')];_0x50eba9[_0x33f2('0x24')]=qs[_0x33f2('0x24')](_0x2af2c7['query'][_0x33f2('0x24')]);_0x50eba9[_0x33f2('0x26')]=qs['offset'](_0x2af2c7[_0x33f2('0x36')][_0x33f2('0x26')]);_0x50eba9[_0x33f2('0x3d')]=qs['sort'](_0x2af2c7['query'][_0x33f2('0x3e')]);_0x50eba9[_0x33f2('0x3f')]=qs['filters'](_[_0x33f2('0x77')](_0x2af2c7[_0x33f2('0x36')],_0x1d0e84[_0x33f2('0x40')]));_0x50eba9=_['merge']({},_0x50eba9,_0x2af2c7[_0x33f2('0x43')]);return _0x26a2ec[_0x33f2('0x4d')+_[_0x33f2('0x72')](_0x2af2c7[_0x33f2('0x36')]['channel'][_0x33f2('0x73')]())+_0x33f2('0x78')](_0x50eba9);})[_0x33f2('0x2b')](respondWithResult(_0x55f3b6,null))[_0x33f2('0x4a')](handleError(_0x55f3b6,null));};exports[_0x33f2('0x79')]=function(_0xe6b23e,_0x2d793a,_0x5845c8){return db[_0x33f2('0x32')][_0x33f2('0x70')]({'where':{'id':_0xe6b23e[_0x33f2('0x48')]['id']}})[_0x33f2('0x2b')](function(_0x3eb292){if(_0x3eb292){if(!_0xe6b23e[_0x33f2('0x4c')][_0x33f2('0x71')]||!utils[_0x33f2('0x7a')](_0xe6b23e['body'][_0x33f2('0x71')])){throw new db[(_0x33f2('0x58'))][(_0x33f2('0x7b'))](_0x33f2('0x7c'));}return _0x3eb292[_0x33f2('0x7d')+_[_0x33f2('0x72')](_0xe6b23e['body'][_0x33f2('0x71')][_0x33f2('0x73')]())+'Queues'](_0xe6b23e['body']['ids']);}return null;})[_0x33f2('0x2b')](handleEntityNotFound(_0x2d793a,null))[_0x33f2('0x2b')](respondWithStatusCode(_0x2d793a,null))[_0x33f2('0x4a')](handleError(_0x2d793a,null));};exports[_0x33f2('0x7e')]=function(_0x4f9cf9,_0x350473,_0x17f550){return db[_0x33f2('0x32')][_0x33f2('0x70')]({'where':{'id':_0x4f9cf9[_0x33f2('0x48')]['id']}})['then'](function(_0x2caed1){if(_0x2caed1){if(!_0x4f9cf9[_0x33f2('0x36')][_0x33f2('0x71')]||!utils['isValidChannel'](_0x4f9cf9['query'][_0x33f2('0x71')])){throw new db[(_0x33f2('0x58'))][(_0x33f2('0x7b'))]('Unknown\x20channel');}return _0x2caed1[_0x33f2('0x7f')+_[_0x33f2('0x72')](_0x4f9cf9['query']['channel']['toLowerCase']())+_0x33f2('0x78')](_0x4f9cf9['query']['ids']);}return null;})[_0x33f2('0x2b')](handleEntityNotFound(_0x350473,null))[_0x33f2('0x2b')](respondWithStatusCode(_0x350473,null))[_0x33f2('0x4a')](handleError(_0x350473,null));};exports[_0x33f2('0x80')]=function(_0x3b18ea,_0x26d54e){var _0x2ddfe5=_[_0x33f2('0x81')](_0x3b18ea[_0x33f2('0x4c')]['ids'])?_0x3b18ea['body'][_0x33f2('0x82')]:[_0x3b18ea[_0x33f2('0x4c')][_0x33f2('0x82')]];var _0xef6fa2=_0x3b18ea[_0x33f2('0x48')]['id'];return db[_0x33f2('0x32')][_0x33f2('0x49')]({'where':{'id':_0xef6fa2}})[_0x33f2('0x2b')](handleEntityNotFound(_0x26d54e,null))[_0x33f2('0x2b')](function(_0x40d44f){if(_0x40d44f){var _0xd2ea5f=[_0x33f2('0x83'),_0x33f2('0x84'),_0x33f2('0x85'),_0x33f2('0x86'),_0x33f2('0x87'),_0x33f2('0x88'),_0x33f2('0x89')];return db['sequelize']['transaction'](function(_0x6abb43){var _0x1da43c=_[_0x33f2('0x31')](_0xd2ea5f,function(_0x4c7c05){var _0x285eea={'attributes':['id',_0x33f2('0x2e')]};if(_0x4c7c05===_0x33f2('0x83')){_0x285eea[_0x33f2('0x8a')]={'attributes':['penalty']};}return _0x40d44f[_0x33f2('0x4d')+_0x4c7c05+_0x33f2('0x78')](_0x285eea)[_0x33f2('0x2b')](function(_0x219261){var _0x5f36c6=_[_0x33f2('0x31')](_0x219261,function(_0x3e0975){var _0x286c8f=_['map'](_0x2ddfe5,function(_0x4a0f8b){var _0x362e0c={'where':{'UserId':_0x4a0f8b,[_0x4c7c05+_0x33f2('0x8b')]:_0x3e0975['id']},'transaction':_0x6abb43};if(_0x4c7c05==='Voice'){_0x362e0c[_0x33f2('0x1b')]={'penalty':_0x3e0975[_0x33f2('0x8c')][_0x33f2('0x8d')]};}return db[_0x33f2('0x8e')+_0x4c7c05+_0x33f2('0x74')][_0x33f2('0x8f')](_0x362e0c)[_0x33f2('0x2b')](function(){socket['emit'](_0x33f2('0x4f')+_0x4c7c05+_0x33f2('0x90'),{'UserId':_0x4a0f8b,[_0x4c7c05+_0x33f2('0x8b')]:_0x3e0975['id']});if(_0x4c7c05!=='Voice'){return;}return db[_0x33f2('0x8e')][_0x33f2('0x91')]({'where':{'id':_0x2ddfe5,'online':0x1},'attributes':['id',_0x33f2('0x2e'),_0x33f2('0x92'),_0x33f2('0x93'),_0x33f2('0x94')],'raw':!![]})[_0x33f2('0x2b')](function(_0x101a75){var _0xdc0b74=_[_0x33f2('0x31')](_0x101a75,function(_0x349253){return db[_0x33f2('0x95')]['upsert']({'membername':_0x349253[_0x33f2('0x2e')],'UserId':_0x349253['id'],'queue_name':_0x3e0975[_0x33f2('0x2e')],'VoiceQueueId':_0x3e0975['id'],'interface':_[_0x33f2('0x96')](_0x349253[_0x33f2('0x94')])?util[_0x33f2('0x97')](_0x33f2('0x98'),_0x349253[_0x33f2('0x2e')]):_0x349253[_0x33f2('0x94')],'paused':_0x349253[_0x33f2('0x93')]||![],'penalty':_0x3e0975[_0x33f2('0x8c')][_0x33f2('0x8d')]},{'transaction':_0x6abb43});});return Promise[_0x33f2('0x99')](_0xdc0b74);});});});return Promise[_0x33f2('0x99')](_0x286c8f);});return Promise['all'](_0x5f36c6);})[_0x33f2('0x2b')](function(){return db[_0x33f2('0x6c')][_0x33f2('0x70')]({'where':{'teamId':_0xef6fa2}})['then'](function(_0x53381a){if(_0x53381a){var _0xd6fbe0=_[_0x33f2('0x31')](_0x2ddfe5,function(_0x10f8dc){db[_0x33f2('0x6d')]['upsert']({'UserId':_0x10f8dc,'VoicePrefixId':_0x53381a[_0x33f2('0x6e')]});});return Promise[_0x33f2('0x99')](_0xd6fbe0);}});});});return Promise[_0x33f2('0x99')](_0x1da43c)[_0x33f2('0x2b')](function(){return _0x40d44f[_0x33f2('0x80')](_0x2ddfe5,{'transaction':_0x6abb43})[_0x33f2('0x9a')](function(_0x35ab17){return _0x35ab17;});});});}})['then'](respondWithResult(_0x26d54e,null))[_0x33f2('0x4a')](handleError(_0x26d54e,null));};exports[_0x33f2('0x9b')]=function(_0x495006,_0x20d478){var _0x2f8cf0=_[_0x33f2('0x81')](_0x495006[_0x33f2('0x36')]['ids'])?_0x495006[_0x33f2('0x36')][_0x33f2('0x82')]:[_0x495006[_0x33f2('0x36')][_0x33f2('0x82')]];var _0x96f045=_0x495006[_0x33f2('0x48')]['id'];return db[_0x33f2('0x32')][_0x33f2('0x49')]({'where':{'id':_0x96f045}})[_0x33f2('0x2b')](handleEntityNotFound(_0x20d478,null))[_0x33f2('0x2b')](function(_0x5a4bbc){if(_0x5a4bbc){var _0x280199=[_0x33f2('0x83'),_0x33f2('0x84'),'Mail','Sms',_0x33f2('0x87'),_0x33f2('0x88'),_0x33f2('0x89')];return db[_0x33f2('0x55')][_0x33f2('0x56')](function(_0x398505){var _0xc59e1f=_[_0x33f2('0x31')](_0x280199,function(_0x5a3159){var _0xf14e9b={'attributes':['id','name']};return _0x5a4bbc[_0x33f2('0x4d')+_0x5a3159+_0x33f2('0x78')](_0xf14e9b)[_0x33f2('0x2b')](function(_0x13e8da){var _0x5e1167=_[_0x33f2('0x31')](_0x13e8da,function(_0x3cb0c0){return _0x3cb0c0[_0x33f2('0x9b')](_0x2f8cf0,{'transaction':_0x398505})['then'](function(){var _0x430370=_[_0x33f2('0x31')](_0x2f8cf0,function(_0x594361){socket[_0x33f2('0x9c')](_0x33f2('0x4f')+_0x5a3159+'Queue:remove',{'UserId':Number(_0x594361),[_0x5a3159+'QueueId']:_0x3cb0c0['id']});if(_0x5a3159!=='Voice'){return;}return db[_0x33f2('0x95')][_0x33f2('0x54')]({'where':{'VoiceQueueId':_0x3cb0c0['id'],'UserId':_0x594361},'transaction':_0x398505});});return Promise['all'](_0x430370);});});return Promise[_0x33f2('0x99')](_0x5e1167);});});return Promise[_0x33f2('0x99')](_0xc59e1f)[_0x33f2('0x2b')](function(){return _0x5a4bbc['removeAgents'](_0x2f8cf0,{'transaction':_0x398505});})[_0x33f2('0x2b')](function(){return db[_0x33f2('0x6c')]['findOne']({'where':{'teamId':_0x96f045}})[_0x33f2('0x2b')](function(_0xf27fae){if(_0xf27fae){var _0x23443e=_['map'](_0x2f8cf0,function(_0x38f896){db[_0x33f2('0x6d')]['destroy']({'where':{'UserId':_0x38f896,'VoicePrefixId':_0xf27fae[_0x33f2('0x6e')]}});});return Promise['all'](_0x23443e);}});});});}})[_0x33f2('0x2b')](respondWithStatusCode(_0x20d478,null))['catch'](handleError(_0x20d478,null));};exports[_0x33f2('0x9d')]=function(_0x52b55f,_0x412847,_0x6fd78f){var _0x117f49={};var _0x595e82={};var _0x22890a;var _0x5623af;return db[_0x33f2('0x32')][_0x33f2('0x70')]({'where':{'id':_0x52b55f['params']['id']}})[_0x33f2('0x2b')](handleEntityNotFound(_0x412847,null))['then'](function(_0x31e0c9){if(_0x31e0c9){_0x22890a=_0x31e0c9;_0x595e82[_0x33f2('0x35')]=_[_0x33f2('0x37')](db[_0x33f2('0x8e')][_0x33f2('0x75')]);_0x595e82['query']=_['keys'](_0x52b55f[_0x33f2('0x36')]);_0x595e82[_0x33f2('0x40')]=_[_0x33f2('0x38')](_0x595e82[_0x33f2('0x35')],_0x595e82[_0x33f2('0x36')]);_0x117f49['attributes']=_[_0x33f2('0x38')](_0x595e82[_0x33f2('0x35')],qs[_0x33f2('0x39')](_0x52b55f[_0x33f2('0x36')][_0x33f2('0x39')]));_0x117f49[_0x33f2('0x3a')]=_0x117f49[_0x33f2('0x3a')]['length']?_0x117f49[_0x33f2('0x3a')]:_0x595e82['model'];_0x117f49[_0x33f2('0x3d')]=qs[_0x33f2('0x3e')](_0x52b55f['query']['sort']);_0x117f49['where']=qs['filters'](_[_0x33f2('0x77')](_0x52b55f[_0x33f2('0x36')],_0x595e82[_0x33f2('0x40')]));if(_0x52b55f[_0x33f2('0x36')][_0x33f2('0x42')]){_0x117f49[_0x33f2('0x3f')]=_[_0x33f2('0x41')](_0x117f49[_0x33f2('0x3f')],{'$or':_[_0x33f2('0x31')](_0x117f49['attributes'],function(_0x4bcf6a){var _0x331308={};_0x331308[_0x4bcf6a]={'$like':'%'+_0x52b55f[_0x33f2('0x36')][_0x33f2('0x42')]+'%'};return _0x331308;})});}_0x117f49=_[_0x33f2('0x41')]({},_0x117f49,_0x52b55f[_0x33f2('0x43')]);return _0x22890a['getAgents'](_0x117f49);}})[_0x33f2('0x2b')](function(_0x49f087){if(_0x49f087){_0x5623af=_0x49f087[_0x33f2('0x76')];if(!_0x52b55f[_0x33f2('0x36')][_0x33f2('0x3b')](_0x33f2('0x3c'))){_0x117f49[_0x33f2('0x24')]=qs[_0x33f2('0x24')](_0x52b55f['query']['limit']);_0x117f49[_0x33f2('0x26')]=qs[_0x33f2('0x26')](_0x52b55f['query'][_0x33f2('0x26')]);}return _0x22890a[_0x33f2('0x9d')](_0x117f49);}})[_0x33f2('0x2b')](function(_0x11aa33){if(_0x11aa33){return _0x11aa33?{'count':_0x5623af,'rows':_0x11aa33}:null;}})['then'](respondWithResult(_0x412847,null))['catch'](handleError(_0x412847,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7c4de30..6f20771 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 _0x9bf5=['../../mysqldb','Team','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0x9bf5,0x81));var _0x59bf=function(_0x48f51d,_0x17a6c1){_0x48f51d=_0x48f51d-0x0;var _0x1ab641=_0x9bf5[_0x48f51d];return _0x1ab641;};'use strict';var EventEmitter=require(_0x59bf('0x0'));var Team=require(_0x59bf('0x1'))['db'][_0x59bf('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x59bf('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x59bf('0x4'),'afterDestroy':_0x59bf('0x5')};function emitEvent(_0x4e7091){return function(_0x5ecab5,_0x2587c3,_0x15bea9){TeamEvents[_0x59bf('0x6')](_0x4e7091+':'+_0x5ecab5['id'],_0x5ecab5);TeamEvents['emit'](_0x4e7091,_0x5ecab5);_0x15bea9(null);};}for(var e in events){if(events[_0x59bf('0x7')](e)){var event=events[e];Team[_0x59bf('0x8')](e,emitEvent(event));}}module[_0x59bf('0x9')]=TeamEvents; \ No newline at end of file +var _0x9c77=['Team','setMaxListeners','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x1f4559,_0xac6e5){var _0x212d70=function(_0x2016c7){while(--_0x2016c7){_0x1f4559['push'](_0x1f4559['shift']());}};_0x212d70(++_0xac6e5);}(_0x9c77,0x9e));var _0x79c7=function(_0x5a934b,_0x43ad62){_0x5a934b=_0x5a934b-0x0;var _0x2f5087=_0x9c77[_0x5a934b];return _0x2f5087;};'use strict';var EventEmitter=require(_0x79c7('0x0'));var Team=require(_0x79c7('0x1'))['db'][_0x79c7('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x79c7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x79c7('0x4')};function emitEvent(_0x145439){return function(_0x2e4ea0,_0x481d46,_0x46f2ac){TeamEvents[_0x79c7('0x5')](_0x145439+':'+_0x2e4ea0['id'],_0x2e4ea0);TeamEvents[_0x79c7('0x5')](_0x145439,_0x2e4ea0);_0x46f2ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x79c7('0x6')](e,emitEvent(event));}}module[_0x79c7('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 4a68939..ca62fe3 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 _0xc099=['./team.attributes','get','exports','define','Team','teams','Chat','Fax','Openchannel','Voice','Whatsapp','then','all','catch','lodash'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0xc099,0x176));var _0x9c09=function(_0x5b0e43,_0x2ceab7){_0x5b0e43=_0x5b0e43-0x0;var _0x9df53f=_0xc099[_0x5b0e43];return _0x9df53f;};'use strict';var _=require(_0x9c09('0x0'));var attributes=require(_0x9c09('0x1'));function getQueuesByChannel(_0x54c2a7,_0x1d5a19){var _0x42ed9b=_0x9c09('0x2')+_0x1d5a19+'Queues';return _0x54c2a7[_0x42ed9b]()['then'](function(_0x5ebc30){return _['map'](_0x5ebc30,function(_0x1dc909){_0x1dc909['setDataValue']('channel',_0x1d5a19);return _0x1dc909;});})['catch'](function(_0x2f5d93){throw _0x2f5d93;});}module[_0x9c09('0x3')]=function(_0x4ab501){return _0x4ab501[_0x9c09('0x4')](_0x9c09('0x5'),attributes,{'tableName':_0x9c09('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4972c9=this;var _0x296524=[_0x9c09('0x7'),_0x9c09('0x8'),'Mail',_0x9c09('0x9'),'Sms',_0x9c09('0xa'),_0x9c09('0xb')];return Promise['resolve']()[_0x9c09('0xc')](function(){var _0x292779=_['map'](_0x296524,function(_0x28878b){return getQueuesByChannel(_0x4972c9,_0x28878b);});return Promise[_0x9c09('0xd')](_0x292779);})[_0x9c09('0xe')](function(_0x576a59){throw _0x576a59;});}}});}; \ No newline at end of file +var _0x4b80=['Mail','Openchannel','Voice','resolve','then','all','lodash','./team.attributes','get','setDataValue','channel','catch','define','Team','teams','Fax'];(function(_0x4c8f05,_0x24a91e){var _0x8a673d=function(_0x175b51){while(--_0x175b51){_0x4c8f05['push'](_0x4c8f05['shift']());}};_0x8a673d(++_0x24a91e);}(_0x4b80,0x1a6));var _0x04b8=function(_0x51c362,_0x1c8bb2){_0x51c362=_0x51c362-0x0;var _0x5cd6fb=_0x4b80[_0x51c362];return _0x5cd6fb;};'use strict';var _=require(_0x04b8('0x0'));var attributes=require(_0x04b8('0x1'));function getQueuesByChannel(_0x1ac4b3,_0x45ec4d){var _0x5e1051=_0x04b8('0x2')+_0x45ec4d+'Queues';return _0x1ac4b3[_0x5e1051]()['then'](function(_0x632e03){return _['map'](_0x632e03,function(_0x3ebbc4){_0x3ebbc4[_0x04b8('0x3')](_0x04b8('0x4'),_0x45ec4d);return _0x3ebbc4;});})[_0x04b8('0x5')](function(_0x79a9a2){throw _0x79a9a2;});}module['exports']=function(_0x3841b7){return _0x3841b7[_0x04b8('0x6')](_0x04b8('0x7'),attributes,{'tableName':_0x04b8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x379272=this;var _0x5d1530=['Chat',_0x04b8('0x9'),_0x04b8('0xa'),_0x04b8('0xb'),'Sms',_0x04b8('0xc'),'Whatsapp'];return Promise[_0x04b8('0xd')]()[_0x04b8('0xe')](function(){var _0x28c4c0=_['map'](_0x5d1530,function(_0x56dd90){return getQueuesByChannel(_0x379272,_0x56dd90);});return Promise[_0x04b8('0xf')](_0x28c4c0);})['catch'](function(_0x35c874){throw _0x35c874;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 5740998..981c904 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 _0xa12e=['ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','moment','randomstring'];(function(_0x3f1c7e,_0x4ee861){var _0x38e4df=function(_0xcb642b){while(--_0xcb642b){_0x3f1c7e['push'](_0x3f1c7e['shift']());}};_0x38e4df(++_0x4ee861);}(_0xa12e,0x7b));var _0xea12=function(_0x26c12e,_0x55ef42){_0x26c12e=_0x26c12e-0x0;var _0xbab0c7=_0xa12e[_0x26c12e];return _0xbab0c7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea12('0x0'));var BPromise=require('bluebird');var rs=require(_0xea12('0x1'));var fs=require('fs');var Redis=require(_0xea12('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xea12('0x3'));var logger=require(_0xea12('0x4'))('rpc');var config=require(_0xea12('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xea12('0x6')][_0xea12('0x7')]({'port':0x232a});config[_0xea12('0x8')]=_[_0xea12('0x9')](config[_0xea12('0x8')],{'host':_0xea12('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea12('0x8')]));require(_0xea12('0xb'))['register'](socket);function respondWithRpcPromise(_0x3f4491,_0x35ec6a,_0x2bc39e){return new BPromise(function(_0x87b7d4,_0x2e06dd){return client[_0xea12('0xc')](_0x3f4491,_0x2bc39e)[_0xea12('0xd')](function(_0x5cb4ae){logger[_0xea12('0xe')](_0xea12('0xf'),_0x35ec6a,_0xea12('0x10'));logger[_0xea12('0x11')](_0xea12('0x12'),_0x35ec6a,_0xea12('0x10'),JSON[_0xea12('0x13')](_0x5cb4ae));if(_0x5cb4ae['error']){if(_0x5cb4ae[_0xea12('0x14')][_0xea12('0x15')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x35ec6a,_0x5cb4ae[_0xea12('0x14')]['message']);return _0x2e06dd(_0x5cb4ae['error']['message']);}logger['error'](_0xea12('0xf'),_0x35ec6a,_0x5cb4ae[_0xea12('0x14')]['message']);return _0x87b7d4(_0x5cb4ae[_0xea12('0x14')]['message']);}else{logger[_0xea12('0xe')]('Team,\x20%s,\x20%s',_0x35ec6a,_0xea12('0x10'));_0x87b7d4(_0x5cb4ae[_0xea12('0x16')][_0xea12('0x17')]);}})[_0xea12('0x18')](function(_0x557528){logger[_0xea12('0x14')]('Team,\x20%s,\x20%s',_0x35ec6a,_0x557528);_0x2e06dd(_0x557528);});});} \ No newline at end of file +var _0x9bcc=['Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./team.socket','register','then','info','Team,\x20%s,\x20%s','debug'];(function(_0x55627b,_0x47be96){var _0x526d26=function(_0x27f008){while(--_0x27f008){_0x55627b['push'](_0x55627b['shift']());}};_0x526d26(++_0x47be96);}(_0x9bcc,0x1b7));var _0xc9bc=function(_0x47fafa,_0x1b0fbf){_0x47fafa=_0x47fafa-0x0;var _0x838958=_0x9bcc[_0x47fafa];return _0x838958;};'use strict';var _=require(_0xc9bc('0x0'));var util=require(_0xc9bc('0x1'));var moment=require(_0xc9bc('0x2'));var BPromise=require(_0xc9bc('0x3'));var rs=require(_0xc9bc('0x4'));var fs=require('fs');var Redis=require(_0xc9bc('0x5'));var db=require(_0xc9bc('0x6'))['db'];var utils=require(_0xc9bc('0x7'));var logger=require(_0xc9bc('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc9bc('0x9'));var client=jayson[_0xc9bc('0xa')][_0xc9bc('0xb')]({'port':0x232a});config[_0xc9bc('0xc')]=_[_0xc9bc('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc9bc('0xc')]));require(_0xc9bc('0xe'))[_0xc9bc('0xf')](socket);function respondWithRpcPromise(_0x2337d9,_0x22aa2c,_0x521b7b){return new BPromise(function(_0x379d46,_0x4b4088){return client['request'](_0x2337d9,_0x521b7b)[_0xc9bc('0x10')](function(_0x1830b4){logger[_0xc9bc('0x11')](_0xc9bc('0x12'),_0x22aa2c,'request\x20sent');logger[_0xc9bc('0x13')](_0xc9bc('0x14'),_0x22aa2c,_0xc9bc('0x15'),JSON[_0xc9bc('0x16')](_0x1830b4));if(_0x1830b4[_0xc9bc('0x17')]){if(_0x1830b4[_0xc9bc('0x17')][_0xc9bc('0x18')]===0x1f4){logger[_0xc9bc('0x17')](_0xc9bc('0x12'),_0x22aa2c,_0x1830b4[_0xc9bc('0x17')][_0xc9bc('0x19')]);return _0x4b4088(_0x1830b4['error'][_0xc9bc('0x19')]);}logger[_0xc9bc('0x17')](_0xc9bc('0x12'),_0x22aa2c,_0x1830b4[_0xc9bc('0x17')][_0xc9bc('0x19')]);return _0x379d46(_0x1830b4[_0xc9bc('0x17')]['message']);}else{logger['info'](_0xc9bc('0x12'),_0x22aa2c,'request\x20sent');_0x379d46(_0x1830b4[_0xc9bc('0x1a')]['message']);}})['catch'](function(_0x51013e){logger[_0xc9bc('0x17')](_0xc9bc('0x12'),_0x22aa2c,_0x51013e);_0x4b4088(_0x51013e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 087d64b..413490e 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 _0x7d98=['./team.events','remove','update','emit','removeListener','length','team:'];(function(_0x19ac1e,_0x18c481){var _0x2d0ab4=function(_0x1bffa3){while(--_0x1bffa3){_0x19ac1e['push'](_0x19ac1e['shift']());}};_0x2d0ab4(++_0x18c481);}(_0x7d98,0xe7));var _0x87d9=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x7d98[_0x2d7f0e];return _0x110b07;};'use strict';var TeamEvents=require(_0x87d9('0x0'));var events=['save',_0x87d9('0x1'),_0x87d9('0x2')];function createListener(_0x3fdc56,_0xbee750){return function(_0x47cceb){_0xbee750[_0x87d9('0x3')](_0x3fdc56,_0x47cceb);};}function removeListener(_0x317ba8,_0x4b4f58){return function(){TeamEvents[_0x87d9('0x4')](_0x317ba8,_0x4b4f58);};}exports['register']=function(_0x5ed6d2){for(var _0x510ba4=0x0,_0x3fe56d=events[_0x87d9('0x5')];_0x510ba4<_0x3fe56d;_0x510ba4++){var _0x2dc542=events[_0x510ba4];var _0x5f2693=createListener(_0x87d9('0x6')+_0x2dc542,_0x5ed6d2);TeamEvents['on'](_0x2dc542,_0x5f2693);}}; \ No newline at end of file +var _0xa49e=['emit','removeListener','register','length','team:','./team.events','remove'];(function(_0x4225aa,_0x582bf2){var _0x3f8fab=function(_0x498647){while(--_0x498647){_0x4225aa['push'](_0x4225aa['shift']());}};_0x3f8fab(++_0x582bf2);}(_0xa49e,0x147));var _0xea49=function(_0xb247e3,_0x1319d1){_0xb247e3=_0xb247e3-0x0;var _0x57fb7b=_0xa49e[_0xb247e3];return _0x57fb7b;};'use strict';var TeamEvents=require(_0xea49('0x0'));var events=['save',_0xea49('0x1'),'update'];function createListener(_0x2b81d7,_0x313853){return function(_0x142f60){_0x313853[_0xea49('0x2')](_0x2b81d7,_0x142f60);};}function removeListener(_0x14e587,_0xf22802){return function(){TeamEvents[_0xea49('0x3')](_0x14e587,_0xf22802);};}exports[_0xea49('0x4')]=function(_0x2a08cb){for(var _0x2e4f31=0x0,_0x3ba938=events[_0xea49('0x5')];_0x2e4f31<_0x3ba938;_0x2e4f31++){var _0x4bec0c=events[_0x2e4f31];var _0x15d8e1=createListener(_0xea49('0x6')+_0x4bec0c,_0x2a08cb);TeamEvents['on'](_0x4bec0c,_0x15d8e1);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 393ae44..66dde8f 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 _0x0e35=['exports','INTEGER','sequelize'];(function(_0x17882e,_0x140c6e){var _0x8d37e8=function(_0x2cee55){while(--_0x2cee55){_0x17882e['push'](_0x17882e['shift']());}};_0x8d37e8(++_0x140c6e);}(_0x0e35,0xc2));var _0x50e3=function(_0x1f1534,_0x329913){_0x1f1534=_0x1f1534-0x0;var _0x24729b=_0x0e35[_0x1f1534];return _0x24729b;};'use strict';var Sequelize=require(_0x50e3('0x0'));module[_0x50e3('0x1')]={'TeamId':{'type':Sequelize[_0x50e3('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x50e3('0x2')]}}; \ No newline at end of file +var _0x75f0=['INTEGER','sequelize','exports'];(function(_0x363fb7,_0x4e6aa2){var _0x1e88dc=function(_0x1dec46){while(--_0x1dec46){_0x363fb7['push'](_0x363fb7['shift']());}};_0x1e88dc(++_0x4e6aa2);}(_0x75f0,0x196));var _0x075f=function(_0xfab3e1,_0x2d9028){_0xfab3e1=_0xfab3e1-0x0;var _0x5afd4d=_0x75f0[_0xfab3e1];return _0x5afd4d;};'use strict';var Sequelize=require(_0x075f('0x0'));module[_0x075f('0x1')]={'TeamId':{'type':Sequelize[_0x075f('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x075f('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 837bf50..965a685 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 _0xd878=['request-promise','./teamVoicePrefix.attributes','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x543976,_0x2b06c8){var _0x617f0b=function(_0x2b1879){while(--_0x2b1879){_0x543976['push'](_0x543976['shift']());}};_0x617f0b(++_0x2b06c8);}(_0xd878,0x118));var _0x8d87=function(_0x1f2682,_0x1ceb9a){_0x1f2682=_0x1f2682-0x0;var _0x4fe9ca=_0xd878[_0x1f2682];return _0x4fe9ca;};'use strict';var _=require(_0x8d87('0x0'));var util=require(_0x8d87('0x1'));var logger=require(_0x8d87('0x2'))(_0x8d87('0x3'));var moment=require(_0x8d87('0x4'));var BPromise=require(_0x8d87('0x5'));var rp=require(_0x8d87('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8d87('0x7'));module['exports']=function(_0x5f11a6,_0x456998){return _0x5f11a6[_0x8d87('0x8')](_0x8d87('0x9'),attributes,{'tableName':_0x8d87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c0=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x4eb68b,_0x4c933f){var _0x1610d1=function(_0x4f293e){while(--_0x4f293e){_0x4eb68b['push'](_0x4eb68b['shift']());}};_0x1610d1(++_0x4c933f);}(_0xe0c0,0xa7));var _0x0e0c=function(_0xffd870,_0x3c556f){_0xffd870=_0xffd870-0x0;var _0x4b8e31=_0xe0c0[_0xffd870];return _0x4b8e31;};'use strict';var _=require(_0x0e0c('0x0'));var util=require('util');var logger=require(_0x0e0c('0x1'))(_0x0e0c('0x2'));var moment=require(_0x0e0c('0x3'));var BPromise=require(_0x0e0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e0c('0x5'));var rimraf=require(_0x0e0c('0x6'));var config=require(_0x0e0c('0x7'));var attributes=require('./teamVoicePrefix.attributes');module[_0x0e0c('0x8')]=function(_0x2856d7,_0x4a094c){return _0x2856d7[_0x0e0c('0x9')](_0x0e0c('0xa'),attributes,{'tableName':_0x0e0c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 502243b..8d21df9 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x57fcdd,_0x28df3c){var _0xecaa62=function(_0x5ae4e5){while(--_0x5ae4e5){_0x57fcdd['push'](_0x57fcdd['shift']());}};_0xecaa62(++_0x28df3c);}(_0x70e0,0x17b));var _0x070e=function(_0x132f72,_0x530509){_0x132f72=_0x132f72-0x0;var _0x4313f9=_0x70e0[_0x132f72];return _0x4313f9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x51256c,_0x5ad225){var _0x2e0574=function(_0x322df8){while(--_0x322df8){_0x51256c['push'](_0x51256c['shift']());}};_0x2e0574(++_0x5ad225);}(_0xe706,0xa3));var _0x6e70=function(_0x1e6ca5,_0xfb9d62){_0x1e6ca5=_0x1e6ca5-0x0;var _0xf1e27=_0xe706[_0x1e6ca5];return _0xf1e27;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 614a39c..be11a91 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 _0x5336=['INTEGER','exports'];(function(_0x410a1d,_0x369bc8){var _0x28007a=function(_0x2cc888){while(--_0x2cc888){_0x410a1d['push'](_0x410a1d['shift']());}};_0x28007a(++_0x369bc8);}(_0x5336,0xa9));var _0x6533=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x5336[_0x17928f];return _0x500b63;};'use strict';var Sequelize=require('sequelize');module[_0x6533('0x0')]={'penalty':{'type':Sequelize[_0x6533('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5f4e=['sequelize','INTEGER'];(function(_0x12e075,_0x2f6b9c){var _0xacd6dd=function(_0x1135c2){while(--_0x1135c2){_0x12e075['push'](_0x12e075['shift']());}};_0xacd6dd(++_0x2f6b9c);}(_0x5f4e,0x1d8));var _0xe5f4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f4e[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xe5f4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe5f4('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index a66ae76..9db6351 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 _0x8664=['moment','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x19697,_0x633c11){var _0x419edd=function(_0x463d2a){while(--_0x463d2a){_0x19697['push'](_0x19697['shift']());}};_0x419edd(++_0x633c11);}(_0x8664,0x11a));var _0x4866=function(_0x356b65,_0x1d2fca){_0x356b65=_0x356b65-0x0;var _0x1edc06=_0x8664[_0x356b65];return _0x1edc06;};'use strict';var _=require(_0x4866('0x0'));var util=require(_0x4866('0x1'));var logger=require(_0x4866('0x2'))(_0x4866('0x3'));var moment=require(_0x4866('0x4'));var BPromise=require(_0x4866('0x5'));var rp=require(_0x4866('0x6'));var fs=require('fs');var path=require(_0x4866('0x7'));var rimraf=require(_0x4866('0x8'));var config=require('../../config/environment');var attributes=require(_0x4866('0x9'));module['exports']=function(_0x66b444,_0x3eb6f9){return _0x66b444[_0x4866('0xa')](_0x4866('0xb'),attributes,{'tableName':_0x4866('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc65=['rimraf','exports','define','TeamVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x465b87,_0x504537){var _0x4a43b5=function(_0x38500c){while(--_0x38500c){_0x465b87['push'](_0x465b87['shift']());}};_0x4a43b5(++_0x504537);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x5f5a3d,_0x1fe698){_0x5f5a3d=_0x5f5a3d-0x0;var _0x2bd5a1=_0xfc65[_0x5f5a3d];return _0x2bd5a1;};'use strict';var _=require(_0x5fc6('0x0'));var util=require(_0x5fc6('0x1'));var logger=require(_0x5fc6('0x2'))(_0x5fc6('0x3'));var moment=require(_0x5fc6('0x4'));var BPromise=require(_0x5fc6('0x5'));var rp=require(_0x5fc6('0x6'));var fs=require('fs');var path=require(_0x5fc6('0x7'));var rimraf=require(_0x5fc6('0x8'));var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0x5fc6('0x9')]=function(_0x2e1c2b,_0x3e9bf3){return _0x2e1c2b[_0x5fc6('0xa')](_0x5fc6('0xb'),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 67798d9..85698ae 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1ef69f,_0x44ea11){var _0x175357=function(_0x22c1b6){while(--_0x22c1b6){_0x1ef69f['push'](_0x1ef69f['shift']());}};_0x175357(++_0x44ea11);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0xcb91[_0x28a5ad];return _0x176b8a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xf9a6=['randomstring','../../mysqldb','../../config/utils','rpc','client','http','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x42b19d,_0x5ec500){var _0x27cc9b=function(_0x4b20bf){while(--_0x4b20bf){_0x42b19d['push'](_0x42b19d['shift']());}};_0x27cc9b(++_0x5ec500);}(_0xf9a6,0xd8));var _0x6f9a=function(_0x1a424b,_0x3d344d){_0x1a424b=_0x1a424b-0x0;var _0x775933=_0xf9a6[_0x1a424b];return _0x775933;};'use strict';var _=require(_0x6f9a('0x0'));var util=require(_0x6f9a('0x1'));var moment=require(_0x6f9a('0x2'));var BPromise=require(_0x6f9a('0x3'));var rs=require(_0x6f9a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f9a('0x5'))['db'];var utils=require(_0x6f9a('0x6'));var logger=require('../../config/logger')(_0x6f9a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6f9a('0x8')][_0x6f9a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x407b35,_0x2c724e,_0x512674){return new BPromise(function(_0x3ef7b1,_0x2fe152){return client['request'](_0x407b35,_0x512674)['then'](function(_0x4d23f8){logger[_0x6f9a('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x2c724e,_0x6f9a('0xb'));logger[_0x6f9a('0xc')](_0x6f9a('0xd'),_0x2c724e,_0x6f9a('0xb'),JSON[_0x6f9a('0xe')](_0x4d23f8));if(_0x4d23f8['error']){if(_0x4d23f8[_0x6f9a('0xf')]['code']===0x1f4){logger[_0x6f9a('0xf')](_0x6f9a('0x10'),_0x2c724e,_0x4d23f8[_0x6f9a('0xf')][_0x6f9a('0x11')]);return _0x2fe152(_0x4d23f8[_0x6f9a('0xf')][_0x6f9a('0x11')]);}logger[_0x6f9a('0xf')](_0x6f9a('0x10'),_0x2c724e,_0x4d23f8[_0x6f9a('0xf')][_0x6f9a('0x11')]);return _0x3ef7b1(_0x4d23f8['error'][_0x6f9a('0x11')]);}else{logger[_0x6f9a('0xa')](_0x6f9a('0x10'),_0x2c724e,_0x6f9a('0xb'));_0x3ef7b1(_0x4d23f8[_0x6f9a('0x12')][_0x6f9a('0x11')]);}})[_0x6f9a('0x13')](function(_0x131df2){logger[_0x6f9a('0xf')](_0x6f9a('0x10'),_0x2c724e,_0x131df2);_0x2fe152(_0x131df2);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 579822f..7883a3c 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 _0x1267=['isAuthenticated','index','get','/:id','show','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x442ae6,_0x58743b){var _0x581317=function(_0x3accfa){while(--_0x3accfa){_0x442ae6['push'](_0x442ae6['shift']());}};_0x581317(++_0x58743b);}(_0x1267,0xb5));var _0x7126=function(_0xdff12b,_0x31e5e7){_0xdff12b=_0xdff12b-0x0;var _0xc400b7=_0x1267[_0xdff12b];return _0xc400b7;};'use strict';var multer=require(_0x7126('0x0'));var util=require(_0x7126('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7126('0x2'));var router=express[_0x7126('0x3')]();var fs_extra=require(_0x7126('0x4'));var auth=require(_0x7126('0x5'));var interaction=require(_0x7126('0x6'));var config=require(_0x7126('0x7'));var controller=require(_0x7126('0x8'));router['get']('/',auth[_0x7126('0x9')](),controller[_0x7126('0xa')]);router[_0x7126('0xb')](_0x7126('0xc'),auth['isAuthenticated'](),controller[_0x7126('0xd')]);router['post']('/',auth[_0x7126('0x9')](),controller['create']);router[_0x7126('0xe')](_0x7126('0xc'),auth[_0x7126('0x9')](),controller[_0x7126('0xf')]);router[_0x7126('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x7126('0x11')]);module[_0x7126('0x12')]=router; \ No newline at end of file +var _0xd509=['post','create','/:id','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','show'];(function(_0x1e85db,_0x432aad){var _0x11066d=function(_0x254d3c){while(--_0x254d3c){_0x1e85db['push'](_0x1e85db['shift']());}};_0x11066d(++_0x432aad);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9d50('0x0'));var timeout=require(_0x9d50('0x1'));var express=require(_0x9d50('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9d50('0x3'));var interaction=require(_0x9d50('0x4'));var config=require('../../config/environment');var controller=require(_0x9d50('0x5'));router[_0x9d50('0x6')]('/',auth[_0x9d50('0x7')](),controller['index']);router[_0x9d50('0x6')]('/:id',auth[_0x9d50('0x7')](),controller[_0x9d50('0x8')]);router[_0x9d50('0x9')]('/',auth[_0x9d50('0x7')](),controller[_0x9d50('0xa')]);router['put'](_0x9d50('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x9d50('0xc')]('/:id',auth[_0x9d50('0x7')](),controller[_0x9d50('0xd')]);module[_0x9d50('0xe')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index eefce5b..b1dc2ed 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 _0xb293=['exports','STRING','TEXT','sequelize'];(function(_0x18c7f7,_0x4263fc){var _0x5e142a=function(_0x49460e){while(--_0x49460e){_0x18c7f7['push'](_0x18c7f7['shift']());}};_0x5e142a(++_0x4263fc);}(_0xb293,0x12f));var _0x3b29=function(_0x1d1967,_0x52b368){_0x1d1967=_0x1d1967-0x0;var _0x5d6ce0=_0xb293[_0x1d1967];return _0x5d6ce0;};'use strict';var Sequelize=require(_0x3b29('0x0'));module[_0x3b29('0x1')]={'name':{'type':Sequelize[_0x3b29('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x3b29('0x3')]}}; \ No newline at end of file +var _0xd6fe=['exports','STRING','sequelize'];(function(_0x17d903,_0x3b0714){var _0x76c440=function(_0xe472f0){while(--_0xe472f0){_0x17d903['push'](_0x17d903['shift']());}};_0x76c440(++_0x3b0714);}(_0xd6fe,0x158));var _0xed6f=function(_0x465f61,_0x2b5e6c){_0x465f61=_0x465f61-0x0;var _0xa721e6=_0xd6fe[_0x465f61];return _0xa721e6;};'use strict';var Sequelize=require(_0xed6f('0x0'));module[_0xed6f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xed6f('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index baa551c..be0a165 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 _0x1d64=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','Templates','error','stack','name','index','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','Template','include','rows','catch','show','params','keys','rawAttributes','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring'];(function(_0x59a40c,_0x35999f){var _0x3cf340=function(_0x3d2c47){while(--_0x3d2c47){_0x59a40c['push'](_0x59a40c['shift']());}};_0x3cf340(++_0x35999f);}(_0x1d64,0x122));var _0x41d6=function(_0x5280f4,_0x3c36d0){_0x5280f4=_0x5280f4-0x0;var _0xba93e7=_0x1d64[_0x5280f4];return _0xba93e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x41d6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x41d6('0x1'));var rp=require(_0x41d6('0x2'));var moment=require('moment');var BPromise=require(_0x41d6('0x3'));var Mustache=require(_0x41d6('0x4'));var util=require(_0x41d6('0x5'));var path=require(_0x41d6('0x6'));var sox=require(_0x41d6('0x7'));var csv=require('to-csv');var ejs=require(_0x41d6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41d6('0x9'));var squel=require(_0x41d6('0xa'));var crypto=require(_0x41d6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x41d6('0xc'));var querystring=require(_0x41d6('0xd'));var Papa=require(_0x41d6('0xe'));var Redis=require(_0x41d6('0xf'));var authService=require(_0x41d6('0x10'));var qs=require(_0x41d6('0x11'));var as=require(_0x41d6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x41d6('0x13'))(_0x41d6('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x41d6('0x15'))['db'];function respondWithStatusCode(_0x56eb11,_0x279b7d){_0x279b7d=_0x279b7d||0xcc;return function(_0x5b2d69){if(_0x5b2d69){return _0x56eb11['sendStatus'](_0x279b7d);}return _0x56eb11[_0x41d6('0x16')](_0x279b7d)[_0x41d6('0x17')]();};}function respondWithResult(_0x649964,_0x318d76){_0x318d76=_0x318d76||0xc8;return function(_0x52e0f2){if(_0x52e0f2){return _0x649964[_0x41d6('0x16')](_0x318d76)['json'](_0x52e0f2);}};}function respondWithFilteredResult(_0xd6953d,_0x51002e){return function(_0x4d8454){if(_0x4d8454){var _0x3d7a6f=typeof _0x51002e[_0x41d6('0x18')]===_0x41d6('0x19')&&typeof _0x51002e[_0x41d6('0x1a')]==='undefined';var _0x2f3e2e=_0x4d8454['count'];var _0x21ec10=_0x3d7a6f?0x0:_0x51002e[_0x41d6('0x18')];var _0x481e23=_0x3d7a6f?_0x4d8454[_0x41d6('0x1b')]:_0x51002e[_0x41d6('0x18')]+_0x51002e[_0x41d6('0x1a')];var _0x3c6660;if(_0x481e23>=_0x2f3e2e){_0x481e23=_0x2f3e2e;_0x3c6660=0xc8;}else{_0x3c6660=0xce;}_0xd6953d[_0x41d6('0x16')](_0x3c6660);return _0xd6953d['set'](_0x41d6('0x1c'),_0x21ec10+'-'+_0x481e23+'/'+_0x2f3e2e)['json'](_0x4d8454);}return null;};}function patchUpdates(_0x1cb8cd){return function(_0x13c70e){try{jsonpatch[_0x41d6('0x1d')](_0x13c70e,_0x1cb8cd,!![]);}catch(_0x3897c7){return BPromise['reject'](_0x3897c7);}return _0x13c70e[_0x41d6('0x1e')]();};}function saveUpdates(_0x107a4a,_0x146dfd){return function(_0x304b53){if(_0x304b53){return _0x304b53[_0x41d6('0x1f')](_0x107a4a)[_0x41d6('0x20')](function(_0x1487fb){return _0x1487fb;});}return null;};}function removeEntity(_0x1f5196,_0x23f1b2){return function(_0x57bc64){if(_0x57bc64){return _0x57bc64[_0x41d6('0x21')]()['then'](function(){var _0x33ee38=_0x57bc64['get']({'plain':!![]});var _0x5a4c33=_0x41d6('0x22');return db['UserProfileResource'][_0x41d6('0x21')]({'where':{'type':_0x5a4c33,'resourceId':_0x33ee38['id']}})[_0x41d6('0x20')](function(){return _0x57bc64;});})[_0x41d6('0x20')](function(){_0x1f5196[_0x41d6('0x16')](0xcc)[_0x41d6('0x17')]();});}};}function handleEntityNotFound(_0x4641da,_0x3ecebd){return function(_0x44da35){if(!_0x44da35){_0x4641da['sendStatus'](0x194);}return _0x44da35;};}function handleError(_0x5ea879,_0x424ecc){_0x424ecc=_0x424ecc||0x1f4;return function(_0x6a1008){logger[_0x41d6('0x23')](_0x6a1008[_0x41d6('0x24')]);if(_0x6a1008[_0x41d6('0x25')]){delete _0x6a1008[_0x41d6('0x25')];}_0x5ea879[_0x41d6('0x16')](_0x424ecc)['send'](_0x6a1008);};}exports[_0x41d6('0x26')]=function(_0x4045c4,_0x5988a4){var _0x420eee={},_0x2edcae={},_0x4f8a74={'count':0x0,'rows':[]};var _0x37daa2=_['map'](db['Template']['rawAttributes'],function(_0x2804e8){return{'name':_0x2804e8[_0x41d6('0x27')],'type':_0x2804e8[_0x41d6('0x28')]['key']};});_0x2edcae['model']=_[_0x41d6('0x29')](_0x37daa2,_0x41d6('0x25'));_0x2edcae[_0x41d6('0x2a')]=_['keys'](_0x4045c4[_0x41d6('0x2a')]);_0x2edcae[_0x41d6('0x2b')]=_[_0x41d6('0x2c')](_0x2edcae[_0x41d6('0x2d')],_0x2edcae[_0x41d6('0x2a')]);_0x420eee[_0x41d6('0x2e')]=_[_0x41d6('0x2c')](_0x2edcae[_0x41d6('0x2d')],qs[_0x41d6('0x2f')](_0x4045c4[_0x41d6('0x2a')]['fields']));_0x420eee[_0x41d6('0x2e')]=_0x420eee[_0x41d6('0x2e')][_0x41d6('0x30')]?_0x420eee[_0x41d6('0x2e')]:_0x2edcae[_0x41d6('0x2d')];if(!_0x4045c4['query'][_0x41d6('0x31')](_0x41d6('0x32'))){_0x420eee[_0x41d6('0x1a')]=qs[_0x41d6('0x1a')](_0x4045c4[_0x41d6('0x2a')][_0x41d6('0x1a')]);_0x420eee[_0x41d6('0x18')]=qs[_0x41d6('0x18')](_0x4045c4['query'][_0x41d6('0x18')]);}_0x420eee[_0x41d6('0x33')]=qs[_0x41d6('0x34')](_0x4045c4[_0x41d6('0x2a')]['sort']);_0x420eee[_0x41d6('0x35')]=qs['filters'](_[_0x41d6('0x36')](_0x4045c4[_0x41d6('0x2a')],_0x2edcae['filters']),_0x37daa2);if(_0x4045c4[_0x41d6('0x2a')]['filter']){_0x420eee[_0x41d6('0x35')]=_['merge'](_0x420eee[_0x41d6('0x35')],{'$or':_[_0x41d6('0x29')](_0x37daa2,function(_0x3d04ce){if(_0x3d04ce[_0x41d6('0x28')]!==_0x41d6('0x37')){var _0x210b7a={};_0x210b7a[_0x3d04ce['name']]={'$like':'%'+_0x4045c4[_0x41d6('0x2a')][_0x41d6('0x38')]+'%'};return _0x210b7a;}})});}_0x420eee=_[_0x41d6('0x39')]({},_0x420eee,_0x4045c4['options']);var _0x305800={'where':_0x420eee['where']};return db[_0x41d6('0x3a')][_0x41d6('0x1b')](_0x305800)[_0x41d6('0x20')](function(_0x20d4c8){_0x4f8a74[_0x41d6('0x1b')]=_0x20d4c8;if(_0x4045c4[_0x41d6('0x2a')]['includeAll']){_0x420eee[_0x41d6('0x3b')]=[{'all':!![]}];}return db[_0x41d6('0x3a')]['findAll'](_0x420eee);})[_0x41d6('0x20')](function(_0x1f0a87){_0x4f8a74[_0x41d6('0x3c')]=_0x1f0a87;return _0x4f8a74;})['then'](respondWithFilteredResult(_0x5988a4,_0x420eee))[_0x41d6('0x3d')](handleError(_0x5988a4,null));};exports[_0x41d6('0x3e')]=function(_0x25e93c,_0x1e4a3a){var _0x388ff2={'raw':!![],'where':{'id':_0x25e93c[_0x41d6('0x3f')]['id']}},_0x2fbc45={};_0x2fbc45[_0x41d6('0x2d')]=_[_0x41d6('0x40')](db['Template'][_0x41d6('0x41')]);_0x2fbc45['query']=_[_0x41d6('0x40')](_0x25e93c[_0x41d6('0x2a')]);_0x2fbc45['filters']=_['intersection'](_0x2fbc45['model'],_0x2fbc45[_0x41d6('0x2a')]);_0x388ff2['attributes']=_[_0x41d6('0x2c')](_0x2fbc45['model'],qs[_0x41d6('0x2f')](_0x25e93c[_0x41d6('0x2a')][_0x41d6('0x2f')]));_0x388ff2['attributes']=_0x388ff2[_0x41d6('0x2e')]['length']?_0x388ff2[_0x41d6('0x2e')]:_0x2fbc45[_0x41d6('0x2d')];if(_0x25e93c[_0x41d6('0x2a')][_0x41d6('0x42')]){_0x388ff2['include']=[{'all':!![]}];}_0x388ff2=_[_0x41d6('0x39')]({},_0x388ff2,_0x25e93c['options']);return db[_0x41d6('0x3a')][_0x41d6('0x43')](_0x388ff2)[_0x41d6('0x20')](handleEntityNotFound(_0x1e4a3a,null))[_0x41d6('0x20')](respondWithResult(_0x1e4a3a,null))['catch'](handleError(_0x1e4a3a,null));};exports['create']=function(_0x839a04,_0x118096){return db['Template']['create'](_0x839a04[_0x41d6('0x44')],{})['then'](function(_0x59d158){var _0xa99ab6=_0x839a04[_0x41d6('0x45')][_0x41d6('0x46')]({'plain':!![]});if(!_0xa99ab6)throw new Error(_0x41d6('0x47'));if(_0xa99ab6[_0x41d6('0x48')]===_0x41d6('0x45')){var _0x37fb49=_0x59d158[_0x41d6('0x46')]({'plain':!![]});var _0x4589ee='Templates';return db['UserProfileSection']['find']({'where':{'name':_0x4589ee,'userProfileId':_0xa99ab6[_0x41d6('0x49')]},'raw':!![]})[_0x41d6('0x20')](function(_0x33f3a3){if(_0x33f3a3&&_0x33f3a3['autoAssociation']===0x0){return db[_0x41d6('0x4a')]['create']({'name':_0x37fb49[_0x41d6('0x25')],'resourceId':_0x37fb49['id'],'type':_0x33f3a3[_0x41d6('0x25')],'sectionId':_0x33f3a3['id']},{})[_0x41d6('0x20')](function(){return _0x59d158;});}else{return _0x59d158;}})[_0x41d6('0x3d')](function(_0x1c1af7){logger['error'](_0x41d6('0x4b'),_0x1c1af7);throw _0x1c1af7;});}return _0x59d158;})[_0x41d6('0x20')](respondWithResult(_0x118096,0xc9))[_0x41d6('0x3d')](handleError(_0x118096,null));};exports[_0x41d6('0x1f')]=function(_0x20c5cb,_0x25444d){if(_0x20c5cb['body']['id']){delete _0x20c5cb[_0x41d6('0x44')]['id'];}return db['Template'][_0x41d6('0x43')]({'where':{'id':_0x20c5cb['params']['id']}})['then'](handleEntityNotFound(_0x25444d,null))[_0x41d6('0x20')](saveUpdates(_0x20c5cb[_0x41d6('0x44')],null))[_0x41d6('0x20')](respondWithResult(_0x25444d,null))[_0x41d6('0x3d')](handleError(_0x25444d,null));};exports['destroy']=function(_0x42551d,_0xc43d30){return db['Template'][_0x41d6('0x43')]({'where':{'id':_0x42551d[_0x41d6('0x3f')]['id']}})[_0x41d6('0x20')](handleEntityNotFound(_0xc43d30,null))[_0x41d6('0x20')](removeEntity(_0xc43d30,null))[_0x41d6('0x3d')](handleError(_0xc43d30,null));}; \ No newline at end of file +var _0x8652=['stack','name','send','map','Template','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','filter','options','include','findAll','params','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','get','Templates','destroy','error'];(function(_0x37dd5b,_0xf4db75){var _0x14982a=function(_0x31a70){while(--_0x31a70){_0x37dd5b['push'](_0x37dd5b['shift']());}};_0x14982a(++_0xf4db75);}(_0x8652,0x17c));var _0x2865=function(_0x1966f3,_0x210ea3){_0x1966f3=_0x1966f3-0x0;var _0x17575f=_0x8652[_0x1966f3];return _0x17575f;};'use strict';var emlformat=require(_0x2865('0x0'));var rimraf=require(_0x2865('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2865('0x2'));var rp=require(_0x2865('0x3'));var moment=require(_0x2865('0x4'));var BPromise=require(_0x2865('0x5'));var Mustache=require(_0x2865('0x6'));var util=require(_0x2865('0x7'));var path=require(_0x2865('0x8'));var sox=require(_0x2865('0x9'));var csv=require(_0x2865('0xa'));var ejs=require(_0x2865('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2865('0xc'));var squel=require(_0x2865('0xd'));var crypto=require(_0x2865('0xe'));var jsforce=require(_0x2865('0xf'));var deskjs=require(_0x2865('0x10'));var toCsv=require(_0x2865('0xa'));var querystring=require(_0x2865('0x11'));var Papa=require(_0x2865('0x12'));var Redis=require(_0x2865('0x13'));var authService=require(_0x2865('0x14'));var qs=require(_0x2865('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2865('0x16'));var logger=require(_0x2865('0x17'))('api');var utils=require(_0x2865('0x18'));var config=require(_0x2865('0x19'));var licenseUtil=require(_0x2865('0x1a'));var db=require(_0x2865('0x1b'))['db'];function respondWithStatusCode(_0x52d1e9,_0x4420ea){_0x4420ea=_0x4420ea||0xcc;return function(_0x19b017){if(_0x19b017){return _0x52d1e9[_0x2865('0x1c')](_0x4420ea);}return _0x52d1e9[_0x2865('0x1d')](_0x4420ea)[_0x2865('0x1e')]();};}function respondWithResult(_0x3f3978,_0x3ac276){_0x3ac276=_0x3ac276||0xc8;return function(_0x46bc9b){if(_0x46bc9b){return _0x3f3978[_0x2865('0x1d')](_0x3ac276)[_0x2865('0x1f')](_0x46bc9b);}};}function respondWithFilteredResult(_0x2e234d,_0x1215e1){return function(_0x1e8947){if(_0x1e8947){var _0x268295=typeof _0x1215e1[_0x2865('0x20')]===_0x2865('0x21')&&typeof _0x1215e1[_0x2865('0x22')]===_0x2865('0x21');var _0x1ab1c5=_0x1e8947[_0x2865('0x23')];var _0x56f35c=_0x268295?0x0:_0x1215e1[_0x2865('0x20')];var _0x911b43=_0x268295?_0x1e8947[_0x2865('0x23')]:_0x1215e1[_0x2865('0x20')]+_0x1215e1[_0x2865('0x22')];var _0x24c88b;if(_0x911b43>=_0x1ab1c5){_0x911b43=_0x1ab1c5;_0x24c88b=0xc8;}else{_0x24c88b=0xce;}_0x2e234d['status'](_0x24c88b);return _0x2e234d[_0x2865('0x24')]('Content-Range',_0x56f35c+'-'+_0x911b43+'/'+_0x1ab1c5)['json'](_0x1e8947);}return null;};}function patchUpdates(_0x412d43){return function(_0x2acfdf){try{jsonpatch[_0x2865('0x25')](_0x2acfdf,_0x412d43,!![]);}catch(_0x1409b8){return BPromise['reject'](_0x1409b8);}return _0x2acfdf[_0x2865('0x26')]();};}function saveUpdates(_0x1c5b3e,_0x2b9f9b){return function(_0x5aaca8){if(_0x5aaca8){return _0x5aaca8[_0x2865('0x27')](_0x1c5b3e)[_0x2865('0x28')](function(_0x11f187){return _0x11f187;});}return null;};}function removeEntity(_0x4ce155,_0x4685c4){return function(_0x15429d){if(_0x15429d){return _0x15429d['destroy']()['then'](function(){var _0x174375=_0x15429d[_0x2865('0x29')]({'plain':!![]});var _0x24ea3f=_0x2865('0x2a');return db['UserProfileResource'][_0x2865('0x2b')]({'where':{'type':_0x24ea3f,'resourceId':_0x174375['id']}})[_0x2865('0x28')](function(){return _0x15429d;});})['then'](function(){_0x4ce155[_0x2865('0x1d')](0xcc)[_0x2865('0x1e')]();});}};}function handleEntityNotFound(_0xd86987,_0x989eee){return function(_0x5e1019){if(!_0x5e1019){_0xd86987[_0x2865('0x1c')](0x194);}return _0x5e1019;};}function handleError(_0x24c6a8,_0x543d69){_0x543d69=_0x543d69||0x1f4;return function(_0x597d7c){logger[_0x2865('0x2c')](_0x597d7c[_0x2865('0x2d')]);if(_0x597d7c[_0x2865('0x2e')]){delete _0x597d7c[_0x2865('0x2e')];}_0x24c6a8[_0x2865('0x1d')](_0x543d69)[_0x2865('0x2f')](_0x597d7c);};}exports['index']=function(_0x56cb81,_0x101e5c){var _0x39ba7f={},_0x19498e={},_0x4ae336={'count':0x0,'rows':[]};var _0x12f7bd=_[_0x2865('0x30')](db[_0x2865('0x31')][_0x2865('0x32')],function(_0x29dd8c){return{'name':_0x29dd8c[_0x2865('0x33')],'type':_0x29dd8c[_0x2865('0x34')][_0x2865('0x35')]};});_0x19498e[_0x2865('0x36')]=_[_0x2865('0x30')](_0x12f7bd,_0x2865('0x2e'));_0x19498e['query']=_['keys'](_0x56cb81[_0x2865('0x37')]);_0x19498e[_0x2865('0x38')]=_[_0x2865('0x39')](_0x19498e[_0x2865('0x36')],_0x19498e[_0x2865('0x37')]);_0x39ba7f[_0x2865('0x3a')]=_[_0x2865('0x39')](_0x19498e[_0x2865('0x36')],qs[_0x2865('0x3b')](_0x56cb81[_0x2865('0x37')][_0x2865('0x3b')]));_0x39ba7f[_0x2865('0x3a')]=_0x39ba7f['attributes']['length']?_0x39ba7f[_0x2865('0x3a')]:_0x19498e['model'];if(!_0x56cb81[_0x2865('0x37')][_0x2865('0x3c')](_0x2865('0x3d'))){_0x39ba7f['limit']=qs[_0x2865('0x22')](_0x56cb81['query'][_0x2865('0x22')]);_0x39ba7f[_0x2865('0x20')]=qs[_0x2865('0x20')](_0x56cb81[_0x2865('0x37')][_0x2865('0x20')]);}_0x39ba7f['order']=qs[_0x2865('0x3e')](_0x56cb81[_0x2865('0x37')][_0x2865('0x3e')]);_0x39ba7f[_0x2865('0x3f')]=qs[_0x2865('0x38')](_['pick'](_0x56cb81[_0x2865('0x37')],_0x19498e[_0x2865('0x38')]),_0x12f7bd);if(_0x56cb81['query']['filter']){_0x39ba7f[_0x2865('0x3f')]=_[_0x2865('0x40')](_0x39ba7f[_0x2865('0x3f')],{'$or':_[_0x2865('0x30')](_0x12f7bd,function(_0x49cf10){if(_0x49cf10['type']!=='VIRTUAL'){var _0x211ceb={};_0x211ceb[_0x49cf10[_0x2865('0x2e')]]={'$like':'%'+_0x56cb81[_0x2865('0x37')][_0x2865('0x41')]+'%'};return _0x211ceb;}})});}_0x39ba7f=_[_0x2865('0x40')]({},_0x39ba7f,_0x56cb81[_0x2865('0x42')]);var _0x5e9699={'where':_0x39ba7f[_0x2865('0x3f')]};return db[_0x2865('0x31')][_0x2865('0x23')](_0x5e9699)[_0x2865('0x28')](function(_0x2905f8){_0x4ae336[_0x2865('0x23')]=_0x2905f8;if(_0x56cb81[_0x2865('0x37')]['includeAll']){_0x39ba7f[_0x2865('0x43')]=[{'all':!![]}];}return db[_0x2865('0x31')][_0x2865('0x44')](_0x39ba7f);})['then'](function(_0x521657){_0x4ae336['rows']=_0x521657;return _0x4ae336;})[_0x2865('0x28')](respondWithFilteredResult(_0x101e5c,_0x39ba7f))['catch'](handleError(_0x101e5c,null));};exports['show']=function(_0x13fccf,_0x4dd01b){var _0x4f8bcc={'raw':!![],'where':{'id':_0x13fccf[_0x2865('0x45')]['id']}},_0x25d927={};_0x25d927[_0x2865('0x36')]=_[_0x2865('0x46')](db[_0x2865('0x31')][_0x2865('0x32')]);_0x25d927[_0x2865('0x37')]=_[_0x2865('0x46')](_0x13fccf[_0x2865('0x37')]);_0x25d927[_0x2865('0x38')]=_['intersection'](_0x25d927[_0x2865('0x36')],_0x25d927[_0x2865('0x37')]);_0x4f8bcc[_0x2865('0x3a')]=_['intersection'](_0x25d927['model'],qs[_0x2865('0x3b')](_0x13fccf[_0x2865('0x37')]['fields']));_0x4f8bcc[_0x2865('0x3a')]=_0x4f8bcc[_0x2865('0x3a')][_0x2865('0x47')]?_0x4f8bcc[_0x2865('0x3a')]:_0x25d927[_0x2865('0x36')];if(_0x13fccf[_0x2865('0x37')][_0x2865('0x48')]){_0x4f8bcc['include']=[{'all':!![]}];}_0x4f8bcc=_['merge']({},_0x4f8bcc,_0x13fccf[_0x2865('0x42')]);return db[_0x2865('0x31')][_0x2865('0x49')](_0x4f8bcc)[_0x2865('0x28')](handleEntityNotFound(_0x4dd01b,null))[_0x2865('0x28')](respondWithResult(_0x4dd01b,null))[_0x2865('0x4a')](handleError(_0x4dd01b,null));};exports[_0x2865('0x4b')]=function(_0x45ff41,_0x1f8800){return db[_0x2865('0x31')][_0x2865('0x4b')](_0x45ff41[_0x2865('0x4c')],{})[_0x2865('0x28')](function(_0x3c438b){var _0x24204d=_0x45ff41[_0x2865('0x4d')][_0x2865('0x29')]({'plain':!![]});if(!_0x24204d)throw new Error(_0x2865('0x4e'));if(_0x24204d[_0x2865('0x4f')]===_0x2865('0x4d')){var _0x5d6b5e=_0x3c438b['get']({'plain':!![]});var _0x349d14=_0x2865('0x2a');return db[_0x2865('0x50')][_0x2865('0x49')]({'where':{'name':_0x349d14,'userProfileId':_0x24204d[_0x2865('0x51')]},'raw':!![]})[_0x2865('0x28')](function(_0x29f763){if(_0x29f763&&_0x29f763[_0x2865('0x52')]===0x0){return db[_0x2865('0x53')][_0x2865('0x4b')]({'name':_0x5d6b5e['name'],'resourceId':_0x5d6b5e['id'],'type':_0x29f763[_0x2865('0x2e')],'sectionId':_0x29f763['id']},{})['then'](function(){return _0x3c438b;});}else{return _0x3c438b;}})[_0x2865('0x4a')](function(_0x4e56a3){logger[_0x2865('0x2c')](_0x2865('0x54'),_0x4e56a3);throw _0x4e56a3;});}return _0x3c438b;})[_0x2865('0x28')](respondWithResult(_0x1f8800,0xc9))[_0x2865('0x4a')](handleError(_0x1f8800,null));};exports[_0x2865('0x27')]=function(_0x2f77e1,_0x12ed65){if(_0x2f77e1['body']['id']){delete _0x2f77e1['body']['id'];}return db[_0x2865('0x31')]['find']({'where':{'id':_0x2f77e1[_0x2865('0x45')]['id']}})['then'](handleEntityNotFound(_0x12ed65,null))['then'](saveUpdates(_0x2f77e1[_0x2865('0x4c')],null))['then'](respondWithResult(_0x12ed65,null))[_0x2865('0x4a')](handleError(_0x12ed65,null));};exports[_0x2865('0x2b')]=function(_0x5d02bc,_0x505258){return db[_0x2865('0x31')][_0x2865('0x49')]({'where':{'id':_0x5d02bc['params']['id']}})[_0x2865('0x28')](handleEntityNotFound(_0x505258,null))['then'](removeEntity(_0x505258,null))[_0x2865('0x4a')](handleError(_0x505258,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index ac5171e..c52faf0 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 _0x95b8=['rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x12c323,_0x596cd2){var _0x2289ae=function(_0x3e255a){while(--_0x3e255a){_0x12c323['push'](_0x12c323['shift']());}};_0x2289ae(++_0x596cd2);}(_0x95b8,0x192));var _0x895b=function(_0x189a67,_0x374595){_0x189a67=_0x189a67-0x0;var _0x3b9184=_0x95b8[_0x189a67];return _0x3b9184;};'use strict';var _=require(_0x895b('0x0'));var util=require(_0x895b('0x1'));var logger=require(_0x895b('0x2'))('api');var moment=require(_0x895b('0x3'));var BPromise=require(_0x895b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x895b('0x5'));var rimraf=require(_0x895b('0x6'));var config=require(_0x895b('0x7'));var attributes=require(_0x895b('0x8'));module['exports']=function(_0x4fa4f3,_0x4062c0){return _0x4fa4f3[_0x895b('0x9')](_0x895b('0xa'),attributes,{'tableName':_0x895b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73db=['path','rimraf','../../config/environment','define','Template','tools_templates','lodash','util','moment','request-promise'];(function(_0x260cf8,_0x1e8444){var _0x3b3549=function(_0x2f5a13){while(--_0x2f5a13){_0x260cf8['push'](_0x260cf8['shift']());}};_0x3b3549(++_0x1e8444);}(_0x73db,0x1c8));var _0xb73d=function(_0x18c1d6,_0x50b09c){_0x18c1d6=_0x18c1d6-0x0;var _0x5f225e=_0x73db[_0x18c1d6];return _0x5f225e;};'use strict';var _=require(_0xb73d('0x0'));var util=require(_0xb73d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb73d('0x2'));var BPromise=require('bluebird');var rp=require(_0xb73d('0x3'));var fs=require('fs');var path=require(_0xb73d('0x4'));var rimraf=require(_0xb73d('0x5'));var config=require(_0xb73d('0x6'));var attributes=require('./template.attributes');module['exports']=function(_0x3c6099,_0x729d19){return _0x3c6099[_0xb73d('0x7')](_0xb73d('0x8'),attributes,{'tableName':_0xb73d('0x9'),'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 1280ef2..d050a64 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 _0xe4a3=['../../config/environment','jayson/promise','client','request','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2b271b,_0x47ab63){var _0x464860=function(_0x367fad){while(--_0x367fad){_0x2b271b['push'](_0x2b271b['shift']());}};_0x464860(++_0x47ab63);}(_0xe4a3,0x164));var _0x3e4a=function(_0x1e8f0c,_0x40e34a){_0x1e8f0c=_0x1e8f0c-0x0;var _0x2cdb1e=_0xe4a3[_0x1e8f0c];return _0x2cdb1e;};'use strict';var _=require(_0x3e4a('0x0'));var util=require(_0x3e4a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3e4a('0x2'));var fs=require('fs');var Redis=require(_0x3e4a('0x3'));var db=require(_0x3e4a('0x4'))['db'];var utils=require(_0x3e4a('0x5'));var logger=require(_0x3e4a('0x6'))('rpc');var config=require(_0x3e4a('0x7'));var jayson=require(_0x3e4a('0x8'));var client=jayson[_0x3e4a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x433c87,_0x257863,_0x2099ac){return new BPromise(function(_0x3ae2f8,_0x151c4e){return client[_0x3e4a('0xa')](_0x433c87,_0x2099ac)['then'](function(_0x177ade){logger['info'](_0x3e4a('0xb'),_0x257863,_0x3e4a('0xc'));logger[_0x3e4a('0xd')](_0x3e4a('0xe'),_0x257863,_0x3e4a('0xc'),JSON[_0x3e4a('0xf')](_0x177ade));if(_0x177ade[_0x3e4a('0x10')]){if(_0x177ade[_0x3e4a('0x10')][_0x3e4a('0x11')]===0x1f4){logger[_0x3e4a('0x10')](_0x3e4a('0xb'),_0x257863,_0x177ade[_0x3e4a('0x10')]['message']);return _0x151c4e(_0x177ade[_0x3e4a('0x10')][_0x3e4a('0x12')]);}logger[_0x3e4a('0x10')](_0x3e4a('0xb'),_0x257863,_0x177ade[_0x3e4a('0x10')][_0x3e4a('0x12')]);return _0x3ae2f8(_0x177ade[_0x3e4a('0x10')][_0x3e4a('0x12')]);}else{logger[_0x3e4a('0x13')](_0x3e4a('0xb'),_0x257863,_0x3e4a('0xc'));_0x3ae2f8(_0x177ade[_0x3e4a('0x14')][_0x3e4a('0x12')]);}})[_0x3e4a('0x15')](function(_0x2c1ea1){logger[_0x3e4a('0x10')]('Template,\x20%s,\x20%s',_0x257863,_0x2c1ea1);_0x151c4e(_0x2c1ea1);});});}exports[_0x3e4a('0x16')]=function(_0x35c31a){var _0x469df4=this;return new Promise(function(_0xd31d02,_0x32cc1b){return db[_0x3e4a('0x17')]['findAll']({'raw':_0x35c31a['options']?_0x35c31a[_0x3e4a('0x18')][_0x3e4a('0x19')]===undefined?!![]:![]:!![],'where':_0x35c31a[_0x3e4a('0x18')]?_0x35c31a[_0x3e4a('0x18')][_0x3e4a('0x1a')]||null:null,'attributes':_0x35c31a['options']?_0x35c31a[_0x3e4a('0x18')][_0x3e4a('0x1b')]||null:null,'limit':_0x35c31a[_0x3e4a('0x18')]?_0x35c31a[_0x3e4a('0x18')][_0x3e4a('0x1c')]||null:null,'include':_0x35c31a[_0x3e4a('0x18')]?_0x35c31a[_0x3e4a('0x18')][_0x3e4a('0x1d')]?_['map'](_0x35c31a[_0x3e4a('0x18')][_0x3e4a('0x1d')],function(_0x27c488){return{'model':db[_0x27c488['model']],'as':_0x27c488['as'],'attributes':_0x27c488[_0x3e4a('0x1b')],'include':_0x27c488[_0x3e4a('0x1d')]?_['map'](_0x27c488[_0x3e4a('0x1d')],function(_0x244c6a){return{'model':db[_0x244c6a['model']],'as':_0x244c6a['as'],'attributes':_0x244c6a[_0x3e4a('0x1b')],'include':_0x244c6a[_0x3e4a('0x1d')]?_[_0x3e4a('0x1e')](_0x244c6a[_0x3e4a('0x1d')],function(_0x217b8a){return{'model':db[_0x217b8a[_0x3e4a('0x1f')]],'as':_0x217b8a['as'],'attributes':_0x217b8a[_0x3e4a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3e4a('0x20')](function(_0x52d5e6){logger[_0x3e4a('0x13')](_0x3e4a('0x16'),_0x35c31a);logger[_0x3e4a('0xd')](_0x3e4a('0x16'),_0x35c31a,JSON[_0x3e4a('0xf')](_0x52d5e6));_0xd31d02(_0x52d5e6);})[_0x3e4a('0x15')](function(_0x3f3915){logger['error']('GetTemplate',_0x3f3915[_0x3e4a('0x12')],_0x35c31a);_0x32cc1b(_0x469df4[_0x3e4a('0x10')](0x1f4,_0x3f3915[_0x3e4a('0x12')]));});});}; \ No newline at end of file +var _0x94bf=['then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Template','findAll','options','raw','where','include','map','model','attributes','GetTemplate','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x216897,_0x5890a8){var _0x5a67a0=function(_0x51a77f){while(--_0x51a77f){_0x216897['push'](_0x216897['shift']());}};_0x5a67a0(++_0x5890a8);}(_0x94bf,0x1c2));var _0xf94b=function(_0x15f62e,_0x571c2a){_0x15f62e=_0x15f62e-0x0;var _0x56183a=_0x94bf[_0x15f62e];return _0x56183a;};'use strict';var _=require('lodash');var util=require(_0xf94b('0x0'));var moment=require('moment');var BPromise=require(_0xf94b('0x1'));var rs=require(_0xf94b('0x2'));var fs=require('fs');var Redis=require(_0xf94b('0x3'));var db=require(_0xf94b('0x4'))['db'];var utils=require(_0xf94b('0x5'));var logger=require(_0xf94b('0x6'))(_0xf94b('0x7'));var config=require(_0xf94b('0x8'));var jayson=require(_0xf94b('0x9'));var client=jayson['client'][_0xf94b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9a8ae7,_0x13e671,_0x5643b6){return new BPromise(function(_0x5cb253,_0x3a4ad7){return client[_0xf94b('0xb')](_0x9a8ae7,_0x5643b6)[_0xf94b('0xc')](function(_0x5afaa3){logger[_0xf94b('0xd')](_0xf94b('0xe'),_0x13e671,_0xf94b('0xf'));logger[_0xf94b('0x10')](_0xf94b('0x11'),_0x13e671,'request\x20sent',JSON[_0xf94b('0x12')](_0x5afaa3));if(_0x5afaa3[_0xf94b('0x13')]){if(_0x5afaa3[_0xf94b('0x13')]['code']===0x1f4){logger[_0xf94b('0x13')](_0xf94b('0xe'),_0x13e671,_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);return _0x3a4ad7(_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);}logger[_0xf94b('0x13')]('Template,\x20%s,\x20%s',_0x13e671,_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);return _0x5cb253(_0x5afaa3[_0xf94b('0x13')][_0xf94b('0x14')]);}else{logger[_0xf94b('0xd')](_0xf94b('0xe'),_0x13e671,_0xf94b('0xf'));_0x5cb253(_0x5afaa3[_0xf94b('0x15')][_0xf94b('0x14')]);}})[_0xf94b('0x16')](function(_0xe5a61b){logger['error'](_0xf94b('0xe'),_0x13e671,_0xe5a61b);_0x3a4ad7(_0xe5a61b);});});}exports['GetTemplate']=function(_0x3b9306){var _0x4e1025=this;return new Promise(function(_0x340097,_0x271597){return db[_0xf94b('0x17')][_0xf94b('0x18')]({'raw':_0x3b9306[_0xf94b('0x19')]?_0x3b9306[_0xf94b('0x19')][_0xf94b('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b9306[_0xf94b('0x19')]?_0x3b9306[_0xf94b('0x19')][_0xf94b('0x1b')]||null:null,'attributes':_0x3b9306['options']?_0x3b9306[_0xf94b('0x19')]['attributes']||null:null,'limit':_0x3b9306[_0xf94b('0x19')]?_0x3b9306['options']['limit']||null:null,'include':_0x3b9306[_0xf94b('0x19')]?_0x3b9306[_0xf94b('0x19')][_0xf94b('0x1c')]?_[_0xf94b('0x1d')](_0x3b9306['options'][_0xf94b('0x1c')],function(_0x510fee){return{'model':db[_0x510fee[_0xf94b('0x1e')]],'as':_0x510fee['as'],'attributes':_0x510fee[_0xf94b('0x1f')],'include':_0x510fee[_0xf94b('0x1c')]?_[_0xf94b('0x1d')](_0x510fee['include'],function(_0x4d804f){return{'model':db[_0x4d804f[_0xf94b('0x1e')]],'as':_0x4d804f['as'],'attributes':_0x4d804f['attributes'],'include':_0x4d804f[_0xf94b('0x1c')]?_[_0xf94b('0x1d')](_0x4d804f[_0xf94b('0x1c')],function(_0x272451){return{'model':db[_0x272451[_0xf94b('0x1e')]],'as':_0x272451['as'],'attributes':_0x272451['attributes']};}):[]};}):[]};}):[]:[]})[_0xf94b('0xc')](function(_0x15073b){logger['info'](_0xf94b('0x20'),_0x3b9306);logger['debug']('GetTemplate',_0x3b9306,JSON['stringify'](_0x15073b));_0x340097(_0x15073b);})[_0xf94b('0x16')](function(_0x52b80b){logger[_0xf94b('0x13')](_0xf94b('0x20'),_0x52b80b[_0xf94b('0x14')],_0x3b9306);_0x271597(_0x4e1025['error'](0x1f4,_0x52b80b[_0xf94b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index b8432f9..743fbcb 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 _0x0f19=['get','isAuthenticated','/:id','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','./trigger.controller'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0x0f19,0xf3));var _0x90f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f19[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x90f1('0x0'));var util=require(_0x90f1('0x1'));var path=require(_0x90f1('0x2'));var timeout=require('connect-timeout');var express=require(_0x90f1('0x3'));var router=express[_0x90f1('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x90f1('0x5'));var config=require('../../config/environment');var controller=require(_0x90f1('0x6'));router[_0x90f1('0x7')]('/',auth[_0x90f1('0x8')](),controller['index']);router['get'](_0x90f1('0x9'),auth['isAuthenticated'](),controller[_0x90f1('0xa')]);router['get'](_0x90f1('0xb'),auth[_0x90f1('0x8')](),controller['getAllConditions']);router[_0x90f1('0x7')](_0x90f1('0xc'),auth['isAuthenticated'](),controller[_0x90f1('0xd')]);router[_0x90f1('0x7')](_0x90f1('0xe'),auth[_0x90f1('0x8')](),controller[_0x90f1('0xf')]);router[_0x90f1('0x10')]('/',auth[_0x90f1('0x8')](),controller[_0x90f1('0x11')]);router[_0x90f1('0x10')]('/:id/all_conditions',auth[_0x90f1('0x8')](),controller[_0x90f1('0x12')]);router['post']('/:id/any_conditions',auth[_0x90f1('0x8')](),controller[_0x90f1('0x13')]);router[_0x90f1('0x10')]('/:id/actions',auth[_0x90f1('0x8')](),controller[_0x90f1('0x14')]);router[_0x90f1('0x15')](_0x90f1('0x9'),auth['isAuthenticated'](),controller[_0x90f1('0x16')]);router[_0x90f1('0x17')](_0x90f1('0x9'),auth[_0x90f1('0x8')](),controller['destroy']);module[_0x90f1('0x18')]=router; \ No newline at end of file +var _0x134d=['getAnyConditions','/:id/actions','getActions','create','post','addAllCondition','/:id/any_conditions','addAction','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','index','get','isAuthenticated','/:id/all_conditions','getAllConditions'];(function(_0xb8f65,_0x5b3d4f){var _0x537221=function(_0x157d70){while(--_0x157d70){_0xb8f65['push'](_0xb8f65['shift']());}};_0x537221(++_0x5b3d4f);}(_0x134d,0x16c));var _0xd134=function(_0x35f1f9,_0x18d87e){_0x35f1f9=_0x35f1f9-0x0;var _0x33eb78=_0x134d[_0x35f1f9];return _0x33eb78;};'use strict';var multer=require(_0xd134('0x0'));var util=require(_0xd134('0x1'));var path=require('path');var timeout=require(_0xd134('0x2'));var express=require(_0xd134('0x3'));var router=express[_0xd134('0x4')]();var fs_extra=require(_0xd134('0x5'));var auth=require(_0xd134('0x6'));var interaction=require(_0xd134('0x7'));var config=require('../../config/environment');var controller=require(_0xd134('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd134('0x9')]);router[_0xd134('0xa')]('/:id',auth[_0xd134('0xb')](),controller['show']);router[_0xd134('0xa')](_0xd134('0xc'),auth[_0xd134('0xb')](),controller[_0xd134('0xd')]);router[_0xd134('0xa')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xd134('0xe')]);router[_0xd134('0xa')](_0xd134('0xf'),auth[_0xd134('0xb')](),controller[_0xd134('0x10')]);router['post']('/',auth[_0xd134('0xb')](),controller[_0xd134('0x11')]);router[_0xd134('0x12')](_0xd134('0xc'),auth[_0xd134('0xb')](),controller[_0xd134('0x13')]);router['post'](_0xd134('0x14'),auth[_0xd134('0xb')](),controller['addAnyCondition']);router[_0xd134('0x12')](_0xd134('0xf'),auth[_0xd134('0xb')](),controller[_0xd134('0x15')]);router[_0xd134('0x16')](_0xd134('0x17'),auth[_0xd134('0xb')](),controller[_0xd134('0x18')]);router[_0xd134('0x19')](_0xd134('0x17'),auth[_0xd134('0xb')](),controller[_0xd134('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index d5d17ab..35d54b3 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 _0xfca4=['sequelize','exports','STRING'];(function(_0x5326df,_0x4babd6){var _0x6a86fd=function(_0x53f53c){while(--_0x53f53c){_0x5326df['push'](_0x5326df['shift']());}};_0x6a86fd(++_0x4babd6);}(_0xfca4,0x12c));var _0x4fca=function(_0x489a55,_0x1f5395){_0x489a55=_0x489a55-0x0;var _0x5beb03=_0xfca4[_0x489a55];return _0x5beb03;};'use strict';var Sequelize=require(_0x4fca('0x0'));module[_0x4fca('0x1')]={'name':{'type':Sequelize[_0x4fca('0x2')]},'channel':{'type':Sequelize[_0x4fca('0x2')]},'description':{'type':Sequelize[_0x4fca('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe83c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x1aadeb,_0x56ed5b){var _0x1a9070=function(_0x301bdb){while(--_0x301bdb){_0x1aadeb['push'](_0x1aadeb['shift']());}};_0x1a9070(++_0x56ed5b);}(_0xe83c,0x1a6));var _0xce83=function(_0x5154a6,_0x428f5a){_0x5154a6=_0x5154a6-0x0;var _0x3c8400=_0xe83c[_0x5154a6];return _0x3c8400;};'use strict';var Sequelize=require(_0xce83('0x0'));module[_0xce83('0x1')]={'name':{'type':Sequelize[_0xce83('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xce83('0x2')]},'status':{'type':Sequelize[_0xce83('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 081be44..6708eba 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 _0x7288=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','rows','show','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x272282,_0x2e94a0){var _0xedf511=function(_0x5d1ab6){while(--_0x5d1ab6){_0x272282['push'](_0x272282['shift']());}};_0xedf511(++_0x2e94a0);}(_0x7288,0x105));var _0x8728=function(_0x4d822b,_0x39bbf8){_0x4d822b=_0x4d822b-0x0;var _0x5aab20=_0x7288[_0x4d822b];return _0x5aab20;};'use strict';var emlformat=require(_0x8728('0x0'));var rimraf=require(_0x8728('0x1'));var zipdir=require(_0x8728('0x2'));var jsonpatch=require(_0x8728('0x3'));var rp=require(_0x8728('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8728('0x5'));var util=require('util');var path=require(_0x8728('0x6'));var sox=require(_0x8728('0x7'));var csv=require('to-csv');var ejs=require(_0x8728('0x8'));var fs=require('fs');var fs_extra=require(_0x8728('0x9'));var _=require(_0x8728('0xa'));var squel=require(_0x8728('0xb'));var crypto=require(_0x8728('0xc'));var jsforce=require(_0x8728('0xd'));var deskjs=require(_0x8728('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8728('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8728('0x10'));var hardwareService=require(_0x8728('0x11'));var logger=require(_0x8728('0x12'))(_0x8728('0x13'));var utils=require(_0x8728('0x14'));var config=require(_0x8728('0x15'));var licenseUtil=require(_0x8728('0x16'));var db=require(_0x8728('0x17'))['db'];function respondWithStatusCode(_0x52b24d,_0x106a18){_0x106a18=_0x106a18||0xcc;return function(_0x4f4c8d){if(_0x4f4c8d){return _0x52b24d[_0x8728('0x18')](_0x106a18);}return _0x52b24d[_0x8728('0x19')](_0x106a18)[_0x8728('0x1a')]();};}function respondWithResult(_0x893e17,_0x24cd6e){_0x24cd6e=_0x24cd6e||0xc8;return function(_0x4d98ee){if(_0x4d98ee){return _0x893e17[_0x8728('0x19')](_0x24cd6e)[_0x8728('0x1b')](_0x4d98ee);}};}function respondWithFilteredResult(_0x591b77,_0x1717a1){return function(_0x28bfc1){if(_0x28bfc1){var _0x52caf3=typeof _0x1717a1['offset']===_0x8728('0x1c')&&typeof _0x1717a1[_0x8728('0x1d')]==='undefined';var _0x313f4e=_0x28bfc1[_0x8728('0x1e')];var _0x2f3793=_0x52caf3?0x0:_0x1717a1[_0x8728('0x1f')];var _0x53eb25=_0x52caf3?_0x28bfc1[_0x8728('0x1e')]:_0x1717a1[_0x8728('0x1f')]+_0x1717a1[_0x8728('0x1d')];var _0x3cbe15;if(_0x53eb25>=_0x313f4e){_0x53eb25=_0x313f4e;_0x3cbe15=0xc8;}else{_0x3cbe15=0xce;}_0x591b77[_0x8728('0x19')](_0x3cbe15);return _0x591b77[_0x8728('0x20')](_0x8728('0x21'),_0x2f3793+'-'+_0x53eb25+'/'+_0x313f4e)[_0x8728('0x1b')](_0x28bfc1);}return null;};}function patchUpdates(_0x1eaf73){return function(_0x475af8){try{jsonpatch[_0x8728('0x22')](_0x475af8,_0x1eaf73,!![]);}catch(_0x4aa0f8){return BPromise[_0x8728('0x23')](_0x4aa0f8);}return _0x475af8[_0x8728('0x24')]();};}function saveUpdates(_0x597260,_0x30e94d){return function(_0x1ed039){if(_0x1ed039){return _0x1ed039[_0x8728('0x25')](_0x597260)['then'](function(_0x25bb06){return _0x25bb06;});}return null;};}function removeEntity(_0x21364a,_0x1c27f3){return function(_0xa22c1e){if(_0xa22c1e){return _0xa22c1e[_0x8728('0x26')]()['then'](function(){var _0x239d13=_0xa22c1e[_0x8728('0x27')]({'plain':!![]});var _0x1b0b61='Triggers';return db[_0x8728('0x28')][_0x8728('0x26')]({'where':{'type':_0x1b0b61,'resourceId':_0x239d13['id']}})['then'](function(){return _0xa22c1e;});})['then'](function(){_0x21364a['status'](0xcc)[_0x8728('0x1a')]();});}};}function handleEntityNotFound(_0x437db7,_0x3133e8){return function(_0xc855a9){if(!_0xc855a9){_0x437db7[_0x8728('0x18')](0x194);}return _0xc855a9;};}function handleError(_0x1924ca,_0x186574){_0x186574=_0x186574||0x1f4;return function(_0x4f0bb8){logger[_0x8728('0x29')](_0x4f0bb8[_0x8728('0x2a')]);if(_0x4f0bb8['name']){delete _0x4f0bb8[_0x8728('0x2b')];}_0x1924ca[_0x8728('0x19')](_0x186574)[_0x8728('0x2c')](_0x4f0bb8);};}exports[_0x8728('0x2d')]=function(_0x542b96,_0x1d4520){var _0x385d4e={},_0x5cb3f7={},_0xa8bd91={'count':0x0,'rows':[]};var _0x4523d5=_[_0x8728('0x2e')](db[_0x8728('0x2f')][_0x8728('0x30')],function(_0x8a6213){return{'name':_0x8a6213[_0x8728('0x31')],'type':_0x8a6213[_0x8728('0x32')][_0x8728('0x33')]};});_0x5cb3f7[_0x8728('0x34')]=_['map'](_0x4523d5,_0x8728('0x2b'));_0x5cb3f7[_0x8728('0x35')]=_[_0x8728('0x36')](_0x542b96[_0x8728('0x35')]);_0x5cb3f7[_0x8728('0x37')]=_[_0x8728('0x38')](_0x5cb3f7[_0x8728('0x34')],_0x5cb3f7[_0x8728('0x35')]);_0x385d4e['attributes']=_[_0x8728('0x38')](_0x5cb3f7[_0x8728('0x34')],qs['fields'](_0x542b96[_0x8728('0x35')][_0x8728('0x39')]));_0x385d4e[_0x8728('0x3a')]=_0x385d4e[_0x8728('0x3a')][_0x8728('0x3b')]?_0x385d4e['attributes']:_0x5cb3f7[_0x8728('0x34')];if(!_0x542b96[_0x8728('0x35')][_0x8728('0x3c')](_0x8728('0x3d'))){_0x385d4e[_0x8728('0x1d')]=qs['limit'](_0x542b96['query'][_0x8728('0x1d')]);_0x385d4e['offset']=qs[_0x8728('0x1f')](_0x542b96[_0x8728('0x35')][_0x8728('0x1f')]);}_0x385d4e[_0x8728('0x3e')]=qs[_0x8728('0x3f')](_0x542b96[_0x8728('0x35')][_0x8728('0x3f')]);_0x385d4e[_0x8728('0x40')]=qs[_0x8728('0x37')](_[_0x8728('0x41')](_0x542b96[_0x8728('0x35')],_0x5cb3f7['filters']),_0x4523d5);if(_0x542b96[_0x8728('0x35')][_0x8728('0x42')]){_0x385d4e[_0x8728('0x40')]=_[_0x8728('0x43')](_0x385d4e[_0x8728('0x40')],{'$or':_['map'](_0x4523d5,function(_0x2334d4){if(_0x2334d4[_0x8728('0x32')]!==_0x8728('0x44')){var _0x2ae2eb={};_0x2ae2eb[_0x2334d4[_0x8728('0x2b')]]={'$like':'%'+_0x542b96[_0x8728('0x35')]['filter']+'%'};return _0x2ae2eb;}})});}_0x385d4e=_[_0x8728('0x43')]({},_0x385d4e,_0x542b96['options']);var _0x2e7ba0={'where':_0x385d4e[_0x8728('0x40')]};return db[_0x8728('0x2f')][_0x8728('0x1e')](_0x2e7ba0)[_0x8728('0x45')](function(_0xc9ec0e){_0xa8bd91['count']=_0xc9ec0e;if(_0x542b96[_0x8728('0x35')][_0x8728('0x46')]){_0x385d4e['include']=[{'all':!![]}];}return db[_0x8728('0x2f')]['findAll'](_0x385d4e);})[_0x8728('0x45')](function(_0x589169){_0xa8bd91[_0x8728('0x47')]=_0x589169;return _0xa8bd91;})[_0x8728('0x45')](respondWithFilteredResult(_0x1d4520,_0x385d4e))['catch'](handleError(_0x1d4520,null));};exports[_0x8728('0x48')]=function(_0x2d829c,_0x1a2a3b){var _0x2de5b2={'raw':![],'where':{'id':_0x2d829c['params']['id']}},_0x236196={};_0x236196[_0x8728('0x34')]=_['keys'](db[_0x8728('0x2f')][_0x8728('0x30')]);_0x236196[_0x8728('0x35')]=_[_0x8728('0x36')](_0x2d829c['query']);_0x236196[_0x8728('0x37')]=_[_0x8728('0x38')](_0x236196[_0x8728('0x34')],_0x236196[_0x8728('0x35')]);_0x2de5b2[_0x8728('0x3a')]=_[_0x8728('0x38')](_0x236196[_0x8728('0x34')],qs[_0x8728('0x39')](_0x2d829c['query'][_0x8728('0x39')]));_0x2de5b2[_0x8728('0x3a')]=_0x2de5b2[_0x8728('0x3a')][_0x8728('0x3b')]?_0x2de5b2[_0x8728('0x3a')]:_0x236196['model'];if(_0x2d829c[_0x8728('0x35')]['includeAll']){_0x2de5b2[_0x8728('0x49')]=[{'all':!![]}];}_0x2de5b2=_['merge']({},_0x2de5b2,_0x2d829c[_0x8728('0x4a')]);return db[_0x8728('0x2f')][_0x8728('0x4b')](_0x2de5b2)[_0x8728('0x45')](handleEntityNotFound(_0x1a2a3b,null))['then'](respondWithResult(_0x1a2a3b,null))['catch'](handleError(_0x1a2a3b,null));};exports[_0x8728('0x4c')]=function(_0x4c8e7e,_0x186135){return db[_0x8728('0x2f')]['create'](_0x4c8e7e[_0x8728('0x4d')],{})[_0x8728('0x45')](function(_0x1a8dce){var _0x5c80d3=_0x4c8e7e[_0x8728('0x4e')][_0x8728('0x27')]({'plain':!![]});if(!_0x5c80d3)throw new Error(_0x8728('0x4f'));if(_0x5c80d3[_0x8728('0x50')]===_0x8728('0x4e')){var _0x4ab0f1=_0x1a8dce[_0x8728('0x27')]({'plain':!![]});var _0x112fd3='Triggers';return db[_0x8728('0x51')]['find']({'where':{'name':_0x112fd3,'userProfileId':_0x5c80d3[_0x8728('0x52')]},'raw':!![]})[_0x8728('0x45')](function(_0x9e384a){if(_0x9e384a&&_0x9e384a[_0x8728('0x53')]===0x0){return db[_0x8728('0x28')][_0x8728('0x4c')]({'name':_0x4ab0f1[_0x8728('0x2b')],'resourceId':_0x4ab0f1['id'],'type':_0x9e384a[_0x8728('0x2b')],'sectionId':_0x9e384a['id']},{})[_0x8728('0x45')](function(){return _0x1a8dce;});}else{return _0x1a8dce;}})[_0x8728('0x54')](function(_0x2c641e){logger[_0x8728('0x29')](_0x8728('0x55'),_0x2c641e);throw _0x2c641e;});}return _0x1a8dce;})['then'](respondWithResult(_0x186135,0xc9))[_0x8728('0x54')](handleError(_0x186135,null));};exports[_0x8728('0x25')]=function(_0x5911d6,_0x1ca1b7){if(_0x5911d6[_0x8728('0x4d')]['id']){delete _0x5911d6[_0x8728('0x4d')]['id'];}return db[_0x8728('0x2f')][_0x8728('0x4b')]({'where':{'id':_0x5911d6[_0x8728('0x56')]['id']}})['then'](handleEntityNotFound(_0x1ca1b7,null))[_0x8728('0x45')](saveUpdates(_0x5911d6['body'],null))['then'](respondWithResult(_0x1ca1b7,null))[_0x8728('0x54')](handleError(_0x1ca1b7,null));};exports[_0x8728('0x26')]=function(_0x478f09,_0x2afc54){return db[_0x8728('0x2f')]['find']({'where':{'id':_0x478f09['params']['id']}})[_0x8728('0x45')](handleEntityNotFound(_0x2afc54,null))[_0x8728('0x45')](removeEntity(_0x2afc54,null))[_0x8728('0x54')](handleError(_0x2afc54,null));};exports[_0x8728('0x57')]=function(_0x1a4656,_0x47bbd7,_0x4b477f){if(_0x1a4656[_0x8728('0x4d')]['id']){delete _0x1a4656[_0x8728('0x4d')]['id'];}return db[_0x8728('0x2f')][_0x8728('0x4b')]({'where':{'id':_0x1a4656[_0x8728('0x56')]['id']}})[_0x8728('0x45')](handleEntityNotFound(_0x47bbd7,null))[_0x8728('0x45')](function(_0xf24876){if(_0xf24876){_0x1a4656[_0x8728('0x4d')]['TriggerAllId']=_0xf24876['id'];return db[_0x8728('0x58')]['create'](_0x1a4656[_0x8728('0x4d')]);}})['then'](respondWithResult(_0x47bbd7,null))[_0x8728('0x54')](handleError(_0x47bbd7,null));};exports[_0x8728('0x59')]=function(_0x1d0736,_0x188c68,_0x5e25e7){if(_0x1d0736[_0x8728('0x4d')]['id']){delete _0x1d0736['body']['id'];}return db[_0x8728('0x2f')][_0x8728('0x4b')]({'where':{'id':_0x1d0736['params']['id']}})[_0x8728('0x45')](handleEntityNotFound(_0x188c68,null))['then'](function(_0xa29696){if(_0xa29696){_0x1d0736[_0x8728('0x4d')][_0x8728('0x5a')]=_0xa29696['id'];return db['Condition']['create'](_0x1d0736['body']);}})[_0x8728('0x45')](respondWithResult(_0x188c68,null))[_0x8728('0x54')](handleError(_0x188c68,null));};exports[_0x8728('0x5b')]=function(_0x345ade,_0x25bb37,_0x6ddb28){var _0x4a4621={};var _0x55a325={};var _0x3af0ea;var _0x30400a;return db[_0x8728('0x2f')]['findOne']({'where':{'id':_0x345ade[_0x8728('0x56')]['id']}})[_0x8728('0x45')](handleEntityNotFound(_0x25bb37,null))[_0x8728('0x45')](function(_0x546cfb){if(_0x546cfb){_0x3af0ea=_0x546cfb;_0x55a325['model']=_[_0x8728('0x36')](db['Condition'][_0x8728('0x30')]);_0x55a325[_0x8728('0x35')]=_[_0x8728('0x36')](_0x345ade[_0x8728('0x35')]);_0x55a325[_0x8728('0x37')]=_['intersection'](_0x55a325[_0x8728('0x34')],_0x55a325[_0x8728('0x35')]);_0x4a4621['attributes']=_[_0x8728('0x38')](_0x55a325['model'],qs[_0x8728('0x39')](_0x345ade[_0x8728('0x35')][_0x8728('0x39')]));_0x4a4621[_0x8728('0x3a')]=_0x4a4621['attributes'][_0x8728('0x3b')]?_0x4a4621[_0x8728('0x3a')]:_0x55a325[_0x8728('0x34')];_0x4a4621[_0x8728('0x3e')]=qs[_0x8728('0x3f')](_0x345ade['query'][_0x8728('0x3f')]);_0x4a4621[_0x8728('0x40')]=qs['filters'](_[_0x8728('0x41')](_0x345ade[_0x8728('0x35')],_0x55a325[_0x8728('0x37')]));if(_0x345ade[_0x8728('0x35')][_0x8728('0x42')]){_0x4a4621[_0x8728('0x40')]=_[_0x8728('0x43')](_0x4a4621[_0x8728('0x40')],{'$or':_[_0x8728('0x2e')](_0x4a4621[_0x8728('0x3a')],function(_0x58b9a7){var _0x27cc9b={};_0x27cc9b[_0x58b9a7]={'$like':'%'+_0x345ade[_0x8728('0x35')][_0x8728('0x42')]+'%'};return _0x27cc9b;})});}_0x4a4621=_[_0x8728('0x43')]({},_0x4a4621,_0x345ade[_0x8728('0x4a')]);return _0x3af0ea['getAllConditions'](_0x4a4621);}})[_0x8728('0x45')](function(_0x3cc8e0){if(_0x3cc8e0){_0x30400a=_0x3cc8e0['length'];if(!_0x345ade[_0x8728('0x35')][_0x8728('0x3c')](_0x8728('0x3d'))){_0x4a4621['limit']=qs['limit'](_0x345ade[_0x8728('0x35')]['limit']);_0x4a4621[_0x8728('0x1f')]=qs[_0x8728('0x1f')](_0x345ade[_0x8728('0x35')][_0x8728('0x1f')]);}return _0x3af0ea[_0x8728('0x5b')](_0x4a4621);}})[_0x8728('0x45')](function(_0x5094e9){if(_0x5094e9){return _0x5094e9?{'count':_0x30400a,'rows':_0x5094e9}:null;}})[_0x8728('0x45')](respondWithResult(_0x25bb37,null))['catch'](handleError(_0x25bb37,null));};exports['getAnyConditions']=function(_0xebbb4e,_0x2aaae9,_0x49902c){var _0x413794={};var _0x56e1b4={};var _0x257304;var _0x136c82;return db[_0x8728('0x2f')][_0x8728('0x5c')]({'where':{'id':_0xebbb4e[_0x8728('0x56')]['id']}})[_0x8728('0x45')](handleEntityNotFound(_0x2aaae9,null))['then'](function(_0x38a11e){if(_0x38a11e){_0x257304=_0x38a11e;_0x56e1b4[_0x8728('0x34')]=_[_0x8728('0x36')](db[_0x8728('0x58')][_0x8728('0x30')]);_0x56e1b4[_0x8728('0x35')]=_[_0x8728('0x36')](_0xebbb4e[_0x8728('0x35')]);_0x56e1b4[_0x8728('0x37')]=_['intersection'](_0x56e1b4['model'],_0x56e1b4[_0x8728('0x35')]);_0x413794['attributes']=_[_0x8728('0x38')](_0x56e1b4[_0x8728('0x34')],qs['fields'](_0xebbb4e[_0x8728('0x35')][_0x8728('0x39')]));_0x413794[_0x8728('0x3a')]=_0x413794[_0x8728('0x3a')][_0x8728('0x3b')]?_0x413794[_0x8728('0x3a')]:_0x56e1b4[_0x8728('0x34')];_0x413794[_0x8728('0x3e')]=qs[_0x8728('0x3f')](_0xebbb4e[_0x8728('0x35')][_0x8728('0x3f')]);_0x413794['where']=qs[_0x8728('0x37')](_[_0x8728('0x41')](_0xebbb4e['query'],_0x56e1b4[_0x8728('0x37')]));if(_0xebbb4e[_0x8728('0x35')][_0x8728('0x42')]){_0x413794[_0x8728('0x40')]=_[_0x8728('0x43')](_0x413794['where'],{'$or':_['map'](_0x413794[_0x8728('0x3a')],function(_0x4c50d4){var _0x4a8b1f={};_0x4a8b1f[_0x4c50d4]={'$like':'%'+_0xebbb4e[_0x8728('0x35')][_0x8728('0x42')]+'%'};return _0x4a8b1f;})});}_0x413794=_['merge']({},_0x413794,_0xebbb4e[_0x8728('0x4a')]);return _0x257304['getAnyConditions'](_0x413794);}})[_0x8728('0x45')](function(_0x3bd947){if(_0x3bd947){_0x136c82=_0x3bd947[_0x8728('0x3b')];if(!_0xebbb4e[_0x8728('0x35')][_0x8728('0x3c')]('nolimit')){_0x413794[_0x8728('0x1d')]=qs[_0x8728('0x1d')](_0xebbb4e[_0x8728('0x35')][_0x8728('0x1d')]);_0x413794[_0x8728('0x1f')]=qs[_0x8728('0x1f')](_0xebbb4e[_0x8728('0x35')][_0x8728('0x1f')]);}return _0x257304['getAnyConditions'](_0x413794);}})['then'](function(_0x4685a1){if(_0x4685a1){return _0x4685a1?{'count':_0x136c82,'rows':_0x4685a1}:null;}})[_0x8728('0x45')](respondWithResult(_0x2aaae9,null))['catch'](handleError(_0x2aaae9,null));};exports['addAction']=function(_0x2e3ccb,_0x23aaa7,_0x142e7e){if(_0x2e3ccb['body']['id']){delete _0x2e3ccb[_0x8728('0x4d')]['id'];}return db[_0x8728('0x2f')][_0x8728('0x4b')]({'where':{'id':_0x2e3ccb['params']['id']}})[_0x8728('0x45')](handleEntityNotFound(_0x23aaa7,null))['then'](function(_0x3a95b9){if(_0x3a95b9){_0x2e3ccb[_0x8728('0x4d')][_0x8728('0x5d')]=_0x3a95b9['id'];return db[_0x8728('0x5e')][_0x8728('0x4c')](_0x2e3ccb['body']);}})[_0x8728('0x45')](respondWithResult(_0x23aaa7,null))[_0x8728('0x54')](handleError(_0x23aaa7,null));};exports[_0x8728('0x5f')]=function(_0x2e7e06,_0x32bea3,_0x1d9553){var _0x57860d={};var _0x114bdc={};var _0x2a70e6;var _0x4f178e;return db[_0x8728('0x2f')]['findOne']({'where':{'id':_0x2e7e06[_0x8728('0x56')]['id']}})['then'](handleEntityNotFound(_0x32bea3,null))[_0x8728('0x45')](function(_0x3aa132){if(_0x3aa132){_0x2a70e6=_0x3aa132;_0x114bdc['model']=_['keys'](db[_0x8728('0x5e')][_0x8728('0x30')]);_0x114bdc[_0x8728('0x35')]=_['keys'](_0x2e7e06['query']);_0x114bdc[_0x8728('0x37')]=_[_0x8728('0x38')](_0x114bdc['model'],_0x114bdc[_0x8728('0x35')]);_0x57860d[_0x8728('0x3a')]=_[_0x8728('0x38')](_0x114bdc['model'],qs['fields'](_0x2e7e06['query']['fields']));_0x57860d[_0x8728('0x3a')]=_0x57860d['attributes']['length']?_0x57860d[_0x8728('0x3a')]:_0x114bdc[_0x8728('0x34')];_0x57860d[_0x8728('0x3e')]=qs[_0x8728('0x3f')](_0x2e7e06[_0x8728('0x35')][_0x8728('0x3f')]);_0x57860d[_0x8728('0x40')]=qs[_0x8728('0x37')](_[_0x8728('0x41')](_0x2e7e06[_0x8728('0x35')],_0x114bdc[_0x8728('0x37')]));if(_0x2e7e06[_0x8728('0x35')][_0x8728('0x42')]){_0x57860d[_0x8728('0x40')]=_[_0x8728('0x43')](_0x57860d[_0x8728('0x40')],{'$or':_[_0x8728('0x2e')](_0x57860d['attributes'],function(_0xd99562){var _0x23fcd9={};_0x23fcd9[_0xd99562]={'$like':'%'+_0x2e7e06[_0x8728('0x35')][_0x8728('0x42')]+'%'};return _0x23fcd9;})});}_0x57860d=_[_0x8728('0x43')]({},_0x57860d,_0x2e7e06[_0x8728('0x4a')]);return _0x2a70e6[_0x8728('0x5f')](_0x57860d);}})[_0x8728('0x45')](function(_0x57c2ed){if(_0x57c2ed){_0x4f178e=_0x57c2ed[_0x8728('0x3b')];if(!_0x2e7e06['query']['hasOwnProperty'](_0x8728('0x3d'))){_0x57860d[_0x8728('0x1d')]=qs[_0x8728('0x1d')](_0x2e7e06[_0x8728('0x35')]['limit']);_0x57860d[_0x8728('0x1f')]=qs[_0x8728('0x1f')](_0x2e7e06[_0x8728('0x35')][_0x8728('0x1f')]);}return _0x2a70e6[_0x8728('0x5f')](_0x57860d);}})[_0x8728('0x45')](function(_0xd4f117){if(_0xd4f117){return _0xd4f117?{'count':_0x4f178e,'rows':_0xd4f117}:null;}})[_0x8728('0x45')](respondWithResult(_0x32bea3,null))[_0x8728('0x54')](handleError(_0x32bea3,null));}; \ No newline at end of file +var _0xf5ea=['count','offset','set','apply','reject','save','update','then','get','Triggers','destroy','end','error','stack','index','map','Trigger','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','getAnyConditions','findOne','Action','getActions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit'];(function(_0x138baf,_0x374f21){var _0x3b865f=function(_0x598dff){while(--_0x598dff){_0x138baf['push'](_0x138baf['shift']());}};_0x3b865f(++_0x374f21);}(_0xf5ea,0xfd));var _0xaf5e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf5ea[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaf5e('0x0'));var zipdir=require(_0xaf5e('0x1'));var jsonpatch=require(_0xaf5e('0x2'));var rp=require(_0xaf5e('0x3'));var moment=require(_0xaf5e('0x4'));var BPromise=require(_0xaf5e('0x5'));var Mustache=require(_0xaf5e('0x6'));var util=require(_0xaf5e('0x7'));var path=require('path');var sox=require(_0xaf5e('0x8'));var csv=require(_0xaf5e('0x9'));var ejs=require(_0xaf5e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaf5e('0xb'));var crypto=require('crypto');var jsforce=require(_0xaf5e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaf5e('0xd'));var Papa=require(_0xaf5e('0xe'));var Redis=require('ioredis');var authService=require(_0xaf5e('0xf'));var qs=require(_0xaf5e('0x10'));var as=require(_0xaf5e('0x11'));var hardwareService=require(_0xaf5e('0x12'));var logger=require(_0xaf5e('0x13'))(_0xaf5e('0x14'));var utils=require(_0xaf5e('0x15'));var config=require(_0xaf5e('0x16'));var licenseUtil=require(_0xaf5e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303ff8,_0x29be9a){_0x29be9a=_0x29be9a||0xcc;return function(_0x590bb9){if(_0x590bb9){return _0x303ff8[_0xaf5e('0x18')](_0x29be9a);}return _0x303ff8[_0xaf5e('0x19')](_0x29be9a)['end']();};}function respondWithResult(_0xd109d,_0x2a6296){_0x2a6296=_0x2a6296||0xc8;return function(_0x5c1f2e){if(_0x5c1f2e){return _0xd109d[_0xaf5e('0x19')](_0x2a6296)[_0xaf5e('0x1a')](_0x5c1f2e);}};}function respondWithFilteredResult(_0x1608ed,_0x21a299){return function(_0x17c567){if(_0x17c567){var _0x2ab65f=typeof _0x21a299['offset']===_0xaf5e('0x1b')&&typeof _0x21a299[_0xaf5e('0x1c')]===_0xaf5e('0x1b');var _0x1485ba=_0x17c567[_0xaf5e('0x1d')];var _0x227007=_0x2ab65f?0x0:_0x21a299[_0xaf5e('0x1e')];var _0x1633ea=_0x2ab65f?_0x17c567[_0xaf5e('0x1d')]:_0x21a299['offset']+_0x21a299[_0xaf5e('0x1c')];var _0x292e1d;if(_0x1633ea>=_0x1485ba){_0x1633ea=_0x1485ba;_0x292e1d=0xc8;}else{_0x292e1d=0xce;}_0x1608ed['status'](_0x292e1d);return _0x1608ed[_0xaf5e('0x1f')]('Content-Range',_0x227007+'-'+_0x1633ea+'/'+_0x1485ba)[_0xaf5e('0x1a')](_0x17c567);}return null;};}function patchUpdates(_0x4da47c){return function(_0x73e483){try{jsonpatch[_0xaf5e('0x20')](_0x73e483,_0x4da47c,!![]);}catch(_0x20b272){return BPromise[_0xaf5e('0x21')](_0x20b272);}return _0x73e483[_0xaf5e('0x22')]();};}function saveUpdates(_0x55eaf7,_0x18ea39){return function(_0x5f4c80){if(_0x5f4c80){return _0x5f4c80[_0xaf5e('0x23')](_0x55eaf7)[_0xaf5e('0x24')](function(_0x5d5710){return _0x5d5710;});}return null;};}function removeEntity(_0x37cbda,_0x1f36a3){return function(_0xb34ca7){if(_0xb34ca7){return _0xb34ca7['destroy']()['then'](function(){var _0xd2ba37=_0xb34ca7[_0xaf5e('0x25')]({'plain':!![]});var _0x37cd06=_0xaf5e('0x26');return db['UserProfileResource'][_0xaf5e('0x27')]({'where':{'type':_0x37cd06,'resourceId':_0xd2ba37['id']}})[_0xaf5e('0x24')](function(){return _0xb34ca7;});})[_0xaf5e('0x24')](function(){_0x37cbda['status'](0xcc)[_0xaf5e('0x28')]();});}};}function handleEntityNotFound(_0x131be6,_0x100632){return function(_0x3985c4){if(!_0x3985c4){_0x131be6[_0xaf5e('0x18')](0x194);}return _0x3985c4;};}function handleError(_0x1ae2b8,_0x1b12ac){_0x1b12ac=_0x1b12ac||0x1f4;return function(_0x474fe6){logger[_0xaf5e('0x29')](_0x474fe6[_0xaf5e('0x2a')]);if(_0x474fe6['name']){delete _0x474fe6['name'];}_0x1ae2b8['status'](_0x1b12ac)['send'](_0x474fe6);};}exports[_0xaf5e('0x2b')]=function(_0xc3a261,_0xf4983b){var _0x1abe90={},_0xced261={},_0x7fb6fa={'count':0x0,'rows':[]};var _0x26cf2e=_[_0xaf5e('0x2c')](db[_0xaf5e('0x2d')][_0xaf5e('0x2e')],function(_0x53f14b){return{'name':_0x53f14b['fieldName'],'type':_0x53f14b[_0xaf5e('0x2f')][_0xaf5e('0x30')]};});_0xced261[_0xaf5e('0x31')]=_[_0xaf5e('0x2c')](_0x26cf2e,_0xaf5e('0x32'));_0xced261[_0xaf5e('0x33')]=_[_0xaf5e('0x34')](_0xc3a261[_0xaf5e('0x33')]);_0xced261[_0xaf5e('0x35')]=_[_0xaf5e('0x36')](_0xced261[_0xaf5e('0x31')],_0xced261[_0xaf5e('0x33')]);_0x1abe90[_0xaf5e('0x37')]=_[_0xaf5e('0x36')](_0xced261[_0xaf5e('0x31')],qs[_0xaf5e('0x38')](_0xc3a261[_0xaf5e('0x33')][_0xaf5e('0x38')]));_0x1abe90['attributes']=_0x1abe90[_0xaf5e('0x37')]['length']?_0x1abe90[_0xaf5e('0x37')]:_0xced261[_0xaf5e('0x31')];if(!_0xc3a261[_0xaf5e('0x33')][_0xaf5e('0x39')](_0xaf5e('0x3a'))){_0x1abe90[_0xaf5e('0x1c')]=qs['limit'](_0xc3a261[_0xaf5e('0x33')][_0xaf5e('0x1c')]);_0x1abe90[_0xaf5e('0x1e')]=qs[_0xaf5e('0x1e')](_0xc3a261[_0xaf5e('0x33')]['offset']);}_0x1abe90[_0xaf5e('0x3b')]=qs['sort'](_0xc3a261[_0xaf5e('0x33')][_0xaf5e('0x3c')]);_0x1abe90[_0xaf5e('0x3d')]=qs[_0xaf5e('0x35')](_[_0xaf5e('0x3e')](_0xc3a261[_0xaf5e('0x33')],_0xced261[_0xaf5e('0x35')]),_0x26cf2e);if(_0xc3a261[_0xaf5e('0x33')][_0xaf5e('0x3f')]){_0x1abe90[_0xaf5e('0x3d')]=_[_0xaf5e('0x40')](_0x1abe90[_0xaf5e('0x3d')],{'$or':_['map'](_0x26cf2e,function(_0x4d38a8){if(_0x4d38a8[_0xaf5e('0x2f')]!==_0xaf5e('0x41')){var _0x477206={};_0x477206[_0x4d38a8[_0xaf5e('0x32')]]={'$like':'%'+_0xc3a261[_0xaf5e('0x33')]['filter']+'%'};return _0x477206;}})});}_0x1abe90=_['merge']({},_0x1abe90,_0xc3a261[_0xaf5e('0x42')]);var _0x53eca7={'where':_0x1abe90[_0xaf5e('0x3d')]};return db['Trigger'][_0xaf5e('0x1d')](_0x53eca7)['then'](function(_0x361ade){_0x7fb6fa[_0xaf5e('0x1d')]=_0x361ade;if(_0xc3a261['query'][_0xaf5e('0x43')]){_0x1abe90[_0xaf5e('0x44')]=[{'all':!![]}];}return db[_0xaf5e('0x2d')]['findAll'](_0x1abe90);})[_0xaf5e('0x24')](function(_0x2c4b90){_0x7fb6fa[_0xaf5e('0x45')]=_0x2c4b90;return _0x7fb6fa;})[_0xaf5e('0x24')](respondWithFilteredResult(_0xf4983b,_0x1abe90))[_0xaf5e('0x46')](handleError(_0xf4983b,null));};exports[_0xaf5e('0x47')]=function(_0x1adbe5,_0x54ed37){var _0x1f6f5f={'raw':![],'where':{'id':_0x1adbe5[_0xaf5e('0x48')]['id']}},_0x51a2c1={};_0x51a2c1[_0xaf5e('0x31')]=_[_0xaf5e('0x34')](db['Trigger'][_0xaf5e('0x2e')]);_0x51a2c1[_0xaf5e('0x33')]=_['keys'](_0x1adbe5[_0xaf5e('0x33')]);_0x51a2c1['filters']=_[_0xaf5e('0x36')](_0x51a2c1['model'],_0x51a2c1[_0xaf5e('0x33')]);_0x1f6f5f[_0xaf5e('0x37')]=_['intersection'](_0x51a2c1[_0xaf5e('0x31')],qs[_0xaf5e('0x38')](_0x1adbe5[_0xaf5e('0x33')][_0xaf5e('0x38')]));_0x1f6f5f['attributes']=_0x1f6f5f[_0xaf5e('0x37')][_0xaf5e('0x49')]?_0x1f6f5f[_0xaf5e('0x37')]:_0x51a2c1[_0xaf5e('0x31')];if(_0x1adbe5['query']['includeAll']){_0x1f6f5f[_0xaf5e('0x44')]=[{'all':!![]}];}_0x1f6f5f=_[_0xaf5e('0x40')]({},_0x1f6f5f,_0x1adbe5[_0xaf5e('0x42')]);return db[_0xaf5e('0x2d')][_0xaf5e('0x4a')](_0x1f6f5f)[_0xaf5e('0x24')](handleEntityNotFound(_0x54ed37,null))['then'](respondWithResult(_0x54ed37,null))[_0xaf5e('0x46')](handleError(_0x54ed37,null));};exports[_0xaf5e('0x4b')]=function(_0x409708,_0x4c8d9f){return db[_0xaf5e('0x2d')][_0xaf5e('0x4b')](_0x409708[_0xaf5e('0x4c')],{})[_0xaf5e('0x24')](function(_0x3b0088){var _0x4db5e3=_0x409708[_0xaf5e('0x4d')][_0xaf5e('0x25')]({'plain':!![]});if(!_0x4db5e3)throw new Error(_0xaf5e('0x4e'));if(_0x4db5e3[_0xaf5e('0x4f')]===_0xaf5e('0x4d')){var _0x165426=_0x3b0088[_0xaf5e('0x25')]({'plain':!![]});var _0x11246e=_0xaf5e('0x26');return db[_0xaf5e('0x50')][_0xaf5e('0x4a')]({'where':{'name':_0x11246e,'userProfileId':_0x4db5e3['userProfileId']},'raw':!![]})[_0xaf5e('0x24')](function(_0x338707){if(_0x338707&&_0x338707[_0xaf5e('0x51')]===0x0){return db[_0xaf5e('0x52')]['create']({'name':_0x165426[_0xaf5e('0x32')],'resourceId':_0x165426['id'],'type':_0x338707['name'],'sectionId':_0x338707['id']},{})[_0xaf5e('0x24')](function(){return _0x3b0088;});}else{return _0x3b0088;}})[_0xaf5e('0x46')](function(_0x1f440d){logger[_0xaf5e('0x29')](_0xaf5e('0x53'),_0x1f440d);throw _0x1f440d;});}return _0x3b0088;})[_0xaf5e('0x24')](respondWithResult(_0x4c8d9f,0xc9))[_0xaf5e('0x46')](handleError(_0x4c8d9f,null));};exports[_0xaf5e('0x23')]=function(_0x40efa9,_0x2bf925){if(_0x40efa9[_0xaf5e('0x4c')]['id']){delete _0x40efa9[_0xaf5e('0x4c')]['id'];}return db[_0xaf5e('0x2d')][_0xaf5e('0x4a')]({'where':{'id':_0x40efa9[_0xaf5e('0x48')]['id']}})['then'](handleEntityNotFound(_0x2bf925,null))[_0xaf5e('0x24')](saveUpdates(_0x40efa9['body'],null))[_0xaf5e('0x24')](respondWithResult(_0x2bf925,null))['catch'](handleError(_0x2bf925,null));};exports['destroy']=function(_0x18712e,_0x2a1318){return db[_0xaf5e('0x2d')][_0xaf5e('0x4a')]({'where':{'id':_0x18712e[_0xaf5e('0x48')]['id']}})[_0xaf5e('0x24')](handleEntityNotFound(_0x2a1318,null))[_0xaf5e('0x24')](removeEntity(_0x2a1318,null))[_0xaf5e('0x46')](handleError(_0x2a1318,null));};exports[_0xaf5e('0x54')]=function(_0x101227,_0x503347,_0x2700f8){if(_0x101227['body']['id']){delete _0x101227[_0xaf5e('0x4c')]['id'];}return db[_0xaf5e('0x2d')][_0xaf5e('0x4a')]({'where':{'id':_0x101227[_0xaf5e('0x48')]['id']}})[_0xaf5e('0x24')](handleEntityNotFound(_0x503347,null))[_0xaf5e('0x24')](function(_0x309a74){if(_0x309a74){_0x101227[_0xaf5e('0x4c')][_0xaf5e('0x55')]=_0x309a74['id'];return db['Condition']['create'](_0x101227[_0xaf5e('0x4c')]);}})[_0xaf5e('0x24')](respondWithResult(_0x503347,null))[_0xaf5e('0x46')](handleError(_0x503347,null));};exports[_0xaf5e('0x56')]=function(_0x30dba7,_0x52a375,_0x1e0608){if(_0x30dba7[_0xaf5e('0x4c')]['id']){delete _0x30dba7[_0xaf5e('0x4c')]['id'];}return db['Trigger'][_0xaf5e('0x4a')]({'where':{'id':_0x30dba7[_0xaf5e('0x48')]['id']}})['then'](handleEntityNotFound(_0x52a375,null))['then'](function(_0x1623f7){if(_0x1623f7){_0x30dba7[_0xaf5e('0x4c')][_0xaf5e('0x57')]=_0x1623f7['id'];return db[_0xaf5e('0x58')][_0xaf5e('0x4b')](_0x30dba7[_0xaf5e('0x4c')]);}})[_0xaf5e('0x24')](respondWithResult(_0x52a375,null))[_0xaf5e('0x46')](handleError(_0x52a375,null));};exports[_0xaf5e('0x59')]=function(_0x217b86,_0x569941,_0x5c8dd8){var _0x1f8fd8={};var _0x3fad46={};var _0x415b1f;var _0x52b04b;return db[_0xaf5e('0x2d')]['findOne']({'where':{'id':_0x217b86[_0xaf5e('0x48')]['id']}})[_0xaf5e('0x24')](handleEntityNotFound(_0x569941,null))['then'](function(_0x470c3a){if(_0x470c3a){_0x415b1f=_0x470c3a;_0x3fad46[_0xaf5e('0x31')]=_['keys'](db[_0xaf5e('0x58')][_0xaf5e('0x2e')]);_0x3fad46[_0xaf5e('0x33')]=_[_0xaf5e('0x34')](_0x217b86[_0xaf5e('0x33')]);_0x3fad46[_0xaf5e('0x35')]=_[_0xaf5e('0x36')](_0x3fad46[_0xaf5e('0x31')],_0x3fad46[_0xaf5e('0x33')]);_0x1f8fd8['attributes']=_['intersection'](_0x3fad46[_0xaf5e('0x31')],qs['fields'](_0x217b86[_0xaf5e('0x33')]['fields']));_0x1f8fd8[_0xaf5e('0x37')]=_0x1f8fd8[_0xaf5e('0x37')][_0xaf5e('0x49')]?_0x1f8fd8['attributes']:_0x3fad46[_0xaf5e('0x31')];_0x1f8fd8[_0xaf5e('0x3b')]=qs[_0xaf5e('0x3c')](_0x217b86[_0xaf5e('0x33')]['sort']);_0x1f8fd8[_0xaf5e('0x3d')]=qs['filters'](_['pick'](_0x217b86['query'],_0x3fad46[_0xaf5e('0x35')]));if(_0x217b86[_0xaf5e('0x33')][_0xaf5e('0x3f')]){_0x1f8fd8[_0xaf5e('0x3d')]=_[_0xaf5e('0x40')](_0x1f8fd8['where'],{'$or':_[_0xaf5e('0x2c')](_0x1f8fd8[_0xaf5e('0x37')],function(_0x4da43a){var _0x401ba1={};_0x401ba1[_0x4da43a]={'$like':'%'+_0x217b86[_0xaf5e('0x33')]['filter']+'%'};return _0x401ba1;})});}_0x1f8fd8=_['merge']({},_0x1f8fd8,_0x217b86[_0xaf5e('0x42')]);return _0x415b1f[_0xaf5e('0x59')](_0x1f8fd8);}})['then'](function(_0x241f0f){if(_0x241f0f){_0x52b04b=_0x241f0f[_0xaf5e('0x49')];if(!_0x217b86[_0xaf5e('0x33')][_0xaf5e('0x39')](_0xaf5e('0x3a'))){_0x1f8fd8['limit']=qs[_0xaf5e('0x1c')](_0x217b86[_0xaf5e('0x33')][_0xaf5e('0x1c')]);_0x1f8fd8[_0xaf5e('0x1e')]=qs[_0xaf5e('0x1e')](_0x217b86[_0xaf5e('0x33')][_0xaf5e('0x1e')]);}return _0x415b1f[_0xaf5e('0x59')](_0x1f8fd8);}})['then'](function(_0xc7dfee){if(_0xc7dfee){return _0xc7dfee?{'count':_0x52b04b,'rows':_0xc7dfee}:null;}})[_0xaf5e('0x24')](respondWithResult(_0x569941,null))[_0xaf5e('0x46')](handleError(_0x569941,null));};exports[_0xaf5e('0x5a')]=function(_0x52f3e0,_0x5b13ca,_0x5b6bfc){var _0x51ac51={};var _0x443524={};var _0x3a0e0f;var _0x3f9342;return db[_0xaf5e('0x2d')][_0xaf5e('0x5b')]({'where':{'id':_0x52f3e0[_0xaf5e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b13ca,null))[_0xaf5e('0x24')](function(_0x23e713){if(_0x23e713){_0x3a0e0f=_0x23e713;_0x443524[_0xaf5e('0x31')]=_[_0xaf5e('0x34')](db[_0xaf5e('0x58')][_0xaf5e('0x2e')]);_0x443524[_0xaf5e('0x33')]=_[_0xaf5e('0x34')](_0x52f3e0[_0xaf5e('0x33')]);_0x443524[_0xaf5e('0x35')]=_[_0xaf5e('0x36')](_0x443524[_0xaf5e('0x31')],_0x443524['query']);_0x51ac51['attributes']=_[_0xaf5e('0x36')](_0x443524[_0xaf5e('0x31')],qs[_0xaf5e('0x38')](_0x52f3e0['query'][_0xaf5e('0x38')]));_0x51ac51['attributes']=_0x51ac51[_0xaf5e('0x37')][_0xaf5e('0x49')]?_0x51ac51['attributes']:_0x443524[_0xaf5e('0x31')];_0x51ac51[_0xaf5e('0x3b')]=qs[_0xaf5e('0x3c')](_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x3c')]);_0x51ac51[_0xaf5e('0x3d')]=qs[_0xaf5e('0x35')](_[_0xaf5e('0x3e')](_0x52f3e0['query'],_0x443524[_0xaf5e('0x35')]));if(_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x3f')]){_0x51ac51['where']=_[_0xaf5e('0x40')](_0x51ac51[_0xaf5e('0x3d')],{'$or':_[_0xaf5e('0x2c')](_0x51ac51['attributes'],function(_0x419d74){var _0x29b08f={};_0x29b08f[_0x419d74]={'$like':'%'+_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x3f')]+'%'};return _0x29b08f;})});}_0x51ac51=_['merge']({},_0x51ac51,_0x52f3e0[_0xaf5e('0x42')]);return _0x3a0e0f[_0xaf5e('0x5a')](_0x51ac51);}})['then'](function(_0xc267aa){if(_0xc267aa){_0x3f9342=_0xc267aa[_0xaf5e('0x49')];if(!_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x39')]('nolimit')){_0x51ac51[_0xaf5e('0x1c')]=qs[_0xaf5e('0x1c')](_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x1c')]);_0x51ac51[_0xaf5e('0x1e')]=qs[_0xaf5e('0x1e')](_0x52f3e0[_0xaf5e('0x33')][_0xaf5e('0x1e')]);}return _0x3a0e0f[_0xaf5e('0x5a')](_0x51ac51);}})[_0xaf5e('0x24')](function(_0xe0069c){if(_0xe0069c){return _0xe0069c?{'count':_0x3f9342,'rows':_0xe0069c}:null;}})[_0xaf5e('0x24')](respondWithResult(_0x5b13ca,null))[_0xaf5e('0x46')](handleError(_0x5b13ca,null));};exports['addAction']=function(_0x3278f8,_0x40d7f9,_0x20e12a){if(_0x3278f8['body']['id']){delete _0x3278f8[_0xaf5e('0x4c')]['id'];}return db[_0xaf5e('0x2d')][_0xaf5e('0x4a')]({'where':{'id':_0x3278f8[_0xaf5e('0x48')]['id']}})[_0xaf5e('0x24')](handleEntityNotFound(_0x40d7f9,null))[_0xaf5e('0x24')](function(_0x37771c){if(_0x37771c){_0x3278f8['body']['TriggerId']=_0x37771c['id'];return db[_0xaf5e('0x5c')][_0xaf5e('0x4b')](_0x3278f8['body']);}})['then'](respondWithResult(_0x40d7f9,null))[_0xaf5e('0x46')](handleError(_0x40d7f9,null));};exports[_0xaf5e('0x5d')]=function(_0x565d99,_0x5d5c5a,_0x41ca03){var _0x1e6026={};var _0x3d5fe8={};var _0x562c66;var _0x3d08e5;return db[_0xaf5e('0x2d')][_0xaf5e('0x5b')]({'where':{'id':_0x565d99[_0xaf5e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d5c5a,null))['then'](function(_0x525269){if(_0x525269){_0x562c66=_0x525269;_0x3d5fe8[_0xaf5e('0x31')]=_[_0xaf5e('0x34')](db['Action'][_0xaf5e('0x2e')]);_0x3d5fe8[_0xaf5e('0x33')]=_[_0xaf5e('0x34')](_0x565d99[_0xaf5e('0x33')]);_0x3d5fe8[_0xaf5e('0x35')]=_['intersection'](_0x3d5fe8['model'],_0x3d5fe8['query']);_0x1e6026['attributes']=_[_0xaf5e('0x36')](_0x3d5fe8['model'],qs[_0xaf5e('0x38')](_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x38')]));_0x1e6026[_0xaf5e('0x37')]=_0x1e6026[_0xaf5e('0x37')][_0xaf5e('0x49')]?_0x1e6026['attributes']:_0x3d5fe8[_0xaf5e('0x31')];_0x1e6026[_0xaf5e('0x3b')]=qs['sort'](_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x3c')]);_0x1e6026[_0xaf5e('0x3d')]=qs[_0xaf5e('0x35')](_['pick'](_0x565d99['query'],_0x3d5fe8[_0xaf5e('0x35')]));if(_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x3f')]){_0x1e6026['where']=_[_0xaf5e('0x40')](_0x1e6026[_0xaf5e('0x3d')],{'$or':_[_0xaf5e('0x2c')](_0x1e6026['attributes'],function(_0x12f247){var _0x3b7d28={};_0x3b7d28[_0x12f247]={'$like':'%'+_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x3f')]+'%'};return _0x3b7d28;})});}_0x1e6026=_[_0xaf5e('0x40')]({},_0x1e6026,_0x565d99[_0xaf5e('0x42')]);return _0x562c66[_0xaf5e('0x5d')](_0x1e6026);}})[_0xaf5e('0x24')](function(_0x3020ed){if(_0x3020ed){_0x3d08e5=_0x3020ed[_0xaf5e('0x49')];if(!_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x39')]('nolimit')){_0x1e6026[_0xaf5e('0x1c')]=qs[_0xaf5e('0x1c')](_0x565d99['query'][_0xaf5e('0x1c')]);_0x1e6026[_0xaf5e('0x1e')]=qs['offset'](_0x565d99[_0xaf5e('0x33')][_0xaf5e('0x1e')]);}return _0x562c66['getActions'](_0x1e6026);}})[_0xaf5e('0x24')](function(_0x505c34){if(_0x505c34){return _0x505c34?{'count':_0x3d08e5,'rows':_0x505c34}:null;}})['then'](respondWithResult(_0x5d5c5a,null))[_0xaf5e('0x46')](handleError(_0x5d5c5a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 33d1f4c..5ce62b3 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 _0x4d9e=['lodash','api','bluebird','path','rimraf','./trigger.attributes','exports','define','Trigger'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x5452b7,_0x487f12){_0x5452b7=_0x5452b7-0x0;var _0x8b8e33=_0x4d9e[_0x5452b7];return _0x8b8e33;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe4d9('0x1'));var moment=require('moment');var BPromise=require(_0xe4d9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4d9('0x3'));var rimraf=require(_0xe4d9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe4d9('0x5'));module[_0xe4d9('0x6')]=function(_0x278035,_0x34c2a2){return _0x278035[_0xe4d9('0x7')](_0xe4d9('0x8'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b1f=['api','moment','bluebird','path','rimraf','../../config/environment','define','Trigger','tools_triggers','lodash','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4b1f,0x195));var _0xf4b1=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x4b1f[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var logger=require('../../config/logger')(_0xf4b1('0x2'));var moment=require(_0xf4b1('0x3'));var BPromise=require(_0xf4b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4b1('0x5'));var rimraf=require(_0xf4b1('0x6'));var config=require(_0xf4b1('0x7'));var attributes=require('./trigger.attributes');module['exports']=function(_0x1ab96b,_0x4b676){return _0x1ab96b[_0xf4b1('0x8')](_0xf4b1('0x9'),attributes,{'tableName':_0xf4b1('0xa'),'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 ba79fd3..f6b963a 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 _0x9437=['stringify','error','message','result','catch','Trigger','findAll','options','raw','attributes','limit','include','map','model','info','GetTrigger','find','where','then','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9437,0x80));var _0x7943=function(_0x5c760f,_0x3c4f49){_0x5c760f=_0x5c760f-0x0;var _0x58e4de=_0x9437[_0x5c760f];return _0x58e4de;};'use strict';var _=require(_0x7943('0x0'));var util=require(_0x7943('0x1'));var moment=require(_0x7943('0x2'));var BPromise=require(_0x7943('0x3'));var rs=require(_0x7943('0x4'));var fs=require('fs');var Redis=require(_0x7943('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7943('0x6'));var logger=require(_0x7943('0x7'))('rpc');var config=require(_0x7943('0x8'));var jayson=require(_0x7943('0x9'));var client=jayson['client'][_0x7943('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f70aa,_0xb4f714,_0x5d5d79){return new BPromise(function(_0x5b655b,_0x20432d){return client[_0x7943('0xb')](_0x3f70aa,_0x5d5d79)['then'](function(_0x567c18){logger['info'](_0x7943('0xc'),_0xb4f714,_0x7943('0xd'));logger[_0x7943('0xe')](_0x7943('0xf'),_0xb4f714,_0x7943('0xd'),JSON[_0x7943('0x10')](_0x567c18));if(_0x567c18[_0x7943('0x11')]){if(_0x567c18['error']['code']===0x1f4){logger[_0x7943('0x11')](_0x7943('0xc'),_0xb4f714,_0x567c18[_0x7943('0x11')][_0x7943('0x12')]);return _0x20432d(_0x567c18[_0x7943('0x11')][_0x7943('0x12')]);}logger[_0x7943('0x11')](_0x7943('0xc'),_0xb4f714,_0x567c18[_0x7943('0x11')][_0x7943('0x12')]);return _0x5b655b(_0x567c18[_0x7943('0x11')][_0x7943('0x12')]);}else{logger['info'](_0x7943('0xc'),_0xb4f714,_0x7943('0xd'));_0x5b655b(_0x567c18[_0x7943('0x13')]['message']);}})[_0x7943('0x14')](function(_0x14a6dc){logger[_0x7943('0x11')](_0x7943('0xc'),_0xb4f714,_0x14a6dc);_0x20432d(_0x14a6dc);});});}exports['GetTrigger']=function(_0x46d1dd){var _0x36c091=this;return new Promise(function(_0x2b8c5e,_0x52ecf6){return db[_0x7943('0x15')][_0x7943('0x16')]({'raw':_0x46d1dd[_0x7943('0x17')]?_0x46d1dd[_0x7943('0x17')][_0x7943('0x18')]===undefined?!![]:![]:!![],'where':_0x46d1dd[_0x7943('0x17')]?_0x46d1dd[_0x7943('0x17')]['where']||null:null,'attributes':_0x46d1dd[_0x7943('0x17')]?_0x46d1dd[_0x7943('0x17')][_0x7943('0x19')]||null:null,'limit':_0x46d1dd[_0x7943('0x17')]?_0x46d1dd['options'][_0x7943('0x1a')]||null:null,'include':_0x46d1dd[_0x7943('0x17')]?_0x46d1dd[_0x7943('0x17')][_0x7943('0x1b')]?_[_0x7943('0x1c')](_0x46d1dd[_0x7943('0x17')][_0x7943('0x1b')],function(_0x23b102){return{'model':db[_0x23b102[_0x7943('0x1d')]],'as':_0x23b102['as'],'attributes':_0x23b102[_0x7943('0x19')],'include':_0x23b102[_0x7943('0x1b')]?_[_0x7943('0x1c')](_0x23b102[_0x7943('0x1b')],function(_0x98558a){return{'model':db[_0x98558a[_0x7943('0x1d')]],'as':_0x98558a['as'],'attributes':_0x98558a[_0x7943('0x19')],'include':_0x98558a[_0x7943('0x1b')]?_[_0x7943('0x1c')](_0x98558a['include'],function(_0x92219e){return{'model':db[_0x92219e[_0x7943('0x1d')]],'as':_0x92219e['as'],'attributes':_0x92219e[_0x7943('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x323fa7){logger[_0x7943('0x1e')](_0x7943('0x1f'),_0x46d1dd);logger['debug'](_0x7943('0x1f'),_0x46d1dd,JSON[_0x7943('0x10')](_0x323fa7));_0x2b8c5e(_0x323fa7);})['catch'](function(_0x56a2df){logger[_0x7943('0x11')]('GetTrigger',_0x56a2df[_0x7943('0x12')],_0x46d1dd);_0x52ecf6(_0x36c091[_0x7943('0x11')](0x1f4,_0x56a2df[_0x7943('0x12')]));});});};exports['ShowTrigger']=function(_0x362025){var _0x4551fc=this;return new Promise(function(_0x3304a5,_0x11aa2c){return db['Trigger'][_0x7943('0x20')]({'raw':_0x362025[_0x7943('0x17')]?_0x362025[_0x7943('0x17')][_0x7943('0x18')]===undefined?!![]:![]:!![],'where':_0x362025[_0x7943('0x17')]?_0x362025['options'][_0x7943('0x21')]||null:null,'attributes':_0x362025['options']?_0x362025[_0x7943('0x17')][_0x7943('0x19')]||null:null,'include':_0x362025[_0x7943('0x17')]?_0x362025['options'][_0x7943('0x1b')]?_['map'](_0x362025[_0x7943('0x17')][_0x7943('0x1b')],function(_0x22e672){return{'model':db[_0x22e672['model']],'as':_0x22e672['as'],'attributes':_0x22e672[_0x7943('0x19')],'include':_0x22e672[_0x7943('0x1b')]?_[_0x7943('0x1c')](_0x22e672[_0x7943('0x1b')],function(_0x495b31){return{'model':db[_0x495b31['model']],'as':_0x495b31['as'],'attributes':_0x495b31[_0x7943('0x19')],'include':_0x495b31[_0x7943('0x1b')]?_[_0x7943('0x1c')](_0x495b31['include'],function(_0x8f27c3){return{'model':db[_0x8f27c3['model']],'as':_0x8f27c3['as'],'attributes':_0x8f27c3[_0x7943('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7943('0x22')](function(_0x5ef147){logger['info'](_0x7943('0x23'),_0x362025);logger[_0x7943('0xe')]('ShowTrigger',_0x362025,JSON[_0x7943('0x10')](_0x5ef147));_0x3304a5(_0x5ef147);})['catch'](function(_0x3f382b){logger[_0x7943('0x11')](_0x7943('0x23'),_0x3f382b['message'],_0x362025);_0x11aa2c(_0x4551fc[_0x7943('0x11')](0x1f4,_0x3f382b[_0x7943('0x12')]));});});}; \ No newline at end of file +var _0x54d6=['client','request','info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x6ec41e,_0x49779b){var _0x53ca48=function(_0x47ac46){while(--_0x47ac46){_0x6ec41e['push'](_0x6ec41e['shift']());}};_0x53ca48(++_0x49779b);}(_0x54d6,0x1bd));var _0x654d=function(_0xcfbed,_0x454c06){_0xcfbed=_0xcfbed-0x0;var _0x4c153a=_0x54d6[_0xcfbed];return _0x4c153a;};'use strict';var _=require(_0x654d('0x0'));var util=require(_0x654d('0x1'));var moment=require(_0x654d('0x2'));var BPromise=require(_0x654d('0x3'));var rs=require(_0x654d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x654d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x654d('0x6'))(_0x654d('0x7'));var config=require(_0x654d('0x8'));var jayson=require(_0x654d('0x9'));var client=jayson[_0x654d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f2adf,_0x12ad58,_0x462622){return new BPromise(function(_0x1dbca9,_0x2f7a26){return client[_0x654d('0xb')](_0x5f2adf,_0x462622)['then'](function(_0x31dd99){logger[_0x654d('0xc')](_0x654d('0xd'),_0x12ad58,'request\x20sent');logger['debug'](_0x654d('0xe'),_0x12ad58,'request\x20sent',JSON[_0x654d('0xf')](_0x31dd99));if(_0x31dd99[_0x654d('0x10')]){if(_0x31dd99[_0x654d('0x10')]['code']===0x1f4){logger[_0x654d('0x10')](_0x654d('0xd'),_0x12ad58,_0x31dd99['error'][_0x654d('0x11')]);return _0x2f7a26(_0x31dd99['error'][_0x654d('0x11')]);}logger['error'](_0x654d('0xd'),_0x12ad58,_0x31dd99[_0x654d('0x10')][_0x654d('0x11')]);return _0x1dbca9(_0x31dd99['error'][_0x654d('0x11')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x12ad58,_0x654d('0x12'));_0x1dbca9(_0x31dd99[_0x654d('0x13')][_0x654d('0x11')]);}})[_0x654d('0x14')](function(_0x3747a6){logger[_0x654d('0x10')](_0x654d('0xd'),_0x12ad58,_0x3747a6);_0x2f7a26(_0x3747a6);});});}exports[_0x654d('0x15')]=function(_0x14adfc){var _0x580d09=this;return new Promise(function(_0x22f82e,_0xdd28b3){return db[_0x654d('0x16')][_0x654d('0x17')]({'raw':_0x14adfc[_0x654d('0x18')]?_0x14adfc[_0x654d('0x18')][_0x654d('0x19')]===undefined?!![]:![]:!![],'where':_0x14adfc['options']?_0x14adfc[_0x654d('0x18')][_0x654d('0x1a')]||null:null,'attributes':_0x14adfc[_0x654d('0x18')]?_0x14adfc[_0x654d('0x18')][_0x654d('0x1b')]||null:null,'limit':_0x14adfc[_0x654d('0x18')]?_0x14adfc['options'][_0x654d('0x1c')]||null:null,'include':_0x14adfc[_0x654d('0x18')]?_0x14adfc[_0x654d('0x18')][_0x654d('0x1d')]?_[_0x654d('0x1e')](_0x14adfc[_0x654d('0x18')][_0x654d('0x1d')],function(_0x183881){return{'model':db[_0x183881['model']],'as':_0x183881['as'],'attributes':_0x183881['attributes'],'include':_0x183881[_0x654d('0x1d')]?_[_0x654d('0x1e')](_0x183881[_0x654d('0x1d')],function(_0x59b0dd){return{'model':db[_0x59b0dd[_0x654d('0x1f')]],'as':_0x59b0dd['as'],'attributes':_0x59b0dd['attributes'],'include':_0x59b0dd[_0x654d('0x1d')]?_[_0x654d('0x1e')](_0x59b0dd[_0x654d('0x1d')],function(_0x29dfb4){return{'model':db[_0x29dfb4[_0x654d('0x1f')]],'as':_0x29dfb4['as'],'attributes':_0x29dfb4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f33da){logger[_0x654d('0xc')](_0x654d('0x15'),_0x14adfc);logger[_0x654d('0x20')]('GetTrigger',_0x14adfc,JSON[_0x654d('0xf')](_0x1f33da));_0x22f82e(_0x1f33da);})[_0x654d('0x14')](function(_0x5559b8){logger[_0x654d('0x10')](_0x654d('0x15'),_0x5559b8['message'],_0x14adfc);_0xdd28b3(_0x580d09[_0x654d('0x10')](0x1f4,_0x5559b8[_0x654d('0x11')]));});});};exports[_0x654d('0x21')]=function(_0x7a6051){var _0x52492=this;return new Promise(function(_0xebb910,_0x48837e){return db['Trigger'][_0x654d('0x22')]({'raw':_0x7a6051[_0x654d('0x18')]?_0x7a6051[_0x654d('0x18')][_0x654d('0x19')]===undefined?!![]:![]:!![],'where':_0x7a6051[_0x654d('0x18')]?_0x7a6051[_0x654d('0x18')]['where']||null:null,'attributes':_0x7a6051[_0x654d('0x18')]?_0x7a6051['options'][_0x654d('0x1b')]||null:null,'include':_0x7a6051['options']?_0x7a6051['options'][_0x654d('0x1d')]?_['map'](_0x7a6051[_0x654d('0x18')]['include'],function(_0x36078c){return{'model':db[_0x36078c[_0x654d('0x1f')]],'as':_0x36078c['as'],'attributes':_0x36078c[_0x654d('0x1b')],'include':_0x36078c[_0x654d('0x1d')]?_[_0x654d('0x1e')](_0x36078c[_0x654d('0x1d')],function(_0x15134f){return{'model':db[_0x15134f['model']],'as':_0x15134f['as'],'attributes':_0x15134f[_0x654d('0x1b')],'include':_0x15134f[_0x654d('0x1d')]?_[_0x654d('0x1e')](_0x15134f['include'],function(_0x2a9a5b){return{'model':db[_0x2a9a5b[_0x654d('0x1f')]],'as':_0x2a9a5b['as'],'attributes':_0x2a9a5b[_0x654d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51c79){logger['info'](_0x654d('0x21'),_0x7a6051);logger[_0x654d('0x20')](_0x654d('0x21'),_0x7a6051,JSON[_0x654d('0xf')](_0x51c79));_0xebb910(_0x51c79);})[_0x654d('0x14')](function(_0x3008fc){logger[_0x654d('0x10')](_0x654d('0x21'),_0x3008fc[_0x654d('0x11')],_0x7a6051);_0x48837e(_0x52492[_0x654d('0x10')](0x1f4,_0x3008fc[_0x654d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1d99f25..d177533 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 _0x9c6a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','index','isAuthenticated','show','post','/:id/clone','clone','create','put','/:id','update','destroy','multer','util'];(function(_0x69b44f,_0x3a7b45){var _0x2325ce=function(_0x523be8){while(--_0x523be8){_0x69b44f['push'](_0x69b44f['shift']());}};_0x2325ce(++_0x3a7b45);}(_0x9c6a,0x82));var _0xa9c6=function(_0x458e87,_0x339a72){_0x458e87=_0x458e87-0x0;var _0x475075=_0x9c6a[_0x458e87];return _0x475075;};'use strict';var multer=require(_0xa9c6('0x0'));var util=require(_0xa9c6('0x1'));var path=require(_0xa9c6('0x2'));var timeout=require(_0xa9c6('0x3'));var express=require(_0xa9c6('0x4'));var router=express[_0xa9c6('0x5')]();var fs_extra=require(_0xa9c6('0x6'));var auth=require(_0xa9c6('0x7'));var interaction=require(_0xa9c6('0x8'));var config=require('../../config/environment');var controller=require(_0xa9c6('0x9'));router[_0xa9c6('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9c6('0xb')]);router[_0xa9c6('0xa')]('/:id',auth[_0xa9c6('0xc')](),controller[_0xa9c6('0xd')]);router[_0xa9c6('0xe')](_0xa9c6('0xf'),auth[_0xa9c6('0xc')](),controller[_0xa9c6('0x10')]);router[_0xa9c6('0xe')]('/',auth[_0xa9c6('0xc')](),controller[_0xa9c6('0x11')]);router[_0xa9c6('0x12')](_0xa9c6('0x13'),auth[_0xa9c6('0xc')](),controller[_0xa9c6('0x14')]);router['delete'](_0xa9c6('0x13'),auth[_0xa9c6('0xc')](),controller[_0xa9c6('0x15')]);module['exports']=router; \ No newline at end of file +var _0xbf7e=['Router','../../config/environment','get','isAuthenticated','index','/:id','show','post','/:id/clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xbf7e,0x1b3));var _0xebf7=function(_0x4000eb,_0x3a0b97){_0x4000eb=_0x4000eb-0x0;var _0x27ee47=_0xbf7e[_0x4000eb];return _0x27ee47;};'use strict';var multer=require(_0xebf7('0x0'));var util=require(_0xebf7('0x1'));var path=require(_0xebf7('0x2'));var timeout=require(_0xebf7('0x3'));var express=require(_0xebf7('0x4'));var router=express[_0xebf7('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xebf7('0x6'));var controller=require('./trunk.controller');router[_0xebf7('0x7')]('/',auth[_0xebf7('0x8')](),controller[_0xebf7('0x9')]);router[_0xebf7('0x7')](_0xebf7('0xa'),auth['isAuthenticated'](),controller[_0xebf7('0xb')]);router[_0xebf7('0xc')](_0xebf7('0xd'),auth[_0xebf7('0x8')](),controller['clone']);router[_0xebf7('0xc')]('/',auth[_0xebf7('0x8')](),controller[_0xebf7('0xe')]);router[_0xebf7('0xf')](_0xebf7('0xa'),auth['isAuthenticated'](),controller[_0xebf7('0x10')]);router[_0xebf7('0x11')](_0xebf7('0xa'),auth['isAuthenticated'](),controller[_0xebf7('0x12')]);module[_0xebf7('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index e94a692..07e7a21 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 _0xc901=['uac','uas','pai','fingerprint','passive','actpass','dynamic','sequelize','exports','ENUM','friend','peer','STRING','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','nonat','update','yes','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always'];(function(_0x227831,_0x1036ab){var _0x58dc93=function(_0x2c509c){while(--_0x2c509c){_0x227831['push'](_0x227831['shift']());}};_0x58dc93(++_0x1036ab);}(_0xc901,0x88));var _0x1c90=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc901[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x1c90('0x0'));module[_0x1c90('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x3'),'user',_0x1c90('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x1c90('0x5')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x1c90('0x2')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x1c90('0x6'),'ALLOWED',_0x1c90('0x7'),_0x1c90('0x8'),_0x1c90('0x9'),_0x1c90('0xa'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x1c90('0x5')]},'secret':{'type':Sequelize[_0x1c90('0x5')]},'md5secret':{'type':Sequelize[_0x1c90('0x5')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x1c90('0x5')],'defaultValue':_0x1c90('0xb'),'set':function(_0x374b56){this['setDataValue'](_0x1c90('0xc'),_0x374b56?_0x374b56[_0x1c90('0xd')](','):null);},'get':function(){return this[_0x1c90('0xe')]('transport')?this['getDataValue'](_0x1c90('0xc'))[_0x1c90('0xf')](','):null;},'comment':_0x1c90('0x10')},'dtmfmode':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x11'),'info',_0x1c90('0x12'),_0x1c90('0x13'),_0x1c90('0x14')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x1c90('0x15'),_0x1c90('0x16'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x1c90('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1c90('0x5')]},'directmediadeny':{'type':Sequelize[_0x1c90('0x5')]},'nat':{'type':Sequelize[_0x1c90('0x5')],'defaultValue':'force_rport,comedia','set':function(_0x831f21){this[_0x1c90('0x18')]('nat',_0x831f21?_0x831f21[_0x1c90('0xd')](','):null);},'get':function(){return this[_0x1c90('0xe')](_0x1c90('0x19'))?this[_0x1c90('0xe')](_0x1c90('0x19'))['split'](','):null;},'comment':_0x1c90('0x1a')},'callgroup':{'type':Sequelize[_0x1c90('0x5')]},'namedcallgroup':{'type':Sequelize[_0x1c90('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1c90('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1c90('0x5')],'defaultValue':_0x1c90('0x1b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1c90('0x1c'),'set':function(_0x3b427f){this['setDataValue'](_0x1c90('0x1d'),_0x3b427f?_0x3b427f[_0x1c90('0xd')](';'):_0x1c90('0x1c'));},'get':function(){return this[_0x1c90('0xe')](_0x1c90('0x1d'))?this['getDataValue'](_0x1c90('0x1d'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x1c90('0x1e'),'set':function(_0x18efc3){this['setDataValue']('insecure',_0x18efc3?_0x18efc3[_0x1c90('0xd')](','):null);},'get':function(){return this[_0x1c90('0xe')](_0x1c90('0x1f'))?this[_0x1c90('0xe')](_0x1c90('0x1f'))[_0x1c90('0xf')](','):null;},'comment':_0x1c90('0x20')},'trustrpid':{'type':Sequelize['ENUM'](_0x1c90('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x1c90('0x17'),'no','never')},'promiscredir':{'type':Sequelize[_0x1c90('0x2')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x1c90('0x17'),'no')},'accountcode':{'type':Sequelize[_0x1c90('0x21')](0xb)},'setvar':{'type':Sequelize[_0x1c90('0x5')]},'callerid':{'type':Sequelize[_0x1c90('0x5')],'defaultValue':_0x1c90('0x22')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x1c90('0x17'),'no'),'defaultValue':_0x1c90('0x17')},'busylevel':{'type':Sequelize[_0x1c90('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x1c90('0x5')]},'template':{'type':Sequelize[_0x1c90('0x5')]},'videosupport':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no',_0x1c90('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1c90('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no')},'mailbox':{'type':Sequelize[_0x1c90('0x5')]},'session_timers':{'type':Sequelize['ENUM']('accept','refuse','originate')},'session_expires':{'type':Sequelize[_0x1c90('0x21')](0xb)},'session_minse':{'type':Sequelize[_0x1c90('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x24'),'uas'),'defaultValue':_0x1c90('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0x1c90('0x5')]},'regexten':{'type':Sequelize[_0x1c90('0x5')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1c90('0x21')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x1c90('0x17'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x1c90('0x21')](0xb)},'defaultip':{'type':Sequelize[_0x1c90('0x5')]},'defaultuser':{'type':Sequelize[_0x1c90('0x5')]},'rtptimeout':{'type':Sequelize[_0x1c90('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x1c90('0x17'),'no',_0x1c90('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x1c90('0x5')]},'timert1':{'type':Sequelize[_0x1c90('0x21')](0xb)},'timerb':{'type':Sequelize[_0x1c90('0x21')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x1c90('0x5')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x1c90('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0x1c90('0x5')]},'use_q850_reason':{'type':Sequelize[_0x1c90('0x5')]},'maxforwards':{'type':Sequelize[_0x1c90('0x21')](0xb)},'encryption':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1c90('0x2')]('yes','no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no',_0x1c90('0x27'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x1c90('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x1c90('0x5')]},'dtlsprivatekey':{'type':Sequelize[_0x1c90('0x5')]},'dtlscipher':{'type':Sequelize[_0x1c90('0x5')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x1c90('0x5')]},'dtlssetup':{'type':Sequelize[_0x1c90('0x2')]('active',_0x1c90('0x28'),_0x1c90('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1c90('0x5')]},'usereqphone':{'type':Sequelize['ENUM'](_0x1c90('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1c90('0x5')]},'recordofffeature':{'type':Sequelize[_0x1c90('0x5')]},'call_limit':{'type':Sequelize[_0x1c90('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x1c90('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x1c90('0x2')](_0x1c90('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x1c90('0x5')]},'mohsuggest':{'type':Sequelize[_0x1c90('0x5')]},'parkinglot':{'type':Sequelize[_0x1c90('0x5')]},'description':{'type':Sequelize[_0x1c90('0x5')]},'host':{'type':Sequelize[_0x1c90('0x5')],'defaultValue':_0x1c90('0x2a')},'canreinvite':{'type':Sequelize[_0x1c90('0x2')]('yes','no',_0x1c90('0x15'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x1c90('0x5')]},'otherFields':{'type':Sequelize[_0x1c90('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1c90('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0x63ea=['STRING','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','always','refuse','originate','uac','uas','pai','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','name','ENUM','friend','user','peer'];(function(_0x151b00,_0x4804f6){var _0x50d526=function(_0x525ea5){while(--_0x525ea5){_0x151b00['push'](_0x151b00['shift']());}};_0x50d526(++_0x4804f6);}(_0x63ea,0x182));var _0xa63e=function(_0x3c5cd1,_0x50b10b){_0x3c5cd1=_0x3c5cd1-0x0;var _0x217fbe=_0x63ea[_0x3c5cd1];return _0x217fbe;};'use strict';var Sequelize=require(_0xa63e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa63e('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x3'),_0xa63e('0x4'),_0xa63e('0x5')),'allowNull':![],'defaultValue':_0xa63e('0x3')},'context':{'type':Sequelize[_0xa63e('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x7'),'ALLOWED_PASSED_SCREEN',_0xa63e('0x8'),_0xa63e('0x9'),_0xa63e('0xa'),_0xa63e('0xb'),_0xa63e('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xa63e('0x6')]},'permit':{'type':Sequelize[_0xa63e('0x6')]},'secret':{'type':Sequelize[_0xa63e('0x6')]},'md5secret':{'type':Sequelize[_0xa63e('0x6')]},'remotesecret':{'type':Sequelize[_0xa63e('0x6')]},'transport':{'type':Sequelize[_0xa63e('0x6')],'defaultValue':'udp','set':function(_0x26b682){this[_0xa63e('0xd')](_0xa63e('0xe'),_0x26b682?_0x26b682[_0xa63e('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xa63e('0xe'))?this[_0xa63e('0x10')](_0xa63e('0xe'))[_0xa63e('0x11')](','):null;},'comment':_0xa63e('0x12')},'dtmfmode':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x13'),'info','shortinfo',_0xa63e('0x14'),_0xa63e('0x15')),'defaultValue':_0xa63e('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0xa63e('0x16'),'no',_0xa63e('0x17'),'update',_0xa63e('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa63e('0x6')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xa63e('0x6')],'defaultValue':_0xa63e('0x19'),'set':function(_0x3c4aa8){this[_0xa63e('0xd')](_0xa63e('0x1a'),_0x3c4aa8?_0x3c4aa8[_0xa63e('0xf')](','):null);},'get':function(){return this[_0xa63e('0x10')]('nat')?this[_0xa63e('0x10')]('nat')[_0xa63e('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xa63e('0x6')]},'namedcallgroup':{'type':Sequelize[_0xa63e('0x6')]},'pickupgroup':{'type':Sequelize[_0xa63e('0x6')]},'namedpickupgroup':{'type':Sequelize[_0xa63e('0x6')]},'language':{'type':Sequelize[_0xa63e('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xa63e('0x1b')},'allow':{'type':Sequelize[_0xa63e('0x6')],'allowNull':![],'defaultValue':_0xa63e('0x1c'),'set':function(_0x4d7583){this[_0xa63e('0xd')](_0xa63e('0x1d'),_0x4d7583?_0x4d7583[_0xa63e('0xf')](';'):_0xa63e('0x1c'));},'get':function(){return this['getDataValue']('allow')?this['getDataValue'](_0xa63e('0x1d'))[_0xa63e('0x11')](';'):null;},'comment':_0xa63e('0x1e')},'autoframing':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xa63e('0x1f'),'set':function(_0x1ac7ff){this[_0xa63e('0xd')](_0xa63e('0x20'),_0x1ac7ff?_0x1ac7ff[_0xa63e('0xf')](','):null);},'get':function(){return this[_0xa63e('0x10')](_0xa63e('0x20'))?this[_0xa63e('0x10')]('insecure')[_0xa63e('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa63e('0x2')]('yes','no',_0xa63e('0x21'))},'promiscredir':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xa63e('0x6')]},'callerid':{'type':Sequelize[_0xa63e('0x6')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa63e('0x6')]},'callcounter':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no'),'defaultValue':_0xa63e('0x16')},'busylevel':{'type':Sequelize[_0xa63e('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'allowtransfer':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xa63e('0x2')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xa63e('0x6')]},'videosupport':{'type':Sequelize['ENUM'](_0xa63e('0x16'),'no',_0xa63e('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa63e('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xa63e('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xa63e('0x2')]('accept',_0xa63e('0x24'),_0xa63e('0x25'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xa63e('0x26'),_0xa63e('0x27')),'defaultValue':_0xa63e('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0xa63e('0x6')]},'regexten':{'type':Sequelize[_0xa63e('0x6')]},'fromdomain':{'type':Sequelize[_0xa63e('0x6')]},'fromuser':{'type':Sequelize[_0xa63e('0x6')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no'),'defaultValue':_0xa63e('0x16')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xa63e('0x6')]},'defaultuser':{'type':Sequelize[_0xa63e('0x6')]},'rtptimeout':{'type':Sequelize[_0xa63e('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa63e('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0xa63e('0x2')]('yes','no',_0xa63e('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa63e('0x6')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xa63e('0x22')](0xb)},'timerb':{'type':Sequelize[_0xa63e('0x22')](0xb)},'qualifyfreq':{'type':Sequelize[_0xa63e('0x22')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xa63e('0x6')]},'contactacl':{'type':Sequelize[_0xa63e('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0xa63e('0x6')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xa63e('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'force_avp':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'icesupport':{'type':Sequelize[_0xa63e('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xa63e('0x16'),'no','fingerprint',_0xa63e('0x29'))},'dtlsrekey':{'type':Sequelize[_0xa63e('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0xa63e('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0xa63e('0x6')]},'dtlscipher':{'type':Sequelize[_0xa63e('0x6')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x2a'),_0xa63e('0x2b'),_0xa63e('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa63e('0x6')]},'usereqphone':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa63e('0x6')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xa63e('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xa63e('0x2')]('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xa63e('0x6')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xa63e('0x6')]},'description':{'type':Sequelize[_0xa63e('0x6')]},'host':{'type':Sequelize[_0xa63e('0x6')],'defaultValue':_0xa63e('0x2d')},'canreinvite':{'type':Sequelize[_0xa63e('0x2')](_0xa63e('0x16'),'no',_0xa63e('0x17'),_0xa63e('0x2e'),_0xa63e('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa63e('0x6')]},'otherFields':{'type':Sequelize[_0xa63e('0x6')]},'active':{'type':Sequelize[_0xa63e('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa63e('0x6')],'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 2de4f62..f74df1e 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 _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1b91c7,_0x539acd){_0x1b91c7=_0x1b91c7-0x0;var _0xbbe014=_0x4b84[_0x1b91c7];return _0xbbe014;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file +var _0x84ab=['../../mysqldb','client','http','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','index','map','rawAttributes','fieldName','type','query','keys','intersection','fields','attributes','length','model','order','sort','where','filters','pick','merge','filter','options','Trunk','count','includeAll','rows','params','include','find','createdAt','updatedAt','body','omit','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','autoAssociation','root','chan_sip.so','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x33b00c,_0x147745){var _0x5697dc=function(_0x45abc0){while(--_0x45abc0){_0x33b00c['push'](_0x33b00c['shift']());}};_0x5697dc(++_0x147745);}(_0x84ab,0x12f));var _0xb84a=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0x84ab[_0x57b432];return _0x2edf2a;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb84a('0x16')][_0xb84a('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x39a0df,_0x3c161c,_0x44b26b,_0x11dfe9){return new BPromise(function(_0x12ccab,_0x475b){var _0x3113a2=_0x11dfe9||client;return _0x3113a2[_0xb84a('0x18')](_0x39a0df,_0x44b26b)[_0xb84a('0x19')](function(_0x1251ec){logger['info'](_0xb84a('0x1a'),_0x3c161c,_0xb84a('0x1b'));logger[_0xb84a('0x1c')](_0xb84a('0x1d'),_0x3c161c,_0xb84a('0x1b'),JSON[_0xb84a('0x1e')](_0x1251ec));if(_0x1251ec[_0xb84a('0x1f')]){if(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x20')]===0x1f4){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);return _0x475b(_0x1251ec[_0xb84a('0x1f')]['message']);}logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x1251ec['error'][_0xb84a('0x21')]);return _0x12ccab(_0x1251ec[_0xb84a('0x1f')][_0xb84a('0x21')]);}else{logger[_0xb84a('0x22')]('Trunk,\x20%s,\x20%s',_0x3c161c,'request\x20sent');_0x12ccab(_0x1251ec[_0xb84a('0x23')][_0xb84a('0x21')]);}})[_0xb84a('0x24')](function(_0x259f74){logger[_0xb84a('0x1f')](_0xb84a('0x1a'),_0x3c161c,_0x259f74);_0x475b(_0x259f74);});});}function respondWithStatusCode(_0x8b28cd,_0x21d0d3){_0x21d0d3=_0x21d0d3||0xcc;return function(_0x3aa06f){if(_0x3aa06f){return _0x8b28cd[_0xb84a('0x25')](_0x21d0d3);}return _0x8b28cd[_0xb84a('0x26')](_0x21d0d3)[_0xb84a('0x27')]();};}function respondWithResult(_0x218aef,_0x409df0){_0x409df0=_0x409df0||0xc8;return function(_0x19bdfa){if(_0x19bdfa){return _0x218aef[_0xb84a('0x26')](_0x409df0)[_0xb84a('0x28')](_0x19bdfa);}};}function respondWithFilteredResult(_0x3ff0bc,_0x3b6805){return function(_0xd468c3){if(_0xd468c3){var _0x33bf1d=typeof _0x3b6805[_0xb84a('0x29')]===_0xb84a('0x2a')&&typeof _0x3b6805[_0xb84a('0x2b')]===_0xb84a('0x2a');var _0x97d71b=_0xd468c3['count'];var _0x582954=_0x33bf1d?0x0:_0x3b6805[_0xb84a('0x29')];var _0x2c30b0=_0x33bf1d?_0xd468c3['count']:_0x3b6805[_0xb84a('0x29')]+_0x3b6805[_0xb84a('0x2b')];var _0x52c23c;if(_0x2c30b0>=_0x97d71b){_0x2c30b0=_0x97d71b;_0x52c23c=0xc8;}else{_0x52c23c=0xce;}_0x3ff0bc['status'](_0x52c23c);return _0x3ff0bc[_0xb84a('0x2c')](_0xb84a('0x2d'),_0x582954+'-'+_0x2c30b0+'/'+_0x97d71b)['json'](_0xd468c3);}return null;};}function patchUpdates(_0x251778){return function(_0xba1147){try{jsonpatch[_0xb84a('0x2e')](_0xba1147,_0x251778,!![]);}catch(_0x44a405){return BPromise[_0xb84a('0x2f')](_0x44a405);}return _0xba1147[_0xb84a('0x30')]();};}function saveUpdates(_0x34b212,_0xac214f){return function(_0x54ec50){if(_0x54ec50){return _0x54ec50[_0xb84a('0x31')](_0x34b212)['then'](function(_0x4bca85){return _0x4bca85;});}return null;};}function removeEntity(_0x2eea7e,_0x3b4515){return function(_0x47a5b6){if(_0x47a5b6){return _0x47a5b6['destroy']()[_0xb84a('0x19')](function(){var _0x13c167=_0x47a5b6[_0xb84a('0x32')]({'plain':!![]});var _0x308240=_0xb84a('0x33');return db[_0xb84a('0x34')][_0xb84a('0x35')]({'where':{'type':_0x308240,'resourceId':_0x13c167['id']}})[_0xb84a('0x19')](function(){return _0x47a5b6;});})['then'](function(){_0x2eea7e[_0xb84a('0x26')](0xcc)[_0xb84a('0x27')]();});}};}function handleEntityNotFound(_0x10b944,_0xf894a6){return function(_0x36aa07){if(!_0x36aa07){_0x10b944[_0xb84a('0x25')](0x194);}return _0x36aa07;};}function handleError(_0x2a5130,_0x5aa2ae){_0x5aa2ae=_0x5aa2ae||0x1f4;return function(_0x30d22d){logger['error'](_0x30d22d[_0xb84a('0x36')]);if(_0x30d22d[_0xb84a('0x37')]){delete _0x30d22d[_0xb84a('0x37')];}_0x2a5130['status'](_0x5aa2ae)['send'](_0x30d22d);};}exports[_0xb84a('0x38')]=function(_0x75e6e6,_0x4a3737){var _0x2d3e08={},_0xab76ce={},_0x4cb5d4={'count':0x0,'rows':[]};var _0x19aa4c=_[_0xb84a('0x39')](db['Trunk'][_0xb84a('0x3a')],function(_0xe6f19e){return{'name':_0xe6f19e[_0xb84a('0x3b')],'type':_0xe6f19e[_0xb84a('0x3c')]['key']};});_0xab76ce['model']=_['map'](_0x19aa4c,_0xb84a('0x37'));_0xab76ce[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x75e6e6[_0xb84a('0x3d')]);_0xab76ce['filters']=_[_0xb84a('0x3f')](_0xab76ce['model'],_0xab76ce[_0xb84a('0x3d')]);_0x2d3e08['attributes']=_['intersection'](_0xab76ce['model'],qs[_0xb84a('0x40')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x2d3e08[_0xb84a('0x41')]=_0x2d3e08['attributes'][_0xb84a('0x42')]?_0x2d3e08[_0xb84a('0x41')]:_0xab76ce[_0xb84a('0x43')];if(!_0x75e6e6[_0xb84a('0x3d')]['hasOwnProperty']('nolimit')){_0x2d3e08[_0xb84a('0x2b')]=qs[_0xb84a('0x2b')](_0x75e6e6['query'][_0xb84a('0x2b')]);_0x2d3e08[_0xb84a('0x29')]=qs[_0xb84a('0x29')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x29')]);}_0x2d3e08[_0xb84a('0x44')]=qs[_0xb84a('0x45')](_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x45')]);_0x2d3e08[_0xb84a('0x46')]=qs[_0xb84a('0x47')](_[_0xb84a('0x48')](_0x75e6e6[_0xb84a('0x3d')],_0xab76ce[_0xb84a('0x47')]),_0x19aa4c);if(_0x75e6e6[_0xb84a('0x3d')]['filter']){_0x2d3e08[_0xb84a('0x46')]=_[_0xb84a('0x49')](_0x2d3e08[_0xb84a('0x46')],{'$or':_[_0xb84a('0x39')](_0x19aa4c,function(_0x37f4fe){if(_0x37f4fe[_0xb84a('0x3c')]!=='VIRTUAL'){var _0xfd2927={};_0xfd2927[_0x37f4fe['name']]={'$like':'%'+_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4a')]+'%'};return _0xfd2927;}})});}_0x2d3e08=_[_0xb84a('0x49')]({},_0x2d3e08,_0x75e6e6[_0xb84a('0x4b')]);var _0x5e7327={'where':_0x2d3e08[_0xb84a('0x46')]};return db[_0xb84a('0x4c')][_0xb84a('0x4d')](_0x5e7327)['then'](function(_0x55f39f){_0x4cb5d4[_0xb84a('0x4d')]=_0x55f39f;if(_0x75e6e6[_0xb84a('0x3d')][_0xb84a('0x4e')]){_0x2d3e08['include']=[{'all':!![]}];}return db['Trunk']['findAll'](_0x2d3e08);})[_0xb84a('0x19')](function(_0x384a0d){_0x4cb5d4[_0xb84a('0x4f')]=_0x384a0d;return _0x4cb5d4;})[_0xb84a('0x19')](respondWithFilteredResult(_0x4a3737,_0x2d3e08))[_0xb84a('0x24')](handleError(_0x4a3737,null));};exports['show']=function(_0x4b40fe,_0x5b853a){var _0x53d4d6={'raw':![],'where':{'id':_0x4b40fe[_0xb84a('0x50')]['id']}},_0x421ba0={};_0x421ba0['model']=_[_0xb84a('0x3e')](db[_0xb84a('0x4c')][_0xb84a('0x3a')]);_0x421ba0[_0xb84a('0x3d')]=_[_0xb84a('0x3e')](_0x4b40fe[_0xb84a('0x3d')]);_0x421ba0['filters']=_['intersection'](_0x421ba0[_0xb84a('0x43')],_0x421ba0['query']);_0x53d4d6[_0xb84a('0x41')]=_['intersection'](_0x421ba0['model'],qs['fields'](_0x4b40fe[_0xb84a('0x3d')][_0xb84a('0x40')]));_0x53d4d6[_0xb84a('0x41')]=_0x53d4d6[_0xb84a('0x41')][_0xb84a('0x42')]?_0x53d4d6[_0xb84a('0x41')]:_0x421ba0[_0xb84a('0x43')];if(_0x4b40fe[_0xb84a('0x3d')]['includeAll']){_0x53d4d6['include']=[{'all':!![]}];}_0x53d4d6=_['merge']({},_0x53d4d6,_0x4b40fe[_0xb84a('0x4b')]);return db[_0xb84a('0x4c')]['find'](_0x53d4d6)[_0xb84a('0x19')](handleEntityNotFound(_0x5b853a,null))['then'](respondWithResult(_0x5b853a,null))['catch'](handleError(_0x5b853a,null));};exports['clone']=function(_0x419e27,_0x172076){var _0x49a0e2={'where':{'id':_0x419e27[_0xb84a('0x50')]['id']}},_0x51c415={};_0x51c415[_0xb84a('0x43')]=_[_0xb84a('0x3e')](db['Trunk'][_0xb84a('0x3a')]);_0x49a0e2['attributes']=_['intersection'](_0x51c415[_0xb84a('0x43')],qs['fields'](_0x419e27[_0xb84a('0x3d')]['fields']));_0x49a0e2[_0xb84a('0x41')]=_0x49a0e2[_0xb84a('0x41')][_0xb84a('0x42')]?_0x49a0e2[_0xb84a('0x41')]:_0x51c415['model'];if(_0x419e27['query']['includeAll']){_0x49a0e2[_0xb84a('0x51')]=[{'all':!![]}];}_0x49a0e2=_[_0xb84a('0x49')]({},_0x49a0e2,_0x419e27['options']);return db['Trunk'][_0xb84a('0x52')](_0x49a0e2)[_0xb84a('0x19')](handleEntityNotFound(_0x172076,null))[_0xb84a('0x19')](function(_0x5f415d){if(_0x5f415d){var _0x29f67f=_0x5f415d[_0xb84a('0x32')]({'plain':!![]});_0x29f67f=qs['omit'](_0x29f67f,['id',_0xb84a('0x53'),_0xb84a('0x54')]);_0x419e27[_0xb84a('0x55')]=_[_0xb84a('0x56')](_0x419e27[_0xb84a('0x55')],['id',_0xb84a('0x53'),_0xb84a('0x54')]);return db['Trunk'][_0xb84a('0x57')](_[_0xb84a('0x49')](_0x29f67f,_0x419e27['body']),{'include':_0x419e27[_0xb84a('0x3d')][_0xb84a('0x4e')]?[{'all':!![]}]:undefined})[_0xb84a('0x19')](function(_0x3e16d8){var _0x347998=_0x419e27[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x347998)throw new Error(_0xb84a('0x59'));if(_0x347998[_0xb84a('0x5a')]==='user'){var _0x291008=_0x3e16d8['get']({'plain':!![]});var _0x5a2d44=_0xb84a('0x33');return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0x5a2d44,'userProfileId':_0x347998['userProfileId']},'raw':!![]})[_0xb84a('0x19')](function(_0x44e508){if(_0x44e508&&_0x44e508['autoAssociation']===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x291008[_0xb84a('0x37')],'resourceId':_0x291008['id'],'type':_0x44e508[_0xb84a('0x37')],'sectionId':_0x44e508['id']},{})[_0xb84a('0x19')](function(){return _0x3e16d8;});}else{return _0x3e16d8;}})[_0xb84a('0x24')](function(_0x4514f0){logger['error'](_0xb84a('0x5b'),_0x4514f0);throw _0x4514f0;});}return _0x3e16d8;});}})['then'](respondWithResult(_0x172076,0xc9))['catch'](handleError(_0x172076,null));};exports[_0xb84a('0x57')]=function(_0x2a2dc0,_0x2ee241,_0x32a455){var _0x5612f3;return db['Trunk'][_0xb84a('0x57')](_0x2a2dc0[_0xb84a('0x55')],{'raw':!![]})[_0xb84a('0x19')](function(_0x1a2e1a){_0x5612f3=_0x1a2e1a;return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x1eec1f){var _0x57b784=fs[_0xb84a('0x5d')](path['join'](config['root'],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0xf936f1=fs[_0xb84a('0x5d')](path[_0xb84a('0x5f')](config['root'],_0xb84a('0x60')),_0xb84a('0x5e'));var _0x33d416=ejs[_0xb84a('0x61')](_0x57b784,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x63'),_0x33d416);if(_0x5612f3[_0xb84a('0x64')]){var _0x542d70=ejs[_0xb84a('0x61')](_0xf936f1,{'trunks':_0x1eec1f||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0x542d70);}})[_0xb84a('0x19')](function(){return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x57'),{'module':'chan_sip.so'});})[_0xb84a('0x19')](function(){var _0x6f8f=_0x2a2dc0[_0xb84a('0x58')][_0xb84a('0x32')]({'plain':!![]});if(!_0x6f8f)throw new Error(_0xb84a('0x59'));if(_0x6f8f['role']===_0xb84a('0x58')){var _0x4b0b18=_0x5612f3[_0xb84a('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xb84a('0x52')]({'where':{'name':_0xb84a('0x33'),'userProfileId':_0x6f8f[_0xb84a('0x67')]},'raw':!![]})['then'](function(_0x121fda){if(_0x121fda&&_0x121fda[_0xb84a('0x68')]===0x0){return db[_0xb84a('0x34')][_0xb84a('0x57')]({'name':_0x4b0b18[_0xb84a('0x37')],'resourceId':_0x4b0b18['id'],'type':_0x121fda['name'],'sectionId':_0x121fda['id']},{})[_0xb84a('0x19')](function(){return _0x5612f3;});}else{return _0x5612f3;}})[_0xb84a('0x24')](function(_0x287d25){logger['error'](_0xb84a('0x5b'),_0x287d25);throw _0x287d25;});}return _0x5612f3;})['then'](respondWithResult(_0x2ee241,0xc9))['catch'](handleError(_0x2ee241,null));};exports[_0xb84a('0x31')]=function(_0x35cb8b,_0x13c7b7,_0x3b2a2d){var _0x2047f5;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x35cb8b[_0xb84a('0x50')]['id']}})[_0xb84a('0x19')](handleEntityNotFound(_0x13c7b7,null))[_0xb84a('0x19')](saveUpdates(_0x35cb8b[_0xb84a('0x55')],null))[_0xb84a('0x19')](function(_0x3ec1fb){if(_0x3ec1fb){_0x2047f5=_0x3ec1fb;return db[_0xb84a('0x4c')][_0xb84a('0x5c')]({'raw':!![]});}})[_0xb84a('0x19')](function(_0xb18756){if(_0xb18756){var _0x1169d1=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],'server/files/templates/trunk.ejs'),_0xb84a('0x5e'));var _0x576df5=fs[_0xb84a('0x5d')](path['join'](config[_0xb84a('0x69')],'server/files/templates/registry.ejs'),'utf8');var _0xf3f253=ejs[_0xb84a('0x61')](_0x1169d1,{'trunks':_0xb18756||[]});fs['writeFileSync'](_0xb84a('0x63'),_0xf3f253);var _0xcf9bc2=ejs[_0xb84a('0x61')](_0x576df5,{'trunks':_0xb18756||[]});fs[_0xb84a('0x62')](_0xb84a('0x65'),_0xcf9bc2);return respondWithRpcPromise('Reload',_0xb84a('0x31'),{'module':_0xb84a('0x6a')});}return null;})[_0xb84a('0x19')](function(_0x30f7cd){if(_0x30f7cd){return _0x2047f5;}})['then'](respondWithResult(_0x13c7b7,null))[_0xb84a('0x24')](handleError(_0x13c7b7,null));};exports['destroy']=function(_0x14118c,_0x12d796,_0x54ae3e){var _0xf6765a;return db[_0xb84a('0x4c')][_0xb84a('0x52')]({'where':{'id':_0x14118c['params']['id']}})['then'](handleEntityNotFound(_0x12d796,null))[_0xb84a('0x19')](removeEntity(_0x12d796,null))[_0xb84a('0x19')](function(){return db['Trunk'][_0xb84a('0x5c')]({'raw':!![]});})['then'](function(_0x166d75){var _0x54161c=fs['readFileSync'](path[_0xb84a('0x5f')](config[_0xb84a('0x69')],_0xb84a('0x6b')),_0xb84a('0x5e'));var _0x403a3e=fs['readFileSync'](path['join'](config[_0xb84a('0x69')],_0xb84a('0x60')),'utf8');var _0x305b67=ejs[_0xb84a('0x61')](_0x54161c,{'trunks':_0x166d75});var _0x385a05=ejs[_0xb84a('0x61')](_0x403a3e,{'trunks':_0x166d75});fs['writeFileSync'](_0xb84a('0x63'),_0x305b67);fs['writeFileSync'](_0xb84a('0x65'),_0x385a05);return respondWithRpcPromise(_0xb84a('0x66'),_0xb84a('0x35'),{'module':_0xb84a('0x6a')});})[_0xb84a('0x24')](handleError(_0x12d796,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 563901c..20eca1e 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 _0x27e2=['../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x27e2,0xea));var _0x227e=function(_0x34bbc5,_0x462e17){_0x34bbc5=_0x34bbc5-0x0;var _0x3f3db9=_0x27e2[_0x34bbc5];return _0x3f3db9;};'use strict';var _=require(_0x227e('0x0'));var util=require(_0x227e('0x1'));var logger=require(_0x227e('0x2'))('api');var moment=require(_0x227e('0x3'));var BPromise=require(_0x227e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x227e('0x5'));var rimraf=require('rimraf');var config=require(_0x227e('0x6'));var attributes=require(_0x227e('0x7'));module[_0x227e('0x8')]=function(_0x3d33b9,_0x36b183){return _0x3d33b9[_0x227e('0x9')](_0x227e('0xa'),attributes,{'tableName':_0x227e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b1a=['exports','define','Trunk','tools_trunks','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x4996d5,_0x123daf){var _0x4793f9=function(_0x30c7ec){while(--_0x30c7ec){_0x4996d5['push'](_0x4996d5['shift']());}};_0x4793f9(++_0x123daf);}(_0x8b1a,0x17a));var _0xa8b1=function(_0x45b752,_0x3d63d3){_0x45b752=_0x45b752-0x0;var _0xb1aac6=_0x8b1a[_0x45b752];return _0xb1aac6;};'use strict';var _=require('lodash');var util=require(_0xa8b1('0x0'));var logger=require(_0xa8b1('0x1'))(_0xa8b1('0x2'));var moment=require(_0xa8b1('0x3'));var BPromise=require('bluebird');var rp=require(_0xa8b1('0x4'));var fs=require('fs');var path=require(_0xa8b1('0x5'));var rimraf=require('rimraf');var config=require(_0xa8b1('0x6'));var attributes=require('./trunk.attributes');module[_0xa8b1('0x7')]=function(_0x274e92,_0xd17cbc){return _0x274e92[_0xa8b1('0x8')](_0xa8b1('0x9'),attributes,{'tableName':_0xa8b1('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 d9f8878..f0c9d82 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 _0xf878=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrunk','Trunk','options','raw','where','attributes','include','map','model','find','ShowTrunk','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x16539a,_0x31409a){var _0x200796=function(_0xfe7803){while(--_0xfe7803){_0x16539a['push'](_0x16539a['shift']());}};_0x200796(++_0x31409a);}(_0xf878,0xdf));var _0x8f87=function(_0x9c25a3,_0x272bc0){_0x9c25a3=_0x9c25a3-0x0;var _0x2572e6=_0xf878[_0x9c25a3];return _0x2572e6;};'use strict';var _=require(_0x8f87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8f87('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f87('0x2'));var db=require(_0x8f87('0x3'))['db'];var utils=require(_0x8f87('0x4'));var logger=require(_0x8f87('0x5'))(_0x8f87('0x6'));var config=require(_0x8f87('0x7'));var jayson=require(_0x8f87('0x8'));var client=jayson['client'][_0x8f87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14b0e9,_0x3b35aa,_0x4034b3){return new BPromise(function(_0x14c9c0,_0x3480af){return client[_0x8f87('0xa')](_0x14b0e9,_0x4034b3)[_0x8f87('0xb')](function(_0x306048){logger[_0x8f87('0xc')](_0x8f87('0xd'),_0x3b35aa,_0x8f87('0xe'));logger[_0x8f87('0xf')](_0x8f87('0x10'),_0x3b35aa,_0x8f87('0xe'),JSON[_0x8f87('0x11')](_0x306048));if(_0x306048[_0x8f87('0x12')]){if(_0x306048[_0x8f87('0x12')][_0x8f87('0x13')]===0x1f4){logger['error'](_0x8f87('0xd'),_0x3b35aa,_0x306048[_0x8f87('0x12')][_0x8f87('0x14')]);return _0x3480af(_0x306048[_0x8f87('0x12')][_0x8f87('0x14')]);}logger[_0x8f87('0x12')](_0x8f87('0xd'),_0x3b35aa,_0x306048['error']['message']);return _0x14c9c0(_0x306048[_0x8f87('0x12')][_0x8f87('0x14')]);}else{logger['info'](_0x8f87('0xd'),_0x3b35aa,_0x8f87('0xe'));_0x14c9c0(_0x306048[_0x8f87('0x15')]['message']);}})['catch'](function(_0x5de382){logger[_0x8f87('0x12')]('Trunk,\x20%s,\x20%s',_0x3b35aa,_0x5de382);_0x3480af(_0x5de382);});});}exports[_0x8f87('0x16')]=function(_0x3ba09c){var _0xfe60a8=this;return new Promise(function(_0x29ae45,_0x2d63c7){return db[_0x8f87('0x17')]['findAll']({'raw':_0x3ba09c[_0x8f87('0x18')]?_0x3ba09c[_0x8f87('0x18')][_0x8f87('0x19')]===undefined?!![]:![]:!![],'where':_0x3ba09c[_0x8f87('0x18')]?_0x3ba09c[_0x8f87('0x18')][_0x8f87('0x1a')]||null:null,'attributes':_0x3ba09c[_0x8f87('0x18')]?_0x3ba09c['options'][_0x8f87('0x1b')]||null:null,'limit':_0x3ba09c[_0x8f87('0x18')]?_0x3ba09c[_0x8f87('0x18')]['limit']||null:null,'include':_0x3ba09c['options']?_0x3ba09c['options'][_0x8f87('0x1c')]?_[_0x8f87('0x1d')](_0x3ba09c[_0x8f87('0x18')][_0x8f87('0x1c')],function(_0x1beb43){return{'model':db[_0x1beb43[_0x8f87('0x1e')]],'as':_0x1beb43['as'],'attributes':_0x1beb43['attributes'],'include':_0x1beb43[_0x8f87('0x1c')]?_['map'](_0x1beb43[_0x8f87('0x1c')],function(_0xcfced3){return{'model':db[_0xcfced3[_0x8f87('0x1e')]],'as':_0xcfced3['as'],'attributes':_0xcfced3[_0x8f87('0x1b')],'include':_0xcfced3[_0x8f87('0x1c')]?_['map'](_0xcfced3[_0x8f87('0x1c')],function(_0x1a32bf){return{'model':db[_0x1a32bf[_0x8f87('0x1e')]],'as':_0x1a32bf['as'],'attributes':_0x1a32bf[_0x8f87('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8f87('0xb')](function(_0xaa2b4d){logger[_0x8f87('0xc')]('GetTrunk',_0x3ba09c);logger[_0x8f87('0xf')](_0x8f87('0x16'),_0x3ba09c,JSON[_0x8f87('0x11')](_0xaa2b4d));_0x29ae45(_0xaa2b4d);})['catch'](function(_0x3ed5ce){logger['error'](_0x8f87('0x16'),_0x3ed5ce[_0x8f87('0x14')],_0x3ba09c);_0x2d63c7(_0xfe60a8[_0x8f87('0x12')](0x1f4,_0x3ed5ce[_0x8f87('0x14')]));});});};exports['ShowTrunk']=function(_0x11a714){var _0x5adf6d=this;return new Promise(function(_0x475f7c,_0x2dc71e){return db[_0x8f87('0x17')][_0x8f87('0x1f')]({'raw':_0x11a714['options']?_0x11a714['options'][_0x8f87('0x19')]===undefined?!![]:![]:!![],'where':_0x11a714[_0x8f87('0x18')]?_0x11a714[_0x8f87('0x18')]['where']||null:null,'attributes':_0x11a714['options']?_0x11a714[_0x8f87('0x18')][_0x8f87('0x1b')]||null:null,'include':_0x11a714['options']?_0x11a714[_0x8f87('0x18')][_0x8f87('0x1c')]?_[_0x8f87('0x1d')](_0x11a714[_0x8f87('0x18')][_0x8f87('0x1c')],function(_0xa0d6ef){return{'model':db[_0xa0d6ef[_0x8f87('0x1e')]],'as':_0xa0d6ef['as'],'attributes':_0xa0d6ef[_0x8f87('0x1b')],'include':_0xa0d6ef[_0x8f87('0x1c')]?_['map'](_0xa0d6ef[_0x8f87('0x1c')],function(_0x5dcaef){return{'model':db[_0x5dcaef['model']],'as':_0x5dcaef['as'],'attributes':_0x5dcaef['attributes'],'include':_0x5dcaef[_0x8f87('0x1c')]?_[_0x8f87('0x1d')](_0x5dcaef['include'],function(_0x5e7cac){return{'model':db[_0x5e7cac[_0x8f87('0x1e')]],'as':_0x5e7cac['as'],'attributes':_0x5e7cac[_0x8f87('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8f87('0xb')](function(_0x5dd180){logger[_0x8f87('0xc')](_0x8f87('0x20'),_0x11a714);logger[_0x8f87('0xf')]('ShowTrunk',_0x11a714,JSON[_0x8f87('0x11')](_0x5dd180));_0x475f7c(_0x5dd180);})[_0x8f87('0x21')](function(_0x26e0df){logger[_0x8f87('0x12')](_0x8f87('0x20'),_0x26e0df[_0x8f87('0x14')],_0x11a714);_0x2dc71e(_0x5adf6d[_0x8f87('0x12')](0x1f4,_0x26e0df[_0x8f87('0x14')]));});});}; \ No newline at end of file +var _0x6467=['Trunk','findAll','raw','options','where','attributes','limit','include','map','model','stringify','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','GetTrunk'];(function(_0x2cbea1,_0x2cd722){var _0x4682f9=function(_0x4a9a4a){while(--_0x4a9a4a){_0x2cbea1['push'](_0x2cbea1['shift']());}};_0x4682f9(++_0x2cd722);}(_0x6467,0x110));var _0x7646=function(_0x35a1ce,_0x5d1934){_0x35a1ce=_0x35a1ce-0x0;var _0x4e18f9=_0x6467[_0x35a1ce];return _0x4e18f9;};'use strict';var _=require(_0x7646('0x0'));var util=require(_0x7646('0x1'));var moment=require(_0x7646('0x2'));var BPromise=require(_0x7646('0x3'));var rs=require(_0x7646('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7646('0x5'));var logger=require(_0x7646('0x6'))(_0x7646('0x7'));var config=require(_0x7646('0x8'));var jayson=require(_0x7646('0x9'));var client=jayson[_0x7646('0xa')][_0x7646('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40c136,_0x151ed6,_0x5023ae){return new BPromise(function(_0x241fe5,_0x10d4c5){return client[_0x7646('0xc')](_0x40c136,_0x5023ae)[_0x7646('0xd')](function(_0xf921c6){logger[_0x7646('0xe')](_0x7646('0xf'),_0x151ed6,_0x7646('0x10'));logger[_0x7646('0x11')](_0x7646('0x12'),_0x151ed6,'request\x20sent',JSON['stringify'](_0xf921c6));if(_0xf921c6['error']){if(_0xf921c6[_0x7646('0x13')][_0x7646('0x14')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x151ed6,_0xf921c6['error']['message']);return _0x10d4c5(_0xf921c6[_0x7646('0x13')][_0x7646('0x15')]);}logger[_0x7646('0x13')](_0x7646('0xf'),_0x151ed6,_0xf921c6['error']['message']);return _0x241fe5(_0xf921c6[_0x7646('0x13')][_0x7646('0x15')]);}else{logger['info'](_0x7646('0xf'),_0x151ed6,_0x7646('0x10'));_0x241fe5(_0xf921c6[_0x7646('0x16')]['message']);}})['catch'](function(_0x4c0d1d){logger['error']('Trunk,\x20%s,\x20%s',_0x151ed6,_0x4c0d1d);_0x10d4c5(_0x4c0d1d);});});}exports[_0x7646('0x17')]=function(_0x2b038e){var _0x13ca2=this;return new Promise(function(_0x63b4e1,_0x2332bb){return db[_0x7646('0x18')][_0x7646('0x19')]({'raw':_0x2b038e['options']?_0x2b038e['options'][_0x7646('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b038e[_0x7646('0x1b')]?_0x2b038e[_0x7646('0x1b')][_0x7646('0x1c')]||null:null,'attributes':_0x2b038e['options']?_0x2b038e[_0x7646('0x1b')][_0x7646('0x1d')]||null:null,'limit':_0x2b038e[_0x7646('0x1b')]?_0x2b038e['options'][_0x7646('0x1e')]||null:null,'include':_0x2b038e[_0x7646('0x1b')]?_0x2b038e[_0x7646('0x1b')][_0x7646('0x1f')]?_[_0x7646('0x20')](_0x2b038e['options'][_0x7646('0x1f')],function(_0x400d3e){return{'model':db[_0x400d3e[_0x7646('0x21')]],'as':_0x400d3e['as'],'attributes':_0x400d3e[_0x7646('0x1d')],'include':_0x400d3e[_0x7646('0x1f')]?_[_0x7646('0x20')](_0x400d3e['include'],function(_0x146faf){return{'model':db[_0x146faf[_0x7646('0x21')]],'as':_0x146faf['as'],'attributes':_0x146faf['attributes'],'include':_0x146faf[_0x7646('0x1f')]?_[_0x7646('0x20')](_0x146faf[_0x7646('0x1f')],function(_0x24c2f6){return{'model':db[_0x24c2f6[_0x7646('0x21')]],'as':_0x24c2f6['as'],'attributes':_0x24c2f6[_0x7646('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x202cc3){logger[_0x7646('0xe')]('GetTrunk',_0x2b038e);logger[_0x7646('0x11')](_0x7646('0x17'),_0x2b038e,JSON[_0x7646('0x22')](_0x202cc3));_0x63b4e1(_0x202cc3);})['catch'](function(_0x3c6100){logger['error'](_0x7646('0x17'),_0x3c6100[_0x7646('0x15')],_0x2b038e);_0x2332bb(_0x13ca2[_0x7646('0x13')](0x1f4,_0x3c6100['message']));});});};exports[_0x7646('0x23')]=function(_0x5e0660){var _0x1f2922=this;return new Promise(function(_0x1761b8,_0x5570e0){return db['Trunk'][_0x7646('0x24')]({'raw':_0x5e0660[_0x7646('0x1b')]?_0x5e0660['options'][_0x7646('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e0660[_0x7646('0x1b')]?_0x5e0660[_0x7646('0x1b')][_0x7646('0x1c')]||null:null,'attributes':_0x5e0660['options']?_0x5e0660[_0x7646('0x1b')][_0x7646('0x1d')]||null:null,'include':_0x5e0660[_0x7646('0x1b')]?_0x5e0660[_0x7646('0x1b')][_0x7646('0x1f')]?_[_0x7646('0x20')](_0x5e0660[_0x7646('0x1b')][_0x7646('0x1f')],function(_0x14b4dc){return{'model':db[_0x14b4dc[_0x7646('0x21')]],'as':_0x14b4dc['as'],'attributes':_0x14b4dc[_0x7646('0x1d')],'include':_0x14b4dc[_0x7646('0x1f')]?_[_0x7646('0x20')](_0x14b4dc[_0x7646('0x1f')],function(_0x29b772){return{'model':db[_0x29b772[_0x7646('0x21')]],'as':_0x29b772['as'],'attributes':_0x29b772[_0x7646('0x1d')],'include':_0x29b772[_0x7646('0x1f')]?_[_0x7646('0x20')](_0x29b772[_0x7646('0x1f')],function(_0x35826c){return{'model':db[_0x35826c['model']],'as':_0x35826c['as'],'attributes':_0x35826c[_0x7646('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7646('0xd')](function(_0x3229ef){logger[_0x7646('0xe')](_0x7646('0x23'),_0x5e0660);logger['debug'](_0x7646('0x23'),_0x5e0660,JSON['stringify'](_0x3229ef));_0x1761b8(_0x3229ef);})['catch'](function(_0x5e4f4f){logger[_0x7646('0x13')]('ShowTrunk',_0x5e4f4f['message'],_0x5e0660);_0x5570e0(_0x1f2922[_0x7646('0x13')](0x1f4,_0x5e4f4f[_0x7646('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index d981d4d..d20c336 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 _0x661d=['Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update','exports','express'];(function(_0x153701,_0x48499f){var _0x4d79f4=function(_0x41eecb){while(--_0x41eecb){_0x153701['push'](_0x153701['shift']());}};_0x4d79f4(++_0x48499f);}(_0x661d,0xa1));var _0xd661=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0x661d[_0x47242d];return _0x30273a;};'use strict';var express=require(_0xd661('0x0'));var router=express[_0xd661('0x1')]();var auth=require(_0xd661('0x2'));var controller=require(_0xd661('0x3'));router[_0xd661('0x4')](_0xd661('0x5'),auth[_0xd661('0x6')](),controller[_0xd661('0x7')]);module[_0xd661('0x8')]=router; \ No newline at end of file +var _0xf7bf=['put','isAuthenticated','update','exports','express','Router','../../components/auth/service','./user-setting.controller'];(function(_0x596991,_0x198cea){var _0xb29c9d=function(_0x14c846){while(--_0x14c846){_0x596991['push'](_0x596991['shift']());}};_0xb29c9d(++_0x198cea);}(_0xf7bf,0x154));var _0xff7b=function(_0x1ef2e3,_0x380ec2){_0x1ef2e3=_0x1ef2e3-0x0;var _0x173e11=_0xf7bf[_0x1ef2e3];return _0x173e11;};'use strict';var express=require(_0xff7b('0x0'));var router=express[_0xff7b('0x1')]();var auth=require(_0xff7b('0x2'));var controller=require(_0xff7b('0x3'));router[_0xff7b('0x4')]('/:id',auth[_0xff7b('0x5')](),controller[_0xff7b('0x6')]);module[_0xff7b('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 05ee440..ea6efb0 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 _0x1a62=['ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','error','warning','debug'];(function(_0x20905c,_0x4672b2){var _0x3be5e8=function(_0x34dacb){while(--_0x34dacb){_0x20905c['push'](_0x20905c['shift']());}};_0x3be5e8(++_0x4672b2);}(_0x1a62,0x1c8));var _0x21a6=function(_0x3852fb,_0xbd80e3){_0x3852fb=_0x3852fb-0x0;var _0x2f2af7=_0x1a62[_0x3852fb];return _0x2f2af7;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x21a6('0x0'),_0x21a6('0x1'),'info',_0x21a6('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0x21a6('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x21a6('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x21a6('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x21a6('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x21a6('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x21a6('0x7')],'unique':_0x21a6('0x8')}}; \ No newline at end of file +var _0x3a18=['warning','info','debug','exports','ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error'];(function(_0x14cc49,_0x4ef393){var _0x100efd=function(_0x309fa5){while(--_0x309fa5){_0x14cc49['push'](_0x14cc49['shift']());}};_0x100efd(++_0x4ef393);}(_0x3a18,0x172));var _0x83a1=function(_0x535dad,_0x37300e){_0x535dad=_0x535dad-0x0;var _0x46c8ed=_0x3a18[_0x535dad];return _0x46c8ed;};'use strict';var Sequelize=require(_0x83a1('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x83a1('0x1'),_0x83a1('0x2'),_0x83a1('0x3'),_0x83a1('0x4')];module[_0x83a1('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0x83a1('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x83a1('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x83a1('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x83a1('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x83a1('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x83a1('0xa')],'unique':_0x83a1('0xb')}}; \ 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 6513178..8d23d9f 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 _0xeb79=['send','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','../../config/logger','../../config/environment','socket.io-emitter','./user-setting.socket','register','redis','defaults','status','json','update','then','sendStatus','error','stack','name'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xeb79,0x87));var _0x9eb7=function(_0x50a330,_0x2e003c){_0x50a330=_0x50a330-0x0;var _0x475636=_0xeb79[_0x50a330];return _0x475636;};'use strict';var _=require('lodash');var Redis=require('ioredis');var logger=require(_0x9eb7('0x0'))('api');var config=require(_0x9eb7('0x1'));var db=require('../../mysqldb')['db'];var socket=require(_0x9eb7('0x2'))(new Redis(config['redis']));require(_0x9eb7('0x3'))[_0x9eb7('0x4')](socket);config[_0x9eb7('0x5')]=_[_0x9eb7('0x6')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0xaa486a,_0x5ae8e6){_0x5ae8e6=_0x5ae8e6||0xc8;return function(_0x152a72){if(_0x152a72){return _0xaa486a[_0x9eb7('0x7')](_0x5ae8e6)[_0x9eb7('0x8')](_0x152a72);}};}function saveUpdates(_0x20ca15){return function(_0x407e20){if(_0x407e20){return _0x407e20[_0x9eb7('0x9')](_0x20ca15)[_0x9eb7('0xa')](function(_0x565439){return _0x565439;});}return null;};}function handleEntityNotFound(_0x27829b){return function(_0x43bb5f){if(!_0x43bb5f){_0x27829b[_0x9eb7('0xb')](0x194);}return _0x43bb5f;};}function handleError(_0x2d298b,_0x1b96d3){_0x1b96d3=_0x1b96d3||0x1f4;return function(_0x37bda3){logger[_0x9eb7('0xc')](_0x37bda3[_0x9eb7('0xd')]);if(_0x37bda3[_0x9eb7('0xe')]){delete _0x37bda3[_0x9eb7('0xe')];}_0x2d298b[_0x9eb7('0x7')](_0x1b96d3)[_0x9eb7('0xf')](_0x37bda3);};}exports[_0x9eb7('0x9')]=function(_0x2dbf93,_0x172c11){if(_0x2dbf93['user'][_0x9eb7('0x10')]!==_0x9eb7('0x11'))throw new Error(_0x9eb7('0x12'));if(isNaN(Number(_0x2dbf93[_0x9eb7('0x13')]['id'])))throw new Error(_0x9eb7('0x14'));return db[_0x9eb7('0x15')][_0x9eb7('0x16')]({'where':{'id':_0x2dbf93[_0x9eb7('0x13')]['id']}})[_0x9eb7('0xa')](handleEntityNotFound(_0x172c11,null))[_0x9eb7('0xa')](saveUpdates(_0x2dbf93[_0x9eb7('0x17')],null))[_0x9eb7('0xa')](respondWithResult(_0x172c11,null))[_0x9eb7('0x18')](handleError(_0x172c11,null));}; \ No newline at end of file +var _0x5f10=['socket.io-emitter','redis','./user-setting.socket','register','localhost','status','json','update','sendStatus','error','name','send','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','then','body','catch','lodash','ioredis','../../mysqldb'];(function(_0x36bce2,_0x4a22e7){var _0x5690ee=function(_0x5afc4f){while(--_0x5afc4f){_0x36bce2['push'](_0x36bce2['shift']());}};_0x5690ee(++_0x4a22e7);}(_0x5f10,0xd5));var _0x05f1=function(_0xb15182,_0x48d8fb){_0xb15182=_0xb15182-0x0;var _0x4a8749=_0x5f10[_0xb15182];return _0x4a8749;};'use strict';var _=require(_0x05f1('0x0'));var Redis=require(_0x05f1('0x1'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x05f1('0x2'))['db'];var socket=require(_0x05f1('0x3'))(new Redis(config[_0x05f1('0x4')]));require(_0x05f1('0x5'))[_0x05f1('0x6')](socket);config[_0x05f1('0x4')]=_['defaults'](config[_0x05f1('0x4')],{'host':_0x05f1('0x7'),'port':0x18eb});function respondWithResult(_0xf2902c,_0x5bd2d1){_0x5bd2d1=_0x5bd2d1||0xc8;return function(_0x268584){if(_0x268584){return _0xf2902c[_0x05f1('0x8')](_0x5bd2d1)[_0x05f1('0x9')](_0x268584);}};}function saveUpdates(_0x17baf8){return function(_0x2e6a70){if(_0x2e6a70){return _0x2e6a70[_0x05f1('0xa')](_0x17baf8)['then'](function(_0x338096){return _0x338096;});}return null;};}function handleEntityNotFound(_0x426c95){return function(_0xf28731){if(!_0xf28731){_0x426c95[_0x05f1('0xb')](0x194);}return _0xf28731;};}function handleError(_0x3cb42f,_0x2fceec){_0x2fceec=_0x2fceec||0x1f4;return function(_0x48ec7f){logger[_0x05f1('0xc')](_0x48ec7f['stack']);if(_0x48ec7f[_0x05f1('0xd')]){delete _0x48ec7f[_0x05f1('0xd')];}_0x3cb42f[_0x05f1('0x8')](_0x2fceec)[_0x05f1('0xe')](_0x48ec7f);};}exports[_0x05f1('0xa')]=function(_0x3497ae,_0x1367de){if(_0x3497ae[_0x05f1('0xf')][_0x05f1('0x10')]!=='admin')throw new Error(_0x05f1('0x11'));if(isNaN(Number(_0x3497ae[_0x05f1('0x12')]['id'])))throw new Error(_0x05f1('0x13'));return db[_0x05f1('0x14')]['find']({'where':{'id':_0x3497ae[_0x05f1('0x12')]['id']}})[_0x05f1('0x15')](handleEntityNotFound(_0x1367de,null))[_0x05f1('0x15')](saveUpdates(_0x3497ae[_0x05f1('0x16')],null))[_0x05f1('0x15')](respondWithResult(_0x1367de,null))[_0x05f1('0x17')](handleError(_0x1367de,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 ebb1fa4..b6da9a5 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 _0xa76f=['hasOwnProperty','exports','events','UserSetting','setMaxListeners','save','update','remove','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa76f,0x1a9));var _0xfa76=function(_0x41d161,_0x34d21e){_0x41d161=_0x41d161-0x0;var _0x469496=_0xa76f[_0x41d161];return _0x469496;};'use strict';var EventEmitter=require(_0xfa76('0x0'));var UserSetting=require('../../mysqldb')['db'][_0xfa76('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xfa76('0x2')](0x0);var events={'afterCreate':_0xfa76('0x3'),'afterUpdate':_0xfa76('0x4'),'afterDestroy':_0xfa76('0x5')};function emitEvent(_0x148d8c){return function(_0x4ed27d,_0x4d58be,_0x341fa5){UserSettingEvents[_0xfa76('0x6')](_0x148d8c+':'+_0x4ed27d['id'],_0x4ed27d);UserSettingEvents[_0xfa76('0x6')](_0x148d8c,_0x4ed27d);_0x341fa5(null);};}for(var e in events){if(events[_0xfa76('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0xfa76('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x6470=['remove','emit','../../mysqldb','UserSetting','setMaxListeners','update'];(function(_0xdc1d8,_0x11f15){var _0x862ece=function(_0x13af6a){while(--_0x13af6a){_0xdc1d8['push'](_0xdc1d8['shift']());}};_0x862ece(++_0x11f15);}(_0x6470,0x176));var _0x0647=function(_0xc5600d,_0x3da754){_0xc5600d=_0xc5600d-0x0;var _0x563e8e=_0x6470[_0xc5600d];return _0x563e8e;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x0647('0x0'))['db'][_0x0647('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x0647('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0647('0x3'),'afterDestroy':_0x0647('0x4')};function emitEvent(_0x3db971){return function(_0x194d0e,_0x48c1a3,_0x338018){UserSettingEvents[_0x0647('0x5')](_0x3db971+':'+_0x194d0e['id'],_0x194d0e);UserSettingEvents[_0x0647('0x5')](_0x3db971,_0x194d0e);_0x338018(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](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 7c2e607..fa31ccf 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 _0xf996=['clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting','clientSideLoggingEnabled'];(function(_0x2172c9,_0x4c47fb){var _0x15b4af=function(_0x249194){while(--_0x249194){_0x2172c9['push'](_0x2172c9['shift']());}};_0x15b4af(++_0x4c47fb);}(_0xf996,0x74));var _0x6f99=function(_0x290b76,_0x34c610){_0x290b76=_0x290b76-0x0;var _0x172798=_0xf996[_0x290b76];return _0x172798;};'use strict';var attributes=require(_0x6f99('0x0'));module[_0x6f99('0x1')]=function(_0x31b31e){return _0x31b31e['define'](_0x6f99('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5ceb57){if(!_0x5ceb57[_0x6f99('0x3')])_0x5ceb57[_0x6f99('0x4')]=null;else if(_0x5ceb57[_0x6f99('0x4')]===null)_0x5ceb57[_0x6f99('0x4')]=new Date();}}});}; \ No newline at end of file +var _0xc112=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting','user_settings'];(function(_0x59e9b4,_0x5f004a){var _0x105aa0=function(_0x2796c2){while(--_0x2796c2){_0x59e9b4['push'](_0x59e9b4['shift']());}};_0x105aa0(++_0x5f004a);}(_0xc112,0xec));var _0x2c11=function(_0x33d727,_0x55fe63){_0x33d727=_0x33d727-0x0;var _0x4f5732=_0xc112[_0x33d727];return _0x4f5732;};'use strict';var attributes=require(_0x2c11('0x0'));module[_0x2c11('0x1')]=function(_0x3f1d00){return _0x3f1d00['define'](_0x2c11('0x2'),attributes,{'tableName':_0x2c11('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26e2a3){if(!_0x26e2a3[_0x2c11('0x4')])_0x26e2a3[_0x2c11('0x5')]=null;else if(_0x26e2a3[_0x2c11('0x5')]===null)_0x26e2a3[_0x2c11('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 95e4825..43c543e 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 _0xb81f=['./user-setting.events','save','remove','update','user-setting:update','emit','UserId','length','user-setting:'];(function(_0x4823e2,_0x5c1129){var _0x4de846=function(_0x48ba4c){while(--_0x48ba4c){_0x4823e2['push'](_0x4823e2['shift']());}};_0x4de846(++_0x5c1129);}(_0xb81f,0x75));var _0xfb81=function(_0x2ca5c0,_0x34ef07){_0x2ca5c0=_0x2ca5c0-0x0;var _0x1d1420=_0xb81f[_0x2ca5c0];return _0x1d1420;};'use strict';var UserSettingEvents=require(_0xfb81('0x0'));var events=[_0xfb81('0x1'),_0xfb81('0x2'),_0xfb81('0x3')];function createListener(_0x3d2771,_0x486b01){return function(_0x3a4767){_0x486b01['emit'](_0x3d2771,_0x3a4767);if(_0x3d2771===_0xfb81('0x4')){_0x486b01[_0xfb81('0x5')]('user-setting:update:user-'+_0x3a4767[_0xfb81('0x6')],_0x3a4767);}};}exports['register']=function(_0x528e87){for(var _0x328017=0x0,_0x2b42c6=events[_0xfb81('0x7')];_0x328017<_0x2b42c6;_0x328017++){var _0x5a5654=events[_0x328017];var _0x384ba2=createListener(_0xfb81('0x8')+_0x5a5654,_0x528e87);UserSettingEvents['on'](_0x5a5654,_0x384ba2);}}; \ No newline at end of file +var _0x99f6=['user-setting:','./user-setting.events','save','remove','update','user-setting:update','emit','user-setting:update:user-','UserId','length'];(function(_0x239866,_0x261f27){var _0x3af064=function(_0x2715a0){while(--_0x2715a0){_0x239866['push'](_0x239866['shift']());}};_0x3af064(++_0x261f27);}(_0x99f6,0x83));var _0x699f=function(_0x1e0288,_0xf26008){_0x1e0288=_0x1e0288-0x0;var _0x2510d9=_0x99f6[_0x1e0288];return _0x2510d9;};'use strict';var UserSettingEvents=require(_0x699f('0x0'));var events=[_0x699f('0x1'),_0x699f('0x2'),_0x699f('0x3')];function createListener(_0x5a1136,_0x1fad23){return function(_0x1f2577){_0x1fad23['emit'](_0x5a1136,_0x1f2577);if(_0x5a1136===_0x699f('0x4')){_0x1fad23[_0x699f('0x5')](_0x699f('0x6')+_0x1f2577[_0x699f('0x7')],_0x1f2577);}};}exports['register']=function(_0x22a14e){for(var _0xe5106c=0x0,_0x2c7a08=events[_0x699f('0x8')];_0xe5106c<_0x2c7a08;_0xe5106c++){var _0x477d66=events[_0xe5106c];var _0x4a1493=createListener(_0x699f('0x9')+_0x477d66,_0x22a14e);UserSettingEvents['on'](_0x477d66,_0x4a1493);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 7d9a3c1..5ba930f 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 _0xdd38=['addWhatsappInteractions','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','removeQueues','delete','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','/:id/fax_accounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeApiKey','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','/describe','describe','whoami','get','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getScheduledCalls','getApiKey','/:id/contacts','addContacts','post','/:id/queues','diskStorage','join','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd38,0x161));var _0x8dd3=function(_0x295898,_0x1c7f30){_0x295898=_0x295898-0x0;var _0x922943=_0xdd38[_0x295898];return _0x922943;};'use strict';var multer=require(_0x8dd3('0x0'));var util=require(_0x8dd3('0x1'));var path=require(_0x8dd3('0x2'));var timeout=require(_0x8dd3('0x3'));var express=require(_0x8dd3('0x4'));var router=express['Router']();var fs_extra=require(_0x8dd3('0x5'));var auth=require(_0x8dd3('0x6'));var interaction=require(_0x8dd3('0x7'));var config=require('../../config/environment');var controller=require(_0x8dd3('0x8'));router['get']('/',auth[_0x8dd3('0x9')](),controller['index']);router['get'](_0x8dd3('0xa'),auth['isAuthenticated'](),controller[_0x8dd3('0xb')]);router['get']('/whoami',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0xc')]);router[_0x8dd3('0xd')]('/presence',auth[_0x8dd3('0x9')](),controller['getPresence']);router[_0x8dd3('0xd')](_0x8dd3('0xe'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0xf')]);router[_0x8dd3('0xd')](_0x8dd3('0x10'),controller[_0x8dd3('0x11')]);router[_0x8dd3('0xd')](_0x8dd3('0x12'),auth['isAuthenticated'](),controller[_0x8dd3('0x13')]);router['get']('/:id/contacts',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x14')]);router[_0x8dd3('0xd')]('/:id/queues',auth['isAuthenticated'](),controller[_0x8dd3('0x15')]);router[_0x8dd3('0xd')](_0x8dd3('0x16'),auth['isAuthenticated'](),controller[_0x8dd3('0x17')]);router['get']('/:id/groups',auth[_0x8dd3('0x9')](),controller['getGroups']);router['get'](_0x8dd3('0x18'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x19')]);router[_0x8dd3('0xd')](_0x8dd3('0x1a'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x1b')]);router['get']('/:id/chat/interactions',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x1c')]);router[_0x8dd3('0xd')]('/:id/openchannel/interactions',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x1d')]);router[_0x8dd3('0xd')](_0x8dd3('0x1e'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x1f')]);router['get'](_0x8dd3('0x20'),auth['isAuthenticated'](),controller[_0x8dd3('0x21')]);router[_0x8dd3('0xd')]('/:id/fax/interactions',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x22')]);router[_0x8dd3('0xd')](_0x8dd3('0x23'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x24')]);router[_0x8dd3('0xd')](_0x8dd3('0x25'),auth[_0x8dd3('0x9')](),controller['getTeams']);router[_0x8dd3('0xd')](_0x8dd3('0x26'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x27')]);router[_0x8dd3('0xd')](_0x8dd3('0x28'),auth['isAuthenticated'](),controller['getAgents']);router[_0x8dd3('0xd')](_0x8dd3('0x29'),auth['isAuthenticated'](),controller[_0x8dd3('0x2a')]);router[_0x8dd3('0xd')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x8dd3('0x2b')]);router['get'](_0x8dd3('0x2c'),auth[_0x8dd3('0x9')](),controller['getMailAccounts']);router['get'](_0x8dd3('0x2d'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x2e')]);router[_0x8dd3('0xd')]('/:id/sms_accounts',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x2f')]);router['get'](_0x8dd3('0x30'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x31')]);router[_0x8dd3('0xd')]('/:id/whatsapp_accounts',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x32')]);router[_0x8dd3('0xd')](_0x8dd3('0x33'),auth[_0x8dd3('0x9')](),controller['getSquareProjects']);router['get']('/:id/scheduled_calls',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x34')]);router[_0x8dd3('0xd')]('/:id/api_key',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x35')]);router['post'](_0x8dd3('0x36'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x37')]);router[_0x8dd3('0x38')]('/',auth[_0x8dd3('0x9')](),controller['create']);router['post']('/create_many',auth[_0x8dd3('0x9')](),controller['bulkCreate']);router['post'](_0x8dd3('0x39'),auth[_0x8dd3('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x8dd3('0x3a')]({'destination':function(_0x343eab,_0x189691,_0x1137e2){_0x1137e2(null,path[_0x8dd3('0x3b')](config[_0x8dd3('0x3c')],_0x8dd3('0x3d')));},'filename':function(_0x533e95,_0xaeca40,_0x112a46){_0x112a46(null,util[_0x8dd3('0x3e')]('%s-%s',Date[_0x8dd3('0x3f')](),_0xaeca40[_0x8dd3('0x40')]));}})});router[_0x8dd3('0x38')](_0x8dd3('0x10'),upload[_0x8dd3('0x41')](_0x8dd3('0x42')),controller[_0x8dd3('0x43')]);router[_0x8dd3('0x38')](_0x8dd3('0x44'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x45')]);router[_0x8dd3('0x38')]('/:id/logout',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x46')]);router[_0x8dd3('0x38')](_0x8dd3('0x47'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x48')]);router[_0x8dd3('0x38')]('/:id/unpause',auth[_0x8dd3('0x9')](),controller['unpause']);router[_0x8dd3('0x38')]('/:id/teams',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x49')]);router[_0x8dd3('0x38')](_0x8dd3('0x4a'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x4b')]);router['post'](_0x8dd3('0x4c'),auth['isAuthenticated'](),controller[_0x8dd3('0x4d')]);router[_0x8dd3('0x38')](_0x8dd3('0x4e'),auth[_0x8dd3('0x9')](),controller['addFaxInteractions']);router['post'](_0x8dd3('0x4f'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x50')]);router['post'](_0x8dd3('0x51'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x52')]);router[_0x8dd3('0x38')]('/:id/whatsapp_interactions',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x53')]);router[_0x8dd3('0x38')]('/:id/fax_accounts',auth[_0x8dd3('0x9')](),controller['addFaxAccounts']);router[_0x8dd3('0x38')]('/:id/mail_accounts',auth[_0x8dd3('0x9')](),controller['addMailAccounts']);router[_0x8dd3('0x38')](_0x8dd3('0x2d'),auth['isAuthenticated'](),controller[_0x8dd3('0x54')]);router[_0x8dd3('0x38')](_0x8dd3('0x55'),auth['isAuthenticated'](),controller[_0x8dd3('0x56')]);router['post'](_0x8dd3('0x30'),auth['isAuthenticated'](),controller['addChatWebsites']);router[_0x8dd3('0x38')]('/:id/whatsapp_accounts',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x57')]);router[_0x8dd3('0x38')](_0x8dd3('0x33'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x58')]);router[_0x8dd3('0x38')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x8dd3('0x59')]);router[_0x8dd3('0x5a')](_0x8dd3('0xe'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x5b')]);router[_0x8dd3('0x5a')](_0x8dd3('0x5c'),auth[_0x8dd3('0x9')](),controller['changePassword']);router['delete'](_0x8dd3('0x39'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x5d')]);router[_0x8dd3('0x5e')](_0x8dd3('0x25'),auth[_0x8dd3('0x9')](),controller['removeTeams']);router[_0x8dd3('0x5e')](_0x8dd3('0xe'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x5f')]);router['delete'](_0x8dd3('0x4a'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x60')]);router[_0x8dd3('0x5e')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x8dd3('0x61')]);router[_0x8dd3('0x5e')](_0x8dd3('0x4e'),auth['isAuthenticated'](),controller[_0x8dd3('0x62')]);router['delete'](_0x8dd3('0x4f'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x63')]);router[_0x8dd3('0x5e')](_0x8dd3('0x51'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x64')]);router[_0x8dd3('0x5e')](_0x8dd3('0x65'),auth[_0x8dd3('0x9')](),controller['removeWhatsappInteractions']);router[_0x8dd3('0x5e')](_0x8dd3('0x66'),auth[_0x8dd3('0x9')](),controller['removeFaxAccounts']);router[_0x8dd3('0x5e')]('/:id/mail_accounts',auth[_0x8dd3('0x9')](),controller['removeMailAccounts']);router[_0x8dd3('0x5e')](_0x8dd3('0x2d'),auth[_0x8dd3('0x9')](),controller['removeOpenchannelAccounts']);router[_0x8dd3('0x5e')](_0x8dd3('0x55'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x67')]);router[_0x8dd3('0x5e')]('/:id/chat_websites',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x68')]);router[_0x8dd3('0x5e')](_0x8dd3('0x69'),auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x6a')]);router[_0x8dd3('0x5e')](_0x8dd3('0x33'),auth['isAuthenticated'](),controller['removeSquareProjects']);router['delete']('/:id/api_key',auth[_0x8dd3('0x9')](),controller[_0x8dd3('0x6b')]);module[_0x8dd3('0x6c')]=router; \ No newline at end of file +var _0x93bd=['getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x93bd,0xd6));var _0xd93b=function(_0x22b334,_0x121725){_0x22b334=_0x22b334-0x0;var _0x133f77=_0x93bd[_0x22b334];return _0x133f77;};'use strict';var multer=require(_0xd93b('0x0'));var util=require('util');var path=require(_0xd93b('0x1'));var timeout=require(_0xd93b('0x2'));var express=require(_0xd93b('0x3'));var router=express[_0xd93b('0x4')]();var fs_extra=require(_0xd93b('0x5'));var auth=require(_0xd93b('0x6'));var interaction=require(_0xd93b('0x7'));var config=require(_0xd93b('0x8'));var controller=require(_0xd93b('0x9'));router[_0xd93b('0xa')]('/',auth['isAuthenticated'](),controller[_0xd93b('0xb')]);router['get']('/describe',auth[_0xd93b('0xc')](),controller[_0xd93b('0xd')]);router[_0xd93b('0xa')](_0xd93b('0xe'),auth['isAuthenticated'](),controller[_0xd93b('0xf')]);router['get'](_0xd93b('0x10'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x11')]);router[_0xd93b('0xa')](_0xd93b('0x12'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x13')]);router[_0xd93b('0xa')](_0xd93b('0x14'),controller[_0xd93b('0x15')]);router['get'](_0xd93b('0x16'),auth['isAuthenticated'](),controller[_0xd93b('0x17')]);router[_0xd93b('0xa')](_0xd93b('0x18'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x19')]);router[_0xd93b('0xa')](_0xd93b('0x1a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x1b')]);router[_0xd93b('0xa')](_0xd93b('0x1c'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x1d')]);router[_0xd93b('0xa')]('/:id/groups',auth[_0xd93b('0xc')](),controller[_0xd93b('0x1e')]);router[_0xd93b('0xa')](_0xd93b('0x1f'),auth[_0xd93b('0xc')](),controller['getRecordings']);router[_0xd93b('0xa')](_0xd93b('0x20'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x21')]);router['get'](_0xd93b('0x22'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x23')]);router[_0xd93b('0xa')]('/:id/openchannel/interactions',auth[_0xd93b('0xc')](),controller[_0xd93b('0x24')]);router['get'](_0xd93b('0x25'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x26')]);router[_0xd93b('0xa')](_0xd93b('0x27'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x28')]);router[_0xd93b('0xa')](_0xd93b('0x29'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x2a')]);router[_0xd93b('0xa')](_0xd93b('0x2b'),auth['isAuthenticated'](),controller[_0xd93b('0x2c')]);router[_0xd93b('0xa')](_0xd93b('0x2d'),auth[_0xd93b('0xc')](),controller['getTeams']);router['get'](_0xd93b('0x2e'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x2f')]);router[_0xd93b('0xa')]('/:id/agents',auth[_0xd93b('0xc')](),controller['getAgents']);router['get']('/:id/prefixes',auth[_0xd93b('0xc')](),controller[_0xd93b('0x30')]);router[_0xd93b('0xa')](_0xd93b('0x31'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0xd93b('0xa')](_0xd93b('0x32'),auth['isAuthenticated'](),controller[_0xd93b('0x33')]);router['get'](_0xd93b('0x34'),auth['isAuthenticated'](),controller[_0xd93b('0x35')]);router[_0xd93b('0xa')](_0xd93b('0x36'),auth[_0xd93b('0xc')](),controller['getSmsAccounts']);router['get'](_0xd93b('0x37'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x38')]);router['get']('/:id/whatsapp_accounts',auth[_0xd93b('0xc')](),controller[_0xd93b('0x39')]);router['get'](_0xd93b('0x3a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x3b')]);router[_0xd93b('0xa')](_0xd93b('0x3c'),auth['isAuthenticated'](),controller[_0xd93b('0x3d')]);router['get'](_0xd93b('0x3e'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x3f')]);router[_0xd93b('0x40')](_0xd93b('0x18'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x41')]);router[_0xd93b('0x40')]('/',auth[_0xd93b('0xc')](),controller[_0xd93b('0x42')]);router[_0xd93b('0x40')](_0xd93b('0x43'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x44')]);router[_0xd93b('0x40')](_0xd93b('0x1a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x45')]);var upload=multer({'storage':multer[_0xd93b('0x46')]({'destination':function(_0x5a39e4,_0x110b5c,_0x554078){_0x554078(null,path[_0xd93b('0x47')](config[_0xd93b('0x48')],'server/files/images/'));},'filename':function(_0x5b104d,_0xac5742,_0x3c1c61){_0x3c1c61(null,util[_0xd93b('0x49')](_0xd93b('0x4a'),Date[_0xd93b('0x4b')](),_0xac5742[_0xd93b('0x4c')]));}})});router['post'](_0xd93b('0x14'),upload[_0xd93b('0x4d')](_0xd93b('0x4e')),controller[_0xd93b('0x4f')]);router[_0xd93b('0x40')](_0xd93b('0x50'),auth['isAuthenticated'](),controller[_0xd93b('0x51')]);router[_0xd93b('0x40')](_0xd93b('0x52'),auth['isAuthenticated'](),controller[_0xd93b('0x53')]);router[_0xd93b('0x40')](_0xd93b('0x54'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x55')]);router['post'](_0xd93b('0x56'),auth[_0xd93b('0xc')](),controller['unpause']);router[_0xd93b('0x40')](_0xd93b('0x2d'),auth['isAuthenticated'](),controller[_0xd93b('0x57')]);router[_0xd93b('0x40')](_0xd93b('0x58'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x59')]);router[_0xd93b('0x40')](_0xd93b('0x5a'),auth['isAuthenticated'](),controller[_0xd93b('0x5b')]);router[_0xd93b('0x40')](_0xd93b('0x5c'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x5d')]);router['post'](_0xd93b('0x5e'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x5f')]);router['post'](_0xd93b('0x60'),auth['isAuthenticated'](),controller[_0xd93b('0x61')]);router[_0xd93b('0x40')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xd93b('0x62')]);router[_0xd93b('0x40')](_0xd93b('0x31'),auth[_0xd93b('0xc')](),controller['addFaxAccounts']);router['post'](_0xd93b('0x32'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x63')]);router[_0xd93b('0x40')](_0xd93b('0x34'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x64')]);router[_0xd93b('0x40')](_0xd93b('0x36'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x65')]);router[_0xd93b('0x40')]('/:id/chat_websites',auth[_0xd93b('0xc')](),controller[_0xd93b('0x66')]);router[_0xd93b('0x40')](_0xd93b('0x67'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x68')]);router[_0xd93b('0x40')](_0xd93b('0x3a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x69')]);router['post'](_0xd93b('0x3e'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x6a')]);router[_0xd93b('0x6b')](_0xd93b('0x12'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x6c')]);router[_0xd93b('0x6b')]('/:id/password',auth['isAuthenticated'](),controller[_0xd93b('0x6d')]);router[_0xd93b('0x6e')](_0xd93b('0x1a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x6f')]);router[_0xd93b('0x6e')](_0xd93b('0x2d'),auth['isAuthenticated'](),controller[_0xd93b('0x70')]);router[_0xd93b('0x6e')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xd93b('0x6e')]('/:id/chat_interactions',auth[_0xd93b('0xc')](),controller[_0xd93b('0x71')]);router[_0xd93b('0x6e')](_0xd93b('0x5a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x72')]);router[_0xd93b('0x6e')](_0xd93b('0x5c'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x73')]);router[_0xd93b('0x6e')]('/:id/sms_interactions',auth[_0xd93b('0xc')](),controller['removeSmsInteractions']);router[_0xd93b('0x6e')]('/:id/openchannel_interactions',auth[_0xd93b('0xc')](),controller[_0xd93b('0x74')]);router[_0xd93b('0x6e')](_0xd93b('0x75'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x76')]);router[_0xd93b('0x6e')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xd93b('0x77')]);router[_0xd93b('0x6e')]('/:id/mail_accounts',auth[_0xd93b('0xc')](),controller[_0xd93b('0x78')]);router[_0xd93b('0x6e')](_0xd93b('0x34'),auth['isAuthenticated'](),controller[_0xd93b('0x79')]);router['delete'](_0xd93b('0x36'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x7a')]);router[_0xd93b('0x6e')]('/:id/chat_websites',auth[_0xd93b('0xc')](),controller[_0xd93b('0x7b')]);router['delete'](_0xd93b('0x67'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x7c')]);router[_0xd93b('0x6e')](_0xd93b('0x3a'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x7d')]);router[_0xd93b('0x6e')](_0xd93b('0x3e'),auth[_0xd93b('0xc')](),controller[_0xd93b('0x7e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 8f67e3e..19d5453 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 _0x9c44=['get','udp','encryption','avpf','force_avp','icesupport','dtlscertfile','dtlsprivatekey','wss','dtlsenable','dtlsverify','dtlssetup','actpass','/etc/pki/tls/certs/motion.crt','rtcp_mux','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','admin','user','telephone','local','INTEGER','internal','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','accept','refuse','originate','uac','uas','fingerprint','certificate','active','update,nonat','TEXT'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x49c4('0x0'));var _=require(_0x49c4('0x1'));module[_0x49c4('0x2')]={'name':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2ad237){this['setDataValue']('name',_0x2ad237);this[_0x49c4('0x5')]('defaultuser',_0x2ad237);},'comment':_0x49c4('0x6')},'fullname':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'set':function(_0x69bc41){this[_0x49c4('0x5')](_0x49c4('0x7'),_0x69bc41);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),_0x69bc41,this[_0x49c4('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'unique':_0x49c4('0xc'),'validate':{'isEmail':!![]},'set':function(_0x58cad7){if(_0x58cad7){this[_0x49c4('0x5')](_0x49c4('0xc'),_0x58cad7['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x49c4('0xd'),_0x49c4('0xe'),'agent',_0x49c4('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x49c4('0x10')},'internal':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':![],'unique':_0x49c4('0x12'),'set':function(_0x2decee){this[_0x49c4('0x5')](_0x49c4('0x12'),_0x2decee);this[_0x49c4('0x5')](_0x49c4('0x13'),_0x2decee);this['setDataValue'](_0x49c4('0x8'),util[_0x49c4('0x9')](_0x49c4('0xa'),this[_0x49c4('0xb')](_0x49c4('0x7')),_0x2decee));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x49c4('0x3')]},'mobile':{'type':Sequelize[_0x49c4('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x49c4('0x3')]},'city':{'type':Sequelize[_0x49c4('0x3')]},'country':{'type':Sequelize[_0x49c4('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x49c4('0x14')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':_0x49c4('0x16')},'lastPauseAt':{'type':Sequelize[_0x49c4('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x49c4('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x17')},'ipaddr':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x19'),'user',_0x49c4('0x1a')),'allowNull':!![],'defaultValue':_0x49c4('0x19')},'context':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x1b')},'callingpres':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x1c'),_0x49c4('0x1d'),_0x49c4('0x1e'),_0x49c4('0x1f'),_0x49c4('0x20'),_0x49c4('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x38ad77){this[_0x49c4('0x5')](_0x49c4('0x22'),_0x38ad77?_0x38ad77[_0x49c4('0x23')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x49c4('0xb')](_0x49c4('0x22'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x25')},'dtmfmode':{'type':Sequelize[_0x49c4('0x18')]('rfc2833',_0x49c4('0x26'),_0x49c4('0x27'),_0x49c4('0x28'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x49c4('0x2d'),'set':function(_0x5b96df){this[_0x49c4('0x5')](_0x49c4('0x2e'),_0x5b96df?_0x5b96df[_0x49c4('0x23')](','):null);},'get':function(){return this[_0x49c4('0xb')]('nat')?this[_0x49c4('0xb')](_0x49c4('0x2e'))[_0x49c4('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedcallgroup':{'type':Sequelize[_0x49c4('0x3')]},'pickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x49c4('0x3')]},'language':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x49c4('0x3')]},'disallow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x2f')},'allow':{'type':Sequelize[_0x49c4('0x3')],'allowNull':![],'defaultValue':_0x49c4('0x30'),'set':function(_0x1e506a){this['setDataValue'](_0x49c4('0x31'),_0x1e506a?_0x1e506a[_0x49c4('0x23')](';'):_0x49c4('0x30'));},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x31'))?this[_0x49c4('0xb')](_0x49c4('0x31'))[_0x49c4('0x24')](';'):null;},'comment':_0x49c4('0x32')},'autoframing':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'set':function(_0x326142){this['setDataValue'](_0x49c4('0x33'),_0x326142?_0x326142['join'](','):null);},'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x33'))?this[_0x49c4('0xb')](_0x49c4('0x33'))[_0x49c4('0x24')](','):null;},'comment':_0x49c4('0x34')},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![],'defaultValue':_0x49c4('0x35')},'amaflags':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x36'),_0x49c4('0x37'),_0x49c4('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x39'),'uas'),'allowNull':!![],'defaultValue':_0x49c4('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x49c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x3b'),_0x49c4('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x3d'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x49c4('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x49c4('0x18')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no',_0x49c4('0x2a'),_0x49c4('0x2b'),_0x49c4('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x49c4('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x49c4('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x49c4('0x3f')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x10dec7){this[_0x49c4('0x5')]('showWebBar',_0x10dec7);var _0x39c455=this[_0x49c4('0x40')]({'plain':!![]});switch(_0x10dec7){case 0x0:case 0x1:var _0x4f50bf=_0x39c455['transport']?_['isArray'](_0x39c455['transport'])?_0x39c455[_0x49c4('0x22')]['join']():_0x39c455[_0x49c4('0x22')]:_0x49c4('0x41');if(_0x4f50bf==='wss'){_0x4f50bf=_0x49c4('0x41');}this[_0x49c4('0x5')]('transport',_0x4f50bf);this[_0x49c4('0x5')](_0x49c4('0x42'),'no');this[_0x49c4('0x5')](_0x49c4('0x43'),null);this['setDataValue'](_0x49c4('0x44'),null);this[_0x49c4('0x5')](_0x49c4('0x45'),null);this[_0x49c4('0x5')]('dtlsenable',null);this[_0x49c4('0x5')]('dtlsverify',null);this['setDataValue']('dtlssetup',null);this['setDataValue'](_0x49c4('0x46'),null);this[_0x49c4('0x5')](_0x49c4('0x47'),null);this[_0x49c4('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x49c4('0x22'),_0x49c4('0x48'));this[_0x49c4('0x5')](_0x49c4('0x42'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x43'),_0x49c4('0x29'));this['setDataValue'](_0x49c4('0x44'),'yes');this[_0x49c4('0x5')](_0x49c4('0x45'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x49'),_0x49c4('0x29'));this[_0x49c4('0x5')](_0x49c4('0x4a'),'no');this[_0x49c4('0x5')](_0x49c4('0x4b'),_0x49c4('0x4c'));this[_0x49c4('0x5')](_0x49c4('0x46'),_0x39c455[_0x49c4('0x46')]||_0x49c4('0x4d'));this[_0x49c4('0x5')](_0x49c4('0x47'),_0x39c455[_0x49c4('0x47')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x49c4('0x4e'),_0x49c4('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x1a15f3){this[_0x49c4('0x5')](_0x49c4('0x4f'),_0x1a15f3?_0x1a15f3[_0x49c4('0x23')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0x49c4('0xb')](_0x49c4('0x4f'))[_0x49c4('0x24')](','),function(_0x2f4289){return parseInt(_0x2f4289,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x49c4('0x18')](_0x49c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x49c4('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x49c4('0xb')](_0x49c4('0x50'))?this[_0x49c4('0xb')](_0x49c4('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x49c4('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x49c4('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x27b77d){if(typeof _0x27b77d===_0x49c4('0x51')){var _0x34870e=_0x27b77d==='1'?!![]:_0x27b77d==='0'?![]:_0x27b77d==='true'?!![]:_0x27b77d===_0x49c4('0x52')?![]:![];this[_0x49c4('0x5')](_0x49c4('0x53'),_0x34870e);}else{this[_0x49c4('0x5')](_0x49c4('0x53'),_0x27b77d);}}},'blocked':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![],'set':function(_0x38b291){this[_0x49c4('0x5')](_0x49c4('0x54'),_0x38b291);if(_0x38b291===!![]){this[_0x49c4('0x5')]('blockedAt',moment());this[_0x49c4('0x5')](_0x49c4('0x55'),0x0);}else{this['setDataValue'](_0x49c4('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x49c4('0x11')](0x5)[_0x49c4('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x49c4('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x49c4('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x1871ac,_0x2f3e10){var _0x499037=function(_0xdd4c1b){while(--_0xdd4c1b){_0x1871ac['push'](_0x1871ac['shift']());}};_0x499037(++_0x2f3e10);}(_0x34e8,0x12c));var _0x834e=function(_0x5e40af,_0x292ddf){_0x5e40af=_0x5e40af-0x0;var _0x4bca2f=_0x34e8[_0x5e40af];return _0x4bca2f;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index f0f5ea0..4c79f49 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 _0xa65d=['logout','pause','QueuePause','updateAttributes','getChannels','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','openchannelPause','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','addAgent','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','getDataValue','getLists','getAgents','getVoiceQueues','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gte','$lte','$ne','$between','$notBetween','$iLike','$notILike','$overlap','$contains','$contained','$any','firstName','lastName','Contact','dialActive','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','removeApiKey','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','flatten','col','toString','asc','desc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','slice','toUpperCase','SELECT','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','./user.socket','register','defaults','redis','localhost','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','status','offset','undefined','limit','count','Content-Range','json','destroy','get','role','admin','Users','user','Agents','agent','telephone','filter','ignore','includes','find','value','stack','name','send','index','User','rawAttributes','map','fieldName','key','salt','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','chat','dataValues','sms','fax','mail','openchannel','catch','keys','password','filters','intersection','model','fields','length','merge','options','all','update','body','params','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','max','min_internal','isNil','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','fullname','email','permissions','101','103','113','110','106','109','100','114','115','Unauthorized','checkUserLimits','settingsEnabled','create','UserProfileSection','Telephones','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','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','VoiceMail','isEmpty','compact','UserProfileResource','newPassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Sequelize','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','previousPasswords','passwordHistoryLimit','addQueues','channel','online','loginInPause','interface','isValidChannel','capitalize','toLowerCase','QueueId','emit','Queue:save','VoiceQueue','voice','format','voicePause','penalty','UserVoiceQueueRt','upsert','Queues','isArray','Queue:remove','addAvatar','filename','userpic','download','existsSync','join','root','server/files/images/','whatsapp','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','getContacts','CmContact','order','sort','hasOwnProperty','CmList','List','Tags','tag','nolimit','getQueues','pick','Queue','getVoiceQueuesRt','getGroups','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','UserId','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','isMiddleware','resolve'];(function(_0xfc6b18,_0x1639f2){var _0x505d67=function(_0x467845){while(--_0x467845){_0xfc6b18['push'](_0xfc6b18['shift']());}};_0x505d67(++_0x1639f2);}(_0xa65d,0x8e));var _0xda65=function(_0x4ed805,_0x21978f){_0x4ed805=_0x4ed805-0x0;var _0xdec584=_0xa65d[_0x4ed805];return _0xdec584;};'use strict';var moment=require(_0xda65('0x0'));var util=require(_0xda65('0x1'));var path=require(_0xda65('0x2'));var fs=require('fs');var _=require(_0xda65('0x3'));var squel=require(_0xda65('0x4'));var jayson=require(_0xda65('0x5'));var Redis=require(_0xda65('0x6'));var authService=require(_0xda65('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xda65('0x8'))('api');var utils=require(_0xda65('0x9'));var config=require(_0xda65('0xa'));var licenseUtil=require(_0xda65('0xb'));var APIBadRequestError=require(_0xda65('0xc'))[_0xda65('0xd')];var APINotFoundError=require(_0xda65('0xc'))[_0xda65('0xe')];var APIHandleError=require(_0xda65('0xc'))[_0xda65('0xf')];var db=require(_0xda65('0x10'))['db'];var socket=require(_0xda65('0x11'))(new Redis(config['redis']));require(_0xda65('0x12'))[_0xda65('0x13')](socket);config['redis']=_[_0xda65('0x14')](config[_0xda65('0x15')],{'host':_0xda65('0x16'),'port':0x18eb});var amiClient=jayson[_0xda65('0x17')][_0xda65('0x18')]({'port':0x232a});var values;function respondWithRpcPromise(_0x35110c,_0x79187,_0xfba1cc,_0x1f982f){return new Promise(function(_0x5465d5,_0x4269f2){var _0x16a78a=_0x1f982f||amiClient;return _0x16a78a[_0xda65('0x19')](_0x35110c,_0xfba1cc)[_0xda65('0x1a')](function(_0x2a1cdd){logger[_0xda65('0x1b')](_0xda65('0x1c'),_0x79187,_0xda65('0x1d'));logger[_0xda65('0x1e')](_0xda65('0x1f'),_0x79187,_0xda65('0x1d'),JSON['stringify'](_0x2a1cdd));if(_0x2a1cdd[_0xda65('0x20')]){if(_0x2a1cdd['error'][_0xda65('0x21')]===0x1f4){logger['error'](_0xda65('0x1c'),_0x79187,_0x2a1cdd[_0xda65('0x20')][_0xda65('0x22')]);return _0x4269f2(_0x2a1cdd['error'][_0xda65('0x22')]);}logger[_0xda65('0x20')]('User,\x20%s,\x20%s',_0x79187,_0x2a1cdd['error'][_0xda65('0x22')]);return _0x5465d5(_0x2a1cdd['error']['message']);}else{logger['info']('User,\x20%s,\x20%s',_0x79187,_0xda65('0x1d'));_0x5465d5(_0x2a1cdd[_0xda65('0x23')][_0xda65('0x22')]);}})['catch'](function(_0x50d2d8){logger['error'](_0xda65('0x1c'),_0x79187,_0x50d2d8);_0x4269f2(_0x50d2d8);});});}function respondWithStatusCode(_0x163aea,_0x42b379){_0x42b379=_0x42b379||0xcc;return function(_0x278185){if(_0x278185){return _0x163aea['sendStatus'](_0x42b379);}return _0x163aea[_0xda65('0x24')](_0x42b379)['end']();};}function respondWithResult(_0x577158,_0x3df2cb){_0x3df2cb=_0x3df2cb||0xc8;return function(_0x31cfb4){if(_0x31cfb4){return _0x577158['status'](_0x3df2cb)['json'](_0x31cfb4);}};}function respondWithFilteredResult(_0x458e93,_0x3bc752){return function(_0x3eae65){if(_0x3eae65){var _0x531f43=typeof _0x3bc752[_0xda65('0x25')]===_0xda65('0x26')&&typeof _0x3bc752[_0xda65('0x27')]==='undefined';var _0x385e07=_0x3eae65[_0xda65('0x28')];var _0x5dc5f4=_0x531f43?0x0:_0x3bc752['offset'];var _0x3a2111=_0x531f43?_0x3eae65[_0xda65('0x28')]:_0x3bc752[_0xda65('0x25')]+_0x3bc752['limit'];var _0x17f7ec;if(_0x3a2111>=_0x385e07){_0x3a2111=_0x385e07;_0x17f7ec=0xc8;}else{_0x17f7ec=0xce;}_0x458e93['status'](_0x17f7ec);return _0x458e93['set'](_0xda65('0x29'),_0x5dc5f4+'-'+_0x3a2111+'/'+_0x385e07)[_0xda65('0x2a')](_0x3eae65);}return null;};}function saveUpdates(_0x3ec2db){return function(_0x153cea){if(_0x153cea){return _0x153cea['update'](_0x3ec2db)['then'](function(_0x1c8ea4){socket['emit']('userNotification:recalc:'+_0x1c8ea4['id'],{});return _0x1c8ea4;});}return null;};}function removeEntity(_0x45c0f3){return function(_0x3fb389){if(_0x3fb389){return _0x3fb389[_0xda65('0x2b')]()[_0xda65('0x1a')](function(){var _0x1434d9=_0x3fb389[_0xda65('0x2c')]({'plain':!![]});if(_0x1434d9[_0xda65('0x2d')]===_0xda65('0x2e'))return;var _0x4f09ec=[{'name':_0xda65('0x2f'),'value':_0xda65('0x30'),'ignore':!![]},{'name':_0xda65('0x31'),'value':_0xda65('0x32'),'ignore':![]},{'name':'Telephones','value':_0xda65('0x33'),'ignore':![]}];var _0xf1c2a0=_(_0x4f09ec)[_0xda65('0x34')](_0xda65('0x35'))['map']('value')['value']();if(_[_0xda65('0x36')](_0xf1c2a0,_0x1434d9['role'])){return;}var _0xffbf3d=_[_0xda65('0x37')](_0x4f09ec,[_0xda65('0x38'),_0x1434d9[_0xda65('0x2d')]])['name'];return db['UserProfileResource'][_0xda65('0x2b')]({'where':{'type':_0xffbf3d,'resourceId':_0x1434d9['id']}})[_0xda65('0x1a')](function(){return _0x3fb389;});})[_0xda65('0x1a')](function(){_0x45c0f3[_0xda65('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41a106){return function(_0xa4f835){if(!_0xa4f835){_0x41a106['sendStatus'](0x194);}return _0xa4f835;};}function handleError(_0x2eed68,_0x22cad5){_0x22cad5=_0x22cad5||0x1f4;return function(_0xe45f48){logger[_0xda65('0x20')](_0xe45f48[_0xda65('0x39')]);if(_0xe45f48[_0xda65('0x3a')]){delete _0xe45f48[_0xda65('0x3a')];}_0x2eed68['status'](_0x22cad5)[_0xda65('0x3b')](_0xe45f48);};}exports[_0xda65('0x3c')]=function(_0xf8b6d6,_0x40cc7){var _0x464582={},_0x12a55f={'count':0x0,'rows':[]};var _0x15cad5=_(db[_0xda65('0x3d')][_0xda65('0x3e')])[_0xda65('0x3f')](function(_0x16611f){return{'name':_0x16611f[_0xda65('0x40')],'type':_0x16611f['type'][_0xda65('0x41')]};})['filter'](function(_0x3f4da7){return!_[_0xda65('0x36')](['password',_0xda65('0x42')],_0x3f4da7[_0xda65('0x3a')]);})[_0xda65('0x38')]();_0x464582=qs[_0xda65('0x43')](_0x15cad5,_0xf8b6d6);var _0x5e601e={'where':_0x464582[_0xda65('0x44')]};return db['User'][_0xda65('0x28')](_0x5e601e)[_0xda65('0x1a')](function(_0x28f174){_0x12a55f[_0xda65('0x28')]=_0x28f174;if(_0xf8b6d6[_0xda65('0x45')][_0xda65('0x46')]){_0x464582[_0xda65('0x47')]=[{'all':!![]}];}if(_0xf8b6d6['query'][_0xda65('0x48')]===_0xda65('0x49')){_0x464582[_0xda65('0x47')]=[{'model':db[_0xda65('0x4a')],'as':_0xda65('0x48')}];}if(!_[_0xda65('0x36')](_0x464582[_0xda65('0x4b')],'id')){_0x464582[_0xda65('0x4b')][_0xda65('0x4c')]('id');}return db['User'][_0xda65('0x4d')](_0x464582);})[_0xda65('0x1a')](function(_0x152ff8){_0x12a55f[_0xda65('0x4e')]=_0x152ff8;if(_0xf8b6d6[_0xda65('0x45')][_0xda65('0x4f')]===_0xda65('0x49')){var _0x5eb48e=[];for(var _0x11aa12=0x0;_0x11aa12<_0x12a55f[_0xda65('0x4e')]['length'];_0x11aa12++){_0x5eb48e['push'](get_open_tabs(_0xda65('0x50'),_0x12a55f[_0xda65('0x4e')][_0x11aa12][_0xda65('0x51')]));_0x5eb48e[_0xda65('0x4c')](get_open_tabs(_0xda65('0x52'),_0x12a55f[_0xda65('0x4e')][_0x11aa12][_0xda65('0x51')]));_0x5eb48e[_0xda65('0x4c')](get_open_tabs(_0xda65('0x53'),_0x12a55f[_0xda65('0x4e')][_0x11aa12][_0xda65('0x51')]));_0x5eb48e[_0xda65('0x4c')](get_open_tabs(_0xda65('0x54'),_0x12a55f[_0xda65('0x4e')][_0x11aa12][_0xda65('0x51')]));_0x5eb48e[_0xda65('0x4c')](get_open_tabs(_0xda65('0x55'),_0x12a55f['rows'][_0x11aa12][_0xda65('0x51')]));_0x5eb48e['push'](get_open_tabs('whatsapp',_0x12a55f['rows'][_0x11aa12][_0xda65('0x51')]));}return Promise['all'](_0x5eb48e)[_0xda65('0x1a')](function(){return _0x12a55f;});}else{return _0x12a55f;}})[_0xda65('0x1a')](respondWithFilteredResult(_0x40cc7,_0x464582))[_0xda65('0x56')](handleError(_0x40cc7,null));};exports['show']=function(_0x1a3b00,_0x1f5bc7){var _0x1d1c79={'raw':![],'where':{'id':_0x1a3b00['params']['id']}},_0x1c7dfc={};_0x1c7dfc['model']=_['differenceBy'](_[_0xda65('0x57')](db['User'][_0xda65('0x3e')]),[_0xda65('0x58'),_0xda65('0x42')]);_0x1c7dfc[_0xda65('0x45')]=_[_0xda65('0x57')](_0x1a3b00[_0xda65('0x45')]);_0x1c7dfc[_0xda65('0x59')]=_[_0xda65('0x5a')](_0x1c7dfc[_0xda65('0x5b')],_0x1c7dfc['query']);_0x1d1c79[_0xda65('0x4b')]=_[_0xda65('0x5a')](_0x1c7dfc[_0xda65('0x5b')],qs[_0xda65('0x5c')](_0x1a3b00[_0xda65('0x45')][_0xda65('0x5c')]));_0x1d1c79[_0xda65('0x4b')]=_0x1d1c79['attributes'][_0xda65('0x5d')]?_0x1d1c79[_0xda65('0x4b')]:_0x1c7dfc[_0xda65('0x5b')];if(_0x1a3b00[_0xda65('0x45')][_0xda65('0x46')]){_0x1d1c79[_0xda65('0x47')]=[{'all':!![]}];}if(_0x1a3b00[_0xda65('0x45')][_0xda65('0x48')]===_0xda65('0x49')){_0x1d1c79[_0xda65('0x47')]=[{'model':db[_0xda65('0x4a')],'as':_0xda65('0x48')}];}_0x1d1c79=_[_0xda65('0x5e')]({},_0x1d1c79,_0x1a3b00[_0xda65('0x5f')]);if(!_[_0xda65('0x36')](_0x1d1c79[_0xda65('0x4b')],'id')){_0x1d1c79[_0xda65('0x4b')][_0xda65('0x4c')]('id');}return db['User'][_0xda65('0x37')](_0x1d1c79)[_0xda65('0x1a')](handleEntityNotFound(_0x1f5bc7,null))[_0xda65('0x1a')](function(_0x3dca3f){var _0x2d1e76=[];values=_0x3dca3f;if(_0x1a3b00[_0xda65('0x45')]['openTabs']===_0xda65('0x49')){_0x2d1e76['push'](get_open_tabs(_0xda65('0x50'),_0x3dca3f['dataValues']));_0x2d1e76[_0xda65('0x4c')](get_open_tabs(_0xda65('0x52'),_0x3dca3f[_0xda65('0x51')]));_0x2d1e76['push'](get_open_tabs(_0xda65('0x55'),_0x3dca3f[_0xda65('0x51')]));_0x2d1e76[_0xda65('0x4c')](get_open_tabs('whatsapp',_0x3dca3f[_0xda65('0x51')]));_0x2d1e76['push'](get_open_tabs(_0xda65('0x53'),_0x3dca3f[_0xda65('0x51')]));_0x2d1e76['push'](get_open_tabs(_0xda65('0x54'),_0x3dca3f[_0xda65('0x51')]));return Promise[_0xda65('0x60')](_0x2d1e76);}else{return values;}})[_0xda65('0x1a')](function(){return values;})['then'](respondWithResult(_0x1f5bc7,null))['catch'](handleError(_0x1f5bc7,null));};exports[_0xda65('0x61')]=function(_0x2e99f6,_0x27127f){if(_0x2e99f6['body']['id']){delete _0x2e99f6[_0xda65('0x62')]['id'];}delete _0x2e99f6[_0xda65('0x62')][_0xda65('0x2d')];return db[_0xda65('0x3d')][_0xda65('0x37')]({'where':{'id':_0x2e99f6[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x27127f,null))[_0xda65('0x1a')](saveUpdates(_0x2e99f6[_0xda65('0x62')],null))[_0xda65('0x1a')](respondWithResult(_0x27127f,null))[_0xda65('0x56')](handleError(_0x27127f,null));};exports[_0xda65('0x64')]=function(_0x1d1fb,_0x5bbb95){return db['User'][_0xda65('0x64')]()[_0xda65('0x1a')](respondWithResult(_0x5bbb95,null))[_0xda65('0x56')](handleError(_0x5bbb95,null));};exports[_0xda65('0x65')]=function(_0x22d2bd,_0x38675f){return db[_0xda65('0x3d')]['find']({'where':{'id':_0x22d2bd[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x38675f,null))[_0xda65('0x1a')](function(_0x36a13a){if(_0x36a13a){return _0x36a13a['addContacts'](_0x22d2bd[_0xda65('0x62')][_0xda65('0x66')],_[_0xda65('0x67')](_0x22d2bd[_0xda65('0x62')],['ids','id'])||{});}})[_0xda65('0x1a')](respondWithResult(_0x38675f,null))['catch'](handleError(_0x38675f,null));};function validateUser(_0x72387d){return new Promise(function(_0x237e73,_0x256490){if(_0x72387d[_0xda65('0x68')])return _0x237e73(_0x72387d);return db[_0xda65('0x69')][_0xda65('0x6a')](0x1)[_0xda65('0x1a')](function(_0x29a527){if(_0x29a527[_0xda65('0x6b')])authService[_0xda65('0x6c')](_0x72387d[_0xda65('0x58')]);db['User'][_0xda65('0x6d')](_0xda65('0x68'))[_0xda65('0x1a')](function(_0xd4a287){if(_['isNil'](_0xd4a287)){_0x72387d['internal']=_0x29a527[_0xda65('0x6e')]||0x1;return;}if(_[_0xda65('0x6f')](_0x29a527[_0xda65('0x6e')])||_0x29a527[_0xda65('0x6e')]===_0xd4a287){_0x72387d[_0xda65('0x68')]=_0xd4a287+0x1;return;}if(_0x29a527[_0xda65('0x6e')]>_0xd4a287){_0x72387d[_0xda65('0x68')]=_0x29a527[_0xda65('0x6e')];return;}return db[_0xda65('0x70')][_0xda65('0x45')](_0xda65('0x71'),{'type':db[_0xda65('0x70')][_0xda65('0x72')]['SELECT']})[_0xda65('0x1a')](function(_0x4b20c0){if(_0x4b20c0&&_0x4b20c0[_0xda65('0x5d')]){for(var _0x87523a=0x0,_0x66cca9=_0x4b20c0[_0xda65('0x5d')];_0x87523a<_0x66cca9&&_[_0xda65('0x6f')](_0x72387d[_0xda65('0x68')]);_0x87523a++){if(_0x29a527[_0xda65('0x6e')]<=_0x4b20c0[_0x87523a][_0xda65('0x73')]){_0x72387d[_0xda65('0x68')]=_0x4b20c0[_0x87523a][_0xda65('0x73')];}else if(_0x29a527[_0xda65('0x6e')]>_0x4b20c0[_0x87523a]['from']&&_0x29a527[_0xda65('0x6e')]<=_0x4b20c0[_0x87523a]['to']){_0x72387d[_0xda65('0x68')]=_0x29a527['min_internal'];}}}if(_['isNil'](_0x72387d[_0xda65('0x68')])){_0x72387d[_0xda65('0x68')]=_0xd4a287+0x1;}return _0x237e73(_0x72387d);});});})[_0xda65('0x56')](function(_0x53e28f){_0x256490(_0x53e28f);});});}function updateUser(_0x33dee8){return new Promise(function(_0x403946,_0x5893d1){try{if(_0x33dee8[_0xda65('0x74')]){_0x33dee8['mailbox']=_0x33dee8[_0xda65('0x68')];_0x33dee8['VoiceMail']={'mailbox':_0x33dee8[_0xda65('0x68')],'password':_0x33dee8['password'],'fullname':_0x33dee8[_0xda65('0x75')],'email':_0x33dee8[_0xda65('0x76')]};}if(_0x33dee8[_0xda65('0x2d')]==='agent'){if(!_0x33dee8[_0xda65('0x77')])_0x33dee8[_0xda65('0x77')]=[_0xda65('0x78'),'102',_0xda65('0x79'),_0xda65('0x7a'),_0xda65('0x7b'),'104','105',_0xda65('0x7c'),'107','108',_0xda65('0x7d'),_0xda65('0x7e'),'111',_0xda65('0x7f'),_0xda65('0x80')];}_0x403946(_0x33dee8);}catch(_0x44b47f){_0x5893d1(_0x44b47f);}});}exports['create']=function(_0x4ce410,_0x37e5ae){if(_0x4ce410[_0xda65('0x30')][_0xda65('0x2d')]==='agent')throw new Error(_0xda65('0x81'));if(_0x4ce410[_0xda65('0x62')][_0xda65('0x2d')]===_0xda65('0x30')&&_0x4ce410[_0xda65('0x30')][_0xda65('0x2d')]!==_0xda65('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x4ce410[_0xda65('0x62')][_0xda65('0x2d')]==='admin'&&_0x4ce410[_0xda65('0x30')][_0xda65('0x2d')]!==_0xda65('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xda65('0x82')]([_0x4ce410[_0xda65('0x62')]])[_0xda65('0x1a')](function(){return validateUser(_0x4ce410['body']);})[_0xda65('0x1a')](function(_0x321077){return updateUser(_0x321077)[_0xda65('0x1a')](function(_0x19d68e){if(_0x19d68e[_0xda65('0x2d')]===_0xda65('0x2e')){_0x19d68e[_0xda65('0x83')]=_0x4ce410[_0xda65('0x30')][_0xda65('0x83')];delete _0x19d68e['userProfileId'];}return _0x19d68e;});})[_0xda65('0x1a')](function(_0xa2f5bd){return db['User'][_0xda65('0x84')](_0xa2f5bd,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0xda65('0x1a')](function(_0x5737e9){if(_0x4ce410[_0xda65('0x62')][_0xda65('0x2d')]===_0xda65('0x30'))return _0x5737e9;if(_0x4ce410['user']['role']!==_0xda65('0x30'))return _0x5737e9;return db[_0xda65('0x85')][_0xda65('0x37')]({'where':{'name':_0x5737e9[_0xda65('0x2d')]===_0xda65('0x32')?_0xda65('0x31'):_0xda65('0x86'),'userProfileId':_0x4ce410[_0xda65('0x30')][_0xda65('0x87')]},'raw':!![]})[_0xda65('0x1a')](function(_0x518cee){if(!_0x518cee||_0x518cee[_0xda65('0x88')]!=0x0)return _0x5737e9;return db['UserProfileResource'][_0xda65('0x84')]({'name':_0x5737e9[_0xda65('0x3a')],'resourceId':_0x5737e9['id'],'type':_0x518cee[_0xda65('0x3a')],'sectionId':_0x518cee['id']},{})['then'](function(){return _0x5737e9;});})[_0xda65('0x56')](function(_0x407a0b){logger[_0xda65('0x20')](_0xda65('0x89'),_0x407a0b);throw _0x407a0b;});})[_0xda65('0x1a')](respondWithResult(_0x37e5ae,0xc9))[_0xda65('0x56')](handleError(_0x37e5ae,null));};exports[_0xda65('0x8a')]=function(_0x16bc02,_0x47c20c){var _0x4ae909=_0x16bc02[_0xda65('0x62')];var _0x93c568=[];if(_0x16bc02[_0xda65('0x30')]['role']===_0xda65('0x32'))throw new Error(_0xda65('0x81'));if(_[_0xda65('0x8b')](_0x4ae909,[_0xda65('0x2d'),_0xda65('0x30')])&&_0x16bc02[_0xda65('0x30')][_0xda65('0x2d')]!==_0xda65('0x2e')){throw new Error(_0xda65('0x8c'));}if(_[_0xda65('0x8b')](_0x4ae909,['role','admin'])&&_0x16bc02[_0xda65('0x30')][_0xda65('0x2d')]!==_0xda65('0x2e')){throw new Error(_0xda65('0x8d'));}return licenseUtil['checkUserLimits'](_0x4ae909)[_0xda65('0x1a')](function(){return validateUser(_0x4ae909[0x0]);})[_0xda65('0x1a')](function(){for(var _0xb4445d=0x1;_0xb4445d<_0x4ae909['length'];_0xb4445d++){var _0xa64273=_0x4ae909[_0xb4445d-0x1]['internal'];if(!_0x4ae909[_0xb4445d][_0xda65('0x68')])_0x4ae909[_0xb4445d]['internal']=_0xa64273+0x1;_0x93c568[_0xda65('0x4c')](validateUser(_0x4ae909[_0xb4445d]));}return Promise[_0xda65('0x60')](_0x93c568);})[_0xda65('0x1a')](function(){_0x93c568=[];for(var _0x46c163=0x0;_0x46c163<_0x4ae909[_0xda65('0x5d')];_0x46c163++){_0x93c568[_0xda65('0x4c')](updateUser(_0x4ae909[_0x46c163]));}return Promise['all'](_0x93c568);})[_0xda65('0x1a')](function(){_0x93c568=_0x4ae909[_0xda65('0x3f')](function(_0x3931f4){return db['User'][_0xda65('0x84')](_0x3931f4,{'include':[{'model':db[_0xda65('0x8e')],'as':_0xda65('0x8e')}]})[_0xda65('0x1a')](function(_0xe6b4c){_0x3931f4['id']=_0xe6b4c['id'];return _0x3931f4;});});return Promise[_0xda65('0x60')](_0x93c568);})[_0xda65('0x1a')](function(_0x5cdb2a){if(_0x16bc02[_0xda65('0x62')][_0xda65('0x2d')]===_0xda65('0x30'))return _0x5cdb2a;if(_0x16bc02[_0xda65('0x30')][_0xda65('0x2d')]!=='user')return _0x5cdb2a;var _0x5ed771=_[_0xda65('0x8b')](_0x5cdb2a,function(_0x13f726){return _0x13f726[_0xda65('0x2d')]===_0xda65('0x32')||_0x13f726[_0xda65('0x2d')]===_0xda65('0x33');});if(!_0x5ed771)return _0x5cdb2a;return db['UserProfileSection'][_0xda65('0x4d')]({'where':{'name':{'$or':[_0xda65('0x31'),'Telephones']},'userProfileId':_0x16bc02['user'][_0xda65('0x87')]},'raw':!![]})['then'](function(_0x4c965d){if(_[_0xda65('0x8f')](_0x4c965d)||!_[_0xda65('0x8b')](_0x4c965d,[_0xda65('0x88'),0x0]))return _0x5cdb2a;_0x93c568=[];var _0x2590e1=_(_0x4c965d)['map'](function(_0x59e536){if(_0x59e536[_0xda65('0x88')]===0x1)return;return _0x59e536[_0xda65('0x3a')]===_0xda65('0x31')?'agent':_0xda65('0x33');})[_0xda65('0x90')]()[_0xda65('0x38')]();for(var _0x1eb003=0x0;_0x1eb003<_0x5cdb2a[_0xda65('0x5d')];_0x1eb003++){if(!_[_0xda65('0x36')](_0x2590e1,_0x5cdb2a[_0x1eb003]['role']))return;var _0x251686=_0x5cdb2a[_0x1eb003][_0xda65('0x2d')]===_0xda65('0x32')?'Agents':_0xda65('0x86');_0x93c568[_0xda65('0x4c')](db[_0xda65('0x91')][_0xda65('0x84')]({'name':_0x5cdb2a[_0x1eb003][_0xda65('0x3a')],'resourceId':_0x5cdb2a[_0x1eb003]['id'],'type':_0x251686,'sectionId':_[_0xda65('0x37')](_0x4c965d,[_0xda65('0x3a'),_0x251686])['id']},{}));}return Promise['all'](_0x93c568);});})[_0xda65('0x1a')](respondWithResult(_0x47c20c,0xc9))[_0xda65('0x56')](handleError(_0x47c20c,null));};exports['changePassword']=function(_0x79b762,_0x349d82){if(_0x79b762['body']['id']){delete _0x79b762[_0xda65('0x62')]['id'];}return db['User'][_0xda65('0x37')]({'where':{'id':_0x79b762[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](function(_0x503cc4){if(!_0x503cc4)return null;if(_0x503cc4['id']===_0x79b762[_0xda65('0x30')]['id']){if(!_0x79b762[_0xda65('0x62')]['oldPassword']||!_0x79b762[_0xda65('0x62')][_0xda65('0x92')]){throw new db['Sequelize'][(_0xda65('0x93'))](_0xda65('0x94'));}if(!_0x503cc4[_0xda65('0x95')](_0x79b762[_0xda65('0x62')][_0xda65('0x96')])){throw new db[(_0xda65('0x97'))]['ValidationError'](_0xda65('0x98'));}if(_0x79b762[_0xda65('0x62')][_0xda65('0x96')]===_0x79b762[_0xda65('0x62')][_0xda65('0x92')]){throw new db[(_0xda65('0x97'))][(_0xda65('0x93'))](_0xda65('0x99'));}}else if(_0x79b762[_0xda65('0x30')][_0xda65('0x2d')]===_0xda65('0x2e')){if(!_0x79b762[_0xda65('0x62')]['newPassword']){throw new db[(_0xda65('0x97'))]['ValidationError'](_0xda65('0x9a'));}}else if(_0x79b762[_0xda65('0x30')][_0xda65('0x2d')]===_0xda65('0x30')){if(!_0x79b762[_0xda65('0x62')][_0xda65('0x92')]){throw new db[(_0xda65('0x97'))][(_0xda65('0x93'))](_0xda65('0x9a'));}if(_0x503cc4[_0xda65('0x2d')]!==_0xda65('0x32')){throw new db[(_0xda65('0x97'))]['ValidationError'](_0xda65('0x81'));}}else{throw new db[(_0xda65('0x97'))][(_0xda65('0x93'))]('Unauthorized');}return _0x503cc4;})[_0xda65('0x1a')](handleEntityNotFound(_0x349d82,null))[_0xda65('0x1a')](function(_0x197a9d){return db[_0xda65('0x69')][_0xda65('0x9b')]({'attributes':['id','securePassword',_0xda65('0x9c'),'passwordHistoryLimit']})[_0xda65('0x1a')](function(_0x1c8f01){if(_0x1c8f01[_0xda65('0x6b')])authService[_0xda65('0x6c')](_0x79b762[_0xda65('0x62')][_0xda65('0x92')]);if(!_0x1c8f01[_0xda65('0x9c')]||!_0x197a9d[_0xda65('0x9d')])return _0x197a9d;authService['validatePasswordHistory'](_0x79b762[_0xda65('0x62')][_0xda65('0x92')],_0x197a9d[_0xda65('0x9d')],_0x1c8f01[_0xda65('0x9e')]);return _0x197a9d;})[_0xda65('0x1a')](saveUpdates({'password':_0x79b762[_0xda65('0x62')]['newPassword'],'passwordResetAt':_0x79b762[_0xda65('0x30')]['id']==_0x79b762[_0xda65('0x63')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x79b762['body'][_0xda65('0x92')],_0x197a9d[_0xda65('0x9d')])},null));})[_0xda65('0x1a')](respondWithResult(_0x349d82,null))['catch'](handleError(_0x349d82,null));};exports[_0xda65('0x9f')]=function(_0x2dd7ab,_0x5cea64){var _0x4e37a1=_0x2dd7ab['body'][_0xda65('0xa0')];return db[_0xda65('0x3d')]['find']({'where':{'id':_0x2dd7ab['params']['id']},'attributes':['id','name','role',_0xda65('0xa1'),_0xda65('0xa2'),'voicePause',_0xda65('0xa3')]})['then'](handleEntityNotFound(_0x5cea64,null))[_0xda65('0x1a')](function(_0x451a66){if(_0x451a66){if(!utils[_0xda65('0xa4')](_0x4e37a1)){throw new db['Sequelize'][(_0xda65('0x93'))]('Unknown\x20channel');}return _0x451a66['add'+_[_0xda65('0xa5')](_0x4e37a1[_0xda65('0xa6')]())+'Queues'](_0x2dd7ab[_0xda65('0x62')][_0xda65('0x66')],{'penalty':_0x2dd7ab[_0xda65('0x62')]['penalty']||0x0})['spread'](function(_0x43ff86){for(var _0x2767ad=0x0;_0x2767ad<_0x2dd7ab[_0xda65('0x62')]['ids'][_0xda65('0x5d')];_0x2767ad+=0x1){var _0x19b4d1={'UserId':Number(_0x2dd7ab[_0xda65('0x63')]['id'])};_0x19b4d1[_['capitalize'](_0x4e37a1[_0xda65('0xa6')]())+_0xda65('0xa7')]=Number(_0x2dd7ab['body']['ids'][_0x2767ad]);socket[_0xda65('0xa8')](_0xda65('0x30')+_['capitalize'](_0x4e37a1['toLowerCase']())+_0xda65('0xa9'),_0x19b4d1);}return _0x43ff86;})[_0xda65('0x1a')](function(){if(_0x4e37a1==='voice'){return db[_0xda65('0xaa')][_0xda65('0x4d')]({'where':{'id':_0x2dd7ab[_0xda65('0x62')][_0xda65('0x66')]||[]},'raw':!![],'attributes':['id',_0xda65('0x3a')]});}})[_0xda65('0x1a')](function(_0x44fe1c){var _0x28198b=_0x451a66[_0xda65('0x2c')]({'plain':!![]});var _0x261786=[];if(_0x4e37a1===_0xda65('0xab')&&_0x28198b['role']==='agent'&&_0x28198b[_0xda65('0xa1')]){for(let _0x2a1b81=0x0;_0x2a1b81<_0x44fe1c[_0xda65('0x5d')];_0x2a1b81+=0x1){_0x261786[_0xda65('0x4c')]({'membername':_0x28198b[_0xda65('0x3a')],'UserId':_0x28198b['id'],'queue_name':_0x44fe1c[_0x2a1b81][_0xda65('0x3a')],'VoiceQueueId':_0x44fe1c[_0x2a1b81]['id'],'interface':_['isNil'](_0x28198b[_0xda65('0xa3')])?util[_0xda65('0xac')]('SIP/%s',_0x28198b[_0xda65('0x3a')]):_0x28198b[_0xda65('0xa3')],'paused':_0x28198b[_0xda65('0xad')]||![],'penalty':_0x2dd7ab[_0xda65('0x62')][_0xda65('0xae')]||0x0});}return Promise[_0xda65('0x60')](_0x261786[_0xda65('0x3f')](function(_0x3f4c9a){return db[_0xda65('0xaf')][_0xda65('0xb0')](_0x3f4c9a);}));}return _0x451a66;});}})[_0xda65('0x1a')](respondWithStatusCode(_0x5cea64,null))[_0xda65('0x56')](handleError(_0x5cea64,null));};exports['removeQueues']=function(_0xd0dbd4,_0x4a6675){var _0x4c4dda,_0x1174bd;return db[_0xda65('0x3d')][_0xda65('0x37')]({'where':{'id':_0xd0dbd4['params']['id']},'attributes':['id',_0xda65('0x3a'),_0xda65('0x2d')]})[_0xda65('0x1a')](handleEntityNotFound(_0x4a6675,null))[_0xda65('0x1a')](function(_0x5934ad){if(_0x5934ad){_0x4c4dda=_0x5934ad;if(!_0xd0dbd4[_0xda65('0x45')][_0xda65('0xa0')]||!utils[_0xda65('0xa4')](_0xd0dbd4[_0xda65('0x45')][_0xda65('0xa0')])){throw new db['Sequelize'][(_0xda65('0x93'))]('Unknown\x20channel');}return _0x5934ad['remove'+_[_0xda65('0xa5')](_0xd0dbd4[_0xda65('0x45')][_0xda65('0xa0')][_0xda65('0xa6')]())+_0xda65('0xb1')](_0xd0dbd4[_0xda65('0x45')]['ids']);}})[_0xda65('0x1a')](function(_0x5eb581){if(_[_0xda65('0xb2')](_0xd0dbd4[_0xda65('0x45')][_0xda65('0x66')])){for(var _0x1143c4=0x0;_0x1143c4<_0xd0dbd4[_0xda65('0x45')]['ids']['length'];_0x1143c4+=0x1){_0x1174bd={'UserId':Number(_0xd0dbd4['params']['id'])};_0x1174bd[_[_0xda65('0xa5')](_0xd0dbd4['query'][_0xda65('0xa0')][_0xda65('0xa6')]())+_0xda65('0xa7')]=Number(_0xd0dbd4[_0xda65('0x45')][_0xda65('0x66')][_0x1143c4]);socket[_0xda65('0xa8')](_0xda65('0x30')+_['capitalize'](_0xd0dbd4[_0xda65('0x45')][_0xda65('0xa0')][_0xda65('0xa6')]())+_0xda65('0xb3'),_0x1174bd);}}else{_0x1174bd={'UserId':Number(_0xd0dbd4['params']['id'])};_0x1174bd[_[_0xda65('0xa5')](_0xd0dbd4[_0xda65('0x45')][_0xda65('0xa0')][_0xda65('0xa6')]())+_0xda65('0xa7')]=Number(_0xd0dbd4['query'][_0xda65('0x66')]);socket[_0xda65('0xa8')](_0xda65('0x30')+_[_0xda65('0xa5')](_0xd0dbd4['query'][_0xda65('0xa0')]['toLowerCase']())+_0xda65('0xb3'),_0x1174bd);}return _0x5eb581;})['then'](function(){if(_0xd0dbd4[_0xda65('0x45')][_0xda65('0xa0')]===_0xda65('0xab')){return db['UserVoiceQueueRt'][_0xda65('0x2b')]({'where':{'UserId':_0xd0dbd4[_0xda65('0x63')]['id'],'VoiceQueueId':_0xd0dbd4[_0xda65('0x45')][_0xda65('0x66')]},'individualHooks':!![]})['then'](function(){return _0x4c4dda;});}return _0x4c4dda;})[_0xda65('0x1a')](respondWithStatusCode(_0x4a6675,null))[_0xda65('0x56')](handleError(_0x4a6675,null));};exports[_0xda65('0xb4')]=function(_0x16561b,_0x3e3a24){_0x16561b[_0xda65('0x62')]['userpic']=_0x16561b['file'][_0xda65('0xb5')];return db['User'][_0xda65('0x37')]({'where':{'id':_0x16561b[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x3e3a24,null))[_0xda65('0x1a')](saveUpdates(_0x16561b[_0xda65('0x62')],null))['then'](respondWithResult(_0x3e3a24,null))[_0xda65('0x56')](handleError(_0x3e3a24,null));};exports['getAvatar']=function(_0x40b1c5,_0x6b0515){var _0x6c58d3=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db['User'][_0xda65('0x37')]({'where':{'id':_0x40b1c5[_0xda65('0x63')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x6b0515,null))[_0xda65('0x1a')](function(_0x1071c8){if(_0x1071c8){if(_[_0xda65('0x6f')](_0x1071c8[_0xda65('0xb6')])){return _0x6b0515[_0xda65('0xb7')](_0x6c58d3);}else{if(!fs[_0xda65('0xb8')](path[_0xda65('0xb9')](config[_0xda65('0xba')],_0xda65('0xbb'),_0x1071c8[_0xda65('0xb6')]))){return _0x6b0515[_0xda65('0xb7')](_0x6c58d3);}return _0x6b0515[_0xda65('0xb7')](path[_0xda65('0xb9')](config[_0xda65('0xba')],_0xda65('0xbb'),_0x1071c8[_0xda65('0xb6')]));}}})[_0xda65('0x56')](handleError(_0x6b0515,null));};exports['getOpenTabs']=function(_0x49f6bc,_0x4e0337){return db[_0xda65('0x3d')][_0xda65('0x37')]({'where':{'id':_0x49f6bc[_0xda65('0x63')]['id']},'attributes':['id']})[_0xda65('0x1a')](handleEntityNotFound(_0x4e0337,null))[_0xda65('0x1a')](function(_0x536e62){var _0x2eb1e9=[];values=_0x536e62['dataValues'];_0x2eb1e9['push'](get_open_tabs(_0xda65('0x50'),_0x536e62[_0xda65('0x51')]));_0x2eb1e9[_0xda65('0x4c')](get_open_tabs(_0xda65('0x52'),_0x536e62[_0xda65('0x51')]));_0x2eb1e9[_0xda65('0x4c')](get_open_tabs('openchannel',_0x536e62[_0xda65('0x51')]));_0x2eb1e9[_0xda65('0x4c')](get_open_tabs(_0xda65('0xbc'),_0x536e62['dataValues']));_0x2eb1e9[_0xda65('0x4c')](get_open_tabs(_0xda65('0x53'),_0x536e62['dataValues']));_0x2eb1e9[_0xda65('0x4c')](get_open_tabs('mail',_0x536e62[_0xda65('0x51')]));return Promise[_0xda65('0x60')](_0x2eb1e9);})[_0xda65('0x1a')](function(_0x360a2a){if(_0x360a2a){var _0x31f95f=_[_0xda65('0x3f')](values[_0xda65('0xbd')],function(_0x1af2d7){return{'channel':_0xda65('0xbe'),'id':_0x1af2d7['id'],'createdAt':_0x1af2d7[_0xda65('0xbf')]};});var _0x3c208c=_[_0xda65('0x3f')](values[_0xda65('0xc0')],function(_0x1c24bb){return{'channel':_0xda65('0xc1'),'id':_0x1c24bb['id'],'createdAt':_0x1c24bb['createdAt']};});var _0x1dfb35=_[_0xda65('0x3f')](values[_0xda65('0xc2')],function(_0x4d76bd){return{'channel':_0xda65('0xc3'),'id':_0x4d76bd['id'],'createdAt':_0x4d76bd[_0xda65('0xbf')]};});var _0x330698=_[_0xda65('0x3f')](values[_0xda65('0xc4')],function(_0x2062bb){return{'channel':_0xda65('0xc5'),'id':_0x2062bb['id'],'createdAt':_0x2062bb[_0xda65('0xbf')]};});var _0x1de28e=_[_0xda65('0x3f')](values[_0xda65('0xc6')],function(_0x2264ca){return{'channel':_0xda65('0xc7'),'id':_0x2264ca['id'],'createdAt':_0x2264ca[_0xda65('0xbf')]};});var _0x4ebd96=_[_0xda65('0x3f')](values[_0xda65('0xc8')],function(_0x30b289){return{'channel':_0xda65('0xc9'),'id':_0x30b289['id'],'createdAt':_0x30b289[_0xda65('0xbf')]};});var _0x13ba5a=_[_0xda65('0xca')](_0x31f95f,_0x3c208c,_0x1dfb35,_0x330698,_0x1de28e,_0x4ebd96);var _0x5cb9a0={'count':_0x13ba5a[_0xda65('0x5d')],'rows':_0x13ba5a};return _0x5cb9a0;}else return null;})['then'](respondWithResult(_0x4e0337,null))['catch'](handleError(_0x4e0337,null));};exports[_0xda65('0xcb')]=function(_0x56d39d,_0x322591){var _0x3357b5={};var _0x37c123={};var _0x3bcca3;var _0xd11c32;return db[_0xda65('0x3d')][_0xda65('0x9b')]({'where':{'id':_0x56d39d[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x322591,null))[_0xda65('0x1a')](function(_0x23d3b0){if(_0x23d3b0){_0x3bcca3=_0x23d3b0;_0x37c123[_0xda65('0x5b')]=_[_0xda65('0x57')](db[_0xda65('0xcc')][_0xda65('0x3e')]);_0x37c123[_0xda65('0x45')]=_[_0xda65('0x57')](_0x56d39d['query']);_0x37c123[_0xda65('0x59')]=_['intersection'](_0x37c123[_0xda65('0x5b')],_0x37c123[_0xda65('0x45')]);_0x3357b5[_0xda65('0x4b')]=_[_0xda65('0x5a')](_0x37c123[_0xda65('0x5b')],qs['fields'](_0x56d39d[_0xda65('0x45')][_0xda65('0x5c')]));_0x3357b5[_0xda65('0x4b')]=_0x3357b5[_0xda65('0x4b')][_0xda65('0x5d')]?_0x3357b5[_0xda65('0x4b')]:_0x37c123[_0xda65('0x5b')];_0x3357b5[_0xda65('0xcd')]=qs[_0xda65('0xce')](_0x56d39d['query']['sort']);_0x3357b5[_0xda65('0x44')]=qs[_0xda65('0x59')](_['pick'](_0x56d39d[_0xda65('0x45')],_0x37c123[_0xda65('0x59')]));if(_0x56d39d[_0xda65('0x45')][_0xda65('0x34')]){_0x3357b5['where']=_[_0xda65('0x5e')](_0x3357b5[_0xda65('0x44')],{'$or':_['map'](_0x3357b5[_0xda65('0x4b')],function(_0x35cc22){var _0x164bb1={};_0x164bb1[_0x35cc22]={'$like':'%'+_0x56d39d[_0xda65('0x45')][_0xda65('0x34')]+'%'};return _0x164bb1;})});}_0x3357b5=_[_0xda65('0x5e')]({},_0x3357b5,_0x56d39d[_0xda65('0x5f')]);return _0x3bcca3[_0xda65('0xcb')](_0x3357b5);}})[_0xda65('0x1a')](function(_0x3fb1c4){if(_0x3fb1c4){_0xd11c32=_0x3fb1c4[_0xda65('0x5d')];if(_0x56d39d[_0xda65('0x45')][_0xda65('0xcf')]('includeAll')){_0x3357b5[_0xda65('0x47')]=[{'model':db[_0xda65('0xd0')],'as':_0xda65('0xd1'),'required':![]},{'model':db['Tag'],'as':_0xda65('0xd2'),'attributes':['id',_0xda65('0x3a'),'color'],'where':_0x56d39d[_0xda65('0x45')][_0xda65('0xd3')]?{'id':_0x56d39d[_0xda65('0x45')][_0xda65('0xd3')]}:undefined,'required':_0x56d39d['query'][_0xda65('0xd3')]?!![]:![]}];}if(!_0x56d39d[_0xda65('0x45')][_0xda65('0xcf')](_0xda65('0xd4'))){_0x3357b5[_0xda65('0x27')]=qs[_0xda65('0x27')](_0x56d39d[_0xda65('0x45')]['limit']);_0x3357b5['offset']=qs[_0xda65('0x25')](_0x56d39d[_0xda65('0x45')][_0xda65('0x25')]);}return _0x3bcca3[_0xda65('0xcb')](_0x3357b5);}})[_0xda65('0x1a')](function(_0x4fb7be){if(_0x4fb7be){return _0x4fb7be?{'count':_0xd11c32,'rows':_0x4fb7be}:null;}})[_0xda65('0x1a')](respondWithResult(_0x322591,null))[_0xda65('0x56')](handleError(_0x322591,null));};exports[_0xda65('0xd5')]=function(_0x30e4df,_0x348215){var _0x28d486;var _0x582f0c={};var _0x3fbf93;return db[_0xda65('0x3d')][_0xda65('0x9b')]({'where':{'id':_0x30e4df[_0xda65('0x63')]['id']},'attributes':['id','name',_0xda65('0x2d')]})['then'](handleEntityNotFound(_0x348215,null))[_0xda65('0x1a')](function(_0x21895d){if(!utils[_0xda65('0xa4')](_0x30e4df[_0xda65('0x45')][_0xda65('0xa0')])){throw new db['Sequelize'][(_0xda65('0x93'))]('Unknown\x20channel');}_0x28d486=_0x21895d;var _0x45abc4={};_0x45abc4[_0xda65('0x5b')]=_[_0xda65('0x57')](db[_['capitalize'](_0x30e4df[_0xda65('0x45')][_0xda65('0xa0')])+'Queue']['rawAttributes']);_0x45abc4[_0xda65('0x45')]=_[_0xda65('0x57')](_0x30e4df[_0xda65('0x45')]);_0x45abc4[_0xda65('0x59')]=_[_0xda65('0x5a')](_0x45abc4[_0xda65('0x5b')],_0x45abc4['query']);_0x582f0c['attributes']=_['intersection'](_0x45abc4['model'],qs[_0xda65('0x5c')](_0x30e4df[_0xda65('0x45')]['fields']));_0x582f0c['attributes']=_0x582f0c[_0xda65('0x4b')][_0xda65('0x5d')]?_0x582f0c[_0xda65('0x4b')]:_0x45abc4[_0xda65('0x5b')];_0x582f0c[_0xda65('0xcd')]=qs[_0xda65('0xce')](_0x30e4df[_0xda65('0x45')][_0xda65('0xce')]);_0x582f0c['where']=qs[_0xda65('0x59')](_[_0xda65('0xd6')](_0x30e4df['query'],_0x45abc4[_0xda65('0x59')]));if(_0x30e4df[_0xda65('0x45')][_0xda65('0x34')]){_0x582f0c[_0xda65('0x44')]=_[_0xda65('0x5e')](_0x582f0c[_0xda65('0x44')],{'$or':_[_0xda65('0x3f')](_0x582f0c[_0xda65('0x4b')],function(_0x164426){var _0x5127e9={};_0x5127e9[_0x164426]={'$like':'%'+_0x30e4df[_0xda65('0x45')]['filter']+'%'};return _0x5127e9;})});}_0x582f0c=_[_0xda65('0x5e')]({},_0x582f0c,_0x30e4df['options']);switch(_0x28d486[_0xda65('0x2d')]){case'admin':return db[_[_0xda65('0xa5')](_0x30e4df['query'][_0xda65('0xa0')])+'Queue']['findAll'](_0x582f0c);case'user':case _0xda65('0x32'):return _0x28d486[_0xda65('0x2c')+_['capitalize'](_0x30e4df['query'][_0xda65('0xa0')])+_0xda65('0xb1')](_0x582f0c);default:throw new db[(_0xda65('0x97'))][(_0xda65('0x93'))]('Unknown\x20role');}})[_0xda65('0x1a')](function(_0x5dc1a7){_0x3fbf93=_0x5dc1a7['length'];if(!_0x30e4df[_0xda65('0x45')][_0xda65('0xcf')](_0xda65('0xd4'))){_0x582f0c[_0xda65('0x27')]=qs['limit'](_0x30e4df['query'][_0xda65('0x27')]);_0x582f0c[_0xda65('0x25')]=qs[_0xda65('0x25')](_0x30e4df['query'][_0xda65('0x25')]);}switch(_0x28d486[_0xda65('0x2d')]){case _0xda65('0x2e'):return db[_[_0xda65('0xa5')](_0x30e4df['query']['channel'])+_0xda65('0xd7')][_0xda65('0x4d')](_0x582f0c);case'user':case _0xda65('0x32'):return _0x28d486['get'+_['capitalize'](_0x30e4df[_0xda65('0x45')][_0xda65('0xa0')])+_0xda65('0xb1')](_0x582f0c);}})[_0xda65('0x1a')](function(_0x47985e){return{'count':_0x3fbf93,'rows':_0x47985e};})[_0xda65('0x1a')](respondWithResult(_0x348215,null))[_0xda65('0x56')](handleError(_0x348215,null));};exports[_0xda65('0xd8')]=function(_0x3a692f,_0x2c89cc){var _0x54a71c={};var _0x21ffdb={};var _0x242762;var _0x2d6544;return db[_0xda65('0x3d')]['findOne']({'where':{'id':_0x3a692f[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x2c89cc,null))[_0xda65('0x1a')](function(_0x5ce01d){if(_0x5ce01d){_0x242762=_0x5ce01d;_0x21ffdb['model']=_[_0xda65('0x57')](db['UserVoiceQueueRt'][_0xda65('0x3e')]);_0x21ffdb[_0xda65('0x45')]=_[_0xda65('0x57')](_0x3a692f[_0xda65('0x45')]);_0x21ffdb[_0xda65('0x59')]=_['intersection'](_0x21ffdb[_0xda65('0x5b')],_0x21ffdb[_0xda65('0x45')]);_0x54a71c['attributes']=_[_0xda65('0x5a')](_0x21ffdb[_0xda65('0x5b')],qs[_0xda65('0x5c')](_0x3a692f[_0xda65('0x45')][_0xda65('0x5c')]));_0x54a71c[_0xda65('0x4b')]=_0x54a71c[_0xda65('0x4b')]['length']?_0x54a71c[_0xda65('0x4b')]:_0x21ffdb[_0xda65('0x5b')];_0x54a71c[_0xda65('0xcd')]=qs['sort'](_0x3a692f['query'][_0xda65('0xce')]);_0x54a71c['where']=qs['filters'](_['pick'](_0x3a692f[_0xda65('0x45')],_0x21ffdb['filters']));if(_0x3a692f['query'][_0xda65('0x34')]){_0x54a71c[_0xda65('0x44')]=_[_0xda65('0x5e')](_0x54a71c[_0xda65('0x44')],{'$or':_[_0xda65('0x3f')](_0x54a71c['attributes'],function(_0x4bb68e){var _0x552fed={};_0x552fed[_0x4bb68e]={'$like':'%'+_0x3a692f['query'][_0xda65('0x34')]+'%'};return _0x552fed;})});}_0x54a71c=_[_0xda65('0x5e')]({},_0x54a71c,_0x3a692f[_0xda65('0x5f')]);return _0x242762[_0xda65('0xd8')](_0x54a71c);}})[_0xda65('0x1a')](function(_0x3f3898){if(_0x3f3898){_0x2d6544=_0x3f3898[_0xda65('0x5d')];if(!_0x3a692f[_0xda65('0x45')][_0xda65('0xcf')](_0xda65('0xd4'))){_0x54a71c[_0xda65('0x27')]=qs[_0xda65('0x27')](_0x3a692f['query'][_0xda65('0x27')]);_0x54a71c['offset']=qs[_0xda65('0x25')](_0x3a692f['query']['offset']);}return _0x242762[_0xda65('0xd8')](_0x54a71c);}})[_0xda65('0x1a')](function(_0x4be0c9){if(_0x4be0c9){return _0x4be0c9?{'count':_0x2d6544,'rows':_0x4be0c9}:null;}})[_0xda65('0x1a')](respondWithResult(_0x2c89cc,null))[_0xda65('0x56')](handleError(_0x2c89cc,null));};exports[_0xda65('0xd9')]=function(_0x4225ba,_0x2e74a0){var _0x2970f6={};var _0x55f002={};var _0xb5aad4;var _0x269f4e;return db['User'][_0xda65('0x9b')]({'where':{'id':_0x4225ba[_0xda65('0x63')]['id']}})['then'](handleEntityNotFound(_0x2e74a0,null))[_0xda65('0x1a')](function(_0x1c8bf4){if(_0x1c8bf4){_0xb5aad4=_0x1c8bf4;_0x55f002[_0xda65('0x5b')]=_[_0xda65('0x57')](db['ChatGroup'][_0xda65('0x3e')]);_0x55f002[_0xda65('0x45')]=_[_0xda65('0x57')](_0x4225ba['query']);_0x55f002[_0xda65('0x59')]=_[_0xda65('0x5a')](_0x55f002[_0xda65('0x5b')],_0x55f002['query']);_0x2970f6[_0xda65('0x4b')]=_['intersection'](_0x55f002[_0xda65('0x5b')],qs[_0xda65('0x5c')](_0x4225ba[_0xda65('0x45')][_0xda65('0x5c')]));_0x2970f6['attributes']=_0x2970f6[_0xda65('0x4b')][_0xda65('0x5d')]?_0x2970f6[_0xda65('0x4b')]:_0x55f002[_0xda65('0x5b')];_0x2970f6['order']=qs[_0xda65('0xce')](_0x4225ba['query'][_0xda65('0xce')]);_0x2970f6[_0xda65('0x44')]=qs[_0xda65('0x59')](_['pick'](_0x4225ba[_0xda65('0x45')],_0x55f002['filters']));if(_0x4225ba[_0xda65('0x45')][_0xda65('0x34')]){_0x2970f6[_0xda65('0x44')]=_[_0xda65('0x5e')](_0x2970f6[_0xda65('0x44')],{'$or':_[_0xda65('0x3f')](_0x2970f6[_0xda65('0x4b')],function(_0x109216){var _0x19b116={};_0x19b116[_0x109216]={'$like':'%'+_0x4225ba[_0xda65('0x45')]['filter']+'%'};return _0x19b116;})});}_0x2970f6=_['merge']({},_0x2970f6,_0x4225ba['options']);return _0xb5aad4[_0xda65('0xd9')](_0x2970f6);}})[_0xda65('0x1a')](function(_0xb48e53){if(_0xb48e53){_0x269f4e=_0xb48e53['length'];if(!_0x4225ba[_0xda65('0x45')][_0xda65('0xcf')](_0xda65('0xd4'))){_0x2970f6[_0xda65('0x27')]=qs[_0xda65('0x27')](_0x4225ba['query']['limit']);_0x2970f6['offset']=qs[_0xda65('0x25')](_0x4225ba[_0xda65('0x45')]['offset']);}return _0xb5aad4[_0xda65('0xd9')](_0x2970f6);}})[_0xda65('0x1a')](function(_0x502ec9){if(_0x502ec9){return _0x502ec9?{'count':_0x269f4e,'rows':_0x502ec9}:null;}})[_0xda65('0x1a')](respondWithResult(_0x2e74a0,null))['catch'](handleError(_0x2e74a0,null));};exports['getRecordings']=function(_0x2aebb2,_0x19404c){var _0x2b76e9={'raw':!![],'where':{}};var _0x5d0d9f={};var _0x5dd4d1={'count':0x0,'rows':[]};return db[_0xda65('0x3d')][_0xda65('0x9b')]({'where':{'id':_0x2aebb2['params']['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x19404c,null))['then'](function(_0x54284d){if(_0x54284d){_0x5d0d9f['model']=_[_0xda65('0x57')](db[_0xda65('0xda')][_0xda65('0x3e')]);_0x5d0d9f[_0xda65('0x45')]=_[_0xda65('0x57')](_0x2aebb2[_0xda65('0x45')]);_0x5d0d9f[_0xda65('0x59')]=_['intersection'](_0x5d0d9f[_0xda65('0x5b')],_0x5d0d9f['query']);_0x2b76e9['attributes']=_['intersection'](_0x5d0d9f[_0xda65('0x5b')],qs[_0xda65('0x5c')](_0x2aebb2[_0xda65('0x45')]['fields']));_0x2b76e9[_0xda65('0x4b')]=_0x2b76e9[_0xda65('0x4b')][_0xda65('0x5d')]?_0x2b76e9['attributes']:_0x5d0d9f[_0xda65('0x5b')];if(!_0x2aebb2[_0xda65('0x45')][_0xda65('0xcf')](_0xda65('0xd4'))){_0x2b76e9[_0xda65('0x27')]=qs[_0xda65('0x27')](_0x2aebb2[_0xda65('0x45')][_0xda65('0x27')]);_0x2b76e9[_0xda65('0x25')]=qs['offset'](_0x2aebb2[_0xda65('0x45')][_0xda65('0x25')]);}_0x2b76e9['order']=qs[_0xda65('0xce')](_0x2aebb2[_0xda65('0x45')][_0xda65('0xce')]);_0x2b76e9[_0xda65('0x44')]=qs['filters'](_[_0xda65('0xd6')](_0x2aebb2[_0xda65('0x45')],_0x5d0d9f[_0xda65('0x59')]));_0x2b76e9[_0xda65('0x44')]['UserId']=_0x54284d['id'];if(_0x2aebb2[_0xda65('0x45')][_0xda65('0x34')]){_0x2b76e9['where']=_[_0xda65('0x5e')](_0x2b76e9['where'],{'$or':_[_0xda65('0x3f')](_0x2b76e9[_0xda65('0x4b')],function(_0x3b45b6){var _0x60778d={};_0x60778d[_0x3b45b6]={'$like':'%'+_0x2aebb2[_0xda65('0x45')]['filter']+'%'};return _0x60778d;})});}_0x2b76e9=_[_0xda65('0x5e')]({},_0x2b76e9,_0x2aebb2[_0xda65('0x5f')]);return db['VoiceRecording'][_0xda65('0x28')]({'where':_0x2b76e9[_0xda65('0x44')]})[_0xda65('0x1a')](function(_0x3f527c){_0x5dd4d1[_0xda65('0x28')]=_0x3f527c;if(_0x2aebb2['query'][_0xda65('0x46')]){_0x2b76e9[_0xda65('0x47')]=[{'all':!![]}];}return db['VoiceRecording'][_0xda65('0x4d')](_0x2b76e9);})[_0xda65('0x1a')](function(_0x3148a9){_0x5dd4d1[_0xda65('0x4e')]=_0x3148a9;return _0x5dd4d1;});}})['then'](respondWithFilteredResult(_0x19404c,_0x2b76e9))[_0xda65('0x56')](handleError(_0x19404c,null));};exports[_0xda65('0xdb')]=function(_0x532153,_0x3d22e2){var _0x51e3b3={'raw':!![],'where':{}};var _0x445fb8={};var _0x249cae={'count':0x0,'rows':[]};return db['User'][_0xda65('0x9b')]({'where':{'id':_0x532153['params']['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x3d22e2,null))[_0xda65('0x1a')](function(_0x38f1ad){if(_0x38f1ad){_0x445fb8['model']=_[_0xda65('0x57')](db[_0xda65('0xdc')][_0xda65('0x3e')]);_0x445fb8[_0xda65('0x45')]=_[_0xda65('0x57')](_0x532153[_0xda65('0x45')]);_0x445fb8[_0xda65('0x59')]=_[_0xda65('0x5a')](_0x445fb8[_0xda65('0x5b')],_0x445fb8[_0xda65('0x45')]);_0x51e3b3['attributes']=_[_0xda65('0x5a')](_0x445fb8[_0xda65('0x5b')],qs[_0xda65('0x5c')](_0x532153['query'][_0xda65('0x5c')]));_0x51e3b3[_0xda65('0x4b')]=_0x51e3b3[_0xda65('0x4b')][_0xda65('0x5d')]?_0x51e3b3['attributes']:_0x445fb8['model'];if(!_0x532153['query'][_0xda65('0xcf')](_0xda65('0xd4'))){_0x51e3b3[_0xda65('0x27')]=qs[_0xda65('0x27')](_0x532153[_0xda65('0x45')][_0xda65('0x27')]);_0x51e3b3['offset']=qs['offset'](_0x532153[_0xda65('0x45')][_0xda65('0x25')]);}_0x51e3b3[_0xda65('0xcd')]=qs['sort'](_0x532153[_0xda65('0x45')][_0xda65('0xce')]);_0x51e3b3[_0xda65('0x44')]=qs['filters'](_[_0xda65('0xd6')](_0x532153['query'],_0x445fb8[_0xda65('0x59')]));_0x51e3b3['where']['UserId']=_0x38f1ad['id'];if(_0x532153[_0xda65('0x45')]['filter']){_0x51e3b3[_0xda65('0x44')]=_[_0xda65('0x5e')](_0x51e3b3[_0xda65('0x44')],{'$or':_[_0xda65('0x3f')](_0x51e3b3[_0xda65('0x4b')],function(_0x5d6efb){var _0x2ea4e7={};_0x2ea4e7[_0x5d6efb]={'$like':'%'+_0x532153[_0xda65('0x45')]['filter']+'%'};return _0x2ea4e7;})});}_0x51e3b3=_[_0xda65('0x5e')]({},_0x51e3b3,_0x532153[_0xda65('0x5f')]);return db[_0xda65('0xdc')]['count']({'where':_0x51e3b3[_0xda65('0x44')]})[_0xda65('0x1a')](function(_0x10e7db){_0x249cae[_0xda65('0x28')]=_0x10e7db;if(_0x532153['query'][_0xda65('0x46')]){_0x51e3b3[_0xda65('0x47')]=[{'all':!![]}];}return db[_0xda65('0xdc')][_0xda65('0x4d')](_0x51e3b3);})['then'](function(_0x44c543){_0x249cae[_0xda65('0x4e')]=_0x44c543;return _0x249cae;});}})[_0xda65('0x1a')](respondWithFilteredResult(_0x3d22e2,_0x51e3b3))['catch'](handleError(_0x3d22e2,null));};exports[_0xda65('0xdd')]=function(_0x5a8859,_0x3eef8a){var _0x1f57ff={};var _0x4ce1fa={};var _0x2642f8;var _0x1b0148;return db['User'][_0xda65('0x9b')]({'where':{'id':_0x5a8859[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x3eef8a,null))[_0xda65('0x1a')](function(_0x727dd9){if(_0x727dd9){_0x2642f8=_0x727dd9;_0x4ce1fa['model']=_[_0xda65('0x57')](db[_0xda65('0xde')][_0xda65('0x3e')]);_0x4ce1fa[_0xda65('0x45')]=_['keys'](_0x5a8859[_0xda65('0x45')]);_0x4ce1fa['filters']=_[_0xda65('0x5a')](_0x4ce1fa[_0xda65('0x5b')],_0x4ce1fa[_0xda65('0x45')]);_0x1f57ff[_0xda65('0x4b')]=_[_0xda65('0x5a')](_0x4ce1fa[_0xda65('0x5b')],qs[_0xda65('0x5c')](_0x5a8859['query'][_0xda65('0x5c')]));_0x1f57ff[_0xda65('0x4b')]=_0x1f57ff[_0xda65('0x4b')]['length']?_0x1f57ff['attributes']:_0x4ce1fa[_0xda65('0x5b')];_0x1f57ff[_0xda65('0xcd')]=qs[_0xda65('0xce')](_0x5a8859[_0xda65('0x45')][_0xda65('0xce')]);_0x1f57ff[_0xda65('0x44')]=qs['filters'](_[_0xda65('0xd6')](_0x5a8859['query'],_0x4ce1fa[_0xda65('0x59')]));if(_0x5a8859[_0xda65('0x45')][_0xda65('0x34')]){_0x1f57ff[_0xda65('0x44')]=_[_0xda65('0x5e')](_0x1f57ff['where'],{'$or':_[_0xda65('0x3f')](_0x1f57ff[_0xda65('0x4b')],function(_0x22594a){var _0x112abf={};_0x112abf[_0x22594a]={'$like':'%'+_0x5a8859[_0xda65('0x45')][_0xda65('0x34')]+'%'};return _0x112abf;})});}_0x1f57ff=_['merge']({},_0x1f57ff,_0x5a8859[_0xda65('0x5f')]);return _0x2642f8[_0xda65('0xdd')](_0x1f57ff);}})[_0xda65('0x1a')](function(_0x517524){if(_0x517524){_0x1b0148=_0x517524[_0xda65('0x5d')];if(!_0x5a8859['query'][_0xda65('0xcf')]('nolimit')){_0x1f57ff[_0xda65('0x27')]=qs[_0xda65('0x27')](_0x5a8859['query'][_0xda65('0x27')]);_0x1f57ff['offset']=qs['offset'](_0x5a8859[_0xda65('0x45')][_0xda65('0x25')]);}return _0x2642f8[_0xda65('0xdd')](_0x1f57ff);}})['then'](function(_0x531614){if(_0x531614){return _0x531614?{'count':_0x1b0148,'rows':_0x531614}:null;}})[_0xda65('0x1a')](respondWithResult(_0x3eef8a,null))[_0xda65('0x56')](handleError(_0x3eef8a,null));};exports[_0xda65('0xdf')]=function(_0x23e649,_0x5fae23){var _0x4c9812={};var _0x467a54={};var _0x5e9d48;var _0x5c01c9;return db[_0xda65('0x3d')][_0xda65('0x9b')]({'where':{'id':_0x23e649[_0xda65('0x63')]['id']}})['then'](handleEntityNotFound(_0x5fae23,null))[_0xda65('0x1a')](function(_0x52646){if(_0x52646){_0x5e9d48=_0x52646;_0x467a54[_0xda65('0x5b')]=_[_0xda65('0x57')](db[_0xda65('0xe0')][_0xda65('0x3e')]);_0x467a54['query']=_[_0xda65('0x57')](_0x23e649[_0xda65('0x45')]);_0x467a54['filters']=_[_0xda65('0x5a')](_0x467a54[_0xda65('0x5b')],_0x467a54['query']);_0x4c9812[_0xda65('0x4b')]=_[_0xda65('0x5a')](_0x467a54['model'],qs['fields'](_0x23e649[_0xda65('0x45')][_0xda65('0x5c')]));_0x4c9812[_0xda65('0x4b')]=_0x4c9812['attributes'][_0xda65('0x5d')]?_0x4c9812['attributes']:_0x467a54[_0xda65('0x5b')];_0x4c9812[_0xda65('0xcd')]=qs[_0xda65('0xce')](_0x23e649['query'][_0xda65('0xce')]);_0x4c9812['where']=qs['filters'](_[_0xda65('0xd6')](_0x23e649[_0xda65('0x45')],_0x467a54[_0xda65('0x59')]));if(_0x23e649[_0xda65('0x45')]['filter']){_0x4c9812['where']=_['merge'](_0x4c9812[_0xda65('0x44')],{'$or':_[_0xda65('0x3f')](_0x4c9812['attributes'],function(_0x1e70ea){var _0x55088d={};_0x55088d[_0x1e70ea]={'$like':'%'+_0x23e649['query'][_0xda65('0x34')]+'%'};return _0x55088d;})});}_0x4c9812=_['merge']({},_0x4c9812,_0x23e649[_0xda65('0x5f')]);return _0x5e9d48['getOpenchannelInteractions'](_0x4c9812);}})[_0xda65('0x1a')](function(_0x3e8e64){if(_0x3e8e64){_0x5c01c9=_0x3e8e64['length'];if(!_0x23e649[_0xda65('0x45')][_0xda65('0xcf')](_0xda65('0xd4'))){_0x4c9812['limit']=qs[_0xda65('0x27')](_0x23e649[_0xda65('0x45')][_0xda65('0x27')]);_0x4c9812[_0xda65('0x25')]=qs[_0xda65('0x25')](_0x23e649['query'][_0xda65('0x25')]);}return _0x5e9d48[_0xda65('0xdf')](_0x4c9812);}})['then'](function(_0x402299){if(_0x402299){return _0x402299?{'count':_0x5c01c9,'rows':_0x402299}:null;}})['then'](respondWithResult(_0x5fae23,null))[_0xda65('0x56')](handleError(_0x5fae23,null));};exports[_0xda65('0xe1')]=function(_0x4f344a,_0x3befc5){var _0x70b5={'raw':!![],'where':{}};var _0x39ab6e={};var _0x2bb17d={'count':0x0,'rows':[]};return db[_0xda65('0x3d')][_0xda65('0x9b')]({'where':{'id':_0x4f344a['params']['id']}})['then'](handleEntityNotFound(_0x3befc5,null))[_0xda65('0x1a')](function(_0x21ebce){if(_0x21ebce){_0x39ab6e[_0xda65('0x5b')]=_[_0xda65('0x57')](db[_0xda65('0xe2')][_0xda65('0x3e')]);_0x39ab6e[_0xda65('0x45')]=_[_0xda65('0x57')](_0x4f344a[_0xda65('0x45')]);_0x39ab6e[_0xda65('0x59')]=_['intersection'](_0x39ab6e[_0xda65('0x5b')],_0x39ab6e['query']);_0x70b5[_0xda65('0x4b')]=_[_0xda65('0x5a')](_0x39ab6e[_0xda65('0x5b')],qs[_0xda65('0x5c')](_0x4f344a[_0xda65('0x45')]['fields']));_0x70b5[_0xda65('0x4b')]=_0x70b5[_0xda65('0x4b')]['length']?_0x70b5['attributes']:_0x39ab6e[_0xda65('0x5b')];if(!_0x4f344a[_0xda65('0x45')][_0xda65('0xcf')](_0xda65('0xd4'))){_0x70b5[_0xda65('0x27')]=qs[_0xda65('0x27')](_0x4f344a[_0xda65('0x45')][_0xda65('0x27')]);_0x70b5[_0xda65('0x25')]=qs[_0xda65('0x25')](_0x4f344a['query'][_0xda65('0x25')]);}_0x70b5[_0xda65('0xcd')]=qs[_0xda65('0xce')](_0x4f344a[_0xda65('0x45')][_0xda65('0xce')]);_0x70b5[_0xda65('0x44')]=qs[_0xda65('0x59')](_['pick'](_0x4f344a[_0xda65('0x45')],_0x39ab6e[_0xda65('0x59')]));_0x70b5['where'][_0xda65('0xe3')]=_0x21ebce['id'];if(_0x4f344a['query'][_0xda65('0x34')]){_0x70b5[_0xda65('0x44')]=_['merge'](_0x70b5['where'],{'$or':_[_0xda65('0x3f')](_0x70b5[_0xda65('0x4b')],function(_0x5c89c5){var _0x3de1ac={};_0x3de1ac[_0x5c89c5]={'$like':'%'+_0x4f344a[_0xda65('0x45')]['filter']+'%'};return _0x3de1ac;})});}_0x70b5=_[_0xda65('0x5e')]({},_0x70b5,_0x4f344a['options']);return db['MailInteraction'][_0xda65('0x28')]({'where':_0x70b5['where']})[_0xda65('0x1a')](function(_0x1bae97){_0x2bb17d[_0xda65('0x28')]=_0x1bae97;if(_0x4f344a['query'][_0xda65('0x46')]){_0x70b5['include']=[{'all':!![]}];}return db[_0xda65('0xe2')][_0xda65('0x4d')](_0x70b5);})[_0xda65('0x1a')](function(_0x1ec226){_0x2bb17d[_0xda65('0x4e')]=_0x1ec226;return _0x2bb17d;});}})[_0xda65('0x1a')](respondWithFilteredResult(_0x3befc5,_0x70b5))[_0xda65('0x56')](handleError(_0x3befc5,null));};exports[_0xda65('0xe4')]=function(_0x1d889a,_0x179883){var _0x19a263={};var _0x5427d6={};var _0x8014a7;var _0x148bc2;return db['User'][_0xda65('0x9b')]({'where':{'id':_0x1d889a[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x179883,null))[_0xda65('0x1a')](function(_0x46fa37){if(_0x46fa37){_0x8014a7=_0x46fa37;_0x5427d6[_0xda65('0x5b')]=_[_0xda65('0x57')](db['SmsInteraction'][_0xda65('0x3e')]);_0x5427d6['query']=_[_0xda65('0x57')](_0x1d889a[_0xda65('0x45')]);_0x5427d6[_0xda65('0x59')]=_[_0xda65('0x5a')](_0x5427d6[_0xda65('0x5b')],_0x5427d6[_0xda65('0x45')]);_0x19a263[_0xda65('0x4b')]=_['intersection'](_0x5427d6['model'],qs['fields'](_0x1d889a[_0xda65('0x45')][_0xda65('0x5c')]));_0x19a263[_0xda65('0x4b')]=_0x19a263[_0xda65('0x4b')]['length']?_0x19a263['attributes']:_0x5427d6[_0xda65('0x5b')];_0x19a263['order']=qs['sort'](_0x1d889a[_0xda65('0x45')][_0xda65('0xce')]);_0x19a263[_0xda65('0x44')]=qs['filters'](_[_0xda65('0xd6')](_0x1d889a[_0xda65('0x45')],_0x5427d6['filters']));if(_0x1d889a[_0xda65('0x45')]['filter']){_0x19a263['where']=_[_0xda65('0x5e')](_0x19a263[_0xda65('0x44')],{'$or':_[_0xda65('0x3f')](_0x19a263[_0xda65('0x4b')],function(_0x4cd8a6){var _0x421956={};_0x421956[_0x4cd8a6]={'$like':'%'+_0x1d889a[_0xda65('0x45')][_0xda65('0x34')]+'%'};return _0x421956;})});}_0x19a263=_[_0xda65('0x5e')]({},_0x19a263,_0x1d889a['options']);return _0x8014a7[_0xda65('0xe4')](_0x19a263);}})[_0xda65('0x1a')](function(_0x5413ea){if(_0x5413ea){_0x148bc2=_0x5413ea['length'];if(!_0x1d889a['query']['hasOwnProperty']('nolimit')){_0x19a263[_0xda65('0x27')]=qs[_0xda65('0x27')](_0x1d889a[_0xda65('0x45')][_0xda65('0x27')]);_0x19a263['offset']=qs[_0xda65('0x25')](_0x1d889a[_0xda65('0x45')][_0xda65('0x25')]);}return _0x8014a7[_0xda65('0xe4')](_0x19a263);}})[_0xda65('0x1a')](function(_0x2fa171){if(_0x2fa171){return _0x2fa171?{'count':_0x148bc2,'rows':_0x2fa171}:null;}})[_0xda65('0x1a')](respondWithResult(_0x179883,null))['catch'](handleError(_0x179883,null));};exports['getFaxInteractions']=function(_0x4fa860,_0x290f0e){var _0xa817af={};var _0xefb2b6={};var _0x3e2457;var _0x39a9c3;return db[_0xda65('0x3d')][_0xda65('0x9b')]({'where':{'id':_0x4fa860[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x290f0e,null))[_0xda65('0x1a')](function(_0x1e9f07){if(_0x1e9f07){_0x3e2457=_0x1e9f07;_0xefb2b6['model']=_[_0xda65('0x57')](db['FaxInteraction'][_0xda65('0x3e')]);_0xefb2b6['query']=_[_0xda65('0x57')](_0x4fa860['query']);_0xefb2b6[_0xda65('0x59')]=_[_0xda65('0x5a')](_0xefb2b6['model'],_0xefb2b6[_0xda65('0x45')]);_0xa817af['attributes']=_[_0xda65('0x5a')](_0xefb2b6[_0xda65('0x5b')],qs['fields'](_0x4fa860[_0xda65('0x45')][_0xda65('0x5c')]));_0xa817af[_0xda65('0x4b')]=_0xa817af[_0xda65('0x4b')][_0xda65('0x5d')]?_0xa817af[_0xda65('0x4b')]:_0xefb2b6[_0xda65('0x5b')];_0xa817af[_0xda65('0xcd')]=qs[_0xda65('0xce')](_0x4fa860[_0xda65('0x45')][_0xda65('0xce')]);_0xa817af[_0xda65('0x44')]=qs[_0xda65('0x59')](_[_0xda65('0xd6')](_0x4fa860['query'],_0xefb2b6['filters']));if(_0x4fa860['query']['filter']){_0xa817af[_0xda65('0x44')]=_[_0xda65('0x5e')](_0xa817af[_0xda65('0x44')],{'$or':_[_0xda65('0x3f')](_0xa817af['attributes'],function(_0x59e2a0){var _0x4f25e7={};_0x4f25e7[_0x59e2a0]={'$like':'%'+_0x4fa860[_0xda65('0x45')][_0xda65('0x34')]+'%'};return _0x4f25e7;})});}_0xa817af=_[_0xda65('0x5e')]({},_0xa817af,_0x4fa860[_0xda65('0x5f')]);return _0x3e2457[_0xda65('0xe5')](_0xa817af);}})[_0xda65('0x1a')](function(_0xc111a6){if(_0xc111a6){_0x39a9c3=_0xc111a6[_0xda65('0x5d')];if(!_0x4fa860[_0xda65('0x45')][_0xda65('0xcf')](_0xda65('0xd4'))){_0xa817af['limit']=qs['limit'](_0x4fa860['query']['limit']);_0xa817af[_0xda65('0x25')]=qs['offset'](_0x4fa860[_0xda65('0x45')][_0xda65('0x25')]);}return _0x3e2457[_0xda65('0xe5')](_0xa817af);}})['then'](function(_0x4ce919){if(_0x4ce919){return _0x4ce919?{'count':_0x39a9c3,'rows':_0x4ce919}:null;}})[_0xda65('0x1a')](respondWithResult(_0x290f0e,null))['catch'](handleError(_0x290f0e,null));};exports[_0xda65('0xe6')]=function(_0x3dae91,_0x4485c4){var _0x5929bd={};var _0x4886cb={};var _0x296cbc;var _0xb17f02;return db[_0xda65('0x3d')]['findOne']({'where':{'id':_0x3dae91[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x4485c4,null))[_0xda65('0x1a')](function(_0x285346){if(_0x285346){_0x296cbc=_0x285346;_0x4886cb['model']=_[_0xda65('0x57')](db[_0xda65('0xe7')][_0xda65('0x3e')]);_0x4886cb['query']=_[_0xda65('0x57')](_0x3dae91[_0xda65('0x45')]);_0x4886cb[_0xda65('0x59')]=_['intersection'](_0x4886cb[_0xda65('0x5b')],_0x4886cb[_0xda65('0x45')]);_0x5929bd[_0xda65('0x4b')]=_[_0xda65('0x5a')](_0x4886cb['model'],qs[_0xda65('0x5c')](_0x3dae91['query'][_0xda65('0x5c')]));_0x5929bd['attributes']=_0x5929bd['attributes'][_0xda65('0x5d')]?_0x5929bd[_0xda65('0x4b')]:_0x4886cb[_0xda65('0x5b')];_0x5929bd['order']=qs['sort'](_0x3dae91['query']['sort']);_0x5929bd[_0xda65('0x44')]=qs[_0xda65('0x59')](_[_0xda65('0xd6')](_0x3dae91['query'],_0x4886cb[_0xda65('0x59')]));if(_0x3dae91['query'][_0xda65('0x34')]){_0x5929bd['where']=_[_0xda65('0x5e')](_0x5929bd[_0xda65('0x44')],{'$or':_[_0xda65('0x3f')](_0x5929bd[_0xda65('0x4b')],function(_0x266541){var _0x36b745={};_0x36b745[_0x266541]={'$like':'%'+_0x3dae91[_0xda65('0x45')][_0xda65('0x34')]+'%'};return _0x36b745;})});}_0x5929bd=_[_0xda65('0x5e')]({},_0x5929bd,_0x3dae91[_0xda65('0x5f')]);return _0x296cbc['getWhatsappInteractions'](_0x5929bd);}})[_0xda65('0x1a')](function(_0x584c58){if(_0x584c58){_0xb17f02=_0x584c58['length'];if(!_0x3dae91['query'][_0xda65('0xcf')]('nolimit')){_0x5929bd['limit']=qs[_0xda65('0x27')](_0x3dae91[_0xda65('0x45')][_0xda65('0x27')]);_0x5929bd['offset']=qs[_0xda65('0x25')](_0x3dae91['query'][_0xda65('0x25')]);}return _0x296cbc[_0xda65('0xe6')](_0x5929bd);}})['then'](function(_0x29f76f){if(_0x29f76f){return _0x29f76f?{'count':_0xb17f02,'rows':_0x29f76f}:null;}})[_0xda65('0x1a')](respondWithResult(_0x4485c4,null))['catch'](handleError(_0x4485c4,null));};exports['login']=function(_0x2e696c,_0x105f8e,_0x3995f9){var _0x46ca2b;var _0x5627c8;var _0x5ccf23;var _0x272195=!_['isNil'](_0x2e696c[_0xda65('0x63')]['id'])?_0x2e696c[_0xda65('0x63')]['id']:!_[_0xda65('0x6f')](_0x2e696c['user']['id'])?_0x2e696c[_0xda65('0x30')]['id']:null;return db['User'][_0xda65('0x37')]({'where':{'id':_0x272195,'role':{'$or':[_0xda65('0x2e'),_0xda65('0x30'),_0xda65('0x32')]}},'attributes':['id',_0xda65('0x3a'),_0xda65('0xe8'),_0xda65('0xe9'),_0xda65('0x2d'),'internal',_0xda65('0xa2')]})[_0xda65('0x1a')](function(_0x42f46f){if(_0x42f46f){if(_0x42f46f[_0xda65('0x2d')]===_0xda65('0x32')){_0x46ca2b=_0x42f46f;if(_0x2e696c[_0xda65('0x62')][_0xda65('0xa3')]){_0x5ccf23=util[_0xda65('0xac')](_0xda65('0xea'),_0x46ca2b[_0x2e696c[_0xda65('0x62')][_0xda65('0xa3')]]);}else if(_0x2e696c[_0xda65('0x62')][_0xda65('0xeb')]){_0x5ccf23=util[_0xda65('0xac')](_0xda65('0xec'),_0x2e696c[_0xda65('0x62')]['intrf']);}else{_0x5ccf23=util[_0xda65('0xac')]('SIP/%s',_0x46ca2b[_0xda65('0x3a')]);}socket['to'](util[_0xda65('0xac')]('user:%s',_0x46ca2b[_0xda65('0x3a')]))['emit'](_0xda65('0xed'),{'user':{'id':_0x46ca2b['id'],'name':_0x46ca2b[_0xda65('0x3a')]},'ip':_0x2e696c[_0xda65('0xee')][_0xda65('0xef')]||_0x2e696c['connection'][_0xda65('0xf0')]||_0x2e696c[_0xda65('0xf1')][_0xda65('0xf0')]||_0x2e696c[_0xda65('0xf2')][_0xda65('0xf1')][_0xda65('0xf0')]});return db[_0xda65('0xaf')][_0xda65('0x2b')]({'where':{'membername':_0x46ca2b['name']},'individualHooks':!![]});}}else{throw new db[(_0xda65('0x97'))]['ValidationError'](_0xda65('0xf3'));}})[_0xda65('0x1a')](function(){if(_0x46ca2b){return _0x46ca2b['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x3d7459){if(_0x46ca2b){if(_0x3d7459){_0x5627c8=_0x3d7459;if(_0x5627c8['length']){var _0x5d5b89=_0x5627c8[_0xda65('0x3f')](function(_0x15a0e0){var _0x5b5d0c={'membername':_0x46ca2b[_0xda65('0x3a')],'UserId':_0x46ca2b['id'],'queue_name':_0x15a0e0[_0xda65('0x3a')],'VoiceQueueId':_0x15a0e0['id'],'interface':_0x5ccf23,'paused':_0x46ca2b[_0xda65('0xa2')]||![],'penalty':_0x15a0e0[_0xda65('0xf4')]||0x0};return db[_0xda65('0xaf')][_0xda65('0xb0')](_0x5b5d0c);});return Promise[_0xda65('0x60')](_0x5d5b89);}}}})['then'](function(){if(_0x46ca2b){return db[_0xda65('0xf5')]['findAll']({'where':{'membername':_0x46ca2b[_0xda65('0x3a')],'exitAt':null}});}})[_0xda65('0x1a')](function(_0x460366){if(_0x46ca2b){var _0x5dbb69=[];_0x460366[_0xda65('0xf6')](function(_0x571aff){_0x5dbb69[_0xda65('0x4c')](_0x571aff['update']({'exitAt':moment()[_0xda65('0xac')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xda65('0x60')](_0x5dbb69);}})[_0xda65('0x1a')](function(){if(_0x46ca2b){var _0x11cc33=[];var _0x5add01=[];var _0x29c490=utils['getChannels']();var _0x4cbfa3={'membername':_0x46ca2b[_0xda65('0x3a')],'interface':_0x5ccf23,'enterAt':moment()[_0xda65('0xac')](_0xda65('0xf7')),'role':_0x46ca2b[_0xda65('0x2d')],'internal':_0x46ca2b[_0xda65('0x68')]};_0x29c490[_0xda65('0xf6')](function(_0x66351f){_0x11cc33[_0xda65('0x4c')](_['merge']({'channel':_0x66351f,'type':_0xda65('0xf8'),'data1':_0x2e696c[_0xda65('0x62')][_0xda65('0xf9')],'data2':_0x5ccf23},_0x4cbfa3));if(_0x46ca2b[_0xda65('0xa2')]){_0x5add01[_0xda65('0x4c')](_[_0xda65('0x5e')]({'channel':_0x66351f,'type':_0xda65('0xfa'),'data1':'LOGININPAUSE'},_0x4cbfa3));}});return db[_0xda65('0xf5')][_0xda65('0x8a')](_0x11cc33[_0xda65('0xca')](_0x5add01),{'individualHooks':!![]});}})[_0xda65('0x1a')](function(){if(_0x46ca2b){return _0x46ca2b[_0xda65('0x61')]({'online':!![],'lastLoginAt':moment()[_0xda65('0xac')](_0xda65('0xf7')),'voicePause':_0x46ca2b['loginInPause']||![],'mailPause':_0x46ca2b[_0xda65('0xa2')]||![],'chatPause':_0x46ca2b[_0xda65('0xa2')]||![],'faxPause':_0x46ca2b[_0xda65('0xa2')]||![],'smsPause':_0x46ca2b[_0xda65('0xa2')]||![],'openchannelPause':_0x46ca2b[_0xda65('0xa2')]||![],'whatsappPause':_0x46ca2b[_0xda65('0xa2')]||![],'pauseType':_0x46ca2b[_0xda65('0xa2')]?'LOGININPAUSE':null,'interface':_0x5ccf23,'lastPauseAt':moment()[_0xda65('0xac')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xda65('0x1a')](function(_0x590891){if(_0x2e696c[_0xda65('0xfb')]){return _0x3995f9();}else{return Promise[_0xda65('0xfc')](_0x590891)[_0xda65('0x1a')](respondWithResult(_0x105f8e,null));}})[_0xda65('0x56')](handleError(_0x105f8e,null));};exports[_0xda65('0xfd')]=function(_0x3122c8,_0x2c0693){var _0x326500;return db[_0xda65('0x3d')]['find']({'where':{'id':_0x3122c8[_0xda65('0x63')]['id'],'role':_0xda65('0x32')},'attributes':['id',_0xda65('0x3a'),'role']})['then'](handleEntityNotFound(_0x2c0693,null))[_0xda65('0x1a')](function(_0x4921ef){if(_0x4921ef){_0x326500=_0x4921ef;return db[_0xda65('0xaf')][_0xda65('0x2b')]({'where':{'membername':_0x326500[_0xda65('0x3a')]},'individualHooks':!![]});}})[_0xda65('0x1a')](function(){return db[_0xda65('0xf5')]['findAll']({'where':{'membername':_0x326500[_0xda65('0x3a')],'exitAt':null}});})[_0xda65('0x1a')](function(_0x101858){var _0x47c236=[];_0x101858[_0xda65('0xf6')](function(_0x183c24){_0x47c236[_0xda65('0x4c')](_0x183c24[_0xda65('0x61')]({'exitAt':moment()[_0xda65('0xac')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x47c236);})[_0xda65('0x1a')](function(){return _0x326500[_0xda65('0x61')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xda65('0x1a')](respondWithResult(_0x2c0693,null))[_0xda65('0x56')](handleError(_0x2c0693,null));};exports[_0xda65('0xfe')]=function(_0x230722,_0x34c4d7){var _0x2e3594;return db[_0xda65('0xaf')][_0xda65('0x61')]({'paused':0x1},{'where':{'UserId':_0x230722[_0xda65('0x63')]['id']},'individualHooks':!![]})[_0xda65('0x1a')](function(){return db[_0xda65('0x3d')][_0xda65('0x37')]({'where':{'id':_0x230722[_0xda65('0x63')]['id'],'role':_0xda65('0x32')},'attributes':['id',_0xda65('0x3a'),_0xda65('0x2d'),_0xda65('0x68'),'interface',_0xda65('0xa1')]});})[_0xda65('0x1a')](handleEntityNotFound(_0x34c4d7,null))[_0xda65('0x1a')](function(_0x4b3650){if(_0x4b3650){_0x2e3594=_0x4b3650;return respondWithRpcPromise(_0xda65('0xff'),'pause',{'id':_0x2e3594['id'],'name':_0x2e3594[_0xda65('0x3a')],'pause':!![]});}})[_0xda65('0x1a')](function(){if(_0x2e3594){return db[_0xda65('0xf5')]['findAll']({'where':{'membername':_0x2e3594[_0xda65('0x3a')],'type':'PAUSE','exitAt':null}});}})[_0xda65('0x1a')](function(_0x4ec1ea){if(_0x4ec1ea[_0xda65('0x5d')]){var _0x538e31=moment()[_0xda65('0xac')](_0xda65('0xf7'));for(var _0x368d0f=0x0,_0x3d3d74=_0x4ec1ea['length'];_0x368d0f<_0x3d3d74;_0x368d0f++){_0x4ec1ea[_0x368d0f][_0xda65('0x100')]({'exitAt':_0x538e31});}}})[_0xda65('0x1a')](function(){var _0x11bdd6=[];var _0x420d37=utils[_0xda65('0x101')]();_0x420d37[_0xda65('0xf6')](function(_0x460555){_0x11bdd6[_0xda65('0x4c')]({'channel':_0x460555,'membername':_0x2e3594[_0xda65('0x3a')],'interface':_[_0xda65('0x6f')](_0x2e3594[_0xda65('0xa3')])?util[_0xda65('0xac')](_0xda65('0xec'),_0x2e3594[_0xda65('0x3a')]):_0x2e3594['interface'],'type':'PAUSE','enterAt':moment()[_0xda65('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x230722[_0xda65('0x62')][_0xda65('0x102')]||'DEFAULT\x20PAUSE','role':_0x2e3594[_0xda65('0x2d')],'internal':_0x2e3594[_0xda65('0x68')]});});return db[_0xda65('0xf5')]['bulkCreate'](_0x11bdd6,{'individualHooks':!![]});})['then'](function(){return _0x2e3594['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x230722['body'][_0xda65('0x102')]||_0xda65('0x103'),'lastPauseAt':moment()[_0xda65('0xac')](_0xda65('0xf7'))});})[_0xda65('0x1a')](respondWithResult(_0x34c4d7,null))['catch'](handleError(_0x34c4d7,null));};exports[_0xda65('0x104')]=function(_0x4411e5,_0x4a727a){if(_0x4411e5[_0xda65('0x62')][_0xda65('0xa0')]&&!utils[_0xda65('0xa4')](_0x4411e5[_0xda65('0x62')]['channel'])){throw new APIBadRequestError(util[_0xda65('0xac')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x4411e5[_0xda65('0x62')][_0xda65('0xa0')]));}return db['User'][_0xda65('0x37')]({'where':{'id':_0x4411e5[_0xda65('0x63')]['id']},'attributes':['id',_0xda65('0x3a'),_0xda65('0x2d'),_0xda65('0x68'),_0xda65('0xa3'),_0xda65('0xa1'),'voicePause',_0xda65('0x105'),_0xda65('0x106'),'faxPause',_0xda65('0x107'),'smsPause','whatsappPause','pauseType',_0xda65('0x108')]})[_0xda65('0x1a')](function(_0x79b40){if(!_0x79b40){throw new APINotFoundError(util[_0xda65('0xac')](_0xda65('0x109'),_0x4411e5['params']['id']));}return _0x79b40[_0xda65('0x104')](_0x4411e5[_0xda65('0x62')][_0xda65('0xa0')]);})['then'](respondWithResult(_0x4a727a,null))[_0xda65('0x56')](APIHandleError(_0x4a727a));};exports[_0xda65('0x10a')]=function(_0x3da970,_0x3bdba6){var _0x363ae9={};var _0x2fbadf={};var _0x361f42;var _0x2a3bec;return db[_0xda65('0x3d')][_0xda65('0x9b')]({'where':{'id':_0x3da970[_0xda65('0x63')]['id']}})['then'](handleEntityNotFound(_0x3bdba6,null))['then'](function(_0x2659ec){if(_0x2659ec){_0x361f42=_0x2659ec;_0x2fbadf['model']=_['keys'](db[_0xda65('0x10b')][_0xda65('0x3e')]);_0x2fbadf[_0xda65('0x45')]=_[_0xda65('0x57')](_0x3da970[_0xda65('0x45')]);_0x2fbadf[_0xda65('0x59')]=_['intersection'](_0x2fbadf[_0xda65('0x5b')],_0x2fbadf[_0xda65('0x45')]);_0x363ae9[_0xda65('0x4b')]=_[_0xda65('0x5a')](_0x2fbadf['model'],qs['fields'](_0x3da970['query'][_0xda65('0x5c')]));_0x363ae9[_0xda65('0x4b')]=_0x363ae9[_0xda65('0x4b')]['length']?_0x363ae9[_0xda65('0x4b')]:_0x2fbadf[_0xda65('0x5b')];_0x363ae9[_0xda65('0xcd')]=qs[_0xda65('0xce')](_0x3da970['query'][_0xda65('0xce')]);_0x363ae9['where']=qs[_0xda65('0x59')](_[_0xda65('0xd6')](_0x3da970[_0xda65('0x45')],_0x2fbadf[_0xda65('0x59')]));if(_0x3da970['query']['filter']){_0x363ae9['where']=_['merge'](_0x363ae9['where'],{'$or':_[_0xda65('0x3f')](_0x363ae9['attributes'],function(_0x19f409){var _0x1c1997={};_0x1c1997[_0x19f409]={'$like':'%'+_0x3da970[_0xda65('0x45')][_0xda65('0x34')]+'%'};return _0x1c1997;})});}_0x363ae9=_[_0xda65('0x5e')]({},_0x363ae9,_0x3da970[_0xda65('0x5f')]);return _0x361f42[_0xda65('0x10a')](_0x363ae9);}})[_0xda65('0x1a')](function(_0x38537c){if(_0x38537c){_0x2a3bec=_0x38537c[_0xda65('0x5d')];if(!_0x3da970['query'][_0xda65('0xcf')](_0xda65('0xd4'))){_0x363ae9[_0xda65('0x27')]=qs['limit'](_0x3da970[_0xda65('0x45')]['limit']);_0x363ae9[_0xda65('0x25')]=qs[_0xda65('0x25')](_0x3da970[_0xda65('0x45')]['offset']);}return _0x361f42[_0xda65('0x10a')](_0x363ae9);}})['then'](function(_0x1b4d58){if(_0x1b4d58){return _0x1b4d58?{'count':_0x2a3bec,'rows':_0x1b4d58}:null;}})[_0xda65('0x1a')](respondWithResult(_0x3bdba6,null))[_0xda65('0x56')](handleError(_0x3bdba6,null));};exports[_0xda65('0x10c')]=function(_0x16187a,_0x24c1ee){var _0x4b7a0f=_0x16187a[_0xda65('0x63')]['id'];var _0x46d290=_0x16187a[_0xda65('0x62')]?_0x16187a[_0xda65('0x62')][_0xda65('0x66')]:null;var _0x198847=[];return Promise[_0xda65('0xfc')]()[_0xda65('0x1a')](function(){if(!_0x46d290)throw new APIBadRequestError(_0xda65('0x10d'));})[_0xda65('0x1a')](function(){return db[_0xda65('0x3d')][_0xda65('0x9b')]({'where':{'id':_0x4b7a0f}});})[_0xda65('0x1a')](function(_0x2abfbd){if(!_0x2abfbd)throw new APINotFoundError(util[_0xda65('0xac')](_0xda65('0x109'),_0x16187a[_0xda65('0x63')]['id']));return db['sequelize'][_0xda65('0x10e')](function(_0x371478){return _0x2abfbd[_0xda65('0x10c')](_0x46d290,{'transaction':_0x371478})['then'](function(){return db[_0xda65('0x10b')][_0xda65('0x4d')]({'where':{'id':{'$in':_0x46d290}}});})[_0xda65('0x1a')](function(_0x766393){var _0x749da6=_[_0xda65('0x3f')](_0x766393,function(_0x4c1714){return _0x4c1714[_0xda65('0x10f')]();});return Promise[_0xda65('0x60')](_0x749da6);})[_0xda65('0x1a')](function(_0x19f140){_0x198847=_['flattenDeep'](_0x19f140);var _0x42bad3=_[_0xda65('0x3f')](_0x198847,function(_0x2a1f61){return _0x2a1f61[_0xda65('0x110')](_0x2abfbd['id'],{'transaction':_0x371478});});return Promise['all'](_0x42bad3);})['then'](function(){if(!_0x2abfbd[_0xda65('0xa1')])return;var _0x52c088=_[_0xda65('0x34')](_0x198847,function(_0x5915d9){return _0x5915d9['getDataValue'](_0xda65('0xa0'))===_0xda65('0x111');});var _0xb3d053=_['map'](_0x52c088,function(_0x3db6f7){return db[_0xda65('0xaf')]['upsert']({'membername':_0x2abfbd['name'],'UserId':_0x2abfbd['id'],'queue_name':_0x3db6f7[_0xda65('0x3a')],'VoiceQueueId':_0x3db6f7['id'],'interface':_[_0xda65('0x6f')](_0x2abfbd['interface'])?util['format'](_0xda65('0xec'),_0x2abfbd[_0xda65('0x3a')]):_0x2abfbd['interface'],'paused':_0x2abfbd[_0xda65('0xad')]||![],'penalty':_0x2abfbd['penalty']},{'transaction':_0x371478});});return Promise[_0xda65('0x60')](_0xb3d053);})['then'](function(){return db[_0xda65('0x112')]['findAll']({'where':{'teamId':{'$in':_0x46d290}}});})[_0xda65('0x1a')](function(_0xa39517){var _0x357d02=_[_0xda65('0x3f')](_0xa39517,function(_0x4f2690){return db[_0xda65('0x113')][_0xda65('0x84')]({'UserId':_0x2abfbd['id'],'VoicePrefixId':_0x4f2690[_0xda65('0x114')]},{'transaction':_0x371478});});return Promise['all'](_0x357d02);});});})[_0xda65('0x1a')](function(){for(var _0x2b24d3=0x0;_0x2b24d3<_0x198847[_0xda65('0x5d')];_0x2b24d3++){var _0x40a570=_0x198847[_0x2b24d3]['getDataValue'](_0xda65('0xa0'));var _0x523442=_0x40a570+'QueueId';socket[_0xda65('0xa8')](_0xda65('0x30')+_0x40a570+'Queue:save',{'UserId':_0x4b7a0f,['queueField']:_0x198847[_0x2b24d3]['id']});}})[_0xda65('0x1a')](respondWithStatusCode(_0x24c1ee,null))[_0xda65('0x56')](APIHandleError(_0x24c1ee));};exports[_0xda65('0x115')]=function(_0x1d28fd,_0x134745){var _0x2546ea=_0x1d28fd['params']['id'];var _0x390045=null;if(_0x1d28fd[_0xda65('0x45')]['ids']){_0x390045=_[_0xda65('0xb2')](_0x1d28fd[_0xda65('0x45')]['ids'])?_0x1d28fd[_0xda65('0x45')][_0xda65('0x66')]:[_0x1d28fd['query'][_0xda65('0x66')]];}var _0x330030=[];return Promise[_0xda65('0xfc')]()[_0xda65('0x1a')](function(){if(!_0x390045)throw new APIBadRequestError(_0xda65('0x116'));})[_0xda65('0x1a')](function(){return db[_0xda65('0x3d')][_0xda65('0x9b')]({'where':{'id':_0x2546ea}});})[_0xda65('0x1a')](function(_0x3a0c78){if(!_0x3a0c78)throw new APINotFoundError(util[_0xda65('0xac')](_0xda65('0x109'),_0x1d28fd[_0xda65('0x63')]['id']));return db[_0xda65('0x70')][_0xda65('0x10e')](function(_0x51d5cb){return _0x3a0c78[_0xda65('0x115')](_0x390045,{'transaction':_0x51d5cb})[_0xda65('0x1a')](function(){return db[_0xda65('0x10b')][_0xda65('0x4d')]({'where':{'id':{'$in':_0x390045}}});})[_0xda65('0x1a')](function(_0x2492c5){var _0x55ca53=_[_0xda65('0x3f')](_0x2492c5,function(_0x10495d){return _0x10495d[_0xda65('0x10f')]();});return Promise['all'](_0x55ca53);})[_0xda65('0x1a')](function(_0x1a8be5){_0x330030=_[_0xda65('0x117')](_0x1a8be5);var _0x556dc9=_[_0xda65('0x3f')](_0x330030,function(_0x44fa9b){return _0x44fa9b[_0xda65('0x118')](_0x3a0c78['id'],{'transaction':_0x51d5cb});});return Promise[_0xda65('0x60')](_0x556dc9);})['then'](function(){if(!_0x3a0c78[_0xda65('0xa1')])return;var _0x1b70df=_[_0xda65('0x34')](_0x330030,function(_0x3ecd83){return _0x3ecd83[_0xda65('0x119')](_0xda65('0xa0'))===_0xda65('0x111');});var _0xd8a455=_[_0xda65('0x3f')](_0x1b70df,function(_0x285a39){return db[_0xda65('0xaf')]['destroy']({'where':{'VoiceQueueId':_0x285a39['id'],'UserId':_0x3a0c78['id']},'transaction':_0x51d5cb});});return Promise[_0xda65('0x60')](_0xd8a455);})[_0xda65('0x1a')](function(){return db[_0xda65('0x112')][_0xda65('0x4d')]({'where':{'teamId':{'$in':_0x390045}}});})[_0xda65('0x1a')](function(_0x3ab45b){var _0x57d3fa=_[_0xda65('0x3f')](_0x3ab45b,function(_0x10ba07){return db[_0xda65('0x113')][_0xda65('0x2b')]({'where':{'UserId':_0x3a0c78['id'],'VoicePrefixId':_0x10ba07[_0xda65('0x114')]}},{'transaction':_0x51d5cb});});return Promise[_0xda65('0x60')](_0x57d3fa);});});})[_0xda65('0x1a')](function(){for(var _0x2c0de8=0x0;_0x2c0de8<_0x330030[_0xda65('0x5d')];_0x2c0de8++){var _0x31d983=_0x330030[_0x2c0de8][_0xda65('0x119')](_0xda65('0xa0'));var _0x431bb5=_0x31d983+_0xda65('0xa7');socket[_0xda65('0xa8')](_0xda65('0x30')+_0x31d983+'Queue:remove',{'UserId':_0x2546ea,['queueField']:_0x330030[_0x2c0de8]['id']});}})[_0xda65('0x1a')](respondWithStatusCode(_0x134745,null))[_0xda65('0x56')](APIHandleError(_0x134745));};exports[_0xda65('0x11a')]=function(_0x442d25,_0x697728){var _0x50e7c2={};var _0x5bd00e={};var _0x2e8ba2;var _0x40047e;return db['User']['findOne']({'where':{'id':_0x442d25[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x697728,null))[_0xda65('0x1a')](function(_0x5c2004){if(_0x5c2004){_0x2e8ba2=_0x5c2004;_0x5bd00e['model']=_[_0xda65('0x57')](db[_0xda65('0xd0')][_0xda65('0x3e')]);_0x5bd00e[_0xda65('0x45')]=_[_0xda65('0x57')](_0x442d25[_0xda65('0x45')]);_0x5bd00e[_0xda65('0x59')]=_[_0xda65('0x5a')](_0x5bd00e['model'],_0x5bd00e[_0xda65('0x45')]);_0x50e7c2[_0xda65('0x4b')]=_[_0xda65('0x5a')](_0x5bd00e[_0xda65('0x5b')],qs['fields'](_0x442d25[_0xda65('0x45')]['fields']));_0x50e7c2[_0xda65('0x4b')]=_0x50e7c2[_0xda65('0x4b')][_0xda65('0x5d')]?_0x50e7c2[_0xda65('0x4b')]:_0x5bd00e[_0xda65('0x5b')];_0x50e7c2[_0xda65('0xcd')]=qs[_0xda65('0xce')](_0x442d25[_0xda65('0x45')]['sort']);_0x50e7c2[_0xda65('0x44')]=qs[_0xda65('0x59')](_[_0xda65('0xd6')](_0x442d25[_0xda65('0x45')],_0x5bd00e[_0xda65('0x59')]));if(_0x442d25['query'][_0xda65('0x34')]){_0x50e7c2[_0xda65('0x44')]=_[_0xda65('0x5e')](_0x50e7c2[_0xda65('0x44')],{'$or':_[_0xda65('0x3f')](_0x50e7c2['attributes'],function(_0xc96911){var _0x19b623={};_0x19b623[_0xc96911]={'$like':'%'+_0x442d25[_0xda65('0x45')][_0xda65('0x34')]+'%'};return _0x19b623;})});}_0x50e7c2=_['merge']({},_0x50e7c2,_0x442d25[_0xda65('0x5f')]);return _0x2e8ba2[_0xda65('0x11a')](_0x50e7c2);}})[_0xda65('0x1a')](function(_0x4d4cc3){if(_0x4d4cc3){_0x40047e=_0x4d4cc3['length'];if(!_0x442d25[_0xda65('0x45')][_0xda65('0xcf')]('nolimit')){_0x50e7c2[_0xda65('0x27')]=qs['limit'](_0x442d25[_0xda65('0x45')]['limit']);_0x50e7c2['offset']=qs[_0xda65('0x25')](_0x442d25[_0xda65('0x45')][_0xda65('0x25')]);}return _0x2e8ba2[_0xda65('0x11a')](_0x50e7c2);}})[_0xda65('0x1a')](function(_0x2f9374){if(_0x2f9374){return _0x2f9374?{'count':_0x40047e,'rows':_0x2f9374}:null;}})[_0xda65('0x1a')](respondWithResult(_0x697728,null))[_0xda65('0x56')](handleError(_0x697728,null));};exports[_0xda65('0x11b')]=function(_0x3b1d2a,_0x2dfea4){var _0x10f73e={};var _0x1a07c4={};var _0x68448d;return db[_0xda65('0x3d')][_0xda65('0x9b')]({'where':{'id':_0x3b1d2a[_0xda65('0x63')]['id']}})[_0xda65('0x1a')](handleEntityNotFound(_0x2dfea4,null))[_0xda65('0x1a')](function(_0x27ea1e){if(_0x27ea1e){_0x68448d=_0x27ea1e;_0x1a07c4[_0xda65('0x5b')]=_[_0xda65('0x57')](db[_0xda65('0x3d')][_0xda65('0x3e')]);_0x1a07c4[_0xda65('0x45')]=_[_0xda65('0x57')](_0x3b1d2a['query']);_0x1a07c4['filters']=_['intersection'](_0x1a07c4[_0xda65('0x5b')],_0x1a07c4['query']);_0x10f73e['attributes']=_[_0xda65('0x5a')](_0x1a07c4[_0xda65('0x5b')],qs[_0xda65('0x5c')](_0x3b1d2a['query'][_0xda65('0x5c')]));_0x10f73e[_0xda65('0x4b')]=_0x10f73e['attributes'][_0xda65('0x5d')]?_0x10f73e['attributes']:_0x1a07c4[_0xda65('0x5b')];_0x10f73e['order']=qs[_0xda65('0xce')](_0x3b1d2a[_0xda65('0x45')][_0xda65('0xce')]);_0x10f73e[_0xda65('0x44')]=qs[_0xda65('0x59')](_[_0xda65('0xd6')](_0x3b1d2a['query'],_0x1a07c4['filters']));if(_0x3b1d2a['query'][_0xda65('0x34')]){_0x10f73e[_0xda65('0x44')]=_[_0xda65('0x5e')](_0x10f73e[_0xda65('0x44')],{'$or':_[_0xda65('0x3f')](_0x10f73e['attributes'],function(_0x379a9d){var _0x360899={};_0x360899[_0x379a9d]={'$like':'%'+_0x3b1d2a['query'][_0xda65('0x34')]+'%'};return _0x360899;})});}_0x10f73e[_0xda65('0x5b')]=db['User'];_0x10f73e['as']='Agents';_0x10f73e=_['merge']({},_0x10f73e,_0x3b1d2a['options']);return _0x68448d[_0xda65('0x11c')]({'include':[_0x10f73e]});}})[_0xda65('0x1a')](function(_0x1895f6){if(_0x1895f6){var _0x990e0e={},_0x37e869=[];for(var _0x5212e1=0x0;_0x5212e1<_0x1895f6[_0xda65('0x5d')];_0x5212e1+=0x1){for(var _0x59bf0d=0x0,_0x3f8341;_0x59bf0d<_0x1895f6[_0x5212e1][_0xda65('0x31')][_0xda65('0x5d')];_0x59bf0d+=0x1){_0x3f8341=_0x1895f6[_0x5212e1]['Agents'][_0x59bf0d][_0xda65('0x2c')]({'plain':!![]});_0x990e0e[_0x3f8341['id']]=_0x3f8341;}}_0x990e0e=_[_0xda65('0x11d')](_0x990e0e);for(var _0x96892=qs['offset'](_0x3b1d2a[_0xda65('0x45')]['offset']);_0x96892<_0x990e0e['length']&&_0x37e869[_0xda65('0x5d')]=_0x16d4a6){_0x52f171=_0x16d4a6;_0x53fb81=0xc8;}else{_0x53fb81=0xce;}_0x117e3b[_0x40d5('0x25')](_0x53fb81);return _0x117e3b['set'](_0x40d5('0x2a'),_0x1f89ce+'-'+_0x52f171+'/'+_0x16d4a6)[_0x40d5('0x2b')](_0x295fc2);}return null;};}function saveUpdates(_0x1fa14c){return function(_0x2b06f2){if(_0x2b06f2){return _0x2b06f2[_0x40d5('0x2c')](_0x1fa14c)[_0x40d5('0x2d')](function(_0x59c360){socket[_0x40d5('0x2e')](_0x40d5('0x2f')+_0x59c360['id'],{});return _0x59c360;});}return null;};}function removeEntity(_0x2a0374){return function(_0x591e7d){if(_0x591e7d){return _0x591e7d['destroy']()['then'](function(){var _0x1c011f=_0x591e7d[_0x40d5('0x30')]({'plain':!![]});if(_0x1c011f[_0x40d5('0x31')]===_0x40d5('0x32'))return;var _0x3b0ab7=[{'name':_0x40d5('0x33'),'value':_0x40d5('0x34'),'ignore':!![]},{'name':_0x40d5('0x35'),'value':_0x40d5('0x36'),'ignore':![]},{'name':_0x40d5('0x37'),'value':_0x40d5('0x38'),'ignore':![]}];var _0x34144c=_(_0x3b0ab7)[_0x40d5('0x39')](_0x40d5('0x3a'))[_0x40d5('0x3b')](_0x40d5('0x3c'))['value']();if(_['includes'](_0x34144c,_0x1c011f[_0x40d5('0x31')])){return;}var _0x516eb7=_[_0x40d5('0x3d')](_0x3b0ab7,[_0x40d5('0x3c'),_0x1c011f[_0x40d5('0x31')]])[_0x40d5('0x3e')];return db['UserProfileResource'][_0x40d5('0x3f')]({'where':{'type':_0x516eb7,'resourceId':_0x1c011f['id']}})['then'](function(){return _0x591e7d;});})[_0x40d5('0x2d')](function(){_0x2a0374[_0x40d5('0x25')](0xcc)[_0x40d5('0x24')]();});}};}function handleEntityNotFound(_0x345b79){return function(_0x20d9d1){if(!_0x20d9d1){_0x345b79[_0x40d5('0x23')](0x194);}return _0x20d9d1;};}function handleError(_0x3555f9,_0x38af43){_0x38af43=_0x38af43||0x1f4;return function(_0xb96b78){logger[_0x40d5('0x1d')](_0xb96b78[_0x40d5('0x40')]);if(_0xb96b78['name']){delete _0xb96b78[_0x40d5('0x3e')];}_0x3555f9[_0x40d5('0x25')](_0x38af43)[_0x40d5('0x41')](_0xb96b78);};}exports[_0x40d5('0x42')]=function(_0x2a9779,_0x2776bd){var _0x4481a8={},_0x3a2c7f={'count':0x0,'rows':[]};var _0x5b7bb2=_(db[_0x40d5('0x43')][_0x40d5('0x44')])[_0x40d5('0x3b')](function(_0x3e1fbf){return{'name':_0x3e1fbf[_0x40d5('0x45')],'type':_0x3e1fbf[_0x40d5('0x46')][_0x40d5('0x47')]};})[_0x40d5('0x39')](function(_0x155198){return!_['includes'](['password',_0x40d5('0x48')],_0x155198[_0x40d5('0x3e')]);})[_0x40d5('0x3c')]();_0x4481a8=qs[_0x40d5('0x49')](_0x5b7bb2,_0x2a9779);var _0x2841af={'where':_0x4481a8[_0x40d5('0x4a')]};return db[_0x40d5('0x43')]['count'](_0x2841af)[_0x40d5('0x2d')](function(_0x56181d){_0x3a2c7f[_0x40d5('0x28')]=_0x56181d;if(_0x2a9779[_0x40d5('0x4b')][_0x40d5('0x4c')]){_0x4481a8[_0x40d5('0x4d')]=[{'all':!![]}];}if(_0x2a9779[_0x40d5('0x4b')][_0x40d5('0x4e')]===_0x40d5('0x4f')){_0x4481a8[_0x40d5('0x4d')]=[{'model':db[_0x40d5('0x50')],'as':'userSetting'}];}if(!_['includes'](_0x4481a8[_0x40d5('0x51')],'id')){_0x4481a8[_0x40d5('0x51')][_0x40d5('0x52')]('id');}return db[_0x40d5('0x43')][_0x40d5('0x53')](_0x4481a8);})[_0x40d5('0x2d')](function(_0x44c077){_0x3a2c7f[_0x40d5('0x54')]=_0x44c077;if(_0x2a9779[_0x40d5('0x4b')][_0x40d5('0x55')]===_0x40d5('0x4f')){var _0x7fe61=[];for(var _0x58a8e0=0x0;_0x58a8e0<_0x3a2c7f['rows'][_0x40d5('0x56')];_0x58a8e0++){_0x7fe61[_0x40d5('0x52')](get_open_tabs('chat',_0x3a2c7f['rows'][_0x58a8e0][_0x40d5('0x57')]));_0x7fe61['push'](get_open_tabs(_0x40d5('0x58'),_0x3a2c7f[_0x40d5('0x54')][_0x58a8e0]['dataValues']));_0x7fe61[_0x40d5('0x52')](get_open_tabs('fax',_0x3a2c7f[_0x40d5('0x54')][_0x58a8e0]['dataValues']));_0x7fe61[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x59'),_0x3a2c7f[_0x40d5('0x54')][_0x58a8e0][_0x40d5('0x57')]));_0x7fe61[_0x40d5('0x52')](get_open_tabs('openchannel',_0x3a2c7f[_0x40d5('0x54')][_0x58a8e0]['dataValues']));_0x7fe61['push'](get_open_tabs(_0x40d5('0x5a'),_0x3a2c7f['rows'][_0x58a8e0][_0x40d5('0x57')]));}return Promise[_0x40d5('0x5b')](_0x7fe61)['then'](function(){return _0x3a2c7f;});}else{return _0x3a2c7f;}})[_0x40d5('0x2d')](respondWithFilteredResult(_0x2776bd,_0x4481a8))[_0x40d5('0x22')](handleError(_0x2776bd,null));};exports[_0x40d5('0x5c')]=function(_0x4eb134,_0x212d51){var _0x28c0b2={'raw':![],'where':{'id':_0x4eb134[_0x40d5('0x5d')]['id']}},_0x309000={};_0x309000['model']=_['differenceBy'](_[_0x40d5('0x5e')](db[_0x40d5('0x43')]['rawAttributes']),[_0x40d5('0x5f'),_0x40d5('0x48')]);_0x309000['query']=_['keys'](_0x4eb134[_0x40d5('0x4b')]);_0x309000[_0x40d5('0x60')]=_['intersection'](_0x309000[_0x40d5('0x61')],_0x309000[_0x40d5('0x4b')]);_0x28c0b2['attributes']=_[_0x40d5('0x62')](_0x309000['model'],qs[_0x40d5('0x63')](_0x4eb134[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x28c0b2[_0x40d5('0x51')]=_0x28c0b2['attributes'][_0x40d5('0x56')]?_0x28c0b2[_0x40d5('0x51')]:_0x309000['model'];if(_0x4eb134[_0x40d5('0x4b')][_0x40d5('0x4c')]){_0x28c0b2[_0x40d5('0x4d')]=[{'all':!![]}];}if(_0x4eb134[_0x40d5('0x4b')][_0x40d5('0x4e')]===_0x40d5('0x4f')){_0x28c0b2['include']=[{'model':db[_0x40d5('0x50')],'as':_0x40d5('0x4e')}];}_0x28c0b2=_[_0x40d5('0x64')]({},_0x28c0b2,_0x4eb134['options']);if(!_['includes'](_0x28c0b2['attributes'],'id')){_0x28c0b2[_0x40d5('0x51')][_0x40d5('0x52')]('id');}return db['User'][_0x40d5('0x3d')](_0x28c0b2)[_0x40d5('0x2d')](handleEntityNotFound(_0x212d51,null))[_0x40d5('0x2d')](function(_0x152949){var _0x4bdbfc=[];values=_0x152949;if(_0x4eb134[_0x40d5('0x4b')][_0x40d5('0x55')]===_0x40d5('0x4f')){_0x4bdbfc['push'](get_open_tabs(_0x40d5('0x65'),_0x152949[_0x40d5('0x57')]));_0x4bdbfc['push'](get_open_tabs(_0x40d5('0x58'),_0x152949[_0x40d5('0x57')]));_0x4bdbfc[_0x40d5('0x52')](get_open_tabs('openchannel',_0x152949[_0x40d5('0x57')]));_0x4bdbfc[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x5a'),_0x152949[_0x40d5('0x57')]));_0x4bdbfc['push'](get_open_tabs('fax',_0x152949['dataValues']));_0x4bdbfc[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x59'),_0x152949[_0x40d5('0x57')]));return Promise['all'](_0x4bdbfc);}else{return values;}})['then'](function(){return values;})[_0x40d5('0x2d')](respondWithResult(_0x212d51,null))['catch'](handleError(_0x212d51,null));};exports['update']=function(_0x4ca7c9,_0x2d398c){if(_0x4ca7c9['body']['id']){delete _0x4ca7c9[_0x40d5('0x66')]['id'];}delete _0x4ca7c9['body']['role'];return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x4ca7c9[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x2d398c,null))[_0x40d5('0x2d')](saveUpdates(_0x4ca7c9[_0x40d5('0x66')],null))['then'](respondWithResult(_0x2d398c,null))['catch'](handleError(_0x2d398c,null));};exports['describe']=function(_0x32a434,_0x3d188f){return db[_0x40d5('0x43')][_0x40d5('0x67')]()[_0x40d5('0x2d')](respondWithResult(_0x3d188f,null))['catch'](handleError(_0x3d188f,null));};exports['addContacts']=function(_0x5021ec,_0x4c69fd){return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x5021ec[_0x40d5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4c69fd,null))[_0x40d5('0x2d')](function(_0x347327){if(_0x347327){return _0x347327['addContacts'](_0x5021ec[_0x40d5('0x66')][_0x40d5('0x68')],_[_0x40d5('0x69')](_0x5021ec[_0x40d5('0x66')],['ids','id'])||{});}})[_0x40d5('0x2d')](respondWithResult(_0x4c69fd,null))[_0x40d5('0x22')](handleError(_0x4c69fd,null));};function validateUser(_0x3cc5ac){return new Promise(function(_0x2e5e18,_0x3accbf){if(_0x3cc5ac[_0x40d5('0x6a')])return _0x2e5e18(_0x3cc5ac);return db['Setting'][_0x40d5('0x6b')](0x1)[_0x40d5('0x2d')](function(_0x29750d){if(_0x29750d['securePassword'])authService[_0x40d5('0x6c')](_0x3cc5ac['password']);db['User'][_0x40d5('0x6d')](_0x40d5('0x6a'))[_0x40d5('0x2d')](function(_0x2bde59){if(_[_0x40d5('0x6e')](_0x2bde59)){_0x3cc5ac[_0x40d5('0x6a')]=_0x29750d[_0x40d5('0x6f')]||0x1;return;}if(_[_0x40d5('0x6e')](_0x29750d[_0x40d5('0x6f')])||_0x29750d[_0x40d5('0x6f')]===_0x2bde59){_0x3cc5ac[_0x40d5('0x6a')]=_0x2bde59+0x1;return;}if(_0x29750d['min_internal']>_0x2bde59){_0x3cc5ac['internal']=_0x29750d[_0x40d5('0x6f')];return;}return db[_0x40d5('0x70')][_0x40d5('0x4b')](_0x40d5('0x71'),{'type':db[_0x40d5('0x70')][_0x40d5('0x72')]['SELECT']})['then'](function(_0x3be093){if(_0x3be093&&_0x3be093['length']){for(var _0x4d447b=0x0,_0x53f4fe=_0x3be093[_0x40d5('0x56')];_0x4d447b<_0x53f4fe&&_['isNil'](_0x3cc5ac[_0x40d5('0x6a')]);_0x4d447b++){if(_0x29750d['min_internal']<=_0x3be093[_0x4d447b][_0x40d5('0x73')]){_0x3cc5ac['internal']=_0x3be093[_0x4d447b][_0x40d5('0x73')];}else if(_0x29750d[_0x40d5('0x6f')]>_0x3be093[_0x4d447b]['from']&&_0x29750d[_0x40d5('0x6f')]<=_0x3be093[_0x4d447b]['to']){_0x3cc5ac[_0x40d5('0x6a')]=_0x29750d[_0x40d5('0x6f')];}}}if(_['isNil'](_0x3cc5ac[_0x40d5('0x6a')])){_0x3cc5ac['internal']=_0x2bde59+0x1;}return _0x2e5e18(_0x3cc5ac);});});})[_0x40d5('0x22')](function(_0x1e58ea){_0x3accbf(_0x1e58ea);});});}function updateUser(_0x337678){return new Promise(function(_0x4543c4,_0x5f09b5){try{if(_0x337678[_0x40d5('0x74')]){_0x337678[_0x40d5('0x75')]=_0x337678[_0x40d5('0x6a')];_0x337678[_0x40d5('0x76')]={'mailbox':_0x337678['internal'],'password':_0x337678[_0x40d5('0x5f')],'fullname':_0x337678[_0x40d5('0x77')],'email':_0x337678[_0x40d5('0x78')]};}if(_0x337678[_0x40d5('0x31')]===_0x40d5('0x36')){if(!_0x337678[_0x40d5('0x79')])_0x337678[_0x40d5('0x79')]=['101','102',_0x40d5('0x7a'),_0x40d5('0x7b'),_0x40d5('0x7c'),'104',_0x40d5('0x7d'),_0x40d5('0x7e'),_0x40d5('0x7f'),_0x40d5('0x80'),_0x40d5('0x81'),_0x40d5('0x82'),'111',_0x40d5('0x83'),_0x40d5('0x84')];}_0x4543c4(_0x337678);}catch(_0x323e42){_0x5f09b5(_0x323e42);}});}exports[_0x40d5('0x85')]=function(_0x299e6d,_0x324393){if(_0x299e6d[_0x40d5('0x34')]['role']==='agent')throw new Error(_0x40d5('0x86'));if(_0x299e6d['body'][_0x40d5('0x31')]===_0x40d5('0x34')&&_0x299e6d['user'][_0x40d5('0x31')]!==_0x40d5('0x32')){throw new Error(_0x40d5('0x87'));}if(_0x299e6d[_0x40d5('0x66')]['role']==='admin'&&_0x299e6d[_0x40d5('0x34')][_0x40d5('0x31')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x40d5('0x88')]([_0x299e6d[_0x40d5('0x66')]])[_0x40d5('0x2d')](function(){return validateUser(_0x299e6d['body']);})[_0x40d5('0x2d')](function(_0x432b0d){return updateUser(_0x432b0d)['then'](function(_0x3c9c93){if(_0x3c9c93[_0x40d5('0x31')]===_0x40d5('0x32')){_0x3c9c93[_0x40d5('0x89')]=_0x299e6d['user'][_0x40d5('0x89')];delete _0x3c9c93[_0x40d5('0x8a')];}return _0x3c9c93;});})[_0x40d5('0x2d')](function(_0x41d918){return db[_0x40d5('0x43')]['create'](_0x41d918,{'include':[{'model':db[_0x40d5('0x76')],'as':_0x40d5('0x76')}]});})[_0x40d5('0x2d')](function(_0x561f50){if(_0x299e6d[_0x40d5('0x66')][_0x40d5('0x31')]==='user')return _0x561f50;if(_0x299e6d['user'][_0x40d5('0x31')]!==_0x40d5('0x34'))return _0x561f50;return db[_0x40d5('0x8b')]['find']({'where':{'name':_0x561f50['role']===_0x40d5('0x36')?_0x40d5('0x35'):_0x40d5('0x37'),'userProfileId':_0x299e6d[_0x40d5('0x34')][_0x40d5('0x8a')]},'raw':!![]})['then'](function(_0x1e77e8){if(!_0x1e77e8||_0x1e77e8[_0x40d5('0x8c')]!=0x0)return _0x561f50;return db['UserProfileResource'][_0x40d5('0x85')]({'name':_0x561f50[_0x40d5('0x3e')],'resourceId':_0x561f50['id'],'type':_0x1e77e8[_0x40d5('0x3e')],'sectionId':_0x1e77e8['id']},{})[_0x40d5('0x2d')](function(){return _0x561f50;});})[_0x40d5('0x22')](function(_0x383c5f){logger[_0x40d5('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x383c5f);throw _0x383c5f;});})[_0x40d5('0x2d')](respondWithResult(_0x324393,0xc9))[_0x40d5('0x22')](handleError(_0x324393,null));};exports[_0x40d5('0x8d')]=function(_0x1c7885,_0x40bfca){var _0x50db92=_0x1c7885[_0x40d5('0x66')];var _0x365f54=[];if(_0x1c7885['user'][_0x40d5('0x31')]===_0x40d5('0x36'))throw new Error('Unauthorized');if(_[_0x40d5('0x8e')](_0x50db92,[_0x40d5('0x31'),_0x40d5('0x34')])&&_0x1c7885[_0x40d5('0x34')]['role']!==_0x40d5('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x50db92,[_0x40d5('0x31'),_0x40d5('0x32')])&&_0x1c7885[_0x40d5('0x34')]['role']!==_0x40d5('0x32')){throw new Error(_0x40d5('0x8f'));}return licenseUtil[_0x40d5('0x88')](_0x50db92)[_0x40d5('0x2d')](function(){return validateUser(_0x50db92[0x0]);})['then'](function(){for(var _0x1bff71=0x1;_0x1bff71<_0x50db92['length'];_0x1bff71++){var _0x1a6a7e=_0x50db92[_0x1bff71-0x1]['internal'];if(!_0x50db92[_0x1bff71][_0x40d5('0x6a')])_0x50db92[_0x1bff71][_0x40d5('0x6a')]=_0x1a6a7e+0x1;_0x365f54[_0x40d5('0x52')](validateUser(_0x50db92[_0x1bff71]));}return Promise[_0x40d5('0x5b')](_0x365f54);})[_0x40d5('0x2d')](function(){_0x365f54=[];for(var _0x47c863=0x0;_0x47c863<_0x50db92[_0x40d5('0x56')];_0x47c863++){_0x365f54[_0x40d5('0x52')](updateUser(_0x50db92[_0x47c863]));}return Promise['all'](_0x365f54);})[_0x40d5('0x2d')](function(){_0x365f54=_0x50db92['map'](function(_0x42aab8){return db['User'][_0x40d5('0x85')](_0x42aab8,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x40d5('0x2d')](function(_0x5e0096){_0x42aab8['id']=_0x5e0096['id'];return _0x42aab8;});});return Promise[_0x40d5('0x5b')](_0x365f54);})['then'](function(_0x347187){if(_0x1c7885[_0x40d5('0x66')][_0x40d5('0x31')]===_0x40d5('0x34'))return _0x347187;if(_0x1c7885[_0x40d5('0x34')][_0x40d5('0x31')]!==_0x40d5('0x34'))return _0x347187;var _0x430f12=_[_0x40d5('0x8e')](_0x347187,function(_0x7a7eac){return _0x7a7eac[_0x40d5('0x31')]===_0x40d5('0x36')||_0x7a7eac[_0x40d5('0x31')]==='telephone';});if(!_0x430f12)return _0x347187;return db[_0x40d5('0x8b')][_0x40d5('0x53')]({'where':{'name':{'$or':['Agents',_0x40d5('0x37')]},'userProfileId':_0x1c7885[_0x40d5('0x34')][_0x40d5('0x8a')]},'raw':!![]})[_0x40d5('0x2d')](function(_0xe3363e){if(_[_0x40d5('0x90')](_0xe3363e)||!_[_0x40d5('0x8e')](_0xe3363e,[_0x40d5('0x8c'),0x0]))return _0x347187;_0x365f54=[];var _0xb69e51=_(_0xe3363e)[_0x40d5('0x3b')](function(_0xc5eeb){if(_0xc5eeb[_0x40d5('0x8c')]===0x1)return;return _0xc5eeb[_0x40d5('0x3e')]===_0x40d5('0x35')?_0x40d5('0x36'):'telephone';})[_0x40d5('0x91')]()[_0x40d5('0x3c')]();for(var _0x319823=0x0;_0x319823<_0x347187[_0x40d5('0x56')];_0x319823++){if(!_[_0x40d5('0x92')](_0xb69e51,_0x347187[_0x319823][_0x40d5('0x31')]))return;var _0x1208eb=_0x347187[_0x319823][_0x40d5('0x31')]===_0x40d5('0x36')?'Agents':'Telephones';_0x365f54['push'](db[_0x40d5('0x93')][_0x40d5('0x85')]({'name':_0x347187[_0x319823][_0x40d5('0x3e')],'resourceId':_0x347187[_0x319823]['id'],'type':_0x1208eb,'sectionId':_[_0x40d5('0x3d')](_0xe3363e,[_0x40d5('0x3e'),_0x1208eb])['id']},{}));}return Promise[_0x40d5('0x5b')](_0x365f54);});})[_0x40d5('0x2d')](respondWithResult(_0x40bfca,0xc9))[_0x40d5('0x22')](handleError(_0x40bfca,null));};exports['changePassword']=function(_0x33f078,_0x5a9599){if(_0x33f078[_0x40d5('0x66')]['id']){delete _0x33f078[_0x40d5('0x66')]['id'];}return db['User']['find']({'where':{'id':_0x33f078[_0x40d5('0x5d')]['id']}})['then'](function(_0x388ba2){if(!_0x388ba2)return null;if(_0x388ba2['id']===_0x33f078[_0x40d5('0x34')]['id']){if(!_0x33f078[_0x40d5('0x66')]['oldPassword']||!_0x33f078[_0x40d5('0x66')]['newPassword']){throw new db[(_0x40d5('0x94'))]['ValidationError'](_0x40d5('0x95'));}if(!_0x388ba2[_0x40d5('0x96')](_0x33f078[_0x40d5('0x66')][_0x40d5('0x97')])){throw new db[(_0x40d5('0x94'))]['ValidationError'](_0x40d5('0x98'));}if(_0x33f078[_0x40d5('0x66')][_0x40d5('0x97')]===_0x33f078[_0x40d5('0x66')][_0x40d5('0x99')]){throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))](_0x40d5('0x9b'));}}else if(_0x33f078[_0x40d5('0x34')]['role']==='admin'){if(!_0x33f078[_0x40d5('0x66')][_0x40d5('0x99')]){throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))](_0x40d5('0x9c'));}}else if(_0x33f078[_0x40d5('0x34')][_0x40d5('0x31')]===_0x40d5('0x34')){if(!_0x33f078['body'][_0x40d5('0x99')]){throw new db[(_0x40d5('0x94'))]['ValidationError'](_0x40d5('0x9c'));}if(_0x388ba2[_0x40d5('0x31')]!=='agent'){throw new db['Sequelize']['ValidationError'](_0x40d5('0x86'));}}else{throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))](_0x40d5('0x86'));}return _0x388ba2;})[_0x40d5('0x2d')](handleEntityNotFound(_0x5a9599,null))[_0x40d5('0x2d')](function(_0x37498b){return db[_0x40d5('0x9d')][_0x40d5('0x9e')]({'attributes':['id','securePassword','enforcePasswordHistory',_0x40d5('0x9f')]})['then'](function(_0xd91cc2){if(_0xd91cc2[_0x40d5('0xa0')])authService[_0x40d5('0x6c')](_0x33f078[_0x40d5('0x66')][_0x40d5('0x99')]);if(!_0xd91cc2['enforcePasswordHistory']||!_0x37498b[_0x40d5('0xa1')])return _0x37498b;authService[_0x40d5('0xa2')](_0x33f078[_0x40d5('0x66')]['newPassword'],_0x37498b[_0x40d5('0xa1')],_0xd91cc2[_0x40d5('0x9f')]);return _0x37498b;})['then'](saveUpdates({'password':_0x33f078[_0x40d5('0x66')][_0x40d5('0x99')],'passwordResetAt':_0x33f078[_0x40d5('0x34')]['id']==_0x33f078[_0x40d5('0x5d')]['id']?moment():null,'previousPasswords':authService[_0x40d5('0xa3')](_0x33f078['body'][_0x40d5('0x99')],_0x37498b[_0x40d5('0xa1')])},null));})[_0x40d5('0x2d')](respondWithResult(_0x5a9599,null))['catch'](handleError(_0x5a9599,null));};exports[_0x40d5('0xa4')]=function(_0x9b1f46,_0x48c586){var _0x5e2ceb=_0x9b1f46[_0x40d5('0x66')][_0x40d5('0xa5')];return db['User'][_0x40d5('0x3d')]({'where':{'id':_0x9b1f46['params']['id']},'attributes':['id','name',_0x40d5('0x31'),'online',_0x40d5('0xa6'),_0x40d5('0xa7'),_0x40d5('0xa8')]})['then'](handleEntityNotFound(_0x48c586,null))[_0x40d5('0x2d')](function(_0x51b61c){if(_0x51b61c){if(!utils[_0x40d5('0xa9')](_0x5e2ceb)){throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))]('Unknown\x20channel');}return _0x51b61c['add'+_[_0x40d5('0xaa')](_0x5e2ceb[_0x40d5('0xab')]())+_0x40d5('0xac')](_0x9b1f46['body']['ids'],{'penalty':_0x9b1f46[_0x40d5('0x66')][_0x40d5('0xad')]||0x0})[_0x40d5('0xae')](function(_0x59dec8){for(var _0x21fcdf=0x0;_0x21fcdf<_0x9b1f46[_0x40d5('0x66')]['ids'][_0x40d5('0x56')];_0x21fcdf+=0x1){var _0x2d11df={'UserId':Number(_0x9b1f46['params']['id'])};_0x2d11df[_['capitalize'](_0x5e2ceb[_0x40d5('0xab')]())+_0x40d5('0xaf')]=Number(_0x9b1f46[_0x40d5('0x66')][_0x40d5('0x68')][_0x21fcdf]);socket[_0x40d5('0x2e')](_0x40d5('0x34')+_['capitalize'](_0x5e2ceb['toLowerCase']())+_0x40d5('0xb0'),_0x2d11df);}return _0x59dec8;})[_0x40d5('0x2d')](function(){if(_0x5e2ceb==='voice'){return db[_0x40d5('0xb1')][_0x40d5('0x53')]({'where':{'id':_0x9b1f46[_0x40d5('0x66')][_0x40d5('0x68')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x5d39ec){var _0x13b35b=_0x51b61c[_0x40d5('0x30')]({'plain':!![]});var _0x4c7589=[];if(_0x5e2ceb===_0x40d5('0xb2')&&_0x13b35b['role']==='agent'&&_0x13b35b['online']){for(let _0x12d242=0x0;_0x12d242<_0x5d39ec[_0x40d5('0x56')];_0x12d242+=0x1){_0x4c7589['push']({'membername':_0x13b35b['name'],'UserId':_0x13b35b['id'],'queue_name':_0x5d39ec[_0x12d242]['name'],'VoiceQueueId':_0x5d39ec[_0x12d242]['id'],'interface':_[_0x40d5('0x6e')](_0x13b35b[_0x40d5('0xa8')])?util[_0x40d5('0xb3')]('SIP/%s',_0x13b35b[_0x40d5('0x3e')]):_0x13b35b['interface'],'paused':_0x13b35b[_0x40d5('0xa7')]||![],'penalty':_0x9b1f46[_0x40d5('0x66')][_0x40d5('0xad')]||0x0});}return Promise[_0x40d5('0x5b')](_0x4c7589[_0x40d5('0x3b')](function(_0x581b8e){return db[_0x40d5('0xb4')][_0x40d5('0xb5')](_0x581b8e);}));}return _0x51b61c;});}})[_0x40d5('0x2d')](respondWithStatusCode(_0x48c586,null))['catch'](handleError(_0x48c586,null));};exports['removeQueues']=function(_0x386dd6,_0x47f71a){var _0x434331,_0x30a762;return db[_0x40d5('0x43')]['find']({'where':{'id':_0x386dd6[_0x40d5('0x5d')]['id']},'attributes':['id',_0x40d5('0x3e'),'role']})[_0x40d5('0x2d')](handleEntityNotFound(_0x47f71a,null))[_0x40d5('0x2d')](function(_0x56cdd7){if(_0x56cdd7){_0x434331=_0x56cdd7;if(!_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')]||!utils[_0x40d5('0xa9')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')])){throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))](_0x40d5('0xb6'));}return _0x56cdd7[_0x40d5('0xb7')+_['capitalize'](_0x386dd6[_0x40d5('0x4b')]['channel'][_0x40d5('0xab')]())+_0x40d5('0xac')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0x68')]);}})[_0x40d5('0x2d')](function(_0x367ff0){if(_[_0x40d5('0xb8')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0x68')])){for(var _0x563f41=0x0;_0x563f41<_0x386dd6['query'][_0x40d5('0x68')][_0x40d5('0x56')];_0x563f41+=0x1){_0x30a762={'UserId':Number(_0x386dd6[_0x40d5('0x5d')]['id'])};_0x30a762[_[_0x40d5('0xaa')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')][_0x40d5('0xab')]())+'QueueId']=Number(_0x386dd6[_0x40d5('0x4b')]['ids'][_0x563f41]);socket[_0x40d5('0x2e')]('user'+_[_0x40d5('0xaa')](_0x386dd6['query'][_0x40d5('0xa5')][_0x40d5('0xab')]())+_0x40d5('0xb9'),_0x30a762);}}else{_0x30a762={'UserId':Number(_0x386dd6[_0x40d5('0x5d')]['id'])};_0x30a762[_[_0x40d5('0xaa')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')][_0x40d5('0xab')]())+'QueueId']=Number(_0x386dd6[_0x40d5('0x4b')][_0x40d5('0x68')]);socket[_0x40d5('0x2e')](_0x40d5('0x34')+_[_0x40d5('0xaa')](_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')][_0x40d5('0xab')]())+_0x40d5('0xb9'),_0x30a762);}return _0x367ff0;})[_0x40d5('0x2d')](function(){if(_0x386dd6[_0x40d5('0x4b')][_0x40d5('0xa5')]==='voice'){return db[_0x40d5('0xb4')][_0x40d5('0x3f')]({'where':{'UserId':_0x386dd6[_0x40d5('0x5d')]['id'],'VoiceQueueId':_0x386dd6[_0x40d5('0x4b')]['ids']},'individualHooks':!![]})[_0x40d5('0x2d')](function(){return _0x434331;});}return _0x434331;})[_0x40d5('0x2d')](respondWithStatusCode(_0x47f71a,null))[_0x40d5('0x22')](handleError(_0x47f71a,null));};exports[_0x40d5('0xba')]=function(_0x3f9c9a,_0x790b52){_0x3f9c9a['body'][_0x40d5('0xbb')]=_0x3f9c9a[_0x40d5('0xbc')][_0x40d5('0xbd')];return db[_0x40d5('0x43')]['find']({'where':{'id':_0x3f9c9a['params']['id']}})['then'](handleEntityNotFound(_0x790b52,null))['then'](saveUpdates(_0x3f9c9a['body'],null))['then'](respondWithResult(_0x790b52,null))[_0x40d5('0x22')](handleError(_0x790b52,null));};exports[_0x40d5('0xbe')]=function(_0x306bfe,_0x500553){var _0x32320c=path[_0x40d5('0xbf')](config[_0x40d5('0xc0')],_0x40d5('0xc1'));return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x306bfe[_0x40d5('0x5d')]['id']},'attributes':['id',_0x40d5('0xbb')],'raw':!![]})[_0x40d5('0x2d')](handleEntityNotFound(_0x500553,null))['then'](function(_0x19d534){if(_0x19d534){if(_['isNil'](_0x19d534[_0x40d5('0xbb')])){return _0x500553[_0x40d5('0xc2')](_0x32320c);}else{if(!fs[_0x40d5('0xc3')](path[_0x40d5('0xbf')](config[_0x40d5('0xc0')],_0x40d5('0xc4'),_0x19d534['userpic']))){return _0x500553['download'](_0x32320c);}return _0x500553[_0x40d5('0xc2')](path[_0x40d5('0xbf')](config['root'],_0x40d5('0xc4'),_0x19d534[_0x40d5('0xbb')]));}}})['catch'](handleError(_0x500553,null));};exports[_0x40d5('0xc5')]=function(_0x53bc2e,_0x1cdfd2){return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x53bc2e[_0x40d5('0x5d')]['id']},'attributes':['id']})[_0x40d5('0x2d')](handleEntityNotFound(_0x1cdfd2,null))['then'](function(_0x525f5a){var _0x46515b=[];values=_0x525f5a[_0x40d5('0x57')];_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x65'),_0x525f5a[_0x40d5('0x57')]));_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x58'),_0x525f5a['dataValues']));_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0xc6'),_0x525f5a[_0x40d5('0x57')]));_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x5a'),_0x525f5a[_0x40d5('0x57')]));_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0xc7'),_0x525f5a[_0x40d5('0x57')]));_0x46515b[_0x40d5('0x52')](get_open_tabs(_0x40d5('0x59'),_0x525f5a[_0x40d5('0x57')]));return Promise['all'](_0x46515b);})[_0x40d5('0x2d')](function(_0x5ae940){if(_0x5ae940){var _0x9b10ef=_[_0x40d5('0x3b')](values[_0x40d5('0xc8')],function(_0xdd49a3){return{'channel':'CHAT','id':_0xdd49a3['id'],'createdAt':_0xdd49a3[_0x40d5('0xc9')]};});var _0x7fc45=_['map'](values[_0x40d5('0xca')],function(_0x4e8f82){return{'channel':'FAX','id':_0x4e8f82['id'],'createdAt':_0x4e8f82['createdAt']};});var _0x2c8c84=_[_0x40d5('0x3b')](values[_0x40d5('0xcb')],function(_0x242824){return{'channel':'OPENCHANNEL','id':_0x242824['id'],'createdAt':_0x242824[_0x40d5('0xc9')]};});var _0x30b7d7=_[_0x40d5('0x3b')](values[_0x40d5('0xcc')],function(_0x416a6b){return{'channel':_0x40d5('0xcd'),'id':_0x416a6b['id'],'createdAt':_0x416a6b[_0x40d5('0xc9')]};});var _0x3a3eb7=_[_0x40d5('0x3b')](values[_0x40d5('0xce')],function(_0x43c424){return{'channel':_0x40d5('0xcf'),'id':_0x43c424['id'],'createdAt':_0x43c424[_0x40d5('0xc9')]};});var _0x4ca3b5=_[_0x40d5('0x3b')](values[_0x40d5('0xd0')],function(_0x2e445a){return{'channel':_0x40d5('0xd1'),'id':_0x2e445a['id'],'createdAt':_0x2e445a[_0x40d5('0xc9')]};});var _0x54c9b9=_[_0x40d5('0xd2')](_0x9b10ef,_0x7fc45,_0x2c8c84,_0x30b7d7,_0x3a3eb7,_0x4ca3b5);var _0x5d4308={'count':_0x54c9b9[_0x40d5('0x56')],'rows':_0x54c9b9};return _0x5d4308;}else return null;})[_0x40d5('0x2d')](respondWithResult(_0x1cdfd2,null))['catch'](handleError(_0x1cdfd2,null));};exports[_0x40d5('0xd3')]=function(_0x52d3e5,_0x41b8fb){var _0x1a3a84={};var _0x5dab8e={};var _0x100285;var _0x3bfaaf;return db[_0x40d5('0x43')]['findOne']({'where':{'id':_0x52d3e5[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x41b8fb,null))[_0x40d5('0x2d')](function(_0x3e5fbe){if(_0x3e5fbe){_0x100285=_0x3e5fbe;_0x5dab8e[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xd4')][_0x40d5('0x44')]);_0x5dab8e[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x52d3e5[_0x40d5('0x4b')]);_0x5dab8e['filters']=_[_0x40d5('0x62')](_0x5dab8e[_0x40d5('0x61')],_0x5dab8e['query']);_0x1a3a84[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x5dab8e[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x52d3e5['query'][_0x40d5('0x63')]));_0x1a3a84[_0x40d5('0x51')]=_0x1a3a84[_0x40d5('0x51')][_0x40d5('0x56')]?_0x1a3a84[_0x40d5('0x51')]:_0x5dab8e['model'];_0x1a3a84[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x1a3a84['where']=qs[_0x40d5('0x60')](_['pick'](_0x52d3e5[_0x40d5('0x4b')],_0x5dab8e['filters']));if(_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x1a3a84[_0x40d5('0x4a')]=_[_0x40d5('0x64')](_0x1a3a84[_0x40d5('0x4a')],{'$or':_['map'](_0x1a3a84[_0x40d5('0x51')],function(_0x18c2e5){var _0x2c2a64={};_0x2c2a64[_0x18c2e5]={'$like':'%'+_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x2c2a64;})});}_0x1a3a84=_[_0x40d5('0x64')]({},_0x1a3a84,_0x52d3e5[_0x40d5('0xd7')]);return _0x100285['getContacts'](_0x1a3a84);}})['then'](function(_0x1b2dd6){if(_0x1b2dd6){_0x3bfaaf=_0x1b2dd6[_0x40d5('0x56')];if(_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0xd8')](_0x40d5('0x4c'))){_0x1a3a84[_0x40d5('0x4d')]=[{'model':db[_0x40d5('0xd9')],'as':_0x40d5('0xda'),'required':![]},{'model':db[_0x40d5('0xdb')],'as':_0x40d5('0xdc'),'attributes':['id','name',_0x40d5('0xdd')],'where':_0x52d3e5['query'][_0x40d5('0xde')]?{'id':_0x52d3e5['query']['tag']}:undefined,'required':_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0xde')]?!![]:![]}];}if(!_0x52d3e5['query'][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0x1a3a84[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x52d3e5[_0x40d5('0x4b')][_0x40d5('0x27')]);_0x1a3a84[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x52d3e5['query'][_0x40d5('0x29')]);}return _0x100285[_0x40d5('0xd3')](_0x1a3a84);}})[_0x40d5('0x2d')](function(_0x227705){if(_0x227705){return _0x227705?{'count':_0x3bfaaf,'rows':_0x227705}:null;}})['then'](respondWithResult(_0x41b8fb,null))['catch'](handleError(_0x41b8fb,null));};exports[_0x40d5('0xe0')]=function(_0x43a160,_0x3b66d8){var _0x2aa263;var _0x347c34={};var _0x394b49;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x43a160['params']['id']},'attributes':['id',_0x40d5('0x3e'),'role']})[_0x40d5('0x2d')](handleEntityNotFound(_0x3b66d8,null))[_0x40d5('0x2d')](function(_0x14dd59){if(!utils[_0x40d5('0xa9')](_0x43a160[_0x40d5('0x4b')][_0x40d5('0xa5')])){throw new db['Sequelize'][(_0x40d5('0x9a'))](_0x40d5('0xb6'));}_0x2aa263=_0x14dd59;var _0x555a4c={};_0x555a4c['model']=_[_0x40d5('0x5e')](db[_[_0x40d5('0xaa')](_0x43a160[_0x40d5('0x4b')]['channel'])+'Queue']['rawAttributes']);_0x555a4c[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x43a160[_0x40d5('0x4b')]);_0x555a4c['filters']=_['intersection'](_0x555a4c[_0x40d5('0x61')],_0x555a4c[_0x40d5('0x4b')]);_0x347c34['attributes']=_[_0x40d5('0x62')](_0x555a4c[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x43a160['query'][_0x40d5('0x63')]));_0x347c34['attributes']=_0x347c34[_0x40d5('0x51')][_0x40d5('0x56')]?_0x347c34['attributes']:_0x555a4c['model'];_0x347c34[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x43a160[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x347c34[_0x40d5('0x4a')]=qs['filters'](_[_0x40d5('0xe1')](_0x43a160[_0x40d5('0x4b')],_0x555a4c[_0x40d5('0x60')]));if(_0x43a160[_0x40d5('0x4b')]['filter']){_0x347c34[_0x40d5('0x4a')]=_['merge'](_0x347c34[_0x40d5('0x4a')],{'$or':_['map'](_0x347c34[_0x40d5('0x51')],function(_0x2020fe){var _0x5c3d88={};_0x5c3d88[_0x2020fe]={'$like':'%'+_0x43a160[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x5c3d88;})});}_0x347c34=_[_0x40d5('0x64')]({},_0x347c34,_0x43a160[_0x40d5('0xd7')]);switch(_0x2aa263['role']){case _0x40d5('0x32'):return db[_[_0x40d5('0xaa')](_0x43a160[_0x40d5('0x4b')][_0x40d5('0xa5')])+_0x40d5('0xe2')][_0x40d5('0x53')](_0x347c34);case _0x40d5('0x34'):case'agent':return _0x2aa263[_0x40d5('0x30')+_[_0x40d5('0xaa')](_0x43a160[_0x40d5('0x4b')]['channel'])+_0x40d5('0xac')](_0x347c34);default:throw new db['Sequelize']['ValidationError'](_0x40d5('0xe3'));}})['then'](function(_0x47cc31){_0x394b49=_0x47cc31['length'];if(!_0x43a160['query'][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0x347c34[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x43a160['query']['limit']);_0x347c34[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x43a160[_0x40d5('0x4b')][_0x40d5('0x29')]);}switch(_0x2aa263[_0x40d5('0x31')]){case _0x40d5('0x32'):return db[_[_0x40d5('0xaa')](_0x43a160[_0x40d5('0x4b')]['channel'])+_0x40d5('0xe2')][_0x40d5('0x53')](_0x347c34);case'user':case _0x40d5('0x36'):return _0x2aa263[_0x40d5('0x30')+_[_0x40d5('0xaa')](_0x43a160[_0x40d5('0x4b')][_0x40d5('0xa5')])+'Queues'](_0x347c34);}})[_0x40d5('0x2d')](function(_0x140714){return{'count':_0x394b49,'rows':_0x140714};})[_0x40d5('0x2d')](respondWithResult(_0x3b66d8,null))[_0x40d5('0x22')](handleError(_0x3b66d8,null));};exports['getVoiceQueuesRt']=function(_0xc842d9,_0x572812){var _0x21a37c={};var _0x160f62={};var _0x267e3a;var _0x4fc607;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0xc842d9[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x572812,null))[_0x40d5('0x2d')](function(_0x2adcda){if(_0x2adcda){_0x267e3a=_0x2adcda;_0x160f62[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xb4')][_0x40d5('0x44')]);_0x160f62['query']=_[_0x40d5('0x5e')](_0xc842d9[_0x40d5('0x4b')]);_0x160f62[_0x40d5('0x60')]=_['intersection'](_0x160f62[_0x40d5('0x61')],_0x160f62[_0x40d5('0x4b')]);_0x21a37c['attributes']=_['intersection'](_0x160f62[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0xc842d9[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x21a37c[_0x40d5('0x51')]=_0x21a37c['attributes'][_0x40d5('0x56')]?_0x21a37c[_0x40d5('0x51')]:_0x160f62[_0x40d5('0x61')];_0x21a37c[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0xc842d9[_0x40d5('0x4b')]['sort']);_0x21a37c[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_['pick'](_0xc842d9['query'],_0x160f62[_0x40d5('0x60')]));if(_0xc842d9[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x21a37c['where']=_[_0x40d5('0x64')](_0x21a37c[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x21a37c['attributes'],function(_0x350745){var _0x3d17db={};_0x3d17db[_0x350745]={'$like':'%'+_0xc842d9[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x3d17db;})});}_0x21a37c=_['merge']({},_0x21a37c,_0xc842d9[_0x40d5('0xd7')]);return _0x267e3a['getVoiceQueuesRt'](_0x21a37c);}})['then'](function(_0x1baa20){if(_0x1baa20){_0x4fc607=_0x1baa20[_0x40d5('0x56')];if(!_0xc842d9[_0x40d5('0x4b')][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0x21a37c[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0xc842d9[_0x40d5('0x4b')][_0x40d5('0x27')]);_0x21a37c[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0xc842d9[_0x40d5('0x4b')][_0x40d5('0x29')]);}return _0x267e3a[_0x40d5('0xe4')](_0x21a37c);}})['then'](function(_0x4d23a4){if(_0x4d23a4){return _0x4d23a4?{'count':_0x4fc607,'rows':_0x4d23a4}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x572812,null))[_0x40d5('0x22')](handleError(_0x572812,null));};exports[_0x40d5('0xe5')]=function(_0x20f6db,_0x34ce5c){var _0x31be74={};var _0x3e2a32={};var _0x4495ea;var _0x35c541;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x20f6db[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x34ce5c,null))[_0x40d5('0x2d')](function(_0x54f839){if(_0x54f839){_0x4495ea=_0x54f839;_0x3e2a32[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xe6')]['rawAttributes']);_0x3e2a32['query']=_[_0x40d5('0x5e')](_0x20f6db[_0x40d5('0x4b')]);_0x3e2a32[_0x40d5('0x60')]=_[_0x40d5('0x62')](_0x3e2a32[_0x40d5('0x61')],_0x3e2a32[_0x40d5('0x4b')]);_0x31be74['attributes']=_[_0x40d5('0x62')](_0x3e2a32[_0x40d5('0x61')],qs['fields'](_0x20f6db['query'][_0x40d5('0x63')]));_0x31be74[_0x40d5('0x51')]=_0x31be74[_0x40d5('0x51')]['length']?_0x31be74[_0x40d5('0x51')]:_0x3e2a32['model'];_0x31be74[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x20f6db[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x31be74[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_['pick'](_0x20f6db[_0x40d5('0x4b')],_0x3e2a32[_0x40d5('0x60')]));if(_0x20f6db['query'][_0x40d5('0x39')]){_0x31be74[_0x40d5('0x4a')]=_['merge'](_0x31be74['where'],{'$or':_['map'](_0x31be74[_0x40d5('0x51')],function(_0x4d4912){var _0x134e96={};_0x134e96[_0x4d4912]={'$like':'%'+_0x20f6db[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x134e96;})});}_0x31be74=_[_0x40d5('0x64')]({},_0x31be74,_0x20f6db[_0x40d5('0xd7')]);return _0x4495ea[_0x40d5('0xe5')](_0x31be74);}})['then'](function(_0x5a3194){if(_0x5a3194){_0x35c541=_0x5a3194[_0x40d5('0x56')];if(!_0x20f6db[_0x40d5('0x4b')]['hasOwnProperty']('nolimit')){_0x31be74[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x20f6db['query'][_0x40d5('0x27')]);_0x31be74[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x20f6db[_0x40d5('0x4b')]['offset']);}return _0x4495ea[_0x40d5('0xe5')](_0x31be74);}})[_0x40d5('0x2d')](function(_0x38cbe9){if(_0x38cbe9){return _0x38cbe9?{'count':_0x35c541,'rows':_0x38cbe9}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x34ce5c,null))[_0x40d5('0x22')](handleError(_0x34ce5c,null));};exports[_0x40d5('0xe7')]=function(_0x290a0d,_0x29d518){var _0x57cf68={'raw':!![],'where':{}};var _0x6be890={};var _0x20b921={'count':0x0,'rows':[]};return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x290a0d[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x29d518,null))[_0x40d5('0x2d')](function(_0x4cc22e){if(_0x4cc22e){_0x6be890['model']=_['keys'](db[_0x40d5('0xe8')][_0x40d5('0x44')]);_0x6be890[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x290a0d[_0x40d5('0x4b')]);_0x6be890[_0x40d5('0x60')]=_[_0x40d5('0x62')](_0x6be890[_0x40d5('0x61')],_0x6be890[_0x40d5('0x4b')]);_0x57cf68[_0x40d5('0x51')]=_['intersection'](_0x6be890[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x290a0d[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x57cf68[_0x40d5('0x51')]=_0x57cf68[_0x40d5('0x51')][_0x40d5('0x56')]?_0x57cf68[_0x40d5('0x51')]:_0x6be890[_0x40d5('0x61')];if(!_0x290a0d[_0x40d5('0x4b')][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0x57cf68[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x290a0d['query']['limit']);_0x57cf68[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x290a0d[_0x40d5('0x4b')][_0x40d5('0x29')]);}_0x57cf68['order']=qs[_0x40d5('0xd6')](_0x290a0d[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x57cf68['where']=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x290a0d['query'],_0x6be890[_0x40d5('0x60')]));_0x57cf68[_0x40d5('0x4a')]['UserId']=_0x4cc22e['id'];if(_0x290a0d['query'][_0x40d5('0x39')]){_0x57cf68['where']=_[_0x40d5('0x64')](_0x57cf68['where'],{'$or':_[_0x40d5('0x3b')](_0x57cf68[_0x40d5('0x51')],function(_0x2183ff){var _0xf411a9={};_0xf411a9[_0x2183ff]={'$like':'%'+_0x290a0d[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0xf411a9;})});}_0x57cf68=_[_0x40d5('0x64')]({},_0x57cf68,_0x290a0d[_0x40d5('0xd7')]);return db['VoiceRecording'][_0x40d5('0x28')]({'where':_0x57cf68[_0x40d5('0x4a')]})[_0x40d5('0x2d')](function(_0x29b035){_0x20b921[_0x40d5('0x28')]=_0x29b035;if(_0x290a0d['query'][_0x40d5('0x4c')]){_0x57cf68[_0x40d5('0x4d')]=[{'all':!![]}];}return db[_0x40d5('0xe8')][_0x40d5('0x53')](_0x57cf68);})[_0x40d5('0x2d')](function(_0x1d82b5){_0x20b921[_0x40d5('0x54')]=_0x1d82b5;return _0x20b921;});}})[_0x40d5('0x2d')](respondWithFilteredResult(_0x29d518,_0x57cf68))[_0x40d5('0x22')](handleError(_0x29d518,null));};exports[_0x40d5('0xe9')]=function(_0x1d8348,_0x403ebb){var _0x3c06c3={'raw':!![],'where':{}};var _0x2c1320={};var _0x1041f1={'count':0x0,'rows':[]};return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x1d8348['params']['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x403ebb,null))[_0x40d5('0x2d')](function(_0x3e2102){if(_0x3e2102){_0x2c1320['model']=_[_0x40d5('0x5e')](db['ScreenRecording'][_0x40d5('0x44')]);_0x2c1320[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x1d8348['query']);_0x2c1320[_0x40d5('0x60')]=_[_0x40d5('0x62')](_0x2c1320[_0x40d5('0x61')],_0x2c1320[_0x40d5('0x4b')]);_0x3c06c3[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x2c1320[_0x40d5('0x61')],qs['fields'](_0x1d8348[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x3c06c3[_0x40d5('0x51')]=_0x3c06c3[_0x40d5('0x51')][_0x40d5('0x56')]?_0x3c06c3[_0x40d5('0x51')]:_0x2c1320[_0x40d5('0x61')];if(!_0x1d8348[_0x40d5('0x4b')][_0x40d5('0xd8')]('nolimit')){_0x3c06c3[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x1d8348[_0x40d5('0x4b')][_0x40d5('0x27')]);_0x3c06c3[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x1d8348['query']['offset']);}_0x3c06c3['order']=qs['sort'](_0x1d8348[_0x40d5('0x4b')]['sort']);_0x3c06c3[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_['pick'](_0x1d8348[_0x40d5('0x4b')],_0x2c1320[_0x40d5('0x60')]));_0x3c06c3[_0x40d5('0x4a')][_0x40d5('0xea')]=_0x3e2102['id'];if(_0x1d8348[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x3c06c3[_0x40d5('0x4a')]=_['merge'](_0x3c06c3[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x3c06c3[_0x40d5('0x51')],function(_0x303945){var _0x3814a8={};_0x3814a8[_0x303945]={'$like':'%'+_0x1d8348[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x3814a8;})});}_0x3c06c3=_[_0x40d5('0x64')]({},_0x3c06c3,_0x1d8348[_0x40d5('0xd7')]);return db[_0x40d5('0xeb')][_0x40d5('0x28')]({'where':_0x3c06c3[_0x40d5('0x4a')]})[_0x40d5('0x2d')](function(_0x29b141){_0x1041f1['count']=_0x29b141;if(_0x1d8348[_0x40d5('0x4b')][_0x40d5('0x4c')]){_0x3c06c3[_0x40d5('0x4d')]=[{'all':!![]}];}return db[_0x40d5('0xeb')][_0x40d5('0x53')](_0x3c06c3);})[_0x40d5('0x2d')](function(_0x1d0291){_0x1041f1['rows']=_0x1d0291;return _0x1041f1;});}})[_0x40d5('0x2d')](respondWithFilteredResult(_0x403ebb,_0x3c06c3))[_0x40d5('0x22')](handleError(_0x403ebb,null));};exports[_0x40d5('0xec')]=function(_0x13eb32,_0xd63f18){var _0x146172={};var _0x189fd4={};var _0x4e99e1;var _0x36c1cd;return db[_0x40d5('0x43')]['findOne']({'where':{'id':_0x13eb32[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0xd63f18,null))[_0x40d5('0x2d')](function(_0x26845e){if(_0x26845e){_0x4e99e1=_0x26845e;_0x189fd4['model']=_[_0x40d5('0x5e')](db[_0x40d5('0xed')][_0x40d5('0x44')]);_0x189fd4[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x13eb32[_0x40d5('0x4b')]);_0x189fd4['filters']=_['intersection'](_0x189fd4['model'],_0x189fd4[_0x40d5('0x4b')]);_0x146172['attributes']=_[_0x40d5('0x62')](_0x189fd4[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x13eb32['query'][_0x40d5('0x63')]));_0x146172[_0x40d5('0x51')]=_0x146172[_0x40d5('0x51')]['length']?_0x146172[_0x40d5('0x51')]:_0x189fd4['model'];_0x146172[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x13eb32['query'][_0x40d5('0xd6')]);_0x146172[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x13eb32[_0x40d5('0x4b')],_0x189fd4[_0x40d5('0x60')]));if(_0x13eb32[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x146172[_0x40d5('0x4a')]=_[_0x40d5('0x64')](_0x146172[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x146172[_0x40d5('0x51')],function(_0x5aa2cd){var _0x619b28={};_0x619b28[_0x5aa2cd]={'$like':'%'+_0x13eb32[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x619b28;})});}_0x146172=_['merge']({},_0x146172,_0x13eb32['options']);return _0x4e99e1['getChatInteractions'](_0x146172);}})['then'](function(_0x430449){if(_0x430449){_0x36c1cd=_0x430449['length'];if(!_0x13eb32[_0x40d5('0x4b')][_0x40d5('0xd8')]('nolimit')){_0x146172[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x13eb32['query'][_0x40d5('0x27')]);_0x146172[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x13eb32[_0x40d5('0x4b')][_0x40d5('0x29')]);}return _0x4e99e1[_0x40d5('0xec')](_0x146172);}})[_0x40d5('0x2d')](function(_0x78bb7){if(_0x78bb7){return _0x78bb7?{'count':_0x36c1cd,'rows':_0x78bb7}:null;}})[_0x40d5('0x2d')](respondWithResult(_0xd63f18,null))[_0x40d5('0x22')](handleError(_0xd63f18,null));};exports['getOpenchannelInteractions']=function(_0x3c96d5,_0x111d9c){var _0x29d6c4={};var _0x21f2ec={};var _0x4de9e5;var _0xb64ac4;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x3c96d5['params']['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x111d9c,null))[_0x40d5('0x2d')](function(_0x17f688){if(_0x17f688){_0x4de9e5=_0x17f688;_0x21f2ec[_0x40d5('0x61')]=_['keys'](db[_0x40d5('0xee')][_0x40d5('0x44')]);_0x21f2ec['query']=_[_0x40d5('0x5e')](_0x3c96d5[_0x40d5('0x4b')]);_0x21f2ec['filters']=_[_0x40d5('0x62')](_0x21f2ec[_0x40d5('0x61')],_0x21f2ec[_0x40d5('0x4b')]);_0x29d6c4[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x21f2ec[_0x40d5('0x61')],qs['fields'](_0x3c96d5[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x29d6c4[_0x40d5('0x51')]=_0x29d6c4[_0x40d5('0x51')]['length']?_0x29d6c4[_0x40d5('0x51')]:_0x21f2ec[_0x40d5('0x61')];_0x29d6c4['order']=qs[_0x40d5('0xd6')](_0x3c96d5[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x29d6c4[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_['pick'](_0x3c96d5[_0x40d5('0x4b')],_0x21f2ec[_0x40d5('0x60')]));if(_0x3c96d5['query']['filter']){_0x29d6c4[_0x40d5('0x4a')]=_[_0x40d5('0x64')](_0x29d6c4[_0x40d5('0x4a')],{'$or':_['map'](_0x29d6c4[_0x40d5('0x51')],function(_0x14ee8e){var _0x2b4cbf={};_0x2b4cbf[_0x14ee8e]={'$like':'%'+_0x3c96d5[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x2b4cbf;})});}_0x29d6c4=_[_0x40d5('0x64')]({},_0x29d6c4,_0x3c96d5[_0x40d5('0xd7')]);return _0x4de9e5[_0x40d5('0xef')](_0x29d6c4);}})['then'](function(_0x574f6b){if(_0x574f6b){_0xb64ac4=_0x574f6b[_0x40d5('0x56')];if(!_0x3c96d5[_0x40d5('0x4b')]['hasOwnProperty'](_0x40d5('0xdf'))){_0x29d6c4[_0x40d5('0x27')]=qs['limit'](_0x3c96d5[_0x40d5('0x4b')][_0x40d5('0x27')]);_0x29d6c4[_0x40d5('0x29')]=qs['offset'](_0x3c96d5[_0x40d5('0x4b')]['offset']);}return _0x4de9e5[_0x40d5('0xef')](_0x29d6c4);}})[_0x40d5('0x2d')](function(_0x3c7275){if(_0x3c7275){return _0x3c7275?{'count':_0xb64ac4,'rows':_0x3c7275}:null;}})['then'](respondWithResult(_0x111d9c,null))[_0x40d5('0x22')](handleError(_0x111d9c,null));};exports[_0x40d5('0xf0')]=function(_0x20d7db,_0x239432){var _0xbb80a2={'raw':!![],'where':{}};var _0x1564b9={};var _0x3e5a94={'count':0x0,'rows':[]};return db['User'][_0x40d5('0x9e')]({'where':{'id':_0x20d7db[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x239432,null))[_0x40d5('0x2d')](function(_0x3bfbc7){if(_0x3bfbc7){_0x1564b9[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xf1')]['rawAttributes']);_0x1564b9['query']=_['keys'](_0x20d7db[_0x40d5('0x4b')]);_0x1564b9[_0x40d5('0x60')]=_[_0x40d5('0x62')](_0x1564b9['model'],_0x1564b9[_0x40d5('0x4b')]);_0xbb80a2[_0x40d5('0x51')]=_['intersection'](_0x1564b9[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x20d7db[_0x40d5('0x4b')][_0x40d5('0x63')]));_0xbb80a2[_0x40d5('0x51')]=_0xbb80a2['attributes'][_0x40d5('0x56')]?_0xbb80a2['attributes']:_0x1564b9[_0x40d5('0x61')];if(!_0x20d7db[_0x40d5('0x4b')][_0x40d5('0xd8')]('nolimit')){_0xbb80a2[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x20d7db[_0x40d5('0x4b')][_0x40d5('0x27')]);_0xbb80a2[_0x40d5('0x29')]=qs['offset'](_0x20d7db[_0x40d5('0x4b')][_0x40d5('0x29')]);}_0xbb80a2['order']=qs[_0x40d5('0xd6')](_0x20d7db[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0xbb80a2['where']=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x20d7db[_0x40d5('0x4b')],_0x1564b9['filters']));_0xbb80a2[_0x40d5('0x4a')][_0x40d5('0xea')]=_0x3bfbc7['id'];if(_0x20d7db[_0x40d5('0x4b')][_0x40d5('0x39')]){_0xbb80a2[_0x40d5('0x4a')]=_['merge'](_0xbb80a2[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0xbb80a2['attributes'],function(_0x4a92b3){var _0x57f6ca={};_0x57f6ca[_0x4a92b3]={'$like':'%'+_0x20d7db[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x57f6ca;})});}_0xbb80a2=_['merge']({},_0xbb80a2,_0x20d7db['options']);return db[_0x40d5('0xf1')]['count']({'where':_0xbb80a2[_0x40d5('0x4a')]})[_0x40d5('0x2d')](function(_0x4b3d14){_0x3e5a94['count']=_0x4b3d14;if(_0x20d7db['query'][_0x40d5('0x4c')]){_0xbb80a2[_0x40d5('0x4d')]=[{'all':!![]}];}return db['MailInteraction']['findAll'](_0xbb80a2);})[_0x40d5('0x2d')](function(_0x7a4d4e){_0x3e5a94[_0x40d5('0x54')]=_0x7a4d4e;return _0x3e5a94;});}})[_0x40d5('0x2d')](respondWithFilteredResult(_0x239432,_0xbb80a2))[_0x40d5('0x22')](handleError(_0x239432,null));};exports['getSmsInteractions']=function(_0x40d3d2,_0xc6b9f){var _0x5668e1={};var _0x51fc8f={};var _0x7a4586;var _0x591d7a;return db['User'][_0x40d5('0x9e')]({'where':{'id':_0x40d3d2[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0xc6b9f,null))[_0x40d5('0x2d')](function(_0x4f5b54){if(_0x4f5b54){_0x7a4586=_0x4f5b54;_0x51fc8f[_0x40d5('0x61')]=_['keys'](db[_0x40d5('0xf2')][_0x40d5('0x44')]);_0x51fc8f[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x40d3d2['query']);_0x51fc8f['filters']=_['intersection'](_0x51fc8f[_0x40d5('0x61')],_0x51fc8f[_0x40d5('0x4b')]);_0x5668e1[_0x40d5('0x51')]=_['intersection'](_0x51fc8f[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x40d3d2[_0x40d5('0x4b')]['fields']));_0x5668e1[_0x40d5('0x51')]=_0x5668e1['attributes'][_0x40d5('0x56')]?_0x5668e1[_0x40d5('0x51')]:_0x51fc8f[_0x40d5('0x61')];_0x5668e1[_0x40d5('0xd5')]=qs['sort'](_0x40d3d2[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0x5668e1[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x40d3d2[_0x40d5('0x4b')],_0x51fc8f[_0x40d5('0x60')]));if(_0x40d3d2['query'][_0x40d5('0x39')]){_0x5668e1[_0x40d5('0x4a')]=_['merge'](_0x5668e1[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x5668e1['attributes'],function(_0x1622e4){var _0x4e5aa9={};_0x4e5aa9[_0x1622e4]={'$like':'%'+_0x40d3d2[_0x40d5('0x4b')]['filter']+'%'};return _0x4e5aa9;})});}_0x5668e1=_[_0x40d5('0x64')]({},_0x5668e1,_0x40d3d2['options']);return _0x7a4586[_0x40d5('0xf3')](_0x5668e1);}})[_0x40d5('0x2d')](function(_0x380866){if(_0x380866){_0x591d7a=_0x380866[_0x40d5('0x56')];if(!_0x40d3d2['query']['hasOwnProperty'](_0x40d5('0xdf'))){_0x5668e1['limit']=qs[_0x40d5('0x27')](_0x40d3d2[_0x40d5('0x4b')][_0x40d5('0x27')]);_0x5668e1[_0x40d5('0x29')]=qs[_0x40d5('0x29')](_0x40d3d2['query'][_0x40d5('0x29')]);}return _0x7a4586[_0x40d5('0xf3')](_0x5668e1);}})['then'](function(_0x5437df){if(_0x5437df){return _0x5437df?{'count':_0x591d7a,'rows':_0x5437df}:null;}})[_0x40d5('0x2d')](respondWithResult(_0xc6b9f,null))[_0x40d5('0x22')](handleError(_0xc6b9f,null));};exports[_0x40d5('0xf4')]=function(_0x563796,_0x3f14a2){var _0xc8780f={};var _0x252682={};var _0x581700;var _0x4f59d2;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x563796[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x3f14a2,null))[_0x40d5('0x2d')](function(_0x60d78e){if(_0x60d78e){_0x581700=_0x60d78e;_0x252682[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xf5')][_0x40d5('0x44')]);_0x252682[_0x40d5('0x4b')]=_['keys'](_0x563796[_0x40d5('0x4b')]);_0x252682['filters']=_['intersection'](_0x252682['model'],_0x252682[_0x40d5('0x4b')]);_0xc8780f[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x252682[_0x40d5('0x61')],qs['fields'](_0x563796[_0x40d5('0x4b')][_0x40d5('0x63')]));_0xc8780f[_0x40d5('0x51')]=_0xc8780f[_0x40d5('0x51')][_0x40d5('0x56')]?_0xc8780f[_0x40d5('0x51')]:_0x252682[_0x40d5('0x61')];_0xc8780f[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x563796['query'][_0x40d5('0xd6')]);_0xc8780f[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_['pick'](_0x563796[_0x40d5('0x4b')],_0x252682[_0x40d5('0x60')]));if(_0x563796['query'][_0x40d5('0x39')]){_0xc8780f[_0x40d5('0x4a')]=_[_0x40d5('0x64')](_0xc8780f[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0xc8780f[_0x40d5('0x51')],function(_0x50b67){var _0x56d992={};_0x56d992[_0x50b67]={'$like':'%'+_0x563796[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x56d992;})});}_0xc8780f=_[_0x40d5('0x64')]({},_0xc8780f,_0x563796[_0x40d5('0xd7')]);return _0x581700[_0x40d5('0xf4')](_0xc8780f);}})[_0x40d5('0x2d')](function(_0x58f439){if(_0x58f439){_0x4f59d2=_0x58f439[_0x40d5('0x56')];if(!_0x563796[_0x40d5('0x4b')][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0xc8780f[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x563796[_0x40d5('0x4b')][_0x40d5('0x27')]);_0xc8780f[_0x40d5('0x29')]=qs['offset'](_0x563796[_0x40d5('0x4b')]['offset']);}return _0x581700[_0x40d5('0xf4')](_0xc8780f);}})[_0x40d5('0x2d')](function(_0x35f88b){if(_0x35f88b){return _0x35f88b?{'count':_0x4f59d2,'rows':_0x35f88b}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x3f14a2,null))[_0x40d5('0x22')](handleError(_0x3f14a2,null));};exports[_0x40d5('0xf6')]=function(_0x5667d4,_0x88f7e5){var _0x567b19={};var _0x4bd156={};var _0xf0d246;var _0x5be336;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x5667d4[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x88f7e5,null))[_0x40d5('0x2d')](function(_0x1dc634){if(_0x1dc634){_0xf0d246=_0x1dc634;_0x4bd156[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0xf7')][_0x40d5('0x44')]);_0x4bd156[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x5667d4[_0x40d5('0x4b')]);_0x4bd156['filters']=_[_0x40d5('0x62')](_0x4bd156['model'],_0x4bd156[_0x40d5('0x4b')]);_0x567b19[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x4bd156[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x5667d4[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x567b19[_0x40d5('0x51')]=_0x567b19[_0x40d5('0x51')][_0x40d5('0x56')]?_0x567b19[_0x40d5('0x51')]:_0x4bd156[_0x40d5('0x61')];_0x567b19['order']=qs[_0x40d5('0xd6')](_0x5667d4['query'][_0x40d5('0xd6')]);_0x567b19['where']=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x5667d4[_0x40d5('0x4b')],_0x4bd156[_0x40d5('0x60')]));if(_0x5667d4[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x567b19[_0x40d5('0x4a')]=_['merge'](_0x567b19[_0x40d5('0x4a')],{'$or':_['map'](_0x567b19['attributes'],function(_0x3fc675){var _0x2781dd={};_0x2781dd[_0x3fc675]={'$like':'%'+_0x5667d4[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x2781dd;})});}_0x567b19=_[_0x40d5('0x64')]({},_0x567b19,_0x5667d4['options']);return _0xf0d246[_0x40d5('0xf6')](_0x567b19);}})[_0x40d5('0x2d')](function(_0xa5af2b){if(_0xa5af2b){_0x5be336=_0xa5af2b['length'];if(!_0x5667d4[_0x40d5('0x4b')]['hasOwnProperty'](_0x40d5('0xdf'))){_0x567b19['limit']=qs[_0x40d5('0x27')](_0x5667d4['query'][_0x40d5('0x27')]);_0x567b19[_0x40d5('0x29')]=qs['offset'](_0x5667d4[_0x40d5('0x4b')][_0x40d5('0x29')]);}return _0xf0d246[_0x40d5('0xf6')](_0x567b19);}})[_0x40d5('0x2d')](function(_0x138137){if(_0x138137){return _0x138137?{'count':_0x5be336,'rows':_0x138137}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x88f7e5,null))[_0x40d5('0x22')](handleError(_0x88f7e5,null));};exports[_0x40d5('0xf8')]=function(_0x201c72,_0x1c13ec,_0x840b56){var _0x470407;var _0x28e717;var _0xaac49c;var _0x10d98c=!_['isNil'](_0x201c72['params']['id'])?_0x201c72[_0x40d5('0x5d')]['id']:!_[_0x40d5('0x6e')](_0x201c72[_0x40d5('0x34')]['id'])?_0x201c72[_0x40d5('0x34')]['id']:null;return db[_0x40d5('0x43')]['find']({'where':{'id':_0x10d98c,'role':{'$or':[_0x40d5('0x32'),_0x40d5('0x34'),'agent']}},'attributes':['id',_0x40d5('0x3e'),'phone',_0x40d5('0xf9'),'role','internal',_0x40d5('0xa6')]})[_0x40d5('0x2d')](function(_0x1972b8){if(_0x1972b8){if(_0x1972b8[_0x40d5('0x31')]===_0x40d5('0x36')){_0x470407=_0x1972b8;if(_0x201c72['body'][_0x40d5('0xa8')]){_0xaac49c=util[_0x40d5('0xb3')](_0x40d5('0xfa'),_0x470407[_0x201c72[_0x40d5('0x66')][_0x40d5('0xa8')]]);}else if(_0x201c72[_0x40d5('0x66')][_0x40d5('0xfb')]){_0xaac49c=util[_0x40d5('0xb3')](_0x40d5('0xfc'),_0x201c72[_0x40d5('0x66')][_0x40d5('0xfb')]);}else{_0xaac49c=util[_0x40d5('0xb3')]('SIP/%s',_0x470407[_0x40d5('0x3e')]);}socket['to'](util[_0x40d5('0xb3')]('user:%s',_0x470407[_0x40d5('0x3e')]))['emit'](_0x40d5('0xfd'),{'user':{'id':_0x470407['id'],'name':_0x470407[_0x40d5('0x3e')]},'ip':_0x201c72['headers'][_0x40d5('0xfe')]||_0x201c72[_0x40d5('0xff')][_0x40d5('0x100')]||_0x201c72['socket'][_0x40d5('0x100')]||_0x201c72[_0x40d5('0xff')]['socket'][_0x40d5('0x100')]});return db[_0x40d5('0xb4')]['destroy']({'where':{'membername':_0x470407[_0x40d5('0x3e')]},'individualHooks':!![]});}}else{throw new db[(_0x40d5('0x94'))][(_0x40d5('0x9a'))](_0x40d5('0x101'));}})[_0x40d5('0x2d')](function(){if(_0x470407){return _0x470407[_0x40d5('0x102')]({'raw':!![]});}})[_0x40d5('0x2d')](function(_0x149b61){if(_0x470407){if(_0x149b61){_0x28e717=_0x149b61;if(_0x28e717[_0x40d5('0x56')]){var _0x454746=_0x28e717[_0x40d5('0x3b')](function(_0x218676){var _0x47e656={'membername':_0x470407[_0x40d5('0x3e')],'UserId':_0x470407['id'],'queue_name':_0x218676[_0x40d5('0x3e')],'VoiceQueueId':_0x218676['id'],'interface':_0xaac49c,'paused':_0x470407[_0x40d5('0xa6')]||![],'penalty':_0x218676[_0x40d5('0x103')]||0x0};return db[_0x40d5('0xb4')][_0x40d5('0xb5')](_0x47e656);});return Promise[_0x40d5('0x5b')](_0x454746);}}}})[_0x40d5('0x2d')](function(){if(_0x470407){return db[_0x40d5('0x104')]['findAll']({'where':{'membername':_0x470407[_0x40d5('0x3e')],'exitAt':null}});}})[_0x40d5('0x2d')](function(_0x43d3c3){if(_0x470407){var _0x40bfcc=[];_0x43d3c3[_0x40d5('0x105')](function(_0x2a5e0c){_0x40bfcc['push'](_0x2a5e0c[_0x40d5('0x2c')]({'exitAt':moment()[_0x40d5('0xb3')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x40d5('0x5b')](_0x40bfcc);}})[_0x40d5('0x2d')](function(){if(_0x470407){var _0x247291=[];var _0x469139=[];var _0x543dd6=utils[_0x40d5('0x106')]();var _0x54ecb2={'membername':_0x470407[_0x40d5('0x3e')],'interface':_0xaac49c,'enterAt':moment()[_0x40d5('0xb3')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x470407['role'],'internal':_0x470407[_0x40d5('0x6a')]};_0x543dd6[_0x40d5('0x105')](function(_0x5e402f){_0x247291['push'](_[_0x40d5('0x64')]({'channel':_0x5e402f,'type':_0x40d5('0x107'),'data1':_0x201c72['body'][_0x40d5('0x108')],'data2':_0xaac49c},_0x54ecb2));if(_0x470407[_0x40d5('0xa6')]){_0x469139[_0x40d5('0x52')](_[_0x40d5('0x64')]({'channel':_0x5e402f,'type':_0x40d5('0x109'),'data1':_0x40d5('0x10a')},_0x54ecb2));}});return db['MemberReport'][_0x40d5('0x8d')](_0x247291['concat'](_0x469139),{'individualHooks':!![]});}})[_0x40d5('0x2d')](function(){if(_0x470407){return _0x470407['update']({'online':!![],'lastLoginAt':moment()[_0x40d5('0xb3')](_0x40d5('0x10b')),'voicePause':_0x470407[_0x40d5('0xa6')]||![],'mailPause':_0x470407[_0x40d5('0xa6')]||![],'chatPause':_0x470407[_0x40d5('0xa6')]||![],'faxPause':_0x470407[_0x40d5('0xa6')]||![],'smsPause':_0x470407[_0x40d5('0xa6')]||![],'openchannelPause':_0x470407[_0x40d5('0xa6')]||![],'whatsappPause':_0x470407['loginInPause']||![],'pauseType':_0x470407[_0x40d5('0xa6')]?_0x40d5('0x10a'):null,'interface':_0xaac49c,'lastPauseAt':moment()[_0x40d5('0xb3')](_0x40d5('0x10b'))});}})[_0x40d5('0x2d')](function(_0x3b588f){if(_0x201c72[_0x40d5('0x10c')]){return _0x840b56();}else{return Promise[_0x40d5('0x10d')](_0x3b588f)[_0x40d5('0x2d')](respondWithResult(_0x1c13ec,null));}})[_0x40d5('0x22')](handleError(_0x1c13ec,null));};exports[_0x40d5('0x10e')]=function(_0x13794c,_0x1afb60){var _0x247f99;return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x13794c[_0x40d5('0x5d')]['id'],'role':_0x40d5('0x36')},'attributes':['id',_0x40d5('0x3e'),_0x40d5('0x31')]})[_0x40d5('0x2d')](handleEntityNotFound(_0x1afb60,null))[_0x40d5('0x2d')](function(_0x44bb73){if(_0x44bb73){_0x247f99=_0x44bb73;return db[_0x40d5('0xb4')][_0x40d5('0x3f')]({'where':{'membername':_0x247f99[_0x40d5('0x3e')]},'individualHooks':!![]});}})['then'](function(){return db[_0x40d5('0x104')][_0x40d5('0x53')]({'where':{'membername':_0x247f99[_0x40d5('0x3e')],'exitAt':null}});})['then'](function(_0x4cf9fa){var _0x5e118f=[];_0x4cf9fa['forEach'](function(_0x2bcdff){_0x5e118f[_0x40d5('0x52')](_0x2bcdff[_0x40d5('0x2c')]({'exitAt':moment()['format'](_0x40d5('0x10b'))}));});return Promise['all'](_0x5e118f);})[_0x40d5('0x2d')](function(){return _0x247f99['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x40d5('0x2d')](respondWithResult(_0x1afb60,null))['catch'](handleError(_0x1afb60,null));};exports['pause']=function(_0x46fad0,_0x14f79c){var _0x101565;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x46fad0[_0x40d5('0x5d')]['id']},'individualHooks':!![]})[_0x40d5('0x2d')](function(){return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x46fad0[_0x40d5('0x5d')]['id'],'role':_0x40d5('0x36')},'attributes':['id',_0x40d5('0x3e'),_0x40d5('0x31'),_0x40d5('0x6a'),_0x40d5('0xa8'),_0x40d5('0x10f')]});})['then'](handleEntityNotFound(_0x14f79c,null))['then'](function(_0x1d6aaf){if(_0x1d6aaf){_0x101565=_0x1d6aaf;return respondWithRpcPromise(_0x40d5('0x110'),_0x40d5('0x111'),{'id':_0x101565['id'],'name':_0x101565['name'],'pause':!![]});}})[_0x40d5('0x2d')](function(){if(_0x101565){return db[_0x40d5('0x104')][_0x40d5('0x53')]({'where':{'membername':_0x101565[_0x40d5('0x3e')],'type':_0x40d5('0x109'),'exitAt':null}});}})[_0x40d5('0x2d')](function(_0x1d5f72){if(_0x1d5f72[_0x40d5('0x56')]){var _0x5bfbcb=moment()[_0x40d5('0xb3')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3a806d=0x0,_0x1b0426=_0x1d5f72['length'];_0x3a806d<_0x1b0426;_0x3a806d++){_0x1d5f72[_0x3a806d]['updateAttributes']({'exitAt':_0x5bfbcb});}}})[_0x40d5('0x2d')](function(){var _0x1cf81d=[];var _0x330604=utils[_0x40d5('0x106')]();_0x330604['forEach'](function(_0x33ebfe){_0x1cf81d[_0x40d5('0x52')]({'channel':_0x33ebfe,'membername':_0x101565['name'],'interface':_[_0x40d5('0x6e')](_0x101565[_0x40d5('0xa8')])?util[_0x40d5('0xb3')](_0x40d5('0xfc'),_0x101565['name']):_0x101565['interface'],'type':_0x40d5('0x109'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x46fad0[_0x40d5('0x66')][_0x40d5('0x46')]||_0x40d5('0x112'),'role':_0x101565['role'],'internal':_0x101565['internal']});});return db['MemberReport']['bulkCreate'](_0x1cf81d,{'individualHooks':!![]});})[_0x40d5('0x2d')](function(){return _0x101565[_0x40d5('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x46fad0[_0x40d5('0x66')][_0x40d5('0x46')]||_0x40d5('0x112'),'lastPauseAt':moment()[_0x40d5('0xb3')](_0x40d5('0x10b'))});})[_0x40d5('0x2d')](respondWithResult(_0x14f79c,null))[_0x40d5('0x22')](handleError(_0x14f79c,null));};exports['unpause']=function(_0x26f9f5,_0xf4b01){if(_0x26f9f5[_0x40d5('0x66')][_0x40d5('0xa5')]&&!utils[_0x40d5('0xa9')](_0x26f9f5[_0x40d5('0x66')]['channel'])){throw new APIBadRequestError(util[_0x40d5('0xb3')](_0x40d5('0x113'),_0x26f9f5['body'][_0x40d5('0xa5')]));}return db[_0x40d5('0x43')][_0x40d5('0x3d')]({'where':{'id':_0x26f9f5[_0x40d5('0x5d')]['id']},'attributes':['id',_0x40d5('0x3e'),'role','internal',_0x40d5('0xa8'),'online','voicePause','mailPause',_0x40d5('0x114'),_0x40d5('0x115'),_0x40d5('0x116'),'smsPause',_0x40d5('0x117'),_0x40d5('0x118'),_0x40d5('0x119')]})[_0x40d5('0x2d')](function(_0x499829){if(!_0x499829){throw new APINotFoundError(util[_0x40d5('0xb3')]('User\x20with\x20id\x20%s\x20not\x20found',_0x26f9f5[_0x40d5('0x5d')]['id']));}return _0x499829[_0x40d5('0x11a')](_0x26f9f5[_0x40d5('0x66')][_0x40d5('0xa5')]);})[_0x40d5('0x2d')](respondWithResult(_0xf4b01,null))['catch'](APIHandleError(_0xf4b01));};exports['getTeams']=function(_0x14f9fc,_0x144627){var _0x3c105d={};var _0x533bcf={};var _0x768f3e;var _0x5e0bc6;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x14f9fc['params']['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x144627,null))[_0x40d5('0x2d')](function(_0x13dd71){if(_0x13dd71){_0x768f3e=_0x13dd71;_0x533bcf[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db[_0x40d5('0x11b')][_0x40d5('0x44')]);_0x533bcf[_0x40d5('0x4b')]=_['keys'](_0x14f9fc[_0x40d5('0x4b')]);_0x533bcf[_0x40d5('0x60')]=_['intersection'](_0x533bcf[_0x40d5('0x61')],_0x533bcf[_0x40d5('0x4b')]);_0x3c105d['attributes']=_[_0x40d5('0x62')](_0x533bcf[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x14f9fc['query'][_0x40d5('0x63')]));_0x3c105d[_0x40d5('0x51')]=_0x3c105d['attributes']['length']?_0x3c105d[_0x40d5('0x51')]:_0x533bcf[_0x40d5('0x61')];_0x3c105d[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x14f9fc[_0x40d5('0x4b')]['sort']);_0x3c105d[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x14f9fc['query'],_0x533bcf[_0x40d5('0x60')]));if(_0x14f9fc[_0x40d5('0x4b')]['filter']){_0x3c105d['where']=_[_0x40d5('0x64')](_0x3c105d[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x3c105d['attributes'],function(_0x522d32){var _0x272e44={};_0x272e44[_0x522d32]={'$like':'%'+_0x14f9fc['query'][_0x40d5('0x39')]+'%'};return _0x272e44;})});}_0x3c105d=_['merge']({},_0x3c105d,_0x14f9fc[_0x40d5('0xd7')]);return _0x768f3e['getTeams'](_0x3c105d);}})['then'](function(_0x4fb22e){if(_0x4fb22e){_0x5e0bc6=_0x4fb22e[_0x40d5('0x56')];if(!_0x14f9fc['query'][_0x40d5('0xd8')](_0x40d5('0xdf'))){_0x3c105d[_0x40d5('0x27')]=qs[_0x40d5('0x27')](_0x14f9fc['query'][_0x40d5('0x27')]);_0x3c105d[_0x40d5('0x29')]=qs['offset'](_0x14f9fc['query'][_0x40d5('0x29')]);}return _0x768f3e[_0x40d5('0x11c')](_0x3c105d);}})[_0x40d5('0x2d')](function(_0x5b0f58){if(_0x5b0f58){return _0x5b0f58?{'count':_0x5e0bc6,'rows':_0x5b0f58}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x144627,null))[_0x40d5('0x22')](handleError(_0x144627,null));};exports[_0x40d5('0x11d')]=function(_0x1d584a,_0x2bf8ba){var _0x58fe3f=_0x1d584a[_0x40d5('0x5d')]['id'];var _0x385814=_0x1d584a[_0x40d5('0x66')]?_0x1d584a[_0x40d5('0x66')]['ids']:null;var _0xd12062=[];return Promise[_0x40d5('0x10d')]()[_0x40d5('0x2d')](function(){if(!_0x385814)throw new APIBadRequestError(_0x40d5('0x11e'));})[_0x40d5('0x2d')](function(){return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x58fe3f}});})[_0x40d5('0x2d')](function(_0xb0c62d){if(!_0xb0c62d)throw new APINotFoundError(util[_0x40d5('0xb3')](_0x40d5('0x11f'),_0x1d584a[_0x40d5('0x5d')]['id']));return db[_0x40d5('0x70')][_0x40d5('0x120')](function(_0x3528e6){return _0xb0c62d[_0x40d5('0x11d')](_0x385814,{'transaction':_0x3528e6})['then'](function(){return db[_0x40d5('0x11b')]['findAll']({'where':{'id':{'$in':_0x385814}}});})[_0x40d5('0x2d')](function(_0x2befc6){var _0x1185a0=_['map'](_0x2befc6,function(_0x48a257){return _0x48a257[_0x40d5('0x121')]();});return Promise[_0x40d5('0x5b')](_0x1185a0);})[_0x40d5('0x2d')](function(_0x562856){_0xd12062=_[_0x40d5('0x122')](_0x562856);var _0x1f8de3=_[_0x40d5('0x3b')](_0xd12062,function(_0x34e14b){return _0x34e14b['addAgent'](_0xb0c62d['id'],{'transaction':_0x3528e6});});return Promise[_0x40d5('0x5b')](_0x1f8de3);})['then'](function(){if(!_0xb0c62d[_0x40d5('0x10f')])return;var _0x301fec=_[_0x40d5('0x39')](_0xd12062,function(_0x25646b){return _0x25646b[_0x40d5('0x123')](_0x40d5('0xa5'))===_0x40d5('0x124');});var _0x37cd3c=_[_0x40d5('0x3b')](_0x301fec,function(_0x5cca19){return db[_0x40d5('0xb4')][_0x40d5('0xb5')]({'membername':_0xb0c62d[_0x40d5('0x3e')],'UserId':_0xb0c62d['id'],'queue_name':_0x5cca19[_0x40d5('0x3e')],'VoiceQueueId':_0x5cca19['id'],'interface':_[_0x40d5('0x6e')](_0xb0c62d[_0x40d5('0xa8')])?util[_0x40d5('0xb3')]('SIP/%s',_0xb0c62d[_0x40d5('0x3e')]):_0xb0c62d['interface'],'paused':_0xb0c62d[_0x40d5('0xa7')]||![],'penalty':_0xb0c62d[_0x40d5('0xad')]},{'transaction':_0x3528e6});});return Promise[_0x40d5('0x5b')](_0x37cd3c);})['then'](function(){return db[_0x40d5('0x125')][_0x40d5('0x53')]({'where':{'teamId':{'$in':_0x385814}}});})['then'](function(_0x4536ad){var _0x426ea7=_[_0x40d5('0x3b')](_0x4536ad,function(_0x5836de){return db[_0x40d5('0x126')][_0x40d5('0x85')]({'UserId':_0xb0c62d['id'],'VoicePrefixId':_0x5836de[_0x40d5('0x127')]},{'transaction':_0x3528e6});});return Promise['all'](_0x426ea7);});});})[_0x40d5('0x2d')](function(){for(var _0x321bf9=0x0;_0x321bf9<_0xd12062[_0x40d5('0x56')];_0x321bf9++){var _0x40e0eb=_0xd12062[_0x321bf9][_0x40d5('0x123')](_0x40d5('0xa5'));var _0xc6a2b=_0x40e0eb+_0x40d5('0xaf');socket[_0x40d5('0x2e')](_0x40d5('0x34')+_0x40e0eb+_0x40d5('0xb0'),{'UserId':_0x58fe3f,['queueField']:_0xd12062[_0x321bf9]['id']});}})[_0x40d5('0x2d')](respondWithStatusCode(_0x2bf8ba,null))['catch'](APIHandleError(_0x2bf8ba));};exports[_0x40d5('0x128')]=function(_0x16d8e2,_0x50c30c){var _0x163ff6=_0x16d8e2[_0x40d5('0x5d')]['id'];var _0x152831=null;if(_0x16d8e2['query'][_0x40d5('0x68')]){_0x152831=_[_0x40d5('0xb8')](_0x16d8e2[_0x40d5('0x4b')][_0x40d5('0x68')])?_0x16d8e2[_0x40d5('0x4b')]['ids']:[_0x16d8e2['query'][_0x40d5('0x68')]];}var _0xf2b5e0=[];return Promise['resolve']()['then'](function(){if(!_0x152831)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db['User'][_0x40d5('0x9e')]({'where':{'id':_0x163ff6}});})[_0x40d5('0x2d')](function(_0x51d86d){if(!_0x51d86d)throw new APINotFoundError(util[_0x40d5('0xb3')]('User\x20with\x20id\x20%s\x20not\x20found',_0x16d8e2[_0x40d5('0x5d')]['id']));return db[_0x40d5('0x70')][_0x40d5('0x120')](function(_0x175b23){return _0x51d86d['removeTeams'](_0x152831,{'transaction':_0x175b23})[_0x40d5('0x2d')](function(){return db[_0x40d5('0x11b')][_0x40d5('0x53')]({'where':{'id':{'$in':_0x152831}}});})[_0x40d5('0x2d')](function(_0x462cc2){var _0x4f3f5e=_[_0x40d5('0x3b')](_0x462cc2,function(_0x5281bc){return _0x5281bc[_0x40d5('0x121')]();});return Promise['all'](_0x4f3f5e);})[_0x40d5('0x2d')](function(_0x5b546d){_0xf2b5e0=_[_0x40d5('0x122')](_0x5b546d);var _0x3ca5ff=_[_0x40d5('0x3b')](_0xf2b5e0,function(_0x397aa6){return _0x397aa6['removeAgent'](_0x51d86d['id'],{'transaction':_0x175b23});});return Promise[_0x40d5('0x5b')](_0x3ca5ff);})[_0x40d5('0x2d')](function(){if(!_0x51d86d['online'])return;var _0x4a5e09=_[_0x40d5('0x39')](_0xf2b5e0,function(_0x4c9b92){return _0x4c9b92[_0x40d5('0x123')](_0x40d5('0xa5'))===_0x40d5('0x124');});var _0x1aa786=_[_0x40d5('0x3b')](_0x4a5e09,function(_0x353d02){return db[_0x40d5('0xb4')]['destroy']({'where':{'VoiceQueueId':_0x353d02['id'],'UserId':_0x51d86d['id']},'transaction':_0x175b23});});return Promise['all'](_0x1aa786);})['then'](function(){return db[_0x40d5('0x125')][_0x40d5('0x53')]({'where':{'teamId':{'$in':_0x152831}}});})['then'](function(_0x5bc351){var _0x1584de=_[_0x40d5('0x3b')](_0x5bc351,function(_0x294a4f){return db[_0x40d5('0x126')][_0x40d5('0x3f')]({'where':{'UserId':_0x51d86d['id'],'VoicePrefixId':_0x294a4f['VoicePrefixId']}},{'transaction':_0x175b23});});return Promise[_0x40d5('0x5b')](_0x1584de);});});})[_0x40d5('0x2d')](function(){for(var _0x4cd22b=0x0;_0x4cd22b<_0xf2b5e0[_0x40d5('0x56')];_0x4cd22b++){var _0x56af2f=_0xf2b5e0[_0x4cd22b][_0x40d5('0x123')](_0x40d5('0xa5'));var _0x524e8f=_0x56af2f+_0x40d5('0xaf');socket[_0x40d5('0x2e')](_0x40d5('0x34')+_0x56af2f+'Queue:remove',{'UserId':_0x163ff6,['queueField']:_0xf2b5e0[_0x4cd22b]['id']});}})[_0x40d5('0x2d')](respondWithStatusCode(_0x50c30c,null))[_0x40d5('0x22')](APIHandleError(_0x50c30c));};exports[_0x40d5('0x129')]=function(_0x2a1bcc,_0x4bce87){var _0xfe3930={};var _0x3d305d={};var _0x3e77a9;var _0x4f9d75;return db[_0x40d5('0x43')]['findOne']({'where':{'id':_0x2a1bcc[_0x40d5('0x5d')]['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x4bce87,null))[_0x40d5('0x2d')](function(_0x1a5faf){if(_0x1a5faf){_0x3e77a9=_0x1a5faf;_0x3d305d[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db['CmList'][_0x40d5('0x44')]);_0x3d305d[_0x40d5('0x4b')]=_[_0x40d5('0x5e')](_0x2a1bcc[_0x40d5('0x4b')]);_0x3d305d['filters']=_[_0x40d5('0x62')](_0x3d305d[_0x40d5('0x61')],_0x3d305d[_0x40d5('0x4b')]);_0xfe3930[_0x40d5('0x51')]=_['intersection'](_0x3d305d['model'],qs['fields'](_0x2a1bcc[_0x40d5('0x4b')][_0x40d5('0x63')]));_0xfe3930['attributes']=_0xfe3930[_0x40d5('0x51')]['length']?_0xfe3930[_0x40d5('0x51')]:_0x3d305d[_0x40d5('0x61')];_0xfe3930[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x2a1bcc[_0x40d5('0x4b')][_0x40d5('0xd6')]);_0xfe3930[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x2a1bcc[_0x40d5('0x4b')],_0x3d305d[_0x40d5('0x60')]));if(_0x2a1bcc[_0x40d5('0x4b')][_0x40d5('0x39')]){_0xfe3930['where']=_[_0x40d5('0x64')](_0xfe3930[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0xfe3930[_0x40d5('0x51')],function(_0xbe5b7c){var _0x341c89={};_0x341c89[_0xbe5b7c]={'$like':'%'+_0x2a1bcc['query'][_0x40d5('0x39')]+'%'};return _0x341c89;})});}_0xfe3930=_['merge']({},_0xfe3930,_0x2a1bcc[_0x40d5('0xd7')]);return _0x3e77a9[_0x40d5('0x129')](_0xfe3930);}})[_0x40d5('0x2d')](function(_0x1773b1){if(_0x1773b1){_0x4f9d75=_0x1773b1[_0x40d5('0x56')];if(!_0x2a1bcc[_0x40d5('0x4b')]['hasOwnProperty'](_0x40d5('0xdf'))){_0xfe3930[_0x40d5('0x27')]=qs['limit'](_0x2a1bcc[_0x40d5('0x4b')]['limit']);_0xfe3930['offset']=qs[_0x40d5('0x29')](_0x2a1bcc[_0x40d5('0x4b')][_0x40d5('0x29')]);}return _0x3e77a9['getLists'](_0xfe3930);}})[_0x40d5('0x2d')](function(_0x45c6f3){if(_0x45c6f3){return _0x45c6f3?{'count':_0x4f9d75,'rows':_0x45c6f3}:null;}})[_0x40d5('0x2d')](respondWithResult(_0x4bce87,null))[_0x40d5('0x22')](handleError(_0x4bce87,null));};exports['getAgents']=function(_0x244670,_0x2e2ccf){var _0x43f2e6={};var _0x265260={};var _0x5be291;return db[_0x40d5('0x43')][_0x40d5('0x9e')]({'where':{'id':_0x244670['params']['id']}})[_0x40d5('0x2d')](handleEntityNotFound(_0x2e2ccf,null))['then'](function(_0x37a317){if(_0x37a317){_0x5be291=_0x37a317;_0x265260[_0x40d5('0x61')]=_[_0x40d5('0x5e')](db['User'][_0x40d5('0x44')]);_0x265260['query']=_[_0x40d5('0x5e')](_0x244670[_0x40d5('0x4b')]);_0x265260[_0x40d5('0x60')]=_[_0x40d5('0x62')](_0x265260[_0x40d5('0x61')],_0x265260['query']);_0x43f2e6[_0x40d5('0x51')]=_[_0x40d5('0x62')](_0x265260[_0x40d5('0x61')],qs[_0x40d5('0x63')](_0x244670[_0x40d5('0x4b')][_0x40d5('0x63')]));_0x43f2e6[_0x40d5('0x51')]=_0x43f2e6[_0x40d5('0x51')][_0x40d5('0x56')]?_0x43f2e6[_0x40d5('0x51')]:_0x265260[_0x40d5('0x61')];_0x43f2e6[_0x40d5('0xd5')]=qs[_0x40d5('0xd6')](_0x244670[_0x40d5('0x4b')]['sort']);_0x43f2e6[_0x40d5('0x4a')]=qs[_0x40d5('0x60')](_[_0x40d5('0xe1')](_0x244670[_0x40d5('0x4b')],_0x265260[_0x40d5('0x60')]));if(_0x244670[_0x40d5('0x4b')][_0x40d5('0x39')]){_0x43f2e6[_0x40d5('0x4a')]=_[_0x40d5('0x64')](_0x43f2e6[_0x40d5('0x4a')],{'$or':_[_0x40d5('0x3b')](_0x43f2e6[_0x40d5('0x51')],function(_0x43ca69){var _0x5c09de={};_0x5c09de[_0x43ca69]={'$like':'%'+_0x244670[_0x40d5('0x4b')][_0x40d5('0x39')]+'%'};return _0x5c09de;})});}_0x43f2e6['model']=db[_0x40d5('0x43')];_0x43f2e6['as']='Agents';_0x43f2e6=_[_0x40d5('0x64')]({},_0x43f2e6,_0x244670[_0x40d5('0xd7')]);return _0x5be291[_0x40d5('0x102')]({'include':[_0x43f2e6]});}})[_0x40d5('0x2d')](function(_0x182b66){if(_0x182b66){var _0x3a1e58={},_0x4cc1da=[];for(var _0x2f2a5e=0x0;_0x2f2a5e<_0x182b66[_0x40d5('0x56')];_0x2f2a5e+=0x1){for(var _0xb3a1a1=0x0,_0x308238;_0xb3a1a1<_0x182b66[_0x2f2a5e][_0x40d5('0x35')][_0x40d5('0x56')];_0xb3a1a1+=0x1){_0x308238=_0x182b66[_0x2f2a5e][_0x40d5('0x35')][_0xb3a1a1][_0x40d5('0x30')]({'plain':!![]});_0x3a1e58[_0x308238['id']]=_0x308238;}}_0x3a1e58=_['values'](_0x3a1e58);for(var _0x523a3c=qs[_0x40d5('0x29')](_0x244670[_0x40d5('0x4b')][_0x40d5('0x29')]);_0x523a3c<_0x3a1e58[_0x40d5('0x56')]&&_0x4cc1da[_0x40d5('0x56')]=_0x2dd163[_0x96eb('0x4d')]){throw new Error(_0x96eb('0x4e'));}})['then'](function(){if(_0x2fda0c){return db['UserVoiceQueueRt'][_0x96eb('0x44')]({'where':{'membername':_0x2fda0c[_0x96eb('0x25')]},'individualHooks':!![]});}})[_0x96eb('0x15')](function(){if(_0x2fda0c){return _0x2fda0c[_0x96eb('0x4f')]({'raw':!![]});}})[_0x96eb('0x15')](function(_0x7e59db){if(_0x2fda0c){if(_0x7e59db){var _0x128c0d=[];_0x1fdc36=_0x7e59db;if(_0x1fdc36[_0x96eb('0x26')]){for(var _0x673608=0x0;_0x673608<_0x1fdc36[_0x96eb('0x26')];_0x673608++){_0x128c0d[_0x96eb('0x2a')](db[_0x96eb('0x22')][_0x96eb('0x50')]({'membername':_0x2fda0c[_0x96eb('0x25')],'UserId':_0x2fda0c['id'],'queue_name':_0x1fdc36[_0x673608][_0x96eb('0x25')],'VoiceQueueId':_0x1fdc36[_0x673608]['id'],'interface':_0x529927,'paused':_0x2fda0c[_0x96eb('0x49')]||![],'penalty':_0x1fdc36[_0x673608][_0x96eb('0x51')]||0x0}));}return BPromise[_0x96eb('0x46')](_0x128c0d);}}}})[_0x96eb('0x15')](function(){if(_0x2fda0c){return db['MemberReport'][_0x96eb('0xd')]({'where':{'membername':_0x2fda0c[_0x96eb('0x25')],'exitAt':null}});}})[_0x96eb('0x15')](function(_0x1fb9b9){if(_0x2fda0c){if(_0x1fb9b9&&_0x1fb9b9[_0x96eb('0x26')]){var _0x181c20=[];_0x1fb9b9[_0x96eb('0x45')](function(_0xb9c023){_0x181c20[_0x96eb('0x2a')](_0xb9c023[_0x96eb('0x23')]({'exitAt':moment()[_0x96eb('0x27')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x96eb('0x46')](_0x181c20);}}})[_0x96eb('0x15')](function(){if(_0x2fda0c){var _0x3e5e10=[];var _0x35f4f5=[];var _0x341df5=utils[_0x96eb('0x29')]();var _0xbfe885={'membername':_0x2fda0c['name'],'interface':_0x529927,'enterAt':moment()[_0x96eb('0x27')](_0x96eb('0x2d')),'role':_0x2fda0c[_0x96eb('0x1f')],'internal':_0x2fda0c[_0x96eb('0x20')]};_0x341df5['forEach'](function(_0x4a40dc){_0x3e5e10[_0x96eb('0x2a')](_['merge']({'channel':_0x4a40dc,'type':_0x96eb('0x52'),'data1':_0x96eb('0x53'),'data2':_0x529927},_0xbfe885));if(_0x2fda0c[_0x96eb('0x49')]){_0x35f4f5[_0x96eb('0x2a')](_[_0x96eb('0x54')]({'channel':_0x4a40dc,'type':_0x96eb('0x2c'),'data1':_0x96eb('0x55')},_0xbfe885));}});return db[_0x96eb('0x24')][_0x96eb('0x32')](_0x3e5e10['concat'](_0x35f4f5),{'individualHooks':!![]});}})[_0x96eb('0x15')](function(){if(_0x2fda0c){return _0x2fda0c[_0x96eb('0x23')]({'online':!![],'lastLoginAt':moment()[_0x96eb('0x27')](_0x96eb('0x2d')),'voicePause':_0x2fda0c[_0x96eb('0x49')]||![],'mailPause':_0x2fda0c[_0x96eb('0x49')]||![],'chatPause':_0x2fda0c['loginInPause']||![],'faxPause':_0x2fda0c[_0x96eb('0x49')]||![],'smsPause':_0x2fda0c['loginInPause']||![],'openchannelPause':_0x2fda0c[_0x96eb('0x49')]||![],'pauseType':_0x2fda0c['loginInPause']?_0x96eb('0x55'):null,'lastPauseAt':moment()['format'](_0x96eb('0x2d')),'interface':_0x529927});}})['then'](function(_0x119f41){_0x37ceab(_0x119f41);})[_0x96eb('0x1c')](function(_0x55918f){_0x5c8427(_0x5d9f55['error'](0x1f4,_0x55918f[_0x96eb('0x19')]));});});}; \ No newline at end of file +var _0xdb7b=['unpause','system','LogoutUser','all','LoginUser','mobile','phone','count','agent','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','redis','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','where','attributes','limit','map','include','model','then','info','debug','catch','error','message','ShowUser','find','raw','role','UserVoiceQueueRt','update','MemberReport','name','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','interface','format','SIP/%s','type','internal','uniqueid','bulkCreate','UnpauseUser','body','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params'];(function(_0x1198a4,_0x9d3926){var _0x4041e2=function(_0x49a0cc){while(--_0x49a0cc){_0x1198a4['push'](_0x1198a4['shift']());}};_0x4041e2(++_0x9d3926);}(_0xdb7b,0x11a));var _0xbdb7=function(_0x22fa5a,_0x278029){_0x22fa5a=_0x22fa5a-0x0;var _0x136d55=_0xdb7b[_0x22fa5a];return _0x136d55;};'use strict';var _=require(_0xbdb7('0x0'));var util=require(_0xbdb7('0x1'));var moment=require(_0xbdb7('0x2'));var BPromise=require('bluebird');var Redis=require(_0xbdb7('0x3'));var db=require(_0xbdb7('0x4'))['db'];var utils=require(_0xbdb7('0x5'));var logger=require('../../config/logger')(_0xbdb7('0x6'));var config=require('../../config/environment');config[_0xbdb7('0x7')]=_['defaults'](config[_0xbdb7('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xbdb7('0x8'))(new Redis(config[_0xbdb7('0x7')]));require(_0xbdb7('0x9'))[_0xbdb7('0xa')](socket);exports[_0xbdb7('0xb')]=function(_0x57ff7c){var _0x5e8f4d=this;return new Promise(function(_0x54aca6,_0x247915){return db[_0xbdb7('0xc')][_0xbdb7('0xd')]({'raw':_0x57ff7c[_0xbdb7('0xe')]?_0x57ff7c[_0xbdb7('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x57ff7c[_0xbdb7('0xe')]?_0x57ff7c['options'][_0xbdb7('0xf')]||null:null,'attributes':_0x57ff7c['options']?_0x57ff7c[_0xbdb7('0xe')][_0xbdb7('0x10')]||null:null,'limit':_0x57ff7c[_0xbdb7('0xe')]?_0x57ff7c[_0xbdb7('0xe')][_0xbdb7('0x11')]||null:null,'include':_0x57ff7c[_0xbdb7('0xe')]?_0x57ff7c[_0xbdb7('0xe')]['include']?_[_0xbdb7('0x12')](_0x57ff7c[_0xbdb7('0xe')][_0xbdb7('0x13')],function(_0x52e6a4){return{'model':db[_0x52e6a4[_0xbdb7('0x14')]],'as':_0x52e6a4['as'],'attributes':_0x52e6a4[_0xbdb7('0x10')],'include':_0x52e6a4[_0xbdb7('0x13')]?_[_0xbdb7('0x12')](_0x52e6a4[_0xbdb7('0x13')],function(_0x1cf06d){return{'model':db[_0x1cf06d[_0xbdb7('0x14')]],'as':_0x1cf06d['as'],'attributes':_0x1cf06d[_0xbdb7('0x10')],'include':_0x1cf06d[_0xbdb7('0x13')]?_[_0xbdb7('0x12')](_0x1cf06d[_0xbdb7('0x13')],function(_0x22b9d7){return{'model':db[_0x22b9d7[_0xbdb7('0x14')]],'as':_0x22b9d7['as'],'attributes':_0x22b9d7[_0xbdb7('0x10')]};}):[]};}):[]};}):[]:[]})[_0xbdb7('0x15')](function(_0x425570){logger[_0xbdb7('0x16')](_0xbdb7('0xb'),_0x57ff7c);logger[_0xbdb7('0x17')]('GetUser',_0x57ff7c,JSON['stringify'](_0x425570));_0x54aca6(_0x425570);})[_0xbdb7('0x18')](function(_0x3a2e5a){logger[_0xbdb7('0x19')](_0xbdb7('0xb'),_0x3a2e5a[_0xbdb7('0x1a')],_0x57ff7c);_0x247915(_0x5e8f4d[_0xbdb7('0x19')](0x1f4,_0x3a2e5a['message']));});});};exports[_0xbdb7('0x1b')]=function(_0x39490a){var _0x498358=this;return new Promise(function(_0x24fde4,_0x7f7ea2){return db['User'][_0xbdb7('0x1c')]({'raw':_0x39490a[_0xbdb7('0xe')]?_0x39490a[_0xbdb7('0xe')][_0xbdb7('0x1d')]===undefined?!![]:![]:!![],'where':_0x39490a[_0xbdb7('0xe')]?_0x39490a['options'][_0xbdb7('0xf')]||null:null,'attributes':_0x39490a[_0xbdb7('0xe')]?_0x39490a[_0xbdb7('0xe')][_0xbdb7('0x10')]||null:null,'include':_0x39490a[_0xbdb7('0xe')]?_0x39490a[_0xbdb7('0xe')]['include']?_['map'](_0x39490a[_0xbdb7('0xe')][_0xbdb7('0x13')],function(_0x4f3cb3){return{'model':db[_0x4f3cb3['model']],'as':_0x4f3cb3['as'],'attributes':_0x4f3cb3[_0xbdb7('0x10')],'include':_0x4f3cb3[_0xbdb7('0x13')]?_[_0xbdb7('0x12')](_0x4f3cb3['include'],function(_0x2095fb){return{'model':db[_0x2095fb[_0xbdb7('0x14')]],'as':_0x2095fb['as'],'attributes':_0x2095fb[_0xbdb7('0x10')],'include':_0x2095fb[_0xbdb7('0x13')]?_[_0xbdb7('0x12')](_0x2095fb[_0xbdb7('0x13')],function(_0x38311f){return{'model':db[_0x38311f[_0xbdb7('0x14')]],'as':_0x38311f['as'],'attributes':_0x38311f[_0xbdb7('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17e022){logger[_0xbdb7('0x16')](_0xbdb7('0x1b'),_0x39490a);logger[_0xbdb7('0x17')](_0xbdb7('0x1b'),_0x39490a,JSON['stringify'](_0x17e022));_0x24fde4(_0x17e022);})[_0xbdb7('0x18')](function(_0x158e41){logger[_0xbdb7('0x19')]('ShowUser',_0x158e41[_0xbdb7('0x1a')],_0x39490a);_0x7f7ea2(_0x498358[_0xbdb7('0x19')](0x1f4,_0x158e41[_0xbdb7('0x1a')]));});});};exports['PauseUser']=function(_0xb490ba){var _0xf6f1ea=this;return new Promise(function(_0x15a828,_0x5884e2){var _0x2c4a2a;return db[_0xbdb7('0xc')][_0xbdb7('0x1c')]({'where':_0xb490ba[_0xbdb7('0xe')]['where']||{},'attributes':['id','name',_0xbdb7('0x1e'),'internal','interface']})[_0xbdb7('0x15')](function(_0x8251e){if(_0x8251e){_0x2c4a2a=_0x8251e;return db[_0xbdb7('0x1f')][_0xbdb7('0x20')]({'paused':0x1},{'where':{'UserId':_0x2c4a2a['id']},'individualHooks':!![]});}})[_0xbdb7('0x15')](function(){if(_0x2c4a2a){return db[_0xbdb7('0x21')][_0xbdb7('0xd')]({'where':{'membername':_0x2c4a2a[_0xbdb7('0x22')],'type':_0xbdb7('0x23'),'exitAt':null}});}})[_0xbdb7('0x15')](function(_0x1974d3){if(_0x2c4a2a){if(_0x1974d3&&_0x1974d3[_0xbdb7('0x24')]){var _0x493575=moment()['format'](_0xbdb7('0x25'));for(var _0x147a67=0x0,_0x1ebaac=_0x1974d3[_0xbdb7('0x24')];_0x147a67<_0x1ebaac;_0x147a67++){_0x1974d3[_0x147a67][_0xbdb7('0x26')]({'exitAt':_0x493575});}}}})[_0xbdb7('0x15')](function(){if(_0x2c4a2a){var _0x430151=[];var _0xea6c06=utils[_0xbdb7('0x27')]();_0xea6c06[_0xbdb7('0x28')](function(_0x4e08c2){_0x430151[_0xbdb7('0x29')]({'channel':_0x4e08c2,'membername':_0x2c4a2a[_0xbdb7('0x22')],'interface':_[_0xbdb7('0x2a')](_0x2c4a2a[_0xbdb7('0x2b')])?util[_0xbdb7('0x2c')](_0xbdb7('0x2d'),_0x2c4a2a[_0xbdb7('0x22')]):_0x2c4a2a['interface'],'type':_0xbdb7('0x23'),'enterAt':moment()[_0xbdb7('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0xb490ba['body'][_0xbdb7('0x2e')]||'DEFAULT\x20PAUSE','role':_0x2c4a2a['role'],'internal':_0x2c4a2a[_0xbdb7('0x2f')],'uniqueid':_0xb490ba['body'][_0xbdb7('0x30')]||null});});return db[_0xbdb7('0x21')][_0xbdb7('0x31')](_0x430151,{'individualHooks':!![]});}})[_0xbdb7('0x15')](function(){if(_0x2c4a2a){return _0x2c4a2a[_0xbdb7('0x20')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xb490ba['body'][_0xbdb7('0x2e')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xbdb7('0x2c')](_0xbdb7('0x25'))});}})['then'](function(_0x593337){_0x15a828(_0x593337);})['catch'](function(_0x189464){_0x5884e2(_0xf6f1ea[_0xbdb7('0x19')](0x1f4,_0x189464['message']));});});};exports[_0xbdb7('0x32')]=function(_0x4b1af3){var _0x5678c3=this;return new Promise(function(_0x2b86e0,_0x4461ca){if(_0x4b1af3[_0xbdb7('0x33')][_0xbdb7('0x34')]&&!utils[_0xbdb7('0x35')](_0x4b1af3[_0xbdb7('0x33')][_0xbdb7('0x34')])){throw new Error(util[_0xbdb7('0x2c')](_0xbdb7('0x36'),_0x4b1af3['body'][_0xbdb7('0x34')]));}return db[_0xbdb7('0xc')][_0xbdb7('0x37')]({'where':_0x4b1af3[_0xbdb7('0xe')][_0xbdb7('0xf')]||{},'attributes':['id',_0xbdb7('0x22'),_0xbdb7('0x1e'),_0xbdb7('0x2f'),_0xbdb7('0x2b'),_0xbdb7('0x38'),_0xbdb7('0x39'),_0xbdb7('0x3a'),_0xbdb7('0x3b'),_0xbdb7('0x3c'),_0xbdb7('0x3d'),'smsPause','whatsappPause',_0xbdb7('0x3e'),_0xbdb7('0x3f')]})['then'](function(_0x317d7d){if(!_0x317d7d){throw new Error(util[_0xbdb7('0x2c')](_0xbdb7('0x40'),_0x4b1af3[_0xbdb7('0x41')]['id']));}return _0x317d7d[_0xbdb7('0x42')](_0x4b1af3[_0xbdb7('0x33')][_0xbdb7('0x34')],_0xbdb7('0x43'));})['then'](function(_0xa742b5){_0x2b86e0(_0xa742b5);})[_0xbdb7('0x18')](function(_0x38c680){_0x4461ca(_0x5678c3[_0xbdb7('0x19')](0x1f4,_0x38c680[_0xbdb7('0x1a')]));});});};exports[_0xbdb7('0x44')]=function(_0x52ccf9){var _0x4976bf=this;return new Promise(function(_0x17cad9,_0x17cee1){var _0xe8e6d3;return db[_0xbdb7('0xc')][_0xbdb7('0x37')]({'where':_0x52ccf9['options'][_0xbdb7('0xf')]||{},'attributes':['id',_0xbdb7('0x22')]})['then'](function(_0x564271){if(_0x564271){_0xe8e6d3=_0x564271;return db[_0xbdb7('0x1f')]['destroy']({'where':{'membername':_0xe8e6d3[_0xbdb7('0x22')]},'individualHooks':!![]});}})[_0xbdb7('0x15')](function(){if(_0xe8e6d3){return db['MemberReport'][_0xbdb7('0xd')]({'where':{'membername':_0xe8e6d3[_0xbdb7('0x22')],'exitAt':null}});}})[_0xbdb7('0x15')](function(_0x228d92){if(_0xe8e6d3){if(_0x228d92&&_0x228d92[_0xbdb7('0x24')]){var _0x5aef97=[];_0x228d92[_0xbdb7('0x28')](function(_0x785950){_0x5aef97[_0xbdb7('0x29')](_0x785950['update']({'exitAt':moment()[_0xbdb7('0x2c')](_0xbdb7('0x25'))}));});return BPromise[_0xbdb7('0x45')](_0x5aef97);}}})[_0xbdb7('0x15')](function(){if(_0xe8e6d3){return _0xe8e6d3[_0xbdb7('0x20')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xbdb7('0x15')](function(_0x32e567){_0x17cad9(_0x32e567);})[_0xbdb7('0x18')](function(_0x117ba7){_0x17cee1(_0x4976bf[_0xbdb7('0x19')](0x1f4,_0x117ba7[_0xbdb7('0x1a')]));});});};exports[_0xbdb7('0x46')]=function(_0x19547b){var _0x47c12c=this;return new Promise(function(_0x118cbf,_0x2ed7c3){var _0x33efb0;var _0x328b70;var _0x2870c5;var _0x3a2fee;return db[_0xbdb7('0xc')]['findOne']({'where':_0x19547b[_0xbdb7('0xe')][_0xbdb7('0xf')]||{},'attributes':['id',_0xbdb7('0x22'),_0xbdb7('0x1e'),_0xbdb7('0x47'),_0xbdb7('0x48'),'internal','loginInPause','interface']})[_0xbdb7('0x15')](function(_0x199534){if(_0x199534){_0x33efb0=_0x199534;_0x3a2fee=_0x19547b[_0xbdb7('0x33')][_0xbdb7('0x2b')]?_0x19547b[_0xbdb7('0x33')][_0xbdb7('0x2b')]:util[_0xbdb7('0x2c')](_0xbdb7('0x2d'),_0x33efb0[_0xbdb7('0x22')]);return db['User'][_0xbdb7('0x49')]({'where':{'role':_0xbdb7('0x4a'),'online':!![],'id':{'$ne':_0x33efb0['id']}}});}})[_0xbdb7('0x15')](function(_0x3314b2){if(_0x3314b2){_0x2870c5=_0x3314b2;return require('../../config/license/util')['getLicense']();}})[_0xbdb7('0x15')](function(_0x457fa6){if(_0x457fa6&&_0x457fa6['agents']&&_0x2870c5>=_0x457fa6[_0xbdb7('0x4b')]){throw new Error(_0xbdb7('0x4c'));}})[_0xbdb7('0x15')](function(){if(_0x33efb0){return db['UserVoiceQueueRt'][_0xbdb7('0x4d')]({'where':{'membername':_0x33efb0[_0xbdb7('0x22')]},'individualHooks':!![]});}})[_0xbdb7('0x15')](function(){if(_0x33efb0){return _0x33efb0[_0xbdb7('0x4e')]({'raw':!![]});}})[_0xbdb7('0x15')](function(_0x5404d8){if(_0x33efb0){if(_0x5404d8){var _0x5f38e0=[];_0x328b70=_0x5404d8;if(_0x328b70[_0xbdb7('0x24')]){for(var _0xe4ef86=0x0;_0xe4ef86<_0x328b70[_0xbdb7('0x24')];_0xe4ef86++){_0x5f38e0['push'](db[_0xbdb7('0x1f')][_0xbdb7('0x4f')]({'membername':_0x33efb0[_0xbdb7('0x22')],'UserId':_0x33efb0['id'],'queue_name':_0x328b70[_0xe4ef86][_0xbdb7('0x22')],'VoiceQueueId':_0x328b70[_0xe4ef86]['id'],'interface':_0x3a2fee,'paused':_0x33efb0[_0xbdb7('0x50')]||![],'penalty':_0x328b70[_0xe4ef86][_0xbdb7('0x51')]||0x0}));}return BPromise[_0xbdb7('0x45')](_0x5f38e0);}}}})[_0xbdb7('0x15')](function(){if(_0x33efb0){return db[_0xbdb7('0x21')][_0xbdb7('0xd')]({'where':{'membername':_0x33efb0[_0xbdb7('0x22')],'exitAt':null}});}})[_0xbdb7('0x15')](function(_0x2ce12f){if(_0x33efb0){if(_0x2ce12f&&_0x2ce12f[_0xbdb7('0x24')]){var _0xbf6b25=[];_0x2ce12f['forEach'](function(_0x44e805){_0xbf6b25[_0xbdb7('0x29')](_0x44e805['update']({'exitAt':moment()[_0xbdb7('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xbdb7('0x45')](_0xbf6b25);}}})[_0xbdb7('0x15')](function(){if(_0x33efb0){var _0x209afc=[];var _0x18517a=[];var _0x385ec7=utils[_0xbdb7('0x27')]();var _0x38d916={'membername':_0x33efb0[_0xbdb7('0x22')],'interface':_0x3a2fee,'enterAt':moment()[_0xbdb7('0x2c')](_0xbdb7('0x25')),'role':_0x33efb0[_0xbdb7('0x1e')],'internal':_0x33efb0[_0xbdb7('0x2f')]};_0x385ec7['forEach'](function(_0x541189){_0x209afc[_0xbdb7('0x29')](_[_0xbdb7('0x52')]({'channel':_0x541189,'type':_0xbdb7('0x53'),'data1':_0xbdb7('0x54'),'data2':_0x3a2fee},_0x38d916));if(_0x33efb0['loginInPause']){_0x18517a['push'](_[_0xbdb7('0x52')]({'channel':_0x541189,'type':_0xbdb7('0x23'),'data1':_0xbdb7('0x55')},_0x38d916));}});return db[_0xbdb7('0x21')]['bulkCreate'](_0x209afc[_0xbdb7('0x56')](_0x18517a),{'individualHooks':!![]});}})[_0xbdb7('0x15')](function(){if(_0x33efb0){return _0x33efb0[_0xbdb7('0x20')]({'online':!![],'lastLoginAt':moment()[_0xbdb7('0x2c')](_0xbdb7('0x25')),'voicePause':_0x33efb0[_0xbdb7('0x50')]||![],'mailPause':_0x33efb0[_0xbdb7('0x50')]||![],'chatPause':_0x33efb0[_0xbdb7('0x50')]||![],'faxPause':_0x33efb0[_0xbdb7('0x50')]||![],'smsPause':_0x33efb0['loginInPause']||![],'openchannelPause':_0x33efb0[_0xbdb7('0x50')]||![],'pauseType':_0x33efb0[_0xbdb7('0x50')]?_0xbdb7('0x55'):null,'lastPauseAt':moment()['format'](_0xbdb7('0x25')),'interface':_0x3a2fee});}})[_0xbdb7('0x15')](function(_0x4a153c){_0x118cbf(_0x4a153c);})[_0xbdb7('0x18')](function(_0x2713e3){_0x2ed7c3(_0x47c12c['error'](0x1f4,_0x2713e3[_0xbdb7('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f8cbea4..80482f1 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 _0x338d=['update','emit','removeListener','register','length','./user.events','save','remove'];(function(_0x3eac70,_0x36b0b4){var _0x12893b=function(_0x4cadce){while(--_0x4cadce){_0x3eac70['push'](_0x3eac70['shift']());}};_0x12893b(++_0x36b0b4);}(_0x338d,0x6d));var _0xd338=function(_0x380c32,_0x450437){_0x380c32=_0x380c32-0x0;var _0x5c0ed4=_0x338d[_0x380c32];return _0x5c0ed4;};'use strict';var UserEvents=require(_0xd338('0x0'));var events=[_0xd338('0x1'),_0xd338('0x2'),_0xd338('0x3')];function createListener(_0x36a4b8,_0x17c984){return function(_0x1c97e0){_0x17c984[_0xd338('0x4')](_0x36a4b8,_0x1c97e0);};}function removeListener(_0x1a89f7,_0x3bbf0a){return function(){UserEvents[_0xd338('0x5')](_0x1a89f7,_0x3bbf0a);};}exports[_0xd338('0x6')]=function(_0x405bbd){for(var _0x55cd72=0x0,_0x50c12e=events[_0xd338('0x7')];_0x55cd72<_0x50c12e;_0x55cd72++){var _0x5117fe=events[_0x55cd72];var _0x5b2e6b=createListener('user:'+_0x5117fe,_0x405bbd);UserEvents['on'](_0x5117fe,_0x5b2e6b);}}; \ No newline at end of file +var _0xa4b7=['save','update','emit','removeListener','register','length','user:','./user.events'];(function(_0x339792,_0x52215c){var _0x4675a6=function(_0x714777){while(--_0x714777){_0x339792['push'](_0x339792['shift']());}};_0x4675a6(++_0x52215c);}(_0xa4b7,0xff));var _0x7a4b=function(_0x18006e,_0x14430a){_0x18006e=_0x18006e-0x0;var _0x503dad=_0xa4b7[_0x18006e];return _0x503dad;};'use strict';var UserEvents=require(_0x7a4b('0x0'));var events=[_0x7a4b('0x1'),'remove',_0x7a4b('0x2')];function createListener(_0x2226eb,_0x17f356){return function(_0x14492f){_0x17f356[_0x7a4b('0x3')](_0x2226eb,_0x14492f);};}function removeListener(_0x1c8f53,_0x25d99d){return function(){UserEvents[_0x7a4b('0x4')](_0x1c8f53,_0x25d99d);};}exports[_0x7a4b('0x5')]=function(_0x1f75ce){for(var _0x12f257=0x0,_0x264be1=events[_0x7a4b('0x6')];_0x12f257<_0x264be1;_0x12f257++){var _0x36b271=events[_0x12f257];var _0x2f0452=createListener(_0x7a4b('0x7')+_0x36b271,_0x1f75ce);UserEvents['on'](_0x36b271,_0x2f0452);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f1bbb30..ffea540 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1ec1b8,_0x4e3651){var _0x4d0f2c=function(_0x502766){while(--_0x502766){_0x1ec1b8['push'](_0x1ec1b8['shift']());}};_0x4d0f2c(++_0x4e3651);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x141043,_0xf143f9){var _0x468307=function(_0x5be2f7){while(--_0x5be2f7){_0x141043['push'](_0x141043['shift']());}};_0x468307(++_0xf143f9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0xcb91[_0x40be86];return _0xda3c3b;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index a863919..3f1aee3 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 _0x73a7=['exports','INTEGER'];(function(_0x277023,_0x4ee10a){var _0x2399b5=function(_0x232dc0){while(--_0x232dc0){_0x277023['push'](_0x277023['shift']());}};_0x2399b5(++_0x4ee10a);}(_0x73a7,0x80));var _0x773a=function(_0x4aee47,_0x5b1af1){_0x4aee47=_0x4aee47-0x0;var _0x4971de=_0x73a7[_0x4aee47];return _0x4971de;};'use strict';var Sequelize=require('sequelize');module[_0x773a('0x0')]={'penalty':{'type':Sequelize[_0x773a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa205=['sequelize','exports','INTEGER'];(function(_0x51b3f3,_0x42205e){var _0x6c12c4=function(_0x2afa89){while(--_0x2afa89){_0x51b3f3['push'](_0x51b3f3['shift']());}};_0x6c12c4(++_0x42205e);}(_0xa205,0x177));var _0x5a20=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa205[_0x28947d];return _0x12d2ee;};'use strict';var Sequelize=require(_0x5a20('0x0'));module[_0x5a20('0x1')]={'penalty':{'type':Sequelize[_0x5a20('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 0895a04..faade56 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 _0x9e0c=['lodash','api','request-promise','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues'];(function(_0x2c9f51,_0x2eec01){var _0x12abf9=function(_0x2d463f){while(--_0x2d463f){_0x2c9f51['push'](_0x2c9f51['shift']());}};_0x12abf9(++_0x2eec01);}(_0x9e0c,0x178));var _0xc9e0=function(_0x2ec25a,_0x5e5b87){_0x2ec25a=_0x2ec25a-0x0;var _0x5b24a4=_0x9e0c[_0x2ec25a];return _0x5b24a4;};'use strict';var _=require(_0xc9e0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc9e0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc9e0('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc9e0('0x3'));var attributes=require(_0xc9e0('0x4'));module[_0xc9e0('0x5')]=function(_0x2fd776,_0x1403b8){return _0x2fd776[_0xc9e0('0x6')]('UserChatQueue',attributes,{'tableName':_0xc9e0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5daa=['moment','bluebird','request-promise','path','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api'];(function(_0x3aff90,_0x2d2dbb){var _0x11253f=function(_0x3ea819){while(--_0x3ea819){_0x3aff90['push'](_0x3aff90['shift']());}};_0x11253f(++_0x2d2dbb);}(_0x5daa,0x1e9));var _0xa5da=function(_0x449cad,_0x4472ce){_0x449cad=_0x449cad-0x0;var _0x5e7c41=_0x5daa[_0x449cad];return _0x5e7c41;};'use strict';var _=require('lodash');var util=require(_0xa5da('0x0'));var logger=require(_0xa5da('0x1'))(_0xa5da('0x2'));var moment=require(_0xa5da('0x3'));var BPromise=require(_0xa5da('0x4'));var rp=require(_0xa5da('0x5'));var fs=require('fs');var path=require(_0xa5da('0x6'));var rimraf=require('rimraf');var config=require(_0xa5da('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xa5da('0x8')]=function(_0x1424b7,_0x2d210a){return _0x1424b7[_0xa5da('0x9')](_0xa5da('0xa'),attributes,{'tableName':_0xa5da('0xb'),'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 8826882..3866ccc 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 _0x6eb9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x46b701,_0x1dae73){var _0x781729=function(_0x1dd2d1){while(--_0x1dd2d1){_0x46b701['push'](_0x46b701['shift']());}};_0x781729(++_0x1dae73);}(_0x6eb9,0x1cc));var _0x96eb=function(_0x2b70bd,_0x2e39d2){_0x2b70bd=_0x2b70bd-0x0;var _0x4cd986=_0x6eb9[_0x2b70bd];return _0x4cd986;};'use strict';var _=require(_0x96eb('0x0'));var util=require(_0x96eb('0x1'));var moment=require(_0x96eb('0x2'));var BPromise=require(_0x96eb('0x3'));var rs=require(_0x96eb('0x4'));var fs=require('fs');var Redis=require(_0x96eb('0x5'));var db=require(_0x96eb('0x6'))['db'];var utils=require(_0x96eb('0x7'));var logger=require(_0x96eb('0x8'))(_0x96eb('0x9'));var config=require('../../config/environment');var jayson=require(_0x96eb('0xa'));var client=jayson[_0x96eb('0xb')][_0x96eb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x495ea3,_0x5268d6,_0xbd3d8c){return new BPromise(function(_0xdf7f91,_0x3cae1d){return client[_0x96eb('0xd')](_0x495ea3,_0xbd3d8c)['then'](function(_0x1c7b39){logger['info'](_0x96eb('0xe'),_0x5268d6,_0x96eb('0xf'));logger[_0x96eb('0x10')](_0x96eb('0x11'),_0x5268d6,'request\x20sent',JSON['stringify'](_0x1c7b39));if(_0x1c7b39['error']){if(_0x1c7b39[_0x96eb('0x12')][_0x96eb('0x13')]===0x1f4){logger[_0x96eb('0x12')](_0x96eb('0xe'),_0x5268d6,_0x1c7b39['error'][_0x96eb('0x14')]);return _0x3cae1d(_0x1c7b39[_0x96eb('0x12')][_0x96eb('0x14')]);}logger[_0x96eb('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x5268d6,_0x1c7b39[_0x96eb('0x12')][_0x96eb('0x14')]);return _0xdf7f91(_0x1c7b39[_0x96eb('0x12')][_0x96eb('0x14')]);}else{logger[_0x96eb('0x15')](_0x96eb('0xe'),_0x5268d6,_0x96eb('0xf'));_0xdf7f91(_0x1c7b39[_0x96eb('0x16')]['message']);}})['catch'](function(_0x485d69){logger[_0x96eb('0x12')](_0x96eb('0xe'),_0x5268d6,_0x485d69);_0x3cae1d(_0x485d69);});});} \ No newline at end of file +var _0x0482=['UserChatQueue,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0x3f531a,_0x165074){var _0x31e27e=function(_0x15b420){while(--_0x15b420){_0x3f531a['push'](_0x3f531a['shift']());}};_0x31e27e(++_0x165074);}(_0x0482,0x191));var _0x2048=function(_0x503ffd,_0x8ecde){_0x503ffd=_0x503ffd-0x0;var _0x160437=_0x0482[_0x503ffd];return _0x160437;};'use strict';var _=require(_0x2048('0x0'));var util=require('util');var moment=require(_0x2048('0x1'));var BPromise=require(_0x2048('0x2'));var rs=require(_0x2048('0x3'));var fs=require('fs');var Redis=require(_0x2048('0x4'));var db=require(_0x2048('0x5'))['db'];var utils=require(_0x2048('0x6'));var logger=require(_0x2048('0x7'))(_0x2048('0x8'));var config=require(_0x2048('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2048('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e8dbc,_0x12b958,_0x2ed9e4){return new BPromise(function(_0x5ffb4c,_0x1e5759){return client['request'](_0x3e8dbc,_0x2ed9e4)[_0x2048('0xb')](function(_0x11c4b6){logger[_0x2048('0xc')](_0x2048('0xd'),_0x12b958,_0x2048('0xe'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x12b958,_0x2048('0xe'),JSON['stringify'](_0x11c4b6));if(_0x11c4b6[_0x2048('0xf')]){if(_0x11c4b6[_0x2048('0xf')]['code']===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x12b958,_0x11c4b6[_0x2048('0xf')][_0x2048('0x10')]);return _0x1e5759(_0x11c4b6[_0x2048('0xf')][_0x2048('0x10')]);}logger[_0x2048('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x12b958,_0x11c4b6[_0x2048('0xf')][_0x2048('0x10')]);return _0x5ffb4c(_0x11c4b6[_0x2048('0xf')][_0x2048('0x10')]);}else{logger[_0x2048('0xc')](_0x2048('0xd'),_0x12b958,_0x2048('0xe'));_0x5ffb4c(_0x11c4b6[_0x2048('0x11')][_0x2048('0x10')]);}})['catch'](function(_0x2898b7){logger[_0x2048('0xf')](_0x2048('0xd'),_0x12b958,_0x2898b7);_0x1e5759(_0x2898b7);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 091f6d9..132da36 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xd2a568,_0x4e8606){var _0x4cf0ba=function(_0x1f9dfc){while(--_0x1f9dfc){_0xd2a568['push'](_0xd2a568['shift']());}};_0x4cf0ba(++_0x4e8606);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x596cbf,_0x3ee197){var _0x50f1b6=function(_0x1ff543){while(--_0x1ff543){_0x596cbf['push'](_0x596cbf['shift']());}};_0x50f1b6(++_0x3ee197);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xcb91[_0x151721];return _0x2deaa7;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 738f09c..cd6a2f5 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 _0x76ea=['exports','INTEGER','sequelize'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x76ea,0x101));var _0xa76e=function(_0x3c1a64,_0x16cc30){_0x3c1a64=_0x3c1a64-0x0;var _0x35aac6=_0x76ea[_0x3c1a64];return _0x35aac6;};'use strict';var Sequelize=require(_0xa76e('0x0'));module[_0xa76e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa76e('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8615=['exports','sequelize'];(function(_0x529d4d,_0x4243fb){var _0x459662=function(_0x8db78){while(--_0x8db78){_0x529d4d['push'](_0x529d4d['shift']());}};_0x459662(++_0x4243fb);}(_0x8615,0x14d));var _0x5861=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0x8615[_0x319cb9];return _0x1735fc;};'use strict';var Sequelize=require(_0x5861('0x0'));module[_0x5861('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8d5aefc..df1ddd2 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 _0x2970=['./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x239c42,_0xcd69d6){var _0x3f3fd1=function(_0x45d7dc){while(--_0x45d7dc){_0x239c42['push'](_0x239c42['shift']());}};_0x3f3fd1(++_0xcd69d6);}(_0x2970,0x197));var _0x0297=function(_0x1fbf6c,_0x4732a2){_0x1fbf6c=_0x1fbf6c-0x0;var _0x10ca87=_0x2970[_0x1fbf6c];return _0x10ca87;};'use strict';var _=require('lodash');var util=require(_0x0297('0x0'));var logger=require(_0x0297('0x1'))(_0x0297('0x2'));var moment=require(_0x0297('0x3'));var BPromise=require(_0x0297('0x4'));var rp=require(_0x0297('0x5'));var fs=require('fs');var path=require(_0x0297('0x6'));var rimraf=require(_0x0297('0x7'));var config=require(_0x0297('0x8'));var attributes=require(_0x0297('0x9'));module[_0x0297('0xa')]=function(_0x34d7d8,_0xf8b87b){return _0x34d7d8['define'](_0x0297('0xb'),attributes,{'tableName':_0x0297('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcab1=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x265f6a,_0x489e7b){var _0x411cb3=function(_0x2d9dcf){while(--_0x2d9dcf){_0x265f6a['push'](_0x265f6a['shift']());}};_0x411cb3(++_0x489e7b);}(_0xcab1,0x1a2));var _0x1cab=function(_0x2efc98,_0x5896b4){_0x2efc98=_0x2efc98-0x0;var _0x15dd1d=_0xcab1[_0x2efc98];return _0x15dd1d;};'use strict';var _=require(_0x1cab('0x0'));var util=require(_0x1cab('0x1'));var logger=require(_0x1cab('0x2'))(_0x1cab('0x3'));var moment=require(_0x1cab('0x4'));var BPromise=require(_0x1cab('0x5'));var rp=require(_0x1cab('0x6'));var fs=require('fs');var path=require(_0x1cab('0x7'));var rimraf=require(_0x1cab('0x8'));var config=require(_0x1cab('0x9'));var attributes=require(_0x1cab('0xa'));module[_0x1cab('0xb')]=function(_0x54f653,_0x5b16fc){return _0x54f653['define'](_0x1cab('0xc'),attributes,{'tableName':_0x1cab('0xd'),'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 b7732f8..090cbb7 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 _0x40da=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40da,0x75));var _0xa40d=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x40da[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0xa40d('0x0'));var util=require(_0xa40d('0x1'));var moment=require(_0xa40d('0x2'));var BPromise=require(_0xa40d('0x3'));var rs=require(_0xa40d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa40d('0x5'))['db'];var utils=require(_0xa40d('0x6'));var logger=require(_0xa40d('0x7'))(_0xa40d('0x8'));var config=require(_0xa40d('0x9'));var jayson=require(_0xa40d('0xa'));var client=jayson[_0xa40d('0xb')][_0xa40d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c5262,_0x1a4d3f,_0x139ede){return new BPromise(function(_0x431bf2,_0x214ee7){return client[_0xa40d('0xd')](_0x5c5262,_0x139ede)['then'](function(_0x1e691a){logger[_0xa40d('0xe')](_0xa40d('0xf'),_0x1a4d3f,_0xa40d('0x10'));logger[_0xa40d('0x11')](_0xa40d('0x12'),_0x1a4d3f,'request\x20sent',JSON[_0xa40d('0x13')](_0x1e691a));if(_0x1e691a[_0xa40d('0x14')]){if(_0x1e691a[_0xa40d('0x14')][_0xa40d('0x15')]===0x1f4){logger[_0xa40d('0x14')](_0xa40d('0xf'),_0x1a4d3f,_0x1e691a[_0xa40d('0x14')][_0xa40d('0x16')]);return _0x214ee7(_0x1e691a[_0xa40d('0x14')]['message']);}logger[_0xa40d('0x14')](_0xa40d('0xf'),_0x1a4d3f,_0x1e691a[_0xa40d('0x14')]['message']);return _0x431bf2(_0x1e691a[_0xa40d('0x14')]['message']);}else{logger[_0xa40d('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x1a4d3f,_0xa40d('0x10'));_0x431bf2(_0x1e691a['result'][_0xa40d('0x16')]);}})[_0xa40d('0x17')](function(_0x5c9b97){logger[_0xa40d('0x14')](_0xa40d('0xf'),_0x1a4d3f,_0x5c9b97);_0x214ee7(_0x5c9b97);});});} \ No newline at end of file +var _0xebb5=['info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x470961,_0x3315a9){var _0x288382=function(_0x315718){while(--_0x315718){_0x470961['push'](_0x470961['shift']());}};_0x288382(++_0x3315a9);}(_0xebb5,0x11d));var _0x5ebb=function(_0x4e9e63,_0x125d14){_0x4e9e63=_0x4e9e63-0x0;var _0x19b0b9=_0xebb5[_0x4e9e63];return _0x19b0b9;};'use strict';var _=require(_0x5ebb('0x0'));var util=require(_0x5ebb('0x1'));var moment=require(_0x5ebb('0x2'));var BPromise=require(_0x5ebb('0x3'));var rs=require(_0x5ebb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ebb('0x5'))['db'];var utils=require(_0x5ebb('0x6'));var logger=require(_0x5ebb('0x7'))('rpc');var config=require(_0x5ebb('0x8'));var jayson=require(_0x5ebb('0x9'));var client=jayson[_0x5ebb('0xa')][_0x5ebb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a7444,_0x203167,_0xdd8af9){return new BPromise(function(_0x4c5c11,_0x4673fe){return client[_0x5ebb('0xc')](_0x4a7444,_0xdd8af9)[_0x5ebb('0xd')](function(_0x2072ed){logger[_0x5ebb('0xe')](_0x5ebb('0xf'),_0x203167,'request\x20sent');logger[_0x5ebb('0x10')](_0x5ebb('0x11'),_0x203167,'request\x20sent',JSON['stringify'](_0x2072ed));if(_0x2072ed[_0x5ebb('0x12')]){if(_0x2072ed[_0x5ebb('0x12')]['code']===0x1f4){logger[_0x5ebb('0x12')](_0x5ebb('0xf'),_0x203167,_0x2072ed[_0x5ebb('0x12')][_0x5ebb('0x13')]);return _0x4673fe(_0x2072ed[_0x5ebb('0x12')][_0x5ebb('0x13')]);}logger[_0x5ebb('0x12')](_0x5ebb('0xf'),_0x203167,_0x2072ed[_0x5ebb('0x12')][_0x5ebb('0x13')]);return _0x4c5c11(_0x2072ed[_0x5ebb('0x12')][_0x5ebb('0x13')]);}else{logger['info'](_0x5ebb('0xf'),_0x203167,_0x5ebb('0x14'));_0x4c5c11(_0x2072ed[_0x5ebb('0x15')][_0x5ebb('0x13')]);}})[_0x5ebb('0x16')](function(_0x65b1fe){logger[_0x5ebb('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x203167,_0x65b1fe);_0x4673fe(_0x65b1fe);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 13ae923..c1c428a 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x231c07,_0x3bfd65){var _0x176560=function(_0x46b70b){while(--_0x46b70b){_0x231c07['push'](_0x231c07['shift']());}};_0x176560(++_0x3bfd65);}(_0x70e0,0x17b));var _0x070e=function(_0x23299c,_0x570d0d){_0x23299c=_0x23299c-0x0;var _0x2e6e35=_0x70e0[_0x23299c];return _0x2e6e35;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x29c0b7,_0x3c2245){var _0x4b0961=function(_0x3d9d5b){while(--_0x3d9d5b){_0x29c0b7['push'](_0x29c0b7['shift']());}};_0x4b0961(++_0x3c2245);}(_0xedd9,0xfc));var _0x9edd=function(_0x208767,_0x26b59d){_0x208767=_0x208767-0x0;var _0x4319b7=_0xedd9[_0x208767];return _0x4319b7;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c07be11..2b13694 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 _0x584f=['sequelize','exports'];(function(_0x3e4b27,_0x30f168){var _0x156235=function(_0x4bea30){while(--_0x4bea30){_0x3e4b27['push'](_0x3e4b27['shift']());}};_0x156235(++_0x30f168);}(_0x584f,0x108));var _0xf584=function(_0x53cf14,_0x29e073){_0x53cf14=_0x53cf14-0x0;var _0x3e5981=_0x584f[_0x53cf14];return _0x3e5981;};'use strict';var Sequelize=require(_0xf584('0x0'));module[_0xf584('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb4b1=['exports','INTEGER','sequelize'];(function(_0x2522ee,_0x28d475){var _0x40d4fb=function(_0xab61d7){while(--_0xab61d7){_0x2522ee['push'](_0x2522ee['shift']());}};_0x40d4fb(++_0x28d475);}(_0xb4b1,0x1d3));var _0x1b4b=function(_0x3850b0,_0x2a5251){_0x3850b0=_0x3850b0-0x0;var _0x6f82d6=_0xb4b1[_0x3850b0];return _0x6f82d6;};'use strict';var Sequelize=require(_0x1b4b('0x0'));module[_0x1b4b('0x1')]={'penalty':{'type':Sequelize[_0x1b4b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 07389f8..f5460d6 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 _0x5be7=['api','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','lodash','util','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5be7,0xf7));var _0x75be=function(_0x5639a2,_0x1d529c){_0x5639a2=_0x5639a2-0x0;var _0x2c5aa5=_0x5be7[_0x5639a2];return _0x2c5aa5;};'use strict';var _=require(_0x75be('0x0'));var util=require(_0x75be('0x1'));var logger=require(_0x75be('0x2'))(_0x75be('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x75be('0x4'));var rimraf=require(_0x75be('0x5'));var config=require(_0x75be('0x6'));var attributes=require(_0x75be('0x7'));module[_0x75be('0x8')]=function(_0x23ff9d,_0x1a3907){return _0x23ff9d['define'](_0x75be('0x9'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbf2=['lodash','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x16ea87,_0x378d8b){var _0x6e7b1c=function(_0x26306e){while(--_0x26306e){_0x16ea87['push'](_0x16ea87['shift']());}};_0x6e7b1c(++_0x378d8b);}(_0xfbf2,0xbe));var _0x2fbf=function(_0x312b2b,_0x2174f3){_0x312b2b=_0x312b2b-0x0;var _0x1d6a18=_0xfbf2[_0x312b2b];return _0x1d6a18;};'use strict';var _=require(_0x2fbf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2fbf('0x1'));var BPromise=require(_0x2fbf('0x2'));var rp=require(_0x2fbf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fbf('0x4'));var config=require(_0x2fbf('0x5'));var attributes=require('./userMailQueue.attributes');module[_0x2fbf('0x6')]=function(_0x48d03e,_0xbcf03e){return _0x48d03e[_0x2fbf('0x7')](_0x2fbf('0x8'),attributes,{'tableName':_0x2fbf('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 86bc38a..695aaa6 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x008c,0x188));var _0xc008=function(_0x34331b,_0x22a64c){_0x34331b=_0x34331b-0x0;var _0x1f97c8=_0x008c[_0x34331b];return _0x1f97c8;};'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 _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x4774e6,_0x1a2a6f){var _0xef1fa3=function(_0x4a0ec2){while(--_0x4a0ec2){_0x4774e6['push'](_0x4774e6['shift']());}};_0xef1fa3(++_0x1a2a6f);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x4b84[_0x1f1a97];return _0x29fc6a;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 9dcc485..1a61d14 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 _0x1947=['../../config/environment','./userNotification.controller','post','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x417fef,_0x10aec2){var _0xc9213d=function(_0xf04519){while(--_0xf04519){_0x417fef['push'](_0x417fef['shift']());}};_0xc9213d(++_0x10aec2);}(_0x1947,0xb9));var _0x7194=function(_0x83f53a,_0x3b232e){_0x83f53a=_0x83f53a-0x0;var _0x4d8797=_0x1947[_0x83f53a];return _0x4d8797;};'use strict';var multer=require(_0x7194('0x0'));var util=require(_0x7194('0x1'));var path=require(_0x7194('0x2'));var timeout=require(_0x7194('0x3'));var express=require(_0x7194('0x4'));var router=express[_0x7194('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7194('0x6'));var config=require(_0x7194('0x7'));var controller=require(_0x7194('0x8'));router[_0x7194('0x9')]('/',auth[_0x7194('0xa')](),controller['sendUserNotification']);module[_0x7194('0xb')]=router; \ No newline at end of file +var _0x45a1=['Router','fs-extra','../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','util','path'];(function(_0xf34c84,_0x18a73b){var _0x49c93e=function(_0x1279be){while(--_0x1279be){_0xf34c84['push'](_0xf34c84['shift']());}};_0x49c93e(++_0x18a73b);}(_0x45a1,0xd0));var _0x145a=function(_0x5f523d,_0x162500){_0x5f523d=_0x5f523d-0x0;var _0x21c4b1=_0x45a1[_0x5f523d];return _0x21c4b1;};'use strict';var multer=require('multer');var util=require(_0x145a('0x0'));var path=require(_0x145a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x145a('0x2')]();var fs_extra=require(_0x145a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x145a('0x4'));var config=require(_0x145a('0x5'));var controller=require(_0x145a('0x6'));router['post']('/',auth[_0x145a('0x7')](),controller[_0x145a('0x8')]);module[_0x145a('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 168f4e5..b29c643 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 _0x9cdd=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x32be82,_0x21b592){var _0x35aa04=function(_0x3d59ca){while(--_0x3d59ca){_0x32be82['push'](_0x32be82['shift']());}};_0x35aa04(++_0x21b592);}(_0x9cdd,0x76));var _0xd9cd=function(_0x52e06e,_0x220056){_0x52e06e=_0x52e06e-0x0;var _0x3279af=_0x9cdd[_0x52e06e];return _0x3279af;};'use strict';var Sequelize=require(_0xd9cd('0x0'));module[_0xd9cd('0x1')]={'body':{'type':Sequelize[_0xd9cd('0x2')]},'senderName':{'type':Sequelize[_0xd9cd('0x3')]},'recipientsId':{'type':Sequelize[_0xd9cd('0x2')]},'recipientsDescription':{'type':Sequelize[_0xd9cd('0x3')]},'beep':{'type':Sequelize[_0xd9cd('0x4')]}}; \ No newline at end of file +var _0xdc9a=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x520945,_0x28b144){var _0x17067a=function(_0x191ae1){while(--_0x191ae1){_0x520945['push'](_0x520945['shift']());}};_0x17067a(++_0x28b144);}(_0xdc9a,0x133));var _0xadc9=function(_0x1129a7,_0x1c88c7){_0x1129a7=_0x1129a7-0x0;var _0x38dffa=_0xdc9a[_0x1129a7];return _0x38dffa;};'use strict';var Sequelize=require(_0xadc9('0x0'));module[_0xadc9('0x1')]={'body':{'type':Sequelize[_0xadc9('0x2')]},'senderName':{'type':Sequelize[_0xadc9('0x3')]},'recipientsId':{'type':Sequelize[_0xadc9('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xadc9('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 5b77883..d38bcbb 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 _0x914f=['map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./userNotification.socket','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','openchannelqueue','whatsappqueue','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','user','fullname','isEmpty','beep','SenderId','sortBy','join','transaction','UserNotification','create','senderName','recipientsDescription','forEach','recipient','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','User','union','ids','queue','replace','push','all','getAgents'];(function(_0x4680a2,_0x2217d5){var _0x5220d2=function(_0x3833ab){while(--_0x3833ab){_0x4680a2['push'](_0x4680a2['shift']());}};_0x5220d2(++_0x2217d5);}(_0x914f,0x1d2));var _0xf914=function(_0x942eca,_0x1d0181){_0x942eca=_0x942eca-0x0;var _0x589c16=_0x914f[_0x942eca];return _0x589c16;};'use strict';var emlformat=require(_0xf914('0x0'));var rimraf=require(_0xf914('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf914('0x2'));var rp=require(_0xf914('0x3'));var moment=require(_0xf914('0x4'));var BPromise=require(_0xf914('0x5'));var Mustache=require(_0xf914('0x6'));var util=require(_0xf914('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf914('0x8'));var fs=require('fs');var fs_extra=require(_0xf914('0x9'));var _=require(_0xf914('0xa'));var squel=require(_0xf914('0xb'));var crypto=require(_0xf914('0xc'));var jsforce=require(_0xf914('0xd'));var deskjs=require(_0xf914('0xe'));var toCsv=require(_0xf914('0xf'));var querystring=require(_0xf914('0x10'));var Papa=require(_0xf914('0x11'));var Redis=require(_0xf914('0x12'));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(_0xf914('0x13'))(_0xf914('0x14'));var utils=require(_0xf914('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf914('0x16'));var db=require('../../mysqldb')['db'];config[_0xf914('0x17')]=_[_0xf914('0x18')](config[_0xf914('0x17')],{'host':_0xf914('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf914('0x17')]));require(_0xf914('0x1a'))['register'](socket);function respondWithStatusCode(_0x54dc36,_0x515c5d){_0x515c5d=_0x515c5d||0xcc;return function(_0x780956){if(_0x780956){return _0x54dc36['sendStatus'](_0x515c5d);}return _0x54dc36['status'](_0x515c5d)[_0xf914('0x1b')]();};}function respondWithResult(_0x85a127,_0x318237){_0x318237=_0x318237||0xc8;return function(_0x17afab){if(_0x17afab){return _0x85a127[_0xf914('0x1c')](_0x318237)['json'](_0x17afab);}};}function respondWithFilteredResult(_0x16256a,_0xc06cb0){return function(_0x140d0a){if(_0x140d0a){var _0x49327e=typeof _0xc06cb0[_0xf914('0x1d')]==='undefined'&&typeof _0xc06cb0['limit']===_0xf914('0x1e');var _0x351bbb=_0x140d0a[_0xf914('0x1f')];var _0x4a92be=_0x49327e?0x0:_0xc06cb0[_0xf914('0x1d')];var _0x2e6091=_0x49327e?_0x140d0a[_0xf914('0x1f')]:_0xc06cb0[_0xf914('0x1d')]+_0xc06cb0[_0xf914('0x20')];var _0x4d8a46;if(_0x2e6091>=_0x351bbb){_0x2e6091=_0x351bbb;_0x4d8a46=0xc8;}else{_0x4d8a46=0xce;}_0x16256a[_0xf914('0x1c')](_0x4d8a46);return _0x16256a[_0xf914('0x21')](_0xf914('0x22'),_0x4a92be+'-'+_0x2e6091+'/'+_0x351bbb)[_0xf914('0x23')](_0x140d0a);}return null;};}function patchUpdates(_0x1e1327){return function(_0x424ba4){try{jsonpatch[_0xf914('0x24')](_0x424ba4,_0x1e1327,!![]);}catch(_0x28db7c){return BPromise[_0xf914('0x25')](_0x28db7c);}return _0x424ba4[_0xf914('0x26')]();};}function saveUpdates(_0x469289,_0x21b6f8){return function(_0x49282f){if(_0x49282f){return _0x49282f[_0xf914('0x27')](_0x469289)['then'](function(_0x59bed2){return _0x59bed2;});}return null;};}function removeEntity(_0x4c61e0,_0x11046b){return function(_0x22cbb0){if(_0x22cbb0){return _0x22cbb0['destroy']()[_0xf914('0x28')](function(){_0x4c61e0[_0xf914('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfffbbf,_0x4585cf){return function(_0x1f8978){if(!_0x1f8978){_0xfffbbf[_0xf914('0x29')](0x194);}return _0x1f8978;};}function handleError(_0x504da6,_0xab8464){_0xab8464=_0xab8464||0x1f4;return function(_0x39c220){logger[_0xf914('0x2a')](_0x39c220['stack']);if(_0x39c220['name']){delete _0x39c220[_0xf914('0x2b')];}_0x504da6[_0xf914('0x1c')](_0xab8464)['send'](_0x39c220);};}exports[_0xf914('0x2c')]=function(_0x5f3395,_0x476839,_0x36acff){if(!_0x5f3395[_0xf914('0x2d')][_0xf914('0x2e')](_0xf914('0x2f'))&&!_0x5f3395[_0xf914('0x2d')][_0xf914('0x2e')](_0xf914('0x30'))){throw new db[(_0xf914('0x31'))][(_0xf914('0x32'))](_0xf914('0x33'));}else{if(_0x5f3395[_0xf914('0x2d')][_0xf914('0x2e')](_0xf914('0x30'))&&!_0x5f3395['body']['hasOwnProperty'](_0xf914('0x34'))){throw new db[(_0xf914('0x31'))][(_0xf914('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x5f3395['body'][_0xf914('0x2e')]('recipients')){throw new db['Sequelize'][(_0xf914('0x32'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x535073=JSON[_0xf914('0x35')](_0x5f3395['body'][_0xf914('0x36')]);}catch(_0x221c3f){logger['error'](_0x221c3f);throw new db[(_0xf914('0x31'))][(_0xf914('0x32'))](_0xf914('0x37'));}var _0x8a08ad=['chatqueue',_0xf914('0x38'),'mailqueue',_0xf914('0x39'),'smsqueue','voicequeue',_0xf914('0x3a'),'team','user'];if(_['some'](_0x535073,function(_0x236232){return!_[_0xf914('0x3b')](_0x8a08ad,_0x236232[_0xf914('0x3c')][_0xf914('0x3d')]());})){throw new db['Sequelize'][(_0xf914('0x32'))](_0xf914('0x3e'));}}}var _0x4ad40c={};_0x4ad40c['senderName']=_0x5f3395['body'][_0xf914('0x2e')]('senderName')?_0x5f3395['body']['senderName']:_0x5f3395[_0xf914('0x3f')][_0xf914('0x40')];_0x4ad40c['recipientsDescription']=_[_0xf914('0x41')](_0x5f3395[_0xf914('0x2d')]['recipientsDescription'])?null:_0x5f3395['body']['recipientsDescription'];_0x4ad40c[_0xf914('0x42')]=_0x5f3395[_0xf914('0x2d')]['beep']||![];_0x4ad40c[_0xf914('0x43')]=_0x5f3395[_0xf914('0x3f')]['id'];return getContent(_0x5f3395['body'])[_0xf914('0x28')](function(_0xcfd9eb){_0x4ad40c[_0xf914('0x2d')]=_0xcfd9eb;return getRecipients(_0x535073);})['then'](function(_0x5361fb){_0x4ad40c['recipientsId']=_[_0xf914('0x44')](_0x5361fb)[_0xf914('0x45')](',');return db['sequelize'][_0xf914('0x46')](function(_0x569752){return db[_0xf914('0x47')][_0xf914('0x48')](_0x4ad40c,{'raw':!![],'transaction':_0x569752})['then'](function(_0x43d319){var _0x4ba641={'sender':_0x4ad40c[_0xf914('0x49')],'description':_0x4ad40c[_0xf914('0x4a')],'content':_0x4ad40c['body'],'beep':_0x4ad40c[_0xf914('0x42')]};_0x5361fb[_0xf914('0x4b')](function(_0x1f3728){_0x4ba641[_0xf914('0x4c')]=_0x1f3728;socket['emit'](_0xf914('0x4d'),_0x4ba641);});return _0x43d319;});});})[_0xf914('0x28')](respondWithResult(_0x476839,0xc9))[_0xf914('0x4e')](handleError(_0x476839,null));};function getContent(_0x591081){return new BPromise(function(_0x1a4265,_0x4428e3){if(_0x591081[_0xf914('0x2f')]){_0x1a4265(_0x591081[_0xf914('0x2f')]);return;}return db[_0xf914('0x4f')][_0xf914('0x50')]({'attributes':[_0xf914('0x51')],'where':{'id':_0x591081['TemplateId']},'raw':!![]})[_0xf914('0x28')](function(_0x1f4e02){if(!_0x1f4e02)throw new db[(_0xf914('0x31'))][(_0xf914('0x32'))](_0xf914('0x52'));var _0x316c4f=Mustache[_0xf914('0x53')](_0x1f4e02[_0xf914('0x51')],_0x591081[_0xf914('0x34')]);_0x1a4265(_0x316c4f);})[_0xf914('0x4e')](function(_0x1dca77){_0x4428e3(_0x1dca77);});});}function getRecipients(_0x540225){return new BPromise(function(_0x194459,_0x5f5358){var _0x1cca0d=[];var _0xc127bb=[];_0x540225[_0xf914('0x4b')](function(_0x2cb389){var _0x5f9520=_['startCase'](_0x2cb389[_0xf914('0x3c')]['toLowerCase']());if(_0x5f9520===_0xf914('0x54')){_0x1cca0d=_[_0xf914('0x55')](_0x1cca0d,_0x2cb389[_0xf914('0x56')]);}else{if(_[_0xf914('0x3b')](_0x5f9520,_0xf914('0x57')))_0x5f9520=_0x5f9520[_0xf914('0x58')]('queue','Queue');_0x2cb389['ids']['forEach'](function(_0x4a755b){_0xc127bb[_0xf914('0x59')](getAgents(_0x5f9520,_0x4a755b));});}});return BPromise[_0xf914('0x5a')](_0xc127bb)[_0xf914('0x28')](function(_0x8c62c7){_0x1cca0d=_[_0xf914('0x55')](_0x1cca0d,_['flatten'](_0x8c62c7));_0x194459(_0x1cca0d);})[_0xf914('0x4e')](function(_0x197c21){_0x5f5358(_0x197c21);});});}function getAgents(_0x1bdb1c,_0x3e5c56){return new BPromise(function(_0x4ad532,_0x2e97c3){return db[_0x1bdb1c][_0xf914('0x50')]({'where':{'id':_0x3e5c56}})['then'](function(_0x54d531){return _0x54d531[_0xf914('0x5b')]({'attributes':['id'],'raw':!![]})[_0xf914('0x28')](function(_0x2a45ed){var _0x24fcb9=_[_0xf914('0x5c')](_0x2a45ed,'id');_0x4ad532(_0x24fcb9);});})[_0xf914('0x4e')](function(_0x2ef70c){_0x2e97c3(_0x2ef70c);});});} \ No newline at end of file +var _0x8b41=['stack','name','send','sendUserNotification','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','Template','findOne','html','render','catch','startCase','User','union','ids','includes','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','save','update','destroy','then','error'];(function(_0xde9708,_0x118eac){var _0x58d460=function(_0x262a49){while(--_0x262a49){_0xde9708['push'](_0xde9708['shift']());}};_0x58d460(++_0x118eac);}(_0x8b41,0x175));var _0x18b4=function(_0x4db301,_0x368b4c){_0x4db301=_0x4db301-0x0;var _0x434b36=_0x8b41[_0x4db301];return _0x434b36;};'use strict';var emlformat=require(_0x18b4('0x0'));var rimraf=require(_0x18b4('0x1'));var zipdir=require(_0x18b4('0x2'));var jsonpatch=require(_0x18b4('0x3'));var rp=require('request-promise');var moment=require(_0x18b4('0x4'));var BPromise=require(_0x18b4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x18b4('0x6'));var ejs=require(_0x18b4('0x7'));var fs=require('fs');var fs_extra=require(_0x18b4('0x8'));var _=require(_0x18b4('0x9'));var squel=require(_0x18b4('0xa'));var crypto=require(_0x18b4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x18b4('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x18b4('0xd'));var Redis=require(_0x18b4('0xe'));var authService=require(_0x18b4('0xf'));var qs=require(_0x18b4('0x10'));var as=require(_0x18b4('0x11'));var hardwareService=require(_0x18b4('0x12'));var logger=require(_0x18b4('0x13'))(_0x18b4('0x14'));var utils=require('../../config/utils');var config=require(_0x18b4('0x15'));var licenseUtil=require(_0x18b4('0x16'));var db=require(_0x18b4('0x17'))['db'];config[_0x18b4('0x18')]=_[_0x18b4('0x19')](config[_0x18b4('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x18b4('0x1a'))(new Redis(config[_0x18b4('0x18')]));require(_0x18b4('0x1b'))['register'](socket);function respondWithStatusCode(_0x161edb,_0x24c98c){_0x24c98c=_0x24c98c||0xcc;return function(_0x410612){if(_0x410612){return _0x161edb[_0x18b4('0x1c')](_0x24c98c);}return _0x161edb[_0x18b4('0x1d')](_0x24c98c)[_0x18b4('0x1e')]();};}function respondWithResult(_0x462ce0,_0x4487f1){_0x4487f1=_0x4487f1||0xc8;return function(_0x12de57){if(_0x12de57){return _0x462ce0[_0x18b4('0x1d')](_0x4487f1)['json'](_0x12de57);}};}function respondWithFilteredResult(_0x25d140,_0x452b40){return function(_0x1a896a){if(_0x1a896a){var _0x5202bb=typeof _0x452b40['offset']===_0x18b4('0x1f')&&typeof _0x452b40[_0x18b4('0x20')]===_0x18b4('0x1f');var _0x4d43e9=_0x1a896a['count'];var _0x517937=_0x5202bb?0x0:_0x452b40[_0x18b4('0x21')];var _0x235040=_0x5202bb?_0x1a896a['count']:_0x452b40[_0x18b4('0x21')]+_0x452b40[_0x18b4('0x20')];var _0x258f4f;if(_0x235040>=_0x4d43e9){_0x235040=_0x4d43e9;_0x258f4f=0xc8;}else{_0x258f4f=0xce;}_0x25d140['status'](_0x258f4f);return _0x25d140[_0x18b4('0x22')](_0x18b4('0x23'),_0x517937+'-'+_0x235040+'/'+_0x4d43e9)[_0x18b4('0x24')](_0x1a896a);}return null;};}function patchUpdates(_0x5d0434){return function(_0x414f92){try{jsonpatch[_0x18b4('0x25')](_0x414f92,_0x5d0434,!![]);}catch(_0x278f3d){return BPromise['reject'](_0x278f3d);}return _0x414f92[_0x18b4('0x26')]();};}function saveUpdates(_0xbb666b,_0x7a0f04){return function(_0x10767b){if(_0x10767b){return _0x10767b[_0x18b4('0x27')](_0xbb666b)['then'](function(_0x505420){return _0x505420;});}return null;};}function removeEntity(_0x314f78,_0x3dc7ed){return function(_0x3e50ce){if(_0x3e50ce){return _0x3e50ce[_0x18b4('0x28')]()[_0x18b4('0x29')](function(){_0x314f78[_0x18b4('0x1d')](0xcc)[_0x18b4('0x1e')]();});}};}function handleEntityNotFound(_0x4c9d63,_0x373ff4){return function(_0x25c069){if(!_0x25c069){_0x4c9d63[_0x18b4('0x1c')](0x194);}return _0x25c069;};}function handleError(_0xb3f348,_0x341806){_0x341806=_0x341806||0x1f4;return function(_0x4fd028){logger[_0x18b4('0x2a')](_0x4fd028[_0x18b4('0x2b')]);if(_0x4fd028[_0x18b4('0x2c')]){delete _0x4fd028[_0x18b4('0x2c')];}_0xb3f348[_0x18b4('0x1d')](_0x341806)[_0x18b4('0x2d')](_0x4fd028);};}exports[_0x18b4('0x2e')]=function(_0x2bddab,_0x35a692,_0x85a738){if(!_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x30')](_0x18b4('0x31'))&&!_0x2bddab[_0x18b4('0x2f')]['hasOwnProperty']('TemplateId')){throw new db[(_0x18b4('0x32'))][(_0x18b4('0x33'))](_0x18b4('0x34'));}else{if(_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x30')](_0x18b4('0x35'))&&!_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x30')](_0x18b4('0x36'))){throw new db[(_0x18b4('0x32'))][(_0x18b4('0x33'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x30')](_0x18b4('0x37'))){throw new db[(_0x18b4('0x32'))][(_0x18b4('0x33'))](_0x18b4('0x38'));}else{try{var _0x32dfb5=JSON[_0x18b4('0x39')](_0x2bddab['body'][_0x18b4('0x37')]);}catch(_0x2764db){logger[_0x18b4('0x2a')](_0x2764db);throw new db[(_0x18b4('0x32'))][(_0x18b4('0x33'))](_0x18b4('0x3a'));}var _0x58cb41=[_0x18b4('0x3b'),_0x18b4('0x3c'),'mailqueue',_0x18b4('0x3d'),_0x18b4('0x3e'),_0x18b4('0x3f'),_0x18b4('0x40'),_0x18b4('0x41'),_0x18b4('0x42')];if(_['some'](_0x32dfb5,function(_0x550a64){return!_['includes'](_0x58cb41,_0x550a64[_0x18b4('0x43')][_0x18b4('0x44')]());})){throw new db[(_0x18b4('0x32'))]['ValidationError'](_0x18b4('0x45'));}}}var _0x4a56c1={};_0x4a56c1[_0x18b4('0x46')]=_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x30')]('senderName')?_0x2bddab['body'][_0x18b4('0x46')]:_0x2bddab[_0x18b4('0x42')][_0x18b4('0x47')];_0x4a56c1[_0x18b4('0x48')]=_[_0x18b4('0x49')](_0x2bddab[_0x18b4('0x2f')][_0x18b4('0x48')])?null:_0x2bddab['body'][_0x18b4('0x48')];_0x4a56c1[_0x18b4('0x4a')]=_0x2bddab[_0x18b4('0x2f')]['beep']||![];_0x4a56c1[_0x18b4('0x4b')]=_0x2bddab['user']['id'];return getContent(_0x2bddab['body'])['then'](function(_0x526e24){_0x4a56c1[_0x18b4('0x2f')]=_0x526e24;return getRecipients(_0x32dfb5);})[_0x18b4('0x29')](function(_0x6f6756){_0x4a56c1[_0x18b4('0x4c')]=_[_0x18b4('0x4d')](_0x6f6756)[_0x18b4('0x4e')](',');return db[_0x18b4('0x4f')][_0x18b4('0x50')](function(_0x4b6130){return db[_0x18b4('0x51')][_0x18b4('0x52')](_0x4a56c1,{'raw':!![],'transaction':_0x4b6130})[_0x18b4('0x29')](function(_0x89792f){var _0x14776a={'sender':_0x4a56c1[_0x18b4('0x46')],'description':_0x4a56c1[_0x18b4('0x48')],'content':_0x4a56c1['body'],'beep':_0x4a56c1[_0x18b4('0x4a')]};_0x6f6756[_0x18b4('0x53')](function(_0x1dc9eb){_0x14776a[_0x18b4('0x54')]=_0x1dc9eb;socket[_0x18b4('0x55')]('userNotification:send',_0x14776a);});return _0x89792f;});});})[_0x18b4('0x29')](respondWithResult(_0x35a692,0xc9))['catch'](handleError(_0x35a692,null));};function getContent(_0x4a82ee){return new BPromise(function(_0x41a493,_0x2c1a50){if(_0x4a82ee[_0x18b4('0x31')]){_0x41a493(_0x4a82ee['text']);return;}return db[_0x18b4('0x56')][_0x18b4('0x57')]({'attributes':[_0x18b4('0x58')],'where':{'id':_0x4a82ee[_0x18b4('0x35')]},'raw':!![]})[_0x18b4('0x29')](function(_0x29e3de){if(!_0x29e3de)throw new db[(_0x18b4('0x32'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0xacfc72=Mustache[_0x18b4('0x59')](_0x29e3de[_0x18b4('0x58')],_0x4a82ee['view']);_0x41a493(_0xacfc72);})[_0x18b4('0x5a')](function(_0x5e4ba9){_0x2c1a50(_0x5e4ba9);});});}function getRecipients(_0x285dcd){return new BPromise(function(_0xee6856,_0x32d41e){var _0x476e84=[];var _0x1ce276=[];_0x285dcd[_0x18b4('0x53')](function(_0x5d9a26){var _0x3007f5=_[_0x18b4('0x5b')](_0x5d9a26[_0x18b4('0x43')]['toLowerCase']());if(_0x3007f5===_0x18b4('0x5c')){_0x476e84=_[_0x18b4('0x5d')](_0x476e84,_0x5d9a26[_0x18b4('0x5e')]);}else{if(_[_0x18b4('0x5f')](_0x3007f5,_0x18b4('0x60')))_0x3007f5=_0x3007f5[_0x18b4('0x61')]('queue',_0x18b4('0x62'));_0x5d9a26[_0x18b4('0x5e')][_0x18b4('0x53')](function(_0x4fdd99){_0x1ce276[_0x18b4('0x63')](getAgents(_0x3007f5,_0x4fdd99));});}});return BPromise[_0x18b4('0x64')](_0x1ce276)[_0x18b4('0x29')](function(_0x432191){_0x476e84=_['union'](_0x476e84,_[_0x18b4('0x65')](_0x432191));_0xee6856(_0x476e84);})[_0x18b4('0x5a')](function(_0x1a9dfb){_0x32d41e(_0x1a9dfb);});});}function getAgents(_0x347bd2,_0x1ed2c5){return new BPromise(function(_0xb87526,_0x578a10){return db[_0x347bd2]['findOne']({'where':{'id':_0x1ed2c5}})[_0x18b4('0x29')](function(_0x1c0b92){return _0x1c0b92[_0x18b4('0x66')]({'attributes':['id'],'raw':!![]})[_0x18b4('0x29')](function(_0x22bebf){var _0x1d457b=_[_0x18b4('0x67')](_0x22bebf,'id');_0xb87526(_0x1d457b);});})[_0x18b4('0x5a')](function(_0x9c9c2){_0x578a10(_0x9c9c2);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index f993639..964fafb 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 _0x3b1c=['../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0xdff95a,_0x1525f8){var _0x546c6d=function(_0x53f607){while(--_0x53f607){_0xdff95a['push'](_0xdff95a['shift']());}};_0x546c6d(++_0x1525f8);}(_0x3b1c,0x1ee));var _0xc3b1=function(_0x498a8d,_0xedde9c){_0x498a8d=_0x498a8d-0x0;var _0x4b2242=_0x3b1c[_0x498a8d];return _0x4b2242;};'use strict';var EventEmitter=require(_0xc3b1('0x0'));var UserNotification=require(_0xc3b1('0x1'))['db'][_0xc3b1('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xc3b1('0x3')](0x0);var events={'afterCreate':_0xc3b1('0x4'),'afterUpdate':_0xc3b1('0x5'),'afterDestroy':_0xc3b1('0x6')};function emitEvent(_0x244c22){return function(_0x440490,_0x4264a6,_0x271dac){UserNotificationEvents['emit'](_0x244c22+':'+_0x440490['id'],_0x440490);UserNotificationEvents[_0xc3b1('0x7')](_0x244c22,_0x440490);_0x271dac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xc3b1('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x1696=['../../mysqldb','UserNotification','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x2166e1,_0x4a9a63){var _0x42ada1=function(_0x1d487a){while(--_0x1d487a){_0x2166e1['push'](_0x2166e1['shift']());}};_0x42ada1(++_0x4a9a63);}(_0x1696,0x1ee));var _0x6169=function(_0x4c3c87,_0xae709d){_0x4c3c87=_0x4c3c87-0x0;var _0x1efffb=_0x1696[_0x4c3c87];return _0x1efffb;};'use strict';var EventEmitter=require(_0x6169('0x0'));var UserNotification=require(_0x6169('0x1'))['db'][_0x6169('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x6169('0x3')](0x0);var events={'afterCreate':_0x6169('0x4'),'afterUpdate':'update','afterDestroy':_0x6169('0x5')};function emitEvent(_0x50c765){return function(_0x1b379c,_0xc70b7b,_0x2ee751){UserNotificationEvents[_0x6169('0x6')](_0x50c765+':'+_0x1b379c['id'],_0x1b379c);UserNotificationEvents['emit'](_0x50c765,_0x1b379c);_0x2ee751(null);};}for(var e in events){if(events[_0x6169('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x6169('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 5db3cd4..6c553c2 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 _0xf016=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserNotification','userNotifications','utf8mb4'];(function(_0x5d7d7f,_0x49e6af){var _0x25bd25=function(_0x11bd24){while(--_0x11bd24){_0x5d7d7f['push'](_0x5d7d7f['shift']());}};_0x25bd25(++_0x49e6af);}(_0xf016,0xe1));var _0x6f01=function(_0x3b316d,_0x290f1f){_0x3b316d=_0x3b316d-0x0;var _0x14950b=_0xf016[_0x3b316d];return _0x14950b;};'use strict';var _=require(_0x6f01('0x0'));var util=require(_0x6f01('0x1'));var logger=require('../../config/logger')(_0x6f01('0x2'));var moment=require(_0x6f01('0x3'));var BPromise=require(_0x6f01('0x4'));var rp=require(_0x6f01('0x5'));var fs=require('fs');var path=require(_0x6f01('0x6'));var rimraf=require(_0x6f01('0x7'));var config=require(_0x6f01('0x8'));var attributes=require('./userNotification.attributes');module[_0x6f01('0x9')]=function(_0x59d23f,_0x4a7971){return _0x59d23f['define'](_0x6f01('0xa'),attributes,{'tableName':_0x6f01('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f01('0xc'),'collate':_0x6f01('0xd')});}; \ No newline at end of file +var _0xce24=['request-promise','../../config/environment','./userNotification.attributes','exports','userNotifications','utf8mb4','lodash','util','../../config/logger','api','bluebird'];(function(_0x84b0c9,_0x386dbc){var _0x124ab9=function(_0x58b7ed){while(--_0x58b7ed){_0x84b0c9['push'](_0x84b0c9['shift']());}};_0x124ab9(++_0x386dbc);}(_0xce24,0x119));var _0x4ce2=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xce24[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x4ce2('0x0'));var util=require(_0x4ce2('0x1'));var logger=require(_0x4ce2('0x2'))(_0x4ce2('0x3'));var moment=require('moment');var BPromise=require(_0x4ce2('0x4'));var rp=require(_0x4ce2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4ce2('0x6'));var attributes=require(_0x4ce2('0x7'));module[_0x4ce2('0x8')]=function(_0x30042c,_0x1b8e5c){return _0x30042c['define']('UserNotification',attributes,{'tableName':_0x4ce2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ce2('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 09afabd..e184948 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 _0x1f8d=['http','redis','defaults','socket.io-emitter','./userNotification.socket','register','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x2e3568,_0x19932a){var _0x40c851=function(_0x5b7c18){while(--_0x5b7c18){_0x2e3568['push'](_0x2e3568['shift']());}};_0x40c851(++_0x19932a);}(_0x1f8d,0x13a));var _0xd1f8=function(_0x613f98,_0x3985f0){_0x613f98=_0x613f98-0x0;var _0x296895=_0x1f8d[_0x613f98];return _0x296895;};'use strict';var _=require(_0xd1f8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd1f8('0x1'));var rs=require(_0xd1f8('0x2'));var fs=require('fs');var Redis=require(_0xd1f8('0x3'));var db=require(_0xd1f8('0x4'))['db'];var utils=require(_0xd1f8('0x5'));var logger=require('../../config/logger')(_0xd1f8('0x6'));var config=require(_0xd1f8('0x7'));var jayson=require(_0xd1f8('0x8'));var client=jayson[_0xd1f8('0x9')][_0xd1f8('0xa')]({'port':0x232a});config[_0xd1f8('0xb')]=_[_0xd1f8('0xc')](config[_0xd1f8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd1f8('0xd'))(new Redis(config[_0xd1f8('0xb')]));require(_0xd1f8('0xe'))[_0xd1f8('0xf')](socket);function respondWithRpcPromise(_0x42e451,_0x3d1f16,_0x3e3e2a){return new BPromise(function(_0x18acd3,_0x3bad94){return client['request'](_0x42e451,_0x3e3e2a)['then'](function(_0x58e65f){logger['info'](_0xd1f8('0x10'),_0x3d1f16,'request\x20sent');logger[_0xd1f8('0x11')](_0xd1f8('0x12'),_0x3d1f16,_0xd1f8('0x13'),JSON[_0xd1f8('0x14')](_0x58e65f));if(_0x58e65f[_0xd1f8('0x15')]){if(_0x58e65f['error'][_0xd1f8('0x16')]===0x1f4){logger[_0xd1f8('0x15')]('UserNotification,\x20%s,\x20%s',_0x3d1f16,_0x58e65f[_0xd1f8('0x15')]['message']);return _0x3bad94(_0x58e65f['error'][_0xd1f8('0x17')]);}logger['error'](_0xd1f8('0x10'),_0x3d1f16,_0x58e65f[_0xd1f8('0x15')][_0xd1f8('0x17')]);return _0x18acd3(_0x58e65f[_0xd1f8('0x15')][_0xd1f8('0x17')]);}else{logger[_0xd1f8('0x18')](_0xd1f8('0x10'),_0x3d1f16,_0xd1f8('0x13'));_0x18acd3(_0x58e65f[_0xd1f8('0x19')][_0xd1f8('0x17')]);}})[_0xd1f8('0x1a')](function(_0x3ee36c){logger['error'](_0xd1f8('0x10'),_0x3d1f16,_0x3ee36c);_0x3bad94(_0x3ee36c);});});} \ No newline at end of file +var _0xec83=['localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis'];(function(_0x53f897,_0x539857){var _0x6879f8=function(_0xa3c36){while(--_0xa3c36){_0x53f897['push'](_0x53f897['shift']());}};_0x6879f8(++_0x539857);}(_0xec83,0x1d0));var _0x3ec8=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xec83[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x3ec8('0x0'));var util=require(_0x3ec8('0x1'));var moment=require(_0x3ec8('0x2'));var BPromise=require(_0x3ec8('0x3'));var rs=require(_0x3ec8('0x4'));var fs=require('fs');var Redis=require(_0x3ec8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ec8('0x6'));var logger=require('../../config/logger')(_0x3ec8('0x7'));var config=require('../../config/environment');var jayson=require(_0x3ec8('0x8'));var client=jayson[_0x3ec8('0x9')][_0x3ec8('0xa')]({'port':0x232a});config[_0x3ec8('0xb')]=_['defaults'](config['redis'],{'host':_0x3ec8('0xc'),'port':0x18eb});var socket=require(_0x3ec8('0xd'))(new Redis(config[_0x3ec8('0xb')]));require(_0x3ec8('0xe'))[_0x3ec8('0xf')](socket);function respondWithRpcPromise(_0x152155,_0x1997f2,_0x5cae36){return new BPromise(function(_0x335116,_0x9cfd6c){return client[_0x3ec8('0x10')](_0x152155,_0x5cae36)[_0x3ec8('0x11')](function(_0x2e2026){logger[_0x3ec8('0x12')]('UserNotification,\x20%s,\x20%s',_0x1997f2,_0x3ec8('0x13'));logger[_0x3ec8('0x14')](_0x3ec8('0x15'),_0x1997f2,_0x3ec8('0x13'),JSON['stringify'](_0x2e2026));if(_0x2e2026[_0x3ec8('0x16')]){if(_0x2e2026[_0x3ec8('0x16')][_0x3ec8('0x17')]===0x1f4){logger[_0x3ec8('0x16')](_0x3ec8('0x18'),_0x1997f2,_0x2e2026['error'][_0x3ec8('0x19')]);return _0x9cfd6c(_0x2e2026[_0x3ec8('0x16')][_0x3ec8('0x19')]);}logger[_0x3ec8('0x16')](_0x3ec8('0x18'),_0x1997f2,_0x2e2026['error']['message']);return _0x335116(_0x2e2026[_0x3ec8('0x16')][_0x3ec8('0x19')]);}else{logger[_0x3ec8('0x12')]('UserNotification,\x20%s,\x20%s',_0x1997f2,_0x3ec8('0x13'));_0x335116(_0x2e2026[_0x3ec8('0x1a')]['message']);}})[_0x3ec8('0x1b')](function(_0xb31ac6){logger['error'](_0x3ec8('0x18'),_0x1997f2,_0xb31ac6);_0x9cfd6c(_0xb31ac6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index d30d10e..ca5053b 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 _0x46c6=['save','remove','register','length','userNotification:','./userNotification.events'];(function(_0x329e1b,_0x2a8efa){var _0x5186fc=function(_0x4e1265){while(--_0x4e1265){_0x329e1b['push'](_0x329e1b['shift']());}};_0x5186fc(++_0x2a8efa);}(_0x46c6,0x1d9));var _0x646c=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x46c6[_0x2e4e19];return _0x9ba20b;};'use strict';var UserNotificationEvents=require(_0x646c('0x0'));var events=[_0x646c('0x1'),_0x646c('0x2'),'update'];function createListener(_0x5971ca,_0x410235){return function(_0x566ee6){_0x410235['emit'](_0x5971ca,_0x566ee6);};}function removeListener(_0x5bb67c,_0x425698){return function(){UserNotificationEvents['removeListener'](_0x5bb67c,_0x425698);};}exports[_0x646c('0x3')]=function(_0x3c82ae){for(var _0x554c9f=0x0,_0x1cfe1f=events[_0x646c('0x4')];_0x554c9f<_0x1cfe1f;_0x554c9f++){var _0x2664a8=events[_0x554c9f];var _0x51f949=createListener(_0x646c('0x5')+_0x2664a8,_0x3c82ae);UserNotificationEvents['on'](_0x2664a8,_0x51f949);}}; \ No newline at end of file +var _0x5560=['length','userNotification:','./userNotification.events','save','remove','update','register'];(function(_0x56500a,_0x5953c7){var _0x333977=function(_0x374007){while(--_0x374007){_0x56500a['push'](_0x56500a['shift']());}};_0x333977(++_0x5953c7);}(_0x5560,0x113));var _0x0556=function(_0x871ef0,_0x167b63){_0x871ef0=_0x871ef0-0x0;var _0x4e9fbf=_0x5560[_0x871ef0];return _0x4e9fbf;};'use strict';var UserNotificationEvents=require(_0x0556('0x0'));var events=[_0x0556('0x1'),_0x0556('0x2'),_0x0556('0x3')];function createListener(_0x5b693e,_0x4b1c5c){return function(_0xa9119){_0x4b1c5c['emit'](_0x5b693e,_0xa9119);};}function removeListener(_0x4cbe5b,_0x35aab5){return function(){UserNotificationEvents['removeListener'](_0x4cbe5b,_0x35aab5);};}exports[_0x0556('0x4')]=function(_0x271d96){for(var _0x5e153f=0x0,_0xc97486=events[_0x0556('0x5')];_0x5e153f<_0xc97486;_0x5e153f++){var _0x19da15=events[_0x5e153f];var _0x473d97=createListener(_0x0556('0x6')+_0x19da15,_0x271d96);UserNotificationEvents['on'](_0x19da15,_0x473d97);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 37ce0a8..464d76c 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x279d04,_0xa8f6f4){var _0x41b3de=function(_0x236aef){while(--_0x236aef){_0x279d04['push'](_0x279d04['shift']());}};_0x41b3de(++_0xa8f6f4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0xcb91[_0x119705];return _0x2affc2;};'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(_0x4361c1,_0x175703){var _0x7d47bd=function(_0x185980){while(--_0x185980){_0x4361c1['push'](_0x4361c1['shift']());}};_0x7d47bd(++_0x175703);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 9006424..e78df57 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. * // * * // ************************************************************************* -'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xde02=['sequelize','exports','INTEGER'];(function(_0x54bf3f,_0x1963ab){var _0x2db7d4=function(_0x4971d7){while(--_0x4971d7){_0x54bf3f['push'](_0x54bf3f['shift']());}};_0x2db7d4(++_0x1963ab);}(_0xde02,0xd5));var _0x2de0=function(_0x469f7b,_0x475956){_0x469f7b=_0x469f7b-0x0;var _0x3addce=_0xde02[_0x469f7b];return _0x3addce;};'use strict';var Sequelize=require(_0x2de0('0x0'));module[_0x2de0('0x1')]={'penalty':{'type':Sequelize[_0x2de0('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 eea9145..43e147a 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 _0x3b6e=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4f4ca5,_0x4c02b8){var _0x4a2021=function(_0x1fb3dc){while(--_0x1fb3dc){_0x4f4ca5['push'](_0x4f4ca5['shift']());}};_0x4a2021(++_0x4c02b8);}(_0x3b6e,0xa0));var _0xe3b6=function(_0x411cb9,_0x264b9c){_0x411cb9=_0x411cb9-0x0;var _0x26981a=_0x3b6e[_0x411cb9];return _0x26981a;};'use strict';var _=require(_0xe3b6('0x0'));var util=require(_0xe3b6('0x1'));var logger=require(_0xe3b6('0x2'))('api');var moment=require(_0xe3b6('0x3'));var BPromise=require(_0xe3b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3b6('0x5'));var rimraf=require(_0xe3b6('0x6'));var config=require(_0xe3b6('0x7'));var attributes=require(_0xe3b6('0x8'));module[_0xe3b6('0x9')]=function(_0x497b76,_0x28970a){return _0x497b76[_0xe3b6('0xa')](_0xe3b6('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb88f=['rimraf','../../config/environment','exports','UserOpenchannelQueue','util','api','bluebird','request-promise','path'];(function(_0x34ced0,_0x21907f){var _0x3db58d=function(_0x51fb31){while(--_0x51fb31){_0x34ced0['push'](_0x34ced0['shift']());}};_0x3db58d(++_0x21907f);}(_0xb88f,0x124));var _0xfb88=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0xb88f[_0x5c6994];return _0x1d5c84;};'use strict';var _=require('lodash');var util=require(_0xfb88('0x0'));var logger=require('../../config/logger')(_0xfb88('0x1'));var moment=require('moment');var BPromise=require(_0xfb88('0x2'));var rp=require(_0xfb88('0x3'));var fs=require('fs');var path=require(_0xfb88('0x4'));var rimraf=require(_0xfb88('0x5'));var config=require(_0xfb88('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xfb88('0x7')]=function(_0x299565,_0x11ba28){return _0x299565['define'](_0xfb88('0x8'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index b02ea88..d1e6f99 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 _0x1915=['stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','util','moment','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1de787,_0x55e79d){var _0x14aa44=function(_0x297a90){while(--_0x297a90){_0x1de787['push'](_0x1de787['shift']());}};_0x14aa44(++_0x55e79d);}(_0x1915,0x15b));var _0x5191=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x1915[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x5191('0x0'));var moment=require(_0x5191('0x1'));var BPromise=require('bluebird');var rs=require(_0x5191('0x2'));var fs=require('fs');var Redis=require(_0x5191('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5191('0x4'));var config=require('../../config/environment');var jayson=require(_0x5191('0x5'));var client=jayson[_0x5191('0x6')][_0x5191('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1770e5,_0x22a71,_0x29725a){return new BPromise(function(_0xe47e89,_0x5ea75d){return client[_0x5191('0x8')](_0x1770e5,_0x29725a)[_0x5191('0x9')](function(_0x3ce465){logger[_0x5191('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x22a71,_0x5191('0xb'));logger[_0x5191('0xc')](_0x5191('0xd'),_0x22a71,_0x5191('0xb'),JSON[_0x5191('0xe')](_0x3ce465));if(_0x3ce465['error']){if(_0x3ce465['error']['code']===0x1f4){logger[_0x5191('0xf')](_0x5191('0x10'),_0x22a71,_0x3ce465['error'][_0x5191('0x11')]);return _0x5ea75d(_0x3ce465['error'][_0x5191('0x11')]);}logger[_0x5191('0xf')](_0x5191('0x10'),_0x22a71,_0x3ce465[_0x5191('0xf')][_0x5191('0x11')]);return _0xe47e89(_0x3ce465[_0x5191('0xf')][_0x5191('0x11')]);}else{logger[_0x5191('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x22a71,_0x5191('0xb'));_0xe47e89(_0x3ce465['result'][_0x5191('0x11')]);}})[_0x5191('0x12')](function(_0x55a02f){logger[_0x5191('0xf')](_0x5191('0x10'),_0x22a71,_0x55a02f);_0x5ea75d(_0x55a02f);});});} \ No newline at end of file +var _0x0bb0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0bb0,0xf2));var _0x00bb=function(_0x16e684,_0x193aee){_0x16e684=_0x16e684-0x0;var _0xefc256=_0x0bb0[_0x16e684];return _0xefc256;};'use strict';var _=require(_0x00bb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x00bb('0x1'));var rs=require(_0x00bb('0x2'));var fs=require('fs');var Redis=require(_0x00bb('0x3'));var db=require(_0x00bb('0x4'))['db'];var utils=require(_0x00bb('0x5'));var logger=require(_0x00bb('0x6'))(_0x00bb('0x7'));var config=require(_0x00bb('0x8'));var jayson=require(_0x00bb('0x9'));var client=jayson['client'][_0x00bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24acac,_0x9d95ec,_0x4107ba){return new BPromise(function(_0x1aef0d,_0x40e2ff){return client['request'](_0x24acac,_0x4107ba)[_0x00bb('0xb')](function(_0x1ce56f){logger['info'](_0x00bb('0xc'),_0x9d95ec,_0x00bb('0xd'));logger['debug'](_0x00bb('0xe'),_0x9d95ec,_0x00bb('0xd'),JSON['stringify'](_0x1ce56f));if(_0x1ce56f[_0x00bb('0xf')]){if(_0x1ce56f['error']['code']===0x1f4){logger[_0x00bb('0xf')](_0x00bb('0xc'),_0x9d95ec,_0x1ce56f['error'][_0x00bb('0x10')]);return _0x40e2ff(_0x1ce56f[_0x00bb('0xf')][_0x00bb('0x10')]);}logger['error'](_0x00bb('0xc'),_0x9d95ec,_0x1ce56f['error']['message']);return _0x1aef0d(_0x1ce56f[_0x00bb('0xf')][_0x00bb('0x10')]);}else{logger['info'](_0x00bb('0xc'),_0x9d95ec,'request\x20sent');_0x1aef0d(_0x1ce56f[_0x00bb('0x11')][_0x00bb('0x10')]);}})[_0x00bb('0x12')](function(_0x315144){logger[_0x00bb('0xf')](_0x00bb('0xc'),_0x9d95ec,_0x315144);_0x40e2ff(_0x315144);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index df4bb39..93728a4 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 _0x2283=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','create','/:id/clone','clone','post','addResources','put','update','delete','removeSections','removeResources','multer','util','express','Router','fs-extra'];(function(_0x308213,_0x224541){var _0x2e1619=function(_0x972b51){while(--_0x972b51){_0x308213['push'](_0x308213['shift']());}};_0x2e1619(++_0x224541);}(_0x2283,0x167));var _0x3228=function(_0x493fbb,_0x220663){_0x493fbb=_0x493fbb-0x0;var _0x522868=_0x2283[_0x493fbb];return _0x522868;};'use strict';var multer=require(_0x3228('0x0'));var util=require(_0x3228('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3228('0x2'));var router=express[_0x3228('0x3')]();var fs_extra=require(_0x3228('0x4'));var auth=require(_0x3228('0x5'));var interaction=require(_0x3228('0x6'));var config=require(_0x3228('0x7'));var controller=require('./userProfile.controller');router[_0x3228('0x8')]('/',auth[_0x3228('0x9')](),controller['index']);router[_0x3228('0x8')](_0x3228('0xa'),auth[_0x3228('0x9')](),controller[_0x3228('0xb')]);router[_0x3228('0x8')](_0x3228('0xc'),auth[_0x3228('0x9')](),controller[_0x3228('0xd')]);router[_0x3228('0x8')](_0x3228('0xe'),auth[_0x3228('0x9')](),controller[_0x3228('0xf')]);router[_0x3228('0x8')](_0x3228('0x10'),auth[_0x3228('0x9')](),controller[_0x3228('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3228('0x12')]);router['post'](_0x3228('0x13'),auth[_0x3228('0x9')](),controller[_0x3228('0x14')]);router['post'](_0x3228('0xe'),auth[_0x3228('0x9')](),controller['addSections']);router[_0x3228('0x15')](_0x3228('0x10'),auth[_0x3228('0x9')](),controller[_0x3228('0x16')]);router[_0x3228('0x17')](_0x3228('0xc'),auth[_0x3228('0x9')](),controller[_0x3228('0x18')]);router['delete'](_0x3228('0xc'),auth[_0x3228('0x9')](),controller['destroy']);router[_0x3228('0x19')](_0x3228('0xe'),auth['isAuthenticated'](),controller[_0x3228('0x1a')]);router[_0x3228('0x19')](_0x3228('0x10'),auth[_0x3228('0x9')](),controller[_0x3228('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x10a1=['clone','addResources','update','delete','destroy','removeSections','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone'];(function(_0x2a2ece,_0x29cb59){var _0x221838=function(_0x4cd1f9){while(--_0x4cd1f9){_0x2a2ece['push'](_0x2a2ece['shift']());}};_0x221838(++_0x29cb59);}(_0x10a1,0x172));var _0x110a=function(_0x4e506a,_0x58869e){_0x4e506a=_0x4e506a-0x0;var _0x51d0f3=_0x10a1[_0x4e506a];return _0x51d0f3;};'use strict';var multer=require(_0x110a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x110a('0x1'));var express=require(_0x110a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x110a('0x3'));var interaction=require(_0x110a('0x4'));var config=require(_0x110a('0x5'));var controller=require(_0x110a('0x6'));router[_0x110a('0x7')]('/',auth[_0x110a('0x8')](),controller[_0x110a('0x9')]);router[_0x110a('0x7')](_0x110a('0xa'),auth[_0x110a('0x8')](),controller['describe']);router[_0x110a('0x7')](_0x110a('0xb'),auth['isAuthenticated'](),controller[_0x110a('0xc')]);router[_0x110a('0x7')](_0x110a('0xd'),auth[_0x110a('0x8')](),controller[_0x110a('0xe')]);router['get'](_0x110a('0xf'),auth[_0x110a('0x8')](),controller[_0x110a('0x10')]);router[_0x110a('0x11')]('/',auth[_0x110a('0x8')](),controller[_0x110a('0x12')]);router[_0x110a('0x11')](_0x110a('0x13'),auth['isAuthenticated'](),controller[_0x110a('0x14')]);router[_0x110a('0x11')]('/:id/sections',auth[_0x110a('0x8')](),controller['addSections']);router[_0x110a('0x11')](_0x110a('0xf'),auth[_0x110a('0x8')](),controller[_0x110a('0x15')]);router['put'](_0x110a('0xb'),auth[_0x110a('0x8')](),controller[_0x110a('0x16')]);router[_0x110a('0x17')]('/:id',auth[_0x110a('0x8')](),controller[_0x110a('0x18')]);router[_0x110a('0x17')](_0x110a('0xd'),auth[_0x110a('0x8')](),controller[_0x110a('0x19')]);router['delete']('/:id/resources',auth['isAuthenticated'](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 51c71c8..38c9ba7 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 _0xde52=['STRING','setDataValue','crudPermissions','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x5089d6,_0x3fe08d){var _0xff68d6=function(_0x163660){while(--_0x163660){_0x5089d6['push'](_0x5089d6['shift']());}};_0xff68d6(++_0x3fe08d);}(_0xde52,0x66));var _0x2de5=function(_0x4d916f,_0x59fab1){_0x4d916f=_0x4d916f-0x0;var _0x267390=_0xde52[_0x4d916f];return _0x267390;};'use strict';var Sequelize=require(_0x2de5('0x0'));module[_0x2de5('0x1')]={'name':{'type':Sequelize[_0x2de5('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x2de5('0x2')],'set':function(_0x4f9044){this[_0x2de5('0x3')](_0x2de5('0x4'),_0x4f9044?_0x4f9044['join'](''):[]);},'get':function(){return this[_0x2de5('0x5')](_0x2de5('0x4'))?this[_0x2de5('0x5')](_0x2de5('0x4'))[_0x2de5('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2de5('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x2de5('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2de5('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2de5('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2de5('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2de5('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2de5('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb3e0=['BOOLEAN','exports','STRING','setDataValue','crudPermissions','getDataValue'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb3e0,0x1e7));var _0x0b3e=function(_0x2cb441,_0x56ea22){_0x2cb441=_0x2cb441-0x0;var _0x290548=_0xb3e0[_0x2cb441];return _0x290548;};'use strict';var Sequelize=require('sequelize');module[_0x0b3e('0x0')]={'name':{'type':Sequelize[_0x0b3e('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x0b3e('0x1')],'set':function(_0x1f10a3){this[_0x0b3e('0x2')](_0x0b3e('0x3'),_0x1f10a3?_0x1f10a3['join'](''):[]);},'get':function(){return this['getDataValue'](_0x0b3e('0x3'))?this[_0x0b3e('0x4')](_0x0b3e('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0b3e('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0b3e('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 1637a69..09efcba 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 _0x62cf=['addSections','transaction','userProfileId','push','removeSections','getSections','enabled','includes','sectionId','isEmpty','subsections','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','Missing\x20section\x20parameter','nolimit','eml-format','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./userProfile.socket','sendStatus','end','status','json','offset','undefined','count','limit','apply','reject','destroy','error','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','UserProfile','findAll','rows','show','params','length','include','find','create','body','catch','get','createdAt','crudPermissions','omit','updatedAt','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','Resources','update','describe'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x62cf,0x81));var _0xf62c=function(_0x455596,_0x132d09){_0x455596=_0x455596-0x0;var _0x27363a=_0x62cf[_0x455596];return _0x27363a;};'use strict';var emlformat=require(_0xf62c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf62c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf62c('0x2'));var moment=require(_0xf62c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf62c('0x4'));var path=require(_0xf62c('0x5'));var sox=require(_0xf62c('0x6'));var csv=require(_0xf62c('0x7'));var ejs=require(_0xf62c('0x8'));var fs=require('fs');var fs_extra=require(_0xf62c('0x9'));var _=require(_0xf62c('0xa'));var squel=require(_0xf62c('0xb'));var crypto=require(_0xf62c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf62c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf62c('0xe'));var Papa=require(_0xf62c('0xf'));var Redis=require(_0xf62c('0x10'));var authService=require(_0xf62c('0x11'));var qs=require(_0xf62c('0x12'));var as=require(_0xf62c('0x13'));var hardwareService=require(_0xf62c('0x14'));var logger=require(_0xf62c('0x15'))(_0xf62c('0x16'));var utils=require(_0xf62c('0x17'));var config=require(_0xf62c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf62c('0x19'))['db'];config['redis']=_['defaults'](config[_0xf62c('0x1a')],{'host':_0xf62c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf62c('0x1a')]));require(_0xf62c('0x1c'))['register'](socket);function respondWithStatusCode(_0x1c47fa,_0x4a5cba){_0x4a5cba=_0x4a5cba||0xcc;return function(_0x265253){if(_0x265253){return _0x1c47fa[_0xf62c('0x1d')](_0x4a5cba);}return _0x1c47fa['status'](_0x4a5cba)[_0xf62c('0x1e')]();};}function respondWithResult(_0x3ffb03,_0x55bba7){_0x55bba7=_0x55bba7||0xc8;return function(_0x29aece){if(_0x29aece){return _0x3ffb03[_0xf62c('0x1f')](_0x55bba7)[_0xf62c('0x20')](_0x29aece);}};}function respondWithFilteredResult(_0x5c087b,_0x25c80c){return function(_0xc7da63){if(_0xc7da63){var _0x8180f3=typeof _0x25c80c[_0xf62c('0x21')]===_0xf62c('0x22')&&typeof _0x25c80c['limit']===_0xf62c('0x22');var _0xad689c=_0xc7da63[_0xf62c('0x23')];var _0x55a475=_0x8180f3?0x0:_0x25c80c['offset'];var _0x3ae15e=_0x8180f3?_0xc7da63[_0xf62c('0x23')]:_0x25c80c[_0xf62c('0x21')]+_0x25c80c[_0xf62c('0x24')];var _0x23bf2b;if(_0x3ae15e>=_0xad689c){_0x3ae15e=_0xad689c;_0x23bf2b=0xc8;}else{_0x23bf2b=0xce;}_0x5c087b['status'](_0x23bf2b);return _0x5c087b['set']('Content-Range',_0x55a475+'-'+_0x3ae15e+'/'+_0xad689c)[_0xf62c('0x20')](_0xc7da63);}return null;};}function patchUpdates(_0x1c883c){return function(_0x4490ed){try{jsonpatch[_0xf62c('0x25')](_0x4490ed,_0x1c883c,!![]);}catch(_0x34bf70){return BPromise[_0xf62c('0x26')](_0x34bf70);}return _0x4490ed['save']();};}function saveUpdates(_0x33b572,_0x120077){return function(_0x424660){if(_0x424660){return _0x424660['update'](_0x33b572)['then'](function(_0x48541f){return _0x48541f;});}return null;};}function removeEntity(_0x496992,_0x2165ae){return function(_0x5c4e52){if(_0x5c4e52){return _0x5c4e52[_0xf62c('0x27')]()['then'](function(){_0x496992[_0xf62c('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9da128,_0x41c49f){return function(_0x439f48){if(!_0x439f48){_0x9da128[_0xf62c('0x1d')](0x194);}return _0x439f48;};}function handleError(_0xbaa5a0,_0x4d00ab){_0x4d00ab=_0x4d00ab||0x1f4;return function(_0x1ecd60){logger[_0xf62c('0x28')](_0x1ecd60[_0xf62c('0x29')]);if(_0x1ecd60[_0xf62c('0x2a')]){delete _0x1ecd60[_0xf62c('0x2a')];}_0xbaa5a0[_0xf62c('0x1f')](_0x4d00ab)[_0xf62c('0x2b')](_0x1ecd60);};}exports[_0xf62c('0x2c')]=function(_0x19b820,_0x1862eb){var _0x554fce={},_0x398d1c={},_0x1aaeb9={'count':0x0,'rows':[]};var _0x56ec5f=_[_0xf62c('0x2d')](db['UserProfile'][_0xf62c('0x2e')],function(_0x20895e){return{'name':_0x20895e['fieldName'],'type':_0x20895e['type'][_0xf62c('0x2f')]};});_0x398d1c[_0xf62c('0x30')]=_['map'](_0x56ec5f,_0xf62c('0x2a'));_0x398d1c['query']=_[_0xf62c('0x31')](_0x19b820[_0xf62c('0x32')]);_0x398d1c[_0xf62c('0x33')]=_[_0xf62c('0x34')](_0x398d1c['model'],_0x398d1c['query']);_0x554fce[_0xf62c('0x35')]=_['intersection'](_0x398d1c[_0xf62c('0x30')],qs['fields'](_0x19b820[_0xf62c('0x32')][_0xf62c('0x36')]));_0x554fce[_0xf62c('0x35')]=_0x554fce[_0xf62c('0x35')]['length']?_0x554fce[_0xf62c('0x35')]:_0x398d1c[_0xf62c('0x30')];if(!_0x19b820[_0xf62c('0x32')][_0xf62c('0x37')]('nolimit')){_0x554fce[_0xf62c('0x24')]=qs[_0xf62c('0x24')](_0x19b820['query'][_0xf62c('0x24')]);_0x554fce[_0xf62c('0x21')]=qs[_0xf62c('0x21')](_0x19b820[_0xf62c('0x32')][_0xf62c('0x21')]);}_0x554fce[_0xf62c('0x38')]=qs[_0xf62c('0x39')](_0x19b820[_0xf62c('0x32')][_0xf62c('0x39')]);_0x554fce[_0xf62c('0x3a')]=qs[_0xf62c('0x33')](_[_0xf62c('0x3b')](_0x19b820[_0xf62c('0x32')],_0x398d1c[_0xf62c('0x33')]),_0x56ec5f);if(_0x19b820[_0xf62c('0x32')][_0xf62c('0x3c')]){_0x554fce[_0xf62c('0x3a')]=_[_0xf62c('0x3d')](_0x554fce[_0xf62c('0x3a')],{'$or':_[_0xf62c('0x2d')](_0x56ec5f,function(_0x499d19){if(_0x499d19[_0xf62c('0x3e')]!==_0xf62c('0x3f')){var _0x18c174={};_0x18c174[_0x499d19[_0xf62c('0x2a')]]={'$like':'%'+_0x19b820['query'][_0xf62c('0x3c')]+'%'};return _0x18c174;}})});}_0x554fce=_[_0xf62c('0x3d')]({},_0x554fce,_0x19b820[_0xf62c('0x40')]);var _0x10bc4c={'where':_0x554fce[_0xf62c('0x3a')]};return db['UserProfile']['count'](_0x10bc4c)[_0xf62c('0x41')](function(_0x588ad1){_0x1aaeb9[_0xf62c('0x23')]=_0x588ad1;if(_0x19b820[_0xf62c('0x32')][_0xf62c('0x42')]){_0x554fce['include']=[{'all':!![]}];}return db[_0xf62c('0x43')][_0xf62c('0x44')](_0x554fce);})[_0xf62c('0x41')](function(_0x3a550c){_0x1aaeb9[_0xf62c('0x45')]=_0x3a550c;return _0x1aaeb9;})[_0xf62c('0x41')](respondWithFilteredResult(_0x1862eb,_0x554fce))['catch'](handleError(_0x1862eb,null));};exports[_0xf62c('0x46')]=function(_0x4d0248,_0x40f2d9){var _0x311e77={'raw':![],'where':{'id':_0x4d0248[_0xf62c('0x47')]['id']}},_0x197769={};_0x197769[_0xf62c('0x30')]=_[_0xf62c('0x31')](db[_0xf62c('0x43')][_0xf62c('0x2e')]);_0x197769[_0xf62c('0x32')]=_['keys'](_0x4d0248[_0xf62c('0x32')]);_0x197769[_0xf62c('0x33')]=_['intersection'](_0x197769['model'],_0x197769[_0xf62c('0x32')]);_0x311e77['attributes']=_[_0xf62c('0x34')](_0x197769[_0xf62c('0x30')],qs['fields'](_0x4d0248[_0xf62c('0x32')]['fields']));_0x311e77[_0xf62c('0x35')]=_0x311e77['attributes'][_0xf62c('0x48')]?_0x311e77['attributes']:_0x197769[_0xf62c('0x30')];if(_0x4d0248[_0xf62c('0x32')][_0xf62c('0x42')]){_0x311e77[_0xf62c('0x49')]=[{'all':!![]}];}_0x311e77=_['merge']({},_0x311e77,_0x4d0248[_0xf62c('0x40')]);return db[_0xf62c('0x43')][_0xf62c('0x4a')](_0x311e77)[_0xf62c('0x41')](handleEntityNotFound(_0x40f2d9,null))[_0xf62c('0x41')](respondWithResult(_0x40f2d9,null))['catch'](handleError(_0x40f2d9,null));};exports[_0xf62c('0x4b')]=function(_0x2d8e15,_0x41efdf){return db[_0xf62c('0x43')][_0xf62c('0x4b')](_0x2d8e15[_0xf62c('0x4c')],{})[_0xf62c('0x41')](respondWithResult(_0x41efdf,0xc9))[_0xf62c('0x4d')](handleError(_0x41efdf,null));};exports['clone']=function(_0x236d87,_0x24e405){var _0x501461={'where':{'id':_0x236d87['params']['id']}},_0x112ddf={};_0x112ddf['model']=_[_0xf62c('0x31')](db[_0xf62c('0x43')]['rawAttributes']);_0x501461[_0xf62c('0x35')]=_['intersection'](_0x112ddf[_0xf62c('0x30')],qs[_0xf62c('0x36')](_0x236d87[_0xf62c('0x32')][_0xf62c('0x36')]));_0x501461[_0xf62c('0x35')]=_0x501461[_0xf62c('0x35')][_0xf62c('0x48')]?_0x501461[_0xf62c('0x35')]:_0x112ddf[_0xf62c('0x30')];if(_0x236d87[_0xf62c('0x32')][_0xf62c('0x42')]){_0x501461[_0xf62c('0x49')]=[{'all':!![]}];}_0x501461=_[_0xf62c('0x3d')]({},_0x501461,_0x236d87['options']);return db[_0xf62c('0x43')][_0xf62c('0x4a')](_0x501461)[_0xf62c('0x41')](handleEntityNotFound(_0x24e405,null))['then'](function(_0x1e5a24){if(_0x1e5a24){var _0x13e8bb=_0x1e5a24[_0xf62c('0x4e')]({'plain':!![]});_0x13e8bb=qs['omit'](_0x13e8bb,['id',_0xf62c('0x4f'),'updatedAt',_0xf62c('0x50')]);_0x236d87['body']=_[_0xf62c('0x51')](_0x236d87['body'],['id',_0xf62c('0x4f'),_0xf62c('0x52')]);return db[_0xf62c('0x53')]['transaction'](function(_0x4b8117){return db[_0xf62c('0x43')][_0xf62c('0x4b')](_[_0xf62c('0x3d')](_0x13e8bb,_0x236d87[_0xf62c('0x4c')]),{'include':_0x236d87[_0xf62c('0x32')][_0xf62c('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x4b8117})[_0xf62c('0x41')](function(_0x4289f5){var _0x267344=_0x4289f5[_0xf62c('0x4e')]({'plain':!![]});return db[_0xf62c('0x54')][_0xf62c('0x44')]({'where':{'userProfileId':_0x236d87[_0xf62c('0x47')]['id']},'raw':!![]})[_0xf62c('0x41')](function(_0x25003a){if(_0x25003a){return BPromise[_0xf62c('0x55')](_0x25003a,function(_0x4a6833){return new BPromise(function(_0x307eab,_0x4d5b80){if(_0x4a6833[_0xf62c('0x56')]===null||_0x4a6833[_0xf62c('0x56')]===0x1)_0x307eab(null);return db[_0xf62c('0x57')][_0xf62c('0x44')]({'where':{'sectionId':_0x4a6833['id']},'raw':!![]})[_0xf62c('0x41')](function(_0x6f8e86){var _0x3a57a8=_[_0xf62c('0x2d')](_0x6f8e86,function(_0x3cfe0f){return qs[_0xf62c('0x51')](_0x3cfe0f,['id',_0xf62c('0x4f'),_0xf62c('0x52'),'sectionId']);});_0x307eab(_0x3a57a8);})[_0xf62c('0x4d')](function(_0x2e0b24){_0x4d5b80(_0x2e0b24);});})['then'](function(_0x30c8ef){var _0x38c458=qs[_0xf62c('0x51')](_0x4a6833,['id','createdAt',_0xf62c('0x52')]);_0x38c458['userProfileId']=_0x267344['id'];if(_0x30c8ef)_0x38c458[_0xf62c('0x58')]=_0x30c8ef;return _0x38c458;})[_0xf62c('0x41')](function(_0x5020fa){return db['UserProfileSection'][_0xf62c('0x4b')](_0x5020fa,{'include':[{'model':db[_0xf62c('0x57')],'as':_0xf62c('0x58')}],'raw':!![],'transaction':_0x4b8117});});})['then'](function(){return _0x267344;});}});});});}})['then'](respondWithResult(_0x24e405,0xc9))['catch'](handleError(_0x24e405,null));};exports[_0xf62c('0x59')]=function(_0x51568e,_0x1361ca){if(_0x51568e[_0xf62c('0x4c')]['id']){delete _0x51568e[_0xf62c('0x4c')]['id'];}return db[_0xf62c('0x43')][_0xf62c('0x4a')]({'where':{'id':_0x51568e[_0xf62c('0x47')]['id']}})[_0xf62c('0x41')](handleEntityNotFound(_0x1361ca,null))[_0xf62c('0x41')](saveUpdates(_0x51568e[_0xf62c('0x4c')],null))[_0xf62c('0x41')](respondWithResult(_0x1361ca,null))[_0xf62c('0x4d')](handleError(_0x1361ca,null));};exports['destroy']=function(_0x26d55f,_0x18f8d4){return db[_0xf62c('0x43')][_0xf62c('0x4a')]({'where':{'id':_0x26d55f[_0xf62c('0x47')]['id']}})['then'](handleEntityNotFound(_0x18f8d4,null))['then'](removeEntity(_0x18f8d4,null))[_0xf62c('0x4d')](handleError(_0x18f8d4,null));};exports['describe']=function(_0x3a59f7,_0x4a7cb3){return db[_0xf62c('0x43')][_0xf62c('0x5a')]()['then'](respondWithResult(_0x4a7cb3,null))['catch'](handleError(_0x4a7cb3,null));};exports[_0xf62c('0x5b')]=function(_0x11aec2,_0x30f424){var _0x2e2c7e=_0x11aec2['body'];return db[_0xf62c('0x43')][_0xf62c('0x4a')]({'where':{'id':_0x11aec2[_0xf62c('0x47')]['id']}})[_0xf62c('0x41')](handleEntityNotFound(_0x30f424,null))['then'](function(_0x561b58){if(_0x561b58){return db[_0xf62c('0x53')][_0xf62c('0x5c')](function(_0x476ddc){return db['UserProfileSection'][_0xf62c('0x27')]({'where':{'userProfileId':_0x11aec2['params']['id'],'sectionId':_[_0xf62c('0x2d')](_0x2e2c7e,function(_0x2e45a3){return _0x2e45a3['sectionId'];})},'transaction':_0x476ddc})[_0xf62c('0x41')](function(){var _0x38e41d=_[_0xf62c('0x2d')](_0x2e2c7e,function(_0x5113ab){_0x5113ab[_0xf62c('0x5d')]=_0x11aec2[_0xf62c('0x47')]['id'];return _0x5113ab;});var _0x3ce580=[];return BPromise['each'](_0x38e41d,function(_0x4d639b){return db[_0xf62c('0x54')][_0xf62c('0x4b')](_0x4d639b,{'include':[{'model':db['UserProfileResource'],'as':_0xf62c('0x58')}],'raw':!![],'transaction':_0x476ddc})[_0xf62c('0x41')](function(_0xcd46d2){_0x3ce580[_0xf62c('0x5e')](_0xcd46d2[_0xf62c('0x4e')]({'plain':!![]}));});})[_0xf62c('0x41')](function(){return _0x3ce580;});});});}})[_0xf62c('0x41')](function(_0x4eb0ae){return _0x4eb0ae;})['then'](respondWithResult(_0x30f424,null))[_0xf62c('0x4d')](handleError(_0x30f424,null));};exports[_0xf62c('0x5f')]=function(_0x5d9f68,_0x1bc9dc){var _0x14ef34;return db[_0xf62c('0x43')]['find']({'where':{'id':_0x5d9f68[_0xf62c('0x47')]['id']},'attributes':['id',_0xf62c('0x2a')]})[_0xf62c('0x41')](handleEntityNotFound(_0x1bc9dc,null))['then'](function(_0x37ef58){if(_0x37ef58){_0x14ef34=_0x37ef58;return db[_0xf62c('0x54')][_0xf62c('0x27')]({'where':{'userProfileId':_0x5d9f68[_0xf62c('0x47')]['id'],'sectionId':_0x5d9f68['query']['ids']}});}})[_0xf62c('0x41')](function(){return _0x14ef34;})[_0xf62c('0x41')](respondWithStatusCode(_0x1bc9dc,null))[_0xf62c('0x4d')](handleError(_0x1bc9dc,null));};exports[_0xf62c('0x60')]=function(_0x48ea18,_0x4ae41e){var _0x2906ac=[];var _0x406f21=[];return db[_0xf62c('0x54')][_0xf62c('0x44')]({'where':{'userProfileId':_0x48ea18['params']['id']},'raw':!![]})[_0xf62c('0x41')](function(_0x54d966){_0x2906ac=_[_0xf62c('0x3c')](_0x54d966,function(_0x435ab7){return _0x435ab7[_0xf62c('0x61')]===0x1||_[_0xf62c('0x62')]([0x3eb,0x709],_0x435ab7[_0xf62c('0x63')]);});if(!_[_0xf62c('0x64')](_0x2906ac)){return _[_0xf62c('0x2d')](_0x2906ac,function(_0x454643){return _0x454643['sectionId'];});}else{return;}})[_0xf62c('0x41')](function(_0x41eabb){if(_0x41eabb)_0x406f21=_0x41eabb;if(_['includes'](_0x406f21,0x64)){var _0x517d56=_['find'](_0x2906ac,{'sectionId':0x64});return hasDefaultDashboard(_0x517d56)[_0xf62c('0x41')](function(_0x5e6bf3){return _['map'](_0x2906ac,function(_0x15db4e){if(_0x15db4e[_0xf62c('0x63')]===0x64){_0x15db4e['subsections']=_0x5e6bf3;}return _0x15db4e;});});}else{return;}})[_0xf62c('0x41')](function(_0x1cf053){if(_0x1cf053)_0x2906ac=_0x1cf053;if(_[_0xf62c('0x62')](_0x406f21,0x3eb)){var _0x3c13f5=_[_0xf62c('0x4a')](_0x2906ac,{'sectionId':0x3eb});return getCustomDashboards(_0x3c13f5)[_0xf62c('0x41')](function(_0x52b418){return _[_0xf62c('0x2d')](_0x2906ac,function(_0x58d86e){if(_0x3c13f5[_0xf62c('0x61')]){if(_0x58d86e[_0xf62c('0x63')]===0x3eb){_0x58d86e['subsections']=_0x52b418;}}else{if(_0x58d86e[_0xf62c('0x63')]===0x64){_0x58d86e['subsections']=_0x52b418;}}return _0x58d86e;});});}else{return;}})[_0xf62c('0x41')](function(_0x41a415){if(_0x41a415)_0x2906ac=_0x41a415;if(_[_0xf62c('0x62')](_0x406f21,0x709)){var _0x151b17=_['find'](_0x2906ac,{'sectionId':0x709});return getPlugins(_0x151b17)['then'](function(_0x2a8290){if(_0x151b17[_0xf62c('0x61')]){return _[_0xf62c('0x2d')](_0x2906ac,function(_0xd1215a){if(_0xd1215a[_0xf62c('0x63')]===0x709){_0xd1215a[_0xf62c('0x65')]=_0x2a8290;}return _0xd1215a;});}else{var _0x12f6dc={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2a8290};var _0x377f37=_[_0xf62c('0x2d')](_0x2906ac);_0x377f37[_0xf62c('0x5e')](_0x12f6dc);return _0x377f37;}});}else{return;}})[_0xf62c('0x41')](function(_0x177848){if(_0x177848)_0x2906ac=_0x177848;return _[_0xf62c('0x3c')](_0x2906ac,[_0xf62c('0x61'),0x1]);})[_0xf62c('0x41')](respondWithResult(_0x4ae41e,null))[_0xf62c('0x4d')](handleError(_0x4ae41e,null));};function hasDefaultDashboard(_0x51cbfa){var _0x398c3c=[0x65];return new BPromise(function(_0x1e03e3,_0x32a4df){try{if(_0x51cbfa[_0xf62c('0x56')]){_0x1e03e3(_0x398c3c);}else{return db['UserProfileResource'][_0xf62c('0x66')]({'where':{'sectionId':_0x51cbfa['id']},'raw':!![]})[_0xf62c('0x41')](function(_0x9be280){_0x9be280?_0x1e03e3(_0x398c3c):_0x1e03e3();});}}catch(_0x415070){_0x32a4df(_0x415070);}});}function getCustomDashboards(_0xdf7c97){var _0x161a8a=[];return new BPromise(function(_0x38fa69,_0x45bbdd){try{if(_0xdf7c97[_0xf62c('0x56')]){return db['Dashboard'][_0xf62c('0x44')]({'raw':!![]})[_0xf62c('0x41')](function(_0x16f330){_0x16f330[_0xf62c('0x67')](function(_0x556579){_0x161a8a[_0xf62c('0x5e')](_0x556579['id']+0x1869f);});_0x38fa69(_0x161a8a);});}else{return db[_0xf62c('0x57')]['findAll']({'where':{'sectionId':_0xdf7c97['id']},'raw':!![]})[_0xf62c('0x41')](function(_0x57c7b4){_0x57c7b4[_0xf62c('0x67')](function(_0x4755af){_0x161a8a['push'](_0x4755af[_0xf62c('0x68')]+0x1869f);});_0x38fa69(_0x161a8a);});}}catch(_0xdaa04d){_0x45bbdd(_0xdaa04d);}});}function getPlugins(_0x2cad38){var _0xd179ba=[];return new BPromise(function(_0x2971c9,_0xae799){try{if(_0x2cad38[_0xf62c('0x56')]){return db[_0xf62c('0x69')][_0xf62c('0x44')]({'raw':!![]})['then'](function(_0x1bc773){_0x1bc773['forEach'](function(_0x249823){_0xd179ba[_0xf62c('0x5e')](_0x249823['id']+0x15b38);});_0x2971c9(_0xd179ba);});}else{return db[_0xf62c('0x57')]['findAll']({'where':{'sectionId':_0x2cad38['id']},'raw':!![]})['then'](function(_0x3b8ec7){_0x3b8ec7[_0xf62c('0x67')](function(_0x742e1c){_0xd179ba[_0xf62c('0x5e')](_0x742e1c[_0xf62c('0x68')]+0x15b38);});_0x2971c9(_0xd179ba);});}}catch(_0x51a76c){_0xae799(_0x51a76c);}});}exports['addResources']=function(_0x221cb3,_0x4f0c40){return db[_0xf62c('0x43')][_0xf62c('0x4a')]({'where':{'id':_0x221cb3[_0xf62c('0x47')]['id']}})[_0xf62c('0x41')](handleEntityNotFound(_0x4f0c40,null))[_0xf62c('0x41')](function(_0x7a95a1){if(_0x7a95a1){return db[_0xf62c('0x53')][_0xf62c('0x5c')](function(_0x3320e2){return db[_0xf62c('0x54')][_0xf62c('0x44')]({'where':{'userProfileId':_0x221cb3['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x177227){if(_0x177227){return db[_0xf62c('0x54')][_0xf62c('0x27')]({'where':{'userProfileId':_0x221cb3['params']['id'],'id':_[_0xf62c('0x2d')](_0x177227,function(_0x287cc9){return _0x287cc9['id'];})},'transaction':_0x3320e2});}})['then'](function(_0x4cbd15){var _0x480e4b=_[_0xf62c('0x2d')](_0x221cb3[_0xf62c('0x4c')],function(_0x24a15e){_0x24a15e[_0xf62c('0x5d')]=_0x221cb3[_0xf62c('0x47')]['id'];return _0x24a15e;});return db[_0xf62c('0x54')]['bulkCreate'](_0x480e4b,{'raw':!![],'transaction':_0x3320e2});})[_0xf62c('0x41')](function(_0xaf86d7){var _0x5402a8=_[_0xf62c('0x3c')](_[_0xf62c('0x2d')](_0xaf86d7,function(_0x32dd6b){return _0x32dd6b[_0xf62c('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x5402a8){return db[_0xf62c('0x54')][_0xf62c('0x44')]({'where':{'userProfileId':_0x221cb3[_0xf62c('0x47')]['id'],'sectionId':_['map'](_0x5402a8,function(_0x2eb05b){return _0x2eb05b[_0xf62c('0x63')];})},'attributes':['id',_0xf62c('0x63')],'raw':!![]})['then'](function(_0x3d3d9c){var _0x28a421=_[_0xf62c('0x2d')](_0x221cb3['body'],function(_0x24cf4a){_0x24cf4a[_0xf62c('0x5d')]=_0x221cb3[_0xf62c('0x47')]['id'];return _0x24cf4a;});return db[_0xf62c('0x57')][_0xf62c('0x6a')](_0x28a421,{'raw':!![],'transaction':_0x3320e2});});}})[_0xf62c('0x4d')](handleError(_0x4f0c40,null));});}})[_0xf62c('0x41')](function(_0x4d8647){var _0x50e7b0=_['map'](_0x4d8647,function(_0x193a61){return _0x193a61[_0xf62c('0x4e')]({'plain':!![]});});})[_0xf62c('0x41')](respondWithResult(_0x4f0c40,null))['catch'](handleError(_0x4f0c40,null));};exports[_0xf62c('0x6b')]=function(_0x130f02,_0xf3bca3,_0x528921){return db[_0xf62c('0x43')][_0xf62c('0x4a')]({'where':{'id':_0x130f02[_0xf62c('0x47')]['id']}})['then'](handleEntityNotFound(_0xf3bca3,null))[_0xf62c('0x41')](function(_0xee782f){if(_0xee782f){return _0xee782f[_0xf62c('0x6b')](_0x130f02[_0xf62c('0x32')]['ids']);}})[_0xf62c('0x41')](respondWithStatusCode(_0xf3bca3,null))[_0xf62c('0x4d')](handleError(_0xf3bca3,null));};exports['getResources']=function(_0x30231b,_0x57a0a2){var _0x40f0c9={};if(!_0x30231b['query']['section'])throw new Error(_0xf62c('0x6c'));if(!_0x30231b[_0xf62c('0x32')][_0xf62c('0x37')](_0xf62c('0x6d'))){_0x40f0c9[_0xf62c('0x24')]=qs['limit'](_0x30231b[_0xf62c('0x32')][_0xf62c('0x24')]);_0x40f0c9[_0xf62c('0x21')]=qs[_0xf62c('0x21')](_0x30231b[_0xf62c('0x32')][_0xf62c('0x21')]);}return db['UserProfile'][_0xf62c('0x4a')]({'where':{'id':_0x30231b[_0xf62c('0x47')]['id']}})[_0xf62c('0x41')](function(_0x45d000){if(!_0x45d000)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x30231b[_0xf62c('0x47')]['id']);return db[_0xf62c('0x43')]['getResources'](_0x30231b);})['then'](respondWithFilteredResult(_0x57a0a2,_0x40f0c9))['catch'](handleError(_0x57a0a2,null));}; \ No newline at end of file +var _0x5f7b=['to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','UserProfile','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','clone','get','omit','updatedAt','crudPermissions','body','createdAt','sequelize','transaction','UserProfileSection','each','UserProfileResource','sectionId','userProfileId','Resources','describe','push','removeSections','ids','includes','isEmpty','subsections','enabled','autoAssociation','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3074e2,_0x24b6aa){var _0x2f7362=function(_0x539e6b){while(--_0x539e6b){_0x3074e2['push'](_0x3074e2['shift']());}};_0x2f7362(++_0x24b6aa);}(_0x5f7b,0x14a));var _0xb5f7=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x5f7b[_0x4b7895];return _0x264180;};'use strict';var emlformat=require(_0xb5f7('0x0'));var rimraf=require(_0xb5f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5f7('0x2'));var rp=require(_0xb5f7('0x3'));var moment=require(_0xb5f7('0x4'));var BPromise=require(_0xb5f7('0x5'));var Mustache=require(_0xb5f7('0x6'));var util=require(_0xb5f7('0x7'));var path=require(_0xb5f7('0x8'));var sox=require('sox');var csv=require(_0xb5f7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5f7('0xa'));var _=require(_0xb5f7('0xb'));var squel=require('squel');var crypto=require(_0xb5f7('0xc'));var jsforce=require(_0xb5f7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb5f7('0x9'));var querystring=require(_0xb5f7('0xe'));var Papa=require(_0xb5f7('0xf'));var Redis=require(_0xb5f7('0x10'));var authService=require(_0xb5f7('0x11'));var qs=require(_0xb5f7('0x12'));var as=require(_0xb5f7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5f7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb5f7('0x15'));var licenseUtil=require(_0xb5f7('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb5f7('0x17')](config[_0xb5f7('0x18')],{'host':_0xb5f7('0x19'),'port':0x18eb});var socket=require(_0xb5f7('0x1a'))(new Redis(config[_0xb5f7('0x18')]));require('./userProfile.socket')[_0xb5f7('0x1b')](socket);function respondWithStatusCode(_0x30db32,_0x123afb){_0x123afb=_0x123afb||0xcc;return function(_0x375815){if(_0x375815){return _0x30db32[_0xb5f7('0x1c')](_0x123afb);}return _0x30db32[_0xb5f7('0x1d')](_0x123afb)['end']();};}function respondWithResult(_0xe5b295,_0x2162d2){_0x2162d2=_0x2162d2||0xc8;return function(_0x5931f6){if(_0x5931f6){return _0xe5b295[_0xb5f7('0x1d')](_0x2162d2)[_0xb5f7('0x1e')](_0x5931f6);}};}function respondWithFilteredResult(_0x53e739,_0x4e76bb){return function(_0x286b7f){if(_0x286b7f){var _0x23e296=typeof _0x4e76bb['offset']===_0xb5f7('0x1f')&&typeof _0x4e76bb[_0xb5f7('0x20')]===_0xb5f7('0x1f');var _0x27cc6f=_0x286b7f[_0xb5f7('0x21')];var _0x2b7588=_0x23e296?0x0:_0x4e76bb[_0xb5f7('0x22')];var _0xae34f7=_0x23e296?_0x286b7f['count']:_0x4e76bb[_0xb5f7('0x22')]+_0x4e76bb[_0xb5f7('0x20')];var _0x27a320;if(_0xae34f7>=_0x27cc6f){_0xae34f7=_0x27cc6f;_0x27a320=0xc8;}else{_0x27a320=0xce;}_0x53e739[_0xb5f7('0x1d')](_0x27a320);return _0x53e739[_0xb5f7('0x23')](_0xb5f7('0x24'),_0x2b7588+'-'+_0xae34f7+'/'+_0x27cc6f)['json'](_0x286b7f);}return null;};}function patchUpdates(_0x45d9ef){return function(_0x530d8e){try{jsonpatch[_0xb5f7('0x25')](_0x530d8e,_0x45d9ef,!![]);}catch(_0x612777){return BPromise['reject'](_0x612777);}return _0x530d8e[_0xb5f7('0x26')]();};}function saveUpdates(_0x4bcc47,_0x3045be){return function(_0x38c70b){if(_0x38c70b){return _0x38c70b[_0xb5f7('0x27')](_0x4bcc47)['then'](function(_0x6aacf5){return _0x6aacf5;});}return null;};}function removeEntity(_0xdd9c83,_0x4b7c30){return function(_0x43fdf4){if(_0x43fdf4){return _0x43fdf4[_0xb5f7('0x28')]()[_0xb5f7('0x29')](function(){_0xdd9c83[_0xb5f7('0x1d')](0xcc)[_0xb5f7('0x2a')]();});}};}function handleEntityNotFound(_0x481f56,_0x542853){return function(_0x2c4d35){if(!_0x2c4d35){_0x481f56[_0xb5f7('0x1c')](0x194);}return _0x2c4d35;};}function handleError(_0xb7a42f,_0x398d37){_0x398d37=_0x398d37||0x1f4;return function(_0x2fc208){logger[_0xb5f7('0x2b')](_0x2fc208[_0xb5f7('0x2c')]);if(_0x2fc208['name']){delete _0x2fc208[_0xb5f7('0x2d')];}_0xb7a42f[_0xb5f7('0x1d')](_0x398d37)[_0xb5f7('0x2e')](_0x2fc208);};}exports['index']=function(_0x4dc7e0,_0x33e2c1){var _0x1fec8e={},_0x2b0db9={},_0xf8e211={'count':0x0,'rows':[]};var _0xb98a3=_['map'](db[_0xb5f7('0x2f')][_0xb5f7('0x30')],function(_0x4c6e35){return{'name':_0x4c6e35[_0xb5f7('0x31')],'type':_0x4c6e35[_0xb5f7('0x32')][_0xb5f7('0x33')]};});_0x2b0db9[_0xb5f7('0x34')]=_[_0xb5f7('0x35')](_0xb98a3,'name');_0x2b0db9['query']=_[_0xb5f7('0x36')](_0x4dc7e0[_0xb5f7('0x37')]);_0x2b0db9[_0xb5f7('0x38')]=_['intersection'](_0x2b0db9[_0xb5f7('0x34')],_0x2b0db9[_0xb5f7('0x37')]);_0x1fec8e[_0xb5f7('0x39')]=_['intersection'](_0x2b0db9[_0xb5f7('0x34')],qs[_0xb5f7('0x3a')](_0x4dc7e0[_0xb5f7('0x37')][_0xb5f7('0x3a')]));_0x1fec8e[_0xb5f7('0x39')]=_0x1fec8e[_0xb5f7('0x39')]['length']?_0x1fec8e[_0xb5f7('0x39')]:_0x2b0db9[_0xb5f7('0x34')];if(!_0x4dc7e0[_0xb5f7('0x37')][_0xb5f7('0x3b')]('nolimit')){_0x1fec8e[_0xb5f7('0x20')]=qs[_0xb5f7('0x20')](_0x4dc7e0[_0xb5f7('0x37')][_0xb5f7('0x20')]);_0x1fec8e[_0xb5f7('0x22')]=qs[_0xb5f7('0x22')](_0x4dc7e0['query'][_0xb5f7('0x22')]);}_0x1fec8e[_0xb5f7('0x3c')]=qs[_0xb5f7('0x3d')](_0x4dc7e0[_0xb5f7('0x37')][_0xb5f7('0x3d')]);_0x1fec8e['where']=qs[_0xb5f7('0x38')](_[_0xb5f7('0x3e')](_0x4dc7e0[_0xb5f7('0x37')],_0x2b0db9[_0xb5f7('0x38')]),_0xb98a3);if(_0x4dc7e0['query'][_0xb5f7('0x3f')]){_0x1fec8e['where']=_[_0xb5f7('0x40')](_0x1fec8e['where'],{'$or':_[_0xb5f7('0x35')](_0xb98a3,function(_0x2fe620){if(_0x2fe620[_0xb5f7('0x32')]!==_0xb5f7('0x41')){var _0x2688a4={};_0x2688a4[_0x2fe620[_0xb5f7('0x2d')]]={'$like':'%'+_0x4dc7e0[_0xb5f7('0x37')]['filter']+'%'};return _0x2688a4;}})});}_0x1fec8e=_['merge']({},_0x1fec8e,_0x4dc7e0['options']);var _0x1ed37e={'where':_0x1fec8e[_0xb5f7('0x42')]};return db[_0xb5f7('0x2f')][_0xb5f7('0x21')](_0x1ed37e)[_0xb5f7('0x29')](function(_0x24dc48){_0xf8e211[_0xb5f7('0x21')]=_0x24dc48;if(_0x4dc7e0[_0xb5f7('0x37')][_0xb5f7('0x43')]){_0x1fec8e[_0xb5f7('0x44')]=[{'all':!![]}];}return db[_0xb5f7('0x2f')][_0xb5f7('0x45')](_0x1fec8e);})[_0xb5f7('0x29')](function(_0x333714){_0xf8e211[_0xb5f7('0x46')]=_0x333714;return _0xf8e211;})['then'](respondWithFilteredResult(_0x33e2c1,_0x1fec8e))[_0xb5f7('0x47')](handleError(_0x33e2c1,null));};exports[_0xb5f7('0x48')]=function(_0xf6b742,_0x3fc0c7){var _0x5540d7={'raw':![],'where':{'id':_0xf6b742[_0xb5f7('0x49')]['id']}},_0x4e4c46={};_0x4e4c46[_0xb5f7('0x34')]=_['keys'](db[_0xb5f7('0x2f')][_0xb5f7('0x30')]);_0x4e4c46[_0xb5f7('0x37')]=_[_0xb5f7('0x36')](_0xf6b742[_0xb5f7('0x37')]);_0x4e4c46[_0xb5f7('0x38')]=_['intersection'](_0x4e4c46[_0xb5f7('0x34')],_0x4e4c46['query']);_0x5540d7[_0xb5f7('0x39')]=_[_0xb5f7('0x4a')](_0x4e4c46[_0xb5f7('0x34')],qs[_0xb5f7('0x3a')](_0xf6b742[_0xb5f7('0x37')]['fields']));_0x5540d7[_0xb5f7('0x39')]=_0x5540d7['attributes']['length']?_0x5540d7[_0xb5f7('0x39')]:_0x4e4c46['model'];if(_0xf6b742['query']['includeAll']){_0x5540d7[_0xb5f7('0x44')]=[{'all':!![]}];}_0x5540d7=_[_0xb5f7('0x40')]({},_0x5540d7,_0xf6b742[_0xb5f7('0x4b')]);return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')](_0x5540d7)['then'](handleEntityNotFound(_0x3fc0c7,null))['then'](respondWithResult(_0x3fc0c7,null))[_0xb5f7('0x47')](handleError(_0x3fc0c7,null));};exports['create']=function(_0x41ff3a,_0x25a701){return db[_0xb5f7('0x2f')][_0xb5f7('0x4d')](_0x41ff3a['body'],{})[_0xb5f7('0x29')](respondWithResult(_0x25a701,0xc9))[_0xb5f7('0x47')](handleError(_0x25a701,null));};exports[_0xb5f7('0x4e')]=function(_0x4a59e5,_0xc07b4b){var _0x4da6bc={'where':{'id':_0x4a59e5['params']['id']}},_0x7146d4={};_0x7146d4['model']=_[_0xb5f7('0x36')](db[_0xb5f7('0x2f')][_0xb5f7('0x30')]);_0x4da6bc[_0xb5f7('0x39')]=_[_0xb5f7('0x4a')](_0x7146d4[_0xb5f7('0x34')],qs['fields'](_0x4a59e5[_0xb5f7('0x37')][_0xb5f7('0x3a')]));_0x4da6bc[_0xb5f7('0x39')]=_0x4da6bc['attributes']['length']?_0x4da6bc['attributes']:_0x7146d4[_0xb5f7('0x34')];if(_0x4a59e5[_0xb5f7('0x37')]['includeAll']){_0x4da6bc[_0xb5f7('0x44')]=[{'all':!![]}];}_0x4da6bc=_[_0xb5f7('0x40')]({},_0x4da6bc,_0x4a59e5[_0xb5f7('0x4b')]);return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')](_0x4da6bc)[_0xb5f7('0x29')](handleEntityNotFound(_0xc07b4b,null))[_0xb5f7('0x29')](function(_0x3da59f){if(_0x3da59f){var _0x16983f=_0x3da59f[_0xb5f7('0x4f')]({'plain':!![]});_0x16983f=qs[_0xb5f7('0x50')](_0x16983f,['id','createdAt',_0xb5f7('0x51'),_0xb5f7('0x52')]);_0x4a59e5[_0xb5f7('0x53')]=_[_0xb5f7('0x50')](_0x4a59e5[_0xb5f7('0x53')],['id',_0xb5f7('0x54'),'updatedAt']);return db[_0xb5f7('0x55')][_0xb5f7('0x56')](function(_0x2ab875){return db[_0xb5f7('0x2f')][_0xb5f7('0x4d')](_[_0xb5f7('0x40')](_0x16983f,_0x4a59e5[_0xb5f7('0x53')]),{'include':_0x4a59e5[_0xb5f7('0x37')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2ab875})['then'](function(_0x4f5ca5){var _0x218f1e=_0x4f5ca5[_0xb5f7('0x4f')]({'plain':!![]});return db[_0xb5f7('0x57')][_0xb5f7('0x45')]({'where':{'userProfileId':_0x4a59e5['params']['id']},'raw':!![]})[_0xb5f7('0x29')](function(_0x5e9c45){if(_0x5e9c45){return BPromise[_0xb5f7('0x58')](_0x5e9c45,function(_0x21e2f5){return new BPromise(function(_0x42c915,_0x5e5259){if(_0x21e2f5['autoAssociation']===null||_0x21e2f5['autoAssociation']===0x1)_0x42c915(null);return db[_0xb5f7('0x59')][_0xb5f7('0x45')]({'where':{'sectionId':_0x21e2f5['id']},'raw':!![]})[_0xb5f7('0x29')](function(_0x52bda2){var _0x31a14c=_['map'](_0x52bda2,function(_0x530a1d){return qs[_0xb5f7('0x50')](_0x530a1d,['id',_0xb5f7('0x54'),'updatedAt',_0xb5f7('0x5a')]);});_0x42c915(_0x31a14c);})[_0xb5f7('0x47')](function(_0x3d69a4){_0x5e5259(_0x3d69a4);});})['then'](function(_0x3c03aa){var _0x3cb60f=qs[_0xb5f7('0x50')](_0x21e2f5,['id',_0xb5f7('0x54'),'updatedAt']);_0x3cb60f[_0xb5f7('0x5b')]=_0x218f1e['id'];if(_0x3c03aa)_0x3cb60f['Resources']=_0x3c03aa;return _0x3cb60f;})[_0xb5f7('0x29')](function(_0x493b96){return db[_0xb5f7('0x57')][_0xb5f7('0x4d')](_0x493b96,{'include':[{'model':db['UserProfileResource'],'as':_0xb5f7('0x5c')}],'raw':!![],'transaction':_0x2ab875});});})[_0xb5f7('0x29')](function(){return _0x218f1e;});}});});});}})[_0xb5f7('0x29')](respondWithResult(_0xc07b4b,0xc9))[_0xb5f7('0x47')](handleError(_0xc07b4b,null));};exports[_0xb5f7('0x27')]=function(_0x3a0536,_0x5b9b56){if(_0x3a0536['body']['id']){delete _0x3a0536[_0xb5f7('0x53')]['id'];}return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')]({'where':{'id':_0x3a0536[_0xb5f7('0x49')]['id']}})[_0xb5f7('0x29')](handleEntityNotFound(_0x5b9b56,null))[_0xb5f7('0x29')](saveUpdates(_0x3a0536[_0xb5f7('0x53')],null))[_0xb5f7('0x29')](respondWithResult(_0x5b9b56,null))[_0xb5f7('0x47')](handleError(_0x5b9b56,null));};exports['destroy']=function(_0x436b88,_0x113d11){return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')]({'where':{'id':_0x436b88[_0xb5f7('0x49')]['id']}})[_0xb5f7('0x29')](handleEntityNotFound(_0x113d11,null))[_0xb5f7('0x29')](removeEntity(_0x113d11,null))[_0xb5f7('0x47')](handleError(_0x113d11,null));};exports[_0xb5f7('0x5d')]=function(_0x4dca05,_0x234e66){return db[_0xb5f7('0x2f')][_0xb5f7('0x5d')]()[_0xb5f7('0x29')](respondWithResult(_0x234e66,null))[_0xb5f7('0x47')](handleError(_0x234e66,null));};exports['addSections']=function(_0x2dbfd5,_0x231472){var _0x3e77f9=_0x2dbfd5[_0xb5f7('0x53')];return db['UserProfile'][_0xb5f7('0x4c')]({'where':{'id':_0x2dbfd5[_0xb5f7('0x49')]['id']}})[_0xb5f7('0x29')](handleEntityNotFound(_0x231472,null))[_0xb5f7('0x29')](function(_0x5caeee){if(_0x5caeee){return db[_0xb5f7('0x55')][_0xb5f7('0x56')](function(_0x5c654b){return db[_0xb5f7('0x57')][_0xb5f7('0x28')]({'where':{'userProfileId':_0x2dbfd5[_0xb5f7('0x49')]['id'],'sectionId':_[_0xb5f7('0x35')](_0x3e77f9,function(_0x140823){return _0x140823['sectionId'];})},'transaction':_0x5c654b})[_0xb5f7('0x29')](function(){var _0x951d72=_['map'](_0x3e77f9,function(_0xcac5fb){_0xcac5fb[_0xb5f7('0x5b')]=_0x2dbfd5[_0xb5f7('0x49')]['id'];return _0xcac5fb;});var _0x135b53=[];return BPromise[_0xb5f7('0x58')](_0x951d72,function(_0x2b6fa7){return db[_0xb5f7('0x57')][_0xb5f7('0x4d')](_0x2b6fa7,{'include':[{'model':db[_0xb5f7('0x59')],'as':_0xb5f7('0x5c')}],'raw':!![],'transaction':_0x5c654b})[_0xb5f7('0x29')](function(_0x4c26a5){_0x135b53[_0xb5f7('0x5e')](_0x4c26a5['get']({'plain':!![]}));});})[_0xb5f7('0x29')](function(){return _0x135b53;});});});}})[_0xb5f7('0x29')](function(_0x5c87a1){return _0x5c87a1;})[_0xb5f7('0x29')](respondWithResult(_0x231472,null))['catch'](handleError(_0x231472,null));};exports[_0xb5f7('0x5f')]=function(_0x2edc58,_0x1e86e6){var _0x4ca2a8;return db[_0xb5f7('0x2f')]['find']({'where':{'id':_0x2edc58[_0xb5f7('0x49')]['id']},'attributes':['id',_0xb5f7('0x2d')]})[_0xb5f7('0x29')](handleEntityNotFound(_0x1e86e6,null))[_0xb5f7('0x29')](function(_0x5913a2){if(_0x5913a2){_0x4ca2a8=_0x5913a2;return db[_0xb5f7('0x57')][_0xb5f7('0x28')]({'where':{'userProfileId':_0x2edc58['params']['id'],'sectionId':_0x2edc58[_0xb5f7('0x37')][_0xb5f7('0x60')]}});}})[_0xb5f7('0x29')](function(){return _0x4ca2a8;})[_0xb5f7('0x29')](respondWithStatusCode(_0x1e86e6,null))[_0xb5f7('0x47')](handleError(_0x1e86e6,null));};exports['getSections']=function(_0x75ab4f,_0x541927){var _0x5bc24c=[];var _0x2d7ce4=[];return db[_0xb5f7('0x57')][_0xb5f7('0x45')]({'where':{'userProfileId':_0x75ab4f[_0xb5f7('0x49')]['id']},'raw':!![]})[_0xb5f7('0x29')](function(_0x163939){_0x5bc24c=_[_0xb5f7('0x3f')](_0x163939,function(_0x26d669){return _0x26d669['enabled']===0x1||_[_0xb5f7('0x61')]([0x3eb,0x709],_0x26d669[_0xb5f7('0x5a')]);});if(!_[_0xb5f7('0x62')](_0x5bc24c)){return _['map'](_0x5bc24c,function(_0x23ce01){return _0x23ce01[_0xb5f7('0x5a')];});}else{return;}})['then'](function(_0xfc7120){if(_0xfc7120)_0x2d7ce4=_0xfc7120;if(_[_0xb5f7('0x61')](_0x2d7ce4,0x64)){var _0x162b04=_[_0xb5f7('0x4c')](_0x5bc24c,{'sectionId':0x64});return hasDefaultDashboard(_0x162b04)[_0xb5f7('0x29')](function(_0x4e1d66){return _[_0xb5f7('0x35')](_0x5bc24c,function(_0x2666a2){if(_0x2666a2[_0xb5f7('0x5a')]===0x64){_0x2666a2[_0xb5f7('0x63')]=_0x4e1d66;}return _0x2666a2;});});}else{return;}})[_0xb5f7('0x29')](function(_0x281c0a){if(_0x281c0a)_0x5bc24c=_0x281c0a;if(_[_0xb5f7('0x61')](_0x2d7ce4,0x3eb)){var _0x5e0d65=_[_0xb5f7('0x4c')](_0x5bc24c,{'sectionId':0x3eb});return getCustomDashboards(_0x5e0d65)['then'](function(_0x5ea702){return _[_0xb5f7('0x35')](_0x5bc24c,function(_0x29c3a8){if(_0x5e0d65['enabled']){if(_0x29c3a8[_0xb5f7('0x5a')]===0x3eb){_0x29c3a8[_0xb5f7('0x63')]=_0x5ea702;}}else{if(_0x29c3a8[_0xb5f7('0x5a')]===0x64){_0x29c3a8['subsections']=_0x5ea702;}}return _0x29c3a8;});});}else{return;}})['then'](function(_0x23aa64){if(_0x23aa64)_0x5bc24c=_0x23aa64;if(_[_0xb5f7('0x61')](_0x2d7ce4,0x709)){var _0x30decc=_[_0xb5f7('0x4c')](_0x5bc24c,{'sectionId':0x709});return getPlugins(_0x30decc)[_0xb5f7('0x29')](function(_0x387502){if(_0x30decc[_0xb5f7('0x64')]){return _[_0xb5f7('0x35')](_0x5bc24c,function(_0x59f302){if(_0x59f302['sectionId']===0x709){_0x59f302[_0xb5f7('0x63')]=_0x387502;}return _0x59f302;});}else{var _0x440c7b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x387502};var _0x5db186=_[_0xb5f7('0x35')](_0x5bc24c);_0x5db186[_0xb5f7('0x5e')](_0x440c7b);return _0x5db186;}});}else{return;}})[_0xb5f7('0x29')](function(_0x99f231){if(_0x99f231)_0x5bc24c=_0x99f231;return _['filter'](_0x5bc24c,['enabled',0x1]);})[_0xb5f7('0x29')](respondWithResult(_0x541927,null))[_0xb5f7('0x47')](handleError(_0x541927,null));};function hasDefaultDashboard(_0x59a92f){var _0x50f9cb=[0x65];return new BPromise(function(_0x55ffc9,_0x277e47){try{if(_0x59a92f[_0xb5f7('0x65')]){_0x55ffc9(_0x50f9cb);}else{return db[_0xb5f7('0x59')][_0xb5f7('0x66')]({'where':{'sectionId':_0x59a92f['id']},'raw':!![]})[_0xb5f7('0x29')](function(_0x3c0767){_0x3c0767?_0x55ffc9(_0x50f9cb):_0x55ffc9();});}}catch(_0x3dadfd){_0x277e47(_0x3dadfd);}});}function getCustomDashboards(_0x311366){var _0xd5f429=[];return new BPromise(function(_0x55f6d9,_0x51ebea){try{if(_0x311366['autoAssociation']){return db[_0xb5f7('0x67')][_0xb5f7('0x45')]({'raw':!![]})[_0xb5f7('0x29')](function(_0x5112bf){_0x5112bf[_0xb5f7('0x68')](function(_0x4066a9){_0xd5f429['push'](_0x4066a9['id']+0x1869f);});_0x55f6d9(_0xd5f429);});}else{return db[_0xb5f7('0x59')]['findAll']({'where':{'sectionId':_0x311366['id']},'raw':!![]})['then'](function(_0x25f3be){_0x25f3be['forEach'](function(_0x372702){_0xd5f429[_0xb5f7('0x5e')](_0x372702[_0xb5f7('0x69')]+0x1869f);});_0x55f6d9(_0xd5f429);});}}catch(_0x34053b){_0x51ebea(_0x34053b);}});}function getPlugins(_0x23703a){var _0x5abbbc=[];return new BPromise(function(_0x122c0d,_0x539d14){try{if(_0x23703a[_0xb5f7('0x65')]){return db[_0xb5f7('0x6a')][_0xb5f7('0x45')]({'raw':!![]})[_0xb5f7('0x29')](function(_0x162d00){_0x162d00[_0xb5f7('0x68')](function(_0x4563f7){_0x5abbbc[_0xb5f7('0x5e')](_0x4563f7['id']+0x15b38);});_0x122c0d(_0x5abbbc);});}else{return db['UserProfileResource'][_0xb5f7('0x45')]({'where':{'sectionId':_0x23703a['id']},'raw':!![]})[_0xb5f7('0x29')](function(_0x24131a){_0x24131a[_0xb5f7('0x68')](function(_0xc6ebda){_0x5abbbc[_0xb5f7('0x5e')](_0xc6ebda[_0xb5f7('0x69')]+0x15b38);});_0x122c0d(_0x5abbbc);});}}catch(_0x158628){_0x539d14(_0x158628);}});}exports[_0xb5f7('0x6b')]=function(_0x3c7c40,_0x1ce934){return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')]({'where':{'id':_0x3c7c40[_0xb5f7('0x49')]['id']}})[_0xb5f7('0x29')](handleEntityNotFound(_0x1ce934,null))[_0xb5f7('0x29')](function(_0x465135){if(_0x465135){return db['sequelize'][_0xb5f7('0x56')](function(_0x2d8d3e){return db[_0xb5f7('0x57')][_0xb5f7('0x45')]({'where':{'userProfileId':_0x3c7c40[_0xb5f7('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0xb5f7('0x29')](function(_0x2cd543){if(_0x2cd543){return db[_0xb5f7('0x57')][_0xb5f7('0x28')]({'where':{'userProfileId':_0x3c7c40[_0xb5f7('0x49')]['id'],'id':_['map'](_0x2cd543,function(_0x364092){return _0x364092['id'];})},'transaction':_0x2d8d3e});}})[_0xb5f7('0x29')](function(_0xf439e8){var _0x436856=_['map'](_0x3c7c40[_0xb5f7('0x53')],function(_0xbc0dbb){_0xbc0dbb['userProfileId']=_0x3c7c40[_0xb5f7('0x49')]['id'];return _0xbc0dbb;});return db[_0xb5f7('0x57')][_0xb5f7('0x6c')](_0x436856,{'raw':!![],'transaction':_0x2d8d3e});})[_0xb5f7('0x29')](function(_0x560bc9){var _0x30c262=_[_0xb5f7('0x3f')](_[_0xb5f7('0x35')](_0x560bc9,function(_0x264011){return _0x264011[_0xb5f7('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x30c262){return db[_0xb5f7('0x57')][_0xb5f7('0x45')]({'where':{'userProfileId':_0x3c7c40[_0xb5f7('0x49')]['id'],'sectionId':_[_0xb5f7('0x35')](_0x30c262,function(_0x5c5aef){return _0x5c5aef[_0xb5f7('0x5a')];})},'attributes':['id',_0xb5f7('0x5a')],'raw':!![]})['then'](function(_0x2adf6f){var _0x4f51a5=_[_0xb5f7('0x35')](_0x3c7c40[_0xb5f7('0x53')],function(_0x151ee9){_0x151ee9['userProfileId']=_0x3c7c40['params']['id'];return _0x151ee9;});return db[_0xb5f7('0x59')][_0xb5f7('0x6c')](_0x4f51a5,{'raw':!![],'transaction':_0x2d8d3e});});}})[_0xb5f7('0x47')](handleError(_0x1ce934,null));});}})['then'](function(_0x51e22a){var _0x16052b=_[_0xb5f7('0x35')](_0x51e22a,function(_0x52ebf2){return _0x52ebf2['get']({'plain':!![]});});})[_0xb5f7('0x29')](respondWithResult(_0x1ce934,null))[_0xb5f7('0x47')](handleError(_0x1ce934,null));};exports[_0xb5f7('0x6d')]=function(_0x294e81,_0x4783e4,_0x310b48){return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')]({'where':{'id':_0x294e81[_0xb5f7('0x49')]['id']}})['then'](handleEntityNotFound(_0x4783e4,null))[_0xb5f7('0x29')](function(_0x49f9e7){if(_0x49f9e7){return _0x49f9e7[_0xb5f7('0x6d')](_0x294e81[_0xb5f7('0x37')]['ids']);}})[_0xb5f7('0x29')](respondWithStatusCode(_0x4783e4,null))[_0xb5f7('0x47')](handleError(_0x4783e4,null));};exports['getResources']=function(_0x328389,_0x3ef28c){var _0x5240c8={};if(!_0x328389['query']['section'])throw new Error(_0xb5f7('0x6e'));if(!_0x328389['query'][_0xb5f7('0x3b')]('nolimit')){_0x5240c8[_0xb5f7('0x20')]=qs[_0xb5f7('0x20')](_0x328389[_0xb5f7('0x37')]['limit']);_0x5240c8['offset']=qs[_0xb5f7('0x22')](_0x328389['query']['offset']);}return db[_0xb5f7('0x2f')][_0xb5f7('0x4c')]({'where':{'id':_0x328389[_0xb5f7('0x49')]['id']}})['then'](function(_0x5ea504){if(!_0x5ea504)throw new Error(_0xb5f7('0x6f')+_0x328389[_0xb5f7('0x49')]['id']);return db[_0xb5f7('0x2f')][_0xb5f7('0x70')](_0x328389);})[_0xb5f7('0x29')](respondWithFilteredResult(_0x3ef28c,_0x5240c8))[_0xb5f7('0x47')](handleError(_0x3ef28c,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index c8c372d..48c2dd0 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 _0xe626=['setMaxListeners','update','remove','hasOwnProperty','hook','events','../../mysqldb','UserProfile'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xe626,0x9d));var _0x6e62=function(_0x44cf63,_0xadf9dd){_0x44cf63=_0x44cf63-0x0;var _0xbc96b9=_0xe626[_0x44cf63];return _0xbc96b9;};'use strict';var EventEmitter=require(_0x6e62('0x0'));var UserProfile=require(_0x6e62('0x1'))['db'][_0x6e62('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6e62('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6e62('0x4'),'afterDestroy':_0x6e62('0x5')};function emitEvent(_0x302770){return function(_0xb5cd38,_0x2ebc77,_0x4d4816){UserProfileEvents['emit'](_0x302770+':'+_0xb5cd38['id'],_0xb5cd38);UserProfileEvents['emit'](_0x302770,_0xb5cd38);_0x4d4816(null);};}for(var e in events){if(events[_0x6e62('0x6')](e)){var event=events[e];UserProfile[_0x6e62('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x0adf=['UserProfile','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x228cfb,_0x1b4294){var _0x21e85d=function(_0x377b37){while(--_0x377b37){_0x228cfb['push'](_0x228cfb['shift']());}};_0x21e85d(++_0x1b4294);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x2e3885,_0x101c38){_0x2e3885=_0x2e3885-0x0;var _0x148628=_0x0adf[_0x2e3885];return _0x148628;};'use strict';var EventEmitter=require(_0xf0ad('0x0'));var UserProfile=require(_0xf0ad('0x1'))['db'][_0xf0ad('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf0ad('0x3'),'afterUpdate':_0xf0ad('0x4'),'afterDestroy':_0xf0ad('0x5')};function emitEvent(_0x187aa4){return function(_0x27d666,_0x459e70,_0x719547){UserProfileEvents['emit'](_0x187aa4+':'+_0x27d666['id'],_0x27d666);UserProfileEvents[_0xf0ad('0x6')](_0x187aa4,_0x27d666);_0x719547(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xf0ad('0x7')](e,emitEvent(event));}}module[_0xf0ad('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 2405f34..10b3837 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 _0x4883=['section','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','autoAssociation','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','include','CustomReports','rows','ids','customSorting','extraQueryConditions','count','includeAll','color','tag','ThroughTags','openTabs','true','chat','fax','dataValues','mail','openchannel','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','value','findAll','then','associatedResources','map','catch','model','name','resolve','UserProfileResource','field','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','membername','User','role','agent','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','Agents','Telephones','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','variables','Variable','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','SELECT','select','InteractionId','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw'];(function(_0x3509d1,_0x34fdc8){var _0x5aad33=function(_0x163e7e){while(--_0x163e7e){_0x3509d1['push'](_0x3509d1['shift']());}};_0x5aad33(++_0x34fdc8);}(_0x4883,0xef));var _0x3488=function(_0x150af9,_0x5296ed){_0x150af9=_0x150af9-0x0;var _0x437552=_0x4883[_0x150af9];return _0x437552;};'use strict';var _=require(_0x3488('0x0'));var attributes=require(_0x3488('0x1'));var qs=require(_0x3488('0x2'));var squel=require('squel');module[_0x3488('0x3')]=function(_0x14becd){var _0x94d054=_0x14becd[_0x3488('0x4')];function _0xc7fe98(_0x1539a0,_0xdc4389){return new Promise(function(_0x25d816,_0x35e1c4){if(!_0xdc4389)return _0x25d816(null);var _0x7c1bb3=_0xdc4389[_0x3488('0x5')]?{[_0xdc4389[_0x3488('0x5')]['field']]:_0xdc4389['filter'][_0x3488('0x6')]}:undefined;return _0x94d054[_0x1539a0][_0x3488('0x7')]({'where':_0x7c1bb3,'raw':!![]})[_0x3488('0x8')](function(_0x439851){_0xdc4389[_0x3488('0x9')]=_[_0x3488('0xa')](_0x439851,'id');_0x25d816(_0xdc4389);})[_0x3488('0xb')](function(_0x14ab13){_0x35e1c4(_0x14ab13);});});}function _0x4a41ca(_0x569c8d,_0x568cee){return new Promise(function(_0x3c74be,_0x23c05e){var _0x178629=_0x569c8d['filter']?{[_0x569c8d['filter']['field']]:_0x569c8d[_0x3488('0x5')][_0x3488('0x6')]}:undefined;return _0x94d054[_0x569c8d[_0x3488('0xc')]][_0x3488('0x7')]({'where':_0x178629,'raw':!![]})[_0x3488('0x8')](function(_0x3a3959){_0x568cee[_0x3488('0x9')]=_[_0x3488('0xa')](_0x3a3959,function(_0x2df401){return _0x2df401[_0x3488('0xd')];});_0x3c74be(_0x568cee);})[_0x3488('0xb')](function(_0x2532dc){_0x23c05e(_0x2532dc);});});}function _0x12034b(_0x55471d,_0x54d891,_0x1b2501){if(!_0x54d891)return Promise[_0x3488('0xe')](null);return new Promise(function(_0x1e9268,_0x400f28){return _0x94d054[_0x3488('0xf')][_0x3488('0x7')]({'where':{'sectionId':_0x54d891['id']},'raw':!![]})[_0x3488('0x8')](function(_0x4a5cf1){if(_0x55471d[_0x3488('0x10')]&&_0x55471d[_0x3488('0x10')]!=='id'){_0x54d891[_0x3488('0x9')]=_[_0x3488('0xa')](_0x4a5cf1,function(_0x3d261c){return _0x3d261c[_0x55471d[_0x3488('0x10')]];});}else{if(_0x1b2501===_0x3488('0x11')){_0x54d891[_0x3488('0x9')]=_['map'](_0x4a5cf1,function(_0xa54404){return{'id':_0xa54404[_0x3488('0x12')],'type':_0xa54404[_0x3488('0x13')]};});}else{_0x54d891['associatedResources']=_[_0x3488('0xa')](_0x4a5cf1,function(_0x2e639b){return _0x2e639b[_0x3488('0x12')];});}}_0x1e9268(_0x54d891);})[_0x3488('0xb')](function(_0xa4d376){_0x400f28(_0xa4d376);});});}function _0x31ce98(_0x5a612e,_0x33e468){var _0x5e7ac8={'parentSections':[]};switch(_0x5a612e[_0x3488('0x14')]()){case _0x3488('0x15'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x17');break;case _0x3488('0x18'):_0x5e7ac8[_0x3488('0x16')]='SquareOdbc';break;case'squarerecordings':_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x19');_0x5e7ac8[_0x3488('0x1a')]=[{'name':_0x3488('0x1b'),'field':_0x3488('0xd'),'foreignKey':_0x3488('0x1c')}];break;case _0x3488('0x1d'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x1e');break;case _0x3488('0x1f'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x20');_0x5e7ac8[_0x3488('0x1a')]=[{'name':_0x3488('0x21'),'field':'id','foreignKey':_0x3488('0x22')}];break;case _0x3488('0x23'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x24');break;case _0x3488('0x25'):_0x5e7ac8[_0x3488('0x16')]='CmCompany';break;case _0x3488('0x26'):_0x5e7ac8[_0x3488('0x16')]='CmCustomField';break;case _0x3488('0x27'):_0x5e7ac8['childModel']=_0x3488('0x28');break;case _0x3488('0x29'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x2a');break;case _0x3488('0x2b'):_0x5e7ac8[_0x3488('0x16')]='FaxQueue';break;case _0x3488('0x2c'):_0x5e7ac8[_0x3488('0x16')]='FaxAccount';break;case _0x3488('0x2d'):case _0x3488('0x2e'):case _0x3488('0x2f'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x30');break;case _0x3488('0x31'):_0x5e7ac8['childModel']=_0x3488('0x32');break;case'voicemails':_0x5e7ac8[_0x3488('0x16')]='VoiceMail';break;case _0x3488('0x33'):_0x5e7ac8[_0x3488('0x16')]='VoiceRecording';_0x5e7ac8['parentSections']=[{'name':'Agents','field':_0x3488('0xd'),'foreignKey':_0x3488('0x34'),'model':_0x3488('0x35'),'filter':{'field':_0x3488('0x36'),'value':[_0x3488('0x37')]}},{'name':'Telephones','field':'name','foreignKey':_0x3488('0x34'),'model':_0x3488('0x35'),'filter':{'field':_0x3488('0x36'),'value':[_0x3488('0x38')]}},{'name':_0x3488('0x39'),'field':'name','foreignKey':'queue','model':_0x3488('0x3a'),'filter':{'field':_0x3488('0x13'),'value':[_0x3488('0x3b')]}},{'name':_0x3488('0x3c'),'field':_0x3488('0xd'),'foreignKey':_0x3488('0x3d'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x3488('0x3e')]}}];break;case _0x3488('0x3f'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x40');break;case'chanspies':_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x41');break;case _0x3488('0x42'):_0x5e7ac8['childModel']=_0x3488('0x43');break;case'ivrcampaigns':_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x44');break;case _0x3488('0x45'):_0x5e7ac8[_0x3488('0x16')]='MailQueue';break;case _0x3488('0x46'):_0x5e7ac8['childModel']=_0x3488('0x47');break;case _0x3488('0x48'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x49');break;case _0x3488('0x4a'):_0x5e7ac8['childModel']=_0x3488('0x4b');break;case _0x3488('0x4c'):_0x5e7ac8[_0x3488('0x16')]='OpenchannelAccount';break;case'smsqueues':_0x5e7ac8[_0x3488('0x16')]='SmsQueue';break;case _0x3488('0x4d'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x4e');break;case _0x3488('0x4f'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x50');break;case _0x3488('0x51'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x52');break;case _0x3488('0x53'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x54');break;case _0x3488('0x55'):case _0x3488('0x56'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x3a');if(_0x33e468){_0x5e7ac8[_0x3488('0x1a')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case'users':case _0x3488('0x57'):case _0x3488('0x58'):_0x5e7ac8[_0x3488('0x16')]='User';if(_0x33e468){_0x5e7ac8[_0x3488('0x1a')]=[{'name':_0x3488('0x59'),'filter':{'field':_0x3488('0x36'),'value':['admin','user']},'ignore':!![]},{'name':_0x3488('0x5a')},{'name':_0x3488('0x5b')}];}break;case'zendeskaccounts':_0x5e7ac8[_0x3488('0x16')]='ZendeskAccount';break;case _0x3488('0x5c'):_0x5e7ac8['childModel']=_0x3488('0x5d');break;case'freshdeskaccounts':_0x5e7ac8['childModel']=_0x3488('0x5e');break;case _0x3488('0x5f'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x60');break;case _0x3488('0x61'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x62');break;case'zohoaccounts':_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x63');break;case _0x3488('0x64'):_0x5e7ac8[_0x3488('0x16')]='User';break;case _0x3488('0x65'):_0x5e7ac8['childModel']=_0x3488('0x66');break;case _0x3488('0x67'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x68');break;case _0x3488('0x69'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x6a');break;case _0x3488('0x6b'):_0x5e7ac8['childModel']=_0x3488('0x6c');break;case _0x3488('0x6d'):_0x5e7ac8['childModel']=_0x3488('0x6e');break;case _0x3488('0x6f'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x70');break;case _0x3488('0x71'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x72');break;case _0x3488('0x73'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x74');break;case _0x3488('0x75'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x76');break;case _0x3488('0x77'):_0x5e7ac8['childModel']=_0x3488('0x78');break;case _0x3488('0x79'):_0x5e7ac8['childModel']='Trunk';break;case _0x3488('0x7a'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x7b');break;case'plugins':_0x5e7ac8[_0x3488('0x16')]='Plugin';break;case _0x3488('0x7c'):_0x5e7ac8['childModel']=_0x3488('0x11');_0x5e7ac8[_0x3488('0x1a')]=[{'name':_0x3488('0x7d'),'field':'id','foreignKey':_0x3488('0x7e')}];break;case _0x3488('0x7f'):_0x5e7ac8[_0x3488('0x16')]=_0x3488('0x80');break;}return _0x5e7ac8;}function _0x51ca45(_0x3b07d6,_0x24aaa2){var _0x3adb4b=_0x3b07d6['charAt'](0x0)[_0x3488('0x81')]()+_0x3b07d6[_0x3488('0x82')](0x1);var _0x2ee377={'type':_0x94d054[_0x3488('0x83')]['QueryTypes'][_0x3488('0x84')],'raw':!![]};return new Promise(function(_0x126171,_0x250beb){var _0x5128a8=squel[_0x3488('0x85')]()[_0x3488('0x10')]('ui.'+_0x3adb4b+_0x3488('0x86'),'id')[_0x3488('0x10')]('ui.createdAt')[_0x3488('0x87')](_0x3488('0x88')+_0x3b07d6+_0x3488('0x89'),'ui')[_0x3488('0x8a')]('ui.UserId\x20=\x20?',_0x24aaa2['id']);return _0x94d054[_0x3488('0x8b')][_0x3488('0x8c')](_0x5128a8[_0x3488('0x8d')](),_0x2ee377)[_0x3488('0x8')](function(_0x422720){_0x24aaa2[_0x3adb4b+_0x3488('0x8e')]=_0x422720;_0x126171(_0x422720);})['catch'](function(_0x1b78f5){_0x250beb(_0x1b78f5);});});}return _0x14becd[_0x3488('0x8f')](_0x3488('0x90'),attributes,{'tableName':_0x3488('0x91'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xbc326d){var _0x39823b={'raw':_0xbc326d[_0x3488('0x8c')][_0x3488('0x92')],'where':{}};var _0x229cd6={};var _0x2b0805={'count':0x0,'rows':[]};var _0xcc36a0=_0xbc326d[_0x3488('0x8c')][_0x3488('0x93')];var _0x3d48eb=_0xbc326d[_0x3488('0x8c')]['mergeResources']||![];var _0x369d98=_0x31ce98(_0xcc36a0,_0x3d48eb);if(!_0x369d98[_0x3488('0x16')])throw new Error('Invalid\x20section\x20\x27'+_0xcc36a0+'\x27');var _0x1dd28a=[{'name':_0xcc36a0}];if(!_[_0x3488('0x94')](_0x369d98[_0x3488('0x1a')]))_0x1dd28a=_0x369d98[_0x3488('0x1a')];var _0x5965c5=[];for(var _0x23aba3=0x0;_0x23aba3<_0x1dd28a[_0x3488('0x95')];_0x23aba3++){_0x5965c5[_0x3488('0x96')](_0x94d054[_0x3488('0x97')][_0x3488('0x98')]({'where':{'userProfileId':_0xbc326d[_0x3488('0x99')]['id'],'name':_0x1dd28a[_0x23aba3][_0x3488('0xd')]},'raw':!![]}));}return Promise[_0x3488('0x9a')](_0x5965c5)[_0x3488('0x8')](function(_0x4059b8){var _0x534e63=_['filter'](_0x4059b8,function(_0x421eb8){return _0x421eb8?_0x421eb8:undefined;});var _0x22851e=_[_0x3488('0x5')](_0x1dd28a,[_0x3488('0x9b'),!![]]);var _0x42b8ff=_[_0x3488('0x94')](_0x534e63)&&_[_0x3488('0x94')](_0x22851e)?null:_[_0x3488('0x9c')](_0x22851e,_0x534e63);if(!_0x42b8ff)return null;var _0x49aa9a=[];for(var _0x4c268f=0x0;_0x4c268f<_0x42b8ff[_0x3488('0x95')];_0x4c268f++){var _0x414b32=_[_0x3488('0x98')](_0x1dd28a,function(_0x15ca27){return _0x42b8ff[_0x4c268f]?_0x15ca27[_0x3488('0xd')]===_0x42b8ff[_0x4c268f][_0x3488('0xd')]:null;});if(_0x414b32){if(_0x42b8ff[_0x4c268f]['ignore']){_0x49aa9a[_0x3488('0x96')](_0xc7fe98(_0x369d98['childModel'],_0x42b8ff[_0x4c268f]));}else{if(!_0x42b8ff[_0x4c268f][_0x3488('0x9d')]){_0x49aa9a[_0x3488('0x96')](_0x12034b(_0x414b32,_0x42b8ff[_0x4c268f],_0x369d98[_0x3488('0x16')]));}else{if(_0x414b32[_0x3488('0xc')]){_0x49aa9a['push'](_0x4a41ca(_0x414b32,_0x42b8ff[_0x4c268f]));}}}}}return Promise[_0x3488('0x9a')](_0x49aa9a);})[_0x3488('0x8')](function(_0x5d00a1){var _0x5eef02=_0x5d00a1;var _0x37c8b9=null;if(_0x5eef02){_0x37c8b9=_0x5eef02[_0x3488('0x95')]===0x1?_0x5eef02[0x0]:null;}if(!_0x37c8b9&&!_0x5eef02)return _0x2b0805;var _0x22a59d=_0x94d054[_0x369d98[_0x3488('0x16')]]['rawAttributes'];_0x229cd6[_0x3488('0xc')]=_[_0x3488('0x9e')](_0x22a59d);_0x229cd6[_0x3488('0x8c')]=_[_0x3488('0x9e')](_0xbc326d[_0x3488('0x8c')]);_0x229cd6[_0x3488('0x9f')]=_[_0x3488('0xa0')](_0x229cd6[_0x3488('0xc')],_0x229cd6[_0x3488('0x8c')]);_0x39823b[_0x3488('0xa1')]=_[_0x3488('0xa0')](_0x229cd6[_0x3488('0xc')],qs[_0x3488('0xa2')](_0xbc326d[_0x3488('0x8c')][_0x3488('0xa2')]));_0x39823b['attributes']=_0x39823b[_0x3488('0xa1')][_0x3488('0x95')]?_0x39823b[_0x3488('0xa1')]:_0x229cd6[_0x3488('0xc')];if(!_0xbc326d['query'][_0x3488('0xa3')]('nolimit')){_0x39823b[_0x3488('0xa4')]=qs[_0x3488('0xa4')](_0xbc326d['query'][_0x3488('0xa4')]);_0x39823b['offset']=qs[_0x3488('0xa5')](_0xbc326d['query'][_0x3488('0xa5')]);}_0x39823b[_0x3488('0xa6')]=qs[_0x3488('0xa7')](_0xbc326d[_0x3488('0x8c')][_0x3488('0xa7')]);_0x39823b[_0x3488('0x8a')]=qs[_0x3488('0x9f')](_[_0x3488('0xa8')](_0xbc326d[_0x3488('0x8c')],_0x229cd6[_0x3488('0x9f')]));if(_0xbc326d[_0x3488('0x8c')][_0x3488('0x5')]){_0x39823b['where']=_[_0x3488('0xa9')](_0x39823b[_0x3488('0x8a')],{'$or':_[_0x3488('0xa')](_0x22a59d,function(_0x44cc08){if(_0x44cc08[_0x3488('0x13')][_0x3488('0xaa')]!==_0x3488('0xab')){var _0x134980={};_0x134980[_0x44cc08['field']]={'$like':'%'+_0xbc326d[_0x3488('0x8c')][_0x3488('0x5')]+'%'};return _0x134980;}})});}var _0x8ec178=[];var _0x24aa77=null;var _0x38dba3={};if(_0x37c8b9){_0x24aa77=_['find'](_0x1dd28a,[_0x3488('0xd'),_0x37c8b9['name']]);if(_0x24aa77[_0x3488('0x10')]){_0x38dba3={};if(_0x369d98['childModel']===_0x3488('0x11')){_0x38dba3[_0x24aa77[_0x3488('0xac')]]=_[_0x3488('0xa')](_0x37c8b9[_0x3488('0x9')],'id');}else{_0x38dba3[_0x24aa77[_0x3488('0xac')]]=_0x37c8b9[_0x3488('0x9')];}_0x8ec178['push'](_0x38dba3);}else{_0x39823b[_0x3488('0x8a')]['id']=_0x37c8b9[_0x3488('0x9')];}}else{for(var _0x5d2478=0x0;_0x5d2478<_0x5eef02[_0x3488('0x95')];_0x5d2478++){_0x24aa77=_[_0x3488('0x98')](_0x1dd28a,[_0x3488('0xd'),_0x5eef02[_0x5d2478]['name']]);if(_0x24aa77[_0x3488('0x10')]){_0x38dba3={};_0x38dba3[_0x24aa77[_0x3488('0xac')]]=_0x5eef02[_0x5d2478][_0x3488('0x9')];_0x8ec178[_0x3488('0x96')](_0x38dba3);}else{if(!_0x39823b['where']['id'])_0x39823b['where']['id']=[];_0x5eef02[_0x5d2478]['associatedResources'][_0x3488('0xad')](function(_0x206f9d){_0x39823b[_0x3488('0x8a')]['id']['push'](_0x206f9d);});}}}if(!_[_0x3488('0x94')](_0x8ec178)){_0x39823b[_0x3488('0x8a')]=_[_0x3488('0xa9')](_0x39823b[_0x3488('0x8a')],{'$and':{'$or':_0x8ec178}});}_0x39823b=_['merge']({},_0x39823b,_0xbc326d[_0x3488('0xae')]);if(_0x37c8b9&&!_0x37c8b9[_0x3488('0x9d')]&&_0x369d98[_0x3488('0x16')]===_0x3488('0x11')){if(_0xbc326d['query']['includeAll']){_0x39823b[_0x3488('0xaf')]=[{'all':!![]}];}return _0x94d054[_0x369d98[_0x3488('0x16')]][_0x3488('0x7')](_0x39823b)[_0x3488('0x8')](function(_0x1ed832){var _0x41e759=[];_0x1ed832[_0x3488('0xad')](function(_0x3ae5cf){var _0x1b996a;switch(_0x3ae5cf['reportType']){case'default':_0x1b996a=_[_0x3488('0x98')](_0x37c8b9[_0x3488('0x9')],function(_0x3acd88){return _0x3acd88['id']===_0x3ae5cf[_0x3488('0x7e')]&&_0x3acd88[_0x3488('0x13')]==='DefaultReports';});break;case'custom':_0x1b996a=_[_0x3488('0x98')](_0x37c8b9[_0x3488('0x9')],function(_0xaf9571){return _0xaf9571['id']===_0x3ae5cf['reportId']&&_0xaf9571['type']===_0x3488('0xb0');});break;}if(_0x1b996a)_0x41e759[_0x3488('0x96')](_0x3ae5cf);});_0x2b0805['count']=_0x41e759['length'];_0x2b0805[_0x3488('0xb1')]=_0x41e759;return _0x2b0805;});}else{if(!_[_0x3488('0x94')](_0xbc326d[_0x3488('0x8c')]['ids'])){_0x39823b[_0x3488('0x8a')]['id']=_0x39823b[_0x3488('0x8a')]['id']?_[_0x3488('0xa0')](_0x39823b['where']['id'],_0xbc326d[_0x3488('0x8c')][_0x3488('0xb2')]):_0xbc326d[_0x3488('0x8c')][_0x3488('0xb2')];if(_0xbc326d[_0x3488('0x8c')]['customSorting']){_0x39823b[_0x3488('0xa6')]=_0xbc326d['query'][_0x3488('0xb3')];}}if(_0xbc326d[_0x3488('0x8c')][_0x3488('0xb4')]){_0x39823b[_0x3488('0x8a')]=_[_0x3488('0xa9')](_0x39823b['where'],{'$and':_0xbc326d[_0x3488('0x8c')][_0x3488('0xb4')]});}return _0x94d054[_0x369d98['childModel']][_0x3488('0xb5')]({'where':_0x39823b[_0x3488('0x8a')]})[_0x3488('0x8')](function(_0x2f0f5e){_0x2b0805[_0x3488('0xb5')]=_0x2f0f5e;if(_0xbc326d[_0x3488('0x8c')][_0x3488('0xb6')]){if(_0x369d98[_0x3488('0x16')]==='CmContact'){_0x39823b[_0x3488('0xaf')]=[{'model':_0x94d054['Tag'],'as':'Tags','attributes':['id','name',_0x3488('0xb7')],'required':_0xbc326d[_0x3488('0x8c')][_0x3488('0xb8')]?!![]:![]},{'model':_0x94d054[_0x3488('0x74')],'as':_0x3488('0xb9'),'attributes':['id',_0x3488('0xd'),_0x3488('0xb7')],'through':_0xbc326d['query']['tag']?{'attributes':[],'where':{'TagId':_0xbc326d['query'][_0x3488('0xb8')]||undefined}}:{},'required':_0xbc326d[_0x3488('0x8c')]['tag']?!![]:![]}];}else{_0x39823b[_0x3488('0xaf')]=[{'all':!![]}];}}return _0x94d054[_0x369d98[_0x3488('0x16')]]['findAll'](_0x39823b);})[_0x3488('0x8')](function(_0x52528c){_0x2b0805[_0x3488('0xb1')]=_0x52528c;if(_0xcc36a0===_0x3488('0x5a')&&_0xbc326d[_0x3488('0x8c')][_0x3488('0xba')]===_0x3488('0xbb')){var _0x3087b6=[];for(var _0x2b5858=0x0;_0x2b5858<_0x2b0805['rows'][_0x3488('0x95')];_0x2b5858++){_0x3087b6[_0x3488('0x96')](_0x51ca45(_0x3488('0xbc'),_0x2b0805[_0x3488('0xb1')][_0x2b5858]['dataValues']));_0x3087b6[_0x3488('0x96')](_0x51ca45('sms',_0x2b0805['rows'][_0x2b5858]['dataValues']));_0x3087b6['push'](_0x51ca45(_0x3488('0xbd'),_0x2b0805[_0x3488('0xb1')][_0x2b5858][_0x3488('0xbe')]));_0x3087b6[_0x3488('0x96')](_0x51ca45(_0x3488('0xbf'),_0x2b0805['rows'][_0x2b5858]['dataValues']));_0x3087b6[_0x3488('0x96')](_0x51ca45(_0x3488('0xc0'),_0x2b0805[_0x3488('0xb1')][_0x2b5858][_0x3488('0xbe')]));_0x3087b6[_0x3488('0x96')](_0x51ca45('whatsapp',_0x2b0805[_0x3488('0xb1')][_0x2b5858][_0x3488('0xbe')]));}return Promise[_0x3488('0x9a')](_0x3087b6)[_0x3488('0x8')](function(){return _0x2b0805;});}return _0x2b0805;});}});}}});}; \ No newline at end of file +var _0xc1fd=['customSorting','extraQueryConditions','CmContact','Tag','Tags','ThroughTags','color','tag','openTabs','true','dataValues','fax','openchannel','whatsapp','all','lodash','../../components/parsers/qs','squel','exports','models','filter','findAll','then','associatedResources','catch','field','value','map','name','UserProfileResource','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','voicerecordings','VoiceRecording','membername','role','agent','Telephones','User','telephone','VoiceQueues','VoiceQueue','QueueCampaigns','queue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','MailAccount','mailsubstatuses','openchannelqueues','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','admin','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Schedule','Sound','tags','templates','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','user_profiles','raw','section','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','rawAttributes','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids'];(function(_0x34e5c3,_0x2e2b9b){var _0x175897=function(_0x18c00b){while(--_0x18c00b){_0x34e5c3['push'](_0x34e5c3['shift']());}};_0x175897(++_0x2e2b9b);}(_0xc1fd,0xd3));var _0xdc1f=function(_0x5c56ca,_0x10f0a9){_0x5c56ca=_0x5c56ca-0x0;var _0x3bdfcd=_0xc1fd[_0x5c56ca];return _0x3bdfcd;};'use strict';var _=require(_0xdc1f('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0xdc1f('0x1'));var squel=require(_0xdc1f('0x2'));module[_0xdc1f('0x3')]=function(_0x3f469f){var _0x422a39=_0x3f469f[_0xdc1f('0x4')];function _0x76e1b6(_0x231194,_0x16d46f){return new Promise(function(_0x526024,_0x146559){if(!_0x16d46f)return _0x526024(null);var _0x3d51e1=_0x16d46f[_0xdc1f('0x5')]?{[_0x16d46f[_0xdc1f('0x5')]['field']]:_0x16d46f[_0xdc1f('0x5')]['value']}:undefined;return _0x422a39[_0x231194][_0xdc1f('0x6')]({'where':_0x3d51e1,'raw':!![]})[_0xdc1f('0x7')](function(_0x1d44bd){_0x16d46f[_0xdc1f('0x8')]=_['map'](_0x1d44bd,'id');_0x526024(_0x16d46f);})[_0xdc1f('0x9')](function(_0x5cac53){_0x146559(_0x5cac53);});});}function _0x440759(_0x176d32,_0x3b261e){return new Promise(function(_0x562fe5,_0x4f4884){var _0x1fa827=_0x176d32[_0xdc1f('0x5')]?{[_0x176d32['filter'][_0xdc1f('0xa')]]:_0x176d32[_0xdc1f('0x5')][_0xdc1f('0xb')]}:undefined;return _0x422a39[_0x176d32['model']][_0xdc1f('0x6')]({'where':_0x1fa827,'raw':!![]})[_0xdc1f('0x7')](function(_0x464993){_0x3b261e[_0xdc1f('0x8')]=_[_0xdc1f('0xc')](_0x464993,function(_0x420609){return _0x420609[_0xdc1f('0xd')];});_0x562fe5(_0x3b261e);})[_0xdc1f('0x9')](function(_0xbabb57){_0x4f4884(_0xbabb57);});});}function _0x1cea5f(_0x49321b,_0x1d8b4e,_0x5e8453){if(!_0x1d8b4e)return Promise['resolve'](null);return new Promise(function(_0x9ce4bd,_0x502080){return _0x422a39[_0xdc1f('0xe')][_0xdc1f('0x6')]({'where':{'sectionId':_0x1d8b4e['id']},'raw':!![]})[_0xdc1f('0x7')](function(_0x28760c){if(_0x49321b['field']&&_0x49321b[_0xdc1f('0xa')]!=='id'){_0x1d8b4e['associatedResources']=_[_0xdc1f('0xc')](_0x28760c,function(_0x1e66a0){return _0x1e66a0[_0x49321b[_0xdc1f('0xa')]];});}else{if(_0x5e8453==='AnalyticExtractedReport'){_0x1d8b4e['associatedResources']=_[_0xdc1f('0xc')](_0x28760c,function(_0x530d6d){return{'id':_0x530d6d[_0xdc1f('0xf')],'type':_0x530d6d[_0xdc1f('0x10')]};});}else{_0x1d8b4e[_0xdc1f('0x8')]=_[_0xdc1f('0xc')](_0x28760c,function(_0x3f7ccb){return _0x3f7ccb[_0xdc1f('0xf')];});}}_0x9ce4bd(_0x1d8b4e);})[_0xdc1f('0x9')](function(_0xefaab){_0x502080(_0xefaab);});});}function _0x720800(_0xaf7ce3,_0x430c6f){var _0x456d69={'parentSections':[]};switch(_0xaf7ce3[_0xdc1f('0x11')]()){case _0xdc1f('0x12'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x14');break;case'odbc':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x15');break;case _0xdc1f('0x16'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x17');_0x456d69['parentSections']=[{'name':_0xdc1f('0x18'),'field':_0xdc1f('0xd'),'foreignKey':'projectName'}];break;case _0xdc1f('0x19'):_0x456d69[_0xdc1f('0x13')]='JscriptyProject';break;case'contacts':_0x456d69[_0xdc1f('0x13')]='CmContact';_0x456d69[_0xdc1f('0x1a')]=[{'name':_0xdc1f('0x1b'),'field':'id','foreignKey':_0xdc1f('0x1c')}];break;case _0xdc1f('0x1d'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x1e');break;case _0xdc1f('0x1f'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x20');break;case _0xdc1f('0x21'):_0x456d69['childModel']=_0xdc1f('0x22');break;case _0xdc1f('0x23'):_0x456d69['childModel']='ChatQueue';break;case _0xdc1f('0x24'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x25');break;case'faxqueues':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x26');break;case _0xdc1f('0x27'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x28');break;case _0xdc1f('0x29'):case _0xdc1f('0x2a'):case _0xdc1f('0x2b'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x2c');break;case'contexts':_0x456d69['childModel']=_0xdc1f('0x2d');break;case _0xdc1f('0x2e'):_0x456d69[_0xdc1f('0x13')]='VoiceMail';break;case _0xdc1f('0x2f'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x30');_0x456d69[_0xdc1f('0x1a')]=[{'name':'Agents','field':_0xdc1f('0xd'),'foreignKey':_0xdc1f('0x31'),'model':'User','filter':{'field':_0xdc1f('0x32'),'value':[_0xdc1f('0x33')]}},{'name':_0xdc1f('0x34'),'field':_0xdc1f('0xd'),'foreignKey':'membername','model':_0xdc1f('0x35'),'filter':{'field':'role','value':[_0xdc1f('0x36')]}},{'name':_0xdc1f('0x37'),'field':'name','foreignKey':'queue','model':_0xdc1f('0x38'),'filter':{'field':_0xdc1f('0x10'),'value':['inbound']}},{'name':_0xdc1f('0x39'),'field':_0xdc1f('0xd'),'foreignKey':_0xdc1f('0x3a'),'model':_0xdc1f('0x38'),'filter':{'field':_0xdc1f('0x10'),'value':['outbound']}}];break;case _0xdc1f('0x3b'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x3c');break;case _0xdc1f('0x3d'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x3e');break;case _0xdc1f('0x3f'):_0x456d69[_0xdc1f('0x13')]='VoicePrefix';break;case _0xdc1f('0x40'):_0x456d69[_0xdc1f('0x13')]='Campaign';break;case _0xdc1f('0x41'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x42');break;case'mailaccounts':_0x456d69['childModel']=_0xdc1f('0x43');break;case _0xdc1f('0x44'):_0x456d69['childModel']='MailSubstatus';break;case _0xdc1f('0x45'):_0x456d69[_0xdc1f('0x13')]='OpenchannelQueue';break;case'openchannelaccounts':_0x456d69[_0xdc1f('0x13')]='OpenchannelAccount';break;case _0xdc1f('0x46'):_0x456d69['childModel']=_0xdc1f('0x47');break;case _0xdc1f('0x48'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x49');break;case _0xdc1f('0x4a'):_0x456d69[_0xdc1f('0x13')]='WhatsappQueue';break;case _0xdc1f('0x4b'):_0x456d69['childModel']=_0xdc1f('0x4c');break;case'teams':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x4d');break;case _0xdc1f('0x4e'):case _0xdc1f('0x4f'):_0x456d69[_0xdc1f('0x13')]='VoiceQueue';if(_0x430c6f){_0x456d69[_0xdc1f('0x1a')]=[{'name':_0xdc1f('0x37')},{'name':_0xdc1f('0x39')}];}break;case'users':case'agents':case'telephones':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x35');if(_0x430c6f){_0x456d69['parentSections']=[{'name':'Users','filter':{'field':'role','value':[_0xdc1f('0x50'),'user']},'ignore':!![]},{'name':_0xdc1f('0x51')},{'name':_0xdc1f('0x34')}];}break;case _0xdc1f('0x52'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x53');break;case _0xdc1f('0x54'):_0x456d69[_0xdc1f('0x13')]='SalesforceAccount';break;case _0xdc1f('0x55'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x56');break;case _0xdc1f('0x57'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x58');break;case _0xdc1f('0x59'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x5a');break;case _0xdc1f('0x5b'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x5c');break;case _0xdc1f('0x5d'):_0x456d69[_0xdc1f('0x13')]='User';break;case _0xdc1f('0x5e'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x5f');break;case _0xdc1f('0x60'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x61');break;case _0xdc1f('0x62'):_0x456d69['childModel']=_0xdc1f('0x63');break;case _0xdc1f('0x64'):_0x456d69[_0xdc1f('0x13')]='Interval';break;case _0xdc1f('0x65'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x66');break;case _0xdc1f('0x67'):_0x456d69['childModel']=_0xdc1f('0x68');break;case'sounds':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x69');break;case _0xdc1f('0x6a'):_0x456d69['childModel']='Tag';break;case _0xdc1f('0x6b'):_0x456d69['childModel']='Template';break;case _0xdc1f('0x6c'):_0x456d69[_0xdc1f('0x13')]='Trigger';break;case _0xdc1f('0x6d'):_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x6e');break;case _0xdc1f('0x6f'):_0x456d69['childModel']=_0xdc1f('0x70');break;case _0xdc1f('0x71'):_0x456d69['childModel']=_0xdc1f('0x72');break;case _0xdc1f('0x73'):_0x456d69['childModel']=_0xdc1f('0x74');_0x456d69['parentSections']=[{'name':_0xdc1f('0x75'),'field':'id','foreignKey':_0xdc1f('0x76')}];break;case'metrics':_0x456d69[_0xdc1f('0x13')]=_0xdc1f('0x77');break;}return _0x456d69;}function _0xb38e39(_0xc8e79c,_0x47a293){var _0x5475a9=_0xc8e79c['charAt'](0x0)[_0xdc1f('0x78')]()+_0xc8e79c[_0xdc1f('0x79')](0x1);var _0x277df0={'type':_0x422a39[_0xdc1f('0x7a')][_0xdc1f('0x7b')][_0xdc1f('0x7c')],'raw':!![]};return new Promise(function(_0x41a955,_0x4843fe){var _0x3133e1=squel[_0xdc1f('0x7d')]()[_0xdc1f('0xa')](_0xdc1f('0x7e')+_0x5475a9+_0xdc1f('0x7f'),'id')[_0xdc1f('0xa')]('ui.createdAt')[_0xdc1f('0x80')](_0xdc1f('0x81')+_0xc8e79c+_0xdc1f('0x82'),'ui')[_0xdc1f('0x83')](_0xdc1f('0x84'),_0x47a293['id']);return _0x422a39[_0xdc1f('0x85')][_0xdc1f('0x86')](_0x3133e1[_0xdc1f('0x87')](),_0x277df0)[_0xdc1f('0x7')](function(_0x4bac3a){_0x47a293[_0x5475a9+_0xdc1f('0x88')]=_0x4bac3a;_0x41a955(_0x4bac3a);})[_0xdc1f('0x9')](function(_0x1b34a7){_0x4843fe(_0x1b34a7);});});}return _0x3f469f[_0xdc1f('0x89')]('UserProfile',attributes,{'tableName':_0xdc1f('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x305e70){var _0x55d6ff={'raw':_0x305e70[_0xdc1f('0x86')][_0xdc1f('0x8b')],'where':{}};var _0x37bc18={};var _0xce1f23={'count':0x0,'rows':[]};var _0x545c5d=_0x305e70[_0xdc1f('0x86')][_0xdc1f('0x8c')];var _0xe40f2=_0x305e70[_0xdc1f('0x86')]['mergeResources']||![];var _0x2346bf=_0x720800(_0x545c5d,_0xe40f2);if(!_0x2346bf[_0xdc1f('0x13')])throw new Error(_0xdc1f('0x8d')+_0x545c5d+'\x27');var _0x3b2b19=[{'name':_0x545c5d}];if(!_[_0xdc1f('0x8e')](_0x2346bf[_0xdc1f('0x1a')]))_0x3b2b19=_0x2346bf['parentSections'];var _0x3eace4=[];for(var _0x3a5733=0x0;_0x3a5733<_0x3b2b19[_0xdc1f('0x8f')];_0x3a5733++){_0x3eace4[_0xdc1f('0x90')](_0x422a39[_0xdc1f('0x91')][_0xdc1f('0x92')]({'where':{'userProfileId':_0x305e70[_0xdc1f('0x93')]['id'],'name':_0x3b2b19[_0x3a5733][_0xdc1f('0xd')]},'raw':!![]}));}return Promise['all'](_0x3eace4)[_0xdc1f('0x7')](function(_0x1b94ef){var _0x21c199=_['filter'](_0x1b94ef,function(_0x1ee071){return _0x1ee071?_0x1ee071:undefined;});var _0x544c45=_[_0xdc1f('0x5')](_0x3b2b19,[_0xdc1f('0x94'),!![]]);var _0x48b9c3=_[_0xdc1f('0x8e')](_0x21c199)&&_[_0xdc1f('0x8e')](_0x544c45)?null:_[_0xdc1f('0x95')](_0x544c45,_0x21c199);if(!_0x48b9c3)return null;var _0x31ac26=[];for(var _0x41a9b8=0x0;_0x41a9b8<_0x48b9c3[_0xdc1f('0x8f')];_0x41a9b8++){var _0x3e05a6=_['find'](_0x3b2b19,function(_0x231a2f){return _0x48b9c3[_0x41a9b8]?_0x231a2f[_0xdc1f('0xd')]===_0x48b9c3[_0x41a9b8][_0xdc1f('0xd')]:null;});if(_0x3e05a6){if(_0x48b9c3[_0x41a9b8][_0xdc1f('0x94')]){_0x31ac26[_0xdc1f('0x90')](_0x76e1b6(_0x2346bf[_0xdc1f('0x13')],_0x48b9c3[_0x41a9b8]));}else{if(!_0x48b9c3[_0x41a9b8][_0xdc1f('0x96')]){_0x31ac26[_0xdc1f('0x90')](_0x1cea5f(_0x3e05a6,_0x48b9c3[_0x41a9b8],_0x2346bf[_0xdc1f('0x13')]));}else{if(_0x3e05a6['model']){_0x31ac26['push'](_0x440759(_0x3e05a6,_0x48b9c3[_0x41a9b8]));}}}}}return Promise['all'](_0x31ac26);})[_0xdc1f('0x7')](function(_0x5b9a3c){var _0x5a0172=_0x5b9a3c;var _0x16b2a3=null;if(_0x5a0172){_0x16b2a3=_0x5a0172[_0xdc1f('0x8f')]===0x1?_0x5a0172[0x0]:null;}if(!_0x16b2a3&&!_0x5a0172)return _0xce1f23;var _0x404a3e=_0x422a39[_0x2346bf[_0xdc1f('0x13')]][_0xdc1f('0x97')];_0x37bc18['model']=_[_0xdc1f('0x98')](_0x404a3e);_0x37bc18[_0xdc1f('0x86')]=_[_0xdc1f('0x98')](_0x305e70[_0xdc1f('0x86')]);_0x37bc18[_0xdc1f('0x99')]=_['intersection'](_0x37bc18[_0xdc1f('0x9a')],_0x37bc18['query']);_0x55d6ff[_0xdc1f('0x9b')]=_[_0xdc1f('0x9c')](_0x37bc18[_0xdc1f('0x9a')],qs[_0xdc1f('0x9d')](_0x305e70[_0xdc1f('0x86')][_0xdc1f('0x9d')]));_0x55d6ff[_0xdc1f('0x9b')]=_0x55d6ff['attributes']['length']?_0x55d6ff[_0xdc1f('0x9b')]:_0x37bc18[_0xdc1f('0x9a')];if(!_0x305e70['query'][_0xdc1f('0x9e')](_0xdc1f('0x9f'))){_0x55d6ff[_0xdc1f('0xa0')]=qs[_0xdc1f('0xa0')](_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xa0')]);_0x55d6ff[_0xdc1f('0xa1')]=qs[_0xdc1f('0xa1')](_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xa1')]);}_0x55d6ff[_0xdc1f('0xa2')]=qs[_0xdc1f('0xa3')](_0x305e70['query'][_0xdc1f('0xa3')]);_0x55d6ff[_0xdc1f('0x83')]=qs['filters'](_[_0xdc1f('0xa4')](_0x305e70[_0xdc1f('0x86')],_0x37bc18[_0xdc1f('0x99')]));if(_0x305e70['query'][_0xdc1f('0x5')]){_0x55d6ff[_0xdc1f('0x83')]=_[_0xdc1f('0xa5')](_0x55d6ff[_0xdc1f('0x83')],{'$or':_[_0xdc1f('0xc')](_0x404a3e,function(_0x4e0f20){if(_0x4e0f20[_0xdc1f('0x10')][_0xdc1f('0xa6')]!==_0xdc1f('0xa7')){var _0x591c75={};_0x591c75[_0x4e0f20['field']]={'$like':'%'+_0x305e70[_0xdc1f('0x86')]['filter']+'%'};return _0x591c75;}})});}var _0x460d05=[];var _0x266c77=null;var _0x470b55={};if(_0x16b2a3){_0x266c77=_[_0xdc1f('0x92')](_0x3b2b19,[_0xdc1f('0xd'),_0x16b2a3['name']]);if(_0x266c77[_0xdc1f('0xa')]){_0x470b55={};if(_0x2346bf[_0xdc1f('0x13')]==='AnalyticExtractedReport'){_0x470b55[_0x266c77[_0xdc1f('0xa8')]]=_['map'](_0x16b2a3[_0xdc1f('0x8')],'id');}else{_0x470b55[_0x266c77[_0xdc1f('0xa8')]]=_0x16b2a3[_0xdc1f('0x8')];}_0x460d05['push'](_0x470b55);}else{_0x55d6ff[_0xdc1f('0x83')]['id']=_0x16b2a3['associatedResources'];}}else{for(var _0x2b609e=0x0;_0x2b609e<_0x5a0172[_0xdc1f('0x8f')];_0x2b609e++){_0x266c77=_[_0xdc1f('0x92')](_0x3b2b19,[_0xdc1f('0xd'),_0x5a0172[_0x2b609e][_0xdc1f('0xd')]]);if(_0x266c77[_0xdc1f('0xa')]){_0x470b55={};_0x470b55[_0x266c77[_0xdc1f('0xa8')]]=_0x5a0172[_0x2b609e][_0xdc1f('0x8')];_0x460d05[_0xdc1f('0x90')](_0x470b55);}else{if(!_0x55d6ff['where']['id'])_0x55d6ff[_0xdc1f('0x83')]['id']=[];_0x5a0172[_0x2b609e][_0xdc1f('0x8')][_0xdc1f('0xa9')](function(_0x490129){_0x55d6ff[_0xdc1f('0x83')]['id'][_0xdc1f('0x90')](_0x490129);});}}}if(!_[_0xdc1f('0x8e')](_0x460d05)){_0x55d6ff[_0xdc1f('0x83')]=_[_0xdc1f('0xa5')](_0x55d6ff[_0xdc1f('0x83')],{'$and':{'$or':_0x460d05}});}_0x55d6ff=_[_0xdc1f('0xa5')]({},_0x55d6ff,_0x305e70[_0xdc1f('0xaa')]);if(_0x16b2a3&&!_0x16b2a3[_0xdc1f('0x96')]&&_0x2346bf[_0xdc1f('0x13')]===_0xdc1f('0x74')){if(_0x305e70['query'][_0xdc1f('0xab')]){_0x55d6ff[_0xdc1f('0xac')]=[{'all':!![]}];}return _0x422a39[_0x2346bf[_0xdc1f('0x13')]][_0xdc1f('0x6')](_0x55d6ff)[_0xdc1f('0x7')](function(_0x2990af){var _0x3f216e=[];_0x2990af[_0xdc1f('0xa9')](function(_0x5a1bd8){var _0x2f4fb3;switch(_0x5a1bd8[_0xdc1f('0xad')]){case _0xdc1f('0xae'):_0x2f4fb3=_[_0xdc1f('0x92')](_0x16b2a3[_0xdc1f('0x8')],function(_0x1e8e13){return _0x1e8e13['id']===_0x5a1bd8[_0xdc1f('0x76')]&&_0x1e8e13[_0xdc1f('0x10')]===_0xdc1f('0xaf');});break;case _0xdc1f('0xb0'):_0x2f4fb3=_[_0xdc1f('0x92')](_0x16b2a3[_0xdc1f('0x8')],function(_0x7c3148){return _0x7c3148['id']===_0x5a1bd8[_0xdc1f('0x76')]&&_0x7c3148['type']===_0xdc1f('0xb1');});break;}if(_0x2f4fb3)_0x3f216e[_0xdc1f('0x90')](_0x5a1bd8);});_0xce1f23[_0xdc1f('0xb2')]=_0x3f216e['length'];_0xce1f23[_0xdc1f('0xb3')]=_0x3f216e;return _0xce1f23;});}else{if(!_['isEmpty'](_0x305e70['query']['ids'])){_0x55d6ff['where']['id']=_0x55d6ff[_0xdc1f('0x83')]['id']?_[_0xdc1f('0x9c')](_0x55d6ff[_0xdc1f('0x83')]['id'],_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xb4')]):_0x305e70['query']['ids'];if(_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xb5')]){_0x55d6ff[_0xdc1f('0xa2')]=_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xb5')];}}if(_0x305e70['query'][_0xdc1f('0xb6')]){_0x55d6ff['where']=_[_0xdc1f('0xa5')](_0x55d6ff[_0xdc1f('0x83')],{'$and':_0x305e70[_0xdc1f('0x86')]['extraQueryConditions']});}return _0x422a39[_0x2346bf[_0xdc1f('0x13')]][_0xdc1f('0xb2')]({'where':_0x55d6ff[_0xdc1f('0x83')]})['then'](function(_0x5cd56f){_0xce1f23[_0xdc1f('0xb2')]=_0x5cd56f;if(_0x305e70[_0xdc1f('0x86')][_0xdc1f('0xab')]){if(_0x2346bf[_0xdc1f('0x13')]===_0xdc1f('0xb7')){_0x55d6ff[_0xdc1f('0xac')]=[{'model':_0x422a39[_0xdc1f('0xb8')],'as':_0xdc1f('0xb9'),'attributes':['id',_0xdc1f('0xd'),'color'],'required':_0x305e70[_0xdc1f('0x86')]['tag']?!![]:![]},{'model':_0x422a39['Tag'],'as':_0xdc1f('0xba'),'attributes':['id',_0xdc1f('0xd'),_0xdc1f('0xbb')],'through':_0x305e70['query'][_0xdc1f('0xbc')]?{'attributes':[],'where':{'TagId':_0x305e70[_0xdc1f('0x86')]['tag']||undefined}}:{},'required':_0x305e70['query'][_0xdc1f('0xbc')]?!![]:![]}];}else{_0x55d6ff[_0xdc1f('0xac')]=[{'all':!![]}];}}return _0x422a39[_0x2346bf['childModel']]['findAll'](_0x55d6ff);})['then'](function(_0x425264){_0xce1f23['rows']=_0x425264;if(_0x545c5d==='Agents'&&_0x305e70['query'][_0xdc1f('0xbd')]===_0xdc1f('0xbe')){var _0x2185a7=[];for(var _0x4eb63e=0x0;_0x4eb63e<_0xce1f23[_0xdc1f('0xb3')][_0xdc1f('0x8f')];_0x4eb63e++){_0x2185a7[_0xdc1f('0x90')](_0xb38e39('chat',_0xce1f23['rows'][_0x4eb63e]['dataValues']));_0x2185a7[_0xdc1f('0x90')](_0xb38e39('sms',_0xce1f23[_0xdc1f('0xb3')][_0x4eb63e][_0xdc1f('0xbf')]));_0x2185a7[_0xdc1f('0x90')](_0xb38e39(_0xdc1f('0xc0'),_0xce1f23[_0xdc1f('0xb3')][_0x4eb63e][_0xdc1f('0xbf')]));_0x2185a7[_0xdc1f('0x90')](_0xb38e39('mail',_0xce1f23[_0xdc1f('0xb3')][_0x4eb63e]['dataValues']));_0x2185a7['push'](_0xb38e39(_0xdc1f('0xc1'),_0xce1f23[_0xdc1f('0xb3')][_0x4eb63e]['dataValues']));_0x2185a7[_0xdc1f('0x90')](_0xb38e39(_0xdc1f('0xc2'),_0xce1f23[_0xdc1f('0xb3')][_0x4eb63e][_0xdc1f('0xbf')]));}return Promise[_0xdc1f('0xc3')](_0x2185a7)[_0xdc1f('0x7')](function(){return _0xce1f23;});}return _0xce1f23;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index b573522..3d724c5 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 _0x4e83=['bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','client','redis','defaults','socket.io-emitter','./userProfile.socket','request','then','info','request\x20sent','debug','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x33a5ca,_0x3b9fc4){var _0x156125=function(_0x202dd7){while(--_0x202dd7){_0x33a5ca['push'](_0x33a5ca['shift']());}};_0x156125(++_0x3b9fc4);}(_0x4e83,0x1ae));var _0x34e8=function(_0x34e14d,_0x5dea39){_0x34e14d=_0x34e14d-0x0;var _0x3d8e08=_0x4e83[_0x34e14d];return _0x3d8e08;};'use strict';var _=require(_0x34e8('0x0'));var util=require('util');var moment=require(_0x34e8('0x1'));var BPromise=require(_0x34e8('0x2'));var rs=require(_0x34e8('0x3'));var fs=require('fs');var Redis=require(_0x34e8('0x4'));var db=require(_0x34e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x34e8('0x6'));var client=jayson[_0x34e8('0x7')]['http']({'port':0x232a});config[_0x34e8('0x8')]=_[_0x34e8('0x9')](config[_0x34e8('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x34e8('0xa'))(new Redis(config[_0x34e8('0x8')]));require(_0x34e8('0xb'))['register'](socket);function respondWithRpcPromise(_0x8ad56d,_0x1e3038,_0x42bb8d){return new BPromise(function(_0x46fe66,_0x316e99){return client[_0x34e8('0xc')](_0x8ad56d,_0x42bb8d)[_0x34e8('0xd')](function(_0x6827a3){logger[_0x34e8('0xe')]('UserProfile,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'));logger[_0x34e8('0x10')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x1e3038,_0x34e8('0xf'),JSON[_0x34e8('0x11')](_0x6827a3));if(_0x6827a3[_0x34e8('0x12')]){if(_0x6827a3[_0x34e8('0x12')][_0x34e8('0x13')]===0x1f4){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x316e99(_0x6827a3['error'][_0x34e8('0x15')]);}logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x6827a3[_0x34e8('0x12')][_0x34e8('0x15')]);return _0x46fe66(_0x6827a3['error'][_0x34e8('0x15')]);}else{logger[_0x34e8('0xe')](_0x34e8('0x14'),_0x1e3038,_0x34e8('0xf'));_0x46fe66(_0x6827a3[_0x34e8('0x16')][_0x34e8('0x15')]);}})[_0x34e8('0x17')](function(_0x3eb461){logger[_0x34e8('0x12')](_0x34e8('0x14'),_0x1e3038,_0x3eb461);_0x316e99(_0x3eb461);});});} \ No newline at end of file +var _0x8ac9=['message','UserProfile,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','request','then','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x4ade17,_0x1bff9b){var _0x3e4bb9=function(_0x2bbd08){while(--_0x2bbd08){_0x4ade17['push'](_0x4ade17['shift']());}};_0x3e4bb9(++_0x1bff9b);}(_0x8ac9,0x199));var _0x98ac=function(_0xc89f5,_0x1f8de7){_0xc89f5=_0xc89f5-0x0;var _0x39d90b=_0x8ac9[_0xc89f5];return _0x39d90b;};'use strict';var _=require(_0x98ac('0x0'));var util=require(_0x98ac('0x1'));var moment=require(_0x98ac('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98ac('0x3'));var db=require(_0x98ac('0x4'))['db'];var utils=require(_0x98ac('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x98ac('0x6'));var jayson=require(_0x98ac('0x7'));var client=jayson[_0x98ac('0x8')]['http']({'port':0x232a});config['redis']=_[_0x98ac('0x9')](config[_0x98ac('0xa')],{'host':_0x98ac('0xb'),'port':0x18eb});var socket=require(_0x98ac('0xc'))(new Redis(config[_0x98ac('0xa')]));require(_0x98ac('0xd'))['register'](socket);function respondWithRpcPromise(_0x3335ce,_0x55e46f,_0xb21a9d){return new BPromise(function(_0x432461,_0x8f058c){return client[_0x98ac('0xe')](_0x3335ce,_0xb21a9d)[_0x98ac('0xf')](function(_0x4724b6){logger[_0x98ac('0x10')]('UserProfile,\x20%s,\x20%s',_0x55e46f,'request\x20sent');logger[_0x98ac('0x11')](_0x98ac('0x12'),_0x55e46f,_0x98ac('0x13'),JSON[_0x98ac('0x14')](_0x4724b6));if(_0x4724b6['error']){if(_0x4724b6[_0x98ac('0x15')][_0x98ac('0x16')]===0x1f4){logger[_0x98ac('0x15')]('UserProfile,\x20%s,\x20%s',_0x55e46f,_0x4724b6['error'][_0x98ac('0x17')]);return _0x8f058c(_0x4724b6[_0x98ac('0x15')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x55e46f,_0x4724b6[_0x98ac('0x15')][_0x98ac('0x17')]);return _0x432461(_0x4724b6['error'][_0x98ac('0x17')]);}else{logger[_0x98ac('0x10')](_0x98ac('0x18'),_0x55e46f,'request\x20sent');_0x432461(_0x4724b6[_0x98ac('0x19')][_0x98ac('0x17')]);}})[_0x98ac('0x1a')](function(_0x48f000){logger[_0x98ac('0x15')](_0x98ac('0x18'),_0x55e46f,_0x48f000);_0x8f058c(_0x48f000);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 43bb832..e49e8e3 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 _0x3309=['remove','update','emit','removeListener','register','./userProfile.events','save'];(function(_0x540407,_0x2d2166){var _0x1b2aac=function(_0xa20b3d){while(--_0xa20b3d){_0x540407['push'](_0x540407['shift']());}};_0x1b2aac(++_0x2d2166);}(_0x3309,0x1a2));var _0x9330=function(_0x1fe188,_0x11e1df){_0x1fe188=_0x1fe188-0x0;var _0x1b3e93=_0x3309[_0x1fe188];return _0x1b3e93;};'use strict';var UserProfileEvents=require(_0x9330('0x0'));var events=[_0x9330('0x1'),_0x9330('0x2'),_0x9330('0x3')];function createListener(_0x79298d,_0x3ac28f){return function(_0x2e8575){_0x3ac28f[_0x9330('0x4')](_0x79298d,_0x2e8575);};}function removeListener(_0x3c8884,_0xf9410a){return function(){UserProfileEvents[_0x9330('0x5')](_0x3c8884,_0xf9410a);};}exports[_0x9330('0x6')]=function(_0x912508){for(var _0x59ad73=0x0,_0x283330=events['length'];_0x59ad73<_0x283330;_0x59ad73++){var _0x4fac3e=events[_0x59ad73];var _0x4dd54a=createListener('userProfile:'+_0x4fac3e,_0x912508);UserProfileEvents['on'](_0x4fac3e,_0x4dd54a);}}; \ No newline at end of file +var _0x63fc=['./userProfile.events','remove','emit','removeListener','register','length','userProfile:'];(function(_0x2e057a,_0x399f37){var _0x10c9f3=function(_0x2ef459){while(--_0x2ef459){_0x2e057a['push'](_0x2e057a['shift']());}};_0x10c9f3(++_0x399f37);}(_0x63fc,0x150));var _0xc63f=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x63fc[_0x5a95fa];return _0x1a61b8;};'use strict';var UserProfileEvents=require(_0xc63f('0x0'));var events=['save',_0xc63f('0x1'),'update'];function createListener(_0x52c1cb,_0x125dce){return function(_0x15396b){_0x125dce[_0xc63f('0x2')](_0x52c1cb,_0x15396b);};}function removeListener(_0x1fb390,_0x371a84){return function(){UserProfileEvents[_0xc63f('0x3')](_0x1fb390,_0x371a84);};}exports[_0xc63f('0x4')]=function(_0x303965){for(var _0xfc86b4=0x0,_0x3c380d=events[_0xc63f('0x5')];_0xfc86b4<_0x3c380d;_0xfc86b4++){var _0x57b49b=events[_0xfc86b4];var _0x56b083=createListener(_0xc63f('0x6')+_0x57b49b,_0x303965);UserProfileEvents['on'](_0x57b49b,_0x56b083);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 0627b28..87ecb65 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 _0x30a3=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0x30a3,0x1ee));var _0x330a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x30a3[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x330a('0x0'));var util=require(_0x330a('0x1'));var path=require('path');var timeout=require(_0x330a('0x2'));var express=require('express');var router=express[_0x330a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x330a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x330a('0x5'));var controller=require(_0x330a('0x6'));router[_0x330a('0x7')]('/',auth[_0x330a('0x8')](),controller[_0x330a('0x9')]);router[_0x330a('0x7')](_0x330a('0xa'),auth[_0x330a('0x8')](),controller[_0x330a('0xb')]);router['get'](_0x330a('0xc'),auth['isAuthenticated'](),controller[_0x330a('0xd')]);router[_0x330a('0xe')]('/',auth[_0x330a('0x8')](),controller[_0x330a('0xf')]);router[_0x330a('0x10')](_0x330a('0xc'),auth[_0x330a('0x8')](),controller[_0x330a('0x11')]);router[_0x330a('0x12')](_0x330a('0xc'),auth[_0x330a('0x8')](),controller[_0x330a('0x13')]);module[_0x330a('0x14')]=router; \ No newline at end of file +var _0x2a0d=['../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','/describe','describe','get','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x2a0d,0x1c8));var _0xd2a0=function(_0x4bfbc8,_0x182459){_0x4bfbc8=_0x4bfbc8-0x0;var _0xad75e1=_0x2a0d[_0x4bfbc8];return _0xad75e1;};'use strict';var multer=require(_0xd2a0('0x0'));var util=require(_0xd2a0('0x1'));var path=require(_0xd2a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2a0('0x3'));var router=express[_0xd2a0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd2a0('0x5'));var interaction=require(_0xd2a0('0x6'));var config=require(_0xd2a0('0x7'));var controller=require(_0xd2a0('0x8'));router['get']('/',auth[_0xd2a0('0x9')](),controller[_0xd2a0('0xa')]);router['get'](_0xd2a0('0xb'),auth[_0xd2a0('0x9')](),controller[_0xd2a0('0xc')]);router[_0xd2a0('0xd')]('/:id',auth[_0xd2a0('0x9')](),controller[_0xd2a0('0xe')]);router[_0xd2a0('0xf')]('/',auth[_0xd2a0('0x9')](),controller['create']);router[_0xd2a0('0x10')](_0xd2a0('0x11'),auth[_0xd2a0('0x9')](),controller[_0xd2a0('0x12')]);router[_0xd2a0('0x13')](_0xd2a0('0x11'),auth[_0xd2a0('0x9')](),controller[_0xd2a0('0x14')]);module[_0xd2a0('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 9a7845a..33913fd 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 _0x18c5=['sequelize','exports','INTEGER','STRING'];(function(_0x115584,_0x22182b){var _0x26f931=function(_0x3711bc){while(--_0x3711bc){_0x115584['push'](_0x115584['shift']());}};_0x26f931(++_0x22182b);}(_0x18c5,0x148));var _0x518c=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x18c5[_0x5834bc];return _0x3e183a;};'use strict';var Sequelize=require(_0x518c('0x0'));module[_0x518c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x518c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x518c('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x62bc=['sequelize','STRING','INTEGER'];(function(_0x529798,_0x2d10d8){var _0x30bbfa=function(_0x307890){while(--_0x307890){_0x529798['push'](_0x529798['shift']());}};_0x30bbfa(++_0x2d10d8);}(_0x62bc,0x72));var _0xc62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc62b('0x0'));module['exports']={'name':{'type':Sequelize[_0xc62b('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc62b('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 5dac924..ac83785 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 _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model'];(function(_0x1df07a,_0x30f0a2){var _0x5667c3=function(_0x3334b0){while(--_0x3334b0){_0x1df07a['push'](_0x1df07a['shift']());}};_0x5667c3(++_0x30f0a2);}(_0x47c5,0x165));var _0x547c=function(_0x2ad921,_0x3ec1d1){_0x2ad921=_0x2ad921-0x0;var _0x419042=_0x47c5[_0x2ad921];return _0x419042;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['UserProfileResource'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['UserProfileResource']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['UserProfileResource'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['UserProfileResource'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file +var _0x6343=['VIRTUAL','options','UserProfileResource','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x6343,0x168));var _0x3634=function(_0x40a006,_0x420901){_0x40a006=_0x40a006-0x0;var _0x5e8f89=_0x6343[_0x40a006];return _0x5e8f89;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['UserProfileResource'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['UserProfileResource'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index e5ea3ba..19ba98c 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 _0xcb91=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0xcb91,0x114));var _0x1cb9=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0xcb91[_0x47df54];return _0x261b87;};'use strict';var _=require('lodash');var util=require(_0x1cb9('0x0'));var logger=require(_0x1cb9('0x1'))(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var rp=require(_0x1cb9('0x4'));var fs=require('fs');var path=require(_0x1cb9('0x5'));var rimraf=require('rimraf');var config=require(_0x1cb9('0x6'));var attributes=require('./userProfileResource.attributes');module[_0x1cb9('0x7')]=function(_0x2b5e2f,_0x42f508){return _0x2b5e2f['define']('UserProfileResource',attributes,{'tableName':_0x1cb9('0x8'),'paranoid':![],'indexes':[{'name':_0x1cb9('0x9'),'fields':[_0x1cb9('0xa'),_0x1cb9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6947=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6947,0x1c0));var _0x7694=function(_0x15d605,_0x6793ed){_0x15d605=_0x15d605-0x0;var _0x1cc906=_0x6947[_0x15d605];return _0x1cc906;};'use strict';var _=require(_0x7694('0x0'));var util=require(_0x7694('0x1'));var logger=require(_0x7694('0x2'))(_0x7694('0x3'));var moment=require(_0x7694('0x4'));var BPromise=require(_0x7694('0x5'));var rp=require(_0x7694('0x6'));var fs=require('fs');var path=require(_0x7694('0x7'));var rimraf=require(_0x7694('0x8'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module[_0x7694('0x9')]=function(_0x1c693a,_0x32cea0){return _0x1c693a[_0x7694('0xa')]('UserProfileResource',attributes,{'tableName':_0x7694('0xb'),'paranoid':![],'indexes':[{'name':_0x7694('0xc'),'fields':[_0x7694('0xd'),_0x7694('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 8d98f87..4758bf2 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 _0x67fd=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','../../mysqldb'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x67fd,0x1dc));var _0xd67f=function(_0x9763f8,_0x4b85d4){_0x9763f8=_0x9763f8-0x0;var _0x1757c0=_0x67fd[_0x9763f8];return _0x1757c0;};'use strict';var _=require('lodash');var util=require(_0xd67f('0x0'));var moment=require(_0xd67f('0x1'));var BPromise=require(_0xd67f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd67f('0x3'))['db'];var utils=require(_0xd67f('0x4'));var logger=require(_0xd67f('0x5'))(_0xd67f('0x6'));var config=require(_0xd67f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd67f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c36dc,_0x5551d3,_0x332f2f){return new BPromise(function(_0x3bfa47,_0xf5930){return client[_0xd67f('0x9')](_0x2c36dc,_0x332f2f)[_0xd67f('0xa')](function(_0x6bef86){logger[_0xd67f('0xb')](_0xd67f('0xc'),_0x5551d3,_0xd67f('0xd'));logger['debug'](_0xd67f('0xe'),_0x5551d3,_0xd67f('0xd'),JSON[_0xd67f('0xf')](_0x6bef86));if(_0x6bef86['error']){if(_0x6bef86[_0xd67f('0x10')][_0xd67f('0x11')]===0x1f4){logger['error'](_0xd67f('0xc'),_0x5551d3,_0x6bef86[_0xd67f('0x10')][_0xd67f('0x12')]);return _0xf5930(_0x6bef86[_0xd67f('0x10')][_0xd67f('0x12')]);}logger[_0xd67f('0x10')](_0xd67f('0xc'),_0x5551d3,_0x6bef86[_0xd67f('0x10')]['message']);return _0x3bfa47(_0x6bef86[_0xd67f('0x10')][_0xd67f('0x12')]);}else{logger[_0xd67f('0xb')](_0xd67f('0xc'),_0x5551d3,_0xd67f('0xd'));_0x3bfa47(_0x6bef86[_0xd67f('0x13')][_0xd67f('0x12')]);}})['catch'](function(_0x20eb0a){logger[_0xd67f('0x10')](_0xd67f('0xc'),_0x5551d3,_0x20eb0a);_0xf5930(_0x20eb0a);});});} \ No newline at end of file +var _0x7694=['UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x4389ca,_0x447b1a){var _0x16932f=function(_0x4a6de1){while(--_0x4a6de1){_0x4389ca['push'](_0x4389ca['shift']());}};_0x16932f(++_0x447b1a);}(_0x7694,0x86));var _0x4769=function(_0x9e4996,_0x26df96){_0x9e4996=_0x9e4996-0x0;var _0x1ad5f1=_0x7694[_0x9e4996];return _0x1ad5f1;};'use strict';var _=require(_0x4769('0x0'));var util=require(_0x4769('0x1'));var moment=require('moment');var BPromise=require(_0x4769('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4769('0x3'));var db=require(_0x4769('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4769('0x5'))(_0x4769('0x6'));var config=require(_0x4769('0x7'));var jayson=require(_0x4769('0x8'));var client=jayson[_0x4769('0x9')][_0x4769('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21717b,_0x81d7a2,_0x58bceb){return new BPromise(function(_0x113c1e,_0x160875){return client[_0x4769('0xb')](_0x21717b,_0x58bceb)['then'](function(_0x5a0eb8){logger[_0x4769('0xc')](_0x4769('0xd'),_0x81d7a2,_0x4769('0xe'));logger['debug'](_0x4769('0xf'),_0x81d7a2,_0x4769('0xe'),JSON[_0x4769('0x10')](_0x5a0eb8));if(_0x5a0eb8[_0x4769('0x11')]){if(_0x5a0eb8[_0x4769('0x11')]['code']===0x1f4){logger[_0x4769('0x11')](_0x4769('0xd'),_0x81d7a2,_0x5a0eb8[_0x4769('0x11')][_0x4769('0x12')]);return _0x160875(_0x5a0eb8[_0x4769('0x11')][_0x4769('0x12')]);}logger[_0x4769('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x81d7a2,_0x5a0eb8[_0x4769('0x11')][_0x4769('0x12')]);return _0x113c1e(_0x5a0eb8[_0x4769('0x11')][_0x4769('0x12')]);}else{logger[_0x4769('0xc')](_0x4769('0xd'),_0x81d7a2,_0x4769('0xe'));_0x113c1e(_0x5a0eb8[_0x4769('0x13')]['message']);}})[_0x4769('0x14')](function(_0x21f83b){logger[_0x4769('0x11')](_0x4769('0xd'),_0x81d7a2,_0x21f83b);_0x160875(_0x21f83b);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 7a57621..06e54f5 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 _0x9461=['get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x106f9e,_0x179018){var _0x5188ca=function(_0x26afde){while(--_0x26afde){_0x106f9e['push'](_0x106f9e['shift']());}};_0x5188ca(++_0x179018);}(_0x9461,0x1ee));var _0x1946=function(_0xbd7cc,_0x17e13d){_0xbd7cc=_0xbd7cc-0x0;var _0x349c15=_0x9461[_0xbd7cc];return _0x349c15;};'use strict';var multer=require(_0x1946('0x0'));var util=require(_0x1946('0x1'));var path=require(_0x1946('0x2'));var timeout=require(_0x1946('0x3'));var express=require(_0x1946('0x4'));var router=express[_0x1946('0x5')]();var fs_extra=require(_0x1946('0x6'));var auth=require(_0x1946('0x7'));var interaction=require(_0x1946('0x8'));var config=require(_0x1946('0x9'));var controller=require('./userProfileSection.controller');router[_0x1946('0xa')]('/',auth[_0x1946('0xb')](),controller[_0x1946('0xc')]);router[_0x1946('0xa')](_0x1946('0xd'),auth[_0x1946('0xb')](),controller[_0x1946('0xe')]);router[_0x1946('0xa')](_0x1946('0xf'),auth[_0x1946('0xb')](),controller[_0x1946('0x10')]);router['post']('/',auth[_0x1946('0xb')](),controller[_0x1946('0x11')]);router['put']('/:id',auth[_0x1946('0xb')](),controller[_0x1946('0x12')]);router['delete'](_0x1946('0xf'),auth['isAuthenticated'](),controller[_0x1946('0x13')]);module[_0x1946('0x14')]=router; \ No newline at end of file +var _0x6a0c=['fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','show','post','put','delete','/:id','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x57f8ca,_0x115fd9){var _0xe8e71d=function(_0x40dadd){while(--_0x40dadd){_0x57f8ca['push'](_0x57f8ca['shift']());}};_0xe8e71d(++_0x115fd9);}(_0x6a0c,0x140));var _0xc6a0=function(_0x1a68fa,_0x356c02){_0x1a68fa=_0x1a68fa-0x0;var _0x145b22=_0x6a0c[_0x1a68fa];return _0x145b22;};'use strict';var multer=require(_0xc6a0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc6a0('0x1'));var express=require(_0xc6a0('0x2'));var router=express[_0xc6a0('0x3')]();var fs_extra=require(_0xc6a0('0x4'));var auth=require(_0xc6a0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6a0('0x6'));var controller=require('./userProfileSection.controller');router[_0xc6a0('0x7')]('/',auth['isAuthenticated'](),controller[_0xc6a0('0x8')]);router[_0xc6a0('0x7')]('/describe',auth[_0xc6a0('0x9')](),controller[_0xc6a0('0xa')]);router[_0xc6a0('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xc6a0('0xb')]);router[_0xc6a0('0xc')]('/',auth[_0xc6a0('0x9')](),controller['create']);router[_0xc6a0('0xd')]('/:id',auth[_0xc6a0('0x9')](),controller['update']);router[_0xc6a0('0xe')](_0xc6a0('0xf'),auth['isAuthenticated'](),controller[_0xc6a0('0x10')]);module[_0xc6a0('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 6ea9622..7527fc0 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 _0x4e81=['join','getDataValue','split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x4e81,0x1bc));var _0x14e8=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x4e81[_0x22dac7];return _0x3e6cfa;};'use strict';var Sequelize=require(_0x14e8('0x0'));module[_0x14e8('0x1')]={'name':{'type':Sequelize[_0x14e8('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x14e8('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x14e8('0x2')],'set':function(_0x224121){this[_0x14e8('0x4')](_0x14e8('0x5'),_0x224121?_0x224121[_0x14e8('0x6')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x14e8('0x7')](_0x14e8('0x5'))[_0x14e8('0x8')](''):[];}}}; \ No newline at end of file +var _0x1c9a=['sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','split'];(function(_0x4089d1,_0x10c140){var _0x1b4aee=function(_0x77412a){while(--_0x77412a){_0x4089d1['push'](_0x4089d1['shift']());}};_0x1b4aee(++_0x10c140);}(_0x1c9a,0x98));var _0xa1c9=function(_0x30f181,_0x228bc0){_0x30f181=_0x30f181-0x0;var _0x151fa5=_0x1c9a[_0x30f181];return _0x151fa5;};'use strict';var Sequelize=require(_0xa1c9('0x0'));module['exports']={'name':{'type':Sequelize[_0xa1c9('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xa1c9('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xa1c9('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xa1c9('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x21c0fc){this[_0xa1c9('0x4')](_0xa1c9('0x5'),_0x21c0fc?_0x21c0fc[_0xa1c9('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xa1c9('0x5'))?this['getDataValue'](_0xa1c9('0x5'))[_0xa1c9('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index bcee4ef..505b123 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 _0x28b0=['create','body','catch','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','json','apply','reject','save','update','then','end','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','model','keys','find'];(function(_0x3e6ef6,_0x41c865){var _0x4fb82b=function(_0x18e849){while(--_0x18e849){_0x3e6ef6['push'](_0x3e6ef6['shift']());}};_0x4fb82b(++_0x41c865);}(_0x28b0,0xec));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x028b('0x0'));var rimraf=require(_0x028b('0x1'));var zipdir=require(_0x028b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x028b('0x3'));var moment=require(_0x028b('0x4'));var BPromise=require(_0x028b('0x5'));var Mustache=require(_0x028b('0x6'));var util=require(_0x028b('0x7'));var path=require(_0x028b('0x8'));var sox=require(_0x028b('0x9'));var csv=require(_0x028b('0xa'));var ejs=require(_0x028b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x028b('0xc'));var squel=require(_0x028b('0xd'));var crypto=require(_0x028b('0xe'));var jsforce=require(_0x028b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x028b('0xa'));var querystring=require(_0x028b('0x10'));var Papa=require('papaparse');var Redis=require(_0x028b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x028b('0x12'));var as=require(_0x028b('0x13'));var hardwareService=require(_0x028b('0x14'));var logger=require(_0x028b('0x15'))('api');var utils=require(_0x028b('0x16'));var config=require(_0x028b('0x17'));var licenseUtil=require(_0x028b('0x18'));var db=require(_0x028b('0x19'))['db'];function respondWithStatusCode(_0x49bcb1,_0x585293){_0x585293=_0x585293||0xcc;return function(_0x138b01){if(_0x138b01){return _0x49bcb1[_0x028b('0x1a')](_0x585293);}return _0x49bcb1[_0x028b('0x1b')](_0x585293)['end']();};}function respondWithResult(_0x3093bc,_0x473dc9){_0x473dc9=_0x473dc9||0xc8;return function(_0x69ed04){if(_0x69ed04){return _0x3093bc[_0x028b('0x1b')](_0x473dc9)['json'](_0x69ed04);}};}function respondWithFilteredResult(_0x17a320,_0x10bed2){return function(_0x3d0e12){if(_0x3d0e12){var _0x31dfa1=typeof _0x10bed2['offset']===_0x028b('0x1c')&&typeof _0x10bed2['limit']===_0x028b('0x1c');var _0x300232=_0x3d0e12[_0x028b('0x1d')];var _0x47ad27=_0x31dfa1?0x0:_0x10bed2['offset'];var _0x5d7dea=_0x31dfa1?_0x3d0e12['count']:_0x10bed2[_0x028b('0x1e')]+_0x10bed2[_0x028b('0x1f')];var _0x316f08;if(_0x5d7dea>=_0x300232){_0x5d7dea=_0x300232;_0x316f08=0xc8;}else{_0x316f08=0xce;}_0x17a320[_0x028b('0x1b')](_0x316f08);return _0x17a320[_0x028b('0x20')]('Content-Range',_0x47ad27+'-'+_0x5d7dea+'/'+_0x300232)[_0x028b('0x21')](_0x3d0e12);}return null;};}function patchUpdates(_0x37897d){return function(_0x4fce89){try{jsonpatch[_0x028b('0x22')](_0x4fce89,_0x37897d,!![]);}catch(_0xa9a560){return BPromise[_0x028b('0x23')](_0xa9a560);}return _0x4fce89[_0x028b('0x24')]();};}function saveUpdates(_0x4a041a,_0x1cf4ae){return function(_0x411839){if(_0x411839){return _0x411839[_0x028b('0x25')](_0x4a041a)[_0x028b('0x26')](function(_0x3b0ed7){return _0x3b0ed7;});}return null;};}function removeEntity(_0x582253,_0x18c200){return function(_0x5bee31){if(_0x5bee31){return _0x5bee31['destroy']()[_0x028b('0x26')](function(){_0x582253[_0x028b('0x1b')](0xcc)[_0x028b('0x27')]();});}};}function handleEntityNotFound(_0x25a941,_0x534e27){return function(_0x90d88){if(!_0x90d88){_0x25a941['sendStatus'](0x194);}return _0x90d88;};}function handleError(_0x2f446a,_0x57e448){_0x57e448=_0x57e448||0x1f4;return function(_0x1eb0a5){logger[_0x028b('0x28')](_0x1eb0a5['stack']);if(_0x1eb0a5[_0x028b('0x29')]){delete _0x1eb0a5[_0x028b('0x29')];}_0x2f446a['status'](_0x57e448)[_0x028b('0x2a')](_0x1eb0a5);};}exports[_0x028b('0x2b')]=function(_0x24b0b6,_0x14bcc1){var _0x39f2fc={},_0x20dd34={},_0x1ba142={'count':0x0,'rows':[]};var _0xf2a059=_[_0x028b('0x2c')](db[_0x028b('0x2d')][_0x028b('0x2e')],function(_0x51b52e){return{'name':_0x51b52e[_0x028b('0x2f')],'type':_0x51b52e[_0x028b('0x30')][_0x028b('0x31')]};});_0x20dd34['model']=_['map'](_0xf2a059,_0x028b('0x29'));_0x20dd34[_0x028b('0x32')]=_['keys'](_0x24b0b6[_0x028b('0x32')]);_0x20dd34[_0x028b('0x33')]=_[_0x028b('0x34')](_0x20dd34['model'],_0x20dd34[_0x028b('0x32')]);_0x39f2fc[_0x028b('0x35')]=_[_0x028b('0x34')](_0x20dd34['model'],qs[_0x028b('0x36')](_0x24b0b6[_0x028b('0x32')][_0x028b('0x36')]));_0x39f2fc[_0x028b('0x35')]=_0x39f2fc[_0x028b('0x35')][_0x028b('0x37')]?_0x39f2fc[_0x028b('0x35')]:_0x20dd34['model'];if(!_0x24b0b6[_0x028b('0x32')][_0x028b('0x38')](_0x028b('0x39'))){_0x39f2fc[_0x028b('0x1f')]=qs[_0x028b('0x1f')](_0x24b0b6['query'][_0x028b('0x1f')]);_0x39f2fc[_0x028b('0x1e')]=qs['offset'](_0x24b0b6['query'][_0x028b('0x1e')]);}_0x39f2fc[_0x028b('0x3a')]=qs[_0x028b('0x3b')](_0x24b0b6[_0x028b('0x32')][_0x028b('0x3b')]);_0x39f2fc[_0x028b('0x3c')]=qs[_0x028b('0x33')](_['pick'](_0x24b0b6[_0x028b('0x32')],_0x20dd34[_0x028b('0x33')]),_0xf2a059);if(_0x24b0b6['query']['filter']){_0x39f2fc[_0x028b('0x3c')]=_[_0x028b('0x3d')](_0x39f2fc[_0x028b('0x3c')],{'$or':_['map'](_0xf2a059,function(_0x500b8c){if(_0x500b8c[_0x028b('0x30')]!==_0x028b('0x3e')){var _0x191086={};_0x191086[_0x500b8c['name']]={'$like':'%'+_0x24b0b6['query'][_0x028b('0x3f')]+'%'};return _0x191086;}})});}_0x39f2fc=_[_0x028b('0x3d')]({},_0x39f2fc,_0x24b0b6[_0x028b('0x40')]);var _0x5c5131={'where':_0x39f2fc[_0x028b('0x3c')]};return db['UserProfileSection'][_0x028b('0x1d')](_0x5c5131)[_0x028b('0x26')](function(_0x224752){_0x1ba142['count']=_0x224752;if(_0x24b0b6['query'][_0x028b('0x41')]){_0x39f2fc[_0x028b('0x42')]=[{'all':!![]}];}return db[_0x028b('0x2d')][_0x028b('0x43')](_0x39f2fc);})[_0x028b('0x26')](function(_0x2b3f63){_0x1ba142['rows']=_0x2b3f63;return _0x1ba142;})[_0x028b('0x26')](respondWithFilteredResult(_0x14bcc1,_0x39f2fc))['catch'](handleError(_0x14bcc1,null));};exports['show']=function(_0x2cc605,_0x5b8090){var _0x1b9db1={'raw':![],'where':{'id':_0x2cc605[_0x028b('0x44')]['id']}},_0x3e30c3={};_0x3e30c3[_0x028b('0x45')]=_[_0x028b('0x46')](db[_0x028b('0x2d')]['rawAttributes']);_0x3e30c3['query']=_[_0x028b('0x46')](_0x2cc605[_0x028b('0x32')]);_0x3e30c3[_0x028b('0x33')]=_[_0x028b('0x34')](_0x3e30c3[_0x028b('0x45')],_0x3e30c3[_0x028b('0x32')]);_0x1b9db1[_0x028b('0x35')]=_['intersection'](_0x3e30c3[_0x028b('0x45')],qs['fields'](_0x2cc605['query'][_0x028b('0x36')]));_0x1b9db1[_0x028b('0x35')]=_0x1b9db1[_0x028b('0x35')][_0x028b('0x37')]?_0x1b9db1[_0x028b('0x35')]:_0x3e30c3[_0x028b('0x45')];if(_0x2cc605[_0x028b('0x32')]['includeAll']){_0x1b9db1[_0x028b('0x42')]=[{'all':!![]}];}_0x1b9db1=_[_0x028b('0x3d')]({},_0x1b9db1,_0x2cc605[_0x028b('0x40')]);return db[_0x028b('0x2d')][_0x028b('0x47')](_0x1b9db1)[_0x028b('0x26')](handleEntityNotFound(_0x5b8090,null))[_0x028b('0x26')](respondWithResult(_0x5b8090,null))['catch'](handleError(_0x5b8090,null));};exports[_0x028b('0x48')]=function(_0x4daaa6,_0x22b14d){return db[_0x028b('0x2d')][_0x028b('0x48')](_0x4daaa6[_0x028b('0x49')],{})[_0x028b('0x26')](respondWithResult(_0x22b14d,0xc9))[_0x028b('0x4a')](handleError(_0x22b14d,null));};exports['update']=function(_0x14c2e9,_0x165b7f){if(_0x14c2e9[_0x028b('0x49')]['id']){delete _0x14c2e9['body']['id'];}return db[_0x028b('0x2d')]['find']({'where':{'id':_0x14c2e9[_0x028b('0x44')]['id']}})['then'](handleEntityNotFound(_0x165b7f,null))[_0x028b('0x26')](saveUpdates(_0x14c2e9['body'],null))[_0x028b('0x26')](respondWithResult(_0x165b7f,null))['catch'](handleError(_0x165b7f,null));};exports[_0x028b('0x4b')]=function(_0xb652f3,_0x27409b){return db[_0x028b('0x2d')][_0x028b('0x47')]({'where':{'id':_0xb652f3[_0x028b('0x44')]['id']}})[_0x028b('0x26')](handleEntityNotFound(_0x27409b,null))['then'](removeEntity(_0x27409b,null))[_0x028b('0x4a')](handleError(_0x27409b,null));};exports[_0x028b('0x4c')]=function(_0x2227eb,_0x12858e){return db[_0x028b('0x2d')][_0x028b('0x4c')]()[_0x028b('0x26')](respondWithResult(_0x12858e,null))['catch'](handleError(_0x12858e,null));}; \ No newline at end of file +var _0x670f=['length','nolimit','sort','where','pick','filter','merge','VIRTUAL','then','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','util','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0x670f,0x139));var _0xf670=function(_0x57e0b2,_0x2180fa){_0x57e0b2=_0x57e0b2-0x0;var _0x3c1920=_0x670f[_0x57e0b2];return _0x3c1920;};'use strict';var emlformat=require(_0xf670('0x0'));var rimraf=require(_0xf670('0x1'));var zipdir=require(_0xf670('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf670('0x3'));var moment=require('moment');var BPromise=require(_0xf670('0x4'));var Mustache=require('mustache');var util=require(_0xf670('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf670('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf670('0x7'));var squel=require(_0xf670('0x8'));var crypto=require(_0xf670('0x9'));var jsforce=require(_0xf670('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf670('0x6'));var querystring=require('querystring');var Papa=require(_0xf670('0xb'));var Redis=require(_0xf670('0xc'));var authService=require(_0xf670('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf670('0xe'));var hardwareService=require(_0xf670('0xf'));var logger=require(_0xf670('0x10'))(_0xf670('0x11'));var utils=require('../../config/utils');var config=require(_0xf670('0x12'));var licenseUtil=require(_0xf670('0x13'));var db=require(_0xf670('0x14'))['db'];function respondWithStatusCode(_0x39e98f,_0x155574){_0x155574=_0x155574||0xcc;return function(_0x19d63b){if(_0x19d63b){return _0x39e98f[_0xf670('0x15')](_0x155574);}return _0x39e98f['status'](_0x155574)[_0xf670('0x16')]();};}function respondWithResult(_0x5db2f2,_0x3c9822){_0x3c9822=_0x3c9822||0xc8;return function(_0x44567f){if(_0x44567f){return _0x5db2f2[_0xf670('0x17')](_0x3c9822)[_0xf670('0x18')](_0x44567f);}};}function respondWithFilteredResult(_0x150ee5,_0x8c9c0a){return function(_0x22df12){if(_0x22df12){var _0x4a54f3=typeof _0x8c9c0a[_0xf670('0x19')]===_0xf670('0x1a')&&typeof _0x8c9c0a[_0xf670('0x1b')]===_0xf670('0x1a');var _0x28f358=_0x22df12[_0xf670('0x1c')];var _0x530aac=_0x4a54f3?0x0:_0x8c9c0a[_0xf670('0x19')];var _0x659775=_0x4a54f3?_0x22df12[_0xf670('0x1c')]:_0x8c9c0a['offset']+_0x8c9c0a[_0xf670('0x1b')];var _0x5a2141;if(_0x659775>=_0x28f358){_0x659775=_0x28f358;_0x5a2141=0xc8;}else{_0x5a2141=0xce;}_0x150ee5[_0xf670('0x17')](_0x5a2141);return _0x150ee5[_0xf670('0x1d')](_0xf670('0x1e'),_0x530aac+'-'+_0x659775+'/'+_0x28f358)[_0xf670('0x18')](_0x22df12);}return null;};}function patchUpdates(_0x4a30fd){return function(_0x21be89){try{jsonpatch[_0xf670('0x1f')](_0x21be89,_0x4a30fd,!![]);}catch(_0x3052f0){return BPromise[_0xf670('0x20')](_0x3052f0);}return _0x21be89[_0xf670('0x21')]();};}function saveUpdates(_0x5a12b4,_0x25e70d){return function(_0x542e4c){if(_0x542e4c){return _0x542e4c[_0xf670('0x22')](_0x5a12b4)['then'](function(_0x51429c){return _0x51429c;});}return null;};}function removeEntity(_0x357f95,_0x594375){return function(_0x3268f1){if(_0x3268f1){return _0x3268f1[_0xf670('0x23')]()['then'](function(){_0x357f95[_0xf670('0x17')](0xcc)[_0xf670('0x16')]();});}};}function handleEntityNotFound(_0x1fdc02,_0x476d10){return function(_0x4beca0){if(!_0x4beca0){_0x1fdc02[_0xf670('0x15')](0x194);}return _0x4beca0;};}function handleError(_0x5a848a,_0x4bd38d){_0x4bd38d=_0x4bd38d||0x1f4;return function(_0x484f1d){logger[_0xf670('0x24')](_0x484f1d[_0xf670('0x25')]);if(_0x484f1d[_0xf670('0x26')]){delete _0x484f1d['name'];}_0x5a848a[_0xf670('0x17')](_0x4bd38d)['send'](_0x484f1d);};}exports[_0xf670('0x27')]=function(_0x3622f4,_0x29b5e8){var _0x203b16={},_0x1a1077={},_0x524946={'count':0x0,'rows':[]};var _0x5158e8=_[_0xf670('0x28')](db[_0xf670('0x29')][_0xf670('0x2a')],function(_0x2b0bdb){return{'name':_0x2b0bdb[_0xf670('0x2b')],'type':_0x2b0bdb[_0xf670('0x2c')][_0xf670('0x2d')]};});_0x1a1077[_0xf670('0x2e')]=_[_0xf670('0x28')](_0x5158e8,_0xf670('0x26'));_0x1a1077[_0xf670('0x2f')]=_['keys'](_0x3622f4['query']);_0x1a1077[_0xf670('0x30')]=_[_0xf670('0x31')](_0x1a1077[_0xf670('0x2e')],_0x1a1077[_0xf670('0x2f')]);_0x203b16[_0xf670('0x32')]=_[_0xf670('0x31')](_0x1a1077[_0xf670('0x2e')],qs[_0xf670('0x33')](_0x3622f4[_0xf670('0x2f')][_0xf670('0x33')]));_0x203b16['attributes']=_0x203b16[_0xf670('0x32')][_0xf670('0x34')]?_0x203b16[_0xf670('0x32')]:_0x1a1077[_0xf670('0x2e')];if(!_0x3622f4[_0xf670('0x2f')]['hasOwnProperty'](_0xf670('0x35'))){_0x203b16[_0xf670('0x1b')]=qs[_0xf670('0x1b')](_0x3622f4[_0xf670('0x2f')]['limit']);_0x203b16['offset']=qs[_0xf670('0x19')](_0x3622f4[_0xf670('0x2f')][_0xf670('0x19')]);}_0x203b16['order']=qs[_0xf670('0x36')](_0x3622f4[_0xf670('0x2f')]['sort']);_0x203b16[_0xf670('0x37')]=qs[_0xf670('0x30')](_[_0xf670('0x38')](_0x3622f4[_0xf670('0x2f')],_0x1a1077[_0xf670('0x30')]),_0x5158e8);if(_0x3622f4[_0xf670('0x2f')][_0xf670('0x39')]){_0x203b16['where']=_[_0xf670('0x3a')](_0x203b16[_0xf670('0x37')],{'$or':_[_0xf670('0x28')](_0x5158e8,function(_0xa30931){if(_0xa30931['type']!==_0xf670('0x3b')){var _0x5eef8b={};_0x5eef8b[_0xa30931[_0xf670('0x26')]]={'$like':'%'+_0x3622f4[_0xf670('0x2f')]['filter']+'%'};return _0x5eef8b;}})});}_0x203b16=_['merge']({},_0x203b16,_0x3622f4['options']);var _0x5e7faf={'where':_0x203b16[_0xf670('0x37')]};return db[_0xf670('0x29')][_0xf670('0x1c')](_0x5e7faf)[_0xf670('0x3c')](function(_0x3b3f24){_0x524946[_0xf670('0x1c')]=_0x3b3f24;if(_0x3622f4[_0xf670('0x2f')]['includeAll']){_0x203b16[_0xf670('0x3d')]=[{'all':!![]}];}return db[_0xf670('0x29')][_0xf670('0x3e')](_0x203b16);})['then'](function(_0x5f2afa){_0x524946[_0xf670('0x3f')]=_0x5f2afa;return _0x524946;})[_0xf670('0x3c')](respondWithFilteredResult(_0x29b5e8,_0x203b16))[_0xf670('0x40')](handleError(_0x29b5e8,null));};exports['show']=function(_0x2cb61c,_0x95a66){var _0x508579={'raw':![],'where':{'id':_0x2cb61c[_0xf670('0x41')]['id']}},_0x5be8ab={};_0x5be8ab['model']=_[_0xf670('0x42')](db['UserProfileSection'][_0xf670('0x2a')]);_0x5be8ab[_0xf670('0x2f')]=_[_0xf670('0x42')](_0x2cb61c['query']);_0x5be8ab[_0xf670('0x30')]=_[_0xf670('0x31')](_0x5be8ab[_0xf670('0x2e')],_0x5be8ab[_0xf670('0x2f')]);_0x508579[_0xf670('0x32')]=_['intersection'](_0x5be8ab['model'],qs[_0xf670('0x33')](_0x2cb61c[_0xf670('0x2f')][_0xf670('0x33')]));_0x508579['attributes']=_0x508579['attributes']['length']?_0x508579[_0xf670('0x32')]:_0x5be8ab[_0xf670('0x2e')];if(_0x2cb61c[_0xf670('0x2f')][_0xf670('0x43')]){_0x508579[_0xf670('0x3d')]=[{'all':!![]}];}_0x508579=_[_0xf670('0x3a')]({},_0x508579,_0x2cb61c[_0xf670('0x44')]);return db[_0xf670('0x29')][_0xf670('0x45')](_0x508579)[_0xf670('0x3c')](handleEntityNotFound(_0x95a66,null))[_0xf670('0x3c')](respondWithResult(_0x95a66,null))[_0xf670('0x40')](handleError(_0x95a66,null));};exports[_0xf670('0x46')]=function(_0x579c9b,_0x1ca278){return db[_0xf670('0x29')]['create'](_0x579c9b[_0xf670('0x47')],{})['then'](respondWithResult(_0x1ca278,0xc9))[_0xf670('0x40')](handleError(_0x1ca278,null));};exports[_0xf670('0x22')]=function(_0x3cb251,_0x308943){if(_0x3cb251[_0xf670('0x47')]['id']){delete _0x3cb251[_0xf670('0x47')]['id'];}return db[_0xf670('0x29')][_0xf670('0x45')]({'where':{'id':_0x3cb251['params']['id']}})[_0xf670('0x3c')](handleEntityNotFound(_0x308943,null))[_0xf670('0x3c')](saveUpdates(_0x3cb251[_0xf670('0x47')],null))[_0xf670('0x3c')](respondWithResult(_0x308943,null))[_0xf670('0x40')](handleError(_0x308943,null));};exports[_0xf670('0x23')]=function(_0x4ae334,_0xbbe86c){return db[_0xf670('0x29')][_0xf670('0x45')]({'where':{'id':_0x4ae334['params']['id']}})[_0xf670('0x3c')](handleEntityNotFound(_0xbbe86c,null))['then'](removeEntity(_0xbbe86c,null))[_0xf670('0x40')](handleError(_0xbbe86c,null));};exports['describe']=function(_0xa935dd,_0x571bea){return db[_0xf670('0x29')][_0xf670('0x48')]()[_0xf670('0x3c')](respondWithResult(_0x571bea,null))['catch'](handleError(_0x571bea,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index da1c49c..2964dee 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 _0x3a1f=['sectionId','userProfileId','lodash','util','moment','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0xd55aa8,_0x4bbab7){var _0x57d2d7=function(_0x27c24c){while(--_0x27c24c){_0xd55aa8['push'](_0xd55aa8['shift']());}};_0x57d2d7(++_0x4bbab7);}(_0x3a1f,0x160));var _0xf3a1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3a1f[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xf3a1('0x0'));var util=require(_0xf3a1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf3a1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3a1('0x3'));var rimraf=require(_0xf3a1('0x4'));var config=require(_0xf3a1('0x5'));var attributes=require(_0xf3a1('0x6'));module[_0xf3a1('0x7')]=function(_0x3f655c,_0x41f5de){return _0x3f655c[_0xf3a1('0x8')](_0xf3a1('0x9'),attributes,{'tableName':_0xf3a1('0xa'),'paranoid':![],'indexes':[{'name':_0xf3a1('0xb'),'fields':[_0xf3a1('0xc'),_0xf3a1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcde7=['UserProfileSection','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2f1343,_0x59bd6a){var _0x2d8268=function(_0x2844e9){while(--_0x2844e9){_0x2f1343['push'](_0x2f1343['shift']());}};_0x2d8268(++_0x59bd6a);}(_0xcde7,0x129));var _0x7cde=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcde7[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7cde('0x0'));var util=require(_0x7cde('0x1'));var logger=require(_0x7cde('0x2'))(_0x7cde('0x3'));var moment=require(_0x7cde('0x4'));var BPromise=require(_0x7cde('0x5'));var rp=require(_0x7cde('0x6'));var fs=require('fs');var path=require(_0x7cde('0x7'));var rimraf=require(_0x7cde('0x8'));var config=require(_0x7cde('0x9'));var attributes=require('./userProfileSection.attributes');module[_0x7cde('0xa')]=function(_0x2730e2,_0x410b00){return _0x2730e2['define'](_0x7cde('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x7cde('0xc'),_0x7cde('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 3db2d38..712e9f9 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 _0x7f0d=['result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x496831,_0x3cd648){var _0xdb5f6=function(_0x57789f){while(--_0x57789f){_0x496831['push'](_0x496831['shift']());}};_0xdb5f6(++_0x3cd648);}(_0x7f0d,0x113));var _0xd7f0=function(_0xc4754c,_0x4c2a1b){_0xc4754c=_0xc4754c-0x0;var _0x282cf2=_0x7f0d[_0xc4754c];return _0x282cf2;};'use strict';var _=require(_0xd7f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd7f0('0x1'));var rs=require(_0xd7f0('0x2'));var fs=require('fs');var Redis=require(_0xd7f0('0x3'));var db=require(_0xd7f0('0x4'))['db'];var utils=require(_0xd7f0('0x5'));var logger=require('../../config/logger')(_0xd7f0('0x6'));var config=require(_0xd7f0('0x7'));var jayson=require(_0xd7f0('0x8'));var client=jayson['client'][_0xd7f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1de64c,_0x1e232a,_0x4475bc){return new BPromise(function(_0x16b254,_0x31e548){return client['request'](_0x1de64c,_0x4475bc)[_0xd7f0('0xa')](function(_0x933e85){logger[_0xd7f0('0xb')](_0xd7f0('0xc'),_0x1e232a,_0xd7f0('0xd'));logger[_0xd7f0('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x1e232a,_0xd7f0('0xd'),JSON[_0xd7f0('0xf')](_0x933e85));if(_0x933e85[_0xd7f0('0x10')]){if(_0x933e85[_0xd7f0('0x10')][_0xd7f0('0x11')]===0x1f4){logger[_0xd7f0('0x10')](_0xd7f0('0xc'),_0x1e232a,_0x933e85[_0xd7f0('0x10')][_0xd7f0('0x12')]);return _0x31e548(_0x933e85[_0xd7f0('0x10')][_0xd7f0('0x12')]);}logger[_0xd7f0('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x1e232a,_0x933e85[_0xd7f0('0x10')]['message']);return _0x16b254(_0x933e85['error'][_0xd7f0('0x12')]);}else{logger['info'](_0xd7f0('0xc'),_0x1e232a,'request\x20sent');_0x16b254(_0x933e85[_0xd7f0('0x13')][_0xd7f0('0x12')]);}})[_0xd7f0('0x14')](function(_0x215323){logger[_0xd7f0('0x10')](_0xd7f0('0xc'),_0x1e232a,_0x215323);_0x31e548(_0x215323);});});} \ No newline at end of file +var _0xeb27=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','ioredis'];(function(_0x38c02c,_0x29b291){var _0xbe2f5a=function(_0x4d5082){while(--_0x4d5082){_0x38c02c['push'](_0x38c02c['shift']());}};_0xbe2f5a(++_0x29b291);}(_0xeb27,0xe1));var _0x7eb2=function(_0x2fdf0c,_0x299ef2){_0x2fdf0c=_0x2fdf0c-0x0;var _0xbb3de5=_0xeb27[_0x2fdf0c];return _0xbb3de5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7eb2('0x0'));var BPromise=require(_0x7eb2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7eb2('0x2'));var db=require(_0x7eb2('0x3'))['db'];var utils=require(_0x7eb2('0x4'));var logger=require('../../config/logger')(_0x7eb2('0x5'));var config=require(_0x7eb2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7eb2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x231d63,_0x56c723,_0xda27e2){return new BPromise(function(_0x13d836,_0x2533b4){return client['request'](_0x231d63,_0xda27e2)[_0x7eb2('0x8')](function(_0xa38fba){logger[_0x7eb2('0x9')](_0x7eb2('0xa'),_0x56c723,_0x7eb2('0xb'));logger[_0x7eb2('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x56c723,_0x7eb2('0xb'),JSON[_0x7eb2('0xd')](_0xa38fba));if(_0xa38fba['error']){if(_0xa38fba[_0x7eb2('0xe')][_0x7eb2('0xf')]===0x1f4){logger[_0x7eb2('0xe')](_0x7eb2('0xa'),_0x56c723,_0xa38fba[_0x7eb2('0xe')][_0x7eb2('0x10')]);return _0x2533b4(_0xa38fba[_0x7eb2('0xe')][_0x7eb2('0x10')]);}logger['error'](_0x7eb2('0xa'),_0x56c723,_0xa38fba[_0x7eb2('0xe')][_0x7eb2('0x10')]);return _0x13d836(_0xa38fba[_0x7eb2('0xe')][_0x7eb2('0x10')]);}else{logger[_0x7eb2('0x9')]('UserProfileSection,\x20%s,\x20%s',_0x56c723,_0x7eb2('0xb'));_0x13d836(_0xa38fba[_0x7eb2('0x11')][_0x7eb2('0x10')]);}})[_0x7eb2('0x12')](function(_0x4e08c5){logger[_0x7eb2('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x56c723,_0x4e08c5);_0x2533b4(_0x4e08c5);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 1c9968a..af33f75 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4f6495,_0x1fe01a){var _0x528aec=function(_0x4c9431){while(--_0x4c9431){_0x4f6495['push'](_0x4f6495['shift']());}};_0x528aec(++_0x1fe01a);}(_0x70e0,0x17b));var _0x070e=function(_0x33bdc0,_0x2efc5c){_0x33bdc0=_0x33bdc0-0x0;var _0x30908f=_0x70e0[_0x33bdc0];return _0x30908f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5eab8c,_0x250dc7){var _0x2ff4f1=function(_0x57acb0){while(--_0x57acb0){_0x5eab8c['push'](_0x5eab8c['shift']());}};_0x2ff4f1(++_0x250dc7);}(_0xedd9,0xfc));var _0x9edd=function(_0x182273,_0x1c88ff){_0x182273=_0x182273-0x0;var _0x3cf552=_0xedd9[_0x182273];return _0x3cf552;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 11102f1..53870d8 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 _0xe888=['INTEGER','sequelize'];(function(_0x4f52bd,_0x29d170){var _0x42bc01=function(_0x3c6f36){while(--_0x3c6f36){_0x4f52bd['push'](_0x4f52bd['shift']());}};_0x42bc01(++_0x29d170);}(_0xe888,0x97));var _0x8e88=function(_0x16bb4b,_0x5fe431){_0x16bb4b=_0x16bb4b-0x0;var _0x8aeb84=_0xe888[_0x16bb4b];return _0x8aeb84;};'use strict';var Sequelize=require(_0x8e88('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8e88('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xee35=['exports','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xee35,0x1ba));var _0x5ee3=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0xee35[_0xbc4560];return _0x298cfb;};'use strict';var Sequelize=require('sequelize');module[_0x5ee3('0x0')]={'penalty':{'type':Sequelize[_0x5ee3('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index f76fbca..7dd5169 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 _0xbd10=['UserSmsQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xbd10,0x85));var _0x0bd1=function(_0x3207bf,_0x5b5543){_0x3207bf=_0x3207bf-0x0;var _0x531b49=_0xbd10[_0x3207bf];return _0x531b49;};'use strict';var _=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var logger=require(_0x0bd1('0x2'))('api');var moment=require(_0x0bd1('0x3'));var BPromise=require(_0x0bd1('0x4'));var rp=require(_0x0bd1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bd1('0x6'));var config=require(_0x0bd1('0x7'));var attributes=require(_0x0bd1('0x8'));module[_0x0bd1('0x9')]=function(_0x453508,_0x46c432){return _0x453508['define'](_0x0bd1('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x964b=['util','api','moment','bluebird','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x246227,_0x12bfcb){var _0x37bd4a=function(_0x4670f4){while(--_0x4670f4){_0x246227['push'](_0x246227['shift']());}};_0x37bd4a(++_0x12bfcb);}(_0x964b,0x112));var _0xb964=function(_0x142830,_0x53a163){_0x142830=_0x142830-0x0;var _0x196c3c=_0x964b[_0x142830];return _0x196c3c;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var logger=require('../../config/logger')(_0xb964('0x2'));var moment=require(_0xb964('0x3'));var BPromise=require(_0xb964('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb964('0x5'));var config=require('../../config/environment');var attributes=require(_0xb964('0x6'));module[_0xb964('0x7')]=function(_0xba9f19,_0x11a0c1){return _0xba9f19[_0xb964('0x8')](_0xb964('0x9'),attributes,{'tableName':_0xb964('0xa'),'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 8202e6b..09a5c3f 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 _0x238d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','ioredis'];(function(_0x995c5b,_0x5485b3){var _0x2ade0a=function(_0x59bbbf){while(--_0x59bbbf){_0x995c5b['push'](_0x995c5b['shift']());}};_0x2ade0a(++_0x5485b3);}(_0x238d,0x1b5));var _0xd238=function(_0x1c52f8,_0x5cd4b4){_0x1c52f8=_0x1c52f8-0x0;var _0x566991=_0x238d[_0x1c52f8];return _0x566991;};'use strict';var _=require(_0xd238('0x0'));var util=require(_0xd238('0x1'));var moment=require(_0xd238('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd238('0x3'));var db=require(_0xd238('0x4'))['db'];var utils=require(_0xd238('0x5'));var logger=require(_0xd238('0x6'))(_0xd238('0x7'));var config=require(_0xd238('0x8'));var jayson=require(_0xd238('0x9'));var client=jayson[_0xd238('0xa')][_0xd238('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50ff7c,_0x392c7c,_0x2c6f24){return new BPromise(function(_0x2b74dc,_0xa25828){return client[_0xd238('0xc')](_0x50ff7c,_0x2c6f24)['then'](function(_0x31991f){logger[_0xd238('0xd')](_0xd238('0xe'),_0x392c7c,_0xd238('0xf'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x392c7c,_0xd238('0xf'),JSON[_0xd238('0x10')](_0x31991f));if(_0x31991f[_0xd238('0x11')]){if(_0x31991f[_0xd238('0x11')]['code']===0x1f4){logger[_0xd238('0x11')](_0xd238('0xe'),_0x392c7c,_0x31991f[_0xd238('0x11')][_0xd238('0x12')]);return _0xa25828(_0x31991f[_0xd238('0x11')][_0xd238('0x12')]);}logger[_0xd238('0x11')](_0xd238('0xe'),_0x392c7c,_0x31991f[_0xd238('0x11')][_0xd238('0x12')]);return _0x2b74dc(_0x31991f['error'][_0xd238('0x12')]);}else{logger[_0xd238('0xd')](_0xd238('0xe'),_0x392c7c,_0xd238('0xf'));_0x2b74dc(_0x31991f[_0xd238('0x13')][_0xd238('0x12')]);}})[_0xd238('0x14')](function(_0x160845){logger[_0xd238('0x11')](_0xd238('0xe'),_0x392c7c,_0x160845);_0xa25828(_0x160845);});});} \ No newline at end of file +var _0x8cc6=['request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x481844,_0x259b1f){var _0x2afc17=function(_0x3404d4){while(--_0x3404d4){_0x481844['push'](_0x481844['shift']());}};_0x2afc17(++_0x259b1f);}(_0x8cc6,0x84));var _0x68cc=function(_0x5e1fbe,_0x429e33){_0x5e1fbe=_0x5e1fbe-0x0;var _0x51465b=_0x8cc6[_0x5e1fbe];return _0x51465b;};'use strict';var _=require(_0x68cc('0x0'));var util=require(_0x68cc('0x1'));var moment=require(_0x68cc('0x2'));var BPromise=require('bluebird');var rs=require(_0x68cc('0x3'));var fs=require('fs');var Redis=require(_0x68cc('0x4'));var db=require(_0x68cc('0x5'))['db'];var utils=require(_0x68cc('0x6'));var logger=require(_0x68cc('0x7'))(_0x68cc('0x8'));var config=require(_0x68cc('0x9'));var jayson=require(_0x68cc('0xa'));var client=jayson[_0x68cc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32b246,_0x2accaf,_0x4a6e21){return new BPromise(function(_0x5237b0,_0x5a0a60){return client[_0x68cc('0xc')](_0x32b246,_0x4a6e21)[_0x68cc('0xd')](function(_0x19316a){logger['info'](_0x68cc('0xe'),_0x2accaf,_0x68cc('0xf'));logger[_0x68cc('0x10')](_0x68cc('0x11'),_0x2accaf,'request\x20sent',JSON[_0x68cc('0x12')](_0x19316a));if(_0x19316a[_0x68cc('0x13')]){if(_0x19316a[_0x68cc('0x13')][_0x68cc('0x14')]===0x1f4){logger[_0x68cc('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2accaf,_0x19316a[_0x68cc('0x13')][_0x68cc('0x15')]);return _0x5a0a60(_0x19316a['error']['message']);}logger[_0x68cc('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x2accaf,_0x19316a[_0x68cc('0x13')][_0x68cc('0x15')]);return _0x5237b0(_0x19316a[_0x68cc('0x13')]['message']);}else{logger['info'](_0x68cc('0xe'),_0x2accaf,_0x68cc('0xf'));_0x5237b0(_0x19316a[_0x68cc('0x16')][_0x68cc('0x15')]);}})[_0x68cc('0x17')](function(_0x4e476f){logger[_0x68cc('0x13')](_0x68cc('0xe'),_0x2accaf,_0x4e476f);_0x5a0a60(_0x4e476f);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 4455d97..513c061 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 _0x0369=['sequelize','exports','INTEGER'];(function(_0x5aac8e,_0x1c60ef){var _0x89915f=function(_0x134df4){while(--_0x134df4){_0x5aac8e['push'](_0x5aac8e['shift']());}};_0x89915f(++_0x1c60ef);}(_0x0369,0x1b0));var _0x9036=function(_0x528a23,_0x6f4588){_0x528a23=_0x528a23-0x0;var _0x3ab28e=_0x0369[_0x528a23];return _0x3ab28e;};'use strict';var Sequelize=require(_0x9036('0x0'));module[_0x9036('0x1')]={'UserId':{'type':Sequelize[_0x9036('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x9036('0x2')]}}; \ No newline at end of file +var _0xd7f7=['exports','sequelize'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xd7f7,0x1b1));var _0x7d7f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd7f7[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x7d7f('0x0'));module[_0x7d7f('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index c3a3ac5..65237df 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(_0x33cfb0,_0x510afd){var _0x2b30e6=function(_0x24ffb4){while(--_0x24ffb4){_0x33cfb0['push'](_0x33cfb0['shift']());}};_0x2b30e6(++_0x510afd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x2b47ed,_0x5beea8){var _0x30df64=function(_0x507e68){while(--_0x507e68){_0x2b47ed['push'](_0x2b47ed['shift']());}};_0x30df64(++_0x5beea8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 66cc9dd..52e55b8 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(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x291c9b,_0x52cdf2){var _0x5c392b=function(_0x930d5b){while(--_0x930d5b){_0x291c9b['push'](_0x291c9b['shift']());}};_0x5c392b(++_0x52cdf2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 481e877..06123ba 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 _0xf206=['exports','INTEGER'];(function(_0x3b3551,_0x49dbd7){var _0x10bc70=function(_0x117abb){while(--_0x117abb){_0x3b3551['push'](_0x3b3551['shift']());}};_0x10bc70(++_0x49dbd7);}(_0xf206,0x1f0));var _0x6f20=function(_0x6beb71,_0x17c305){_0x6beb71=_0x6beb71-0x0;var _0x3b6808=_0xf206[_0x6beb71];return _0x3b6808;};'use strict';var Sequelize=require('sequelize');module[_0x6f20('0x0')]={'penalty':{'type':Sequelize[_0x6f20('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc63a=['sequelize','exports'];(function(_0x5d6476,_0x56c199){var _0xd3f6bc=function(_0x157293){while(--_0x157293){_0x5d6476['push'](_0x5d6476['shift']());}};_0xd3f6bc(++_0x56c199);}(_0xc63a,0x130));var _0xac63=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xc63a[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0xac63('0x0'));module[_0xac63('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 1674594..a722a22 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 _0x21c2=['moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x540705,_0x5c8fb1){var _0x3cb184=function(_0x2b8dc9){while(--_0x2b8dc9){_0x540705['push'](_0x540705['shift']());}};_0x3cb184(++_0x5c8fb1);}(_0x21c2,0x188));var _0x221c=function(_0x537e7c,_0x4da0b7){_0x537e7c=_0x537e7c-0x0;var _0x101e3e=_0x21c2[_0x537e7c];return _0x101e3e;};'use strict';var _=require(_0x221c('0x0'));var util=require(_0x221c('0x1'));var logger=require(_0x221c('0x2'))(_0x221c('0x3'));var moment=require(_0x221c('0x4'));var BPromise=require(_0x221c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x221c('0x6'));var rimraf=require(_0x221c('0x7'));var config=require(_0x221c('0x8'));var attributes=require(_0x221c('0x9'));module[_0x221c('0xa')]=function(_0x375a99,_0x5a3e0a){return _0x375a99[_0x221c('0xb')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a43=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','../../config/logger','api','request-promise','path'];(function(_0x4f5661,_0x348c7a){var _0x2dd40e=function(_0x166c69){while(--_0x166c69){_0x4f5661['push'](_0x4f5661['shift']());}};_0x2dd40e(++_0x348c7a);}(_0x4a43,0xce));var _0x34a4=function(_0x54f5f9,_0x129efc){_0x54f5f9=_0x54f5f9-0x0;var _0x4a1f68=_0x4a43[_0x54f5f9];return _0x4a1f68;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x34a4('0x0'))(_0x34a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x34a4('0x2'));var fs=require('fs');var path=require(_0x34a4('0x3'));var rimraf=require(_0x34a4('0x4'));var config=require(_0x34a4('0x5'));var attributes=require(_0x34a4('0x6'));module[_0x34a4('0x7')]=function(_0x507ce0,_0x2f4fc7){return _0x507ce0[_0x34a4('0x8')](_0x34a4('0x9'),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 5f91963..18852e2 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 _0x56da=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x2df9a6,_0x5d89c3){var _0x23343f=function(_0x2c2134){while(--_0x2c2134){_0x2df9a6['push'](_0x2df9a6['shift']());}};_0x23343f(++_0x5d89c3);}(_0x56da,0x179));var _0xa56d=function(_0x15449d,_0x537b1d){_0x15449d=_0x15449d-0x0;var _0x55cf8c=_0x56da[_0x15449d];return _0x55cf8c;};'use strict';var _=require(_0xa56d('0x0'));var util=require(_0xa56d('0x1'));var moment=require(_0xa56d('0x2'));var BPromise=require(_0xa56d('0x3'));var rs=require(_0xa56d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa56d('0x5'))['db'];var utils=require(_0xa56d('0x6'));var logger=require(_0xa56d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa56d('0x8')][_0xa56d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x352563,_0x12ea97,_0x5400f2){return new BPromise(function(_0xa6c07d,_0x2b2d29){return client['request'](_0x352563,_0x5400f2)[_0xa56d('0xa')](function(_0x428569){logger[_0xa56d('0xb')](_0xa56d('0xc'),_0x12ea97,_0xa56d('0xd'));logger['debug'](_0xa56d('0xe'),_0x12ea97,_0xa56d('0xd'),JSON['stringify'](_0x428569));if(_0x428569['error']){if(_0x428569[_0xa56d('0xf')][_0xa56d('0x10')]===0x1f4){logger[_0xa56d('0xf')](_0xa56d('0xc'),_0x12ea97,_0x428569[_0xa56d('0xf')]['message']);return _0x2b2d29(_0x428569[_0xa56d('0xf')]['message']);}logger[_0xa56d('0xf')](_0xa56d('0xc'),_0x12ea97,_0x428569['error']['message']);return _0xa6c07d(_0x428569[_0xa56d('0xf')][_0xa56d('0x11')]);}else{logger[_0xa56d('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x12ea97,'request\x20sent');_0xa6c07d(_0x428569[_0xa56d('0x12')][_0xa56d('0x11')]);}})[_0xa56d('0x13')](function(_0x245609){logger['error'](_0xa56d('0xc'),_0x12ea97,_0x245609);_0x2b2d29(_0x245609);});});} \ No newline at end of file +var _0xf48c=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x55c00d,_0x520cb6){var _0x254a8f=function(_0x2b3378){while(--_0x2b3378){_0x55c00d['push'](_0x55c00d['shift']());}};_0x254a8f(++_0x520cb6);}(_0xf48c,0x1d0));var _0xcf48=function(_0x12c1e8,_0x1ffda9){_0x12c1e8=_0x12c1e8-0x0;var _0x284326=_0xf48c[_0x12c1e8];return _0x284326;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcf48('0x0'));var BPromise=require(_0xcf48('0x1'));var rs=require(_0xcf48('0x2'));var fs=require('fs');var Redis=require(_0xcf48('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf48('0x4'));var logger=require('../../config/logger')(_0xcf48('0x5'));var config=require(_0xcf48('0x6'));var jayson=require(_0xcf48('0x7'));var client=jayson['client'][_0xcf48('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x313471,_0x410705,_0x55213d){return new BPromise(function(_0xb0b9a3,_0x506be3){return client[_0xcf48('0x9')](_0x313471,_0x55213d)[_0xcf48('0xa')](function(_0x172890){logger[_0xcf48('0xb')](_0xcf48('0xc'),_0x410705,_0xcf48('0xd'));logger['debug'](_0xcf48('0xe'),_0x410705,_0xcf48('0xd'),JSON[_0xcf48('0xf')](_0x172890));if(_0x172890[_0xcf48('0x10')]){if(_0x172890[_0xcf48('0x10')]['code']===0x1f4){logger['error'](_0xcf48('0xc'),_0x410705,_0x172890[_0xcf48('0x10')]['message']);return _0x506be3(_0x172890[_0xcf48('0x10')]['message']);}logger[_0xcf48('0x10')](_0xcf48('0xc'),_0x410705,_0x172890['error'][_0xcf48('0x11')]);return _0xb0b9a3(_0x172890['error'][_0xcf48('0x11')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x410705,_0xcf48('0xd'));_0xb0b9a3(_0x172890[_0xcf48('0x12')][_0xcf48('0x11')]);}})['catch'](function(_0x495a2b){logger[_0xcf48('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x410705,_0x495a2b);_0x506be3(_0x495a2b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 0416028..ea5a3bd 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2aec00,_0x556269){var _0xaa1af=function(_0x10cadd){while(--_0x10cadd){_0x2aec00['push'](_0x2aec00['shift']());}};_0xaa1af(++_0x556269);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xb12603,_0x142505){var _0x2bdc24=function(_0x5dca90){while(--_0x5dca90){_0xb12603['push'](_0xb12603['shift']());}};_0x2bdc24(++_0x142505);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 748ceb1..5b04dc3 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 _0x3e64=['queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING'];(function(_0x8a6b79,_0x3b0466){var _0x11016c=function(_0x5a50f3){while(--_0x5a50f3){_0x8a6b79['push'](_0x8a6b79['shift']());}};_0x11016c(++_0x3b0466);}(_0x3e64,0xa6));var _0x43e6=function(_0x2076a3,_0x15a946){_0x2076a3=_0x2076a3-0x0;var _0x33eb71=_0x3e64[_0x2076a3];return _0x33eb71;};'use strict';var Sequelize=require(_0x43e6('0x0'));module[_0x43e6('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x43e6('0x2')},'membername':{'type':Sequelize[_0x43e6('0x3')],'allowNull':![],'comment':_0x43e6('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x43e6('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x43e6('0x3')],'allowNull':![],'unique':_0x43e6('0x4'),'comment':_0x43e6('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x43e6('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x43e6('0x2')}}; \ No newline at end of file +var _0xdba6=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0xdba6,0xe6));var _0x6dba=function(_0x2cf6fe,_0x2dbeac){_0x2cf6fe=_0x2cf6fe-0x0;var _0x34e1f9=_0xdba6[_0x2cf6fe];return _0x34e1f9;};'use strict';var Sequelize=require(_0x6dba('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6dba('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6dba('0x2')},'membername':{'type':Sequelize[_0x6dba('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x6dba('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x6dba('0x3')],'allowNull':![],'unique':_0x6dba('0x4'),'comment':_0x6dba('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x6dba('0x3')],'allowNull':![],'unique':_0x6dba('0x4'),'comment':_0x6dba('0x2')},'penalty':{'type':Sequelize[_0x6dba('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x6dba('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ce45a6e..3e889e8 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 _0xff12=['remove','emit','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x481a6d,_0x219fb5){var _0x28f90d=function(_0x127cfa){while(--_0x127cfa){_0x481a6d['push'](_0x481a6d['shift']());}};_0x28f90d(++_0x219fb5);}(_0xff12,0x10b));var _0x2ff1=function(_0x4ba925,_0x5e3d76){_0x4ba925=_0x4ba925-0x0;var _0x1a8189=_0xff12[_0x4ba925];return _0x1a8189;};'use strict';var EventEmitter=require(_0x2ff1('0x0'));var UserVoiceQueueRt=require(_0x2ff1('0x1'))['db'][_0x2ff1('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x2ff1('0x3')](0x0);var events={'afterCreate':_0x2ff1('0x4'),'afterUpdate':'update','afterDestroy':_0x2ff1('0x5')};function emitEvent(_0x8096a8){return function(_0x4659de,_0x1a8fb3,_0x4ffa48){UserVoiceQueueRtEvents[_0x2ff1('0x6')](_0x8096a8+':'+_0x4659de['id'],_0x4659de);UserVoiceQueueRtEvents[_0x2ff1('0x6')](_0x8096a8,_0x4659de);_0x4ffa48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x2ff1('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe2a2=['emit','hasOwnProperty','hook','UserVoiceQueueRt','save','update'];(function(_0x3ecf9c,_0x27d793){var _0x2ce38f=function(_0x3afba1){while(--_0x3afba1){_0x3ecf9c['push'](_0x3ecf9c['shift']());}};_0x2ce38f(++_0x27d793);}(_0xe2a2,0x1b9));var _0x2e2a=function(_0x1f743c,_0x352877){_0x1f743c=_0x1f743c-0x0;var _0x34c6a0=_0xe2a2[_0x1f743c];return _0x34c6a0;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x2e2a('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2e2a('0x1'),'afterUpdate':_0x2e2a('0x2'),'afterDestroy':'remove'};function emitEvent(_0xb07930){return function(_0x4fd6e5,_0x2b5849,_0x2454a8){UserVoiceQueueRtEvents['emit'](_0xb07930+':'+_0x4fd6e5['id'],_0x4fd6e5);UserVoiceQueueRtEvents[_0x2e2a('0x3')](_0xb07930,_0x4fd6e5);_0x2454a8(null);};}for(var e in events){if(events[_0x2e2a('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x2e2a('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 1bd7b16..d6e3c54 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 _0xd5bc=['exports','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x202a60,_0x38eec5){var _0x4ba608=function(_0x14ba6d){while(--_0x14ba6d){_0x202a60['push'](_0x202a60['shift']());}};_0x4ba608(++_0x38eec5);}(_0xd5bc,0x1af));var _0xcd5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcd5b('0x0'));var util=require('util');var logger=require(_0xcd5b('0x1'))('api');var moment=require(_0xcd5b('0x2'));var BPromise=require(_0xcd5b('0x3'));var rp=require(_0xcd5b('0x4'));var fs=require('fs');var path=require(_0xcd5b('0x5'));var rimraf=require(_0xcd5b('0x6'));var config=require(_0xcd5b('0x7'));var attributes=require(_0xcd5b('0x8'));module[_0xcd5b('0x9')]=function(_0x43836e,_0x3e76c2){return _0x43836e['define']('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd89=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','api','moment','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x3f578f,_0x51f172){var _0x32c754=function(_0x1bd873){while(--_0x1bd873){_0x3f578f['push'](_0x3f578f['shift']());}};_0x32c754(++_0x51f172);}(_0xbd89,0x1c6));var _0x9bd8=function(_0x32d9fb,_0x46af04){_0x32d9fb=_0x32d9fb-0x0;var _0x3b3c0d=_0xbd89[_0x32d9fb];return _0x3b3c0d;};'use strict';var _=require(_0x9bd8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9bd8('0x1'));var moment=require(_0x9bd8('0x2'));var BPromise=require('bluebird');var rp=require(_0x9bd8('0x3'));var fs=require('fs');var path=require(_0x9bd8('0x4'));var rimraf=require('rimraf');var config=require(_0x9bd8('0x5'));var attributes=require(_0x9bd8('0x6'));module[_0x9bd8('0x7')]=function(_0x3ca330,_0x7cc44c){return _0x3ca330[_0x9bd8('0x8')](_0x9bd8('0x9'),attributes,{'tableName':_0x9bd8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 3cad3b7..09c0863 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 _0xe813=['redis','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','options','raw','where','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0xe813,0xe3));var _0x3e81=function(_0x1499c4,_0x57c5c3){_0x1499c4=_0x1499c4-0x0;var _0x3cf45a=_0xe813[_0x1499c4];return _0x3cf45a;};'use strict';var _=require(_0x3e81('0x0'));var util=require(_0x3e81('0x1'));var moment=require(_0x3e81('0x2'));var BPromise=require('bluebird');var rs=require(_0x3e81('0x3'));var fs=require('fs');var Redis=require(_0x3e81('0x4'));var db=require(_0x3e81('0x5'))['db'];var utils=require(_0x3e81('0x6'));var logger=require(_0x3e81('0x7'))(_0x3e81('0x8'));var config=require('../../config/environment');var jayson=require(_0x3e81('0x9'));var client=jayson[_0x3e81('0xa')]['http']({'port':0x232a});config[_0x3e81('0xb')]=_['defaults'](config[_0x3e81('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e81('0xc'))(new Redis(config['redis']));require(_0x3e81('0xd'))[_0x3e81('0xe')](socket);function respondWithRpcPromise(_0x52f2e9,_0x5182fe,_0x1761bc){return new BPromise(function(_0x2f4ff1,_0x46cef5){return client['request'](_0x52f2e9,_0x1761bc)[_0x3e81('0xf')](function(_0x9a434d){logger[_0x3e81('0x10')](_0x3e81('0x11'),_0x5182fe,_0x3e81('0x12'));logger[_0x3e81('0x13')](_0x3e81('0x14'),_0x5182fe,_0x3e81('0x12'),JSON[_0x3e81('0x15')](_0x9a434d));if(_0x9a434d[_0x3e81('0x16')]){if(_0x9a434d[_0x3e81('0x16')][_0x3e81('0x17')]===0x1f4){logger[_0x3e81('0x16')](_0x3e81('0x11'),_0x5182fe,_0x9a434d[_0x3e81('0x16')][_0x3e81('0x18')]);return _0x46cef5(_0x9a434d[_0x3e81('0x16')]['message']);}logger[_0x3e81('0x16')](_0x3e81('0x11'),_0x5182fe,_0x9a434d[_0x3e81('0x16')][_0x3e81('0x18')]);return _0x2f4ff1(_0x9a434d[_0x3e81('0x16')]['message']);}else{logger[_0x3e81('0x10')](_0x3e81('0x11'),_0x5182fe,_0x3e81('0x12'));_0x2f4ff1(_0x9a434d[_0x3e81('0x19')][_0x3e81('0x18')]);}})['catch'](function(_0x5cdfba){logger['error'](_0x3e81('0x11'),_0x5182fe,_0x5cdfba);_0x46cef5(_0x5cdfba);});});}exports[_0x3e81('0x1a')]=function(_0x5e5fc8){var _0x2c9750=this;return new Promise(function(_0x7d84a5,_0x44f390){return db['UserVoiceQueueRt']['findAll']({'raw':_0x5e5fc8[_0x3e81('0x1b')]?_0x5e5fc8[_0x3e81('0x1b')][_0x3e81('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e5fc8[_0x3e81('0x1b')]?_0x5e5fc8['options'][_0x3e81('0x1d')]||null:null,'attributes':[[db[_0x3e81('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3e81('0x1e')]['literal'](_0x3e81('0x1f')))),_0x3e81('0x20')]]})['then'](function(_0x53b99d){logger[_0x3e81('0x10')]('GetVoiceQueueRtPauses',_0x5e5fc8);logger['debug'](_0x3e81('0x1a'),_0x5e5fc8,JSON[_0x3e81('0x15')](_0x53b99d));_0x7d84a5(_0x53b99d);})[_0x3e81('0x21')](function(_0x3be48e){logger[_0x3e81('0x16')](_0x3e81('0x1a'),_0x3be48e['message'],_0x5e5fc8);_0x44f390(_0x2c9750[_0x3e81('0x16')](0x1f4,_0x3be48e[_0x3e81('0x18')]));});});}; \ No newline at end of file +var _0x3b9d=['literal','`paused`\x20=\x201,\x201,\x20null','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','raw','options','where','sequelize','COUNT'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x3b9d,0x1ec));var _0xd3b9=function(_0x5c6fc1,_0x54eec3){_0x5c6fc1=_0x5c6fc1-0x0;var _0x1a96c6=_0x3b9d[_0x5c6fc1];return _0x1a96c6;};'use strict';var _=require(_0xd3b9('0x0'));var util=require(_0xd3b9('0x1'));var moment=require('moment');var BPromise=require(_0xd3b9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3b9('0x3'));var db=require(_0xd3b9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3b9('0x5'))(_0xd3b9('0x6'));var config=require(_0xd3b9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd3b9('0x8')]['http']({'port':0x232a});config[_0xd3b9('0x9')]=_['defaults'](config['redis'],{'host':_0xd3b9('0xa'),'port':0x18eb});var socket=require(_0xd3b9('0xb'))(new Redis(config[_0xd3b9('0x9')]));require(_0xd3b9('0xc'))['register'](socket);function respondWithRpcPromise(_0x54dbc4,_0x395143,_0x953639){return new BPromise(function(_0x27710c,_0x2e0e5f){return client['request'](_0x54dbc4,_0x953639)[_0xd3b9('0xd')](function(_0x5aaa14){logger[_0xd3b9('0xe')](_0xd3b9('0xf'),_0x395143,_0xd3b9('0x10'));logger[_0xd3b9('0x11')](_0xd3b9('0x12'),_0x395143,_0xd3b9('0x10'),JSON[_0xd3b9('0x13')](_0x5aaa14));if(_0x5aaa14['error']){if(_0x5aaa14[_0xd3b9('0x14')][_0xd3b9('0x15')]===0x1f4){logger[_0xd3b9('0x14')](_0xd3b9('0xf'),_0x395143,_0x5aaa14['error'][_0xd3b9('0x16')]);return _0x2e0e5f(_0x5aaa14[_0xd3b9('0x14')]['message']);}logger['error'](_0xd3b9('0xf'),_0x395143,_0x5aaa14['error'][_0xd3b9('0x16')]);return _0x27710c(_0x5aaa14[_0xd3b9('0x14')][_0xd3b9('0x16')]);}else{logger[_0xd3b9('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x395143,_0xd3b9('0x10'));_0x27710c(_0x5aaa14[_0xd3b9('0x17')][_0xd3b9('0x16')]);}})[_0xd3b9('0x18')](function(_0x54b215){logger[_0xd3b9('0x14')](_0xd3b9('0xf'),_0x395143,_0x54b215);_0x2e0e5f(_0x54b215);});});}exports[_0xd3b9('0x19')]=function(_0x4ca748){var _0x1c30fb=this;return new Promise(function(_0x53a5e4,_0x226f1b){return db[_0xd3b9('0x1a')][_0xd3b9('0x1b')]({'raw':_0x4ca748['options']?_0x4ca748['options'][_0xd3b9('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ca748['options']?_0x4ca748[_0xd3b9('0x1d')][_0xd3b9('0x1e')]||null:null,'attributes':[[db[_0xd3b9('0x1f')]['fn'](_0xd3b9('0x20'),db[_0xd3b9('0x1f')]['fn']('IF',db[_0xd3b9('0x1f')][_0xd3b9('0x21')](_0xd3b9('0x22')))),'outboundQueuePauses']]})[_0xd3b9('0xd')](function(_0x5851a4){logger['info'](_0xd3b9('0x19'),_0x4ca748);logger['debug'](_0xd3b9('0x19'),_0x4ca748,JSON[_0xd3b9('0x13')](_0x5851a4));_0x53a5e4(_0x5851a4);})[_0xd3b9('0x18')](function(_0x1f8525){logger[_0xd3b9('0x14')](_0xd3b9('0x19'),_0x1f8525['message'],_0x4ca748);_0x226f1b(_0x1c30fb[_0xd3b9('0x14')](0x1f4,_0x1f8525['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 1231141..f268910 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 _0x5b5a=['removeListener','register','userVoiceQueueRt:','save','remove','emit'];(function(_0x2836fa,_0xb2c637){var _0x14b7e7=function(_0x373ec2){while(--_0x373ec2){_0x2836fa['push'](_0x2836fa['shift']());}};_0x14b7e7(++_0xb2c637);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x2e8fd1,_0x17377c){_0x2e8fd1=_0x2e8fd1-0x0;var _0x1d6927=_0x5b5a[_0x2e8fd1];return _0x1d6927;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xa5b5('0x0'),_0xa5b5('0x1'),'update'];function createListener(_0x454eee,_0x2e4253){return function(_0x2c7e95){_0x2e4253[_0xa5b5('0x2')](_0x454eee,_0x2c7e95);};}function removeListener(_0x1c76ae,_0x45f433){return function(){UserVoiceQueueRtEvents[_0xa5b5('0x3')](_0x1c76ae,_0x45f433);};}exports[_0xa5b5('0x4')]=function(_0x509b78){for(var _0x33678e=0x0,_0x29c137=events['length'];_0x33678e<_0x29c137;_0x33678e++){var _0x32a09a=events[_0x33678e];var _0x1936d6=createListener(_0xa5b5('0x5')+_0x32a09a,_0x509b78);UserVoiceQueueRtEvents['on'](_0x32a09a,_0x1936d6);}}; \ No newline at end of file +var _0xa0a1=['emit','removeListener','register','length','./userVoiceQueueRt.events','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x5aaa90,_0x493b89){_0x5aaa90=_0x5aaa90-0x0;var _0x532628=_0xa0a1[_0x5aaa90];return _0x532628;};'use strict';var UserVoiceQueueRtEvents=require(_0x1a0a('0x0'));var events=['save',_0x1a0a('0x1'),_0x1a0a('0x2')];function createListener(_0x45ebf9,_0x5bdfc1){return function(_0x54b3a4){_0x5bdfc1[_0x1a0a('0x3')](_0x45ebf9,_0x54b3a4);};}function removeListener(_0x22f069,_0x5114de){return function(){UserVoiceQueueRtEvents[_0x1a0a('0x4')](_0x22f069,_0x5114de);};}exports[_0x1a0a('0x5')]=function(_0x4b5573){for(var _0x2d4b04=0x0,_0xe59f97=events[_0x1a0a('0x6')];_0x2d4b04<_0xe59f97;_0x2d4b04++){var _0x245f3d=events[_0x2d4b04];var _0x9da67c=createListener('userVoiceQueueRt:'+_0x245f3d,_0x4b5573);UserVoiceQueueRtEvents['on'](_0x245f3d,_0x9da67c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 30b359e..9966f27 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1b964a,_0x40fdc2){var _0x2559fa=function(_0x1afe3e){while(--_0x1afe3e){_0x1b964a['push'](_0x1b964a['shift']());}};_0x2559fa(++_0x40fdc2);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x18a146,_0x7f9c66){var _0x5f4e60=function(_0x355114){while(--_0x355114){_0x18a146['push'](_0x18a146['shift']());}};_0x5f4e60(++_0x7f9c66);}(_0x70e0,0x17b));var _0x070e=function(_0x5d0002,_0x33d28a){_0x5d0002=_0x5d0002-0x0;var _0xaf4b1=_0x70e0[_0x5d0002];return _0xaf4b1;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index f62649c..6626f92 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 _0x645a=['INTEGER','sequelize','exports'];(function(_0x5b4f4a,_0x7a4f95){var _0x42ff9a=function(_0x19b0e3){while(--_0x19b0e3){_0x5b4f4a['push'](_0x5b4f4a['shift']());}};_0x42ff9a(++_0x7a4f95);}(_0x645a,0x1cf));var _0xa645=function(_0x31b350,_0x5be290){_0x31b350=_0x31b350-0x0;var _0x1870dc=_0x645a[_0x31b350];return _0x1870dc;};'use strict';var Sequelize=require(_0xa645('0x0'));module[_0xa645('0x1')]={'penalty':{'type':Sequelize[_0xa645('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6c30=['sequelize','INTEGER'];(function(_0x16bb21,_0x4181f4){var _0x179ca4=function(_0x1c3528){while(--_0x1c3528){_0x16bb21['push'](_0x16bb21['shift']());}};_0x179ca4(++_0x4181f4);}(_0x6c30,0x19a));var _0x06c3=function(_0x378720,_0xa711f1){_0x378720=_0x378720-0x0;var _0x47920a=_0x6c30[_0x378720];return _0x47920a;};'use strict';var Sequelize=require(_0x06c3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x06c3('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 0310e7a..a2936af 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 _0xa50c=['UserWhatsappQueue','user_has_whatsapp_queues','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x11c258,_0x2db155){var _0x2a58a4=function(_0x2023c1){while(--_0x2023c1){_0x11c258['push'](_0x11c258['shift']());}};_0x2a58a4(++_0x2db155);}(_0xa50c,0x1ba));var _0xca50=function(_0x177346,_0x5e4024){_0x177346=_0x177346-0x0;var _0x155669=_0xa50c[_0x177346];return _0x155669;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xca50('0x0'))('api');var moment=require('moment');var BPromise=require(_0xca50('0x1'));var rp=require(_0xca50('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca50('0x3'));var config=require(_0xca50('0x4'));var attributes=require(_0xca50('0x5'));module[_0xca50('0x6')]=function(_0x491960,_0x1500bb){return _0x491960[_0xca50('0x7')](_0xca50('0x8'),attributes,{'tableName':_0xca50('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9832=['define','UserWhatsappQueue','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x120610,_0x226b61){var _0x4e5072=function(_0x27b8cd){while(--_0x27b8cd){_0x120610['push'](_0x120610['shift']());}};_0x4e5072(++_0x226b61);}(_0x9832,0xff));var _0x2983=function(_0x3bbc46,_0x58ee90){_0x3bbc46=_0x3bbc46-0x0;var _0x3658f2=_0x9832[_0x3bbc46];return _0x3658f2;};'use strict';var _=require('lodash');var util=require(_0x2983('0x0'));var logger=require('../../config/logger')(_0x2983('0x1'));var moment=require(_0x2983('0x2'));var BPromise=require(_0x2983('0x3'));var rp=require(_0x2983('0x4'));var fs=require('fs');var path=require(_0x2983('0x5'));var rimraf=require(_0x2983('0x6'));var config=require(_0x2983('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x2983('0x8')]=function(_0x1ac90a,_0x57b109){return _0x1ac90a[_0x2983('0x9')](_0x2983('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 23d09f2..a6e3b26 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 _0x77bf=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2fa771,_0x511aec){var _0x8f89c2=function(_0x376db1){while(--_0x376db1){_0x2fa771['push'](_0x2fa771['shift']());}};_0x8f89c2(++_0x511aec);}(_0x77bf,0x189));var _0xf77b=function(_0xa8e2f6,_0x113b29){_0xa8e2f6=_0xa8e2f6-0x0;var _0x1c6068=_0x77bf[_0xa8e2f6];return _0x1c6068;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf77b('0x0'));var BPromise=require(_0xf77b('0x1'));var rs=require(_0xf77b('0x2'));var fs=require('fs');var Redis=require(_0xf77b('0x3'));var db=require(_0xf77b('0x4'))['db'];var utils=require(_0xf77b('0x5'));var logger=require(_0xf77b('0x6'))('rpc');var config=require(_0xf77b('0x7'));var jayson=require(_0xf77b('0x8'));var client=jayson[_0xf77b('0x9')][_0xf77b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1edd3b,_0xef25fd,_0x3890c5){return new BPromise(function(_0x284dfa,_0x1c02f4){return client[_0xf77b('0xb')](_0x1edd3b,_0x3890c5)[_0xf77b('0xc')](function(_0x2e2ecc){logger[_0xf77b('0xd')](_0xf77b('0xe'),_0xef25fd,_0xf77b('0xf'));logger['debug']('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0xef25fd,'request\x20sent',JSON['stringify'](_0x2e2ecc));if(_0x2e2ecc[_0xf77b('0x10')]){if(_0x2e2ecc[_0xf77b('0x10')][_0xf77b('0x11')]===0x1f4){logger['error'](_0xf77b('0xe'),_0xef25fd,_0x2e2ecc['error'][_0xf77b('0x12')]);return _0x1c02f4(_0x2e2ecc[_0xf77b('0x10')][_0xf77b('0x12')]);}logger[_0xf77b('0x10')](_0xf77b('0xe'),_0xef25fd,_0x2e2ecc['error'][_0xf77b('0x12')]);return _0x284dfa(_0x2e2ecc[_0xf77b('0x10')][_0xf77b('0x12')]);}else{logger['info'](_0xf77b('0xe'),_0xef25fd,'request\x20sent');_0x284dfa(_0x2e2ecc[_0xf77b('0x13')][_0xf77b('0x12')]);}})[_0xf77b('0x14')](function(_0x274de9){logger[_0xf77b('0x10')]('UserWhatsappQueue,\x20%s,\x20%s',_0xef25fd,_0x274de9);_0x1c02f4(_0x274de9);});});} \ No newline at end of file +var _0x113e=['../../config/logger','rpc','jayson/promise','client','http','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d3499,_0x25fd91){var _0x3871f4=function(_0x4528b1){while(--_0x4528b1){_0x1d3499['push'](_0x1d3499['shift']());}};_0x3871f4(++_0x25fd91);}(_0x113e,0x1c4));var _0xe113=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x113e[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xe113('0x0'));var util=require(_0xe113('0x1'));var moment=require(_0xe113('0x2'));var BPromise=require(_0xe113('0x3'));var rs=require(_0xe113('0x4'));var fs=require('fs');var Redis=require(_0xe113('0x5'));var db=require(_0xe113('0x6'))['db'];var utils=require(_0xe113('0x7'));var logger=require(_0xe113('0x8'))(_0xe113('0x9'));var config=require('../../config/environment');var jayson=require(_0xe113('0xa'));var client=jayson[_0xe113('0xb')][_0xe113('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b2248,_0x590bf3,_0x432a99){return new BPromise(function(_0x480197,_0x595620){return client[_0xe113('0xd')](_0x4b2248,_0x432a99)['then'](function(_0x51d3ac){logger['info'](_0xe113('0xe'),_0x590bf3,_0xe113('0xf'));logger[_0xe113('0x10')](_0xe113('0x11'),_0x590bf3,_0xe113('0xf'),JSON[_0xe113('0x12')](_0x51d3ac));if(_0x51d3ac[_0xe113('0x13')]){if(_0x51d3ac[_0xe113('0x13')]['code']===0x1f4){logger[_0xe113('0x13')](_0xe113('0xe'),_0x590bf3,_0x51d3ac['error']['message']);return _0x595620(_0x51d3ac[_0xe113('0x13')]['message']);}logger[_0xe113('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x590bf3,_0x51d3ac[_0xe113('0x13')][_0xe113('0x14')]);return _0x480197(_0x51d3ac[_0xe113('0x13')][_0xe113('0x14')]);}else{logger[_0xe113('0x15')]('UserWhatsappQueue,\x20%s,\x20%s',_0x590bf3,_0xe113('0xf'));_0x480197(_0x51d3ac[_0xe113('0x16')]['message']);}})['catch'](function(_0x2c13e5){logger[_0xe113('0x13')](_0xe113('0xe'),_0x590bf3,_0x2c13e5);_0x595620(_0x2c13e5);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 456eaef..35f6f10 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 _0xda65=['Router','fs-extra','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','express'];(function(_0x338c39,_0x4a411b){var _0x68546b=function(_0x586b40){while(--_0x586b40){_0x338c39['push'](_0x338c39['shift']());}};_0x68546b(++_0x4a411b);}(_0xda65,0x1d0));var _0x5da6=function(_0x32f470,_0x3726c6){_0x32f470=_0x32f470-0x0;var _0x43cc20=_0xda65[_0x32f470];return _0x43cc20;};'use strict';var multer=require(_0x5da6('0x0'));var util=require(_0x5da6('0x1'));var path=require(_0x5da6('0x2'));var timeout=require('connect-timeout');var express=require(_0x5da6('0x3'));var router=express[_0x5da6('0x4')]();var fs_extra=require(_0x5da6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5da6('0x6'));var controller=require(_0x5da6('0x7'));router[_0x5da6('0x8')]('/',auth[_0x5da6('0x9')](),controller[_0x5da6('0xa')]);router['get'](_0x5da6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5da6('0xc')]('/',auth['isAuthenticated'](),controller[_0x5da6('0xd')]);router[_0x5da6('0xe')](_0x5da6('0xb'),auth[_0x5da6('0x9')](),controller[_0x5da6('0xf')]);router[_0x5da6('0x10')](_0x5da6('0xb'),auth[_0x5da6('0x9')](),controller['destroy']);module[_0x5da6('0x11')]=router; \ No newline at end of file +var _0xf25a=['create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','index','isAuthenticated','show','post'];(function(_0x380d32,_0x28c493){var _0x10fcdd=function(_0x3dadf4){while(--_0x3dadf4){_0x380d32['push'](_0x380d32['shift']());}};_0x10fcdd(++_0x28c493);}(_0xf25a,0x195));var _0xaf25=function(_0x19a5db,_0x3de9d9){_0x19a5db=_0x19a5db-0x0;var _0x3d9737=_0xf25a[_0x19a5db];return _0x3d9737;};'use strict';var multer=require(_0xaf25('0x0'));var util=require(_0xaf25('0x1'));var path=require(_0xaf25('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf25('0x3'));var router=express[_0xaf25('0x4')]();var fs_extra=require(_0xaf25('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaf25('0x6'));var config=require(_0xaf25('0x7'));var controller=require(_0xaf25('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xaf25('0x9')]);router['get']('/:id',auth[_0xaf25('0xa')](),controller[_0xaf25('0xb')]);router[_0xaf25('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf25('0xd')]);router[_0xaf25('0xe')](_0xaf25('0xf'),auth[_0xaf25('0xa')](),controller[_0xaf25('0x10')]);router['delete'](_0xaf25('0xf'),auth[_0xaf25('0xa')](),controller[_0xaf25('0x11')]);module[_0xaf25('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 5b8b3fd..5620ae1 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 _0x165d=['STRING','name','sequelize','exports'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0x165d,0x14a));var _0xd165=function(_0x1c2f0b,_0x3923cd){_0x1c2f0b=_0x1c2f0b-0x0;var _0x497f14=_0x165d[_0x1c2f0b];return _0x497f14;};'use strict';var Sequelize=require(_0xd165('0x0'));module[_0xd165('0x1')]={'name':{'type':Sequelize[_0xd165('0x2')],'unique':_0xd165('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd165('0x2')]}}; \ No newline at end of file +var _0x8bad=['sequelize','exports','STRING','name'];(function(_0xdae69b,_0x5544f3){var _0x503069=function(_0x38e499){while(--_0x38e499){_0xdae69b['push'](_0xdae69b['shift']());}};_0x503069(++_0x5544f3);}(_0x8bad,0x124));var _0xd8ba=function(_0x530cea,_0x5ba642){_0x530cea=_0x530cea-0x0;var _0xc0b750=_0x8bad[_0x530cea];return _0xc0b750;};'use strict';var Sequelize=require(_0xd8ba('0x0'));module[_0xd8ba('0x1')]={'name':{'type':Sequelize[_0xd8ba('0x2')],'unique':_0xd8ba('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd8ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 12d0316..39015b4 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 _0xa663=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','Variables','UserProfileResource','error','name','send','index','Variable','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x42a4e3,_0x137cdf){var _0x410529=function(_0x3365a5){while(--_0x3365a5){_0x42a4e3['push'](_0x42a4e3['shift']());}};_0x410529(++_0x137cdf);}(_0xa663,0x70));var _0x3a66=function(_0x126f42,_0x57f1ad){_0x126f42=_0x126f42-0x0;var _0x219119=_0xa663[_0x126f42];return _0x219119;};'use strict';var emlformat=require(_0x3a66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a66('0x1'));var jsonpatch=require(_0x3a66('0x2'));var rp=require(_0x3a66('0x3'));var moment=require(_0x3a66('0x4'));var BPromise=require(_0x3a66('0x5'));var Mustache=require(_0x3a66('0x6'));var util=require(_0x3a66('0x7'));var path=require(_0x3a66('0x8'));var sox=require('sox');var csv=require(_0x3a66('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3a66('0xa'));var squel=require(_0x3a66('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3a66('0xc'));var toCsv=require(_0x3a66('0x9'));var querystring=require(_0x3a66('0xd'));var Papa=require(_0x3a66('0xe'));var Redis=require(_0x3a66('0xf'));var authService=require(_0x3a66('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a66('0x11'))(_0x3a66('0x12'));var utils=require(_0x3a66('0x13'));var config=require(_0x3a66('0x14'));var licenseUtil=require(_0x3a66('0x15'));var db=require(_0x3a66('0x16'))['db'];function respondWithStatusCode(_0x10a965,_0x3fe00f){_0x3fe00f=_0x3fe00f||0xcc;return function(_0x5a339a){if(_0x5a339a){return _0x10a965[_0x3a66('0x17')](_0x3fe00f);}return _0x10a965['status'](_0x3fe00f)[_0x3a66('0x18')]();};}function respondWithResult(_0x4a2e65,_0x574d44){_0x574d44=_0x574d44||0xc8;return function(_0x3e6ca4){if(_0x3e6ca4){return _0x4a2e65['status'](_0x574d44)[_0x3a66('0x19')](_0x3e6ca4);}};}function respondWithFilteredResult(_0x96019c,_0x325b90){return function(_0x6905f){if(_0x6905f){var _0x2045ad=typeof _0x325b90[_0x3a66('0x1a')]==='undefined'&&typeof _0x325b90[_0x3a66('0x1b')]==='undefined';var _0x4c8aea=_0x6905f[_0x3a66('0x1c')];var _0x46bdc9=_0x2045ad?0x0:_0x325b90[_0x3a66('0x1a')];var _0x1c989f=_0x2045ad?_0x6905f[_0x3a66('0x1c')]:_0x325b90[_0x3a66('0x1a')]+_0x325b90['limit'];var _0x1332ff;if(_0x1c989f>=_0x4c8aea){_0x1c989f=_0x4c8aea;_0x1332ff=0xc8;}else{_0x1332ff=0xce;}_0x96019c[_0x3a66('0x1d')](_0x1332ff);return _0x96019c[_0x3a66('0x1e')](_0x3a66('0x1f'),_0x46bdc9+'-'+_0x1c989f+'/'+_0x4c8aea)[_0x3a66('0x19')](_0x6905f);}return null;};}function patchUpdates(_0x599a95){return function(_0x41fc9b){try{jsonpatch[_0x3a66('0x20')](_0x41fc9b,_0x599a95,!![]);}catch(_0x33d5a6){return BPromise[_0x3a66('0x21')](_0x33d5a6);}return _0x41fc9b[_0x3a66('0x22')]();};}function saveUpdates(_0x538c39,_0x37a983){return function(_0xacbe7f){if(_0xacbe7f){return _0xacbe7f[_0x3a66('0x23')](_0x538c39)[_0x3a66('0x24')](function(_0xf24bc5){return _0xf24bc5;});}return null;};}function removeEntity(_0x55914a,_0x1d8615){return function(_0x18be91){if(_0x18be91){return _0x18be91[_0x3a66('0x25')]()[_0x3a66('0x24')](function(){var _0x3465b0=_0x18be91['get']({'plain':!![]});var _0x2c10d8=_0x3a66('0x26');return db[_0x3a66('0x27')]['destroy']({'where':{'type':_0x2c10d8,'resourceId':_0x3465b0['id']}})[_0x3a66('0x24')](function(){return _0x18be91;});})['then'](function(){_0x55914a['status'](0xcc)[_0x3a66('0x18')]();});}};}function handleEntityNotFound(_0x128e11,_0x251100){return function(_0x3d8e0f){if(!_0x3d8e0f){_0x128e11[_0x3a66('0x17')](0x194);}return _0x3d8e0f;};}function handleError(_0x208d19,_0x108ed2){_0x108ed2=_0x108ed2||0x1f4;return function(_0x198329){logger[_0x3a66('0x28')](_0x198329['stack']);if(_0x198329[_0x3a66('0x29')]){delete _0x198329['name'];}_0x208d19[_0x3a66('0x1d')](_0x108ed2)[_0x3a66('0x2a')](_0x198329);};}exports[_0x3a66('0x2b')]=function(_0x360102,_0x1b14c7){var _0x48a85f={},_0x435b3f={},_0x4b758b={'count':0x0,'rows':[]};var _0x104e25=_['map'](db[_0x3a66('0x2c')][_0x3a66('0x2d')],function(_0x453f96){return{'name':_0x453f96[_0x3a66('0x2e')],'type':_0x453f96['type'][_0x3a66('0x2f')]};});_0x435b3f[_0x3a66('0x30')]=_['map'](_0x104e25,'name');_0x435b3f[_0x3a66('0x31')]=_[_0x3a66('0x32')](_0x360102[_0x3a66('0x31')]);_0x435b3f[_0x3a66('0x33')]=_[_0x3a66('0x34')](_0x435b3f[_0x3a66('0x30')],_0x435b3f[_0x3a66('0x31')]);_0x48a85f[_0x3a66('0x35')]=_[_0x3a66('0x34')](_0x435b3f[_0x3a66('0x30')],qs[_0x3a66('0x36')](_0x360102[_0x3a66('0x31')][_0x3a66('0x36')]));_0x48a85f[_0x3a66('0x35')]=_0x48a85f[_0x3a66('0x35')][_0x3a66('0x37')]?_0x48a85f[_0x3a66('0x35')]:_0x435b3f[_0x3a66('0x30')];if(!_0x360102[_0x3a66('0x31')][_0x3a66('0x38')](_0x3a66('0x39'))){_0x48a85f[_0x3a66('0x1b')]=qs['limit'](_0x360102[_0x3a66('0x31')][_0x3a66('0x1b')]);_0x48a85f[_0x3a66('0x1a')]=qs['offset'](_0x360102[_0x3a66('0x31')][_0x3a66('0x1a')]);}_0x48a85f[_0x3a66('0x3a')]=qs[_0x3a66('0x3b')](_0x360102['query']['sort']);_0x48a85f[_0x3a66('0x3c')]=qs[_0x3a66('0x33')](_[_0x3a66('0x3d')](_0x360102[_0x3a66('0x31')],_0x435b3f[_0x3a66('0x33')]),_0x104e25);if(_0x360102[_0x3a66('0x31')]['filter']){_0x48a85f[_0x3a66('0x3c')]=_[_0x3a66('0x3e')](_0x48a85f[_0x3a66('0x3c')],{'$or':_['map'](_0x104e25,function(_0xef8e7f){if(_0xef8e7f[_0x3a66('0x3f')]!==_0x3a66('0x40')){var _0x58aaee={};_0x58aaee[_0xef8e7f[_0x3a66('0x29')]]={'$like':'%'+_0x360102[_0x3a66('0x31')][_0x3a66('0x41')]+'%'};return _0x58aaee;}})});}_0x48a85f=_[_0x3a66('0x3e')]({},_0x48a85f,_0x360102[_0x3a66('0x42')]);var _0x109abe={'where':_0x48a85f[_0x3a66('0x3c')]};return db[_0x3a66('0x2c')][_0x3a66('0x1c')](_0x109abe)[_0x3a66('0x24')](function(_0x45983e){_0x4b758b[_0x3a66('0x1c')]=_0x45983e;if(_0x360102[_0x3a66('0x31')][_0x3a66('0x43')]){_0x48a85f[_0x3a66('0x44')]=[{'all':!![]}];}return db['Variable'][_0x3a66('0x45')](_0x48a85f);})[_0x3a66('0x24')](function(_0x3e4812){_0x4b758b[_0x3a66('0x46')]=_0x3e4812;return _0x4b758b;})[_0x3a66('0x24')](respondWithFilteredResult(_0x1b14c7,_0x48a85f))['catch'](handleError(_0x1b14c7,null));};exports[_0x3a66('0x47')]=function(_0x4671ae,_0x381bcf){var _0x106139={'raw':!![],'where':{'id':_0x4671ae[_0x3a66('0x48')]['id']}},_0xa1cb55={};_0xa1cb55['model']=_[_0x3a66('0x32')](db[_0x3a66('0x2c')][_0x3a66('0x2d')]);_0xa1cb55['query']=_[_0x3a66('0x32')](_0x4671ae[_0x3a66('0x31')]);_0xa1cb55['filters']=_[_0x3a66('0x34')](_0xa1cb55[_0x3a66('0x30')],_0xa1cb55[_0x3a66('0x31')]);_0x106139['attributes']=_[_0x3a66('0x34')](_0xa1cb55[_0x3a66('0x30')],qs[_0x3a66('0x36')](_0x4671ae['query']['fields']));_0x106139[_0x3a66('0x35')]=_0x106139[_0x3a66('0x35')][_0x3a66('0x37')]?_0x106139[_0x3a66('0x35')]:_0xa1cb55[_0x3a66('0x30')];if(_0x4671ae[_0x3a66('0x31')][_0x3a66('0x43')]){_0x106139[_0x3a66('0x44')]=[{'all':!![]}];}_0x106139=_[_0x3a66('0x3e')]({},_0x106139,_0x4671ae[_0x3a66('0x42')]);return db[_0x3a66('0x2c')][_0x3a66('0x49')](_0x106139)[_0x3a66('0x24')](handleEntityNotFound(_0x381bcf,null))[_0x3a66('0x24')](respondWithResult(_0x381bcf,null))[_0x3a66('0x4a')](handleError(_0x381bcf,null));};exports[_0x3a66('0x4b')]=function(_0x357eb7,_0x218417){return db[_0x3a66('0x2c')][_0x3a66('0x4b')](_0x357eb7[_0x3a66('0x4c')],{})[_0x3a66('0x24')](function(_0x139e27){var _0x17c0fa=_0x357eb7[_0x3a66('0x4d')][_0x3a66('0x4e')]({'plain':!![]});if(!_0x17c0fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17c0fa[_0x3a66('0x4f')]===_0x3a66('0x4d')){var _0x47770f=_0x139e27['get']({'plain':!![]});var _0x2d8bf8=_0x3a66('0x26');return db[_0x3a66('0x50')]['find']({'where':{'name':_0x2d8bf8,'userProfileId':_0x17c0fa[_0x3a66('0x51')]},'raw':!![]})[_0x3a66('0x24')](function(_0xc03c1a){if(_0xc03c1a&&_0xc03c1a[_0x3a66('0x52')]===0x0){return db[_0x3a66('0x27')]['create']({'name':_0x47770f[_0x3a66('0x29')],'resourceId':_0x47770f['id'],'type':_0xc03c1a[_0x3a66('0x29')],'sectionId':_0xc03c1a['id']},{})[_0x3a66('0x24')](function(){return _0x139e27;});}else{return _0x139e27;}})[_0x3a66('0x4a')](function(_0x1929dd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1929dd);throw _0x1929dd;});}return _0x139e27;})[_0x3a66('0x24')](respondWithResult(_0x218417,0xc9))['catch'](handleError(_0x218417,null));};exports[_0x3a66('0x23')]=function(_0x3a0cd7,_0x6acef8){if(_0x3a0cd7[_0x3a66('0x4c')]['id']){delete _0x3a0cd7[_0x3a66('0x4c')]['id'];}return db['Variable'][_0x3a66('0x49')]({'where':{'id':_0x3a0cd7[_0x3a66('0x48')]['id']}})['then'](handleEntityNotFound(_0x6acef8,null))[_0x3a66('0x24')](saveUpdates(_0x3a0cd7['body'],null))[_0x3a66('0x24')](respondWithResult(_0x6acef8,null))[_0x3a66('0x4a')](handleError(_0x6acef8,null));};exports[_0x3a66('0x25')]=function(_0x5e89ef,_0x451eca){return db[_0x3a66('0x2c')]['find']({'where':{'id':_0x5e89ef[_0x3a66('0x48')]['id']}})[_0x3a66('0x24')](handleEntityNotFound(_0x451eca,null))[_0x3a66('0x24')](removeEntity(_0x451eca,null))['catch'](handleError(_0x451eca,null));}; \ No newline at end of file +var _0x18bd=['set','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','user','role','UserProfileSection','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset'];(function(_0x38613b,_0x593433){var _0x3f9353=function(_0x5e07ac){while(--_0x5e07ac){_0x38613b['push'](_0x38613b['shift']());}};_0x3f9353(++_0x593433);}(_0x18bd,0x1b1));var _0xd18b=function(_0x3d8e50,_0x48c5d6){_0x3d8e50=_0x3d8e50-0x0;var _0x18beb3=_0x18bd[_0x3d8e50];return _0x18beb3;};'use strict';var emlformat=require(_0xd18b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd18b('0x1'));var jsonpatch=require(_0xd18b('0x2'));var rp=require(_0xd18b('0x3'));var moment=require('moment');var BPromise=require(_0xd18b('0x4'));var Mustache=require(_0xd18b('0x5'));var util=require(_0xd18b('0x6'));var path=require(_0xd18b('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(_0xd18b('0x8'));var squel=require(_0xd18b('0x9'));var crypto=require(_0xd18b('0xa'));var jsforce=require(_0xd18b('0xb'));var deskjs=require(_0xd18b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd18b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd18b('0xe'));var qs=require(_0xd18b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd18b('0x10'));var logger=require('../../config/logger')(_0xd18b('0x11'));var utils=require(_0xd18b('0x12'));var config=require(_0xd18b('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xd18b('0x14'))['db'];function respondWithStatusCode(_0x516fb8,_0x3b6203){_0x3b6203=_0x3b6203||0xcc;return function(_0x245987){if(_0x245987){return _0x516fb8[_0xd18b('0x15')](_0x3b6203);}return _0x516fb8['status'](_0x3b6203)[_0xd18b('0x16')]();};}function respondWithResult(_0x439674,_0x50f7b3){_0x50f7b3=_0x50f7b3||0xc8;return function(_0xfcce77){if(_0xfcce77){return _0x439674[_0xd18b('0x17')](_0x50f7b3)[_0xd18b('0x18')](_0xfcce77);}};}function respondWithFilteredResult(_0xd0d9dc,_0x2ae589){return function(_0x275c48){if(_0x275c48){var _0x297e8b=typeof _0x2ae589['offset']===_0xd18b('0x19')&&typeof _0x2ae589[_0xd18b('0x1a')]==='undefined';var _0x31c5db=_0x275c48[_0xd18b('0x1b')];var _0x48847c=_0x297e8b?0x0:_0x2ae589[_0xd18b('0x1c')];var _0x232e40=_0x297e8b?_0x275c48['count']:_0x2ae589[_0xd18b('0x1c')]+_0x2ae589['limit'];var _0x1164a1;if(_0x232e40>=_0x31c5db){_0x232e40=_0x31c5db;_0x1164a1=0xc8;}else{_0x1164a1=0xce;}_0xd0d9dc[_0xd18b('0x17')](_0x1164a1);return _0xd0d9dc[_0xd18b('0x1d')]('Content-Range',_0x48847c+'-'+_0x232e40+'/'+_0x31c5db)['json'](_0x275c48);}return null;};}function patchUpdates(_0x27afbb){return function(_0x488820){try{jsonpatch[_0xd18b('0x1e')](_0x488820,_0x27afbb,!![]);}catch(_0x46d7a0){return BPromise[_0xd18b('0x1f')](_0x46d7a0);}return _0x488820[_0xd18b('0x20')]();};}function saveUpdates(_0x4dd4a6,_0x1bea17){return function(_0x1ffb9b){if(_0x1ffb9b){return _0x1ffb9b[_0xd18b('0x21')](_0x4dd4a6)['then'](function(_0x5afb21){return _0x5afb21;});}return null;};}function removeEntity(_0x6cc7a4,_0x2810ca){return function(_0x126b9f){if(_0x126b9f){return _0x126b9f[_0xd18b('0x22')]()[_0xd18b('0x23')](function(){var _0x2e3918=_0x126b9f[_0xd18b('0x24')]({'plain':!![]});var _0x1f8b21=_0xd18b('0x25');return db[_0xd18b('0x26')][_0xd18b('0x22')]({'where':{'type':_0x1f8b21,'resourceId':_0x2e3918['id']}})[_0xd18b('0x23')](function(){return _0x126b9f;});})[_0xd18b('0x23')](function(){_0x6cc7a4[_0xd18b('0x17')](0xcc)[_0xd18b('0x16')]();});}};}function handleEntityNotFound(_0x52b665,_0x4f56e0){return function(_0x2145f3){if(!_0x2145f3){_0x52b665[_0xd18b('0x15')](0x194);}return _0x2145f3;};}function handleError(_0x872fea,_0x4a87f4){_0x4a87f4=_0x4a87f4||0x1f4;return function(_0x5b123f){logger[_0xd18b('0x27')](_0x5b123f[_0xd18b('0x28')]);if(_0x5b123f['name']){delete _0x5b123f[_0xd18b('0x29')];}_0x872fea['status'](_0x4a87f4)[_0xd18b('0x2a')](_0x5b123f);};}exports[_0xd18b('0x2b')]=function(_0x3757eb,_0x597433){var _0x518afb={},_0x100c6c={},_0x16b81d={'count':0x0,'rows':[]};var _0x304503=_[_0xd18b('0x2c')](db[_0xd18b('0x2d')]['rawAttributes'],function(_0xe624d5){return{'name':_0xe624d5[_0xd18b('0x2e')],'type':_0xe624d5['type']['key']};});_0x100c6c[_0xd18b('0x2f')]=_[_0xd18b('0x2c')](_0x304503,'name');_0x100c6c[_0xd18b('0x30')]=_[_0xd18b('0x31')](_0x3757eb['query']);_0x100c6c[_0xd18b('0x32')]=_[_0xd18b('0x33')](_0x100c6c['model'],_0x100c6c[_0xd18b('0x30')]);_0x518afb[_0xd18b('0x34')]=_[_0xd18b('0x33')](_0x100c6c[_0xd18b('0x2f')],qs[_0xd18b('0x35')](_0x3757eb['query']['fields']));_0x518afb['attributes']=_0x518afb['attributes'][_0xd18b('0x36')]?_0x518afb[_0xd18b('0x34')]:_0x100c6c[_0xd18b('0x2f')];if(!_0x3757eb[_0xd18b('0x30')][_0xd18b('0x37')]('nolimit')){_0x518afb[_0xd18b('0x1a')]=qs[_0xd18b('0x1a')](_0x3757eb[_0xd18b('0x30')][_0xd18b('0x1a')]);_0x518afb[_0xd18b('0x1c')]=qs[_0xd18b('0x1c')](_0x3757eb[_0xd18b('0x30')]['offset']);}_0x518afb[_0xd18b('0x38')]=qs['sort'](_0x3757eb[_0xd18b('0x30')][_0xd18b('0x39')]);_0x518afb[_0xd18b('0x3a')]=qs[_0xd18b('0x32')](_[_0xd18b('0x3b')](_0x3757eb['query'],_0x100c6c[_0xd18b('0x32')]),_0x304503);if(_0x3757eb[_0xd18b('0x30')][_0xd18b('0x3c')]){_0x518afb[_0xd18b('0x3a')]=_[_0xd18b('0x3d')](_0x518afb[_0xd18b('0x3a')],{'$or':_[_0xd18b('0x2c')](_0x304503,function(_0xa303d){if(_0xa303d[_0xd18b('0x3e')]!=='VIRTUAL'){var _0x13ddf4={};_0x13ddf4[_0xa303d['name']]={'$like':'%'+_0x3757eb[_0xd18b('0x30')][_0xd18b('0x3c')]+'%'};return _0x13ddf4;}})});}_0x518afb=_[_0xd18b('0x3d')]({},_0x518afb,_0x3757eb[_0xd18b('0x3f')]);var _0x308e01={'where':_0x518afb[_0xd18b('0x3a')]};return db[_0xd18b('0x2d')][_0xd18b('0x1b')](_0x308e01)[_0xd18b('0x23')](function(_0x2294d7){_0x16b81d[_0xd18b('0x1b')]=_0x2294d7;if(_0x3757eb[_0xd18b('0x30')][_0xd18b('0x40')]){_0x518afb[_0xd18b('0x41')]=[{'all':!![]}];}return db[_0xd18b('0x2d')][_0xd18b('0x42')](_0x518afb);})['then'](function(_0x495f94){_0x16b81d['rows']=_0x495f94;return _0x16b81d;})[_0xd18b('0x23')](respondWithFilteredResult(_0x597433,_0x518afb))[_0xd18b('0x43')](handleError(_0x597433,null));};exports['show']=function(_0x5e7a1a,_0x179f18){var _0x3eea0a={'raw':!![],'where':{'id':_0x5e7a1a[_0xd18b('0x44')]['id']}},_0x484f29={};_0x484f29[_0xd18b('0x2f')]=_[_0xd18b('0x31')](db[_0xd18b('0x2d')][_0xd18b('0x45')]);_0x484f29[_0xd18b('0x30')]=_[_0xd18b('0x31')](_0x5e7a1a[_0xd18b('0x30')]);_0x484f29['filters']=_['intersection'](_0x484f29[_0xd18b('0x2f')],_0x484f29[_0xd18b('0x30')]);_0x3eea0a[_0xd18b('0x34')]=_['intersection'](_0x484f29['model'],qs[_0xd18b('0x35')](_0x5e7a1a['query'][_0xd18b('0x35')]));_0x3eea0a[_0xd18b('0x34')]=_0x3eea0a[_0xd18b('0x34')][_0xd18b('0x36')]?_0x3eea0a[_0xd18b('0x34')]:_0x484f29['model'];if(_0x5e7a1a[_0xd18b('0x30')][_0xd18b('0x40')]){_0x3eea0a[_0xd18b('0x41')]=[{'all':!![]}];}_0x3eea0a=_[_0xd18b('0x3d')]({},_0x3eea0a,_0x5e7a1a[_0xd18b('0x3f')]);return db['Variable'][_0xd18b('0x46')](_0x3eea0a)['then'](handleEntityNotFound(_0x179f18,null))['then'](respondWithResult(_0x179f18,null))[_0xd18b('0x43')](handleError(_0x179f18,null));};exports[_0xd18b('0x47')]=function(_0x3b08a3,_0x12a1f4){return db['Variable'][_0xd18b('0x47')](_0x3b08a3[_0xd18b('0x48')],{})[_0xd18b('0x23')](function(_0x2d0c40){var _0x3205a7=_0x3b08a3[_0xd18b('0x49')]['get']({'plain':!![]});if(!_0x3205a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3205a7[_0xd18b('0x4a')]===_0xd18b('0x49')){var _0x2602d7=_0x2d0c40['get']({'plain':!![]});var _0x2491b4='Variables';return db[_0xd18b('0x4b')][_0xd18b('0x46')]({'where':{'name':_0x2491b4,'userProfileId':_0x3205a7['userProfileId']},'raw':!![]})[_0xd18b('0x23')](function(_0x390b9e){if(_0x390b9e&&_0x390b9e[_0xd18b('0x4c')]===0x0){return db[_0xd18b('0x26')][_0xd18b('0x47')]({'name':_0x2602d7[_0xd18b('0x29')],'resourceId':_0x2602d7['id'],'type':_0x390b9e['name'],'sectionId':_0x390b9e['id']},{})['then'](function(){return _0x2d0c40;});}else{return _0x2d0c40;}})[_0xd18b('0x43')](function(_0x1e303c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e303c);throw _0x1e303c;});}return _0x2d0c40;})[_0xd18b('0x23')](respondWithResult(_0x12a1f4,0xc9))[_0xd18b('0x43')](handleError(_0x12a1f4,null));};exports[_0xd18b('0x21')]=function(_0x3022be,_0x50757b){if(_0x3022be[_0xd18b('0x48')]['id']){delete _0x3022be[_0xd18b('0x48')]['id'];}return db[_0xd18b('0x2d')][_0xd18b('0x46')]({'where':{'id':_0x3022be[_0xd18b('0x44')]['id']}})[_0xd18b('0x23')](handleEntityNotFound(_0x50757b,null))[_0xd18b('0x23')](saveUpdates(_0x3022be[_0xd18b('0x48')],null))[_0xd18b('0x23')](respondWithResult(_0x50757b,null))[_0xd18b('0x43')](handleError(_0x50757b,null));};exports[_0xd18b('0x22')]=function(_0x391e7f,_0x2914be){return db[_0xd18b('0x2d')]['find']({'where':{'id':_0x391e7f[_0xd18b('0x44')]['id']}})[_0xd18b('0x23')](handleEntityNotFound(_0x2914be,null))[_0xd18b('0x23')](removeEntity(_0x2914be,null))[_0xd18b('0x43')](handleError(_0x2914be,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 7ac01d0..483e254 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 _0x8873=['path','rimraf','../../config/environment','exports','Variable','tools_variables','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x8873,0x17a));var _0x3887=function(_0x485f35,_0x45a0fc){_0x485f35=_0x485f35-0x0;var _0x2ad118=_0x8873[_0x485f35];return _0x2ad118;};'use strict';var _=require('lodash');var util=require(_0x3887('0x0'));var logger=require(_0x3887('0x1'))(_0x3887('0x2'));var moment=require(_0x3887('0x3'));var BPromise=require(_0x3887('0x4'));var rp=require(_0x3887('0x5'));var fs=require('fs');var path=require(_0x3887('0x6'));var rimraf=require(_0x3887('0x7'));var config=require(_0x3887('0x8'));var attributes=require('./variable.attributes');module[_0x3887('0x9')]=function(_0x1be341,_0x70bd0a){return _0x1be341['define'](_0x3887('0xa'),attributes,{'tableName':_0x3887('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef80=['../../config/logger','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0xef80,0x175));var _0x0ef8=function(_0x5f12fd,_0x33c70d){_0x5f12fd=_0x5f12fd-0x0;var _0x58bd80=_0xef80[_0x5f12fd];return _0x58bd80;};'use strict';var _=require(_0x0ef8('0x0'));var util=require('util');var logger=require(_0x0ef8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0ef8('0x2'));var rp=require(_0x0ef8('0x3'));var fs=require('fs');var path=require(_0x0ef8('0x4'));var rimraf=require('rimraf');var config=require(_0x0ef8('0x5'));var attributes=require(_0x0ef8('0x6'));module[_0x0ef8('0x7')]=function(_0x1d4bfd,_0x5f0a63){return _0x1d4bfd[_0x0ef8('0x8')](_0x0ef8('0x9'),attributes,{'tableName':_0x0ef8('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 edcfb3e..6de66f1 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 _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0xe011f3,_0x5552b7){var _0x565d37=function(_0x2d5e06){while(--_0x2d5e06){_0xe011f3['push'](_0xe011f3['shift']());}};_0x565d37(++_0x5552b7);}(_0x6aa7,0x178));var _0x76aa=function(_0x868fd5,_0x2547b8){_0x868fd5=_0x868fd5-0x0;var _0x45d1eb=_0x6aa7[_0x868fd5];return _0x45d1eb;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x4db081,_0xd3b834){var _0x3aa22e=function(_0x4fe5cc){while(--_0x4fe5cc){_0x4db081['push'](_0x4db081['shift']());}};_0x3aa22e(++_0xd3b834);}(_0x814b,0x1a2));var _0xb814=function(_0x11b4fb,_0x10c784){_0x11b4fb=_0x11b4fb-0x0;var _0x56cbb5=_0x814b[_0x11b4fb];return _0x56cbb5;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 5096dbf..3ab08b1 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 _0xaa24=['../../components/auth/service','./version.controller','get','index','canUpdate','fetch','isAuthenticated','reset','pull','/restart','restart','/migrations','migrations','exports','Router'];(function(_0x27a887,_0x562706){var _0x15eb32=function(_0x5f8a8d){while(--_0x5f8a8d){_0x27a887['push'](_0x27a887['shift']());}};_0x15eb32(++_0x562706);}(_0xaa24,0x86));var _0x4aa2=function(_0x381360,_0x1d2eff){_0x381360=_0x381360-0x0;var _0x53a472=_0xaa24[_0x381360];return _0x53a472;};'use strict';var express=require('express');var router=express[_0x4aa2('0x0')]();var auth=require(_0x4aa2('0x1'));var controller=require(_0x4aa2('0x2'));router[_0x4aa2('0x3')]('/',controller[_0x4aa2('0x4')]);router[_0x4aa2('0x3')]('/fetch',auth['isAuthenticated'](),auth[_0x4aa2('0x5')](),controller[_0x4aa2('0x6')]);router['get']('/reset',auth[_0x4aa2('0x7')](),auth[_0x4aa2('0x5')](),controller[_0x4aa2('0x8')]);router[_0x4aa2('0x3')]('/pull',auth[_0x4aa2('0x7')](),auth[_0x4aa2('0x5')](),controller[_0x4aa2('0x9')]);router[_0x4aa2('0x3')](_0x4aa2('0xa'),auth[_0x4aa2('0x7')](),controller[_0x4aa2('0xb')]);router[_0x4aa2('0x3')](_0x4aa2('0xc'),controller[_0x4aa2('0xd')]);module[_0x4aa2('0xe')]=router; \ No newline at end of file +var _0xf50a=['pull','/restart','restart','/migrations','exports','index','get','/fetch','isAuthenticated','fetch','/reset','canUpdate','/pull'];(function(_0x4a4d8e,_0x22a7a9){var _0x1a5cb4=function(_0xdcf2eb){while(--_0xdcf2eb){_0x4a4d8e['push'](_0x4a4d8e['shift']());}};_0x1a5cb4(++_0x22a7a9);}(_0xf50a,0x18b));var _0xaf50=function(_0x5a3ee9,_0x11ed55){_0x5a3ee9=_0x5a3ee9-0x0;var _0x45032c=_0xf50a[_0x5a3ee9];return _0x45032c;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./version.controller');router['get']('/',controller[_0xaf50('0x0')]);router[_0xaf50('0x1')](_0xaf50('0x2'),auth[_0xaf50('0x3')](),auth['canUpdate'](),controller[_0xaf50('0x4')]);router[_0xaf50('0x1')](_0xaf50('0x5'),auth[_0xaf50('0x3')](),auth[_0xaf50('0x6')](),controller['reset']);router[_0xaf50('0x1')](_0xaf50('0x7'),auth[_0xaf50('0x3')](),auth['canUpdate'](),controller[_0xaf50('0x8')]);router['get'](_0xaf50('0x9'),auth[_0xaf50('0x3')](),controller[_0xaf50('0xa')]);router[_0xaf50('0x1')](_0xaf50('0xb'),controller['migrations']);module[_0xaf50('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 337ced5..d4ba3f8 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 _0x7636=['sequelize','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','join','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','child_process','exec','../../config/pm2','../../config/logger','simple-git','root','version','query','latest','tags','exports','status','json','fetch','origin','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','.js','push','length'];(function(_0x1306f3,_0x1da761){var _0xc1c7bf=function(_0x1ca08e){while(--_0x1ca08e){_0x1306f3['push'](_0x1306f3['shift']());}};_0xc1c7bf(++_0x1da761);}(_0x7636,0xce));var _0x6763=function(_0x5454e2,_0x576f66){_0x5454e2=_0x5454e2-0x0;var _0x5b9409=_0x7636[_0x5454e2];return _0x5b9409;};'use strict';var Umzug=require(_0x6763('0x0'));var path=require(_0x6763('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x6763('0x2'))(module,'version');var compareVersions=require(_0x6763('0x3'));var exec=require(_0x6763('0x4'))[_0x6763('0x5')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0x6763('0x6'));var logger=require(_0x6763('0x7'))('update');var git=require(_0x6763('0x8'))(config[_0x6763('0x9')]);exports['index']=function(_0x3c3893,_0x3f40a0){var _0x2ab461={'current':module['exports'][_0x6763('0xa')],'phonebar':0x2};if(_0x3c3893[_0x6763('0xb')]&&_0x3c3893[_0x6763('0xb')][_0x6763('0xc')]){return git['fetch']()[_0x6763('0xd')](function(_0x561145,_0x3c9482){_0x2ab461[_0x6763('0xc')]=(_0x561145?module[_0x6763('0xe')]['version']:_0x3c9482[_0x6763('0xc')])||'2.0.0';return _0x3f40a0[_0x6763('0xf')](0xc8)[_0x6763('0x10')](_0x2ab461);});}else{return _0x3f40a0[_0x6763('0xf')](0xc8)[_0x6763('0x10')](_0x2ab461);}};exports[_0x6763('0x11')]=function(_0x323f52,_0x116608){return git[_0x6763('0x11')]([_0x6763('0x12'),'master'],function(_0x4670cb){if(_0x4670cb){logger[_0x6763('0x13')](_0x4670cb);return _0x116608['status'](0x1f4)['json'](_0x4670cb);}logger[_0x6763('0x14')](_0x6763('0x15'));return _0x116608['status'](0xc8)['json']({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x6763('0x16')]=function(_0x563a36,_0x51b814){return git[_0x6763('0x16')]([_0x6763('0x17'),_0x6763('0x18')],function(_0xb481f8){if(_0xb481f8){logger[_0x6763('0x13')](_0xb481f8);return _0x51b814[_0x6763('0xf')](0x1f4)['json'](_0xb481f8);}logger[_0x6763('0x14')](_0x6763('0x19'));return _0x51b814['status'](0xc8)['json']({'output':_0x6763('0x1a')});});};exports[_0x6763('0x1b')]=function(_0x5f0268,_0x39c81b){exec('npm\x20install\x20--production',function(_0x5ce4a4,_0x523f85,_0x193649){logger[_0x6763('0x14')](_0x523f85);logger[_0x6763('0x14')](_0x193649);if(_0x5ce4a4){logger[_0x6763('0x13')](_0x5ce4a4);return _0x39c81b[_0x6763('0xf')](0x1f4)[_0x6763('0x10')](_0x5ce4a4);}return _0x39c81b[_0x6763('0xf')](0xc8)[_0x6763('0x10')]({'output':_0x523f85});});};exports[_0x6763('0x1c')]=function(_0x8ad8b4,_0x5a2ca9){return pm2[_0x6763('0x1c')]('motion2')[_0x6763('0x1d')](function(_0x695463){logger[_0x6763('0x14')](_0x6763('0x1e'),_0x695463);return _0x5a2ca9[_0x6763('0xf')](0xc8)['json']({'output':_0x6763('0x1f')});})[_0x6763('0x20')](function(_0x2c65d2){logger[_0x6763('0x13')](_0x2c65d2);return _0x5a2ca9[_0x6763('0xf')](0x1f4)['json'](_0x2c65d2);});};exports[_0x6763('0x21')]=function(_0xa8e52d,_0x40f5b0){var _0x5a5f83=fs[_0x6763('0x22')](path['join'](config[_0x6763('0x9')],_0x6763('0x23'),'migrations'));var _0x20ae04=[];for(var _0x4dfbe3=0x0;_0x4dfbe3<_0x5a5f83['length'];_0x4dfbe3++){var _0xc93c58=_0x5a5f83[_0x4dfbe3]['replace'](_0x6763('0x24'),'');if(compareVersions(module[_0x6763('0xe')][_0x6763('0xa')],_0xc93c58)===-0x1){_0x20ae04[_0x6763('0x25')](_0xc93c58);}}if(_0x20ae04[_0x6763('0x26')]){var _0x4ce21d=_0x20ae04['sort'](compareVersions);var _0x508295=new Umzug({'storage':_0x6763('0x27'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x6763('0xa')},'migrations':{'params':[db[_0x6763('0x27')][_0x6763('0x28')](),db['sequelize'][_0x6763('0x29')],function(){throw new Error(_0x6763('0x2a'));}],'path':path['join'](config[_0x6763('0x9')],_0x6763('0x23'),_0x6763('0x21')),'pattern':/\.js$/}});_0x508295['up']({'migrations':_[_0x6763('0x2b')](_0x4ce21d,function(_0x84c4c){return _0x84c4c+_0x6763('0x24');})})[_0x6763('0x1d')](function(){return _0x40f5b0[_0x6763('0xf')](0xc8)[_0x6763('0x10')]({'output':_0x6763('0x2c')+module[_0x6763('0xe')][_0x6763('0xa')]+_0x6763('0x2d')+_[_0x6763('0x2e')](_0x4ce21d),'migrations':_[_0x6763('0x2f')](_0x4ce21d)});})[_0x6763('0x20')](function(_0x45a43a){if(_0x45a43a instanceof db[_0x6763('0x27')]['UniqueConstraintError']){return _0x40f5b0[_0x6763('0xf')](0xc8)['json']({'output':_0x6763('0x30')});}else{return _0x40f5b0[_0x6763('0xf')](0x1f4)[_0x6763('0x10')](_0x45a43a);}});}else{return _0x40f5b0[_0x6763('0xf')](0xc8)[_0x6763('0x10')]({'output':_0x6763('0x30')});}}; \ No newline at end of file +var _0x5b7a=['exports','query','latest','fetch','2.0.0','json','master','error','status','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','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','join','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.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/logger','update','simple-git','root'];(function(_0x130777,_0x241c02){var _0x2a45d6=function(_0x50bae9){while(--_0x50bae9){_0x130777['push'](_0x130777['shift']());}};_0x2a45d6(++_0x241c02);}(_0x5b7a,0x160));var _0xa5b7=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x5b7a[_0x88cd7b];return _0x56fcc8;};'use strict';var Umzug=require(_0xa5b7('0x0'));var path=require(_0xa5b7('0x1'));var fs=require('fs');var _=require(_0xa5b7('0x2'));var pkginfo=require(_0xa5b7('0x3'))(module,_0xa5b7('0x4'));var compareVersions=require(_0xa5b7('0x5'));var exec=require(_0xa5b7('0x6'))[_0xa5b7('0x7')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require(_0xa5b7('0x8'))(_0xa5b7('0x9'));var git=require(_0xa5b7('0xa'))(config[_0xa5b7('0xb')]);exports['index']=function(_0x51207f,_0x3e45be){var _0x5f4b24={'current':module[_0xa5b7('0xc')][_0xa5b7('0x4')],'phonebar':0x2};if(_0x51207f[_0xa5b7('0xd')]&&_0x51207f[_0xa5b7('0xd')][_0xa5b7('0xe')]){return git[_0xa5b7('0xf')]()['tags'](function(_0x1eefc8,_0x4879b9){_0x5f4b24[_0xa5b7('0xe')]=(_0x1eefc8?module[_0xa5b7('0xc')][_0xa5b7('0x4')]:_0x4879b9[_0xa5b7('0xe')])||_0xa5b7('0x10');return _0x3e45be['status'](0xc8)['json'](_0x5f4b24);});}else{return _0x3e45be['status'](0xc8)[_0xa5b7('0x11')](_0x5f4b24);}};exports[_0xa5b7('0xf')]=function(_0x4c49fb,_0x314a9c){return git['fetch'](['origin',_0xa5b7('0x12')],function(_0x33d27e){if(_0x33d27e){logger[_0xa5b7('0x13')](_0x33d27e);return _0x314a9c[_0xa5b7('0x14')](0x1f4)[_0xa5b7('0x11')](_0x33d27e);}logger[_0xa5b7('0x15')](_0xa5b7('0x16'));return _0x314a9c[_0xa5b7('0x14')](0xc8)[_0xa5b7('0x11')]({'output':_0xa5b7('0x17')});});};exports[_0xa5b7('0x18')]=function(_0x4cc725,_0x221cc3){return git[_0xa5b7('0x18')]([_0xa5b7('0x19'),_0xa5b7('0x1a')],function(_0x149e36){if(_0x149e36){logger[_0xa5b7('0x13')](_0x149e36);return _0x221cc3['status'](0x1f4)[_0xa5b7('0x11')](_0x149e36);}logger[_0xa5b7('0x15')](_0xa5b7('0x1b'));return _0x221cc3[_0xa5b7('0x14')](0xc8)['json']({'output':_0xa5b7('0x1c')});});};exports[_0xa5b7('0x1d')]=function(_0x4c97c0,_0x3032db){exec(_0xa5b7('0x1e'),function(_0x17db35,_0x4fd520,_0x5e87c7){logger[_0xa5b7('0x15')](_0x4fd520);logger[_0xa5b7('0x15')](_0x5e87c7);if(_0x17db35){logger[_0xa5b7('0x13')](_0x17db35);return _0x3032db[_0xa5b7('0x14')](0x1f4)['json'](_0x17db35);}return _0x3032db[_0xa5b7('0x14')](0xc8)[_0xa5b7('0x11')]({'output':_0x4fd520});});};exports[_0xa5b7('0x1f')]=function(_0x2bca53,_0x490959){return pm2[_0xa5b7('0x1f')](_0xa5b7('0x20'))[_0xa5b7('0x21')](function(_0x35aebd){logger[_0xa5b7('0x15')](_0xa5b7('0x22'),_0x35aebd);return _0x490959['status'](0xc8)[_0xa5b7('0x11')]({'output':_0xa5b7('0x23')});})[_0xa5b7('0x24')](function(_0x3dfb7f){logger[_0xa5b7('0x13')](_0x3dfb7f);return _0x490959[_0xa5b7('0x14')](0x1f4)[_0xa5b7('0x11')](_0x3dfb7f);});};exports[_0xa5b7('0x25')]=function(_0x24c1aa,_0xe25d06){var _0x13f38b=fs['readdirSync'](path[_0xa5b7('0x26')](config['root'],'server',_0xa5b7('0x25')));var _0x722aec=[];for(var _0x845a91=0x0;_0x845a91<_0x13f38b[_0xa5b7('0x27')];_0x845a91++){var _0x59bba1=_0x13f38b[_0x845a91][_0xa5b7('0x28')](_0xa5b7('0x29'),'');if(compareVersions(module[_0xa5b7('0xc')][_0xa5b7('0x4')],_0x59bba1)===-0x1){_0x722aec['push'](_0x59bba1);}}if(_0x722aec[_0xa5b7('0x27')]){var _0x1b2a4a=_0x722aec[_0xa5b7('0x2a')](compareVersions);var _0x25ffba=new Umzug({'storage':_0xa5b7('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':_0xa5b7('0x2c'),'columnName':_0xa5b7('0x4')},'migrations':{'params':[db[_0xa5b7('0x2b')][_0xa5b7('0x2d')](),db[_0xa5b7('0x2b')][_0xa5b7('0x2e')],function(){throw new Error(_0xa5b7('0x2f'));}],'path':path[_0xa5b7('0x26')](config['root'],_0xa5b7('0x30'),_0xa5b7('0x25')),'pattern':/\.js$/}});_0x25ffba['up']({'migrations':_[_0xa5b7('0x31')](_0x1b2a4a,function(_0xb2c8f8){return _0xb2c8f8+_0xa5b7('0x29');})})[_0xa5b7('0x21')](function(){return _0xe25d06['status'](0xc8)[_0xa5b7('0x11')]({'output':_0xa5b7('0x32')+module[_0xa5b7('0xc')][_0xa5b7('0x4')]+'\x20to\x20'+_['last'](_0x1b2a4a),'migrations':_[_0xa5b7('0x26')](_0x1b2a4a)});})[_0xa5b7('0x24')](function(_0x5340b7){if(_0x5340b7 instanceof db[_0xa5b7('0x2b')]['UniqueConstraintError']){return _0xe25d06['status'](0xc8)['json']({'output':_0xa5b7('0x33')});}else{return _0xe25d06['status'](0x1f4)['json'](_0x5340b7);}});}else{return _0xe25d06[_0xa5b7('0x14')](0xc8)[_0xa5b7('0x11')]({'output':_0xa5b7('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 80d6cb1..59f498c 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 _0x35e6=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x425342,_0x1a39bc){var _0x6cd14b=function(_0x4cb6e3){while(--_0x4cb6e3){_0x425342['push'](_0x425342['shift']());}};_0x6cd14b(++_0x1a39bc);}(_0x35e6,0x179));var _0x635e=function(_0x44cc5c,_0x40ef3e){_0x44cc5c=_0x44cc5c-0x0;var _0x52b91c=_0x35e6[_0x44cc5c];return _0x52b91c;};'use strict';var multer=require(_0x635e('0x0'));var util=require(_0x635e('0x1'));var path=require('path');var timeout=require(_0x635e('0x2'));var express=require('express');var router=express[_0x635e('0x3')]();var fs_extra=require(_0x635e('0x4'));var auth=require(_0x635e('0x5'));var interaction=require(_0x635e('0x6'));var config=require(_0x635e('0x7'));var controller=require(_0x635e('0x8'));router[_0x635e('0x9')]('/',auth[_0x635e('0xa')](),controller[_0x635e('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x635e('0xc')]);router['get'](_0x635e('0xd'),auth['isAuthenticated'](),controller[_0x635e('0xe')]);router[_0x635e('0xf')]('/',auth['isAuthenticated'](),controller[_0x635e('0x10')]);router[_0x635e('0x11')](_0x635e('0xd'),auth[_0x635e('0xa')](),controller[_0x635e('0x12')]);router[_0x635e('0x13')](_0x635e('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x635e('0x14')]=router; \ No newline at end of file +var _0x2870=['fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x5342eb,_0x425e62){var _0x57abcb=function(_0x35c4ff){while(--_0x35c4ff){_0x5342eb['push'](_0x5342eb['shift']());}};_0x57abcb(++_0x425e62);}(_0x2870,0x1e9));var _0x0287=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0x2870[_0x5e8c32];return _0x595f7b;};'use strict';var multer=require(_0x0287('0x0'));var util=require(_0x0287('0x1'));var path=require(_0x0287('0x2'));var timeout=require(_0x0287('0x3'));var express=require('express');var router=express[_0x0287('0x4')]();var fs_extra=require(_0x0287('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0287('0x6'));var config=require(_0x0287('0x7'));var controller=require(_0x0287('0x8'));router[_0x0287('0x9')]('/',auth[_0x0287('0xa')](),controller[_0x0287('0xb')]);router['get']('/describe',auth[_0x0287('0xa')](),controller['describe']);router[_0x0287('0x9')](_0x0287('0xc'),auth[_0x0287('0xa')](),controller['show']);router[_0x0287('0xd')]('/',auth[_0x0287('0xa')](),controller['create']);router[_0x0287('0xe')](_0x0287('0xc'),auth['isAuthenticated'](),controller[_0x0287('0xf')]);router[_0x0287('0x10')](_0x0287('0xc'),auth[_0x0287('0xa')](),controller[_0x0287('0x11')]);module[_0x0287('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 2b5caee..990b118 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 _0x1399=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x3d6e4c,_0x8879a2){var _0x42a887=function(_0x32ce16){while(--_0x32ce16){_0x3d6e4c['push'](_0x3d6e4c['shift']());}};_0x42a887(++_0x8879a2);}(_0x1399,0x16c));var _0x9139=function(_0x2af276,_0xb15ec5){_0x2af276=_0x2af276-0x0;var _0x4c586e=_0x1399[_0x2af276];return _0x4c586e;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9139('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9139('0x2')]},'queue':{'type':Sequelize[_0x9139('0x2')]},'interface':{'type':Sequelize[_0x9139('0x2')]},'membername':{'type':Sequelize[_0x9139('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9139('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9139('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x9139('0x3')]},'holdtime':{'type':Sequelize[_0x9139('0x4')]},'agentcomplete':{'type':Sequelize[_0x9139('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x9139('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9139('0x4')]},'reason':{'type':Sequelize[_0x9139('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x9139('0x2')]},'channelstate':{'type':Sequelize[_0x9139('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x9139('0x2')]},'language':{'type':Sequelize[_0x9139('0x2')]},'accountcode':{'type':Sequelize[_0x9139('0x2')]},'context':{'type':Sequelize[_0x9139('0x2')]},'exten':{'type':Sequelize[_0x9139('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x9139('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9139('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9139('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9139('0x2')]},'destlanguage':{'type':Sequelize[_0x9139('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9139('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x9139('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x9139('0x2')]},'transfer':{'type':Sequelize[_0x9139('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9139('0x2')],'comment':_0x9139('0x6')},'transferexten':{'type':Sequelize[_0x9139('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcd6f=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x344adc,_0x183c37){var _0x4014b2=function(_0xe809e5){while(--_0xe809e5){_0x344adc['push'](_0x344adc['shift']());}};_0x4014b2(++_0x183c37);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x27b9f4,_0x31657b){_0x27b9f4=_0x27b9f4-0x0;var _0x553b26=_0xcd6f[_0x27b9f4];return _0x553b26;};'use strict';var Sequelize=require(_0xfcd6('0x0'));module[_0xfcd6('0x1')]={'type':{'type':Sequelize[_0xfcd6('0x2')]},'uniqueid':{'type':Sequelize[_0xfcd6('0x2')]},'calleridnum':{'type':Sequelize[_0xfcd6('0x2')]},'calleridname':{'type':Sequelize[_0xfcd6('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xfcd6('0x2')]},'membername':{'type':Sequelize[_0xfcd6('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xfcd6('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xfcd6('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xfcd6('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfcd6('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xfcd6('0x2')]},'accountcode':{'type':Sequelize[_0xfcd6('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xfcd6('0x2')]},'priority':{'type':Sequelize[_0xfcd6('0x2')]},'destchannel':{'type':Sequelize[_0xfcd6('0x2')]},'destchannelstate':{'type':Sequelize[_0xfcd6('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xfcd6('0x2')]},'destcalleridnum':{'type':Sequelize[_0xfcd6('0x2')]},'destcalleridname':{'type':Sequelize[_0xfcd6('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfcd6('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xfcd6('0x2')]},'destlanguage':{'type':Sequelize[_0xfcd6('0x2')]},'destaccountcode':{'type':Sequelize[_0xfcd6('0x2')]},'destcontext':{'type':Sequelize[_0xfcd6('0x2')]},'destexten':{'type':Sequelize[_0xfcd6('0x2')]},'destpriority':{'type':Sequelize[_0xfcd6('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xfcd6('0x2')]},'transfer':{'type':Sequelize[_0xfcd6('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xfcd6('0x6')},'transferexten':{'type':Sequelize[_0xfcd6('0x2')]},'transferuniqueid':{'type':Sequelize[_0xfcd6('0x2')]},'agententerreason':{'type':Sequelize[_0xfcd6('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 58e5b4f..9025d27 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(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 d50cca7..c43d5d1 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 _0xcb81=['define','report_agent','uniqueid','destuniqueid','lodash','util','api','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xcb81,0x154));var _0x1cb8=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0xcb81[_0x255ac0];return _0x437bf1;};'use strict';var _=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var logger=require('../../config/logger')(_0x1cb8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb8('0x3'));var rimraf=require(_0x1cb8('0x4'));var config=require(_0x1cb8('0x5'));var attributes=require(_0x1cb8('0x6'));module[_0x1cb8('0x7')]=function(_0x4e5c19,_0x98d682){return _0x4e5c19[_0x1cb8('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x1cb8('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1cb8('0xa'),_0x1cb8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6bdc=['define','VoiceAgentReport','report_agent','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x28ccff,_0x97ded8){var _0x5c9c8d=function(_0x53359f){while(--_0x53359f){_0x28ccff['push'](_0x28ccff['shift']());}};_0x5c9c8d(++_0x97ded8);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x179dad,_0x137e84){_0x179dad=_0x179dad-0x0;var _0x27f370=_0x6bdc[_0x179dad];return _0x27f370;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var logger=require(_0xc6bd('0x2'))(_0xc6bd('0x3'));var moment=require(_0xc6bd('0x4'));var BPromise=require(_0xc6bd('0x5'));var rp=require(_0xc6bd('0x6'));var fs=require('fs');var path=require(_0xc6bd('0x7'));var rimraf=require(_0xc6bd('0x8'));var config=require(_0xc6bd('0x9'));var attributes=require('./voiceAgentReport.attributes');module[_0xc6bd('0xa')]=function(_0x26218a,_0x158271){return _0x26218a[_0xc6bd('0xb')](_0xc6bd('0xc'),attributes,{'tableName':_0xc6bd('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0xc6bd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 515f00a..e274437 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 _0x18bf=['update','options','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','raw','catch','UpdateVoiceAgentReport'];(function(_0x3d8d0a,_0x11bb87){var _0x5b9df5=function(_0x3ecba2){while(--_0x3ecba2){_0x3d8d0a['push'](_0x3d8d0a['shift']());}};_0x5b9df5(++_0x11bb87);}(_0x18bf,0x8c));var _0xf18b=function(_0x411c60,_0x32c701){_0x411c60=_0x411c60-0x0;var _0x59b3d3=_0x18bf[_0x411c60];return _0x59b3d3;};'use strict';var _=require(_0xf18b('0x0'));var util=require(_0xf18b('0x1'));var moment=require(_0xf18b('0x2'));var BPromise=require('bluebird');var rs=require(_0xf18b('0x3'));var fs=require('fs');var Redis=require(_0xf18b('0x4'));var db=require(_0xf18b('0x5'))['db'];var utils=require(_0xf18b('0x6'));var logger=require('../../config/logger')(_0xf18b('0x7'));var config=require(_0xf18b('0x8'));var jayson=require(_0xf18b('0x9'));var client=jayson[_0xf18b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ef14b,_0x1c31cf,_0x3a5929){return new BPromise(function(_0x329513,_0x2966b4){return client[_0xf18b('0xb')](_0x3ef14b,_0x3a5929)[_0xf18b('0xc')](function(_0x490a59){logger[_0xf18b('0xd')](_0xf18b('0xe'),_0x1c31cf,'request\x20sent');logger[_0xf18b('0xf')](_0xf18b('0x10'),_0x1c31cf,_0xf18b('0x11'),JSON[_0xf18b('0x12')](_0x490a59));if(_0x490a59[_0xf18b('0x13')]){if(_0x490a59[_0xf18b('0x13')][_0xf18b('0x14')]===0x1f4){logger[_0xf18b('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x1c31cf,_0x490a59[_0xf18b('0x13')]['message']);return _0x2966b4(_0x490a59['error'][_0xf18b('0x15')]);}logger[_0xf18b('0x13')](_0xf18b('0xe'),_0x1c31cf,_0x490a59[_0xf18b('0x13')][_0xf18b('0x15')]);return _0x329513(_0x490a59[_0xf18b('0x13')][_0xf18b('0x15')]);}else{logger['info'](_0xf18b('0xe'),_0x1c31cf,_0xf18b('0x11'));_0x329513(_0x490a59[_0xf18b('0x16')][_0xf18b('0x15')]);}})['catch'](function(_0x187224){logger[_0xf18b('0x13')](_0xf18b('0xe'),_0x1c31cf,_0x187224);_0x2966b4(_0x187224);});});}exports[_0xf18b('0x17')]=function(_0x1500d8){var _0x65fa78=this;return new Promise(function(_0x481c2f,_0x880907){return db[_0xf18b('0x18')][_0xf18b('0x19')](_0x1500d8[_0xf18b('0x1a')],{'raw':_0x1500d8['options']?_0x1500d8['options'][_0xf18b('0x1b')]===undefined?!![]:![]:!![]})[_0xf18b('0xc')](function(_0x49c938){logger[_0xf18b('0xd')](_0xf18b('0x17'),_0x1500d8);logger['debug'](_0xf18b('0x17'),_0x1500d8,JSON[_0xf18b('0x12')](_0x49c938));_0x481c2f(_0x49c938);})[_0xf18b('0x1c')](function(_0x2e29da){logger[_0xf18b('0x13')](_0xf18b('0x17'),_0x2e29da[_0xf18b('0x15')],_0x1500d8);_0x880907(_0x65fa78['error'](0x1f4,_0x2e29da[_0xf18b('0x15')]));});});};exports[_0xf18b('0x1d')]=function(_0x3f1785){var _0x1d4a18=this;return new Promise(function(_0xc18458,_0x145b41){return db[_0xf18b('0x18')][_0xf18b('0x1e')](_0x3f1785[_0xf18b('0x1a')],{'raw':_0x3f1785[_0xf18b('0x1f')]?_0x3f1785[_0xf18b('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f1785[_0xf18b('0x1f')]?_0x3f1785[_0xf18b('0x1f')][_0xf18b('0x20')]||null:null,'attributes':_0x3f1785[_0xf18b('0x1f')]?_0x3f1785[_0xf18b('0x1f')][_0xf18b('0x21')]||null:null,'limit':_0x3f1785[_0xf18b('0x1f')]?_0x3f1785['options']['limit']||null:null})['then'](function(_0x26d969){logger[_0xf18b('0xd')]('UpdateVoiceAgentReport',_0x3f1785);logger[_0xf18b('0xf')]('UpdateVoiceAgentReport',_0x3f1785,JSON['stringify'](_0x26d969));_0xc18458(_0x26d969);})[_0xf18b('0x1c')](function(_0x51a0ed){logger[_0xf18b('0x13')](_0xf18b('0x1d'),_0x51a0ed[_0xf18b('0x15')],_0x3f1785);_0x145b41(_0x1d4a18[_0xf18b('0x13')](0x1f4,_0x51a0ed[_0xf18b('0x15')]));});});}; \ No newline at end of file +var _0x30e9=['info','result','catch','VoiceAgentReport','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5391ef,_0x3c8788){var _0x136499=function(_0x4d80a5){while(--_0x4d80a5){_0x5391ef['push'](_0x5391ef['shift']());}};_0x136499(++_0x3c8788);}(_0x30e9,0x70));var _0x930e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x30e9[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require(_0x930e('0x0'));var moment=require(_0x930e('0x1'));var BPromise=require(_0x930e('0x2'));var rs=require(_0x930e('0x3'));var fs=require('fs');var Redis=require(_0x930e('0x4'));var db=require(_0x930e('0x5'))['db'];var utils=require(_0x930e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x930e('0x7'));var jayson=require(_0x930e('0x8'));var client=jayson[_0x930e('0x9')][_0x930e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a2dff,_0xf1cb05,_0x561a00){return new BPromise(function(_0x37612b,_0x25b12e){return client['request'](_0x2a2dff,_0x561a00)[_0x930e('0xb')](function(_0x12e75b){logger['info'](_0x930e('0xc'),_0xf1cb05,_0x930e('0xd'));logger[_0x930e('0xe')](_0x930e('0xf'),_0xf1cb05,_0x930e('0xd'),JSON[_0x930e('0x10')](_0x12e75b));if(_0x12e75b['error']){if(_0x12e75b[_0x930e('0x11')][_0x930e('0x12')]===0x1f4){logger[_0x930e('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0xf1cb05,_0x12e75b[_0x930e('0x11')][_0x930e('0x13')]);return _0x25b12e(_0x12e75b[_0x930e('0x11')]['message']);}logger[_0x930e('0x11')](_0x930e('0xc'),_0xf1cb05,_0x12e75b[_0x930e('0x11')][_0x930e('0x13')]);return _0x37612b(_0x12e75b[_0x930e('0x11')]['message']);}else{logger[_0x930e('0x14')](_0x930e('0xc'),_0xf1cb05,_0x930e('0xd'));_0x37612b(_0x12e75b[_0x930e('0x15')][_0x930e('0x13')]);}})[_0x930e('0x16')](function(_0x5e2fc5){logger[_0x930e('0x11')](_0x930e('0xc'),_0xf1cb05,_0x5e2fc5);_0x25b12e(_0x5e2fc5);});});}exports['CreateVoiceAgentReport']=function(_0x1c12d5){var _0xf2b145=this;return new Promise(function(_0x2d08f6,_0x31e09a){return db[_0x930e('0x17')]['create'](_0x1c12d5[_0x930e('0x18')],{'raw':_0x1c12d5['options']?_0x1c12d5[_0x930e('0x19')][_0x930e('0x1a')]===undefined?!![]:![]:!![]})[_0x930e('0xb')](function(_0x3b3aa2){logger['info'](_0x930e('0x1b'),_0x1c12d5);logger[_0x930e('0xe')](_0x930e('0x1b'),_0x1c12d5,JSON['stringify'](_0x3b3aa2));_0x2d08f6(_0x3b3aa2);})[_0x930e('0x16')](function(_0x358047){logger['error']('CreateVoiceAgentReport',_0x358047['message'],_0x1c12d5);_0x31e09a(_0xf2b145[_0x930e('0x11')](0x1f4,_0x358047[_0x930e('0x13')]));});});};exports[_0x930e('0x1c')]=function(_0xef6e0a){var _0x4ea063=this;return new Promise(function(_0x2a0c65,_0x58fb7a){return db[_0x930e('0x17')][_0x930e('0x1d')](_0xef6e0a[_0x930e('0x18')],{'raw':_0xef6e0a[_0x930e('0x19')]?_0xef6e0a[_0x930e('0x19')][_0x930e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xef6e0a[_0x930e('0x19')]?_0xef6e0a[_0x930e('0x19')][_0x930e('0x1e')]||null:null,'attributes':_0xef6e0a['options']?_0xef6e0a['options'][_0x930e('0x1f')]||null:null,'limit':_0xef6e0a[_0x930e('0x19')]?_0xef6e0a[_0x930e('0x19')][_0x930e('0x20')]||null:null})[_0x930e('0xb')](function(_0x58bd57){logger['info'](_0x930e('0x1c'),_0xef6e0a);logger[_0x930e('0xe')](_0x930e('0x1c'),_0xef6e0a,JSON[_0x930e('0x10')](_0x58bd57));_0x2a0c65(_0x58bd57);})[_0x930e('0x16')](function(_0x6d2f33){logger[_0x930e('0x11')]('UpdateVoiceAgentReport',_0x6d2f33[_0x930e('0x13')],_0xef6e0a);_0x58fb7a(_0x4ea063[_0x930e('0x11')](0x1f4,_0x6d2f33['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 5b5cf88..6af5c6e 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 _0x6f47=['path','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','util'];(function(_0x2f8805,_0x2f1d21){var _0xa16375=function(_0x1c5bcc){while(--_0x1c5bcc){_0x2f8805['push'](_0x2f8805['shift']());}};_0xa16375(++_0x2f1d21);}(_0x6f47,0xc7));var _0x76f4=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x6f47[_0x34bc30];return _0x5706de;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var fs_extra=require(_0x76f4('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x4'));var config=require(_0x76f4('0x5'));var controller=require(_0x76f4('0x6'));router[_0x76f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x76f4('0x8')]);router[_0x76f4('0x7')](_0x76f4('0x9'),auth['isAuthenticated'](),controller[_0x76f4('0xa')]);router[_0x76f4('0x7')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x76f4('0xe')]);router[_0x76f4('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x76f4('0x10')]);router[_0x76f4('0x11')](_0x76f4('0xb'),auth[_0x76f4('0xc')](),controller[_0x76f4('0x12')]);module[_0x76f4('0x13')]=router; \ No newline at end of file +var _0x44e8=['show','post','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x3a07d4,_0xa80b88){var _0x2c352=function(_0x27926b){while(--_0x27926b){_0x3a07d4['push'](_0x3a07d4['shift']());}};_0x2c352(++_0xa80b88);}(_0x44e8,0xd7));var _0x844e=function(_0xe776f5,_0x19f716){_0xe776f5=_0xe776f5-0x0;var _0xec20b3=_0x44e8[_0xe776f5];return _0xec20b3;};'use strict';var multer=require(_0x844e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x844e('0x1'));var express=require(_0x844e('0x2'));var router=express[_0x844e('0x3')]();var fs_extra=require(_0x844e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var controller=require(_0x844e('0x7'));router[_0x844e('0x8')]('/',auth['isAuthenticated'](),controller[_0x844e('0x9')]);router[_0x844e('0x8')](_0x844e('0xa'),auth[_0x844e('0xb')](),controller['describe']);router[_0x844e('0x8')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller[_0x844e('0xd')]);router[_0x844e('0xe')]('/',auth[_0x844e('0xb')](),controller['create']);router[_0x844e('0xf')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller[_0x844e('0x10')]);router[_0x844e('0x11')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller['destroy']);module[_0x844e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index ab6a403..c5e1522 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 _0x866a=['INTEGER','exports','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax','dialer','TEXT','DATE'];(function(_0x28ca12,_0x4e023b){var _0x352f8b=function(_0x1fe854){while(--_0x1fe854){_0x28ca12['push'](_0x28ca12['shift']());}};_0x352f8b(++_0x4e023b);}(_0x866a,0x156));var _0xa866=function(_0x3c4856,_0x98f049){_0x3c4856=_0x3c4856-0x0;var _0xba2cac=_0x866a[_0x3c4856];return _0xba2cac;};'use strict';var Sequelize=require('sequelize');module[_0xa866('0x0')]={'uniqueid':{'type':Sequelize[_0xa866('0x1')]},'type':{'type':Sequelize[_0xa866('0x2')](_0xa866('0x3'),_0xa866('0x4'),'outbound',_0xa866('0x5'),_0xa866('0x6'),_0xa866('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa866('0x1')]},'source':{'type':Sequelize[_0xa866('0x1')]},'destination':{'type':Sequelize[_0xa866('0x1')]},'destinationcontext':{'type':Sequelize[_0xa866('0x1')]},'callerid':{'type':Sequelize[_0xa866('0x1')]},'channel':{'type':Sequelize[_0xa866('0x1')]},'destinationchannel':{'type':Sequelize[_0xa866('0x1')]},'lastapplication':{'type':Sequelize[_0xa866('0x1')]},'lastdata':{'type':Sequelize[_0xa866('0x8')]},'starttime':{'type':Sequelize[_0xa866('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa866('0x9')]},'endtime':{'type':Sequelize[_0xa866('0x9')]},'duration':{'type':Sequelize[_0xa866('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa866('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa866('0x1')]},'amaflags':{'type':Sequelize[_0xa866('0x1')]},'userfield':{'type':Sequelize[_0xa866('0x1')]},'userDisposition':{'type':Sequelize[_0xa866('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xa866('0x1')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa866('0x1')]},'prefix':{'type':Sequelize[_0xa866('0x1')]},'routeid':{'type':Sequelize[_0xa866('0xa')]},'sipcallid':{'type':Sequelize[_0xa866('0x1')]}}; \ No newline at end of file +var _0x46ec=['inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','ENUM','inbound','internal','outbound'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x46ec,0x145));var _0xc46e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x46ec[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc46e('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc46e('0x1')](_0xc46e('0x2'),_0xc46e('0x3'),_0xc46e('0x4'),_0xc46e('0x5'),_0xc46e('0x6'),'dialer')},'tag':{'type':Sequelize[_0xc46e('0x7')]},'accountcode':{'type':Sequelize[_0xc46e('0x7')]},'source':{'type':Sequelize[_0xc46e('0x7')]},'destination':{'type':Sequelize[_0xc46e('0x7')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc46e('0x7')]},'channel':{'type':Sequelize[_0xc46e('0x7')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc46e('0x8')]},'starttime':{'type':Sequelize[_0xc46e('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xc46e('0x9')]},'endtime':{'type':Sequelize[_0xc46e('0x9')]},'duration':{'type':Sequelize[_0xc46e('0xa')]},'billableseconds':{'type':Sequelize[_0xc46e('0xa')]},'mohtime':{'type':Sequelize[_0xc46e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc46e('0x7')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xc46e('0x7')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xc46e('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc46e('0x7')]},'prefix':{'type':Sequelize[_0xc46e('0x7')]},'routeid':{'type':Sequelize[_0xc46e('0xa')]},'sipcallid':{'type':Sequelize[_0xc46e('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 2dd9a38..19e41ee 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0xb7aeab,_0x4954db){_0xb7aeab=_0xb7aeab-0x0;var _0x3a288b=_0x2032[_0xb7aeab];return _0x3a288b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x466a7a,_0x5792bd){_0x466a7a=_0x466a7a-0x0;var _0x31792e=_0x2032[_0x466a7a];return _0x31792e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index ce26ce6..f8be2ba 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 _0x1652=['report_call','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x36d7ca,_0x40dea5){var _0x2f3c5d=function(_0x2ea642){while(--_0x2ea642){_0x36d7ca['push'](_0x36d7ca['shift']());}};_0x2f3c5d(++_0x40dea5);}(_0x1652,0x18a));var _0x2165=function(_0x209575,_0x417ae0){_0x209575=_0x209575-0x0;var _0x5b183d=_0x1652[_0x209575];return _0x5b183d;};'use strict';var _=require(_0x2165('0x0'));var util=require(_0x2165('0x1'));var logger=require(_0x2165('0x2'))(_0x2165('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2165('0x4'));var fs=require('fs');var path=require(_0x2165('0x5'));var rimraf=require(_0x2165('0x6'));var config=require(_0x2165('0x7'));var attributes=require(_0x2165('0x8'));module[_0x2165('0x9')]=function(_0x2e624e,_0x3d908a){return _0x2e624e[_0x2165('0xa')](_0x2165('0xb'),attributes,{'tableName':_0x2165('0xc'),'paranoid':![],'indexes':[{'fields':[_0x2165('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x71e4=['report_call','uniqueid','lodash','api','moment','request-promise','rimraf','../../config/environment','exports','define','VoiceCallReport'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x71e4,0x65));var _0x471e=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x71e4[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0x471e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x471e('0x1'));var moment=require(_0x471e('0x2'));var BPromise=require('bluebird');var rp=require(_0x471e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x471e('0x4'));var config=require(_0x471e('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x471e('0x6')]=function(_0x4d77c4,_0x3bab79){return _0x4d77c4[_0x471e('0x7')](_0x471e('0x8'),attributes,{'tableName':_0x471e('0x9'),'paranoid':![],'indexes':[{'fields':[_0x471e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5adaded..5b5ab99 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 _0x7516=['error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','model','include','attributes','map','stringify','catch','CreateVoiceCallReport','create','UpdateVoiceCallReport','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x7516,0x14d));var _0x6751=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x7516[_0x53abe5];return _0xc1c37e;};'use strict';var _=require(_0x6751('0x0'));var util=require(_0x6751('0x1'));var moment=require(_0x6751('0x2'));var BPromise=require(_0x6751('0x3'));var rs=require(_0x6751('0x4'));var fs=require('fs');var Redis=require(_0x6751('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6751('0x6'));var logger=require('../../config/logger')(_0x6751('0x7'));var config=require(_0x6751('0x8'));var jayson=require(_0x6751('0x9'));var client=jayson[_0x6751('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4aea82,_0x4610b4,_0x2fc5ce){return new BPromise(function(_0x3f1912,_0x34a334){return client[_0x6751('0xb')](_0x4aea82,_0x2fc5ce)[_0x6751('0xc')](function(_0x4acf5a){logger[_0x6751('0xd')](_0x6751('0xe'),_0x4610b4,_0x6751('0xf'));logger[_0x6751('0x10')](_0x6751('0x11'),_0x4610b4,'request\x20sent',JSON['stringify'](_0x4acf5a));if(_0x4acf5a[_0x6751('0x12')]){if(_0x4acf5a['error'][_0x6751('0x13')]===0x1f4){logger[_0x6751('0x12')](_0x6751('0xe'),_0x4610b4,_0x4acf5a['error'][_0x6751('0x14')]);return _0x34a334(_0x4acf5a[_0x6751('0x12')][_0x6751('0x14')]);}logger[_0x6751('0x12')](_0x6751('0xe'),_0x4610b4,_0x4acf5a[_0x6751('0x12')]['message']);return _0x3f1912(_0x4acf5a[_0x6751('0x12')][_0x6751('0x14')]);}else{logger[_0x6751('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x4610b4,'request\x20sent');_0x3f1912(_0x4acf5a[_0x6751('0x15')]['message']);}})['catch'](function(_0x4a8fa8){logger[_0x6751('0x12')](_0x6751('0xe'),_0x4610b4,_0x4a8fa8);_0x34a334(_0x4a8fa8);});});}exports[_0x6751('0x16')]=function(_0x153f03){var _0xf3110f=this;return new Promise(function(_0x351a5b,_0x3f206d){return db[_0x6751('0x17')][_0x6751('0x18')]({'raw':_0x153f03[_0x6751('0x19')]?_0x153f03[_0x6751('0x19')][_0x6751('0x1a')]===undefined?!![]:![]:!![],'where':_0x153f03[_0x6751('0x19')]?_0x153f03[_0x6751('0x19')][_0x6751('0x1b')]||null:null,'attributes':_0x153f03[_0x6751('0x19')]?_0x153f03[_0x6751('0x19')]['attributes']||null:null,'limit':_0x153f03[_0x6751('0x19')]?_0x153f03[_0x6751('0x19')]['limit']||null:null,'include':_0x153f03[_0x6751('0x19')]?_0x153f03[_0x6751('0x19')]['include']?_['map'](_0x153f03[_0x6751('0x19')]['include'],function(_0x516643){return{'model':db[_0x516643[_0x6751('0x1c')]],'as':_0x516643['as'],'attributes':_0x516643['attributes'],'include':_0x516643['include']?_['map'](_0x516643[_0x6751('0x1d')],function(_0x222b08){return{'model':db[_0x222b08[_0x6751('0x1c')]],'as':_0x222b08['as'],'attributes':_0x222b08[_0x6751('0x1e')],'include':_0x222b08[_0x6751('0x1d')]?_[_0x6751('0x1f')](_0x222b08[_0x6751('0x1d')],function(_0x6d80e0){return{'model':db[_0x6d80e0[_0x6751('0x1c')]],'as':_0x6d80e0['as'],'attributes':_0x6d80e0[_0x6751('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6751('0xc')](function(_0x1af6f3){logger['info'](_0x6751('0x16'),_0x153f03);logger['debug'](_0x6751('0x16'),_0x153f03,JSON[_0x6751('0x20')](_0x1af6f3));_0x351a5b(_0x1af6f3);})[_0x6751('0x21')](function(_0x43d264){logger[_0x6751('0x12')](_0x6751('0x16'),_0x43d264['message'],_0x153f03);_0x3f206d(_0xf3110f[_0x6751('0x12')](0x1f4,_0x43d264[_0x6751('0x14')]));});});};exports[_0x6751('0x22')]=function(_0x15d71c){var _0x4846ec=this;return new Promise(function(_0x534939,_0x2e719b){return db[_0x6751('0x17')][_0x6751('0x23')](_0x15d71c['body'],{'raw':_0x15d71c['options']?_0x15d71c[_0x6751('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x6751('0xc')](function(_0x58c03f){logger[_0x6751('0xd')](_0x6751('0x22'),_0x15d71c);logger[_0x6751('0x10')](_0x6751('0x22'),_0x15d71c,JSON[_0x6751('0x20')](_0x58c03f));_0x534939(_0x58c03f);})['catch'](function(_0x5558eb){logger[_0x6751('0x12')](_0x6751('0x22'),_0x5558eb[_0x6751('0x14')],_0x15d71c);_0x2e719b(_0x4846ec['error'](0x1f4,_0x5558eb[_0x6751('0x14')]));});});};exports[_0x6751('0x24')]=function(_0x486c9e){var _0x2e1700=this;return new Promise(function(_0x4da52e,_0x4ed5bc){return db[_0x6751('0x17')]['update'](_0x486c9e[_0x6751('0x25')],{'raw':_0x486c9e['options']?_0x486c9e[_0x6751('0x19')][_0x6751('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x486c9e['options']?_0x486c9e[_0x6751('0x19')]['where']||null:null,'attributes':_0x486c9e[_0x6751('0x19')]?_0x486c9e[_0x6751('0x19')]['attributes']||null:null,'limit':_0x486c9e[_0x6751('0x19')]?_0x486c9e[_0x6751('0x19')][_0x6751('0x26')]||null:null})[_0x6751('0xc')](function(_0x3a439d){logger[_0x6751('0xd')](_0x6751('0x24'),_0x486c9e);logger[_0x6751('0x10')](_0x6751('0x24'),_0x486c9e,JSON[_0x6751('0x20')](_0x3a439d));_0x4da52e(_0x3a439d);})[_0x6751('0x21')](function(_0x577c41){logger['error']('UpdateVoiceCallReport',_0x577c41[_0x6751('0x14')],_0x486c9e);_0x4ed5bc(_0x2e1700[_0x6751('0x12')](0x1f4,_0x577c41[_0x6751('0x14')]));});});}; \ No newline at end of file +var _0xe0bc=['CreateVoiceCallReport','create','body','then','UpdateVoiceCallReport','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','code','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','map','model'];(function(_0x1f4656,_0x201b59){var _0x35e26e=function(_0x44b72e){while(--_0x44b72e){_0x1f4656['push'](_0x1f4656['shift']());}};_0x35e26e(++_0x201b59);}(_0xe0bc,0x141));var _0xce0b=function(_0x1d4c41,_0x376e14){_0x1d4c41=_0x1d4c41-0x0;var _0x4c4243=_0xe0bc[_0x1d4c41];return _0x4c4243;};'use strict';var _=require(_0xce0b('0x0'));var util=require(_0xce0b('0x1'));var moment=require('moment');var BPromise=require(_0xce0b('0x2'));var rs=require(_0xce0b('0x3'));var fs=require('fs');var Redis=require(_0xce0b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce0b('0x5'))('rpc');var config=require(_0xce0b('0x6'));var jayson=require(_0xce0b('0x7'));var client=jayson[_0xce0b('0x8')][_0xce0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x188e29,_0x47a5cc,_0xa08fdd){return new BPromise(function(_0x2f8a01,_0x322b78){return client[_0xce0b('0xa')](_0x188e29,_0xa08fdd)['then'](function(_0x18e115){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x47a5cc,_0xce0b('0xb'));logger[_0xce0b('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x47a5cc,_0xce0b('0xb'),JSON['stringify'](_0x18e115));if(_0x18e115[_0xce0b('0xd')]){if(_0x18e115[_0xce0b('0xd')][_0xce0b('0xe')]===0x1f4){logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x47a5cc,_0x18e115[_0xce0b('0xd')][_0xce0b('0xf')]);return _0x322b78(_0x18e115[_0xce0b('0xd')]['message']);}logger[_0xce0b('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x47a5cc,_0x18e115[_0xce0b('0xd')][_0xce0b('0xf')]);return _0x2f8a01(_0x18e115[_0xce0b('0xd')][_0xce0b('0xf')]);}else{logger[_0xce0b('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x47a5cc,_0xce0b('0xb'));_0x2f8a01(_0x18e115[_0xce0b('0x11')][_0xce0b('0xf')]);}})[_0xce0b('0x12')](function(_0xc5836f){logger[_0xce0b('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x47a5cc,_0xc5836f);_0x322b78(_0xc5836f);});});}exports[_0xce0b('0x13')]=function(_0x4e872b){var _0x748b07=this;return new Promise(function(_0x48df4c,_0x5eb21f){return db[_0xce0b('0x14')]['findAll']({'raw':_0x4e872b[_0xce0b('0x15')]?_0x4e872b[_0xce0b('0x15')][_0xce0b('0x16')]===undefined?!![]:![]:!![],'where':_0x4e872b[_0xce0b('0x15')]?_0x4e872b[_0xce0b('0x15')][_0xce0b('0x17')]||null:null,'attributes':_0x4e872b[_0xce0b('0x15')]?_0x4e872b[_0xce0b('0x15')][_0xce0b('0x18')]||null:null,'limit':_0x4e872b[_0xce0b('0x15')]?_0x4e872b[_0xce0b('0x15')][_0xce0b('0x19')]||null:null,'include':_0x4e872b['options']?_0x4e872b['options'][_0xce0b('0x1a')]?_[_0xce0b('0x1b')](_0x4e872b[_0xce0b('0x15')][_0xce0b('0x1a')],function(_0x32767b){return{'model':db[_0x32767b[_0xce0b('0x1c')]],'as':_0x32767b['as'],'attributes':_0x32767b[_0xce0b('0x18')],'include':_0x32767b[_0xce0b('0x1a')]?_['map'](_0x32767b[_0xce0b('0x1a')],function(_0xce2073){return{'model':db[_0xce2073['model']],'as':_0xce2073['as'],'attributes':_0xce2073['attributes'],'include':_0xce2073[_0xce0b('0x1a')]?_[_0xce0b('0x1b')](_0xce2073[_0xce0b('0x1a')],function(_0x2a798b){return{'model':db[_0x2a798b[_0xce0b('0x1c')]],'as':_0x2a798b['as'],'attributes':_0x2a798b[_0xce0b('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x64592){logger[_0xce0b('0x10')]('GetVoiceCallReport',_0x4e872b);logger[_0xce0b('0xc')](_0xce0b('0x13'),_0x4e872b,JSON['stringify'](_0x64592));_0x48df4c(_0x64592);})[_0xce0b('0x12')](function(_0x28d5ed){logger['error']('GetVoiceCallReport',_0x28d5ed[_0xce0b('0xf')],_0x4e872b);_0x5eb21f(_0x748b07[_0xce0b('0xd')](0x1f4,_0x28d5ed[_0xce0b('0xf')]));});});};exports[_0xce0b('0x1d')]=function(_0x44d31c){var _0x1f4ce2=this;return new Promise(function(_0x52933f,_0x42486d){return db[_0xce0b('0x14')][_0xce0b('0x1e')](_0x44d31c[_0xce0b('0x1f')],{'raw':_0x44d31c[_0xce0b('0x15')]?_0x44d31c['options'][_0xce0b('0x16')]===undefined?!![]:![]:!![]})[_0xce0b('0x20')](function(_0x277ad6){logger[_0xce0b('0x10')]('CreateVoiceCallReport',_0x44d31c);logger[_0xce0b('0xc')](_0xce0b('0x1d'),_0x44d31c,JSON['stringify'](_0x277ad6));_0x52933f(_0x277ad6);})[_0xce0b('0x12')](function(_0x47186a){logger[_0xce0b('0xd')](_0xce0b('0x1d'),_0x47186a[_0xce0b('0xf')],_0x44d31c);_0x42486d(_0x1f4ce2[_0xce0b('0xd')](0x1f4,_0x47186a['message']));});});};exports[_0xce0b('0x21')]=function(_0x89cab9){var _0xb554cf=this;return new Promise(function(_0x15bb51,_0x5421a2){return db[_0xce0b('0x14')]['update'](_0x89cab9[_0xce0b('0x1f')],{'raw':_0x89cab9[_0xce0b('0x15')]?_0x89cab9[_0xce0b('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x89cab9[_0xce0b('0x15')]?_0x89cab9[_0xce0b('0x15')][_0xce0b('0x17')]||null:null,'attributes':_0x89cab9[_0xce0b('0x15')]?_0x89cab9[_0xce0b('0x15')][_0xce0b('0x18')]||null:null,'limit':_0x89cab9[_0xce0b('0x15')]?_0x89cab9['options'][_0xce0b('0x19')]||null:null})[_0xce0b('0x20')](function(_0x5af211){logger['info']('UpdateVoiceCallReport',_0x89cab9);logger[_0xce0b('0xc')](_0xce0b('0x21'),_0x89cab9,JSON[_0xce0b('0x22')](_0x5af211));_0x15bb51(_0x5af211);})[_0xce0b('0x12')](function(_0x54a881){logger['error'](_0xce0b('0x21'),_0x54a881[_0xce0b('0xf')],_0x89cab9);_0x5421a2(_0xb554cf[_0xce0b('0xd')](0x1f4,_0x54a881[_0xce0b('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 52198b0..79ef5cb 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 _0x1c9a=['./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2418fc,_0x2c1342){var _0x2c27e6=function(_0x47ddee){while(--_0x47ddee){_0x2418fc['push'](_0x2418fc['shift']());}};_0x2c27e6(++_0x2c1342);}(_0x1c9a,0x124));var _0xa1c9=function(_0x1bc3ae,_0x3565ee){_0x1bc3ae=_0x1bc3ae-0x0;var _0x291de0=_0x1c9a[_0x1bc3ae];return _0x291de0;};'use strict';var multer=require(_0xa1c9('0x0'));var util=require(_0xa1c9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa1c9('0x2'));var router=express[_0xa1c9('0x3')]();var fs_extra=require(_0xa1c9('0x4'));var auth=require(_0xa1c9('0x5'));var interaction=require(_0xa1c9('0x6'));var config=require(_0xa1c9('0x7'));var controller=require(_0xa1c9('0x8'));router[_0xa1c9('0x9')]('/',auth[_0xa1c9('0xa')](),controller[_0xa1c9('0xb')]);router['get'](_0xa1c9('0xc'),auth[_0xa1c9('0xa')](),controller[_0xa1c9('0xd')]);router[_0xa1c9('0xe')]('/',auth['isAuthenticated'](),controller[_0xa1c9('0xf')]);router['put'](_0xa1c9('0xc'),auth[_0xa1c9('0xa')](),controller[_0xa1c9('0x10')]);router[_0xa1c9('0x11')](_0xa1c9('0xc'),auth[_0xa1c9('0xa')](),controller[_0xa1c9('0x12')]);module[_0xa1c9('0x13')]=router; \ No newline at end of file +var _0xf089=['/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x5b40ab,_0x15ec5e){var _0x5baa84=function(_0x2edde7){while(--_0x2edde7){_0x5b40ab['push'](_0x5b40ab['shift']());}};_0x5baa84(++_0x15ec5e);}(_0xf089,0x105));var _0x9f08=function(_0x3f9929,_0x3f49e6){_0x3f9929=_0x3f9929-0x0;var _0x207410=_0xf089[_0x3f9929];return _0x207410;};'use strict';var multer=require(_0x9f08('0x0'));var util=require(_0x9f08('0x1'));var path=require(_0x9f08('0x2'));var timeout=require(_0x9f08('0x3'));var express=require('express');var router=express[_0x9f08('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9f08('0x5'));var interaction=require(_0x9f08('0x6'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x9f08('0x7')]('/',auth[_0x9f08('0x8')](),controller['index']);router[_0x9f08('0x7')](_0x9f08('0x9'),auth[_0x9f08('0x8')](),controller[_0x9f08('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9f08('0xb')]);router[_0x9f08('0xc')]('/:id',auth[_0x9f08('0x8')](),controller['update']);router[_0x9f08('0xd')](_0x9f08('0x9'),auth[_0x9f08('0x8')](),controller[_0x9f08('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index cfe0c26..23c0ecb 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 _0xe005=['options','join','getDataValue','split','BOOLEAN','sequelize','STRING','setDataValue'];(function(_0x49ca87,_0x1ced49){var _0x513840=function(_0x285dcb){while(--_0x285dcb){_0x49ca87['push'](_0x49ca87['shift']());}};_0x513840(++_0x1ced49);}(_0xe005,0x85));var _0x5e00=function(_0x147074,_0x5571ca){_0x147074=_0x147074-0x0;var _0x18cc36=_0xe005[_0x147074];return _0x18cc36;};'use strict';var Sequelize=require(_0x5e00('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x5e00('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x5e00('0x1')],'set':function(_0x5a10ce){this[_0x5e00('0x2')](_0x5e00('0x3'),_0x5a10ce?_0x5a10ce[_0x5e00('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x5e00('0x3'))?this[_0x5e00('0x5')]('options')[_0x5e00('0x6')](''):[];}},'auth':{'type':Sequelize[_0x5e00('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5e00('0x1')]}}; \ No newline at end of file +var _0xd934=['options','getDataValue','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x43f552,_0x42808c){var _0x17911b=function(_0x4407a7){while(--_0x4407a7){_0x43f552['push'](_0x43f552['shift']());}};_0x17911b(++_0x42808c);}(_0xd934,0x16f));var _0x4d93=function(_0x30e61c,_0x20c167){_0x30e61c=_0x30e61c-0x0;var _0x4e894c=_0xd934[_0x30e61c];return _0x4e894c;};'use strict';var Sequelize=require(_0x4d93('0x0'));module[_0x4d93('0x1')]={'name':{'type':Sequelize[_0x4d93('0x2')]},'prefix':{'type':Sequelize[_0x4d93('0x2')],'unique':_0x4d93('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x4d93('0x2')],'set':function(_0xbfc66d){this['setDataValue'](_0x4d93('0x4'),_0xbfc66d?_0xbfc66d['join'](''):[]);},'get':function(){return this[_0x4d93('0x5')](_0x4d93('0x4'))?this['getDataValue'](_0x4d93('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0x4d93('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x4d93('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4d93('0x2')]},'description':{'type':Sequelize[_0x4d93('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index f50f679..2bd556d 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 _0x1a5c=['then','destroy','ChanSpies','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','params','rawAttributes','length','includeAll','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update'];(function(_0x5482d1,_0x487514){var _0x4802ca=function(_0x46fe5a){while(--_0x46fe5a){_0x5482d1['push'](_0x5482d1['shift']());}};_0x4802ca(++_0x487514);}(_0x1a5c,0x12c));var _0xc1a5=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x1a5c[_0x1ae5ab];return _0x1ce001;};'use strict';var emlformat=require(_0xc1a5('0x0'));var rimraf=require(_0xc1a5('0x1'));var zipdir=require(_0xc1a5('0x2'));var jsonpatch=require(_0xc1a5('0x3'));var rp=require(_0xc1a5('0x4'));var moment=require(_0xc1a5('0x5'));var BPromise=require(_0xc1a5('0x6'));var Mustache=require(_0xc1a5('0x7'));var util=require(_0xc1a5('0x8'));var path=require(_0xc1a5('0x9'));var sox=require('sox');var csv=require(_0xc1a5('0xa'));var ejs=require(_0xc1a5('0xb'));var fs=require('fs');var fs_extra=require(_0xc1a5('0xc'));var _=require(_0xc1a5('0xd'));var squel=require(_0xc1a5('0xe'));var crypto=require(_0xc1a5('0xf'));var jsforce=require(_0xc1a5('0x10'));var deskjs=require(_0xc1a5('0x11'));var toCsv=require('to-csv');var querystring=require(_0xc1a5('0x12'));var Papa=require(_0xc1a5('0x13'));var Redis=require('ioredis');var authService=require(_0xc1a5('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1a5('0x15'));var logger=require(_0xc1a5('0x16'))('api');var utils=require(_0xc1a5('0x17'));var config=require(_0xc1a5('0x18'));var licenseUtil=require(_0xc1a5('0x19'));var db=require(_0xc1a5('0x1a'))['db'];function respondWithStatusCode(_0x1fb066,_0x52fe6d){_0x52fe6d=_0x52fe6d||0xcc;return function(_0x428ccf){if(_0x428ccf){return _0x1fb066[_0xc1a5('0x1b')](_0x52fe6d);}return _0x1fb066[_0xc1a5('0x1c')](_0x52fe6d)[_0xc1a5('0x1d')]();};}function respondWithResult(_0x1aec58,_0x1dabb5){_0x1dabb5=_0x1dabb5||0xc8;return function(_0x24e513){if(_0x24e513){return _0x1aec58[_0xc1a5('0x1c')](_0x1dabb5)[_0xc1a5('0x1e')](_0x24e513);}};}function respondWithFilteredResult(_0x4fcced,_0x4b2590){return function(_0x1b2cfb){if(_0x1b2cfb){var _0xfdb88e=typeof _0x4b2590[_0xc1a5('0x1f')]==='undefined'&&typeof _0x4b2590[_0xc1a5('0x20')]===_0xc1a5('0x21');var _0x21faf9=_0x1b2cfb['count'];var _0x82766f=_0xfdb88e?0x0:_0x4b2590['offset'];var _0x294e92=_0xfdb88e?_0x1b2cfb[_0xc1a5('0x22')]:_0x4b2590[_0xc1a5('0x1f')]+_0x4b2590[_0xc1a5('0x20')];var _0xcbdda5;if(_0x294e92>=_0x21faf9){_0x294e92=_0x21faf9;_0xcbdda5=0xc8;}else{_0xcbdda5=0xce;}_0x4fcced[_0xc1a5('0x1c')](_0xcbdda5);return _0x4fcced[_0xc1a5('0x23')](_0xc1a5('0x24'),_0x82766f+'-'+_0x294e92+'/'+_0x21faf9)[_0xc1a5('0x1e')](_0x1b2cfb);}return null;};}function patchUpdates(_0x1f327c){return function(_0x45a3f5){try{jsonpatch[_0xc1a5('0x25')](_0x45a3f5,_0x1f327c,!![]);}catch(_0x6452c7){return BPromise[_0xc1a5('0x26')](_0x6452c7);}return _0x45a3f5['save']();};}function saveUpdates(_0xb93792,_0x12002d){return function(_0x4b424c){if(_0x4b424c){return _0x4b424c[_0xc1a5('0x27')](_0xb93792)[_0xc1a5('0x28')](function(_0x283599){return _0x283599;});}return null;};}function removeEntity(_0x2a8ee8,_0x232666){return function(_0x2e2351){if(_0x2e2351){return _0x2e2351[_0xc1a5('0x29')]()[_0xc1a5('0x28')](function(){var _0x4ba053=_0x2e2351['get']({'plain':!![]});var _0x2b19c5=_0xc1a5('0x2a');return db[_0xc1a5('0x2b')]['destroy']({'where':{'type':_0x2b19c5,'resourceId':_0x4ba053['id']}})[_0xc1a5('0x28')](function(){return _0x2e2351;});})['then'](function(){_0x2a8ee8['status'](0xcc)[_0xc1a5('0x1d')]();});}};}function handleEntityNotFound(_0x41f861,_0x20c65b){return function(_0x33ea9a){if(!_0x33ea9a){_0x41f861['sendStatus'](0x194);}return _0x33ea9a;};}function handleError(_0x47f09f,_0x4f3f99){_0x4f3f99=_0x4f3f99||0x1f4;return function(_0x1fa511){logger['error'](_0x1fa511[_0xc1a5('0x2c')]);if(_0x1fa511['name']){delete _0x1fa511[_0xc1a5('0x2d')];}_0x47f09f[_0xc1a5('0x1c')](_0x4f3f99)[_0xc1a5('0x2e')](_0x1fa511);};}exports[_0xc1a5('0x2f')]=function(_0x52653d,_0x4d7542){var _0x20eb2d={},_0x5e50a7={},_0x167fcb={'count':0x0,'rows':[]};var _0xdca8bd=_[_0xc1a5('0x30')](db[_0xc1a5('0x31')]['rawAttributes'],function(_0x4dbf2f){return{'name':_0x4dbf2f[_0xc1a5('0x32')],'type':_0x4dbf2f[_0xc1a5('0x33')][_0xc1a5('0x34')]};});_0x5e50a7[_0xc1a5('0x35')]=_[_0xc1a5('0x30')](_0xdca8bd,_0xc1a5('0x2d'));_0x5e50a7[_0xc1a5('0x36')]=_[_0xc1a5('0x37')](_0x52653d[_0xc1a5('0x36')]);_0x5e50a7[_0xc1a5('0x38')]=_[_0xc1a5('0x39')](_0x5e50a7[_0xc1a5('0x35')],_0x5e50a7[_0xc1a5('0x36')]);_0x20eb2d[_0xc1a5('0x3a')]=_['intersection'](_0x5e50a7[_0xc1a5('0x35')],qs[_0xc1a5('0x3b')](_0x52653d[_0xc1a5('0x36')][_0xc1a5('0x3b')]));_0x20eb2d[_0xc1a5('0x3a')]=_0x20eb2d[_0xc1a5('0x3a')]['length']?_0x20eb2d[_0xc1a5('0x3a')]:_0x5e50a7[_0xc1a5('0x35')];if(!_0x52653d[_0xc1a5('0x36')][_0xc1a5('0x3c')]('nolimit')){_0x20eb2d[_0xc1a5('0x20')]=qs[_0xc1a5('0x20')](_0x52653d[_0xc1a5('0x36')]['limit']);_0x20eb2d['offset']=qs[_0xc1a5('0x1f')](_0x52653d[_0xc1a5('0x36')]['offset']);}_0x20eb2d[_0xc1a5('0x3d')]=qs['sort'](_0x52653d['query'][_0xc1a5('0x3e')]);_0x20eb2d[_0xc1a5('0x3f')]=qs[_0xc1a5('0x38')](_[_0xc1a5('0x40')](_0x52653d[_0xc1a5('0x36')],_0x5e50a7['filters']),_0xdca8bd);if(_0x52653d[_0xc1a5('0x36')][_0xc1a5('0x41')]){_0x20eb2d[_0xc1a5('0x3f')]=_[_0xc1a5('0x42')](_0x20eb2d['where'],{'$or':_[_0xc1a5('0x30')](_0xdca8bd,function(_0xe28eff){if(_0xe28eff[_0xc1a5('0x33')]!==_0xc1a5('0x43')){var _0x46180a={};_0x46180a[_0xe28eff[_0xc1a5('0x2d')]]={'$like':'%'+_0x52653d[_0xc1a5('0x36')]['filter']+'%'};return _0x46180a;}})});}_0x20eb2d=_['merge']({},_0x20eb2d,_0x52653d[_0xc1a5('0x44')]);var _0x32ea6a={'where':_0x20eb2d[_0xc1a5('0x3f')]};return db[_0xc1a5('0x31')][_0xc1a5('0x22')](_0x32ea6a)[_0xc1a5('0x28')](function(_0x2f3c62){_0x167fcb[_0xc1a5('0x22')]=_0x2f3c62;if(_0x52653d['query']['includeAll']){_0x20eb2d['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0xc1a5('0x45')](_0x20eb2d);})[_0xc1a5('0x28')](function(_0x169aa7){_0x167fcb['rows']=_0x169aa7;return _0x167fcb;})[_0xc1a5('0x28')](respondWithFilteredResult(_0x4d7542,_0x20eb2d))['catch'](handleError(_0x4d7542,null));};exports['show']=function(_0x536f30,_0xb2c3b){var _0x26af58={'raw':![],'where':{'id':_0x536f30[_0xc1a5('0x46')]['id']}},_0x19b43f={};_0x19b43f[_0xc1a5('0x35')]=_[_0xc1a5('0x37')](db['VoiceChanSpy'][_0xc1a5('0x47')]);_0x19b43f[_0xc1a5('0x36')]=_[_0xc1a5('0x37')](_0x536f30[_0xc1a5('0x36')]);_0x19b43f[_0xc1a5('0x38')]=_[_0xc1a5('0x39')](_0x19b43f['model'],_0x19b43f[_0xc1a5('0x36')]);_0x26af58[_0xc1a5('0x3a')]=_[_0xc1a5('0x39')](_0x19b43f[_0xc1a5('0x35')],qs['fields'](_0x536f30['query'][_0xc1a5('0x3b')]));_0x26af58['attributes']=_0x26af58['attributes'][_0xc1a5('0x48')]?_0x26af58[_0xc1a5('0x3a')]:_0x19b43f['model'];if(_0x536f30[_0xc1a5('0x36')][_0xc1a5('0x49')]){_0x26af58['include']=[{'all':!![]}];}_0x26af58=_[_0xc1a5('0x42')]({},_0x26af58,_0x536f30['options']);return db[_0xc1a5('0x31')][_0xc1a5('0x4a')](_0x26af58)['then'](handleEntityNotFound(_0xb2c3b,null))[_0xc1a5('0x28')](respondWithResult(_0xb2c3b,null))[_0xc1a5('0x4b')](handleError(_0xb2c3b,null));};exports[_0xc1a5('0x4c')]=function(_0x6a9a49,_0x336523){return db[_0xc1a5('0x31')][_0xc1a5('0x4c')](_0x6a9a49['body'],{})[_0xc1a5('0x28')](function(_0x4b0141){var _0x2390e4=_0x6a9a49[_0xc1a5('0x4d')][_0xc1a5('0x4e')]({'plain':!![]});if(!_0x2390e4)throw new Error(_0xc1a5('0x4f'));if(_0x2390e4['role']===_0xc1a5('0x4d')){var _0x102664=_0x4b0141['get']({'plain':!![]});var _0x359e47=_0xc1a5('0x2a');return db['UserProfileSection'][_0xc1a5('0x4a')]({'where':{'name':_0x359e47,'userProfileId':_0x2390e4[_0xc1a5('0x50')]},'raw':!![]})['then'](function(_0x3973c8){if(_0x3973c8&&_0x3973c8[_0xc1a5('0x51')]===0x0){return db[_0xc1a5('0x2b')][_0xc1a5('0x4c')]({'name':_0x102664[_0xc1a5('0x2d')],'resourceId':_0x102664['id'],'type':_0x3973c8[_0xc1a5('0x2d')],'sectionId':_0x3973c8['id']},{})[_0xc1a5('0x28')](function(){return _0x4b0141;});}else{return _0x4b0141;}})['catch'](function(_0xabe7be){logger[_0xc1a5('0x52')](_0xc1a5('0x53'),_0xabe7be);throw _0xabe7be;});}return _0x4b0141;})['then'](respondWithResult(_0x336523,0xc9))[_0xc1a5('0x4b')](handleError(_0x336523,null));};exports[_0xc1a5('0x27')]=function(_0x5405b3,_0x5bac8){if(_0x5405b3[_0xc1a5('0x54')]['id']){delete _0x5405b3['body']['id'];}return db[_0xc1a5('0x31')]['find']({'where':{'id':_0x5405b3[_0xc1a5('0x46')]['id']}})[_0xc1a5('0x28')](handleEntityNotFound(_0x5bac8,null))[_0xc1a5('0x28')](saveUpdates(_0x5405b3[_0xc1a5('0x54')],null))[_0xc1a5('0x28')](respondWithResult(_0x5bac8,null))[_0xc1a5('0x4b')](handleError(_0x5bac8,null));};exports[_0xc1a5('0x29')]=function(_0x5ed9f0,_0x5e333b){return db['VoiceChanSpy'][_0xc1a5('0x4a')]({'where':{'id':_0x5ed9f0[_0xc1a5('0x46')]['id']}})[_0xc1a5('0x28')](handleEntityNotFound(_0x5e333b,null))['then'](removeEntity(_0x5e333b,null))[_0xc1a5('0x4b')](handleError(_0x5e333b,null));}; \ No newline at end of file +var _0xb11e=['limit','count','then','destroy','ChanSpies','UserProfileResource','sendStatus','error','name','send','index','VoiceChanSpy','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','include','find','catch','create','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xb11e,0x7d));var _0xeb11=function(_0x104992,_0x18603b){_0x104992=_0x104992-0x0;var _0x466de6=_0xb11e[_0x104992];return _0x466de6;};'use strict';var emlformat=require(_0xeb11('0x0'));var rimraf=require(_0xeb11('0x1'));var zipdir=require(_0xeb11('0x2'));var jsonpatch=require(_0xeb11('0x3'));var rp=require(_0xeb11('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb11('0x5'));var util=require(_0xeb11('0x6'));var path=require(_0xeb11('0x7'));var sox=require(_0xeb11('0x8'));var csv=require('to-csv');var ejs=require(_0xeb11('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeb11('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeb11('0xb'));var toCsv=require(_0xeb11('0xc'));var querystring=require(_0xeb11('0xd'));var Papa=require('papaparse');var Redis=require(_0xeb11('0xe'));var authService=require(_0xeb11('0xf'));var qs=require(_0xeb11('0x10'));var as=require(_0xeb11('0x11'));var hardwareService=require(_0xeb11('0x12'));var logger=require(_0xeb11('0x13'))(_0xeb11('0x14'));var utils=require(_0xeb11('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeb11('0x16'));var db=require(_0xeb11('0x17'))['db'];function respondWithStatusCode(_0x15b1e4,_0x517962){_0x517962=_0x517962||0xcc;return function(_0x44b192){if(_0x44b192){return _0x15b1e4['sendStatus'](_0x517962);}return _0x15b1e4[_0xeb11('0x18')](_0x517962)['end']();};}function respondWithResult(_0x5d183d,_0x146cfa){_0x146cfa=_0x146cfa||0xc8;return function(_0x2e0d2c){if(_0x2e0d2c){return _0x5d183d[_0xeb11('0x18')](_0x146cfa)[_0xeb11('0x19')](_0x2e0d2c);}};}function respondWithFilteredResult(_0x4c6a67,_0x58d276){return function(_0x200730){if(_0x200730){var _0xd1a9bf=typeof _0x58d276[_0xeb11('0x1a')]==='undefined'&&typeof _0x58d276[_0xeb11('0x1b')]==='undefined';var _0x33a996=_0x200730[_0xeb11('0x1c')];var _0x139ff8=_0xd1a9bf?0x0:_0x58d276['offset'];var _0xf36770=_0xd1a9bf?_0x200730[_0xeb11('0x1c')]:_0x58d276['offset']+_0x58d276['limit'];var _0x1906db;if(_0xf36770>=_0x33a996){_0xf36770=_0x33a996;_0x1906db=0xc8;}else{_0x1906db=0xce;}_0x4c6a67[_0xeb11('0x18')](_0x1906db);return _0x4c6a67['set']('Content-Range',_0x139ff8+'-'+_0xf36770+'/'+_0x33a996)[_0xeb11('0x19')](_0x200730);}return null;};}function patchUpdates(_0xf057c){return function(_0x4dfe03){try{jsonpatch['apply'](_0x4dfe03,_0xf057c,!![]);}catch(_0x17af28){return BPromise['reject'](_0x17af28);}return _0x4dfe03['save']();};}function saveUpdates(_0x5779df,_0xeeb427){return function(_0x1caf4f){if(_0x1caf4f){return _0x1caf4f['update'](_0x5779df)[_0xeb11('0x1d')](function(_0x40a4cb){return _0x40a4cb;});}return null;};}function removeEntity(_0x53e48d,_0x1c526d){return function(_0x3b2e1a){if(_0x3b2e1a){return _0x3b2e1a[_0xeb11('0x1e')]()['then'](function(){var _0x640c79=_0x3b2e1a['get']({'plain':!![]});var _0x5b97b5=_0xeb11('0x1f');return db[_0xeb11('0x20')][_0xeb11('0x1e')]({'where':{'type':_0x5b97b5,'resourceId':_0x640c79['id']}})['then'](function(){return _0x3b2e1a;});})['then'](function(){_0x53e48d[_0xeb11('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39c0da,_0x45eeba){return function(_0x377abf){if(!_0x377abf){_0x39c0da[_0xeb11('0x21')](0x194);}return _0x377abf;};}function handleError(_0x289121,_0x4a0501){_0x4a0501=_0x4a0501||0x1f4;return function(_0x1d9bf7){logger[_0xeb11('0x22')](_0x1d9bf7['stack']);if(_0x1d9bf7[_0xeb11('0x23')]){delete _0x1d9bf7['name'];}_0x289121[_0xeb11('0x18')](_0x4a0501)[_0xeb11('0x24')](_0x1d9bf7);};}exports[_0xeb11('0x25')]=function(_0x6adeaa,_0x22e3d2){var _0x80f0d9={},_0x26ca49={},_0x2b7f14={'count':0x0,'rows':[]};var _0x322797=_['map'](db[_0xeb11('0x26')]['rawAttributes'],function(_0x10089d){return{'name':_0x10089d[_0xeb11('0x27')],'type':_0x10089d[_0xeb11('0x28')]['key']};});_0x26ca49['model']=_[_0xeb11('0x29')](_0x322797,_0xeb11('0x23'));_0x26ca49[_0xeb11('0x2a')]=_[_0xeb11('0x2b')](_0x6adeaa['query']);_0x26ca49[_0xeb11('0x2c')]=_[_0xeb11('0x2d')](_0x26ca49[_0xeb11('0x2e')],_0x26ca49['query']);_0x80f0d9[_0xeb11('0x2f')]=_['intersection'](_0x26ca49[_0xeb11('0x2e')],qs['fields'](_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x30')]));_0x80f0d9[_0xeb11('0x2f')]=_0x80f0d9[_0xeb11('0x2f')][_0xeb11('0x31')]?_0x80f0d9[_0xeb11('0x2f')]:_0x26ca49[_0xeb11('0x2e')];if(!_0x6adeaa['query'][_0xeb11('0x32')]('nolimit')){_0x80f0d9[_0xeb11('0x1b')]=qs['limit'](_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x1b')]);_0x80f0d9[_0xeb11('0x1a')]=qs[_0xeb11('0x1a')](_0x6adeaa['query'][_0xeb11('0x1a')]);}_0x80f0d9[_0xeb11('0x33')]=qs[_0xeb11('0x34')](_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x34')]);_0x80f0d9[_0xeb11('0x35')]=qs[_0xeb11('0x2c')](_[_0xeb11('0x36')](_0x6adeaa[_0xeb11('0x2a')],_0x26ca49[_0xeb11('0x2c')]),_0x322797);if(_0x6adeaa[_0xeb11('0x2a')][_0xeb11('0x37')]){_0x80f0d9[_0xeb11('0x35')]=_[_0xeb11('0x38')](_0x80f0d9[_0xeb11('0x35')],{'$or':_['map'](_0x322797,function(_0x16637b){if(_0x16637b['type']!==_0xeb11('0x39')){var _0xcdf358={};_0xcdf358[_0x16637b['name']]={'$like':'%'+_0x6adeaa['query'][_0xeb11('0x37')]+'%'};return _0xcdf358;}})});}_0x80f0d9=_[_0xeb11('0x38')]({},_0x80f0d9,_0x6adeaa[_0xeb11('0x3a')]);var _0x211ead={'where':_0x80f0d9['where']};return db[_0xeb11('0x26')][_0xeb11('0x1c')](_0x211ead)[_0xeb11('0x1d')](function(_0xffa000){_0x2b7f14['count']=_0xffa000;if(_0x6adeaa['query'][_0xeb11('0x3b')]){_0x80f0d9['include']=[{'all':!![]}];}return db[_0xeb11('0x26')][_0xeb11('0x3c')](_0x80f0d9);})[_0xeb11('0x1d')](function(_0xdf32e7){_0x2b7f14[_0xeb11('0x3d')]=_0xdf32e7;return _0x2b7f14;})[_0xeb11('0x1d')](respondWithFilteredResult(_0x22e3d2,_0x80f0d9))['catch'](handleError(_0x22e3d2,null));};exports['show']=function(_0x9a9daa,_0x1fd33c){var _0x28f8b4={'raw':![],'where':{'id':_0x9a9daa[_0xeb11('0x3e')]['id']}},_0x54023c={};_0x54023c[_0xeb11('0x2e')]=_[_0xeb11('0x2b')](db[_0xeb11('0x26')][_0xeb11('0x3f')]);_0x54023c['query']=_['keys'](_0x9a9daa[_0xeb11('0x2a')]);_0x54023c['filters']=_[_0xeb11('0x2d')](_0x54023c[_0xeb11('0x2e')],_0x54023c[_0xeb11('0x2a')]);_0x28f8b4[_0xeb11('0x2f')]=_[_0xeb11('0x2d')](_0x54023c[_0xeb11('0x2e')],qs['fields'](_0x9a9daa[_0xeb11('0x2a')][_0xeb11('0x30')]));_0x28f8b4[_0xeb11('0x2f')]=_0x28f8b4[_0xeb11('0x2f')][_0xeb11('0x31')]?_0x28f8b4['attributes']:_0x54023c[_0xeb11('0x2e')];if(_0x9a9daa[_0xeb11('0x2a')]['includeAll']){_0x28f8b4[_0xeb11('0x40')]=[{'all':!![]}];}_0x28f8b4=_[_0xeb11('0x38')]({},_0x28f8b4,_0x9a9daa[_0xeb11('0x3a')]);return db[_0xeb11('0x26')][_0xeb11('0x41')](_0x28f8b4)['then'](handleEntityNotFound(_0x1fd33c,null))['then'](respondWithResult(_0x1fd33c,null))[_0xeb11('0x42')](handleError(_0x1fd33c,null));};exports['create']=function(_0x355251,_0x2307ff){return db[_0xeb11('0x26')][_0xeb11('0x43')](_0x355251['body'],{})[_0xeb11('0x1d')](function(_0x12c628){var _0xdc38a1=_0x355251[_0xeb11('0x44')][_0xeb11('0x45')]({'plain':!![]});if(!_0xdc38a1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xdc38a1['role']==='user'){var _0x315f87=_0x12c628[_0xeb11('0x45')]({'plain':!![]});var _0x49cfac='ChanSpies';return db[_0xeb11('0x46')]['find']({'where':{'name':_0x49cfac,'userProfileId':_0xdc38a1[_0xeb11('0x47')]},'raw':!![]})[_0xeb11('0x1d')](function(_0x362909){if(_0x362909&&_0x362909[_0xeb11('0x48')]===0x0){return db[_0xeb11('0x20')][_0xeb11('0x43')]({'name':_0x315f87[_0xeb11('0x23')],'resourceId':_0x315f87['id'],'type':_0x362909[_0xeb11('0x23')],'sectionId':_0x362909['id']},{})[_0xeb11('0x1d')](function(){return _0x12c628;});}else{return _0x12c628;}})[_0xeb11('0x42')](function(_0x3a4543){logger[_0xeb11('0x22')](_0xeb11('0x49'),_0x3a4543);throw _0x3a4543;});}return _0x12c628;})[_0xeb11('0x1d')](respondWithResult(_0x2307ff,0xc9))[_0xeb11('0x42')](handleError(_0x2307ff,null));};exports[_0xeb11('0x4a')]=function(_0x6ec5de,_0x45f413){if(_0x6ec5de['body']['id']){delete _0x6ec5de[_0xeb11('0x4b')]['id'];}return db[_0xeb11('0x26')][_0xeb11('0x41')]({'where':{'id':_0x6ec5de['params']['id']}})[_0xeb11('0x1d')](handleEntityNotFound(_0x45f413,null))[_0xeb11('0x1d')](saveUpdates(_0x6ec5de[_0xeb11('0x4b')],null))[_0xeb11('0x1d')](respondWithResult(_0x45f413,null))['catch'](handleError(_0x45f413,null));};exports[_0xeb11('0x1e')]=function(_0x6813d2,_0x1d769d){return db['VoiceChanSpy']['find']({'where':{'id':_0x6813d2[_0xeb11('0x3e')]['id']}})[_0xeb11('0x1d')](handleEntityNotFound(_0x1d769d,null))[_0xeb11('0x1d')](removeEntity(_0x1d769d,null))['catch'](handleError(_0x1d769d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 3d3e892..4a71c1a 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 _0x184d=['bulkCreate','catch','destroy','lodash','bluebird','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','recordingFormat','auth','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','then','exports','define','VoiceChanSpy','VoiceExtension'];(function(_0x303e7f,_0x1ed1b5){var _0x5c07fd=function(_0x9dc3df){while(--_0x9dc3df){_0x303e7f['push'](_0x303e7f['shift']());}};_0x5c07fd(++_0x1ed1b5);}(_0x184d,0x135));var _0xd184=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x184d[_0x38537f];return _0x141e23;};'use strict';var _=require(_0xd184('0x0'));var util=require('util');var BPromise=require(_0xd184('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x2afd22,_0x1a4412,_0x256fbd){var _0x46e075=0x1;var _0xd8e9c4=[];var _0x1f82d9={'context':_0x1a4412[_0xd184('0x2')]||_0xd184('0x3'),'exten':util[_0xd184('0x4')](_0xd184('0x5'),_0x2afd22[_0xd184('0x6')],_0x256fbd),'type':_0xd184('0x7'),'isApp':![],'ChanSpyId':_0x2afd22['id'],'UserId':_0x1a4412['id']};_0xd8e9c4[_0xd184('0x8')](_[_0xd184('0x9')]({'app':_0xd184('0xa'),'appdata':util['format'](_0xd184('0xb'),_0xd184('0xc')),'priority':_0x46e075++},_0x1f82d9));if(_0x2afd22[_0xd184('0xd')]){_0xd8e9c4[_0xd184('0x8')](_[_0xd184('0x9')]({'app':'MixMonitor','appdata':util[_0xd184('0x4')]('${UNIQUEID}.%s,a',_0x2afd22[_0xd184('0xe')]),'priority':_0x46e075++},_0x1f82d9));}if(_0x2afd22[_0xd184('0xf')]){_0xd8e9c4[_0xd184('0x8')](_[_0xd184('0x9')]({'app':'Authenticate','appdata':_0x2afd22[_0xd184('0x10')],'priority':_0x46e075++},_0x1f82d9));}_0xd8e9c4[_0xd184('0x8')](_[_0xd184('0x9')]({'app':_0xd184('0x11'),'appdata':util[_0xd184('0x4')](_0xd184('0x12'),_0x1a4412[_0xd184('0x13')],_0x2afd22[_0xd184('0x14')]?_0x2afd22[_0xd184('0x14')][_0xd184('0x15')](''):''),'priority':_0x46e075++},_0x1f82d9));if(_0x2afd22[_0xd184('0xd')]){_0xd8e9c4[_0xd184('0x8')](_[_0xd184('0x9')]({'app':'StopMixMonitor','priority':_0x46e075++},_0x1f82d9));}return _0xd8e9c4;};var getChanSpyApplications=function(_0x1c6e86,_0x32f90b){var _0x4c296f=[];for(var _0x58e84d=0x0,_0x8c168d=0x1;_0x58e84d<_0x32f90b[_0xd184('0x16')];_0x58e84d++,_0x8c168d=0x1){_0x4c296f=_0x4c296f[_0xd184('0x17')](getUserApplications(_0x1c6e86,_0x32f90b[_0x58e84d],_0x32f90b[_0x58e84d][_0xd184('0x18')]));if(_0x32f90b[_0x58e84d][_0xd184('0x18')]!=_0x32f90b[_0x58e84d][_0xd184('0x13')]){_0x4c296f=_0x4c296f['concat'](getUserApplications(_0x1c6e86,_0x32f90b[_0x58e84d],_0x32f90b[_0x58e84d][_0xd184('0x13')]));}}return _0x4c296f;};var getChanSpyPromise=function(_0x3935e0,_0x3063a0){return new BPromise(function(_0x722567,_0x4cbd1b){return _0x3935e0[_0xd184('0x19')]['findAll']({'attributes':['id',_0xd184('0x13'),_0xd184('0x18')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xd184('0x1a')](function(_0x51e75f){if(_0x51e75f){return _0x722567(getChanSpyApplications(_0x3063a0,_0x51e75f));}return _0x722567([]);})['catch'](function(_0x2a951b){_0x4cbd1b(_0x2a951b);});});};module[_0xd184('0x1b')]=function(_0x37808f,_0x21eeec){var _0x48330c=_0x37808f['models'];return _0x37808f[_0xd184('0x1c')](_0xd184('0x1d'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x226672,_0x50d69c,_0x517dd7){return getChanSpyPromise(_0x48330c,_0x226672)[_0xd184('0x1a')](function(_0x287efc){if(_0x287efc&&_0x287efc['length']){return _0x48330c[_0xd184('0x1e')][_0xd184('0x1f')](_0x287efc);}})[_0xd184('0x1a')](function(){_0x517dd7();})[_0xd184('0x20')](function(_0x2b4565){_0x517dd7(_0x2b4565);});},'afterUpdate':function(_0x53aff1,_0x5f08a5,_0x637616){return _0x48330c['VoiceExtension'][_0xd184('0x21')]({'where':{'ChanSpyId':_0x53aff1['id']}})['then'](function(){return getChanSpyPromise(_0x48330c,_0x53aff1);})[_0xd184('0x1a')](function(_0x579aa8){if(_0x579aa8&&_0x579aa8[_0xd184('0x16')]){return _0x48330c['VoiceExtension'][_0xd184('0x1f')](_0x579aa8);}})[_0xd184('0x1a')](function(){_0x637616();})['catch'](function(_0x3e0298){_0x637616(_0x3e0298);});},'afterDestroy':function(_0x533908,_0x2e503c,_0x436824){return _0x48330c['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x533908['id']}})['then'](function(){_0x436824();})[_0xd184('0x20')](function(_0xf78f16){_0x436824(_0xf78f16);});}}});}; \ No newline at end of file +var _0xba2e=['password','ChanSpy','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','exports','models','define','voice_chanspy','then','VoiceExtension','destroy','bulkCreate','lodash','util','from-sip','format','%s%s','merge','Set','CDR(type)=%s','chanspy','MixMonitor','auth','push'];(function(_0x450b1b,_0x1847b8){var _0x57481f=function(_0xe0da7b){while(--_0xe0da7b){_0x450b1b['push'](_0x450b1b['shift']());}};_0x57481f(++_0x1847b8);}(_0xba2e,0x15f));var _0xeba2=function(_0x44a3da,_0x1b3f44){_0x44a3da=_0x44a3da-0x0;var _0xaf07f8=_0xba2e[_0x44a3da];return _0xaf07f8;};'use strict';var _=require(_0xeba2('0x0'));var util=require(_0xeba2('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x552596,_0x225a76,_0x43ea54){var _0x39916f=0x1;var _0x599a6a=[];var _0x35c768={'context':_0x225a76['context']||_0xeba2('0x2'),'exten':util[_0xeba2('0x3')](_0xeba2('0x4'),_0x552596['prefix'],_0x43ea54),'type':'system','isApp':![],'ChanSpyId':_0x552596['id'],'UserId':_0x225a76['id']};_0x599a6a['push'](_[_0xeba2('0x5')]({'app':_0xeba2('0x6'),'appdata':util['format'](_0xeba2('0x7'),_0xeba2('0x8')),'priority':_0x39916f++},_0x35c768));if(_0x552596['record']){_0x599a6a['push'](_[_0xeba2('0x5')]({'app':_0xeba2('0x9'),'appdata':util[_0xeba2('0x3')]('${UNIQUEID}.%s,a',_0x552596['recordingFormat']),'priority':_0x39916f++},_0x35c768));}if(_0x552596[_0xeba2('0xa')]){_0x599a6a[_0xeba2('0xb')](_[_0xeba2('0x5')]({'app':'Authenticate','appdata':_0x552596[_0xeba2('0xc')],'priority':_0x39916f++},_0x35c768));}_0x599a6a[_0xeba2('0xb')](_[_0xeba2('0x5')]({'app':_0xeba2('0xd'),'appdata':util['format']('SIP/%s,%s',_0x225a76[_0xeba2('0xe')],_0x552596[_0xeba2('0xf')]?_0x552596[_0xeba2('0xf')][_0xeba2('0x10')](''):''),'priority':_0x39916f++},_0x35c768));if(_0x552596['record']){_0x599a6a[_0xeba2('0xb')](_[_0xeba2('0x5')]({'app':_0xeba2('0x11'),'priority':_0x39916f++},_0x35c768));}return _0x599a6a;};var getChanSpyApplications=function(_0x287089,_0x27ec84){var _0x3807f8=[];for(var _0x527ee8=0x0,_0x3fd867=0x1;_0x527ee8<_0x27ec84[_0xeba2('0x12')];_0x527ee8++,_0x3fd867=0x1){_0x3807f8=_0x3807f8[_0xeba2('0x13')](getUserApplications(_0x287089,_0x27ec84[_0x527ee8],_0x27ec84[_0x527ee8][_0xeba2('0x14')]));if(_0x27ec84[_0x527ee8][_0xeba2('0x14')]!=_0x27ec84[_0x527ee8][_0xeba2('0xe')]){_0x3807f8=_0x3807f8['concat'](getUserApplications(_0x287089,_0x27ec84[_0x527ee8],_0x27ec84[_0x527ee8][_0xeba2('0xe')]));}}return _0x3807f8;};var getChanSpyPromise=function(_0x5a514a,_0x4b9ed7){return new BPromise(function(_0x47e2ee,_0x16177a){return _0x5a514a[_0xeba2('0x15')][_0xeba2('0x16')]({'attributes':['id',_0xeba2('0xe'),_0xeba2('0x14')],'where':{'role':_0xeba2('0x17'),'chanspy':!![]},'raw':!![]})['then'](function(_0x5a7a7a){if(_0x5a7a7a){return _0x47e2ee(getChanSpyApplications(_0x4b9ed7,_0x5a7a7a));}return _0x47e2ee([]);})[_0xeba2('0x18')](function(_0x43bbbf){_0x16177a(_0x43bbbf);});});};module[_0xeba2('0x19')]=function(_0x1963e0,_0x464c0b){var _0x10ca98=_0x1963e0[_0xeba2('0x1a')];return _0x1963e0[_0xeba2('0x1b')]('VoiceChanSpy',attributes,{'tableName':_0xeba2('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x492bf6,_0x32ac86,_0x105453){return getChanSpyPromise(_0x10ca98,_0x492bf6)[_0xeba2('0x1d')](function(_0x51c839){if(_0x51c839&&_0x51c839[_0xeba2('0x12')]){return _0x10ca98[_0xeba2('0x1e')]['bulkCreate'](_0x51c839);}})[_0xeba2('0x1d')](function(){_0x105453();})[_0xeba2('0x18')](function(_0x2363ce){_0x105453(_0x2363ce);});},'afterUpdate':function(_0x2791d8,_0x572f8c,_0x51be33){return _0x10ca98[_0xeba2('0x1e')][_0xeba2('0x1f')]({'where':{'ChanSpyId':_0x2791d8['id']}})[_0xeba2('0x1d')](function(){return getChanSpyPromise(_0x10ca98,_0x2791d8);})[_0xeba2('0x1d')](function(_0x5ed984){if(_0x5ed984&&_0x5ed984['length']){return _0x10ca98[_0xeba2('0x1e')][_0xeba2('0x20')](_0x5ed984);}})[_0xeba2('0x1d')](function(){_0x51be33();})['catch'](function(_0x24895f){_0x51be33(_0x24895f);});},'afterDestroy':function(_0x22645b,_0x5d2796,_0x4416eb){return _0x10ca98[_0xeba2('0x1e')]['destroy']({'where':{'ChanSpyId':_0x22645b['id']}})[_0xeba2('0x1d')](function(){_0x4416eb();})[_0xeba2('0x18')](function(_0xf17643){_0x4416eb(_0xf17643);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 96949ea..b6fd8ed 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 _0xdace=['request\x20sent','debug','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xdace,0xc5));var _0xedac=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0xdace[_0x5c4f6b];return _0x104c4e;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file +var _0x6308=['stringify','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6308,0x1f2));var _0x8630=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6308[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x8630('0x0'));var util=require('util');var moment=require(_0x8630('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8630('0x2'));var db=require(_0x8630('0x3'))['db'];var utils=require(_0x8630('0x4'));var logger=require(_0x8630('0x5'))(_0x8630('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8630('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x337086,_0x3d5a10,_0x1bcfea){return new BPromise(function(_0x2b87ea,_0x10cc17){return client[_0x8630('0x8')](_0x337086,_0x1bcfea)['then'](function(_0x8b3652){logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));logger[_0x8630('0xb')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3d5a10,_0x8630('0xa'),JSON[_0x8630('0xc')](_0x8b3652));if(_0x8b3652[_0x8630('0xd')]){if(_0x8b3652['error'][_0x8630('0xe')]===0x1f4){logger[_0x8630('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3d5a10,_0x8b3652['error'][_0x8630('0xf')]);return _0x10cc17(_0x8b3652[_0x8630('0xd')]['message']);}logger[_0x8630('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3d5a10,_0x8b3652[_0x8630('0xd')]['message']);return _0x2b87ea(_0x8b3652[_0x8630('0xd')]['message']);}else{logger['info'](_0x8630('0x9'),_0x3d5a10,_0x8630('0xa'));_0x2b87ea(_0x8b3652['result']['message']);}})[_0x8630('0x10')](function(_0x547667){logger[_0x8630('0xd')](_0x8630('0x9'),_0x3d5a10,_0x547667);_0x10cc17(_0x547667);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 18a9ff2..a540eff 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 _0x2346=['isAuthenticated','index','/:id','show','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x55cc58,_0x5ce0af){var _0x26062e=function(_0x59e29d){while(--_0x59e29d){_0x55cc58['push'](_0x55cc58['shift']());}};_0x26062e(++_0x5ce0af);}(_0x2346,0x1b8));var _0x6234=function(_0x202aa2,_0x584b66){_0x202aa2=_0x202aa2-0x0;var _0x4e8000=_0x2346[_0x202aa2];return _0x4e8000;};'use strict';var multer=require(_0x6234('0x0'));var util=require(_0x6234('0x1'));var path=require(_0x6234('0x2'));var timeout=require(_0x6234('0x3'));var express=require(_0x6234('0x4'));var router=express[_0x6234('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6234('0x6'));var interaction=require(_0x6234('0x7'));var config=require(_0x6234('0x8'));var controller=require('./voiceContext.controller');router[_0x6234('0x9')]('/',auth[_0x6234('0xa')](),controller[_0x6234('0xb')]);router[_0x6234('0x9')](_0x6234('0xc'),auth['isAuthenticated'](),controller[_0x6234('0xd')]);router[_0x6234('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6234('0xf')]);router['delete'](_0x6234('0xc'),auth[_0x6234('0xa')](),controller[_0x6234('0x10')]);module[_0x6234('0x11')]=router; \ No newline at end of file +var _0x995a=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy','exports','multer','util'];(function(_0x1e271f,_0xf14504){var _0x2b2ac5=function(_0x21c3b6){while(--_0x21c3b6){_0x1e271f['push'](_0x1e271f['shift']());}};_0x2b2ac5(++_0xf14504);}(_0x995a,0xfd));var _0xa995=function(_0x3e7b8c,_0xb6f78d){_0x3e7b8c=_0x3e7b8c-0x0;var _0x40d533=_0x995a[_0x3e7b8c];return _0x40d533;};'use strict';var multer=require(_0xa995('0x0'));var util=require(_0xa995('0x1'));var path=require('path');var timeout=require(_0xa995('0x2'));var express=require(_0xa995('0x3'));var router=express['Router']();var fs_extra=require(_0xa995('0x4'));var auth=require(_0xa995('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa995('0x6'));var controller=require(_0xa995('0x7'));router[_0xa995('0x8')]('/',auth[_0xa995('0x9')](),controller['index']);router[_0xa995('0x8')](_0xa995('0xa'),auth['isAuthenticated'](),controller[_0xa995('0xb')]);router['post']('/',auth[_0xa995('0x9')](),controller[_0xa995('0xc')]);router[_0xa995('0xd')](_0xa995('0xa'),auth[_0xa995('0x9')](),controller['update']);router[_0xa995('0xe')](_0xa995('0xa'),auth['isAuthenticated'](),controller[_0xa995('0xf')]);module[_0xa995('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 8c4e2d5..1c2f330 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 _0xce9e=['exports','STRING','BOOLEAN','sequelize'];(function(_0xe05e9a,_0xd16e7c){var _0x15061b=function(_0x56c238){while(--_0x56c238){_0xe05e9a['push'](_0xe05e9a['shift']());}};_0x15061b(++_0xd16e7c);}(_0xce9e,0x87));var _0xece9=function(_0x7c7a41,_0x11a170){_0x7c7a41=_0x7c7a41-0x0;var _0x5c09d3=_0xce9e[_0x7c7a41];return _0x5c09d3;};'use strict';var Sequelize=require(_0xece9('0x0'));module[_0xece9('0x1')]={'name':{'type':Sequelize[_0xece9('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xece9('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xece9('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa311=['STRING','name','BOOLEAN','exports'];(function(_0x308502,_0x275f8f){var _0x3004c6=function(_0xab552f){while(--_0xab552f){_0x308502['push'](_0x308502['shift']());}};_0x3004c6(++_0x275f8f);}(_0xa311,0x193));var _0x1a31=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa311[_0x5c3c0b];return _0x52ecd2;};'use strict';var Sequelize=require('sequelize');module[_0x1a31('0x0')]={'name':{'type':Sequelize[_0x1a31('0x1')],'unique':_0x1a31('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x1a31('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 136dbd7..407f62a 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 _0x74e9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','chan_sip.so','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','map','VoiceContext','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x74e9,0x68));var _0x974e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x74e9[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x974e('0x0'));var rimraf=require(_0x974e('0x1'));var zipdir=require(_0x974e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x974e('0x3'));var BPromise=require(_0x974e('0x4'));var Mustache=require(_0x974e('0x5'));var util=require(_0x974e('0x6'));var path=require('path');var sox=require(_0x974e('0x7'));var csv=require(_0x974e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x974e('0x9'));var _=require(_0x974e('0xa'));var squel=require(_0x974e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x974e('0x8'));var querystring=require(_0x974e('0xc'));var Papa=require('papaparse');var Redis=require(_0x974e('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x974e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x974e('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x974e('0x10'));var config=require(_0x974e('0x11'));var licenseUtil=require(_0x974e('0x12'));var db=require(_0x974e('0x13'))['db'];var jayson=require(_0x974e('0x14'));var client=jayson[_0x974e('0x15')][_0x974e('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2a990e,_0x498281,_0x170852,_0x2b8543){return new BPromise(function(_0xadc815,_0x4cb8c8){var _0x2b95d0=_0x2b8543||client;return _0x2b95d0[_0x974e('0x17')](_0x2a990e,_0x170852)[_0x974e('0x18')](function(_0x4cf72e){logger[_0x974e('0x19')](_0x974e('0x1a'),_0x498281,_0x974e('0x1b'));logger['debug'](_0x974e('0x1c'),_0x498281,_0x974e('0x1b'),JSON[_0x974e('0x1d')](_0x4cf72e));if(_0x4cf72e[_0x974e('0x1e')]){if(_0x4cf72e['error']['code']===0x1f4){logger[_0x974e('0x1e')](_0x974e('0x1a'),_0x498281,_0x4cf72e[_0x974e('0x1e')][_0x974e('0x1f')]);return _0x4cb8c8(_0x4cf72e['error'][_0x974e('0x1f')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x498281,_0x4cf72e['error'][_0x974e('0x1f')]);return _0xadc815(_0x4cf72e['error'][_0x974e('0x1f')]);}else{logger[_0x974e('0x19')](_0x974e('0x1a'),_0x498281,_0x974e('0x1b'));_0xadc815(_0x4cf72e[_0x974e('0x20')][_0x974e('0x1f')]);}})[_0x974e('0x21')](function(_0x27f13c){logger[_0x974e('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x498281,_0x27f13c);_0x4cb8c8(_0x27f13c);});});}function respondWithStatusCode(_0x3965af,_0xaf7739){_0xaf7739=_0xaf7739||0xcc;return function(_0x14460b){if(_0x14460b){return _0x3965af['sendStatus'](_0xaf7739);}return _0x3965af[_0x974e('0x22')](_0xaf7739)[_0x974e('0x23')]();};}function respondWithResult(_0x544ff9,_0x3c52d7){_0x3c52d7=_0x3c52d7||0xc8;return function(_0x73715e){if(_0x73715e){return _0x544ff9[_0x974e('0x22')](_0x3c52d7)[_0x974e('0x24')](_0x73715e);}};}function respondWithFilteredResult(_0x10ac25,_0x57b80f){return function(_0xe2329d){if(_0xe2329d){var _0x86baab=typeof _0x57b80f[_0x974e('0x25')]==='undefined'&&typeof _0x57b80f['limit']===_0x974e('0x26');var _0x538c58=_0xe2329d[_0x974e('0x27')];var _0x580140=_0x86baab?0x0:_0x57b80f['offset'];var _0x4b0ee7=_0x86baab?_0xe2329d['count']:_0x57b80f[_0x974e('0x25')]+_0x57b80f['limit'];var _0x14e9c2;if(_0x4b0ee7>=_0x538c58){_0x4b0ee7=_0x538c58;_0x14e9c2=0xc8;}else{_0x14e9c2=0xce;}_0x10ac25['status'](_0x14e9c2);return _0x10ac25[_0x974e('0x28')]('Content-Range',_0x580140+'-'+_0x4b0ee7+'/'+_0x538c58)[_0x974e('0x24')](_0xe2329d);}return null;};}function patchUpdates(_0x4eb69f){return function(_0x4a6422){try{jsonpatch[_0x974e('0x29')](_0x4a6422,_0x4eb69f,!![]);}catch(_0x42087a){return BPromise[_0x974e('0x2a')](_0x42087a);}return _0x4a6422[_0x974e('0x2b')]();};}function saveUpdates(_0x3d76a2,_0x2ee52b){return function(_0x88a248){if(_0x88a248){return _0x88a248[_0x974e('0x2c')](_0x3d76a2)['then'](function(_0x51b7c7){return _0x51b7c7;});}return null;};}function removeEntity(_0x4075d7,_0x1f57e0){return function(_0x4b082a){if(_0x4b082a){return _0x4b082a[_0x974e('0x2d')]()[_0x974e('0x18')](function(){var _0x9e3c0e=_0x4b082a[_0x974e('0x2e')]({'plain':!![]});var _0x49f408=_0x974e('0x2f');return db[_0x974e('0x30')][_0x974e('0x2d')]({'where':{'type':_0x49f408,'resourceId':_0x9e3c0e['id']}})[_0x974e('0x18')](function(){return _0x4b082a;});})[_0x974e('0x18')](function(){_0x4075d7[_0x974e('0x22')](0xcc)[_0x974e('0x23')]();});}};}function handleEntityNotFound(_0x2db7a9,_0x3431a7){return function(_0x2288e5){if(!_0x2288e5){_0x2db7a9['sendStatus'](0x194);}return _0x2288e5;};}function handleError(_0x3c08c3,_0x3126aa){_0x3126aa=_0x3126aa||0x1f4;return function(_0x58315b){logger['error'](_0x58315b[_0x974e('0x31')]);if(_0x58315b[_0x974e('0x32')]){delete _0x58315b[_0x974e('0x32')];}_0x3c08c3[_0x974e('0x22')](_0x3126aa)[_0x974e('0x33')](_0x58315b);};}exports['index']=function(_0x6fb29e,_0x3465df){var _0x2e44fb={},_0x494543={},_0x1dbf39={'count':0x0,'rows':[]};var _0x20e603=_[_0x974e('0x34')](db[_0x974e('0x35')]['rawAttributes'],function(_0x51c870){return{'name':_0x51c870[_0x974e('0x36')],'type':_0x51c870[_0x974e('0x37')][_0x974e('0x38')]};});_0x494543[_0x974e('0x39')]=_[_0x974e('0x34')](_0x20e603,_0x974e('0x32'));_0x494543[_0x974e('0x3a')]=_[_0x974e('0x3b')](_0x6fb29e['query']);_0x494543[_0x974e('0x3c')]=_[_0x974e('0x3d')](_0x494543[_0x974e('0x39')],_0x494543[_0x974e('0x3a')]);_0x2e44fb['attributes']=_['intersection'](_0x494543[_0x974e('0x39')],qs[_0x974e('0x3e')](_0x6fb29e[_0x974e('0x3a')]['fields']));_0x2e44fb[_0x974e('0x3f')]=_0x2e44fb[_0x974e('0x3f')][_0x974e('0x40')]?_0x2e44fb[_0x974e('0x3f')]:_0x494543[_0x974e('0x39')];if(!_0x6fb29e['query'][_0x974e('0x41')](_0x974e('0x42'))){_0x2e44fb[_0x974e('0x43')]=qs[_0x974e('0x43')](_0x6fb29e['query'][_0x974e('0x43')]);_0x2e44fb[_0x974e('0x25')]=qs['offset'](_0x6fb29e[_0x974e('0x3a')]['offset']);}_0x2e44fb[_0x974e('0x44')]=qs[_0x974e('0x45')](_0x6fb29e['query'][_0x974e('0x45')]);_0x2e44fb['where']=qs['filters'](_['pick'](_0x6fb29e[_0x974e('0x3a')],_0x494543[_0x974e('0x3c')]),_0x20e603);if(_0x6fb29e[_0x974e('0x3a')][_0x974e('0x46')]){_0x2e44fb[_0x974e('0x47')]=_[_0x974e('0x48')](_0x2e44fb['where'],{'$or':_[_0x974e('0x34')](_0x20e603,function(_0x5dd924){if(_0x5dd924['type']!==_0x974e('0x49')){var _0x2e6bd4={};_0x2e6bd4[_0x5dd924[_0x974e('0x32')]]={'$like':'%'+_0x6fb29e[_0x974e('0x3a')][_0x974e('0x46')]+'%'};return _0x2e6bd4;}})});}_0x2e44fb=_['merge']({},_0x2e44fb,_0x6fb29e[_0x974e('0x4a')]);var _0x4bd44a={'where':_0x2e44fb[_0x974e('0x47')]};return db[_0x974e('0x35')][_0x974e('0x27')](_0x4bd44a)['then'](function(_0x342251){_0x1dbf39['count']=_0x342251;if(_0x6fb29e[_0x974e('0x3a')][_0x974e('0x4b')]){_0x2e44fb[_0x974e('0x4c')]=[{'all':!![]}];}return db[_0x974e('0x35')][_0x974e('0x4d')](_0x2e44fb);})[_0x974e('0x18')](function(_0x2182cd){_0x1dbf39['rows']=_0x2182cd;return _0x1dbf39;})[_0x974e('0x18')](respondWithFilteredResult(_0x3465df,_0x2e44fb))[_0x974e('0x21')](handleError(_0x3465df,null));};exports['show']=function(_0x30e9e0,_0x66db8c){var _0x1bc809={'raw':![],'where':{'id':_0x30e9e0[_0x974e('0x4e')]['id']}},_0x4247b6={};_0x4247b6[_0x974e('0x39')]=_['keys'](db[_0x974e('0x35')][_0x974e('0x4f')]);_0x4247b6[_0x974e('0x3a')]=_[_0x974e('0x3b')](_0x30e9e0[_0x974e('0x3a')]);_0x4247b6[_0x974e('0x3c')]=_[_0x974e('0x3d')](_0x4247b6[_0x974e('0x39')],_0x4247b6[_0x974e('0x3a')]);_0x1bc809['attributes']=_['intersection'](_0x4247b6[_0x974e('0x39')],qs[_0x974e('0x3e')](_0x30e9e0[_0x974e('0x3a')][_0x974e('0x3e')]));_0x1bc809[_0x974e('0x3f')]=_0x1bc809[_0x974e('0x3f')][_0x974e('0x40')]?_0x1bc809['attributes']:_0x4247b6[_0x974e('0x39')];if(_0x30e9e0['query'][_0x974e('0x4b')]){_0x1bc809[_0x974e('0x4c')]=[{'all':!![]}];}_0x1bc809=_['merge']({},_0x1bc809,_0x30e9e0['options']);return db[_0x974e('0x35')][_0x974e('0x50')](_0x1bc809)['then'](handleEntityNotFound(_0x66db8c,null))[_0x974e('0x18')](respondWithResult(_0x66db8c,null))['catch'](handleError(_0x66db8c,null));};exports['create']=function(_0x2300b0,_0x18a1b6,_0x3acc96){var _0x3509a5;return db[_0x974e('0x35')][_0x974e('0x51')](_0x2300b0[_0x974e('0x52')],{'raw':!![]})[_0x974e('0x18')](function(_0x9d5a6e){_0x3509a5=_0x9d5a6e;return db[_0x974e('0x35')]['findAll']({'raw':!![]});})[_0x974e('0x18')](function(_0x460130){var _0x66dc29=fs[_0x974e('0x53')](path[_0x974e('0x54')](config[_0x974e('0x55')],_0x974e('0x56')),_0x974e('0x57'));var _0x98ab0e=ejs[_0x974e('0x58')](_0x66dc29,{'contexts':_0x460130||[]});fs[_0x974e('0x59')](_0x974e('0x5a'),_0x98ab0e);})[_0x974e('0x18')](function(){return respondWithRpcPromise(_0x974e('0x5b'),_0x974e('0x51'),{'module':'chan_sip.so'});})[_0x974e('0x18')](function(){var _0xb53dcf=_0x2300b0[_0x974e('0x5c')][_0x974e('0x2e')]({'plain':!![]});if(!_0xb53dcf)throw new Error(_0x974e('0x5d'));if(_0xb53dcf[_0x974e('0x5e')]===_0x974e('0x5c')){var _0x46f6ae=_0x3509a5[_0x974e('0x2e')]({'plain':!![]});return db['UserProfileSection'][_0x974e('0x50')]({'where':{'name':'Contexts','userProfileId':_0xb53dcf[_0x974e('0x5f')]},'raw':!![]})[_0x974e('0x18')](function(_0x41896f){if(_0x41896f&&_0x41896f[_0x974e('0x60')]===0x0){return db[_0x974e('0x30')][_0x974e('0x51')]({'name':_0x46f6ae['name'],'resourceId':_0x46f6ae['id'],'type':_0x41896f[_0x974e('0x32')],'sectionId':_0x41896f['id']},{})[_0x974e('0x18')](function(){return _0x3509a5;});}else{return _0x3509a5;}})[_0x974e('0x21')](function(_0x30334a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30334a);throw _0x30334a;});}return _0x3509a5;})[_0x974e('0x18')](respondWithResult(_0x18a1b6,0xc9))[_0x974e('0x21')](handleError(_0x18a1b6,null));};exports[_0x974e('0x2c')]=function(_0x3c3a33,_0x3031e3,_0x2d4f5f){var _0x456388;return db[_0x974e('0x35')]['find']({'where':{'id':_0x3c3a33[_0x974e('0x4e')]['id']}})[_0x974e('0x18')](handleEntityNotFound(_0x3031e3,null))[_0x974e('0x18')](saveUpdates(_0x3c3a33[_0x974e('0x52')],null))[_0x974e('0x18')](function(_0xae5f5b){if(_0xae5f5b){_0x456388=_0xae5f5b;return db[_0x974e('0x35')][_0x974e('0x4d')]({'raw':!![]});}})[_0x974e('0x18')](function(_0x50baef){var _0x24b118=fs[_0x974e('0x53')](path[_0x974e('0x54')](config['root'],_0x974e('0x56')),_0x974e('0x57'));var _0x488f1f=ejs[_0x974e('0x58')](_0x24b118,{'contexts':_0x50baef||[]});fs[_0x974e('0x59')](_0x974e('0x5a'),_0x488f1f);})[_0x974e('0x18')](function(){return respondWithRpcPromise(_0x974e('0x5b'),_0x974e('0x2c'),{'module':_0x974e('0x61')});})[_0x974e('0x18')](function(){return _0x456388;})[_0x974e('0x18')](respondWithResult(_0x3031e3,null))[_0x974e('0x21')](handleError(_0x3031e3,null));};exports[_0x974e('0x2d')]=function(_0xb6e3ee,_0x903902,_0x49db96){var _0x318fc8;return db['VoiceContext'][_0x974e('0x50')]({'where':{'id':_0xb6e3ee['params']['id']}})[_0x974e('0x18')](handleEntityNotFound(_0x903902,null))[_0x974e('0x18')](removeEntity(_0x903902,null))['then'](function(){return db[_0x974e('0x35')]['findAll']({'raw':!![]});})[_0x974e('0x18')](function(_0x2dca44){var _0x272297=fs[_0x974e('0x53')](path[_0x974e('0x54')](config[_0x974e('0x55')],_0x974e('0x56')),_0x974e('0x57'));var _0x22d803=ejs['render'](_0x272297,{'contexts':_0x2dca44});fs[_0x974e('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x22d803);return respondWithRpcPromise('Reload','destroy',{'module':_0x974e('0x61')});})[_0x974e('0x21')](handleError(_0x903902,null));}; \ No newline at end of file +var _0xc9d2=['VoiceContext,\x20%s,\x20%s','message','result','catch','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','Contexts','destroy','sendStatus','name','send','map','VoiceContext','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','options','find','create','body','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','server/files/templates/context.ejs','render','Reload','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x8edb99,_0x535523){var _0x564460=function(_0x4e13d3){while(--_0x4e13d3){_0x8edb99['push'](_0x8edb99['shift']());}};_0x564460(++_0x535523);}(_0xc9d2,0x184));var _0x2c9d=function(_0x8f8e0b,_0x474bac){_0x8f8e0b=_0x8f8e0b-0x0;var _0x2aa030=_0xc9d2[_0x8f8e0b];return _0x2aa030;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2c9d('0x0'));var zipdir=require(_0x2c9d('0x1'));var jsonpatch=require(_0x2c9d('0x2'));var rp=require(_0x2c9d('0x3'));var moment=require(_0x2c9d('0x4'));var BPromise=require(_0x2c9d('0x5'));var Mustache=require(_0x2c9d('0x6'));var util=require(_0x2c9d('0x7'));var path=require('path');var sox=require(_0x2c9d('0x8'));var csv=require('to-csv');var ejs=require(_0x2c9d('0x9'));var fs=require('fs');var fs_extra=require(_0x2c9d('0xa'));var _=require(_0x2c9d('0xb'));var squel=require(_0x2c9d('0xc'));var crypto=require(_0x2c9d('0xd'));var jsforce=require(_0x2c9d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2c9d('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2c9d('0x10'));var authService=require(_0x2c9d('0x11'));var qs=require(_0x2c9d('0x12'));var as=require(_0x2c9d('0x13'));var hardwareService=require(_0x2c9d('0x14'));var logger=require(_0x2c9d('0x15'))(_0x2c9d('0x16'));var utils=require('../../config/utils');var config=require(_0x2c9d('0x17'));var licenseUtil=require(_0x2c9d('0x18'));var db=require(_0x2c9d('0x19'))['db'];var jayson=require(_0x2c9d('0x1a'));var client=jayson[_0x2c9d('0x1b')][_0x2c9d('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x339f85,_0xcceb0f,_0x1e5d5b,_0xdef15){return new BPromise(function(_0x2bff3c,_0x25ef0c){var _0x43fa0f=_0xdef15||client;return _0x43fa0f[_0x2c9d('0x1d')](_0x339f85,_0x1e5d5b)['then'](function(_0x2e2969){logger[_0x2c9d('0x1e')]('VoiceContext,\x20%s,\x20%s',_0xcceb0f,_0x2c9d('0x1f'));logger[_0x2c9d('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xcceb0f,_0x2c9d('0x1f'),JSON[_0x2c9d('0x21')](_0x2e2969));if(_0x2e2969[_0x2c9d('0x22')]){if(_0x2e2969[_0x2c9d('0x22')][_0x2c9d('0x23')]===0x1f4){logger[_0x2c9d('0x22')](_0x2c9d('0x24'),_0xcceb0f,_0x2e2969['error'][_0x2c9d('0x25')]);return _0x25ef0c(_0x2e2969[_0x2c9d('0x22')][_0x2c9d('0x25')]);}logger[_0x2c9d('0x22')](_0x2c9d('0x24'),_0xcceb0f,_0x2e2969[_0x2c9d('0x22')]['message']);return _0x2bff3c(_0x2e2969[_0x2c9d('0x22')][_0x2c9d('0x25')]);}else{logger['info'](_0x2c9d('0x24'),_0xcceb0f,_0x2c9d('0x1f'));_0x2bff3c(_0x2e2969[_0x2c9d('0x26')][_0x2c9d('0x25')]);}})[_0x2c9d('0x27')](function(_0x496898){logger['error'](_0x2c9d('0x24'),_0xcceb0f,_0x496898);_0x25ef0c(_0x496898);});});}function respondWithStatusCode(_0x48c596,_0x34abbc){_0x34abbc=_0x34abbc||0xcc;return function(_0x7e2b0e){if(_0x7e2b0e){return _0x48c596['sendStatus'](_0x34abbc);}return _0x48c596[_0x2c9d('0x28')](_0x34abbc)[_0x2c9d('0x29')]();};}function respondWithResult(_0x52d5a8,_0x29c980){_0x29c980=_0x29c980||0xc8;return function(_0x5e5abe){if(_0x5e5abe){return _0x52d5a8[_0x2c9d('0x28')](_0x29c980)['json'](_0x5e5abe);}};}function respondWithFilteredResult(_0x307623,_0x2439b3){return function(_0x43fac5){if(_0x43fac5){var _0x197c80=typeof _0x2439b3[_0x2c9d('0x2a')]===_0x2c9d('0x2b')&&typeof _0x2439b3['limit']==='undefined';var _0x60063f=_0x43fac5[_0x2c9d('0x2c')];var _0x4f78ce=_0x197c80?0x0:_0x2439b3['offset'];var _0x435f59=_0x197c80?_0x43fac5[_0x2c9d('0x2c')]:_0x2439b3[_0x2c9d('0x2a')]+_0x2439b3['limit'];var _0x407c09;if(_0x435f59>=_0x60063f){_0x435f59=_0x60063f;_0x407c09=0xc8;}else{_0x407c09=0xce;}_0x307623[_0x2c9d('0x28')](_0x407c09);return _0x307623['set'](_0x2c9d('0x2d'),_0x4f78ce+'-'+_0x435f59+'/'+_0x60063f)[_0x2c9d('0x2e')](_0x43fac5);}return null;};}function patchUpdates(_0x20dd58){return function(_0x5c3cc1){try{jsonpatch[_0x2c9d('0x2f')](_0x5c3cc1,_0x20dd58,!![]);}catch(_0x539578){return BPromise[_0x2c9d('0x30')](_0x539578);}return _0x5c3cc1[_0x2c9d('0x31')]();};}function saveUpdates(_0x40fc32,_0x14df3a){return function(_0x305b58){if(_0x305b58){return _0x305b58[_0x2c9d('0x32')](_0x40fc32)[_0x2c9d('0x33')](function(_0x3497f1){return _0x3497f1;});}return null;};}function removeEntity(_0x3bf56e,_0xebe91c){return function(_0x2294e9){if(_0x2294e9){return _0x2294e9['destroy']()['then'](function(){var _0x5cf769=_0x2294e9['get']({'plain':!![]});var _0x123460=_0x2c9d('0x34');return db['UserProfileResource'][_0x2c9d('0x35')]({'where':{'type':_0x123460,'resourceId':_0x5cf769['id']}})['then'](function(){return _0x2294e9;});})[_0x2c9d('0x33')](function(){_0x3bf56e['status'](0xcc)[_0x2c9d('0x29')]();});}};}function handleEntityNotFound(_0x31ce0b,_0x1debf5){return function(_0x44ab1b){if(!_0x44ab1b){_0x31ce0b[_0x2c9d('0x36')](0x194);}return _0x44ab1b;};}function handleError(_0x143107,_0x4c41dd){_0x4c41dd=_0x4c41dd||0x1f4;return function(_0x5d3b20){logger['error'](_0x5d3b20['stack']);if(_0x5d3b20['name']){delete _0x5d3b20[_0x2c9d('0x37')];}_0x143107[_0x2c9d('0x28')](_0x4c41dd)[_0x2c9d('0x38')](_0x5d3b20);};}exports['index']=function(_0x4d96b0,_0x52c6a5){var _0x157e53={},_0x12e3d1={},_0xe7d01f={'count':0x0,'rows':[]};var _0x296a67=_[_0x2c9d('0x39')](db[_0x2c9d('0x3a')][_0x2c9d('0x3b')],function(_0x211a69){return{'name':_0x211a69[_0x2c9d('0x3c')],'type':_0x211a69[_0x2c9d('0x3d')]['key']};});_0x12e3d1[_0x2c9d('0x3e')]=_[_0x2c9d('0x39')](_0x296a67,_0x2c9d('0x37'));_0x12e3d1[_0x2c9d('0x3f')]=_[_0x2c9d('0x40')](_0x4d96b0['query']);_0x12e3d1[_0x2c9d('0x41')]=_[_0x2c9d('0x42')](_0x12e3d1[_0x2c9d('0x3e')],_0x12e3d1['query']);_0x157e53[_0x2c9d('0x43')]=_[_0x2c9d('0x42')](_0x12e3d1[_0x2c9d('0x3e')],qs[_0x2c9d('0x44')](_0x4d96b0[_0x2c9d('0x3f')][_0x2c9d('0x44')]));_0x157e53['attributes']=_0x157e53['attributes'][_0x2c9d('0x45')]?_0x157e53[_0x2c9d('0x43')]:_0x12e3d1[_0x2c9d('0x3e')];if(!_0x4d96b0[_0x2c9d('0x3f')][_0x2c9d('0x46')](_0x2c9d('0x47'))){_0x157e53[_0x2c9d('0x48')]=qs[_0x2c9d('0x48')](_0x4d96b0[_0x2c9d('0x3f')]['limit']);_0x157e53[_0x2c9d('0x2a')]=qs['offset'](_0x4d96b0[_0x2c9d('0x3f')][_0x2c9d('0x2a')]);}_0x157e53[_0x2c9d('0x49')]=qs[_0x2c9d('0x4a')](_0x4d96b0['query']['sort']);_0x157e53[_0x2c9d('0x4b')]=qs[_0x2c9d('0x41')](_[_0x2c9d('0x4c')](_0x4d96b0['query'],_0x12e3d1[_0x2c9d('0x41')]),_0x296a67);if(_0x4d96b0[_0x2c9d('0x3f')][_0x2c9d('0x4d')]){_0x157e53['where']=_[_0x2c9d('0x4e')](_0x157e53[_0x2c9d('0x4b')],{'$or':_[_0x2c9d('0x39')](_0x296a67,function(_0x32cae4){if(_0x32cae4[_0x2c9d('0x3d')]!==_0x2c9d('0x4f')){var _0x42a43e={};_0x42a43e[_0x32cae4[_0x2c9d('0x37')]]={'$like':'%'+_0x4d96b0[_0x2c9d('0x3f')][_0x2c9d('0x4d')]+'%'};return _0x42a43e;}})});}_0x157e53=_[_0x2c9d('0x4e')]({},_0x157e53,_0x4d96b0['options']);var _0x1121ec={'where':_0x157e53['where']};return db['VoiceContext'][_0x2c9d('0x2c')](_0x1121ec)[_0x2c9d('0x33')](function(_0x56b6b2){_0xe7d01f['count']=_0x56b6b2;if(_0x4d96b0['query'][_0x2c9d('0x50')]){_0x157e53[_0x2c9d('0x51')]=[{'all':!![]}];}return db[_0x2c9d('0x3a')][_0x2c9d('0x52')](_0x157e53);})['then'](function(_0x5bc96f){_0xe7d01f['rows']=_0x5bc96f;return _0xe7d01f;})[_0x2c9d('0x33')](respondWithFilteredResult(_0x52c6a5,_0x157e53))[_0x2c9d('0x27')](handleError(_0x52c6a5,null));};exports[_0x2c9d('0x53')]=function(_0x32aa8a,_0x424abb){var _0x24f2c4={'raw':![],'where':{'id':_0x32aa8a[_0x2c9d('0x54')]['id']}},_0x155095={};_0x155095[_0x2c9d('0x3e')]=_['keys'](db[_0x2c9d('0x3a')][_0x2c9d('0x3b')]);_0x155095['query']=_[_0x2c9d('0x40')](_0x32aa8a[_0x2c9d('0x3f')]);_0x155095[_0x2c9d('0x41')]=_[_0x2c9d('0x42')](_0x155095['model'],_0x155095[_0x2c9d('0x3f')]);_0x24f2c4[_0x2c9d('0x43')]=_['intersection'](_0x155095[_0x2c9d('0x3e')],qs[_0x2c9d('0x44')](_0x32aa8a['query'][_0x2c9d('0x44')]));_0x24f2c4[_0x2c9d('0x43')]=_0x24f2c4['attributes'][_0x2c9d('0x45')]?_0x24f2c4['attributes']:_0x155095[_0x2c9d('0x3e')];if(_0x32aa8a[_0x2c9d('0x3f')][_0x2c9d('0x50')]){_0x24f2c4[_0x2c9d('0x51')]=[{'all':!![]}];}_0x24f2c4=_['merge']({},_0x24f2c4,_0x32aa8a[_0x2c9d('0x55')]);return db[_0x2c9d('0x3a')][_0x2c9d('0x56')](_0x24f2c4)[_0x2c9d('0x33')](handleEntityNotFound(_0x424abb,null))[_0x2c9d('0x33')](respondWithResult(_0x424abb,null))[_0x2c9d('0x27')](handleError(_0x424abb,null));};exports['create']=function(_0x4cf4da,_0x112387,_0x479a87){var _0x514ffc;return db[_0x2c9d('0x3a')][_0x2c9d('0x57')](_0x4cf4da[_0x2c9d('0x58')],{'raw':!![]})[_0x2c9d('0x33')](function(_0xc61f42){_0x514ffc=_0xc61f42;return db[_0x2c9d('0x3a')][_0x2c9d('0x52')]({'raw':!![]});})[_0x2c9d('0x33')](function(_0x4d688a){var _0x2d7806=fs['readFileSync'](path['join'](config[_0x2c9d('0x59')],'server/files/templates/context.ejs'),_0x2c9d('0x5a'));var _0x154e4d=ejs['render'](_0x2d7806,{'contexts':_0x4d688a||[]});fs[_0x2c9d('0x5b')](_0x2c9d('0x5c'),_0x154e4d);})['then'](function(){return respondWithRpcPromise('Reload',_0x2c9d('0x57'),{'module':_0x2c9d('0x5d')});})[_0x2c9d('0x33')](function(){var _0x16615e=_0x4cf4da['user'][_0x2c9d('0x5e')]({'plain':!![]});if(!_0x16615e)throw new Error(_0x2c9d('0x5f'));if(_0x16615e[_0x2c9d('0x60')]===_0x2c9d('0x61')){var _0x4b1222=_0x514ffc[_0x2c9d('0x5e')]({'plain':!![]});return db[_0x2c9d('0x62')]['find']({'where':{'name':_0x2c9d('0x34'),'userProfileId':_0x16615e[_0x2c9d('0x63')]},'raw':!![]})['then'](function(_0x492c52){if(_0x492c52&&_0x492c52[_0x2c9d('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x4b1222['name'],'resourceId':_0x4b1222['id'],'type':_0x492c52[_0x2c9d('0x37')],'sectionId':_0x492c52['id']},{})[_0x2c9d('0x33')](function(){return _0x514ffc;});}else{return _0x514ffc;}})['catch'](function(_0x575cf6){logger[_0x2c9d('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x575cf6);throw _0x575cf6;});}return _0x514ffc;})[_0x2c9d('0x33')](respondWithResult(_0x112387,0xc9))[_0x2c9d('0x27')](handleError(_0x112387,null));};exports[_0x2c9d('0x32')]=function(_0x11d389,_0x137520,_0x4ae30a){var _0x43c31c;return db['VoiceContext']['find']({'where':{'id':_0x11d389['params']['id']}})[_0x2c9d('0x33')](handleEntityNotFound(_0x137520,null))[_0x2c9d('0x33')](saveUpdates(_0x11d389[_0x2c9d('0x58')],null))['then'](function(_0x29796f){if(_0x29796f){_0x43c31c=_0x29796f;return db[_0x2c9d('0x3a')]['findAll']({'raw':!![]});}})['then'](function(_0x3ff3ec){var _0x19d443=fs[_0x2c9d('0x65')](path[_0x2c9d('0x66')](config['root'],_0x2c9d('0x67')),'utf8');var _0x11fc56=ejs[_0x2c9d('0x68')](_0x19d443,{'contexts':_0x3ff3ec||[]});fs[_0x2c9d('0x5b')](_0x2c9d('0x5c'),_0x11fc56);})['then'](function(){return respondWithRpcPromise('Reload','update',{'module':_0x2c9d('0x5d')});})[_0x2c9d('0x33')](function(){return _0x43c31c;})[_0x2c9d('0x33')](respondWithResult(_0x137520,null))[_0x2c9d('0x27')](handleError(_0x137520,null));};exports[_0x2c9d('0x35')]=function(_0x17b82d,_0x350bf3,_0x12d7a0){var _0x24d4f8;return db['VoiceContext'][_0x2c9d('0x56')]({'where':{'id':_0x17b82d['params']['id']}})[_0x2c9d('0x33')](handleEntityNotFound(_0x350bf3,null))[_0x2c9d('0x33')](removeEntity(_0x350bf3,null))['then'](function(){return db[_0x2c9d('0x3a')]['findAll']({'raw':!![]});})[_0x2c9d('0x33')](function(_0x25c732){var _0x5715bd=fs[_0x2c9d('0x65')](path[_0x2c9d('0x66')](config[_0x2c9d('0x59')],_0x2c9d('0x67')),_0x2c9d('0x5a'));var _0xc1eb75=ejs[_0x2c9d('0x68')](_0x5715bd,{'contexts':_0x25c732});fs['writeFileSync'](_0x2c9d('0x5c'),_0xc1eb75);return respondWithRpcPromise(_0x2c9d('0x69'),_0x2c9d('0x35'),{'module':_0x2c9d('0x5d')});})[_0x2c9d('0x27')](handleError(_0x350bf3,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 3650c05..2073f49 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 _0x4e2e=['exports','define','VoiceContext','voice_contexts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x17f760,_0x56a09b){_0x17f760=_0x17f760-0x0;var _0xe9845=_0x4e2e[_0x17f760];return _0xe9845;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var logger=require(_0xe4e2('0x1'))(_0xe4e2('0x2'));var moment=require(_0xe4e2('0x3'));var BPromise=require(_0xe4e2('0x4'));var rp=require(_0xe4e2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4e2('0x6'));var config=require(_0xe4e2('0x7'));var attributes=require(_0xe4e2('0x8'));module[_0xe4e2('0x9')]=function(_0x48e83d,_0x322295){return _0x48e83d[_0xe4e2('0xa')](_0xe4e2('0xb'),attributes,{'tableName':_0xe4e2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd56=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x2a7331,_0x4c166c){var _0x9fdaa0=function(_0x3afb19){while(--_0x3afb19){_0x2a7331['push'](_0x2a7331['shift']());}};_0x9fdaa0(++_0x4c166c);}(_0xfd56,0x1d4));var _0x6fd5=function(_0x5ee4cc,_0x4fe51f){_0x5ee4cc=_0x5ee4cc-0x0;var _0x2e4ae2=_0xfd56[_0x5ee4cc];return _0x2e4ae2;};'use strict';var _=require(_0x6fd5('0x0'));var util=require('util');var logger=require(_0x6fd5('0x1'))(_0x6fd5('0x2'));var moment=require(_0x6fd5('0x3'));var BPromise=require(_0x6fd5('0x4'));var rp=require(_0x6fd5('0x5'));var fs=require('fs');var path=require(_0x6fd5('0x6'));var rimraf=require(_0x6fd5('0x7'));var config=require('../../config/environment');var attributes=require(_0x6fd5('0x8'));module[_0x6fd5('0x9')]=function(_0x2945af,_0x4420c6){return _0x2945af[_0x6fd5('0xa')](_0x6fd5('0xb'),attributes,{'tableName':_0x6fd5('0xc'),'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 6749ef9..64a2163 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 _0x6a5f=['randomstring','../../mysqldb','rpc','client','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x49d40d,_0x30e0ea){var _0x5ec463=function(_0x11bab1){while(--_0x11bab1){_0x49d40d['push'](_0x49d40d['shift']());}};_0x5ec463(++_0x30e0ea);}(_0x6a5f,0xbb));var _0xf6a5=function(_0x1f15bb,_0x4663fb){_0x1f15bb=_0x1f15bb-0x0;var _0x3a49ef=_0x6a5f[_0x1f15bb];return _0x3a49ef;};'use strict';var _=require(_0xf6a5('0x0'));var util=require(_0xf6a5('0x1'));var moment=require('moment');var BPromise=require(_0xf6a5('0x2'));var rs=require(_0xf6a5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6a5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf6a5('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf6a5('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3560d0,_0x2919fe,_0x4627d3){return new BPromise(function(_0x1e3360,_0x19facf){return client[_0xf6a5('0x7')](_0x3560d0,_0x4627d3)[_0xf6a5('0x8')](function(_0x3eaf83){logger[_0xf6a5('0x9')]('VoiceContext,\x20%s,\x20%s',_0x2919fe,_0xf6a5('0xa'));logger[_0xf6a5('0xb')](_0xf6a5('0xc'),_0x2919fe,_0xf6a5('0xa'),JSON[_0xf6a5('0xd')](_0x3eaf83));if(_0x3eaf83[_0xf6a5('0xe')]){if(_0x3eaf83[_0xf6a5('0xe')]['code']===0x1f4){logger[_0xf6a5('0xe')](_0xf6a5('0xf'),_0x2919fe,_0x3eaf83[_0xf6a5('0xe')][_0xf6a5('0x10')]);return _0x19facf(_0x3eaf83['error'][_0xf6a5('0x10')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x2919fe,_0x3eaf83[_0xf6a5('0xe')][_0xf6a5('0x10')]);return _0x1e3360(_0x3eaf83['error'][_0xf6a5('0x10')]);}else{logger[_0xf6a5('0x9')](_0xf6a5('0xf'),_0x2919fe,_0xf6a5('0xa'));_0x1e3360(_0x3eaf83[_0xf6a5('0x11')][_0xf6a5('0x10')]);}})[_0xf6a5('0x12')](function(_0x556a42){logger[_0xf6a5('0xe')]('VoiceContext,\x20%s,\x20%s',_0x2919fe,_0x556a42);_0x19facf(_0x556a42);});});} \ No newline at end of file +var _0x7fb3=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x57c611,_0x37f9e0){var _0x4c06ff=function(_0x3b3ea9){while(--_0x3b3ea9){_0x57c611['push'](_0x57c611['shift']());}};_0x4c06ff(++_0x37f9e0);}(_0x7fb3,0xf9));var _0x37fb=function(_0x3dd531,_0xedaa84){_0x3dd531=_0x3dd531-0x0;var _0x299141=_0x7fb3[_0x3dd531];return _0x299141;};'use strict';var _=require(_0x37fb('0x0'));var util=require(_0x37fb('0x1'));var moment=require(_0x37fb('0x2'));var BPromise=require(_0x37fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37fb('0x4'));var db=require(_0x37fb('0x5'))['db'];var utils=require(_0x37fb('0x6'));var logger=require(_0x37fb('0x7'))('rpc');var config=require(_0x37fb('0x8'));var jayson=require(_0x37fb('0x9'));var client=jayson[_0x37fb('0xa')][_0x37fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x144254,_0x39d6a3,_0x51b36a){return new BPromise(function(_0x5ab1f3,_0x4ee5e0){return client[_0x37fb('0xc')](_0x144254,_0x51b36a)[_0x37fb('0xd')](function(_0x1f4810){logger[_0x37fb('0xe')](_0x37fb('0xf'),_0x39d6a3,_0x37fb('0x10'));logger[_0x37fb('0x11')](_0x37fb('0x12'),_0x39d6a3,'request\x20sent',JSON['stringify'](_0x1f4810));if(_0x1f4810[_0x37fb('0x13')]){if(_0x1f4810[_0x37fb('0x13')][_0x37fb('0x14')]===0x1f4){logger[_0x37fb('0x13')](_0x37fb('0xf'),_0x39d6a3,_0x1f4810[_0x37fb('0x13')][_0x37fb('0x15')]);return _0x4ee5e0(_0x1f4810[_0x37fb('0x13')]['message']);}logger['error'](_0x37fb('0xf'),_0x39d6a3,_0x1f4810[_0x37fb('0x13')][_0x37fb('0x15')]);return _0x5ab1f3(_0x1f4810[_0x37fb('0x13')]['message']);}else{logger[_0x37fb('0xe')]('VoiceContext,\x20%s,\x20%s',_0x39d6a3,_0x37fb('0x10'));_0x5ab1f3(_0x1f4810[_0x37fb('0x16')][_0x37fb('0x15')]);}})[_0x37fb('0x17')](function(_0x42b5ce){logger[_0x37fb('0x13')](_0x37fb('0xf'),_0x39d6a3,_0x42b5ce);_0x4ee5e0(_0x42b5ce);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 148b6eb..f5bd550 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 _0x9063=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','multer','util'];(function(_0x301c86,_0x116aec){var _0x373e1c=function(_0x11d95b){while(--_0x11d95b){_0x301c86['push'](_0x301c86['shift']());}};_0x373e1c(++_0x116aec);}(_0x9063,0x1a2));var _0x3906=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x9063[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x3906('0x0'));var util=require(_0x3906('0x1'));var path=require(_0x3906('0x2'));var timeout=require(_0x3906('0x3'));var express=require(_0x3906('0x4'));var router=express[_0x3906('0x5')]();var fs_extra=require(_0x3906('0x6'));var auth=require(_0x3906('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3906('0x8'));var controller=require(_0x3906('0x9'));router[_0x3906('0xa')]('/',auth[_0x3906('0xb')](),controller[_0x3906('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x3906('0xd')]);router[_0x3906('0xa')](_0x3906('0xe'),auth['isAuthenticated'](),controller[_0x3906('0xf')]);router[_0x3906('0x10')]('/',auth['isAuthenticated'](),controller[_0x3906('0x11')]);router[_0x3906('0x12')](_0x3906('0xe'),auth['isAuthenticated'](),controller[_0x3906('0x13')]);router[_0x3906('0x14')]('/:id',auth[_0x3906('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcd92=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','describe','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x349598,_0x4382e5){var _0x33fa1b=function(_0x1c9a56){while(--_0x1c9a56){_0x349598['push'](_0x349598['shift']());}};_0x33fa1b(++_0x4382e5);}(_0xcd92,0x1b3));var _0x2cd9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcd92[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x2cd9('0x0'));var util=require(_0x2cd9('0x1'));var path=require(_0x2cd9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2cd9('0x3')]();var fs_extra=require(_0x2cd9('0x4'));var auth=require(_0x2cd9('0x5'));var interaction=require(_0x2cd9('0x6'));var config=require(_0x2cd9('0x7'));var controller=require(_0x2cd9('0x8'));router['get']('/',auth[_0x2cd9('0x9')](),controller[_0x2cd9('0xa')]);router[_0x2cd9('0xb')]('/describe',auth[_0x2cd9('0x9')](),controller[_0x2cd9('0xc')]);router[_0x2cd9('0xb')]('/:id',auth[_0x2cd9('0x9')](),controller['show']);router[_0x2cd9('0xd')]('/',auth[_0x2cd9('0x9')](),controller['create']);router['put'](_0x2cd9('0xe'),auth[_0x2cd9('0x9')](),controller[_0x2cd9('0xf')]);router[_0x2cd9('0x10')]('/:id',auth[_0x2cd9('0x9')](),controller[_0x2cd9('0x11')]);module[_0x2cd9('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 75d4df6..90d2458 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 _0x9a19=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x1fef32,_0x391ff4){var _0x450c8f=function(_0x5af7c5){while(--_0x5af7c5){_0x1fef32['push'](_0x1fef32['shift']());}};_0x450c8f(++_0x391ff4);}(_0x9a19,0x114));var _0x99a1=function(_0x5cbf0e,_0x4cd140){_0x5cbf0e=_0x5cbf0e-0x0;var _0x1c76f8=_0x9a19[_0x5cbf0e];return _0x1c76f8;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'privilege':{'type':Sequelize[_0x99a1('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x99a1('0x3')]},'channelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'calleridnum':{'type':Sequelize[_0x99a1('0x2')]},'calleridname':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'connectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'language':{'type':Sequelize[_0x99a1('0x2')]},'accountcode':{'type':Sequelize[_0x99a1('0x2')]},'context':{'type':Sequelize[_0x99a1('0x2')]},'exten':{'type':Sequelize[_0x99a1('0x2')]},'priority':{'type':Sequelize[_0x99a1('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x99a1('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x99a1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x99a1('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x99a1('0x2')]},'destlanguage':{'type':Sequelize[_0x99a1('0x2')]},'destaccountcode':{'type':Sequelize[_0x99a1('0x2')]},'destcontext':{'type':Sequelize[_0x99a1('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x99a1('0x3')]},'destuniqueid':{'type':Sequelize[_0x99a1('0x2')]},'destlinkedid':{'type':Sequelize[_0x99a1('0x2')]},'dialstring':{'type':Sequelize[_0x99a1('0x2')]},'dialstatus':{'type':Sequelize[_0x99a1('0x2')]},'starttime':{'type':Sequelize[_0x99a1('0x4')]},'answertime':{'type':Sequelize[_0x99a1('0x4')]},'endtime':{'type':Sequelize[_0x99a1('0x4')]},'lastevent':{'type':Sequelize[_0x99a1('0x2')],'comment':_0x99a1('0x5')},'routeId':{'type':Sequelize[_0x99a1('0x3')]},'duration':{'type':Sequelize[_0x99a1('0x3')]},'holdtime':{'type':Sequelize[_0x99a1('0x3')]},'billableseconds':{'type':Sequelize[_0x99a1('0x3')]}}; \ No newline at end of file +var _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x2151e3,_0x527b00){var _0x10bd23=function(_0x9d1ae9){while(--_0x9d1ae9){_0x2151e3['push'](_0x2151e3['shift']());}};_0x10bd23(++_0x527b00);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4e1472,_0x4e428b){_0x4e1472=_0x4e1472-0x0;var _0x4cc2da=_0x6f0d[_0x4e1472];return _0x4cc2da;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index d98313d..08d551d 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 _0xfc6e=['model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','pick','merge','where','type','VIRTUAL','filter','options','includeAll','findAll','catch','show','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','end','error','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','key'];(function(_0x533410,_0x560aa8){var _0x5b7a5c=function(_0x5a312d){while(--_0x5a312d){_0x533410['push'](_0x533410['shift']());}};_0x5b7a5c(++_0x560aa8);}(_0xfc6e,0x1cb));var _0xefc6=function(_0x536755,_0x3bfa50){_0x536755=_0x536755-0x0;var _0x2b9dde=_0xfc6e[_0x536755];return _0x2b9dde;};'use strict';var emlformat=require(_0xefc6('0x0'));var rimraf=require(_0xefc6('0x1'));var zipdir=require(_0xefc6('0x2'));var jsonpatch=require(_0xefc6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xefc6('0x4'));var path=require(_0xefc6('0x5'));var sox=require(_0xefc6('0x6'));var csv=require(_0xefc6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefc6('0x8'));var _=require(_0xefc6('0x9'));var squel=require(_0xefc6('0xa'));var crypto=require(_0xefc6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xefc6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xefc6('0xd'));var Papa=require(_0xefc6('0xe'));var Redis=require(_0xefc6('0xf'));var authService=require(_0xefc6('0x10'));var qs=require(_0xefc6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xefc6('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xefc6('0x13'));var licenseUtil=require(_0xefc6('0x14'));var db=require(_0xefc6('0x15'))['db'];function respondWithStatusCode(_0x31d16b,_0x4e809a){_0x4e809a=_0x4e809a||0xcc;return function(_0x5e5e32){if(_0x5e5e32){return _0x31d16b[_0xefc6('0x16')](_0x4e809a);}return _0x31d16b[_0xefc6('0x17')](_0x4e809a)['end']();};}function respondWithResult(_0x4c3060,_0x260a90){_0x260a90=_0x260a90||0xc8;return function(_0x368008){if(_0x368008){return _0x4c3060[_0xefc6('0x17')](_0x260a90)[_0xefc6('0x18')](_0x368008);}};}function respondWithFilteredResult(_0x5e0e66,_0x42113b){return function(_0x4d2e8b){if(_0x4d2e8b){var _0x12e30f=typeof _0x42113b[_0xefc6('0x19')]===_0xefc6('0x1a')&&typeof _0x42113b[_0xefc6('0x1b')]==='undefined';var _0x2b13b2=_0x4d2e8b[_0xefc6('0x1c')];var _0x4637f0=_0x12e30f?0x0:_0x42113b[_0xefc6('0x19')];var _0x148d4b=_0x12e30f?_0x4d2e8b[_0xefc6('0x1c')]:_0x42113b[_0xefc6('0x19')]+_0x42113b[_0xefc6('0x1b')];var _0x2b3d06;if(_0x148d4b>=_0x2b13b2){_0x148d4b=_0x2b13b2;_0x2b3d06=0xc8;}else{_0x2b3d06=0xce;}_0x5e0e66[_0xefc6('0x17')](_0x2b3d06);return _0x5e0e66[_0xefc6('0x1d')]('Content-Range',_0x4637f0+'-'+_0x148d4b+'/'+_0x2b13b2)[_0xefc6('0x18')](_0x4d2e8b);}return null;};}function patchUpdates(_0x517fa4){return function(_0x23c384){try{jsonpatch['apply'](_0x23c384,_0x517fa4,!![]);}catch(_0x5a10af){return BPromise[_0xefc6('0x1e')](_0x5a10af);}return _0x23c384[_0xefc6('0x1f')]();};}function saveUpdates(_0x3c5418,_0x5523a8){return function(_0x5e27d8){if(_0x5e27d8){return _0x5e27d8[_0xefc6('0x20')](_0x3c5418)['then'](function(_0x51a91d){return _0x51a91d;});}return null;};}function removeEntity(_0x3faaba,_0x2e9d6a){return function(_0x2facff){if(_0x2facff){return _0x2facff[_0xefc6('0x21')]()[_0xefc6('0x22')](function(){_0x3faaba[_0xefc6('0x17')](0xcc)[_0xefc6('0x23')]();});}};}function handleEntityNotFound(_0x302df2,_0x50b691){return function(_0x33caf0){if(!_0x33caf0){_0x302df2[_0xefc6('0x16')](0x194);}return _0x33caf0;};}function handleError(_0x4eadca,_0x58a353){_0x58a353=_0x58a353||0x1f4;return function(_0xf72e8b){logger[_0xefc6('0x24')](_0xf72e8b[_0xefc6('0x25')]);if(_0xf72e8b[_0xefc6('0x26')]){delete _0xf72e8b[_0xefc6('0x26')];}_0x4eadca[_0xefc6('0x17')](_0x58a353)[_0xefc6('0x27')](_0xf72e8b);};}exports['index']=function(_0xb0728d,_0x39a3bd){var _0x19fde2={},_0x1cbad={},_0x36ff1b={'count':0x0,'rows':[]};var _0x4f244a=_[_0xefc6('0x28')](db[_0xefc6('0x29')][_0xefc6('0x2a')],function(_0x4b0590){return{'name':_0x4b0590[_0xefc6('0x2b')],'type':_0x4b0590['type'][_0xefc6('0x2c')]};});_0x1cbad[_0xefc6('0x2d')]=_['map'](_0x4f244a,_0xefc6('0x26'));_0x1cbad['query']=_[_0xefc6('0x2e')](_0xb0728d['query']);_0x1cbad[_0xefc6('0x2f')]=_[_0xefc6('0x30')](_0x1cbad[_0xefc6('0x2d')],_0x1cbad[_0xefc6('0x31')]);_0x19fde2[_0xefc6('0x32')]=_[_0xefc6('0x30')](_0x1cbad[_0xefc6('0x2d')],qs[_0xefc6('0x33')](_0xb0728d[_0xefc6('0x31')][_0xefc6('0x33')]));_0x19fde2[_0xefc6('0x32')]=_0x19fde2[_0xefc6('0x32')][_0xefc6('0x34')]?_0x19fde2[_0xefc6('0x32')]:_0x1cbad[_0xefc6('0x2d')];if(!_0xb0728d[_0xefc6('0x31')][_0xefc6('0x35')](_0xefc6('0x36'))){_0x19fde2['limit']=qs[_0xefc6('0x1b')](_0xb0728d[_0xefc6('0x31')][_0xefc6('0x1b')]);_0x19fde2['offset']=qs[_0xefc6('0x19')](_0xb0728d['query'][_0xefc6('0x19')]);}_0x19fde2['order']=qs['sort'](_0xb0728d[_0xefc6('0x31')]['sort']);_0x19fde2['where']=qs['filters'](_[_0xefc6('0x37')](_0xb0728d[_0xefc6('0x31')],_0x1cbad['filters']),_0x4f244a);if(_0xb0728d[_0xefc6('0x31')]['filter']){_0x19fde2['where']=_[_0xefc6('0x38')](_0x19fde2[_0xefc6('0x39')],{'$or':_['map'](_0x4f244a,function(_0x36fe81){if(_0x36fe81[_0xefc6('0x3a')]!==_0xefc6('0x3b')){var _0x59c007={};_0x59c007[_0x36fe81[_0xefc6('0x26')]]={'$like':'%'+_0xb0728d['query'][_0xefc6('0x3c')]+'%'};return _0x59c007;}})});}_0x19fde2=_[_0xefc6('0x38')]({},_0x19fde2,_0xb0728d[_0xefc6('0x3d')]);var _0x384402={'where':_0x19fde2[_0xefc6('0x39')]};return db[_0xefc6('0x29')][_0xefc6('0x1c')](_0x384402)[_0xefc6('0x22')](function(_0x5de7ec){_0x36ff1b[_0xefc6('0x1c')]=_0x5de7ec;if(_0xb0728d[_0xefc6('0x31')][_0xefc6('0x3e')]){_0x19fde2['include']=[{'all':!![]}];}return db[_0xefc6('0x29')][_0xefc6('0x3f')](_0x19fde2);})[_0xefc6('0x22')](function(_0x34bcfd){_0x36ff1b['rows']=_0x34bcfd;return _0x36ff1b;})['then'](respondWithFilteredResult(_0x39a3bd,_0x19fde2))[_0xefc6('0x40')](handleError(_0x39a3bd,null));};exports[_0xefc6('0x41')]=function(_0x51fb99,_0x512b64){var _0x20727b={'raw':!![],'where':{'id':_0x51fb99['params']['id']}},_0x243002={};_0x243002[_0xefc6('0x2d')]=_[_0xefc6('0x2e')](db[_0xefc6('0x29')][_0xefc6('0x2a')]);_0x243002[_0xefc6('0x31')]=_[_0xefc6('0x2e')](_0x51fb99[_0xefc6('0x31')]);_0x243002['filters']=_[_0xefc6('0x30')](_0x243002['model'],_0x243002[_0xefc6('0x31')]);_0x20727b[_0xefc6('0x32')]=_[_0xefc6('0x30')](_0x243002[_0xefc6('0x2d')],qs['fields'](_0x51fb99[_0xefc6('0x31')][_0xefc6('0x33')]));_0x20727b[_0xefc6('0x32')]=_0x20727b[_0xefc6('0x32')]['length']?_0x20727b[_0xefc6('0x32')]:_0x243002[_0xefc6('0x2d')];if(_0x51fb99[_0xefc6('0x31')][_0xefc6('0x3e')]){_0x20727b[_0xefc6('0x42')]=[{'all':!![]}];}_0x20727b=_[_0xefc6('0x38')]({},_0x20727b,_0x51fb99['options']);return db[_0xefc6('0x29')][_0xefc6('0x43')](_0x20727b)[_0xefc6('0x22')](handleEntityNotFound(_0x512b64,null))[_0xefc6('0x22')](respondWithResult(_0x512b64,null))[_0xefc6('0x40')](handleError(_0x512b64,null));};exports['create']=function(_0x14411d,_0x243e62){return db[_0xefc6('0x29')][_0xefc6('0x44')](_0x14411d[_0xefc6('0x45')],{})[_0xefc6('0x22')](respondWithResult(_0x243e62,0xc9))[_0xefc6('0x40')](handleError(_0x243e62,null));};exports[_0xefc6('0x20')]=function(_0x56b4f0,_0x164ddd){if(_0x56b4f0[_0xefc6('0x45')]['id']){delete _0x56b4f0['body']['id'];}return db[_0xefc6('0x29')][_0xefc6('0x43')]({'where':{'id':_0x56b4f0['params']['id']}})['then'](handleEntityNotFound(_0x164ddd,null))['then'](saveUpdates(_0x56b4f0[_0xefc6('0x45')],null))[_0xefc6('0x22')](respondWithResult(_0x164ddd,null))['catch'](handleError(_0x164ddd,null));};exports[_0xefc6('0x21')]=function(_0x1805a5,_0x26c8a9){return db[_0xefc6('0x29')][_0xefc6('0x43')]({'where':{'id':_0x1805a5[_0xefc6('0x46')]['id']}})[_0xefc6('0x22')](handleEntityNotFound(_0x26c8a9,null))[_0xefc6('0x22')](removeEntity(_0x26c8a9,null))[_0xefc6('0x40')](handleError(_0x26c8a9,null));};exports[_0xefc6('0x47')]=function(_0x5e557f,_0x37ff7e){return db['VoiceDialReport']['describe']()[_0xefc6('0x22')](respondWithResult(_0x37ff7e,null))['catch'](handleError(_0x37ff7e,null));}; \ No newline at end of file +var _0x57f0=['filter','options','VoiceDialReport','then','includeAll','include','findAll','rows','show','params','length','merge','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','end','error','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL'];(function(_0x18cf72,_0x12c3be){var _0x1c7c05=function(_0x52f7e0){while(--_0x52f7e0){_0x18cf72['push'](_0x18cf72['shift']());}};_0x1c7c05(++_0x12c3be);}(_0x57f0,0x14a));var _0x057f=function(_0x252d7e,_0x20a71c){_0x252d7e=_0x252d7e-0x0;var _0x2afaba=_0x57f0[_0x252d7e];return _0x2afaba;};'use strict';var emlformat=require(_0x057f('0x0'));var rimraf=require(_0x057f('0x1'));var zipdir=require(_0x057f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x057f('0x3'));var moment=require(_0x057f('0x4'));var BPromise=require(_0x057f('0x5'));var Mustache=require('mustache');var util=require(_0x057f('0x6'));var path=require(_0x057f('0x7'));var sox=require(_0x057f('0x8'));var csv=require('to-csv');var ejs=require(_0x057f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x057f('0xa'));var squel=require(_0x057f('0xb'));var crypto=require(_0x057f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x057f('0xd'));var querystring=require(_0x057f('0xe'));var Papa=require(_0x057f('0xf'));var Redis=require(_0x057f('0x10'));var authService=require(_0x057f('0x11'));var qs=require(_0x057f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x057f('0x13'));var logger=require(_0x057f('0x14'))(_0x057f('0x15'));var utils=require('../../config/utils');var config=require(_0x057f('0x16'));var licenseUtil=require(_0x057f('0x17'));var db=require(_0x057f('0x18'))['db'];function respondWithStatusCode(_0x4685e8,_0x35e686){_0x35e686=_0x35e686||0xcc;return function(_0x319a99){if(_0x319a99){return _0x4685e8[_0x057f('0x19')](_0x35e686);}return _0x4685e8[_0x057f('0x1a')](_0x35e686)['end']();};}function respondWithResult(_0x332950,_0x1a7625){_0x1a7625=_0x1a7625||0xc8;return function(_0x34f5fa){if(_0x34f5fa){return _0x332950[_0x057f('0x1a')](_0x1a7625)['json'](_0x34f5fa);}};}function respondWithFilteredResult(_0x25fbf8,_0x18b1cf){return function(_0x460ac0){if(_0x460ac0){var _0x24fe68=typeof _0x18b1cf['offset']==='undefined'&&typeof _0x18b1cf[_0x057f('0x1b')]===_0x057f('0x1c');var _0xe4667=_0x460ac0['count'];var _0x55f55e=_0x24fe68?0x0:_0x18b1cf['offset'];var _0x5c8f85=_0x24fe68?_0x460ac0[_0x057f('0x1d')]:_0x18b1cf[_0x057f('0x1e')]+_0x18b1cf[_0x057f('0x1b')];var _0x319ba2;if(_0x5c8f85>=_0xe4667){_0x5c8f85=_0xe4667;_0x319ba2=0xc8;}else{_0x319ba2=0xce;}_0x25fbf8[_0x057f('0x1a')](_0x319ba2);return _0x25fbf8[_0x057f('0x1f')](_0x057f('0x20'),_0x55f55e+'-'+_0x5c8f85+'/'+_0xe4667)[_0x057f('0x21')](_0x460ac0);}return null;};}function patchUpdates(_0x2c6848){return function(_0x55ecdd){try{jsonpatch[_0x057f('0x22')](_0x55ecdd,_0x2c6848,!![]);}catch(_0x530124){return BPromise[_0x057f('0x23')](_0x530124);}return _0x55ecdd[_0x057f('0x24')]();};}function saveUpdates(_0x2b870c,_0x3c3433){return function(_0x35b9ad){if(_0x35b9ad){return _0x35b9ad[_0x057f('0x25')](_0x2b870c)['then'](function(_0x135c90){return _0x135c90;});}return null;};}function removeEntity(_0x244f7,_0x433be7){return function(_0x570263){if(_0x570263){return _0x570263['destroy']()['then'](function(){_0x244f7['status'](0xcc)[_0x057f('0x26')]();});}};}function handleEntityNotFound(_0x5ba746,_0x4b2384){return function(_0xae92b0){if(!_0xae92b0){_0x5ba746[_0x057f('0x19')](0x194);}return _0xae92b0;};}function handleError(_0x592e47,_0x2c0312){_0x2c0312=_0x2c0312||0x1f4;return function(_0xef2291){logger[_0x057f('0x27')](_0xef2291['stack']);if(_0xef2291['name']){delete _0xef2291[_0x057f('0x28')];}_0x592e47[_0x057f('0x1a')](_0x2c0312)['send'](_0xef2291);};}exports[_0x057f('0x29')]=function(_0x2606f5,_0x2f5857){var _0x1350f4={},_0x59c7e6={},_0x18b5a8={'count':0x0,'rows':[]};var _0x15a561=_[_0x057f('0x2a')](db['VoiceDialReport'][_0x057f('0x2b')],function(_0xd08cd0){return{'name':_0xd08cd0[_0x057f('0x2c')],'type':_0xd08cd0[_0x057f('0x2d')]['key']};});_0x59c7e6[_0x057f('0x2e')]=_[_0x057f('0x2a')](_0x15a561,_0x057f('0x28'));_0x59c7e6[_0x057f('0x2f')]=_[_0x057f('0x30')](_0x2606f5[_0x057f('0x2f')]);_0x59c7e6[_0x057f('0x31')]=_[_0x057f('0x32')](_0x59c7e6[_0x057f('0x2e')],_0x59c7e6[_0x057f('0x2f')]);_0x1350f4[_0x057f('0x33')]=_[_0x057f('0x32')](_0x59c7e6['model'],qs[_0x057f('0x34')](_0x2606f5[_0x057f('0x2f')]['fields']));_0x1350f4[_0x057f('0x33')]=_0x1350f4[_0x057f('0x33')]['length']?_0x1350f4[_0x057f('0x33')]:_0x59c7e6[_0x057f('0x2e')];if(!_0x2606f5[_0x057f('0x2f')][_0x057f('0x35')](_0x057f('0x36'))){_0x1350f4[_0x057f('0x1b')]=qs['limit'](_0x2606f5['query'][_0x057f('0x1b')]);_0x1350f4['offset']=qs[_0x057f('0x1e')](_0x2606f5[_0x057f('0x2f')][_0x057f('0x1e')]);}_0x1350f4[_0x057f('0x37')]=qs[_0x057f('0x38')](_0x2606f5[_0x057f('0x2f')][_0x057f('0x38')]);_0x1350f4[_0x057f('0x39')]=qs[_0x057f('0x31')](_[_0x057f('0x3a')](_0x2606f5['query'],_0x59c7e6['filters']),_0x15a561);if(_0x2606f5[_0x057f('0x2f')]['filter']){_0x1350f4[_0x057f('0x39')]=_['merge'](_0x1350f4[_0x057f('0x39')],{'$or':_[_0x057f('0x2a')](_0x15a561,function(_0x2d2eef){if(_0x2d2eef['type']!==_0x057f('0x3b')){var _0x496575={};_0x496575[_0x2d2eef[_0x057f('0x28')]]={'$like':'%'+_0x2606f5[_0x057f('0x2f')][_0x057f('0x3c')]+'%'};return _0x496575;}})});}_0x1350f4=_['merge']({},_0x1350f4,_0x2606f5[_0x057f('0x3d')]);var _0x1b09f4={'where':_0x1350f4['where']};return db[_0x057f('0x3e')][_0x057f('0x1d')](_0x1b09f4)[_0x057f('0x3f')](function(_0x1061f2){_0x18b5a8[_0x057f('0x1d')]=_0x1061f2;if(_0x2606f5[_0x057f('0x2f')][_0x057f('0x40')]){_0x1350f4[_0x057f('0x41')]=[{'all':!![]}];}return db[_0x057f('0x3e')][_0x057f('0x42')](_0x1350f4);})[_0x057f('0x3f')](function(_0x9ba6dd){_0x18b5a8[_0x057f('0x43')]=_0x9ba6dd;return _0x18b5a8;})[_0x057f('0x3f')](respondWithFilteredResult(_0x2f5857,_0x1350f4))['catch'](handleError(_0x2f5857,null));};exports[_0x057f('0x44')]=function(_0x2ca058,_0x440b5a){var _0x12d2cd={'raw':!![],'where':{'id':_0x2ca058[_0x057f('0x45')]['id']}},_0x22709b={};_0x22709b[_0x057f('0x2e')]=_[_0x057f('0x30')](db[_0x057f('0x3e')][_0x057f('0x2b')]);_0x22709b[_0x057f('0x2f')]=_[_0x057f('0x30')](_0x2ca058[_0x057f('0x2f')]);_0x22709b['filters']=_[_0x057f('0x32')](_0x22709b['model'],_0x22709b[_0x057f('0x2f')]);_0x12d2cd[_0x057f('0x33')]=_[_0x057f('0x32')](_0x22709b['model'],qs['fields'](_0x2ca058[_0x057f('0x2f')]['fields']));_0x12d2cd['attributes']=_0x12d2cd[_0x057f('0x33')][_0x057f('0x46')]?_0x12d2cd[_0x057f('0x33')]:_0x22709b[_0x057f('0x2e')];if(_0x2ca058[_0x057f('0x2f')][_0x057f('0x40')]){_0x12d2cd[_0x057f('0x41')]=[{'all':!![]}];}_0x12d2cd=_[_0x057f('0x47')]({},_0x12d2cd,_0x2ca058[_0x057f('0x3d')]);return db[_0x057f('0x3e')]['find'](_0x12d2cd)[_0x057f('0x3f')](handleEntityNotFound(_0x440b5a,null))[_0x057f('0x3f')](respondWithResult(_0x440b5a,null))[_0x057f('0x48')](handleError(_0x440b5a,null));};exports[_0x057f('0x49')]=function(_0x496e17,_0x2f649c){return db[_0x057f('0x3e')][_0x057f('0x49')](_0x496e17[_0x057f('0x4a')],{})[_0x057f('0x3f')](respondWithResult(_0x2f649c,0xc9))[_0x057f('0x48')](handleError(_0x2f649c,null));};exports[_0x057f('0x25')]=function(_0x4bbf64,_0x24cd95){if(_0x4bbf64[_0x057f('0x4a')]['id']){delete _0x4bbf64[_0x057f('0x4a')]['id'];}return db[_0x057f('0x3e')][_0x057f('0x4b')]({'where':{'id':_0x4bbf64[_0x057f('0x45')]['id']}})[_0x057f('0x3f')](handleEntityNotFound(_0x24cd95,null))['then'](saveUpdates(_0x4bbf64['body'],null))['then'](respondWithResult(_0x24cd95,null))['catch'](handleError(_0x24cd95,null));};exports[_0x057f('0x4c')]=function(_0x4d688a,_0x17d5cc){return db[_0x057f('0x3e')][_0x057f('0x4b')]({'where':{'id':_0x4d688a[_0x057f('0x45')]['id']}})[_0x057f('0x3f')](handleEntityNotFound(_0x17d5cc,null))[_0x057f('0x3f')](removeEntity(_0x17d5cc,null))['catch'](handleError(_0x17d5cc,null));};exports[_0x057f('0x4d')]=function(_0x424a26,_0xcbcca9){return db['VoiceDialReport']['describe']()[_0x057f('0x3f')](respondWithResult(_0xcbcca9,null))[_0x057f('0x48')](handleError(_0xcbcca9,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 0fe1d66..2b613a3 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 _0x8881=['define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports'];(function(_0x1261c2,_0x3ef819){var _0x3aabd2=function(_0x425d76){while(--_0x425d76){_0x1261c2['push'](_0x1261c2['shift']());}};_0x3aabd2(++_0x3ef819);}(_0x8881,0xd0));var _0x1888=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x8881[_0x349367];return _0x14179b;};'use strict';var _=require(_0x1888('0x0'));var util=require(_0x1888('0x1'));var logger=require(_0x1888('0x2'))(_0x1888('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1888('0x4'));var fs=require('fs');var path=require(_0x1888('0x5'));var rimraf=require('rimraf');var config=require(_0x1888('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0x1888('0x7')]=function(_0x4f29b5,_0x79a802){return _0x4f29b5[_0x1888('0x8')](_0x1888('0x9'),attributes,{'tableName':_0x1888('0xa'),'paranoid':![],'indexes':[{'fields':[_0x1888('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7536=['lodash','util','../../config/logger','api','path','rimraf','../../config/environment','define','uniqueid'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x7536,0xf3));var _0x6753=function(_0x22663b,_0xc8c6e3){_0x22663b=_0x22663b-0x0;var _0x310d0a=_0x7536[_0x22663b];return _0x310d0a;};'use strict';var _=require(_0x6753('0x0'));var util=require(_0x6753('0x1'));var logger=require(_0x6753('0x2'))(_0x6753('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6753('0x4'));var rimraf=require(_0x6753('0x5'));var config=require(_0x6753('0x6'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x208b03,_0xaa3ff){return _0x208b03[_0x6753('0x7')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x6753('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index acb194f..53b73c9 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 _0x8b90=['update','where','attributes','limit','UpdateVoiceDialReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','debug'];(function(_0x2dddd5,_0x350741){var _0x1f223a=function(_0x5ba4a7){while(--_0x5ba4a7){_0x2dddd5['push'](_0x2dddd5['shift']());}};_0x1f223a(++_0x350741);}(_0x8b90,0xf3));var _0x08b9=function(_0x1ca8d8,_0x17aa35){_0x1ca8d8=_0x1ca8d8-0x0;var _0x1161d8=_0x8b90[_0x1ca8d8];return _0x1161d8;};'use strict';var _=require(_0x08b9('0x0'));var util=require(_0x08b9('0x1'));var moment=require('moment');var BPromise=require(_0x08b9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08b9('0x3'));var db=require(_0x08b9('0x4'))['db'];var utils=require(_0x08b9('0x5'));var logger=require(_0x08b9('0x6'))(_0x08b9('0x7'));var config=require(_0x08b9('0x8'));var jayson=require(_0x08b9('0x9'));var client=jayson['client'][_0x08b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53afed,_0x2fc822,_0x5c7854){return new BPromise(function(_0x77e8cf,_0x1e3364){return client[_0x08b9('0xb')](_0x53afed,_0x5c7854)[_0x08b9('0xc')](function(_0x1f59ad){logger[_0x08b9('0xd')](_0x08b9('0xe'),_0x2fc822,_0x08b9('0xf'));logger['debug'](_0x08b9('0x10'),_0x2fc822,_0x08b9('0xf'),JSON[_0x08b9('0x11')](_0x1f59ad));if(_0x1f59ad[_0x08b9('0x12')]){if(_0x1f59ad[_0x08b9('0x12')][_0x08b9('0x13')]===0x1f4){logger[_0x08b9('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x2fc822,_0x1f59ad[_0x08b9('0x12')]['message']);return _0x1e3364(_0x1f59ad['error'][_0x08b9('0x14')]);}logger[_0x08b9('0x12')](_0x08b9('0xe'),_0x2fc822,_0x1f59ad['error'][_0x08b9('0x14')]);return _0x77e8cf(_0x1f59ad[_0x08b9('0x12')]['message']);}else{logger[_0x08b9('0xd')](_0x08b9('0xe'),_0x2fc822,_0x08b9('0xf'));_0x77e8cf(_0x1f59ad[_0x08b9('0x15')][_0x08b9('0x14')]);}})[_0x08b9('0x16')](function(_0x12bb65){logger[_0x08b9('0x12')](_0x08b9('0xe'),_0x2fc822,_0x12bb65);_0x1e3364(_0x12bb65);});});}exports[_0x08b9('0x17')]=function(_0x15300f){var _0x5a2c71=this;return new Promise(function(_0x3b1a24,_0x4ce860){return db[_0x08b9('0x18')][_0x08b9('0x19')](_0x15300f[_0x08b9('0x1a')],{'raw':_0x15300f['options']?_0x15300f[_0x08b9('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x45e02c){logger[_0x08b9('0xd')](_0x08b9('0x17'),_0x15300f);logger[_0x08b9('0x1c')](_0x08b9('0x17'),_0x15300f,JSON[_0x08b9('0x11')](_0x45e02c));_0x3b1a24(_0x45e02c);})[_0x08b9('0x16')](function(_0x489a97){logger[_0x08b9('0x12')](_0x08b9('0x17'),_0x489a97[_0x08b9('0x14')],_0x15300f);_0x4ce860(_0x5a2c71[_0x08b9('0x12')](0x1f4,_0x489a97[_0x08b9('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x3c4b12){var _0x56f4bb=this;return new Promise(function(_0x4cb802,_0x5c59a1){return db['VoiceDialReport'][_0x08b9('0x1d')](_0x3c4b12['body'],{'raw':_0x3c4b12['options']?_0x3c4b12[_0x08b9('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c4b12[_0x08b9('0x1b')]?_0x3c4b12[_0x08b9('0x1b')][_0x08b9('0x1e')]||null:null,'attributes':_0x3c4b12['options']?_0x3c4b12[_0x08b9('0x1b')][_0x08b9('0x1f')]||null:null,'limit':_0x3c4b12[_0x08b9('0x1b')]?_0x3c4b12[_0x08b9('0x1b')][_0x08b9('0x20')]||null:null})['then'](function(_0x4da442){logger[_0x08b9('0xd')](_0x08b9('0x21'),_0x3c4b12);logger['debug']('UpdateVoiceDialReport',_0x3c4b12,JSON[_0x08b9('0x11')](_0x4da442));_0x4cb802(_0x4da442);})[_0x08b9('0x16')](function(_0x154eb0){logger[_0x08b9('0x12')](_0x08b9('0x21'),_0x154eb0[_0x08b9('0x14')],_0x3c4b12);_0x5c59a1(_0x56f4bb[_0x08b9('0x12')](0x1f4,_0x154eb0[_0x08b9('0x14')]));});});}; \ No newline at end of file +var _0xa8b6=['VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport'];(function(_0x48f7ca,_0x46131c){var _0x566547=function(_0x29b250){while(--_0x29b250){_0x48f7ca['push'](_0x48f7ca['shift']());}};_0x566547(++_0x46131c);}(_0xa8b6,0x106));var _0x6a8b=function(_0x3ef91f,_0x4c470c){_0x3ef91f=_0x3ef91f-0x0;var _0x4efe8a=_0xa8b6[_0x3ef91f];return _0x4efe8a;};'use strict';var _=require(_0x6a8b('0x0'));var util=require(_0x6a8b('0x1'));var moment=require(_0x6a8b('0x2'));var BPromise=require(_0x6a8b('0x3'));var rs=require(_0x6a8b('0x4'));var fs=require('fs');var Redis=require(_0x6a8b('0x5'));var db=require(_0x6a8b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a8b('0x7'))(_0x6a8b('0x8'));var config=require(_0x6a8b('0x9'));var jayson=require(_0x6a8b('0xa'));var client=jayson[_0x6a8b('0xb')][_0x6a8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x476cab,_0xb1001f,_0x5f56d8){return new BPromise(function(_0x417d26,_0x83f2e8){return client[_0x6a8b('0xd')](_0x476cab,_0x5f56d8)[_0x6a8b('0xe')](function(_0x1e7b29){logger[_0x6a8b('0xf')](_0x6a8b('0x10'),_0xb1001f,_0x6a8b('0x11'));logger[_0x6a8b('0x12')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xb1001f,_0x6a8b('0x11'),JSON[_0x6a8b('0x13')](_0x1e7b29));if(_0x1e7b29[_0x6a8b('0x14')]){if(_0x1e7b29['error'][_0x6a8b('0x15')]===0x1f4){logger['error'](_0x6a8b('0x10'),_0xb1001f,_0x1e7b29[_0x6a8b('0x14')][_0x6a8b('0x16')]);return _0x83f2e8(_0x1e7b29['error'][_0x6a8b('0x16')]);}logger[_0x6a8b('0x14')](_0x6a8b('0x10'),_0xb1001f,_0x1e7b29[_0x6a8b('0x14')]['message']);return _0x417d26(_0x1e7b29[_0x6a8b('0x14')]['message']);}else{logger[_0x6a8b('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0xb1001f,_0x6a8b('0x11'));_0x417d26(_0x1e7b29[_0x6a8b('0x17')][_0x6a8b('0x16')]);}})[_0x6a8b('0x18')](function(_0x3fc466){logger[_0x6a8b('0x14')]('VoiceDialReport,\x20%s,\x20%s',_0xb1001f,_0x3fc466);_0x83f2e8(_0x3fc466);});});}exports[_0x6a8b('0x19')]=function(_0x5e2aee){var _0x563d7d=this;return new Promise(function(_0x3f33cb,_0x5d9ccd){return db[_0x6a8b('0x1a')][_0x6a8b('0x1b')](_0x5e2aee[_0x6a8b('0x1c')],{'raw':_0x5e2aee[_0x6a8b('0x1d')]?_0x5e2aee[_0x6a8b('0x1d')][_0x6a8b('0x1e')]===undefined?!![]:![]:!![]})[_0x6a8b('0xe')](function(_0x1755c4){logger[_0x6a8b('0xf')](_0x6a8b('0x19'),_0x5e2aee);logger[_0x6a8b('0x12')](_0x6a8b('0x19'),_0x5e2aee,JSON['stringify'](_0x1755c4));_0x3f33cb(_0x1755c4);})[_0x6a8b('0x18')](function(_0x364d8d){logger[_0x6a8b('0x14')](_0x6a8b('0x19'),_0x364d8d[_0x6a8b('0x16')],_0x5e2aee);_0x5d9ccd(_0x563d7d[_0x6a8b('0x14')](0x1f4,_0x364d8d['message']));});});};exports[_0x6a8b('0x1f')]=function(_0x5df517){var _0x2cf0e9=this;return new Promise(function(_0x50012a,_0xe29d98){return db[_0x6a8b('0x1a')][_0x6a8b('0x20')](_0x5df517['body'],{'raw':_0x5df517[_0x6a8b('0x1d')]?_0x5df517[_0x6a8b('0x1d')][_0x6a8b('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5df517[_0x6a8b('0x1d')]?_0x5df517[_0x6a8b('0x1d')][_0x6a8b('0x21')]||null:null,'attributes':_0x5df517['options']?_0x5df517[_0x6a8b('0x1d')][_0x6a8b('0x22')]||null:null,'limit':_0x5df517[_0x6a8b('0x1d')]?_0x5df517['options'][_0x6a8b('0x23')]||null:null})['then'](function(_0x275281){logger[_0x6a8b('0xf')](_0x6a8b('0x1f'),_0x5df517);logger[_0x6a8b('0x12')]('UpdateVoiceDialReport',_0x5df517,JSON[_0x6a8b('0x13')](_0x275281));_0x50012a(_0x275281);})[_0x6a8b('0x18')](function(_0x31b66b){logger[_0x6a8b('0x14')](_0x6a8b('0x1f'),_0x31b66b[_0x6a8b('0x16')],_0x5df517);_0xe29d98(_0x2cf0e9[_0x6a8b('0x14')](0x1f4,_0x31b66b['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7984926..927fbab 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 _0x1240=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','show','create','post','/:id/applications','addApplications','put','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x5d6769,_0x175e86){var _0x58950b=function(_0x4d4598){while(--_0x4d4598){_0x5d6769['push'](_0x5d6769['shift']());}};_0x58950b(++_0x175e86);}(_0x1240,0xb9));var _0x0124=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x1240[_0x1beef3];return _0x5af964;};'use strict';var multer=require('multer');var util=require(_0x0124('0x0'));var path=require(_0x0124('0x1'));var timeout=require(_0x0124('0x2'));var express=require(_0x0124('0x3'));var router=express[_0x0124('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0124('0x5'));var controller=require(_0x0124('0x6'));router[_0x0124('0x7')]('/',auth[_0x0124('0x8')](),controller['index']);router[_0x0124('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0124('0x9')]);router['post']('/',auth[_0x0124('0x8')](),controller[_0x0124('0xa')]);router[_0x0124('0xb')](_0x0124('0xc'),auth[_0x0124('0x8')](),controller[_0x0124('0xd')]);router[_0x0124('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0124('0xf')](_0x0124('0x10'),auth[_0x0124('0x8')](),controller[_0x0124('0x11')]);module[_0x0124('0x12')]=router; \ No newline at end of file +var _0xf149=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','index','get','/:id','isAuthenticated','post','create','/:id/applications','addApplications','put','update'];(function(_0x1daaa4,_0x2a13f8){var _0x4d6a11=function(_0x52ea7f){while(--_0x52ea7f){_0x1daaa4['push'](_0x1daaa4['shift']());}};_0x4d6a11(++_0x2a13f8);}(_0xf149,0xa3));var _0x9f14=function(_0x35af98,_0x103f33){_0x35af98=_0x35af98-0x0;var _0x5f5a62=_0xf149[_0x35af98];return _0x5f5a62;};'use strict';var multer=require(_0x9f14('0x0'));var util=require(_0x9f14('0x1'));var path=require(_0x9f14('0x2'));var timeout=require(_0x9f14('0x3'));var express=require(_0x9f14('0x4'));var router=express[_0x9f14('0x5')]();var fs_extra=require(_0x9f14('0x6'));var auth=require(_0x9f14('0x7'));var interaction=require(_0x9f14('0x8'));var config=require(_0x9f14('0x9'));var controller=require(_0x9f14('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x9f14('0xb')]);router[_0x9f14('0xc')](_0x9f14('0xd'),auth[_0x9f14('0xe')](),controller['show']);router[_0x9f14('0xf')]('/',auth[_0x9f14('0xe')](),controller[_0x9f14('0x10')]);router[_0x9f14('0xf')](_0x9f14('0x11'),auth['isAuthenticated'](),controller[_0x9f14('0x12')]);router[_0x9f14('0x13')](_0x9f14('0xd'),auth[_0x9f14('0xe')](),controller[_0x9f14('0x14')]);router[_0x9f14('0x15')](_0x9f14('0xd'),auth[_0x9f14('0xe')](),controller[_0x9f14('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 1b02da6..962732b 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 _0xacb4=['any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','exten','sequelize','exports','STRING','compositeIndex','ENUM','inbound','system'];(function(_0x3cb5b5,_0x46c74f){var _0x36a650=function(_0x53e219){while(--_0x53e219){_0x3cb5b5['push'](_0x3cb5b5['shift']());}};_0x36a650(++_0x46c74f);}(_0xacb4,0x95));var _0x4acb=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0xacb4[_0x4828b1];return _0x1fec1b;};'use strict';var Sequelize=require(_0x4acb('0x0'));module[_0x4acb('0x1')]={'context':{'type':Sequelize[_0x4acb('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4acb('0x2')],'allowNull':![],'unique':_0x4acb('0x3')},'priority':{'type':Sequelize[_0x4acb('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x4acb('0x3')},'tag':{'type':Sequelize[_0x4acb('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4acb('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4acb('0x4')](_0x4acb('0x5'),'outbound','internal','inbound-fax','outbound-fax',_0x4acb('0x6'),_0x4acb('0x7')),'allowNull':![]},'description':{'type':Sequelize[_0x4acb('0x2')]},'interval':{'type':Sequelize[_0x4acb('0x2')],'allowNull':![],'defaultValue':_0x4acb('0x8')},'IntervalId':{'type':Sequelize[_0x4acb('0x9')]},'isApp':{'type':Sequelize[_0x4acb('0xa')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4acb('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4acb('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x4acb('0xa')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4acb('0x9')]},'recordingFormat':{'type':Sequelize[_0x4acb('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x4acb('0xa')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4acb('0xb')],'get':function(_0x457d68){return this['getDataValue'](_0x4acb('0xc'));}},'alias':{'type':Sequelize[_0x4acb('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x172b=['compositeIndex','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','sequelize','exports','STRING'];(function(_0x483b9b,_0x1d3810){var _0x2b4f57=function(_0x25b926){while(--_0x25b926){_0x483b9b['push'](_0x483b9b['shift']());}};_0x2b4f57(++_0x1d3810);}(_0x172b,0x195));var _0xb172=function(_0x3de0ae,_0x50c5df){_0x3de0ae=_0x3de0ae-0x0;var _0x3dadc4=_0x172b[_0x3de0ae];return _0x3dadc4;};'use strict';var Sequelize=require(_0xb172('0x0'));module[_0xb172('0x1')]={'context':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'unique':_0xb172('0x3')},'priority':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xb172('0x4')](_0xb172('0x5'),_0xb172('0x6'),_0xb172('0x7'),_0xb172('0x8'),_0xb172('0x9'),'system',_0xb172('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xb172('0x2')]},'interval':{'type':Sequelize[_0xb172('0x2')],'allowNull':![],'defaultValue':_0xb172('0xb')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0xb172('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xb172('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xb172('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xb172('0xd')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xb172('0xe')},'answer':{'type':Sequelize[_0xb172('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xb172('0xf')],'get':function(_0x16f7f4){return this[_0xb172('0x10')]('exten');}},'alias':{'type':Sequelize[_0xb172('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 441e473..e361953 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 _0xf159=['show','params','options','catch','create','startsWith','exten','body','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','send','lodash','ioredis','../../components/parsers/qs','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','name','UserProfileResource','then','stack','index','VoiceExtension','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x4dd6d4,_0x31a217){var _0x3d3177=function(_0x405a1a){while(--_0x405a1a){_0x4dd6d4['push'](_0x4dd6d4['shift']());}};_0x3d3177(++_0x31a217);}(_0xf159,0xe3));var _0x9f15=function(_0x1f019a,_0x2abe70){_0x1f019a=_0x1f019a-0x0;var _0x1864ec=_0xf159[_0x1f019a];return _0x1864ec;};'use strict';var _=require(_0x9f15('0x0'));var Redis=require(_0x9f15('0x1'));var qs=require(_0x9f15('0x2'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x9f15('0x3'))['db'];config[_0x9f15('0x4')]=_[_0x9f15('0x5')](config[_0x9f15('0x4')],{'host':_0x9f15('0x6'),'port':0x18eb});var socket=require(_0x9f15('0x7'))(new Redis(config['redis']));require(_0x9f15('0x8'))['register'](socket);function respondWithStatusCode(_0x2cea3f,_0x55b075){_0x55b075=_0x55b075||0xcc;return function(_0x381678){if(_0x381678){return _0x2cea3f[_0x9f15('0x9')](_0x55b075);}return _0x2cea3f[_0x9f15('0xa')](_0x55b075)[_0x9f15('0xb')]();};}function respondWithResult(_0x1b7c6a,_0x1b7f46){_0x1b7f46=_0x1b7f46||0xc8;return function(_0xccf9b5){if(_0xccf9b5){return _0x1b7c6a[_0x9f15('0xa')](_0x1b7f46)[_0x9f15('0xc')](_0xccf9b5);}};}function respondWithFilteredResult(_0x2d5bf2,_0x121937){return function(_0x473f76){if(_0x473f76){var _0x1b50de=typeof _0x121937[_0x9f15('0xd')]===_0x9f15('0xe')&&typeof _0x121937[_0x9f15('0xf')]===_0x9f15('0xe');var _0x30f844=_0x473f76[_0x9f15('0x10')];var _0x3774d4=_0x1b50de?0x0:_0x121937[_0x9f15('0xd')];var _0xb81243=_0x1b50de?_0x473f76[_0x9f15('0x10')]:_0x121937[_0x9f15('0xd')]+_0x121937[_0x9f15('0xf')];var _0x333bf6;if(_0xb81243>=_0x30f844){_0xb81243=_0x30f844;_0x333bf6=0xc8;}else{_0x333bf6=0xce;}_0x2d5bf2[_0x9f15('0xa')](_0x333bf6);return _0x2d5bf2[_0x9f15('0x11')](_0x9f15('0x12'),_0x3774d4+'-'+_0xb81243+'/'+_0x30f844)[_0x9f15('0xc')](_0x473f76);}return null;};}function removeEntity(_0x110187){return function(_0xb3d373){if(_0xb3d373){return _0xb3d373[_0x9f15('0x13')]()['then'](function(){var _0x19c294=_0xb3d373[_0x9f15('0x14')]({'plain':!![]});var _0x481760=[{'name':_0x9f15('0x15'),'value':_0x9f15('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':_0x9f15('0x17'),'ignore':![]},{'name':_0x9f15('0x18'),'value':_0x9f15('0x19'),'ignore':![]}];var _0x94062b=_(_0x481760)[_0x9f15('0x1a')]('ignore')[_0x9f15('0x1b')](_0x9f15('0x1c'))[_0x9f15('0x1c')]();if(_[_0x9f15('0x1d')](_0x94062b,_0x19c294[_0x9f15('0x1e')])){return;}var _0x3b2562=_[_0x9f15('0x1f')](_0x481760,[_0x9f15('0x1c'),_0x19c294[_0x9f15('0x1e')]])[_0x9f15('0x20')];return db[_0x9f15('0x21')]['destroy']({'where':{'type':_0x3b2562,'resourceId':_0x19c294['id']}})[_0x9f15('0x22')](function(){return _0xb3d373;});})[_0x9f15('0x22')](function(){_0x110187['status'](0xcc)[_0x9f15('0xb')]();});}};}function handleEntityNotFound(_0xb42c54){return function(_0x20b73e){if(!_0x20b73e){_0xb42c54['sendStatus'](0x194);}return _0x20b73e;};}function handleError(_0x2eb268,_0x102f40){_0x102f40=_0x102f40||0x1f4;return function(_0x3ecf98){logger['error'](_0x3ecf98[_0x9f15('0x23')]);if(_0x3ecf98[_0x9f15('0x20')]){delete _0x3ecf98['name'];}_0x2eb268[_0x9f15('0xa')](_0x102f40)['send'](_0x3ecf98);};}exports[_0x9f15('0x24')]=function(_0x133459,_0x4785eb){var _0x1757d7={},_0x3d6329={},_0x59d24b={'count':0x0,'rows':[]};var _0x23562b=_['map'](db[_0x9f15('0x25')][_0x9f15('0x26')],function(_0x53c10b){return{'name':_0x53c10b[_0x9f15('0x27')],'type':_0x53c10b['type'][_0x9f15('0x28')]};});_0x3d6329[_0x9f15('0x29')]=_[_0x9f15('0x1b')](_0x23562b,'name');_0x3d6329['query']=_[_0x9f15('0x2a')](_0x133459[_0x9f15('0x2b')]);_0x3d6329[_0x9f15('0x2c')]=_['intersection'](_0x3d6329[_0x9f15('0x29')],_0x3d6329[_0x9f15('0x2b')]);_0x1757d7[_0x9f15('0x2d')]=_[_0x9f15('0x2e')](_0x3d6329['model'],qs['fields'](_0x133459['query'][_0x9f15('0x2f')]));_0x1757d7[_0x9f15('0x2d')]=_0x1757d7['attributes'][_0x9f15('0x30')]?_0x1757d7['attributes']:_0x3d6329[_0x9f15('0x29')];if(!_0x133459[_0x9f15('0x2b')][_0x9f15('0x31')](_0x9f15('0x32'))){_0x1757d7['limit']=qs[_0x9f15('0xf')](_0x133459[_0x9f15('0x2b')][_0x9f15('0xf')]);_0x1757d7[_0x9f15('0xd')]=qs[_0x9f15('0xd')](_0x133459['query'][_0x9f15('0xd')]);}_0x1757d7[_0x9f15('0x33')]=qs[_0x9f15('0x34')](_0x133459['query'][_0x9f15('0x34')]);_0x1757d7[_0x9f15('0x35')]=qs[_0x9f15('0x2c')](_[_0x9f15('0x36')](_0x133459[_0x9f15('0x2b')],_0x3d6329[_0x9f15('0x2c')]),_0x23562b);if(_0x133459['query'][_0x9f15('0x1a')]){_0x1757d7[_0x9f15('0x35')]=_[_0x9f15('0x37')](_0x1757d7[_0x9f15('0x35')],{'$or':_['map'](_0x23562b,function(_0x2b2517){if(_0x2b2517[_0x9f15('0x1e')]!==_0x9f15('0x38')){var _0x26903c={};_0x26903c[_0x2b2517[_0x9f15('0x20')]]={'$like':'%'+_0x133459[_0x9f15('0x2b')][_0x9f15('0x1a')]+'%'};return _0x26903c;}})});}_0x1757d7=_['merge']({},_0x1757d7,_0x133459['options']);var _0x4a14d8={'where':_0x1757d7['where']};return db[_0x9f15('0x25')][_0x9f15('0x10')](_0x4a14d8)[_0x9f15('0x22')](function(_0x2d8b76){_0x59d24b['count']=_0x2d8b76;if(_0x133459[_0x9f15('0x2b')][_0x9f15('0x39')]){_0x1757d7[_0x9f15('0x3a')]=[{'all':!![]}];}return db['VoiceExtension'][_0x9f15('0x3b')](_0x1757d7);})[_0x9f15('0x22')](function(_0x136b69){_0x59d24b[_0x9f15('0x3c')]=_0x136b69;return _0x59d24b;})[_0x9f15('0x22')](respondWithFilteredResult(_0x4785eb,_0x1757d7))['catch'](handleError(_0x4785eb,null));};exports[_0x9f15('0x3d')]=function(_0x364df6,_0x2580e0){var _0x15af88={'raw':![],'where':{'id':_0x364df6[_0x9f15('0x3e')]['id']}},_0x29098a={};_0x29098a[_0x9f15('0x29')]=_[_0x9f15('0x2a')](db[_0x9f15('0x25')]['rawAttributes']);_0x29098a['query']=_['keys'](_0x364df6[_0x9f15('0x2b')]);_0x29098a[_0x9f15('0x2c')]=_[_0x9f15('0x2e')](_0x29098a[_0x9f15('0x29')],_0x29098a['query']);_0x15af88[_0x9f15('0x2d')]=_[_0x9f15('0x2e')](_0x29098a['model'],qs[_0x9f15('0x2f')](_0x364df6['query']['fields']));_0x15af88[_0x9f15('0x2d')]=_0x15af88[_0x9f15('0x2d')][_0x9f15('0x30')]?_0x15af88['attributes']:_0x29098a[_0x9f15('0x29')];if(_0x364df6[_0x9f15('0x2b')]['includeAll']){_0x15af88[_0x9f15('0x3a')]=[{'all':!![]}];}_0x15af88=_['merge']({},_0x15af88,_0x364df6[_0x9f15('0x3f')]);return db[_0x9f15('0x25')][_0x9f15('0x1f')](_0x15af88)[_0x9f15('0x22')](handleEntityNotFound(_0x2580e0,null))[_0x9f15('0x22')](respondWithResult(_0x2580e0,null))[_0x9f15('0x40')](handleError(_0x2580e0,null));};exports[_0x9f15('0x13')]=function(_0x5129bb,_0x5ce6ed){return db['VoiceExtension'][_0x9f15('0x1f')]({'where':{'id':_0x5129bb[_0x9f15('0x3e')]['id']}})[_0x9f15('0x22')](handleEntityNotFound(_0x5ce6ed,null))['then'](removeEntity(_0x5ce6ed,null))[_0x9f15('0x40')](handleError(_0x5ce6ed,null));};exports[_0x9f15('0x41')]=function(_0x12de16,_0x3239f0){if(_0x12de16['body'][_0x9f15('0x1e')]===_0x9f15('0x17')&&!_[_0x9f15('0x42')](_0x12de16['body'][_0x9f15('0x43')],'_')){_0x12de16[_0x9f15('0x44')][_0x9f15('0x43')]='_'[_0x9f15('0x45')](_0x12de16['body'][_0x9f15('0x43')]);}return db[_0x9f15('0x25')][_0x9f15('0x41')](_0x12de16[_0x9f15('0x44')],{'raw':![]})[_0x9f15('0x22')](function(_0x362bff){var _0x363353=_0x12de16[_0x9f15('0x46')][_0x9f15('0x14')]({'plain':!![]});if(!_0x363353)throw new Error(_0x9f15('0x47'));if(_0x363353[_0x9f15('0x48')]===_0x9f15('0x46')){var _0x231393=_0x362bff[_0x9f15('0x14')]({'plain':!![]});var _0x388db0=[{'name':'InboundRoutes','value':_0x9f15('0x16')},{'name':_0x9f15('0x49'),'value':_0x9f15('0x17')},{'name':_0x9f15('0x18'),'value':_0x9f15('0x19')}];var _0xddd90=_[_0x9f15('0x1f')](_0x388db0,[_0x9f15('0x1c'),_0x231393[_0x9f15('0x1e')]])[_0x9f15('0x20')];return db['UserProfileSection']['find']({'where':{'name':_0xddd90,'userProfileId':_0x363353[_0x9f15('0x4a')]},'raw':!![]})['then'](function(_0x4c085d){if(_0x4c085d&&_0x4c085d[_0x9f15('0x4b')]===0x0){return db[_0x9f15('0x21')][_0x9f15('0x41')]({'name':_0x231393[_0x9f15('0x20')],'resourceId':_0x231393['id'],'type':_0x4c085d[_0x9f15('0x20')],'sectionId':_0x4c085d['id']},{})['then'](function(){return _0x362bff;});}else{return _0x362bff;}})[_0x9f15('0x40')](function(_0x4602d3){logger[_0x9f15('0x4c')](_0x9f15('0x4d'),_0x4602d3);throw _0x4602d3;});}return _0x362bff;})['then'](respondWithResult(_0x3239f0,0xc9))['catch'](handleError(_0x3239f0,null));};exports[_0x9f15('0x4e')]=function(_0x461220,_0x3b9e38){if(_0x461220[_0x9f15('0x44')]['id']){delete _0x461220[_0x9f15('0x44')]['id'];}return db['VoiceExtension'][_0x9f15('0x1f')]({'where':{'id':_0x461220['params']['id']}})[_0x9f15('0x22')](handleEntityNotFound(_0x3b9e38,null))[_0x9f15('0x22')](function(_0x364680){if(_0x364680){return db[_0x9f15('0x25')][_0x9f15('0x4e')](_['pick'](_0x461220['body'],[_0x9f15('0x43'),_0x9f15('0x4f'),_0x9f15('0x50'),_0x9f15('0x51'),_0x9f15('0x52'),_0x9f15('0x53'),_0x9f15('0x54')]),{'where':{'context':_0x364680['context'],'exten':_0x364680[_0x9f15('0x43')]},'individualHooks':!![]})['then'](function(_0x3aab81){return _0x3aab81;});}return null;})[_0x9f15('0x22')](respondWithStatusCode(_0x3b9e38,null))['catch'](handleError(_0x3b9e38,null));};exports[_0x9f15('0x55')]=function(_0x1846a8,_0x521017){var _0x326e59=_0x1846a8[_0x9f15('0x3e')]['id'];var _0x288c3d=_0x1846a8[_0x9f15('0x44')];var _0x5541ba=0xc8;var _0x50e6b7=null;return db[_0x9f15('0x56')]['transaction']({'isolationLevel':db['sequelize'][_0x9f15('0x57')]['ISOLATION_LEVELS'][_0x9f15('0x58')]},function(_0x299aec){return db['VoiceExtension'][_0x9f15('0x59')]({'where':{'id':_0x326e59},'transaction':_0x299aec})['then'](function(_0x1eafa5){if(_0x1eafa5){return db[_0x9f15('0x25')][_0x9f15('0x13')]({'where':{'VoiceExtensionId':_0x326e59},'transaction':_0x299aec})[_0x9f15('0x22')](function(){var _0x8fe3f6=_[_0x9f15('0x1b')](_0x288c3d,function(_0x20651c){_0x20651c[_0x9f15('0x5a')]=_0x326e59;_0x20651c[_0x9f15('0x5b')]=!![];return _0x20651c;});return _0x1eafa5[_0x9f15('0x5c')](_0x8fe3f6);})['then'](function(_0x1cd654){return db[_0x9f15('0x25')]['bulkCreate'](_0x1cd654,{'transaction':_0x299aec});});}else{_0x5541ba=0x194;_0x50e6b7=[];}});})['then'](function(){if(_0x5541ba!==0x194){return db[_0x9f15('0x25')][_0x9f15('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x326e59},'order':_0x9f15('0x5e')})[_0x9f15('0x22')](function(_0x579040){_0x50e6b7=_0x579040;});}})[_0x9f15('0x40')](function(_0x45b78b){_0x5541ba=0x1f4;logger[_0x9f15('0x4c')](_0x45b78b[_0x9f15('0x23')]);if(_0x45b78b[_0x9f15('0x20')]){delete _0x45b78b['name'];}_0x50e6b7=_0x45b78b;})['finally'](function(){if(_0x50e6b7===null){_0x521017['sendStatus'](_0x5541ba);}else{if(_0x5541ba===0x1f4){_0x521017[_0x9f15('0xa')](_0x5541ba)[_0x9f15('0x5f')](_0x50e6b7);}else{_0x521017[_0x9f15('0xa')](_0x5541ba)['json'](_0x50e6b7);}}});}; \ No newline at end of file +var _0x28f7=['mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','isApp','bulkCreate','findAndCountAll','finally','ioredis','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','then','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','value','type','find','name','UserProfileResource','destroy','stack','send','index','map','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','UserProfileSection','autoAssociation','error','update','recordingFormat','cutdigits'];(function(_0x5abb1b,_0x53f881){var _0x582ed6=function(_0x27ced7){while(--_0x27ced7){_0x5abb1b['push'](_0x5abb1b['shift']());}};_0x582ed6(++_0x53f881);}(_0x28f7,0x1ce));var _0x728f=function(_0x460397,_0x2d940c){_0x460397=_0x460397-0x0;var _0x5a4afe=_0x28f7[_0x460397];return _0x5a4afe;};'use strict';var _=require('lodash');var Redis=require(_0x728f('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x728f('0x1'))('api');var config=require(_0x728f('0x2'));var db=require('../../mysqldb')['db'];config[_0x728f('0x3')]=_[_0x728f('0x4')](config[_0x728f('0x3')],{'host':_0x728f('0x5'),'port':0x18eb});var socket=require(_0x728f('0x6'))(new Redis(config[_0x728f('0x3')]));require(_0x728f('0x7'))[_0x728f('0x8')](socket);function respondWithStatusCode(_0x15869c,_0x115de8){_0x115de8=_0x115de8||0xcc;return function(_0x36f25b){if(_0x36f25b){return _0x15869c[_0x728f('0x9')](_0x115de8);}return _0x15869c[_0x728f('0xa')](_0x115de8)[_0x728f('0xb')]();};}function respondWithResult(_0x5c05ce,_0x56dd8b){_0x56dd8b=_0x56dd8b||0xc8;return function(_0xef77d7){if(_0xef77d7){return _0x5c05ce[_0x728f('0xa')](_0x56dd8b)[_0x728f('0xc')](_0xef77d7);}};}function respondWithFilteredResult(_0x23c8fe,_0x53f871){return function(_0x14cdb2){if(_0x14cdb2){var _0x4add10=typeof _0x53f871[_0x728f('0xd')]===_0x728f('0xe')&&typeof _0x53f871[_0x728f('0xf')]==='undefined';var _0x2880c7=_0x14cdb2[_0x728f('0x10')];var _0x5c301e=_0x4add10?0x0:_0x53f871[_0x728f('0xd')];var _0x5a195b=_0x4add10?_0x14cdb2[_0x728f('0x10')]:_0x53f871[_0x728f('0xd')]+_0x53f871['limit'];var _0x408fac;if(_0x5a195b>=_0x2880c7){_0x5a195b=_0x2880c7;_0x408fac=0xc8;}else{_0x408fac=0xce;}_0x23c8fe[_0x728f('0xa')](_0x408fac);return _0x23c8fe[_0x728f('0x11')]('Content-Range',_0x5c301e+'-'+_0x5a195b+'/'+_0x2880c7)[_0x728f('0xc')](_0x14cdb2);}return null;};}function removeEntity(_0x4da2a0){return function(_0x24324c){if(_0x24324c){return _0x24324c['destroy']()[_0x728f('0x12')](function(){var _0x272dd4=_0x24324c['get']({'plain':!![]});var _0x27651c=[{'name':_0x728f('0x13'),'value':_0x728f('0x14'),'ignore':![]},{'name':_0x728f('0x15'),'value':_0x728f('0x16'),'ignore':![]},{'name':'InternalRoutes','value':_0x728f('0x17'),'ignore':![]}];var _0x3b7a79=_(_0x27651c)[_0x728f('0x18')](_0x728f('0x19'))['map'](_0x728f('0x1a'))[_0x728f('0x1a')]();if(_['includes'](_0x3b7a79,_0x272dd4[_0x728f('0x1b')])){return;}var _0x5ea8af=_[_0x728f('0x1c')](_0x27651c,[_0x728f('0x1a'),_0x272dd4[_0x728f('0x1b')]])[_0x728f('0x1d')];return db[_0x728f('0x1e')][_0x728f('0x1f')]({'where':{'type':_0x5ea8af,'resourceId':_0x272dd4['id']}})[_0x728f('0x12')](function(){return _0x24324c;});})['then'](function(){_0x4da2a0[_0x728f('0xa')](0xcc)[_0x728f('0xb')]();});}};}function handleEntityNotFound(_0x4ecce){return function(_0x38c76e){if(!_0x38c76e){_0x4ecce[_0x728f('0x9')](0x194);}return _0x38c76e;};}function handleError(_0x480791,_0x410184){_0x410184=_0x410184||0x1f4;return function(_0x2e4360){logger['error'](_0x2e4360[_0x728f('0x20')]);if(_0x2e4360[_0x728f('0x1d')]){delete _0x2e4360[_0x728f('0x1d')];}_0x480791[_0x728f('0xa')](_0x410184)[_0x728f('0x21')](_0x2e4360);};}exports[_0x728f('0x22')]=function(_0x4202da,_0x430797){var _0x2a6751={},_0x4d37de={},_0x5ac44f={'count':0x0,'rows':[]};var _0x356a53=_[_0x728f('0x23')](db[_0x728f('0x24')][_0x728f('0x25')],function(_0x2a50f1){return{'name':_0x2a50f1[_0x728f('0x26')],'type':_0x2a50f1['type'][_0x728f('0x27')]};});_0x4d37de[_0x728f('0x28')]=_['map'](_0x356a53,_0x728f('0x1d'));_0x4d37de[_0x728f('0x29')]=_[_0x728f('0x2a')](_0x4202da[_0x728f('0x29')]);_0x4d37de[_0x728f('0x2b')]=_[_0x728f('0x2c')](_0x4d37de[_0x728f('0x28')],_0x4d37de['query']);_0x2a6751['attributes']=_[_0x728f('0x2c')](_0x4d37de[_0x728f('0x28')],qs[_0x728f('0x2d')](_0x4202da['query'][_0x728f('0x2d')]));_0x2a6751[_0x728f('0x2e')]=_0x2a6751['attributes'][_0x728f('0x2f')]?_0x2a6751[_0x728f('0x2e')]:_0x4d37de[_0x728f('0x28')];if(!_0x4202da[_0x728f('0x29')][_0x728f('0x30')]('nolimit')){_0x2a6751[_0x728f('0xf')]=qs[_0x728f('0xf')](_0x4202da[_0x728f('0x29')][_0x728f('0xf')]);_0x2a6751[_0x728f('0xd')]=qs[_0x728f('0xd')](_0x4202da[_0x728f('0x29')][_0x728f('0xd')]);}_0x2a6751[_0x728f('0x31')]=qs[_0x728f('0x32')](_0x4202da['query']['sort']);_0x2a6751[_0x728f('0x33')]=qs[_0x728f('0x2b')](_[_0x728f('0x34')](_0x4202da['query'],_0x4d37de[_0x728f('0x2b')]),_0x356a53);if(_0x4202da['query'][_0x728f('0x18')]){_0x2a6751[_0x728f('0x33')]=_[_0x728f('0x35')](_0x2a6751[_0x728f('0x33')],{'$or':_[_0x728f('0x23')](_0x356a53,function(_0x327f60){if(_0x327f60[_0x728f('0x1b')]!==_0x728f('0x36')){var _0x24b715={};_0x24b715[_0x327f60['name']]={'$like':'%'+_0x4202da[_0x728f('0x29')][_0x728f('0x18')]+'%'};return _0x24b715;}})});}_0x2a6751=_[_0x728f('0x35')]({},_0x2a6751,_0x4202da[_0x728f('0x37')]);var _0xddd056={'where':_0x2a6751[_0x728f('0x33')]};return db['VoiceExtension']['count'](_0xddd056)[_0x728f('0x12')](function(_0x2f41a8){_0x5ac44f[_0x728f('0x10')]=_0x2f41a8;if(_0x4202da[_0x728f('0x29')][_0x728f('0x38')]){_0x2a6751[_0x728f('0x39')]=[{'all':!![]}];}return db[_0x728f('0x24')][_0x728f('0x3a')](_0x2a6751);})['then'](function(_0x37e860){_0x5ac44f[_0x728f('0x3b')]=_0x37e860;return _0x5ac44f;})[_0x728f('0x12')](respondWithFilteredResult(_0x430797,_0x2a6751))[_0x728f('0x3c')](handleError(_0x430797,null));};exports[_0x728f('0x3d')]=function(_0x373293,_0x41565e){var _0x45f8e3={'raw':![],'where':{'id':_0x373293[_0x728f('0x3e')]['id']}},_0x2a7726={};_0x2a7726[_0x728f('0x28')]=_['keys'](db[_0x728f('0x24')][_0x728f('0x25')]);_0x2a7726['query']=_[_0x728f('0x2a')](_0x373293[_0x728f('0x29')]);_0x2a7726[_0x728f('0x2b')]=_[_0x728f('0x2c')](_0x2a7726[_0x728f('0x28')],_0x2a7726[_0x728f('0x29')]);_0x45f8e3['attributes']=_[_0x728f('0x2c')](_0x2a7726[_0x728f('0x28')],qs['fields'](_0x373293['query']['fields']));_0x45f8e3[_0x728f('0x2e')]=_0x45f8e3[_0x728f('0x2e')]['length']?_0x45f8e3[_0x728f('0x2e')]:_0x2a7726['model'];if(_0x373293[_0x728f('0x29')]['includeAll']){_0x45f8e3['include']=[{'all':!![]}];}_0x45f8e3=_[_0x728f('0x35')]({},_0x45f8e3,_0x373293[_0x728f('0x37')]);return db['VoiceExtension']['find'](_0x45f8e3)['then'](handleEntityNotFound(_0x41565e,null))[_0x728f('0x12')](respondWithResult(_0x41565e,null))['catch'](handleError(_0x41565e,null));};exports['destroy']=function(_0x527c95,_0x587505){return db[_0x728f('0x24')]['find']({'where':{'id':_0x527c95[_0x728f('0x3e')]['id']}})[_0x728f('0x12')](handleEntityNotFound(_0x587505,null))[_0x728f('0x12')](removeEntity(_0x587505,null))[_0x728f('0x3c')](handleError(_0x587505,null));};exports[_0x728f('0x3f')]=function(_0x4d02be,_0x20e01f){if(_0x4d02be[_0x728f('0x40')]['type']==='outbound'&&!_['startsWith'](_0x4d02be['body'][_0x728f('0x41')],'_')){_0x4d02be[_0x728f('0x40')][_0x728f('0x41')]='_'[_0x728f('0x42')](_0x4d02be[_0x728f('0x40')][_0x728f('0x41')]);}return db[_0x728f('0x24')]['create'](_0x4d02be[_0x728f('0x40')],{'raw':![]})['then'](function(_0x2a2b9a){var _0x485a7c=_0x4d02be[_0x728f('0x43')][_0x728f('0x44')]({'plain':!![]});if(!_0x485a7c)throw new Error(_0x728f('0x45'));if(_0x485a7c[_0x728f('0x46')]===_0x728f('0x43')){var _0x6b6196=_0x2a2b9a[_0x728f('0x44')]({'plain':!![]});var _0x33fa54=[{'name':_0x728f('0x13'),'value':_0x728f('0x14')},{'name':_0x728f('0x15'),'value':'outbound'},{'name':_0x728f('0x47'),'value':'internal'}];var _0x5256b4=_[_0x728f('0x1c')](_0x33fa54,[_0x728f('0x1a'),_0x6b6196[_0x728f('0x1b')]])[_0x728f('0x1d')];return db[_0x728f('0x48')]['find']({'where':{'name':_0x5256b4,'userProfileId':_0x485a7c['userProfileId']},'raw':!![]})['then'](function(_0x23ff7e){if(_0x23ff7e&&_0x23ff7e[_0x728f('0x49')]===0x0){return db[_0x728f('0x1e')][_0x728f('0x3f')]({'name':_0x6b6196[_0x728f('0x1d')],'resourceId':_0x6b6196['id'],'type':_0x23ff7e[_0x728f('0x1d')],'sectionId':_0x23ff7e['id']},{})[_0x728f('0x12')](function(){return _0x2a2b9a;});}else{return _0x2a2b9a;}})['catch'](function(_0x571b4c){logger[_0x728f('0x4a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x571b4c);throw _0x571b4c;});}return _0x2a2b9a;})[_0x728f('0x12')](respondWithResult(_0x20e01f,0xc9))[_0x728f('0x3c')](handleError(_0x20e01f,null));};exports[_0x728f('0x4b')]=function(_0x11478b,_0x4cfaec){if(_0x11478b[_0x728f('0x40')]['id']){delete _0x11478b[_0x728f('0x40')]['id'];}return db[_0x728f('0x24')][_0x728f('0x1c')]({'where':{'id':_0x11478b[_0x728f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4cfaec,null))['then'](function(_0x4fa40f){if(_0x4fa40f){return db[_0x728f('0x24')][_0x728f('0x4b')](_[_0x728f('0x34')](_0x11478b[_0x728f('0x40')],[_0x728f('0x41'),'context','description',_0x728f('0x4c'),_0x728f('0x4d'),_0x728f('0x4e'),_0x728f('0x4f')]),{'where':{'context':_0x4fa40f['context'],'exten':_0x4fa40f[_0x728f('0x41')]},'individualHooks':!![]})['then'](function(_0x239bde){return _0x239bde;});}return null;})['then'](respondWithStatusCode(_0x4cfaec,null))[_0x728f('0x3c')](handleError(_0x4cfaec,null));};exports[_0x728f('0x50')]=function(_0x560d04,_0x21d2ba){var _0x11ccb0=_0x560d04[_0x728f('0x3e')]['id'];var _0x47060e=_0x560d04[_0x728f('0x40')];var _0x1768b2=0xc8;var _0x264806=null;return db[_0x728f('0x51')][_0x728f('0x52')]({'isolationLevel':db[_0x728f('0x51')][_0x728f('0x53')][_0x728f('0x54')]['READ_COMMITTED']},function(_0x224884){return db[_0x728f('0x24')][_0x728f('0x55')]({'where':{'id':_0x11ccb0},'transaction':_0x224884})[_0x728f('0x12')](function(_0x6bb307){if(_0x6bb307){return db[_0x728f('0x24')]['destroy']({'where':{'VoiceExtensionId':_0x11ccb0},'transaction':_0x224884})['then'](function(){var _0x2b4a0b=_[_0x728f('0x23')](_0x47060e,function(_0xc6761b){_0xc6761b['VoiceExtensionId']=_0x11ccb0;_0xc6761b[_0x728f('0x56')]=!![];return _0xc6761b;});return _0x6bb307['createRouting'](_0x2b4a0b);})['then'](function(_0xfb6a8f){return db[_0x728f('0x24')][_0x728f('0x57')](_0xfb6a8f,{'transaction':_0x224884});});}else{_0x1768b2=0x194;_0x264806=[];}});})['then'](function(){if(_0x1768b2!==0x194){return db[_0x728f('0x24')][_0x728f('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x11ccb0},'order':'cast(priority\x20as\x20unsigned)'})[_0x728f('0x12')](function(_0x35622c){_0x264806=_0x35622c;});}})['catch'](function(_0x942d3e){_0x1768b2=0x1f4;logger[_0x728f('0x4a')](_0x942d3e[_0x728f('0x20')]);if(_0x942d3e[_0x728f('0x1d')]){delete _0x942d3e[_0x728f('0x1d')];}_0x264806=_0x942d3e;})[_0x728f('0x59')](function(){if(_0x264806===null){_0x21d2ba['sendStatus'](_0x1768b2);}else{if(_0x1768b2===0x1f4){_0x21d2ba[_0x728f('0xa')](_0x1768b2)[_0x728f('0x21')](_0x264806);}else{_0x21d2ba[_0x728f('0xa')](_0x1768b2)[_0x728f('0xc')](_0x264806);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 3bc1a5f..f4e6208 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 _0x0af6=['exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2970f4,_0x171125){var _0x15bb2b=function(_0x48ab7c){while(--_0x48ab7c){_0x2970f4['push'](_0x2970f4['shift']());}};_0x15bb2b(++_0x171125);}(_0x0af6,0x1b9));var _0x60af=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0x0af6[_0x231b2e];return _0x3feb2a;};'use strict';var EventEmitter=require(_0x60af('0x0'));var VoiceExtension=require(_0x60af('0x1'))['db'][_0x60af('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x60af('0x3')](0x0);var events={'afterCreate':_0x60af('0x4'),'afterUpdate':_0x60af('0x5'),'afterDestroy':_0x60af('0x6')};function emitEvent(_0xe9e52){return function(_0x121eaf,_0x46228d,_0x1096f9){VoiceExtensionEvents[_0x60af('0x7')](_0xe9e52+':'+_0x121eaf['id'],_0x121eaf);VoiceExtensionEvents[_0x60af('0x7')](_0xe9e52,_0x121eaf);_0x1096f9(null);};}for(var e in events){if(events[_0x60af('0x8')](e)){var event=events[e];VoiceExtension[_0x60af('0x9')](e,emitEvent(event));}}module[_0x60af('0xa')]=VoiceExtensionEvents; \ No newline at end of file +var _0xe1a3=['VoiceExtension','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3c38a,_0x590548){var _0x16df15=function(_0x1f8983){while(--_0x1f8983){_0x3c38a['push'](_0x3c38a['shift']());}};_0x16df15(++_0x590548);}(_0xe1a3,0x148));var _0x3e1a=function(_0x3bd4a5,_0x2597bd){_0x3bd4a5=_0x3bd4a5-0x0;var _0x41d843=_0xe1a3[_0x3bd4a5];return _0x41d843;};'use strict';var EventEmitter=require(_0x3e1a('0x0'));var VoiceExtension=require(_0x3e1a('0x1'))['db'][_0x3e1a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1fd929){return function(_0x5a335f,_0x36b0d6,_0x191174){VoiceExtensionEvents[_0x3e1a('0x3')](_0x1fd929+':'+_0x5a335f['id'],_0x5a335f);VoiceExtensionEvents[_0x3e1a('0x3')](_0x1fd929,_0x5a335f);_0x191174(null);};}for(var e in events){if(events[_0x3e1a('0x4')](e)){var event=events[e];VoiceExtension[_0x3e1a('0x5')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index c6b7b1d..c60bad9 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 _0x0298=['No\x20alias\x20set','context','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','split','length','name','trunk','param','prefix','phone','SIP','join','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','then','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','queue','includes','app','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','define','VoiceExtension','voice_extensions','get','Hangup','lodash','exports','models','type','CDR(type)=','exten','alias','Set','NoOp'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0298,0x95));var _0x8029=function(_0x3146d5,_0x483d94){_0x3146d5=_0x3146d5-0x0;var _0x551674=_0x0298[_0x3146d5];return _0x551674;};'use strict';var _=require(_0x8029('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x8029('0x1')]=function(_0x43448f){var _0x2f521b=_0x43448f[_0x8029('0x2')];function _0xd466eb(_0xedf3dc){var _0x2f2e16=0x2;var _0x24d160=[{'type':_0xedf3dc[_0x8029('0x3')],'app':'Set','appdata':_0x8029('0x4')+_0xedf3dc[_0x8029('0x3')],'context':_0xedf3dc['context'],'exten':_0xedf3dc[_0x8029('0x5')],'priority':_0x2f2e16++,'VoiceExtensionId':_0xedf3dc['id']},{'type':_0xedf3dc[_0x8029('0x3')],'app':_0xedf3dc[_0x8029('0x6')]?_0x8029('0x7'):_0x8029('0x8'),'appdata':_0xedf3dc['alias']?'CDR(routeAlias)='+_0xedf3dc[_0x8029('0x6')]:_0x8029('0x9'),'context':_0xedf3dc[_0x8029('0xa')],'exten':_0xedf3dc['exten'],'priority':_0x2f2e16++,'VoiceExtensionId':_0xedf3dc['id']}];if(_0xedf3dc['type']===_0x8029('0xb')){_0x24d160[_0x8029('0xc')]({'type':'inbound','app':_0x8029('0x7'),'appdata':'CDR(routeid)='+_0xedf3dc['id'],'context':_0xedf3dc[_0x8029('0xa')],'exten':_0xedf3dc[_0x8029('0x5')],'priority':_0x2f2e16++,'VoiceExtensionId':_0xedf3dc['id']});}_0x24d160[_0x8029('0xc')]({'type':_0xedf3dc[_0x8029('0x3')],'app':_0x8029('0x7'),'appdata':_0x8029('0xd'),'context':_0xedf3dc['context'],'exten':_0xedf3dc[_0x8029('0x5')],'priority':_0x2f2e16++,'VoiceExtensionId':_0xedf3dc['id']},{'type':_0xedf3dc[_0x8029('0x3')],'app':_0x8029('0x7'),'appdata':_0x8029('0xe'),'context':_0xedf3dc['context'],'exten':_0xedf3dc['exten'],'priority':_0x2f2e16++,'VoiceExtensionId':_0xedf3dc['id']},{'type':_0xedf3dc['type'],'app':_0x8029('0x7'),'appdata':_0x8029('0xf'),'context':_0xedf3dc[_0x8029('0xa')],'exten':_0xedf3dc[_0x8029('0x5')],'priority':_0x2f2e16++,'VoiceExtensionId':_0xedf3dc['id']});return _0x24d160;}function _0x14ad14(_0x3bf5df){var _0x4f524a=0x2;var _0x43117d=[{'type':_0x8029('0x10'),'app':_0x8029('0x7'),'appdata':_0x8029('0x11'),'context':_0x3bf5df['context'],'exten':_0x3bf5df[_0x8029('0x5')],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']},{'type':_0x8029('0x10'),'app':_0x3bf5df['alias']?_0x8029('0x7'):'NoOp','appdata':_0x3bf5df[_0x8029('0x6')]?_0x8029('0x12')+_0x3bf5df[_0x8029('0x6')]:_0x8029('0x9'),'context':_0x3bf5df['context'],'exten':_0x3bf5df[_0x8029('0x5')],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']},{'type':_0x8029('0x10'),'app':'Set','appdata':'CDR(destination)='+(_0x3bf5df[_0x8029('0x13')]?_0x8029('0x14')+_0x3bf5df[_0x8029('0x13')]+'}':_0x8029('0x15')),'context':_0x3bf5df[_0x8029('0xa')],'exten':_0x3bf5df[_0x8029('0x5')],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']},{'type':_0x8029('0x10'),'app':_0x8029('0x7'),'appdata':_0x8029('0x16')+_0x3bf5df['id'],'context':_0x3bf5df[_0x8029('0xa')],'exten':_0x3bf5df[_0x8029('0x5')],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']},{'type':_0x8029('0x10'),'app':_0x8029('0x17'),'appdata':_0x8029('0x18')+(_0x4f524a+0x2)+_0x8029('0x19')+(_0x4f524a+0x1)+')','context':_0x3bf5df[_0x8029('0xa')],'exten':_0x3bf5df[_0x8029('0x5')],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']},{'type':_0x8029('0x10'),'app':_0x8029('0x7'),'appdata':_0x3bf5df[_0x8029('0x13')]?'CDR(prefix)=${EXTEN:0:'+_0x3bf5df[_0x8029('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x3bf5df[_0x8029('0xa')],'exten':_0x3bf5df[_0x8029('0x5')],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']},{'type':_0x8029('0x10'),'app':_0x8029('0x7'),'appdata':_0x8029('0xd'),'context':_0x3bf5df['context'],'exten':_0x3bf5df[_0x8029('0x5')],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']},{'type':_0x8029('0x10'),'app':_0x8029('0x7'),'appdata':_0x8029('0xe'),'context':_0x3bf5df[_0x8029('0xa')],'exten':_0x3bf5df['exten'],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']},{'type':_0x8029('0x10'),'app':_0x8029('0x7'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3bf5df[_0x8029('0xa')],'exten':_0x3bf5df['exten'],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']},{'type':_0x8029('0x10'),'app':_0x8029('0x7'),'appdata':_0x8029('0x1a')+_0x3bf5df['id'],'context':_0x3bf5df[_0x8029('0xa')],'exten':_0x3bf5df[_0x8029('0x5')],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']}];if(_0x3bf5df[_0x8029('0x1b')]('recordingFormat')&&_0x3bf5df[_0x8029('0x1c')]!==_0x8029('0x1d')){_0x43117d[_0x8029('0xc')]({'type':_0x8029('0x10'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3bf5df['context'],'exten':_0x3bf5df['exten'],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']},{'type':_0x8029('0x10'),'app':_0x8029('0x7'),'appdata':_0x8029('0x1e')+_0x3bf5df[_0x8029('0x1c')]||_0x8029('0x1f'),'context':_0x3bf5df[_0x8029('0xa')],'exten':_0x3bf5df['exten'],'priority':_0x4f524a++,'VoiceExtensionId':_0x3bf5df['id']});}return _0x43117d;}function _0x2bf869(_0x19a39e,_0x327a79){var _0x5bcd23=[{'name':'trunk','param':0x0},{'name':_0x8029('0x20'),'param':0x1},{'name':_0x8029('0x21'),'param':0x2},{'name':'url','param':0x3}];var _0x3d58d2={};var _0x2bc543=_0x327a79[_0x8029('0x22')](',');var _0x23037c=[];for(var _0x139b77=0x0;_0x139b77<_0x5bcd23[_0x8029('0x23')];_0x139b77++){switch(_0x5bcd23[_0x139b77][_0x8029('0x24')]){case _0x8029('0x25'):_0x3d58d2[_0x8029('0x25')]=_0x2bc543[_0x5bcd23[_0x139b77][_0x8029('0x26')]][_0x8029('0x22')]('/')[0x1];_0x3d58d2['phone']=_0x2bc543[_0x5bcd23[_0x139b77]['param']][_0x8029('0x22')]('/')[0x2];_0x3d58d2[_0x8029('0x27')]=_0x3d58d2[_0x8029('0x28')]?_0x3d58d2['phone'][_0x8029('0x22')]('$')[0x0]:undefined;_0x3d58d2[_0x8029('0x28')]=_0x19a39e['cutdigits']?(_0x3d58d2[_0x8029('0x27')]||'')+_0x8029('0x14')+_0x19a39e[_0x8029('0x13')]+'}':(_0x3d58d2[_0x8029('0x27')]||'')+_0x8029('0x15');_0x23037c[_0x5bcd23[_0x139b77][_0x8029('0x26')]]=[_0x8029('0x29'),_0x3d58d2['trunk'],_0x3d58d2['phone']][_0x8029('0x2a')]('/');break;case _0x8029('0x21'):_0x3d58d2[_0x8029('0x21')]=_0x2bc543[_0x5bcd23[_0x139b77][_0x8029('0x26')]];if(_0x19a39e['recordingFormat']!==_0x8029('0x1d')){if(_0x3d58d2[_0x8029('0x21')]['indexOf'](_0x8029('0x2b'))<0x0){_0x3d58d2[_0x8029('0x21')]+=_0x8029('0x2b');}}else{_0x3d58d2[_0x8029('0x21')]=_0x3d58d2[_0x8029('0x21')][_0x8029('0x2c')]('U(xcally-mixmonitor-context)','');}_0x23037c[_0x5bcd23[_0x139b77][_0x8029('0x26')]]=_0x3d58d2['options'];break;default:_0x23037c[_0x5bcd23[_0x139b77][_0x8029('0x26')]]=_0x2bc543[_0x5bcd23[_0x139b77]['param']];}}return _0x23037c[_0x8029('0x2a')](',');}function _0x1cae7d(_0x29b2b7,_0x40a3db,_0x1020fb){return new Promise(function(_0x670193,_0x2f7728){var _0x594ca5=[];if(_[_0x8029('0x2d')](_0x40a3db))return _0x670193(_0x594ca5);_0x2f521b['Interval'][_0x8029('0x2e')]({'attributes':['id',_0x8029('0x2f'),'IntervalId'],'raw':!![]})[_0x8029('0x30')](function(_0x4e2c23){for(var _0x3fc000=0x0,_0x5b9b8d=0x0;_0x3fc000<_0x40a3db[_0x8029('0x23')];_0x3fc000++,_0x5b9b8d=0x0){var _0x24fcd7=_0x40a3db[_0x3fc000];var _0x31ba25=[];var _0x224ccb=[];delete _0x24fcd7['id'];if(_0x24fcd7[_0x8029('0x2f')]!==_0x8029('0x31')){_0x24fcd7[_0x8029('0x32')]=[_0x24fcd7[_0x8029('0x2f')]];}else{_0x24fcd7[_0x8029('0x32')]=_0x24fcd7[_0x8029('0x33')]?_[_0x8029('0x34')](_[_0x8029('0x35')](_0x4e2c23,{'IntervalId':_0x24fcd7[_0x8029('0x33')]}),_0x8029('0x2f')):[];}_0x24fcd7['context']=_0x29b2b7['context'];_0x24fcd7[_0x8029('0x5')]=_0x29b2b7[_0x8029('0x5')];if(_0x24fcd7[_0x8029('0x3')])_0x24fcd7['type']=_0x24fcd7[_0x8029('0x3')][_0x8029('0x36')]();if(_0x29b2b7[_0x8029('0x3')]===_0x8029('0x10')){if(_0x24fcd7[_0x8029('0x1b')]('tag')&&_0x24fcd7[_0x8029('0x37')]&&_0x24fcd7[_0x8029('0x37')]!=='--'){_0x31ba25[_0x8029('0xc')]({'type':_0x24fcd7[_0x8029('0x3')][_0x8029('0x36')](),'app':_0x8029('0x7'),'appdata':_0x8029('0x38')+_0x24fcd7[_0x8029('0x37')],'context':_0x29b2b7['context'],'exten':_0x29b2b7[_0x8029('0x5')],'priority':_0x24fcd7['intervals'][_0x8029('0x23')]+_0x1020fb+_0x5b9b8d++,'VoiceExtensionId':_0x29b2b7['id']});}_0x31ba25['push']({'type':_0x24fcd7['type'][_0x8029('0x36')](),'app':_0x8029('0x17'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x24fcd7['callerID']?_0x8029('0x39')+_0x24fcd7[_0x8029('0x3a')]+')':_0x8029('0x3b')),'context':_0x29b2b7[_0x8029('0xa')],'exten':_0x29b2b7[_0x8029('0x5')],'priority':_0x24fcd7[_0x8029('0x32')][_0x8029('0x23')]+_0x1020fb+_0x5b9b8d++,'VoiceExtensionId':_0x29b2b7['id']});}else{if(_0x24fcd7['hasOwnProperty']('answer')){if([_0x8029('0x3c'),'playback'][_0x8029('0x3d')](_0x24fcd7[_0x8029('0x3e')]['toLowerCase']())&&_0x24fcd7['appType']!=='custom'){if(_0x24fcd7['answer']){_0x31ba25['push']({'type':_0x24fcd7[_0x8029('0x3')][_0x8029('0x36')](),'app':_0x8029('0x17'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x29b2b7['context'],'exten':_0x29b2b7[_0x8029('0x5')],'priority':_0x24fcd7['intervals'][_0x8029('0x23')]+_0x1020fb+_0x5b9b8d++,'VoiceExtensionId':_0x29b2b7['id']});_0x31ba25[_0x8029('0xc')]({'type':_0x24fcd7[_0x8029('0x3')][_0x8029('0x36')](),'app':'Set','appdata':_0x8029('0x3f'),'context':_0x29b2b7['context'],'exten':_0x29b2b7['exten'],'priority':_0x24fcd7[_0x8029('0x32')][_0x8029('0x23')]+_0x1020fb+_0x5b9b8d++,'VoiceExtensionId':_0x29b2b7['id']});}else{_0x31ba25[_0x8029('0xc')]({'type':_0x24fcd7[_0x8029('0x3')][_0x8029('0x36')](),'app':_0x8029('0x17'),'appdata':_0x8029('0x40'),'context':_0x29b2b7[_0x8029('0xa')],'exten':_0x29b2b7[_0x8029('0x5')],'priority':_0x24fcd7['intervals'][_0x8029('0x23')]+_0x1020fb+_0x5b9b8d++,'VoiceExtensionId':_0x29b2b7['id']});_0x31ba25[_0x8029('0xc')]({'type':_0x24fcd7[_0x8029('0x3')][_0x8029('0x36')](),'app':_0x8029('0x7'),'appdata':_0x8029('0x41'),'context':_0x29b2b7[_0x8029('0xa')],'exten':_0x29b2b7[_0x8029('0x5')],'priority':_0x24fcd7['intervals'][_0x8029('0x23')]+_0x1020fb+_0x5b9b8d++,'VoiceExtensionId':_0x29b2b7['id']});}}}}for(var _0x37f1f4=0x0;_0x37f1f4<_0x24fcd7['intervals'][_0x8029('0x23')];_0x37f1f4++){var _0x37490d=_0x1020fb+_0x24fcd7[_0x8029('0x32')]['length'];var _0x3fc171=_0x37f1f4===_0x24fcd7[_0x8029('0x32')][_0x8029('0x23')]-0x1?_0x1020fb+_0x31ba25['length']+_0x224ccb[_0x8029('0x23')]+0x2:_0x1020fb+_0x37f1f4+0x1;_0x31ba25['splice'](_0x37f1f4,0x0,{'type':_0x29b2b7[_0x8029('0x3')],'app':_0x8029('0x42'),'appdata':_0x24fcd7[_0x8029('0x32')][_0x37f1f4]+'?'+_0x29b2b7[_0x8029('0xa')]+_0x8029('0x43')+_0x37490d+':'+_0x29b2b7[_0x8029('0xa')]+',${EXTEN},'+_0x3fc171,'exten':_0x29b2b7[_0x8029('0x5')],'context':_0x29b2b7[_0x8029('0xa')],'priority':_0x1020fb+_0x37f1f4,'VoiceExtensionId':_0x29b2b7['id']});}if(_0x24fcd7[_0x8029('0x44')]===_0x8029('0x45'))_0x24fcd7[_0x8029('0x46')]=_0x2bf869(_0x29b2b7,_0x24fcd7[_0x8029('0x46')]);_0x24fcd7[_0x8029('0x47')]=_0x31ba25['length']?_[_0x8029('0x48')](_0x31ba25)[_0x8029('0x47')]+0x1:_0x1020fb;_0x594ca5=_[_0x8029('0x49')](_0x594ca5,_0x31ba25,[_0x24fcd7],_0x224ccb);_0x1020fb=_[_0x8029('0x48')](_0x594ca5)[_0x8029('0x47')]+0x1;}return _0x670193(_0x594ca5);})['catch'](function(_0x237abc){_0x2f7728(_0x237abc);});});}return _0x43448f[_0x8029('0x4a')](_0x8029('0x4b'),attributes,{'tableName':_0x8029('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x26ae5f){var _0x27fe4f=this[_0x8029('0x4d')]({'plain':!![]});var _0x5be614=_0x27fe4f['type']==='outbound'?_0x14ad14(_0x27fe4f):_0xd466eb(_0x27fe4f);return _0x1cae7d(_0x27fe4f,_0x26ae5f,_[_0x8029('0x48')](_0x5be614)[_0x8029('0x47')]+0x1)[_0x8029('0x30')](function(_0x4f68d9){var _0x1d75a3=_[_0x8029('0x49')](_0x5be614,_0x4f68d9);_0x1d75a3[_0x8029('0xc')]({'type':_0x27fe4f[_0x8029('0x3')],'app':_0x8029('0x4e'),'exten':_0x27fe4f[_0x8029('0x5')],'context':_0x27fe4f[_0x8029('0xa')],'priority':_[_0x8029('0x48')](_0x1d75a3)['priority']+0x1,'VoiceExtensionId':_0x27fe4f['id']});return _0x1d75a3;});}}});}; \ No newline at end of file +var _0x5e17=['CDR(type)=outbound','outbound','CDR(routeAlias)=','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','phone','prefix','${EXTEN:','SIP','join','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','outboundDial','appdata','priority','concat','last','define','VoiceExtension','voice_extensions','then','Hangup','lodash','type','Set','CDR(type)=','context','exten','alias','NoOp','inbound','push','CDR(routeid)=','MONITOR_OPTIONS=ab'];(function(_0x265e0e,_0x38b2bb){var _0x518157=function(_0x1e3eab){while(--_0x1e3eab){_0x265e0e['push'](_0x265e0e['shift']());}};_0x518157(++_0x38b2bb);}(_0x5e17,0x17a));var _0x75e1=function(_0x33a413,_0xce31ae){_0x33a413=_0x33a413-0x0;var _0x439361=_0x5e17[_0x33a413];return _0x439361;};'use strict';var _=require(_0x75e1('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x4c7527){var _0x55bd67=_0x4c7527['models'];function _0x43afe6(_0x25fc55){var _0x23ec49=0x2;var _0x1e8819=[{'type':_0x25fc55[_0x75e1('0x1')],'app':_0x75e1('0x2'),'appdata':_0x75e1('0x3')+_0x25fc55[_0x75e1('0x1')],'context':_0x25fc55[_0x75e1('0x4')],'exten':_0x25fc55[_0x75e1('0x5')],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']},{'type':_0x25fc55[_0x75e1('0x1')],'app':_0x25fc55[_0x75e1('0x6')]?_0x75e1('0x2'):_0x75e1('0x7'),'appdata':_0x25fc55[_0x75e1('0x6')]?'CDR(routeAlias)='+_0x25fc55[_0x75e1('0x6')]:'No\x20alias\x20set','context':_0x25fc55['context'],'exten':_0x25fc55[_0x75e1('0x5')],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']}];if(_0x25fc55[_0x75e1('0x1')]===_0x75e1('0x8')){_0x1e8819[_0x75e1('0x9')]({'type':_0x75e1('0x8'),'app':_0x75e1('0x2'),'appdata':_0x75e1('0xa')+_0x25fc55['id'],'context':_0x25fc55[_0x75e1('0x4')],'exten':_0x25fc55['exten'],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']});}_0x1e8819[_0x75e1('0x9')]({'type':_0x25fc55[_0x75e1('0x1')],'app':_0x75e1('0x2'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x25fc55[_0x75e1('0x4')],'exten':_0x25fc55[_0x75e1('0x5')],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']},{'type':_0x25fc55[_0x75e1('0x1')],'app':_0x75e1('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x25fc55[_0x75e1('0x4')],'exten':_0x25fc55[_0x75e1('0x5')],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']},{'type':_0x25fc55[_0x75e1('0x1')],'app':_0x75e1('0x2'),'appdata':_0x75e1('0xb'),'context':_0x25fc55[_0x75e1('0x4')],'exten':_0x25fc55[_0x75e1('0x5')],'priority':_0x23ec49++,'VoiceExtensionId':_0x25fc55['id']});return _0x1e8819;}function _0x56c741(_0x4251ea){var _0x14dc9d=0x2;var _0x2128af=[{'type':'outbound','app':_0x75e1('0x2'),'appdata':_0x75e1('0xc'),'context':_0x4251ea['context'],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x4251ea[_0x75e1('0x6')]?'Set':_0x75e1('0x7'),'appdata':_0x4251ea[_0x75e1('0x6')]?_0x75e1('0xe')+_0x4251ea[_0x75e1('0x6')]:_0x75e1('0xf'),'context':_0x4251ea['context'],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':'outbound','app':_0x75e1('0x2'),'appdata':_0x75e1('0x10')+(_0x4251ea[_0x75e1('0x11')]?'${EXTEN:'+_0x4251ea['cutdigits']+'}':_0x75e1('0x12')),'context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x75e1('0x2'),'appdata':_0x75e1('0xa')+_0x4251ea['id'],'context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea['exten'],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x75e1('0x13'),'appdata':_0x75e1('0x14')+(_0x14dc9d+0x2)+_0x75e1('0x15')+(_0x14dc9d+0x1)+')','context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x75e1('0x2'),'appdata':_0x4251ea[_0x75e1('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x4251ea[_0x75e1('0x11')]+'}':_0x75e1('0x16'),'context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea['exten'],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x75e1('0x2'),'appdata':_0x75e1('0x17'),'context':_0x4251ea['context'],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':_0x75e1('0x2'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':'outbound','app':_0x75e1('0x2'),'appdata':_0x75e1('0x18')+_0x4251ea['id'],'context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']}];if(_0x4251ea[_0x75e1('0x19')]('recordingFormat')&&_0x4251ea[_0x75e1('0x1a')]!==_0x75e1('0x1b')){_0x2128af['push']({'type':_0x75e1('0xd'),'app':_0x75e1('0x2'),'appdata':_0x75e1('0x1c'),'context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']},{'type':_0x75e1('0xd'),'app':'Set','appdata':_0x75e1('0x1d')+_0x4251ea['recordingFormat']||'wav','context':_0x4251ea[_0x75e1('0x4')],'exten':_0x4251ea[_0x75e1('0x5')],'priority':_0x14dc9d++,'VoiceExtensionId':_0x4251ea['id']});}return _0x2128af;}function _0xb5b393(_0x33229d,_0x3682e5){var _0x81c069=[{'name':_0x75e1('0x1e'),'param':0x0},{'name':_0x75e1('0x1f'),'param':0x1},{'name':_0x75e1('0x20'),'param':0x2},{'name':_0x75e1('0x21'),'param':0x3}];var _0x3a6840={};var _0x69520b=_0x3682e5[_0x75e1('0x22')](',');var _0x5779c8=[];for(var _0x2ec108=0x0;_0x2ec108<_0x81c069[_0x75e1('0x23')];_0x2ec108++){switch(_0x81c069[_0x2ec108][_0x75e1('0x24')]){case _0x75e1('0x1e'):_0x3a6840[_0x75e1('0x1e')]=_0x69520b[_0x81c069[_0x2ec108][_0x75e1('0x25')]]['split']('/')[0x1];_0x3a6840[_0x75e1('0x26')]=_0x69520b[_0x81c069[_0x2ec108][_0x75e1('0x25')]][_0x75e1('0x22')]('/')[0x2];_0x3a6840[_0x75e1('0x27')]=_0x3a6840[_0x75e1('0x26')]?_0x3a6840[_0x75e1('0x26')]['split']('$')[0x0]:undefined;_0x3a6840[_0x75e1('0x26')]=_0x33229d[_0x75e1('0x11')]?(_0x3a6840['prefix']||'')+_0x75e1('0x28')+_0x33229d[_0x75e1('0x11')]+'}':(_0x3a6840['prefix']||'')+_0x75e1('0x12');_0x5779c8[_0x81c069[_0x2ec108][_0x75e1('0x25')]]=[_0x75e1('0x29'),_0x3a6840[_0x75e1('0x1e')],_0x3a6840[_0x75e1('0x26')]][_0x75e1('0x2a')]('/');break;case _0x75e1('0x20'):_0x3a6840['options']=_0x69520b[_0x81c069[_0x2ec108][_0x75e1('0x25')]];if(_0x33229d[_0x75e1('0x1a')]!=='none'){if(_0x3a6840[_0x75e1('0x20')]['indexOf'](_0x75e1('0x2b'))<0x0){_0x3a6840[_0x75e1('0x20')]+='U(xcally-mixmonitor-context)';}}else{_0x3a6840['options']=_0x3a6840[_0x75e1('0x20')]['replace'](_0x75e1('0x2b'),'');}_0x5779c8[_0x81c069[_0x2ec108][_0x75e1('0x25')]]=_0x3a6840[_0x75e1('0x20')];break;default:_0x5779c8[_0x81c069[_0x2ec108][_0x75e1('0x25')]]=_0x69520b[_0x81c069[_0x2ec108]['param']];}}return _0x5779c8[_0x75e1('0x2a')](',');}function _0x28e964(_0x17f1de,_0x12137b,_0xb50d2e){return new Promise(function(_0x4f9f13,_0x10c0b0){var _0x221c97=[];if(_[_0x75e1('0x2c')](_0x12137b))return _0x4f9f13(_0x221c97);_0x55bd67[_0x75e1('0x2d')][_0x75e1('0x2e')]({'attributes':['id',_0x75e1('0x2f'),_0x75e1('0x30')],'raw':!![]})['then'](function(_0x3b377b){for(var _0x573c38=0x0,_0x24ddce=0x0;_0x573c38<_0x12137b[_0x75e1('0x23')];_0x573c38++,_0x24ddce=0x0){var _0x127b6e=_0x12137b[_0x573c38];var _0x5501d6=[];var _0x239bcd=[];delete _0x127b6e['id'];if(_0x127b6e['interval']!==_0x75e1('0x31')){_0x127b6e[_0x75e1('0x32')]=[_0x127b6e[_0x75e1('0x2f')]];}else{_0x127b6e[_0x75e1('0x32')]=_0x127b6e['IntervalId']?_[_0x75e1('0x33')](_[_0x75e1('0x34')](_0x3b377b,{'IntervalId':_0x127b6e[_0x75e1('0x30')]}),_0x75e1('0x2f')):[];}_0x127b6e[_0x75e1('0x4')]=_0x17f1de[_0x75e1('0x4')];_0x127b6e[_0x75e1('0x5')]=_0x17f1de[_0x75e1('0x5')];if(_0x127b6e[_0x75e1('0x1')])_0x127b6e[_0x75e1('0x1')]=_0x127b6e[_0x75e1('0x1')][_0x75e1('0x35')]();if(_0x17f1de[_0x75e1('0x1')]===_0x75e1('0xd')){if(_0x127b6e['hasOwnProperty'](_0x75e1('0x36'))&&_0x127b6e[_0x75e1('0x36')]&&_0x127b6e[_0x75e1('0x36')]!=='--'){_0x5501d6[_0x75e1('0x9')]({'type':_0x127b6e['type']['toLowerCase'](),'app':'Set','appdata':_0x75e1('0x37')+_0x127b6e[_0x75e1('0x36')],'context':_0x17f1de[_0x75e1('0x4')],'exten':_0x17f1de['exten'],'priority':_0x127b6e['intervals'][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});}_0x5501d6[_0x75e1('0x9')]({'type':_0x127b6e[_0x75e1('0x1')][_0x75e1('0x35')](),'app':_0x75e1('0x13'),'appdata':_0x75e1('0x38')+(_0x127b6e[_0x75e1('0x39')]?_0x75e1('0x3a')+_0x127b6e['callerID']+')':_0x75e1('0x3b')),'context':_0x17f1de[_0x75e1('0x4')],'exten':_0x17f1de['exten'],'priority':_0x127b6e['intervals'][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});}else{if(_0x127b6e[_0x75e1('0x19')](_0x75e1('0x3c'))){if([_0x75e1('0x3d'),_0x75e1('0x3e')][_0x75e1('0x3f')](_0x127b6e[_0x75e1('0x40')][_0x75e1('0x35')]())&&_0x127b6e['appType']!=='custom'){if(_0x127b6e['answer']){_0x5501d6['push']({'type':_0x127b6e[_0x75e1('0x1')][_0x75e1('0x35')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x17f1de['context'],'exten':_0x17f1de['exten'],'priority':_0x127b6e[_0x75e1('0x32')][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});_0x5501d6[_0x75e1('0x9')]({'type':_0x127b6e[_0x75e1('0x1')][_0x75e1('0x35')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x17f1de[_0x75e1('0x4')],'exten':_0x17f1de[_0x75e1('0x5')],'priority':_0x127b6e[_0x75e1('0x32')][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});}else{_0x5501d6['push']({'type':_0x127b6e[_0x75e1('0x1')][_0x75e1('0x35')](),'app':_0x75e1('0x13'),'appdata':_0x75e1('0x41'),'context':_0x17f1de[_0x75e1('0x4')],'exten':_0x17f1de[_0x75e1('0x5')],'priority':_0x127b6e[_0x75e1('0x32')][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});_0x5501d6['push']({'type':_0x127b6e['type']['toLowerCase'](),'app':_0x75e1('0x2'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x17f1de['context'],'exten':_0x17f1de['exten'],'priority':_0x127b6e[_0x75e1('0x32')][_0x75e1('0x23')]+_0xb50d2e+_0x24ddce++,'VoiceExtensionId':_0x17f1de['id']});}}}}for(var _0x9d7a02=0x0;_0x9d7a02<_0x127b6e[_0x75e1('0x32')]['length'];_0x9d7a02++){var _0x527d73=_0xb50d2e+_0x127b6e[_0x75e1('0x32')]['length'];var _0x5551b7=_0x9d7a02===_0x127b6e[_0x75e1('0x32')][_0x75e1('0x23')]-0x1?_0xb50d2e+_0x5501d6[_0x75e1('0x23')]+_0x239bcd[_0x75e1('0x23')]+0x2:_0xb50d2e+_0x9d7a02+0x1;_0x5501d6[_0x75e1('0x42')](_0x9d7a02,0x0,{'type':_0x17f1de[_0x75e1('0x1')],'app':'GotoIfTime','appdata':_0x127b6e[_0x75e1('0x32')][_0x9d7a02]+'?'+_0x17f1de['context']+_0x75e1('0x43')+_0x527d73+':'+_0x17f1de[_0x75e1('0x4')]+_0x75e1('0x43')+_0x5551b7,'exten':_0x17f1de[_0x75e1('0x5')],'context':_0x17f1de[_0x75e1('0x4')],'priority':_0xb50d2e+_0x9d7a02,'VoiceExtensionId':_0x17f1de['id']});}if(_0x127b6e['appType']===_0x75e1('0x44'))_0x127b6e[_0x75e1('0x45')]=_0xb5b393(_0x17f1de,_0x127b6e['appdata']);_0x127b6e[_0x75e1('0x46')]=_0x5501d6['length']?_['last'](_0x5501d6)[_0x75e1('0x46')]+0x1:_0xb50d2e;_0x221c97=_[_0x75e1('0x47')](_0x221c97,_0x5501d6,[_0x127b6e],_0x239bcd);_0xb50d2e=_[_0x75e1('0x48')](_0x221c97)['priority']+0x1;}return _0x4f9f13(_0x221c97);})['catch'](function(_0x3b42a8){_0x10c0b0(_0x3b42a8);});});}return _0x4c7527[_0x75e1('0x49')](_0x75e1('0x4a'),attributes,{'tableName':_0x75e1('0x4b'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5b9111){var _0x4b1d6e=this['get']({'plain':!![]});var _0x28b141=_0x4b1d6e['type']==='outbound'?_0x56c741(_0x4b1d6e):_0x43afe6(_0x4b1d6e);return _0x28e964(_0x4b1d6e,_0x5b9111,_[_0x75e1('0x48')](_0x28b141)[_0x75e1('0x46')]+0x1)[_0x75e1('0x4c')](function(_0x169cbb){var _0x1012f3=_[_0x75e1('0x47')](_0x28b141,_0x169cbb);_0x1012f3[_0x75e1('0x9')]({'type':_0x4b1d6e[_0x75e1('0x1')],'app':_0x75e1('0x4d'),'exten':_0x4b1d6e[_0x75e1('0x5')],'context':_0x4b1d6e[_0x75e1('0x4')],'priority':_[_0x75e1('0x48')](_0x1012f3)['priority']+0x1,'VoiceExtensionId':_0x4b1d6e['id']});return _0x1012f3;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index cf7c59b..2649f58 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 _0x18af=['moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetVoiceExtension','findAll','options','where','attributes','limit','include','map','model','stringify','lodash'];(function(_0x5ac425,_0x408d40){var _0x397c36=function(_0x2b7deb){while(--_0x2b7deb){_0x5ac425['push'](_0x5ac425['shift']());}};_0x397c36(++_0x408d40);}(_0x18af,0x8b));var _0xf18a=function(_0x47884e,_0x1a9a55){_0x47884e=_0x47884e-0x0;var _0x29f668=_0x18af[_0x47884e];return _0x29f668;};'use strict';var _=require(_0xf18a('0x0'));var util=require('util');var moment=require(_0xf18a('0x1'));var BPromise=require('bluebird');var rs=require(_0xf18a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf18a('0x3'))(_0xf18a('0x4'));var config=require(_0xf18a('0x5'));var jayson=require(_0xf18a('0x6'));var client=jayson['client'][_0xf18a('0x7')]({'port':0x232a});config[_0xf18a('0x8')]=_[_0xf18a('0x9')](config['redis'],{'host':_0xf18a('0xa'),'port':0x18eb});var socket=require(_0xf18a('0xb'))(new Redis(config[_0xf18a('0x8')]));require(_0xf18a('0xc'))[_0xf18a('0xd')](socket);function respondWithRpcPromise(_0x270333,_0xcafadb,_0x20247d){return new BPromise(function(_0x33fb6a,_0x31ab9a){return client[_0xf18a('0xe')](_0x270333,_0x20247d)[_0xf18a('0xf')](function(_0x36a9c6){logger['info'](_0xf18a('0x10'),_0xcafadb,_0xf18a('0x11'));logger[_0xf18a('0x12')](_0xf18a('0x13'),_0xcafadb,_0xf18a('0x11'),JSON['stringify'](_0x36a9c6));if(_0x36a9c6[_0xf18a('0x14')]){if(_0x36a9c6[_0xf18a('0x14')]['code']===0x1f4){logger[_0xf18a('0x14')]('VoiceExtension,\x20%s,\x20%s',_0xcafadb,_0x36a9c6[_0xf18a('0x14')][_0xf18a('0x15')]);return _0x31ab9a(_0x36a9c6['error'][_0xf18a('0x15')]);}logger['error'](_0xf18a('0x10'),_0xcafadb,_0x36a9c6[_0xf18a('0x14')]['message']);return _0x33fb6a(_0x36a9c6['error'][_0xf18a('0x15')]);}else{logger[_0xf18a('0x16')]('VoiceExtension,\x20%s,\x20%s',_0xcafadb,'request\x20sent');_0x33fb6a(_0x36a9c6[_0xf18a('0x17')][_0xf18a('0x15')]);}})[_0xf18a('0x18')](function(_0x5c9173){logger[_0xf18a('0x14')]('VoiceExtension,\x20%s,\x20%s',_0xcafadb,_0x5c9173);_0x31ab9a(_0x5c9173);});});}exports[_0xf18a('0x19')]=function(_0x31cb63){var _0x5f170a=this;return new Promise(function(_0x1aa0b2,_0x340d94){return db['VoiceExtension'][_0xf18a('0x1a')]({'raw':_0x31cb63[_0xf18a('0x1b')]?_0x31cb63[_0xf18a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x31cb63['options']?_0x31cb63[_0xf18a('0x1b')][_0xf18a('0x1c')]||null:null,'attributes':_0x31cb63[_0xf18a('0x1b')]?_0x31cb63[_0xf18a('0x1b')][_0xf18a('0x1d')]||null:null,'limit':_0x31cb63[_0xf18a('0x1b')]?_0x31cb63[_0xf18a('0x1b')][_0xf18a('0x1e')]||null:null,'include':_0x31cb63[_0xf18a('0x1b')]?_0x31cb63['options'][_0xf18a('0x1f')]?_[_0xf18a('0x20')](_0x31cb63[_0xf18a('0x1b')][_0xf18a('0x1f')],function(_0x5dd917){return{'model':db[_0x5dd917[_0xf18a('0x21')]],'as':_0x5dd917['as'],'attributes':_0x5dd917[_0xf18a('0x1d')],'include':_0x5dd917[_0xf18a('0x1f')]?_['map'](_0x5dd917[_0xf18a('0x1f')],function(_0x40d6d3){return{'model':db[_0x40d6d3[_0xf18a('0x21')]],'as':_0x40d6d3['as'],'attributes':_0x40d6d3[_0xf18a('0x1d')],'include':_0x40d6d3['include']?_[_0xf18a('0x20')](_0x40d6d3[_0xf18a('0x1f')],function(_0x53ba5b){return{'model':db[_0x53ba5b['model']],'as':_0x53ba5b['as'],'attributes':_0x53ba5b[_0xf18a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf18a('0xf')](function(_0x7e668c){logger[_0xf18a('0x16')]('GetVoiceExtension',_0x31cb63);logger[_0xf18a('0x12')](_0xf18a('0x19'),_0x31cb63,JSON[_0xf18a('0x22')](_0x7e668c));_0x1aa0b2(_0x7e668c);})[_0xf18a('0x18')](function(_0x3a9b89){logger[_0xf18a('0x14')]('GetVoiceExtension',_0x3a9b89['message'],_0x31cb63);_0x340d94(_0x5f170a[_0xf18a('0x14')](0x1f4,_0x3a9b89[_0xf18a('0x15')]));});});}; \ No newline at end of file +var _0xb138=['where','attributes','limit','include','model','map','then','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./voiceExtension.socket','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','message','result','GetVoiceExtension','VoiceExtension','findAll','raw','options'];(function(_0x2f2352,_0x2158a1){var _0x49663d=function(_0x249c8a){while(--_0x249c8a){_0x2f2352['push'](_0x2f2352['shift']());}};_0x49663d(++_0x2158a1);}(_0xb138,0x1dd));var _0x8b13=function(_0x1e8eee,_0x44bfe9){_0x1e8eee=_0x1e8eee-0x0;var _0x55fe4b=_0xb138[_0x1e8eee];return _0x55fe4b;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8b13('0xa')][_0x8b13('0xb')]({'port':0x232a});config['redis']=_[_0x8b13('0xc')](config[_0x8b13('0xd')],{'host':_0x8b13('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b13('0xd')]));require(_0x8b13('0xf'))['register'](socket);function respondWithRpcPromise(_0x53ae50,_0x1f2528,_0x21fcd9){return new BPromise(function(_0x13fbd1,_0x439451){return client[_0x8b13('0x10')](_0x53ae50,_0x21fcd9)['then'](function(_0x11bc89){logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));logger[_0x8b13('0x14')](_0x8b13('0x15'),_0x1f2528,'request\x20sent',JSON['stringify'](_0x11bc89));if(_0x11bc89[_0x8b13('0x16')]){if(_0x11bc89[_0x8b13('0x16')]['code']===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x439451(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}logger[_0x8b13('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x13fbd1(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}else{logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));_0x13fbd1(_0x11bc89[_0x8b13('0x18')]['message']);}})['catch'](function(_0xae4966){logger[_0x8b13('0x16')](_0x8b13('0x12'),_0x1f2528,_0xae4966);_0x439451(_0xae4966);});});}exports[_0x8b13('0x19')]=function(_0x1e0fe3){var _0x3cc9a0=this;return new Promise(function(_0x559442,_0x1e8a48){return db[_0x8b13('0x1a')][_0x8b13('0x1b')]({'raw':_0x1e0fe3['options']?_0x1e0fe3['options'][_0x8b13('0x1c')]===undefined?!![]:![]:!![],'where':_0x1e0fe3[_0x8b13('0x1d')]?_0x1e0fe3['options'][_0x8b13('0x1e')]||null:null,'attributes':_0x1e0fe3[_0x8b13('0x1d')]?_0x1e0fe3[_0x8b13('0x1d')][_0x8b13('0x1f')]||null:null,'limit':_0x1e0fe3[_0x8b13('0x1d')]?_0x1e0fe3['options'][_0x8b13('0x20')]||null:null,'include':_0x1e0fe3[_0x8b13('0x1d')]?_0x1e0fe3['options'][_0x8b13('0x21')]?_['map'](_0x1e0fe3[_0x8b13('0x1d')][_0x8b13('0x21')],function(_0x54786a){return{'model':db[_0x54786a[_0x8b13('0x22')]],'as':_0x54786a['as'],'attributes':_0x54786a[_0x8b13('0x1f')],'include':_0x54786a['include']?_[_0x8b13('0x23')](_0x54786a[_0x8b13('0x21')],function(_0x410122){return{'model':db[_0x410122[_0x8b13('0x22')]],'as':_0x410122['as'],'attributes':_0x410122[_0x8b13('0x1f')],'include':_0x410122['include']?_[_0x8b13('0x23')](_0x410122[_0x8b13('0x21')],function(_0x3475d8){return{'model':db[_0x3475d8[_0x8b13('0x22')]],'as':_0x3475d8['as'],'attributes':_0x3475d8[_0x8b13('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8b13('0x24')](function(_0x5ab161){logger[_0x8b13('0x11')](_0x8b13('0x19'),_0x1e0fe3);logger[_0x8b13('0x14')](_0x8b13('0x19'),_0x1e0fe3,JSON[_0x8b13('0x25')](_0x5ab161));_0x559442(_0x5ab161);})[_0x8b13('0x26')](function(_0x3304bd){logger[_0x8b13('0x16')](_0x8b13('0x19'),_0x3304bd['message'],_0x1e0fe3);_0x1e8a48(_0x3cc9a0[_0x8b13('0x16')](0x1f4,_0x3304bd[_0x8b13('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 09c802f..24c2b28 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 _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x203f00,_0x21cb72){var _0x1fe3c8=function(_0x536716){while(--_0x536716){_0x203f00['push'](_0x203f00['shift']());}};_0x1fe3c8(++_0x21cb72);}(_0x326f,0xd1));var _0xf326=function(_0x50e7bf,_0x4bea72){_0x50e7bf=_0x50e7bf-0x0;var _0x249a65=_0x326f[_0x50e7bf];return _0x249a65;};'use strict';var VoiceExtensionEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){VoiceExtensionEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('voiceExtension:'+_0x165f95,_0x3ace29);VoiceExtensionEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x1c5441,_0x4ccffe){var _0x569783=function(_0x5b0282){while(--_0x5b0282){_0x1c5441['push'](_0x1c5441['shift']());}};_0x569783(++_0x4ccffe);}(_0x53ec,0x192));var _0xc53e=function(_0x5951e8,_0x42b9a7){_0x5951e8=_0x5951e8-0x0;var _0x20a1f5=_0x53ec[_0x5951e8];return _0x20a1f5;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 9b54b6e..f199fb2 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 _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated','get','/:id','show','/:id/messages','getMessages','post','create','put'];(function(_0x27471e,_0x121ad4){var _0x184db3=function(_0x3d0111){while(--_0x3d0111){_0x27471e['push'](_0x27471e['shift']());}};_0x184db3(++_0x121ad4);}(_0x53ec,0x192));var _0xc53e=function(_0x29d5ce,_0x1503e9){_0x29d5ce=_0x29d5ce-0x0;var _0x266f7b=_0x53ec[_0x29d5ce];return _0x266f7b;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file +var _0x4888=['/:id/messages','post','create','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x4888,0x198));var _0x8488=function(_0x53b93b,_0x1bfab1){_0x53b93b=_0x53b93b-0x0;var _0x485761=_0x4888[_0x53b93b];return _0x485761;};'use strict';var multer=require('multer');var util=require(_0x8488('0x0'));var path=require(_0x8488('0x1'));var timeout=require(_0x8488('0x2'));var express=require(_0x8488('0x3'));var router=express[_0x8488('0x4')]();var fs_extra=require(_0x8488('0x5'));var auth=require(_0x8488('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8488('0x7'));var controller=require(_0x8488('0x8'));router[_0x8488('0x9')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xb')]);router[_0x8488('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8488('0xc'),auth[_0x8488('0xa')](),controller['getMessages']);router[_0x8488('0xd')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xe')]);router[_0x8488('0xf')]('/:id',auth[_0x8488('0xa')](),controller[_0x8488('0x10')]);router[_0x8488('0x11')](_0x8488('0x12'),auth[_0x8488('0xa')](),controller['destroy']);module[_0x8488('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 7b1b6c2..22d1d56 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 _0xf901=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20'];(function(_0x335de0,_0x24e38){var _0x12358b=function(_0x27e419){while(--_0x27e419){_0x335de0['push'](_0x335de0['shift']());}};_0x12358b(++_0x24e38);}(_0xf901,0x157));var _0x1f90=function(_0xb7e5e5,_0x16642e){_0xb7e5e5=_0xb7e5e5-0x0;var _0x55e238=_0xf901[_0xb7e5e5];return _0x55e238;};'use strict';var Sequelize=require(_0x1f90('0x0'));module[_0x1f90('0x1')]={'customer_id':{'type':Sequelize[_0x1f90('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x1f90('0x3'),'unique':_0x1f90('0x4')},'mailbox':{'type':Sequelize[_0x1f90('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x1f90('0x2')]},'fullname':{'type':Sequelize[_0x1f90('0x2')]},'email':{'type':Sequelize[_0x1f90('0x2')],'validate':{'isEmail':!![]},'set':function(_0x362ee3){this[_0x1f90('0x5')](_0x1f90('0x6'),typeof _0x362ee3===_0x1f90('0x7')&&_0x362ee3[_0x1f90('0x8')]()?_0x362ee3[_0x1f90('0x8')]():null);}},'pager':{'type':Sequelize[_0x1f90('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x1f90('0x9')},'attach':{'type':Sequelize['ENUM'](_0x1f90('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x1f90('0xb')](_0x1f90('0xa'),'no'),'defaultValue':_0x1f90('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1f90('0x2')]},'callback':{'type':Sequelize[_0x1f90('0x2')]},'review':{'type':Sequelize['ENUM'](_0x1f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1f90('0xb')](_0x1f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1f90('0xb')](_0x1f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1f90('0xb')](_0x1f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x1f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1f90('0xb')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1f90('0xb')](_0x1f90('0xa'),'no'),'defaultValue':_0x1f90('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x1f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1f90('0xb')](_0x1f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1f90('0xb')](_0x1f90('0xa'),'no'),'defaultValue':_0x1f90('0xa'),'allowNull':![]},'stamp':{'type':_0x1f90('0xc')},'emailsubject':{'type':Sequelize[_0x1f90('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x1f90('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1f90('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x1f90('0xe')](_0x1f90('0xf'))+_0x1f90('0x10')+this[_0x1f90('0xe')](_0x1f90('0x11'));}}}; \ No newline at end of file +var _0x9197=['setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','exports','STRING','contest_mailbox'];(function(_0x1bc9b7,_0x5cbcb3){var _0x59b9b5=function(_0x9cfce6){while(--_0x9cfce6){_0x1bc9b7['push'](_0x1bc9b7['shift']());}};_0x59b9b5(++_0x5cbcb3);}(_0x9197,0x119));var _0x7919=function(_0x1c43b9,_0x5b32ac){_0x1c43b9=_0x1c43b9-0x0;var _0x30510a=_0x9197[_0x1c43b9];return _0x30510a;};'use strict';var Sequelize=require(_0x7919('0x0'));module[_0x7919('0x1')]={'customer_id':{'type':Sequelize[_0x7919('0x2')]},'context':{'type':Sequelize[_0x7919('0x2')],'defaultValue':'from-voicemail','unique':_0x7919('0x3')},'mailbox':{'type':Sequelize[_0x7919('0x2')],'defaultValue':'','allowNull':![],'unique':_0x7919('0x3')},'password':{'type':Sequelize[_0x7919('0x2')]},'fullname':{'type':Sequelize[_0x7919('0x2')]},'email':{'type':Sequelize[_0x7919('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3fe74e){this[_0x7919('0x4')](_0x7919('0x5'),typeof _0x3fe74e===_0x7919('0x6')&&_0x3fe74e['trim']()?_0x3fe74e[_0x7919('0x7')]():null);}},'pager':{'type':Sequelize[_0x7919('0x2')]},'tz':{'type':Sequelize[_0x7919('0x2')],'defaultValue':_0x7919('0x8')},'attach':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x7919('0x2')]},'review':{'type':Sequelize[_0x7919('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7919('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':_0x7919('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7919('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x7919('0x9')](_0x7919('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x7919('0xa'),'no'),'defaultValue':_0x7919('0xa'),'allowNull':![]},'stamp':{'type':_0x7919('0xc')},'emailsubject':{'type':Sequelize[_0x7919('0x2')]},'emailbody':{'type':Sequelize[_0x7919('0x2')]},'maxsecs':{'type':Sequelize[_0x7919('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7919('0xe')],'get':function(){return this['getDataValue'](_0x7919('0xf'))+_0x7919('0x10')+this[_0x7919('0x11')](_0x7919('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 37a9479..59ec595 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 _0x2f68=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','Voicemails','error','stack','name','send','index','VoiceMail','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','body','destroy','getMessages','findOne','VoiceMailMessage','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel'];(function(_0x49dfc6,_0x43f8db){var _0xd622=function(_0x30eb26){while(--_0x30eb26){_0x49dfc6['push'](_0x49dfc6['shift']());}};_0xd622(++_0x43f8db);}(_0x2f68,0x9a));var _0x82f6=function(_0x5e99cc,_0x2e5750){_0x5e99cc=_0x5e99cc-0x0;var _0x1d8e38=_0x2f68[_0x5e99cc];return _0x1d8e38;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82f6('0x0'));var zipdir=require(_0x82f6('0x1'));var jsonpatch=require(_0x82f6('0x2'));var rp=require(_0x82f6('0x3'));var moment=require('moment');var BPromise=require(_0x82f6('0x4'));var Mustache=require('mustache');var util=require(_0x82f6('0x5'));var path=require(_0x82f6('0x6'));var sox=require('sox');var csv=require(_0x82f6('0x7'));var ejs=require(_0x82f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82f6('0xa'));var toCsv=require(_0x82f6('0x7'));var querystring=require(_0x82f6('0xb'));var Papa=require('papaparse');var Redis=require(_0x82f6('0xc'));var authService=require(_0x82f6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x82f6('0xe'));var hardwareService=require(_0x82f6('0xf'));var logger=require(_0x82f6('0x10'))(_0x82f6('0x11'));var utils=require(_0x82f6('0x12'));var config=require(_0x82f6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x82f6('0x14'))['db'];function respondWithStatusCode(_0x442262,_0x4cc967){_0x4cc967=_0x4cc967||0xcc;return function(_0x194da7){if(_0x194da7){return _0x442262[_0x82f6('0x15')](_0x4cc967);}return _0x442262[_0x82f6('0x16')](_0x4cc967)[_0x82f6('0x17')]();};}function respondWithResult(_0x371481,_0xa00275){_0xa00275=_0xa00275||0xc8;return function(_0x115c7b){if(_0x115c7b){return _0x371481[_0x82f6('0x16')](_0xa00275)[_0x82f6('0x18')](_0x115c7b);}};}function respondWithFilteredResult(_0x55b58e,_0x389949){return function(_0x5d0827){if(_0x5d0827){var _0x249222=typeof _0x389949[_0x82f6('0x19')]===_0x82f6('0x1a')&&typeof _0x389949[_0x82f6('0x1b')]===_0x82f6('0x1a');var _0x2326ae=_0x5d0827[_0x82f6('0x1c')];var _0xcbc95f=_0x249222?0x0:_0x389949[_0x82f6('0x19')];var _0x2bfd57=_0x249222?_0x5d0827[_0x82f6('0x1c')]:_0x389949[_0x82f6('0x19')]+_0x389949[_0x82f6('0x1b')];var _0x4fe226;if(_0x2bfd57>=_0x2326ae){_0x2bfd57=_0x2326ae;_0x4fe226=0xc8;}else{_0x4fe226=0xce;}_0x55b58e[_0x82f6('0x16')](_0x4fe226);return _0x55b58e['set'](_0x82f6('0x1d'),_0xcbc95f+'-'+_0x2bfd57+'/'+_0x2326ae)[_0x82f6('0x18')](_0x5d0827);}return null;};}function patchUpdates(_0x55cbce){return function(_0x2b03ad){try{jsonpatch[_0x82f6('0x1e')](_0x2b03ad,_0x55cbce,!![]);}catch(_0x46713a){return BPromise[_0x82f6('0x1f')](_0x46713a);}return _0x2b03ad['save']();};}function saveUpdates(_0xdc4dea,_0x4beccf){return function(_0x8668bb){if(_0x8668bb){return _0x8668bb[_0x82f6('0x20')](_0xdc4dea)['then'](function(_0x516deb){return _0x516deb;});}return null;};}function removeEntity(_0x3af5f7,_0x1d96d5){return function(_0x4c57c5){if(_0x4c57c5){return _0x4c57c5['destroy']()[_0x82f6('0x21')](function(){var _0x31face=_0x4c57c5['get']({'plain':!![]});var _0xfd8b68=_0x82f6('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0xfd8b68,'resourceId':_0x31face['id']}})[_0x82f6('0x21')](function(){return _0x4c57c5;});})['then'](function(){_0x3af5f7[_0x82f6('0x16')](0xcc)[_0x82f6('0x17')]();});}};}function handleEntityNotFound(_0x54ce11,_0x3795ef){return function(_0x15c9b7){if(!_0x15c9b7){_0x54ce11[_0x82f6('0x15')](0x194);}return _0x15c9b7;};}function handleError(_0x1125a0,_0x4f9fa4){_0x4f9fa4=_0x4f9fa4||0x1f4;return function(_0x40a071){logger[_0x82f6('0x23')](_0x40a071[_0x82f6('0x24')]);if(_0x40a071[_0x82f6('0x25')]){delete _0x40a071[_0x82f6('0x25')];}_0x1125a0[_0x82f6('0x16')](_0x4f9fa4)[_0x82f6('0x26')](_0x40a071);};}exports[_0x82f6('0x27')]=function(_0x1e1aa4,_0x402449){var _0x3c9419={},_0x20d1c5={},_0x6ce179={'count':0x0,'rows':[]};var _0x91117b=_['map'](db[_0x82f6('0x28')][_0x82f6('0x29')],function(_0x418f34){return{'name':_0x418f34['fieldName'],'type':_0x418f34[_0x82f6('0x2a')][_0x82f6('0x2b')]};});_0x20d1c5[_0x82f6('0x2c')]=_[_0x82f6('0x2d')](_0x91117b,_0x82f6('0x25'));_0x20d1c5[_0x82f6('0x2e')]=_[_0x82f6('0x2f')](_0x1e1aa4[_0x82f6('0x2e')]);_0x20d1c5[_0x82f6('0x30')]=_[_0x82f6('0x31')](_0x20d1c5[_0x82f6('0x2c')],_0x20d1c5[_0x82f6('0x2e')]);_0x3c9419[_0x82f6('0x32')]=_[_0x82f6('0x31')](_0x20d1c5['model'],qs[_0x82f6('0x33')](_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x33')]));_0x3c9419[_0x82f6('0x32')]=_0x3c9419[_0x82f6('0x32')][_0x82f6('0x34')]?_0x3c9419[_0x82f6('0x32')]:_0x20d1c5[_0x82f6('0x2c')];if(!_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x35')](_0x82f6('0x36'))){_0x3c9419[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x1e1aa4[_0x82f6('0x2e')]['limit']);_0x3c9419[_0x82f6('0x19')]=qs['offset'](_0x1e1aa4['query'][_0x82f6('0x19')]);}_0x3c9419[_0x82f6('0x37')]=qs['sort'](_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x38')]);_0x3c9419[_0x82f6('0x39')]=qs['filters'](_[_0x82f6('0x3a')](_0x1e1aa4['query'],_0x20d1c5[_0x82f6('0x30')]),_0x91117b);if(_0x1e1aa4['query'][_0x82f6('0x3b')]){_0x3c9419['where']=_[_0x82f6('0x3c')](_0x3c9419[_0x82f6('0x39')],{'$or':_['map'](_0x91117b,function(_0xfce1dd){if(_0xfce1dd[_0x82f6('0x2a')]!==_0x82f6('0x3d')){var _0x43dcd1={};_0x43dcd1[_0xfce1dd['name']]={'$like':'%'+_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x3b')]+'%'};return _0x43dcd1;}})});}_0x3c9419=_[_0x82f6('0x3c')]({},_0x3c9419,_0x1e1aa4[_0x82f6('0x3e')]);var _0x55ecd4={'where':_0x3c9419[_0x82f6('0x39')]};return db[_0x82f6('0x28')]['count'](_0x55ecd4)[_0x82f6('0x21')](function(_0x699803){_0x6ce179[_0x82f6('0x1c')]=_0x699803;if(_0x1e1aa4[_0x82f6('0x2e')][_0x82f6('0x3f')]){_0x3c9419['include']=[{'all':!![]}];}return db[_0x82f6('0x28')]['findAll'](_0x3c9419);})[_0x82f6('0x21')](function(_0x38e82d){_0x6ce179[_0x82f6('0x40')]=_0x38e82d;return _0x6ce179;})[_0x82f6('0x21')](respondWithFilteredResult(_0x402449,_0x3c9419))[_0x82f6('0x41')](handleError(_0x402449,null));};exports[_0x82f6('0x42')]=function(_0x43fefc,_0x47a0d1){var _0x165493={'raw':!![],'where':{'id':_0x43fefc[_0x82f6('0x43')]['id']}},_0x297cda={};_0x297cda[_0x82f6('0x2c')]=_['keys'](db[_0x82f6('0x28')]['rawAttributes']);_0x297cda[_0x82f6('0x2e')]=_[_0x82f6('0x2f')](_0x43fefc[_0x82f6('0x2e')]);_0x297cda[_0x82f6('0x30')]=_[_0x82f6('0x31')](_0x297cda[_0x82f6('0x2c')],_0x297cda['query']);_0x165493[_0x82f6('0x32')]=_[_0x82f6('0x31')](_0x297cda[_0x82f6('0x2c')],qs[_0x82f6('0x33')](_0x43fefc[_0x82f6('0x2e')][_0x82f6('0x33')]));_0x165493[_0x82f6('0x32')]=_0x165493[_0x82f6('0x32')]['length']?_0x165493[_0x82f6('0x32')]:_0x297cda[_0x82f6('0x2c')];if(_0x43fefc['query'][_0x82f6('0x3f')]){_0x165493['include']=[{'all':!![]}];}_0x165493=_[_0x82f6('0x3c')]({},_0x165493,_0x43fefc['options']);return db[_0x82f6('0x28')][_0x82f6('0x44')](_0x165493)[_0x82f6('0x21')](handleEntityNotFound(_0x47a0d1,null))[_0x82f6('0x21')](respondWithResult(_0x47a0d1,null))[_0x82f6('0x41')](handleError(_0x47a0d1,null));};exports[_0x82f6('0x45')]=function(_0x53f7d4,_0x3cb1f0){return db[_0x82f6('0x28')]['create'](_0x53f7d4['body'],{})[_0x82f6('0x21')](function(_0x2a6366){var _0x2c2b64=_0x53f7d4['user'][_0x82f6('0x46')]({'plain':!![]});if(!_0x2c2b64)throw new Error(_0x82f6('0x47'));if(_0x2c2b64[_0x82f6('0x48')]===_0x82f6('0x49')){var _0x4e9e13=_0x2a6366['get']({'plain':!![]});var _0x1695ea=_0x82f6('0x22');return db[_0x82f6('0x4a')]['find']({'where':{'name':_0x1695ea,'userProfileId':_0x2c2b64[_0x82f6('0x4b')]},'raw':!![]})[_0x82f6('0x21')](function(_0x4bc646){if(_0x4bc646&&_0x4bc646['autoAssociation']===0x0){return db['UserProfileResource'][_0x82f6('0x45')]({'name':_0x4e9e13['name'],'resourceId':_0x4e9e13['id'],'type':_0x4bc646[_0x82f6('0x25')],'sectionId':_0x4bc646['id']},{})['then'](function(){return _0x2a6366;});}else{return _0x2a6366;}})[_0x82f6('0x41')](function(_0x4f69de){logger[_0x82f6('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f69de);throw _0x4f69de;});}return _0x2a6366;})[_0x82f6('0x21')](respondWithResult(_0x3cb1f0,0xc9))[_0x82f6('0x41')](handleError(_0x3cb1f0,null));};exports[_0x82f6('0x20')]=function(_0x1633cf,_0xb8d7d8){if(_0x1633cf[_0x82f6('0x4c')]['id']){delete _0x1633cf['body']['id'];}return db[_0x82f6('0x28')][_0x82f6('0x44')]({'where':{'id':_0x1633cf[_0x82f6('0x43')]['id']}})['then'](handleEntityNotFound(_0xb8d7d8,null))['then'](saveUpdates(_0x1633cf[_0x82f6('0x4c')],null))[_0x82f6('0x21')](respondWithResult(_0xb8d7d8,null))[_0x82f6('0x41')](handleError(_0xb8d7d8,null));};exports[_0x82f6('0x4d')]=function(_0x49a204,_0x2c1c0e){return db[_0x82f6('0x28')][_0x82f6('0x44')]({'where':{'id':_0x49a204['params']['id']}})['then'](handleEntityNotFound(_0x2c1c0e,null))['then'](removeEntity(_0x2c1c0e,null))[_0x82f6('0x41')](handleError(_0x2c1c0e,null));};exports[_0x82f6('0x4e')]=function(_0x221cfc,_0x59176d,_0x4013f0){return db[_0x82f6('0x28')][_0x82f6('0x4f')]({'where':{'id':_0x221cfc[_0x82f6('0x43')]['id']}})['then'](handleEntityNotFound(_0x59176d,null))[_0x82f6('0x21')](function(_0x94aed4){var _0x12a5b9;var _0x33591b={},_0x4a8bdb={};_0x4a8bdb['model']=_[_0x82f6('0x2f')](db[_0x82f6('0x50')]['rawAttributes']);_0x4a8bdb[_0x82f6('0x2e')]=_[_0x82f6('0x2f')](_0x221cfc[_0x82f6('0x2e')]);_0x4a8bdb['filters']=_[_0x82f6('0x31')](_0x4a8bdb[_0x82f6('0x2c')],_0x4a8bdb[_0x82f6('0x2e')]);_0x33591b[_0x82f6('0x32')]=_[_0x82f6('0x31')](_0x4a8bdb[_0x82f6('0x2c')],qs['fields'](_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x33')]));_0x33591b[_0x82f6('0x32')]=_0x33591b[_0x82f6('0x32')][_0x82f6('0x34')]?_0x33591b['attributes']:_0x4a8bdb[_0x82f6('0x2c')];if(!_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x35')](_0x82f6('0x36'))){_0x33591b[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x1b')]);_0x33591b['offset']=qs[_0x82f6('0x19')](_0x221cfc['query'][_0x82f6('0x19')]);}_0x33591b[_0x82f6('0x37')]=qs['sort'](_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x38')]);_0x33591b[_0x82f6('0x39')]=qs['filters'](_['pick'](_0x221cfc[_0x82f6('0x2e')],_0x4a8bdb[_0x82f6('0x30')]));if(_0x221cfc['query']['filter']){_0x33591b[_0x82f6('0x39')]=_[_0x82f6('0x3c')](_0x33591b[_0x82f6('0x39')],{'$or':_[_0x82f6('0x2d')](_0x33591b[_0x82f6('0x32')],function(_0x11581c){var _0xc1d784={};_0xc1d784[_0x11581c]={'$like':'%'+_0x221cfc[_0x82f6('0x2e')][_0x82f6('0x3b')]+'%'};return _0xc1d784;})});}_0x33591b[_0x82f6('0x39')]=_[_0x82f6('0x3c')](_0x33591b[_0x82f6('0x39')],{'mailboxuser':_0x94aed4['mailbox']});_0x33591b=_[_0x82f6('0x3c')]({},_0x33591b,_0x221cfc[_0x82f6('0x3e')]);return db[_0x82f6('0x50')][_0x82f6('0x51')](_0x33591b)[_0x82f6('0x21')](respondWithFilteredResult(_0x59176d,_0x33591b));})['catch'](handleError(_0x59176d,null));}; \ No newline at end of file +var _0xcb91=['VoiceMail','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','includeAll','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','findOne','VoiceMailMessage','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send'];(function(_0x3d7811,_0x59daeb){var _0x927cfa=function(_0x5ce736){while(--_0x5ce736){_0x3d7811['push'](_0x3d7811['shift']());}};_0x927cfa(++_0x59daeb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4d7116,_0xdb8175){_0x4d7116=_0x4d7116-0x0;var _0x4593dc=_0xcb91[_0x4d7116];return _0x4593dc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1cb9('0x0'));var jsonpatch=require(_0x1cb9('0x1'));var rp=require(_0x1cb9('0x2'));var moment=require(_0x1cb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1cb9('0x4'));var util=require(_0x1cb9('0x5'));var path=require('path');var sox=require(_0x1cb9('0x6'));var csv=require(_0x1cb9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb9('0x8'));var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xc'));var authService=require(_0x1cb9('0xd'));var qs=require(_0x1cb9('0xe'));var as=require(_0x1cb9('0xf'));var hardwareService=require(_0x1cb9('0x10'));var logger=require('../../config/logger')(_0x1cb9('0x11'));var utils=require(_0x1cb9('0x12'));var config=require(_0x1cb9('0x13'));var licenseUtil=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x16')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19)[_0x1cb9('0x18')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x17')](_0x56884d)[_0x1cb9('0x19')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=typeof _0x3e2d11[_0x1cb9('0x1a')]===_0x1cb9('0x1b')&&typeof _0x3e2d11[_0x1cb9('0x1c')]===_0x1cb9('0x1b');var _0x3e21e0=_0x5806d8[_0x1cb9('0x1d')];var _0x23d3a9=_0x5572cb?0x0:_0x3e2d11['offset'];var _0x479d43=_0x5572cb?_0x5806d8[_0x1cb9('0x1d')]:_0x3e2d11[_0x1cb9('0x1a')]+_0x3e2d11[_0x1cb9('0x1c')];var _0x31481a;if(_0x479d43>=_0x3e21e0){_0x479d43=_0x3e21e0;_0x31481a=0xc8;}else{_0x31481a=0xce;}_0x8dfa55[_0x1cb9('0x17')](_0x31481a);return _0x8dfa55[_0x1cb9('0x1e')](_0x1cb9('0x1f'),_0x23d3a9+'-'+_0x479d43+'/'+_0x3e21e0)['json'](_0x5806d8);}return null;};}function patchUpdates(_0x559bcc){return function(_0x1a5a72){try{jsonpatch['apply'](_0x1a5a72,_0x559bcc,!![]);}catch(_0x4750b1){return BPromise[_0x1cb9('0x20')](_0x4750b1);}return _0x1a5a72['save']();};}function saveUpdates(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x21')](_0x599275)[_0x1cb9('0x22')](function(_0x45b8d3){return _0x45b8d3;});}return null;};}function removeEntity(_0x27db16,_0x59ebea){return function(_0x55b232){if(_0x55b232){return _0x55b232[_0x1cb9('0x23')]()['then'](function(){var _0x10a419=_0x55b232[_0x1cb9('0x24')]({'plain':!![]});var _0x69b4c8=_0x1cb9('0x25');return db[_0x1cb9('0x26')]['destroy']({'where':{'type':_0x69b4c8,'resourceId':_0x10a419['id']}})[_0x1cb9('0x22')](function(){return _0x55b232;});})[_0x1cb9('0x22')](function(){_0x27db16['status'](0xcc)[_0x1cb9('0x18')]();});}};}function handleEntityNotFound(_0x21effa,_0x41a9a0){return function(_0x1804fd){if(!_0x1804fd){_0x21effa[_0x1cb9('0x16')](0x194);}return _0x1804fd;};}function handleError(_0x21d6f5,_0x2e28fe){_0x2e28fe=_0x2e28fe||0x1f4;return function(_0xb644b3){logger[_0x1cb9('0x27')](_0xb644b3[_0x1cb9('0x28')]);if(_0xb644b3['name']){delete _0xb644b3[_0x1cb9('0x29')];}_0x21d6f5['status'](_0x2e28fe)[_0x1cb9('0x2a')](_0xb644b3);};}exports['index']=function(_0x278327,_0x41011c){var _0x3cd7f5={},_0x2038aa={},_0x561d89={'count':0x0,'rows':[]};var _0x1c701f=_['map'](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')],function(_0x4220d7){return{'name':_0x4220d7['fieldName'],'type':_0x4220d7[_0x1cb9('0x2d')]['key']};});_0x2038aa[_0x1cb9('0x2e')]=_['map'](_0x1c701f,_0x1cb9('0x29'));_0x2038aa[_0x1cb9('0x2f')]=_[_0x1cb9('0x30')](_0x278327[_0x1cb9('0x2f')]);_0x2038aa['filters']=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],_0x2038aa[_0x1cb9('0x2f')]);_0x3cd7f5[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x2038aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x3cd7f5[_0x1cb9('0x32')]=_0x3cd7f5[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x3cd7f5[_0x1cb9('0x32')]:_0x2038aa['model'];if(!_0x278327['query'][_0x1cb9('0x35')](_0x1cb9('0x36'))){_0x3cd7f5[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x1c')]);_0x3cd7f5[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0x278327['query'][_0x1cb9('0x1a')]);}_0x3cd7f5[_0x1cb9('0x37')]=qs[_0x1cb9('0x38')](_0x278327['query'][_0x1cb9('0x38')]);_0x3cd7f5['where']=qs[_0x1cb9('0x39')](_['pick'](_0x278327[_0x1cb9('0x2f')],_0x2038aa[_0x1cb9('0x39')]),_0x1c701f);if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]){_0x3cd7f5[_0x1cb9('0x3b')]=_[_0x1cb9('0x3c')](_0x3cd7f5[_0x1cb9('0x3b')],{'$or':_['map'](_0x1c701f,function(_0x4ca19e){if(_0x4ca19e[_0x1cb9('0x2d')]!==_0x1cb9('0x3d')){var _0x7a0d8b={};_0x7a0d8b[_0x4ca19e[_0x1cb9('0x29')]]={'$like':'%'+_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3a')]+'%'};return _0x7a0d8b;}})});}_0x3cd7f5=_[_0x1cb9('0x3c')]({},_0x3cd7f5,_0x278327['options']);var _0xbcaa32={'where':_0x3cd7f5['where']};return db['VoiceMail']['count'](_0xbcaa32)[_0x1cb9('0x22')](function(_0x397ff9){_0x561d89[_0x1cb9('0x1d')]=_0x397ff9;if(_0x278327[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x3cd7f5['include']=[{'all':!![]}];}return db[_0x1cb9('0x2b')]['findAll'](_0x3cd7f5);})[_0x1cb9('0x22')](function(_0x71db9d){_0x561d89[_0x1cb9('0x3f')]=_0x71db9d;return _0x561d89;})['then'](respondWithFilteredResult(_0x41011c,_0x3cd7f5))[_0x1cb9('0x40')](handleError(_0x41011c,null));};exports['show']=function(_0xda1a44,_0xbc36fc){var _0x51a898={'raw':!![],'where':{'id':_0xda1a44[_0x1cb9('0x41')]['id']}},_0x5839aa={};_0x5839aa[_0x1cb9('0x2e')]=_[_0x1cb9('0x30')](db[_0x1cb9('0x2b')][_0x1cb9('0x2c')]);_0x5839aa['query']=_[_0x1cb9('0x30')](_0xda1a44['query']);_0x5839aa['filters']=_['intersection'](_0x5839aa[_0x1cb9('0x2e')],_0x5839aa[_0x1cb9('0x2f')]);_0x51a898[_0x1cb9('0x32')]=_[_0x1cb9('0x31')](_0x5839aa[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x51a898[_0x1cb9('0x32')]=_0x51a898[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x51a898['attributes']:_0x5839aa[_0x1cb9('0x2e')];if(_0xda1a44[_0x1cb9('0x2f')][_0x1cb9('0x3e')]){_0x51a898['include']=[{'all':!![]}];}_0x51a898=_[_0x1cb9('0x3c')]({},_0x51a898,_0xda1a44[_0x1cb9('0x42')]);return db[_0x1cb9('0x2b')][_0x1cb9('0x43')](_0x51a898)[_0x1cb9('0x22')](handleEntityNotFound(_0xbc36fc,null))['then'](respondWithResult(_0xbc36fc,null))[_0x1cb9('0x40')](handleError(_0xbc36fc,null));};exports['create']=function(_0x2eaa11,_0x4ac483){return db[_0x1cb9('0x2b')][_0x1cb9('0x44')](_0x2eaa11[_0x1cb9('0x45')],{})[_0x1cb9('0x22')](function(_0x56d0c5){var _0x298475=_0x2eaa11[_0x1cb9('0x46')][_0x1cb9('0x24')]({'plain':!![]});if(!_0x298475)throw new Error(_0x1cb9('0x47'));if(_0x298475[_0x1cb9('0x48')]===_0x1cb9('0x46')){var _0x17b92a=_0x56d0c5[_0x1cb9('0x24')]({'plain':!![]});var _0xbb500e=_0x1cb9('0x25');return db['UserProfileSection']['find']({'where':{'name':_0xbb500e,'userProfileId':_0x298475[_0x1cb9('0x49')]},'raw':!![]})[_0x1cb9('0x22')](function(_0x19e83a){if(_0x19e83a&&_0x19e83a[_0x1cb9('0x4a')]===0x0){return db[_0x1cb9('0x26')][_0x1cb9('0x44')]({'name':_0x17b92a[_0x1cb9('0x29')],'resourceId':_0x17b92a['id'],'type':_0x19e83a[_0x1cb9('0x29')],'sectionId':_0x19e83a['id']},{})[_0x1cb9('0x22')](function(){return _0x56d0c5;});}else{return _0x56d0c5;}})[_0x1cb9('0x40')](function(_0x4a4b87){logger[_0x1cb9('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a4b87);throw _0x4a4b87;});}return _0x56d0c5;})[_0x1cb9('0x22')](respondWithResult(_0x4ac483,0xc9))['catch'](handleError(_0x4ac483,null));};exports[_0x1cb9('0x21')]=function(_0x53c002,_0x5e5174){if(_0x53c002[_0x1cb9('0x45')]['id']){delete _0x53c002[_0x1cb9('0x45')]['id'];}return db[_0x1cb9('0x2b')]['find']({'where':{'id':_0x53c002[_0x1cb9('0x41')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x5e5174,null))['then'](saveUpdates(_0x53c002['body'],null))[_0x1cb9('0x22')](respondWithResult(_0x5e5174,null))[_0x1cb9('0x40')](handleError(_0x5e5174,null));};exports[_0x1cb9('0x23')]=function(_0x2b3f2a,_0x3de325){return db[_0x1cb9('0x2b')][_0x1cb9('0x43')]({'where':{'id':_0x2b3f2a['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x3de325,null))[_0x1cb9('0x22')](removeEntity(_0x3de325,null))[_0x1cb9('0x40')](handleError(_0x3de325,null));};exports['getMessages']=function(_0x183bd1,_0x9893a3,_0x1651c5){return db[_0x1cb9('0x2b')][_0x1cb9('0x4b')]({'where':{'id':_0x183bd1[_0x1cb9('0x41')]['id']}})['then'](handleEntityNotFound(_0x9893a3,null))[_0x1cb9('0x22')](function(_0x36c40d){var _0x41e81f;var _0x128c5b={},_0x4ad7cd={};_0x4ad7cd[_0x1cb9('0x2e')]=_[_0x1cb9('0x30')](db[_0x1cb9('0x4c')][_0x1cb9('0x2c')]);_0x4ad7cd[_0x1cb9('0x2f')]=_[_0x1cb9('0x30')](_0x183bd1['query']);_0x4ad7cd[_0x1cb9('0x39')]=_[_0x1cb9('0x31')](_0x4ad7cd[_0x1cb9('0x2e')],_0x4ad7cd[_0x1cb9('0x2f')]);_0x128c5b['attributes']=_['intersection'](_0x4ad7cd[_0x1cb9('0x2e')],qs[_0x1cb9('0x33')](_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x33')]));_0x128c5b[_0x1cb9('0x32')]=_0x128c5b[_0x1cb9('0x32')][_0x1cb9('0x34')]?_0x128c5b[_0x1cb9('0x32')]:_0x4ad7cd['model'];if(!_0x183bd1['query'][_0x1cb9('0x35')]('nolimit')){_0x128c5b['limit']=qs['limit'](_0x183bd1['query']['limit']);_0x128c5b[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x1a')]);}_0x128c5b[_0x1cb9('0x37')]=qs[_0x1cb9('0x38')](_0x183bd1['query'][_0x1cb9('0x38')]);_0x128c5b[_0x1cb9('0x3b')]=qs['filters'](_['pick'](_0x183bd1[_0x1cb9('0x2f')],_0x4ad7cd[_0x1cb9('0x39')]));if(_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x3a')]){_0x128c5b[_0x1cb9('0x3b')]=_['merge'](_0x128c5b['where'],{'$or':_['map'](_0x128c5b[_0x1cb9('0x32')],function(_0x2fd5a0){var _0x196349={};_0x196349[_0x2fd5a0]={'$like':'%'+_0x183bd1[_0x1cb9('0x2f')][_0x1cb9('0x3a')]+'%'};return _0x196349;})});}_0x128c5b['where']=_[_0x1cb9('0x3c')](_0x128c5b[_0x1cb9('0x3b')],{'mailboxuser':_0x36c40d['mailbox']});_0x128c5b=_['merge']({},_0x128c5b,_0x183bd1[_0x1cb9('0x42')]);return db['VoiceMailMessage'][_0x1cb9('0x4d')](_0x128c5b)[_0x1cb9('0x22')](respondWithFilteredResult(_0x9893a3,_0x128c5b));})[_0x1cb9('0x40')](handleError(_0x9893a3,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 5624f07..f1121d3 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 _0xb758=['define','VoiceMail','voice_voicemail','mailbox','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes'];(function(_0x3e0558,_0x4818a4){var _0xfa1387=function(_0x3b5c61){while(--_0x3b5c61){_0x3e0558['push'](_0x3e0558['shift']());}};_0xfa1387(++_0x4818a4);}(_0xb758,0xfb));var _0x8b75=function(_0x540133,_0x41783f){_0x540133=_0x540133-0x0;var _0x26b6e9=_0xb758[_0x540133];return _0x26b6e9;};'use strict';var _=require(_0x8b75('0x0'));var util=require(_0x8b75('0x1'));var logger=require(_0x8b75('0x2'))(_0x8b75('0x3'));var moment=require('moment');var BPromise=require(_0x8b75('0x4'));var rp=require(_0x8b75('0x5'));var fs=require('fs');var path=require(_0x8b75('0x6'));var rimraf=require('rimraf');var config=require(_0x8b75('0x7'));var attributes=require(_0x8b75('0x8'));module['exports']=function(_0x4fcf9b,_0x12734b){return _0x4fcf9b[_0x8b75('0x9')](_0x8b75('0xa'),attributes,{'tableName':_0x8b75('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x8b75('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b3a=['define','VoiceMail','voice_voicemail','mailbox','context','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x7b3a,0xd7));var _0xa7b3=function(_0x2025ea,_0x52d487){_0x2025ea=_0x2025ea-0x0;var _0x1607ae=_0x7b3a[_0x2025ea];return _0x1607ae;};'use strict';var _=require(_0xa7b3('0x0'));var util=require(_0xa7b3('0x1'));var logger=require('../../config/logger')(_0xa7b3('0x2'));var moment=require(_0xa7b3('0x3'));var BPromise=require(_0xa7b3('0x4'));var rp=require(_0xa7b3('0x5'));var fs=require('fs');var path=require(_0xa7b3('0x6'));var rimraf=require(_0xa7b3('0x7'));var config=require(_0xa7b3('0x8'));var attributes=require(_0xa7b3('0x9'));module['exports']=function(_0x5a4dfe,_0x17e600){return _0x5a4dfe[_0xa7b3('0xa')](_0xa7b3('0xb'),attributes,{'tableName':_0xa7b3('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xa7b3('0xd'),_0xa7b3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index d59ea2f..521f607 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 _0x2986=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x350878,_0x1a5ee3){var _0x33da22=function(_0x582bca){while(--_0x582bca){_0x350878['push'](_0x350878['shift']());}};_0x33da22(++_0x1a5ee3);}(_0x2986,0x184));var _0x6298=function(_0x1a6718,_0xf6325){_0x1a6718=_0x1a6718-0x0;var _0x2fdb5e=_0x2986[_0x1a6718];return _0x2fdb5e;};'use strict';var _=require('lodash');var util=require(_0x6298('0x0'));var moment=require('moment');var BPromise=require(_0x6298('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6298('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6298('0x3'));var logger=require(_0x6298('0x4'))(_0x6298('0x5'));var config=require(_0x6298('0x6'));var jayson=require(_0x6298('0x7'));var client=jayson[_0x6298('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10c7bf,_0x4b9f9d,_0x586011){return new BPromise(function(_0x2e0551,_0x427f2a){return client['request'](_0x10c7bf,_0x586011)[_0x6298('0x9')](function(_0x160c6e){logger[_0x6298('0xa')](_0x6298('0xb'),_0x4b9f9d,_0x6298('0xc'));logger[_0x6298('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4b9f9d,_0x6298('0xc'),JSON[_0x6298('0xe')](_0x160c6e));if(_0x160c6e[_0x6298('0xf')]){if(_0x160c6e[_0x6298('0xf')]['code']===0x1f4){logger[_0x6298('0xf')](_0x6298('0xb'),_0x4b9f9d,_0x160c6e[_0x6298('0xf')][_0x6298('0x10')]);return _0x427f2a(_0x160c6e[_0x6298('0xf')][_0x6298('0x10')]);}logger[_0x6298('0xf')]('VoiceMail,\x20%s,\x20%s',_0x4b9f9d,_0x160c6e[_0x6298('0xf')][_0x6298('0x10')]);return _0x2e0551(_0x160c6e['error'][_0x6298('0x10')]);}else{logger[_0x6298('0xa')](_0x6298('0xb'),_0x4b9f9d,'request\x20sent');_0x2e0551(_0x160c6e[_0x6298('0x11')][_0x6298('0x10')]);}})[_0x6298('0x12')](function(_0x286d5e){logger[_0x6298('0xf')](_0x6298('0xb'),_0x4b9f9d,_0x286d5e);_0x427f2a(_0x286d5e);});});} \ No newline at end of file +var _0xba71=['error','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0x3ef31b,_0x4be438){var _0x4fe171=function(_0x3df9da){while(--_0x3df9da){_0x3ef31b['push'](_0x3ef31b['shift']());}};_0x4fe171(++_0x4be438);}(_0xba71,0x125));var _0x1ba7=function(_0x1c6085,_0x53f5d9){_0x1c6085=_0x1c6085-0x0;var _0x2e9016=_0xba71[_0x1c6085];return _0x2e9016;};'use strict';var _=require(_0x1ba7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1ba7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ba7('0x2'))['db'];var utils=require(_0x1ba7('0x3'));var logger=require(_0x1ba7('0x4'))(_0x1ba7('0x5'));var config=require('../../config/environment');var jayson=require(_0x1ba7('0x6'));var client=jayson[_0x1ba7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a5c86,_0x46cfac,_0x35a6f1){return new BPromise(function(_0x5f5a2b,_0x55c40d){return client['request'](_0x4a5c86,_0x35a6f1)[_0x1ba7('0x8')](function(_0xcc2e72){logger[_0x1ba7('0x9')]('VoiceMail,\x20%s,\x20%s',_0x46cfac,_0x1ba7('0xa'));logger[_0x1ba7('0xb')](_0x1ba7('0xc'),_0x46cfac,_0x1ba7('0xa'),JSON['stringify'](_0xcc2e72));if(_0xcc2e72[_0x1ba7('0xd')]){if(_0xcc2e72[_0x1ba7('0xd')]['code']===0x1f4){logger[_0x1ba7('0xd')]('VoiceMail,\x20%s,\x20%s',_0x46cfac,_0xcc2e72[_0x1ba7('0xd')][_0x1ba7('0xe')]);return _0x55c40d(_0xcc2e72[_0x1ba7('0xd')][_0x1ba7('0xe')]);}logger[_0x1ba7('0xd')](_0x1ba7('0xf'),_0x46cfac,_0xcc2e72[_0x1ba7('0xd')][_0x1ba7('0xe')]);return _0x5f5a2b(_0xcc2e72[_0x1ba7('0xd')]['message']);}else{logger[_0x1ba7('0x9')](_0x1ba7('0xf'),_0x46cfac,_0x1ba7('0xa'));_0x5f5a2b(_0xcc2e72[_0x1ba7('0x10')][_0x1ba7('0xe')]);}})[_0x1ba7('0x11')](function(_0x36c8a7){logger[_0x1ba7('0xd')](_0x1ba7('0xf'),_0x46cfac,_0x36c8a7);_0x55c40d(_0x36c8a7);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 4cbf96b..8bff22e 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 _0x895e=['../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x5b42fe,_0x129d7f){var _0x1b0c93=function(_0x448c23){while(--_0x448c23){_0x5b42fe['push'](_0x5b42fe['shift']());}};_0x1b0c93(++_0x129d7f);}(_0x895e,0x1c2));var _0xe895=function(_0x2a2233,_0x2f2ee5){_0x2a2233=_0x2a2233-0x0;var _0x504cd2=_0x895e[_0x2a2233];return _0x504cd2;};'use strict';var multer=require(_0xe895('0x0'));var util=require(_0xe895('0x1'));var path=require('path');var timeout=require(_0xe895('0x2'));var express=require(_0xe895('0x3'));var router=express[_0xe895('0x4')]();var fs_extra=require(_0xe895('0x5'));var auth=require(_0xe895('0x6'));var interaction=require(_0xe895('0x7'));var config=require('../../config/environment');var controller=require(_0xe895('0x8'));router[_0xe895('0x9')]('/',auth[_0xe895('0xa')](),controller['index']);router['get'](_0xe895('0xb'),auth[_0xe895('0xa')](),controller[_0xe895('0xc')]);router[_0xe895('0x9')](_0xe895('0xd'),auth[_0xe895('0xa')](),controller[_0xe895('0xe')]);router['post']('/',auth[_0xe895('0xa')](),controller[_0xe895('0xf')]);router['put'](_0xe895('0xb'),auth['isAuthenticated'](),controller[_0xe895('0x10')]);router[_0xe895('0x11')](_0xe895('0xb'),auth[_0xe895('0xa')](),controller['destroy']);module[_0xe895('0x12')]=router; \ No newline at end of file +var _0x3666=['destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','create','update'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x3666,0x68));var _0x6366=function(_0x72f807,_0x3d2b60){_0x72f807=_0x72f807-0x0;var _0x337b69=_0x3666[_0x72f807];return _0x337b69;};'use strict';var multer=require(_0x6366('0x0'));var util=require(_0x6366('0x1'));var path=require(_0x6366('0x2'));var timeout=require('connect-timeout');var express=require(_0x6366('0x3'));var router=express[_0x6366('0x4')]();var fs_extra=require(_0x6366('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6366('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x6366('0x7')]('/',auth[_0x6366('0x8')](),controller['index']);router[_0x6366('0x7')](_0x6366('0x9'),auth[_0x6366('0x8')](),controller[_0x6366('0xa')]);router[_0x6366('0x7')](_0x6366('0xb'),auth[_0x6366('0x8')](),controller[_0x6366('0xc')]);router['post']('/',auth[_0x6366('0x8')](),controller[_0x6366('0xd')]);router['put'](_0x6366('0x9'),auth[_0x6366('0x8')](),controller[_0x6366('0xe')]);router['delete'](_0x6366('0x9'),auth[_0x6366('0x8')](),controller[_0x6366('0xf')]);module[_0x6366('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 6be4da8..7e6484c 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 _0x2389=['BLOB','TIMESTAMP','literal','sequelize','exports','VIRTUAL','STRING'];(function(_0x47ec93,_0x8dc08f){var _0x42a807=function(_0x417b12){while(--_0x417b12){_0x47ec93['push'](_0x47ec93['shift']());}};_0x42a807(++_0x8dc08f);}(_0x2389,0xa4));var _0x9238=function(_0x489577,_0x5ca21c){_0x489577=_0x489577-0x0;var _0x3f7c42=_0x2389[_0x489577];return _0x3f7c42;};'use strict';var Sequelize=require(_0x9238('0x0'));module[_0x9238('0x1')]={'name':{'type':Sequelize[_0x9238('0x2')],'get':function(_0xdf3e1c){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9238('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x9238('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x9238('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x9238('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x9238('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9238('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9238('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x9238('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x9238('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x9238('0x3')],'defaultValue':''},'stamp':{'type':_0x9238('0x5'),'defaultValue':Sequelize[_0x9238('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x7208=['INTEGER','STRING','BLOB','long','TIMESTAMP','literal','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x535a47,_0x4a9470){var _0x41bff4=function(_0x3e4ad1){while(--_0x3e4ad1){_0x535a47['push'](_0x535a47['shift']());}};_0x41bff4(++_0x4a9470);}(_0x7208,0x196));var _0x8720=function(_0x3cca79,_0x2abbcd){_0x3cca79=_0x3cca79-0x0;var _0x35fb6f=_0x7208[_0x3cca79];return _0x35fb6f;};'use strict';var Sequelize=require(_0x8720('0x0'));module[_0x8720('0x1')]={'name':{'type':Sequelize[_0x8720('0x2')],'get':function(_0x1089ea){return this[_0x8720('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x8720('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x8720('0x6')](_0x8720('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x8720('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x8720('0x8'),'defaultValue':Sequelize[_0x8720('0x9')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d580a70..aa9c2db 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 _0x300a=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','body','find','download','recording','Sequelize','ValidationError','audio/wav','attachment','msg_id','attachment;\x20filename=\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','apply','update','destroy','then','sendStatus','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','differenceBy','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x300a,0x16f));var _0xa300=function(_0x18a4f7,_0x3f915c){_0x18a4f7=_0x18a4f7-0x0;var _0x368cf3=_0x300a[_0x18a4f7];return _0x368cf3;};'use strict';var emlformat=require(_0xa300('0x0'));var rimraf=require(_0xa300('0x1'));var zipdir=require(_0xa300('0x2'));var jsonpatch=require(_0xa300('0x3'));var rp=require(_0xa300('0x4'));var moment=require(_0xa300('0x5'));var BPromise=require(_0xa300('0x6'));var Mustache=require(_0xa300('0x7'));var util=require(_0xa300('0x8'));var path=require(_0xa300('0x9'));var sox=require(_0xa300('0xa'));var csv=require(_0xa300('0xb'));var ejs=require(_0xa300('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa300('0xd'));var squel=require(_0xa300('0xe'));var crypto=require(_0xa300('0xf'));var jsforce=require(_0xa300('0x10'));var deskjs=require(_0xa300('0x11'));var toCsv=require(_0xa300('0xb'));var querystring=require('querystring');var Papa=require(_0xa300('0x12'));var Redis=require(_0xa300('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xa300('0x14'));var as=require(_0xa300('0x15'));var hardwareService=require(_0xa300('0x16'));var logger=require(_0xa300('0x17'))(_0xa300('0x18'));var utils=require(_0xa300('0x19'));var config=require(_0xa300('0x1a'));var licenseUtil=require(_0xa300('0x1b'));var db=require(_0xa300('0x1c'))['db'];function respondWithStatusCode(_0x4b1077,_0x12a222){_0x12a222=_0x12a222||0xcc;return function(_0x2aafee){if(_0x2aafee){return _0x4b1077['sendStatus'](_0x12a222);}return _0x4b1077[_0xa300('0x1d')](_0x12a222)['end']();};}function respondWithResult(_0x5e5df3,_0x3d540b){_0x3d540b=_0x3d540b||0xc8;return function(_0x333a3c){if(_0x333a3c){return _0x5e5df3['status'](_0x3d540b)['json'](_0x333a3c);}};}function respondWithFilteredResult(_0x13c432,_0x58d348){return function(_0xddf962){if(_0xddf962){var _0x44874b=typeof _0x58d348[_0xa300('0x1e')]===_0xa300('0x1f')&&typeof _0x58d348['limit']===_0xa300('0x1f');var _0x133faa=_0xddf962[_0xa300('0x20')];var _0x5b4bdc=_0x44874b?0x0:_0x58d348['offset'];var _0x48fc7b=_0x44874b?_0xddf962[_0xa300('0x20')]:_0x58d348[_0xa300('0x1e')]+_0x58d348[_0xa300('0x21')];var _0x5b91ec;if(_0x48fc7b>=_0x133faa){_0x48fc7b=_0x133faa;_0x5b91ec=0xc8;}else{_0x5b91ec=0xce;}_0x13c432[_0xa300('0x1d')](_0x5b91ec);return _0x13c432[_0xa300('0x22')](_0xa300('0x23'),_0x5b4bdc+'-'+_0x48fc7b+'/'+_0x133faa)[_0xa300('0x24')](_0xddf962);}return null;};}function patchUpdates(_0x4aff05){return function(_0x90b2f9){try{jsonpatch[_0xa300('0x25')](_0x90b2f9,_0x4aff05,!![]);}catch(_0x1d60b1){return BPromise['reject'](_0x1d60b1);}return _0x90b2f9['save']();};}function saveUpdates(_0x4b9c5e,_0x24b289){return function(_0x2b936d){if(_0x2b936d){return _0x2b936d[_0xa300('0x26')](_0x4b9c5e)['then'](function(_0x17d705){return _0x17d705;});}return null;};}function removeEntity(_0x18d7de,_0x3a04bd){return function(_0x2aca5d){if(_0x2aca5d){return _0x2aca5d[_0xa300('0x27')]()[_0xa300('0x28')](function(){_0x18d7de[_0xa300('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45368c,_0x29872c){return function(_0x4a5876){if(!_0x4a5876){_0x45368c[_0xa300('0x29')](0x194);}return _0x4a5876;};}function handleError(_0x17b51e,_0x1899ab){_0x1899ab=_0x1899ab||0x1f4;return function(_0xd52ac7){logger['error'](_0xd52ac7['stack']);if(_0xd52ac7[_0xa300('0x2a')]){delete _0xd52ac7['name'];}_0x17b51e['status'](_0x1899ab)[_0xa300('0x2b')](_0xd52ac7);};}exports[_0xa300('0x2c')]=function(_0x10f0c7,_0xe39e6b){var _0x5d9fa8={},_0x39a398={},_0x364d11={'count':0x0,'rows':[]};var _0x59970c=_[_0xa300('0x2d')](db[_0xa300('0x2e')][_0xa300('0x2f')],function(_0x3a5b5e){return{'name':_0x3a5b5e[_0xa300('0x30')],'type':_0x3a5b5e[_0xa300('0x31')][_0xa300('0x32')]};});_0x39a398['model']=_[_0xa300('0x33')](_['map'](_0x59970c,_0xa300('0x2a')),[_0xa300('0x2a')]);_0x39a398[_0xa300('0x34')]=_[_0xa300('0x35')](_0x10f0c7[_0xa300('0x34')]);_0x39a398[_0xa300('0x36')]=_['intersection'](_0x39a398[_0xa300('0x37')],_0x39a398[_0xa300('0x34')]);_0x5d9fa8[_0xa300('0x38')]=_[_0xa300('0x39')](_0x39a398['model'],qs[_0xa300('0x3a')](_0x10f0c7[_0xa300('0x34')]['fields']));_0x5d9fa8['attributes']=_0x5d9fa8['attributes'][_0xa300('0x3b')]?_0x5d9fa8[_0xa300('0x38')]:_0x39a398['model'];if(!_0x10f0c7['query']['hasOwnProperty'](_0xa300('0x3c'))){_0x5d9fa8[_0xa300('0x21')]=qs[_0xa300('0x21')](_0x10f0c7[_0xa300('0x34')]['limit']);_0x5d9fa8[_0xa300('0x1e')]=qs['offset'](_0x10f0c7[_0xa300('0x34')]['offset']);}_0x5d9fa8[_0xa300('0x3d')]=qs[_0xa300('0x3e')](_0x10f0c7[_0xa300('0x34')][_0xa300('0x3e')]);_0x5d9fa8[_0xa300('0x3f')]=qs['filters'](_[_0xa300('0x40')](_0x10f0c7[_0xa300('0x34')],_0x39a398[_0xa300('0x36')]),_0x59970c);if(_0x10f0c7[_0xa300('0x34')][_0xa300('0x41')]){_0x5d9fa8['where']=_[_0xa300('0x42')](_0x5d9fa8[_0xa300('0x3f')],{'$or':_[_0xa300('0x2d')](_0x59970c,function(_0x53cffd){if(_0x53cffd[_0xa300('0x31')]!==_0xa300('0x43')){var _0x40768f={};_0x40768f[_0x53cffd[_0xa300('0x2a')]]={'$like':'%'+_0x10f0c7[_0xa300('0x34')][_0xa300('0x41')]+'%'};return _0x40768f;}})});}_0x5d9fa8=_['merge']({},_0x5d9fa8,_0x10f0c7[_0xa300('0x44')]);var _0x514e2f={'where':_0x5d9fa8[_0xa300('0x3f')]};return db[_0xa300('0x2e')][_0xa300('0x20')](_0x514e2f)['then'](function(_0x3b05ed){_0x364d11['count']=_0x3b05ed;if(_0x10f0c7[_0xa300('0x34')][_0xa300('0x45')]){_0x5d9fa8[_0xa300('0x46')]=[{'all':!![]}];}return db[_0xa300('0x2e')][_0xa300('0x47')](_0x5d9fa8);})[_0xa300('0x28')](function(_0x4b77f5){_0x364d11[_0xa300('0x48')]=_0x4b77f5;return _0x364d11;})[_0xa300('0x28')](respondWithFilteredResult(_0xe39e6b,_0x5d9fa8))[_0xa300('0x49')](handleError(_0xe39e6b,null));};exports[_0xa300('0x4a')]=function(_0x1c1890,_0x8f3d88){var _0x1787a5={'raw':!![],'where':{'id':_0x1c1890[_0xa300('0x4b')]['id']}},_0x3b713a={};_0x3b713a['model']=_['keys'](db[_0xa300('0x2e')][_0xa300('0x2f')]);_0x3b713a[_0xa300('0x34')]=_[_0xa300('0x35')](_0x1c1890[_0xa300('0x34')]);_0x3b713a['filters']=_[_0xa300('0x39')](_0x3b713a[_0xa300('0x37')],_0x3b713a[_0xa300('0x34')]);_0x1787a5[_0xa300('0x38')]=_[_0xa300('0x39')](_0x3b713a[_0xa300('0x37')],qs['fields'](_0x1c1890[_0xa300('0x34')]['fields']));_0x1787a5[_0xa300('0x38')]=_0x1787a5[_0xa300('0x38')][_0xa300('0x3b')]?_0x1787a5[_0xa300('0x38')]:_0x3b713a['model'];if(_0x1c1890[_0xa300('0x34')][_0xa300('0x45')]){_0x1787a5[_0xa300('0x46')]=[{'all':!![]}];}_0x1787a5=_[_0xa300('0x42')]({},_0x1787a5,_0x1c1890[_0xa300('0x44')]);return db[_0xa300('0x2e')]['find'](_0x1787a5)[_0xa300('0x28')](handleEntityNotFound(_0x8f3d88,null))[_0xa300('0x28')](respondWithResult(_0x8f3d88,null))[_0xa300('0x49')](handleError(_0x8f3d88,null));};exports['create']=function(_0x33f4d1,_0x2ffb82){return db[_0xa300('0x2e')]['create'](_0x33f4d1[_0xa300('0x4c')],{})[_0xa300('0x28')](respondWithResult(_0x2ffb82,0xc9))['catch'](handleError(_0x2ffb82,null));};exports[_0xa300('0x26')]=function(_0x4dd5bd,_0x35747c){if(_0x4dd5bd[_0xa300('0x4c')]['id']){delete _0x4dd5bd[_0xa300('0x4c')]['id'];}return db[_0xa300('0x2e')][_0xa300('0x4d')]({'where':{'id':_0x4dd5bd[_0xa300('0x4b')]['id']}})[_0xa300('0x28')](handleEntityNotFound(_0x35747c,null))[_0xa300('0x28')](saveUpdates(_0x4dd5bd[_0xa300('0x4c')],null))['then'](respondWithResult(_0x35747c,null))[_0xa300('0x49')](handleError(_0x35747c,null));};exports['destroy']=function(_0x28c24e,_0x37c87c){return db[_0xa300('0x2e')]['find']({'where':{'id':_0x28c24e['params']['id']}})[_0xa300('0x28')](handleEntityNotFound(_0x37c87c,null))[_0xa300('0x28')](removeEntity(_0x37c87c,null))[_0xa300('0x49')](handleError(_0x37c87c,null));};exports[_0xa300('0x4e')]=function(_0x2238e4,_0x1a0aa4,_0x460aba){return db[_0xa300('0x2e')][_0xa300('0x4d')]({'where':{'id':_0x2238e4['params']['id']},'attributes':['id',_0xa300('0x4f'),'msg_id']})['then'](handleEntityNotFound(_0x1a0aa4,null))[_0xa300('0x28')](function(_0xc844f5){if(_0xc844f5){if(!_0xc844f5[_0xa300('0x4f')]){throw new db[(_0xa300('0x50'))][(_0xa300('0x51'))]('VoiceMailMessage\x20not\x20found');}var _0x52c5f2={'Content-Type':_0xa300('0x52'),'Content-Disposition':_0xa300('0x53')};if(_0xc844f5[_0xa300('0x54')]){_0x52c5f2['Content-Disposition']=_0xa300('0x55')+_0xc844f5[_0xa300('0x54')]+'.wav\x22';}_0x1a0aa4[_0xa300('0x22')](_0x52c5f2);return _0x1a0aa4[_0xa300('0x2b')](new Buffer(_0xc844f5[_0xa300('0x4f')]));}})[_0xa300('0x49')](handleError(_0x1a0aa4,null));}; \ No newline at end of file +var _0xb88f=['to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','findAll','show','keys','includeAll','include','find','create','body','catch','params','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x25d21c,_0x2a9f7e){var _0x5cde67=function(_0x173ec3){while(--_0x173ec3){_0x25d21c['push'](_0x25d21c['shift']());}};_0x5cde67(++_0x2a9f7e);}(_0xb88f,0x135));var _0xfb88=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0xb88f[_0x130d82];return _0x112070;};'use strict';var emlformat=require(_0xfb88('0x0'));var rimraf=require(_0xfb88('0x1'));var zipdir=require(_0xfb88('0x2'));var jsonpatch=require(_0xfb88('0x3'));var rp=require(_0xfb88('0x4'));var moment=require(_0xfb88('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfb88('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfb88('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb88('0x8'));var squel=require(_0xfb88('0x9'));var crypto=require(_0xfb88('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfb88('0xb'));var toCsv=require(_0xfb88('0x7'));var querystring=require(_0xfb88('0xc'));var Papa=require(_0xfb88('0xd'));var Redis=require(_0xfb88('0xe'));var authService=require(_0xfb88('0xf'));var qs=require(_0xfb88('0x10'));var as=require(_0xfb88('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfb88('0x12'));var utils=require('../../config/utils');var config=require(_0xfb88('0x13'));var licenseUtil=require(_0xfb88('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a20af,_0x281dd5){_0x281dd5=_0x281dd5||0xcc;return function(_0x30b604){if(_0x30b604){return _0x4a20af[_0xfb88('0x15')](_0x281dd5);}return _0x4a20af['status'](_0x281dd5)[_0xfb88('0x16')]();};}function respondWithResult(_0x1981a1,_0x18e645){_0x18e645=_0x18e645||0xc8;return function(_0x3dcc3a){if(_0x3dcc3a){return _0x1981a1[_0xfb88('0x17')](_0x18e645)[_0xfb88('0x18')](_0x3dcc3a);}};}function respondWithFilteredResult(_0x52aa9f,_0x48afa2){return function(_0x1dff06){if(_0x1dff06){var _0x35c24e=typeof _0x48afa2[_0xfb88('0x19')]==='undefined'&&typeof _0x48afa2['limit']==='undefined';var _0x25db95=_0x1dff06[_0xfb88('0x1a')];var _0x344b4a=_0x35c24e?0x0:_0x48afa2['offset'];var _0x380fbd=_0x35c24e?_0x1dff06['count']:_0x48afa2[_0xfb88('0x19')]+_0x48afa2['limit'];var _0x26705c;if(_0x380fbd>=_0x25db95){_0x380fbd=_0x25db95;_0x26705c=0xc8;}else{_0x26705c=0xce;}_0x52aa9f[_0xfb88('0x17')](_0x26705c);return _0x52aa9f[_0xfb88('0x1b')](_0xfb88('0x1c'),_0x344b4a+'-'+_0x380fbd+'/'+_0x25db95)[_0xfb88('0x18')](_0x1dff06);}return null;};}function patchUpdates(_0x195ecb){return function(_0x3f5c10){try{jsonpatch['apply'](_0x3f5c10,_0x195ecb,!![]);}catch(_0x40e268){return BPromise[_0xfb88('0x1d')](_0x40e268);}return _0x3f5c10[_0xfb88('0x1e')]();};}function saveUpdates(_0x541638,_0x384767){return function(_0x368ed4){if(_0x368ed4){return _0x368ed4[_0xfb88('0x1f')](_0x541638)[_0xfb88('0x20')](function(_0x1aa138){return _0x1aa138;});}return null;};}function removeEntity(_0x58a8c8,_0x3c3085){return function(_0x496cd8){if(_0x496cd8){return _0x496cd8[_0xfb88('0x21')]()[_0xfb88('0x20')](function(){_0x58a8c8[_0xfb88('0x17')](0xcc)[_0xfb88('0x16')]();});}};}function handleEntityNotFound(_0x47da68,_0x9a42b){return function(_0x53dcf8){if(!_0x53dcf8){_0x47da68['sendStatus'](0x194);}return _0x53dcf8;};}function handleError(_0x25339c,_0x196770){_0x196770=_0x196770||0x1f4;return function(_0x34b157){logger['error'](_0x34b157[_0xfb88('0x22')]);if(_0x34b157[_0xfb88('0x23')]){delete _0x34b157[_0xfb88('0x23')];}_0x25339c[_0xfb88('0x17')](_0x196770)[_0xfb88('0x24')](_0x34b157);};}exports[_0xfb88('0x25')]=function(_0x373c98,_0x521d74){var _0x6b8d8a={},_0x230d23={},_0x445041={'count':0x0,'rows':[]};var _0x760614=_[_0xfb88('0x26')](db['VoiceMailMessage'][_0xfb88('0x27')],function(_0xb5139f){return{'name':_0xb5139f[_0xfb88('0x28')],'type':_0xb5139f[_0xfb88('0x29')][_0xfb88('0x2a')]};});_0x230d23[_0xfb88('0x2b')]=_[_0xfb88('0x2c')](_[_0xfb88('0x26')](_0x760614,_0xfb88('0x23')),[_0xfb88('0x23')]);_0x230d23[_0xfb88('0x2d')]=_['keys'](_0x373c98[_0xfb88('0x2d')]);_0x230d23[_0xfb88('0x2e')]=_[_0xfb88('0x2f')](_0x230d23[_0xfb88('0x2b')],_0x230d23[_0xfb88('0x2d')]);_0x6b8d8a[_0xfb88('0x30')]=_[_0xfb88('0x2f')](_0x230d23[_0xfb88('0x2b')],qs[_0xfb88('0x31')](_0x373c98[_0xfb88('0x2d')][_0xfb88('0x31')]));_0x6b8d8a[_0xfb88('0x30')]=_0x6b8d8a[_0xfb88('0x30')][_0xfb88('0x32')]?_0x6b8d8a[_0xfb88('0x30')]:_0x230d23[_0xfb88('0x2b')];if(!_0x373c98[_0xfb88('0x2d')]['hasOwnProperty'](_0xfb88('0x33'))){_0x6b8d8a[_0xfb88('0x34')]=qs[_0xfb88('0x34')](_0x373c98[_0xfb88('0x2d')][_0xfb88('0x34')]);_0x6b8d8a[_0xfb88('0x19')]=qs[_0xfb88('0x19')](_0x373c98[_0xfb88('0x2d')]['offset']);}_0x6b8d8a[_0xfb88('0x35')]=qs[_0xfb88('0x36')](_0x373c98['query']['sort']);_0x6b8d8a[_0xfb88('0x37')]=qs[_0xfb88('0x2e')](_[_0xfb88('0x38')](_0x373c98[_0xfb88('0x2d')],_0x230d23['filters']),_0x760614);if(_0x373c98[_0xfb88('0x2d')][_0xfb88('0x39')]){_0x6b8d8a[_0xfb88('0x37')]=_[_0xfb88('0x3a')](_0x6b8d8a[_0xfb88('0x37')],{'$or':_[_0xfb88('0x26')](_0x760614,function(_0x59f516){if(_0x59f516[_0xfb88('0x29')]!==_0xfb88('0x3b')){var _0x40eece={};_0x40eece[_0x59f516[_0xfb88('0x23')]]={'$like':'%'+_0x373c98[_0xfb88('0x2d')][_0xfb88('0x39')]+'%'};return _0x40eece;}})});}_0x6b8d8a=_[_0xfb88('0x3a')]({},_0x6b8d8a,_0x373c98[_0xfb88('0x3c')]);var _0xfda141={'where':_0x6b8d8a['where']};return db['VoiceMailMessage'][_0xfb88('0x1a')](_0xfda141)[_0xfb88('0x20')](function(_0x122ef9){_0x445041[_0xfb88('0x1a')]=_0x122ef9;if(_0x373c98[_0xfb88('0x2d')]['includeAll']){_0x6b8d8a['include']=[{'all':!![]}];}return db[_0xfb88('0x3d')][_0xfb88('0x3e')](_0x6b8d8a);})[_0xfb88('0x20')](function(_0x506788){_0x445041['rows']=_0x506788;return _0x445041;})['then'](respondWithFilteredResult(_0x521d74,_0x6b8d8a))['catch'](handleError(_0x521d74,null));};exports[_0xfb88('0x3f')]=function(_0x5988f8,_0x265815){var _0x2ac767={'raw':!![],'where':{'id':_0x5988f8['params']['id']}},_0x3ed237={};_0x3ed237[_0xfb88('0x2b')]=_[_0xfb88('0x40')](db[_0xfb88('0x3d')][_0xfb88('0x27')]);_0x3ed237[_0xfb88('0x2d')]=_[_0xfb88('0x40')](_0x5988f8['query']);_0x3ed237['filters']=_[_0xfb88('0x2f')](_0x3ed237[_0xfb88('0x2b')],_0x3ed237['query']);_0x2ac767[_0xfb88('0x30')]=_['intersection'](_0x3ed237[_0xfb88('0x2b')],qs['fields'](_0x5988f8['query'][_0xfb88('0x31')]));_0x2ac767[_0xfb88('0x30')]=_0x2ac767['attributes']['length']?_0x2ac767[_0xfb88('0x30')]:_0x3ed237['model'];if(_0x5988f8[_0xfb88('0x2d')][_0xfb88('0x41')]){_0x2ac767[_0xfb88('0x42')]=[{'all':!![]}];}_0x2ac767=_['merge']({},_0x2ac767,_0x5988f8[_0xfb88('0x3c')]);return db['VoiceMailMessage'][_0xfb88('0x43')](_0x2ac767)[_0xfb88('0x20')](handleEntityNotFound(_0x265815,null))[_0xfb88('0x20')](respondWithResult(_0x265815,null))['catch'](handleError(_0x265815,null));};exports[_0xfb88('0x44')]=function(_0x568019,_0x3d0788){return db[_0xfb88('0x3d')][_0xfb88('0x44')](_0x568019[_0xfb88('0x45')],{})['then'](respondWithResult(_0x3d0788,0xc9))[_0xfb88('0x46')](handleError(_0x3d0788,null));};exports['update']=function(_0x45bbe2,_0x112440){if(_0x45bbe2[_0xfb88('0x45')]['id']){delete _0x45bbe2['body']['id'];}return db['VoiceMailMessage'][_0xfb88('0x43')]({'where':{'id':_0x45bbe2['params']['id']}})[_0xfb88('0x20')](handleEntityNotFound(_0x112440,null))['then'](saveUpdates(_0x45bbe2['body'],null))[_0xfb88('0x20')](respondWithResult(_0x112440,null))[_0xfb88('0x46')](handleError(_0x112440,null));};exports[_0xfb88('0x21')]=function(_0x11c6e7,_0x426dbc){return db[_0xfb88('0x3d')][_0xfb88('0x43')]({'where':{'id':_0x11c6e7[_0xfb88('0x47')]['id']}})['then'](handleEntityNotFound(_0x426dbc,null))['then'](removeEntity(_0x426dbc,null))[_0xfb88('0x46')](handleError(_0x426dbc,null));};exports[_0xfb88('0x48')]=function(_0x3f9f54,_0x34f2b8,_0x117a4b){return db[_0xfb88('0x3d')][_0xfb88('0x43')]({'where':{'id':_0x3f9f54['params']['id']},'attributes':['id',_0xfb88('0x49'),_0xfb88('0x4a')]})[_0xfb88('0x20')](handleEntityNotFound(_0x34f2b8,null))[_0xfb88('0x20')](function(_0x4e0634){if(_0x4e0634){if(!_0x4e0634[_0xfb88('0x49')]){throw new db[(_0xfb88('0x4b'))][(_0xfb88('0x4c'))](_0xfb88('0x4d'));}var _0x13311d={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x4e0634[_0xfb88('0x4a')]){_0x13311d['Content-Disposition']='attachment;\x20filename=\x22'+_0x4e0634[_0xfb88('0x4a')]+_0xfb88('0x4e');}_0x34f2b8['set'](_0x13311d);return _0x34f2b8[_0xfb88('0x24')](new Buffer(_0x4e0634['recording']));}})[_0xfb88('0x46')](handleError(_0x34f2b8,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 9842421..7d291e6 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 _0xd2ca=['VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x18d4cb,_0x3018da){var _0x542fee=function(_0x1fc54f){while(--_0x1fc54f){_0x18d4cb['push'](_0x18d4cb['shift']());}};_0x542fee(++_0x3018da);}(_0xd2ca,0x1d4));var _0xad2c=function(_0x3a2409,_0x25cb8d){_0x3a2409=_0x3a2409-0x0;var _0x90f378=_0xd2ca[_0x3a2409];return _0x90f378;};'use strict';var _=require(_0xad2c('0x0'));var util=require(_0xad2c('0x1'));var logger=require(_0xad2c('0x2'))(_0xad2c('0x3'));var moment=require(_0xad2c('0x4'));var BPromise=require(_0xad2c('0x5'));var rp=require(_0xad2c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad2c('0x7'));var config=require(_0xad2c('0x8'));var attributes=require(_0xad2c('0x9'));module[_0xad2c('0xa')]=function(_0x2d622e,_0x1118b9){return _0x2d622e[_0xad2c('0xb')](_0xad2c('0xc'),attributes,{'tableName':_0xad2c('0xd'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xad2c('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1898=['request-promise','rimraf','../../config/environment','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','bluebird'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0x1898,0x98));var _0x8189=function(_0x31c918,_0x59e824){_0x31c918=_0x31c918-0x0;var _0x3056d3=_0x1898[_0x31c918];return _0x3056d3;};'use strict';var _=require(_0x8189('0x0'));var util=require(_0x8189('0x1'));var logger=require('../../config/logger')(_0x8189('0x2'));var moment=require('moment');var BPromise=require(_0x8189('0x3'));var rp=require(_0x8189('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8189('0x5'));var config=require(_0x8189('0x6'));var attributes=require('./voiceMailMessage.attributes');module[_0x8189('0x7')]=function(_0x5a0201,_0x2b4209){return _0x5a0201[_0x8189('0x8')](_0x8189('0x9'),attributes,{'tableName':_0x8189('0xa'),'paranoid':![],'indexes':[{'name':_0x8189('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 59d3f8e..0a6ee5e 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 _0x7e65=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5b5925,_0x16c2ad){var _0x50bf96=function(_0x41ade4){while(--_0x41ade4){_0x5b5925['push'](_0x5b5925['shift']());}};_0x50bf96(++_0x16c2ad);}(_0x7e65,0x83));var _0x57e6=function(_0x436f18,_0x40b20b){_0x436f18=_0x436f18-0x0;var _0x4177ee=_0x7e65[_0x436f18];return _0x4177ee;};'use strict';var _=require(_0x57e6('0x0'));var util=require(_0x57e6('0x1'));var moment=require(_0x57e6('0x2'));var BPromise=require(_0x57e6('0x3'));var rs=require(_0x57e6('0x4'));var fs=require('fs');var Redis=require(_0x57e6('0x5'));var db=require(_0x57e6('0x6'))['db'];var utils=require(_0x57e6('0x7'));var logger=require('../../config/logger')(_0x57e6('0x8'));var config=require(_0x57e6('0x9'));var jayson=require(_0x57e6('0xa'));var client=jayson[_0x57e6('0xb')][_0x57e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17e806,_0x5d1005,_0x3b61a3){return new BPromise(function(_0x1d085f,_0xcb0d01){return client['request'](_0x17e806,_0x3b61a3)[_0x57e6('0xd')](function(_0x8f5a4b){logger[_0x57e6('0xe')](_0x57e6('0xf'),_0x5d1005,_0x57e6('0x10'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5d1005,_0x57e6('0x10'),JSON[_0x57e6('0x11')](_0x8f5a4b));if(_0x8f5a4b['error']){if(_0x8f5a4b[_0x57e6('0x12')][_0x57e6('0x13')]===0x1f4){logger['error'](_0x57e6('0xf'),_0x5d1005,_0x8f5a4b[_0x57e6('0x12')][_0x57e6('0x14')]);return _0xcb0d01(_0x8f5a4b['error']['message']);}logger[_0x57e6('0x12')](_0x57e6('0xf'),_0x5d1005,_0x8f5a4b[_0x57e6('0x12')][_0x57e6('0x14')]);return _0x1d085f(_0x8f5a4b[_0x57e6('0x12')][_0x57e6('0x14')]);}else{logger[_0x57e6('0xe')](_0x57e6('0xf'),_0x5d1005,'request\x20sent');_0x1d085f(_0x8f5a4b[_0x57e6('0x15')][_0x57e6('0x14')]);}})[_0x57e6('0x16')](function(_0x1cb22d){logger[_0x57e6('0x12')](_0x57e6('0xf'),_0x5d1005,_0x1cb22d);_0xcb0d01(_0x1cb22d);});});} \ No newline at end of file +var _0x42b2=['client','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2ecfca,_0x4f5d2c){var _0x3cbd36=function(_0x3f7c17){while(--_0x3f7c17){_0x2ecfca['push'](_0x2ecfca['shift']());}};_0x3cbd36(++_0x4f5d2c);}(_0x42b2,0x107));var _0x242b=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x42b2[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x242b('0x0'));var util=require(_0x242b('0x1'));var moment=require(_0x242b('0x2'));var BPromise=require(_0x242b('0x3'));var rs=require(_0x242b('0x4'));var fs=require('fs');var Redis=require(_0x242b('0x5'));var db=require(_0x242b('0x6'))['db'];var utils=require(_0x242b('0x7'));var logger=require(_0x242b('0x8'))(_0x242b('0x9'));var config=require(_0x242b('0xa'));var jayson=require(_0x242b('0xb'));var client=jayson[_0x242b('0xc')][_0x242b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2aa2a8,_0x304213,_0x2fd43d){return new BPromise(function(_0x5c8ac1,_0x1b7eb4){return client['request'](_0x2aa2a8,_0x2fd43d)['then'](function(_0x577f21){logger[_0x242b('0xe')](_0x242b('0xf'),_0x304213,_0x242b('0x10'));logger[_0x242b('0x11')](_0x242b('0x12'),_0x304213,_0x242b('0x10'),JSON[_0x242b('0x13')](_0x577f21));if(_0x577f21[_0x242b('0x14')]){if(_0x577f21[_0x242b('0x14')][_0x242b('0x15')]===0x1f4){logger[_0x242b('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x304213,_0x577f21[_0x242b('0x14')]['message']);return _0x1b7eb4(_0x577f21['error'][_0x242b('0x16')]);}logger[_0x242b('0x14')](_0x242b('0xf'),_0x304213,_0x577f21[_0x242b('0x14')][_0x242b('0x16')]);return _0x5c8ac1(_0x577f21[_0x242b('0x14')][_0x242b('0x16')]);}else{logger[_0x242b('0xe')](_0x242b('0xf'),_0x304213,_0x242b('0x10'));_0x5c8ac1(_0x577f21[_0x242b('0x17')]['message']);}})[_0x242b('0x18')](function(_0x4cb971){logger[_0x242b('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x304213,_0x4cb971);_0x1b7eb4(_0x4cb971);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 9371864..7ea966c 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 _0xd88a=['update','delete','/:id','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','getSounds','post','create','addSound','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd88a,0x11b));var _0xad88=function(_0x317d61,_0x5e6335){_0x317d61=_0x317d61-0x0;var _0x3abc20=_0xd88a[_0x317d61];return _0x3abc20;};'use strict';var multer=require(_0xad88('0x0'));var util=require(_0xad88('0x1'));var path=require(_0xad88('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xad88('0x3')]();var fs_extra=require(_0xad88('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xad88('0x5'));var config=require(_0xad88('0x6'));var controller=require(_0xad88('0x7'));router[_0xad88('0x8')]('/',auth[_0xad88('0x9')](),controller[_0xad88('0xa')]);router[_0xad88('0x8')]('/:id',auth[_0xad88('0x9')](),controller[_0xad88('0xb')]);router[_0xad88('0x8')]('/:id/sounds',auth[_0xad88('0x9')](),controller[_0xad88('0xc')]);router[_0xad88('0xd')]('/',auth['isAuthenticated'](),controller[_0xad88('0xe')]);router[_0xad88('0xd')]('/:id/sounds',auth[_0xad88('0x9')](),controller[_0xad88('0xf')]);router[_0xad88('0x10')]('/:id',auth[_0xad88('0x9')](),controller[_0xad88('0x11')]);router[_0xad88('0x12')](_0xad88('0x13'),auth['isAuthenticated'](),controller['destroy']);router[_0xad88('0x12')]('/:id/sounds/:id2',auth[_0xad88('0x9')](),controller['removeSound']);module['exports']=router; \ No newline at end of file +var _0x30d2=['put','/:id','update','delete','destroy','/:id/sounds/:id2','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','show','get','/:id/sounds','getSounds','create','post','addSound'];(function(_0x2dc5b5,_0x10d82c){var _0x2a8ccc=function(_0x2de9da){while(--_0x2de9da){_0x2dc5b5['push'](_0x2dc5b5['shift']());}};_0x2a8ccc(++_0x10d82c);}(_0x30d2,0x125));var _0x230d=function(_0x4200e3,_0xb34e23){_0x4200e3=_0x4200e3-0x0;var _0x26ac37=_0x30d2[_0x4200e3];return _0x26ac37;};'use strict';var multer=require(_0x230d('0x0'));var util=require(_0x230d('0x1'));var path=require(_0x230d('0x2'));var timeout=require(_0x230d('0x3'));var express=require('express');var router=express[_0x230d('0x4')]();var fs_extra=require(_0x230d('0x5'));var auth=require(_0x230d('0x6'));var interaction=require(_0x230d('0x7'));var config=require(_0x230d('0x8'));var controller=require(_0x230d('0x9'));router['get']('/',auth[_0x230d('0xa')](),controller[_0x230d('0xb')]);router['get']('/:id',auth[_0x230d('0xa')](),controller[_0x230d('0xc')]);router[_0x230d('0xd')](_0x230d('0xe'),auth[_0x230d('0xa')](),controller[_0x230d('0xf')]);router['post']('/',auth[_0x230d('0xa')](),controller[_0x230d('0x10')]);router[_0x230d('0x11')](_0x230d('0xe'),auth['isAuthenticated'](),controller[_0x230d('0x12')]);router[_0x230d('0x13')](_0x230d('0x14'),auth[_0x230d('0xa')](),controller[_0x230d('0x15')]);router[_0x230d('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x230d('0x17')]);router[_0x230d('0x16')](_0x230d('0x18'),auth[_0x230d('0xa')](),controller['removeSound']);module[_0x230d('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 9da87cb..7f98162 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 _0xf364=['STRING','name','ENUM','mp3nb','quietmp3nb','quietmp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x2f303d,_0x5c22ce){var _0x2a84a6=function(_0x1af594){while(--_0x1af594){_0x2f303d['push'](_0x2f303d['shift']());}};_0x2a84a6(++_0x5c22ce);}(_0xf364,0x78));var _0x4f36=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xf364[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x4f36('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f36('0x1')],'allowNull':![],'unique':_0x4f36('0x2')},'mode':{'type':Sequelize[_0x4f36('0x3')]('custom','files',_0x4f36('0x4'),_0x4f36('0x5'),_0x4f36('0x6'),'mp3'),'allowNull':!![],'defaultValue':_0x4f36('0x7')},'directory':{'type':Sequelize[_0x4f36('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x4f36('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x4f36('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x4f36('0x1')],'allowNull':!![],'defaultValue':_0x4f36('0x8')},'format':{'type':Sequelize[_0x4f36('0x1')],'allowNull':!![]},'stamp':{'type':_0x4f36('0x9')},'defaultEntry':{'type':Sequelize[_0x4f36('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x40ca=['quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','custom','files','mp3nb'];(function(_0x9e575,_0x5894d4){var _0x522277=function(_0x1f5458){while(--_0x1f5458){_0x9e575['push'](_0x9e575['shift']());}};_0x522277(++_0x5894d4);}(_0x40ca,0x1d9));var _0xa40c=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x40ca[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0xa40c('0x0'));module[_0xa40c('0x1')]={'name':{'type':Sequelize[_0xa40c('0x2')],'allowNull':![],'unique':_0xa40c('0x3')},'mode':{'type':Sequelize['ENUM'](_0xa40c('0x4'),_0xa40c('0x5'),_0xa40c('0x6'),'quietmp3nb',_0xa40c('0x7'),_0xa40c('0x8')),'allowNull':!![],'defaultValue':_0xa40c('0x5')},'directory':{'type':Sequelize[_0xa40c('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xa40c('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa40c('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa40c('0x2')],'allowNull':!![],'defaultValue':_0xa40c('0x9')},'format':{'type':Sequelize[_0xa40c('0x2')],'allowNull':!![]},'stamp':{'type':_0xa40c('0xa')},'defaultEntry':{'type':Sequelize[_0xa40c('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index ce54de2..e7504c6 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 _0x6482=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','index','VoiceMusicOnHold','rawAttributes','fieldName','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','includeAll','include','body','find','create','sequelize','files','directory','join','server/files/moh','mode','mkdirSync','0777','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','save_name','extname','symlinkSync','removeSound','id2','unlinkSync','getSounds','eml-format','zip-dir','request-promise'];(function(_0x418549,_0x11b13d){var _0x288826=function(_0x3c0411){while(--_0x3c0411){_0x418549['push'](_0x418549['shift']());}};_0x288826(++_0x11b13d);}(_0x6482,0x1c5));var _0x2648=function(_0x128cae,_0x398cf9){_0x128cae=_0x128cae-0x0;var _0x177631=_0x6482[_0x128cae];return _0x177631;};'use strict';var emlformat=require(_0x2648('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2648('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2648('0x2'));var moment=require(_0x2648('0x3'));var BPromise=require(_0x2648('0x4'));var Mustache=require(_0x2648('0x5'));var util=require(_0x2648('0x6'));var path=require(_0x2648('0x7'));var sox=require(_0x2648('0x8'));var csv=require(_0x2648('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2648('0xa'));var _=require(_0x2648('0xb'));var squel=require(_0x2648('0xc'));var crypto=require('crypto');var jsforce=require(_0x2648('0xd'));var deskjs=require(_0x2648('0xe'));var toCsv=require(_0x2648('0x9'));var querystring=require(_0x2648('0xf'));var Papa=require(_0x2648('0x10'));var Redis=require(_0x2648('0x11'));var authService=require(_0x2648('0x12'));var qs=require(_0x2648('0x13'));var as=require(_0x2648('0x14'));var hardwareService=require(_0x2648('0x15'));var logger=require(_0x2648('0x16'))(_0x2648('0x17'));var utils=require(_0x2648('0x18'));var config=require(_0x2648('0x19'));var licenseUtil=require(_0x2648('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40eb89,_0x9e57b4){_0x9e57b4=_0x9e57b4||0xcc;return function(_0x5a122e){if(_0x5a122e){return _0x40eb89['sendStatus'](_0x9e57b4);}return _0x40eb89[_0x2648('0x1b')](_0x9e57b4)[_0x2648('0x1c')]();};}function respondWithResult(_0x5cc047,_0xfc35cf){_0xfc35cf=_0xfc35cf||0xc8;return function(_0x2141f8){if(_0x2141f8){return _0x5cc047[_0x2648('0x1b')](_0xfc35cf)[_0x2648('0x1d')](_0x2141f8);}};}function respondWithFilteredResult(_0x555bb7,_0x135d8b){return function(_0x4b1f6a){if(_0x4b1f6a){var _0x14ae3b=typeof _0x135d8b[_0x2648('0x1e')]==='undefined'&&typeof _0x135d8b[_0x2648('0x1f')]===_0x2648('0x20');var _0x44c2ec=_0x4b1f6a[_0x2648('0x21')];var _0x5cd957=_0x14ae3b?0x0:_0x135d8b[_0x2648('0x1e')];var _0x4e4411=_0x14ae3b?_0x4b1f6a[_0x2648('0x21')]:_0x135d8b[_0x2648('0x1e')]+_0x135d8b[_0x2648('0x1f')];var _0x2a9fed;if(_0x4e4411>=_0x44c2ec){_0x4e4411=_0x44c2ec;_0x2a9fed=0xc8;}else{_0x2a9fed=0xce;}_0x555bb7['status'](_0x2a9fed);return _0x555bb7['set'](_0x2648('0x22'),_0x5cd957+'-'+_0x4e4411+'/'+_0x44c2ec)[_0x2648('0x1d')](_0x4b1f6a);}return null;};}function patchUpdates(_0x2f4e81){return function(_0xb4d2bd){try{jsonpatch[_0x2648('0x23')](_0xb4d2bd,_0x2f4e81,!![]);}catch(_0x4a463d){return BPromise['reject'](_0x4a463d);}return _0xb4d2bd[_0x2648('0x24')]();};}function saveUpdates(_0x5d1499,_0x4a0aea){return function(_0xbdd55d){if(_0xbdd55d){return _0xbdd55d[_0x2648('0x25')](_0x5d1499)[_0x2648('0x26')](function(_0x47c683){return _0x47c683;});}return null;};}function removeEntity(_0x1b7811,_0x488086){return function(_0xf0de21){if(_0xf0de21){return _0xf0de21[_0x2648('0x27')]()[_0x2648('0x26')](function(){var _0x231e95=_0xf0de21[_0x2648('0x28')]({'plain':!![]});var _0x526ac3=_0x2648('0x29');return db[_0x2648('0x2a')][_0x2648('0x27')]({'where':{'type':_0x526ac3,'resourceId':_0x231e95['id']}})['then'](function(){return _0xf0de21;});})[_0x2648('0x26')](function(){_0x1b7811['status'](0xcc)[_0x2648('0x1c')]();});}};}function handleEntityNotFound(_0x2363d2,_0x445ad9){return function(_0x3bce11){if(!_0x3bce11){_0x2363d2[_0x2648('0x2b')](0x194);}return _0x3bce11;};}function handleError(_0x2afeef,_0x2dfc77){_0x2dfc77=_0x2dfc77||0x1f4;return function(_0x3eec81){logger[_0x2648('0x2c')](_0x3eec81[_0x2648('0x2d')]);if(_0x3eec81[_0x2648('0x2e')]){delete _0x3eec81[_0x2648('0x2e')];}_0x2afeef[_0x2648('0x1b')](_0x2dfc77)['send'](_0x3eec81);};}exports[_0x2648('0x2f')]=function(_0x2e5466,_0x165815){var _0x326d4d={},_0x790a90={},_0x5ada29={'count':0x0,'rows':[]};var _0x4420f4=_['map'](db[_0x2648('0x30')][_0x2648('0x31')],function(_0xbd27b2){return{'name':_0xbd27b2[_0x2648('0x32')],'type':_0xbd27b2['type']['key']};});_0x790a90[_0x2648('0x33')]=_[_0x2648('0x34')](_0x4420f4,'name');_0x790a90[_0x2648('0x35')]=_[_0x2648('0x36')](_0x2e5466['query']);_0x790a90[_0x2648('0x37')]=_[_0x2648('0x38')](_0x790a90['model'],_0x790a90[_0x2648('0x35')]);_0x326d4d['attributes']=_[_0x2648('0x38')](_0x790a90[_0x2648('0x33')],qs[_0x2648('0x39')](_0x2e5466[_0x2648('0x35')][_0x2648('0x39')]));_0x326d4d[_0x2648('0x3a')]=_0x326d4d[_0x2648('0x3a')][_0x2648('0x3b')]?_0x326d4d[_0x2648('0x3a')]:_0x790a90[_0x2648('0x33')];if(!_0x2e5466['query'][_0x2648('0x3c')](_0x2648('0x3d'))){_0x326d4d[_0x2648('0x1f')]=qs[_0x2648('0x1f')](_0x2e5466[_0x2648('0x35')][_0x2648('0x1f')]);_0x326d4d[_0x2648('0x1e')]=qs['offset'](_0x2e5466[_0x2648('0x35')][_0x2648('0x1e')]);}_0x326d4d[_0x2648('0x3e')]=qs[_0x2648('0x3f')](_0x2e5466[_0x2648('0x35')]['sort']);delete _0x2e5466[_0x2648('0x35')][_0x2648('0x3f')];_0x326d4d[_0x2648('0x40')]=qs[_0x2648('0x37')](_[_0x2648('0x41')](_0x2e5466[_0x2648('0x35')],_0x790a90[_0x2648('0x37')]),_0x4420f4);if(_0x2e5466['query'][_0x2648('0x42')]){_0x326d4d['where']=_[_0x2648('0x43')](_0x326d4d[_0x2648('0x40')],{'$or':_[_0x2648('0x34')](_0x4420f4,function(_0x2cd636){if(_0x2cd636[_0x2648('0x44')]!==_0x2648('0x45')){var _0x1a5a82={};_0x1a5a82[_0x2cd636[_0x2648('0x2e')]]={'$like':'%'+_0x2e5466['query'][_0x2648('0x42')]+'%'};return _0x1a5a82;}})});}_0x326d4d=_[_0x2648('0x43')]({},_0x326d4d,_0x2e5466[_0x2648('0x46')]);var _0x10179b={'where':_0x326d4d[_0x2648('0x40')]};return db[_0x2648('0x30')][_0x2648('0x21')](_0x10179b)[_0x2648('0x26')](function(_0x517e7c){_0x5ada29['count']=_0x517e7c;if(_0x2e5466[_0x2648('0x35')]['includeAll']){_0x326d4d['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x2648('0x47')](_0x326d4d);})['then'](function(_0x46d617){_0x5ada29['rows']=_0x46d617;return _0x5ada29;})[_0x2648('0x26')](respondWithFilteredResult(_0x165815,_0x326d4d))[_0x2648('0x48')](handleError(_0x165815,null));};exports[_0x2648('0x49')]=function(_0x23375d,_0x49bf5a){var _0xf20d6a={'raw':![],'where':{'id':_0x23375d[_0x2648('0x4a')]['id']}},_0x311a28={};_0x311a28['model']=_[_0x2648('0x36')](db[_0x2648('0x30')][_0x2648('0x31')]);_0x311a28[_0x2648('0x35')]=_['keys'](_0x23375d[_0x2648('0x35')]);_0x311a28[_0x2648('0x37')]=_[_0x2648('0x38')](_0x311a28[_0x2648('0x33')],_0x311a28[_0x2648('0x35')]);_0xf20d6a['attributes']=_[_0x2648('0x38')](_0x311a28[_0x2648('0x33')],qs[_0x2648('0x39')](_0x23375d['query'][_0x2648('0x39')]));_0xf20d6a['attributes']=_0xf20d6a['attributes'][_0x2648('0x3b')]?_0xf20d6a[_0x2648('0x3a')]:_0x311a28[_0x2648('0x33')];if(_0x23375d['query'][_0x2648('0x4b')]){_0xf20d6a[_0x2648('0x4c')]=[{'all':!![]}];}_0xf20d6a=_['merge']({},_0xf20d6a,_0x23375d['options']);return db['VoiceMusicOnHold']['find'](_0xf20d6a)[_0x2648('0x26')](handleEntityNotFound(_0x49bf5a,null))[_0x2648('0x26')](respondWithResult(_0x49bf5a,null))[_0x2648('0x48')](handleError(_0x49bf5a,null));};exports['update']=function(_0x566be0,_0x36657e){if(_0x566be0[_0x2648('0x4d')]['id']){delete _0x566be0[_0x2648('0x4d')]['id'];}return db['VoiceMusicOnHold'][_0x2648('0x4e')]({'where':{'id':_0x566be0[_0x2648('0x4a')]['id']}})[_0x2648('0x26')](handleEntityNotFound(_0x36657e,null))[_0x2648('0x26')](saveUpdates(_0x566be0[_0x2648('0x4d')],null))[_0x2648('0x26')](respondWithResult(_0x36657e,null))[_0x2648('0x48')](handleError(_0x36657e,null));};exports[_0x2648('0x4f')]=function(_0x322134,_0x324dd2,_0x43655c){return db[_0x2648('0x50')]['transaction'](function(_0x388180){if(_0x322134[_0x2648('0x4d')]['mode']===_0x2648('0x51')){_0x322134[_0x2648('0x4d')][_0x2648('0x52')]=path[_0x2648('0x53')](config['root'],_0x2648('0x54'),_0x322134['body'][_0x2648('0x2e')]);}return db[_0x2648('0x30')][_0x2648('0x4f')](_0x322134[_0x2648('0x4d')],{'transaction':_0x388180})[_0x2648('0x26')](function(_0xc806e1){if(_0x322134['body'][_0x2648('0x55')]===_0x2648('0x51')){fs[_0x2648('0x56')](_0xc806e1[_0x2648('0x52')],parseInt(_0x2648('0x57'),0x8));}var _0x2a9040=_0x322134[_0x2648('0x58')]['get']({'plain':!![]});if(!_0x2a9040)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a9040[_0x2648('0x59')]===_0x2648('0x58')){var _0x2cf5ef=_0xc806e1['get']({'plain':!![]});return db['UserProfileSection'][_0x2648('0x4e')]({'where':{'name':_0x2648('0x29'),'userProfileId':_0x2a9040['userProfileId']},'raw':!![]})[_0x2648('0x26')](function(_0x3746c3){if(_0x3746c3&&_0x3746c3[_0x2648('0x5a')]===0x0){return db[_0x2648('0x2a')][_0x2648('0x4f')]({'name':_0x2cf5ef['name'],'resourceId':_0x2cf5ef['id'],'type':_0x3746c3[_0x2648('0x2e')],'sectionId':_0x3746c3['id']},{})['then'](function(){return _0xc806e1;});}else{return _0xc806e1;}})[_0x2648('0x48')](function(_0xc4ec0e){logger[_0x2648('0x2c')](_0x2648('0x5b'),_0xc4ec0e);});}return _0xc806e1;});})[_0x2648('0x26')](respondWithResult(_0x324dd2,0xc9))[_0x2648('0x48')](handleError(_0x324dd2,null));};exports[_0x2648('0x27')]=function(_0x4a3c17,_0x598c22,_0x4d2875){var _0x2992f7;return db['VoiceMusicOnHold'][_0x2648('0x4e')]({'where':{'id':_0x4a3c17[_0x2648('0x4a')]['id']}})[_0x2648('0x26')](function(_0x1c9d3c){if(_0x1c9d3c){return db[_0x2648('0x50')][_0x2648('0x5c')](function(_0x295314){return _0x1c9d3c['destroy']({'transaction':_0x295314,'raw':!![]})[_0x2648('0x26')](function(_0x34e850){if(_0x34e850[_0x2648('0x52')]){fs[_0x2648('0x5d')](_0x34e850[_0x2648('0x52')])['forEach'](function(_0x1b0330){fs['unlinkSync'](path['join'](_0x34e850['directory'],_0x1b0330));});fs[_0x2648('0x5e')](_0x34e850[_0x2648('0x52')]);}return _0x34e850;});})['catch'](function(_0x273887){throw new db[(_0x2648('0x5f'))][(_0x2648('0x60'))](_0x273887[_0x2648('0x61')]);});}})[_0x2648('0x26')](handleEntityNotFound(_0x598c22,null))[_0x2648('0x26')](removeEntity(_0x598c22,null))[_0x2648('0x48')](handleError(_0x598c22,null));};exports[_0x2648('0x62')]=function(_0x34d115,_0x5486c9,_0x2176d4){return db[_0x2648('0x50')]['transaction'](function(_0xad9e99){var _0x44d565;return db['VoiceMusicOnHold'][_0x2648('0x4e')]({'where':{'id':_0x34d115['params']['id']}})[_0x2648('0x26')](function(_0x329267){if(_0x329267){_0x44d565=_0x329267;return _0x329267['addSound'](_0x34d115[_0x2648('0x4d')]['id'],{'transaction':_0xad9e99});}})[_0x2648('0x26')](function(_0x6f0e20){if(_0x6f0e20){return db[_0x2648('0x63')][_0x2648('0x64')]({'where':{'id':_0x34d115['body']['id']},'attributes':['id',_0x2648('0x2e'),'save_name',_0x2648('0x65'),_0x2648('0x66')],'raw':!![]});}})['then'](function(_0x26599d){if(_0x26599d){var _0x1f3134=path[_0x2648('0x53')](config[_0x2648('0x67')],_0x2648('0x68'),util[_0x2648('0x69')](_0x2648('0x6a'),path['basename'](_0x26599d[_0x2648('0x6b')],path[_0x2648('0x6c')](_0x26599d['save_name'])),_0x26599d['converted_format']));var _0x5b4f5b=path[_0x2648('0x53')](config[_0x2648('0x67')],'server/files/moh',_0x44d565[_0x2648('0x2e')],util[_0x2648('0x69')](_0x2648('0x6a'),_0x26599d[_0x2648('0x2e')],_0x26599d[_0x2648('0x65')]));fs[_0x2648('0x6d')](_0x1f3134,_0x5b4f5b);return _0x26599d;}})[_0x2648('0x48')](function(_0x8c9bc1){throw new db['Sequelize'][(_0x2648('0x60'))](_0x8c9bc1[_0x2648('0x61')]);});})[_0x2648('0x26')](handleEntityNotFound(_0x5486c9,null))[_0x2648('0x26')](respondWithResult(_0x5486c9,0xc9))['catch'](handleError(_0x5486c9,null));};exports['removeSound']=function(_0x5dd3f8,_0x175038,_0xdb2571){return db[_0x2648('0x50')][_0x2648('0x5c')](function(_0x560a4c){var _0x97cd75;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5dd3f8[_0x2648('0x4a')]['id']}})[_0x2648('0x26')](handleEntityNotFound(_0x175038,null))['then'](function(_0x3e224d){if(_0x3e224d){_0x97cd75=_0x3e224d;return _0x3e224d[_0x2648('0x6e')](_0x5dd3f8[_0x2648('0x4a')][_0x2648('0x6f')]);}})['then'](function(_0x329ee7){if(_0x329ee7){return db[_0x2648('0x63')]['findOne']({'where':{'id':_0x5dd3f8[_0x2648('0x4a')][_0x2648('0x6f')]},'attributes':['id',_0x2648('0x2e'),_0x2648('0x6b'),'converted_format',_0x2648('0x66')],'raw':!![]});}})[_0x2648('0x26')](function(_0x1073fd){if(_0x1073fd){fs[_0x2648('0x70')](path[_0x2648('0x53')](_0x97cd75['directory'],util[_0x2648('0x69')](_0x2648('0x6a'),_0x1073fd['name'],_0x1073fd[_0x2648('0x65')])));return _0x1073fd;}})[_0x2648('0x48')](function(_0x33e1a8){throw new db[(_0x2648('0x5f'))][(_0x2648('0x60'))](_0x33e1a8[_0x2648('0x61')]);});})['then'](handleEntityNotFound(_0x175038,null))[_0x2648('0x26')](respondWithStatusCode(_0x175038,0xcc))[_0x2648('0x48')](handleError(_0x175038,null));};exports[_0x2648('0x71')]=function(_0x4a7db5,_0x465125,_0x4e115a){var _0xc32cf9={};var _0x5e7fce={};var _0x2a5d58;var _0x18df05;return db[_0x2648('0x30')]['findOne']({'where':{'id':_0x4a7db5[_0x2648('0x4a')]['id']}})[_0x2648('0x26')](handleEntityNotFound(_0x465125,null))[_0x2648('0x26')](function(_0x17c391){if(_0x17c391){_0x2a5d58=_0x17c391;_0x5e7fce['model']=_['keys'](db[_0x2648('0x63')]['rawAttributes']);_0x5e7fce['query']=_[_0x2648('0x36')](_0x4a7db5['query']);_0x5e7fce[_0x2648('0x37')]=_[_0x2648('0x38')](_0x5e7fce[_0x2648('0x33')],_0x5e7fce[_0x2648('0x35')]);_0xc32cf9['attributes']=_[_0x2648('0x38')](_0x5e7fce['model'],qs[_0x2648('0x39')](_0x4a7db5[_0x2648('0x35')][_0x2648('0x39')]));_0xc32cf9[_0x2648('0x3a')]=_0xc32cf9['attributes']['length']?_0xc32cf9[_0x2648('0x3a')]:_0x5e7fce[_0x2648('0x33')];_0xc32cf9[_0x2648('0x3e')]=qs['sort'](_0x4a7db5[_0x2648('0x35')][_0x2648('0x3f')]);_0xc32cf9[_0x2648('0x40')]=qs[_0x2648('0x37')](_['pick'](_0x4a7db5['query'],_0x5e7fce['filters']));if(_0x4a7db5[_0x2648('0x35')][_0x2648('0x42')]){_0xc32cf9['where']=_['merge'](_0xc32cf9['where'],{'$or':_['map'](_0xc32cf9[_0x2648('0x3a')],function(_0x183193){var _0x2ba3b7={};_0x2ba3b7[_0x183193]={'$like':'%'+_0x4a7db5[_0x2648('0x35')][_0x2648('0x42')]+'%'};return _0x2ba3b7;})});}_0xc32cf9=_[_0x2648('0x43')]({},_0xc32cf9,_0x4a7db5[_0x2648('0x46')]);return _0x2a5d58[_0x2648('0x71')](_0xc32cf9);}})[_0x2648('0x26')](function(_0x505802){if(_0x505802){_0x18df05=_0x505802[_0x2648('0x3b')];if(!_0x4a7db5[_0x2648('0x35')][_0x2648('0x3c')](_0x2648('0x3d'))){_0xc32cf9[_0x2648('0x1f')]=qs['limit'](_0x4a7db5['query'][_0x2648('0x1f')]);_0xc32cf9[_0x2648('0x1e')]=qs[_0x2648('0x1e')](_0x4a7db5['query'][_0x2648('0x1e')]);}return _0x2a5d58[_0x2648('0x71')](_0xc32cf9);}})['then'](function(_0x222a48){if(_0x222a48){return _0x222a48?{'count':_0x18df05,'rows':_0x222a48}:null;}})['then'](respondWithResult(_0x465125,null))[_0x2648('0x48')](handleError(_0x465125,null));}; \ No newline at end of file +var _0xe704=['rows','fields','length','includeAll','include','find','catch','body','params','create','sequelize','transaction','mode','files','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','readdirSync','unlinkSync','join','rmdirSync','Sequelize','ValidationError','addSound','findOne','save_name','converted_format','createdAt','root','%s.%s','symlinkSync','removeSound','id2','format','message','getSounds','Sound','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','VoiceMusicOnHold','fieldName','key','model','map','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x51e79c,_0x51485e){var _0x2467be=function(_0xbf70f0){while(--_0xbf70f0){_0x51e79c['push'](_0x51e79c['shift']());}};_0x2467be(++_0x51485e);}(_0xe704,0x1cd));var _0x4e70=function(_0x173591,_0x559922){_0x173591=_0x173591-0x0;var _0x1b1233=_0xe704[_0x173591];return _0x1b1233;};'use strict';var emlformat=require(_0x4e70('0x0'));var rimraf=require(_0x4e70('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e70('0x2'));var rp=require(_0x4e70('0x3'));var moment=require(_0x4e70('0x4'));var BPromise=require(_0x4e70('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4e70('0x6'));var sox=require(_0x4e70('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e70('0x8'));var _=require(_0x4e70('0x9'));var squel=require(_0x4e70('0xa'));var crypto=require('crypto');var jsforce=require(_0x4e70('0xb'));var deskjs=require(_0x4e70('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e70('0xd'));var authService=require(_0x4e70('0xe'));var qs=require(_0x4e70('0xf'));var as=require(_0x4e70('0x10'));var hardwareService=require(_0x4e70('0x11'));var logger=require('../../config/logger')(_0x4e70('0x12'));var utils=require('../../config/utils');var config=require(_0x4e70('0x13'));var licenseUtil=require(_0x4e70('0x14'));var db=require(_0x4e70('0x15'))['db'];function respondWithStatusCode(_0x187259,_0x122f49){_0x122f49=_0x122f49||0xcc;return function(_0x30b338){if(_0x30b338){return _0x187259[_0x4e70('0x16')](_0x122f49);}return _0x187259[_0x4e70('0x17')](_0x122f49)[_0x4e70('0x18')]();};}function respondWithResult(_0x20098b,_0x5fb63b){_0x5fb63b=_0x5fb63b||0xc8;return function(_0x28f67f){if(_0x28f67f){return _0x20098b[_0x4e70('0x17')](_0x5fb63b)[_0x4e70('0x19')](_0x28f67f);}};}function respondWithFilteredResult(_0x21e7b2,_0x1d3711){return function(_0x4c4677){if(_0x4c4677){var _0x3f1468=typeof _0x1d3711[_0x4e70('0x1a')]===_0x4e70('0x1b')&&typeof _0x1d3711[_0x4e70('0x1c')]===_0x4e70('0x1b');var _0x2e0148=_0x4c4677[_0x4e70('0x1d')];var _0x455671=_0x3f1468?0x0:_0x1d3711['offset'];var _0x2dcb68=_0x3f1468?_0x4c4677[_0x4e70('0x1d')]:_0x1d3711['offset']+_0x1d3711[_0x4e70('0x1c')];var _0x32ecb8;if(_0x2dcb68>=_0x2e0148){_0x2dcb68=_0x2e0148;_0x32ecb8=0xc8;}else{_0x32ecb8=0xce;}_0x21e7b2[_0x4e70('0x17')](_0x32ecb8);return _0x21e7b2[_0x4e70('0x1e')](_0x4e70('0x1f'),_0x455671+'-'+_0x2dcb68+'/'+_0x2e0148)[_0x4e70('0x19')](_0x4c4677);}return null;};}function patchUpdates(_0x525d68){return function(_0x49434b){try{jsonpatch[_0x4e70('0x20')](_0x49434b,_0x525d68,!![]);}catch(_0x461695){return BPromise['reject'](_0x461695);}return _0x49434b[_0x4e70('0x21')]();};}function saveUpdates(_0x13956b,_0x13310d){return function(_0x2932df){if(_0x2932df){return _0x2932df[_0x4e70('0x22')](_0x13956b)[_0x4e70('0x23')](function(_0x1c4db8){return _0x1c4db8;});}return null;};}function removeEntity(_0x5a7e19,_0x188ed3){return function(_0x2657b8){if(_0x2657b8){return _0x2657b8[_0x4e70('0x24')]()[_0x4e70('0x23')](function(){var _0x5580c3=_0x2657b8[_0x4e70('0x25')]({'plain':!![]});var _0x26ede7=_0x4e70('0x26');return db[_0x4e70('0x27')][_0x4e70('0x24')]({'where':{'type':_0x26ede7,'resourceId':_0x5580c3['id']}})['then'](function(){return _0x2657b8;});})['then'](function(){_0x5a7e19[_0x4e70('0x17')](0xcc)[_0x4e70('0x18')]();});}};}function handleEntityNotFound(_0x2b68eb,_0x5ec4df){return function(_0x5176b7){if(!_0x5176b7){_0x2b68eb[_0x4e70('0x16')](0x194);}return _0x5176b7;};}function handleError(_0x2b6d89,_0x1d87f6){_0x1d87f6=_0x1d87f6||0x1f4;return function(_0x174bd5){logger[_0x4e70('0x28')](_0x174bd5[_0x4e70('0x29')]);if(_0x174bd5[_0x4e70('0x2a')]){delete _0x174bd5['name'];}_0x2b6d89[_0x4e70('0x17')](_0x1d87f6)['send'](_0x174bd5);};}exports['index']=function(_0x7156e0,_0x134a23){var _0xf2ee5={},_0x217bf7={},_0xa695c4={'count':0x0,'rows':[]};var _0x1cf367=_['map'](db[_0x4e70('0x2b')]['rawAttributes'],function(_0x86c0b3){return{'name':_0x86c0b3[_0x4e70('0x2c')],'type':_0x86c0b3['type'][_0x4e70('0x2d')]};});_0x217bf7[_0x4e70('0x2e')]=_[_0x4e70('0x2f')](_0x1cf367,'name');_0x217bf7[_0x4e70('0x30')]=_[_0x4e70('0x31')](_0x7156e0['query']);_0x217bf7[_0x4e70('0x32')]=_['intersection'](_0x217bf7[_0x4e70('0x2e')],_0x217bf7[_0x4e70('0x30')]);_0xf2ee5[_0x4e70('0x33')]=_[_0x4e70('0x34')](_0x217bf7['model'],qs['fields'](_0x7156e0[_0x4e70('0x30')]['fields']));_0xf2ee5[_0x4e70('0x33')]=_0xf2ee5[_0x4e70('0x33')]['length']?_0xf2ee5['attributes']:_0x217bf7['model'];if(!_0x7156e0['query'][_0x4e70('0x35')](_0x4e70('0x36'))){_0xf2ee5['limit']=qs[_0x4e70('0x1c')](_0x7156e0[_0x4e70('0x30')][_0x4e70('0x1c')]);_0xf2ee5[_0x4e70('0x1a')]=qs[_0x4e70('0x1a')](_0x7156e0[_0x4e70('0x30')][_0x4e70('0x1a')]);}_0xf2ee5[_0x4e70('0x37')]=qs['sort'](_0x7156e0[_0x4e70('0x30')][_0x4e70('0x38')]);delete _0x7156e0[_0x4e70('0x30')][_0x4e70('0x38')];_0xf2ee5[_0x4e70('0x39')]=qs['filters'](_[_0x4e70('0x3a')](_0x7156e0[_0x4e70('0x30')],_0x217bf7[_0x4e70('0x32')]),_0x1cf367);if(_0x7156e0[_0x4e70('0x30')][_0x4e70('0x3b')]){_0xf2ee5[_0x4e70('0x39')]=_[_0x4e70('0x3c')](_0xf2ee5[_0x4e70('0x39')],{'$or':_[_0x4e70('0x2f')](_0x1cf367,function(_0x311cb5){if(_0x311cb5[_0x4e70('0x3d')]!==_0x4e70('0x3e')){var _0x3d81f2={};_0x3d81f2[_0x311cb5[_0x4e70('0x2a')]]={'$like':'%'+_0x7156e0[_0x4e70('0x30')][_0x4e70('0x3b')]+'%'};return _0x3d81f2;}})});}_0xf2ee5=_[_0x4e70('0x3c')]({},_0xf2ee5,_0x7156e0[_0x4e70('0x3f')]);var _0x2106dd={'where':_0xf2ee5[_0x4e70('0x39')]};return db[_0x4e70('0x2b')][_0x4e70('0x1d')](_0x2106dd)[_0x4e70('0x23')](function(_0x4ac4b2){_0xa695c4[_0x4e70('0x1d')]=_0x4ac4b2;if(_0x7156e0[_0x4e70('0x30')]['includeAll']){_0xf2ee5['include']=[{'all':!![]}];}return db[_0x4e70('0x2b')]['findAll'](_0xf2ee5);})[_0x4e70('0x23')](function(_0xb1d88){_0xa695c4[_0x4e70('0x40')]=_0xb1d88;return _0xa695c4;})[_0x4e70('0x23')](respondWithFilteredResult(_0x134a23,_0xf2ee5))['catch'](handleError(_0x134a23,null));};exports['show']=function(_0x537ec7,_0x1c24aa){var _0x123ba1={'raw':![],'where':{'id':_0x537ec7['params']['id']}},_0x519195={};_0x519195[_0x4e70('0x2e')]=_[_0x4e70('0x31')](db['VoiceMusicOnHold']['rawAttributes']);_0x519195[_0x4e70('0x30')]=_[_0x4e70('0x31')](_0x537ec7['query']);_0x519195[_0x4e70('0x32')]=_[_0x4e70('0x34')](_0x519195['model'],_0x519195[_0x4e70('0x30')]);_0x123ba1[_0x4e70('0x33')]=_[_0x4e70('0x34')](_0x519195[_0x4e70('0x2e')],qs[_0x4e70('0x41')](_0x537ec7[_0x4e70('0x30')][_0x4e70('0x41')]));_0x123ba1[_0x4e70('0x33')]=_0x123ba1['attributes'][_0x4e70('0x42')]?_0x123ba1[_0x4e70('0x33')]:_0x519195['model'];if(_0x537ec7['query'][_0x4e70('0x43')]){_0x123ba1[_0x4e70('0x44')]=[{'all':!![]}];}_0x123ba1=_[_0x4e70('0x3c')]({},_0x123ba1,_0x537ec7[_0x4e70('0x3f')]);return db['VoiceMusicOnHold'][_0x4e70('0x45')](_0x123ba1)['then'](handleEntityNotFound(_0x1c24aa,null))[_0x4e70('0x23')](respondWithResult(_0x1c24aa,null))[_0x4e70('0x46')](handleError(_0x1c24aa,null));};exports[_0x4e70('0x22')]=function(_0x1d26e1,_0x36b958){if(_0x1d26e1[_0x4e70('0x47')]['id']){delete _0x1d26e1[_0x4e70('0x47')]['id'];}return db[_0x4e70('0x2b')]['find']({'where':{'id':_0x1d26e1[_0x4e70('0x48')]['id']}})['then'](handleEntityNotFound(_0x36b958,null))[_0x4e70('0x23')](saveUpdates(_0x1d26e1[_0x4e70('0x47')],null))[_0x4e70('0x23')](respondWithResult(_0x36b958,null))[_0x4e70('0x46')](handleError(_0x36b958,null));};exports[_0x4e70('0x49')]=function(_0x96756d,_0x17c4e1,_0x55f67b){return db[_0x4e70('0x4a')][_0x4e70('0x4b')](function(_0x4b5734){if(_0x96756d[_0x4e70('0x47')][_0x4e70('0x4c')]===_0x4e70('0x4d')){_0x96756d[_0x4e70('0x47')]['directory']=path['join'](config['root'],'server/files/moh',_0x96756d['body']['name']);}return db[_0x4e70('0x2b')]['create'](_0x96756d['body'],{'transaction':_0x4b5734})[_0x4e70('0x23')](function(_0x41fdf2){if(_0x96756d[_0x4e70('0x47')]['mode']===_0x4e70('0x4d')){fs['mkdirSync'](_0x41fdf2[_0x4e70('0x4e')],parseInt('0777',0x8));}var _0x33bb07=_0x96756d[_0x4e70('0x4f')][_0x4e70('0x25')]({'plain':!![]});if(!_0x33bb07)throw new Error(_0x4e70('0x50'));if(_0x33bb07[_0x4e70('0x51')]===_0x4e70('0x4f')){var _0x1ed6c8=_0x41fdf2[_0x4e70('0x25')]({'plain':!![]});return db[_0x4e70('0x52')][_0x4e70('0x45')]({'where':{'name':_0x4e70('0x26'),'userProfileId':_0x33bb07[_0x4e70('0x53')]},'raw':!![]})[_0x4e70('0x23')](function(_0x3f5c7c){if(_0x3f5c7c&&_0x3f5c7c[_0x4e70('0x54')]===0x0){return db[_0x4e70('0x27')]['create']({'name':_0x1ed6c8[_0x4e70('0x2a')],'resourceId':_0x1ed6c8['id'],'type':_0x3f5c7c[_0x4e70('0x2a')],'sectionId':_0x3f5c7c['id']},{})[_0x4e70('0x23')](function(){return _0x41fdf2;});}else{return _0x41fdf2;}})[_0x4e70('0x46')](function(_0x22f46f){logger[_0x4e70('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22f46f);});}return _0x41fdf2;});})['then'](respondWithResult(_0x17c4e1,0xc9))[_0x4e70('0x46')](handleError(_0x17c4e1,null));};exports['destroy']=function(_0x3bf7b0,_0x386a74,_0x22eb19){var _0x4c5e3d;return db[_0x4e70('0x2b')][_0x4e70('0x45')]({'where':{'id':_0x3bf7b0[_0x4e70('0x48')]['id']}})[_0x4e70('0x23')](function(_0x2eccb7){if(_0x2eccb7){return db[_0x4e70('0x4a')]['transaction'](function(_0x517bf6){return _0x2eccb7[_0x4e70('0x24')]({'transaction':_0x517bf6,'raw':!![]})[_0x4e70('0x23')](function(_0x1962d5){if(_0x1962d5['directory']){fs[_0x4e70('0x55')](_0x1962d5[_0x4e70('0x4e')])['forEach'](function(_0x2b370e){fs[_0x4e70('0x56')](path[_0x4e70('0x57')](_0x1962d5['directory'],_0x2b370e));});fs[_0x4e70('0x58')](_0x1962d5['directory']);}return _0x1962d5;});})[_0x4e70('0x46')](function(_0x49c2f8){throw new db[(_0x4e70('0x59'))][(_0x4e70('0x5a'))](_0x49c2f8['message']);});}})[_0x4e70('0x23')](handleEntityNotFound(_0x386a74,null))['then'](removeEntity(_0x386a74,null))[_0x4e70('0x46')](handleError(_0x386a74,null));};exports[_0x4e70('0x5b')]=function(_0x3cef2c,_0x5b4781,_0x2310a3){return db['sequelize'][_0x4e70('0x4b')](function(_0x3a459e){var _0x43a3c5;return db[_0x4e70('0x2b')][_0x4e70('0x45')]({'where':{'id':_0x3cef2c['params']['id']}})[_0x4e70('0x23')](function(_0x11af13){if(_0x11af13){_0x43a3c5=_0x11af13;return _0x11af13[_0x4e70('0x5b')](_0x3cef2c[_0x4e70('0x47')]['id'],{'transaction':_0x3a459e});}})[_0x4e70('0x23')](function(_0x26a96d){if(_0x26a96d){return db['Sound'][_0x4e70('0x5c')]({'where':{'id':_0x3cef2c[_0x4e70('0x47')]['id']},'attributes':['id',_0x4e70('0x2a'),_0x4e70('0x5d'),_0x4e70('0x5e'),_0x4e70('0x5f')],'raw':!![]});}})[_0x4e70('0x23')](function(_0x16f2d1){if(_0x16f2d1){var _0x198a0f=path[_0x4e70('0x57')](config[_0x4e70('0x60')],'server/files/sounds/converted',util['format'](_0x4e70('0x61'),path['basename'](_0x16f2d1['save_name'],path['extname'](_0x16f2d1['save_name'])),_0x16f2d1[_0x4e70('0x5e')]));var _0x5bebc3=path[_0x4e70('0x57')](config['root'],'server/files/moh',_0x43a3c5[_0x4e70('0x2a')],util['format'](_0x4e70('0x61'),_0x16f2d1[_0x4e70('0x2a')],_0x16f2d1[_0x4e70('0x5e')]));fs[_0x4e70('0x62')](_0x198a0f,_0x5bebc3);return _0x16f2d1;}})[_0x4e70('0x46')](function(_0x1337a3){throw new db['Sequelize'][(_0x4e70('0x5a'))](_0x1337a3['message']);});})['then'](handleEntityNotFound(_0x5b4781,null))[_0x4e70('0x23')](respondWithResult(_0x5b4781,0xc9))['catch'](handleError(_0x5b4781,null));};exports[_0x4e70('0x63')]=function(_0x31b47c,_0x325184,_0x5c19e6){return db[_0x4e70('0x4a')][_0x4e70('0x4b')](function(_0x46b028){var _0x3ffbd9;return db[_0x4e70('0x2b')]['findOne']({'where':{'id':_0x31b47c[_0x4e70('0x48')]['id']}})[_0x4e70('0x23')](handleEntityNotFound(_0x325184,null))[_0x4e70('0x23')](function(_0x559d73){if(_0x559d73){_0x3ffbd9=_0x559d73;return _0x559d73[_0x4e70('0x63')](_0x31b47c[_0x4e70('0x48')][_0x4e70('0x64')]);}})[_0x4e70('0x23')](function(_0x4ce7f4){if(_0x4ce7f4){return db['Sound']['findOne']({'where':{'id':_0x31b47c[_0x4e70('0x48')][_0x4e70('0x64')]},'attributes':['id',_0x4e70('0x2a'),_0x4e70('0x5d'),_0x4e70('0x5e'),_0x4e70('0x5f')],'raw':!![]});}})[_0x4e70('0x23')](function(_0x3cd50c){if(_0x3cd50c){fs[_0x4e70('0x56')](path[_0x4e70('0x57')](_0x3ffbd9[_0x4e70('0x4e')],util[_0x4e70('0x65')](_0x4e70('0x61'),_0x3cd50c['name'],_0x3cd50c[_0x4e70('0x5e')])));return _0x3cd50c;}})['catch'](function(_0x5c53b9){throw new db[(_0x4e70('0x59'))]['ValidationError'](_0x5c53b9[_0x4e70('0x66')]);});})[_0x4e70('0x23')](handleEntityNotFound(_0x325184,null))[_0x4e70('0x23')](respondWithStatusCode(_0x325184,0xcc))[_0x4e70('0x46')](handleError(_0x325184,null));};exports[_0x4e70('0x67')]=function(_0x383b50,_0x5aede0,_0xf62adc){var _0x3f6589={};var _0x3b2f1c={};var _0x2da862;var _0x5e129b;return db['VoiceMusicOnHold'][_0x4e70('0x5c')]({'where':{'id':_0x383b50[_0x4e70('0x48')]['id']}})[_0x4e70('0x23')](handleEntityNotFound(_0x5aede0,null))[_0x4e70('0x23')](function(_0x2ff769){if(_0x2ff769){_0x2da862=_0x2ff769;_0x3b2f1c[_0x4e70('0x2e')]=_[_0x4e70('0x31')](db[_0x4e70('0x68')]['rawAttributes']);_0x3b2f1c[_0x4e70('0x30')]=_['keys'](_0x383b50[_0x4e70('0x30')]);_0x3b2f1c[_0x4e70('0x32')]=_[_0x4e70('0x34')](_0x3b2f1c[_0x4e70('0x2e')],_0x3b2f1c['query']);_0x3f6589['attributes']=_['intersection'](_0x3b2f1c[_0x4e70('0x2e')],qs['fields'](_0x383b50[_0x4e70('0x30')]['fields']));_0x3f6589[_0x4e70('0x33')]=_0x3f6589['attributes'][_0x4e70('0x42')]?_0x3f6589[_0x4e70('0x33')]:_0x3b2f1c[_0x4e70('0x2e')];_0x3f6589[_0x4e70('0x37')]=qs[_0x4e70('0x38')](_0x383b50['query']['sort']);_0x3f6589[_0x4e70('0x39')]=qs['filters'](_['pick'](_0x383b50[_0x4e70('0x30')],_0x3b2f1c[_0x4e70('0x32')]));if(_0x383b50[_0x4e70('0x30')][_0x4e70('0x3b')]){_0x3f6589[_0x4e70('0x39')]=_['merge'](_0x3f6589[_0x4e70('0x39')],{'$or':_['map'](_0x3f6589[_0x4e70('0x33')],function(_0x3b0c51){var _0x4b4336={};_0x4b4336[_0x3b0c51]={'$like':'%'+_0x383b50[_0x4e70('0x30')][_0x4e70('0x3b')]+'%'};return _0x4b4336;})});}_0x3f6589=_['merge']({},_0x3f6589,_0x383b50[_0x4e70('0x3f')]);return _0x2da862[_0x4e70('0x67')](_0x3f6589);}})[_0x4e70('0x23')](function(_0xdc585d){if(_0xdc585d){_0x5e129b=_0xdc585d[_0x4e70('0x42')];if(!_0x383b50[_0x4e70('0x30')]['hasOwnProperty'](_0x4e70('0x36'))){_0x3f6589[_0x4e70('0x1c')]=qs[_0x4e70('0x1c')](_0x383b50[_0x4e70('0x30')]['limit']);_0x3f6589[_0x4e70('0x1a')]=qs[_0x4e70('0x1a')](_0x383b50[_0x4e70('0x30')][_0x4e70('0x1a')]);}return _0x2da862[_0x4e70('0x67')](_0x3f6589);}})['then'](function(_0x4ab0ee){if(_0x4ab0ee){return _0x4ab0ee?{'count':_0x5e129b,'rows':_0x4ab0ee}:null;}})[_0x4e70('0x23')](respondWithResult(_0x5aede0,null))['catch'](handleError(_0x5aede0,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 98de0d6..aa4a008 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 _0x03a7=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x03a7,0x121));var _0x703a=function(_0x51ffa0,_0xd23c02){_0x51ffa0=_0x51ffa0-0x0;var _0x459e5d=_0x03a7[_0x51ffa0];return _0x459e5d;};'use strict';var _=require(_0x703a('0x0'));var util=require(_0x703a('0x1'));var logger=require('../../config/logger')(_0x703a('0x2'));var moment=require(_0x703a('0x3'));var BPromise=require(_0x703a('0x4'));var rp=require(_0x703a('0x5'));var fs=require('fs');var path=require(_0x703a('0x6'));var rimraf=require(_0x703a('0x7'));var config=require(_0x703a('0x8'));var attributes=require(_0x703a('0x9'));module[_0x703a('0xa')]=function(_0x16cdbf,_0x3b6eb8){return _0x16cdbf[_0x703a('0xb')](_0x703a('0xc'),attributes,{'tableName':_0x703a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3bdb=['api','moment','request-promise','path','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x3bdb,0x173));var _0xb3bd=function(_0x5ce0e5,_0xe794f0){_0x5ce0e5=_0x5ce0e5-0x0;var _0x3f99fc=_0x3bdb[_0x5ce0e5];return _0x3f99fc;};'use strict';var _=require(_0xb3bd('0x0'));var util=require(_0xb3bd('0x1'));var logger=require(_0xb3bd('0x2'))(_0xb3bd('0x3'));var moment=require(_0xb3bd('0x4'));var BPromise=require('bluebird');var rp=require(_0xb3bd('0x5'));var fs=require('fs');var path=require(_0xb3bd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb3bd('0x7'));module['exports']=function(_0x54a099,_0x12ae3c){return _0x54a099[_0xb3bd('0x8')](_0xb3bd('0x9'),attributes,{'tableName':_0xb3bd('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 9565b39..787b7b2 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x1d7a18,_0x2bb312){var _0x495f4a=function(_0x5ccfe5){while(--_0x5ccfe5){_0x1d7a18['push'](_0x1d7a18['shift']());}};_0x495f4a(++_0x2bb312);}(_0xedd9,0xfc));var _0x9edd=function(_0x106748,_0x27ebee){_0x106748=_0x106748-0x0;var _0x359346=_0xedd9[_0x106748];return _0x359346;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x1589da,_0x520f28){var _0x2df507=function(_0x2ff4cc){while(--_0x2ff4cc){_0x1589da['push'](_0x1589da['shift']());}};_0x2df507(++_0x520f28);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0xcb91[_0x270adf];return _0x29eda9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a731f4f..aef2cc5 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 _0xb701=['/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','destroy','delete','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0xb701,0x144));var _0x1b70=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xb701[_0x199572];return _0x13cfa3;};'use strict';var multer=require('multer');var util=require(_0x1b70('0x0'));var path=require('path');var timeout=require(_0x1b70('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b70('0x2'));var auth=require(_0x1b70('0x3'));var interaction=require(_0x1b70('0x4'));var config=require(_0x1b70('0x5'));var controller=require(_0x1b70('0x6'));router[_0x1b70('0x7')]('/',auth[_0x1b70('0x8')](),controller[_0x1b70('0x9')]);router[_0x1b70('0x7')](_0x1b70('0xa'),auth['isAuthenticated'](),controller[_0x1b70('0xb')]);router[_0x1b70('0x7')](_0x1b70('0xc'),auth[_0x1b70('0x8')](),controller[_0x1b70('0xd')]);router[_0x1b70('0x7')](_0x1b70('0xe'),auth['isAuthenticated'](),controller[_0x1b70('0xf')]);router[_0x1b70('0x7')](_0x1b70('0x10'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x11')]);router[_0x1b70('0x12')]('/',auth[_0x1b70('0x8')](),controller[_0x1b70('0x13')]);router[_0x1b70('0x12')](_0x1b70('0xe'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x14')]);router[_0x1b70('0x12')]('/:id/teams',auth[_0x1b70('0x8')](),controller[_0x1b70('0x15')]);router[_0x1b70('0x16')](_0x1b70('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1b70('0xc'),auth[_0x1b70('0x8')](),controller[_0x1b70('0x17')]);router[_0x1b70('0x18')](_0x1b70('0xe'),auth[_0x1b70('0x8')](),controller['removeAgents']);router[_0x1b70('0x18')](_0x1b70('0x10'),auth[_0x1b70('0x8')](),controller['removeTeams']);module[_0x1b70('0x19')]=router; \ No newline at end of file +var _0xf569=['addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','/describe','get','/:id','/:id/users','/:id/teams','post'];(function(_0x5a6dcd,_0x39fb72){var _0x4900a7=function(_0x147a39){while(--_0x147a39){_0x5a6dcd['push'](_0x5a6dcd['shift']());}};_0x4900a7(++_0x39fb72);}(_0xf569,0xd0));var _0x9f56=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xf569[_0x599e60];return _0x468e19;};'use strict';var multer=require('multer');var util=require(_0x9f56('0x0'));var path=require(_0x9f56('0x1'));var timeout=require(_0x9f56('0x2'));var express=require(_0x9f56('0x3'));var router=express[_0x9f56('0x4')]();var fs_extra=require(_0x9f56('0x5'));var auth=require(_0x9f56('0x6'));var interaction=require(_0x9f56('0x7'));var config=require('../../config/environment');var controller=require(_0x9f56('0x8'));router['get']('/',auth[_0x9f56('0x9')](),controller[_0x9f56('0xa')]);router['get'](_0x9f56('0xb'),auth[_0x9f56('0x9')](),controller['describe']);router[_0x9f56('0xc')](_0x9f56('0xd'),auth[_0x9f56('0x9')](),controller['show']);router['get'](_0x9f56('0xe'),auth[_0x9f56('0x9')](),controller['getAgents']);router[_0x9f56('0xc')](_0x9f56('0xf'),auth[_0x9f56('0x9')](),controller['getTeams']);router['post']('/',auth[_0x9f56('0x9')](),controller['create']);router[_0x9f56('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0x9f56('0x11')]);router[_0x9f56('0x10')]('/:id/teams',auth[_0x9f56('0x9')](),controller[_0x9f56('0x12')]);router[_0x9f56('0x13')](_0x9f56('0xd'),auth[_0x9f56('0x9')](),controller[_0x9f56('0x14')]);router[_0x9f56('0x15')](_0x9f56('0xd'),auth[_0x9f56('0x9')](),controller[_0x9f56('0x16')]);router[_0x9f56('0x15')](_0x9f56('0xe'),auth[_0x9f56('0x9')](),controller[_0x9f56('0x17')]);router[_0x9f56('0x15')](_0x9f56('0xf'),auth[_0x9f56('0x9')](),controller[_0x9f56('0x18')]);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 2e8cef3..ca74561 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 _0x2e79=['name','sequelize','exports','STRING','VIRTUAL','system-','getDataValue'];(function(_0x321518,_0x363ba6){var _0x47f043=function(_0x50b800){while(--_0x50b800){_0x321518['push'](_0x321518['shift']());}};_0x47f043(++_0x363ba6);}(_0x2e79,0x78));var _0x92e7=function(_0x34d3f8,_0x8a2283){_0x34d3f8=_0x34d3f8-0x0;var _0x3e9532=_0x2e79[_0x34d3f8];return _0x3e9532;};'use strict';var Sequelize=require(_0x92e7('0x0'));module[_0x92e7('0x1')]={'name':{'type':Sequelize[_0x92e7('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x92e7('0x3')],'get':function(_0x5e2ba2){return _0x92e7('0x4')+this[_0x92e7('0x5')](_0x92e7('0x6'))+'-';}},'description':{'type':Sequelize[_0x92e7('0x2')]},'callerIdAll':{'type':Sequelize[_0x92e7('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3251=['VIRTUAL','system-','INTEGER','sequelize','exports','STRING','name'];(function(_0x2fb812,_0x34ab89){var _0x469ae7=function(_0x1c8022){while(--_0x1c8022){_0x2fb812['push'](_0x2fb812['shift']());}};_0x469ae7(++_0x34ab89);}(_0x3251,0x65));var _0x1325=function(_0x4f348b,_0x23a6d7){_0x4f348b=_0x4f348b-0x0;var _0x59ea7f=_0x3251[_0x4f348b];return _0x59ea7f;};'use strict';var Sequelize=require(_0x1325('0x0'));module[_0x1325('0x1')]={'name':{'type':Sequelize[_0x1325('0x2')],'allowNull':![],'unique':_0x1325('0x3')},'prefix':{'type':Sequelize[_0x1325('0x4')],'get':function(_0x394a28){return _0x1325('0x5')+this['getDataValue'](_0x1325('0x3'))+'-';}},'description':{'type':Sequelize[_0x1325('0x2')]},'callerIdAll':{'type':Sequelize[_0x1325('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x1325('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index e8410b2..f7032bc 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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xda2d,0x102));var _0xdda2=function(_0x3e9399,_0x5a8f82){_0x3e9399=_0x3e9399-0x0;var _0x1c42cb=_0xda2d[_0x3e9399];return _0x1c42cb;};'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 _0x2272=['Voice\x20Prefix\x20Extension','priority','NoOp','VoicePrefixId','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','goto','context','${EXTEN:','charAt','update','system-','findById','addAgents','ids','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','User','order','pick','getTeams','findOne','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','select','field','tq.TeamId','from','team_has_voice_prefixes','join','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','SELECT','every','TeamId','includes','all','union','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','system','description'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x2272,0xd8));var _0x2227=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2272[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x2227('0x0'));var rimraf=require(_0x2227('0x1'));var zipdir=require(_0x2227('0x2'));var jsonpatch=require(_0x2227('0x3'));var rp=require(_0x2227('0x4'));var moment=require('moment');var BPromise=require(_0x2227('0x5'));var Mustache=require(_0x2227('0x6'));var util=require(_0x2227('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2227('0x8'));var ejs=require(_0x2227('0x9'));var fs=require('fs');var fs_extra=require(_0x2227('0xa'));var _=require(_0x2227('0xb'));var squel=require(_0x2227('0xc'));var crypto=require(_0x2227('0xd'));var jsforce=require(_0x2227('0xe'));var deskjs=require(_0x2227('0xf'));var toCsv=require(_0x2227('0x8'));var querystring=require(_0x2227('0x10'));var Papa=require('papaparse');var Redis=require(_0x2227('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2227('0x12'));var as=require(_0x2227('0x13'));var hardwareService=require(_0x2227('0x14'));var logger=require(_0x2227('0x15'))(_0x2227('0x16'));var utils=require('../../config/utils');var config=require(_0x2227('0x17'));var licenseUtil=require(_0x2227('0x18'));var db=require(_0x2227('0x19'))['db'];config[_0x2227('0x1a')]=_[_0x2227('0x1b')](config[_0x2227('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2227('0x1c'))['register'](socket);function respondWithStatusCode(_0x42f60b,_0xb631b0){_0xb631b0=_0xb631b0||0xcc;return function(_0x510b09){if(_0x510b09){return _0x42f60b[_0x2227('0x1d')](_0xb631b0);}return _0x42f60b[_0x2227('0x1e')](_0xb631b0)[_0x2227('0x1f')]();};}function respondWithResult(_0x43e174,_0x42a93c){_0x42a93c=_0x42a93c||0xc8;return function(_0x1e78a8){if(_0x1e78a8){return _0x43e174['status'](_0x42a93c)[_0x2227('0x20')](_0x1e78a8);}};}function respondWithFilteredResult(_0x1cf016,_0x162723){return function(_0x531f75){if(_0x531f75){var _0x11bf80=typeof _0x162723[_0x2227('0x21')]===_0x2227('0x22')&&typeof _0x162723[_0x2227('0x23')]===_0x2227('0x22');var _0x28e642=_0x531f75[_0x2227('0x24')];var _0x4e0bba=_0x11bf80?0x0:_0x162723[_0x2227('0x21')];var _0x59f988=_0x11bf80?_0x531f75[_0x2227('0x24')]:_0x162723[_0x2227('0x21')]+_0x162723[_0x2227('0x23')];var _0x1f28ef;if(_0x59f988>=_0x28e642){_0x59f988=_0x28e642;_0x1f28ef=0xc8;}else{_0x1f28ef=0xce;}_0x1cf016[_0x2227('0x1e')](_0x1f28ef);return _0x1cf016[_0x2227('0x25')](_0x2227('0x26'),_0x4e0bba+'-'+_0x59f988+'/'+_0x28e642)[_0x2227('0x20')](_0x531f75);}return null;};}function patchUpdates(_0x3299fd){return function(_0x34c090){try{jsonpatch[_0x2227('0x27')](_0x34c090,_0x3299fd,!![]);}catch(_0x5a454f){return BPromise[_0x2227('0x28')](_0x5a454f);}return _0x34c090[_0x2227('0x29')]();};}function saveUpdates(_0x5b3a09,_0x2cef4b){return function(_0xbfdce1){if(_0xbfdce1){return _0xbfdce1['update'](_0x5b3a09)['then'](function(_0x17c7a4){return _0x17c7a4;});}return null;};}function removeEntity(_0xa4d18b,_0x35333f){return function(_0x1f30c3){if(_0x1f30c3){return _0x1f30c3['destroy']()[_0x2227('0x2a')](function(){var _0x301304=_0x1f30c3[_0x2227('0x2b')]({'plain':!![]});var _0x1957ee='VoicePrefixes';return db[_0x2227('0x2c')][_0x2227('0x2d')]({'where':{'type':_0x1957ee,'resourceId':_0x301304['id']}})[_0x2227('0x2a')](function(){return _0x1f30c3;});})[_0x2227('0x2a')](function(){_0xa4d18b[_0x2227('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55015e,_0x5d1d56){return function(_0x2dc38d){if(!_0x2dc38d){_0x55015e['sendStatus'](0x194);}return _0x2dc38d;};}function handleError(_0x2ba581,_0x1979d8){_0x1979d8=_0x1979d8||0x1f4;return function(_0x58609e){logger['error'](_0x58609e[_0x2227('0x2e')]);if(_0x58609e[_0x2227('0x2f')]){delete _0x58609e[_0x2227('0x2f')];}_0x2ba581['status'](_0x1979d8)[_0x2227('0x30')](_0x58609e);};}exports['index']=function(_0xaa2bbb,_0x3f108b){var _0x28ad1c={},_0xfa2140={},_0x155095={'count':0x0,'rows':[]};var _0x256b7b=_[_0x2227('0x31')](db[_0x2227('0x32')][_0x2227('0x33')],function(_0x781f79){return{'name':_0x781f79[_0x2227('0x34')],'type':_0x781f79['type'][_0x2227('0x35')]};});_0xfa2140[_0x2227('0x36')]=_[_0x2227('0x31')](_0x256b7b,_0x2227('0x2f'));_0xfa2140['query']=_[_0x2227('0x37')](_0xaa2bbb[_0x2227('0x38')]);_0xfa2140[_0x2227('0x39')]=_[_0x2227('0x3a')](_0xfa2140['model'],_0xfa2140[_0x2227('0x38')]);_0x28ad1c[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0xfa2140['model'],qs['fields'](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x3c')]));_0x28ad1c['attributes']=_0x28ad1c[_0x2227('0x3b')][_0x2227('0x3d')]?_0x28ad1c['attributes']:_0xfa2140[_0x2227('0x36')];if(!_0xaa2bbb['query'][_0x2227('0x3e')](_0x2227('0x3f'))){_0x28ad1c[_0x2227('0x23')]=qs[_0x2227('0x23')](_0xaa2bbb['query'][_0x2227('0x23')]);_0x28ad1c['offset']=qs[_0x2227('0x21')](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x21')]);}_0x28ad1c['order']=qs[_0x2227('0x40')](_0xaa2bbb[_0x2227('0x38')][_0x2227('0x40')]);_0x28ad1c[_0x2227('0x41')]=qs[_0x2227('0x39')](_['pick'](_0xaa2bbb['query'],_0xfa2140[_0x2227('0x39')]),_0x256b7b);if(_0xaa2bbb['query'][_0x2227('0x42')]){_0x28ad1c[_0x2227('0x41')]=_[_0x2227('0x43')](_0x28ad1c[_0x2227('0x41')],{'$or':_[_0x2227('0x31')](_0x256b7b,function(_0xd08cd8){if(_0xd08cd8[_0x2227('0x44')]!==_0x2227('0x45')){var _0x5688b5={};_0x5688b5[_0xd08cd8[_0x2227('0x2f')]]={'$like':'%'+_0xaa2bbb['query'][_0x2227('0x42')]+'%'};return _0x5688b5;}})});}_0x28ad1c=_['merge']({},_0x28ad1c,_0xaa2bbb[_0x2227('0x46')]);var _0x59afc0={'where':_0x28ad1c[_0x2227('0x41')]};return db['VoicePrefix'][_0x2227('0x24')](_0x59afc0)[_0x2227('0x2a')](function(_0x46eb0f){_0x155095[_0x2227('0x24')]=_0x46eb0f;if(_0xaa2bbb[_0x2227('0x38')][_0x2227('0x47')]){_0x28ad1c['include']=[{'all':!![]}];}return db['VoicePrefix'][_0x2227('0x48')](_0x28ad1c);})['then'](function(_0x3552db){_0x155095['rows']=_0x3552db;return _0x155095;})[_0x2227('0x2a')](respondWithFilteredResult(_0x3f108b,_0x28ad1c))[_0x2227('0x49')](handleError(_0x3f108b,null));};exports[_0x2227('0x4a')]=function(_0xa3ae06,_0x3f9787){var _0x2871a6={'raw':![],'where':{'id':_0xa3ae06[_0x2227('0x4b')]['id']}},_0x5f5880={};_0x5f5880[_0x2227('0x36')]=_[_0x2227('0x37')](db[_0x2227('0x32')][_0x2227('0x33')]);_0x5f5880[_0x2227('0x38')]=_[_0x2227('0x37')](_0xa3ae06[_0x2227('0x38')]);_0x5f5880['filters']=_[_0x2227('0x3a')](_0x5f5880[_0x2227('0x36')],_0x5f5880[_0x2227('0x38')]);_0x2871a6[_0x2227('0x3b')]=_['intersection'](_0x5f5880[_0x2227('0x36')],qs[_0x2227('0x3c')](_0xa3ae06['query'][_0x2227('0x3c')]));_0x2871a6[_0x2227('0x3b')]=_0x2871a6[_0x2227('0x3b')][_0x2227('0x3d')]?_0x2871a6[_0x2227('0x3b')]:_0x5f5880[_0x2227('0x36')];if(_0xa3ae06[_0x2227('0x38')]['includeAll']){_0x2871a6[_0x2227('0x4c')]=[{'all':!![]}];}_0x2871a6=_[_0x2227('0x43')]({},_0x2871a6,_0xa3ae06['options']);return db[_0x2227('0x32')]['find'](_0x2871a6)[_0x2227('0x2a')](handleEntityNotFound(_0x3f9787,null))[_0x2227('0x2a')](respondWithResult(_0x3f9787,null))[_0x2227('0x49')](handleError(_0x3f9787,null));};exports[_0x2227('0x2d')]=function(_0x5387fc,_0x4e12c7){return db['VoicePrefix'][_0x2227('0x4d')]({'where':{'id':_0x5387fc[_0x2227('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4e12c7,null))[_0x2227('0x2a')](removeEntity(_0x4e12c7,null))[_0x2227('0x49')](handleError(_0x4e12c7,null));};exports[_0x2227('0x4e')]=function(_0x39166b,_0x4ee23c){return db['VoicePrefix'][_0x2227('0x4e')]()[_0x2227('0x2a')](respondWithResult(_0x4ee23c,null))[_0x2227('0x49')](handleError(_0x4ee23c,null));};exports[_0x2227('0x4f')]=function(_0x597f00,_0x26581d){var _0x443933;return db[_0x2227('0x50')][_0x2227('0x51')](function(_0x125fa8){return db[_0x2227('0x32')][_0x2227('0x4f')](_0x597f00[_0x2227('0x52')],{'transaction':_0x125fa8})[_0x2227('0x2a')](function(_0x418ec4){_0x443933=_0x418ec4[_0x2227('0x2b')]({'plain':!![]});return db[_0x2227('0x53')][_0x2227('0x4d')]({'where':{'id':_0x443933[_0x2227('0x54')]},'raw':!![]})[_0x2227('0x2a')](function(_0x10c21a){return createVoicePrefixExtensions(_0x443933,_0x10c21a,_0x125fa8);});});})['then'](function(){var _0xc176c9=_0x597f00[_0x2227('0x55')]['get']({'plain':!![]});if(!_0xc176c9)throw new Error(_0x2227('0x56'));if(_0xc176c9[_0x2227('0x57')]===_0x2227('0x55')){var _0x4e8622=_0x443933;return db['UserProfileSection']['find']({'where':{'name':_0x2227('0x58'),'userProfileId':_0xc176c9[_0x2227('0x59')]},'raw':!![]})['then'](function(_0x2171b1){if(_0x2171b1&&_0x2171b1[_0x2227('0x5a')]===0x0){return db[_0x2227('0x2c')]['create']({'name':_0x4e8622[_0x2227('0x2f')],'resourceId':_0x4e8622['id'],'type':_0x2171b1[_0x2227('0x2f')],'sectionId':_0x2171b1['id']},{})['then'](function(){return _0x443933;});}else{return _0x443933;}})[_0x2227('0x49')](function(_0x1f02be){logger['error'](_0x2227('0x5b'),_0x1f02be);throw _0x1f02be;});}return _0x443933;})[_0x2227('0x2a')](respondWithResult(_0x26581d,null))[_0x2227('0x49')](handleError(_0x26581d,null));};function Extension(_0x1ab7e0,_0x300741,_0x118225,_0x52861f){this['context']=_0x2227('0x5c');this['exten']=_0x1ab7e0;this[_0x2227('0x5d')]=_0x118225;this['type']=_0x2227('0x5e');this[_0x2227('0x5f')]=_0x2227('0x60');this[_0x2227('0x61')]=_0x300741;this['appdata']=_0x52861f;}function createVoicePrefixExtensions(_0x44a025,_0x41359a,_0x10df84){return new BPromise(function(_0x1ec0db,_0x30fbd8){var _0x4fdb8d=new Extension(formatPrefixName(_0x44a025['prefix']),0x1,_0x2227('0x62'),'Voice\x20Prefix');_0x4fdb8d[_0x2227('0x63')]=_0x44a025['id'];return db[_0x2227('0x53')]['create'](_0x4fdb8d,{'transaction':_0x10df84})['then'](function(_0x1aa091){var _0x335798=_0x1aa091[_0x2227('0x2b')]({'plain':!![]});var _0x2f6d49=_[_0x2227('0x31')](addVoicePrefixExtensions(_0x44a025,_0x41359a),function(_0x119d39){_0x119d39[_0x2227('0x54')]=_0x335798['id'];_0x119d39[_0x2227('0x63')]=_0x44a025['id'];return _0x119d39;});return db[_0x2227('0x53')]['bulkCreate'](_0x2f6d49,{'transaction':_0x10df84})[_0x2227('0x2a')](function(_0x1d0e87){if(!_0x1d0e87){return _0x30fbd8('Extensions\x20creation\x20failed');}else{return _0x1ec0db(_0x1d0e87);}})[_0x2227('0x49')](function(_0x108605){return _0x30fbd8(_0x108605);});});;});};function addVoicePrefixExtensions(_0x1b2634,_0x5a41d9){var _0x215fb2=[];var _0xfa23f1=formatPrefixName(_0x1b2634[_0x2227('0x64')]);_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x2,_0x2227('0x66'),_0x2227('0x67')+_0x1b2634[_0x2227('0x2f')]));if(_0x1b2634[_0x2227('0x68')]){_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x3,_0x2227('0x66'),_0x2227('0x69')+_0x1b2634[_0x2227('0x68')]));}else{_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x3,_0x2227('0x62'),'No\x20callerid\x20available'));}_0x215fb2[_0x2227('0x65')](new Extension(_0xfa23f1,0x4,_0x2227('0x6a'),_0x5a41d9[_0x2227('0x6b')]+','+_0x2227('0x6c')+(0x8+_0x1b2634[_0x2227('0x2f')][_0x2227('0x3d')])+'}'+','+0x1));return _0x215fb2;}function formatPrefixName(_0x1e7779){var _0x4633d8='_';for(var _0x4e0ca2=0x0;_0x4e0ca2<_0x1e7779[_0x2227('0x3d')];_0x4e0ca2++){if(_0x1e7779[_0x2227('0x6d')](_0x4e0ca2)=='-'){_0x4633d8+=_0x1e7779[_0x2227('0x6d')](_0x4e0ca2);}else{_0x4633d8+='['+_0x1e7779['charAt'](_0x4e0ca2)+']';}}_0x4633d8+='.';return _0x4633d8;}exports[_0x2227('0x6e')]=function(_0x4258a3,_0x24b5b0,_0x5bd233){var _0x398d76=_0x4258a3['body'];_0x398d76[_0x2227('0x64')]=_0x2227('0x6f')+_0x398d76[_0x2227('0x2f')]+'-';return db[_0x2227('0x50')]['transaction'](function(_0x3a34d8){return db[_0x2227('0x32')]['update'](_0x398d76,{'where':{'id':_0x398d76['id']},'transaction':_0x3a34d8})['then'](function(){return db[_0x2227('0x53')][_0x2227('0x2d')]({'where':{'VoicePrefixId':_0x398d76['id']},'transaction':_0x3a34d8})[_0x2227('0x2a')](function(){return db[_0x2227('0x53')][_0x2227('0x4d')]({'where':{'id':_0x398d76[_0x2227('0x54')]},'raw':!![]})[_0x2227('0x2a')](function(_0x36a85a){return createVoicePrefixExtensions(_0x398d76,_0x36a85a,_0x3a34d8);});});});})['then'](function(){return db[_0x2227('0x32')][_0x2227('0x70')](_0x398d76['id']);})[_0x2227('0x2a')](respondWithResult(_0x24b5b0,null))['catch'](handleError(_0x24b5b0,null));};exports['addAgents']=function(_0x5147fe,_0xf3038b,_0x57b27a){return db[_0x2227('0x32')][_0x2227('0x4d')]({'where':{'id':_0x5147fe[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0xf3038b,null))[_0x2227('0x2a')](function(_0x2435d0){if(_0x2435d0){return _0x2435d0[_0x2227('0x71')](_0x5147fe[_0x2227('0x52')][_0x2227('0x72')],_['omit'](_0x5147fe[_0x2227('0x52')],[_0x2227('0x72'),'id'])||{})[_0x2227('0x73')](function(_0x58e3ee){for(var _0x22a30f=0x0;_0x22a30f<_0x5147fe[_0x2227('0x52')]['ids']['length'];_0x22a30f+=0x1){socket[_0x2227('0x74')]('userVoicePrefix:save',{'UserId':Number(_0x5147fe[_0x2227('0x52')][_0x2227('0x72')][_0x22a30f]),'VoicePrefixId':Number(_0x5147fe[_0x2227('0x4b')]['id'])});}return _0x58e3ee;});}})[_0x2227('0x2a')](respondWithResult(_0xf3038b,null))[_0x2227('0x49')](handleError(_0xf3038b,null));};exports['removeAgents']=function(_0x9b431a,_0x128e74,_0x770f98){return db[_0x2227('0x32')]['find']({'where':{'id':_0x9b431a[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x128e74,null))['then'](function(_0x5af36d){if(_0x5af36d){return _0x5af36d[_0x2227('0x75')](_0x9b431a[_0x2227('0x38')][_0x2227('0x72')])['then'](function(){if(_['isArray'](_0x9b431a[_0x2227('0x38')][_0x2227('0x72')])){for(var _0x13cd17=0x0;_0x13cd17<_0x9b431a[_0x2227('0x38')]['ids']['length'];_0x13cd17+=0x1){socket[_0x2227('0x74')]('userVoicePrefix:remove',{'UserId':Number(_0x9b431a[_0x2227('0x38')][_0x2227('0x72')][_0x13cd17]),'VoicePrefixId':Number(_0x9b431a[_0x2227('0x4b')]['id'])});}}else{socket['emit'](_0x2227('0x76'),{'UserId':Number(_0x9b431a['query'][_0x2227('0x72')]),'VoicePrefixId':Number(_0x9b431a[_0x2227('0x4b')]['id'])});}});}})[_0x2227('0x2a')](respondWithStatusCode(_0x128e74,null))[_0x2227('0x49')](handleError(_0x128e74,null));};exports[_0x2227('0x77')]=function(_0x190760,_0x2eea42,_0x9364ec){var _0x50c689={};var _0x266f3b={};var _0x3e2219;var _0x1f0fc8;return db['VoicePrefix']['findOne']({'where':{'id':_0x190760[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x2eea42,null))[_0x2227('0x2a')](function(_0x5daa8b){if(_0x5daa8b){_0x3e2219=_0x5daa8b;_0x266f3b[_0x2227('0x36')]=_['keys'](db[_0x2227('0x78')]['rawAttributes']);_0x266f3b[_0x2227('0x38')]=_[_0x2227('0x37')](_0x190760['query']);_0x266f3b[_0x2227('0x39')]=_[_0x2227('0x3a')](_0x266f3b[_0x2227('0x36')],_0x266f3b[_0x2227('0x38')]);_0x50c689[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0x266f3b['model'],qs['fields'](_0x190760[_0x2227('0x38')][_0x2227('0x3c')]));_0x50c689[_0x2227('0x3b')]=_0x50c689[_0x2227('0x3b')]['length']?_0x50c689['attributes']:_0x266f3b[_0x2227('0x36')];_0x50c689[_0x2227('0x79')]=qs[_0x2227('0x40')](_0x190760['query']['sort']);_0x50c689[_0x2227('0x41')]=qs[_0x2227('0x39')](_[_0x2227('0x7a')](_0x190760[_0x2227('0x38')],_0x266f3b[_0x2227('0x39')]));if(_0x190760[_0x2227('0x38')][_0x2227('0x42')]){_0x50c689[_0x2227('0x41')]=_[_0x2227('0x43')](_0x50c689['where'],{'$or':_['map'](_0x50c689[_0x2227('0x3b')],function(_0x5732e5){var _0x5f1ade={};_0x5f1ade[_0x5732e5]={'$like':'%'+_0x190760[_0x2227('0x38')]['filter']+'%'};return _0x5f1ade;})});}_0x50c689=_[_0x2227('0x43')]({},_0x50c689,_0x190760[_0x2227('0x46')]);return _0x3e2219['getAgents'](_0x50c689);}})[_0x2227('0x2a')](function(_0x3174ef){if(_0x3174ef){_0x1f0fc8=_0x3174ef[_0x2227('0x3d')];if(!_0x190760['query'][_0x2227('0x3e')]('nolimit')){_0x50c689['limit']=qs[_0x2227('0x23')](_0x190760['query'][_0x2227('0x23')]);_0x50c689[_0x2227('0x21')]=qs[_0x2227('0x21')](_0x190760['query'][_0x2227('0x21')]);}return _0x3e2219[_0x2227('0x77')](_0x50c689);}})[_0x2227('0x2a')](function(_0x467380){if(_0x467380){return _0x467380?{'count':_0x1f0fc8,'rows':_0x467380}:null;}})['then'](respondWithResult(_0x2eea42,null))['catch'](handleError(_0x2eea42,null));};exports[_0x2227('0x7b')]=function(_0x3b653f,_0x35c9ea,_0x2e4a1b){var _0x4cd27e={};var _0x1a2852={};var _0x4599ab;var _0x3d592a;return db[_0x2227('0x32')][_0x2227('0x7c')]({'where':{'id':_0x3b653f[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](handleEntityNotFound(_0x35c9ea,null))['then'](function(_0x524e6a){if(_0x524e6a){_0x4599ab=_0x524e6a;_0x1a2852[_0x2227('0x36')]=_[_0x2227('0x37')](db['Team'][_0x2227('0x33')]);_0x1a2852[_0x2227('0x38')]=_[_0x2227('0x37')](_0x3b653f[_0x2227('0x38')]);_0x1a2852['filters']=_[_0x2227('0x3a')](_0x1a2852['model'],_0x1a2852['query']);_0x4cd27e[_0x2227('0x3b')]=_[_0x2227('0x3a')](_0x1a2852[_0x2227('0x36')],qs[_0x2227('0x3c')](_0x3b653f[_0x2227('0x38')][_0x2227('0x3c')]));_0x4cd27e[_0x2227('0x3b')]=_0x4cd27e[_0x2227('0x3b')][_0x2227('0x3d')]?_0x4cd27e['attributes']:_0x1a2852[_0x2227('0x36')];_0x4cd27e[_0x2227('0x79')]=qs[_0x2227('0x40')](_0x3b653f[_0x2227('0x38')][_0x2227('0x40')]);_0x4cd27e['where']=qs[_0x2227('0x39')](_['pick'](_0x3b653f[_0x2227('0x38')],_0x1a2852[_0x2227('0x39')]));if(_0x3b653f[_0x2227('0x38')][_0x2227('0x42')]){_0x4cd27e[_0x2227('0x41')]=_[_0x2227('0x43')](_0x4cd27e[_0x2227('0x41')],{'$or':_[_0x2227('0x31')](_0x4cd27e['attributes'],function(_0x1686d7){var _0x30101f={};_0x30101f[_0x1686d7]={'$like':'%'+_0x3b653f[_0x2227('0x38')]['filter']+'%'};return _0x30101f;})});}_0x4cd27e=_[_0x2227('0x43')]({},_0x4cd27e,_0x3b653f[_0x2227('0x46')]);return _0x4599ab['getTeams'](_0x4cd27e);}})[_0x2227('0x2a')](function(_0x386b5d){if(_0x386b5d){_0x3d592a=_0x386b5d['length'];if(!_0x3b653f[_0x2227('0x38')][_0x2227('0x3e')](_0x2227('0x3f'))){_0x4cd27e[_0x2227('0x23')]=qs[_0x2227('0x23')](_0x3b653f[_0x2227('0x38')][_0x2227('0x23')]);_0x4cd27e[_0x2227('0x21')]=qs['offset'](_0x3b653f[_0x2227('0x38')][_0x2227('0x21')]);}return _0x4599ab[_0x2227('0x7b')](_0x4cd27e);}})[_0x2227('0x2a')](function(_0x172b34){if(_0x172b34){return _0x172b34?{'count':_0x3d592a,'rows':_0x172b34}:null;}})[_0x2227('0x2a')](respondWithResult(_0x35c9ea,null))['catch'](handleError(_0x35c9ea,null));};exports[_0x2227('0x7d')]=function(_0x2ffe4f,_0x28d3ca,_0x20def8){var _0x42787b=_0x2ffe4f[_0x2227('0x52')][_0x2227('0x72')];var _0x2cf763;return db[_0x2227('0x7e')][_0x2227('0x48')]({'where':{'id':_0x42787b},'attributes':['id'],'include':[{'model':db[_0x2227('0x78')],'as':_0x2227('0x7f'),'attributes':['id','name',_0x2227('0x80'),_0x2227('0x81'),_0x2227('0x82')],'raw':!![]}]})[_0x2227('0x2a')](function(_0x43af43){if(_0x43af43){_0x2cf763=_0x43af43;var _0x1766e5=_[_0x2227('0x83')](_0x43af43,function(_0x2fdf17){var _0x38e805=_0x2fdf17[_0x2227('0x2b')]({'plain':!![]});return _0x38e805['Agents'];});return db[_0x2227('0x32')][_0x2227('0x4d')]({'where':{'id':_0x2ffe4f[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](function(_0x2fdc19){return db[_0x2227('0x50')][_0x2227('0x51')](function(_0x3f7d5d){return _0x2fdc19['addTeams'](_0x42787b,{'transaction':_0x3f7d5d})[_0x2227('0x2a')](function(){return BPromise[_0x2227('0x84')](_0x2cf763,function(_0x36492d){return db['TeamVoicePrefix'][_0x2227('0x85')]({'TeamId':_0x36492d['id'],'VoicePrefixId':_0x2ffe4f[_0x2227('0x4b')]['id']},{'transaction':_0x3f7d5d});});})['then'](function(){return BPromise[_0x2227('0x84')](_0x1766e5,function(_0x2fb89b){return db[_0x2227('0x86')][_0x2227('0x87')]({'where':{'UserId':_0x2fb89b['id'],'VoicePrefixId':_0x2ffe4f[_0x2227('0x4b')]['id']},'transaction':_0x3f7d5d});});})['then'](function(){_0x1766e5[_0x2227('0x88')](function(_0x12fabe){socket[_0x2227('0x74')](_0x2227('0x89'),{'UserId':_0x12fabe['id'],'VoicePrefixId':_0x2fdc19['id']});});});});});}})[_0x2227('0x2a')](respondWithStatusCode(_0x28d3ca,null))['catch'](handleError(_0x28d3ca,null));};exports['removeTeams']=function(_0x2e153f,_0x312033,_0x1c557d){return db['Team']['findAll']({'where':{'id':_0x2e153f['query'][_0x2227('0x72')]},'attributes':['id'],'include':[{'model':db[_0x2227('0x78')],'as':_0x2227('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x2227('0x2a')](handleEntityNotFound(_0x312033,null))[_0x2227('0x2a')](function(_0x3e5597){var _0x3f58d2=_['map'](_0x3e5597,'id');var _0x2930e9=[];var _0x4505ab=[];var _0x2824b1=squel[_0x2227('0x8a')]();_0x2824b1[_0x2227('0x8b')](_0x2227('0x8c'))[_0x2227('0x8d')](_0x2227('0x8e'),'tq')[_0x2227('0x8f')]('user_has_teams','ut',_0x2227('0x90'))[_0x2227('0x41')](_0x2227('0x91'),_0x2e153f[_0x2227('0x4b')]['id']);for(var _0x3b5b07=0x0;_0x3b5b07<_0x3e5597[_0x2227('0x3d')];_0x3b5b07+=0x1){let _0x19608d=_0x3e5597[_0x3b5b07];for(var _0x5008cc=0x0;_0x5008cc<_0x19608d[_0x2227('0x7f')][_0x2227('0x3d')];_0x5008cc+=0x1){let _0x15b3c4=_0x19608d[_0x2227('0x7f')][_0x5008cc];var _0x1a0805=_0x2824b1[_0x2227('0x92')]();_0x1a0805[_0x2227('0x41')]('ut.UserId\x20=\x20?',_0x15b3c4['id']);_0x4505ab[_0x2227('0x65')](db[_0x2227('0x50')][_0x2227('0x38')](_0x1a0805[_0x2227('0x93')](),{'type':db[_0x2227('0x50')]['QueryTypes'][_0x2227('0x94')]})[_0x2227('0x2a')](function(_0x4f822c){if(_0x4f822c['length']===0x1){return _0x15b3c4['id'];}else{var _0x1bab79=_[_0x2227('0x95')](_[_0x2227('0x31')](_0x4f822c,_0x2227('0x96')),function(_0x26c479){return _[_0x2227('0x97')](_0x3f58d2,_0x26c479);});if(_0x1bab79){return _0x15b3c4['id'];}}}));}}return BPromise[_0x2227('0x98')](_0x4505ab)['then'](function(_0x54db70){_0x2930e9=_(_0x2930e9)[_0x2227('0x99')](_0x54db70)['compact']()['value']();return db[_0x2227('0x32')][_0x2227('0x4d')]({'where':{'id':_0x2e153f[_0x2227('0x4b')]['id']}})[_0x2227('0x2a')](function(_0x152b89){return db[_0x2227('0x50')]['transaction'](function(_0x360f72){return _0x152b89[_0x2227('0x9a')](_0x2e153f['query'][_0x2227('0x72')],{'transaction':_0x360f72})[_0x2227('0x2a')](function(){if(!_[_0x2227('0x9b')](_0x2930e9)){return _0x152b89[_0x2227('0x75')](_0x2930e9,{'transaction':_0x360f72});}})[_0x2227('0x2a')](function(){_0x2930e9[_0x2227('0x88')](function(_0x66aa39){socket[_0x2227('0x74')](_0x2227('0x76'),{'UserId':_0x66aa39,'VoicePrefixId':_0x152b89['id']});});});});});});})[_0x2227('0x2a')](respondWithStatusCode(_0x312033,null))['catch'](handleError(_0x312033,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 72fb95a..a6a62ae 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 _0xe66f=['VoicePrefix','setMaxListeners','save','update','remove','emit','events','../../mysqldb'];(function(_0x1f5d35,_0x13db91){var _0x27355a=function(_0x1a3932){while(--_0x1a3932){_0x1f5d35['push'](_0x1f5d35['shift']());}};_0x27355a(++_0x13db91);}(_0xe66f,0x18e));var _0xfe66=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xe66f[_0x5a776b];return _0xbbef59;};'use strict';var EventEmitter=require(_0xfe66('0x0'));var VoicePrefix=require(_0xfe66('0x1'))['db'][_0xfe66('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xfe66('0x3')](0x0);var events={'afterCreate':_0xfe66('0x4'),'afterUpdate':_0xfe66('0x5'),'afterDestroy':_0xfe66('0x6')};function emitEvent(_0x3d5b9d){return function(_0x590e45,_0x16a4e3,_0x46e770){VoicePrefixEvents[_0xfe66('0x7')](_0x3d5b9d+':'+_0x590e45['id'],_0x590e45);VoicePrefixEvents[_0xfe66('0x7')](_0x3d5b9d,_0x590e45);_0x46e770(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x2756=['../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x2756,0x116));var _0x6275=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x2756[_0x5519a9];return _0x32f2cc;};'use strict';var EventEmitter=require(_0x6275('0x0'));var VoicePrefix=require(_0x6275('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6275('0x2')](0x0);var events={'afterCreate':_0x6275('0x3'),'afterUpdate':_0x6275('0x4'),'afterDestroy':_0x6275('0x5')};function emitEvent(_0x4d2e31){return function(_0x433add,_0x3a8479,_0x4079f7){VoicePrefixEvents['emit'](_0x4d2e31+':'+_0x433add['id'],_0x433add);VoicePrefixEvents['emit'](_0x4d2e31,_0x433add);_0x4079f7(null);};}for(var e in events){if(events[_0x6275('0x6')](e)){var event=events[e];VoicePrefix[_0x6275('0x7')](e,emitEvent(event));}}module[_0x6275('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 4300708..59e1fc8 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 _0xd20c=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoicePrefix','lodash'];(function(_0x2215d2,_0x563782){var _0x2bb13a=function(_0x1bb042){while(--_0x1bb042){_0x2215d2['push'](_0x2215d2['shift']());}};_0x2bb13a(++_0x563782);}(_0xd20c,0x1df));var _0xcd20=function(_0xe8a0f0,_0x21e7ed){_0xe8a0f0=_0xe8a0f0-0x0;var _0x343380=_0xd20c[_0xe8a0f0];return _0x343380;};'use strict';var _=require(_0xcd20('0x0'));var util=require('util');var logger=require(_0xcd20('0x1'))('api');var moment=require(_0xcd20('0x2'));var BPromise=require(_0xcd20('0x3'));var rp=require(_0xcd20('0x4'));var fs=require('fs');var path=require(_0xcd20('0x5'));var rimraf=require(_0xcd20('0x6'));var config=require(_0xcd20('0x7'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x10f049,_0x5d4a8e){return _0x10f049[_0xcd20('0x8')](_0xcd20('0x9'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7318=['VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x3d08ba,_0x15a535){var _0x3b4764=function(_0x57430c){while(--_0x57430c){_0x3d08ba['push'](_0x3d08ba['shift']());}};_0x3b4764(++_0x15a535);}(_0x7318,0x1f0));var _0x8731=function(_0x371974,_0x463561){_0x371974=_0x371974-0x0;var _0x10122c=_0x7318[_0x371974];return _0x10122c;};'use strict';var _=require(_0x8731('0x0'));var util=require(_0x8731('0x1'));var logger=require(_0x8731('0x2'))(_0x8731('0x3'));var moment=require(_0x8731('0x4'));var BPromise=require(_0x8731('0x5'));var rp=require(_0x8731('0x6'));var fs=require('fs');var path=require(_0x8731('0x7'));var rimraf=require('rimraf');var config=require(_0x8731('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x8731('0x9')]=function(_0x45f2e0,_0x451d0b){return _0x45f2e0[_0x8731('0xa')](_0x8731('0xb'),attributes,{'tableName':_0x8731('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 80df989..28d246d 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 _0x565e=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','moment','bluebird'];(function(_0x579e8e,_0x5d8200){var _0xb9b51c=function(_0x16ac0f){while(--_0x16ac0f){_0x579e8e['push'](_0x579e8e['shift']());}};_0xb9b51c(++_0x5d8200);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe565('0x0'));var util=require('util');var moment=require(_0xe565('0x1'));var BPromise=require(_0xe565('0x2'));var rs=require(_0xe565('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe565('0x4'));var logger=require(_0xe565('0x5'))(_0xe565('0x6'));var config=require(_0xe565('0x7'));var jayson=require(_0xe565('0x8'));var client=jayson[_0xe565('0x9')][_0xe565('0xa')]({'port':0x232a});config[_0xe565('0xb')]=_[_0xe565('0xc')](config[_0xe565('0xb')],{'host':_0xe565('0xd'),'port':0x18eb});var socket=require(_0xe565('0xe'))(new Redis(config[_0xe565('0xb')]));require(_0xe565('0xf'))[_0xe565('0x10')](socket);function respondWithRpcPromise(_0x41640f,_0x5b82c1,_0x3dd4dc){return new BPromise(function(_0x36c827,_0x9fd021){return client['request'](_0x41640f,_0x3dd4dc)[_0xe565('0x11')](function(_0x9f674){logger[_0xe565('0x12')](_0xe565('0x13'),_0x5b82c1,'request\x20sent');logger[_0xe565('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x5b82c1,_0xe565('0x15'),JSON['stringify'](_0x9f674));if(_0x9f674[_0xe565('0x16')]){if(_0x9f674[_0xe565('0x16')][_0xe565('0x17')]===0x1f4){logger['error'](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x9fd021(_0x9f674[_0xe565('0x16')]['message']);}logger[_0xe565('0x16')](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x36c827(_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);}else{logger['info'](_0xe565('0x13'),_0x5b82c1,_0xe565('0x15'));_0x36c827(_0x9f674[_0xe565('0x19')][_0xe565('0x18')]);}})['catch'](function(_0x403f94){logger[_0xe565('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x5b82c1,_0x403f94);_0x9fd021(_0x403f94);});});} \ No newline at end of file +var _0x1a85=['catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2d204c,_0x3a3b9d){var _0xf760d6=function(_0x4c28b4){while(--_0x4c28b4){_0x2d204c['push'](_0x2d204c['shift']());}};_0xf760d6(++_0x3a3b9d);}(_0x1a85,0x178));var _0x51a8=function(_0x45081a,_0x3ae384){_0x45081a=_0x45081a-0x0;var _0x55bfe2=_0x1a85[_0x45081a];return _0x55bfe2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});config['redis']=_[_0x51a8('0x8')](config[_0x51a8('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x51a8('0xa'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x51a8('0xb')](socket);function respondWithRpcPromise(_0x2f276b,_0x1a476d,_0x45a3f4){return new BPromise(function(_0x418f06,_0x421fa4){return client[_0x51a8('0xc')](_0x2f276b,_0x45a3f4)[_0x51a8('0xd')](function(_0x34c887){logger[_0x51a8('0xe')](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));logger[_0x51a8('0x11')](_0x51a8('0x12'),_0x1a476d,_0x51a8('0x10'),JSON[_0x51a8('0x13')](_0x34c887));if(_0x34c887[_0x51a8('0x14')]){if(_0x34c887['error'][_0x51a8('0x15')]===0x1f4){logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887['error'][_0x51a8('0x16')]);return _0x421fa4(_0x34c887['error'][_0x51a8('0x16')]);}logger[_0x51a8('0x14')](_0x51a8('0xf'),_0x1a476d,_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);return _0x418f06(_0x34c887[_0x51a8('0x14')][_0x51a8('0x16')]);}else{logger['info'](_0x51a8('0xf'),_0x1a476d,_0x51a8('0x10'));_0x418f06(_0x34c887[_0x51a8('0x17')][_0x51a8('0x16')]);}})[_0x51a8('0x18')](function(_0x544886){logger['error'](_0x51a8('0xf'),_0x1a476d,_0x544886);_0x421fa4(_0x544886);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index aa09ada..e4e5175 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 _0x8fcf=['length','./voicePrefix.events','save','remove','removeListener','register'];(function(_0x35d2d6,_0x14e944){var _0x1637d5=function(_0x327b04){while(--_0x327b04){_0x35d2d6['push'](_0x35d2d6['shift']());}};_0x1637d5(++_0x14e944);}(_0x8fcf,0x1db));var _0xf8fc=function(_0x143ee8,_0x5b3419){_0x143ee8=_0x143ee8-0x0;var _0x440682=_0x8fcf[_0x143ee8];return _0x440682;};'use strict';var VoicePrefixEvents=require(_0xf8fc('0x0'));var events=[_0xf8fc('0x1'),_0xf8fc('0x2'),'update'];function createListener(_0x18da9a,_0x5ac9b3){return function(_0x5d623e){_0x5ac9b3['emit'](_0x18da9a,_0x5d623e);};}function removeListener(_0x33afd1,_0x2a5191){return function(){VoicePrefixEvents[_0xf8fc('0x3')](_0x33afd1,_0x2a5191);};}exports[_0xf8fc('0x4')]=function(_0x33fdc1){for(var _0x292131=0x0,_0x1448de=events[_0xf8fc('0x5')];_0x292131<_0x1448de;_0x292131++){var _0x59c401=events[_0x292131];var _0x13c2a7=createListener('voicePrefix:'+_0x59c401,_0x33fdc1);VoicePrefixEvents['on'](_0x59c401,_0x13c2a7);}}; \ No newline at end of file +var _0x7834=['voicePrefix:','./voicePrefix.events','update','emit','removeListener','register'];(function(_0x10a903,_0x5b6073){var _0x1c0ea7=function(_0x5d996c){while(--_0x5d996c){_0x10a903['push'](_0x10a903['shift']());}};_0x1c0ea7(++_0x5b6073);}(_0x7834,0x13f));var _0x4783=function(_0x4b77a4,_0x238eef){_0x4b77a4=_0x4b77a4-0x0;var _0x434550=_0x7834[_0x4b77a4];return _0x434550;};'use strict';var VoicePrefixEvents=require(_0x4783('0x0'));var events=['save','remove',_0x4783('0x1')];function createListener(_0x51b60a,_0x15dbb4){return function(_0x30c3ee){_0x15dbb4[_0x4783('0x2')](_0x51b60a,_0x30c3ee);};}function removeListener(_0x2ebef6,_0x29566c){return function(){VoicePrefixEvents[_0x4783('0x3')](_0x2ebef6,_0x29566c);};}exports[_0x4783('0x4')]=function(_0x49114c){for(var _0x1cb674=0x0,_0xf8c030=events['length'];_0x1cb674<_0xf8c030;_0x1cb674++){var _0x2dcf46=events[_0x1cb674];var _0x16c83e=createListener(_0x4783('0x5')+_0x2dcf46,_0x49114c);VoicePrefixEvents['on'](_0x2dcf46,_0x16c83e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 9974754..56f3e26 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 _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(_0x11b8ae,_0x485fa8){var _0x35a448=function(_0x188a5b){while(--_0x188a5b){_0x11b8ae['push'](_0x11b8ae['shift']());}};_0x35a448(++_0x485fa8);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e5a0c,_0x3a16fc){_0x1e5a0c=_0x1e5a0c-0x0;var _0x5cc15b=_0xb10b[_0x1e5a0c];return _0x5cc15b;};'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 +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(_0x4c6c46,_0x4d5b50){var _0x4eca5e=function(_0x2478b3){while(--_0x2478b3){_0x4c6c46['push'](_0x4c6c46['shift']());}};_0x4eca5e(++_0x4d5b50);}(_0xb10b,0x12a));var _0xbb10=function(_0x1bfec9,_0x2a863a){_0x1bfec9=_0x1bfec9-0x0;var _0x35cb18=_0xb10b[_0x1bfec9];return _0x35cb18;};'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 c4a1dc7..c7eb6d3 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 _0x5e88=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','name','inbound','outbound','STRING','ENUM','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','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)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x462d3e,_0x232378){var _0x2c29eb=function(_0x28f1fb){while(--_0x28f1fb){_0x462d3e['push'](_0x462d3e['shift']());}};_0x2c29eb(++_0x232378);}(_0x5e88,0xb2));var _0x85e8=function(_0x388971,_0x1cf6ab){_0x388971=_0x388971-0x0;var _0x5ca8dd=_0x5e88[_0x388971];return _0x5ca8dd;};'use strict';var Sequelize=require(_0x85e8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x85e8('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x85e8('0x2'),_0x85e8('0x3')),'allowNull':![],'defaultValue':_0x85e8('0x2')},'musiconhold':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x85e8('0x5')]('rr','ringall',_0x85e8('0x6'),_0x85e8('0x7'),_0x85e8('0x8'),_0x85e8('0x9'),_0x85e8('0xa'),_0x85e8('0xb'),_0x85e8('0xc')),'allowNull':![],'defaultValue':_0x85e8('0xd'),'set':function(_0x4c9de6){this[_0x85e8('0xe')](_0x85e8('0xf'),_0x4c9de6?_0x4c9de6:_0x85e8('0x9'));},'get':function(){var _0x58629a=this[_0x85e8('0x10')](_0x85e8('0x11'));var _0x46b496=this['getDataValue'](_0x85e8('0x12'));var _0x5227ee=this[_0x85e8('0x10')](_0x85e8('0xf'));if(_0x58629a==='inbound'){return _0x5227ee;}if(_0x46b496===_0x85e8('0x13')&&_0x5227ee===_0x85e8('0x9')||_0x46b496===_0x85e8('0x13')&&_0x5227ee==='roundrobin'){return _0x5227ee;}if(_0x46b496==='progressive'||_0x46b496===_0x85e8('0x14')||_0x46b496===_0x85e8('0x15')){return _0x5227ee;}return null;}},'servicelevel':{'type':Sequelize[_0x85e8('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x85e8('0x16')](0xb)},'timeout':{'type':Sequelize[_0x85e8('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x85e8('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x85e8('0x4')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x85e8('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x17'),'no'),'defaultValue':_0x85e8('0x17')},'autopause':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x17'),'no',_0x85e8('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x85e8('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x85e8('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x85e8('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x85e8('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x85e8('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x85e8('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x85e8('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x17'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x85e8('0x5')]('yes','no',_0x85e8('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x85e8('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x85e8('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x85e8('0x4')]},'queue_youarenext':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x85e8('0x4')]},'queue_quantity2':{'type':Sequelize[_0x85e8('0x4')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x85e8('0x4')]},'periodic_announce':{'type':Sequelize[_0x85e8('0x1a')],'set':function(_0x3eb6be){this['setDataValue'](_0x85e8('0x1b'),_0x3eb6be?_0x3eb6be['join'](','):[]);},'get':function(){return this[_0x85e8('0x10')]('periodic_announce')?this[_0x85e8('0x10')](_0x85e8('0x1b'))[_0x85e8('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':_0x85e8('0x17'),'set':function(_0x5f1670){this[_0x85e8('0xe')](_0x85e8('0x1d'),_0x5f1670?_0x5f1670[_0x85e8('0x1e')](','):undefined);},'get':function(){return this[_0x85e8('0x10')](_0x85e8('0x1d'))?this[_0x85e8('0x10')](_0x85e8('0x1d'))[_0x85e8('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':'no','set':function(_0x17b5d1){this[_0x85e8('0xe')]('leavewhenempty',_0x17b5d1?_0x17b5d1[_0x85e8('0x1e')](','):undefined);},'get':function(){return this[_0x85e8('0x10')](_0x85e8('0x1f'))?this[_0x85e8('0x10')](_0x85e8('0x1f'))[_0x85e8('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x85e8('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x85e8('0x4')]},'description':{'type':Sequelize[_0x85e8('0x4')]},'acw':{'type':Sequelize[_0x85e8('0x20')],'defaultValue':0x0,'set':function(_0x1c8eb7){this[_0x85e8('0xe')]('acw',_0x1c8eb7);if(_0x1c8eb7){if(this[_0x85e8('0x10')](_0x85e8('0x21'))<0x2){this[_0x85e8('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x85e8('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x85e8('0x20')],'defaultValue':0x0,'comment':_0x85e8('0x22')},'dialMethod':{'type':Sequelize[_0x85e8('0x5')]('preview',_0x85e8('0x23'),'power',_0x85e8('0x14'),'booked'),'defaultValue':_0x85e8('0x23'),'comment':_0x85e8('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x85e8('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x85e8('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x85e8('0x26')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x85e8('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x85e8('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x85e8('0x5')]('agentBusyFactor',_0x85e8('0x28')),'defaultValue':_0x85e8('0x28'),'comment':_0x85e8('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x85e8('0x2a')](0x2)[_0x85e8('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x85e8('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x85e8('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x85e8('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x85e8('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':_0x85e8('0x2e'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x85e8('0x2f')},'dialQueueProject':{'type':Sequelize[_0x85e8('0x4')],'comment':_0x85e8('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x85e8('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x85e8('0x16')](0x5)[_0x85e8('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x85e8('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x85e8('0x16')](0x5)[_0x85e8('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x85e8('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'defaultValue':0x3,'comment':_0x85e8('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x85e8('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x85e8('0x35')},'dialTimezone':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x85e8('0x4')],'defaultValue':_0x85e8('0x36')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x85e8('0x5')](_0x85e8('0x37'),_0x85e8('0x38'),_0x85e8('0x39')),'defaultValue':_0x85e8('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x85e8('0x3a')},'dialAMDInitialSilence':{'type':Sequelize[_0x85e8('0x16')](0x9)[_0x85e8('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x85e8('0x3b')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x85e8('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x85e8('0x16')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x85e8('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x85e8('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x85e8('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x85e8('0x16')](0x9)[_0x85e8('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x85e8('0x16')](0x9)[_0x85e8('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x85e8('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x85e8('0x16')](0x9)[_0x85e8('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x85e8('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x85e8('0x16')](0x5)[_0x85e8('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x85e8('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x85e8('0x16')](0x5)[_0x85e8('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x85e8('0x41')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x85e8('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x85e8('0x43'),_0x85e8('0x44')),'defaultValue':_0x85e8('0x43')},'dialQueueProject2':{'type':Sequelize[_0x85e8('0x4')],'comment':_0x85e8('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x85e8('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x85e8('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x85e8('0x45')},'dialCutDigit':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x85e8('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x85e8('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x85e8('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x85e8('0x16')](0x5)[_0x85e8('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x85e8('0x48')},'dialDropRetryFrequency':{'type':Sequelize[_0x85e8('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x85e8('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x85e8('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x85e8('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x85e8('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x85e8('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x85e8('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x85e8('0x16')](0x5)[_0x85e8('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x85e8('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x85e8('0x16')](0x5)[_0x85e8('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x85e8('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x85e8('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x85e8('0x4f'),'set':function(_0xbce7e5){if(!_0xbce7e5)this[_0x85e8('0xe')]('mandatoryDispositionPauseId',null);this[_0x85e8('0xe')](_0x85e8('0x50'),_0xbce7e5);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x85e8('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x85e8('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x85e8('0x16')](0x3)[_0x85e8('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x85e8('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0xc9ce=['fewestcalls','linear','wrandom','rrordered','ringall','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','booked','roundrobin','progressive','predictive','INTEGER','yes','all','once','join','periodic_announce','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','power','Dial\x20Method.','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.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','mandatoryDisposition','exports','name','ENUM','inbound','outbound','STRING','default','leastrecent'];(function(_0x1fee16,_0x4ec02e){var _0x2018be=function(_0x2452e4){while(--_0x2452e4){_0x1fee16['push'](_0x1fee16['shift']());}};_0x2018be(++_0x4ec02e);}(_0xc9ce,0xee));var _0xec9c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc9ce[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xec9c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xec9c('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x3'),_0xec9c('0x4')),'allowNull':![],'defaultValue':_0xec9c('0x3')},'musiconhold':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':_0xec9c('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xec9c('0x2')]('rr','ringall',_0xec9c('0x7'),_0xec9c('0x8'),'random','rrmemory',_0xec9c('0x9'),_0xec9c('0xa'),_0xec9c('0xb')),'allowNull':![],'defaultValue':_0xec9c('0xc'),'set':function(_0x502ec1){this[_0xec9c('0xd')](_0xec9c('0xe'),_0x502ec1?_0x502ec1:_0xec9c('0xf'));},'get':function(){var _0xe1359b=this[_0xec9c('0x10')](_0xec9c('0x11'));var _0x283493=this[_0xec9c('0x10')](_0xec9c('0x12'));var _0x16a32e=this[_0xec9c('0x10')](_0xec9c('0xe'));if(_0xe1359b==='inbound'){return _0x16a32e;}if(_0x283493===_0xec9c('0x13')&&_0x16a32e===_0xec9c('0xf')||_0x283493===_0xec9c('0x13')&&_0x16a32e===_0xec9c('0x14')){return _0x16a32e;}if(_0x283493===_0xec9c('0x15')||_0x283493===_0xec9c('0x16')||_0x283493==='power'){return _0x16a32e;}return null;}},'servicelevel':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xec9c('0x17')](0xb)},'timeout':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xec9c('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':_0xec9c('0x18')},'autopause':{'type':Sequelize['ENUM'](_0xec9c('0x18'),'no',_0xec9c('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xec9c('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xec9c('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xec9c('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xec9c('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xec9c('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xec9c('0x2')]('yes','no'),'defaultValue':_0xec9c('0x18')},'announce_holdtime':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no',_0xec9c('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xec9c('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0xec9c('0x17')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xec9c('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xec9c('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xec9c('0x5')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x369b3e){this[_0xec9c('0xd')]('periodic_announce',_0x369b3e?_0x369b3e[_0xec9c('0x1b')](','):[]);},'get':function(){return this[_0xec9c('0x10')]('periodic_announce')?this[_0xec9c('0x10')](_0xec9c('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':_0xec9c('0x18'),'set':function(_0x515542){this[_0xec9c('0xd')](_0xec9c('0x1d'),_0x515542?_0x515542[_0xec9c('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xec9c('0x1d'))?this[_0xec9c('0x10')](_0xec9c('0x1d'))[_0xec9c('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':'no','set':function(_0x2a4693){this[_0xec9c('0xd')]('leavewhenempty',_0x2a4693?_0x2a4693['join'](','):undefined);},'get':function(){return this[_0xec9c('0x10')](_0xec9c('0x1f'))?this[_0xec9c('0x10')](_0xec9c('0x1f'))[_0xec9c('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0xec9c('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xec9c('0x5')]},'acw':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':0x0,'set':function(_0x2f29b1){this[_0xec9c('0xd')](_0xec9c('0x21'),_0x2f29b1);if(_0x2f29b1){if(this[_0xec9c('0x10')]('wrapuptime')<0x2){this['setDataValue'](_0xec9c('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xec9c('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xec9c('0x15'),_0xec9c('0x23'),'predictive',_0xec9c('0x13')),'defaultValue':_0xec9c('0x15'),'comment':_0xec9c('0x24')},'dialLimitChannel':{'type':Sequelize[_0xec9c('0x17')](0x4)[_0xec9c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xec9c('0x26')},'dialLimitQueue':{'type':Sequelize[_0xec9c('0x17')](0x4)[_0xec9c('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xec9c('0x27')},'dialPowerLevel':{'type':Sequelize[_0xec9c('0x28')](0x2)[_0xec9c('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xec9c('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x2a'),_0xec9c('0x2b')),'defaultValue':_0xec9c('0x2b'),'comment':_0xec9c('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xec9c('0x2d')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xec9c('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xec9c('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0xec9c('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xec9c('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0xec9c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x2f')},'dialQueueOptions':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':_0xec9c('0x30'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xec9c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x31')},'dialQueueProject':{'type':Sequelize[_0xec9c('0x5')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xec9c('0x36')},'dialTimezone':{'type':Sequelize[_0xec9c('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xec9c('0x37')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xec9c('0x2')](_0xec9c('0x38'),'never',_0xec9c('0x39')),'defaultValue':_0xec9c('0x38')},'dialAMDActive':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':0x0,'comment':_0xec9c('0x3a')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xec9c('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xec9c('0x3b')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xec9c('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xec9c('0x3c')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xec9c('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xec9c('0x3d')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xec9c('0x17')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xec9c('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0xec9c('0x17')](0x9)[_0xec9c('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xec9c('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xec9c('0x17')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xec9c('0x40')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xec9c('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xec9c('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xec9c('0x17')](0x9)[_0xec9c('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xec9c('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xec9c('0x44')},'dialRecallInQueue':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':0x0,'comment':_0xec9c('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0xec9c('0x2')]('DESC',_0xec9c('0x46')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xec9c('0x5')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xec9c('0x47')},'dialCutDigit':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xec9c('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x49')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x4a')},'dialDropMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x4b')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x4c')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x4d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x4e')},'dialMachineMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xec9c('0x4f')},'dialMachineRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xec9c('0x50')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xec9c('0x17')](0x5)[_0xec9c('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xec9c('0x17')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x366ed5){if(!_0x366ed5)this[_0xec9c('0xd')]('mandatoryDispositionPauseId',null);this[_0xec9c('0xd')](_0xec9c('0x51'),_0x366ed5);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xec9c('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xec9c('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xec9c('0x17')](0x3)[_0xec9c('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 91a700d..c7f935a 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 _0x8d0a=['sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','find','type','name','UserProfileResource','stack','send','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceQueue','includeAll','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','error','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','interface','flatMap','forEach','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','voicePause','removeTeams','ids','select','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','sequelize','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','userVoiceQueue:save','online','SIP/%s','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','ContactId','ListId','phone','field','scheduledAt','CmListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','VoiceQueueId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','push','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./voiceQueue.socket','register'];(function(_0x45e709,_0x225275){var _0x597e47=function(_0x4e3af8){while(--_0x4e3af8){_0x45e709['push'](_0x45e709['shift']());}};_0x597e47(++_0x225275);}(_0x8d0a,0x172));var _0xa8d0=function(_0x45b775,_0x195120){_0x45b775=_0x45b775-0x0;var _0x2b9c51=_0x8d0a[_0x45b775];return _0x2b9c51;};'use strict';var emlformat=require(_0xa8d0('0x0'));var rimraf=require(_0xa8d0('0x1'));var zipdir=require(_0xa8d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8d0('0x3'));var moment=require(_0xa8d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8d0('0x5'));var util=require(_0xa8d0('0x6'));var path=require(_0xa8d0('0x7'));var sox=require('sox');var csv=require(_0xa8d0('0x8'));var ejs=require(_0xa8d0('0x9'));var fs=require('fs');var fs_extra=require(_0xa8d0('0xa'));var _=require(_0xa8d0('0xb'));var squel=require(_0xa8d0('0xc'));var crypto=require(_0xa8d0('0xd'));var jsforce=require(_0xa8d0('0xe'));var deskjs=require(_0xa8d0('0xf'));var toCsv=require(_0xa8d0('0x8'));var querystring=require(_0xa8d0('0x10'));var Papa=require(_0xa8d0('0x11'));var Redis=require(_0xa8d0('0x12'));var authService=require(_0xa8d0('0x13'));var qs=require(_0xa8d0('0x14'));var as=require(_0xa8d0('0x15'));var hardwareService=require(_0xa8d0('0x16'));var logger=require(_0xa8d0('0x17'))(_0xa8d0('0x18'));var utils=require(_0xa8d0('0x19'));var config=require(_0xa8d0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa8d0('0x1b')]=_[_0xa8d0('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa8d0('0x1d'))(new Redis(config[_0xa8d0('0x1b')]));require(_0xa8d0('0x1e'))[_0xa8d0('0x1f')](socket);function respondWithStatusCode(_0x2ebddf,_0x18f935){_0x18f935=_0x18f935||0xcc;return function(_0x192b0a){if(_0x192b0a){return _0x2ebddf[_0xa8d0('0x20')](_0x18f935);}return _0x2ebddf[_0xa8d0('0x21')](_0x18f935)[_0xa8d0('0x22')]();};}function respondWithResult(_0xfa19ee,_0x575f69){_0x575f69=_0x575f69||0xc8;return function(_0x728809){if(_0x728809){return _0xfa19ee[_0xa8d0('0x21')](_0x575f69)['json'](_0x728809);}};}function respondWithFilteredResult(_0x3e1dc6,_0x15620f){return function(_0x2899fb){if(_0x2899fb){var _0x434ad5=typeof _0x15620f[_0xa8d0('0x23')]==='undefined'&&typeof _0x15620f[_0xa8d0('0x24')]===_0xa8d0('0x25');var _0x213de2=_0x2899fb[_0xa8d0('0x26')];var _0x1b5dfb=_0x434ad5?0x0:_0x15620f[_0xa8d0('0x23')];var _0x21a6ca=_0x434ad5?_0x2899fb['count']:_0x15620f[_0xa8d0('0x23')]+_0x15620f[_0xa8d0('0x24')];var _0x3c8843;if(_0x21a6ca>=_0x213de2){_0x21a6ca=_0x213de2;_0x3c8843=0xc8;}else{_0x3c8843=0xce;}_0x3e1dc6[_0xa8d0('0x21')](_0x3c8843);return _0x3e1dc6['set'](_0xa8d0('0x27'),_0x1b5dfb+'-'+_0x21a6ca+'/'+_0x213de2)[_0xa8d0('0x28')](_0x2899fb);}return null;};}function patchUpdates(_0x3212a3){return function(_0x252682){try{jsonpatch['apply'](_0x252682,_0x3212a3,!![]);}catch(_0x150080){return BPromise[_0xa8d0('0x29')](_0x150080);}return _0x252682[_0xa8d0('0x2a')]();};}function saveUpdates(_0x1e9c3e,_0x55e6e0){return function(_0x35b4a6){if(_0x35b4a6){return _0x35b4a6[_0xa8d0('0x2b')](_0x1e9c3e)[_0xa8d0('0x2c')](function(_0x507d18){return _0x507d18;});}return null;};}function removeEntity(_0x34c0bf,_0x5f5dfb){return function(_0x3efa4e){if(_0x3efa4e){return _0x3efa4e[_0xa8d0('0x2d')]()['then'](function(){var _0x5d7292=_0x3efa4e[_0xa8d0('0x2e')]({'plain':!![]});var _0x5d9a04=[{'name':_0xa8d0('0x2f'),'value':_0xa8d0('0x30'),'ignore':![]},{'name':_0xa8d0('0x31'),'value':_0xa8d0('0x32'),'ignore':![]}];var _0x3ceaa9=_(_0x5d9a04)['filter'](_0xa8d0('0x33'))[_0xa8d0('0x34')](_0xa8d0('0x35'))['value']();if(_['includes'](_0x3ceaa9,_0x5d7292['type'])){return;}var _0x472982=_[_0xa8d0('0x36')](_0x5d9a04,[_0xa8d0('0x35'),_0x5d7292[_0xa8d0('0x37')]])[_0xa8d0('0x38')];return db[_0xa8d0('0x39')][_0xa8d0('0x2d')]({'where':{'type':_0x472982,'resourceId':_0x5d7292['id']}})['then'](function(){return _0x3efa4e;});})[_0xa8d0('0x2c')](function(){_0x34c0bf['status'](0xcc)[_0xa8d0('0x22')]();});}};}function handleEntityNotFound(_0x538e51,_0x4ea42b){return function(_0x54bc61){if(!_0x54bc61){_0x538e51['sendStatus'](0x194);}return _0x54bc61;};}function handleError(_0xde0f12,_0x25b7b1){_0x25b7b1=_0x25b7b1||0x1f4;return function(_0x5e2334){logger['error'](_0x5e2334[_0xa8d0('0x3a')]);if(_0x5e2334[_0xa8d0('0x38')]){delete _0x5e2334[_0xa8d0('0x38')];}_0xde0f12[_0xa8d0('0x21')](_0x25b7b1)[_0xa8d0('0x3b')](_0x5e2334);};}exports['index']=function(_0x491efc,_0x128a0c){var _0xf5f87={},_0x431d49={},_0x43c9f0={'count':0x0,'rows':[]};var _0x40ccb6=_[_0xa8d0('0x34')](db['VoiceQueue'][_0xa8d0('0x3c')],function(_0x1f474e){return{'name':_0x1f474e[_0xa8d0('0x3d')],'type':_0x1f474e['type'][_0xa8d0('0x3e')]};});_0x431d49[_0xa8d0('0x3f')]=_[_0xa8d0('0x34')](_0x40ccb6,_0xa8d0('0x38'));_0x431d49[_0xa8d0('0x40')]=_[_0xa8d0('0x41')](_0x491efc[_0xa8d0('0x40')]);_0x431d49[_0xa8d0('0x42')]=_[_0xa8d0('0x43')](_0x431d49[_0xa8d0('0x3f')],_0x431d49[_0xa8d0('0x40')]);_0xf5f87['attributes']=_[_0xa8d0('0x43')](_0x431d49['model'],qs[_0xa8d0('0x44')](_0x491efc[_0xa8d0('0x40')][_0xa8d0('0x44')]));_0xf5f87['attributes']=_0xf5f87[_0xa8d0('0x45')][_0xa8d0('0x46')]?_0xf5f87[_0xa8d0('0x45')]:_0x431d49['model'];if(!_0x491efc[_0xa8d0('0x40')][_0xa8d0('0x47')](_0xa8d0('0x48'))){_0xf5f87[_0xa8d0('0x24')]=qs[_0xa8d0('0x24')](_0x491efc[_0xa8d0('0x40')][_0xa8d0('0x24')]);_0xf5f87[_0xa8d0('0x23')]=qs[_0xa8d0('0x23')](_0x491efc['query'][_0xa8d0('0x23')]);}_0xf5f87[_0xa8d0('0x49')]=qs[_0xa8d0('0x4a')](_0x491efc[_0xa8d0('0x40')][_0xa8d0('0x4a')]);_0xf5f87[_0xa8d0('0x4b')]=qs[_0xa8d0('0x42')](_[_0xa8d0('0x4c')](_0x491efc[_0xa8d0('0x40')],_0x431d49['filters']),_0x40ccb6);if(_0x491efc[_0xa8d0('0x40')]['filter']){_0xf5f87[_0xa8d0('0x4b')]=_[_0xa8d0('0x4d')](_0xf5f87['where'],{'$or':_[_0xa8d0('0x34')](_0x40ccb6,function(_0x5c44f1){if(_0x5c44f1[_0xa8d0('0x37')]!==_0xa8d0('0x4e')){var _0x1a14b8={};_0x1a14b8[_0x5c44f1['name']]={'$like':'%'+_0x491efc['query'][_0xa8d0('0x4f')]+'%'};return _0x1a14b8;}})});}_0xf5f87=_[_0xa8d0('0x4d')]({},_0xf5f87,_0x491efc[_0xa8d0('0x50')]);var _0xaf3120={'where':_0xf5f87[_0xa8d0('0x4b')]};return db[_0xa8d0('0x51')][_0xa8d0('0x26')](_0xaf3120)[_0xa8d0('0x2c')](function(_0x5e33f4){_0x43c9f0[_0xa8d0('0x26')]=_0x5e33f4;if(_0x491efc['query'][_0xa8d0('0x52')]){_0xf5f87['include']=[{'all':!![]}];}return db[_0xa8d0('0x51')][_0xa8d0('0x53')](_0xf5f87);})[_0xa8d0('0x2c')](function(_0x58d820){_0x43c9f0[_0xa8d0('0x54')]=_0x58d820;return _0x43c9f0;})[_0xa8d0('0x2c')](respondWithFilteredResult(_0x128a0c,_0xf5f87))[_0xa8d0('0x55')](handleError(_0x128a0c,null));};exports[_0xa8d0('0x56')]=function(_0x86c7ef,_0x38abbf){var _0x2b0f77={'raw':![],'where':{'id':_0x86c7ef[_0xa8d0('0x57')]['id']}},_0x2c5055={};_0x2c5055[_0xa8d0('0x3f')]=_[_0xa8d0('0x41')](db[_0xa8d0('0x51')][_0xa8d0('0x3c')]);_0x2c5055[_0xa8d0('0x40')]=_[_0xa8d0('0x41')](_0x86c7ef['query']);_0x2c5055['filters']=_[_0xa8d0('0x43')](_0x2c5055[_0xa8d0('0x3f')],_0x2c5055[_0xa8d0('0x40')]);_0x2b0f77[_0xa8d0('0x45')]=_[_0xa8d0('0x43')](_0x2c5055[_0xa8d0('0x3f')],qs[_0xa8d0('0x44')](_0x86c7ef[_0xa8d0('0x40')][_0xa8d0('0x44')]));_0x2b0f77[_0xa8d0('0x45')]=_0x2b0f77[_0xa8d0('0x45')][_0xa8d0('0x46')]?_0x2b0f77[_0xa8d0('0x45')]:_0x2c5055['model'];if(_0x86c7ef[_0xa8d0('0x40')][_0xa8d0('0x52')]){_0x2b0f77[_0xa8d0('0x58')]=[{'all':!![]}];}_0x2b0f77=_['merge']({},_0x2b0f77,_0x86c7ef[_0xa8d0('0x50')]);return db[_0xa8d0('0x51')][_0xa8d0('0x36')](_0x2b0f77)[_0xa8d0('0x2c')](handleEntityNotFound(_0x38abbf,null))[_0xa8d0('0x2c')](respondWithResult(_0x38abbf,null))['catch'](handleError(_0x38abbf,null));};exports['create']=function(_0x2b7a1c,_0x1021f8){return db[_0xa8d0('0x51')][_0xa8d0('0x59')](_0x2b7a1c[_0xa8d0('0x5a')],{})[_0xa8d0('0x2c')](function(_0x39518a){var _0x15e8d9=_0x2b7a1c[_0xa8d0('0x5b')]['get']({'plain':!![]});if(!_0x15e8d9)throw new Error(_0xa8d0('0x5c'));if(_0x15e8d9[_0xa8d0('0x5d')]===_0xa8d0('0x5b')){var _0x2380fb=_0x39518a[_0xa8d0('0x2e')]({'plain':!![]});var _0x5247df=[{'name':_0xa8d0('0x2f'),'value':'inbound'},{'name':_0xa8d0('0x31'),'value':'outbound'}];var _0x2cd37f=_['find'](_0x5247df,['value',_0x2380fb[_0xa8d0('0x37')]])[_0xa8d0('0x38')];return db[_0xa8d0('0x5e')]['find']({'where':{'name':_0x2cd37f,'userProfileId':_0x15e8d9[_0xa8d0('0x5f')]},'raw':!![]})['then'](function(_0x4ffecd){if(_0x4ffecd&&_0x4ffecd[_0xa8d0('0x60')]===0x0){return db[_0xa8d0('0x39')][_0xa8d0('0x59')]({'name':_0x2380fb['name'],'resourceId':_0x2380fb['id'],'type':_0x4ffecd['name'],'sectionId':_0x4ffecd['id']},{})[_0xa8d0('0x2c')](function(){return _0x39518a;});}else{return _0x39518a;}})[_0xa8d0('0x55')](function(_0xf0c4b8){logger['error'](_0xa8d0('0x61'),_0xf0c4b8);throw _0xf0c4b8;});}return _0x39518a;})['then'](respondWithResult(_0x1021f8,0xc9))[_0xa8d0('0x55')](handleError(_0x1021f8,null));};exports[_0xa8d0('0x62')]=function(_0xcc4cdb,_0x514579){var _0x2b9a12={'where':{'id':_0xcc4cdb[_0xa8d0('0x57')]['id']}},_0x21af6f={};_0x21af6f['model']=_['keys'](db[_0xa8d0('0x51')][_0xa8d0('0x3c')]);_0x2b9a12['attributes']=_['intersection'](_0x21af6f[_0xa8d0('0x3f')],qs[_0xa8d0('0x44')](_0xcc4cdb[_0xa8d0('0x40')]['fields']));_0x2b9a12['attributes']=_0x2b9a12[_0xa8d0('0x45')]['length']?_0x2b9a12[_0xa8d0('0x45')]:_0x21af6f[_0xa8d0('0x3f')];if(_0xcc4cdb['query']['includeAll']){_0x2b9a12['include']=[{'all':!![]}];}_0x2b9a12=_[_0xa8d0('0x4d')]({},_0x2b9a12,_0xcc4cdb['options']);return db[_0xa8d0('0x51')][_0xa8d0('0x36')](_0x2b9a12)[_0xa8d0('0x2c')](handleEntityNotFound(_0x514579,null))['then'](function(_0x5a97ed){if(_0x5a97ed){var _0x5a2b34=_0x5a97ed[_0xa8d0('0x2e')]({'plain':!![]});_0x5a2b34=qs[_0xa8d0('0x63')](_0x5a2b34,['id',_0xa8d0('0x64'),_0xa8d0('0x65')]);_0xcc4cdb[_0xa8d0('0x5a')]=_['omit'](_0xcc4cdb[_0xa8d0('0x5a')],['id','createdAt',_0xa8d0('0x65')]);return db['VoiceQueue'][_0xa8d0('0x59')](_['merge'](_0x5a2b34,_0xcc4cdb[_0xa8d0('0x5a')]),{'include':_0xcc4cdb[_0xa8d0('0x40')][_0xa8d0('0x52')]?[{'all':!![]}]:undefined})[_0xa8d0('0x2c')](function(_0x5dde58){var _0x409614=_0xcc4cdb[_0xa8d0('0x5b')]['get']({'plain':!![]});if(!_0x409614)throw new Error(_0xa8d0('0x5c'));if(_0x409614[_0xa8d0('0x5d')]==='user'){var _0x37f6ba=_0x5dde58[_0xa8d0('0x2e')]({'plain':!![]});var _0x3369da=[{'name':_0xa8d0('0x2f'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xa8d0('0x32')}];var _0x62b34e=_[_0xa8d0('0x36')](_0x3369da,[_0xa8d0('0x35'),_0x37f6ba[_0xa8d0('0x37')]])['name'];return db[_0xa8d0('0x5e')][_0xa8d0('0x36')]({'where':{'name':_0x62b34e,'userProfileId':_0x409614[_0xa8d0('0x5f')]},'raw':!![]})[_0xa8d0('0x2c')](function(_0xbebfea){if(_0xbebfea&&_0xbebfea[_0xa8d0('0x60')]===0x0){return db['UserProfileResource'][_0xa8d0('0x59')]({'name':_0x37f6ba[_0xa8d0('0x38')],'resourceId':_0x37f6ba['id'],'type':_0xbebfea[_0xa8d0('0x38')],'sectionId':_0xbebfea['id']},{})['then'](function(){return _0x5dde58;});}else{return _0x5dde58;}})[_0xa8d0('0x55')](function(_0xa155eb){logger[_0xa8d0('0x66')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa155eb);throw _0xa155eb;});}return _0x5dde58;});}})['then'](respondWithResult(_0x514579,0xc9))[_0xa8d0('0x55')](handleError(_0x514579,null));};exports[_0xa8d0('0x2b')]=function(_0x5dc214,_0xef6c6d){if(_0x5dc214['body']['id']){delete _0x5dc214['body']['id'];}return db['VoiceQueue'][_0xa8d0('0x36')]({'where':{'id':_0x5dc214[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0xef6c6d,null))['then'](saveUpdates(_0x5dc214[_0xa8d0('0x5a')],null))[_0xa8d0('0x2c')](respondWithResult(_0xef6c6d,null))[_0xa8d0('0x55')](handleError(_0xef6c6d,null));};exports[_0xa8d0('0x2d')]=function(_0x126c54,_0x717ea5){return db['VoiceQueue'][_0xa8d0('0x36')]({'where':{'id':_0x126c54[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x717ea5,null))[_0xa8d0('0x2c')](removeEntity(_0x717ea5,null))[_0xa8d0('0x55')](handleError(_0x717ea5,null));};exports[_0xa8d0('0x67')]=function(_0x3ee3dc,_0x471b9b,_0x1c4485){var _0x1732c3={'raw':![],'where':{}};var _0x580a04={};var _0x3f562a={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa8d0('0x68')]({'where':{'id':_0x3ee3dc['params']['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x471b9b,null))[_0xa8d0('0x2c')](function(_0xc7a712){if(_0xc7a712){_0x580a04[_0xa8d0('0x3f')]=_[_0xa8d0('0x41')](db[_0xa8d0('0x69')][_0xa8d0('0x3c')]);_0x580a04[_0xa8d0('0x40')]=_[_0xa8d0('0x41')](_0x3ee3dc[_0xa8d0('0x40')]);_0x580a04['filters']=_[_0xa8d0('0x43')](_0x580a04[_0xa8d0('0x3f')],_0x580a04[_0xa8d0('0x40')]);_0x1732c3[_0xa8d0('0x45')]=_['intersection'](_0x580a04[_0xa8d0('0x3f')],qs[_0xa8d0('0x44')](_0x3ee3dc[_0xa8d0('0x40')][_0xa8d0('0x44')]));_0x1732c3[_0xa8d0('0x45')]=_0x1732c3['attributes'][_0xa8d0('0x46')]?_0x1732c3[_0xa8d0('0x45')]:_0x580a04[_0xa8d0('0x3f')];if(!_0x3ee3dc[_0xa8d0('0x40')][_0xa8d0('0x47')](_0xa8d0('0x48'))){_0x1732c3[_0xa8d0('0x24')]=qs['limit'](_0x3ee3dc[_0xa8d0('0x40')]['limit']);_0x1732c3['offset']=qs[_0xa8d0('0x23')](_0x3ee3dc[_0xa8d0('0x40')][_0xa8d0('0x23')]);}_0x1732c3['order']=qs[_0xa8d0('0x4a')](_0x3ee3dc[_0xa8d0('0x40')]['sort']);_0x1732c3[_0xa8d0('0x4b')]=qs[_0xa8d0('0x42')](_['pick'](_0x3ee3dc[_0xa8d0('0x40')],_0x580a04[_0xa8d0('0x42')]));_0x1732c3[_0xa8d0('0x4b')][_0xa8d0('0x6a')]=_0xc7a712['id'];if(_0x3ee3dc['query'][_0xa8d0('0x4f')]){_0x1732c3[_0xa8d0('0x4b')]=_[_0xa8d0('0x4d')](_0x1732c3[_0xa8d0('0x4b')],{'$or':_[_0xa8d0('0x34')](_0x1732c3[_0xa8d0('0x45')],function(_0x58c149){var _0x34689e={};_0x34689e[_0x58c149]={'$like':'%'+_0x3ee3dc[_0xa8d0('0x40')][_0xa8d0('0x4f')]+'%'};return _0x34689e;})});}_0x1732c3=_[_0xa8d0('0x4d')]({},_0x1732c3,_0x3ee3dc[_0xa8d0('0x50')]);return db['CmHopper'][_0xa8d0('0x26')]({'where':_0x1732c3['where']})[_0xa8d0('0x2c')](function(_0x31a6d2){_0x3f562a[_0xa8d0('0x26')]=_0x31a6d2;if(_0x3ee3dc[_0xa8d0('0x40')]['includeAll']){_0x1732c3[_0xa8d0('0x58')]=[{'all':!![]}];}return db[_0xa8d0('0x69')]['findAll'](_0x1732c3);})['then'](function(_0x4d53f8){_0x3f562a[_0xa8d0('0x54')]=_0x4d53f8;return _0x3f562a;});}})[_0xa8d0('0x2c')](respondWithFilteredResult(_0x471b9b,_0x1732c3))[_0xa8d0('0x55')](handleError(_0x471b9b,null));};exports[_0xa8d0('0x6b')]=function(_0x1865f1,_0x17c092,_0x127e04){var _0x5d0313={'raw':!![],'where':{}};var _0x39ec37={};var _0x47f818={'count':0x0,'rows':[]};return db[_0xa8d0('0x51')]['findOne']({'where':{'id':_0x1865f1['params']['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x17c092,null))['then'](function(_0xf7f94b){if(_0xf7f94b){_0x39ec37[_0xa8d0('0x3f')]=_['keys'](db['CmHopperHistory'][_0xa8d0('0x3c')]);_0x39ec37[_0xa8d0('0x40')]=_[_0xa8d0('0x41')](_0x1865f1[_0xa8d0('0x40')]);_0x39ec37[_0xa8d0('0x42')]=_[_0xa8d0('0x43')](_0x39ec37[_0xa8d0('0x3f')],_0x39ec37[_0xa8d0('0x40')]);_0x5d0313[_0xa8d0('0x45')]=_[_0xa8d0('0x43')](_0x39ec37[_0xa8d0('0x3f')],qs[_0xa8d0('0x44')](_0x1865f1[_0xa8d0('0x40')][_0xa8d0('0x44')]));_0x5d0313['attributes']=_0x5d0313[_0xa8d0('0x45')]['length']?_0x5d0313[_0xa8d0('0x45')]:_0x39ec37[_0xa8d0('0x3f')];if(!_0x1865f1[_0xa8d0('0x40')][_0xa8d0('0x47')](_0xa8d0('0x48'))){_0x5d0313[_0xa8d0('0x24')]=qs[_0xa8d0('0x24')](_0x1865f1[_0xa8d0('0x40')][_0xa8d0('0x24')]);_0x5d0313[_0xa8d0('0x23')]=qs[_0xa8d0('0x23')](_0x1865f1[_0xa8d0('0x40')]['offset']);}_0x5d0313['order']=qs['sort'](_0x1865f1[_0xa8d0('0x40')]['sort']);_0x5d0313[_0xa8d0('0x4b')]=qs[_0xa8d0('0x42')](_['pick'](_0x1865f1[_0xa8d0('0x40')],_0x39ec37['filters']));_0x5d0313[_0xa8d0('0x4b')]['VoiceQueueId']=_0xf7f94b['id'];if(_0x1865f1[_0xa8d0('0x40')][_0xa8d0('0x4f')]){_0x5d0313[_0xa8d0('0x4b')]=_[_0xa8d0('0x4d')](_0x5d0313[_0xa8d0('0x4b')],{'$or':_[_0xa8d0('0x34')](_0x5d0313[_0xa8d0('0x45')],function(_0x3042af){var _0xf89033={};_0xf89033[_0x3042af]={'$like':'%'+_0x1865f1[_0xa8d0('0x40')][_0xa8d0('0x4f')]+'%'};return _0xf89033;})});}_0x5d0313=_[_0xa8d0('0x4d')]({},_0x5d0313,_0x1865f1[_0xa8d0('0x50')]);return db['CmHopperHistory']['count']({'where':_0x5d0313[_0xa8d0('0x4b')]})[_0xa8d0('0x2c')](function(_0x12945c){_0x47f818['count']=_0x12945c;if(_0x1865f1[_0xa8d0('0x40')]['includeAll']){_0x5d0313['include']=[{'all':!![]}];}return db[_0xa8d0('0x6c')][_0xa8d0('0x53')](_0x5d0313);})[_0xa8d0('0x2c')](function(_0x32d614){_0x47f818['rows']=_0x32d614;return _0x47f818;});}})[_0xa8d0('0x2c')](respondWithFilteredResult(_0x17c092,_0x5d0313))['catch'](handleError(_0x17c092,null));};exports['getHopperFinals']=function(_0x112a24,_0x124864,_0x4b69c2){var _0x31adf5={'raw':!![],'where':{}};var _0x8291aa={};var _0x3b124a={'count':0x0,'rows':[]};return db[_0xa8d0('0x51')]['findOne']({'where':{'id':_0x112a24[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x124864,null))[_0xa8d0('0x2c')](function(_0x580808){if(_0x580808){_0x8291aa[_0xa8d0('0x3f')]=_['keys'](db[_0xa8d0('0x6d')][_0xa8d0('0x3c')]);_0x8291aa[_0xa8d0('0x40')]=_[_0xa8d0('0x41')](_0x112a24[_0xa8d0('0x40')]);_0x8291aa[_0xa8d0('0x42')]=_[_0xa8d0('0x43')](_0x8291aa[_0xa8d0('0x3f')],_0x8291aa[_0xa8d0('0x40')]);_0x31adf5[_0xa8d0('0x45')]=_[_0xa8d0('0x43')](_0x8291aa[_0xa8d0('0x3f')],qs[_0xa8d0('0x44')](_0x112a24[_0xa8d0('0x40')][_0xa8d0('0x44')]));_0x31adf5[_0xa8d0('0x45')]=_0x31adf5['attributes'][_0xa8d0('0x46')]?_0x31adf5['attributes']:_0x8291aa['model'];if(!_0x112a24[_0xa8d0('0x40')]['hasOwnProperty'](_0xa8d0('0x48'))){_0x31adf5[_0xa8d0('0x24')]=qs[_0xa8d0('0x24')](_0x112a24['query']['limit']);_0x31adf5[_0xa8d0('0x23')]=qs[_0xa8d0('0x23')](_0x112a24[_0xa8d0('0x40')][_0xa8d0('0x23')]);}_0x31adf5[_0xa8d0('0x49')]=qs[_0xa8d0('0x4a')](_0x112a24['query'][_0xa8d0('0x4a')]);_0x31adf5[_0xa8d0('0x4b')]=qs[_0xa8d0('0x42')](_[_0xa8d0('0x4c')](_0x112a24[_0xa8d0('0x40')],_0x8291aa[_0xa8d0('0x42')]));_0x31adf5[_0xa8d0('0x4b')][_0xa8d0('0x6a')]=_0x580808['id'];if(_0x112a24[_0xa8d0('0x40')]['filter']){_0x31adf5[_0xa8d0('0x4b')]=_[_0xa8d0('0x4d')](_0x31adf5[_0xa8d0('0x4b')],{'$or':_['map'](_0x31adf5[_0xa8d0('0x45')],function(_0x20fcad){var _0x40a16e={};_0x40a16e[_0x20fcad]={'$like':'%'+_0x112a24[_0xa8d0('0x40')]['filter']+'%'};return _0x40a16e;})});}_0x31adf5=_['merge']({},_0x31adf5,_0x112a24[_0xa8d0('0x50')]);return db[_0xa8d0('0x6d')][_0xa8d0('0x26')]({'where':_0x31adf5[_0xa8d0('0x4b')]})[_0xa8d0('0x2c')](function(_0x394202){_0x3b124a['count']=_0x394202;if(_0x112a24[_0xa8d0('0x40')][_0xa8d0('0x52')]){_0x31adf5[_0xa8d0('0x58')]=[{'all':!![]}];}return db[_0xa8d0('0x6d')]['findAll'](_0x31adf5);})[_0xa8d0('0x2c')](function(_0x121a1b){_0x3b124a['rows']=_0x121a1b;return _0x3b124a;});}})['then'](respondWithFilteredResult(_0x124864,_0x31adf5))[_0xa8d0('0x55')](handleError(_0x124864,null));};exports[_0xa8d0('0x6e')]=function(_0x1f8130,_0x37c476,_0x39d256){var _0x171792={'raw':!![],'where':{}};var _0xfc8f03={};var _0x2e132b={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa8d0('0x68')]({'where':{'id':_0x1f8130[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x37c476,null))['then'](function(_0x5e0b86){if(_0x5e0b86){_0xfc8f03[_0xa8d0('0x3f')]=_[_0xa8d0('0x41')](db[_0xa8d0('0x6f')][_0xa8d0('0x3c')]);_0xfc8f03[_0xa8d0('0x40')]=_['keys'](_0x1f8130[_0xa8d0('0x40')]);_0xfc8f03['filters']=_[_0xa8d0('0x43')](_0xfc8f03[_0xa8d0('0x3f')],_0xfc8f03[_0xa8d0('0x40')]);_0x171792[_0xa8d0('0x45')]=_[_0xa8d0('0x43')](_0xfc8f03[_0xa8d0('0x3f')],qs[_0xa8d0('0x44')](_0x1f8130[_0xa8d0('0x40')][_0xa8d0('0x44')]));_0x171792[_0xa8d0('0x45')]=_0x171792[_0xa8d0('0x45')][_0xa8d0('0x46')]?_0x171792[_0xa8d0('0x45')]:_0xfc8f03[_0xa8d0('0x3f')];if(!_0x1f8130[_0xa8d0('0x40')]['hasOwnProperty'](_0xa8d0('0x48'))){_0x171792[_0xa8d0('0x24')]=qs[_0xa8d0('0x24')](_0x1f8130[_0xa8d0('0x40')][_0xa8d0('0x24')]);_0x171792[_0xa8d0('0x23')]=qs[_0xa8d0('0x23')](_0x1f8130[_0xa8d0('0x40')][_0xa8d0('0x23')]);}_0x171792['order']=qs[_0xa8d0('0x4a')](_0x1f8130[_0xa8d0('0x40')][_0xa8d0('0x4a')]);_0x171792[_0xa8d0('0x4b')]=qs['filters'](_[_0xa8d0('0x4c')](_0x1f8130['query'],_0xfc8f03['filters']));_0x171792[_0xa8d0('0x4b')][_0xa8d0('0x6a')]=_0x5e0b86['id'];if(_0x1f8130['query']['filter']){_0x171792[_0xa8d0('0x4b')]=_[_0xa8d0('0x4d')](_0x171792[_0xa8d0('0x4b')],{'$or':_[_0xa8d0('0x34')](_0x171792['attributes'],function(_0x4e7825){var _0x431485={};_0x431485[_0x4e7825]={'$like':'%'+_0x1f8130[_0xa8d0('0x40')]['filter']+'%'};return _0x431485;})});}_0x171792=_[_0xa8d0('0x4d')]({},_0x171792,_0x1f8130['options']);return db['CmHopperBlack'][_0xa8d0('0x26')]({'where':_0x171792[_0xa8d0('0x4b')]})[_0xa8d0('0x2c')](function(_0x26e064){_0x2e132b['count']=_0x26e064;if(_0x1f8130[_0xa8d0('0x40')][_0xa8d0('0x52')]){_0x171792[_0xa8d0('0x58')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xa8d0('0x53')](_0x171792);})[_0xa8d0('0x2c')](function(_0x197e57){_0x2e132b[_0xa8d0('0x54')]=_0x197e57;return _0x2e132b;});}})[_0xa8d0('0x2c')](respondWithFilteredResult(_0x37c476,_0x171792))[_0xa8d0('0x55')](handleError(_0x37c476,null));};exports[_0xa8d0('0x70')]=function(_0x11a09a,_0x5b9cb3,_0x20ac47){var _0x4e9c0c={};var _0x4db794={};var _0x4badbd;var _0x4020e5;return db[_0xa8d0('0x51')][_0xa8d0('0x68')]({'where':{'id':_0x11a09a[_0xa8d0('0x57')]['id']}})['then'](handleEntityNotFound(_0x5b9cb3,null))['then'](function(_0x4d1539){if(_0x4d1539){_0x4badbd=_0x4d1539;_0x4db794[_0xa8d0('0x3f')]=_[_0xa8d0('0x41')](db[_0xa8d0('0x71')][_0xa8d0('0x3c')]);_0x4db794['query']=_[_0xa8d0('0x41')](_0x11a09a['query']);_0x4db794[_0xa8d0('0x42')]=_['intersection'](_0x4db794[_0xa8d0('0x3f')],_0x4db794['query']);_0x4e9c0c[_0xa8d0('0x45')]=_[_0xa8d0('0x43')](_0x4db794[_0xa8d0('0x3f')],qs[_0xa8d0('0x44')](_0x11a09a[_0xa8d0('0x40')][_0xa8d0('0x44')]));_0x4e9c0c[_0xa8d0('0x45')]=_0x4e9c0c['attributes'][_0xa8d0('0x46')]?_0x4e9c0c[_0xa8d0('0x45')]:_0x4db794[_0xa8d0('0x3f')];_0x4e9c0c['order']=qs['sort'](_0x11a09a['query'][_0xa8d0('0x4a')]);_0x4e9c0c['where']=qs[_0xa8d0('0x42')](_[_0xa8d0('0x4c')](_0x11a09a[_0xa8d0('0x40')],_0x4db794[_0xa8d0('0x42')]));if(_0x11a09a['query'][_0xa8d0('0x4f')]){_0x4e9c0c['where']=_[_0xa8d0('0x4d')](_0x4e9c0c[_0xa8d0('0x4b')],{'$or':_[_0xa8d0('0x34')](_0x4e9c0c[_0xa8d0('0x45')],function(_0x44c560){var _0x521d28={};_0x521d28[_0x44c560]={'$like':'%'+_0x11a09a[_0xa8d0('0x40')][_0xa8d0('0x4f')]+'%'};return _0x521d28;})});}_0x4e9c0c=_[_0xa8d0('0x4d')]({},_0x4e9c0c,_0x11a09a[_0xa8d0('0x50')]);return _0x4badbd['getTeams'](_0x4e9c0c);}})[_0xa8d0('0x2c')](function(_0xd9cba2){if(_0xd9cba2){_0x4020e5=_0xd9cba2[_0xa8d0('0x46')];if(!_0x11a09a[_0xa8d0('0x40')][_0xa8d0('0x47')](_0xa8d0('0x48'))){_0x4e9c0c[_0xa8d0('0x24')]=qs[_0xa8d0('0x24')](_0x11a09a[_0xa8d0('0x40')][_0xa8d0('0x24')]);_0x4e9c0c[_0xa8d0('0x23')]=qs[_0xa8d0('0x23')](_0x11a09a[_0xa8d0('0x40')]['offset']);}return _0x4badbd['getTeams'](_0x4e9c0c);}})[_0xa8d0('0x2c')](function(_0x1f398d){if(_0x1f398d){return _0x1f398d?{'count':_0x4020e5,'rows':_0x1f398d}:null;}})[_0xa8d0('0x2c')](respondWithResult(_0x5b9cb3,null))[_0xa8d0('0x55')](handleError(_0x5b9cb3,null));};exports[_0xa8d0('0x72')]=function(_0x577255,_0x92c5a8,_0x39eeec){var _0x3af9a3=_0x577255[_0xa8d0('0x5a')][_0xa8d0('0x73')];var _0x1c6d52=_[_0xa8d0('0x34')](_0x3af9a3,'id');return db[_0xa8d0('0x71')]['findAll']({'where':{'id':_0x1c6d52},'attributes':['id'],'include':[{'model':db[_0xa8d0('0x74')],'as':_0xa8d0('0x75'),'attributes':['id',_0xa8d0('0x38'),'online','voicePause',_0xa8d0('0x76')],'raw':!![]}]})['then'](function(_0x5a123a){if(_0x5a123a){var _0x5cea52=_[_0xa8d0('0x77')](_0x5a123a,function(_0x5e58ae){var _0x143523=_0x5e58ae['get']({'plain':!![]});_0x143523[_0xa8d0('0x75')][_0xa8d0('0x78')](function(_0x594947){_0x594947[_0xa8d0('0x79')]=_[_0xa8d0('0x36')](_0x3af9a3,{'id':_0x143523['id']})['penalty'];});return _0x143523[_0xa8d0('0x75')];});return db[_0xa8d0('0x51')][_0xa8d0('0x36')]({'where':{'id':_0x577255[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](function(_0x35a253){return db['sequelize'][_0xa8d0('0x7a')](function(_0x1bb9f0){return _0x35a253[_0xa8d0('0x72')](_0x1c6d52,{'transaction':_0x1bb9f0})['then'](function(){return BPromise[_0xa8d0('0x7b')](_0x3af9a3,function(_0x13a361){return db[_0xa8d0('0x7c')][_0xa8d0('0x7d')]({'TeamId':_0x13a361['id'],'VoiceQueueId':_0x577255[_0xa8d0('0x57')]['id'],'penalty':_0x13a361['penalty']},{'transaction':_0x1bb9f0});});})['then'](function(){return BPromise[_0xa8d0('0x7b')](_0x5cea52,function(_0x56ae12){return db[_0xa8d0('0x7e')][_0xa8d0('0x7f')]({'where':{'UserId':_0x56ae12['id'],'VoiceQueueId':_0x577255[_0xa8d0('0x57')]['id']},'defaults':{'penalty':_0x56ae12['penalty']},'transaction':_0x1bb9f0});});})[_0xa8d0('0x2c')](function(){return BPromise[_0xa8d0('0x7b')](_[_0xa8d0('0x4f')](_0x5cea52,{'online':!![]}),function(_0x530404){return db[_0xa8d0('0x80')][_0xa8d0('0x7d')]({'membername':_0x530404['name'],'UserId':_0x530404['id'],'queue_name':_0x35a253[_0xa8d0('0x38')],'VoiceQueueId':_0x35a253['id'],'interface':_[_0xa8d0('0x81')](_0x530404[_0xa8d0('0x76')])?util[_0xa8d0('0x82')]('SIP/%s',_0x530404[_0xa8d0('0x38')]):_0x530404[_0xa8d0('0x76')],'paused':_0x530404[_0xa8d0('0x83')]||![],'penalty':_0x530404[_0xa8d0('0x79')]},{'transaction':_0x1bb9f0});});})['then'](function(){_0x5cea52['forEach'](function(_0x1f795f){socket['emit']('userVoiceQueue:save',{'UserId':_0x1f795f['id'],'VoiceQueueId':_0x35a253['id']});});});});});}})[_0xa8d0('0x2c')](respondWithStatusCode(_0x92c5a8,null))['catch'](handleError(_0x92c5a8,null));};exports[_0xa8d0('0x84')]=function(_0x5c4014,_0x5718b0,_0x5b674d){return db[_0xa8d0('0x71')][_0xa8d0('0x53')]({'where':{'id':_0x5c4014[_0xa8d0('0x40')][_0xa8d0('0x85')]},'attributes':['id'],'include':[{'model':db[_0xa8d0('0x74')],'as':_0xa8d0('0x75'),'attributes':['id'],'raw':!![]}]})[_0xa8d0('0x2c')](handleEntityNotFound(_0x5718b0,null))['then'](function(_0x5bc9fc){var _0x44ffba=_[_0xa8d0('0x34')](_0x5bc9fc,'id');var _0x2ef008=[];var _0x5562d8=[];var _0x4750a5=squel[_0xa8d0('0x86')]();_0x4750a5['field'](_0xa8d0('0x87'))['from'](_0xa8d0('0x88'),'tq')['join'](_0xa8d0('0x89'),'ut',_0xa8d0('0x8a'))[_0xa8d0('0x4b')]('VoiceQueueId\x20=\x20?',_0x5c4014[_0xa8d0('0x57')]['id']);for(var _0x57e85d=0x0;_0x57e85d<_0x5bc9fc[_0xa8d0('0x46')];_0x57e85d+=0x1){let _0x46c417=_0x5bc9fc[_0x57e85d];for(var _0x2b5dc6=0x0;_0x2b5dc6<_0x46c417['Agents'][_0xa8d0('0x46')];_0x2b5dc6+=0x1){let _0xdd17d3=_0x46c417[_0xa8d0('0x75')][_0x2b5dc6];var _0x1f41dc=_0x4750a5[_0xa8d0('0x62')]();_0x1f41dc['where'](_0xa8d0('0x8b'),_0xdd17d3['id']);_0x5562d8['push'](db['sequelize'][_0xa8d0('0x40')](_0x1f41dc[_0xa8d0('0x8c')](),{'type':db['sequelize'][_0xa8d0('0x8d')][_0xa8d0('0x8e')]})[_0xa8d0('0x2c')](function(_0x2c3a62){if(_0x2c3a62[_0xa8d0('0x46')]===0x1){return _0xdd17d3['id'];}else{var _0x31245d=_[_0xa8d0('0x8f')](_[_0xa8d0('0x34')](_0x2c3a62,_0xa8d0('0x90')),function(_0x2ff43b){return _['includes'](_0x44ffba,_0x2ff43b);});if(_0x31245d){return _0xdd17d3['id'];}}}));}}return BPromise[_0xa8d0('0x91')](_0x5562d8)[_0xa8d0('0x2c')](function(_0x2eb444){_0x2ef008=_(_0x2ef008)[_0xa8d0('0x92')](_0x2eb444)[_0xa8d0('0x93')]()[_0xa8d0('0x35')]();return db[_0xa8d0('0x51')]['find']({'where':{'id':_0x5c4014['params']['id']}})[_0xa8d0('0x2c')](function(_0xde05fb){return db[_0xa8d0('0x94')][_0xa8d0('0x7a')](function(_0x51d6bf){return _0xde05fb[_0xa8d0('0x84')](_0x5c4014[_0xa8d0('0x40')][_0xa8d0('0x85')],{'transaction':_0x51d6bf})[_0xa8d0('0x2c')](function(){if(!_['isEmpty'](_0x2ef008)){return _0xde05fb[_0xa8d0('0x95')](_0x2ef008,{'transaction':_0x51d6bf})['then'](function(){return db[_0xa8d0('0x80')]['destroy']({'where':{'VoiceQueueId':_0x5c4014[_0xa8d0('0x57')]['id'],'UserId':_0x2ef008},'transaction':_0x51d6bf});});}})['then'](function(){_0x2ef008[_0xa8d0('0x78')](function(_0x4d0b67){socket[_0xa8d0('0x96')](_0xa8d0('0x97'),{'UserId':_0x4d0b67,'VoiceQueueId':_0xde05fb['id']});});});});});});})[_0xa8d0('0x2c')](respondWithStatusCode(_0x5718b0,null))[_0xa8d0('0x55')](handleError(_0x5718b0,null));};exports[_0xa8d0('0x98')]=function(_0x13cedf,_0x369968,_0x124c90){var _0x1ee414,_0x56e8e1;return db['VoiceQueue'][_0xa8d0('0x36')]({'where':{'id':_0x13cedf[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x369968,null))[_0xa8d0('0x2c')](function(_0x472e25){if(_0x472e25){_0x56e8e1=_0x472e25;return _0x472e25[_0xa8d0('0x98')](_0x13cedf['body'][_0xa8d0('0x85')],_[_0xa8d0('0x63')](_0x13cedf[_0xa8d0('0x5a')],['ids','id'])||{})[_0xa8d0('0x99')](function(_0x130780){for(var _0x27b285=0x0;_0x27b285<_0x13cedf[_0xa8d0('0x5a')][_0xa8d0('0x85')][_0xa8d0('0x46')];_0x27b285+=0x1){socket[_0xa8d0('0x96')](_0xa8d0('0x9a'),{'UserId':Number(_0x13cedf[_0xa8d0('0x5a')][_0xa8d0('0x85')][_0x27b285]),'VoiceQueueId':Number(_0x13cedf[_0xa8d0('0x57')]['id'])});}return _0x130780;});}})[_0xa8d0('0x2c')](function(_0x41cbf7){_0x1ee414=_0x41cbf7||[];if(_0x56e8e1){return db[_0xa8d0('0x74')][_0xa8d0('0x53')]({'where':{'id':_0x13cedf[_0xa8d0('0x5a')]['ids']},'attributes':['id',_0xa8d0('0x38'),_0xa8d0('0x9b'),'voicePause',_0xa8d0('0x76')],'raw':!![]});}})['then'](function(_0x192ebf){if(!_['isEmpty'](_0x192ebf)){var _0x2624c3=[];for(var _0x213782=0x0;_0x213782<_0x192ebf['length'];_0x213782++){if(_0x192ebf[_0x213782][_0xa8d0('0x9b')]){_0x2624c3['push'](db[_0xa8d0('0x80')][_0xa8d0('0x7d')]({'membername':_0x192ebf[_0x213782]['name'],'UserId':_0x192ebf[_0x213782]['id'],'queue_name':_0x56e8e1['name'],'VoiceQueueId':_0x56e8e1['id'],'interface':_['isNil'](_0x192ebf[_0x213782][_0xa8d0('0x76')])?util[_0xa8d0('0x82')](_0xa8d0('0x9c'),_0x192ebf[_0x213782]['name']):_0x192ebf[_0x213782]['interface'],'paused':_0x192ebf[_0x213782][_0xa8d0('0x83')]||![],'penalty':_0x13cedf[_0xa8d0('0x5a')][_0xa8d0('0x79')]||0x0}));}}return BPromise[_0xa8d0('0x91')](_0x2624c3);}})[_0xa8d0('0x2c')](function(){return _0x1ee414;})[_0xa8d0('0x2c')](respondWithResult(_0x369968,null))[_0xa8d0('0x55')](handleError(_0x369968,null));};exports[_0xa8d0('0x95')]=function(_0x28eda7,_0x4fd9c4,_0x262f43){return db[_0xa8d0('0x51')]['find']({'where':{'id':_0x28eda7[_0xa8d0('0x57')]['id']}})['then'](handleEntityNotFound(_0x4fd9c4,null))[_0xa8d0('0x2c')](function(_0x54970f){if(_0x54970f){return _0x54970f[_0xa8d0('0x95')](_0x28eda7[_0xa8d0('0x40')][_0xa8d0('0x85')])[_0xa8d0('0x2c')](function(){if(_[_0xa8d0('0x9d')](_0x28eda7[_0xa8d0('0x40')][_0xa8d0('0x85')])){for(var _0x309505=0x0;_0x309505<_0x28eda7[_0xa8d0('0x40')][_0xa8d0('0x85')][_0xa8d0('0x46')];_0x309505+=0x1){socket[_0xa8d0('0x96')](_0xa8d0('0x97'),{'UserId':Number(_0x28eda7[_0xa8d0('0x40')][_0xa8d0('0x85')][_0x309505]),'VoiceQueueId':Number(_0x28eda7[_0xa8d0('0x57')]['id'])});}}else{socket[_0xa8d0('0x96')](_0xa8d0('0x97'),{'UserId':Number(_0x28eda7[_0xa8d0('0x40')][_0xa8d0('0x85')]),'VoiceQueueId':Number(_0x28eda7[_0xa8d0('0x57')]['id'])});}});}})['then'](function(_0x51ec65){return db[_0xa8d0('0x80')]['destroy']({'where':{'VoiceQueueId':_0x28eda7[_0xa8d0('0x57')]['id'],'UserId':_0x28eda7[_0xa8d0('0x40')][_0xa8d0('0x85')]}})[_0xa8d0('0x2c')](function(){return _0x51ec65;});})[_0xa8d0('0x2c')](respondWithStatusCode(_0x4fd9c4,null))[_0xa8d0('0x55')](handleError(_0x4fd9c4,null));};exports['getAgents']=function(_0x49a924,_0x44e5d9,_0x1bd36e){var _0x7c9c07={};var _0x5cb276={};var _0x1781ea;var _0x68ef0d;return db[_0xa8d0('0x51')][_0xa8d0('0x68')]({'where':{'id':_0x49a924['params']['id']}})['then'](handleEntityNotFound(_0x44e5d9,null))[_0xa8d0('0x2c')](function(_0x327b37){if(_0x327b37){_0x1781ea=_0x327b37;_0x5cb276[_0xa8d0('0x3f')]=_[_0xa8d0('0x41')](db[_0xa8d0('0x74')][_0xa8d0('0x3c')]);_0x5cb276[_0xa8d0('0x40')]=_['keys'](_0x49a924[_0xa8d0('0x40')]);_0x5cb276[_0xa8d0('0x42')]=_['intersection'](_0x5cb276[_0xa8d0('0x3f')],_0x5cb276[_0xa8d0('0x40')]);_0x7c9c07['attributes']=_['intersection'](_0x5cb276[_0xa8d0('0x3f')],qs[_0xa8d0('0x44')](_0x49a924['query'][_0xa8d0('0x44')]));_0x7c9c07[_0xa8d0('0x45')]=_0x7c9c07[_0xa8d0('0x45')][_0xa8d0('0x46')]?_0x7c9c07[_0xa8d0('0x45')]:_0x5cb276[_0xa8d0('0x3f')];_0x7c9c07['order']=qs[_0xa8d0('0x4a')](_0x49a924['query']['sort']);_0x7c9c07[_0xa8d0('0x4b')]=qs[_0xa8d0('0x42')](_[_0xa8d0('0x4c')](_0x49a924[_0xa8d0('0x40')],_0x5cb276['filters']));if(_0x49a924[_0xa8d0('0x40')]['filter']){_0x7c9c07[_0xa8d0('0x4b')]=_[_0xa8d0('0x4d')](_0x7c9c07['where'],{'$or':_['map'](_0x7c9c07[_0xa8d0('0x45')],function(_0x25be54){var _0x2c7820={};_0x2c7820[_0x25be54]={'$like':'%'+_0x49a924[_0xa8d0('0x40')][_0xa8d0('0x4f')]+'%'};return _0x2c7820;})});}_0x7c9c07=_[_0xa8d0('0x4d')]({},_0x7c9c07,_0x49a924['options']);return _0x1781ea[_0xa8d0('0x9e')](_0x7c9c07);}})[_0xa8d0('0x2c')](function(_0x192e5f){if(_0x192e5f){_0x68ef0d=_0x192e5f[_0xa8d0('0x46')];if(!_0x49a924['query'][_0xa8d0('0x47')](_0xa8d0('0x48'))){_0x7c9c07[_0xa8d0('0x24')]=qs[_0xa8d0('0x24')](_0x49a924[_0xa8d0('0x40')][_0xa8d0('0x24')]);_0x7c9c07[_0xa8d0('0x23')]=qs[_0xa8d0('0x23')](_0x49a924[_0xa8d0('0x40')][_0xa8d0('0x23')]);}return _0x1781ea[_0xa8d0('0x9e')](_0x7c9c07);}})[_0xa8d0('0x2c')](function(_0x492320){if(_0x492320){return _0x492320?{'count':_0x68ef0d,'rows':_0x492320}:null;}})[_0xa8d0('0x2c')](respondWithResult(_0x44e5d9,null))[_0xa8d0('0x55')](handleError(_0x44e5d9,null));};exports[_0xa8d0('0x9f')]=function(_0x4dbccf,_0x4a7886,_0x368a78){var _0x29b310={};var _0x259bbf={};var _0x4cd9e4;var _0x4a99a3;return db[_0xa8d0('0x51')][_0xa8d0('0x68')]({'where':{'id':_0x4dbccf['params']['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x4a7886,null))[_0xa8d0('0x2c')](function(_0x2c9187){if(_0x2c9187){_0x4cd9e4=_0x2c9187;_0x259bbf[_0xa8d0('0x3f')]=_['keys'](db[_0xa8d0('0x80')]['rawAttributes']);_0x259bbf[_0xa8d0('0x40')]=_['keys'](_0x4dbccf[_0xa8d0('0x40')]);_0x259bbf[_0xa8d0('0x42')]=_[_0xa8d0('0x43')](_0x259bbf[_0xa8d0('0x3f')],_0x259bbf[_0xa8d0('0x40')]);_0x29b310[_0xa8d0('0x45')]=_[_0xa8d0('0x43')](_0x259bbf[_0xa8d0('0x3f')],qs[_0xa8d0('0x44')](_0x4dbccf[_0xa8d0('0x40')]['fields']));_0x29b310['attributes']=_0x29b310[_0xa8d0('0x45')][_0xa8d0('0x46')]?_0x29b310[_0xa8d0('0x45')]:_0x259bbf[_0xa8d0('0x3f')];_0x29b310[_0xa8d0('0x49')]=qs['sort'](_0x4dbccf['query'][_0xa8d0('0x4a')]);_0x29b310['where']=qs[_0xa8d0('0x42')](_[_0xa8d0('0x4c')](_0x4dbccf[_0xa8d0('0x40')],_0x259bbf[_0xa8d0('0x42')]));if(_0x4dbccf['query'][_0xa8d0('0x4f')]){_0x29b310[_0xa8d0('0x4b')]=_[_0xa8d0('0x4d')](_0x29b310['where'],{'$or':_[_0xa8d0('0x34')](_0x29b310[_0xa8d0('0x45')],function(_0x595cd6){var _0x253660={};_0x253660[_0x595cd6]={'$like':'%'+_0x4dbccf[_0xa8d0('0x40')]['filter']+'%'};return _0x253660;})});}_0x29b310=_[_0xa8d0('0x4d')]({},_0x29b310,_0x4dbccf[_0xa8d0('0x50')]);return _0x4cd9e4[_0xa8d0('0x9f')](_0x29b310);}})['then'](function(_0x513eba){if(_0x513eba){_0x4a99a3=_0x513eba['length'];if(!_0x4dbccf[_0xa8d0('0x40')][_0xa8d0('0x47')]('nolimit')){_0x29b310[_0xa8d0('0x24')]=qs[_0xa8d0('0x24')](_0x4dbccf[_0xa8d0('0x40')][_0xa8d0('0x24')]);_0x29b310[_0xa8d0('0x23')]=qs[_0xa8d0('0x23')](_0x4dbccf['query']['offset']);}return _0x4cd9e4['getMembers'](_0x29b310);}})['then'](function(_0x22dd20){return _0x22dd20?{'count':_0x4a99a3,'rows':_0x22dd20}:null;})['then'](respondWithResult(_0x4a7886,null))[_0xa8d0('0x55')](handleError(_0x4a7886,null));};exports[_0xa8d0('0xa0')]=function(_0x58384b,_0x108a23,_0x55582c){var _0x52cfbd={};var _0x4acf8a={};var _0x902ea6;var _0x2b3482;return db[_0xa8d0('0x51')][_0xa8d0('0x68')]({'where':{'id':_0x58384b[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x108a23,null))[_0xa8d0('0x2c')](function(_0x3cf694){if(_0x3cf694){_0x902ea6=_0x3cf694;_0x4acf8a[_0xa8d0('0x3f')]=_['keys'](db[_0xa8d0('0xa1')]['rawAttributes']);_0x4acf8a[_0xa8d0('0x40')]=_['keys'](_0x58384b[_0xa8d0('0x40')]);_0x4acf8a[_0xa8d0('0x42')]=_[_0xa8d0('0x43')](_0x4acf8a['model'],_0x4acf8a['query']);_0x52cfbd[_0xa8d0('0x45')]=_['intersection'](_0x4acf8a[_0xa8d0('0x3f')],qs['fields'](_0x58384b[_0xa8d0('0x40')][_0xa8d0('0x44')]));_0x52cfbd[_0xa8d0('0x45')]=_0x52cfbd['attributes'][_0xa8d0('0x46')]?_0x52cfbd[_0xa8d0('0x45')]:_0x4acf8a[_0xa8d0('0x3f')];_0x52cfbd['order']=qs['sort'](_0x58384b[_0xa8d0('0x40')][_0xa8d0('0x4a')]);_0x52cfbd[_0xa8d0('0x4b')]=qs['filters'](_[_0xa8d0('0x4c')](_0x58384b[_0xa8d0('0x40')],_0x4acf8a[_0xa8d0('0x42')]));if(_0x58384b[_0xa8d0('0x40')][_0xa8d0('0x4f')]){_0x52cfbd[_0xa8d0('0x4b')]=_[_0xa8d0('0x4d')](_0x52cfbd[_0xa8d0('0x4b')],{'$or':_[_0xa8d0('0x34')](_0x52cfbd[_0xa8d0('0x45')],function(_0x28e307){var _0xfc6ca={};_0xfc6ca[_0x28e307]={'$like':'%'+_0x58384b['query']['filter']+'%'};return _0xfc6ca;})});}_0x52cfbd=_[_0xa8d0('0x4d')]({},_0x52cfbd,_0x58384b['options']);return _0x902ea6[_0xa8d0('0xa0')](_0x52cfbd);}})[_0xa8d0('0x2c')](function(_0xd12287){if(_0xd12287){_0x2b3482=_0xd12287['length'];if(!_0x58384b[_0xa8d0('0x40')][_0xa8d0('0x47')](_0xa8d0('0x48'))){_0x52cfbd[_0xa8d0('0x24')]=qs['limit'](_0x58384b['query'][_0xa8d0('0x24')]);_0x52cfbd[_0xa8d0('0x23')]=qs[_0xa8d0('0x23')](_0x58384b[_0xa8d0('0x40')]['offset']);}return _0x902ea6[_0xa8d0('0xa0')](_0x52cfbd);}})[_0xa8d0('0x2c')](function(_0x54b480){if(_0x54b480){return _0x54b480?{'count':_0x2b3482,'rows':_0x54b480}:null;}})[_0xa8d0('0x2c')](respondWithResult(_0x108a23,null))['catch'](handleError(_0x108a23,null));};exports[_0xa8d0('0xa2')]=function(_0x42a32f,_0x257c22,_0x490153){var _0xd3511b=moment()[_0xa8d0('0x82')](_0xa8d0('0xa3'));var _0x21bc45,_0x1e91ba;return db[_0xa8d0('0x51')][_0xa8d0('0x36')]({'where':{'id':_0x42a32f[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x257c22,null))[_0xa8d0('0x2c')](function(_0x5af163){if(_0x5af163){_0x1e91ba=_0x5af163;return _0x5af163[_0xa8d0('0xa2')](_0x42a32f[_0xa8d0('0x5a')]['ids'],_[_0xa8d0('0x63')](_0x42a32f[_0xa8d0('0x5a')],['ids','id'])||{});}return null;})[_0xa8d0('0x99')](function(_0x1fb9da){var _0x4eaa88;_0x21bc45=_0x1fb9da||[];var _0x4d6cde=[];if(_0x1fb9da){for(var _0x12117a=0x0;_0x12117a<_0x1fb9da['length'];_0x12117a+=0x1){var _0x2f2501=_0x1fb9da[_0x12117a][_0xa8d0('0x2e')]({'plain':!![]});_0x1e91ba['dialCheckDuplicateType']=_0x42a32f[_0xa8d0('0x5a')][_0xa8d0('0xa4')]?_0x42a32f['body'][_0xa8d0('0xa4')]:_0x1e91ba[_0xa8d0('0xa4')];switch(_0x1e91ba[_0xa8d0('0xa4')]){case'always':_0x4eaa88=squel[_0xa8d0('0xa5')]()[_0xa8d0('0xa6')](_0xa8d0('0xa7'))['fromQuery'](['phone','scheduledAt',_0xa8d0('0xa8'),_0xa8d0('0xa9'),_0xa8d0('0x6a'),_0xa8d0('0x64'),_0xa8d0('0x65')],squel[_0xa8d0('0x86')]()['field'](_0xa8d0('0xaa'),'phone')[_0xa8d0('0xab')]('\x27'+_0xd3511b+'\x27',_0xa8d0('0xac'))['field']('id','ContactId')[_0xa8d0('0xab')](_0x2f2501[_0xa8d0('0xad')][_0xa8d0('0x8c')](),'ListId')[_0xa8d0('0xab')](_0x42a32f[_0xa8d0('0x57')]['id'][_0xa8d0('0x8c')](),_0xa8d0('0x6a'))[_0xa8d0('0xab')]('\x27'+_0xd3511b+'\x27',_0xa8d0('0x64'))[_0xa8d0('0xab')]('\x27'+_0xd3511b+'\x27',_0xa8d0('0x65'))[_0xa8d0('0xae')]('cm_contacts')['where'](_0xa8d0('0xaf'))['where'](_0xa8d0('0xb0'),_0x2f2501['CmListId'][_0xa8d0('0x8c')]())[_0xa8d0('0x4b')](_0xa8d0('0xb1'))[_0xa8d0('0x4b')]('phone\x20NOT\x20IN\x20(?)',squel[_0xa8d0('0x86')]()[_0xa8d0('0xab')]('COALESCE(calleridnum,\x27\x27)')[_0xa8d0('0xae')](_0xa8d0('0xb2'))[_0xa8d0('0x4b')](_0xa8d0('0xb3'),_0x42a32f[_0xa8d0('0x57')]['id'][_0xa8d0('0x8c')]()))['where'](_0xa8d0('0xb4'),squel[_0xa8d0('0x86')]()['field'](_0xa8d0('0xb5'))[_0xa8d0('0xae')]('cm_hopper')[_0xa8d0('0x4b')]('VoiceQueueId\x20=\x20?',_0x42a32f[_0xa8d0('0x57')]['id'][_0xa8d0('0x8c')]())))[_0xa8d0('0x8c')]();break;case _0xa8d0('0xb6'):_0x4eaa88=squel[_0xa8d0('0xa5')]()['into'](_0xa8d0('0xa7'))['fromQuery']([_0xa8d0('0xaa'),_0xa8d0('0xac'),_0xa8d0('0xa8'),_0xa8d0('0xa9'),_0xa8d0('0x6a'),'createdAt','updatedAt'],squel[_0xa8d0('0x86')]()['field'](_0xa8d0('0xaa'),_0xa8d0('0xaa'))[_0xa8d0('0xab')]('\x27'+_0xd3511b+'\x27',_0xa8d0('0xac'))['field']('id','ContactId')[_0xa8d0('0xab')](_0x2f2501[_0xa8d0('0xad')][_0xa8d0('0x8c')](),_0xa8d0('0xa9'))['field'](_0x42a32f[_0xa8d0('0x57')]['id'][_0xa8d0('0x8c')](),_0xa8d0('0x6a'))[_0xa8d0('0xab')]('\x27'+_0xd3511b+'\x27',_0xa8d0('0x64'))[_0xa8d0('0xab')]('\x27'+_0xd3511b+'\x27',_0xa8d0('0x65'))[_0xa8d0('0xae')]('cm_contacts')[_0xa8d0('0x4b')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x2f2501[_0xa8d0('0xad')][_0xa8d0('0x8c')]())[_0xa8d0('0x4b')](_0xa8d0('0xb1'))[_0xa8d0('0x4b')](_0xa8d0('0xb4'),squel['select']()[_0xa8d0('0xab')](_0xa8d0('0xb5'))['from'](_0xa8d0('0xa7'))[_0xa8d0('0x4b')](_0xa8d0('0xb3'),_0x42a32f[_0xa8d0('0x57')]['id'][_0xa8d0('0x8c')]())))[_0xa8d0('0x8c')]();break;default:_0x4eaa88=squel[_0xa8d0('0xa5')]()[_0xa8d0('0xa6')]('cm_hopper')[_0xa8d0('0xb7')]([_0xa8d0('0xaa'),_0xa8d0('0xac'),_0xa8d0('0xa8'),_0xa8d0('0xa9'),_0xa8d0('0x6a'),_0xa8d0('0x64'),_0xa8d0('0x65')],squel[_0xa8d0('0x86')]()[_0xa8d0('0xab')](_0xa8d0('0xaa'),_0xa8d0('0xaa'))['field']('\x27'+_0xd3511b+'\x27',_0xa8d0('0xac'))[_0xa8d0('0xab')]('id',_0xa8d0('0xa8'))[_0xa8d0('0xab')](_0x2f2501['CmListId'][_0xa8d0('0x8c')](),_0xa8d0('0xa9'))[_0xa8d0('0xab')](_0x42a32f[_0xa8d0('0x57')]['id'][_0xa8d0('0x8c')](),_0xa8d0('0x6a'))['field']('\x27'+_0xd3511b+'\x27',_0xa8d0('0x64'))[_0xa8d0('0xab')]('\x27'+_0xd3511b+'\x27','updatedAt')[_0xa8d0('0xae')](_0xa8d0('0xb8'))['where'](_0xa8d0('0xaf'))[_0xa8d0('0x4b')](_0xa8d0('0xb0'),_0x2f2501[_0xa8d0('0xad')]['toString']())[_0xa8d0('0x4b')](_0xa8d0('0xb1')))['toString']();}_0x4d6cde[_0xa8d0('0xb9')](db['sequelize'][_0xa8d0('0x40')](_0x4eaa88));}return BPromise[_0xa8d0('0x91')](_0x4d6cde);}})[_0xa8d0('0x2c')](function(){var _0x50db81=[];var _0x59fa68=squel[_0xa8d0('0xa5')]()[_0xa8d0('0xa6')](_0xa8d0('0xba'))[_0xa8d0('0xb7')]([_0xa8d0('0xbb'),_0xa8d0('0xaa'),_0xa8d0('0xbc'),_0xa8d0('0x64'),'updatedAt'],squel[_0xa8d0('0x86')]()[_0xa8d0('0xab')](_0xa8d0('0xbd'))[_0xa8d0('0xab')](_0xa8d0('0xbe'))[_0xa8d0('0xab')](_0xa8d0('0xbf'))[_0xa8d0('0xab')]('\x27'+_0xd3511b+'\x27',_0xa8d0('0x64'))[_0xa8d0('0xab')]('\x27'+_0xd3511b+'\x27','updatedAt')['from'](_0xa8d0('0xc0'),'ci')['join'](_0xa8d0('0xa7'),'h','h.ContactId=ci.CmContactId')[_0xa8d0('0x4b')](_0xa8d0('0xc1'),_0xd3511b)[_0xa8d0('0x4b')](_0xa8d0('0xc2'),_0xa8d0('0xc3')))[_0xa8d0('0x8c')]();_0x50db81['push'](db[_0xa8d0('0x94')]['query'](_0x59fa68));return BPromise[_0xa8d0('0x91')](_0x50db81);})['then'](function(){return _0x21bc45;})['then'](respondWithResult(_0x257c22,null))[_0xa8d0('0x55')](handleError(_0x257c22,null));};exports[_0xa8d0('0xc4')]=function(_0x25cc04,_0x579d20,_0x1da1a3){return db[_0xa8d0('0x51')]['find']({'where':{'id':_0x25cc04[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x579d20,null))[_0xa8d0('0x2c')](function(_0x792d08){if(_0x792d08){return _0x792d08[_0xa8d0('0xc4')](_0x25cc04[_0xa8d0('0x40')][_0xa8d0('0x85')]);}})[_0xa8d0('0x2c')](function(_0x510545){if(_0x510545){return db[_0xa8d0('0x69')][_0xa8d0('0x2d')]({'where':{'ListId':_0x25cc04[_0xa8d0('0x40')][_0xa8d0('0x85')],'VoiceQueueId':_0x25cc04[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](function(){return _0x510545;});}})[_0xa8d0('0x2c')](respondWithStatusCode(_0x579d20,null))[_0xa8d0('0x55')](handleError(_0x579d20,null));};exports['getBlackLists']=function(_0x86125f,_0xe54c2c,_0x1e5e21){var _0x2f0b87={};var _0xd48b0={};var _0x3664fc;var _0x3adff8;return db[_0xa8d0('0x51')]['findOne']({'where':{'id':_0x86125f[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0xe54c2c,null))['then'](function(_0x1d7a59){if(_0x1d7a59){_0x3664fc=_0x1d7a59;_0xd48b0['model']=_[_0xa8d0('0x41')](db[_0xa8d0('0xa1')]['rawAttributes']);_0xd48b0[_0xa8d0('0x40')]=_['keys'](_0x86125f[_0xa8d0('0x40')]);_0xd48b0[_0xa8d0('0x42')]=_['intersection'](_0xd48b0[_0xa8d0('0x3f')],_0xd48b0['query']);_0x2f0b87[_0xa8d0('0x45')]=_['intersection'](_0xd48b0[_0xa8d0('0x3f')],qs['fields'](_0x86125f[_0xa8d0('0x40')][_0xa8d0('0x44')]));_0x2f0b87[_0xa8d0('0x45')]=_0x2f0b87[_0xa8d0('0x45')]['length']?_0x2f0b87[_0xa8d0('0x45')]:_0xd48b0[_0xa8d0('0x3f')];_0x2f0b87[_0xa8d0('0x49')]=qs[_0xa8d0('0x4a')](_0x86125f[_0xa8d0('0x40')][_0xa8d0('0x4a')]);_0x2f0b87[_0xa8d0('0x4b')]=qs[_0xa8d0('0x42')](_[_0xa8d0('0x4c')](_0x86125f['query'],_0xd48b0['filters']));if(_0x86125f[_0xa8d0('0x40')][_0xa8d0('0x4f')]){_0x2f0b87[_0xa8d0('0x4b')]=_[_0xa8d0('0x4d')](_0x2f0b87['where'],{'$or':_[_0xa8d0('0x34')](_0x2f0b87['attributes'],function(_0x3b6de4){var _0x45d6db={};_0x45d6db[_0x3b6de4]={'$like':'%'+_0x86125f['query'][_0xa8d0('0x4f')]+'%'};return _0x45d6db;})});}_0x2f0b87=_[_0xa8d0('0x4d')]({},_0x2f0b87,_0x86125f[_0xa8d0('0x50')]);return _0x3664fc[_0xa8d0('0xc5')](_0x2f0b87);}})[_0xa8d0('0x2c')](function(_0x5e90a6){if(_0x5e90a6){_0x3adff8=_0x5e90a6[_0xa8d0('0x46')];if(!_0x86125f[_0xa8d0('0x40')][_0xa8d0('0x47')]('nolimit')){_0x2f0b87[_0xa8d0('0x24')]=qs[_0xa8d0('0x24')](_0x86125f[_0xa8d0('0x40')][_0xa8d0('0x24')]);_0x2f0b87[_0xa8d0('0x23')]=qs[_0xa8d0('0x23')](_0x86125f['query'][_0xa8d0('0x23')]);}return _0x3664fc[_0xa8d0('0xc5')](_0x2f0b87);}})[_0xa8d0('0x2c')](function(_0x564c74){if(_0x564c74){return _0x564c74?{'count':_0x3adff8,'rows':_0x564c74}:null;}})[_0xa8d0('0x2c')](respondWithResult(_0xe54c2c,null))['catch'](handleError(_0xe54c2c,null));};exports[_0xa8d0('0xc6')]=function(_0x4547bb,_0x30c489,_0xe7d718){var _0xd7eeda,_0x135408;return db[_0xa8d0('0x51')][_0xa8d0('0x36')]({'where':{'id':_0x4547bb[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](handleEntityNotFound(_0x30c489,null))[_0xa8d0('0x2c')](function(_0x4588ba){if(_0x4588ba){_0x135408=_0x4588ba;return _0x4588ba[_0xa8d0('0xc6')](_0x4547bb['body'][_0xa8d0('0x85')],_[_0xa8d0('0x63')](_0x4547bb[_0xa8d0('0x5a')],['ids','id'])||{});}return null;})[_0xa8d0('0x99')](function(_0x12c15f){var _0x22b746;_0xd7eeda=_0x12c15f||[];var _0x295fa5=[];if(_0x12c15f){for(var _0x262779=0x0;_0x262779<_0x12c15f['length'];_0x262779+=0x1){var _0x339f76=_0x12c15f[_0x262779][_0xa8d0('0x2e')]({'plain':!![]});_0x22b746=squel['insert']()[_0xa8d0('0xa6')]('cm_hopper_black')[_0xa8d0('0xb7')]([_0xa8d0('0xaa'),_0xa8d0('0xa8'),_0xa8d0('0xa9'),'VoiceQueueId',_0xa8d0('0x64'),_0xa8d0('0x65')],squel[_0xa8d0('0x86')]()['field'](_0xa8d0('0xaa'),'phone')[_0xa8d0('0xab')]('id','ContactId')[_0xa8d0('0xab')](_0x339f76[_0xa8d0('0xad')][_0xa8d0('0x8c')](),'ListId')['field'](_0x4547bb['params']['id'][_0xa8d0('0x8c')](),_0xa8d0('0x6a'))[_0xa8d0('0xab')](_0xa8d0('0xc7'),_0xa8d0('0x64'))[_0xa8d0('0xab')](_0xa8d0('0xc7'),'updatedAt')[_0xa8d0('0xae')](_0xa8d0('0xb8'))[_0xa8d0('0x4b')]('deletedAt\x20IS\x20NULL')[_0xa8d0('0x4b')]('ListId\x20=\x20?',_0x339f76[_0xa8d0('0xad')]['toString']())[_0xa8d0('0x4b')]('phone\x20IS\x20NOT\x20NULL'))[_0xa8d0('0x8c')]();_0x295fa5[_0xa8d0('0xb9')](db[_0xa8d0('0x94')][_0xa8d0('0x40')](_0x22b746));}return BPromise['all'](_0x295fa5);}})['then'](function(){return _0xd7eeda;})[_0xa8d0('0x2c')](respondWithResult(_0x30c489,null))['catch'](handleError(_0x30c489,null));};exports[_0xa8d0('0xc8')]=function(_0x2c1c6a,_0x534ab4,_0x2a89e6){return db[_0xa8d0('0x51')]['find']({'where':{'id':_0x2c1c6a[_0xa8d0('0x57')]['id']}})['then'](handleEntityNotFound(_0x534ab4,null))[_0xa8d0('0x2c')](function(_0x3b3066){if(_0x3b3066){return _0x3b3066[_0xa8d0('0xc8')](_0x2c1c6a['query'][_0xa8d0('0x85')]);}})[_0xa8d0('0x2c')](function(_0x46ea24){if(_0x46ea24){return db[_0xa8d0('0x6f')]['destroy']({'where':{'ListId':_0x2c1c6a[_0xa8d0('0x40')][_0xa8d0('0x85')],'VoiceQueueId':_0x2c1c6a[_0xa8d0('0x57')]['id']}})[_0xa8d0('0x2c')](function(){return _0x46ea24;});}})[_0xa8d0('0x2c')](respondWithStatusCode(_0x534ab4,null))[_0xa8d0('0x55')](handleError(_0x534ab4,null));}; \ No newline at end of file +var _0x4f0d=['findOrCreate','UserVoiceQueueRt','format','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','compact','isEmpty','userVoiceQueue:remove','addAgents','spread','push','isNil','SIP/%s','all','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','h.ContactId=ci.CmContactId','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','type','find','name','UserProfileResource','error','stack','send','index','VoiceQueue','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','createdAt','updatedAt','omit','UserProfileSection','getHoppers','findOne','CmHopper','nolimit','getHopperHistories','CmHopperHistory','VoiceQueueId','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','forEach','penalty','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue'];(function(_0x273ecc,_0x5bb90d){var _0x25467d=function(_0x29cd85){while(--_0x29cd85){_0x273ecc['push'](_0x273ecc['shift']());}};_0x25467d(++_0x5bb90d);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x27062d,_0x24b179){_0x27062d=_0x27062d-0x0;var _0x4f1478=_0x4f0d[_0x27062d];return _0x4f1478;};'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('request-promise');var moment=require(_0xd4f0('0x0'));var BPromise=require(_0xd4f0('0x1'));var Mustache=require(_0xd4f0('0x2'));var util=require('util');var path=require(_0xd4f0('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4f0('0x4'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd4f0('0x5'));var squel=require(_0xd4f0('0x6'));var crypto=require('crypto');var jsforce=require(_0xd4f0('0x7'));var deskjs=require(_0xd4f0('0x8'));var toCsv=require(_0xd4f0('0x9'));var querystring=require(_0xd4f0('0xa'));var Papa=require(_0xd4f0('0xb'));var Redis=require('ioredis');var authService=require(_0xd4f0('0xc'));var qs=require(_0xd4f0('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd4f0('0xe'))(_0xd4f0('0xf'));var utils=require('../../config/utils');var config=require(_0xd4f0('0x10'));var licenseUtil=require(_0xd4f0('0x11'));var db=require(_0xd4f0('0x12'))['db'];config[_0xd4f0('0x13')]=_[_0xd4f0('0x14')](config['redis'],{'host':_0xd4f0('0x15'),'port':0x18eb});var socket=require(_0xd4f0('0x16'))(new Redis(config[_0xd4f0('0x13')]));require(_0xd4f0('0x17'))[_0xd4f0('0x18')](socket);function respondWithStatusCode(_0x544936,_0x100cd4){_0x100cd4=_0x100cd4||0xcc;return function(_0x386f84){if(_0x386f84){return _0x544936[_0xd4f0('0x19')](_0x100cd4);}return _0x544936[_0xd4f0('0x1a')](_0x100cd4)[_0xd4f0('0x1b')]();};}function respondWithResult(_0x2dd02d,_0x4f8e76){_0x4f8e76=_0x4f8e76||0xc8;return function(_0x5adf8a){if(_0x5adf8a){return _0x2dd02d[_0xd4f0('0x1a')](_0x4f8e76)[_0xd4f0('0x1c')](_0x5adf8a);}};}function respondWithFilteredResult(_0xff90e,_0x7b2ca4){return function(_0x4d0dcc){if(_0x4d0dcc){var _0x5bf265=typeof _0x7b2ca4[_0xd4f0('0x1d')]===_0xd4f0('0x1e')&&typeof _0x7b2ca4[_0xd4f0('0x1f')]===_0xd4f0('0x1e');var _0x7560d6=_0x4d0dcc[_0xd4f0('0x20')];var _0x57d418=_0x5bf265?0x0:_0x7b2ca4[_0xd4f0('0x1d')];var _0x2f0b79=_0x5bf265?_0x4d0dcc[_0xd4f0('0x20')]:_0x7b2ca4['offset']+_0x7b2ca4[_0xd4f0('0x1f')];var _0x474c22;if(_0x2f0b79>=_0x7560d6){_0x2f0b79=_0x7560d6;_0x474c22=0xc8;}else{_0x474c22=0xce;}_0xff90e[_0xd4f0('0x1a')](_0x474c22);return _0xff90e['set'](_0xd4f0('0x21'),_0x57d418+'-'+_0x2f0b79+'/'+_0x7560d6)[_0xd4f0('0x1c')](_0x4d0dcc);}return null;};}function patchUpdates(_0x655480){return function(_0x5b94bb){try{jsonpatch[_0xd4f0('0x22')](_0x5b94bb,_0x655480,!![]);}catch(_0x174e52){return BPromise[_0xd4f0('0x23')](_0x174e52);}return _0x5b94bb[_0xd4f0('0x24')]();};}function saveUpdates(_0x4fd650,_0x1552e9){return function(_0x3345c6){if(_0x3345c6){return _0x3345c6[_0xd4f0('0x25')](_0x4fd650)[_0xd4f0('0x26')](function(_0x5f4858){return _0x5f4858;});}return null;};}function removeEntity(_0x37e8a1,_0x49b94b){return function(_0x15e310){if(_0x15e310){return _0x15e310[_0xd4f0('0x27')]()[_0xd4f0('0x26')](function(){var _0x22d385=_0x15e310[_0xd4f0('0x28')]({'plain':!![]});var _0x2f4291=[{'name':_0xd4f0('0x29'),'value':_0xd4f0('0x2a'),'ignore':![]},{'name':_0xd4f0('0x2b'),'value':_0xd4f0('0x2c'),'ignore':![]}];var _0xe2bf28=_(_0x2f4291)['filter'](_0xd4f0('0x2d'))[_0xd4f0('0x2e')](_0xd4f0('0x2f'))[_0xd4f0('0x2f')]();if(_['includes'](_0xe2bf28,_0x22d385[_0xd4f0('0x30')])){return;}var _0x27427c=_[_0xd4f0('0x31')](_0x2f4291,[_0xd4f0('0x2f'),_0x22d385['type']])[_0xd4f0('0x32')];return db[_0xd4f0('0x33')][_0xd4f0('0x27')]({'where':{'type':_0x27427c,'resourceId':_0x22d385['id']}})[_0xd4f0('0x26')](function(){return _0x15e310;});})['then'](function(){_0x37e8a1[_0xd4f0('0x1a')](0xcc)[_0xd4f0('0x1b')]();});}};}function handleEntityNotFound(_0x39153a,_0x416209){return function(_0x30ef92){if(!_0x30ef92){_0x39153a[_0xd4f0('0x19')](0x194);}return _0x30ef92;};}function handleError(_0x3eb203,_0x283e1b){_0x283e1b=_0x283e1b||0x1f4;return function(_0x177f7c){logger[_0xd4f0('0x34')](_0x177f7c[_0xd4f0('0x35')]);if(_0x177f7c['name']){delete _0x177f7c[_0xd4f0('0x32')];}_0x3eb203[_0xd4f0('0x1a')](_0x283e1b)[_0xd4f0('0x36')](_0x177f7c);};}exports[_0xd4f0('0x37')]=function(_0x1d4777,_0x5a48a3){var _0x1d2d09={},_0x46e74d={},_0x515aad={'count':0x0,'rows':[]};var _0x431118=_[_0xd4f0('0x2e')](db[_0xd4f0('0x38')]['rawAttributes'],function(_0xf63538){return{'name':_0xf63538['fieldName'],'type':_0xf63538['type']['key']};});_0x46e74d[_0xd4f0('0x39')]=_[_0xd4f0('0x2e')](_0x431118,_0xd4f0('0x32'));_0x46e74d[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x1d4777['query']);_0x46e74d['filters']=_[_0xd4f0('0x3c')](_0x46e74d[_0xd4f0('0x39')],_0x46e74d[_0xd4f0('0x3a')]);_0x1d2d09['attributes']=_[_0xd4f0('0x3c')](_0x46e74d[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x1d4777['query'][_0xd4f0('0x3d')]));_0x1d2d09['attributes']=_0x1d2d09[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0x1d2d09[_0xd4f0('0x3e')]:_0x46e74d[_0xd4f0('0x39')];if(!_0x1d4777[_0xd4f0('0x3a')][_0xd4f0('0x40')]('nolimit')){_0x1d2d09['limit']=qs[_0xd4f0('0x1f')](_0x1d4777[_0xd4f0('0x3a')]['limit']);_0x1d2d09[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x1d4777[_0xd4f0('0x3a')][_0xd4f0('0x1d')]);}_0x1d2d09[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x1d4777['query'][_0xd4f0('0x42')]);_0x1d2d09[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x1d4777[_0xd4f0('0x3a')],_0x46e74d[_0xd4f0('0x44')]),_0x431118);if(_0x1d4777['query'][_0xd4f0('0x46')]){_0x1d2d09[_0xd4f0('0x43')]=_['merge'](_0x1d2d09['where'],{'$or':_[_0xd4f0('0x2e')](_0x431118,function(_0x1cce51){if(_0x1cce51[_0xd4f0('0x30')]!=='VIRTUAL'){var _0x4af132={};_0x4af132[_0x1cce51[_0xd4f0('0x32')]]={'$like':'%'+_0x1d4777[_0xd4f0('0x3a')][_0xd4f0('0x46')]+'%'};return _0x4af132;}})});}_0x1d2d09=_[_0xd4f0('0x47')]({},_0x1d2d09,_0x1d4777[_0xd4f0('0x48')]);var _0x128e50={'where':_0x1d2d09[_0xd4f0('0x43')]};return db[_0xd4f0('0x38')][_0xd4f0('0x20')](_0x128e50)[_0xd4f0('0x26')](function(_0x2aa578){_0x515aad[_0xd4f0('0x20')]=_0x2aa578;if(_0x1d4777[_0xd4f0('0x3a')]['includeAll']){_0x1d2d09[_0xd4f0('0x49')]=[{'all':!![]}];}return db['VoiceQueue'][_0xd4f0('0x4a')](_0x1d2d09);})['then'](function(_0x2dca62){_0x515aad[_0xd4f0('0x4b')]=_0x2dca62;return _0x515aad;})[_0xd4f0('0x26')](respondWithFilteredResult(_0x5a48a3,_0x1d2d09))['catch'](handleError(_0x5a48a3,null));};exports[_0xd4f0('0x4c')]=function(_0x2cf57a,_0x59a7ea){var _0x3e6a62={'raw':![],'where':{'id':_0x2cf57a[_0xd4f0('0x4d')]['id']}},_0x541e0b={};_0x541e0b[_0xd4f0('0x39')]=_['keys'](db[_0xd4f0('0x38')][_0xd4f0('0x4e')]);_0x541e0b[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x2cf57a[_0xd4f0('0x3a')]);_0x541e0b[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x541e0b[_0xd4f0('0x39')],_0x541e0b[_0xd4f0('0x3a')]);_0x3e6a62[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x541e0b[_0xd4f0('0x39')],qs['fields'](_0x2cf57a[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x3e6a62[_0xd4f0('0x3e')]=_0x3e6a62[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0x3e6a62['attributes']:_0x541e0b[_0xd4f0('0x39')];if(_0x2cf57a[_0xd4f0('0x3a')][_0xd4f0('0x4f')]){_0x3e6a62[_0xd4f0('0x49')]=[{'all':!![]}];}_0x3e6a62=_[_0xd4f0('0x47')]({},_0x3e6a62,_0x2cf57a[_0xd4f0('0x48')]);return db[_0xd4f0('0x38')][_0xd4f0('0x31')](_0x3e6a62)[_0xd4f0('0x26')](handleEntityNotFound(_0x59a7ea,null))[_0xd4f0('0x26')](respondWithResult(_0x59a7ea,null))[_0xd4f0('0x50')](handleError(_0x59a7ea,null));};exports[_0xd4f0('0x51')]=function(_0x38671d,_0x245001){return db[_0xd4f0('0x38')]['create'](_0x38671d[_0xd4f0('0x52')],{})['then'](function(_0x406b3f){var _0x1d42d1=_0x38671d[_0xd4f0('0x53')]['get']({'plain':!![]});if(!_0x1d42d1)throw new Error(_0xd4f0('0x54'));if(_0x1d42d1[_0xd4f0('0x55')]==='user'){var _0x19f971=_0x406b3f[_0xd4f0('0x28')]({'plain':!![]});var _0x1290ee=[{'name':_0xd4f0('0x29'),'value':'inbound'},{'name':_0xd4f0('0x2b'),'value':'outbound'}];var _0x382eaf=_[_0xd4f0('0x31')](_0x1290ee,[_0xd4f0('0x2f'),_0x19f971[_0xd4f0('0x30')]])[_0xd4f0('0x32')];return db['UserProfileSection']['find']({'where':{'name':_0x382eaf,'userProfileId':_0x1d42d1[_0xd4f0('0x56')]},'raw':!![]})[_0xd4f0('0x26')](function(_0x32044d){if(_0x32044d&&_0x32044d[_0xd4f0('0x57')]===0x0){return db[_0xd4f0('0x33')][_0xd4f0('0x51')]({'name':_0x19f971[_0xd4f0('0x32')],'resourceId':_0x19f971['id'],'type':_0x32044d[_0xd4f0('0x32')],'sectionId':_0x32044d['id']},{})[_0xd4f0('0x26')](function(){return _0x406b3f;});}else{return _0x406b3f;}})['catch'](function(_0xde8573){logger[_0xd4f0('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xde8573);throw _0xde8573;});}return _0x406b3f;})[_0xd4f0('0x26')](respondWithResult(_0x245001,0xc9))[_0xd4f0('0x50')](handleError(_0x245001,null));};exports[_0xd4f0('0x58')]=function(_0x1a0ca9,_0x5a4f9e){var _0x504f62={'where':{'id':_0x1a0ca9[_0xd4f0('0x4d')]['id']}},_0x461626={};_0x461626['model']=_['keys'](db[_0xd4f0('0x38')][_0xd4f0('0x4e')]);_0x504f62[_0xd4f0('0x3e')]=_['intersection'](_0x461626[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x1a0ca9[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x504f62['attributes']=_0x504f62['attributes'][_0xd4f0('0x3f')]?_0x504f62['attributes']:_0x461626[_0xd4f0('0x39')];if(_0x1a0ca9['query'][_0xd4f0('0x4f')]){_0x504f62[_0xd4f0('0x49')]=[{'all':!![]}];}_0x504f62=_['merge']({},_0x504f62,_0x1a0ca9[_0xd4f0('0x48')]);return db[_0xd4f0('0x38')][_0xd4f0('0x31')](_0x504f62)[_0xd4f0('0x26')](handleEntityNotFound(_0x5a4f9e,null))[_0xd4f0('0x26')](function(_0x25c333){if(_0x25c333){var _0x195fd=_0x25c333['get']({'plain':!![]});_0x195fd=qs['omit'](_0x195fd,['id',_0xd4f0('0x59'),_0xd4f0('0x5a')]);_0x1a0ca9['body']=_[_0xd4f0('0x5b')](_0x1a0ca9['body'],['id',_0xd4f0('0x59'),_0xd4f0('0x5a')]);return db[_0xd4f0('0x38')][_0xd4f0('0x51')](_[_0xd4f0('0x47')](_0x195fd,_0x1a0ca9[_0xd4f0('0x52')]),{'include':_0x1a0ca9[_0xd4f0('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0xd4f0('0x26')](function(_0x4d9935){var _0x1c0afe=_0x1a0ca9[_0xd4f0('0x53')][_0xd4f0('0x28')]({'plain':!![]});if(!_0x1c0afe)throw new Error(_0xd4f0('0x54'));if(_0x1c0afe[_0xd4f0('0x55')]==='user'){var _0x259baa=_0x4d9935['get']({'plain':!![]});var _0x32a5d7=[{'name':_0xd4f0('0x29'),'value':'inbound'},{'name':_0xd4f0('0x2b'),'value':_0xd4f0('0x2c')}];var _0x5e330c=_[_0xd4f0('0x31')](_0x32a5d7,[_0xd4f0('0x2f'),_0x259baa[_0xd4f0('0x30')]])[_0xd4f0('0x32')];return db[_0xd4f0('0x5c')][_0xd4f0('0x31')]({'where':{'name':_0x5e330c,'userProfileId':_0x1c0afe['userProfileId']},'raw':!![]})[_0xd4f0('0x26')](function(_0x272b07){if(_0x272b07&&_0x272b07[_0xd4f0('0x57')]===0x0){return db['UserProfileResource'][_0xd4f0('0x51')]({'name':_0x259baa[_0xd4f0('0x32')],'resourceId':_0x259baa['id'],'type':_0x272b07[_0xd4f0('0x32')],'sectionId':_0x272b07['id']},{})[_0xd4f0('0x26')](function(){return _0x4d9935;});}else{return _0x4d9935;}})['catch'](function(_0x53d7cf){logger[_0xd4f0('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53d7cf);throw _0x53d7cf;});}return _0x4d9935;});}})[_0xd4f0('0x26')](respondWithResult(_0x5a4f9e,0xc9))['catch'](handleError(_0x5a4f9e,null));};exports[_0xd4f0('0x25')]=function(_0x304234,_0x2b7674){if(_0x304234[_0xd4f0('0x52')]['id']){delete _0x304234[_0xd4f0('0x52')]['id'];}return db[_0xd4f0('0x38')][_0xd4f0('0x31')]({'where':{'id':_0x304234[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x2b7674,null))[_0xd4f0('0x26')](saveUpdates(_0x304234['body'],null))['then'](respondWithResult(_0x2b7674,null))[_0xd4f0('0x50')](handleError(_0x2b7674,null));};exports[_0xd4f0('0x27')]=function(_0x19c292,_0x3bfd3b){return db['VoiceQueue'][_0xd4f0('0x31')]({'where':{'id':_0x19c292['params']['id']}})['then'](handleEntityNotFound(_0x3bfd3b,null))['then'](removeEntity(_0x3bfd3b,null))[_0xd4f0('0x50')](handleError(_0x3bfd3b,null));};exports[_0xd4f0('0x5d')]=function(_0x57c6fb,_0x2551bc,_0x3e14e7){var _0x187718={'raw':![],'where':{}};var _0x31c2c1={};var _0x2e94f9={'count':0x0,'rows':[]};return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x57c6fb[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x2551bc,null))['then'](function(_0x403d3b){if(_0x403d3b){_0x31c2c1[_0xd4f0('0x39')]=_['keys'](db[_0xd4f0('0x5f')][_0xd4f0('0x4e')]);_0x31c2c1[_0xd4f0('0x3a')]=_['keys'](_0x57c6fb[_0xd4f0('0x3a')]);_0x31c2c1[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x31c2c1[_0xd4f0('0x39')],_0x31c2c1['query']);_0x187718[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x31c2c1[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x57c6fb[_0xd4f0('0x3a')]['fields']));_0x187718['attributes']=_0x187718[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0x187718[_0xd4f0('0x3e')]:_0x31c2c1[_0xd4f0('0x39')];if(!_0x57c6fb['query'][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x187718[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x57c6fb['query'][_0xd4f0('0x1f')]);_0x187718['offset']=qs[_0xd4f0('0x1d')](_0x57c6fb[_0xd4f0('0x3a')][_0xd4f0('0x1d')]);}_0x187718[_0xd4f0('0x41')]=qs['sort'](_0x57c6fb[_0xd4f0('0x3a')][_0xd4f0('0x42')]);_0x187718[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x57c6fb['query'],_0x31c2c1[_0xd4f0('0x44')]));_0x187718[_0xd4f0('0x43')]['VoiceQueueId']=_0x403d3b['id'];if(_0x57c6fb[_0xd4f0('0x3a')][_0xd4f0('0x46')]){_0x187718[_0xd4f0('0x43')]=_[_0xd4f0('0x47')](_0x187718[_0xd4f0('0x43')],{'$or':_['map'](_0x187718[_0xd4f0('0x3e')],function(_0x10149b){var _0x14becf={};_0x14becf[_0x10149b]={'$like':'%'+_0x57c6fb[_0xd4f0('0x3a')][_0xd4f0('0x46')]+'%'};return _0x14becf;})});}_0x187718=_[_0xd4f0('0x47')]({},_0x187718,_0x57c6fb[_0xd4f0('0x48')]);return db['CmHopper'][_0xd4f0('0x20')]({'where':_0x187718[_0xd4f0('0x43')]})[_0xd4f0('0x26')](function(_0x139426){_0x2e94f9[_0xd4f0('0x20')]=_0x139426;if(_0x57c6fb[_0xd4f0('0x3a')]['includeAll']){_0x187718['include']=[{'all':!![]}];}return db[_0xd4f0('0x5f')][_0xd4f0('0x4a')](_0x187718);})[_0xd4f0('0x26')](function(_0x110936){_0x2e94f9[_0xd4f0('0x4b')]=_0x110936;return _0x2e94f9;});}})[_0xd4f0('0x26')](respondWithFilteredResult(_0x2551bc,_0x187718))[_0xd4f0('0x50')](handleError(_0x2551bc,null));};exports[_0xd4f0('0x61')]=function(_0x5cd947,_0x29398a,_0x214214){var _0x4fa782={'raw':!![],'where':{}};var _0x335f39={};var _0x4f7a7b={'count':0x0,'rows':[]};return db[_0xd4f0('0x38')]['findOne']({'where':{'id':_0x5cd947[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x29398a,null))['then'](function(_0x5e61a4){if(_0x5e61a4){_0x335f39[_0xd4f0('0x39')]=_['keys'](db[_0xd4f0('0x62')]['rawAttributes']);_0x335f39[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x5cd947['query']);_0x335f39[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x335f39[_0xd4f0('0x39')],_0x335f39[_0xd4f0('0x3a')]);_0x4fa782[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x335f39[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x5cd947[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x4fa782[_0xd4f0('0x3e')]=_0x4fa782['attributes'][_0xd4f0('0x3f')]?_0x4fa782['attributes']:_0x335f39['model'];if(!_0x5cd947[_0xd4f0('0x3a')][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x4fa782[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x5cd947[_0xd4f0('0x3a')][_0xd4f0('0x1f')]);_0x4fa782[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x5cd947['query'][_0xd4f0('0x1d')]);}_0x4fa782[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x5cd947[_0xd4f0('0x3a')]['sort']);_0x4fa782[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_['pick'](_0x5cd947[_0xd4f0('0x3a')],_0x335f39[_0xd4f0('0x44')]));_0x4fa782[_0xd4f0('0x43')][_0xd4f0('0x63')]=_0x5e61a4['id'];if(_0x5cd947[_0xd4f0('0x3a')][_0xd4f0('0x46')]){_0x4fa782[_0xd4f0('0x43')]=_['merge'](_0x4fa782[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0x4fa782[_0xd4f0('0x3e')],function(_0x4db266){var _0x25cec6={};_0x25cec6[_0x4db266]={'$like':'%'+_0x5cd947['query'][_0xd4f0('0x46')]+'%'};return _0x25cec6;})});}_0x4fa782=_['merge']({},_0x4fa782,_0x5cd947[_0xd4f0('0x48')]);return db['CmHopperHistory'][_0xd4f0('0x20')]({'where':_0x4fa782[_0xd4f0('0x43')]})['then'](function(_0x114638){_0x4f7a7b[_0xd4f0('0x20')]=_0x114638;if(_0x5cd947[_0xd4f0('0x3a')][_0xd4f0('0x4f')]){_0x4fa782[_0xd4f0('0x49')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xd4f0('0x4a')](_0x4fa782);})[_0xd4f0('0x26')](function(_0x9956be){_0x4f7a7b['rows']=_0x9956be;return _0x4f7a7b;});}})[_0xd4f0('0x26')](respondWithFilteredResult(_0x29398a,_0x4fa782))[_0xd4f0('0x50')](handleError(_0x29398a,null));};exports['getHopperFinals']=function(_0x54fa49,_0x9c764f,_0x147cae){var _0xdc707a={'raw':!![],'where':{}};var _0x188653={};var _0x597600={'count':0x0,'rows':[]};return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x54fa49[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x9c764f,null))['then'](function(_0xc0bd14){if(_0xc0bd14){_0x188653[_0xd4f0('0x39')]=_[_0xd4f0('0x3b')](db['CmHopperFinal'][_0xd4f0('0x4e')]);_0x188653['query']=_[_0xd4f0('0x3b')](_0x54fa49[_0xd4f0('0x3a')]);_0x188653[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x188653[_0xd4f0('0x39')],_0x188653[_0xd4f0('0x3a')]);_0xdc707a[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x188653[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x54fa49[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0xdc707a[_0xd4f0('0x3e')]=_0xdc707a[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0xdc707a[_0xd4f0('0x3e')]:_0x188653['model'];if(!_0x54fa49[_0xd4f0('0x3a')][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0xdc707a['limit']=qs['limit'](_0x54fa49[_0xd4f0('0x3a')]['limit']);_0xdc707a[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x54fa49[_0xd4f0('0x3a')]['offset']);}_0xdc707a[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x54fa49[_0xd4f0('0x3a')][_0xd4f0('0x42')]);_0xdc707a[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x54fa49[_0xd4f0('0x3a')],_0x188653[_0xd4f0('0x44')]));_0xdc707a[_0xd4f0('0x43')][_0xd4f0('0x63')]=_0xc0bd14['id'];if(_0x54fa49[_0xd4f0('0x3a')]['filter']){_0xdc707a[_0xd4f0('0x43')]=_['merge'](_0xdc707a[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0xdc707a['attributes'],function(_0x2eeb0b){var _0x3e3f48={};_0x3e3f48[_0x2eeb0b]={'$like':'%'+_0x54fa49[_0xd4f0('0x3a')][_0xd4f0('0x46')]+'%'};return _0x3e3f48;})});}_0xdc707a=_['merge']({},_0xdc707a,_0x54fa49[_0xd4f0('0x48')]);return db[_0xd4f0('0x64')][_0xd4f0('0x20')]({'where':_0xdc707a[_0xd4f0('0x43')]})[_0xd4f0('0x26')](function(_0x3e3867){_0x597600[_0xd4f0('0x20')]=_0x3e3867;if(_0x54fa49['query'][_0xd4f0('0x4f')]){_0xdc707a[_0xd4f0('0x49')]=[{'all':!![]}];}return db[_0xd4f0('0x64')][_0xd4f0('0x4a')](_0xdc707a);})[_0xd4f0('0x26')](function(_0x3fdf45){_0x597600[_0xd4f0('0x4b')]=_0x3fdf45;return _0x597600;});}})[_0xd4f0('0x26')](respondWithFilteredResult(_0x9c764f,_0xdc707a))[_0xd4f0('0x50')](handleError(_0x9c764f,null));};exports['getHopperBlacks']=function(_0x3d25a8,_0x4ee21e,_0x989814){var _0x1aa8ac={'raw':!![],'where':{}};var _0x15b2cb={};var _0x124e66={'count':0x0,'rows':[]};return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x3d25a8[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x4ee21e,null))[_0xd4f0('0x26')](function(_0x3438ab){if(_0x3438ab){_0x15b2cb[_0xd4f0('0x39')]=_[_0xd4f0('0x3b')](db[_0xd4f0('0x65')]['rawAttributes']);_0x15b2cb[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x3d25a8['query']);_0x15b2cb[_0xd4f0('0x44')]=_['intersection'](_0x15b2cb[_0xd4f0('0x39')],_0x15b2cb['query']);_0x1aa8ac['attributes']=_['intersection'](_0x15b2cb[_0xd4f0('0x39')],qs['fields'](_0x3d25a8[_0xd4f0('0x3a')]['fields']));_0x1aa8ac['attributes']=_0x1aa8ac['attributes']['length']?_0x1aa8ac['attributes']:_0x15b2cb[_0xd4f0('0x39')];if(!_0x3d25a8[_0xd4f0('0x3a')][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x1aa8ac[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x3d25a8[_0xd4f0('0x3a')][_0xd4f0('0x1f')]);_0x1aa8ac[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x3d25a8['query'][_0xd4f0('0x1d')]);}_0x1aa8ac[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x3d25a8[_0xd4f0('0x3a')][_0xd4f0('0x42')]);_0x1aa8ac[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_['pick'](_0x3d25a8['query'],_0x15b2cb['filters']));_0x1aa8ac[_0xd4f0('0x43')]['VoiceQueueId']=_0x3438ab['id'];if(_0x3d25a8[_0xd4f0('0x3a')][_0xd4f0('0x46')]){_0x1aa8ac[_0xd4f0('0x43')]=_['merge'](_0x1aa8ac[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0x1aa8ac[_0xd4f0('0x3e')],function(_0x26769b){var _0x226ea1={};_0x226ea1[_0x26769b]={'$like':'%'+_0x3d25a8[_0xd4f0('0x3a')]['filter']+'%'};return _0x226ea1;})});}_0x1aa8ac=_['merge']({},_0x1aa8ac,_0x3d25a8['options']);return db[_0xd4f0('0x65')][_0xd4f0('0x20')]({'where':_0x1aa8ac[_0xd4f0('0x43')]})['then'](function(_0x1a7afe){_0x124e66[_0xd4f0('0x20')]=_0x1a7afe;if(_0x3d25a8[_0xd4f0('0x3a')][_0xd4f0('0x4f')]){_0x1aa8ac[_0xd4f0('0x49')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x1aa8ac);})['then'](function(_0x38868c){_0x124e66[_0xd4f0('0x4b')]=_0x38868c;return _0x124e66;});}})[_0xd4f0('0x26')](respondWithFilteredResult(_0x4ee21e,_0x1aa8ac))[_0xd4f0('0x50')](handleError(_0x4ee21e,null));};exports[_0xd4f0('0x66')]=function(_0x3a1ba6,_0x115af2,_0x2bfd00){var _0x326e8b={};var _0x5ae1d2={};var _0x1b6bc0;var _0x790feb;return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x3a1ba6[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x115af2,null))[_0xd4f0('0x26')](function(_0x26fe19){if(_0x26fe19){_0x1b6bc0=_0x26fe19;_0x5ae1d2['model']=_[_0xd4f0('0x3b')](db[_0xd4f0('0x67')][_0xd4f0('0x4e')]);_0x5ae1d2[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x3a1ba6[_0xd4f0('0x3a')]);_0x5ae1d2[_0xd4f0('0x44')]=_['intersection'](_0x5ae1d2['model'],_0x5ae1d2['query']);_0x326e8b['attributes']=_[_0xd4f0('0x3c')](_0x5ae1d2['model'],qs[_0xd4f0('0x3d')](_0x3a1ba6[_0xd4f0('0x3a')]['fields']));_0x326e8b[_0xd4f0('0x3e')]=_0x326e8b[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0x326e8b[_0xd4f0('0x3e')]:_0x5ae1d2[_0xd4f0('0x39')];_0x326e8b[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x3a1ba6[_0xd4f0('0x3a')]['sort']);_0x326e8b[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x3a1ba6['query'],_0x5ae1d2[_0xd4f0('0x44')]));if(_0x3a1ba6[_0xd4f0('0x3a')]['filter']){_0x326e8b[_0xd4f0('0x43')]=_[_0xd4f0('0x47')](_0x326e8b['where'],{'$or':_[_0xd4f0('0x2e')](_0x326e8b[_0xd4f0('0x3e')],function(_0x166a6c){var _0x9c4661={};_0x9c4661[_0x166a6c]={'$like':'%'+_0x3a1ba6['query'][_0xd4f0('0x46')]+'%'};return _0x9c4661;})});}_0x326e8b=_[_0xd4f0('0x47')]({},_0x326e8b,_0x3a1ba6[_0xd4f0('0x48')]);return _0x1b6bc0[_0xd4f0('0x66')](_0x326e8b);}})[_0xd4f0('0x26')](function(_0x1b9830){if(_0x1b9830){_0x790feb=_0x1b9830[_0xd4f0('0x3f')];if(!_0x3a1ba6[_0xd4f0('0x3a')]['hasOwnProperty'](_0xd4f0('0x60'))){_0x326e8b[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x3a1ba6[_0xd4f0('0x3a')]['limit']);_0x326e8b['offset']=qs['offset'](_0x3a1ba6[_0xd4f0('0x3a')][_0xd4f0('0x1d')]);}return _0x1b6bc0['getTeams'](_0x326e8b);}})[_0xd4f0('0x26')](function(_0x2ae3e3){if(_0x2ae3e3){return _0x2ae3e3?{'count':_0x790feb,'rows':_0x2ae3e3}:null;}})[_0xd4f0('0x26')](respondWithResult(_0x115af2,null))['catch'](handleError(_0x115af2,null));};exports[_0xd4f0('0x68')]=function(_0x5afbc3,_0x3b5747,_0x28a1e7){var _0x472049=_0x5afbc3[_0xd4f0('0x52')][_0xd4f0('0x69')];var _0x1bc15c=_[_0xd4f0('0x2e')](_0x472049,'id');return db['Team'][_0xd4f0('0x4a')]({'where':{'id':_0x1bc15c},'attributes':['id'],'include':[{'model':db[_0xd4f0('0x6a')],'as':_0xd4f0('0x6b'),'attributes':['id',_0xd4f0('0x32'),_0xd4f0('0x6c'),'voicePause',_0xd4f0('0x6d')],'raw':!![]}]})['then'](function(_0x1e0657){if(_0x1e0657){var _0x26e5af=_['flatMap'](_0x1e0657,function(_0x2820a3){var _0x36a38d=_0x2820a3[_0xd4f0('0x28')]({'plain':!![]});_0x36a38d[_0xd4f0('0x6b')][_0xd4f0('0x6e')](function(_0x451d3b){_0x451d3b[_0xd4f0('0x6f')]=_[_0xd4f0('0x31')](_0x472049,{'id':_0x36a38d['id']})[_0xd4f0('0x6f')];});return _0x36a38d[_0xd4f0('0x6b')];});return db[_0xd4f0('0x38')]['find']({'where':{'id':_0x5afbc3[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](function(_0x58dd8a){return db['sequelize'][_0xd4f0('0x70')](function(_0x35a19b){return _0x58dd8a[_0xd4f0('0x68')](_0x1bc15c,{'transaction':_0x35a19b})[_0xd4f0('0x26')](function(){return BPromise[_0xd4f0('0x71')](_0x472049,function(_0x7ebea1){return db[_0xd4f0('0x72')][_0xd4f0('0x73')]({'TeamId':_0x7ebea1['id'],'VoiceQueueId':_0x5afbc3[_0xd4f0('0x4d')]['id'],'penalty':_0x7ebea1['penalty']},{'transaction':_0x35a19b});});})['then'](function(){return BPromise[_0xd4f0('0x71')](_0x26e5af,function(_0x4d91b6){return db[_0xd4f0('0x74')][_0xd4f0('0x75')]({'where':{'UserId':_0x4d91b6['id'],'VoiceQueueId':_0x5afbc3[_0xd4f0('0x4d')]['id']},'defaults':{'penalty':_0x4d91b6[_0xd4f0('0x6f')]},'transaction':_0x35a19b});});})[_0xd4f0('0x26')](function(){return BPromise[_0xd4f0('0x71')](_[_0xd4f0('0x46')](_0x26e5af,{'online':!![]}),function(_0x218358){return db[_0xd4f0('0x76')]['upsert']({'membername':_0x218358[_0xd4f0('0x32')],'UserId':_0x218358['id'],'queue_name':_0x58dd8a[_0xd4f0('0x32')],'VoiceQueueId':_0x58dd8a['id'],'interface':_['isNil'](_0x218358[_0xd4f0('0x6d')])?util[_0xd4f0('0x77')]('SIP/%s',_0x218358['name']):_0x218358[_0xd4f0('0x6d')],'paused':_0x218358[_0xd4f0('0x78')]||![],'penalty':_0x218358[_0xd4f0('0x6f')]},{'transaction':_0x35a19b});});})[_0xd4f0('0x26')](function(){_0x26e5af[_0xd4f0('0x6e')](function(_0x321fd5){socket[_0xd4f0('0x79')](_0xd4f0('0x7a'),{'UserId':_0x321fd5['id'],'VoiceQueueId':_0x58dd8a['id']});});});});});}})[_0xd4f0('0x26')](respondWithStatusCode(_0x3b5747,null))[_0xd4f0('0x50')](handleError(_0x3b5747,null));};exports[_0xd4f0('0x7b')]=function(_0x28573e,_0x1f086a,_0xd08210){return db[_0xd4f0('0x67')][_0xd4f0('0x4a')]({'where':{'id':_0x28573e[_0xd4f0('0x3a')][_0xd4f0('0x7c')]},'attributes':['id'],'include':[{'model':db[_0xd4f0('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1f086a,null))[_0xd4f0('0x26')](function(_0x21cd76){var _0x23d7e6=_['map'](_0x21cd76,'id');var _0x570c58=[];var _0x52aff5=[];var _0x381d18=squel[_0xd4f0('0x7d')]();_0x381d18[_0xd4f0('0x7e')](_0xd4f0('0x7f'))[_0xd4f0('0x80')](_0xd4f0('0x81'),'tq')[_0xd4f0('0x82')](_0xd4f0('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd4f0('0x84'),_0x28573e['params']['id']);for(var _0x484cd4=0x0;_0x484cd4<_0x21cd76['length'];_0x484cd4+=0x1){let _0x300161=_0x21cd76[_0x484cd4];for(var _0x568184=0x0;_0x568184<_0x300161[_0xd4f0('0x6b')][_0xd4f0('0x3f')];_0x568184+=0x1){let _0x444e5b=_0x300161[_0xd4f0('0x6b')][_0x568184];var _0x103072=_0x381d18[_0xd4f0('0x58')]();_0x103072[_0xd4f0('0x43')](_0xd4f0('0x85'),_0x444e5b['id']);_0x52aff5['push'](db[_0xd4f0('0x86')]['query'](_0x103072[_0xd4f0('0x87')](),{'type':db['sequelize'][_0xd4f0('0x88')][_0xd4f0('0x89')]})[_0xd4f0('0x26')](function(_0x166ce7){if(_0x166ce7['length']===0x1){return _0x444e5b['id'];}else{var _0x284074=_[_0xd4f0('0x8a')](_[_0xd4f0('0x2e')](_0x166ce7,_0xd4f0('0x8b')),function(_0x4fd6f2){return _[_0xd4f0('0x8c')](_0x23d7e6,_0x4fd6f2);});if(_0x284074){return _0x444e5b['id'];}}}));}}return BPromise['all'](_0x52aff5)[_0xd4f0('0x26')](function(_0x720eb){_0x570c58=_(_0x570c58)['union'](_0x720eb)[_0xd4f0('0x8d')]()['value']();return db['VoiceQueue'][_0xd4f0('0x31')]({'where':{'id':_0x28573e[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](function(_0x4adfd6){return db[_0xd4f0('0x86')]['transaction'](function(_0x390f9f){return _0x4adfd6['removeTeams'](_0x28573e[_0xd4f0('0x3a')][_0xd4f0('0x7c')],{'transaction':_0x390f9f})[_0xd4f0('0x26')](function(){if(!_[_0xd4f0('0x8e')](_0x570c58)){return _0x4adfd6['removeAgents'](_0x570c58,{'transaction':_0x390f9f})[_0xd4f0('0x26')](function(){return db[_0xd4f0('0x76')]['destroy']({'where':{'VoiceQueueId':_0x28573e[_0xd4f0('0x4d')]['id'],'UserId':_0x570c58},'transaction':_0x390f9f});});}})[_0xd4f0('0x26')](function(){_0x570c58[_0xd4f0('0x6e')](function(_0x1bd639){socket[_0xd4f0('0x79')](_0xd4f0('0x8f'),{'UserId':_0x1bd639,'VoiceQueueId':_0x4adfd6['id']});});});});});});})['then'](respondWithStatusCode(_0x1f086a,null))[_0xd4f0('0x50')](handleError(_0x1f086a,null));};exports[_0xd4f0('0x90')]=function(_0x6b590,_0x39c3f1,_0x40cb2d){var _0x530ba9,_0x4eb44e;return db[_0xd4f0('0x38')]['find']({'where':{'id':_0x6b590[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x39c3f1,null))['then'](function(_0x4a4577){if(_0x4a4577){_0x4eb44e=_0x4a4577;return _0x4a4577[_0xd4f0('0x90')](_0x6b590[_0xd4f0('0x52')][_0xd4f0('0x7c')],_[_0xd4f0('0x5b')](_0x6b590[_0xd4f0('0x52')],['ids','id'])||{})[_0xd4f0('0x91')](function(_0x4ce9dc){for(var _0x305447=0x0;_0x305447<_0x6b590[_0xd4f0('0x52')][_0xd4f0('0x7c')][_0xd4f0('0x3f')];_0x305447+=0x1){socket[_0xd4f0('0x79')]('userVoiceQueue:save',{'UserId':Number(_0x6b590[_0xd4f0('0x52')][_0xd4f0('0x7c')][_0x305447]),'VoiceQueueId':Number(_0x6b590[_0xd4f0('0x4d')]['id'])});}return _0x4ce9dc;});}})[_0xd4f0('0x26')](function(_0xb8dacb){_0x530ba9=_0xb8dacb||[];if(_0x4eb44e){return db[_0xd4f0('0x6a')][_0xd4f0('0x4a')]({'where':{'id':_0x6b590['body']['ids']},'attributes':['id',_0xd4f0('0x32'),_0xd4f0('0x6c'),_0xd4f0('0x78'),'interface'],'raw':!![]});}})[_0xd4f0('0x26')](function(_0x4e11bc){if(!_['isEmpty'](_0x4e11bc)){var _0x3ca649=[];for(var _0x2a5be5=0x0;_0x2a5be5<_0x4e11bc['length'];_0x2a5be5++){if(_0x4e11bc[_0x2a5be5][_0xd4f0('0x6c')]){_0x3ca649[_0xd4f0('0x92')](db[_0xd4f0('0x76')][_0xd4f0('0x73')]({'membername':_0x4e11bc[_0x2a5be5][_0xd4f0('0x32')],'UserId':_0x4e11bc[_0x2a5be5]['id'],'queue_name':_0x4eb44e[_0xd4f0('0x32')],'VoiceQueueId':_0x4eb44e['id'],'interface':_[_0xd4f0('0x93')](_0x4e11bc[_0x2a5be5]['interface'])?util['format'](_0xd4f0('0x94'),_0x4e11bc[_0x2a5be5]['name']):_0x4e11bc[_0x2a5be5]['interface'],'paused':_0x4e11bc[_0x2a5be5][_0xd4f0('0x78')]||![],'penalty':_0x6b590['body'][_0xd4f0('0x6f')]||0x0}));}}return BPromise[_0xd4f0('0x95')](_0x3ca649);}})[_0xd4f0('0x26')](function(){return _0x530ba9;})[_0xd4f0('0x26')](respondWithResult(_0x39c3f1,null))['catch'](handleError(_0x39c3f1,null));};exports['removeAgents']=function(_0x3d7426,_0x3b4987,_0x11f6ae){return db[_0xd4f0('0x38')][_0xd4f0('0x31')]({'where':{'id':_0x3d7426[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x3b4987,null))['then'](function(_0x28aca6){if(_0x28aca6){return _0x28aca6[_0xd4f0('0x96')](_0x3d7426[_0xd4f0('0x3a')]['ids'])[_0xd4f0('0x26')](function(){if(_[_0xd4f0('0x97')](_0x3d7426['query'][_0xd4f0('0x7c')])){for(var _0x21c2d4=0x0;_0x21c2d4<_0x3d7426[_0xd4f0('0x3a')]['ids']['length'];_0x21c2d4+=0x1){socket[_0xd4f0('0x79')](_0xd4f0('0x8f'),{'UserId':Number(_0x3d7426[_0xd4f0('0x3a')][_0xd4f0('0x7c')][_0x21c2d4]),'VoiceQueueId':Number(_0x3d7426['params']['id'])});}}else{socket[_0xd4f0('0x79')](_0xd4f0('0x8f'),{'UserId':Number(_0x3d7426[_0xd4f0('0x3a')][_0xd4f0('0x7c')]),'VoiceQueueId':Number(_0x3d7426[_0xd4f0('0x4d')]['id'])});}});}})[_0xd4f0('0x26')](function(_0x1d8760){return db[_0xd4f0('0x76')][_0xd4f0('0x27')]({'where':{'VoiceQueueId':_0x3d7426[_0xd4f0('0x4d')]['id'],'UserId':_0x3d7426[_0xd4f0('0x3a')][_0xd4f0('0x7c')]}})[_0xd4f0('0x26')](function(){return _0x1d8760;});})[_0xd4f0('0x26')](respondWithStatusCode(_0x3b4987,null))['catch'](handleError(_0x3b4987,null));};exports[_0xd4f0('0x98')]=function(_0x60b346,_0x329a1b,_0x26b8f8){var _0x247669={};var _0x244bfa={};var _0x356b28;var _0x30bb10;return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x60b346[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x329a1b,null))[_0xd4f0('0x26')](function(_0x4e424c){if(_0x4e424c){_0x356b28=_0x4e424c;_0x244bfa[_0xd4f0('0x39')]=_[_0xd4f0('0x3b')](db[_0xd4f0('0x6a')][_0xd4f0('0x4e')]);_0x244bfa['query']=_[_0xd4f0('0x3b')](_0x60b346[_0xd4f0('0x3a')]);_0x244bfa[_0xd4f0('0x44')]=_['intersection'](_0x244bfa[_0xd4f0('0x39')],_0x244bfa[_0xd4f0('0x3a')]);_0x247669['attributes']=_[_0xd4f0('0x3c')](_0x244bfa[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x60b346[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x247669['attributes']=_0x247669[_0xd4f0('0x3e')][_0xd4f0('0x3f')]?_0x247669[_0xd4f0('0x3e')]:_0x244bfa['model'];_0x247669[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x60b346['query'][_0xd4f0('0x42')]);_0x247669[_0xd4f0('0x43')]=qs['filters'](_['pick'](_0x60b346['query'],_0x244bfa[_0xd4f0('0x44')]));if(_0x60b346[_0xd4f0('0x3a')]['filter']){_0x247669['where']=_[_0xd4f0('0x47')](_0x247669['where'],{'$or':_[_0xd4f0('0x2e')](_0x247669['attributes'],function(_0x1631ca){var _0x2ec0c7={};_0x2ec0c7[_0x1631ca]={'$like':'%'+_0x60b346[_0xd4f0('0x3a')]['filter']+'%'};return _0x2ec0c7;})});}_0x247669=_[_0xd4f0('0x47')]({},_0x247669,_0x60b346[_0xd4f0('0x48')]);return _0x356b28[_0xd4f0('0x98')](_0x247669);}})[_0xd4f0('0x26')](function(_0x395317){if(_0x395317){_0x30bb10=_0x395317[_0xd4f0('0x3f')];if(!_0x60b346['query'][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x247669[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x60b346[_0xd4f0('0x3a')]['limit']);_0x247669['offset']=qs['offset'](_0x60b346[_0xd4f0('0x3a')][_0xd4f0('0x1d')]);}return _0x356b28[_0xd4f0('0x98')](_0x247669);}})[_0xd4f0('0x26')](function(_0x46167){if(_0x46167){return _0x46167?{'count':_0x30bb10,'rows':_0x46167}:null;}})[_0xd4f0('0x26')](respondWithResult(_0x329a1b,null))[_0xd4f0('0x50')](handleError(_0x329a1b,null));};exports[_0xd4f0('0x99')]=function(_0x2b76df,_0x17172d,_0x101f2f){var _0x5de1f2={};var _0x32d11e={};var _0x194e5e;var _0x12574e;return db['VoiceQueue']['findOne']({'where':{'id':_0x2b76df[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x17172d,null))[_0xd4f0('0x26')](function(_0x38867b){if(_0x38867b){_0x194e5e=_0x38867b;_0x32d11e[_0xd4f0('0x39')]=_[_0xd4f0('0x3b')](db[_0xd4f0('0x76')][_0xd4f0('0x4e')]);_0x32d11e[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x2b76df[_0xd4f0('0x3a')]);_0x32d11e[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x32d11e[_0xd4f0('0x39')],_0x32d11e[_0xd4f0('0x3a')]);_0x5de1f2[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x32d11e[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x2b76df[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x5de1f2[_0xd4f0('0x3e')]=_0x5de1f2[_0xd4f0('0x3e')]['length']?_0x5de1f2[_0xd4f0('0x3e')]:_0x32d11e['model'];_0x5de1f2['order']=qs[_0xd4f0('0x42')](_0x2b76df['query'][_0xd4f0('0x42')]);_0x5de1f2[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x2b76df[_0xd4f0('0x3a')],_0x32d11e['filters']));if(_0x2b76df['query']['filter']){_0x5de1f2[_0xd4f0('0x43')]=_[_0xd4f0('0x47')](_0x5de1f2[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0x5de1f2[_0xd4f0('0x3e')],function(_0x52eab8){var _0x5c493a={};_0x5c493a[_0x52eab8]={'$like':'%'+_0x2b76df['query'][_0xd4f0('0x46')]+'%'};return _0x5c493a;})});}_0x5de1f2=_[_0xd4f0('0x47')]({},_0x5de1f2,_0x2b76df[_0xd4f0('0x48')]);return _0x194e5e[_0xd4f0('0x99')](_0x5de1f2);}})[_0xd4f0('0x26')](function(_0x1bc264){if(_0x1bc264){_0x12574e=_0x1bc264['length'];if(!_0x2b76df['query'][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x5de1f2['limit']=qs['limit'](_0x2b76df[_0xd4f0('0x3a')][_0xd4f0('0x1f')]);_0x5de1f2[_0xd4f0('0x1d')]=qs['offset'](_0x2b76df['query'][_0xd4f0('0x1d')]);}return _0x194e5e[_0xd4f0('0x99')](_0x5de1f2);}})['then'](function(_0x45fcf9){return _0x45fcf9?{'count':_0x12574e,'rows':_0x45fcf9}:null;})[_0xd4f0('0x26')](respondWithResult(_0x17172d,null))[_0xd4f0('0x50')](handleError(_0x17172d,null));};exports[_0xd4f0('0x9a')]=function(_0x27fea8,_0x56de6d,_0xa817ea){var _0x49f66f={};var _0x16dc93={};var _0x26a1fa;var _0x3504ae;return db[_0xd4f0('0x38')][_0xd4f0('0x5e')]({'where':{'id':_0x27fea8[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x56de6d,null))[_0xd4f0('0x26')](function(_0x1e2c57){if(_0x1e2c57){_0x26a1fa=_0x1e2c57;_0x16dc93[_0xd4f0('0x39')]=_['keys'](db[_0xd4f0('0x9b')][_0xd4f0('0x4e')]);_0x16dc93['query']=_[_0xd4f0('0x3b')](_0x27fea8[_0xd4f0('0x3a')]);_0x16dc93[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x16dc93[_0xd4f0('0x39')],_0x16dc93[_0xd4f0('0x3a')]);_0x49f66f[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x16dc93[_0xd4f0('0x39')],qs[_0xd4f0('0x3d')](_0x27fea8[_0xd4f0('0x3a')][_0xd4f0('0x3d')]));_0x49f66f[_0xd4f0('0x3e')]=_0x49f66f['attributes'][_0xd4f0('0x3f')]?_0x49f66f[_0xd4f0('0x3e')]:_0x16dc93[_0xd4f0('0x39')];_0x49f66f[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x27fea8[_0xd4f0('0x3a')]['sort']);_0x49f66f[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x27fea8[_0xd4f0('0x3a')],_0x16dc93[_0xd4f0('0x44')]));if(_0x27fea8[_0xd4f0('0x3a')][_0xd4f0('0x46')]){_0x49f66f[_0xd4f0('0x43')]=_[_0xd4f0('0x47')](_0x49f66f[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0x49f66f[_0xd4f0('0x3e')],function(_0x2455e3){var _0x2c72c0={};_0x2c72c0[_0x2455e3]={'$like':'%'+_0x27fea8['query'][_0xd4f0('0x46')]+'%'};return _0x2c72c0;})});}_0x49f66f=_[_0xd4f0('0x47')]({},_0x49f66f,_0x27fea8[_0xd4f0('0x48')]);return _0x26a1fa[_0xd4f0('0x9a')](_0x49f66f);}})[_0xd4f0('0x26')](function(_0xc2a673){if(_0xc2a673){_0x3504ae=_0xc2a673['length'];if(!_0x27fea8[_0xd4f0('0x3a')][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0x49f66f[_0xd4f0('0x1f')]=qs[_0xd4f0('0x1f')](_0x27fea8['query'][_0xd4f0('0x1f')]);_0x49f66f[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x27fea8['query']['offset']);}return _0x26a1fa[_0xd4f0('0x9a')](_0x49f66f);}})[_0xd4f0('0x26')](function(_0x2324e1){if(_0x2324e1){return _0x2324e1?{'count':_0x3504ae,'rows':_0x2324e1}:null;}})[_0xd4f0('0x26')](respondWithResult(_0x56de6d,null))[_0xd4f0('0x50')](handleError(_0x56de6d,null));};exports[_0xd4f0('0x9c')]=function(_0xecdb75,_0x49243f,_0x3b6ac4){var _0x441468=moment()[_0xd4f0('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x40ee0,_0x3d64d1;return db[_0xd4f0('0x38')]['find']({'where':{'id':_0xecdb75[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x49243f,null))[_0xd4f0('0x26')](function(_0x3858dd){if(_0x3858dd){_0x3d64d1=_0x3858dd;return _0x3858dd[_0xd4f0('0x9c')](_0xecdb75[_0xd4f0('0x52')][_0xd4f0('0x7c')],_[_0xd4f0('0x5b')](_0xecdb75[_0xd4f0('0x52')],[_0xd4f0('0x7c'),'id'])||{});}return null;})[_0xd4f0('0x91')](function(_0x274f99){var _0xe72e2c;_0x40ee0=_0x274f99||[];var _0x3e0aff=[];if(_0x274f99){for(var _0x12dfe3=0x0;_0x12dfe3<_0x274f99[_0xd4f0('0x3f')];_0x12dfe3+=0x1){var _0x192ae1=_0x274f99[_0x12dfe3][_0xd4f0('0x28')]({'plain':!![]});_0x3d64d1[_0xd4f0('0x9d')]=_0xecdb75['body']['dialCheckDuplicateType']?_0xecdb75[_0xd4f0('0x52')][_0xd4f0('0x9d')]:_0x3d64d1[_0xd4f0('0x9d')];switch(_0x3d64d1['dialCheckDuplicateType']){case _0xd4f0('0x9e'):_0xe72e2c=squel[_0xd4f0('0x9f')]()[_0xd4f0('0xa0')](_0xd4f0('0xa1'))[_0xd4f0('0xa2')]([_0xd4f0('0xa3'),_0xd4f0('0xa4'),_0xd4f0('0xa5'),_0xd4f0('0xa6'),_0xd4f0('0x63'),_0xd4f0('0x59'),'updatedAt'],squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')]('phone',_0xd4f0('0xa3'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27','scheduledAt')[_0xd4f0('0x7e')]('id',_0xd4f0('0xa5'))['field'](_0x192ae1[_0xd4f0('0xa7')][_0xd4f0('0x87')](),_0xd4f0('0xa6'))[_0xd4f0('0x7e')](_0xecdb75[_0xd4f0('0x4d')]['id']['toString'](),'VoiceQueueId')[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27',_0xd4f0('0x59'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27','updatedAt')[_0xd4f0('0x80')](_0xd4f0('0xa8'))['where']('deletedAt\x20IS\x20NULL')[_0xd4f0('0x43')](_0xd4f0('0xa9'),_0x192ae1[_0xd4f0('0xa7')][_0xd4f0('0x87')]())[_0xd4f0('0x43')](_0xd4f0('0xaa'))[_0xd4f0('0x43')](_0xd4f0('0xab'),squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')](_0xd4f0('0xac'))[_0xd4f0('0x80')](_0xd4f0('0xad'))[_0xd4f0('0x43')](_0xd4f0('0x84'),_0xecdb75[_0xd4f0('0x4d')]['id'][_0xd4f0('0x87')]()))[_0xd4f0('0x43')](_0xd4f0('0xab'),squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')]('COALESCE(phone,\x27\x27)')[_0xd4f0('0x80')](_0xd4f0('0xa1'))['where'](_0xd4f0('0x84'),_0xecdb75[_0xd4f0('0x4d')]['id'][_0xd4f0('0x87')]())))[_0xd4f0('0x87')]();break;case _0xd4f0('0xae'):_0xe72e2c=squel[_0xd4f0('0x9f')]()[_0xd4f0('0xa0')]('cm_hopper')[_0xd4f0('0xa2')]([_0xd4f0('0xa3'),_0xd4f0('0xa4'),'ContactId','ListId',_0xd4f0('0x63'),_0xd4f0('0x59'),_0xd4f0('0x5a')],squel[_0xd4f0('0x7d')]()['field']('phone',_0xd4f0('0xa3'))['field']('\x27'+_0x441468+'\x27',_0xd4f0('0xa4'))[_0xd4f0('0x7e')]('id','ContactId')[_0xd4f0('0x7e')](_0x192ae1[_0xd4f0('0xa7')][_0xd4f0('0x87')](),_0xd4f0('0xa6'))[_0xd4f0('0x7e')](_0xecdb75[_0xd4f0('0x4d')]['id'][_0xd4f0('0x87')](),_0xd4f0('0x63'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27',_0xd4f0('0x59'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27',_0xd4f0('0x5a'))['from'](_0xd4f0('0xa8'))['where'](_0xd4f0('0xaf'))['where']('ListId\x20=\x20?',_0x192ae1[_0xd4f0('0xa7')]['toString']())[_0xd4f0('0x43')](_0xd4f0('0xaa'))[_0xd4f0('0x43')](_0xd4f0('0xab'),squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')]('COALESCE(phone,\x27\x27)')['from'](_0xd4f0('0xa1'))[_0xd4f0('0x43')](_0xd4f0('0x84'),_0xecdb75[_0xd4f0('0x4d')]['id'][_0xd4f0('0x87')]())))[_0xd4f0('0x87')]();break;default:_0xe72e2c=squel[_0xd4f0('0x9f')]()[_0xd4f0('0xa0')](_0xd4f0('0xa1'))[_0xd4f0('0xa2')]([_0xd4f0('0xa3'),_0xd4f0('0xa4'),_0xd4f0('0xa5'),'ListId',_0xd4f0('0x63'),_0xd4f0('0x59'),_0xd4f0('0x5a')],squel['select']()[_0xd4f0('0x7e')]('phone',_0xd4f0('0xa3'))['field']('\x27'+_0x441468+'\x27',_0xd4f0('0xa4'))['field']('id',_0xd4f0('0xa5'))['field'](_0x192ae1['CmListId'][_0xd4f0('0x87')](),'ListId')[_0xd4f0('0x7e')](_0xecdb75[_0xd4f0('0x4d')]['id']['toString'](),_0xd4f0('0x63'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27',_0xd4f0('0x59'))['field']('\x27'+_0x441468+'\x27',_0xd4f0('0x5a'))[_0xd4f0('0x80')]('cm_contacts')[_0xd4f0('0x43')]('deletedAt\x20IS\x20NULL')[_0xd4f0('0x43')](_0xd4f0('0xa9'),_0x192ae1[_0xd4f0('0xa7')][_0xd4f0('0x87')]())[_0xd4f0('0x43')](_0xd4f0('0xaa')))[_0xd4f0('0x87')]();}_0x3e0aff[_0xd4f0('0x92')](db[_0xd4f0('0x86')]['query'](_0xe72e2c));}return BPromise[_0xd4f0('0x95')](_0x3e0aff);}})[_0xd4f0('0x26')](function(){var _0x2d0bee=[];var _0xc317e7=squel[_0xd4f0('0x9f')]()[_0xd4f0('0xa0')](_0xd4f0('0xb0'))['fromQuery']([_0xd4f0('0xb1'),_0xd4f0('0xa3'),_0xd4f0('0xb2'),_0xd4f0('0x59'),_0xd4f0('0x5a')],squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')](_0xd4f0('0xb3'))[_0xd4f0('0x7e')](_0xd4f0('0xb4'))[_0xd4f0('0x7e')]('ci.OrderBy+1')['field']('\x27'+_0x441468+'\x27',_0xd4f0('0x59'))[_0xd4f0('0x7e')]('\x27'+_0x441468+'\x27',_0xd4f0('0x5a'))['from']('cm_contact_has_items','ci')[_0xd4f0('0x82')](_0xd4f0('0xa1'),'h',_0xd4f0('0xb5'))[_0xd4f0('0x43')]('h.scheduledat=?',_0x441468)[_0xd4f0('0x43')](_0xd4f0('0xb6'),'PHONE'))['toString']();_0x2d0bee[_0xd4f0('0x92')](db[_0xd4f0('0x86')][_0xd4f0('0x3a')](_0xc317e7));return BPromise[_0xd4f0('0x95')](_0x2d0bee);})[_0xd4f0('0x26')](function(){return _0x40ee0;})[_0xd4f0('0x26')](respondWithResult(_0x49243f,null))[_0xd4f0('0x50')](handleError(_0x49243f,null));};exports[_0xd4f0('0xb7')]=function(_0x555d5a,_0x23f986,_0x2d3a79){return db['VoiceQueue'][_0xd4f0('0x31')]({'where':{'id':_0x555d5a[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x23f986,null))[_0xd4f0('0x26')](function(_0x51c8fc){if(_0x51c8fc){return _0x51c8fc[_0xd4f0('0xb7')](_0x555d5a[_0xd4f0('0x3a')][_0xd4f0('0x7c')]);}})[_0xd4f0('0x26')](function(_0x6d89a2){if(_0x6d89a2){return db[_0xd4f0('0x5f')][_0xd4f0('0x27')]({'where':{'ListId':_0x555d5a[_0xd4f0('0x3a')][_0xd4f0('0x7c')],'VoiceQueueId':_0x555d5a[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](function(){return _0x6d89a2;});}})['then'](respondWithStatusCode(_0x23f986,null))[_0xd4f0('0x50')](handleError(_0x23f986,null));};exports[_0xd4f0('0xb8')]=function(_0x1c91a7,_0x3a3e47,_0x43c99d){var _0xbd4e9f={};var _0x373fb9={};var _0x12d67b;var _0x4ea804;return db['VoiceQueue'][_0xd4f0('0x5e')]({'where':{'id':_0x1c91a7[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x3a3e47,null))[_0xd4f0('0x26')](function(_0xafcbc5){if(_0xafcbc5){_0x12d67b=_0xafcbc5;_0x373fb9[_0xd4f0('0x39')]=_[_0xd4f0('0x3b')](db[_0xd4f0('0x9b')][_0xd4f0('0x4e')]);_0x373fb9[_0xd4f0('0x3a')]=_[_0xd4f0('0x3b')](_0x1c91a7[_0xd4f0('0x3a')]);_0x373fb9[_0xd4f0('0x44')]=_[_0xd4f0('0x3c')](_0x373fb9[_0xd4f0('0x39')],_0x373fb9[_0xd4f0('0x3a')]);_0xbd4e9f[_0xd4f0('0x3e')]=_[_0xd4f0('0x3c')](_0x373fb9[_0xd4f0('0x39')],qs['fields'](_0x1c91a7[_0xd4f0('0x3a')]['fields']));_0xbd4e9f[_0xd4f0('0x3e')]=_0xbd4e9f['attributes'][_0xd4f0('0x3f')]?_0xbd4e9f[_0xd4f0('0x3e')]:_0x373fb9['model'];_0xbd4e9f[_0xd4f0('0x41')]=qs[_0xd4f0('0x42')](_0x1c91a7['query']['sort']);_0xbd4e9f[_0xd4f0('0x43')]=qs[_0xd4f0('0x44')](_[_0xd4f0('0x45')](_0x1c91a7['query'],_0x373fb9['filters']));if(_0x1c91a7[_0xd4f0('0x3a')][_0xd4f0('0x46')]){_0xbd4e9f[_0xd4f0('0x43')]=_[_0xd4f0('0x47')](_0xbd4e9f[_0xd4f0('0x43')],{'$or':_[_0xd4f0('0x2e')](_0xbd4e9f[_0xd4f0('0x3e')],function(_0x16791c){var _0x181c83={};_0x181c83[_0x16791c]={'$like':'%'+_0x1c91a7[_0xd4f0('0x3a')]['filter']+'%'};return _0x181c83;})});}_0xbd4e9f=_[_0xd4f0('0x47')]({},_0xbd4e9f,_0x1c91a7[_0xd4f0('0x48')]);return _0x12d67b[_0xd4f0('0xb8')](_0xbd4e9f);}})['then'](function(_0x3ec838){if(_0x3ec838){_0x4ea804=_0x3ec838['length'];if(!_0x1c91a7['query'][_0xd4f0('0x40')](_0xd4f0('0x60'))){_0xbd4e9f[_0xd4f0('0x1f')]=qs['limit'](_0x1c91a7[_0xd4f0('0x3a')]['limit']);_0xbd4e9f[_0xd4f0('0x1d')]=qs[_0xd4f0('0x1d')](_0x1c91a7[_0xd4f0('0x3a')][_0xd4f0('0x1d')]);}return _0x12d67b['getBlackLists'](_0xbd4e9f);}})[_0xd4f0('0x26')](function(_0x421a9a){if(_0x421a9a){return _0x421a9a?{'count':_0x4ea804,'rows':_0x421a9a}:null;}})['then'](respondWithResult(_0x3a3e47,null))[_0xd4f0('0x50')](handleError(_0x3a3e47,null));};exports[_0xd4f0('0xb9')]=function(_0x59bdde,_0x333b7e,_0x34c7d6){var _0x825fb7,_0x17c9b2;return db[_0xd4f0('0x38')][_0xd4f0('0x31')]({'where':{'id':_0x59bdde[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x333b7e,null))[_0xd4f0('0x26')](function(_0x28c006){if(_0x28c006){_0x17c9b2=_0x28c006;return _0x28c006[_0xd4f0('0xb9')](_0x59bdde['body']['ids'],_[_0xd4f0('0x5b')](_0x59bdde[_0xd4f0('0x52')],[_0xd4f0('0x7c'),'id'])||{});}return null;})[_0xd4f0('0x91')](function(_0x3c3a4d){var _0x4957e9;_0x825fb7=_0x3c3a4d||[];var _0x1c5967=[];if(_0x3c3a4d){for(var _0xed80ec=0x0;_0xed80ec<_0x3c3a4d[_0xd4f0('0x3f')];_0xed80ec+=0x1){var _0xbda04b=_0x3c3a4d[_0xed80ec][_0xd4f0('0x28')]({'plain':!![]});_0x4957e9=squel[_0xd4f0('0x9f')]()[_0xd4f0('0xa0')](_0xd4f0('0xba'))[_0xd4f0('0xa2')](['phone','ContactId',_0xd4f0('0xa6'),_0xd4f0('0x63'),_0xd4f0('0x59'),_0xd4f0('0x5a')],squel[_0xd4f0('0x7d')]()[_0xd4f0('0x7e')]('phone',_0xd4f0('0xa3'))[_0xd4f0('0x7e')]('id',_0xd4f0('0xa5'))[_0xd4f0('0x7e')](_0xbda04b[_0xd4f0('0xa7')][_0xd4f0('0x87')](),_0xd4f0('0xa6'))[_0xd4f0('0x7e')](_0x59bdde[_0xd4f0('0x4d')]['id']['toString'](),_0xd4f0('0x63'))['field']('NOW()','createdAt')['field'](_0xd4f0('0xbb'),_0xd4f0('0x5a'))[_0xd4f0('0x80')](_0xd4f0('0xa8'))[_0xd4f0('0x43')](_0xd4f0('0xaf'))['where']('ListId\x20=\x20?',_0xbda04b[_0xd4f0('0xa7')][_0xd4f0('0x87')]())[_0xd4f0('0x43')](_0xd4f0('0xaa')))[_0xd4f0('0x87')]();_0x1c5967['push'](db['sequelize'][_0xd4f0('0x3a')](_0x4957e9));}return BPromise[_0xd4f0('0x95')](_0x1c5967);}})['then'](function(){return _0x825fb7;})[_0xd4f0('0x26')](respondWithResult(_0x333b7e,null))['catch'](handleError(_0x333b7e,null));};exports[_0xd4f0('0xbc')]=function(_0xa503e7,_0x3eea40,_0x3a4009){return db[_0xd4f0('0x38')][_0xd4f0('0x31')]({'where':{'id':_0xa503e7[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](handleEntityNotFound(_0x3eea40,null))['then'](function(_0x5ad970){if(_0x5ad970){return _0x5ad970['removeBlackLists'](_0xa503e7['query'][_0xd4f0('0x7c')]);}})['then'](function(_0x41248a){if(_0x41248a){return db['CmHopperBlack'][_0xd4f0('0x27')]({'where':{'ListId':_0xa503e7[_0xd4f0('0x3a')][_0xd4f0('0x7c')],'VoiceQueueId':_0xa503e7[_0xd4f0('0x4d')]['id']}})[_0xd4f0('0x26')](function(){return _0x41248a;});}})[_0xd4f0('0x26')](respondWithStatusCode(_0x3eea40,null))[_0xd4f0('0x50')](handleError(_0x3eea40,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 3c30670..a5bdaf6 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 _0xaf76=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x50eafa,_0x400830){var _0x1b5227=function(_0x5498c4){while(--_0x5498c4){_0x50eafa['push'](_0x50eafa['shift']());}};_0x1b5227(++_0x400830);}(_0xaf76,0xe2));var _0x6af7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaf76[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6af7('0x0'));var VoiceQueue=require(_0x6af7('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6af7('0x2')](0x0);var events={'afterCreate':_0x6af7('0x3'),'afterUpdate':_0x6af7('0x4'),'afterDestroy':_0x6af7('0x5')};function emitEvent(_0x5499f2){return function(_0x1616b1,_0x575391,_0x23789f){VoiceQueueEvents[_0x6af7('0x6')](_0x5499f2+':'+_0x1616b1['id'],_0x1616b1);VoiceQueueEvents[_0x6af7('0x6')](_0x5499f2,_0x1616b1);_0x23789f(null);};}for(var e in events){if(events[_0x6af7('0x7')](e)){var event=events[e];VoiceQueue[_0x6af7('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x0654=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue'];(function(_0x283771,_0x3ba4bd){var _0x251945=function(_0x4fefcc){while(--_0x4fefcc){_0x283771['push'](_0x283771['shift']());}};_0x251945(++_0x3ba4bd);}(_0x0654,0x16f));var _0x4065=function(_0x5c7734,_0x5a2a10){_0x5c7734=_0x5c7734-0x0;var _0xdcee38=_0x0654[_0x5c7734];return _0xdcee38;};'use strict';var EventEmitter=require(_0x4065('0x0'));var VoiceQueue=require(_0x4065('0x1'))['db'][_0x4065('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4065('0x3')](0x0);var events={'afterCreate':_0x4065('0x4'),'afterUpdate':_0x4065('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2e4225){return function(_0x1c7694,_0x4098ff,_0x470117){VoiceQueueEvents[_0x4065('0x6')](_0x2e4225+':'+_0x1c7694['id'],_0x1c7694);VoiceQueueEvents['emit'](_0x2e4225,_0x1c7694);_0x470117(null);};}for(var e in events){if(events[_0x4065('0x7')](e)){var event=events[e];VoiceQueue[_0x4065('0x8')](e,emitEvent(event));}}module[_0x4065('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 4c07f1f..2d79eb2 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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4b7b69,_0x3ab075){var _0x173b4c=function(_0x234d5f){while(--_0x234d5f){_0x4b7b69['push'](_0x4b7b69['shift']());}};_0x173b4c(++_0x3ab075);}(_0x55ca,0x126));var _0xa55c=function(_0x4d73b1,_0x91ab71){_0x4d73b1=_0x4d73b1-0x0;var _0xe394f9=_0x55ca[_0x4d73b1];return _0xe394f9;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0xded7ec,_0x7cd9f9){var _0x3e4c42=function(_0x4acf51){while(--_0x4acf51){_0xded7ec['push'](_0xded7ec['shift']());}};_0x3e4c42(++_0x7cd9f9);}(_0x34e8,0x12c));var _0x834e=function(_0x2b21f1,_0x48b6ac){_0x2b21f1=_0x2b21f1-0x0;var _0x1301ec=_0x34e8[_0x2b21f1];return _0x1301ec;};'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 7744ba3..e5ffb35 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 _0x92c3=['redis','socket.io-emitter','./voiceQueue.socket','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceQueue,\x20%s,\x20%s','result','catch','VoiceQueue','findAll','options','raw','limit','map','model','attributes','include','GetVoiceQueue','find','where','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','defaults'];(function(_0x24c963,_0x5f32a4){var _0x32a0eb=function(_0x3fd2eb){while(--_0x3fd2eb){_0x24c963['push'](_0x24c963['shift']());}};_0x32a0eb(++_0x5f32a4);}(_0x92c3,0x1ca));var _0x392c=function(_0x584bf4,_0x16c912){_0x584bf4=_0x584bf4-0x0;var _0x275380=_0x92c3[_0x584bf4];return _0x275380;};'use strict';var _=require(_0x392c('0x0'));var util=require(_0x392c('0x1'));var moment=require(_0x392c('0x2'));var BPromise=require(_0x392c('0x3'));var rs=require(_0x392c('0x4'));var fs=require('fs');var Redis=require(_0x392c('0x5'));var db=require(_0x392c('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x392c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x392c('0x8')]['http']({'port':0x232a});config['redis']=_[_0x392c('0x9')](config[_0x392c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x392c('0xb'))(new Redis(config[_0x392c('0xa')]));require(_0x392c('0xc'))['register'](socket);function respondWithRpcPromise(_0x5613cd,_0x3f0fea,_0x35f730){return new BPromise(function(_0x5ed916,_0xb6e12){return client[_0x392c('0xd')](_0x5613cd,_0x35f730)[_0x392c('0xe')](function(_0x2aaf2f){logger[_0x392c('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x3f0fea,_0x392c('0x10'));logger[_0x392c('0x11')](_0x392c('0x12'),_0x3f0fea,_0x392c('0x10'),JSON[_0x392c('0x13')](_0x2aaf2f));if(_0x2aaf2f['error']){if(_0x2aaf2f[_0x392c('0x14')][_0x392c('0x15')]===0x1f4){logger[_0x392c('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x3f0fea,_0x2aaf2f[_0x392c('0x14')][_0x392c('0x16')]);return _0xb6e12(_0x2aaf2f[_0x392c('0x14')][_0x392c('0x16')]);}logger[_0x392c('0x14')](_0x392c('0x17'),_0x3f0fea,_0x2aaf2f[_0x392c('0x14')][_0x392c('0x16')]);return _0x5ed916(_0x2aaf2f['error'][_0x392c('0x16')]);}else{logger[_0x392c('0xf')](_0x392c('0x17'),_0x3f0fea,_0x392c('0x10'));_0x5ed916(_0x2aaf2f[_0x392c('0x18')][_0x392c('0x16')]);}})[_0x392c('0x19')](function(_0x3213f7){logger['error'](_0x392c('0x17'),_0x3f0fea,_0x3213f7);_0xb6e12(_0x3213f7);});});}exports['GetVoiceQueue']=function(_0x492c8c){var _0x56a93d=this;return new Promise(function(_0x237ab7,_0x2f35e8){return db[_0x392c('0x1a')][_0x392c('0x1b')]({'raw':_0x492c8c['options']?_0x492c8c[_0x392c('0x1c')][_0x392c('0x1d')]===undefined?!![]:![]:!![],'where':_0x492c8c[_0x392c('0x1c')]?_0x492c8c['options']['where']||null:null,'attributes':_0x492c8c[_0x392c('0x1c')]?_0x492c8c[_0x392c('0x1c')]['attributes']||null:null,'limit':_0x492c8c[_0x392c('0x1c')]?_0x492c8c[_0x392c('0x1c')][_0x392c('0x1e')]||null:null,'include':_0x492c8c[_0x392c('0x1c')]?_0x492c8c[_0x392c('0x1c')]['include']?_[_0x392c('0x1f')](_0x492c8c['options']['include'],function(_0x1b45b9){return{'model':db[_0x1b45b9[_0x392c('0x20')]],'as':_0x1b45b9['as'],'attributes':_0x1b45b9[_0x392c('0x21')],'include':_0x1b45b9[_0x392c('0x22')]?_['map'](_0x1b45b9[_0x392c('0x22')],function(_0x5d0a98){return{'model':db[_0x5d0a98[_0x392c('0x20')]],'as':_0x5d0a98['as'],'attributes':_0x5d0a98[_0x392c('0x21')],'include':_0x5d0a98[_0x392c('0x22')]?_[_0x392c('0x1f')](_0x5d0a98['include'],function(_0xea5f2e){return{'model':db[_0xea5f2e[_0x392c('0x20')]],'as':_0xea5f2e['as'],'attributes':_0xea5f2e[_0x392c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x392c('0xe')](function(_0x3de053){logger[_0x392c('0xf')](_0x392c('0x23'),_0x492c8c);logger['debug'](_0x392c('0x23'),_0x492c8c,JSON[_0x392c('0x13')](_0x3de053));_0x237ab7(_0x3de053);})[_0x392c('0x19')](function(_0x5ec015){logger['error']('GetVoiceQueue',_0x5ec015[_0x392c('0x16')],_0x492c8c);_0x2f35e8(_0x56a93d[_0x392c('0x14')](0x1f4,_0x5ec015[_0x392c('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x5bcc8b){var _0xa8d2e7=this;return new Promise(function(_0x4206b8,_0x1bf2bd){return db['VoiceQueue'][_0x392c('0x24')]({'raw':_0x5bcc8b['options']?_0x5bcc8b[_0x392c('0x1c')][_0x392c('0x1d')]===undefined?!![]:![]:!![],'where':_0x5bcc8b[_0x392c('0x1c')]?_0x5bcc8b[_0x392c('0x1c')][_0x392c('0x25')]||null:null,'attributes':_0x5bcc8b['options']?_0x5bcc8b[_0x392c('0x1c')]['attributes']||null:null,'include':_0x5bcc8b[_0x392c('0x1c')]?_0x5bcc8b[_0x392c('0x1c')][_0x392c('0x22')]?_['map'](_0x5bcc8b[_0x392c('0x1c')][_0x392c('0x22')],function(_0x45e19a){return{'model':db[_0x45e19a['model']],'as':_0x45e19a['as'],'attributes':_0x45e19a[_0x392c('0x21')],'include':_0x45e19a[_0x392c('0x22')]?_['map'](_0x45e19a['include'],function(_0x2c09f2){return{'model':db[_0x2c09f2[_0x392c('0x20')]],'as':_0x2c09f2['as'],'attributes':_0x2c09f2['attributes'],'include':_0x2c09f2[_0x392c('0x22')]?_['map'](_0x2c09f2[_0x392c('0x22')],function(_0x147d47){return{'model':db[_0x147d47[_0x392c('0x20')]],'as':_0x147d47['as'],'attributes':_0x147d47[_0x392c('0x21')]};}):[]};}):[]};}):[]:[]})[_0x392c('0xe')](function(_0x5f0061){logger[_0x392c('0xf')](_0x392c('0x26'),_0x5bcc8b);logger[_0x392c('0x11')](_0x392c('0x26'),_0x5bcc8b,JSON[_0x392c('0x13')](_0x5f0061));_0x4206b8(_0x5f0061);})['catch'](function(_0x1b9335){logger['error']('ShowVoiceQueue',_0x1b9335[_0x392c('0x16')],_0x5bcc8b);_0x1bf2bd(_0xa8d2e7[_0x392c('0x14')](0x1f4,_0x1b9335[_0x392c('0x16')]));});});}; \ No newline at end of file +var _0x9319=['stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','VoiceQueue','options','raw','where','limit','map','include','attributes','model','GetVoiceQueue','ShowVoiceQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x9319,0x17b));var _0x9931=function(_0x250148,_0x437a83){_0x250148=_0x250148-0x0;var _0x29fc06=_0x9319[_0x250148];return _0x29fc06;};'use strict';var _=require(_0x9931('0x0'));var util=require(_0x9931('0x1'));var moment=require('moment');var BPromise=require(_0x9931('0x2'));var rs=require(_0x9931('0x3'));var fs=require('fs');var Redis=require(_0x9931('0x4'));var db=require(_0x9931('0x5'))['db'];var utils=require(_0x9931('0x6'));var logger=require('../../config/logger')(_0x9931('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9931('0x8')][_0x9931('0x9')]({'port':0x232a});config[_0x9931('0xa')]=_['defaults'](config[_0x9931('0xa')],{'host':_0x9931('0xb'),'port':0x18eb});var socket=require(_0x9931('0xc'))(new Redis(config['redis']));require(_0x9931('0xd'))[_0x9931('0xe')](socket);function respondWithRpcPromise(_0x3631f5,_0x47d363,_0x210617){return new BPromise(function(_0x242b7a,_0x5ce664){return client[_0x9931('0xf')](_0x3631f5,_0x210617)[_0x9931('0x10')](function(_0x1394be){logger[_0x9931('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x47d363,_0x9931('0x12'));logger[_0x9931('0x13')](_0x9931('0x14'),_0x47d363,'request\x20sent',JSON[_0x9931('0x15')](_0x1394be));if(_0x1394be[_0x9931('0x16')]){if(_0x1394be[_0x9931('0x16')][_0x9931('0x17')]===0x1f4){logger['error'](_0x9931('0x18'),_0x47d363,_0x1394be[_0x9931('0x16')][_0x9931('0x19')]);return _0x5ce664(_0x1394be['error'][_0x9931('0x19')]);}logger[_0x9931('0x16')](_0x9931('0x18'),_0x47d363,_0x1394be[_0x9931('0x16')][_0x9931('0x19')]);return _0x242b7a(_0x1394be[_0x9931('0x16')]['message']);}else{logger['info'](_0x9931('0x18'),_0x47d363,_0x9931('0x12'));_0x242b7a(_0x1394be[_0x9931('0x1a')][_0x9931('0x19')]);}})[_0x9931('0x1b')](function(_0x237a64){logger[_0x9931('0x16')](_0x9931('0x18'),_0x47d363,_0x237a64);_0x5ce664(_0x237a64);});});}exports['GetVoiceQueue']=function(_0xe09a8d){var _0x1bce7d=this;return new Promise(function(_0x103538,_0x440fd5){return db[_0x9931('0x1c')]['findAll']({'raw':_0xe09a8d[_0x9931('0x1d')]?_0xe09a8d['options'][_0x9931('0x1e')]===undefined?!![]:![]:!![],'where':_0xe09a8d[_0x9931('0x1d')]?_0xe09a8d[_0x9931('0x1d')][_0x9931('0x1f')]||null:null,'attributes':_0xe09a8d[_0x9931('0x1d')]?_0xe09a8d[_0x9931('0x1d')]['attributes']||null:null,'limit':_0xe09a8d['options']?_0xe09a8d[_0x9931('0x1d')][_0x9931('0x20')]||null:null,'include':_0xe09a8d['options']?_0xe09a8d[_0x9931('0x1d')]['include']?_[_0x9931('0x21')](_0xe09a8d['options'][_0x9931('0x22')],function(_0x3dbdae){return{'model':db[_0x3dbdae['model']],'as':_0x3dbdae['as'],'attributes':_0x3dbdae[_0x9931('0x23')],'include':_0x3dbdae[_0x9931('0x22')]?_['map'](_0x3dbdae[_0x9931('0x22')],function(_0x3159c2){return{'model':db[_0x3159c2['model']],'as':_0x3159c2['as'],'attributes':_0x3159c2[_0x9931('0x23')],'include':_0x3159c2[_0x9931('0x22')]?_[_0x9931('0x21')](_0x3159c2[_0x9931('0x22')],function(_0x34ed6f){return{'model':db[_0x34ed6f[_0x9931('0x24')]],'as':_0x34ed6f['as'],'attributes':_0x34ed6f['attributes']};}):[]};}):[]};}):[]:[]})[_0x9931('0x10')](function(_0x8d5f69){logger['info'](_0x9931('0x25'),_0xe09a8d);logger[_0x9931('0x13')](_0x9931('0x25'),_0xe09a8d,JSON[_0x9931('0x15')](_0x8d5f69));_0x103538(_0x8d5f69);})[_0x9931('0x1b')](function(_0x879265){logger[_0x9931('0x16')](_0x9931('0x25'),_0x879265[_0x9931('0x19')],_0xe09a8d);_0x440fd5(_0x1bce7d[_0x9931('0x16')](0x1f4,_0x879265['message']));});});};exports[_0x9931('0x26')]=function(_0x99b880){var _0x15b2b7=this;return new Promise(function(_0x14e512,_0x4999c2){return db[_0x9931('0x1c')][_0x9931('0x27')]({'raw':_0x99b880[_0x9931('0x1d')]?_0x99b880[_0x9931('0x1d')][_0x9931('0x1e')]===undefined?!![]:![]:!![],'where':_0x99b880[_0x9931('0x1d')]?_0x99b880[_0x9931('0x1d')][_0x9931('0x1f')]||null:null,'attributes':_0x99b880[_0x9931('0x1d')]?_0x99b880[_0x9931('0x1d')][_0x9931('0x23')]||null:null,'include':_0x99b880['options']?_0x99b880[_0x9931('0x1d')][_0x9931('0x22')]?_[_0x9931('0x21')](_0x99b880[_0x9931('0x1d')]['include'],function(_0x257032){return{'model':db[_0x257032[_0x9931('0x24')]],'as':_0x257032['as'],'attributes':_0x257032[_0x9931('0x23')],'include':_0x257032[_0x9931('0x22')]?_['map'](_0x257032['include'],function(_0x19a0cc){return{'model':db[_0x19a0cc[_0x9931('0x24')]],'as':_0x19a0cc['as'],'attributes':_0x19a0cc[_0x9931('0x23')],'include':_0x19a0cc[_0x9931('0x22')]?_[_0x9931('0x21')](_0x19a0cc['include'],function(_0x3e492c){return{'model':db[_0x3e492c[_0x9931('0x24')]],'as':_0x3e492c['as'],'attributes':_0x3e492c[_0x9931('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9931('0x10')](function(_0x4c2252){logger['info'](_0x9931('0x26'),_0x99b880);logger[_0x9931('0x13')]('ShowVoiceQueue',_0x99b880,JSON['stringify'](_0x4c2252));_0x14e512(_0x4c2252);})[_0x9931('0x1b')](function(_0x37ce76){logger[_0x9931('0x16')](_0x9931('0x26'),_0x37ce76[_0x9931('0x19')],_0x99b880);_0x4999c2(_0x15b2b7[_0x9931('0x16')](0x1f4,_0x37ce76[_0x9931('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 4060dd8..8e28aab 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 _0x6ebb=['emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','remove','update'];(function(_0x118653,_0x50ef26){var _0xc11fa6=function(_0x2ec581){while(--_0x2ec581){_0x118653['push'](_0x118653['shift']());}};_0xc11fa6(++_0x50ef26);}(_0x6ebb,0x7d));var _0xb6eb=function(_0x1bb6dd,_0x4a0db2){_0x1bb6dd=_0x1bb6dd-0x0;var _0x4731bf=_0x6ebb[_0x1bb6dd];return _0x4731bf;};'use strict';var VoiceQueueEvents=require(_0xb6eb('0x0'));var events=['save',_0xb6eb('0x1'),_0xb6eb('0x2')];function createListener(_0x48c98c,_0x270aae){return function(_0x3c1fde){_0x270aae[_0xb6eb('0x3')](_0x48c98c,_0x3c1fde);};}function removeListener(_0x36af11,_0x21988f){return function(){VoiceQueueEvents[_0xb6eb('0x4')](_0x36af11,_0x21988f);};}exports[_0xb6eb('0x5')]=function(_0x53bc69){for(var _0x4cd31f=0x0,_0x1170c8=events[_0xb6eb('0x6')];_0x4cd31f<_0x1170c8;_0x4cd31f++){var _0x37ea9b=events[_0x4cd31f];var _0x11576c=createListener(_0xb6eb('0x7')+_0x37ea9b,_0x53bc69);VoiceQueueEvents['on'](_0x37ea9b,_0x11576c);}}; \ No newline at end of file +var _0xa716=['save','update','emit','removeListener','length','voiceQueue:','./voiceQueue.events'];(function(_0x233e08,_0x56a14b){var _0x3f40b2=function(_0x24f6e1){while(--_0x24f6e1){_0x233e08['push'](_0x233e08['shift']());}};_0x3f40b2(++_0x56a14b);}(_0xa716,0xa7));var _0x6a71=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa716[_0x321bb2];return _0x9c12ed;};'use strict';var VoiceQueueEvents=require(_0x6a71('0x0'));var events=[_0x6a71('0x1'),'remove',_0x6a71('0x2')];function createListener(_0x482a8d,_0x4eda15){return function(_0x3bd10f){_0x4eda15[_0x6a71('0x3')](_0x482a8d,_0x3bd10f);};}function removeListener(_0x6865c7,_0x5b0301){return function(){VoiceQueueEvents[_0x6a71('0x4')](_0x6865c7,_0x5b0301);};}exports['register']=function(_0x5e15d5){for(var _0x567dbb=0x0,_0x36e8ca=events[_0x6a71('0x5')];_0x567dbb<_0x36e8ca;_0x567dbb++){var _0x404479=events[_0x567dbb];var _0x2aa558=createListener(_0x6a71('0x6')+_0x404479,_0x5e15d5);VoiceQueueEvents['on'](_0x404479,_0x2aa558);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index bad0c07..638be1c 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 _0x68cf=['put','delete','destroy','multer','express','Router','../../components/auth/service','./voiceQueueReport.controller','get','/describe','isAuthenticated','getVoiceQueuesReport','/:id','post','create'];(function(_0x4c70c4,_0x963969){var _0x437865=function(_0x54e323){while(--_0x54e323){_0x4c70c4['push'](_0x4c70c4['shift']());}};_0x437865(++_0x963969);}(_0x68cf,0xd5));var _0xf68c=function(_0x35f1d8,_0x5e9c25){_0x35f1d8=_0x35f1d8-0x0;var _0x574a2a=_0x68cf[_0x35f1d8];return _0x574a2a;};'use strict';var multer=require(_0xf68c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf68c('0x1'));var router=express[_0xf68c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf68c('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf68c('0x4'));router[_0xf68c('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf68c('0x5')](_0xf68c('0x6'),auth[_0xf68c('0x7')](),controller['describe']);router[_0xf68c('0x5')]('/index',auth[_0xf68c('0x7')](),controller[_0xf68c('0x8')]);router[_0xf68c('0x5')](_0xf68c('0x9'),auth[_0xf68c('0x7')](),controller['show']);router[_0xf68c('0xa')]('/',auth[_0xf68c('0x7')](),controller[_0xf68c('0xb')]);router[_0xf68c('0xc')](_0xf68c('0x9'),auth[_0xf68c('0x7')](),controller['update']);router[_0xf68c('0xd')]('/:id',auth[_0xf68c('0x7')](),controller[_0xf68c('0xe')]);module['exports']=router; \ No newline at end of file +var _0xcb7b=['post','put','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe','describe','isAuthenticated','getVoiceQueuesReport','/:id','show'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xcb7b,0x16d));var _0xbcb7=function(_0xbc3e84,_0x26f548){_0xbc3e84=_0xbc3e84-0x0;var _0x3190dd=_0xcb7b[_0xbc3e84];return _0x3190dd;};'use strict';var multer=require(_0xbcb7('0x0'));var util=require(_0xbcb7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbcb7('0x2'));var router=express['Router']();var fs_extra=require(_0xbcb7('0x3'));var auth=require(_0xbcb7('0x4'));var interaction=require(_0xbcb7('0x5'));var config=require(_0xbcb7('0x6'));var controller=require(_0xbcb7('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbcb7('0x8')](_0xbcb7('0x9'),auth['isAuthenticated'](),controller[_0xbcb7('0xa')]);router[_0xbcb7('0x8')]('/index',auth[_0xbcb7('0xb')](),controller[_0xbcb7('0xc')]);router['get'](_0xbcb7('0xd'),auth['isAuthenticated'](),controller[_0xbcb7('0xe')]);router[_0xbcb7('0xf')]('/',auth[_0xbcb7('0xb')](),controller['create']);router[_0xbcb7('0x10')](_0xbcb7('0xd'),auth[_0xbcb7('0xb')](),controller['update']);router[_0xbcb7('0x11')](_0xbcb7('0xd'),auth['isAuthenticated'](),controller[_0xbcb7('0x12')]);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 106533e..02d60a6 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 _0x9156=['setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds'];(function(_0x59794f,_0x4ab1ad){var _0x1c5919=function(_0x3ec043){while(--_0x3ec043){_0x59794f['push'](_0x59794f['shift']());}};_0x1c5919(++_0x4ab1ad);}(_0x9156,0x155));var _0x6915=function(_0x14c95b,_0x3e3711){_0x14c95b=_0x14c95b-0x0;var _0x16f2c7=_0x9156[_0x14c95b];return _0x16f2c7;};'use strict';var Sequelize=require(_0x6915('0x0'));var moment=require(_0x6915('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x6915('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6915('0x2')]},'queue':{'type':Sequelize[_0x6915('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x6915('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x6915('0x3')],'set':function(_0xe3813e){var _0x55072c=moment(_0xe3813e);var _0x5eec15=moment(this[_0x6915('0x4')](_0x6915('0x5')))[_0x6915('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x490729=_0x55072c[_0x6915('0x7')](_0x5eec15,_0x6915('0x8'));this[_0x6915('0x9')](_0x6915('0xa'),_0xe3813e);this[_0x6915('0x9')]('holdtime',_0x490729||null);}},'position':{'type':Sequelize[_0x6915('0xb')]},'count':{'type':Sequelize[_0x6915('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x6915('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6915('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x6915('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x6915('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x6915('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x6915('0xb')]},'channel':{'type':Sequelize[_0x6915('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6915('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6915('0x2')]},'context':{'type':Sequelize[_0x6915('0x2')]},'exten':{'type':Sequelize[_0x6915('0x2')]},'priority':{'type':Sequelize[_0x6915('0x2')]},'holdtime':{'type':Sequelize[_0x6915('0xb')]},'mohtime':{'type':Sequelize[_0x6915('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6915('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6915('0x2')]},'transfer':{'type':Sequelize[_0x6915('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x6915('0xd')},'transferexten':{'type':Sequelize[_0x6915('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6915('0x2')]},'secondDisposition':{'type':Sequelize[_0x6915('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6915('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x6915('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x35cb=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format'];(function(_0x166cc7,_0x486d0c){var _0x196799=function(_0x598af5){while(--_0x598af5){_0x166cc7['push'](_0x166cc7['shift']());}};_0x196799(++_0x486d0c);}(_0x35cb,0x18e));var _0xb35c=function(_0x1289a2,_0x3e236f){_0x1289a2=_0x1289a2-0x0;var _0x2afb9f=_0x35cb[_0x1289a2];return _0x2afb9f;};'use strict';var Sequelize=require(_0xb35c('0x0'));var moment=require(_0xb35c('0x1'));module[_0xb35c('0x2')]={'type':{'type':Sequelize[_0xb35c('0x3')]},'uniqueid':{'type':Sequelize[_0xb35c('0x3')]},'calleridnum':{'type':Sequelize[_0xb35c('0x3')]},'calleridname':{'type':Sequelize[_0xb35c('0x3')]},'queue':{'type':Sequelize[_0xb35c('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xb35c('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xb35c('0x4')],'set':function(_0x592bea){var _0x1e0149=moment(_0x592bea);var _0x4b7e58=moment(this['getDataValue'](_0xb35c('0x5')))[_0xb35c('0x6')](_0xb35c('0x7'));var _0x3ac866=_0x1e0149[_0xb35c('0x8')](_0x4b7e58,_0xb35c('0x9'));this[_0xb35c('0xa')]('queuecallerleaveAt',_0x592bea);this[_0xb35c('0xa')](_0xb35c('0xb'),_0x3ac866||null);}},'position':{'type':Sequelize[_0xb35c('0xc')]},'count':{'type':Sequelize[_0xb35c('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xb35c('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0xb35c('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xb35c('0x4')]},'queuecallerexit':{'type':Sequelize[_0xb35c('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb35c('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xb35c('0xc')]},'channel':{'type':Sequelize[_0xb35c('0x3')]},'connectedlinenum':{'type':Sequelize[_0xb35c('0x3')]},'connectedlinename':{'type':Sequelize[_0xb35c('0x3')]},'accountcode':{'type':Sequelize[_0xb35c('0x3')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb35c('0x3')]},'priority':{'type':Sequelize[_0xb35c('0x3')]},'holdtime':{'type':Sequelize[_0xb35c('0xc')]},'mohtime':{'type':Sequelize[_0xb35c('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb35c('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb35c('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xb35c('0xe')},'transferexten':{'type':Sequelize[_0xb35c('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xb35c('0x3')]},'secondDisposition':{'type':Sequelize[_0xb35c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index b610540..c1bd136 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 _0x5f44=['sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','reject','save','update','then','error','stack','send','index','map','VoiceQueueReport','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','find','destroy','describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register'];(function(_0x1caa1d,_0xa95047){var _0xa05f41=function(_0xc58853){while(--_0xc58853){_0x1caa1d['push'](_0x1caa1d['shift']());}};_0xa05f41(++_0xa95047);}(_0x5f44,0x87));var _0x45f4=function(_0xfa9fa9,_0x4f5d57){_0xfa9fa9=_0xfa9fa9-0x0;var _0x189447=_0x5f44[_0xfa9fa9];return _0x189447;};'use strict';var emlformat=require(_0x45f4('0x0'));var rimraf=require(_0x45f4('0x1'));var zipdir=require(_0x45f4('0x2'));var jsonpatch=require(_0x45f4('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x45f4('0x4'));var Mustache=require('mustache');var util=require(_0x45f4('0x5'));var path=require(_0x45f4('0x6'));var sox=require('sox');var csv=require(_0x45f4('0x7'));var ejs=require(_0x45f4('0x8'));var fs=require('fs');var fs_extra=require(_0x45f4('0x9'));var _=require(_0x45f4('0xa'));var squel=require(_0x45f4('0xb'));var crypto=require(_0x45f4('0xc'));var jsforce=require(_0x45f4('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x45f4('0xe'));var Redis=require(_0x45f4('0xf'));var authService=require(_0x45f4('0x10'));var qs=require(_0x45f4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x45f4('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x45f4('0x13'));var db=require(_0x45f4('0x14'))['db'];config[_0x45f4('0x15')]=_[_0x45f4('0x16')](config[_0x45f4('0x15')],{'host':_0x45f4('0x17'),'port':0x18eb});var socket=require(_0x45f4('0x18'))(new Redis(config[_0x45f4('0x15')]));require(_0x45f4('0x19'))[_0x45f4('0x1a')](socket);function respondWithStatusCode(_0x307296,_0x53973c){_0x53973c=_0x53973c||0xcc;return function(_0x5f3421){if(_0x5f3421){return _0x307296[_0x45f4('0x1b')](_0x53973c);}return _0x307296['status'](_0x53973c)[_0x45f4('0x1c')]();};}function respondWithResult(_0x25f010,_0x1b3f35){_0x1b3f35=_0x1b3f35||0xc8;return function(_0x31faaf){if(_0x31faaf){return _0x25f010['status'](_0x1b3f35)[_0x45f4('0x1d')](_0x31faaf);}};}function respondWithFilteredResult(_0x56667f,_0x576bc0){return function(_0x383125){if(_0x383125){var _0xee62a8=typeof _0x576bc0['offset']===_0x45f4('0x1e')&&typeof _0x576bc0[_0x45f4('0x1f')]===_0x45f4('0x1e');var _0x407855=_0x383125[_0x45f4('0x20')];var _0xcbc3cb=_0xee62a8?0x0:_0x576bc0['offset'];var _0x3453ca=_0xee62a8?_0x383125[_0x45f4('0x20')]:_0x576bc0[_0x45f4('0x21')]+_0x576bc0[_0x45f4('0x1f')];var _0x4a6a8e;if(_0x3453ca>=_0x407855){_0x3453ca=_0x407855;_0x4a6a8e=0xc8;}else{_0x4a6a8e=0xce;}_0x56667f[_0x45f4('0x22')](_0x4a6a8e);return _0x56667f['set'](_0x45f4('0x23'),_0xcbc3cb+'-'+_0x3453ca+'/'+_0x407855)['json'](_0x383125);}return null;};}function patchUpdates(_0x54760d){return function(_0x4b8e07){try{jsonpatch['apply'](_0x4b8e07,_0x54760d,!![]);}catch(_0x1dcd45){return BPromise[_0x45f4('0x24')](_0x1dcd45);}return _0x4b8e07[_0x45f4('0x25')]();};}function saveUpdates(_0x3c4b50,_0x5376fe){return function(_0x3061ee){if(_0x3061ee){return _0x3061ee[_0x45f4('0x26')](_0x3c4b50)[_0x45f4('0x27')](function(_0x89a079){return _0x89a079;});}return null;};}function removeEntity(_0x12acb6,_0x1edf6e){return function(_0x1307e2){if(_0x1307e2){return _0x1307e2['destroy']()[_0x45f4('0x27')](function(){_0x12acb6[_0x45f4('0x22')](0xcc)[_0x45f4('0x1c')]();});}};}function handleEntityNotFound(_0x3bd58d,_0x2704cd){return function(_0xdcb8){if(!_0xdcb8){_0x3bd58d[_0x45f4('0x1b')](0x194);}return _0xdcb8;};}function handleError(_0x879242,_0x3eedf4){_0x3eedf4=_0x3eedf4||0x1f4;return function(_0x4ab9dd){logger[_0x45f4('0x28')](_0x4ab9dd[_0x45f4('0x29')]);if(_0x4ab9dd['name']){delete _0x4ab9dd['name'];}_0x879242[_0x45f4('0x22')](_0x3eedf4)[_0x45f4('0x2a')](_0x4ab9dd);};}exports[_0x45f4('0x2b')]=function(_0x30b8e9,_0x598e1f){var _0x4e2380={},_0x375835={},_0x3b53f3={'count':0x0,'rows':[]};var _0x2c1195=_[_0x45f4('0x2c')](db[_0x45f4('0x2d')]['rawAttributes'],function(_0x42ae39){return{'name':_0x42ae39[_0x45f4('0x2e')],'type':_0x42ae39[_0x45f4('0x2f')][_0x45f4('0x30')]};});_0x375835[_0x45f4('0x31')]=_['map'](_0x2c1195,_0x45f4('0x32'));_0x375835[_0x45f4('0x33')]=_[_0x45f4('0x34')](_0x30b8e9['query']);_0x375835[_0x45f4('0x35')]=_[_0x45f4('0x36')](_0x375835['model'],_0x375835[_0x45f4('0x33')]);_0x4e2380['attributes']=_['intersection'](_0x375835[_0x45f4('0x31')],qs[_0x45f4('0x37')](_0x30b8e9[_0x45f4('0x33')][_0x45f4('0x37')]));_0x4e2380['attributes']=_0x4e2380[_0x45f4('0x38')][_0x45f4('0x39')]?_0x4e2380[_0x45f4('0x38')]:_0x375835[_0x45f4('0x31')];if(!_0x30b8e9[_0x45f4('0x33')]['hasOwnProperty'](_0x45f4('0x3a'))){_0x4e2380[_0x45f4('0x1f')]=qs['limit'](_0x30b8e9[_0x45f4('0x33')][_0x45f4('0x1f')]);_0x4e2380[_0x45f4('0x21')]=qs[_0x45f4('0x21')](_0x30b8e9[_0x45f4('0x33')][_0x45f4('0x21')]);}_0x4e2380[_0x45f4('0x3b')]=qs[_0x45f4('0x3c')](_0x30b8e9['query']['sort']);_0x4e2380[_0x45f4('0x3d')]=qs[_0x45f4('0x35')](_[_0x45f4('0x3e')](_0x30b8e9[_0x45f4('0x33')],_0x375835[_0x45f4('0x35')]),_0x2c1195);if(_0x30b8e9[_0x45f4('0x33')][_0x45f4('0x3f')]){_0x4e2380[_0x45f4('0x3d')]=_[_0x45f4('0x40')](_0x4e2380[_0x45f4('0x3d')],{'$or':_[_0x45f4('0x2c')](_0x2c1195,function(_0x4884f3){if(_0x4884f3[_0x45f4('0x2f')]!==_0x45f4('0x41')){var _0x4d4ea4={};_0x4d4ea4[_0x4884f3[_0x45f4('0x32')]]={'$like':'%'+_0x30b8e9[_0x45f4('0x33')][_0x45f4('0x3f')]+'%'};return _0x4d4ea4;}})});}_0x4e2380=_['merge']({},_0x4e2380,_0x30b8e9[_0x45f4('0x42')]);var _0x731aa0={'where':_0x4e2380[_0x45f4('0x3d')]};return db['VoiceQueueReport'][_0x45f4('0x20')](_0x731aa0)['then'](function(_0x35e920){_0x3b53f3['count']=_0x35e920;if(_0x30b8e9['query'][_0x45f4('0x43')]){_0x4e2380[_0x45f4('0x44')]=[{'all':!![]}];}return db[_0x45f4('0x2d')][_0x45f4('0x45')](_0x4e2380);})['then'](function(_0x3e7005){_0x3b53f3[_0x45f4('0x46')]=_0x3e7005;return _0x3b53f3;})[_0x45f4('0x27')](respondWithFilteredResult(_0x598e1f,_0x4e2380))[_0x45f4('0x47')](handleError(_0x598e1f,null));};exports[_0x45f4('0x48')]=function(_0x146ea8,_0x5533ed){var _0x530d38={'raw':![],'where':{'id':_0x146ea8['params']['id']}},_0x258e61={};_0x258e61[_0x45f4('0x31')]=_['keys'](db[_0x45f4('0x2d')][_0x45f4('0x49')]);_0x258e61['query']=_['keys'](_0x146ea8[_0x45f4('0x33')]);_0x258e61[_0x45f4('0x35')]=_[_0x45f4('0x36')](_0x258e61['model'],_0x258e61['query']);_0x530d38['attributes']=_['intersection'](_0x258e61[_0x45f4('0x31')],qs[_0x45f4('0x37')](_0x146ea8[_0x45f4('0x33')][_0x45f4('0x37')]));_0x530d38[_0x45f4('0x38')]=_0x530d38[_0x45f4('0x38')][_0x45f4('0x39')]?_0x530d38[_0x45f4('0x38')]:_0x258e61[_0x45f4('0x31')];if(_0x146ea8[_0x45f4('0x33')]['includeAll']){_0x530d38[_0x45f4('0x44')]=[{'all':!![]}];}_0x530d38=_[_0x45f4('0x40')]({},_0x530d38,_0x146ea8[_0x45f4('0x42')]);return db[_0x45f4('0x2d')]['find'](_0x530d38)[_0x45f4('0x27')](handleEntityNotFound(_0x5533ed,null))[_0x45f4('0x27')](respondWithResult(_0x5533ed,null))[_0x45f4('0x47')](handleError(_0x5533ed,null));};exports[_0x45f4('0x4a')]=function(_0x46b615,_0x55f1a7){return db[_0x45f4('0x2d')][_0x45f4('0x4a')](_0x46b615[_0x45f4('0x4b')],{})[_0x45f4('0x27')](respondWithResult(_0x55f1a7,0xc9))['catch'](handleError(_0x55f1a7,null));};exports['update']=function(_0x4e27b0,_0xa35e5f){if(_0x4e27b0[_0x45f4('0x4b')]['id']){delete _0x4e27b0[_0x45f4('0x4b')]['id'];}return db[_0x45f4('0x2d')][_0x45f4('0x4c')]({'where':{'id':_0x4e27b0['params']['id']}})['then'](handleEntityNotFound(_0xa35e5f,null))['then'](saveUpdates(_0x4e27b0[_0x45f4('0x4b')],null))[_0x45f4('0x27')](respondWithResult(_0xa35e5f,null))['catch'](handleError(_0xa35e5f,null));};exports[_0x45f4('0x4d')]=function(_0x373f40,_0x5589e6){return db['VoiceQueueReport'][_0x45f4('0x4c')]({'where':{'id':_0x373f40['params']['id']}})[_0x45f4('0x27')](handleEntityNotFound(_0x5589e6,null))['then'](removeEntity(_0x5589e6,null))[_0x45f4('0x47')](handleError(_0x5589e6,null));};exports['describe']=function(_0xfe94f,_0x41d6be){return db[_0x45f4('0x2d')][_0x45f4('0x4e')]()['then'](respondWithResult(_0x41d6be,null))[_0x45f4('0x47')](handleError(_0x41d6be,null));};exports[_0x45f4('0x4f')]=function(_0x357203,_0x3980cb){var _0x4c6817={},_0x29b688={},_0x2c5f94={'count':0x0,'rows':[]};_0x29b688['model']=_[_0x45f4('0x34')](db[_0x45f4('0x2d')][_0x45f4('0x49')]);_0x29b688[_0x45f4('0x33')]=_[_0x45f4('0x34')](_0x357203[_0x45f4('0x33')]);_0x29b688[_0x45f4('0x35')]=_[_0x45f4('0x36')](_0x29b688[_0x45f4('0x31')],_0x29b688[_0x45f4('0x33')]);_0x4c6817[_0x45f4('0x38')]=_[_0x45f4('0x36')](_0x29b688[_0x45f4('0x31')],qs[_0x45f4('0x37')](_0x357203[_0x45f4('0x33')][_0x45f4('0x37')]));_0x4c6817[_0x45f4('0x38')]=_0x4c6817[_0x45f4('0x38')]['length']?_0x4c6817[_0x45f4('0x38')]:_0x29b688[_0x45f4('0x31')];if(!_0x357203['query'][_0x45f4('0x50')](_0x45f4('0x3a'))){_0x4c6817[_0x45f4('0x1f')]=qs[_0x45f4('0x1f')](_0x357203[_0x45f4('0x33')]['limit']);_0x4c6817[_0x45f4('0x21')]=qs['offset'](_0x357203[_0x45f4('0x33')][_0x45f4('0x21')]);}_0x4c6817[_0x45f4('0x3b')]=qs[_0x45f4('0x3c')](_0x357203['query'][_0x45f4('0x3c')]);_0x4c6817[_0x45f4('0x3d')]=qs[_0x45f4('0x35')](_[_0x45f4('0x3e')](_0x357203[_0x45f4('0x33')],_0x29b688[_0x45f4('0x35')]));if(_0x357203[_0x45f4('0x33')][_0x45f4('0x3f')]){_0x4c6817[_0x45f4('0x3d')]=_[_0x45f4('0x40')](_0x4c6817[_0x45f4('0x3d')],{'$or':_['map'](_0x4c6817['attributes'],function(_0x2c18ce){var _0x2a2324={};_0x2a2324[_0x2c18ce]={'$like':'%'+_0x357203[_0x45f4('0x33')][_0x45f4('0x3f')]+'%'};return _0x2a2324;})});}_0x4c6817=_[_0x45f4('0x40')]({},_0x4c6817,_0x357203[_0x45f4('0x42')]);var _0x240147={'where':_0x4c6817[_0x45f4('0x3d')]};return db[_0x45f4('0x2d')][_0x45f4('0x20')](_0x240147)[_0x45f4('0x27')](function(_0x4e98d3){_0x2c5f94[_0x45f4('0x20')]=_0x4e98d3;if(_0x357203[_0x45f4('0x33')][_0x45f4('0x43')]){_0x4c6817[_0x45f4('0x44')]=[{'all':!![]}];}return db[_0x45f4('0x2d')][_0x45f4('0x45')](_0x4c6817);})['then'](function(_0x1ec133){_0x2c5f94['rows']=_0x1ec133;return _0x2c5f94;})[_0x45f4('0x27')](respondWithFilteredResult(_0x3980cb,_0x4c6817,'getVoiceQueuesReport'))[_0x45f4('0x47')](handleError(_0x3980cb,null,_0x45f4('0x4f')));}; \ No newline at end of file +var _0x9877=['redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','includeAll','include','rows','show','params','options','find','catch','create','body','destroy','describe','getVoiceQueuesReport','sort','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9877,0x139));var _0x7987=function(_0x45d4a0,_0x364983){_0x45d4a0=_0x45d4a0-0x0;var _0x5db710=_0x9877[_0x45d4a0];return _0x5db710;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7987('0x0'));var zipdir=require(_0x7987('0x1'));var jsonpatch=require(_0x7987('0x2'));var rp=require('request-promise');var moment=require(_0x7987('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7987('0x4'));var util=require(_0x7987('0x5'));var path=require(_0x7987('0x6'));var sox=require(_0x7987('0x7'));var csv=require(_0x7987('0x8'));var ejs=require(_0x7987('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7987('0xa'));var squel=require(_0x7987('0xb'));var crypto=require(_0x7987('0xc'));var jsforce=require(_0x7987('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7987('0x8'));var querystring=require(_0x7987('0xe'));var Papa=require(_0x7987('0xf'));var Redis=require(_0x7987('0x10'));var authService=require(_0x7987('0x11'));var qs=require(_0x7987('0x12'));var as=require(_0x7987('0x13'));var hardwareService=require(_0x7987('0x14'));var logger=require(_0x7987('0x15'))(_0x7987('0x16'));var utils=require(_0x7987('0x17'));var config=require(_0x7987('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7987('0x19'))['db'];config['redis']=_[_0x7987('0x1a')](config[_0x7987('0x1b')],{'host':_0x7987('0x1c'),'port':0x18eb});var socket=require(_0x7987('0x1d'))(new Redis(config['redis']));require(_0x7987('0x1e'))[_0x7987('0x1f')](socket);function respondWithStatusCode(_0xbe48f6,_0x149963){_0x149963=_0x149963||0xcc;return function(_0x592931){if(_0x592931){return _0xbe48f6[_0x7987('0x20')](_0x149963);}return _0xbe48f6[_0x7987('0x21')](_0x149963)['end']();};}function respondWithResult(_0x409464,_0x37019a){_0x37019a=_0x37019a||0xc8;return function(_0x18f0c){if(_0x18f0c){return _0x409464[_0x7987('0x21')](_0x37019a)[_0x7987('0x22')](_0x18f0c);}};}function respondWithFilteredResult(_0x5ec933,_0xa4f5e6){return function(_0x32b418){if(_0x32b418){var _0x2edfcf=typeof _0xa4f5e6[_0x7987('0x23')]===_0x7987('0x24')&&typeof _0xa4f5e6['limit']===_0x7987('0x24');var _0x438ad0=_0x32b418[_0x7987('0x25')];var _0x4afb0b=_0x2edfcf?0x0:_0xa4f5e6[_0x7987('0x23')];var _0x311093=_0x2edfcf?_0x32b418[_0x7987('0x25')]:_0xa4f5e6[_0x7987('0x23')]+_0xa4f5e6[_0x7987('0x26')];var _0x3955d0;if(_0x311093>=_0x438ad0){_0x311093=_0x438ad0;_0x3955d0=0xc8;}else{_0x3955d0=0xce;}_0x5ec933[_0x7987('0x21')](_0x3955d0);return _0x5ec933[_0x7987('0x27')](_0x7987('0x28'),_0x4afb0b+'-'+_0x311093+'/'+_0x438ad0)[_0x7987('0x22')](_0x32b418);}return null;};}function patchUpdates(_0x30fdea){return function(_0x10fe79){try{jsonpatch[_0x7987('0x29')](_0x10fe79,_0x30fdea,!![]);}catch(_0x47b70d){return BPromise[_0x7987('0x2a')](_0x47b70d);}return _0x10fe79[_0x7987('0x2b')]();};}function saveUpdates(_0x43a8aa,_0x399dc2){return function(_0x504e89){if(_0x504e89){return _0x504e89[_0x7987('0x2c')](_0x43a8aa)[_0x7987('0x2d')](function(_0x1d6f47){return _0x1d6f47;});}return null;};}function removeEntity(_0x4b60fc,_0x38ab95){return function(_0x58c3a2){if(_0x58c3a2){return _0x58c3a2['destroy']()[_0x7987('0x2d')](function(){_0x4b60fc[_0x7987('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe269ab,_0x3d8e9e){return function(_0x29934e){if(!_0x29934e){_0xe269ab[_0x7987('0x20')](0x194);}return _0x29934e;};}function handleError(_0x344b2a,_0x1e034b){_0x1e034b=_0x1e034b||0x1f4;return function(_0x49b5cb){logger[_0x7987('0x2e')](_0x49b5cb['stack']);if(_0x49b5cb[_0x7987('0x2f')]){delete _0x49b5cb['name'];}_0x344b2a[_0x7987('0x21')](_0x1e034b)[_0x7987('0x30')](_0x49b5cb);};}exports[_0x7987('0x31')]=function(_0x25e212,_0x23c36f){var _0x463f62={},_0x11900c={},_0x13ca4d={'count':0x0,'rows':[]};var _0x4b6f9c=_[_0x7987('0x32')](db[_0x7987('0x33')][_0x7987('0x34')],function(_0x377d1d){return{'name':_0x377d1d[_0x7987('0x35')],'type':_0x377d1d[_0x7987('0x36')][_0x7987('0x37')]};});_0x11900c[_0x7987('0x38')]=_[_0x7987('0x32')](_0x4b6f9c,_0x7987('0x2f'));_0x11900c[_0x7987('0x39')]=_[_0x7987('0x3a')](_0x25e212[_0x7987('0x39')]);_0x11900c[_0x7987('0x3b')]=_[_0x7987('0x3c')](_0x11900c[_0x7987('0x38')],_0x11900c[_0x7987('0x39')]);_0x463f62['attributes']=_[_0x7987('0x3c')](_0x11900c[_0x7987('0x38')],qs[_0x7987('0x3d')](_0x25e212[_0x7987('0x39')][_0x7987('0x3d')]));_0x463f62[_0x7987('0x3e')]=_0x463f62[_0x7987('0x3e')][_0x7987('0x3f')]?_0x463f62[_0x7987('0x3e')]:_0x11900c[_0x7987('0x38')];if(!_0x25e212[_0x7987('0x39')][_0x7987('0x40')](_0x7987('0x41'))){_0x463f62[_0x7987('0x26')]=qs['limit'](_0x25e212['query'][_0x7987('0x26')]);_0x463f62[_0x7987('0x23')]=qs['offset'](_0x25e212['query'][_0x7987('0x23')]);}_0x463f62[_0x7987('0x42')]=qs['sort'](_0x25e212['query']['sort']);_0x463f62[_0x7987('0x43')]=qs[_0x7987('0x3b')](_['pick'](_0x25e212[_0x7987('0x39')],_0x11900c[_0x7987('0x3b')]),_0x4b6f9c);if(_0x25e212['query'][_0x7987('0x44')]){_0x463f62[_0x7987('0x43')]=_[_0x7987('0x45')](_0x463f62['where'],{'$or':_['map'](_0x4b6f9c,function(_0x207069){if(_0x207069[_0x7987('0x36')]!==_0x7987('0x46')){var _0x4fbdce={};_0x4fbdce[_0x207069[_0x7987('0x2f')]]={'$like':'%'+_0x25e212['query'][_0x7987('0x44')]+'%'};return _0x4fbdce;}})});}_0x463f62=_[_0x7987('0x45')]({},_0x463f62,_0x25e212['options']);var _0x44d1ff={'where':_0x463f62[_0x7987('0x43')]};return db[_0x7987('0x33')][_0x7987('0x25')](_0x44d1ff)[_0x7987('0x2d')](function(_0xfa08bd){_0x13ca4d[_0x7987('0x25')]=_0xfa08bd;if(_0x25e212['query'][_0x7987('0x47')]){_0x463f62[_0x7987('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x463f62);})[_0x7987('0x2d')](function(_0x3da426){_0x13ca4d[_0x7987('0x49')]=_0x3da426;return _0x13ca4d;})['then'](respondWithFilteredResult(_0x23c36f,_0x463f62))['catch'](handleError(_0x23c36f,null));};exports[_0x7987('0x4a')]=function(_0x3da8b8,_0x5a70e4){var _0x213b7d={'raw':![],'where':{'id':_0x3da8b8[_0x7987('0x4b')]['id']}},_0x45fe5c={};_0x45fe5c[_0x7987('0x38')]=_[_0x7987('0x3a')](db[_0x7987('0x33')][_0x7987('0x34')]);_0x45fe5c['query']=_[_0x7987('0x3a')](_0x3da8b8[_0x7987('0x39')]);_0x45fe5c[_0x7987('0x3b')]=_['intersection'](_0x45fe5c[_0x7987('0x38')],_0x45fe5c[_0x7987('0x39')]);_0x213b7d[_0x7987('0x3e')]=_['intersection'](_0x45fe5c[_0x7987('0x38')],qs[_0x7987('0x3d')](_0x3da8b8[_0x7987('0x39')][_0x7987('0x3d')]));_0x213b7d[_0x7987('0x3e')]=_0x213b7d[_0x7987('0x3e')][_0x7987('0x3f')]?_0x213b7d[_0x7987('0x3e')]:_0x45fe5c[_0x7987('0x38')];if(_0x3da8b8['query'][_0x7987('0x47')]){_0x213b7d['include']=[{'all':!![]}];}_0x213b7d=_[_0x7987('0x45')]({},_0x213b7d,_0x3da8b8[_0x7987('0x4c')]);return db['VoiceQueueReport'][_0x7987('0x4d')](_0x213b7d)[_0x7987('0x2d')](handleEntityNotFound(_0x5a70e4,null))[_0x7987('0x2d')](respondWithResult(_0x5a70e4,null))[_0x7987('0x4e')](handleError(_0x5a70e4,null));};exports[_0x7987('0x4f')]=function(_0xc67fab,_0x4c47df){return db[_0x7987('0x33')][_0x7987('0x4f')](_0xc67fab['body'],{})['then'](respondWithResult(_0x4c47df,0xc9))[_0x7987('0x4e')](handleError(_0x4c47df,null));};exports['update']=function(_0x29c4d3,_0x2106f5){if(_0x29c4d3[_0x7987('0x50')]['id']){delete _0x29c4d3['body']['id'];}return db[_0x7987('0x33')]['find']({'where':{'id':_0x29c4d3[_0x7987('0x4b')]['id']}})[_0x7987('0x2d')](handleEntityNotFound(_0x2106f5,null))[_0x7987('0x2d')](saveUpdates(_0x29c4d3[_0x7987('0x50')],null))[_0x7987('0x2d')](respondWithResult(_0x2106f5,null))['catch'](handleError(_0x2106f5,null));};exports[_0x7987('0x51')]=function(_0x56ac8f,_0x50e0b5){return db[_0x7987('0x33')][_0x7987('0x4d')]({'where':{'id':_0x56ac8f[_0x7987('0x4b')]['id']}})[_0x7987('0x2d')](handleEntityNotFound(_0x50e0b5,null))['then'](removeEntity(_0x50e0b5,null))[_0x7987('0x4e')](handleError(_0x50e0b5,null));};exports['describe']=function(_0x5b90ce,_0x436221){return db[_0x7987('0x33')][_0x7987('0x52')]()[_0x7987('0x2d')](respondWithResult(_0x436221,null))[_0x7987('0x4e')](handleError(_0x436221,null));};exports[_0x7987('0x53')]=function(_0x2ba2ef,_0x3f53ae){var _0x10d426={},_0x3faf98={},_0x35681d={'count':0x0,'rows':[]};_0x3faf98[_0x7987('0x38')]=_[_0x7987('0x3a')](db[_0x7987('0x33')]['rawAttributes']);_0x3faf98[_0x7987('0x39')]=_['keys'](_0x2ba2ef[_0x7987('0x39')]);_0x3faf98[_0x7987('0x3b')]=_[_0x7987('0x3c')](_0x3faf98[_0x7987('0x38')],_0x3faf98[_0x7987('0x39')]);_0x10d426['attributes']=_['intersection'](_0x3faf98[_0x7987('0x38')],qs[_0x7987('0x3d')](_0x2ba2ef[_0x7987('0x39')][_0x7987('0x3d')]));_0x10d426['attributes']=_0x10d426[_0x7987('0x3e')][_0x7987('0x3f')]?_0x10d426[_0x7987('0x3e')]:_0x3faf98['model'];if(!_0x2ba2ef['query'][_0x7987('0x40')](_0x7987('0x41'))){_0x10d426[_0x7987('0x26')]=qs[_0x7987('0x26')](_0x2ba2ef[_0x7987('0x39')][_0x7987('0x26')]);_0x10d426[_0x7987('0x23')]=qs[_0x7987('0x23')](_0x2ba2ef[_0x7987('0x39')][_0x7987('0x23')]);}_0x10d426[_0x7987('0x42')]=qs[_0x7987('0x54')](_0x2ba2ef[_0x7987('0x39')][_0x7987('0x54')]);_0x10d426[_0x7987('0x43')]=qs[_0x7987('0x3b')](_['pick'](_0x2ba2ef['query'],_0x3faf98[_0x7987('0x3b')]));if(_0x2ba2ef[_0x7987('0x39')][_0x7987('0x44')]){_0x10d426[_0x7987('0x43')]=_['merge'](_0x10d426['where'],{'$or':_[_0x7987('0x32')](_0x10d426[_0x7987('0x3e')],function(_0x4b305d){var _0x5aae2c={};_0x5aae2c[_0x4b305d]={'$like':'%'+_0x2ba2ef[_0x7987('0x39')][_0x7987('0x44')]+'%'};return _0x5aae2c;})});}_0x10d426=_['merge']({},_0x10d426,_0x2ba2ef[_0x7987('0x4c')]);var _0x4a37f4={'where':_0x10d426[_0x7987('0x43')]};return db['VoiceQueueReport'][_0x7987('0x25')](_0x4a37f4)[_0x7987('0x2d')](function(_0x573f66){_0x35681d[_0x7987('0x25')]=_0x573f66;if(_0x2ba2ef[_0x7987('0x39')]['includeAll']){_0x10d426[_0x7987('0x48')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x10d426);})[_0x7987('0x2d')](function(_0x50663b){_0x35681d[_0x7987('0x49')]=_0x50663b;return _0x35681d;})[_0x7987('0x2d')](respondWithFilteredResult(_0x3f53ae,_0x10d426,_0x7987('0x53')))[_0x7987('0x4e')](handleError(_0x3f53ae,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 28449d5..83f3a13 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 _0x4eb1=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update'];(function(_0x4efbfd,_0x105f75){var _0x4264b8=function(_0x4f232f){while(--_0x4f232f){_0x4efbfd['push'](_0x4efbfd['shift']());}};_0x4264b8(++_0x105f75);}(_0x4eb1,0x14e));var _0x14eb=function(_0x5ce5f5,_0x568672){_0x5ce5f5=_0x5ce5f5-0x0;var _0x11f46f=_0x4eb1[_0x5ce5f5];return _0x11f46f;};'use strict';var EventEmitter=require(_0x14eb('0x0'));var VoiceQueueReport=require(_0x14eb('0x1'))['db'][_0x14eb('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x14eb('0x3')](0x0);var events={'afterCreate':_0x14eb('0x4'),'afterUpdate':_0x14eb('0x5'),'afterDestroy':_0x14eb('0x6')};function emitEvent(_0x18a1bb){return function(_0x3a76e7,_0x45375d,_0x4af1a6){VoiceQueueReportEvents[_0x14eb('0x7')](_0x18a1bb+':'+_0x3a76e7['id'],_0x3a76e7);VoiceQueueReportEvents[_0x14eb('0x7')](_0x18a1bb,_0x3a76e7);_0x4af1a6(null);};}for(var e in events){if(events[_0x14eb('0x8')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x14eb('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x4720=['remove','emit','hook','../../mysqldb','VoiceQueueReport','save','update'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0x4720,0x11b));var _0x0472=function(_0xff5df6,_0x514e73){_0xff5df6=_0xff5df6-0x0;var _0x2634bb=_0x4720[_0xff5df6];return _0x2634bb;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x0472('0x0'))['db'][_0x0472('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0472('0x2'),'afterUpdate':_0x0472('0x3'),'afterDestroy':_0x0472('0x4')};function emitEvent(_0x54846c){return function(_0x2b6015,_0x25ace6,_0x1c25db){VoiceQueueReportEvents[_0x0472('0x5')](_0x54846c+':'+_0x2b6015['id'],_0x2b6015);VoiceQueueReportEvents[_0x0472('0x5')](_0x54846c,_0x2b6015);_0x1c25db(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x0472('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 65369be..d9b8d9d 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 _0xb261=['exports','define','VoiceQueueReport','report_queue','uniqueid','lodash','util','api','path','rimraf','./voiceQueueReport.attributes'];(function(_0x26f7c9,_0x1db9c0){var _0xc0786=function(_0x16948e){while(--_0x16948e){_0x26f7c9['push'](_0x26f7c9['shift']());}};_0xc0786(++_0x1db9c0);}(_0xb261,0x12e));var _0x1b26=function(_0x2c85c0,_0x1dac4f){_0x2c85c0=_0x2c85c0-0x0;var _0xf4d4c9=_0xb261[_0x2c85c0];return _0xf4d4c9;};'use strict';var _=require(_0x1b26('0x0'));var util=require(_0x1b26('0x1'));var logger=require('../../config/logger')(_0x1b26('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b26('0x3'));var rimraf=require(_0x1b26('0x4'));var config=require('../../config/environment');var attributes=require(_0x1b26('0x5'));module[_0x1b26('0x6')]=function(_0x51dad9,_0x3473ad){return _0x51dad9[_0x1b26('0x7')](_0x1b26('0x8'),attributes,{'tableName':_0x1b26('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1b26('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb066=['rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','report_queue','util','../../config/logger','bluebird','request-promise','path'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xb066,0x1c9));var _0x6b06=function(_0xe9bc1c,_0x3934c3){_0xe9bc1c=_0xe9bc1c-0x0;var _0x377d54=_0xb066[_0xe9bc1c];return _0x377d54;};'use strict';var _=require('lodash');var util=require(_0x6b06('0x0'));var logger=require(_0x6b06('0x1'))('api');var moment=require('moment');var BPromise=require(_0x6b06('0x2'));var rp=require(_0x6b06('0x3'));var fs=require('fs');var path=require(_0x6b06('0x4'));var rimraf=require(_0x6b06('0x5'));var config=require(_0x6b06('0x6'));var attributes=require(_0x6b06('0x7'));module[_0x6b06('0x8')]=function(_0xa85096,_0x1e303d){return _0xa85096[_0x6b06('0x9')]('VoiceQueueReport',attributes,{'tableName':_0x6b06('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 6cc70a2..1736e99 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 _0x5542=['stringify','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','limit','include','model','attributes','map','CreateVoiceQueueReport','create','body','then','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','info','request\x20sent','debug'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0x5542,0x17e));var _0x2554=function(_0x5ecaab,_0x2f3053){_0x5ecaab=_0x5ecaab-0x0;var _0x3db1a8=_0x5542[_0x5ecaab];return _0x3db1a8;};'use strict';var _=require(_0x2554('0x0'));var util=require(_0x2554('0x1'));var moment=require(_0x2554('0x2'));var BPromise=require(_0x2554('0x3'));var rs=require(_0x2554('0x4'));var fs=require('fs');var Redis=require(_0x2554('0x5'));var db=require(_0x2554('0x6'))['db'];var utils=require(_0x2554('0x7'));var logger=require(_0x2554('0x8'))(_0x2554('0x9'));var config=require(_0x2554('0xa'));var jayson=require(_0x2554('0xb'));var client=jayson[_0x2554('0xc')][_0x2554('0xd')]({'port':0x232a});config[_0x2554('0xe')]=_[_0x2554('0xf')](config[_0x2554('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x2554('0x10'))(new Redis(config['redis']));require(_0x2554('0x11'))[_0x2554('0x12')](socket);function respondWithRpcPromise(_0x50a607,_0x3fb5e8,_0x5559af){return new BPromise(function(_0x3dc477,_0x52e6ac){return client[_0x2554('0x13')](_0x50a607,_0x5559af)['then'](function(_0x753d8d){logger[_0x2554('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x3fb5e8,_0x2554('0x15'));logger[_0x2554('0x16')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x3fb5e8,_0x2554('0x15'),JSON[_0x2554('0x17')](_0x753d8d));if(_0x753d8d[_0x2554('0x18')]){if(_0x753d8d['error'][_0x2554('0x19')]===0x1f4){logger[_0x2554('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x3fb5e8,_0x753d8d[_0x2554('0x18')]['message']);return _0x52e6ac(_0x753d8d[_0x2554('0x18')][_0x2554('0x1a')]);}logger['error'](_0x2554('0x1b'),_0x3fb5e8,_0x753d8d[_0x2554('0x18')][_0x2554('0x1a')]);return _0x3dc477(_0x753d8d[_0x2554('0x18')][_0x2554('0x1a')]);}else{logger[_0x2554('0x14')](_0x2554('0x1b'),_0x3fb5e8,'request\x20sent');_0x3dc477(_0x753d8d[_0x2554('0x1c')]['message']);}})[_0x2554('0x1d')](function(_0x6ba188){logger[_0x2554('0x18')](_0x2554('0x1b'),_0x3fb5e8,_0x6ba188);_0x52e6ac(_0x6ba188);});});}exports[_0x2554('0x1e')]=function(_0x488f57){var _0x1f8c9a=this;return new Promise(function(_0x4ead39,_0x321d7d){return db[_0x2554('0x1f')][_0x2554('0x20')]({'raw':_0x488f57['options']?_0x488f57[_0x2554('0x21')][_0x2554('0x22')]===undefined?!![]:![]:!![],'where':_0x488f57[_0x2554('0x21')]?_0x488f57[_0x2554('0x21')]['where']||null:null,'attributes':_0x488f57['options']?_0x488f57[_0x2554('0x21')]['attributes']||null:null,'limit':_0x488f57[_0x2554('0x21')]?_0x488f57[_0x2554('0x21')][_0x2554('0x23')]||null:null,'include':_0x488f57['options']?_0x488f57[_0x2554('0x21')][_0x2554('0x24')]?_['map'](_0x488f57[_0x2554('0x21')][_0x2554('0x24')],function(_0x4792b1){return{'model':db[_0x4792b1[_0x2554('0x25')]],'as':_0x4792b1['as'],'attributes':_0x4792b1[_0x2554('0x26')],'include':_0x4792b1[_0x2554('0x24')]?_[_0x2554('0x27')](_0x4792b1[_0x2554('0x24')],function(_0x2ff318){return{'model':db[_0x2ff318[_0x2554('0x25')]],'as':_0x2ff318['as'],'attributes':_0x2ff318[_0x2554('0x26')],'include':_0x2ff318[_0x2554('0x24')]?_[_0x2554('0x27')](_0x2ff318[_0x2554('0x24')],function(_0x4639ac){return{'model':db[_0x4639ac[_0x2554('0x25')]],'as':_0x4639ac['as'],'attributes':_0x4639ac['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52082d){logger[_0x2554('0x14')](_0x2554('0x1e'),_0x488f57);logger[_0x2554('0x16')](_0x2554('0x1e'),_0x488f57,JSON[_0x2554('0x17')](_0x52082d));_0x4ead39(_0x52082d);})['catch'](function(_0x42d3bb){logger[_0x2554('0x18')](_0x2554('0x1e'),_0x42d3bb[_0x2554('0x1a')],_0x488f57);_0x321d7d(_0x1f8c9a[_0x2554('0x18')](0x1f4,_0x42d3bb[_0x2554('0x1a')]));});});};exports[_0x2554('0x28')]=function(_0x3482c0){var _0x1e61bf=this;return new Promise(function(_0x1fe54c,_0x217248){return db['VoiceQueueReport'][_0x2554('0x29')](_0x3482c0[_0x2554('0x2a')],{'raw':_0x3482c0[_0x2554('0x21')]?_0x3482c0[_0x2554('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x2554('0x2b')](function(_0x66fb42){logger[_0x2554('0x14')](_0x2554('0x28'),_0x3482c0);logger[_0x2554('0x16')](_0x2554('0x28'),_0x3482c0,JSON[_0x2554('0x17')](_0x66fb42));_0x1fe54c(_0x66fb42);})[_0x2554('0x1d')](function(_0x435f10){logger['error'](_0x2554('0x28'),_0x435f10['message'],_0x3482c0);_0x217248(_0x1e61bf[_0x2554('0x18')](0x1f4,_0x435f10['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x2a75be){var _0x25f57f=this;return new Promise(function(_0xecc5a5,_0x4c4a6f){return db[_0x2554('0x1f')]['update'](_0x2a75be[_0x2554('0x2a')],{'raw':_0x2a75be[_0x2554('0x21')]?_0x2a75be[_0x2554('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a75be[_0x2554('0x21')]?_0x2a75be[_0x2554('0x21')]['where']||null:null,'attributes':_0x2a75be['options']?_0x2a75be['options']['attributes']||null:null,'limit':_0x2a75be[_0x2554('0x21')]?_0x2a75be['options'][_0x2554('0x23')]||null:null})[_0x2554('0x2b')](function(_0x3ffaaa){logger[_0x2554('0x14')]('UpdateVoiceQueueReport',_0x2a75be);logger['debug'](_0x2554('0x2c'),_0x2a75be,JSON[_0x2554('0x17')](_0x3ffaaa));_0xecc5a5(_0x3ffaaa);})[_0x2554('0x1d')](function(_0x3c81aa){logger[_0x2554('0x18')](_0x2554('0x2c'),_0x3c81aa[_0x2554('0x1a')],_0x2a75be);_0x4c4a6f(_0x25f57f[_0x2554('0x18')](0x1f4,_0x3c81aa[_0x2554('0x1a')]));});});}; \ No newline at end of file +var _0x3e96=['stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x4b6a9c,_0x2a5b60){var _0x1b8586=function(_0x47a6b0){while(--_0x47a6b0){_0x4b6a9c['push'](_0x4b6a9c['shift']());}};_0x1b8586(++_0x2a5b60);}(_0x3e96,0x1ee));var _0x63e9=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0x3e96[_0x585ee5];return _0x470808;};'use strict';var _=require(_0x63e9('0x0'));var util=require(_0x63e9('0x1'));var moment=require(_0x63e9('0x2'));var BPromise=require(_0x63e9('0x3'));var rs=require(_0x63e9('0x4'));var fs=require('fs');var Redis=require(_0x63e9('0x5'));var db=require(_0x63e9('0x6'))['db'];var utils=require(_0x63e9('0x7'));var logger=require(_0x63e9('0x8'))(_0x63e9('0x9'));var config=require(_0x63e9('0xa'));var jayson=require(_0x63e9('0xb'));var client=jayson[_0x63e9('0xc')][_0x63e9('0xd')]({'port':0x232a});config[_0x63e9('0xe')]=_['defaults'](config['redis'],{'host':_0x63e9('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x63e9('0xe')]));require('./voiceQueueReport.socket')[_0x63e9('0x10')](socket);function respondWithRpcPromise(_0x42a71d,_0x2182f1,_0xf31053){return new BPromise(function(_0x2a1615,_0x1ca4cc){return client['request'](_0x42a71d,_0xf31053)['then'](function(_0x5100e8){logger[_0x63e9('0x11')](_0x63e9('0x12'),_0x2182f1,_0x63e9('0x13'));logger[_0x63e9('0x14')](_0x63e9('0x15'),_0x2182f1,_0x63e9('0x13'),JSON[_0x63e9('0x16')](_0x5100e8));if(_0x5100e8[_0x63e9('0x17')]){if(_0x5100e8['error'][_0x63e9('0x18')]===0x1f4){logger[_0x63e9('0x17')](_0x63e9('0x12'),_0x2182f1,_0x5100e8[_0x63e9('0x17')][_0x63e9('0x19')]);return _0x1ca4cc(_0x5100e8[_0x63e9('0x17')]['message']);}logger[_0x63e9('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x2182f1,_0x5100e8[_0x63e9('0x17')]['message']);return _0x2a1615(_0x5100e8[_0x63e9('0x17')][_0x63e9('0x19')]);}else{logger[_0x63e9('0x11')](_0x63e9('0x12'),_0x2182f1,_0x63e9('0x13'));_0x2a1615(_0x5100e8[_0x63e9('0x1a')][_0x63e9('0x19')]);}})[_0x63e9('0x1b')](function(_0x3ec5b6){logger[_0x63e9('0x17')](_0x63e9('0x12'),_0x2182f1,_0x3ec5b6);_0x1ca4cc(_0x3ec5b6);});});}exports[_0x63e9('0x1c')]=function(_0xc0e269){var _0x55f80f=this;return new Promise(function(_0x2a49f0,_0x925bf){return db[_0x63e9('0x1d')][_0x63e9('0x1e')]({'raw':_0xc0e269[_0x63e9('0x1f')]?_0xc0e269[_0x63e9('0x1f')][_0x63e9('0x20')]===undefined?!![]:![]:!![],'where':_0xc0e269[_0x63e9('0x1f')]?_0xc0e269[_0x63e9('0x1f')][_0x63e9('0x21')]||null:null,'attributes':_0xc0e269[_0x63e9('0x1f')]?_0xc0e269['options'][_0x63e9('0x22')]||null:null,'limit':_0xc0e269[_0x63e9('0x1f')]?_0xc0e269[_0x63e9('0x1f')][_0x63e9('0x23')]||null:null,'include':_0xc0e269[_0x63e9('0x1f')]?_0xc0e269[_0x63e9('0x1f')][_0x63e9('0x24')]?_[_0x63e9('0x25')](_0xc0e269['options'][_0x63e9('0x24')],function(_0x5bf85b){return{'model':db[_0x5bf85b[_0x63e9('0x26')]],'as':_0x5bf85b['as'],'attributes':_0x5bf85b['attributes'],'include':_0x5bf85b[_0x63e9('0x24')]?_['map'](_0x5bf85b['include'],function(_0x81e0ce){return{'model':db[_0x81e0ce['model']],'as':_0x81e0ce['as'],'attributes':_0x81e0ce[_0x63e9('0x22')],'include':_0x81e0ce[_0x63e9('0x24')]?_[_0x63e9('0x25')](_0x81e0ce[_0x63e9('0x24')],function(_0x3575d7){return{'model':db[_0x3575d7[_0x63e9('0x26')]],'as':_0x3575d7['as'],'attributes':_0x3575d7[_0x63e9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x63e9('0x27')](function(_0x37a4b9){logger[_0x63e9('0x11')](_0x63e9('0x1c'),_0xc0e269);logger[_0x63e9('0x14')](_0x63e9('0x1c'),_0xc0e269,JSON[_0x63e9('0x16')](_0x37a4b9));_0x2a49f0(_0x37a4b9);})[_0x63e9('0x1b')](function(_0x17c94f){logger[_0x63e9('0x17')](_0x63e9('0x1c'),_0x17c94f[_0x63e9('0x19')],_0xc0e269);_0x925bf(_0x55f80f[_0x63e9('0x17')](0x1f4,_0x17c94f[_0x63e9('0x19')]));});});};exports[_0x63e9('0x28')]=function(_0x203639){var _0x2f99da=this;return new Promise(function(_0x2b45f9,_0x572b82){return db['VoiceQueueReport']['create'](_0x203639[_0x63e9('0x29')],{'raw':_0x203639[_0x63e9('0x1f')]?_0x203639[_0x63e9('0x1f')][_0x63e9('0x20')]===undefined?!![]:![]:!![]})[_0x63e9('0x27')](function(_0x470a37){logger[_0x63e9('0x11')](_0x63e9('0x28'),_0x203639);logger['debug'](_0x63e9('0x28'),_0x203639,JSON['stringify'](_0x470a37));_0x2b45f9(_0x470a37);})['catch'](function(_0x96c9de){logger[_0x63e9('0x17')](_0x63e9('0x28'),_0x96c9de[_0x63e9('0x19')],_0x203639);_0x572b82(_0x2f99da[_0x63e9('0x17')](0x1f4,_0x96c9de['message']));});});};exports[_0x63e9('0x2a')]=function(_0x5540f0){var _0x3e210e=this;return new Promise(function(_0xbddacc,_0xd10c08){return db[_0x63e9('0x1d')]['update'](_0x5540f0[_0x63e9('0x29')],{'raw':_0x5540f0['options']?_0x5540f0['options'][_0x63e9('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5540f0[_0x63e9('0x1f')]?_0x5540f0[_0x63e9('0x1f')][_0x63e9('0x21')]||null:null,'attributes':_0x5540f0['options']?_0x5540f0[_0x63e9('0x1f')][_0x63e9('0x22')]||null:null,'limit':_0x5540f0['options']?_0x5540f0[_0x63e9('0x1f')][_0x63e9('0x23')]||null:null})[_0x63e9('0x27')](function(_0x4000bf){logger[_0x63e9('0x11')](_0x63e9('0x2a'),_0x5540f0);logger['debug']('UpdateVoiceQueueReport',_0x5540f0,JSON[_0x63e9('0x16')](_0x4000bf));_0xbddacc(_0x4000bf);})[_0x63e9('0x1b')](function(_0x430d74){logger[_0x63e9('0x17')]('UpdateVoiceQueueReport',_0x430d74[_0x63e9('0x19')],_0x5540f0);_0xd10c08(_0x3e210e['error'](0x1f4,_0x430d74[_0x63e9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 452472a..444d25c 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 _0x668b=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','register'];(function(_0x4b7788,_0x2033ab){var _0xfa38be=function(_0x41042e){while(--_0x41042e){_0x4b7788['push'](_0x4b7788['shift']());}};_0xfa38be(++_0x2033ab);}(_0x668b,0x8d));var _0xb668=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x668b[_0x16629d];return _0x56ccee;};'use strict';var VoiceQueueReportEvents=require(_0xb668('0x0'));var events=[_0xb668('0x1'),_0xb668('0x2'),_0xb668('0x3')];function createListener(_0x279ff1,_0x34692f){return function(_0x2baf22){_0x34692f[_0xb668('0x4')](_0x279ff1,_0x2baf22);};}function removeListener(_0x26d010,_0x172925){return function(){VoiceQueueReportEvents['removeListener'](_0x26d010,_0x172925);};}exports[_0xb668('0x5')]=function(_0x145564){for(var _0x551fc3=0x0,_0x9482c=events['length'];_0x551fc3<_0x9482c;_0x551fc3++){var _0x22e32c=events[_0x551fc3];var _0x39e907=createListener(_0xb668('0x6')+_0x22e32c,_0x145564);VoiceQueueReportEvents['on'](_0x22e32c,_0x39e907);}}; \ No newline at end of file +var _0x448a=['removeListener','register','length','save','remove','emit'];(function(_0x13b948,_0x2a5a86){var _0x2f0044=function(_0xc63313){while(--_0xc63313){_0x13b948['push'](_0x13b948['shift']());}};_0x2f0044(++_0x2a5a86);}(_0x448a,0x1ef));var _0xa448=function(_0x1528ba,_0x30ea58){_0x1528ba=_0x1528ba-0x0;var _0x596f42=_0x448a[_0x1528ba];return _0x596f42;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xa448('0x0'),_0xa448('0x1'),'update'];function createListener(_0x3f08b0,_0x47909c){return function(_0x5ea7f4){_0x47909c[_0xa448('0x2')](_0x3f08b0,_0x5ea7f4);};}function removeListener(_0x3206fd,_0x57e1ea){return function(){VoiceQueueReportEvents[_0xa448('0x3')](_0x3206fd,_0x57e1ea);};}exports[_0xa448('0x4')]=function(_0x343b79){for(var _0x2c16e3=0x0,_0x12b0e2=events[_0xa448('0x5')];_0x2c16e3<_0x12b0e2;_0x2c16e3++){var _0x1ec2d8=events[_0x2c16e3];var _0x54bdb0=createListener('voiceQueueReport:'+_0x1ec2d8,_0x343b79);VoiceQueueReportEvents['on'](_0x1ec2d8,_0x54bdb0);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d7f4067..6ce9661 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 _0x3738=['create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3738,0x1e5));var _0x8373=function(_0x3c3daa,_0x3ece95){_0x3c3daa=_0x3c3daa-0x0;var _0x273f7e=_0x3738[_0x3c3daa];return _0x273f7e;};'use strict';var multer=require('multer');var util=require(_0x8373('0x0'));var path=require(_0x8373('0x1'));var timeout=require(_0x8373('0x2'));var express=require(_0x8373('0x3'));var router=express[_0x8373('0x4')]();var fs_extra=require(_0x8373('0x5'));var auth=require(_0x8373('0x6'));var interaction=require(_0x8373('0x7'));var config=require(_0x8373('0x8'));var controller=require(_0x8373('0x9'));router[_0x8373('0xa')]('/',auth[_0x8373('0xb')](),controller['index']);router[_0x8373('0xa')](_0x8373('0xc'),auth[_0x8373('0xb')](),controller[_0x8373('0xd')]);router[_0x8373('0xe')]('/',auth['isAuthenticated'](),controller[_0x8373('0xf')]);router[_0x8373('0x10')](_0x8373('0xc'),auth[_0x8373('0xb')](),controller[_0x8373('0x11')]);router[_0x8373('0x12')](_0x8373('0xc'),auth[_0x8373('0xb')](),controller['destroy']);module[_0x8373('0x13')]=router; \ No newline at end of file +var _0xb477=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0x3452a8,_0x4bfaa4){var _0x233814=function(_0x40b537){while(--_0x40b537){_0x3452a8['push'](_0x3452a8['shift']());}};_0x233814(++_0x4bfaa4);}(_0xb477,0xac));var _0x7b47=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xb477[_0x565c49];return _0x20ca34;};'use strict';var multer=require(_0x7b47('0x0'));var util=require(_0x7b47('0x1'));var path=require(_0x7b47('0x2'));var timeout=require(_0x7b47('0x3'));var express=require('express');var router=express[_0x7b47('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7b47('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7b47('0x6'));var controller=require(_0x7b47('0x7'));router['get']('/',auth[_0x7b47('0x8')](),controller['index']);router[_0x7b47('0x9')](_0x7b47('0xa'),auth[_0x7b47('0x8')](),controller[_0x7b47('0xb')]);router[_0x7b47('0xc')]('/',auth[_0x7b47('0x8')](),controller[_0x7b47('0xd')]);router[_0x7b47('0xe')](_0x7b47('0xa'),auth[_0x7b47('0x8')](),controller[_0x7b47('0xf')]);router[_0x7b47('0x10')]('/:id',auth[_0x7b47('0x8')](),controller[_0x7b47('0x11')]);module[_0x7b47('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 28d2bc5..2f87ed0 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 _0x2f74=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','STRING'];(function(_0x48521b,_0x3f6d08){var _0x1fb75c=function(_0x3220ec){while(--_0x3220ec){_0x48521b['push'](_0x48521b['shift']());}};_0x1fb75c(++_0x3f6d08);}(_0x2f74,0x7b));var _0x42f7=function(_0x1b9d97,_0x19159b){_0x1b9d97=_0x1b9d97-0x0;var _0x1d7a29=_0x2f74[_0x1b9d97];return _0x1d7a29;};'use strict';var Sequelize=require(_0x42f7('0x0'));var moment=require('moment');module[_0x42f7('0x1')]={'time':{'type':Sequelize[_0x42f7('0x2')]},'callid':{'type':Sequelize[_0x42f7('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x42f7('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x42f7('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x42f7('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x42f7('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x42f7('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x42f7('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x42f7('0x3')],'allowNull':![],'defaultValue':moment()[_0x42f7('0x4')](_0x42f7('0x5'))}}; \ No newline at end of file +var _0x0e17=['moment','STRING','sequelize'];(function(_0x3e3edc,_0x4743ca){var _0xd6ffd=function(_0x4bb7d7){while(--_0x4bb7d7){_0x3e3edc['push'](_0x3e3edc['shift']());}};_0xd6ffd(++_0x4743ca);}(_0x0e17,0x83));var _0x70e1=function(_0x291474,_0x2702e7){_0x291474=_0x291474-0x0;var _0x265e24=_0x0e17[_0x291474];return _0x265e24;};'use strict';var Sequelize=require(_0x70e1('0x0'));var moment=require(_0x70e1('0x1'));module['exports']={'time':{'type':Sequelize[_0x70e1('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x70e1('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 29577b9..f58432d 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 _0xdacc=['findAll','rows','catch','params','keys','length','options','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdacc,0x1ba));var _0xcdac=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xdacc[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdac('0x0'));var zipdir=require(_0xcdac('0x1'));var jsonpatch=require(_0xcdac('0x2'));var rp=require('request-promise');var moment=require(_0xcdac('0x3'));var BPromise=require(_0xcdac('0x4'));var Mustache=require('mustache');var util=require(_0xcdac('0x5'));var path=require(_0xcdac('0x6'));var sox=require(_0xcdac('0x7'));var csv=require(_0xcdac('0x8'));var ejs=require(_0xcdac('0x9'));var fs=require('fs');var fs_extra=require(_0xcdac('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcdac('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xcdac('0xc'));var toCsv=require(_0xcdac('0x8'));var querystring=require(_0xcdac('0xd'));var Papa=require(_0xcdac('0xe'));var Redis=require(_0xcdac('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcdac('0x10'));var as=require(_0xcdac('0x11'));var hardwareService=require(_0xcdac('0x12'));var logger=require('../../config/logger')(_0xcdac('0x13'));var utils=require(_0xcdac('0x14'));var config=require(_0xcdac('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdac('0x16'))['db'];function respondWithStatusCode(_0x214f95,_0xbe0ec8){_0xbe0ec8=_0xbe0ec8||0xcc;return function(_0x1add92){if(_0x1add92){return _0x214f95['sendStatus'](_0xbe0ec8);}return _0x214f95[_0xcdac('0x17')](_0xbe0ec8)[_0xcdac('0x18')]();};}function respondWithResult(_0x161dcd,_0x5c71f2){_0x5c71f2=_0x5c71f2||0xc8;return function(_0x568501){if(_0x568501){return _0x161dcd[_0xcdac('0x17')](_0x5c71f2)['json'](_0x568501);}};}function respondWithFilteredResult(_0x4ba94c,_0x456559){return function(_0x245f1d){if(_0x245f1d){var _0x1386f4=typeof _0x456559[_0xcdac('0x19')]==='undefined'&&typeof _0x456559['limit']===_0xcdac('0x1a');var _0x57ffd9=_0x245f1d[_0xcdac('0x1b')];var _0x51e583=_0x1386f4?0x0:_0x456559[_0xcdac('0x19')];var _0x14bd57=_0x1386f4?_0x245f1d['count']:_0x456559[_0xcdac('0x19')]+_0x456559[_0xcdac('0x1c')];var _0x39e4e6;if(_0x14bd57>=_0x57ffd9){_0x14bd57=_0x57ffd9;_0x39e4e6=0xc8;}else{_0x39e4e6=0xce;}_0x4ba94c[_0xcdac('0x17')](_0x39e4e6);return _0x4ba94c[_0xcdac('0x1d')]('Content-Range',_0x51e583+'-'+_0x14bd57+'/'+_0x57ffd9)[_0xcdac('0x1e')](_0x245f1d);}return null;};}function patchUpdates(_0x494730){return function(_0x1aaa8c){try{jsonpatch[_0xcdac('0x1f')](_0x1aaa8c,_0x494730,!![]);}catch(_0x7a81c3){return BPromise['reject'](_0x7a81c3);}return _0x1aaa8c[_0xcdac('0x20')]();};}function saveUpdates(_0x4c8b95,_0x3ba78b){return function(_0x2971f1){if(_0x2971f1){return _0x2971f1[_0xcdac('0x21')](_0x4c8b95)[_0xcdac('0x22')](function(_0x18fcc0){return _0x18fcc0;});}return null;};}function removeEntity(_0x1fdcb0,_0x30a0a5){return function(_0x5ece80){if(_0x5ece80){return _0x5ece80[_0xcdac('0x23')]()[_0xcdac('0x22')](function(){_0x1fdcb0['status'](0xcc)[_0xcdac('0x18')]();});}};}function handleEntityNotFound(_0xe2f55a,_0x1e701a){return function(_0x213157){if(!_0x213157){_0xe2f55a[_0xcdac('0x24')](0x194);}return _0x213157;};}function handleError(_0x4ea5e2,_0x214717){_0x214717=_0x214717||0x1f4;return function(_0x429976){logger[_0xcdac('0x25')](_0x429976[_0xcdac('0x26')]);if(_0x429976[_0xcdac('0x27')]){delete _0x429976[_0xcdac('0x27')];}_0x4ea5e2[_0xcdac('0x17')](_0x214717)[_0xcdac('0x28')](_0x429976);};}exports[_0xcdac('0x29')]=function(_0x49706a,_0x21bcae){var _0x4bc289={},_0x40f5b5={},_0x4b4015={'count':0x0,'rows':[]};var _0x5bd6e9=_[_0xcdac('0x2a')](db[_0xcdac('0x2b')][_0xcdac('0x2c')],function(_0x3c850a){return{'name':_0x3c850a['fieldName'],'type':_0x3c850a[_0xcdac('0x2d')][_0xcdac('0x2e')]};});_0x40f5b5['model']=_[_0xcdac('0x2a')](_0x5bd6e9,_0xcdac('0x27'));_0x40f5b5['query']=_['keys'](_0x49706a[_0xcdac('0x2f')]);_0x40f5b5[_0xcdac('0x30')]=_[_0xcdac('0x31')](_0x40f5b5[_0xcdac('0x32')],_0x40f5b5[_0xcdac('0x2f')]);_0x4bc289[_0xcdac('0x33')]=_['intersection'](_0x40f5b5[_0xcdac('0x32')],qs[_0xcdac('0x34')](_0x49706a['query']['fields']));_0x4bc289[_0xcdac('0x33')]=_0x4bc289['attributes']['length']?_0x4bc289['attributes']:_0x40f5b5[_0xcdac('0x32')];if(!_0x49706a[_0xcdac('0x2f')]['hasOwnProperty'](_0xcdac('0x35'))){_0x4bc289[_0xcdac('0x1c')]=qs[_0xcdac('0x1c')](_0x49706a[_0xcdac('0x2f')][_0xcdac('0x1c')]);_0x4bc289[_0xcdac('0x19')]=qs[_0xcdac('0x19')](_0x49706a[_0xcdac('0x2f')][_0xcdac('0x19')]);}_0x4bc289[_0xcdac('0x36')]=qs[_0xcdac('0x37')](_0x49706a['query'][_0xcdac('0x37')]);_0x4bc289[_0xcdac('0x38')]=qs[_0xcdac('0x30')](_['pick'](_0x49706a[_0xcdac('0x2f')],_0x40f5b5[_0xcdac('0x30')]),_0x5bd6e9);if(_0x49706a[_0xcdac('0x2f')][_0xcdac('0x39')]){_0x4bc289[_0xcdac('0x38')]=_[_0xcdac('0x3a')](_0x4bc289['where'],{'$or':_[_0xcdac('0x2a')](_0x5bd6e9,function(_0x5c5ccc){if(_0x5c5ccc['type']!==_0xcdac('0x3b')){var _0xa2b34e={};_0xa2b34e[_0x5c5ccc['name']]={'$like':'%'+_0x49706a[_0xcdac('0x2f')]['filter']+'%'};return _0xa2b34e;}})});}_0x4bc289=_[_0xcdac('0x3a')]({},_0x4bc289,_0x49706a['options']);var _0x56b2d7={'where':_0x4bc289[_0xcdac('0x38')]};return db['VoiceQueuesLog'][_0xcdac('0x1b')](_0x56b2d7)[_0xcdac('0x22')](function(_0x34178b){_0x4b4015[_0xcdac('0x1b')]=_0x34178b;if(_0x49706a[_0xcdac('0x2f')][_0xcdac('0x3c')]){_0x4bc289[_0xcdac('0x3d')]=[{'all':!![]}];}return db[_0xcdac('0x2b')][_0xcdac('0x3e')](_0x4bc289);})[_0xcdac('0x22')](function(_0x24a9e8){_0x4b4015[_0xcdac('0x3f')]=_0x24a9e8;return _0x4b4015;})[_0xcdac('0x22')](respondWithFilteredResult(_0x21bcae,_0x4bc289))[_0xcdac('0x40')](handleError(_0x21bcae,null));};exports['show']=function(_0x33954d,_0x11dfc5){var _0x22b14d={'raw':!![],'where':{'id':_0x33954d[_0xcdac('0x41')]['id']}},_0x5615de={};_0x5615de['model']=_['keys'](db[_0xcdac('0x2b')][_0xcdac('0x2c')]);_0x5615de['query']=_[_0xcdac('0x42')](_0x33954d[_0xcdac('0x2f')]);_0x5615de[_0xcdac('0x30')]=_[_0xcdac('0x31')](_0x5615de['model'],_0x5615de[_0xcdac('0x2f')]);_0x22b14d['attributes']=_[_0xcdac('0x31')](_0x5615de[_0xcdac('0x32')],qs[_0xcdac('0x34')](_0x33954d[_0xcdac('0x2f')]['fields']));_0x22b14d[_0xcdac('0x33')]=_0x22b14d['attributes'][_0xcdac('0x43')]?_0x22b14d[_0xcdac('0x33')]:_0x5615de[_0xcdac('0x32')];if(_0x33954d[_0xcdac('0x2f')][_0xcdac('0x3c')]){_0x22b14d[_0xcdac('0x3d')]=[{'all':!![]}];}_0x22b14d=_['merge']({},_0x22b14d,_0x33954d[_0xcdac('0x44')]);return db[_0xcdac('0x2b')][_0xcdac('0x45')](_0x22b14d)[_0xcdac('0x22')](handleEntityNotFound(_0x11dfc5,null))[_0xcdac('0x22')](respondWithResult(_0x11dfc5,null))[_0xcdac('0x40')](handleError(_0x11dfc5,null));};exports['create']=function(_0x32ca0b,_0x1cd03b){return db[_0xcdac('0x2b')][_0xcdac('0x46')](_0x32ca0b[_0xcdac('0x47')],{})['then'](respondWithResult(_0x1cd03b,0xc9))[_0xcdac('0x40')](handleError(_0x1cd03b,null));};exports['update']=function(_0x3ffe03,_0x13d8fa){if(_0x3ffe03['body']['id']){delete _0x3ffe03[_0xcdac('0x47')]['id'];}return db['VoiceQueuesLog'][_0xcdac('0x45')]({'where':{'id':_0x3ffe03[_0xcdac('0x41')]['id']}})['then'](handleEntityNotFound(_0x13d8fa,null))[_0xcdac('0x22')](saveUpdates(_0x3ffe03[_0xcdac('0x47')],null))[_0xcdac('0x22')](respondWithResult(_0x13d8fa,null))['catch'](handleError(_0x13d8fa,null));};exports[_0xcdac('0x23')]=function(_0x28f6fe,_0x3aa6e9){return db['VoiceQueuesLog'][_0xcdac('0x45')]({'where':{'id':_0x28f6fe[_0xcdac('0x41')]['id']}})[_0xcdac('0x22')](handleEntityNotFound(_0x3aa6e9,null))[_0xcdac('0x22')](removeEntity(_0x3aa6e9,null))[_0xcdac('0x40')](handleError(_0x3aa6e9,null));}; \ No newline at end of file +var _0xc9b3=['key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','catch','show','params','keys','rawAttributes','intersection','length','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','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','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','name','send','index','map','VoiceQueuesLog','fieldName','type'];(function(_0x2da8a0,_0x4e5f10){var _0x3be812=function(_0x4984cd){while(--_0x4984cd){_0x2da8a0['push'](_0x2da8a0['shift']());}};_0x3be812(++_0x4e5f10);}(_0xc9b3,0xb0));var _0x3c9b=function(_0x197ca0,_0x4bf088){_0x197ca0=_0x197ca0-0x0;var _0x55858d=_0xc9b3[_0x197ca0];return _0x55858d;};'use strict';var emlformat=require(_0x3c9b('0x0'));var rimraf=require(_0x3c9b('0x1'));var zipdir=require(_0x3c9b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3c9b('0x3'));var moment=require(_0x3c9b('0x4'));var BPromise=require(_0x3c9b('0x5'));var Mustache=require('mustache');var util=require(_0x3c9b('0x6'));var path=require('path');var sox=require(_0x3c9b('0x7'));var csv=require('to-csv');var ejs=require(_0x3c9b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3c9b('0x9'));var squel=require(_0x3c9b('0xa'));var crypto=require(_0x3c9b('0xb'));var jsforce=require(_0x3c9b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3c9b('0xd'));var querystring=require(_0x3c9b('0xe'));var Papa=require('papaparse');var Redis=require(_0x3c9b('0xf'));var authService=require(_0x3c9b('0x10'));var qs=require(_0x3c9b('0x11'));var as=require(_0x3c9b('0x12'));var hardwareService=require(_0x3c9b('0x13'));var logger=require(_0x3c9b('0x14'))(_0x3c9b('0x15'));var utils=require('../../config/utils');var config=require(_0x3c9b('0x16'));var licenseUtil=require(_0x3c9b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x8d1ce9,_0x4f88a5){_0x4f88a5=_0x4f88a5||0xcc;return function(_0x5c27b4){if(_0x5c27b4){return _0x8d1ce9[_0x3c9b('0x18')](_0x4f88a5);}return _0x8d1ce9[_0x3c9b('0x19')](_0x4f88a5)[_0x3c9b('0x1a')]();};}function respondWithResult(_0x5e9851,_0x313b5c){_0x313b5c=_0x313b5c||0xc8;return function(_0x6d02bc){if(_0x6d02bc){return _0x5e9851[_0x3c9b('0x19')](_0x313b5c)['json'](_0x6d02bc);}};}function respondWithFilteredResult(_0x5d652b,_0x2eab58){return function(_0x25b6eb){if(_0x25b6eb){var _0x30f568=typeof _0x2eab58[_0x3c9b('0x1b')]===_0x3c9b('0x1c')&&typeof _0x2eab58[_0x3c9b('0x1d')]==='undefined';var _0x536d15=_0x25b6eb['count'];var _0x3347ee=_0x30f568?0x0:_0x2eab58['offset'];var _0x493702=_0x30f568?_0x25b6eb[_0x3c9b('0x1e')]:_0x2eab58[_0x3c9b('0x1b')]+_0x2eab58[_0x3c9b('0x1d')];var _0x34ef22;if(_0x493702>=_0x536d15){_0x493702=_0x536d15;_0x34ef22=0xc8;}else{_0x34ef22=0xce;}_0x5d652b[_0x3c9b('0x19')](_0x34ef22);return _0x5d652b[_0x3c9b('0x1f')](_0x3c9b('0x20'),_0x3347ee+'-'+_0x493702+'/'+_0x536d15)['json'](_0x25b6eb);}return null;};}function patchUpdates(_0x4cae52){return function(_0x32ff22){try{jsonpatch[_0x3c9b('0x21')](_0x32ff22,_0x4cae52,!![]);}catch(_0x55b487){return BPromise[_0x3c9b('0x22')](_0x55b487);}return _0x32ff22[_0x3c9b('0x23')]();};}function saveUpdates(_0x4438d7,_0x44f8b1){return function(_0x29e3df){if(_0x29e3df){return _0x29e3df[_0x3c9b('0x24')](_0x4438d7)['then'](function(_0x1b51b6){return _0x1b51b6;});}return null;};}function removeEntity(_0x289520,_0x57b6cd){return function(_0x7ec580){if(_0x7ec580){return _0x7ec580[_0x3c9b('0x25')]()['then'](function(){_0x289520['status'](0xcc)[_0x3c9b('0x1a')]();});}};}function handleEntityNotFound(_0x55c4bf,_0x5a950f){return function(_0x11b8be){if(!_0x11b8be){_0x55c4bf[_0x3c9b('0x18')](0x194);}return _0x11b8be;};}function handleError(_0x4387e9,_0x4950f0){_0x4950f0=_0x4950f0||0x1f4;return function(_0x308f94){logger[_0x3c9b('0x26')](_0x308f94['stack']);if(_0x308f94[_0x3c9b('0x27')]){delete _0x308f94[_0x3c9b('0x27')];}_0x4387e9[_0x3c9b('0x19')](_0x4950f0)[_0x3c9b('0x28')](_0x308f94);};}exports[_0x3c9b('0x29')]=function(_0x4f0a1b,_0x1a5541){var _0x4a4bf0={},_0x3ccd02={},_0x563eff={'count':0x0,'rows':[]};var _0x59c135=_[_0x3c9b('0x2a')](db[_0x3c9b('0x2b')]['rawAttributes'],function(_0x1d51a8){return{'name':_0x1d51a8[_0x3c9b('0x2c')],'type':_0x1d51a8[_0x3c9b('0x2d')][_0x3c9b('0x2e')]};});_0x3ccd02[_0x3c9b('0x2f')]=_[_0x3c9b('0x2a')](_0x59c135,_0x3c9b('0x27'));_0x3ccd02['query']=_['keys'](_0x4f0a1b[_0x3c9b('0x30')]);_0x3ccd02[_0x3c9b('0x31')]=_['intersection'](_0x3ccd02[_0x3c9b('0x2f')],_0x3ccd02['query']);_0x4a4bf0[_0x3c9b('0x32')]=_['intersection'](_0x3ccd02['model'],qs[_0x3c9b('0x33')](_0x4f0a1b[_0x3c9b('0x30')][_0x3c9b('0x33')]));_0x4a4bf0[_0x3c9b('0x32')]=_0x4a4bf0['attributes']['length']?_0x4a4bf0['attributes']:_0x3ccd02[_0x3c9b('0x2f')];if(!_0x4f0a1b[_0x3c9b('0x30')][_0x3c9b('0x34')](_0x3c9b('0x35'))){_0x4a4bf0[_0x3c9b('0x1d')]=qs[_0x3c9b('0x1d')](_0x4f0a1b[_0x3c9b('0x30')]['limit']);_0x4a4bf0[_0x3c9b('0x1b')]=qs['offset'](_0x4f0a1b[_0x3c9b('0x30')]['offset']);}_0x4a4bf0['order']=qs[_0x3c9b('0x36')](_0x4f0a1b[_0x3c9b('0x30')][_0x3c9b('0x36')]);_0x4a4bf0[_0x3c9b('0x37')]=qs[_0x3c9b('0x31')](_['pick'](_0x4f0a1b['query'],_0x3ccd02[_0x3c9b('0x31')]),_0x59c135);if(_0x4f0a1b['query']['filter']){_0x4a4bf0[_0x3c9b('0x37')]=_[_0x3c9b('0x38')](_0x4a4bf0[_0x3c9b('0x37')],{'$or':_[_0x3c9b('0x2a')](_0x59c135,function(_0x4ede19){if(_0x4ede19[_0x3c9b('0x2d')]!==_0x3c9b('0x39')){var _0x3675a5={};_0x3675a5[_0x4ede19[_0x3c9b('0x27')]]={'$like':'%'+_0x4f0a1b[_0x3c9b('0x30')][_0x3c9b('0x3a')]+'%'};return _0x3675a5;}})});}_0x4a4bf0=_[_0x3c9b('0x38')]({},_0x4a4bf0,_0x4f0a1b[_0x3c9b('0x3b')]);var _0x250f43={'where':_0x4a4bf0['where']};return db['VoiceQueuesLog']['count'](_0x250f43)[_0x3c9b('0x3c')](function(_0x4c0fb1){_0x563eff[_0x3c9b('0x1e')]=_0x4c0fb1;if(_0x4f0a1b['query'][_0x3c9b('0x3d')]){_0x4a4bf0[_0x3c9b('0x3e')]=[{'all':!![]}];}return db[_0x3c9b('0x2b')][_0x3c9b('0x3f')](_0x4a4bf0);})[_0x3c9b('0x3c')](function(_0x44e383){_0x563eff['rows']=_0x44e383;return _0x563eff;})[_0x3c9b('0x3c')](respondWithFilteredResult(_0x1a5541,_0x4a4bf0))[_0x3c9b('0x40')](handleError(_0x1a5541,null));};exports[_0x3c9b('0x41')]=function(_0x35a3a3,_0x15a771){var _0xa27e82={'raw':!![],'where':{'id':_0x35a3a3[_0x3c9b('0x42')]['id']}},_0xd70f17={};_0xd70f17['model']=_[_0x3c9b('0x43')](db[_0x3c9b('0x2b')][_0x3c9b('0x44')]);_0xd70f17[_0x3c9b('0x30')]=_['keys'](_0x35a3a3['query']);_0xd70f17[_0x3c9b('0x31')]=_[_0x3c9b('0x45')](_0xd70f17[_0x3c9b('0x2f')],_0xd70f17['query']);_0xa27e82[_0x3c9b('0x32')]=_['intersection'](_0xd70f17[_0x3c9b('0x2f')],qs[_0x3c9b('0x33')](_0x35a3a3['query'][_0x3c9b('0x33')]));_0xa27e82['attributes']=_0xa27e82[_0x3c9b('0x32')][_0x3c9b('0x46')]?_0xa27e82[_0x3c9b('0x32')]:_0xd70f17['model'];if(_0x35a3a3[_0x3c9b('0x30')]['includeAll']){_0xa27e82[_0x3c9b('0x3e')]=[{'all':!![]}];}_0xa27e82=_[_0x3c9b('0x38')]({},_0xa27e82,_0x35a3a3['options']);return db[_0x3c9b('0x2b')]['find'](_0xa27e82)['then'](handleEntityNotFound(_0x15a771,null))[_0x3c9b('0x3c')](respondWithResult(_0x15a771,null))[_0x3c9b('0x40')](handleError(_0x15a771,null));};exports[_0x3c9b('0x47')]=function(_0x239da1,_0x1e7ed0){return db[_0x3c9b('0x2b')][_0x3c9b('0x47')](_0x239da1['body'],{})[_0x3c9b('0x3c')](respondWithResult(_0x1e7ed0,0xc9))['catch'](handleError(_0x1e7ed0,null));};exports['update']=function(_0x24d7c8,_0x5a6865){if(_0x24d7c8[_0x3c9b('0x48')]['id']){delete _0x24d7c8[_0x3c9b('0x48')]['id'];}return db[_0x3c9b('0x2b')][_0x3c9b('0x49')]({'where':{'id':_0x24d7c8[_0x3c9b('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a6865,null))[_0x3c9b('0x3c')](saveUpdates(_0x24d7c8[_0x3c9b('0x48')],null))[_0x3c9b('0x3c')](respondWithResult(_0x5a6865,null))[_0x3c9b('0x40')](handleError(_0x5a6865,null));};exports[_0x3c9b('0x25')]=function(_0x596f61,_0x35f627){return db[_0x3c9b('0x2b')]['find']({'where':{'id':_0x596f61[_0x3c9b('0x42')]['id']}})['then'](handleEntityNotFound(_0x35f627,null))[_0x3c9b('0x3c')](removeEntity(_0x35f627,null))[_0x3c9b('0x40')](handleError(_0x35f627,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index c9a352d..1bca232 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 _0x1b81=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','util','../../config/logger'];(function(_0x3131c4,_0x5df24e){var _0x5347db=function(_0x32317e){while(--_0x32317e){_0x3131c4['push'](_0x3131c4['shift']());}};_0x5347db(++_0x5df24e);}(_0x1b81,0x124));var _0x11b8=function(_0x447e32,_0x25f7e0){_0x447e32=_0x447e32-0x0;var _0x103b19=_0x1b81[_0x447e32];return _0x103b19;};'use strict';var _=require('lodash');var util=require(_0x11b8('0x0'));var logger=require(_0x11b8('0x1'))('api');var moment=require(_0x11b8('0x2'));var BPromise=require(_0x11b8('0x3'));var rp=require(_0x11b8('0x4'));var fs=require('fs');var path=require(_0x11b8('0x5'));var rimraf=require(_0x11b8('0x6'));var config=require(_0x11b8('0x7'));var attributes=require(_0x11b8('0x8'));module[_0x11b8('0x9')]=function(_0x4f74a4,_0x14b308){return _0x4f74a4[_0x11b8('0xa')](_0x11b8('0xb'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x11b8('0xc'),'fields':[_0x11b8('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xd156=['exports','VoiceQueuesLog','voice_queues_log','dtm','../../config/logger','api','moment','path','../../config/environment'];(function(_0x151c7c,_0x8ef319){var _0x15a581=function(_0x3f8de0){while(--_0x3f8de0){_0x151c7c['push'](_0x151c7c['shift']());}};_0x15a581(++_0x8ef319);}(_0xd156,0x151));var _0x6d15=function(_0x44a4de,_0x539e7c){_0x44a4de=_0x44a4de-0x0;var _0x1f3abf=_0xd156[_0x44a4de];return _0x1f3abf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6d15('0x0'))(_0x6d15('0x1'));var moment=require(_0x6d15('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d15('0x3'));var rimraf=require('rimraf');var config=require(_0x6d15('0x4'));var attributes=require('./voiceQueuesLog.attributes');module[_0x6d15('0x5')]=function(_0x3736b8,_0x524c33){return _0x3736b8['define'](_0x6d15('0x6'),attributes,{'tableName':_0x6d15('0x7'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0x6d15('0x8')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 0543ae4..7868bbe 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 _0x3306=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x43c355,_0x469b9a){var _0xbf9e1c=function(_0x200617){while(--_0x200617){_0x43c355['push'](_0x43c355['shift']());}};_0xbf9e1c(++_0x469b9a);}(_0x3306,0x1ec));var _0x6330=function(_0x3e5345,_0xf11108){_0x3e5345=_0x3e5345-0x0;var _0x3392c3=_0x3306[_0x3e5345];return _0x3392c3;};'use strict';var _=require(_0x6330('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6330('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6330('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6330('0x3'));var logger=require(_0x6330('0x4'))('rpc');var config=require(_0x6330('0x5'));var jayson=require(_0x6330('0x6'));var client=jayson[_0x6330('0x7')][_0x6330('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd06a5c,_0x3a6cff,_0x360f97){return new BPromise(function(_0x3c2e7d,_0xb4739b){return client['request'](_0xd06a5c,_0x360f97)[_0x6330('0x9')](function(_0x5aa3ce){logger[_0x6330('0xa')](_0x6330('0xb'),_0x3a6cff,'request\x20sent');logger[_0x6330('0xc')](_0x6330('0xd'),_0x3a6cff,_0x6330('0xe'),JSON[_0x6330('0xf')](_0x5aa3ce));if(_0x5aa3ce[_0x6330('0x10')]){if(_0x5aa3ce[_0x6330('0x10')][_0x6330('0x11')]===0x1f4){logger['error'](_0x6330('0xb'),_0x3a6cff,_0x5aa3ce['error']['message']);return _0xb4739b(_0x5aa3ce[_0x6330('0x10')][_0x6330('0x12')]);}logger['error'](_0x6330('0xb'),_0x3a6cff,_0x5aa3ce[_0x6330('0x10')]['message']);return _0x3c2e7d(_0x5aa3ce[_0x6330('0x10')][_0x6330('0x12')]);}else{logger[_0x6330('0xa')](_0x6330('0xb'),_0x3a6cff,_0x6330('0xe'));_0x3c2e7d(_0x5aa3ce[_0x6330('0x13')][_0x6330('0x12')]);}})[_0x6330('0x14')](function(_0x29c290){logger[_0x6330('0x10')](_0x6330('0xb'),_0x3a6cff,_0x29c290);_0xb4739b(_0x29c290);});});} \ No newline at end of file +var _0x5cd9=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','rpc'];(function(_0x537d69,_0x2a04ea){var _0x433d2b=function(_0x38d67b){while(--_0x38d67b){_0x537d69['push'](_0x537d69['shift']());}};_0x433d2b(++_0x2a04ea);}(_0x5cd9,0x13c));var _0x95cd=function(_0xe27cee,_0x25bfa0){_0xe27cee=_0xe27cee-0x0;var _0x25db5e=_0x5cd9[_0xe27cee];return _0x25db5e;};'use strict';var _=require('lodash');var util=require(_0x95cd('0x0'));var moment=require(_0x95cd('0x1'));var BPromise=require(_0x95cd('0x2'));var rs=require(_0x95cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x95cd('0x5'));var config=require(_0x95cd('0x6'));var jayson=require(_0x95cd('0x7'));var client=jayson[_0x95cd('0x8')][_0x95cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a862e,_0xda639a,_0x50f01d){return new BPromise(function(_0x523d56,_0x4fc0f5){return client[_0x95cd('0xa')](_0x2a862e,_0x50f01d)[_0x95cd('0xb')](function(_0x3cac40){logger[_0x95cd('0xc')](_0x95cd('0xd'),_0xda639a,_0x95cd('0xe'));logger[_0x95cd('0xf')](_0x95cd('0x10'),_0xda639a,_0x95cd('0xe'),JSON[_0x95cd('0x11')](_0x3cac40));if(_0x3cac40[_0x95cd('0x12')]){if(_0x3cac40[_0x95cd('0x12')][_0x95cd('0x13')]===0x1f4){logger[_0x95cd('0x12')](_0x95cd('0xd'),_0xda639a,_0x3cac40[_0x95cd('0x12')][_0x95cd('0x14')]);return _0x4fc0f5(_0x3cac40[_0x95cd('0x12')][_0x95cd('0x14')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xda639a,_0x3cac40[_0x95cd('0x12')]['message']);return _0x523d56(_0x3cac40[_0x95cd('0x12')][_0x95cd('0x14')]);}else{logger[_0x95cd('0xc')](_0x95cd('0xd'),_0xda639a,_0x95cd('0xe'));_0x523d56(_0x3cac40[_0x95cd('0x15')][_0x95cd('0x14')]);}})[_0x95cd('0x16')](function(_0x14e6f3){logger[_0x95cd('0x12')](_0x95cd('0xd'),_0xda639a,_0x14e6f3);_0x4fc0f5(_0x14e6f3);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 15d92bd..5ace4b5 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 _0x4521=['put','update','destroy','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','/:id','show','/:id/download','isAuthenticated','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create'];(function(_0x35cc3c,_0x514401){var _0x2ca231=function(_0x5052ce){while(--_0x5052ce){_0x35cc3c['push'](_0x35cc3c['shift']());}};_0x2ca231(++_0x514401);}(_0x4521,0x1d0));var _0x1452=function(_0x57023f,_0x2b8cd7){_0x57023f=_0x57023f-0x0;var _0x1ee860=_0x4521[_0x57023f];return _0x1ee860;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1452('0x0'));var timeout=require(_0x1452('0x1'));var express=require(_0x1452('0x2'));var router=express['Router']();var fs_extra=require(_0x1452('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1452('0x4'));var config=require(_0x1452('0x5'));var controller=require('./voiceRecording.controller');router[_0x1452('0x6')]('/',auth['isAuthenticated'](),controller[_0x1452('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x1452('0x8')]);router[_0x1452('0x6')](_0x1452('0x9'),auth['isAuthenticated'](),controller[_0x1452('0xa')]);router[_0x1452('0x6')](_0x1452('0xb'),auth[_0x1452('0xc')](),controller['download']);router[_0x1452('0x6')](_0x1452('0xd'),controller[_0x1452('0xe')]);router['get'](_0x1452('0xf'),auth[_0x1452('0xc')](),controller[_0x1452('0x10')]);router[_0x1452('0x11')]('/',auth[_0x1452('0xc')](),controller[_0x1452('0x12')]);router[_0x1452('0x11')](_0x1452('0xf'),auth[_0x1452('0xc')](),controller['runTranscribe']);router[_0x1452('0x13')](_0x1452('0x9'),auth[_0x1452('0xc')](),controller[_0x1452('0x14')]);router['delete'](_0x1452('0x9'),auth[_0x1452('0xc')](),controller[_0x1452('0x15')]);module[_0x1452('0x16')]=router; \ No newline at end of file +var _0x9e06=['isAuthenticated','index','/:id','show','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x9e06,0x1be));var _0x69e0=function(_0x4c77a2,_0x451b31){_0x4c77a2=_0x4c77a2-0x0;var _0x1f41dd=_0x9e06[_0x4c77a2];return _0x1f41dd;};'use strict';var multer=require(_0x69e0('0x0'));var util=require(_0x69e0('0x1'));var path=require(_0x69e0('0x2'));var timeout=require(_0x69e0('0x3'));var express=require(_0x69e0('0x4'));var router=express[_0x69e0('0x5')]();var fs_extra=require(_0x69e0('0x6'));var auth=require(_0x69e0('0x7'));var interaction=require(_0x69e0('0x8'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x69e0('0x9')]('/',auth[_0x69e0('0xa')](),controller[_0x69e0('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x69e0('0x9')](_0x69e0('0xc'),auth[_0x69e0('0xa')](),controller[_0x69e0('0xd')]);router[_0x69e0('0x9')]('/:id/download',auth[_0x69e0('0xa')](),controller['download']);router[_0x69e0('0x9')](_0x69e0('0xe'),controller[_0x69e0('0xf')]);router[_0x69e0('0x9')](_0x69e0('0x10'),auth[_0x69e0('0xa')](),controller[_0x69e0('0x11')]);router[_0x69e0('0x12')]('/',auth[_0x69e0('0xa')](),controller[_0x69e0('0x13')]);router[_0x69e0('0x12')]('/:id/transcribe',auth[_0x69e0('0xa')](),controller[_0x69e0('0x14')]);router[_0x69e0('0x15')](_0x69e0('0xc'),auth[_0x69e0('0xa')](),controller[_0x69e0('0x16')]);router['delete'](_0x69e0('0xc'),auth[_0x69e0('0xa')](),controller[_0x69e0('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 14ae2fc..69a78bd 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(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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 af6df09..898ffd5 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 _0x8e58=['util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','name','send','index','map','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','VoiceRecording','includeAll','include','findAll','rows','catch','keys','rawAttributes','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','secrets','recording','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','decryptFile','ValidationError','extname','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','findOne','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0x232493,_0x195497){var _0x5482f7=function(_0x3c240a){while(--_0x3c240a){_0x232493['push'](_0x232493['shift']());}};_0x5482f7(++_0x195497);}(_0x8e58,0x91));var _0x88e5=function(_0x3106e4,_0x4b2f59){_0x3106e4=_0x3106e4-0x0;var _0x4989e2=_0x8e58[_0x3106e4];return _0x4989e2;};'use strict';var emlformat=require(_0x88e5('0x0'));var rimraf=require(_0x88e5('0x1'));var zipdir=require(_0x88e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x88e5('0x3'));var moment=require('moment');var BPromise=require(_0x88e5('0x4'));var Mustache=require(_0x88e5('0x5'));var util=require(_0x88e5('0x6'));var path=require(_0x88e5('0x7'));var sox=require(_0x88e5('0x8'));var csv=require(_0x88e5('0x9'));var ejs=require(_0x88e5('0xa'));var fs=require('fs');var fs_extra=require(_0x88e5('0xb'));var _=require(_0x88e5('0xc'));var squel=require('squel');var crypto=require(_0x88e5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x88e5('0xe'));var Papa=require(_0x88e5('0xf'));var AWS=require(_0x88e5('0x10'));var uuidv4=require(_0x88e5('0x11'));var Redis=require(_0x88e5('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x88e5('0x13'));var hardwareService=require(_0x88e5('0x14'));var logger=require(_0x88e5('0x15'))(_0x88e5('0x16'));var utils=require(_0x88e5('0x17'));var config=require(_0x88e5('0x18'));var licenseUtil=require(_0x88e5('0x19'));var db=require(_0x88e5('0x1a'))['db'];function respondWithStatusCode(_0x39253e,_0x3f4b70){_0x3f4b70=_0x3f4b70||0xcc;return function(_0x28678a){if(_0x28678a){return _0x39253e['sendStatus'](_0x3f4b70);}return _0x39253e[_0x88e5('0x1b')](_0x3f4b70)[_0x88e5('0x1c')]();};}function respondWithResult(_0x10c268,_0x232967){_0x232967=_0x232967||0xc8;return function(_0x4c44aa){if(_0x4c44aa){return _0x10c268['status'](_0x232967)['json'](_0x4c44aa);}};}function respondWithFilteredResult(_0x2004b2,_0x24806d){return function(_0x4ae1b9){if(_0x4ae1b9){var _0x5846ec=typeof _0x24806d[_0x88e5('0x1d')]===_0x88e5('0x1e')&&typeof _0x24806d[_0x88e5('0x1f')]===_0x88e5('0x1e');var _0x57d094=_0x4ae1b9[_0x88e5('0x20')];var _0x2a428e=_0x5846ec?0x0:_0x24806d[_0x88e5('0x1d')];var _0x513887=_0x5846ec?_0x4ae1b9['count']:_0x24806d['offset']+_0x24806d[_0x88e5('0x1f')];var _0x184960;if(_0x513887>=_0x57d094){_0x513887=_0x57d094;_0x184960=0xc8;}else{_0x184960=0xce;}_0x2004b2['status'](_0x184960);return _0x2004b2[_0x88e5('0x21')](_0x88e5('0x22'),_0x2a428e+'-'+_0x513887+'/'+_0x57d094)[_0x88e5('0x23')](_0x4ae1b9);}return null;};}function patchUpdates(_0x159369){return function(_0x5e672d){try{jsonpatch[_0x88e5('0x24')](_0x5e672d,_0x159369,!![]);}catch(_0x5488ce){return BPromise['reject'](_0x5488ce);}return _0x5e672d[_0x88e5('0x25')]();};}function saveUpdates(_0x51b13d,_0x2fb787){return function(_0x1c44e5){if(_0x1c44e5){return _0x1c44e5[_0x88e5('0x26')](_0x51b13d)[_0x88e5('0x27')](function(_0x233c37){return _0x233c37;});}return null;};}function removeEntity(_0x5bbaa8,_0x4034a4){return function(_0x28b627){if(_0x28b627){return _0x28b627[_0x88e5('0x28')]()['then'](function(){_0x5bbaa8[_0x88e5('0x1b')](0xcc)[_0x88e5('0x1c')]();});}};}function handleEntityNotFound(_0x3616fe,_0x95265c){return function(_0xb42544){if(!_0xb42544){_0x3616fe[_0x88e5('0x29')](0x194);}return _0xb42544;};}function handleError(_0x3365ec,_0x5c8dff){_0x5c8dff=_0x5c8dff||0x1f4;return function(_0x4d2252){logger['error'](_0x4d2252['stack']);if(_0x4d2252[_0x88e5('0x2a')]){delete _0x4d2252[_0x88e5('0x2a')];}_0x3365ec[_0x88e5('0x1b')](_0x5c8dff)[_0x88e5('0x2b')](_0x4d2252);};}exports[_0x88e5('0x2c')]=function(_0x4dd279,_0x4e45d7){var _0x3eaaf3={},_0x45e8dd={},_0xbe6522={'count':0x0,'rows':[]};var _0x4563b4=_[_0x88e5('0x2d')](db['VoiceRecording']['rawAttributes'],function(_0xfff8fa){return{'name':_0xfff8fa['fieldName'],'type':_0xfff8fa[_0x88e5('0x2e')]['key']};});_0x45e8dd[_0x88e5('0x2f')]=_['differenceBy'](_['map'](_0x4563b4,'name'),['format']);_0x45e8dd[_0x88e5('0x30')]=_['keys'](_0x4dd279[_0x88e5('0x30')]);_0x45e8dd[_0x88e5('0x31')]=_[_0x88e5('0x32')](_0x45e8dd['model'],_0x45e8dd['query']);_0x3eaaf3[_0x88e5('0x33')]=_[_0x88e5('0x32')](_0x45e8dd[_0x88e5('0x2f')],qs[_0x88e5('0x34')](_0x4dd279['query'][_0x88e5('0x34')]));_0x3eaaf3['attributes']=_0x3eaaf3[_0x88e5('0x33')][_0x88e5('0x35')]?_0x3eaaf3[_0x88e5('0x33')]:_0x45e8dd[_0x88e5('0x2f')];if(!_0x4dd279[_0x88e5('0x30')]['hasOwnProperty']('nolimit')){_0x3eaaf3[_0x88e5('0x1f')]=qs[_0x88e5('0x1f')](_0x4dd279[_0x88e5('0x30')]['limit']);_0x3eaaf3[_0x88e5('0x1d')]=qs['offset'](_0x4dd279[_0x88e5('0x30')][_0x88e5('0x1d')]);}_0x3eaaf3[_0x88e5('0x36')]=qs[_0x88e5('0x37')](_0x4dd279[_0x88e5('0x30')][_0x88e5('0x37')]);_0x3eaaf3[_0x88e5('0x38')]=qs[_0x88e5('0x31')](_[_0x88e5('0x39')](_0x4dd279[_0x88e5('0x30')],_0x45e8dd[_0x88e5('0x31')]),_0x4563b4);if(_0x4dd279[_0x88e5('0x30')][_0x88e5('0x3a')]){_0x3eaaf3[_0x88e5('0x38')]=_[_0x88e5('0x3b')](_0x3eaaf3[_0x88e5('0x38')],{'$or':_['map'](_0x4563b4,function(_0x4eba92){if(_0x4eba92[_0x88e5('0x2e')]!=='VIRTUAL'){var _0x3e3e18={};_0x3e3e18[_0x4eba92[_0x88e5('0x2a')]]={'$like':'%'+_0x4dd279['query'][_0x88e5('0x3a')]+'%'};return _0x3e3e18;}})});}_0x3eaaf3=_['merge']({},_0x3eaaf3,_0x4dd279[_0x88e5('0x3c')]);var _0x1621f5={'where':_0x3eaaf3['where']};return db[_0x88e5('0x3d')][_0x88e5('0x20')](_0x1621f5)[_0x88e5('0x27')](function(_0x2413ec){_0xbe6522[_0x88e5('0x20')]=_0x2413ec;if(_0x4dd279[_0x88e5('0x30')][_0x88e5('0x3e')]){_0x3eaaf3[_0x88e5('0x3f')]=[{'all':!![]}];}return db[_0x88e5('0x3d')][_0x88e5('0x40')](_0x3eaaf3);})[_0x88e5('0x27')](function(_0xfa2b64){_0xbe6522[_0x88e5('0x41')]=_0xfa2b64;return _0xbe6522;})['then'](respondWithFilteredResult(_0x4e45d7,_0x3eaaf3))[_0x88e5('0x42')](handleError(_0x4e45d7,null));};exports['show']=function(_0x272036,_0x3ca837){var _0x490f86={'raw':![],'where':{'id':_0x272036['params']['id']}},_0x2fbc1b={};_0x2fbc1b[_0x88e5('0x2f')]=_[_0x88e5('0x43')](db[_0x88e5('0x3d')][_0x88e5('0x44')]);_0x2fbc1b[_0x88e5('0x30')]=_[_0x88e5('0x43')](_0x272036['query']);_0x2fbc1b[_0x88e5('0x31')]=_[_0x88e5('0x32')](_0x2fbc1b[_0x88e5('0x2f')],_0x2fbc1b['query']);_0x490f86[_0x88e5('0x33')]=_[_0x88e5('0x32')](_0x2fbc1b['model'],qs[_0x88e5('0x34')](_0x272036[_0x88e5('0x30')][_0x88e5('0x34')]));_0x490f86[_0x88e5('0x33')]=_0x490f86[_0x88e5('0x33')]['length']?_0x490f86['attributes']:_0x2fbc1b[_0x88e5('0x2f')];if(_0x272036[_0x88e5('0x30')]['includeAll']){_0x490f86['include']=[{'all':!![]}];}_0x490f86=_['merge']({},_0x490f86,_0x272036['options']);return db[_0x88e5('0x3d')][_0x88e5('0x45')](_0x490f86)[_0x88e5('0x27')](handleEntityNotFound(_0x3ca837,null))[_0x88e5('0x27')](respondWithResult(_0x3ca837,null))[_0x88e5('0x42')](handleError(_0x3ca837,null));};exports[_0x88e5('0x46')]=function(_0x372ae3,_0x1d5e8c){return db[_0x88e5('0x3d')][_0x88e5('0x46')](_0x372ae3['body'],{})[_0x88e5('0x27')](respondWithResult(_0x1d5e8c,0xc9))[_0x88e5('0x42')](handleError(_0x1d5e8c,null));};exports[_0x88e5('0x26')]=function(_0x1864e4,_0x219f05){if(_0x1864e4['body']['id']){delete _0x1864e4[_0x88e5('0x47')]['id'];}return db[_0x88e5('0x3d')][_0x88e5('0x45')]({'where':{'id':_0x1864e4[_0x88e5('0x48')]['id']}})[_0x88e5('0x27')](handleEntityNotFound(_0x219f05,null))[_0x88e5('0x27')](saveUpdates(_0x1864e4[_0x88e5('0x47')],null))[_0x88e5('0x27')](respondWithResult(_0x219f05,null))['catch'](handleError(_0x219f05,null));};exports[_0x88e5('0x49')]=function(_0x50a863,_0x243259){return db['VoiceRecording'][_0x88e5('0x49')]()[_0x88e5('0x27')](respondWithResult(_0x243259,null))['catch'](handleError(_0x243259,null));};exports[_0x88e5('0x4a')]=function(_0x48d580,_0x4a6f7a,_0x197089){var _0x53e308=require(_0x88e5('0x4b'));var _0x1354e1=![];var _0x10d9e6={};if(_0x48d580[_0x88e5('0x30')][_0x88e5('0x2e')]&&_0x48d580[_0x88e5('0x30')]['type']===_0x88e5('0x4c')){_0x10d9e6[_0x88e5('0x4c')]=_0x48d580[_0x88e5('0x48')]['id'];}else{_0x10d9e6['id']=_0x48d580[_0x88e5('0x48')]['id'];}return db[_0x88e5('0x3d')][_0x88e5('0x45')]({'where':_0x10d9e6,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x4a6f7a,null))[_0x88e5('0x27')](function(_0x2e56d9){if(_0x2e56d9){var _0x5f394d=_0x2e56d9[_0x88e5('0x4d')];var _0x567853=util[_0x88e5('0x4e')](_0x88e5('0x4f'),_0x5f394d);if(fs['existsSync'](_0x567853)){_0x1354e1=!![];return _0x53e308['decryptFile'](_0x567853,_0x5f394d,config[_0x88e5('0x50')][_0x88e5('0x51')])[_0x88e5('0x27')](function(){return _0x2e56d9;});}return _0x2e56d9;}})[_0x88e5('0x27')](function(_0x555f0c){if(_0x555f0c){var _0x4576f4=_0x555f0c[_0x88e5('0x4d')];if(!fs[_0x88e5('0x52')](_0x4576f4)){throw new db[(_0x88e5('0x53'))]['ValidationError'](_0x88e5('0x54'));}if(_0x555f0c['filename']){return _0x4a6f7a[_0x88e5('0x4a')](_0x4576f4,_0x555f0c[_0x88e5('0x55')]+path['extname'](_0x4576f4),function(){if(_0x1354e1){fs[_0x88e5('0x56')](_0x4576f4);}});}else{return _0x4a6f7a['download'](_0x4576f4,function(_0x5e927b){if(_0x1354e1){fs[_0x88e5('0x56')](_0x4576f4);}});}}})[_0x88e5('0x42')](function(_0x33474c){if(_0x33474c[_0x88e5('0x57')]===_0x88e5('0x54')){_0x4a6f7a['status'](0x194)[_0x88e5('0x2b')](_0x88e5('0x58'));}else{return handleError(_0x4a6f7a,null);}});};exports['downloads']=function(_0x51a1d4,_0xbb89b9,_0xdd5440){var _0xa6c122=require(_0x88e5('0x4b'));var _0x52457a=![];var _0x3115f9={'$and':[db[_0x88e5('0x59')]['where'](db[_0x88e5('0x59')]['fn'](_0x88e5('0x5a'),db['sequelize'][_0x88e5('0x5b')](_0x88e5('0x4c'))),_0x51a1d4[_0x88e5('0x30')][_0x88e5('0x5c')])]};if(_0x51a1d4[_0x88e5('0x30')][_0x88e5('0x2e')]&&_0x51a1d4['query'][_0x88e5('0x2e')]==='uniqueid'){_0x3115f9['$and']['push']({'uniqueid':_0x51a1d4[_0x88e5('0x48')]['id']});}else{_0x3115f9[_0x88e5('0x5d')][_0x88e5('0x5e')]({'id':_0x51a1d4[_0x88e5('0x48')]['id']});}return db[_0x88e5('0x3d')][_0x88e5('0x45')]({'where':_0x3115f9,'attributes':['id',_0x88e5('0x4d')],'raw':!![]})[_0x88e5('0x27')](handleEntityNotFound(_0xbb89b9,null))[_0x88e5('0x27')](function(_0x27b9f5){if(_0x27b9f5){var _0x80afed=util[_0x88e5('0x4e')]('%s.cypher',_0x27b9f5[_0x88e5('0x4d')]);if(fs[_0x88e5('0x52')](_0x80afed)){_0x52457a=!![];return _0xa6c122[_0x88e5('0x5f')](_0x80afed,_0x27b9f5[_0x88e5('0x4d')],config['secrets'][_0x88e5('0x51')])['then'](function(){return _0x27b9f5;});}return _0x27b9f5;}})[_0x88e5('0x27')](function(_0x548b72){if(_0x548b72){if(!fs[_0x88e5('0x52')](_0x548b72[_0x88e5('0x4d')])){throw new db[(_0x88e5('0x53'))][(_0x88e5('0x60'))](_0x88e5('0x54'));}if(_0x548b72[_0x88e5('0x55')]){return _0xbb89b9[_0x88e5('0x4a')](_0x548b72[_0x88e5('0x4d')],_0x548b72[_0x88e5('0x55')]+path[_0x88e5('0x61')](_0x548b72[_0x88e5('0x4d')]),function(){if(_0x52457a){fs['unlink'](_0x548b72[_0x88e5('0x4d')]);}});}else{return _0xbb89b9['download'](_0x548b72[_0x88e5('0x4d')],function(_0x5d1729){if(_0x52457a){fs[_0x88e5('0x56')](_0x548b72['value']);}});}}})[_0x88e5('0x42')](handleError(_0xbb89b9,null));};exports[_0x88e5('0x28')]=function(_0x43f740,_0x5e93b5){return db[_0x88e5('0x3d')][_0x88e5('0x45')]({'where':{'id':_0x43f740[_0x88e5('0x48')]['id']}})[_0x88e5('0x27')](function(_0x3f3845){if(_['isNil'](_0x3f3845)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3f3845;})[_0x88e5('0x27')](function(_0x149d45){var _0x1ba0a8=_0x149d45[_0x88e5('0x4d')];logger[_0x88e5('0x62')](_0x88e5('0x63'),_0x1ba0a8);if(!_[_0x88e5('0x64')](_0x149d45['value'])&&fs[_0x88e5('0x52')](_0x1ba0a8)){logger[_0x88e5('0x62')](_0x88e5('0x65')+_0x1ba0a8+_0x88e5('0x66'));fs[_0x88e5('0x67')](_0x1ba0a8);}_0x1ba0a8=_0x1ba0a8+_0x88e5('0x68');if(!_[_0x88e5('0x64')](_0x149d45[_0x88e5('0x4d')])&&fs[_0x88e5('0x52')](_0x1ba0a8)){logger['info'](_0x88e5('0x65')+_0x1ba0a8+_0x88e5('0x66'));fs[_0x88e5('0x67')](_0x1ba0a8);}return _0x149d45;})[_0x88e5('0x27')](function(_0x578885){if(!_0x578885)throw new InternalError();return _0x578885['destroy']();})[_0x88e5('0x27')](function(){_0x5e93b5['status'](0xcc)['end']();})[_0x88e5('0x42')](handleError(_0x5e93b5,null));};function getBucketslist(_0x3b8846,_0x1aeb72,_0x2d9c43){return new Promise(function(_0x5c2a62,_0x398337){var _0x1ce043=new AWS['S3']({'accessKeyId':_0x1aeb72,'secretAccessKey':_0x3b8846,'region':_0x2d9c43});_0x1ce043['listBuckets']({},function(_0x40bfb6,_0x403570){if(_0x40bfb6){return _0x398337(_0x40bfb6);}else{return _0x5c2a62(_0x403570);}});});}function createBucket(_0x170f81,_0x4aba88,_0xca234e,_0x3007fd){return new Promise(function(_0x277f71,_0x15ceb9){var _0x52467e=new AWS['S3']({'accessKeyId':_0x4aba88,'secretAccessKey':_0x170f81,'region':_0xca234e});_0x52467e['createBucket']({'Bucket':_0x3007fd},function(_0x35e2cb,_0x29fa15){if(_0x35e2cb){return _0x15ceb9(_0x35e2cb);}else{return _0x277f71(_0x29fa15);}});});}function uploadFile(_0x3eabb4,_0x5c2dce,_0x483412,_0x1ba0be,_0xebf784,_0x22ea6d){return new Promise(function(_0x328050,_0x237e7d){var _0x4d6851=new AWS['S3']({'accessKeyId':_0x5c2dce,'secretAccessKey':_0x3eabb4,'region':_0x483412});_0x4d6851['upload']({'Bucket':_0x1ba0be,'Key':_0xebf784,'Body':_0x22ea6d},function(_0x27851f,_0x4068f0){if(_0x27851f){return _0x237e7d(_0x27851f);}else{return _0x328050(_0x4068f0);}});});}function startTranscribe(_0x6958a7,_0x5c4ed3,_0x150828,_0x89d036,_0x5e4969,_0x3b47e5){return new Promise(function(_0x1017fd,_0x379acf){var _0x639e1b=new AWS[(_0x88e5('0x69'))]({'accessKeyId':_0x5c4ed3,'secretAccessKey':_0x6958a7,'region':_0x150828});_0x639e1b[_0x88e5('0x6a')]({'TranscriptionJobName':_0x89d036,'LanguageCode':_0x5e4969,'Media':{'MediaFileUri':_0x3b47e5}},function(_0x3bcb7f,_0x43534b){if(_0x3bcb7f){return _0x379acf(_0x3bcb7f);}else{return _0x1017fd(_0x43534b);}});});}function transcribe(_0x3c1ea5,_0x148a22,_0x27b8e4,_0x126543,_0x228d27,_0x1671df,_0x3d401e){return new Promise(function(_0x304b77,_0x855a68){var _0x42073e={};logger[_0x88e5('0x62')](util['format'](_0x88e5('0x6b'),_0x3c1ea5,_0x228d27));return uploadFile(_0x148a22,_0x27b8e4,_0x126543,_0x228d27,path[_0x88e5('0x6c')](_0x1671df),fs[_0x88e5('0x6d')](_0x1671df))['then'](function(_0x47b5f9){logger[_0x88e5('0x62')](util[_0x88e5('0x4e')](_0x88e5('0x6e'),_0x3c1ea5,_0x228d27,_0x47b5f9[_0x88e5('0x6f')]));_0x42073e['bucket']=_0x47b5f9[_0x88e5('0x70')];_0x42073e[_0x88e5('0x71')]=_0x47b5f9[_0x88e5('0x6f')];logger[_0x88e5('0x62')](util['format'](_0x88e5('0x72'),_0x3c1ea5));return startTranscribe(_0x148a22,_0x27b8e4,_0x126543,uuidv4(),_0x3d401e,_0x47b5f9[_0x88e5('0x6f')]);})[_0x88e5('0x27')](function(_0x3744d0){logger[_0x88e5('0x62')](util[_0x88e5('0x4e')](_0x88e5('0x73'),_0x3c1ea5,_0x3744d0['TranscriptionJob'][_0x88e5('0x74')]));_0x42073e[_0x88e5('0x75')]=_0x3744d0[_0x88e5('0x76')][_0x88e5('0x74')];_0x42073e[_0x88e5('0x77')]=_0x3744d0[_0x88e5('0x76')][_0x88e5('0x78')];return _0x304b77(_0x42073e);})['catch'](function(_0x3c2b1e){return _0x855a68(_0x3c2b1e);});});}exports[_0x88e5('0x79')]=function(_0xd72042,_0x13bc84,_0x5873dd){var _0x49e86e;var _0x2c42d7;var _0x5c096e;var _0x2c2107=require(_0x88e5('0x4b'));return db[_0x88e5('0x3d')]['findOne']({'where':{'id':_0xd72042[_0x88e5('0x48')]['id']}})['then'](function(_0x5e4f37){if(_0x5e4f37){var _0xb35cc6=util[_0x88e5('0x4e')](_0x88e5('0x4f'),_0x5e4f37[_0x88e5('0x4d')]);if(fs[_0x88e5('0x52')](_0xb35cc6)){cypher=!![];return _0x2c2107[_0x88e5('0x5f')](_0xb35cc6,_0x5e4f37[_0x88e5('0x4d')],config[_0x88e5('0x50')]['recording'])[_0x88e5('0x27')](function(){return _0x5e4f37;});}return _0x5e4f37;}})[_0x88e5('0x27')](function(_0xf736ea){if(!_0xf736ea){throw new db[(_0x88e5('0x53'))][(_0x88e5('0x60'))](_0x88e5('0x7a'));}_0x2c42d7=_0xf736ea;return db[_0x88e5('0x7b')]['findOne']({'where':{'id':0x1}});})[_0x88e5('0x27')](handleEntityNotFound(_0x13bc84,null))[_0x88e5('0x27')](function(_0x1cc7a2){if(_0x1cc7a2){_0x49e86e=_0x1cc7a2;if(!_0x49e86e['transcribe']||!_0x49e86e['transcribeAccountId']||!_0x49e86e[_0x88e5('0x7c')]||!_0x49e86e['language']||!_0x49e86e['bucket']){throw new db[(_0x88e5('0x53'))][(_0x88e5('0x60'))](_0x88e5('0x7d'));}if(_0xd72042[_0x88e5('0x47')][_0x88e5('0x7e')]&&(!_0x49e86e[_0x88e5('0x7f')]||!_0x49e86e[_0x88e5('0x80')]||!_0x49e86e[_0x88e5('0x81')]||!_0x49e86e[_0x88e5('0x82')]||!_0x49e86e[_0x88e5('0x83')])){throw new db[(_0x88e5('0x53'))][(_0x88e5('0x60'))](_0x88e5('0x84'));}return db['CloudProvider']['findOne']({'where':{'id':_0x49e86e['transcribeAccountId']}});}})[_0x88e5('0x27')](function(_0x1c6aa6){if(!_0x1c6aa6){throw new db['Sequelize'][(_0x88e5('0x60'))](_0x88e5('0x85'));}if(!_0x1c6aa6['data1']||!_0x1c6aa6[_0x88e5('0x86')]){throw new db[(_0x88e5('0x53'))][(_0x88e5('0x60'))](_0x88e5('0x87'));}_0x5c096e=_0x1c6aa6;return getBucketslist(_0x5c096e[_0x88e5('0x88')],_0x5c096e[_0x88e5('0x86')],_0x49e86e['transcribeRegion']);})['then'](function(_0xdd9411){if(_0xdd9411&&_0xdd9411[_0x88e5('0x89')]){var _0x2440f7=_[_0x88e5('0x45')](_0xdd9411[_0x88e5('0x89')],function(_0x5ec414){return _0x5ec414[_0x88e5('0x8a')]===_0x49e86e[_0x88e5('0x83')];});if(!_0x2440f7){logger[_0x88e5('0x62')](util[_0x88e5('0x4e')](_0x88e5('0x8b'),_0xd72042[_0x88e5('0x48')]['id'],_0x49e86e[_0x88e5('0x83')]));return createBucket(_0x5c096e['data1'],_0x5c096e['data2'],_0x49e86e[_0x88e5('0x7c')],_0x49e86e['bucket']);}logger[_0x88e5('0x62')](util[_0x88e5('0x4e')](_0x88e5('0x8c'),_0xd72042[_0x88e5('0x48')]['id'],_0x49e86e['bucket']));return;}})[_0x88e5('0x27')](function(_0x19dd79){if(_0x2c42d7['transcribeStatus']==='NEW'){return transcribe(_0xd72042[_0x88e5('0x48')]['id'],_0x5c096e[_0x88e5('0x88')],_0x5c096e[_0x88e5('0x86')],_0x49e86e[_0x88e5('0x7c')],_0x49e86e['bucket'],_0x2c42d7[_0x88e5('0x4d')],_0x49e86e['language']);}else{logger[_0x88e5('0x62')](util['format'](_0x88e5('0x8d'),_0xd72042[_0x88e5('0x48')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x88e5('0x27')](function(_0x1ef8fc){if(_0x1ef8fc){_0x1ef8fc[_0x88e5('0x8e')]=_0xd72042[_0x88e5('0x47')]['runSentiment'];return _0x2c42d7[_0x88e5('0x8f')](_0x1ef8fc);}})[_0x88e5('0x27')](respondWithResult(_0x13bc84,null))['catch'](handleError(_0x13bc84,null));};function writeFile(_0x4d949e,_0x1f97c6){return new Promise(function(_0x152f40,_0x40f87c){fs[_0x88e5('0x90')](_0x1f97c6,_0x4d949e,function(_0x518628,_0x34e303){if(_0x518628){return _0x40f87c(_0x518628);}else{return _0x152f40(_0x34e303);}});});}exports['downloadTranscribe']=function(_0x4c5a36,_0x1942fc,_0x576891){return db[_0x88e5('0x3d')][_0x88e5('0x91')]({'where':{'id':_0x4c5a36[_0x88e5('0x48')]['id']}})[_0x88e5('0x27')](handleEntityNotFound(_0x1942fc))[_0x88e5('0x27')](function(_0x5bcda1){if(_0x5bcda1&&_0x5bcda1[_0x88e5('0x92')]){var _0x21052e=_0x5bcda1['fileText'];var _0x213f57=config[_0x88e5('0x93')]+_0x88e5('0x94')+_0x5bcda1['id']+_0x88e5('0x95');if(fs[_0x88e5('0x52')](_0x213f57)){return _0x213f57;}return writeFile(_0x21052e,_0x213f57)['then'](function(){return _0x213f57;});}else{throw new db['Sequelize'][(_0x88e5('0x60'))](_0x88e5('0x96'));}})[_0x88e5('0x27')](function(_0x3fb8ad){return _0x1942fc[_0x88e5('0x4a')](_0x3fb8ad);})[_0x88e5('0x42')](handleError(_0x1942fc));}; \ No newline at end of file +var _0x08c1=['key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','Not\x20found','downloads','sequelize','col','token','$and','push','existsSync','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','name','send','index','map','VoiceRecording','type'];(function(_0x13ae2a,_0x2cb187){var _0x2f56e1=function(_0x279320){while(--_0x279320){_0x13ae2a['push'](_0x13ae2a['shift']());}};_0x2f56e1(++_0x2cb187);}(_0x08c1,0x1ac));var _0x108c=function(_0x380cd2,_0x3f7c81){_0x380cd2=_0x380cd2-0x0;var _0x1ab58d=_0x08c1[_0x380cd2];return _0x1ab58d;};'use strict';var emlformat=require(_0x108c('0x0'));var rimraf=require(_0x108c('0x1'));var zipdir=require(_0x108c('0x2'));var jsonpatch=require(_0x108c('0x3'));var rp=require(_0x108c('0x4'));var moment=require(_0x108c('0x5'));var BPromise=require(_0x108c('0x6'));var Mustache=require(_0x108c('0x7'));var util=require(_0x108c('0x8'));var path=require(_0x108c('0x9'));var sox=require(_0x108c('0xa'));var csv=require('to-csv');var ejs=require(_0x108c('0xb'));var fs=require('fs');var fs_extra=require(_0x108c('0xc'));var _=require(_0x108c('0xd'));var squel=require(_0x108c('0xe'));var crypto=require(_0x108c('0xf'));var jsforce=require(_0x108c('0x10'));var deskjs=require(_0x108c('0x11'));var toCsv=require(_0x108c('0x12'));var querystring=require(_0x108c('0x13'));var Papa=require(_0x108c('0x14'));var AWS=require(_0x108c('0x15'));var uuidv4=require(_0x108c('0x16'));var Redis=require(_0x108c('0x17'));var authService=require(_0x108c('0x18'));var qs=require(_0x108c('0x19'));var as=require(_0x108c('0x1a'));var hardwareService=require(_0x108c('0x1b'));var logger=require(_0x108c('0x1c'))('api');var utils=require(_0x108c('0x1d'));var config=require(_0x108c('0x1e'));var licenseUtil=require(_0x108c('0x1f'));var db=require(_0x108c('0x20'))['db'];function respondWithStatusCode(_0x13f97b,_0x40399a){_0x40399a=_0x40399a||0xcc;return function(_0x4febb0){if(_0x4febb0){return _0x13f97b[_0x108c('0x21')](_0x40399a);}return _0x13f97b[_0x108c('0x22')](_0x40399a)[_0x108c('0x23')]();};}function respondWithResult(_0x16064,_0x5d3d25){_0x5d3d25=_0x5d3d25||0xc8;return function(_0x47c292){if(_0x47c292){return _0x16064['status'](_0x5d3d25)[_0x108c('0x24')](_0x47c292);}};}function respondWithFilteredResult(_0x556de2,_0x55a841){return function(_0x3d97f5){if(_0x3d97f5){var _0x59289e=typeof _0x55a841[_0x108c('0x25')]===_0x108c('0x26')&&typeof _0x55a841[_0x108c('0x27')]===_0x108c('0x26');var _0x13c30f=_0x3d97f5[_0x108c('0x28')];var _0x4e0994=_0x59289e?0x0:_0x55a841['offset'];var _0x4f4e1b=_0x59289e?_0x3d97f5[_0x108c('0x28')]:_0x55a841[_0x108c('0x25')]+_0x55a841[_0x108c('0x27')];var _0x4bab71;if(_0x4f4e1b>=_0x13c30f){_0x4f4e1b=_0x13c30f;_0x4bab71=0xc8;}else{_0x4bab71=0xce;}_0x556de2[_0x108c('0x22')](_0x4bab71);return _0x556de2[_0x108c('0x29')]('Content-Range',_0x4e0994+'-'+_0x4f4e1b+'/'+_0x13c30f)['json'](_0x3d97f5);}return null;};}function patchUpdates(_0x1500bd){return function(_0x17c8ff){try{jsonpatch['apply'](_0x17c8ff,_0x1500bd,!![]);}catch(_0xd45b03){return BPromise[_0x108c('0x2a')](_0xd45b03);}return _0x17c8ff[_0x108c('0x2b')]();};}function saveUpdates(_0x25cc9f,_0x59bbaf){return function(_0x51dd1c){if(_0x51dd1c){return _0x51dd1c['update'](_0x25cc9f)[_0x108c('0x2c')](function(_0x111be4){return _0x111be4;});}return null;};}function removeEntity(_0x2df54c,_0x380cf9){return function(_0x4046cb){if(_0x4046cb){return _0x4046cb[_0x108c('0x2d')]()['then'](function(){_0x2df54c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb5f2,_0x59cd87){return function(_0x32a5d3){if(!_0x32a5d3){_0x2eb5f2[_0x108c('0x21')](0x194);}return _0x32a5d3;};}function handleError(_0x49eaba,_0x6cd3ad){_0x6cd3ad=_0x6cd3ad||0x1f4;return function(_0x918bc8){logger['error'](_0x918bc8['stack']);if(_0x918bc8[_0x108c('0x2e')]){delete _0x918bc8[_0x108c('0x2e')];}_0x49eaba[_0x108c('0x22')](_0x6cd3ad)[_0x108c('0x2f')](_0x918bc8);};}exports[_0x108c('0x30')]=function(_0x2c5713,_0x182a49){var _0x1cfe27={},_0x12e351={},_0x341243={'count':0x0,'rows':[]};var _0x3c41ea=_[_0x108c('0x31')](db[_0x108c('0x32')]['rawAttributes'],function(_0x51fcb4){return{'name':_0x51fcb4['fieldName'],'type':_0x51fcb4[_0x108c('0x33')][_0x108c('0x34')]};});_0x12e351[_0x108c('0x35')]=_[_0x108c('0x36')](_[_0x108c('0x31')](_0x3c41ea,_0x108c('0x2e')),[_0x108c('0x37')]);_0x12e351[_0x108c('0x38')]=_['keys'](_0x2c5713[_0x108c('0x38')]);_0x12e351[_0x108c('0x39')]=_[_0x108c('0x3a')](_0x12e351[_0x108c('0x35')],_0x12e351[_0x108c('0x38')]);_0x1cfe27['attributes']=_[_0x108c('0x3a')](_0x12e351[_0x108c('0x35')],qs[_0x108c('0x3b')](_0x2c5713[_0x108c('0x38')][_0x108c('0x3b')]));_0x1cfe27[_0x108c('0x3c')]=_0x1cfe27[_0x108c('0x3c')][_0x108c('0x3d')]?_0x1cfe27[_0x108c('0x3c')]:_0x12e351[_0x108c('0x35')];if(!_0x2c5713['query'][_0x108c('0x3e')](_0x108c('0x3f'))){_0x1cfe27['limit']=qs[_0x108c('0x27')](_0x2c5713[_0x108c('0x38')][_0x108c('0x27')]);_0x1cfe27[_0x108c('0x25')]=qs[_0x108c('0x25')](_0x2c5713[_0x108c('0x38')]['offset']);}_0x1cfe27['order']=qs[_0x108c('0x40')](_0x2c5713[_0x108c('0x38')][_0x108c('0x40')]);_0x1cfe27['where']=qs[_0x108c('0x39')](_[_0x108c('0x41')](_0x2c5713['query'],_0x12e351['filters']),_0x3c41ea);if(_0x2c5713[_0x108c('0x38')][_0x108c('0x42')]){_0x1cfe27[_0x108c('0x43')]=_[_0x108c('0x44')](_0x1cfe27[_0x108c('0x43')],{'$or':_[_0x108c('0x31')](_0x3c41ea,function(_0x413100){if(_0x413100[_0x108c('0x33')]!==_0x108c('0x45')){var _0x2d829c={};_0x2d829c[_0x413100[_0x108c('0x2e')]]={'$like':'%'+_0x2c5713['query'][_0x108c('0x42')]+'%'};return _0x2d829c;}})});}_0x1cfe27=_[_0x108c('0x44')]({},_0x1cfe27,_0x2c5713[_0x108c('0x46')]);var _0x577d23={'where':_0x1cfe27[_0x108c('0x43')]};return db[_0x108c('0x32')][_0x108c('0x28')](_0x577d23)[_0x108c('0x2c')](function(_0xe9f6b1){_0x341243[_0x108c('0x28')]=_0xe9f6b1;if(_0x2c5713[_0x108c('0x38')][_0x108c('0x47')]){_0x1cfe27[_0x108c('0x48')]=[{'all':!![]}];}return db['VoiceRecording'][_0x108c('0x49')](_0x1cfe27);})[_0x108c('0x2c')](function(_0x41762a){_0x341243[_0x108c('0x4a')]=_0x41762a;return _0x341243;})[_0x108c('0x2c')](respondWithFilteredResult(_0x182a49,_0x1cfe27))[_0x108c('0x4b')](handleError(_0x182a49,null));};exports[_0x108c('0x4c')]=function(_0x32ac58,_0xd3c80b){var _0x320916={'raw':![],'where':{'id':_0x32ac58[_0x108c('0x4d')]['id']}},_0x1001a4={};_0x1001a4['model']=_[_0x108c('0x4e')](db[_0x108c('0x32')][_0x108c('0x4f')]);_0x1001a4['query']=_['keys'](_0x32ac58[_0x108c('0x38')]);_0x1001a4[_0x108c('0x39')]=_[_0x108c('0x3a')](_0x1001a4[_0x108c('0x35')],_0x1001a4[_0x108c('0x38')]);_0x320916[_0x108c('0x3c')]=_[_0x108c('0x3a')](_0x1001a4[_0x108c('0x35')],qs[_0x108c('0x3b')](_0x32ac58[_0x108c('0x38')][_0x108c('0x3b')]));_0x320916['attributes']=_0x320916[_0x108c('0x3c')][_0x108c('0x3d')]?_0x320916[_0x108c('0x3c')]:_0x1001a4['model'];if(_0x32ac58[_0x108c('0x38')][_0x108c('0x47')]){_0x320916[_0x108c('0x48')]=[{'all':!![]}];}_0x320916=_[_0x108c('0x44')]({},_0x320916,_0x32ac58['options']);return db[_0x108c('0x32')][_0x108c('0x50')](_0x320916)['then'](handleEntityNotFound(_0xd3c80b,null))[_0x108c('0x2c')](respondWithResult(_0xd3c80b,null))['catch'](handleError(_0xd3c80b,null));};exports[_0x108c('0x51')]=function(_0x35d221,_0x2a7b9e){return db[_0x108c('0x32')][_0x108c('0x51')](_0x35d221[_0x108c('0x52')],{})[_0x108c('0x2c')](respondWithResult(_0x2a7b9e,0xc9))['catch'](handleError(_0x2a7b9e,null));};exports['update']=function(_0x59f514,_0x28e62b){if(_0x59f514[_0x108c('0x52')]['id']){delete _0x59f514['body']['id'];}return db[_0x108c('0x32')][_0x108c('0x50')]({'where':{'id':_0x59f514[_0x108c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x28e62b,null))[_0x108c('0x2c')](saveUpdates(_0x59f514['body'],null))[_0x108c('0x2c')](respondWithResult(_0x28e62b,null))['catch'](handleError(_0x28e62b,null));};exports[_0x108c('0x53')]=function(_0x5534c0,_0x579c76){return db[_0x108c('0x32')][_0x108c('0x53')]()[_0x108c('0x2c')](respondWithResult(_0x579c76,null))[_0x108c('0x4b')](handleError(_0x579c76,null));};exports['download']=function(_0x5a2cd6,_0x365fd8,_0x2b4db6){var _0x10b02e=require(_0x108c('0x54'));var _0xd48fa5=![];var _0x150e1d={};if(_0x5a2cd6[_0x108c('0x38')]['type']&&_0x5a2cd6[_0x108c('0x38')]['type']===_0x108c('0x55')){_0x150e1d[_0x108c('0x55')]=_0x5a2cd6[_0x108c('0x4d')]['id'];}else{_0x150e1d['id']=_0x5a2cd6[_0x108c('0x4d')]['id'];}return db[_0x108c('0x32')][_0x108c('0x50')]({'where':_0x150e1d,'attributes':['id','value'],'raw':!![]})[_0x108c('0x2c')](handleEntityNotFound(_0x365fd8,null))[_0x108c('0x2c')](function(_0x1e73bf){if(_0x1e73bf){var _0x41fc1b=_0x1e73bf[_0x108c('0x56')];var _0x434b3e=util[_0x108c('0x37')](_0x108c('0x57'),_0x41fc1b);if(fs['existsSync'](_0x434b3e)){_0xd48fa5=!![];return _0x10b02e[_0x108c('0x58')](_0x434b3e,_0x41fc1b,config[_0x108c('0x59')][_0x108c('0x5a')])[_0x108c('0x2c')](function(){return _0x1e73bf;});}return _0x1e73bf;}})[_0x108c('0x2c')](function(_0xddba5f){if(_0xddba5f){var _0x386086=_0xddba5f[_0x108c('0x56')];if(!fs['existsSync'](_0x386086)){throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x5d'));}if(_0xddba5f[_0x108c('0x5e')]){return _0x365fd8[_0x108c('0x5f')](_0x386086,_0xddba5f[_0x108c('0x5e')]+path[_0x108c('0x60')](_0x386086),function(){if(_0xd48fa5){fs[_0x108c('0x61')](_0x386086);}});}else{return _0x365fd8['download'](_0x386086,function(_0x444841){if(_0xd48fa5){fs[_0x108c('0x61')](_0x386086);}});}}})['catch'](function(_0x42d27b){if(_0x42d27b['message']===_0x108c('0x5d')){_0x365fd8[_0x108c('0x22')](0x194)[_0x108c('0x2f')](_0x108c('0x62'));}else{return handleError(_0x365fd8,null);}});};exports[_0x108c('0x63')]=function(_0x223e8d,_0xe46000,_0xc23fdb){var _0x89be00=require(_0x108c('0x54'));var _0x3dbcd2=![];var _0x3ab466={'$and':[db[_0x108c('0x64')][_0x108c('0x43')](db[_0x108c('0x64')]['fn']('MD5',db[_0x108c('0x64')][_0x108c('0x65')](_0x108c('0x55'))),_0x223e8d[_0x108c('0x38')][_0x108c('0x66')])]};if(_0x223e8d[_0x108c('0x38')]['type']&&_0x223e8d[_0x108c('0x38')][_0x108c('0x33')]===_0x108c('0x55')){_0x3ab466[_0x108c('0x67')][_0x108c('0x68')]({'uniqueid':_0x223e8d[_0x108c('0x4d')]['id']});}else{_0x3ab466['$and'][_0x108c('0x68')]({'id':_0x223e8d[_0x108c('0x4d')]['id']});}return db['VoiceRecording']['find']({'where':_0x3ab466,'attributes':['id',_0x108c('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0xe46000,null))[_0x108c('0x2c')](function(_0x2f101d){if(_0x2f101d){var _0x81919f=util[_0x108c('0x37')](_0x108c('0x57'),_0x2f101d[_0x108c('0x56')]);if(fs[_0x108c('0x69')](_0x81919f)){_0x3dbcd2=!![];return _0x89be00[_0x108c('0x58')](_0x81919f,_0x2f101d['value'],config[_0x108c('0x59')][_0x108c('0x5a')])['then'](function(){return _0x2f101d;});}return _0x2f101d;}})['then'](function(_0x52d88e){if(_0x52d88e){if(!fs[_0x108c('0x69')](_0x52d88e[_0x108c('0x56')])){throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x5d'));}if(_0x52d88e['filename']){return _0xe46000['download'](_0x52d88e[_0x108c('0x56')],_0x52d88e[_0x108c('0x5e')]+path[_0x108c('0x60')](_0x52d88e[_0x108c('0x56')]),function(){if(_0x3dbcd2){fs[_0x108c('0x61')](_0x52d88e[_0x108c('0x56')]);}});}else{return _0xe46000[_0x108c('0x5f')](_0x52d88e[_0x108c('0x56')],function(_0x31a8eb){if(_0x3dbcd2){fs[_0x108c('0x61')](_0x52d88e[_0x108c('0x56')]);}});}}})[_0x108c('0x4b')](handleError(_0xe46000,null));};exports['destroy']=function(_0x2836b5,_0x3ca49b){return db[_0x108c('0x32')][_0x108c('0x50')]({'where':{'id':_0x2836b5[_0x108c('0x4d')]['id']}})[_0x108c('0x2c')](function(_0x12d0f7){if(_[_0x108c('0x6a')](_0x12d0f7)){throw new ReferenceError(_0x108c('0x6b'));}return _0x12d0f7;})[_0x108c('0x2c')](function(_0x562534){var _0x1f55c6=_0x562534[_0x108c('0x56')];logger[_0x108c('0x6c')](_0x108c('0x6d'),_0x1f55c6);if(!_['isNil'](_0x562534[_0x108c('0x56')])&&fs[_0x108c('0x69')](_0x1f55c6)){logger[_0x108c('0x6c')]('File:\x20\x22'+_0x1f55c6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1f55c6);}_0x1f55c6=_0x1f55c6+_0x108c('0x6e');if(!_[_0x108c('0x6a')](_0x562534[_0x108c('0x56')])&&fs[_0x108c('0x69')](_0x1f55c6)){logger[_0x108c('0x6c')]('File:\x20\x22'+_0x1f55c6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x1f55c6);}return _0x562534;})['then'](function(_0x5b496a){if(!_0x5b496a)throw new InternalError();return _0x5b496a[_0x108c('0x2d')]();})['then'](function(){_0x3ca49b[_0x108c('0x22')](0xcc)[_0x108c('0x23')]();})[_0x108c('0x4b')](handleError(_0x3ca49b,null));};function getBucketslist(_0x446317,_0x1f0063,_0x5303e7){return new Promise(function(_0x4ae1b7,_0x46fd57){var _0x842fca=new AWS['S3']({'accessKeyId':_0x1f0063,'secretAccessKey':_0x446317,'region':_0x5303e7});_0x842fca[_0x108c('0x6f')]({},function(_0x3e66ca,_0x55c3c0){if(_0x3e66ca){return _0x46fd57(_0x3e66ca);}else{return _0x4ae1b7(_0x55c3c0);}});});}function createBucket(_0x5d8d2,_0x1e5f19,_0x32856e,_0x3a864e){return new Promise(function(_0x36bd0e,_0x2f4291){var _0x343e93=new AWS['S3']({'accessKeyId':_0x1e5f19,'secretAccessKey':_0x5d8d2,'region':_0x32856e});_0x343e93[_0x108c('0x70')]({'Bucket':_0x3a864e},function(_0x300ddb,_0x31b265){if(_0x300ddb){return _0x2f4291(_0x300ddb);}else{return _0x36bd0e(_0x31b265);}});});}function uploadFile(_0x4c821b,_0x5a540a,_0x2664e2,_0x3a8c15,_0x34de7b,_0x165c37){return new Promise(function(_0x52ea2d,_0x10174f){var _0x3b7849=new AWS['S3']({'accessKeyId':_0x5a540a,'secretAccessKey':_0x4c821b,'region':_0x2664e2});_0x3b7849[_0x108c('0x71')]({'Bucket':_0x3a8c15,'Key':_0x34de7b,'Body':_0x165c37},function(_0x1af29a,_0x5bf790){if(_0x1af29a){return _0x10174f(_0x1af29a);}else{return _0x52ea2d(_0x5bf790);}});});}function startTranscribe(_0x368587,_0x5aa4bf,_0x532def,_0x35f962,_0x398940,_0x244d1d){return new Promise(function(_0x208819,_0x31e044){var _0x32bc22=new AWS[(_0x108c('0x72'))]({'accessKeyId':_0x5aa4bf,'secretAccessKey':_0x368587,'region':_0x532def});_0x32bc22[_0x108c('0x73')]({'TranscriptionJobName':_0x35f962,'LanguageCode':_0x398940,'Media':{'MediaFileUri':_0x244d1d}},function(_0x4e5c82,_0x5309c9){if(_0x4e5c82){return _0x31e044(_0x4e5c82);}else{return _0x208819(_0x5309c9);}});});}function transcribe(_0x38873e,_0x4ab0c7,_0x4c453c,_0x4b7aea,_0x5889a8,_0x1fb204,_0x5b59fa){return new Promise(function(_0x4e3d5c,_0xe3fe07){var _0x2999b0={};logger['info'](util[_0x108c('0x37')](_0x108c('0x74'),_0x38873e,_0x5889a8));return uploadFile(_0x4ab0c7,_0x4c453c,_0x4b7aea,_0x5889a8,path['basename'](_0x1fb204),fs[_0x108c('0x75')](_0x1fb204))[_0x108c('0x2c')](function(_0x2781a8){logger[_0x108c('0x6c')](util[_0x108c('0x37')](_0x108c('0x76'),_0x38873e,_0x5889a8,_0x2781a8[_0x108c('0x77')]));_0x2999b0[_0x108c('0x78')]=_0x2781a8[_0x108c('0x79')];_0x2999b0[_0x108c('0x7a')]=_0x2781a8[_0x108c('0x77')];logger[_0x108c('0x6c')](util['format'](_0x108c('0x7b'),_0x38873e));return startTranscribe(_0x4ab0c7,_0x4c453c,_0x4b7aea,uuidv4(),_0x5b59fa,_0x2781a8[_0x108c('0x77')]);})[_0x108c('0x2c')](function(_0x53ab75){logger[_0x108c('0x6c')](util[_0x108c('0x37')](_0x108c('0x7c'),_0x38873e,_0x53ab75[_0x108c('0x7d')][_0x108c('0x7e')]));_0x2999b0['transcribeName']=_0x53ab75['TranscriptionJob'][_0x108c('0x7e')];_0x2999b0[_0x108c('0x7f')]=_0x53ab75[_0x108c('0x7d')][_0x108c('0x80')];return _0x4e3d5c(_0x2999b0);})[_0x108c('0x4b')](function(_0x5bb2b6){return _0xe3fe07(_0x5bb2b6);});});}exports[_0x108c('0x81')]=function(_0x164a3d,_0x362904,_0x5ca22d){var _0x1baf09;var _0x1ffd38;var _0x561a5a;var _0x3e33ba=require(_0x108c('0x54'));return db[_0x108c('0x32')][_0x108c('0x82')]({'where':{'id':_0x164a3d['params']['id']}})['then'](function(_0x284f67){if(_0x284f67){var _0x21fbcd=util[_0x108c('0x37')](_0x108c('0x57'),_0x284f67[_0x108c('0x56')]);if(fs['existsSync'](_0x21fbcd)){cypher=!![];return _0x3e33ba['decryptFile'](_0x21fbcd,_0x284f67[_0x108c('0x56')],config[_0x108c('0x59')][_0x108c('0x5a')])[_0x108c('0x2c')](function(){return _0x284f67;});}return _0x284f67;}})[_0x108c('0x2c')](function(_0x3b390b){if(!_0x3b390b){throw new db[(_0x108c('0x5b'))]['ValidationError'](_0x108c('0x83'));}_0x1ffd38=_0x3b390b;return db[_0x108c('0x84')]['findOne']({'where':{'id':0x1}});})[_0x108c('0x2c')](handleEntityNotFound(_0x362904,null))[_0x108c('0x2c')](function(_0x52e349){if(_0x52e349){_0x1baf09=_0x52e349;if(!_0x1baf09[_0x108c('0x85')]||!_0x1baf09['transcribeAccountId']||!_0x1baf09['transcribeRegion']||!_0x1baf09['language']||!_0x1baf09[_0x108c('0x78')]){throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x86'));}if(_0x164a3d[_0x108c('0x52')][_0x108c('0x87')]&&(!_0x1baf09[_0x108c('0x88')]||!_0x1baf09[_0x108c('0x89')]||!_0x1baf09[_0x108c('0x8a')]||!_0x1baf09[_0x108c('0x8b')]||!_0x1baf09[_0x108c('0x78')])){throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x8c'));}return db[_0x108c('0x8d')][_0x108c('0x82')]({'where':{'id':_0x1baf09[_0x108c('0x8e')]}});}})['then'](function(_0x5763a7){if(!_0x5763a7){throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x8f'));}if(!_0x5763a7[_0x108c('0x90')]||!_0x5763a7[_0x108c('0x91')]){throw new db['Sequelize'][(_0x108c('0x5c'))]('Cloud\x20Provider\x20not\x20configured');}_0x561a5a=_0x5763a7;return getBucketslist(_0x561a5a[_0x108c('0x90')],_0x561a5a['data2'],_0x1baf09[_0x108c('0x92')]);})[_0x108c('0x2c')](function(_0x784d8e){if(_0x784d8e&&_0x784d8e['Buckets']){var _0x1d8c1e=_[_0x108c('0x50')](_0x784d8e[_0x108c('0x93')],function(_0x23717f){return _0x23717f['Name']===_0x1baf09[_0x108c('0x78')];});if(!_0x1d8c1e){logger[_0x108c('0x6c')](util[_0x108c('0x37')](_0x108c('0x94'),_0x164a3d['params']['id'],_0x1baf09[_0x108c('0x78')]));return createBucket(_0x561a5a[_0x108c('0x90')],_0x561a5a['data2'],_0x1baf09[_0x108c('0x92')],_0x1baf09['bucket']);}logger[_0x108c('0x6c')](util[_0x108c('0x37')](_0x108c('0x95'),_0x164a3d['params']['id'],_0x1baf09[_0x108c('0x78')]));return;}})['then'](function(_0x48fdc0){if(_0x1ffd38[_0x108c('0x7f')]===_0x108c('0x96')){return transcribe(_0x164a3d[_0x108c('0x4d')]['id'],_0x561a5a['data1'],_0x561a5a['data2'],_0x1baf09[_0x108c('0x92')],_0x1baf09['bucket'],_0x1ffd38['value'],_0x1baf09[_0x108c('0x8b')]);}else{logger[_0x108c('0x6c')](util[_0x108c('0x37')](_0x108c('0x97'),_0x164a3d[_0x108c('0x4d')]['id']));return{'transcribeStatus':_0x108c('0x98')};}})['then'](function(_0xd1778d){if(_0xd1778d){_0xd1778d[_0x108c('0x99')]=_0x164a3d[_0x108c('0x52')][_0x108c('0x87')];return _0x1ffd38['updateAttributes'](_0xd1778d);}})[_0x108c('0x2c')](respondWithResult(_0x362904,null))['catch'](handleError(_0x362904,null));};function writeFile(_0x485da5,_0x3ebc45){return new Promise(function(_0xd75564,_0x44facd){fs[_0x108c('0x9a')](_0x3ebc45,_0x485da5,function(_0x4c992f,_0x1f13fb){if(_0x4c992f){return _0x44facd(_0x4c992f);}else{return _0xd75564(_0x1f13fb);}});});}exports[_0x108c('0x9b')]=function(_0x32ed59,_0x23c775,_0x46267f){return db[_0x108c('0x32')][_0x108c('0x82')]({'where':{'id':_0x32ed59[_0x108c('0x4d')]['id']}})[_0x108c('0x2c')](handleEntityNotFound(_0x23c775))[_0x108c('0x2c')](function(_0x230091){if(_0x230091&&_0x230091[_0x108c('0x9c')]){var _0x2a8ce0=_0x230091[_0x108c('0x9c')];var _0x2ccf46=config['root']+_0x108c('0x9d')+_0x230091['id']+_0x108c('0x9e');if(fs[_0x108c('0x69')](_0x2ccf46)){return _0x2ccf46;}return writeFile(_0x2a8ce0,_0x2ccf46)[_0x108c('0x2c')](function(){return _0x2ccf46;});}else{throw new db[(_0x108c('0x5b'))][(_0x108c('0x5c'))](_0x108c('0x9f'));}})['then'](function(_0x353bdd){return _0x23c775[_0x108c('0x5f')](_0x353bdd);})[_0x108c('0x4b')](handleError(_0x23c775));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 2ba595a..e48e8e0 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 _0x702d=['voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define'];(function(_0x452b6e,_0x41ebb7){var _0x3661d4=function(_0x51a7a1){while(--_0x51a7a1){_0x452b6e['push'](_0x452b6e['shift']());}};_0x3661d4(++_0x41ebb7);}(_0x702d,0x147));var _0xd702=function(_0x8d614a,_0x42b849){_0x8d614a=_0x8d614a-0x0;var _0x5b37a3=_0x702d[_0x8d614a];return _0x5b37a3;};'use strict';var attributes=require(_0xd702('0x0'));module[_0xd702('0x1')]=function(_0x37c2c5,_0x33e7c5){return _0x37c2c5[_0xd702('0x2')]('VoiceRecording',attributes,{'tableName':_0xd702('0x3'),'paranoid':![],'indexes':[{'name':_0xd702('0x4'),'fields':[_0xd702('0x4')]},{'name':_0xd702('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0xea70=['transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings','uniqueid'];(function(_0x25e545,_0x4939a4){var _0x4c19b5=function(_0x441b83){while(--_0x441b83){_0x25e545['push'](_0x25e545['shift']());}};_0x4c19b5(++_0x4939a4);}(_0xea70,0x175));var _0x0ea7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea70[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0x0ea7('0x0'));module[_0x0ea7('0x1')]=function(_0x43f027,_0x5443ee){return _0x43f027[_0x0ea7('0x2')]('VoiceRecording',attributes,{'tableName':_0x0ea7('0x3'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0ea7('0x4')]},{'name':_0x0ea7('0x5'),'fields':[_0x0ea7('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 4a8473a..f94bc1e 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 _0x6d11=['message','catch','VoiceRecording','update','options','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5c8736,_0x2a2a03){var _0x142bdb=function(_0x406951){while(--_0x406951){_0x5c8736['push'](_0x5c8736['shift']());}};_0x142bdb(++_0x2a2a03);}(_0x6d11,0xbf));var _0x16d1=function(_0x5e5cd0,_0x540c4c){_0x5e5cd0=_0x5e5cd0-0x0;var _0x418a62=_0x6d11[_0x5e5cd0];return _0x418a62;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1009dc,_0x150217,_0x19390d){return new BPromise(function(_0x5d0e3f,_0x58a7a2){return client['request'](_0x1009dc,_0x19390d)[_0x16d1('0xa')](function(_0xcfbb15){logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,'request\x20sent');logger[_0x16d1('0xd')](_0x16d1('0xe'),_0x150217,_0x16d1('0xf'),JSON[_0x16d1('0x10')](_0xcfbb15));if(_0xcfbb15[_0x16d1('0x11')]){if(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x12')]===0x1f4){logger[_0x16d1('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x58a7a2(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}logger[_0x16d1('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x5d0e3f(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}else{logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,_0x16d1('0xf'));_0x5d0e3f(_0xcfbb15['result'][_0x16d1('0x13')]);}})[_0x16d1('0x14')](function(_0x555b2d){logger['error'](_0x16d1('0xc'),_0x150217,_0x555b2d);_0x58a7a2(_0x555b2d);});});}exports['UpdateVoiceRecording']=function(_0x46a25e){var _0x4aeff0=this;return new Promise(function(_0x1da1b8,_0x4fe22d){return db[_0x16d1('0x15')][_0x16d1('0x16')](_0x46a25e['body'],{'raw':_0x46a25e['options']?_0x46a25e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a25e[_0x16d1('0x17')]?_0x46a25e['options'][_0x16d1('0x18')]||null:null,'attributes':_0x46a25e[_0x16d1('0x17')]?_0x46a25e[_0x16d1('0x17')][_0x16d1('0x19')]||null:null,'limit':_0x46a25e['options']?_0x46a25e[_0x16d1('0x17')][_0x16d1('0x1a')]||null:null})[_0x16d1('0xa')](function(_0x585ce5){logger[_0x16d1('0xb')](_0x16d1('0x1b'),_0x46a25e);logger[_0x16d1('0xd')](_0x16d1('0x1b'),_0x46a25e,JSON[_0x16d1('0x10')](_0x585ce5));_0x1da1b8(_0x585ce5);})[_0x16d1('0x14')](function(_0x32f362){logger[_0x16d1('0x11')](_0x16d1('0x1b'),_0x32f362[_0x16d1('0x13')],_0x46a25e);_0x4fe22d(_0x4aeff0[_0x16d1('0x11')](0x1f4,_0x32f362[_0x16d1('0x13')]));});});};exports[_0x16d1('0x1c')]=function(_0x262f89){var _0x346b69=this;return new Promise(function(_0x2b8403,_0x491f65){var _0x25ae4e=require(_0x16d1('0x1d'));var _0x4257f1;return db['Setting'][_0x16d1('0x1e')]({'attributes':['id',_0x16d1('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x16d1('0xa')](function(_0x22e5b3){_0x4257f1=_0x22e5b3;return db[_0x16d1('0x15')][_0x16d1('0x20')](_0x262f89[_0x16d1('0x21')]);})['then'](function(_0x3dd104){if(_0x4257f1[_0x16d1('0x1f')]&&fs[_0x16d1('0x22')](_0x3dd104[_0x16d1('0x23')])){var _0x55c021=util['format'](_0x16d1('0x24'),_0x3dd104[_0x16d1('0x23')]);return _0x25ae4e[_0x16d1('0x25')](_0x3dd104[_0x16d1('0x23')],_0x55c021,config[_0x16d1('0x26')][_0x16d1('0x27')])[_0x16d1('0xa')](function(){fs[_0x16d1('0x28')](_0x3dd104[_0x16d1('0x23')]);logger[_0x16d1('0xb')](_0x16d1('0x29'));return _0x3dd104;});}return _0x3dd104;})[_0x16d1('0xa')](function(_0x188cf4){logger[_0x16d1('0xb')]('CreateVoiceRecording',_0x262f89);logger[_0x16d1('0xd')]('CreateVoiceRecording',_0x262f89,JSON[_0x16d1('0x10')](_0x188cf4));_0x2b8403(_0x188cf4);})[_0x16d1('0x14')](function(_0x2b9126){logger[_0x16d1('0x11')](_0x16d1('0x1c'),_0x2b9126[_0x16d1('0x13')],_0x262f89);_0x491f65(_0x346b69['error'](0x1f4,_0x2b9126['message']));});});}; \ No newline at end of file +var _0x4325=['attributes','CreateVoiceRecording','Setting','findOne','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where'];(function(_0x277a8d,_0x8f4900){var _0x3e1793=function(_0x5e8f41){while(--_0x5e8f41){_0x277a8d['push'](_0x277a8d['shift']());}};_0x3e1793(++_0x8f4900);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')](_0x32fe60[_0x5432('0x1a')],{'raw':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fe60['options']?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1d')]||null:null,'attributes':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1e')]||null:null,'limit':_0x32fe60['options']?_0x32fe60['options']['limit']||null:null})[_0x5432('0xb')](function(_0xb900f2){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger['debug']('UpdateVoiceRecording',_0x32fe60,JSON[_0x5432('0x10')](_0xb900f2));_0x5f011f(_0xb900f2);})[_0x5432('0x16')](function(_0x4a40fc){logger[_0x5432('0x12')](_0x5432('0x17'),_0x4a40fc[_0x5432('0x13')],_0x32fe60);_0x3f3873(_0x4221a8['error'](0x1f4,_0x4a40fc[_0x5432('0x13')]));});});};exports[_0x5432('0x1f')]=function(_0xe7eda2){var _0x520da1=this;return new Promise(function(_0x4ab09d,_0x1f2055){var _0x2114b8=require('../../components/encryptor');var _0x1abe73;return db[_0x5432('0x20')][_0x5432('0x21')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5432('0xb')](function(_0x5be867){_0x1abe73=_0x5be867;return db['VoiceRecording'][_0x5432('0x22')](_0xe7eda2['body']);})[_0x5432('0xb')](function(_0x578281){if(_0x1abe73['callRecordingEncryption']&&fs[_0x5432('0x23')](_0x578281[_0x5432('0x24')])){var _0x345b51=util['format'](_0x5432('0x25'),_0x578281[_0x5432('0x24')]);return _0x2114b8[_0x5432('0x26')](_0x578281[_0x5432('0x24')],_0x345b51,config[_0x5432('0x27')][_0x5432('0x28')])[_0x5432('0xb')](function(){fs[_0x5432('0x29')](_0x578281[_0x5432('0x24')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x578281;});}return _0x578281;})[_0x5432('0xb')](function(_0x42ab1e){logger[_0x5432('0x14')](_0x5432('0x1f'),_0xe7eda2);logger[_0x5432('0xd')]('CreateVoiceRecording',_0xe7eda2,JSON[_0x5432('0x10')](_0x42ab1e));_0x4ab09d(_0x42ab1e);})['catch'](function(_0x2955e0){logger[_0x5432('0x12')](_0x5432('0x1f'),_0x2955e0[_0x5432('0x13')],_0xe7eda2);_0x1f2055(_0x520da1[_0x5432('0x12')](0x1f4,_0x2955e0[_0x5432('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index d22f8d0..c25c7f1 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 _0x128f=['fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x36b322,_0x1e465e){var _0xb2fbe4=function(_0x3f6002){while(--_0x3f6002){_0x36b322['push'](_0x36b322['shift']());}};_0xb2fbe4(++_0x1e465e);}(_0x128f,0x6d));var _0xf128=function(_0x5e4c60,_0x27fb14){_0x5e4c60=_0x5e4c60-0x0;var _0x50e15e=_0x128f[_0x5e4c60];return _0x50e15e;};'use strict';var multer=require(_0xf128('0x0'));var util=require(_0xf128('0x1'));var path=require(_0xf128('0x2'));var timeout=require(_0xf128('0x3'));var express=require(_0xf128('0x4'));var router=express[_0xf128('0x5')]();var fs_extra=require(_0xf128('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf128('0x7'));var config=require(_0xf128('0x8'));var controller=require(_0xf128('0x9'));router[_0xf128('0xa')]('/',auth[_0xf128('0xb')](),controller[_0xf128('0xc')]);router['get'](_0xf128('0xd'),auth[_0xf128('0xb')](),controller[_0xf128('0xe')]);router[_0xf128('0xa')](_0xf128('0xf'),auth['isAuthenticated'](),controller[_0xf128('0x10')]);router[_0xf128('0x11')]('/',auth[_0xf128('0xb')](),controller[_0xf128('0x12')]);router[_0xf128('0x13')]('/:id',auth[_0xf128('0xb')](),controller['update']);router[_0xf128('0x14')](_0xf128('0xf'),auth['isAuthenticated'](),controller[_0xf128('0x15')]);module[_0xf128('0x16')]=router; \ No newline at end of file +var _0x4d79=['/describe','describe','/:id','post','create','put','update','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index'];(function(_0x2d3f62,_0x28eeac){var _0x1fdf6c=function(_0x4e5aab){while(--_0x4e5aab){_0x2d3f62['push'](_0x2d3f62['shift']());}};_0x1fdf6c(++_0x28eeac);}(_0x4d79,0x8e));var _0x94d7=function(_0x113afc,_0x2c7d5a){_0x113afc=_0x113afc-0x0;var _0x3a9219=_0x4d79[_0x113afc];return _0x3a9219;};'use strict';var multer=require('multer');var util=require(_0x94d7('0x0'));var path=require('path');var timeout=require(_0x94d7('0x1'));var express=require('express');var router=express[_0x94d7('0x2')]();var fs_extra=require(_0x94d7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x94d7('0x4'));var config=require(_0x94d7('0x5'));var controller=require(_0x94d7('0x6'));router[_0x94d7('0x7')]('/',auth[_0x94d7('0x8')](),controller[_0x94d7('0x9')]);router[_0x94d7('0x7')](_0x94d7('0xa'),auth[_0x94d7('0x8')](),controller[_0x94d7('0xb')]);router[_0x94d7('0x7')](_0x94d7('0xc'),auth[_0x94d7('0x8')](),controller['show']);router[_0x94d7('0xd')]('/',auth[_0x94d7('0x8')](),controller[_0x94d7('0xe')]);router[_0x94d7('0xf')]('/:id',auth[_0x94d7('0x8')](),controller[_0x94d7('0x10')]);router['delete'](_0x94d7('0xc'),auth[_0x94d7('0x8')](),controller[_0x94d7('0x11')]);module[_0x94d7('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 5147cea..532c807 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 _0xe64d=['attended','STRING','Yes','moment','exports','ENUM','blind'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe64d,0x1ca));var _0xde64=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0xe64d[_0x8ba19a];return _0x2bd8b4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xde64('0x0'));module[_0xde64('0x1')]={'type':{'type':Sequelize[_0xde64('0x2')](_0xde64('0x3'),_0xde64('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xde64('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xde64('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xde64('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xde64('0x5')]},'transferercontext':{'type':Sequelize[_0xde64('0x5')]},'transfererexten':{'type':Sequelize[_0xde64('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xde64('0x5')]},'transfereechannel':{'type':Sequelize[_0xde64('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xde64('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xde64('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xde64('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xde64('0x5')]},'isexternal':{'type':Sequelize[_0xde64('0x2')](_0xde64('0x6'),'No')},'context':{'type':Sequelize[_0xde64('0x5')]},'extension':{'type':Sequelize[_0xde64('0x5')]}}; \ No newline at end of file +var _0xf04b=['blind','STRING','Yes','sequelize','moment','exports','ENUM'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0xf04b,0x168));var _0xbf04=function(_0x377f43,_0x5acb1a){_0x377f43=_0x377f43-0x0;var _0xa7a1f=_0xf04b[_0x377f43];return _0xa7a1f;};'use strict';var Sequelize=require(_0xbf04('0x0'));var moment=require(_0xbf04('0x1'));module[_0xbf04('0x2')]={'type':{'type':Sequelize[_0xbf04('0x3')](_0xbf04('0x4'),'attended')},'result':{'type':Sequelize[_0xbf04('0x5')]},'transfererchannel':{'type':Sequelize[_0xbf04('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xbf04('0x5')]},'transferercalleridname':{'type':Sequelize[_0xbf04('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xbf04('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xbf04('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xbf04('0x5')]},'transferercontext':{'type':Sequelize[_0xbf04('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xbf04('0x5')]},'transfereechannel':{'type':Sequelize[_0xbf04('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xbf04('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xbf04('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xbf04('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xbf04('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xbf04('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xbf04('0x6'),'No')},'context':{'type':Sequelize[_0xbf04('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 6942173..4510496 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 _0x396b=['catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','sendStatus','end','status','json','limit','undefined','count','offset','set','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows'];(function(_0x1b1fc9,_0x44cee2){var _0x45fc63=function(_0x42c82f){while(--_0x42c82f){_0x1b1fc9['push'](_0x1b1fc9['shift']());}};_0x45fc63(++_0x44cee2);}(_0x396b,0x19a));var _0xb396=function(_0x439b29,_0x21f296){_0x439b29=_0x439b29-0x0;var _0xf1bdd4=_0x396b[_0x439b29];return _0xf1bdd4;};'use strict';var emlformat=require(_0xb396('0x0'));var rimraf=require(_0xb396('0x1'));var zipdir=require(_0xb396('0x2'));var jsonpatch=require(_0xb396('0x3'));var rp=require('request-promise');var moment=require(_0xb396('0x4'));var BPromise=require(_0xb396('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb396('0x6'));var sox=require('sox');var csv=require(_0xb396('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb396('0x8'));var _=require('lodash');var squel=require(_0xb396('0x9'));var crypto=require('crypto');var jsforce=require(_0xb396('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xb396('0x7'));var querystring=require(_0xb396('0xb'));var Papa=require(_0xb396('0xc'));var Redis=require(_0xb396('0xd'));var authService=require(_0xb396('0xe'));var qs=require(_0xb396('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb396('0x10'));var utils=require(_0xb396('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x354205,_0x5100bd){_0x5100bd=_0x5100bd||0xcc;return function(_0x2e7061){if(_0x2e7061){return _0x354205[_0xb396('0x12')](_0x5100bd);}return _0x354205['status'](_0x5100bd)[_0xb396('0x13')]();};}function respondWithResult(_0x2cad36,_0x456b23){_0x456b23=_0x456b23||0xc8;return function(_0x4e20a3){if(_0x4e20a3){return _0x2cad36[_0xb396('0x14')](_0x456b23)[_0xb396('0x15')](_0x4e20a3);}};}function respondWithFilteredResult(_0x4b37a1,_0x1c2a70){return function(_0x3ee47d){if(_0x3ee47d){var _0x5aa767=typeof _0x1c2a70['offset']==='undefined'&&typeof _0x1c2a70[_0xb396('0x16')]===_0xb396('0x17');var _0x249522=_0x3ee47d[_0xb396('0x18')];var _0x545b98=_0x5aa767?0x0:_0x1c2a70[_0xb396('0x19')];var _0x1b674a=_0x5aa767?_0x3ee47d[_0xb396('0x18')]:_0x1c2a70[_0xb396('0x19')]+_0x1c2a70[_0xb396('0x16')];var _0xef5ce;if(_0x1b674a>=_0x249522){_0x1b674a=_0x249522;_0xef5ce=0xc8;}else{_0xef5ce=0xce;}_0x4b37a1[_0xb396('0x14')](_0xef5ce);return _0x4b37a1[_0xb396('0x1a')]('Content-Range',_0x545b98+'-'+_0x1b674a+'/'+_0x249522)[_0xb396('0x15')](_0x3ee47d);}return null;};}function patchUpdates(_0x478a84){return function(_0x31ce81){try{jsonpatch['apply'](_0x31ce81,_0x478a84,!![]);}catch(_0x49a84a){return BPromise['reject'](_0x49a84a);}return _0x31ce81['save']();};}function saveUpdates(_0x242a0f,_0x1bb27f){return function(_0x3f2b3e){if(_0x3f2b3e){return _0x3f2b3e[_0xb396('0x1b')](_0x242a0f)[_0xb396('0x1c')](function(_0x14af5c){return _0x14af5c;});}return null;};}function removeEntity(_0x216fc1,_0x31d002){return function(_0x2878b0){if(_0x2878b0){return _0x2878b0[_0xb396('0x1d')]()[_0xb396('0x1c')](function(){_0x216fc1['status'](0xcc)[_0xb396('0x13')]();});}};}function handleEntityNotFound(_0x1ba51a,_0x25b4e7){return function(_0x1ffa0a){if(!_0x1ffa0a){_0x1ba51a[_0xb396('0x12')](0x194);}return _0x1ffa0a;};}function handleError(_0x5c1581,_0x237bd9){_0x237bd9=_0x237bd9||0x1f4;return function(_0x29c35a){logger[_0xb396('0x1e')](_0x29c35a[_0xb396('0x1f')]);if(_0x29c35a[_0xb396('0x20')]){delete _0x29c35a['name'];}_0x5c1581[_0xb396('0x14')](_0x237bd9)[_0xb396('0x21')](_0x29c35a);};}exports[_0xb396('0x22')]=function(_0x17b949,_0x275086){var _0x4a0007={},_0x317d73={},_0x4bae76={'count':0x0,'rows':[]};var _0x144f4f=_['map'](db[_0xb396('0x23')]['rawAttributes'],function(_0x3e82c3){return{'name':_0x3e82c3[_0xb396('0x24')],'type':_0x3e82c3[_0xb396('0x25')][_0xb396('0x26')]};});_0x317d73[_0xb396('0x27')]=_[_0xb396('0x28')](_0x144f4f,'name');_0x317d73[_0xb396('0x29')]=_[_0xb396('0x2a')](_0x17b949[_0xb396('0x29')]);_0x317d73[_0xb396('0x2b')]=_[_0xb396('0x2c')](_0x317d73['model'],_0x317d73[_0xb396('0x29')]);_0x4a0007[_0xb396('0x2d')]=_['intersection'](_0x317d73['model'],qs[_0xb396('0x2e')](_0x17b949[_0xb396('0x29')]['fields']));_0x4a0007[_0xb396('0x2d')]=_0x4a0007[_0xb396('0x2d')]['length']?_0x4a0007['attributes']:_0x317d73['model'];if(!_0x17b949[_0xb396('0x29')][_0xb396('0x2f')](_0xb396('0x30'))){_0x4a0007[_0xb396('0x16')]=qs[_0xb396('0x16')](_0x17b949['query'][_0xb396('0x16')]);_0x4a0007['offset']=qs[_0xb396('0x19')](_0x17b949[_0xb396('0x29')][_0xb396('0x19')]);}_0x4a0007[_0xb396('0x31')]=qs[_0xb396('0x32')](_0x17b949['query']['sort']);_0x4a0007[_0xb396('0x33')]=qs[_0xb396('0x2b')](_[_0xb396('0x34')](_0x17b949[_0xb396('0x29')],_0x317d73[_0xb396('0x2b')]),_0x144f4f);if(_0x17b949[_0xb396('0x29')]['filter']){_0x4a0007[_0xb396('0x33')]=_[_0xb396('0x35')](_0x4a0007['where'],{'$or':_['map'](_0x144f4f,function(_0x47640f){if(_0x47640f[_0xb396('0x25')]!=='VIRTUAL'){var _0xaf4d86={};_0xaf4d86[_0x47640f[_0xb396('0x20')]]={'$like':'%'+_0x17b949[_0xb396('0x29')][_0xb396('0x36')]+'%'};return _0xaf4d86;}})});}_0x4a0007=_[_0xb396('0x35')]({},_0x4a0007,_0x17b949[_0xb396('0x37')]);var _0x4bfaf0={'where':_0x4a0007[_0xb396('0x33')]};return db[_0xb396('0x23')][_0xb396('0x18')](_0x4bfaf0)[_0xb396('0x1c')](function(_0x39128b){_0x4bae76['count']=_0x39128b;if(_0x17b949[_0xb396('0x29')]['includeAll']){_0x4a0007[_0xb396('0x38')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xb396('0x39')](_0x4a0007);})[_0xb396('0x1c')](function(_0x1e9b95){_0x4bae76[_0xb396('0x3a')]=_0x1e9b95;return _0x4bae76;})['then'](respondWithFilteredResult(_0x275086,_0x4a0007))[_0xb396('0x3b')](handleError(_0x275086,null));};exports[_0xb396('0x3c')]=function(_0x22553d,_0x19c9de){var _0x5423e2={'raw':!![],'where':{'id':_0x22553d[_0xb396('0x3d')]['id']}},_0x3bc483={};_0x3bc483[_0xb396('0x27')]=_['keys'](db[_0xb396('0x23')]['rawAttributes']);_0x3bc483['query']=_[_0xb396('0x2a')](_0x22553d[_0xb396('0x29')]);_0x3bc483[_0xb396('0x2b')]=_['intersection'](_0x3bc483[_0xb396('0x27')],_0x3bc483['query']);_0x5423e2[_0xb396('0x2d')]=_['intersection'](_0x3bc483[_0xb396('0x27')],qs['fields'](_0x22553d[_0xb396('0x29')][_0xb396('0x2e')]));_0x5423e2[_0xb396('0x2d')]=_0x5423e2[_0xb396('0x2d')]['length']?_0x5423e2[_0xb396('0x2d')]:_0x3bc483[_0xb396('0x27')];if(_0x22553d['query'][_0xb396('0x3e')]){_0x5423e2[_0xb396('0x38')]=[{'all':!![]}];}_0x5423e2=_[_0xb396('0x35')]({},_0x5423e2,_0x22553d['options']);return db[_0xb396('0x23')][_0xb396('0x3f')](_0x5423e2)[_0xb396('0x1c')](handleEntityNotFound(_0x19c9de,null))['then'](respondWithResult(_0x19c9de,null))['catch'](handleError(_0x19c9de,null));};exports[_0xb396('0x40')]=function(_0x52642e,_0x5213a0){return db[_0xb396('0x23')][_0xb396('0x40')](_0x52642e[_0xb396('0x41')],{})['then'](respondWithResult(_0x5213a0,0xc9))[_0xb396('0x3b')](handleError(_0x5213a0,null));};exports['update']=function(_0x5a804a,_0x1fe59e){if(_0x5a804a['body']['id']){delete _0x5a804a['body']['id'];}return db[_0xb396('0x23')][_0xb396('0x3f')]({'where':{'id':_0x5a804a[_0xb396('0x3d')]['id']}})[_0xb396('0x1c')](handleEntityNotFound(_0x1fe59e,null))[_0xb396('0x1c')](saveUpdates(_0x5a804a['body'],null))[_0xb396('0x1c')](respondWithResult(_0x1fe59e,null))['catch'](handleError(_0x1fe59e,null));};exports[_0xb396('0x1d')]=function(_0x23ce9a,_0x50fbf4){return db[_0xb396('0x23')]['find']({'where':{'id':_0x23ce9a[_0xb396('0x3d')]['id']}})[_0xb396('0x1c')](handleEntityNotFound(_0x50fbf4,null))[_0xb396('0x1c')](removeEntity(_0x50fbf4,null))[_0xb396('0x3b')](handleError(_0x50fbf4,null));};exports[_0xb396('0x42')]=function(_0x168cc7,_0x3d56be){return db[_0xb396('0x23')][_0xb396('0x42')]()[_0xb396('0x1c')](respondWithResult(_0x3d56be,null))[_0xb396('0x3b')](handleError(_0x3d56be,null));}; \ No newline at end of file +var _0x5ce8=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','params','keys','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','stack','name','map','VoiceTransferReport','rawAttributes','key','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ce8,0xb0));var _0x85ce=function(_0x3a3701,_0x91e5ce){_0x3a3701=_0x3a3701-0x0;var _0x532cb8=_0x5ce8[_0x3a3701];return _0x532cb8;};'use strict';var emlformat=require(_0x85ce('0x0'));var rimraf=require(_0x85ce('0x1'));var zipdir=require(_0x85ce('0x2'));var jsonpatch=require(_0x85ce('0x3'));var rp=require(_0x85ce('0x4'));var moment=require(_0x85ce('0x5'));var BPromise=require(_0x85ce('0x6'));var Mustache=require(_0x85ce('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x85ce('0x8'));var fs=require('fs');var fs_extra=require(_0x85ce('0x9'));var _=require(_0x85ce('0xa'));var squel=require(_0x85ce('0xb'));var crypto=require(_0x85ce('0xc'));var jsforce=require(_0x85ce('0xd'));var deskjs=require(_0x85ce('0xe'));var toCsv=require(_0x85ce('0xf'));var querystring=require(_0x85ce('0x10'));var Papa=require(_0x85ce('0x11'));var Redis=require(_0x85ce('0x12'));var authService=require(_0x85ce('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85ce('0x14'));var logger=require(_0x85ce('0x15'))(_0x85ce('0x16'));var utils=require(_0x85ce('0x17'));var config=require(_0x85ce('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x85ce('0x19'))['db'];function respondWithStatusCode(_0x3e365b,_0x14cb04){_0x14cb04=_0x14cb04||0xcc;return function(_0x53b32c){if(_0x53b32c){return _0x3e365b['sendStatus'](_0x14cb04);}return _0x3e365b[_0x85ce('0x1a')](_0x14cb04)[_0x85ce('0x1b')]();};}function respondWithResult(_0x1683d4,_0x29cb40){_0x29cb40=_0x29cb40||0xc8;return function(_0x9a9a19){if(_0x9a9a19){return _0x1683d4['status'](_0x29cb40)['json'](_0x9a9a19);}};}function respondWithFilteredResult(_0x35defd,_0x571776){return function(_0x3f2996){if(_0x3f2996){var _0x520992=typeof _0x571776[_0x85ce('0x1c')]===_0x85ce('0x1d')&&typeof _0x571776[_0x85ce('0x1e')]===_0x85ce('0x1d');var _0x2183e9=_0x3f2996[_0x85ce('0x1f')];var _0x7c03a8=_0x520992?0x0:_0x571776[_0x85ce('0x1c')];var _0x191d9d=_0x520992?_0x3f2996[_0x85ce('0x1f')]:_0x571776[_0x85ce('0x1c')]+_0x571776['limit'];var _0x4114d0;if(_0x191d9d>=_0x2183e9){_0x191d9d=_0x2183e9;_0x4114d0=0xc8;}else{_0x4114d0=0xce;}_0x35defd[_0x85ce('0x1a')](_0x4114d0);return _0x35defd[_0x85ce('0x20')](_0x85ce('0x21'),_0x7c03a8+'-'+_0x191d9d+'/'+_0x2183e9)[_0x85ce('0x22')](_0x3f2996);}return null;};}function patchUpdates(_0x53fe0e){return function(_0x280204){try{jsonpatch['apply'](_0x280204,_0x53fe0e,!![]);}catch(_0x48952f){return BPromise[_0x85ce('0x23')](_0x48952f);}return _0x280204[_0x85ce('0x24')]();};}function saveUpdates(_0x2340b3,_0x14db42){return function(_0x1cff2b){if(_0x1cff2b){return _0x1cff2b[_0x85ce('0x25')](_0x2340b3)[_0x85ce('0x26')](function(_0x3846d2){return _0x3846d2;});}return null;};}function removeEntity(_0x2f8c2a,_0x477d80){return function(_0x3dc6ac){if(_0x3dc6ac){return _0x3dc6ac[_0x85ce('0x27')]()[_0x85ce('0x26')](function(){_0x2f8c2a['status'](0xcc)[_0x85ce('0x1b')]();});}};}function handleEntityNotFound(_0x4cbcef,_0x4bb8c7){return function(_0x5c5a10){if(!_0x5c5a10){_0x4cbcef[_0x85ce('0x28')](0x194);}return _0x5c5a10;};}function handleError(_0x2d97a5,_0x4847be){_0x4847be=_0x4847be||0x1f4;return function(_0x4c767d){logger['error'](_0x4c767d[_0x85ce('0x29')]);if(_0x4c767d[_0x85ce('0x2a')]){delete _0x4c767d[_0x85ce('0x2a')];}_0x2d97a5[_0x85ce('0x1a')](_0x4847be)['send'](_0x4c767d);};}exports['index']=function(_0x4d84d1,_0x160acd){var _0x431c9a={},_0x5ecde7={},_0x5a672d={'count':0x0,'rows':[]};var _0x3456ae=_[_0x85ce('0x2b')](db[_0x85ce('0x2c')][_0x85ce('0x2d')],function(_0x2a650b){return{'name':_0x2a650b['fieldName'],'type':_0x2a650b['type'][_0x85ce('0x2e')]};});_0x5ecde7['model']=_[_0x85ce('0x2b')](_0x3456ae,_0x85ce('0x2a'));_0x5ecde7['query']=_['keys'](_0x4d84d1[_0x85ce('0x2f')]);_0x5ecde7[_0x85ce('0x30')]=_[_0x85ce('0x31')](_0x5ecde7['model'],_0x5ecde7[_0x85ce('0x2f')]);_0x431c9a['attributes']=_[_0x85ce('0x31')](_0x5ecde7[_0x85ce('0x32')],qs[_0x85ce('0x33')](_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x33')]));_0x431c9a[_0x85ce('0x34')]=_0x431c9a[_0x85ce('0x34')][_0x85ce('0x35')]?_0x431c9a[_0x85ce('0x34')]:_0x5ecde7[_0x85ce('0x32')];if(!_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x36')](_0x85ce('0x37'))){_0x431c9a['limit']=qs[_0x85ce('0x1e')](_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x1e')]);_0x431c9a['offset']=qs[_0x85ce('0x1c')](_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x1c')]);}_0x431c9a[_0x85ce('0x38')]=qs[_0x85ce('0x39')](_0x4d84d1['query']['sort']);_0x431c9a[_0x85ce('0x3a')]=qs['filters'](_[_0x85ce('0x3b')](_0x4d84d1[_0x85ce('0x2f')],_0x5ecde7[_0x85ce('0x30')]),_0x3456ae);if(_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x3c')]){_0x431c9a[_0x85ce('0x3a')]=_[_0x85ce('0x3d')](_0x431c9a[_0x85ce('0x3a')],{'$or':_['map'](_0x3456ae,function(_0xff79c){if(_0xff79c[_0x85ce('0x3e')]!==_0x85ce('0x3f')){var _0x1778b9={};_0x1778b9[_0xff79c[_0x85ce('0x2a')]]={'$like':'%'+_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x3c')]+'%'};return _0x1778b9;}})});}_0x431c9a=_['merge']({},_0x431c9a,_0x4d84d1['options']);var _0x385a3e={'where':_0x431c9a['where']};return db[_0x85ce('0x2c')][_0x85ce('0x1f')](_0x385a3e)['then'](function(_0x377825){_0x5a672d[_0x85ce('0x1f')]=_0x377825;if(_0x4d84d1[_0x85ce('0x2f')][_0x85ce('0x40')]){_0x431c9a[_0x85ce('0x41')]=[{'all':!![]}];}return db[_0x85ce('0x2c')][_0x85ce('0x42')](_0x431c9a);})['then'](function(_0x4b6d56){_0x5a672d['rows']=_0x4b6d56;return _0x5a672d;})['then'](respondWithFilteredResult(_0x160acd,_0x431c9a))['catch'](handleError(_0x160acd,null));};exports['show']=function(_0x3560d8,_0x44aa73){var _0x59ad8b={'raw':!![],'where':{'id':_0x3560d8[_0x85ce('0x43')]['id']}},_0xe3f799={};_0xe3f799[_0x85ce('0x32')]=_[_0x85ce('0x44')](db[_0x85ce('0x2c')][_0x85ce('0x2d')]);_0xe3f799['query']=_[_0x85ce('0x44')](_0x3560d8[_0x85ce('0x2f')]);_0xe3f799[_0x85ce('0x30')]=_[_0x85ce('0x31')](_0xe3f799[_0x85ce('0x32')],_0xe3f799[_0x85ce('0x2f')]);_0x59ad8b[_0x85ce('0x34')]=_['intersection'](_0xe3f799['model'],qs['fields'](_0x3560d8['query'][_0x85ce('0x33')]));_0x59ad8b[_0x85ce('0x34')]=_0x59ad8b['attributes'][_0x85ce('0x35')]?_0x59ad8b[_0x85ce('0x34')]:_0xe3f799[_0x85ce('0x32')];if(_0x3560d8[_0x85ce('0x2f')][_0x85ce('0x40')]){_0x59ad8b[_0x85ce('0x41')]=[{'all':!![]}];}_0x59ad8b=_[_0x85ce('0x3d')]({},_0x59ad8b,_0x3560d8[_0x85ce('0x45')]);return db['VoiceTransferReport'][_0x85ce('0x46')](_0x59ad8b)[_0x85ce('0x26')](handleEntityNotFound(_0x44aa73,null))[_0x85ce('0x26')](respondWithResult(_0x44aa73,null))[_0x85ce('0x47')](handleError(_0x44aa73,null));};exports[_0x85ce('0x48')]=function(_0x3eec39,_0x15699f){return db[_0x85ce('0x2c')]['create'](_0x3eec39[_0x85ce('0x49')],{})[_0x85ce('0x26')](respondWithResult(_0x15699f,0xc9))[_0x85ce('0x47')](handleError(_0x15699f,null));};exports['update']=function(_0x32915e,_0x2554de){if(_0x32915e[_0x85ce('0x49')]['id']){delete _0x32915e[_0x85ce('0x49')]['id'];}return db[_0x85ce('0x2c')][_0x85ce('0x46')]({'where':{'id':_0x32915e[_0x85ce('0x43')]['id']}})['then'](handleEntityNotFound(_0x2554de,null))[_0x85ce('0x26')](saveUpdates(_0x32915e[_0x85ce('0x49')],null))[_0x85ce('0x26')](respondWithResult(_0x2554de,null))[_0x85ce('0x47')](handleError(_0x2554de,null));};exports[_0x85ce('0x27')]=function(_0x343f7d,_0x16981c){return db[_0x85ce('0x2c')][_0x85ce('0x46')]({'where':{'id':_0x343f7d[_0x85ce('0x43')]['id']}})[_0x85ce('0x26')](handleEntityNotFound(_0x16981c,null))['then'](removeEntity(_0x16981c,null))[_0x85ce('0x47')](handleError(_0x16981c,null));};exports[_0x85ce('0x4a')]=function(_0x1debf2,_0xe21eb6){return db[_0x85ce('0x2c')][_0x85ce('0x4a')]()[_0x85ce('0x26')](respondWithResult(_0xe21eb6,null))[_0x85ce('0x47')](handleError(_0xe21eb6,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index e4cbdb6..359cf42 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 _0x11d5=['path','rimraf','./voiceTransferReport.attributes','exports','define','report_call_transfer','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x8efa6d,_0x51a861){var _0x3ce69a=function(_0x2bd97d){while(--_0x2bd97d){_0x8efa6d['push'](_0x8efa6d['shift']());}};_0x3ce69a(++_0x51a861);}(_0x11d5,0xde));var _0x511d=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x11d5[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0x511d('0x0'));var logger=require(_0x511d('0x1'))(_0x511d('0x2'));var moment=require(_0x511d('0x3'));var BPromise=require(_0x511d('0x4'));var rp=require(_0x511d('0x5'));var fs=require('fs');var path=require(_0x511d('0x6'));var rimraf=require(_0x511d('0x7'));var config=require('../../config/environment');var attributes=require(_0x511d('0x8'));module[_0x511d('0x9')]=function(_0x476b24,_0x208e70){return _0x476b24[_0x511d('0xa')]('VoiceTransferReport',attributes,{'tableName':_0x511d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73a9=['define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports'];(function(_0x270bac,_0x2583f8){var _0x13aff1=function(_0x491694){while(--_0x491694){_0x270bac['push'](_0x270bac['shift']());}};_0x13aff1(++_0x2583f8);}(_0x73a9,0x148));var _0x973a=function(_0x597bf8,_0x4fda9c){_0x597bf8=_0x597bf8-0x0;var _0x3833ba=_0x73a9[_0x597bf8];return _0x3833ba;};'use strict';var _=require(_0x973a('0x0'));var util=require('util');var logger=require(_0x973a('0x1'))(_0x973a('0x2'));var moment=require(_0x973a('0x3'));var BPromise=require(_0x973a('0x4'));var rp=require(_0x973a('0x5'));var fs=require('fs');var path=require(_0x973a('0x6'));var rimraf=require('rimraf');var config=require(_0x973a('0x7'));var attributes=require(_0x973a('0x8'));module[_0x973a('0x9')]=function(_0x494897,_0x59e830){return _0x494897[_0x973a('0xa')](_0x973a('0xb'),attributes,{'tableName':_0x973a('0xc'),'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 3cea728..ebe5476 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 _0x55d6=['body','options','raw','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport'];(function(_0xf2931a,_0x2d490b){var _0x45c15d=function(_0x1ef510){while(--_0x1ef510){_0xf2931a['push'](_0xf2931a['shift']());}};_0x45c15d(++_0x2d490b);}(_0x55d6,0x1ce));var _0x655d=function(_0x1c3266,_0x2da6bf){_0x1c3266=_0x1c3266-0x0;var _0x58cbbb=_0x55d6[_0x1c3266];return _0x58cbbb;};'use strict';var _=require('lodash');var util=require(_0x655d('0x0'));var moment=require(_0x655d('0x1'));var BPromise=require(_0x655d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x655d('0x3'))['db'];var utils=require(_0x655d('0x4'));var logger=require(_0x655d('0x5'))('rpc');var config=require(_0x655d('0x6'));var jayson=require(_0x655d('0x7'));var client=jayson[_0x655d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16cafa,_0x1442a0,_0x1db4d3){return new BPromise(function(_0x5db60a,_0x2ea03f){return client[_0x655d('0x9')](_0x16cafa,_0x1db4d3)[_0x655d('0xa')](function(_0x3ff8c1){logger[_0x655d('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x1442a0,'request\x20sent');logger[_0x655d('0xc')](_0x655d('0xd'),_0x1442a0,_0x655d('0xe'),JSON[_0x655d('0xf')](_0x3ff8c1));if(_0x3ff8c1[_0x655d('0x10')]){if(_0x3ff8c1['error'][_0x655d('0x11')]===0x1f4){logger[_0x655d('0x10')](_0x655d('0x12'),_0x1442a0,_0x3ff8c1[_0x655d('0x10')][_0x655d('0x13')]);return _0x2ea03f(_0x3ff8c1[_0x655d('0x10')][_0x655d('0x13')]);}logger[_0x655d('0x10')](_0x655d('0x12'),_0x1442a0,_0x3ff8c1[_0x655d('0x10')][_0x655d('0x13')]);return _0x5db60a(_0x3ff8c1[_0x655d('0x10')][_0x655d('0x13')]);}else{logger[_0x655d('0xb')](_0x655d('0x12'),_0x1442a0,'request\x20sent');_0x5db60a(_0x3ff8c1[_0x655d('0x14')][_0x655d('0x13')]);}})[_0x655d('0x15')](function(_0x18769e){logger[_0x655d('0x10')](_0x655d('0x12'),_0x1442a0,_0x18769e);_0x2ea03f(_0x18769e);});});}exports[_0x655d('0x16')]=function(_0x329abe){var _0x195279=this;return new Promise(function(_0x5aed2a,_0x2510d0){return db[_0x655d('0x17')]['create'](_0x329abe[_0x655d('0x18')],{'raw':_0x329abe[_0x655d('0x19')]?_0x329abe[_0x655d('0x19')][_0x655d('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x29d165){logger['info'](_0x655d('0x16'),_0x329abe);logger[_0x655d('0xc')]('CreateVoiceTransferReport',_0x329abe,JSON[_0x655d('0xf')](_0x29d165));_0x5aed2a(_0x29d165);})[_0x655d('0x15')](function(_0x12c017){logger[_0x655d('0x10')](_0x655d('0x16'),_0x12c017[_0x655d('0x13')],_0x329abe);_0x2510d0(_0x195279['error'](0x1f4,_0x12c017['message']));});});}; \ No newline at end of file +var _0xd6ff=['CreateVoiceTransferReport','create','body','options','raw','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd6ff,0xc3));var _0xfd6f=function(_0x4ec618,_0x5ea2ca){_0x4ec618=_0x4ec618-0x0;var _0x3a6b2c=_0xd6ff[_0x4ec618];return _0x3a6b2c;};'use strict';var _=require('lodash');var util=require(_0xfd6f('0x0'));var moment=require(_0xfd6f('0x1'));var BPromise=require('bluebird');var rs=require(_0xfd6f('0x2'));var fs=require('fs');var Redis=require(_0xfd6f('0x3'));var db=require(_0xfd6f('0x4'))['db'];var utils=require(_0xfd6f('0x5'));var logger=require(_0xfd6f('0x6'))('rpc');var config=require(_0xfd6f('0x7'));var jayson=require(_0xfd6f('0x8'));var client=jayson[_0xfd6f('0x9')][_0xfd6f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28f0d6,_0x2667a5,_0x399ec1){return new BPromise(function(_0x2d209e,_0x24f221){return client['request'](_0x28f0d6,_0x399ec1)[_0xfd6f('0xb')](function(_0xb7d067){logger[_0xfd6f('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x2667a5,'request\x20sent');logger[_0xfd6f('0xd')](_0xfd6f('0xe'),_0x2667a5,_0xfd6f('0xf'),JSON[_0xfd6f('0x10')](_0xb7d067));if(_0xb7d067['error']){if(_0xb7d067[_0xfd6f('0x11')][_0xfd6f('0x12')]===0x1f4){logger[_0xfd6f('0x11')](_0xfd6f('0x13'),_0x2667a5,_0xb7d067[_0xfd6f('0x11')][_0xfd6f('0x14')]);return _0x24f221(_0xb7d067[_0xfd6f('0x11')]['message']);}logger['error'](_0xfd6f('0x13'),_0x2667a5,_0xb7d067[_0xfd6f('0x11')][_0xfd6f('0x14')]);return _0x2d209e(_0xb7d067[_0xfd6f('0x11')][_0xfd6f('0x14')]);}else{logger[_0xfd6f('0xc')](_0xfd6f('0x13'),_0x2667a5,_0xfd6f('0xf'));_0x2d209e(_0xb7d067['result']['message']);}})['catch'](function(_0x473cb7){logger[_0xfd6f('0x11')](_0xfd6f('0x13'),_0x2667a5,_0x473cb7);_0x24f221(_0x473cb7);});});}exports[_0xfd6f('0x15')]=function(_0x5932e6){var _0x49adfd=this;return new Promise(function(_0xd25ebb,_0x100a4b){return db['VoiceTransferReport'][_0xfd6f('0x16')](_0x5932e6[_0xfd6f('0x17')],{'raw':_0x5932e6['options']?_0x5932e6[_0xfd6f('0x18')][_0xfd6f('0x19')]===undefined?!![]:![]:!![]})[_0xfd6f('0xb')](function(_0x5a20bd){logger[_0xfd6f('0xc')](_0xfd6f('0x15'),_0x5932e6);logger[_0xfd6f('0xd')]('CreateVoiceTransferReport',_0x5932e6,JSON[_0xfd6f('0x10')](_0x5a20bd));_0xd25ebb(_0x5a20bd);})[_0xfd6f('0x1a')](function(_0xd44100){logger['error'](_0xfd6f('0x15'),_0xd44100[_0xfd6f('0x14')],_0x5932e6);_0x100a4b(_0x49adfd[_0xfd6f('0x11')](0x1f4,_0xd44100['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d371388..2d85c93 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 _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3969f4,_0x429032){_0x3969f4=_0x3969f4-0x0;var _0x308caa=_0xb43b[_0x3969f4];return _0x308caa;};'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 +var _0x9bde=['Router','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','transfer'];(function(_0x2ceb8e,_0x19ba8e){var _0xe283bb=function(_0x104094){while(--_0x104094){_0x2ceb8e['push'](_0x2ceb8e['shift']());}};_0xe283bb(++_0x19ba8e);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3089f0,_0x310931){_0x3089f0=_0x3089f0-0x0;var _0x5bab29=_0x9bde[_0x3089f0];return _0x5bab29;};'use strict';var express=require('express');var router=express[_0xe9bd('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xe9bd('0x1'));router['post'](_0xe9bd('0x2'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0x5')]);router[_0xe9bd('0x6')](_0xe9bd('0x7'),auth[_0xe9bd('0x3')](),auth['isWebrtcLicence'](),controller[_0xe9bd('0x8')]);router[_0xe9bd('0x6')](_0xe9bd('0x9'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xa')]);router[_0xe9bd('0x6')](_0xe9bd('0xb'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['hold']);router['post'](_0xe9bd('0xc'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['unhold']);router[_0xe9bd('0x6')](_0xe9bd('0xd'),auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller['calls']);router[_0xe9bd('0x6')]('/transfer',auth[_0xe9bd('0x3')](),auth[_0xe9bd('0x4')](),controller[_0xe9bd('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 87edb0f..fc13fde 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 _0x422f=['transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','name','status','send','request','error','code','message','result','catch','findOne','agent','then','all','filter','UserId','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','length','json','userId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup\x20fired:','sessionId','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','rows','conference','conference\x20fired:'];(function(_0x399f9d,_0x5655e9){var _0x2e7b09=function(_0x1f2209){while(--_0x1f2209){_0x399f9d['push'](_0x399f9d['shift']());}};_0x2e7b09(++_0x5655e9);}(_0x422f,0x1c7));var _0xf422=function(_0x5a89e7,_0xb9c029){_0x5a89e7=_0x5a89e7-0x0;var _0x2d7767=_0x422f[_0x5a89e7];return _0x2d7767;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xf422('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0xf422('0x1'));var util=require(_0xf422('0x2'));var BPromise=require('bluebird');var jayson=require(_0xf422('0x3'));var amiClient=jayson[_0xf422('0x4')][_0xf422('0x5')]({'port':0x232a});var logger=require(_0xf422('0x6'))(_0xf422('0x7'));var Redis=require(_0xf422('0x8'));config[_0xf422('0x9')]=_[_0xf422('0xa')](config[_0xf422('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf422('0xb'))(new Redis(config[_0xf422('0x9')]));var Schema=require(_0xf422('0xc'));var originateValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'callNumber':{'type':'string','required':[!![],_0xf422('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':_0xf422('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':'string','required':[!![],_0xf422('0x11')]},'transferNumber':{'type':_0xf422('0x10'),'required':[!![],_0xf422('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':_0xf422('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':_0xf422('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf422('0xe')]}});function emit(_0x30b70a,_0x21a35d,_0xdf4434){logger['info'](_0x30b70a,_0x21a35d,JSON[_0xf422('0x13')](_0xdf4434));io['to'](_0x30b70a)[_0xf422('0x14')](_0x21a35d,_0xdf4434);}function handleError(_0x76e4b1){return function(_0x2ae133){console[_0xf422('0x15')](_0xf422('0x16'),_0x2ae133,_0x2ae133 instanceof RangeError);logger['error'](_0x2ae133['stack']);if(_0x2ae133 instanceof RangeError){if(_0x2ae133[_0xf422('0x17')]){delete _0x2ae133[_0xf422('0x17')];}_0x76e4b1[_0xf422('0x18')](0x194)['send'](_0x2ae133);}else{if(_0x2ae133[_0xf422('0x17')]){delete _0x2ae133['name'];}_0x76e4b1[_0xf422('0x18')](0x1f4)[_0xf422('0x19')](_0x2ae133);}};}function checkError(){return function(_0x36b7e7){if(!_0x36b7e7){throw new RangeError('NotFound');}return _0x36b7e7;};}function respondWithRpcPromise(_0xf2d06b,_0x3cdd93){return new BPromise(function(_0x511529,_0x4b80a0){var _0x268575=amiClient;return _0x268575[_0xf422('0x1a')](_0xf2d06b,_0x3cdd93)['then'](function(_0x25b6a5){if(_0x25b6a5['error']){if(_0x25b6a5[_0xf422('0x1b')][_0xf422('0x1c')]===0x1f4){return _0x4b80a0(_0x25b6a5[_0xf422('0x1b')][_0xf422('0x1d')]);}return _0x511529(_0x25b6a5[_0xf422('0x1b')][_0xf422('0x1d')]);}else{_0x511529(_0x25b6a5[_0xf422('0x1e')]);}})[_0xf422('0x1f')](function(_0x5dcab4){_0x4b80a0(_0x5dcab4);});});}function getAgent(_0x1125ce){return db['User'][_0xf422('0x20')]({'where':{'id':_0x1125ce,'role':_0xf422('0x21')}})[_0xf422('0x22')](checkError());}function getAgentCheckSession(_0x3d3fe4,_0xaa3e7e){return new BPromise(function(_0x31f439,_0x2d0053){var _0x4ebfe9=respondWithRpcPromise('VoiceChannels');var _0x35d1fa=getAgent(_0x3d3fe4);Promise[_0xf422('0x23')]([_0x4ebfe9,_0x35d1fa])[_0xf422('0x22')](function(_0x33ef63){var _0xefb99e=_0x33ef63[0x0];var _0x48e0c7=_0x33ef63[0x1];var _0x6d22f1=_[_0xf422('0x24')](_0xefb99e['rows'],function(_0x5f0186){return _0x5f0186[_0xf422('0x25')]==_0x48e0c7['id']&&_0x5f0186['sessionId']==_0xaa3e7e;});if(_0x6d22f1['length']==0x1){_0x31f439(_0x48e0c7);}else{_0x2d0053(new RangeError(_0xf422('0x26')+_0xaa3e7e+_0xf422('0x27')));}});});}exports['originate']=function(_0x261e29,_0x2f5b75){logger[_0xf422('0x28')](_0xf422('0x29'),_0x261e29[_0xf422('0x2a')]);var _0x4d8670=originateValidation[_0xf422('0xc')](_0x261e29['body']);if(_0x4d8670[_0xf422('0x2b')]>0x0){return _0x2f5b75[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x4d8670);}var _0x1869a4=_0x261e29[_0xf422('0x2a')][_0xf422('0x2d')];var _0xbd95dd=_0x261e29['body']['callNumber'];var _0x2b35d2=_0x261e29[_0xf422('0x2a')]['callerId'];var _0x259bb2=_0x261e29[_0xf422('0x2a')][_0xf422('0x2e')];return getAgent(_0x1869a4)[_0xf422('0x22')](function(_0x12ddbf){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x12ddbf[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x12ddbf[_0xf422('0x17')]),_0xf422('0x32'),{'callNumber':_0xbd95dd,'callerId':_0x2b35d2,'callbackUrl':_0x259bb2});return _0x2f5b75[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x2f5b75));};exports['hangup']=function(_0x2c9861,_0x2ae7e1){logger['info'](_0xf422('0x33'),_0x2c9861['body']);var _0x774834=hangupValidation[_0xf422('0xc')](_0x2c9861['body']);if(_0x774834[_0xf422('0x2b')]>0x0){return _0x2ae7e1[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x774834);}var _0x511fc7=_0x2c9861[_0xf422('0x2a')]['userId'];var _0x567667=_0x2c9861['body'][_0xf422('0x34')];return getAgent(_0x511fc7)[_0xf422('0x22')](function(_0x2133a5){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x2133a5[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x2133a5['name']),'webbar:hangup',{'sessionId':_0x567667});return _0x2ae7e1[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x35')});})[_0xf422('0x1f')](handleError(_0x2ae7e1));};exports[_0xf422('0x36')]=function(_0x35eac8,_0x56d615){logger[_0xf422('0x28')]('answer\x20fired:',_0x35eac8[_0xf422('0x2a')]);var _0x391e3c=answerValidation['validate'](_0x35eac8[_0xf422('0x2a')]);if(_0x391e3c[_0xf422('0x2b')]>0x0){return _0x56d615[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x391e3c);}var _0x1658d0=_0x35eac8['body'][_0xf422('0x2d')];var _0x1e20a2=_0x35eac8[_0xf422('0x2a')][_0xf422('0x34')];return getAgent(_0x1658d0)[_0xf422('0x22')](function(_0x5ea94e){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x5ea94e['name']);emit(util[_0xf422('0x30')]('user:%s',_0x5ea94e[_0xf422('0x17')]),_0xf422('0x37'),{'sessionId':_0x1e20a2});return _0x56d615[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x38')});})[_0xf422('0x1f')](handleError(_0x56d615));};exports[_0xf422('0x39')]=function(_0xd77d9,_0x2ad164){logger[_0xf422('0x28')](_0xf422('0x3a'),_0xd77d9[_0xf422('0x2a')]);var _0x154e72=holdValidation[_0xf422('0xc')](_0xd77d9[_0xf422('0x2a')]);if(_0x154e72['length']>0x0){return _0x2ad164['status'](0x190)[_0xf422('0x2c')](_0x154e72);}var _0x2c2ce9=_0xd77d9[_0xf422('0x2a')]['userId'];var _0x15967f=_0xd77d9[_0xf422('0x2a')][_0xf422('0x34')];return getAgent(_0x2c2ce9)[_0xf422('0x22')](function(_0x1f3a30){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x1f3a30['name']);emit(util[_0xf422('0x30')]('user:%s',_0x1f3a30[_0xf422('0x17')]),_0xf422('0x3b'),{'sessionId':_0x15967f});return _0x2ad164['status'](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x3c')});})[_0xf422('0x1f')](handleError(_0x2ad164));};exports[_0xf422('0x3d')]=function(_0x2df71a,_0x5c3cb8){logger['info'](_0xf422('0x3e'),_0x2df71a['body']);var _0x4429c6=unholdValidation[_0xf422('0xc')](_0x2df71a[_0xf422('0x2a')]);if(_0x4429c6[_0xf422('0x2b')]>0x0){return _0x5c3cb8['status'](0x190)['json'](_0x4429c6);}var _0x44448c=_0x2df71a[_0xf422('0x2a')][_0xf422('0x2d')];var _0xddcd6c=_0x2df71a[_0xf422('0x2a')][_0xf422('0x34')];return getAgent(_0x44448c)['then'](function(_0x315e79){logger['info'](_0xf422('0x2f'),_0x315e79[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x315e79['name']),'webbar:unhold',{'sessionId':_0xddcd6c});return _0x5c3cb8[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x3f')});})[_0xf422('0x1f')](handleError(_0x5c3cb8));};exports[_0xf422('0x40')]=function(_0x2ce919,_0x90f97f){logger['info'](_0xf422('0x41'),_0x90f97f[_0xf422('0x2a')]);var _0x19e687=callsValidation[_0xf422('0xc')](_0x2ce919[_0xf422('0x2a')]);if(_0x19e687[_0xf422('0x2b')]>0x0){return _0x90f97f[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x19e687);}var _0x36f8ae=_0x2ce919[_0xf422('0x2a')]['userId'];var _0x4419e6=respondWithRpcPromise(_0xf422('0x42'));var _0x23ee77=getAgent(_0x36f8ae);return Promise[_0xf422('0x23')]([_0x4419e6,_0x23ee77])[_0xf422('0x22')](function(_0x5b14dd){var _0x235fff=_0x5b14dd[0x0];var _0x2b6a57=_0x5b14dd[0x1];var _0x4fa193=_[_0xf422('0x24')](_0x235fff[_0xf422('0x43')],function(_0x39fa95){return _0x39fa95[_0xf422('0x25')]==_0x2b6a57['id'];});return _0x90f97f[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'count':_0x4fa193[_0xf422('0x2b')],'rows':_0x4fa193});})['catch'](handleError(_0x90f97f));};exports[_0xf422('0x44')]=function(_0x477a65,_0x462376){logger['info'](_0xf422('0x45'),_0x477a65[_0xf422('0x2a')]);var _0x3d9946=conferenceValidation[_0xf422('0xc')](_0x477a65[_0xf422('0x2a')]);if(_0x3d9946[_0xf422('0x2b')]>0x0){return _0x462376[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x3d9946);}var _0x3f2095=_0x477a65[_0xf422('0x2a')][_0xf422('0x2d')];return getAgent(_0x3f2095)[_0xf422('0x22')](function(_0x28c6ac){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x28c6ac[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x28c6ac[_0xf422('0x17')]),'webbar:conference');return _0x462376['status'](0xc8)[_0xf422('0x2c')]({'error':![],'message':'conference\x20executed!'});})[_0xf422('0x1f')](handleError(_0x462376));};exports[_0xf422('0x46')]=function(_0x416e40,_0x14904a){logger['info'](_0xf422('0x47'),_0x416e40[_0xf422('0x2a')]);var _0x2b1d8f=transferValidation['validate'](_0x416e40['body']);if(_0x2b1d8f[_0xf422('0x2b')]>0x0){return _0x14904a[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x2b1d8f);}var _0x23d1b5=_0x416e40['body']['userId'];var _0x53f92e=_0x416e40[_0xf422('0x2a')][_0xf422('0x34')];var _0x3de5c5=_0x416e40[_0xf422('0x2a')][_0xf422('0x48')];return getAgent(_0x23d1b5)[_0xf422('0x22')](function(_0x3f165d){logger['info']('entityFound:',_0x3f165d['name']);emit(util[_0xf422('0x30')]('user:%s',_0x3f165d[_0xf422('0x17')]),_0xf422('0x49'),{'sessionId':_0x53f92e,'transferNumber':_0x3de5c5});return _0x14904a['status'](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x4a')});})[_0xf422('0x1f')](handleError(_0x14904a));}; \ No newline at end of file +var _0x7980=['webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','error','name','send','status','NotFound','request','then','code','message','result','User','agent','VoiceChannels','all','filter','sessionId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','validate','callNumber','callerId','user:%s','webbar:originate','json','originate\x20executed!','catch','hangup','hangup\x20fired:','userId','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','format','answer\x20executed!','hold\x20fired:'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7980,0xab));var _0x0798=function(_0x5e6c25,_0x4ecd3c){_0x5e6c25=_0x5e6c25-0x0;var _0x2a5a38=_0x7980[_0x5e6c25];return _0x2a5a38;};'use strict';var path=require(_0x0798('0x0'));var fs=require('fs');var _=require(_0x0798('0x1'));var db=require(_0x0798('0x2'))['db'];var config=require(_0x0798('0x3'));var util=require(_0x0798('0x4'));var BPromise=require('bluebird');var jayson=require(_0x0798('0x5'));var amiClient=jayson[_0x0798('0x6')][_0x0798('0x7')]({'port':0x232a});var logger=require(_0x0798('0x8'))(_0x0798('0x9'));var Redis=require('ioredis');config[_0x0798('0xa')]=_['defaults'](config[_0x0798('0xa')],{'host':_0x0798('0xb'),'port':0x18eb});var io=require(_0x0798('0xc'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]},'callNumber':{'type':_0x0798('0xf'),'required':[!![],_0x0798('0x10')]},'callerId':{'type':_0x0798('0xf')},'callbackUrl':{'type':_0x0798('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]},'sessionId':{'type':_0x0798('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0798('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0x0798('0x11')]},'transferNumber':{'type':_0x0798('0xf'),'required':[!![],_0x0798('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]},'sessionId':{'type':_0x0798('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0798('0xd'),'required':[!![],_0x0798('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x21c30b,_0x45cae6,_0x258081){logger['info'](_0x21c30b,_0x45cae6,JSON['stringify'](_0x258081));io['to'](_0x21c30b)[_0x0798('0x13')](_0x45cae6,_0x258081);}function handleError(_0x502635){return function(_0x41e217){console[_0x0798('0x14')](_0x0798('0x15'),_0x41e217,_0x41e217 instanceof RangeError);logger[_0x0798('0x16')](_0x41e217['stack']);if(_0x41e217 instanceof RangeError){if(_0x41e217[_0x0798('0x17')]){delete _0x41e217[_0x0798('0x17')];}_0x502635['status'](0x194)[_0x0798('0x18')](_0x41e217);}else{if(_0x41e217[_0x0798('0x17')]){delete _0x41e217[_0x0798('0x17')];}_0x502635[_0x0798('0x19')](0x1f4)[_0x0798('0x18')](_0x41e217);}};}function checkError(){return function(_0x273ba8){if(!_0x273ba8){throw new RangeError(_0x0798('0x1a'));}return _0x273ba8;};}function respondWithRpcPromise(_0x212ad5,_0x23b37d){return new BPromise(function(_0x4a86d5,_0x2aaabf){var _0x35c141=amiClient;return _0x35c141[_0x0798('0x1b')](_0x212ad5,_0x23b37d)[_0x0798('0x1c')](function(_0x20654b){if(_0x20654b[_0x0798('0x16')]){if(_0x20654b['error'][_0x0798('0x1d')]===0x1f4){return _0x2aaabf(_0x20654b[_0x0798('0x16')][_0x0798('0x1e')]);}return _0x4a86d5(_0x20654b[_0x0798('0x16')][_0x0798('0x1e')]);}else{_0x4a86d5(_0x20654b[_0x0798('0x1f')]);}})['catch'](function(_0x43d99f){_0x2aaabf(_0x43d99f);});});}function getAgent(_0x14f828){return db[_0x0798('0x20')]['findOne']({'where':{'id':_0x14f828,'role':_0x0798('0x21')}})['then'](checkError());}function getAgentCheckSession(_0x53a3d7,_0x406030){return new BPromise(function(_0x2dfbff,_0x134d24){var _0xaa949b=respondWithRpcPromise(_0x0798('0x22'));var _0x161244=getAgent(_0x53a3d7);Promise[_0x0798('0x23')]([_0xaa949b,_0x161244])[_0x0798('0x1c')](function(_0x5bbe3d){var _0x167960=_0x5bbe3d[0x0];var _0x4f5d1d=_0x5bbe3d[0x1];var _0x5f1780=_[_0x0798('0x24')](_0x167960['rows'],function(_0x1dabd5){return _0x1dabd5['UserId']==_0x4f5d1d['id']&&_0x1dabd5[_0x0798('0x25')]==_0x406030;});if(_0x5f1780[_0x0798('0x26')]==0x1){_0x2dfbff(_0x4f5d1d);}else{_0x134d24(new RangeError(_0x0798('0x27')+_0x406030+_0x0798('0x28')));}});});}exports[_0x0798('0x29')]=function(_0x1ebd07,_0xa1376e){logger[_0x0798('0x2a')](_0x0798('0x2b'),_0x1ebd07[_0x0798('0x2c')]);var _0x54a955=originateValidation[_0x0798('0x2d')](_0x1ebd07['body']);if(_0x54a955[_0x0798('0x26')]>0x0){return _0xa1376e['status'](0x190)['json'](_0x54a955);}var _0x104d23=_0x1ebd07[_0x0798('0x2c')]['userId'];var _0x49d5b8=_0x1ebd07[_0x0798('0x2c')][_0x0798('0x2e')];var _0x322adf=_0x1ebd07[_0x0798('0x2c')][_0x0798('0x2f')];var _0x2ad922=_0x1ebd07['body']['callbackUrl'];return getAgent(_0x104d23)[_0x0798('0x1c')](function(_0x23a70b){logger[_0x0798('0x2a')]('entityFound:',_0x23a70b['name']);emit(util['format'](_0x0798('0x30'),_0x23a70b[_0x0798('0x17')]),_0x0798('0x31'),{'callNumber':_0x49d5b8,'callerId':_0x322adf,'callbackUrl':_0x2ad922});return _0xa1376e[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x33')});})[_0x0798('0x34')](handleError(_0xa1376e));};exports[_0x0798('0x35')]=function(_0x502556,_0x16dae6){logger['info'](_0x0798('0x36'),_0x502556[_0x0798('0x2c')]);var _0x2caa82=hangupValidation['validate'](_0x502556[_0x0798('0x2c')]);if(_0x2caa82['length']>0x0){return _0x16dae6[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x2caa82);}var _0x223751=_0x502556['body'][_0x0798('0x37')];var _0xb5937b=_0x502556['body'][_0x0798('0x25')];return getAgent(_0x223751)['then'](function(_0x4e9d94){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x4e9d94['name']);emit(util['format'](_0x0798('0x30'),_0x4e9d94[_0x0798('0x17')]),_0x0798('0x39'),{'sessionId':_0xb5937b});return _0x16dae6[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x3a')});})[_0x0798('0x34')](handleError(_0x16dae6));};exports['answer']=function(_0x3aa79c,_0x11c5bf){logger[_0x0798('0x2a')](_0x0798('0x3b'),_0x3aa79c[_0x0798('0x2c')]);var _0x26e9cb=answerValidation['validate'](_0x3aa79c[_0x0798('0x2c')]);if(_0x26e9cb[_0x0798('0x26')]>0x0){return _0x11c5bf[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x26e9cb);}var _0x387450=_0x3aa79c[_0x0798('0x2c')][_0x0798('0x37')];var _0x10a50a=_0x3aa79c[_0x0798('0x2c')][_0x0798('0x25')];return getAgent(_0x387450)[_0x0798('0x1c')](function(_0x31a3cb){logger['info'](_0x0798('0x38'),_0x31a3cb[_0x0798('0x17')]);emit(util[_0x0798('0x3c')](_0x0798('0x30'),_0x31a3cb['name']),'webbar:answer',{'sessionId':_0x10a50a});return _0x11c5bf[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x3d')});})[_0x0798('0x34')](handleError(_0x11c5bf));};exports['hold']=function(_0x21c28c,_0x4858e6){logger['info'](_0x0798('0x3e'),_0x21c28c[_0x0798('0x2c')]);var _0x42c5b8=holdValidation[_0x0798('0x2d')](_0x21c28c[_0x0798('0x2c')]);if(_0x42c5b8[_0x0798('0x26')]>0x0){return _0x4858e6[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x42c5b8);}var _0x182e3b=_0x21c28c['body'][_0x0798('0x37')];var _0x56d438=_0x21c28c[_0x0798('0x2c')][_0x0798('0x25')];return getAgent(_0x182e3b)[_0x0798('0x1c')](function(_0x54634d){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x54634d[_0x0798('0x17')]);emit(util[_0x0798('0x3c')]('user:%s',_0x54634d[_0x0798('0x17')]),_0x0798('0x3f'),{'sessionId':_0x56d438});return _0x4858e6[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x40')});})['catch'](handleError(_0x4858e6));};exports[_0x0798('0x41')]=function(_0x3e1c15,_0x2679b1){logger[_0x0798('0x2a')](_0x0798('0x42'),_0x3e1c15[_0x0798('0x2c')]);var _0x181757=unholdValidation[_0x0798('0x2d')](_0x3e1c15[_0x0798('0x2c')]);if(_0x181757['length']>0x0){return _0x2679b1['status'](0x190)[_0x0798('0x32')](_0x181757);}var _0x499073=_0x3e1c15[_0x0798('0x2c')][_0x0798('0x37')];var _0x40b3d6=_0x3e1c15[_0x0798('0x2c')][_0x0798('0x25')];return getAgent(_0x499073)['then'](function(_0x3cb0b4){logger['info'](_0x0798('0x38'),_0x3cb0b4[_0x0798('0x17')]);emit(util[_0x0798('0x3c')]('user:%s',_0x3cb0b4['name']),'webbar:unhold',{'sessionId':_0x40b3d6});return _0x2679b1[_0x0798('0x19')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x0798('0x34')](handleError(_0x2679b1));};exports[_0x0798('0x43')]=function(_0x455d19,_0x499580){logger[_0x0798('0x2a')](_0x0798('0x44'),_0x499580[_0x0798('0x2c')]);var _0x743d26=callsValidation['validate'](_0x455d19['body']);if(_0x743d26[_0x0798('0x26')]>0x0){return _0x499580[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x743d26);}var _0x59ad6c=_0x455d19['body'][_0x0798('0x37')];var _0x82599=respondWithRpcPromise(_0x0798('0x22'));var _0x190467=getAgent(_0x59ad6c);return Promise[_0x0798('0x23')]([_0x82599,_0x190467])[_0x0798('0x1c')](function(_0x18c0fa){var _0x1a55c0=_0x18c0fa[0x0];var _0x4f35c7=_0x18c0fa[0x1];var _0x349f86=_[_0x0798('0x24')](_0x1a55c0['rows'],function(_0x3ab2cc){return _0x3ab2cc[_0x0798('0x45')]==_0x4f35c7['id'];});return _0x499580['status'](0xc8)[_0x0798('0x32')]({'count':_0x349f86[_0x0798('0x26')],'rows':_0x349f86});})[_0x0798('0x34')](handleError(_0x499580));};exports[_0x0798('0x46')]=function(_0x458a4e,_0x541669){logger[_0x0798('0x2a')](_0x0798('0x47'),_0x458a4e[_0x0798('0x2c')]);var _0x47cfc0=conferenceValidation[_0x0798('0x2d')](_0x458a4e['body']);if(_0x47cfc0[_0x0798('0x26')]>0x0){return _0x541669[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x47cfc0);}var _0x26b393=_0x458a4e[_0x0798('0x2c')][_0x0798('0x37')];return getAgent(_0x26b393)['then'](function(_0x3cc8bd){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x3cc8bd[_0x0798('0x17')]);emit(util['format'](_0x0798('0x30'),_0x3cc8bd[_0x0798('0x17')]),_0x0798('0x48'));return _0x541669[_0x0798('0x19')](0xc8)[_0x0798('0x32')]({'error':![],'message':'conference\x20executed!'});})[_0x0798('0x34')](handleError(_0x541669));};exports[_0x0798('0x49')]=function(_0x5668b7,_0x48d1d1){logger[_0x0798('0x2a')](_0x0798('0x4a'),_0x5668b7['body']);var _0x2f336a=transferValidation[_0x0798('0x2d')](_0x5668b7[_0x0798('0x2c')]);if(_0x2f336a[_0x0798('0x26')]>0x0){return _0x48d1d1[_0x0798('0x19')](0x190)[_0x0798('0x32')](_0x2f336a);}var _0x21c156=_0x5668b7[_0x0798('0x2c')]['userId'];var _0x316762=_0x5668b7[_0x0798('0x2c')][_0x0798('0x25')];var _0xf5100e=_0x5668b7['body'][_0x0798('0x4b')];return getAgent(_0x21c156)[_0x0798('0x1c')](function(_0x11946d){logger[_0x0798('0x2a')](_0x0798('0x38'),_0x11946d[_0x0798('0x17')]);emit(util[_0x0798('0x3c')](_0x0798('0x30'),_0x11946d['name']),_0x0798('0x4c'),{'sessionId':_0x316762,'transferNumber':_0xf5100e});return _0x48d1d1['status'](0xc8)[_0x0798('0x32')]({'error':![],'message':_0x0798('0x4d')});})[_0x0798('0x34')](handleError(_0x48d1d1));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index d8d5d94..8c05894 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 _0x430c=['Router','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addAgents','send','put','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','multer','connect-timeout','express'];(function(_0x867b0a,_0x587ccf){var _0x137438=function(_0xbeafa6){while(--_0xbeafa6){_0x867b0a['push'](_0x867b0a['shift']());}};_0x137438(++_0x587ccf);}(_0x430c,0x1a1));var _0xc430=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x430c[_0x648163];return _0x199d4d;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0x5')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0x5')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['getAnswers']);router[_0xc430('0x5')]('/:id/users',auth[_0xc430('0x8')](),controller[_0xc430('0xe')]);router[_0xc430('0x5')](_0xc430('0xf'),auth[_0xc430('0x8')](),controller[_0xc430('0x10')]);router[_0xc430('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc430('0x11')](_0xc430('0xc'),auth[_0xc430('0x8')](),controller[_0xc430('0x12')]);router[_0xc430('0x11')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['addAnswer']);router['post'](_0xc430('0x13'),auth[_0xc430('0x8')](),controller[_0xc430('0x14')]);router['post']('/:id/applications',auth[_0xc430('0x8')](),controller['addApplications']);router[_0xc430('0x11')]('/:id/notify',controller['notify']);router[_0xc430('0x11')]('/:id/send',auth[_0xc430('0x8')](),controller[_0xc430('0x15')]);router[_0xc430('0x16')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller['update']);router[_0xc430('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xc430('0x18')]);router[_0xc430('0x17')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0x19')]);router['delete'](_0xc430('0x1a'),auth[_0xc430('0x8')](),controller['removeAnswers']);router[_0xc430('0x17')](_0xc430('0x13'),auth['isAuthenticated'](),controller[_0xc430('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x6d38=['get','/describe','/:id','/:id/dispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','update','delete','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index'];(function(_0x456b77,_0x4fed12){var _0x118bb6=function(_0x2ea238){while(--_0x2ea238){_0x456b77['push'](_0x456b77['shift']());}};_0x118bb6(++_0x4fed12);}(_0x6d38,0x1ef));var _0x86d3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6d38[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['get'](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller['getDispositions']);router['get'](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['getAnswers']);router[_0x86d3('0x9')]('/:id/users',auth[_0x86d3('0x7')](),controller[_0x86d3('0xe')]);router[_0x86d3('0x9')](_0x86d3('0xf'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x10')]);router[_0x86d3('0x11')]('/',auth[_0x86d3('0x7')](),controller['create']);router[_0x86d3('0x11')](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x12')]);router[_0x86d3('0x11')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x13')]);router['post'](_0x86d3('0x14'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x15')]);router[_0x86d3('0x11')](_0x86d3('0xf'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x16')]);router[_0x86d3('0x11')](_0x86d3('0x17'),controller['notify']);router[_0x86d3('0x11')]('/:id/send',auth[_0x86d3('0x7')](),controller['send']);router['put'](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller[_0x86d3('0x18')]);router[_0x86d3('0x19')]('/:id',auth[_0x86d3('0x7')](),controller['destroy']);router[_0x86d3('0x19')](_0x86d3('0xc'),auth[_0x86d3('0x7')](),controller['removeDispositions']);router[_0x86d3('0x19')](_0x86d3('0xd'),auth[_0x86d3('0x7')](),controller['removeAnswers']);router['delete'](_0x86d3('0x14'),auth['isAuthenticated'](),controller[_0x86d3('0x1a')]);module[_0x86d3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 8d97405..1787cf0 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 _0x0c32=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','sinch'];(function(_0x46166e,_0x3ffa7e){var _0x3a5ab4=function(_0x2e220c){while(--_0x2e220c){_0x46166e['push'](_0x46166e['shift']());}};_0x3a5ab4(++_0x3ffa7e);}(_0x0c32,0xb8));var _0x20c3=function(_0x44e7a8,_0x222d08){_0x44e7a8=_0x44e7a8-0x0;var _0x1f34f7=_0x0c32[_0x44e7a8];return _0x1f34f7;};'use strict';var Sequelize=require(_0x20c3('0x0'));var rs=require(_0x20c3('0x1'));module[_0x20c3('0x2')]={'name':{'type':Sequelize[_0x20c3('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x20c3('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x20c3('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x20c3('0x3')],'defaultValue':function(){return rs[_0x20c3('0x4')]();}},'phone':{'type':Sequelize[_0x20c3('0x3')]},'type':{'type':Sequelize[_0x20c3('0x5')](_0x20c3('0x6'),_0x20c3('0x7'))},'accountSid':{'type':Sequelize[_0x20c3('0x3')]},'baseUrl':{'type':Sequelize[_0x20c3('0x3')]},'authToken':{'type':Sequelize[_0x20c3('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x20c3('0x8');}},'notificationSound':{'type':Sequelize[_0x20c3('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x20c3('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x20c3('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x20c3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x20c3('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x20c3('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x20c3('0xa')],'comment':_0x20c3('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x20c3('0xc'),'set':function(_0x1e4332){if(!_0x1e4332){this[_0x20c3('0xd')](_0x20c3('0xe'),null);}this['setDataValue'](_0x20c3('0xf'),_0x1e4332);}},'description':{'type':Sequelize[_0x20c3('0x3')]}}; \ No newline at end of file +var _0xe70b=['TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING','generate','ENUM','sinch'];(function(_0x2f597d,_0x32addb){var _0x28615a=function(_0xa06d14){while(--_0xa06d14){_0x2f597d['push'](_0x2f597d['shift']());}};_0x28615a(++_0x32addb);}(_0xe70b,0x170));var _0xbe70=function(_0x589c86,_0x2f3130){_0x589c86=_0x589c86-0x0;var _0xf50dc5=_0xe70b[_0x589c86];return _0xf50dc5;};'use strict';var Sequelize=require(_0xbe70('0x0'));var rs=require(_0xbe70('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xbe70('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xbe70('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xbe70('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xbe70('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbe70('0x5')]('twilio',_0xbe70('0x6'))},'accountSid':{'type':Sequelize[_0xbe70('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xbe70('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbe70('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbe70('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbe70('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbe70('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbe70('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xbe70('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xbe70('0x8')],'defaultValue':![],'comment':_0xbe70('0xb'),'set':function(_0x5c8d25){if(!_0x5c8d25){this[_0xbe70('0xc')](_0xbe70('0xd'),null);}this[_0xbe70('0xc')](_0xbe70('0xe'),_0x5c8d25);}},'description':{'type':Sequelize[_0xbe70('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index c43f29c..627c29c 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 _0x1d61=['nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','WhatsappAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','WhatsappAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','rawAttributes','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','User','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','notify','Applications','account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','Body','messageId','sinch','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','WhatsappInteraction','interaction','created','autoclose','push','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','debug','entity\x20found','text/xml','\x0a','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x56960f,_0x5bba63){var _0x467460=function(_0xf217c9){while(--_0xf217c9){_0x56960f['push'](_0x56960f['shift']());}};_0x467460(++_0x5bba63);}(_0x1d61,0x1f3));var _0x11d6=function(_0x34a31c,_0x6b580e){_0x34a31c=_0x34a31c-0x0;var _0x9472d5=_0x1d61[_0x34a31c];return _0x9472d5;};'use strict';var emlformat=require(_0x11d6('0x0'));var rimraf=require(_0x11d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x11d6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x11d6('0x3'));var util=require(_0x11d6('0x4'));var path=require(_0x11d6('0x5'));var sox=require(_0x11d6('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11d6('0x7'));var _=require(_0x11d6('0x8'));var squel=require(_0x11d6('0x9'));var crypto=require(_0x11d6('0xa'));var jsforce=require(_0x11d6('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x11d6('0xc'));var Redis=require(_0x11d6('0xd'));var authService=require(_0x11d6('0xe'));var qs=require(_0x11d6('0xf'));var as=require(_0x11d6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x11d6('0x11'))(_0x11d6('0x12'));var utils=require('../../config/utils');var config=require(_0x11d6('0x13'));var licenseUtil=require(_0x11d6('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x11d6('0x15')](config['redis'],{'host':_0x11d6('0x16'),'port':0x18eb});var socket=require(_0x11d6('0x17'))(new Redis(config['redis']));require(_0x11d6('0x18'))[_0x11d6('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x11d6('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x1281ab,_0x12c829,_0x198bf7,_0x2056ae){return new BPromise(function(_0xcf8742,_0x4f3ea6){var _0x2ff00e=_0x2056ae||client;return _0x2ff00e[_0x11d6('0x1b')](_0x1281ab,_0x198bf7)['then'](function(_0x2db341){logger[_0x11d6('0x1c')](_0x11d6('0x1d'),_0x12c829,_0x11d6('0x1e'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x12c829,'request\x20sent',JSON[_0x11d6('0x1f')](_0x2db341));if(_0x2db341[_0x11d6('0x20')]){if(_0x2db341['error'][_0x11d6('0x21')]===0x1f4){logger['error'](_0x11d6('0x1d'),_0x12c829,_0x2db341[_0x11d6('0x20')][_0x11d6('0x22')]);return _0x4f3ea6(_0x2db341[_0x11d6('0x20')][_0x11d6('0x22')]);}logger[_0x11d6('0x20')](_0x11d6('0x1d'),_0x12c829,_0x2db341[_0x11d6('0x20')]['message']);return _0xcf8742(_0x2db341[_0x11d6('0x20')]['message']);}else{logger[_0x11d6('0x1c')](_0x11d6('0x1d'),_0x12c829,_0x11d6('0x1e'));_0xcf8742(_0x2db341[_0x11d6('0x23')]['message']);}})[_0x11d6('0x24')](function(_0x537fda){logger[_0x11d6('0x20')](_0x11d6('0x1d'),_0x12c829,_0x537fda);_0x4f3ea6(_0x537fda);});});}function respondWithStatusCode(_0x10f290,_0x3503bc){_0x3503bc=_0x3503bc||0xcc;return function(_0x2016df){if(_0x2016df){return _0x10f290[_0x11d6('0x25')](_0x3503bc);}return _0x10f290[_0x11d6('0x26')](_0x3503bc)[_0x11d6('0x27')]();};}function respondWithResult(_0x217f7a,_0x3e9cfc){_0x3e9cfc=_0x3e9cfc||0xc8;return function(_0x98805d){if(_0x98805d){return _0x217f7a[_0x11d6('0x26')](_0x3e9cfc)[_0x11d6('0x28')](_0x98805d);}};}function respondWithFilteredResult(_0x4dcd67,_0x373726){return function(_0x20cebc){if(_0x20cebc){var _0x2ff300=typeof _0x373726[_0x11d6('0x29')]===_0x11d6('0x2a')&&typeof _0x373726[_0x11d6('0x2b')]===_0x11d6('0x2a');var _0x30e7f6=_0x20cebc[_0x11d6('0x2c')];var _0x42138d=_0x2ff300?0x0:_0x373726['offset'];var _0x494b7c=_0x2ff300?_0x20cebc[_0x11d6('0x2c')]:_0x373726[_0x11d6('0x29')]+_0x373726['limit'];var _0x54d352;if(_0x494b7c>=_0x30e7f6){_0x494b7c=_0x30e7f6;_0x54d352=0xc8;}else{_0x54d352=0xce;}_0x4dcd67[_0x11d6('0x26')](_0x54d352);return _0x4dcd67[_0x11d6('0x2d')](_0x11d6('0x2e'),_0x42138d+'-'+_0x494b7c+'/'+_0x30e7f6)[_0x11d6('0x28')](_0x20cebc);}return null;};}function patchUpdates(_0xad23c3){return function(_0x2400dc){try{jsonpatch['apply'](_0x2400dc,_0xad23c3,!![]);}catch(_0x23f4c2){return BPromise[_0x11d6('0x2f')](_0x23f4c2);}return _0x2400dc[_0x11d6('0x30')]();};}function saveUpdates(_0x1f17b9,_0x5720a4){return function(_0x296abb){if(_0x296abb){return _0x296abb[_0x11d6('0x31')](_0x1f17b9)[_0x11d6('0x32')](function(_0x338a41){return _0x338a41;});}return null;};}function removeEntity(_0x482b32,_0x5b4c77){return function(_0x401a14){if(_0x401a14){return _0x401a14[_0x11d6('0x33')]()[_0x11d6('0x32')](function(){var _0x1b3048=_0x401a14[_0x11d6('0x34')]({'plain':!![]});var _0x98b431='WhatsappAccounts';return db[_0x11d6('0x35')][_0x11d6('0x33')]({'where':{'type':_0x98b431,'resourceId':_0x1b3048['id']}})['then'](function(){return _0x401a14;});})[_0x11d6('0x32')](function(){_0x482b32['status'](0xcc)[_0x11d6('0x27')]();});}};}function handleEntityNotFound(_0x4ac30d,_0xd8e50f){return function(_0x5b6703){if(!_0x5b6703){_0x4ac30d[_0x11d6('0x25')](0x194);}return _0x5b6703;};}function handleError(_0x424895,_0x366bab){_0x366bab=_0x366bab||0x1f4;return function(_0x4ae0ee){logger['error'](_0x4ae0ee['stack']);if(_0x4ae0ee[_0x11d6('0x36')]){delete _0x4ae0ee['name'];}_0x424895[_0x11d6('0x26')](_0x366bab)[_0x11d6('0x37')](_0x4ae0ee);};}exports[_0x11d6('0x38')]=function(_0x3dda01,_0x18fda9){var _0xa53403={'include':[{'model':db[_0x11d6('0x39')],'as':_0x11d6('0x3a')}]},_0x132647={},_0x2c36f2={'count':0x0,'rows':[]};var _0x3e829d=_['map'](db[_0x11d6('0x3b')]['rawAttributes'],function(_0x3cafa7){return{'name':_0x3cafa7[_0x11d6('0x3c')],'type':_0x3cafa7[_0x11d6('0x3d')]['key']};});_0x132647['model']=_[_0x11d6('0x3e')](_0x3e829d,_0x11d6('0x36'));_0x132647[_0x11d6('0x3f')]=_[_0x11d6('0x40')](_0x3dda01[_0x11d6('0x3f')]);_0x132647['filters']=_[_0x11d6('0x41')](_0x132647[_0x11d6('0x42')],_0x132647[_0x11d6('0x3f')]);_0xa53403[_0x11d6('0x43')]=_[_0x11d6('0x41')](_0x132647[_0x11d6('0x42')],qs[_0x11d6('0x44')](_0x3dda01['query'][_0x11d6('0x44')]));_0xa53403[_0x11d6('0x43')]=_0xa53403[_0x11d6('0x43')][_0x11d6('0x45')]?_0xa53403[_0x11d6('0x43')]:_0x132647[_0x11d6('0x42')];if(!_0x3dda01[_0x11d6('0x3f')][_0x11d6('0x46')](_0x11d6('0x47'))){_0xa53403[_0x11d6('0x2b')]=qs['limit'](_0x3dda01[_0x11d6('0x3f')][_0x11d6('0x2b')]);_0xa53403[_0x11d6('0x29')]=qs['offset'](_0x3dda01[_0x11d6('0x3f')][_0x11d6('0x29')]);}_0xa53403[_0x11d6('0x48')]=qs[_0x11d6('0x49')](_0x3dda01[_0x11d6('0x3f')]['sort']);_0xa53403[_0x11d6('0x4a')]=qs[_0x11d6('0x4b')](_[_0x11d6('0x4c')](_0x3dda01[_0x11d6('0x3f')],_0x132647[_0x11d6('0x4b')]),_0x3e829d);if(_0x3dda01[_0x11d6('0x3f')][_0x11d6('0x4d')]){_0xa53403['where']=_[_0x11d6('0x4e')](_0xa53403[_0x11d6('0x4a')],{'$or':_[_0x11d6('0x3e')](_0x3e829d,function(_0x66ee75){if(_0x66ee75[_0x11d6('0x3d')]!==_0x11d6('0x4f')){var _0x43e48c={};_0x43e48c[_0x66ee75[_0x11d6('0x36')]]={'$like':'%'+_0x3dda01['query'][_0x11d6('0x4d')]+'%'};return _0x43e48c;}})});}_0xa53403=_[_0x11d6('0x4e')]({},_0xa53403,_0x3dda01[_0x11d6('0x50')]);var _0x2e9b56={'where':_0xa53403['where']};return db[_0x11d6('0x3b')][_0x11d6('0x2c')](_0x2e9b56)[_0x11d6('0x32')](function(_0x302be8){_0x2c36f2[_0x11d6('0x2c')]=_0x302be8;if(_0x3dda01[_0x11d6('0x3f')][_0x11d6('0x51')]){_0xa53403[_0x11d6('0x52')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0xa53403);})['then'](function(_0xbc9f1f){_0x2c36f2[_0x11d6('0x53')]=_0xbc9f1f;return _0x2c36f2;})[_0x11d6('0x32')](respondWithFilteredResult(_0x18fda9,_0xa53403))[_0x11d6('0x24')](handleError(_0x18fda9,null));};exports[_0x11d6('0x54')]=function(_0x5f09e6,_0x44a80c){var _0x782c9d={'raw':![],'where':{'id':_0x5f09e6[_0x11d6('0x55')]['id']},'include':[{'model':db[_0x11d6('0x39')],'as':'mandatoryDispositionPause'}]},_0x39979a={};_0x39979a[_0x11d6('0x42')]=_[_0x11d6('0x40')](db['WhatsappAccount']['rawAttributes']);_0x39979a['query']=_[_0x11d6('0x40')](_0x5f09e6[_0x11d6('0x3f')]);_0x39979a[_0x11d6('0x4b')]=_[_0x11d6('0x41')](_0x39979a['model'],_0x39979a['query']);_0x782c9d['attributes']=_['intersection'](_0x39979a[_0x11d6('0x42')],qs[_0x11d6('0x44')](_0x5f09e6[_0x11d6('0x3f')][_0x11d6('0x44')]));_0x782c9d[_0x11d6('0x43')]=_0x782c9d['attributes'][_0x11d6('0x45')]?_0x782c9d[_0x11d6('0x43')]:_0x39979a[_0x11d6('0x42')];if(_0x5f09e6[_0x11d6('0x3f')][_0x11d6('0x51')]){_0x782c9d[_0x11d6('0x52')]=[{'all':!![]}];}_0x782c9d=_[_0x11d6('0x4e')]({},_0x782c9d,_0x5f09e6[_0x11d6('0x50')]);return db[_0x11d6('0x3b')][_0x11d6('0x56')](_0x782c9d)[_0x11d6('0x32')](handleEntityNotFound(_0x44a80c,null))[_0x11d6('0x32')](respondWithResult(_0x44a80c,null))[_0x11d6('0x24')](handleError(_0x44a80c,null));};exports[_0x11d6('0x57')]=function(_0x34a576,_0x155791){return db['WhatsappAccount'][_0x11d6('0x57')](_0x34a576[_0x11d6('0x58')],{})[_0x11d6('0x32')](function(_0xb69d8a){var _0x6ba055=_0x34a576['user']['get']({'plain':!![]});if(!_0x6ba055)throw new Error(_0x11d6('0x59'));if(_0x6ba055[_0x11d6('0x5a')]===_0x11d6('0x5b')){var _0x281f8c=_0xb69d8a['get']({'plain':!![]});var _0x5a839e=_0x11d6('0x5c');return db[_0x11d6('0x5d')]['find']({'where':{'name':_0x5a839e,'userProfileId':_0x6ba055[_0x11d6('0x5e')]},'raw':!![]})[_0x11d6('0x32')](function(_0x570a56){if(_0x570a56&&_0x570a56['autoAssociation']===0x0){return db[_0x11d6('0x35')][_0x11d6('0x57')]({'name':_0x281f8c['name'],'resourceId':_0x281f8c['id'],'type':_0x570a56['name'],'sectionId':_0x570a56['id']},{})[_0x11d6('0x32')](function(){return _0xb69d8a;});}else{return _0xb69d8a;}})[_0x11d6('0x24')](function(_0x5499cf){logger['error'](_0x11d6('0x5f'),_0x5499cf);throw _0x5499cf;});}return _0xb69d8a;})[_0x11d6('0x32')](respondWithResult(_0x155791,0xc9))[_0x11d6('0x24')](handleError(_0x155791,null));};exports[_0x11d6('0x31')]=function(_0x498f8a,_0x405c0d){if(_0x498f8a[_0x11d6('0x58')]['id']){delete _0x498f8a['body']['id'];}return db[_0x11d6('0x3b')]['find']({'where':{'id':_0x498f8a[_0x11d6('0x55')]['id']},'include':[{'model':db[_0x11d6('0x39')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x405c0d,null))[_0x11d6('0x32')](saveUpdates(_0x498f8a[_0x11d6('0x58')],null))[_0x11d6('0x32')](respondWithResult(_0x405c0d,null))[_0x11d6('0x24')](handleError(_0x405c0d,null));};exports[_0x11d6('0x33')]=function(_0x17a968,_0x1a77e2){return db['WhatsappAccount'][_0x11d6('0x56')]({'where':{'id':_0x17a968[_0x11d6('0x55')]['id']}})[_0x11d6('0x32')](handleEntityNotFound(_0x1a77e2,null))['then'](removeEntity(_0x1a77e2,null))[_0x11d6('0x24')](handleError(_0x1a77e2,null));};exports[_0x11d6('0x60')]=function(_0x256dc7,_0x504ae4){return db[_0x11d6('0x3b')][_0x11d6('0x60')]()[_0x11d6('0x32')](respondWithResult(_0x504ae4,null))[_0x11d6('0x24')](handleError(_0x504ae4,null));};exports['addDisposition']=function(_0xfe42ae,_0x260dda,_0x18be3c){if(_0xfe42ae[_0x11d6('0x58')]['id']){delete _0xfe42ae[_0x11d6('0x58')]['id'];}return db[_0x11d6('0x3b')][_0x11d6('0x56')]({'where':{'id':_0xfe42ae[_0x11d6('0x55')]['id']}})[_0x11d6('0x32')](handleEntityNotFound(_0x260dda,null))['then'](function(_0x1cdbce){if(_0x1cdbce){_0xfe42ae[_0x11d6('0x58')]['WhatsappAccountId']=_0x1cdbce['id'];return db[_0x11d6('0x61')][_0x11d6('0x57')](_0xfe42ae[_0x11d6('0x58')]);}})['then'](respondWithResult(_0x260dda,null))['catch'](handleError(_0x260dda,null));};exports[_0x11d6('0x62')]=function(_0x4e6830,_0x3bb075,_0x476101){var _0x1cc9f6={'raw':![],'where':{}};var _0x49d8d8={};var _0x3a084d={'count':0x0,'rows':[]};return db[_0x11d6('0x3b')][_0x11d6('0x63')]({'where':{'id':_0x4e6830[_0x11d6('0x55')]['id']}})[_0x11d6('0x32')](handleEntityNotFound(_0x3bb075,null))[_0x11d6('0x32')](function(_0x2d4d25){if(_0x2d4d25){_0x49d8d8['model']=_[_0x11d6('0x40')](db['Disposition']['rawAttributes']);_0x49d8d8[_0x11d6('0x3f')]=_[_0x11d6('0x40')](_0x4e6830[_0x11d6('0x3f')]);_0x49d8d8[_0x11d6('0x4b')]=_[_0x11d6('0x41')](_0x49d8d8[_0x11d6('0x42')],_0x49d8d8[_0x11d6('0x3f')]);_0x1cc9f6[_0x11d6('0x43')]=_['intersection'](_0x49d8d8[_0x11d6('0x42')],qs[_0x11d6('0x44')](_0x4e6830[_0x11d6('0x3f')][_0x11d6('0x44')]));_0x1cc9f6['attributes']=_0x1cc9f6[_0x11d6('0x43')][_0x11d6('0x45')]?_0x1cc9f6[_0x11d6('0x43')]:_0x49d8d8[_0x11d6('0x42')];if(!_0x4e6830[_0x11d6('0x3f')][_0x11d6('0x46')](_0x11d6('0x47'))){_0x1cc9f6['limit']=qs[_0x11d6('0x2b')](_0x4e6830['query'][_0x11d6('0x2b')]);_0x1cc9f6['offset']=qs[_0x11d6('0x29')](_0x4e6830[_0x11d6('0x3f')]['offset']);}_0x1cc9f6['order']=qs[_0x11d6('0x49')](_0x4e6830[_0x11d6('0x3f')][_0x11d6('0x49')]);_0x1cc9f6[_0x11d6('0x4a')]=qs['filters'](_[_0x11d6('0x4c')](_0x4e6830[_0x11d6('0x3f')],_0x49d8d8[_0x11d6('0x4b')]));_0x1cc9f6[_0x11d6('0x4a')][_0x11d6('0x64')]=_0x2d4d25['id'];if(_0x4e6830[_0x11d6('0x3f')][_0x11d6('0x4d')]){_0x1cc9f6[_0x11d6('0x4a')]=_[_0x11d6('0x4e')](_0x1cc9f6[_0x11d6('0x4a')],{'$or':_[_0x11d6('0x3e')](_0x1cc9f6[_0x11d6('0x43')],function(_0x51a1d8){var _0x32f73e={};_0x32f73e[_0x51a1d8]={'$like':'%'+_0x4e6830[_0x11d6('0x3f')][_0x11d6('0x4d')]+'%'};return _0x32f73e;})});}_0x1cc9f6=_[_0x11d6('0x4e')]({},_0x1cc9f6,_0x4e6830[_0x11d6('0x50')]);return db['Disposition'][_0x11d6('0x2c')]({'where':_0x1cc9f6[_0x11d6('0x4a')]})[_0x11d6('0x32')](function(_0x27671e){_0x3a084d['count']=_0x27671e;if(_0x4e6830[_0x11d6('0x3f')][_0x11d6('0x51')]){_0x1cc9f6[_0x11d6('0x52')]=[{'all':!![]}];}return db['Disposition'][_0x11d6('0x65')](_0x1cc9f6);})[_0x11d6('0x32')](function(_0x3df1db){_0x3a084d[_0x11d6('0x53')]=_0x3df1db;return _0x3a084d;});}})['then'](respondWithFilteredResult(_0x3bb075,_0x1cc9f6))[_0x11d6('0x24')](handleError(_0x3bb075,null));};exports[_0x11d6('0x66')]=function(_0x14aecd,_0x3ddadc,_0x238049){return db[_0x11d6('0x3b')][_0x11d6('0x56')]({'where':{'id':_0x14aecd[_0x11d6('0x55')]['id']}})[_0x11d6('0x32')](handleEntityNotFound(_0x3ddadc,null))['then'](function(_0x346859){if(_0x346859){return _0x346859['removeDispositions'](_0x14aecd[_0x11d6('0x3f')][_0x11d6('0x67')]);}})[_0x11d6('0x32')](respondWithStatusCode(_0x3ddadc,null))['catch'](handleError(_0x3ddadc,null));};exports[_0x11d6('0x68')]=function(_0x504151,_0x114317,_0x2c870d){if(_0x504151[_0x11d6('0x58')]['id']){delete _0x504151[_0x11d6('0x58')]['id'];}return db['WhatsappAccount'][_0x11d6('0x56')]({'where':{'id':_0x504151['params']['id']}})[_0x11d6('0x32')](handleEntityNotFound(_0x114317,null))[_0x11d6('0x32')](function(_0x2eb8f9){if(_0x2eb8f9){_0x504151[_0x11d6('0x58')][_0x11d6('0x64')]=_0x2eb8f9['id'];return db[_0x11d6('0x69')]['create'](_0x504151[_0x11d6('0x58')]);}})[_0x11d6('0x32')](respondWithResult(_0x114317,null))[_0x11d6('0x24')](handleError(_0x114317,null));};exports['getAnswers']=function(_0x2d8965,_0x7b380a,_0x148814){var _0x5d4995={'raw':![],'where':{}};var _0x4bbfd8={};var _0x945754={'count':0x0,'rows':[]};return db[_0x11d6('0x3b')][_0x11d6('0x63')]({'where':{'id':_0x2d8965[_0x11d6('0x55')]['id']}})['then'](handleEntityNotFound(_0x7b380a,null))[_0x11d6('0x32')](function(_0x40dc06){if(_0x40dc06){_0x4bbfd8[_0x11d6('0x42')]=_[_0x11d6('0x40')](db['CannedAnswer'][_0x11d6('0x6a')]);_0x4bbfd8[_0x11d6('0x3f')]=_[_0x11d6('0x40')](_0x2d8965[_0x11d6('0x3f')]);_0x4bbfd8[_0x11d6('0x4b')]=_[_0x11d6('0x41')](_0x4bbfd8[_0x11d6('0x42')],_0x4bbfd8[_0x11d6('0x3f')]);_0x5d4995[_0x11d6('0x43')]=_[_0x11d6('0x41')](_0x4bbfd8['model'],qs[_0x11d6('0x44')](_0x2d8965[_0x11d6('0x3f')][_0x11d6('0x44')]));_0x5d4995['attributes']=_0x5d4995[_0x11d6('0x43')][_0x11d6('0x45')]?_0x5d4995[_0x11d6('0x43')]:_0x4bbfd8['model'];if(!_0x2d8965[_0x11d6('0x3f')][_0x11d6('0x46')](_0x11d6('0x47'))){_0x5d4995[_0x11d6('0x2b')]=qs[_0x11d6('0x2b')](_0x2d8965['query'][_0x11d6('0x2b')]);_0x5d4995[_0x11d6('0x29')]=qs[_0x11d6('0x29')](_0x2d8965[_0x11d6('0x3f')][_0x11d6('0x29')]);}_0x5d4995[_0x11d6('0x48')]=qs['sort'](_0x2d8965['query'][_0x11d6('0x49')]);_0x5d4995[_0x11d6('0x4a')]=qs[_0x11d6('0x4b')](_[_0x11d6('0x4c')](_0x2d8965['query'],_0x4bbfd8['filters']));_0x5d4995[_0x11d6('0x4a')][_0x11d6('0x64')]=_0x40dc06['id'];if(_0x2d8965[_0x11d6('0x3f')][_0x11d6('0x4d')]){_0x5d4995[_0x11d6('0x4a')]=_[_0x11d6('0x4e')](_0x5d4995[_0x11d6('0x4a')],{'$or':_[_0x11d6('0x3e')](_0x5d4995['attributes'],function(_0x56e490){var _0x398976={};_0x398976[_0x56e490]={'$like':'%'+_0x2d8965[_0x11d6('0x3f')][_0x11d6('0x4d')]+'%'};return _0x398976;})});}_0x5d4995=_[_0x11d6('0x4e')]({},_0x5d4995,_0x2d8965[_0x11d6('0x50')]);return db[_0x11d6('0x69')]['count']({'where':_0x5d4995[_0x11d6('0x4a')]})[_0x11d6('0x32')](function(_0x5a1296){_0x945754[_0x11d6('0x2c')]=_0x5a1296;if(_0x2d8965[_0x11d6('0x3f')][_0x11d6('0x51')]){_0x5d4995[_0x11d6('0x52')]=[{'all':!![]}];}return db[_0x11d6('0x69')]['findAll'](_0x5d4995);})[_0x11d6('0x32')](function(_0x1e0617){_0x945754[_0x11d6('0x53')]=_0x1e0617;return _0x945754;});}})[_0x11d6('0x32')](respondWithFilteredResult(_0x7b380a,_0x5d4995))[_0x11d6('0x24')](handleError(_0x7b380a,null));};exports[_0x11d6('0x6b')]=function(_0x1f62d0,_0xb7e4ff,_0x1682f9){return db[_0x11d6('0x3b')]['find']({'where':{'id':_0x1f62d0[_0x11d6('0x55')]['id']}})[_0x11d6('0x32')](handleEntityNotFound(_0xb7e4ff,null))['then'](function(_0x2c7096){if(_0x2c7096){return _0x2c7096['removeAnswers'](_0x1f62d0[_0x11d6('0x3f')][_0x11d6('0x67')]);}})[_0x11d6('0x32')](respondWithStatusCode(_0xb7e4ff,null))[_0x11d6('0x24')](handleError(_0xb7e4ff,null));};exports['addAgents']=function(_0x84079d,_0x10e74a,_0x23119c){return db[_0x11d6('0x3b')][_0x11d6('0x56')]({'where':{'id':_0x84079d['params']['id']}})[_0x11d6('0x32')](handleEntityNotFound(_0x10e74a,null))[_0x11d6('0x32')](function(_0x4ef6b1){if(_0x4ef6b1){return _0x4ef6b1[_0x11d6('0x6c')](_0x84079d[_0x11d6('0x58')][_0x11d6('0x67')],_[_0x11d6('0x6d')](_0x84079d[_0x11d6('0x58')],[_0x11d6('0x67'),'id'])||{})[_0x11d6('0x6e')](function(_0x490227){for(var _0x44e0f7=0x0;_0x44e0f7<_0x84079d[_0x11d6('0x58')]['ids'][_0x11d6('0x45')];_0x44e0f7+=0x1){socket['emit'](_0x11d6('0x6f'),{'UserId':Number(_0x84079d[_0x11d6('0x58')][_0x11d6('0x67')][_0x44e0f7]),'WhatsappAccountId':Number(_0x84079d['params']['id'])});}return _0x490227;});}})['then'](respondWithResult(_0x10e74a,null))['catch'](handleError(_0x10e74a,null));};exports[_0x11d6('0x70')]=function(_0x2bff23,_0x1cfa43,_0x52cd4a){return db[_0x11d6('0x3b')][_0x11d6('0x56')]({'where':{'id':_0x2bff23[_0x11d6('0x55')]['id']}})['then'](handleEntityNotFound(_0x1cfa43,null))[_0x11d6('0x32')](function(_0x570c08){if(_0x570c08){return _0x570c08[_0x11d6('0x70')](_0x2bff23[_0x11d6('0x3f')]['ids'])[_0x11d6('0x32')](function(){if(_['isArray'](_0x2bff23[_0x11d6('0x3f')][_0x11d6('0x67')])){for(var _0x548175=0x0;_0x548175<_0x2bff23[_0x11d6('0x3f')]['ids']['length'];_0x548175+=0x1){socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x2bff23[_0x11d6('0x3f')][_0x11d6('0x67')][_0x548175]),'WhatsappAccountId':Number(_0x2bff23[_0x11d6('0x55')]['id'])});}}else{socket['emit'](_0x11d6('0x71'),{'UserId':Number(_0x2bff23[_0x11d6('0x3f')][_0x11d6('0x67')]),'WhatsappAccountId':Number(_0x2bff23[_0x11d6('0x55')]['id'])});}});}})[_0x11d6('0x32')](respondWithStatusCode(_0x1cfa43,null))['catch'](handleError(_0x1cfa43,null));};exports['getAgents']=function(_0x2e3d7e,_0x588352,_0x2a2351){var _0x588f21={};var _0x7fa42a={};var _0x33d087;var _0x27da84;return db['WhatsappAccount'][_0x11d6('0x63')]({'where':{'id':_0x2e3d7e[_0x11d6('0x55')]['id']}})['then'](handleEntityNotFound(_0x588352,null))[_0x11d6('0x32')](function(_0x16c368){if(_0x16c368){_0x33d087=_0x16c368;_0x7fa42a[_0x11d6('0x42')]=_[_0x11d6('0x40')](db[_0x11d6('0x72')]['rawAttributes']);_0x7fa42a[_0x11d6('0x3f')]=_[_0x11d6('0x40')](_0x2e3d7e[_0x11d6('0x3f')]);_0x7fa42a[_0x11d6('0x4b')]=_['intersection'](_0x7fa42a[_0x11d6('0x42')],_0x7fa42a[_0x11d6('0x3f')]);_0x588f21['attributes']=_[_0x11d6('0x41')](_0x7fa42a[_0x11d6('0x42')],qs[_0x11d6('0x44')](_0x2e3d7e[_0x11d6('0x3f')][_0x11d6('0x44')]));_0x588f21[_0x11d6('0x43')]=_0x588f21['attributes']['length']?_0x588f21[_0x11d6('0x43')]:_0x7fa42a[_0x11d6('0x42')];_0x588f21[_0x11d6('0x48')]=qs[_0x11d6('0x49')](_0x2e3d7e[_0x11d6('0x3f')][_0x11d6('0x49')]);_0x588f21['where']=qs['filters'](_['pick'](_0x2e3d7e[_0x11d6('0x3f')],_0x7fa42a[_0x11d6('0x4b')]));if(_0x2e3d7e[_0x11d6('0x3f')][_0x11d6('0x4d')]){_0x588f21['where']=_[_0x11d6('0x4e')](_0x588f21[_0x11d6('0x4a')],{'$or':_['map'](_0x588f21[_0x11d6('0x43')],function(_0x42de45){var _0x32fac2={};_0x32fac2[_0x42de45]={'$like':'%'+_0x2e3d7e[_0x11d6('0x3f')][_0x11d6('0x4d')]+'%'};return _0x32fac2;})});}_0x588f21=_[_0x11d6('0x4e')]({},_0x588f21,_0x2e3d7e[_0x11d6('0x50')]);return _0x33d087['getAgents'](_0x588f21);}})['then'](function(_0x50fc2f){if(_0x50fc2f){_0x27da84=_0x50fc2f['length'];if(!_0x2e3d7e[_0x11d6('0x3f')]['hasOwnProperty'](_0x11d6('0x47'))){_0x588f21[_0x11d6('0x2b')]=qs[_0x11d6('0x2b')](_0x2e3d7e['query'][_0x11d6('0x2b')]);_0x588f21[_0x11d6('0x29')]=qs[_0x11d6('0x29')](_0x2e3d7e[_0x11d6('0x3f')][_0x11d6('0x29')]);}return _0x33d087['getAgents'](_0x588f21);}})[_0x11d6('0x32')](function(_0xf6b3da){if(_0xf6b3da){return _0xf6b3da?{'count':_0x27da84,'rows':_0xf6b3da}:null;}})['then'](respondWithResult(_0x588352,null))[_0x11d6('0x24')](handleError(_0x588352,null));};exports[_0x11d6('0x73')]=function(_0x47dc0d,_0x80e5f){var _0x15b8fd=_0x47dc0d['params']['id'];var _0xc7071=_0x47dc0d[_0x11d6('0x58')];var _0x5665fa=0xc8;var _0x1ab243=null;return db[_0x11d6('0x74')][_0x11d6('0x75')]({'isolationLevel':db[_0x11d6('0x74')]['Transaction'][_0x11d6('0x76')][_0x11d6('0x77')]},function(_0x214b7e){return db[_0x11d6('0x3b')][_0x11d6('0x63')]({'where':{'id':_0x15b8fd},'transaction':_0x214b7e})[_0x11d6('0x32')](function(_0x2bed4a){if(_0x2bed4a){return db['WhatsappApplication'][_0x11d6('0x33')]({'where':{'WhatsappAccountId':_0x15b8fd},'transaction':_0x214b7e})[_0x11d6('0x32')](function(){var _0x52c772=_[_0x11d6('0x3e')](_0xc7071,function(_0x402b8c){_0x402b8c[_0x11d6('0x64')]=_0x15b8fd;return _0x402b8c;});return db[_0x11d6('0x78')][_0x11d6('0x79')](_0x52c772,{'transaction':_0x214b7e});});}else{_0x5665fa=0x194;_0x1ab243=[];}});})[_0x11d6('0x32')](function(){if(_0x5665fa!==0x194){return db['WhatsappApplication'][_0x11d6('0x7a')]({'where':{'WhatsappAccountId':_0x15b8fd},'order':_0x11d6('0x7b')})['then'](function(_0x4206a4){_0x1ab243=_0x4206a4;});}})['catch'](function(_0x4bc62b){_0x5665fa=0x1f4;logger[_0x11d6('0x20')](_0x4bc62b[_0x11d6('0x7c')]);if(_0x4bc62b[_0x11d6('0x36')]){delete _0x4bc62b[_0x11d6('0x36')];}_0x1ab243=_0x4bc62b;})[_0x11d6('0x7d')](function(){if(_0x1ab243===null){_0x80e5f[_0x11d6('0x25')](_0x5665fa);}else{if(_0x5665fa===0x1f4){_0x80e5f[_0x11d6('0x26')](_0x5665fa)[_0x11d6('0x37')](_0x1ab243);}else{_0x80e5f[_0x11d6('0x26')](_0x5665fa)[_0x11d6('0x28')](_0x1ab243);}}});};exports['getApplications']=function(_0x33b75d,_0x34adc9,_0x4afae4){var _0x4bbd2d={};var _0xad22d5={};var _0xb67447;var _0x539853;return db['WhatsappAccount'][_0x11d6('0x63')]({'where':{'id':_0x33b75d[_0x11d6('0x55')]['id']}})['then'](handleEntityNotFound(_0x34adc9,null))[_0x11d6('0x32')](function(_0x3f1abc){if(_0x3f1abc){_0xb67447=_0x3f1abc;_0xad22d5['model']=_[_0x11d6('0x40')](db[_0x11d6('0x78')][_0x11d6('0x6a')]);_0xad22d5[_0x11d6('0x3f')]=_[_0x11d6('0x40')](_0x33b75d['query']);_0xad22d5[_0x11d6('0x4b')]=_[_0x11d6('0x41')](_0xad22d5[_0x11d6('0x42')],_0xad22d5[_0x11d6('0x3f')]);_0x4bbd2d[_0x11d6('0x43')]=_[_0x11d6('0x41')](_0xad22d5[_0x11d6('0x42')],qs[_0x11d6('0x44')](_0x33b75d[_0x11d6('0x3f')]['fields']));_0x4bbd2d[_0x11d6('0x43')]=_0x4bbd2d[_0x11d6('0x43')][_0x11d6('0x45')]?_0x4bbd2d['attributes']:_0xad22d5[_0x11d6('0x42')];_0x4bbd2d['order']=qs[_0x11d6('0x49')](_0x33b75d[_0x11d6('0x3f')]['sort']);_0x4bbd2d[_0x11d6('0x4a')]=qs[_0x11d6('0x4b')](_['pick'](_0x33b75d[_0x11d6('0x3f')],_0xad22d5['filters']));if(_0x33b75d[_0x11d6('0x3f')][_0x11d6('0x4d')]){_0x4bbd2d[_0x11d6('0x4a')]=_[_0x11d6('0x4e')](_0x4bbd2d[_0x11d6('0x4a')],{'$or':_[_0x11d6('0x3e')](_0x4bbd2d['attributes'],function(_0x45c497){var _0x16d28c={};_0x16d28c[_0x45c497]={'$like':'%'+_0x33b75d[_0x11d6('0x3f')]['filter']+'%'};return _0x16d28c;})});}_0x4bbd2d=_['merge']({},_0x4bbd2d,_0x33b75d[_0x11d6('0x50')]);return _0xb67447[_0x11d6('0x7e')](_0x4bbd2d);}})[_0x11d6('0x32')](function(_0xfc87ad){if(_0xfc87ad){_0x539853=_0xfc87ad['length'];if(!_0x33b75d[_0x11d6('0x3f')][_0x11d6('0x46')](_0x11d6('0x47'))){_0x4bbd2d[_0x11d6('0x2b')]=qs[_0x11d6('0x2b')](_0x33b75d[_0x11d6('0x3f')][_0x11d6('0x2b')]);_0x4bbd2d[_0x11d6('0x29')]=qs[_0x11d6('0x29')](_0x33b75d[_0x11d6('0x3f')][_0x11d6('0x29')]);}return _0xb67447[_0x11d6('0x7e')](_0x4bbd2d);}})['then'](function(_0x1306a7){if(_0x1306a7){return _0x1306a7?{'count':_0x539853,'rows':_0x1306a7}:null;}})[_0x11d6('0x32')](respondWithResult(_0x34adc9,null))[_0x11d6('0x24')](handleError(_0x34adc9,null));};exports[_0x11d6('0x7f')]=function(_0x25ff8f,_0x284f42,_0x290991){var _0x565d0a={'channel':'whatsapp'};var _0x5c67d4=[];var _0x437f06=[];var _0x845bbc={};return db[_0x11d6('0x3b')][_0x11d6('0x56')]({'where':{'id':_0x25ff8f[_0x11d6('0x55')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x11d6('0x80')}]})['then'](handleEntityNotFound(_0x284f42,null))[_0x11d6('0x32')](function(_0x4fd519){_0x565d0a[_0x11d6('0x81')]=_0x4fd519;if(_0x565d0a[_0x11d6('0x81')]&&_0x565d0a[_0x11d6('0x81')]['type']==='sinch'&&_0x25ff8f[_0x11d6('0x58')]['statuses']){if(_0x25ff8f['body'][_0x11d6('0x82')][_0x11d6('0x45')]===0x0)return;if(_0x25ff8f[_0x11d6('0x58')][_0x11d6('0x82')][0x0][_0x11d6('0x83')]!==_0x11d6('0x84'))return;return db[_0x11d6('0x85')][_0x11d6('0x31')]({'read':!![],'readAt':_0x25ff8f[_0x11d6('0x58')][_0x11d6('0x82')][0x0][_0x11d6('0x86')]},{'where':{'messageId':_0x25ff8f['body']['statuses'][0x0][_0x11d6('0x87')]},'individualHooks':!![]})['then'](function(_0x2c6b80){return _0x284f42[_0x11d6('0x26')](0xc8)[_0x11d6('0x28')](_0x2c6b80);});}_0x565d0a[_0x11d6('0x88')]=_[_0x11d6('0x89')](_0x4fd519[_0x11d6('0x80')],[_0x11d6('0x7b')],[_0x11d6('0x8a')]);if(_0x565d0a[_0x11d6('0x81')][_0x11d6('0x80')]){delete _0x565d0a[_0x11d6('0x81')][_0x11d6('0x80')];}return db[_0x11d6('0x8b')][_0x11d6('0x60')]()[_0x11d6('0x32')](function(_0x30dcca){if(!_0x30dcca){throw new db[(_0x11d6('0x8c'))][(_0x11d6('0x8d'))]('no\x20available\x20attributes');}_0x5c67d4=_[_0x11d6('0x8e')](_[_0x11d6('0x40')](_0x30dcca),[_0x11d6('0x8f'),_0x11d6('0x90')]);_0x437f06=_[_0x11d6('0x8e')](_[_0x11d6('0x40')](_0x30dcca),[_0x11d6('0x8f'),_0x11d6('0x90'),_0x11d6('0x91'),_0x11d6('0x92')]);_0x565d0a[_0x11d6('0x58')]={'mapKey':_0x11d6('0x93')};if(_0x565d0a[_0x11d6('0x81')]&&_0x565d0a['account'][_0x11d6('0x3d')]===_0x11d6('0x94')){_0x565d0a['body'][_0x11d6('0x95')]=_0x25ff8f['body'][_0x11d6('0x96')][_0x11d6('0x97')]('whatsapp:','');_0x565d0a[_0x11d6('0x58')]['body']=_0x25ff8f[_0x11d6('0x58')][_0x11d6('0x98')];_0x565d0a[_0x11d6('0x58')][_0x11d6('0x99')]=_0x25ff8f[_0x11d6('0x58')]['MessageSid'];}if(_0x565d0a[_0x11d6('0x81')]&&_0x565d0a['account'][_0x11d6('0x3d')]===_0x11d6('0x9a')){_0x565d0a['body'][_0x11d6('0x95')]=_0x25ff8f[_0x11d6('0x58')][_0x11d6('0x9b')][0x0]['from'];_0x565d0a[_0x11d6('0x58')][_0x11d6('0x58')]=_0x25ff8f[_0x11d6('0x58')][_0x11d6('0x9b')][0x0][_0x11d6('0x22')][_0x11d6('0x58')];_0x565d0a[_0x11d6('0x58')]['messageId']=_0x25ff8f[_0x11d6('0x58')][_0x11d6('0x9b')][0x0][_0x11d6('0x87')];}if(_0x565d0a[_0x11d6('0x58')]['id']){delete _0x565d0a[_0x11d6('0x58')]['id'];}if(_[_0x11d6('0x9c')](_0x565d0a['body'][_0x11d6('0x95')])){throw new db[(_0x11d6('0x8c'))][(_0x11d6('0x8d'))](_0x11d6('0x9d'));}if(_[_0x11d6('0x9c')](_0x565d0a['body'][_0x11d6('0x58')])||_0x565d0a[_0x11d6('0x58')][_0x11d6('0x58')]===''){throw new db[(_0x11d6('0x8c'))]['ValidationError'](_0x11d6('0x9e'));}if(_[_0x11d6('0x9c')](_0x565d0a['body'][_0x11d6('0x9f')])){throw new db[(_0x11d6('0x8c'))][(_0x11d6('0x8d'))](_0x11d6('0xa0')+_0x437f06);}if(!_[_0x11d6('0xa1')](_0x437f06,_0x565d0a[_0x11d6('0x58')][_0x11d6('0x9f')])){throw new db['Sequelize'][(_0x11d6('0x8d'))](_0x11d6('0xa2')+_0x437f06);}_0x845bbc[_0x565d0a['body']['mapKey']]=_0x565d0a[_0x11d6('0x58')][_0x11d6('0x95')];return db[_0x11d6('0xa3')]['find']({'where':{'id':_0x565d0a['account'][_0x11d6('0x92')]},'include':[{'model':db[_0x11d6('0x8b')],'as':_0x11d6('0xa4'),'where':_0x845bbc,'limit':0x1,'order':[[_0x11d6('0x90'),_0x11d6('0xa5')]]}]});})[_0x11d6('0x32')](handleEntityNotFound(_0x284f42,null))[_0x11d6('0x32')](function(_0x1c10f0){if(_0x1c10f0){_0x565d0a[_0x11d6('0xa6')]=_[_0x11d6('0x6d')](_0x1c10f0,['Contacts']);if(_0x1c10f0[_0x11d6('0xa4')]['length']){return _0x1c10f0['Contacts'][0x0];}var _0x514aa6=_[_0x11d6('0x15')](_0x565d0a[_0x11d6('0x58')],{'firstName':_0x565d0a[_0x11d6('0x58')]['from'],'ListId':_0x1c10f0['id']});_0x514aa6[_0x565d0a[_0x11d6('0x58')][_0x11d6('0x9f')]]=_0x565d0a[_0x11d6('0x58')][_0x11d6('0x95')];return db[_0x11d6('0x8b')]['create'](_0x514aa6,{'fields':_0x5c67d4,'raw':!![]});}})['then'](handleEntityNotFound(_0x284f42,null))[_0x11d6('0x32')](function(_0x1d33d0){if(_0x1d33d0){_0x565d0a['contact']=_0x1d33d0;var _0x2d6c13={'ContactId':_0x1d33d0['id'],'phone':_0x565d0a['body']['from'],'WhatsappAccountId':_0x25ff8f[_0x11d6('0x55')]['id']};var _0x3e71b6={'ContactId':_0x1d33d0['id'],'WhatsappAccountId':_0x25ff8f[_0x11d6('0x55')]['id'],'closed':![]};return db[_0x11d6('0xa7')][_0x11d6('0x56')]({'where':_0x3e71b6})[_0x11d6('0x32')](function(_0x60035f){if(_0x60035f){return[_0x60035f,![]];}return db[_0x11d6('0xa7')][_0x11d6('0x57')](_0x2d6c13)['then'](function(_0x4b6d56){return[_0x4b6d56,!![]];});});}})[_0x11d6('0x6e')](function(_0x1eeccd,_0x228adc){_0x565d0a['interaction']=_0x1eeccd[_0x11d6('0x34')]({'plain':!![]});_0x565d0a[_0x11d6('0xa8')][_0x11d6('0xa9')]=![];if(_0x228adc){if(_0x565d0a[_0x11d6('0x81')][_0x11d6('0xaa')]){_0x565d0a[_0x11d6('0x88')][_0x11d6('0xab')]({'id':0x0,'priority':_0x565d0a[_0x11d6('0x88')][_0x11d6('0x45')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x11d6('0xac')});}_0x565d0a[_0x11d6('0xa8')][_0x11d6('0xa9')]=!![];}return db['WhatsappMessage'][_0x11d6('0x57')]({'phone':_0x565d0a[_0x11d6('0x58')]['from'],'messageId':_0x565d0a['body'][_0x11d6('0x99')],'body':_0x565d0a['body'][_0x11d6('0x58')],'WhatsappAccountId':_0x25ff8f[_0x11d6('0x55')]['id'],'WhatsappInteractionId':_0x1eeccd['id'],'direction':'in','ContactId':_0x1eeccd[_0x11d6('0xad')],'AttachmentId':_0x565d0a[_0x11d6('0x58')][_0x11d6('0xae')]});})[_0x11d6('0x32')](function(_0x345316){_0x565d0a[_0x11d6('0x22')]=_0x345316;if(_0x565d0a[_0x11d6('0xa8')]['UserId']){return db[_0x11d6('0x72')][_0x11d6('0x56')]({'attributes':['id',_0x11d6('0x36')],'where':{'id':_0x565d0a[_0x11d6('0xa8')][_0x11d6('0xaf')]}})[_0x11d6('0x32')](function(_0x2bee4a){if(_0x2bee4a){_0x565d0a[_0x11d6('0x88')][_0x11d6('0xb0')]({'id':0x0,'priority':0x0,'app':_0x11d6('0xb1'),'appdata':_0x2bee4a[_0x11d6('0x36')]+','+(_0x565d0a[_0x11d6('0x81')][_0x11d6('0xb2')]||0xa),'interval':_0x11d6('0xac')});}return respondWithRpcPromise('Start',_0x11d6('0xb3'),_0x565d0a);});}return respondWithRpcPromise(_0x11d6('0xb4'),_0x11d6('0xb3'),_0x565d0a);})[_0x11d6('0x32')](function(_0x2d0ece){if(_0x2d0ece){var _0x1fa1ff=0xc8;var _0x7852d7=_0x11d6('0xb5');logger[_0x11d6('0x1c')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x7852d7,_0x1fa1ff,'entity\x20found');logger[_0x11d6('0xb6')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x7852d7,_0x1fa1ff,_0x11d6('0xb7'),JSON['stringify'](_0x2d0ece));if(_0x565d0a[_0x11d6('0x81')][_0x11d6('0x3d')]===_0x11d6('0x94')){return _0x284f42[_0x11d6('0x26')](_0x1fa1ff)[_0x11d6('0x2d')]('Content-Type',_0x11d6('0xb8'))[_0x11d6('0x37')](_0x11d6('0xb9'));}else{return _0x284f42['status'](_0x1fa1ff)[_0x11d6('0x28')](_0x2d0ece);}}});})[_0x11d6('0x24')](handleError(_0x284f42,null));};exports[_0x11d6('0x37')]=function(_0x15780c,_0x204a30,_0x225ec6){var _0x3b6a0a,_0x17b98d,_0x72f90f;if(_[_0x11d6('0x9c')](_0x15780c['body']['body'])||_0x15780c[_0x11d6('0x58')][_0x11d6('0x58')]===''){throw new db['Sequelize'][(_0x11d6('0x8d'))](_0x11d6('0x9e'));}if(_[_0x11d6('0x9c')](_0x15780c[_0x11d6('0x58')]['to'])){throw new db[(_0x11d6('0x8c'))][(_0x11d6('0x8d'))]('to\x20is\x20mandatory');}_0x3b6a0a=_0x15780c[_0x11d6('0x58')]['to'];return db['WhatsappAccount'][_0x11d6('0x56')]({'where':{'id':_0x15780c[_0x11d6('0x55')]['id']},'include':[{'model':db[_0x11d6('0xa3')],'as':_0x11d6('0xba'),'include':[{'model':db[_0x11d6('0x8b')],'as':_0x11d6('0xa4'),'where':{'mobile':_0x3b6a0a},'limit':0x1,'order':[[_0x11d6('0x90'),_0x11d6('0xa5')]]}]}]})[_0x11d6('0x32')](handleEntityNotFound(_0x204a30,null))[_0x11d6('0x32')](function(_0x3330bd){if(_0x3330bd&&_0x3330bd[_0x11d6('0xba')]){_0x17b98d=_0x3330bd[_0x11d6('0x34')]({'plain':!![]});if(_0x17b98d['List']&&_0x17b98d[_0x11d6('0xba')]['Contacts']['length']){return _0x17b98d[_0x11d6('0xba')]['Contacts'][0x0];}return db[_0x11d6('0x8b')][_0x11d6('0x57')](_[_0x11d6('0x15')](_0x15780c['body'],{'firstName':_0x3b6a0a,'mobile':_0x3b6a0a,'phone':_0x3b6a0a,'ListId':_0x17b98d[_0x11d6('0x92')]}));}})['then'](handleEntityNotFound(_0x204a30,null))[_0x11d6('0x32')](function(_0x4f937c){if(_0x4f937c){_0x72f90f=_0x4f937c;return db[_0x11d6('0xa7')]['find']({'where':{'ContactId':_0x72f90f['id'],'closed':![],'WhatsappAccountId':_0x17b98d['id']}})[_0x11d6('0x32')](function(_0xd0b23d){if(_0xd0b23d){return[_0xd0b23d,![]];}return db['WhatsappInteraction'][_0x11d6('0x57')]({'UserId':_0x15780c[_0x11d6('0x5b')]['id'],'ContactId':_0x72f90f['id'],'WhatsappAccountId':_0x17b98d['id'],'phone':_0x3b6a0a,'firstMsgDirection':_0x11d6('0xbb'),'Messages':[_['merge'](_0x15780c[_0x11d6('0x58')],{'read':![],'body':_0x15780c[_0x11d6('0x58')][_0x11d6('0x58')],'phone':_0x3b6a0a,'WhatsappAccountId':_0x17b98d['id'],'UserId':_0x15780c[_0x11d6('0x5b')]['id'],'ContactId':_0x72f90f['id']})]},{'include':[{'model':db[_0x11d6('0x85')],'as':_0x11d6('0xbc')}]})[_0x11d6('0x32')](function(_0x3fe35c){return[_0x3fe35c,!![]];});});}})[_0x11d6('0x6e')](function(_0x29126a,_0x1c206f){if(_0x1c206f){return _0x29126a;}return db[_0x11d6('0x85')][_0x11d6('0x57')](_[_0x11d6('0x4e')](_0x15780c[_0x11d6('0x58')],{'read':![],'body':_0x15780c['body'][_0x11d6('0x58')],'phone':_0x3b6a0a,'WhatsappAccountId':_0x17b98d['id'],'WhatsappInteractionId':_0x29126a['id'],'UserId':_0x15780c[_0x11d6('0x5b')]['id'],'ContactId':_0x72f90f['id']}))[_0x11d6('0x32')](function(_0x29ab02){_0x29126a[_0x11d6('0xbd')]['Messages']=[];_0x29126a[_0x11d6('0xbd')]['Messages']['push'](_0x29ab02[_0x11d6('0xbd')]);return _0x29126a;});})[_0x11d6('0x32')](respondWithResult(_0x204a30,null))['catch'](handleError(_0x204a30,null));}; \ No newline at end of file +var _0x32c7=['created','ContactId','AttachmentId','UserId','agent','Start','startRouting','receiveMessage','entity\x20found','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','DESC','List','WhatsappInteraction','out','Messages','dataValues','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','localhost','./whatsappAccount.socket','register','jayson/promise','http','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','WhatsappAccounts','sendStatus','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','Pause','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','getDispositions','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','findOne','User','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','CmContact','Contacts','list','contact','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x32c7,0x19e));var _0x732c=function(_0x9e377,_0x119bcf){_0x9e377=_0x9e377-0x0;var _0x531f1f=_0x32c7[_0x9e377];return _0x531f1f;};'use strict';var emlformat=require(_0x732c('0x0'));var rimraf=require(_0x732c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x732c('0x2'));var moment=require(_0x732c('0x3'));var BPromise=require(_0x732c('0x4'));var Mustache=require('mustache');var util=require(_0x732c('0x5'));var path=require(_0x732c('0x6'));var sox=require(_0x732c('0x7'));var csv=require(_0x732c('0x8'));var ejs=require(_0x732c('0x9'));var fs=require('fs');var fs_extra=require(_0x732c('0xa'));var _=require(_0x732c('0xb'));var squel=require(_0x732c('0xc'));var crypto=require('crypto');var jsforce=require(_0x732c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x732c('0x8'));var querystring=require(_0x732c('0xe'));var Papa=require(_0x732c('0xf'));var Redis=require(_0x732c('0x10'));var authService=require(_0x732c('0x11'));var qs=require(_0x732c('0x12'));var as=require(_0x732c('0x13'));var hardwareService=require(_0x732c('0x14'));var logger=require('../../config/logger')(_0x732c('0x15'));var utils=require('../../config/utils');var config=require(_0x732c('0x16'));var licenseUtil=require(_0x732c('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x732c('0x18')](config[_0x732c('0x19')],{'host':_0x732c('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x732c('0x19')]));require(_0x732c('0x1b'))[_0x732c('0x1c')](socket);var jayson=require(_0x732c('0x1d'));var client=jayson['client'][_0x732c('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x5556a2,_0x4d14e0,_0x514ea7,_0x2548ba){return new BPromise(function(_0x4bedac,_0x1f0af5){var _0x8591b4=_0x2548ba||client;return _0x8591b4[_0x732c('0x1f')](_0x5556a2,_0x514ea7)['then'](function(_0x412b0c){logger[_0x732c('0x20')](_0x732c('0x21'),_0x4d14e0,_0x732c('0x22'));logger[_0x732c('0x23')](_0x732c('0x24'),_0x4d14e0,_0x732c('0x22'),JSON[_0x732c('0x25')](_0x412b0c));if(_0x412b0c[_0x732c('0x26')]){if(_0x412b0c['error'][_0x732c('0x27')]===0x1f4){logger['error'](_0x732c('0x21'),_0x4d14e0,_0x412b0c[_0x732c('0x26')]['message']);return _0x1f0af5(_0x412b0c[_0x732c('0x26')][_0x732c('0x28')]);}logger['error'](_0x732c('0x21'),_0x4d14e0,_0x412b0c[_0x732c('0x26')][_0x732c('0x28')]);return _0x4bedac(_0x412b0c[_0x732c('0x26')][_0x732c('0x28')]);}else{logger[_0x732c('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x4d14e0,'request\x20sent');_0x4bedac(_0x412b0c[_0x732c('0x29')][_0x732c('0x28')]);}})[_0x732c('0x2a')](function(_0x3cb972){logger[_0x732c('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x4d14e0,_0x3cb972);_0x1f0af5(_0x3cb972);});});}function respondWithStatusCode(_0x1ed949,_0x1bcbab){_0x1bcbab=_0x1bcbab||0xcc;return function(_0x162c03){if(_0x162c03){return _0x1ed949['sendStatus'](_0x1bcbab);}return _0x1ed949[_0x732c('0x2b')](_0x1bcbab)[_0x732c('0x2c')]();};}function respondWithResult(_0x10126c,_0x2e1cff){_0x2e1cff=_0x2e1cff||0xc8;return function(_0x49d946){if(_0x49d946){return _0x10126c[_0x732c('0x2b')](_0x2e1cff)[_0x732c('0x2d')](_0x49d946);}};}function respondWithFilteredResult(_0x2a701b,_0x42c50e){return function(_0x3ffcfc){if(_0x3ffcfc){var _0x468ce0=typeof _0x42c50e[_0x732c('0x2e')]===_0x732c('0x2f')&&typeof _0x42c50e[_0x732c('0x30')]==='undefined';var _0x1f502b=_0x3ffcfc['count'];var _0x1d3b52=_0x468ce0?0x0:_0x42c50e['offset'];var _0x4e65bc=_0x468ce0?_0x3ffcfc[_0x732c('0x31')]:_0x42c50e[_0x732c('0x2e')]+_0x42c50e['limit'];var _0x3100e0;if(_0x4e65bc>=_0x1f502b){_0x4e65bc=_0x1f502b;_0x3100e0=0xc8;}else{_0x3100e0=0xce;}_0x2a701b['status'](_0x3100e0);return _0x2a701b['set']('Content-Range',_0x1d3b52+'-'+_0x4e65bc+'/'+_0x1f502b)[_0x732c('0x2d')](_0x3ffcfc);}return null;};}function patchUpdates(_0x439b29){return function(_0x5adbe1){try{jsonpatch[_0x732c('0x32')](_0x5adbe1,_0x439b29,!![]);}catch(_0x3e3fe6){return BPromise[_0x732c('0x33')](_0x3e3fe6);}return _0x5adbe1[_0x732c('0x34')]();};}function saveUpdates(_0x20fb8c,_0x349920){return function(_0x47eece){if(_0x47eece){return _0x47eece[_0x732c('0x35')](_0x20fb8c)[_0x732c('0x36')](function(_0x32d48c){return _0x32d48c;});}return null;};}function removeEntity(_0x5ccbbb,_0x2da11b){return function(_0xb3e292){if(_0xb3e292){return _0xb3e292[_0x732c('0x37')]()[_0x732c('0x36')](function(){var _0x17c0b3=_0xb3e292[_0x732c('0x38')]({'plain':!![]});var _0x1a3b03=_0x732c('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x1a3b03,'resourceId':_0x17c0b3['id']}})[_0x732c('0x36')](function(){return _0xb3e292;});})['then'](function(){_0x5ccbbb[_0x732c('0x2b')](0xcc)[_0x732c('0x2c')]();});}};}function handleEntityNotFound(_0x474d13,_0x4cbef6){return function(_0xcfc29c){if(!_0xcfc29c){_0x474d13[_0x732c('0x3a')](0x194);}return _0xcfc29c;};}function handleError(_0x479d91,_0xc5c850){_0xc5c850=_0xc5c850||0x1f4;return function(_0x5e9a69){logger[_0x732c('0x26')](_0x5e9a69[_0x732c('0x3b')]);if(_0x5e9a69[_0x732c('0x3c')]){delete _0x5e9a69[_0x732c('0x3c')];}_0x479d91[_0x732c('0x2b')](_0xc5c850)['send'](_0x5e9a69);};}exports[_0x732c('0x3d')]=function(_0x3d1525,_0x4c54d9){var _0x2f7b29={'include':[{'model':db['Pause'],'as':_0x732c('0x3e')}]},_0x42f56e={},_0x416842={'count':0x0,'rows':[]};var _0x50c739=_[_0x732c('0x3f')](db[_0x732c('0x40')][_0x732c('0x41')],function(_0x3e8b67){return{'name':_0x3e8b67['fieldName'],'type':_0x3e8b67[_0x732c('0x42')]['key']};});_0x42f56e[_0x732c('0x43')]=_['map'](_0x50c739,'name');_0x42f56e[_0x732c('0x44')]=_['keys'](_0x3d1525[_0x732c('0x44')]);_0x42f56e[_0x732c('0x45')]=_[_0x732c('0x46')](_0x42f56e['model'],_0x42f56e['query']);_0x2f7b29[_0x732c('0x47')]=_[_0x732c('0x46')](_0x42f56e['model'],qs[_0x732c('0x48')](_0x3d1525['query'][_0x732c('0x48')]));_0x2f7b29[_0x732c('0x47')]=_0x2f7b29[_0x732c('0x47')][_0x732c('0x49')]?_0x2f7b29[_0x732c('0x47')]:_0x42f56e[_0x732c('0x43')];if(!_0x3d1525[_0x732c('0x44')][_0x732c('0x4a')](_0x732c('0x4b'))){_0x2f7b29[_0x732c('0x30')]=qs['limit'](_0x3d1525['query'][_0x732c('0x30')]);_0x2f7b29['offset']=qs['offset'](_0x3d1525[_0x732c('0x44')][_0x732c('0x2e')]);}_0x2f7b29['order']=qs[_0x732c('0x4c')](_0x3d1525['query']['sort']);_0x2f7b29['where']=qs['filters'](_[_0x732c('0x4d')](_0x3d1525['query'],_0x42f56e['filters']),_0x50c739);if(_0x3d1525['query']['filter']){_0x2f7b29[_0x732c('0x4e')]=_[_0x732c('0x4f')](_0x2f7b29['where'],{'$or':_['map'](_0x50c739,function(_0x8035d){if(_0x8035d[_0x732c('0x42')]!==_0x732c('0x50')){var _0x4e515e={};_0x4e515e[_0x8035d[_0x732c('0x3c')]]={'$like':'%'+_0x3d1525['query'][_0x732c('0x51')]+'%'};return _0x4e515e;}})});}_0x2f7b29=_[_0x732c('0x4f')]({},_0x2f7b29,_0x3d1525[_0x732c('0x52')]);var _0x181a2e={'where':_0x2f7b29['where']};return db['WhatsappAccount'][_0x732c('0x31')](_0x181a2e)[_0x732c('0x36')](function(_0x4a5025){_0x416842[_0x732c('0x31')]=_0x4a5025;if(_0x3d1525[_0x732c('0x44')][_0x732c('0x53')]){_0x2f7b29['include']=[{'all':!![]}];}return db[_0x732c('0x40')][_0x732c('0x54')](_0x2f7b29);})[_0x732c('0x36')](function(_0x42b9e8){_0x416842['rows']=_0x42b9e8;return _0x416842;})[_0x732c('0x36')](respondWithFilteredResult(_0x4c54d9,_0x2f7b29))['catch'](handleError(_0x4c54d9,null));};exports[_0x732c('0x55')]=function(_0x3c8fe1,_0x4cf4a0){var _0x3deb7a={'raw':![],'where':{'id':_0x3c8fe1[_0x732c('0x56')]['id']},'include':[{'model':db[_0x732c('0x57')],'as':_0x732c('0x3e')}]},_0x3e6501={};_0x3e6501['model']=_[_0x732c('0x58')](db[_0x732c('0x40')][_0x732c('0x41')]);_0x3e6501[_0x732c('0x44')]=_[_0x732c('0x58')](_0x3c8fe1[_0x732c('0x44')]);_0x3e6501['filters']=_['intersection'](_0x3e6501[_0x732c('0x43')],_0x3e6501[_0x732c('0x44')]);_0x3deb7a['attributes']=_[_0x732c('0x46')](_0x3e6501[_0x732c('0x43')],qs[_0x732c('0x48')](_0x3c8fe1[_0x732c('0x44')]['fields']));_0x3deb7a[_0x732c('0x47')]=_0x3deb7a[_0x732c('0x47')][_0x732c('0x49')]?_0x3deb7a['attributes']:_0x3e6501['model'];if(_0x3c8fe1[_0x732c('0x44')][_0x732c('0x53')]){_0x3deb7a[_0x732c('0x59')]=[{'all':!![]}];}_0x3deb7a=_[_0x732c('0x4f')]({},_0x3deb7a,_0x3c8fe1[_0x732c('0x52')]);return db['WhatsappAccount'][_0x732c('0x5a')](_0x3deb7a)[_0x732c('0x36')](handleEntityNotFound(_0x4cf4a0,null))[_0x732c('0x36')](respondWithResult(_0x4cf4a0,null))[_0x732c('0x2a')](handleError(_0x4cf4a0,null));};exports[_0x732c('0x5b')]=function(_0x5985bc,_0x29e9df){return db[_0x732c('0x40')][_0x732c('0x5b')](_0x5985bc['body'],{})['then'](function(_0x518ff3){var _0x42c9bf=_0x5985bc[_0x732c('0x5c')][_0x732c('0x38')]({'plain':!![]});if(!_0x42c9bf)throw new Error(_0x732c('0x5d'));if(_0x42c9bf[_0x732c('0x5e')]===_0x732c('0x5c')){var _0x2c2d63=_0x518ff3[_0x732c('0x38')]({'plain':!![]});var _0x4837bc=_0x732c('0x39');return db[_0x732c('0x5f')][_0x732c('0x5a')]({'where':{'name':_0x4837bc,'userProfileId':_0x42c9bf[_0x732c('0x60')]},'raw':!![]})[_0x732c('0x36')](function(_0x1b1f66){if(_0x1b1f66&&_0x1b1f66[_0x732c('0x61')]===0x0){return db[_0x732c('0x62')][_0x732c('0x5b')]({'name':_0x2c2d63[_0x732c('0x3c')],'resourceId':_0x2c2d63['id'],'type':_0x1b1f66[_0x732c('0x3c')],'sectionId':_0x1b1f66['id']},{})['then'](function(){return _0x518ff3;});}else{return _0x518ff3;}})['catch'](function(_0x252e0d){logger[_0x732c('0x26')](_0x732c('0x63'),_0x252e0d);throw _0x252e0d;});}return _0x518ff3;})['then'](respondWithResult(_0x29e9df,0xc9))['catch'](handleError(_0x29e9df,null));};exports[_0x732c('0x35')]=function(_0x3e7025,_0x4a3a95){if(_0x3e7025[_0x732c('0x64')]['id']){delete _0x3e7025['body']['id'];}return db[_0x732c('0x40')][_0x732c('0x5a')]({'where':{'id':_0x3e7025[_0x732c('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4a3a95,null))[_0x732c('0x36')](saveUpdates(_0x3e7025[_0x732c('0x64')],null))['then'](respondWithResult(_0x4a3a95,null))[_0x732c('0x2a')](handleError(_0x4a3a95,null));};exports['destroy']=function(_0x277750,_0x1354e4){return db[_0x732c('0x40')]['find']({'where':{'id':_0x277750[_0x732c('0x56')]['id']}})['then'](handleEntityNotFound(_0x1354e4,null))['then'](removeEntity(_0x1354e4,null))['catch'](handleError(_0x1354e4,null));};exports[_0x732c('0x65')]=function(_0x3e3aaa,_0x2f6182){return db[_0x732c('0x40')]['describe']()[_0x732c('0x36')](respondWithResult(_0x2f6182,null))[_0x732c('0x2a')](handleError(_0x2f6182,null));};exports['addDisposition']=function(_0x2e5774,_0x4a8fab,_0x2bdf5a){if(_0x2e5774[_0x732c('0x64')]['id']){delete _0x2e5774['body']['id'];}return db['WhatsappAccount'][_0x732c('0x5a')]({'where':{'id':_0x2e5774['params']['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x4a8fab,null))[_0x732c('0x36')](function(_0x488d6f){if(_0x488d6f){_0x2e5774['body'][_0x732c('0x66')]=_0x488d6f['id'];return db[_0x732c('0x67')][_0x732c('0x5b')](_0x2e5774[_0x732c('0x64')]);}})[_0x732c('0x36')](respondWithResult(_0x4a8fab,null))[_0x732c('0x2a')](handleError(_0x4a8fab,null));};exports[_0x732c('0x68')]=function(_0x382e9b,_0x34c11f,_0x5804ee){var _0x166d49={'raw':![],'where':{}};var _0x5d6414={};var _0x550fad={'count':0x0,'rows':[]};return db[_0x732c('0x40')]['findOne']({'where':{'id':_0x382e9b[_0x732c('0x56')]['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x34c11f,null))[_0x732c('0x36')](function(_0x5cf583){if(_0x5cf583){_0x5d6414['model']=_[_0x732c('0x58')](db[_0x732c('0x67')][_0x732c('0x41')]);_0x5d6414[_0x732c('0x44')]=_[_0x732c('0x58')](_0x382e9b['query']);_0x5d6414[_0x732c('0x45')]=_[_0x732c('0x46')](_0x5d6414[_0x732c('0x43')],_0x5d6414[_0x732c('0x44')]);_0x166d49[_0x732c('0x47')]=_[_0x732c('0x46')](_0x5d6414[_0x732c('0x43')],qs[_0x732c('0x48')](_0x382e9b[_0x732c('0x44')][_0x732c('0x48')]));_0x166d49[_0x732c('0x47')]=_0x166d49[_0x732c('0x47')][_0x732c('0x49')]?_0x166d49['attributes']:_0x5d6414['model'];if(!_0x382e9b['query']['hasOwnProperty'](_0x732c('0x4b'))){_0x166d49[_0x732c('0x30')]=qs['limit'](_0x382e9b[_0x732c('0x44')][_0x732c('0x30')]);_0x166d49[_0x732c('0x2e')]=qs[_0x732c('0x2e')](_0x382e9b['query'][_0x732c('0x2e')]);}_0x166d49[_0x732c('0x69')]=qs[_0x732c('0x4c')](_0x382e9b[_0x732c('0x44')][_0x732c('0x4c')]);_0x166d49[_0x732c('0x4e')]=qs['filters'](_[_0x732c('0x4d')](_0x382e9b[_0x732c('0x44')],_0x5d6414['filters']));_0x166d49[_0x732c('0x4e')][_0x732c('0x66')]=_0x5cf583['id'];if(_0x382e9b[_0x732c('0x44')][_0x732c('0x51')]){_0x166d49[_0x732c('0x4e')]=_[_0x732c('0x4f')](_0x166d49[_0x732c('0x4e')],{'$or':_[_0x732c('0x3f')](_0x166d49[_0x732c('0x47')],function(_0x31ab01){var _0x40f710={};_0x40f710[_0x31ab01]={'$like':'%'+_0x382e9b[_0x732c('0x44')][_0x732c('0x51')]+'%'};return _0x40f710;})});}_0x166d49=_[_0x732c('0x4f')]({},_0x166d49,_0x382e9b[_0x732c('0x52')]);return db[_0x732c('0x67')][_0x732c('0x31')]({'where':_0x166d49[_0x732c('0x4e')]})[_0x732c('0x36')](function(_0x202062){_0x550fad[_0x732c('0x31')]=_0x202062;if(_0x382e9b['query'][_0x732c('0x53')]){_0x166d49[_0x732c('0x59')]=[{'all':!![]}];}return db[_0x732c('0x67')][_0x732c('0x54')](_0x166d49);})[_0x732c('0x36')](function(_0xf52233){_0x550fad[_0x732c('0x6a')]=_0xf52233;return _0x550fad;});}})[_0x732c('0x36')](respondWithFilteredResult(_0x34c11f,_0x166d49))[_0x732c('0x2a')](handleError(_0x34c11f,null));};exports[_0x732c('0x6b')]=function(_0x1610aa,_0x26c7db,_0x31f594){return db[_0x732c('0x40')][_0x732c('0x5a')]({'where':{'id':_0x1610aa[_0x732c('0x56')]['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x26c7db,null))[_0x732c('0x36')](function(_0x3d019d){if(_0x3d019d){return _0x3d019d['removeDispositions'](_0x1610aa[_0x732c('0x44')][_0x732c('0x6c')]);}})[_0x732c('0x36')](respondWithStatusCode(_0x26c7db,null))['catch'](handleError(_0x26c7db,null));};exports[_0x732c('0x6d')]=function(_0x1dd0b7,_0x55645f,_0x539698){if(_0x1dd0b7[_0x732c('0x64')]['id']){delete _0x1dd0b7[_0x732c('0x64')]['id'];}return db['WhatsappAccount'][_0x732c('0x5a')]({'where':{'id':_0x1dd0b7[_0x732c('0x56')]['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x55645f,null))['then'](function(_0x4685b0){if(_0x4685b0){_0x1dd0b7['body'][_0x732c('0x66')]=_0x4685b0['id'];return db['CannedAnswer'][_0x732c('0x5b')](_0x1dd0b7[_0x732c('0x64')]);}})[_0x732c('0x36')](respondWithResult(_0x55645f,null))[_0x732c('0x2a')](handleError(_0x55645f,null));};exports['getAnswers']=function(_0x22983f,_0x4b67c0,_0x2f5f03){var _0x568d34={'raw':![],'where':{}};var _0x28c972={};var _0x4202c9={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x22983f[_0x732c('0x56')]['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x4b67c0,null))[_0x732c('0x36')](function(_0x3c26e4){if(_0x3c26e4){_0x28c972[_0x732c('0x43')]=_['keys'](db[_0x732c('0x6e')][_0x732c('0x41')]);_0x28c972['query']=_[_0x732c('0x58')](_0x22983f[_0x732c('0x44')]);_0x28c972[_0x732c('0x45')]=_[_0x732c('0x46')](_0x28c972['model'],_0x28c972['query']);_0x568d34['attributes']=_[_0x732c('0x46')](_0x28c972[_0x732c('0x43')],qs[_0x732c('0x48')](_0x22983f[_0x732c('0x44')][_0x732c('0x48')]));_0x568d34[_0x732c('0x47')]=_0x568d34['attributes'][_0x732c('0x49')]?_0x568d34[_0x732c('0x47')]:_0x28c972[_0x732c('0x43')];if(!_0x22983f[_0x732c('0x44')][_0x732c('0x4a')](_0x732c('0x4b'))){_0x568d34['limit']=qs['limit'](_0x22983f[_0x732c('0x44')][_0x732c('0x30')]);_0x568d34[_0x732c('0x2e')]=qs[_0x732c('0x2e')](_0x22983f['query'][_0x732c('0x2e')]);}_0x568d34[_0x732c('0x69')]=qs[_0x732c('0x4c')](_0x22983f[_0x732c('0x44')][_0x732c('0x4c')]);_0x568d34['where']=qs[_0x732c('0x45')](_['pick'](_0x22983f[_0x732c('0x44')],_0x28c972['filters']));_0x568d34['where']['WhatsappAccountId']=_0x3c26e4['id'];if(_0x22983f[_0x732c('0x44')][_0x732c('0x51')]){_0x568d34['where']=_[_0x732c('0x4f')](_0x568d34['where'],{'$or':_[_0x732c('0x3f')](_0x568d34[_0x732c('0x47')],function(_0x4ba04c){var _0x522640={};_0x522640[_0x4ba04c]={'$like':'%'+_0x22983f['query'][_0x732c('0x51')]+'%'};return _0x522640;})});}_0x568d34=_[_0x732c('0x4f')]({},_0x568d34,_0x22983f[_0x732c('0x52')]);return db[_0x732c('0x6e')][_0x732c('0x31')]({'where':_0x568d34[_0x732c('0x4e')]})[_0x732c('0x36')](function(_0x10fdeb){_0x4202c9[_0x732c('0x31')]=_0x10fdeb;if(_0x22983f['query'][_0x732c('0x53')]){_0x568d34[_0x732c('0x59')]=[{'all':!![]}];}return db[_0x732c('0x6e')][_0x732c('0x54')](_0x568d34);})[_0x732c('0x36')](function(_0x12e358){_0x4202c9[_0x732c('0x6a')]=_0x12e358;return _0x4202c9;});}})[_0x732c('0x36')](respondWithFilteredResult(_0x4b67c0,_0x568d34))[_0x732c('0x2a')](handleError(_0x4b67c0,null));};exports[_0x732c('0x6f')]=function(_0x18c984,_0x42abe1,_0x568623){return db['WhatsappAccount'][_0x732c('0x5a')]({'where':{'id':_0x18c984[_0x732c('0x56')]['id']}})['then'](handleEntityNotFound(_0x42abe1,null))[_0x732c('0x36')](function(_0x5efa5e){if(_0x5efa5e){return _0x5efa5e['removeAnswers'](_0x18c984['query'][_0x732c('0x6c')]);}})[_0x732c('0x36')](respondWithStatusCode(_0x42abe1,null))[_0x732c('0x2a')](handleError(_0x42abe1,null));};exports[_0x732c('0x70')]=function(_0x500d6d,_0x1d53b3,_0x2aaa18){return db[_0x732c('0x40')][_0x732c('0x5a')]({'where':{'id':_0x500d6d['params']['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x1d53b3,null))['then'](function(_0x458858){if(_0x458858){return _0x458858['addAgents'](_0x500d6d[_0x732c('0x64')]['ids'],_['omit'](_0x500d6d['body'],[_0x732c('0x6c'),'id'])||{})['spread'](function(_0x4cfd6b){for(var _0x5c0c7e=0x0;_0x5c0c7e<_0x500d6d['body']['ids'][_0x732c('0x49')];_0x5c0c7e+=0x1){socket[_0x732c('0x71')]('userWhatsappAccount:save',{'UserId':Number(_0x500d6d[_0x732c('0x64')][_0x732c('0x6c')][_0x5c0c7e]),'WhatsappAccountId':Number(_0x500d6d['params']['id'])});}return _0x4cfd6b;});}})[_0x732c('0x36')](respondWithResult(_0x1d53b3,null))[_0x732c('0x2a')](handleError(_0x1d53b3,null));};exports[_0x732c('0x72')]=function(_0x464f14,_0x347d18,_0x3790d7){return db[_0x732c('0x40')]['find']({'where':{'id':_0x464f14[_0x732c('0x56')]['id']}})['then'](handleEntityNotFound(_0x347d18,null))['then'](function(_0x5eb733){if(_0x5eb733){return _0x5eb733[_0x732c('0x72')](_0x464f14['query']['ids'])[_0x732c('0x36')](function(){if(_[_0x732c('0x73')](_0x464f14['query']['ids'])){for(var _0x57ab96=0x0;_0x57ab96<_0x464f14[_0x732c('0x44')][_0x732c('0x6c')][_0x732c('0x49')];_0x57ab96+=0x1){socket[_0x732c('0x71')](_0x732c('0x74'),{'UserId':Number(_0x464f14['query']['ids'][_0x57ab96]),'WhatsappAccountId':Number(_0x464f14['params']['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x464f14[_0x732c('0x44')][_0x732c('0x6c')]),'WhatsappAccountId':Number(_0x464f14[_0x732c('0x56')]['id'])});}});}})[_0x732c('0x36')](respondWithStatusCode(_0x347d18,null))[_0x732c('0x2a')](handleError(_0x347d18,null));};exports[_0x732c('0x75')]=function(_0x2d42e2,_0x4f7d7d,_0x7dde62){var _0x393b48={};var _0x420e14={};var _0x4b5f07;var _0x26b81a;return db['WhatsappAccount'][_0x732c('0x76')]({'where':{'id':_0x2d42e2['params']['id']}})['then'](handleEntityNotFound(_0x4f7d7d,null))[_0x732c('0x36')](function(_0x4722a1){if(_0x4722a1){_0x4b5f07=_0x4722a1;_0x420e14[_0x732c('0x43')]=_['keys'](db[_0x732c('0x77')]['rawAttributes']);_0x420e14['query']=_[_0x732c('0x58')](_0x2d42e2[_0x732c('0x44')]);_0x420e14['filters']=_[_0x732c('0x46')](_0x420e14[_0x732c('0x43')],_0x420e14[_0x732c('0x44')]);_0x393b48['attributes']=_[_0x732c('0x46')](_0x420e14['model'],qs[_0x732c('0x48')](_0x2d42e2[_0x732c('0x44')][_0x732c('0x48')]));_0x393b48[_0x732c('0x47')]=_0x393b48[_0x732c('0x47')]['length']?_0x393b48[_0x732c('0x47')]:_0x420e14['model'];_0x393b48['order']=qs[_0x732c('0x4c')](_0x2d42e2[_0x732c('0x44')][_0x732c('0x4c')]);_0x393b48[_0x732c('0x4e')]=qs[_0x732c('0x45')](_[_0x732c('0x4d')](_0x2d42e2[_0x732c('0x44')],_0x420e14[_0x732c('0x45')]));if(_0x2d42e2[_0x732c('0x44')][_0x732c('0x51')]){_0x393b48[_0x732c('0x4e')]=_[_0x732c('0x4f')](_0x393b48[_0x732c('0x4e')],{'$or':_['map'](_0x393b48[_0x732c('0x47')],function(_0x349e09){var _0xd466cd={};_0xd466cd[_0x349e09]={'$like':'%'+_0x2d42e2[_0x732c('0x44')][_0x732c('0x51')]+'%'};return _0xd466cd;})});}_0x393b48=_[_0x732c('0x4f')]({},_0x393b48,_0x2d42e2['options']);return _0x4b5f07[_0x732c('0x75')](_0x393b48);}})[_0x732c('0x36')](function(_0x5882a5){if(_0x5882a5){_0x26b81a=_0x5882a5['length'];if(!_0x2d42e2[_0x732c('0x44')]['hasOwnProperty'](_0x732c('0x4b'))){_0x393b48['limit']=qs[_0x732c('0x30')](_0x2d42e2['query'][_0x732c('0x30')]);_0x393b48['offset']=qs[_0x732c('0x2e')](_0x2d42e2['query']['offset']);}return _0x4b5f07['getAgents'](_0x393b48);}})[_0x732c('0x36')](function(_0x26cd9d){if(_0x26cd9d){return _0x26cd9d?{'count':_0x26b81a,'rows':_0x26cd9d}:null;}})['then'](respondWithResult(_0x4f7d7d,null))[_0x732c('0x2a')](handleError(_0x4f7d7d,null));};exports['addApplications']=function(_0x5153d8,_0x209815){var _0x436b6f=_0x5153d8['params']['id'];var _0x1eea2b=_0x5153d8['body'];var _0x15b1ef=0xc8;var _0xcbb24a=null;return db['sequelize'][_0x732c('0x78')]({'isolationLevel':db['sequelize'][_0x732c('0x79')][_0x732c('0x7a')][_0x732c('0x7b')]},function(_0x4a27d3){return db['WhatsappAccount']['findOne']({'where':{'id':_0x436b6f},'transaction':_0x4a27d3})[_0x732c('0x36')](function(_0x11b8c5){if(_0x11b8c5){return db[_0x732c('0x7c')]['destroy']({'where':{'WhatsappAccountId':_0x436b6f},'transaction':_0x4a27d3})['then'](function(){var _0x22bb59=_[_0x732c('0x3f')](_0x1eea2b,function(_0x3f2a9f){_0x3f2a9f[_0x732c('0x66')]=_0x436b6f;return _0x3f2a9f;});return db['WhatsappApplication'][_0x732c('0x7d')](_0x22bb59,{'transaction':_0x4a27d3});});}else{_0x15b1ef=0x194;_0xcbb24a=[];}});})[_0x732c('0x36')](function(){if(_0x15b1ef!==0x194){return db[_0x732c('0x7c')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x436b6f},'order':_0x732c('0x7e')})[_0x732c('0x36')](function(_0x5bbb98){_0xcbb24a=_0x5bbb98;});}})[_0x732c('0x2a')](function(_0x18ef9f){_0x15b1ef=0x1f4;logger[_0x732c('0x26')](_0x18ef9f[_0x732c('0x3b')]);if(_0x18ef9f[_0x732c('0x3c')]){delete _0x18ef9f[_0x732c('0x3c')];}_0xcbb24a=_0x18ef9f;})[_0x732c('0x7f')](function(){if(_0xcbb24a===null){_0x209815[_0x732c('0x3a')](_0x15b1ef);}else{if(_0x15b1ef===0x1f4){_0x209815[_0x732c('0x2b')](_0x15b1ef)[_0x732c('0x80')](_0xcbb24a);}else{_0x209815[_0x732c('0x2b')](_0x15b1ef)['json'](_0xcbb24a);}}});};exports[_0x732c('0x81')]=function(_0x85fda3,_0x566083,_0x699c0b){var _0x450da2={};var _0x124d57={};var _0x3de036;var _0x34d3fc;return db[_0x732c('0x40')]['findOne']({'where':{'id':_0x85fda3[_0x732c('0x56')]['id']}})[_0x732c('0x36')](handleEntityNotFound(_0x566083,null))[_0x732c('0x36')](function(_0xda8e31){if(_0xda8e31){_0x3de036=_0xda8e31;_0x124d57['model']=_[_0x732c('0x58')](db[_0x732c('0x7c')][_0x732c('0x41')]);_0x124d57['query']=_['keys'](_0x85fda3[_0x732c('0x44')]);_0x124d57[_0x732c('0x45')]=_[_0x732c('0x46')](_0x124d57[_0x732c('0x43')],_0x124d57[_0x732c('0x44')]);_0x450da2['attributes']=_[_0x732c('0x46')](_0x124d57[_0x732c('0x43')],qs[_0x732c('0x48')](_0x85fda3[_0x732c('0x44')][_0x732c('0x48')]));_0x450da2[_0x732c('0x47')]=_0x450da2['attributes'][_0x732c('0x49')]?_0x450da2[_0x732c('0x47')]:_0x124d57['model'];_0x450da2[_0x732c('0x69')]=qs['sort'](_0x85fda3[_0x732c('0x44')][_0x732c('0x4c')]);_0x450da2[_0x732c('0x4e')]=qs[_0x732c('0x45')](_[_0x732c('0x4d')](_0x85fda3[_0x732c('0x44')],_0x124d57[_0x732c('0x45')]));if(_0x85fda3[_0x732c('0x44')][_0x732c('0x51')]){_0x450da2[_0x732c('0x4e')]=_[_0x732c('0x4f')](_0x450da2[_0x732c('0x4e')],{'$or':_[_0x732c('0x3f')](_0x450da2[_0x732c('0x47')],function(_0x42da92){var _0x140184={};_0x140184[_0x42da92]={'$like':'%'+_0x85fda3['query'][_0x732c('0x51')]+'%'};return _0x140184;})});}_0x450da2=_[_0x732c('0x4f')]({},_0x450da2,_0x85fda3[_0x732c('0x52')]);return _0x3de036[_0x732c('0x81')](_0x450da2);}})[_0x732c('0x36')](function(_0x576454){if(_0x576454){_0x34d3fc=_0x576454['length'];if(!_0x85fda3[_0x732c('0x44')][_0x732c('0x4a')](_0x732c('0x4b'))){_0x450da2['limit']=qs[_0x732c('0x30')](_0x85fda3['query'][_0x732c('0x30')]);_0x450da2['offset']=qs[_0x732c('0x2e')](_0x85fda3['query'][_0x732c('0x2e')]);}return _0x3de036[_0x732c('0x81')](_0x450da2);}})['then'](function(_0x5753b4){if(_0x5753b4){return _0x5753b4?{'count':_0x34d3fc,'rows':_0x5753b4}:null;}})['then'](respondWithResult(_0x566083,null))[_0x732c('0x2a')](handleError(_0x566083,null));};exports[_0x732c('0x82')]=function(_0x3df39a,_0x108c82,_0x381888){var _0x1f6b8f={'channel':_0x732c('0x83')};var _0x4468bf=[];var _0x2e1eea=[];var _0xf8fc7d={};return db[_0x732c('0x40')][_0x732c('0x5a')]({'where':{'id':_0x3df39a[_0x732c('0x56')]['id']},'include':[{'model':db[_0x732c('0x7c')],'as':_0x732c('0x84')}]})['then'](handleEntityNotFound(_0x108c82,null))[_0x732c('0x36')](function(_0x333797){_0x1f6b8f[_0x732c('0x85')]=_0x333797;if(_0x1f6b8f[_0x732c('0x85')]&&_0x1f6b8f['account'][_0x732c('0x42')]===_0x732c('0x86')&&_0x3df39a[_0x732c('0x64')][_0x732c('0x87')]){if(_0x3df39a[_0x732c('0x64')]['statuses']['length']===0x0)return;if(_0x3df39a[_0x732c('0x64')]['statuses'][0x0][_0x732c('0x88')]!==_0x732c('0x89'))return;return db[_0x732c('0x8a')][_0x732c('0x35')]({'read':!![],'readAt':_0x3df39a['body'][_0x732c('0x87')][0x0][_0x732c('0x8b')]},{'where':{'messageId':_0x3df39a[_0x732c('0x64')]['statuses'][0x0]['message_id']},'individualHooks':!![]})['then'](function(_0x1f4124){return _0x108c82[_0x732c('0x2b')](0xc8)['json'](_0x1f4124);});}_0x1f6b8f[_0x732c('0x8c')]=_[_0x732c('0x8d')](_0x333797[_0x732c('0x84')],[_0x732c('0x7e')],['asc']);if(_0x1f6b8f['account'][_0x732c('0x84')]){delete _0x1f6b8f[_0x732c('0x85')]['Applications'];}return db['CmContact'][_0x732c('0x65')]()[_0x732c('0x36')](function(_0x441b0e){if(!_0x441b0e){throw new db[(_0x732c('0x8e'))]['ValidationError'](_0x732c('0x8f'));}_0x4468bf=_[_0x732c('0x90')](_[_0x732c('0x58')](_0x441b0e),[_0x732c('0x91'),_0x732c('0x92')]);_0x2e1eea=_[_0x732c('0x90')](_[_0x732c('0x58')](_0x441b0e),['createdAt',_0x732c('0x92'),_0x732c('0x93'),_0x732c('0x94')]);_0x1f6b8f[_0x732c('0x64')]={'mapKey':_0x732c('0x95')};if(_0x1f6b8f['account']&&_0x1f6b8f['account'][_0x732c('0x42')]==='twilio'){_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')]=_0x3df39a[_0x732c('0x64')]['From'][_0x732c('0x97')](_0x732c('0x98'),'');_0x1f6b8f[_0x732c('0x64')][_0x732c('0x64')]=_0x3df39a[_0x732c('0x64')][_0x732c('0x99')];_0x1f6b8f[_0x732c('0x64')][_0x732c('0x9a')]=_0x3df39a['body'][_0x732c('0x9b')];}if(_0x1f6b8f[_0x732c('0x85')]&&_0x1f6b8f['account'][_0x732c('0x42')]===_0x732c('0x86')){_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')]=_0x3df39a['body'][_0x732c('0x9c')][0x0][_0x732c('0x96')];_0x1f6b8f[_0x732c('0x64')]['body']=_0x3df39a[_0x732c('0x64')][_0x732c('0x9c')][0x0][_0x732c('0x28')][_0x732c('0x64')];_0x1f6b8f['body'][_0x732c('0x9a')]=_0x3df39a['body']['notifications'][0x0]['message_id'];}if(_0x1f6b8f[_0x732c('0x64')]['id']){delete _0x1f6b8f['body']['id'];}if(_[_0x732c('0x9d')](_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')])){throw new db[(_0x732c('0x8e'))][(_0x732c('0x9e'))](_0x732c('0x9f'));}if(_[_0x732c('0x9d')](_0x1f6b8f['body'][_0x732c('0x64')])||_0x1f6b8f['body'][_0x732c('0x64')]===''){throw new db[(_0x732c('0x8e'))][(_0x732c('0x9e'))](_0x732c('0xa0'));}if(_[_0x732c('0x9d')](_0x1f6b8f[_0x732c('0x64')]['mapKey'])){throw new db[(_0x732c('0x8e'))][(_0x732c('0x9e'))](_0x732c('0xa1')+_0x2e1eea);}if(!_[_0x732c('0xa2')](_0x2e1eea,_0x1f6b8f[_0x732c('0x64')]['mapKey'])){throw new db['Sequelize'][(_0x732c('0x9e'))](_0x732c('0xa3')+_0x2e1eea);}_0xf8fc7d[_0x1f6b8f['body'][_0x732c('0xa4')]]=_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')];return db[_0x732c('0xa5')][_0x732c('0x5a')]({'where':{'id':_0x1f6b8f['account']['ListId']},'include':[{'model':db[_0x732c('0xa6')],'as':_0x732c('0xa7'),'where':_0xf8fc7d,'limit':0x1,'order':[[_0x732c('0x92'),'DESC']]}]});})[_0x732c('0x36')](handleEntityNotFound(_0x108c82,null))['then'](function(_0x52f979){if(_0x52f979){_0x1f6b8f[_0x732c('0xa8')]=_['omit'](_0x52f979,[_0x732c('0xa7')]);if(_0x52f979[_0x732c('0xa7')]['length']){return _0x52f979['Contacts'][0x0];}var _0x1c85ff=_[_0x732c('0x18')](_0x1f6b8f[_0x732c('0x64')],{'firstName':_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')],'ListId':_0x52f979['id']});_0x1c85ff[_0x1f6b8f[_0x732c('0x64')]['mapKey']]=_0x1f6b8f['body'][_0x732c('0x96')];return db[_0x732c('0xa6')][_0x732c('0x5b')](_0x1c85ff,{'fields':_0x4468bf,'raw':!![]});}})['then'](handleEntityNotFound(_0x108c82,null))['then'](function(_0x62b03b){if(_0x62b03b){_0x1f6b8f[_0x732c('0xa9')]=_0x62b03b;var _0x3f193b={'ContactId':_0x62b03b['id'],'phone':_0x1f6b8f[_0x732c('0x64')]['from'],'WhatsappAccountId':_0x3df39a[_0x732c('0x56')]['id']};var _0x297621={'ContactId':_0x62b03b['id'],'WhatsappAccountId':_0x3df39a[_0x732c('0x56')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x732c('0x5a')]({'where':_0x297621})['then'](function(_0x59201c){if(_0x59201c){return[_0x59201c,![]];}return db['WhatsappInteraction'][_0x732c('0x5b')](_0x3f193b)[_0x732c('0x36')](function(_0x694e39){return[_0x694e39,!![]];});});}})[_0x732c('0xaa')](function(_0x41dabf,_0xcb505c){_0x1f6b8f[_0x732c('0xab')]=_0x41dabf[_0x732c('0x38')]({'plain':!![]});_0x1f6b8f[_0x732c('0xab')]['created']=![];if(_0xcb505c){if(_0x1f6b8f['account'][_0x732c('0xac')]){_0x1f6b8f[_0x732c('0x8c')][_0x732c('0xad')]({'id':0x0,'priority':_0x1f6b8f['applications'][_0x732c('0x49')]+0x1,'app':_0x732c('0xae'),'appdata':_0x732c('0xaf'),'interval':_0x732c('0xb0')});}_0x1f6b8f[_0x732c('0xab')][_0x732c('0xb1')]=!![];}return db[_0x732c('0x8a')][_0x732c('0x5b')]({'phone':_0x1f6b8f[_0x732c('0x64')][_0x732c('0x96')],'messageId':_0x1f6b8f['body'][_0x732c('0x9a')],'body':_0x1f6b8f[_0x732c('0x64')]['body'],'WhatsappAccountId':_0x3df39a[_0x732c('0x56')]['id'],'WhatsappInteractionId':_0x41dabf['id'],'direction':'in','ContactId':_0x41dabf[_0x732c('0xb2')],'AttachmentId':_0x1f6b8f[_0x732c('0x64')][_0x732c('0xb3')]});})['then'](function(_0x34de19){_0x1f6b8f[_0x732c('0x28')]=_0x34de19;if(_0x1f6b8f[_0x732c('0xab')][_0x732c('0xb4')]){return db[_0x732c('0x77')][_0x732c('0x5a')]({'attributes':['id','name'],'where':{'id':_0x1f6b8f[_0x732c('0xab')][_0x732c('0xb4')]}})[_0x732c('0x36')](function(_0x32b6e6){if(_0x32b6e6){_0x1f6b8f[_0x732c('0x8c')]['unshift']({'id':0x0,'priority':0x0,'app':_0x732c('0xb5'),'appdata':_0x32b6e6[_0x732c('0x3c')]+','+(_0x1f6b8f[_0x732c('0x85')]['waitForTheAssignedAgent']||0xa),'interval':_0x732c('0xb0')});}return respondWithRpcPromise(_0x732c('0xb6'),_0x732c('0xb7'),_0x1f6b8f);});}return respondWithRpcPromise(_0x732c('0xb6'),'startRouting',_0x1f6b8f);})[_0x732c('0x36')](function(_0x2679a){if(_0x2679a){var _0x5669f4=0xc8;var _0x4f87d2=_0x732c('0xb8');logger[_0x732c('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4f87d2,_0x5669f4,_0x732c('0xb9'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x4f87d2,_0x5669f4,_0x732c('0xb9'),JSON[_0x732c('0x25')](_0x2679a));if(_0x1f6b8f[_0x732c('0x85')][_0x732c('0x42')]==='twilio'){return _0x108c82[_0x732c('0x2b')](_0x5669f4)[_0x732c('0xba')](_0x732c('0xbb'),_0x732c('0xbc'))['send'](_0x732c('0xbd'));}else{return _0x108c82[_0x732c('0x2b')](_0x5669f4)[_0x732c('0x2d')](_0x2679a);}}});})['catch'](handleError(_0x108c82,null));};exports[_0x732c('0x80')]=function(_0x26eabf,_0x9d01d5,_0x46640c){var _0x4e7978,_0x52d12f,_0x312010;if(_[_0x732c('0x9d')](_0x26eabf[_0x732c('0x64')][_0x732c('0x64')])||_0x26eabf[_0x732c('0x64')][_0x732c('0x64')]===''){throw new db[(_0x732c('0x8e'))][(_0x732c('0x9e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x26eabf[_0x732c('0x64')]['to'])){throw new db[(_0x732c('0x8e'))][(_0x732c('0x9e'))](_0x732c('0xbe'));}_0x4e7978=_0x26eabf[_0x732c('0x64')]['to'];return db[_0x732c('0x40')][_0x732c('0x5a')]({'where':{'id':_0x26eabf[_0x732c('0x56')]['id']},'include':[{'model':db[_0x732c('0xa5')],'as':'List','include':[{'model':db[_0x732c('0xa6')],'as':_0x732c('0xa7'),'where':{'mobile':_0x4e7978},'limit':0x1,'order':[[_0x732c('0x92'),_0x732c('0xbf')]]}]}]})[_0x732c('0x36')](handleEntityNotFound(_0x9d01d5,null))[_0x732c('0x36')](function(_0x42c6ad){if(_0x42c6ad&&_0x42c6ad['List']){_0x52d12f=_0x42c6ad[_0x732c('0x38')]({'plain':!![]});if(_0x52d12f[_0x732c('0xc0')]&&_0x52d12f[_0x732c('0xc0')]['Contacts'][_0x732c('0x49')]){return _0x52d12f[_0x732c('0xc0')][_0x732c('0xa7')][0x0];}return db['CmContact']['create'](_[_0x732c('0x18')](_0x26eabf['body'],{'firstName':_0x4e7978,'mobile':_0x4e7978,'phone':_0x4e7978,'ListId':_0x52d12f[_0x732c('0x94')]}));}})[_0x732c('0x36')](handleEntityNotFound(_0x9d01d5,null))[_0x732c('0x36')](function(_0x31a1f5){if(_0x31a1f5){_0x312010=_0x31a1f5;return db[_0x732c('0xc1')][_0x732c('0x5a')]({'where':{'ContactId':_0x312010['id'],'closed':![],'WhatsappAccountId':_0x52d12f['id']}})[_0x732c('0x36')](function(_0x548447){if(_0x548447){return[_0x548447,![]];}return db['WhatsappInteraction'][_0x732c('0x5b')]({'UserId':_0x26eabf['user']['id'],'ContactId':_0x312010['id'],'WhatsappAccountId':_0x52d12f['id'],'phone':_0x4e7978,'firstMsgDirection':_0x732c('0xc2'),'Messages':[_['merge'](_0x26eabf[_0x732c('0x64')],{'read':![],'body':_0x26eabf['body']['body'],'phone':_0x4e7978,'WhatsappAccountId':_0x52d12f['id'],'UserId':_0x26eabf[_0x732c('0x5c')]['id'],'ContactId':_0x312010['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x732c('0xc3')}]})[_0x732c('0x36')](function(_0x4c23f3){return[_0x4c23f3,!![]];});});}})[_0x732c('0xaa')](function(_0x69fac2,_0x10a328){if(_0x10a328){return _0x69fac2;}return db[_0x732c('0x8a')]['create'](_[_0x732c('0x4f')](_0x26eabf['body'],{'read':![],'body':_0x26eabf[_0x732c('0x64')][_0x732c('0x64')],'phone':_0x4e7978,'WhatsappAccountId':_0x52d12f['id'],'WhatsappInteractionId':_0x69fac2['id'],'UserId':_0x26eabf[_0x732c('0x5c')]['id'],'ContactId':_0x312010['id']}))['then'](function(_0x5d2e3c){_0x69fac2[_0x732c('0xc4')][_0x732c('0xc3')]=[];_0x69fac2[_0x732c('0xc4')][_0x732c('0xc3')]['push'](_0x5d2e3c[_0x732c('0xc4')]);return _0x69fac2;});})['then'](respondWithResult(_0x9d01d5,null))[_0x732c('0x2a')](handleError(_0x9d01d5,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 41e4347..16333ca 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 _0xbec1=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','hook','exports'];(function(_0x5c473d,_0x312ec3){var _0x16026c=function(_0x1afc93){while(--_0x1afc93){_0x5c473d['push'](_0x5c473d['shift']());}};_0x16026c(++_0x312ec3);}(_0xbec1,0x190));var _0x1bec=function(_0x3630d3,_0x17503c){_0x3630d3=_0x3630d3-0x0;var _0x40c088=_0xbec1[_0x3630d3];return _0x40c088;};'use strict';var EventEmitter=require(_0x1bec('0x0'));var WhatsappAccount=require(_0x1bec('0x1'))['db'][_0x1bec('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1bec('0x3')](0x0);var events={'afterCreate':_0x1bec('0x4'),'afterUpdate':_0x1bec('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2c1e23){return function(_0x58b411,_0x5ec79e,_0x5563d6){WhatsappAccountEvents['emit'](_0x2c1e23+':'+_0x58b411['id'],_0x58b411);WhatsappAccountEvents['emit'](_0x2c1e23,_0x58b411);_0x5563d6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x1bec('0x6')](e,emitEvent(event));}}module[_0x1bec('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x993a=['remove','exports','../../mysqldb','WhatsappAccount','setMaxListeners','update'];(function(_0x2a2213,_0xcf1444){var _0x555842=function(_0x75734c){while(--_0x75734c){_0x2a2213['push'](_0x2a2213['shift']());}};_0x555842(++_0xcf1444);}(_0x993a,0xe0));var _0xa993=function(_0x577f93,_0x8570aa){_0x577f93=_0x577f93-0x0;var _0x34efaa=_0x993a[_0x577f93];return _0x34efaa;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xa993('0x0'))['db'][_0xa993('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xa993('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa993('0x3'),'afterDestroy':_0xa993('0x4')};function emitEvent(_0x24b516){return function(_0x56fadc,_0x3b7b34,_0x5db4e0){WhatsappAccountEvents['emit'](_0x24b516+':'+_0x56fadc['id'],_0x56fadc);WhatsappAccountEvents['emit'](_0x24b516,_0x56fadc);_0x5db4e0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xa993('0x5')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 5594bcd..1fed877 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 _0xb0da=['../../config/logger','request-promise','path','rimraf','./whatsappAccount.attributes','define','whatsapp_accounts','lodash','util'];(function(_0x5c28f0,_0x2011fd){var _0x3a6389=function(_0x25307a){while(--_0x25307a){_0x5c28f0['push'](_0x5c28f0['shift']());}};_0x3a6389(++_0x2011fd);}(_0xb0da,0x11e));var _0xab0d=function(_0x1c8a38,_0x1f8f1a){_0x1c8a38=_0x1c8a38-0x0;var _0x1e8e5c=_0xb0da[_0x1c8a38];return _0x1e8e5c;};'use strict';var _=require(_0xab0d('0x0'));var util=require(_0xab0d('0x1'));var logger=require(_0xab0d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xab0d('0x3'));var fs=require('fs');var path=require(_0xab0d('0x4'));var rimraf=require(_0xab0d('0x5'));var config=require('../../config/environment');var attributes=require(_0xab0d('0x6'));module['exports']=function(_0x34389d,_0x26477d){return _0x34389d[_0xab0d('0x7')]('WhatsappAccount',attributes,{'tableName':_0xab0d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4edc=['define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x5adf76,_0x33d495){var _0x44d8f9=function(_0x2b94ec){while(--_0x2b94ec){_0x5adf76['push'](_0x5adf76['shift']());}};_0x44d8f9(++_0x33d495);}(_0x4edc,0x1f1));var _0xc4ed=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x4edc[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0xc4ed('0x0'));var util=require(_0xc4ed('0x1'));var logger=require('../../config/logger')(_0xc4ed('0x2'));var moment=require(_0xc4ed('0x3'));var BPromise=require('bluebird');var rp=require(_0xc4ed('0x4'));var fs=require('fs');var path=require(_0xc4ed('0x5'));var rimraf=require(_0xc4ed('0x6'));var config=require(_0xc4ed('0x7'));var attributes=require(_0xc4ed('0x8'));module[_0xc4ed('0x9')]=function(_0x285c20,_0x579879){return _0x285c20[_0xc4ed('0xa')](_0xc4ed('0xb'),attributes,{'tableName':_0xc4ed('0xc'),'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 44ac4eb..3f9536b 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 _0xa354=['./whatsappAccount.socket','request','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter'];(function(_0x1374fc,_0x2f35f3){var _0x1db0b0=function(_0x251a00){while(--_0x251a00){_0x1374fc['push'](_0x1374fc['shift']());}};_0x1db0b0(++_0x2f35f3);}(_0xa354,0xd6));var _0x4a35=function(_0x27abf1,_0x30901d){_0x27abf1=_0x27abf1-0x0;var _0x36b422=_0xa354[_0x27abf1];return _0x36b422;};'use strict';var _=require(_0x4a35('0x0'));var util=require(_0x4a35('0x1'));var moment=require(_0x4a35('0x2'));var BPromise=require(_0x4a35('0x3'));var rs=require(_0x4a35('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a35('0x5'))['db'];var utils=require(_0x4a35('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4a35('0x7'));var jayson=require(_0x4a35('0x8'));var client=jayson[_0x4a35('0x9')][_0x4a35('0xa')]({'port':0x232a});config['redis']=_[_0x4a35('0xb')](config[_0x4a35('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a35('0xd'))(new Redis(config[_0x4a35('0xc')]));require(_0x4a35('0xe'))['register'](socket);function respondWithRpcPromise(_0x5433c6,_0x3e3beb,_0x421d2c){return new BPromise(function(_0x1e2148,_0x5ad864){return client[_0x4a35('0xf')](_0x5433c6,_0x421d2c)['then'](function(_0x1acea5){logger['info'](_0x4a35('0x10'),_0x3e3beb,'request\x20sent');logger[_0x4a35('0x11')](_0x4a35('0x12'),_0x3e3beb,_0x4a35('0x13'),JSON[_0x4a35('0x14')](_0x1acea5));if(_0x1acea5[_0x4a35('0x15')]){if(_0x1acea5[_0x4a35('0x15')][_0x4a35('0x16')]===0x1f4){logger['error'](_0x4a35('0x10'),_0x3e3beb,_0x1acea5[_0x4a35('0x15')][_0x4a35('0x17')]);return _0x5ad864(_0x1acea5[_0x4a35('0x15')][_0x4a35('0x17')]);}logger[_0x4a35('0x15')](_0x4a35('0x10'),_0x3e3beb,_0x1acea5[_0x4a35('0x15')][_0x4a35('0x17')]);return _0x1e2148(_0x1acea5['error'][_0x4a35('0x17')]);}else{logger[_0x4a35('0x18')](_0x4a35('0x10'),_0x3e3beb,_0x4a35('0x13'));_0x1e2148(_0x1acea5[_0x4a35('0x19')][_0x4a35('0x17')]);}})[_0x4a35('0x1a')](function(_0x5bb982){logger[_0x4a35('0x15')](_0x4a35('0x10'),_0x3e3beb,_0x5bb982);_0x5ad864(_0x5bb982);});});}exports[_0x4a35('0x1b')]=function(_0x2d58a2){var _0x375a05=this;return new Promise(function(_0x3293b3,_0x4b470c){return db[_0x4a35('0x1c')][_0x4a35('0x1d')]({'raw':_0x2d58a2[_0x4a35('0x1e')]?_0x2d58a2[_0x4a35('0x1e')][_0x4a35('0x1f')]===undefined?!![]:![]:!![],'where':_0x2d58a2['options']?_0x2d58a2['options'][_0x4a35('0x20')]||null:null,'attributes':_0x2d58a2['options']?_0x2d58a2[_0x4a35('0x1e')][_0x4a35('0x21')]||null:null,'include':_0x2d58a2[_0x4a35('0x1e')]?_0x2d58a2['options'][_0x4a35('0x22')]?_['map'](_0x2d58a2['options'][_0x4a35('0x22')],function(_0x213df3){return{'model':db[_0x213df3[_0x4a35('0x23')]],'as':_0x213df3['as'],'attributes':_0x213df3[_0x4a35('0x21')],'include':_0x213df3[_0x4a35('0x22')]?_[_0x4a35('0x24')](_0x213df3[_0x4a35('0x22')],function(_0x20aac1){return{'model':db[_0x20aac1[_0x4a35('0x23')]],'as':_0x20aac1['as'],'attributes':_0x20aac1['attributes'],'include':_0x20aac1[_0x4a35('0x22')]?_[_0x4a35('0x24')](_0x20aac1[_0x4a35('0x22')],function(_0x183ff1){return{'model':db[_0x183ff1['model']],'as':_0x183ff1['as'],'attributes':_0x183ff1[_0x4a35('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4a35('0x25')](function(_0x528aa9){logger['info'](_0x4a35('0x1b'),_0x2d58a2);logger[_0x4a35('0x11')](_0x4a35('0x1b'),_0x2d58a2,JSON[_0x4a35('0x14')](_0x528aa9));_0x3293b3(_0x528aa9);})[_0x4a35('0x1a')](function(_0x41e42f){logger[_0x4a35('0x15')](_0x4a35('0x1b'),_0x41e42f[_0x4a35('0x17')],_0x2d58a2);_0x4b470c(_0x375a05[_0x4a35('0x15')](0x1f4,_0x41e42f['message']));});});}; \ No newline at end of file +var _0xfe4a=['options','raw','where','attributes','map','include','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowWhatsappAccount','find'];(function(_0x2ab61d,_0x4a2fe6){var _0x3d4308=function(_0x4b4054){while(--_0x4b4054){_0x2ab61d['push'](_0x2ab61d['shift']());}};_0x3d4308(++_0x4a2fe6);}(_0xfe4a,0x10b));var _0xafe4=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xfe4a[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xafe4('0x0'));var util=require(_0xafe4('0x1'));var moment=require(_0xafe4('0x2'));var BPromise=require(_0xafe4('0x3'));var rs=require(_0xafe4('0x4'));var fs=require('fs');var Redis=require(_0xafe4('0x5'));var db=require(_0xafe4('0x6'))['db'];var utils=require(_0xafe4('0x7'));var logger=require('../../config/logger')(_0xafe4('0x8'));var config=require(_0xafe4('0x9'));var jayson=require(_0xafe4('0xa'));var client=jayson[_0xafe4('0xb')]['http']({'port':0x232a});config[_0xafe4('0xc')]=_[_0xafe4('0xd')](config['redis'],{'host':_0xafe4('0xe'),'port':0x18eb});var socket=require(_0xafe4('0xf'))(new Redis(config[_0xafe4('0xc')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x4bfe6d,_0xb53b6c,_0x4a671e){return new BPromise(function(_0x3363c4,_0x5bd58e){return client[_0xafe4('0x10')](_0x4bfe6d,_0x4a671e)[_0xafe4('0x11')](function(_0xf5c43b){logger[_0xafe4('0x12')](_0xafe4('0x13'),_0xb53b6c,_0xafe4('0x14'));logger['debug'](_0xafe4('0x15'),_0xb53b6c,_0xafe4('0x14'),JSON[_0xafe4('0x16')](_0xf5c43b));if(_0xf5c43b['error']){if(_0xf5c43b['error'][_0xafe4('0x17')]===0x1f4){logger[_0xafe4('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0xb53b6c,_0xf5c43b[_0xafe4('0x18')][_0xafe4('0x19')]);return _0x5bd58e(_0xf5c43b[_0xafe4('0x18')][_0xafe4('0x19')]);}logger['error'](_0xafe4('0x13'),_0xb53b6c,_0xf5c43b['error'][_0xafe4('0x19')]);return _0x3363c4(_0xf5c43b[_0xafe4('0x18')][_0xafe4('0x19')]);}else{logger['info'](_0xafe4('0x13'),_0xb53b6c,'request\x20sent');_0x3363c4(_0xf5c43b['result'][_0xafe4('0x19')]);}})[_0xafe4('0x1a')](function(_0x5c22b9){logger[_0xafe4('0x18')](_0xafe4('0x13'),_0xb53b6c,_0x5c22b9);_0x5bd58e(_0x5c22b9);});});}exports[_0xafe4('0x1b')]=function(_0x1d068a){var _0x3d736e=this;return new Promise(function(_0x4c2107,_0x300af5){return db['WhatsappAccount'][_0xafe4('0x1c')]({'raw':_0x1d068a[_0xafe4('0x1d')]?_0x1d068a['options'][_0xafe4('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d068a['options']?_0x1d068a[_0xafe4('0x1d')][_0xafe4('0x1f')]||null:null,'attributes':_0x1d068a['options']?_0x1d068a[_0xafe4('0x1d')][_0xafe4('0x20')]||null:null,'include':_0x1d068a['options']?_0x1d068a[_0xafe4('0x1d')]['include']?_[_0xafe4('0x21')](_0x1d068a[_0xafe4('0x1d')][_0xafe4('0x22')],function(_0x5830aa){return{'model':db[_0x5830aa[_0xafe4('0x23')]],'as':_0x5830aa['as'],'attributes':_0x5830aa[_0xafe4('0x20')],'include':_0x5830aa[_0xafe4('0x22')]?_['map'](_0x5830aa[_0xafe4('0x22')],function(_0x47ee7d){return{'model':db[_0x47ee7d['model']],'as':_0x47ee7d['as'],'attributes':_0x47ee7d[_0xafe4('0x20')],'include':_0x47ee7d[_0xafe4('0x22')]?_[_0xafe4('0x21')](_0x47ee7d[_0xafe4('0x22')],function(_0x84943a){return{'model':db[_0x84943a[_0xafe4('0x23')]],'as':_0x84943a['as'],'attributes':_0x84943a[_0xafe4('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58c36c){logger[_0xafe4('0x12')]('ShowWhatsappAccount',_0x1d068a);logger[_0xafe4('0x24')](_0xafe4('0x1b'),_0x1d068a,JSON[_0xafe4('0x16')](_0x58c36c));_0x4c2107(_0x58c36c);})[_0xafe4('0x1a')](function(_0x17ab7e){logger[_0xafe4('0x18')]('ShowWhatsappAccount',_0x17ab7e['message'],_0x1d068a);_0x300af5(_0x3d736e[_0xafe4('0x18')](0x1f4,_0x17ab7e[_0xafe4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 3b03006..6047834 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 _0x2ca1=['save','remove','emit','removeListener','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x5359a2,_0x41ce31){var _0x18f21b=function(_0x82b6f5){while(--_0x82b6f5){_0x5359a2['push'](_0x5359a2['shift']());}};_0x18f21b(++_0x41ce31);}(_0x2ca1,0x117));var _0x12ca=function(_0x3c5f8d,_0x39891f){_0x3c5f8d=_0x3c5f8d-0x0;var _0x3b7beb=_0x2ca1[_0x3c5f8d];return _0x3b7beb;};'use strict';var WhatsappAccountEvents=require(_0x12ca('0x0'));var events=[_0x12ca('0x1'),_0x12ca('0x2'),'update'];function createListener(_0x59a623,_0x2ceea7){return function(_0x452f60){_0x2ceea7[_0x12ca('0x3')](_0x59a623,_0x452f60);};}function removeListener(_0x39bc9f,_0x1dd5d5){return function(){WhatsappAccountEvents[_0x12ca('0x4')](_0x39bc9f,_0x1dd5d5);};}exports['register']=function(_0x5f3745){for(var _0x211b35=0x0,_0x52b64c=events[_0x12ca('0x5')];_0x211b35<_0x52b64c;_0x211b35++){var _0x51db6e=events[_0x211b35];var _0xc8db9d=createListener(_0x12ca('0x6')+_0x51db6e,_0x5f3745);WhatsappAccountEvents['on'](_0x51db6e,_0xc8db9d);}}; \ No newline at end of file +var _0xe785=['update','emit','length','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe785,0x107));var _0x5e78=function(_0x4b288c,_0x4dea83){_0x4b288c=_0x4b288c-0x0;var _0x18e473=_0xe785[_0x4b288c];return _0x18e473;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x5e78('0x0'),_0x5e78('0x1'),_0x5e78('0x2')];function createListener(_0x1ddcc8,_0x43ba0a){return function(_0x1bb71b){_0x43ba0a[_0x5e78('0x3')](_0x1ddcc8,_0x1bb71b);};}function removeListener(_0x49ca32,_0x1f0a9b){return function(){WhatsappAccountEvents['removeListener'](_0x49ca32,_0x1f0a9b);};}exports['register']=function(_0x5f130c){for(var _0x1d31fc=0x0,_0x9671bb=events[_0x5e78('0x4')];_0x1d31fc<_0x9671bb;_0x1d31fc++){var _0x4a745e=events[_0x1d31fc];var _0x51c6f7=createListener('whatsappAccount:'+_0x4a745e,_0x5f130c);WhatsappAccountEvents['on'](_0x4a745e,_0x51c6f7);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 8f9951f..bdb5ecc 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 _0x4e77=['get','index','/:id','isAuthenticated','show','post','create','put','update','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller'];(function(_0x2baca1,_0x2f3557){var _0x9aa62a=function(_0x5c47d5){while(--_0x5c47d5){_0x2baca1['push'](_0x2baca1['shift']());}};_0x9aa62a(++_0x2f3557);}(_0x4e77,0xcf));var _0x74e7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4e77[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x74e7('0x0'));var path=require('path');var timeout=require(_0x74e7('0x1'));var express=require(_0x74e7('0x2'));var router=express[_0x74e7('0x3')]();var fs_extra=require(_0x74e7('0x4'));var auth=require(_0x74e7('0x5'));var interaction=require(_0x74e7('0x6'));var config=require(_0x74e7('0x7'));var controller=require(_0x74e7('0x8'));router[_0x74e7('0x9')]('/',auth['isAuthenticated'](),controller[_0x74e7('0xa')]);router[_0x74e7('0x9')](_0x74e7('0xb'),auth[_0x74e7('0xc')](),controller[_0x74e7('0xd')]);router[_0x74e7('0xe')]('/',auth[_0x74e7('0xc')](),controller[_0x74e7('0xf')]);router[_0x74e7('0x10')](_0x74e7('0xb'),auth[_0x74e7('0xc')](),controller[_0x74e7('0x11')]);router['delete'](_0x74e7('0xb'),auth[_0x74e7('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeeee=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util'];(function(_0x238f08,_0x17b2d6){var _0x306697=function(_0x28a705){while(--_0x28a705){_0x238f08['push'](_0x238f08['shift']());}};_0x306697(++_0x17b2d6);}(_0xeeee,0xdb));var _0xeeee=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0xeeee[_0x313c96];return _0x522f53;};'use strict';var multer=require(_0xeeee('0x0'));var util=require(_0xeeee('0x1'));var path=require(_0xeeee('0x2'));var timeout=require(_0xeeee('0x3'));var express=require('express');var router=express[_0xeeee('0x4')]();var fs_extra=require(_0xeeee('0x5'));var auth=require(_0xeeee('0x6'));var interaction=require(_0xeeee('0x7'));var config=require('../../config/environment');var controller=require(_0xeeee('0x8'));router['get']('/',auth[_0xeeee('0x9')](),controller['index']);router['get'](_0xeeee('0xa'),auth['isAuthenticated'](),controller[_0xeeee('0xb')]);router[_0xeeee('0xc')]('/',auth[_0xeeee('0x9')](),controller['create']);router[_0xeeee('0xd')](_0xeeee('0xa'),auth[_0xeeee('0x9')](),controller['update']);router[_0xeeee('0xe')](_0xeeee('0xa'),auth[_0xeeee('0x9')](),controller[_0xeeee('0xf')]);module[_0xeeee('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 3177663..d37350f 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 _0x66b2=['INTEGER','noop','STRING','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x66b2,0xa3));var _0x266b=function(_0x4e5b7c,_0x291c10){_0x4e5b7c=_0x4e5b7c-0x0;var _0x2c89af=_0x66b2[_0x4e5b7c];return _0x2c89af;};'use strict';var Sequelize=require(_0x266b('0x0'));module[_0x266b('0x1')]={'priority':{'type':Sequelize[_0x266b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x266b('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x266b('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x603d=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x603d,0x14d));var _0xd603=function(_0x1e259c,_0x27c300){_0x1e259c=_0x1e259c-0x0;var _0x16d6e8=_0x603d[_0x1e259c];return _0x16d6e8;};'use strict';var Sequelize=require(_0xd603('0x0'));module[_0xd603('0x1')]={'priority':{'type':Sequelize[_0xd603('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd603('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xd603('0x3')]},'interval':{'type':Sequelize[_0xd603('0x3')],'defaultValue':_0xd603('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index d585eb6..ea9fb05 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 _0x5232=['includeAll','options','catch','create','body','update','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','reject','save','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','include','WhatsappApplication','findAll','show','params'];(function(_0x5ff41b,_0x5f3133){var _0x57d3d2=function(_0x20ebd8){while(--_0x20ebd8){_0x5ff41b['push'](_0x5ff41b['shift']());}};_0x57d3d2(++_0x5f3133);}(_0x5232,0x1c9));var _0x2523=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0x5232[_0x3474ac];return _0x5345ec;};'use strict';var emlformat=require(_0x2523('0x0'));var rimraf=require(_0x2523('0x1'));var zipdir=require(_0x2523('0x2'));var jsonpatch=require(_0x2523('0x3'));var rp=require(_0x2523('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2523('0x5'));var util=require(_0x2523('0x6'));var path=require('path');var sox=require(_0x2523('0x7'));var csv=require(_0x2523('0x8'));var ejs=require(_0x2523('0x9'));var fs=require('fs');var fs_extra=require(_0x2523('0xa'));var _=require(_0x2523('0xb'));var squel=require(_0x2523('0xc'));var crypto=require(_0x2523('0xd'));var jsforce=require(_0x2523('0xe'));var deskjs=require(_0x2523('0xf'));var toCsv=require(_0x2523('0x8'));var querystring=require(_0x2523('0x10'));var Papa=require(_0x2523('0x11'));var Redis=require('ioredis');var authService=require(_0x2523('0x12'));var qs=require(_0x2523('0x13'));var as=require(_0x2523('0x14'));var hardwareService=require(_0x2523('0x15'));var logger=require(_0x2523('0x16'))(_0x2523('0x17'));var utils=require('../../config/utils');var config=require(_0x2523('0x18'));var licenseUtil=require(_0x2523('0x19'));var db=require(_0x2523('0x1a'))['db'];function respondWithStatusCode(_0x99685a,_0x5176d5){_0x5176d5=_0x5176d5||0xcc;return function(_0x37f270){if(_0x37f270){return _0x99685a[_0x2523('0x1b')](_0x5176d5);}return _0x99685a['status'](_0x5176d5)[_0x2523('0x1c')]();};}function respondWithResult(_0x2cd6e1,_0xc9898b){_0xc9898b=_0xc9898b||0xc8;return function(_0xc09a01){if(_0xc09a01){return _0x2cd6e1['status'](_0xc9898b)[_0x2523('0x1d')](_0xc09a01);}};}function respondWithFilteredResult(_0x5974a6,_0x3f9b51){return function(_0x1ac5d3){if(_0x1ac5d3){var _0x173218=typeof _0x3f9b51[_0x2523('0x1e')]==='undefined'&&typeof _0x3f9b51[_0x2523('0x1f')]===_0x2523('0x20');var _0x108159=_0x1ac5d3[_0x2523('0x21')];var _0x1ce828=_0x173218?0x0:_0x3f9b51[_0x2523('0x1e')];var _0x4f2a85=_0x173218?_0x1ac5d3[_0x2523('0x21')]:_0x3f9b51[_0x2523('0x1e')]+_0x3f9b51['limit'];var _0x2819aa;if(_0x4f2a85>=_0x108159){_0x4f2a85=_0x108159;_0x2819aa=0xc8;}else{_0x2819aa=0xce;}_0x5974a6[_0x2523('0x22')](_0x2819aa);return _0x5974a6[_0x2523('0x23')](_0x2523('0x24'),_0x1ce828+'-'+_0x4f2a85+'/'+_0x108159)['json'](_0x1ac5d3);}return null;};}function patchUpdates(_0x4f94c9){return function(_0x4e9498){try{jsonpatch['apply'](_0x4e9498,_0x4f94c9,!![]);}catch(_0x1d52dc){return BPromise[_0x2523('0x25')](_0x1d52dc);}return _0x4e9498[_0x2523('0x26')]();};}function saveUpdates(_0x3baae5,_0x1c39d8){return function(_0x578a83){if(_0x578a83){return _0x578a83['update'](_0x3baae5)['then'](function(_0x50e34e){return _0x50e34e;});}return null;};}function removeEntity(_0x14a685,_0x4847c1){return function(_0x4fc304){if(_0x4fc304){return _0x4fc304['destroy']()[_0x2523('0x27')](function(){_0x14a685[_0x2523('0x22')](0xcc)[_0x2523('0x1c')]();});}};}function handleEntityNotFound(_0x393956,_0xd47858){return function(_0x5495f4){if(!_0x5495f4){_0x393956[_0x2523('0x1b')](0x194);}return _0x5495f4;};}function handleError(_0x45366f,_0x3a8b48){_0x3a8b48=_0x3a8b48||0x1f4;return function(_0x1a8b0c){logger[_0x2523('0x28')](_0x1a8b0c[_0x2523('0x29')]);if(_0x1a8b0c[_0x2523('0x2a')]){delete _0x1a8b0c[_0x2523('0x2a')];}_0x45366f[_0x2523('0x22')](_0x3a8b48)['send'](_0x1a8b0c);};}exports[_0x2523('0x2b')]=function(_0x1565a8,_0x53b772){var _0x304dd4={},_0x52b25d={},_0x4cb11f={'count':0x0,'rows':[]};var _0x5e0ada=_[_0x2523('0x2c')](db['WhatsappApplication'][_0x2523('0x2d')],function(_0x577c90){return{'name':_0x577c90[_0x2523('0x2e')],'type':_0x577c90[_0x2523('0x2f')]['key']};});_0x52b25d[_0x2523('0x30')]=_['map'](_0x5e0ada,_0x2523('0x2a'));_0x52b25d[_0x2523('0x31')]=_[_0x2523('0x32')](_0x1565a8[_0x2523('0x31')]);_0x52b25d[_0x2523('0x33')]=_[_0x2523('0x34')](_0x52b25d['model'],_0x52b25d[_0x2523('0x31')]);_0x304dd4[_0x2523('0x35')]=_[_0x2523('0x34')](_0x52b25d['model'],qs[_0x2523('0x36')](_0x1565a8['query'][_0x2523('0x36')]));_0x304dd4[_0x2523('0x35')]=_0x304dd4[_0x2523('0x35')][_0x2523('0x37')]?_0x304dd4[_0x2523('0x35')]:_0x52b25d[_0x2523('0x30')];if(!_0x1565a8[_0x2523('0x31')]['hasOwnProperty'](_0x2523('0x38'))){_0x304dd4[_0x2523('0x1f')]=qs[_0x2523('0x1f')](_0x1565a8[_0x2523('0x31')][_0x2523('0x1f')]);_0x304dd4['offset']=qs[_0x2523('0x1e')](_0x1565a8[_0x2523('0x31')][_0x2523('0x1e')]);}_0x304dd4[_0x2523('0x39')]=qs['sort'](_0x1565a8[_0x2523('0x31')]['sort']);_0x304dd4[_0x2523('0x3a')]=qs['filters'](_[_0x2523('0x3b')](_0x1565a8[_0x2523('0x31')],_0x52b25d[_0x2523('0x33')]),_0x5e0ada);if(_0x1565a8[_0x2523('0x31')][_0x2523('0x3c')]){_0x304dd4[_0x2523('0x3a')]=_[_0x2523('0x3d')](_0x304dd4[_0x2523('0x3a')],{'$or':_['map'](_0x5e0ada,function(_0x24aea8){if(_0x24aea8[_0x2523('0x2f')]!==_0x2523('0x3e')){var _0x2cd540={};_0x2cd540[_0x24aea8[_0x2523('0x2a')]]={'$like':'%'+_0x1565a8['query'][_0x2523('0x3c')]+'%'};return _0x2cd540;}})});}_0x304dd4=_[_0x2523('0x3d')]({},_0x304dd4,_0x1565a8['options']);var _0x4a5171={'where':_0x304dd4[_0x2523('0x3a')]};return db['WhatsappApplication'][_0x2523('0x21')](_0x4a5171)[_0x2523('0x27')](function(_0x200a6d){_0x4cb11f[_0x2523('0x21')]=_0x200a6d;if(_0x1565a8['query']['includeAll']){_0x304dd4[_0x2523('0x3f')]=[{'all':!![]}];}return db[_0x2523('0x40')][_0x2523('0x41')](_0x304dd4);})[_0x2523('0x27')](function(_0x14104c){_0x4cb11f['rows']=_0x14104c;return _0x4cb11f;})['then'](respondWithFilteredResult(_0x53b772,_0x304dd4))['catch'](handleError(_0x53b772,null));};exports[_0x2523('0x42')]=function(_0x19f453,_0xceff81){var _0x574e6e={'raw':!![],'where':{'id':_0x19f453[_0x2523('0x43')]['id']}},_0x24e0e1={};_0x24e0e1['model']=_[_0x2523('0x32')](db[_0x2523('0x40')][_0x2523('0x2d')]);_0x24e0e1[_0x2523('0x31')]=_[_0x2523('0x32')](_0x19f453['query']);_0x24e0e1[_0x2523('0x33')]=_[_0x2523('0x34')](_0x24e0e1[_0x2523('0x30')],_0x24e0e1[_0x2523('0x31')]);_0x574e6e['attributes']=_[_0x2523('0x34')](_0x24e0e1[_0x2523('0x30')],qs[_0x2523('0x36')](_0x19f453[_0x2523('0x31')]['fields']));_0x574e6e['attributes']=_0x574e6e[_0x2523('0x35')]['length']?_0x574e6e[_0x2523('0x35')]:_0x24e0e1[_0x2523('0x30')];if(_0x19f453[_0x2523('0x31')][_0x2523('0x44')]){_0x574e6e[_0x2523('0x3f')]=[{'all':!![]}];}_0x574e6e=_['merge']({},_0x574e6e,_0x19f453[_0x2523('0x45')]);return db[_0x2523('0x40')]['find'](_0x574e6e)[_0x2523('0x27')](handleEntityNotFound(_0xceff81,null))[_0x2523('0x27')](respondWithResult(_0xceff81,null))[_0x2523('0x46')](handleError(_0xceff81,null));};exports['create']=function(_0x337993,_0x1a1268){return db[_0x2523('0x40')][_0x2523('0x47')](_0x337993[_0x2523('0x48')],{})['then'](respondWithResult(_0x1a1268,0xc9))[_0x2523('0x46')](handleError(_0x1a1268,null));};exports[_0x2523('0x49')]=function(_0x4d0727,_0x569caa){if(_0x4d0727['body']['id']){delete _0x4d0727['body']['id'];}return db[_0x2523('0x40')][_0x2523('0x4a')]({'where':{'id':_0x4d0727[_0x2523('0x43')]['id']}})[_0x2523('0x27')](handleEntityNotFound(_0x569caa,null))[_0x2523('0x27')](saveUpdates(_0x4d0727[_0x2523('0x48')],null))[_0x2523('0x27')](respondWithResult(_0x569caa,null))['catch'](handleError(_0x569caa,null));};exports['destroy']=function(_0x5ec3e2,_0x66d07c){return db[_0x2523('0x40')]['find']({'where':{'id':_0x5ec3e2[_0x2523('0x43')]['id']}})[_0x2523('0x27')](handleEntityNotFound(_0x66d07c,null))[_0x2523('0x27')](removeEntity(_0x66d07c,null))['catch'](handleError(_0x66d07c,null));}; \ No newline at end of file +var _0xba38=['intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','params','includeAll','create','body','find','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappApplication','rawAttributes','type','key','model','map','query','keys','filters','attributes'];(function(_0x45aa0c,_0x3b1092){var _0x51b6a5=function(_0x54b824){while(--_0x54b824){_0x45aa0c['push'](_0x45aa0c['shift']());}};_0x51b6a5(++_0x3b1092);}(_0xba38,0x190));var _0x8ba3=function(_0x18a0ba,_0x5b3be9){_0x18a0ba=_0x18a0ba-0x0;var _0xd43374=_0xba38[_0x18a0ba];return _0xd43374;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ba3('0x0'));var zipdir=require(_0x8ba3('0x1'));var jsonpatch=require(_0x8ba3('0x2'));var rp=require('request-promise');var moment=require(_0x8ba3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8ba3('0x4'));var util=require(_0x8ba3('0x5'));var path=require(_0x8ba3('0x6'));var sox=require(_0x8ba3('0x7'));var csv=require(_0x8ba3('0x8'));var ejs=require(_0x8ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x8ba3('0xa'));var _=require(_0x8ba3('0xb'));var squel=require(_0x8ba3('0xc'));var crypto=require(_0x8ba3('0xd'));var jsforce=require(_0x8ba3('0xe'));var deskjs=require(_0x8ba3('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8ba3('0x10'));var Papa=require(_0x8ba3('0x11'));var Redis=require('ioredis');var authService=require(_0x8ba3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8ba3('0x13'));var hardwareService=require(_0x8ba3('0x14'));var logger=require(_0x8ba3('0x15'))(_0x8ba3('0x16'));var utils=require(_0x8ba3('0x17'));var config=require(_0x8ba3('0x18'));var licenseUtil=require(_0x8ba3('0x19'));var db=require(_0x8ba3('0x1a'))['db'];function respondWithStatusCode(_0x923aa5,_0x5c8f5b){_0x5c8f5b=_0x5c8f5b||0xcc;return function(_0x1abd6e){if(_0x1abd6e){return _0x923aa5[_0x8ba3('0x1b')](_0x5c8f5b);}return _0x923aa5['status'](_0x5c8f5b)[_0x8ba3('0x1c')]();};}function respondWithResult(_0x4ef1d5,_0x859934){_0x859934=_0x859934||0xc8;return function(_0x59764d){if(_0x59764d){return _0x4ef1d5[_0x8ba3('0x1d')](_0x859934)[_0x8ba3('0x1e')](_0x59764d);}};}function respondWithFilteredResult(_0x57f76d,_0x2842b9){return function(_0x417960){if(_0x417960){var _0x48577c=typeof _0x2842b9[_0x8ba3('0x1f')]===_0x8ba3('0x20')&&typeof _0x2842b9['limit']==='undefined';var _0x47020f=_0x417960['count'];var _0x5a8f04=_0x48577c?0x0:_0x2842b9[_0x8ba3('0x1f')];var _0x563d61=_0x48577c?_0x417960['count']:_0x2842b9[_0x8ba3('0x1f')]+_0x2842b9['limit'];var _0x118c50;if(_0x563d61>=_0x47020f){_0x563d61=_0x47020f;_0x118c50=0xc8;}else{_0x118c50=0xce;}_0x57f76d['status'](_0x118c50);return _0x57f76d[_0x8ba3('0x21')](_0x8ba3('0x22'),_0x5a8f04+'-'+_0x563d61+'/'+_0x47020f)[_0x8ba3('0x1e')](_0x417960);}return null;};}function patchUpdates(_0x5bd852){return function(_0x1a8d6b){try{jsonpatch[_0x8ba3('0x23')](_0x1a8d6b,_0x5bd852,!![]);}catch(_0x2f264d){return BPromise[_0x8ba3('0x24')](_0x2f264d);}return _0x1a8d6b[_0x8ba3('0x25')]();};}function saveUpdates(_0x4a3a50,_0x581daa){return function(_0xb15432){if(_0xb15432){return _0xb15432[_0x8ba3('0x26')](_0x4a3a50)[_0x8ba3('0x27')](function(_0x11e3e7){return _0x11e3e7;});}return null;};}function removeEntity(_0x57f037,_0x543021){return function(_0x10f3e2){if(_0x10f3e2){return _0x10f3e2[_0x8ba3('0x28')]()[_0x8ba3('0x27')](function(){_0x57f037[_0x8ba3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x199ad6,_0x56a391){return function(_0x2f253f){if(!_0x2f253f){_0x199ad6[_0x8ba3('0x1b')](0x194);}return _0x2f253f;};}function handleError(_0x80347a,_0x8b2237){_0x8b2237=_0x8b2237||0x1f4;return function(_0x43e306){logger[_0x8ba3('0x29')](_0x43e306[_0x8ba3('0x2a')]);if(_0x43e306[_0x8ba3('0x2b')]){delete _0x43e306[_0x8ba3('0x2b')];}_0x80347a[_0x8ba3('0x1d')](_0x8b2237)[_0x8ba3('0x2c')](_0x43e306);};}exports[_0x8ba3('0x2d')]=function(_0x16d189,_0x2df77c){var _0x309a89={},_0xee2109={},_0x148aac={'count':0x0,'rows':[]};var _0x4570d3=_['map'](db[_0x8ba3('0x2e')][_0x8ba3('0x2f')],function(_0x4f3b2b){return{'name':_0x4f3b2b['fieldName'],'type':_0x4f3b2b[_0x8ba3('0x30')][_0x8ba3('0x31')]};});_0xee2109[_0x8ba3('0x32')]=_[_0x8ba3('0x33')](_0x4570d3,_0x8ba3('0x2b'));_0xee2109[_0x8ba3('0x34')]=_[_0x8ba3('0x35')](_0x16d189[_0x8ba3('0x34')]);_0xee2109[_0x8ba3('0x36')]=_['intersection'](_0xee2109[_0x8ba3('0x32')],_0xee2109[_0x8ba3('0x34')]);_0x309a89[_0x8ba3('0x37')]=_[_0x8ba3('0x38')](_0xee2109[_0x8ba3('0x32')],qs[_0x8ba3('0x39')](_0x16d189[_0x8ba3('0x34')]['fields']));_0x309a89['attributes']=_0x309a89[_0x8ba3('0x37')][_0x8ba3('0x3a')]?_0x309a89[_0x8ba3('0x37')]:_0xee2109[_0x8ba3('0x32')];if(!_0x16d189['query']['hasOwnProperty'](_0x8ba3('0x3b'))){_0x309a89['limit']=qs['limit'](_0x16d189[_0x8ba3('0x34')]['limit']);_0x309a89[_0x8ba3('0x1f')]=qs[_0x8ba3('0x1f')](_0x16d189['query'][_0x8ba3('0x1f')]);}_0x309a89[_0x8ba3('0x3c')]=qs[_0x8ba3('0x3d')](_0x16d189[_0x8ba3('0x34')][_0x8ba3('0x3d')]);_0x309a89[_0x8ba3('0x3e')]=qs[_0x8ba3('0x36')](_[_0x8ba3('0x3f')](_0x16d189[_0x8ba3('0x34')],_0xee2109[_0x8ba3('0x36')]),_0x4570d3);if(_0x16d189[_0x8ba3('0x34')][_0x8ba3('0x40')]){_0x309a89['where']=_[_0x8ba3('0x41')](_0x309a89[_0x8ba3('0x3e')],{'$or':_[_0x8ba3('0x33')](_0x4570d3,function(_0x2ae0ae){if(_0x2ae0ae[_0x8ba3('0x30')]!==_0x8ba3('0x42')){var _0x3d1b84={};_0x3d1b84[_0x2ae0ae[_0x8ba3('0x2b')]]={'$like':'%'+_0x16d189[_0x8ba3('0x34')][_0x8ba3('0x40')]+'%'};return _0x3d1b84;}})});}_0x309a89=_[_0x8ba3('0x41')]({},_0x309a89,_0x16d189[_0x8ba3('0x43')]);var _0x497d1f={'where':_0x309a89[_0x8ba3('0x3e')]};return db['WhatsappApplication']['count'](_0x497d1f)[_0x8ba3('0x27')](function(_0x47870b){_0x148aac['count']=_0x47870b;if(_0x16d189['query']['includeAll']){_0x309a89[_0x8ba3('0x44')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x309a89);})[_0x8ba3('0x27')](function(_0x4883b7){_0x148aac[_0x8ba3('0x45')]=_0x4883b7;return _0x148aac;})[_0x8ba3('0x27')](respondWithFilteredResult(_0x2df77c,_0x309a89))[_0x8ba3('0x46')](handleError(_0x2df77c,null));};exports['show']=function(_0x5d979d,_0x5cb74a){var _0x4f524d={'raw':!![],'where':{'id':_0x5d979d[_0x8ba3('0x47')]['id']}},_0x31f5c8={};_0x31f5c8[_0x8ba3('0x32')]=_['keys'](db[_0x8ba3('0x2e')][_0x8ba3('0x2f')]);_0x31f5c8['query']=_[_0x8ba3('0x35')](_0x5d979d[_0x8ba3('0x34')]);_0x31f5c8[_0x8ba3('0x36')]=_['intersection'](_0x31f5c8[_0x8ba3('0x32')],_0x31f5c8[_0x8ba3('0x34')]);_0x4f524d[_0x8ba3('0x37')]=_['intersection'](_0x31f5c8[_0x8ba3('0x32')],qs['fields'](_0x5d979d[_0x8ba3('0x34')][_0x8ba3('0x39')]));_0x4f524d[_0x8ba3('0x37')]=_0x4f524d[_0x8ba3('0x37')][_0x8ba3('0x3a')]?_0x4f524d['attributes']:_0x31f5c8[_0x8ba3('0x32')];if(_0x5d979d['query'][_0x8ba3('0x48')]){_0x4f524d['include']=[{'all':!![]}];}_0x4f524d=_['merge']({},_0x4f524d,_0x5d979d['options']);return db[_0x8ba3('0x2e')]['find'](_0x4f524d)[_0x8ba3('0x27')](handleEntityNotFound(_0x5cb74a,null))[_0x8ba3('0x27')](respondWithResult(_0x5cb74a,null))[_0x8ba3('0x46')](handleError(_0x5cb74a,null));};exports[_0x8ba3('0x49')]=function(_0x2620cd,_0x211933){return db[_0x8ba3('0x2e')][_0x8ba3('0x49')](_0x2620cd['body'],{})[_0x8ba3('0x27')](respondWithResult(_0x211933,0xc9))[_0x8ba3('0x46')](handleError(_0x211933,null));};exports[_0x8ba3('0x26')]=function(_0x4c5571,_0x5b7671){if(_0x4c5571[_0x8ba3('0x4a')]['id']){delete _0x4c5571[_0x8ba3('0x4a')]['id'];}return db[_0x8ba3('0x2e')][_0x8ba3('0x4b')]({'where':{'id':_0x4c5571['params']['id']}})[_0x8ba3('0x27')](handleEntityNotFound(_0x5b7671,null))[_0x8ba3('0x27')](saveUpdates(_0x4c5571[_0x8ba3('0x4a')],null))['then'](respondWithResult(_0x5b7671,null))[_0x8ba3('0x46')](handleError(_0x5b7671,null));};exports[_0x8ba3('0x28')]=function(_0x30d962,_0x2ab289){return db[_0x8ba3('0x2e')][_0x8ba3('0x4b')]({'where':{'id':_0x30d962[_0x8ba3('0x47')]['id']}})['then'](handleEntityNotFound(_0x2ab289,null))[_0x8ba3('0x27')](removeEntity(_0x2ab289,null))[_0x8ba3('0x46')](handleError(_0x2ab289,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 6144ee3..5aabfb1 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 _0x35aa=['path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise'];(function(_0x128322,_0x25fedb){var _0x386788=function(_0x44c5fc){while(--_0x44c5fc){_0x128322['push'](_0x128322['shift']());}};_0x386788(++_0x25fedb);}(_0x35aa,0xbe));var _0xa35a=function(_0x8d8485,_0x51d694){_0x8d8485=_0x8d8485-0x0;var _0x50569a=_0x35aa[_0x8d8485];return _0x50569a;};'use strict';var _=require('lodash');var util=require(_0xa35a('0x0'));var logger=require(_0xa35a('0x1'))(_0xa35a('0x2'));var moment=require(_0xa35a('0x3'));var BPromise=require('bluebird');var rp=require(_0xa35a('0x4'));var fs=require('fs');var path=require(_0xa35a('0x5'));var rimraf=require(_0xa35a('0x6'));var config=require(_0xa35a('0x7'));var attributes=require(_0xa35a('0x8'));module[_0xa35a('0x9')]=function(_0x449cfe,_0x10917d){return _0x449cfe['define'](_0xa35a('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa35a('0xb'),'collate':_0xa35a('0xc')});}; \ No newline at end of file +var _0xa631=['api','bluebird','rimraf','../../config/environment','./whatsappApplication.attributes','WhatsappApplication','whatsapp_applications','utf8mb4','util','../../config/logger'];(function(_0x36353c,_0x5d9055){var _0x15a748=function(_0x466d58){while(--_0x466d58){_0x36353c['push'](_0x36353c['shift']());}};_0x15a748(++_0x5d9055);}(_0xa631,0xe4));var _0x1a63=function(_0x7f9376,_0x12334b){_0x7f9376=_0x7f9376-0x0;var _0x1217e4=_0xa631[_0x7f9376];return _0x1217e4;};'use strict';var _=require('lodash');var util=require(_0x1a63('0x0'));var logger=require(_0x1a63('0x1'))(_0x1a63('0x2'));var moment=require('moment');var BPromise=require(_0x1a63('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1a63('0x4'));var config=require(_0x1a63('0x5'));var attributes=require(_0x1a63('0x6'));module['exports']=function(_0x51ff47,_0x5a2067){return _0x51ff47['define'](_0x1a63('0x7'),attributes,{'tableName':_0x1a63('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1a63('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 9479a61..687cc7e 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 _0xfd28=['error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4a7180,_0x42434a){var _0x398f07=function(_0x56e9be){while(--_0x56e9be){_0x4a7180['push'](_0x4a7180['shift']());}};_0x398f07(++_0x42434a);}(_0xfd28,0x148));var _0x8fd2=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xfd28[_0x20a558];return _0x53d3f7;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','WhatsappApplication,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x37c20c,_0x307ba5){var _0x4bb42c=function(_0x403e7b){while(--_0x403e7b){_0x37c20c['push'](_0x37c20c['shift']());}};_0x4bb42c(++_0x307ba5);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index c44f854..72993e5 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 _0x0e4b=['/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','express','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x2d3f34,_0x2fe664){var _0x1f9e81=function(_0xdcb72f){while(--_0xdcb72f){_0x2d3f34['push'](_0x2d3f34['shift']());}};_0x1f9e81(++_0x2fe664);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x39de07,_0x59d3e3){_0x39de07=_0x39de07-0x0;var _0x5b95d5=_0x0e4b[_0x39de07];return _0x5b95d5;};'use strict';var multer=require(_0xb0e4('0x0'));var util=require(_0xb0e4('0x1'));var path=require(_0xb0e4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb0e4('0x3'));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(_0xb0e4('0x4'));var controller=require(_0xb0e4('0x5'));router['get']('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x7')]);router[_0xb0e4('0x8')](_0xb0e4('0x9'),auth[_0xb0e4('0x6')](),controller['describe']);router['get'](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xb')]);router[_0xb0e4('0x8')](_0xb0e4('0xc'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xd')]);router[_0xb0e4('0x8')](_0xb0e4('0xe'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0xf')]);router[_0xb0e4('0x10')]('/',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x11')]);router[_0xb0e4('0x10')]('/:id/messages',auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x12')]);router['post'](_0xb0e4('0x13'),auth[_0xb0e4('0x6')](),interaction[_0xb0e4('0x14')](_0xb0e4('0x15'),_0xb0e4('0x16')),controller['addTags']);router['put'](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),interaction['tracked'](_0xb0e4('0x15'),_0xb0e4('0x17')),controller[_0xb0e4('0x18')]);router[_0xb0e4('0x19')](_0xb0e4('0xa'),auth[_0xb0e4('0x6')](),interaction['tracked']('whatsapp','whatsappinteraction:destroy'),controller[_0xb0e4('0x1a')]);router[_0xb0e4('0x19')](_0xb0e4('0x13'),auth[_0xb0e4('0x6')](),controller[_0xb0e4('0x1b')]);module[_0xb0e4('0x1c')]=router; \ No newline at end of file +var _0x8c46=['whatsappinteraction:addtags','addTags','update','delete','whatsapp','whatsappinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x3253f8,_0xfb50af){var _0x562c07=function(_0x1e9f49){while(--_0x1e9f49){_0x3253f8['push'](_0x3253f8['shift']());}};_0x562c07(++_0xfb50af);}(_0x8c46,0x171));var _0x68c4=function(_0x33cf66,_0x30e414){_0x33cf66=_0x33cf66-0x0;var _0x3a400b=_0x8c46[_0x33cf66];return _0x3a400b;};'use strict';var multer=require(_0x68c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x68c4('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x68c4('0x2'));var auth=require(_0x68c4('0x3'));var interaction=require(_0x68c4('0x4'));var config=require(_0x68c4('0x5'));var controller=require(_0x68c4('0x6'));router[_0x68c4('0x7')]('/',auth[_0x68c4('0x8')](),controller[_0x68c4('0x9')]);router[_0x68c4('0x7')](_0x68c4('0xa'),auth['isAuthenticated'](),controller[_0x68c4('0xb')]);router[_0x68c4('0x7')](_0x68c4('0xc'),auth['isAuthenticated'](),controller[_0x68c4('0xd')]);router[_0x68c4('0x7')](_0x68c4('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0x68c4('0x7')](_0x68c4('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x68c4('0x10')]('/',auth[_0x68c4('0x8')](),controller[_0x68c4('0x11')]);router['post'](_0x68c4('0xe'),auth[_0x68c4('0x8')](),controller[_0x68c4('0x12')]);router['post'](_0x68c4('0x13'),auth[_0x68c4('0x8')](),interaction[_0x68c4('0x14')]('whatsapp',_0x68c4('0x15')),controller[_0x68c4('0x16')]);router['put'](_0x68c4('0xc'),auth['isAuthenticated'](),interaction[_0x68c4('0x14')]('whatsapp','whatsappinteraction:update'),controller[_0x68c4('0x17')]);router[_0x68c4('0x18')]('/:id',auth[_0x68c4('0x8')](),interaction[_0x68c4('0x14')](_0x68c4('0x19'),_0x68c4('0x1a')),controller[_0x68c4('0x1b')]);router[_0x68c4('0x18')](_0x68c4('0x13'),auth[_0x68c4('0x8')](),controller[_0x68c4('0x1c')]);module[_0x68c4('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index d2d665f..f293d19 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 _0x5fc3=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM'];(function(_0x9b8ae4,_0x3e37fe){var _0x16749b=function(_0x53cf70){while(--_0x53cf70){_0x9b8ae4['push'](_0x9b8ae4['shift']());}};_0x16749b(++_0x3e37fe);}(_0x5fc3,0xa8));var _0x35fc=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0x5fc3[_0x325501];return _0x2c1626;};'use strict';var Sequelize=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));module['exports']={'closed':{'type':Sequelize[_0x35fc('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x35fc('0x3')]},'disposition':{'type':Sequelize[_0x35fc('0x4')]},'secondDisposition':{'type':Sequelize[_0x35fc('0x4')]},'thirdDisposition':{'type':Sequelize[_0x35fc('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x35fc('0x4')]},'read1stAt':{'type':Sequelize[_0x35fc('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x35fc('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x35fc('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x35fc('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6ec2=['ENUM','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0x6ec2,0x78));var _0x26ec=function(_0x38a507,_0x22abac){_0x38a507=_0x38a507-0x0;var _0x3fd3be=_0x6ec2[_0x38a507];return _0x3fd3be;};'use strict';var Sequelize=require(_0x26ec('0x0'));var moment=require(_0x26ec('0x1'));module[_0x26ec('0x2')]={'closed':{'type':Sequelize[_0x26ec('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x26ec('0x4')]},'disposition':{'type':Sequelize[_0x26ec('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x26ec('0x5')]},'note':{'type':Sequelize[_0x26ec('0x5')]},'phone':{'type':Sequelize[_0x26ec('0x5')]},'read1stAt':{'type':Sequelize[_0x26ec('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x26ec('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x26ec('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x26ec('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ee2d724..441f95b 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 _0xd7a4=['rimraf','zip-dir','bluebird','util','path','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','stack','send','index','map','WhatsappInteraction','fieldName','type','key','getOptions','findAll','whatsapp','query','user','then','catch','params','model','keys','rawAttributes','filters','intersection','fields','length','attributes','includeAll','include','merge','create','body','find','describe','addMessage','WhatsappMessage','omit','getMessages','findOne','nolimit','order','sort','where','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','ids','spread','Tag','name','emit','whatsappInteractionTags:save','removeTags','join','files','root','server','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','attachments','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','closed','closedAt','disposition','basename','existsSync','pipe','createWriteStream','toString','System','lastName','out','read','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','download','log'];(function(_0x12e073,_0x2a6387){var _0x17e67b=function(_0x61b780){while(--_0x61b780){_0x12e073['push'](_0x12e073['shift']());}};_0x17e67b(++_0x2a6387);}(_0xd7a4,0x7e));var _0x4d7a=function(_0xa298a2,_0x45b471){_0xa298a2=_0xa298a2-0x0;var _0x530b9f=_0xd7a4[_0xa298a2];return _0x530b9f;};'use strict';var rimraf=require(_0x4d7a('0x0'));var zipdir=require(_0x4d7a('0x1'));var moment=require('moment');var BPromise=require(_0x4d7a('0x2'));var util=require(_0x4d7a('0x3'));var path=require(_0x4d7a('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4d7a('0x5'));var Redis=require('ioredis');var interaction=require(_0x4d7a('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x4d7a('0x7'));var logger=require(_0x4d7a('0x8'))(_0x4d7a('0x9'));var config=require(_0x4d7a('0xa'));var db=require(_0x4d7a('0xb'))['db'];config[_0x4d7a('0xc')]=_[_0x4d7a('0xd')](config[_0x4d7a('0xc')],{'host':_0x4d7a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d7a('0xc')]));require('./whatsappInteraction.socket')[_0x4d7a('0xf')](socket);function respondWithStatusCode(_0xddb648,_0x5badc5){_0x5badc5=_0x5badc5||0xcc;return function(_0x555c3a){if(_0x555c3a){return _0xddb648['sendStatus'](_0x5badc5);}return _0xddb648[_0x4d7a('0x10')](_0x5badc5)[_0x4d7a('0x11')]();};}function respondWithResult(_0x28c011,_0x37d2c0){_0x37d2c0=_0x37d2c0||0xc8;return function(_0x15f137){if(_0x15f137){return _0x28c011[_0x4d7a('0x10')](_0x37d2c0)[_0x4d7a('0x12')](_0x15f137);}};}function respondWithFilteredResult(_0x65905,_0x183fe1){return function(_0x1e8d6d){if(_0x1e8d6d){var _0x29edf3=typeof _0x183fe1[_0x4d7a('0x13')]===_0x4d7a('0x14')&&typeof _0x183fe1[_0x4d7a('0x15')]===_0x4d7a('0x14');var _0x4db1b0=_0x1e8d6d[_0x4d7a('0x16')];var _0x3670ef=_0x29edf3?0x0:_0x183fe1[_0x4d7a('0x13')];var _0x481fdf=_0x29edf3?_0x1e8d6d[_0x4d7a('0x16')]:_0x183fe1[_0x4d7a('0x13')]+_0x183fe1[_0x4d7a('0x15')];var _0x37fb31;if(_0x481fdf>=_0x4db1b0){_0x481fdf=_0x4db1b0;_0x37fb31=0xc8;}else{_0x37fb31=0xce;}_0x65905[_0x4d7a('0x10')](_0x37fb31);return _0x65905[_0x4d7a('0x17')](_0x4d7a('0x18'),_0x3670ef+'-'+_0x481fdf+'/'+_0x4db1b0)[_0x4d7a('0x12')](_0x1e8d6d);}return null;};}function saveUpdates(_0x392588){return function(_0x5d6407){if(_0x5d6407){return _0x5d6407[_0x4d7a('0x19')](_0x392588)['then'](function(_0x2b27cb){return _0x2b27cb;});}return null;};}function removeEntity(_0xd4da09){return function(_0x450f36){if(_0x450f36){return _0x450f36[_0x4d7a('0x1a')]()['then'](function(){_0xd4da09[_0x4d7a('0x10')](0xcc)[_0x4d7a('0x11')]();});}};}function handleEntityNotFound(_0x129ab5){return function(_0x288d5e){if(!_0x288d5e){_0x129ab5[_0x4d7a('0x1b')](0x194);}return _0x288d5e;};}function handleError(_0x4538e4,_0x1adba0){_0x1adba0=_0x1adba0||0x1f4;return function(_0x2eb19b){logger['error'](_0x2eb19b[_0x4d7a('0x1c')]);if(_0x2eb19b['name']){delete _0x2eb19b['name'];}_0x4538e4[_0x4d7a('0x10')](_0x1adba0)[_0x4d7a('0x1d')](_0x2eb19b);};}exports[_0x4d7a('0x1e')]=function(_0x438ec7,_0x38e38a){var _0x256f4f={};var _0x29f84f=_[_0x4d7a('0x1f')](db[_0x4d7a('0x20')]['rawAttributes'],function(_0x3631b0){return{'name':_0x3631b0[_0x4d7a('0x21')],'type':_0x3631b0[_0x4d7a('0x22')][_0x4d7a('0x23')]};});_0x256f4f=qs[_0x4d7a('0x24')](_0x29f84f,_0x438ec7);return interaction[_0x4d7a('0x25')](_0x4d7a('0x26'),_0x438ec7[_0x4d7a('0x27')],_0x438ec7[_0x4d7a('0x28')],_0x256f4f,_0x29f84f)[_0x4d7a('0x29')](respondWithFilteredResult(_0x38e38a,_0x256f4f))[_0x4d7a('0x2a')](handleError(_0x38e38a,null));};exports['show']=function(_0x2840c7,_0xfbb503){var _0x5bae65={'raw':![],'where':{'id':_0x2840c7[_0x4d7a('0x2b')]['id']}},_0x464595={};_0x464595[_0x4d7a('0x2c')]=_[_0x4d7a('0x2d')](db['WhatsappInteraction'][_0x4d7a('0x2e')]);_0x464595['query']=_['keys'](_0x2840c7['query']);_0x464595[_0x4d7a('0x2f')]=_[_0x4d7a('0x30')](_0x464595['model'],_0x464595[_0x4d7a('0x27')]);_0x5bae65['attributes']=_[_0x4d7a('0x30')](_0x464595[_0x4d7a('0x2c')],qs[_0x4d7a('0x31')](_0x2840c7[_0x4d7a('0x27')][_0x4d7a('0x31')]));_0x5bae65['attributes']=_0x5bae65['attributes'][_0x4d7a('0x32')]?_0x5bae65[_0x4d7a('0x33')]:_0x464595[_0x4d7a('0x2c')];if(_0x2840c7[_0x4d7a('0x27')][_0x4d7a('0x34')]){_0x5bae65[_0x4d7a('0x35')]=[{'all':!![]}];}_0x5bae65=_[_0x4d7a('0x36')]({},_0x5bae65,_0x2840c7['options']);return db[_0x4d7a('0x20')]['find'](_0x5bae65)[_0x4d7a('0x29')](handleEntityNotFound(_0xfbb503,null))[_0x4d7a('0x29')](respondWithResult(_0xfbb503,null))[_0x4d7a('0x2a')](handleError(_0xfbb503,null));};exports[_0x4d7a('0x37')]=function(_0x144c34,_0x2b38dd){return db['WhatsappInteraction'][_0x4d7a('0x37')](_0x144c34[_0x4d7a('0x38')],{})[_0x4d7a('0x29')](respondWithResult(_0x2b38dd,0xc9))['catch'](handleError(_0x2b38dd,null));};exports[_0x4d7a('0x19')]=function(_0x38ae66,_0x3a4037){if(_0x38ae66[_0x4d7a('0x38')]['id']){delete _0x38ae66['body']['id'];}return db[_0x4d7a('0x20')][_0x4d7a('0x39')]({'where':{'id':_0x38ae66['params']['id']}})[_0x4d7a('0x29')](handleEntityNotFound(_0x3a4037,null))[_0x4d7a('0x29')](saveUpdates(_0x38ae66[_0x4d7a('0x38')],null))[_0x4d7a('0x29')](respondWithResult(_0x3a4037,null))[_0x4d7a('0x2a')](handleError(_0x3a4037,null));};exports[_0x4d7a('0x1a')]=function(_0x1734c1,_0x37a09e){return db[_0x4d7a('0x20')]['find']({'where':{'id':_0x1734c1[_0x4d7a('0x2b')]['id']}})[_0x4d7a('0x29')](handleEntityNotFound(_0x37a09e,null))[_0x4d7a('0x29')](removeEntity(_0x37a09e,null))[_0x4d7a('0x2a')](handleError(_0x37a09e,null));};exports[_0x4d7a('0x3a')]=function(_0xa1671,_0x3795e6){return db[_0x4d7a('0x20')]['describe']()[_0x4d7a('0x29')](respondWithResult(_0x3795e6,null))[_0x4d7a('0x2a')](handleError(_0x3795e6,null));};exports[_0x4d7a('0x3b')]=function(_0x4523c3,_0x24d14d){return db[_0x4d7a('0x3c')][_0x4d7a('0x39')]({'where':{'id':_0x4523c3[_0x4d7a('0x2b')]['id']}})[_0x4d7a('0x29')](handleEntityNotFound(_0x24d14d,null))[_0x4d7a('0x29')](function(_0x2c3eda){if(_0x2c3eda){return _0x2c3eda['addMessage'](_0x4523c3[_0x4d7a('0x38')]['ids'],_[_0x4d7a('0x3d')](_0x4523c3[_0x4d7a('0x38')],['ids','id'])||{});}})[_0x4d7a('0x29')](respondWithResult(_0x24d14d,null))['catch'](handleError(_0x24d14d,null));};exports[_0x4d7a('0x3e')]=function(_0x1deee0,_0x5e527c){var _0x2753c1={'raw':![],'where':{}};var _0x1a2974={};var _0x5554a4={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x4d7a('0x3f')]({'where':{'id':_0x1deee0['params']['id']}})[_0x4d7a('0x29')](handleEntityNotFound(_0x5e527c,null))[_0x4d7a('0x29')](function(_0x1f7f8d){if(_0x1f7f8d){_0x1a2974['model']=_['keys'](db['WhatsappMessage'][_0x4d7a('0x2e')]);_0x1a2974[_0x4d7a('0x27')]=_['keys'](_0x1deee0[_0x4d7a('0x27')]);_0x1a2974['filters']=_['intersection'](_0x1a2974['model'],_0x1a2974[_0x4d7a('0x27')]);_0x2753c1[_0x4d7a('0x33')]=_[_0x4d7a('0x30')](_0x1a2974[_0x4d7a('0x2c')],qs['fields'](_0x1deee0[_0x4d7a('0x27')]['fields']));_0x2753c1['attributes']=_0x2753c1[_0x4d7a('0x33')][_0x4d7a('0x32')]?_0x2753c1['attributes']:_0x1a2974[_0x4d7a('0x2c')];if(!_0x1deee0['query']['hasOwnProperty'](_0x4d7a('0x40'))){_0x2753c1[_0x4d7a('0x15')]=qs[_0x4d7a('0x15')](_0x1deee0[_0x4d7a('0x27')]['limit']);_0x2753c1['offset']=qs[_0x4d7a('0x13')](_0x1deee0['query'][_0x4d7a('0x13')]);}_0x2753c1[_0x4d7a('0x41')]=qs[_0x4d7a('0x42')](_0x1deee0[_0x4d7a('0x27')][_0x4d7a('0x42')]);_0x2753c1[_0x4d7a('0x43')]=qs[_0x4d7a('0x2f')](_['pick'](_0x1deee0[_0x4d7a('0x27')],_0x1a2974['filters']));_0x2753c1[_0x4d7a('0x43')]['WhatsappInteractionId']=_0x1f7f8d['id'];if(_0x1deee0[_0x4d7a('0x27')]['filter']){_0x2753c1['where']=_[_0x4d7a('0x36')](_0x2753c1[_0x4d7a('0x43')],{'$or':_['map'](_0x2753c1[_0x4d7a('0x33')],function(_0x2b87e0){var _0x4cfd61={};_0x4cfd61[_0x2b87e0]={'$like':'%'+_0x1deee0[_0x4d7a('0x27')][_0x4d7a('0x44')]+'%'};return _0x4cfd61;})});}if(_0x1deee0[_0x4d7a('0x27')][_0x4d7a('0x45')]){var _0x58c895=_0x1deee0[_0x4d7a('0x27')]['$gte'][_0x4d7a('0x46')](',');var _0x1619d5={};_0x1619d5[_0x58c895[0x0]]={'$gte':moment(_0x58c895[0x1])[_0x4d7a('0x47')](_0x4d7a('0x48'))};_0x2753c1[_0x4d7a('0x43')]=_[_0x4d7a('0x36')](_0x2753c1[_0x4d7a('0x43')],_0x1619d5);}_0x2753c1=_[_0x4d7a('0x36')]({},_0x2753c1,_0x1deee0[_0x4d7a('0x49')]);return db[_0x4d7a('0x3c')][_0x4d7a('0x16')]({'where':_0x2753c1[_0x4d7a('0x43')]})['then'](function(_0x85382c){_0x5554a4[_0x4d7a('0x16')]=_0x85382c;if(_0x1deee0['query'][_0x4d7a('0x34')]){_0x2753c1[_0x4d7a('0x35')]=[{'all':!![]}];}return db[_0x4d7a('0x3c')][_0x4d7a('0x25')](_0x2753c1);})[_0x4d7a('0x29')](function(_0x5f376b){_0x5554a4['rows']=_0x5f376b;return _0x5554a4;});}})['then'](respondWithFilteredResult(_0x5e527c,_0x2753c1))['catch'](handleError(_0x5e527c,null));};exports[_0x4d7a('0x4a')]=function(_0x58dff6,_0x560b33){return db['WhatsappInteraction']['find']({'where':{'id':_0x58dff6['params']['id']}})[_0x4d7a('0x29')](handleEntityNotFound(_0x560b33,null))[_0x4d7a('0x29')](function(_0x388894){if(_0x388894){return _0x388894[_0x4d7a('0x4b')](_0x58dff6['body']['ids'],_['omit'](_0x58dff6[_0x4d7a('0x38')],[_0x4d7a('0x4c'),'id'])||{})[_0x4d7a('0x4d')](function(){return db[_0x4d7a('0x4e')][_0x4d7a('0x25')]({'attributes':['id',_0x4d7a('0x4f'),'color'],'where':{'id':_0x58dff6[_0x4d7a('0x38')][_0x4d7a('0x4c')]}});})[_0x4d7a('0x29')](function(_0x33b774){socket[_0x4d7a('0x50')](_0x4d7a('0x51'),{'id':Number(_0x58dff6[_0x4d7a('0x2b')]['id']),'tags':_0x33b774||[]});return{'id':Number(_0x58dff6[_0x4d7a('0x2b')]['id']),'tags':_0x33b774||[]};});}})[_0x4d7a('0x29')](respondWithResult(_0x560b33,null))[_0x4d7a('0x2a')](handleError(_0x560b33,null));};exports[_0x4d7a('0x52')]=function(_0x518826,_0x29dc71){return db[_0x4d7a('0x20')][_0x4d7a('0x39')]({'where':{'id':_0x518826[_0x4d7a('0x2b')]['id']}})[_0x4d7a('0x29')](handleEntityNotFound(_0x29dc71,null))[_0x4d7a('0x29')](function(_0x193c06){if(_0x193c06){return _0x193c06[_0x4d7a('0x52')](_0x518826[_0x4d7a('0x27')]['ids']);}})[_0x4d7a('0x29')](respondWithStatusCode(_0x29dc71,null))[_0x4d7a('0x2a')](handleError(_0x29dc71,null));};exports['download']=function(_0x4d59ba,_0x1ed7b9){var _0xbae933=moment()['unix']()['toString']();var _0x382101=path[_0x4d7a('0x53')](config['root'],'server',_0x4d7a('0x54'),'tmp');var _0x320be7=path[_0x4d7a('0x53')](config[_0x4d7a('0x55')],_0x4d7a('0x56'),'files','attachments');var _0x7cd799=path['join'](_0x382101,_0xbae933);var _0x304b57=util[_0x4d7a('0x47')](_0x4d7a('0x57'),_0x4d59ba[_0x4d7a('0x2b')]['id'],_0xbae933);var _0x8ab86=path[_0x4d7a('0x53')](_0x382101,_0x304b57);var _0x370234=[];_0x370234['push']({'model':db['User'],'as':_0x4d7a('0x58'),'attributes':['id',_0x4d7a('0x59')],'raw':!![]});_0x370234[_0x4d7a('0x5a')]({'model':db[_0x4d7a('0x5b')],'as':_0x4d7a('0x5c'),'attributes':['id',_0x4d7a('0x5d'),'lastName'],'raw':!![]});if(_0x4d59ba['query'][_0x4d7a('0x5e')]){_0x370234[_0x4d7a('0x5a')]({'model':db['Attachment'],'as':_0x4d7a('0x5f'),'raw':!![]});}var _0x261af9=[{'model':db[_0x4d7a('0x3c')],'as':_0x4d7a('0x60'),'attributes':['id',_0x4d7a('0x38'),_0x4d7a('0x61'),_0x4d7a('0x62'),_0x4d7a('0x63'),'read'],'include':_0x370234}];_0x261af9['push']({'model':db[_0x4d7a('0x64')],'as':_0x4d7a('0x65'),'attributes':['id','name']});_0x261af9[_0x4d7a('0x5a')]({'model':db[_0x4d7a('0x58')],'as':'Owner','attributes':['id',_0x4d7a('0x59')]});return db['WhatsappInteraction'][_0x4d7a('0x39')]({'where':{'id':_0x4d59ba[_0x4d7a('0x2b')]['id']},'include':_0x261af9})[_0x4d7a('0x29')](handleEntityNotFound(_0x1ed7b9,null))['then'](function(_0x3cf061){if(_0x3cf061){var _0xce259f=_0x3cf061[_0x4d7a('0x66')]({'plain':!![]});fs[_0x4d7a('0x67')](_0x7cd799);var _0x6b4338={'channel':_0x4d7a('0x68'),'account':_0xce259f[_0x4d7a('0x65')][_0x4d7a('0x4f')],'agent':_0xce259f[_0x4d7a('0x69')]?_0xce259f[_0x4d7a('0x69')][_0x4d7a('0x59')]:'N.A.','createdAt':moment(_0xce259f['createdAt'])[_0x4d7a('0x47')](_0x4d7a('0x48'))['toString'](),'closedAt':_0xce259f[_0x4d7a('0x6a')]?moment(_0xce259f[_0x4d7a('0x6b')])[_0x4d7a('0x47')](_0x4d7a('0x48'))['toString']():'','disposition':_0xce259f[_0x4d7a('0x6c')],'messages':_(_0xce259f['Messages'])['filter']({'secret':![]})[_0x4d7a('0x1f')](function(_0x190837){if(_0x190837[_0x4d7a('0x5f')]){var _0x5cbb84=path['join'](_0x320be7,_0x190837['Attachment'][_0x4d7a('0x6d')]);if(fs[_0x4d7a('0x6e')](_0x5cbb84)){fs['createReadStream'](_0x5cbb84)[_0x4d7a('0x6f')](fs[_0x4d7a('0x70')](path[_0x4d7a('0x53')](_0x7cd799,_0x190837[_0x4d7a('0x5f')]['basename'])));}}return{'date':moment(_0x190837[_0x4d7a('0x61')])[_0x4d7a('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4d7a('0x71')](),'sender':_0x190837[_0x4d7a('0x62')]==='out'?_0x190837[_0x4d7a('0x58')]?_0x190837[_0x4d7a('0x58')][_0x4d7a('0x59')]:_0x4d7a('0x72'):_0x190837[_0x4d7a('0x5c')][_0x4d7a('0x5d')]+(_0x190837['Contact'][_0x4d7a('0x73')]?'\x20'+_0x190837[_0x4d7a('0x5c')]['lastName']:''),'body':_0x190837['Attachment']?_0x190837[_0x4d7a('0x5f')][_0x4d7a('0x6d')]:_0x190837['body'],'direction':_0x190837['direction']===_0x4d7a('0x74')?'A':'C','secret':_0x190837['secret'],'read':_0x190837[_0x4d7a('0x75')],'attachment':_0x190837['Attachment']};})[_0x4d7a('0x76')]()};return ejs[_0x4d7a('0x77')](path[_0x4d7a('0x53')](config[_0x4d7a('0x55')],_0x4d7a('0x56'),_0x4d7a('0x78'),_0x4d7a('0x79')),{'interaction':_0x6b4338})[_0x4d7a('0x29')](function(_0x4b35a8){var _0x9fc325=path['join'](_0x7cd799,'transcript-'+_0xce259f['id']+'-'+_0xbae933+_0x4d7a('0x7a'));var _0x5043b0={'path':_0x9fc325,'channel':_0x4d7a('0x68'),'interactionId':_0xce259f['id']};return pdf[_0x4d7a('0x7b')](_0x4b35a8,_0x5043b0);})[_0x4d7a('0x29')](function(){return new BPromise(function(_0x5955f8,_0x40ce6f){zipdir(_0x7cd799,{'saveTo':_0x8ab86},function(_0xa62d10,_0x48c81e){if(_0xa62d10)return _0x40ce6f(_0xa62d10);return _0x5955f8(_0x48c81e);});})['then'](function(){return new BPromise(function(_0x55a171,_0x11d547){rimraf(_0x7cd799,function(_0x40de5b){if(_0x40de5b)_0x11d547(_0x40de5b);return _0x55a171();});});})[_0x4d7a('0x29')](function(){return _0x1ed7b9[_0x4d7a('0x7c')](_0x8ab86,_0x304b57,function(_0x2a07c6){if(_0x2a07c6){console[_0x4d7a('0x7d')]('err',_0x2a07c6);}else{fs['unlinkSync'](_0x8ab86);}});});});}else{return _0x1ed7b9['sendStatus'](0xc8);}})['catch'](handleError(_0x1ed7b9,null));}; \ No newline at end of file +var _0x91ab=['push','fullname','CmContact','Contact','lastName','Messages','createdAt','secret','WhatsappAccount','User','Owner','get','mkdirSync','Whatsapp','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','Attachment','basename','createReadStream','pipe','direction','System','firstName','out','read','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','rimraf','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','whatsapp','query','user','catch','params','model','filters','intersection','attributes','length','includeAll','include','options','find','create','body','describe','addMessage','WhatsappMessage','omit','getMessages','keys','fields','hasOwnProperty','nolimit','limit','order','sort','where','WhatsappInteractionId','filter','merge','$gte','findAll','rows','addTags','ids','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','format'];(function(_0x3421f8,_0x3e5d70){var _0x2d4e8a=function(_0x404bd5){while(--_0x404bd5){_0x3421f8['push'](_0x3421f8['shift']());}};_0x2d4e8a(++_0x3e5d70);}(_0x91ab,0x194));var _0xb91a=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x91ab[_0xe66cf2];return _0x2d84e7;};'use strict';var rimraf=require(_0xb91a('0x0'));var zipdir=require('zip-dir');var moment=require(_0xb91a('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0xb91a('0x2'));var ejs=require(_0xb91a('0x3'));var fs=require('fs');var _=require(_0xb91a('0x4'));var Redis=require(_0xb91a('0x5'));var interaction=require(_0xb91a('0x6'));var qs=require(_0xb91a('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xb91a('0x8'))('api');var config=require(_0xb91a('0x9'));var db=require(_0xb91a('0xa'))['db'];config['redis']=_[_0xb91a('0xb')](config['redis'],{'host':_0xb91a('0xc'),'port':0x18eb});var socket=require(_0xb91a('0xd'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0xb91a('0xe')](socket);function respondWithStatusCode(_0x5350fa,_0x36152f){_0x36152f=_0x36152f||0xcc;return function(_0x2e1121){if(_0x2e1121){return _0x5350fa[_0xb91a('0xf')](_0x36152f);}return _0x5350fa[_0xb91a('0x10')](_0x36152f)['end']();};}function respondWithResult(_0x4407b7,_0x137cb2){_0x137cb2=_0x137cb2||0xc8;return function(_0x26214c){if(_0x26214c){return _0x4407b7[_0xb91a('0x10')](_0x137cb2)[_0xb91a('0x11')](_0x26214c);}};}function respondWithFilteredResult(_0x3d2cda,_0x1eb3ea){return function(_0x56e409){if(_0x56e409){var _0x38f46e=typeof _0x1eb3ea[_0xb91a('0x12')]===_0xb91a('0x13')&&typeof _0x1eb3ea['limit']===_0xb91a('0x13');var _0xdcb89c=_0x56e409[_0xb91a('0x14')];var _0x8ac259=_0x38f46e?0x0:_0x1eb3ea[_0xb91a('0x12')];var _0x4aea37=_0x38f46e?_0x56e409[_0xb91a('0x14')]:_0x1eb3ea[_0xb91a('0x12')]+_0x1eb3ea['limit'];var _0x16f943;if(_0x4aea37>=_0xdcb89c){_0x4aea37=_0xdcb89c;_0x16f943=0xc8;}else{_0x16f943=0xce;}_0x3d2cda[_0xb91a('0x10')](_0x16f943);return _0x3d2cda[_0xb91a('0x15')](_0xb91a('0x16'),_0x8ac259+'-'+_0x4aea37+'/'+_0xdcb89c)[_0xb91a('0x11')](_0x56e409);}return null;};}function saveUpdates(_0x447df9){return function(_0x19caaf){if(_0x19caaf){return _0x19caaf[_0xb91a('0x17')](_0x447df9)[_0xb91a('0x18')](function(_0x52c4cb){return _0x52c4cb;});}return null;};}function removeEntity(_0x32c20f){return function(_0x216d73){if(_0x216d73){return _0x216d73[_0xb91a('0x19')]()[_0xb91a('0x18')](function(){_0x32c20f[_0xb91a('0x10')](0xcc)[_0xb91a('0x1a')]();});}};}function handleEntityNotFound(_0x5051f9){return function(_0x3d5d27){if(!_0x3d5d27){_0x5051f9[_0xb91a('0xf')](0x194);}return _0x3d5d27;};}function handleError(_0x418b69,_0x14433a){_0x14433a=_0x14433a||0x1f4;return function(_0x50b920){logger[_0xb91a('0x1b')](_0x50b920[_0xb91a('0x1c')]);if(_0x50b920[_0xb91a('0x1d')]){delete _0x50b920['name'];}_0x418b69[_0xb91a('0x10')](_0x14433a)[_0xb91a('0x1e')](_0x50b920);};}exports[_0xb91a('0x1f')]=function(_0x3f2299,_0x18343e){var _0x5f5059={};var _0x4a53a3=_[_0xb91a('0x20')](db[_0xb91a('0x21')][_0xb91a('0x22')],function(_0x182c75){return{'name':_0x182c75[_0xb91a('0x23')],'type':_0x182c75[_0xb91a('0x24')][_0xb91a('0x25')]};});_0x5f5059=qs[_0xb91a('0x26')](_0x4a53a3,_0x3f2299);return interaction['findAll'](_0xb91a('0x27'),_0x3f2299[_0xb91a('0x28')],_0x3f2299[_0xb91a('0x29')],_0x5f5059,_0x4a53a3)[_0xb91a('0x18')](respondWithFilteredResult(_0x18343e,_0x5f5059))[_0xb91a('0x2a')](handleError(_0x18343e,null));};exports['show']=function(_0x2a453b,_0x39afdf){var _0xa99686={'raw':![],'where':{'id':_0x2a453b[_0xb91a('0x2b')]['id']}},_0x205353={};_0x205353[_0xb91a('0x2c')]=_['keys'](db[_0xb91a('0x21')][_0xb91a('0x22')]);_0x205353[_0xb91a('0x28')]=_['keys'](_0x2a453b['query']);_0x205353[_0xb91a('0x2d')]=_[_0xb91a('0x2e')](_0x205353[_0xb91a('0x2c')],_0x205353[_0xb91a('0x28')]);_0xa99686['attributes']=_['intersection'](_0x205353['model'],qs['fields'](_0x2a453b['query']['fields']));_0xa99686[_0xb91a('0x2f')]=_0xa99686[_0xb91a('0x2f')][_0xb91a('0x30')]?_0xa99686['attributes']:_0x205353[_0xb91a('0x2c')];if(_0x2a453b[_0xb91a('0x28')][_0xb91a('0x31')]){_0xa99686[_0xb91a('0x32')]=[{'all':!![]}];}_0xa99686=_['merge']({},_0xa99686,_0x2a453b[_0xb91a('0x33')]);return db[_0xb91a('0x21')][_0xb91a('0x34')](_0xa99686)[_0xb91a('0x18')](handleEntityNotFound(_0x39afdf,null))['then'](respondWithResult(_0x39afdf,null))['catch'](handleError(_0x39afdf,null));};exports[_0xb91a('0x35')]=function(_0x3faa81,_0x16ae20){return db[_0xb91a('0x21')]['create'](_0x3faa81[_0xb91a('0x36')],{})[_0xb91a('0x18')](respondWithResult(_0x16ae20,0xc9))[_0xb91a('0x2a')](handleError(_0x16ae20,null));};exports[_0xb91a('0x17')]=function(_0x592463,_0x19fa0e){if(_0x592463[_0xb91a('0x36')]['id']){delete _0x592463[_0xb91a('0x36')]['id'];}return db['WhatsappInteraction'][_0xb91a('0x34')]({'where':{'id':_0x592463[_0xb91a('0x2b')]['id']}})[_0xb91a('0x18')](handleEntityNotFound(_0x19fa0e,null))[_0xb91a('0x18')](saveUpdates(_0x592463[_0xb91a('0x36')],null))[_0xb91a('0x18')](respondWithResult(_0x19fa0e,null))[_0xb91a('0x2a')](handleError(_0x19fa0e,null));};exports[_0xb91a('0x19')]=function(_0x1c4736,_0x2b716e){return db['WhatsappInteraction']['find']({'where':{'id':_0x1c4736['params']['id']}})[_0xb91a('0x18')](handleEntityNotFound(_0x2b716e,null))['then'](removeEntity(_0x2b716e,null))[_0xb91a('0x2a')](handleError(_0x2b716e,null));};exports['describe']=function(_0x2e674c,_0x2a3c2f){return db[_0xb91a('0x21')][_0xb91a('0x37')]()[_0xb91a('0x18')](respondWithResult(_0x2a3c2f,null))[_0xb91a('0x2a')](handleError(_0x2a3c2f,null));};exports[_0xb91a('0x38')]=function(_0x53401d,_0x10e075){return db[_0xb91a('0x39')][_0xb91a('0x34')]({'where':{'id':_0x53401d[_0xb91a('0x2b')]['id']}})['then'](handleEntityNotFound(_0x10e075,null))[_0xb91a('0x18')](function(_0x6c241){if(_0x6c241){return _0x6c241['addMessage'](_0x53401d[_0xb91a('0x36')]['ids'],_[_0xb91a('0x3a')](_0x53401d[_0xb91a('0x36')],['ids','id'])||{});}})[_0xb91a('0x18')](respondWithResult(_0x10e075,null))[_0xb91a('0x2a')](handleError(_0x10e075,null));};exports[_0xb91a('0x3b')]=function(_0x488919,_0x50d1e7){var _0x2d0f7f={'raw':![],'where':{}};var _0x57192c={};var _0x2a213b={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x488919['params']['id']}})[_0xb91a('0x18')](handleEntityNotFound(_0x50d1e7,null))[_0xb91a('0x18')](function(_0x35c380){if(_0x35c380){_0x57192c[_0xb91a('0x2c')]=_[_0xb91a('0x3c')](db['WhatsappMessage'][_0xb91a('0x22')]);_0x57192c[_0xb91a('0x28')]=_['keys'](_0x488919[_0xb91a('0x28')]);_0x57192c[_0xb91a('0x2d')]=_[_0xb91a('0x2e')](_0x57192c[_0xb91a('0x2c')],_0x57192c[_0xb91a('0x28')]);_0x2d0f7f[_0xb91a('0x2f')]=_['intersection'](_0x57192c[_0xb91a('0x2c')],qs['fields'](_0x488919[_0xb91a('0x28')][_0xb91a('0x3d')]));_0x2d0f7f[_0xb91a('0x2f')]=_0x2d0f7f[_0xb91a('0x2f')][_0xb91a('0x30')]?_0x2d0f7f[_0xb91a('0x2f')]:_0x57192c[_0xb91a('0x2c')];if(!_0x488919[_0xb91a('0x28')][_0xb91a('0x3e')](_0xb91a('0x3f'))){_0x2d0f7f[_0xb91a('0x40')]=qs['limit'](_0x488919[_0xb91a('0x28')]['limit']);_0x2d0f7f[_0xb91a('0x12')]=qs['offset'](_0x488919[_0xb91a('0x28')][_0xb91a('0x12')]);}_0x2d0f7f[_0xb91a('0x41')]=qs[_0xb91a('0x42')](_0x488919[_0xb91a('0x28')][_0xb91a('0x42')]);_0x2d0f7f['where']=qs[_0xb91a('0x2d')](_['pick'](_0x488919[_0xb91a('0x28')],_0x57192c[_0xb91a('0x2d')]));_0x2d0f7f[_0xb91a('0x43')][_0xb91a('0x44')]=_0x35c380['id'];if(_0x488919['query'][_0xb91a('0x45')]){_0x2d0f7f[_0xb91a('0x43')]=_[_0xb91a('0x46')](_0x2d0f7f['where'],{'$or':_[_0xb91a('0x20')](_0x2d0f7f['attributes'],function(_0x3040b0){var _0x511b08={};_0x511b08[_0x3040b0]={'$like':'%'+_0x488919[_0xb91a('0x28')][_0xb91a('0x45')]+'%'};return _0x511b08;})});}if(_0x488919['query']['$gte']){var _0x544c2d=_0x488919[_0xb91a('0x28')][_0xb91a('0x47')]['split'](',');var _0x4c3192={};_0x4c3192[_0x544c2d[0x0]]={'$gte':moment(_0x544c2d[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2d0f7f['where']=_['merge'](_0x2d0f7f['where'],_0x4c3192);}_0x2d0f7f=_[_0xb91a('0x46')]({},_0x2d0f7f,_0x488919[_0xb91a('0x33')]);return db[_0xb91a('0x39')][_0xb91a('0x14')]({'where':_0x2d0f7f[_0xb91a('0x43')]})[_0xb91a('0x18')](function(_0x1e6edb){_0x2a213b[_0xb91a('0x14')]=_0x1e6edb;if(_0x488919[_0xb91a('0x28')]['includeAll']){_0x2d0f7f['include']=[{'all':!![]}];}return db[_0xb91a('0x39')][_0xb91a('0x48')](_0x2d0f7f);})[_0xb91a('0x18')](function(_0x32f5b1){_0x2a213b[_0xb91a('0x49')]=_0x32f5b1;return _0x2a213b;});}})[_0xb91a('0x18')](respondWithFilteredResult(_0x50d1e7,_0x2d0f7f))[_0xb91a('0x2a')](handleError(_0x50d1e7,null));};exports[_0xb91a('0x4a')]=function(_0x19e3a7,_0x58aedf){return db[_0xb91a('0x21')][_0xb91a('0x34')]({'where':{'id':_0x19e3a7[_0xb91a('0x2b')]['id']}})[_0xb91a('0x18')](handleEntityNotFound(_0x58aedf,null))[_0xb91a('0x18')](function(_0x1dd928){if(_0x1dd928){return _0x1dd928['setTags'](_0x19e3a7[_0xb91a('0x36')][_0xb91a('0x4b')],_[_0xb91a('0x3a')](_0x19e3a7['body'],[_0xb91a('0x4b'),'id'])||{})[_0xb91a('0x4c')](function(){return db[_0xb91a('0x4d')]['findAll']({'attributes':['id',_0xb91a('0x1d'),_0xb91a('0x4e')],'where':{'id':_0x19e3a7[_0xb91a('0x36')]['ids']}});})[_0xb91a('0x18')](function(_0x21eee1){socket[_0xb91a('0x4f')](_0xb91a('0x50'),{'id':Number(_0x19e3a7[_0xb91a('0x2b')]['id']),'tags':_0x21eee1||[]});return{'id':Number(_0x19e3a7[_0xb91a('0x2b')]['id']),'tags':_0x21eee1||[]};});}})['then'](respondWithResult(_0x58aedf,null))['catch'](handleError(_0x58aedf,null));};exports[_0xb91a('0x51')]=function(_0x343c36,_0x538af4){return db[_0xb91a('0x21')]['find']({'where':{'id':_0x343c36[_0xb91a('0x2b')]['id']}})[_0xb91a('0x18')](handleEntityNotFound(_0x538af4,null))[_0xb91a('0x18')](function(_0x598ae6){if(_0x598ae6){return _0x598ae6[_0xb91a('0x51')](_0x343c36[_0xb91a('0x28')]['ids']);}})[_0xb91a('0x18')](respondWithStatusCode(_0x538af4,null))[_0xb91a('0x2a')](handleError(_0x538af4,null));};exports[_0xb91a('0x52')]=function(_0x16537e,_0x150d0c){var _0x1251ec=moment()[_0xb91a('0x53')]()[_0xb91a('0x54')]();var _0x3b12ae=path['join'](config[_0xb91a('0x55')],_0xb91a('0x56'),_0xb91a('0x57'),_0xb91a('0x58'));var _0x119622=path[_0xb91a('0x59')](config[_0xb91a('0x55')],_0xb91a('0x56'),_0xb91a('0x57'),_0xb91a('0x5a'));var _0x36ed91=path[_0xb91a('0x59')](_0x3b12ae,_0x1251ec);var _0x2c2af1=util[_0xb91a('0x5b')]('transcript-%d-%s.zip',_0x16537e['params']['id'],_0x1251ec);var _0x157deb=path[_0xb91a('0x59')](_0x3b12ae,_0x2c2af1);var _0x5b148c=[];_0x5b148c[_0xb91a('0x5c')]({'model':db['User'],'as':'User','attributes':['id',_0xb91a('0x5d')],'raw':!![]});_0x5b148c['push']({'model':db[_0xb91a('0x5e')],'as':_0xb91a('0x5f'),'attributes':['id','firstName',_0xb91a('0x60')],'raw':!![]});if(_0x16537e['query'][_0xb91a('0x5a')]){_0x5b148c[_0xb91a('0x5c')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x525dfd=[{'model':db[_0xb91a('0x39')],'as':_0xb91a('0x61'),'attributes':['id',_0xb91a('0x36'),_0xb91a('0x62'),'direction',_0xb91a('0x63'),'read'],'include':_0x5b148c}];_0x525dfd['push']({'model':db[_0xb91a('0x64')],'as':'Account','attributes':['id',_0xb91a('0x1d')]});_0x525dfd[_0xb91a('0x5c')]({'model':db[_0xb91a('0x65')],'as':_0xb91a('0x66'),'attributes':['id',_0xb91a('0x5d')]});return db[_0xb91a('0x21')][_0xb91a('0x34')]({'where':{'id':_0x16537e[_0xb91a('0x2b')]['id']},'include':_0x525dfd})[_0xb91a('0x18')](handleEntityNotFound(_0x150d0c,null))['then'](function(_0x170159){if(_0x170159){var _0x484939=_0x170159[_0xb91a('0x67')]({'plain':!![]});fs[_0xb91a('0x68')](_0x36ed91);var _0x5ccc3d={'channel':_0xb91a('0x69'),'account':_0x484939['Account'][_0xb91a('0x1d')],'agent':_0x484939['Owner']?_0x484939['Owner'][_0xb91a('0x5d')]:'N.A.','createdAt':moment(_0x484939['createdAt'])[_0xb91a('0x5b')](_0xb91a('0x6a'))['toString'](),'closedAt':_0x484939[_0xb91a('0x6b')]?moment(_0x484939[_0xb91a('0x6c')])[_0xb91a('0x5b')](_0xb91a('0x6a'))['toString']():'','disposition':_0x484939['disposition'],'messages':_(_0x484939[_0xb91a('0x61')])['filter']({'secret':![]})[_0xb91a('0x20')](function(_0x9ac739){if(_0x9ac739[_0xb91a('0x6d')]){var _0x2e2fab=path[_0xb91a('0x59')](_0x119622,_0x9ac739['Attachment'][_0xb91a('0x6e')]);if(fs['existsSync'](_0x2e2fab)){fs[_0xb91a('0x6f')](_0x2e2fab)[_0xb91a('0x70')](fs['createWriteStream'](path[_0xb91a('0x59')](_0x36ed91,_0x9ac739[_0xb91a('0x6d')][_0xb91a('0x6e')])));}}return{'date':moment(_0x9ac739[_0xb91a('0x62')])[_0xb91a('0x5b')](_0xb91a('0x6a'))[_0xb91a('0x54')](),'sender':_0x9ac739[_0xb91a('0x71')]==='out'?_0x9ac739[_0xb91a('0x65')]?_0x9ac739[_0xb91a('0x65')][_0xb91a('0x5d')]:_0xb91a('0x72'):_0x9ac739[_0xb91a('0x5f')][_0xb91a('0x73')]+(_0x9ac739[_0xb91a('0x5f')][_0xb91a('0x60')]?'\x20'+_0x9ac739[_0xb91a('0x5f')][_0xb91a('0x60')]:''),'body':_0x9ac739[_0xb91a('0x6d')]?_0x9ac739[_0xb91a('0x6d')][_0xb91a('0x6e')]:_0x9ac739[_0xb91a('0x36')],'direction':_0x9ac739[_0xb91a('0x71')]===_0xb91a('0x74')?'A':'C','secret':_0x9ac739[_0xb91a('0x63')],'read':_0x9ac739[_0xb91a('0x75')],'attachment':_0x9ac739[_0xb91a('0x6d')]};})['value']()};return ejs[_0xb91a('0x76')](path[_0xb91a('0x59')](config['root'],_0xb91a('0x56'),'views',_0xb91a('0x77')),{'interaction':_0x5ccc3d})[_0xb91a('0x18')](function(_0x1914fd){var _0x46df07=path['join'](_0x36ed91,_0xb91a('0x78')+_0x484939['id']+'-'+_0x1251ec+_0xb91a('0x79'));var _0x4d06a0={'path':_0x46df07,'channel':_0xb91a('0x69'),'interactionId':_0x484939['id']};return pdf[_0xb91a('0x7a')](_0x1914fd,_0x4d06a0);})[_0xb91a('0x18')](function(){return new BPromise(function(_0x1267c4,_0x4650ed){zipdir(_0x36ed91,{'saveTo':_0x157deb},function(_0x4a027c,_0x3f238a){if(_0x4a027c)return _0x4650ed(_0x4a027c);return _0x1267c4(_0x3f238a);});})[_0xb91a('0x18')](function(){return new BPromise(function(_0x23eaca,_0x16e431){rimraf(_0x36ed91,function(_0x153975){if(_0x153975)_0x16e431(_0x153975);return _0x23eaca();});});})[_0xb91a('0x18')](function(){return _0x150d0c[_0xb91a('0x52')](_0x157deb,_0x2c2af1,function(_0x42754f){if(_0x42754f){console[_0xb91a('0x7b')]('err',_0x42754f);}else{fs['unlinkSync'](_0x157deb);}});});});}else{return _0x150d0c[_0xb91a('0xf')](0xc8);}})[_0xb91a('0x2a')](handleError(_0x150d0c,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 60f122e..e7a2e97 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 _0xed8a=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','remove','getUsers'];(function(_0x5f1a3f,_0x15f4c7){var _0x3ff879=function(_0x508ac9){while(--_0x508ac9){_0x5f1a3f['push'](_0x5f1a3f['shift']());}};_0x3ff879(++_0x15f4c7);}(_0xed8a,0xc5));var _0xaed8=function(_0x473b44,_0x358c65){_0x473b44=_0x473b44-0x0;var _0x5b243c=_0xed8a[_0x473b44];return _0x5b243c;};'use strict';var EventEmitter=require(_0xaed8('0x0'));var WhatsappInteraction=require(_0xaed8('0x1'))['db'][_0xaed8('0x2')];var WhatsappMessage=require(_0xaed8('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xaed8('0x3')](0x0);var events={'afterCreate':_0xaed8('0x4'),'afterUpdate':'update','afterDestroy':_0xaed8('0x5')};function emitEvent(_0x2b330f){return function(_0x5759dd,_0x4f5082,_0x347ca1){_0x5759dd[_0xaed8('0x6')]({'attributes':['id'],'raw':!![]})[_0xaed8('0x7')](function(_0x2f6ab8){_0x5759dd[_0xaed8('0x8')](_0xaed8('0x9'),_0x2f6ab8[_0xaed8('0xa')](function(_0x5455ff){return{'id':_0x5455ff['id']};}));return WhatsappMessage[_0xaed8('0xb')]({'where':{'WhatsappInteractionId':_0x5759dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaed8('0x7')](function(_0x347f88){_0x5759dd['setDataValue'](_0xaed8('0xc'),_0x347f88[_0xaed8('0xd')]);WhatsappInteractionEvents[_0xaed8('0xe')](_0x2b330f+':'+_0x5759dd['id'],_0x5759dd);WhatsappInteractionEvents[_0xaed8('0xe')](_0x2b330f,_0x5759dd);_0x347ca1(null);})[_0xaed8('0xf')](_0x347ca1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xaed8('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x4dc0=['getUsers','then','map','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove'];(function(_0x3ae80e,_0xbbb162){var _0x410b30=function(_0xcedfb){while(--_0xcedfb){_0x3ae80e['push'](_0x3ae80e['shift']());}};_0x410b30(++_0xbbb162);}(_0x4dc0,0x13d));var _0x04dc=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x4dc0[_0x30ae5e];return _0x1f2e93;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0x04dc('0x0')];var WhatsappMessage=require(_0x04dc('0x1'))['db'][_0x04dc('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x04dc('0x3')](0x0);var events={'afterCreate':_0x04dc('0x4'),'afterUpdate':'update','afterDestroy':_0x04dc('0x5')};function emitEvent(_0x389f53){return function(_0x13a827,_0x5c0e3d,_0x224df5){_0x13a827[_0x04dc('0x6')]({'attributes':['id'],'raw':!![]})[_0x04dc('0x7')](function(_0x53cc43){_0x13a827['setDataValue']('Users',_0x53cc43[_0x04dc('0x8')](function(_0x8bc895){return{'id':_0x8bc895['id']};}));return WhatsappMessage[_0x04dc('0x9')]({'where':{'WhatsappInteractionId':_0x13a827['id'],'direction':'in','read':![]},'raw':!![]});})[_0x04dc('0x7')](function(_0x3cd9c7){_0x13a827[_0x04dc('0xa')](_0x04dc('0xb'),_0x3cd9c7[_0x04dc('0xc')]);WhatsappInteractionEvents['emit'](_0x389f53+':'+_0x13a827['id'],_0x13a827);WhatsappInteractionEvents[_0x04dc('0xd')](_0x389f53,_0x13a827);_0x224df5(null);})[_0x04dc('0xe')](_0x224df5(null));};}for(var e in events){if(events[_0x04dc('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x04dc('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 7826840..0fef026 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 _0x209e=['exports','WhatsappInteraction','whatsapp_interactions','closed','closedAt','util','../../config/logger','request-promise','path','../../config/environment','./whatsappInteraction.attributes'];(function(_0x35e0ad,_0x521127){var _0x18b62b=function(_0x261e95){while(--_0x261e95){_0x35e0ad['push'](_0x35e0ad['shift']());}};_0x18b62b(++_0x521127);}(_0x209e,0x89));var _0xe209=function(_0x250844,_0x20a3fe){_0x250844=_0x250844-0x0;var _0x4c2d25=_0x209e[_0x250844];return _0x4c2d25;};'use strict';var _=require('lodash');var util=require(_0xe209('0x0'));var logger=require(_0xe209('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe209('0x2'));var fs=require('fs');var path=require(_0xe209('0x3'));var rimraf=require('rimraf');var config=require(_0xe209('0x4'));var attributes=require(_0xe209('0x5'));module[_0xe209('0x6')]=function(_0x338805,_0x164e1b){return _0x338805['define'](_0xe209('0x7'),attributes,{'tableName':_0xe209('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9016f4,_0xbbdeca,_0x33b3e0){if(_0x9016f4['changed'](_0xe209('0x9'))){_0x9016f4[_0xe209('0xa')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x33b3e0(null,_0x9016f4);}}});}; \ No newline at end of file +var _0x885f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappInteraction','whatsapp_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger'];(function(_0x1e3023,_0x1a6b30){var _0x1706bb=function(_0x429260){while(--_0x429260){_0x1e3023['push'](_0x1e3023['shift']());}};_0x1706bb(++_0x1a6b30);}(_0x885f,0x1b1));var _0xf885=function(_0x117821,_0xaa1933){_0x117821=_0x117821-0x0;var _0x4ae9ff=_0x885f[_0x117821];return _0x4ae9ff;};'use strict';var _=require('lodash');var util=require(_0xf885('0x0'));var logger=require(_0xf885('0x1'))(_0xf885('0x2'));var moment=require(_0xf885('0x3'));var BPromise=require(_0xf885('0x4'));var rp=require(_0xf885('0x5'));var fs=require('fs');var path=require(_0xf885('0x6'));var rimraf=require(_0xf885('0x7'));var config=require(_0xf885('0x8'));var attributes=require('./whatsappInteraction.attributes');module[_0xf885('0x9')]=function(_0x434ac7,_0x16861b){return _0x434ac7['define'](_0xf885('0xa'),attributes,{'tableName':_0xf885('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49b117,_0x532732,_0x17f048){if(_0x49b117['changed'](_0xf885('0xc'))){_0x49b117['closedAt']=moment()[_0xf885('0xd')](_0xf885('0xe'));}_0x17f048(null,_0x49b117);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 9ab61d4..cfcf0bf 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 _0x83c1=['error','code','message','info','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','attributes','limit','stringify','AddTagsToWhatsappInteraction','find','where','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x23fd2c,_0x5d8ffe){var _0x2797a8=function(_0x29f36d){while(--_0x29f36d){_0x23fd2c['push'](_0x23fd2c['shift']());}};_0x2797a8(++_0x5d8ffe);}(_0x83c1,0xea));var _0x183c=function(_0x446567,_0x4a7931){_0x446567=_0x446567-0x0;var _0x6af6c0=_0x83c1[_0x446567];return _0x6af6c0;};'use strict';var _=require(_0x183c('0x0'));var util=require('util');var moment=require(_0x183c('0x1'));var BPromise=require(_0x183c('0x2'));var rs=require(_0x183c('0x3'));var fs=require('fs');var Redis=require(_0x183c('0x4'));var db=require(_0x183c('0x5'))['db'];var utils=require(_0x183c('0x6'));var logger=require(_0x183c('0x7'))(_0x183c('0x8'));var config=require(_0x183c('0x9'));var jayson=require(_0x183c('0xa'));var client=jayson[_0x183c('0xb')][_0x183c('0xc')]({'port':0x232a});config['redis']=_[_0x183c('0xd')](config[_0x183c('0xe')],{'host':_0x183c('0xf'),'port':0x18eb});var socket=require(_0x183c('0x10'))(new Redis(config['redis']));require(_0x183c('0x11'))[_0x183c('0x12')](socket);function respondWithRpcPromise(_0x39bcc6,_0x381738,_0x962bf5){return new BPromise(function(_0xcf2c3f,_0xb5af9c){return client[_0x183c('0x13')](_0x39bcc6,_0x962bf5)[_0x183c('0x14')](function(_0x271223){logger['info'](_0x183c('0x15'),_0x381738,_0x183c('0x16'));logger[_0x183c('0x17')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x381738,_0x183c('0x16'),JSON['stringify'](_0x271223));if(_0x271223[_0x183c('0x18')]){if(_0x271223[_0x183c('0x18')][_0x183c('0x19')]===0x1f4){logger[_0x183c('0x18')](_0x183c('0x15'),_0x381738,_0x271223[_0x183c('0x18')][_0x183c('0x1a')]);return _0xb5af9c(_0x271223[_0x183c('0x18')][_0x183c('0x1a')]);}logger[_0x183c('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x381738,_0x271223['error'][_0x183c('0x1a')]);return _0xcf2c3f(_0x271223[_0x183c('0x18')][_0x183c('0x1a')]);}else{logger[_0x183c('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x381738,_0x183c('0x16'));_0xcf2c3f(_0x271223['result'][_0x183c('0x1a')]);}})[_0x183c('0x1c')](function(_0x3ed4c1){logger['error'](_0x183c('0x15'),_0x381738,_0x3ed4c1);_0xb5af9c(_0x3ed4c1);});});}exports[_0x183c('0x1d')]=function(_0x25eb78){var _0x58039e=this;return new Promise(function(_0x38f3c9,_0x1f77c1){return db[_0x183c('0x1e')][_0x183c('0x1f')](_0x25eb78['body'],{'raw':_0x25eb78[_0x183c('0x20')]?_0x25eb78[_0x183c('0x20')][_0x183c('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25eb78[_0x183c('0x20')]?_0x25eb78[_0x183c('0x20')]['where']||null:null,'attributes':_0x25eb78['options']?_0x25eb78['options'][_0x183c('0x22')]||null:null,'limit':_0x25eb78[_0x183c('0x20')]?_0x25eb78[_0x183c('0x20')][_0x183c('0x23')]||null:null})[_0x183c('0x14')](function(_0x23e31f){logger[_0x183c('0x1b')](_0x183c('0x1d'),_0x25eb78);logger[_0x183c('0x17')](_0x183c('0x1d'),_0x25eb78,JSON[_0x183c('0x24')](_0x23e31f));_0x38f3c9(_0x23e31f);})[_0x183c('0x1c')](function(_0x3c98ff){logger[_0x183c('0x18')](_0x183c('0x1d'),_0x3c98ff[_0x183c('0x1a')],_0x25eb78);_0x1f77c1(_0x58039e[_0x183c('0x18')](0x1f4,_0x3c98ff[_0x183c('0x1a')]));});});};exports[_0x183c('0x25')]=function(_0x4c8aae){return new Promise(function(_0x1e32c2,_0x11e505){return db['WhatsappInteraction'][_0x183c('0x26')]({'where':_0x4c8aae[_0x183c('0x20')]?_0x4c8aae[_0x183c('0x20')][_0x183c('0x27')]||null:null})[_0x183c('0x14')](function(_0x22e215){if(_0x22e215){return _0x22e215['addTags'](_0x4c8aae['body'][_0x183c('0x28')],_[_0x183c('0x29')](_0x4c8aae['body'],[_0x183c('0x28'),'id'])||{});}})['spread'](function(_0x34957f){logger['info'](_0x183c('0x2a'),_0x4c8aae);logger[_0x183c('0x17')](_0x183c('0x2a'),_0x4c8aae,JSON[_0x183c('0x24')](_0x34957f));_0x1e32c2(_0x34957f);})['catch'](function(_0x76565d){logger[_0x183c('0x18')](_0x183c('0x2a'),_0x76565d[_0x183c('0x1a')],_0x4c8aae);_0x11e505(_this[_0x183c('0x18')](0x1f4,_0x76565d[_0x183c('0x1a')]));});});}; \ No newline at end of file +var _0x7154=['find','addTags','omit','ids','spread','AddTags','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateWhatsappInteraction','update','body','options','where','attributes','limit','info','debug','AddTagsToWhatsappInteraction','WhatsappInteraction'];(function(_0x5baf6b,_0x388e21){var _0x1dd8de=function(_0x4a929f){while(--_0x4a929f){_0x5baf6b['push'](_0x5baf6b['shift']());}};_0x1dd8de(++_0x388e21);}(_0x7154,0xa6));var _0x4715=function(_0x52f159,_0x419d8a){_0x52f159=_0x52f159-0x0;var _0x156799=_0x7154[_0x52f159];return _0x156799;};'use strict';var _=require('lodash');var util=require(_0x4715('0x0'));var moment=require('moment');var BPromise=require(_0x4715('0x1'));var rs=require(_0x4715('0x2'));var fs=require('fs');var Redis=require(_0x4715('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4715('0x4'));var logger=require('../../config/logger')(_0x4715('0x5'));var config=require(_0x4715('0x6'));var jayson=require(_0x4715('0x7'));var client=jayson['client'][_0x4715('0x8')]({'port':0x232a});config[_0x4715('0x9')]=_[_0x4715('0xa')](config[_0x4715('0x9')],{'host':_0x4715('0xb'),'port':0x18eb});var socket=require(_0x4715('0xc'))(new Redis(config[_0x4715('0x9')]));require(_0x4715('0xd'))[_0x4715('0xe')](socket);function respondWithRpcPromise(_0x523a7d,_0x29acec,_0x4680c9){return new BPromise(function(_0x21ba89,_0x12abca){return client['request'](_0x523a7d,_0x4680c9)['then'](function(_0x5dc0c8){logger['info'](_0x4715('0xf'),_0x29acec,_0x4715('0x10'));logger['debug'](_0x4715('0x11'),_0x29acec,_0x4715('0x10'),JSON[_0x4715('0x12')](_0x5dc0c8));if(_0x5dc0c8[_0x4715('0x13')]){if(_0x5dc0c8[_0x4715('0x13')]['code']===0x1f4){logger[_0x4715('0x13')](_0x4715('0xf'),_0x29acec,_0x5dc0c8[_0x4715('0x13')][_0x4715('0x14')]);return _0x12abca(_0x5dc0c8[_0x4715('0x13')][_0x4715('0x14')]);}logger[_0x4715('0x13')](_0x4715('0xf'),_0x29acec,_0x5dc0c8[_0x4715('0x13')][_0x4715('0x14')]);return _0x21ba89(_0x5dc0c8['error'][_0x4715('0x14')]);}else{logger['info'](_0x4715('0xf'),_0x29acec,_0x4715('0x10'));_0x21ba89(_0x5dc0c8[_0x4715('0x15')][_0x4715('0x14')]);}})[_0x4715('0x16')](function(_0x482e4e){logger[_0x4715('0x13')](_0x4715('0xf'),_0x29acec,_0x482e4e);_0x12abca(_0x482e4e);});});}exports[_0x4715('0x17')]=function(_0x1abdca){var _0x1504cb=this;return new Promise(function(_0x1fc7a3,_0x195605){return db['WhatsappInteraction'][_0x4715('0x18')](_0x1abdca[_0x4715('0x19')],{'raw':_0x1abdca[_0x4715('0x1a')]?_0x1abdca['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1abdca[_0x4715('0x1a')]?_0x1abdca[_0x4715('0x1a')][_0x4715('0x1b')]||null:null,'attributes':_0x1abdca['options']?_0x1abdca[_0x4715('0x1a')][_0x4715('0x1c')]||null:null,'limit':_0x1abdca[_0x4715('0x1a')]?_0x1abdca['options'][_0x4715('0x1d')]||null:null})['then'](function(_0x29beef){logger[_0x4715('0x1e')](_0x4715('0x17'),_0x1abdca);logger[_0x4715('0x1f')](_0x4715('0x17'),_0x1abdca,JSON[_0x4715('0x12')](_0x29beef));_0x1fc7a3(_0x29beef);})[_0x4715('0x16')](function(_0x5d33d6){logger['error'](_0x4715('0x17'),_0x5d33d6[_0x4715('0x14')],_0x1abdca);_0x195605(_0x1504cb[_0x4715('0x13')](0x1f4,_0x5d33d6[_0x4715('0x14')]));});});};exports[_0x4715('0x20')]=function(_0xe8b93d){return new Promise(function(_0x5704de,_0x122d31){return db[_0x4715('0x21')][_0x4715('0x22')]({'where':_0xe8b93d[_0x4715('0x1a')]?_0xe8b93d[_0x4715('0x1a')][_0x4715('0x1b')]||null:null})['then'](function(_0x5984f8){if(_0x5984f8){return _0x5984f8[_0x4715('0x23')](_0xe8b93d['body']['ids'],_[_0x4715('0x24')](_0xe8b93d[_0x4715('0x19')],[_0x4715('0x25'),'id'])||{});}})[_0x4715('0x26')](function(_0x3145e4){logger['info'](_0x4715('0x27'),_0xe8b93d);logger[_0x4715('0x1f')](_0x4715('0x27'),_0xe8b93d,JSON['stringify'](_0x3145e4));_0x5704de(_0x3145e4);})[_0x4715('0x16')](function(_0x54bbd2){logger['error'](_0x4715('0x27'),_0x54bbd2[_0x4715('0x14')],_0xe8b93d);_0x122d31(_this['error'](0x1f4,_0x54bbd2['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 352e5bc..aaa121f 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 _0x0c85=['save','remove','update','emit','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x1a22ef,_0x1ef6df){var _0x4a8226=function(_0x47508a){while(--_0x47508a){_0x1a22ef['push'](_0x1a22ef['shift']());}};_0x4a8226(++_0x1ef6df);}(_0x0c85,0x7f));var _0x50c8=function(_0x5ccda9,_0x4386de){_0x5ccda9=_0x5ccda9-0x0;var _0x14723d=_0x0c85[_0x5ccda9];return _0x14723d;};'use strict';var WhatsappInteractionEvents=require(_0x50c8('0x0'));var events=[_0x50c8('0x1'),_0x50c8('0x2'),_0x50c8('0x3')];function createListener(_0x5c2afb,_0x167b52){return function(_0x46b505){_0x167b52[_0x50c8('0x4')](_0x5c2afb,_0x46b505);};}function removeListener(_0x16a5c9,_0x4ec4f4){return function(){WhatsappInteractionEvents['removeListener'](_0x16a5c9,_0x4ec4f4);};}exports[_0x50c8('0x5')]=function(_0x18c426){for(var _0x56f271=0x0,_0x44ae99=events[_0x50c8('0x6')];_0x56f271<_0x44ae99;_0x56f271++){var _0x30a8c9=events[_0x56f271];var _0x3d4361=createListener(_0x50c8('0x7')+_0x30a8c9,_0x18c426);WhatsappInteractionEvents['on'](_0x30a8c9,_0x3d4361);}}; \ No newline at end of file +var _0x98a9=['./whatsappInteraction.events','save','remove','update','removeListener','length','whatsappInteraction:'];(function(_0x3e48c8,_0x3a92ec){var _0x1947b7=function(_0x4e9f88){while(--_0x4e9f88){_0x3e48c8['push'](_0x3e48c8['shift']());}};_0x1947b7(++_0x3a92ec);}(_0x98a9,0x8c));var _0x998a=function(_0x472266,_0x13b9aa){_0x472266=_0x472266-0x0;var _0x5ed7ef=_0x98a9[_0x472266];return _0x5ed7ef;};'use strict';var WhatsappInteractionEvents=require(_0x998a('0x0'));var events=[_0x998a('0x1'),_0x998a('0x2'),_0x998a('0x3')];function createListener(_0x47fe98,_0x15a4e3){return function(_0x4055de){_0x15a4e3['emit'](_0x47fe98,_0x4055de);};}function removeListener(_0xc7e06b,_0x5ecc0b){return function(){WhatsappInteractionEvents[_0x998a('0x4')](_0xc7e06b,_0x5ecc0b);};}exports['register']=function(_0xc0323d){for(var _0x52f5a8=0x0,_0x4c4f3e=events[_0x998a('0x5')];_0x52f5a8<_0x4c4f3e;_0x52f5a8++){var _0x242deb=events[_0x52f5a8];var _0x4e939f=createListener(_0x998a('0x6')+_0x242deb,_0xc0323d);WhatsappInteractionEvents['on'](_0x242deb,_0x4e939f);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index ec907c7..762ed7b 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 _0xe1dd=['accept','/:id/reject','reject','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','index','isAuthenticated','describe','/:id','show','whatsappmessage:create','create','post','/:id/status','status','put'];(function(_0x5b771d,_0x2d3cb7){var _0x40ccff=function(_0xed7cf3){while(--_0xed7cf3){_0x5b771d['push'](_0x5b771d['shift']());}};_0x40ccff(++_0x2d3cb7);}(_0xe1dd,0xb3));var _0xde1d=function(_0x3e8264,_0x33d8ff){_0x3e8264=_0x3e8264-0x0;var _0x1ed50d=_0xe1dd[_0x3e8264];return _0x1ed50d;};'use strict';var multer=require(_0xde1d('0x0'));var util=require(_0xde1d('0x1'));var path=require(_0xde1d('0x2'));var timeout=require(_0xde1d('0x3'));var express=require('express');var router=express[_0xde1d('0x4')]();var fs_extra=require(_0xde1d('0x5'));var auth=require(_0xde1d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xde1d('0x7'));var controller=require(_0xde1d('0x8'));router[_0xde1d('0x9')]('/',auth['isAuthenticated'](),controller[_0xde1d('0xa')]);router['get']('/describe',auth[_0xde1d('0xb')](),controller[_0xde1d('0xc')]);router[_0xde1d('0x9')](_0xde1d('0xd'),auth[_0xde1d('0xb')](),controller[_0xde1d('0xe')]);router['post']('/',auth[_0xde1d('0xb')](),interaction['tracked']('whatsapp',_0xde1d('0xf')),controller[_0xde1d('0x10')]);router[_0xde1d('0x11')](_0xde1d('0x12'),controller[_0xde1d('0x13')]);router[_0xde1d('0x14')](_0xde1d('0xd'),auth[_0xde1d('0xb')](),controller['update']);router[_0xde1d('0x14')]('/:id/accept',auth[_0xde1d('0xb')](),controller[_0xde1d('0x15')]);router[_0xde1d('0x14')](_0xde1d('0x16'),auth[_0xde1d('0xb')](),controller[_0xde1d('0x17')]);router['delete'](_0xde1d('0xd'),auth[_0xde1d('0xb')](),controller[_0xde1d('0x18')]);module['exports']=router; \ No newline at end of file +var _0xc857=['get','index','/describe','isAuthenticated','/:id','post','whatsapp','create','/:id/status','put','/:id/reject','reject','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','./whatsappMessage.controller'];(function(_0x279b67,_0x5f1b9f){var _0x3b7ccd=function(_0x3744ff){while(--_0x3744ff){_0x279b67['push'](_0x279b67['shift']());}};_0x3b7ccd(++_0x5f1b9f);}(_0xc857,0x185));var _0x7c85=function(_0x20073d,_0x5c1c3c){_0x20073d=_0x20073d-0x0;var _0x4ada37=_0xc857[_0x20073d];return _0x4ada37;};'use strict';var multer=require('multer');var util=require(_0x7c85('0x0'));var path=require(_0x7c85('0x1'));var timeout=require('connect-timeout');var express=require(_0x7c85('0x2'));var router=express[_0x7c85('0x3')]();var fs_extra=require(_0x7c85('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7c85('0x5'));var config=require('../../config/environment');var controller=require(_0x7c85('0x6'));router[_0x7c85('0x7')]('/',auth['isAuthenticated'](),controller[_0x7c85('0x8')]);router[_0x7c85('0x7')](_0x7c85('0x9'),auth[_0x7c85('0xa')](),controller['describe']);router[_0x7c85('0x7')](_0x7c85('0xb'),auth[_0x7c85('0xa')](),controller['show']);router[_0x7c85('0xc')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x7c85('0xd'),'whatsappmessage:create'),controller[_0x7c85('0xe')]);router[_0x7c85('0xc')](_0x7c85('0xf'),controller['status']);router[_0x7c85('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['put']('/:id/accept',auth[_0x7c85('0xa')](),controller['accept']);router[_0x7c85('0x10')](_0x7c85('0x11'),auth[_0x7c85('0xa')](),controller[_0x7c85('0x12')]);router[_0x7c85('0x13')]('/:id',auth[_0x7c85('0xa')](),controller[_0x7c85('0x14')]);module[_0x7c85('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index ae08d17..8893bd3 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x448a=['out','STRING','DATE','exports','TEXT','BOOLEAN'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x448a,0x1ef));var _0xa448=function(_0x50f8d0,_0x3edfc0){_0x50f8d0=_0x50f8d0-0x0;var _0x1eed82=_0x448a[_0x50f8d0];return _0x1eed82;};'use strict';var Sequelize=require('sequelize');module[_0xa448('0x0')]={'body':{'type':Sequelize[_0xa448('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa448('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa448('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa448('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xa448('0x5')]},'secret':{'type':Sequelize[_0xa448('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xa448('0x4')]},'providerResponse':{'type':Sequelize[_0xa448('0x1')]}}; \ No newline at end of file +var _0xe526=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe526,0x18c));var _0x6e52=function(_0x58b67f,_0x49272a){_0x58b67f=_0x58b67f-0x0;var _0x5f3f0e=_0xe526[_0x58b67f];return _0x5f3f0e;};'use strict';var Sequelize=require(_0x6e52('0x0'));module[_0x6e52('0x1')]={'body':{'type':Sequelize[_0x6e52('0x2')](_0x6e52('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6e52('0x5')]('in',_0x6e52('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x6e52('0x7')]},'readAt':{'type':Sequelize[_0x6e52('0x8')]},'secret':{'type':Sequelize[_0x6e52('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6e52('0x7')]},'providerResponse':{'type':Sequelize[_0x6e52('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 9a0d3eb..00c6d73 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 _0x757e=['lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','map','WhatsappMessage','rawAttributes','key','keys','query','intersection','model','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show','params','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','find','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','RejectMessage','rejectMessage','contact','fullname','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','to-csv','ejs','fs-extra'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x757e,0x187));var _0xe757=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x757e[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xe757('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe757('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe757('0x2'));var moment=require(_0xe757('0x3'));var BPromise=require(_0xe757('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe757('0x5'));var ejs=require(_0xe757('0x6'));var fs=require('fs');var fs_extra=require(_0xe757('0x7'));var _=require(_0xe757('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe757('0x9'));var toCsv=require(_0xe757('0x5'));var querystring=require(_0xe757('0xa'));var Papa=require(_0xe757('0xb'));var Redis=require(_0xe757('0xc'));var authService=require(_0xe757('0xd'));var qs=require(_0xe757('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe757('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe757('0x10'));var licenseUtil=require(_0xe757('0x11'));var db=require('../../mysqldb')['db'];config[_0xe757('0x12')]=_[_0xe757('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe757('0x14'))(new Redis(config[_0xe757('0x12')]));require(_0xe757('0x15'))[_0xe757('0x16')](socket);var jayson=require(_0xe757('0x17'));var client=jayson['client'][_0xe757('0x18')]({'port':0x232c});var client9002=jayson[_0xe757('0x19')][_0xe757('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x2943be,_0x15e7d4,_0x364503,_0x2e5f11){return new BPromise(function(_0x180d84,_0x4fe776){var _0xdd7dfd=_0x2e5f11||client;return _0xdd7dfd['request'](_0x2943be,_0x364503)[_0xe757('0x1a')](function(_0xbf521f){logger[_0xe757('0x1b')](_0xe757('0x1c'),_0x15e7d4,_0xe757('0x1d'));logger[_0xe757('0x1e')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x15e7d4,_0xe757('0x1d'),JSON[_0xe757('0x1f')](_0xbf521f));if(_0xbf521f[_0xe757('0x20')]){if(_0xbf521f['error']['code']===0x1f4){logger[_0xe757('0x20')](_0xe757('0x1c'),_0x15e7d4,_0xbf521f[_0xe757('0x20')][_0xe757('0x21')]);return _0x4fe776(_0xbf521f[_0xe757('0x20')][_0xe757('0x21')]);}logger[_0xe757('0x20')](_0xe757('0x1c'),_0x15e7d4,_0xbf521f[_0xe757('0x20')][_0xe757('0x21')]);return _0x180d84(_0xbf521f[_0xe757('0x20')][_0xe757('0x21')]);}else{logger['info'](_0xe757('0x1c'),_0x15e7d4,'request\x20sent');_0x180d84(_0xbf521f[_0xe757('0x22')][_0xe757('0x21')]);}})[_0xe757('0x23')](function(_0x35373e){logger[_0xe757('0x20')](_0xe757('0x1c'),_0x15e7d4,_0x35373e);_0x4fe776(_0x35373e);});});}function respondWithStatusCode(_0x495c90,_0x59612e){_0x59612e=_0x59612e||0xcc;return function(_0x4f3206){if(_0x4f3206){return _0x495c90['sendStatus'](_0x59612e);}return _0x495c90[_0xe757('0x24')](_0x59612e)['end']();};}function respondWithResult(_0x3f20cf,_0xa6953e){_0xa6953e=_0xa6953e||0xc8;return function(_0x3f0680){if(_0x3f0680){return _0x3f20cf[_0xe757('0x24')](_0xa6953e)[_0xe757('0x25')](_0x3f0680);}};}function respondWithFilteredResult(_0x1e4778,_0x3c977b){return function(_0x188be2){if(_0x188be2){var _0x532086=typeof _0x3c977b['offset']===_0xe757('0x26')&&typeof _0x3c977b['limit']===_0xe757('0x26');var _0x2a11e9=_0x188be2[_0xe757('0x27')];var _0x3040b0=_0x532086?0x0:_0x3c977b[_0xe757('0x28')];var _0x248c82=_0x532086?_0x188be2[_0xe757('0x27')]:_0x3c977b[_0xe757('0x28')]+_0x3c977b[_0xe757('0x29')];var _0x3fafca;if(_0x248c82>=_0x2a11e9){_0x248c82=_0x2a11e9;_0x3fafca=0xc8;}else{_0x3fafca=0xce;}_0x1e4778[_0xe757('0x24')](_0x3fafca);return _0x1e4778[_0xe757('0x2a')]('Content-Range',_0x3040b0+'-'+_0x248c82+'/'+_0x2a11e9)[_0xe757('0x25')](_0x188be2);}return null;};}function patchUpdates(_0xbf4ba9){return function(_0x206a59){try{jsonpatch[_0xe757('0x2b')](_0x206a59,_0xbf4ba9,!![]);}catch(_0x6fe0f5){return BPromise[_0xe757('0x2c')](_0x6fe0f5);}return _0x206a59[_0xe757('0x2d')]();};}function saveUpdates(_0x314b46,_0x4f73df){return function(_0x4dcde0){if(_0x4dcde0){return _0x4dcde0[_0xe757('0x2e')](_0x314b46)['then'](function(_0x53fb61){return _0x53fb61;});}return null;};}function removeEntity(_0x27b445,_0x3242ec){return function(_0x1f22ba){if(_0x1f22ba){return _0x1f22ba[_0xe757('0x2f')]()[_0xe757('0x1a')](function(){_0x27b445[_0xe757('0x24')](0xcc)[_0xe757('0x30')]();});}};}function handleEntityNotFound(_0x11d7df,_0x5930b2){return function(_0x45aefd){if(!_0x45aefd){_0x11d7df[_0xe757('0x31')](0x194);}return _0x45aefd;};}function handleError(_0x2224c6,_0x4067b4){_0x4067b4=_0x4067b4||0x1f4;return function(_0x119122){logger[_0xe757('0x20')](_0x119122[_0xe757('0x32')]);if(_0x119122[_0xe757('0x33')]){delete _0x119122['name'];}_0x2224c6[_0xe757('0x24')](_0x4067b4)[_0xe757('0x34')](_0x119122);};}exports['index']=function(_0x513e33,_0x51765b){var _0x4dabd9={},_0x536b5e={},_0x15df9f={'count':0x0,'rows':[]};var _0x3446b8=_[_0xe757('0x35')](db[_0xe757('0x36')][_0xe757('0x37')],function(_0x5685c9){return{'name':_0x5685c9['fieldName'],'type':_0x5685c9['type'][_0xe757('0x38')]};});_0x536b5e['model']=_[_0xe757('0x35')](_0x3446b8,_0xe757('0x33'));_0x536b5e['query']=_[_0xe757('0x39')](_0x513e33[_0xe757('0x3a')]);_0x536b5e['filters']=_[_0xe757('0x3b')](_0x536b5e[_0xe757('0x3c')],_0x536b5e['query']);_0x4dabd9[_0xe757('0x3d')]=_[_0xe757('0x3b')](_0x536b5e[_0xe757('0x3c')],qs[_0xe757('0x3e')](_0x513e33[_0xe757('0x3a')][_0xe757('0x3e')]));_0x4dabd9['attributes']=_0x4dabd9[_0xe757('0x3d')]['length']?_0x4dabd9[_0xe757('0x3d')]:_0x536b5e['model'];if(!_0x513e33[_0xe757('0x3a')]['hasOwnProperty'](_0xe757('0x3f'))){_0x4dabd9['limit']=qs[_0xe757('0x29')](_0x513e33[_0xe757('0x3a')]['limit']);_0x4dabd9[_0xe757('0x28')]=qs[_0xe757('0x28')](_0x513e33[_0xe757('0x3a')][_0xe757('0x28')]);}_0x4dabd9['order']=qs[_0xe757('0x40')](_0x513e33[_0xe757('0x3a')][_0xe757('0x40')]);_0x4dabd9[_0xe757('0x41')]=qs[_0xe757('0x42')](_[_0xe757('0x43')](_0x513e33[_0xe757('0x3a')],_0x536b5e[_0xe757('0x42')]),_0x3446b8);if(_0x513e33[_0xe757('0x3a')][_0xe757('0x44')]){_0x4dabd9[_0xe757('0x41')]=_[_0xe757('0x45')](_0x4dabd9[_0xe757('0x41')],{'$or':_[_0xe757('0x35')](_0x3446b8,function(_0x37e9ba){if(_0x37e9ba[_0xe757('0x46')]!==_0xe757('0x47')){var _0x4e80b4={};_0x4e80b4[_0x37e9ba[_0xe757('0x33')]]={'$like':'%'+_0x513e33[_0xe757('0x3a')]['filter']+'%'};return _0x4e80b4;}})});}_0x4dabd9=_[_0xe757('0x45')]({},_0x4dabd9,_0x513e33[_0xe757('0x48')]);var _0x1d2708={'where':_0x4dabd9[_0xe757('0x41')]};return db[_0xe757('0x36')][_0xe757('0x27')](_0x1d2708)[_0xe757('0x1a')](function(_0x511800){_0x15df9f['count']=_0x511800;if(_0x513e33[_0xe757('0x3a')][_0xe757('0x49')]){_0x4dabd9[_0xe757('0x4a')]=[{'all':!![]}];}return db[_0xe757('0x36')][_0xe757('0x4b')](_0x4dabd9);})['then'](function(_0x3dfb6e){_0x15df9f['rows']=_0x3dfb6e;return _0x15df9f;})[_0xe757('0x1a')](respondWithFilteredResult(_0x51765b,_0x4dabd9))[_0xe757('0x23')](handleError(_0x51765b,null));};exports[_0xe757('0x4c')]=function(_0x204ad8,_0x21d42a){var _0x3ca444={'raw':!![],'where':{'id':_0x204ad8[_0xe757('0x4d')]['id']}},_0x5a58ba={};_0x5a58ba[_0xe757('0x3c')]=_['keys'](db[_0xe757('0x36')][_0xe757('0x37')]);_0x5a58ba[_0xe757('0x3a')]=_[_0xe757('0x39')](_0x204ad8['query']);_0x5a58ba[_0xe757('0x42')]=_['intersection'](_0x5a58ba[_0xe757('0x3c')],_0x5a58ba[_0xe757('0x3a')]);_0x3ca444['attributes']=_['intersection'](_0x5a58ba[_0xe757('0x3c')],qs[_0xe757('0x3e')](_0x204ad8[_0xe757('0x3a')]['fields']));_0x3ca444['attributes']=_0x3ca444[_0xe757('0x3d')]['length']?_0x3ca444[_0xe757('0x3d')]:_0x5a58ba[_0xe757('0x3c')];if(_0x204ad8['query'][_0xe757('0x49')]){_0x3ca444[_0xe757('0x4a')]=[{'all':!![]}];}_0x3ca444=_[_0xe757('0x45')]({},_0x3ca444,_0x204ad8['options']);return db[_0xe757('0x36')]['find'](_0x3ca444)['then'](handleEntityNotFound(_0x21d42a,null))[_0xe757('0x1a')](respondWithResult(_0x21d42a,null))[_0xe757('0x23')](handleError(_0x21d42a,null));};exports[_0xe757('0x4e')]=function(_0x209237,_0x1a41ae){return db[_0xe757('0x36')][_0xe757('0x4e')](_0x209237[_0xe757('0x4f')],{})[_0xe757('0x1a')](respondWithResult(_0x1a41ae,0xc9))[_0xe757('0x23')](handleError(_0x1a41ae,null));};exports[_0xe757('0x2e')]=function(_0x4155f2,_0x349435){if(_0x4155f2[_0xe757('0x4f')]['id']){delete _0x4155f2[_0xe757('0x4f')]['id'];}return db[_0xe757('0x36')]['find']({'where':{'id':_0x4155f2[_0xe757('0x4d')]['id']}})['then'](handleEntityNotFound(_0x349435,null))[_0xe757('0x1a')](saveUpdates(_0x4155f2[_0xe757('0x4f')],null))[_0xe757('0x1a')](respondWithResult(_0x349435,null))['catch'](handleError(_0x349435,null));};exports[_0xe757('0x2f')]=function(_0x585f78,_0x3bba46){return db[_0xe757('0x36')]['find']({'where':{'id':_0x585f78[_0xe757('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3bba46,null))[_0xe757('0x1a')](removeEntity(_0x3bba46,null))[_0xe757('0x23')](handleError(_0x3bba46,null));};exports[_0xe757('0x50')]=function(_0x427bad,_0x477485){return db['WhatsappMessage'][_0xe757('0x50')]()[_0xe757('0x1a')](respondWithResult(_0x477485,null))['catch'](handleError(_0x477485,null));};var interaction_log=require(_0xe757('0x51'))(_0xe757('0x52'));exports[_0xe757('0x53')]=function(_0x397361,_0x2bb451,_0x4419a0){var _0x33a3c3={'agent':{},'channel':_0xe757('0x54')};if(_0x397361[_0xe757('0x4f')]['id']){delete _0x397361[_0xe757('0x4f')]['id'];}_0x397361[_0xe757('0x4f')][_0xe757('0x55')]=!![];_0x397361[_0xe757('0x4f')][_0xe757('0x56')]=moment()[_0xe757('0x57')](_0xe757('0x58'));_0x397361[_0xe757('0x4f')][_0xe757('0x59')]=_0x397361[_0xe757('0x4f')][_0xe757('0x59')]||_0x397361[_0xe757('0x5a')]['id'];_0x33a3c3[_0xe757('0x5b')]['id']=_0x397361[_0xe757('0x4f')][_0xe757('0x59')];return db[_0xe757('0x36')][_0xe757('0x5c')]({'where':{'id':_0x397361[_0xe757('0x4d')]['id'],'UserId':null}})[_0xe757('0x1a')](handleEntityNotFound(_0x2bb451,null))[_0xe757('0x1a')](saveUpdates(_0x397361[_0xe757('0x4f')],null))[_0xe757('0x1a')](function(_0x26ceaf){if(_0x26ceaf){_0x33a3c3[_0xe757('0x21')]=_0x26ceaf[_0xe757('0x5d')]({'plain':!![]});return db[_0xe757('0x5e')][_0xe757('0x5c')]({'where':{'id':_0x26ceaf[_0xe757('0x5f')]}});}return null;})[_0xe757('0x1a')](handleEntityNotFound(_0x2bb451,null))[_0xe757('0x1a')](function(_0x1aea27){if(_0x1aea27){return _0x1aea27[_0xe757('0x2e')]({'UserId':_0x397361[_0xe757('0x4f')]['UserId'],'read1stAt':_[_0xe757('0x60')](_0x1aea27[_0xe757('0x61')])?moment()[_0xe757('0x57')](_0xe757('0x58')):undefined});}return null;})[_0xe757('0x1a')](function(_0x49ab9f){if(_0x49ab9f){_0x33a3c3['interaction']=_0x49ab9f[_0xe757('0x5d')]({'plain':!![]});interaction_log[_0xe757('0x1b')](_0xe757('0x62'),_0x397361[_0xe757('0x5a')]['id'],_0x397361[_0xe757('0x5a')][_0xe757('0x33')],_0x397361[_0xe757('0x5a')][_0xe757('0x63')],_0x33a3c3['interaction']['id'],_0x397361[_0xe757('0x4f')]?JSON['stringify'](_0x397361[_0xe757('0x4f')]):'null');return respondWithRpcPromise(_0xe757('0x64'),_0xe757('0x65'),_0x33a3c3);}return null;})[_0xe757('0x1a')](function(_0x4dc474){var _0x3b51d9=_0xe757('0x66')+_0x4dc474[_0xe757('0x21')][_0xe757('0x67')];return db[_0xe757('0x68')][_0xe757('0x3a')](_0x3b51d9,{'type':db[_0xe757('0x69')][_0xe757('0x6a')][_0xe757('0x6b')],'raw':!![]})[_0xe757('0x1a')](function(_0x294f07){return _0x294f07;});})['then'](function(_0x20768f){if(_0x20768f){_0x33a3c3[_0xe757('0x21')]['contact']=_0x20768f[0x0];if(!_0x397361[_0xe757('0x4f')][_0xe757('0x59')])return;return db[_0xe757('0x6c')][_0xe757('0x5c')]({'where':{'id':_0x397361[_0xe757('0x4f')][_0xe757('0x59')],'role':'agent'},'attributes':['id','name','fullname',_0xe757('0x6d'),'internal'],'raw':!![]});}return null;})['then'](function(_0x123555){if(!_0x123555)return null;_0x33a3c3['message']['agent']=_0x123555;return _0x33a3c3;})[_0xe757('0x1a')](function(_0x405bcb){if(_0x405bcb){if(_0x397361[_0xe757('0x4f')][_0xe757('0x6e')]){_0x33a3c3[_0xe757('0x21')][_0xe757('0x6f')]=util['format'](_0xe757('0x70'),_0x397361[_0xe757('0x5a')]['name']);_0x33a3c3['message'][_0xe757('0x71')]=_0x33a3c3[_0xe757('0x71')];_0x33a3c3[_0xe757('0x21')][_0xe757('0x72')]=_0x33a3c3[_0xe757('0x71')];_0x33a3c3[_0xe757('0x21')][_0xe757('0x73')]='accept';return respondWithRpcPromise(_0xe757('0x74'),'EventManager',{'event':'acceptmessage','message':_0x33a3c3['message']},client9002)[_0xe757('0x1a')](function(){return _0x33a3c3;});}return _0x33a3c3;}return null;})['then'](respondWithResult(_0x2bb451,null))[_0xe757('0x23')](handleError(_0x2bb451,null));};var interaction_log=require(_0xe757('0x51'))('whatsapp-interactions');exports[_0xe757('0x2c')]=function(_0x5eb492,_0x43d6b7,_0x356057){var _0x4bca50={'agent':{},'channel':_0xe757('0x54')};if(_0x5eb492['body']['id']){delete _0x5eb492[_0xe757('0x4f')]['id'];}_0x5eb492[_0xe757('0x4f')][_0xe757('0x59')]=_0x5eb492[_0xe757('0x4f')]['UserId']||_0x5eb492['user']['id'];_0x4bca50[_0xe757('0x5b')]['id']=_0x5eb492[_0xe757('0x4f')][_0xe757('0x59')];return db[_0xe757('0x36')][_0xe757('0x5c')]({'where':{'id':_0x5eb492['params']['id'],'UserId':null}})[_0xe757('0x1a')](handleEntityNotFound(_0x43d6b7,null))[_0xe757('0x1a')](function(_0x4b7153){if(_0x4b7153){_0x4bca50[_0xe757('0x21')]=_0x4b7153[_0xe757('0x5d')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x4b7153[_0xe757('0x5f')]}});}return null;})[_0xe757('0x1a')](handleEntityNotFound(_0x43d6b7,null))[_0xe757('0x1a')](function(_0x2e727c){if(_0x2e727c){_0x4bca50['interaction']=_0x2e727c[_0xe757('0x5d')]({'plain':!![]});interaction_log[_0xe757('0x1b')](_0xe757('0x75'),_0x5eb492[_0xe757('0x5a')]['id'],_0x5eb492[_0xe757('0x5a')][_0xe757('0x33')],_0x5eb492[_0xe757('0x5a')]['role'],_0x4bca50[_0xe757('0x76')]['id'],_0x5eb492['body']?JSON[_0xe757('0x1f')](_0x5eb492['body']):_0xe757('0x77'));return respondWithRpcPromise(_0xe757('0x78'),_0xe757('0x79'),_0x4bca50);}return null;})['then'](function(_0x37a8e3){var _0x2cba88=_0xe757('0x66')+_0x37a8e3[_0xe757('0x21')][_0xe757('0x67')];return db[_0xe757('0x68')]['query'](_0x2cba88,{'type':db['Sequelize'][_0xe757('0x6a')][_0xe757('0x6b')],'raw':!![]})[_0xe757('0x1a')](function(_0x438e9d){return _0x438e9d;});})['then'](function(_0x5c7df6){if(_0x5c7df6){_0x4bca50[_0xe757('0x21')][_0xe757('0x7a')]=_0x5c7df6[0x0];if(!_0x5eb492[_0xe757('0x4f')][_0xe757('0x59')])return;return db[_0xe757('0x6c')]['find']({'where':{'id':_0x5eb492['body']['UserId'],'role':'agent'},'attributes':['id',_0xe757('0x33'),_0xe757('0x7b'),_0xe757('0x6d'),_0xe757('0x7c')],'raw':!![]});}return null;})[_0xe757('0x1a')](function(_0x31014){if(!_0x31014)return null;_0x4bca50[_0xe757('0x21')]['agent']=_0x31014;return _0x4bca50;})[_0xe757('0x1a')](function(_0x9591){if(_0x9591){_0x9591['message'][_0xe757('0x6f')]=util['format'](_0xe757('0x70'),_0x5eb492[_0xe757('0x5a')]['name']);_0x9591[_0xe757('0x21')][_0xe757('0x71')]=_0x4bca50[_0xe757('0x71')];_0x9591[_0xe757('0x21')][_0xe757('0x72')]=_0x4bca50['channel'];_0x9591[_0xe757('0x21')][_0xe757('0x73')]=_0xe757('0x2c');respondWithRpcPromise(_0xe757('0x74'),_0xe757('0x74'),{'event':_0xe757('0x7d'),'message':_0x9591[_0xe757('0x21')]},client9002);return _0x4bca50;}return null;})[_0xe757('0x1a')](respondWithResult(_0x43d6b7,null))[_0xe757('0x23')](handleError(_0x43d6b7,null));};exports[_0xe757('0x24')]=function(_0x28e9c0,_0x5d9426,_0x186da9){if(_0x28e9c0[_0xe757('0x4f')]['id']){delete _0x28e9c0[_0xe757('0x4f')]['id'];}var _0x206a00;return db['WhatsappMessage'][_0xe757('0x5c')]({'where':{'id':_0x28e9c0[_0xe757('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5d9426,null))[_0xe757('0x1a')](function(_0x2f2869){if(_0x2f2869){_0x206a00=_0x2f2869;return db[_0xe757('0x7e')][_0xe757('0x5c')]({'where':{'id':_0x2f2869[_0xe757('0x7f')]}});}})[_0xe757('0x1a')](handleEntityNotFound(_0x5d9426,null))[_0xe757('0x1a')](function(_0x262d25){if(_0x262d25){logger[_0xe757('0x1e')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xe757('0x24'),_0xe757('0x80'),_0x262d25[_0xe757('0x46')],util['inspect'](_0x28e9c0['body'],{'showHidden':![],'depth':null}));switch(_0x262d25[_0xe757('0x46')]){case'twilio':if(_0x28e9c0[_0xe757('0x4f')][_0xe757('0x81')]&&_0x28e9c0[_0xe757('0x4f')][_0xe757('0x81')]===_0x206a00[_0xe757('0x82')]&&_0x28e9c0[_0xe757('0x4f')][_0xe757('0x83')]&&_0x28e9c0[_0xe757('0x4f')]['MessageStatus']===_0xe757('0x55')){return _0x206a00[_0xe757('0x2e')]({'read':!![]});}else{logger['error'](_0xe757('0x84'),_0xe757('0x24'),'twilio',util['inspect'](_0x28e9c0[_0xe757('0x4f')],{'showHidden':![],'depth':null}));}break;}return _0x206a00;}})[_0xe757('0x1a')](respondWithResult(_0x5d9426,null))['catch'](handleError(_0x5d9426,null));}; \ No newline at end of file +var _0xedf6=['ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp','RejectMessage','sequelize','User','internal','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','WhatsappMessage','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','find','catch','create','body','describe','whatsapp-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'];(function(_0x1107b5,_0x30f5bc){var _0x3e7b30=function(_0x576298){while(--_0x576298){_0x1107b5['push'](_0x1107b5['shift']());}};_0x3e7b30(++_0x30f5bc);}(_0xedf6,0x1cf));var _0x6edf=function(_0xf4d811,_0x11d532){_0xf4d811=_0xf4d811-0x0;var _0x1677f9=_0xedf6[_0xf4d811];return _0x1677f9;};'use strict';var emlformat=require(_0x6edf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6edf('0x1'));var jsonpatch=require(_0x6edf('0x2'));var rp=require(_0x6edf('0x3'));var moment=require(_0x6edf('0x4'));var BPromise=require(_0x6edf('0x5'));var Mustache=require(_0x6edf('0x6'));var util=require(_0x6edf('0x7'));var path=require(_0x6edf('0x8'));var sox=require(_0x6edf('0x9'));var csv=require(_0x6edf('0xa'));var ejs=require(_0x6edf('0xb'));var fs=require('fs');var fs_extra=require(_0x6edf('0xc'));var _=require(_0x6edf('0xd'));var squel=require(_0x6edf('0xe'));var crypto=require('crypto');var jsforce=require(_0x6edf('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6edf('0xa'));var querystring=require(_0x6edf('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6edf('0x11'));var qs=require(_0x6edf('0x12'));var as=require(_0x6edf('0x13'));var hardwareService=require(_0x6edf('0x14'));var logger=require(_0x6edf('0x15'))(_0x6edf('0x16'));var utils=require('../../config/utils');var config=require(_0x6edf('0x17'));var licenseUtil=require(_0x6edf('0x18'));var db=require(_0x6edf('0x19'))['db'];config[_0x6edf('0x1a')]=_[_0x6edf('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6edf('0x1c'))(new Redis(config[_0x6edf('0x1a')]));require(_0x6edf('0x1d'))[_0x6edf('0x1e')](socket);var jayson=require(_0x6edf('0x1f'));var client=jayson[_0x6edf('0x20')][_0x6edf('0x21')]({'port':0x232c});var client9002=jayson[_0x6edf('0x20')][_0x6edf('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4b8cd3,_0x3ba402,_0x399ee0,_0x15d2e6){return new BPromise(function(_0x3fff94,_0x23e5ac){var _0x1957cc=_0x15d2e6||client;return _0x1957cc[_0x6edf('0x22')](_0x4b8cd3,_0x399ee0)[_0x6edf('0x23')](function(_0x553d1d){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x3ba402,_0x6edf('0x24'));logger[_0x6edf('0x25')](_0x6edf('0x26'),_0x3ba402,_0x6edf('0x24'),JSON[_0x6edf('0x27')](_0x553d1d));if(_0x553d1d[_0x6edf('0x28')]){if(_0x553d1d['error'][_0x6edf('0x29')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x3ba402,_0x553d1d['error'][_0x6edf('0x2a')]);return _0x23e5ac(_0x553d1d[_0x6edf('0x28')]['message']);}logger['error'](_0x6edf('0x2b'),_0x3ba402,_0x553d1d[_0x6edf('0x28')]['message']);return _0x3fff94(_0x553d1d[_0x6edf('0x28')]['message']);}else{logger['info'](_0x6edf('0x2b'),_0x3ba402,_0x6edf('0x24'));_0x3fff94(_0x553d1d[_0x6edf('0x2c')]['message']);}})['catch'](function(_0x537c79){logger[_0x6edf('0x28')](_0x6edf('0x2b'),_0x3ba402,_0x537c79);_0x23e5ac(_0x537c79);});});}function respondWithStatusCode(_0x290d46,_0x12a191){_0x12a191=_0x12a191||0xcc;return function(_0x416a79){if(_0x416a79){return _0x290d46['sendStatus'](_0x12a191);}return _0x290d46[_0x6edf('0x2d')](_0x12a191)[_0x6edf('0x2e')]();};}function respondWithResult(_0x4c238d,_0xfb4a45){_0xfb4a45=_0xfb4a45||0xc8;return function(_0x5d9c93){if(_0x5d9c93){return _0x4c238d[_0x6edf('0x2d')](_0xfb4a45)['json'](_0x5d9c93);}};}function respondWithFilteredResult(_0x418c6b,_0x4491f1){return function(_0x2d0aec){if(_0x2d0aec){var _0x3f479a=typeof _0x4491f1[_0x6edf('0x2f')]===_0x6edf('0x30')&&typeof _0x4491f1[_0x6edf('0x31')]===_0x6edf('0x30');var _0x33d361=_0x2d0aec[_0x6edf('0x32')];var _0x318466=_0x3f479a?0x0:_0x4491f1[_0x6edf('0x2f')];var _0x2cd271=_0x3f479a?_0x2d0aec[_0x6edf('0x32')]:_0x4491f1[_0x6edf('0x2f')]+_0x4491f1[_0x6edf('0x31')];var _0x167a02;if(_0x2cd271>=_0x33d361){_0x2cd271=_0x33d361;_0x167a02=0xc8;}else{_0x167a02=0xce;}_0x418c6b['status'](_0x167a02);return _0x418c6b[_0x6edf('0x33')](_0x6edf('0x34'),_0x318466+'-'+_0x2cd271+'/'+_0x33d361)[_0x6edf('0x35')](_0x2d0aec);}return null;};}function patchUpdates(_0x58e648){return function(_0x585a0a){try{jsonpatch[_0x6edf('0x36')](_0x585a0a,_0x58e648,!![]);}catch(_0x46086d){return BPromise[_0x6edf('0x37')](_0x46086d);}return _0x585a0a[_0x6edf('0x38')]();};}function saveUpdates(_0x1f61b5,_0x16266e){return function(_0x3c79c4){if(_0x3c79c4){return _0x3c79c4[_0x6edf('0x39')](_0x1f61b5)[_0x6edf('0x23')](function(_0x2ad221){return _0x2ad221;});}return null;};}function removeEntity(_0x3d192b,_0x55fd5c){return function(_0xf1ce53){if(_0xf1ce53){return _0xf1ce53[_0x6edf('0x3a')]()['then'](function(){_0x3d192b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ee097,_0x1fbafc){return function(_0x278405){if(!_0x278405){_0x1ee097[_0x6edf('0x3b')](0x194);}return _0x278405;};}function handleError(_0xfc6b02,_0x10bf83){_0x10bf83=_0x10bf83||0x1f4;return function(_0x4fb4bc){logger[_0x6edf('0x28')](_0x4fb4bc[_0x6edf('0x3c')]);if(_0x4fb4bc[_0x6edf('0x3d')]){delete _0x4fb4bc[_0x6edf('0x3d')];}_0xfc6b02[_0x6edf('0x2d')](_0x10bf83)[_0x6edf('0x3e')](_0x4fb4bc);};}exports[_0x6edf('0x3f')]=function(_0x252b61,_0x43ce85){var _0x45f065={},_0x1c9e35={},_0x81c1b0={'count':0x0,'rows':[]};var _0x400b4b=_[_0x6edf('0x40')](db[_0x6edf('0x41')][_0x6edf('0x42')],function(_0x554dbd){return{'name':_0x554dbd['fieldName'],'type':_0x554dbd[_0x6edf('0x43')][_0x6edf('0x44')]};});_0x1c9e35['model']=_[_0x6edf('0x40')](_0x400b4b,_0x6edf('0x3d'));_0x1c9e35[_0x6edf('0x45')]=_['keys'](_0x252b61[_0x6edf('0x45')]);_0x1c9e35[_0x6edf('0x46')]=_[_0x6edf('0x47')](_0x1c9e35[_0x6edf('0x48')],_0x1c9e35['query']);_0x45f065[_0x6edf('0x49')]=_[_0x6edf('0x47')](_0x1c9e35[_0x6edf('0x48')],qs['fields'](_0x252b61[_0x6edf('0x45')][_0x6edf('0x4a')]));_0x45f065[_0x6edf('0x49')]=_0x45f065[_0x6edf('0x49')][_0x6edf('0x4b')]?_0x45f065[_0x6edf('0x49')]:_0x1c9e35[_0x6edf('0x48')];if(!_0x252b61[_0x6edf('0x45')]['hasOwnProperty'](_0x6edf('0x4c'))){_0x45f065[_0x6edf('0x31')]=qs[_0x6edf('0x31')](_0x252b61[_0x6edf('0x45')]['limit']);_0x45f065[_0x6edf('0x2f')]=qs['offset'](_0x252b61[_0x6edf('0x45')][_0x6edf('0x2f')]);}_0x45f065['order']=qs[_0x6edf('0x4d')](_0x252b61['query'][_0x6edf('0x4d')]);_0x45f065['where']=qs[_0x6edf('0x46')](_['pick'](_0x252b61[_0x6edf('0x45')],_0x1c9e35[_0x6edf('0x46')]),_0x400b4b);if(_0x252b61[_0x6edf('0x45')][_0x6edf('0x4e')]){_0x45f065[_0x6edf('0x4f')]=_[_0x6edf('0x50')](_0x45f065[_0x6edf('0x4f')],{'$or':_[_0x6edf('0x40')](_0x400b4b,function(_0x2d2a1a){if(_0x2d2a1a[_0x6edf('0x43')]!==_0x6edf('0x51')){var _0xc10a3f={};_0xc10a3f[_0x2d2a1a['name']]={'$like':'%'+_0x252b61[_0x6edf('0x45')][_0x6edf('0x4e')]+'%'};return _0xc10a3f;}})});}_0x45f065=_[_0x6edf('0x50')]({},_0x45f065,_0x252b61[_0x6edf('0x52')]);var _0x1b2b52={'where':_0x45f065[_0x6edf('0x4f')]};return db[_0x6edf('0x41')][_0x6edf('0x32')](_0x1b2b52)['then'](function(_0x584212){_0x81c1b0[_0x6edf('0x32')]=_0x584212;if(_0x252b61[_0x6edf('0x45')][_0x6edf('0x53')]){_0x45f065['include']=[{'all':!![]}];}return db[_0x6edf('0x41')][_0x6edf('0x54')](_0x45f065);})[_0x6edf('0x23')](function(_0x22f743){_0x81c1b0[_0x6edf('0x55')]=_0x22f743;return _0x81c1b0;})[_0x6edf('0x23')](respondWithFilteredResult(_0x43ce85,_0x45f065))['catch'](handleError(_0x43ce85,null));};exports['show']=function(_0x3a3df4,_0x529219){var _0x44668a={'raw':!![],'where':{'id':_0x3a3df4[_0x6edf('0x56')]['id']}},_0x44fcc8={};_0x44fcc8['model']=_[_0x6edf('0x57')](db[_0x6edf('0x41')][_0x6edf('0x42')]);_0x44fcc8[_0x6edf('0x45')]=_[_0x6edf('0x57')](_0x3a3df4[_0x6edf('0x45')]);_0x44fcc8['filters']=_[_0x6edf('0x47')](_0x44fcc8[_0x6edf('0x48')],_0x44fcc8[_0x6edf('0x45')]);_0x44668a[_0x6edf('0x49')]=_['intersection'](_0x44fcc8[_0x6edf('0x48')],qs[_0x6edf('0x4a')](_0x3a3df4[_0x6edf('0x45')][_0x6edf('0x4a')]));_0x44668a['attributes']=_0x44668a['attributes'][_0x6edf('0x4b')]?_0x44668a[_0x6edf('0x49')]:_0x44fcc8['model'];if(_0x3a3df4[_0x6edf('0x45')][_0x6edf('0x53')]){_0x44668a[_0x6edf('0x58')]=[{'all':!![]}];}_0x44668a=_['merge']({},_0x44668a,_0x3a3df4['options']);return db['WhatsappMessage'][_0x6edf('0x59')](_0x44668a)[_0x6edf('0x23')](handleEntityNotFound(_0x529219,null))[_0x6edf('0x23')](respondWithResult(_0x529219,null))[_0x6edf('0x5a')](handleError(_0x529219,null));};exports[_0x6edf('0x5b')]=function(_0x518a9f,_0x185cf4){return db['WhatsappMessage'][_0x6edf('0x5b')](_0x518a9f[_0x6edf('0x5c')],{})[_0x6edf('0x23')](respondWithResult(_0x185cf4,0xc9))[_0x6edf('0x5a')](handleError(_0x185cf4,null));};exports[_0x6edf('0x39')]=function(_0x467fcb,_0x4a8a8e){if(_0x467fcb[_0x6edf('0x5c')]['id']){delete _0x467fcb[_0x6edf('0x5c')]['id'];}return db[_0x6edf('0x41')][_0x6edf('0x59')]({'where':{'id':_0x467fcb[_0x6edf('0x56')]['id']}})[_0x6edf('0x23')](handleEntityNotFound(_0x4a8a8e,null))['then'](saveUpdates(_0x467fcb['body'],null))[_0x6edf('0x23')](respondWithResult(_0x4a8a8e,null))[_0x6edf('0x5a')](handleError(_0x4a8a8e,null));};exports[_0x6edf('0x3a')]=function(_0x5f494e,_0x42aa36){return db[_0x6edf('0x41')][_0x6edf('0x59')]({'where':{'id':_0x5f494e[_0x6edf('0x56')]['id']}})[_0x6edf('0x23')](handleEntityNotFound(_0x42aa36,null))[_0x6edf('0x23')](removeEntity(_0x42aa36,null))[_0x6edf('0x5a')](handleError(_0x42aa36,null));};exports[_0x6edf('0x5d')]=function(_0xda3669,_0x2b6c2c){return db[_0x6edf('0x41')][_0x6edf('0x5d')]()[_0x6edf('0x23')](respondWithResult(_0x2b6c2c,null))[_0x6edf('0x5a')](handleError(_0x2b6c2c,null));};var interaction_log=require(_0x6edf('0x15'))(_0x6edf('0x5e'));exports[_0x6edf('0x5f')]=function(_0x36b1a3,_0x3815d4,_0x5cf0d2){var _0x3bf204={'agent':{},'channel':'whatsapp'};if(_0x36b1a3[_0x6edf('0x5c')]['id']){delete _0x36b1a3[_0x6edf('0x5c')]['id'];}_0x36b1a3['body'][_0x6edf('0x60')]=!![];_0x36b1a3['body'][_0x6edf('0x61')]=moment()['format'](_0x6edf('0x62'));_0x36b1a3[_0x6edf('0x5c')][_0x6edf('0x63')]=_0x36b1a3['body'][_0x6edf('0x63')]||_0x36b1a3[_0x6edf('0x64')]['id'];_0x3bf204[_0x6edf('0x65')]['id']=_0x36b1a3[_0x6edf('0x5c')]['UserId'];return db[_0x6edf('0x41')][_0x6edf('0x59')]({'where':{'id':_0x36b1a3['params']['id'],'UserId':null}})[_0x6edf('0x23')](handleEntityNotFound(_0x3815d4,null))[_0x6edf('0x23')](saveUpdates(_0x36b1a3[_0x6edf('0x5c')],null))['then'](function(_0x1861e4){if(_0x1861e4){_0x3bf204['message']=_0x1861e4[_0x6edf('0x66')]({'plain':!![]});return db[_0x6edf('0x67')][_0x6edf('0x59')]({'where':{'id':_0x1861e4[_0x6edf('0x68')]}});}return null;})[_0x6edf('0x23')](handleEntityNotFound(_0x3815d4,null))['then'](function(_0x21c973){if(_0x21c973){return _0x21c973[_0x6edf('0x39')]({'UserId':_0x36b1a3['body'][_0x6edf('0x63')],'read1stAt':_[_0x6edf('0x69')](_0x21c973['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6edf('0x23')](function(_0x25a053){if(_0x25a053){_0x3bf204['interaction']=_0x25a053['get']({'plain':!![]});interaction_log[_0x6edf('0x6a')](_0x6edf('0x6b'),_0x36b1a3['user']['id'],_0x36b1a3[_0x6edf('0x64')][_0x6edf('0x3d')],_0x36b1a3[_0x6edf('0x64')][_0x6edf('0x6c')],_0x3bf204[_0x6edf('0x6d')]['id'],_0x36b1a3[_0x6edf('0x5c')]?JSON[_0x6edf('0x27')](_0x36b1a3[_0x6edf('0x5c')]):_0x6edf('0x6e'));return respondWithRpcPromise(_0x6edf('0x6f'),'acceptMessage',_0x3bf204);}return null;})[_0x6edf('0x23')](function(_0x1a57b4){var _0x2c4bf0=_0x6edf('0x70')+_0x1a57b4[_0x6edf('0x2a')][_0x6edf('0x71')];return db['sequelize']['query'](_0x2c4bf0,{'type':db[_0x6edf('0x72')][_0x6edf('0x73')][_0x6edf('0x74')],'raw':!![]})[_0x6edf('0x23')](function(_0x2fd2a4){return _0x2fd2a4;});})[_0x6edf('0x23')](function(_0x5d60fe){if(_0x5d60fe){_0x3bf204[_0x6edf('0x2a')][_0x6edf('0x75')]=_0x5d60fe[0x0];if(!_0x36b1a3[_0x6edf('0x5c')]['UserId'])return;return db['User']['find']({'where':{'id':_0x36b1a3[_0x6edf('0x5c')]['UserId'],'role':_0x6edf('0x65')},'attributes':['id',_0x6edf('0x3d'),_0x6edf('0x76'),_0x6edf('0x77'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4df429){if(!_0x4df429)return null;_0x3bf204['message'][_0x6edf('0x65')]=_0x4df429;return _0x3bf204;})[_0x6edf('0x23')](function(_0xfead7){if(_0xfead7){if(_0x36b1a3['body'][_0x6edf('0x78')]){_0x3bf204[_0x6edf('0x2a')][_0x6edf('0x79')]=util[_0x6edf('0x7a')](_0x6edf('0x7b'),_0x36b1a3['user'][_0x6edf('0x3d')]);_0x3bf204[_0x6edf('0x2a')][_0x6edf('0x7c')]=_0x3bf204[_0x6edf('0x7c')];_0x3bf204['message'][_0x6edf('0x7d')]=_0x3bf204['channel'];_0x3bf204[_0x6edf('0x2a')][_0x6edf('0x7e')]=_0x6edf('0x5f');return respondWithRpcPromise('EventManager',_0x6edf('0x7f'),{'event':_0x6edf('0x80'),'message':_0x3bf204[_0x6edf('0x2a')]},client9002)[_0x6edf('0x23')](function(){return _0x3bf204;});}return _0x3bf204;}return null;})[_0x6edf('0x23')](respondWithResult(_0x3815d4,null))[_0x6edf('0x5a')](handleError(_0x3815d4,null));};var interaction_log=require(_0x6edf('0x15'))(_0x6edf('0x5e'));exports['reject']=function(_0x4392e2,_0x1c7c0b,_0x3e72ba){var _0x2ecd6d={'agent':{},'channel':_0x6edf('0x81')};if(_0x4392e2['body']['id']){delete _0x4392e2[_0x6edf('0x5c')]['id'];}_0x4392e2[_0x6edf('0x5c')][_0x6edf('0x63')]=_0x4392e2[_0x6edf('0x5c')][_0x6edf('0x63')]||_0x4392e2[_0x6edf('0x64')]['id'];_0x2ecd6d[_0x6edf('0x65')]['id']=_0x4392e2['body']['UserId'];return db[_0x6edf('0x41')][_0x6edf('0x59')]({'where':{'id':_0x4392e2[_0x6edf('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1c7c0b,null))['then'](function(_0x4cbec2){if(_0x4cbec2){_0x2ecd6d['message']=_0x4cbec2[_0x6edf('0x66')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x4cbec2[_0x6edf('0x68')]}});}return null;})[_0x6edf('0x23')](handleEntityNotFound(_0x1c7c0b,null))[_0x6edf('0x23')](function(_0x19bb2a){if(_0x19bb2a){_0x2ecd6d['interaction']=_0x19bb2a[_0x6edf('0x66')]({'plain':!![]});interaction_log[_0x6edf('0x6a')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4392e2[_0x6edf('0x64')]['id'],_0x4392e2['user'][_0x6edf('0x3d')],_0x4392e2['user']['role'],_0x2ecd6d[_0x6edf('0x6d')]['id'],_0x4392e2['body']?JSON[_0x6edf('0x27')](_0x4392e2[_0x6edf('0x5c')]):_0x6edf('0x6e'));return respondWithRpcPromise(_0x6edf('0x82'),'rejectMessage',_0x2ecd6d);}return null;})[_0x6edf('0x23')](function(_0x41eb72){var _0x2e8e5=_0x6edf('0x70')+_0x41eb72['message'][_0x6edf('0x71')];return db[_0x6edf('0x83')]['query'](_0x2e8e5,{'type':db[_0x6edf('0x72')][_0x6edf('0x73')][_0x6edf('0x74')],'raw':!![]})[_0x6edf('0x23')](function(_0x55551b){return _0x55551b;});})['then'](function(_0x1796bb){if(_0x1796bb){_0x2ecd6d[_0x6edf('0x2a')][_0x6edf('0x75')]=_0x1796bb[0x0];if(!_0x4392e2[_0x6edf('0x5c')][_0x6edf('0x63')])return;return db[_0x6edf('0x84')]['find']({'where':{'id':_0x4392e2[_0x6edf('0x5c')][_0x6edf('0x63')],'role':_0x6edf('0x65')},'attributes':['id',_0x6edf('0x3d'),_0x6edf('0x76'),_0x6edf('0x77'),_0x6edf('0x85')],'raw':!![]});}return null;})[_0x6edf('0x23')](function(_0x2877cc){if(!_0x2877cc)return null;_0x2ecd6d[_0x6edf('0x2a')][_0x6edf('0x65')]=_0x2877cc;return _0x2ecd6d;})['then'](function(_0x43f870){if(_0x43f870){_0x43f870[_0x6edf('0x2a')][_0x6edf('0x79')]=util[_0x6edf('0x7a')](_0x6edf('0x7b'),_0x4392e2[_0x6edf('0x64')][_0x6edf('0x3d')]);_0x43f870[_0x6edf('0x2a')][_0x6edf('0x7c')]=_0x2ecd6d[_0x6edf('0x7c')];_0x43f870[_0x6edf('0x2a')]['motionChannel']=_0x2ecd6d['channel'];_0x43f870[_0x6edf('0x2a')][_0x6edf('0x7e')]=_0x6edf('0x37');respondWithRpcPromise(_0x6edf('0x7f'),_0x6edf('0x7f'),{'event':_0x6edf('0x86'),'message':_0x43f870['message']},client9002);return _0x2ecd6d;}return null;})['then'](respondWithResult(_0x1c7c0b,null))['catch'](handleError(_0x1c7c0b,null));};exports[_0x6edf('0x2d')]=function(_0x33bdd7,_0x5183a3,_0x4b2d44){if(_0x33bdd7[_0x6edf('0x5c')]['id']){delete _0x33bdd7['body']['id'];}var _0x51b4e3;return db[_0x6edf('0x41')][_0x6edf('0x59')]({'where':{'id':_0x33bdd7[_0x6edf('0x56')]['id']}})[_0x6edf('0x23')](handleEntityNotFound(_0x5183a3,null))[_0x6edf('0x23')](function(_0x27f85e){if(_0x27f85e){_0x51b4e3=_0x27f85e;return db['WhatsappAccount'][_0x6edf('0x59')]({'where':{'id':_0x27f85e[_0x6edf('0x87')]}});}})[_0x6edf('0x23')](handleEntityNotFound(_0x5183a3,null))[_0x6edf('0x23')](function(_0x5e7949){if(_0x5e7949){logger[_0x6edf('0x25')](_0x6edf('0x88'),_0x6edf('0x2d'),_0x6edf('0x89'),_0x5e7949['type'],util[_0x6edf('0x8a')](_0x33bdd7[_0x6edf('0x5c')],{'showHidden':![],'depth':null}));switch(_0x5e7949[_0x6edf('0x43')]){case'twilio':if(_0x33bdd7['body'][_0x6edf('0x8b')]&&_0x33bdd7[_0x6edf('0x5c')][_0x6edf('0x8b')]===_0x51b4e3[_0x6edf('0x8c')]&&_0x33bdd7[_0x6edf('0x5c')][_0x6edf('0x8d')]&&_0x33bdd7[_0x6edf('0x5c')]['MessageStatus']===_0x6edf('0x60')){return _0x51b4e3['update']({'read':!![]});}else{logger[_0x6edf('0x28')](_0x6edf('0x8e'),_0x6edf('0x2d'),_0x6edf('0x8f'),util[_0x6edf('0x8a')](_0x33bdd7[_0x6edf('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x51b4e3;}})[_0x6edf('0x23')](respondWithResult(_0x5183a3,null))[_0x6edf('0x5a')](handleError(_0x5183a3,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index af33fae..4ffd425 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 _0xcf66=['exports','events','../../mysqldb','WhatsappMessage','save','update','emit','hasOwnProperty'];(function(_0x3d9de3,_0x5067bf){var _0x59dfd9=function(_0x2beb1a){while(--_0x2beb1a){_0x3d9de3['push'](_0x3d9de3['shift']());}};_0x59dfd9(++_0x5067bf);}(_0xcf66,0x71));var _0x6cf6=function(_0xe945c8,_0x3597a3){_0xe945c8=_0xe945c8-0x0;var _0x20492c=_0xcf66[_0xe945c8];return _0x20492c;};'use strict';var EventEmitter=require(_0x6cf6('0x0'));var WhatsappMessage=require(_0x6cf6('0x1'))['db'][_0x6cf6('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6cf6('0x3'),'afterUpdate':_0x6cf6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4e16eb){return function(_0x1c599d,_0x45d0d8,_0x57f22f){WhatsappMessageEvents[_0x6cf6('0x5')](_0x4e16eb+':'+_0x1c599d['id'],_0x1c599d);WhatsappMessageEvents[_0x6cf6('0x5')](_0x4e16eb,_0x1c599d);_0x57f22f(null);};}for(var e in events){if(events[_0x6cf6('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x6cf6('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xd523=['remove','emit','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update'];(function(_0x21da59,_0x45ae75){var _0x5023f1=function(_0x1a6fd3){while(--_0x1a6fd3){_0x21da59['push'](_0x21da59['shift']());}};_0x5023f1(++_0x45ae75);}(_0xd523,0x153));var _0x3d52=function(_0x2cea55,_0x5806ae){_0x2cea55=_0x2cea55-0x0;var _0x1094d0=_0xd523[_0x2cea55];return _0x1094d0;};'use strict';var EventEmitter=require(_0x3d52('0x0'));var WhatsappMessage=require(_0x3d52('0x1'))['db'][_0x3d52('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x3d52('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3d52('0x4'),'afterDestroy':_0x3d52('0x5')};function emitEvent(_0x2752e7){return function(_0x5103d8,_0x24d3af,_0x3dfd00){WhatsappMessageEvents[_0x3d52('0x6')](_0x2752e7+':'+_0x5103d8['id'],_0x5103d8);WhatsappMessageEvents[_0x3d52('0x6')](_0x2752e7,_0x5103d8);_0x3dfd00(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x3d52('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 4324b50..d3dd39a 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 _0x004c=['api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','util','../../config/logger'];(function(_0x2ccf87,_0x2ad346){var _0x9256db=function(_0x2fea89){while(--_0x2fea89){_0x2ccf87['push'](_0x2ccf87['shift']());}};_0x9256db(++_0x2ad346);}(_0x004c,0x76));var _0xc004=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x004c[_0x220f3f];return _0x1f170e;};'use strict';var _=require('lodash');var util=require(_0xc004('0x0'));var logger=require(_0xc004('0x1'))(_0xc004('0x2'));var moment=require(_0xc004('0x3'));var BPromise=require('bluebird');var rp=require(_0xc004('0x4'));var fetch=require(_0xc004('0x5'));var fs=require('fs');var path=require(_0xc004('0x6'));var rimraf=require(_0xc004('0x7'));var config=require(_0xc004('0x8'));var attributes=require(_0xc004('0x9'));module[_0xc004('0xa')]=function(_0x291cf0,_0x3e0262){return _0x291cf0[_0xc004('0xb')](_0xc004('0xc'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xc004('0xd'),'fields':['messageId']},{'name':_0xc004('0xe'),'fields':[_0xc004('0xf')],'type':_0xc004('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3114e3,_0xddc68a,_0x62e50a){var _0x198980=_0x291cf0['models'];var _0xe672ee=_0x3114e3[_0xc004('0x11')]({'plain':!![]});if(_0xe672ee[_0xc004('0x12')][_0xc004('0x13')]()==='in'||_0xe672ee[_0xc004('0x12')][_0xc004('0x13')]()===_0xc004('0x14')&&!_0xe672ee[_0xc004('0x15')]&&!_[_0xc004('0x16')](_0xe672ee[_0xc004('0x17')])){_0x198980[_0xc004('0x18')]['findOne']({'where':{'id':_0xe672ee[_0xc004('0x19')]}})[_0xc004('0x1a')](function(_0x4bc9e3){if(_0x4bc9e3){_0x4bc9e3[_0xc004('0x1b')]({'lastMsgAt':_0xe672ee[_0xc004('0x1c')],'lastMsgDirection':_0xe672ee[_0xc004('0x12')][_0xc004('0x13')]()});}})[_0xc004('0x1d')](function(_0x58f55c){console[_0xc004('0x1e')](_0x58f55c);});}if(_0xe672ee[_0xc004('0x12')]===_0xc004('0x14')&&!_0xe672ee[_0xc004('0x15')]){var _0x543df4;_0x198980[_0xc004('0x1f')][_0xc004('0x20')]({'where':{'id':_0xe672ee['WhatsappAccountId']},'raw':!![]})[_0xc004('0x1a')](function(_0x5566ad){_0x543df4=_0x5566ad;if(_0x543df4&&_0x543df4[_0xc004('0x21')]){switch(_0x543df4[_0xc004('0x21')]){case _0xc004('0x22'):var _0x1039f1=require(_0xc004('0x22'));if(_0x543df4[_0xc004('0x23')]&&_0x543df4[_0xc004('0x24')]&&_0x543df4[_0xc004('0x25')]){var _0x810652=new _0x1039f1(_0x543df4['accountSid'],_0x543df4[_0xc004('0x24')]);_0x810652['messages']['create']({'body':_0xe672ee[_0xc004('0xf')],'to':_0xc004('0x26')+_0xe672ee[_0xc004('0x25')],'from':_0xc004('0x26')+_0x543df4['phone'],'statusCallback':_0x543df4[_0xc004('0x27')]+_0xc004('0x28')+_0xe672ee['id']+_0xc004('0x29')+_0x543df4['token']})[_0xc004('0x1a')](function(_0x5d05d0){if(_0x5d05d0[_0xc004('0x2a')]){return _0x3114e3[_0xc004('0x1b')]({'messageId':_0x5d05d0['sid']});}})['catch'](function(_0x3e8c03){logger[_0xc004('0x1e')](_0xc004('0x2b'),'afterCreate',_0xc004('0x22'),util[_0xc004('0x2c')](_0x3e8c03,{'showHidden':![],'depth':null}));});}else{logger[_0xc004('0x1e')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc004('0x2d'),_0xc004('0x22'),_0xc004('0x2e'));}break;case _0xc004('0x2f'):var _0x509aac=_0x543df4[_0xc004('0x23')];var _0x54ad9d=_0x543df4['authToken'];var _0x3bb481=_0x543df4[_0xc004('0x30')]+_0xc004('0x31')+_0x509aac+_0xc004('0x32');var _0xe53fdd={'to':[_0xe672ee[_0xc004('0x25')]],'message':{'type':_0xc004('0x33'),'text':_0xe672ee[_0xc004('0xf')]}};var _0xe4778f={'method':'POST','uri':_0x3bb481,'headers':{'Authorization':_0xc004('0x34')+_0x54ad9d,'Content-Type':_0xc004('0x35')},'body':_0xe53fdd,'json':!![]};rp(_0xe4778f)[_0xc004('0x1a')](function(_0x1d991c){if(_0x1d991c[_0xc004('0x36')][0x0][_0xc004('0x37')]){return _0x3114e3[_0xc004('0x1b')]({'messageId':_0x1d991c[_0xc004('0x36')][0x0][_0xc004('0x37')]});}})['catch'](function(_0x5726bf){logger[_0xc004('0x38')](_0xc004('0x39'),_0x5726bf);});break;}}})[_0xc004('0x3a')](function(){_0x62e50a();});}else{_0x62e50a();}}},'charset':_0xc004('0x3b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa329=['update','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','get','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','createdAt','direction','catch','error','secret','find','WhatsappAccountId','type','twilio','authToken','accountSid','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','/whatsapp/v1/','/messages/','POST','Bearer\x20','application/json','statuses','message_id'];(function(_0x7a1d70,_0x681fba){var _0x57a143=function(_0x36c4ce){while(--_0x36c4ce){_0x7a1d70['push'](_0x7a1d70['shift']());}};_0x57a143(++_0x681fba);}(_0xa329,0x1cc));var _0x9a32=function(_0x167e60,_0x5ce9d7){_0x167e60=_0x167e60-0x0;var _0x53ef7c=_0xa329[_0x167e60];return _0x53ef7c;};'use strict';var _=require(_0x9a32('0x0'));var util=require(_0x9a32('0x1'));var logger=require(_0x9a32('0x2'))('api');var moment=require(_0x9a32('0x3'));var BPromise=require(_0x9a32('0x4'));var rp=require(_0x9a32('0x5'));var fetch=require(_0x9a32('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a32('0x7'));var config=require('../../config/environment');var attributes=require(_0x9a32('0x8'));module[_0x9a32('0x9')]=function(_0x3ac937,_0x58569d){return _0x3ac937[_0x9a32('0xa')](_0x9a32('0xb'),attributes,{'tableName':_0x9a32('0xc'),'paranoid':![],'indexes':[{'name':_0x9a32('0xd'),'fields':[_0x9a32('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0x9a32('0xe')],'type':_0x9a32('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x14c7a7,_0x1c476c,_0x3cb2fe){var _0x3c9aa2=_0x3ac937['models'];var _0x234ec4=_0x14c7a7[_0x9a32('0x10')]({'plain':!![]});if(_0x234ec4['direction'][_0x9a32('0x11')]()==='in'||_0x234ec4['direction'][_0x9a32('0x11')]()===_0x9a32('0x12')&&!_0x234ec4['secret']&&!_[_0x9a32('0x13')](_0x234ec4[_0x9a32('0x14')])){_0x3c9aa2[_0x9a32('0x15')][_0x9a32('0x16')]({'where':{'id':_0x234ec4[_0x9a32('0x17')]}})[_0x9a32('0x18')](function(_0x4d2aee){if(_0x4d2aee){_0x4d2aee['update']({'lastMsgAt':_0x234ec4[_0x9a32('0x19')],'lastMsgDirection':_0x234ec4[_0x9a32('0x1a')][_0x9a32('0x11')]()});}})[_0x9a32('0x1b')](function(_0x32ba67){console[_0x9a32('0x1c')](_0x32ba67);});}if(_0x234ec4['direction']===_0x9a32('0x12')&&!_0x234ec4[_0x9a32('0x1d')]){var _0x49fa25;_0x3c9aa2['WhatsappAccount'][_0x9a32('0x1e')]({'where':{'id':_0x234ec4[_0x9a32('0x1f')]},'raw':!![]})[_0x9a32('0x18')](function(_0x34c7bd){_0x49fa25=_0x34c7bd;if(_0x49fa25&&_0x49fa25[_0x9a32('0x20')]){switch(_0x49fa25[_0x9a32('0x20')]){case _0x9a32('0x21'):var _0x4d9e0a=require(_0x9a32('0x21'));if(_0x49fa25['accountSid']&&_0x49fa25[_0x9a32('0x22')]&&_0x49fa25['phone']){var _0x94de66=new _0x4d9e0a(_0x49fa25[_0x9a32('0x23')],_0x49fa25['authToken']);_0x94de66[_0x9a32('0x24')][_0x9a32('0x25')]({'body':_0x234ec4[_0x9a32('0xe')],'to':_0x9a32('0x26')+_0x234ec4['phone'],'from':'whatsapp:'+_0x49fa25[_0x9a32('0x27')],'statusCallback':_0x49fa25[_0x9a32('0x28')]+_0x9a32('0x29')+_0x234ec4['id']+'/status?token='+_0x49fa25[_0x9a32('0x2a')]})[_0x9a32('0x18')](function(_0x145891){if(_0x145891[_0x9a32('0x2b')]){return _0x14c7a7['update']({'messageId':_0x145891['sid']});}})[_0x9a32('0x1b')](function(_0x30274b){logger[_0x9a32('0x1c')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9a32('0x21'),util['inspect'](_0x30274b,{'showHidden':![],'depth':null}));});}else{logger[_0x9a32('0x1c')](_0x9a32('0x2c'),'afterCreate',_0x9a32('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x9a32('0x2d'):var _0x250d0e=_0x49fa25[_0x9a32('0x23')];var _0x294dc2=_0x49fa25[_0x9a32('0x22')];var _0x4d8377=_0x49fa25['baseUrl']+_0x9a32('0x2e')+_0x250d0e+_0x9a32('0x2f');var _0x481a27={'to':[_0x234ec4[_0x9a32('0x27')]],'message':{'type':'text','text':_0x234ec4['body']}};var _0xf78773={'method':_0x9a32('0x30'),'uri':_0x4d8377,'headers':{'Authorization':_0x9a32('0x31')+_0x294dc2,'Content-Type':_0x9a32('0x32')},'body':_0x481a27,'json':!![]};rp(_0xf78773)[_0x9a32('0x18')](function(_0x58cef2){if(_0x58cef2[_0x9a32('0x33')][0x0][_0x9a32('0x34')]){return _0x14c7a7[_0x9a32('0x35')]({'messageId':_0x58cef2[_0x9a32('0x33')][0x0][_0x9a32('0x34')]});}})[_0x9a32('0x1b')](function(_0xf5f52d){logger['err'](_0x9a32('0x36'),_0xf5f52d);});break;}}})[_0x9a32('0x37')](function(){_0x3cb2fe();});}else{_0x3cb2fe();}}},'charset':_0x9a32('0x38'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 7531ed3..73c643f 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 _0x51a0=['request\x20sent','stringify','error','code','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','body','raw','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3937ec,_0x4873be){var _0x4dee34=function(_0x143cab){while(--_0x143cab){_0x3937ec['push'](_0x3937ec['shift']());}};_0x4dee34(++_0x4873be);}(_0x51a0,0x123));var _0x051a=function(_0x39b51c,_0x40010d){_0x39b51c=_0x39b51c-0x0;var _0x146312=_0x51a0[_0x39b51c];return _0x146312;};'use strict';var _=require('lodash');var util=require(_0x051a('0x0'));var moment=require(_0x051a('0x1'));var BPromise=require(_0x051a('0x2'));var rs=require(_0x051a('0x3'));var fs=require('fs');var Redis=require(_0x051a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x051a('0x5'))(_0x051a('0x6'));var config=require(_0x051a('0x7'));var jayson=require(_0x051a('0x8'));var client=jayson['client'][_0x051a('0x9')]({'port':0x232a});config[_0x051a('0xa')]=_['defaults'](config[_0x051a('0xa')],{'host':_0x051a('0xb'),'port':0x18eb});var socket=require(_0x051a('0xc'))(new Redis(config['redis']));require(_0x051a('0xd'))[_0x051a('0xe')](socket);function respondWithRpcPromise(_0x55be27,_0x5ee999,_0x5e11f7){return new BPromise(function(_0x9b6ac1,_0x1c9e94){return client[_0x051a('0xf')](_0x55be27,_0x5e11f7)['then'](function(_0x211840){logger['info'](_0x051a('0x10'),_0x5ee999,'request\x20sent');logger[_0x051a('0x11')](_0x051a('0x12'),_0x5ee999,_0x051a('0x13'),JSON[_0x051a('0x14')](_0x211840));if(_0x211840[_0x051a('0x15')]){if(_0x211840[_0x051a('0x15')][_0x051a('0x16')]===0x1f4){logger[_0x051a('0x15')](_0x051a('0x10'),_0x5ee999,_0x211840[_0x051a('0x15')]['message']);return _0x1c9e94(_0x211840[_0x051a('0x15')][_0x051a('0x17')]);}logger['error'](_0x051a('0x10'),_0x5ee999,_0x211840['error'][_0x051a('0x17')]);return _0x9b6ac1(_0x211840[_0x051a('0x15')][_0x051a('0x17')]);}else{logger[_0x051a('0x18')](_0x051a('0x10'),_0x5ee999,'request\x20sent');_0x9b6ac1(_0x211840[_0x051a('0x19')]['message']);}})[_0x051a('0x1a')](function(_0x22aabb){logger[_0x051a('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x5ee999,_0x22aabb);_0x1c9e94(_0x22aabb);});});}exports[_0x051a('0x1b')]=function(_0x555778){var _0x44c027=this;return new Promise(function(_0x1ce562,_0x53d78c){return db[_0x051a('0x1c')]['create'](_0x555778[_0x051a('0x1d')],{'raw':_0x555778['options']?_0x555778['options'][_0x051a('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x499d84){logger[_0x051a('0x18')]('CreateWhatsappMessage',_0x555778);logger['debug'](_0x051a('0x1b'),_0x555778,JSON['stringify'](_0x499d84));_0x1ce562(_0x499d84);})[_0x051a('0x1a')](function(_0x4a3221){logger[_0x051a('0x15')](_0x051a('0x1b'),_0x4a3221[_0x051a('0x17')],_0x555778);_0x53d78c(_0x44c027['error'](0x1f4,_0x4a3221['message']));});});}; \ No newline at end of file +var _0xbb92=['request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','lodash','util','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x23d6f9,_0xdaa281){var _0x4c3c70=function(_0x589bf5){while(--_0x589bf5){_0x23d6f9['push'](_0x23d6f9['shift']());}};_0x4c3c70(++_0xdaa281);}(_0xbb92,0x187));var _0x2bb9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbb92[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x2bb9('0x0'));var util=require(_0x2bb9('0x1'));var moment=require('moment');var BPromise=require(_0x2bb9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bb9('0x3'));var db=require(_0x2bb9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2bb9('0x5'));var config=require('../../config/environment');var jayson=require(_0x2bb9('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x2bb9('0x7')]=_[_0x2bb9('0x8')](config[_0x2bb9('0x7')],{'host':_0x2bb9('0x9'),'port':0x18eb});var socket=require(_0x2bb9('0xa'))(new Redis(config[_0x2bb9('0x7')]));require('./whatsappMessage.socket')[_0x2bb9('0xb')](socket);function respondWithRpcPromise(_0x28784d,_0x4bd165,_0x57b994){return new BPromise(function(_0x587657,_0x3edc69){return client[_0x2bb9('0xc')](_0x28784d,_0x57b994)[_0x2bb9('0xd')](function(_0x57a369){logger[_0x2bb9('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x4bd165,_0x2bb9('0xf'));logger[_0x2bb9('0x10')](_0x2bb9('0x11'),_0x4bd165,_0x2bb9('0xf'),JSON[_0x2bb9('0x12')](_0x57a369));if(_0x57a369[_0x2bb9('0x13')]){if(_0x57a369[_0x2bb9('0x13')][_0x2bb9('0x14')]===0x1f4){logger[_0x2bb9('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x4bd165,_0x57a369[_0x2bb9('0x13')]['message']);return _0x3edc69(_0x57a369[_0x2bb9('0x13')][_0x2bb9('0x15')]);}logger[_0x2bb9('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x4bd165,_0x57a369['error'][_0x2bb9('0x15')]);return _0x587657(_0x57a369[_0x2bb9('0x13')][_0x2bb9('0x15')]);}else{logger[_0x2bb9('0xe')](_0x2bb9('0x16'),_0x4bd165,_0x2bb9('0xf'));_0x587657(_0x57a369[_0x2bb9('0x17')][_0x2bb9('0x15')]);}})[_0x2bb9('0x18')](function(_0x590c6c){logger[_0x2bb9('0x13')](_0x2bb9('0x16'),_0x4bd165,_0x590c6c);_0x3edc69(_0x590c6c);});});}exports['CreateWhatsappMessage']=function(_0x3824b8){var _0x54b864=this;return new Promise(function(_0xfa295c,_0x1ae29a){return db[_0x2bb9('0x19')][_0x2bb9('0x1a')](_0x3824b8[_0x2bb9('0x1b')],{'raw':_0x3824b8[_0x2bb9('0x1c')]?_0x3824b8[_0x2bb9('0x1c')][_0x2bb9('0x1d')]===undefined?!![]:![]:!![]})[_0x2bb9('0xd')](function(_0x4414ef){logger[_0x2bb9('0xe')](_0x2bb9('0x1e'),_0x3824b8);logger['debug'](_0x2bb9('0x1e'),_0x3824b8,JSON[_0x2bb9('0x12')](_0x4414ef));_0xfa295c(_0x4414ef);})[_0x2bb9('0x18')](function(_0x135d1c){logger[_0x2bb9('0x13')](_0x2bb9('0x1e'),_0x135d1c['message'],_0x3824b8);_0x1ae29a(_0x54b864['error'](0x1f4,_0x135d1c[_0x2bb9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 062f5ef..0683110 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 _0x24e2=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x10bd3d,_0x478dfb){var _0x48d6fd=function(_0xdf597f){while(--_0xdf597f){_0x10bd3d['push'](_0x10bd3d['shift']());}};_0x48d6fd(++_0x478dfb);}(_0x24e2,0xae));var _0x224e=function(_0x3474fb,_0x491ee3){_0x3474fb=_0x3474fb-0x0;var _0x5061f5=_0x24e2[_0x3474fb];return _0x5061f5;};'use strict';var WhatsappMessageEvents=require(_0x224e('0x0'));var events=[_0x224e('0x1'),_0x224e('0x2'),_0x224e('0x3')];function createListener(_0x35e79d,_0x19f60f){return function(_0x4a2c1d){_0x19f60f[_0x224e('0x4')](_0x35e79d,_0x4a2c1d);};}function removeListener(_0x96cd4,_0x202f76){return function(){WhatsappMessageEvents[_0x224e('0x5')](_0x96cd4,_0x202f76);};}exports[_0x224e('0x6')]=function(_0xbe4be4){for(var _0x2f9c27=0x0,_0xe61f07=events[_0x224e('0x7')];_0x2f9c27<_0xe61f07;_0x2f9c27++){var _0x44861f=events[_0x2f9c27];var _0x4cf605=createListener(_0x224e('0x8')+_0x44861f,_0xbe4be4);WhatsappMessageEvents['on'](_0x44861f,_0x4cf605);}}; \ No newline at end of file +var _0x34a4=['emit','removeListener','register','length','save','remove','update'];(function(_0xa6e4c8,_0x52e242){var _0x29e0c8=function(_0x2caaf2){while(--_0x2caaf2){_0xa6e4c8['push'](_0xa6e4c8['shift']());}};_0x29e0c8(++_0x52e242);}(_0x34a4,0x162));var _0x434a=function(_0x5ca54b,_0x51cce0){_0x5ca54b=_0x5ca54b-0x0;var _0x48647b=_0x34a4[_0x5ca54b];return _0x48647b;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x434a('0x0'),_0x434a('0x1'),_0x434a('0x2')];function createListener(_0x32749a,_0x240484){return function(_0x580678){_0x240484[_0x434a('0x3')](_0x32749a,_0x580678);};}function removeListener(_0x440107,_0x12a285){return function(){WhatsappMessageEvents[_0x434a('0x4')](_0x440107,_0x12a285);};}exports[_0x434a('0x5')]=function(_0x4b6de4){for(var _0xa8797b=0x0,_0x3d19ba=events[_0x434a('0x6')];_0xa8797b<_0x3d19ba;_0xa8797b++){var _0x341a74=events[_0xa8797b];var _0x30215f=createListener('whatsappMessage:'+_0x341a74,_0x4b6de4);WhatsappMessageEvents['on'](_0x341a74,_0x30215f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 446a3be..385dc48 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 _0xb796=['/:id/teams','addTeams','update','delete','removeTeams','removeAgents','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post'];(function(_0xe30a3f,_0x2971c0){var _0x33b504=function(_0x35a6ff){while(--_0x35a6ff){_0xe30a3f['push'](_0xe30a3f['shift']());}};_0x33b504(++_0x2971c0);}(_0xb796,0xd2));var _0x6b79=function(_0x37d9dd,_0x924888){_0x37d9dd=_0x37d9dd-0x0;var _0x20983e=_0xb796[_0x37d9dd];return _0x20983e;};'use strict';var multer=require(_0x6b79('0x0'));var util=require(_0x6b79('0x1'));var path=require(_0x6b79('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6b79('0x3')]();var fs_extra=require(_0x6b79('0x4'));var auth=require(_0x6b79('0x5'));var interaction=require(_0x6b79('0x6'));var config=require(_0x6b79('0x7'));var controller=require(_0x6b79('0x8'));router[_0x6b79('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6b79('0x9')](_0x6b79('0xa'),auth[_0x6b79('0xb')](),controller[_0x6b79('0xc')]);router[_0x6b79('0x9')](_0x6b79('0xd'),auth[_0x6b79('0xb')](),controller[_0x6b79('0xe')]);router[_0x6b79('0x9')](_0x6b79('0xf'),auth[_0x6b79('0xb')](),controller[_0x6b79('0x10')]);router[_0x6b79('0x9')]('/:id/teams',auth[_0x6b79('0xb')](),controller[_0x6b79('0x11')]);router[_0x6b79('0x9')](_0x6b79('0x12'),auth['isAuthenticated'](),controller[_0x6b79('0x13')]);router['post']('/',auth[_0x6b79('0xb')](),controller[_0x6b79('0x14')]);router[_0x6b79('0x15')](_0x6b79('0x16'),auth[_0x6b79('0xb')](),controller[_0x6b79('0x17')]);router[_0x6b79('0x15')](_0x6b79('0x12'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x6b79('0xd'),auth['isAuthenticated'](),controller[_0x6b79('0x18')]);router[_0x6b79('0x19')](_0x6b79('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x6b79('0x19')](_0x6b79('0x16'),auth[_0x6b79('0xb')](),controller[_0x6b79('0x1a')]);router[_0x6b79('0x19')](_0x6b79('0x12'),auth[_0x6b79('0xb')](),controller[_0x6b79('0x1b')]);module[_0x6b79('0x1c')]=router; \ No newline at end of file +var _0x4f11=['create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post'];(function(_0x12939d,_0x24971d){var _0x38f9ab=function(_0x23a8d5){while(--_0x23a8d5){_0x12939d['push'](_0x12939d['shift']());}};_0x38f9ab(++_0x24971d);}(_0x4f11,0xcd));var _0x14f1=function(_0x2df76e,_0x1207c2){_0x2df76e=_0x2df76e-0x0;var _0x2a5d53=_0x4f11[_0x2df76e];return _0x2a5d53;};'use strict';var multer=require(_0x14f1('0x0'));var util=require(_0x14f1('0x1'));var path=require(_0x14f1('0x2'));var timeout=require(_0x14f1('0x3'));var express=require(_0x14f1('0x4'));var router=express['Router']();var fs_extra=require(_0x14f1('0x5'));var auth=require(_0x14f1('0x6'));var interaction=require(_0x14f1('0x7'));var config=require(_0x14f1('0x8'));var controller=require(_0x14f1('0x9'));router[_0x14f1('0xa')]('/',auth[_0x14f1('0xb')](),controller['index']);router[_0x14f1('0xa')]('/describe',auth[_0x14f1('0xb')](),controller[_0x14f1('0xc')]);router[_0x14f1('0xa')](_0x14f1('0xd'),auth[_0x14f1('0xb')](),controller[_0x14f1('0xe')]);router[_0x14f1('0xa')]('/:id/members',auth[_0x14f1('0xb')](),controller[_0x14f1('0xf')]);router[_0x14f1('0xa')](_0x14f1('0x10'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x14f1('0x11'),auth[_0x14f1('0xb')](),controller['getAgents']);router[_0x14f1('0x12')]('/',auth[_0x14f1('0xb')](),controller[_0x14f1('0x13')]);router[_0x14f1('0x12')](_0x14f1('0x10'),auth[_0x14f1('0xb')](),controller[_0x14f1('0x14')]);router[_0x14f1('0x12')](_0x14f1('0x11'),auth[_0x14f1('0xb')](),controller[_0x14f1('0x15')]);router[_0x14f1('0x16')](_0x14f1('0xd'),auth[_0x14f1('0xb')](),controller[_0x14f1('0x17')]);router[_0x14f1('0x18')](_0x14f1('0xd'),auth['isAuthenticated'](),controller[_0x14f1('0x19')]);router[_0x14f1('0x18')](_0x14f1('0x10'),auth[_0x14f1('0xb')](),controller[_0x14f1('0x1a')]);router[_0x14f1('0x18')](_0x14f1('0x11'),auth[_0x14f1('0xb')](),controller['removeAgents']);module[_0x14f1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 6465144..c6f060e 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 _0x7cda=['exports','STRING','name','ENUM','rrmemory','roundrobin'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7cda,0xf6));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xa7cd('0x0')]={'name':{'type':Sequelize[_0xa7cd('0x1')],'unique':_0xa7cd('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa7cd('0x3')](_0xa7cd('0x4'),'beepall',_0xa7cd('0x5'))},'description':{'type':Sequelize[_0xa7cd('0x1')]}}; \ No newline at end of file +var _0x16e4=['name','INTEGER','ENUM','beepall','sequelize','exports','STRING'];(function(_0x548383,_0x357ab4){var _0x581bfc=function(_0x49f59b){while(--_0x49f59b){_0x548383['push'](_0x548383['shift']());}};_0x581bfc(++_0x357ab4);}(_0x16e4,0x97));var _0x416e=function(_0x4d8e5a,_0x3fd957){_0x4d8e5a=_0x4d8e5a-0x0;var _0x64153f=_0x16e4[_0x4d8e5a];return _0x64153f;};'use strict';var Sequelize=require(_0x416e('0x0'));module[_0x416e('0x1')]={'name':{'type':Sequelize[_0x416e('0x2')],'unique':_0x416e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x416e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x416e('0x5')]('rrmemory',_0x416e('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x416e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 56b2018..c10b735 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 _0xaf02=['stack','name','index','WhatsappQueue','fieldName','type','model','map','query','keys','filters','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserWhatsappQueue','rawAttributes','hasOwnProperty','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','User','getAgents','eml-format','rimraf','zip-dir','moment','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','WhatsappQueues','UserProfileResource','end','error'];(function(_0x5356df,_0x518dc6){var _0x14e235=function(_0x9601cc){while(--_0x9601cc){_0x5356df['push'](_0x5356df['shift']());}};_0x14e235(++_0x518dc6);}(_0xaf02,0xe8));var _0x2af0=function(_0x12a0a3,_0x2652d1){_0x12a0a3=_0x12a0a3-0x0;var _0x1c47c4=_0xaf02[_0x12a0a3];return _0x1c47c4;};'use strict';var emlformat=require(_0x2af0('0x0'));var rimraf=require(_0x2af0('0x1'));var zipdir=require(_0x2af0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2af0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2af0('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2af0('0x5'));var csv=require(_0x2af0('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2af0('0x7'));var _=require(_0x2af0('0x8'));var squel=require(_0x2af0('0x9'));var crypto=require(_0x2af0('0xa'));var jsforce=require(_0x2af0('0xb'));var deskjs=require(_0x2af0('0xc'));var toCsv=require(_0x2af0('0x6'));var querystring=require('querystring');var Papa=require(_0x2af0('0xd'));var Redis=require(_0x2af0('0xe'));var authService=require(_0x2af0('0xf'));var qs=require(_0x2af0('0x10'));var as=require(_0x2af0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2af0('0x12'));var utils=require('../../config/utils');var config=require(_0x2af0('0x13'));var licenseUtil=require(_0x2af0('0x14'));var db=require('../../mysqldb')['db'];config[_0x2af0('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2af0('0x16'))(new Redis(config[_0x2af0('0x15')]));require(_0x2af0('0x17'))[_0x2af0('0x18')](socket);function respondWithStatusCode(_0x30fdf1,_0x1bfc93){_0x1bfc93=_0x1bfc93||0xcc;return function(_0x54822b){if(_0x54822b){return _0x30fdf1[_0x2af0('0x19')](_0x1bfc93);}return _0x30fdf1[_0x2af0('0x1a')](_0x1bfc93)['end']();};}function respondWithResult(_0x93c56,_0x8eb2f3){_0x8eb2f3=_0x8eb2f3||0xc8;return function(_0x40540d){if(_0x40540d){return _0x93c56['status'](_0x8eb2f3)[_0x2af0('0x1b')](_0x40540d);}};}function respondWithFilteredResult(_0x2766c2,_0xa692bc){return function(_0x349e39){if(_0x349e39){var _0x5a5b1a=typeof _0xa692bc[_0x2af0('0x1c')]==='undefined'&&typeof _0xa692bc[_0x2af0('0x1d')]==='undefined';var _0x125c7d=_0x349e39[_0x2af0('0x1e')];var _0x37a785=_0x5a5b1a?0x0:_0xa692bc[_0x2af0('0x1c')];var _0xdcf08a=_0x5a5b1a?_0x349e39[_0x2af0('0x1e')]:_0xa692bc[_0x2af0('0x1c')]+_0xa692bc[_0x2af0('0x1d')];var _0x13c836;if(_0xdcf08a>=_0x125c7d){_0xdcf08a=_0x125c7d;_0x13c836=0xc8;}else{_0x13c836=0xce;}_0x2766c2['status'](_0x13c836);return _0x2766c2[_0x2af0('0x1f')](_0x2af0('0x20'),_0x37a785+'-'+_0xdcf08a+'/'+_0x125c7d)[_0x2af0('0x1b')](_0x349e39);}return null;};}function patchUpdates(_0x33a6a2){return function(_0x1f8130){try{jsonpatch[_0x2af0('0x21')](_0x1f8130,_0x33a6a2,!![]);}catch(_0x946b27){return BPromise[_0x2af0('0x22')](_0x946b27);}return _0x1f8130[_0x2af0('0x23')]();};}function saveUpdates(_0x59a9ce,_0x4efcab){return function(_0x10b06f){if(_0x10b06f){return _0x10b06f[_0x2af0('0x24')](_0x59a9ce)['then'](function(_0x2e5591){return _0x2e5591;});}return null;};}function removeEntity(_0x30db34,_0x3524eb){return function(_0x2c4434){if(_0x2c4434){return _0x2c4434[_0x2af0('0x25')]()[_0x2af0('0x26')](function(){var _0x59ff4d=_0x2c4434[_0x2af0('0x27')]({'plain':!![]});var _0x47f0ef=_0x2af0('0x28');return db[_0x2af0('0x29')][_0x2af0('0x25')]({'where':{'type':_0x47f0ef,'resourceId':_0x59ff4d['id']}})['then'](function(){return _0x2c4434;});})[_0x2af0('0x26')](function(){_0x30db34[_0x2af0('0x1a')](0xcc)[_0x2af0('0x2a')]();});}};}function handleEntityNotFound(_0x4f132f,_0x4aaa38){return function(_0x4fdcf9){if(!_0x4fdcf9){_0x4f132f[_0x2af0('0x19')](0x194);}return _0x4fdcf9;};}function handleError(_0x3b1a3c,_0x2105f0){_0x2105f0=_0x2105f0||0x1f4;return function(_0x3aca4e){logger[_0x2af0('0x2b')](_0x3aca4e[_0x2af0('0x2c')]);if(_0x3aca4e[_0x2af0('0x2d')]){delete _0x3aca4e[_0x2af0('0x2d')];}_0x3b1a3c[_0x2af0('0x1a')](_0x2105f0)['send'](_0x3aca4e);};}exports[_0x2af0('0x2e')]=function(_0x260217,_0x4665c1){var _0x4d4ae9={},_0x571390={},_0x10a682={'count':0x0,'rows':[]};var _0x1f1f1e=_['map'](db[_0x2af0('0x2f')]['rawAttributes'],function(_0x33e200){return{'name':_0x33e200[_0x2af0('0x30')],'type':_0x33e200[_0x2af0('0x31')]['key']};});_0x571390[_0x2af0('0x32')]=_[_0x2af0('0x33')](_0x1f1f1e,'name');_0x571390[_0x2af0('0x34')]=_[_0x2af0('0x35')](_0x260217['query']);_0x571390[_0x2af0('0x36')]=_['intersection'](_0x571390['model'],_0x571390[_0x2af0('0x34')]);_0x4d4ae9[_0x2af0('0x37')]=_['intersection'](_0x571390['model'],qs[_0x2af0('0x38')](_0x260217[_0x2af0('0x34')][_0x2af0('0x38')]));_0x4d4ae9['attributes']=_0x4d4ae9[_0x2af0('0x37')]['length']?_0x4d4ae9[_0x2af0('0x37')]:_0x571390[_0x2af0('0x32')];if(!_0x260217[_0x2af0('0x34')]['hasOwnProperty'](_0x2af0('0x39'))){_0x4d4ae9[_0x2af0('0x1d')]=qs[_0x2af0('0x1d')](_0x260217[_0x2af0('0x34')][_0x2af0('0x1d')]);_0x4d4ae9[_0x2af0('0x1c')]=qs['offset'](_0x260217[_0x2af0('0x34')][_0x2af0('0x1c')]);}_0x4d4ae9[_0x2af0('0x3a')]=qs['sort'](_0x260217['query'][_0x2af0('0x3b')]);_0x4d4ae9[_0x2af0('0x3c')]=qs[_0x2af0('0x36')](_[_0x2af0('0x3d')](_0x260217[_0x2af0('0x34')],_0x571390[_0x2af0('0x36')]),_0x1f1f1e);if(_0x260217[_0x2af0('0x34')]['filter']){_0x4d4ae9[_0x2af0('0x3c')]=_[_0x2af0('0x3e')](_0x4d4ae9[_0x2af0('0x3c')],{'$or':_[_0x2af0('0x33')](_0x1f1f1e,function(_0x185f76){if(_0x185f76['type']!==_0x2af0('0x3f')){var _0x5e22e0={};_0x5e22e0[_0x185f76[_0x2af0('0x2d')]]={'$like':'%'+_0x260217[_0x2af0('0x34')][_0x2af0('0x40')]+'%'};return _0x5e22e0;}})});}_0x4d4ae9=_[_0x2af0('0x3e')]({},_0x4d4ae9,_0x260217[_0x2af0('0x41')]);var _0x45a8a8={'where':_0x4d4ae9[_0x2af0('0x3c')]};return db[_0x2af0('0x2f')][_0x2af0('0x1e')](_0x45a8a8)['then'](function(_0x520728){_0x10a682[_0x2af0('0x1e')]=_0x520728;if(_0x260217[_0x2af0('0x34')]['includeAll']){_0x4d4ae9['include']=[{'all':!![]}];}return db[_0x2af0('0x2f')][_0x2af0('0x42')](_0x4d4ae9);})[_0x2af0('0x26')](function(_0x9249e3){_0x10a682[_0x2af0('0x43')]=_0x9249e3;return _0x10a682;})[_0x2af0('0x26')](respondWithFilteredResult(_0x4665c1,_0x4d4ae9))[_0x2af0('0x44')](handleError(_0x4665c1,null));};exports[_0x2af0('0x45')]=function(_0x2d2f04,_0x5a44dd){var _0x2d545c={'raw':!![],'where':{'id':_0x2d2f04[_0x2af0('0x46')]['id']}},_0x324589={};_0x324589['model']=_[_0x2af0('0x35')](db['WhatsappQueue']['rawAttributes']);_0x324589[_0x2af0('0x34')]=_[_0x2af0('0x35')](_0x2d2f04[_0x2af0('0x34')]);_0x324589['filters']=_[_0x2af0('0x47')](_0x324589['model'],_0x324589[_0x2af0('0x34')]);_0x2d545c[_0x2af0('0x37')]=_[_0x2af0('0x47')](_0x324589[_0x2af0('0x32')],qs[_0x2af0('0x38')](_0x2d2f04[_0x2af0('0x34')][_0x2af0('0x38')]));_0x2d545c[_0x2af0('0x37')]=_0x2d545c['attributes'][_0x2af0('0x48')]?_0x2d545c[_0x2af0('0x37')]:_0x324589[_0x2af0('0x32')];if(_0x2d2f04[_0x2af0('0x34')][_0x2af0('0x49')]){_0x2d545c['include']=[{'all':!![]}];}_0x2d545c=_[_0x2af0('0x3e')]({},_0x2d545c,_0x2d2f04[_0x2af0('0x41')]);return db[_0x2af0('0x2f')][_0x2af0('0x4a')](_0x2d545c)[_0x2af0('0x26')](handleEntityNotFound(_0x5a44dd,null))[_0x2af0('0x26')](respondWithResult(_0x5a44dd,null))[_0x2af0('0x44')](handleError(_0x5a44dd,null));};exports[_0x2af0('0x4b')]=function(_0x2ad5f6,_0x2cef58){return db[_0x2af0('0x2f')]['create'](_0x2ad5f6['body'],{})[_0x2af0('0x26')](function(_0x167bc5){var _0x1ea882=_0x2ad5f6[_0x2af0('0x4c')][_0x2af0('0x27')]({'plain':!![]});if(!_0x1ea882)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ea882[_0x2af0('0x4d')]==='user'){var _0x1742d3=_0x167bc5[_0x2af0('0x27')]({'plain':!![]});var _0x8d6aa=_0x2af0('0x28');return db[_0x2af0('0x4e')][_0x2af0('0x4a')]({'where':{'name':_0x8d6aa,'userProfileId':_0x1ea882[_0x2af0('0x4f')]},'raw':!![]})['then'](function(_0x4c644c){if(_0x4c644c&&_0x4c644c['autoAssociation']===0x0){return db[_0x2af0('0x29')][_0x2af0('0x4b')]({'name':_0x1742d3[_0x2af0('0x2d')],'resourceId':_0x1742d3['id'],'type':_0x4c644c[_0x2af0('0x2d')],'sectionId':_0x4c644c['id']},{})[_0x2af0('0x26')](function(){return _0x167bc5;});}else{return _0x167bc5;}})[_0x2af0('0x44')](function(_0xe04499){logger[_0x2af0('0x2b')](_0x2af0('0x50'),_0xe04499);throw _0xe04499;});}return _0x167bc5;})[_0x2af0('0x26')](respondWithResult(_0x2cef58,0xc9))[_0x2af0('0x44')](handleError(_0x2cef58,null));};exports[_0x2af0('0x24')]=function(_0x5814b8,_0x60f636){if(_0x5814b8[_0x2af0('0x51')]['id']){delete _0x5814b8[_0x2af0('0x51')]['id'];}return db[_0x2af0('0x2f')][_0x2af0('0x4a')]({'where':{'id':_0x5814b8['params']['id']}})[_0x2af0('0x26')](handleEntityNotFound(_0x60f636,null))[_0x2af0('0x26')](saveUpdates(_0x5814b8['body'],null))[_0x2af0('0x26')](respondWithResult(_0x60f636,null))[_0x2af0('0x44')](handleError(_0x60f636,null));};exports['destroy']=function(_0x455f97,_0x12083d){return db[_0x2af0('0x2f')][_0x2af0('0x4a')]({'where':{'id':_0x455f97[_0x2af0('0x46')]['id']}})[_0x2af0('0x26')](handleEntityNotFound(_0x12083d,null))[_0x2af0('0x26')](removeEntity(_0x12083d,null))[_0x2af0('0x44')](handleError(_0x12083d,null));};exports[_0x2af0('0x52')]=function(_0x181be4,_0x5d96c1){return db[_0x2af0('0x2f')][_0x2af0('0x52')]()[_0x2af0('0x26')](respondWithResult(_0x5d96c1,null))[_0x2af0('0x44')](handleError(_0x5d96c1,null));};exports[_0x2af0('0x53')]=function(_0xd9499b,_0x5b32e9,_0x887d09){var _0x303584={'raw':!![],'where':{}},_0x8b331b={},_0xf53d45;return db[_0x2af0('0x2f')][_0x2af0('0x54')]({'where':{'id':_0xd9499b['params']['id']}})[_0x2af0('0x26')](handleEntityNotFound(_0x5b32e9,null))[_0x2af0('0x26')](function(_0x4d64df){if(_0x4d64df){_0xf53d45=_0x4d64df[_0x2af0('0x27')]({'plain':!![]});_0x8b331b[_0x2af0('0x32')]=_[_0x2af0('0x35')](db[_0x2af0('0x55')][_0x2af0('0x56')]);_0x8b331b[_0x2af0('0x34')]=_[_0x2af0('0x35')](_0xd9499b[_0x2af0('0x34')]);_0x8b331b[_0x2af0('0x36')]=_[_0x2af0('0x47')](_0x8b331b[_0x2af0('0x32')],_0x8b331b[_0x2af0('0x34')]);_0x303584[_0x2af0('0x37')]=_[_0x2af0('0x47')](_0x8b331b['model'],qs[_0x2af0('0x38')](_0xd9499b[_0x2af0('0x34')][_0x2af0('0x38')]));_0x303584[_0x2af0('0x37')]=_0x303584[_0x2af0('0x37')][_0x2af0('0x48')]?_0x303584['attributes']:_0x8b331b[_0x2af0('0x32')];if(!_0xd9499b[_0x2af0('0x34')][_0x2af0('0x57')](_0x2af0('0x39'))){_0x303584[_0x2af0('0x1d')]=qs[_0x2af0('0x1d')](_0xd9499b[_0x2af0('0x34')][_0x2af0('0x1d')]);_0x303584[_0x2af0('0x1c')]=qs[_0x2af0('0x1c')](_0xd9499b[_0x2af0('0x34')][_0x2af0('0x1c')]);}_0x303584[_0x2af0('0x3a')]=qs[_0x2af0('0x3b')](_0xd9499b[_0x2af0('0x34')][_0x2af0('0x3b')]);_0x303584[_0x2af0('0x3c')]=qs['filters'](_[_0x2af0('0x3d')](_0xd9499b[_0x2af0('0x34')],_0x8b331b[_0x2af0('0x36')]));_0x303584['where'][_0x2af0('0x58')]=_0x4d64df['id'];if(_0xd9499b[_0x2af0('0x34')][_0x2af0('0x40')]){_0x303584[_0x2af0('0x3c')]=_[_0x2af0('0x3e')](_0x303584[_0x2af0('0x3c')],{'$or':_[_0x2af0('0x33')](_0x303584[_0x2af0('0x37')],function(_0x395d50){var _0x59d65f={};_0x59d65f[_0x395d50]={'$like':'%'+_0xd9499b['query'][_0x2af0('0x40')]+'%'};return _0x59d65f;})});}_0x303584=_[_0x2af0('0x3e')]({},_0x303584,_0xd9499b['options']);return db[_0x2af0('0x55')][_0x2af0('0x42')](_0x303584);}})[_0x2af0('0x26')](function(_0x36644b){if(_0x36644b){return db['User'][_0x2af0('0x59')]({'where':{'id':_[_0x2af0('0x33')](_0x36644b,_0x2af0('0x5a')),'role':_0x2af0('0x5b')},'attributes':['id',_0x2af0('0x2d'),_0x2af0('0x5c'),_0x2af0('0x5d'),_0x2af0('0x5e')]});}})[_0x2af0('0x26')](function(_0x216dcb){if(_0x216dcb){return{'count':_0x216dcb['count'],'rows':_['map'](_0x216dcb[_0x2af0('0x43')],function(_0x38c50f){return{'membername':_0x38c50f[_0x2af0('0x2d')],'UserId':_0x38c50f['id'],'queue_name':_0xf53d45[_0x2af0('0x2d')],'WhatsappQueueId':_0xf53d45['id'],'interface':util[_0x2af0('0x5f')](_0x2af0('0x60'),_0x2af0('0x61'),_0x38c50f[_0x2af0('0x2d')]),'penalty':0x0,'paused':_0x38c50f[_0x2af0('0x5c')],'createdAt':_0x38c50f[_0x2af0('0x5e')],'updatedAt':_0x38c50f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2af0('0x26')](respondWithFilteredResult(_0x5b32e9,_0x303584))[_0x2af0('0x44')](handleError(_0x5b32e9,null));};exports[_0x2af0('0x62')]=function(_0x319aa5,_0x255540,_0x1585c6){var _0x2275e4={};var _0x43c347={};var _0x24e4ad;var _0x4c69cc;return db[_0x2af0('0x2f')][_0x2af0('0x54')]({'where':{'id':_0x319aa5['params']['id']}})['then'](handleEntityNotFound(_0x255540,null))[_0x2af0('0x26')](function(_0x176d56){if(_0x176d56){_0x24e4ad=_0x176d56;_0x43c347[_0x2af0('0x32')]=_[_0x2af0('0x35')](db[_0x2af0('0x63')]['rawAttributes']);_0x43c347[_0x2af0('0x34')]=_['keys'](_0x319aa5[_0x2af0('0x34')]);_0x43c347[_0x2af0('0x36')]=_['intersection'](_0x43c347[_0x2af0('0x32')],_0x43c347[_0x2af0('0x34')]);_0x2275e4['attributes']=_[_0x2af0('0x47')](_0x43c347['model'],qs[_0x2af0('0x38')](_0x319aa5[_0x2af0('0x34')][_0x2af0('0x38')]));_0x2275e4['attributes']=_0x2275e4[_0x2af0('0x37')][_0x2af0('0x48')]?_0x2275e4[_0x2af0('0x37')]:_0x43c347[_0x2af0('0x32')];_0x2275e4['order']=qs[_0x2af0('0x3b')](_0x319aa5[_0x2af0('0x34')][_0x2af0('0x3b')]);_0x2275e4['where']=qs[_0x2af0('0x36')](_[_0x2af0('0x3d')](_0x319aa5[_0x2af0('0x34')],_0x43c347[_0x2af0('0x36')]));if(_0x319aa5[_0x2af0('0x34')][_0x2af0('0x40')]){_0x2275e4['where']=_[_0x2af0('0x3e')](_0x2275e4[_0x2af0('0x3c')],{'$or':_[_0x2af0('0x33')](_0x2275e4[_0x2af0('0x37')],function(_0x116562){var _0x37a380={};_0x37a380[_0x116562]={'$like':'%'+_0x319aa5[_0x2af0('0x34')][_0x2af0('0x40')]+'%'};return _0x37a380;})});}_0x2275e4=_[_0x2af0('0x3e')]({},_0x2275e4,_0x319aa5['options']);return _0x24e4ad[_0x2af0('0x62')](_0x2275e4);}})[_0x2af0('0x26')](function(_0x11a62f){if(_0x11a62f){_0x4c69cc=_0x11a62f[_0x2af0('0x48')];if(!_0x319aa5[_0x2af0('0x34')][_0x2af0('0x57')](_0x2af0('0x39'))){_0x2275e4['limit']=qs[_0x2af0('0x1d')](_0x319aa5[_0x2af0('0x34')][_0x2af0('0x1d')]);_0x2275e4[_0x2af0('0x1c')]=qs['offset'](_0x319aa5['query'][_0x2af0('0x1c')]);}return _0x24e4ad[_0x2af0('0x62')](_0x2275e4);}})[_0x2af0('0x26')](function(_0x57cff4){if(_0x57cff4){return _0x57cff4?{'count':_0x4c69cc,'rows':_0x57cff4}:null;}})[_0x2af0('0x26')](respondWithResult(_0x255540,null))[_0x2af0('0x44')](handleError(_0x255540,null));};exports[_0x2af0('0x64')]=function(_0x35e7f7,_0x24ca2e,_0x62c5cb){var _0x4ca2c5=_0x35e7f7[_0x2af0('0x51')][_0x2af0('0x65')];return db[_0x2af0('0x63')][_0x2af0('0x42')]({'where':{'id':_0x4ca2c5},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x2af0('0x2d'),_0x2af0('0x66'),_0x2af0('0x67'),_0x2af0('0x68')],'raw':!![]}]})['then'](function(_0x457882){if(_0x457882){var _0x4ff8c8=_[_0x2af0('0x69')](_0x457882,function(_0xb10da3){var _0x1c8f3f=_0xb10da3[_0x2af0('0x27')]({'plain':!![]});return _0x1c8f3f[_0x2af0('0x6a')];});return db['WhatsappQueue']['find']({'where':{'id':_0x35e7f7['params']['id']}})[_0x2af0('0x26')](function(_0x554e6f){return db[_0x2af0('0x6b')][_0x2af0('0x6c')](function(_0x3dc249){return _0x554e6f['addTeams'](_0x4ca2c5,{'transaction':_0x3dc249})[_0x2af0('0x26')](function(){return BPromise[_0x2af0('0x6d')](_0x4ff8c8,function(_0x23a78c){return db[_0x2af0('0x55')][_0x2af0('0x6e')]({'where':{'UserId':_0x23a78c['id'],'WhatsappQueueId':_0x35e7f7[_0x2af0('0x46')]['id']},'transaction':_0x3dc249});});})['then'](function(){_0x4ff8c8[_0x2af0('0x6f')](function(_0x1f96cb){socket[_0x2af0('0x70')](_0x2af0('0x71'),{'UserId':_0x1f96cb['id'],'WhatsappQueueId':_0x554e6f['id']});});});});});}})[_0x2af0('0x26')](respondWithStatusCode(_0x24ca2e,null))['catch'](handleError(_0x24ca2e,null));};exports['removeTeams']=function(_0x4fd484,_0x45d64a,_0x5d23eb){return db[_0x2af0('0x63')][_0x2af0('0x42')]({'where':{'id':_0x4fd484['query'][_0x2af0('0x65')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2af0('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x2af0('0x26')](handleEntityNotFound(_0x45d64a,null))[_0x2af0('0x26')](function(_0x6cae41){var _0x20a5ad=_[_0x2af0('0x33')](_0x6cae41,'id');var _0x3d6236=[];var _0xe1667a=[];var _0xf7053f=squel['select']();_0xf7053f['field']('tq.TeamId')[_0x2af0('0x72')](_0x2af0('0x73'),'tq')[_0x2af0('0x74')]('user_has_teams','ut',_0x2af0('0x75'))[_0x2af0('0x3c')]('WhatsappQueueId\x20=\x20?',_0x4fd484[_0x2af0('0x46')]['id']);for(var _0x35b7a9=0x0;_0x35b7a9<_0x6cae41[_0x2af0('0x48')];_0x35b7a9+=0x1){let _0x235d97=_0x6cae41[_0x35b7a9];for(var _0x423bd4=0x0;_0x423bd4<_0x235d97[_0x2af0('0x6a')][_0x2af0('0x48')];_0x423bd4+=0x1){let _0x435aa0=_0x235d97[_0x2af0('0x6a')][_0x423bd4];var _0x41ab49=_0xf7053f[_0x2af0('0x76')]();_0x41ab49['where']('ut.UserId\x20=\x20?',_0x435aa0['id']);_0xe1667a[_0x2af0('0x77')](db['sequelize'][_0x2af0('0x34')](_0x41ab49[_0x2af0('0x78')](),{'type':db[_0x2af0('0x6b')][_0x2af0('0x79')][_0x2af0('0x7a')]})[_0x2af0('0x26')](function(_0x5796d0){if(_0x5796d0[_0x2af0('0x48')]===0x1){return _0x435aa0['id'];}else{var _0xe91ad6=_[_0x2af0('0x7b')](_[_0x2af0('0x33')](_0x5796d0,_0x2af0('0x7c')),function(_0x672ffd){return _[_0x2af0('0x7d')](_0x20a5ad,_0x672ffd);});if(_0xe91ad6){return _0x435aa0['id'];}}}));}}return BPromise['all'](_0xe1667a)[_0x2af0('0x26')](function(_0x35c429){_0x3d6236=_(_0x3d6236)[_0x2af0('0x7e')](_0x35c429)[_0x2af0('0x7f')]()[_0x2af0('0x80')]();return db[_0x2af0('0x2f')][_0x2af0('0x4a')]({'where':{'id':_0x4fd484[_0x2af0('0x46')]['id']}})['then'](function(_0x171f1b){return db[_0x2af0('0x6b')][_0x2af0('0x6c')](function(_0x18953b){return _0x171f1b[_0x2af0('0x81')](_0x4fd484[_0x2af0('0x34')][_0x2af0('0x65')],{'transaction':_0x18953b})[_0x2af0('0x26')](function(){if(!_['isEmpty'](_0x3d6236)){return _0x171f1b[_0x2af0('0x82')](_0x3d6236,{'transaction':_0x18953b});}})['then'](function(){_0x3d6236[_0x2af0('0x6f')](function(_0x203688){socket[_0x2af0('0x70')](_0x2af0('0x83'),{'UserId':_0x203688,'WhatsappQueueId':_0x171f1b['id']});});});});});});})[_0x2af0('0x26')](respondWithStatusCode(_0x45d64a,null))['catch'](handleError(_0x45d64a,null));};exports[_0x2af0('0x84')]=function(_0x3666cf,_0x336e07,_0x349396){return db[_0x2af0('0x2f')]['find']({'where':{'id':_0x3666cf['params']['id']}})[_0x2af0('0x26')](handleEntityNotFound(_0x336e07,null))[_0x2af0('0x26')](function(_0x2cfb3f){if(_0x2cfb3f){return _0x2cfb3f[_0x2af0('0x84')](_0x3666cf['body'][_0x2af0('0x65')],_[_0x2af0('0x85')](_0x3666cf['body'],[_0x2af0('0x65'),'id'])||{})[_0x2af0('0x86')](function(_0x406d1c){for(var _0x13b1a2=0x0;_0x13b1a2<_0x3666cf[_0x2af0('0x51')][_0x2af0('0x65')]['length'];_0x13b1a2+=0x1){socket[_0x2af0('0x70')](_0x2af0('0x71'),{'UserId':Number(_0x3666cf[_0x2af0('0x51')][_0x2af0('0x65')][_0x13b1a2]),'WhatsappQueueId':Number(_0x3666cf['params']['id'])});}return _0x406d1c;});}})[_0x2af0('0x26')](respondWithResult(_0x336e07,null))['catch'](handleError(_0x336e07,null));};exports['removeAgents']=function(_0x38bb60,_0x23ae4a,_0x3d4635){return db[_0x2af0('0x2f')][_0x2af0('0x4a')]({'where':{'id':_0x38bb60[_0x2af0('0x46')]['id']}})[_0x2af0('0x26')](handleEntityNotFound(_0x23ae4a,null))[_0x2af0('0x26')](function(_0xe5c038){if(_0xe5c038){return _0xe5c038['removeAgents'](_0x38bb60[_0x2af0('0x34')][_0x2af0('0x65')])[_0x2af0('0x26')](function(){if(_[_0x2af0('0x87')](_0x38bb60[_0x2af0('0x34')]['ids'])){for(var _0x1c0612=0x0;_0x1c0612<_0x38bb60[_0x2af0('0x34')][_0x2af0('0x65')]['length'];_0x1c0612+=0x1){socket[_0x2af0('0x70')](_0x2af0('0x83'),{'UserId':Number(_0x38bb60['query']['ids'][_0x1c0612]),'WhatsappQueueId':Number(_0x38bb60[_0x2af0('0x46')]['id'])});}}else{socket[_0x2af0('0x70')](_0x2af0('0x83'),{'UserId':Number(_0x38bb60[_0x2af0('0x34')][_0x2af0('0x65')]),'WhatsappQueueId':Number(_0x38bb60[_0x2af0('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x23ae4a,null))[_0x2af0('0x44')](handleError(_0x23ae4a,null));};exports['getAgents']=function(_0x7d9943,_0x31046e,_0x3c5e13){var _0x453c99={};var _0xbfc575={};var _0x1ce740;var _0xb8d72a;return db[_0x2af0('0x2f')][_0x2af0('0x54')]({'where':{'id':_0x7d9943[_0x2af0('0x46')]['id']}})[_0x2af0('0x26')](handleEntityNotFound(_0x31046e,null))[_0x2af0('0x26')](function(_0xaee409){if(_0xaee409){_0x1ce740=_0xaee409;_0xbfc575[_0x2af0('0x32')]=_[_0x2af0('0x35')](db[_0x2af0('0x88')][_0x2af0('0x56')]);_0xbfc575[_0x2af0('0x34')]=_['keys'](_0x7d9943[_0x2af0('0x34')]);_0xbfc575[_0x2af0('0x36')]=_['intersection'](_0xbfc575[_0x2af0('0x32')],_0xbfc575['query']);_0x453c99[_0x2af0('0x37')]=_[_0x2af0('0x47')](_0xbfc575['model'],qs[_0x2af0('0x38')](_0x7d9943[_0x2af0('0x34')][_0x2af0('0x38')]));_0x453c99['attributes']=_0x453c99[_0x2af0('0x37')][_0x2af0('0x48')]?_0x453c99[_0x2af0('0x37')]:_0xbfc575['model'];_0x453c99['order']=qs['sort'](_0x7d9943[_0x2af0('0x34')][_0x2af0('0x3b')]);_0x453c99[_0x2af0('0x3c')]=qs[_0x2af0('0x36')](_[_0x2af0('0x3d')](_0x7d9943[_0x2af0('0x34')],_0xbfc575[_0x2af0('0x36')]));if(_0x7d9943[_0x2af0('0x34')][_0x2af0('0x40')]){_0x453c99['where']=_[_0x2af0('0x3e')](_0x453c99['where'],{'$or':_['map'](_0x453c99[_0x2af0('0x37')],function(_0x2d7ad7){var _0x2d6129={};_0x2d6129[_0x2d7ad7]={'$like':'%'+_0x7d9943[_0x2af0('0x34')][_0x2af0('0x40')]+'%'};return _0x2d6129;})});}_0x453c99=_[_0x2af0('0x3e')]({},_0x453c99,_0x7d9943[_0x2af0('0x41')]);return _0x1ce740['getAgents'](_0x453c99);}})[_0x2af0('0x26')](function(_0x1f0262){if(_0x1f0262){_0xb8d72a=_0x1f0262[_0x2af0('0x48')];if(!_0x7d9943[_0x2af0('0x34')][_0x2af0('0x57')](_0x2af0('0x39'))){_0x453c99[_0x2af0('0x1d')]=qs[_0x2af0('0x1d')](_0x7d9943[_0x2af0('0x34')][_0x2af0('0x1d')]);_0x453c99['offset']=qs[_0x2af0('0x1c')](_0x7d9943['query'][_0x2af0('0x1c')]);}return _0x1ce740[_0x2af0('0x89')](_0x453c99);}})[_0x2af0('0x26')](function(_0x4c607e){if(_0x4c607e){return _0x4c607e?{'count':_0xb8d72a,'rows':_0x4c607e}:null;}})[_0x2af0('0x26')](respondWithResult(_0x31046e,null))[_0x2af0('0x44')](handleError(_0x31046e,null));}; \ No newline at end of file +var _0x3eb9=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','order','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','ids','omit','spread','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','name','send','map','WhatsappQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3eb9,0xe3));var _0x93eb=function(_0x231b2e,_0x2a33f9){_0x231b2e=_0x231b2e-0x0;var _0x3feb2a=_0x3eb9[_0x231b2e];return _0x3feb2a;};'use strict';var emlformat=require(_0x93eb('0x0'));var rimraf=require(_0x93eb('0x1'));var zipdir=require(_0x93eb('0x2'));var jsonpatch=require(_0x93eb('0x3'));var rp=require(_0x93eb('0x4'));var moment=require(_0x93eb('0x5'));var BPromise=require(_0x93eb('0x6'));var Mustache=require('mustache');var util=require(_0x93eb('0x7'));var path=require(_0x93eb('0x8'));var sox=require(_0x93eb('0x9'));var csv=require(_0x93eb('0xa'));var ejs=require(_0x93eb('0xb'));var fs=require('fs');var fs_extra=require(_0x93eb('0xc'));var _=require(_0x93eb('0xd'));var squel=require(_0x93eb('0xe'));var crypto=require(_0x93eb('0xf'));var jsforce=require(_0x93eb('0x10'));var deskjs=require(_0x93eb('0x11'));var toCsv=require(_0x93eb('0xa'));var querystring=require(_0x93eb('0x12'));var Papa=require(_0x93eb('0x13'));var Redis=require(_0x93eb('0x14'));var authService=require(_0x93eb('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x93eb('0x16'));var hardwareService=require(_0x93eb('0x17'));var logger=require(_0x93eb('0x18'))(_0x93eb('0x19'));var utils=require(_0x93eb('0x1a'));var config=require(_0x93eb('0x1b'));var licenseUtil=require(_0x93eb('0x1c'));var db=require(_0x93eb('0x1d'))['db'];config[_0x93eb('0x1e')]=_['defaults'](config['redis'],{'host':_0x93eb('0x1f'),'port':0x18eb});var socket=require(_0x93eb('0x20'))(new Redis(config['redis']));require(_0x93eb('0x21'))[_0x93eb('0x22')](socket);function respondWithStatusCode(_0x40ea29,_0x15fa9e){_0x15fa9e=_0x15fa9e||0xcc;return function(_0x5406ac){if(_0x5406ac){return _0x40ea29['sendStatus'](_0x15fa9e);}return _0x40ea29[_0x93eb('0x23')](_0x15fa9e)[_0x93eb('0x24')]();};}function respondWithResult(_0x473c07,_0x5b614c){_0x5b614c=_0x5b614c||0xc8;return function(_0x9a4ece){if(_0x9a4ece){return _0x473c07[_0x93eb('0x23')](_0x5b614c)['json'](_0x9a4ece);}};}function respondWithFilteredResult(_0x226231,_0x338156){return function(_0x4980d0){if(_0x4980d0){var _0x3cc05a=typeof _0x338156[_0x93eb('0x25')]===_0x93eb('0x26')&&typeof _0x338156[_0x93eb('0x27')]===_0x93eb('0x26');var _0x12b322=_0x4980d0[_0x93eb('0x28')];var _0x2d1b28=_0x3cc05a?0x0:_0x338156[_0x93eb('0x25')];var _0x496566=_0x3cc05a?_0x4980d0[_0x93eb('0x28')]:_0x338156[_0x93eb('0x25')]+_0x338156['limit'];var _0x353fc4;if(_0x496566>=_0x12b322){_0x496566=_0x12b322;_0x353fc4=0xc8;}else{_0x353fc4=0xce;}_0x226231['status'](_0x353fc4);return _0x226231[_0x93eb('0x29')](_0x93eb('0x2a'),_0x2d1b28+'-'+_0x496566+'/'+_0x12b322)['json'](_0x4980d0);}return null;};}function patchUpdates(_0x3eec09){return function(_0x54031a){try{jsonpatch[_0x93eb('0x2b')](_0x54031a,_0x3eec09,!![]);}catch(_0x2eb6b4){return BPromise[_0x93eb('0x2c')](_0x2eb6b4);}return _0x54031a['save']();};}function saveUpdates(_0x33fad8,_0x3016d6){return function(_0x10de75){if(_0x10de75){return _0x10de75[_0x93eb('0x2d')](_0x33fad8)[_0x93eb('0x2e')](function(_0x4b6b68){return _0x4b6b68;});}return null;};}function removeEntity(_0x4e831d,_0x104129){return function(_0x18a5ae){if(_0x18a5ae){return _0x18a5ae[_0x93eb('0x2f')]()[_0x93eb('0x2e')](function(){var _0x14840e=_0x18a5ae[_0x93eb('0x30')]({'plain':!![]});var _0x72cdb8=_0x93eb('0x31');return db[_0x93eb('0x32')][_0x93eb('0x2f')]({'where':{'type':_0x72cdb8,'resourceId':_0x14840e['id']}})['then'](function(){return _0x18a5ae;});})[_0x93eb('0x2e')](function(){_0x4e831d[_0x93eb('0x23')](0xcc)[_0x93eb('0x24')]();});}};}function handleEntityNotFound(_0x42a7b0,_0x58d850){return function(_0x37c551){if(!_0x37c551){_0x42a7b0['sendStatus'](0x194);}return _0x37c551;};}function handleError(_0x54443a,_0x4d35c4){_0x4d35c4=_0x4d35c4||0x1f4;return function(_0x25a217){logger[_0x93eb('0x33')](_0x25a217['stack']);if(_0x25a217[_0x93eb('0x34')]){delete _0x25a217[_0x93eb('0x34')];}_0x54443a['status'](_0x4d35c4)[_0x93eb('0x35')](_0x25a217);};}exports['index']=function(_0x2b0ca6,_0x34b5dd){var _0xe6ac5d={},_0x118c12={},_0x26971a={'count':0x0,'rows':[]};var _0x363735=_[_0x93eb('0x36')](db[_0x93eb('0x37')][_0x93eb('0x38')],function(_0x1bb117){return{'name':_0x1bb117['fieldName'],'type':_0x1bb117[_0x93eb('0x39')][_0x93eb('0x3a')]};});_0x118c12[_0x93eb('0x3b')]=_[_0x93eb('0x36')](_0x363735,'name');_0x118c12[_0x93eb('0x3c')]=_[_0x93eb('0x3d')](_0x2b0ca6['query']);_0x118c12[_0x93eb('0x3e')]=_[_0x93eb('0x3f')](_0x118c12[_0x93eb('0x3b')],_0x118c12[_0x93eb('0x3c')]);_0xe6ac5d[_0x93eb('0x40')]=_['intersection'](_0x118c12['model'],qs[_0x93eb('0x41')](_0x2b0ca6[_0x93eb('0x3c')]['fields']));_0xe6ac5d[_0x93eb('0x40')]=_0xe6ac5d[_0x93eb('0x40')][_0x93eb('0x42')]?_0xe6ac5d[_0x93eb('0x40')]:_0x118c12['model'];if(!_0x2b0ca6[_0x93eb('0x3c')][_0x93eb('0x43')](_0x93eb('0x44'))){_0xe6ac5d['limit']=qs[_0x93eb('0x27')](_0x2b0ca6[_0x93eb('0x3c')][_0x93eb('0x27')]);_0xe6ac5d[_0x93eb('0x25')]=qs[_0x93eb('0x25')](_0x2b0ca6[_0x93eb('0x3c')][_0x93eb('0x25')]);}_0xe6ac5d['order']=qs[_0x93eb('0x45')](_0x2b0ca6['query'][_0x93eb('0x45')]);_0xe6ac5d[_0x93eb('0x46')]=qs[_0x93eb('0x3e')](_[_0x93eb('0x47')](_0x2b0ca6[_0x93eb('0x3c')],_0x118c12['filters']),_0x363735);if(_0x2b0ca6[_0x93eb('0x3c')][_0x93eb('0x48')]){_0xe6ac5d['where']=_[_0x93eb('0x49')](_0xe6ac5d[_0x93eb('0x46')],{'$or':_['map'](_0x363735,function(_0x435e0b){if(_0x435e0b['type']!==_0x93eb('0x4a')){var _0x11ee4b={};_0x11ee4b[_0x435e0b['name']]={'$like':'%'+_0x2b0ca6['query']['filter']+'%'};return _0x11ee4b;}})});}_0xe6ac5d=_[_0x93eb('0x49')]({},_0xe6ac5d,_0x2b0ca6['options']);var _0x4000ca={'where':_0xe6ac5d[_0x93eb('0x46')]};return db[_0x93eb('0x37')][_0x93eb('0x28')](_0x4000ca)['then'](function(_0x56ff3f){_0x26971a[_0x93eb('0x28')]=_0x56ff3f;if(_0x2b0ca6[_0x93eb('0x3c')][_0x93eb('0x4b')]){_0xe6ac5d[_0x93eb('0x4c')]=[{'all':!![]}];}return db[_0x93eb('0x37')]['findAll'](_0xe6ac5d);})['then'](function(_0x366af7){_0x26971a[_0x93eb('0x4d')]=_0x366af7;return _0x26971a;})[_0x93eb('0x2e')](respondWithFilteredResult(_0x34b5dd,_0xe6ac5d))[_0x93eb('0x4e')](handleError(_0x34b5dd,null));};exports[_0x93eb('0x4f')]=function(_0x391ed2,_0x5141a3){var _0x2b59d4={'raw':!![],'where':{'id':_0x391ed2[_0x93eb('0x50')]['id']}},_0x515ee3={};_0x515ee3[_0x93eb('0x3b')]=_['keys'](db[_0x93eb('0x37')][_0x93eb('0x38')]);_0x515ee3['query']=_[_0x93eb('0x3d')](_0x391ed2[_0x93eb('0x3c')]);_0x515ee3[_0x93eb('0x3e')]=_['intersection'](_0x515ee3[_0x93eb('0x3b')],_0x515ee3[_0x93eb('0x3c')]);_0x2b59d4[_0x93eb('0x40')]=_['intersection'](_0x515ee3['model'],qs[_0x93eb('0x41')](_0x391ed2[_0x93eb('0x3c')][_0x93eb('0x41')]));_0x2b59d4[_0x93eb('0x40')]=_0x2b59d4['attributes'][_0x93eb('0x42')]?_0x2b59d4[_0x93eb('0x40')]:_0x515ee3[_0x93eb('0x3b')];if(_0x391ed2[_0x93eb('0x3c')][_0x93eb('0x4b')]){_0x2b59d4[_0x93eb('0x4c')]=[{'all':!![]}];}_0x2b59d4=_[_0x93eb('0x49')]({},_0x2b59d4,_0x391ed2[_0x93eb('0x51')]);return db[_0x93eb('0x37')][_0x93eb('0x52')](_0x2b59d4)[_0x93eb('0x2e')](handleEntityNotFound(_0x5141a3,null))[_0x93eb('0x2e')](respondWithResult(_0x5141a3,null))[_0x93eb('0x4e')](handleError(_0x5141a3,null));};exports[_0x93eb('0x53')]=function(_0x3457ef,_0x5bf88b){return db[_0x93eb('0x37')][_0x93eb('0x53')](_0x3457ef[_0x93eb('0x54')],{})[_0x93eb('0x2e')](function(_0x3540f2){var _0x12485f=_0x3457ef['user'][_0x93eb('0x30')]({'plain':!![]});if(!_0x12485f)throw new Error(_0x93eb('0x55'));if(_0x12485f[_0x93eb('0x56')]==='user'){var _0x31eaad=_0x3540f2['get']({'plain':!![]});var _0x547f60='WhatsappQueues';return db[_0x93eb('0x57')]['find']({'where':{'name':_0x547f60,'userProfileId':_0x12485f[_0x93eb('0x58')]},'raw':!![]})[_0x93eb('0x2e')](function(_0x390096){if(_0x390096&&_0x390096[_0x93eb('0x59')]===0x0){return db[_0x93eb('0x32')]['create']({'name':_0x31eaad[_0x93eb('0x34')],'resourceId':_0x31eaad['id'],'type':_0x390096[_0x93eb('0x34')],'sectionId':_0x390096['id']},{})['then'](function(){return _0x3540f2;});}else{return _0x3540f2;}})[_0x93eb('0x4e')](function(_0x1d364e){logger['error'](_0x93eb('0x5a'),_0x1d364e);throw _0x1d364e;});}return _0x3540f2;})[_0x93eb('0x2e')](respondWithResult(_0x5bf88b,0xc9))[_0x93eb('0x4e')](handleError(_0x5bf88b,null));};exports['update']=function(_0x5db328,_0x28e7ae){if(_0x5db328[_0x93eb('0x54')]['id']){delete _0x5db328[_0x93eb('0x54')]['id'];}return db[_0x93eb('0x37')][_0x93eb('0x52')]({'where':{'id':_0x5db328[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0x28e7ae,null))[_0x93eb('0x2e')](saveUpdates(_0x5db328['body'],null))[_0x93eb('0x2e')](respondWithResult(_0x28e7ae,null))['catch'](handleError(_0x28e7ae,null));};exports[_0x93eb('0x2f')]=function(_0x2dccfe,_0x37afc1){return db[_0x93eb('0x37')][_0x93eb('0x52')]({'where':{'id':_0x2dccfe[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0x37afc1,null))[_0x93eb('0x2e')](removeEntity(_0x37afc1,null))[_0x93eb('0x4e')](handleError(_0x37afc1,null));};exports[_0x93eb('0x5b')]=function(_0x18ff22,_0x47409e){return db[_0x93eb('0x37')][_0x93eb('0x5b')]()[_0x93eb('0x2e')](respondWithResult(_0x47409e,null))[_0x93eb('0x4e')](handleError(_0x47409e,null));};exports[_0x93eb('0x5c')]=function(_0xe7562c,_0x2869c5,_0x11de97){var _0x128233={'raw':!![],'where':{}},_0x4bf2c2={},_0x3f5316;return db[_0x93eb('0x37')][_0x93eb('0x5d')]({'where':{'id':_0xe7562c[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0x2869c5,null))[_0x93eb('0x2e')](function(_0x23bc24){if(_0x23bc24){_0x3f5316=_0x23bc24[_0x93eb('0x30')]({'plain':!![]});_0x4bf2c2[_0x93eb('0x3b')]=_[_0x93eb('0x3d')](db[_0x93eb('0x5e')]['rawAttributes']);_0x4bf2c2[_0x93eb('0x3c')]=_[_0x93eb('0x3d')](_0xe7562c[_0x93eb('0x3c')]);_0x4bf2c2['filters']=_[_0x93eb('0x3f')](_0x4bf2c2['model'],_0x4bf2c2[_0x93eb('0x3c')]);_0x128233[_0x93eb('0x40')]=_[_0x93eb('0x3f')](_0x4bf2c2[_0x93eb('0x3b')],qs[_0x93eb('0x41')](_0xe7562c[_0x93eb('0x3c')]['fields']));_0x128233[_0x93eb('0x40')]=_0x128233['attributes'][_0x93eb('0x42')]?_0x128233[_0x93eb('0x40')]:_0x4bf2c2[_0x93eb('0x3b')];if(!_0xe7562c[_0x93eb('0x3c')][_0x93eb('0x43')](_0x93eb('0x44'))){_0x128233[_0x93eb('0x27')]=qs[_0x93eb('0x27')](_0xe7562c['query']['limit']);_0x128233['offset']=qs['offset'](_0xe7562c[_0x93eb('0x3c')][_0x93eb('0x25')]);}_0x128233[_0x93eb('0x5f')]=qs[_0x93eb('0x45')](_0xe7562c[_0x93eb('0x3c')][_0x93eb('0x45')]);_0x128233['where']=qs[_0x93eb('0x3e')](_[_0x93eb('0x47')](_0xe7562c[_0x93eb('0x3c')],_0x4bf2c2[_0x93eb('0x3e')]));_0x128233['where'][_0x93eb('0x60')]=_0x23bc24['id'];if(_0xe7562c[_0x93eb('0x3c')][_0x93eb('0x48')]){_0x128233[_0x93eb('0x46')]=_[_0x93eb('0x49')](_0x128233[_0x93eb('0x46')],{'$or':_[_0x93eb('0x36')](_0x128233[_0x93eb('0x40')],function(_0xb98deb){var _0xf0c0e9={};_0xf0c0e9[_0xb98deb]={'$like':'%'+_0xe7562c[_0x93eb('0x3c')][_0x93eb('0x48')]+'%'};return _0xf0c0e9;})});}_0x128233=_['merge']({},_0x128233,_0xe7562c[_0x93eb('0x51')]);return db[_0x93eb('0x5e')][_0x93eb('0x61')](_0x128233);}})[_0x93eb('0x2e')](function(_0x3f4b98){if(_0x3f4b98){return db[_0x93eb('0x62')][_0x93eb('0x63')]({'where':{'id':_[_0x93eb('0x36')](_0x3f4b98,_0x93eb('0x64')),'role':_0x93eb('0x65')},'attributes':['id',_0x93eb('0x34'),_0x93eb('0x66'),_0x93eb('0x67'),_0x93eb('0x68')]});}})[_0x93eb('0x2e')](function(_0x166c37){if(_0x166c37){return{'count':_0x166c37[_0x93eb('0x28')],'rows':_[_0x93eb('0x36')](_0x166c37[_0x93eb('0x4d')],function(_0x52b20f){return{'membername':_0x52b20f[_0x93eb('0x34')],'UserId':_0x52b20f['id'],'queue_name':_0x3f5316[_0x93eb('0x34')],'WhatsappQueueId':_0x3f5316['id'],'interface':util['format'](_0x93eb('0x69'),_0x93eb('0x6a'),_0x52b20f['name']),'penalty':0x0,'paused':_0x52b20f[_0x93eb('0x66')],'createdAt':_0x52b20f[_0x93eb('0x68')],'updatedAt':_0x52b20f[_0x93eb('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2869c5,_0x128233))[_0x93eb('0x4e')](handleError(_0x2869c5,null));};exports[_0x93eb('0x6b')]=function(_0x1e5e75,_0x2686a2,_0x3cf99b){var _0x11ff84={};var _0x261d48={};var _0x35015d;var _0x578d43;return db[_0x93eb('0x37')][_0x93eb('0x5d')]({'where':{'id':_0x1e5e75[_0x93eb('0x50')]['id']}})['then'](handleEntityNotFound(_0x2686a2,null))[_0x93eb('0x2e')](function(_0x463506){if(_0x463506){_0x35015d=_0x463506;_0x261d48['model']=_[_0x93eb('0x3d')](db[_0x93eb('0x6c')][_0x93eb('0x38')]);_0x261d48[_0x93eb('0x3c')]=_[_0x93eb('0x3d')](_0x1e5e75[_0x93eb('0x3c')]);_0x261d48[_0x93eb('0x3e')]=_['intersection'](_0x261d48[_0x93eb('0x3b')],_0x261d48[_0x93eb('0x3c')]);_0x11ff84['attributes']=_[_0x93eb('0x3f')](_0x261d48[_0x93eb('0x3b')],qs[_0x93eb('0x41')](_0x1e5e75[_0x93eb('0x3c')][_0x93eb('0x41')]));_0x11ff84[_0x93eb('0x40')]=_0x11ff84['attributes'][_0x93eb('0x42')]?_0x11ff84['attributes']:_0x261d48['model'];_0x11ff84[_0x93eb('0x5f')]=qs[_0x93eb('0x45')](_0x1e5e75['query'][_0x93eb('0x45')]);_0x11ff84[_0x93eb('0x46')]=qs[_0x93eb('0x3e')](_[_0x93eb('0x47')](_0x1e5e75[_0x93eb('0x3c')],_0x261d48[_0x93eb('0x3e')]));if(_0x1e5e75[_0x93eb('0x3c')]['filter']){_0x11ff84[_0x93eb('0x46')]=_[_0x93eb('0x49')](_0x11ff84[_0x93eb('0x46')],{'$or':_['map'](_0x11ff84[_0x93eb('0x40')],function(_0x3847b4){var _0x16176b={};_0x16176b[_0x3847b4]={'$like':'%'+_0x1e5e75[_0x93eb('0x3c')][_0x93eb('0x48')]+'%'};return _0x16176b;})});}_0x11ff84=_[_0x93eb('0x49')]({},_0x11ff84,_0x1e5e75[_0x93eb('0x51')]);return _0x35015d[_0x93eb('0x6b')](_0x11ff84);}})[_0x93eb('0x2e')](function(_0x31937f){if(_0x31937f){_0x578d43=_0x31937f[_0x93eb('0x42')];if(!_0x1e5e75['query'][_0x93eb('0x43')](_0x93eb('0x44'))){_0x11ff84[_0x93eb('0x27')]=qs[_0x93eb('0x27')](_0x1e5e75[_0x93eb('0x3c')][_0x93eb('0x27')]);_0x11ff84['offset']=qs[_0x93eb('0x25')](_0x1e5e75[_0x93eb('0x3c')][_0x93eb('0x25')]);}return _0x35015d[_0x93eb('0x6b')](_0x11ff84);}})[_0x93eb('0x2e')](function(_0x4af7d7){if(_0x4af7d7){return _0x4af7d7?{'count':_0x578d43,'rows':_0x4af7d7}:null;}})['then'](respondWithResult(_0x2686a2,null))[_0x93eb('0x4e')](handleError(_0x2686a2,null));};exports[_0x93eb('0x6d')]=function(_0x33acc1,_0x5bff04,_0x2a6800){var _0x5b7b85=_0x33acc1[_0x93eb('0x54')]['ids'];return db[_0x93eb('0x6c')][_0x93eb('0x61')]({'where':{'id':_0x5b7b85},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x93eb('0x34'),'online',_0x93eb('0x6e'),_0x93eb('0x6f')],'raw':!![]}]})[_0x93eb('0x2e')](function(_0x15a8a5){if(_0x15a8a5){var _0x2856c5=_[_0x93eb('0x70')](_0x15a8a5,function(_0x2d7760){var _0x214551=_0x2d7760[_0x93eb('0x30')]({'plain':!![]});return _0x214551[_0x93eb('0x71')];});return db['WhatsappQueue'][_0x93eb('0x52')]({'where':{'id':_0x33acc1[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](function(_0x4ec4cb){return db[_0x93eb('0x72')][_0x93eb('0x73')](function(_0x31114c){return _0x4ec4cb[_0x93eb('0x6d')](_0x5b7b85,{'transaction':_0x31114c})[_0x93eb('0x2e')](function(){return BPromise[_0x93eb('0x74')](_0x2856c5,function(_0x3abd80){return db['UserWhatsappQueue'][_0x93eb('0x75')]({'where':{'UserId':_0x3abd80['id'],'WhatsappQueueId':_0x33acc1[_0x93eb('0x50')]['id']},'transaction':_0x31114c});});})[_0x93eb('0x2e')](function(){_0x2856c5['forEach'](function(_0x5d4d3f){socket[_0x93eb('0x76')](_0x93eb('0x77'),{'UserId':_0x5d4d3f['id'],'WhatsappQueueId':_0x4ec4cb['id']});});});});});}})[_0x93eb('0x2e')](respondWithStatusCode(_0x5bff04,null))['catch'](handleError(_0x5bff04,null));};exports['removeTeams']=function(_0x1ec62e,_0x550b0f,_0x16beb5){return db[_0x93eb('0x6c')][_0x93eb('0x61')]({'where':{'id':_0x1ec62e['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x93eb('0x62')],'as':_0x93eb('0x71'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x550b0f,null))['then'](function(_0x5ced1b){var _0x44b802=_[_0x93eb('0x36')](_0x5ced1b,'id');var _0x628fbe=[];var _0x33d74c=[];var _0x2e60b5=squel['select']();_0x2e60b5['field'](_0x93eb('0x78'))[_0x93eb('0x79')](_0x93eb('0x7a'),'tq')[_0x93eb('0x7b')](_0x93eb('0x7c'),'ut',_0x93eb('0x7d'))[_0x93eb('0x46')](_0x93eb('0x7e'),_0x1ec62e[_0x93eb('0x50')]['id']);for(var _0x5cc2f5=0x0;_0x5cc2f5<_0x5ced1b[_0x93eb('0x42')];_0x5cc2f5+=0x1){let _0x7f342=_0x5ced1b[_0x5cc2f5];for(var _0x202ce4=0x0;_0x202ce4<_0x7f342[_0x93eb('0x71')][_0x93eb('0x42')];_0x202ce4+=0x1){let _0x1cba23=_0x7f342[_0x93eb('0x71')][_0x202ce4];var _0x438d4c=_0x2e60b5[_0x93eb('0x7f')]();_0x438d4c['where']('ut.UserId\x20=\x20?',_0x1cba23['id']);_0x33d74c[_0x93eb('0x80')](db[_0x93eb('0x72')][_0x93eb('0x3c')](_0x438d4c[_0x93eb('0x81')](),{'type':db['sequelize'][_0x93eb('0x82')][_0x93eb('0x83')]})[_0x93eb('0x2e')](function(_0x23fc13){if(_0x23fc13['length']===0x1){return _0x1cba23['id'];}else{var _0x961fc0=_[_0x93eb('0x84')](_[_0x93eb('0x36')](_0x23fc13,_0x93eb('0x85')),function(_0x26621b){return _['includes'](_0x44b802,_0x26621b);});if(_0x961fc0){return _0x1cba23['id'];}}}));}}return BPromise[_0x93eb('0x86')](_0x33d74c)[_0x93eb('0x2e')](function(_0x5076fa){_0x628fbe=_(_0x628fbe)['union'](_0x5076fa)[_0x93eb('0x87')]()[_0x93eb('0x88')]();return db['WhatsappQueue'][_0x93eb('0x52')]({'where':{'id':_0x1ec62e['params']['id']}})[_0x93eb('0x2e')](function(_0x21d1b6){return db['sequelize'][_0x93eb('0x73')](function(_0x1ec8f0){return _0x21d1b6[_0x93eb('0x89')](_0x1ec62e[_0x93eb('0x3c')]['ids'],{'transaction':_0x1ec8f0})['then'](function(){if(!_[_0x93eb('0x8a')](_0x628fbe)){return _0x21d1b6[_0x93eb('0x8b')](_0x628fbe,{'transaction':_0x1ec8f0});}})[_0x93eb('0x2e')](function(){_0x628fbe[_0x93eb('0x8c')](function(_0x1d3b49){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x1d3b49,'WhatsappQueueId':_0x21d1b6['id']});});});});});});})[_0x93eb('0x2e')](respondWithStatusCode(_0x550b0f,null))[_0x93eb('0x4e')](handleError(_0x550b0f,null));};exports[_0x93eb('0x8d')]=function(_0x289bdc,_0x52c112,_0x13b63c){return db[_0x93eb('0x37')][_0x93eb('0x52')]({'where':{'id':_0x289bdc[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0x52c112,null))['then'](function(_0xa1e73d){if(_0xa1e73d){return _0xa1e73d[_0x93eb('0x8d')](_0x289bdc[_0x93eb('0x54')][_0x93eb('0x8e')],_[_0x93eb('0x8f')](_0x289bdc[_0x93eb('0x54')],[_0x93eb('0x8e'),'id'])||{})[_0x93eb('0x90')](function(_0x1a5fff){for(var _0x9ae6f3=0x0;_0x9ae6f3<_0x289bdc[_0x93eb('0x54')][_0x93eb('0x8e')][_0x93eb('0x42')];_0x9ae6f3+=0x1){socket[_0x93eb('0x76')]('userWhatsappQueue:save',{'UserId':Number(_0x289bdc['body'][_0x93eb('0x8e')][_0x9ae6f3]),'WhatsappQueueId':Number(_0x289bdc[_0x93eb('0x50')]['id'])});}return _0x1a5fff;});}})[_0x93eb('0x2e')](respondWithResult(_0x52c112,null))[_0x93eb('0x4e')](handleError(_0x52c112,null));};exports[_0x93eb('0x8b')]=function(_0xd640,_0xc871e1,_0x1ab02f){return db[_0x93eb('0x37')][_0x93eb('0x52')]({'where':{'id':_0xd640['params']['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0xc871e1,null))['then'](function(_0x1e7c4e){if(_0x1e7c4e){return _0x1e7c4e['removeAgents'](_0xd640['query'][_0x93eb('0x8e')])[_0x93eb('0x2e')](function(){if(_['isArray'](_0xd640[_0x93eb('0x3c')][_0x93eb('0x8e')])){for(var _0x238a2=0x0;_0x238a2<_0xd640[_0x93eb('0x3c')][_0x93eb('0x8e')][_0x93eb('0x42')];_0x238a2+=0x1){socket[_0x93eb('0x76')](_0x93eb('0x91'),{'UserId':Number(_0xd640[_0x93eb('0x3c')][_0x93eb('0x8e')][_0x238a2]),'WhatsappQueueId':Number(_0xd640[_0x93eb('0x50')]['id'])});}}else{socket[_0x93eb('0x76')](_0x93eb('0x91'),{'UserId':Number(_0xd640[_0x93eb('0x3c')][_0x93eb('0x8e')]),'WhatsappQueueId':Number(_0xd640['params']['id'])});}});}})[_0x93eb('0x2e')](respondWithStatusCode(_0xc871e1,null))[_0x93eb('0x4e')](handleError(_0xc871e1,null));};exports['getAgents']=function(_0x4b8adf,_0xa17c60,_0x31c0ed){var _0x2be082={};var _0x566e2c={};var _0x4505ec;var _0x52f877;return db[_0x93eb('0x37')][_0x93eb('0x5d')]({'where':{'id':_0x4b8adf[_0x93eb('0x50')]['id']}})[_0x93eb('0x2e')](handleEntityNotFound(_0xa17c60,null))[_0x93eb('0x2e')](function(_0x31b4ac){if(_0x31b4ac){_0x4505ec=_0x31b4ac;_0x566e2c[_0x93eb('0x3b')]=_[_0x93eb('0x3d')](db[_0x93eb('0x62')][_0x93eb('0x38')]);_0x566e2c[_0x93eb('0x3c')]=_[_0x93eb('0x3d')](_0x4b8adf['query']);_0x566e2c[_0x93eb('0x3e')]=_['intersection'](_0x566e2c[_0x93eb('0x3b')],_0x566e2c[_0x93eb('0x3c')]);_0x2be082[_0x93eb('0x40')]=_['intersection'](_0x566e2c[_0x93eb('0x3b')],qs[_0x93eb('0x41')](_0x4b8adf['query'][_0x93eb('0x41')]));_0x2be082[_0x93eb('0x40')]=_0x2be082['attributes']['length']?_0x2be082[_0x93eb('0x40')]:_0x566e2c['model'];_0x2be082['order']=qs[_0x93eb('0x45')](_0x4b8adf[_0x93eb('0x3c')][_0x93eb('0x45')]);_0x2be082['where']=qs[_0x93eb('0x3e')](_[_0x93eb('0x47')](_0x4b8adf[_0x93eb('0x3c')],_0x566e2c[_0x93eb('0x3e')]));if(_0x4b8adf['query']['filter']){_0x2be082[_0x93eb('0x46')]=_[_0x93eb('0x49')](_0x2be082[_0x93eb('0x46')],{'$or':_['map'](_0x2be082[_0x93eb('0x40')],function(_0x26916c){var _0x1ae608={};_0x1ae608[_0x26916c]={'$like':'%'+_0x4b8adf['query'][_0x93eb('0x48')]+'%'};return _0x1ae608;})});}_0x2be082=_[_0x93eb('0x49')]({},_0x2be082,_0x4b8adf['options']);return _0x4505ec[_0x93eb('0x92')](_0x2be082);}})[_0x93eb('0x2e')](function(_0x5ce3a2){if(_0x5ce3a2){_0x52f877=_0x5ce3a2[_0x93eb('0x42')];if(!_0x4b8adf[_0x93eb('0x3c')][_0x93eb('0x43')](_0x93eb('0x44'))){_0x2be082[_0x93eb('0x27')]=qs[_0x93eb('0x27')](_0x4b8adf['query']['limit']);_0x2be082[_0x93eb('0x25')]=qs['offset'](_0x4b8adf[_0x93eb('0x3c')][_0x93eb('0x25')]);}return _0x4505ec[_0x93eb('0x92')](_0x2be082);}})[_0x93eb('0x2e')](function(_0x4e0e5c){if(_0x4e0e5c){return _0x4e0e5c?{'count':_0x52f877,'rows':_0x4e0e5c}:null;}})['then'](respondWithResult(_0xa17c60,null))['catch'](handleError(_0xa17c60,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 0f59119..c175268 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 _0x309d=['update','emit','hasOwnProperty','hook','exports','events','save'];(function(_0x3b3063,_0x4f9401){var _0x4ffbd9=function(_0x293db5){while(--_0x293db5){_0x3b3063['push'](_0x3b3063['shift']());}};_0x4ffbd9(++_0x4f9401);}(_0x309d,0x139));var _0xd309=function(_0x148b30,_0x1fe1c6){_0x148b30=_0x148b30-0x0;var _0x197038=_0x309d[_0x148b30];return _0x197038;};'use strict';var EventEmitter=require(_0xd309('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd309('0x1'),'afterUpdate':_0xd309('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5b83e1){return function(_0x44221a,_0x22e6f7,_0x5e4057){WhatsappQueueEvents[_0xd309('0x3')](_0x5b83e1+':'+_0x44221a['id'],_0x44221a);WhatsappQueueEvents[_0xd309('0x3')](_0x5b83e1,_0x44221a);_0x5e4057(null);};}for(var e in events){if(events[_0xd309('0x4')](e)){var event=events[e];WhatsappQueue[_0xd309('0x5')](e,emitEvent(event));}}module[_0xd309('0x6')]=WhatsappQueueEvents; \ No newline at end of file +var _0x4fb5=['emit','hasOwnProperty','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4fb5,0x12a));var _0x54fb=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4fb5[_0x4565bf];return _0x5610ba;};'use strict';var EventEmitter=require(_0x54fb('0x0'));var WhatsappQueue=require(_0x54fb('0x1'))['db'][_0x54fb('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x54fb('0x3')](0x0);var events={'afterCreate':_0x54fb('0x4'),'afterUpdate':'update','afterDestroy':_0x54fb('0x5')};function emitEvent(_0x8c6c6d){return function(_0x231ad2,_0x20ea31,_0x193c51){WhatsappQueueEvents[_0x54fb('0x6')](_0x8c6c6d+':'+_0x231ad2['id'],_0x231ad2);WhatsappQueueEvents['emit'](_0x8c6c6d,_0x231ad2);_0x193c51(null);};}for(var e in events){if(events[_0x54fb('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 4b0b23d..20ac445 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 _0x4e33=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues'];(function(_0x2a7e1a,_0xd188fa){var _0x202852=function(_0x382afc){while(--_0x382afc){_0x2a7e1a['push'](_0x2a7e1a['shift']());}};_0x202852(++_0xd188fa);}(_0x4e33,0xa8));var _0x34e3=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0x4e33[_0x4bf96c];return _0x281d09;};'use strict';var _=require('lodash');var util=require(_0x34e3('0x0'));var logger=require(_0x34e3('0x1'))(_0x34e3('0x2'));var moment=require(_0x34e3('0x3'));var BPromise=require(_0x34e3('0x4'));var rp=require(_0x34e3('0x5'));var fs=require('fs');var path=require(_0x34e3('0x6'));var rimraf=require(_0x34e3('0x7'));var config=require(_0x34e3('0x8'));var attributes=require(_0x34e3('0x9'));module[_0x34e3('0xa')]=function(_0xe87f51,_0x5afb07){return _0xe87f51[_0x34e3('0xb')](_0x34e3('0xc'),attributes,{'tableName':_0x34e3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40e6=['rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','api','moment','request-promise'];(function(_0x56b0f2,_0x14554d){var _0x5d82ed=function(_0x3f482f){while(--_0x3f482f){_0x56b0f2['push'](_0x56b0f2['shift']());}};_0x5d82ed(++_0x14554d);}(_0x40e6,0x1f3));var _0x640e=function(_0x58c513,_0x15deec){_0x58c513=_0x58c513-0x0;var _0x4da4c4=_0x40e6[_0x58c513];return _0x4da4c4;};'use strict';var _=require(_0x640e('0x0'));var util=require(_0x640e('0x1'));var logger=require('../../config/logger')(_0x640e('0x2'));var moment=require(_0x640e('0x3'));var BPromise=require('bluebird');var rp=require(_0x640e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x640e('0x5'));var config=require(_0x640e('0x6'));var attributes=require(_0x640e('0x7'));module[_0x640e('0x8')]=function(_0x3afffb,_0x5ddc25){return _0x3afffb[_0x640e('0x9')](_0x640e('0xa'),attributes,{'tableName':_0x640e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 0991f4c..9b8c66d 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 _0x9ce4=['stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','result','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','include','map','model','attributes','debug','catch','ShowWhatsappQueue','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','localhost','./whatsappQueue.socket','register','request','then','info','request\x20sent'];(function(_0x2a895b,_0x32e0af){var _0x5b5a07=function(_0x50afbe){while(--_0x50afbe){_0x2a895b['push'](_0x2a895b['shift']());}};_0x5b5a07(++_0x32e0af);}(_0x9ce4,0x154));var _0x49ce=function(_0x23607f,_0x51db51){_0x23607f=_0x23607f-0x0;var _0x5a5be0=_0x9ce4[_0x23607f];return _0x5a5be0;};'use strict';var _=require(_0x49ce('0x0'));var util=require(_0x49ce('0x1'));var moment=require('moment');var BPromise=require(_0x49ce('0x2'));var rs=require(_0x49ce('0x3'));var fs=require('fs');var Redis=require(_0x49ce('0x4'));var db=require(_0x49ce('0x5'))['db'];var utils=require(_0x49ce('0x6'));var logger=require('../../config/logger')(_0x49ce('0x7'));var config=require('../../config/environment');var jayson=require(_0x49ce('0x8'));var client=jayson[_0x49ce('0x9')][_0x49ce('0xa')]({'port':0x232a});config['redis']=_[_0x49ce('0xb')](config[_0x49ce('0xc')],{'host':_0x49ce('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x49ce('0xe'))[_0x49ce('0xf')](socket);function respondWithRpcPromise(_0xdb3021,_0x53f4e9,_0x3243e8){return new BPromise(function(_0x4140a5,_0x3f19be){return client[_0x49ce('0x10')](_0xdb3021,_0x3243e8)[_0x49ce('0x11')](function(_0xb28791){logger[_0x49ce('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x53f4e9,_0x49ce('0x13'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x53f4e9,_0x49ce('0x13'),JSON[_0x49ce('0x14')](_0xb28791));if(_0xb28791['error']){if(_0xb28791[_0x49ce('0x15')][_0x49ce('0x16')]===0x1f4){logger[_0x49ce('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x53f4e9,_0xb28791['error']['message']);return _0x3f19be(_0xb28791[_0x49ce('0x15')][_0x49ce('0x17')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x53f4e9,_0xb28791['error'][_0x49ce('0x17')]);return _0x4140a5(_0xb28791[_0x49ce('0x15')]['message']);}else{logger['info'](_0x49ce('0x18'),_0x53f4e9,_0x49ce('0x13'));_0x4140a5(_0xb28791[_0x49ce('0x19')][_0x49ce('0x17')]);}})['catch'](function(_0x28b158){logger['error'](_0x49ce('0x18'),_0x53f4e9,_0x28b158);_0x3f19be(_0x28b158);});});}exports[_0x49ce('0x1a')]=function(_0x432427){var _0xde271f=this;return new Promise(function(_0x392308,_0x423f0b){return db[_0x49ce('0x1b')][_0x49ce('0x1c')]({'raw':_0x432427['options']?_0x432427[_0x49ce('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x432427[_0x49ce('0x1d')]?_0x432427[_0x49ce('0x1d')][_0x49ce('0x1e')]||null:null,'attributes':_0x432427[_0x49ce('0x1d')]?_0x432427[_0x49ce('0x1d')]['attributes']||null:null,'limit':_0x432427[_0x49ce('0x1d')]?_0x432427[_0x49ce('0x1d')][_0x49ce('0x1f')]||null:null,'include':_0x432427['options']?_0x432427[_0x49ce('0x1d')][_0x49ce('0x20')]?_[_0x49ce('0x21')](_0x432427[_0x49ce('0x1d')]['include'],function(_0x1cfa10){return{'model':db[_0x1cfa10[_0x49ce('0x22')]],'as':_0x1cfa10['as'],'attributes':_0x1cfa10[_0x49ce('0x23')],'include':_0x1cfa10[_0x49ce('0x20')]?_[_0x49ce('0x21')](_0x1cfa10[_0x49ce('0x20')],function(_0x1dde19){return{'model':db[_0x1dde19[_0x49ce('0x22')]],'as':_0x1dde19['as'],'attributes':_0x1dde19[_0x49ce('0x23')],'include':_0x1dde19[_0x49ce('0x20')]?_[_0x49ce('0x21')](_0x1dde19[_0x49ce('0x20')],function(_0x599956){return{'model':db[_0x599956[_0x49ce('0x22')]],'as':_0x599956['as'],'attributes':_0x599956[_0x49ce('0x23')]};}):[]};}):[]};}):[]:[]})[_0x49ce('0x11')](function(_0x59d228){logger[_0x49ce('0x12')]('GetWhatsappQueue',_0x432427);logger[_0x49ce('0x24')]('GetWhatsappQueue',_0x432427,JSON[_0x49ce('0x14')](_0x59d228));_0x392308(_0x59d228);})[_0x49ce('0x25')](function(_0x4b25f8){logger[_0x49ce('0x15')]('GetWhatsappQueue',_0x4b25f8[_0x49ce('0x17')],_0x432427);_0x423f0b(_0xde271f[_0x49ce('0x15')](0x1f4,_0x4b25f8[_0x49ce('0x17')]));});});};exports[_0x49ce('0x26')]=function(_0x54e17d){var _0x4d67ed=this;return new Promise(function(_0x405753,_0x1fdb4e){return db[_0x49ce('0x1b')]['find']({'raw':_0x54e17d[_0x49ce('0x1d')]?_0x54e17d['options'][_0x49ce('0x27')]===undefined?!![]:![]:!![],'where':_0x54e17d[_0x49ce('0x1d')]?_0x54e17d[_0x49ce('0x1d')][_0x49ce('0x1e')]||null:null,'attributes':_0x54e17d[_0x49ce('0x1d')]?_0x54e17d['options'][_0x49ce('0x23')]||null:null,'include':_0x54e17d[_0x49ce('0x1d')]?_0x54e17d[_0x49ce('0x1d')][_0x49ce('0x20')]?_[_0x49ce('0x21')](_0x54e17d[_0x49ce('0x1d')][_0x49ce('0x20')],function(_0x365fa0){return{'model':db[_0x365fa0[_0x49ce('0x22')]],'as':_0x365fa0['as'],'attributes':_0x365fa0[_0x49ce('0x23')],'include':_0x365fa0[_0x49ce('0x20')]?_[_0x49ce('0x21')](_0x365fa0[_0x49ce('0x20')],function(_0xb380fa){return{'model':db[_0xb380fa[_0x49ce('0x22')]],'as':_0xb380fa['as'],'attributes':_0xb380fa[_0x49ce('0x23')],'include':_0xb380fa[_0x49ce('0x20')]?_['map'](_0xb380fa['include'],function(_0x3176b0){return{'model':db[_0x3176b0[_0x49ce('0x22')]],'as':_0x3176b0['as'],'attributes':_0x3176b0[_0x49ce('0x23')]};}):[]};}):[]};}):[]:[]})[_0x49ce('0x11')](function(_0x4ffe2b){logger[_0x49ce('0x12')](_0x49ce('0x26'),_0x54e17d);logger[_0x49ce('0x24')](_0x49ce('0x26'),_0x54e17d,JSON[_0x49ce('0x14')](_0x4ffe2b));_0x405753(_0x4ffe2b);})['catch'](function(_0x454418){logger[_0x49ce('0x15')](_0x49ce('0x26'),_0x454418[_0x49ce('0x17')],_0x54e17d);_0x1fdb4e(_0x4d67ed[_0x49ce('0x15')](0x1f4,_0x454418[_0x49ce('0x17')]));});});}; \ No newline at end of file +var _0x4dc6=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','attributes','limit','include','map','model','ShowWhatsappQueue','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x18e711,_0x445de2){var _0x5c7fef=function(_0x464189){while(--_0x464189){_0x18e711['push'](_0x18e711['shift']());}};_0x5c7fef(++_0x445de2);}(_0x4dc6,0xc2));var _0x64dc=function(_0x25018e,_0x4ec973){_0x25018e=_0x25018e-0x0;var _0x49861d=_0x4dc6[_0x25018e];return _0x49861d;};'use strict';var _=require(_0x64dc('0x0'));var util=require(_0x64dc('0x1'));var moment=require('moment');var BPromise=require(_0x64dc('0x2'));var rs=require(_0x64dc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64dc('0x4'))['db'];var utils=require(_0x64dc('0x5'));var logger=require(_0x64dc('0x6'))(_0x64dc('0x7'));var config=require(_0x64dc('0x8'));var jayson=require(_0x64dc('0x9'));var client=jayson[_0x64dc('0xa')][_0x64dc('0xb')]({'port':0x232a});config[_0x64dc('0xc')]=_[_0x64dc('0xd')](config[_0x64dc('0xc')],{'host':_0x64dc('0xe'),'port':0x18eb});var socket=require(_0x64dc('0xf'))(new Redis(config[_0x64dc('0xc')]));require('./whatsappQueue.socket')[_0x64dc('0x10')](socket);function respondWithRpcPromise(_0x4d6d93,_0x399ed5,_0x5e93e4){return new BPromise(function(_0x5c5696,_0x1c873b){return client[_0x64dc('0x11')](_0x4d6d93,_0x5e93e4)[_0x64dc('0x12')](function(_0x47f09c){logger[_0x64dc('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x399ed5,_0x64dc('0x14'));logger[_0x64dc('0x15')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x399ed5,'request\x20sent',JSON[_0x64dc('0x16')](_0x47f09c));if(_0x47f09c[_0x64dc('0x17')]){if(_0x47f09c['error'][_0x64dc('0x18')]===0x1f4){logger['error'](_0x64dc('0x19'),_0x399ed5,_0x47f09c[_0x64dc('0x17')][_0x64dc('0x1a')]);return _0x1c873b(_0x47f09c[_0x64dc('0x17')][_0x64dc('0x1a')]);}logger['error'](_0x64dc('0x19'),_0x399ed5,_0x47f09c['error'][_0x64dc('0x1a')]);return _0x5c5696(_0x47f09c[_0x64dc('0x17')]['message']);}else{logger[_0x64dc('0x13')](_0x64dc('0x19'),_0x399ed5,_0x64dc('0x14'));_0x5c5696(_0x47f09c[_0x64dc('0x1b')][_0x64dc('0x1a')]);}})[_0x64dc('0x1c')](function(_0x25d116){logger['error'](_0x64dc('0x19'),_0x399ed5,_0x25d116);_0x1c873b(_0x25d116);});});}exports[_0x64dc('0x1d')]=function(_0x103b87){var _0x583c3e=this;return new Promise(function(_0x1dc358,_0x168421){return db[_0x64dc('0x1e')][_0x64dc('0x1f')]({'raw':_0x103b87[_0x64dc('0x20')]?_0x103b87[_0x64dc('0x20')][_0x64dc('0x21')]===undefined?!![]:![]:!![],'where':_0x103b87[_0x64dc('0x20')]?_0x103b87[_0x64dc('0x20')]['where']||null:null,'attributes':_0x103b87[_0x64dc('0x20')]?_0x103b87[_0x64dc('0x20')][_0x64dc('0x22')]||null:null,'limit':_0x103b87[_0x64dc('0x20')]?_0x103b87[_0x64dc('0x20')][_0x64dc('0x23')]||null:null,'include':_0x103b87['options']?_0x103b87['options'][_0x64dc('0x24')]?_[_0x64dc('0x25')](_0x103b87[_0x64dc('0x20')][_0x64dc('0x24')],function(_0x1e9d22){return{'model':db[_0x1e9d22[_0x64dc('0x26')]],'as':_0x1e9d22['as'],'attributes':_0x1e9d22['attributes'],'include':_0x1e9d22[_0x64dc('0x24')]?_[_0x64dc('0x25')](_0x1e9d22[_0x64dc('0x24')],function(_0x9f74a9){return{'model':db[_0x9f74a9[_0x64dc('0x26')]],'as':_0x9f74a9['as'],'attributes':_0x9f74a9[_0x64dc('0x22')],'include':_0x9f74a9['include']?_['map'](_0x9f74a9[_0x64dc('0x24')],function(_0x29f34f){return{'model':db[_0x29f34f[_0x64dc('0x26')]],'as':_0x29f34f['as'],'attributes':_0x29f34f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x517408){logger[_0x64dc('0x13')](_0x64dc('0x1d'),_0x103b87);logger[_0x64dc('0x15')](_0x64dc('0x1d'),_0x103b87,JSON[_0x64dc('0x16')](_0x517408));_0x1dc358(_0x517408);})['catch'](function(_0x107f33){logger['error'](_0x64dc('0x1d'),_0x107f33[_0x64dc('0x1a')],_0x103b87);_0x168421(_0x583c3e[_0x64dc('0x17')](0x1f4,_0x107f33['message']));});});};exports[_0x64dc('0x27')]=function(_0x20e591){var _0x46ba4a=this;return new Promise(function(_0x1be0fc,_0x516101){return db[_0x64dc('0x1e')]['find']({'raw':_0x20e591['options']?_0x20e591[_0x64dc('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x20e591['options']?_0x20e591['options'][_0x64dc('0x28')]||null:null,'attributes':_0x20e591['options']?_0x20e591['options']['attributes']||null:null,'include':_0x20e591[_0x64dc('0x20')]?_0x20e591[_0x64dc('0x20')]['include']?_[_0x64dc('0x25')](_0x20e591[_0x64dc('0x20')]['include'],function(_0x1e2b20){return{'model':db[_0x1e2b20[_0x64dc('0x26')]],'as':_0x1e2b20['as'],'attributes':_0x1e2b20['attributes'],'include':_0x1e2b20[_0x64dc('0x24')]?_[_0x64dc('0x25')](_0x1e2b20[_0x64dc('0x24')],function(_0x4bd396){return{'model':db[_0x4bd396[_0x64dc('0x26')]],'as':_0x4bd396['as'],'attributes':_0x4bd396[_0x64dc('0x22')],'include':_0x4bd396[_0x64dc('0x24')]?_[_0x64dc('0x25')](_0x4bd396[_0x64dc('0x24')],function(_0x4de9f7){return{'model':db[_0x4de9f7['model']],'as':_0x4de9f7['as'],'attributes':_0x4de9f7[_0x64dc('0x22')]};}):[]};}):[]};}):[]:[]})[_0x64dc('0x12')](function(_0x45986a){logger[_0x64dc('0x13')](_0x64dc('0x27'),_0x20e591);logger[_0x64dc('0x15')](_0x64dc('0x27'),_0x20e591,JSON[_0x64dc('0x16')](_0x45986a));_0x1be0fc(_0x45986a);})[_0x64dc('0x1c')](function(_0x314245){logger[_0x64dc('0x17')](_0x64dc('0x27'),_0x314245[_0x64dc('0x1a')],_0x20e591);_0x516101(_0x46ba4a[_0x64dc('0x17')](0x1f4,_0x314245[_0x64dc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index ccac20d..378bb3d 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 _0xc3aa=['save','update','emit','removeListener','register'];(function(_0x588c41,_0x207ce0){var _0x5c6046=function(_0x17b8cd){while(--_0x17b8cd){_0x588c41['push'](_0x588c41['shift']());}};_0x5c6046(++_0x207ce0);}(_0xc3aa,0x14a));var _0xac3a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc3aa[_0x21a9d9];return _0x46adce;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xac3a('0x0'),'remove',_0xac3a('0x1')];function createListener(_0x173a3a,_0xd77f57){return function(_0x2d8c1a){_0xd77f57[_0xac3a('0x2')](_0x173a3a,_0x2d8c1a);};}function removeListener(_0xdb065,_0x10a99c){return function(){WhatsappQueueEvents[_0xac3a('0x3')](_0xdb065,_0x10a99c);};}exports[_0xac3a('0x4')]=function(_0x26d941){for(var _0x26c5d1=0x0,_0x16ea87=events['length'];_0x26c5d1<_0x16ea87;_0x26c5d1++){var _0x3ad9a3=events[_0x26c5d1];var _0x5e7283=createListener('whatsappQueue:'+_0x3ad9a3,_0x26d941);WhatsappQueueEvents['on'](_0x3ad9a3,_0x5e7283);}}; \ No newline at end of file +var _0x4091=['length','./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x3ed6d7,_0x353def){var _0x13c622=function(_0xe7b875){while(--_0xe7b875){_0x3ed6d7['push'](_0x3ed6d7['shift']());}};_0x13c622(++_0x353def);}(_0x4091,0x1d1));var _0x1409=function(_0x510b72,_0x514bb0){_0x510b72=_0x510b72-0x0;var _0x362dbf=_0x4091[_0x510b72];return _0x362dbf;};'use strict';var WhatsappQueueEvents=require(_0x1409('0x0'));var events=[_0x1409('0x1'),_0x1409('0x2'),_0x1409('0x3')];function createListener(_0x3d4dc8,_0x793a54){return function(_0x179e76){_0x793a54[_0x1409('0x4')](_0x3d4dc8,_0x179e76);};}function removeListener(_0x2a3f45,_0x2fa256){return function(){WhatsappQueueEvents[_0x1409('0x5')](_0x2a3f45,_0x2fa256);};}exports[_0x1409('0x6')]=function(_0x5c5a86){for(var _0x22459f=0x0,_0x32afe2=events[_0x1409('0x7')];_0x22459f<_0x32afe2;_0x22459f++){var _0x51dfe8=events[_0x22459f];var _0x3d9b1e=createListener('whatsappQueue:'+_0x51dfe8,_0x5c5a86);WhatsappQueueEvents['on'](_0x51dfe8,_0x3d9b1e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 5f781cd..2753393 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 _0x3325=['create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x1ef726,_0x16fdea){var _0x4c3c66=function(_0x1bf2de){while(--_0x1bf2de){_0x1ef726['push'](_0x1ef726['shift']());}};_0x4c3c66(++_0x16fdea);}(_0x3325,0x16f));var _0x5332=function(_0x5504fc,_0x2e161c){_0x5504fc=_0x5504fc-0x0;var _0xbad34c=_0x3325[_0x5504fc];return _0xbad34c;};'use strict';var multer=require(_0x5332('0x0'));var util=require(_0x5332('0x1'));var path=require(_0x5332('0x2'));var timeout=require(_0x5332('0x3'));var express=require('express');var router=express[_0x5332('0x4')]();var fs_extra=require(_0x5332('0x5'));var auth=require(_0x5332('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5332('0x7'));router[_0x5332('0x8')]('/',auth['isAuthenticated'](),controller[_0x5332('0x9')]);router[_0x5332('0x8')](_0x5332('0xa'),auth[_0x5332('0xb')](),controller[_0x5332('0xc')]);router[_0x5332('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x5332('0xb')](),controller[_0x5332('0xd')]);router[_0x5332('0xe')](_0x5332('0xf'),auth[_0x5332('0xb')](),controller['update']);router[_0x5332('0x10')](_0x5332('0xf'),auth[_0x5332('0xb')](),controller[_0x5332('0x11')]);module[_0x5332('0x12')]=router; \ No newline at end of file +var _0xfd76=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','describe','/:id','show','isAuthenticated','put','update','delete','destroy','path','connect-timeout','express','Router'];(function(_0xd2d7f2,_0xfc9871){var _0x2d10fc=function(_0x37cd26){while(--_0x37cd26){_0xd2d7f2['push'](_0xd2d7f2['shift']());}};_0x2d10fc(++_0xfc9871);}(_0xfd76,0x11d));var _0x6fd7=function(_0x418f4f,_0x496861){_0x418f4f=_0x418f4f-0x0;var _0x22261e=_0xfd76[_0x418f4f];return _0x22261e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6fd7('0x0'));var timeout=require(_0x6fd7('0x1'));var express=require(_0x6fd7('0x2'));var router=express[_0x6fd7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6fd7('0x4'));var interaction=require(_0x6fd7('0x5'));var config=require(_0x6fd7('0x6'));var controller=require(_0x6fd7('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6fd7('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x6fd7('0x9')]);router[_0x6fd7('0x8')](_0x6fd7('0xa'),auth['isAuthenticated'](),controller[_0x6fd7('0xb')]);router['post']('/',auth[_0x6fd7('0xc')](),controller['create']);router[_0x6fd7('0xd')](_0x6fd7('0xa'),auth[_0x6fd7('0xc')](),controller[_0x6fd7('0xe')]);router[_0x6fd7('0xf')](_0x6fd7('0xa'),auth[_0x6fd7('0xc')](),controller[_0x6fd7('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e57f256..a28647b 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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x48b258,_0x4e5ae9){var _0x3f5e3c=function(_0x8d208d){while(--_0x8d208d){_0x48b258['push'](_0x48b258['shift']());}};_0x3f5e3c(++_0x4e5ae9);}(_0x7a54,0x106));var _0x47a5=function(_0x33bb77,_0x43fd7a){_0x33bb77=_0x33bb77-0x0;var _0x1fbbfd=_0x7a54[_0x33bb77];return _0x1fbbfd;};'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 +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x356971,_0x11c80e){var _0x3ae4cc=function(_0x307bf8){while(--_0x307bf8){_0x356971['push'](_0x356971['shift']());}};_0x3ae4cc(++_0x11c80e);}(_0x7a54,0x106));var _0x47a5=function(_0x4077de,_0x1cd85c){_0x4077de=_0x4077de-0x0;var _0x1f1087=_0x7a54[_0x4077de];return _0x1f1087;};'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 95c9c7c..abe6100 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 _0xe1e3=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','offset','limit','count','status','set','Content-Range','apply','reject','destroy','then','end','name','index','map','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','WhatsappQueueReport','includeAll','include','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','bluebird','util'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x4fdacd,_0xb5f277){_0x4fdacd=_0x4fdacd-0x0;var _0x157ad7=_0xe1e3[_0x4fdacd];return _0x157ad7;};'use strict';var emlformat=require(_0x3e1e('0x0'));var rimraf=require(_0x3e1e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e1e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e1e('0x3'));var Mustache=require('mustache');var util=require(_0x3e1e('0x4'));var path=require(_0x3e1e('0x5'));var sox=require(_0x3e1e('0x6'));var csv=require(_0x3e1e('0x7'));var ejs=require(_0x3e1e('0x8'));var fs=require('fs');var fs_extra=require(_0x3e1e('0x9'));var _=require('lodash');var squel=require(_0x3e1e('0xa'));var crypto=require(_0x3e1e('0xb'));var jsforce=require(_0x3e1e('0xc'));var deskjs=require(_0x3e1e('0xd'));var toCsv=require(_0x3e1e('0x7'));var querystring=require(_0x3e1e('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e1e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e1e('0x10'));var logger=require(_0x3e1e('0x11'))(_0x3e1e('0x12'));var utils=require('../../config/utils');var config=require(_0x3e1e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e47b9,_0x536129){_0x536129=_0x536129||0xcc;return function(_0x5c09a2){if(_0x5c09a2){return _0x4e47b9[_0x3e1e('0x14')](_0x536129);}return _0x4e47b9['status'](_0x536129)['end']();};}function respondWithResult(_0x3a9375,_0x8bd4cd){_0x8bd4cd=_0x8bd4cd||0xc8;return function(_0x78ee54){if(_0x78ee54){return _0x3a9375['status'](_0x8bd4cd)['json'](_0x78ee54);}};}function respondWithFilteredResult(_0x4131a1,_0x1b62e6){return function(_0x4dca60){if(_0x4dca60){var _0x26cb35=typeof _0x1b62e6[_0x3e1e('0x15')]==='undefined'&&typeof _0x1b62e6[_0x3e1e('0x16')]==='undefined';var _0x23228c=_0x4dca60[_0x3e1e('0x17')];var _0x1d786c=_0x26cb35?0x0:_0x1b62e6[_0x3e1e('0x15')];var _0x791ed8=_0x26cb35?_0x4dca60[_0x3e1e('0x17')]:_0x1b62e6['offset']+_0x1b62e6['limit'];var _0x4a9497;if(_0x791ed8>=_0x23228c){_0x791ed8=_0x23228c;_0x4a9497=0xc8;}else{_0x4a9497=0xce;}_0x4131a1[_0x3e1e('0x18')](_0x4a9497);return _0x4131a1[_0x3e1e('0x19')](_0x3e1e('0x1a'),_0x1d786c+'-'+_0x791ed8+'/'+_0x23228c)['json'](_0x4dca60);}return null;};}function patchUpdates(_0x1c5acd){return function(_0x530815){try{jsonpatch[_0x3e1e('0x1b')](_0x530815,_0x1c5acd,!![]);}catch(_0x33ec1d){return BPromise[_0x3e1e('0x1c')](_0x33ec1d);}return _0x530815['save']();};}function saveUpdates(_0x53e051,_0x96396){return function(_0xefa098){if(_0xefa098){return _0xefa098['update'](_0x53e051)['then'](function(_0x13d7ac){return _0x13d7ac;});}return null;};}function removeEntity(_0x1b5097,_0x488f9f){return function(_0x60e6bc){if(_0x60e6bc){return _0x60e6bc[_0x3e1e('0x1d')]()[_0x3e1e('0x1e')](function(){_0x1b5097[_0x3e1e('0x18')](0xcc)[_0x3e1e('0x1f')]();});}};}function handleEntityNotFound(_0x159212,_0x43d583){return function(_0x21c898){if(!_0x21c898){_0x159212['sendStatus'](0x194);}return _0x21c898;};}function handleError(_0x5d908e,_0x44e419){_0x44e419=_0x44e419||0x1f4;return function(_0x541ef1){logger['error'](_0x541ef1['stack']);if(_0x541ef1['name']){delete _0x541ef1[_0x3e1e('0x20')];}_0x5d908e[_0x3e1e('0x18')](_0x44e419)['send'](_0x541ef1);};}exports[_0x3e1e('0x21')]=function(_0x5ac814,_0xdfcd93){var _0x176bb4={},_0x53a6ff={},_0x43e029={'count':0x0,'rows':[]};var _0x210a84=_[_0x3e1e('0x22')](db['WhatsappQueueReport'][_0x3e1e('0x23')],function(_0x4ec149){return{'name':_0x4ec149['fieldName'],'type':_0x4ec149['type'][_0x3e1e('0x24')]};});_0x53a6ff['model']=_['map'](_0x210a84,_0x3e1e('0x20'));_0x53a6ff[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x5ac814[_0x3e1e('0x25')]);_0x53a6ff[_0x3e1e('0x27')]=_['intersection'](_0x53a6ff['model'],_0x53a6ff['query']);_0x176bb4['attributes']=_[_0x3e1e('0x28')](_0x53a6ff[_0x3e1e('0x29')],qs[_0x3e1e('0x2a')](_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x2a')]));_0x176bb4[_0x3e1e('0x2b')]=_0x176bb4[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x176bb4['attributes']:_0x53a6ff[_0x3e1e('0x29')];if(!_0x5ac814[_0x3e1e('0x25')]['hasOwnProperty'](_0x3e1e('0x2d'))){_0x176bb4[_0x3e1e('0x16')]=qs[_0x3e1e('0x16')](_0x5ac814[_0x3e1e('0x25')]['limit']);_0x176bb4['offset']=qs[_0x3e1e('0x15')](_0x5ac814[_0x3e1e('0x25')]['offset']);}_0x176bb4[_0x3e1e('0x2e')]=qs[_0x3e1e('0x2f')](_0x5ac814['query'][_0x3e1e('0x2f')]);_0x176bb4[_0x3e1e('0x30')]=qs[_0x3e1e('0x27')](_[_0x3e1e('0x31')](_0x5ac814[_0x3e1e('0x25')],_0x53a6ff['filters']),_0x210a84);if(_0x5ac814[_0x3e1e('0x25')][_0x3e1e('0x32')]){_0x176bb4[_0x3e1e('0x30')]=_[_0x3e1e('0x33')](_0x176bb4['where'],{'$or':_[_0x3e1e('0x22')](_0x210a84,function(_0xf973c9){if(_0xf973c9[_0x3e1e('0x34')]!==_0x3e1e('0x35')){var _0x2cc5c7={};_0x2cc5c7[_0xf973c9[_0x3e1e('0x20')]]={'$like':'%'+_0x5ac814[_0x3e1e('0x25')]['filter']+'%'};return _0x2cc5c7;}})});}_0x176bb4=_[_0x3e1e('0x33')]({},_0x176bb4,_0x5ac814['options']);var _0x53bdf5={'where':_0x176bb4[_0x3e1e('0x30')]};return db[_0x3e1e('0x36')][_0x3e1e('0x17')](_0x53bdf5)['then'](function(_0x3dbd2a){_0x43e029[_0x3e1e('0x17')]=_0x3dbd2a;if(_0x5ac814['query'][_0x3e1e('0x37')]){_0x176bb4[_0x3e1e('0x38')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x176bb4);})[_0x3e1e('0x1e')](function(_0x49e4cb){_0x43e029['rows']=_0x49e4cb;return _0x43e029;})[_0x3e1e('0x1e')](respondWithFilteredResult(_0xdfcd93,_0x176bb4))[_0x3e1e('0x39')](handleError(_0xdfcd93,null));};exports[_0x3e1e('0x3a')]=function(_0x202748,_0x377a06){var _0x55ea1d={'raw':!![],'where':{'id':_0x202748[_0x3e1e('0x3b')]['id']}},_0x5b32ad={};_0x5b32ad[_0x3e1e('0x29')]=_[_0x3e1e('0x26')](db['WhatsappQueueReport'][_0x3e1e('0x23')]);_0x5b32ad[_0x3e1e('0x25')]=_[_0x3e1e('0x26')](_0x202748['query']);_0x5b32ad[_0x3e1e('0x27')]=_['intersection'](_0x5b32ad['model'],_0x5b32ad[_0x3e1e('0x25')]);_0x55ea1d[_0x3e1e('0x2b')]=_[_0x3e1e('0x28')](_0x5b32ad[_0x3e1e('0x29')],qs['fields'](_0x202748['query']['fields']));_0x55ea1d['attributes']=_0x55ea1d[_0x3e1e('0x2b')][_0x3e1e('0x2c')]?_0x55ea1d['attributes']:_0x5b32ad['model'];if(_0x202748[_0x3e1e('0x25')][_0x3e1e('0x37')]){_0x55ea1d[_0x3e1e('0x38')]=[{'all':!![]}];}_0x55ea1d=_['merge']({},_0x55ea1d,_0x202748[_0x3e1e('0x3c')]);return db['WhatsappQueueReport'][_0x3e1e('0x3d')](_0x55ea1d)[_0x3e1e('0x1e')](handleEntityNotFound(_0x377a06,null))[_0x3e1e('0x1e')](respondWithResult(_0x377a06,null))[_0x3e1e('0x39')](handleError(_0x377a06,null));};exports[_0x3e1e('0x3e')]=function(_0x3de309,_0x53d32b){return db[_0x3e1e('0x36')][_0x3e1e('0x3e')](_0x3de309['body'],{})[_0x3e1e('0x1e')](respondWithResult(_0x53d32b,0xc9))[_0x3e1e('0x39')](handleError(_0x53d32b,null));};exports['update']=function(_0x1cc820,_0x347b3f){if(_0x1cc820[_0x3e1e('0x3f')]['id']){delete _0x1cc820[_0x3e1e('0x3f')]['id'];}return db['WhatsappQueueReport'][_0x3e1e('0x3d')]({'where':{'id':_0x1cc820[_0x3e1e('0x3b')]['id']}})[_0x3e1e('0x1e')](handleEntityNotFound(_0x347b3f,null))[_0x3e1e('0x1e')](saveUpdates(_0x1cc820['body'],null))[_0x3e1e('0x1e')](respondWithResult(_0x347b3f,null))[_0x3e1e('0x39')](handleError(_0x347b3f,null));};exports[_0x3e1e('0x1d')]=function(_0x25ddf7,_0xe2516c){return db[_0x3e1e('0x36')][_0x3e1e('0x3d')]({'where':{'id':_0x25ddf7[_0x3e1e('0x3b')]['id']}})['then'](handleEntityNotFound(_0xe2516c,null))[_0x3e1e('0x1e')](removeEntity(_0xe2516c,null))['catch'](handleError(_0xe2516c,null));};exports['describe']=function(_0x4c8583,_0x1c4269){return db[_0x3e1e('0x36')]['describe']()[_0x3e1e('0x1e')](respondWithResult(_0x1c4269,null))['catch'](handleError(_0x1c4269,null));}; \ No newline at end of file +var _0x96cc=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2919bc,_0x256334){var _0x1a4743=function(_0x47c44e){while(--_0x47c44e){_0x2919bc['push'](_0x2919bc['shift']());}};_0x1a4743(++_0x256334);}(_0x96cc,0x16c));var _0xc96c=function(_0x5ba513,_0x459c3b){_0x5ba513=_0x5ba513-0x0;var _0x1132a0=_0x96cc[_0x5ba513];return _0x1132a0;};'use strict';var emlformat=require(_0xc96c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc96c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc96c('0x2'));var moment=require(_0xc96c('0x3'));var BPromise=require(_0xc96c('0x4'));var Mustache=require(_0xc96c('0x5'));var util=require(_0xc96c('0x6'));var path=require(_0xc96c('0x7'));var sox=require(_0xc96c('0x8'));var csv=require(_0xc96c('0x9'));var ejs=require(_0xc96c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc96c('0xb'));var squel=require(_0xc96c('0xc'));var crypto=require(_0xc96c('0xd'));var jsforce=require(_0xc96c('0xe'));var deskjs=require(_0xc96c('0xf'));var toCsv=require(_0xc96c('0x9'));var querystring=require(_0xc96c('0x10'));var Papa=require('papaparse');var Redis=require(_0xc96c('0x11'));var authService=require(_0xc96c('0x12'));var qs=require(_0xc96c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc96c('0x14'));var logger=require('../../config/logger')(_0xc96c('0x15'));var utils=require('../../config/utils');var config=require(_0xc96c('0x16'));var licenseUtil=require(_0xc96c('0x17'));var db=require(_0xc96c('0x18'))['db'];function respondWithStatusCode(_0x246a95,_0x5f27f3){_0x5f27f3=_0x5f27f3||0xcc;return function(_0x3fe3d5){if(_0x3fe3d5){return _0x246a95[_0xc96c('0x19')](_0x5f27f3);}return _0x246a95[_0xc96c('0x1a')](_0x5f27f3)[_0xc96c('0x1b')]();};}function respondWithResult(_0x48de8d,_0x35da94){_0x35da94=_0x35da94||0xc8;return function(_0xbed0c9){if(_0xbed0c9){return _0x48de8d[_0xc96c('0x1a')](_0x35da94)[_0xc96c('0x1c')](_0xbed0c9);}};}function respondWithFilteredResult(_0x377dbc,_0x46455a){return function(_0x1765d9){if(_0x1765d9){var _0x23e357=typeof _0x46455a[_0xc96c('0x1d')]===_0xc96c('0x1e')&&typeof _0x46455a[_0xc96c('0x1f')]==='undefined';var _0x509376=_0x1765d9[_0xc96c('0x20')];var _0x99c402=_0x23e357?0x0:_0x46455a[_0xc96c('0x1d')];var _0x2ae19a=_0x23e357?_0x1765d9['count']:_0x46455a[_0xc96c('0x1d')]+_0x46455a[_0xc96c('0x1f')];var _0x2a361c;if(_0x2ae19a>=_0x509376){_0x2ae19a=_0x509376;_0x2a361c=0xc8;}else{_0x2a361c=0xce;}_0x377dbc[_0xc96c('0x1a')](_0x2a361c);return _0x377dbc[_0xc96c('0x21')](_0xc96c('0x22'),_0x99c402+'-'+_0x2ae19a+'/'+_0x509376)[_0xc96c('0x1c')](_0x1765d9);}return null;};}function patchUpdates(_0x41daba){return function(_0x28d762){try{jsonpatch[_0xc96c('0x23')](_0x28d762,_0x41daba,!![]);}catch(_0x2bb397){return BPromise[_0xc96c('0x24')](_0x2bb397);}return _0x28d762[_0xc96c('0x25')]();};}function saveUpdates(_0x45edee,_0x325c54){return function(_0x3b5c6c){if(_0x3b5c6c){return _0x3b5c6c[_0xc96c('0x26')](_0x45edee)['then'](function(_0xd63951){return _0xd63951;});}return null;};}function removeEntity(_0x4be783,_0x4456bf){return function(_0x10ae21){if(_0x10ae21){return _0x10ae21[_0xc96c('0x27')]()[_0xc96c('0x28')](function(){_0x4be783[_0xc96c('0x1a')](0xcc)[_0xc96c('0x1b')]();});}};}function handleEntityNotFound(_0x1a77df,_0x14f171){return function(_0x50fc07){if(!_0x50fc07){_0x1a77df[_0xc96c('0x19')](0x194);}return _0x50fc07;};}function handleError(_0x117f17,_0x3f87cc){_0x3f87cc=_0x3f87cc||0x1f4;return function(_0x294fee){logger['error'](_0x294fee['stack']);if(_0x294fee[_0xc96c('0x29')]){delete _0x294fee[_0xc96c('0x29')];}_0x117f17[_0xc96c('0x1a')](_0x3f87cc)[_0xc96c('0x2a')](_0x294fee);};}exports[_0xc96c('0x2b')]=function(_0x5e1727,_0x427cb2){var _0x1c911b={},_0xa0efbc={},_0x27925f={'count':0x0,'rows':[]};var _0x325cda=_[_0xc96c('0x2c')](db[_0xc96c('0x2d')][_0xc96c('0x2e')],function(_0x556108){return{'name':_0x556108[_0xc96c('0x2f')],'type':_0x556108['type'][_0xc96c('0x30')]};});_0xa0efbc[_0xc96c('0x31')]=_[_0xc96c('0x2c')](_0x325cda,'name');_0xa0efbc[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x5e1727[_0xc96c('0x32')]);_0xa0efbc[_0xc96c('0x34')]=_['intersection'](_0xa0efbc['model'],_0xa0efbc[_0xc96c('0x32')]);_0x1c911b[_0xc96c('0x35')]=_[_0xc96c('0x36')](_0xa0efbc['model'],qs[_0xc96c('0x37')](_0x5e1727[_0xc96c('0x32')][_0xc96c('0x37')]));_0x1c911b[_0xc96c('0x35')]=_0x1c911b['attributes'][_0xc96c('0x38')]?_0x1c911b[_0xc96c('0x35')]:_0xa0efbc['model'];if(!_0x5e1727[_0xc96c('0x32')][_0xc96c('0x39')](_0xc96c('0x3a'))){_0x1c911b[_0xc96c('0x1f')]=qs[_0xc96c('0x1f')](_0x5e1727[_0xc96c('0x32')]['limit']);_0x1c911b[_0xc96c('0x1d')]=qs[_0xc96c('0x1d')](_0x5e1727[_0xc96c('0x32')][_0xc96c('0x1d')]);}_0x1c911b[_0xc96c('0x3b')]=qs[_0xc96c('0x3c')](_0x5e1727['query']['sort']);_0x1c911b[_0xc96c('0x3d')]=qs[_0xc96c('0x34')](_['pick'](_0x5e1727['query'],_0xa0efbc[_0xc96c('0x34')]),_0x325cda);if(_0x5e1727[_0xc96c('0x32')][_0xc96c('0x3e')]){_0x1c911b[_0xc96c('0x3d')]=_[_0xc96c('0x3f')](_0x1c911b[_0xc96c('0x3d')],{'$or':_[_0xc96c('0x2c')](_0x325cda,function(_0x257750){if(_0x257750[_0xc96c('0x40')]!==_0xc96c('0x41')){var _0x1b68e6={};_0x1b68e6[_0x257750['name']]={'$like':'%'+_0x5e1727[_0xc96c('0x32')][_0xc96c('0x3e')]+'%'};return _0x1b68e6;}})});}_0x1c911b=_[_0xc96c('0x3f')]({},_0x1c911b,_0x5e1727[_0xc96c('0x42')]);var _0x4eb180={'where':_0x1c911b[_0xc96c('0x3d')]};return db[_0xc96c('0x2d')][_0xc96c('0x20')](_0x4eb180)['then'](function(_0x510252){_0x27925f[_0xc96c('0x20')]=_0x510252;if(_0x5e1727[_0xc96c('0x32')][_0xc96c('0x43')]){_0x1c911b['include']=[{'all':!![]}];}return db[_0xc96c('0x2d')][_0xc96c('0x44')](_0x1c911b);})[_0xc96c('0x28')](function(_0x2a8ea7){_0x27925f[_0xc96c('0x45')]=_0x2a8ea7;return _0x27925f;})[_0xc96c('0x28')](respondWithFilteredResult(_0x427cb2,_0x1c911b))[_0xc96c('0x46')](handleError(_0x427cb2,null));};exports[_0xc96c('0x47')]=function(_0x25df41,_0x4d5a1b){var _0x4c3088={'raw':!![],'where':{'id':_0x25df41[_0xc96c('0x48')]['id']}},_0x30b3ac={};_0x30b3ac[_0xc96c('0x31')]=_[_0xc96c('0x33')](db['WhatsappQueueReport']['rawAttributes']);_0x30b3ac[_0xc96c('0x32')]=_[_0xc96c('0x33')](_0x25df41[_0xc96c('0x32')]);_0x30b3ac[_0xc96c('0x34')]=_[_0xc96c('0x36')](_0x30b3ac[_0xc96c('0x31')],_0x30b3ac[_0xc96c('0x32')]);_0x4c3088['attributes']=_[_0xc96c('0x36')](_0x30b3ac[_0xc96c('0x31')],qs[_0xc96c('0x37')](_0x25df41[_0xc96c('0x32')]['fields']));_0x4c3088['attributes']=_0x4c3088[_0xc96c('0x35')][_0xc96c('0x38')]?_0x4c3088[_0xc96c('0x35')]:_0x30b3ac[_0xc96c('0x31')];if(_0x25df41[_0xc96c('0x32')][_0xc96c('0x43')]){_0x4c3088[_0xc96c('0x49')]=[{'all':!![]}];}_0x4c3088=_[_0xc96c('0x3f')]({},_0x4c3088,_0x25df41[_0xc96c('0x42')]);return db[_0xc96c('0x2d')][_0xc96c('0x4a')](_0x4c3088)[_0xc96c('0x28')](handleEntityNotFound(_0x4d5a1b,null))[_0xc96c('0x28')](respondWithResult(_0x4d5a1b,null))['catch'](handleError(_0x4d5a1b,null));};exports[_0xc96c('0x4b')]=function(_0x2e5045,_0x307d58){return db[_0xc96c('0x2d')]['create'](_0x2e5045[_0xc96c('0x4c')],{})['then'](respondWithResult(_0x307d58,0xc9))[_0xc96c('0x46')](handleError(_0x307d58,null));};exports[_0xc96c('0x26')]=function(_0x565812,_0x2581ae){if(_0x565812[_0xc96c('0x4c')]['id']){delete _0x565812[_0xc96c('0x4c')]['id'];}return db[_0xc96c('0x2d')][_0xc96c('0x4a')]({'where':{'id':_0x565812[_0xc96c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2581ae,null))['then'](saveUpdates(_0x565812['body'],null))[_0xc96c('0x28')](respondWithResult(_0x2581ae,null))['catch'](handleError(_0x2581ae,null));};exports[_0xc96c('0x27')]=function(_0x22b2e3,_0x65a0a7){return db[_0xc96c('0x2d')][_0xc96c('0x4a')]({'where':{'id':_0x22b2e3[_0xc96c('0x48')]['id']}})[_0xc96c('0x28')](handleEntityNotFound(_0x65a0a7,null))[_0xc96c('0x28')](removeEntity(_0x65a0a7,null))[_0xc96c('0x46')](handleError(_0x65a0a7,null));};exports[_0xc96c('0x4d')]=function(_0x573177,_0x3adefb){return db[_0xc96c('0x2d')][_0xc96c('0x4d')]()[_0xc96c('0x28')](respondWithResult(_0x3adefb,null))[_0xc96c('0x46')](handleError(_0x3adefb,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 0cb9688..c653390 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 _0xa0ff=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x562c16,_0x4a6c17){var _0x3f98cc=function(_0x299d62){while(--_0x299d62){_0x562c16['push'](_0x562c16['shift']());}};_0x3f98cc(++_0x4a6c17);}(_0xa0ff,0xa5));var _0xfa0f=function(_0x4c7149,_0x335342){_0x4c7149=_0x4c7149-0x0;var _0x200122=_0xa0ff[_0x4c7149];return _0x200122;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa0f('0x0'))(_0xfa0f('0x1'));var moment=require('moment');var BPromise=require(_0xfa0f('0x2'));var rp=require(_0xfa0f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa0f('0x4'));var config=require(_0xfa0f('0x5'));var attributes=require('./whatsappQueueReport.attributes');module[_0xfa0f('0x6')]=function(_0x2d1441,_0x1fe6c4){return _0x2d1441[_0xfa0f('0x7')](_0xfa0f('0x8'),attributes,{'tableName':_0xfa0f('0x9'),'paranoid':![],'indexes':[{'name':_0xfa0f('0xa'),'fields':[_0xfa0f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1da7=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5232bb,_0x4fcb6c){var _0x2ba6d1=function(_0x508383){while(--_0x508383){_0x5232bb['push'](_0x5232bb['shift']());}};_0x2ba6d1(++_0x4fcb6c);}(_0x1da7,0x1bb));var _0x71da=function(_0x3f2246,_0x5e37b4){_0x3f2246=_0x3f2246-0x0;var _0x2d7c8b=_0x1da7[_0x3f2246];return _0x2d7c8b;};'use strict';var _=require(_0x71da('0x0'));var util=require('util');var logger=require(_0x71da('0x1'))(_0x71da('0x2'));var moment=require(_0x71da('0x3'));var BPromise=require(_0x71da('0x4'));var rp=require(_0x71da('0x5'));var fs=require('fs');var path=require(_0x71da('0x6'));var rimraf=require(_0x71da('0x7'));var config=require(_0x71da('0x8'));var attributes=require(_0x71da('0x9'));module['exports']=function(_0x184dac,_0x137d29){return _0x184dac[_0x71da('0xa')](_0x71da('0xb'),attributes,{'tableName':_0x71da('0xc'),'paranoid':![],'indexes':[{'name':_0x71da('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index db64e30..7a00e5f 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 _0x7d67=['error','WhatsappQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','UpdateWhatsappQueueReport','update','body','raw','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3edbae,_0x129a13){var _0x3c8c70=function(_0x5a8465){while(--_0x5a8465){_0x3edbae['push'](_0x3edbae['shift']());}};_0x3c8c70(++_0x129a13);}(_0x7d67,0xaa));var _0x77d6=function(_0x55c036,_0x3f04ce){_0x55c036=_0x55c036-0x0;var _0x5eb794=_0x7d67[_0x55c036];return _0x5eb794;};'use strict';var _=require(_0x77d6('0x0'));var util=require(_0x77d6('0x1'));var moment=require('moment');var BPromise=require(_0x77d6('0x2'));var rs=require(_0x77d6('0x3'));var fs=require('fs');var Redis=require(_0x77d6('0x4'));var db=require(_0x77d6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77d6('0x6'))(_0x77d6('0x7'));var config=require(_0x77d6('0x8'));var jayson=require(_0x77d6('0x9'));var client=jayson[_0x77d6('0xa')][_0x77d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c20cf,_0x2e4075,_0x3c3d0c){return new BPromise(function(_0x223817,_0x455704){return client['request'](_0x2c20cf,_0x3c3d0c)['then'](function(_0x4ae527){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x2e4075,'request\x20sent');logger[_0x77d6('0xc')](_0x77d6('0xd'),_0x2e4075,_0x77d6('0xe'),JSON[_0x77d6('0xf')](_0x4ae527));if(_0x4ae527[_0x77d6('0x10')]){if(_0x4ae527[_0x77d6('0x10')]['code']===0x1f4){logger['error'](_0x77d6('0x11'),_0x2e4075,_0x4ae527[_0x77d6('0x10')][_0x77d6('0x12')]);return _0x455704(_0x4ae527[_0x77d6('0x10')][_0x77d6('0x12')]);}logger['error'](_0x77d6('0x11'),_0x2e4075,_0x4ae527[_0x77d6('0x10')][_0x77d6('0x12')]);return _0x223817(_0x4ae527[_0x77d6('0x10')][_0x77d6('0x12')]);}else{logger[_0x77d6('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2e4075,_0x77d6('0xe'));_0x223817(_0x4ae527[_0x77d6('0x14')][_0x77d6('0x12')]);}})[_0x77d6('0x15')](function(_0x51688d){logger[_0x77d6('0x10')](_0x77d6('0x11'),_0x2e4075,_0x51688d);_0x455704(_0x51688d);});});}exports[_0x77d6('0x16')]=function(_0x2e39bf){var _0x4b8f07=this;return new Promise(function(_0x24872b,_0x57d094){return db[_0x77d6('0x17')][_0x77d6('0x18')](_0x2e39bf['body'],{'raw':_0x2e39bf['options']?_0x2e39bf[_0x77d6('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x389d64){logger[_0x77d6('0x13')](_0x77d6('0x16'),_0x2e39bf);logger[_0x77d6('0xc')]('CreateWhatsappQueueReport',_0x2e39bf,JSON[_0x77d6('0xf')](_0x389d64));_0x24872b(_0x389d64);})[_0x77d6('0x15')](function(_0x5e9dc5){logger['error']('CreateWhatsappQueueReport',_0x5e9dc5['message'],_0x2e39bf);_0x57d094(_0x4b8f07[_0x77d6('0x10')](0x1f4,_0x5e9dc5[_0x77d6('0x12')]));});});};exports[_0x77d6('0x1a')]=function(_0x1c1d32){var _0xa33c42=this;return new Promise(function(_0x33747e,_0x547831){return db['WhatsappQueueReport'][_0x77d6('0x1b')](_0x1c1d32[_0x77d6('0x1c')],{'raw':_0x1c1d32[_0x77d6('0x19')]?_0x1c1d32[_0x77d6('0x19')][_0x77d6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c1d32['options']?_0x1c1d32['options'][_0x77d6('0x1e')]||null:null,'attributes':_0x1c1d32[_0x77d6('0x19')]?_0x1c1d32[_0x77d6('0x19')]['attributes']||null:null,'limit':_0x1c1d32[_0x77d6('0x19')]?_0x1c1d32[_0x77d6('0x19')]['limit']||null:null})['then'](function(_0x367d3d){logger['info']('UpdateWhatsappQueueReport',_0x1c1d32);logger['debug'](_0x77d6('0x1a'),_0x1c1d32,JSON[_0x77d6('0xf')](_0x367d3d));_0x33747e(_0x367d3d);})[_0x77d6('0x15')](function(_0x4dc7df){logger[_0x77d6('0x10')]('UpdateWhatsappQueueReport',_0x4dc7df[_0x77d6('0x12')],_0x1c1d32);_0x547831(_0xa33c42[_0x77d6('0x10')](0x1f4,_0x4dc7df['message']));});});}; \ No newline at end of file +var _0xca1d=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird'];(function(_0x42b251,_0x1bfdf2){var _0x30cf5d=function(_0x45998e){while(--_0x45998e){_0x42b251['push'](_0x42b251['shift']());}};_0x30cf5d(++_0x1bfdf2);}(_0xca1d,0x1e6));var _0xdca1=function(_0xee50a9,_0x5921af){_0xee50a9=_0xee50a9-0x0;var _0x537d05=_0xca1d[_0xee50a9];return _0x537d05;};'use strict';var _=require(_0xdca1('0x0'));var util=require(_0xdca1('0x1'));var moment=require(_0xdca1('0x2'));var BPromise=require(_0xdca1('0x3'));var rs=require(_0xdca1('0x4'));var fs=require('fs');var Redis=require(_0xdca1('0x5'));var db=require(_0xdca1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdca1('0x7'))(_0xdca1('0x8'));var config=require('../../config/environment');var jayson=require(_0xdca1('0x9'));var client=jayson[_0xdca1('0xa')][_0xdca1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4de495,_0x290b14,_0x124ced){return new BPromise(function(_0x43f029,_0x1837b1){return client[_0xdca1('0xc')](_0x4de495,_0x124ced)['then'](function(_0x319e07){logger[_0xdca1('0xd')](_0xdca1('0xe'),_0x290b14,_0xdca1('0xf'));logger[_0xdca1('0x10')](_0xdca1('0x11'),_0x290b14,'request\x20sent',JSON[_0xdca1('0x12')](_0x319e07));if(_0x319e07[_0xdca1('0x13')]){if(_0x319e07['error'][_0xdca1('0x14')]===0x1f4){logger[_0xdca1('0x13')](_0xdca1('0xe'),_0x290b14,_0x319e07[_0xdca1('0x13')][_0xdca1('0x15')]);return _0x1837b1(_0x319e07[_0xdca1('0x13')]['message']);}logger[_0xdca1('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x290b14,_0x319e07[_0xdca1('0x13')][_0xdca1('0x15')]);return _0x43f029(_0x319e07[_0xdca1('0x13')][_0xdca1('0x15')]);}else{logger[_0xdca1('0xd')](_0xdca1('0xe'),_0x290b14,_0xdca1('0xf'));_0x43f029(_0x319e07['result']['message']);}})[_0xdca1('0x16')](function(_0x2f1a03){logger[_0xdca1('0x13')](_0xdca1('0xe'),_0x290b14,_0x2f1a03);_0x1837b1(_0x2f1a03);});});}exports[_0xdca1('0x17')]=function(_0x1fad53){var _0x29bcfe=this;return new Promise(function(_0x39aded,_0x3baf6a){return db[_0xdca1('0x18')][_0xdca1('0x19')](_0x1fad53[_0xdca1('0x1a')],{'raw':_0x1fad53[_0xdca1('0x1b')]?_0x1fad53[_0xdca1('0x1b')][_0xdca1('0x1c')]===undefined?!![]:![]:!![]})[_0xdca1('0x1d')](function(_0xe84014){logger['info'](_0xdca1('0x17'),_0x1fad53);logger[_0xdca1('0x10')](_0xdca1('0x17'),_0x1fad53,JSON[_0xdca1('0x12')](_0xe84014));_0x39aded(_0xe84014);})[_0xdca1('0x16')](function(_0x2f1d49){logger[_0xdca1('0x13')](_0xdca1('0x17'),_0x2f1d49['message'],_0x1fad53);_0x3baf6a(_0x29bcfe[_0xdca1('0x13')](0x1f4,_0x2f1d49[_0xdca1('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0xd34c45){var _0x348d72=this;return new Promise(function(_0x186c71,_0x89cba8){return db[_0xdca1('0x18')][_0xdca1('0x1e')](_0xd34c45[_0xdca1('0x1a')],{'raw':_0xd34c45[_0xdca1('0x1b')]?_0xd34c45[_0xdca1('0x1b')][_0xdca1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd34c45['options']?_0xd34c45[_0xdca1('0x1b')][_0xdca1('0x1f')]||null:null,'attributes':_0xd34c45[_0xdca1('0x1b')]?_0xd34c45['options'][_0xdca1('0x20')]||null:null,'limit':_0xd34c45[_0xdca1('0x1b')]?_0xd34c45[_0xdca1('0x1b')][_0xdca1('0x21')]||null:null})['then'](function(_0x2269f5){logger[_0xdca1('0xd')](_0xdca1('0x22'),_0xd34c45);logger[_0xdca1('0x10')](_0xdca1('0x22'),_0xd34c45,JSON['stringify'](_0x2269f5));_0x186c71(_0x2269f5);})[_0xdca1('0x16')](function(_0x25bb64){logger[_0xdca1('0x13')](_0xdca1('0x22'),_0x25bb64[_0xdca1('0x15')],_0xd34c45);_0x89cba8(_0x348d72[_0xdca1('0x13')](0x1f4,_0x25bb64[_0xdca1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 2ad9732..fcad78b 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 _0x6990=['./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x570dfb,_0x41d131){var _0x1865b5=function(_0xfa2743){while(--_0xfa2743){_0x570dfb['push'](_0x570dfb['shift']());}};_0x1865b5(++_0x41d131);}(_0x6990,0x1bc));var _0x0699=function(_0x4cea27,_0x5d0843){_0x4cea27=_0x4cea27-0x0;var _0x76bf89=_0x6990[_0x4cea27];return _0x76bf89;};'use strict';var multer=require(_0x0699('0x0'));var util=require('util');var path=require(_0x0699('0x1'));var timeout=require(_0x0699('0x2'));var express=require(_0x0699('0x3'));var router=express[_0x0699('0x4')]();var fs_extra=require(_0x0699('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0699('0x6'));router[_0x0699('0x7')]('/',auth[_0x0699('0x8')](),controller[_0x0699('0x9')]);router[_0x0699('0x7')](_0x0699('0xa'),auth[_0x0699('0x8')](),controller[_0x0699('0xb')]);router['get'](_0x0699('0xc'),auth[_0x0699('0x8')](),controller[_0x0699('0xd')]);router[_0x0699('0xe')]('/',auth[_0x0699('0x8')](),controller[_0x0699('0xf')]);router['put'](_0x0699('0xc'),auth['isAuthenticated'](),controller[_0x0699('0x10')]);router[_0x0699('0x11')](_0x0699('0xc'),auth[_0x0699('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2990=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update'];(function(_0x382282,_0x12308e){var _0x3106d4=function(_0x1a9743){while(--_0x1a9743){_0x382282['push'](_0x382282['shift']());}};_0x3106d4(++_0x12308e);}(_0x2990,0x1bb));var _0x0299=function(_0x4a752b,_0x1a8b9a){_0x4a752b=_0x4a752b-0x0;var _0x4696a4=_0x2990[_0x4a752b];return _0x4696a4;};'use strict';var multer=require(_0x0299('0x0'));var util=require('util');var path=require(_0x0299('0x1'));var timeout=require(_0x0299('0x2'));var express=require(_0x0299('0x3'));var router=express[_0x0299('0x4')]();var fs_extra=require(_0x0299('0x5'));var auth=require(_0x0299('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0299('0x7'));var controller=require(_0x0299('0x8'));router[_0x0299('0x9')]('/',auth['isAuthenticated'](),controller[_0x0299('0xa')]);router[_0x0299('0x9')](_0x0299('0xb'),auth[_0x0299('0xc')](),controller[_0x0299('0xd')]);router[_0x0299('0x9')](_0x0299('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x0299('0xf')]('/',auth['isAuthenticated'](),controller[_0x0299('0x10')]);router[_0x0299('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0299('0x12')]);router[_0x0299('0x13')](_0x0299('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x0299('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index c2a359e..ea54475 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 _0x94d2=['queue','STRING','ENUM','account','agent'];(function(_0x10d2bd,_0x15049e){var _0x241ac4=function(_0xb2b338){while(--_0xb2b338){_0x10d2bd['push'](_0x10d2bd['shift']());}};_0x241ac4(++_0x15049e);}(_0x94d2,0x1cd));var _0x294d=function(_0x509273,_0x13fc9f){_0x509273=_0x509273-0x0;var _0x38ef40=_0x94d2[_0x509273];return _0x38ef40;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x294d('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x294d('0x1')](_0x294d('0x2'),_0x294d('0x3'),_0x294d('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x98b7=['STRING','ENUM','DATE','sequelize','exports'];(function(_0x2942c2,_0x205327){var _0x1844a2=function(_0xe8143a){while(--_0xe8143a){_0x2942c2['push'](_0x2942c2['shift']());}};_0x1844a2(++_0x205327);}(_0x98b7,0xc1));var _0x798b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x98b7[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x798b('0x0'));module[_0x798b('0x1')]={'uniqueid':{'type':Sequelize[_0x798b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x798b('0x3')]('account','agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x798b('0x4')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 65dd244..6502222 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 _0x68b7=['to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','WhatsappTransferReport','findAll','catch','show','keys','rawAttributes','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox'];(function(_0x515908,_0x4e70c0){var _0x398b59=function(_0x130162){while(--_0x130162){_0x515908['push'](_0x515908['shift']());}};_0x398b59(++_0x4e70c0);}(_0x68b7,0x8c));var _0x768b=function(_0x11ccbc,_0x308b35){_0x11ccbc=_0x11ccbc-0x0;var _0xe7f530=_0x68b7[_0x11ccbc];return _0xe7f530;};'use strict';var emlformat=require(_0x768b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x768b('0x1'));var jsonpatch=require(_0x768b('0x2'));var rp=require(_0x768b('0x3'));var moment=require('moment');var BPromise=require(_0x768b('0x4'));var Mustache=require(_0x768b('0x5'));var util=require(_0x768b('0x6'));var path=require('path');var sox=require(_0x768b('0x7'));var csv=require(_0x768b('0x8'));var ejs=require(_0x768b('0x9'));var fs=require('fs');var fs_extra=require(_0x768b('0xa'));var _=require(_0x768b('0xb'));var squel=require(_0x768b('0xc'));var crypto=require(_0x768b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x768b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x768b('0xf'));var Papa=require(_0x768b('0x10'));var Redis=require(_0x768b('0x11'));var authService=require(_0x768b('0x12'));var qs=require(_0x768b('0x13'));var as=require(_0x768b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x768b('0x15'))(_0x768b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x768b('0x17'));var db=require(_0x768b('0x18'))['db'];function respondWithStatusCode(_0x35689d,_0x9c3671){_0x9c3671=_0x9c3671||0xcc;return function(_0x8fa3e6){if(_0x8fa3e6){return _0x35689d[_0x768b('0x19')](_0x9c3671);}return _0x35689d[_0x768b('0x1a')](_0x9c3671)[_0x768b('0x1b')]();};}function respondWithResult(_0x37a8b5,_0x4cff45){_0x4cff45=_0x4cff45||0xc8;return function(_0x467f33){if(_0x467f33){return _0x37a8b5[_0x768b('0x1a')](_0x4cff45)[_0x768b('0x1c')](_0x467f33);}};}function respondWithFilteredResult(_0x3a40b6,_0x1f655e){return function(_0x50306b){if(_0x50306b){var _0x17078f=typeof _0x1f655e[_0x768b('0x1d')]===_0x768b('0x1e')&&typeof _0x1f655e[_0x768b('0x1f')]===_0x768b('0x1e');var _0x7fc465=_0x50306b[_0x768b('0x20')];var _0x20312a=_0x17078f?0x0:_0x1f655e[_0x768b('0x1d')];var _0x421b6f=_0x17078f?_0x50306b[_0x768b('0x20')]:_0x1f655e[_0x768b('0x1d')]+_0x1f655e['limit'];var _0x507bdc;if(_0x421b6f>=_0x7fc465){_0x421b6f=_0x7fc465;_0x507bdc=0xc8;}else{_0x507bdc=0xce;}_0x3a40b6[_0x768b('0x1a')](_0x507bdc);return _0x3a40b6[_0x768b('0x21')]('Content-Range',_0x20312a+'-'+_0x421b6f+'/'+_0x7fc465)[_0x768b('0x1c')](_0x50306b);}return null;};}function patchUpdates(_0x931aa0){return function(_0x5c81ca){try{jsonpatch[_0x768b('0x22')](_0x5c81ca,_0x931aa0,!![]);}catch(_0x10c81c){return BPromise[_0x768b('0x23')](_0x10c81c);}return _0x5c81ca[_0x768b('0x24')]();};}function saveUpdates(_0xaa1538,_0x4d63a2){return function(_0x58cca0){if(_0x58cca0){return _0x58cca0[_0x768b('0x25')](_0xaa1538)[_0x768b('0x26')](function(_0xdc2648){return _0xdc2648;});}return null;};}function removeEntity(_0x207f99,_0x4694f6){return function(_0x1186ab){if(_0x1186ab){return _0x1186ab[_0x768b('0x27')]()[_0x768b('0x26')](function(){_0x207f99[_0x768b('0x1a')](0xcc)[_0x768b('0x1b')]();});}};}function handleEntityNotFound(_0x3ada89,_0x388e79){return function(_0x3a5307){if(!_0x3a5307){_0x3ada89[_0x768b('0x19')](0x194);}return _0x3a5307;};}function handleError(_0x4e31d5,_0x35614b){_0x35614b=_0x35614b||0x1f4;return function(_0x533665){logger['error'](_0x533665['stack']);if(_0x533665['name']){delete _0x533665[_0x768b('0x28')];}_0x4e31d5[_0x768b('0x1a')](_0x35614b)['send'](_0x533665);};}exports[_0x768b('0x29')]=function(_0x5194ee,_0x19c0ed){var _0x556b47={},_0x2681d4={},_0x1973b8={'count':0x0,'rows':[]};var _0x194812=_[_0x768b('0x2a')](db['WhatsappTransferReport']['rawAttributes'],function(_0x501ec6){return{'name':_0x501ec6[_0x768b('0x2b')],'type':_0x501ec6[_0x768b('0x2c')][_0x768b('0x2d')]};});_0x2681d4[_0x768b('0x2e')]=_['map'](_0x194812,_0x768b('0x28'));_0x2681d4[_0x768b('0x2f')]=_['keys'](_0x5194ee['query']);_0x2681d4[_0x768b('0x30')]=_[_0x768b('0x31')](_0x2681d4['model'],_0x2681d4[_0x768b('0x2f')]);_0x556b47[_0x768b('0x32')]=_[_0x768b('0x31')](_0x2681d4[_0x768b('0x2e')],qs[_0x768b('0x33')](_0x5194ee[_0x768b('0x2f')]['fields']));_0x556b47[_0x768b('0x32')]=_0x556b47[_0x768b('0x32')][_0x768b('0x34')]?_0x556b47['attributes']:_0x2681d4[_0x768b('0x2e')];if(!_0x5194ee[_0x768b('0x2f')][_0x768b('0x35')]('nolimit')){_0x556b47['limit']=qs[_0x768b('0x1f')](_0x5194ee[_0x768b('0x2f')][_0x768b('0x1f')]);_0x556b47[_0x768b('0x1d')]=qs[_0x768b('0x1d')](_0x5194ee['query'][_0x768b('0x1d')]);}_0x556b47[_0x768b('0x36')]=qs[_0x768b('0x37')](_0x5194ee[_0x768b('0x2f')][_0x768b('0x37')]);_0x556b47[_0x768b('0x38')]=qs[_0x768b('0x30')](_[_0x768b('0x39')](_0x5194ee[_0x768b('0x2f')],_0x2681d4['filters']),_0x194812);if(_0x5194ee[_0x768b('0x2f')][_0x768b('0x3a')]){_0x556b47[_0x768b('0x38')]=_[_0x768b('0x3b')](_0x556b47[_0x768b('0x38')],{'$or':_['map'](_0x194812,function(_0x6f018a){if(_0x6f018a[_0x768b('0x2c')]!=='VIRTUAL'){var _0x58abd2={};_0x58abd2[_0x6f018a['name']]={'$like':'%'+_0x5194ee['query'][_0x768b('0x3a')]+'%'};return _0x58abd2;}})});}_0x556b47=_[_0x768b('0x3b')]({},_0x556b47,_0x5194ee[_0x768b('0x3c')]);var _0x3a3b99={'where':_0x556b47[_0x768b('0x38')]};return db['WhatsappTransferReport'][_0x768b('0x20')](_0x3a3b99)['then'](function(_0x5c1e2b){_0x1973b8[_0x768b('0x20')]=_0x5c1e2b;if(_0x5194ee[_0x768b('0x2f')][_0x768b('0x3d')]){_0x556b47[_0x768b('0x3e')]=[{'all':!![]}];}return db[_0x768b('0x3f')][_0x768b('0x40')](_0x556b47);})[_0x768b('0x26')](function(_0x213919){_0x1973b8['rows']=_0x213919;return _0x1973b8;})[_0x768b('0x26')](respondWithFilteredResult(_0x19c0ed,_0x556b47))[_0x768b('0x41')](handleError(_0x19c0ed,null));};exports[_0x768b('0x42')]=function(_0x22cfe8,_0x925c02){var _0x4be074={'raw':!![],'where':{'id':_0x22cfe8['params']['id']}},_0x5c9f57={};_0x5c9f57[_0x768b('0x2e')]=_[_0x768b('0x43')](db[_0x768b('0x3f')][_0x768b('0x44')]);_0x5c9f57[_0x768b('0x2f')]=_[_0x768b('0x43')](_0x22cfe8[_0x768b('0x2f')]);_0x5c9f57['filters']=_['intersection'](_0x5c9f57[_0x768b('0x2e')],_0x5c9f57[_0x768b('0x2f')]);_0x4be074[_0x768b('0x32')]=_[_0x768b('0x31')](_0x5c9f57[_0x768b('0x2e')],qs[_0x768b('0x33')](_0x22cfe8[_0x768b('0x2f')]['fields']));_0x4be074[_0x768b('0x32')]=_0x4be074[_0x768b('0x32')][_0x768b('0x34')]?_0x4be074[_0x768b('0x32')]:_0x5c9f57[_0x768b('0x2e')];if(_0x22cfe8[_0x768b('0x2f')][_0x768b('0x3d')]){_0x4be074[_0x768b('0x3e')]=[{'all':!![]}];}_0x4be074=_[_0x768b('0x3b')]({},_0x4be074,_0x22cfe8[_0x768b('0x3c')]);return db[_0x768b('0x3f')][_0x768b('0x45')](_0x4be074)['then'](handleEntityNotFound(_0x925c02,null))[_0x768b('0x26')](respondWithResult(_0x925c02,null))[_0x768b('0x41')](handleError(_0x925c02,null));};exports[_0x768b('0x46')]=function(_0x16649c,_0x37915d){return db[_0x768b('0x3f')][_0x768b('0x46')](_0x16649c[_0x768b('0x47')],{})[_0x768b('0x26')](respondWithResult(_0x37915d,0xc9))[_0x768b('0x41')](handleError(_0x37915d,null));};exports[_0x768b('0x25')]=function(_0x17fb3c,_0x461cc5){if(_0x17fb3c[_0x768b('0x47')]['id']){delete _0x17fb3c[_0x768b('0x47')]['id'];}return db[_0x768b('0x3f')]['find']({'where':{'id':_0x17fb3c[_0x768b('0x48')]['id']}})[_0x768b('0x26')](handleEntityNotFound(_0x461cc5,null))[_0x768b('0x26')](saveUpdates(_0x17fb3c[_0x768b('0x47')],null))[_0x768b('0x26')](respondWithResult(_0x461cc5,null))[_0x768b('0x41')](handleError(_0x461cc5,null));};exports[_0x768b('0x27')]=function(_0x4ef9ce,_0x40d5cc){return db['WhatsappTransferReport'][_0x768b('0x45')]({'where':{'id':_0x4ef9ce[_0x768b('0x48')]['id']}})['then'](handleEntityNotFound(_0x40d5cc,null))[_0x768b('0x26')](removeEntity(_0x40d5cc,null))[_0x768b('0x41')](handleError(_0x40d5cc,null));};exports[_0x768b('0x49')]=function(_0x578025,_0x3048f6){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x3048f6,null))[_0x768b('0x41')](handleError(_0x3048f6,null));}; \ No newline at end of file +var _0xf74e=['order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','WhatsappTransferReport','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x473fca,_0x550413){var _0x330758=function(_0x554b88){while(--_0x554b88){_0x473fca['push'](_0x473fca['shift']());}};_0x330758(++_0x550413);}(_0xf74e,0x19e));var _0xef74=function(_0x2f3783,_0x14e8e1){_0x2f3783=_0x2f3783-0x0;var _0x5857c4=_0xf74e[_0x2f3783];return _0x5857c4;};'use strict';var emlformat=require(_0xef74('0x0'));var rimraf=require(_0xef74('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xef74('0x2'));var moment=require(_0xef74('0x3'));var BPromise=require(_0xef74('0x4'));var Mustache=require(_0xef74('0x5'));var util=require(_0xef74('0x6'));var path=require(_0xef74('0x7'));var sox=require(_0xef74('0x8'));var csv=require('to-csv');var ejs=require(_0xef74('0x9'));var fs=require('fs');var fs_extra=require(_0xef74('0xa'));var _=require(_0xef74('0xb'));var squel=require(_0xef74('0xc'));var crypto=require('crypto');var jsforce=require(_0xef74('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xef74('0xe'));var querystring=require(_0xef74('0xf'));var Papa=require(_0xef74('0x10'));var Redis=require(_0xef74('0x11'));var authService=require(_0xef74('0x12'));var qs=require(_0xef74('0x13'));var as=require(_0xef74('0x14'));var hardwareService=require(_0xef74('0x15'));var logger=require('../../config/logger')(_0xef74('0x16'));var utils=require(_0xef74('0x17'));var config=require(_0xef74('0x18'));var licenseUtil=require(_0xef74('0x19'));var db=require(_0xef74('0x1a'))['db'];function respondWithStatusCode(_0x681c22,_0x423c16){_0x423c16=_0x423c16||0xcc;return function(_0x5cce05){if(_0x5cce05){return _0x681c22[_0xef74('0x1b')](_0x423c16);}return _0x681c22[_0xef74('0x1c')](_0x423c16)[_0xef74('0x1d')]();};}function respondWithResult(_0x2af325,_0x563377){_0x563377=_0x563377||0xc8;return function(_0x559e09){if(_0x559e09){return _0x2af325[_0xef74('0x1c')](_0x563377)[_0xef74('0x1e')](_0x559e09);}};}function respondWithFilteredResult(_0x3db30c,_0x1adf3e){return function(_0x401b12){if(_0x401b12){var _0x13d708=typeof _0x1adf3e[_0xef74('0x1f')]===_0xef74('0x20')&&typeof _0x1adf3e[_0xef74('0x21')]===_0xef74('0x20');var _0x6b2c2a=_0x401b12['count'];var _0x3ab228=_0x13d708?0x0:_0x1adf3e[_0xef74('0x1f')];var _0x423fe4=_0x13d708?_0x401b12[_0xef74('0x22')]:_0x1adf3e[_0xef74('0x1f')]+_0x1adf3e[_0xef74('0x21')];var _0x327d20;if(_0x423fe4>=_0x6b2c2a){_0x423fe4=_0x6b2c2a;_0x327d20=0xc8;}else{_0x327d20=0xce;}_0x3db30c[_0xef74('0x1c')](_0x327d20);return _0x3db30c[_0xef74('0x23')]('Content-Range',_0x3ab228+'-'+_0x423fe4+'/'+_0x6b2c2a)['json'](_0x401b12);}return null;};}function patchUpdates(_0x4ec7e0){return function(_0x5a85d3){try{jsonpatch[_0xef74('0x24')](_0x5a85d3,_0x4ec7e0,!![]);}catch(_0x449742){return BPromise['reject'](_0x449742);}return _0x5a85d3[_0xef74('0x25')]();};}function saveUpdates(_0x36fb08,_0x455197){return function(_0x339031){if(_0x339031){return _0x339031[_0xef74('0x26')](_0x36fb08)[_0xef74('0x27')](function(_0x572781){return _0x572781;});}return null;};}function removeEntity(_0x1ed90e,_0x2c65a1){return function(_0x8e7d36){if(_0x8e7d36){return _0x8e7d36[_0xef74('0x28')]()[_0xef74('0x27')](function(){_0x1ed90e[_0xef74('0x1c')](0xcc)[_0xef74('0x1d')]();});}};}function handleEntityNotFound(_0x3fb0b1,_0x49e538){return function(_0x131226){if(!_0x131226){_0x3fb0b1['sendStatus'](0x194);}return _0x131226;};}function handleError(_0x8e36c1,_0x5e2662){_0x5e2662=_0x5e2662||0x1f4;return function(_0x49b717){logger['error'](_0x49b717[_0xef74('0x29')]);if(_0x49b717[_0xef74('0x2a')]){delete _0x49b717[_0xef74('0x2a')];}_0x8e36c1['status'](_0x5e2662)[_0xef74('0x2b')](_0x49b717);};}exports[_0xef74('0x2c')]=function(_0xafd163,_0x2e87a1){var _0x397510={},_0x3ca299={},_0x17c9da={'count':0x0,'rows':[]};var _0x2d5f6c=_['map'](db[_0xef74('0x2d')]['rawAttributes'],function(_0x1a031e){return{'name':_0x1a031e[_0xef74('0x2e')],'type':_0x1a031e[_0xef74('0x2f')][_0xef74('0x30')]};});_0x3ca299[_0xef74('0x31')]=_[_0xef74('0x32')](_0x2d5f6c,_0xef74('0x2a'));_0x3ca299[_0xef74('0x33')]=_[_0xef74('0x34')](_0xafd163[_0xef74('0x33')]);_0x3ca299[_0xef74('0x35')]=_['intersection'](_0x3ca299[_0xef74('0x31')],_0x3ca299[_0xef74('0x33')]);_0x397510[_0xef74('0x36')]=_[_0xef74('0x37')](_0x3ca299[_0xef74('0x31')],qs[_0xef74('0x38')](_0xafd163[_0xef74('0x33')]['fields']));_0x397510['attributes']=_0x397510['attributes'][_0xef74('0x39')]?_0x397510['attributes']:_0x3ca299[_0xef74('0x31')];if(!_0xafd163[_0xef74('0x33')][_0xef74('0x3a')](_0xef74('0x3b'))){_0x397510['limit']=qs[_0xef74('0x21')](_0xafd163[_0xef74('0x33')][_0xef74('0x21')]);_0x397510['offset']=qs[_0xef74('0x1f')](_0xafd163[_0xef74('0x33')][_0xef74('0x1f')]);}_0x397510[_0xef74('0x3c')]=qs[_0xef74('0x3d')](_0xafd163[_0xef74('0x33')][_0xef74('0x3d')]);_0x397510[_0xef74('0x3e')]=qs[_0xef74('0x35')](_[_0xef74('0x3f')](_0xafd163[_0xef74('0x33')],_0x3ca299[_0xef74('0x35')]),_0x2d5f6c);if(_0xafd163[_0xef74('0x33')][_0xef74('0x40')]){_0x397510[_0xef74('0x3e')]=_[_0xef74('0x41')](_0x397510[_0xef74('0x3e')],{'$or':_[_0xef74('0x32')](_0x2d5f6c,function(_0x31842d){if(_0x31842d[_0xef74('0x2f')]!==_0xef74('0x42')){var _0x18ad25={};_0x18ad25[_0x31842d[_0xef74('0x2a')]]={'$like':'%'+_0xafd163[_0xef74('0x33')][_0xef74('0x40')]+'%'};return _0x18ad25;}})});}_0x397510=_[_0xef74('0x41')]({},_0x397510,_0xafd163[_0xef74('0x43')]);var _0x42892f={'where':_0x397510[_0xef74('0x3e')]};return db['WhatsappTransferReport'][_0xef74('0x22')](_0x42892f)['then'](function(_0x4f5579){_0x17c9da['count']=_0x4f5579;if(_0xafd163[_0xef74('0x33')]['includeAll']){_0x397510[_0xef74('0x44')]=[{'all':!![]}];}return db[_0xef74('0x2d')][_0xef74('0x45')](_0x397510);})[_0xef74('0x27')](function(_0x50f7cc){_0x17c9da[_0xef74('0x46')]=_0x50f7cc;return _0x17c9da;})[_0xef74('0x27')](respondWithFilteredResult(_0x2e87a1,_0x397510))[_0xef74('0x47')](handleError(_0x2e87a1,null));};exports['show']=function(_0x5e63b1,_0x4c860d){var _0x2aaf73={'raw':!![],'where':{'id':_0x5e63b1[_0xef74('0x48')]['id']}},_0x266c83={};_0x266c83[_0xef74('0x31')]=_[_0xef74('0x34')](db[_0xef74('0x2d')][_0xef74('0x49')]);_0x266c83['query']=_[_0xef74('0x34')](_0x5e63b1[_0xef74('0x33')]);_0x266c83[_0xef74('0x35')]=_[_0xef74('0x37')](_0x266c83['model'],_0x266c83[_0xef74('0x33')]);_0x2aaf73[_0xef74('0x36')]=_['intersection'](_0x266c83[_0xef74('0x31')],qs[_0xef74('0x38')](_0x5e63b1[_0xef74('0x33')][_0xef74('0x38')]));_0x2aaf73[_0xef74('0x36')]=_0x2aaf73['attributes'][_0xef74('0x39')]?_0x2aaf73[_0xef74('0x36')]:_0x266c83[_0xef74('0x31')];if(_0x5e63b1['query'][_0xef74('0x4a')]){_0x2aaf73[_0xef74('0x44')]=[{'all':!![]}];}_0x2aaf73=_['merge']({},_0x2aaf73,_0x5e63b1[_0xef74('0x43')]);return db['WhatsappTransferReport'][_0xef74('0x4b')](_0x2aaf73)[_0xef74('0x27')](handleEntityNotFound(_0x4c860d,null))[_0xef74('0x27')](respondWithResult(_0x4c860d,null))[_0xef74('0x47')](handleError(_0x4c860d,null));};exports[_0xef74('0x4c')]=function(_0x398775,_0x5377c5){return db[_0xef74('0x2d')]['create'](_0x398775[_0xef74('0x4d')],{})[_0xef74('0x27')](respondWithResult(_0x5377c5,0xc9))[_0xef74('0x47')](handleError(_0x5377c5,null));};exports[_0xef74('0x26')]=function(_0x568ffe,_0x3fcbb3){if(_0x568ffe[_0xef74('0x4d')]['id']){delete _0x568ffe['body']['id'];}return db['WhatsappTransferReport'][_0xef74('0x4b')]({'where':{'id':_0x568ffe[_0xef74('0x48')]['id']}})[_0xef74('0x27')](handleEntityNotFound(_0x3fcbb3,null))[_0xef74('0x27')](saveUpdates(_0x568ffe[_0xef74('0x4d')],null))['then'](respondWithResult(_0x3fcbb3,null))[_0xef74('0x47')](handleError(_0x3fcbb3,null));};exports[_0xef74('0x28')]=function(_0x3bbf1b,_0x5110b1){return db[_0xef74('0x2d')]['find']({'where':{'id':_0x3bbf1b[_0xef74('0x48')]['id']}})[_0xef74('0x27')](handleEntityNotFound(_0x5110b1,null))[_0xef74('0x27')](removeEntity(_0x5110b1,null))[_0xef74('0x47')](handleError(_0x5110b1,null));};exports['describe']=function(_0x4072f3,_0x1e26d7){return db['WhatsappTransferReport'][_0xef74('0x4e')]()[_0xef74('0x27')](respondWithResult(_0x1e26d7,null))[_0xef74('0x47')](handleError(_0x1e26d7,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 52a0f61..fbbfffc 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 _0x117d=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','report_whatsapp_transfer','uniqueid','lodash'];(function(_0xb2d045,_0x4f42ef){var _0x421cc7=function(_0x34756d){while(--_0x34756d){_0xb2d045['push'](_0xb2d045['shift']());}};_0x421cc7(++_0x4f42ef);}(_0x117d,0x1eb));var _0xd117=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0x117d[_0x53f04f];return _0x16a824;};'use strict';var _=require(_0xd117('0x0'));var util=require(_0xd117('0x1'));var logger=require(_0xd117('0x2'))(_0xd117('0x3'));var moment=require(_0xd117('0x4'));var BPromise=require('bluebird');var rp=require(_0xd117('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd117('0x6'));var config=require(_0xd117('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0xd117('0x8')]=function(_0x30819a,_0x1afabc){return _0x30819a[_0xd117('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0xd117('0xa'),'paranoid':![],'indexes':[{'name':_0xd117('0xb'),'fields':[_0xd117('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab63=['define','report_whatsapp_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x16be59,_0x4596e8){var _0x1dcfdc=function(_0x37284a){while(--_0x37284a){_0x16be59['push'](_0x16be59['shift']());}};_0x1dcfdc(++_0x4596e8);}(_0xab63,0x19b));var _0x3ab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab63[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3ab6('0x0'));var logger=require(_0x3ab6('0x1'))(_0x3ab6('0x2'));var moment=require(_0x3ab6('0x3'));var BPromise=require(_0x3ab6('0x4'));var rp=require(_0x3ab6('0x5'));var fs=require('fs');var path=require(_0x3ab6('0x6'));var rimraf=require(_0x3ab6('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x3ab6('0x8')]=function(_0x22847e,_0x1290b7){return _0x22847e[_0x3ab6('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x3ab6('0xa'),'paranoid':![],'indexes':[{'name':_0x3ab6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 0249eed..b23cc30 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 _0xf183=['request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0xc8302f,_0x1d8f18){var _0x163f56=function(_0x31e3fa){while(--_0x31e3fa){_0xc8302f['push'](_0xc8302f['shift']());}};_0x163f56(++_0x1d8f18);}(_0xf183,0x1c3));var _0x3f18=function(_0x3556e3,_0x32985a){_0x3556e3=_0x3556e3-0x0;var _0x3d7471=_0xf183[_0x3556e3];return _0x3d7471;};'use strict';var _=require(_0x3f18('0x0'));var util=require(_0x3f18('0x1'));var moment=require(_0x3f18('0x2'));var BPromise=require(_0x3f18('0x3'));var rs=require(_0x3f18('0x4'));var fs=require('fs');var Redis=require(_0x3f18('0x5'));var db=require(_0x3f18('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3f18('0x7'));var config=require(_0x3f18('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f18('0x9')][_0x3f18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1faaae,_0x560ba1,_0x3739f3){return new BPromise(function(_0x4889ff,_0x20bc18){return client[_0x3f18('0xb')](_0x1faaae,_0x3739f3)['then'](function(_0x50c529){logger[_0x3f18('0xc')](_0x3f18('0xd'),_0x560ba1,_0x3f18('0xe'));logger[_0x3f18('0xf')](_0x3f18('0x10'),_0x560ba1,_0x3f18('0xe'),JSON[_0x3f18('0x11')](_0x50c529));if(_0x50c529[_0x3f18('0x12')]){if(_0x50c529['error']['code']===0x1f4){logger['error'](_0x3f18('0xd'),_0x560ba1,_0x50c529[_0x3f18('0x12')][_0x3f18('0x13')]);return _0x20bc18(_0x50c529[_0x3f18('0x12')][_0x3f18('0x13')]);}logger[_0x3f18('0x12')](_0x3f18('0xd'),_0x560ba1,_0x50c529['error'][_0x3f18('0x13')]);return _0x4889ff(_0x50c529[_0x3f18('0x12')][_0x3f18('0x13')]);}else{logger[_0x3f18('0xc')](_0x3f18('0xd'),_0x560ba1,_0x3f18('0xe'));_0x4889ff(_0x50c529[_0x3f18('0x14')]['message']);}})[_0x3f18('0x15')](function(_0x26139b){logger['error'](_0x3f18('0xd'),_0x560ba1,_0x26139b);_0x20bc18(_0x26139b);});});} \ No newline at end of file +var _0xd8a0=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','error','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x9c1b3c,_0xb712fa){var _0x4be255=function(_0x50b4ad){while(--_0x50b4ad){_0x9c1b3c['push'](_0x9c1b3c['shift']());}};_0x4be255(++_0xb712fa);}(_0xd8a0,0x1a5));var _0x0d8a=function(_0x1053c2,_0x3b7bf5){_0x1053c2=_0x1053c2-0x0;var _0xdee52c=_0xd8a0[_0x1053c2];return _0xdee52c;};'use strict';var _=require(_0x0d8a('0x0'));var util=require(_0x0d8a('0x1'));var moment=require(_0x0d8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d8a('0x3'));var fs=require('fs');var Redis=require(_0x0d8a('0x4'));var db=require(_0x0d8a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d8a('0x6'))(_0x0d8a('0x7'));var config=require(_0x0d8a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0d8a('0x9')][_0x0d8a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58f4fa,_0x3cdacf,_0x3616c6){return new BPromise(function(_0xaf5603,_0x35a701){return client['request'](_0x58f4fa,_0x3616c6)['then'](function(_0x494016){logger[_0x0d8a('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3cdacf,_0x0d8a('0xc'));logger[_0x0d8a('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x3cdacf,'request\x20sent',JSON['stringify'](_0x494016));if(_0x494016[_0x0d8a('0xe')]){if(_0x494016[_0x0d8a('0xe')]['code']===0x1f4){logger['error'](_0x0d8a('0xf'),_0x3cdacf,_0x494016[_0x0d8a('0xe')][_0x0d8a('0x10')]);return _0x35a701(_0x494016['error'][_0x0d8a('0x10')]);}logger[_0x0d8a('0xe')](_0x0d8a('0xf'),_0x3cdacf,_0x494016[_0x0d8a('0xe')][_0x0d8a('0x10')]);return _0xaf5603(_0x494016[_0x0d8a('0xe')][_0x0d8a('0x10')]);}else{logger[_0x0d8a('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3cdacf,_0x0d8a('0xc'));_0xaf5603(_0x494016[_0x0d8a('0x11')][_0x0d8a('0x10')]);}})[_0x0d8a('0x12')](function(_0x54ca7b){logger[_0x0d8a('0xe')](_0x0d8a('0xf'),_0x3cdacf,_0x54ca7b);_0x35a701(_0x54ca7b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 3cfd980..7799351 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9417=['lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','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(_0x5f0092,_0x3e6a7a){var _0x597a54=function(_0x5ab4c4){while(--_0x5ab4c4){_0x5f0092['push'](_0x5f0092['shift']());}};_0x597a54(++_0x3e6a7a);}(_0x9417,0xb4));var _0x7941=function(_0x18f396,_0x174d17){_0x18f396=_0x18f396-0x0;var _0x3ba532=_0x9417[_0x18f396];return _0x3ba532;};'use strict';var _=require(_0x7941('0x0'));var db=require(_0x7941('0x1'))['db'];var seedDb=require(_0x7941('0x2'));var checkLicense=require(_0x7941('0x3'));var rpc=require('./rpc');var config=require(_0x7941('0x4'));var logger=require(_0x7941('0x5'))(_0x7941('0x6'));var pm2=require(_0x7941('0x7'));var pm2Config=require(_0x7941('0x8'));var schedule=require(_0x7941('0x9'));var chat=require(_0x7941('0xa'));var whatsapp=require(_0x7941('0xb'));var transcribe=require(_0x7941('0xc'));var provider=require(_0x7941('0xd'));function main(){return db['sequelize'][_0x7941('0xe')]()[_0x7941('0xf')](function(){if(config[_0x7941('0x10')]){return seedDb['default']();}})[_0x7941('0xf')](function(){return checkLicense['default']();})['then'](function(){return rpc[_0x7941('0x11')]();})[_0x7941('0xf')](function(_0x34b34b){logger[_0x7941('0x12')](_0x34b34b);return chat[_0x7941('0x13')]();})[_0x7941('0xf')](function(){return whatsapp[_0x7941('0x13')]();})[_0x7941('0xf')](function(){return schedule['start']();})[_0x7941('0xf')](function(){return transcribe['start']();})[_0x7941('0xf')](function(){return provider[_0x7941('0x13')]();})['then'](function(_0x4f40af){logger[_0x7941('0x12')](_0x4f40af);return pm2['start'](pm2Config);})[_0x7941('0xf')](function(_0x45c08f){var _0xa9f093=_0x45c08f[_0x7941('0x14')](function(_0x1da410){return typeof _0x1da410[_0x7941('0x15')]==='number'&&_0x1da410[_0x7941('0x15')]>=0x0;});if(_0xa9f093[_0x7941('0x16')]>0x0){throw new Error(_0xa9f093[_0x7941('0x16')]+_0x7941('0x17')+_[_0x7941('0x18')](_0xa9f093,function(_0x256f45){return'\x22'+_0x256f45[_0x7941('0x19')][_0x7941('0x1a')]+'\x22';}));}logger[_0x7941('0x12')]('Online\x20apps:',_['map'](_[_0x7941('0x14')](_0x45c08f,{'status':'online'}),_0x7941('0x1a'))[_0x7941('0x1b')]());logger[_0x7941('0x12')]('Offline\x20apps:',_['map'](_[_0x7941('0x14')](_0x45c08f,function(_0x4d3b28){return _0x4d3b28[_0x7941('0x1c')]!=='online';}),_0x7941('0x1a'))[_0x7941('0x1b')]()||_0x7941('0x1d'));console[_0x7941('0x1e')](_0x7941('0x1f'));})[_0x7941('0x20')](function(_0x368a07){console['log'](_0x7941('0x21'),_0x368a07);logger['error'](_0x7941('0x22'),_0x368a07);process[_0x7941('0x23')](0x1);});}main(); \ No newline at end of file +var _0xb673=['online','join','Offline\x20apps:','status','name','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','default','listen','info','start','then','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','pm2_env','Online\x20apps:','map'];(function(_0x484c61,_0x35b2dd){var _0x53064b=function(_0x2a2e2f){while(--_0x2a2e2f){_0x484c61['push'](_0x484c61['shift']());}};_0x53064b(++_0x35b2dd);}(_0xb673,0xa5));var _0x3b67=function(_0x15cdc5,_0x3da0f0){_0x15cdc5=_0x15cdc5-0x0;var _0x51f299=_0xb673[_0x15cdc5];return _0x51f299;};'use strict';var _=require(_0x3b67('0x0'));var db=require(_0x3b67('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x3b67('0x2'));var rpc=require(_0x3b67('0x3'));var config=require(_0x3b67('0x4'));var logger=require('./config/logger')(_0x3b67('0x5'));var pm2=require(_0x3b67('0x6'));var pm2Config=require(_0x3b67('0x7'));var schedule=require('./config/schedule');var chat=require(_0x3b67('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x3b67('0x9'));var provider=require(_0x3b67('0xa'));function main(){return db[_0x3b67('0xb')][_0x3b67('0xc')]()['then'](function(){if(config['seedDB']){return seedDb['default']();}})['then'](function(){return checkLicense[_0x3b67('0xd')]();})['then'](function(){return rpc[_0x3b67('0xe')]();})['then'](function(_0x1e4d72){logger[_0x3b67('0xf')](_0x1e4d72);return chat[_0x3b67('0x10')]();})[_0x3b67('0x11')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})['then'](function(){return transcribe[_0x3b67('0x10')]();})[_0x3b67('0x11')](function(){return provider['start']();})[_0x3b67('0x11')](function(_0x150bf1){logger['info'](_0x150bf1);return pm2[_0x3b67('0x10')](pm2Config);})[_0x3b67('0x11')](function(_0x37f47a){var _0xdbd8d4=_0x37f47a[_0x3b67('0x12')](function(_0x46168c){return typeof _0x46168c['exitCode']==='number'&&_0x46168c[_0x3b67('0x13')]>=0x0;});if(_0xdbd8d4[_0x3b67('0x14')]>0x0){throw new Error(_0xdbd8d4[_0x3b67('0x14')]+_0x3b67('0x15')+_['map'](_0xdbd8d4,function(_0x204b66){return'\x22'+_0x204b66[_0x3b67('0x16')]['name']+'\x22';}));}logger[_0x3b67('0xf')](_0x3b67('0x17'),_[_0x3b67('0x18')](_[_0x3b67('0x12')](_0x37f47a,{'status':_0x3b67('0x19')}),'name')[_0x3b67('0x1a')]());logger[_0x3b67('0xf')](_0x3b67('0x1b'),_[_0x3b67('0x18')](_[_0x3b67('0x12')](_0x37f47a,function(_0x47752e){return _0x47752e[_0x3b67('0x1c')]!=='online';}),_0x3b67('0x1d'))[_0x3b67('0x1a')]()||_0x3b67('0x1e'));console['log'](_0x3b67('0x1f'));})[_0x3b67('0x20')](function(_0x2faaf1){console[_0x3b67('0x21')](_0x3b67('0x22'),_0x2faaf1);logger[_0x3b67('0x23')](_0x3b67('0x24'),_0x2faaf1);process[_0x3b67('0x25')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 9342eb4..8ac6f24 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 _0x55ca=['It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','splice','unshift','encryptString','join','promisify','payload','options','session','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','internal','email','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','isChatInteractionAuthorized','isAuthenticated','use','user','closed','then','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','headers','authorization','startsWith','User','find','name','authenticate','pass','Wrong\x20credentials.','catch','query','apikey','getUuid','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blockDuration','add','Invalid\x20API\x20access\x20key','Unknown\x20authorization\x20format','User\x20not\x20found.','canUpdate','update','isWebrtcLicence','getLicense','webrtc','Forbidden','isMiddleware','signToken'];(function(_0x811272,_0x2523c1){var _0x592744=function(_0x38126a){while(--_0x38126a){_0x811272['push'](_0x811272['shift']());}};_0x592744(++_0x2523c1);}(_0x55ca,0x126));var _0xa55c=function(_0x29638f,_0x5dfb8a){_0x29638f=_0x29638f-0x0;var _0x4c2121=_0x55ca[_0x29638f];return _0x4c2121;};'use strict';var db=require(_0xa55c('0x0'))['db'];var config=require(_0xa55c('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xa55c('0x2'));var jwt=require(_0xa55c('0x3'));var expressJwt=require('express-jwt');var compose=require(_0xa55c('0x4'));var basicAuth=require(_0xa55c('0x5'));var crypto=require(_0xa55c('0x6'));var BPromise=require(_0xa55c('0x7'));var util=require(_0xa55c('0x8'));var moment=require(_0xa55c('0x9'));var validateJwt=expressJwt({'secret':config[_0xa55c('0xa')]['session']});var userAttributes=['id',_0xa55c('0xb'),_0xa55c('0xc'),'name',_0xa55c('0xd'),_0xa55c('0xe'),'userpic','permissions',_0xa55c('0xf'),_0xa55c('0x10'),_0xa55c('0x11'),_0xa55c('0x12'),_0xa55c('0x13'),_0xa55c('0x14'),_0xa55c('0x15'),_0xa55c('0x16'),_0xa55c('0x17'),_0xa55c('0x18'),'lastPauseAt','crudPermissions',_0xa55c('0x19'),'passwordResetAt','alias','phoneBarAutoAnswer',_0xa55c('0x1a'),_0xa55c('0x1b'),_0xa55c('0x1c'),_0xa55c('0x1d'),_0xa55c('0x1e'),_0xa55c('0x1f'),'phoneBarPrefixRequired',_0xa55c('0x20'),_0xa55c('0x21'),_0xa55c('0x22'),_0xa55c('0x23'),_0xa55c('0x24'),_0xa55c('0x25'),_0xa55c('0x26'),_0xa55c('0x27'),_0xa55c('0x28'),'downloadOmnichannelInteractions',_0xa55c('0x29'),_0xa55c('0x2a'),_0xa55c('0x2b'),_0xa55c('0x2c'),_0xa55c('0x2d'),_0xa55c('0x2e'),'emailAutoanswerDelay','smsAutoanswer',_0xa55c('0x2f'),_0xa55c('0x30'),_0xa55c('0x31'),'faxAutoanswer',_0xa55c('0x32'),_0xa55c('0x33'),'whatsappAutoanswerDelay'];exports[_0xa55c('0x34')]=function(){return this[_0xa55c('0x35')](!![])[_0xa55c('0x36')](function(_0x1965f1,_0x234372,_0x49ed04){if(_0x1965f1[_0xa55c('0x37')]){_0x49ed04();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x1965f1['params']['id']},'attributes':['id',_0xa55c('0x38'),'disposition'],'raw':!![]})[_0xa55c('0x39')](function(_0x190757){if(_0x190757&&_0x190757[_0xa55c('0x38')]){return _0x234372[_0xa55c('0x3a')](_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?0x195:0x193)[_0xa55c('0x3d')]({'message':_0x190757[_0xa55c('0x3b')]===_0xa55c('0x3c')?_0xa55c('0x3e'):_0xa55c('0x3f')});}else{_0x49ed04();}})['catch'](function(_0x430d55){_0x49ed04(_0x430d55);});}});};exports[_0xa55c('0x35')]=function isAuthenticated(_0x1c9f6b){return compose()[_0xa55c('0x36')](function(_0x5d940d,_0x1377b0,_0x22f6b6){var _0x1b8388;if(_0x5d940d[_0xa55c('0x40')][_0xa55c('0x41')]){if(_[_0xa55c('0x42')](_0x5d940d['headers'][_0xa55c('0x41')],'Basic')){var _0x35c9c2=basicAuth(_0x5d940d);db[_0xa55c('0x43')][_0xa55c('0x44')]({'where':{'name':_0x35c9c2[_0xa55c('0x45')]}})['then'](function(_0x3d28fb){if(!_0x3d28fb||!_0x3d28fb[_0xa55c('0x46')](_0x35c9c2[_0xa55c('0x47')])){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x48')});}_0x5d940d[_0xa55c('0x37')]={'id':_0x3d28fb['id']};_0x22f6b6();})[_0xa55c('0x49')](function(_0x2808e9){_0x22f6b6(_0x2808e9);});}else if(_[_0xa55c('0x42')](_0x5d940d[_0xa55c('0x40')]['authorization'],'Bearer')){validateJwt(_0x5d940d,_0x1377b0,_0x22f6b6);}else{if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')]){try{var _0x2e9623={'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};verifyJwt(_0x5d940d[_0xa55c('0x4a')][_0xa55c('0x4b')],_0x2e9623)[_0xa55c('0x39')](function(_0x3959e3){return db['User']['find']({'where':{'id':_0x3959e3['sub']}})[_0xa55c('0x39')](function(_0x18e00e){_0x1b8388=_0x18e00e;return db[_0xa55c('0x4d')]['findOne']({'where':{'id':0x1},'attributes':[_0xa55c('0x4e'),'blockDuration'],'raw':!![]});})[_0xa55c('0x39')](function(_0x4ad813){if(!_0x1b8388||!_[_0xa55c('0x4f')](_0x1b8388[_0xa55c('0x50')],_0x3959e3[_0xa55c('0x51')])){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x52')});}if(_0x1b8388['disabled']){return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1b8388['blocked']){if(_0x4ad813[_0xa55c('0x53')]>0x0){if(moment(_0x1b8388['blockedAt'])[_0xa55c('0x54')](_0x4ad813[_0xa55c('0x53')],'minutes')>moment()){return _0x1377b0['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x1377b0[_0xa55c('0x3a')](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});}}_0x5d940d[_0xa55c('0x37')]={'id':_0x1b8388['id']};_0x22f6b6();});})[_0xa55c('0x49')](function(){return _0x1377b0['status'](0x191)[_0xa55c('0x3d')]({'message':_0xa55c('0x55')});});}catch(_0x77d623){_0x22f6b6(_0x77d623);}}else if(_0x1c9f6b){_0x22f6b6();}else{return _0x1377b0[_0xa55c('0x3a')](0x193)[_0xa55c('0x3d')]({'message':_0xa55c('0x56')});}})['use'](function(_0x386e34,_0x5ee63d,_0x57a972){if(_0x386e34[_0xa55c('0x37')]){db[_0xa55c('0x43')]['find']({'where':{'id':_0x386e34[_0xa55c('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5f25f7){if(!_0x5f25f7){return _0x5ee63d[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x57')});}_0x386e34['user']=_0x5f25f7;_0x57a972();})[_0xa55c('0x49')](function(_0xd5a006){_0x57a972(_0xd5a006);});}else if(_0x1c9f6b){_0x57a972();}else{return _0x5ee63d['status'](0x194)[_0xa55c('0x3d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xa55c('0x58')]=function canUpdate(){return compose()[_0xa55c('0x36')](function(_0x5be43f,_0x66d1de,_0x1dae70){return licenseUtil['getLicense']()[_0xa55c('0x39')](function(_0x187e09){if(_0x187e09[_0xa55c('0x59')]){_0x1dae70();}else{return _0x66d1de['status'](0x193)[_0xa55c('0x3d')]({'message':'Forbidden'});}})[_0xa55c('0x49')](function(_0x3a8af4){_0x1dae70(_0x3a8af4);});});};exports[_0xa55c('0x5a')]=function isWebrtcLicence(){return compose()['use'](function(_0x41eab1,_0x106adb,_0x592429){return licenseUtil[_0xa55c('0x5b')]()[_0xa55c('0x39')](function(_0x5d5cf6){if(_0x5d5cf6[_0xa55c('0x5c')]){_0x592429();}else{return _0x106adb[_0xa55c('0x3a')](0x193)['json']({'message':_0xa55c('0x5d')});}})[_0xa55c('0x49')](function(_0x219a68){_0x592429(_0x219a68);});});};exports[_0xa55c('0x5e')]=function(_0x564cb3,_0x143989,_0x58a7ea){_0x564cb3[_0xa55c('0x5e')]=!![];return _0x58a7ea();};exports[_0xa55c('0x5f')]=function signToken(_0x194a79){return signJwt(_0x194a79);};exports['setTokenCookie']=function(_0x39bd3d,_0x250b00){if(!_0x39bd3d['user']){return _0x250b00[_0xa55c('0x3a')](0x194)[_0xa55c('0x3d')]({'message':_0xa55c('0x60')});}var _0xcd78c5={'payload':{'id':_0x39bd3d[_0xa55c('0x37')]['id'],'role':_0x39bd3d[_0xa55c('0x37')][_0xa55c('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0xcd78c5)[_0xa55c('0x39')](function(_0x3c147b){_0x250b00[_0xa55c('0x61')]('motion.token',_0x3c147b);_0x250b00[_0xa55c('0x62')](_0xa55c('0x63'));})[_0xa55c('0x49')](function(_0x4f73b6){return _0x250b00[_0xa55c('0x3a')](0x1f4)[_0xa55c('0x64')](_0x4f73b6);});};exports['retrieveApiKey']=function(_0x21b760){if(_['isNil'](_0x21b760[_0xa55c('0x50')])||_[_0xa55c('0x65')](_0x21b760[_0xa55c('0x66')])){return null;}else{return createJwt(_0x21b760);}};exports[_0xa55c('0x67')]=function(_0x2ecf79){_0x2ecf79['apiKeyNonce']=generateNonce();_0x2ecf79[_0xa55c('0x66')]=generateIssuedAt();return createJwt(_0x2ecf79);};exports[_0xa55c('0x68')]=function(_0x4b85cc,_0x3929a6){var _0x2291e0=_0x4b85cc[_0xa55c('0x4a')][_0xa55c('0x4b')];if(_0x2291e0){var _0x50176b={'nonce':_0x3929a6['apiKeyNonce'],'iat':_0x3929a6[_0xa55c('0x66')],'audience':hardwareConf[_0xa55c('0x4c')](),'issuer':hardwareConf[_0xa55c('0x4c')]()};return verifyJwt(_0x2291e0,_0x50176b)[_0xa55c('0x39')](function(){return generateApiKey(_0x3929a6);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa55c('0x69')]=function(_0x5ce463){var _0x2742e4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2742e4[_0xa55c('0x6a')](_0x5ce463))throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0xa55c('0x6d'));return;};exports['validatePasswordHistory']=function(_0x1cb73b,_0x54f776,_0x23f67f){var _0x157afe=encryptor[_0xa55c('0x6e')](_0x54f776)[_0xa55c('0x6f')](',');for(var _0x19aaf5=0x0;_0x19aaf5<_0x23f67f;_0x19aaf5++){if(!_0x157afe[_0x19aaf5])break;if(_0x1cb73b[_0xa55c('0x70')]()===_0x157afe[_0x19aaf5][_0xa55c('0x70')]()){var _0x53e2be=util[_0xa55c('0x71')](_0xa55c('0x72'),_0x23f67f);if(_0x23f67f===0x1){_0x53e2be=_0xa55c('0x73');}throw new db[(_0xa55c('0x6b'))][(_0xa55c('0x6c'))](_0x53e2be);}}return;};exports['updatePasswordsHistory']=function(_0xa72718,_0x3cd40d){var _0x28bac4=_0x3cd40d?encryptor[_0xa55c('0x6e')](_0x3cd40d)[_0xa55c('0x6f')](','):[];if(_0x28bac4['length']===0x5){_0x28bac4[_0xa55c('0x74')](-0x1,0x1);}_0x28bac4[_0xa55c('0x75')](_0xa72718);return encryptor[_0xa55c('0x76')](_0x28bac4[_0xa55c('0x77')](','));};function signJwt(_0x3ba56d){var _0x480dfc=BPromise[_0xa55c('0x78')](jwt['sign'],{'context':jwt});var _0x2e482a=_0x3ba56d['secret']||config[_0xa55c('0xa')]['session'];return new BPromise(function(_0x34edc5,_0x1333da){_0x480dfc(_0x3ba56d[_0xa55c('0x79')],_0x2e482a,_0x3ba56d[_0xa55c('0x7a')])[_0xa55c('0x39')](function(_0x3a5a52){_0x34edc5(_0x3a5a52);})[_0xa55c('0x49')](function(_0x2f2226){_0x1333da(_0x2f2226);});});}function verifyJwt(_0x14b515,_0x1acf50,_0x51c736){var _0x150a07=BPromise[_0xa55c('0x78')](jwt['verify'],{'context':jwt});var _0x18b928=_0x51c736||config[_0xa55c('0xa')][_0xa55c('0x7b')];return new BPromise(function(_0x9fe234,_0x1b8b06){_0x150a07(_0x14b515,_0x18b928,_0x1acf50)[_0xa55c('0x39')](function(_0x3cef1f){_0x9fe234(_0x3cef1f);})[_0xa55c('0x49')](function(_0x47de0a){_0x1b8b06(_0x47de0a);});});}function generateNonce(){return crypto[_0xa55c('0x7c')](0x10)[_0xa55c('0x7d')](_0xa55c('0x7e'));}function generateIssuedAt(){return Math[_0xa55c('0x7f')](Date[_0xa55c('0x80')]()/0x3e8)[_0xa55c('0x7d')]();}function createJwt(_0x2f1237){var _0x4249c1={'payload':{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237['apiKeyNonce']},'options':{'algorithm':_0xa55c('0x81'),'subject':_0x2f1237['id'][_0xa55c('0x7d')](),'issuer':hardwareConf[_0xa55c('0x4c')](),'audience':hardwareConf[_0xa55c('0x4c')]()}};return signJwt(_0x4249c1)[_0xa55c('0x39')](function(_0x10e711){return{'iat':_0x2f1237[_0xa55c('0x66')],'nonce':_0x2f1237[_0xa55c('0x50')],'token':_0x10e711};});} \ No newline at end of file +var _0x6aa7=['smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','find','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','length','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','hex','floor','now','HS512','toString','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','util','secrets','session','role','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x6aa7,0x178));var _0x76aa=function(_0x1ec5ae,_0xc06719){_0x1ec5ae=_0x1ec5ae-0x0;var _0x2aba99=_0x6aa7[_0x1ec5ae];return _0x2aba99;};'use strict';var db=require(_0x76aa('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x76aa('0x1'));var licenseUtil=require(_0x76aa('0x2'));var encryptor=require(_0x76aa('0x3'));var _=require(_0x76aa('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x76aa('0x5'));var compose=require(_0x76aa('0x6'));var basicAuth=require(_0x76aa('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var util=require(_0x76aa('0x8'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0x76aa('0x9')][_0x76aa('0xa')]});var userAttributes=['id',_0x76aa('0xb'),'fullname',_0x76aa('0xc'),_0x76aa('0xd'),_0x76aa('0xe'),'userpic',_0x76aa('0xf'),_0x76aa('0x10'),_0x76aa('0x11'),_0x76aa('0x12'),_0x76aa('0x13'),_0x76aa('0x14'),_0x76aa('0x15'),_0x76aa('0x16'),_0x76aa('0x17'),_0x76aa('0x18'),'lastLoginAt',_0x76aa('0x19'),'crudPermissions',_0x76aa('0x1a'),_0x76aa('0x1b'),_0x76aa('0x1c'),_0x76aa('0x1d'),_0x76aa('0x1e'),'phoneBarDnd','phoneBarEnableRecording',_0x76aa('0x1f'),'phoneBarEnableSettings',_0x76aa('0x20'),_0x76aa('0x21'),'phoneBarRemoteControl',_0x76aa('0x22'),'hotdesk',_0x76aa('0x23'),'userProfileId',_0x76aa('0x24'),_0x76aa('0x25'),_0x76aa('0x26'),_0x76aa('0x27'),_0x76aa('0x28'),_0x76aa('0x29'),'ignorePauseForPreviewCalls','selectRecallMeCampaign',_0x76aa('0x2a'),_0x76aa('0x2b'),_0x76aa('0x2c'),_0x76aa('0x2d'),_0x76aa('0x2e'),_0x76aa('0x2f'),_0x76aa('0x30'),_0x76aa('0x31'),_0x76aa('0x32'),'faxAutoanswerDelay',_0x76aa('0x33'),_0x76aa('0x34')];exports[_0x76aa('0x35')]=function(){return this['isAuthenticated'](!![])[_0x76aa('0x36')](function(_0x189cb6,_0x31252f,_0x2bd2c6){if(_0x189cb6[_0x76aa('0x37')]){_0x2bd2c6();}else{return db[_0x76aa('0x38')][_0x76aa('0x39')]({'where':{'id':_0x189cb6[_0x76aa('0x3a')]['id']},'attributes':['id',_0x76aa('0x3b'),_0x76aa('0x3c')],'raw':!![]})[_0x76aa('0x3d')](function(_0x26b75e){if(_0x26b75e&&_0x26b75e[_0x76aa('0x3b')]){return _0x31252f['status'](_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?0x195:0x193)[_0x76aa('0x3f')]({'message':_0x26b75e[_0x76aa('0x3c')]===_0x76aa('0x3e')?_0x76aa('0x40'):_0x76aa('0x41')});}else{_0x2bd2c6();}})[_0x76aa('0x42')](function(_0xd12a99){_0x2bd2c6(_0xd12a99);});}});};exports[_0x76aa('0x43')]=function isAuthenticated(_0x545b06){return compose()[_0x76aa('0x36')](function(_0x5a8030,_0x994550,_0x365ff8){var _0x2dec94;if(_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')]){if(_[_0x76aa('0x46')](_0x5a8030[_0x76aa('0x44')][_0x76aa('0x45')],_0x76aa('0x47'))){var _0x3ea05a=basicAuth(_0x5a8030);db['User'][_0x76aa('0x48')]({'where':{'name':_0x3ea05a[_0x76aa('0xc')]}})[_0x76aa('0x3d')](function(_0x928ccf){if(!_0x928ccf||!_0x928ccf[_0x76aa('0x49')](_0x3ea05a[_0x76aa('0x4a')])){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x4c')});}_0x5a8030[_0x76aa('0x37')]={'id':_0x928ccf['id']};_0x365ff8();})['catch'](function(_0x2ee338){_0x365ff8(_0x2ee338);});}else if(_['startsWith'](_0x5a8030[_0x76aa('0x44')]['authorization'],_0x76aa('0x4d'))){validateJwt(_0x5a8030,_0x994550,_0x365ff8);}else{if(_0x545b06){_0x365ff8();}else{return _0x994550['status'](0x193)['json']({'message':_0x76aa('0x4e')});}}}else if(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')]){try{var _0x37dfab={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x5a8030[_0x76aa('0x4f')][_0x76aa('0x50')],_0x37dfab)[_0x76aa('0x3d')](function(_0x23e2fd){return db[_0x76aa('0x51')]['find']({'where':{'id':_0x23e2fd[_0x76aa('0x52')]}})['then'](function(_0x5086f5){_0x2dec94=_0x5086f5;return db[_0x76aa('0x53')][_0x76aa('0x39')]({'where':{'id':0x1},'attributes':[_0x76aa('0x54'),_0x76aa('0x55')],'raw':!![]});})['then'](function(_0x401c07){if(!_0x2dec94||!_[_0x76aa('0x56')](_0x2dec94[_0x76aa('0x57')],_0x23e2fd['nonce'])){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x58')});}if(_0x2dec94[_0x76aa('0x59')]){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}if(_0x2dec94[_0x76aa('0x5b')]){if(_0x401c07[_0x76aa('0x55')]>0x0){if(moment(_0x2dec94['blockedAt'])[_0x76aa('0x5c')](_0x401c07[_0x76aa('0x55')],_0x76aa('0x5d'))>moment()){return _0x994550[_0x76aa('0x4b')](0x191)[_0x76aa('0x3f')]({'message':_0x76aa('0x5a')});}}else{return _0x994550['status'](0x191)['json']({'message':_0x76aa('0x5a')});}}_0x5a8030[_0x76aa('0x37')]={'id':_0x2dec94['id']};_0x365ff8();});})[_0x76aa('0x42')](function(){return _0x994550[_0x76aa('0x4b')](0x191)['json']({'message':_0x76aa('0x5a')});});}catch(_0x403084){_0x365ff8(_0x403084);}}else if(_0x545b06){_0x365ff8();}else{return _0x994550[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x4e')});}})['use'](function(_0x13dafe,_0x556f59,_0xbb3136){if(_0x13dafe['user']){db['User']['find']({'where':{'id':_0x13dafe[_0x76aa('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x5cf314){if(!_0x5cf314){return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5e')});}_0x13dafe[_0x76aa('0x37')]=_0x5cf314;_0xbb3136();})[_0x76aa('0x42')](function(_0x27a52e){_0xbb3136(_0x27a52e);});}else if(_0x545b06){_0xbb3136();}else{return _0x556f59['status'](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x5f')});}});};exports[_0x76aa('0x60')]=function canUpdate(){return compose()[_0x76aa('0x36')](function(_0x3800a4,_0x47a308,_0x2f695c){return licenseUtil[_0x76aa('0x61')]()['then'](function(_0x2d3441){if(_0x2d3441['update']){_0x2f695c();}else{return _0x47a308[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})[_0x76aa('0x42')](function(_0x2d0bc4){_0x2f695c(_0x2d0bc4);});});};exports[_0x76aa('0x63')]=function isWebrtcLicence(){return compose()[_0x76aa('0x36')](function(_0x165858,_0xb8d052,_0x3946bd){return licenseUtil['getLicense']()[_0x76aa('0x3d')](function(_0x4b8f12){if(_0x4b8f12[_0x76aa('0x64')]){_0x3946bd();}else{return _0xb8d052[_0x76aa('0x4b')](0x193)[_0x76aa('0x3f')]({'message':_0x76aa('0x62')});}})['catch'](function(_0x5a3d9c){_0x3946bd(_0x5a3d9c);});});};exports[_0x76aa('0x65')]=function(_0x54b673,_0x8660a4,_0x302a0c){_0x54b673[_0x76aa('0x65')]=!![];return _0x302a0c();};exports[_0x76aa('0x66')]=function signToken(_0x30c577){return signJwt(_0x30c577);};exports[_0x76aa('0x67')]=function(_0x5b567b,_0x564546){if(!_0x5b567b[_0x76aa('0x37')]){return _0x564546[_0x76aa('0x4b')](0x194)[_0x76aa('0x3f')]({'message':_0x76aa('0x68')});}var _0x18c679={'payload':{'id':_0x5b567b[_0x76aa('0x37')]['id'],'role':_0x5b567b['user'][_0x76aa('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x18c679)[_0x76aa('0x3d')](function(_0x26db69){_0x564546['cookie'](_0x76aa('0x69'),_0x26db69);_0x564546['redirect'](_0x76aa('0x6a'));})['catch'](function(_0x339b0d){return _0x564546[_0x76aa('0x4b')](0x1f4)[_0x76aa('0x6b')](_0x339b0d);});};exports[_0x76aa('0x6c')]=function(_0x37a4d9){if(_[_0x76aa('0x6d')](_0x37a4d9[_0x76aa('0x57')])||_['isNil'](_0x37a4d9[_0x76aa('0x6e')])){return null;}else{return createJwt(_0x37a4d9);}};exports['generateApiKey']=function(_0x3ee32){_0x3ee32[_0x76aa('0x57')]=generateNonce();_0x3ee32[_0x76aa('0x6e')]=generateIssuedAt();return createJwt(_0x3ee32);};exports[_0x76aa('0x6f')]=function(_0x3fa7ec,_0x28f8aa){var _0x336024=_0x3fa7ec['query'][_0x76aa('0x50')];if(_0x336024){var _0x281f73={'nonce':_0x28f8aa[_0x76aa('0x57')],'iat':_0x28f8aa[_0x76aa('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x76aa('0x70')]()};return verifyJwt(_0x336024,_0x281f73)[_0x76aa('0x3d')](function(){return generateApiKey(_0x28f8aa);});}else{throw{'message':_0x76aa('0x71')};}};exports[_0x76aa('0x72')]=function(_0x2027f8){var _0xf7732=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xf7732['test'](_0x2027f8))throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x76aa('0x75'));return;};exports[_0x76aa('0x76')]=function(_0x3967f3,_0x2fdc4f,_0x37babe){var _0x51893b=encryptor['decryptString'](_0x2fdc4f)[_0x76aa('0x77')](',');for(var _0x3b0d8a=0x0;_0x3b0d8a<_0x37babe;_0x3b0d8a++){if(!_0x51893b[_0x3b0d8a])break;if(_0x3967f3['toLowerCase']()===_0x51893b[_0x3b0d8a][_0x76aa('0x78')]()){var _0x1e6f3c=util['format'](_0x76aa('0x79'),_0x37babe);if(_0x37babe===0x1){_0x1e6f3c=_0x76aa('0x7a');}throw new db[(_0x76aa('0x73'))][(_0x76aa('0x74'))](_0x1e6f3c);}}return;};exports[_0x76aa('0x7b')]=function(_0x1f5010,_0x3376ec){var _0x30573a=_0x3376ec?encryptor[_0x76aa('0x7c')](_0x3376ec)['split'](','):[];if(_0x30573a[_0x76aa('0x7d')]===0x5){_0x30573a['splice'](-0x1,0x1);}_0x30573a[_0x76aa('0x7e')](_0x1f5010);return encryptor[_0x76aa('0x7f')](_0x30573a[_0x76aa('0x80')](','));};function signJwt(_0x16cc85){var _0x343cf1=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x82')],{'context':jwt});var _0x431d1c=_0x16cc85[_0x76aa('0x83')]||config['secrets'][_0x76aa('0xa')];return new BPromise(function(_0x3d4025,_0x5c542b){_0x343cf1(_0x16cc85[_0x76aa('0x84')],_0x431d1c,_0x16cc85[_0x76aa('0x85')])[_0x76aa('0x3d')](function(_0x3d6d10){_0x3d4025(_0x3d6d10);})[_0x76aa('0x42')](function(_0x5546b6){_0x5c542b(_0x5546b6);});});}function verifyJwt(_0x364d05,_0x4d3ad0,_0x35bd2b){var _0x35881c=BPromise[_0x76aa('0x81')](jwt[_0x76aa('0x86')],{'context':jwt});var _0x3a82fe=_0x35bd2b||config[_0x76aa('0x9')][_0x76aa('0xa')];return new BPromise(function(_0x4a37f1,_0x9ea0af){_0x35881c(_0x364d05,_0x3a82fe,_0x4d3ad0)[_0x76aa('0x3d')](function(_0x543c1d){_0x4a37f1(_0x543c1d);})['catch'](function(_0x40429c){_0x9ea0af(_0x40429c);});});}function generateNonce(){return crypto[_0x76aa('0x87')](0x10)['toString'](_0x76aa('0x88'));}function generateIssuedAt(){return Math[_0x76aa('0x89')](Date[_0x76aa('0x8a')]()/0x3e8)['toString']();}function createJwt(_0x446073){var _0x47f733={'payload':{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')]},'options':{'algorithm':_0x76aa('0x8b'),'subject':_0x446073['id'][_0x76aa('0x8c')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x47f733)[_0x76aa('0x3d')](function(_0x4dfeb3){return{'iat':_0x446073[_0x76aa('0x6e')],'nonce':_0x446073[_0x76aa('0x57')],'token':_0x4dfeb3};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 78edbce..ae684f0 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 _0x0b0e=['tags','skip','tag','count','getFilteredContacts','catch','CmContact','keys','cf_','map','findOne','all','length','type','lodash','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','clause'];(function(_0x5c324a,_0x5a8590){var _0x1226c4=function(_0x2e7532){while(--_0x2e7532){_0x5c324a['push'](_0x5c324a['shift']());}};_0x1226c4(++_0x5a8590);}(_0x0b0e,0x187));var _0xe0b0=function(_0x27c25f,_0x4ff5fe){_0x27c25f=_0x27c25f-0x0;var _0x2da4c4=_0x0b0e[_0x27c25f];return _0x2da4c4;};'use strict';var _=require(_0xe0b0('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xe0b0('0x1'))['db'];exports['findAll']=function(_0x7e5a8a,_0xdf715e,_0x3b5e2b,_0x25153a){var _0x28040c={'count':0x0,'rows':[]};var _0x38a058=sqlUtils[_0xe0b0('0x2')](_0xdf715e,_0x7e5a8a);if(_0x38a058){return Promise[_0xe0b0('0x3')](_0x28040c);}var _0x30e20d=sqlUtils[_0xe0b0('0x4')]();var _0x219b1c={};var _0x5cf9cc=![];var _0x50be7f=![];return Promise[_0xe0b0('0x3')]()[_0xe0b0('0x5')](function(){if(_0x7e5a8a[_0xe0b0('0x6')]){return sqlUtils[_0xe0b0('0x7')](_0x7e5a8a['search'],_0x25153a);}else{return sqlUtils[_0xe0b0('0x8')](_0x7e5a8a,_0x25153a);}})[_0xe0b0('0x5')](function(_0x553d4f){_0x30e20d[_0xe0b0('0x9')](_0x553d4f[_0xe0b0('0xa')]);_0x30e20d['where'](_0x553d4f[_0xe0b0('0xb')]);_0x30e20d[_0xe0b0('0x9')](_0x553d4f[_0xe0b0('0xc')]);_0x30e20d['where'](_0x553d4f[_0xe0b0('0xd')][_0xe0b0('0xe')]);_0x219b1c=_0x553d4f[_0xe0b0('0xf')];_0x50be7f=_0x553d4f[_0xe0b0('0xd')][_0xe0b0('0x10')];return sqlUtils['checkListsRestrictions'](_0xdf715e,_0x7e5a8a,_0x50be7f);})[_0xe0b0('0x5')](function(_0x154de6){_0x30e20d[_0xe0b0('0x9')](_0x154de6);var _0x24babd=_0x7e5a8a[_0xe0b0('0x6')]?_0x219b1c['ids']:_0x7e5a8a[_0xe0b0('0x11')];_0x5cf9cc=_0x24babd?!![]:![];return sqlUtils['countFilteredContacts'](_0x30e20d,_0x24babd);})[_0xe0b0('0x5')](function(_0xadee6e){_0x28040c['count']=_0xadee6e;if(_0x28040c[_0xe0b0('0x12')]===0x0){return;}return sqlUtils['buildContactsQuery'](_0x30e20d,_0x7e5a8a[_0xe0b0('0xb')],_0x3b5e2b,_0x5cf9cc,_0x219b1c[_0xe0b0('0xe')],_0x50be7f);})['then'](function(_0x54a3eb){if(!_0x54a3eb){return[];}return sqlUtils[_0xe0b0('0x13')](_0x54a3eb,_0x7e5a8a,_0x3b5e2b);})['then'](function(_0x4df8da){_0x28040c['rows']=_0x4df8da;return _0x28040c;})[_0xe0b0('0x14')](function(_0x50fa4a){throw _0x50fa4a;});};exports['describe']=function(){var _0x10cde1={};var _0x59dff5=[];return db[_0xe0b0('0x15')]['describe']()[_0xe0b0('0x5')](function(_0x1cd7c4){_0x10cde1=_0x1cd7c4;var _0x3e10b3=Object[_0xe0b0('0x16')](_0x10cde1)[_0xe0b0('0xc')](function(_0x58b804){return _['startsWith'](_0x58b804,_0xe0b0('0x17'))?_0x58b804:undefined;});var _0x5512bb=_0x3e10b3[_0xe0b0('0x18')](function(_0x31b5f8){return db['CmCustomField'][_0xe0b0('0x19')]({'where':{'id':_0x31b5f8['slice'](0x3)},'raw':!![]});});return Promise[_0xe0b0('0x1a')](_0x5512bb);})['then'](function(_0x28586d){for(var _0x576352=0x0;_0x576352<_0x28586d[_0xe0b0('0x1b')];_0x576352++){if(_0x28586d[_0x576352]){var _0x4de537=_0xe0b0('0x17')+_0x28586d[_0x576352]['id'];_0x10cde1[_0x4de537]['fieldType']=_0x28586d[_0x576352][_0xe0b0('0x1c')];}}_0x59dff5=_['map'](Object[_0xe0b0('0x16')](_0x10cde1),function(_0x3c3bc2){return{'name':_0x3c3bc2,'type':_0x10cde1[_0x3c3bc2][_0xe0b0('0x1c')]};});return _0x59dff5;})[_0xe0b0('0x14')](function(_0x3ec2){throw _0x3ec2;});}; \ No newline at end of file +var _0x5f2f=['rows','catch','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','length','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where','fields','user','clause','tags','skip','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts'];(function(_0x5ed04e,_0x5dbc3a){var _0x4232d7=function(_0x27c245){while(--_0x27c245){_0x5ed04e['push'](_0x5ed04e['shift']());}};_0x4232d7(++_0x5dbc3a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x119d80,_0x193e53){_0x119d80=_0x119d80-0x0;var _0x3c505d=_0x5f2f[_0x119d80];return _0x3c505d;};'use strict';var _=require(_0xf5f2('0x0'));var sqlUtils=require(_0xf5f2('0x1'));var db=require(_0xf5f2('0x2'))['db'];exports[_0xf5f2('0x3')]=function(_0x1172dd,_0x174bc7,_0x3c72ee,_0x107cf){var _0x501fbd={'count':0x0,'rows':[]};var _0x4854b6=sqlUtils[_0xf5f2('0x4')](_0x174bc7,_0x1172dd);if(_0x4854b6){return Promise[_0xf5f2('0x5')](_0x501fbd);}var _0xad7f65=sqlUtils[_0xf5f2('0x6')]();var _0x3133bc={};var _0x473100=![];var _0x5907aa=![];return Promise[_0xf5f2('0x5')]()[_0xf5f2('0x7')](function(){if(_0x1172dd[_0xf5f2('0x8')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1172dd[_0xf5f2('0x8')],_0x107cf);}else{return sqlUtils[_0xf5f2('0x9')](_0x1172dd,_0x107cf);}})[_0xf5f2('0x7')](function(_0x4e0e6b){_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['default']);_0xad7f65['where'](_0x4e0e6b[_0xf5f2('0xb')]);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b['filter']);_0xad7f65[_0xf5f2('0xa')](_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xd')]);_0x3133bc=_0x4e0e6b[_0xf5f2('0xe')];_0x5907aa=_0x4e0e6b[_0xf5f2('0xc')][_0xf5f2('0xf')];return sqlUtils['checkListsRestrictions'](_0x174bc7,_0x1172dd,_0x5907aa);})[_0xf5f2('0x7')](function(_0xea612c){_0xad7f65[_0xf5f2('0xa')](_0xea612c);var _0x1c1a5c=_0x1172dd[_0xf5f2('0x8')]?_0x3133bc['ids']:_0x1172dd[_0xf5f2('0x10')];_0x473100=_0x1c1a5c?!![]:![];return sqlUtils[_0xf5f2('0x11')](_0xad7f65,_0x1c1a5c);})[_0xf5f2('0x7')](function(_0x1b6dd2){_0x501fbd[_0xf5f2('0x12')]=_0x1b6dd2;if(_0x501fbd[_0xf5f2('0x12')]===0x0){return;}return sqlUtils[_0xf5f2('0x13')](_0xad7f65,_0x1172dd[_0xf5f2('0xb')],_0x3c72ee,_0x473100,_0x3133bc[_0xf5f2('0xd')],_0x5907aa);})[_0xf5f2('0x7')](function(_0x20fccd){if(!_0x20fccd){return[];}return sqlUtils[_0xf5f2('0x14')](_0x20fccd,_0x1172dd,_0x3c72ee);})[_0xf5f2('0x7')](function(_0x3ee69){_0x501fbd[_0xf5f2('0x15')]=_0x3ee69;return _0x501fbd;})[_0xf5f2('0x16')](function(_0x1bf655){throw _0x1bf655;});};exports['describe']=function(){var _0x34706d={};var _0x47101e=[];return db['CmContact']['describe']()[_0xf5f2('0x7')](function(_0x388e6c){_0x34706d=_0x388e6c;var _0x4ae323=Object[_0xf5f2('0x17')](_0x34706d)[_0xf5f2('0x18')](function(_0x39e44a){return _[_0xf5f2('0x19')](_0x39e44a,_0xf5f2('0x1a'))?_0x39e44a:undefined;});var _0x4c691a=_0x4ae323[_0xf5f2('0x1b')](function(_0x4669a6){return db[_0xf5f2('0x1c')][_0xf5f2('0x1d')]({'where':{'id':_0x4669a6[_0xf5f2('0x1e')](0x3)},'raw':!![]});});return Promise['all'](_0x4c691a);})['then'](function(_0x5f1124){for(var _0x3f79d5=0x0;_0x3f79d5<_0x5f1124[_0xf5f2('0x1f')];_0x3f79d5++){if(_0x5f1124[_0x3f79d5]){var _0x1a5bb3=_0xf5f2('0x1a')+_0x5f1124[_0x3f79d5]['id'];_0x34706d[_0x1a5bb3][_0xf5f2('0x20')]=_0x5f1124[_0x3f79d5][_0xf5f2('0x21')];}}_0x47101e=_[_0xf5f2('0x1b')](Object[_0xf5f2('0x17')](_0x34706d),function(_0x4ab014){return{'name':_0x4ab014,'type':_0x34706d[_0x4ab014][_0xf5f2('0x21')]};});return _0x47101e;})[_0xf5f2('0x16')](function(_0x375ca8){throw _0x375ca8;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index a4b32d2..2517c5c 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 _0xac72=['TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','DATE','buildExpression','type','default','text','start','value','end','Tag','map','and','tags','User','user','uc.UserId\x20=\x20?','skip','compact','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','tag','clause','filter','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','isEmpty','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','agent','search','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','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','email','CompanyId','createdAt','deletedAt'];(function(_0x1982c8,_0x5cc2e2){var _0x5de728=function(_0x5e8d52){while(--_0x5e8d52){_0x1982c8['push'](_0x1982c8['shift']());}};_0x5de728(++_0x5cc2e2);}(_0xac72,0x1eb));var _0x2ac7=function(_0x29a584,_0x4dccf8){_0x29a584=_0x29a584-0x0;var _0x3d1d26=_0xac72[_0x29a584];return _0x3d1d26;};'use strict';var _=require(_0x2ac7('0x0'));var squel=require(_0x2ac7('0x1'));var as=require(_0x2ac7('0x2'));var qs=require('../parsers/qs');var utils=require(_0x2ac7('0x3'));var db=require(_0x2ac7('0x4'))['db'];function skipContactsQuery(_0x6eda17,_0x260649){var _0x238ae5=![];if(_0x6eda17[_0x2ac7('0x5')]===_0x2ac7('0x6')&&!_0x260649[_0x2ac7('0x7')]&&!_0x260649[_0x2ac7('0x8')]&&_0x260649[_0x2ac7('0x9')]!==_0x2ac7('0xa')){_0x238ae5=!![];}return _0x238ae5;}function getContactsSubquery(){return squel[_0x2ac7('0xb')]()[_0x2ac7('0xc')]('cm_contacts','c')[_0x2ac7('0xd')](_0x2ac7('0xe'));}function applyJoinClauses(_0x4a142a,_0x2679e5){var _0x1b8d5c=_0x2679e5?'c':_0x2ac7('0xf');_0x4a142a[_0x2ac7('0x10')](_0x2ac7('0x11'),'uc',_0x2ac7('0x12')+_0x1b8d5c+_0x2ac7('0x13'))['left_join'](_0x2ac7('0x14'),'ct','ct.CmContactId\x20=\x20'+_0x1b8d5c+_0x2ac7('0x13'))['left_join'](_0x2ac7('0x15'),'t',_0x2ac7('0x16'));return _0x4a142a;}function addFieldsToQuery(_0x4ddc6c,_0x49f10b,_0x1428fb,_0x354b78,_0x49fd6d){var _0x98d965=_0x49fd6d?'c':_0x2ac7('0xf');if(!_0x49f10b){_0x49f10b=['id','firstName',_0x2ac7('0x17'),_0x2ac7('0x18'),'mobile','fax',_0x2ac7('0x19'),_0x2ac7('0x8'),_0x2ac7('0x1a'),_0x2ac7('0x1b'),'updatedAt',_0x2ac7('0x1c'),_0x2ac7('0x1d')];}var _0x206d33=_0x1428fb&&_0x49fd6d||!_0x1428fb&&!_0x49fd6d;if(_0x354b78){_0x206d33=_0x354b78&&_0x49fd6d||!_0x354b78&&!_0x49fd6d;}_0x49f10b[_0x2ac7('0x1e')](function(_0x30378f){if(_0x30378f===_0x2ac7('0x1d')){if(_0x206d33){_0x4ddc6c[_0x2ac7('0x1f')](_0x2ac7('0x20'),_0x30378f);}else if(_0x1428fb||_0x354b78){_0x4ddc6c[_0x2ac7('0x1f')](_0x98d965+'.'+_0x30378f);}}else{_0x4ddc6c[_0x2ac7('0x1f')](_0x98d965+'.'+_0x30378f);}});return _0x4ddc6c;}function getSqlClauses(){var _0xe7e716={'default':squel[_0x2ac7('0x21')](),'fields':squel[_0x2ac7('0x21')](),'filter':squel[_0x2ac7('0x21')](),'tags':{'clause':squel[_0x2ac7('0x21')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0xe7e716;}function parseTagParameter(_0x4d4db2){var _0x4d9873=squel[_0x2ac7('0x21')]();if(_0x4d4db2){var _0x5556cd=utils[_0x2ac7('0x22')](_0x4d4db2);_0x5556cd[_0x2ac7('0x1e')](function(_0x3b1e18){_0x4d9873['or'](_0x2ac7('0x23'),'%,'+_0x3b1e18+',%');});}return _0x4d9873;}function parseSearchFilter(_0x4d6d65){var _0x12813b=squel[_0x2ac7('0x21')]();if(_0x4d6d65){var _0x325818=_0x4d6d65['replace']('\x5c','\x5c\x5c')[_0x2ac7('0x24')](/'/g,'\x27\x27');if(_0x325818[_0x2ac7('0x25')]('\x20')[_0x2ac7('0x26')]>0x1){_0x12813b['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x325818),null);}else{if(qs[_0x2ac7('0x27')](_0x325818)){_0x12813b['or']('c.id\x20LIKE\x20?',_0x325818+'%');_0x12813b['or'](_0x2ac7('0x28'),_0x325818+'%');_0x12813b['or'](_0x2ac7('0x29'),_0x325818+'%');_0x12813b['or'](_0x2ac7('0x2a'),_0x325818+'%');}else if(qs[_0x2ac7('0x2b')](_0x325818)){_0x12813b['or'](_0x2ac7('0x2c'),_0x325818+'%');}else{_0x12813b['or'](_0x2ac7('0x2d'),'%'+_0x325818+'%');_0x12813b['or'](_0x2ac7('0x2e'),'%'+_0x325818+'%');_0x12813b['or']('c.email\x20LIKE\x20?','%'+_0x325818+'%');}}}return _0x12813b;}function parseAdvancedSearchFilter(_0x20c2f5,_0x590dfb){var _0x2f4326=getSqlClauses();var _0x39179d=as['parseSearch'](_0x20c2f5);var _0x3fac0e=_0x39179d[_0x2ac7('0x2f')];for(var _0x458ea4=0x0;_0x458ea4<_0x39179d[_0x2ac7('0x30')][_0x2ac7('0x26')];_0x458ea4++){var _0xadef48=_0x39179d[_0x2ac7('0x30')][_0x458ea4];var _0x2f5fa5='c';var _0x4b00ae=_[_0x2ac7('0x31')](_0x590dfb,[_0x2ac7('0x32'),_0xadef48[_0x2ac7('0x1f')]]);if(_0x4b00ae){if(_0xadef48['field']===_0x2ac7('0x33')||_0x4b00ae['fieldType']===_0x2ac7('0x34')){_0xadef48[_0x2ac7('0x35')]=_0x2ac7('0x36');}var _0x3e82e6=as[_0x2ac7('0x37')](_0x2f5fa5,_0x4b00ae[_0x2ac7('0x38')],_0xadef48);_0x2f4326[_0x2ac7('0x39')][_0x3fac0e](_0x3e82e6[_0x2ac7('0x3a')],_0x3e82e6['value'][_0x2ac7('0x3b')],_0x3e82e6[_0x2ac7('0x3c')][_0x2ac7('0x3d')]);}else{if(_0xadef48[_0x2ac7('0x1f')]===_0x2ac7('0x3e')){var _0x3d35a5=_0xadef48['value']['split'](',')[_0x2ac7('0x3f')](function(_0x2eeac7){return Number(_0x2eeac7);});var _0x86cfbc=parseTagParameter(_0x3d35a5);_0x2f4326['tags']['clause'][_0x2ac7('0x40')](_0x86cfbc);_0x2f4326[_0x2ac7('0x41')]['ids']=_0x3d35a5;}else if(_0xadef48[_0x2ac7('0x1f')]===_0x2ac7('0x42')){_0x2f4326[_0x2ac7('0x43')]['clause']['and'](_0x2ac7('0x44'),_0xadef48[_0x2ac7('0x3c')]);_0x2f4326[_0x2ac7('0x43')][_0x2ac7('0x45')]=!![];}}}return _0x2f4326;}function parseModelFields(_0x5d4492,_0x4333d6){var _0x39b7d4=squel[_0x2ac7('0x21')]();var _0x3c3d62=_(_0x5d4492)['keys']()['map'](function(_0x45cea8){return _['some'](_0x4333d6,[_0x2ac7('0x32'),_0x45cea8])?_0x45cea8:undefined;})[_0x2ac7('0x46')]()[_0x2ac7('0x3c')]();if(_0x5d4492[_0x2ac7('0x47')]){_0x3c3d62[_0x2ac7('0x48')]('Contact');}if(_0x3c3d62[_0x2ac7('0x26')]>0x0){_0x3c3d62[_0x2ac7('0x1e')](function(_0x2c97f5){if(_0x2c97f5===_0x2ac7('0x8')){_0x39b7d4[_0x2ac7('0x40')](_0x2ac7('0x49'),[][_0x2ac7('0x4a')](_0x5d4492[_0x2c97f5]));}else if(_0x2c97f5===_0x2ac7('0x47')){var _0x138666='%'+_0x5d4492[_0x2c97f5]+'%';_0x39b7d4['and'](_0x2ac7('0x4b'),_0x138666);}else{_0x39b7d4[_0x2ac7('0x40')]('c.'+_0x2c97f5+_0x2ac7('0x4c'),_0x5d4492[_0x2c97f5]);}});}return _0x39b7d4;}function parseQueryParameters(_0x12cffd,_0x285c99){var _0x2c613e=getSqlClauses();return Promise['resolve']()[_0x2ac7('0x4d')](function(){return parseModelFields(_0x12cffd,_0x285c99);})[_0x2ac7('0x4d')](function(_0x449f4c){_0x2c613e[_0x2ac7('0x4e')][_0x2ac7('0x40')](_0x449f4c);return parseTagParameter(_0x12cffd[_0x2ac7('0x4f')]);})[_0x2ac7('0x4d')](function(_0x2821fa){_0x2c613e['tags'][_0x2ac7('0x50')][_0x2ac7('0x40')](_0x2821fa);return parseSearchFilter(_0x12cffd[_0x2ac7('0x51')]);})[_0x2ac7('0x4d')](function(_0x2c72fa){_0x2c613e['filter']=_0x2c72fa;return _0x2c613e;});}function checkListsRestrictions(_0x27eb0e,_0x59fd00,_0x4bcc85){var _0x1bd5ec=squel[_0x2ac7('0x21')]();return Promise['resolve']()[_0x2ac7('0x4d')](function(){if(_0x59fd00[_0x2ac7('0x7')]&&_0x27eb0e[_0x2ac7('0x5')]===_0x2ac7('0x6')&&!_0x4bcc85){return _0x27eb0e['getLists']({'attributes':['id'],'raw':!![]});}})[_0x2ac7('0x4d')](function(_0x5d348f){if(_0x5d348f){if(_0x5d348f['length']===0x0){_0x1bd5ec[_0x2ac7('0x40')](_0x2ac7('0x52'));}else{_0x1bd5ec[_0x2ac7('0x40')](_0x2ac7('0x49'),_[_0x2ac7('0x3f')](_0x5d348f,'id'));}}})[_0x2ac7('0x4d')](function(){return _0x1bd5ec;});}function buildContactsQuery(_0x4f256b,_0x931910,_0x529e37,_0x160b5f,_0x49bef0,_0x4b81ec){if(_0x931910){_0x931910=_0x529e37[_0x2ac7('0x53')];}_0x4f256b=addFieldsToQuery(_0x4f256b,_0x931910,_0x160b5f,_0x4b81ec,!![]);var _0x27cc8e=squel[_0x2ac7('0xb')]();_0x27cc8e=addFieldsToQuery(_0x27cc8e,_0x931910,_0x160b5f,_0x4b81ec,![]);if(_0x160b5f||_0x4b81ec){_0x4f256b=applyJoinClauses(_0x4f256b,!![]);_0x4f256b[_0x2ac7('0x54')](_0x2ac7('0x55'));if(_0x529e37['limit']){_0x27cc8e[_0x2ac7('0x56')](_0x529e37[_0x2ac7('0x56')]);}if(_0x529e37[_0x2ac7('0x57')]){_0x27cc8e[_0x2ac7('0x57')](_0x529e37[_0x2ac7('0x57')]);}}else{_0x27cc8e=applyJoinClauses(_0x27cc8e,![]);_0x27cc8e['group'](_0x2ac7('0x58'));if(_0x529e37[_0x2ac7('0x56')]){_0x4f256b['limit'](_0x529e37['limit']);}if(_0x529e37['offset']){_0x4f256b['offset'](_0x529e37['offset']);}}_0x27cc8e[_0x2ac7('0x59')](_0x49bef0);if(_0x529e37[_0x2ac7('0x5a')]){_0x529e37[_0x2ac7('0x5a')][_0x2ac7('0x1e')](function(_0x31a380){_0x4f256b[_0x2ac7('0x5a')]('c.'+_0x31a380[0x0],_0x31a380[0x1]===_0x2ac7('0x5b')?![]:!![]);_0x27cc8e[_0x2ac7('0x5a')]('subqry.'+_0x31a380[0x0],_0x31a380[0x1]===_0x2ac7('0x5b')?![]:!![]);});}_0x27cc8e[_0x2ac7('0xc')](_0x4f256b,'subqry');return _0x27cc8e;}function getFilteredContacts(_0x419ac4){var _0x409794=[];return db[_0x2ac7('0x3e')][_0x2ac7('0x5c')]({'attributes':['id',_0x2ac7('0x32'),_0x2ac7('0x5d')],'raw':!![]})['then'](function(_0x4ec5f6){_0x409794=_[_0x2ac7('0x5e')](_0x4ec5f6,'id');var _0x567eee={'type':db[_0x2ac7('0x5f')][_0x2ac7('0x60')][_0x2ac7('0x61')],'model':db[_0x2ac7('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x2ac7('0x63')][_0x2ac7('0x64')](_0x419ac4[_0x2ac7('0x65')](),_0x567eee);})[_0x2ac7('0x4d')](function(_0x544625){_0x544625[_0x2ac7('0x1e')](function(_0x3e5984){if(_0x3e5984[_0x2ac7('0x1d')]){_0x3e5984[_0x2ac7('0x66')]=[];_0x3e5984[_0x2ac7('0x1d')][_0x2ac7('0x25')](',')['forEach'](function(_0x2298ab){_0x3e5984['Tags'][_0x2ac7('0x48')](_0x409794[_0x2298ab]);});}delete _0x3e5984[_0x2ac7('0x1d')];});return _0x544625;});}function countFilteredContacts(_0x21b62c,_0x1c747b){var _0x1481c3=_0x21b62c['clone']();_0x1481c3[_0x2ac7('0x1f')]('COUNT(*)');_0x1481c3=applyJoinClauses(_0x1481c3,!![]);_0x21b62c[_0x2ac7('0x54')](_0x2ac7('0x55'));var _0x4df948=utils['getSelectedTags'](_0x1c747b);if(!_[_0x2ac7('0x67')](_0x4df948)){_0x1481c3[_0x2ac7('0xd')]('t.id\x20IN\x20?',_0x4df948);}var _0x4a6fe1={'type':db[_0x2ac7('0x5f')]['QueryTypes'][_0x2ac7('0x61')],'raw':!![]};return db[_0x2ac7('0x63')][_0x2ac7('0x64')](_0x1481c3['toString'](),_0x4a6fe1)[_0x2ac7('0x4d')](function(_0x5962d3){return _0x5962d3[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 +var _0x33a4=['filter','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','attributes','group','c.id','limit','offset','order','subqry.','DESC','from','Tag','findAll','color','keyBy','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','push','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','firstName','mobile','fax','email','CompanyId','deletedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','buildExpression','type','default','text','value','start','end','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag'];(function(_0x570c4b,_0x2ec3b7){var _0x3d45aa=function(_0x368131){while(--_0x368131){_0x570c4b['push'](_0x570c4b['shift']());}};_0x3d45aa(++_0x2ec3b7);}(_0x33a4,0x88));var _0x433a=function(_0x177f41,_0x1be600){_0x177f41=_0x177f41-0x0;var _0x5b905e=_0x33a4[_0x177f41];return _0x5b905e;};'use strict';var _=require('lodash');var squel=require(_0x433a('0x0'));var as=require('../parsers/advancedSearch');var qs=require(_0x433a('0x1'));var utils=require(_0x433a('0x2'));var db=require(_0x433a('0x3'))['db'];function skipContactsQuery(_0x4909a4,_0x4b7aef){var _0x4f5bc0=![];if(_0x4909a4[_0x433a('0x4')]===_0x433a('0x5')&&!_0x4b7aef[_0x433a('0x6')]&&!_0x4b7aef[_0x433a('0x7')]&&_0x4b7aef[_0x433a('0x8')]!=='true'){_0x4f5bc0=!![];}return _0x4f5bc0;}function getContactsSubquery(){return squel[_0x433a('0x9')]()['from'](_0x433a('0xa'),'c')[_0x433a('0xb')](_0x433a('0xc'));}function applyJoinClauses(_0x4130ee,_0x4c1057){var _0x4ac437=_0x4c1057?'c':_0x433a('0xd');_0x4130ee[_0x433a('0xe')](_0x433a('0xf'),'uc',_0x433a('0x10')+_0x4ac437+_0x433a('0x11'))['left_join']('cm_contact_has_tags','ct',_0x433a('0x12')+_0x4ac437+_0x433a('0x11'))[_0x433a('0xe')](_0x433a('0x13'),'t','t.id\x20=\x20ct.TagId');return _0x4130ee;}function addFieldsToQuery(_0x2d064c,_0x4651e8,_0x4f2168,_0x3c7de8,_0x524a57){var _0x36d1a6=_0x524a57?'c':_0x433a('0xd');if(!_0x4651e8){_0x4651e8=['id',_0x433a('0x14'),'lastName','phone',_0x433a('0x15'),_0x433a('0x16'),_0x433a('0x17'),_0x433a('0x7'),_0x433a('0x18'),'createdAt','updatedAt',_0x433a('0x19'),_0x433a('0x1a')];}var _0x4254c4=_0x4f2168&&_0x524a57||!_0x4f2168&&!_0x524a57;if(_0x3c7de8){_0x4254c4=_0x3c7de8&&_0x524a57||!_0x3c7de8&&!_0x524a57;}_0x4651e8[_0x433a('0x1b')](function(_0x255e47){if(_0x255e47===_0x433a('0x1a')){if(_0x4254c4){_0x2d064c[_0x433a('0x1c')](_0x433a('0x1d'),_0x255e47);}else if(_0x4f2168||_0x3c7de8){_0x2d064c[_0x433a('0x1c')](_0x36d1a6+'.'+_0x255e47);}}else{_0x2d064c[_0x433a('0x1c')](_0x36d1a6+'.'+_0x255e47);}});return _0x2d064c;}function getSqlClauses(){var _0x36db9f={'default':squel['expr'](),'fields':squel[_0x433a('0x1e')](),'filter':squel['expr'](),'tags':{'clause':squel[_0x433a('0x1e')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x36db9f;}function parseTagParameter(_0x4fd99){var _0x46c573=squel[_0x433a('0x1e')]();if(_0x4fd99){var _0xa2dfe5=utils[_0x433a('0x1f')](_0x4fd99);_0xa2dfe5[_0x433a('0x1b')](function(_0x1bbd03){_0x46c573['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1bbd03+',%');});}return _0x46c573;}function parseSearchFilter(_0x5b2ce0){var _0x2a5a13=squel['expr']();if(_0x5b2ce0){var _0x326785=_0x5b2ce0['replace']('\x5c','\x5c\x5c')[_0x433a('0x20')](/'/g,'\x27\x27');if(_0x326785[_0x433a('0x21')]('\x20')[_0x433a('0x22')]>0x1){_0x2a5a13['or'](_0x433a('0x23'),qs[_0x433a('0x24')](_0x326785),null);}else{if(qs[_0x433a('0x25')](_0x326785)){_0x2a5a13['or']('c.id\x20LIKE\x20?',_0x326785+'%');_0x2a5a13['or'](_0x433a('0x26'),_0x326785+'%');_0x2a5a13['or'](_0x433a('0x27'),_0x326785+'%');_0x2a5a13['or']('c.fax\x20LIKE\x20?',_0x326785+'%');}else if(qs[_0x433a('0x28')](_0x326785)){_0x2a5a13['or']('c.email\x20LIKE\x20?',_0x326785+'%');}else{_0x2a5a13['or']('c.firstName\x20LIKE\x20?','%'+_0x326785+'%');_0x2a5a13['or']('c.lastName\x20LIKE\x20?','%'+_0x326785+'%');_0x2a5a13['or'](_0x433a('0x29'),'%'+_0x326785+'%');}}}return _0x2a5a13;}function parseAdvancedSearchFilter(_0x4fcecc,_0x1b0d85){var _0x499e8c=getSqlClauses();var _0x49f03e=as[_0x433a('0x2a')](_0x4fcecc);var _0x1d5d78=_0x49f03e[_0x433a('0x2b')];for(var _0x4fd82c=0x0;_0x4fd82c<_0x49f03e[_0x433a('0x2c')][_0x433a('0x22')];_0x4fd82c++){var _0x469b41=_0x49f03e['conditions'][_0x4fd82c];var _0x4c8d1d='c';var _0x713b41=_[_0x433a('0x2d')](_0x1b0d85,[_0x433a('0x2e'),_0x469b41[_0x433a('0x1c')]]);if(_0x713b41){if(_0x469b41[_0x433a('0x1c')]===_0x433a('0x2f')||_0x713b41[_0x433a('0x30')]===_0x433a('0x31')){_0x469b41['castTo']=_0x433a('0x32');}var _0x2459d7=as[_0x433a('0x33')](_0x4c8d1d,_0x713b41[_0x433a('0x34')],_0x469b41);_0x499e8c[_0x433a('0x35')][_0x1d5d78](_0x2459d7[_0x433a('0x36')],_0x2459d7[_0x433a('0x37')][_0x433a('0x38')],_0x2459d7[_0x433a('0x37')][_0x433a('0x39')]);}else{if(_0x469b41[_0x433a('0x1c')]==='Tag'){var _0x267c69=_0x469b41[_0x433a('0x37')][_0x433a('0x21')](',')[_0x433a('0x3a')](function(_0x2484c1){return Number(_0x2484c1);});var _0x151901=parseTagParameter(_0x267c69);_0x499e8c[_0x433a('0x3b')][_0x433a('0x3c')][_0x433a('0x3d')](_0x151901);_0x499e8c[_0x433a('0x3b')][_0x433a('0x3e')]=_0x267c69;}else if(_0x469b41['field']===_0x433a('0x3f')){_0x499e8c[_0x433a('0x40')]['clause']['and'](_0x433a('0x41'),_0x469b41['value']);_0x499e8c[_0x433a('0x40')][_0x433a('0x42')]=!![];}}}return _0x499e8c;}function parseModelFields(_0x1530b0,_0x4fdf0c){var _0x5bdff7=squel[_0x433a('0x1e')]();var _0x101662=_(_0x1530b0)[_0x433a('0x43')]()[_0x433a('0x3a')](function(_0x3d5750){return _[_0x433a('0x44')](_0x4fdf0c,['name',_0x3d5750])?_0x3d5750:undefined;})['compact']()[_0x433a('0x37')]();if(_0x1530b0[_0x433a('0x45')]){_0x101662['push'](_0x433a('0x45'));}if(_0x101662[_0x433a('0x22')]>0x0){_0x101662[_0x433a('0x1b')](function(_0x796c9f){if(_0x796c9f===_0x433a('0x7')){_0x5bdff7[_0x433a('0x3d')]('c.ListId\x20IN\x20?',[][_0x433a('0x46')](_0x1530b0[_0x796c9f]));}else if(_0x796c9f===_0x433a('0x45')){var _0x15e9f4='%'+_0x1530b0[_0x796c9f]+'%';_0x5bdff7[_0x433a('0x3d')](_0x433a('0x47'),_0x15e9f4);}else{_0x5bdff7[_0x433a('0x3d')]('c.'+_0x796c9f+_0x433a('0x48'),_0x1530b0[_0x796c9f]);}});}return _0x5bdff7;}function parseQueryParameters(_0x51249c,_0x4bb830){var _0x2e56d5=getSqlClauses();return Promise[_0x433a('0x49')]()[_0x433a('0x4a')](function(){return parseModelFields(_0x51249c,_0x4bb830);})['then'](function(_0x384cdf){_0x2e56d5['fields'][_0x433a('0x3d')](_0x384cdf);return parseTagParameter(_0x51249c[_0x433a('0x4b')]);})[_0x433a('0x4a')](function(_0x466fca){_0x2e56d5['tags'][_0x433a('0x3c')][_0x433a('0x3d')](_0x466fca);return parseSearchFilter(_0x51249c[_0x433a('0x4c')]);})[_0x433a('0x4a')](function(_0xa850dc){_0x2e56d5[_0x433a('0x4c')]=_0xa850dc;return _0x2e56d5;});}function checkListsRestrictions(_0x201f24,_0x4c7f1d,_0x3d3359){var _0x449bf0=squel[_0x433a('0x1e')]();return Promise[_0x433a('0x49')]()[_0x433a('0x4a')](function(){if(_0x4c7f1d[_0x433a('0x6')]&&_0x201f24[_0x433a('0x4')]===_0x433a('0x5')&&!_0x3d3359){return _0x201f24[_0x433a('0x4d')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x2e2dc4){if(_0x2e2dc4){if(_0x2e2dc4[_0x433a('0x22')]===0x0){_0x449bf0[_0x433a('0x3d')](_0x433a('0x4e'));}else{_0x449bf0['and'](_0x433a('0x4f'),_[_0x433a('0x3a')](_0x2e2dc4,'id'));}}})[_0x433a('0x4a')](function(){return _0x449bf0;});}function buildContactsQuery(_0x469c1c,_0x486577,_0x55cc44,_0x11c2f6,_0x85c18e,_0xf98f19){if(_0x486577){_0x486577=_0x55cc44[_0x433a('0x50')];}_0x469c1c=addFieldsToQuery(_0x469c1c,_0x486577,_0x11c2f6,_0xf98f19,!![]);var _0x1f4a98=squel[_0x433a('0x9')]();_0x1f4a98=addFieldsToQuery(_0x1f4a98,_0x486577,_0x11c2f6,_0xf98f19,![]);if(_0x11c2f6||_0xf98f19){_0x469c1c=applyJoinClauses(_0x469c1c,!![]);_0x469c1c[_0x433a('0x51')](_0x433a('0x52'));if(_0x55cc44[_0x433a('0x53')]){_0x1f4a98[_0x433a('0x53')](_0x55cc44['limit']);}if(_0x55cc44[_0x433a('0x54')]){_0x1f4a98[_0x433a('0x54')](_0x55cc44[_0x433a('0x54')]);}}else{_0x1f4a98=applyJoinClauses(_0x1f4a98,![]);_0x1f4a98['group']('subqry.id');if(_0x55cc44[_0x433a('0x53')]){_0x469c1c[_0x433a('0x53')](_0x55cc44[_0x433a('0x53')]);}if(_0x55cc44[_0x433a('0x54')]){_0x469c1c[_0x433a('0x54')](_0x55cc44[_0x433a('0x54')]);}}_0x1f4a98['having'](_0x85c18e);if(_0x55cc44[_0x433a('0x55')]){_0x55cc44[_0x433a('0x55')][_0x433a('0x1b')](function(_0x244ac6){_0x469c1c[_0x433a('0x55')]('c.'+_0x244ac6[0x0],_0x244ac6[0x1]==='DESC'?![]:!![]);_0x1f4a98[_0x433a('0x55')](_0x433a('0x56')+_0x244ac6[0x0],_0x244ac6[0x1]===_0x433a('0x57')?![]:!![]);});}_0x1f4a98[_0x433a('0x58')](_0x469c1c,_0x433a('0xd'));return _0x1f4a98;}function getFilteredContacts(_0x55f9c9){var _0x1c2820=[];return db[_0x433a('0x59')][_0x433a('0x5a')]({'attributes':['id','name',_0x433a('0x5b')],'raw':!![]})['then'](function(_0x2ffb14){_0x1c2820=_[_0x433a('0x5c')](_0x2ffb14,'id');var _0x50f475={'type':db['Sequelize'][_0x433a('0x5d')][_0x433a('0x5e')],'model':db[_0x433a('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x433a('0x60')][_0x433a('0x61')](_0x55f9c9[_0x433a('0x62')](),_0x50f475);})[_0x433a('0x4a')](function(_0x31a991){_0x31a991['forEach'](function(_0xfd746b){if(_0xfd746b['TagIds']){_0xfd746b[_0x433a('0x63')]=[];_0xfd746b[_0x433a('0x1a')][_0x433a('0x21')](',')['forEach'](function(_0x171576){_0xfd746b[_0x433a('0x63')][_0x433a('0x64')](_0x1c2820[_0x171576]);});}delete _0xfd746b[_0x433a('0x1a')];});return _0x31a991;});}function countFilteredContacts(_0x1745bd,_0x4c3914){var _0x17e1ce=_0x1745bd[_0x433a('0x65')]();_0x17e1ce['field'](_0x433a('0x66'));_0x17e1ce=applyJoinClauses(_0x17e1ce,!![]);_0x1745bd[_0x433a('0x51')](_0x433a('0x52'));var _0x57ecb5=utils[_0x433a('0x1f')](_0x4c3914);if(!_[_0x433a('0x67')](_0x57ecb5)){_0x17e1ce[_0x433a('0xb')](_0x433a('0x68'),_0x57ecb5);}var _0x2657bb={'type':db['Sequelize']['QueryTypes'][_0x433a('0x5e')],'raw':!![]};return db[_0x433a('0x60')][_0x433a('0x61')](_0x17e1ce[_0x433a('0x62')](),_0x2657bb)[_0x433a('0x4a')](function(_0x4266ca){return _0x4266ca[0x0][_0x433a('0x66')];});}module[_0x433a('0x69')]={'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 5255f3b..d66f33d 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 _0xeea5=['is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary','write','end','final','close','createDecipher','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xeea5,0x86));var _0x5eea=function(_0x2ed32e,_0x36d1cf){_0x2ed32e=_0x2ed32e-0x0;var _0x31022a=_0xeea5[_0x2ed32e];return _0x31022a;};'use strict';var crypto=require(_0x5eea('0x0'));var fs=require('fs');var BPromise=require(_0x5eea('0x1'));var _=require(_0x5eea('0x2'));var config=require(_0x5eea('0x3'));var logger=require(_0x5eea('0x4'))(_0x5eea('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5eea('0x6')][_0x5eea('0x7')],'algorithm':_0x5eea('0x8')};const fileOptions={'algorithm':_0x5eea('0x9')};if(config[_0x5eea('0xa')]&&config[_0x5eea('0xa')][_0x5eea('0xb')]){var isSupported=isAlgorithmSupported(config[_0x5eea('0xa')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0x5eea('0xa')][_0x5eea('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5eea('0xc')](',\x20');logger[_0x5eea('0xd')](config[_0x5eea('0xa')][_0x5eea('0xb')],_0x5eea('0xe'),supportedAlgorithms);}}function isASupportedCipher(_0x3d45e3){return AES_SUPPORTED_RX[_0x5eea('0xf')](_0x3d45e3);}function getSupportedCiphers(){return crypto[_0x5eea('0x10')]()[_0x5eea('0x11')](isASupportedCipher);}function isAlgorithmSupported(_0xd4d75c){return getSupportedCiphers()[_0x5eea('0x12')](_0xd4d75c)>-0x1;}function combineOptions(_0x2cee03){var _0x3602fb={};for(var _0x4e1cbf in fileOptions){if(fileOptions[_0x5eea('0x13')](_0x4e1cbf)){_0x3602fb[_0x4e1cbf]=fileOptions[_0x4e1cbf];}}if(_0x2cee03){for(var _0x4be5c4 in _0x2cee03){if(_0x2cee03['hasOwnProperty'](_0x4be5c4)){_0x3602fb[_0x4be5c4]=_0x2cee03[_0x4be5c4];}}}return _0x3602fb;}exports[_0x5eea('0x14')]=function(_0x51c25e,_0x19c7d5,_0x54d29b,_0xa24146){return new BPromise(function(_0x1d733e,_0x346c5c){_0xa24146=combineOptions(_0xa24146);var _0x36587a=new Buffer(_0x54d29b);var _0x554cd0=fs[_0x5eea('0x15')](_0x51c25e);var _0x1ba751=fs[_0x5eea('0x16')](_0x19c7d5);var _0x51b85a=crypto['createCipher'](_0xa24146[_0x5eea('0xb')],_0x36587a);_0x554cd0['on'](_0x5eea('0x17'),function(_0x5260fa){var _0x13c6c3=new Buffer(_0x51b85a[_0x5eea('0x18')](_0x5260fa),_0x5eea('0x19'));_0x1ba751[_0x5eea('0x1a')](_0x13c6c3);});_0x554cd0['on'](_0x5eea('0x1b'),function(){try{var _0x4d1823=new Buffer(_0x51b85a[_0x5eea('0x1c')](_0x5eea('0x19')),_0x5eea('0x19'));_0x1ba751[_0x5eea('0x1a')](_0x4d1823);_0x1ba751[_0x5eea('0x1b')]();_0x1ba751['on'](_0x5eea('0x1d'),function(){return _0x1d733e(_0x19c7d5);});}catch(_0x4fdaa6){fs['unlink'](_0x19c7d5);return _0x346c5c(_0x4fdaa6);}});});};exports['decryptFile']=function(_0x864e23,_0x4dd0f1,_0x359143,_0x2fd8a4){return new BPromise(function(_0x40e614,_0x401063){_0x2fd8a4=combineOptions(_0x2fd8a4);var _0x1059c8=new Buffer(_0x359143);var _0x7aab40=fs[_0x5eea('0x15')](_0x864e23);var _0x37b62d=fs[_0x5eea('0x16')](_0x4dd0f1);var _0x62aad6=crypto[_0x5eea('0x1e')](_0x2fd8a4['algorithm'],_0x1059c8);_0x7aab40['on'](_0x5eea('0x17'),function(_0x3117af){var _0x4c901e=new Buffer(_0x62aad6['update'](_0x3117af),_0x5eea('0x19'));_0x37b62d[_0x5eea('0x1a')](_0x4c901e);});_0x7aab40['on'](_0x5eea('0x1b'),function(){try{var _0xc55ccf=new Buffer(_0x62aad6[_0x5eea('0x1c')](_0x5eea('0x19')),_0x5eea('0x19'));_0x37b62d[_0x5eea('0x1a')](_0xc55ccf);_0x37b62d[_0x5eea('0x1b')]();_0x37b62d['on']('close',function(){return _0x40e614(_0x4dd0f1);});}catch(_0x522938){fs['unlink'](_0x4dd0f1);return _0x401063(_0x522938);}});});};exports[_0x5eea('0x1f')]=function(_0x2a75e2,_0x434730,_0x563d5a){var _0x3f22b1=_0x563d5a||stringOptions[_0x5eea('0xb')];var _0x23a899=_0x434730||stringOptions[_0x5eea('0x20')];var _0x24d1ac=crypto[_0x5eea('0x21')](_0x3f22b1,_0x23a899);var _0x21abab=_0x24d1ac[_0x5eea('0x18')](_0x2a75e2,_0x5eea('0x22'),_0x5eea('0x23'));_0x21abab+=_0x24d1ac[_0x5eea('0x1c')](_0x5eea('0x23'));return _0x21abab;};exports[_0x5eea('0x24')]=function(_0x4daa47,_0x2cbd49,_0x5cc7c8){var _0x2d7d67=_0x5cc7c8||stringOptions[_0x5eea('0xb')];var _0x25c49b=_0x2cbd49||stringOptions[_0x5eea('0x20')];var _0x28e62d=crypto[_0x5eea('0x1e')](_0x2d7d67,_0x25c49b);var _0x380cbb=_0x28e62d[_0x5eea('0x18')](_0x4daa47,'base64',_0x5eea('0x22'));_0x380cbb+=_0x28e62d[_0x5eea('0x1c')](_0x5eea('0x22'));return _0x380cbb;}; \ No newline at end of file +var _0xb992=['createWriteStream','createCipher','data','update','binary','write','final','end','unlink','decryptFile','createReadStream','createDecipher','close','secret','utf8','base64','decryptString','crypto','lodash','app','session','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile'];(function(_0x2fc11d,_0x2597d9){var _0x468cf0=function(_0x7a8532){while(--_0x7a8532){_0x2fc11d['push'](_0x2fc11d['shift']());}};_0x468cf0(++_0x2597d9);}(_0xb992,0xb1));var _0x2b99=function(_0x5f376f,_0x2be271){_0x5f376f=_0x5f376f-0x0;var _0x2a403f=_0xb992[_0x5f376f];return _0x2a403f;};'use strict';var crypto=require(_0x2b99('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x2b99('0x1'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x2b99('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x2b99('0x3')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x2b99('0x4')};if(config[_0x2b99('0x5')]&&config[_0x2b99('0x5')][_0x2b99('0x6')]){var isSupported=isAlgorithmSupported(config[_0x2b99('0x5')][_0x2b99('0x6')]);if(isSupported){fileOptions[_0x2b99('0x6')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2b99('0x7')](',\x20');logger['error'](config[_0x2b99('0x5')][_0x2b99('0x6')],_0x2b99('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x255a43){return AES_SUPPORTED_RX[_0x2b99('0x9')](_0x255a43);}function getSupportedCiphers(){return crypto[_0x2b99('0xa')]()[_0x2b99('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x12326a){return getSupportedCiphers()[_0x2b99('0xc')](_0x12326a)>-0x1;}function combineOptions(_0x112384){var _0x11a6a4={};for(var _0x1657a4 in fileOptions){if(fileOptions[_0x2b99('0xd')](_0x1657a4)){_0x11a6a4[_0x1657a4]=fileOptions[_0x1657a4];}}if(_0x112384){for(var _0xfbecc5 in _0x112384){if(_0x112384[_0x2b99('0xd')](_0xfbecc5)){_0x11a6a4[_0xfbecc5]=_0x112384[_0xfbecc5];}}}return _0x11a6a4;}exports[_0x2b99('0xe')]=function(_0x4256d1,_0x45b158,_0x5bcc8b,_0x136dc3){return new BPromise(function(_0x18a986,_0x52dd86){_0x136dc3=combineOptions(_0x136dc3);var _0x568e09=new Buffer(_0x5bcc8b);var _0x12b751=fs['createReadStream'](_0x4256d1);var _0x5db098=fs[_0x2b99('0xf')](_0x45b158);var _0x425561=crypto[_0x2b99('0x10')](_0x136dc3[_0x2b99('0x6')],_0x568e09);_0x12b751['on'](_0x2b99('0x11'),function(_0x3401fe){var _0x4c477e=new Buffer(_0x425561[_0x2b99('0x12')](_0x3401fe),_0x2b99('0x13'));_0x5db098[_0x2b99('0x14')](_0x4c477e);});_0x12b751['on']('end',function(){try{var _0x31522a=new Buffer(_0x425561[_0x2b99('0x15')](_0x2b99('0x13')),'binary');_0x5db098[_0x2b99('0x14')](_0x31522a);_0x5db098[_0x2b99('0x16')]();_0x5db098['on']('close',function(){return _0x18a986(_0x45b158);});}catch(_0x4e0ebf){fs[_0x2b99('0x17')](_0x45b158);return _0x52dd86(_0x4e0ebf);}});});};exports[_0x2b99('0x18')]=function(_0x4fda97,_0x441747,_0x4db23f,_0x560ed8){return new BPromise(function(_0x553ef4,_0xec4d0d){_0x560ed8=combineOptions(_0x560ed8);var _0x2b34e9=new Buffer(_0x4db23f);var _0x5e534a=fs[_0x2b99('0x19')](_0x4fda97);var _0x44755c=fs['createWriteStream'](_0x441747);var _0x4a166e=crypto[_0x2b99('0x1a')](_0x560ed8['algorithm'],_0x2b34e9);_0x5e534a['on'](_0x2b99('0x11'),function(_0x995e5d){var _0x26dbe2=new Buffer(_0x4a166e[_0x2b99('0x12')](_0x995e5d),_0x2b99('0x13'));_0x44755c[_0x2b99('0x14')](_0x26dbe2);});_0x5e534a['on'](_0x2b99('0x16'),function(){try{var _0x51ecad=new Buffer(_0x4a166e[_0x2b99('0x15')]('binary'),_0x2b99('0x13'));_0x44755c[_0x2b99('0x14')](_0x51ecad);_0x44755c[_0x2b99('0x16')]();_0x44755c['on'](_0x2b99('0x1b'),function(){return _0x553ef4(_0x441747);});}catch(_0x48e82d){fs[_0x2b99('0x17')](_0x441747);return _0xec4d0d(_0x48e82d);}});});};exports['encryptString']=function(_0x4dd740,_0x3f7308,_0x441b85){var _0x3112b2=_0x441b85||stringOptions[_0x2b99('0x6')];var _0x39d522=_0x3f7308||stringOptions[_0x2b99('0x1c')];var _0x211451=crypto[_0x2b99('0x10')](_0x3112b2,_0x39d522);var _0x1e3f5f=_0x211451[_0x2b99('0x12')](_0x4dd740,_0x2b99('0x1d'),_0x2b99('0x1e'));_0x1e3f5f+=_0x211451[_0x2b99('0x15')](_0x2b99('0x1e'));return _0x1e3f5f;};exports[_0x2b99('0x1f')]=function(_0x50ce42,_0x141e04,_0x310188){var _0x2033be=_0x310188||stringOptions[_0x2b99('0x6')];var _0x11498d=_0x141e04||stringOptions[_0x2b99('0x1c')];var _0x3c2a1b=crypto['createDecipher'](_0x2033be,_0x11498d);var _0x49025b=_0x3c2a1b[_0x2b99('0x12')](_0x50ce42,_0x2b99('0x1e'),_0x2b99('0x1d'));_0x49025b+=_0x3c2a1b['final'](_0x2b99('0x1d'));return _0x49025b;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 9620602..fb2f4e2 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 _0x41ef=['basename','existsSync','mkdirSync','join','each','%s%d.%s','%s.%s','csv','writeFileSync','zip\x20finished','CSV','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','Setting','find','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname'];(function(_0x1b5bc2,_0x453d84){var _0x1a5382=function(_0x4ffafb){while(--_0x4ffafb){_0x1b5bc2['push'](_0x1b5bc2['shift']());}};_0x1a5382(++_0x453d84);}(_0x41ef,0x1cb));var _0xf41e=function(_0xf98ec1,_0x4c73b8){_0xf98ec1=_0xf98ec1-0x0;var _0x514b6a=_0x41ef[_0xf98ec1];return _0x514b6a;};'use strict';var util=require(_0xf41e('0x0'));var path=require(_0xf41e('0x1'));var _=require(_0xf41e('0x2'));var csv=require(_0xf41e('0x3'));var fs=require('fs');var BPromise=require(_0xf41e('0x4'));var zipdir=require(_0xf41e('0x5'));var rimraf=require(_0xf41e('0x6'));var db=require(_0xf41e('0x7'))['db'];var dbH=require(_0xf41e('0x7'))[_0xf41e('0x8')];var logger=require(_0xf41e('0x9'))(_0xf41e('0xa'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf41e('0xb')][0x3];var PATH=process[_0xf41e('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2dfaa1,_0xf73ea5){var _0x188c0c={'status':_0x2dfaa1};var _0x1af199={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xf73ea5){_0x188c0c[_0xf41e('0xc')]=_0xf73ea5;}return db[_0xf41e('0xd')][_0xf41e('0xe')](_0x188c0c,_0x1af199);}function main(){var _0x13d97d=0x1388;var _0x2217f4;logger[_0xf41e('0xf')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'));return db[_0xf41e('0x10')][_0xf41e('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf41e('0x12')]})[_0xf41e('0x13')](function(_0x5aa132){if(_0x5aa132){_0x2217f4=_0x5aa132;_0x13d97d=_0x2217f4['splitSizeCsv']||0x1388;}})[_0xf41e('0x13')](function(){return dbH[_0xf41e('0x14')][_0xf41e('0x15')](util[_0xf41e('0x16')](_0xf41e('0x17'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xf41e('0x18')]});})[_0xf41e('0x13')](function(_0x3e7d34){if(!_0x3e7d34[0x0][_0xf41e('0x19')]){return analyticExtractedReport(_0xf41e('0x1a'));}var _0x254c78=[];var _0x43feb8=0x0;if(_0x2217f4[_0xf41e('0x1b')]){if(_0x3e7d34&&_0x3e7d34[_0xf41e('0x1c')]){var _0x3c2b3d=_[_0xf41e('0x1d')](_0x3e7d34[0x0][_0xf41e('0x19')]/_0x13d97d);var _0x20dbf1=Number[_0xf41e('0x1e')](_0x3e7d34[0x0][_0xf41e('0x19')]/_0x13d97d)?_0x3e7d34[0x0]['num']%_0x13d97d:0x0;_0x3c2b3d[_0xf41e('0x1f')](function(_0x95cd51){if(_0x95cd51>0x0){_0x43feb8+=_0x13d97d;}_0x254c78[_0xf41e('0x20')](dbH[_0xf41e('0x14')][_0xf41e('0x15')](util[_0xf41e('0x16')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x13d97d,_0x43feb8),{'type':dbH['sequelize']['QueryTypes'][_0xf41e('0x18')]}));});if(_0x20dbf1>0x0){_0x43feb8+=_0x13d97d;_0x254c78[_0xf41e('0x20')](dbH[_0xf41e('0x14')][_0xf41e('0x15')](util[_0xf41e('0x16')](_0xf41e('0x21'),QUERY,_0x20dbf1,_0x43feb8),{'type':dbH['sequelize'][_0xf41e('0x22')][_0xf41e('0x18')]}));}}}else{_0x254c78[_0xf41e('0x20')](dbH[_0xf41e('0x14')]['query'](QUERY,{'type':dbH[_0xf41e('0x14')][_0xf41e('0x22')][_0xf41e('0x18')]}));}var _0x495050=path[_0xf41e('0x23')](PATH);var _0x225a2c=path[_0xf41e('0x24')](PATH,'.csv');var _0x21a0ac=_0x2217f4[_0xf41e('0x1b')]&&_0x254c78[_0xf41e('0x1c')]>0x1;var _0x4fc9d4=[];if(!fs[_0xf41e('0x25')](path['join'](_0x495050,_0x225a2c))&&_0x21a0ac){fs[_0xf41e('0x26')](path[_0xf41e('0x27')](_0x495050,_0x225a2c));}return BPromise[_0xf41e('0x28')](_0x254c78,function(_0x208410){_0x4fc9d4[_0xf41e('0x20')](_0x208410);})[_0xf41e('0x13')](function(){for(var _0x5502d9=0x0;_0x5502d9<_0x4fc9d4[_0xf41e('0x1c')];_0x5502d9+=0x1){var _0x1699da;var _0xddc0d=_0x4fc9d4[_0x5502d9];if(_0x21a0ac){_0x1699da=path[_0xf41e('0x27')](_0x495050,_0x225a2c,util['format'](_0xf41e('0x29'),_0x225a2c,_0x5502d9,'csv'));}else{_0x1699da=path[_0xf41e('0x27')](_0x495050,util[_0xf41e('0x16')](_0xf41e('0x2a'),_0x225a2c,_0xf41e('0x2b')));}fs[_0xf41e('0x2c')](_0x1699da,csv(_0xddc0d));}})[_0xf41e('0x13')](function(){if(_0x21a0ac){return new Promise(function(_0x5bb0d1){zipdir(path[_0xf41e('0x27')](_0x495050,_0x225a2c),{'saveTo':path[_0xf41e('0x27')](_0x495050,util[_0xf41e('0x16')](_0xf41e('0x2a'),_0x225a2c,'zip'))},function(_0x450682,_0x169904){rimraf(path[_0xf41e('0x27')](_0x495050,_0x225a2c),function(){});_0x5bb0d1(_0xf41e('0x2d'));});});}})[_0xf41e('0x13')](function(){logger['info'](util[_0xf41e('0x16')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf41e('0x2e')));return analyticExtractedReport(_0xf41e('0x2f'),_0x21a0ac?util[_0xf41e('0x16')](_0xf41e('0x2a'),_0x225a2c,_0x21a0ac?_0xf41e('0x30'):_0xf41e('0x2b')):null);});})[_0xf41e('0x31')](function(_0x522e5b){logger[_0xf41e('0xf')](util['format'](_0xf41e('0x32'),EXTRACTED_REPORT_ID,_0xf41e('0x2e')),util[_0xf41e('0x33')](_0x522e5b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf41e('0x34'));})[_0xf41e('0x35')](function(){process[_0xf41e('0x36')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6d2a=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip\x20finished','info','Completed','zip','inspect','Failed','finally','exit','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','query'];(function(_0x9e3086,_0x22e738){var _0x9db120=function(_0x1a2cfe){while(--_0x1a2cfe){_0x9e3086['push'](_0x9e3086['shift']());}};_0x9db120(++_0x22e738);}(_0x6d2a,0x184));var _0xa6d2=function(_0x559233,_0x4f4408){_0x559233=_0x559233-0x0;var _0x1a9acb=_0x6d2a[_0x559233];return _0x1a9acb;};'use strict';var util=require('util');var path=require(_0xa6d2('0x0'));var _=require(_0xa6d2('0x1'));var csv=require(_0xa6d2('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xa6d2('0x3'));var rimraf=require(_0xa6d2('0x4'));var db=require(_0xa6d2('0x5'))['db'];var dbH=require('../../mysqldb')[_0xa6d2('0x6')];var logger=require(_0xa6d2('0x7'))(_0xa6d2('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xa6d2('0x9')][0x2]);var QUERY=process[_0xa6d2('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2731d6,_0x50190f){var _0x429f38={'status':_0x2731d6};var _0x53e0c9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50190f){_0x429f38[_0xa6d2('0xa')]=_0x50190f;}return db['AnalyticExtractedReport'][_0xa6d2('0xb')](_0x429f38,_0x53e0c9);}function main(){var _0x552ffc=0x1388;var _0x2d8e8e;logger['info'](util[_0xa6d2('0xc')](_0xa6d2('0xd'),EXTRACTED_REPORT_ID,_0xa6d2('0xe')));return db[_0xa6d2('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa6d2('0x10'),_0xa6d2('0x11')]})[_0xa6d2('0x12')](function(_0x34ae71){if(_0x34ae71){_0x2d8e8e=_0x34ae71;_0x552ffc=_0x2d8e8e[_0xa6d2('0x11')]||0x1388;}})[_0xa6d2('0x12')](function(){return dbH['sequelize'][_0xa6d2('0x13')](util[_0xa6d2('0xc')](_0xa6d2('0x14'),QUERY),{'type':dbH[_0xa6d2('0x15')]['QueryTypes'][_0xa6d2('0x16')]});})[_0xa6d2('0x12')](function(_0x58f3d4){if(!_0x58f3d4[0x0][_0xa6d2('0x17')]){return analyticExtractedReport(_0xa6d2('0x18'));}var _0x43eacb=[];var _0x5a8d1f=0x0;if(_0x2d8e8e['split']){if(_0x58f3d4&&_0x58f3d4[_0xa6d2('0x19')]){var _0x10741f=_[_0xa6d2('0x1a')](_0x58f3d4[0x0][_0xa6d2('0x17')]/_0x552ffc);var _0x5df963=Number[_0xa6d2('0x1b')](_0x58f3d4[0x0]['num']/_0x552ffc)?_0x58f3d4[0x0][_0xa6d2('0x17')]%_0x552ffc:0x0;_0x10741f[_0xa6d2('0x1c')](function(_0x1cd6dd){if(_0x1cd6dd>0x0){_0x5a8d1f+=_0x552ffc;}_0x43eacb[_0xa6d2('0x1d')](dbH[_0xa6d2('0x15')][_0xa6d2('0x13')](util['format'](_0xa6d2('0x1e'),QUERY,_0x552ffc,_0x5a8d1f),{'type':dbH[_0xa6d2('0x15')][_0xa6d2('0x1f')][_0xa6d2('0x16')]}));});if(_0x5df963>0x0){_0x5a8d1f+=_0x552ffc;_0x43eacb['push'](dbH[_0xa6d2('0x15')][_0xa6d2('0x13')](util[_0xa6d2('0xc')](_0xa6d2('0x1e'),QUERY,_0x5df963,_0x5a8d1f),{'type':dbH[_0xa6d2('0x15')][_0xa6d2('0x1f')][_0xa6d2('0x16')]}));}}}else{_0x43eacb['push'](dbH[_0xa6d2('0x15')][_0xa6d2('0x13')](QUERY,{'type':dbH[_0xa6d2('0x15')][_0xa6d2('0x1f')][_0xa6d2('0x16')]}));}var _0x1cfeea=path[_0xa6d2('0x20')](PATH);var _0x2f7d95=path[_0xa6d2('0x21')](PATH,_0xa6d2('0x22'));var _0x1eadfc=_0x2d8e8e[_0xa6d2('0x10')]&&_0x43eacb['length']>0x1;var _0x3657ce=[];if(!fs[_0xa6d2('0x23')](path[_0xa6d2('0x24')](_0x1cfeea,_0x2f7d95))&&_0x1eadfc){fs[_0xa6d2('0x25')](path[_0xa6d2('0x24')](_0x1cfeea,_0x2f7d95));}return BPromise[_0xa6d2('0x26')](_0x43eacb,function(_0x4b7cf9){_0x3657ce[_0xa6d2('0x1d')](_0x4b7cf9);})[_0xa6d2('0x12')](function(){for(var _0x3ef37e=0x0;_0x3ef37e<_0x3657ce[_0xa6d2('0x19')];_0x3ef37e+=0x1){var _0x2ffb90;var _0xa25f07=_0x3657ce[_0x3ef37e];if(_0x1eadfc){_0x2ffb90=path['join'](_0x1cfeea,_0x2f7d95,util['format'](_0xa6d2('0x27'),_0x2f7d95,_0x3ef37e,_0xa6d2('0x28')));}else{_0x2ffb90=path[_0xa6d2('0x24')](_0x1cfeea,util[_0xa6d2('0xc')](_0xa6d2('0x29'),_0x2f7d95,'csv'));}fs[_0xa6d2('0x2a')](_0x2ffb90,csv(_0xa25f07));}})[_0xa6d2('0x12')](function(){if(_0x1eadfc){return new Promise(function(_0x3345f4){zipdir(path[_0xa6d2('0x24')](_0x1cfeea,_0x2f7d95),{'saveTo':path[_0xa6d2('0x24')](_0x1cfeea,util[_0xa6d2('0xc')]('%s.%s',_0x2f7d95,'zip'))},function(_0x84ef2,_0x1e246c){rimraf(path[_0xa6d2('0x24')](_0x1cfeea,_0x2f7d95),function(){});_0x3345f4(_0xa6d2('0x2b'));});});}})[_0xa6d2('0x12')](function(){logger[_0xa6d2('0x2c')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa6d2('0xe')));return analyticExtractedReport(_0xa6d2('0x2d'),_0x1eadfc?util[_0xa6d2('0xc')](_0xa6d2('0x29'),_0x2f7d95,_0x1eadfc?_0xa6d2('0x2e'):_0xa6d2('0x28')):null);});})['catch'](function(_0x23b13b){logger[_0xa6d2('0x2c')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa6d2('0xe')),util[_0xa6d2('0x2f')](_0x23b13b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa6d2('0x30'));})[_0xa6d2('0x31')](function(){process[_0xa6d2('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 6667916..63326df 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 _0xd8af=['before','margin','landscape','\x20/\x20','Arial','black','Setting','find','split','splitSizePdf','then','range','num','isInteger','sequelize','SELECT','query','QueryTypes','dirname','basename','existsSync','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','footer','pipe','createWriteStream','finish','error','createPdfFromHTML','createPdfKitDocument','path','lodash','util','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','map','pick','toString','fill','length','auto','body','push','concat','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','header'];(function(_0x31fb16,_0x3a4f55){var _0x50f4b7=function(_0x42f60f){while(--_0x42f60f){_0x31fb16['push'](_0x31fb16['shift']());}};_0x50f4b7(++_0x3a4f55);}(_0xd8af,0x141));var _0xfd8a=function(_0x5e210b,_0x5218b7){_0x5e210b=_0x5e210b-0x0;var _0x596c3a=_0xd8af[_0x5e210b];return _0x596c3a;};'use strict';var _=require(_0xfd8a('0x0'));var fs=require('fs');var util=require(_0xfd8a('0x1'));var path=require('path');var moment=require(_0xfd8a('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xfd8a('0x3'));var zipdir=require(_0xfd8a('0x4'));var rimraf=require(_0xfd8a('0x5'));var JSDOM=require(_0xfd8a('0x6'))[_0xfd8a('0x7')];var window=new JSDOM('')[_0xfd8a('0x8')];var BPromise=require(_0xfd8a('0x9'));var db=require('../../mysqldb')['db'];var dbH=require(_0xfd8a('0xa'))[_0xfd8a('0xb')];var logger=require(_0xfd8a('0xc'))(_0xfd8a('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xfd8a('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xfd8a('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x54251e,_0x2f1935){var _0x163efc={'status':_0x54251e};var _0x2e0ad7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f1935){_0x163efc[_0xfd8a('0xf')]=_0x2f1935;}return db['AnalyticExtractedReport'][_0xfd8a('0x10')](_0x163efc,_0x2e0ad7);}function getHeaders(_0x44dc84){return _[_0xfd8a('0x11')](_0x44dc84,function(_0x4c8078){return{'text':_0x4c8078,'style':'tableHeader'};});}function getRows(_0x1b9b97,_0x5d7637){return _[_0xfd8a('0x11')](_0x5d7637,function(_0xbf8904){return _(_0xbf8904)[_0xfd8a('0x12')](_0x1b9b97)[_0xfd8a('0x11')](function(_0x5a2d35){return _0x5a2d35?_[_0xfd8a('0x13')](_0x5a2d35):'';})['value']();});}function createTable(_0x141701,_0x1df704){var _0x140601={'widths':_[_0xfd8a('0x14')](Array(_0x141701[_0xfd8a('0x15')]),0x91),'heights':function(_0x3c2f37){return _0x3c2f37===0x0?_0xfd8a('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2d8595=getHeaders(_0x141701);_0x140601[_0xfd8a('0x17')][_0xfd8a('0x18')](_0x2d8595);var _0x55f29a=getRows(_0x141701,_0x1df704);_0x140601[_0xfd8a('0x17')]=_0x140601[_0xfd8a('0x17')][_0xfd8a('0x19')](_0x55f29a);return _0x140601;}function createTables(_0xf4cdba){var _0x1cc574=[];var _0xf9fce3=_['chunk'](Object[_0xfd8a('0x1a')](_0xf4cdba[0x0]),0x5);_0xf9fce3['forEach'](function(_0x4b58ff){_0x1cc574[_0xfd8a('0x18')](createTable(_0x4b58ff,_0xf4cdba));});return _0x1cc574;}function getPDFDocDefinition(_0x30edf4){var _0x5c13b1=util[_0xfd8a('0x1b')](_0xfd8a('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xfd8a('0x1d')])[_0xfd8a('0x1b')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xfd8a('0x1b')](FORMAT));var _0x2c267b=[];for(var _0x2f5a38=0x0;_0x2f5a38<_0x30edf4[_0xfd8a('0x15')];_0x2f5a38++){var _0x4dae93=[];if(_0x2f5a38===0x0){_0x4dae93[_0xfd8a('0x18')]({'text':_0x5c13b1,'style':_0xfd8a('0x1e')});}var _0x3157cf={'table':_0x30edf4[_0x2f5a38]};if(_0x2f5a38>0x0){_0x3157cf['pageBreak']=_0xfd8a('0x1f');_0x3157cf[_0xfd8a('0x20')]=[0x0,0x46,0x0,0x0];}_0x4dae93[_0xfd8a('0x18')](_0x3157cf);_0x2c267b[_0xfd8a('0x18')](_0x4dae93);}return{'pageSize':'A4','pageOrientation':_0xfd8a('0x21'),'content':_0x2c267b,'footer':function(_0x5b2d94,_0x294772){return{'text':_0x5b2d94[_0xfd8a('0x13')]()+_0xfd8a('0x22')+_0x294772,'style':'footer'};},'defaultStyle':{'font':_0xfd8a('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xfd8a('0x24')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x595417){var _0x579423=0x1388;var _0x5200e7;if(!_0x595417[0x0]['num']){return analyticExtractedReport('Empty');}return db[_0xfd8a('0x25')][_0xfd8a('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfd8a('0x27'),_0xfd8a('0x28')]})[_0xfd8a('0x29')](function(_0x38e603){if(_0x38e603){_0x5200e7=_0x38e603;_0x579423=_0x5200e7[_0xfd8a('0x28')]||0x3e8;}})[_0xfd8a('0x29')](function(){var _0x4fe834=[];var _0x3837c5=0x0;if(_0x5200e7[_0xfd8a('0x27')]){if(_0x595417&&_0x595417[_0xfd8a('0x15')]){var _0x261b9d=_[_0xfd8a('0x2a')](_0x595417[0x0][_0xfd8a('0x2b')]/_0x579423);var _0x4f0d4a=Number[_0xfd8a('0x2c')](_0x595417[0x0][_0xfd8a('0x2b')]/_0x579423)?_0x595417[0x0][_0xfd8a('0x2b')]%_0x579423:0x0;_0x261b9d['forEach'](function(_0x337190){if(_0x337190>0x0){_0x3837c5+=_0x579423;}_0x4fe834['push'](dbH[_0xfd8a('0x2d')]['query'](util[_0xfd8a('0x1b')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x579423,_0x3837c5),{'type':dbH[_0xfd8a('0x2d')]['QueryTypes'][_0xfd8a('0x2e')]}));});if(_0x4f0d4a>0x0){_0x3837c5+=_0x579423;_0x4fe834[_0xfd8a('0x18')](dbH[_0xfd8a('0x2d')][_0xfd8a('0x2f')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f0d4a,_0x3837c5),{'type':dbH[_0xfd8a('0x2d')][_0xfd8a('0x30')][_0xfd8a('0x2e')]}));}}}else{_0x4fe834['push'](dbH[_0xfd8a('0x2d')][_0xfd8a('0x2f')](QUERY,{'type':dbH[_0xfd8a('0x2d')]['QueryTypes'][_0xfd8a('0x2e')]}));}var _0x22682a=path[_0xfd8a('0x31')](PATH);var _0x51ec26=path[_0xfd8a('0x32')](PATH,'.pdf');var _0x1cf638=_0x5200e7[_0xfd8a('0x27')]&&_0x4fe834['length']>0x1;var _0x1d07ae=[];if(!fs[_0xfd8a('0x33')](path[_0xfd8a('0x34')](_0x22682a,_0x51ec26))&&_0x1cf638){fs[_0xfd8a('0x35')](path[_0xfd8a('0x34')](_0x22682a,_0x51ec26));}return BPromise[_0xfd8a('0x36')](_0x4fe834,function(_0x22dfd4){_0x1d07ae[_0xfd8a('0x18')](_0x22dfd4);})[_0xfd8a('0x29')](function(){var _0x4fd5d2=[];for(var _0x4965d6=0x0;_0x4965d6<_0x1d07ae[_0xfd8a('0x15')];_0x4965d6+=0x1){var _0x342a9e=_0x1d07ae[_0x4965d6];var _0x14e3ad=createTables(_[_0xfd8a('0x37')](_0x342a9e));var _0x4b9b3e;var _0x44c37c=getPDFDocDefinition(_0x14e3ad);var _0x3e1db6=getPDFPrinter();var _0x2e1ee6=_0x3e1db6['createPdfKitDocument'](_0x44c37c);if(_0x1cf638){_0x4b9b3e=path[_0xfd8a('0x34')](_0x22682a,_0x51ec26,util[_0xfd8a('0x1b')](_0xfd8a('0x38'),_0x51ec26,_0x4965d6,_0xfd8a('0x39')));}else{_0x4b9b3e=path[_0xfd8a('0x34')](_0x22682a,util[_0xfd8a('0x1b')](_0xfd8a('0x3a'),_0x51ec26,_0xfd8a('0x39')));}_0x4fd5d2[_0xfd8a('0x18')](writePDFDocument(_0x2e1ee6,_0x4b9b3e));}return Promise['all'](_0x4fd5d2);})[_0xfd8a('0x29')](function(){if(_0x1cf638){return new Promise(function(_0x29dadf){zipdir(path[_0xfd8a('0x34')](_0x22682a,_0x51ec26),{'saveTo':path[_0xfd8a('0x34')](_0x22682a,util[_0xfd8a('0x1b')](_0xfd8a('0x3a'),_0x51ec26,_0xfd8a('0x3b')))},function(){rimraf(path[_0xfd8a('0x34')](_0x22682a,_0x51ec26),function(){});_0x29dadf(_0xfd8a('0x3c'));});});}})['then'](function(){if(!_0x1cf638)return;rimraf(path['join'](_0x22682a,_0x51ec26),function(){});})['then'](function(){logger[_0xfd8a('0x3d')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xfd8a('0x3e')));return analyticExtractedReport('Completed',_0x1cf638?util[_0xfd8a('0x1b')](_0xfd8a('0x3a'),_0x51ec26,_0x1cf638?'zip':_0xfd8a('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xfd8a('0x3d')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db[_0xfd8a('0x3f')][_0xfd8a('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x253f99){EXTRACTED_REPORT=_0x253f99;return dbH['sequelize'][_0xfd8a('0x2f')](util[_0xfd8a('0x1b')](_0xfd8a('0x41'),QUERY),{'type':dbH[_0xfd8a('0x2d')]['QueryTypes'][_0xfd8a('0x2e')]});})[_0xfd8a('0x29')](extractReport)[_0xfd8a('0x42')](function(_0xc17d4){logger[_0xfd8a('0x3d')](util[_0xfd8a('0x1b')](_0xfd8a('0x43'),EXTRACTED_REPORT_ID,_0xfd8a('0x3e')),util[_0xfd8a('0x44')](_0xc17d4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfd8a('0x45'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x40945f=new PdfPrinter({'Arial':{'normal':__dirname+_0xfd8a('0x46'),'bold':__dirname+_0xfd8a('0x47'),'italics':__dirname+_0xfd8a('0x48'),'bolditalics':__dirname+_0xfd8a('0x49')}});return _0x40945f;}function getPDFDocDefinitionFromHTML(_0x419e45,_0x298dfb){var _0x588151=util[_0xfd8a('0x1b')](_0xfd8a('0x4a'),_0x298dfb[_0xfd8a('0x4b')],_0x298dfb[_0xfd8a('0x4c')]);var _0x63223=moment()['format'](_0xfd8a('0x4d'))[_0xfd8a('0x13')]();var _0x54c6da=htmlToPdfmake(_0x419e45,{'window':window,'tableAutoSize':!![]});return{'content':[_0x54c6da],'defaultStyle':{'font':_0xfd8a('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xfd8a('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xfd8a('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xfd8a('0x4e')}},'header':function(){return[{'text':_0xfd8a('0x4f'),'style':_0xfd8a('0x1e')}];},'footer':function(_0x178219,_0x5a9cd8){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x588151,_0x178219,_0x5a9cd8,_0x63223),'style':_0xfd8a('0x50')}];}};}function writePDFDocument(_0x378ae4,_0x309f36){return new Promise(function(_0x439c90,_0x8e123e){var _0x400ce8=_0x378ae4[_0xfd8a('0x51')](fs[_0xfd8a('0x52')](_0x309f36));_0x400ce8['on'](_0xfd8a('0x53'),function(){_0x439c90(_0xfd8a('0x53'));});_0x400ce8['on'](_0xfd8a('0x54'),function(_0x41c637){_0x8e123e(_0x41c637);});_0x378ae4['end']();});}exports[_0xfd8a('0x55')]=function(_0x6e4ea9,_0x38d746){var _0x8804a0=getPDFPrinter();var _0x2cd2d3=getPDFDocDefinitionFromHTML(_0x6e4ea9,_0x38d746);var _0x24dbfc=_0x8804a0[_0xfd8a('0x56')](_0x2cd2d3);return writePDFDocument(_0x24dbfc,_0x38d746[_0xfd8a('0x57')])['catch'](function(_0x76af3a){throw _0x76af3a;});}; \ No newline at end of file +var _0xd2ce=['endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','then','splitSizePdf','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','end','createPdfFromHTML','catch','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','toString','value','fill','length','auto','body','push','concat','keys','format','name','startDate'];(function(_0x38900f,_0x4f168c){var _0x5b2a76=function(_0x1f3978){while(--_0x1f3978){_0x38900f['push'](_0x38900f['shift']());}};_0x5b2a76(++_0x4f168c);}(_0xd2ce,0x1ba));var _0xed2c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd2ce[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xed2c('0x0'));var fs=require('fs');var util=require(_0xed2c('0x1'));var path=require(_0xed2c('0x2'));var moment=require(_0xed2c('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xed2c('0x4'));var zipdir=require(_0xed2c('0x5'));var rimraf=require(_0xed2c('0x6'));var JSDOM=require(_0xed2c('0x7'))[_0xed2c('0x8')];var window=new JSDOM('')[_0xed2c('0x9')];var BPromise=require(_0xed2c('0xa'));var db=require(_0xed2c('0xb'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xed2c('0xc'))(_0xed2c('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xed2c('0xe')][0x2]);var QUERY=process[_0xed2c('0xe')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xed2c('0xe')][0x5];var FORMAT=_0xed2c('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xb47236,_0x5ba914){var _0x507c88={'status':_0xb47236};var _0xb80992={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ba914){_0x507c88[_0xed2c('0x10')]=_0x5ba914;}return db[_0xed2c('0x11')][_0xed2c('0x12')](_0x507c88,_0xb80992);}function getHeaders(_0xb9871e){return _['map'](_0xb9871e,function(_0x126523){return{'text':_0x126523,'style':_0xed2c('0x13')};});}function getRows(_0xbc4d8f,_0x3ca89a){return _[_0xed2c('0x14')](_0x3ca89a,function(_0x193f9a){return _(_0x193f9a)['pick'](_0xbc4d8f)['map'](function(_0x396077){return _0x396077?_[_0xed2c('0x15')](_0x396077):'';})[_0xed2c('0x16')]();});}function createTable(_0x17339e,_0xc36589){var _0x1198ad={'widths':_[_0xed2c('0x17')](Array(_0x17339e[_0xed2c('0x18')]),0x91),'heights':function(_0x166a9d){return _0x166a9d===0x0?_0xed2c('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4f1cb1=getHeaders(_0x17339e);_0x1198ad[_0xed2c('0x1a')][_0xed2c('0x1b')](_0x4f1cb1);var _0x52b2d3=getRows(_0x17339e,_0xc36589);_0x1198ad[_0xed2c('0x1a')]=_0x1198ad[_0xed2c('0x1a')][_0xed2c('0x1c')](_0x52b2d3);return _0x1198ad;}function createTables(_0x22de92){var _0x53e083=[];var _0x2d2a20=_['chunk'](Object[_0xed2c('0x1d')](_0x22de92[0x0]),0x5);_0x2d2a20['forEach'](function(_0x543b1b){_0x53e083['push'](createTable(_0x543b1b,_0x22de92));});return _0x53e083;}function getPDFDocDefinition(_0x561a94){var _0x198f23=util[_0xed2c('0x1e')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0xed2c('0x1f')],moment(EXTRACTED_REPORT[_0xed2c('0x20')])[_0xed2c('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0xed2c('0x21')])[_0xed2c('0x1e')](FORMAT));var _0x4ed8ea=[];for(var _0x1072e9=0x0;_0x1072e9<_0x561a94[_0xed2c('0x18')];_0x1072e9++){var _0x24db4b=[];if(_0x1072e9===0x0){_0x24db4b[_0xed2c('0x1b')]({'text':_0x198f23,'style':_0xed2c('0x22')});}var _0x303d67={'table':_0x561a94[_0x1072e9]};if(_0x1072e9>0x0){_0x303d67[_0xed2c('0x23')]=_0xed2c('0x24');_0x303d67[_0xed2c('0x25')]=[0x0,0x46,0x0,0x0];}_0x24db4b['push'](_0x303d67);_0x4ed8ea[_0xed2c('0x1b')](_0x24db4b);}return{'pageSize':'A4','pageOrientation':_0xed2c('0x26'),'content':_0x4ed8ea,'footer':function(_0x365db7,_0x1f914b){return{'text':_0x365db7[_0xed2c('0x15')]()+_0xed2c('0x27')+_0x1f914b,'style':_0xed2c('0x28')};},'defaultStyle':{'font':_0xed2c('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xed2c('0x2a')},'footer':{'alignment':_0xed2c('0x2b'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4c5acc){var _0x1e6a31=0x1388;var _0x30b537;if(!_0x4c5acc[0x0][_0xed2c('0x2c')]){return analyticExtractedReport(_0xed2c('0x2d'));}return db[_0xed2c('0x2e')][_0xed2c('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xed2c('0x30'),'splitSizePdf']})[_0xed2c('0x31')](function(_0x502c67){if(_0x502c67){_0x30b537=_0x502c67;_0x1e6a31=_0x30b537[_0xed2c('0x32')]||0x3e8;}})['then'](function(){var _0x88e2ec=[];var _0x1af437=0x0;if(_0x30b537[_0xed2c('0x30')]){if(_0x4c5acc&&_0x4c5acc[_0xed2c('0x18')]){var _0x2bf48a=_['range'](_0x4c5acc[0x0]['num']/_0x1e6a31);var _0x5086ff=Number['isInteger'](_0x4c5acc[0x0][_0xed2c('0x2c')]/_0x1e6a31)?_0x4c5acc[0x0][_0xed2c('0x2c')]%_0x1e6a31:0x0;_0x2bf48a[_0xed2c('0x33')](function(_0x18a8f3){if(_0x18a8f3>0x0){_0x1af437+=_0x1e6a31;}_0x88e2ec[_0xed2c('0x1b')](dbH[_0xed2c('0x34')][_0xed2c('0x35')](util[_0xed2c('0x1e')](_0xed2c('0x36'),QUERY,_0x1e6a31,_0x1af437),{'type':dbH['sequelize'][_0xed2c('0x37')]['SELECT']}));});if(_0x5086ff>0x0){_0x1af437+=_0x1e6a31;_0x88e2ec['push'](dbH[_0xed2c('0x34')]['query'](util[_0xed2c('0x1e')](_0xed2c('0x36'),QUERY,_0x5086ff,_0x1af437),{'type':dbH[_0xed2c('0x34')][_0xed2c('0x37')][_0xed2c('0x38')]}));}}}else{_0x88e2ec['push'](dbH[_0xed2c('0x34')]['query'](QUERY,{'type':dbH['sequelize'][_0xed2c('0x37')][_0xed2c('0x38')]}));}var _0x4ac67c=path[_0xed2c('0x39')](PATH);var _0x48b2de=path['basename'](PATH,_0xed2c('0x3a'));var _0x43c40c=_0x30b537['split']&&_0x88e2ec[_0xed2c('0x18')]>0x1;var _0x5afcf1=[];if(!fs['existsSync'](path[_0xed2c('0x3b')](_0x4ac67c,_0x48b2de))&&_0x43c40c){fs[_0xed2c('0x3c')](path[_0xed2c('0x3b')](_0x4ac67c,_0x48b2de));}return BPromise[_0xed2c('0x3d')](_0x88e2ec,function(_0x5c47dd){_0x5afcf1[_0xed2c('0x1b')](_0x5c47dd);})[_0xed2c('0x31')](function(){var _0x45fdd9=[];for(var _0x41cc5c=0x0;_0x41cc5c<_0x5afcf1[_0xed2c('0x18')];_0x41cc5c+=0x1){var _0x4221c9=_0x5afcf1[_0x41cc5c];var _0xb90435=createTables(_[_0xed2c('0x3e')](_0x4221c9));var _0x4d7b13;var _0x5f07a2=getPDFDocDefinition(_0xb90435);var _0x298e67=getPDFPrinter();var _0x1e7eac=_0x298e67[_0xed2c('0x3f')](_0x5f07a2);if(_0x43c40c){_0x4d7b13=path[_0xed2c('0x3b')](_0x4ac67c,_0x48b2de,util[_0xed2c('0x1e')]('%s%d.%s',_0x48b2de,_0x41cc5c,_0xed2c('0x40')));}else{_0x4d7b13=path['join'](_0x4ac67c,util[_0xed2c('0x1e')](_0xed2c('0x41'),_0x48b2de,'pdf'));}_0x45fdd9['push'](writePDFDocument(_0x1e7eac,_0x4d7b13));}return Promise['all'](_0x45fdd9);})['then'](function(){if(_0x43c40c){return new Promise(function(_0x13e69f){zipdir(path[_0xed2c('0x3b')](_0x4ac67c,_0x48b2de),{'saveTo':path[_0xed2c('0x3b')](_0x4ac67c,util['format'](_0xed2c('0x41'),_0x48b2de,_0xed2c('0x42')))},function(){rimraf(path[_0xed2c('0x3b')](_0x4ac67c,_0x48b2de),function(){});_0x13e69f('zip\x20finished');});});}})[_0xed2c('0x31')](function(){if(!_0x43c40c)return;rimraf(path['join'](_0x4ac67c,_0x48b2de),function(){});})['then'](function(){logger['info'](util[_0xed2c('0x1e')](_0xed2c('0x43'),EXTRACTED_REPORT_ID,_0xed2c('0x44')));return analyticExtractedReport(_0xed2c('0x45'),_0x43c40c?util[_0xed2c('0x1e')](_0xed2c('0x41'),_0x48b2de,_0x43c40c?_0xed2c('0x42'):_0xed2c('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xed2c('0x1e')](_0xed2c('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db[_0xed2c('0x11')][_0xed2c('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xed2c('0x31')](function(_0x445e66){EXTRACTED_REPORT=_0x445e66;return dbH[_0xed2c('0x34')][_0xed2c('0x35')](util[_0xed2c('0x1e')](_0xed2c('0x48'),QUERY),{'type':dbH[_0xed2c('0x34')][_0xed2c('0x37')][_0xed2c('0x38')]});})[_0xed2c('0x31')](extractReport)['catch'](function(_0x148901){logger[_0xed2c('0x49')](util['format'](_0xed2c('0x4a'),EXTRACTED_REPORT_ID,_0xed2c('0x44')),util['inspect'](_0x148901,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xed2c('0x4b'));})[_0xed2c('0x4c')](function(){process[_0xed2c('0x4d')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x9c0786=new PdfPrinter({'Arial':{'normal':__dirname+_0xed2c('0x4e'),'bold':__dirname+_0xed2c('0x4f'),'italics':__dirname+_0xed2c('0x50'),'bolditalics':__dirname+_0xed2c('0x51')}});return _0x9c0786;}function getPDFDocDefinitionFromHTML(_0x3325fb,_0x493bbb){var _0x69db4c=util[_0xed2c('0x1e')](_0xed2c('0x52'),_0x493bbb[_0xed2c('0x53')],_0x493bbb[_0xed2c('0x54')]);var _0x140422=moment()['format'](_0xed2c('0x55'))['toString']();var _0x15f8e0=htmlToPdfmake(_0x3325fb,{'window':window,'tableAutoSize':!![]});return{'content':[_0x15f8e0],'defaultStyle':{'font':_0xed2c('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xed2c('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xed2c('0x56'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xed2c('0x56')}},'header':function(){return[{'text':_0xed2c('0x57'),'style':_0xed2c('0x22')}];},'footer':function(_0x1898ad,_0x2637f1){return[{'text':util[_0xed2c('0x1e')](_0xed2c('0x58'),_0x69db4c,_0x1898ad,_0x2637f1,_0x140422),'style':'footer'}];}};}function writePDFDocument(_0x277911,_0x318469){return new Promise(function(_0x5b1212,_0x415734){var _0x5c3eed=_0x277911[_0xed2c('0x59')](fs[_0xed2c('0x5a')](_0x318469));_0x5c3eed['on'](_0xed2c('0x5b'),function(){_0x5b1212(_0xed2c('0x5b'));});_0x5c3eed['on']('error',function(_0x29352e){_0x415734(_0x29352e);});_0x277911[_0xed2c('0x5c')]();});}exports[_0xed2c('0x5d')]=function(_0x22362b,_0x44e216){var _0x1aa477=getPDFPrinter();var _0x12700c=getPDFDocDefinitionFromHTML(_0x22362b,_0x44e216);var _0x100a8b=_0x1aa477['createPdfKitDocument'](_0x12700c);return writePDFDocument(_0x100a8b,_0x44e216[_0xed2c('0x2')])[_0xed2c('0x5e')](function(_0x44d156){throw _0x44d156;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index abe7b0d..eb55320 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 _0xdee7=['../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','XLSX','find','split','then','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','join','each','%s.%s','writeFileSync','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','inspect','finally','util','path','lodash','bluebird','zip-dir'];(function(_0x5d8687,_0x46fbb2){var _0xe4c517=function(_0x6002ca){while(--_0x6002ca){_0x5d8687['push'](_0x5d8687['shift']());}};_0xe4c517(++_0x46fbb2);}(_0xdee7,0xf1));var _0x7dee=function(_0x41ec5f,_0x59d889){_0x41ec5f=_0x41ec5f-0x0;var _0x20eb12=_0xdee7[_0x41ec5f];return _0x20eb12;};'use strict';var util=require(_0x7dee('0x0'));var path=require(_0x7dee('0x1'));var _=require(_0x7dee('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x7dee('0x3'));var zipdir=require(_0x7dee('0x4'));var rimraf=require('rimraf');var db=require(_0x7dee('0x5'))['db'];var dbH=require(_0x7dee('0x5'))[_0x7dee('0x6')];var logger=require(_0x7dee('0x7'))(_0x7dee('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x7dee('0x9')][0x2]);var QUERY=process[_0x7dee('0x9')][0x3];var PATH=process[_0x7dee('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x631590,_0x3f3a44){var _0x318920={'status':_0x631590};var _0x27dbe6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f3a44){_0x318920[_0x7dee('0xa')]=_0x3f3a44;}return db['AnalyticExtractedReport'][_0x7dee('0xb')](_0x318920,_0x27dbe6);}function main(){var _0xa8e0fa=0x1388;var _0x102b09;logger['info'](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7dee('0xc')));return db['Setting'][_0x7dee('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7dee('0xe'),'splitSizeXlsx']})[_0x7dee('0xf')](function(_0x3f116b){if(_0x3f116b){_0x102b09=_0x3f116b;_0xa8e0fa=_0x102b09[_0x7dee('0x10')]||0x1388;}})[_0x7dee('0xf')](function(){return dbH[_0x7dee('0x11')][_0x7dee('0x12')](util[_0x7dee('0x13')](_0x7dee('0x14'),QUERY),{'type':dbH[_0x7dee('0x11')][_0x7dee('0x15')][_0x7dee('0x16')]});})[_0x7dee('0xf')](function(_0x3fd4ac){if(!_0x3fd4ac[0x0]['num']){return analyticExtractedReport(_0x7dee('0x17'));}var _0xcfda31=[];var _0x15c3ab=0x0;if(_0x102b09[_0x7dee('0xe')]){if(_0x3fd4ac&&_0x3fd4ac[_0x7dee('0x18')]){var _0x3faa0e=_[_0x7dee('0x19')](_0x3fd4ac[0x0][_0x7dee('0x1a')]/_0xa8e0fa);var _0x1a8b0b=Number[_0x7dee('0x1b')](_0x3fd4ac[0x0][_0x7dee('0x1a')]/_0xa8e0fa)?_0x3fd4ac[0x0][_0x7dee('0x1a')]%_0xa8e0fa:0x0;_0x3faa0e['forEach'](function(_0x43a39a){if(_0x43a39a>0x0){_0x15c3ab+=_0xa8e0fa;}_0xcfda31[_0x7dee('0x1c')](dbH['sequelize'][_0x7dee('0x12')](util[_0x7dee('0x13')](_0x7dee('0x1d'),QUERY,_0xa8e0fa,_0x15c3ab),{'type':dbH[_0x7dee('0x11')][_0x7dee('0x15')][_0x7dee('0x16')]}));});if(_0x1a8b0b>0x0){_0x15c3ab+=_0xa8e0fa;_0xcfda31[_0x7dee('0x1c')](dbH[_0x7dee('0x11')][_0x7dee('0x12')](util[_0x7dee('0x13')](_0x7dee('0x1d'),QUERY,_0x1a8b0b,_0x15c3ab),{'type':dbH['sequelize'][_0x7dee('0x15')][_0x7dee('0x16')]}));}}}else{_0xcfda31[_0x7dee('0x1c')](dbH[_0x7dee('0x11')][_0x7dee('0x12')](QUERY,{'type':dbH[_0x7dee('0x11')]['QueryTypes'][_0x7dee('0x16')]}));}var _0x4d9453=path['dirname'](PATH);var _0x5af77b=path[_0x7dee('0x1e')](PATH,_0x7dee('0x1f'));var _0x30913e=_0x102b09[_0x7dee('0xe')]&&_0xcfda31[_0x7dee('0x18')]>0x1;var _0x351be3=[];if(!fs['existsSync'](path['join'](_0x4d9453,_0x5af77b))&&_0x30913e){fs['mkdirSync'](path[_0x7dee('0x20')](_0x4d9453,_0x5af77b));}return BPromise[_0x7dee('0x21')](_0xcfda31,function(_0x562477){_0x351be3[_0x7dee('0x1c')](_0x562477);})[_0x7dee('0xf')](function(){for(var _0x50a03f=0x0;_0x50a03f<_0x351be3['length'];_0x50a03f+=0x1){var _0x552871;var _0x42df8f=_0x351be3[_0x50a03f];if(_0x30913e){_0x552871=path[_0x7dee('0x20')](_0x4d9453,_0x5af77b,util[_0x7dee('0x13')]('%s%d.%s',_0x5af77b,_0x50a03f,'xlsx'));}else{_0x552871=path[_0x7dee('0x20')](_0x4d9453,util[_0x7dee('0x13')](_0x7dee('0x22'),_0x5af77b,'xlsx'));}fs[_0x7dee('0x23')](_0x552871,json2xls(_0x42df8f),'binary');}})[_0x7dee('0xf')](function(){if(_0x30913e){return new Promise(function(_0x437c0a){zipdir(path[_0x7dee('0x20')](_0x4d9453,_0x5af77b),{'saveTo':path[_0x7dee('0x20')](_0x4d9453,util[_0x7dee('0x13')](_0x7dee('0x22'),_0x5af77b,'zip'))},function(_0x5616b4,_0x1a39eb){rimraf(path[_0x7dee('0x20')](_0x4d9453,_0x5af77b),function(){});_0x437c0a('zip\x20finished');});});}})[_0x7dee('0xf')](function(){logger[_0x7dee('0x24')](util[_0x7dee('0x13')](_0x7dee('0x25'),EXTRACTED_REPORT_ID,_0x7dee('0xc')));return analyticExtractedReport('Completed',_0x30913e?util['format'](_0x7dee('0x22'),_0x5af77b,_0x30913e?_0x7dee('0x26'):'xlsx'):null);});})['catch'](function(_0x20f76f){logger['info'](util[_0x7dee('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x7dee('0x27')](_0x20f76f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x7dee('0x28')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x46aa=['zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','join','mkdirSync','%s%d.%s','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','lodash'];(function(_0x37e61a,_0x435290){var _0x3ab814=function(_0x27525b){while(--_0x27525b){_0x37e61a['push'](_0x37e61a['shift']());}};_0x3ab814(++_0x435290);}(_0x46aa,0x90));var _0xa46a=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x46aa[_0xb24a3e];return _0x4038d7;};'use strict';var util=require(_0xa46a('0x0'));var path=require(_0xa46a('0x1'));var _=require(_0xa46a('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require(_0xa46a('0x3'));var rimraf=require(_0xa46a('0x4'));var db=require(_0xa46a('0x5'))['db'];var dbH=require(_0xa46a('0x5'))[_0xa46a('0x6')];var logger=require(_0xa46a('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa46a('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xa46a('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x44529e,_0x23ab8f){var _0x34c66e={'status':_0x44529e};var _0x237932={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x23ab8f){_0x34c66e[_0xa46a('0x9')]=_0x23ab8f;}return db[_0xa46a('0xa')][_0xa46a('0xb')](_0x34c66e,_0x237932);}function main(){var _0x3fd2f5=0x1388;var _0x4df886;logger['info'](util[_0xa46a('0xc')](_0xa46a('0xd'),EXTRACTED_REPORT_ID,_0xa46a('0xe')));return db[_0xa46a('0xf')][_0xa46a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa46a('0x11'),_0xa46a('0x12')]})['then'](function(_0x3fc908){if(_0x3fc908){_0x4df886=_0x3fc908;_0x3fd2f5=_0x4df886[_0xa46a('0x12')]||0x1388;}})[_0xa46a('0x13')](function(){return dbH[_0xa46a('0x14')][_0xa46a('0x15')](util[_0xa46a('0xc')](_0xa46a('0x16'),QUERY),{'type':dbH[_0xa46a('0x14')][_0xa46a('0x17')]['SELECT']});})[_0xa46a('0x13')](function(_0x344f87){if(!_0x344f87[0x0][_0xa46a('0x18')]){return analyticExtractedReport(_0xa46a('0x19'));}var _0x5a85cb=[];var _0x3401a3=0x0;if(_0x4df886['split']){if(_0x344f87&&_0x344f87[_0xa46a('0x1a')]){var _0x4fc11e=_[_0xa46a('0x1b')](_0x344f87[0x0][_0xa46a('0x18')]/_0x3fd2f5);var _0x9e081a=Number[_0xa46a('0x1c')](_0x344f87[0x0][_0xa46a('0x18')]/_0x3fd2f5)?_0x344f87[0x0]['num']%_0x3fd2f5:0x0;_0x4fc11e[_0xa46a('0x1d')](function(_0x4e2d1c){if(_0x4e2d1c>0x0){_0x3401a3+=_0x3fd2f5;}_0x5a85cb[_0xa46a('0x1e')](dbH[_0xa46a('0x14')][_0xa46a('0x15')](util['format'](_0xa46a('0x1f'),QUERY,_0x3fd2f5,_0x3401a3),{'type':dbH['sequelize'][_0xa46a('0x17')][_0xa46a('0x20')]}));});if(_0x9e081a>0x0){_0x3401a3+=_0x3fd2f5;_0x5a85cb[_0xa46a('0x1e')](dbH[_0xa46a('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x9e081a,_0x3401a3),{'type':dbH[_0xa46a('0x14')][_0xa46a('0x17')][_0xa46a('0x20')]}));}}}else{_0x5a85cb[_0xa46a('0x1e')](dbH[_0xa46a('0x14')][_0xa46a('0x15')](QUERY,{'type':dbH[_0xa46a('0x14')][_0xa46a('0x17')][_0xa46a('0x20')]}));}var _0x358c31=path[_0xa46a('0x21')](PATH);var _0x3828cf=path[_0xa46a('0x22')](PATH,_0xa46a('0x23'));var _0x1a9c37=_0x4df886[_0xa46a('0x11')]&&_0x5a85cb[_0xa46a('0x1a')]>0x1;var _0x19ff4a=[];if(!fs['existsSync'](path[_0xa46a('0x24')](_0x358c31,_0x3828cf))&&_0x1a9c37){fs[_0xa46a('0x25')](path[_0xa46a('0x24')](_0x358c31,_0x3828cf));}return BPromise['each'](_0x5a85cb,function(_0xd18cf4){_0x19ff4a[_0xa46a('0x1e')](_0xd18cf4);})[_0xa46a('0x13')](function(){for(var _0x39ce1c=0x0;_0x39ce1c<_0x19ff4a[_0xa46a('0x1a')];_0x39ce1c+=0x1){var _0x4698ed;var _0x2df63d=_0x19ff4a[_0x39ce1c];if(_0x1a9c37){_0x4698ed=path[_0xa46a('0x24')](_0x358c31,_0x3828cf,util[_0xa46a('0xc')](_0xa46a('0x26'),_0x3828cf,_0x39ce1c,'xlsx'));}else{_0x4698ed=path['join'](_0x358c31,util[_0xa46a('0xc')](_0xa46a('0x27'),_0x3828cf,'xlsx'));}fs[_0xa46a('0x28')](_0x4698ed,json2xls(_0x2df63d),_0xa46a('0x29'));}})[_0xa46a('0x13')](function(){if(_0x1a9c37){return new Promise(function(_0x30c6c4){zipdir(path['join'](_0x358c31,_0x3828cf),{'saveTo':path['join'](_0x358c31,util[_0xa46a('0xc')](_0xa46a('0x27'),_0x3828cf,_0xa46a('0x2a')))},function(_0x2d1fba,_0x3ee5a7){rimraf(path['join'](_0x358c31,_0x3828cf),function(){});_0x30c6c4(_0xa46a('0x2b'));});});}})[_0xa46a('0x13')](function(){logger['info'](util[_0xa46a('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa46a('0xe')));return analyticExtractedReport(_0xa46a('0x2c'),_0x1a9c37?util[_0xa46a('0xc')]('%s.%s',_0x3828cf,_0x1a9c37?_0xa46a('0x2a'):'xlsx'):null);});})[_0xa46a('0x2d')](function(_0x1a470f){logger[_0xa46a('0x2e')](util['format'](_0xa46a('0x2f'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xa46a('0x30')](_0x1a470f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 65749ad..68acb09 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 _0xd39b=['error','lodash','util','models','Interval','findAll','intervals','VoiceExtension','then','uniq','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','priority','extensions','extension','find','type','Set','format','context','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','hasOwnProperty','callerID','ExecIf','$[${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','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','catch'];(function(_0x10827c,_0x2c13d1){var _0x17fb82=function(_0x4503c2){while(--_0x4503c2){_0x10827c['push'](_0x10827c['shift']());}};_0x17fb82(++_0x2c13d1);}(_0xd39b,0x164));var _0xbd39=function(_0x3cd07e,_0x135124){_0x3cd07e=_0x3cd07e-0x0;var _0x14d0c2=_0xd39b[_0x3cd07e];return _0x14d0c2;};'use strict';var _=require(_0xbd39('0x0'));var util=require(_0xbd39('0x1'));function rewrite(_0xa41c31,_0x8c6f0e){var _0x1c00bc=this;return _0xa41c31[_0xbd39('0x2')][_0xbd39('0x3')][_0xbd39('0x4')]({'raw':!![]})['then'](function(_0x461810){_0x1c00bc[_0xbd39('0x5')]=_0x461810;return _0xa41c31[_0xbd39('0x2')][_0xbd39('0x6')]['findAll']({'where':{'IntervalId':_0x8c6f0e['IntervalId']},'raw':!![]});})[_0xbd39('0x7')](function(_0x202c87){return _0xa41c31[_0xbd39('0x2')][_0xbd39('0x6')][_0xbd39('0x4')]({'where':{'exten':{'$in':_[_0xbd39('0x8')](_[_0xbd39('0x9')](_0x202c87,'exten'))}},'order':[{'raw':_0xbd39('0xa')}],'raw':!![]});})[_0xbd39('0x7')](function(_0x41036e){var _0x58d62a=_[_0xbd39('0xb')](_0x41036e,{'priority':'1'});var _0x303ac5=_[_0xbd39('0xb')](_0x41036e,{'isApp':0x1});var _0x21aa2b=_[_0xbd39('0xc')](_0x303ac5,_0xbd39('0xd'));var _0x15fa44=[_0xbd39('0xe'),_0xbd39('0xf')];var _0xdd79ff=[];var _0x4b7707=[];for(var _0x45d78d in _0x21aa2b){if(_0x21aa2b['hasOwnProperty'](_0x45d78d)){_0x1c00bc[_0xbd39('0x10')]=0x2;_0x1c00bc[_0xbd39('0x11')]=[];_0x1c00bc[_0xbd39('0x12')]=_[_0xbd39('0x13')](_0x58d62a,{'exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')]});_0x1c00bc[_0xbd39('0x11')]['push']({'type':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x14')],'app':_0xbd39('0x15'),'appdata':util[_0xbd39('0x16')]('CDR(type)=%s',_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x14')]),'context':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x17')],'exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')],'priority':_0x1c00bc[_0xbd39('0x10')]++,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});if(_0x21aa2b[_0x45d78d][0x0]['type']===_0xbd39('0x19')){_0x1c00bc['extensions'][_0xbd39('0x1a')]({'type':_0x21aa2b[_0x45d78d][0x0]['type'],'app':_0xbd39('0x15'),'appdata':_0xbd39('0x1b')+_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')],'context':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x17')],'exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')],'priority':_0x1c00bc[_0xbd39('0x10')]++,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});}else if(_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x14')]===_0xbd39('0x1c')){if(_0x1c00bc[_0xbd39('0x12')]){_0x1c00bc['extensions'][_0xbd39('0x1a')]({'type':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x14')],'app':_0xbd39('0x15'),'appdata':_0xbd39('0x1d')+(_0x1c00bc[_0xbd39('0x12')]['cutdigits']?_0xbd39('0x1e')+_0x1c00bc['extension'][_0xbd39('0x1f')]+'}':_0xbd39('0x20')),'context':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x17')],'exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')],'priority':_0x1c00bc['priority']++,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});}_0x1c00bc[_0xbd39('0x11')]['push']({'type':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x14')],'app':_0xbd39('0x15'),'appdata':_0xbd39('0x1b')+_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')],'context':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x17')],'exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')],'priority':_0x1c00bc[_0xbd39('0x10')]++,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});var _0x3ff379=_0x1c00bc['priority']++;_0x1c00bc['extensions']['push']({'type':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x14')],'app':'ExecIf','appdata':_0xbd39('0x21')+(_0x3ff379+0x2)+_0xbd39('0x22')+(_0x3ff379+0x1)+')','context':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x17')],'exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')],'priority':_0x3ff379,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});if(_0x1c00bc['extension']){_0x1c00bc[_0xbd39('0x11')]['push']({'type':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x14')],'app':_0xbd39('0x15'),'appdata':_0x1c00bc[_0xbd39('0x12')][_0xbd39('0x1f')]?_0xbd39('0x23')+_0x1c00bc[_0xbd39('0x12')][_0xbd39('0x1f')]+'}':_0xbd39('0x24'),'context':_0x21aa2b[_0x45d78d][0x0]['context'],'exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')],'priority':_0x1c00bc['priority']++,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0]['VoiceExtensionId']});}_0x1c00bc[_0xbd39('0x11')][_0xbd39('0x1a')]({'type':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x14')],'app':_0xbd39('0x15'),'appdata':'outboundrouteid='+_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')],'context':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x17')],'exten':_0x21aa2b[_0x45d78d][0x0]['exten'],'priority':_0x1c00bc[_0xbd39('0x10')]++,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});if(_0x1c00bc['extension']&&_0x1c00bc['extension']['hasOwnProperty'](_0xbd39('0x25'))&&_0x1c00bc[_0xbd39('0x12')][_0xbd39('0x25')]!==_0xbd39('0x26')){_0x1c00bc['extensions'][_0xbd39('0x1a')]({'type':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x14')],'app':_0xbd39('0x15'),'appdata':_0xbd39('0x27'),'context':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x17')],'exten':_0x21aa2b[_0x45d78d][0x0]['exten'],'priority':_0x1c00bc[_0xbd39('0x10')]++,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});_0x1c00bc[_0xbd39('0x11')][_0xbd39('0x1a')]({'type':_0x21aa2b[_0x45d78d][0x0]['type'],'app':'Set','appdata':_0xbd39('0x28')+_0x1c00bc['extension'][_0xbd39('0x25')]||_0xbd39('0x29'),'context':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x17')],'exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')],'priority':_0x1c00bc[_0xbd39('0x10')]++,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0]['VoiceExtensionId']});}}_0x1c00bc[_0xbd39('0x11')][_0xbd39('0x1a')]({'type':_0x21aa2b[_0x45d78d][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x17')],'exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')],'priority':_0x1c00bc['priority']++,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});_0x1c00bc[_0xbd39('0x11')][_0xbd39('0x1a')]({'type':_0x21aa2b[_0x45d78d][0x0]['type'],'app':_0xbd39('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x21aa2b[_0x45d78d][0x0]['context'],'exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')],'priority':_0x1c00bc[_0xbd39('0x10')]++,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});_0x1c00bc[_0xbd39('0x11')][_0xbd39('0x1a')]({'type':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x14')],'app':_0xbd39('0x15'),'appdata':_0xbd39('0x2a'),'context':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x17')],'exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')],'priority':_0x1c00bc[_0xbd39('0x10')]++,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});for(var _0x139886=0x0,_0x181dfb=0x0;_0x139886<_0x21aa2b[_0x45d78d][_0xbd39('0x2b')];_0x139886+=0x1,_0x181dfb=0x0){var _0x32ffc0=_0x21aa2b[_0x45d78d][_0x139886];if(_0x32ffc0[_0xbd39('0x14')]){_0x32ffc0[_0xbd39('0x14')]=_0x32ffc0[_0xbd39('0x14')][_0xbd39('0x2c')]();}var _0x784195=[];var _0x4f8706=[];delete _0x32ffc0['id'];delete _0x32ffc0[_0xbd39('0x2d')];delete _0x32ffc0['updatedAt'];var _0x294017=_0x32ffc0[_0xbd39('0x2e')]!==_0xbd39('0x2f')?[_0x32ffc0['interval']]:_0x32ffc0['IntervalId']?_[_0xbd39('0x9')](_[_0xbd39('0xb')](_0x1c00bc[_0xbd39('0x5')],{'IntervalId':_0x32ffc0[_0xbd39('0x30')]}),_0xbd39('0x2e')):[];if(_0x32ffc0['hasOwnProperty'](_0xbd39('0x31'))){if(_0x32ffc0[_0xbd39('0x31')]&&_0x32ffc0[_0xbd39('0x31')]!=='--'){_0x784195[_0xbd39('0x1a')]({'type':_0x32ffc0[_0xbd39('0x14')],'app':'Set','appdata':_0xbd39('0x32')+_0x32ffc0['tag'],'context':_0x32ffc0['context'],'exten':_0x32ffc0['exten'],'priority':_0x294017[_0xbd39('0x2b')]+_0x1c00bc[_0xbd39('0x10')]+_0x181dfb++,'VoiceExtensionId':_0x32ffc0[_0xbd39('0x18')]});}}if(_0x32ffc0[_0xbd39('0x14')]===_0xbd39('0x1c')&&_0x32ffc0[_0xbd39('0x33')]('callerID')){if(_0x32ffc0[_0xbd39('0x34')]){_0x784195[_0xbd39('0x1a')]({'type':_0x32ffc0['type'],'app':_0xbd39('0x35'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x32ffc0[_0xbd39('0x34')]+')','context':_0x32ffc0['context'],'exten':_0x32ffc0[_0xbd39('0xd')],'priority':_0x294017[_0xbd39('0x2b')]+_0x1c00bc[_0xbd39('0x10')]+_0x181dfb++,'VoiceExtensionId':_0x32ffc0[_0xbd39('0x18')]});}else{_0x784195[_0xbd39('0x1a')]({'type':_0x32ffc0[_0xbd39('0x14')],'app':_0xbd39('0x35'),'appdata':_0xbd39('0x36'),'context':_0x32ffc0[_0xbd39('0x17')],'exten':_0x32ffc0[_0xbd39('0xd')],'priority':_0x294017[_0xbd39('0x2b')]+_0x1c00bc[_0xbd39('0x10')]+_0x181dfb++,'VoiceExtensionId':_0x32ffc0[_0xbd39('0x18')]});}}if(_0x32ffc0[_0xbd39('0x33')](_0xbd39('0x37'))){if(_0x15fa44['indexOf'](_0x32ffc0[_0xbd39('0x38')]['toLowerCase']())>=0x0&&_0x32ffc0[_0xbd39('0x39')]!==_0xbd39('0x3a')){if(_0x32ffc0['answer']){_0x784195[_0xbd39('0x1a')]({'type':_0x32ffc0[_0xbd39('0x14')],'app':_0xbd39('0x35'),'appdata':_0xbd39('0x3b'),'context':_0x32ffc0['context'],'exten':_0x32ffc0[_0xbd39('0xd')],'priority':_0x294017[_0xbd39('0x2b')]+_0x1c00bc[_0xbd39('0x10')]+_0x181dfb++,'VoiceExtensionId':_0x32ffc0[_0xbd39('0x18')]});_0x784195[_0xbd39('0x1a')]({'type':_0x32ffc0[_0xbd39('0x14')],'app':'Set','appdata':_0xbd39('0x3c'),'context':_0x32ffc0['context'],'exten':_0x32ffc0[_0xbd39('0xd')],'priority':_0x294017[_0xbd39('0x2b')]+_0x1c00bc[_0xbd39('0x10')]+_0x181dfb++,'VoiceExtensionId':_0x32ffc0['VoiceExtensionId']});}else{_0x784195[_0xbd39('0x1a')]({'type':_0x32ffc0[_0xbd39('0x14')],'app':_0xbd39('0x35'),'appdata':_0xbd39('0x3d'),'context':_0x32ffc0['context'],'exten':_0x32ffc0['exten'],'priority':_0x294017[_0xbd39('0x2b')]+_0x1c00bc[_0xbd39('0x10')]+_0x181dfb++,'VoiceExtensionId':_0x32ffc0['VoiceExtensionId']});_0x784195['push']({'type':_0x32ffc0['type'],'app':_0xbd39('0x15'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x32ffc0['context'],'exten':_0x32ffc0['exten'],'priority':_0x294017[_0xbd39('0x2b')]+_0x1c00bc[_0xbd39('0x10')]+_0x181dfb++,'VoiceExtensionId':_0x32ffc0['VoiceExtensionId']});}}}for(var _0x40a721=0x0;_0x40a721<_0x294017['length'];_0x40a721+=0x1){var _0x747355=_0x1c00bc[_0xbd39('0x10')]+_0x294017[_0xbd39('0x2b')];var _0xd1a318=_0x40a721===_0x294017[_0xbd39('0x2b')]-0x1?_0x1c00bc[_0xbd39('0x10')]+_0x784195[_0xbd39('0x2b')]+_0x4f8706[_0xbd39('0x2b')]+0x2:_0x1c00bc[_0xbd39('0x10')]+_0x40a721+0x1;_0x784195[_0xbd39('0x3e')](_0x40a721,0x0,{'type':_0x32ffc0[_0xbd39('0x14')],'app':_0xbd39('0x3f'),'appdata':_0x294017[_0x40a721]+'?'+_0x32ffc0['context']+_0xbd39('0x40')+_0x747355+':'+_0x32ffc0[_0xbd39('0x17')]+_0xbd39('0x40')+_0xd1a318,'exten':_0x32ffc0[_0xbd39('0xd')],'context':_0x32ffc0[_0xbd39('0x17')],'priority':_0x1c00bc[_0xbd39('0x10')]+_0x40a721,'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});}_0x32ffc0[_0xbd39('0x10')]=_0x784195[_0xbd39('0x2b')]?_[_0xbd39('0x41')](_0x784195)[_0xbd39('0x10')]+0x1:_0x1c00bc[_0xbd39('0x10')];_0x1c00bc[_0xbd39('0x10')]=(_0x4f8706[_0xbd39('0x2b')]?_[_0xbd39('0x41')](_0x4f8706)[_0xbd39('0x10')]:_0x32ffc0[_0xbd39('0x10')])+0x1;_0x1c00bc[_0xbd39('0x11')]=_['concat'](_0x1c00bc['extensions'],_0x784195,[_0x32ffc0],_0x4f8706);}_0x1c00bc[_0xbd39('0x11')]['push']({'type':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x14')],'app':'Hangup','exten':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0xd')],'context':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x17')],'priority':_0x1c00bc['priority'],'VoiceExtensionId':_0x21aa2b[_0x45d78d][0x0][_0xbd39('0x18')]});_0xdd79ff[_0xbd39('0x1a')](_0x21aa2b[_0x45d78d][0x0]['VoiceExtensionId']);_0x4b7707=_[_0xbd39('0x42')](_0x4b7707,_0x1c00bc[_0xbd39('0x11')]);}}return _0xa41c31['transaction'](function(_0x3f118c){return _0xa41c31['models'][_0xbd39('0x6')][_0xbd39('0x43')]({'where':{'VoiceExtensionId':{'$in':_0xdd79ff}},'transaction':_0x3f118c})[_0xbd39('0x7')](function(_0xc9461c){return _0xa41c31[_0xbd39('0x2')][_0xbd39('0x6')][_0xbd39('0x44')](_['sortBy'](_0x4b7707,'priority'),{'transaction':_0x3f118c});});});})[_0xbd39('0x45')](function(_0x5ee8e0){console[_0xbd39('0x46')](_0x5ee8e0);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x3c61=['cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','intervals','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','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','destroy','bulkCreate','sortBy','error','rewrite','lodash','models','Interval','findAll','then','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','find','extensions','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','outbound','extension','push'];(function(_0x10732c,_0x336eba){var _0x5f51e5=function(_0x28af22){while(--_0x28af22){_0x10732c['push'](_0x10732c['shift']());}};_0x5f51e5(++_0x336eba);}(_0x3c61,0x1d5));var _0x13c6=function(_0x351f20,_0x58757f){_0x351f20=_0x351f20-0x0;var _0xea6ff3=_0x3c61[_0x351f20];return _0xea6ff3;};'use strict';var _=require(_0x13c6('0x0'));var util=require('util');function rewrite(_0x2b6151,_0xdaabaa){var _0x62e75f=this;return _0x2b6151[_0x13c6('0x1')][_0x13c6('0x2')][_0x13c6('0x3')]({'raw':!![]})[_0x13c6('0x4')](function(_0x2822f2){_0x62e75f['intervals']=_0x2822f2;return _0x2b6151[_0x13c6('0x1')][_0x13c6('0x5')][_0x13c6('0x3')]({'where':{'IntervalId':_0xdaabaa['IntervalId']},'raw':!![]});})[_0x13c6('0x4')](function(_0x362faa){return _0x2b6151[_0x13c6('0x1')][_0x13c6('0x5')][_0x13c6('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x13c6('0x6')](_0x362faa,_0x13c6('0x7')))}},'order':[{'raw':_0x13c6('0x8')}],'raw':!![]});})['then'](function(_0x3d062f){var _0xca82ff=_[_0x13c6('0x9')](_0x3d062f,{'priority':'1'});var _0x55fdd9=_[_0x13c6('0x9')](_0x3d062f,{'isApp':0x1});var _0xffbb28=_[_0x13c6('0xa')](_0x55fdd9,_0x13c6('0x7'));var _0x23db0d=[_0x13c6('0xb'),_0x13c6('0xc')];var _0x42892f=[];var _0x2dd871=[];for(var _0x378102 in _0xffbb28){if(_0xffbb28[_0x13c6('0xd')](_0x378102)){_0x62e75f[_0x13c6('0xe')]=0x2;_0x62e75f['extensions']=[];_0x62e75f['extension']=_[_0x13c6('0xf')](_0xca82ff,{'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')]});_0x62e75f[_0x13c6('0x10')]['push']({'type':_0xffbb28[_0x378102][0x0]['type'],'app':'Set','appdata':util[_0x13c6('0x11')](_0x13c6('0x12'),_0xffbb28[_0x378102][0x0][_0x13c6('0x13')]),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});if(_0xffbb28[_0x378102][0x0][_0x13c6('0x13')]===_0x13c6('0x16')){_0x62e75f[_0x13c6('0x10')]['push']({'type':_0xffbb28[_0x378102][0x0]['type'],'app':_0x13c6('0x17'),'appdata':_0x13c6('0x18')+_0xffbb28[_0x378102][0x0][_0x13c6('0x15')],'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0]['VoiceExtensionId']});}else if(_0xffbb28[_0x378102][0x0]['type']===_0x13c6('0x19')){if(_0x62e75f[_0x13c6('0x1a')]){_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':'CDR(destination)='+(_0x62e75f['extension'][_0x13c6('0x1c')]?_0x13c6('0x1d')+_0x62e75f[_0x13c6('0x1a')][_0x13c6('0x1c')]+'}':_0x13c6('0x1e')),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0]['VoiceExtensionId']});}_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':'CDR(routeid)='+_0xffbb28[_0x378102][0x0]['VoiceExtensionId'],'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});var _0xacedd2=_0x62e75f[_0x13c6('0xe')]++;_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x1f'),'appdata':_0x13c6('0x20')+(_0xacedd2+0x2)+_0x13c6('0x21')+(_0xacedd2+0x1)+')','context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0xacedd2,'VoiceExtensionId':_0xffbb28[_0x378102][0x0]['VoiceExtensionId']});if(_0x62e75f['extension']){_0x62e75f['extensions'][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':_0x62e75f[_0x13c6('0x1a')][_0x13c6('0x1c')]?'CDR(prefix)=${EXTEN:0:'+_0x62e75f['extension'][_0x13c6('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'priority':_0x62e75f['priority']++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});}_0x62e75f[_0x13c6('0x10')]['push']({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':_0x13c6('0x22')+_0xffbb28[_0x378102][0x0][_0x13c6('0x15')],'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});if(_0x62e75f[_0x13c6('0x1a')]&&_0x62e75f['extension'][_0x13c6('0xd')](_0x13c6('0x23'))&&_0x62e75f[_0x13c6('0x1a')][_0x13c6('0x23')]!==_0x13c6('0x24')){_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':'Set','appdata':_0x13c6('0x25'),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0]['type'],'app':'Set','appdata':_0x13c6('0x26')+_0x62e75f['extension'][_0x13c6('0x23')]||_0x13c6('0x27'),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0]['VoiceExtensionId']});}}_0x62e75f['extensions']['push']({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':_0x13c6('0x28'),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});_0x62e75f[_0x13c6('0x10')]['push']({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':_0x13c6('0x29'),'context':_0xffbb28[_0x378102][0x0][_0x13c6('0x14')],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});_0x62e75f[_0x13c6('0x10')]['push']({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':'MONITOR_OPTIONS=ab','context':_0xffbb28[_0x378102][0x0]['context'],'exten':_0xffbb28[_0x378102][0x0]['exten'],'priority':_0x62e75f[_0x13c6('0xe')]++,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});for(var _0x27a776=0x0,_0x1a86ef=0x0;_0x27a776<_0xffbb28[_0x378102][_0x13c6('0x2a')];_0x27a776+=0x1,_0x1a86ef=0x0){var _0x10e701=_0xffbb28[_0x378102][_0x27a776];if(_0x10e701[_0x13c6('0x13')]){_0x10e701['type']=_0x10e701[_0x13c6('0x13')][_0x13c6('0x2b')]();}var _0x2dc06d=[];var _0x3eed5f=[];delete _0x10e701['id'];delete _0x10e701[_0x13c6('0x2c')];delete _0x10e701[_0x13c6('0x2d')];var _0x58898b=_0x10e701[_0x13c6('0x2e')]!==_0x13c6('0x2f')?[_0x10e701['interval']]:_0x10e701[_0x13c6('0x30')]?_[_0x13c6('0x6')](_[_0x13c6('0x9')](_0x62e75f[_0x13c6('0x31')],{'IntervalId':_0x10e701[_0x13c6('0x30')]}),_0x13c6('0x2e')):[];if(_0x10e701[_0x13c6('0xd')](_0x13c6('0x32'))){if(_0x10e701[_0x13c6('0x32')]&&_0x10e701['tag']!=='--'){_0x2dc06d[_0x13c6('0x1b')]({'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':_0x13c6('0x33')+_0x10e701['tag'],'context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701[_0x13c6('0x7')],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f['priority']+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});}}if(_0x10e701['type']===_0x13c6('0x19')&&_0x10e701[_0x13c6('0xd')](_0x13c6('0x34'))){if(_0x10e701[_0x13c6('0x34')]){_0x2dc06d[_0x13c6('0x1b')]({'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x1f'),'appdata':_0x13c6('0x35')+_0x10e701['callerID']+')','context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701[_0x13c6('0x7')],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f['priority']+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});}else{_0x2dc06d['push']({'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x1f'),'appdata':_0x13c6('0x36'),'context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701[_0x13c6('0x7')],'priority':_0x58898b['length']+_0x62e75f[_0x13c6('0xe')]+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});}}if(_0x10e701[_0x13c6('0xd')](_0x13c6('0x37'))){if(_0x23db0d[_0x13c6('0x38')](_0x10e701[_0x13c6('0x39')]['toLowerCase']())>=0x0&&_0x10e701['appType']!==_0x13c6('0x3a')){if(_0x10e701['answer']){_0x2dc06d[_0x13c6('0x1b')]({'type':_0x10e701['type'],'app':_0x13c6('0x1f'),'appdata':_0x13c6('0x3b'),'context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701['exten'],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f[_0x13c6('0xe')]+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});_0x2dc06d[_0x13c6('0x1b')]({'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x10e701['context'],'exten':_0x10e701['exten'],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f[_0x13c6('0xe')]+_0x1a86ef++,'VoiceExtensionId':_0x10e701['VoiceExtensionId']});}else{_0x2dc06d['push']({'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x1f'),'appdata':_0x13c6('0x3c'),'context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701[_0x13c6('0x7')],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f[_0x13c6('0xe')]+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});_0x2dc06d[_0x13c6('0x1b')]({'type':_0x10e701['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x10e701[_0x13c6('0x14')],'exten':_0x10e701['exten'],'priority':_0x58898b[_0x13c6('0x2a')]+_0x62e75f[_0x13c6('0xe')]+_0x1a86ef++,'VoiceExtensionId':_0x10e701[_0x13c6('0x15')]});}}}for(var _0x4ef1de=0x0;_0x4ef1de<_0x58898b[_0x13c6('0x2a')];_0x4ef1de+=0x1){var _0x592f7b=_0x62e75f[_0x13c6('0xe')]+_0x58898b[_0x13c6('0x2a')];var _0x3f75e5=_0x4ef1de===_0x58898b[_0x13c6('0x2a')]-0x1?_0x62e75f['priority']+_0x2dc06d[_0x13c6('0x2a')]+_0x3eed5f['length']+0x2:_0x62e75f[_0x13c6('0xe')]+_0x4ef1de+0x1;_0x2dc06d[_0x13c6('0x3d')](_0x4ef1de,0x0,{'type':_0x10e701[_0x13c6('0x13')],'app':_0x13c6('0x3e'),'appdata':_0x58898b[_0x4ef1de]+'?'+_0x10e701['context']+_0x13c6('0x3f')+_0x592f7b+':'+_0x10e701[_0x13c6('0x14')]+_0x13c6('0x3f')+_0x3f75e5,'exten':_0x10e701[_0x13c6('0x7')],'context':_0x10e701[_0x13c6('0x14')],'priority':_0x62e75f[_0x13c6('0xe')]+_0x4ef1de,'VoiceExtensionId':_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]});}_0x10e701[_0x13c6('0xe')]=_0x2dc06d[_0x13c6('0x2a')]?_[_0x13c6('0x40')](_0x2dc06d)[_0x13c6('0xe')]+0x1:_0x62e75f['priority'];_0x62e75f[_0x13c6('0xe')]=(_0x3eed5f[_0x13c6('0x2a')]?_[_0x13c6('0x40')](_0x3eed5f)[_0x13c6('0xe')]:_0x10e701['priority'])+0x1;_0x62e75f['extensions']=_['concat'](_0x62e75f[_0x13c6('0x10')],_0x2dc06d,[_0x10e701],_0x3eed5f);}_0x62e75f[_0x13c6('0x10')][_0x13c6('0x1b')]({'type':_0xffbb28[_0x378102][0x0][_0x13c6('0x13')],'app':'Hangup','exten':_0xffbb28[_0x378102][0x0][_0x13c6('0x7')],'context':_0xffbb28[_0x378102][0x0]['context'],'priority':_0x62e75f['priority'],'VoiceExtensionId':_0xffbb28[_0x378102][0x0]['VoiceExtensionId']});_0x42892f[_0x13c6('0x1b')](_0xffbb28[_0x378102][0x0][_0x13c6('0x15')]);_0x2dd871=_[_0x13c6('0x41')](_0x2dd871,_0x62e75f[_0x13c6('0x10')]);}}return _0x2b6151['transaction'](function(_0x45b4e0){return _0x2b6151[_0x13c6('0x1')]['VoiceExtension'][_0x13c6('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x42892f}},'transaction':_0x45b4e0})[_0x13c6('0x4')](function(_0x20912d){return _0x2b6151[_0x13c6('0x1')][_0x13c6('0x5')][_0x13c6('0x43')](_[_0x13c6('0x44')](_0x2dd871,_0x13c6('0xe')),{'transaction':_0x45b4e0});});});})['catch'](function(_0x5c9347){console[_0x13c6('0x45')](_0x5c9347);});}exports[_0x13c6('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 8a0b41c..05f69a3 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 _0xfd8c=['VoiceQueueId','onlyIfOpen','all','outbound','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','stringify','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','from','cm_contacts','ListId\x20=\x20?','id\x20IN\x20?','cm_hopper_final','str','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0xfd8c,0x103));var _0xcfd8=function(_0x1d49da,_0x4b8203){_0x1d49da=_0x1d49da-0x0;var _0x206b1d=_0xfd8c[_0x1d49da];return _0x206b1d;};'use strict';var BPromise=require(_0xcfd8('0x0'));var util=require(_0xcfd8('0x1'));var _=require(_0xcfd8('0x2'));var fs=require('fs');var squel=require(_0xcfd8('0x3'));var Papa=require(_0xcfd8('0x4'));var Redis=require(_0xcfd8('0x5'));var db=require(_0xcfd8('0x6'))['db'];var config=require(_0xcfd8('0x7'));var logger=require(_0xcfd8('0x8'))(_0xcfd8('0x9'));config[_0xcfd8('0xa')]=_[_0xcfd8('0xb')](config['redis'],{'host':_0xcfd8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfd8('0xa')]));require(_0xcfd8('0xd'))[_0xcfd8('0xe')](socket);try{if(!process[_0xcfd8('0xf')][0x2]||process['argv'][0x2]===_0xcfd8('0x10')||process['argv'][0x2]===_0xcfd8('0x11')){throw new Error(_0xcfd8('0x12'));}var FILEPATH=process[_0xcfd8('0xf')][0x2];if(!process[_0xcfd8('0xf')][0x3]||process['argv'][0x3]===_0xcfd8('0x10')||process['argv'][0x3]===_0xcfd8('0x11')||!process[_0xcfd8('0xf')][0x4]||process['argv'][0x4]===_0xcfd8('0x10')||process[_0xcfd8('0xf')][0x4]===_0xcfd8('0x11')){throw new Error(_0xcfd8('0x13'));}var FIELDS=_[_0xcfd8('0x14')](process[_0xcfd8('0xf')][0x3][_0xcfd8('0x15')](','),process['argv'][0x4][_0xcfd8('0x15')](','));if(!process['argv'][0x5]||process[_0xcfd8('0xf')][0x5]==='undefined'||process[_0xcfd8('0xf')][0x5]==='null'){throw new Error(_0xcfd8('0x16'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xcfd8('0xf')][0x6]&&process[_0xcfd8('0xf')][0x6]!==_0xcfd8('0x10')&&process[_0xcfd8('0xf')][0x6]!==_0xcfd8('0x11')?process[_0xcfd8('0xf')][0x6]:null;var DUPLICATES=process[_0xcfd8('0xf')][0x7]&&process['argv'][0x7]!==_0xcfd8('0x10')&&process[_0xcfd8('0xf')][0x7]!==_0xcfd8('0x11')?process[_0xcfd8('0xf')][0x7]:null;if(!process[_0xcfd8('0xf')][0x8]||process[_0xcfd8('0xf')][0x8]===_0xcfd8('0x10')||process[_0xcfd8('0xf')][0x8]===_0xcfd8('0x11')){throw new Error(_0xcfd8('0x17'));}var SOCKET_TIMESTAMP=process[_0xcfd8('0xf')][0x8];}catch(_0x382f31){logger[_0xcfd8('0x18')](_0x382f31);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(_0x32418d,_0x58f7f3,_0x3301ee,_0xca910a){var _0xa4bb87={'message':_0x58f7f3};_0xa4bb87[_0x32418d]=!![];if(_0x3301ee){_0xa4bb87[_0xcfd8('0x19')]=_0x3301ee;}if(_0xca910a){_0xa4bb87[_0xcfd8('0x1a')]=_0xca910a;}return _0xa4bb87;}function isEmail(_0x210cf3){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))*$/[_0xcfd8('0x1b')](_0x210cf3);}function checkRow(_0xe1b2d9,_0x4acf24,_0xfe9bcd){return new BPromise(function(_0x58b8a3,_0x5d0a69){if(_[_0xcfd8('0x1c')](_0xe1b2d9)){return _0x5d0a69(handleCheckRowError(_0xcfd8('0x18'),_0xcfd8('0x1d'),null,_0xfe9bcd));}if(_0xe1b2d9[_0xcfd8('0x1e')]&&_0xe1b2d9[_0xcfd8('0x1e')][_0xcfd8('0x1f')]){var _0x4f02b5=_[_0xcfd8('0x20')](_0xe1b2d9[_0xcfd8('0x1e')],_0xcfd8('0x21'))[_0xcfd8('0x22')](';');return _0x5d0a69(handleCheckRowError(_0xcfd8('0x18'),_0x4f02b5,null,_0xfe9bcd));}var _0x35b984={};for(var _0x5434b5 in FIELDS){if(FIELDS[_0xcfd8('0x23')](_0x5434b5)&&FIELDS[_0x5434b5]){_0x35b984[_0x5434b5]=_0xe1b2d9[_0xcfd8('0x24')][0x0][FIELDS[_0x5434b5]]||_0xe1b2d9[_0xcfd8('0x24')][0x0]['\ufeff'+FIELDS[_0x5434b5]];}}if(!_0x35b984['firstName']){return _0x5d0a69(handleCheckRowError(_0xcfd8('0x18'),_0xcfd8('0x25'),null,_0xfe9bcd));}if(!_0x35b984[_0xcfd8('0x26')]){return _0x5d0a69(handleCheckRowError(_0xcfd8('0x18'),_0xcfd8('0x27'),null,_0xfe9bcd));}if(_0x35b984[_0xcfd8('0x28')]){var _0x235f2c=moment(_0x35b984['birthDate'],_0xcfd8('0x29'));if(!_0x235f2c['isValid']()){return _0x5d0a69(handleCheckRowError(_0xcfd8('0x18'),_0xcfd8('0x2a'),null,_0xfe9bcd));}}if(_0x35b984[_0xcfd8('0x2b')]){if(!isEmail(_0x35b984['email'])){return _0x5d0a69(handleCheckRowError('error',_0xcfd8('0x2c'),null,_0xfe9bcd));}}_0x35b984[_0xcfd8('0x2d')]=LISTID;_0x35b984[_0xcfd8('0x2e')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xcfd8('0x1f')]&&_0x4acf24){var _0x1b6778={};for(var _0x72838e=0x0,_0xe1e434=DUPLICATES[_0xcfd8('0x1f')];_0x72838e<_0xe1e434;_0x72838e+=0x1){_0x1b6778[DUPLICATES[_0x72838e]]=_0x35b984[DUPLICATES[_0x72838e]];}var _0x4ad846=_[_0xcfd8('0x2f')](_0x4acf24,_0x1b6778);if(_0x4ad846){return _0x5d0a69(handleCheckRowError('duplicate',_0xcfd8('0x30'),_0x4ad846,_0xfe9bcd));}}return db[_0xcfd8('0x31')][_0xcfd8('0x32')](_0x35b984,{'raw':!![],'hooks':![],'fields':_[_0xcfd8('0x33')](_0x35b984)})[_0xcfd8('0x34')](function(_0x3f38a5){if(DUPLICATES&&DUPLICATES[_0xcfd8('0x1f')]&&_0x4acf24){_0x4acf24[_0xcfd8('0x35')](_[_0xcfd8('0x36')](_0x35b984,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3f38a5['id'];return _0x58b8a3();})[_0xcfd8('0x37')](function(_0x114bce){return _0x5d0a69(handleCheckRowError(_0xcfd8('0x18'),_0xcfd8('0x38')+(_0x114bce['message']||JSON['stringify'](_0x114bce)),null,_0xfe9bcd));});});}function checkHopper(){function _0x263be0(){return function(_0x3bc2f7){logger['error']('cmContact',_0xcfd8('0x39'),util[_0xcfd8('0x3a')](_0x3bc2f7,{'showHidden':![],'depth':null}));};}var _0x4d22f6=function(_0x150d6b,_0x2f9b4d){var _0x5dd81e=squel[_0xcfd8('0x3b')]()[_0xcfd8('0x3c')](_0xcfd8('0x3d'))[_0xcfd8('0x3e')]([_0xcfd8('0x26'),_0xcfd8('0x3f'),_0xcfd8('0x40'),'ListId',_0x2f9b4d,_0xcfd8('0x41'),_0xcfd8('0x42')],squel[_0xcfd8('0x43')]()[_0xcfd8('0x44')](_0xcfd8('0x26'),_0xcfd8('0x26'))[_0xcfd8('0x44')](_0xcfd8('0x45'),'scheduledAt')[_0xcfd8('0x44')]('id',_0xcfd8('0x40'))[_0xcfd8('0x44')](LISTID[_0xcfd8('0x46')](),_0xcfd8('0x2d'))[_0xcfd8('0x44')](_0x150d6b['id'][_0xcfd8('0x46')](),_0x2f9b4d)['field'](_0xcfd8('0x45'),'createdAt')[_0xcfd8('0x44')](_0xcfd8('0x45'),_0xcfd8('0x42'))['from']('cm_contacts')[_0xcfd8('0x47')](_0xcfd8('0x48'))[_0xcfd8('0x47')]('ListId\x20=\x20?',LISTID[_0xcfd8('0x46')]())['where'](_0xcfd8('0x49'))[_0xcfd8('0x47')](_0xcfd8('0x4a'),squel[_0xcfd8('0x43')]()[_0xcfd8('0x44')]('phone')['from']('cm_hopper')[_0xcfd8('0x47')](_0x2f9b4d+_0xcfd8('0x4b'),_0x150d6b['id'][_0xcfd8('0x46')]())))[_0xcfd8('0x46')]();return _0x5dd81e;};var _0x415bc7=function(_0x7ec3d5,_0x426ee7){var _0x265cd3=squel[_0xcfd8('0x3b')]()[_0xcfd8('0x3c')](_0xcfd8('0x3d'))[_0xcfd8('0x3e')]([_0xcfd8('0x26'),_0xcfd8('0x3f'),'ContactId',_0xcfd8('0x2d'),_0x426ee7,_0xcfd8('0x41'),_0xcfd8('0x42')],squel['select']()[_0xcfd8('0x44')](_0xcfd8('0x26'),_0xcfd8('0x26'))[_0xcfd8('0x44')](_0xcfd8('0x45'),_0xcfd8('0x3f'))[_0xcfd8('0x44')]('id','ContactId')[_0xcfd8('0x44')](LISTID[_0xcfd8('0x46')](),_0xcfd8('0x2d'))[_0xcfd8('0x44')](_0x7ec3d5['id']['toString'](),_0x426ee7)['field'](_0xcfd8('0x45'),'createdAt')[_0xcfd8('0x44')](_0xcfd8('0x45'),_0xcfd8('0x42'))[_0xcfd8('0x4c')](_0xcfd8('0x4d'))['where']('deletedAt\x20IS\x20NULL')['where'](_0xcfd8('0x4e'),LISTID[_0xcfd8('0x46')]())[_0xcfd8('0x47')](_0xcfd8('0x4f'),squel['str'](hopperContacts))[_0xcfd8('0x47')]('phone\x20IS\x20NOT\x20NULL')[_0xcfd8('0x47')](_0xcfd8('0x4a'),squel[_0xcfd8('0x43')]()['field']('calleridnum')['from'](_0xcfd8('0x50'))[_0xcfd8('0x47')](_0x426ee7+'\x20=\x20?',_0x7ec3d5['id'][_0xcfd8('0x46')]()))[_0xcfd8('0x47')](_0xcfd8('0x4a'),squel['select']()['field'](_0xcfd8('0x26'))['from'](_0xcfd8('0x3d'))[_0xcfd8('0x47')](_0x426ee7+_0xcfd8('0x4b'),_0x7ec3d5['id'][_0xcfd8('0x46')]())))[_0xcfd8('0x46')]();return _0x265cd3;};function _0x229d64(_0x34bb51,_0x2a8477){var _0x3e24b7=squel[_0xcfd8('0x3b')]()[_0xcfd8('0x3c')](_0xcfd8('0x3d'))['fromQuery']([_0xcfd8('0x26'),_0xcfd8('0x3f'),_0xcfd8('0x40'),_0xcfd8('0x2d'),_0x2a8477,_0xcfd8('0x41'),'updatedAt'],squel[_0xcfd8('0x43')]()[_0xcfd8('0x44')](_0xcfd8('0x26'),_0xcfd8('0x26'))[_0xcfd8('0x44')](_0xcfd8('0x45'),_0xcfd8('0x3f'))[_0xcfd8('0x44')]('id',_0xcfd8('0x40'))[_0xcfd8('0x44')](LISTID[_0xcfd8('0x46')](),_0xcfd8('0x2d'))[_0xcfd8('0x44')](_0x34bb51['id'][_0xcfd8('0x46')](),_0x2a8477)[_0xcfd8('0x44')](_0xcfd8('0x45'),_0xcfd8('0x41'))[_0xcfd8('0x44')](_0xcfd8('0x45'),_0xcfd8('0x42'))[_0xcfd8('0x4c')](_0xcfd8('0x4d'))[_0xcfd8('0x47')](_0xcfd8('0x48'))[_0xcfd8('0x47')](_0xcfd8('0x4e'),LISTID[_0xcfd8('0x46')]())[_0xcfd8('0x47')]('id\x20IN\x20?',squel[_0xcfd8('0x51')](hopperContacts))[_0xcfd8('0x47')](_0xcfd8('0x49')))[_0xcfd8('0x46')]();return _0x3e24b7;}function _0x3f280c(_0x3c6a72,_0x2e0cf3){var _0x2e710f=squel[_0xcfd8('0x3b')]()[_0xcfd8('0x3c')](_0xcfd8('0x52'))[_0xcfd8('0x3e')]([_0xcfd8('0x26'),'ContactId',_0xcfd8('0x2d'),_0x2e0cf3,'createdAt',_0xcfd8('0x42')],squel['select']()[_0xcfd8('0x44')](_0xcfd8('0x26'),'phone')[_0xcfd8('0x44')]('id',_0xcfd8('0x40'))['field'](LISTID[_0xcfd8('0x46')](),_0xcfd8('0x2d'))[_0xcfd8('0x44')](_0x3c6a72['id']['toString'](),_0x2e0cf3)[_0xcfd8('0x44')](_0xcfd8('0x45'),_0xcfd8('0x41'))[_0xcfd8('0x44')](_0xcfd8('0x45'),_0xcfd8('0x42'))[_0xcfd8('0x4c')](_0xcfd8('0x4d'))['where'](_0xcfd8('0x48'))[_0xcfd8('0x47')](_0xcfd8('0x4e'),LISTID[_0xcfd8('0x46')]())[_0xcfd8('0x47')](_0xcfd8('0x4f'),squel['str'](hopperContacts))[_0xcfd8('0x47')](_0xcfd8('0x49')))[_0xcfd8('0x46')]();return _0x2e710f;}return db[_0xcfd8('0x53')][_0xcfd8('0x54')]({'where':{'type':'outbound'},'attributes':['id',_0xcfd8('0x55')],'include':[{'model':db[_0xcfd8('0x56')],'as':_0xcfd8('0x57'),'where':{'id':LISTID}}]})[_0xcfd8('0x34')](function(_0x51ecae){var _0xb1a0a=[];if(_0x51ecae){var _0x1f250a;for(var _0x24a165=0x0,_0x542bd7;_0x24a165<_0x51ecae[_0xcfd8('0x1f')];_0x24a165+=0x1){_0x542bd7=_0x51ecae[_0x24a165][_0xcfd8('0x58')]({'plain':!![]});switch(_0x542bd7[_0xcfd8('0x55')]){case _0xcfd8('0x59'):_0xb1a0a[_0xcfd8('0x35')](db[_0xcfd8('0x5a')][_0xcfd8('0x5b')](_0x415bc7(_0x542bd7,_0xcfd8('0x5c')))[_0xcfd8('0x34')](function(){})[_0xcfd8('0x37')](_0x263be0()));break;case _0xcfd8('0x5d'):_0xb1a0a['push'](db[_0xcfd8('0x5a')][_0xcfd8('0x5b')](_0x4d22f6(_0x542bd7,_0xcfd8('0x5c')))[_0xcfd8('0x34')](function(){})[_0xcfd8('0x37')](_0x263be0()));break;default:_0xb1a0a[_0xcfd8('0x35')](db['sequelize'][_0xcfd8('0x5b')](_0x229d64(_0x542bd7,'VoiceQueueId'))['then'](function(){})[_0xcfd8('0x37')](_0x263be0()));}}}return _0xb1a0a;})[_0xcfd8('0x5e')]()['then'](function(){return db[_0xcfd8('0x53')]['findAll']({'where':{'type':_0xcfd8('0x5f')},'attributes':['id'],'include':[{'model':db[_0xcfd8('0x56')],'as':_0xcfd8('0x60'),'where':{'id':LISTID}}]})[_0xcfd8('0x34')](function(_0x362740){var _0x272147=[];if(_0x362740){var _0x6bebf8;for(var _0x380859=0x0,_0x39592e;_0x380859<_0x362740[_0xcfd8('0x1f')];_0x380859+=0x1){_0x39592e=_0x362740[_0x380859]['get']({'plain':!![]});_0x272147['push'](db[_0xcfd8('0x5a')][_0xcfd8('0x5b')](_0x3f280c(_0x39592e,'VoiceQueueId'))[_0xcfd8('0x34')](function(){})[_0xcfd8('0x37')](_0x263be0()));}}return _0x272147;})[_0xcfd8('0x5e')]();})[_0xcfd8('0x34')](function(){return db[_0xcfd8('0x61')][_0xcfd8('0x54')]({'attributes':['id',_0xcfd8('0x55')],'include':[{'model':db[_0xcfd8('0x56')],'as':_0xcfd8('0x57'),'where':{'id':LISTID}}]})[_0xcfd8('0x34')](function(_0x11828c){var _0x282239=[];if(_0x11828c){for(var _0x1c7598=0x0,_0x50fc77;_0x1c7598<_0x11828c[_0xcfd8('0x1f')];_0x1c7598+=0x1){_0x50fc77=_0x11828c[_0x1c7598][_0xcfd8('0x58')]({'plain':!![]});switch(_0x50fc77[_0xcfd8('0x55')]){case _0xcfd8('0x59'):_0x282239[_0xcfd8('0x35')](db['sequelize'][_0xcfd8('0x5b')](_0x415bc7(_0x50fc77,_0xcfd8('0x62')))[_0xcfd8('0x34')](function(){})[_0xcfd8('0x37')](_0x263be0()));break;case'onlyIfOpen':_0x282239[_0xcfd8('0x35')](db[_0xcfd8('0x5a')]['query'](_0x4d22f6(_0x50fc77,_0xcfd8('0x62')))[_0xcfd8('0x34')](function(){})[_0xcfd8('0x37')](_0x263be0()));break;default:_0x282239[_0xcfd8('0x35')](db[_0xcfd8('0x5a')][_0xcfd8('0x5b')](_0x229d64(_0x50fc77,'CampaignId'))['then'](function(){})['catch'](_0x263be0()));}}}return _0x282239;})[_0xcfd8('0x5e')]();})[_0xcfd8('0x34')](function(){return db[_0xcfd8('0x61')]['findAll']({'attributes':['id'],'include':[{'model':db[_0xcfd8('0x56')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x4b56dd){var _0x257c7b=[];if(_0x4b56dd){for(var _0x1358fb=0x0,_0x30804a;_0x1358fb<_0x4b56dd[_0xcfd8('0x1f')];_0x1358fb+=0x1){_0x30804a=_0x4b56dd[_0x1358fb][_0xcfd8('0x58')]({'plain':!![]});_0x257c7b[_0xcfd8('0x35')](db['sequelize'][_0xcfd8('0x5b')](_0x3f280c(_0x30804a,_0xcfd8('0x62')))['then'](function(){})[_0xcfd8('0x37')](_0x263be0()));}}return _0x257c7b;})[_0xcfd8('0x5e')]();})[_0xcfd8('0x37')](function(_0x4ed407){logger['error'](_0xcfd8('0x63'),'generalCheckHopper',_0x4ed407[_0xcfd8('0x21')]);});}var processPromises=function(_0xcb055f){return BPromise['all'](promises)['then'](function(_0xfbf3ca){})['catch'](function(_0x30f38f){logger[_0xcfd8('0x18')]('Error\x20processing\x20rows\x20block:',JSON[_0xcfd8('0x64')](_0x30f38f));})['finally'](function(){socket[_0xcfd8('0x65')](_0xcfd8('0x66')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xcb055f){return _0xcb055f[_0xcfd8('0x67')]();}});};var endCsv=function(){return BPromise[_0xcfd8('0x68')]()[_0xcfd8('0x34')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xcfd8('0x65')](_0xcfd8('0x66')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xcfd8('0x69')](FILEPATH);}catch(_0x1964b){logger[_0xcfd8('0x18')](_0xcfd8('0x6a'),JSON['stringify'](_0x1964b));}finally{process[_0xcfd8('0x6b')](0x0);}});};process['on'](_0xcfd8('0x6c'),function(){logger['info'](_0xcfd8('0x6d'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xcfd8('0x31')][_0xcfd8('0x54')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xcfd8('0x34')](function(_0x55ea3a){var _0x878544=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xcfd8('0x6e')](_0x878544,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1f0aad,_0x4b493a){total+=0x1;var _0x2754ad=total;promises['push'](checkRow(_0x1f0aad,_0x55ea3a,_0x2754ad)[_0xcfd8('0x34')](function(){success+=0x1;})[_0xcfd8('0x37')](function(_0x25d47b){if(_0x25d47b[_0xcfd8('0x18')]){errors+=0x1;delete _0x25d47b[_0xcfd8('0x18')];}else if(_0x25d47b['duplicate']){duplicates+=0x1;delete _0x25d47b[_0xcfd8('0x6f')];}rows[_0xcfd8('0x35')](_0x25d47b);}));if(total%0xc8===0x0){_0x4b493a[_0xcfd8('0x70')]();return processPromises(_0x4b493a);}},'complete':function(){return processPromises()[_0xcfd8('0x34')](function(){logger[_0xcfd8('0x71')](_0xcfd8('0x72'));endCsv();});},'error':function(_0x2f0c71,_0x111846){logger['info'](_0xcfd8('0x73'),JSON[_0xcfd8('0x64')](_0x2f0c71));endCsv();}});})[_0xcfd8('0x37')](function(_0x19c670){logger['error'](_0xcfd8('0x74'),JSON[_0xcfd8('0x64')](_0x19c670));});}main(); \ No newline at end of file +var _0x6877=['redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','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\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','find','duplicate','CmContact','create','then','pick','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','select','field','NOW()','toString','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','id\x20IN\x20?','calleridnum','\x20=\x20?','str','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','push','sequelize','VoiceQueueId','onlyIfOpen','catch','query','all','BlackLists','always','CampaignId','Campaign','Error\x20processing\x20rows\x20block:','stringify','emit','resume','resolve','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api'];(function(_0x1ea4d6,_0x4b3516){var _0x4e77d6=function(_0x114184){while(--_0x114184){_0x1ea4d6['push'](_0x1ea4d6['shift']());}};_0x4e77d6(++_0x4b3516);}(_0x6877,0xd4));var _0x7687=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x6877[_0x267d8d];return _0x11a98f;};'use strict';var BPromise=require(_0x7687('0x0'));var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x7687('0x1'));var db=require(_0x7687('0x2'))['db'];var config=require(_0x7687('0x3'));var logger=require(_0x7687('0x4'))(_0x7687('0x5'));config[_0x7687('0x6')]=_[_0x7687('0x7')](config[_0x7687('0x6')],{'host':_0x7687('0x8'),'port':0x18eb});var socket=require(_0x7687('0x9'))(new Redis(config[_0x7687('0x6')]));require(_0x7687('0xa'))['register'](socket);try{if(!process[_0x7687('0xb')][0x2]||process[_0x7687('0xb')][0x2]===_0x7687('0xc')||process['argv'][0x2]===_0x7687('0xd')){throw new Error(_0x7687('0xe'));}var FILEPATH=process[_0x7687('0xb')][0x2];if(!process[_0x7687('0xb')][0x3]||process[_0x7687('0xb')][0x3]===_0x7687('0xc')||process[_0x7687('0xb')][0x3]===_0x7687('0xd')||!process[_0x7687('0xb')][0x4]||process[_0x7687('0xb')][0x4]==='undefined'||process['argv'][0x4]===_0x7687('0xd')){throw new Error(_0x7687('0xf'));}var FIELDS=_[_0x7687('0x10')](process['argv'][0x3]['split'](','),process[_0x7687('0xb')][0x4]['split'](','));if(!process['argv'][0x5]||process[_0x7687('0xb')][0x5]===_0x7687('0xc')||process['argv'][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7687('0xb')][0x6]&&process[_0x7687('0xb')][0x6]!==_0x7687('0xc')&&process['argv'][0x6]!==_0x7687('0xd')?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x7687('0xb')][0x7]!==_0x7687('0xc')&&process[_0x7687('0xb')][0x7]!=='null'?process[_0x7687('0xb')][0x7]:null;if(!process['argv'][0x8]||process[_0x7687('0xb')][0x8]===_0x7687('0xc')||process['argv'][0x8]===_0x7687('0xd')){throw new Error(_0x7687('0x11'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x32a72c){logger[_0x7687('0x12')](_0x32a72c);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(_0x4e37af,_0x177caa,_0x527baa,_0x2ddb48){var _0x29809a={'message':_0x177caa};_0x29809a[_0x4e37af]=!![];if(_0x527baa){_0x29809a[_0x7687('0x13')]=_0x527baa;}if(_0x2ddb48){_0x29809a[_0x7687('0x14')]=_0x2ddb48;}return _0x29809a;}function isEmail(_0x3a9cd6){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))*$/[_0x7687('0x15')](_0x3a9cd6);}function checkRow(_0x50445b,_0x107c49,_0x18d38f){return new BPromise(function(_0x3e5970,_0x1d31d2){if(_[_0x7687('0x16')](_0x50445b)){return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),_0x7687('0x17'),null,_0x18d38f));}if(_0x50445b[_0x7687('0x18')]&&_0x50445b[_0x7687('0x18')]['length']){var _0x4efd6a=_[_0x7687('0x19')](_0x50445b['errors'],_0x7687('0x1a'))[_0x7687('0x1b')](';');return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),_0x4efd6a,null,_0x18d38f));}var _0x3fd072={};for(var _0x2907fe in FIELDS){if(FIELDS[_0x7687('0x1c')](_0x2907fe)&&FIELDS[_0x2907fe]){_0x3fd072[_0x2907fe]=_0x50445b['data'][0x0][FIELDS[_0x2907fe]]||_0x50445b[_0x7687('0x1d')][0x0]['\ufeff'+FIELDS[_0x2907fe]];}}if(!_0x3fd072['firstName']){return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),_0x7687('0x1e'),null,_0x18d38f));}if(!_0x3fd072['phone']){return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),_0x7687('0x1f'),null,_0x18d38f));}if(_0x3fd072[_0x7687('0x20')]){var _0x2277f8=moment(_0x3fd072['birthDate'],_0x7687('0x21'));if(!_0x2277f8[_0x7687('0x22')]()){return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x18d38f));}}if(_0x3fd072[_0x7687('0x23')]){if(!isEmail(_0x3fd072['email'])){return _0x1d31d2(handleCheckRowError(_0x7687('0x12'),_0x7687('0x24'),null,_0x18d38f));}}_0x3fd072['ListId']=LISTID;_0x3fd072[_0x7687('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7687('0x26')]&&_0x107c49){var _0x516578={};for(var _0x1d97b8=0x0,_0x540232=DUPLICATES['length'];_0x1d97b8<_0x540232;_0x1d97b8+=0x1){_0x516578[DUPLICATES[_0x1d97b8]]=_0x3fd072[DUPLICATES[_0x1d97b8]];}var _0x2fa7eb=_[_0x7687('0x27')](_0x107c49,_0x516578);if(_0x2fa7eb){return _0x1d31d2(handleCheckRowError(_0x7687('0x28'),'Duplicate\x20Contact',_0x2fa7eb,_0x18d38f));}}return db[_0x7687('0x29')][_0x7687('0x2a')](_0x3fd072,{'raw':!![],'hooks':![],'fields':_['keys'](_0x3fd072)})[_0x7687('0x2b')](function(_0x2bfb8a){if(DUPLICATES&&DUPLICATES[_0x7687('0x26')]&&_0x107c49){_0x107c49['push'](_[_0x7687('0x2c')](_0x3fd072,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2bfb8a['id'];return _0x3e5970();})['catch'](function(_0x149ca0){return _0x1d31d2(handleCheckRowError('error',_0x7687('0x2d')+(_0x149ca0[_0x7687('0x1a')]||JSON['stringify'](_0x149ca0)),null,_0x18d38f));});});}function checkHopper(){function _0x2cff99(){return function(_0x2f91d8){logger[_0x7687('0x12')](_0x7687('0x2e'),_0x7687('0x2f'),util[_0x7687('0x30')](_0x2f91d8,{'showHidden':![],'depth':null}));};}var _0x20ae1a=function(_0x1c20e3,_0x25da4a){var _0x21f19c=squel[_0x7687('0x31')]()[_0x7687('0x32')](_0x7687('0x33'))[_0x7687('0x34')]([_0x7687('0x35'),_0x7687('0x36'),_0x7687('0x37'),_0x7687('0x38'),_0x25da4a,_0x7687('0x39'),'updatedAt'],squel[_0x7687('0x3a')]()[_0x7687('0x3b')]('phone','phone')[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x36'))[_0x7687('0x3b')]('id','ContactId')[_0x7687('0x3b')](LISTID[_0x7687('0x3d')](),'ListId')[_0x7687('0x3b')](_0x1c20e3['id'][_0x7687('0x3d')](),_0x25da4a)[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x39'))[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x3e'))[_0x7687('0x3f')](_0x7687('0x40'))['where'](_0x7687('0x41'))[_0x7687('0x42')](_0x7687('0x43'),LISTID[_0x7687('0x3d')]())[_0x7687('0x42')](_0x7687('0x44'))[_0x7687('0x42')](_0x7687('0x45'),squel[_0x7687('0x3a')]()[_0x7687('0x3b')](_0x7687('0x35'))[_0x7687('0x3f')](_0x7687('0x33'))['where'](_0x25da4a+'\x20=\x20?',_0x1c20e3['id'][_0x7687('0x3d')]())))[_0x7687('0x3d')]();return _0x21f19c;};var _0x34b52b=function(_0x167333,_0x5b5000){var _0x1f855a=squel[_0x7687('0x31')]()[_0x7687('0x32')](_0x7687('0x33'))[_0x7687('0x34')]([_0x7687('0x35'),'scheduledAt',_0x7687('0x37'),'ListId',_0x5b5000,_0x7687('0x39'),_0x7687('0x3e')],squel[_0x7687('0x3a')]()[_0x7687('0x3b')](_0x7687('0x35'),_0x7687('0x35'))[_0x7687('0x3b')](_0x7687('0x3c'),'scheduledAt')[_0x7687('0x3b')]('id','ContactId')['field'](LISTID[_0x7687('0x3d')](),_0x7687('0x38'))['field'](_0x167333['id']['toString'](),_0x5b5000)[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x39'))[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x3e'))[_0x7687('0x3f')](_0x7687('0x40'))[_0x7687('0x42')](_0x7687('0x41'))[_0x7687('0x42')]('ListId\x20=\x20?',LISTID[_0x7687('0x3d')]())['where'](_0x7687('0x46'),squel['str'](hopperContacts))[_0x7687('0x42')](_0x7687('0x44'))['where'](_0x7687('0x45'),squel[_0x7687('0x3a')]()['field'](_0x7687('0x47'))[_0x7687('0x3f')]('cm_hopper_final')[_0x7687('0x42')](_0x5b5000+_0x7687('0x48'),_0x167333['id']['toString']()))[_0x7687('0x42')](_0x7687('0x45'),squel[_0x7687('0x3a')]()[_0x7687('0x3b')]('phone')['from']('cm_hopper')['where'](_0x5b5000+'\x20=\x20?',_0x167333['id'][_0x7687('0x3d')]())))['toString']();return _0x1f855a;};function _0x4ae7ab(_0x3e898c,_0x40581e){var _0x3430b5=squel[_0x7687('0x31')]()[_0x7687('0x32')](_0x7687('0x33'))[_0x7687('0x34')]([_0x7687('0x35'),_0x7687('0x36'),'ContactId',_0x7687('0x38'),_0x40581e,_0x7687('0x39'),_0x7687('0x3e')],squel['select']()[_0x7687('0x3b')](_0x7687('0x35'),'phone')['field'](_0x7687('0x3c'),_0x7687('0x36'))[_0x7687('0x3b')]('id','ContactId')[_0x7687('0x3b')](LISTID[_0x7687('0x3d')](),'ListId')[_0x7687('0x3b')](_0x3e898c['id']['toString'](),_0x40581e)[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x39'))['field'](_0x7687('0x3c'),_0x7687('0x3e'))['from'](_0x7687('0x40'))[_0x7687('0x42')](_0x7687('0x41'))[_0x7687('0x42')]('ListId\x20=\x20?',LISTID[_0x7687('0x3d')]())[_0x7687('0x42')](_0x7687('0x46'),squel[_0x7687('0x49')](hopperContacts))[_0x7687('0x42')](_0x7687('0x44')))[_0x7687('0x3d')]();return _0x3430b5;}function _0x599a64(_0x42e3c5,_0x495c36){var _0xcbb366=squel['insert']()[_0x7687('0x32')](_0x7687('0x4a'))['fromQuery']([_0x7687('0x35'),_0x7687('0x37'),'ListId',_0x495c36,_0x7687('0x39'),'updatedAt'],squel['select']()[_0x7687('0x3b')](_0x7687('0x35'),_0x7687('0x35'))[_0x7687('0x3b')]('id',_0x7687('0x37'))[_0x7687('0x3b')](LISTID[_0x7687('0x3d')](),_0x7687('0x38'))['field'](_0x42e3c5['id'][_0x7687('0x3d')](),_0x495c36)[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x39'))[_0x7687('0x3b')](_0x7687('0x3c'),_0x7687('0x3e'))[_0x7687('0x3f')](_0x7687('0x40'))[_0x7687('0x42')](_0x7687('0x41'))['where'](_0x7687('0x43'),LISTID[_0x7687('0x3d')]())[_0x7687('0x42')]('id\x20IN\x20?',squel[_0x7687('0x49')](hopperContacts))[_0x7687('0x42')](_0x7687('0x44')))[_0x7687('0x3d')]();return _0xcbb366;}return db[_0x7687('0x4b')][_0x7687('0x4c')]({'where':{'type':_0x7687('0x4d')},'attributes':['id',_0x7687('0x4e')],'include':[{'model':db[_0x7687('0x4f')],'as':_0x7687('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x54b04f){var _0x80bb82=[];if(_0x54b04f){var _0xdef4e3;for(var _0x4b2913=0x0,_0x3f411f;_0x4b2913<_0x54b04f[_0x7687('0x26')];_0x4b2913+=0x1){_0x3f411f=_0x54b04f[_0x4b2913][_0x7687('0x51')]({'plain':!![]});switch(_0x3f411f['dialCheckDuplicateType']){case'always':_0x80bb82[_0x7687('0x52')](db[_0x7687('0x53')]['query'](_0x34b52b(_0x3f411f,_0x7687('0x54')))[_0x7687('0x2b')](function(){})['catch'](_0x2cff99()));break;case _0x7687('0x55'):_0x80bb82['push'](db['sequelize']['query'](_0x20ae1a(_0x3f411f,_0x7687('0x54')))[_0x7687('0x2b')](function(){})[_0x7687('0x56')](_0x2cff99()));break;default:_0x80bb82['push'](db[_0x7687('0x53')][_0x7687('0x57')](_0x4ae7ab(_0x3f411f,'VoiceQueueId'))[_0x7687('0x2b')](function(){})['catch'](_0x2cff99()));}}}return _0x80bb82;})[_0x7687('0x58')]()[_0x7687('0x2b')](function(){return db[_0x7687('0x4b')][_0x7687('0x4c')]({'where':{'type':_0x7687('0x4d')},'attributes':['id'],'include':[{'model':db[_0x7687('0x4f')],'as':_0x7687('0x59'),'where':{'id':LISTID}}]})[_0x7687('0x2b')](function(_0x901156){var _0x5bd7c1=[];if(_0x901156){var _0x164a13;for(var _0x1edfa9=0x0,_0xe987dc;_0x1edfa9<_0x901156['length'];_0x1edfa9+=0x1){_0xe987dc=_0x901156[_0x1edfa9][_0x7687('0x51')]({'plain':!![]});_0x5bd7c1[_0x7687('0x52')](db[_0x7687('0x53')][_0x7687('0x57')](_0x599a64(_0xe987dc,_0x7687('0x54')))[_0x7687('0x2b')](function(){})[_0x7687('0x56')](_0x2cff99()));}}return _0x5bd7c1;})[_0x7687('0x58')]();})['then'](function(){return db['Campaign'][_0x7687('0x4c')]({'attributes':['id',_0x7687('0x4e')],'include':[{'model':db['CmList'],'as':_0x7687('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x4ec454){var _0x380a4c=[];if(_0x4ec454){for(var _0x468356=0x0,_0x2de082;_0x468356<_0x4ec454['length'];_0x468356+=0x1){_0x2de082=_0x4ec454[_0x468356][_0x7687('0x51')]({'plain':!![]});switch(_0x2de082[_0x7687('0x4e')]){case _0x7687('0x5a'):_0x380a4c['push'](db['sequelize'][_0x7687('0x57')](_0x34b52b(_0x2de082,'CampaignId'))[_0x7687('0x2b')](function(){})[_0x7687('0x56')](_0x2cff99()));break;case'onlyIfOpen':_0x380a4c['push'](db['sequelize'][_0x7687('0x57')](_0x20ae1a(_0x2de082,_0x7687('0x5b')))['then'](function(){})['catch'](_0x2cff99()));break;default:_0x380a4c['push'](db[_0x7687('0x53')]['query'](_0x4ae7ab(_0x2de082,_0x7687('0x5b')))[_0x7687('0x2b')](function(){})[_0x7687('0x56')](_0x2cff99()));}}}return _0x380a4c;})[_0x7687('0x58')]();})[_0x7687('0x2b')](function(){return db[_0x7687('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7687('0x59'),'where':{'id':LISTID}}]})['then'](function(_0x464664){var _0x1a6d87=[];if(_0x464664){for(var _0x274e85=0x0,_0x4ce6a3;_0x274e85<_0x464664[_0x7687('0x26')];_0x274e85+=0x1){_0x4ce6a3=_0x464664[_0x274e85]['get']({'plain':!![]});_0x1a6d87[_0x7687('0x52')](db[_0x7687('0x53')]['query'](_0x599a64(_0x4ce6a3,'CampaignId'))[_0x7687('0x2b')](function(){})[_0x7687('0x56')](_0x2cff99()));}}return _0x1a6d87;})[_0x7687('0x58')]();})[_0x7687('0x56')](function(_0x20fd57){logger[_0x7687('0x12')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x20fd57['message']);});}var processPromises=function(_0x4f82a5){return BPromise[_0x7687('0x58')](promises)[_0x7687('0x2b')](function(_0x137708){})[_0x7687('0x56')](function(_0x519add){logger['error'](_0x7687('0x5d'),JSON[_0x7687('0x5e')](_0x519add));})['finally'](function(){socket[_0x7687('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4f82a5){return _0x4f82a5[_0x7687('0x60')]();}});};var endCsv=function(){return BPromise[_0x7687('0x61')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7687('0x2b')](function(){socket[_0x7687('0x5f')](_0x7687('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7687('0x63')](FILEPATH);}catch(_0x1cb78c){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x7687('0x5e')](_0x1cb78c));}finally{process[_0x7687('0x64')](0x0);}});};process['on'](_0x7687('0x65'),function(){logger['info'](_0x7687('0x66'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x7687('0x29')][_0x7687('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7687('0x2b')](function(_0x48bef1){var _0x48964f=fs[_0x7687('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7687('0x68')](_0x48964f,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5be92d,_0x4069b2){total+=0x1;var _0xcd884d=total;promises[_0x7687('0x52')](checkRow(_0x5be92d,_0x48bef1,_0xcd884d)['then'](function(){success+=0x1;})[_0x7687('0x56')](function(_0x3c6ecf){if(_0x3c6ecf[_0x7687('0x12')]){errors+=0x1;delete _0x3c6ecf[_0x7687('0x12')];}else if(_0x3c6ecf[_0x7687('0x28')]){duplicates+=0x1;delete _0x3c6ecf[_0x7687('0x28')];}rows[_0x7687('0x52')](_0x3c6ecf);}));if(total%0xc8===0x0){_0x4069b2[_0x7687('0x69')]();return processPromises(_0x4069b2);}},'complete':function(){return processPromises()[_0x7687('0x2b')](function(){logger[_0x7687('0x6a')](_0x7687('0x6b'));endCsv();});},'error':function(_0x42263f,_0x37986f){logger['info']('CSV\x20parse\x20error',JSON[_0x7687('0x5e')](_0x42263f));endCsv();}});})[_0x7687('0x56')](function(_0x17b278){logger[_0x7687('0x12')](_0x7687('0x6c'),JSON[_0x7687('0x5e')](_0x17b278));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 1bc7387..c22218e 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 _0x7d5b=['cm_hopper_black','phone','cm_contacts','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','toString','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.priority','ContactId','updatedAt','\x22always\x22','\x22onlyIfOpen\x22','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','Received\x20SIGINT','error','message','exit','errors','sequelize','query','spread','catch','campaigns.dialTimezone','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','info','main','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','contact:import:','Abort\x20parser','abort','SystemError','duplicates','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','CampaignId','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','push','all','AdditionalPhones','split','then','length','isNil','filter','CmContactHasItem','update','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','priority','UserId','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt'];(function(_0x568fd3,_0x105de5){var _0x164575=function(_0x2f0c06){while(--_0x2f0c06){_0x568fd3['push'](_0x568fd3['shift']());}};_0x164575(++_0x105de5);}(_0x7d5b,0x131));var _0xb7d5=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7d5b[_0x17d9e3];return _0x14192d;};'use strict';var fs=require('fs');var path=require(_0xb7d5('0x0'));var _=require(_0xb7d5('0x1'));var Papa=require('papaparse');var util=require(_0xb7d5('0x2'));var BPromise=require(_0xb7d5('0x3'));var moment=require(_0xb7d5('0x4'));var squel=require('squel');var Redis=require(_0xb7d5('0x5'));var db=require(_0xb7d5('0x6'))['db'];var config=require(_0xb7d5('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0xb7d5('0x8'))('import');config[_0xb7d5('0x9')]=_[_0xb7d5('0xa')](config[_0xb7d5('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xb7d5('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xb7d5('0xc')](_0xb7d5('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xb7d5('0xd'));function isEmail(_0x5e3a82){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))*$/[_0xb7d5('0xe')](_0x5e3a82);}function selectNotIn(_0x50b972,_0x523819,_0x3123f1,_0x393b60,_0x9d89c5){return squel[_0xb7d5('0xf')]()[_0xb7d5('0x10')]('phone')['from'](_0x393b60)[_0xb7d5('0x11')](_0x523819,null,_0x523819+_0xb7d5('0x12')+_0x393b60+'.'+_0x3123f1)[_0xb7d5('0x13')](_0x393b60+'.'+_0x3123f1+_0xb7d5('0x14')+_0x50b972+'.'+_0x3123f1)[_0xb7d5('0x13')](_0x523819+_0xb7d5('0x15')+_0x9d89c5[_0xb7d5('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1cee2c,_0x207b6e){promisesAdditionalPhones=[];return db[_0xb7d5('0x16')][_0xb7d5('0x17')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x187318){if(_0x187318!==null){var _0x18de19=[];for(var _0x599180=0x0;_0x599180<_0x187318['length'];_0x599180++){var _0x5b7fcc=_0x187318[_0x599180];_0x18de19[_0xb7d5('0x18')](insertAdditionalPhones(_0x5b7fcc));}}Promise[_0xb7d5('0x19')](_0x18de19)['then'](function(){_0x1cee2c({'val':0x1});});});});}function insertAdditionalPhones(_0xe5be0b){return new Promise(function(_0x417be2,_0x147318){var _0x432cf5=_0xe5be0b[_0xb7d5('0x1a')];var _0xd62ecb=_0x432cf5[_0xb7d5('0x1b')](';');var _0x40f2cb=[];orderBy=0x0;for(var _0x18692d=0x0;_0x18692d<_0xd62ecb['length'];_0x18692d++){_0x40f2cb[_0xb7d5('0x18')](splitAdditionalPhone(_0xe5be0b['id'],_0xd62ecb[_0x18692d]));}Promise[_0xb7d5('0x19')](_0x40f2cb)[_0xb7d5('0x1c')](function(){_0x417be2({'val':_0xd62ecb[_0xb7d5('0x1d')]});});});}function splitAdditionalPhone(_0x4ca3d1,_0x38060c){return new Promise(function(_0x57c470,_0x455e37){var _0x51db6f=_0x38060c[_0xb7d5('0x1b')](':');var _0x5732e3=_0x51db6f[0x0];var _0xfb43da=_0x51db6f[0x1];if(!_[_0xb7d5('0x1e')](_0xfb43da)){var _0x2b64b7=_0xfb43da[_0xb7d5('0x1b')]('|');var _0x590e4a=[];for(var _0x3eb147=0x0;_0x3eb147<_0x2b64b7[_0xb7d5('0x1d')];_0x3eb147++){if(_0x2b64b7[_0x3eb147]!==''){var _0x18ce4a=_[_0xb7d5('0x1f')](promisesAdditionalPhones,{'contactId':_0x4ca3d1,'phone':_0x2b64b7[_0x3eb147]});if(_0x18ce4a[_0xb7d5('0x1d')]==0x0){orderBy++;promisesAdditionalPhones[_0xb7d5('0x18')]({'contactId':_0x4ca3d1,'contactTypeId':_0x5732e3,'phone':_0x2b64b7[_0x3eb147],'orderBy':orderBy});}}}_0x57c470({'ok':0x1});}else _0x57c470({'res':0x0});});}function createAdditionalPhone(_0x314124,_0x1dfecd,_0x3d425c,_0x36f91d){var _0x288c72='';var _0x23731d='';var _0x1c19ff=_0x3d425c[_0xb7d5('0x1b')]('§');_0x288c72=_0x1c19ff[0x0];if(_0x1c19ff[_0xb7d5('0x1d')]==0x2)_0x23731d=_0x1c19ff[0x1];return new Promise(function(_0x413baf,_0x7a6cfa){return db[_0xb7d5('0x20')]['findOne']({'where':{'CmContactId':_0x314124,'item':_0x288c72}})[_0xb7d5('0x1c')](function(_0x47161b){if(_0x47161b){return db[_0xb7d5('0x20')][_0xb7d5('0x21')]({'ItemTypeId':_0x1dfecd,'description':_0x23731d,'OrderBy':_0x36f91d},{'where':{'CmContactId':_0x314124,'item':_0x288c72}})[_0xb7d5('0x1c')](function(_0x62ee41){_0x413baf({'res':_0xb7d5('0x22')});});}else{return db['CmContactHasItem'][_0xb7d5('0x23')]({'CmContactId':_0x314124,'item':_0x288c72,'description':_0x23731d,'ItemTypeId':_0x1dfecd,'OrderBy':_0x36f91d,'ItemClass':'PHONE'})['then'](function(_0x438562){_0x413baf({'res':_0xb7d5('0x24')});});}});});}function insertCmHopper(_0x589bf,_0x3da4cf,_0x6ca094,_0x419718,_0x33bb99){var _0x3128d1=[_0xb7d5('0x25'),_0xb7d5('0x26'),_0xb7d5('0x27'),'cm_contacts.ListId',_0x3da4cf+'.'+_0x419718,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0xb7d5('0x28'),'\x22'+_0x33bb99+'\x22'];return squel[_0xb7d5('0x29')]()[_0xb7d5('0x2a')](_0xb7d5('0x2b'))[_0xb7d5('0x2c')](['phone',_0xb7d5('0x2d'),'ContactId',_0xb7d5('0x2e'),_0x419718,_0xb7d5('0x2f'),'updatedAt',_0xb7d5('0x30'),_0xb7d5('0x31'),'recallme'],squel['select']()[_0xb7d5('0x32')](_0x3128d1)[_0xb7d5('0x33')](_0x3da4cf)[_0xb7d5('0x11')]('cm_contacts',null,_0xb7d5('0x34')+_0x3da4cf+_0xb7d5('0x35'))[_0xb7d5('0x11')](_0x6ca094,null,_0x6ca094+_0xb7d5('0x12')+_0x3da4cf+'.'+_0x419718)[_0xb7d5('0x13')](_0x3da4cf+_0xb7d5('0x36'),_0x589bf)[_0xb7d5('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xb7d5('0x37'),selectNotIn(_0x3da4cf,_0x6ca094,_0x419718,_0xb7d5('0x2b'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xb7d5('0x13')](_0xb7d5('0x37'),selectNotIn(_0x3da4cf,_0x6ca094,_0x419718,_0xb7d5('0x2b'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x1e0218,_0x580cf5,_0x98ce3c,_0x5ede96){var _0x295482=['cm_contacts.phone','cm_contacts.id',_0xb7d5('0x38'),_0x580cf5+'.'+_0x5ede96,_0xb7d5('0x39'),_0xb7d5('0x3a')];return squel['insert']()[_0xb7d5('0x2a')](_0xb7d5('0x3b'))['fromQuery']([_0xb7d5('0x3c'),'ContactId','ListId',_0x5ede96,_0xb7d5('0x2f'),'updatedAt'],squel['select']()['fields'](_0x295482)[_0xb7d5('0x33')](_0x580cf5)[_0xb7d5('0x11')](_0xb7d5('0x3d'),null,_0xb7d5('0x34')+_0x580cf5+_0xb7d5('0x35'))[_0xb7d5('0x11')](_0x98ce3c,null,_0x98ce3c+_0xb7d5('0x12')+_0x580cf5+'.'+_0x5ede96)[_0xb7d5('0x13')](_0x580cf5+_0xb7d5('0x36'),_0x1e0218)[_0xb7d5('0x13')](_0xb7d5('0x3e'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xb7d5('0xf')]()['field']('phone')[_0xb7d5('0x33')](_0xb7d5('0x3b'))[_0xb7d5('0x13')](_0xb7d5('0x3f'),_0x1e0218)[_0xb7d5('0x13')](_0x5ede96+'\x20=\x20'+_0x580cf5+'.'+_0x5ede96)))[_0xb7d5('0x40')]();}function insertTzCmHopper(_0x1337e8,_0x5be8cf,_0x29aa34,_0x3ce35f,_0x50eee9,_0xce42c){var _0x430260=[_0xb7d5('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0xce42c+_0xb7d5('0x41'),_0xb7d5('0x27'),_0xb7d5('0x38'),_0x5be8cf+'.'+_0x3ce35f,_0xb7d5('0x39'),_0xb7d5('0x3a'),_0xb7d5('0x42'),_0xb7d5('0x28'),'\x22'+_0x50eee9+'\x22'];var _0x4fde4f=squel['insert']()[_0xb7d5('0x2a')](_0xb7d5('0x2b'))[_0xb7d5('0x2c')]([_0xb7d5('0x3c'),'scheduledat',_0xb7d5('0x43'),'ListId',_0x3ce35f,_0xb7d5('0x2f'),_0xb7d5('0x44'),_0xb7d5('0x30'),_0xb7d5('0x31'),'recallme'],squel[_0xb7d5('0xf')]()[_0xb7d5('0x32')](_0x430260)[_0xb7d5('0x33')](_0x5be8cf)[_0xb7d5('0x11')](_0xb7d5('0x3d'),null,_0xb7d5('0x34')+_0x5be8cf+_0xb7d5('0x35'))['join'](_0x29aa34,null,_0x29aa34+'.id\x20=\x20'+_0x5be8cf+'.'+_0x3ce35f)['join'](_0xce42c,null,_0xce42c+_0xb7d5('0x12')+_0x5be8cf+'.'+_0x3ce35f)[_0xb7d5('0x13')](_0x5be8cf+_0xb7d5('0x36'),_0x1337e8)['where'](_0xb7d5('0x3e'),NOW)['where'](_0xb7d5('0x37'),selectNotIn(_0x5be8cf,_0x29aa34,_0x3ce35f,'cm_hopper',[_0xb7d5('0x45'),_0xb7d5('0x46')]))['where'](_0xb7d5('0x37'),selectNotIn(_0x5be8cf,_0x29aa34,_0x3ce35f,_0xb7d5('0x2b'),[_0xb7d5('0x45')])))['toString']();return _0x4fde4f;}function insertTzCmHopperBlack(_0x431aed,_0x3f5d78,_0x2587de,_0x36f9bb){var _0x107df1=[_0xb7d5('0x25'),_0xb7d5('0x27'),'cm_contacts.ListId',_0x3f5d78+'.'+_0x36f9bb,_0xb7d5('0x39'),_0xb7d5('0x3a')];return squel['insert']()[_0xb7d5('0x2a')](_0xb7d5('0x3b'))['fromQuery'](['phone',_0xb7d5('0x43'),'ListId',_0x36f9bb,'createdAt','updatedAt'],squel[_0xb7d5('0xf')]()[_0xb7d5('0x32')](_0x107df1)[_0xb7d5('0x33')](_0x3f5d78)['join'](_0xb7d5('0x3d'),null,'cm_contacts.ListId\x20=\x20'+_0x3f5d78+_0xb7d5('0x35'))[_0xb7d5('0x11')](_0x2587de,null,_0x2587de+_0xb7d5('0x12')+_0x3f5d78+'.'+_0x36f9bb)[_0xb7d5('0x13')](_0x3f5d78+_0xb7d5('0x36'),_0x431aed)[_0xb7d5('0x13')](_0xb7d5('0x3e'),NOW)['where'](_0xb7d5('0x37'),squel[_0xb7d5('0xf')]()[_0xb7d5('0x10')](_0xb7d5('0x3c'))['from'](_0xb7d5('0x3b'))[_0xb7d5('0x13')](_0xb7d5('0x3f'),_0x431aed)['where'](_0x36f9bb+_0xb7d5('0x14')+_0x3f5d78+'.'+_0x36f9bb)))['toString']();}function insertCmHopperAdditionalPhones(_0x336b81){var _0x1b4783=['cm_hopper.id',_0xb7d5('0x47'),_0xb7d5('0x48'),_0xb7d5('0x49'),_0xb7d5('0x4a')];return squel[_0xb7d5('0x29')]()[_0xb7d5('0x2a')]('cm_hopper_additional_phones')[_0xb7d5('0x2c')]([_0xb7d5('0x4b'),_0xb7d5('0x3c'),_0xb7d5('0x4c'),'createdAt',_0xb7d5('0x44')],squel[_0xb7d5('0xf')]()[_0xb7d5('0x32')](_0x1b4783)[_0xb7d5('0x33')]('cm_hopper')[_0xb7d5('0x11')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xb7d5('0x11')](_0xb7d5('0x4d'),null,_0xb7d5('0x4e'))['where'](_0xb7d5('0x4f'),_0x336b81)[_0xb7d5('0x13')](_0xb7d5('0x3e'),NOW))['toString']();}function insertCmContact(_0x47eec1,_0x4403ea,_0x57e931,_0x55ee36){var _0x341629=_[_0xb7d5('0x50')](_[_0xb7d5('0x51')](_0x55ee36),['ListId',_0xb7d5('0x52'),_0xb7d5('0x2f'),_0xb7d5('0x44')]);return squel[_0xb7d5('0x29')]()[_0xb7d5('0x2a')](_0xb7d5('0x3d'))[_0xb7d5('0x2c')](_0x341629,squel[_0xb7d5('0xf')]()['fields'](_0x341629)[_0xb7d5('0x33')](_0x4403ea)[_0xb7d5('0x13')]('('+_0x57e931[_0xb7d5('0x11')](',')+_0xb7d5('0x53'),squel[_0xb7d5('0xf')]()[_0xb7d5('0x32')](_0x57e931)[_0xb7d5('0x33')](_0xb7d5('0x3d'))['where']('ListId\x20=\x20?',_0x47eec1)['where'](_0xb7d5('0x54')))['where'](_0xb7d5('0x55'),squel[_0xb7d5('0xf')]()[_0xb7d5('0x10')]('MIN(id)',_0xb7d5('0x56'))[_0xb7d5('0x33')](_0x4403ea)[_0xb7d5('0x57')](_0x57e931[_0xb7d5('0x11')](','))))['toString']();}function handleStop(){logger['info'](_0xb7d5('0x58'));stopped=!![];}function handleUncaughtException(_0x2b31a4){logger[_0xb7d5('0x59')](_0x2b31a4[_0xb7d5('0x5a')]);process[_0xb7d5('0x5b')](0x1);}function handleError(_0x42d2c7,_0x487b3f){stats[_0xb7d5('0x5c')][_0xb7d5('0x18')]({'name':_0x487b3f['code'],'message':_0x487b3f['message'],'row':_0x42d2c7});}function handleQuery(_0x313f66){logger['info'](_0x313f66);return db[_0xb7d5('0x5d')][_0xb7d5('0x5e')](_0x313f66)[_0xb7d5('0x5f')](function(_0x4fded6){results['push'](_0x4fded6);})[_0xb7d5('0x60')](function(_0x1b8385){logger['error'](_0x1b8385['message']);});}function updateTzCampaigns(_0x12a6c3){return new Promise(function(_0x356f1c,_0x2d074e){var _0x428963=squel[_0xb7d5('0xf')]()[_0xb7d5('0x32')](['campaigns.id',_0xb7d5('0x61')])[_0xb7d5('0x33')](_0xb7d5('0x62'))['join']('campaigns_has_cm_lists',null,_0xb7d5('0x63'))['where'](_0xb7d5('0x64')+_0x12a6c3);db[_0xb7d5('0x5d')][_0xb7d5('0x5e')](_0x428963[_0xb7d5('0x40')]())[_0xb7d5('0x5f')](function(_0x5606e8){var _0x6232d4=[];for(var _0x2599ac=0x0;_0x2599ac<_0x5606e8[_0xb7d5('0x1d')];_0x2599ac++){_0x6232d4[_0xb7d5('0x18')](getTimezoneData(_0x5606e8[_0x2599ac],tmp_campaigns));}BPromise[_0xb7d5('0x19')](_0x6232d4)[_0xb7d5('0x1c')](function(){_0x356f1c({'val':0x1});});})[_0xb7d5('0x60')](function(_0x3090c0){logger[_0xb7d5('0x59')](_0x3090c0[_0xb7d5('0x5a')]);_0x356f1c({'val':0x0});});});}function updateTzVoiceQueues(_0x2d7866){return new Promise(function(_0x9992e9,_0x27771f){var _0x382c4f=squel[_0xb7d5('0xf')]()[_0xb7d5('0x32')](['voice_queues.id',_0xb7d5('0x65')])['from'](_0xb7d5('0x66'))[_0xb7d5('0x11')](_0xb7d5('0x67'),null,_0xb7d5('0x68'))['where'](_0xb7d5('0x69')+_0x2d7866);db[_0xb7d5('0x5d')][_0xb7d5('0x5e')](_0x382c4f[_0xb7d5('0x40')]())['spread'](function(_0x55a251){var _0x54e78a=[];for(var _0x52e2a5=0x0;_0x52e2a5<_0x55a251[_0xb7d5('0x1d')];_0x52e2a5++){_0x54e78a[_0xb7d5('0x18')](getTimezoneData(_0x55a251[_0x52e2a5],tmp_voice_queues));}BPromise[_0xb7d5('0x19')](_0x54e78a)['then'](function(){_0x9992e9({'val':0x1});});})[_0xb7d5('0x60')](function(_0x39a85f){logger[_0xb7d5('0x59')](_0x39a85f['message']);_0x9992e9({'val':0x0});});});}function getTimezoneData(_0x51a672,_0x3ebd67){return new Promise(function(_0x3f8225,_0x163029){var _0x501ce7=shared[_0xb7d5('0x6a')];var _0x5a5c25=_0x501ce7[_0x51a672[_0xb7d5('0x6b')]];if(_[_0xb7d5('0x1e')](_0x5a5c25)){_0x3f8225({'ret':0x1});}else{var _0x10a450=_0x5a5c25[_0xb7d5('0x6c')];var _0x317401=squel[_0xb7d5('0x29')]()[_0xb7d5('0x2a')](_0x3ebd67)['set']('id',_0x51a672['id'])[_0xb7d5('0x6d')](_0xb7d5('0x6e'),_0x10a450)[_0xb7d5('0x6d')](_0xb7d5('0x6b'),_0x51a672[_0xb7d5('0x6b')])[_0xb7d5('0x40')]();return db[_0xb7d5('0x5d')][_0xb7d5('0x5e')](_0x317401)[_0xb7d5('0x5f')](function(_0x3a323e){_0x3f8225({'ret':0x1});})[_0xb7d5('0x60')](function(_0x3a0548){logger[_0xb7d5('0x59')](_0x3a0548[_0xb7d5('0x5a')]);_0x163029({'ret':0x1});});}});}function handleTZQuery(_0x56a10c){logger[_0xb7d5('0x6f')](_0x56a10c);return db[_0xb7d5('0x5d')]['query'](_0x56a10c)['spread'](function(_0x39027e){})[_0xb7d5('0x60')](function(_0x175019){logger[_0xb7d5('0x59')](_0x175019['message']);});}function main(_0x19fccd,_0x4cd172,_0x5d0227,_0x3413d1){logger[_0xb7d5('0x6f')](_0xb7d5('0x70'),_0x19fccd,JSON[_0xb7d5('0x71')](_0x4cd172));process[_0xb7d5('0x72')](_0xb7d5('0x73'));var _0x3b73d3=_0x4cd172[_0xb7d5('0x74')];var _0x14ce97=_[_0xb7d5('0x75')](_0x3b73d3);var _0x6e6b81=_0x4cd172[_0xb7d5('0x76')];var _0x1b75e1=path['join'](config['root'],_0xb7d5('0x77'),_0x6e6b81+_0xb7d5('0x78'));hasTZ=_[_0xb7d5('0x51')](_0x3b73d3)[_0xb7d5('0x79')](_0xb7d5('0x6b'));var _0x244b2f=_[_0xb7d5('0x51')](_0x3b73d3)['join']();logger[_0xb7d5('0x6f')](_0xb7d5('0x7a'),_0x244b2f);db[_0xb7d5('0x7b')]['findAll']({'raw':!![],'attributes':['id',_0xb7d5('0x7c')]})['then'](function(_0x4f2188){for(var _0x1e3802=0x0;_0x1e3802<_0x4f2188[_0xb7d5('0x1d')];_0x1e3802++){if(_0x4f2188[_0x1e3802]['name']in _0x3b73d3){contactItemTypes[_0xb7d5('0x18')](_0x4f2188[_0x1e3802]);delete _0x14ce97[_0x4f2188[_0x1e3802][_0xb7d5('0x7c')]];hasAdditionalPhones=!![];}for(var _0x590c68 in _0x3b73d3){if(_0x4f2188[_0x1e3802][_0xb7d5('0x7c')]+_0xb7d5('0x7d')===_0x590c68){phoneDescriptions[_0xb7d5('0x18')]({'itemTypeId':_0x4f2188[_0x1e3802]['id'],'description':_0x590c68});delete _0x14ce97[_0x590c68];}}}if(hasAdditionalPhones)_0x14ce97[_0xb7d5('0x1a')]='';var _0x2fe219=_[_0xb7d5('0x51')](_0x14ce97)['join']();logger[_0xb7d5('0x6f')](_0xb7d5('0x7a'),_0x2fe219);fs[_0xb7d5('0x7e')](_0x1b75e1,_0x2fe219+'\x0a');Papa[_0xb7d5('0x7f')](fs[_0xb7d5('0x80')](_0x19fccd),{'header':!![],'skipEmptyLines':!![],'step':function(_0x36da12,_0x58ad30){try{for(var _0x59b88d=0x0,_0x86b023=[];_0x59b88d<_0x36da12[_0xb7d5('0x81')][_0xb7d5('0x1d')];_0x59b88d++){stats[_0xb7d5('0x82')]+=0x1;if(_0x36da12[_0xb7d5('0x5c')][_0x59b88d]){handleError(_0x36da12[_0xb7d5('0x81')][_0x59b88d],_0x36da12[_0xb7d5('0x5c')][_0x59b88d]);}else{var _0x5c8b95=[];var _0x266a5d=[];var _0x3bb3f0={};for(var _0x169c07 in _0x3b73d3){let _0x275ff8=contactItemTypes[_0xb7d5('0x83')](_0x1cb148=>_0x1cb148[_0xb7d5('0x7c')]===_0x169c07);let _0x2ea0d5=contactItemTypes[_0xb7d5('0x83')](_0x3b2e77=>_0x3b2e77['name']+_0xb7d5('0x7d')===_0x169c07);if(_[_0xb7d5('0x1e')](_0x275ff8)&&_[_0xb7d5('0x1e')](_0x2ea0d5)){if(_0x3b73d3[_0xb7d5('0x84')](_0x169c07)){if(_0x36da12[_0xb7d5('0x81')][_0x59b88d][_0x3b73d3[_0x169c07]]){var _0x14871a=_[_0xb7d5('0x85')](_0x36da12[_0xb7d5('0x81')][_0x59b88d][_0x3b73d3[_0x169c07]][_0xb7d5('0x86')](/"/g,'\x27'));switch(_0x169c07){case _0xb7d5('0x2d'):var _0xc35acd=moment(_0x14871a,_0xb7d5('0xd'),!![]);if(_0xc35acd[_0xb7d5('0x87')]()){_0x86b023[_0xb7d5('0x18')]('\x22'+_0x14871a+'\x22');}else{_0x5c8b95[_0xb7d5('0x18')](_0xb7d5('0x88'));}break;case'priority':var _0x35083c=parseInt(_0x14871a);_0x14871a=_[_0xb7d5('0x89')](_0x35083c)||_0x35083c<0x0||_0x35083c>0x4?_0x3413d1?0x3:0x2:_0x35083c;_0x86b023[_0xb7d5('0x18')]('\x22'+_0x14871a+'\x22');break;case _0xb7d5('0x31'):var _0x26ef16=parseInt(_0x14871a);if(_[_0xb7d5('0x8a')](_0x26ef16)&&_[_0xb7d5('0x79')](_0x5d0227,_0x26ef16)){_0x86b023['push']('\x22'+_0x26ef16+'\x22');}else{_0x5c8b95[_0xb7d5('0x18')](_0xb7d5('0x8b'));}break;case'email':if(isEmail(_0x14871a)){_0x86b023['push']('\x22'+_0x14871a+'\x22');}else{_0x5c8b95[_0xb7d5('0x18')](_0xb7d5('0x8c'));}break;case _0xb7d5('0x8d'):var _0x15ac37=moment(_0x14871a,_0xb7d5('0x8e'),!![]);if(_0x15ac37[_0xb7d5('0x87')]()){_0x86b023[_0xb7d5('0x18')]('\x22'+_0x14871a+'\x22');}else{_0x5c8b95[_0xb7d5('0x18')](_0xb7d5('0x8f'));}break;case'dialTimezone':var _0x3c6eaf=shared[_0xb7d5('0x6a')];var _0x322f81=_0x3c6eaf[_0x14871a];if(!_[_0xb7d5('0x1e')](_0x322f81)){var _0xd3d352=_0x322f81[_0xb7d5('0x6c')];_0x86b023['push']('\x22'+_0x14871a+'\x22');_0x86b023[_0xb7d5('0x18')]('\x22'+_0xd3d352+'\x22');}break;default:_0x86b023['push']('\x22'+_0x14871a+'\x22');}}else{switch(_0x169c07){case _0xb7d5('0x90'):case'phone':_0x5c8b95['push'](_0x169c07+_0xb7d5('0x91'));break;default:_0x86b023[_0xb7d5('0x18')]('\x22\x22');}}}}else{var _0x53caf3='';if(!_[_0xb7d5('0x1e')](_0x275ff8)){if(!_0x3bb3f0[_0xb7d5('0x84')](_0x275ff8['id'])){if(!_[_0xb7d5('0x1e')](_0x36da12[_0xb7d5('0x81')][_0x59b88d][_0x3b73d3[_0x169c07]])){var _0x14871a=_[_0xb7d5('0x85')](_0x36da12[_0xb7d5('0x81')][_0x59b88d][_0x3b73d3[_0x169c07]]['replace'](/"/g,'\x27'));var _0x2edaea=phoneDescriptions[_0xb7d5('0x83')](_0x3eb40f=>_0x3eb40f[_0xb7d5('0x92')]===_0x275ff8['id']);if(!_['isNil'](_0x2edaea)){var _0x5ba6f9=_[_0xb7d5('0x85')](_0x36da12[_0xb7d5('0x81')][_0x59b88d][_0x3b73d3[_0x2edaea['description']]][_0xb7d5('0x86')](/"/g,'\x27'));if(!_['isNil'](_0x5ba6f9))_0x14871a=_0x14871a+'§'+_0x5ba6f9;}if(_0x53caf3=='')_0x53caf3=_0x14871a;else _0x53caf3+='|'+_0x14871a;}_0x266a5d[_0xb7d5('0x18')](_0x275ff8['id']+':'+_0x53caf3);_0x3bb3f0[_0x275ff8['id']]=0x1;}}}}if(hasAdditionalPhones){_0x86b023[_0xb7d5('0x18')]('\x22'+_0x266a5d['join'](';')+'\x22');}if(_0x5c8b95[_0xb7d5('0x1d')]){handleError(_0x36da12['data'][_0x59b88d],{'code':'SystemRow','message':_0x5c8b95['join']()});}else{fs['appendFileSync'](_0x1b75e1,_0x86b023['join']()+'\x0a');}_0x86b023=[];}if(!(stats[_0xb7d5('0x82')]%0xc8)){socket['emit'](_0xb7d5('0x93')+_0x6e6b81,stats);stats[_0xb7d5('0x5c')]=[];}}if(stopped){logger['info'](_0xb7d5('0x94'));_0x58ad30[_0xb7d5('0x95')]();}}catch(_0x238f91){handleError(_0x36da12[_0xb7d5('0x81')][_0x59b88d],{'code':_0xb7d5('0x96'),'message':_0x238f91[_0xb7d5('0x5a')]});logger[_0xb7d5('0x59')]('step',_0x238f91[_0xb7d5('0x5a')]);}},'complete':function(){try{var _0x29fd4f=[];var _0x34c4a7=[];var _0x39e13d=_0xb7d5('0x3d');if(_0x4cd172[_0xb7d5('0x97')]&&_0x4cd172[_0xb7d5('0x97')]['length']){_0x39e13d='cm_contacts_'+_0x6e6b81;_0x29fd4f[_0xb7d5('0x18')]('CREATE\x20TABLE\x20'+_0x39e13d+'\x20LIKE\x20cm_contacts;');}tmp_campaigns='campaigns_'+_0x6e6b81;tmp_voice_queues=_0xb7d5('0x98')+_0x6e6b81;_0x34c4a7['push'](_0xb7d5('0x99')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x34c4a7[_0xb7d5('0x18')]('CREATE\x20TABLE\x20'+tmp_voice_queues+_0xb7d5('0x9a'));BPromise['each'](_0x34c4a7,handleTZQuery)[_0xb7d5('0x1c')](function(_0x2d43e2){updateTzCampaigns(_0x4cd172[_0xb7d5('0x2e')])['then'](function(_0x252ac){updateTzVoiceQueues(_0x4cd172[_0xb7d5('0x2e')])[_0xb7d5('0x1c')](function(_0x12b67c){if(hasTZ)_0x2fe219=_0x2fe219[_0xb7d5('0x86')](_0xb7d5('0x6b'),_0xb7d5('0x9b'));var _0x556da5=util['format'](_0xb7d5('0x9c'),_0x1b75e1,_0x39e13d,_0x2fe219,_0x4cd172[_0xb7d5('0x2e')],_0x4cd172[_0xb7d5('0x52')]||null,NOW,NOW);if(_['isNil'](_0x3b73d3[_0xb7d5('0x2d')])){_0x556da5+=_0xb7d5('0x9d');}_0x29fd4f[_0xb7d5('0x18')](_0x556da5);if(_0x4cd172[_0xb7d5('0x97')]&&_0x4cd172['duplicates']['length']){_0x29fd4f[_0xb7d5('0x18')](insertCmContact(_0x4cd172[_0xb7d5('0x2e')],_0x39e13d,_0x4cd172[_0xb7d5('0x97')],_0x3b73d3));_0x29fd4f[_0xb7d5('0x18')](_0xb7d5('0x9e')+_0x39e13d+';');}BPromise[_0xb7d5('0x9f')](_0x29fd4f,handleQuery)[_0xb7d5('0x1c')](function(_0x372361){BPromise[_0xb7d5('0x19')]([handleAdditionalPhones()])['then'](function(){_0x29fd4f=[];for(var _0x17d889=0x0;_0x17d889\x20\x20','existsSync','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util'];(function(_0x597ad5,_0x508711){var _0x4aa714=function(_0x3f58fd){while(--_0x3f58fd){_0x597ad5['push'](_0x597ad5['shift']());}};_0x4aa714(++_0x508711);}(_0xfd58,0xb3));var _0x8fd5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd58[_0x2641f9];return _0x585741;};'use strict';var fs=require('fs');var path=require(_0x8fd5('0x0'));var _=require(_0x8fd5('0x1'));var Papa=require('papaparse');var util=require(_0x8fd5('0x2'));var BPromise=require(_0x8fd5('0x3'));var moment=require('moment');var squel=require(_0x8fd5('0x4'));var Redis=require(_0x8fd5('0x5'));var db=require(_0x8fd5('0x6'))['db'];var config=require(_0x8fd5('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0x8fd5('0x8'))(_0x8fd5('0x9'));config[_0x8fd5('0xa')]=_['defaults'](config[_0x8fd5('0xa')],{'host':_0x8fd5('0xb'),'port':0x18eb});var socket=require(_0x8fd5('0xc'))(new Redis(config[_0x8fd5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x8fd5('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x8fd5('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4db571){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))*$/[_0x8fd5('0xe')](_0x4db571);}function selectNotIn(_0x148ad1,_0x49d8c7,_0x2b8942,_0x346492,_0x5c5c21){return squel[_0x8fd5('0xf')]()[_0x8fd5('0x10')]('phone')[_0x8fd5('0x11')](_0x346492)[_0x8fd5('0x12')](_0x49d8c7,null,_0x49d8c7+_0x8fd5('0x13')+_0x346492+'.'+_0x2b8942)[_0x8fd5('0x14')](_0x346492+'.'+_0x2b8942+'\x20=\x20'+_0x148ad1+'.'+_0x2b8942)['where'](_0x49d8c7+'.dialCheckDuplicateType\x20IN\x20('+_0x5c5c21[_0x8fd5('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1c60c5,_0x3f66d8){promisesAdditionalPhones=[];return db[_0x8fd5('0x15')][_0x8fd5('0x16')]({'raw':!![],'attributes':['id',_0x8fd5('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x8fd5('0x18')](function(_0x3aa9e6){if(_0x3aa9e6!==null){var _0x2f18df=[];for(var _0x10ec68=0x0;_0x10ec68<_0x3aa9e6['length'];_0x10ec68++){var _0x418037=_0x3aa9e6[_0x10ec68];_0x2f18df[_0x8fd5('0x19')](insertAdditionalPhones(_0x418037));}}Promise[_0x8fd5('0x1a')](_0x2f18df)['then'](function(){_0x1c60c5({'val':0x1});});});});}function insertAdditionalPhones(_0x4e8e9d){return new Promise(function(_0x5daea6,_0x8509c8){var _0x220f08=_0x4e8e9d[_0x8fd5('0x17')];var _0x46b728=_0x220f08[_0x8fd5('0x1b')](';');var _0x495ef7=[];orderBy=0x0;for(var _0x52d076=0x0;_0x52d076<_0x46b728[_0x8fd5('0x1c')];_0x52d076++){_0x495ef7['push'](splitAdditionalPhone(_0x4e8e9d['id'],_0x46b728[_0x52d076]));}Promise[_0x8fd5('0x1a')](_0x495ef7)[_0x8fd5('0x18')](function(){_0x5daea6({'val':_0x46b728[_0x8fd5('0x1c')]});});});}function splitAdditionalPhone(_0xadd988,_0x4924cd){return new Promise(function(_0x507689,_0x583293){var _0x36385c=_0x4924cd['split'](':');var _0x180f8d=_0x36385c[0x0];var _0x40f729=_0x36385c[0x1];if(!_[_0x8fd5('0x1d')](_0x40f729)){var _0x6b7da9=_0x40f729['split']('|');var _0x411084=[];for(var _0x42eab8=0x0;_0x42eab8<_0x6b7da9[_0x8fd5('0x1c')];_0x42eab8++){if(_0x6b7da9[_0x42eab8]!==''){var _0x3057eb=_[_0x8fd5('0x1e')](promisesAdditionalPhones,{'contactId':_0xadd988,'phone':_0x6b7da9[_0x42eab8]});if(_0x3057eb['length']==0x0){orderBy++;promisesAdditionalPhones[_0x8fd5('0x19')]({'contactId':_0xadd988,'contactTypeId':_0x180f8d,'phone':_0x6b7da9[_0x42eab8],'orderBy':orderBy});}}}_0x507689({'ok':0x1});}else _0x507689({'res':0x0});});}function createAdditionalPhone(_0x34bf0c,_0x1f496d,_0x5b7d8c,_0x5dd206){var _0x884f79='';var _0x3a849a='';var _0x4ddd3b=_0x5b7d8c[_0x8fd5('0x1b')]('§');_0x884f79=_0x4ddd3b[0x0];if(_0x4ddd3b[_0x8fd5('0x1c')]==0x2)_0x3a849a=_0x4ddd3b[0x1];return new Promise(function(_0x1b10f3,_0x1b5509){return db['CmContactHasItem'][_0x8fd5('0x1f')]({'where':{'CmContactId':_0x34bf0c,'item':_0x884f79}})[_0x8fd5('0x18')](function(_0x4906f1){if(_0x4906f1){return db[_0x8fd5('0x20')][_0x8fd5('0x21')]({'ItemTypeId':_0x1f496d,'description':_0x3a849a,'OrderBy':_0x5dd206},{'where':{'CmContactId':_0x34bf0c,'item':_0x884f79}})[_0x8fd5('0x18')](function(_0x40c3be){_0x1b10f3({'res':_0x8fd5('0x22')});});}else{return db[_0x8fd5('0x20')]['create']({'CmContactId':_0x34bf0c,'item':_0x884f79,'description':_0x3a849a,'ItemTypeId':_0x1f496d,'OrderBy':_0x5dd206,'ItemClass':_0x8fd5('0x23')})[_0x8fd5('0x18')](function(_0x1c1565){_0x1b10f3({'res':'inserted'});});}});});}function insertCmHopper(_0xffa204,_0x386b5c,_0x32db0e,_0x89a42a,_0x4bedbb){var _0x5f3635=['cm_contacts.phone','cm_contacts.scheduledat',_0x8fd5('0x24'),_0x8fd5('0x25'),_0x386b5c+'.'+_0x89a42a,_0x8fd5('0x26'),_0x8fd5('0x27'),'cm_contacts.priority',_0x8fd5('0x28'),'\x22'+_0x4bedbb+'\x22'];return squel[_0x8fd5('0x29')]()[_0x8fd5('0x2a')](_0x8fd5('0x2b'))[_0x8fd5('0x2c')](['phone',_0x8fd5('0x2d'),_0x8fd5('0x2e'),_0x8fd5('0x2f'),_0x89a42a,_0x8fd5('0x30'),_0x8fd5('0x31'),_0x8fd5('0x32'),_0x8fd5('0x33'),_0x8fd5('0x34')],squel[_0x8fd5('0xf')]()[_0x8fd5('0x35')](_0x5f3635)['from'](_0x386b5c)[_0x8fd5('0x12')]('cm_contacts',null,_0x8fd5('0x36')+_0x386b5c+_0x8fd5('0x37'))[_0x8fd5('0x12')](_0x32db0e,null,_0x32db0e+_0x8fd5('0x13')+_0x386b5c+'.'+_0x89a42a)[_0x8fd5('0x14')](_0x386b5c+_0x8fd5('0x38'),_0xffa204)['where'](_0x8fd5('0x39'),NOW)[_0x8fd5('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x386b5c,_0x32db0e,_0x89a42a,'cm_hopper',['\x22always\x22',_0x8fd5('0x3a')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x386b5c,_0x32db0e,_0x89a42a,'cm_hopper',[_0x8fd5('0x3b')])))[_0x8fd5('0x3c')]();}function insertCmHopperBlack(_0x5259b8,_0x2d7590,_0x1218b5,_0x4109b9){var _0x579438=[_0x8fd5('0x3d'),_0x8fd5('0x24'),_0x8fd5('0x25'),_0x2d7590+'.'+_0x4109b9,_0x8fd5('0x26'),_0x8fd5('0x27')];return squel[_0x8fd5('0x29')]()[_0x8fd5('0x2a')](_0x8fd5('0x3e'))[_0x8fd5('0x2c')]([_0x8fd5('0x3f'),'ContactId',_0x8fd5('0x2f'),_0x4109b9,_0x8fd5('0x30'),_0x8fd5('0x31')],squel['select']()['fields'](_0x579438)[_0x8fd5('0x11')](_0x2d7590)[_0x8fd5('0x12')](_0x8fd5('0x40'),null,_0x8fd5('0x36')+_0x2d7590+'.CmListId')[_0x8fd5('0x12')](_0x1218b5,null,_0x1218b5+'.id\x20=\x20'+_0x2d7590+'.'+_0x4109b9)[_0x8fd5('0x14')](_0x2d7590+_0x8fd5('0x38'),_0x5259b8)['where'](_0x8fd5('0x39'),NOW)[_0x8fd5('0x14')](_0x8fd5('0x41'),squel['select']()[_0x8fd5('0x10')](_0x8fd5('0x3f'))['from'](_0x8fd5('0x3e'))[_0x8fd5('0x14')]('ListId\x20=\x20?',_0x5259b8)['where'](_0x4109b9+_0x8fd5('0x42')+_0x2d7590+'.'+_0x4109b9)))[_0x8fd5('0x3c')]();}function insertTzCmHopper(_0x1e8e98,_0x5701b9,_0x44ad4a,_0x2a372c,_0x5be08d,_0x4cc4a1){var _0x1c7d88=[_0x8fd5('0x3d'),_0x8fd5('0x43')+_0x4cc4a1+_0x8fd5('0x44'),_0x8fd5('0x24'),'cm_contacts.ListId',_0x5701b9+'.'+_0x2a372c,'cm_contacts.createdAt',_0x8fd5('0x27'),_0x8fd5('0x45'),_0x8fd5('0x28'),'\x22'+_0x5be08d+'\x22'];var _0xe3106e=squel[_0x8fd5('0x29')]()[_0x8fd5('0x2a')](_0x8fd5('0x2b'))['fromQuery']([_0x8fd5('0x3f'),_0x8fd5('0x2d'),'ContactId',_0x8fd5('0x2f'),_0x2a372c,_0x8fd5('0x30'),'updatedAt',_0x8fd5('0x32'),_0x8fd5('0x33'),_0x8fd5('0x34')],squel[_0x8fd5('0xf')]()[_0x8fd5('0x35')](_0x1c7d88)[_0x8fd5('0x11')](_0x5701b9)[_0x8fd5('0x12')]('cm_contacts',null,_0x8fd5('0x36')+_0x5701b9+'.CmListId')[_0x8fd5('0x12')](_0x44ad4a,null,_0x44ad4a+_0x8fd5('0x13')+_0x5701b9+'.'+_0x2a372c)[_0x8fd5('0x12')](_0x4cc4a1,null,_0x4cc4a1+_0x8fd5('0x13')+_0x5701b9+'.'+_0x2a372c)['where'](_0x5701b9+_0x8fd5('0x38'),_0x1e8e98)['where'](_0x8fd5('0x39'),NOW)[_0x8fd5('0x14')](_0x8fd5('0x41'),selectNotIn(_0x5701b9,_0x44ad4a,_0x2a372c,'cm_hopper',[_0x8fd5('0x3b'),_0x8fd5('0x3a')]))[_0x8fd5('0x14')](_0x8fd5('0x41'),selectNotIn(_0x5701b9,_0x44ad4a,_0x2a372c,_0x8fd5('0x2b'),[_0x8fd5('0x3b')])))[_0x8fd5('0x3c')]();return _0xe3106e;}function insertTzCmHopperBlack(_0x12a2f7,_0x2c7679,_0x5b9611,_0x229ab6){var _0x4886cf=[_0x8fd5('0x3d'),_0x8fd5('0x24'),_0x8fd5('0x25'),_0x2c7679+'.'+_0x229ab6,_0x8fd5('0x26'),_0x8fd5('0x27')];return squel['insert']()['into']('cm_hopper_black')['fromQuery'](['phone','ContactId',_0x8fd5('0x2f'),_0x229ab6,_0x8fd5('0x30'),_0x8fd5('0x31')],squel['select']()[_0x8fd5('0x35')](_0x4886cf)['from'](_0x2c7679)[_0x8fd5('0x12')](_0x8fd5('0x40'),null,_0x8fd5('0x36')+_0x2c7679+'.CmListId')[_0x8fd5('0x12')](_0x5b9611,null,_0x5b9611+_0x8fd5('0x13')+_0x2c7679+'.'+_0x229ab6)[_0x8fd5('0x14')](_0x2c7679+_0x8fd5('0x38'),_0x12a2f7)[_0x8fd5('0x14')](_0x8fd5('0x39'),NOW)[_0x8fd5('0x14')](_0x8fd5('0x41'),squel[_0x8fd5('0xf')]()[_0x8fd5('0x10')](_0x8fd5('0x3f'))[_0x8fd5('0x11')](_0x8fd5('0x3e'))[_0x8fd5('0x14')](_0x8fd5('0x46'),_0x12a2f7)['where'](_0x229ab6+_0x8fd5('0x42')+_0x2c7679+'.'+_0x229ab6)))[_0x8fd5('0x3c')]();}function insertCmHopperAdditionalPhones(_0x1e219f){var _0x5293eb=['cm_hopper.id',_0x8fd5('0x47'),_0x8fd5('0x48'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0x8fd5('0x29')]()['into']('cm_hopper_additional_phones')[_0x8fd5('0x2c')](['CmHopperId',_0x8fd5('0x3f'),'OrderBy',_0x8fd5('0x30'),_0x8fd5('0x31')],squel[_0x8fd5('0xf')]()[_0x8fd5('0x35')](_0x5293eb)[_0x8fd5('0x11')]('cm_hopper')['join']('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x8fd5('0x12')](_0x8fd5('0x49'),null,_0x8fd5('0x4a'))[_0x8fd5('0x14')](_0x8fd5('0x4b'),_0x1e219f)[_0x8fd5('0x14')](_0x8fd5('0x39'),NOW))[_0x8fd5('0x3c')]();}function insertCmContact(_0x19a797,_0x456947,_0x3a6d9a,_0xb3eea2){var _0x4c5f44=_[_0x8fd5('0x4c')](_['keys'](_0xb3eea2),[_0x8fd5('0x2f'),_0x8fd5('0x4d'),_0x8fd5('0x30'),_0x8fd5('0x31')]);return squel[_0x8fd5('0x29')]()[_0x8fd5('0x2a')]('cm_contacts')[_0x8fd5('0x2c')](_0x4c5f44,squel['select']()[_0x8fd5('0x35')](_0x4c5f44)[_0x8fd5('0x11')](_0x456947)[_0x8fd5('0x14')]('('+_0x3a6d9a[_0x8fd5('0x12')](',')+')\x20NOT\x20IN\x20?',squel[_0x8fd5('0xf')]()[_0x8fd5('0x35')](_0x3a6d9a)[_0x8fd5('0x11')](_0x8fd5('0x40'))['where'](_0x8fd5('0x46'),_0x19a797)[_0x8fd5('0x14')](_0x8fd5('0x4e')))[_0x8fd5('0x14')](_0x8fd5('0x4f'),squel[_0x8fd5('0xf')]()[_0x8fd5('0x10')]('MIN(id)',_0x8fd5('0x50'))[_0x8fd5('0x11')](_0x456947)[_0x8fd5('0x51')](_0x3a6d9a[_0x8fd5('0x12')](','))))[_0x8fd5('0x3c')]();}function handleStop(){logger[_0x8fd5('0x52')](_0x8fd5('0x53'));stopped=!![];}function handleUncaughtException(_0x3099a4){logger[_0x8fd5('0x54')](_0x3099a4['message']);process[_0x8fd5('0x55')](0x1);}function handleError(_0x52cd5a,_0x1afcde){stats[_0x8fd5('0x56')]['push']({'name':_0x1afcde[_0x8fd5('0x57')],'message':_0x1afcde[_0x8fd5('0x58')],'row':_0x52cd5a});}function handleQuery(_0x1310d5){logger[_0x8fd5('0x52')](_0x1310d5);return db[_0x8fd5('0x59')][_0x8fd5('0x5a')](_0x1310d5)[_0x8fd5('0x5b')](function(_0x41d265){results[_0x8fd5('0x19')](_0x41d265);})[_0x8fd5('0x5c')](function(_0x10b7b1){logger[_0x8fd5('0x54')](_0x10b7b1['message']);});}function updateTzCampaigns(_0x358bb8){return new Promise(function(_0x40f960,_0x1cb180){var _0x4f485f=squel[_0x8fd5('0xf')]()[_0x8fd5('0x35')]([_0x8fd5('0x5d'),_0x8fd5('0x5e')])[_0x8fd5('0x11')](_0x8fd5('0x5f'))[_0x8fd5('0x12')](_0x8fd5('0x60'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')['where'](_0x8fd5('0x61')+_0x358bb8);db[_0x8fd5('0x59')][_0x8fd5('0x5a')](_0x4f485f[_0x8fd5('0x3c')]())[_0x8fd5('0x5b')](function(_0x52145f){var _0x3cfcca=[];for(var _0x1e7761=0x0;_0x1e7761<_0x52145f[_0x8fd5('0x1c')];_0x1e7761++){_0x3cfcca[_0x8fd5('0x19')](getTimezoneData(_0x52145f[_0x1e7761],tmp_campaigns));}BPromise[_0x8fd5('0x1a')](_0x3cfcca)['then'](function(){_0x40f960({'val':0x1});});})[_0x8fd5('0x5c')](function(_0x24e115){logger[_0x8fd5('0x54')](_0x24e115[_0x8fd5('0x58')]);_0x40f960({'val':0x0});});});}function updateTzVoiceQueues(_0x128018){return new Promise(function(_0xa948e4,_0x555186){var _0x343f70=squel[_0x8fd5('0xf')]()['fields']([_0x8fd5('0x62'),_0x8fd5('0x63')])[_0x8fd5('0x11')](_0x8fd5('0x64'))[_0x8fd5('0x12')](_0x8fd5('0x65'),null,_0x8fd5('0x66'))[_0x8fd5('0x14')](_0x8fd5('0x67')+_0x128018);db[_0x8fd5('0x59')][_0x8fd5('0x5a')](_0x343f70[_0x8fd5('0x3c')]())[_0x8fd5('0x5b')](function(_0x286abb){var _0x435934=[];for(var _0x32e86a=0x0;_0x32e86a<_0x286abb[_0x8fd5('0x1c')];_0x32e86a++){_0x435934[_0x8fd5('0x19')](getTimezoneData(_0x286abb[_0x32e86a],tmp_voice_queues));}BPromise[_0x8fd5('0x1a')](_0x435934)[_0x8fd5('0x18')](function(){_0xa948e4({'val':0x1});});})[_0x8fd5('0x5c')](function(_0x5651bc){logger['error'](_0x5651bc[_0x8fd5('0x58')]);_0xa948e4({'val':0x0});});});}function getTimezoneData(_0x5d97a7,_0x56b43b){return new Promise(function(_0x22da3a,_0x38eebd){var _0x120ea5=shared[_0x8fd5('0x68')];var _0x494716=_0x120ea5[_0x5d97a7[_0x8fd5('0x69')]];if(_[_0x8fd5('0x1d')](_0x494716)){_0x22da3a({'ret':0x1});}else{var _0x154213=_0x494716[_0x8fd5('0x6a')];var _0x23df6c=squel[_0x8fd5('0x29')]()['into'](_0x56b43b)['set']('id',_0x5d97a7['id'])[_0x8fd5('0x6b')](_0x8fd5('0x6c'),_0x154213)[_0x8fd5('0x6b')](_0x8fd5('0x69'),_0x5d97a7[_0x8fd5('0x69')])[_0x8fd5('0x3c')]();return db[_0x8fd5('0x59')][_0x8fd5('0x5a')](_0x23df6c)['spread'](function(_0x5ba626){_0x22da3a({'ret':0x1});})[_0x8fd5('0x5c')](function(_0xbc3ca6){logger[_0x8fd5('0x54')](_0xbc3ca6['message']);_0x38eebd({'ret':0x1});});}});}function handleTZQuery(_0x390821){logger[_0x8fd5('0x52')](_0x390821);return db[_0x8fd5('0x59')][_0x8fd5('0x5a')](_0x390821)['spread'](function(_0x11f152){})['catch'](function(_0x26165e){logger[_0x8fd5('0x54')](_0x26165e[_0x8fd5('0x58')]);});}function main(_0x398138,_0x59ede6,_0x356926,_0x6c4f84){logger[_0x8fd5('0x52')](_0x8fd5('0x6d'),_0x398138,JSON['stringify'](_0x59ede6));process[_0x8fd5('0x6e')](_0x8fd5('0x6f'));var _0x4608b6=_0x59ede6[_0x8fd5('0x70')];var _0x174cbb=_[_0x8fd5('0x71')](_0x4608b6);var _0x2a6669=_0x59ede6[_0x8fd5('0x72')];var _0x3b91a8=path[_0x8fd5('0x12')](config[_0x8fd5('0x73')],_0x8fd5('0x74'),_0x2a6669+_0x8fd5('0x75'));hasTZ=_[_0x8fd5('0x76')](_0x4608b6)[_0x8fd5('0x77')](_0x8fd5('0x69'));var _0x1b437f=_[_0x8fd5('0x76')](_0x4608b6)[_0x8fd5('0x12')]();logger['info'](_0x8fd5('0x78'),_0x1b437f);db[_0x8fd5('0x79')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x8fd5('0x18')](function(_0x5a7cf1){for(var _0x4772df=0x0;_0x4772df<_0x5a7cf1[_0x8fd5('0x1c')];_0x4772df++){if(_0x5a7cf1[_0x4772df][_0x8fd5('0x7a')]in _0x4608b6){contactItemTypes['push'](_0x5a7cf1[_0x4772df]);delete _0x174cbb[_0x5a7cf1[_0x4772df][_0x8fd5('0x7a')]];hasAdditionalPhones=!![];}for(var _0x592e64 in _0x4608b6){if(_0x5a7cf1[_0x4772df][_0x8fd5('0x7a')]+_0x8fd5('0x7b')===_0x592e64){phoneDescriptions[_0x8fd5('0x19')]({'itemTypeId':_0x5a7cf1[_0x4772df]['id'],'description':_0x592e64});delete _0x174cbb[_0x592e64];}}}if(hasAdditionalPhones)_0x174cbb[_0x8fd5('0x17')]='';var _0x3fa3db=_[_0x8fd5('0x76')](_0x174cbb)[_0x8fd5('0x12')]();logger[_0x8fd5('0x52')](_0x8fd5('0x78'),_0x3fa3db);fs[_0x8fd5('0x7c')](_0x3b91a8,_0x3fa3db+'\x0a');Papa[_0x8fd5('0x7d')](fs['createReadStream'](_0x398138),{'header':!![],'skipEmptyLines':!![],'step':function(_0x86cc40,_0x40787b){try{for(var _0x672be6=0x0,_0x468cb0=[];_0x672be6<_0x86cc40[_0x8fd5('0x7e')][_0x8fd5('0x1c')];_0x672be6++){stats[_0x8fd5('0x7f')]+=0x1;if(_0x86cc40[_0x8fd5('0x56')][_0x672be6]){handleError(_0x86cc40['data'][_0x672be6],_0x86cc40[_0x8fd5('0x56')][_0x672be6]);}else{var _0x37e088=[];var _0x38e498=[];var _0x336111={};for(var _0x2a109e in _0x4608b6){let _0x2cf9d9=contactItemTypes[_0x8fd5('0x80')](_0x3702c3=>_0x3702c3['name']===_0x2a109e);let _0x3407ee=contactItemTypes[_0x8fd5('0x80')](_0xa039e2=>_0xa039e2[_0x8fd5('0x7a')]+_0x8fd5('0x7b')===_0x2a109e);if(_[_0x8fd5('0x1d')](_0x2cf9d9)&&_[_0x8fd5('0x1d')](_0x3407ee)){if(_0x4608b6['hasOwnProperty'](_0x2a109e)){if(_0x86cc40[_0x8fd5('0x7e')][_0x672be6][_0x4608b6[_0x2a109e]]){var _0x27c8d6=_[_0x8fd5('0x81')](_0x86cc40[_0x8fd5('0x7e')][_0x672be6][_0x4608b6[_0x2a109e]][_0x8fd5('0x82')](/"/g,'\x27'));switch(_0x2a109e){case'scheduledat':var _0x1837bb=moment(_0x27c8d6,_0x8fd5('0x83'),!![]);if(_0x1837bb[_0x8fd5('0x84')]()){_0x468cb0['push']('\x22'+_0x27c8d6+'\x22');}else{_0x37e088['push'](_0x8fd5('0x85'));}break;case _0x8fd5('0x32'):var _0x4bef34=parseInt(_0x27c8d6);_0x27c8d6=_[_0x8fd5('0x86')](_0x4bef34)||_0x4bef34<0x0||_0x4bef34>0x4?_0x6c4f84?0x3:0x2:_0x4bef34;_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x27c8d6+'\x22');break;case _0x8fd5('0x33'):var _0x39868d=parseInt(_0x27c8d6);if(_[_0x8fd5('0x87')](_0x39868d)&&_[_0x8fd5('0x77')](_0x356926,_0x39868d)){_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x39868d+'\x22');}else{_0x37e088['push'](_0x8fd5('0x88'));}break;case _0x8fd5('0x89'):if(isEmail(_0x27c8d6)){_0x468cb0['push']('\x22'+_0x27c8d6+'\x22');}else{_0x37e088[_0x8fd5('0x19')](_0x8fd5('0x8a'));}break;case _0x8fd5('0x8b'):var _0x34fd0d=moment(_0x27c8d6,'YYYY-MM-DD',!![]);if(_0x34fd0d[_0x8fd5('0x84')]()){_0x468cb0['push']('\x22'+_0x27c8d6+'\x22');}else{_0x37e088[_0x8fd5('0x19')](_0x8fd5('0x8c'));}break;case _0x8fd5('0x69'):var _0x4996bc=shared[_0x8fd5('0x68')];var _0x5e7be1=_0x4996bc[_0x27c8d6];if(!_['isNil'](_0x5e7be1)){var _0x707a3a=_0x5e7be1[_0x8fd5('0x6a')];_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x27c8d6+'\x22');_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x707a3a+'\x22');}break;default:_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x27c8d6+'\x22');}}else{switch(_0x2a109e){case _0x8fd5('0x8d'):case _0x8fd5('0x3f'):_0x37e088[_0x8fd5('0x19')](_0x2a109e+_0x8fd5('0x8e'));break;default:_0x468cb0['push']('\x22\x22');}}}}else{var _0x52ef7e='';if(!_['isNil'](_0x2cf9d9)){if(!_0x336111[_0x8fd5('0x8f')](_0x2cf9d9['id'])){if(!_[_0x8fd5('0x1d')](_0x86cc40[_0x8fd5('0x7e')][_0x672be6][_0x4608b6[_0x2a109e]])){var _0x27c8d6=_[_0x8fd5('0x81')](_0x86cc40[_0x8fd5('0x7e')][_0x672be6][_0x4608b6[_0x2a109e]][_0x8fd5('0x82')](/"/g,'\x27'));var _0x1acd2b=phoneDescriptions['find'](_0x375ea8=>_0x375ea8[_0x8fd5('0x90')]===_0x2cf9d9['id']);if(!_[_0x8fd5('0x1d')](_0x1acd2b)){var _0x49c732=_[_0x8fd5('0x81')](_0x86cc40['data'][_0x672be6][_0x4608b6[_0x1acd2b[_0x8fd5('0x91')]]]['replace'](/"/g,'\x27'));if(!_[_0x8fd5('0x1d')](_0x49c732))_0x27c8d6=_0x27c8d6+'§'+_0x49c732;}if(_0x52ef7e=='')_0x52ef7e=_0x27c8d6;else _0x52ef7e+='|'+_0x27c8d6;}_0x38e498['push'](_0x2cf9d9['id']+':'+_0x52ef7e);_0x336111[_0x2cf9d9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x468cb0[_0x8fd5('0x19')]('\x22'+_0x38e498[_0x8fd5('0x12')](';')+'\x22');}if(_0x37e088[_0x8fd5('0x1c')]){handleError(_0x86cc40[_0x8fd5('0x7e')][_0x672be6],{'code':_0x8fd5('0x92'),'message':_0x37e088[_0x8fd5('0x12')]()});}else{fs[_0x8fd5('0x93')](_0x3b91a8,_0x468cb0[_0x8fd5('0x12')]()+'\x0a');}_0x468cb0=[];}if(!(stats[_0x8fd5('0x7f')]%0xc8)){socket[_0x8fd5('0x94')]('contact:import:'+_0x2a6669,stats);stats['errors']=[];}}if(stopped){logger[_0x8fd5('0x52')](_0x8fd5('0x95'));_0x40787b[_0x8fd5('0x96')]();}}catch(_0x1687cc){handleError(_0x86cc40[_0x8fd5('0x7e')][_0x672be6],{'code':_0x8fd5('0x97'),'message':_0x1687cc[_0x8fd5('0x58')]});logger[_0x8fd5('0x54')]('step',_0x1687cc[_0x8fd5('0x58')]);}},'complete':function(){try{var _0x224487=[];var _0x237754=[];var _0x380720='cm_contacts';if(_0x59ede6[_0x8fd5('0x98')]&&_0x59ede6[_0x8fd5('0x98')]['length']){_0x380720=_0x8fd5('0x99')+_0x2a6669;_0x224487[_0x8fd5('0x19')](_0x8fd5('0x9a')+_0x380720+_0x8fd5('0x9b'));}tmp_campaigns='campaigns_'+_0x2a6669;tmp_voice_queues=_0x8fd5('0x9c')+_0x2a6669;_0x237754[_0x8fd5('0x19')](_0x8fd5('0x9a')+tmp_campaigns+_0x8fd5('0x9d'));_0x237754['push'](_0x8fd5('0x9a')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x8fd5('0x9e')](_0x237754,handleTZQuery)[_0x8fd5('0x18')](function(_0x1b1ef4){updateTzCampaigns(_0x59ede6['ListId'])[_0x8fd5('0x18')](function(_0xb94220){updateTzVoiceQueues(_0x59ede6[_0x8fd5('0x2f')])[_0x8fd5('0x18')](function(_0x4eed41){if(hasTZ)_0x3fa3db=_0x3fa3db[_0x8fd5('0x82')](_0x8fd5('0x69'),_0x8fd5('0x9f'));var _0x17e55e=util['format'](_0x8fd5('0xa0'),_0x3b91a8,_0x380720,_0x3fa3db,_0x59ede6['ListId'],_0x59ede6[_0x8fd5('0x4d')]||null,NOW,NOW);if(_['isNil'](_0x4608b6[_0x8fd5('0x2d')])){_0x17e55e+=',\x20scheduledAt\x20=\x20NOW()';}_0x224487[_0x8fd5('0x19')](_0x17e55e);if(_0x59ede6[_0x8fd5('0x98')]&&_0x59ede6['duplicates'][_0x8fd5('0x1c')]){_0x224487[_0x8fd5('0x19')](insertCmContact(_0x59ede6['ListId'],_0x380720,_0x59ede6['duplicates'],_0x4608b6));_0x224487[_0x8fd5('0x19')](_0x8fd5('0xa1')+_0x380720+';');}BPromise[_0x8fd5('0x9e')](_0x224487,handleQuery)[_0x8fd5('0x18')](function(_0xd9654b){BPromise[_0x8fd5('0x1a')]([handleAdditionalPhones()])[_0x8fd5('0x18')](function(){_0x224487=[];for(var _0x50d3c1=0x0;_0x50d3c1\x20\x20','server/files/tmp','existsSync','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','phone','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','query','select\x20*\x20from\x20','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','CmContactHasItem','findOne','update','inserted','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','cm_hopper','fromQuery','ListId','createdAt','updatedAt','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','into','cm_hopper_black','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','\x20=\x20?','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x7e27,0xdd));var _0x77e2=function(_0x5db0c0,_0x500a89){_0x5db0c0=_0x5db0c0-0x0;var _0x435be1=_0x7e27[_0x5db0c0];return _0x435be1;};'use strict';var fs=require('fs');var path=require(_0x77e2('0x0'));var _=require(_0x77e2('0x1'));var Papa=require('papaparse');var util=require(_0x77e2('0x2'));var BPromise=require(_0x77e2('0x3'));var moment=require(_0x77e2('0x4'));var squel=require(_0x77e2('0x5'));var Redis=require('ioredis');var db=require(_0x77e2('0x6'))['db'];var config=require(_0x77e2('0x7'));var logger=require(_0x77e2('0x8'))('import');config[_0x77e2('0x9')]=_['defaults'](config[_0x77e2('0x9')],{'host':_0x77e2('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77e2('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()[_0x77e2('0xb')](_0x77e2('0xc'));var tempTableName=_0x77e2('0xd')+moment()[_0x77e2('0xb')](_0x77e2('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x23583e){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'](_0x23583e);}function selectNotIn(_0x5022db,_0x1b4740,_0x533557,_0x1f0cba,_0xf8293f){return squel['select']()['field'](_0x77e2('0xf'))[_0x77e2('0x10')](_0x1f0cba)['join'](_0x1b4740,null,_0x1b4740+_0x77e2('0x11')+_0x1f0cba+'.'+_0x533557)['where'](_0x1f0cba+'.'+_0x533557+'\x20=\x20'+_0x5022db+'.'+_0x533557)[_0x77e2('0x12')](_0x1b4740+_0x77e2('0x13')+_0xf8293f[_0x77e2('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x33e820,_0x20276){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x77e2('0x15')](_0x77e2('0x16')+tempTableName)['spread'](function(_0x46fb81){if(_0x46fb81!==null){var _0x134fee=[];for(var _0x349627=0x0;_0x349627<_0x46fb81[_0x77e2('0x17')];_0x349627++){var _0x266710=_0x46fb81[_0x349627];if(!_[_0x77e2('0x18')](_0x266710[_0x77e2('0xf')])){if(!_[_0x77e2('0x18')](_0x266710[_0x77e2('0x19')]))_0x134fee[_0x77e2('0x1a')](insertAdditionalPhones(_0x266710));promisesContact['push']({'contact':_0x266710});}}}Promise[_0x77e2('0x1b')](_0x134fee)[_0x77e2('0x1c')](function(){_0x33e820({'val':0x1});});})[_0x77e2('0x1d')](function(_0x15d65e){logger[_0x77e2('0x1e')](_0x15d65e[_0x77e2('0x1f')]);});});}function insertAdditionalPhones(_0x1a5415){return new Promise(function(_0x1e5273,_0x298ab0){var _0x3c9dd8=_0x1a5415[_0x77e2('0x19')];if(_['isNil'](_0x3c9dd8))_0x298ab0({'val':0x0});else{var _0x158547=_0x3c9dd8[_0x77e2('0x20')](';');var _0x4c0d0a=[];orderBy=0x0;for(var _0x2d30d3=0x0;_0x2d30d3<_0x158547['length'];_0x2d30d3++){_0x4c0d0a['push'](splitAdditionalPhone(_0x1a5415['id'],_0x158547[_0x2d30d3]));}Promise[_0x77e2('0x1b')](_0x4c0d0a)['then'](function(){_0x1e5273({'val':_0x158547[_0x77e2('0x17')]});});}});}function splitAdditionalPhone(_0x1c8f39,_0x20eda4){return new Promise(function(_0x5b5844,_0x529a43){var _0x119fb1=_0x20eda4['split'](':');var _0x104860=_0x119fb1[0x0];var _0x370dca=_0x119fb1[0x1];if(_0x370dca!==''){var _0x44ba24=_0x370dca['split']('|');var _0x28765e=[];for(var _0x3413aa=0x0;_0x3413aa<_0x44ba24[_0x77e2('0x17')];_0x3413aa++){if(_0x44ba24[_0x3413aa]!==''){var _0xa2a50f=_[_0x77e2('0x21')](promisesAdditionalPhones,{'contactId':_0x1c8f39,'phone':_0x44ba24[_0x3413aa]});if(_0xa2a50f['length']==0x0){orderBy++;promisesAdditionalPhones[_0x77e2('0x1a')]({'contactId':_0x1c8f39,'contactTypeId':_0x104860,'phone':_0x44ba24[_0x3413aa],'orderBy':orderBy});}}}_0x5b5844({'ok':0x1});}else _0x5b5844({'res':0x0});});}function createAdditionalPhone(_0x52ca41,_0x5013e7,_0x362730,_0x4e7c32){var _0x2acae2='';var _0x11c9f7='';var _0x586919=_0x362730['split']('§');_0x2acae2=_0x586919[0x0];if(_0x586919[_0x77e2('0x17')]==0x2)_0x11c9f7=_0x586919[0x1];return new Promise(function(_0x5002b3,_0x4e5996){return db[_0x77e2('0x22')][_0x77e2('0x23')]({'where':{'CmContactId':_0x52ca41,'item':_0x2acae2}})[_0x77e2('0x1c')](function(_0x97af4b){if(_0x97af4b){return db['CmContactHasItem'][_0x77e2('0x24')]({'ItemTypeId':_0x5013e7,'description':_0x11c9f7,'OrderBy':_0x4e7c32},{'where':{'CmContactId':_0x52ca41,'item':_0x2acae2}})['then'](function(_0x598a4e){_0x5002b3({'res':'updated'});});}else{return db[_0x77e2('0x22')]['create']({'CmContactId':_0x52ca41,'item':_0x2acae2,'ItemTypeId':_0x5013e7,'description':_0x11c9f7,'OrderBy':_0x4e7c32,'ItemClass':'PHONE'})['then'](function(_0x955c4f){_0x5002b3({'res':_0x77e2('0x25')});});}});});}function updateContact(_0xd12c66){return new Promise(function(_0xc4044b,_0x4e4af5){var _0x42764c=_0xd12c66['id'];delete _0xd12c66['id'];return db['CmContact'][_0x77e2('0x24')](_0xd12c66,{'where':{'id':_0x42764c}})['then'](function(_0x24af97){updatedRows+=0x1;return db[_0x77e2('0x26')][_0x77e2('0x24')]({'phone':_0xd12c66[_0x77e2('0xf')]},{'where':{'ContactId':_0x42764c}})[_0x77e2('0x1c')](function(_0x12cca4){_0xc4044b({'ret':'OK'});});});});}function insertCmHopper(_0x380966,_0x54294b,_0x239568,_0x25178b,_0xbc5f8b){var _0x19994e=[_0x77e2('0x27'),_0x77e2('0x28'),_0x77e2('0x29'),_0x77e2('0x2a'),_0x54294b+'.'+_0x25178b,_0x77e2('0x2b'),_0x77e2('0x2c'),_0x77e2('0x2d'),_0x77e2('0x2e'),'\x22'+_0xbc5f8b+'\x22'];return squel[_0x77e2('0x2f')]()['into'](_0x77e2('0x30'))[_0x77e2('0x31')]([_0x77e2('0xf'),'scheduledat','ContactId',_0x77e2('0x32'),_0x25178b,_0x77e2('0x33'),_0x77e2('0x34'),'priority','UserId',_0x77e2('0x35')],squel[_0x77e2('0x36')]()[_0x77e2('0x37')](_0x19994e)[_0x77e2('0x10')](_0x54294b)[_0x77e2('0x14')](_0x77e2('0x38'),null,_0x77e2('0x39')+_0x54294b+_0x77e2('0x3a'))[_0x77e2('0x14')](_0x239568,null,_0x239568+'.id\x20=\x20'+_0x54294b+'.'+_0x25178b)[_0x77e2('0x12')](_0x54294b+_0x77e2('0x3b'),_0x380966)[_0x77e2('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x77e2('0x12')](_0x77e2('0x3c'),selectNotIn(_0x54294b,_0x239568,_0x25178b,_0x77e2('0x30'),[_0x77e2('0x3d'),_0x77e2('0x3e')]))[_0x77e2('0x12')](_0x77e2('0x3c'),selectNotIn(_0x54294b,_0x239568,_0x25178b,_0x77e2('0x30'),['\x22always\x22'])))[_0x77e2('0x3f')]();}function insertCmHopperBlack(_0x45e1d1,_0x4b2d7c,_0x1dea57,_0x37d61e){var _0x8d875f=[_0x77e2('0x27'),_0x77e2('0x29'),_0x77e2('0x2a'),_0x4b2d7c+'.'+_0x37d61e,'cm_contacts.createdAt',_0x77e2('0x2c')];return squel[_0x77e2('0x2f')]()[_0x77e2('0x40')](_0x77e2('0x41'))[_0x77e2('0x31')]([_0x77e2('0xf'),'ContactId',_0x77e2('0x32'),_0x37d61e,_0x77e2('0x33'),_0x77e2('0x34')],squel[_0x77e2('0x36')]()[_0x77e2('0x37')](_0x8d875f)[_0x77e2('0x10')](_0x4b2d7c)['join'](_0x77e2('0x38'),null,_0x77e2('0x39')+_0x4b2d7c+_0x77e2('0x3a'))[_0x77e2('0x14')](_0x1dea57,null,_0x1dea57+'.id\x20=\x20'+_0x4b2d7c+'.'+_0x37d61e)[_0x77e2('0x12')](_0x4b2d7c+_0x77e2('0x3b'),_0x45e1d1)[_0x77e2('0x12')](_0x77e2('0x42'),NOW)[_0x77e2('0x12')](_0x77e2('0x3c'),squel[_0x77e2('0x36')]()[_0x77e2('0x43')]('phone')[_0x77e2('0x10')](_0x77e2('0x41'))[_0x77e2('0x12')](_0x77e2('0x44'),_0x45e1d1)['where'](_0x37d61e+_0x77e2('0x45'),_0x4b2d7c+'.'+_0x37d61e)))['toString']();}function insertCmHopperAdditionalPhones(_0xc792bf){var _0x22b649=['cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy',_0x77e2('0x46'),_0x77e2('0x47')];return squel[_0x77e2('0x2f')]()[_0x77e2('0x40')](_0x77e2('0x48'))['fromQuery'](['CmHopperId',_0x77e2('0xf'),_0x77e2('0x49'),_0x77e2('0x33'),_0x77e2('0x34')],squel[_0x77e2('0x36')]()[_0x77e2('0x37')](_0x22b649)[_0x77e2('0x10')](_0x77e2('0x30'))[_0x77e2('0x14')](_0x77e2('0x38'),null,_0x77e2('0x4a'))['join']('cm_contact_has_items',null,_0x77e2('0x4b'))[_0x77e2('0x12')](_0x77e2('0x4c'),_0xc792bf)[_0x77e2('0x12')](_0x77e2('0x42'),NOW))[_0x77e2('0x3f')]();}function insertCmContact(_0x3cef16,_0x3ec0f6,_0x1c4b7c,_0x29ac31){var _0x2d03d1=_[_0x77e2('0x4d')](_[_0x77e2('0x4e')](_0x29ac31),[_0x77e2('0x32'),_0x77e2('0x4f'),_0x77e2('0x33'),_0x77e2('0x34')]);return squel[_0x77e2('0x2f')]()[_0x77e2('0x40')](_0x77e2('0x38'))[_0x77e2('0x31')](_0x2d03d1,squel[_0x77e2('0x36')]()[_0x77e2('0x37')](_0x2d03d1)[_0x77e2('0x10')](_0x3ec0f6)[_0x77e2('0x12')]('('+_0x1c4b7c['join'](',')+_0x77e2('0x50'),squel[_0x77e2('0x36')]()[_0x77e2('0x37')](_0x1c4b7c)[_0x77e2('0x10')](_0x77e2('0x38'))[_0x77e2('0x12')]('ListId\x20=\x20?',_0x3cef16))[_0x77e2('0x12')](_0x77e2('0x51'),squel[_0x77e2('0x36')]()[_0x77e2('0x43')]('MIN(id)','min_id')[_0x77e2('0x10')](_0x3ec0f6)[_0x77e2('0x52')](_0x1c4b7c[_0x77e2('0x14')](','))))[_0x77e2('0x3f')]();}function handleStop(){logger[_0x77e2('0x53')](_0x77e2('0x54'));stopped=!![];}function handleUncaughtException(_0x263b2d){logger['error'](_0x263b2d[_0x77e2('0x1f')]);process['exit'](0x1);}function handleError(_0x5e884b,_0xd50b68){stats[_0x77e2('0x55')][_0x77e2('0x1a')]({'name':_0xd50b68[_0x77e2('0x56')],'message':_0xd50b68['message'],'row':_0x5e884b});}function handleQuery(_0x25e78d){logger[_0x77e2('0x53')](_0x25e78d);return db['sequelize']['query'](_0x25e78d)[_0x77e2('0x57')](function(_0x2f465d){results[_0x77e2('0x1a')](_0x2f465d);})[_0x77e2('0x1d')](function(_0x350d8a){logger[_0x77e2('0x1e')](_0x350d8a[_0x77e2('0x1f')]);});}function main(_0x2e4938,_0x3487a2,_0x141c95,_0x548bda){logger[_0x77e2('0x53')](_0x77e2('0x58'),_0x2e4938,JSON['stringify'](_0x3487a2));process[_0x77e2('0x59')]('start');var _0x3a2a3d=_0x3487a2[_0x77e2('0x5a')];var _0x794550=_[_0x77e2('0x5b')](_0x3a2a3d);var _0x4fb979=_0x3487a2['socket_timestamp'];var _0x505b5f=path[_0x77e2('0x14')](config[_0x77e2('0x5c')],'server/files/tmp',_0x4fb979+_0x77e2('0x5d'));logger[_0x77e2('0x53')](_0x77e2('0x5e'),_0x3487a2);db[_0x77e2('0x5f')][_0x77e2('0x60')]({'raw':!![],'attributes':['id',_0x77e2('0x61')]})[_0x77e2('0x1c')](function(_0x487964){for(var _0x22b22f=0x0;_0x22b22f<_0x487964[_0x77e2('0x17')];_0x22b22f++){if(_0x487964[_0x22b22f][_0x77e2('0x61')]in _0x3a2a3d){contactItemTypes[_0x77e2('0x1a')](_0x487964[_0x22b22f]);delete _0x794550[_0x487964[_0x22b22f]['name']];hasAdditionalPhones=!![];}for(var _0x100e1e in _0x3a2a3d){if(_0x487964[_0x22b22f][_0x77e2('0x61')]+_0x77e2('0x62')===_0x100e1e){phoneDescriptions[_0x77e2('0x1a')]({'itemTypeId':_0x487964[_0x22b22f]['id'],'description':_0x100e1e});delete _0x794550[_0x100e1e];}}}if(hasAdditionalPhones)_0x794550[_0x77e2('0x19')]='';var _0x1f6079=_[_0x77e2('0x4e')](_0x794550)[_0x77e2('0x14')]();logger[_0x77e2('0x53')](_0x77e2('0x63'),_0x1f6079);fs[_0x77e2('0x64')](_0x505b5f,_0x1f6079+'\x0a');Papa[_0x77e2('0x65')](fs[_0x77e2('0x66')](_0x2e4938),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3a87e7,_0x40c84b){try{for(var _0x5cf203=0x0,_0x4a17d4=[];_0x5cf203<_0x3a87e7[_0x77e2('0x67')][_0x77e2('0x17')];_0x5cf203++){stats['rows']+=0x1;if(_0x3a87e7[_0x77e2('0x55')][_0x5cf203]){handleError(_0x3a87e7[_0x77e2('0x67')][_0x5cf203],_0x3a87e7['errors'][_0x5cf203]);}else{var _0x103bc0=[];var _0x3150c4=[];var _0x4a833b={};for(var _0x450600 in _0x3a2a3d){let _0x2ed102=contactItemTypes[_0x77e2('0x68')](_0x1d4441=>_0x1d4441['name']===_0x450600);let _0x4c1e6b=contactItemTypes[_0x77e2('0x68')](_0x5dd34f=>_0x5dd34f[_0x77e2('0x61')]+_0x77e2('0x62')===_0x450600);if(_[_0x77e2('0x18')](_0x2ed102)&&_[_0x77e2('0x18')](_0x4c1e6b)){if(_0x3a2a3d[_0x77e2('0x69')](_0x450600)){if(_0x3a87e7[_0x77e2('0x67')][_0x5cf203][_0x3a2a3d[_0x450600]]){var _0x45f63b=_[_0x77e2('0x6a')](_0x3a87e7[_0x77e2('0x67')][_0x5cf203][_0x3a2a3d[_0x450600]][_0x77e2('0x6b')](/"/g,'\x27'));switch(_0x450600){case'scheduledat':var _0xc543e3=moment(_0x45f63b,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xc543e3[_0x77e2('0x6c')]()){_0x4a17d4[_0x77e2('0x1a')]('\x22'+_0x45f63b+'\x22');}else{_0x103bc0['push'](_0x77e2('0x6d'));}break;case'priority':var _0x516a91=parseInt(_0x45f63b);_0x45f63b=_[_0x77e2('0x6e')](_0x516a91)||_0x516a91<0x0||_0x516a91>0x4?_0x548bda?0x3:0x2:_0x516a91;_0x4a17d4['push']('\x22'+_0x45f63b+'\x22');break;case _0x77e2('0x6f'):var _0x154028=parseInt(_0x45f63b);if(_[_0x77e2('0x70')](_0x154028)&&_['includes'](_0x141c95,_0x154028)){_0x4a17d4['push']('\x22'+_0x154028+'\x22');}else{_0x103bc0[_0x77e2('0x1a')](_0x77e2('0x71'));}break;case'email':if(isEmail(_0x45f63b)){_0x4a17d4[_0x77e2('0x1a')]('\x22'+_0x45f63b+'\x22');}else{_0x103bc0[_0x77e2('0x1a')](_0x77e2('0x72'));}break;case _0x77e2('0x73'):var _0x312b13=moment(_0x45f63b,_0x77e2('0x74'),!![]);if(_0x312b13[_0x77e2('0x6c')]()){_0x4a17d4['push']('\x22'+_0x45f63b+'\x22');}else{_0x103bc0[_0x77e2('0x1a')](_0x77e2('0x75'));}break;default:_0x4a17d4[_0x77e2('0x1a')]('\x22'+_0x45f63b+'\x22');}}else{switch(_0x450600){case'firstName':case _0x77e2('0xf'):_0x103bc0[_0x77e2('0x1a')](_0x450600+'\x20not\x20specified');break;default:_0x4a17d4[_0x77e2('0x1a')]('\x22\x22');}}}}else{var _0x23b081='';if(!_[_0x77e2('0x18')](_0x2ed102)){if(!_0x4a833b[_0x77e2('0x69')](_0x2ed102['id'])){for(var _0x366bf2=0x0;_0x366bf2<_0x3a2a3d[_0x450600][_0x77e2('0x17')];_0x366bf2++){var _0x45f63b=_['trim'](_0x3a87e7[_0x77e2('0x67')][_0x5cf203][_0x3a2a3d[_0x450600][_0x366bf2]]['replace'](/"/g,'\x27'));var _0xc88965=phoneDescriptions[_0x77e2('0x68')](_0x4411fd=>_0x4411fd['itemTypeId']===_0x2ed102['id']);if(!_[_0x77e2('0x18')](_0xc88965)){var _0x2236e6=_[_0x77e2('0x6a')](_0x3a87e7['data'][_0x5cf203][_0x3a2a3d[_0xc88965[_0x77e2('0x76')]][0x0]][_0x77e2('0x6b')](/"/g,'\x27'));if(!_[_0x77e2('0x18')](_0x2236e6))_0x45f63b=_0x45f63b+'§'+_0x2236e6;}if(_0x23b081=='')_0x23b081=_0x45f63b;else _0x23b081+='|'+_0x45f63b;}_0x3150c4[_0x77e2('0x1a')](_0x2ed102['id']+':'+_0x23b081);_0x4a833b[_0x2ed102['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4a17d4[_0x77e2('0x1a')]('\x22'+_0x3150c4[_0x77e2('0x14')](';')+'\x22');}if(_0x103bc0[_0x77e2('0x17')]){handleError(_0x3a87e7[_0x77e2('0x67')][_0x5cf203],{'code':_0x77e2('0x77'),'message':_0x103bc0[_0x77e2('0x14')]()});}else{fs['appendFileSync'](_0x505b5f,_0x4a17d4[_0x77e2('0x14')]()+'\x0a');}_0x4a17d4=[];}if(!(stats[_0x77e2('0x78')]%0xc8)){socket[_0x77e2('0x79')](_0x77e2('0x7a')+_0x4fb979,stats);stats[_0x77e2('0x55')]=[];}}if(stopped){logger['info'](_0x77e2('0x7b'));_0x40c84b[_0x77e2('0x7c')]();}}catch(_0x43d665){handleError(_0x3a87e7[_0x77e2('0x67')][_0x5cf203],{'code':_0x77e2('0x7d'),'message':_0x43d665[_0x77e2('0x1f')]});logger[_0x77e2('0x1e')](_0x77e2('0x7e'),_0x43d665[_0x77e2('0x1f')]);}},'complete':function(){try{var _0x57ff38=[];var _0x1d69dd=tempTableName;_0x57ff38['push'](_0x77e2('0x7f')+_0x1d69dd+_0x77e2('0x80'));logger['info'](_0x77e2('0x81'),contactItemTypes['length']);var _0x22a38e=util[_0x77e2('0xb')]('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',_0x505b5f,_0x1d69dd,_0x1f6079,_0x3487a2[_0x77e2('0x32')],_0x3487a2[_0x77e2('0x4f')]||null,NOW,NOW);if(_[_0x77e2('0x18')](_0x3a2a3d['scheduledat'])){_0x22a38e+=_0x77e2('0x82');}_0x57ff38[_0x77e2('0x1a')](_0x22a38e);BPromise['each'](_0x57ff38,handleQuery)['then'](function(_0x4d926f){BPromise[_0x77e2('0x1b')]([handleAdditionalPhones()])['then'](function(){_0x57ff38=[];for(var _0x55a209=0x0;_0x55a209_0x233ec0[_0x5d54('0x6a')]===_0x2263da);let _0x10bb93=contactItemTypes[_0x5d54('0x71')](_0x3d1e6c=>_0x3d1e6c[_0x5d54('0x6a')]+_0x5d54('0x6b')===_0x2263da);if(_[_0x5d54('0x1a')](_0x26bcd5)&&_[_0x5d54('0x1a')](_0x10bb93)){if(_0x1619de['hasOwnProperty'](_0x2263da)){if(_0x27b4d5[_0x5d54('0x6f')][_0x1ee1cc][_0x1619de[_0x2263da]]){var _0x4a9025=_[_0x5d54('0x72')](_0x27b4d5[_0x5d54('0x6f')][_0x1ee1cc][_0x1619de[_0x2263da]][_0x5d54('0x73')](/"/g,'\x27'));switch(_0x2263da){case _0x5d54('0x74'):var _0x3b36cc=moment(_0x4a9025,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3b36cc[_0x5d54('0x75')]()){_0x381394[_0x5d54('0x1c')]('\x22'+_0x4a9025+'\x22');}else{_0x4b7f70[_0x5d54('0x1c')](_0x5d54('0x76'));}break;case _0x5d54('0x35'):var _0x5c17d4=parseInt(_0x4a9025);_0x4a9025=_[_0x5d54('0x77')](_0x5c17d4)||_0x5c17d4<0x0||_0x5c17d4>0x4?_0x197344?0x3:0x2:_0x5c17d4;_0x381394[_0x5d54('0x1c')]('\x22'+_0x4a9025+'\x22');break;case'UserId':var _0xf54a1e=parseInt(_0x4a9025);if(_[_0x5d54('0x78')](_0xf54a1e)&&_[_0x5d54('0x79')](_0x5d3ac2,_0xf54a1e)){_0x381394[_0x5d54('0x1c')]('\x22'+_0xf54a1e+'\x22');}else{_0x4b7f70['push'](_0x5d54('0x7a'));}break;case _0x5d54('0x7b'):if(isEmail(_0x4a9025)){_0x381394['push']('\x22'+_0x4a9025+'\x22');}else{_0x4b7f70[_0x5d54('0x1c')](_0x5d54('0x7c'));}break;case _0x5d54('0x7d'):var _0x45925d=moment(_0x4a9025,_0x5d54('0x7e'),!![]);if(_0x45925d[_0x5d54('0x75')]()){_0x381394['push']('\x22'+_0x4a9025+'\x22');}else{_0x4b7f70[_0x5d54('0x1c')](_0x5d54('0x7f'));}break;default:_0x381394[_0x5d54('0x1c')]('\x22'+_0x4a9025+'\x22');}}else{switch(_0x2263da){case _0x5d54('0x80'):case _0x5d54('0x10'):_0x4b7f70[_0x5d54('0x1c')](_0x2263da+_0x5d54('0x81'));break;default:_0x381394[_0x5d54('0x1c')]('\x22\x22');}}}}else{var _0x3f6d42='';if(!_[_0x5d54('0x1a')](_0x26bcd5)){if(!_0x5d95d6[_0x5d54('0x82')](_0x26bcd5['id'])){for(var _0x228b2c=0x0;_0x228b2c<_0x1619de[_0x2263da]['length'];_0x228b2c++){var _0x4a9025=_['trim'](_0x27b4d5['data'][_0x1ee1cc][_0x1619de[_0x2263da][_0x228b2c]][_0x5d54('0x73')](/"/g,'\x27'));var _0x2c221a=phoneDescriptions[_0x5d54('0x71')](_0x5cd011=>_0x5cd011[_0x5d54('0x83')]===_0x26bcd5['id']);if(!_[_0x5d54('0x1a')](_0x2c221a)){var _0x4c1e11=_['trim'](_0x27b4d5['data'][_0x1ee1cc][_0x1619de[_0x2c221a[_0x5d54('0x84')]][0x0]][_0x5d54('0x73')](/"/g,'\x27'));if(!_[_0x5d54('0x1a')](_0x4c1e11))_0x4a9025=_0x4a9025+'§'+_0x4c1e11;}if(_0x3f6d42=='')_0x3f6d42=_0x4a9025;else _0x3f6d42+='|'+_0x4a9025;}_0x56bab5[_0x5d54('0x1c')](_0x26bcd5['id']+':'+_0x3f6d42);_0x5d95d6[_0x26bcd5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x381394[_0x5d54('0x1c')]('\x22'+_0x56bab5['join'](';')+'\x22');}if(_0x4b7f70['length']){handleError(_0x27b4d5[_0x5d54('0x6f')][_0x1ee1cc],{'code':_0x5d54('0x85'),'message':_0x4b7f70[_0x5d54('0x11')]()});}else{fs[_0x5d54('0x86')](_0x34bdb9,_0x381394[_0x5d54('0x11')]()+'\x0a');}_0x381394=[];}if(!(stats['rows']%0xc8)){socket[_0x5d54('0x87')](_0x5d54('0x88')+_0x4341c6,stats);stats[_0x5d54('0x5a')]=[];}}if(stopped){logger[_0x5d54('0x5e')](_0x5d54('0x89'));_0x24ba18[_0x5d54('0x8a')]();}}catch(_0x51ed74){handleError(_0x27b4d5['data'][_0x1ee1cc],{'code':_0x5d54('0x8b'),'message':_0x51ed74[_0x5d54('0x20')]});logger[_0x5d54('0x1f')](_0x5d54('0x8c'),_0x51ed74[_0x5d54('0x20')]);}},'complete':function(){try{var _0x17c366=[];var _0x3a242c=tempTableName;_0x17c366[_0x5d54('0x1c')](_0x5d54('0x8d')+_0x3a242c+_0x5d54('0x8e'));logger[_0x5d54('0x5e')]('CIS\x20len',contactItemTypes[_0x5d54('0x19')]);var _0x4d271c=util[_0x5d54('0xb')](_0x5d54('0x8f'),_0x34bdb9,_0x3a242c,_0x1abd5c,_0x7dae7d[_0x5d54('0x32')],_0x7dae7d['CompanyId']||null,NOW,NOW);if(_[_0x5d54('0x1a')](_0x1619de[_0x5d54('0x74')])){_0x4d271c+=_0x5d54('0x90');}_0x17c366[_0x5d54('0x1c')](_0x4d271c);BPromise['each'](_0x17c366,handleQuery)['then'](function(_0x30b597){BPromise[_0x5d54('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x17c366=[];for(var _0xa30651=0x0;_0xa30651\x20\x20');}var _0x11cae0=path['join'](config['root'],_0x5d54('0x65'),process['argv'][0x2]);if(!fs['existsSync'](_0x11cae0)){throw new Error(_0x5d54('0x9a'));}var _0x318138={};try{_0x318138=JSON[_0x5d54('0x9b')](process[_0x5d54('0x99')][0x3]);if(!_0x318138[_0x5d54('0x9c')]){throw new Error(_0x5d54('0x9d'));}var _0x130011=0x0;if(_0x318138[_0x5d54('0x9c')][_0x5d54('0x36')]){_0x130011=0x1;}if(!_0x318138[_0x5d54('0x32')]){throw new Error(_0x5d54('0x9e'));}}catch(_0x3e4022){throw new Error('body\x20id\x20mandatory');}var _0x47a396=[];try{_0x47a396=_[_0x5d54('0x9f')](JSON[_0x5d54('0x9b')](process[_0x5d54('0x99')][0x4]),'id');}catch(_0x3a7325){logger[_0x5d54('0x5e')](_0x5d54('0xa0'));}main(_0x11cae0,_0x318138,_0x47a396,_0x130011);}validate();process['on'](_0x5d54('0xa1'),handleStop);process['on'](_0x5d54('0xa2'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 2a3d39f..4795953 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1694=['Agent\x20Connect','agentconnectAt','Agent\x20Complete','Talk\x20Time','talktime','Member\x20Name','membername','Date','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','getSubjects','string','toLowerCase','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring'];(function(_0x3e3527,_0x4f9564){var _0x1465cb=function(_0x16031d){while(--_0x16031d){_0x3e3527['push'](_0x3e3527['shift']());}};_0x1465cb(++_0x4f9564);}(_0x1694,0x1ee));var _0x4169=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x1694[_0x47e7cb];return _0x2a8874;};'use strict';exports[_0x4169('0x0')]=function(_0x1f2f2b,_0x3d3da9){var _0xe6a35b=[{'type':_0x4169('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x1f2f2b[_0x4169('0x2')]()){case'voice':switch(_0x3d3da9['toLowerCase']()){case'inbound':_0xe6a35b[_0x4169('0x3')]({'type':_0x4169('0x4'),'content':'','variableName':_0x4169('0x5')});_0xe6a35b[_0x4169('0x3')]({'type':_0x4169('0x4'),'content':'','variableName':_0x4169('0x6')});break;case _0x4169('0x7'):_0xe6a35b[_0x4169('0x3')]({'type':_0x4169('0x1'),'content':_0x4169('0x8'),'variableName':null});_0xe6a35b['push']({'type':_0x4169('0x4'),'content':'','variableName':_0x4169('0x9')});break;}}return _0xe6a35b;};exports[_0x4169('0xa')]=function(_0x469e23,_0x4b5688){var _0x8393dd=[];switch(_0x469e23[_0x4169('0x2')]()){case _0x4169('0xb'):switch(_0x4b5688[_0x4169('0x2')]()){case'inbound':_0x8393dd=[{'type':_0x4169('0x1'),'content':_0x4169('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0xe'),'keyType':'variable','variableName':_0x4169('0x6')},{'type':_0x4169('0xd'),'content':'','key':'Caller\x20Name','keyType':_0x4169('0x4'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x4169('0x4'),'variableName':_0x4169('0xf')},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0x10'),'keyType':_0x4169('0x4'),'variableName':_0x4169('0x5')},{'type':'keyValue','content':'','key':_0x4169('0x11'),'keyType':_0x4169('0x4'),'variableName':_0x4169('0x12')},{'type':_0x4169('0xd'),'content':'','key':'Date','keyType':'variable','variableName':_0x4169('0x13')},{'type':_0x4169('0x1'),'content':_0x4169('0x14'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x4169('0x15'),'keyType':_0x4169('0x4'),'variableName':_0x4169('0x16')},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0x17'),'keyType':_0x4169('0x4'),'variableName':_0x4169('0x9')},{'type':_0x4169('0x1'),'content':_0x4169('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0x19'),'keyType':_0x4169('0x4'),'variableName':_0x4169('0x13')},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0x1a'),'keyType':_0x4169('0x4'),'variableName':_0x4169('0x1b')},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0x1c'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x4169('0xd'),'content':'','key':'Hold\x20Time','keyType':_0x4169('0x4'),'variableName':'holdtime'},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0x1d'),'keyType':'variable','variableName':_0x4169('0x1e')}];break;case _0x4169('0x7'):_0x8393dd=[{'type':_0x4169('0x1'),'content':_0x4169('0xc'),'variableName':null},{'type':_0x4169('0xd'),'content':'','key':'Called\x20Number','keyType':_0x4169('0x4'),'keyContent':'','variableName':_0x4169('0x9')},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0x1f'),'keyType':_0x4169('0x4'),'keyContent':'','variableName':_0x4169('0x20')},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0x11'),'keyType':_0x4169('0x4'),'keyContent':'','variableName':_0x4169('0x12')},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0x21'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0x4169('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x4169('0xd'),'content':'','key':'Answer\x20Time','keyType':_0x4169('0x4'),'keyContent':'','variableName':_0x4169('0x22')},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0x23'),'keyType':_0x4169('0x4'),'keyContent':'','variableName':_0x4169('0x24')},{'type':_0x4169('0xd'),'content':'','key':_0x4169('0x25'),'keyType':'variable','keyContent':'','variableName':_0x4169('0x26')},{'type':'keyValue','content':'','key':_0x4169('0x27'),'keyType':_0x4169('0x4'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x8393dd;}; \ No newline at end of file +var _0xb6ad=['uniqueid','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','Answer\x20Time','answertime','endtime','duration','billableseconds','toLowerCase','voice','inbound','push','variable','queue','outbound','string','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','calleridnum','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xb6ad,0x65));var _0xdb6a=function(_0x10f2ad,_0x569580){_0x10f2ad=_0x10f2ad-0x0;var _0x4edcc9=_0xb6ad[_0x10f2ad];return _0x4edcc9;};'use strict';exports['getSubjects']=function(_0x34c2e5,_0x32ba8d){var _0x1769df=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x34c2e5[_0xdb6a('0x0')]()){case _0xdb6a('0x1'):switch(_0x32ba8d[_0xdb6a('0x0')]()){case _0xdb6a('0x2'):_0x1769df[_0xdb6a('0x3')]({'type':_0xdb6a('0x4'),'content':'','variableName':_0xdb6a('0x5')});_0x1769df[_0xdb6a('0x3')]({'type':_0xdb6a('0x4'),'content':'','variableName':'calleridnum'});break;case _0xdb6a('0x6'):_0x1769df[_0xdb6a('0x3')]({'type':_0xdb6a('0x7'),'content':_0xdb6a('0x8'),'variableName':null});_0x1769df['push']({'type':'variable','content':'','variableName':'destcalleridnum'});break;}}return _0x1769df;};exports[_0xdb6a('0x9')]=function(_0x806ae7,_0x11e959){var _0x5761d6=[];switch(_0x806ae7[_0xdb6a('0x0')]()){case _0xdb6a('0x1'):switch(_0x11e959['toLowerCase']()){case'inbound':_0x5761d6=[{'type':'string','content':_0xdb6a('0xa'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0xdb6a('0x4'),'variableName':_0xdb6a('0xb')},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0xd'),'keyType':_0xdb6a('0x4'),'variableName':_0xdb6a('0xe')},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0xf'),'keyType':_0xdb6a('0x4'),'variableName':_0xdb6a('0x10')},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0x11'),'keyType':'variable','variableName':_0xdb6a('0x5')},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0x12'),'keyType':_0xdb6a('0x4'),'variableName':_0xdb6a('0x13')},{'type':_0xdb6a('0xc'),'content':'','key':'Date','keyType':_0xdb6a('0x4'),'variableName':_0xdb6a('0x14')},{'type':_0xdb6a('0x7'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0x15'),'keyType':_0xdb6a('0x4'),'variableName':_0xdb6a('0x16')},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0x17'),'keyType':'variable','variableName':_0xdb6a('0x18')},{'type':_0xdb6a('0x7'),'content':_0xdb6a('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0x1a'),'keyType':'variable','variableName':_0xdb6a('0x14')},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0x1b'),'keyType':'variable','variableName':_0xdb6a('0x1c')},{'type':'keyValue','content':'','key':_0xdb6a('0x1d'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0x1e'),'keyType':_0xdb6a('0x4'),'variableName':_0xdb6a('0x1f')},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0x20'),'keyType':_0xdb6a('0x4'),'variableName':_0xdb6a('0x21')}];break;case _0xdb6a('0x6'):_0x5761d6=[{'type':'string','content':_0xdb6a('0xa'),'variableName':null},{'type':_0xdb6a('0xc'),'content':'','key':'Called\x20Number','keyType':_0xdb6a('0x4'),'keyContent':'','variableName':_0xdb6a('0x18')},{'type':'keyValue','content':'','key':_0xdb6a('0x22'),'keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0x12'),'keyType':'variable','keyContent':'','variableName':_0xdb6a('0x13')},{'type':_0xdb6a('0xc'),'content':'','key':'Date','keyType':_0xdb6a('0x4'),'keyContent':'','variableName':'starttime'},{'type':_0xdb6a('0x7'),'content':_0xdb6a('0x19')},{'type':_0xdb6a('0xc'),'content':'','key':_0xdb6a('0x23'),'keyType':'variable','keyContent':'','variableName':_0xdb6a('0x24')},{'type':_0xdb6a('0xc'),'content':'','key':'Complete\x20Time','keyType':_0xdb6a('0x4'),'keyContent':'','variableName':_0xdb6a('0x25')},{'type':'keyValue','content':'','key':'Duration','keyType':_0xdb6a('0x4'),'keyContent':'','variableName':_0xdb6a('0x26')},{'type':_0xdb6a('0xc'),'content':'','key':'Billable\x20Time','keyType':_0xdb6a('0x4'),'keyContent':'','variableName':_0xdb6a('0x27')}];break;}}return _0x5761d6;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index f310765..b3f1e1a 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x363e=['then','where','body','contact','default','filter','user','read','tags','checkAccountsRestrictions','group','ids','tag','countFilteredInteractions','length','clause','order','forEach','contactName','DESC','closed','getClosedOrderClause','rows','catch','query','clone','omit','phone','fax','updateUser','lodash','./sql-utils','./utils','findAll','resolve','getInteractionsQuery','search','parseAdvancedSearchFilter','parseQueryParameters'];(function(_0x3a19d4,_0x3f19a4){var _0x5b858b=function(_0x4ddce5){while(--_0x4ddce5){_0x3a19d4['push'](_0x3a19d4['shift']());}};_0x5b858b(++_0x3f19a4);}(_0x363e,0x93));var _0xe363=function(_0x24f703,_0x1ecf70){_0x24f703=_0x24f703-0x0;var _0x359158=_0x363e[_0x24f703];return _0x359158;};'use strict';var _=require(_0xe363('0x0'));var sqlUtils=require(_0xe363('0x1'));var utils=require(_0xe363('0x2'));exports[_0xe363('0x3')]=function(_0x9ec6bb,_0x597c96,_0x1456d4,_0x3f0dd8,_0x2ee93f){var _0xc71d4d={'count':0x0,'rows':[]};var _0x624fe7=sqlUtils['skipInteractionsQuery'](_0x9ec6bb,_0x1456d4,_0x597c96);if(_0x624fe7){return Promise[_0xe363('0x4')](_0xc71d4d);}var _0x3bafa6=sqlUtils[_0xe363('0x5')](_0x9ec6bb);var _0x2ae788={};return Promise[_0xe363('0x4')]()['then'](function(){if(_0x597c96[_0xe363('0x6')]){return sqlUtils[_0xe363('0x7')](_0x597c96[_0xe363('0x6')],_0x2ee93f);}else{return sqlUtils[_0xe363('0x8')](_0x9ec6bb,_0x597c96,_0x2ee93f);}})[_0xe363('0x9')](function(_0x32174a){_0x3bafa6[_0xe363('0xa')](_0x32174a[_0xe363('0xb')]);_0x3bafa6[_0xe363('0xa')](_0x32174a[_0xe363('0xc')]);_0x3bafa6[_0xe363('0xa')](_0x32174a[_0xe363('0xd')]);_0x3bafa6['where'](_0x32174a['fields']);_0x3bafa6[_0xe363('0xa')](_0x32174a[_0xe363('0xe')]);_0x3bafa6[_0xe363('0xa')](_0x32174a[_0xe363('0xf')]);_0x3bafa6['having'](_0x32174a[_0xe363('0x10')]);_0x2ae788=_0x32174a[_0xe363('0x11')];return sqlUtils[_0xe363('0x12')](_0x9ec6bb,_0x1456d4,_0x597c96);})[_0xe363('0x9')](function(_0x566852){_0x3bafa6[_0xe363('0xa')](_0x566852);_0x3bafa6[_0xe363('0x13')]('i.id');var _0x51d29f=_0x597c96[_0xe363('0x6')]?_0x2ae788[_0xe363('0x14')]:_0x597c96[_0xe363('0x15')];return sqlUtils[_0xe363('0x16')](_0x3bafa6,_0x51d29f);})['then'](function(_0x4a3dda){_0xc71d4d['count']=_0x4a3dda[_0xe363('0x17')];if(_0xc71d4d['count']===0x0){return[];}_0x3bafa6['having'](_0x2ae788[_0xe363('0x18')]);if(_0x3f0dd8[_0xe363('0x19')]){_0x3f0dd8[_0xe363('0x19')][_0xe363('0x1a')](function(_0x5e16eb){var _0x5118a3=_0x5e16eb[0x0]===_0xe363('0x1b')?_0x5e16eb[0x0]:'i.'+_0x5e16eb[0x0];_0x3bafa6[_0xe363('0x19')](_0x5118a3,_0x5e16eb[0x1]===_0xe363('0x1c')?![]:!![]);if(_0x5e16eb[0x0]===_0xe363('0x1d')){var _0x32cccf=sqlUtils[_0xe363('0x1e')](_0x9ec6bb,_0x597c96);_0x3bafa6[_0xe363('0x19')](_0x32cccf,_0x5e16eb[0x1]===_0xe363('0x1c')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x9ec6bb,_0x3bafa6,_0x597c96,_0x3f0dd8);})[_0xe363('0x9')](function(_0x2391ee){_0xc71d4d[_0xe363('0x1f')]=_0x2391ee;return _0xc71d4d;})[_0xe363('0x20')](function(_0x169e34){throw _0x169e34;});};exports['tracked']=function(_0x49d558,_0x4eb1db){return function(_0x1b4ee5,_0x40ce59,_0x17f451){var _0x1cdc7b=_0x1b4ee5[_0xe363('0xf')];var _0x491302={};var _0x3a2742=_0x1b4ee5[_0xe363('0x21')];if(_0x491302){_0x491302=_[_0xe363('0x22')](_0x1b4ee5[_0xe363('0xb')]);_0x491302=_[_0xe363('0x23')](_0x491302,[_0xe363('0xb'),'html',_0xe363('0x24'),_0xe363('0x25'),'mobile']);}utils[_0xe363('0x26')](_0x1cdc7b,_0x491302,_0x3a2742,_0x49d558,_0x4eb1db);_0x17f451(null);};}; \ No newline at end of file +var _0x401d=['length','count','clause','order','forEach','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions','rows','catch','query','clone','omit','html','fax','updateUser','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','where','body','default','user','having','read','checkAccountsRestrictions','group','i.id','tag','countFilteredInteractions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x401d,0xd5));var _0xd401=function(_0x36f782,_0x36ef16){_0x36f782=_0x36f782-0x0;var _0x1aadaf=_0x401d[_0x36f782];return _0x1aadaf;};'use strict';var _=require(_0xd401('0x0'));var sqlUtils=require(_0xd401('0x1'));var utils=require(_0xd401('0x2'));exports[_0xd401('0x3')]=function(_0x81fb3f,_0x337be5,_0x40d908,_0x32f091,_0x4fed6a){var _0x2328d3={'count':0x0,'rows':[]};var _0x177aca=sqlUtils[_0xd401('0x4')](_0x81fb3f,_0x40d908,_0x337be5);if(_0x177aca){return Promise[_0xd401('0x5')](_0x2328d3);}var _0x1de0aa=sqlUtils[_0xd401('0x6')](_0x81fb3f);var _0x2fa39f={};return Promise[_0xd401('0x5')]()[_0xd401('0x7')](function(){if(_0x337be5[_0xd401('0x8')]){return sqlUtils[_0xd401('0x9')](_0x337be5[_0xd401('0x8')],_0x4fed6a);}else{return sqlUtils['parseQueryParameters'](_0x81fb3f,_0x337be5,_0x4fed6a);}})[_0xd401('0x7')](function(_0x2ea440){_0x1de0aa[_0xd401('0xa')](_0x2ea440[_0xd401('0xb')]);_0x1de0aa[_0xd401('0xa')](_0x2ea440['contact']);_0x1de0aa['where'](_0x2ea440[_0xd401('0xc')]);_0x1de0aa['where'](_0x2ea440['fields']);_0x1de0aa[_0xd401('0xa')](_0x2ea440['filter']);_0x1de0aa[_0xd401('0xa')](_0x2ea440[_0xd401('0xd')]);_0x1de0aa[_0xd401('0xe')](_0x2ea440[_0xd401('0xf')]);_0x2fa39f=_0x2ea440['tags'];return sqlUtils[_0xd401('0x10')](_0x81fb3f,_0x40d908,_0x337be5);})[_0xd401('0x7')](function(_0x142016){_0x1de0aa[_0xd401('0xa')](_0x142016);_0x1de0aa[_0xd401('0x11')](_0xd401('0x12'));var _0x45d0b1=_0x337be5['search']?_0x2fa39f['ids']:_0x337be5[_0xd401('0x13')];return sqlUtils[_0xd401('0x14')](_0x1de0aa,_0x45d0b1);})[_0xd401('0x7')](function(_0x243a1b){_0x2328d3['count']=_0x243a1b[_0xd401('0x15')];if(_0x2328d3[_0xd401('0x16')]===0x0){return[];}_0x1de0aa[_0xd401('0xe')](_0x2fa39f[_0xd401('0x17')]);if(_0x32f091['order']){_0x32f091[_0xd401('0x18')][_0xd401('0x19')](function(_0xf32fd2){var _0x4fe2d2=_0xf32fd2[0x0]===_0xd401('0x1a')?_0xf32fd2[0x0]:'i.'+_0xf32fd2[0x0];_0x1de0aa[_0xd401('0x18')](_0x4fe2d2,_0xf32fd2[0x1]===_0xd401('0x1b')?![]:!![]);if(_0xf32fd2[0x0]===_0xd401('0x1c')){var _0x272a42=sqlUtils[_0xd401('0x1d')](_0x81fb3f,_0x337be5);_0x1de0aa[_0xd401('0x18')](_0x272a42,_0xf32fd2[0x1]===_0xd401('0x1b')?![]:!![]);}});}return sqlUtils[_0xd401('0x1e')](_0x81fb3f,_0x1de0aa,_0x337be5,_0x32f091);})[_0xd401('0x7')](function(_0x5275a2){_0x2328d3[_0xd401('0x1f')]=_0x5275a2;return _0x2328d3;})[_0xd401('0x20')](function(_0x8dc976){throw _0x8dc976;});};exports['tracked']=function(_0x327212,_0x55f81e){return function(_0x226167,_0x3d70ff,_0x3b5f89){var _0x35c9bf=_0x226167[_0xd401('0xd')];var _0x5d1cea={};var _0x503fb8=_0x226167[_0xd401('0x21')];if(_0x5d1cea){_0x5d1cea=_[_0xd401('0x22')](_0x226167[_0xd401('0xb')]);_0x5d1cea=_[_0xd401('0x23')](_0x5d1cea,['body',_0xd401('0x24'),'phone',_0xd401('0x25'),'mobile']);}utils[_0xd401('0x26')](_0x35c9bf,_0x5d1cea,_0x503fb8,_0x327212,_0x55f81e);_0x3b5f89(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 2c52678..fc0e0b5 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a12=['o.fullname','Owner.fullname','o.internal','TagIds','limit','offset','toString','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','../parsers/advancedSearch','./update-interaction','updateInteraction','./utils','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','user_has_','_interactions','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','length','ui.','map','getInteractionsTables','getInteractionFK','cm_contacts','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','interactionsTags','it.','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','whatsapp','includes','fax','i.fax\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','openchannel','i.from\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','buildExpression','type','value','start','end','unreadMessages','read','and','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','text','tags','clause','ids','User','user','UserId','body','plainBody','keys','some','compact','\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20=\x20?','resolve','then','fields','tag','filter','capitalize','chat','Accounts','\x20IS\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','shift','join','Interaction','QueryTypes','SELECT','sequelize','query','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','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','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x9a12,0x15e));var _0x29a1=function(_0x31de77,_0x57aaf9){_0x31de77=_0x31de77-0x0;var _0x2aa4ae=_0x9a12[_0x31de77];return _0x2aa4ae;};'use strict';var _=require(_0x29a1('0x0'));var squel=require(_0x29a1('0x1'));var as=require(_0x29a1('0x2'));var qs=require('../parsers/qs');var updateInteraction=require(_0x29a1('0x3'))[_0x29a1('0x4')];var utils=require(_0x29a1('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x1bc2d9,_0x335870,_0xe76c0d){var _0x5aa149=![];var _0x2f80fa=utils[_0x29a1('0x6')](_0x1bc2d9);if(_0x335870[_0x29a1('0x7')]===_0x29a1('0x8')&&!_0xe76c0d[_0x29a1('0x9')]&&!_0xe76c0d[_0x2f80fa]){_0x5aa149=!![];}return _0x5aa149;}function getTagsQuery(){return squel[_0x29a1('0xa')]()[_0x29a1('0xb')]('id')['field'](_0x29a1('0xc'))['field'](_0x29a1('0xd'))[_0x29a1('0xe')](_0x29a1('0xf'));}function getUsersQuery(_0x42ebbc,_0x1ea904){var _0x4d39c5=utils['getInteractionFK'](_0x42ebbc);var _0x2962cf=_0x29a1('0x10')+_0x42ebbc+_0x29a1('0x11');var _0x2e3bcf=squel[_0x29a1('0xa')]()['field']('u.id')[_0x29a1('0xb')](_0x29a1('0x12'))['field']('ui.'+_0x4d39c5)[_0x29a1('0xe')](_0x2962cf,'ui')[_0x29a1('0x13')](_0x29a1('0x14'),'u',_0x29a1('0x15'));if(_0x1ea904[_0x29a1('0x16')]>0x0){_0x2e3bcf['where'](_0x29a1('0x17')+_0x4d39c5+'\x20IN\x20?',_[_0x29a1('0x18')](_0x1ea904,'id'));}return _0x2e3bcf;}function getInteractionsQuery(_0x3f73af){var _0x37e256=utils[_0x29a1('0x19')](_0x3f73af);var _0x135ad1=utils[_0x29a1('0x6')](_0x3f73af);var _0x70fdf8=utils[_0x29a1('0x1a')](_0x3f73af);return squel[_0x29a1('0xa')]()['from'](_0x37e256['interactions'],'i')[_0x29a1('0x13')](_0x29a1('0x1b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x29a1('0x13')](_0x29a1('0x14'),'o',_0x29a1('0x1c'))[_0x29a1('0x13')](_0x37e256[_0x29a1('0x1d')],'a',_0x29a1('0x1e')+_0x135ad1)[_0x29a1('0x13')](_0x37e256[_0x29a1('0x1f')],'me','me.'+_0x70fdf8+'\x20=\x20i.id')[_0x29a1('0x13')](_0x37e256[_0x29a1('0x20')],'it',_0x29a1('0x21')+_0x70fdf8+'\x20=\x20i.id')['left_join'](_0x29a1('0xf'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x511cbc={'body':squel[_0x29a1('0x22')](),'contact':squel['expr'](),'default':squel[_0x29a1('0x22')](),'fields':squel['expr'](),'filter':squel[_0x29a1('0x22')](),'read':squel[_0x29a1('0x22')](),'tags':{'clause':squel[_0x29a1('0x22')](),'ids':null},'user':squel['expr']()};return _0x511cbc;}function parseTagParameter(_0x51fb35){var _0x459be3=squel[_0x29a1('0x22')]();if(_0x51fb35){var _0x171b77=utils[_0x29a1('0x23')](_0x51fb35);_0x171b77[_0x29a1('0x24')](function(_0x262505){_0x459be3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x262505+',%');});}return _0x459be3;}function parseReadParameter(_0x4ed019){var _0x4754fc='';if(_0x4ed019){_0x4754fc=_0x29a1('0x25');if(_0x4ed019==='1'){_0x4754fc=_0x4754fc['replace'](_0x29a1('0x26'),'=');}else{_0x4754fc=_0x4754fc[_0x29a1('0x27')]('{OPERATOR}','>');}}return _0x4754fc;}function parseSearchFilter(_0x3e6163,_0x5aee99){var _0x3a047a=squel[_0x29a1('0x22')]();if(_0x5aee99){var _0x23393d=_0x5aee99['replace']('\x5c','\x5c\x5c')[_0x29a1('0x27')](/'/g,'\x27\x27');if(qs[_0x29a1('0x28')](_0x23393d)){_0x3a047a['or'](_0x29a1('0x29'),_0x23393d+'%');if(['sms',_0x29a1('0x2a')][_0x29a1('0x2b')](_0x3e6163)){_0x3a047a['or']('i.phone\x20LIKE\x20?',_0x23393d+'%');}else if(_0x3e6163===_0x29a1('0x2c')){_0x3a047a['or'](_0x29a1('0x2d'),_0x23393d+'%');}}else if(_0x3e6163===_0x29a1('0x2e')&&qs[_0x29a1('0x2f')](_0x23393d)){_0x3a047a['or'](_0x29a1('0x30'),_0x23393d+'%');}else{if(_0x3e6163===_0x29a1('0x2e')){_0x3a047a['or'](_0x29a1('0x31'),qs[_0x29a1('0x32')](_0x23393d))['or'](_0x29a1('0x33'),qs[_0x29a1('0x32')](_0x23393d));}else{if(_0x3e6163!==_0x29a1('0x2c')){_0x3a047a['or'](_0x29a1('0x34'),qs[_0x29a1('0x32')](_0x23393d));}_0x3a047a['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x23393d+'%');if(_0x3e6163===_0x29a1('0x35')){_0x3a047a['or'](_0x29a1('0x36'),_0x23393d+'%');}}}}return _0x3a047a;}function parseAdvancedSearchFilter(_0x30689d,_0x48e86a){var _0x4ba27d=getSqlClauses();var _0x1e9a71=as[_0x29a1('0x37')](_0x30689d);var _0x24e738=_0x1e9a71[_0x29a1('0x38')];for(var _0x5e1402=0x0;_0x5e1402<_0x1e9a71[_0x29a1('0x39')]['length'];_0x5e1402++){var _0x2823fb=_0x1e9a71['conditions'][_0x5e1402];var _0x2dd966='i';var _0x275136=_[_0x29a1('0x3a')](_0x48e86a,['name',_0x2823fb[_0x29a1('0xb')]]);if(_0x275136){var _0x58d192=as[_0x29a1('0x3b')](_0x2dd966,_0x275136[_0x29a1('0x3c')],_0x2823fb);_0x4ba27d['default'][_0x24e738](_0x58d192['text'],_0x58d192[_0x29a1('0x3d')][_0x29a1('0x3e')],_0x58d192['value'][_0x29a1('0x3f')]);}else{switch(_0x2823fb[_0x29a1('0xb')]){case _0x29a1('0x40'):var _0x257139=parseReadParameter(_0x2823fb[_0x29a1('0x3d')]);_0x4ba27d[_0x29a1('0x41')][_0x29a1('0x42')](_0x257139);break;case _0x29a1('0x43'):if(_0x2823fb[_0x29a1('0x44')]===_0x29a1('0x45')){if(_0x2823fb[_0x29a1('0x3d')][_0x29a1('0x46')]('\x20')[_0x29a1('0x16')]>0x1){_0x4ba27d['contact'][_0x24e738](_0x29a1('0x47'),qs[_0x29a1('0x32')](_0x2823fb['value']),null);}else{var _0x53f8ce='%'+_0x2823fb[_0x29a1('0x3d')]+'%';_0x4ba27d[_0x29a1('0x48')][_0x24e738](_0x29a1('0x49'),_0x53f8ce,_0x53f8ce,_0x53f8ce);}}else{_0x275136=_[_0x29a1('0x3a')](_0x48e86a,['name',_0x29a1('0x4a')]);_0x2823fb['field']=_0x29a1('0x4a');_0x58d192=as['buildExpression'](_0x2dd966,_0x275136['type'],_0x2823fb);_0x4ba27d[_0x29a1('0x48')][_0x24e738](_0x58d192[_0x29a1('0x4b')],_0x58d192[_0x29a1('0x3d')][_0x29a1('0x3e')],_0x58d192[_0x29a1('0x3d')]['end']);}break;case'Tag':var _0x1a0f74=_0x2823fb['value'][_0x29a1('0x46')](',')[_0x29a1('0x18')](function(_0x5d4798){return Number(_0x5d4798);});var _0x1646e1=parseTagParameter(_0x1a0f74);_0x4ba27d[_0x29a1('0x4c')][_0x29a1('0x4d')][_0x29a1('0x42')](_0x1646e1);_0x4ba27d[_0x29a1('0x4c')][_0x29a1('0x4e')]=_0x1a0f74;break;case _0x29a1('0x4f'):if(_0x2823fb[_0x29a1('0x44')]==='$substring'){_0x4ba27d[_0x29a1('0x50')][_0x24e738]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2823fb['value']+'%',null);}else{_0x275136=_[_0x29a1('0x3a')](_0x48e86a,[_0x29a1('0xc'),_0x29a1('0x51')]);_0x2823fb['field']=_0x29a1('0x51');_0x58d192=as[_0x29a1('0x3b')](_0x2dd966,_0x275136['type'],_0x2823fb);_0x4ba27d[_0x29a1('0x50')][_0x24e738](_0x58d192[_0x29a1('0x4b')],_0x58d192[_0x29a1('0x3d')][_0x29a1('0x3e')],_0x58d192[_0x29a1('0x3d')][_0x29a1('0x3f')]);}break;case _0x29a1('0x52'):case _0x29a1('0x53'):_0x58d192=as[_0x29a1('0x3b')]('me',null,_0x2823fb);_0x4ba27d[_0x29a1('0x52')][_0x24e738](_0x58d192[_0x29a1('0x4b')],_0x58d192[_0x29a1('0x3d')][_0x29a1('0x3e')],_0x58d192[_0x29a1('0x3d')]['end']);break;}}}return _0x4ba27d;}function parseModelFields(_0x47d232,_0x140c38,_0x27a49d){var _0x46e509=utils[_0x29a1('0x6')](_0x47d232);var _0x5bba7f=squel[_0x29a1('0x22')]();var _0x104ffe=_(_0x140c38)[_0x29a1('0x54')]()[_0x29a1('0x18')](function(_0x2d7d57){return _[_0x29a1('0x55')](_0x27a49d,[_0x29a1('0xc'),_0x2d7d57])?_0x2d7d57:undefined;})[_0x29a1('0x56')]()[_0x29a1('0x3d')]();if(_0x104ffe['length']>0x0){_0x104ffe[_0x29a1('0x24')](function(_0xd6cda){if(_0xd6cda===_0x46e509){_0x5bba7f['and']('i.'+_0x46e509+_0x29a1('0x57'),[][_0x29a1('0x58')](_0x140c38[_0xd6cda]));}else if(_0xd6cda===_0x29a1('0x59')){var _0x7ed8cd=JSON[_0x29a1('0x5a')](_0x140c38[_0xd6cda])[_0x29a1('0x5b')];var _0xa6e102=JSON[_0x29a1('0x5a')](_0x140c38[_0xd6cda])[_0x29a1('0x5c')];_0x5bba7f[_0x29a1('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x7ed8cd,_0xa6e102);}else{if(_0x140c38[_0xd6cda]===_0x29a1('0x5d')){_0x5bba7f[_0x29a1('0x42')]('i.'+_0xd6cda+'\x20IS\x20NULL');}else{_0x5bba7f[_0x29a1('0x42')]('i.'+_0xd6cda+_0x29a1('0x5e'),_0x140c38[_0xd6cda]);}}});}return _0x5bba7f;}function parseQueryParameters(_0x1737bc,_0x517134,_0x19fc67){var _0x109782=getSqlClauses();return Promise[_0x29a1('0x5f')]()['then'](function(){return parseModelFields(_0x1737bc,_0x517134,_0x19fc67);})[_0x29a1('0x60')](function(_0x185eb7){_0x109782[_0x29a1('0x61')]['and'](_0x185eb7);return parseReadParameter(_0x517134[_0x29a1('0x41')]);})[_0x29a1('0x60')](function(_0x596c6f){_0x109782[_0x29a1('0x41')][_0x29a1('0x42')](_0x596c6f);return parseTagParameter(_0x517134[_0x29a1('0x62')]);})[_0x29a1('0x60')](function(_0x2aa556){_0x109782[_0x29a1('0x4c')]['clause'][_0x29a1('0x42')](_0x2aa556);return parseSearchFilter(_0x1737bc,_0x517134[_0x29a1('0x63')]);})['then'](function(_0x4b1864){_0x109782[_0x29a1('0x63')]=_0x4b1864;return _0x109782;});}function checkAccountsRestrictions(_0x2d352d,_0x1279db,_0x52ddc6){var _0x318a7c=utils[_0x29a1('0x6')](_0x2d352d);var _0x5a4aea='get'+_[_0x29a1('0x64')](_0x2d352d)+(_0x2d352d===_0x29a1('0x65')?'Websites':_0x29a1('0x66'));var _0x92a4d4=squel['expr']();return Promise[_0x29a1('0x5f')]()['then'](function(){if(_0x52ddc6[_0x29a1('0x9')]&&_0x1279db[_0x29a1('0x7')]===_0x29a1('0x8')){return _0x1279db[_0x5a4aea]({'attributes':['id'],'raw':!![]});}})[_0x29a1('0x60')](function(_0x2ca126){if(_0x2ca126){if(_0x2ca126[_0x29a1('0x16')]===0x0){_0x92a4d4[_0x29a1('0x42')]('i.'+_0x318a7c+_0x29a1('0x67'));}else{_0x92a4d4[_0x29a1('0x42')]('i.'+_0x318a7c+_0x29a1('0x57'),_[_0x29a1('0x18')](_0x2ca126,'id'));}}else if(!_0x52ddc6[_0x318a7c]){_0x92a4d4['and']('i.'+_0x318a7c+'\x20IS\x20NOT\x20NULL');}})[_0x29a1('0x60')](function(){return _0x92a4d4;});}function getClosedOrderClause(_0x3a5d7f,_0x58829c){var _0x586491='';var _0x6c016d=[_0x29a1('0x68'),'i.secondDisposition',_0x29a1('0x69')];if(_0x3a5d7f==='mail'){_0x6c016d[_0x29a1('0x6a')](_0x29a1('0x6b'));}if(_0x58829c[_0x29a1('0x6c')]==='0'&&_0x3a5d7f===_0x29a1('0x2e')){_0x586491=_0x29a1('0x6b');}else{if(_0x58829c[_0x29a1('0x6c')]==='1'){_0x6c016d[_0x29a1('0x6d')]();}_0x586491='CONCAT_WS(\x27\x27,\x20'+_0x6c016d[_0x29a1('0x6e')](',\x20')+')';}return _0x586491;}function getFilteredInteractions(_0x1701d6,_0x1535f9,_0x248b4c,_0x49843c){var _0x3b2499=utils[_0x29a1('0x1a')](_0x1701d6);var _0x5e8680=_['capitalize'](_0x1701d6)+_0x29a1('0x6f');var _0x27e97e=[];var _0x16265e=getTagsQuery();var _0x4b70a8={'type':db['Sequelize'][_0x29a1('0x70')][_0x29a1('0x71')],'raw':!![]};var _0x1d4e91=[];var _0x1aca54=[];return db[_0x29a1('0x72')][_0x29a1('0x73')](_0x16265e['toString'](),_0x4b70a8)[_0x29a1('0x60')](function(_0x4fcaf2){_0x27e97e=_['keyBy'](_0x4fcaf2,'id');_0x4b70a8=_[_0x29a1('0x74')](_0x4b70a8,{'model':db[_0x5e8680],'mapToModel':!![],'nest':!![]});if(_0x248b4c[_0x29a1('0x61')]){_0x49843c[_0x29a1('0x75')][_0x29a1('0x24')](function(_0x2b6986){_0x1535f9[_0x29a1('0xb')]('i.'+_0x2b6986);});}else{_0x1535f9[_0x29a1('0xb')](_0x29a1('0x76'),_0x29a1('0x40'));_0x1535f9[_0x29a1('0xb')]('a.key',_0x29a1('0x77'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x78'),_0x29a1('0x79'));if(_0x1701d6==='mail'){_0x1535f9[_0x29a1('0xb')](_0x29a1('0x7a'),_0x29a1('0x7b'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x7c'),'contactName');_0x1535f9['field']('i.id');_0x1535f9[_0x29a1('0xb')]('i.createdAt');_0x1535f9[_0x29a1('0xb')]('i.updatedAt');_0x1535f9[_0x29a1('0xb')](_0x29a1('0x7d'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x7e'));_0x1535f9['field'](_0x29a1('0x7f'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x80'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x81'));_0x1535f9['field'](_0x29a1('0x82'));_0x1535f9['field'](_0x29a1('0x69'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x83'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x68'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x6b'));_0x1535f9[_0x29a1('0xb')]('i.to');_0x1535f9['field'](_0x29a1('0x84'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x85'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x86'));}else if(_0x1701d6===_0x29a1('0x35')){_0x1535f9[_0x29a1('0xb')](_0x29a1('0x87'),_0x29a1('0x88'));}else{_0x1535f9[_0x29a1('0xb')]('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(_0x1701d6!==_0x29a1('0x2e')){_0x1535f9[_0x29a1('0xb')](_0x29a1('0x89'));}_0x1535f9[_0x29a1('0xb')](_0x29a1('0x8a'),_0x29a1('0x8b'));_0x1535f9['field'](_0x29a1('0x8c'),_0x29a1('0x8d'));_0x1535f9['field'](_0x29a1('0x8e'),_0x29a1('0x8f'));_0x1535f9['field']('c.phone',_0x29a1('0x90'));_0x1535f9[_0x29a1('0xb')]('c.mobile',_0x29a1('0x91'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x92'),_0x29a1('0x93'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x94'),_0x29a1('0x95'));_0x1535f9[_0x29a1('0xb')](_0x29a1('0x96'),'Owner.internal');_0x1535f9[_0x29a1('0xb')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x29a1('0x97'));}if(_0x49843c[_0x29a1('0x98')]){_0x1535f9[_0x29a1('0x98')](_0x49843c[_0x29a1('0x98')]);}if(_0x49843c[_0x29a1('0x99')]){_0x1535f9['offset'](_0x49843c[_0x29a1('0x99')]);}return db[_0x29a1('0x72')][_0x29a1('0x73')](_0x1535f9[_0x29a1('0x9a')](),_0x4b70a8);})[_0x29a1('0x60')](function(_0x1e9c3e){_0x1d4e91=_0x1e9c3e;var _0x2d596a=getUsersQuery(_0x1701d6,_0x1d4e91);return db[_0x29a1('0x72')][_0x29a1('0x73')](_0x2d596a[_0x29a1('0x9a')](),_0x4b70a8);})[_0x29a1('0x60')](function(_0x2aaf9b){_0x1aca54=_[_0x29a1('0x9b')](_0x2aaf9b,_0x3b2499);if(_0x1701d6===_0x29a1('0x2e')){return db[_0x29a1('0x9c')][_0x29a1('0x9d')]({'attributes':[_0x29a1('0x9e')],'raw':!![]});}})[_0x29a1('0x60')](function(_0x222716){var _0x20bf1d=_0x222716?_0x222716[_0x29a1('0x9e')]:undefined;var _0x486c24=_0x1d4e91[_0x29a1('0x18')](function(_0x54a859){return updateInteraction(_0x54a859,_0x27e97e,_0x1aca54,_0x20bf1d);});return Promise[_0x29a1('0x9f')](_0x486c24);});}function countFilteredInteractions(_0x55bf3d,_0x27b3be){var _0x45a6ef=_0x55bf3d[_0x29a1('0xa0')]();_0x45a6ef[_0x29a1('0xb')](_0x29a1('0xa1'));_0x45a6ef[_0x29a1('0xb')](_0x29a1('0x76'),_0x29a1('0x40'));var _0x20bdb6=utils[_0x29a1('0x23')](_0x27b3be);if(!_[_0x29a1('0xa2')](_0x20bdb6)){_0x45a6ef['where'](_0x29a1('0xa3'),_0x20bdb6);}var _0x4213e2={'type':db[_0x29a1('0xa4')][_0x29a1('0x70')][_0x29a1('0x71')],'raw':!![]};return db['sequelize'][_0x29a1('0x73')](_0x45a6ef['toString'](),_0x4213e2);}module[_0x29a1('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x1d2d=['\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','i.substatus','closed','join','Interaction','Sequelize','SELECT','query','toString','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Account.email','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.ContactId','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','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','Setting','enableEmailPreview','all','COUNT(*)','unreadMessages','isEmpty','t.id\x20IN\x20?','QueryTypes','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','./utils','getAccountFK','role','search','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','interactions','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','find','default','value','read','and','Contact','operator','$substring','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','type','text','tags','clause','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','end','body','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL'];(function(_0x263ffd,_0x140cf8){var _0x2b3b8b=function(_0x36331e){while(--_0x36331e){_0x263ffd['push'](_0x263ffd['shift']());}};_0x2b3b8b(++_0x140cf8);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x3a42be,_0x24fe67){_0x3a42be=_0x3a42be-0x0;var _0x232448=_0x1d2d[_0x3a42be];return _0x232448;};'use strict';var _=require(_0xd1d2('0x0'));var squel=require(_0xd1d2('0x1'));var as=require(_0xd1d2('0x2'));var qs=require(_0xd1d2('0x3'));var updateInteraction=require(_0xd1d2('0x4'))['updateInteraction'];var utils=require(_0xd1d2('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x5d3fac,_0x3caa72,_0x2bfabc){var _0x9852c0=![];var _0x269613=utils[_0xd1d2('0x6')](_0x5d3fac);if(_0x3caa72[_0xd1d2('0x7')]==='agent'&&!_0x2bfabc[_0xd1d2('0x8')]&&!_0x2bfabc[_0x269613]){_0x9852c0=!![];}return _0x9852c0;}function getTagsQuery(){return squel[_0xd1d2('0x9')]()[_0xd1d2('0xa')]('id')[_0xd1d2('0xa')](_0xd1d2('0xb'))[_0xd1d2('0xa')](_0xd1d2('0xc'))[_0xd1d2('0xd')](_0xd1d2('0xe'));}function getUsersQuery(_0x353f9b,_0x900ec){var _0x227d7f=utils[_0xd1d2('0xf')](_0x353f9b);var _0x5b21f4=_0xd1d2('0x10')+_0x353f9b+_0xd1d2('0x11');var _0x3ae4ae=squel[_0xd1d2('0x9')]()[_0xd1d2('0xa')](_0xd1d2('0x12'))[_0xd1d2('0xa')](_0xd1d2('0x13'))[_0xd1d2('0xa')](_0xd1d2('0x14')+_0x227d7f)['from'](_0x5b21f4,'ui')[_0xd1d2('0x15')](_0xd1d2('0x16'),'u',_0xd1d2('0x17'));if(_0x900ec['length']>0x0){_0x3ae4ae[_0xd1d2('0x18')](_0xd1d2('0x14')+_0x227d7f+_0xd1d2('0x19'),_[_0xd1d2('0x1a')](_0x900ec,'id'));}return _0x3ae4ae;}function getInteractionsQuery(_0xecac1f){var _0x2723b3=utils[_0xd1d2('0x1b')](_0xecac1f);var _0x57f2f9=utils['getAccountFK'](_0xecac1f);var _0x3be186=utils['getInteractionFK'](_0xecac1f);return squel[_0xd1d2('0x9')]()[_0xd1d2('0xd')](_0x2723b3[_0xd1d2('0x1c')],'i')[_0xd1d2('0x15')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xd1d2('0x15')]('users','o','o.id\x20=\x20i.UserId')[_0xd1d2('0x15')](_0x2723b3[_0xd1d2('0x1d')],'a',_0xd1d2('0x1e')+_0x57f2f9)[_0xd1d2('0x15')](_0x2723b3['messages'],'me',_0xd1d2('0x1f')+_0x3be186+_0xd1d2('0x20'))[_0xd1d2('0x15')](_0x2723b3['interactionsTags'],'it','it.'+_0x3be186+_0xd1d2('0x20'))[_0xd1d2('0x15')](_0xd1d2('0xe'),'t',_0xd1d2('0x21'));}function getSqlClauses(){var _0x3f229c={'body':squel[_0xd1d2('0x22')](),'contact':squel[_0xd1d2('0x22')](),'default':squel['expr'](),'fields':squel[_0xd1d2('0x22')](),'filter':squel[_0xd1d2('0x22')](),'read':squel[_0xd1d2('0x22')](),'tags':{'clause':squel[_0xd1d2('0x22')](),'ids':null},'user':squel[_0xd1d2('0x22')]()};return _0x3f229c;}function parseTagParameter(_0x39e991){var _0x28b8be=squel[_0xd1d2('0x22')]();if(_0x39e991){var _0xe6ef3c=utils[_0xd1d2('0x23')](_0x39e991);_0xe6ef3c[_0xd1d2('0x24')](function(_0x4e1bc2){_0x28b8be['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4e1bc2+',%');});}return _0x28b8be;}function parseReadParameter(_0x133c6c){var _0x442375='';if(_0x133c6c){_0x442375=_0xd1d2('0x25');if(_0x133c6c==='1'){_0x442375=_0x442375[_0xd1d2('0x26')](_0xd1d2('0x27'),'=');}else{_0x442375=_0x442375['replace'](_0xd1d2('0x27'),'>');}}return _0x442375;}function parseSearchFilter(_0x41171c,_0x383947){var _0x4b4134=squel[_0xd1d2('0x22')]();if(_0x383947){var _0x1db17f=_0x383947[_0xd1d2('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd1d2('0x28')](_0x1db17f)){_0x4b4134['or'](_0xd1d2('0x29'),_0x1db17f+'%');if([_0xd1d2('0x2a'),_0xd1d2('0x2b')][_0xd1d2('0x2c')](_0x41171c)){_0x4b4134['or'](_0xd1d2('0x2d'),_0x1db17f+'%');}else if(_0x41171c===_0xd1d2('0x2e')){_0x4b4134['or'](_0xd1d2('0x2f'),_0x1db17f+'%');}else if(_0x41171c===_0xd1d2('0x30')){_0x4b4134['or'](_0xd1d2('0x31'),_0x1db17f+'%');}}else if(_0x41171c===_0xd1d2('0x32')&&qs[_0xd1d2('0x33')](_0x1db17f)){_0x4b4134['or'](_0xd1d2('0x34'),_0x1db17f+'%');}else{if(_0x41171c===_0xd1d2('0x32')){_0x4b4134['or'](_0xd1d2('0x35'),qs[_0xd1d2('0x36')](_0x1db17f))['or'](_0xd1d2('0x37'),qs[_0xd1d2('0x36')](_0x1db17f));}else{if(_0x41171c!=='fax'){_0x4b4134['or'](_0xd1d2('0x38'),qs[_0xd1d2('0x36')](_0x1db17f));}_0x4b4134['or'](_0xd1d2('0x39'),_0x1db17f+'%');}}}return _0x4b4134;}function parseAdvancedSearchFilter(_0x573d27,_0x2ded64){var _0x516049=getSqlClauses();var _0x57a7fb=as[_0xd1d2('0x3a')](_0x573d27);var _0x103c5f=_0x57a7fb[_0xd1d2('0x3b')];for(var _0x1d00e0=0x0;_0x1d00e0<_0x57a7fb[_0xd1d2('0x3c')][_0xd1d2('0x3d')];_0x1d00e0++){var _0x56f48e=_0x57a7fb[_0xd1d2('0x3c')][_0x1d00e0];var _0x168eb8='i';var _0x5bdf40=_[_0xd1d2('0x3e')](_0x2ded64,[_0xd1d2('0xb'),_0x56f48e[_0xd1d2('0xa')]]);if(_0x5bdf40){var _0x2f55a1=as['buildExpression'](_0x168eb8,_0x5bdf40['type'],_0x56f48e);_0x516049[_0xd1d2('0x3f')][_0x103c5f](_0x2f55a1['text'],_0x2f55a1['value']['start'],_0x2f55a1[_0xd1d2('0x40')]['end']);}else{switch(_0x56f48e[_0xd1d2('0xa')]){case'unreadMessages':var _0x47996a=parseReadParameter(_0x56f48e['value']);_0x516049[_0xd1d2('0x41')][_0xd1d2('0x42')](_0x47996a);break;case _0xd1d2('0x43'):if(_0x56f48e[_0xd1d2('0x44')]===_0xd1d2('0x45')){if(_0x56f48e[_0xd1d2('0x40')][_0xd1d2('0x46')]('\x20')[_0xd1d2('0x3d')]>0x1){_0x516049[_0xd1d2('0x47')][_0x103c5f](_0xd1d2('0x48'),qs[_0xd1d2('0x36')](_0x56f48e[_0xd1d2('0x40')]),null);}else{var _0x1c2835='%'+_0x56f48e[_0xd1d2('0x40')]+'%';_0x516049['contact'][_0x103c5f]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1c2835,_0x1c2835,_0x1c2835);}}else{_0x5bdf40=_[_0xd1d2('0x3e')](_0x2ded64,[_0xd1d2('0xb'),_0xd1d2('0x49')]);_0x56f48e['field']='ContactId';_0x2f55a1=as[_0xd1d2('0x4a')](_0x168eb8,_0x5bdf40[_0xd1d2('0x4b')],_0x56f48e);_0x516049['contact'][_0x103c5f](_0x2f55a1[_0xd1d2('0x4c')],_0x2f55a1['value']['start'],_0x2f55a1[_0xd1d2('0x40')]['end']);}break;case'Tag':var _0x1825f2=_0x56f48e[_0xd1d2('0x40')][_0xd1d2('0x46')](',')['map'](function(_0x2ba87b){return Number(_0x2ba87b);});var _0x192fa4=parseTagParameter(_0x1825f2);_0x516049[_0xd1d2('0x4d')][_0xd1d2('0x4e')]['and'](_0x192fa4);_0x516049[_0xd1d2('0x4d')][_0xd1d2('0x4f')]=_0x1825f2;break;case'User':if(_0x56f48e[_0xd1d2('0x44')]==='$substring'){_0x516049[_0xd1d2('0x50')][_0x103c5f](_0xd1d2('0x51'),'%'+_0x56f48e[_0xd1d2('0x40')]+'%',null);}else{_0x5bdf40=_[_0xd1d2('0x3e')](_0x2ded64,[_0xd1d2('0xb'),'UserId']);_0x56f48e['field']=_0xd1d2('0x52');_0x2f55a1=as[_0xd1d2('0x4a')](_0x168eb8,_0x5bdf40['type'],_0x56f48e);_0x516049[_0xd1d2('0x50')][_0x103c5f](_0x2f55a1[_0xd1d2('0x4c')],_0x2f55a1[_0xd1d2('0x40')][_0xd1d2('0x53')],_0x2f55a1[_0xd1d2('0x40')][_0xd1d2('0x54')]);}break;case _0xd1d2('0x55'):case'plainBody':_0x2f55a1=as[_0xd1d2('0x4a')]('me',null,_0x56f48e);_0x516049[_0xd1d2('0x55')][_0x103c5f](_0x2f55a1['text'],_0x2f55a1[_0xd1d2('0x40')][_0xd1d2('0x53')],_0x2f55a1['value']['end']);break;}}}return _0x516049;}function parseModelFields(_0x3d4fe3,_0x182ea8,_0x4cb376){var _0x21fdfb=utils[_0xd1d2('0x6')](_0x3d4fe3);var _0x2553df=squel[_0xd1d2('0x22')]();var _0x404ad2=_(_0x182ea8)['keys']()['map'](function(_0x314af3){return _['some'](_0x4cb376,[_0xd1d2('0xb'),_0x314af3])?_0x314af3:undefined;})[_0xd1d2('0x56')]()['value']();if(_0x404ad2[_0xd1d2('0x3d')]>0x0){_0x404ad2[_0xd1d2('0x24')](function(_0x4e780c){if(_0x4e780c===_0x21fdfb){_0x2553df['and']('i.'+_0x21fdfb+_0xd1d2('0x19'),[][_0xd1d2('0x57')](_0x182ea8[_0x4e780c]));}else if(_0x4e780c===_0xd1d2('0x58')){var _0xfd8024=JSON[_0xd1d2('0x59')](_0x182ea8[_0x4e780c])[_0xd1d2('0x5a')];var _0x1f6150=JSON[_0xd1d2('0x59')](_0x182ea8[_0x4e780c])[_0xd1d2('0x5b')];_0x2553df['and'](_0xd1d2('0x5c'),_0xfd8024,_0x1f6150);}else{if(_0x182ea8[_0x4e780c]==='null'){_0x2553df['and']('i.'+_0x4e780c+_0xd1d2('0x5d'));}else{_0x2553df[_0xd1d2('0x42')]('i.'+_0x4e780c+_0xd1d2('0x5e'),_0x182ea8[_0x4e780c]);}}});}return _0x2553df;}function parseQueryParameters(_0x47417f,_0x215dea,_0x459209){var _0x35a51b=getSqlClauses();return Promise[_0xd1d2('0x5f')]()[_0xd1d2('0x60')](function(){return parseModelFields(_0x47417f,_0x215dea,_0x459209);})[_0xd1d2('0x60')](function(_0x28173a){_0x35a51b[_0xd1d2('0x61')][_0xd1d2('0x42')](_0x28173a);return parseReadParameter(_0x215dea['read']);})['then'](function(_0x367f3c){_0x35a51b[_0xd1d2('0x41')][_0xd1d2('0x42')](_0x367f3c);return parseTagParameter(_0x215dea[_0xd1d2('0x62')]);})[_0xd1d2('0x60')](function(_0x1d1d31){_0x35a51b[_0xd1d2('0x4d')][_0xd1d2('0x4e')][_0xd1d2('0x42')](_0x1d1d31);return parseSearchFilter(_0x47417f,_0x215dea[_0xd1d2('0x63')]);})[_0xd1d2('0x60')](function(_0x54406e){_0x35a51b['filter']=_0x54406e;return _0x35a51b;});}function checkAccountsRestrictions(_0x306242,_0x321bc8,_0x3d1da1){var _0x1c6a46=utils['getAccountFK'](_0x306242);var _0x17e149=_0xd1d2('0x64')+_[_0xd1d2('0x65')](_0x306242)+(_0x306242===_0xd1d2('0x66')?_0xd1d2('0x67'):_0xd1d2('0x68'));var _0x1c04e4=squel['expr']();return Promise[_0xd1d2('0x5f')]()[_0xd1d2('0x60')](function(){if(_0x3d1da1[_0xd1d2('0x8')]&&_0x321bc8['role']==='agent'){return _0x321bc8[_0x17e149]({'attributes':['id'],'raw':!![]});}})[_0xd1d2('0x60')](function(_0x3cd7c7){if(_0x3cd7c7){if(_0x3cd7c7[_0xd1d2('0x3d')]===0x0){_0x1c04e4[_0xd1d2('0x42')]('i.'+_0x1c6a46+'\x20IS\x20NULL');}else{_0x1c04e4[_0xd1d2('0x42')]('i.'+_0x1c6a46+_0xd1d2('0x19'),_[_0xd1d2('0x1a')](_0x3cd7c7,'id'));}}else if(!_0x3d1da1[_0x1c6a46]){_0x1c04e4['and']('i.'+_0x1c6a46+_0xd1d2('0x69'));}})[_0xd1d2('0x60')](function(){return _0x1c04e4;});}function getClosedOrderClause(_0x4842f1,_0x69a9e2){var _0x3799b7='';var _0x12201f=[_0xd1d2('0x6a'),'i.secondDisposition',_0xd1d2('0x6b')];if(_0x4842f1===_0xd1d2('0x32')){_0x12201f[_0xd1d2('0x6c')](_0xd1d2('0x6d'));}if(_0x69a9e2[_0xd1d2('0x6e')]==='0'&&_0x4842f1==='mail'){_0x3799b7='i.substatus';}else{if(_0x69a9e2['closed']==='1'){_0x12201f['shift']();}_0x3799b7='CONCAT_WS(\x27\x27,\x20'+_0x12201f[_0xd1d2('0x6f')](',\x20')+')';}return _0x3799b7;}function getFilteredInteractions(_0x271e4a,_0x386b51,_0x5f5043,_0x42d6b8){var _0x17c4eb=utils[_0xd1d2('0xf')](_0x271e4a);var _0x580d83=_[_0xd1d2('0x65')](_0x271e4a)+_0xd1d2('0x70');var _0x47422d=[];var _0x4a42d9=getTagsQuery();var _0x43b43c={'type':db[_0xd1d2('0x71')]['QueryTypes'][_0xd1d2('0x72')],'raw':!![]};var _0x1c3c36=[];var _0x516a57=[];return db['sequelize'][_0xd1d2('0x73')](_0x4a42d9[_0xd1d2('0x74')](),_0x43b43c)[_0xd1d2('0x60')](function(_0x14cd07){_0x47422d=_['keyBy'](_0x14cd07,'id');_0x43b43c=_[_0xd1d2('0x75')](_0x43b43c,{'model':db[_0x580d83],'mapToModel':!![],'nest':!![]});if(_0x5f5043[_0xd1d2('0x61')]){_0x42d6b8[_0xd1d2('0x76')][_0xd1d2('0x24')](function(_0x5d537e){_0x386b51[_0xd1d2('0xa')]('i.'+_0x5d537e);});}else{_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x77'),'unreadMessages');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x78'),'Account.key');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x79'),_0xd1d2('0x7a'));if(_0x271e4a===_0xd1d2('0x32')){_0x386b51[_0xd1d2('0xa')]('a.email',_0xd1d2('0x7b'));_0x386b51['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x386b51['field'](_0xd1d2('0x7c'));_0x386b51['field'](_0xd1d2('0x7d'));_0x386b51['field'](_0xd1d2('0x7e'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x7f'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x80'));_0x386b51[_0xd1d2('0xa')]('i.attach');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x81'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x82'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x83'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x6b'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x84'));_0x386b51['field'](_0xd1d2('0x6a'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x6d'));_0x386b51[_0xd1d2('0xa')]('i.to');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x85'));_0x386b51[_0xd1d2('0xa')]('i.MailAccountId');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x86'));}else if(_0x271e4a==='openchannel'){_0x386b51['field'](_0xd1d2('0x87'),_0xd1d2('0x88'));}else{_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x89'),_0xd1d2('0x88'));}if(_0x271e4a!==_0xd1d2('0x32')){_0x386b51[_0xd1d2('0xa')]('i.*');}_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x8a'),_0xd1d2('0x8b'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x8c'),_0xd1d2('0x8d'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x8e'),_0xd1d2('0x8f'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x90'),_0xd1d2('0x91'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x92'),'Contact.mobile');_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x93'),_0xd1d2('0x94'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x95'),_0xd1d2('0x96'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x97'),_0xd1d2('0x98'));_0x386b51[_0xd1d2('0xa')](_0xd1d2('0x99'),_0xd1d2('0x9a'));}if(_0x42d6b8[_0xd1d2('0x9b')]){_0x386b51['limit'](_0x42d6b8[_0xd1d2('0x9b')]);}if(_0x42d6b8[_0xd1d2('0x9c')]){_0x386b51[_0xd1d2('0x9c')](_0x42d6b8[_0xd1d2('0x9c')]);}return db[_0xd1d2('0x9d')][_0xd1d2('0x73')](_0x386b51[_0xd1d2('0x74')](),_0x43b43c);})[_0xd1d2('0x60')](function(_0x28a351){_0x1c3c36=_0x28a351;var _0x59c11a=getUsersQuery(_0x271e4a,_0x1c3c36);return db[_0xd1d2('0x9d')][_0xd1d2('0x73')](_0x59c11a['toString'](),_0x43b43c);})[_0xd1d2('0x60')](function(_0x234262){_0x516a57=_[_0xd1d2('0x9e')](_0x234262,_0x17c4eb);if(_0x271e4a===_0xd1d2('0x32')){return db[_0xd1d2('0x9f')]['findOne']({'attributes':[_0xd1d2('0xa0')],'raw':!![]});}})[_0xd1d2('0x60')](function(_0x2b4bb8){var _0x720693=_0x2b4bb8?_0x2b4bb8['enableEmailPreview']:undefined;var _0x68f8ba=_0x1c3c36[_0xd1d2('0x1a')](function(_0x3b7fc5){return updateInteraction(_0x3b7fc5,_0x47422d,_0x516a57,_0x720693);});return Promise[_0xd1d2('0xa1')](_0x68f8ba);});}function countFilteredInteractions(_0x39c9f1,_0x18bd6d){var _0x1aa0a5=_0x39c9f1['clone']();_0x1aa0a5[_0xd1d2('0xa')](_0xd1d2('0xa2'));_0x1aa0a5[_0xd1d2('0xa')](_0xd1d2('0x77'),_0xd1d2('0xa3'));var _0x30b8e7=utils[_0xd1d2('0x23')](_0x18bd6d);if(!_[_0xd1d2('0xa4')](_0x30b8e7)){_0x1aa0a5[_0xd1d2('0x18')](_0xd1d2('0xa5'),_0x30b8e7);}var _0x1cad85={'type':db[_0xd1d2('0x71')][_0xd1d2('0xa6')][_0xd1d2('0x72')],'raw':!![]};return db[_0xd1d2('0x9d')][_0xd1d2('0x73')](_0x1aa0a5[_0xd1d2('0x74')](),_0x1cad85);}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 292162d..4738770 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 _0xd83c=['disposition','UserId','MailMessage','findOne','plainBody','-id','then','trimStart','catch','updateInteraction','Users','TagIds','Tags','../../mysqldb','map','split','forEach','waiting','talking','answered','unmanaged','abandoned','total','closed'];(function(_0x7dc06f,_0xa14a10){var _0x150783=function(_0x1d50b1){while(--_0x1d50b1){_0x7dc06f['push'](_0x7dc06f['shift']());}};_0x150783(++_0xa14a10);}(_0xd83c,0x18d));var _0xcd83=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xd83c[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require('lodash');var db=require(_0xcd83('0x0'))['db'];function getInteractionUsers(_0x25873d,_0x2a1119){return new Promise(function(_0x3ae7c6,_0x5b623d){try{var _0x63e5c5=[];if(_0x2a1119[_0x25873d]){_0x63e5c5=_0x2a1119[_0x25873d][_0xcd83('0x1')](function(_0xe1fcb9){return{'id':_0xe1fcb9['id'],'fullname':_0xe1fcb9['fullname']};});}return _0x3ae7c6(_0x63e5c5);}catch(_0x1bc289){_0x5b623d(_0x1bc289);}});}function getInteractionTags(_0x2e0e0a,_0x4cc4dd){var _0x494ccc=[];if(_0x2e0e0a){_0x2e0e0a[_0xcd83('0x2')](',')[_0xcd83('0x3')](function(_0xfe6bb2){_0x494ccc['push'](_0x4cc4dd[_0xfe6bb2]);});}return _0x494ccc;}function updateWaitingCounter(_0x333d9e){if(_0x333d9e['waiting']){_0x333d9e['waiting']-=0x1;}}function updateInteractionCounters(_0x2ed40c){_0x2ed40c[_0xcd83('0x4')]=0x0;_0x2ed40c[_0xcd83('0x5')]=0x0;_0x2ed40c[_0xcd83('0x6')]=0x0;_0x2ed40c[_0xcd83('0x7')]=0x0;_0x2ed40c[_0xcd83('0x8')]=0x0;_0x2ed40c[_0xcd83('0x9')]=0x0;if(_0x2ed40c[_0xcd83('0xa')]){if(_0x2ed40c[_0xcd83('0xb')]===_0xcd83('0x8')){_0x2ed40c['abandoned']+=0x1;updateWaitingCounter(_0x2ed40c);}if(_0x2ed40c[_0xcd83('0xc')]){_0x2ed40c['answered']+=0x1;if(_0x2ed40c[_0xcd83('0x5')]){_0x2ed40c[_0xcd83('0x5')]-=0x1;}}else{if(_0x2ed40c[_0xcd83('0xb')]){_0x2ed40c[_0xcd83('0x7')]+=0x1;updateWaitingCounter(_0x2ed40c);}}}else{if(!_0x2ed40c[_0xcd83('0xc')]){_0x2ed40c[_0xcd83('0x4')]+=0x1;}if(_0x2ed40c['UserId']){_0x2ed40c[_0xcd83('0x5')]+=0x1;updateWaitingCounter(_0x2ed40c);}}_0x2ed40c[_0xcd83('0x9')]+=0x1;return _0x2ed40c;}function getLastMessageText(_0x5e77b7){return db[_0xcd83('0xd')][_0xcd83('0xe')]({'where':{'$and':[{'MailInteractionId':_0x5e77b7['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xcd83('0xf')],'order':_0xcd83('0x10'),'raw':!![]})[_0xcd83('0x11')](function(_0x8f5b57){if(_0x8f5b57&&_0x8f5b57['plainBody']){_0x5e77b7['lastMsgText']=_[_0xcd83('0x12')](_0x8f5b57[_0xcd83('0xf')]);}return _0x5e77b7;})[_0xcd83('0x13')](function(_0x19113d){throw _0x19113d;});}exports[_0xcd83('0x14')]=function(_0x39fb5a,_0x48adac,_0x122f19,_0x5b80d8){return new Promise(function(_0x4dd4fc,_0x24a049){return getInteractionUsers(_0x39fb5a['id'],_0x122f19)[_0xcd83('0x11')](function(_0x9e08cb){_0x39fb5a[_0xcd83('0x15')]=_0x9e08cb;return getInteractionTags(_0x39fb5a[_0xcd83('0x16')],_0x48adac);})[_0xcd83('0x11')](function(_0x4edcd6){_0x39fb5a[_0xcd83('0x17')]=_0x4edcd6;delete _0x39fb5a[_0xcd83('0x16')];return updateInteractionCounters(_0x39fb5a);})[_0xcd83('0x11')](function(_0x59a6a2){if(_0x5b80d8){return getLastMessageText(_0x59a6a2);}else{return _0x59a6a2;}})[_0xcd83('0x11')](function(_0x1cc593){_0x4dd4fc(_0x1cc593);})[_0xcd83('0x13')](function(_0x414a35){_0x24a049(_0x414a35);});});}; \ No newline at end of file +var _0xb166=['lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','map','fullname','split','forEach','waiting','answered','abandoned','closed','UserId','talking','disposition','total','findOne','out','plainBody','then'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xb166,0x1cf));var _0x6b16=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0xb166[_0x588011];return _0x3b3773;};'use strict';var _=require(_0x6b16('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x4491ca,_0x53fd5a){return new Promise(function(_0x589d90,_0x579b62){try{var _0x5c01b9=[];if(_0x53fd5a[_0x4491ca]){_0x5c01b9=_0x53fd5a[_0x4491ca][_0x6b16('0x1')](function(_0x80ba04){return{'id':_0x80ba04['id'],'fullname':_0x80ba04[_0x6b16('0x2')]};});}return _0x589d90(_0x5c01b9);}catch(_0x5dde95){_0x579b62(_0x5dde95);}});}function getInteractionTags(_0x53bc00,_0x42727a){var _0xf6cadc=[];if(_0x53bc00){_0x53bc00[_0x6b16('0x3')](',')[_0x6b16('0x4')](function(_0x11c19e){_0xf6cadc['push'](_0x42727a[_0x11c19e]);});}return _0xf6cadc;}function updateWaitingCounter(_0x3105c6){if(_0x3105c6[_0x6b16('0x5')]){_0x3105c6[_0x6b16('0x5')]-=0x1;}}function updateInteractionCounters(_0x41b681){_0x41b681['waiting']=0x0;_0x41b681['talking']=0x0;_0x41b681[_0x6b16('0x6')]=0x0;_0x41b681['unmanaged']=0x0;_0x41b681[_0x6b16('0x7')]=0x0;_0x41b681['total']=0x0;if(_0x41b681[_0x6b16('0x8')]){if(_0x41b681['disposition']===_0x6b16('0x7')){_0x41b681[_0x6b16('0x7')]+=0x1;updateWaitingCounter(_0x41b681);}if(_0x41b681[_0x6b16('0x9')]){_0x41b681[_0x6b16('0x6')]+=0x1;if(_0x41b681['talking']){_0x41b681[_0x6b16('0xa')]-=0x1;}}else{if(_0x41b681[_0x6b16('0xb')]){_0x41b681['unmanaged']+=0x1;updateWaitingCounter(_0x41b681);}}}else{if(!_0x41b681[_0x6b16('0x9')]){_0x41b681[_0x6b16('0x5')]+=0x1;}if(_0x41b681[_0x6b16('0x9')]){_0x41b681['talking']+=0x1;updateWaitingCounter(_0x41b681);}}_0x41b681[_0x6b16('0xc')]+=0x1;return _0x41b681;}function getLastMessageText(_0x33faa6){return db['MailMessage'][_0x6b16('0xd')]({'where':{'$and':[{'MailInteractionId':_0x33faa6['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x6b16('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x6b16('0xf')],'order':'-id','raw':!![]})[_0x6b16('0x10')](function(_0x602811){if(_0x602811&&_0x602811[_0x6b16('0xf')]){_0x33faa6[_0x6b16('0x11')]=_[_0x6b16('0x12')](_0x602811[_0x6b16('0xf')]);}return _0x33faa6;})[_0x6b16('0x13')](function(_0x36d512){throw _0x36d512;});}exports[_0x6b16('0x14')]=function(_0x3749c8,_0x3b2ae8,_0x5e72bb,_0xe9fd6){return new Promise(function(_0x40a69b,_0x4891ef){return getInteractionUsers(_0x3749c8['id'],_0x5e72bb)['then'](function(_0x31c100){_0x3749c8[_0x6b16('0x15')]=_0x31c100;return getInteractionTags(_0x3749c8[_0x6b16('0x16')],_0x3b2ae8);})['then'](function(_0x26f925){_0x3749c8[_0x6b16('0x17')]=_0x26f925;delete _0x3749c8[_0x6b16('0x16')];return updateInteractionCounters(_0x3749c8);})[_0x6b16('0x10')](function(_0x549418){if(_0xe9fd6){return getLastMessageText(_0x549418);}else{return _0x549418;}})['then'](function(_0x7898ea){_0x40a69b(_0x7898ea);})[_0x6b16('0x13')](function(_0xe7d67f){_0x4891ef(_0xe7d67f);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 2056666..5848e10 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 _0x32b2=['update','info','error','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Account','upperFirst','InteractionId','unknown','accounts','_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'];(function(_0x27d48f,_0x1a926b){var _0x4db5ff=function(_0x348ffd){while(--_0x348ffd){_0x27d48f['push'](_0x27d48f['shift']());}};_0x4db5ff(++_0x1a926b);}(_0x32b2,0x15f));var _0x232b=function(_0x48c03c,_0x3a0d41){_0x48c03c=_0x48c03c-0x0;var _0x33b898=_0x32b2[_0x48c03c];return _0x33b898;};'use strict';var _=require('lodash');var db=require(_0x232b('0x0'))['db'];var loggers={'openchannel':require(_0x232b('0x1'))(_0x232b('0x2')),'mail':require('../../config/logger')(_0x232b('0x3')),'fax':require(_0x232b('0x1'))('fax-interactions'),'sms':require(_0x232b('0x1'))(_0x232b('0x4')),'chat':require(_0x232b('0x1'))(_0x232b('0x5')),'whatsapp':require(_0x232b('0x1'))(_0x232b('0x6'))};function getAccountFK(_0x4f42c8){return _[_0x232b('0x7')](_0x4f42c8)+(_0x4f42c8===_0x232b('0x8')?'Website':_0x232b('0x9'))+'Id';}function getInteractionFK(_0x308f9f){return _[_0x232b('0x7')](_0x308f9f)+'InteractionId';}function getInteractionId(_0xcddf2c,_0x1ee4ca,_0x3807b1){if(_0xcddf2c&&_0xcddf2c[_[_0x232b('0xa')](_0x3807b1)+'InteractionId']){return _0xcddf2c[_[_0x232b('0xa')](_0x3807b1)+_0x232b('0xb')];}else if(_0xcddf2c&&_0xcddf2c['id']){return _0xcddf2c['id'];}else if(_0x1ee4ca&&_0x1ee4ca['id']){return _0x1ee4ca['id'];}else{return _0x232b('0xc');}}function getInteractionsTables(_0x507590){return{'accounts':_0x507590+'_'+(_0x507590===_0x232b('0x8')?'websites':_0x232b('0xd')),'interactions':_0x507590+'_interactions','interactionsTags':_0x507590+_0x232b('0xe'),'messages':_0x507590+_0x232b('0xf'),'userInteractions':_0x232b('0x10')+_0x507590+'_interactions'};}function getSelectedTags(_0x91584e){var _0x33e5f1=[];if(_0x91584e){_0x33e5f1=Array[_0x232b('0x11')](_0x91584e)?_0x91584e:[_0x91584e];}return _0x33e5f1;}function log(_0x20d8f7,_0x1f5bd9,_0x5ef36f,_0x21817d,_0x27ff67,_0x5d5c8a){loggers[_0x27ff67[_0x232b('0x12')]()][_0x20d8f7](_0x232b('0x13'),_0x5d5c8a[_0x232b('0x14')](),_0x1f5bd9?_0x1f5bd9['id']:null,_0x1f5bd9?_0x1f5bd9[_0x232b('0x15')]:null,_0x1f5bd9?_0x1f5bd9[_0x232b('0x16')]:null,getInteractionId(_0x5ef36f,_0x21817d,_0x27ff67),_0x5ef36f?JSON[_0x232b('0x17')](_0x5ef36f):'null');}function updateUser(_0x2e94b6,_0x54e661,_0x500469,_0x400a59,_0x3efe4d){db[_['upperFirst'](_0x400a59)+_0x232b('0x18')]['findOne']({'where':{'id':getInteractionId(_0x54e661,_0x500469,_0x400a59)}})[_0x232b('0x19')](function(_0x5dfdcf){if(_0x5dfdcf){return _0x5dfdcf[_0x232b('0x1a')]({'UserId':_0x2e94b6?_0x2e94b6['id']:null});}})['then'](function(_0x4f8773){if(_0x4f8773){log(_0x232b('0x1b'),_0x2e94b6,_0x54e661,_0x500469,_0x400a59,_0x3efe4d);}})['catch'](function(){log(_0x232b('0x1c'),_0x2e94b6,_0x54e661,_0x500469,_0x400a59,_0x3efe4d);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x7f07=['name','role','stringify','null','Interaction','findOne','update','info','catch','error','exports','lodash','openchannel-interactions','mail-interactions','../../config/logger','fax-interactions','sms-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x47d454,_0xf3253a){var _0x1188b9=function(_0x1b6f8d){while(--_0x1b6f8d){_0x47d454['push'](_0x47d454['shift']());}};_0x1188b9(++_0xf3253a);}(_0x7f07,0x122));var _0x77f0=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7f07[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x77f0('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x77f0('0x1')),'mail':require('../../config/logger')(_0x77f0('0x2')),'fax':require(_0x77f0('0x3'))(_0x77f0('0x4')),'sms':require('../../config/logger')(_0x77f0('0x5')),'chat':require(_0x77f0('0x3'))('chat-interactions'),'whatsapp':require(_0x77f0('0x3'))(_0x77f0('0x6'))};function getAccountFK(_0x342624){return _[_0x77f0('0x7')](_0x342624)+(_0x342624===_0x77f0('0x8')?_0x77f0('0x9'):_0x77f0('0xa'))+'Id';}function getInteractionFK(_0x3dd2b5){return _['capitalize'](_0x3dd2b5)+_0x77f0('0xb');}function getInteractionId(_0x316996,_0x3dad4b,_0x2c1345){if(_0x316996&&_0x316996[_[_0x77f0('0xc')](_0x2c1345)+'InteractionId']){return _0x316996[_[_0x77f0('0xc')](_0x2c1345)+_0x77f0('0xb')];}else if(_0x316996&&_0x316996['id']){return _0x316996['id'];}else if(_0x3dad4b&&_0x3dad4b['id']){return _0x3dad4b['id'];}else{return _0x77f0('0xd');}}function getInteractionsTables(_0x5e938a){return{'accounts':_0x5e938a+'_'+(_0x5e938a===_0x77f0('0x8')?'websites':_0x77f0('0xe')),'interactions':_0x5e938a+_0x77f0('0xf'),'interactionsTags':_0x5e938a+_0x77f0('0x10'),'messages':_0x5e938a+'_messages','userInteractions':_0x77f0('0x11')+_0x5e938a+_0x77f0('0xf')};}function getSelectedTags(_0x123e74){var _0x3ea470=[];if(_0x123e74){_0x3ea470=Array[_0x77f0('0x12')](_0x123e74)?_0x123e74:[_0x123e74];}return _0x3ea470;}function log(_0x325f51,_0x4c4e01,_0x7c3509,_0x270c1e,_0x42f2d3,_0x1a12ae){loggers[_0x42f2d3['toLowerCase']()][_0x325f51](_0x77f0('0x13'),_0x1a12ae['toUpperCase'](),_0x4c4e01?_0x4c4e01['id']:null,_0x4c4e01?_0x4c4e01[_0x77f0('0x14')]:null,_0x4c4e01?_0x4c4e01[_0x77f0('0x15')]:null,getInteractionId(_0x7c3509,_0x270c1e,_0x42f2d3),_0x7c3509?JSON[_0x77f0('0x16')](_0x7c3509):_0x77f0('0x17'));}function updateUser(_0x362e5a,_0x44669f,_0x1131a3,_0x12023e,_0x5832ef){db[_['upperFirst'](_0x12023e)+_0x77f0('0x18')][_0x77f0('0x19')]({'where':{'id':getInteractionId(_0x44669f,_0x1131a3,_0x12023e)}})['then'](function(_0x460e66){if(_0x460e66){return _0x460e66[_0x77f0('0x1a')]({'UserId':_0x362e5a?_0x362e5a['id']:null});}})['then'](function(_0x609c54){if(_0x609c54){log(_0x77f0('0x1b'),_0x362e5a,_0x44669f,_0x1131a3,_0x12023e,_0x5832ef);}})[_0x77f0('0x1c')](function(){log(_0x77f0('0x1d'),_0x362e5a,_0x44669f,_0x1131a3,_0x12023e,_0x5832ef);});}module[_0x77f0('0x1e')]={'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 8a9ec6d..7143555 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 _0xf4c9=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','License','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license'];(function(_0x4d7379,_0x4b4e63){var _0x46d7cf=function(_0x53f5f0){while(--_0x53f5f0){_0x4d7379['push'](_0x4d7379['shift']());}};_0x46d7cf(++_0x4b4e63);}(_0xf4c9,0x1aa));var _0x9f4c=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xf4c9[_0x47aa64];return _0x549c7a;};'use strict';var crypto=require(_0x9f4c('0x0'));var util=require(_0x9f4c('0x1'));var compose=require(_0x9f4c('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x9f4c('0x3'));function getValueFromLicense(_0x4f495b,_0x80560e){if(_0x4f495b&&_0x80560e){if(_0x80560e[_0x9f4c('0x4')]&&_0x80560e[_0x9f4c('0x5')]){var _0x54ad85=_0x80560e[_0x9f4c('0x4')];var _0x514031=_0x80560e[_0x9f4c('0x5')];var _0x48dc53=_0x54ad85['split']('-')[0x4];var _0x498795=_0x54ad85[_0x9f4c('0x6')]('-')[0x0];var _0x398b30=crypto[_0x9f4c('0x7')](_0x9f4c('0x8'),util[_0x9f4c('0x9')](_0x9f4c('0xa'),_0x48dc53,_0x54ad85,_0x498795));var _0x553357=_0x398b30[_0x9f4c('0xb')](_0x514031,_0x9f4c('0xc'),_0x9f4c('0xd'));_0x553357+=_0x398b30[_0x9f4c('0xe')](_0x9f4c('0xd'));var _0x433f83=JSON[_0x9f4c('0xf')](_0x553357);return _0x433f83[_0x9f4c('0x10')](_0x4f495b)?_0x433f83[_0x4f495b]:null;}}return null;}function isLimit(_0x5700e2,_0x4953e8,_0x4d71a9,_0x124492){var _0x53159a=_0x4953e8;return compose()['use'](function(_0x32db23,_0x4df46b,_0x5a9cb0){return db[_0x9f4c('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1bcf14){var _0x516787=getValueFromLicense(_0x5700e2,_0x1bcf14);return _0x516787?_0x516787:_0x53159a;})[_0x9f4c('0x12')](function(_0x336fc2){_0x53159a=_0x336fc2;return _0x4d71a9[_0x9f4c('0x13')](_0x124492);})[_0x9f4c('0x12')](function(_0x182295){if(_0x182295>=_0x53159a){return _0x4df46b[_0x9f4c('0x14')](0x193)['json']({'message':util[_0x9f4c('0x9')](_0x9f4c('0x15'),_0x5700e2)});}_0x5a9cb0();})[_0x9f4c('0x16')](function(_0x30da19){_0x5a9cb0(_0x30da19);});});}function isUserLimit(){return isLimit(_0x9f4c('0x17'),0x1,db['User'],{'where':{'$or':[{'role':_0x9f4c('0x18')},{'role':_0x9f4c('0x19')}]}});}exports[_0x9f4c('0x1a')]=isUserLimit; \ No newline at end of file +var _0xe9d2=['update','base64','utf8','final','parse','findOne','then','count','status','json','catch','users','admin','isUserLimit','crypto','composable-middleware','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s'];(function(_0x3546eb,_0x440f3f){var _0xe660bf=function(_0x282566){while(--_0x282566){_0x3546eb['push'](_0x3546eb['shift']());}};_0xe660bf(++_0x440f3f);}(_0xe9d2,0x1da));var _0x2e9d=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xe9d2[_0x2283dc];return _0x16db90;};'use strict';var crypto=require(_0x2e9d('0x0'));var util=require('util');var compose=require(_0x2e9d('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x2e9d('0x2'));function getValueFromLicense(_0x2ce9be,_0x269728){if(_0x2ce9be&&_0x269728){if(_0x269728[_0x2e9d('0x3')]&&_0x269728[_0x2e9d('0x4')]){var _0x41db85=_0x269728[_0x2e9d('0x3')];var _0x140f78=_0x269728['license'];var _0x113f60=_0x41db85[_0x2e9d('0x5')]('-')[0x4];var _0x38102b=_0x41db85[_0x2e9d('0x5')]('-')[0x0];var _0x3c28ef=crypto[_0x2e9d('0x6')]('aes-256-ctr',util[_0x2e9d('0x7')](_0x2e9d('0x8'),_0x113f60,_0x41db85,_0x38102b));var _0x410920=_0x3c28ef[_0x2e9d('0x9')](_0x140f78,_0x2e9d('0xa'),_0x2e9d('0xb'));_0x410920+=_0x3c28ef[_0x2e9d('0xc')](_0x2e9d('0xb'));var _0x2cf4d1=JSON[_0x2e9d('0xd')](_0x410920);return _0x2cf4d1['hasOwnProperty'](_0x2ce9be)?_0x2cf4d1[_0x2ce9be]:null;}}return null;}function isLimit(_0x2a8a52,_0x4b1aff,_0x56022f,_0x246f27){var _0x3f046e=_0x4b1aff;return compose()['use'](function(_0x852ec7,_0x21f006,_0x4ddf2f){return db['License'][_0x2e9d('0xe')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x424e4d){var _0x558b33=getValueFromLicense(_0x2a8a52,_0x424e4d);return _0x558b33?_0x558b33:_0x3f046e;})[_0x2e9d('0xf')](function(_0x5440b2){_0x3f046e=_0x5440b2;return _0x56022f[_0x2e9d('0x10')](_0x246f27);})[_0x2e9d('0xf')](function(_0x243823){if(_0x243823>=_0x3f046e){return _0x21f006[_0x2e9d('0x11')](0x193)[_0x2e9d('0x12')]({'message':util[_0x2e9d('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2a8a52)});}_0x4ddf2f();})[_0x2e9d('0x13')](function(_0x3c58fd){_0x4ddf2f(_0x3c58fd);});});}function isUserLimit(){return isLimit(_0x2e9d('0x14'),0x1,db['User'],{'where':{'$or':[{'role':_0x2e9d('0x15')},{'role':'user'}]}});}exports[_0x2e9d('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 6a66374..d25bfc7 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 _0xb801=['startsWith','and','replace','[$and]','[$or]','split','length','slice','forEach','match','filter','indexOf','push','buildExpression','DATE','operator','$eq','value','includes','$gt','$lte','add','days','format','castTo','text','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator'];(function(_0x8b63c1,_0x3a2d53){var _0x3f01f9=function(_0x33657e){while(--_0x33657e){_0x8b63c1['push'](_0x8b63c1['shift']());}};_0x3f01f9(++_0x3a2d53);}(_0xb801,0x18b));var _0x1b80=function(_0x4561d5,_0x605006){_0x4561d5=_0x4561d5-0x0;var _0x449ddb=_0xb801[_0x4561d5];return _0x449ddb;};'use strict';var _=require(_0x1b80('0x0'));var moment=require(_0x1b80('0x1'));exports[_0x1b80('0x2')]=function(_0x18cdac){var _0x3f52cc={'conditions':[]};_0x3f52cc[_0x1b80('0x3')]=_[_0x1b80('0x4')](_0x18cdac,'[$or]')?'or':_0x1b80('0x5');var _0x52720a=_0x18cdac[_0x1b80('0x6')](_0x1b80('0x7'),'')[_0x1b80('0x6')](_0x1b80('0x8'),'')[_0x1b80('0x9')]('||');for(var _0x5cb67a=0x0;_0x5cb67a<_0x52720a[_0x1b80('0xa')];_0x5cb67a++){var _0x55c384=_0x52720a[_0x5cb67a]['split'](':=');var _0x41958d=_0x55c384[0x0];var _0x232b2d=_0x55c384[_0x1b80('0xb')](0x1);_0x232b2d[_0x1b80('0xc')](function(_0x49f6e1){var _0x26ab67=_0x49f6e1[_0x1b80('0x9')]('[')['shift']();var _0x5b19dd=_0x49f6e1[_0x1b80('0xd')](/\[(.*?)\]/g);_0x5b19dd[_0x1b80('0xc')](function(_0x3e4dfc){var _0x12d2b6=_0x3e4dfc['split']('[')[_0x1b80('0xe')](function(_0x4cd270){return _0x4cd270[_0x1b80('0xf')](']')>-0x1;})['map'](function(_0x312f73){return _0x312f73['split'](']')[0x0];})[0x0];_0x3f52cc['conditions'][_0x1b80('0x10')]({'field':_0x41958d,'operator':_0x26ab67,'value':_0x12d2b6});});});}return _0x3f52cc;};exports[_0x1b80('0x11')]=function(_0x4610d1,_0x3148d7,_0x1fa9ac){var _0x4e3500={};if(_0x3148d7===_0x1b80('0x12')){if(_0x1fa9ac[_0x1b80('0x13')]===_0x1b80('0x14')){_0x1fa9ac[_0x1b80('0x13')]='$between';_0x1fa9ac[_0x1b80('0x15')]+=','+_0x1fa9ac[_0x1b80('0x15')];}else if(_[_0x1b80('0x16')]([_0x1b80('0x17'),_0x1b80('0x18')],_0x1fa9ac['operator'])){_0x1fa9ac[_0x1b80('0x15')]=moment(_0x1fa9ac[_0x1b80('0x15')])[_0x1b80('0x19')](0x1,_0x1b80('0x1a'))[_0x1b80('0x1b')]('YYYY-MM-DD');}}if(_0x1fa9ac[_0x1b80('0x1c')]){_0x3148d7=_0x1fa9ac['castTo'];_0x4e3500[_0x1b80('0x1d')]='CAST('+_0x4610d1+'.'+_0x1fa9ac[_0x1b80('0x1e')]+'\x20AS\x20'+_0x1fa9ac['castTo']+')\x20'+parseOperator(_0x1fa9ac['operator']);}else{_0x4e3500[_0x1b80('0x1d')]=_0x4610d1+'.'+_0x1fa9ac[_0x1b80('0x1e')]+'\x20'+parseOperator(_0x1fa9ac['operator']);}if(_[_0x1b80('0x16')]([_0x1b80('0x1f'),_0x1b80('0x20')],_0x1fa9ac['operator']))_0x4e3500[_0x1b80('0x1d')]='('+_0x4e3500[_0x1b80('0x1d')]+_0x1b80('0x21')+_0x4610d1+'.'+_0x1fa9ac[_0x1b80('0x1e')]+_0x1b80('0x22');_0x4e3500[_0x1b80('0x15')]=parseValue(_0x3148d7,_0x1fa9ac[_0x1b80('0x13')],_0x1fa9ac['value']);return _0x4e3500;};function parseOperator(_0x1cf7c1){var _0x5f2fb1;switch(_0x1cf7c1){case _0x1b80('0x23'):_0x5f2fb1=_0x1b80('0x24');break;case _0x1b80('0x20'):_0x5f2fb1=_0x1b80('0x25');break;case _0x1b80('0x14'):_0x5f2fb1=_0x1b80('0x26');break;case'$ne':_0x5f2fb1=_0x1b80('0x27');break;case _0x1b80('0x28'):case _0x1b80('0x29'):case _0x1b80('0x2a'):_0x5f2fb1=_0x1b80('0x2b');break;case _0x1b80('0x2c'):_0x5f2fb1=_0x1b80('0x2d');break;case _0x1b80('0x17'):_0x5f2fb1='>\x20?';break;case _0x1b80('0x18'):_0x5f2fb1=_0x1b80('0x2e');break;case _0x1b80('0x2f'):_0x5f2fb1='>=\x20?';break;case _0x1b80('0x30'):_0x5f2fb1=_0x1b80('0x31');break;}return _0x5f2fb1;}function parseValue(_0x460628,_0x31ce3b,_0x5dd842){var _0x3c8c94={'start':undefined,'end':undefined};switch(_0x31ce3b){case'$in':case _0x1b80('0x20'):_0x3c8c94[_0x1b80('0x32')]=_0x5dd842[_0x1b80('0x9')](',');break;case _0x1b80('0x28'):_0x3c8c94[_0x1b80('0x32')]='%'+_0x5dd842+'%';break;case _0x1b80('0x29'):_0x3c8c94['start']=_0x5dd842+'%';break;case _0x1b80('0x2a'):_0x3c8c94[_0x1b80('0x32')]='%'+_0x5dd842;break;case _0x1b80('0x30'):var _0x153b9f=_0x5dd842[_0x1b80('0x9')](',');var _0x5dd842=_0x153b9f[_0x1b80('0x33')]();var _0xebdcad=_0x153b9f[_0x1b80('0x34')]();if(_0x460628==='DATE'){_0x5dd842=moment(_0x5dd842)[_0x1b80('0x35')](0x0,!![])['format']();_0xebdcad=moment(_0xebdcad)[_0x1b80('0x35')](0x0,!![])[_0x1b80('0x19')](0x17,_0x1b80('0x36'))[_0x1b80('0x19')](0x3b,_0x1b80('0x37'))[_0x1b80('0x19')](0x3b,_0x1b80('0x38'))[_0x1b80('0x1b')]();}_0x3c8c94={'start':_0x5dd842,'end':_0xebdcad};break;default:_0x3c8c94['start']=_0x5dd842;break;}return _0x3c8c94;} \ No newline at end of file +var _0xb564=['split','shift','map','conditions','buildExpression','operator','$eq','$between','value','includes','$gt','add','days','format','castTo','text','CAST(','\x20AS\x20','$ne','$notIn','\x20OR\x20','field','\x20IS\x20NULL)','IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','>\x20?','$lte','<=\x20?','>=\x20?','$in','start','$substring','pop','DATE','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','length','slice','forEach'];(function(_0x2f4454,_0x5def24){var _0x45191f=function(_0x3692c6){while(--_0x3692c6){_0x2f4454['push'](_0x2f4454['shift']());}};_0x45191f(++_0x5def24);}(_0xb564,0x1ca));var _0x4b56=function(_0x3870ff,_0x1fb759){_0x3870ff=_0x3870ff-0x0;var _0x351ab2=_0xb564[_0x3870ff];return _0x351ab2;};'use strict';var _=require(_0x4b56('0x0'));var moment=require(_0x4b56('0x1'));exports[_0x4b56('0x2')]=function(_0x2cb877){var _0x390f05={'conditions':[]};_0x390f05[_0x4b56('0x3')]=_[_0x4b56('0x4')](_0x2cb877,_0x4b56('0x5'))?'or':'and';var _0x25b7a5=_0x2cb877[_0x4b56('0x6')]('[$and]','')[_0x4b56('0x6')](_0x4b56('0x5'),'')['split']('||');for(var _0xaa35a5=0x0;_0xaa35a5<_0x25b7a5[_0x4b56('0x7')];_0xaa35a5++){var _0xb4f017=_0x25b7a5[_0xaa35a5]['split'](':=');var _0x215b4f=_0xb4f017[0x0];var _0x2a0cf8=_0xb4f017[_0x4b56('0x8')](0x1);_0x2a0cf8[_0x4b56('0x9')](function(_0x247a7d){var _0x4b93de=_0x247a7d[_0x4b56('0xa')]('[')[_0x4b56('0xb')]();var _0x1fe4b6=_0x247a7d['match'](/\[(.*?)\]/g);_0x1fe4b6[_0x4b56('0x9')](function(_0x46db10){var _0x3f6357=_0x46db10[_0x4b56('0xa')]('[')['filter'](function(_0xfd0bb0){return _0xfd0bb0['indexOf'](']')>-0x1;})[_0x4b56('0xc')](function(_0x50ed0b){return _0x50ed0b['split'](']')[0x0];})[0x0];_0x390f05[_0x4b56('0xd')]['push']({'field':_0x215b4f,'operator':_0x4b93de,'value':_0x3f6357});});});}return _0x390f05;};exports[_0x4b56('0xe')]=function(_0x3c374d,_0xc0cbe7,_0x1672ee){var _0x3ba6ba={};if(_0xc0cbe7==='DATE'){if(_0x1672ee[_0x4b56('0xf')]===_0x4b56('0x10')){_0x1672ee[_0x4b56('0xf')]=_0x4b56('0x11');_0x1672ee[_0x4b56('0x12')]+=','+_0x1672ee['value'];}else if(_[_0x4b56('0x13')]([_0x4b56('0x14'),'$lte'],_0x1672ee[_0x4b56('0xf')])){_0x1672ee['value']=moment(_0x1672ee['value'])[_0x4b56('0x15')](0x1,_0x4b56('0x16'))[_0x4b56('0x17')]('YYYY-MM-DD');}}if(_0x1672ee[_0x4b56('0x18')]){_0xc0cbe7=_0x1672ee[_0x4b56('0x18')];_0x3ba6ba[_0x4b56('0x19')]=_0x4b56('0x1a')+_0x3c374d+'.'+_0x1672ee['field']+_0x4b56('0x1b')+_0x1672ee[_0x4b56('0x18')]+')\x20'+parseOperator(_0x1672ee['operator']);}else{_0x3ba6ba[_0x4b56('0x19')]=_0x3c374d+'.'+_0x1672ee['field']+'\x20'+parseOperator(_0x1672ee[_0x4b56('0xf')]);}if(_[_0x4b56('0x13')]([_0x4b56('0x1c'),_0x4b56('0x1d')],_0x1672ee[_0x4b56('0xf')]))_0x3ba6ba[_0x4b56('0x19')]='('+_0x3ba6ba[_0x4b56('0x19')]+_0x4b56('0x1e')+_0x3c374d+'.'+_0x1672ee[_0x4b56('0x1f')]+_0x4b56('0x20');_0x3ba6ba[_0x4b56('0x12')]=parseValue(_0xc0cbe7,_0x1672ee[_0x4b56('0xf')],_0x1672ee['value']);return _0x3ba6ba;};function parseOperator(_0x2ec315){var _0x27bf3c;switch(_0x2ec315){case'$in':_0x27bf3c=_0x4b56('0x21');break;case _0x4b56('0x1d'):_0x27bf3c='NOT\x20IN\x20?';break;case'$eq':_0x27bf3c=_0x4b56('0x22');break;case'$ne':_0x27bf3c=_0x4b56('0x23');break;case'$substring':case _0x4b56('0x24'):case _0x4b56('0x25'):_0x27bf3c=_0x4b56('0x26');break;case'$lt':_0x27bf3c='<\x20?';break;case'$gt':_0x27bf3c=_0x4b56('0x27');break;case _0x4b56('0x28'):_0x27bf3c=_0x4b56('0x29');break;case'$gte':_0x27bf3c=_0x4b56('0x2a');break;case _0x4b56('0x11'):_0x27bf3c='BETWEEN\x20?\x20AND\x20?';break;}return _0x27bf3c;}function parseValue(_0x41272d,_0x3af094,_0x6f3503){var _0x291190={'start':undefined,'end':undefined};switch(_0x3af094){case _0x4b56('0x2b'):case'$notIn':_0x291190[_0x4b56('0x2c')]=_0x6f3503[_0x4b56('0xa')](',');break;case _0x4b56('0x2d'):_0x291190[_0x4b56('0x2c')]='%'+_0x6f3503+'%';break;case _0x4b56('0x24'):_0x291190['start']=_0x6f3503+'%';break;case _0x4b56('0x25'):_0x291190['start']='%'+_0x6f3503;break;case _0x4b56('0x11'):var _0x330cd7=_0x6f3503['split'](',');var _0x6f3503=_0x330cd7[_0x4b56('0xb')]();var _0x5d9b59=_0x330cd7[_0x4b56('0x2e')]();if(_0x41272d===_0x4b56('0x2f')){_0x6f3503=moment(_0x6f3503)[_0x4b56('0x30')](0x0,!![])[_0x4b56('0x17')]();_0x5d9b59=moment(_0x5d9b59)['utcOffset'](0x0,!![])[_0x4b56('0x15')](0x17,_0x4b56('0x31'))[_0x4b56('0x15')](0x3b,_0x4b56('0x32'))[_0x4b56('0x15')](0x3b,_0x4b56('0x33'))['format']();}_0x291190={'start':_0x6f3503,'end':_0x5d9b59};break;default:_0x291190['start']=_0x6f3503;break;}return _0x291190;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index eaad53f..cb594c7 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 _0x24ca=['omit','isEmpty','isObject','isString','hasOwnProperty','isNumeric','match','getFullTextValue','forEach','replace','push','join','query','$id','intersection','model','attributes','length','order','sort','where','filters','filter','object','value','merge','VIRTUAL','lower','lodash','parse','includes','keys','fields','split','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','limit','offset','map','indexOf','priority','cast','col','unsigned','substr','ASC'];(function(_0x347e05,_0x52d75f){var _0xdbbf97=function(_0x59ab46){while(--_0x59ab46){_0x347e05['push'](_0x347e05['shift']());}};_0xdbbf97(++_0x52d75f);}(_0x24ca,0x8c));var _0xa24c=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x24ca[_0xd09668];return _0x68726;};'use strict';var _=require(_0xa24c('0x0'));var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1f4ee1){var _0x4e90b0=['ne'];try{var _0x155c49=JSON[_0xa24c('0x1')](_0x1f4ee1);var _0xe69cdd=Object['keys'](_0x155c49)[0x0];return _0x4e90b0[_0xa24c('0x2')](_0xe69cdd);}catch(_0x89148d){return![];}}function getOperatorValue(_0x4707f9){var _0x5a37ae=JSON['parse'](_0x4707f9);var _0x52147a=Object[_0xa24c('0x3')](_0x5a37ae)[0x0];var _0x3c10d9=_0x5a37ae[_0x52147a];return{['$'+_0x52147a]:_0x3c10d9};}exports[_0xa24c('0x4')]=function(_0x3c3959){var _0x34288c=null;if(_0x3c3959){_0x34288c=_0x3c3959[_0xa24c('0x5')](',');}return _0x34288c;};exports['filters']=function(_0x101ca7,_0x413b3d){var _0x355882={};if(!_['isEmpty'](_0x101ca7)){_['forOwn'](_0x101ca7,function(_0x1331f4,_0x73a132){try{if(_0x413b3d){var _0x2da0c3=_[_0xa24c('0x6')](_0x413b3d,{'name':_0x73a132})||{};if(hasSequelizeOperator(_0x1331f4)){_0x355882[_0x73a132]=getOperatorValue(_0x1331f4);}else if(_0x2da0c3[_0xa24c('0x7')]===_0xa24c('0x8')&&_['isPlainObject'](_0x1331f4)){var _0x5bb631=JSON['parse'](_0x1331f4);var _0x2444b7={'$gte':moment(moment(_0x5bb631[_0xa24c('0x9')])[_0xa24c('0xa')](_0xa24c('0xb')))[_0xa24c('0xc')]()['format'](),'$lte':moment(moment(_0x5bb631[_0xa24c('0xd')])['format']('YYYY-MM-DD'))['utc']()[_0xa24c('0xe')](0x1,'s')[_0xa24c('0xa')]()};_0x355882[_0x73a132]=_0x2444b7;}else if(_0x2da0c3[_0xa24c('0xf')]===_0xa24c('0x10')){_0x355882[_0x73a132]=_0x1331f4;}else{_0x355882[_0x73a132]=_[_0xa24c('0x11')](_0x1331f4)?_0x1331f4:JSON[_0xa24c('0x1')](_0x1331f4);}}else{_0x355882[_0x73a132]=_[_0xa24c('0x11')](_0x1331f4)?_0x1331f4:JSON[_0xa24c('0x1')](_0x1331f4);}}catch(_0x14f0aa){_0x355882[_0x73a132]=_0x1331f4[_0xa24c('0x5')](',');}});}return _0x355882;};exports[_0xa24c('0x12')]=function(_0x1a667b){_0x1a667b=parseInt(_0x1a667b,0xa);if(!_0x1a667b||_0x1a667b<0x0){_0x1a667b=LIMIT_VALUE;}return _0x1a667b;};exports[_0xa24c('0x13')]=function(_0x3e4e81){_0x3e4e81=parseInt(_0x3e4e81,0xa);if(!_0x3e4e81||_0x3e4e81<0x0){_0x3e4e81=0x0;}return _0x3e4e81;};exports['sort']=function(_0x167a76){var _0x48fb65,_0x98802d=null;if(_0x167a76){_0x48fb65=_0x167a76[_0xa24c('0x5')](',');_0x98802d=_[_0xa24c('0x14')](_0x48fb65,function(_0x37e20e){if(_0x37e20e[_0xa24c('0x15')]('-')===0x0){return[_0x37e20e===_0xa24c('0x16')?sequelize[_0xa24c('0x17')](sequelize[_0xa24c('0x18')](_0xa24c('0x16')),_0xa24c('0x19')):_0x37e20e[_0xa24c('0x1a')](0x1),'DESC'];}else{return[_0x37e20e==='priority'?sequelize[_0xa24c('0x17')](sequelize[_0xa24c('0x18')](_0xa24c('0x16')),_0xa24c('0x19')):_0x37e20e,_0xa24c('0x1b')];}});}return _0x98802d;};exports[_0xa24c('0x1c')]=function(_0x16bd20,_0x3106ff){if(_[_0xa24c('0x1d')](_0x16bd20)){return _0x16bd20;}if(_['isArray'](_0x16bd20)){for(var _0x2290e1=0x0;_0x2290e1<_0x16bd20['length'];_0x2290e1+=0x1){_0x16bd20[_0x2290e1]=this[_0xa24c('0x1c')](_0x16bd20[_0x2290e1],_0x3106ff);}return _0x16bd20;}if(!_[_0xa24c('0x1e')](_0x16bd20)){return _0x16bd20;}if(_[_0xa24c('0x1f')](_0x3106ff)){_0x3106ff=[_0x3106ff];}if(!_[_0xa24c('0x11')](_0x3106ff)){return _0x16bd20;}for(var _0x54b8a6=0x0;_0x54b8a6<_0x3106ff['length'];_0x54b8a6+=0x1){_['unset'](_0x16bd20,_0x3106ff[_0x54b8a6]);}for(var _0x4e5d2c in _0x16bd20){if(_0x16bd20[_0xa24c('0x20')](_0x4e5d2c)){_0x16bd20[_0x4e5d2c]=this[_0xa24c('0x1c')](_0x16bd20[_0x4e5d2c],_0x3106ff);}}return _0x16bd20;};exports[_0xa24c('0x21')]=function(_0x1cdee4){return _0x1cdee4[_0xa24c('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x33c208){return _0x33c208[_0xa24c('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0xa24c('0x23')]=function(_0x1d500e){var _0x4566dc=[];_0x1d500e[_0xa24c('0x5')](/[ ,]+/)[_0xa24c('0x24')](function(_0x1e30a9){_0x1e30a9=_0x1e30a9[_0xa24c('0x25')](/([^:]")"+/g,'$1');_0x1e30a9='+'+_0x1e30a9+'*';var _0x17a001=/[ `!@#$%^&*()_\-?~]/;if(_0x1e30a9['match'](_0x17a001))_0x1e30a9='\x22'+_0x1e30a9+'\x22';_0x4566dc[_0xa24c('0x26')](_0x1e30a9);});return _0x4566dc[_0xa24c('0x27')]('\x20');};exports['getOptions']=function(_0x3c9649,_0x3e8b0f,_0x33f0c9){var _0x1de2ef={},_0x26f2fe={};if(_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x29')]){_0x3e8b0f[_0xa24c('0x28')]['id']=_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x29')];delete _0x3e8b0f['query']['$id'];}_0x1de2ef['model']=_[_0xa24c('0x14')](_0x3c9649,'name');_0x1de2ef[_0xa24c('0x28')]=_[_0xa24c('0x3')](_0x3e8b0f[_0xa24c('0x28')]);_0x1de2ef['filters']=_[_0xa24c('0x2a')](_0x1de2ef[_0xa24c('0x2b')],_0x1de2ef[_0xa24c('0x28')]);_0x26f2fe['attributes']=_[_0xa24c('0x2a')](_0x1de2ef[_0xa24c('0x2b')],this['fields'](_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x4')]));_0x26f2fe[_0xa24c('0x2c')]=_0x26f2fe['attributes'][_0xa24c('0x2d')]?_0x26f2fe[_0xa24c('0x2c')]:_0x1de2ef[_0xa24c('0x2b')];if(!_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x20')]('nolimit')){_0x26f2fe[_0xa24c('0x12')]=this[_0xa24c('0x12')](_0x3e8b0f['query'][_0xa24c('0x12')]);_0x26f2fe[_0xa24c('0x13')]=this[_0xa24c('0x13')](_0x3e8b0f['query']['offset']);}_0x26f2fe[_0xa24c('0x2e')]=this[_0xa24c('0x2f')](_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x2f')]);_0x26f2fe[_0xa24c('0x30')]=this[_0xa24c('0x31')](_['pick'](_0x3e8b0f[_0xa24c('0x28')],_0x1de2ef[_0xa24c('0x31')]),_0x3c9649);if(_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x32')]){var _0x5f3cd4=_0x3c9649;var _0x34026c=_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x32')];if(typeof _0x34026c===_0xa24c('0x33')){_0x5f3cd4=_[_0xa24c('0x32')](_0x3c9649,function(_0x7d16aa){return _[_0xa24c('0x2')](_0x34026c['columns'],_0x7d16aa['name']);});_0x34026c=_0x34026c[_0xa24c('0x34')];}_0x26f2fe['where']=_[_0xa24c('0x35')](_0x26f2fe['where'],{'$or':_[_0xa24c('0x14')](_0x5f3cd4,function(_0x214627){if(_0x214627[_0xa24c('0x7')]!==_0xa24c('0x36')){if(_0x33f0c9){return sequelize[_0xa24c('0x30')](sequelize['fn'](_0xa24c('0x37'),sequelize[_0xa24c('0x18')](_0x214627[_0xa24c('0xf')])),{'$like':sequelize['fn'](_0xa24c('0x37'),'%'+_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x32')]+'%')});}else{var _0x1f87b7={};_0x1f87b7[_0x214627[_0xa24c('0xf')]]={'$like':'%'+_0x3e8b0f[_0xa24c('0x28')][_0xa24c('0x32')]+'%'};return _0x1f87b7;}}})});}_0x26f2fe=_[_0xa24c('0x35')]({},_0x26f2fe,_0x3e8b0f['options']);return _0x26f2fe;}; \ No newline at end of file +var _0x6b8f=['isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','push','getOptions','query','$id','model','intersection','attributes','fields','nolimit','limit','where','pick','filter','columns','value','merge','VIRTUAL','lower','options','sequelize','parse','includes','keys','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','subtract','name','uniqueid','isArray','split','offset','sort','map','indexOf','cast','col','priority','unsigned','DESC','ASC','omit','length','isObject','isString','unset','hasOwnProperty'];(function(_0x5434c2,_0x26929c){var _0x253006=function(_0x29ed52){while(--_0x29ed52){_0x5434c2['push'](_0x5434c2['shift']());}};_0x253006(++_0x26929c);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x47a489,_0x22180b){_0x47a489=_0x47a489-0x0;var _0x135495=_0x6b8f[_0x47a489];return _0x135495;};'use strict';var _=require('lodash');var sequelize=require(_0xf6b8('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x311ae7){var _0x4e006e=['ne'];try{var _0x5443a1=JSON[_0xf6b8('0x1')](_0x311ae7);var _0x15de3a=Object['keys'](_0x5443a1)[0x0];return _0x4e006e[_0xf6b8('0x2')](_0x15de3a);}catch(_0xf25536){return![];}}function getOperatorValue(_0x347a0b){var _0x549eac=JSON[_0xf6b8('0x1')](_0x347a0b);var _0x79c66d=Object[_0xf6b8('0x3')](_0x549eac)[0x0];var _0x3c3430=_0x549eac[_0x79c66d];return{['$'+_0x79c66d]:_0x3c3430};}exports['fields']=function(_0x5f07f4){var _0x33e9a0=null;if(_0x5f07f4){_0x33e9a0=_0x5f07f4['split'](',');}return _0x33e9a0;};exports[_0xf6b8('0x4')]=function(_0x7ac5fd,_0x16a799){var _0x3e6712={};if(!_[_0xf6b8('0x5')](_0x7ac5fd)){_[_0xf6b8('0x6')](_0x7ac5fd,function(_0x55dad4,_0x481679){try{if(_0x16a799){var _0x5ae09d=_[_0xf6b8('0x7')](_0x16a799,{'name':_0x481679})||{};if(hasSequelizeOperator(_0x55dad4)){_0x3e6712[_0x481679]=getOperatorValue(_0x55dad4);}else if(_0x5ae09d[_0xf6b8('0x8')]===_0xf6b8('0x9')&&_[_0xf6b8('0xa')](_0x55dad4)){var _0x5a6118=JSON['parse'](_0x55dad4);var _0x748e77={'$gte':moment(moment(_0x5a6118[_0xf6b8('0xb')])['format'](_0xf6b8('0xc')))[_0xf6b8('0xd')]()[_0xf6b8('0xe')](),'$lte':moment(moment(_0x5a6118['$lte'])[_0xf6b8('0xe')]('YYYY-MM-DD'))[_0xf6b8('0xd')]()[_0xf6b8('0xf')](0x1,'s')[_0xf6b8('0xe')]()};_0x3e6712[_0x481679]=_0x748e77;}else if(_0x5ae09d[_0xf6b8('0x10')]===_0xf6b8('0x11')){_0x3e6712[_0x481679]=_0x55dad4;}else{_0x3e6712[_0x481679]=_['isArray'](_0x55dad4)?_0x55dad4:JSON['parse'](_0x55dad4);}}else{_0x3e6712[_0x481679]=_[_0xf6b8('0x12')](_0x55dad4)?_0x55dad4:JSON['parse'](_0x55dad4);}}catch(_0x3cf63c){_0x3e6712[_0x481679]=_0x55dad4[_0xf6b8('0x13')](',');}});}return _0x3e6712;};exports['limit']=function(_0x58cd71){_0x58cd71=parseInt(_0x58cd71,0xa);if(!_0x58cd71||_0x58cd71<0x0){_0x58cd71=LIMIT_VALUE;}return _0x58cd71;};exports[_0xf6b8('0x14')]=function(_0x2e2b29){_0x2e2b29=parseInt(_0x2e2b29,0xa);if(!_0x2e2b29||_0x2e2b29<0x0){_0x2e2b29=0x0;}return _0x2e2b29;};exports[_0xf6b8('0x15')]=function(_0x2cac60){var _0x4df5f4,_0x59f9df=null;if(_0x2cac60){_0x4df5f4=_0x2cac60['split'](',');_0x59f9df=_[_0xf6b8('0x16')](_0x4df5f4,function(_0x2a8195){if(_0x2a8195[_0xf6b8('0x17')]('-')===0x0){return[_0x2a8195==='priority'?sequelize[_0xf6b8('0x18')](sequelize[_0xf6b8('0x19')](_0xf6b8('0x1a')),_0xf6b8('0x1b')):_0x2a8195['substr'](0x1),_0xf6b8('0x1c')];}else{return[_0x2a8195==='priority'?sequelize[_0xf6b8('0x18')](sequelize[_0xf6b8('0x19')](_0xf6b8('0x1a')),_0xf6b8('0x1b')):_0x2a8195,_0xf6b8('0x1d')];}});}return _0x59f9df;};exports[_0xf6b8('0x1e')]=function(_0x4edd29,_0x1aca8a){if(_[_0xf6b8('0x5')](_0x4edd29)){return _0x4edd29;}if(_['isArray'](_0x4edd29)){for(var _0x205d6c=0x0;_0x205d6c<_0x4edd29[_0xf6b8('0x1f')];_0x205d6c+=0x1){_0x4edd29[_0x205d6c]=this[_0xf6b8('0x1e')](_0x4edd29[_0x205d6c],_0x1aca8a);}return _0x4edd29;}if(!_[_0xf6b8('0x20')](_0x4edd29)){return _0x4edd29;}if(_[_0xf6b8('0x21')](_0x1aca8a)){_0x1aca8a=[_0x1aca8a];}if(!_['isArray'](_0x1aca8a)){return _0x4edd29;}for(var _0x5e5b1c=0x0;_0x5e5b1c<_0x1aca8a[_0xf6b8('0x1f')];_0x5e5b1c+=0x1){_[_0xf6b8('0x22')](_0x4edd29,_0x1aca8a[_0x5e5b1c]);}for(var _0x5a9514 in _0x4edd29){if(_0x4edd29[_0xf6b8('0x23')](_0x5a9514)){_0x4edd29[_0x5a9514]=this[_0xf6b8('0x1e')](_0x4edd29[_0x5a9514],_0x1aca8a);}}return _0x4edd29;};exports[_0xf6b8('0x24')]=function(_0x5a7f55){return _0x5a7f55[_0xf6b8('0x25')](RegExp(_0xf6b8('0x26')))?!![]:![];};exports['isEmail']=function(_0x309f04){return _0x309f04[_0xf6b8('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xf6b8('0x27')]=function(_0x223ee7){var _0x51ffcf=[];_0x223ee7[_0xf6b8('0x13')](/[ ,]+/)[_0xf6b8('0x28')](function(_0x4006a6){_0x4006a6=_0x4006a6['replace'](/([^:]")"+/g,'$1');_0x4006a6='+'+_0x4006a6+'*';var _0x7c7546=/[ `!@#$%^&*()_\-?~]/;if(_0x4006a6[_0xf6b8('0x25')](_0x7c7546))_0x4006a6='\x22'+_0x4006a6+'\x22';_0x51ffcf[_0xf6b8('0x29')](_0x4006a6);});return _0x51ffcf['join']('\x20');};exports[_0xf6b8('0x2a')]=function(_0x11b040,_0x20ca5e,_0x108a9d){var _0x4be3cb={},_0x1cb84d={};if(_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x2c')]){_0x20ca5e['query']['id']=_0x20ca5e['query'][_0xf6b8('0x2c')];delete _0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x2c')];}_0x4be3cb[_0xf6b8('0x2d')]=_[_0xf6b8('0x16')](_0x11b040,_0xf6b8('0x10'));_0x4be3cb[_0xf6b8('0x2b')]=_[_0xf6b8('0x3')](_0x20ca5e[_0xf6b8('0x2b')]);_0x4be3cb[_0xf6b8('0x4')]=_[_0xf6b8('0x2e')](_0x4be3cb[_0xf6b8('0x2d')],_0x4be3cb[_0xf6b8('0x2b')]);_0x1cb84d[_0xf6b8('0x2f')]=_[_0xf6b8('0x2e')](_0x4be3cb[_0xf6b8('0x2d')],this[_0xf6b8('0x30')](_0x20ca5e[_0xf6b8('0x2b')]['fields']));_0x1cb84d['attributes']=_0x1cb84d[_0xf6b8('0x2f')][_0xf6b8('0x1f')]?_0x1cb84d[_0xf6b8('0x2f')]:_0x4be3cb[_0xf6b8('0x2d')];if(!_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x23')](_0xf6b8('0x31'))){_0x1cb84d[_0xf6b8('0x32')]=this[_0xf6b8('0x32')](_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x32')]);_0x1cb84d[_0xf6b8('0x14')]=this['offset'](_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x14')]);}_0x1cb84d['order']=this[_0xf6b8('0x15')](_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x15')]);_0x1cb84d[_0xf6b8('0x33')]=this[_0xf6b8('0x4')](_[_0xf6b8('0x34')](_0x20ca5e[_0xf6b8('0x2b')],_0x4be3cb[_0xf6b8('0x4')]),_0x11b040);if(_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x35')]){var _0x15a63b=_0x11b040;var _0x3b0554=_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x35')];if(typeof _0x3b0554==='object'){_0x15a63b=_['filter'](_0x11b040,function(_0x5f42c2){return _[_0xf6b8('0x2')](_0x3b0554[_0xf6b8('0x36')],_0x5f42c2[_0xf6b8('0x10')]);});_0x3b0554=_0x3b0554[_0xf6b8('0x37')];}_0x1cb84d[_0xf6b8('0x33')]=_[_0xf6b8('0x38')](_0x1cb84d[_0xf6b8('0x33')],{'$or':_['map'](_0x15a63b,function(_0x1f5e72){if(_0x1f5e72['type']!==_0xf6b8('0x39')){if(_0x108a9d){return sequelize[_0xf6b8('0x33')](sequelize['fn'](_0xf6b8('0x3a'),sequelize[_0xf6b8('0x19')](_0x1f5e72[_0xf6b8('0x10')])),{'$like':sequelize['fn']('lower','%'+_0x20ca5e[_0xf6b8('0x2b')][_0xf6b8('0x35')]+'%')});}else{var _0x126850={};_0x126850[_0x1f5e72[_0xf6b8('0x10')]]={'$like':'%'+_0x20ca5e[_0xf6b8('0x2b')]['filter']+'%'};return _0x126850;}}})});}_0x1cb84d=_[_0xf6b8('0x38')]({},_0x1cb84d,_0x20ca5e[_0xf6b8('0x3b')]);return _0x1cb84d;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index a61e879..514ec39 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 _0x986e=['lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','mailStatus','smsStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','pick','filterAgentAttributes','lodash','../../mysqldb','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','chatStatus','faxStatus','openchannelStatus','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','error','merge','getRealtimeAgents','pause','*pause','busy','getAgentStatus','isArray','startCase','map','findOne','getAgents','all','flatten','value','getAgentIdsByStatus','includes','User','findAll','fullname','pauseType','globalStatus','catch','getSortedAgentsIdsByStatus','fields','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt'];(function(_0x3276cd,_0x5b4eb5){var _0x3da820=function(_0x195461){while(--_0x195461){_0x3276cd['push'](_0x3276cd['shift']());}};_0x3da820(++_0x5b4eb5);}(_0x986e,0xc8));var _0xe986=function(_0x38a13a,_0x2b0ac0){_0x38a13a=_0x38a13a-0x0;var _0x37f0d6=_0x986e[_0x38a13a];return _0x37f0d6;};'use strict';var _=require(_0xe986('0x0'));var jayson=require('jayson/promise');var db=require(_0xe986('0x1'))['db'];var amiClient=jayson['client'][_0xe986('0x2')]({'port':0x232a});var routingClient=jayson['client'][_0xe986('0x2')]({'port':0x232c});function isAgentPaused(_0x1fd926,_0x17037c){var _0x4b3248=[_0x1fd926[_0xe986('0x3')],_0x1fd926[_0xe986('0x4')],_0x1fd926[_0xe986('0x5')],_0x1fd926[_0xe986('0x6')],_0x1fd926[_0xe986('0x7')],_0x1fd926[_0xe986('0x8')],_0x1fd926[_0xe986('0x9')]];if(!_0x17037c)return _[_0xe986('0xa')](_0x4b3248);var _0x3df9d=_[_0xe986('0xb')](_0x4b3248);return _0x3df9d['length']>0x0&&_0x3df9d[_0xe986('0xc')]<_0x4b3248[_0xe986('0xc')]?!![]:![];}function isIdle(_0x6b38b8){return _0x6b38b8===_0xe986('0xd')||_0x6b38b8===_0xe986('0xe')||_0x6b38b8===_0xe986('0xf')||_0x6b38b8===_0xe986('0x10')||_[_0xe986('0x11')](_0x6b38b8);}function isAgentIdle(_0x370d3d){if(_0x370d3d[_0xe986('0x12')]!=='idle'&&_0x370d3d['voicePause']){_0x370d3d['voiceStatus']='pause';return![];}return _[_0xe986('0xa')]([_0x370d3d[_0xe986('0x13')],_0x370d3d[_0xe986('0x14')],_0x370d3d['mailStatus'],_0x370d3d[_0xe986('0x15')],_0x370d3d['smsStatus'],_0x370d3d[_0xe986('0x12')],_0x370d3d['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xe986('0x16')]('Agents',{})[_0xe986('0x17')](function(_0x1c34ec){if(_0x1c34ec['error']){throw new Error(_0xe986('0x18'));}var _0x25fb5d=_0x1c34ec['result'];return routingClient[_0xe986('0x16')]('Agents',{})[_0xe986('0x17')](function(_0x5e89d3){if(_0x5e89d3[_0xe986('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x1a8100=_0x5e89d3['result'];return _[_0xe986('0x1a')]({},_0x25fb5d,_0x1a8100);});})['catch'](function(_0x7aa7a5){throw _0x7aa7a5;});}exports[_0xe986('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x3b0985){var _0x18be9e=_0xe986('0xe');if(isAgentPaused(_0x3b0985))_0x18be9e=_0xe986('0x1c');else if(isAgentPaused(_0x3b0985,!![]))_0x18be9e=_0xe986('0x1d');else if(isAgentIdle(_0x3b0985))_0x18be9e=_0xe986('0xd');else _0x18be9e=_0xe986('0x1e');return _0x18be9e;}exports[_0xe986('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x5dbb78,_0x17ce11){var _0x4b7695=_[_0xe986('0x20')](_0x5dbb78)?_0x5dbb78:[_0x5dbb78];var _0x3d94ba=_[_0xe986('0x21')](_0x17ce11)+'Queue';var _0x1d44f8=_[_0xe986('0x22')](_0x4b7695,function(_0x214c3b){return db[_0x3d94ba][_0xe986('0x23')]({'where':{'id':_0x214c3b}})[_0xe986('0x17')](function(_0x5710bc){if(!_0x5710bc)return[];return _0x5710bc[_0xe986('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xe986('0x25')](_0x1d44f8)[_0xe986('0x17')](function(_0x8aae9e){var _0x3821db=_(_0x8aae9e)[_0xe986('0x26')]()[_0xe986('0x22')]('id')['uniq']()[_0xe986('0x27')]();return _0x3821db;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x315c89,_0x3d07f5,_0x54382a){try{if(_0x3d07f5[_0xe986('0xc')]>0x0){_0x315c89=_0x315c89['filter'](function(_0x1d74ac){return _0x3d07f5['includes'](_0x1d74ac['id']);});}var _0x44cd19=_0x315c89[_0xe986('0xb')](function(_0x30f6bc){var _0x13d2ac=_0xe986('0x1e');if(isAgentIdle(_0x30f6bc)){_0x13d2ac=_0xe986('0xd');}return _0x13d2ac===_0x54382a;});return _[_0xe986('0x22')](_0x44cd19,'id');}catch(_0x1ca9b5){throw _0x1ca9b5;}}exports[_0xe986('0x28')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3f15ff,_0x9a5f49,_0x119b77){return Promise['resolve']()[_0xe986('0x17')](function(){if(_0x9a5f49['length']>0x0){_0x3f15ff=_0x3f15ff[_0xe986('0xb')](function(_0x74cdc1){return _0x9a5f49[_0xe986('0x29')](_0x74cdc1['id']);});}return _0x3f15ff;})['then'](function(){return db[_0xe986('0x2a')][_0xe986('0x2b')]({'attributes':['id','name',_0xe986('0x2c'),_0xe986('0x3'),_0xe986('0x4'),_0xe986('0x5'),'openchannelPause',_0xe986('0x7'),_0xe986('0x8'),_0xe986('0x9'),_0xe986('0x2d')],'where':{'id':{'$in':_[_0xe986('0x22')](_0x3f15ff,'id')}},'raw':!![]});})[_0xe986('0x17')](function(_0x214307){return _0x214307['map'](function(_0x1483fc){var _0x563c32=_['find'](_0x3f15ff,['id',_0x1483fc['id']]);var _0x2b644f=filterAgentAttributes(_0x563c32);_[_0xe986('0x1a')](_0x1483fc,_0x2b644f);_0x1483fc[_0xe986('0x2e')]=getAgentStatus(_0x1483fc);return _0x1483fc;});})[_0xe986('0x17')](function(_0x37d4e9){var _0x21c4ce=sortAgentsByStatus(_0x37d4e9,_0x119b77);return _['map'](_0x21c4ce,'id');})[_0xe986('0x2f')](function(_0x4e6516){throw _0x4e6516;});}exports[_0xe986('0x30')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x20aa84){var _0x3ac503={'fields':[],'order':null};var _0x5d2abe=_0x20aa84['split'](',');_0x3ac503[_0xe986('0x31')]=_['filter'](_0x5d2abe,function(_0x130a30){if(!_0x130a30['includes'](_0xe986('0x2e'))){return!![];}_0x3ac503['order']=_['startsWith'](_0x130a30,'-')?_0xe986('0x32'):_0xe986('0x33');return![];});return _0x3ac503;}exports[_0xe986('0x34')]=getUpdatedSortOptions;function validateSortParameter(_0xd29676){if(_0xd29676[_0xe986('0x29')]('fullname')&&!_0xd29676[_0xe986('0x29')](_0xe986('0x35'))){var _0x1c4b88=_0xd29676[_0xe986('0x36')](0x0,_0xd29676[_0xe986('0x37')]('fullname'));_0xd29676+=','+_0x1c4b88+_0xe986('0x35');}return _0xd29676;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x4db76f,_0x29c533){var _0x2ebd3d=_0x4db76f['sort'](function(_0x405d61,_0x211243){if(_0x405d61[_0xe986('0x2e')]===_0x211243['globalStatus']){if(_0x405d61[_0xe986('0x2e')]===_0xe986('0x1c')){if(_0x29c533===_0xe986('0x32')){return(_0x405d61[_0xe986('0x2d')]||'')<(_0x211243['pauseType']||'')||_0x405d61[_0xe986('0x2c')][_0xe986('0x38')]()>_0x211243['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x405d61[_0xe986('0x2d')]||'')<(_0x211243[_0xe986('0x2d')]||'')||_0x405d61[_0xe986('0x2c')][_0xe986('0x38')]()>_0x211243[_0xe986('0x2c')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x29c533===_0xe986('0x32')){return _0x405d61[_0xe986('0x2c')][_0xe986('0x38')]()<_0x211243[_0xe986('0x2c')][_0xe986('0x38')]()?0x1:-0x1;}else{return _0x405d61[_0xe986('0x2c')][_0xe986('0x38')]()<_0x211243[_0xe986('0x2c')][_0xe986('0x38')]()?-0x1:0x1;}}}else{if(_0x29c533===_0xe986('0x32')){return _0x405d61[_0xe986('0x2e')]<_0x211243[_0xe986('0x2e')]?0x1:-0x1;}else{return _0x405d61[_0xe986('0x2e')]<_0x211243[_0xe986('0x2e')]?-0x1:0x1;}}});return _0x2ebd3d;}exports[_0xe986('0x39')]=sortAgentsByStatus;function filterAgentAttributes(_0x3d0d44){var _0x4027a9=[_0xe986('0x3a'),_0xe986('0x3b'),_0xe986('0x3c'),_0xe986('0x3d'),_0xe986('0x2d'),_0xe986('0x3d'),_0xe986('0x35'),_0xe986('0x3e'),'chatPause',_0xe986('0x6'),_0xe986('0x5'),_0xe986('0x7'),_0xe986('0x9'),_0xe986('0x4'),'voicePause',_0xe986('0x3f'),_0xe986('0x40'),_0xe986('0x41'),_0xe986('0x42'),_0xe986('0x43'),'faxCapacity','chatCurrentCapacity',_0xe986('0x44'),_0xe986('0x45'),'smsCurrentCapacity',_0xe986('0x46'),'faxCurrentCapacity',_0xe986('0x13'),_0xe986('0x15'),_0xe986('0x47'),_0xe986('0x48'),_0xe986('0x49'),_0xe986('0x14'),_0xe986('0x12'),_0xe986('0x4a'),_0xe986('0x4b'),'mailStatusTime',_0xe986('0x4c'),'whatsappStatusTime',_0xe986('0x4d'),_0xe986('0x4e'),_0xe986('0x4f'),_0xe986('0x50'),_0xe986('0x51'),_0xe986('0x52'),_0xe986('0x53'),_0xe986('0x54')];var _0x4af3c4=['chatPause',_0xe986('0x6'),_0xe986('0x5'),_0xe986('0x7'),_0xe986('0x9'),_0xe986('0x4'),_0xe986('0x8'),_0xe986('0x3b')];var _0x2227e0=_(_0x3d0d44)['omit'](_0x4af3c4)[_0xe986('0x55')](_0x4027a9)[_0xe986('0x27')]();return _0x2227e0;}exports[_0xe986('0x56')]=filterAgentAttributes; \ No newline at end of file +var _0x847e=['internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','online','omit','pick','lodash','../../mysqldb','http','client','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','openchannelStatus','smsStatus','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','getAgentIdsByQueues','includes','resolve','findAll','name','fullname','mailPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','getUpdatedSortOptions'];(function(_0x114448,_0x2be1ad){var _0x14c7d4=function(_0x203064){while(--_0x203064){_0x114448['push'](_0x114448['shift']());}};_0x14c7d4(++_0x2be1ad);}(_0x847e,0x85));var _0xe847=function(_0x108849,_0x357156){_0x108849=_0x108849-0x0;var _0x1b0438=_0x847e[_0x108849];return _0x1b0438;};'use strict';var _=require(_0xe847('0x0'));var jayson=require('jayson/promise');var db=require(_0xe847('0x1'))['db'];var amiClient=jayson['client'][_0xe847('0x2')]({'port':0x232a});var routingClient=jayson[_0xe847('0x3')][_0xe847('0x2')]({'port':0x232c});function isAgentPaused(_0x8684df,_0x55e904){var _0x28426c=[_0x8684df[_0xe847('0x4')],_0x8684df[_0xe847('0x5')],_0x8684df['mailPause'],_0x8684df[_0xe847('0x6')],_0x8684df[_0xe847('0x7')],_0x8684df[_0xe847('0x8')],_0x8684df[_0xe847('0x9')]];if(!_0x55e904)return _[_0xe847('0xa')](_0x28426c);var _0x3128d1=_[_0xe847('0xb')](_0x28426c);return _0x3128d1[_0xe847('0xc')]>0x0&&_0x3128d1[_0xe847('0xc')]<_0x28426c[_0xe847('0xc')]?!![]:![];}function isIdle(_0x5bb52c){return _0x5bb52c===_0xe847('0xd')||_0x5bb52c===_0xe847('0xe')||_0x5bb52c===_0xe847('0xf')||_0x5bb52c==='ringing'||_[_0xe847('0x10')](_0x5bb52c);}function isAgentIdle(_0x1a2c9d){if(_0x1a2c9d[_0xe847('0x11')]!==_0xe847('0xd')&&_0x1a2c9d[_0xe847('0x8')]){_0x1a2c9d[_0xe847('0x11')]=_0xe847('0x12');return![];}return _[_0xe847('0xa')]([_0x1a2c9d['chatStatus'],_0x1a2c9d['faxStatus'],_0x1a2c9d['mailStatus'],_0x1a2c9d[_0xe847('0x13')],_0x1a2c9d[_0xe847('0x14')],_0x1a2c9d[_0xe847('0x11')],_0x1a2c9d['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xe847('0x15'),{})['then'](function(_0x4c1a53){if(_0x4c1a53[_0xe847('0x16')]){throw new Error(_0xe847('0x17'));}var _0x19ba63=_0x4c1a53['result'];return routingClient[_0xe847('0x18')](_0xe847('0x15'),{})[_0xe847('0x19')](function(_0x57d7a5){if(_0x57d7a5[_0xe847('0x16')]){throw new Error(_0xe847('0x1a'));}var _0x56d27c=_0x57d7a5[_0xe847('0x1b')];return _[_0xe847('0x1c')]({},_0x19ba63,_0x56d27c);});})[_0xe847('0x1d')](function(_0x4b0b4a){throw _0x4b0b4a;});}exports[_0xe847('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x593a4d){var _0x3b0c1c='unknown';if(isAgentPaused(_0x593a4d))_0x3b0c1c=_0xe847('0x12');else if(isAgentPaused(_0x593a4d,!![]))_0x3b0c1c=_0xe847('0x1f');else if(isAgentIdle(_0x593a4d))_0x3b0c1c='idle';else _0x3b0c1c=_0xe847('0x20');return _0x3b0c1c;}exports[_0xe847('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x2c7ac2,_0x56534f){var _0x46017d=_[_0xe847('0x22')](_0x2c7ac2)?_0x2c7ac2:[_0x2c7ac2];var _0x291c1b=_[_0xe847('0x23')](_0x56534f)+_0xe847('0x24');var _0x27cc33=_[_0xe847('0x25')](_0x46017d,function(_0x1c2efa){return db[_0x291c1b][_0xe847('0x26')]({'where':{'id':_0x1c2efa}})[_0xe847('0x19')](function(_0x182de8){if(!_0x182de8)return[];return _0x182de8[_0xe847('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xe847('0x28')](_0x27cc33)[_0xe847('0x19')](function(_0x192612){var _0x41b658=_(_0x192612)[_0xe847('0x29')]()[_0xe847('0x25')]('id')[_0xe847('0x2a')]()['value']();return _0x41b658;});}exports[_0xe847('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x329c4c,_0x1cd851,_0x15cc1a){try{if(_0x1cd851[_0xe847('0xc')]>0x0){_0x329c4c=_0x329c4c[_0xe847('0xb')](function(_0x44d6c5){return _0x1cd851[_0xe847('0x2c')](_0x44d6c5['id']);});}var _0x1dff23=_0x329c4c['filter'](function(_0x4eaafe){var _0x81bd07=_0xe847('0x20');if(isAgentIdle(_0x4eaafe)){_0x81bd07=_0xe847('0xd');}return _0x81bd07===_0x15cc1a;});return _[_0xe847('0x25')](_0x1dff23,'id');}catch(_0x5509dc){throw _0x5509dc;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2f55ad,_0x4873a8,_0x127777){return Promise[_0xe847('0x2d')]()[_0xe847('0x19')](function(){if(_0x4873a8[_0xe847('0xc')]>0x0){_0x2f55ad=_0x2f55ad['filter'](function(_0x507e7c){return _0x4873a8['includes'](_0x507e7c['id']);});}return _0x2f55ad;})['then'](function(){return db['User'][_0xe847('0x2e')]({'attributes':['id',_0xe847('0x2f'),_0xe847('0x30'),_0xe847('0x4'),'faxPause',_0xe847('0x31'),_0xe847('0x6'),_0xe847('0x7'),_0xe847('0x8'),'whatsappPause',_0xe847('0x32')],'where':{'id':{'$in':_['map'](_0x2f55ad,'id')}},'raw':!![]});})['then'](function(_0x9bec0c){return _0x9bec0c['map'](function(_0x3d47c0){var _0x1d4675=_[_0xe847('0x33')](_0x2f55ad,['id',_0x3d47c0['id']]);var _0x62db1f=filterAgentAttributes(_0x1d4675);_['merge'](_0x3d47c0,_0x62db1f);_0x3d47c0[_0xe847('0x34')]=getAgentStatus(_0x3d47c0);return _0x3d47c0;});})['then'](function(_0x53bdf5){var _0x5f31b6=sortAgentsByStatus(_0x53bdf5,_0x127777);return _[_0xe847('0x25')](_0x5f31b6,'id');})[_0xe847('0x1d')](function(_0x55df82){throw _0x55df82;});}exports[_0xe847('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1bf206){var _0x332c0a={'fields':[],'order':null};var _0x34777b=_0x1bf206[_0xe847('0x36')](',');_0x332c0a['fields']=_[_0xe847('0xb')](_0x34777b,function(_0x242c12){if(!_0x242c12[_0xe847('0x2c')](_0xe847('0x34'))){return!![];}_0x332c0a[_0xe847('0x37')]=_[_0xe847('0x38')](_0x242c12,'-')?_0xe847('0x39'):'ASC';return![];});return _0x332c0a;}exports[_0xe847('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0xfe0a9c){if(_0xfe0a9c[_0xe847('0x2c')](_0xe847('0x30'))&&!_0xfe0a9c[_0xe847('0x2c')](_0xe847('0x3b'))){var _0x5341f3=_0xfe0a9c[_0xe847('0x3c')](0x0,_0xfe0a9c[_0xe847('0x3d')](_0xe847('0x30')));_0xfe0a9c+=','+_0x5341f3+_0xe847('0x3b');}return _0xfe0a9c;}exports[_0xe847('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x97fb85,_0x235feb){var _0x265e93=_0x97fb85[_0xe847('0x3f')](function(_0x10aa30,_0xbfb7c3){if(_0x10aa30['globalStatus']===_0xbfb7c3[_0xe847('0x34')]){if(_0x10aa30[_0xe847('0x34')]==='pause'){if(_0x235feb==='DESC'){return(_0x10aa30[_0xe847('0x32')]||'')<(_0xbfb7c3[_0xe847('0x32')]||'')||_0x10aa30[_0xe847('0x30')][_0xe847('0x40')]()>_0xbfb7c3[_0xe847('0x30')][_0xe847('0x40')]()?0x1:-0x1;}else{return(_0x10aa30[_0xe847('0x32')]||'')<(_0xbfb7c3['pauseType']||'')||_0x10aa30[_0xe847('0x30')]['toLowerCase']()>_0xbfb7c3[_0xe847('0x30')][_0xe847('0x40')]()?-0x1:0x1;}}else{if(_0x235feb===_0xe847('0x39')){return _0x10aa30[_0xe847('0x30')]['toLowerCase']()<_0xbfb7c3[_0xe847('0x30')]['toLowerCase']()?0x1:-0x1;}else{return _0x10aa30[_0xe847('0x30')][_0xe847('0x40')]()<_0xbfb7c3['fullname'][_0xe847('0x40')]()?-0x1:0x1;}}}else{if(_0x235feb===_0xe847('0x39')){return _0x10aa30['globalStatus']<_0xbfb7c3[_0xe847('0x34')]?0x1:-0x1;}else{return _0x10aa30['globalStatus']<_0xbfb7c3[_0xe847('0x34')]?-0x1:0x1;}}});return _0x265e93;}exports[_0xe847('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x5a34e3){var _0x5f536b=[_0xe847('0x42'),'online','lastLoginAt','lastPauseAt',_0xe847('0x32'),'lastPauseAt',_0xe847('0x3b'),_0xe847('0x43'),_0xe847('0x4'),_0xe847('0x6'),_0xe847('0x31'),_0xe847('0x7'),_0xe847('0x9'),_0xe847('0x5'),_0xe847('0x8'),_0xe847('0x44'),_0xe847('0x45'),_0xe847('0x46'),_0xe847('0x47'),_0xe847('0x48'),_0xe847('0x49'),_0xe847('0x4a'),_0xe847('0x4b'),_0xe847('0x4c'),'smsCurrentCapacity',_0xe847('0x4d'),_0xe847('0x4e'),_0xe847('0x4f'),_0xe847('0x13'),_0xe847('0x50'),'smsStatus','whatsappStatus','faxStatus','voiceStatus',_0xe847('0x51'),_0xe847('0x52'),_0xe847('0x53'),_0xe847('0x54'),_0xe847('0x55'),_0xe847('0x56'),_0xe847('0x57'),_0xe847('0x58'),_0xe847('0x59'),_0xe847('0x5a'),'phoneBarEnableScreenRecordingByAgent',_0xe847('0x5b'),_0xe847('0x5c')];var _0x1b158a=[_0xe847('0x4'),'openchannelPause',_0xe847('0x31'),_0xe847('0x7'),_0xe847('0x9'),_0xe847('0x5'),'voicePause',_0xe847('0x5d')];var _0x576f36=_(_0x5a34e3)[_0xe847('0x5e')](_0x1b158a)[_0xe847('0x5f')](_0x5f536b)['value']();return _0x576f36;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 8df12c6..3620574 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(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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(_0x5c12f2,_0x5de043){var _0x5e8344=function(_0x445932){while(--_0x445932){_0x5c12f2['push'](_0x5c12f2['shift']());}};_0x5e8344(++_0x5de043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 069b37e..238e812 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 _0xac8f=['crypto','../environment','networkInterfaces','orderBy','length','filter','family','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','createHash','substring','lodash'];(function(_0xa90718,_0x2fd952){var _0x56ed79=function(_0x41cff1){while(--_0x41cff1){_0xa90718['push'](_0xa90718['shift']());}};_0x56ed79(++_0x2fd952);}(_0xac8f,0xcb));var _0xfac8=function(_0x19f5fc,_0x4c658a){_0x19f5fc=_0x19f5fc-0x0;var _0x315fa3=_0xac8f[_0x19f5fc];return _0x315fa3;};'use strict';var _=require(_0xfac8('0x0'));var os=require('os');var crypto=require(_0xfac8('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')['execSync'];var config=require(_0xfac8('0x2'));function getInterfaces(){var _0x28b846=[];var _0x76f991=os[_0xfac8('0x3')]();var _0x55f72c=_[_0xfac8('0x4')](_['keys'](_0x76f991));for(var _0x1eecd7=0x0;_0x1eecd7<_0x55f72c[_0xfac8('0x5')];_0x1eecd7++){var _0x139194=_0x76f991[_0x55f72c[_0x1eecd7]][_0xfac8('0x6')](function(_0x225380){return _0x225380[_0xfac8('0x7')]==='IPv4'&&_0x225380[_0xfac8('0x8')]===![];});_0x28b846=_0x28b846['concat'](_0x139194);}return _0x28b846;}function getFirstInterface(){var _0x1623f2=_[_0xfac8('0x9')](getInterfaces());return{'macAddress':_0x1623f2&&_0x1623f2[_0xfac8('0xa')]?_0x1623f2['mac']:_0xfac8('0xb'),'ipAddress':_0x1623f2&&_0x1623f2[_0xfac8('0xc')]?_0x1623f2[_0xfac8('0xc')]:_0xfac8('0xd')};}exports[_0xfac8('0xe')]=getFirstInterface;function getCPUhash(){var _0x429e13=_[_0xfac8('0x4')](os[_0xfac8('0xf')]()[_0xfac8('0x10')](function(_0x5181a2){return _0x5181a2[_0xfac8('0x11')];}))['join'](':');return crypto['createHash'](_0xfac8('0x12'))[_0xfac8('0x13')](_0x429e13)[_0xfac8('0x14')](_0xfac8('0x15'));}exports[_0xfac8('0x16')]=function(){var _0x5ab13b=os[_0xfac8('0x17')]();var _0x104e2b=/[0-9a-f-]{36}/;if(config[_0xfac8('0x18')]&&_0x104e2b[_0xfac8('0x19')](config[_0xfac8('0x18')])){return config['licenseToken'];}else if(_0x5ab13b===_0xfac8('0x1a')){return exec(_0xfac8('0x1b'),{'encoding':_0xfac8('0x1c')})[_0xfac8('0x1d')]('\x0d\x0a','');}else{var _0x97481b=getFirstInterface();var _0x336fd8=getCPUhash();var _0x2352d8=_0x336fd8+'|'+os[_0xfac8('0x1e')]()+'|'+_0x97481b['macAddress']+'|'+_0x97481b[_0xfac8('0x1f')];var _0x25ec25=crypto[_0xfac8('0x20')]('md5')['update'](_0x2352d8)['digest'](_0xfac8('0x15'));return _0x25ec25[_0xfac8('0x21')](0x0,0x8)+'-'+_0x25ec25['substring'](0x8,0xc)+'-'+_0x25ec25[_0xfac8('0x21')](0xc,0x10)+'-'+_0x25ec25[_0xfac8('0x21')](0x10,0x14)+'-'+_0x25ec25[_0xfac8('0x21')](0x14);}}; \ No newline at end of file +var _0x9e24=['address','127.0.0.1','getFirstInterface','orderBy','map','model','md5','update','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','substring','bimedia-machine-uuid','child_process','execSync','networkInterfaces','length','filter','family','IPv4','internal','concat','head','00:00:00:00:00:00'];(function(_0x168c60,_0x539d96){var _0x29bea4=function(_0x1f7f4e){while(--_0x1f7f4e){_0x168c60['push'](_0x168c60['shift']());}};_0x29bea4(++_0x539d96);}(_0x9e24,0x9e));var _0x49e2=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x9e24[_0x12b8ec];return _0x21af77;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x49e2('0x0'));var exec=require(_0x49e2('0x1'))[_0x49e2('0x2')];var config=require('../environment');function getInterfaces(){var _0x2a5632=[];var _0x18a8dc=os[_0x49e2('0x3')]();var _0x42143c=_['orderBy'](_['keys'](_0x18a8dc));for(var _0x3e5c53=0x0;_0x3e5c53<_0x42143c[_0x49e2('0x4')];_0x3e5c53++){var _0x4d7c88=_0x18a8dc[_0x42143c[_0x3e5c53]][_0x49e2('0x5')](function(_0x31a774){return _0x31a774[_0x49e2('0x6')]===_0x49e2('0x7')&&_0x31a774[_0x49e2('0x8')]===![];});_0x2a5632=_0x2a5632[_0x49e2('0x9')](_0x4d7c88);}return _0x2a5632;}function getFirstInterface(){var _0x3cb097=_[_0x49e2('0xa')](getInterfaces());return{'macAddress':_0x3cb097&&_0x3cb097['mac']?_0x3cb097['mac']:_0x49e2('0xb'),'ipAddress':_0x3cb097&&_0x3cb097[_0x49e2('0xc')]?_0x3cb097['address']:_0x49e2('0xd')};}exports[_0x49e2('0xe')]=getFirstInterface;function getCPUhash(){var _0x2c27ac=_[_0x49e2('0xf')](os['cpus']()[_0x49e2('0x10')](function(_0x243271){return _0x243271[_0x49e2('0x11')];}))['join'](':');return crypto['createHash'](_0x49e2('0x12'))[_0x49e2('0x13')](_0x2c27ac)[_0x49e2('0x14')](_0x49e2('0x15'));}exports[_0x49e2('0x16')]=function(){var _0x525cd6=os['platform']();var _0x5257a1=/[0-9a-f-]{36}/;if(config[_0x49e2('0x17')]&&_0x5257a1[_0x49e2('0x18')](config[_0x49e2('0x17')])){return config[_0x49e2('0x17')];}else if(_0x525cd6===_0x49e2('0x19')){return exec(_0x49e2('0x1a'),{'encoding':_0x49e2('0x1b')})[_0x49e2('0x1c')]('\x0d\x0a','');}else{var _0x2ef4d3=getFirstInterface();var _0x50b5b8=getCPUhash();var _0x402bc4=_0x50b5b8+'|'+os[_0x49e2('0x1d')]()+'|'+_0x2ef4d3[_0x49e2('0x1e')]+'|'+_0x2ef4d3[_0x49e2('0x1f')];var _0x30fe9c=crypto[_0x49e2('0x20')](_0x49e2('0x12'))[_0x49e2('0x13')](_0x402bc4)[_0x49e2('0x14')](_0x49e2('0x15'));return _0x30fe9c[_0x49e2('0x21')](0x0,0x8)+'-'+_0x30fe9c['substring'](0x8,0xc)+'-'+_0x30fe9c['substring'](0xc,0x10)+'-'+_0x30fe9c[_0x49e2('0x21')](0x10,0x14)+'-'+_0x30fe9c['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 1d58510..fa7ecf1 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 _0xf0db=['https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','update','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf0db,0x109));var _0xbf0d=function(_0x1e2de4,_0x22d700){_0x1e2de4=_0x1e2de4-0x0;var _0x4a5929=_0xf0db[_0x1e2de4];return _0x4a5929;};'use strict';var util=require(_0xbf0d('0x0'));var moment=require(_0xbf0d('0x1'));var rp=require(_0xbf0d('0x2'));var BPromise=require(_0xbf0d('0x3'));var pkginfo=require(_0xbf0d('0x4'))(module,_0xbf0d('0x5'));var db=require(_0xbf0d('0x6'))['db'];var encryptor=require(_0xbf0d('0x7'));var hardware=require(_0xbf0d('0x8'));var logger=require(_0xbf0d('0x9'))(_0xbf0d('0xa'));var HOST=_0xbf0d('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x35a6fd){return new BPromise(function(_0x460385,_0x3025c0){var _0x39a527=util[_0xbf0d('0xc')](_0xbf0d('0xd'),HOST,_0x35a6fd,module['exports']['version']);if(oldToken){_0x39a527=util['format'](_0xbf0d('0xe'),HOST,_0x35a6fd,module[_0xbf0d('0xf')][_0xbf0d('0x5')],oldToken);}var _0x1d75ab={'uri':_0x39a527,'method':_0xbf0d('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x1d75ab)[_0xbf0d('0x11')](function(_0x5e982d){_0x460385(_0x5e982d);})['catch'](function(_0xa8a8ed){_0x3025c0(_0xa8a8ed);});});}function manageLicense(_0x5acf56,_0x4a531d){var _0x3a97f0=_0x4a531d[_0xbf0d('0x12')]({'plain':!![]});if(!isOldTokenSent&&_0x3a97f0[_0xbf0d('0x13')]!==_0x5acf56&&!_0x3a97f0[_0xbf0d('0x14')]){oldToken=_0x3a97f0['data1'];}httpRequest(_0x5acf56)[_0xbf0d('0x11')](function(_0x261fc4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x261fc4[_0xbf0d('0x15')]){isOldTokenSent=![];if(!_0x3a97f0[_0xbf0d('0xa')]&&_0x3a97f0['license']!=_0x261fc4[_0xbf0d('0xa')]||_0x3a97f0[_0xbf0d('0xa')]&&_0x3a97f0[_0xbf0d('0x14')]){logger[_0xbf0d('0x16')](_0xbf0d('0x17'));}if(_0x3a97f0['license']&&!_0x3a97f0[_0xbf0d('0x14')]&&_0x3a97f0[_0xbf0d('0xa')]!=_0x261fc4[_0xbf0d('0xa')]){logger[_0xbf0d('0x16')](_0xbf0d('0x18'));}if(_0x3a97f0[_0xbf0d('0xa')]&&!_0x3a97f0[_0xbf0d('0x14')]&&_0x3a97f0[_0xbf0d('0xa')]==_0x261fc4[_0xbf0d('0xa')]){return _0x4a531d;}return _0x4a531d['update']({'data1':_0x5acf56,'data2':null,'license':_0x261fc4[_0xbf0d('0xa')]});}else{if(_0x261fc4['license']||_0x3a97f0[_0xbf0d('0xa')]){if(!_0x3a97f0[_0xbf0d('0x14')]){if(_0x3a97f0[_0xbf0d('0x13')]==_0x5acf56){GRAY_PERIOD_REASON=_0xbf0d('0x19');logger['info'](_0xbf0d('0x1a'));}else{GRAY_PERIOD_REASON=_0xbf0d('0x1b');logger[_0xbf0d('0x16')](_0xbf0d('0x1c'),_0x3a97f0['data1'],_0x5acf56);}logger[_0xbf0d('0x16')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xbf0d('0x1d')](),moment()[_0xbf0d('0xc')](_0xbf0d('0x1e')));return _0x4a531d['update']({'data2':encryptor['encryptString'](moment()['format'](_0xbf0d('0x1e')))});}else{if(moment()[_0xbf0d('0x1f')](encryptor[_0xbf0d('0x20')](_0x3a97f0[_0xbf0d('0x14')]),_0xbf0d('0x21'))>DAYS){logger['info'](_0xbf0d('0x22'),moment()[_0xbf0d('0xc')](_0xbf0d('0x1e')));isOldTokenSent=![];return _0x4a531d[_0xbf0d('0x23')]({'data1':_0x5acf56,'data2':null,'license':null});}}}else{if(_0x3a97f0[_0xbf0d('0x13')]!=_0x5acf56){logger[_0xbf0d('0x16')](_0xbf0d('0x1c'),_0x3a97f0[_0xbf0d('0x13')],_0x5acf56);return _0x4a531d[_0xbf0d('0x23')]({'data1':_0x5acf56,'data2':null,'license':null});}}}return _0x4a531d;})['then'](function(_0x369b56){_0x4a531d=_0x369b56;})[_0xbf0d('0x24')](function(_0x3d2ef6){logger[_0xbf0d('0x25')](_0x3d2ef6[_0xbf0d('0x26')]);})[_0xbf0d('0x27')](function(){setTimeout(function(){manageLicense(hardware[_0xbf0d('0x28')](),_0x4a531d);},TIME);});}function defaultLicense(){var _0x2d527c=hardware['getUuid']();if(_0x2d527c){return db[_0xbf0d('0x29')][_0xbf0d('0x2a')]({'where':{'id':0x1},'defaults':{'data1':_0x2d527c}})[_0xbf0d('0x2b')](function(_0x344338,_0x1539b7){logger['info'](_0xbf0d('0x2c'),_0x2d527c);manageLicense(_0x2d527c,_0x344338);})[_0xbf0d('0x24')](function(_0x1784dd){logger[_0xbf0d('0x25')](_0x1784dd[_0xbf0d('0x26')]);});}}exports[_0xbf0d('0x2d')]=defaultLicense; \ No newline at end of file +var _0x92b7=['moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','GET','then','catch','get','data2','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','update','encryptString','diff','days','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x92b7,0xd7));var _0x792b=function(_0x317bf0,_0x277c03){_0x317bf0=_0x317bf0-0x0;var _0x225932=_0x92b7[_0x317bf0];return _0x225932;};'use strict';var util=require('util');var moment=require(_0x792b('0x0'));var rp=require(_0x792b('0x1'));var BPromise=require(_0x792b('0x2'));var pkginfo=require(_0x792b('0x3'))(module,'version');var db=require(_0x792b('0x4'))['db'];var encryptor=require(_0x792b('0x5'));var hardware=require(_0x792b('0x6'));var logger=require(_0x792b('0x7'))('license');var HOST=_0x792b('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x66b452){return new BPromise(function(_0x589bc1,_0x47ab01){var _0x23a799=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x66b452,module[_0x792b('0x9')]['version']);if(oldToken){_0x23a799=util[_0x792b('0xa')](_0x792b('0xb'),HOST,_0x66b452,module['exports'][_0x792b('0xc')],oldToken);}var _0x17a191={'uri':_0x23a799,'method':_0x792b('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x17a191)[_0x792b('0xe')](function(_0x561783){_0x589bc1(_0x561783);})[_0x792b('0xf')](function(_0x30358c){_0x47ab01(_0x30358c);});});}function manageLicense(_0x4fd087,_0x2f1431){var _0x14a499=_0x2f1431[_0x792b('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x14a499['data1']!==_0x4fd087&&!_0x14a499[_0x792b('0x11')]){oldToken=_0x14a499['data1'];}httpRequest(_0x4fd087)['then'](function(_0x3e951e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3e951e[_0x792b('0x12')]){isOldTokenSent=![];if(!_0x14a499[_0x792b('0x13')]&&_0x14a499[_0x792b('0x13')]!=_0x3e951e[_0x792b('0x13')]||_0x14a499[_0x792b('0x13')]&&_0x14a499[_0x792b('0x11')]){logger['info'](_0x792b('0x14'));}if(_0x14a499[_0x792b('0x13')]&&!_0x14a499[_0x792b('0x11')]&&_0x14a499[_0x792b('0x13')]!=_0x3e951e[_0x792b('0x13')]){logger[_0x792b('0x15')](_0x792b('0x16'));}if(_0x14a499[_0x792b('0x13')]&&!_0x14a499[_0x792b('0x11')]&&_0x14a499[_0x792b('0x13')]==_0x3e951e[_0x792b('0x13')]){return _0x2f1431;}return _0x2f1431['update']({'data1':_0x4fd087,'data2':null,'license':_0x3e951e['license']});}else{if(_0x3e951e[_0x792b('0x13')]||_0x14a499[_0x792b('0x13')]){if(!_0x14a499[_0x792b('0x11')]){if(_0x14a499[_0x792b('0x17')]==_0x4fd087){GRAY_PERIOD_REASON=_0x792b('0x18');logger[_0x792b('0x15')](_0x792b('0x19'));}else{GRAY_PERIOD_REASON=_0x792b('0x1a');logger[_0x792b('0x15')](_0x792b('0x1b'),_0x14a499[_0x792b('0x17')],_0x4fd087);}logger[_0x792b('0x15')](_0x792b('0x1c'),GRAY_PERIOD_REASON[_0x792b('0x1d')](),moment()['format'](_0x792b('0x1e')));return _0x2f1431[_0x792b('0x1f')]({'data2':encryptor[_0x792b('0x20')](moment()[_0x792b('0xa')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x792b('0x21')](encryptor['decryptString'](_0x14a499[_0x792b('0x11')]),_0x792b('0x22'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0x792b('0x1e')));isOldTokenSent=![];return _0x2f1431[_0x792b('0x1f')]({'data1':_0x4fd087,'data2':null,'license':null});}}}else{if(_0x14a499[_0x792b('0x17')]!=_0x4fd087){logger[_0x792b('0x15')](_0x792b('0x1b'),_0x14a499[_0x792b('0x17')],_0x4fd087);return _0x2f1431[_0x792b('0x1f')]({'data1':_0x4fd087,'data2':null,'license':null});}}}return _0x2f1431;})[_0x792b('0xe')](function(_0x4c20a3){_0x2f1431=_0x4c20a3;})[_0x792b('0xf')](function(_0x1dddf7){logger['error'](_0x1dddf7['message']);})[_0x792b('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0x792b('0x24')](),_0x2f1431);},TIME);});}function defaultLicense(){var _0x1fa5b0=hardware['getUuid']();if(_0x1fa5b0){return db[_0x792b('0x25')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x1fa5b0}})[_0x792b('0x26')](function(_0x2866fe,_0xf22881){logger[_0x792b('0x15')](_0x792b('0x27'),_0x1fa5b0);manageLicense(_0x1fa5b0,_0x2866fe);})[_0x792b('0xf')](function(_0x3b71d5){logger[_0x792b('0x28')](_0x3b71d5[_0x792b('0x29')]);});}}exports[_0x792b('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index ab5a4e8..c63eaa4 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 _0xb2be=['%s:%s:%s','parse','uuid','machineUuid','getUuid','gray','deadline','add','days','grayReason','changed','disabled','findAll','col','role','admin','user','telephone','users','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','find','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format'];(function(_0x1d6a88,_0x6770b2){var _0x369d68=function(_0x24f1d3){while(--_0x24f1d3){_0x1d6a88['push'](_0x1d6a88['shift']());}};_0x369d68(++_0x6770b2);}(_0xb2be,0xc6));var _0xeb2b=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0xb2be[_0xb24a3e];return _0x4038d7;};'use strict';var util=require(_0xeb2b('0x0'));var _=require(_0xeb2b('0x1'));var moment=require(_0xeb2b('0x2'));var BPromise=require(_0xeb2b('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0xeb2b('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xeb2b('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xeb2b('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xeb2b('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3f1371){return new BPromise(function(_0x23f9d5,_0x1dc8e4){return db['License'][_0xeb2b('0x7')](_['defaults'](_0x3f1371,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x271b23){return checkLicense(_0x271b23,null);})[_0xeb2b('0x8')](function(_0x2f8452){_0x23f9d5(_0x2f8452);return;})[_0xeb2b('0x9')](function(_0x37ec5e){_0x1dc8e4(_0x37ec5e);});});}function checkLicense(_0x2a3383,_0x3359ff){if(!_0x2a3383){demoLicense['uuid']=_0x2a3383[_0xeb2b('0xa')];return demoLicense;}try{var _0x1c8541=_0x3359ff||_0x2a3383[_0xeb2b('0xb')];if(_[_0xeb2b('0xc')](_0x1c8541)){throw new Error(_0xeb2b('0xd'));}var _0x55696b=_0x2a3383[_0xeb2b('0xa')];var _0x11ee8c=_0x2a3383['data2'];var _0x545fb5=_0x55696b[_0xeb2b('0xe')]('-')[0x4];var _0x5843d5=_0x55696b[_0xeb2b('0xe')]('-')[0x0];var _0x487b33=encryptor[_0xeb2b('0xf')](_0x1c8541,util[_0xeb2b('0x10')](_0xeb2b('0x11'),_0x545fb5,_0x55696b,_0x5843d5));var _0xc1fff7=JSON[_0xeb2b('0x12')](_0x487b33);_0xc1fff7['demo']=![];_0xc1fff7[_0xeb2b('0x13')]=_0x55696b;_0xc1fff7[_0xeb2b('0x14')]=hardware[_0xeb2b('0x15')]();if(_0x11ee8c){var _0xeb4ec5=encryptor[_0xeb2b('0xf')](_0x11ee8c);_0xc1fff7[_0xeb2b('0x16')]=_0xeb4ec5;_0xc1fff7[_0xeb2b('0x17')]=moment(_0xeb4ec5)[_0xeb2b('0x18')](0x7,_0xeb2b('0x19'))[_0xeb2b('0x10')]();_0xc1fff7[_0xeb2b('0x1a')]=_0xc1fff7[_0xeb2b('0x13')]!=_0xc1fff7[_0xeb2b('0x14')]?_0xeb2b('0x1b'):_0xeb2b('0x1c');}return _0xc1fff7;}catch(_0x10dc05){breakingLicense[_0xeb2b('0x13')]=_0x2a3383[_0xeb2b('0xa')];breakingLicense['message']=_0x10dc05['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x6d2307,_0x2c89c4){getLicense()[_0xeb2b('0x8')](function(_0x367663){return db['User'][_0xeb2b('0x1d')]({'attributes':['role',[db['sequelize']['fn']('COUNT',db['sequelize'][_0xeb2b('0x1e')](_0xeb2b('0x1f'))),'count']],'group':_0xeb2b('0x1f'),'where':{'role':{'$or':[_0xeb2b('0x20'),_0xeb2b('0x21'),_0xeb2b('0x22')]}},'raw':!![]})['then'](function(_0x33eb0e){var _0x48510c={'user':_0x367663[_0xeb2b('0x23')]||0x0,'telephone':_0x367663['telephones']||0x0};_0x33eb0e[_0xeb2b('0x24')](function(_0x2c4c66){var _0x319d60=_0x2c4c66[_0xeb2b('0x1f')]==='admin'?_0xeb2b('0x21'):_0x2c4c66[_0xeb2b('0x1f')];_0x48510c[_0x319d60]-=_0x2c4c66[_0xeb2b('0x25')];if(_0x48510c[_0x319d60]<0x0)_0x48510c[_0x319d60]=0x0;});_0x6d2307(_0x48510c);return;});})[_0xeb2b('0x9')](function(_0x3c7433){_0x2c89c4(_0x3c7433);});});}function checkUserLimits(_0x4b2f4f){return new BPromise(function(_0x126058,_0x58280e){getLimits()[_0xeb2b('0x8')](function(_0x222226){var _0x2290f8=_[_0xeb2b('0x26')](_[_0xeb2b('0x27')](_0x4b2f4f,_0xeb2b('0x1f')),[_0xeb2b('0x20'),_0xeb2b('0x21'),_0xeb2b('0x22')]);var _0x570670=(_0x2290f8[_0xeb2b('0x20')]||0x0)+(_0x2290f8[_0xeb2b('0x21')]||0x0);var _0x3af950=_0x2290f8[_0xeb2b('0x22')]||0x0;if(_0x570670>_0x222226[_0xeb2b('0x21')])return _0x58280e(_0xeb2b('0x28'));if(_0x3af950>_0x222226['telephone'])return _0x58280e(_0xeb2b('0x29'));return _0x126058();})[_0xeb2b('0x9')](function(_0x2881a5){_0x58280e(_0x2881a5);});});}module[_0xeb2b('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x948e=['2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','uuid','data1','isEmpty','data2','format','%s:%s:%s','demo','decryptString','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','user','telephone','forEach','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb'];(function(_0x2df0bf,_0x13990c){var _0x5c46a3=function(_0x5716ea){while(--_0x5716ea){_0x2df0bf['push'](_0x2df0bf['shift']());}};_0x5c46a3(++_0x13990c);}(_0x948e,0x172));var _0xe948=function(_0x4bc4b5,_0x3628b7){_0x4bc4b5=_0x4bc4b5-0x0;var _0x1f6264=_0x948e[_0x4bc4b5];return _0x1f6264;};'use strict';var util=require(_0xe948('0x0'));var _=require(_0xe948('0x1'));var moment=require(_0xe948('0x2'));var BPromise=require(_0xe948('0x3'));var hardware=require('./hardware');var encryptor=require(_0xe948('0x4'));var db=require(_0xe948('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe948('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe948('0x7'),'machineUuid':hardware[_0xe948('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe948('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe948('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4cc1ac){return new BPromise(function(_0x55a96a,_0x43267e){return db[_0xe948('0xa')][_0xe948('0xb')](_[_0xe948('0xc')](_0x4cc1ac,{'raw':!![],'where':{'id':0x1}}))[_0xe948('0xd')](function(_0x4479b8){return checkLicense(_0x4479b8,null);})[_0xe948('0xd')](function(_0x4d7b95){_0x55a96a(_0x4d7b95);return;})['catch'](function(_0xf62c43){_0x43267e(_0xf62c43);});});}function checkLicense(_0x2915c0,_0x398699){if(!_0x2915c0){demoLicense[_0xe948('0xe')]=_0x2915c0[_0xe948('0xf')];return demoLicense;}try{var _0x2630f2=_0x398699||_0x2915c0['license'];if(_[_0xe948('0x10')](_0x2630f2)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1c168d=_0x2915c0['data1'];var _0x49124b=_0x2915c0[_0xe948('0x11')];var _0x305e1b=_0x1c168d['split']('-')[0x4];var _0x1680e8=_0x1c168d['split']('-')[0x0];var _0x2d5da9=encryptor['decryptString'](_0x2630f2,util[_0xe948('0x12')](_0xe948('0x13'),_0x305e1b,_0x1c168d,_0x1680e8));var _0x4a1869=JSON['parse'](_0x2d5da9);_0x4a1869[_0xe948('0x14')]=![];_0x4a1869['uuid']=_0x1c168d;_0x4a1869['machineUuid']=hardware[_0xe948('0x8')]();if(_0x49124b){var _0x14fd0d=encryptor[_0xe948('0x15')](_0x49124b);_0x4a1869[_0xe948('0x16')]=_0x14fd0d;_0x4a1869[_0xe948('0x17')]=moment(_0x14fd0d)[_0xe948('0x18')](0x7,_0xe948('0x19'))['format']();_0x4a1869[_0xe948('0x1a')]=_0x4a1869[_0xe948('0xe')]!=_0x4a1869[_0xe948('0x1b')]?_0xe948('0x1c'):_0xe948('0x1d');}return _0x4a1869;}catch(_0x37f02e){breakingLicense[_0xe948('0xe')]=_0x2915c0[_0xe948('0xf')];breakingLicense[_0xe948('0x1e')]=_0x37f02e['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x211d25,_0x264979){getLicense()[_0xe948('0xd')](function(_0x4eaaee){return db[_0xe948('0x1f')][_0xe948('0x20')]({'attributes':[_0xe948('0x21'),[db[_0xe948('0x22')]['fn'](_0xe948('0x23'),db['sequelize']['col'](_0xe948('0x21'))),_0xe948('0x24')]],'group':_0xe948('0x21'),'where':{'role':{'$or':[_0xe948('0x25'),_0xe948('0x26'),_0xe948('0x27')]}},'raw':!![]})[_0xe948('0xd')](function(_0x7996aa){var _0x5e604d={'user':_0x4eaaee['users']||0x0,'telephone':_0x4eaaee['telephones']||0x0};_0x7996aa[_0xe948('0x28')](function(_0x14b34e){var _0x3248a5=_0x14b34e[_0xe948('0x21')]===_0xe948('0x25')?_0xe948('0x26'):_0x14b34e[_0xe948('0x21')];_0x5e604d[_0x3248a5]-=_0x14b34e[_0xe948('0x24')];if(_0x5e604d[_0x3248a5]<0x0)_0x5e604d[_0x3248a5]=0x0;});_0x211d25(_0x5e604d);return;});})[_0xe948('0x29')](function(_0x21e60a){_0x264979(_0x21e60a);});});}function checkUserLimits(_0x318162){return new BPromise(function(_0x1c9a9a,_0x4a053b){getLimits()[_0xe948('0xd')](function(_0x3d4668){var _0x18f1f3=_[_0xe948('0x2a')](_[_0xe948('0x2b')](_0x318162,_0xe948('0x21')),[_0xe948('0x25'),_0xe948('0x26'),_0xe948('0x27')]);var _0x43ed1a=(_0x18f1f3[_0xe948('0x25')]||0x0)+(_0x18f1f3[_0xe948('0x26')]||0x0);var _0x147c20=_0x18f1f3['telephone']||0x0;if(_0x43ed1a>_0x3d4668[_0xe948('0x26')])return _0x4a053b(_0xe948('0x2c'));if(_0x147c20>_0x3d4668['telephone'])return _0x4a053b(_0xe948('0x2d'));return _0x1c9a9a();})[_0xe948('0x29')](function(_0x4ed34b){_0x4a053b(_0x4ed34b);});});}module[_0xe948('0x2e')]={'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 3d4c240..22e022e 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 _0x36ee=['myappanuglar-secret','secret'];(function(_0x3a0646,_0x175525){var _0x59ceee=function(_0x49962c){while(--_0x49962c){_0x3a0646['push'](_0x3a0646['shift']());}};_0x59ceee(++_0x175525);}(_0x36ee,0xe8));var _0xe36e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x36ee[_0x3bf83f];return _0x22c4a9;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xe36e('0x0'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xe36e('0x1'),'DEBUG':''}; \ No newline at end of file +var _0xdb28=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x297d92,_0x2ac038){var _0x6e80cc=function(_0x759748){while(--_0x759748){_0x297d92['push'](_0x297d92['shift']());}};_0x6e80cc(++_0x2ac038);}(_0xdb28,0x106));var _0x8db2=function(_0x5cf73c,_0x2cf729){_0x5cf73c=_0x5cf73c-0x0;var _0x2280e3=_0xdb28[_0x5cf73c];return _0x2280e3;};'use strict';module[_0x8db2('0x0')]={'DOMAIN':_0x8db2('0x1'),'SESSION_SECRET':_0x8db2('0x2'),'GOOGLE_ID':_0x8db2('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index cca43dc..cda64c7 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b1a=['../utils/loggers','fileLogger','exports'];(function(_0x1266f9,_0x40f076){var _0x56ced3=function(_0x11b7ba){while(--_0x11b7ba){_0x1266f9['push'](_0x1266f9['shift']());}};_0x56ced3(++_0x40f076);}(_0x4b1a,0x72));var _0xa4b1=function(_0x3cac8d,_0x6b7db7){_0x3cac8d=_0x3cac8d-0x0;var _0x35a69d=_0x4b1a[_0x3cac8d];return _0x35a69d;};'use strict';var fileLogger=require(_0xa4b1('0x0'))[_0xa4b1('0x1')];module[_0xa4b1('0x2')]=fileLogger; \ No newline at end of file +var _0xd9c7=['fileLogger','exports','../utils/loggers'];(function(_0x3c4062,_0x3767fc){var _0x3f5bf3=function(_0x105e55){while(--_0x105e55){_0x3c4062['push'](_0x3c4062['shift']());}};_0x3f5bf3(++_0x3767fc);}(_0xd9c7,0x17f));var _0x7d9c=function(_0x33a464,_0x2b36ac){_0x33a464=_0x33a464-0x0;var _0xece740=_0xd9c7[_0x33a464];return _0xece740;};'use strict';var fileLogger=require(_0x7d9c('0x0'))[_0x7d9c('0x1')];module[_0x7d9c('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 897fcb6..2f64265 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 _0x754d=['routing','../../services/routing/index.js','xdr','exports','express','../../services/express/index.js','ami','agi','../../services/agi/index.js','join','../../services/email/index.js'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x754d,0x72));var _0xd754=function(_0x1b48ce,_0x7f336f){_0x1b48ce=_0x1b48ce-0x0;var _0x3b7f3d=_0x754d[_0x1b48ce];return _0x3b7f3d;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xd754('0x0'),'script':path['join'](__dirname,_0xd754('0x1'))},{'name':_0xd754('0x2'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0xd754('0x3'),'script':path['join'](__dirname,_0xd754('0x4'))},{'name':'email','script':path[_0xd754('0x5')](__dirname,_0xd754('0x6'))},{'name':_0xd754('0x7'),'script':path[_0xd754('0x5')](__dirname,_0xd754('0x8'))},{'name':_0xd754('0x9'),'script':path[_0xd754('0x5')](__dirname,'../../services/xdr/index.js')}]};module[_0xd754('0xa')]=config; \ No newline at end of file +var _0xefe1=['agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','exports','path','express','join','../../services/express/index.js','ami'];(function(_0x5e761b,_0x355e38){var _0x98502c=function(_0x4e52d5){while(--_0x4e52d5){_0x5e761b['push'](_0x5e761b['shift']());}};_0x98502c(++_0x355e38);}(_0xefe1,0x7f));var _0x1efe=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xefe1[_0x187ee1];return _0x388160;};'use strict';var path=require(_0x1efe('0x0'));var os=require('os');var config={'apps':[{'name':_0x1efe('0x1'),'script':path[_0x1efe('0x2')](__dirname,_0x1efe('0x3'))},{'name':_0x1efe('0x4'),'script':path[_0x1efe('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x1efe('0x5'),'script':path[_0x1efe('0x2')](__dirname,_0x1efe('0x6'))},{'name':_0x1efe('0x7'),'script':path['join'](__dirname,_0x1efe('0x8'))},{'name':'routing','script':path[_0x1efe('0x2')](__dirname,_0x1efe('0x9'))},{'name':'xdr','script':path[_0x1efe('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x1efe('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 9e05238..889d362 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 _0xe53d=['start','then','disconnect','stop','restart','list','describe','delete','dump','saved','bluebird','./config','connect'];(function(_0x45c6b8,_0x126026){var _0x4ae199=function(_0x4b295d){while(--_0x4b295d){_0x45c6b8['push'](_0x45c6b8['shift']());}};_0x4ae199(++_0x126026);}(_0xe53d,0x1b7));var _0xde53=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe53d[_0x122ef9];return _0x42fba0;};'use strict';var pm2=require('pm2');var BPromise=require(_0xde53('0x0'));var config=require(_0xde53('0x1'));function connect(){return new BPromise(function(_0x51ca84,_0x1d5222){return pm2[_0xde53('0x2')](function(_0x55e9f6){if(_0x55e9f6){return _0x1d5222(_0x55e9f6);}return _0x51ca84('connected');});});};exports[_0xde53('0x3')]=function(_0x2474e1){return connect()[_0xde53('0x4')](function(){return new BPromise(function(_0x10d6eb,_0xcc4106){return pm2['start'](_0x2474e1,function(_0x2d4dce,_0x34df12){if(_0x2d4dce){return _0xcc4106(_0x2d4dce);}pm2[_0xde53('0x5')]();return _0x10d6eb(_0x34df12);});});});};exports['stop']=function(_0x403aed){return connect()[_0xde53('0x4')](function(){return new BPromise(function(_0x28652e,_0x3b7d03){return pm2[_0xde53('0x6')](_0x403aed,function(_0x495b32,_0x4da8da){if(_0x495b32){return _0x3b7d03(_0x495b32);}pm2[_0xde53('0x5')]();return _0x28652e(_0x4da8da);});});});};exports[_0xde53('0x7')]=function(_0x365f71){return connect()['then'](function(){return new BPromise(function(_0x188ec4,_0x162f73){return pm2[_0xde53('0x7')](_0x365f71,function(_0x84ef57,_0x49f109){if(_0x84ef57){return _0x162f73(_0x84ef57);}pm2[_0xde53('0x5')]();return _0x188ec4(_0x49f109);});});});};exports[_0xde53('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x1f2fbd,_0x5d3185){return pm2['list'](function(_0x1911c0,_0x4c1eb3){if(_0x1911c0){return _0x5d3185(_0x1911c0);}pm2[_0xde53('0x5')]();return _0x1f2fbd(_0x4c1eb3);});});});};exports[_0xde53('0x9')]=function(_0x57d1b3){return connect()['then'](function(){return new BPromise(function(_0x4e69c8,_0x45d9f8){return pm2[_0xde53('0x9')](_0x57d1b3,function(_0x5d7512,_0x2cbf19){if(_0x5d7512){return _0x45d9f8(_0x5d7512);}pm2[_0xde53('0x5')]();return _0x4e69c8(_0x2cbf19);});});});};exports[_0xde53('0xa')]=function(_0x524b05){return connect()['then'](function(){return new BPromise(function(_0x486142,_0x1b011b){return pm2[_0xde53('0xa')](_0x524b05,function(_0x30a99d,_0x57da8f){if(_0x30a99d){return _0x1b011b(_0x30a99d);}pm2[_0xde53('0x5')]();return _0x486142(_0x57da8f);});});});};exports['dump']=function(){return connect()[_0xde53('0x4')](function(){return new BPromise(function(_0x4cdcab,_0x4c05b5){return pm2[_0xde53('0xb')](function(_0x322327){if(_0x322327){return _0x4c05b5(_0x322327);}return _0x4cdcab(_0xde53('0xc'));});});});}; \ No newline at end of file +var _0xe52c=['then','describe','delete','dump','saved','bluebird','./config','connect','connected','start','disconnect','stop','restart'];(function(_0x7cf586,_0xd0ff06){var _0x3c38a4=function(_0x509822){while(--_0x509822){_0x7cf586['push'](_0x7cf586['shift']());}};_0x3c38a4(++_0xd0ff06);}(_0xe52c,0x87));var _0xce52=function(_0xb5fa8d,_0x538f47){_0xb5fa8d=_0xb5fa8d-0x0;var _0x463df2=_0xe52c[_0xb5fa8d];return _0x463df2;};'use strict';var pm2=require('pm2');var BPromise=require(_0xce52('0x0'));var config=require(_0xce52('0x1'));function connect(){return new BPromise(function(_0x5fc111,_0x305650){return pm2[_0xce52('0x2')](function(_0x58c065){if(_0x58c065){return _0x305650(_0x58c065);}return _0x5fc111(_0xce52('0x3'));});});};exports[_0xce52('0x4')]=function(_0x106a4b){return connect()['then'](function(){return new BPromise(function(_0x4df1f5,_0x1eeb53){return pm2['start'](_0x106a4b,function(_0x538dbd,_0x5397db){if(_0x538dbd){return _0x1eeb53(_0x538dbd);}pm2[_0xce52('0x5')]();return _0x4df1f5(_0x5397db);});});});};exports[_0xce52('0x6')]=function(_0x53b7f1){return connect()['then'](function(){return new BPromise(function(_0x4ed0bb,_0x163393){return pm2[_0xce52('0x6')](_0x53b7f1,function(_0x316b29,_0x16711a){if(_0x316b29){return _0x163393(_0x316b29);}pm2['disconnect']();return _0x4ed0bb(_0x16711a);});});});};exports[_0xce52('0x7')]=function(_0x3656da){return connect()['then'](function(){return new BPromise(function(_0x87545e,_0x1f13ae){return pm2[_0xce52('0x7')](_0x3656da,function(_0x2aa255,_0x289fb2){if(_0x2aa255){return _0x1f13ae(_0x2aa255);}pm2[_0xce52('0x5')]();return _0x87545e(_0x289fb2);});});});};exports['list']=function(){return connect()[_0xce52('0x8')](function(){return new BPromise(function(_0x1e146c,_0x51080f){return pm2['list'](function(_0x3a8d62,_0x5790c5){if(_0x3a8d62){return _0x51080f(_0x3a8d62);}pm2[_0xce52('0x5')]();return _0x1e146c(_0x5790c5);});});});};exports[_0xce52('0x9')]=function(_0x32feb4){return connect()[_0xce52('0x8')](function(){return new BPromise(function(_0x48b3eb,_0x1bef87){return pm2[_0xce52('0x9')](_0x32feb4,function(_0x459aa4,_0xbd2d89){if(_0x459aa4){return _0x1bef87(_0x459aa4);}pm2[_0xce52('0x5')]();return _0x48b3eb(_0xbd2d89);});});});};exports[_0xce52('0xa')]=function(_0x3d48dc){return connect()[_0xce52('0x8')](function(){return new BPromise(function(_0x4a6dca,_0x32f3da){return pm2[_0xce52('0xa')](_0x3d48dc,function(_0x4deef4,_0x4b2dc4){if(_0x4deef4){return _0x32f3da(_0x4deef4);}pm2[_0xce52('0x5')]();return _0x4a6dca(_0x4b2dc4);});});});};exports['dump']=function(){return connect()[_0xce52('0x8')](function(){return new BPromise(function(_0x558208,_0x2dbf20){return pm2[_0xce52('0xb')](function(_0x4a4b8f){if(_0x4a4b8f){return _0x2dbf20(_0x4a4b8f);}return _0x558208(_0xce52('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index af9414a..00e2505 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 _0xdf19=['../../config/environment','../../mysqldb','../logger','redis','defaults','Setting','find','chatTimeout','then','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','inspect','start','lodash','moment','ioredis','util'];(function(_0x2db370,_0x569287){var _0x4de82e=function(_0x25a864){while(--_0x25a864){_0x2db370['push'](_0x2db370['shift']());}};_0x4de82e(++_0x569287);}(_0xdf19,0x1af));var _0x9df1=function(_0x438687,_0x16e2fe){_0x438687=_0x438687-0x0;var _0x2e3313=_0xdf19[_0x438687];return _0x2e3313;};'use strict';var _=require(_0x9df1('0x0'));var moment=require(_0x9df1('0x1'));var Redis=require(_0x9df1('0x2'));var util=require(_0x9df1('0x3'));var config=require(_0x9df1('0x4'));var db=require(_0x9df1('0x5'))['db'];var logger=require(_0x9df1('0x6'))('schedule');config[_0x9df1('0x7')]=_[_0x9df1('0x8')](config[_0x9df1('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x43d4dd=0x0;var _0x3f48b2=[];return db[_0x9df1('0x9')][_0x9df1('0xa')]({'raw':!![],'attributes':['id',_0x9df1('0xb')],'where':{'id':0x1}})[_0x9df1('0xc')](function(_0x5608f8){_0x43d4dd=_0x5608f8[_0x9df1('0xb')];if(_0x43d4dd){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x9df1('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x9df1('0xe')](_0x5608f8[_0x9df1('0xb')],_0x9df1('0xf'))}}});}else{return[];}})[_0x9df1('0xc')](function(_0x37da4d){if(_0x37da4d&&_0x37da4d[_0x9df1('0x10')]){_0x3f48b2=_[_0x9df1('0x11')](_0x37da4d||[],'id');logger[_0x9df1('0x12')](_0x9df1('0x13'),_0x3f48b2[_0x9df1('0x14')]());return db[_0x9df1('0x15')][_0x9df1('0x16')]({'closeReason':_0x9df1('0x17'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x9df1('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3f48b2}});}})['then'](function(){if(_0x3f48b2&&_0x3f48b2['length']){logger[_0x9df1('0x12')](_0x9df1('0x19'),_0x3f48b2[_0x9df1('0x14')]());for(var _0x225a7c=0x0;_0x225a7c<_0x3f48b2['length'];_0x225a7c++){io['emit'](_0x9df1('0x1a'),{'id':_0x3f48b2[_0x225a7c],'closed':!![]});}}})['catch'](function(_0x469e15){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x469e15?util[_0x9df1('0x1b')](_0x469e15,{'showHidden':![],'depth':null}):'');});}exports[_0x9df1('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa26d=['start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect'];(function(_0x6d6f7,_0x4ba1a9){var _0x2a6afe=function(_0x2b9c3c){while(--_0x2b9c3c){_0x6d6f7['push'](_0x6d6f7['shift']());}};_0x2a6afe(++_0x4ba1a9);}(_0xa26d,0xe8));var _0xda26=function(_0x3d732d,_0x50b90c){_0x3d732d=_0x3d732d-0x0;var _0x151e38=_0xa26d[_0x3d732d];return _0x151e38;};'use strict';var _=require(_0xda26('0x0'));var moment=require(_0xda26('0x1'));var Redis=require(_0xda26('0x2'));var util=require(_0xda26('0x3'));var config=require(_0xda26('0x4'));var db=require(_0xda26('0x5'))['db'];var logger=require('../logger')('schedule');config[_0xda26('0x6')]=_[_0xda26('0x7')](config[_0xda26('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xda26('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x11fee7=0x0;var _0x21443f=[];return db['Setting'][_0xda26('0x9')]({'raw':!![],'attributes':['id',_0xda26('0xa')],'where':{'id':0x1}})[_0xda26('0xb')](function(_0x113200){_0x11fee7=_0x113200[_0xda26('0xa')];if(_0x11fee7){return db[_0xda26('0xc')][_0xda26('0xd')]({'raw':!![],'attributes':['id',_0xda26('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xda26('0xf')](_0x113200['chatTimeout'],_0xda26('0x10'))}}});}else{return[];}})['then'](function(_0xd915e8){if(_0xd915e8&&_0xd915e8[_0xda26('0x11')]){_0x21443f=_[_0xda26('0x12')](_0xd915e8||[],'id');logger[_0xda26('0x13')](_0xda26('0x14'),_0x21443f[_0xda26('0x15')]());return db['ChatInteraction']['update']({'closeReason':_0xda26('0x16'),'disposition':_0xda26('0x17'),'closed':!![],'closedAt':moment()[_0xda26('0x18')](_0xda26('0x19'))},{'where':{'id':_0x21443f}});}})[_0xda26('0xb')](function(){if(_0x21443f&&_0x21443f[_0xda26('0x11')]){logger[_0xda26('0x13')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x21443f[_0xda26('0x15')]());for(var _0x2343e9=0x0;_0x2343e9<_0x21443f[_0xda26('0x11')];_0x2343e9++){io[_0xda26('0x1a')](_0xda26('0x1b'),{'id':_0x21443f[_0x2343e9],'closed':!![]});}}})[_0xda26('0x1c')](function(_0x24560b){logger[_0xda26('0x1d')](_0xda26('0x1e'),_0x24560b?util[_0xda26('0x1f')](_0x24560b,{'showHidden':![],'depth':null}):'');});}exports[_0xda26('0x20')]=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 73b3e51..8eae3e7 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 _0xd2f8=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0xd2f8,0x17c));var _0x8d2f=function(_0x2f4d41,_0x104d39){_0x2f4d41=_0x2f4d41-0x0;var _0x2197d1=_0xd2f8[_0x2f4d41];return _0x2197d1;};'use strict';function start(){var _0x14dba8=require(_0x8d2f('0x0'));return _0x14dba8['startAllRefreshIntervals']();}module[_0x8d2f('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x0c5e=['startAllRefreshIntervals','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x0c5e,0x1c9));var _0xe0c5=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x0c5e[_0x209941];return _0x1e8729;};'use strict';function start(){var _0x1860f6=require(_0xe0c5('0x0'));return _0x1860f6[_0xe0c5('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index e5236e3..828934a 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 _0xa743=['basename','extname','zip','existsSync','Sent','message','text','stringify','status','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','then','error','error\x20mail','catch','data','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','exists','stop','deleteJob','delete\x20cron','length','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','start','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xa743,0xe5));var _0x3a74=function(_0x503564,_0x55867e){_0x503564=_0x503564-0x0;var _0x4be9fd=_0xa743[_0x503564];return _0x4be9fd;};'use strict';var fs=require('fs');var util=require(_0x3a74('0x0'));var path=require(_0x3a74('0x1'));var _=require(_0x3a74('0x2'));var moment=require(_0x3a74('0x3'));var CronJobManager=require(_0x3a74('0x4'));var jayson=require(_0x3a74('0x5'));var BPromise=require(_0x3a74('0x6'));var logger=require(_0x3a74('0x7'))(_0x3a74('0x8'));var db=require(_0x3a74('0x9'))['db'];var analyticCustomReportController=require(_0x3a74('0xa'));var analyticDefaultReportController=require(_0x3a74('0xb'));var client=jayson['client'][_0x3a74('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x331cd1,_0x3cf0ca){return function(){logger[_0x3a74('0xd')](_0x3a74('0xe'),_0x331cd1[_0x3a74('0xf')]);var _0x21ef69=!![];var _0x1d77d4=_0x331cd1[_0x3a74('0x10')][_0x3a74('0x11')]();var _0x4e46d8={'account':_0x1d77d4,'message':{'from':util[_0x3a74('0x12')]('\x22%s\x22\x20<%s>',_0x331cd1['MailAccount'][_0x3a74('0x13')],_0x331cd1[_0x3a74('0x10')]['email']||_0x331cd1[_0x3a74('0x10')][_0x3a74('0x14')][_0x3a74('0x15')]),'to':_0x331cd1[_0x3a74('0xf')],'cc':_0x331cd1['cc'],'bcc':_0x331cd1[_0x3a74('0x16')],'subject':util[_0x3a74('0x12')](_0x3a74('0x17'),_0x3cf0ca[_0x3a74('0x13')],_0x331cd1[_0x3a74('0x18')],_0x331cd1['subtractUnit'])}};var _0x243f52=path[_0x3a74('0x19')](__dirname,_0x3a74('0x1a'));var _0xb1dc37=_0x3cf0ca[_0x3a74('0x1b')];var _0x5ee1a1=util['format'](_0x3a74('0x1c'),path[_0x3a74('0x1d')](_0x3cf0ca[_0x3a74('0x1b')],path[_0x3a74('0x1e')](_0x3cf0ca[_0x3a74('0x1b')])),_0x3a74('0x1f'));var _0x97bae7=path[_0x3a74('0x19')](_0x243f52,_0xb1dc37);var _0x43d1c7=path[_0x3a74('0x19')](_0x243f52,_0x5ee1a1);if(fs[_0x3a74('0x20')](_0x97bae7)){_0x3cf0ca['status']=_0x3a74('0x21');_0x4e46d8[_0x3a74('0x22')]['attachments']=[{'filename':_0xb1dc37,'path':_0x97bae7}];_0x4e46d8['message'][_0x3a74('0x23')]=util[_0x3a74('0x12')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x3a74('0x24')](_0x3cf0ca,null,0x2));}else if(fs['existsSync'](_0x43d1c7)){_0x3cf0ca[_0x3a74('0x25')]='Sent';_0x4e46d8['message'][_0x3a74('0x26')]=[{'filename':_0x5ee1a1,'path':_0x43d1c7}];}else{_0x4e46d8[_0x3a74('0x22')][_0x3a74('0x23')]=_0x3a74('0x27');if(!_0x331cd1[_0x3a74('0x28')]){_0x21ef69=![];logger[_0x3a74('0xd')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x21ef69){return client[_0x3a74('0x29')]('SendMail',_0x4e46d8)[_0x3a74('0x2a')](function(_0x1f43e3){if(_0x1f43e3[_0x3a74('0x2b')]){return logger['error'](_0x3a74('0x2c'),JSON[_0x3a74('0x24')](_0x1f43e3));}return logger[_0x3a74('0xd')]('email\x20sent');})[_0x3a74('0x2d')](function(_0x2477ce){return logger['error']('error\x20mail',JSON['stringify'](_0x2477ce));});}};}function handleError(){return function(_0x44e5e5){return logger[_0x3a74('0x2b')](JSON['stringify'](_0x44e5e5));};}function handleResult(_0x1c8578){return function(_0x4714e9){logger[_0x3a74('0xd')](_0x3a74('0x2e'),JSON[_0x3a74('0x24')](_0x4714e9));if(_0x1c8578[_0x3a74('0x10')]&&_0x1c8578['MailAccount'][_0x3a74('0x14')]&&!_[_0x3a74('0x2f')](_0x1c8578['email'])){setTimeout(handleSendEmail(_0x1c8578,_0x4714e9),0x3c*0x3e8);}};}function handleJob(_0x568145){return function(){try{if(_[_0x3a74('0x2f')](_0x568145[_0x3a74('0x18')])){return logger[_0x3a74('0xd')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x3a74('0x2f')](_0x568145[_0x3a74('0x30')])){return logger[_0x3a74('0xd')](_0x3a74('0x31'));}var _0x59876e={'startDate':moment()['subtract'](_0x568145[_0x3a74('0x18')],_0x568145[_0x3a74('0x30')])[_0x3a74('0x12')](_0x3a74('0x32')),'endDate':moment()[_0x3a74('0x12')](_0x3a74('0x32')),'type':_0x3a74('0x33'),'output':_0x568145[_0x3a74('0x34')],'name':_0x568145['name']};if(!_['isNil'](_0x568145[_0x3a74('0x35')])){logger[_0x3a74('0xd')](_0x3a74('0x36'),_0x568145[_0x3a74('0x35')]);return analyticDefaultReportController[_0x3a74('0x37')]({'id':_0x568145[_0x3a74('0x35')]},_0x59876e)[_0x3a74('0x2a')](handleResult(_0x568145))['catch'](handleError());}if(!_[_0x3a74('0x2f')](_0x568145[_0x3a74('0x38')])){logger[_0x3a74('0xd')](_0x3a74('0x39'),_0x568145[_0x3a74('0x38')]);return analyticCustomReportController[_0x3a74('0x37')]({'id':_0x568145[_0x3a74('0x38')]},_0x59876e)['then'](handleResult(_0x568145))[_0x3a74('0x2d')](handleError());}}catch(_0x1ed8c5){logger[_0x3a74('0x2b')](JSON['stringify'](_0x1ed8c5));}return logger[_0x3a74('0xd')]('no\x20report\x20id');};}function getJobs(_0x2d4bfe){var _0x175391={};if(_0x2d4bfe){_0x175391['id']=_0x2d4bfe;}return db[_0x3a74('0x3a')]['findAll']({'where':_0x175391,'include':[{'model':db[_0x3a74('0x10')],'attributes':['id','name',_0x3a74('0xf')],'include':[{'model':db[_0x3a74('0x3b')],'as':_0x3a74('0x14'),'include':[{'model':db['CloudProvider'],'as':_0x3a74('0x3c')}]}]}]})[_0x3a74('0x2a')](function(_0x52dee5){var _0x5d1b64=_[_0x3a74('0x3d')](manager[_0x3a74('0x3e')]);var _0x49c58c=_[_0x3a74('0x3f')](_0x52dee5,function(_0x26e8cd){return _0x26e8cd['id'][_0x3a74('0x40')]();});var _0x21f1a2=_[_0x3a74('0x41')](_0x52dee5,function(_0xc2fc96){return _0xc2fc96['id'][_0x3a74('0x40')]();});var _0x5cbf03=_0x2d4bfe?_0x49c58c:_[_0x3a74('0x42')](_0x49c58c,_0x5d1b64);var _0x5efb06=_[_0x3a74('0x43')](_0x49c58c,_0x5d1b64);var _0x3b99b1=_['difference'](_0x5d1b64,_0x49c58c);var _0x7a0a85;var _0x2c311c;for(_0x7a0a85=0x0;_0x7a0a85<_0x3b99b1['length']&&!_0x2d4bfe;_0x7a0a85+=0x1){_0x2c311c=_0x3b99b1[_0x7a0a85]['toString']();if(manager[_0x3a74('0x44')](_0x2c311c)){manager[_0x3a74('0x45')](_0x2c311c);manager[_0x3a74('0x46')](_0x2c311c);logger['info'](_0x3a74('0x47'),_0x2c311c);}}logger['info']('toRun',JSON[_0x3a74('0x24')](_0x5cbf03));for(_0x7a0a85=0x0;_0x7a0a85<_0x5cbf03[_0x3a74('0x48')];_0x7a0a85+=0x1){_0x2c311c=_0x5cbf03[_0x7a0a85][_0x3a74('0x40')]();logger['info'](_0x3a74('0x49'),_0x2c311c);if(_0x2d4bfe){logger[_0x3a74('0xd')](_0x3a74('0x4a'),_0x2d4bfe);logger[_0x3a74('0xd')](JSON[_0x3a74('0x24')](_0x21f1a2[_0x2c311c]));BPromise['resolve']()[_0x3a74('0x2a')](handleJob(_0x21f1a2[_0x2c311c]));logger[_0x3a74('0xd')](_0x3a74('0x4b'),_0x21f1a2[_0x2c311c]['name'],_0x21f1a2[_0x2c311c][_0x3a74('0x4c')]);}else if(_0x21f1a2[_0x2c311c][_0x3a74('0x4c')]&&_0x21f1a2[_0x2c311c][_0x3a74('0x4d')]&&moment()[_0x3a74('0x4e')](_0x21f1a2[_0x2c311c][_0x3a74('0x4f')],_0x21f1a2[_0x2c311c][_0x3a74('0x50')])){manager['add'](_0x2c311c,_0x21f1a2[_0x2c311c][_0x3a74('0x4c')],handleJob(_0x21f1a2[_0x2c311c]));manager[_0x3a74('0x51')](_0x2c311c);logger[_0x3a74('0xd')]('add\x20cron',_0x21f1a2[_0x2c311c][_0x3a74('0x13')],_0x21f1a2[_0x2c311c]['cron']);}else if(manager[_0x3a74('0x44')](_0x2c311c)){manager[_0x3a74('0x45')](_0x2c311c);manager['deleteJob'](_0x2c311c);logger[_0x3a74('0xd')](_0x3a74('0x52'),_0x21f1a2[_0x2c311c][_0x3a74('0x13')],_0x21f1a2[_0x2c311c][_0x3a74('0x4c')]);}}for(_0x7a0a85=0x0,_0x2c311c;_0x7a0a85<_0x5efb06[_0x3a74('0x48')]&&!_0x2d4bfe;_0x7a0a85+=0x1){_0x2c311c=_0x5efb06[_0x7a0a85]['toString']();if(manager[_0x3a74('0x44')](_0x2c311c)){if(_0x21f1a2[_0x2c311c][_0x3a74('0x4c')]&&_0x21f1a2[_0x2c311c][_0x3a74('0x4d')]&&moment()[_0x3a74('0x4e')](_0x21f1a2[_0x2c311c][_0x3a74('0x4f')],_0x21f1a2[_0x2c311c][_0x3a74('0x50')])){manager[_0x3a74('0x53')](_0x2c311c,_0x21f1a2[_0x2c311c]['cron'],handleJob(_0x21f1a2[_0x2c311c]));logger[_0x3a74('0xd')](_0x3a74('0x54'),_0x21f1a2[_0x2c311c]['name'],_0x21f1a2[_0x2c311c][_0x3a74('0x4c')]);}else{manager[_0x3a74('0x45')](_0x2c311c);manager[_0x3a74('0x46')](_0x2c311c);logger[_0x3a74('0xd')]('stop\x20cron',_0x21f1a2[_0x2c311c][_0x3a74('0x13')],_0x21f1a2[_0x2c311c][_0x3a74('0x4c')]);}}}})[_0x3a74('0x2d')](function(_0x13fecd){logger[_0x3a74('0x2b')](JSON['stringify'](_0x13fecd));});}exports[_0x3a74('0x55')]=function(_0x4d93a1){return getJobs(_0x4d93a1);};exports[_0x3a74('0x51')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x1504=['cron-job-manager','bluebird','../logger','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','name','email','Smtp','user','bcc','subtractNumber','subtractUnit','join','savename','%s.%s','zip','existsSync','status','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','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','error','error\x20mail','catch','stringify','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','then','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','toString','keyBy','difference','length','deleteJob','toRun','index','my\x20id','resolve','run\x20job','cron','active','endAt','add','start','stop\x20cron','isBetween','startAt','update','update\x20cron','run','path','lodash','moment'];(function(_0x2b3478,_0x58afd7){var _0x1c106f=function(_0x4f12a1){while(--_0x4f12a1){_0x2b3478['push'](_0x2b3478['shift']());}};_0x1c106f(++_0x58afd7);}(_0x1504,0x97));var _0x4150=function(_0x575584,_0x149395){_0x575584=_0x575584-0x0;var _0x120d12=_0x1504[_0x575584];return _0x120d12;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x4150('0x0'));var _=require(_0x4150('0x1'));var moment=require(_0x4150('0x2'));var CronJobManager=require(_0x4150('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x4150('0x4'));var logger=require(_0x4150('0x5'))('schedule');var db=require(_0x4150('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x4150('0x7'));var client=jayson['client'][_0x4150('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5a36b8,_0x394d9e){return function(){logger[_0x4150('0x9')](_0x4150('0xa'),_0x5a36b8['email']);var _0x74fe7c=!![];var _0x14b7a0=_0x5a36b8[_0x4150('0xb')][_0x4150('0xc')]();var _0x4282f0={'account':_0x14b7a0,'message':{'from':util[_0x4150('0xd')]('\x22%s\x22\x20<%s>',_0x5a36b8['MailAccount'][_0x4150('0xe')],_0x5a36b8['MailAccount'][_0x4150('0xf')]||_0x5a36b8[_0x4150('0xb')][_0x4150('0x10')][_0x4150('0x11')]),'to':_0x5a36b8[_0x4150('0xf')],'cc':_0x5a36b8['cc'],'bcc':_0x5a36b8[_0x4150('0x12')],'subject':util[_0x4150('0xd')]('Report\x20%s\x20last\x20%s\x20%s',_0x394d9e[_0x4150('0xe')],_0x5a36b8[_0x4150('0x13')],_0x5a36b8[_0x4150('0x14')])}};var _0x4cbd7f=path[_0x4150('0x15')](__dirname,'../../files/reports');var _0x3bb236=_0x394d9e[_0x4150('0x16')];var _0x1abb05=util[_0x4150('0xd')](_0x4150('0x17'),path['basename'](_0x394d9e[_0x4150('0x16')],path['extname'](_0x394d9e[_0x4150('0x16')])),_0x4150('0x18'));var _0x12a08b=path['join'](_0x4cbd7f,_0x3bb236);var _0x4c2c63=path['join'](_0x4cbd7f,_0x1abb05);if(fs[_0x4150('0x19')](_0x12a08b)){_0x394d9e[_0x4150('0x1a')]='Sent';_0x4282f0[_0x4150('0x1b')][_0x4150('0x1c')]=[{'filename':_0x3bb236,'path':_0x12a08b}];_0x4282f0[_0x4150('0x1b')][_0x4150('0x1d')]=util[_0x4150('0xd')](_0x4150('0x1e'),JSON['stringify'](_0x394d9e,null,0x2));}else if(fs[_0x4150('0x19')](_0x4c2c63)){_0x394d9e[_0x4150('0x1a')]=_0x4150('0x1f');_0x4282f0[_0x4150('0x1b')][_0x4150('0x1c')]=[{'filename':_0x1abb05,'path':_0x4c2c63}];}else{_0x4282f0[_0x4150('0x1b')][_0x4150('0x1d')]=_0x4150('0x20');if(!_0x5a36b8[_0x4150('0x21')]){_0x74fe7c=![];logger[_0x4150('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x74fe7c){return client[_0x4150('0x22')](_0x4150('0x23'),_0x4282f0)['then'](function(_0x2fa41b){if(_0x2fa41b[_0x4150('0x24')]){return logger[_0x4150('0x24')](_0x4150('0x25'),JSON['stringify'](_0x2fa41b));}return logger[_0x4150('0x9')]('email\x20sent');})[_0x4150('0x26')](function(_0x855bed){return logger['error'](_0x4150('0x25'),JSON[_0x4150('0x27')](_0x855bed));});}};}function handleError(){return function(_0x57da22){return logger[_0x4150('0x24')](JSON[_0x4150('0x27')](_0x57da22));};}function handleResult(_0x2d9d3b){return function(_0xdc89d4){logger['info'](_0x4150('0x28'),JSON[_0x4150('0x27')](_0xdc89d4));if(_0x2d9d3b[_0x4150('0xb')]&&_0x2d9d3b['MailAccount'][_0x4150('0x10')]&&!_[_0x4150('0x29')](_0x2d9d3b[_0x4150('0xf')])){setTimeout(handleSendEmail(_0x2d9d3b,_0xdc89d4),0x3c*0x3e8);}};}function handleJob(_0x3c7af8){return function(){try{if(_['isNil'](_0x3c7af8[_0x4150('0x13')])){return logger[_0x4150('0x9')](_0x4150('0x2a'));}if(_[_0x4150('0x29')](_0x3c7af8[_0x4150('0x14')])){return logger['info'](_0x4150('0x2b'));}var _0x39c7b1={'startDate':moment()['subtract'](_0x3c7af8[_0x4150('0x13')],_0x3c7af8[_0x4150('0x14')])[_0x4150('0xd')](_0x4150('0x2c')),'endDate':moment()[_0x4150('0xd')](_0x4150('0x2c')),'type':'scheduled','output':_0x3c7af8['output'],'name':_0x3c7af8[_0x4150('0xe')]};if(!_['isNil'](_0x3c7af8['DefaultReportId'])){logger[_0x4150('0x9')]('exec\x20defaul\x20report\x20id:%s',_0x3c7af8[_0x4150('0x2d')]);return analyticDefaultReportController['runReport']({'id':_0x3c7af8['DefaultReportId']},_0x39c7b1)[_0x4150('0x2e')](handleResult(_0x3c7af8))[_0x4150('0x26')](handleError());}if(!_[_0x4150('0x29')](_0x3c7af8[_0x4150('0x2f')])){logger[_0x4150('0x9')](_0x4150('0x30'),_0x3c7af8['CustomReportId']);return analyticCustomReportController[_0x4150('0x31')]({'id':_0x3c7af8['CustomReportId']},_0x39c7b1)[_0x4150('0x2e')](handleResult(_0x3c7af8))[_0x4150('0x26')](handleError());}}catch(_0x42a40d){logger[_0x4150('0x24')](JSON['stringify'](_0x42a40d));}return logger['info'](_0x4150('0x32'));};}function getJobs(_0x56df1f){var _0x2bd2fd={};if(_0x56df1f){_0x2bd2fd['id']=_0x56df1f;}return db[_0x4150('0x33')][_0x4150('0x34')]({'where':_0x2bd2fd,'include':[{'model':db[_0x4150('0xb')],'attributes':['id',_0x4150('0xe'),_0x4150('0xf')],'include':[{'model':db['MailServerOut'],'as':_0x4150('0x10'),'include':[{'model':db[_0x4150('0x35')],'as':_0x4150('0x35')}]}]}]})[_0x4150('0x2e')](function(_0x6be5b1){var _0x413643=_[_0x4150('0x36')](manager[_0x4150('0x37')]);var _0x5e71ab=_['map'](_0x6be5b1,function(_0x1f6177){return _0x1f6177['id'][_0x4150('0x38')]();});var _0x20999c=_[_0x4150('0x39')](_0x6be5b1,function(_0x24bc70){return _0x24bc70['id']['toString']();});var _0x37b706=_0x56df1f?_0x5e71ab:_[_0x4150('0x3a')](_0x5e71ab,_0x413643);var _0x308b54=_['intersection'](_0x5e71ab,_0x413643);var _0x5ea8ff=_[_0x4150('0x3a')](_0x413643,_0x5e71ab);var _0x4991c2;var _0x3a7db0;for(_0x4991c2=0x0;_0x4991c2<_0x5ea8ff[_0x4150('0x3b')]&&!_0x56df1f;_0x4991c2+=0x1){_0x3a7db0=_0x5ea8ff[_0x4991c2][_0x4150('0x38')]();if(manager['exists'](_0x3a7db0)){manager['stop'](_0x3a7db0);manager[_0x4150('0x3c')](_0x3a7db0);logger['info']('delete\x20cron',_0x3a7db0);}}logger[_0x4150('0x9')](_0x4150('0x3d'),JSON[_0x4150('0x27')](_0x37b706));for(_0x4991c2=0x0;_0x4991c2<_0x37b706[_0x4150('0x3b')];_0x4991c2+=0x1){_0x3a7db0=_0x37b706[_0x4991c2]['toString']();logger[_0x4150('0x9')](_0x4150('0x3e'),_0x3a7db0);if(_0x56df1f){logger[_0x4150('0x9')](_0x4150('0x3f'),_0x56df1f);logger[_0x4150('0x9')](JSON[_0x4150('0x27')](_0x20999c[_0x3a7db0]));BPromise[_0x4150('0x40')]()[_0x4150('0x2e')](handleJob(_0x20999c[_0x3a7db0]));logger['info'](_0x4150('0x41'),_0x20999c[_0x3a7db0][_0x4150('0xe')],_0x20999c[_0x3a7db0]['cron']);}else if(_0x20999c[_0x3a7db0][_0x4150('0x42')]&&_0x20999c[_0x3a7db0][_0x4150('0x43')]&&moment()['isBetween'](_0x20999c[_0x3a7db0]['startAt'],_0x20999c[_0x3a7db0][_0x4150('0x44')])){manager[_0x4150('0x45')](_0x3a7db0,_0x20999c[_0x3a7db0][_0x4150('0x42')],handleJob(_0x20999c[_0x3a7db0]));manager[_0x4150('0x46')](_0x3a7db0);logger[_0x4150('0x9')]('add\x20cron',_0x20999c[_0x3a7db0][_0x4150('0xe')],_0x20999c[_0x3a7db0][_0x4150('0x42')]);}else if(manager['exists'](_0x3a7db0)){manager['stop'](_0x3a7db0);manager[_0x4150('0x3c')](_0x3a7db0);logger[_0x4150('0x9')](_0x4150('0x47'),_0x20999c[_0x3a7db0][_0x4150('0xe')],_0x20999c[_0x3a7db0][_0x4150('0x42')]);}}for(_0x4991c2=0x0,_0x3a7db0;_0x4991c2<_0x308b54[_0x4150('0x3b')]&&!_0x56df1f;_0x4991c2+=0x1){_0x3a7db0=_0x308b54[_0x4991c2][_0x4150('0x38')]();if(manager['exists'](_0x3a7db0)){if(_0x20999c[_0x3a7db0][_0x4150('0x42')]&&_0x20999c[_0x3a7db0][_0x4150('0x43')]&&moment()[_0x4150('0x48')](_0x20999c[_0x3a7db0][_0x4150('0x49')],_0x20999c[_0x3a7db0][_0x4150('0x44')])){manager[_0x4150('0x4a')](_0x3a7db0,_0x20999c[_0x3a7db0][_0x4150('0x42')],handleJob(_0x20999c[_0x3a7db0]));logger[_0x4150('0x9')](_0x4150('0x4b'),_0x20999c[_0x3a7db0][_0x4150('0xe')],_0x20999c[_0x3a7db0]['cron']);}else{manager['stop'](_0x3a7db0);manager[_0x4150('0x3c')](_0x3a7db0);logger[_0x4150('0x9')](_0x4150('0x47'),_0x20999c[_0x3a7db0][_0x4150('0xe')],_0x20999c[_0x3a7db0][_0x4150('0x42')]);}}}})[_0x4150('0x26')](function(_0x24da61){logger[_0x4150('0x24')](JSON[_0x4150('0x27')](_0x24da61));});}exports[_0x4150('0x4c')]=function(_0x5444ce){return getJobs(_0x5444ce);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index ba89418..e3c2015 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 _0x90db=['Transcribe\x20not\x20configured','push','all','start','aws-sdk','request-promise','util','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','Negative','SentimentScore','Mixed','Neutral','FAILED','FailureReason','resolve','bucket','CloudProvider','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId'];(function(_0x1f7e36,_0x4680ab){var _0x1a71f3=function(_0x69b7bc){while(--_0x69b7bc){_0x1f7e36['push'](_0x1f7e36['shift']());}};_0x1a71f3(++_0x4680ab);}(_0x90db,0x1c0));var _0xb90d=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x90db[_0xbb091];return _0x467a04;};var _=require('lodash');var AWS=require(_0xb90d('0x0'));var rp=require(_0xb90d('0x1'));var util=require(_0xb90d('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x4aaef1,_0x17e9b9,_0x29a2e7,_0x95ea24){return new Promise(function(_0x380149,_0x1e7a52){var _0x2d8398=new AWS[(_0xb90d('0x3'))]({'accessKeyId':_0x17e9b9,'secretAccessKey':_0x4aaef1,'region':_0x29a2e7});_0x2d8398[_0xb90d('0x4')]({'TranscriptionJobName':_0x95ea24},function(_0x2ef5e6,_0x108b88){if(_0x2ef5e6){return _0x1e7a52(_0x2ef5e6);}else{return _0x380149(_0x108b88);}});});}function sentiment(_0x261cf6,_0x2b9103,_0x48c4f6,_0x41e5ed,_0xab0570){return new Promise(function(_0x40a3e1,_0x5d05f8){var _0x81c427=new AWS[(_0xb90d('0x5'))]({'accessKeyId':_0x2b9103,'secretAccessKey':_0x261cf6,'region':_0x48c4f6});_0x81c427[_0xb90d('0x6')]({'Text':_0x41e5ed,'LanguageCode':_0xab0570[_0xb90d('0x7')](0x0,0x2)},function(_0x787db4,_0x54a919){if(_0x787db4){return _0x5d05f8(_0x787db4);}else{return _0x40a3e1(_0x54a919);}});});}function checkTranscribeJob(_0x39caa8,_0x5bc2b9,_0xe1b1d6){var _0x1d5eed;return new BPromise(function(_0x265763,_0x1943a9){logger[_0xb90d('0x8')](util[_0xb90d('0x9')](_0xb90d('0xa'),_0x39caa8['id'],_0x39caa8['transcribeName']));return getTranscriptionJob(_0xe1b1d6[_0xb90d('0xb')],_0xe1b1d6['data2'],_0x5bc2b9[_0xb90d('0xc')],_0x39caa8[_0xb90d('0xd')])['then'](function(_0x1b2324){logger['info'](util[_0xb90d('0x9')](_0xb90d('0xe'),_0x39caa8['id'],_0x39caa8[_0xb90d('0xd')],_0x1b2324[_0xb90d('0xf')][_0xb90d('0x10')]));if(!_0x39caa8['fileText']){switch(_0x1b2324[_0xb90d('0xf')]['TranscriptionJobStatus']){case _0xb90d('0x11'):var _0x57f517={'transcribeStatus':_0x1b2324['TranscriptionJob'][_0xb90d('0x10')],'fileUri':_0x1b2324[_0xb90d('0xf')][_0xb90d('0x12')][_0xb90d('0x13')]};logger[_0xb90d('0x8')](util[_0xb90d('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x39caa8['id']));return rp({'uri':_0x1b2324[_0xb90d('0xf')][_0xb90d('0x12')]['TranscriptFileUri'],'json':!![]})[_0xb90d('0x14')](function(_0x21d28e){logger[_0xb90d('0x8')](util[_0xb90d('0x9')](_0xb90d('0x15'),_0x39caa8['id']));if(_0x21d28e&&_0x21d28e[_0xb90d('0x16')]&&_0x21d28e[_0xb90d('0x16')][_0xb90d('0x17')]&&_0x21d28e[_0xb90d('0x16')][_0xb90d('0x17')][_0xb90d('0x18')]){_0x57f517[_0xb90d('0x19')]='';for(var _0x350218=0x0;_0x350218<_0x21d28e['results'][_0xb90d('0x17')]['length'];_0x350218++){_0x57f517[_0xb90d('0x19')]+=_0x21d28e[_0xb90d('0x16')][_0xb90d('0x17')][_0x350218][_0xb90d('0x1a')]+'';}}return _0x39caa8[_0xb90d('0x1b')](_0x57f517);})[_0xb90d('0x14')](function(){logger[_0xb90d('0x8')](util[_0xb90d('0x9')](_0xb90d('0x1c'),_0x39caa8['id']));if(!_0x39caa8[_0xb90d('0x1d')]){throw new db['Sequelize'][(_0xb90d('0x1e'))](_0xb90d('0x1f'));}if(!_0x5bc2b9[_0xb90d('0x20')]||!_0x5bc2b9[_0xb90d('0x21')]||!_0x5bc2b9[_0xb90d('0x22')]||!_0x5bc2b9[_0xb90d('0x23')]||!_0x5bc2b9['bucket']){throw new db['Sequelize']['ValidationError'](_0xb90d('0x24'));}if(!_0x57f517['fileText']){throw new Error(_0xb90d('0x25'));}if(_0x5bc2b9[_0xb90d('0x21')]===_0xe1b1d6['id']){return _0xe1b1d6;}else{return db['CloudProvider'][_0xb90d('0x26')]({'where':{'id':_settings[_0xb90d('0x21')]}});}})[_0xb90d('0x14')](function(_0x1a424f){if(!_0x1a424f){throw new db[(_0xb90d('0x27'))][(_0xb90d('0x1e'))](_0xb90d('0x28'));}if(!_0x1a424f[_0xb90d('0xb')]||!_0x1a424f[_0xb90d('0x29')]){throw new db[(_0xb90d('0x27'))][(_0xb90d('0x1e'))](_0xb90d('0x2a'));}_0x1d5eed=_0x1a424f;logger[_0xb90d('0x8')](util[_0xb90d('0x9')](_0xb90d('0x2b'),_0x39caa8['id']));return sentiment(_0x1d5eed[_0xb90d('0xb')],_0x1d5eed[_0xb90d('0x29')],_0x5bc2b9[_0xb90d('0x22')],_0x57f517['fileText'],_0x5bc2b9['language']);})[_0xb90d('0x14')](function(_0x20e1d8){logger[_0xb90d('0x8')](util[_0xb90d('0x9')](_0xb90d('0x2c'),_0x39caa8['id']));return _0x39caa8[_0xb90d('0x1b')]({'sentiment':_0x20e1d8[_0xb90d('0x2d')],'sPositive':_0x20e1d8['SentimentScore'][_0xb90d('0x2e')],'sNegative':_0x20e1d8['SentimentScore'][_0xb90d('0x2f')],'sMixed':_0x20e1d8[_0xb90d('0x30')][_0xb90d('0x31')],'sNeutral':_0x20e1d8[_0xb90d('0x30')][_0xb90d('0x32')]});})[_0xb90d('0x14')](function(){logger[_0xb90d('0x8')](util[_0xb90d('0x9')](_0xb90d('0x1c'),_0x39caa8['id']));_0x265763();});case'FAILED':return _0x39caa8[_0xb90d('0x1b')]({'transcribeStatus':_0xb90d('0x33'),'failureReason':_0x1b2324[_0xb90d('0xf')][_0xb90d('0x34')]})['then'](function(){logger[_0xb90d('0x8')](util[_0xb90d('0x9')](_0xb90d('0x1c'),_0x39caa8['id']));_0x265763();});default:logger[_0xb90d('0x8')](util[_0xb90d('0x9')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x39caa8['id']));break;}}else{return BPromise[_0xb90d('0x35')]()[_0xb90d('0x14')](function(){if(!_0x39caa8[_0xb90d('0x1d')]){throw new db[(_0xb90d('0x27'))]['ValidationError'](_0xb90d('0x1f'));}if(!_0x5bc2b9[_0xb90d('0x20')]||!_0x5bc2b9[_0xb90d('0x21')]||!_0x5bc2b9[_0xb90d('0x22')]||!_0x5bc2b9[_0xb90d('0x23')]||!_0x5bc2b9[_0xb90d('0x36')]){throw new db[(_0xb90d('0x27'))][(_0xb90d('0x1e'))](_0xb90d('0x24'));}if(!_0x39caa8[_0xb90d('0x19')]){throw new Error(_0xb90d('0x25'));}if(_0x5bc2b9[_0xb90d('0x21')]===_0xe1b1d6['id']){return _0xe1b1d6;}else{return db[_0xb90d('0x37')][_0xb90d('0x26')]({'where':{'id':_settings[_0xb90d('0x21')]}});}})[_0xb90d('0x14')](function(_0x16974c){if(!_0x16974c){throw new db['Sequelize'][(_0xb90d('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x16974c[_0xb90d('0xb')]||!_0x16974c['data2']){throw new db[(_0xb90d('0x27'))][(_0xb90d('0x1e'))](_0xb90d('0x2a'));}_0x1d5eed=_0x16974c;logger[_0xb90d('0x8')](util[_0xb90d('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x39caa8['id']));return sentiment(_0x1d5eed[_0xb90d('0xb')],_0x1d5eed[_0xb90d('0x29')],_0x5bc2b9['sentimentRegion'],_0x39caa8['fileText'],_0x5bc2b9['language']);})['then'](function(_0x41d001){logger[_0xb90d('0x8')](util['format'](_0xb90d('0x2c'),_0x39caa8['id']));return _0x39caa8['update']({'sentiment':_0x41d001[_0xb90d('0x2d')],'sPositive':_0x41d001['SentimentScore']['Positive'],'sNegative':_0x41d001[_0xb90d('0x30')][_0xb90d('0x2f')],'sMixed':_0x41d001[_0xb90d('0x30')][_0xb90d('0x31')],'sNeutral':_0x41d001[_0xb90d('0x30')]['Neutral'],'transcribeStatus':_0xb90d('0x11')});})[_0xb90d('0x14')](function(){logger[_0xb90d('0x8')](util[_0xb90d('0x9')](_0xb90d('0x1c'),_0x39caa8['id']));_0x265763();});}})[_0xb90d('0x38')](function(_0xcce33e){if(_0xcce33e){if(!_0xcce33e['name']||_0xcce33e[_0xb90d('0x39')]!==_0xb90d('0x3a')){logger[_0xb90d('0x3b')](util['format'](_0xb90d('0x3c'),_0x39caa8['id']),util[_0xb90d('0x3d')](_0xcce33e,{'showHidden':![],'depth':null}));}}_0x265763();});});}function checkTranscribe(){var _0x2b6220;var _0x5cc606;var _0x4a50aa;return db[_0xb90d('0x3e')][_0xb90d('0x3f')]({'where':{'transcribeStatus':_0xb90d('0x40')}})[_0xb90d('0x14')](function(_0xc89422){if(!_0xc89422||!_0xc89422[_0xb90d('0x18')]){throw new db[(_0xb90d('0x27'))][(_0xb90d('0x1e'))](_0xb90d('0x41'));}_0x2b6220=_0xc89422;return db[_0xb90d('0x42')][_0xb90d('0x26')]({'where':{'id':0x1}});})[_0xb90d('0x14')](function(_0x3f3c14){if(!_0x3f3c14){throw new db[(_0xb90d('0x27'))]['ValidationError'](_0xb90d('0x43'));}_0x5cc606=_0x3f3c14;if(!_0x5cc606[_0xb90d('0x44')]||!_0x5cc606[_0xb90d('0x45')]||!_0x5cc606['transcribeRegion']||!_0x5cc606['language']||!_0x5cc606['bucket']){throw new db[(_0xb90d('0x27'))][(_0xb90d('0x1e'))](_0xb90d('0x46'));}return db[_0xb90d('0x37')]['findOne']({'where':{'id':_0x5cc606[_0xb90d('0x45')]}});})[_0xb90d('0x14')](function(_0x3e11ed){if(!_0x3e11ed){throw new db[(_0xb90d('0x27'))][(_0xb90d('0x1e'))](_0xb90d('0x28'));}if(!_0x3e11ed[_0xb90d('0xb')]||!_0x3e11ed[_0xb90d('0x29')]){throw new db['Sequelize'][(_0xb90d('0x1e'))](_0xb90d('0x2a'));}_0x4a50aa=_0x3e11ed;var _0x5570a5=[];_0x2b6220['forEach'](function(_0x49230c){_0x5570a5[_0xb90d('0x47')](checkTranscribeJob(_0x49230c,_0x5cc606,_0x4a50aa));});return BPromise[_0xb90d('0x48')](_0x5570a5);})[_0xb90d('0x38')](function(_0x27d008){if(_0x27d008){if(!_0x27d008['name']||_0x27d008[_0xb90d('0x39')]!=='SequelizeValidationError'){logger[_0xb90d('0x3b')](util[_0xb90d('0x3d')](_0x27d008,{'showHidden':![],'depth':null}));}}});}exports[_0xb90d('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x9db7=['forEach','push','all','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','sentimentAccountId','sentimentRegion','bucket','Sequelize','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','language','Sentiment\x20Analysis\x20not\x20configured','Negative','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','transcribeAccountId','Transcribe\x20not\x20configured'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x9db7,0x1bf));var _0x79db=function(_0x1592e9,_0x4653c1){_0x1592e9=_0x1592e9-0x0;var _0x1af852=_0x9db7[_0x1592e9];return _0x1af852;};var _=require(_0x79db('0x0'));var AWS=require(_0x79db('0x1'));var rp=require(_0x79db('0x2'));var util=require(_0x79db('0x3'));var BPromise=require('bluebird');var db=require(_0x79db('0x4'))['db'];var logger=require('../../config/logger')(_0x79db('0x5'));function getTranscriptionJob(_0x3a9568,_0x59ad03,_0x12ef88,_0x7abe17){return new Promise(function(_0xfb8328,_0x45c9d1){var _0x7980b1=new AWS[(_0x79db('0x6'))]({'accessKeyId':_0x59ad03,'secretAccessKey':_0x3a9568,'region':_0x12ef88});_0x7980b1[_0x79db('0x7')]({'TranscriptionJobName':_0x7abe17},function(_0x792510,_0x27d02a){if(_0x792510){return _0x45c9d1(_0x792510);}else{return _0xfb8328(_0x27d02a);}});});}function sentiment(_0x2ab279,_0x2c0547,_0x145a31,_0x5d0155,_0x37a537){return new Promise(function(_0x1d277f,_0x5e7ac7){var _0x210573=new AWS[(_0x79db('0x8'))]({'accessKeyId':_0x2c0547,'secretAccessKey':_0x2ab279,'region':_0x145a31});_0x210573[_0x79db('0x9')]({'Text':_0x5d0155,'LanguageCode':_0x37a537[_0x79db('0xa')](0x0,0x2)},function(_0x3edbfe,_0x300851){if(_0x3edbfe){return _0x5e7ac7(_0x3edbfe);}else{return _0x1d277f(_0x300851);}});});}function checkTranscribeJob(_0x561acd,_0x51e061,_0x49b16c){var _0x308f84;return new BPromise(function(_0x4f774e,_0x1cf90a){logger['info'](util[_0x79db('0xb')](_0x79db('0xc'),_0x561acd['id'],_0x561acd[_0x79db('0xd')]));return getTranscriptionJob(_0x49b16c[_0x79db('0xe')],_0x49b16c[_0x79db('0xf')],_0x51e061[_0x79db('0x10')],_0x561acd[_0x79db('0xd')])[_0x79db('0x11')](function(_0xa1cc87){logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x13'),_0x561acd['id'],_0x561acd[_0x79db('0xd')],_0xa1cc87['TranscriptionJob'][_0x79db('0x14')]));if(!_0x561acd[_0x79db('0x15')]){switch(_0xa1cc87[_0x79db('0x16')][_0x79db('0x14')]){case _0x79db('0x17'):var _0x5ba1b4={'transcribeStatus':_0xa1cc87[_0x79db('0x16')][_0x79db('0x14')],'fileUri':_0xa1cc87['TranscriptionJob'][_0x79db('0x18')][_0x79db('0x19')]};logger['info'](util[_0x79db('0xb')](_0x79db('0x1a'),_0x561acd['id']));return rp({'uri':_0xa1cc87[_0x79db('0x16')][_0x79db('0x18')][_0x79db('0x19')],'json':!![]})[_0x79db('0x11')](function(_0x1f48ff){logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x1b'),_0x561acd['id']));if(_0x1f48ff&&_0x1f48ff[_0x79db('0x1c')]&&_0x1f48ff[_0x79db('0x1c')][_0x79db('0x1d')]&&_0x1f48ff[_0x79db('0x1c')][_0x79db('0x1d')]['length']){_0x5ba1b4[_0x79db('0x15')]='';for(var _0x434681=0x0;_0x434681<_0x1f48ff['results']['transcripts'][_0x79db('0x1e')];_0x434681++){_0x5ba1b4[_0x79db('0x15')]+=_0x1f48ff[_0x79db('0x1c')][_0x79db('0x1d')][_0x434681][_0x79db('0x1f')]+'';}}return _0x561acd[_0x79db('0x20')](_0x5ba1b4);})[_0x79db('0x11')](function(){logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x21'),_0x561acd['id']));if(!_0x561acd[_0x79db('0x22')]){throw new db['Sequelize'][(_0x79db('0x23'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x51e061['sentiment']||!_0x51e061[_0x79db('0x24')]||!_0x51e061[_0x79db('0x25')]||!_0x51e061['language']||!_0x51e061[_0x79db('0x26')]){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5ba1b4[_0x79db('0x15')]){throw new Error(_0x79db('0x28'));}if(_0x51e061['sentimentAccountId']===_0x49b16c['id']){return _0x49b16c;}else{return db[_0x79db('0x29')][_0x79db('0x2a')]({'where':{'id':_settings[_0x79db('0x24')]}});}})[_0x79db('0x11')](function(_0x4b2157){if(!_0x4b2157){throw new db[(_0x79db('0x27'))]['ValidationError'](_0x79db('0x2b'));}if(!_0x4b2157['data1']||!_0x4b2157[_0x79db('0xf')]){throw new db[(_0x79db('0x27'))]['ValidationError'](_0x79db('0x2c'));}_0x308f84=_0x4b2157;logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x2d'),_0x561acd['id']));return sentiment(_0x308f84[_0x79db('0xe')],_0x308f84[_0x79db('0xf')],_0x51e061[_0x79db('0x25')],_0x5ba1b4[_0x79db('0x15')],_0x51e061['language']);})[_0x79db('0x11')](function(_0x59d8e8){logger['info'](util[_0x79db('0xb')](_0x79db('0x2e'),_0x561acd['id']));return _0x561acd[_0x79db('0x20')]({'sentiment':_0x59d8e8[_0x79db('0x2f')],'sPositive':_0x59d8e8[_0x79db('0x30')][_0x79db('0x31')],'sNegative':_0x59d8e8['SentimentScore']['Negative'],'sMixed':_0x59d8e8[_0x79db('0x30')][_0x79db('0x32')],'sNeutral':_0x59d8e8[_0x79db('0x30')]['Neutral']});})[_0x79db('0x11')](function(){logger['info'](util[_0x79db('0xb')](_0x79db('0x21'),_0x561acd['id']));_0x4f774e();});case _0x79db('0x33'):return _0x561acd[_0x79db('0x20')]({'transcribeStatus':_0x79db('0x33'),'failureReason':_0xa1cc87[_0x79db('0x16')][_0x79db('0x34')]})[_0x79db('0x11')](function(){logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x21'),_0x561acd['id']));_0x4f774e();});default:logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x35'),_0x561acd['id']));break;}}else{return BPromise[_0x79db('0x36')]()[_0x79db('0x11')](function(){if(!_0x561acd[_0x79db('0x22')]){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))](_0x79db('0x37'));}if(!_0x51e061['sentiment']||!_0x51e061[_0x79db('0x24')]||!_0x51e061[_0x79db('0x25')]||!_0x51e061[_0x79db('0x38')]||!_0x51e061[_0x79db('0x26')]){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))](_0x79db('0x39'));}if(!_0x561acd[_0x79db('0x15')]){throw new Error(_0x79db('0x28'));}if(_0x51e061['sentimentAccountId']===_0x49b16c['id']){return _0x49b16c;}else{return db[_0x79db('0x29')]['findOne']({'where':{'id':_settings[_0x79db('0x24')]}});}})[_0x79db('0x11')](function(_0x539b75){if(!_0x539b75){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))](_0x79db('0x2b'));}if(!_0x539b75['data1']||!_0x539b75[_0x79db('0xf')]){throw new db['Sequelize'][(_0x79db('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x308f84=_0x539b75;logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x2d'),_0x561acd['id']));return sentiment(_0x308f84[_0x79db('0xe')],_0x308f84[_0x79db('0xf')],_0x51e061[_0x79db('0x25')],_0x561acd['fileText'],_0x51e061[_0x79db('0x38')]);})[_0x79db('0x11')](function(_0x2eeea9){logger[_0x79db('0x12')](util[_0x79db('0xb')](_0x79db('0x2e'),_0x561acd['id']));return _0x561acd[_0x79db('0x20')]({'sentiment':_0x2eeea9['Sentiment'],'sPositive':_0x2eeea9[_0x79db('0x30')]['Positive'],'sNegative':_0x2eeea9[_0x79db('0x30')][_0x79db('0x3a')],'sMixed':_0x2eeea9[_0x79db('0x30')]['Mixed'],'sNeutral':_0x2eeea9[_0x79db('0x30')][_0x79db('0x3b')],'transcribeStatus':'COMPLETED'});})[_0x79db('0x11')](function(){logger[_0x79db('0x12')](util[_0x79db('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x561acd['id']));_0x4f774e();});}})[_0x79db('0x3c')](function(_0x7ff6d4){if(_0x7ff6d4){if(!_0x7ff6d4['name']||_0x7ff6d4[_0x79db('0x3d')]!==_0x79db('0x3e')){logger[_0x79db('0x3f')](util[_0x79db('0xb')](_0x79db('0x40'),_0x561acd['id']),util[_0x79db('0x41')](_0x7ff6d4,{'showHidden':![],'depth':null}));}}_0x4f774e();});});}function checkTranscribe(){var _0x1f703e;var _0x15fee2;var _0x9515fc;return db[_0x79db('0x42')][_0x79db('0x43')]({'where':{'transcribeStatus':_0x79db('0x44')}})[_0x79db('0x11')](function(_0x2840be){if(!_0x2840be||!_0x2840be[_0x79db('0x1e')]){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))]('No\x20transcribe\x20job\x20to\x20check');}_0x1f703e=_0x2840be;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x79db('0x11')](function(_0x2a16f9){if(!_0x2a16f9){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))]('Settings\x20not\x20available');}_0x15fee2=_0x2a16f9;if(!_0x15fee2[_0x79db('0x5')]||!_0x15fee2[_0x79db('0x45')]||!_0x15fee2[_0x79db('0x10')]||!_0x15fee2[_0x79db('0x38')]||!_0x15fee2[_0x79db('0x26')]){throw new db['Sequelize'][(_0x79db('0x23'))](_0x79db('0x46'));}return db[_0x79db('0x29')][_0x79db('0x2a')]({'where':{'id':_0x15fee2[_0x79db('0x45')]}});})[_0x79db('0x11')](function(_0x1862f6){if(!_0x1862f6){throw new db[(_0x79db('0x27'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1862f6['data1']||!_0x1862f6[_0x79db('0xf')]){throw new db[(_0x79db('0x27'))][(_0x79db('0x23'))](_0x79db('0x2c'));}_0x9515fc=_0x1862f6;var _0x5ed90a=[];_0x1f703e[_0x79db('0x47')](function(_0x4f0a78){_0x5ed90a[_0x79db('0x48')](checkTranscribeJob(_0x4f0a78,_0x15fee2,_0x9515fc));});return BPromise[_0x79db('0x49')](_0x5ed90a);})[_0x79db('0x3c')](function(_0x3ebda4){if(_0x3ebda4){if(!_0x3ebda4['name']||_0x3ebda4[_0x79db('0x3d')]!==_0x79db('0x3e')){logger['error'](util[_0x79db('0x41')](_0x3ebda4,{'showHidden':![],'depth':null}));}}});}exports['start']=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 124fd63..11e5aea 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 _0xd1fd=['map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xd1fd,0xa1));var _0xdd1f=function(_0x4d3a9b,_0x20b47d){_0x4d3a9b=_0x4d3a9b-0x0;var _0x1b5471=_0xd1fd[_0x4d3a9b];return _0x1b5471;};'use strict';var _=require(_0xdd1f('0x0'));var moment=require(_0xdd1f('0x1'));var Redis=require('ioredis');var util=require(_0xdd1f('0x2'));var config=require(_0xdd1f('0x3'));var db=require(_0xdd1f('0x4'))['db'];var logger=require('../logger')('schedule');config[_0xdd1f('0x5')]=_['defaults'](config['redis'],{'host':_0xdd1f('0x6'),'port':0x18eb});var io=require(_0xdd1f('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x4ce535=[];return db[_0xdd1f('0x8')][_0xdd1f('0x9')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xdd1f('0xa')](0x18,_0xdd1f('0xb'))}}})[_0xdd1f('0xc')](function(_0x22c111){if(_0x22c111&&_0x22c111['length']){_0x4ce535=_[_0xdd1f('0xd')](_0x22c111||[],'id');logger[_0xdd1f('0xe')](_0xdd1f('0xf'),_0x4ce535[_0xdd1f('0x10')]());return db['WhatsappInteraction'][_0xdd1f('0x11')]({'closeReason':_0xdd1f('0x12'),'disposition':_0xdd1f('0x13'),'closed':!![],'closedAt':moment()[_0xdd1f('0x14')](_0xdd1f('0x15'))},{'where':{'id':_0x4ce535}});}})[_0xdd1f('0xc')](function(){if(_0x4ce535&&_0x4ce535[_0xdd1f('0x16')]){logger[_0xdd1f('0xe')](_0xdd1f('0x17'),_0x4ce535[_0xdd1f('0x10')]());for(var _0x1384a0=0x0;_0x1384a0<_0x4ce535[_0xdd1f('0x16')];_0x1384a0++){io[_0xdd1f('0x18')](_0xdd1f('0x19'),{'id':_0x4ce535[_0x1384a0],'closed':!![]});}}})['catch'](function(_0x34c37f){logger[_0xdd1f('0x1a')](_0xdd1f('0x1b'),_0x34c37f?util[_0xdd1f('0x1c')](_0x34c37f,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xef0a=['join','update','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:'];(function(_0x1c4cd1,_0x447f9d){var _0x53e576=function(_0x57e80b){while(--_0x57e80b){_0x1c4cd1['push'](_0x1c4cd1['shift']());}};_0x53e576(++_0x447f9d);}(_0xef0a,0xdd));var _0xaef0=function(_0x5891d0,_0x375acf){_0x5891d0=_0x5891d0-0x0;var _0x42ace1=_0xef0a[_0x5891d0];return _0x42ace1;};'use strict';var _=require(_0xaef0('0x0'));var moment=require(_0xaef0('0x1'));var Redis=require(_0xaef0('0x2'));var util=require(_0xaef0('0x3'));var config=require(_0xaef0('0x4'));var db=require(_0xaef0('0x5'))['db'];var logger=require(_0xaef0('0x6'))(_0xaef0('0x7'));config[_0xaef0('0x8')]=_[_0xaef0('0x9')](config[_0xaef0('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xaef0('0xa'))(new Redis(config[_0xaef0('0x8')]));function closeInteractions(){var _0x273fae=[];return db[_0xaef0('0xb')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xaef0('0xc')](0x18,_0xaef0('0xd'))}}})[_0xaef0('0xe')](function(_0x280d93){if(_0x280d93&&_0x280d93[_0xaef0('0xf')]){_0x273fae=_[_0xaef0('0x10')](_0x280d93||[],'id');logger[_0xaef0('0x11')](_0xaef0('0x12'),_0x273fae[_0xaef0('0x13')]());return db['WhatsappInteraction'][_0xaef0('0x14')]({'closeReason':_0xaef0('0x15'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xaef0('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x273fae}});}})['then'](function(){if(_0x273fae&&_0x273fae[_0xaef0('0xf')]){logger[_0xaef0('0x11')](_0xaef0('0x17'),_0x273fae[_0xaef0('0x13')]());for(var _0x20e24e=0x0;_0x20e24e<_0x273fae[_0xaef0('0xf')];_0x20e24e++){io[_0xaef0('0x18')](_0xaef0('0x19'),{'id':_0x273fae[_0x20e24e],'closed':!![]});}}})[_0xaef0('0x1a')](function(_0x426e82){logger[_0xaef0('0x1b')](_0xaef0('0x1c'),_0x426e82?util[_0xaef0('0x1d')](_0x426e82,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index cf1d73d..608d743 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a16=['contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1'];(function(_0x31130d,_0x54c773){var _0x177f9f=function(_0x830c){while(--_0x830c){_0x31130d['push'](_0x31130d['shift']());}};_0x177f9f(++_0x54c773);}(_0x7a16,0x11b));var _0x67a1=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7a16[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x67a1('0x0'));var db=require(_0x67a1('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x67a1('0x2')]({'id':i,'firstName':_0x67a1('0x3')+i,'lastName':_0x67a1('0x4')+i,'phone':0xf879fb460+i,'email':_0x67a1('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x67a1('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x67a1('0x6')](),'updatedAt':Date[_0x67a1('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x67a1('0x3')+i,'lastName':_0x67a1('0x4')+i,'phone':0xf879fb460+i,'email':_0x67a1('0x5')+i+_0x67a1('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x67a1('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x67a1('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x67a1('0x6')](),'updatedAt':Date['now']()});}db[_0x67a1('0x8')][_0x67a1('0x9')]({'where':{}})[_0x67a1('0xa')](function(){return db[_0x67a1('0x8')][_0x67a1('0xb')](contacts);})['then'](function(){console[_0x67a1('0xc')](_0x67a1('0xd'),_0x67a1('0xe'));return db[_0x67a1('0xf')][_0x67a1('0x9')]({'where':{}});})[_0x67a1('0xa')](function(){return db[_0x67a1('0xf')]['bulkCreate'](hopper);})['then'](function(){console[_0x67a1('0xc')]('finished\x20populating',_0x67a1('0x10'));return db[_0x67a1('0x8')][_0x67a1('0xb')](contacts2);})[_0x67a1('0xa')](function(){console['log']('finished\x20populating',_0x67a1('0x11'));return db['CmHopper'][_0x67a1('0xb')](hopper2);})[_0x67a1('0xa')](function(){console[_0x67a1('0xc')](_0x67a1('0xd'),_0x67a1('0x12'));})[_0x67a1('0x13')](function(_0x5d330e){console[_0x67a1('0xc')](_0x5d330e);}); \ No newline at end of file +var _0x61ef=['destroy','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','now','CmContact','bulkCreate','then','log','contacts1','CmHopper'];(function(_0x3bafe6,_0x3432b7){var _0x30bc43=function(_0x1e8389){while(--_0x1e8389){_0x3bafe6['push'](_0x3bafe6['shift']());}};_0x30bc43(++_0x3432b7);}(_0x61ef,0x149));var _0xf61e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x61ef[_0x4ae6ef];return _0x3cbb4e;};'use strict';var util=require(_0xf61e('0x0'));var db=require(_0xf61e('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf61e('0x2')]({'id':i,'firstName':_0xf61e('0x3')+i,'lastName':_0xf61e('0x4')+i,'phone':0xf879fb460+i,'email':_0xf61e('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xf61e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf61e('0x6')](),'updatedAt':Date[_0xf61e('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xf61e('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf61e('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xf61e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf61e('0x6')](),'updatedAt':Date[_0xf61e('0x6')]()});}db['CmContact']['destroy']({'where':{}})['then'](function(){return db[_0xf61e('0x7')][_0xf61e('0x8')](contacts);})[_0xf61e('0x9')](function(){console[_0xf61e('0xa')]('finished\x20populating',_0xf61e('0xb'));return db[_0xf61e('0xc')][_0xf61e('0xd')]({'where':{}});})['then'](function(){return db[_0xf61e('0xc')][_0xf61e('0x8')](hopper);})[_0xf61e('0x9')](function(){console['log'](_0xf61e('0xe'),_0xf61e('0xf'));return db[_0xf61e('0x7')][_0xf61e('0x8')](contacts2);})[_0xf61e('0x9')](function(){console['log']('finished\x20populating',_0xf61e('0x10'));return db['CmHopper'][_0xf61e('0x8')](hopper2);})[_0xf61e('0x9')](function(){console['log'](_0xf61e('0xe'),_0xf61e('0x11'));})[_0xf61e('0x12')](function(_0x5eda4b){console[_0xf61e('0xa')](_0x5eda4b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 13fdc69..6b816e2 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x681e=['agent','%s%s@xcally.com','password','friend','udp','all','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','util','push','format','%s%s'];(function(_0x4e44d6,_0x395d6d){var _0x1f328c=function(_0x425e5a){while(--_0x425e5a){_0x4e44d6['push'](_0x4e44d6['shift']());}};_0x1f328c(++_0x395d6d);}(_0x681e,0x68));var _0xe681=function(_0x14e677,_0x3ff38a){_0x14e677=_0x14e677-0x0;var _0x4df163=_0x681e[_0x14e677];return _0x4df163;};'use strict';var util=require(_0xe681('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe681('0x1')]({'name':util[_0xe681('0x2')](_0xe681('0x3'),_0xe681('0x4'),i),'fullname':util[_0xe681('0x2')]('%s%s',_0xe681('0x4'),i),'email':util[_0xe681('0x2')](_0xe681('0x5'),_0xe681('0x4'),i),'role':_0xe681('0x4'),'password':_0xe681('0x6'),'internal':0xfa0+i,'type':_0xe681('0x7'),'transport':[_0xe681('0x8'),'ws','wss'],'disallow':[_0xe681('0x9')],'allow':['ulaw'],'defaultuser':util[_0xe681('0x2')](_0xe681('0x3'),_0xe681('0x4'),i),'encryption':_0xe681('0xa'),'avpf':_0xe681('0xa'),'force_avp':_0xe681('0xa'),'icesupport':_0xe681('0xa'),'dtlsenable':_0xe681('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xe681('0xb'),'dtlssetup':_0xe681('0xc'),'callerid':util['format'](_0xe681('0xd'),util['format']('%s%s',_0xe681('0x4'),i),0xfa0+i)});}db[_0xe681('0xe')][_0xe681('0xf')](users)[_0xe681('0x10')](function(){console[_0xe681('0x11')]('add\x20user');})['catch'](function(_0x4fd4c7){console[_0xe681('0x11')](_0x4fd4c7);}); \ No newline at end of file +var _0xa9f9=['%s%s','friend','udp','wss','all','format','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','agent'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xa9f9,0x153));var _0x9a9f=function(_0x16549e,_0x909b52){_0x16549e=_0x16549e-0x0;var _0x44c1e4=_0xa9f9[_0x16549e];return _0x44c1e4;};'use strict';var util=require(_0x9a9f('0x0'));var db=require(_0x9a9f('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s',_0x9a9f('0x2'),i),'fullname':util['format'](_0x9a9f('0x3'),_0x9a9f('0x2'),i),'email':util['format']('%s%s@xcally.com',_0x9a9f('0x2'),i),'role':_0x9a9f('0x2'),'password':'password','internal':0xfa0+i,'type':_0x9a9f('0x4'),'transport':[_0x9a9f('0x5'),'ws',_0x9a9f('0x6')],'disallow':[_0x9a9f('0x7')],'allow':['ulaw'],'defaultuser':util[_0x9a9f('0x8')]('%s%s',_0x9a9f('0x2'),i),'encryption':_0x9a9f('0x9'),'avpf':_0x9a9f('0x9'),'force_avp':'yes','icesupport':_0x9a9f('0x9'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x9a9f('0xa'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x9a9f('0xb'),'callerid':util[_0x9a9f('0x8')](_0x9a9f('0xc'),util[_0x9a9f('0x8')](_0x9a9f('0x3'),_0x9a9f('0x2'),i),0xfa0+i)});}db['User'][_0x9a9f('0xd')](users)[_0x9a9f('0xe')](function(){console[_0x9a9f('0xf')](_0x9a9f('0x10'));})[_0x9a9f('0x11')](function(_0x467444){console[_0x9a9f('0xf')](_0x467444);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 71f2b79..06ec526 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ce9=['length','voice','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','map','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','request','remoteAddress','SocketIO\x20','nsp','address','disconnect','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','UserProfileSection','then','autoAssociation','OpenchannelQueues','WhatsappQueues','findAll','IvrCampaigns','resourceId','where','type','ivr','format','%s:queue:%s','user:%s','handshake','find','userProfileId','query','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','voice:inbound','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','Telephones','Trunks','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x3ce9,0x85));var _0x93ce=function(_0x390083,_0x31ba26){_0x390083=_0x390083-0x0;var _0x41a4db=_0x3ce9[_0x390083];return _0x41a4db;};'use strict';var _=require(_0x93ce('0x0'));var util=require('util');var BPromise=require(_0x93ce('0x1'));var db=require(_0x93ce('0x2'))['db'];var config=require(_0x93ce('0x3'));var queryQueues={'attributes':['id',_0x93ce('0x4')],'include':[{'as':_0x93ce('0x5'),'model':db[_0x93ce('0x6')],'attributes':['id','name',_0x93ce('0x7')],'raw':!![],'where':{'role':_0x93ce('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x93ce('0x4')],'where':{'role':_0x93ce('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x93ce('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x93ce('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x93ce('0x4'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x5769fb,_0xfa433,_0x5e3f70){return db[_0x93ce('0xa')]['findOne']({'where':{'name':_0x5769fb,'userProfileId':_0xfa433},'raw':!![]})[_0x93ce('0xb')](function(_0x5a125f){if(_0x5a125f){if(_0x5a125f[_0x93ce('0xc')]){switch(_0x5769fb){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case'SmsQueues':case'MailQueues':case _0x93ce('0xd'):case _0x93ce('0xe'):return db[_0x5e3f70][_0x93ce('0xf')](queryQueues);case'Telephones':return db[_0x5e3f70][_0x93ce('0xf')](queryTelephones);case'Trunks':return db[_0x5e3f70][_0x93ce('0xf')](queryTrunks);case _0x93ce('0x10'):return db[_0x5e3f70]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0x93ce('0xf')]({'attributes':['resourceId'],'where':{'sectionId':_0x5a125f['id']},'raw':!![]})[_0x93ce('0xb')](function(_0x4bc3e1){if(_0x4bc3e1){var _0xecc51b={'where':{'id':_['map'](_0x4bc3e1,_0x93ce('0x11'))},'raw':!![]};switch(_0x5e3f70){case _0x93ce('0x6'):_0xecc51b[_0x93ce('0x12')][_0x93ce('0x7')]=_0x93ce('0x9');break;case'Campaign':_0xecc51b[_0x93ce('0x12')][_0x93ce('0x13')]=_0x93ce('0x14');break;}return db[_0x5e3f70][_0x93ce('0xf')](_0xecc51b);}else{return[];}});}}else{return[];}})[_0x93ce('0xb')](function(_0x25be3b){return _0x25be3b;});}function joinOrLeaveQueues(_0x48929e,_0x4d33de,_0x10cdb5,_0x31d670){_0x48929e[_0x4d33de](util[_0x93ce('0x15')](_0x93ce('0x16'),_0x10cdb5,_0x31d670[_0x93ce('0x4')]));if(_0x31d670[_0x93ce('0x5')]){for(var _0x114527=0x0;_0x114527<_0x31d670[_0x93ce('0x5')]['length'];_0x114527+=0x1){_0x48929e[_0x4d33de](util[_0x93ce('0x15')](_0x93ce('0x17'),_0x31d670[_0x93ce('0x5')][_0x114527][_0x93ce('0x4')]));}}}function joinOrLeave(_0x5de144,_0x1aa60d,_0x49ecf4){var _0xcb26b3;if(_0x5de144[_0x93ce('0x18')]['query']['id']){db[_0x93ce('0x6')][_0x93ce('0x19')]({'attributes':['id',_0x93ce('0x4'),_0x93ce('0x7'),_0x93ce('0x1a')],'where':{'id':_0x5de144[_0x93ce('0x18')][_0x93ce('0x1b')]['id']},'include':[{'model':db[_0x93ce('0x1c')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x93ce('0x1d')],'as':_0x93ce('0x1e'),'attributes':['id'],'raw':!![]},{'model':db[_0x93ce('0x1f')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x93ce('0x20')],'as':_0x93ce('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x93ce('0x22')],'as':_0x93ce('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x93ce('0x24')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x93ce('0xb')](function(_0x212e9e){if(_0x212e9e){_0xcb26b3=_0x212e9e;_0x5de144[_0x1aa60d](util[_0x93ce('0x15')]('user:%s',_0x212e9e[_0x93ce('0x4')]));var _0xd51f28=[];switch(_0x212e9e[_0x93ce('0x7')]){case _0x93ce('0x25'):_0x5de144[_0x1aa60d]('voice:inbound');_0x5de144[_0x1aa60d](_0x93ce('0x26'));if(queryQueues[_0x93ce('0x27')](_0x93ce('0x28'))){delete queryQueues[_0x93ce('0x28')];}_0xd51f28[_0x93ce('0x29')](db['VoiceQueue'][_0x93ce('0xf')](queryQueues));_0xd51f28['push'](db[_0x93ce('0x2a')][_0x93ce('0xf')](queryQueues));_0xd51f28['push'](db[_0x93ce('0x2b')][_0x93ce('0xf')](queryQueues));_0xd51f28[_0x93ce('0x29')](db[_0x93ce('0x2c')][_0x93ce('0xf')](queryQueues));_0xd51f28[_0x93ce('0x29')](db[_0x93ce('0x2d')]['findAll'](queryQueues));_0xd51f28['push'](db[_0x93ce('0x2e')][_0x93ce('0xf')](queryQueues));_0xd51f28[_0x93ce('0x29')](db[_0x93ce('0x2f')][_0x93ce('0xf')](queryQueues));_0xd51f28[_0x93ce('0x29')](db[_0x93ce('0x6')][_0x93ce('0xf')](queryTelephones));_0xd51f28[_0x93ce('0x29')](db[_0x93ce('0x30')][_0x93ce('0xf')](queryTrunks));_0xd51f28['push'](db[_0x93ce('0x31')][_0x93ce('0xf')](queryCampaigns));_0xd51f28[_0x93ce('0x29')](db[_0x93ce('0x6')][_0x93ce('0xf')](queryAgents));break;case _0x93ce('0x32'):_0x5de144[_0x1aa60d](_0x93ce('0x33'));_0x5de144[_0x1aa60d](_0x93ce('0x26'));_0xd51f28['push'](getAssociatedResources(_0x93ce('0x34'),_0x212e9e[_0x93ce('0x1a')],'VoiceQueue'));_0xd51f28['push'](getAssociatedResources(_0x93ce('0x35'),_0x212e9e[_0x93ce('0x1a')],_0x93ce('0x2a')));_0xd51f28[_0x93ce('0x29')](getAssociatedResources(_0x93ce('0x36'),_0x212e9e[_0x93ce('0x1a')],_0x93ce('0x2b')));_0xd51f28[_0x93ce('0x29')](getAssociatedResources(_0x93ce('0x37'),_0x212e9e[_0x93ce('0x1a')],_0x93ce('0x2c')));_0xd51f28[_0x93ce('0x29')](getAssociatedResources(_0x93ce('0x38'),_0x212e9e[_0x93ce('0x1a')],'MailQueue'));_0xd51f28[_0x93ce('0x29')](getAssociatedResources(_0x93ce('0xd'),_0x212e9e['userProfileId'],'OpenchannelQueue'));_0xd51f28[_0x93ce('0x29')](getAssociatedResources(_0x93ce('0xe'),_0x212e9e[_0x93ce('0x1a')],_0x93ce('0x2f')));_0xd51f28['push'](getAssociatedResources(_0x93ce('0x39'),_0x212e9e[_0x93ce('0x1a')],_0x93ce('0x6')));_0xd51f28[_0x93ce('0x29')](getAssociatedResources(_0x93ce('0x3a'),_0x212e9e[_0x93ce('0x1a')],_0x93ce('0x30')));_0xd51f28['push'](getAssociatedResources(_0x93ce('0x10'),_0x212e9e[_0x93ce('0x1a')],_0x93ce('0x31')));_0xd51f28[_0x93ce('0x29')](db['User'][_0x93ce('0xf')](queryAgents));break;case'agent':_0x5de144[_0x1aa60d](_0x93ce('0x33'));_0x5de144[_0x1aa60d]('voice:outbound');_0xd51f28[_0x93ce('0x29')](_0x212e9e['getVoiceQueues']({'attributes':['id','name']}));_0xd51f28[_0x93ce('0x29')](_0x212e9e[_0x93ce('0x3b')]({'attributes':['id',_0x93ce('0x4')]}));_0xd51f28['push'](_0x212e9e['getFaxQueues']({'attributes':['id',_0x93ce('0x4')]}));_0xd51f28[_0x93ce('0x29')](_0x212e9e[_0x93ce('0x3c')]({'attributes':['id',_0x93ce('0x4')]}));_0xd51f28['push'](_0x212e9e[_0x93ce('0x3d')]({'attributes':['id',_0x93ce('0x4')]}));_0xd51f28[_0x93ce('0x29')](_0x212e9e['getOpenchannelQueues']({'attributes':['id',_0x93ce('0x4')]}));_0xd51f28[_0x93ce('0x29')](_0x212e9e[_0x93ce('0x3e')]({'attributes':['id',_0x93ce('0x4')]}));break;}return BPromise['all'](_0xd51f28);}})[_0x93ce('0xb')](function(_0x216978){if(_0x216978&&_0x216978[_0x93ce('0x3f')]){for(var _0x2ee877=0x0;_0x2ee877<_0x216978[_0x93ce('0x3f')];_0x2ee877+=0x1){for(var _0x44e249=0x0;_0x44e249<_0x216978[_0x2ee877][_0x93ce('0x3f')];_0x44e249+=0x1){switch(_0x2ee877){case 0x0:joinOrLeaveQueues(_0x5de144,_0x1aa60d,_0x93ce('0x40'),_0x216978[_0x2ee877][_0x44e249]);break;case 0x1:joinOrLeaveQueues(_0x5de144,_0x1aa60d,'chat',_0x216978[_0x2ee877][_0x44e249]);break;case 0x2:joinOrLeaveQueues(_0x5de144,_0x1aa60d,'fax',_0x216978[_0x2ee877][_0x44e249]);break;case 0x3:joinOrLeaveQueues(_0x5de144,_0x1aa60d,_0x93ce('0x41'),_0x216978[_0x2ee877][_0x44e249]);break;case 0x4:joinOrLeaveQueues(_0x5de144,_0x1aa60d,_0x93ce('0x42'),_0x216978[_0x2ee877][_0x44e249]);break;case 0x5:joinOrLeaveQueues(_0x5de144,_0x1aa60d,'openchannel',_0x216978[_0x2ee877][_0x44e249]);break;case 0x6:joinOrLeaveQueues(_0x5de144,_0x1aa60d,_0x93ce('0x43'),_0x216978[_0x2ee877][_0x44e249]);break;case 0x7:if(_0xcb26b3['role']!==_0x93ce('0x8'))_0x5de144[_0x1aa60d](util[_0x93ce('0x15')](_0x93ce('0x44'),_0x216978[_0x2ee877][_0x44e249][_0x93ce('0x4')]));break;case 0x8:if(_0xcb26b3[_0x93ce('0x7')]!==_0x93ce('0x8'))_0x5de144[_0x1aa60d](util[_0x93ce('0x15')](_0x93ce('0x45'),_0x216978[_0x2ee877][_0x44e249][_0x93ce('0x4')]));break;case 0x9:if(_0xcb26b3[_0x93ce('0x7')]!=='agent')_0x5de144[_0x1aa60d](util[_0x93ce('0x15')](_0x93ce('0x46'),_0x216978[_0x2ee877][_0x44e249][_0x93ce('0x13')],_0x216978[_0x2ee877][_0x44e249][_0x93ce('0x4')]));break;case 0xa:_0x5de144[_0x1aa60d](util[_0x93ce('0x15')](_0x93ce('0x17'),_0x216978[_0x2ee877][_0x44e249][_0x93ce('0x4')]));break;}}}}})[_0x93ce('0xb')](function(){if(_0x1aa60d===_0x93ce('0x47')){var _0x469665=_[_0x93ce('0x48')](_0xcb26b3[_0x93ce('0x49')],'id');return _0xcb26b3[_0x93ce('0x4a')](_0x469665)['then'](function(){for(var _0xf66210=0x0;_0xf66210<_0x469665[_0x93ce('0x3f')];_0xf66210+=0x1){_0x49ecf4[_0x93ce('0x4b')](_0x93ce('0x4c'),{'ChatInteractionId':Number(_0x469665[_0xf66210]),'UserId':Number(_0xcb26b3['id'])});}});}})[_0x93ce('0xb')](function(){if(_0x1aa60d===_0x93ce('0x47')){var _0x26c023=_[_0x93ce('0x48')](_0xcb26b3[_0x93ce('0x1e')],'id');return _0xcb26b3[_0x93ce('0x4d')](_0x26c023)['then'](function(){for(var _0x38c394=0x0;_0x38c394<_0x26c023[_0x93ce('0x3f')];_0x38c394+=0x1){_0x49ecf4[_0x93ce('0x4b')](_0x93ce('0x4e'),{'MailInteractionId':Number(_0x26c023[_0x38c394]),'UserId':Number(_0xcb26b3['id'])});}});}})[_0x93ce('0xb')](function(){if(_0x1aa60d===_0x93ce('0x47')){var _0x1e7e17=_[_0x93ce('0x48')](_0xcb26b3[_0x93ce('0x4f')],'id');return _0xcb26b3[_0x93ce('0x50')](_0x1e7e17)['then'](function(){for(var _0x32a543=0x0;_0x32a543<_0x1e7e17[_0x93ce('0x3f')];_0x32a543+=0x1){_0x49ecf4[_0x93ce('0x4b')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x1e7e17[_0x32a543]),'UserId':Number(_0xcb26b3['id'])});}});}})[_0x93ce('0xb')](function(){if(_0x1aa60d===_0x93ce('0x47')){var _0x72630a=_[_0x93ce('0x48')](_0xcb26b3[_0x93ce('0x21')],'id');return _0xcb26b3['removeSmsInteractions'](_0x72630a)['then'](function(){for(var _0x241c93=0x0;_0x241c93<_0x72630a[_0x93ce('0x3f')];_0x241c93+=0x1){_0x49ecf4['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x72630a[_0x241c93]),'UserId':Number(_0xcb26b3['id'])});}});}})[_0x93ce('0xb')](function(){if(_0x1aa60d===_0x93ce('0x47')){var _0x41c22c=_['map'](_0xcb26b3[_0x93ce('0x23')],'id');return _0xcb26b3[_0x93ce('0x51')](_0x41c22c)[_0x93ce('0xb')](function(){for(var _0x111df1=0x0;_0x111df1<_0x41c22c[_0x93ce('0x3f')];_0x111df1+=0x1){_0x49ecf4[_0x93ce('0x4b')](_0x93ce('0x52'),{'OpenchannelInteractionId':Number(_0x41c22c[_0x111df1]),'UserId':Number(_0xcb26b3['id'])});}});}})[_0x93ce('0xb')](function(){if(_0x1aa60d==='leave'){var _0x26f86c=_[_0x93ce('0x48')](_0xcb26b3[_0x93ce('0x53')],'id');return _0xcb26b3[_0x93ce('0x54')](_0x26f86c)[_0x93ce('0xb')](function(){for(var _0x50e783=0x0;_0x50e783<_0x26f86c[_0x93ce('0x3f')];_0x50e783+=0x1){_0x49ecf4[_0x93ce('0x4b')](_0x93ce('0x55'),{'WhatsappInteractionId':Number(_0x26f86c[_0x50e783]),'UserId':Number(_0xcb26b3['id'])});}});}})[_0x93ce('0x56')](function(_0x300ffa){_0x5de144[_0x93ce('0x57')](_0x300ffa);});}}function onDisconnect(_0x396963,_0x5298ab){joinOrLeave(_0x396963,'leave',_0x5298ab);}function onConnect(_0x54bf86){joinOrLeave(_0x54bf86,_0x93ce('0x58'));}exports[_0x93ce('0x59')]=function(_0x4b8d72){_0x4b8d72['on'](_0x93ce('0x5a'),function(_0x310425){_0x310425['setMaxListeners'](0x0);_0x310425['address']=_0x310425[_0x93ce('0x5b')][_0x93ce('0x5a')][_0x93ce('0x5c')]+':'+_0x310425['request']['connection']['remotePort'];_0x310425['connectedAt']=new Date();_0x310425['log']=function(_0x18249f){console['log'](_0x93ce('0x5d')+_0x310425[_0x93ce('0x5e')][_0x93ce('0x4')]+'['+_0x310425[_0x93ce('0x5f')]+']',_0x18249f);};_0x310425['on'](_0x93ce('0x60'),function(){onDisconnect(_0x310425,_0x4b8d72);_0x310425[_0x93ce('0x57')]('DISCONNECTED');});onConnect(_0x310425);_0x310425[_0x93ce('0x57')](_0x93ce('0x61'));});}; \ No newline at end of file +var _0x8101=['telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','role','format','%s:queue:%s','length','user:%s','handshake','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','VoiceQueue','SmsQueues','MailQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','voice','chat','fax','sms','mail','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x8101,0xc0));var _0x1810=function(_0x357a01,_0x1e57d0){_0x357a01=_0x357a01-0x0;var _0x252c1f=_0x8101[_0x357a01];return _0x252c1f;};'use strict';var _=require(_0x1810('0x0'));var util=require(_0x1810('0x1'));var BPromise=require(_0x1810('0x2'));var db=require(_0x1810('0x3'))['db'];var config=require(_0x1810('0x4'));var queryQueues={'attributes':['id',_0x1810('0x5')],'include':[{'as':_0x1810('0x6'),'model':db[_0x1810('0x7')],'attributes':['id',_0x1810('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x1810('0x5')],'where':{'role':_0x1810('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x1810('0x5')],'where':{'role':_0x1810('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x1810('0x5'),_0x1810('0xa')],'where':{'type':_0x1810('0xb')}};function getAssociatedResources(_0x271738,_0x197255,_0x2dde85){return db[_0x1810('0xc')][_0x1810('0xd')]({'where':{'name':_0x271738,'userProfileId':_0x197255},'raw':!![]})[_0x1810('0xe')](function(_0x5126d2){if(_0x5126d2){if(_0x5126d2[_0x1810('0xf')]){switch(_0x271738){case _0x1810('0x10'):case'ChatQueues':case _0x1810('0x11'):case'SmsQueues':case'MailQueues':case _0x1810('0x12'):case _0x1810('0x13'):return db[_0x2dde85][_0x1810('0x14')](queryQueues);case _0x1810('0x15'):return db[_0x2dde85][_0x1810('0x14')](queryTelephones);case _0x1810('0x16'):return db[_0x2dde85]['findAll'](queryTrunks);case _0x1810('0x17'):return db[_0x2dde85][_0x1810('0x14')](queryCampaigns);}}else{return db['UserProfileResource']['findAll']({'attributes':[_0x1810('0x18')],'where':{'sectionId':_0x5126d2['id']},'raw':!![]})['then'](function(_0x187dca){if(_0x187dca){var _0xbdebf5={'where':{'id':_[_0x1810('0x19')](_0x187dca,_0x1810('0x18'))},'raw':!![]};switch(_0x2dde85){case _0x1810('0x7'):_0xbdebf5[_0x1810('0x1a')][_0x1810('0x1b')]='telephone';break;case'Campaign':_0xbdebf5['where'][_0x1810('0xa')]='ivr';break;}return db[_0x2dde85][_0x1810('0x14')](_0xbdebf5);}else{return[];}});}}else{return[];}})[_0x1810('0xe')](function(_0x3876b0){return _0x3876b0;});}function joinOrLeaveQueues(_0x27c51b,_0x57477e,_0x1490c3,_0x5c8c36){_0x27c51b[_0x57477e](util[_0x1810('0x1c')](_0x1810('0x1d'),_0x1490c3,_0x5c8c36['name']));if(_0x5c8c36[_0x1810('0x6')]){for(var _0x42672f=0x0;_0x42672f<_0x5c8c36[_0x1810('0x6')][_0x1810('0x1e')];_0x42672f+=0x1){_0x27c51b[_0x57477e](util[_0x1810('0x1c')](_0x1810('0x1f'),_0x5c8c36['Agents'][_0x42672f][_0x1810('0x5')]));}}}function joinOrLeave(_0x198bbc,_0x254062,_0x77b5ed){var _0x53ca63;if(_0x198bbc[_0x1810('0x20')]['query']['id']){db['User'][_0x1810('0x21')]({'attributes':['id',_0x1810('0x5'),_0x1810('0x1b'),_0x1810('0x22')],'where':{'id':_0x198bbc[_0x1810('0x20')]['query']['id']},'include':[{'model':db[_0x1810('0x23')],'as':_0x1810('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x1810('0x25')],'as':_0x1810('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x1810('0x27')],'as':_0x1810('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x1810('0x29')],'as':_0x1810('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x1810('0x2b')],'as':_0x1810('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x1810('0xe')](function(_0x3e122b){if(_0x3e122b){_0x53ca63=_0x3e122b;_0x198bbc[_0x254062](util[_0x1810('0x1c')](_0x1810('0x1f'),_0x3e122b[_0x1810('0x5')]));var _0x223638=[];switch(_0x3e122b[_0x1810('0x1b')]){case'admin':_0x198bbc[_0x254062](_0x1810('0x2d'));_0x198bbc[_0x254062](_0x1810('0x2e'));if(queryQueues[_0x1810('0x2f')](_0x1810('0x30'))){delete queryQueues[_0x1810('0x30')];}_0x223638[_0x1810('0x31')](db['VoiceQueue'][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x32')][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db['FaxQueue'][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x33')]['findAll'](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x34')][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x35')][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x36')][_0x1810('0x14')](queryQueues));_0x223638[_0x1810('0x31')](db[_0x1810('0x7')][_0x1810('0x14')](queryTelephones));_0x223638[_0x1810('0x31')](db[_0x1810('0x37')][_0x1810('0x14')](queryTrunks));_0x223638['push'](db[_0x1810('0x38')]['findAll'](queryCampaigns));_0x223638['push'](db[_0x1810('0x7')][_0x1810('0x14')](queryAgents));break;case'user':_0x198bbc[_0x254062](_0x1810('0x2d'));_0x198bbc[_0x254062](_0x1810('0x2e'));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x10'),_0x3e122b[_0x1810('0x22')],_0x1810('0x39')));_0x223638[_0x1810('0x31')](getAssociatedResources('ChatQueues',_0x3e122b[_0x1810('0x22')],_0x1810('0x32')));_0x223638['push'](getAssociatedResources('FaxQueues',_0x3e122b[_0x1810('0x22')],'FaxQueue'));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x3a'),_0x3e122b[_0x1810('0x22')],_0x1810('0x33')));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x3b'),_0x3e122b[_0x1810('0x22')],_0x1810('0x34')));_0x223638[_0x1810('0x31')](getAssociatedResources('OpenchannelQueues',_0x3e122b[_0x1810('0x22')],'OpenchannelQueue'));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x13'),_0x3e122b[_0x1810('0x22')],_0x1810('0x36')));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x15'),_0x3e122b[_0x1810('0x22')],_0x1810('0x7')));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x16'),_0x3e122b['userProfileId'],_0x1810('0x37')));_0x223638[_0x1810('0x31')](getAssociatedResources(_0x1810('0x17'),_0x3e122b['userProfileId'],_0x1810('0x38')));_0x223638[_0x1810('0x31')](db[_0x1810('0x7')][_0x1810('0x14')](queryAgents));break;case _0x1810('0x9'):_0x198bbc[_0x254062](_0x1810('0x2d'));_0x198bbc[_0x254062]('voice:outbound');_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x3c')]({'attributes':['id',_0x1810('0x5')]}));_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x3d')]({'attributes':['id','name']}));_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x3e')]({'attributes':['id',_0x1810('0x5')]}));_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x3f')]({'attributes':['id',_0x1810('0x5')]}));_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x40')]({'attributes':['id',_0x1810('0x5')]}));_0x223638[_0x1810('0x31')](_0x3e122b[_0x1810('0x41')]({'attributes':['id','name']}));_0x223638[_0x1810('0x31')](_0x3e122b['getWhatsappQueues']({'attributes':['id',_0x1810('0x5')]}));break;}return BPromise['all'](_0x223638);}})[_0x1810('0xe')](function(_0x18b946){if(_0x18b946&&_0x18b946[_0x1810('0x1e')]){for(var _0x2f3c21=0x0;_0x2f3c21<_0x18b946[_0x1810('0x1e')];_0x2f3c21+=0x1){for(var _0x9446e9=0x0;_0x9446e9<_0x18b946[_0x2f3c21][_0x1810('0x1e')];_0x9446e9+=0x1){switch(_0x2f3c21){case 0x0:joinOrLeaveQueues(_0x198bbc,_0x254062,_0x1810('0x42'),_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x1:joinOrLeaveQueues(_0x198bbc,_0x254062,_0x1810('0x43'),_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x2:joinOrLeaveQueues(_0x198bbc,_0x254062,_0x1810('0x44'),_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x3:joinOrLeaveQueues(_0x198bbc,_0x254062,_0x1810('0x45'),_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x4:joinOrLeaveQueues(_0x198bbc,_0x254062,_0x1810('0x46'),_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x5:joinOrLeaveQueues(_0x198bbc,_0x254062,'openchannel',_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x6:joinOrLeaveQueues(_0x198bbc,_0x254062,'whatsapp',_0x18b946[_0x2f3c21][_0x9446e9]);break;case 0x7:if(_0x53ca63[_0x1810('0x1b')]!=='agent')_0x198bbc[_0x254062](util[_0x1810('0x1c')](_0x1810('0x47'),_0x18b946[_0x2f3c21][_0x9446e9]['name']));break;case 0x8:if(_0x53ca63['role']!==_0x1810('0x9'))_0x198bbc[_0x254062](util[_0x1810('0x1c')](_0x1810('0x48'),_0x18b946[_0x2f3c21][_0x9446e9][_0x1810('0x5')]));break;case 0x9:if(_0x53ca63[_0x1810('0x1b')]!=='agent')_0x198bbc[_0x254062](util[_0x1810('0x1c')](_0x1810('0x49'),_0x18b946[_0x2f3c21][_0x9446e9][_0x1810('0xa')],_0x18b946[_0x2f3c21][_0x9446e9][_0x1810('0x5')]));break;case 0xa:_0x198bbc[_0x254062](util[_0x1810('0x1c')](_0x1810('0x1f'),_0x18b946[_0x2f3c21][_0x9446e9][_0x1810('0x5')]));break;}}}}})[_0x1810('0xe')](function(){if(_0x254062===_0x1810('0x4a')){var _0x3eff89=_[_0x1810('0x19')](_0x53ca63['ChatInteractions'],'id');return _0x53ca63[_0x1810('0x4b')](_0x3eff89)[_0x1810('0xe')](function(){for(var _0x236aaa=0x0;_0x236aaa<_0x3eff89[_0x1810('0x1e')];_0x236aaa+=0x1){_0x77b5ed['emit'](_0x1810('0x4c'),{'ChatInteractionId':Number(_0x3eff89[_0x236aaa]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0xe')](function(){if(_0x254062==='leave'){var _0x8b722e=_['map'](_0x53ca63['MailInteractions'],'id');return _0x53ca63[_0x1810('0x4d')](_0x8b722e)['then'](function(){for(var _0x4207c4=0x0;_0x4207c4<_0x8b722e[_0x1810('0x1e')];_0x4207c4+=0x1){_0x77b5ed[_0x1810('0x4e')](_0x1810('0x4f'),{'MailInteractionId':Number(_0x8b722e[_0x4207c4]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0xe')](function(){if(_0x254062===_0x1810('0x4a')){var _0x20eba4=_[_0x1810('0x19')](_0x53ca63[_0x1810('0x50')],'id');return _0x53ca63[_0x1810('0x51')](_0x20eba4)[_0x1810('0xe')](function(){for(var _0x4a71a8=0x0;_0x4a71a8<_0x20eba4['length'];_0x4a71a8+=0x1){_0x77b5ed['emit'](_0x1810('0x52'),{'FaxInteractionId':Number(_0x20eba4[_0x4a71a8]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0xe')](function(){if(_0x254062===_0x1810('0x4a')){var _0x53bec7=_[_0x1810('0x19')](_0x53ca63[_0x1810('0x28')],'id');return _0x53ca63['removeSmsInteractions'](_0x53bec7)[_0x1810('0xe')](function(){for(var _0x2a9cd0=0x0;_0x2a9cd0<_0x53bec7[_0x1810('0x1e')];_0x2a9cd0+=0x1){_0x77b5ed['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x53bec7[_0x2a9cd0]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0xe')](function(){if(_0x254062===_0x1810('0x4a')){var _0x4590c7=_[_0x1810('0x19')](_0x53ca63[_0x1810('0x2a')],'id');return _0x53ca63['removeOpenchannelInteractions'](_0x4590c7)[_0x1810('0xe')](function(){for(var _0x528355=0x0;_0x528355<_0x4590c7[_0x1810('0x1e')];_0x528355+=0x1){_0x77b5ed['emit'](_0x1810('0x53'),{'OpenchannelInteractionId':Number(_0x4590c7[_0x528355]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0xe')](function(){if(_0x254062==='leave'){var _0xd81b16=_['map'](_0x53ca63[_0x1810('0x2c')],'id');return _0x53ca63[_0x1810('0x54')](_0xd81b16)[_0x1810('0xe')](function(){for(var _0x4638d2=0x0;_0x4638d2<_0xd81b16[_0x1810('0x1e')];_0x4638d2+=0x1){_0x77b5ed['emit'](_0x1810('0x55'),{'WhatsappInteractionId':Number(_0xd81b16[_0x4638d2]),'UserId':Number(_0x53ca63['id'])});}});}})[_0x1810('0x56')](function(_0x5a5798){_0x198bbc[_0x1810('0x57')](_0x5a5798);});}}function onDisconnect(_0x5e8b6f,_0x59f35c){joinOrLeave(_0x5e8b6f,_0x1810('0x4a'),_0x59f35c);}function onConnect(_0x116287){joinOrLeave(_0x116287,_0x1810('0x58'));}exports[_0x1810('0x59')]=function(_0x4dfae2){_0x4dfae2['on'](_0x1810('0x5a'),function(_0xb99fa0){_0xb99fa0['setMaxListeners'](0x0);_0xb99fa0[_0x1810('0x5b')]=_0xb99fa0[_0x1810('0x5c')][_0x1810('0x5a')][_0x1810('0x5d')]+':'+_0xb99fa0[_0x1810('0x5c')][_0x1810('0x5a')][_0x1810('0x5e')];_0xb99fa0[_0x1810('0x5f')]=new Date();_0xb99fa0[_0x1810('0x57')]=function(_0x41eaef){console[_0x1810('0x57')](_0x1810('0x60')+_0xb99fa0[_0x1810('0x61')][_0x1810('0x5')]+'['+_0xb99fa0[_0x1810('0x5b')]+']',_0x41eaef);};_0xb99fa0['on']('disconnect',function(){onDisconnect(_0xb99fa0,_0x4dfae2);_0xb99fa0[_0x1810('0x57')](_0x1810('0x62'));});onConnect(_0xb99fa0);_0xb99fa0[_0x1810('0x57')](_0x1810('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 84730a4..9b200ad 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 _0x5089=['SIP/%s','name','outgoingmessage','offlineMessage','opened','sequelize','interface','AfterCreate','changed','closed','substatus','format','AfterUpdate','User','find','fullname','email','internal','default','length','hasOwnProperty','model','callback','toLowerCase','condition','../../mysqldb','jayson/promise','../logger','triggers','client','afterCreate','newinteraction','Chat','ChatInteraction','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','SmsInteraction','Sms','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','error','Trigger,\x20%s','catch','EventManager','get','channel','motionChannel','event','resolve','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','query','Sequelize','QueryTypes','SELECT','contact','undefined','UserId'];(function(_0x310146,_0x339214){var _0x29746e=function(_0x1022d3){while(--_0x1022d3){_0x310146['push'](_0x310146['shift']());}};_0x29746e(++_0x339214);}(_0x5089,0x13d));var _0x9508=function(_0x15ec35,_0x5b9972){_0x15ec35=_0x15ec35-0x0;var _0x937cce=_0x5089[_0x15ec35];return _0x937cce;};'use strict';var util=require('util');var db=require(_0x9508('0x0'))['db'];var jayson=require(_0x9508('0x1'));var logger=require(_0x9508('0x2'))(_0x9508('0x3'));var client=jayson[_0x9508('0x4')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':_0x9508('0x5'),'condition':_0x9508('0x6'),'callback':afterCreate},{'channel':_0x9508('0x7'),'model':_0x9508('0x8'),'event':'afterUpdate','condition':_0x9508('0x9'),'callback':afterUpdate},{'channel':_0x9508('0x7'),'model':_0x9508('0xa'),'event':_0x9508('0x5'),'condition':_0x9508('0xb'),'callback':afterCreateMessage},{'channel':_0x9508('0x7'),'model':_0x9508('0xc'),'event':'afterCreate','condition':_0x9508('0xb'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0x9508('0xd'),'event':_0x9508('0x5'),'condition':_0x9508('0x6'),'callback':afterCreate},{'channel':_0x9508('0xe'),'model':_0x9508('0xd'),'event':_0x9508('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9508('0xe'),'model':_0x9508('0x10'),'event':'afterCreate','condition':_0x9508('0xb'),'callback':afterCreateMessage},{'channel':_0x9508('0x11'),'model':_0x9508('0x12'),'event':_0x9508('0x5'),'condition':_0x9508('0x6'),'callback':afterCreate},{'channel':_0x9508('0x11'),'model':_0x9508('0x12'),'event':_0x9508('0xf'),'condition':_0x9508('0x9'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0x9508('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x9508('0x13'),'model':_0x9508('0x14'),'event':_0x9508('0x5'),'condition':_0x9508('0x6'),'callback':afterCreate},{'channel':_0x9508('0x13'),'model':'FaxInteraction','event':_0x9508('0xf'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9508('0x13'),'model':'FaxMessage','event':_0x9508('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0x9508('0x15'),'event':_0x9508('0x5'),'condition':_0x9508('0x6'),'callback':afterCreate},{'channel':_0x9508('0x16'),'model':_0x9508('0x15'),'event':'afterUpdate','condition':_0x9508('0x9'),'callback':afterUpdate},{'channel':'Mail','model':_0x9508('0x17'),'event':_0x9508('0x5'),'condition':_0x9508('0xb'),'callback':afterCreateMessage},{'channel':_0x9508('0x18'),'model':_0x9508('0x19'),'event':_0x9508('0x5'),'condition':_0x9508('0x6'),'callback':afterCreate},{'channel':_0x9508('0x18'),'model':_0x9508('0x19'),'event':_0x9508('0xf'),'condition':_0x9508('0x9'),'callback':afterUpdate},{'channel':_0x9508('0x18'),'model':_0x9508('0x1a'),'event':_0x9508('0x5'),'condition':_0x9508('0xb'),'callback':afterCreateMessage}];function request(_0x5331ee){return client[_0x9508('0x1b')]('EventManager',_0x5331ee)[_0x9508('0x1c')](function(_0x4dd207){logger[_0x9508('0x1d')]('Trigger,\x20%s','EventManager',_0x4dd207);if(_0x4dd207[_0x9508('0x1e')]){if(_0x4dd207[_0x9508('0x1e')]['code']===0x1f4){logger[_0x9508('0x1e')](_0x9508('0x1f'),'EventManager',_0x4dd207[_0x9508('0x1e')]);}}})[_0x9508('0x20')](function(_0x268823){logger[_0x9508('0x1e')]('Trigger,\x20%s',_0x9508('0x21'),_0x268823);});}function afterCreateMessage(_0x351ad5){return function(_0x15e234){_0x15e234=_0x15e234[_0x9508('0x22')]({'plain':!![]});_0x15e234[_0x9508('0x23')]=_0x351ad5;_0x15e234[_0x9508('0x24')]=_0x351ad5;_0x15e234[_0x9508('0x25')]=_0x15e234['direction'];Promise[_0x9508('0x26')]()[_0x9508('0x1c')](function(){if(typeof _0x15e234[_0x9508('0x27')]==='undefined')return null;var _0x15fad9=_0x9508('0x28')+_0x15e234[_0x9508('0x27')];return db['sequelize'][_0x9508('0x29')](_0x15fad9,{'type':db[_0x9508('0x2a')][_0x9508('0x2b')][_0x9508('0x2c')],'raw':!![]});})[_0x9508('0x1c')](function(_0x333116){if(_0x333116){_0x15e234[_0x9508('0x2d')]=_0x333116[0x0];}if(typeof _0x15e234['UserId']===_0x9508('0x2e'))return;return getAgent(_0x15e234[_0x9508('0x2f')]);})[_0x9508('0x1c')](function(_0x2d3327){if(_0x2d3327){_0x15e234['interface']=util['format'](_0x9508('0x30'),_0x2d3327[_0x9508('0x31')]);_0x15e234['agent']=_0x2d3327;_0x15e234[_0x9508('0x23')]=_0x351ad5;return request({'event':'incomingmessage','message':_0x15e234});}else{return request({'event':_0x9508('0x32'),'message':_0x15e234});}})['catch'](function(_0xf8bf11){logger[_0x9508('0x1e')](_0x9508('0x1f'),'AfterCreateMessage',_0xf8bf11);});};}function afterCreateOfflineMessage(_0x52af7a){return function(_0x5e4a95){_0x5e4a95=_0x5e4a95[_0x9508('0x22')]({'plain':!![]});_0x5e4a95[_0x9508('0x23')]=_0x52af7a;_0x5e4a95[_0x9508('0x24')]=_0x52af7a;_0x5e4a95[_0x9508('0x25')]=_0x9508('0x33');return request({'event':_0x5e4a95[_0x9508('0x25')],'message':_0x5e4a95});};}function afterCreate(_0x5c1335,_0x4d4b56){return function(_0x70751){_0x70751=_0x70751[_0x9508('0x22')]({'plain':!![]});_0x70751[_0x9508('0x23')]=_0x5c1335;_0x70751[_0x9508('0x24')]=_0x5c1335;_0x70751['event']=_0x9508('0x34');Promise[_0x9508('0x26')]()['then'](function(){var _0x1404d3=_0x9508('0x28')+_0x70751[_0x9508('0x27')];return db[_0x9508('0x35')]['query'](_0x1404d3,{'type':db[_0x9508('0x2a')][_0x9508('0x2b')][_0x9508('0x2c')],'raw':!![]});})['then'](function(_0xdca8b7){if(_0xdca8b7){_0x70751[_0x9508('0x2d')]=_0xdca8b7[0x0];}if(typeof _0x70751[_0x9508('0x2f')]==='undefined')return;return getAgent(_0x70751['UserId']);})[_0x9508('0x1c')](function(_0x260b53){if(_0x260b53){_0x70751[_0x9508('0x36')]=util['format'](_0x9508('0x30'),_0x260b53['name']);_0x70751['agent']=_0x260b53;}return request({'event':_0x4d4b56,'message':_0x70751});})[_0x9508('0x20')](function(_0x571c4c){logger[_0x9508('0x1e')](_0x9508('0x1f'),_0x9508('0x37'),_0x571c4c);});};}function afterUpdate(_0xafaacf){return function(_0x30c8fc){var _0x4411c4=_0x30c8fc[_0x9508('0x38')](_0x9508('0x39'))&&_0x30c8fc[_0x9508('0x39')];var _0x31c6d1=_0x30c8fc[_0x9508('0x38')]('substatus');if(_0x4411c4||_0x31c6d1){var _0x106b82=_0x4411c4?'closedinteraction':_0x9508('0x3a');var _0x3c3958=_0x30c8fc[_0x9508('0x22')]({'plain':!![]});_0x3c3958[_0x9508('0x23')]=_0xafaacf;_0x3c3958[_0x9508('0x24')]=_0xafaacf;_0x3c3958['event']=_0x4411c4?'closed':_0x9508('0x3a');var _0x402ba4=_0x9508('0x28')+_0x3c3958['ContactId'];return db[_0x9508('0x35')][_0x9508('0x29')](_0x402ba4,{'type':db[_0x9508('0x2a')]['QueryTypes']['SELECT'],'raw':!![]})[_0x9508('0x1c')](function(_0xfa04a5){if(_0xfa04a5){_0x3c3958[_0x9508('0x2d')]=_0xfa04a5[0x0];}if(typeof _0x3c3958[_0x9508('0x2f')]===_0x9508('0x2e'))return;return getAgent(_0x3c3958['UserId']);})['then'](function(_0x2d4459){if(_0x2d4459){_0x3c3958[_0x9508('0x36')]=util[_0x9508('0x3b')](_0x9508('0x30'),_0x2d4459[_0x9508('0x31')]);_0x3c3958['agent']=_0x2d4459;}return request({'event':_0x106b82,'message':_0x3c3958});})[_0x9508('0x20')](function(_0x148e1a){logger[_0x9508('0x1e')]('Trigger,\x20%s',_0x9508('0x3c'),_0x148e1a);});}};}function getAgent(_0x1a3ee2){return db[_0x9508('0x3d')][_0x9508('0x3e')]({'where':{'id':_0x1a3ee2},'attributes':['id',_0x9508('0x31'),_0x9508('0x3f'),_0x9508('0x40'),_0x9508('0x41')],'raw':!![]})[_0x9508('0x1c')](function(_0x55ff49){return _0x55ff49;});}exports[_0x9508('0x42')]=function(){for(var _0x522288=0x0;_0x522288=_0x3c4aae[_0x83e3('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x44b920(_0x37d4c2);})['catch'](function(_0x32add0){_0xe46dfa(_0x32add0);});});}; \ No newline at end of file +var _0xd658=['agents','bluebird','./license/util','voice','mail','sms','whatsapp','getChannels','isValidChannel','toLowerCase','includes','isUndefined','blockedAt','role','agent','User','count','then'];(function(_0x11cd17,_0x489e02){var _0x3343ad=function(_0xfb1588){while(--_0xfb1588){_0x11cd17['push'](_0x11cd17['shift']());}};_0x3343ad(++_0x489e02);}(_0xd658,0x1d5));var _0x8d65=function(_0x4a6329,_0x143f05){_0x4a6329=_0x4a6329-0x0;var _0xe735a4=_0xd658[_0x4a6329];return _0xe735a4;};'use strict';var _=require('lodash');var BPromise=require(_0x8d65('0x0'));var db=require('../mysqldb')['db'];var util=require(_0x8d65('0x1'));var channels=[_0x8d65('0x2'),_0x8d65('0x3'),'chat','fax',_0x8d65('0x4'),_0x8d65('0x5'),'openchannel'];exports[_0x8d65('0x6')]=function(){return channels;};exports[_0x8d65('0x7')]=function(_0x2c4017){_0x2c4017=_0x2c4017[_0x8d65('0x8')]();return _[_0x8d65('0x9')](channels,_0x2c4017);};exports['clearBlockUser']=function(_0x576535,_0x28c07c,_0x34eabc,_0x474e4c){var _0x59d9d0={'loginAttempts':_0x28c07c,'blocked':_0x34eabc};if(!_[_0x8d65('0xa')](_0x474e4c)){_0x59d9d0[_0x8d65('0xb')]=_0x474e4c;}return _0x576535['updateAttributes'](_0x59d9d0);};exports['getLicense']=function(_0x4ebabc){return new BPromise(function(_0x5e251e,_0x338525){var _0x285439=0x0;if(_0x4ebabc[_0x8d65('0xc')]!==_0x8d65('0xd')){_0x5e251e(_0x4ebabc);}db[_0x8d65('0xe')][_0x8d65('0xf')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x4ebabc['id']}}})['then'](function(_0x1cced0){_0x285439=_0x1cced0;return util['getLicense']();})[_0x8d65('0x10')](function(_0x20cd45){if(_0x20cd45&&_0x20cd45[_0x8d65('0x11')]&&_0x285439>=_0x20cd45[_0x8d65('0x11')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x5e251e(_0x4ebabc);})['catch'](function(_0x2ecbbb){_0x338525(_0x2ecbbb);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 035e965..aade072 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91a7=['name','inherits','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack','status','send','../config/logger','api','message'];(function(_0x279f47,_0x539fcf){var _0x20a09c=function(_0xc72177){while(--_0xc72177){_0x279f47['push'](_0x279f47['shift']());}};_0x20a09c(++_0x539fcf);}(_0x91a7,0xe7));var _0x791a=function(_0x17f5ea,_0x480b7b){_0x17f5ea=_0x17f5ea-0x0;var _0x376ed6=_0x91a7[_0x17f5ea];return _0x376ed6;};'use strict';var util=require('util');var logger=require(_0x791a('0x0'))(_0x791a('0x1'));var APIError=function(_0x268862,_0x5d2796){this[_0x791a('0x2')]=_0x268862||'Internal\x20Server\x20Error';this[_0x791a('0x3')]=_0x5d2796||'Error';util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x32fe2b){this[_0x791a('0x2')]=_0x32fe2b||'Bad\x20Request';this[_0x791a('0x3')]='Bad\x20Request';util[_0x791a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x159e24){this['message']=_0x159e24||_0x791a('0x5');this[_0x791a('0x3')]=_0x791a('0x6');util[_0x791a('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x266e4b){switch(_0x266e4b){case'Bad\x20Request':return 0x190;case _0x791a('0x7'),_0x791a('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x2bd26a){return function(_0x206eea){logger[_0x791a('0x9')](_0x206eea[_0x791a('0xa')]);var _0x2805c9=getStatusCode(_0x206eea[_0x791a('0x3')]);if(_0x206eea['name'])delete _0x206eea['name'];return _0x2bd26a[_0x791a('0xb')](_0x2805c9)[_0x791a('0xc')](_0x206eea);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xe5b5=['name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Forbidden','error','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error'];(function(_0x26c12c,_0xde2ac0){var _0x485044=function(_0x3e797b){while(--_0x3e797b){_0x26c12c['push'](_0x26c12c['shift']());}};_0x485044(++_0xde2ac0);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0xe5b5[_0x46f3f8];return _0xbc57cd;};'use strict';var util=require(_0x5e5b('0x0'));var logger=require(_0x5e5b('0x1'))(_0x5e5b('0x2'));var APIError=function(_0x3b3efd,_0x208070){this[_0x5e5b('0x3')]=_0x3b3efd||_0x5e5b('0x4');this[_0x5e5b('0x5')]=_0x208070||_0x5e5b('0x6');util[_0x5e5b('0x7')](APIError,Error);};var APIBadRequestError=function(_0xdc6616){this[_0x5e5b('0x3')]=_0xdc6616||_0x5e5b('0x8');this[_0x5e5b('0x5')]=_0x5e5b('0x8');util[_0x5e5b('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0xe089b1){this[_0x5e5b('0x3')]=_0xe089b1||_0x5e5b('0x9');this[_0x5e5b('0x5')]=_0x5e5b('0xa');util[_0x5e5b('0x7')](APINotFoundError,APIError);};function getStatusCode(_0x3f8534){switch(_0x3f8534){case'Bad\x20Request':return 0x190;case _0x5e5b('0xb'),'OutOfInterval':return 0x193;case _0x5e5b('0xa'):return 0x194;default:return 0x1f4;}}function handleError(_0x58185){return function(_0x23e667){logger[_0x5e5b('0xc')](_0x23e667['stack']);var _0x4a1424=getStatusCode(_0x23e667['name']);if(_0x23e667[_0x5e5b('0x5')])delete _0x23e667[_0x5e5b('0x5')];return _0x58185[_0x5e5b('0xd')](_0x4a1424)[_0x5e5b('0xe')](_0x23e667);};}module[_0x5e5b('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 371f53c..baecc00 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33e5=['404','status','json','send','exports'];(function(_0x515a41,_0x4c631c){var _0x5a435b=function(_0x5dc9b4){while(--_0x5dc9b4){_0x515a41['push'](_0x515a41['shift']());}};_0x5a435b(++_0x4c631c);}(_0x33e5,0x13a));var _0x533e=function(_0x135e45,_0x56e462){_0x135e45=_0x135e45-0x0;var _0xf5b103=_0x33e5[_0x135e45];return _0xf5b103;};'use strict';module[_0x533e('0x0')][0x194]=function pageNotFound(_0x23b543,_0x253d0c){var _0x53a56c=_0x533e('0x1');var _0x597457=0x194;var _0x32d1ff={'status':_0x597457};_0x253d0c[_0x533e('0x2')](_0x32d1ff[_0x533e('0x2')]);_0x253d0c['render'](_0x53a56c,{},function(_0x49957c,_0x422fc7){if(_0x49957c){return _0x253d0c[_0x533e('0x2')](_0x32d1ff[_0x533e('0x2')])[_0x533e('0x3')](_0x32d1ff);}_0x253d0c[_0x533e('0x4')](_0x422fc7);});}; \ No newline at end of file +var _0x8804=['status','send','exports','404','render'];(function(_0x51130a,_0x3d5775){var _0x45e953=function(_0x593cb7){while(--_0x593cb7){_0x51130a['push'](_0x51130a['shift']());}};_0x45e953(++_0x3d5775);}(_0x8804,0x160));var _0x4880=function(_0x103002,_0x4ac5ec){_0x103002=_0x103002-0x0;var _0x304723=_0x8804[_0x103002];return _0x304723;};'use strict';module[_0x4880('0x0')][0x194]=function pageNotFound(_0x3c0b1c,_0xb090ed){var _0x3f47a=_0x4880('0x1');var _0x2aa3c8=0x194;var _0x50f7f6={'status':_0x2aa3c8};_0xb090ed['status'](_0x50f7f6['status']);_0xb090ed[_0x4880('0x2')](_0x3f47a,{},function(_0x10fa36,_0x18e027){if(_0x10fa36){return _0xb090ed['status'](_0x50f7f6[_0x4880('0x3')])['json'](_0x50f7f6);}_0xb090ed[_0x4880('0x4')](_0x18e027);});}; \ No newline at end of file diff --git a/server/migrations/2.6.7.js b/server/migrations/2.6.7.js new file mode 100644 index 0000000..99a8015 --- /dev/null +++ b/server/migrations/2.6.7.js @@ -0,0 +1,170 @@ +'use strict'; + +var BPromise = require('bluebird'); +var util = require('util'); + +var logger = require('../config/logger')('migration'); + +var Sequence = function() {}; + +Sequence.prototype.enqueue = function(fn) { + this.tail = this.tail ? this.tail.finally(fn) : fn(); +}; + +var Migration = function(queryInterface) { + this.queryInterface = queryInterface; + this.sequence = new Sequence(); +}; + +Migration.prototype.changeColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .changeColumn(table, column, type) + .then(function() { + logger.info('Changed column %s in table %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addColumn = function(table, column, type) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addColumn(table, column, type) + .then(function() { + logger.info('Added column %s to %s', column, table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.dropTable = function(table) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .dropTable(table, { + force: true, + }) + .then(function() { + logger.info('table dropped %s', table); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.addIndex = function(table, column, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .addIndex(table, column, { + indexName: indexName, + }) + .then(function() { + logger.info('addIndex %s %s %s', table, column.join(','), indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeIndex = function(table, indexName) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeIndex(table, indexName) + .then(function() { + logger.info('removeIndex %s %s', table, indexName); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.query = function(sql) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface.sequelize + .query(sql) + .then(function() { + logger.info('query %s', sql); + }) + .catch(function(err) { + logger.info(JSON.stringify(err)); + }); + }); +}; + +Migration.prototype.removeColumn = function(table, column) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .removeColumn(table, column) + .then(function() { + logger.info('Removed column %s from %s', column, table); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.renameColumn = function(table, oldColumn, newColumn) { + var _this = this; + this.sequence.enqueue(function() { + return _this.queryInterface + .renameColumn(table, oldColumn, newColumn) + .then(function() { + logger.info( + 'Renamed column from %s to %s on %s', + oldColumn, + newColumn, + table + ); + }) + .catch(function(err) { + logger.info( + util.inspect(err, { + showHidden: false, + depth: null, + }) + ); + }); + }); +}; + +Migration.prototype.final = function(resolve) { + this.sequence.enqueue(function() { + return resolve(); + }); +}; + +module.exports = { + up: function(queryInterface, Sequelize) { + return new BPromise(function(resolve) { + var migration = new Migration(queryInterface); + + // START FINAL + migration.final(resolve); + // END FINAL + }); + }, + + down: function(queryInterface, Sequelize) { + // var migration = new Migration(queryInterface); + }, +}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 18c94da..e72e0b9 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2cc=['SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../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','UserSetting','../api/user-setting/user-setting.model','User','hasOne','UserId','cascade','hasMany','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','MailInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteraction','user_has_whatsapp_interactions','VoicePrefixes','FaxQueues','SmsQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','CmContact','Contact','ContactId','MailAccount','MailAccountId','CloudProviderId','MailServerOut','Imap','Smtp','Answers','Messages','ListId','TemplateId','Pause','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','ChatWebsiteId','ChatOfflineMessageId','restrict','IntervalId','TagId','List','Dispositions','FaxAccountId','Interactions','Exntensions','FaxMessage','FaxInteractionId','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','Owner','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','Interaction','AttachmentId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatInternalMessage','ChatGroupId','CmContactHasItem','Phones','CmContactId','HopperHistories','MailInteractions','Company','CompanyId','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','Campaign','CampaignId','Automation','All','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','ParentId','Intervals','ChatApplications','SmsApplications','DefaultReportId','VoiceMusicOnHold','Mohs','ItemType','ItemTypeId','Hopper','CmHopperId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','FieldId','SugarcrmConfiguration','VariableId','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','ChatQueueReport','FromId','SessionId','ProjectId','VoiceQueues','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','BlackLists','MailTransferReport','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToQueue','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','CustomFields','HopperHistory','Queues','UserProfileSections','userProfileId','UserProfileResource','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','../config/environment','sequelize','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','name','database','username','password','options','import','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatMessage','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model'];(function(_0x22ba46,_0x1abde2){var _0x5871a8=function(_0x400ad5){while(--_0x400ad5){_0x22ba46['push'](_0x22ba46['shift']());}};_0x5871a8(++_0x1abde2);}(_0xc2cc,0x123));var _0xcc2c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc2cc[_0x4a9fb1];return _0x348672;};'use strict';var config=require(_0xcc2c('0x0'));var Sequelize=require(_0xcc2c('0x1'));var _=require('lodash');var jstz=require(_0xcc2c('0x2'));var timezone=jstz[_0xcc2c('0x3')]();config['sequelize']=_[_0xcc2c('0x4')](config['sequelize'],{'database':_0xcc2c('0x5'),'username':_0xcc2c('0x6'),'password':_0xcc2c('0x7'),'options':{'host':_0xcc2c('0x8'),'port':0xcea,'dialect':_0xcc2c('0x9'),'dialectOptions':{'charset':_0xcc2c('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xcc2c('0xb'),'collate':_0xcc2c('0xc')}}});config['sequelizeHistory']=_[_0xcc2c('0x4')](config[_0xcc2c('0xd')],{'database':_0xcc2c('0x5'),'username':_0xcc2c('0x6'),'password':_0xcc2c('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xcc2c('0x9'),'dialectOptions':{'charset':_0xcc2c('0xa')},'logging':![],'timezone':timezone[_0xcc2c('0xe')](),'define':{'charset':_0xcc2c('0xb'),'collate':_0xcc2c('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xcc2c('0xf')],config[_0xcc2c('0x1')][_0xcc2c('0x10')],config[_0xcc2c('0x1')][_0xcc2c('0x11')],config[_0xcc2c('0x1')][_0xcc2c('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcc2c('0xd')][_0xcc2c('0xf')],config[_0xcc2c('0xd')]['username'],config[_0xcc2c('0xd')][_0xcc2c('0x11')],config[_0xcc2c('0xd')]['options'])};db['User']=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/user/user.model');db[_0xcc2c('0x14')]=db[_0xcc2c('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0xcc2c('0x15')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x16'));db[_0xcc2c('0x17')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0x18'));db[_0xcc2c('0x19')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x1a'));db[_0xcc2c('0x1b')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x1c'));db[_0xcc2c('0x1d')]=db[_0xcc2c('0x1')]['import']('../api/screenRecording/screenRecording.model');db[_0xcc2c('0x1e')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x1f'));db[_0xcc2c('0x20')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x21'));db[_0xcc2c('0x22')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x23'));db[_0xcc2c('0x24')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x25'));db[_0xcc2c('0x26')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0x27'));db[_0xcc2c('0x28')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x29'));db[_0xcc2c('0x2a')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x2b'));db['Trunk']=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/trunk/trunk.model');db[_0xcc2c('0x2c')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x2d'));db[_0xcc2c('0x2e')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0x2f'));db[_0xcc2c('0x30')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x31'));db[_0xcc2c('0x32')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x33'));db[_0xcc2c('0x34')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x35'));db[_0xcc2c('0x36')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x37'));db[_0xcc2c('0x38')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x39'));db[_0xcc2c('0x3a')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x3b'));db[_0xcc2c('0x3c')]=db[_0xcc2c('0x1')]['import']('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x3d'));db['MailAccount']=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x3e'));db[_0xcc2c('0x3f')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0x40'));db[_0xcc2c('0x41')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0xcc2c('0x42')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/mailMessage/mailMessage.model');db[_0xcc2c('0x43')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0x44'));db[_0xcc2c('0x45')]=db['sequelize']['import'](_0xcc2c('0x46'));db[_0xcc2c('0x47')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x48'));db[_0xcc2c('0x49')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/faxAccount/faxAccount.model');db[_0xcc2c('0x4a')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/faxApplication/faxApplication.model');db[_0xcc2c('0x4b')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x4c'));db['FaxMessage']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x4d'));db[_0xcc2c('0x4e')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/faxQueue/faxQueue.model');db[_0xcc2c('0x4f')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x50'));db[_0xcc2c('0x51')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x52'));db[_0xcc2c('0x53')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x54'));db[_0xcc2c('0x55')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x56'));db['SmsMessage']=db[_0xcc2c('0x1')]['import']('../api/smsMessage/smsMessage.model');db[_0xcc2c('0x57')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/smsQueue/smsQueue.model');db[_0xcc2c('0x58')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x59'));db['OpenchannelApplication']=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0x5a'));db[_0xcc2c('0x5b')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0x5c'));db['OpenchannelMessage']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x5d'));db[_0xcc2c('0x5e')]=db['sequelize'][_0xcc2c('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0xcc2c('0x5f')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x60'));db[_0xcc2c('0x61')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x62'));db[_0xcc2c('0x63')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0x64'));db['ChatInteraction']=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0xcc2c('0x65')]=db[_0xcc2c('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0xcc2c('0x66')]=db[_0xcc2c('0x1')]['import']('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xcc2c('0x67')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x68'));db[_0xcc2c('0x69')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x6a'));db['ChatProactiveAction']=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0x6b'));db[_0xcc2c('0x6c')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x6d'));db['CmContact']=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x6e'));db[_0xcc2c('0x6f')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/cmHopper/cmHopper.model');db[_0xcc2c('0x70')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x71'));db[_0xcc2c('0x72')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x73'));db[_0xcc2c('0x74')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x75'));db[_0xcc2c('0x76')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xcc2c('0x77')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x78'));db[_0xcc2c('0x79')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x7a'));db['Automation']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x7b'));db[_0xcc2c('0x7c')]=db['sequelize'][_0xcc2c('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0xcc2c('0x7d')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x7e'));db[_0xcc2c('0x7f')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x80'));db[_0xcc2c('0x81')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x82'));db['Pause']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x83'));db[_0xcc2c('0x84')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x85'));db[_0xcc2c('0x86')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x87'));db[_0xcc2c('0x88')]=db[_0xcc2c('0x1')]['import']('../api/schedule/schedule.model');db['Sound']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x89'));db[_0xcc2c('0x8a')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x8b'));db[_0xcc2c('0x8c')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x8d'));db['CmContactHasItem']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x8e'));db['CmHopperAdditionalPhone']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x8f'));db[_0xcc2c('0x90')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x91'));db[_0xcc2c('0x92')]=db[_0xcc2c('0x1')]['import']('../api/trigger/trigger.model');db[_0xcc2c('0x93')]=db['sequelize']['import'](_0xcc2c('0x94'));db[_0xcc2c('0x95')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x96'));db[_0xcc2c('0x97')]=db['sequelize'][_0xcc2c('0x13')]('../api/integrationReport/integrationReport.model');db[_0xcc2c('0x98')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0x99'));db[_0xcc2c('0x9a')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x9b'));db['AnalyticExtractedReport']=db[_0xcc2c('0x1')]['import'](_0xcc2c('0x9c'));db[_0xcc2c('0x9d')]=db['sequelize']['import'](_0xcc2c('0x9e'));db[_0xcc2c('0x9f')]=db['sequelize'][_0xcc2c('0x13')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xa0'));db[_0xcc2c('0xa1')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xcc2c('0xa2')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xa3'));db['SalesforceField']=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0xcc2c('0xa4')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xa5'));db['SugarcrmConfiguration']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xa6'));db[_0xcc2c('0xa7')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0xa8'));db[_0xcc2c('0xa9')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xaa'));db[_0xcc2c('0xab')]=db['sequelize']['import'](_0xcc2c('0xac'));db[_0xcc2c('0xad')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0xae'));db['ZohoAccount']=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xaf'));db[_0xcc2c('0xb0')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0xb1'));db[_0xcc2c('0xb2')]=db['sequelize'][_0xcc2c('0x13')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xcc2c('0xb3')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xb4'));db[_0xcc2c('0xb5')]=db[_0xcc2c('0x1')]['import']('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xcc2c('0xb6')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xb7'));db[_0xcc2c('0xb8')]=db['sequelize'][_0xcc2c('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xb9'));db[_0xcc2c('0xba')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xbb'));db[_0xcc2c('0xbc')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xbd'));db[_0xcc2c('0xbe')]=db[_0xcc2c('0x1')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xcc2c('0xbf')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xc0'));db[_0xcc2c('0xc1')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xc2'));db['Dynamics365Configuration']=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xc3'));db['FreshsalesAccount']=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0xc4'));db[_0xcc2c('0xc5')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xc6'));db[_0xcc2c('0xc7')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xc8'));db[_0xcc2c('0x95')]=db[_0xcc2c('0x1')]['import']('../api/integration/integration.model');db[_0xcc2c('0xc9')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0xca'));db['ChatQueueReport']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xcb'));db['ChatInternalMessage']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xcc'));db[_0xcc2c('0xcd')]=db[_0xcc2c('0x1')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xcc2c('0xce')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xcf'));db[_0xcc2c('0xd0')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xcc2c('0xd1')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0xd2'));db['SquareReport']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xd3'));db['SquareDetailsReport']=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xd4'));db[_0xcc2c('0xd5')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xd6'));db[_0xcc2c('0xd7')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xd8'));db[_0xcc2c('0xd9')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xda'));db['SquareProject']=db[_0xcc2c('0x1')]['import']('../api/squareProject/squareProject.model');db[_0xcc2c('0xdb')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xdc'));db['SquareMessage']=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/squareMessage/squareMessage.model');db[_0xcc2c('0xdd')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xde'));db[_0xcc2c('0xdf')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xe0'));db['Campaign']=db['sequelize']['import'](_0xcc2c('0xe1'));db[_0xcc2c('0xe2')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xe3'));db[_0xcc2c('0xe4')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0xe5'));db[_0xcc2c('0xe6')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xe7'));db['MailTransferReport']=db[_0xcc2c('0x1')]['import']('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0xe8'));db[_0xcc2c('0xe9')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xea'));db[_0xcc2c('0xeb')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xec'));db['SmsTransferReport']=db[_0xcc2c('0x1')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0xcc2c('0xed')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xee'));db[_0xcc2c('0xef')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0xcc2c('0xf0')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xf1'));db[_0xcc2c('0xf2')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xf3'));db[_0xcc2c('0xf4')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xf5'));db[_0xcc2c('0xf6')]=db[_0xcc2c('0x1')]['import'](_0xcc2c('0xf7'));db[_0xcc2c('0xf8')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xf9'));db['WhatsappInteraction']=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0xfa'));db[_0xcc2c('0xfb')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xfc'));db[_0xcc2c('0xfd')]=db[_0xcc2c('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0xfe'));db[_0xcc2c('0xff')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x100'));db[_0xcc2c('0x101')]=db['sequelize'][_0xcc2c('0x13')](_0xcc2c('0x102'));db[_0xcc2c('0x103')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x104'));db[_0xcc2c('0x105')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x106'));db[_0xcc2c('0x107')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x108'));db[_0xcc2c('0x109')]=db[_0xcc2c('0x1')][_0xcc2c('0x13')](_0xcc2c('0x10a'));db[_0xcc2c('0x10b')][_0xcc2c('0x10c')](db['VoiceMail'],{'as':_0xcc2c('0x1e'),'onDelete':'cascade','foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x10b')][_0xcc2c('0x10c')](db[_0xcc2c('0x109')],{'as':'userSetting','onDelete':_0xcc2c('0x10e'),'foreignKey':'UserId'});db[_0xcc2c('0x10b')][_0xcc2c('0x10f')](db[_0xcc2c('0x1b')],{'as':'Recordings','foreignKey':'UserId'});db[_0xcc2c('0x10b')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xcc2c('0x110'),'foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x10b')][_0xcc2c('0x10f')](db['VoiceExtension'],{'as':_0xcc2c('0x111'),'onDelete':_0xcc2c('0x10e'),'hooks':!![]});db['User']['hasMany'](db[_0xcc2c('0x72')],{'as':_0xcc2c('0x112'),'foreignKey':'UserId'});db['User'][_0xcc2c('0x10f')](db[_0xcc2c('0x74')],{'as':'HopperHistory','foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x10b')]['hasMany'](db['ReportAgentPreview'],{'as':_0xcc2c('0x76'),'foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x10b')]['hasMany'](db[_0xcc2c('0x5b')],{'as':_0xcc2c('0x113'),'foreignKey':_0xcc2c('0x10d')});db['User'][_0xcc2c('0x10f')](db[_0xcc2c('0x114')],{'as':_0xcc2c('0x115'),'foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x10b')][_0xcc2c('0x10f')](db[_0xcc2c('0x55')],{'as':_0xcc2c('0x116'),'foreignKey':'UserId'});db[_0xcc2c('0x10b')][_0xcc2c('0x10f')](db[_0xcc2c('0x4b')],{'as':'FaxInteractions','foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x10b')]['hasMany'](db[_0xcc2c('0x117')],{'as':'MailInteractions','foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x10b')][_0xcc2c('0x10f')](db['WhatsappInteraction'],{'as':_0xcc2c('0x118'),'foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x10b')][_0xcc2c('0x10f')](db[_0xcc2c('0xf4')],{'as':_0xcc2c('0x119'),'foreignKey':_0xcc2c('0x11a')});db[_0xcc2c('0x10b')][_0xcc2c('0x11b')](db[_0xcc2c('0xf0')],{'as':_0xcc2c('0xf0'),'foreignKey':'userProfileId'});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db['ChatGroup'],{'as':_0xcc2c('0x11d'),'through':_0xcc2c('0x11e')});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db['CmContact'],{'as':_0xcc2c('0x11f'),'through':_0xcc2c('0x120')});db['User'][_0xcc2c('0x11c')](db[_0xcc2c('0xed')],{'as':'Lists','through':_0xcc2c('0x121')});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0xdd')],{'through':_0xcc2c('0x122')});db['User'][_0xcc2c('0x11c')](db['MailInteraction'],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0x114')],{'as':'ChatInteractions','through':'user_has_chat_interactions'});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0x4b')],{'as':'FaxInteractions','through':_0xcc2c('0x123')});db[_0xcc2c('0x10b')]['belongsToMany'](db['SmsInteraction'],{'as':_0xcc2c('0x116'),'through':_0xcc2c('0x124')});db['User'][_0xcc2c('0x11c')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0xcc2c('0x125')});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0x126')],{'as':'WhatsappInteractions','through':_0xcc2c('0x127')});db['User'][_0xcc2c('0x11c')](db[_0xcc2c('0x19')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db['VoicePrefix'],{'as':_0xcc2c('0x128'),'through':_0xcc2c('0x107'),'required':![]});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0x3f')],{'as':'MailQueues','through':_0xcc2c('0x32'),'required':![]});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0x67')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0xcc2c('0x10b')]['belongsToMany'](db[_0xcc2c('0x4e')],{'as':_0xcc2c('0x129'),'through':_0xcc2c('0x34'),'required':![]});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0x57')],{'as':_0xcc2c('0x12a'),'through':_0xcc2c('0x36'),'required':![]});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0x5e')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db['WhatsappQueue'],{'as':_0xcc2c('0x12b'),'through':_0xcc2c('0x3a'),'required':![]});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0xed')],{'through':_0xcc2c('0x121')});db['User'][_0xcc2c('0x11c')](db[_0xcc2c('0x5f')],{'as':_0xcc2c('0x12c'),'through':_0xcc2c('0x12d')});db['User'][_0xcc2c('0x11c')](db[_0xcc2c('0x12e')],{'as':'FaxAccounts','through':_0xcc2c('0x12f')});db[_0xcc2c('0x10b')]['belongsToMany'](db['MailAccount'],{'as':_0xcc2c('0x130'),'through':_0xcc2c('0x131')});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0x58')],{'as':_0xcc2c('0x132'),'through':'user_has_openchannel_accounts'});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0x51')],{'as':'SmsAccounts','through':_0xcc2c('0x133')});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0xf6')],{'as':_0xcc2c('0x134'),'through':'user_has_whatsapp_accounts'});db[_0xcc2c('0x10b')][_0xcc2c('0x11c')](db[_0xcc2c('0x135')],{'as':_0xcc2c('0x136'),'through':_0xcc2c('0x137')});db[_0xcc2c('0x14')][_0xcc2c('0x10f')](db[_0xcc2c('0x17')],{'as':_0xcc2c('0x138'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x139')});db[_0xcc2c('0x15')][_0xcc2c('0x10f')](db[_0xcc2c('0x17')],{'onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0x17')][_0xcc2c('0x10f')](db[_0xcc2c('0x17')],{'as':_0xcc2c('0x13a'),'onDelete':_0xcc2c('0x10e')});db['VoiceMusicOnHold'][_0xcc2c('0x11c')](db[_0xcc2c('0x13b')],{'as':_0xcc2c('0x13c'),'through':_0xcc2c('0x13d')});db['VoiceQueue'][_0xcc2c('0x10f')](db['UserVoiceQueueRt'],{'as':_0xcc2c('0x13e'),'foreignKey':_0xcc2c('0x13f')});db['VoiceQueue'][_0xcc2c('0x10f')](db[_0xcc2c('0x6f')],{'as':_0xcc2c('0x140'),'foreignKey':_0xcc2c('0x13f')});db['VoiceQueue'][_0xcc2c('0x10f')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xcc2c('0x13f')});db[_0xcc2c('0x19')][_0xcc2c('0x10f')](db[_0xcc2c('0x74')],{'as':'HopperHistories','foreignKey':_0xcc2c('0x13f')});db['VoiceQueue']['hasMany'](db[_0xcc2c('0x76')],{'as':_0xcc2c('0x76'),'foreignKey':_0xcc2c('0x13f')});db[_0xcc2c('0x19')][_0xcc2c('0x10f')](db[_0xcc2c('0x70')],{'as':_0xcc2c('0x141'),'foreignKey':_0xcc2c('0x13f')});db[_0xcc2c('0x19')][_0xcc2c('0x10f')](db['JscriptySessionReport'],{'as':_0xcc2c('0x142'),'foreignKey':_0xcc2c('0x13f')});db[_0xcc2c('0x19')]['belongsTo'](db[_0xcc2c('0x143')],{'as':_0xcc2c('0x143'),'foreignKey':_0xcc2c('0x144')});db[_0xcc2c('0x19')]['belongsTo'](db['Trunk'],{'as':_0xcc2c('0x145'),'foreignKey':'TrunkBackupId'});db[_0xcc2c('0x19')][_0xcc2c('0x11b')](db[_0xcc2c('0x81')],{'as':_0xcc2c('0x81'),'foreignKey':'IntervalId'});db['VoiceQueue'][_0xcc2c('0x11b')](db['Pause'],{'as':_0xcc2c('0x146'),'foreignKey':_0xcc2c('0x147')});db[_0xcc2c('0x19')][_0xcc2c('0x11c')](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x148'),'through':_0xcc2c('0x149')});db[_0xcc2c('0x19')][_0xcc2c('0x11c')](db['User'],{'as':_0xcc2c('0x14a'),'through':_0xcc2c('0x2e')});db[_0xcc2c('0x19')][_0xcc2c('0x11c')](db[_0xcc2c('0xdd')],{'as':_0xcc2c('0x14b'),'through':_0xcc2c('0x103')});db['VoiceQueue'][_0xcc2c('0x11c')](db[_0xcc2c('0xed')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0xcc2c('0x1b')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x10b'),'foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x1d')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x10b'),'foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x1e')][_0xcc2c('0x10f')](db[_0xcc2c('0x20')],{'as':'Messages','onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x14c'),'sourceKey':_0xcc2c('0x14d')});db[_0xcc2c('0x20')][_0xcc2c('0x11b')](db[_0xcc2c('0x1e')],{'foreignKey':_0xcc2c('0x14c'),'targetKey':_0xcc2c('0x14d')});db['VoiceCallReport'][_0xcc2c('0x10f')](db['VoiceQueueReport'],{'as':_0xcc2c('0x14e'),'foreignKey':_0xcc2c('0x14f'),'constraints':![]});db[_0xcc2c('0x22')]['hasMany'](db[_0xcc2c('0x26')],{'as':_0xcc2c('0x150'),'foreignKey':_0xcc2c('0x14f'),'constraints':![]});db[_0xcc2c('0x22')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x10b'),'foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x22')][_0xcc2c('0x11b')](db[_0xcc2c('0x151')],{'as':_0xcc2c('0x152'),'foreignKey':_0xcc2c('0x153')});db['MailServerIn'][_0xcc2c('0x11b')](db[_0xcc2c('0x154')],{'as':_0xcc2c('0x154'),'foreignKey':_0xcc2c('0x155')});db[_0xcc2c('0x3c')]['belongsTo'](db[_0xcc2c('0x101')],{'as':_0xcc2c('0x101'),'foreignKey':_0xcc2c('0x156'),'onDelete':'restrict'});db[_0xcc2c('0x157')][_0xcc2c('0x11b')](db[_0xcc2c('0x154')],{'as':'MailAccount','foreignKey':_0xcc2c('0x155')});db['MailServerOut']['belongsTo'](db[_0xcc2c('0x101')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0xcc2c('0x154')]['hasOne'](db[_0xcc2c('0x3c')],{'as':_0xcc2c('0x158'),'onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0x154')][_0xcc2c('0x10c')](db[_0xcc2c('0x157')],{'as':_0xcc2c('0x159'),'onDelete':'cascade'});db[_0xcc2c('0x154')][_0xcc2c('0x10f')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xcc2c('0x155'),'onDelete':'cascade'});db['MailAccount'][_0xcc2c('0x10f')](db['CannedAnswer'],{'as':_0xcc2c('0x15a'),'foreignKey':'MailAccountId'});db[_0xcc2c('0x154')][_0xcc2c('0x10f')](db[_0xcc2c('0x42')],{'as':_0xcc2c('0x15b'),'foreignKey':_0xcc2c('0x155')});db[_0xcc2c('0x154')][_0xcc2c('0x10f')](db[_0xcc2c('0x117')],{'as':'Interactions'});db[_0xcc2c('0x154')][_0xcc2c('0x10f')](db['MailApplication'],{'as':_0xcc2c('0x13a')});db[_0xcc2c('0x154')][_0xcc2c('0x11b')](db[_0xcc2c('0xed')],{'as':'List','foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0x154')]['belongsTo'](db[_0xcc2c('0x90')],{'as':_0xcc2c('0x90'),'foreignKey':_0xcc2c('0x15d')});db[_0xcc2c('0x154')][_0xcc2c('0x11b')](db[_0xcc2c('0x15e')],{'as':_0xcc2c('0x146'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount']['belongsToMany'](db[_0xcc2c('0x10b')],{'as':'Agents','through':'user_has_mail_accounts'});db[_0xcc2c('0x3f')][_0xcc2c('0x11c')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x14a'),'through':'UserMailQueue'});db[_0xcc2c('0x3f')][_0xcc2c('0x11c')](db[_0xcc2c('0xdd')],{'through':'team_has_mail_queues','as':'Teams'});db[_0xcc2c('0x117')]['hasMany'](db[_0xcc2c('0x42')],{'as':_0xcc2c('0x15b'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x15f')});db['MailInteraction'][_0xcc2c('0x11b')](db['MailAccount'],{'as':_0xcc2c('0x160'),'foreignKey':_0xcc2c('0x155')});db[_0xcc2c('0x117')]['belongsTo'](db[_0xcc2c('0x151')],{'as':_0xcc2c('0x152'),'foreignKey':_0xcc2c('0x153')});db[_0xcc2c('0x117')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'as':'Owner','foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x117')][_0xcc2c('0x11c')](db['Tag'],{'through':_0xcc2c('0x161'),'as':_0xcc2c('0x162')});db[_0xcc2c('0x117')]['belongsToMany'](db[_0xcc2c('0x8a')],{'through':_0xcc2c('0x161'),'as':_0xcc2c('0x163')});db[_0xcc2c('0x117')][_0xcc2c('0x11c')](db['User'],{'as':_0xcc2c('0x164'),'through':_0xcc2c('0x165'),'foreignKey':'MailInteractionId'});db[_0xcc2c('0x42')][_0xcc2c('0x10f')](db['Attachment'],{'as':_0xcc2c('0x166'),'onDelete':_0xcc2c('0x10e')});db['MailMessage'][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'as':'User'});db[_0xcc2c('0x42')]['belongsTo'](db['CmContact'],{'onDelete':_0xcc2c('0x10e'),'as':_0xcc2c('0x152')});db[_0xcc2c('0x42')][_0xcc2c('0x11b')](db[_0xcc2c('0x117')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xcc2c('0x42')][_0xcc2c('0x11b')](db[_0xcc2c('0x154')],{'as':_0xcc2c('0x160'),'foreignKey':'MailAccountId'});db[_0xcc2c('0x42')][_0xcc2c('0x11b')](db[_0xcc2c('0x5f')],{'as':_0xcc2c('0x5f'),'foreignKey':_0xcc2c('0x167')});db[_0xcc2c('0x42')][_0xcc2c('0x11b')](db['ChatOfflineMessage'],{'as':_0xcc2c('0x66'),'foreignKey':_0xcc2c('0x168')});db[_0xcc2c('0x43')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x43')][_0xcc2c('0x11b')](db['MailQueue'],{'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x43')][_0xcc2c('0x11b')](db['MailAccount'],{'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x43')][_0xcc2c('0x11b')](db[_0xcc2c('0x81')],{'onDelete':_0xcc2c('0x169'),'foreignKey':_0xcc2c('0x16a')});db[_0xcc2c('0x43')][_0xcc2c('0x11b')](db[_0xcc2c('0x8a')],{'onDelete':_0xcc2c('0x169'),'foreignKey':_0xcc2c('0x16b')});db[_0xcc2c('0x45')][_0xcc2c('0x11b')](db[_0xcc2c('0x154')],{});db[_0xcc2c('0x45')]['belongsTo'](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x16c'),'foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0x45')][_0xcc2c('0x11b')](db['CmContact'],{'as':_0xcc2c('0x152'),'foreignKey':'ContactId'});db[_0xcc2c('0x45')][_0xcc2c('0x11b')](db[_0xcc2c('0x117')],{});db['MailQueueReport'][_0xcc2c('0x11b')](db['MailMessage'],{});db[_0xcc2c('0x45')][_0xcc2c('0x11b')](db['User'],{});db[_0xcc2c('0x45')][_0xcc2c('0x11b')](db[_0xcc2c('0x3f')],{});db[_0xcc2c('0x47')][_0xcc2c('0x10f')](db[_0xcc2c('0x49')],{'as':'Items','onDelete':_0xcc2c('0x10e')});db['FaxAccount']['hasMany'](db['Disposition'],{'as':_0xcc2c('0x16d'),'foreignKey':'FaxAccountId','onDelete':_0xcc2c('0x10e')});db['FaxAccount'][_0xcc2c('0x10f')](db['CannedAnswer'],{'as':_0xcc2c('0x15a'),'foreignKey':_0xcc2c('0x16e')});db['FaxAccount'][_0xcc2c('0x10f')](db[_0xcc2c('0x4b')],{'as':_0xcc2c('0x16f')});db[_0xcc2c('0x12e')][_0xcc2c('0x10f')](db[_0xcc2c('0x4a')],{'as':_0xcc2c('0x13a')});db[_0xcc2c('0x12e')][_0xcc2c('0x10f')](db['VoiceExtension'],{'as':_0xcc2c('0x170'),'onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0x12e')][_0xcc2c('0x10f')](db[_0xcc2c('0x171')],{'as':_0xcc2c('0x15b')});db[_0xcc2c('0x12e')]['belongsTo'](db[_0xcc2c('0x143')],{'as':_0xcc2c('0x143')});db[_0xcc2c('0x12e')]['belongsTo'](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x16c'),'foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0x12e')]['belongsTo'](db['Pause'],{'as':_0xcc2c('0x146'),'foreignKey':_0xcc2c('0x147')});db[_0xcc2c('0x12e')]['belongsToMany'](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x14a'),'through':_0xcc2c('0x12f')});db[_0xcc2c('0x4a')][_0xcc2c('0x11b')](db['User'],{'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x4a')][_0xcc2c('0x11b')](db['FaxQueue'],{'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x4a')]['belongsTo'](db[_0xcc2c('0x12e')],{'onDelete':'restrict'});db[_0xcc2c('0x4a')][_0xcc2c('0x11b')](db[_0xcc2c('0x8a')],{'onDelete':_0xcc2c('0x169'),'foreignKey':'TagId'});db[_0xcc2c('0x4b')][_0xcc2c('0x10f')](db[_0xcc2c('0x171')],{'as':_0xcc2c('0x15b'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x172')});db['FaxInteraction'][_0xcc2c('0x11b')](db['FaxAccount'],{'as':'Account','foreignKey':_0xcc2c('0x16e')});db[_0xcc2c('0x4b')][_0xcc2c('0x11b')](db[_0xcc2c('0x151')],{'as':_0xcc2c('0x152'),'foreignKey':_0xcc2c('0x153')});db[_0xcc2c('0x4b')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'as':'Owner','foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x4b')][_0xcc2c('0x11c')](db['Tag'],{'through':_0xcc2c('0x173'),'as':_0xcc2c('0x162')});db[_0xcc2c('0x4b')][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'through':_0xcc2c('0x173'),'as':_0xcc2c('0x163')});db[_0xcc2c('0x4b')][_0xcc2c('0x11c')](db['User'],{'as':_0xcc2c('0x164'),'through':_0xcc2c('0x123'),'foreignKey':_0xcc2c('0x172')});db['FaxMessage'][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'onDelete':_0xcc2c('0x10e'),'as':'User'});db[_0xcc2c('0x171')][_0xcc2c('0x11b')](db[_0xcc2c('0x4b')],{'as':'Interaction','foreignKey':_0xcc2c('0x172')});db[_0xcc2c('0x171')][_0xcc2c('0x11b')](db[_0xcc2c('0x151')],{'onDelete':_0xcc2c('0x10e'),'as':_0xcc2c('0x152')});db[_0xcc2c('0x171')][_0xcc2c('0x11b')](db[_0xcc2c('0xe4')],{'as':_0xcc2c('0xe4'),'foreignKey':'AttachmentId'});db['FaxMessage'][_0xcc2c('0x11b')](db[_0xcc2c('0x12e')],{'as':_0xcc2c('0x160'),'foreignKey':'FaxAccountId'});db[_0xcc2c('0x4e')][_0xcc2c('0x11c')](db['User'],{'as':_0xcc2c('0x14a'),'through':'UserFaxQueue'});db[_0xcc2c('0x4e')]['belongsToMany'](db['Team'],{'through':_0xcc2c('0x174'),'as':_0xcc2c('0x14b')});db[_0xcc2c('0x4f')][_0xcc2c('0x11b')](db['FaxAccount'],{});db[_0xcc2c('0x4f')][_0xcc2c('0x11b')](db[_0xcc2c('0xed')],{'as':'List','foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0x4f')][_0xcc2c('0x11b')](db[_0xcc2c('0x151')],{'as':'Contact','foreignKey':'ContactId'});db['FaxQueueReport']['belongsTo'](db[_0xcc2c('0x4b')],{});db[_0xcc2c('0x4f')][_0xcc2c('0x11b')](db[_0xcc2c('0x171')],{});db[_0xcc2c('0x4f')]['belongsTo'](db[_0xcc2c('0x10b')],{});db[_0xcc2c('0x4f')][_0xcc2c('0x11b')](db[_0xcc2c('0x4e')],{});db[_0xcc2c('0x51')]['hasMany'](db[_0xcc2c('0x7d')],{'as':_0xcc2c('0x16d'),'foreignKey':_0xcc2c('0x175'),'onDelete':_0xcc2c('0x10e')});db['SmsAccount'][_0xcc2c('0x10f')](db['CannedAnswer'],{'as':_0xcc2c('0x15a'),'foreignKey':_0xcc2c('0x175')});db['SmsAccount'][_0xcc2c('0x10f')](db[_0xcc2c('0x176')],{'as':_0xcc2c('0x15b'),'foreignKey':_0xcc2c('0x175')});db[_0xcc2c('0x51')]['hasMany'](db[_0xcc2c('0x55')],{'as':_0xcc2c('0x16f')});db[_0xcc2c('0x51')][_0xcc2c('0x10f')](db['SmsApplication'],{'as':_0xcc2c('0x13a')});db[_0xcc2c('0x51')]['belongsTo'](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x16c'),'foreignKey':'ListId'});db['SmsAccount'][_0xcc2c('0x11b')](db[_0xcc2c('0x15e')],{'as':_0xcc2c('0x146'),'foreignKey':_0xcc2c('0x147')});db[_0xcc2c('0x51')][_0xcc2c('0x11c')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x14a'),'through':_0xcc2c('0x133')});db['SmsApplication'][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'onDelete':_0xcc2c('0x169')});db['SmsApplication'][_0xcc2c('0x11b')](db[_0xcc2c('0x57')],{'onDelete':'restrict'});db[_0xcc2c('0x53')]['belongsTo'](db[_0xcc2c('0x51')],{'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x53')][_0xcc2c('0x11b')](db['Interval'],{'onDelete':_0xcc2c('0x169'),'foreignKey':_0xcc2c('0x16a')});db['SmsApplication'][_0xcc2c('0x11b')](db['Tag'],{'onDelete':_0xcc2c('0x169'),'foreignKey':_0xcc2c('0x16b')});db[_0xcc2c('0x55')]['hasMany'](db[_0xcc2c('0x176')],{'as':_0xcc2c('0x15b'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x177')});db[_0xcc2c('0x55')][_0xcc2c('0x11b')](db[_0xcc2c('0x51')],{'as':_0xcc2c('0x160'),'foreignKey':'SmsAccountId'});db[_0xcc2c('0x55')][_0xcc2c('0x11b')](db['CmContact'],{'as':_0xcc2c('0x152'),'foreignKey':_0xcc2c('0x153')});db[_0xcc2c('0x55')][_0xcc2c('0x11b')](db['User'],{'as':_0xcc2c('0x178'),'foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x55')]['belongsToMany'](db[_0xcc2c('0x8a')],{'through':'sms_interaction_has_tags','as':_0xcc2c('0x162')});db['SmsInteraction'][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'through':'sms_interaction_has_tags','as':_0xcc2c('0x163')});db['SmsInteraction'][_0xcc2c('0x11c')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x164'),'through':_0xcc2c('0x124'),'foreignKey':'SmsInteractionId'});db[_0xcc2c('0x176')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'as':'User'});db[_0xcc2c('0x176')][_0xcc2c('0x11b')](db[_0xcc2c('0x151')],{'onDelete':_0xcc2c('0x10e'),'as':_0xcc2c('0x152')});db[_0xcc2c('0x176')]['belongsTo'](db[_0xcc2c('0x55')],{'onDelete':_0xcc2c('0x10e'),'as':'Interaction','foreignKey':_0xcc2c('0x177')});db['SmsMessage'][_0xcc2c('0x11b')](db[_0xcc2c('0x51')],{'as':'Account','foreignKey':_0xcc2c('0x175')});db[_0xcc2c('0x57')][_0xcc2c('0x11c')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x14a'),'through':_0xcc2c('0x36'),'foreignKey':_0xcc2c('0x179')});db['SmsQueue'][_0xcc2c('0x11c')](db[_0xcc2c('0xdd')],{'through':_0xcc2c('0x17a'),'as':_0xcc2c('0x14b')});db['OpenchannelAccount'][_0xcc2c('0x10f')](db[_0xcc2c('0x7d')],{'as':_0xcc2c('0x16d'),'foreignKey':_0xcc2c('0x17b'),'onDelete':_0xcc2c('0x10e')});db['OpenchannelAccount'][_0xcc2c('0x10f')](db[_0xcc2c('0x7c')],{'as':_0xcc2c('0x15a'),'foreignKey':_0xcc2c('0x17b')});db[_0xcc2c('0x58')][_0xcc2c('0x10f')](db['OpenchannelInteraction'],{'as':_0xcc2c('0x16f'),'foreignKey':_0xcc2c('0x17b')});db['OpenchannelAccount'][_0xcc2c('0x10f')](db[_0xcc2c('0x17c')],{'as':_0xcc2c('0x15b'),'foreignKey':_0xcc2c('0x17b')});db[_0xcc2c('0x58')][_0xcc2c('0x10f')](db[_0xcc2c('0x17d')],{'as':'Applications','foreignKey':_0xcc2c('0x17b')});db['OpenchannelAccount'][_0xcc2c('0x11b')](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x16c'),'foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0x58')][_0xcc2c('0x11b')](db[_0xcc2c('0x15e')],{'as':'mandatoryDispositionPause','foreignKey':_0xcc2c('0x147')});db[_0xcc2c('0x58')]['belongsToMany'](db['User'],{'as':_0xcc2c('0x14a'),'through':_0xcc2c('0x17e')});db[_0xcc2c('0x17d')]['belongsTo'](db[_0xcc2c('0x10b')],{'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x17d')][_0xcc2c('0x11b')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0xcc2c('0x17f')});db[_0xcc2c('0x17d')][_0xcc2c('0x11b')](db['OpenchannelAccount'],{'onDelete':_0xcc2c('0x169'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0xcc2c('0x11b')](db[_0xcc2c('0x81')],{'onDelete':_0xcc2c('0x169'),'foreignKey':'IntervalId'});db[_0xcc2c('0x17d')][_0xcc2c('0x11b')](db['Tag'],{'onDelete':_0xcc2c('0x169'),'foreignKey':'TagId'});db[_0xcc2c('0x5b')]['hasMany'](db[_0xcc2c('0x17c')],{'as':_0xcc2c('0x15b'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x180')});db[_0xcc2c('0x5b')]['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0xcc2c('0x17b')});db[_0xcc2c('0x5b')]['belongsTo'](db[_0xcc2c('0x151')],{'as':'Contact','foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x178'),'foreignKey':'UserId'});db[_0xcc2c('0x5b')][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'through':_0xcc2c('0x181'),'as':_0xcc2c('0x162')});db[_0xcc2c('0x5b')][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'through':_0xcc2c('0x181'),'as':_0xcc2c('0x163')});db[_0xcc2c('0x5b')][_0xcc2c('0x11c')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x164'),'through':_0xcc2c('0x125'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'onDelete':_0xcc2c('0x10e'),'as':_0xcc2c('0x10b')});db[_0xcc2c('0x17c')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':_0xcc2c('0x152')});db[_0xcc2c('0x17c')][_0xcc2c('0x11b')](db[_0xcc2c('0x5b')],{'onDelete':_0xcc2c('0x10e'),'as':_0xcc2c('0x182'),'foreignKey':_0xcc2c('0x180')});db[_0xcc2c('0x17c')][_0xcc2c('0x11b')](db[_0xcc2c('0xe4')],{'as':_0xcc2c('0xe4'),'foreignKey':_0xcc2c('0x183')});db[_0xcc2c('0x17c')][_0xcc2c('0x11b')](db['OpenchannelAccount'],{'as':_0xcc2c('0x160'),'foreignKey':_0xcc2c('0x17b')});db[_0xcc2c('0x5e')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xcc2c('0x38'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0xcc2c('0x11c')](db['Team'],{'through':_0xcc2c('0x184'),'as':_0xcc2c('0x14b')});db[_0xcc2c('0x5f')][_0xcc2c('0x10f')](db[_0xcc2c('0x7d')],{'as':_0xcc2c('0x16d'),'foreignKey':_0xcc2c('0x167'),'onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0x5f')]['hasMany'](db[_0xcc2c('0x7c')],{'as':_0xcc2c('0x15a'),'foreignKey':_0xcc2c('0x167')});db[_0xcc2c('0x5f')]['hasMany'](db[_0xcc2c('0x185')],{'as':_0xcc2c('0x186')});db[_0xcc2c('0x5f')][_0xcc2c('0x10f')](db[_0xcc2c('0x114')],{'as':'Interactions'});db['ChatWebsite'][_0xcc2c('0x10f')](db[_0xcc2c('0x63')],{'as':_0xcc2c('0x13a')});db['ChatWebsite']['hasMany'](db[_0xcc2c('0x65')],{'as':_0xcc2c('0x15b')});db[_0xcc2c('0x5f')]['belongsTo'](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x16c'),'foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0x5f')][_0xcc2c('0x11b')](db['Interval'],{'as':_0xcc2c('0x81'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0xcc2c('0x11b')](db[_0xcc2c('0x154')],{'as':'MailAccount','foreignKey':_0xcc2c('0x155')});db['ChatWebsite'][_0xcc2c('0x11b')](db[_0xcc2c('0x15e')],{'as':_0xcc2c('0x146'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcc2c('0x5f')][_0xcc2c('0x11c')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x14a'),'through':_0xcc2c('0x12d')});db[_0xcc2c('0x61')]['belongsTo'](db[_0xcc2c('0x58')],{});db[_0xcc2c('0x61')][_0xcc2c('0x11b')](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x16c'),'foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0x61')]['belongsTo'](db[_0xcc2c('0x151')],{'as':_0xcc2c('0x152'),'foreignKey':'ContactId'});db[_0xcc2c('0x61')][_0xcc2c('0x11b')](db[_0xcc2c('0x5b')],{});db[_0xcc2c('0x61')][_0xcc2c('0x11b')](db[_0xcc2c('0x17c')],{});db[_0xcc2c('0x61')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{});db[_0xcc2c('0x61')][_0xcc2c('0x11b')](db['OpenchannelQueue'],{});db['ChatApplication'][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x187'),'foreignKey':_0xcc2c('0x10d'),'onDelete':_0xcc2c('0x169')});db['ChatApplication'][_0xcc2c('0x11b')](db[_0xcc2c('0x67')],{'as':_0xcc2c('0x188'),'foreignKey':'ChatQueueId','onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x63')][_0xcc2c('0x11b')](db[_0xcc2c('0x5f')],{'as':_0xcc2c('0x189'),'foreignKey':_0xcc2c('0x167'),'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x63')][_0xcc2c('0x11b')](db['Tag'],{'onDelete':_0xcc2c('0x169'),'foreignKey':_0xcc2c('0x16b')});db[_0xcc2c('0x114')][_0xcc2c('0x10f')](db[_0xcc2c('0x65')],{'as':_0xcc2c('0x15b'),'onDelete':'cascade','foreignKey':_0xcc2c('0x18a')});db[_0xcc2c('0x114')]['belongsTo'](db['ChatWebsite'],{'as':_0xcc2c('0x160'),'foreignKey':_0xcc2c('0x167')});db[_0xcc2c('0x114')][_0xcc2c('0x11b')](db['CmContact'],{'as':_0xcc2c('0x152'),'foreignKey':_0xcc2c('0x153')});db[_0xcc2c('0x114')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x178'),'foreignKey':'UserId'});db[_0xcc2c('0x114')]['belongsToMany'](db[_0xcc2c('0x8a')],{'through':'chat_interaction_has_tags','as':_0xcc2c('0x162')});db[_0xcc2c('0x114')][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'through':_0xcc2c('0x18b'),'as':_0xcc2c('0x163')});db['ChatInteraction'][_0xcc2c('0x11c')](db['User'],{'as':_0xcc2c('0x164'),'through':_0xcc2c('0x18c'),'foreignKey':_0xcc2c('0x18a')});db[_0xcc2c('0x65')]['belongsTo'](db[_0xcc2c('0x10b')],{'onDelete':_0xcc2c('0x10e'),'as':_0xcc2c('0x10b')});db['ChatMessage'][_0xcc2c('0x11b')](db[_0xcc2c('0x151')],{'onDelete':'cascade','as':_0xcc2c('0x152'),'foreignKey':_0xcc2c('0x153')});db['ChatMessage'][_0xcc2c('0x11b')](db[_0xcc2c('0x114')],{'onDelete':_0xcc2c('0x10e'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0xcc2c('0x65')][_0xcc2c('0x11b')](db['Attachment'],{'as':_0xcc2c('0xe4'),'foreignKey':_0xcc2c('0x183')});db['ChatMessage']['belongsTo'](db['ChatWebsite'],{'as':_0xcc2c('0x160'),'foreignKey':_0xcc2c('0x167')});db[_0xcc2c('0x66')][_0xcc2c('0x10f')](db[_0xcc2c('0xe4')],{'as':_0xcc2c('0x166'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xcc2c('0x10e'),'hooks':!![]});db[_0xcc2c('0x66')][_0xcc2c('0x11b')](db['CmContact'],{'onDelete':_0xcc2c('0x10e'),'as':_0xcc2c('0x152'),'foreignKey':_0xcc2c('0x153')});db[_0xcc2c('0x66')]['belongsTo'](db['ChatWebsite'],{'as':_0xcc2c('0x160'),'foreignKey':_0xcc2c('0x167')});db['ChatQueue']['belongsToMany'](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x14a'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue']['belongsToMany'](db['Team'],{'through':_0xcc2c('0x18d'),'as':_0xcc2c('0x14b')});db['ChatGroup'][_0xcc2c('0x10f')](db[_0xcc2c('0x18e')],{'as':_0xcc2c('0x15b'),'foreignKey':_0xcc2c('0x18f'),'onDelete':_0xcc2c('0x10e')});db['ChatGroup'][_0xcc2c('0x11c')](db['User'],{'as':_0xcc2c('0x13e'),'through':_0xcc2c('0x11e')});db[_0xcc2c('0x185')][_0xcc2c('0x11b')](db[_0xcc2c('0x5f')],{'as':'Website','foreignKey':_0xcc2c('0x167')});db['CmCompany']['hasMany'](db[_0xcc2c('0x151')],{'as':_0xcc2c('0x11f'),'foreignKey':'CompanyId'});db['CmContact'][_0xcc2c('0x10f')](db[_0xcc2c('0x190')],{'as':_0xcc2c('0x191'),'foreignKey':_0xcc2c('0x192')});db[_0xcc2c('0x151')]['hasMany'](db[_0xcc2c('0x6f')],{'as':_0xcc2c('0x140'),'foreignKey':_0xcc2c('0x153')});db['CmContact'][_0xcc2c('0x10f')](db[_0xcc2c('0x72')],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xcc2c('0x151')][_0xcc2c('0x10f')](db[_0xcc2c('0x74')],{'as':_0xcc2c('0x193'),'foreignKey':_0xcc2c('0x153')});db[_0xcc2c('0x151')][_0xcc2c('0x10f')](db[_0xcc2c('0x76')],{'as':'ReportAgentPreview','foreignKey':_0xcc2c('0x153')});db[_0xcc2c('0x151')][_0xcc2c('0x10f')](db[_0xcc2c('0xd0')],{'as':_0xcc2c('0x142'),'foreignKey':_0xcc2c('0x153')});db['CmContact'][_0xcc2c('0x10f')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xcc2c('0x153'),'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x151')][_0xcc2c('0x10f')](db[_0xcc2c('0x114')],{'as':'ChatInteractions','foreignKey':_0xcc2c('0x153'),'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x151')][_0xcc2c('0x10f')](db[_0xcc2c('0x55')],{'as':_0xcc2c('0x116'),'foreignKey':_0xcc2c('0x153'),'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x151')][_0xcc2c('0x10f')](db[_0xcc2c('0x4b')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x151')][_0xcc2c('0x10f')](db[_0xcc2c('0x117')],{'as':_0xcc2c('0x194'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xcc2c('0x151')][_0xcc2c('0x11b')](db['CmCompany'],{'as':_0xcc2c('0x195'),'foreignKey':_0xcc2c('0x196')});db[_0xcc2c('0x151')]['belongsTo'](db[_0xcc2c('0xed')],{'as':'List','foreignKey':_0xcc2c('0x15c'),'onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0x151')]['belongsToMany'](db[_0xcc2c('0x10b')],{'as':'Users','through':_0xcc2c('0x120')});db[_0xcc2c('0x151')][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'as':_0xcc2c('0x162'),'through':'cm_contact_has_tags'});db[_0xcc2c('0x151')][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'through':_0xcc2c('0x197'),'as':_0xcc2c('0x163')});db[_0xcc2c('0x6f')][_0xcc2c('0x10f')](db[_0xcc2c('0x198')],{'as':_0xcc2c('0x199'),'foreignKey':'CmHopperId'});db['CmHopper']['belongsTo'](db[_0xcc2c('0x151')],{'as':_0xcc2c('0x152'),'foreignKey':_0xcc2c('0x153'),'onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0x6f')][_0xcc2c('0x11b')](db[_0xcc2c('0xed')],{'as':'List','foreignKey':_0xcc2c('0x15c'),'onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0x6f')]['belongsTo'](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x187'),'foreignKey':_0xcc2c('0x10d')});db['CmHopper'][_0xcc2c('0x11b')](db[_0xcc2c('0x19')],{'as':_0xcc2c('0x188'),'foreignKey':_0xcc2c('0x13f'),'onDelete':_0xcc2c('0x10e')});db['CmHopper'][_0xcc2c('0x11b')](db[_0xcc2c('0x19a')],{'as':_0xcc2c('0x19a'),'foreignKey':_0xcc2c('0x19b'),'onDelete':_0xcc2c('0x10e')});db['CmHopper']['belongsTo'](db['User'],{'as':_0xcc2c('0x178'),'foreignKey':'OwnerId'});db[_0xcc2c('0x70')]['belongsTo'](db[_0xcc2c('0x151')],{'as':_0xcc2c('0x152'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopperBlack'][_0xcc2c('0x11b')](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x16c'),'foreignKey':'ListId','onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0x70')][_0xcc2c('0x11b')](db[_0xcc2c('0x19')],{'as':_0xcc2c('0x188'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xcc2c('0x70')][_0xcc2c('0x11b')](db[_0xcc2c('0x19a')],{'as':_0xcc2c('0x19a'),'foreignKey':_0xcc2c('0x19b'),'onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0x19c')][_0xcc2c('0x10f')](db[_0xcc2c('0x7f')],{'as':{'plural':_0xcc2c('0x19d'),'singular':_0xcc2c('0x19e')},'foreignKey':_0xcc2c('0x19f'),'onDelete':_0xcc2c('0x10e'),'hooks':!![]});db[_0xcc2c('0x19c')][_0xcc2c('0x10f')](db[_0xcc2c('0x7f')],{'as':{'plural':_0xcc2c('0x1a0'),'singular':_0xcc2c('0x1a1')},'foreignKey':'AutomationAnyId','onDelete':_0xcc2c('0x10e'),'hooks':!![]});db[_0xcc2c('0x19c')][_0xcc2c('0x10f')](db['Action'],{'as':_0xcc2c('0x1a2'),'foreignKey':_0xcc2c('0x1a3'),'onDelete':_0xcc2c('0x10e'),'hooks':!![]});db[_0xcc2c('0x7d')][_0xcc2c('0x10f')](db[_0xcc2c('0x7d')],{'as':_0xcc2c('0x16d'),'foreignKey':_0xcc2c('0x1a4'),'onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0x81')]['hasMany'](db[_0xcc2c('0x81')],{'as':_0xcc2c('0x1a5'),'foreignKey':_0xcc2c('0x16a'),'onDelete':_0xcc2c('0x10e'),'hooks':!![],'required':![]});db[_0xcc2c('0x81')]['hasMany'](db['VoiceExtension'],{'as':_0xcc2c('0x111'),'foreignKey':_0xcc2c('0x16a'),'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x81')][_0xcc2c('0x10f')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0xcc2c('0x16a')});db[_0xcc2c('0x81')]['hasMany'](db[_0xcc2c('0x63')],{'as':_0xcc2c('0x1a6'),'foreignKey':_0xcc2c('0x16a')});db['Interval'][_0xcc2c('0x10f')](db[_0xcc2c('0x4a')],{'as':'FaxApplications','foreignKey':_0xcc2c('0x16a')});db[_0xcc2c('0x81')][_0xcc2c('0x10f')](db[_0xcc2c('0x53')],{'as':_0xcc2c('0x1a7'),'foreignKey':_0xcc2c('0x16a')});db[_0xcc2c('0x88')]['belongsTo'](db[_0xcc2c('0x154')],{});db[_0xcc2c('0x88')][_0xcc2c('0x11b')](db[_0xcc2c('0x9a')],{'foreignKey':_0xcc2c('0x1a8')});db[_0xcc2c('0x88')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0xcc2c('0x13b')][_0xcc2c('0x11c')](db[_0xcc2c('0x1a9')],{'as':_0xcc2c('0x1aa'),'through':_0xcc2c('0x13d'),'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x8a')][_0xcc2c('0x11c')](db[_0xcc2c('0x151')],{'through':'cm_contact_has_tags'});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':_0xcc2c('0x18b')});db['Tag'][_0xcc2c('0x11c')](db[_0xcc2c('0x117')],{'through':_0xcc2c('0x161')});db['Tag'][_0xcc2c('0x11c')](db[_0xcc2c('0x55')],{'through':'sms_interaction_has_tags'});db[_0xcc2c('0x8a')][_0xcc2c('0x11c')](db['FaxInteraction'],{'through':_0xcc2c('0x173')});db[_0xcc2c('0x8a')]['belongsToMany'](db[_0xcc2c('0x5b')],{'through':_0xcc2c('0x181')});db[_0xcc2c('0x8a')]['belongsToMany'](db[_0xcc2c('0x126')],{'through':'whatsapp_interaction_has_tags'});db['CmContactHasItem']['belongsTo'](db['ContactItemType'],{'as':_0xcc2c('0x1ab'),'foreignKey':_0xcc2c('0x1ac')});db[_0xcc2c('0x198')][_0xcc2c('0x11b')](db['CmHopper'],{'as':_0xcc2c('0x1ad'),'foreignKey':_0xcc2c('0x1ae')});db[_0xcc2c('0x190')]['belongsTo'](db[_0xcc2c('0x151')],{'as':'Contact','foreignKey':_0xcc2c('0x192')});db['Trigger'][_0xcc2c('0x10f')](db[_0xcc2c('0x7f')],{'as':{'plural':_0xcc2c('0x1af'),'singular':_0xcc2c('0x1b0')},'foreignKey':_0xcc2c('0x1b1'),'onDelete':_0xcc2c('0x10e'),'hooks':!![]});db[_0xcc2c('0x92')][_0xcc2c('0x10f')](db[_0xcc2c('0x7f')],{'as':{'plural':_0xcc2c('0x1b2'),'singular':_0xcc2c('0x1b3')},'foreignKey':'TriggerAnyId','onDelete':_0xcc2c('0x10e'),'hooks':!![]});db['Trigger'][_0xcc2c('0x10f')](db[_0xcc2c('0x79')],{'as':_0xcc2c('0x1a2'),'foreignKey':_0xcc2c('0x1b4'),'onDelete':_0xcc2c('0x10e'),'hooks':!![]});db[_0xcc2c('0x98')]['hasMany'](db[_0xcc2c('0x9f')],{'as':'Fields','onDelete':_0xcc2c('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xcc2c('0x9a')][_0xcc2c('0x10f')](db[_0xcc2c('0x9f')],{'as':_0xcc2c('0x1b5'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1a8')});db['AnalyticMetric'][_0xcc2c('0x10f')](db[_0xcc2c('0x9f')],{'as':_0xcc2c('0x1b5'),'onDelete':_0xcc2c('0x10e'),'foreignKey':'MetricId'});db[_0xcc2c('0x9f')][_0xcc2c('0x11b')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0xcc2c('0xa1')]['hasMany'](db[_0xcc2c('0xa2')],{'as':_0xcc2c('0x1b6'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1b7')});db[_0xcc2c('0xa2')][_0xcc2c('0x10f')](db[_0xcc2c('0x1b8')],{'as':_0xcc2c('0x1b9'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1ba')});db[_0xcc2c('0xa2')][_0xcc2c('0x10f')](db[_0xcc2c('0x1b8')],{'as':_0xcc2c('0x1bb'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0xa2')]['hasMany'](db[_0xcc2c('0x1b8')],{'as':_0xcc2c('0x1b5'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xcc2c('0xa2')]['belongsTo'](db[_0xcc2c('0xa1')],{'as':_0xcc2c('0x160'),'foreignKey':_0xcc2c('0x1b7')});db[_0xcc2c('0x1b8')][_0xcc2c('0x10f')](db[_0xcc2c('0x1b8')],{'as':_0xcc2c('0x1bd'),'foreignKey':'SubjectId'});db['SalesforceField'][_0xcc2c('0x10f')](db['SalesforceField'],{'as':_0xcc2c('0x1be'),'foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0x1b8')][_0xcc2c('0x10f')](db[_0xcc2c('0x1b8')],{'as':_0xcc2c('0x1bf'),'foreignKey':_0xcc2c('0x1c0')});db[_0xcc2c('0x1b8')][_0xcc2c('0x11b')](db[_0xcc2c('0x93')],{'as':_0xcc2c('0x93'),'foreignKey':'VariableId'});db[_0xcc2c('0xa4')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0xcc2c('0x1b6'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1b7')});db[_0xcc2c('0x1c1')][_0xcc2c('0x10f')](db[_0xcc2c('0xa7')],{'as':_0xcc2c('0x1b9'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1ba')});db[_0xcc2c('0x1c1')]['hasMany'](db[_0xcc2c('0xa7')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xcc2c('0x1c1')]['hasMany'](db[_0xcc2c('0xa7')],{'as':_0xcc2c('0x1b5'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1c0')});db['SugarcrmConfiguration']['belongsTo'](db[_0xcc2c('0xa4')],{'as':'Account','foreignKey':'AccountId'});db['SugarcrmField']['hasMany'](db[_0xcc2c('0xa7')],{'as':'Subject','foreignKey':_0xcc2c('0x1ba')});db[_0xcc2c('0xa7')][_0xcc2c('0x10f')](db[_0xcc2c('0xa7')],{'as':_0xcc2c('0x1be'),'foreignKey':'DescriptionId'});db[_0xcc2c('0xa7')][_0xcc2c('0x10f')](db['SugarcrmField'],{'as':_0xcc2c('0x1bf'),'foreignKey':_0xcc2c('0x1c0')});db['SugarcrmField'][_0xcc2c('0x11b')](db[_0xcc2c('0x93')],{'as':_0xcc2c('0x93'),'foreignKey':_0xcc2c('0x1c2')});db[_0xcc2c('0xa9')][_0xcc2c('0x10f')](db[_0xcc2c('0xab')],{'as':_0xcc2c('0x1b6'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1b7')});db[_0xcc2c('0xab')][_0xcc2c('0x10f')](db[_0xcc2c('0xad')],{'as':_0xcc2c('0x1b9'),'onDelete':'cascade','foreignKey':_0xcc2c('0x1ba')});db['DeskConfiguration'][_0xcc2c('0x10f')](db[_0xcc2c('0xad')],{'as':_0xcc2c('0x1bb'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0xab')][_0xcc2c('0x10f')](db[_0xcc2c('0xad')],{'as':_0xcc2c('0x1b5'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1c0')});db[_0xcc2c('0xab')][_0xcc2c('0x11b')](db[_0xcc2c('0xa9')],{'as':'Account','foreignKey':_0xcc2c('0x1b7')});db['DeskConfiguration'][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'through':_0xcc2c('0x1c3')});db[_0xcc2c('0xad')]['hasMany'](db[_0xcc2c('0xad')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xcc2c('0xad')][_0xcc2c('0x10f')](db[_0xcc2c('0xad')],{'as':_0xcc2c('0x1be'),'foreignKey':'DescriptionId'});db[_0xcc2c('0xad')][_0xcc2c('0x10f')](db[_0xcc2c('0xad')],{'as':_0xcc2c('0x1bf'),'foreignKey':_0xcc2c('0x1c0')});db[_0xcc2c('0xad')][_0xcc2c('0x11b')](db[_0xcc2c('0x93')],{'as':'Variable','foreignKey':_0xcc2c('0x1c2')});db[_0xcc2c('0x1c4')]['hasMany'](db['ZohoConfiguration'],{'as':_0xcc2c('0x1b6'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1b7')});db['ZohoConfiguration'][_0xcc2c('0x10f')](db[_0xcc2c('0xb0')],{'as':_0xcc2c('0x1b9'),'onDelete':'cascade','foreignKey':_0xcc2c('0x1ba')});db[_0xcc2c('0x1c5')][_0xcc2c('0x10f')](db[_0xcc2c('0xb0')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0x1c5')]['hasMany'](db[_0xcc2c('0xb0')],{'as':_0xcc2c('0x1b5'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1c0')});db['ZohoConfiguration'][_0xcc2c('0x11b')](db[_0xcc2c('0x1c4')],{'as':_0xcc2c('0x160'),'foreignKey':'AccountId'});db[_0xcc2c('0xb0')][_0xcc2c('0x10f')](db[_0xcc2c('0xb0')],{'as':_0xcc2c('0x1bd'),'foreignKey':_0xcc2c('0x1ba')});db[_0xcc2c('0xb0')][_0xcc2c('0x10f')](db[_0xcc2c('0xb0')],{'as':_0xcc2c('0x1be'),'foreignKey':'DescriptionId'});db[_0xcc2c('0xb0')]['hasMany'](db[_0xcc2c('0xb0')],{'as':_0xcc2c('0x1bf'),'foreignKey':_0xcc2c('0x1c0')});db[_0xcc2c('0xb0')]['belongsTo'](db[_0xcc2c('0x93')],{'as':_0xcc2c('0x93'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0xcc2c('0x10f')](db[_0xcc2c('0xb3')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xcc2c('0xb3')][_0xcc2c('0x10f')](db[_0xcc2c('0xb5')],{'as':'Subjects','foreignKey':_0xcc2c('0x1ba')});db['ZendeskConfiguration'][_0xcc2c('0x10f')](db[_0xcc2c('0xb5')],{'as':_0xcc2c('0x1bb'),'foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0xb3')]['hasMany'](db[_0xcc2c('0xb5')],{'as':'Fields','foreignKey':_0xcc2c('0x1c0')});db[_0xcc2c('0xb3')][_0xcc2c('0x11b')](db['ZendeskAccount'],{'as':_0xcc2c('0x160'),'foreignKey':'AccountId'});db[_0xcc2c('0xb3')][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'through':_0xcc2c('0x1c6')});db['ZendeskField'][_0xcc2c('0x10f')](db[_0xcc2c('0xb5')],{'as':_0xcc2c('0x1bd'),'foreignKey':_0xcc2c('0x1ba')});db[_0xcc2c('0xb5')]['hasMany'](db[_0xcc2c('0xb5')],{'as':_0xcc2c('0x1be'),'foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0xb5')][_0xcc2c('0x10f')](db[_0xcc2c('0xb5')],{'as':_0xcc2c('0x1bf'),'foreignKey':_0xcc2c('0x1c0')});db[_0xcc2c('0xb5')][_0xcc2c('0x11b')](db[_0xcc2c('0x93')],{'as':_0xcc2c('0x93'),'foreignKey':_0xcc2c('0x1c2')});db['FreshdeskAccount'][_0xcc2c('0x10f')](db[_0xcc2c('0xb6')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xcc2c('0xb6')]['hasMany'](db[_0xcc2c('0xb8')],{'as':_0xcc2c('0x1b9'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1ba')});db['FreshdeskConfiguration']['hasMany'](db[_0xcc2c('0xb8')],{'as':_0xcc2c('0x1bb'),'onDelete':'cascade','foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0xb6')][_0xcc2c('0x10f')](db['FreshdeskField'],{'as':_0xcc2c('0x1b5'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1c0')});db[_0xcc2c('0xb6')][_0xcc2c('0x11b')](db[_0xcc2c('0x1c7')],{'as':'Account','foreignKey':_0xcc2c('0x1b7')});db[_0xcc2c('0xb6')][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'through':_0xcc2c('0x1c8')});db[_0xcc2c('0xb8')][_0xcc2c('0x10f')](db[_0xcc2c('0xb8')],{'as':_0xcc2c('0x1bd'),'foreignKey':'SubjectId'});db[_0xcc2c('0xb8')][_0xcc2c('0x10f')](db[_0xcc2c('0xb8')],{'as':_0xcc2c('0x1be'),'foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0xb8')]['hasMany'](db[_0xcc2c('0xb8')],{'as':_0xcc2c('0x1bf'),'foreignKey':_0xcc2c('0x1c0')});db['FreshdeskField'][_0xcc2c('0x11b')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xcc2c('0x1c9')]['hasMany'](db[_0xcc2c('0xba')],{'as':_0xcc2c('0x1b6'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1b7')});db[_0xcc2c('0xba')][_0xcc2c('0x10f')](db[_0xcc2c('0xbc')],{'as':'Subjects','foreignKey':_0xcc2c('0x1ba')});db['VtigerConfiguration'][_0xcc2c('0x10f')](db[_0xcc2c('0xbc')],{'as':_0xcc2c('0x1bb'),'foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0xba')][_0xcc2c('0x10f')](db[_0xcc2c('0xbc')],{'as':_0xcc2c('0x1b5'),'foreignKey':'FieldId'});db[_0xcc2c('0xba')][_0xcc2c('0x11b')](db[_0xcc2c('0x1c9')],{'as':_0xcc2c('0x160'),'foreignKey':_0xcc2c('0x1b7')});db[_0xcc2c('0xbc')]['hasMany'](db[_0xcc2c('0xbc')],{'as':_0xcc2c('0x1bd'),'foreignKey':_0xcc2c('0x1ba')});db['VtigerField'][_0xcc2c('0x10f')](db[_0xcc2c('0xbc')],{'as':_0xcc2c('0x1be'),'foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0xbc')]['hasMany'](db['VtigerField'],{'as':_0xcc2c('0x1bf'),'foreignKey':_0xcc2c('0x1c0')});db[_0xcc2c('0xbc')]['belongsTo'](db[_0xcc2c('0x93')],{'as':_0xcc2c('0x93'),'foreignKey':'VariableId'});db[_0xcc2c('0xbe')][_0xcc2c('0x10f')](db[_0xcc2c('0x1ca')],{'as':_0xcc2c('0x1b6'),'onDelete':'cascade','foreignKey':_0xcc2c('0x1b7')});db[_0xcc2c('0x1ca')][_0xcc2c('0x10f')](db['ServicenowField'],{'as':'Subjects','foreignKey':_0xcc2c('0x1ba')});db['ServicenowConfiguration'][_0xcc2c('0x10f')](db[_0xcc2c('0xbf')],{'as':_0xcc2c('0x1bb'),'foreignKey':_0xcc2c('0x1bc')});db['ServicenowConfiguration'][_0xcc2c('0x10f')](db[_0xcc2c('0xbf')],{'as':'Fields','foreignKey':_0xcc2c('0x1c0')});db[_0xcc2c('0x1ca')][_0xcc2c('0x11b')](db[_0xcc2c('0xbe')],{'as':_0xcc2c('0x160'),'foreignKey':'AccountId'});db['ServicenowField'][_0xcc2c('0x10f')](db[_0xcc2c('0xbf')],{'as':'Subject','foreignKey':_0xcc2c('0x1ba')});db[_0xcc2c('0xbf')][_0xcc2c('0x10f')](db[_0xcc2c('0xbf')],{'as':_0xcc2c('0x1be'),'foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0xbf')][_0xcc2c('0x10f')](db[_0xcc2c('0xbf')],{'as':_0xcc2c('0x1bf'),'foreignKey':'FieldId'});db[_0xcc2c('0xbf')][_0xcc2c('0x11b')](db[_0xcc2c('0x93')],{'as':_0xcc2c('0x93'),'foreignKey':_0xcc2c('0x1c2')});db['Dynamics365Account'][_0xcc2c('0x10f')](db[_0xcc2c('0x1cb')],{'as':'Configurations','onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1b7')});db[_0xcc2c('0xc1')][_0xcc2c('0x11b')](db[_0xcc2c('0x101')],{'as':_0xcc2c('0x101'),'foreignKey':_0xcc2c('0x156')});db[_0xcc2c('0x1cb')][_0xcc2c('0x10f')](db[_0xcc2c('0x1cc')],{'as':'Subjects','onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1ba')});db[_0xcc2c('0x1cb')][_0xcc2c('0x10f')](db[_0xcc2c('0x1cc')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0x1cb')][_0xcc2c('0x10f')](db[_0xcc2c('0x1cc')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xcc2c('0x1cb')][_0xcc2c('0x11b')](db[_0xcc2c('0xc1')],{'as':_0xcc2c('0x160'),'foreignKey':_0xcc2c('0x1b7')});db[_0xcc2c('0x1cc')][_0xcc2c('0x10f')](db[_0xcc2c('0x1cc')],{'as':_0xcc2c('0x1bd'),'foreignKey':'SubjectId'});db['Dynamics365Field'][_0xcc2c('0x10f')](db[_0xcc2c('0x1cc')],{'as':'Description','foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0x1cc')][_0xcc2c('0x10f')](db[_0xcc2c('0x1cc')],{'as':_0xcc2c('0x1bf'),'foreignKey':_0xcc2c('0x1c0')});db[_0xcc2c('0x1cc')][_0xcc2c('0x11b')](db['Variable'],{'as':'Variable','foreignKey':_0xcc2c('0x1c2')});db['FreshsalesAccount'][_0xcc2c('0x10f')](db[_0xcc2c('0xc5')],{'as':'Configurations','onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1b7')});db['FreshsalesConfiguration'][_0xcc2c('0x10f')](db[_0xcc2c('0xc7')],{'as':'Subjects','foreignKey':_0xcc2c('0x1ba')});db[_0xcc2c('0xc5')][_0xcc2c('0x10f')](db[_0xcc2c('0xc7')],{'as':_0xcc2c('0x1bb'),'foreignKey':'DescriptionId'});db[_0xcc2c('0xc5')][_0xcc2c('0x10f')](db[_0xcc2c('0xc7')],{'as':_0xcc2c('0x1b5'),'foreignKey':'FieldId'});db[_0xcc2c('0xc5')][_0xcc2c('0x11b')](db[_0xcc2c('0x1cd')],{'as':'Account','foreignKey':'AccountId'});db['FreshsalesField'][_0xcc2c('0x10f')](db[_0xcc2c('0xc7')],{'as':_0xcc2c('0x1bd'),'foreignKey':_0xcc2c('0x1ba')});db[_0xcc2c('0xc7')][_0xcc2c('0x10f')](db[_0xcc2c('0xc7')],{'as':_0xcc2c('0x1be'),'foreignKey':_0xcc2c('0x1bc')});db[_0xcc2c('0xc7')][_0xcc2c('0x10f')](db[_0xcc2c('0xc7')],{'as':_0xcc2c('0x1bf'),'foreignKey':_0xcc2c('0x1c0')});db['FreshsalesField'][_0xcc2c('0x11b')](db[_0xcc2c('0x93')],{'as':_0xcc2c('0x93'),'foreignKey':_0xcc2c('0x1c2')});db[_0xcc2c('0x1ce')][_0xcc2c('0x11b')](db[_0xcc2c('0x5f')],{});db[_0xcc2c('0x1ce')][_0xcc2c('0x11b')](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x16c'),'foreignKey':_0xcc2c('0x15c')});db['ChatQueueReport'][_0xcc2c('0x11b')](db['CmContact'],{'as':_0xcc2c('0x152'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0xcc2c('0x11b')](db[_0xcc2c('0x114')],{});db[_0xcc2c('0x1ce')][_0xcc2c('0x11b')](db[_0xcc2c('0x65')],{});db[_0xcc2c('0x1ce')]['belongsTo'](db['User'],{});db[_0xcc2c('0x1ce')][_0xcc2c('0x11b')](db[_0xcc2c('0x67')],{});db[_0xcc2c('0x18e')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1cf')});db[_0xcc2c('0x18e')]['belongsTo'](db[_0xcc2c('0x10b')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0xcc2c('0xd0')][_0xcc2c('0x10f')](db[_0xcc2c('0xce')],{'foreignKey':_0xcc2c('0x1d0'),'onDelete':'cascade'});db[_0xcc2c('0xd0')][_0xcc2c('0x10f')](db[_0xcc2c('0xcd')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xcc2c('0xd1')][_0xcc2c('0x11b')](db[_0xcc2c('0x51')],{});db[_0xcc2c('0xd1')][_0xcc2c('0x11b')](db[_0xcc2c('0xed')],{'as':'List','foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0xd1')][_0xcc2c('0x11b')](db[_0xcc2c('0x151')],{'as':_0xcc2c('0x152'),'foreignKey':'ContactId'});db[_0xcc2c('0xd1')][_0xcc2c('0x11b')](db[_0xcc2c('0x55')],{});db[_0xcc2c('0xd1')][_0xcc2c('0x11b')](db[_0xcc2c('0x176')],{});db[_0xcc2c('0xd1')]['belongsTo'](db[_0xcc2c('0x10b')],{});db[_0xcc2c('0xd1')][_0xcc2c('0x11b')](db[_0xcc2c('0x57')],{});db[_0xcc2c('0xd5')][_0xcc2c('0x10f')](db[_0xcc2c('0xd0')],{'foreignKey':_0xcc2c('0x1d1')});db[_0xcc2c('0xd5')][_0xcc2c('0x10f')](db[_0xcc2c('0xce')],{'foreignKey':_0xcc2c('0x1d1')});db[_0xcc2c('0xd5')][_0xcc2c('0x10f')](db[_0xcc2c('0xcd')],{'foreignKey':'ProjectId'});db[_0xcc2c('0x135')][_0xcc2c('0x11c')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x164'),'through':'user_has_square_projects'});db['Team']['belongsToMany'](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x14a'),'through':_0xcc2c('0x122')});db[_0xcc2c('0xdd')][_0xcc2c('0x11c')](db[_0xcc2c('0x19')],{'through':_0xcc2c('0x103'),'as':_0xcc2c('0x1d2')});db[_0xcc2c('0xdd')]['belongsToMany'](db['MailQueue'],{'through':'team_has_mail_queues','as':_0xcc2c('0x1d3')});db['Team'][_0xcc2c('0x11c')](db['ChatQueue'],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xcc2c('0xdd')][_0xcc2c('0x11c')](db[_0xcc2c('0x4e')],{'through':_0xcc2c('0x174'),'as':_0xcc2c('0x129')});db[_0xcc2c('0xdd')]['belongsToMany'](db[_0xcc2c('0x57')],{'through':_0xcc2c('0x17a'),'as':_0xcc2c('0x12a')});db[_0xcc2c('0xdd')][_0xcc2c('0x11c')](db['OpenchannelQueue'],{'through':_0xcc2c('0x184'),'as':_0xcc2c('0x1d4')});db[_0xcc2c('0xdd')][_0xcc2c('0x11c')](db[_0xcc2c('0xff')],{'through':_0xcc2c('0x1d5'),'as':_0xcc2c('0x12b')});db[_0xcc2c('0xdd')]['belongsToMany'](db[_0xcc2c('0xef')],{'through':_0xcc2c('0x105'),'as':'VoicePrefixes'});db['Campaign'][_0xcc2c('0x10f')](db[_0xcc2c('0x6f')],{'as':'Hoppers','foreignKey':_0xcc2c('0x19b')});db[_0xcc2c('0x19a')][_0xcc2c('0x10f')](db[_0xcc2c('0x72')],{'as':_0xcc2c('0x112'),'foreignKey':_0xcc2c('0x19b')});db[_0xcc2c('0x19a')][_0xcc2c('0x10f')](db[_0xcc2c('0x74')],{'as':_0xcc2c('0x193'),'foreignKey':_0xcc2c('0x19b')});db['Campaign'][_0xcc2c('0x10f')](db[_0xcc2c('0x70')],{'as':_0xcc2c('0x141'),'foreignKey':'CampaignId'});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0xcc2c('0x143'),'foreignKey':_0xcc2c('0x144')});db[_0xcc2c('0x19a')][_0xcc2c('0x11b')](db[_0xcc2c('0x143')],{'as':_0xcc2c('0x145'),'foreignKey':'TrunkBackupId'});db['Campaign']['belongsTo'](db[_0xcc2c('0x81')],{'as':_0xcc2c('0x81'),'foreignKey':_0xcc2c('0x16a')});db[_0xcc2c('0x19a')]['belongsTo'](db[_0xcc2c('0x135')],{'as':'SquareProject','foreignKey':_0xcc2c('0x1d6')});db[_0xcc2c('0x19a')][_0xcc2c('0x11c')](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x148'),'through':_0xcc2c('0x1d7')});db['Campaign'][_0xcc2c('0x11c')](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x1d8'),'through':'campaigns_has_cm_blacklists'});db[_0xcc2c('0xe4')][_0xcc2c('0x11b')](db['ChatOfflineMessage'],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xcc2c('0x1d9')][_0xcc2c('0x11b')](db['MailMessage'],{});db['MailTransferReport'][_0xcc2c('0x11b')](db['MailInteraction'],{});db[_0xcc2c('0x1d9')][_0xcc2c('0x11b')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0xcc2c('0x1da')});db[_0xcc2c('0x1d9')][_0xcc2c('0x11b')](db['User'],{'foreignKey':_0xcc2c('0x1db'),'as':_0xcc2c('0x1dc')});db[_0xcc2c('0x1d9')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'foreignKey':_0xcc2c('0x1dd'),'as':_0xcc2c('0x1de')});db[_0xcc2c('0x1d9')][_0xcc2c('0x11b')](db[_0xcc2c('0x3f')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0xcc2c('0x1d9')]['belongsTo'](db[_0xcc2c('0x154')],{'foreignKey':_0xcc2c('0x1df'),'as':_0xcc2c('0x1e0')});db['ChatTransferReport'][_0xcc2c('0x11b')](db[_0xcc2c('0x65')],{});db[_0xcc2c('0x1e1')]['belongsTo'](db['ChatInteraction'],{});db[_0xcc2c('0x1e1')][_0xcc2c('0x11b')](db[_0xcc2c('0x5f')],{'foreignKey':_0xcc2c('0x1e2'),'as':'FromAccount'});db['ChatTransferReport'][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'foreignKey':_0xcc2c('0x1db'),'as':_0xcc2c('0x1dc')});db[_0xcc2c('0x1e1')]['belongsTo'](db[_0xcc2c('0x10b')],{'foreignKey':'ToUserId','as':_0xcc2c('0x1de')});db[_0xcc2c('0x1e1')][_0xcc2c('0x11b')](db[_0xcc2c('0x67')],{'foreignKey':_0xcc2c('0x1e3'),'as':'ToQueue'});db['ChatTransferReport'][_0xcc2c('0x11b')](db[_0xcc2c('0x5f')],{'foreignKey':_0xcc2c('0x1e4'),'as':_0xcc2c('0x1e0')});db[_0xcc2c('0xe9')][_0xcc2c('0x11b')](db[_0xcc2c('0x171')],{});db[_0xcc2c('0xe9')][_0xcc2c('0x11b')](db['FaxInteraction'],{});db[_0xcc2c('0xe9')][_0xcc2c('0x11b')](db[_0xcc2c('0x12e')],{'foreignKey':'FromFaxAccountId','as':_0xcc2c('0x1da')});db[_0xcc2c('0xe9')][_0xcc2c('0x11b')](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xcc2c('0xe9')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'foreignKey':_0xcc2c('0x1dd'),'as':_0xcc2c('0x1de')});db['FaxTransferReport'][_0xcc2c('0x11b')](db['FaxQueue'],{'foreignKey':_0xcc2c('0x1e5'),'as':_0xcc2c('0x1e6')});db[_0xcc2c('0xe9')][_0xcc2c('0x11b')](db[_0xcc2c('0x12e')],{'foreignKey':_0xcc2c('0x1e7'),'as':_0xcc2c('0x1e0')});db[_0xcc2c('0xeb')]['belongsTo'](db[_0xcc2c('0x17c')],{});db[_0xcc2c('0xeb')]['belongsTo'](db[_0xcc2c('0x5b')],{});db[_0xcc2c('0xeb')][_0xcc2c('0x11b')](db[_0xcc2c('0x58')],{'foreignKey':_0xcc2c('0x1e8'),'as':_0xcc2c('0x1da')});db[_0xcc2c('0xeb')]['belongsTo'](db[_0xcc2c('0x10b')],{'foreignKey':_0xcc2c('0x1db'),'as':_0xcc2c('0x1dc')});db[_0xcc2c('0xeb')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'foreignKey':'ToUserId','as':'ToAgent'});db['OpenchannelTransferReport']['belongsTo'](db[_0xcc2c('0x5e')],{'foreignKey':_0xcc2c('0x1e9'),'as':_0xcc2c('0x1e6')});db[_0xcc2c('0xeb')][_0xcc2c('0x11b')](db['OpenchannelAccount'],{'foreignKey':_0xcc2c('0x1ea'),'as':'ToAccount'});db[_0xcc2c('0x1eb')]['belongsTo'](db[_0xcc2c('0x176')],{});db[_0xcc2c('0x1eb')]['belongsTo'](db[_0xcc2c('0x55')],{});db['SmsTransferReport'][_0xcc2c('0x11b')](db[_0xcc2c('0x51')],{'foreignKey':_0xcc2c('0x1ec'),'as':_0xcc2c('0x1da')});db[_0xcc2c('0x1eb')][_0xcc2c('0x11b')](db['User'],{'foreignKey':_0xcc2c('0x1db'),'as':_0xcc2c('0x1dc')});db[_0xcc2c('0x1eb')][_0xcc2c('0x11b')](db['User'],{'foreignKey':_0xcc2c('0x1dd'),'as':_0xcc2c('0x1de')});db['SmsTransferReport']['belongsTo'](db[_0xcc2c('0x57')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0xcc2c('0x1eb')][_0xcc2c('0x11b')](db[_0xcc2c('0x51')],{'foreignKey':'ToSmsAccountId','as':_0xcc2c('0x1e0')});db['CmList']['hasMany'](db[_0xcc2c('0x7d')],{'as':_0xcc2c('0x16d'),'foreignKey':_0xcc2c('0x15c'),'onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0xed')][_0xcc2c('0x10f')](db[_0xcc2c('0x77')],{'as':_0xcc2c('0x1ed'),'foreignKey':'ListId'});db[_0xcc2c('0xed')]['hasMany'](db[_0xcc2c('0x151')],{'as':_0xcc2c('0x11f'),'onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0xed')][_0xcc2c('0x10f')](db[_0xcc2c('0x72')],{'as':_0xcc2c('0x112'),'foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0xed')]['hasMany'](db['CmHopperHistory'],{'as':_0xcc2c('0x1ee'),'foreignKey':'ListId'});db[_0xcc2c('0xed')][_0xcc2c('0x10f')](db[_0xcc2c('0x76')],{'as':'ReportAgentPreview','foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0xed')][_0xcc2c('0x11c')](db['VoiceQueue'],{'as':_0xcc2c('0x1ef'),'through':_0xcc2c('0x149')});db[_0xcc2c('0xed')][_0xcc2c('0x11c')](db['User'],{'as':_0xcc2c('0x14a'),'through':_0xcc2c('0x121')});db[_0xcc2c('0xef')]['hasMany'](db[_0xcc2c('0x17')],{'as':'Extensions','onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0xef')][_0xcc2c('0x11c')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x14a'),'through':_0xcc2c('0x107')});db[_0xcc2c('0xef')][_0xcc2c('0x11c')](db[_0xcc2c('0xdd')],{'through':_0xcc2c('0x105'),'as':_0xcc2c('0x14b')});db[_0xcc2c('0xf0')][_0xcc2c('0x10f')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x164'),'foreignKey':'userProfileId'});db[_0xcc2c('0xf0')][_0xcc2c('0x10f')](db[_0xcc2c('0xf2')],{'as':_0xcc2c('0x1f0'),'foreignKey':_0xcc2c('0x1f1'),'onDelete':'cascade'});db[_0xcc2c('0xf2')]['hasMany'](db[_0xcc2c('0x1f2')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0xcc2c('0x10e')});db['WhatsappAccount'][_0xcc2c('0x10f')](db[_0xcc2c('0x7d')],{'as':_0xcc2c('0x16d'),'foreignKey':_0xcc2c('0x1f3'),'onDelete':_0xcc2c('0x10e')});db[_0xcc2c('0xf6')][_0xcc2c('0x10f')](db[_0xcc2c('0x7c')],{'as':'Answers','foreignKey':_0xcc2c('0x1f3')});db['WhatsappAccount'][_0xcc2c('0x10f')](db[_0xcc2c('0xfb')],{'as':_0xcc2c('0x15b'),'foreignKey':_0xcc2c('0x1f3')});db[_0xcc2c('0xf6')]['hasMany'](db['WhatsappInteraction'],{'as':_0xcc2c('0x16f')});db[_0xcc2c('0xf6')][_0xcc2c('0x10f')](db[_0xcc2c('0xf8')],{'as':'Applications'});db[_0xcc2c('0xf6')][_0xcc2c('0x11b')](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x16c'),'foreignKey':_0xcc2c('0x15c')});db[_0xcc2c('0xf6')][_0xcc2c('0x11b')](db['Pause'],{'as':_0xcc2c('0x146'),'foreignKey':_0xcc2c('0x147')});db[_0xcc2c('0xf6')][_0xcc2c('0x11c')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x14a'),'through':_0xcc2c('0x1f4')});db[_0xcc2c('0xf8')]['belongsTo'](db[_0xcc2c('0x10b')],{'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0xf8')][_0xcc2c('0x11b')](db[_0xcc2c('0xff')],{'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0xf8')][_0xcc2c('0x11b')](db[_0xcc2c('0xf6')],{'onDelete':_0xcc2c('0x169')});db[_0xcc2c('0xf8')][_0xcc2c('0x11b')](db[_0xcc2c('0x81')],{'onDelete':_0xcc2c('0x169'),'foreignKey':'IntervalId'});db[_0xcc2c('0xf8')][_0xcc2c('0x11b')](db[_0xcc2c('0x8a')],{'onDelete':_0xcc2c('0x169'),'foreignKey':_0xcc2c('0x16b')});db[_0xcc2c('0x126')][_0xcc2c('0x10f')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xcc2c('0x10e'),'foreignKey':_0xcc2c('0x1f5')});db[_0xcc2c('0x126')][_0xcc2c('0x11b')](db[_0xcc2c('0xf6')],{'as':_0xcc2c('0x160'),'foreignKey':_0xcc2c('0x1f3')});db['WhatsappInteraction']['belongsTo'](db['CmContact'],{'as':_0xcc2c('0x152'),'foreignKey':_0xcc2c('0x153')});db[_0xcc2c('0x126')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'as':'Owner','foreignKey':_0xcc2c('0x10d')});db[_0xcc2c('0x126')][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'through':'whatsapp_interaction_has_tags','as':'Tags'});db[_0xcc2c('0x126')][_0xcc2c('0x11c')](db[_0xcc2c('0x8a')],{'through':_0xcc2c('0x1f6'),'as':_0xcc2c('0x163')});db[_0xcc2c('0x126')][_0xcc2c('0x11c')](db[_0xcc2c('0x10b')],{'as':'Users','through':_0xcc2c('0x127'),'foreignKey':_0xcc2c('0x1f5')});db[_0xcc2c('0xfb')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x10b')});db[_0xcc2c('0xfb')]['belongsTo'](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0xcc2c('0xfb')][_0xcc2c('0x11b')](db[_0xcc2c('0x126')],{'onDelete':_0xcc2c('0x10e'),'as':'Interaction','foreignKey':_0xcc2c('0x1f5')});db[_0xcc2c('0xfb')]['belongsTo'](db[_0xcc2c('0xf6')],{'as':_0xcc2c('0x160'),'foreignKey':_0xcc2c('0x1f3')});db['WhatsappQueueReport'][_0xcc2c('0x11b')](db[_0xcc2c('0xf6')],{});db[_0xcc2c('0xfd')][_0xcc2c('0x11b')](db[_0xcc2c('0xed')],{'as':_0xcc2c('0x16c'),'foreignKey':'ListId'});db[_0xcc2c('0xfd')][_0xcc2c('0x11b')](db[_0xcc2c('0x151')],{'as':'Contact','foreignKey':_0xcc2c('0x153')});db['WhatsappQueueReport'][_0xcc2c('0x11b')](db[_0xcc2c('0x126')],{});db[_0xcc2c('0xfd')][_0xcc2c('0x11b')](db['WhatsappQueue'],{});db[_0xcc2c('0xfd')][_0xcc2c('0x11b')](db[_0xcc2c('0xfb')],{});db[_0xcc2c('0xfd')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{});db[_0xcc2c('0x1f7')]['belongsTo'](db['WhatsappMessage'],{});db[_0xcc2c('0x1f7')][_0xcc2c('0x11b')](db[_0xcc2c('0x126')],{});db[_0xcc2c('0x1f7')][_0xcc2c('0x11b')](db[_0xcc2c('0xf6')],{'foreignKey':_0xcc2c('0x1f8'),'as':'FromAccount'});db[_0xcc2c('0x1f7')][_0xcc2c('0x11b')](db[_0xcc2c('0xf6')],{'foreignKey':_0xcc2c('0x1f9'),'as':_0xcc2c('0x1e0')});db[_0xcc2c('0x1f7')]['belongsTo'](db[_0xcc2c('0xff')],{'foreignKey':_0xcc2c('0x1fa'),'as':_0xcc2c('0x1e6')});db['WhatsappTransferReport'][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'foreignKey':_0xcc2c('0x1db'),'as':'FromAgent'});db[_0xcc2c('0x1f7')][_0xcc2c('0x11b')](db[_0xcc2c('0x10b')],{'foreignKey':_0xcc2c('0x1dd'),'as':_0xcc2c('0x1de')});db[_0xcc2c('0xff')]['belongsToMany'](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x14a'),'through':_0xcc2c('0x3a'),'foreignKey':'WhatsappQueueId'});db[_0xcc2c('0xff')][_0xcc2c('0x11c')](db[_0xcc2c('0xdd')],{'through':_0xcc2c('0x1d5'),'as':_0xcc2c('0x14b')});db[_0xcc2c('0x109')]['belongsTo'](db[_0xcc2c('0x10b')],{'as':_0xcc2c('0x1fb'),'foreignKey':_0xcc2c('0x10d'),'onDelete':'cascade','hooks':!![]});db[_0xcc2c('0x101')][_0xcc2c('0x10c')](db['Dynamics365Account'],{'as':_0xcc2c('0xc1'),'onDelete':_0xcc2c('0x169')});db['CloudProvider']['hasOne'](db['MailServerIn'],{'as':'Imap','onDelete':_0xcc2c('0x169')});db[_0xcc2c('0x101')]['hasOne'](db[_0xcc2c('0x157')],{'as':_0xcc2c('0x159'),'onDelete':_0xcc2c('0x169')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xc80e=['ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','../api/tag/tag.model','../api/contactItemType/contactItemType.model','CmHopperAdditionalPhone','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','User','hasOne','UserId','userSetting','cascade','hasMany','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','MailInteraction','UserNotification','UserNotifications','SenderId','UserProfile','userProfileId','Groups','chat_group_has_users','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','SmsInteractions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueue','VoicePrefix','VoicePrefixes','MailQueues','ChatQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','MailAccount','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','VoiceContext','Applications','VoiceMusicOnHold','Members','VoiceQueueId','CmHopperHistory','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','Trunk','TrunkId','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Disposition','Dispositions','Messages','Interactions','List','TemplateId','team_has_mail_queues','MailMessage','Owner','mail_interaction_has_tags','Tags','Tag','ThroughTags','Users','MailInteractionId','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','MailApplication','TagId','Answers','FaxAccountId','Exntensions','ListId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','Contacts','CompanyId','CmContactId','Hoppers','JscriptySessionReport','Company','cm_contact_has_tags','CmHopper','CampaignId','OwnerId','Automation','All','OneAll','AutomationAllId','OneAny','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','moh_has_sounds','CmContactHasItem','ContactItemType','ItemType','ItemTypeId','Hopper','CmHopperId','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Field','VariableId','SugarcrmField','Description','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','ZohoConfiguration','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','Subject','VtigerField','Dynamics365Configuration','ChatInternalMessage','ToId','SessionId','SmsQueueReport','ProjectId','VoiceQueues','team_has_chat_queues','FaxQueues','WhatsappQueues','TrunkBackup','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToMailQueueId','ToAccount','FromChatWebsiteId','ToAgent','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','ToFaxAccountId','FromAgent','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSections','Resources','WhatsappAccountId','WhatsappMessage','whatsapp_interaction_has_tags','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','UserSetting','user','exports','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8','sequelizeHistory','defaultsDeep','mysql','utf8mb4','name','utf8_general_ci','database','username','password','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/chatApplication/chatApplication.model'];(function(_0x27a675,_0x44abdc){var _0x35adb6=function(_0x2434c2){while(--_0x2434c2){_0x27a675['push'](_0x27a675['shift']());}};_0x35adb6(++_0x44abdc);}(_0xc80e,0x1a3));var _0xec80=function(_0x503ec3,_0x5f851e){_0x503ec3=_0x503ec3-0x0;var _0x4ce7cf=_0xc80e[_0x503ec3];return _0x4ce7cf;};'use strict';var config=require('../config/environment');var Sequelize=require(_0xec80('0x0'));var _=require(_0xec80('0x1'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0xec80('0x0')]=_['defaultsDeep'](config['sequelize'],{'database':_0xec80('0x2'),'username':_0xec80('0x3'),'password':_0xec80('0x4'),'options':{'host':_0xec80('0x5'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xec80('0x6'),'collate':'utf8_general_ci'}}});config[_0xec80('0x7')]=_[_0xec80('0x8')](config['sequelizeHistory'],{'database':_0xec80('0x2'),'username':_0xec80('0x3'),'password':'xC@LL1234','options':{'host':_0xec80('0x5'),'port':0xcea,'dialect':_0xec80('0x9'),'dialectOptions':{'charset':_0xec80('0xa')},'logging':![],'timezone':timezone[_0xec80('0xb')](),'define':{'charset':_0xec80('0x6'),'collate':_0xec80('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xec80('0x0')][_0xec80('0xd')],config[_0xec80('0x0')][_0xec80('0xe')],config['sequelize'][_0xec80('0xf')],config[_0xec80('0x0')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xec80('0x7')][_0xec80('0xd')],config[_0xec80('0x7')][_0xec80('0xe')],config[_0xec80('0x7')][_0xec80('0xf')],config[_0xec80('0x7')]['options'])};db['User']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/user/user.model');db[_0xec80('0x11')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x12'));db['VoiceContext']=db[_0xec80('0x0')]['import'](_0xec80('0x13'));db[_0xec80('0x14')]=db[_0xec80('0x0')]['import'](_0xec80('0x15'));db['VoiceMusicOnHold']=db['sequelize'][_0xec80('0x10')](_0xec80('0x16'));db['VoiceQueue']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/voiceQueue/voiceQueue.model');db[_0xec80('0x17')]=db['sequelize'][_0xec80('0x10')]('../api/voiceRecording/voiceRecording.model');db[_0xec80('0x18')]=db['sequelize']['import'](_0xec80('0x19'));db[_0xec80('0x1a')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x1b'));db[_0xec80('0x1c')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x1d'));db[_0xec80('0x1e')]=db['sequelize'][_0xec80('0x10')]('../api/voiceCallReport/voiceCallReport.model');db[_0xec80('0x1f')]=db[_0xec80('0x0')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0xec80('0x20')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x21'));db[_0xec80('0x22')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x23'));db[_0xec80('0x24')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x25'));db['Trunk']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x26'));db[_0xec80('0x27')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x28'));db[_0xec80('0x29')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x2a'));db[_0xec80('0x2b')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x2c'));db[_0xec80('0x2d')]=db[_0xec80('0x0')]['import'](_0xec80('0x2e'));db[_0xec80('0x2f')]=db['sequelize']['import'](_0xec80('0x30'));db[_0xec80('0x31')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x32'));db['UserSmsQueue']=db['sequelize']['import'](_0xec80('0x33'));db[_0xec80('0x34')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x35'));db[_0xec80('0x36')]=db['sequelize']['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xec80('0x37')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x38'));db[_0xec80('0x39')]=db[_0xec80('0x0')]['import'](_0xec80('0x3a'));db['MailAccount']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x3b'));db[_0xec80('0x3c')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x3d'));db['MailSubstatus']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db['sequelize'][_0xec80('0x10')](_0xec80('0x3e'));db['MailMessage']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x3f'));db['MailApplication']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x40'));db[_0xec80('0x41')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x42'));db['Dashboard']=db['sequelize'][_0xec80('0x10')](_0xec80('0x43'));db[_0xec80('0x44')]=db[_0xec80('0x0')]['import'](_0xec80('0x45'));db['FaxAccount']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x46'));db[_0xec80('0x47')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x48'));db[_0xec80('0x49')]=db['sequelize']['import'](_0xec80('0x4a'));db[_0xec80('0x4b')]=db[_0xec80('0x0')]['import'](_0xec80('0x4c'));db[_0xec80('0x4d')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x4e'));db[_0xec80('0x4f')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x50'));db[_0xec80('0x51')]=db['sequelize'][_0xec80('0x10')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x52'));db[_0xec80('0x53')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x54'));db[_0xec80('0x55')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/smsMessage/smsMessage.model');db[_0xec80('0x56')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0xec80('0x0')]['import'](_0xec80('0x57'));db[_0xec80('0x58')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x59'));db[_0xec80('0x5a')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x5b'));db['OpenchannelMessage']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x5c'));db[_0xec80('0x5d')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x5e'));db[_0xec80('0x5f')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x60'));db[_0xec80('0x61')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db['sequelize'][_0xec80('0x10')](_0xec80('0x62'));db[_0xec80('0x63')]=db['sequelize']['import'](_0xec80('0x64'));db[_0xec80('0x65')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x66'));db['ChatOfflineMessage']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x67'));db[_0xec80('0x68')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x69'));db[_0xec80('0x6a')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/chatGroup/chatGroup.model');db[_0xec80('0x6b')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x6c'));db[_0xec80('0x6d')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x6e'));db[_0xec80('0x6f')]=db[_0xec80('0x0')]['import'](_0xec80('0x70'));db['CmHopper']=db[_0xec80('0x0')]['import'](_0xec80('0x71'));db[_0xec80('0x72')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x73'));db[_0xec80('0x74')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x75'));db['CmHopperHistory']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x76'));db[_0xec80('0x77')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xec80('0x78')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x79'));db[_0xec80('0x7a')]=db['sequelize'][_0xec80('0x10')]('../api/action/action.model');db['Automation']=db[_0xec80('0x0')]['import'](_0xec80('0x7b'));db[_0xec80('0x7c')]=db[_0xec80('0x0')]['import'](_0xec80('0x7d'));db['Disposition']=db['sequelize'][_0xec80('0x10')]('../api/disposition/disposition.model');db[_0xec80('0x7e')]=db['sequelize']['import']('../api/condition/condition.model');db[_0xec80('0x7f')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x80'));db['Pause']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x81'));db[_0xec80('0x82')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x83'));db[_0xec80('0x84')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x85'));db[_0xec80('0x86')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/schedule/schedule.model');db[_0xec80('0x87')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x88'));db['Tag']=db[_0xec80('0x0')]['import'](_0xec80('0x89'));db['ContactItemType']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x8a'));db['CmContactHasItem']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0xec80('0x8b')]=db['sequelize']['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xec80('0x8c')]=db['sequelize']['import']('../api/template/template.model');db[_0xec80('0x8d')]=db[_0xec80('0x0')]['import'](_0xec80('0x8e'));db[_0xec80('0x8f')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x90'));db[_0xec80('0x91')]=db[_0xec80('0x0')]['import']('../api/integration/integration.model');db[_0xec80('0x92')]=db[_0xec80('0x0')]['import'](_0xec80('0x93'));db[_0xec80('0x94')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x95'));db[_0xec80('0x96')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x97'));db[_0xec80('0x98')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x99'));db[_0xec80('0x9a')]=db['sequelize']['import'](_0xec80('0x9b'));db[_0xec80('0x9c')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x9d'));db['AnalyticTreeReport']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x9e'));db[_0xec80('0x9f')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa0'));db['SalesforceConfiguration']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xec80('0xa1')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa2'));db[_0xec80('0xa3')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa4'));db[_0xec80('0xa5')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa6'));db['SugarcrmField']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa7'));db[_0xec80('0xa8')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xa9'));db['DeskConfiguration']=db['sequelize']['import'](_0xec80('0xaa'));db[_0xec80('0xab')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xac'));db['ZohoAccount']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xad'));db['ZohoConfiguration']=db['sequelize'][_0xec80('0x10')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xec80('0xae')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xaf'));db[_0xec80('0xb0')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xb1'));db[_0xec80('0xb2')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xb3'));db['ZendeskField']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xb4'));db[_0xec80('0xb5')]=db['sequelize']['import'](_0xec80('0xb6'));db[_0xec80('0xb7')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xec80('0xb8')]=db['sequelize']['import']('../api/intFreshdeskField/intFreshdeskField.model');db[_0xec80('0xb9')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xba'));db[_0xec80('0xbb')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xbc'));db['VtigerField']=db['sequelize'][_0xec80('0x10')](_0xec80('0xbd'));db[_0xec80('0xbe')]=db['sequelize']['import'](_0xec80('0xbf'));db[_0xec80('0xc0')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xec80('0xc1')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xc2'));db[_0xec80('0xc3')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xc4'));db['Dynamics365Configuration']=db['sequelize'][_0xec80('0x10')](_0xec80('0xc5'));db[_0xec80('0xc6')]=db[_0xec80('0x0')]['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xec80('0xc7')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xc8'));db[_0xec80('0xc9')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xca'));db[_0xec80('0xcb')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xcc'));db[_0xec80('0x91')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xcd'));db[_0xec80('0xce')]=db['sequelize']['import']('../api/network/network.model');db[_0xec80('0xcf')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xd0'));db['ChatInternalMessage']=db[_0xec80('0x0')][_0xec80('0x10')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xec80('0xd1')]=db['sequelize']['import'](_0xec80('0xd2'));db[_0xec80('0xd3')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xd4'));db['JscriptySessionReport']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xd5'));db['SmsQueueReport']=db[_0xec80('0x0')]['import']('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db['sequelize'][_0xec80('0x10')](_0xec80('0xd6'));db[_0xec80('0xd7')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xd8'));db[_0xec80('0xd9')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xda'));db[_0xec80('0xdb')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xdc'));db['SquareOdbc']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xdd'));db[_0xec80('0xde')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xdf'));db['SquareRecording']=db['sequelize'][_0xec80('0x10')](_0xec80('0xe0'));db['SquareMessage']=db['sequelize'][_0xec80('0x10')]('../api/squareMessage/squareMessage.model');db[_0xec80('0xe1')]=db[_0xec80('0x0')]['import'](_0xec80('0xe2'));db[_0xec80('0xe3')]=db['sequelize'][_0xec80('0x10')](_0xec80('0xe4'));db[_0xec80('0xe5')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xe6'));db[_0xec80('0xe7')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xe8'));db[_0xec80('0xe9')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/attachment/attachment.model');db[_0xec80('0xea')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xeb'));db[_0xec80('0xec')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xed'));db[_0xec80('0xee')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xef'));db[_0xec80('0xf0')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xf1'));db[_0xec80('0xf2')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xec80('0xf3')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/smsTransferReport/smsTransferReport.model');db[_0xec80('0xf4')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xf5'));db['VoicePrefix']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xf6'));db['UserProfile']=db['sequelize'][_0xec80('0x10')]('../api/userProfile/userProfile.model');db[_0xec80('0xf7')]=db[_0xec80('0x0')][_0xec80('0x10')]('../api/userProfileSection/userProfileSection.model');db[_0xec80('0xf8')]=db['sequelize'][_0xec80('0x10')](_0xec80('0xf9'));db['UserNotification']=db[_0xec80('0x0')]['import']('../api/userNotification/userNotification.model');db[_0xec80('0xfa')]=db['sequelize'][_0xec80('0x10')](_0xec80('0xfb'));db[_0xec80('0xfc')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0xfd'));db[_0xec80('0xfe')]=db[_0xec80('0x0')]['import'](_0xec80('0xff'));db['WhatsappMessage']=db[_0xec80('0x0')]['import']('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x100'));db[_0xec80('0x101')]=db[_0xec80('0x0')]['import'](_0xec80('0x102'));db[_0xec80('0x103')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x104'));db[_0xec80('0x105')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x106'));db[_0xec80('0x107')]=db[_0xec80('0x0')]['import'](_0xec80('0x108'));db[_0xec80('0x109')]=db['sequelize'][_0xec80('0x10')](_0xec80('0x10a'));db[_0xec80('0x10b')]=db[_0xec80('0x0')][_0xec80('0x10')](_0xec80('0x10c'));db['UserSetting']=db[_0xec80('0x0')]['import'](_0xec80('0x10d'));db[_0xec80('0x10e')][_0xec80('0x10f')](db[_0xec80('0x1a')],{'as':_0xec80('0x1a'),'onDelete':'cascade','foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x10f')](db['UserSetting'],{'as':_0xec80('0x111'),'onDelete':_0xec80('0x112'),'foreignKey':'UserId'});db[_0xec80('0x10e')][_0xec80('0x113')](db['VoiceRecording'],{'as':'Recordings','foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db[_0xec80('0x29')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0xec80('0x10e')]['hasMany'](db[_0xec80('0x14')],{'as':_0xec80('0x114'),'onDelete':_0xec80('0x112'),'hooks':!![]});db[_0xec80('0x10e')]['hasMany'](db[_0xec80('0x74')],{'as':_0xec80('0x115'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db['CmHopperHistory'],{'as':_0xec80('0x116'),'foreignKey':_0xec80('0x110')});db['User'][_0xec80('0x113')](db[_0xec80('0x77')],{'as':_0xec80('0x77'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db['OpenchannelInteraction'],{'as':_0xec80('0x117'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db[_0xec80('0x63')],{'as':_0xec80('0x118'),'foreignKey':_0xec80('0x110')});db['User'][_0xec80('0x113')](db[_0xec80('0x53')],{'as':'SmsInteractions','foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')]['hasMany'](db[_0xec80('0x49')],{'as':'FaxInteractions','foreignKey':_0xec80('0x110')});db['User'][_0xec80('0x113')](db[_0xec80('0x119')],{'as':'MailInteractions','foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db[_0xec80('0xfe')],{'as':'WhatsappInteractions','foreignKey':_0xec80('0x110')});db[_0xec80('0x10e')][_0xec80('0x113')](db[_0xec80('0x11a')],{'as':_0xec80('0x11b'),'foreignKey':_0xec80('0x11c')});db['User']['belongsTo'](db[_0xec80('0x11d')],{'as':_0xec80('0x11d'),'foreignKey':_0xec80('0x11e')});db[_0xec80('0x10e')]['belongsToMany'](db[_0xec80('0x6a')],{'as':_0xec80('0x11f'),'through':_0xec80('0x120')});db['User']['belongsToMany'](db[_0xec80('0x6f')],{'as':'Contacts','through':_0xec80('0x121')});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0xf4')],{'as':_0xec80('0x123'),'through':_0xec80('0x124')});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0xe1')],{'through':_0xec80('0x125')});db['User'][_0xec80('0x122')](db[_0xec80('0x119')],{'as':_0xec80('0x126'),'through':_0xec80('0x127')});db[_0xec80('0x10e')][_0xec80('0x122')](db['ChatInteraction'],{'as':_0xec80('0x118'),'through':_0xec80('0x128')});db['User']['belongsToMany'](db[_0xec80('0x49')],{'as':_0xec80('0x129'),'through':_0xec80('0x12a')});db[_0xec80('0x10e')]['belongsToMany'](db[_0xec80('0x53')],{'as':_0xec80('0x12b'),'through':'user_has_sms_interactions'});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x5a')],{'as':'OpenchannelInteractions','through':'user_has_openchannel_interactions'});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0xfe')],{'as':_0xec80('0x12c'),'through':_0xec80('0x12d')});db[_0xec80('0x10e')]['belongsToMany'](db[_0xec80('0x12e')],{'as':'VoiceQueues','through':_0xec80('0x2b'),'required':![]});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x12f')],{'as':_0xec80('0x130'),'through':_0xec80('0x10b'),'required':![]});db['User'][_0xec80('0x122')](db[_0xec80('0x3c')],{'as':_0xec80('0x131'),'through':_0xec80('0x2f'),'required':![]});db['User']['belongsToMany'](db[_0xec80('0x68')],{'as':_0xec80('0x132'),'through':_0xec80('0x2d'),'required':![],'hooks':!![]});db[_0xec80('0x10e')]['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db['User']['belongsToMany'](db[_0xec80('0x56')],{'as':_0xec80('0x133'),'through':_0xec80('0x134'),'required':![]});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x5d')],{'as':_0xec80('0x135'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0xec80('0x122')](db[_0xec80('0x103')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0xf4')],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xec80('0x136')});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x137')],{'as':_0xec80('0x138'),'through':_0xec80('0x139')});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x13a')],{'as':'MailAccounts','through':_0xec80('0x13b')});db[_0xec80('0x10e')][_0xec80('0x122')](db[_0xec80('0x13c')],{'as':_0xec80('0x13d'),'through':_0xec80('0x13e')});db[_0xec80('0x10e')]['belongsToMany'](db['SmsAccount'],{'as':'SmsAccounts','through':_0xec80('0x13f')});db['User']['belongsToMany'](db[_0xec80('0xfa')],{'as':_0xec80('0x140'),'through':_0xec80('0x141')});db[_0xec80('0x10e')]['belongsToMany'](db[_0xec80('0xde')],{'as':_0xec80('0x142'),'through':_0xec80('0x143')});db['VoiceChanSpy']['hasMany'](db[_0xec80('0x14')],{'as':_0xec80('0x144'),'onDelete':'cascade','foreignKey':_0xec80('0x145')});db[_0xec80('0x146')]['hasMany'](db['VoiceExtension'],{'onDelete':'cascade'});db[_0xec80('0x14')]['hasMany'](db['VoiceExtension'],{'as':_0xec80('0x147'),'onDelete':'cascade'});db[_0xec80('0x148')][_0xec80('0x122')](db['Sound'],{'as':'Sounds','through':'moh_has_sounds'});db[_0xec80('0x12e')][_0xec80('0x113')](db[_0xec80('0x29')],{'as':_0xec80('0x149'),'foreignKey':'VoiceQueueId'});db[_0xec80('0x12e')][_0xec80('0x113')](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xec80('0x14a')});db['VoiceQueue'][_0xec80('0x113')](db[_0xec80('0x74')],{'as':_0xec80('0x115'),'foreignKey':_0xec80('0x14a')});db[_0xec80('0x12e')][_0xec80('0x113')](db[_0xec80('0x14b')],{'as':_0xec80('0x14c'),'foreignKey':'VoiceQueueId'});db[_0xec80('0x12e')][_0xec80('0x113')](db['ReportAgentPreview'],{'as':_0xec80('0x77'),'foreignKey':_0xec80('0x14a')});db[_0xec80('0x12e')]['hasMany'](db[_0xec80('0x72')],{'as':_0xec80('0x14d'),'foreignKey':_0xec80('0x14a')});db['VoiceQueue'][_0xec80('0x113')](db['JscriptySessionReport'],{'as':_0xec80('0x14e'),'foreignKey':_0xec80('0x14a')});db[_0xec80('0x12e')][_0xec80('0x14f')](db[_0xec80('0x150')],{'as':_0xec80('0x150'),'foreignKey':_0xec80('0x151')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xec80('0x152')});db[_0xec80('0x12e')][_0xec80('0x14f')](db[_0xec80('0x7f')],{'as':_0xec80('0x7f'),'foreignKey':_0xec80('0x153')});db[_0xec80('0x12e')][_0xec80('0x14f')](db[_0xec80('0x154')],{'as':_0xec80('0x155'),'foreignKey':_0xec80('0x156')});db[_0xec80('0x12e')]['belongsToMany'](db[_0xec80('0xf4')],{'as':_0xec80('0x123'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x2b')});db[_0xec80('0x12e')][_0xec80('0x122')](db['Team'],{'as':_0xec80('0x158'),'through':_0xec80('0x107')});db['VoiceQueue']['belongsToMany'](db[_0xec80('0xf4')],{'as':'BlackLists','through':_0xec80('0x159')});db[_0xec80('0x17')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x10e'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x18')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x10e'),'foreignKey':'UserId'});db[_0xec80('0x1a')][_0xec80('0x113')](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x15a'),'sourceKey':_0xec80('0x15b')});db[_0xec80('0x1c')][_0xec80('0x14f')](db['VoiceMail'],{'foreignKey':_0xec80('0x15a'),'targetKey':'mailbox'});db[_0xec80('0x1e')][_0xec80('0x113')](db[_0xec80('0x22')],{'as':_0xec80('0x15c'),'foreignKey':_0xec80('0x15d'),'constraints':![]});db[_0xec80('0x1e')][_0xec80('0x113')](db[_0xec80('0x20')],{'as':_0xec80('0x15e'),'foreignKey':_0xec80('0x15d'),'constraints':![]});db[_0xec80('0x1e')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':'User','foreignKey':_0xec80('0x110')});db[_0xec80('0x1e')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x37')]['belongsTo'](db['MailAccount'],{'as':_0xec80('0x13a'),'foreignKey':_0xec80('0x161')});db[_0xec80('0x37')]['belongsTo'](db[_0xec80('0x105')],{'as':_0xec80('0x105'),'foreignKey':_0xec80('0x162'),'onDelete':_0xec80('0x163')});db[_0xec80('0x39')][_0xec80('0x14f')](db[_0xec80('0x13a')],{'as':_0xec80('0x13a'),'foreignKey':'MailAccountId'});db[_0xec80('0x39')][_0xec80('0x14f')](db[_0xec80('0x105')],{'as':_0xec80('0x105'),'foreignKey':_0xec80('0x162'),'onDelete':_0xec80('0x163')});db[_0xec80('0x13a')]['hasOne'](db[_0xec80('0x37')],{'as':_0xec80('0x164'),'onDelete':_0xec80('0x112')});db[_0xec80('0x13a')][_0xec80('0x10f')](db[_0xec80('0x39')],{'as':_0xec80('0x165'),'onDelete':_0xec80('0x112')});db['MailAccount']['hasMany'](db[_0xec80('0x166')],{'as':_0xec80('0x167'),'foreignKey':'MailAccountId','onDelete':_0xec80('0x112')});db[_0xec80('0x13a')]['hasMany'](db[_0xec80('0x7c')],{'as':'Answers','foreignKey':_0xec80('0x161')});db[_0xec80('0x13a')][_0xec80('0x113')](db['MailMessage'],{'as':_0xec80('0x168'),'foreignKey':_0xec80('0x161')});db['MailAccount'][_0xec80('0x113')](db['MailInteraction'],{'as':_0xec80('0x169')});db[_0xec80('0x13a')]['hasMany'](db['MailApplication'],{'as':_0xec80('0x147')});db['MailAccount'][_0xec80('0x14f')](db['CmList'],{'as':_0xec80('0x16a'),'foreignKey':'ListId'});db[_0xec80('0x13a')][_0xec80('0x14f')](db[_0xec80('0x8c')],{'as':_0xec80('0x8c'),'foreignKey':_0xec80('0x16b')});db[_0xec80('0x13a')]['belongsTo'](db[_0xec80('0x154')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xec80('0x13a')][_0xec80('0x122')](db['User'],{'as':_0xec80('0x157'),'through':_0xec80('0x13b')});db['MailQueue'][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x2f')});db[_0xec80('0x3c')]['belongsToMany'](db[_0xec80('0xe1')],{'through':_0xec80('0x16c'),'as':'Teams'});db[_0xec80('0x119')][_0xec80('0x113')](db[_0xec80('0x16d')],{'as':_0xec80('0x168'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0xec80('0x119')][_0xec80('0x14f')](db[_0xec80('0x13a')],{'as':'Account','foreignKey':_0xec80('0x161')});db[_0xec80('0x119')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x119')]['belongsTo'](db[_0xec80('0x10e')],{'as':_0xec80('0x16e'),'foreignKey':'UserId'});db[_0xec80('0x119')][_0xec80('0x122')](db['Tag'],{'through':_0xec80('0x16f'),'as':_0xec80('0x170')});db['MailInteraction'][_0xec80('0x122')](db[_0xec80('0x171')],{'through':'mail_interaction_has_tags','as':_0xec80('0x172')});db['MailInteraction'][_0xec80('0x122')](db['User'],{'as':_0xec80('0x173'),'through':_0xec80('0x127'),'foreignKey':_0xec80('0x174')});db['MailMessage'][_0xec80('0x113')](db[_0xec80('0xe9')],{'as':_0xec80('0x175'),'onDelete':'cascade'});db[_0xec80('0x16d')]['belongsTo'](db[_0xec80('0x10e')],{'as':_0xec80('0x10e')});db[_0xec80('0x16d')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x15f')});db['MailMessage'][_0xec80('0x14f')](db[_0xec80('0x119')],{'as':_0xec80('0x176'),'foreignKey':_0xec80('0x174')});db[_0xec80('0x16d')][_0xec80('0x14f')](db[_0xec80('0x13a')],{'as':_0xec80('0x177'),'foreignKey':'MailAccountId'});db['MailMessage'][_0xec80('0x14f')](db[_0xec80('0x5f')],{'as':_0xec80('0x5f'),'foreignKey':_0xec80('0x178')});db[_0xec80('0x16d')][_0xec80('0x14f')](db[_0xec80('0x179')],{'as':'ChatOfflineMessage','foreignKey':_0xec80('0x17a')});db[_0xec80('0x17b')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x163')});db[_0xec80('0x17b')]['belongsTo'](db[_0xec80('0x3c')],{'onDelete':'restrict'});db[_0xec80('0x17b')][_0xec80('0x14f')](db['MailAccount'],{'onDelete':_0xec80('0x163')});db[_0xec80('0x17b')][_0xec80('0x14f')](db[_0xec80('0x7f')],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x153')});db['MailApplication'][_0xec80('0x14f')](db[_0xec80('0x171')],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x17c')});db[_0xec80('0x41')]['belongsTo'](db[_0xec80('0x13a')],{});db[_0xec80('0x41')][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':'ListId'});db[_0xec80('0x41')][_0xec80('0x14f')](db['CmContact'],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x41')][_0xec80('0x14f')](db['MailInteraction'],{});db[_0xec80('0x41')][_0xec80('0x14f')](db[_0xec80('0x16d')],{});db[_0xec80('0x41')][_0xec80('0x14f')](db[_0xec80('0x10e')],{});db[_0xec80('0x41')][_0xec80('0x14f')](db[_0xec80('0x3c')],{});db['Dashboard']['hasMany'](db[_0xec80('0x44')],{'as':'Items','onDelete':_0xec80('0x112')});db[_0xec80('0x137')]['hasMany'](db[_0xec80('0x166')],{'as':_0xec80('0x167'),'foreignKey':'FaxAccountId','onDelete':_0xec80('0x112')});db[_0xec80('0x137')][_0xec80('0x113')](db[_0xec80('0x7c')],{'as':_0xec80('0x17d'),'foreignKey':_0xec80('0x17e')});db['FaxAccount']['hasMany'](db[_0xec80('0x49')],{'as':_0xec80('0x169')});db[_0xec80('0x137')]['hasMany'](db['FaxApplication'],{'as':_0xec80('0x147')});db[_0xec80('0x137')][_0xec80('0x113')](db[_0xec80('0x14')],{'as':_0xec80('0x17f'),'onDelete':_0xec80('0x112')});db['FaxAccount'][_0xec80('0x113')](db[_0xec80('0x4b')],{'as':_0xec80('0x168')});db[_0xec80('0x137')][_0xec80('0x14f')](db[_0xec80('0x150')],{'as':'Trunk'});db[_0xec80('0x137')]['belongsTo'](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db[_0xec80('0x137')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xec80('0x137')]['belongsToMany'](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x139')});db[_0xec80('0x47')][_0xec80('0x14f')](db['User'],{'onDelete':_0xec80('0x163')});db[_0xec80('0x47')]['belongsTo'](db[_0xec80('0x4d')],{'onDelete':_0xec80('0x163')});db[_0xec80('0x47')][_0xec80('0x14f')](db['FaxAccount'],{'onDelete':'restrict'});db[_0xec80('0x47')]['belongsTo'](db[_0xec80('0x171')],{'onDelete':'restrict','foreignKey':_0xec80('0x17c')});db[_0xec80('0x49')][_0xec80('0x113')](db[_0xec80('0x4b')],{'as':_0xec80('0x168'),'onDelete':'cascade','foreignKey':_0xec80('0x181')});db[_0xec80('0x49')][_0xec80('0x14f')](db['FaxAccount'],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x17e')});db['FaxInteraction'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':'Contact','foreignKey':_0xec80('0x160')});db[_0xec80('0x49')][_0xec80('0x14f')](db['User'],{'as':'Owner','foreignKey':_0xec80('0x110')});db[_0xec80('0x49')][_0xec80('0x122')](db['Tag'],{'through':_0xec80('0x182'),'as':_0xec80('0x170')});db['FaxInteraction']['belongsToMany'](db[_0xec80('0x171')],{'through':_0xec80('0x182'),'as':_0xec80('0x172')});db[_0xec80('0x49')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0xec80('0x4b')]['belongsTo'](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x10e')});db[_0xec80('0x4b')]['belongsTo'](db[_0xec80('0x49')],{'as':_0xec80('0x176'),'foreignKey':_0xec80('0x181')});db['FaxMessage'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x15f')});db[_0xec80('0x4b')][_0xec80('0x14f')](db[_0xec80('0xe9')],{'as':_0xec80('0xe9'),'foreignKey':_0xec80('0x183')});db[_0xec80('0x4b')][_0xec80('0x14f')](db[_0xec80('0x137')],{'as':'Account','foreignKey':_0xec80('0x17e')});db[_0xec80('0x4d')][_0xec80('0x122')](db['User'],{'as':_0xec80('0x157'),'through':_0xec80('0x31')});db[_0xec80('0x4d')][_0xec80('0x122')](db[_0xec80('0xe1')],{'through':_0xec80('0x184'),'as':'Teams'});db[_0xec80('0x4f')][_0xec80('0x14f')](db[_0xec80('0x137')],{});db[_0xec80('0x4f')][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db[_0xec80('0x4f')]['belongsTo'](db['CmContact'],{'as':_0xec80('0x15f'),'foreignKey':'ContactId'});db['FaxQueueReport'][_0xec80('0x14f')](db[_0xec80('0x49')],{});db[_0xec80('0x4f')][_0xec80('0x14f')](db[_0xec80('0x4b')],{});db[_0xec80('0x4f')][_0xec80('0x14f')](db[_0xec80('0x10e')],{});db[_0xec80('0x4f')][_0xec80('0x14f')](db[_0xec80('0x4d')],{});db[_0xec80('0x51')][_0xec80('0x113')](db[_0xec80('0x166')],{'as':_0xec80('0x167'),'foreignKey':_0xec80('0x185'),'onDelete':'cascade'});db[_0xec80('0x51')][_0xec80('0x113')](db[_0xec80('0x7c')],{'as':'Answers','foreignKey':'SmsAccountId'});db['SmsAccount'][_0xec80('0x113')](db['SmsMessage'],{'as':'Messages','foreignKey':_0xec80('0x185')});db[_0xec80('0x51')][_0xec80('0x113')](db['SmsInteraction'],{'as':_0xec80('0x169')});db[_0xec80('0x51')][_0xec80('0x113')](db[_0xec80('0x186')],{'as':_0xec80('0x147')});db[_0xec80('0x51')][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':'ListId'});db[_0xec80('0x51')]['belongsTo'](db['Pause'],{'as':_0xec80('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xec80('0x51')]['belongsToMany'](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x13f')});db[_0xec80('0x186')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x163')});db['SmsApplication'][_0xec80('0x14f')](db[_0xec80('0x56')],{'onDelete':'restrict'});db[_0xec80('0x186')][_0xec80('0x14f')](db[_0xec80('0x51')],{'onDelete':_0xec80('0x163')});db['SmsApplication']['belongsTo'](db['Interval'],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x153')});db[_0xec80('0x186')][_0xec80('0x14f')](db['Tag'],{'onDelete':_0xec80('0x163'),'foreignKey':'TagId'});db[_0xec80('0x53')][_0xec80('0x113')](db[_0xec80('0x55')],{'as':_0xec80('0x168'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x187')});db['SmsInteraction']['belongsTo'](db[_0xec80('0x51')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x185')});db[_0xec80('0x53')]['belongsTo'](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':'ContactId'});db[_0xec80('0x53')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x16e'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x53')][_0xec80('0x122')](db['Tag'],{'through':_0xec80('0x188'),'as':_0xec80('0x170')});db[_0xec80('0x53')]['belongsToMany'](db[_0xec80('0x171')],{'through':_0xec80('0x188'),'as':_0xec80('0x172')});db[_0xec80('0x53')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'through':_0xec80('0x189'),'foreignKey':_0xec80('0x187')});db['SmsMessage'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x10e')});db[_0xec80('0x55')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':'cascade','as':_0xec80('0x15f')});db[_0xec80('0x55')]['belongsTo'](db[_0xec80('0x53')],{'onDelete':_0xec80('0x112'),'as':'Interaction','foreignKey':'SmsInteractionId'});db[_0xec80('0x55')][_0xec80('0x14f')](db[_0xec80('0x51')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x185')});db[_0xec80('0x56')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':'Agents','through':_0xec80('0x134'),'foreignKey':_0xec80('0x18a')});db[_0xec80('0x56')][_0xec80('0x122')](db['Team'],{'through':_0xec80('0x18b'),'as':_0xec80('0x158')});db[_0xec80('0x13c')][_0xec80('0x113')](db[_0xec80('0x166')],{'as':'Dispositions','foreignKey':_0xec80('0x18c'),'onDelete':'cascade'});db['OpenchannelAccount'][_0xec80('0x113')](db[_0xec80('0x7c')],{'as':_0xec80('0x17d'),'foreignKey':_0xec80('0x18c')});db[_0xec80('0x13c')][_0xec80('0x113')](db[_0xec80('0x5a')],{'as':_0xec80('0x169'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xec80('0x113')](db[_0xec80('0x18d')],{'as':_0xec80('0x168'),'foreignKey':_0xec80('0x18c')});db[_0xec80('0x13c')][_0xec80('0x113')](db['OpenchannelApplication'],{'as':_0xec80('0x147'),'foreignKey':_0xec80('0x18c')});db[_0xec80('0x13c')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xec80('0x180')});db[_0xec80('0x13c')][_0xec80('0x14f')](db[_0xec80('0x154')],{'as':'mandatoryDispositionPause','foreignKey':_0xec80('0x156')});db[_0xec80('0x13c')]['belongsToMany'](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x13e')});db[_0xec80('0x58')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x163')});db[_0xec80('0x58')][_0xec80('0x14f')](db[_0xec80('0x5d')],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x18e')});db[_0xec80('0x58')][_0xec80('0x14f')](db[_0xec80('0x13c')],{'onDelete':_0xec80('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0xec80('0x58')][_0xec80('0x14f')](db[_0xec80('0x7f')],{'onDelete':_0xec80('0x163'),'foreignKey':'IntervalId'});db[_0xec80('0x58')][_0xec80('0x14f')](db[_0xec80('0x171')],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x17c')});db[_0xec80('0x5a')][_0xec80('0x113')](db[_0xec80('0x18d')],{'as':_0xec80('0x168'),'onDelete':'cascade','foreignKey':_0xec80('0x18f')});db['OpenchannelInteraction']['belongsTo'](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0xec80('0x18c')});db[_0xec80('0x5a')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x5a')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x16e'),'foreignKey':_0xec80('0x110')});db['OpenchannelInteraction'][_0xec80('0x122')](db[_0xec80('0x171')],{'through':'openchannel_interaction_has_tags','as':_0xec80('0x170')});db[_0xec80('0x5a')][_0xec80('0x122')](db['Tag'],{'through':_0xec80('0x190'),'as':_0xec80('0x172')});db[_0xec80('0x5a')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'through':_0xec80('0x191'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x10e')});db[_0xec80('0x18d')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x15f')});db[_0xec80('0x18d')][_0xec80('0x14f')](db[_0xec80('0x5a')],{'onDelete':'cascade','as':_0xec80('0x176'),'foreignKey':_0xec80('0x18f')});db[_0xec80('0x18d')][_0xec80('0x14f')](db[_0xec80('0xe9')],{'as':'Attachment','foreignKey':_0xec80('0x183')});db['OpenchannelMessage']['belongsTo'](db[_0xec80('0x13c')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x18c')});db['OpenchannelQueue']['belongsToMany'](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x34'),'foreignKey':_0xec80('0x18e')});db[_0xec80('0x5d')][_0xec80('0x122')](db['Team'],{'through':_0xec80('0x192'),'as':_0xec80('0x158')});db['ChatWebsite']['hasMany'](db[_0xec80('0x166')],{'as':_0xec80('0x167'),'foreignKey':_0xec80('0x178'),'onDelete':'cascade'});db[_0xec80('0x5f')][_0xec80('0x113')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xec80('0x178')});db[_0xec80('0x5f')][_0xec80('0x113')](db['ChatProactiveAction'],{'as':_0xec80('0x193')});db[_0xec80('0x5f')][_0xec80('0x113')](db[_0xec80('0x63')],{'as':_0xec80('0x169')});db['ChatWebsite'][_0xec80('0x113')](db[_0xec80('0x194')],{'as':_0xec80('0x147')});db[_0xec80('0x5f')][_0xec80('0x113')](db[_0xec80('0x65')],{'as':_0xec80('0x168')});db['ChatWebsite'][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':'List','foreignKey':_0xec80('0x180')});db[_0xec80('0x5f')]['belongsTo'](db[_0xec80('0x7f')],{'as':'Interval','foreignKey':_0xec80('0x153')});db[_0xec80('0x5f')]['belongsTo'](db[_0xec80('0x13a')],{'as':_0xec80('0x13a'),'foreignKey':'MailAccountId'});db['ChatWebsite']['belongsTo'](db[_0xec80('0x154')],{'as':_0xec80('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xec80('0x5f')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':'user_has_chat_websites'});db[_0xec80('0x61')][_0xec80('0x14f')](db[_0xec80('0x13c')],{});db[_0xec80('0x61')][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':'List','foreignKey':_0xec80('0x180')});db[_0xec80('0x61')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':'Contact','foreignKey':_0xec80('0x160')});db[_0xec80('0x61')][_0xec80('0x14f')](db[_0xec80('0x5a')],{});db['OpenchannelQueueReport'][_0xec80('0x14f')](db[_0xec80('0x18d')],{});db[_0xec80('0x61')][_0xec80('0x14f')](db[_0xec80('0x10e')],{});db['OpenchannelQueueReport'][_0xec80('0x14f')](db[_0xec80('0x5d')],{});db[_0xec80('0x194')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x195'),'foreignKey':_0xec80('0x110'),'onDelete':_0xec80('0x163')});db[_0xec80('0x194')][_0xec80('0x14f')](db['ChatQueue'],{'as':_0xec80('0x196'),'foreignKey':_0xec80('0x197'),'onDelete':'restrict'});db[_0xec80('0x194')][_0xec80('0x14f')](db['ChatWebsite'],{'as':_0xec80('0x198'),'foreignKey':_0xec80('0x178'),'onDelete':'restrict'});db['ChatApplication'][_0xec80('0x14f')](db['Tag'],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x17c')});db[_0xec80('0x63')][_0xec80('0x113')](db[_0xec80('0x65')],{'as':'Messages','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x199')});db[_0xec80('0x63')][_0xec80('0x14f')](db[_0xec80('0x5f')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x178')});db[_0xec80('0x63')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db['ChatInteraction'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x16e'),'foreignKey':'UserId'});db['ChatInteraction']['belongsToMany'](db[_0xec80('0x171')],{'through':_0xec80('0x19a'),'as':'Tags'});db['ChatInteraction'][_0xec80('0x122')](db[_0xec80('0x171')],{'through':_0xec80('0x19a'),'as':_0xec80('0x172')});db[_0xec80('0x63')][_0xec80('0x122')](db['User'],{'as':_0xec80('0x173'),'through':_0xec80('0x128'),'foreignKey':'ChatInteractionId'});db[_0xec80('0x65')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':'cascade','as':_0xec80('0x10e')});db['ChatMessage'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':_0xec80('0x112'),'as':'Contact','foreignKey':'ContactId'});db['ChatMessage'][_0xec80('0x14f')](db['ChatInteraction'],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x176'),'foreignKey':_0xec80('0x199')});db[_0xec80('0x65')][_0xec80('0x14f')](db['Attachment'],{'as':_0xec80('0xe9'),'foreignKey':_0xec80('0x183')});db[_0xec80('0x65')]['belongsTo'](db[_0xec80('0x5f')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xec80('0x179')][_0xec80('0x113')](db[_0xec80('0xe9')],{'as':_0xec80('0x175'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0xec80('0x179')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x15f'),'foreignKey':'ContactId'});db[_0xec80('0x179')][_0xec80('0x14f')](db[_0xec80('0x5f')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x178')});db[_0xec80('0x68')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x2d'),'hooks':!![]});db[_0xec80('0x68')]['belongsToMany'](db['Team'],{'through':'team_has_chat_queues','as':_0xec80('0x158')});db[_0xec80('0x6a')][_0xec80('0x113')](db['ChatInternalMessage'],{'as':_0xec80('0x168'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0xec80('0x6a')][_0xec80('0x122')](db['User'],{'as':_0xec80('0x149'),'through':_0xec80('0x120')});db[_0xec80('0x6b')][_0xec80('0x14f')](db[_0xec80('0x5f')],{'as':_0xec80('0x198'),'foreignKey':_0xec80('0x178')});db[_0xec80('0x6d')][_0xec80('0x113')](db[_0xec80('0x6f')],{'as':_0xec80('0x19b'),'foreignKey':_0xec80('0x19c')});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0xec80('0x19d')});db[_0xec80('0x6f')][_0xec80('0x113')](db['CmHopper'],{'as':_0xec80('0x19e'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x6f')]['hasMany'](db[_0xec80('0x74')],{'as':_0xec80('0x115'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x6f')][_0xec80('0x113')](db['CmHopperHistory'],{'as':_0xec80('0x14c'),'foreignKey':'ContactId'});db['CmContact'][_0xec80('0x113')](db['ReportAgentPreview'],{'as':_0xec80('0x77'),'foreignKey':'ContactId'});db[_0xec80('0x6f')]['hasMany'](db[_0xec80('0x19f')],{'as':_0xec80('0x14e'),'foreignKey':'ContactId'});db[_0xec80('0x6f')][_0xec80('0x113')](db[_0xec80('0x5a')],{'as':_0xec80('0x117'),'foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x163')});db[_0xec80('0x6f')]['hasMany'](db[_0xec80('0x63')],{'as':_0xec80('0x118'),'foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x163')});db['CmContact']['hasMany'](db['SmsInteraction'],{'as':_0xec80('0x12b'),'foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x163')});db[_0xec80('0x6f')][_0xec80('0x113')](db[_0xec80('0x49')],{'as':_0xec80('0x129'),'foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x163')});db[_0xec80('0x6f')]['hasMany'](db[_0xec80('0x119')],{'as':_0xec80('0x126'),'foreignKey':'ContactId','onDelete':_0xec80('0x163')});db[_0xec80('0x6f')][_0xec80('0x14f')](db[_0xec80('0x6d')],{'as':_0xec80('0x1a0'),'foreignKey':'CompanyId'});db['CmContact'][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180'),'onDelete':_0xec80('0x112')});db[_0xec80('0x6f')]['belongsToMany'](db['User'],{'as':'Users','through':_0xec80('0x121')});db[_0xec80('0x6f')][_0xec80('0x122')](db[_0xec80('0x171')],{'as':'Tags','through':_0xec80('0x1a1')});db[_0xec80('0x6f')][_0xec80('0x122')](db[_0xec80('0x171')],{'through':_0xec80('0x1a1'),'as':_0xec80('0x172')});db[_0xec80('0x1a2')]['hasMany'](db[_0xec80('0x8b')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0xec80('0x1a2')][_0xec80('0x14f')](db['CmContact'],{'as':'Contact','foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x112')});db['CmHopper'][_0xec80('0x14f')](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180'),'onDelete':_0xec80('0x112')});db[_0xec80('0x1a2')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x195'),'foreignKey':_0xec80('0x110')});db[_0xec80('0x1a2')][_0xec80('0x14f')](db['VoiceQueue'],{'as':_0xec80('0x196'),'foreignKey':_0xec80('0x14a'),'onDelete':'cascade'});db[_0xec80('0x1a2')]['belongsTo'](db['Campaign'],{'as':_0xec80('0xe5'),'foreignKey':_0xec80('0x1a3'),'onDelete':'cascade'});db['CmHopper'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':'Owner','foreignKey':_0xec80('0x1a4')});db['CmHopperBlack'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160'),'onDelete':_0xec80('0x112')});db[_0xec80('0x72')]['belongsTo'](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180'),'onDelete':_0xec80('0x112')});db[_0xec80('0x72')][_0xec80('0x14f')](db['VoiceQueue'],{'as':_0xec80('0x196'),'foreignKey':_0xec80('0x14a'),'onDelete':_0xec80('0x112')});db[_0xec80('0x72')]['belongsTo'](db[_0xec80('0xe5')],{'as':_0xec80('0xe5'),'foreignKey':_0xec80('0x1a3'),'onDelete':'cascade'});db[_0xec80('0x1a5')][_0xec80('0x113')](db[_0xec80('0x7e')],{'as':{'plural':_0xec80('0x1a6'),'singular':_0xec80('0x1a7')},'foreignKey':_0xec80('0x1a8'),'onDelete':'cascade','hooks':!![]});db[_0xec80('0x1a5')]['hasMany'](db[_0xec80('0x7e')],{'as':{'plural':'Any','singular':_0xec80('0x1a9')},'foreignKey':'AutomationAnyId','onDelete':_0xec80('0x112'),'hooks':!![]});db['Automation'][_0xec80('0x113')](db[_0xec80('0x7a')],{'as':'Actions','foreignKey':_0xec80('0x1aa'),'onDelete':_0xec80('0x112'),'hooks':!![]});db['Disposition'][_0xec80('0x113')](db[_0xec80('0x166')],{'as':_0xec80('0x167'),'foreignKey':_0xec80('0x1ab'),'onDelete':_0xec80('0x112')});db[_0xec80('0x7f')][_0xec80('0x113')](db[_0xec80('0x7f')],{'as':_0xec80('0x1ac'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db['Interval'][_0xec80('0x113')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xec80('0x153'),'onDelete':_0xec80('0x163')});db[_0xec80('0x7f')][_0xec80('0x113')](db['MailApplication'],{'as':_0xec80('0x1ad'),'foreignKey':'IntervalId'});db['Interval'][_0xec80('0x113')](db[_0xec80('0x194')],{'as':_0xec80('0x1ae'),'foreignKey':_0xec80('0x153')});db[_0xec80('0x7f')][_0xec80('0x113')](db[_0xec80('0x47')],{'as':_0xec80('0x1af'),'foreignKey':_0xec80('0x153')});db[_0xec80('0x7f')][_0xec80('0x113')](db['SmsApplication'],{'as':_0xec80('0x1b0'),'foreignKey':_0xec80('0x153')});db[_0xec80('0x86')][_0xec80('0x14f')](db[_0xec80('0x13a')],{});db[_0xec80('0x86')][_0xec80('0x14f')](db[_0xec80('0x96')],{'foreignKey':_0xec80('0x1b1')});db[_0xec80('0x86')][_0xec80('0x14f')](db[_0xec80('0x94')],{'foreignKey':_0xec80('0x1b2')});db['Sound']['belongsToMany'](db[_0xec80('0x148')],{'as':'Mohs','through':_0xec80('0x1b3'),'onDelete':'restrict'});db[_0xec80('0x171')][_0xec80('0x122')](db[_0xec80('0x6f')],{'through':_0xec80('0x1a1')});db[_0xec80('0x171')][_0xec80('0x122')](db[_0xec80('0x63')],{'through':_0xec80('0x19a')});db[_0xec80('0x171')][_0xec80('0x122')](db[_0xec80('0x119')],{'through':_0xec80('0x16f')});db['Tag'][_0xec80('0x122')](db[_0xec80('0x53')],{'through':_0xec80('0x188')});db[_0xec80('0x171')][_0xec80('0x122')](db[_0xec80('0x49')],{'through':_0xec80('0x182')});db[_0xec80('0x171')][_0xec80('0x122')](db[_0xec80('0x5a')],{'through':_0xec80('0x190')});db[_0xec80('0x171')]['belongsToMany'](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0xec80('0x1b4')][_0xec80('0x14f')](db[_0xec80('0x1b5')],{'as':_0xec80('0x1b6'),'foreignKey':_0xec80('0x1b7')});db['CmHopperAdditionalPhone'][_0xec80('0x14f')](db[_0xec80('0x1a2')],{'as':_0xec80('0x1b8'),'foreignKey':_0xec80('0x1b9')});db[_0xec80('0x1b4')]['belongsTo'](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x19d')});db[_0xec80('0x8d')][_0xec80('0x113')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0xec80('0x1ba')},'foreignKey':'TriggerAllId','onDelete':_0xec80('0x112'),'hooks':!![]});db[_0xec80('0x8d')]['hasMany'](db[_0xec80('0x7e')],{'as':{'plural':_0xec80('0x1bb'),'singular':_0xec80('0x1bc')},'foreignKey':_0xec80('0x1bd'),'onDelete':_0xec80('0x112'),'hooks':!![]});db[_0xec80('0x8d')][_0xec80('0x113')](db['Action'],{'as':_0xec80('0x1be'),'foreignKey':_0xec80('0x1bf'),'onDelete':_0xec80('0x112'),'hooks':!![]});db[_0xec80('0x94')][_0xec80('0x113')](db[_0xec80('0x9c')],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1b2'),'hooks':!![]});db[_0xec80('0x96')][_0xec80('0x113')](db['AnalyticFieldReport'],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1b1')});db[_0xec80('0x9a')][_0xec80('0x113')](db[_0xec80('0x9c')],{'as':_0xec80('0x1c0'),'onDelete':'cascade','foreignKey':_0xec80('0x1c1')});db['AnalyticFieldReport']['belongsTo'](db[_0xec80('0x9a')],{'foreignKey':'MetricId'});db[_0xec80('0x9f')][_0xec80('0x113')](db[_0xec80('0x1c2')],{'as':_0xec80('0x1c3'),'onDelete':'cascade','foreignKey':_0xec80('0x1c4')});db['SalesforceConfiguration'][_0xec80('0x113')](db[_0xec80('0xa1')],{'as':_0xec80('0x1c5'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0x1c2')][_0xec80('0x113')](db[_0xec80('0xa1')],{'as':_0xec80('0x1c7'),'onDelete':'cascade','foreignKey':_0xec80('0x1c8')});db[_0xec80('0x1c2')][_0xec80('0x113')](db[_0xec80('0xa1')],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0x1c2')]['belongsTo'](db['SalesforceAccount'],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0xa1')][_0xec80('0x113')](db[_0xec80('0xa1')],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db[_0xec80('0xa1')]['hasMany'](db[_0xec80('0xa1')],{'as':'Description','foreignKey':_0xec80('0x1c8')});db[_0xec80('0xa1')][_0xec80('0x113')](db[_0xec80('0xa1')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xa1')][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xa3')][_0xec80('0x113')](db['SugarcrmConfiguration'],{'as':_0xec80('0x1c3'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xec80('0xa5')]['hasMany'](db[_0xec80('0x1cc')],{'as':'Subjects','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0xa5')][_0xec80('0x113')](db['SugarcrmField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xec80('0xa5')][_0xec80('0x113')](db['SugarcrmField'],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xa5')][_0xec80('0x14f')](db[_0xec80('0xa3')],{'as':_0xec80('0x177'),'foreignKey':'AccountId'});db['SugarcrmField'][_0xec80('0x113')](db[_0xec80('0x1cc')],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db['SugarcrmField']['hasMany'](db[_0xec80('0x1cc')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db['SugarcrmField']['hasMany'](db[_0xec80('0x1cc')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0x1cc')]['belongsTo'](db['Variable'],{'as':_0xec80('0x8f'),'foreignKey':'VariableId'});db[_0xec80('0xa8')]['hasMany'](db['DeskConfiguration'],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0x1ce')][_0xec80('0x113')](db[_0xec80('0xab')],{'as':_0xec80('0x1c5'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xec80('0x1ce')]['hasMany'](db[_0xec80('0xab')],{'as':_0xec80('0x1c7'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xec80('0x1ce')][_0xec80('0x113')](db['DeskField'],{'as':'Fields','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0x1ce')][_0xec80('0x14f')](db['DeskAccount'],{'as':_0xec80('0x177'),'foreignKey':'AccountId'});db['DeskConfiguration']['belongsToMany'](db[_0xec80('0x171')],{'through':_0xec80('0x1cf')});db[_0xec80('0xab')][_0xec80('0x113')](db[_0xec80('0xab')],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db[_0xec80('0xab')][_0xec80('0x113')](db['DeskField'],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xab')]['hasMany'](db[_0xec80('0xab')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db['DeskField'][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0x1d0')][_0xec80('0x113')](db[_0xec80('0x1d1')],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0x1d1')][_0xec80('0x113')](db[_0xec80('0xae')],{'as':_0xec80('0x1c5'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0x1d1')][_0xec80('0x113')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0x1d1')]['hasMany'](db[_0xec80('0xae')],{'as':'Fields','onDelete':_0xec80('0x112'),'foreignKey':'FieldId'});db[_0xec80('0x1d1')][_0xec80('0x14f')](db[_0xec80('0x1d0')],{'as':_0xec80('0x177'),'foreignKey':'AccountId'});db[_0xec80('0xae')]['hasMany'](db[_0xec80('0xae')],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db[_0xec80('0xae')][_0xec80('0x113')](db[_0xec80('0xae')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db['ZohoField']['hasMany'](db[_0xec80('0xae')],{'as':_0xec80('0x1ca'),'foreignKey':'FieldId'});db['ZohoField']['belongsTo'](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xb0')][_0xec80('0x113')](db[_0xec80('0xb2')],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xec80('0x113')](db[_0xec80('0x1d2')],{'as':_0xec80('0x1c5'),'foreignKey':'SubjectId'});db[_0xec80('0xb2')][_0xec80('0x113')](db['ZendeskField'],{'as':_0xec80('0x1c7'),'foreignKey':_0xec80('0x1c8')});db['ZendeskConfiguration'][_0xec80('0x113')](db['ZendeskField'],{'as':_0xec80('0x1c0'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xec80('0x14f')](db['ZendeskAccount'],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0xb2')][_0xec80('0x122')](db['Tag'],{'through':_0xec80('0x1d3')});db[_0xec80('0x1d2')]['hasMany'](db[_0xec80('0x1d2')],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db[_0xec80('0x1d2')]['hasMany'](db[_0xec80('0x1d2')],{'as':'Description','foreignKey':_0xec80('0x1c8')});db[_0xec80('0x1d2')][_0xec80('0x113')](db[_0xec80('0x1d2')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db['ZendeskField'][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':'Variable','foreignKey':_0xec80('0x1cb')});db[_0xec80('0xb5')][_0xec80('0x113')](db[_0xec80('0xb7')],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0xb7')][_0xec80('0x113')](db['FreshdeskField'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0xec80('0xb7')]['hasMany'](db[_0xec80('0xb8')],{'as':_0xec80('0x1c7'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xb7')][_0xec80('0x113')](db[_0xec80('0xb8')],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c9')});db['FreshdeskConfiguration']['belongsTo'](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0xec80('0x1c4')});db[_0xec80('0xb7')][_0xec80('0x122')](db[_0xec80('0x171')],{'through':_0xec80('0x1d4')});db[_0xec80('0xb8')][_0xec80('0x113')](db['FreshdeskField'],{'as':_0xec80('0x1d5'),'foreignKey':'SubjectId'});db[_0xec80('0xb8')][_0xec80('0x113')](db[_0xec80('0xb8')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xb8')][_0xec80('0x113')](db[_0xec80('0xb8')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xb8')][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':'Variable','foreignKey':_0xec80('0x1cb')});db[_0xec80('0xb9')][_0xec80('0x113')](db[_0xec80('0xbb')],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':'AccountId'});db[_0xec80('0xbb')][_0xec80('0x113')](db['VtigerField'],{'as':_0xec80('0x1c5'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0xbb')][_0xec80('0x113')](db['VtigerField'],{'as':_0xec80('0x1c7'),'foreignKey':_0xec80('0x1c8')});db['VtigerConfiguration'][_0xec80('0x113')](db[_0xec80('0x1d6')],{'as':_0xec80('0x1c0'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xbb')][_0xec80('0x14f')](db['VtigerAccount'],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0x1d6')]['hasMany'](db[_0xec80('0x1d6')],{'as':_0xec80('0x1d5'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0x1d6')][_0xec80('0x113')](db[_0xec80('0x1d6')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0x1d6')]['hasMany'](db['VtigerField'],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db['VtigerField'][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xbe')]['hasMany'](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xec80('0xc0')][_0xec80('0x113')](db[_0xec80('0xc1')],{'as':_0xec80('0x1c5'),'foreignKey':'SubjectId'});db['ServicenowConfiguration']['hasMany'](db[_0xec80('0xc1')],{'as':_0xec80('0x1c7'),'foreignKey':'DescriptionId'});db[_0xec80('0xc0')][_0xec80('0x113')](db[_0xec80('0xc1')],{'as':_0xec80('0x1c0'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xc0')]['belongsTo'](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xec80('0x1c4')});db[_0xec80('0xc1')][_0xec80('0x113')](db[_0xec80('0xc1')],{'as':_0xec80('0x1d5'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0xc1')][_0xec80('0x113')](db['ServicenowField'],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xc1')][_0xec80('0x113')](db[_0xec80('0xc1')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db['ServicenowField'][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xc3')][_0xec80('0x113')](db[_0xec80('0x1d7')],{'as':'Configurations','onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c4')});db['Dynamics365Account'][_0xec80('0x14f')](db[_0xec80('0x105')],{'as':_0xec80('0x105'),'foreignKey':_0xec80('0x162')});db[_0xec80('0x1d7')][_0xec80('0x113')](db[_0xec80('0xc6')],{'as':_0xec80('0x1c5'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0x1d7')][_0xec80('0x113')](db['Dynamics365Field'],{'as':_0xec80('0x1c7'),'onDelete':'cascade','foreignKey':_0xec80('0x1c8')});db[_0xec80('0x1d7')][_0xec80('0x113')](db[_0xec80('0xc6')],{'as':_0xec80('0x1c0'),'onDelete':_0xec80('0x112'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0xec80('0x14f')](db[_0xec80('0xc3')],{'as':_0xec80('0x177'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0xc6')]['hasMany'](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0xec80('0x1c6')});db[_0xec80('0xc6')][_0xec80('0x113')](db[_0xec80('0xc6')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xc6')][_0xec80('0x113')](db['Dynamics365Field'],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db[_0xec80('0xc6')][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xc7')]['hasMany'](db[_0xec80('0xc9')],{'as':_0xec80('0x1c3'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1c4')});db[_0xec80('0xc9')][_0xec80('0x113')](db[_0xec80('0xcb')],{'as':_0xec80('0x1c5'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0xc9')][_0xec80('0x113')](db[_0xec80('0xcb')],{'as':_0xec80('0x1c7'),'foreignKey':_0xec80('0x1c8')});db[_0xec80('0xc9')][_0xec80('0x113')](db['FreshsalesField'],{'as':_0xec80('0x1c0'),'foreignKey':'FieldId'});db[_0xec80('0xc9')][_0xec80('0x14f')](db['FreshsalesAccount'],{'as':_0xec80('0x177'),'foreignKey':'AccountId'});db[_0xec80('0xcb')][_0xec80('0x113')](db[_0xec80('0xcb')],{'as':_0xec80('0x1d5'),'foreignKey':_0xec80('0x1c6')});db[_0xec80('0xcb')][_0xec80('0x113')](db[_0xec80('0xcb')],{'as':_0xec80('0x1cd'),'foreignKey':_0xec80('0x1c8')});db['FreshsalesField'][_0xec80('0x113')](db[_0xec80('0xcb')],{'as':_0xec80('0x1ca'),'foreignKey':_0xec80('0x1c9')});db['FreshsalesField'][_0xec80('0x14f')](db[_0xec80('0x8f')],{'as':_0xec80('0x8f'),'foreignKey':_0xec80('0x1cb')});db[_0xec80('0xcf')][_0xec80('0x14f')](db[_0xec80('0x5f')],{});db[_0xec80('0xcf')]['belongsTo'](db['CmList'],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db['ChatQueueReport'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':'Contact','foreignKey':_0xec80('0x160')});db[_0xec80('0xcf')][_0xec80('0x14f')](db[_0xec80('0x63')],{});db[_0xec80('0xcf')][_0xec80('0x14f')](db[_0xec80('0x65')],{});db[_0xec80('0xcf')][_0xec80('0x14f')](db[_0xec80('0x10e')],{});db[_0xec80('0xcf')][_0xec80('0x14f')](db[_0xec80('0x68')],{});db[_0xec80('0x1d8')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x112'),'foreignKey':'FromId'});db[_0xec80('0x1d8')][_0xec80('0x14f')](db['User'],{'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x1d9')});db['JscriptySessionReport'][_0xec80('0x113')](db[_0xec80('0xd3')],{'foreignKey':'SessionId','onDelete':_0xec80('0x112')});db[_0xec80('0x19f')][_0xec80('0x113')](db[_0xec80('0xd1')],{'foreignKey':_0xec80('0x1da'),'onDelete':_0xec80('0x112')});db[_0xec80('0x1db')][_0xec80('0x14f')](db[_0xec80('0x51')],{});db[_0xec80('0x1db')][_0xec80('0x14f')](db['CmList'],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db['SmsQueueReport'][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':_0xec80('0x160')});db[_0xec80('0x1db')][_0xec80('0x14f')](db[_0xec80('0x53')],{});db[_0xec80('0x1db')][_0xec80('0x14f')](db[_0xec80('0x55')],{});db[_0xec80('0x1db')]['belongsTo'](db[_0xec80('0x10e')],{});db['SmsQueueReport'][_0xec80('0x14f')](db['SmsQueue'],{});db['JscriptyProject'][_0xec80('0x113')](db['JscriptySessionReport'],{'foreignKey':_0xec80('0x1dc')});db[_0xec80('0xd9')][_0xec80('0x113')](db[_0xec80('0xd3')],{'foreignKey':_0xec80('0x1dc')});db[_0xec80('0xd9')][_0xec80('0x113')](db[_0xec80('0xd1')],{'foreignKey':_0xec80('0x1dc')});db[_0xec80('0xde')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'through':_0xec80('0x143')});db[_0xec80('0xe1')]['belongsToMany'](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x125')});db[_0xec80('0xe1')][_0xec80('0x122')](db['VoiceQueue'],{'through':_0xec80('0x107'),'as':_0xec80('0x1dd')});db[_0xec80('0xe1')][_0xec80('0x122')](db[_0xec80('0x3c')],{'through':_0xec80('0x16c'),'as':_0xec80('0x131')});db['Team']['belongsToMany'](db[_0xec80('0x68')],{'through':_0xec80('0x1de'),'as':_0xec80('0x132')});db[_0xec80('0xe1')]['belongsToMany'](db['FaxQueue'],{'through':_0xec80('0x184'),'as':_0xec80('0x1df')});db[_0xec80('0xe1')][_0xec80('0x122')](db['SmsQueue'],{'through':_0xec80('0x18b'),'as':'SmsQueues'});db['Team'][_0xec80('0x122')](db[_0xec80('0x5d')],{'through':_0xec80('0x192'),'as':_0xec80('0x135')});db[_0xec80('0xe1')][_0xec80('0x122')](db[_0xec80('0x103')],{'through':'team_has_whatsapp_queues','as':_0xec80('0x1e0')});db[_0xec80('0xe1')]['belongsToMany'](db[_0xec80('0x12f')],{'through':_0xec80('0x109'),'as':_0xec80('0x130')});db['Campaign'][_0xec80('0x113')](db[_0xec80('0x1a2')],{'as':'Hoppers','foreignKey':_0xec80('0x1a3')});db[_0xec80('0xe5')][_0xec80('0x113')](db[_0xec80('0x74')],{'as':_0xec80('0x115'),'foreignKey':_0xec80('0x1a3')});db[_0xec80('0xe5')][_0xec80('0x113')](db[_0xec80('0x14b')],{'as':_0xec80('0x14c'),'foreignKey':_0xec80('0x1a3')});db[_0xec80('0xe5')][_0xec80('0x113')](db[_0xec80('0x72')],{'as':'HopperBlacks','foreignKey':_0xec80('0x1a3')});db[_0xec80('0xe5')]['belongsTo'](db[_0xec80('0x150')],{'as':_0xec80('0x150'),'foreignKey':_0xec80('0x151')});db[_0xec80('0xe5')][_0xec80('0x14f')](db[_0xec80('0x150')],{'as':_0xec80('0x1e1'),'foreignKey':_0xec80('0x152')});db[_0xec80('0xe5')][_0xec80('0x14f')](db[_0xec80('0x7f')],{'as':_0xec80('0x7f'),'foreignKey':_0xec80('0x153')});db[_0xec80('0xe5')]['belongsTo'](db[_0xec80('0xde')],{'as':_0xec80('0xde'),'foreignKey':_0xec80('0x1e2')});db['Campaign'][_0xec80('0x122')](db[_0xec80('0xf4')],{'as':'Lists','through':_0xec80('0x1e3')});db[_0xec80('0xe5')]['belongsToMany'](db[_0xec80('0xf4')],{'as':'BlackLists','through':_0xec80('0x1e4')});db[_0xec80('0xe9')][_0xec80('0x14f')](db[_0xec80('0x179')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xec80('0xec')][_0xec80('0x14f')](db[_0xec80('0x16d')],{});db[_0xec80('0xec')][_0xec80('0x14f')](db[_0xec80('0x119')],{});db[_0xec80('0xec')][_0xec80('0x14f')](db[_0xec80('0x13a')],{'foreignKey':_0xec80('0x1e5'),'as':_0xec80('0x1e6')});db[_0xec80('0xec')]['belongsTo'](db['User'],{'foreignKey':_0xec80('0x1e7'),'as':'FromAgent'});db[_0xec80('0xec')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':_0xec80('0x1e8'),'as':'ToAgent'});db['MailTransferReport'][_0xec80('0x14f')](db[_0xec80('0x3c')],{'foreignKey':_0xec80('0x1e9'),'as':'ToQueue'});db[_0xec80('0xec')][_0xec80('0x14f')](db[_0xec80('0x13a')],{'foreignKey':'ToMailAccountId','as':_0xec80('0x1ea')});db[_0xec80('0xee')][_0xec80('0x14f')](db['ChatMessage'],{});db[_0xec80('0xee')][_0xec80('0x14f')](db[_0xec80('0x63')],{});db[_0xec80('0xee')]['belongsTo'](db[_0xec80('0x5f')],{'foreignKey':_0xec80('0x1eb'),'as':_0xec80('0x1e6')});db['ChatTransferReport'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':_0xec80('0x1e7'),'as':'FromAgent'});db['ChatTransferReport'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':_0xec80('0x1e8'),'as':_0xec80('0x1ec')});db[_0xec80('0xee')][_0xec80('0x14f')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xec80('0xee')][_0xec80('0x14f')](db[_0xec80('0x5f')],{'foreignKey':_0xec80('0x1ed'),'as':_0xec80('0x1ea')});db[_0xec80('0xf0')]['belongsTo'](db[_0xec80('0x4b')],{});db[_0xec80('0xf0')]['belongsTo'](db['FaxInteraction'],{});db[_0xec80('0xf0')][_0xec80('0x14f')](db['FaxAccount'],{'foreignKey':_0xec80('0x1ee'),'as':_0xec80('0x1e6')});db[_0xec80('0xf0')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':_0xec80('0x1e7'),'as':'FromAgent'});db[_0xec80('0xf0')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':_0xec80('0x1e8'),'as':_0xec80('0x1ec')});db[_0xec80('0xf0')][_0xec80('0x14f')](db[_0xec80('0x4d')],{'foreignKey':_0xec80('0x1ef'),'as':_0xec80('0x1f0')});db[_0xec80('0xf0')][_0xec80('0x14f')](db[_0xec80('0x137')],{'foreignKey':_0xec80('0x1f1'),'as':_0xec80('0x1ea')});db['OpenchannelTransferReport'][_0xec80('0x14f')](db['OpenchannelMessage'],{});db[_0xec80('0xf2')][_0xec80('0x14f')](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0xec80('0x14f')](db[_0xec80('0x13c')],{'foreignKey':'FromOpenchannelAccountId','as':_0xec80('0x1e6')});db[_0xec80('0xf2')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':'FromUserId','as':_0xec80('0x1f2')});db[_0xec80('0xf2')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0xec80('0x1ec')});db['OpenchannelTransferReport'][_0xec80('0x14f')](db[_0xec80('0x5d')],{'foreignKey':'ToOpenchannelQueueId','as':_0xec80('0x1f0')});db['OpenchannelTransferReport']['belongsTo'](db[_0xec80('0x13c')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0xec80('0xf3')][_0xec80('0x14f')](db[_0xec80('0x55')],{});db['SmsTransferReport'][_0xec80('0x14f')](db[_0xec80('0x53')],{});db[_0xec80('0xf3')][_0xec80('0x14f')](db['SmsAccount'],{'foreignKey':_0xec80('0x1f3'),'as':_0xec80('0x1e6')});db['SmsTransferReport'][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':'FromUserId','as':_0xec80('0x1f2')});db[_0xec80('0xf3')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'foreignKey':'ToUserId','as':_0xec80('0x1ec')});db['SmsTransferReport'][_0xec80('0x14f')](db[_0xec80('0x56')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db['SmsTransferReport'][_0xec80('0x14f')](db[_0xec80('0x51')],{'foreignKey':_0xec80('0x1f4'),'as':_0xec80('0x1ea')});db['CmList']['hasMany'](db[_0xec80('0x166')],{'as':'Dispositions','foreignKey':'ListId','onDelete':'cascade'});db['CmList']['hasMany'](db[_0xec80('0x78')],{'as':_0xec80('0x1f5'),'foreignKey':_0xec80('0x180')});db['CmList'][_0xec80('0x113')](db[_0xec80('0x6f')],{'as':_0xec80('0x19b'),'onDelete':_0xec80('0x112'),'foreignKey':_0xec80('0x180')});db[_0xec80('0xf4')][_0xec80('0x113')](db[_0xec80('0x74')],{'as':'HopperFinals','foreignKey':_0xec80('0x180')});db['CmList']['hasMany'](db[_0xec80('0x14b')],{'as':_0xec80('0x116'),'foreignKey':_0xec80('0x180')});db[_0xec80('0xf4')][_0xec80('0x113')](db[_0xec80('0x77')],{'as':_0xec80('0x77'),'foreignKey':_0xec80('0x180')});db['CmList'][_0xec80('0x122')](db[_0xec80('0x12e')],{'as':_0xec80('0x1f6'),'through':_0xec80('0x1f7')});db[_0xec80('0xf4')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':'Agents','through':_0xec80('0x124')});db[_0xec80('0x12f')][_0xec80('0x113')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0xec80('0x112')});db[_0xec80('0x12f')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x157'),'through':_0xec80('0x10b')});db[_0xec80('0x12f')][_0xec80('0x122')](db[_0xec80('0xe1')],{'through':_0xec80('0x109'),'as':_0xec80('0x158')});db[_0xec80('0x11d')][_0xec80('0x113')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'foreignKey':'userProfileId'});db[_0xec80('0x11d')][_0xec80('0x113')](db[_0xec80('0xf7')],{'as':_0xec80('0x1f8'),'foreignKey':_0xec80('0x11e'),'onDelete':_0xec80('0x112')});db[_0xec80('0xf7')][_0xec80('0x113')](db[_0xec80('0xf8')],{'as':_0xec80('0x1f9'),'foreignKey':'sectionId','onDelete':_0xec80('0x112')});db['WhatsappAccount'][_0xec80('0x113')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xec80('0x1fa'),'onDelete':_0xec80('0x112')});db[_0xec80('0xfa')][_0xec80('0x113')](db[_0xec80('0x7c')],{'as':_0xec80('0x17d'),'foreignKey':_0xec80('0x1fa')});db[_0xec80('0xfa')][_0xec80('0x113')](db[_0xec80('0x1fb')],{'as':_0xec80('0x168'),'foreignKey':'WhatsappAccountId'});db[_0xec80('0xfa')][_0xec80('0x113')](db['WhatsappInteraction'],{'as':_0xec80('0x169')});db['WhatsappAccount']['hasMany'](db[_0xec80('0xfc')],{'as':_0xec80('0x147')});db[_0xec80('0xfa')][_0xec80('0x14f')](db['CmList'],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db[_0xec80('0xfa')][_0xec80('0x14f')](db[_0xec80('0x154')],{'as':_0xec80('0x155'),'foreignKey':_0xec80('0x156')});db[_0xec80('0xfa')]['belongsToMany'](db[_0xec80('0x10e')],{'as':'Agents','through':_0xec80('0x141')});db[_0xec80('0xfc')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'onDelete':_0xec80('0x163')});db['WhatsappApplication'][_0xec80('0x14f')](db[_0xec80('0x103')],{'onDelete':_0xec80('0x163')});db['WhatsappApplication'][_0xec80('0x14f')](db[_0xec80('0xfa')],{'onDelete':_0xec80('0x163')});db[_0xec80('0xfc')]['belongsTo'](db['Interval'],{'onDelete':_0xec80('0x163'),'foreignKey':_0xec80('0x153')});db['WhatsappApplication'][_0xec80('0x14f')](db[_0xec80('0x171')],{'onDelete':'restrict','foreignKey':_0xec80('0x17c')});db[_0xec80('0xfe')][_0xec80('0x113')](db[_0xec80('0x1fb')],{'as':_0xec80('0x168'),'onDelete':_0xec80('0x112'),'foreignKey':'WhatsappInteractionId'});db[_0xec80('0xfe')][_0xec80('0x14f')](db[_0xec80('0xfa')],{'as':_0xec80('0x177'),'foreignKey':'WhatsappAccountId'});db[_0xec80('0xfe')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':'Contact','foreignKey':_0xec80('0x160')});db[_0xec80('0xfe')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x16e'),'foreignKey':_0xec80('0x110')});db[_0xec80('0xfe')]['belongsToMany'](db[_0xec80('0x171')],{'through':_0xec80('0x1fc'),'as':_0xec80('0x170')});db['WhatsappInteraction']['belongsToMany'](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':'ThroughTags'});db[_0xec80('0xfe')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':_0xec80('0x173'),'through':_0xec80('0x12d'),'foreignKey':_0xec80('0x1fd')});db[_0xec80('0x1fb')]['belongsTo'](db['User'],{'as':'User'});db[_0xec80('0x1fb')][_0xec80('0x14f')](db['CmContact'],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x15f')});db[_0xec80('0x1fb')][_0xec80('0x14f')](db[_0xec80('0xfe')],{'onDelete':_0xec80('0x112'),'as':_0xec80('0x176'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0xec80('0x14f')](db[_0xec80('0xfa')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0xec80('0x1fe')][_0xec80('0x14f')](db[_0xec80('0xfa')],{});db[_0xec80('0x1fe')]['belongsTo'](db[_0xec80('0xf4')],{'as':_0xec80('0x16a'),'foreignKey':_0xec80('0x180')});db[_0xec80('0x1fe')][_0xec80('0x14f')](db[_0xec80('0x6f')],{'as':_0xec80('0x15f'),'foreignKey':'ContactId'});db[_0xec80('0x1fe')][_0xec80('0x14f')](db[_0xec80('0xfe')],{});db[_0xec80('0x1fe')]['belongsTo'](db[_0xec80('0x103')],{});db['WhatsappQueueReport'][_0xec80('0x14f')](db[_0xec80('0x1fb')],{});db[_0xec80('0x1fe')][_0xec80('0x14f')](db[_0xec80('0x10e')],{});db[_0xec80('0x101')][_0xec80('0x14f')](db['WhatsappMessage'],{});db[_0xec80('0x101')]['belongsTo'](db[_0xec80('0xfe')],{});db[_0xec80('0x101')][_0xec80('0x14f')](db[_0xec80('0xfa')],{'foreignKey':_0xec80('0x1ff'),'as':_0xec80('0x1e6')});db[_0xec80('0x101')][_0xec80('0x14f')](db[_0xec80('0xfa')],{'foreignKey':_0xec80('0x200'),'as':_0xec80('0x1ea')});db['WhatsappTransferReport'][_0xec80('0x14f')](db['WhatsappQueue'],{'foreignKey':_0xec80('0x201'),'as':_0xec80('0x1f0')});db[_0xec80('0x101')]['belongsTo'](db['User'],{'foreignKey':_0xec80('0x1e7'),'as':'FromAgent'});db[_0xec80('0x101')][_0xec80('0x14f')](db['User'],{'foreignKey':_0xec80('0x1e8'),'as':_0xec80('0x1ec')});db[_0xec80('0x103')][_0xec80('0x122')](db[_0xec80('0x10e')],{'as':'Agents','through':_0xec80('0x36'),'foreignKey':_0xec80('0x202')});db[_0xec80('0x103')][_0xec80('0x122')](db[_0xec80('0xe1')],{'through':'team_has_whatsapp_queues','as':'Teams'});db[_0xec80('0x203')][_0xec80('0x14f')](db[_0xec80('0x10e')],{'as':_0xec80('0x204'),'foreignKey':'UserId','onDelete':_0xec80('0x112'),'hooks':!![]});db[_0xec80('0x105')][_0xec80('0x10f')](db[_0xec80('0xc3')],{'as':'Dynamics365Account','onDelete':'restrict'});db[_0xec80('0x105')]['hasOne'](db[_0xec80('0x37')],{'as':_0xec80('0x164'),'onDelete':_0xec80('0x163')});db[_0xec80('0x105')]['hasOne'](db[_0xec80('0x39')],{'as':'Smtp','onDelete':_0xec80('0x163')});module[_0xec80('0x205')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b390307..8d981a6 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e48=['/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','./api/openchannelQueue','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/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/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','./api/trigger','/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/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./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/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/rpc','./api/rpc','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','default','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount'];(function(_0x382863,_0x2daa3b){var _0xd75526=function(_0x3fa49f){while(--_0x3fa49f){_0x382863['push'](_0x382863['shift']());}};_0xd75526(++_0x2daa3b);}(_0x0e48,0xe2));var _0x80e4=function(_0x31a51a,_0x2b03ac){_0x31a51a=_0x31a51a-0x0;var _0x3b764c=_0x0e48[_0x31a51a];return _0x3b764c;};'use strict';var path=require(_0x80e4('0x0'));var express=require(_0x80e4('0x1'));var errors=require(_0x80e4('0x2'));var config=require(_0x80e4('0x3'));var setupLoggers=require(_0x80e4('0x4'))[_0x80e4('0x5')];var clientSideLogs=require('./api/client-side-logs');exports[_0x80e4('0x6')]=function(_0x271457){return setupLoggers(_0x271457)['then'](function(){_0x271457[_0x80e4('0x7')](_0x80e4('0x8'),require(_0x80e4('0x9')));_0x271457[_0x80e4('0x7')](_0x80e4('0xa'),require('./api/voiceChanSpy'));_0x271457[_0x80e4('0x7')](_0x80e4('0xb'),require(_0x80e4('0xc')));_0x271457['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x271457[_0x80e4('0x7')]('/api/voice/mohs',require(_0x80e4('0xd')));_0x271457[_0x80e4('0x7')](_0x80e4('0xe'),require(_0x80e4('0xf')));_0x271457['use'](_0x80e4('0x10'),require('./api/voiceRecording'));_0x271457[_0x80e4('0x7')](_0x80e4('0x11'),require('./api/screenRecording'));_0x271457[_0x80e4('0x7')](_0x80e4('0x12'),require('./api/voiceMail'));_0x271457['use'](_0x80e4('0x13'),require(_0x80e4('0x14')));_0x271457[_0x80e4('0x7')](_0x80e4('0x15'),require(_0x80e4('0x16')));_0x271457[_0x80e4('0x7')](_0x80e4('0x17'),require('./api/voiceDialReport'));_0x271457[_0x80e4('0x7')](_0x80e4('0x18'),require(_0x80e4('0x19')));_0x271457[_0x80e4('0x7')]('/api/voice/queues/reports',require(_0x80e4('0x1a')));_0x271457[_0x80e4('0x7')](_0x80e4('0x1b'),require(_0x80e4('0x1c')));_0x271457[_0x80e4('0x7')](_0x80e4('0x1d'),require(_0x80e4('0x1e')));_0x271457[_0x80e4('0x7')]('/api/voice/transfers/reports',require(_0x80e4('0x1f')));_0x271457[_0x80e4('0x7')]('/api/mail/out_servers',require(_0x80e4('0x20')));_0x271457[_0x80e4('0x7')](_0x80e4('0x21'),require(_0x80e4('0x22')));_0x271457['use'](_0x80e4('0x23'),require(_0x80e4('0x24')));_0x271457[_0x80e4('0x7')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x271457[_0x80e4('0x7')](_0x80e4('0x25'),require(_0x80e4('0x26')));_0x271457['use'](_0x80e4('0x27'),require(_0x80e4('0x28')));_0x271457[_0x80e4('0x7')](_0x80e4('0x29'),require(_0x80e4('0x2a')));_0x271457[_0x80e4('0x7')]('/api/mail/reports/queue',require(_0x80e4('0x2b')));_0x271457[_0x80e4('0x7')](_0x80e4('0x2c'),require(_0x80e4('0x2d')));_0x271457[_0x80e4('0x7')]('/api/dashboards/items',require(_0x80e4('0x2e')));_0x271457[_0x80e4('0x7')]('/api/fax/accounts',require(_0x80e4('0x2f')));_0x271457[_0x80e4('0x7')](_0x80e4('0x30'),require(_0x80e4('0x31')));_0x271457[_0x80e4('0x7')](_0x80e4('0x32'),require(_0x80e4('0x33')));_0x271457[_0x80e4('0x7')](_0x80e4('0x34'),require('./api/faxMessage'));_0x271457[_0x80e4('0x7')](_0x80e4('0x35'),require(_0x80e4('0x36')));_0x271457[_0x80e4('0x7')](_0x80e4('0x37'),require(_0x80e4('0x38')));_0x271457[_0x80e4('0x7')](_0x80e4('0x39'),require(_0x80e4('0x3a')));_0x271457[_0x80e4('0x7')](_0x80e4('0x3b'),require(_0x80e4('0x3c')));_0x271457[_0x80e4('0x7')]('/api/sms/interactions',require(_0x80e4('0x3d')));_0x271457[_0x80e4('0x7')](_0x80e4('0x3e'),require(_0x80e4('0x3f')));_0x271457[_0x80e4('0x7')](_0x80e4('0x40'),require('./api/smsQueue'));_0x271457['use'](_0x80e4('0x41'),require(_0x80e4('0x42')));_0x271457['use']('/api/openchannel/applications',require(_0x80e4('0x43')));_0x271457[_0x80e4('0x7')]('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x271457[_0x80e4('0x7')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x271457[_0x80e4('0x7')]('/api/openchannel/queues',require(_0x80e4('0x44')));_0x271457['use']('/api/chat/websites',require('./api/chatWebsite'));_0x271457['use'](_0x80e4('0x45'),require(_0x80e4('0x46')));_0x271457['use']('/api/chat/applications',require(_0x80e4('0x47')));_0x271457[_0x80e4('0x7')](_0x80e4('0x48'),require(_0x80e4('0x49')));_0x271457['use'](_0x80e4('0x4a'),require(_0x80e4('0x4b')));_0x271457[_0x80e4('0x7')](_0x80e4('0x4c'),require('./api/chatOfflineMessage'));_0x271457[_0x80e4('0x7')](_0x80e4('0x4d'),require(_0x80e4('0x4e')));_0x271457[_0x80e4('0x7')](_0x80e4('0x4f'),require(_0x80e4('0x50')));_0x271457[_0x80e4('0x7')]('/api/chat/proactive_actions',require(_0x80e4('0x51')));_0x271457[_0x80e4('0x7')](_0x80e4('0x52'),require(_0x80e4('0x53')));_0x271457[_0x80e4('0x7')](_0x80e4('0x54'),require('./api/cmContact'));_0x271457[_0x80e4('0x7')]('/api/cm/hopper',require(_0x80e4('0x55')));_0x271457['use'](_0x80e4('0x56'),require(_0x80e4('0x57')));_0x271457[_0x80e4('0x7')](_0x80e4('0x58'),require(_0x80e4('0x59')));_0x271457[_0x80e4('0x7')](_0x80e4('0x5a'),require(_0x80e4('0x5b')));_0x271457[_0x80e4('0x7')](_0x80e4('0x5c'),require('./api/cmCustomField'));_0x271457[_0x80e4('0x7')]('/api/actions',require(_0x80e4('0x5d')));_0x271457[_0x80e4('0x7')](_0x80e4('0x5e'),require(_0x80e4('0x5f')));_0x271457[_0x80e4('0x7')](_0x80e4('0x60'),require(_0x80e4('0x61')));_0x271457[_0x80e4('0x7')](_0x80e4('0x62'),require('./api/disposition'));_0x271457[_0x80e4('0x7')](_0x80e4('0x63'),require(_0x80e4('0x64')));_0x271457[_0x80e4('0x7')](_0x80e4('0x65'),require(_0x80e4('0x66')));_0x271457[_0x80e4('0x7')](_0x80e4('0x67'),require(_0x80e4('0x68')));_0x271457['use']('/api/cdr',require(_0x80e4('0x69')));_0x271457[_0x80e4('0x7')](_0x80e4('0x6a'),require(_0x80e4('0x6b')));_0x271457[_0x80e4('0x7')](_0x80e4('0x6c'),require(_0x80e4('0x6d')));_0x271457[_0x80e4('0x7')](_0x80e4('0x6e'),require(_0x80e4('0x6f')));_0x271457[_0x80e4('0x7')]('/api/tags',require(_0x80e4('0x70')));_0x271457[_0x80e4('0x7')]('/api/contact_item_types',require(_0x80e4('0x71')));_0x271457[_0x80e4('0x7')](_0x80e4('0x72'),require('./api/cmContactHasItem'));_0x271457[_0x80e4('0x7')]('/api/cm_hopper_additional_phones',require(_0x80e4('0x73')));_0x271457[_0x80e4('0x7')]('/api/templates',require('./api/template'));_0x271457[_0x80e4('0x7')]('/api/triggers',require(_0x80e4('0x74')));_0x271457[_0x80e4('0x7')](_0x80e4('0x75'),require(_0x80e4('0x76')));_0x271457[_0x80e4('0x7')](_0x80e4('0x77'),require(_0x80e4('0x78')));_0x271457['use'](_0x80e4('0x79'),require(_0x80e4('0x7a')));_0x271457[_0x80e4('0x7')](_0x80e4('0x7b'),require(_0x80e4('0x7c')));_0x271457[_0x80e4('0x7')](_0x80e4('0x7d'),require(_0x80e4('0x7e')));_0x271457[_0x80e4('0x7')](_0x80e4('0x7f'),require(_0x80e4('0x80')));_0x271457[_0x80e4('0x7')](_0x80e4('0x81'),require(_0x80e4('0x82')));_0x271457[_0x80e4('0x7')]('/api/analytics/field_reports',require(_0x80e4('0x83')));_0x271457[_0x80e4('0x7')]('/api/analytics/tree_reports',require(_0x80e4('0x84')));_0x271457[_0x80e4('0x7')](_0x80e4('0x85'),require('./api/intSalesforceAccount'));_0x271457[_0x80e4('0x7')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x271457[_0x80e4('0x7')](_0x80e4('0x86'),require(_0x80e4('0x87')));_0x271457[_0x80e4('0x7')](_0x80e4('0x88'),require(_0x80e4('0x89')));_0x271457[_0x80e4('0x7')](_0x80e4('0x8a'),require(_0x80e4('0x8b')));_0x271457[_0x80e4('0x7')]('/api/integrations/sugarcrm/fields',require(_0x80e4('0x8c')));_0x271457[_0x80e4('0x7')](_0x80e4('0x8d'),require(_0x80e4('0x8e')));_0x271457[_0x80e4('0x7')](_0x80e4('0x8f'),require(_0x80e4('0x90')));_0x271457[_0x80e4('0x7')](_0x80e4('0x91'),require('./api/intDeskField'));_0x271457[_0x80e4('0x7')](_0x80e4('0x92'),require(_0x80e4('0x93')));_0x271457[_0x80e4('0x7')](_0x80e4('0x94'),require('./api/intZohoConfiguration'));_0x271457[_0x80e4('0x7')](_0x80e4('0x95'),require(_0x80e4('0x96')));_0x271457[_0x80e4('0x7')]('/api/integrations/zendesk/accounts',require(_0x80e4('0x97')));_0x271457[_0x80e4('0x7')](_0x80e4('0x98'),require(_0x80e4('0x99')));_0x271457['use'](_0x80e4('0x9a'),require(_0x80e4('0x9b')));_0x271457[_0x80e4('0x7')](_0x80e4('0x9c'),require('./api/intFreshdeskAccount'));_0x271457['use']('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x271457[_0x80e4('0x7')]('/api/integrations/freshdesk/fields',require(_0x80e4('0x9d')));_0x271457[_0x80e4('0x7')](_0x80e4('0x9e'),require(_0x80e4('0x9f')));_0x271457[_0x80e4('0x7')]('/api/integrations/vtiger/configurations',require(_0x80e4('0xa0')));_0x271457[_0x80e4('0x7')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x271457[_0x80e4('0x7')](_0x80e4('0xa1'),require(_0x80e4('0xa2')));_0x271457[_0x80e4('0x7')]('/api/integrations/servicenow/configurations',require(_0x80e4('0xa3')));_0x271457[_0x80e4('0x7')]('/api/integrations/servicenow/fields',require(_0x80e4('0xa4')));_0x271457[_0x80e4('0x7')](_0x80e4('0xa5'),require('./api/intDynamics365Account'));_0x271457[_0x80e4('0x7')](_0x80e4('0xa6'),require(_0x80e4('0xa7')));_0x271457[_0x80e4('0x7')](_0x80e4('0xa8'),require('./api/intDynamics365Field'));_0x271457[_0x80e4('0x7')](_0x80e4('0xa9'),require(_0x80e4('0xaa')));_0x271457['use']('/api/integrations/freshsales/configurations',require(_0x80e4('0xab')));_0x271457['use']('/api/integrations/freshsales/fields',require(_0x80e4('0xac')));_0x271457['use'](_0x80e4('0xad'),require(_0x80e4('0xae')));_0x271457['use'](_0x80e4('0xaf'),require(_0x80e4('0xb0')));_0x271457[_0x80e4('0x7')]('/api/chat/internal/messages',require(_0x80e4('0xb1')));_0x271457[_0x80e4('0x7')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x271457[_0x80e4('0x7')](_0x80e4('0xb2'),require('./api/jscriptyQuestionReport'));_0x271457[_0x80e4('0x7')](_0x80e4('0xb3'),require(_0x80e4('0xb4')));_0x271457[_0x80e4('0x7')](_0x80e4('0xb5'),require('./api/smsQueueReport'));_0x271457[_0x80e4('0x7')](_0x80e4('0xb6'),require(_0x80e4('0xb7')));_0x271457[_0x80e4('0x7')](_0x80e4('0xb8'),require('./api/squareReportDetail'));_0x271457['use'](_0x80e4('0xb9'),require(_0x80e4('0xba')));_0x271457[_0x80e4('0x7')](_0x80e4('0xbb'),require('./api/setting'));_0x271457[_0x80e4('0x7')](_0x80e4('0xbc'),require('./api/squareOdbc'));_0x271457[_0x80e4('0x7')](_0x80e4('0xbd'),require(_0x80e4('0xbe')));_0x271457[_0x80e4('0x7')](_0x80e4('0xbf'),require('./api/squareRecording'));_0x271457[_0x80e4('0x7')](_0x80e4('0xc0'),require(_0x80e4('0xc1')));_0x271457[_0x80e4('0x7')](_0x80e4('0xc2'),require(_0x80e4('0xc3')));_0x271457['use']('/api/license',require(_0x80e4('0xc4')));_0x271457[_0x80e4('0x7')](_0x80e4('0xc5'),require('./api/campaign'));_0x271457[_0x80e4('0x7')](_0x80e4('0xc6'),require(_0x80e4('0xc7')));_0x271457['use'](_0x80e4('0xc8'),require(_0x80e4('0xc9')));_0x271457[_0x80e4('0x7')]('/api/plugins',require(_0x80e4('0xca')));_0x271457[_0x80e4('0x7')](_0x80e4('0xcb'),require('./api/mailTransferReport'));_0x271457[_0x80e4('0x7')]('/api/chat/reports/transfer',require(_0x80e4('0xcc')));_0x271457[_0x80e4('0x7')](_0x80e4('0xcd'),require('./api/faxTransferReport'));_0x271457[_0x80e4('0x7')](_0x80e4('0xce'),require('./api/openchannelTransferReport'));_0x271457[_0x80e4('0x7')](_0x80e4('0xcf'),require(_0x80e4('0xd0')));_0x271457[_0x80e4('0x7')](_0x80e4('0xd1'),require(_0x80e4('0xd2')));_0x271457['use'](_0x80e4('0xd3'),require('./api/voicePrefix'));_0x271457[_0x80e4('0x7')](_0x80e4('0xd4'),require(_0x80e4('0xd5')));_0x271457[_0x80e4('0x7')](_0x80e4('0xd6'),require(_0x80e4('0xd7')));_0x271457['use'](_0x80e4('0xd8'),require('./api/userProfileResource'));_0x271457['use'](_0x80e4('0xd9'),require(_0x80e4('0xda')));_0x271457['use']('/api/whatsapp/accounts',require(_0x80e4('0xdb')));_0x271457[_0x80e4('0x7')](_0x80e4('0xdc'),require(_0x80e4('0xdd')));_0x271457['use'](_0x80e4('0xde'),require(_0x80e4('0xdf')));_0x271457['use'](_0x80e4('0xe0'),require('./api/whatsappMessage'));_0x271457[_0x80e4('0x7')]('/api/whatsapp/reports/queue',require(_0x80e4('0xe1')));_0x271457[_0x80e4('0x7')](_0x80e4('0xe2'),require('./api/whatsappTransferReport'));_0x271457[_0x80e4('0x7')](_0x80e4('0xe3'),require('./api/whatsappQueue'));_0x271457[_0x80e4('0x7')](_0x80e4('0xe4'),require(_0x80e4('0xe5')));_0x271457[_0x80e4('0x7')](_0x80e4('0xe6'),require(_0x80e4('0xe7')));_0x271457[_0x80e4('0x7')]('/api/user-settings',require(_0x80e4('0xe8')));_0x271457[_0x80e4('0x7')](_0x80e4('0xe9'),require(_0x80e4('0xea')));_0x271457[_0x80e4('0x7')](_0x80e4('0xeb'),require(_0x80e4('0xec')));_0x271457['use']('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x271457[_0x80e4('0x7')]('/api/jira',require('./api/jira'));_0x271457['use'](_0x80e4('0xed'),require(_0x80e4('0xee')));_0x271457[_0x80e4('0x7')]('/api/version',require('./api/version'));_0x271457['use'](_0x80e4('0xef'),require(_0x80e4('0xf0')));_0x271457[_0x80e4('0x7')](_0x80e4('0xf1'),require(_0x80e4('0xf2')));_0x271457[_0x80e4('0x7')](_0x80e4('0xf3'),require(_0x80e4('0xf4')));_0x271457[_0x80e4('0x7')]('/api/logs',clientSideLogs);_0x271457[_0x80e4('0x7')](_0x80e4('0xf5'),express[_0x80e4('0xf6')](path[_0x80e4('0xf7')](config[_0x80e4('0xf8')],'/apidoc')));_0x271457[_0x80e4('0x7')]('/www',express[_0x80e4('0xf6')](path[_0x80e4('0xf7')](config[_0x80e4('0xf8')],_0x80e4('0xf9'))));_0x271457[_0x80e4('0x7')]('/demo',express[_0x80e4('0xf6')](path[_0x80e4('0xf7')](config['root'],_0x80e4('0xfa'))));_0x271457['use'](_0x80e4('0xfb'),express[_0x80e4('0xf6')](path[_0x80e4('0xf7')](config[_0x80e4('0xf8')],_0x80e4('0xfc'),_0x80e4('0xfd'))));_0x271457[_0x80e4('0x7')]('/plugins',express[_0x80e4('0xf6')](path[_0x80e4('0xf7')](config[_0x80e4('0xf8')],_0x80e4('0xfe'))));_0x271457['route'](_0x80e4('0xff'))[_0x80e4('0x100')](errors[0x194]);_0x271457['route']('/*')[_0x80e4('0x100')](function(_0x17c5f6,_0x2fa328){_0x2fa328[_0x80e4('0x101')](path[_0x80e4('0x102')](_0x271457[_0x80e4('0x100')](_0x80e4('0x103'))+_0x80e4('0x104')));});return _0x271457;});}; \ No newline at end of file +var _0xba24=['/apidoc','static','join','root','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','./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/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/chatApplication','/api/chat/interactions','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/dispositions','./api/disposition','./api/condition','/api/intervals','/api/pauses','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2'];(function(_0x22b2f8,_0x152017){var _0x14702f=function(_0x32c54a){while(--_0x32c54a){_0x22b2f8['push'](_0x22b2f8['shift']());}};_0x14702f(++_0x152017);}(_0xba24,0x11d));var _0x4ba2=function(_0x180b3c,_0x3f2e92){_0x180b3c=_0x180b3c-0x0;var _0x462dfd=_0xba24[_0x180b3c];return _0x462dfd;};'use strict';var path=require(_0x4ba2('0x0'));var express=require('express');var errors=require('./errors');var config=require('./config/environment');var setupLoggers=require('./utils/client-side-logger')[_0x4ba2('0x1')];var clientSideLogs=require(_0x4ba2('0x2'));exports[_0x4ba2('0x3')]=function(_0x59bbff){return setupLoggers(_0x59bbff)[_0x4ba2('0x4')](function(){_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x6'),require(_0x4ba2('0x7')));_0x59bbff[_0x4ba2('0x5')]('/api/voice/chanspy',require(_0x4ba2('0x8')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x9'),require(_0x4ba2('0xa')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xb'),require(_0x4ba2('0xc')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xd'),require(_0x4ba2('0xe')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xf'),require(_0x4ba2('0x10')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x11'),require('./api/voiceRecording'));_0x59bbff[_0x4ba2('0x5')]('/api/screen/recordings',require(_0x4ba2('0x12')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x13'),require('./api/voiceMail'));_0x59bbff['use'](_0x4ba2('0x14'),require(_0x4ba2('0x15')));_0x59bbff[_0x4ba2('0x5')]('/api/voice/calls/reports',require(_0x4ba2('0x16')));_0x59bbff[_0x4ba2('0x5')]('/api/voice/dials/reports',require(_0x4ba2('0x17')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x18'),require(_0x4ba2('0x19')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x1a'),require(_0x4ba2('0x1b')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x1c'),require(_0x4ba2('0x1d')));_0x59bbff[_0x4ba2('0x5')]('/api/trunks',require(_0x4ba2('0x1e')));_0x59bbff['use'](_0x4ba2('0x1f'),require('./api/voiceTransferReport'));_0x59bbff['use'](_0x4ba2('0x20'),require('./api/mailServerOut'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x21'),require(_0x4ba2('0x22')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x23'),require(_0x4ba2('0x24')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x25'),require(_0x4ba2('0x26')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x27'),require('./api/mailInteraction'));_0x59bbff['use'](_0x4ba2('0x28'),require('./api/mailMessage'));_0x59bbff['use'](_0x4ba2('0x29'),require(_0x4ba2('0x2a')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x2b'),require(_0x4ba2('0x2c')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x2d'),require(_0x4ba2('0x2e')));_0x59bbff['use'](_0x4ba2('0x2f'),require('./api/dashboardItem'));_0x59bbff[_0x4ba2('0x5')]('/api/fax/accounts',require(_0x4ba2('0x30')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x31'),require(_0x4ba2('0x32')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x33'),require('./api/faxInteraction'));_0x59bbff['use']('/api/fax/messages',require('./api/faxMessage'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x34'),require(_0x4ba2('0x35')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x36'),require(_0x4ba2('0x37')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x38'),require('./api/smsAccount'));_0x59bbff[_0x4ba2('0x5')]('/api/sms/applications',require('./api/smsApplication'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x39'),require(_0x4ba2('0x3a')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x3b'),require(_0x4ba2('0x3c')));_0x59bbff['use'](_0x4ba2('0x3d'),require(_0x4ba2('0x3e')));_0x59bbff['use']('/api/openchannel/accounts',require('./api/openchannelAccount'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x3f'),require(_0x4ba2('0x40')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x41'),require(_0x4ba2('0x42')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x43'),require('./api/openchannelMessage'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x44'),require(_0x4ba2('0x45')));_0x59bbff['use'](_0x4ba2('0x46'),require(_0x4ba2('0x47')));_0x59bbff['use'](_0x4ba2('0x48'),require('./api/openchannelQueueReport'));_0x59bbff[_0x4ba2('0x5')]('/api/chat/applications',require(_0x4ba2('0x49')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x4a'),require('./api/chatInteraction'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x4b'),require('./api/chatMessage'));_0x59bbff[_0x4ba2('0x5')]('/api/chat/offline_messages',require(_0x4ba2('0x4c')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x4d'),require(_0x4ba2('0x4e')));_0x59bbff[_0x4ba2('0x5')]('/api/chat/groups',require(_0x4ba2('0x4f')));_0x59bbff['use'](_0x4ba2('0x50'),require(_0x4ba2('0x51')));_0x59bbff['use'](_0x4ba2('0x52'),require(_0x4ba2('0x53')));_0x59bbff[_0x4ba2('0x5')]('/api/cm/contacts',require('./api/cmContact'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x54'),require(_0x4ba2('0x55')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x56'),require(_0x4ba2('0x57')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x58'),require(_0x4ba2('0x59')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x5a'),require(_0x4ba2('0x5b')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x5c'),require('./api/cmCustomField'));_0x59bbff[_0x4ba2('0x5')]('/api/actions',require(_0x4ba2('0x5d')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x5e'),require(_0x4ba2('0x5f')));_0x59bbff[_0x4ba2('0x5')]('/api/canned_answers',require('./api/cannedAnswer'));_0x59bbff['use'](_0x4ba2('0x60'),require(_0x4ba2('0x61')));_0x59bbff['use']('/api/conditions',require(_0x4ba2('0x62')));_0x59bbff['use'](_0x4ba2('0x63'),require('./api/interval'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x64'),require('./api/pause'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x65'),require('./api/cdr'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x66'),require(_0x4ba2('0x67')));_0x59bbff['use'](_0x4ba2('0x68'),require(_0x4ba2('0x69')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x6a'),require(_0x4ba2('0x6b')));_0x59bbff['use'](_0x4ba2('0x6c'),require('./api/tag'));_0x59bbff['use'](_0x4ba2('0x6d'),require(_0x4ba2('0x6e')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x6f'),require(_0x4ba2('0x70')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x71'),require(_0x4ba2('0x72')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x73'),require(_0x4ba2('0x74')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x75'),require(_0x4ba2('0x76')));_0x59bbff['use']('/api/variables',require(_0x4ba2('0x77')));_0x59bbff['use'](_0x4ba2('0x78'),require(_0x4ba2('0x79')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x7a'),require('./api/integrationReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x7b'),require(_0x4ba2('0x7c')));_0x59bbff['use']('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x7d'),require(_0x4ba2('0x7e')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x7f'),require('./api/analyticMetric'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x80'),require('./api/analyticFieldReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x81'),require(_0x4ba2('0x82')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x83'),require(_0x4ba2('0x84')));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x85'),require(_0x4ba2('0x86')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x87'),require(_0x4ba2('0x88')));_0x59bbff['use'](_0x4ba2('0x89'),require(_0x4ba2('0x8a')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x8b'),require(_0x4ba2('0x8c')));_0x59bbff['use'](_0x4ba2('0x8d'),require('./api/intDeskAccount'));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/desk/configurations',require(_0x4ba2('0x8e')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x8f'),require('./api/intDeskField'));_0x59bbff['use'](_0x4ba2('0x90'),require('./api/intZohoAccount'));_0x59bbff['use']('/api/integrations/zoho/configurations',require(_0x4ba2('0x91')));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/zoho/fields',require(_0x4ba2('0x92')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x93'),require('./api/intZendeskAccount'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x94'),require(_0x4ba2('0x95')));_0x59bbff['use'](_0x4ba2('0x96'),require(_0x4ba2('0x97')));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x98'),require('./api/intFreshdeskConfiguration'));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/freshdesk/fields',require(_0x4ba2('0x99')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x9a'),require(_0x4ba2('0x9b')));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/vtiger/configurations',require(_0x4ba2('0x9c')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x9d'),require(_0x4ba2('0x9e')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x9f'),require(_0x4ba2('0xa0')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa1'),require(_0x4ba2('0xa2')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa3'),require(_0x4ba2('0xa4')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa5'),require('./api/intDynamics365Account'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa6'),require('./api/intDynamics365Configuration'));_0x59bbff[_0x4ba2('0x5')]('/api/integrations/dynamics365/fields',require(_0x4ba2('0xa7')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa8'),require('./api/intFreshsalesAccount'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xa9'),require(_0x4ba2('0xaa')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xab'),require(_0x4ba2('0xac')));_0x59bbff[_0x4ba2('0x5')]('/api/networks',require(_0x4ba2('0xad')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xae'),require(_0x4ba2('0xaf')));_0x59bbff[_0x4ba2('0x5')]('/api/chat/internal/messages',require(_0x4ba2('0xb0')));_0x59bbff['use']('/api/jscripty/answers/reports',require(_0x4ba2('0xb1')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xb2'),require('./api/jscriptyQuestionReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xb3'),require(_0x4ba2('0xb4')));_0x59bbff['use'](_0x4ba2('0xb5'),require(_0x4ba2('0xb6')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xb7'),require('./api/squareReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xb8'),require(_0x4ba2('0xb9')));_0x59bbff['use'](_0x4ba2('0xba'),require('./api/jscriptyProject'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xbb'),require(_0x4ba2('0xbc')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xbd'),require('./api/squareOdbc'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xbe'),require(_0x4ba2('0xbf')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xc0'),require(_0x4ba2('0xc1')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xc2'),require(_0x4ba2('0xc3')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xc4'),require(_0x4ba2('0xc5')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xc6'),require('./api/license'));_0x59bbff['use'](_0x4ba2('0xc7'),require(_0x4ba2('0xc8')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xc9'),require(_0x4ba2('0xca')));_0x59bbff['use']('/api/attachments',require(_0x4ba2('0xcb')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xcc'),require(_0x4ba2('0xcd')));_0x59bbff[_0x4ba2('0x5')]('/api/mail/reports/transfer',require(_0x4ba2('0xce')));_0x59bbff['use'](_0x4ba2('0xcf'),require(_0x4ba2('0xd0')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xd1'),require(_0x4ba2('0xd2')));_0x59bbff['use'](_0x4ba2('0xd3'),require(_0x4ba2('0xd4')));_0x59bbff['use'](_0x4ba2('0xd5'),require(_0x4ba2('0xd6')));_0x59bbff[_0x4ba2('0x5')]('/api/cm/lists',require(_0x4ba2('0xd7')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xd8'),require('./api/voicePrefix'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xd9'),require(_0x4ba2('0xda')));_0x59bbff['use'](_0x4ba2('0xdb'),require(_0x4ba2('0xdc')));_0x59bbff[_0x4ba2('0x5')]('/api/userProfile/resources',require(_0x4ba2('0xdd')));_0x59bbff[_0x4ba2('0x5')]('/api/userNotifications',require(_0x4ba2('0xde')));_0x59bbff['use'](_0x4ba2('0xdf'),require(_0x4ba2('0xe0')));_0x59bbff[_0x4ba2('0x5')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xe1'),require('./api/whatsappInteraction'));_0x59bbff['use'](_0x4ba2('0xe2'),require(_0x4ba2('0xe3')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xe4'),require(_0x4ba2('0xe5')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xe6'),require('./api/whatsappTransferReport'));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xe7'),require('./api/whatsappQueue'));_0x59bbff['use'](_0x4ba2('0xe8'),require(_0x4ba2('0xe9')));_0x59bbff[_0x4ba2('0x5')]('/api/realtime',require(_0x4ba2('0xea')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xeb'),require(_0x4ba2('0xec')));_0x59bbff['use'](_0x4ba2('0xed'),require(_0x4ba2('0xee')));_0x59bbff['use'](_0x4ba2('0xef'),require(_0x4ba2('0xf0')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xf1'),require('./api/authActiveDirectory'));_0x59bbff['use'](_0x4ba2('0xf2'),require('./api/jira'));_0x59bbff['use'](_0x4ba2('0xf3'),require(_0x4ba2('0xf4')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xf5'),require(_0x4ba2('0xf6')));_0x59bbff['use'](_0x4ba2('0xf7'),require(_0x4ba2('0xf8')));_0x59bbff['use'](_0x4ba2('0xf9'),require(_0x4ba2('0xfa')));_0x59bbff['use']('/api/webbar',require('./api/webbar'));_0x59bbff[_0x4ba2('0x5')]('/api/logs',clientSideLogs);_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0xfb'),express[_0x4ba2('0xfc')](path[_0x4ba2('0xfd')](config[_0x4ba2('0xfe')],_0x4ba2('0xfb'))));_0x59bbff[_0x4ba2('0x5')]('/www',express['static'](path[_0x4ba2('0xfd')](config[_0x4ba2('0xfe')],'/www')));_0x59bbff['use'](_0x4ba2('0xff'),express['static'](path[_0x4ba2('0xfd')](config['root'],'/demo')));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x100'),express[_0x4ba2('0xfc')](path[_0x4ba2('0xfd')](config[_0x4ba2('0xfe')],_0x4ba2('0x101'),_0x4ba2('0x102'))));_0x59bbff[_0x4ba2('0x5')](_0x4ba2('0x103'),express[_0x4ba2('0xfc')](path[_0x4ba2('0xfd')](config[_0x4ba2('0xfe')],_0x4ba2('0x104'))));_0x59bbff[_0x4ba2('0x105')](_0x4ba2('0x106'))[_0x4ba2('0x107')](errors[0x194]);_0x59bbff[_0x4ba2('0x105')]('/*')[_0x4ba2('0x107')](function(_0x37d038,_0x37f09f){_0x37f09f[_0x4ba2('0x108')](path[_0x4ba2('0x109')](_0x59bbff[_0x4ba2('0x107')](_0x4ba2('0x10a'))+_0x4ba2('0x10b')));});return _0x59bbff;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 26c8c6f..a70a8ab 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x64e4=['listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/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','../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/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','rpc','log','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0x64e4,0x12a));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require('jayson/promise');var _=require(_0x464e('0x0'));var config=require(_0x464e('0x1'));exports[_0x464e('0x2')]=function(){return new Promise(function(_0x1dc429,_0x418fc8){var _0x5ba6aa={};_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x3')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x5')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x6')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x7')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x8')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x9')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0xa')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0xb')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require('../api/trunk/trunk.rpc'));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0xc')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0xd')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require('../api/mailServerIn/mailServerIn.rpc'));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require('../api/mailAccount/mailAccount.rpc'));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require('../api/mailQueue/mailQueue.rpc'));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0xe')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0xf')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x10')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x11')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x12')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x13')));_0x5ba6aa=_['merge'](_0x5ba6aa,require('../api/faxInteraction/faxInteraction.rpc'));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x14')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x15')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x16')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require('../api/smsAccount/smsAccount.rpc'));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x17')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require('../api/smsMessage/smsMessage.rpc'));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x18')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x19')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x1a')));_0x5ba6aa=_['merge'](_0x5ba6aa,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x1b')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x1c')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require('../api/chatInteraction/chatInteraction.rpc'));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x1d')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x1e')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x1f')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x20')));_0x5ba6aa=_['merge'](_0x5ba6aa,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x21')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x22')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x23')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x24')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x25')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x26')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x27')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x28')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x29')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x2a')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x2b')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x2c')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x2d')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x2e')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x2f')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x30')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x31')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x32')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x33')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x34')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x35')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x5ba6aa=_['merge'](_0x5ba6aa,require('../api/squareReport/squareReport.rpc'));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x36')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x37')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x38')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x39')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x3a')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x3b')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x3c')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x3d')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x3e')));_0x5ba6aa=_['merge'](_0x5ba6aa,require(_0x464e('0x3f')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x40')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x41')));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5ba6aa=_[_0x464e('0x4')](_0x5ba6aa,require(_0x464e('0x42')));var _0x9aaabe=jayson[_0x464e('0x43')](_0x5ba6aa)[_0x464e('0x44')]();var _0x2aaed6=config['rpc'][_0x464e('0x45')]||config[_0x464e('0x45')]+0x1;var _0x22035b=config[_0x464e('0x46')]['ip']||'localhost';_0x9aaabe['on']('error',function(_0x5a2756){return _0x418fc8(_0x5a2756);});_0x9aaabe[_0x464e('0x2')](_0x2aaed6,_0x22035b,function(){console[_0x464e('0x47')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x22035b,_0x2aaed6);require(_0x464e('0x48'))[_0x464e('0x49')]();return _0x1dc429(_0x464e('0x4a')+_0x22035b+':'+_0x2aaed6);});});}; \ No newline at end of file +var _0xaef0=['../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.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/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc'];(function(_0xa2ec7c,_0x5ca918){var _0x1ff134=function(_0xb98b90){while(--_0xb98b90){_0xa2ec7c['push'](_0xa2ec7c['shift']());}};_0x1ff134(++_0x5ca918);}(_0xaef0,0x1c8));var _0x0aef=function(_0x5e2152,_0x172f3d){_0x5e2152=_0x5e2152-0x0;var _0x5ddcf6=_0xaef0[_0x5e2152];return _0x5ddcf6;};'use strict';var jayson=require(_0x0aef('0x0'));var _=require('lodash');var config=require(_0x0aef('0x1'));exports[_0x0aef('0x2')]=function(){return new Promise(function(_0x836cb6,_0x2bca8d){var _0x1462f1={};_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x4')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/voiceExtension/voiceExtension.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x5')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/voiceRecording/voiceRecording.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x6')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x7')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x8')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x9')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0xa')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0xb')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0xc')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0xd')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/mailServerIn/mailServerIn.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0xe')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/mailQueue/mailQueue.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0xf')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x10')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x11')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x12')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/faxAccount/faxAccount.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x13')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x14')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x15')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x16')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x17')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x18')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x19')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x1a')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x1b')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x1c')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x1d')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x1e')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x1f')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x20')));_0x1462f1=_['merge'](_0x1462f1,require('../api/chatMessage/chatMessage.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x21')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x22')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/cmHopper/cmHopper.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x23')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x24')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x25')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/interval/interval.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/pause/pause.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x26')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x27')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x28')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/trigger/trigger.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x29')));_0x1462f1=_['merge'](_0x1462f1,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x2a')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x2b')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x2c')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x2d')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x2e')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x2f')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x30')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x31')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x32')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x33')));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x34')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x35')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/squareOdbc/squareOdbc.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x36')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/squareRecording/squareRecording.rpc'));_0x1462f1=_['merge'](_0x1462f1,require(_0x0aef('0x37')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x38')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x39')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x3a')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x3b')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x3c')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require(_0x0aef('0x3d')));_0x1462f1=_[_0x0aef('0x3')](_0x1462f1,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x2122d2=jayson[_0x0aef('0x3e')](_0x1462f1)[_0x0aef('0x3f')]();var _0x1a4a40=config[_0x0aef('0x40')]['port']||config[_0x0aef('0x41')]+0x1;var _0x2e0f13=config[_0x0aef('0x40')]['ip']||_0x0aef('0x42');_0x2122d2['on'](_0x0aef('0x43'),function(_0x13fde4){return _0x2bca8d(_0x13fde4);});_0x2122d2['listen'](_0x1a4a40,_0x2e0f13,function(){console[_0x0aef('0x44')](_0x0aef('0x45'),_0x2e0f13,_0x1a4a40);require(_0x0aef('0x46'))['default']();return _0x836cb6(_0x0aef('0x47')+_0x2e0f13+':'+_0x1a4a40);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 47860ac..2fcc152 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 _0xdb21=['EventEmitter','./reply','./error','utf8','setTimeout','setEncoding','headers','emit','ready','line','hangup','search','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','prototype','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','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','events'];(function(_0x48e3af,_0x54327e){var _0x717aed=function(_0x2f1e90){while(--_0x2f1e90){_0x48e3af['push'](_0x48e3af['shift']());}};_0x717aed(++_0x54327e);}(_0xdb21,0x135));var _0x1db2=function(_0x36c270,_0x2569ff){_0x36c270=_0x36c270-0x0;var _0x276c73=_0xdb21[_0x36c270];return _0x276c73;};'use strict';var util=require(_0x1db2('0x0'));var _=require(_0x1db2('0x1'));var EventEmitter=require(_0x1db2('0x2'))[_0x1db2('0x3')];var AGIReply=require(_0x1db2('0x4'));var AGIError=require(_0x1db2('0x5'));function AGIChannel(_0x3f2d52){var _0xdc2c0c=this,_0x4102c4=new AGIReply(),_0x54a04e=![],_0x3b16c7={};EventEmitter['call'](_0xdc2c0c);_0x3f2d52['setEncoding'](_0x1db2('0x6'));_0x3f2d52[_0x1db2('0x7')](0x8*0x3c*0x3c*0x3e8);_0x4102c4[_0x1db2('0x8')](_0x1db2('0x6'));_0x4102c4['on'](_0x1db2('0x9'),function(_0x24210c){for(var _0x43c896 in _0x24210c){_0xdc2c0c[_0x43c896]=_0x24210c[_0x43c896];}_0xdc2c0c[_0x1db2('0xa')](_0x1db2('0xb'));});_0x4102c4['on'](_0x1db2('0xc'),function(_0x6bb76d){if(_0x6bb76d['toLowerCase']()==_0x1db2('0xd')){_0xdc2c0c[_0x1db2('0xa')](_0x1db2('0xd'));return;}if(_0x6bb76d['substring'](0x0,0xb)=='520-Invalid'){_0x54a04e=!![];}if(_0x54a04e){_0x3b16c7['rx']+=_0x6bb76d+'\x0a';if(_0x6bb76d[_0x1db2('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x54a04e=![];}}else{_0x3b16c7['rx']=_0x6bb76d;}if(_0x54a04e){return;}if(typeof _0x3b16c7['cb']==_0x1db2('0xf')){var _0x3886e9=_0x3b16c7['rx'][_0x1db2('0x10')](0x0,0x3),_0x322ae8=null,_0x1911b2=null;_0x3886e9=parseInt(_0x3886e9);if(isNaN(_0x3886e9)){_0x3b16c7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1db2('0x11')});return;}if(_0x3886e9!=0xc8){_0x3b16c7['cb'](null,{'code':_0x3886e9,'result':-0x1,'extra':'KO'});return;}_0x322ae8=_0x3b16c7['rx']['substring'](0x4)[_0x1db2('0x12')](_0x1db2('0x13'),'');if(_0x322ae8[_0x1db2('0x14')]('\x20')!=-0x1){_0x322ae8=_0x322ae8[_0x1db2('0x15')](0x0,_0x322ae8[_0x1db2('0x14')]('\x20'));}if(_[_0x1db2('0x16')](_0x322ae8,'-1')){_0x322ae8=parseInt(_0x322ae8);}_0x1911b2=_0x3b16c7['rx'][_0x1db2('0x17')]('\x20');if(_0x1911b2['length']==0x3){_0x1911b2=_0x1911b2[0x2][_0x1db2('0x10')](0x1,_0x1911b2[0x2]['length']-0x1);}else if(_0x1911b2[_0x1db2('0x18')]>0x3){var _0x233d76=/\((.+)\)/;var _0x3b422f=_0x3b16c7['rx'][_0x1db2('0x19')](_0x233d76);if(_0x3b422f){_0x1911b2=_0x3b422f[0x1];}else{_0x1911b2=null;}}else{_0x1911b2=null;}_0x3b16c7['cb'](null,{'code':_0x3886e9,'result':_0x322ae8,'extra':_0x1911b2});}});_0x3f2d52['on'](_0x1db2('0x1a'),function(_0xafdb1){_0xdc2c0c[_0x1db2('0xa')](_0x1db2('0x1a'),new AGIError(_0x1db2('0x1b'),_0xafdb1[_0x1db2('0x1c')]));});_0x3f2d52['on'](_0x1db2('0x1d'),function(){_0xdc2c0c[_0x1db2('0xa')](_0x1db2('0x1d'),new AGIError(_0x1db2('0x1e')));});_0x3f2d52['on'](_0x1db2('0x1f'),function(){_0xdc2c0c['emit'](_0x1db2('0x1f'),new AGIError(_0x1db2('0x20')));_0x3f2d52[_0x1db2('0x21')]();});_0x3f2d52['pipe'](_0x4102c4);this[_0x1db2('0x22')]=function(_0x550d1c,_0x2182ef){var _0x550d1c=_0x550d1c||'',_0x2182ef=typeof _0x2182ef==_0x1db2('0xf')?_0x2182ef:new Function();_0x3b16c7={'tx':_0x550d1c,'rx':'','cb':_0x2182ef};_0x3f2d52[_0x1db2('0x23')](_0x550d1c+'\x0a');},this['close']=function(){_0x3f2d52[_0x1db2('0x21')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x1db2('0x24')]['sendRequest']=function(_0x2121df){return this['command']['sync'](this,_0x2121df);};AGIChannel[_0x1db2('0x24')]['answer']=function(){return this[_0x1db2('0x25')](_0x1db2('0x26'));};AGIChannel[_0x1db2('0x24')][_0x1db2('0x27')]=function(_0x1ed8c5,_0x397279,_0xe7889d){_0x1ed8c5=_0x1ed8c5===undefined?'beep':_0x1ed8c5;_0x397279=_0x397279===undefined?'5':_0x397279;_0xe7889d=_0xe7889d===undefined?'1':_0xe7889d;return this[_0x1db2('0x25')](util[_0x1db2('0x28')](_0x1db2('0x29'),_0x1ed8c5,_0x397279*0x3e8,_0xe7889d));};AGIChannel['prototype'][_0x1db2('0x2a')]=function(_0x298e76){_0x298e76=_0x298e76||_0x1db2('0x2b');return this[_0x1db2('0x25')](util['format'](_0x1db2('0x2c'),_0x298e76));};AGIChannel[_0x1db2('0x24')][_0x1db2('0x2d')]=function(_0x4464d9,_0x188a01){if(_[_0x1db2('0x2e')](_0x188a01)){return this[_0x1db2('0x25')](util[_0x1db2('0x28')](_0x1db2('0x2f'),_0x4464d9,_0x188a01['join'](',')));}return this[_0x1db2('0x25')](util[_0x1db2('0x28')](_0x1db2('0x2f'),_0x4464d9,_0x188a01));};AGIChannel[_0x1db2('0x24')][_0x1db2('0x30')]=function(_0x1a3a19){return this[_0x1db2('0x25')](util['format'](_0x1db2('0x31'),_0x1a3a19));};AGIChannel['prototype'][_0x1db2('0x32')]=function(_0x432e5c){return this[_0x1db2('0x25')](util['format']('SET\x20EXTENSION\x20%s',_0x432e5c));};AGIChannel[_0x1db2('0x24')]['setPriority']=function(_0x2c7042){return this[_0x1db2('0x25')](util['format'](_0x1db2('0x33'),_0x2c7042));};AGIChannel[_0x1db2('0x24')][_0x1db2('0xd')]=function(){return this['sendRequest'](_0x1db2('0x34'));};AGIChannel[_0x1db2('0x24')][_0x1db2('0x35')]=function(_0x47d417,_0x4982b8){var _0x91eab3=_[_0x1db2('0x36')](_0x4982b8)||_[_0x1db2('0x37')](_0x4982b8)?_0x4982b8[_0x1db2('0x38')]():_0x4982b8;return this[_0x1db2('0x25')](util[_0x1db2('0x28')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x47d417,_0x91eab3?_0x91eab3['toString']()[_0x1db2('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1db2('0x24')]['sayNumber']=function(_0x4aed51,_0x2188f3){return this[_0x1db2('0x25')](util[_0x1db2('0x28')](_0x1db2('0x39'),_0x4aed51,_0x2188f3));};AGIChannel['prototype'][_0x1db2('0x3a')]=function(_0x5bd176,_0x4daf74){return this[_0x1db2('0x25')](util['format'](_0x1db2('0x3b'),_0x5bd176,_0x4daf74));};AGIChannel['prototype'][_0x1db2('0x3c')]=function(_0x38a807,_0x53aaab){return this[_0x1db2('0x25')](util[_0x1db2('0x28')](_0x1db2('0x3d'),_0x38a807,_0x53aaab));};AGIChannel[_0x1db2('0x24')]['continueAt']=function(_0x4ed271,_0x338ff4,_0x536ca5){_0x338ff4=_0x338ff4||this[_0x1db2('0x3e')];_0x536ca5=_0x536ca5||0x1;this['setContext'](_0x4ed271);this[_0x1db2('0x32')](_0x338ff4);this[_0x1db2('0x3f')](_0x536ca5);return this[_0x1db2('0x2a')](util[_0x1db2('0x28')](_0x1db2('0x40'),_0x4ed271,_0x338ff4,_0x536ca5));};AGIChannel[_0x1db2('0x24')][_0x1db2('0x41')]=function(_0x21ed90){return this[_0x1db2('0x25')](util[_0x1db2('0x28')](_0x1db2('0x42'),_0x21ed90));};AGIChannel[_0x1db2('0x24')][_0x1db2('0x43')]=function(_0x520c46,_0x1c19d1,_0x208e7f,_0x180f31,_0x200723,_0x4f226d){_0x1c19d1=_0x1c19d1||_0x1db2('0x44');_0x208e7f=_0x208e7f||'';_0x180f31=_0x180f31===undefined?-0x1:_0x180f31==='-1'?-0x1:_0x180f31*0x3e8;_0x200723=_0x200723===undefined?'':'s='+_0x200723;_0x4f226d=_0x4f226d?_0x1db2('0x45'):'';return this['sendRequest'](util[_0x1db2('0x28')](_0x1db2('0x46'),_0x520c46,_0x1c19d1,_0x208e7f,_0x180f31,_0x4f226d,_0x200723));};AGIChannel[_0x1db2('0x24')][_0x1db2('0x47')]=function(_0x5f3716,_0x5ea19a){_0x5ea19a=_0x5ea19a||'';return this[_0x1db2('0x25')](util[_0x1db2('0x28')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x5f3716,_0x5ea19a));};AGIChannel[_0x1db2('0x24')][_0x1db2('0x48')]=function(_0xf534c5){return this[_0x1db2('0x2d')](_0x1db2('0x49'),_0xf534c5);};AGIChannel[_0x1db2('0x24')][_0x1db2('0x4a')]=function(_0x164e29){return this['exec'](_0x1db2('0x4b'),_0x164e29);};AGIChannel[_0x1db2('0x24')][_0x1db2('0x1a')]=function(_0x525f29,_0x5dc4a2){this[_0x1db2('0x2a')](util[_0x1db2('0x28')](_0x1db2('0x4c'),_0x525f29['id'],_0x525f29['label'],_0x5dc4a2));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1db2('0x4d')]=AGIChannel; \ No newline at end of file +var _0x4dcb=['520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','command','sync','answer','sendRequest','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','exec','isArray','format','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','setEncoding','setTimeout','utf8','headers','ready','line','toLowerCase','hangup','emit','substring'];(function(_0x5eaf92,_0x2d7bf5){var _0x356f60=function(_0x57c770){while(--_0x57c770){_0x5eaf92['push'](_0x5eaf92['shift']());}};_0x356f60(++_0x2d7bf5);}(_0x4dcb,0x186));var _0xb4dc=function(_0x39ef3f,_0x3c920d){_0x39ef3f=_0x39ef3f-0x0;var _0xb3b499=_0x4dcb[_0x39ef3f];return _0xb3b499;};'use strict';var util=require('util');var _=require(_0xb4dc('0x0'));var EventEmitter=require(_0xb4dc('0x1'))[_0xb4dc('0x2')];var AGIReply=require(_0xb4dc('0x3'));var AGIError=require(_0xb4dc('0x4'));function AGIChannel(_0x1fad90){var _0x21b87a=this,_0x2f9f7c=new AGIReply(),_0x161991=![],_0x56a262={};EventEmitter['call'](_0x21b87a);_0x1fad90[_0xb4dc('0x5')]('utf8');_0x1fad90[_0xb4dc('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2f9f7c[_0xb4dc('0x5')](_0xb4dc('0x7'));_0x2f9f7c['on'](_0xb4dc('0x8'),function(_0x6d25){for(var _0x168305 in _0x6d25){_0x21b87a[_0x168305]=_0x6d25[_0x168305];}_0x21b87a['emit'](_0xb4dc('0x9'));});_0x2f9f7c['on'](_0xb4dc('0xa'),function(_0x9b7f60){if(_0x9b7f60[_0xb4dc('0xb')]()==_0xb4dc('0xc')){_0x21b87a[_0xb4dc('0xd')](_0xb4dc('0xc'));return;}if(_0x9b7f60[_0xb4dc('0xe')](0x0,0xb)==_0xb4dc('0xf')){_0x161991=!![];}if(_0x161991){_0x56a262['rx']+=_0x9b7f60+'\x0a';if(_0x9b7f60[_0xb4dc('0x10')](_0xb4dc('0x11'))!=-0x1){_0x161991=![];}}else{_0x56a262['rx']=_0x9b7f60;}if(_0x161991){return;}if(typeof _0x56a262['cb']==_0xb4dc('0x12')){var _0x41bc3c=_0x56a262['rx'][_0xb4dc('0xe')](0x0,0x3),_0x5d5ec0=null,_0x17669f=null;_0x41bc3c=parseInt(_0x41bc3c);if(isNaN(_0x41bc3c)){_0x56a262['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb4dc('0x13')});return;}if(_0x41bc3c!=0xc8){_0x56a262['cb'](null,{'code':_0x41bc3c,'result':-0x1,'extra':'KO'});return;}_0x5d5ec0=_0x56a262['rx'][_0xb4dc('0xe')](0x4)[_0xb4dc('0x14')]('result=','');if(_0x5d5ec0['indexOf']('\x20')!=-0x1){_0x5d5ec0=_0x5d5ec0[_0xb4dc('0x15')](0x0,_0x5d5ec0[_0xb4dc('0x16')]('\x20'));}if(_[_0xb4dc('0x17')](_0x5d5ec0,'-1')){_0x5d5ec0=parseInt(_0x5d5ec0);}_0x17669f=_0x56a262['rx'][_0xb4dc('0x18')]('\x20');if(_0x17669f[_0xb4dc('0x19')]==0x3){_0x17669f=_0x17669f[0x2][_0xb4dc('0xe')](0x1,_0x17669f[0x2]['length']-0x1);}else if(_0x17669f['length']>0x3){var _0x301ef4=/\((.+)\)/;var _0x1fc58e=_0x56a262['rx'][_0xb4dc('0x1a')](_0x301ef4);if(_0x1fc58e){_0x17669f=_0x1fc58e[0x1];}else{_0x17669f=null;}}else{_0x17669f=null;}_0x56a262['cb'](null,{'code':_0x41bc3c,'result':_0x5d5ec0,'extra':_0x17669f});}});_0x1fad90['on'](_0xb4dc('0x1b'),function(_0x46dc08){_0x21b87a[_0xb4dc('0xd')](_0xb4dc('0x1b'),new AGIError(_0xb4dc('0x1c'),_0x46dc08[_0xb4dc('0x1d')]));});_0x1fad90['on'](_0xb4dc('0x1e'),function(){_0x21b87a[_0xb4dc('0xd')](_0xb4dc('0x1e'),new AGIError(_0xb4dc('0x1f')));});_0x1fad90['on'](_0xb4dc('0x20'),function(){_0x21b87a['emit'](_0xb4dc('0x20'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x1fad90[_0xb4dc('0x21')]();});_0x1fad90[_0xb4dc('0x22')](_0x2f9f7c);this['command']=function(_0x2a38d4,_0x1bd5a4){var _0x2a38d4=_0x2a38d4||'',_0x1bd5a4=typeof _0x1bd5a4==_0xb4dc('0x12')?_0x1bd5a4:new Function();_0x56a262={'tx':_0x2a38d4,'rx':'','cb':_0x1bd5a4};_0x1fad90[_0xb4dc('0x23')](_0x2a38d4+'\x0a');},this[_0xb4dc('0x1e')]=function(){_0x1fad90[_0xb4dc('0x21')]();};}util[_0xb4dc('0x24')](AGIChannel,EventEmitter);AGIChannel[_0xb4dc('0x25')]['sendRequest']=function(_0x5b70bf){return this[_0xb4dc('0x26')][_0xb4dc('0x27')](this,_0x5b70bf);};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x28')]=function(){return this[_0xb4dc('0x29')](_0xb4dc('0x2a'));};AGIChannel['prototype'][_0xb4dc('0x2b')]=function(_0x5c3c87,_0x41b5b9,_0x4f72b7){_0x5c3c87=_0x5c3c87===undefined?'beep':_0x5c3c87;_0x41b5b9=_0x41b5b9===undefined?'5':_0x41b5b9;_0x4f72b7=_0x4f72b7===undefined?'1':_0x4f72b7;return this['sendRequest'](util['format'](_0xb4dc('0x2c'),_0x5c3c87,_0x41b5b9*0x3e8,_0x4f72b7));};AGIChannel['prototype'][_0xb4dc('0x2d')]=function(_0x51d809){_0x51d809=_0x51d809||_0xb4dc('0x2e');return this[_0xb4dc('0x29')](util['format']('VERBOSE\x20\x22%s\x22',_0x51d809));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x2f')]=function(_0xdfe87d,_0x31d0c0){if(_[_0xb4dc('0x30')](_0x31d0c0)){return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')](_0xb4dc('0x32'),_0xdfe87d,_0x31d0c0['join'](',')));}return this['sendRequest'](util[_0xb4dc('0x31')](_0xb4dc('0x32'),_0xdfe87d,_0x31d0c0));};AGIChannel['prototype'][_0xb4dc('0x33')]=function(_0x53e8ab){return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')](_0xb4dc('0x34'),_0x53e8ab));};AGIChannel[_0xb4dc('0x25')]['setExtension']=function(_0x55bf60){return this[_0xb4dc('0x29')](util['format']('SET\x20EXTENSION\x20%s',_0x55bf60));};AGIChannel[_0xb4dc('0x25')]['setPriority']=function(_0x3f64e4){return this[_0xb4dc('0x29')](util['format']('SET\x20PRIORITY\x20%s',_0x3f64e4));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest'](_0xb4dc('0x35'));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x36')]=function(_0x4d30b6,_0x467148){var _0x4516ca=_[_0xb4dc('0x37')](_0x467148)||_[_0xb4dc('0x38')](_0x467148)?_0x467148[_0xb4dc('0x39')]():_0x467148;return this['sendRequest'](util[_0xb4dc('0x31')](_0xb4dc('0x3a'),_0x4d30b6,_0x4516ca?_0x4516ca[_0xb4dc('0x39')]()[_0xb4dc('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xb4dc('0x25')]['sayNumber']=function(_0x5286d9,_0x219a71){return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')]('SAY\x20NUMBER\x20%s\x20%s',_0x5286d9,_0x219a71));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x3b')]=function(_0x37e59e,_0x17cf20){return this['sendRequest'](util[_0xb4dc('0x31')](_0xb4dc('0x3c'),_0x37e59e,_0x17cf20));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x3d')]=function(_0x137e49,_0x106c0e){return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x137e49,_0x106c0e));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x3e')]=function(_0x59f8ea,_0x506d68,_0x43be18){_0x506d68=_0x506d68||this[_0xb4dc('0x3f')];_0x43be18=_0x43be18||0x1;this[_0xb4dc('0x33')](_0x59f8ea);this[_0xb4dc('0x40')](_0x506d68);this[_0xb4dc('0x41')](_0x43be18);return this[_0xb4dc('0x2d')](util['format'](_0xb4dc('0x42'),_0x59f8ea,_0x506d68,_0x43be18));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x43')]=function(_0x5ceb25){return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')](_0xb4dc('0x44'),_0x5ceb25));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x45')]=function(_0x3ca5b8,_0x376c23,_0x583d7e,_0x535c11,_0x12d718,_0x10cd27){_0x376c23=_0x376c23||'wav';_0x583d7e=_0x583d7e||'';_0x535c11=_0x535c11===undefined?-0x1:_0x535c11==='-1'?-0x1:_0x535c11*0x3e8;_0x12d718=_0x12d718===undefined?'':'s='+_0x12d718;_0x10cd27=_0x10cd27?_0xb4dc('0x46'):'';return this[_0xb4dc('0x29')](util[_0xb4dc('0x31')](_0xb4dc('0x47'),_0x3ca5b8,_0x376c23,_0x583d7e,_0x535c11,_0x10cd27,_0x12d718));};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x48')]=function(_0x32c4bc,_0x54e93b){_0x54e93b=_0x54e93b||'';return this['sendRequest'](util[_0xb4dc('0x31')](_0xb4dc('0x49'),_0x32c4bc,_0x54e93b));};AGIChannel['prototype'][_0xb4dc('0x4a')]=function(_0x21097b){return this[_0xb4dc('0x2f')](_0xb4dc('0x4b'),_0x21097b);};AGIChannel[_0xb4dc('0x25')][_0xb4dc('0x4c')]=function(_0x486dca){return this[_0xb4dc('0x2f')](_0xb4dc('0x4d'),_0x486dca);};AGIChannel['prototype'][_0xb4dc('0x1b')]=function(_0x24b151,_0xad18fb){this[_0xb4dc('0x2d')](util[_0xb4dc('0x31')](_0xb4dc('0x4e'),_0x24b151['id'],_0x24b151[_0xb4dc('0x4f')],_0xad18fb));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb4dc('0x50')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 121a93f..58802b8 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 _0xdadb=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply','message','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\x20error.\x20Code:\x20%s.'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0xdadb,0xf9));var _0xbdad=function(_0x162ee0,_0x291661){_0x162ee0=_0x162ee0-0x0;var _0x48fc5e=_0xdadb[_0x162ee0];return _0x48fc5e;};'use strict';var util=require(_0xbdad('0x0'));var error={'E_AGI_UNDEFINED':_0xbdad('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xbdad('0x2'),'E_AGI_SERVER_CLOSE':_0xbdad('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xbdad('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0xbdad('0x5'),'E_AGI_SOCKET_ERROR':_0xbdad('0x6'),'E_AGI_SOCKET_CLOSE':_0xbdad('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xbdad('0x8'),'E_AGI_COMMAND_EMPTY':_0xbdad('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xbdad('0xa')};function AGIError(_0x20c5b8){var _0x20c5b8=_0x20c5b8||null,_0xc530bf=_0xc530bf||[],_0x1ee98e=0x1,_0x411aa4='';if(!error[_0x20c5b8]){_0x20c5b8='E_AGI_UNDEFINED';}_0xc530bf[_0xbdad('0xb')](error[_0x20c5b8]);while(arguments[_0x1ee98e]){_0xc530bf[_0xbdad('0xb')](arguments[_0x1ee98e]);_0x1ee98e++;}_0x411aa4=util['format'][_0xbdad('0xc')](util,_0xc530bf);this[_0xbdad('0xd')]=_0x411aa4;this[_0xbdad('0xe')]=_0x20c5b8;}module[_0xbdad('0xf')]=AGIError; \ No newline at end of file +var _0x2d90=['push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x1ce71f,_0x35e676){var _0x361daf=function(_0x121299){while(--_0x121299){_0x1ce71f['push'](_0x1ce71f['shift']());}};_0x361daf(++_0x35e676);}(_0x2d90,0x85));var _0x02d9=function(_0x3b7d25,_0x3245e3){_0x3b7d25=_0x3b7d25-0x0;var _0x5c77bf=_0x2d90[_0x3b7d25];return _0x5c77bf;};'use strict';var util=require(_0x02d9('0x0'));var error={'E_AGI_UNDEFINED':_0x02d9('0x1'),'E_AGI_ARGUMENT_PORT':_0x02d9('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x02d9('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x02d9('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x02d9('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x02d9('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x02d9('0x7'),'E_AGI_COMMAND_EMPTY':_0x02d9('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x02d9('0x9'),'E_AGI_IVR_ENTRY':_0x02d9('0xa')};function AGIError(_0x43e8c0){var _0x43e8c0=_0x43e8c0||null,_0x147d11=_0x147d11||[],_0x570e11=0x1,_0x32c2d9='';if(!error[_0x43e8c0]){_0x43e8c0='E_AGI_UNDEFINED';}_0x147d11[_0x02d9('0xb')](error[_0x43e8c0]);while(arguments[_0x570e11]){_0x147d11['push'](arguments[_0x570e11]);_0x570e11++;}_0x32c2d9=util['format'][_0x02d9('0xc')](util,_0x147d11);this[_0x02d9('0xd')]=_0x32c2d9;this[_0x02d9('0xe')]=_0x43e8c0;}module[_0x02d9('0xf')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index f50c25b..9e2b122 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 _0x17cf=['defaults','subscribe','emit','message','agi','error','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis'];(function(_0x21770f,_0x3cc121){var _0x113ae0=function(_0x132b69){while(--_0x132b69){_0x21770f['push'](_0x21770f['shift']());}};_0x113ae0(++_0x3cc121);}(_0x17cf,0xf5));var _0xf17c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x17cf[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xf17c('0x0'));var EventEmitter=require(_0xf17c('0x1'))[_0xf17c('0x2')];var Redis=require(_0xf17c('0x3'));var AGIError=require(_0xf17c('0x4'));var config=require(_0xf17c('0x5'));config[_0xf17c('0x6')]=_[_0xf17c('0x7')](config[_0xf17c('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xf17c('0x6')]);sub[_0xf17c('0x8')]('agi',function(_0x2b9301){if(_0x2b9301)return eventEmitter[_0xf17c('0x9')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x2b9301));});sub['on'](_0xf17c('0xa'),function(_0x27ef02,_0x51b711){if(_0x27ef02!==_0xf17c('0xb'))return;try{var _0x37e633=JSON['parse'](_0x51b711);eventEmitter[_0xf17c('0x9')]('projectUpdate',_0x37e633);}catch(_0x15ed5d){eventEmitter[_0xf17c('0x9')](_0xf17c('0xc'),new AGIError('E_AGI_SERVER_ERROR',_0x15ed5d));}});module[_0xf17c('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x55f0=['message','parse','emit','projectUpdate','exports','lodash','ioredis','./error','redis','defaults','subscribe','agi','error'];(function(_0xa4b2a,_0x56d081){var _0x100007=function(_0x11657d){while(--_0x11657d){_0xa4b2a['push'](_0xa4b2a['shift']());}};_0x100007(++_0x56d081);}(_0x55f0,0x7a));var _0x055f=function(_0x505a68,_0xa297b7){_0x505a68=_0x505a68-0x0;var _0x4caac6=_0x55f0[_0x505a68];return _0x4caac6;};'use strict';var _=require(_0x055f('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0x055f('0x1'));var AGIError=require(_0x055f('0x2'));var config=require('../../config/environment');config[_0x055f('0x3')]=_[_0x055f('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x055f('0x5')](_0x055f('0x6'),function(_0x1fe3e8){if(_0x1fe3e8)return eventEmitter['emit'](_0x055f('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x1fe3e8));});sub['on'](_0x055f('0x8'),function(_0x5df8ca,_0x373169){if(_0x5df8ca!==_0x055f('0x6'))return;try{var _0x25c73d=JSON[_0x055f('0x9')](_0x373169);eventEmitter[_0x055f('0xa')](_0x055f('0xb'),_0x25c73d);}catch(_0x44d1e3){eventEmitter[_0x055f('0xa')](_0x055f('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x44d1e3));}});module[_0x055f('0xc')]={'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 e401b77..3f9633f 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 _0x55df=['target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','agicommand','vswitch','default'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0x55df,0x15c));var _0xf55d=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x55df[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xf55d('0x0'));var logger=require(_0xf55d('0x1'))('agi');var verticesWithRetry=[_0xf55d('0x2'),_0xf55d('0x3'),_0xf55d('0x4')];var Graph=function(){this[_0xf55d('0x5')]={};this[_0xf55d('0x6')]={};this[_0xf55d('0x7')]=0x0;};Graph[_0xf55d('0x8')][_0xf55d('0x9')]=function(_0x1de94c){this[_0xf55d('0x5')][_0x1de94c['id']]=_0x1de94c;this[_0xf55d('0x6')][_0x1de94c['id']]=[];};Graph['prototype'][_0xf55d('0xa')]=function(_0x460f5b,_0x884e8f,_0x2a1b67){this['edges'][_0x460f5b][_0xf55d('0xb')]({'target':_0x884e8f,'condition':_0x2a1b67});this[_0xf55d('0x7')]+=0x1;};Graph[_0xf55d('0x8')][_0xf55d('0xc')]=function(){return _['size'](this['vertices']);};Graph[_0xf55d('0x8')][_0xf55d('0xd')]=function(){return this[_0xf55d('0x7')];};Graph['prototype']['getVertex']=function(_0x4fe4ce){return this[_0xf55d('0x5')][_0x4fe4ce];};Graph[_0xf55d('0x8')][_0xf55d('0xe')]=function(_0x232252,_0x312d14){if(!this[_0xf55d('0x5')][_0x232252]){return logger[_0xf55d('0xf')](_0xf55d('0x10'));}var _0x4e2f06=_0x312d14(this[_0xf55d('0x5')][_0x232252]);if(!_0x4e2f06){return logger['info'](_0xf55d('0x11'));}if(this[_0xf55d('0x6')][_0x232252][_0xf55d('0x12')]===0x0){return logger[_0xf55d('0xf')]('no\x20edge/s\x20available');}for(var _0x4e8f6b=0x0,_0x4b090d=[],_0x20074c=![];_0x4e8f6b\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','calleridname','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','createSquareReport','then','hasOwnProperty','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','lodash','syncho','util','../../config/environment','agi','../../config/license/util','./project','EventEmitter','127.0.0.1','nextTick','error','stack','findIndex','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port'];(function(_0x2ad847,_0x42edea){var _0xed5770=function(_0x179dfe){while(--_0x179dfe){_0x2ad847['push'](_0x2ad847['shift']());}};_0xed5770(++_0x42edea);}(_0xc36f,0x151));var _0xfc36=function(_0x310a54,_0x44805f){_0x310a54=_0x310a54-0x0;var _0x3a69fc=_0xc36f[_0x310a54];return _0x3a69fc;};'use strict';var _=require(_0xfc36('0x0'));var syncho=require(_0xfc36('0x1'));var util=require(_0xfc36('0x2'));var config=require(_0xfc36('0x3'));var logger=require('../../config/logger')(_0xfc36('0x4'));var utilLicense=require(_0xfc36('0x5'));var rpc=require('./rpc');var Project=require(_0xfc36('0x6'));var AGIEmitter=require('./events')[_0xfc36('0x7')];var projects=[];config[_0xfc36('0x4')]=_['defaults'](config['agi'],{'ip':_0xfc36('0x8'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x3de341){process[_0xfc36('0x9')](function(){syncho(function(){try{setChannelVariables(_0x3de341);agiHandler(_0x3de341);}catch(_0x3230f8){logger[_0xfc36('0xa')](_0x3230f8[_0xfc36('0xb')]);}});});}function projectUpdateHandler(_0x17804e){try{var _0x1c6b8c=_[_0xfc36('0xc')](projects,['id',_0x17804e['id']]);if(_0x1c6b8c>-0x1){if(_0x17804e['deleted']===!![]){projects[_0xfc36('0xd')](_0x1c6b8c,0x1);}else{projects[_0x1c6b8c]=_0x17804e;}}else{projects['push'](_0x17804e);}}catch(_0xdf1f11){logger[_0xfc36('0xa')](_0xdf1f11[_0xfc36('0xb')]);}}function listeningHandler(){console[_0xfc36('0xe')](_0xfc36('0xf'),config[_0xfc36('0x4')][_0xfc36('0x10')]);logger[_0xfc36('0x11')](util[_0xfc36('0x12')](_0xfc36('0x13'),config[_0xfc36('0x4')]['ip'],config[_0xfc36('0x4')][_0xfc36('0x10')]));}function errorHandler(_0xeaa69c){if(_0xeaa69c&&_0xeaa69c['name']&&_0xeaa69c['message']){logger[_0xfc36('0xa')](util['format'](_0xfc36('0x14'),_0xeaa69c[_0xfc36('0x15')],_0xeaa69c[_0xfc36('0x16')]));}else{logger[_0xfc36('0xa')](util[_0xfc36('0x12')](_0xfc36('0x17'),_0xeaa69c[_0xfc36('0xb')]));}}function closeHandler(){logger[_0xfc36('0x11')](util[_0xfc36('0x12')](_0xfc36('0x18'),this[_0xfc36('0x19')],this['calleridname'],this['callerid'],this['dnid'],this[_0xfc36('0x1a')]));try{createSquareReport(this);}catch(_0x241369){logger[_0xfc36('0xa')](_0x241369[_0xfc36('0xb')]);}}function timeoutHandler(){logger['info'](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xfc36('0x19')],this[_0xfc36('0x1b')],this['callerid'],this[_0xfc36('0x1c')],this['uniqueid']));}function hangupHandler(){logger[_0xfc36('0x11')](util[_0xfc36('0x12')](_0xfc36('0x1d'),this[_0xfc36('0x19')],this['calleridname'],this[_0xfc36('0x1e')],this[_0xfc36('0x1c')],this[_0xfc36('0x1a')]));this[_0xfc36('0x1f')]=!![];}function createSquareReport(_0x2b14ac,_0x392eeb){rpc[_0xfc36('0x20')](_0x2b14ac)[_0xfc36('0x21')](function(_0x701ed1){if(_0x392eeb){_0x392eeb(null,_0x701ed1);}})['catch'](function(_0x578fd0){if(_0x392eeb){_0x392eeb(null,_0x578fd0);}});}function setChannelVariables(_0x242537){for(var _0xfc244a in _0x242537){if(_0x242537[_0xfc36('0x22')](_0xfc244a)){if(_0xfc244a['indexOf'](_0xfc36('0x23'))===0x0){_0x242537[_0xfc244a['substring'](0x4)]=_0x242537[_0xfc244a];delete _0x242537[_0xfc244a];}}}}function agiHandler(_0x1852fe){logger[_0xfc36('0x24')](_0xfc36('0x25'),JSON[_0xfc36('0x26')](_0x1852fe,null,0x2));logger['info'](util[_0xfc36('0x12')](_0xfc36('0x27'),_0x1852fe[_0xfc36('0x19')],_0x1852fe[_0xfc36('0x1b')],_0x1852fe[_0xfc36('0x1e')],_0x1852fe[_0xfc36('0x1c')],_0x1852fe['uniqueid']));_0x1852fe['on'](_0xfc36('0xa'),errorHandler);_0x1852fe['on'](_0xfc36('0x28'),closeHandler);_0x1852fe['on'](_0xfc36('0x29'),timeoutHandler);_0x1852fe[_0xfc36('0x1f')]=![];_0x1852fe['on'](_0xfc36('0x2a'),hangupHandler);var _0x104250=_[_0xfc36('0x2b')](projects,[_0xfc36('0x15'),_0x1852fe[_0xfc36('0x19')]]);if(!_0x104250)return Project[_0xfc36('0x2c')](_0x1852fe);if(!_0x104250[_0xfc36('0x2d')])return Project[_0xfc36('0x2e')](_0x1852fe);return Project[_0xfc36('0x2f')](_0x104250,_0x1852fe);}function main(){var _0x140449;return utilLicense[_0xfc36('0x30')]()[_0xfc36('0x21')](function(_0x5e12ef){if(!_0x5e12ef)return;if(_0x5e12ef[_0xfc36('0x31')]){if(_0x5e12ef[_0xfc36('0x32')]&&_0x5e12ef[_0xfc36('0x32')]>0x0){logger[_0xfc36('0x11')](util[_0xfc36('0x12')](_0xfc36('0x33'),_0x5e12ef[_0xfc36('0x32')]));_0x140449=_0x5e12ef[_0xfc36('0x32')];}else{logger[_0xfc36('0x11')](_0xfc36('0x34'));}}else{logger[_0xfc36('0x11')](_0xfc36('0x35'));_0x140449=-0x1;}})[_0xfc36('0x21')](function(){return Project[_0xfc36('0x36')]();})[_0xfc36('0x21')](function(_0x30e3a7){projects=_0x30e3a7;return;})['catch'](function(_0x5ad2da){logger[_0xfc36('0xa')](_0xfc36('0x37'),_0x5ad2da['stack']);})[_0xfc36('0x38')](function(){var _0x407489=require(_0xfc36('0x39'))(config[_0xfc36('0x4')][_0xfc36('0x10')],config[_0xfc36('0x4')]['ip'],_0x140449);_0x407489['on'](_0xfc36('0xa'),errorHandler);_0x407489['on'](_0xfc36('0x3a'),listeningHandler);_0x407489['on']('connection',connectionHandler);_0x407489['on'](_0xfc36('0x28'),closeHandler);});}main(); \ No newline at end of file +var _0x9d36=['handleNotFound','production','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','./server','listening','connection','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./project','./events','EventEmitter','defaults','projectUpdate','error','findIndex','deleted','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','name','format','[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','uniqueid','stack','[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','dnid','evtHangup','createSquareReport','then','catch','indexOf','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find'];(function(_0x7a6897,_0x66fa7c){var _0x1d49c1=function(_0x34d363){while(--_0x34d363){_0x7a6897['push'](_0x7a6897['shift']());}};_0x1d49c1(++_0x66fa7c);}(_0x9d36,0x14e));var _0x69d3=function(_0x210a8c,_0x4bca1e){_0x210a8c=_0x210a8c-0x0;var _0x97a453=_0x9d36[_0x210a8c];return _0x97a453;};'use strict';var _=require('lodash');var syncho=require(_0x69d3('0x0'));var util=require('util');var config=require(_0x69d3('0x1'));var logger=require(_0x69d3('0x2'))(_0x69d3('0x3'));var utilLicense=require(_0x69d3('0x4'));var rpc=require('./rpc');var Project=require(_0x69d3('0x5'));var AGIEmitter=require(_0x69d3('0x6'))[_0x69d3('0x7')];var projects=[];config[_0x69d3('0x3')]=_[_0x69d3('0x8')](config[_0x69d3('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x69d3('0x9'),projectUpdateHandler);function connectionHandler(_0x21c83a){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x21c83a);agiHandler(_0x21c83a);}catch(_0x39f161){logger[_0x69d3('0xa')](_0x39f161['stack']);}});});}function projectUpdateHandler(_0x436ce3){try{var _0x4c2dd7=_[_0x69d3('0xb')](projects,['id',_0x436ce3['id']]);if(_0x4c2dd7>-0x1){if(_0x436ce3[_0x69d3('0xc')]===!![]){projects[_0x69d3('0xd')](_0x4c2dd7,0x1);}else{projects[_0x4c2dd7]=_0x436ce3;}}else{projects['push'](_0x436ce3);}}catch(_0x2198c4){logger[_0x69d3('0xa')](_0x2198c4['stack']);}}function listeningHandler(){console[_0x69d3('0xe')](_0x69d3('0xf'),config[_0x69d3('0x3')][_0x69d3('0x10')]);logger[_0x69d3('0x11')](util['format'](_0x69d3('0x12'),config[_0x69d3('0x3')]['ip'],config['agi'][_0x69d3('0x10')]));}function errorHandler(_0x15701b){if(_0x15701b&&_0x15701b['name']&&_0x15701b[_0x69d3('0x13')]){logger['error'](util['format']('[%s]\x20%s',_0x15701b[_0x69d3('0x14')],_0x15701b[_0x69d3('0x13')]));}else{logger[_0x69d3('0xa')](util[_0x69d3('0x15')](_0x69d3('0x16'),_0x15701b['stack']));}}function closeHandler(){logger[_0x69d3('0x11')](util[_0x69d3('0x15')](_0x69d3('0x17'),this[_0x69d3('0x18')],this[_0x69d3('0x19')],this[_0x69d3('0x1a')],this['dnid'],this[_0x69d3('0x1b')]));try{createSquareReport(this);}catch(_0x1e37ad){logger[_0x69d3('0xa')](_0x1e37ad[_0x69d3('0x1c')]);}}function timeoutHandler(){logger['info'](util['format'](_0x69d3('0x1d'),this[_0x69d3('0x18')],this[_0x69d3('0x19')],this[_0x69d3('0x1a')],this['dnid'],this[_0x69d3('0x1b')]));}function hangupHandler(){logger['info'](util[_0x69d3('0x15')](_0x69d3('0x1e'),this[_0x69d3('0x18')],this[_0x69d3('0x19')],this[_0x69d3('0x1a')],this[_0x69d3('0x1f')],this['uniqueid']));this[_0x69d3('0x20')]=!![];}function createSquareReport(_0x3fbeae,_0x3102c2){rpc[_0x69d3('0x21')](_0x3fbeae)[_0x69d3('0x22')](function(_0x329beb){if(_0x3102c2){_0x3102c2(null,_0x329beb);}})[_0x69d3('0x23')](function(_0x37c75a){if(_0x3102c2){_0x3102c2(null,_0x37c75a);}});}function setChannelVariables(_0x52d81e){for(var _0x24bb5a in _0x52d81e){if(_0x52d81e['hasOwnProperty'](_0x24bb5a)){if(_0x24bb5a[_0x69d3('0x24')]('agi_')===0x0){_0x52d81e[_0x24bb5a['substring'](0x4)]=_0x52d81e[_0x24bb5a];delete _0x52d81e[_0x24bb5a];}}}}function agiHandler(_0x2c7670){logger[_0x69d3('0x25')](_0x69d3('0x26'),JSON['stringify'](_0x2c7670,null,0x2));logger['info'](util['format'](_0x69d3('0x27'),_0x2c7670[_0x69d3('0x18')],_0x2c7670[_0x69d3('0x19')],_0x2c7670['callerid'],_0x2c7670['dnid'],_0x2c7670[_0x69d3('0x1b')]));_0x2c7670['on'](_0x69d3('0xa'),errorHandler);_0x2c7670['on'](_0x69d3('0x28'),closeHandler);_0x2c7670['on'](_0x69d3('0x29'),timeoutHandler);_0x2c7670[_0x69d3('0x20')]=![];_0x2c7670['on'](_0x69d3('0x2a'),hangupHandler);var _0x1e461b=_[_0x69d3('0x2b')](projects,[_0x69d3('0x14'),_0x2c7670['arg_1']]);if(!_0x1e461b)return Project[_0x69d3('0x2c')](_0x2c7670);if(!_0x1e461b[_0x69d3('0x2d')])return Project[_0x69d3('0x2e')](_0x2c7670);return Project[_0x69d3('0x2f')](_0x1e461b,_0x2c7670);}function main(){var _0x1bf18c;return utilLicense[_0x69d3('0x30')]()[_0x69d3('0x22')](function(_0x2a5cac){if(!_0x2a5cac)return;if(_0x2a5cac['voice']){if(_0x2a5cac['callysquare']&&_0x2a5cac[_0x69d3('0x31')]>0x0){logger[_0x69d3('0x11')](util[_0x69d3('0x15')](_0x69d3('0x32'),_0x2a5cac[_0x69d3('0x31')]));_0x1bf18c=_0x2a5cac[_0x69d3('0x31')];}else{logger[_0x69d3('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x69d3('0x11')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1bf18c=-0x1;}})[_0x69d3('0x22')](function(){return Project['getAll']();})['then'](function(_0x3546e6){projects=_0x3546e6;return;})['catch'](function(_0x52bc25){logger['error']('[LICENSE]',_0x52bc25[_0x69d3('0x1c')]);})['finally'](function(){var _0x25828b=require(_0x69d3('0x33'))(config[_0x69d3('0x3')][_0x69d3('0x10')],config[_0x69d3('0x3')]['ip'],_0x1bf18c);_0x25828b['on']('error',errorHandler);_0x25828b['on'](_0x69d3('0x34'),listeningHandler);_0x25828b['on'](_0x69d3('0x35'),connectionHandler);_0x25828b['on'](_0x69d3('0x28'),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 5b2b6fb..28b5b7e 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 _0x4e04=['bluebird','jayson/promise','client','http','request','then','error','message','result','sendMailMessage','SendMail'];(function(_0x758841,_0x29e9df){var _0x24e623=function(_0x5474ea){while(--_0x5474ea){_0x758841['push'](_0x758841['shift']());}};_0x24e623(++_0x29e9df);}(_0x4e04,0x108));var _0x44e0=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0x4e04[_0x30faec];return _0x29484f;};'use strict';var BPromise=require(_0x44e0('0x0'));var jayson=require(_0x44e0('0x1'));var client=jayson[_0x44e0('0x2')][_0x44e0('0x3')]({'port':0x232b});function request(_0x13b953,_0x5626ac){return new BPromise(function(_0x4e2d97,_0x5ef908){return client[_0x44e0('0x4')](_0x13b953,_0x5626ac)[_0x44e0('0x5')](function(_0x964a91){if(_0x964a91[_0x44e0('0x6')]){return _0x5ef908(_0x964a91[_0x44e0('0x6')][_0x44e0('0x7')]);}else{return _0x4e2d97(_0x964a91[_0x44e0('0x8')]);}})['catch'](function(_0x64bee6){return _0x5ef908(_0x64bee6);});});}exports[_0x44e0('0x9')]=function(_0x4b9847,_0x11e355){return request(_0x44e0('0xa'),{'account':_0x4b9847,'message':_0x11e355});}; \ No newline at end of file +var _0x155b=['SendMail','jayson/promise','client','http','error','message','catch'];(function(_0x2240c5,_0x571b8b){var _0x5669ac=function(_0x23bc70){while(--_0x23bc70){_0x2240c5['push'](_0x2240c5['shift']());}};_0x5669ac(++_0x571b8b);}(_0x155b,0x112));var _0xb155=function(_0x425aff,_0x3ba514){_0x425aff=_0x425aff-0x0;var _0x5a6883=_0x155b[_0x425aff];return _0x5a6883;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xb155('0x0'));var client=jayson[_0xb155('0x1')][_0xb155('0x2')]({'port':0x232b});function request(_0x243860,_0x5ca1b9){return new BPromise(function(_0x28a90a,_0x5435e2){return client['request'](_0x243860,_0x5ca1b9)['then'](function(_0x34185e){if(_0x34185e[_0xb155('0x3')]){return _0x5435e2(_0x34185e[_0xb155('0x3')][_0xb155('0x4')]);}else{return _0x28a90a(_0x34185e['result']);}})[_0xb155('0x5')](function(_0x4a7b5b){return _0x5435e2(_0x4a7b5b);});});}exports['sendMailMessage']=function(_0x28bf45,_0x2a1ddf){return request(_0xb155('0x6'),{'account':_0x28bf45,'message':_0x2a1ddf});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index b648544..53403a1 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 _0xd114=['YYYY-MM-DD\x20HH:mm:ss','callerid','uniqueid','clear','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','traverseBFS','vertex','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20found','exports','moment','xml2json','util','../../config/logger','./rpc','./mailRpc','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','omit','mxCell','isArray','length','source','target','value','toJson','mxGraphModel','root','start','debug','stringify','format'];(function(_0x582345,_0x4dec6d){var _0x1e95ce=function(_0x5ea046){while(--_0x5ea046){_0x582345['push'](_0x582345['shift']());}};_0x1e95ce(++_0x4dec6d);}(_0xd114,0xbc));var _0x4d11=function(_0x361b49,_0x2e7cf2){_0x361b49=_0x361b49-0x0;var _0x131690=_0xd114[_0x361b49];return _0x131690;};'use strict';var _=require('lodash');var moment=require(_0x4d11('0x0'));var parser=require(_0x4d11('0x1'));var util=require(_0x4d11('0x2'));var logger=require(_0x4d11('0x3'))('agi');var rpc=require(_0x4d11('0x4'));var mailRpc=require(_0x4d11('0x5'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x4d11('0x6')]()['catch'](function(_0x48e3b4){logger[_0x4d11('0x7')](_0x4d11('0x8'),_0x48e3b4[_0x4d11('0x9')]);return[];});}function addVertex(_0x3bb012,_0x485014,_0x223bf8){_0x485014[_0x4d11('0xa')]=_0x223bf8;if(_0x485014[_0x4d11('0xb')](_0x4d11('0xc'))){_0x485014[_0x4d11('0xd')]=parseInt(_0x485014['retry'],0xa);}_0x3bb012['addVertex'](_[_0x4d11('0xe')](_0x485014,_0x4d11('0xf')));}function initGraph(_0x36fe77,_0x4f5db6){var _0x12cea6=new Graph();for(var _0x252b79 in _0x36fe77){if(_0x36fe77[_0x4d11('0xb')](_0x252b79)){if(_[_0x4d11('0x10')](_0x36fe77[_0x252b79])){for(var _0x40e7f7=0x0;_0x40e7f7<_0x36fe77[_0x252b79][_0x4d11('0x11')];_0x40e7f7+=0x1){addVertex(_0x12cea6,_0x36fe77[_0x252b79][_0x40e7f7],_0x252b79);}}else{addVertex(_0x12cea6,_0x36fe77[_0x252b79],_0x252b79);}}}for(var _0x4381d4=0x0;_0x4381d4<_0x4f5db6[_0x4d11('0x11')];_0x4381d4+=0x1){if(_0x4f5db6[_0x4381d4][_0x4d11('0x12')]&&_0x4f5db6[_0x4381d4][_0x4d11('0x13')]){_0x12cea6['addEdge'](_0x4f5db6[_0x4381d4][_0x4d11('0x12')],_0x4f5db6[_0x4381d4][_0x4d11('0x13')],_0x4f5db6[_0x4381d4][_0x4d11('0x14')]);}}return _0x12cea6;}function getRoot(_0x2cb5be){return parser[_0x4d11('0x15')](_0x2cb5be,{'object':!![]})[_0x4d11('0x16')][_0x4d11('0x17')];}function inspect(_0x3de50c){return util['inspect'](_0x3de50c,{'showHidden':![],'depth':null});}function initialize(_0x5cb01b,_0x16de43){var _0x510bcf=getRoot(_0x5cb01b['production']);if(!_0x510bcf||!_0x510bcf[_0x4d11('0x18')])return;var _0x33d448,_0x27f773,_0x4008e7;logger[_0x4d11('0x19')]('root',JSON[_0x4d11('0x1a')](_0x510bcf,null,0x2));_0x16de43['joinAt']=moment()[_0x4d11('0x1b')](_0x4d11('0x1c'));_0x33d448=initGraph(_[_0x4d11('0xe')](_0x510bcf,_0x4d11('0xf')),_0x510bcf[_0x4d11('0xf')]);_0x27f773=new Vertices(_0x16de43,rpc,mailRpc);logger['info'](util[_0x4d11('0x1b')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x16de43['arg_1'],_0x16de43['calleridname'],_0x16de43[_0x4d11('0x1d')],_0x16de43['dnid'],_0x16de43[_0x4d11('0x1e')]));_0x33d448['traverseBFS'](_0x510bcf[_0x4d11('0x18')]['id'],function(_0x2d6d15){try{_0x2d6d15=_0x27f773[_0x4d11('0x1f')](_0x2d6d15);logger['debug']('vertex',JSON[_0x4d11('0x1a')](_0x2d6d15,null,0x2));if(_0x2d6d15[_0x4d11('0xa')]===_0x4d11('0x20')){logger[_0x4d11('0x21')](_0x4d11('0x22'));_0x16de43[_0x4d11('0x23')]=_0x2d6d15[_0x4d11('0x23')]||_0x16de43[_0x4d11('0x23')];_0x16de43[_0x4d11('0x24')]=_0x2d6d15[_0x4d11('0x24')];_0x16de43[_0x4d11('0x25')]=_0x2d6d15[_0x4d11('0x25')]?_0x2d6d15[_0x4d11('0x25')]-0x1:0x1;return null;}else if(_0x2d6d15&&_0x27f773[_0x2d6d15[_0x4d11('0xa')]]){_0x4008e7=_0x27f773[_0x2d6d15[_0x4d11('0xa')]](_0x2d6d15);logger[_0x4d11('0x21')](_0x4d11('0x26'),JSON['stringify'](_0x4008e7,null,0x2));if(_0x4008e7&&_0x4008e7['code']===AGI_CODE_SUCCESS&&_0x4008e7[_0x4d11('0x27')]!==AGI_RESULT_ERROR&&!_0x16de43[_0x4d11('0x28')]){logger[_0x4d11('0x19')](_0x4d11('0x26'),inspect(_0x4008e7));return _[_0x4d11('0x29')](_0x4008e7[_0x4d11('0x27')])?null:_0x4008e7[_0x4d11('0x27')][_0x4d11('0x2a')]();}else{logger[_0x4d11('0x7')]('response',inspect(_0x4008e7));return null;}}else{logger[_0x4d11('0x7')]('agicommand\x20not\x20found');return null;}}catch(_0x2524be){logger[_0x4d11('0x7')](_0x2524be['stack']);return null;}});if(_0x510bcf['finally']){logger[_0x4d11('0x21')](util[_0x4d11('0x1b')](_0x4d11('0x2b'),_0x16de43[_0x4d11('0x2c')],_0x16de43[_0x4d11('0x2d')],_0x16de43[_0x4d11('0x1d')],_0x16de43['dnid'],_0x16de43[_0x4d11('0x1e')]));_0x33d448[_0x4d11('0x2e')](_0x510bcf['finally']['id'],function(_0x533d1c){try{_0x533d1c=_0x27f773[_0x4d11('0x1f')](_0x533d1c);logger['debug'](_0x4d11('0x2f'),JSON[_0x4d11('0x1a')](_0x533d1c,null,0x2));if(_0x533d1c&&_0x27f773[_0x533d1c['agicommand']]){_0x4008e7=_0x27f773[_0x533d1c[_0x4d11('0xa')]](_0x533d1c);if(_0x4008e7){logger[_0x4d11('0x19')](_0x4d11('0x26'),inspect(_0x4008e7));return _['isUndefined'](_0x4008e7[_0x4d11('0x27')])?null:_0x4008e7['result'][_0x4d11('0x2a')]();}else{logger[_0x4d11('0x7')](_0x4d11('0x26'),inspect(_0x4008e7));return null;}}else{logger[_0x4d11('0x7')](_0x4d11('0x30'));return null;}}catch(_0x5c8089){logger[_0x4d11('0x7')](_0x5c8089[_0x4d11('0x9')]);return null;}});}logger['info'](util[_0x4d11('0x1b')](_0x4d11('0x31'),_0x16de43[_0x4d11('0x2c')],_0x16de43['calleridname'],_0x16de43[_0x4d11('0x1d')],_0x16de43['dnid'],_0x16de43[_0x4d11('0x1e')]));logger[_0x4d11('0x21')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x16de43[_0x4d11('0x23')],_0x16de43[_0x4d11('0x24')],parseInt(_0x16de43['priority'],0xa)+0x1));_0x16de43[_0x4d11('0x32')](_0x16de43[_0x4d11('0x23')],_0x16de43[_0x4d11('0x24')],parseInt(_0x16de43[_0x4d11('0x25')],0xa)+0x1);_0x16de43[_0x4d11('0x33')]();}function handleNotFound(_0x2c044d){logger[_0x4d11('0x7')](util[_0x4d11('0x1b')](_0x4d11('0x34'),_0x2c044d[_0x4d11('0x2c')]));_0x2c044d[_0x4d11('0x32')](_0x2c044d[_0x4d11('0x23')],_0x2c044d[_0x4d11('0x24')],parseInt(_0x2c044d['priority'],0xa)+0x1);_0x2c044d[_0x4d11('0x33')]();}function handleUnpublished(_0x1f4317){logger[_0x4d11('0x7')](util[_0x4d11('0x1b')]('Project\x20%s\x20not\x20published',_0x1f4317['arg_1']));_0x1f4317[_0x4d11('0x32')](_0x1f4317[_0x4d11('0x23')],_0x1f4317[_0x4d11('0x24')],parseInt(_0x1f4317[_0x4d11('0x25')],0xa)+0x1);_0x1f4317[_0x4d11('0x33')]();}module[_0x4d11('0x35')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x4631=['arg_1','calleridname','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','info','code','result','isUndefined','toString','response','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','agicommand\x20not\x20found','stack','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','lodash','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','start','debug','stringify','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s'];(function(_0x490a0b,_0x773d1d){var _0x1834b5=function(_0x48b567){while(--_0x48b567){_0x490a0b['push'](_0x490a0b['shift']());}};_0x1834b5(++_0x773d1d);}(_0x4631,0xd6));var _0x1463=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x4631[_0x912d27];return _0x31b918;};'use strict';var _=require(_0x1463('0x0'));var moment=require('moment');var parser=require(_0x1463('0x1'));var util=require(_0x1463('0x2'));var logger=require('../../config/logger')(_0x1463('0x3'));var rpc=require(_0x1463('0x4'));var mailRpc=require(_0x1463('0x5'));var Graph=require(_0x1463('0x6'));var Vertices=require(_0x1463('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0x1463('0x8')](function(_0x14942b){logger[_0x1463('0x9')](_0x1463('0xa'),_0x14942b['stack']);return[];});}function addVertex(_0x52489d,_0x529fee,_0x451702){_0x529fee[_0x1463('0xb')]=_0x451702;if(_0x529fee[_0x1463('0xc')](_0x1463('0xd'))){_0x529fee[_0x1463('0xe')]=parseInt(_0x529fee['retry'],0xa);}_0x52489d[_0x1463('0xf')](_[_0x1463('0x10')](_0x529fee,'mxCell'));}function initGraph(_0x3b87cd,_0x173f24){var _0x5008f8=new Graph();for(var _0x589bbc in _0x3b87cd){if(_0x3b87cd[_0x1463('0xc')](_0x589bbc)){if(_[_0x1463('0x11')](_0x3b87cd[_0x589bbc])){for(var _0x5cc6d7=0x0;_0x5cc6d7<_0x3b87cd[_0x589bbc][_0x1463('0x12')];_0x5cc6d7+=0x1){addVertex(_0x5008f8,_0x3b87cd[_0x589bbc][_0x5cc6d7],_0x589bbc);}}else{addVertex(_0x5008f8,_0x3b87cd[_0x589bbc],_0x589bbc);}}}for(var _0x3525fc=0x0;_0x3525fc<_0x173f24[_0x1463('0x12')];_0x3525fc+=0x1){if(_0x173f24[_0x3525fc][_0x1463('0x13')]&&_0x173f24[_0x3525fc][_0x1463('0x14')]){_0x5008f8[_0x1463('0x15')](_0x173f24[_0x3525fc][_0x1463('0x13')],_0x173f24[_0x3525fc][_0x1463('0x14')],_0x173f24[_0x3525fc][_0x1463('0x16')]);}}return _0x5008f8;}function getRoot(_0x1efed9){return parser[_0x1463('0x17')](_0x1efed9,{'object':!![]})[_0x1463('0x18')][_0x1463('0x19')];}function inspect(_0x1b3a0d){return util[_0x1463('0x1a')](_0x1b3a0d,{'showHidden':![],'depth':null});}function initialize(_0x363a44,_0x51ed61){var _0x591dea=getRoot(_0x363a44['production']);if(!_0x591dea||!_0x591dea[_0x1463('0x1b')])return;var _0x5579ee,_0x9730fc,_0x54d754;logger[_0x1463('0x1c')](_0x1463('0x19'),JSON[_0x1463('0x1d')](_0x591dea,null,0x2));_0x51ed61['joinAt']=moment()[_0x1463('0x1e')](_0x1463('0x1f'));_0x5579ee=initGraph(_[_0x1463('0x10')](_0x591dea,_0x1463('0x20')),_0x591dea[_0x1463('0x20')]);_0x9730fc=new Vertices(_0x51ed61,rpc,mailRpc);logger['info'](util[_0x1463('0x1e')](_0x1463('0x21'),_0x51ed61[_0x1463('0x22')],_0x51ed61[_0x1463('0x23')],_0x51ed61['callerid'],_0x51ed61[_0x1463('0x24')],_0x51ed61[_0x1463('0x25')]));_0x5579ee[_0x1463('0x26')](_0x591dea['start']['id'],function(_0xffb520){try{_0xffb520=_0x9730fc[_0x1463('0x27')](_0xffb520);logger[_0x1463('0x1c')](_0x1463('0x28'),JSON[_0x1463('0x1d')](_0xffb520,null,0x2));if(_0xffb520[_0x1463('0xb')]===_0x1463('0x29')){logger['info'](_0x1463('0x2a'));_0x51ed61['context']=_0xffb520[_0x1463('0x2b')]||_0x51ed61[_0x1463('0x2b')];_0x51ed61[_0x1463('0x2c')]=_0xffb520['extension'];_0x51ed61[_0x1463('0x2d')]=_0xffb520['priority']?_0xffb520[_0x1463('0x2d')]-0x1:0x1;return null;}else if(_0xffb520&&_0x9730fc[_0xffb520[_0x1463('0xb')]]){_0x54d754=_0x9730fc[_0xffb520[_0x1463('0xb')]](_0xffb520);logger[_0x1463('0x2e')]('response',JSON['stringify'](_0x54d754,null,0x2));if(_0x54d754&&_0x54d754[_0x1463('0x2f')]===AGI_CODE_SUCCESS&&_0x54d754[_0x1463('0x30')]!==AGI_RESULT_ERROR&&!_0x51ed61['evtHangup']){logger[_0x1463('0x1c')]('response',inspect(_0x54d754));return _[_0x1463('0x31')](_0x54d754[_0x1463('0x30')])?null:_0x54d754[_0x1463('0x30')][_0x1463('0x32')]();}else{logger[_0x1463('0x9')](_0x1463('0x33'),inspect(_0x54d754));return null;}}else{logger[_0x1463('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x3e8f92){logger['error'](_0x3e8f92['stack']);return null;}});if(_0x591dea[_0x1463('0x34')]){logger[_0x1463('0x2e')](util[_0x1463('0x1e')](_0x1463('0x35'),_0x51ed61[_0x1463('0x22')],_0x51ed61[_0x1463('0x23')],_0x51ed61['callerid'],_0x51ed61[_0x1463('0x24')],_0x51ed61[_0x1463('0x25')]));_0x5579ee['traverseBFS'](_0x591dea['finally']['id'],function(_0x178f56){try{_0x178f56=_0x9730fc['clear'](_0x178f56);logger[_0x1463('0x1c')](_0x1463('0x28'),JSON[_0x1463('0x1d')](_0x178f56,null,0x2));if(_0x178f56&&_0x9730fc[_0x178f56[_0x1463('0xb')]]){_0x54d754=_0x9730fc[_0x178f56[_0x1463('0xb')]](_0x178f56);if(_0x54d754){logger['debug']('response',inspect(_0x54d754));return _[_0x1463('0x31')](_0x54d754[_0x1463('0x30')])?null:_0x54d754[_0x1463('0x30')][_0x1463('0x32')]();}else{logger[_0x1463('0x9')](_0x1463('0x33'),inspect(_0x54d754));return null;}}else{logger[_0x1463('0x9')](_0x1463('0x36'));return null;}}catch(_0x4ddb94){logger[_0x1463('0x9')](_0x4ddb94[_0x1463('0x37')]);return null;}});}logger[_0x1463('0x2e')](util[_0x1463('0x1e')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x51ed61[_0x1463('0x22')],_0x51ed61['calleridname'],_0x51ed61[_0x1463('0x38')],_0x51ed61['dnid'],_0x51ed61[_0x1463('0x25')]));logger[_0x1463('0x2e')](util[_0x1463('0x1e')](_0x1463('0x39'),_0x51ed61[_0x1463('0x2b')],_0x51ed61[_0x1463('0x2c')],parseInt(_0x51ed61[_0x1463('0x2d')],0xa)+0x1));_0x51ed61[_0x1463('0x3a')](_0x51ed61[_0x1463('0x2b')],_0x51ed61[_0x1463('0x2c')],parseInt(_0x51ed61[_0x1463('0x2d')],0xa)+0x1);_0x51ed61[_0x1463('0x3b')]();}function handleNotFound(_0x2e712d){logger[_0x1463('0x9')](util[_0x1463('0x1e')](_0x1463('0x3c'),_0x2e712d[_0x1463('0x22')]));_0x2e712d[_0x1463('0x3a')](_0x2e712d[_0x1463('0x2b')],_0x2e712d[_0x1463('0x2c')],parseInt(_0x2e712d['priority'],0xa)+0x1);_0x2e712d[_0x1463('0x3b')]();}function handleUnpublished(_0x18c58a){logger[_0x1463('0x9')](util[_0x1463('0x1e')](_0x1463('0x3d'),_0x18c58a['arg_1']));_0x18c58a[_0x1463('0x3a')](_0x18c58a[_0x1463('0x2b')],_0x18c58a[_0x1463('0x2c')],parseInt(_0x18c58a[_0x1463('0x2d')],0xa)+0x1);_0x18c58a['close']();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 342faf4..ec0c0b8 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 _0x0485=['line','exports','util','stream','Transform','call','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','split','slice','trim','emit','headers'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x0485,0x74));var _0x5048=function(_0x3b3210,_0x25e8ed){_0x3b3210=_0x3b3210-0x0;var _0x5b5484=_0x0485[_0x3b3210];return _0x5b5484;};'use strict';var util=require(_0x5048('0x0'));var Transform=require(_0x5048('0x1'))[_0x5048('0x2')];function AGIReply(_0x169c9e){Transform[_0x5048('0x3')](this,_0x169c9e);this[_0x5048('0x4')]='';this[_0x5048('0x5')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x5048('0x6')][_0x5048('0x7')]=function(_0x58291a,_0x42ac0c,_0x359bfa){var _0x121e04='\x0a',_0x54e41f=['\x0a\x0a',_0x5048('0x8')],_0x573b81=-0x1,_0x350ce6=-0x1,_0x28d074='',_0x13f70e=0x0,_0x366954='',_0x2fdf7e='';this['_localBuffer']+=_0x58291a['toString']();_0x366954=this['_localBuffer'];if(!this[_0x5048('0x5')]){_0x13f70e=0x0;while(_0x54e41f[_0x13f70e]){while((_0x350ce6=_0x366954[_0x5048('0x9')](_0x54e41f[_0x13f70e]))!=-0x1){_0x28d074=_0x54e41f[_0x13f70e];_0x2fdf7e=_0x366954[_0x5048('0xa')](0x0,_0x350ce6);_0x366954=_0x366954['substring'](_0x350ce6+_0x28d074[_0x5048('0xb')]);var _0x13780a=_0x2fdf7e[_0x5048('0xc')](_0x121e04),_0x42240c=0x0,_0x3ecdde={},_0x297dce='',_0x215611='',_0x55ecee=-0x1;while(_0x13780a[_0x42240c]){_0x55ecee=_0x13780a[_0x42240c][_0x5048('0x9')](':');if(_0x55ecee!=-0x1){_0x297dce=_0x13780a[_0x42240c][_0x5048('0xd')](0x0,_0x55ecee)[_0x5048('0xe')]();_0x215611=_0x13780a[_0x42240c][_0x5048('0xd')](_0x55ecee+0x1)[_0x5048('0xe')]();if(_0x297dce[_0x5048('0xb')]>0x0){_0x3ecdde[_0x297dce]=_0x215611;}}else{}_0x42240c++;}this[_0x5048('0xf')](_0x5048('0x10'),_0x3ecdde);this[_0x5048('0x5')]=!![];}_0x13f70e++;}this[_0x5048('0x4')]=_0x366954;}else{while((_0x573b81=_0x366954[_0x5048('0x9')](_0x121e04))!=-0x1){_0x2fdf7e=_0x366954[_0x5048('0xa')](0x0,_0x573b81);this[_0x5048('0xf')](_0x5048('0x11'),_0x2fdf7e);_0x366954=_0x366954[_0x5048('0xa')](_0x573b81+_0x121e04[_0x5048('0xb')]);}this['_localBuffer']=_0x366954;}_0x359bfa();};module[_0x5048('0x12')]=AGIReply; \ No newline at end of file +var _0xcfaf=['line','util','call','_localBuffer','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','_inBody','indexOf','substring','length','split','slice','trim','emit'];(function(_0x3f1b16,_0x426057){var _0x25eab3=function(_0x10ca08){while(--_0x10ca08){_0x3f1b16['push'](_0x3f1b16['shift']());}};_0x25eab3(++_0x426057);}(_0xcfaf,0xef));var _0xfcfa=function(_0x46f805,_0x12a01){_0x46f805=_0x46f805-0x0;var _0x38dbd9=_0xcfaf[_0x46f805];return _0x38dbd9;};'use strict';var util=require(_0xfcfa('0x0'));var Transform=require('stream')['Transform'];function AGIReply(_0x411307){Transform[_0xfcfa('0x1')](this,_0x411307);this[_0xfcfa('0x2')]='';this['_inBody']=![];}util[_0xfcfa('0x3')](AGIReply,Transform);AGIReply[_0xfcfa('0x4')][_0xfcfa('0x5')]=function(_0xae8c73,_0x41f99e,_0x3c5daf){var _0x1e30b1='\x0a',_0x511ddd=['\x0a\x0a',_0xfcfa('0x6')],_0x10b77f=-0x1,_0x3ef6cc=-0x1,_0x26c167='',_0x284e80=0x0,_0xdfca2f='',_0x42622d='';this[_0xfcfa('0x2')]+=_0xae8c73[_0xfcfa('0x7')]();_0xdfca2f=this['_localBuffer'];if(!this[_0xfcfa('0x8')]){_0x284e80=0x0;while(_0x511ddd[_0x284e80]){while((_0x3ef6cc=_0xdfca2f[_0xfcfa('0x9')](_0x511ddd[_0x284e80]))!=-0x1){_0x26c167=_0x511ddd[_0x284e80];_0x42622d=_0xdfca2f['substring'](0x0,_0x3ef6cc);_0xdfca2f=_0xdfca2f[_0xfcfa('0xa')](_0x3ef6cc+_0x26c167[_0xfcfa('0xb')]);var _0x4c1c83=_0x42622d[_0xfcfa('0xc')](_0x1e30b1),_0x58df32=0x0,_0x5f2936={},_0x535a43='',_0x459145='',_0xf47b6f=-0x1;while(_0x4c1c83[_0x58df32]){_0xf47b6f=_0x4c1c83[_0x58df32][_0xfcfa('0x9')](':');if(_0xf47b6f!=-0x1){_0x535a43=_0x4c1c83[_0x58df32][_0xfcfa('0xd')](0x0,_0xf47b6f)[_0xfcfa('0xe')]();_0x459145=_0x4c1c83[_0x58df32]['slice'](_0xf47b6f+0x1)['trim']();if(_0x535a43[_0xfcfa('0xb')]>0x0){_0x5f2936[_0x535a43]=_0x459145;}}else{}_0x58df32++;}this[_0xfcfa('0xf')]('headers',_0x5f2936);this[_0xfcfa('0x8')]=!![];}_0x284e80++;}this[_0xfcfa('0x2')]=_0xdfca2f;}else{while((_0x10b77f=_0xdfca2f[_0xfcfa('0x9')](_0x1e30b1))!=-0x1){_0x42622d=_0xdfca2f[_0xfcfa('0xa')](0x0,_0x10b77f);this['emit'](_0xfcfa('0x10'),_0x42622d);_0xdfca2f=_0xdfca2f[_0xfcfa('0xa')](_0x10b77f+_0x1e30b1['length']);}this[_0xfcfa('0x2')]=_0xdfca2f;}_0x3c5daf();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 3e0f4a9..0f15ed9 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 _0x0962=['production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','ShowUser','GetContactByPhone','phone','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','moment','jayson/promise','client','request','then','error','message','result','getSquareProjects','GetSquareProjects','name'];(function(_0x5b14d7,_0x10b373){var _0x1eb341=function(_0x2d0955){while(--_0x2d0955){_0x5b14d7['push'](_0x5b14d7['shift']());}};_0x1eb341(++_0x10b373);}(_0x0962,0x198));var _0x2096=function(_0x476d73,_0x5b3cb6){_0x476d73=_0x476d73-0x0;var _0x27b555=_0x0962[_0x476d73];return _0x27b555;};'use strict';var _=require(_0x2096('0x0'));var moment=require(_0x2096('0x1'));var jayson=require(_0x2096('0x2'));var client=jayson[_0x2096('0x3')]['http']({'port':0x2329});function request(_0x38bed1,_0x580e85){return new Promise(function(_0x575ef5,_0x2fe7b1){return client[_0x2096('0x4')](_0x38bed1,_0x580e85)[_0x2096('0x5')](function(_0x2f00d2){if(_0x2f00d2[_0x2096('0x6')]){return _0x2fe7b1(_0x2f00d2[_0x2096('0x6')][_0x2096('0x7')]);}else{return _0x575ef5(_0x2f00d2[_0x2096('0x8')]);}})['catch'](function(_0x16799f){return _0x2fe7b1(_0x16799f);});});}exports[_0x2096('0x9')]=function(){return request(_0x2096('0xa'),{'options':{'raw':![],'attributes':['id',_0x2096('0xb'),_0x2096('0xc')]}});};exports[_0x2096('0xd')]=function(_0x442772){return request(_0x2096('0xe'),{'options':{'raw':![],'where':{'name':_0x442772},'attributes':['production']}});};exports[_0x2096('0xf')]=function(_0x14be8a){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x14be8a},'include':[{'model':_0x2096('0x10'),'as':_0x2096('0x11'),'include':[{'model':_0x2096('0x12'),'as':_0x2096('0x12')}]}],'attributes':['id',_0x2096('0xb'),'email'],'smtp':!![]}});};exports[_0x2096('0x13')]=function(_0xf4233){return request(_0x2096('0xe'),{'options':{'where':{'id':_0xf4233},'attributes':['name']}});};exports[_0x2096('0x14')]=function(_0x45b7ec){return request(_0x2096('0x15'),{'options':{'where':{'id':_0x45b7ec},'attributes':['name']}});};exports[_0x2096('0x16')]=function(_0x37dcd0){return request(_0x2096('0x17'),{'options':{'where':{'id':_0x37dcd0},'attributes':[_0x2096('0xb')]}});};exports['getSquareOdbcById']=function(_0x3ef51e){return request(_0x2096('0x18'),{'options':{'where':{'id':_0x3ef51e},'attributes':[_0x2096('0x19')]}});};exports['getUserById']=function(_0x479ba2){return request(_0x2096('0x1a'),{'options':{'where':{'id':_0x479ba2},'attributes':[_0x2096('0xb')]}});};exports['getContactByPhone']=function(_0xd7e9e0){return request(_0x2096('0x1b'),{'options':{'where':{'phone':_0xd7e9e0[_0x2096('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x2a9f62){return request('ShowTrunk',{'options':{'where':{'id':_0x2a9f62},'attributes':[_0x2096('0xb')]}});};exports[_0x2096('0x1d')]=function(_0xb1489a){return request(_0x2096('0x1e'),{'options':{'where':{'id':_0xb1489a},'attributes':[_0x2096('0x1f')]}});};exports[_0x2096('0x20')]=function(_0x2125ad){return request(_0x2096('0x21'),{'options':{'raw':![],'where':{'id':_0x2125ad},'include':[{'model':_0x2096('0x22'),'as':'Intervals'}]}});};exports[_0x2096('0x23')]=function(_0x4b74e2){return request(_0x2096('0x24'),{'options':{'where':{'id':_0x4b74e2},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x362414){return request(_0x2096('0x25'),{'body':_0x362414});};exports[_0x2096('0x26')]=function(_0xb49a24){return request(_0x2096('0x27'),{'body':_0xb49a24});};exports[_0x2096('0x28')]=function(_0x34e9de){return request(_0x2096('0x29'),{'body':_[_0x2096('0x2a')](_0x34e9de,{'project_name':_0x34e9de[_0x2096('0x2b')],'prev_project_name':_0x34e9de[_0x2096('0x2c')]||'','is_subproject':_0x34e9de[_0x2096('0x2c')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x2096('0x2d')]=function(_0x1119a1){return request(_0x2096('0x2e'),{'body':_0x1119a1});};exports[_0x2096('0x2f')]=function(_0x3c6247){return request(_0x2096('0x30'),{'body':_0x3c6247});};exports[_0x2096('0x31')]=function(_0x1e980c){return request(_0x2096('0x32'),{'options':{'raw':![],'where':{'phone':_0x1e980c['phone'],'ListId':_0x1e980c[_0x2096('0x33')]}}})[_0x2096('0x5')](function(_0x77692b){if(_0x77692b){return _0x77692b;}return request(_0x2096('0x34'),{'body':_0x1e980c});});};exports[_0x2096('0x35')]=function(_0x2464a0){return request(_0x2096('0x36'),{'options':{'where':{'id':_0x2464a0},'attributes':[_0x2096('0xb')]}});};exports['agentLogin']=function(_0x3dc95e,_0x32f260){return request('LoginUser',{'body':{'interface':_0x32f260},'options':{'where':_0x3dc95e}});};exports[_0x2096('0x37')]=function(_0x13421b,_0x31924c,_0x3cc62f){return request(_0x2096('0x38'),{'body':{'type':_0x31924c,'uniqueid':_0x3cc62f},'options':{'where':_0x13421b}});};exports[_0x2096('0x39')]=function(_0xd584c4){return request(_0x2096('0x3a'),{'body':{},'options':{'where':_0xd584c4}});};exports['agentLogout']=function(_0x3589f1){return request(_0x2096('0x3b'),{'body':{},'options':{'where':_0x3589f1}});}; \ No newline at end of file +var _0x61b8=['GetSquareProjects','name','production','ShowSquareProject','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','ShowSmsAccount','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','ListId','then','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','error','message','result','catch','getSquareProjects'];(function(_0x43cca7,_0x167394){var _0x8df5e4=function(_0x5aad00){while(--_0x5aad00){_0x43cca7['push'](_0x43cca7['shift']());}};_0x8df5e4(++_0x167394);}(_0x61b8,0x169));var _0x861b=function(_0x2e8efe,_0x30687a){_0x2e8efe=_0x2e8efe-0x0;var _0xec5586=_0x61b8[_0x2e8efe];return _0xec5586;};'use strict';var _=require(_0x861b('0x0'));var moment=require(_0x861b('0x1'));var jayson=require(_0x861b('0x2'));var client=jayson['client'][_0x861b('0x3')]({'port':0x2329});function request(_0x4e113b,_0x542fea){return new Promise(function(_0x37b79f,_0x10e70b){return client[_0x861b('0x4')](_0x4e113b,_0x542fea)['then'](function(_0x160455){if(_0x160455[_0x861b('0x5')]){return _0x10e70b(_0x160455[_0x861b('0x5')][_0x861b('0x6')]);}else{return _0x37b79f(_0x160455[_0x861b('0x7')]);}})[_0x861b('0x8')](function(_0x436722){return _0x10e70b(_0x436722);});});}exports[_0x861b('0x9')]=function(){return request(_0x861b('0xa'),{'options':{'raw':![],'attributes':['id',_0x861b('0xb'),_0x861b('0xc')]}});};exports['getSquareProject']=function(_0xdc4df8){return request(_0x861b('0xd'),{'options':{'raw':![],'where':{'name':_0xdc4df8},'attributes':[_0x861b('0xc')]}});};exports['getMailAccountById']=function(_0x1e1eec){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x1e1eec},'include':[{'model':_0x861b('0xe'),'as':_0x861b('0xf'),'include':[{'model':'CloudProvider','as':_0x861b('0x10')}]}],'attributes':['id',_0x861b('0xb'),_0x861b('0x11')],'smtp':!![]}});};exports[_0x861b('0x12')]=function(_0x202a74){return request(_0x861b('0xd'),{'options':{'where':{'id':_0x202a74},'attributes':[_0x861b('0xb')]}});};exports[_0x861b('0x13')]=function(_0x44b444){return request(_0x861b('0x14'),{'options':{'where':{'id':_0x44b444},'attributes':[_0x861b('0xb')]}});};exports[_0x861b('0x15')]=function(_0x264ba1){return request(_0x861b('0x16'),{'options':{'where':{'id':_0x264ba1},'attributes':[_0x861b('0xb')]}});};exports[_0x861b('0x17')]=function(_0x5121aa){return request(_0x861b('0x18'),{'options':{'where':{'id':_0x5121aa},'attributes':['dsn']}});};exports['getUserById']=function(_0x3d828f){return request('ShowUser',{'options':{'where':{'id':_0x3d828f},'attributes':[_0x861b('0xb')]}});};exports[_0x861b('0x19')]=function(_0x4aafa8){return request(_0x861b('0x1a'),{'options':{'where':{'phone':_0x4aafa8[_0x861b('0x1b')]},'attributes':['id']}});};exports[_0x861b('0x1c')]=function(_0x11a914){return request('ShowTrunk',{'options':{'where':{'id':_0x11a914},'attributes':['name']}});};exports[_0x861b('0x1d')]=function(_0x426a99){return request(_0x861b('0x1e'),{'options':{'where':{'id':_0x426a99},'attributes':['save_name']}});};exports[_0x861b('0x1f')]=function(_0x4dab89){return request(_0x861b('0x20'),{'options':{'raw':![],'where':{'id':_0x4dab89},'include':[{'model':_0x861b('0x21'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x474f49){return request(_0x861b('0x22'),{'options':{'where':{'id':_0x474f49},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x24aed8){return request('CreateSmsMessage',{'body':_0x24aed8});};exports['createSquareDetailsReport']=function(_0x26c7b9){return request('CreateSquareDetailsReport',{'body':_0x26c7b9});};exports['createSquareReport']=function(_0x1b0cc3){return request(_0x861b('0x23'),{'body':_[_0x861b('0x24')](_0x1b0cc3,{'project_name':_0x1b0cc3[_0x861b('0x25')],'prev_project_name':_0x1b0cc3[_0x861b('0x26')]||'','is_subproject':_0x1b0cc3[_0x861b('0x26')]?!![]:![],'leaveAt':moment()['format'](_0x861b('0x27'))})});};exports[_0x861b('0x28')]=function(_0x2d4ed8){return request(_0x861b('0x29'),{'body':_0x2d4ed8});};exports[_0x861b('0x2a')]=function(_0x27a1b5){return request('CreateSquareMessage',{'body':_0x27a1b5});};exports['createCmContact']=function(_0x3882a1){return request(_0x861b('0x2b'),{'options':{'raw':![],'where':{'phone':_0x3882a1[_0x861b('0x1b')],'ListId':_0x3882a1[_0x861b('0x2c')]}}})[_0x861b('0x2d')](function(_0x31c890){if(_0x31c890){return _0x31c890;}return request('CreateCmContact',{'body':_0x3882a1});});};exports['getPauseById']=function(_0x19ee4e){return request('ShowPause',{'options':{'where':{'id':_0x19ee4e},'attributes':[_0x861b('0xb')]}});};exports[_0x861b('0x2e')]=function(_0x35f343,_0x162102){return request(_0x861b('0x2f'),{'body':{'interface':_0x162102},'options':{'where':_0x35f343}});};exports[_0x861b('0x30')]=function(_0x3d8f60,_0x39f1be,_0x4f17c1){return request('PauseUser',{'body':{'type':_0x39f1be,'uniqueid':_0x4f17c1},'options':{'where':_0x3d8f60}});};exports[_0x861b('0x31')]=function(_0x53b215){return request(_0x861b('0x32'),{'body':{},'options':{'where':_0x53b215}});};exports[_0x861b('0x33')]=function(_0x50e5d8){return request(_0x861b('0x34'),{'body':{},'options':{'where':_0x50e5d8}});}; \ 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 324b155..ad6b41c 100644 --- a/server/services/agi/scripts/aws/index.js +++ b/server/services/agi/scripts/aws/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb89c=['./polly','./lex','exports'];(function(_0x43db26,_0x1a516f){var _0xc63f8e=function(_0x5d9ad8){while(--_0x5d9ad8){_0x43db26['push'](_0x43db26['shift']());}};_0xc63f8e(++_0x1a516f);}(_0xb89c,0x198));var _0xcb89=function(_0x4c959f,_0x4d86e8){_0x4c959f=_0x4c959f-0x0;var _0x51e40d=_0xb89c[_0x4c959f];return _0x51e40d;};var polly=require(_0xcb89('0x0'));var lex=require(_0xcb89('0x1'));module[_0xcb89('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x3f27=['./lex','exports','./polly'];(function(_0x414655,_0x79d916){var _0x237884=function(_0x2737d9){while(--_0x2737d9){_0x414655['push'](_0x414655['shift']());}};_0x237884(++_0x79d916);}(_0x3f27,0x1f4));var _0x73f2=function(_0x16e78d,_0x3175e5){_0x16e78d=_0x16e78d-0x0;var _0x8e91aa=_0x3f27[_0x16e78d];return _0x8e91aa;};var polly=require(_0x73f2('0x0'));var lex=require(_0x73f2('0x1'));module[_0x73f2('0x2')]={'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 b41830c..74558f2 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 _0x91a7=['exports'];(function(_0x11fc8b,_0x4ee51d){var _0x4ea86e=function(_0x50e5bf){while(--_0x50e5bf){_0x11fc8b['push'](_0x11fc8b['shift']());}};_0x4ea86e(++_0x4ee51d);}(_0x91a7,0xe7));var _0x791a=function(_0x1f529d,_0x18308c){_0x1f529d=_0x1f529d-0x0;var _0x4e5197=_0x91a7[_0x1f529d];return _0x4e5197;};'use strict';var lex=require('./lib/api');module[_0x791a('0x0')]=function(_0x3d6eab,_0x268862,_0x5d2796,_0x415994,_0x5b6f78,_0x2f6392){return lex(_0x3d6eab,_0x268862,_0x5d2796,_0x415994,_0x5b6f78,_0x2f6392);}; \ No newline at end of file +var _0x750a=['exports'];(function(_0x2b0f88,_0x53d553){var _0xb5e6ef=function(_0x2e8e19){while(--_0x2e8e19){_0x2b0f88['push'](_0x2b0f88['shift']());}};_0xb5e6ef(++_0x53d553);}(_0x750a,0x140));var _0xa750=function(_0xa95722,_0x1023b0){_0xa95722=_0xa95722-0x0;var _0x5351ae=_0x750a[_0xa95722];return _0x5351ae;};'use strict';var lex=require('./lib/api');module[_0xa750('0x0')]=function(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f){return lex(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f);}; \ 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 71ad614..95deafb 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(_0x2a11c7,_0x478b99){var _0x51a503=function(_0x2fd4ba){while(--_0x2fd4ba){_0x2a11c7['push'](_0x2a11c7['shift']());}};_0x51a503(++_0x478b99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x4fec1e,_0x44bbaa){var _0x566d20=function(_0x1e25ae){while(--_0x1e25ae){_0x4fec1e['push'](_0x4fec1e['shift']());}};_0x566d20(++_0x44bbaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 e6e5e6a..c9f1987 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 _0x96f2=['./lib/api'];(function(_0x137ead,_0x5c100b){var _0x982a69=function(_0x248212){while(--_0x248212){_0x137ead['push'](_0x137ead['shift']());}};_0x982a69(++_0x5c100b);}(_0x96f2,0x188));var _0x296f=function(_0x1bad20,_0x38e6c0){_0x1bad20=_0x1bad20-0x0;var _0x1c0d76=_0x96f2[_0x1bad20];return _0x1c0d76;};'use strict';var polly=require(_0x296f('0x0'));module['exports']=function(_0x4ca9cd,_0xaf5f7,_0x575eb0,_0xb7c10e,_0x453f78,_0x3358e0,_0x71a3ca){return polly(_0x4ca9cd,_0xaf5f7,_0x575eb0,_0xb7c10e,_0x453f78,_0x3358e0,_0x71a3ca);}; \ No newline at end of file +var _0xf66d=['exports'];(function(_0x249b69,_0x3edb9b){var _0xed236b=function(_0xb3506c){while(--_0xb3506c){_0x249b69['push'](_0x249b69['shift']());}};_0xed236b(++_0x3edb9b);}(_0xf66d,0x103));var _0xdf66=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xf66d[_0x298ed3];return _0x5aad28;};'use strict';var polly=require('./lib/api');module[_0xdf66('0x0')]=function(_0x36c1a3,_0x56db7a,_0x382f94,_0x5bfbc9,_0x4a7eec,_0x4c600c,_0x484fdc){return polly(_0x36c1a3,_0x56db7a,_0x382f94,_0x5bfbc9,_0x4a7eec,_0x4c600c,_0x484fdc);}; \ 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 a6d95aa..d00a688 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 _0x6e8e=['mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x579b34,_0x1b5aaa){var _0x1b309c=function(_0x5c62e2){while(--_0x5c62e2){_0x579b34['push'](_0x579b34['shift']());}};_0x1b309c(++_0x1b5aaa);}(_0x6e8e,0xa6));var _0xe6e8=function(_0x45d6e7,_0x22f98e){_0x45d6e7=_0x45d6e7-0x0;var _0x4df088=_0x6e8e[_0x45d6e7];return _0x4df088;};'use strict';var fs=require('fs');var path=require(_0xe6e8('0x0'));var BPromise=require(_0xe6e8('0x1'));var rs=require(_0xe6e8('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x11ef32,_0x19e0eb,_0x3e436b){return new BPromise(function(_0x563ac4,_0x3f0f71){_0x11ef32[_0xe6e8('0x3')](_0x19e0eb,function(_0x5052d8,_0x1d468b){if(_0x5052d8){_0x3f0f71(_0x5052d8);}else if(_0x1d468b){if(_0x1d468b[_0xe6e8('0x4')]instanceof Buffer){fs[_0xe6e8('0x5')](_0x3e436b,_0x1d468b[_0xe6e8('0x4')],function(_0x3505d2){if(_0x3505d2){_0x3f0f71(_0x3505d2);}else{_0x563ac4();}});}else{_0x3f0f71(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x3f0f71(new Error(_0xe6e8('0x6')));}});});}module[_0xe6e8('0x7')]=function(_0x357d6a,_0x40599f,_0x38319a,_0x2c0a0c,_0x1ffc96,_0x1f1a3f,_0x18ca27){var _0x168844=new AWS[(_0xe6e8('0x8'))]({'accessKeyId':_0x357d6a,'secretAccessKey':_0x40599f,'region':_0x38319a});var _0x23949b={'Text':_0x1ffc96,'TextType':_0x1f1a3f||_0xe6e8('0x9'),'OutputFormat':_0xe6e8('0xa'),'VoiceId':_0x2c0a0c};return pollyResult(_0x168844,_0x23949b,_0x18ca27);}; \ No newline at end of file +var _0x67c9=['Polly','text','mp3','bluebird','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x1eca20,_0x29506f){var _0x1e3c2b=function(_0x55587a){while(--_0x55587a){_0x1eca20['push'](_0x1eca20['shift']());}};_0x1e3c2b(++_0x29506f);}(_0x67c9,0xdb));var _0x967c=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x67c9[_0x38b14f];return _0x22a324;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x967c('0x0'));var rs=require(_0x967c('0x1'));var AWS=require(_0x967c('0x2'));function pollyResult(_0x2c3b39,_0x192500,_0xe424a9){return new BPromise(function(_0x517e01,_0x195c2c){_0x2c3b39['synthesizeSpeech'](_0x192500,function(_0x410142,_0x310511){if(_0x410142){_0x195c2c(_0x410142);}else if(_0x310511){if(_0x310511[_0x967c('0x3')]instanceof Buffer){fs[_0x967c('0x4')](_0xe424a9,_0x310511[_0x967c('0x3')],function(_0x3cb1cc){if(_0x3cb1cc){_0x195c2c(_0x3cb1cc);}else{_0x517e01();}});}else{_0x195c2c(new Error(_0x967c('0x5')));}}else{_0x195c2c(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x582633,_0x358f0f,_0x1eda12,_0x57fc08,_0x48c63b,_0x54f0d3,_0x2b0fa2){var _0x351113=new AWS[(_0x967c('0x6'))]({'accessKeyId':_0x582633,'secretAccessKey':_0x358f0f,'region':_0x1eda12});var _0x375151={'Text':_0x48c63b,'TextType':_0x54f0d3||_0x967c('0x7'),'OutputFormat':_0x967c('0x8'),'VoiceId':_0x57fc08};return pollyResult(_0x351113,_0x375151,_0x2b0fa2);}; \ 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 a5029b0..5fdcbcc 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 _0xdf20=['exports','./lib/api'];(function(_0x38eeb9,_0x468d0c){var _0x51281a=function(_0x5ca2c1){while(--_0x5ca2c1){_0x38eeb9['push'](_0x38eeb9['shift']());}};_0x51281a(++_0x468d0c);}(_0xdf20,0x12f));var _0x0df2=function(_0x5bb8e4,_0x315620){_0x5bb8e4=_0x5bb8e4-0x0;var _0x3330e8=_0xdf20[_0x5bb8e4];return _0x3330e8;};'use strict';var asr=require(_0x0df2('0x0'));module[_0x0df2('0x1')]=function(_0x49470a,_0x439687,_0x4bf69e,_0x49990d){return asr(_0x49470a,_0x439687,_0x4bf69e);}; \ No newline at end of file +var _0x4691=['./lib/api'];(function(_0x46aea1,_0x5e48ea){var _0x810497=function(_0x25ad6d){while(--_0x25ad6d){_0x46aea1['push'](_0x46aea1['shift']());}};_0x810497(++_0x5e48ea);}(_0x4691,0xae));var _0x1469=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x4691[_0x8c43de];return _0xa6591b;};'use strict';var asr=require(_0x1469('0x0'));module['exports']=function(_0x4aab5a,_0x54944e,_0x50eec8,_0x4d8308){return asr(_0x4aab5a,_0x54944e,_0x50eec8);}; \ 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 36769d3..d6b6fba 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 _0x44a3=['toString','base64','POST','/v1/speech:recognize?key=','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x4deb98,_0x29ebdd){var _0x2c5f93=function(_0x3bdb80){while(--_0x3bdb80){_0x4deb98['push'](_0x4deb98['shift']());}};_0x2c5f93(++_0x29ebdd);}(_0x44a3,0x1a9));var _0x344a=function(_0x10aa73,_0xc744f4){_0x10aa73=_0x10aa73-0x0;var _0x3496d9=_0x44a3[_0x10aa73];return _0x3496d9;};'use strict';var url=require(_0x344a('0x0'));var BPromise=require(_0x344a('0x1'));var fs=require('fs');var host=_0x344a('0x2');module[_0x344a('0x3')]=function(_0xdffe0b,_0x42b3a6,_0x3bb844){return new BPromise(function(_0x212a39,_0x528a13){var _0x23004c;if(typeof _0xdffe0b!==_0x344a('0x4')||_0xdffe0b[_0x344a('0x5')]===0x0){return _0x528a13(_0x344a('0x6'));}if(typeof _0x42b3a6!==_0x344a('0x4')||_0x42b3a6['length']===0x0){return _0x528a13('key\x20should\x20be\x20a\x20string');}if(typeof _0x3bb844!=='undefined'&&(typeof _0x3bb844!=='string'||_0x3bb844[_0x344a('0x5')]===0x0)){return _0x528a13(_0x344a('0x7'));}try{_0x23004c=fs[_0x344a('0x8')](_0xdffe0b)[_0x344a('0x9')](_0x344a('0xa'));}catch(_0x54288d){return _0x528a13(_0x54288d);}return _0x212a39({'method':_0x344a('0xb'),'uri':host+_0x344a('0xc')+_0x42b3a6,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x344a('0xd'),'languageCode':_0x3bb844},'audio':{'content':_0x23004c}},'json':!![]});});}; \ No newline at end of file +var _0x1e69=['POST','/v1/speech:recognize?key=','8000','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64'];(function(_0x5c1fdc,_0x4904ee){var _0x476d9c=function(_0x1fde51){while(--_0x1fde51){_0x5c1fdc['push'](_0x5c1fdc['shift']());}};_0x476d9c(++_0x4904ee);}(_0x1e69,0x85));var _0x91e6=function(_0x1d16fc,_0xe56c15){_0x1d16fc=_0x1d16fc-0x0;var _0x2c84bc=_0x1e69[_0x1d16fc];return _0x2c84bc;};'use strict';var url=require('url');var BPromise=require(_0x91e6('0x0'));var fs=require('fs');var host=_0x91e6('0x1');module[_0x91e6('0x2')]=function(_0x3a523e,_0x4f5881,_0x537c0e){return new BPromise(function(_0x192f10,_0x351c1d){var _0x2b53b6;if(typeof _0x3a523e!==_0x91e6('0x3')||_0x3a523e[_0x91e6('0x4')]===0x0){return _0x351c1d(_0x91e6('0x5'));}if(typeof _0x4f5881!==_0x91e6('0x3')||_0x4f5881[_0x91e6('0x4')]===0x0){return _0x351c1d(_0x91e6('0x6'));}if(typeof _0x537c0e!==_0x91e6('0x7')&&(typeof _0x537c0e!==_0x91e6('0x3')||_0x537c0e[_0x91e6('0x4')]===0x0)){return _0x351c1d(_0x91e6('0x8'));}try{_0x2b53b6=fs['readFileSync'](_0x3a523e)['toString'](_0x91e6('0x9'));}catch(_0x260c4d){return _0x351c1d(_0x260c4d);}return _0x192f10({'method':_0x91e6('0xa'),'uri':host+_0x91e6('0xb')+_0x4f5881,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x91e6('0xc'),'languageCode':_0x537c0e},'audio':{'content':_0x2b53b6}},'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 4878001..a132b0a 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 _0xf366=['exports','./asr'];(function(_0x93942f,_0xb48547){var _0x23fcd8=function(_0x4728be){while(--_0x4728be){_0x93942f['push'](_0x93942f['shift']());}};_0x23fcd8(++_0xb48547);}(_0xf366,0x1c7));var _0x6f36=function(_0x380c21,_0x25991a){_0x380c21=_0x380c21-0x0;var _0xac040e=_0xf366[_0x380c21];return _0xac040e;};var asr=require(_0x6f36('0x0'));module[_0x6f36('0x1')]={'asr':asr}; \ No newline at end of file +var _0xd8fe=['./asr','exports'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xd8fe,0x19c));var _0xed8f=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0xd8fe[_0x2f71f6];return _0x2b23ea;};var asr=require(_0xed8f('0x0'));module[_0xed8f('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 0659501..62a4165 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 _0xef0f=['transcript','results','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','displayName','languageCode','responseId','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','awsLex','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','md5','path','querystring','request-promise','randomstring','sox','url','parse','util','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','unlink','download\x20error','data','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','text:synthesize','POST','then','.mp3','writeFile','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','null','generic','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','map','alternatives'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xef0f,0x154));var _0xfef0=function(_0x179faf,_0xd988a4){_0x179faf=_0x179faf-0x0;var _0x1c2e51=_0xef0f[_0x179faf];return _0x1c2e51;};'use strict';var apiai=require(_0xfef0('0x0'));var BPromise=require(_0xfef0('0x1'));var dialogflow=require(_0xfef0('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0xfef0('0x3'));var path=require(_0xfef0('0x4'));var querystring=require(_0xfef0('0x5'));var rp=require(_0xfef0('0x6'));var rs=require(_0xfef0('0x7'));var sox=require(_0xfef0('0x8'));var tts=require('google-tts-api');var urlParse=require(_0xfef0('0x9'))[_0xfef0('0xa')];var util=require(_0xfef0('0xb'));var aws=require('./aws');var google=require(_0xfef0('0xc'));var sestek=require('./sestek');var tilde=require(_0xfef0('0xd'));var logger=require(_0xfef0('0xe'))(_0xfef0('0xf'));var ISPEECH_API=_0xfef0('0x10');function downloadFile(_0x1e4ca5,_0x3284c4){return new BPromise(function(_0x461639,_0x34d5b0){var _0x6f1e32=urlParse(_0x1e4ca5);var _0x3d4ee5=_0x6f1e32[_0xfef0('0x11')]===_0xfef0('0x12')?https:http;var _0x258cb3={'host':_0x6f1e32[_0xfef0('0x13')],'path':_0x6f1e32[_0xfef0('0x4')],'headers':{'user-agent':_0xfef0('0x14')}};_0x3d4ee5[_0xfef0('0x15')](_0x258cb3,function(_0x357819){if(_0x357819[_0xfef0('0x16')]!==0xc8){logger[_0xfef0('0x17')](_0xfef0('0x18')+_0x1e4ca5+_0xfef0('0x19')+_0x357819[_0xfef0('0x16')]+'\x20('+_0x357819[_0xfef0('0x1a')]+')');_0x34d5b0(new Error('request\x20to\x20'+_0x1e4ca5+'\x20failed,\x20status\x20code\x20=\x20'+_0x357819[_0xfef0('0x16')]+'\x20('+_0x357819['statusMessage']+')'));return;}var _0x4c3c1a=fs[_0xfef0('0x1b')](_0x3284c4);_0x4c3c1a['on']('finish',function(){logger[_0xfef0('0x1c')](_0xfef0('0x1d'));_0x4c3c1a['close'](_0x461639);});_0x4c3c1a['on']('error',function(_0x24c8b9){fs[_0xfef0('0x1e')](_0x3284c4);logger[_0xfef0('0x17')](_0xfef0('0x1f'),_0x24c8b9);_0x34d5b0(_0x24c8b9);});_0x357819['pipe'](_0x4c3c1a);})['on']('error',function(_0x36c597){logger[_0xfef0('0x17')](_0x36c597);_0x34d5b0(_0x36c597);})['end']();});}function uploadFile(_0x404294){return new BPromise(function(_0x40311e,_0x3c71b7){var _0x599543=urlParse(_0x404294);var _0x4d0a5e=_0x599543[_0xfef0('0x11')]===_0xfef0('0x12')?https:http;var _0x331334={'host':_0x599543[_0xfef0('0x13')],'path':_0x599543[_0xfef0('0x4')],'headers':{'user-agent':_0xfef0('0x14')}};_0x4d0a5e['get'](_0x331334,function(_0xae1d65){if(_0xae1d65[_0xfef0('0x16')]!==0xc8){_0x3c71b7(new Error('request\x20to\x20'+_0x404294+_0xfef0('0x19')+_0xae1d65[_0xfef0('0x16')]+'\x20('+_0xae1d65[_0xfef0('0x1a')]+')'));return;}var _0x4b5f9='';_0xae1d65['on'](_0xfef0('0x20'),function(_0x4225c2){_0x4b5f9+=_0x4225c2;});_0xae1d65['on'](_0xfef0('0x21'),function(){_0x40311e(_0x4b5f9);});})['on'](_0xfef0('0x17'),function(_0x17a3c6){_0x3c71b7(_0x17a3c6);})['end']();});}function convertFile(_0x312e71,_0x98690b){return new BPromise(function(_0x13fd29,_0x5a216a){var _0x135f5b=sox[_0xfef0('0x22')](_0x312e71,_0x98690b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x135f5b['on']('error',function(_0x5adf87){logger[_0xfef0('0x17')](_0xfef0('0x23'),_0x5adf87);_0x5a216a(_0x5adf87);});_0x135f5b['on'](_0xfef0('0x21'),function(){logger[_0xfef0('0x1c')](_0xfef0('0x24'));_0x13fd29();});_0x135f5b[_0xfef0('0x25')]();});}function base64Decode(_0x42ec94,_0xbd7bb4){var _0x34f8bc=path[_0xfef0('0x26')](__dirname,_0xfef0('0x27'),rs[_0xfef0('0x28')](0x4)+_0xfef0('0x29'));fs[_0xfef0('0x2a')](_0x34f8bc,_0x42ec94,_0xfef0('0x2b'));return convertFile(_0x34f8bc,_0xbd7bb4)['then'](function(){try{fs[_0xfef0('0x1e')](_0x34f8bc);fs[_0xfef0('0x2c')](_0xbd7bb4,_0xfef0('0x2d'));}catch(_0x37854b){logger[_0xfef0('0x17')](_0x37854b);}return _0xbd7bb4[_0xfef0('0x2e')]('.')[0x0];});}function base64Encode(_0x30b92e){var _0x424630=fs[_0xfef0('0x2f')](_0x30b92e);return new Buffer(_0x424630)['toString'](_0xfef0('0x2b'));}exports[_0xfef0('0x30')]=function(_0x36b83d,_0x3e65a3,_0x336a48,_0x1ef9f7,_0x497c23,_0x23c141){var _0x2cd822,_0x51ff2e;var _0x5e15e1=_0xfef0('0x31');var _0x2d5a20=_0xfef0('0x32')+_0x36b83d;var _0x15cc65={};if(_0x3e65a3===_0xfef0('0x33')){_0x15cc65[_0xfef0('0x34')]={'ssml':_0x336a48};}else{_0x15cc65[_0xfef0('0x34')]={'text':_0x336a48};};_0x15cc65['voice']={'languageCode':_0x1ef9f7,'ssmlGender':_0x497c23};_0x15cc65['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x1defbe={'url':_0x5e15e1+_0xfef0('0x35')+_0x2d5a20,'method':_0xfef0('0x36'),'json':!![],'body':_0x15cc65};return rp(_0x1defbe)[_0xfef0('0x37')](function(_0x461cd4){return new BPromise(function(_0x46dc1c,_0x4452a2){_0x2cd822=path[_0xfef0('0x26')](__dirname,_0xfef0('0x27'),rs[_0xfef0('0x28')](0x4)+_0xfef0('0x38'));var _0x3e9d13=Buffer['from'](_0x461cd4['audioContent'],_0xfef0('0x2b'));return fs[_0xfef0('0x39')](_0x2cd822,_0x3e9d13,function(_0x35e8ff){_0x4452a2(_0x35e8ff);},function(_0x18fbdb){fs[_0xfef0('0x2c')](_0x2cd822,_0xfef0('0x2d'));_0x46dc1c(_0x18fbdb);});});})[_0xfef0('0x37')](function(_0x50d5d0){_0x51ff2e=path[_0xfef0('0x26')](__dirname,_0xfef0('0x27'),rs[_0xfef0('0x28')](0x4)+_0xfef0('0x29'));return convertFile(_0x2cd822,_0x51ff2e);})[_0xfef0('0x37')](function(){try{fs[_0xfef0('0x1e')](_0x2cd822);fs[_0xfef0('0x2c')](_0x51ff2e,'777');}catch(_0x44bfc5){logger[_0xfef0('0x17')](_0x44bfc5);}logger['info']('googleCloudTTS\x20path',_0x51ff2e['split']('.')[0x0]);return _0x51ff2e[_0xfef0('0x2e')]('.')[0x0];});};exports['googleTTS']=function(_0x3a407e,_0x25a7b5){var _0x1bc3a2=_0xfef0('0x3a');var _0x550ab6,_0x5930f0;var _0x51216d;var _0x196205={'encoding':_0xfef0('0x3b'),'method':_0xfef0('0x36'),'timeout':0x2710,'url':_0x1bc3a2,'headers':{'Content-Type':_0xfef0('0x3c')},'body':_0xfef0('0x3d')+encodeURIComponent(JSON['stringify']([[[_0xfef0('0x3e'),JSON[_0xfef0('0x3f')]([_0x3a407e,_0x25a7b5||'en',![],_0xfef0('0x40')]),null,_0xfef0('0x41')]]]))};return rp(_0x196205)[_0xfef0('0x37')](function(_0x25a1d8){try{_0x51216d=eval(_0x25a1d8['slice'](0x5))[0x0][0x2];}catch(_0x145d1){throw new Error('parse\x20response\x20failed:\x0a'+_0x25a1d8[_0xfef0('0x20')]);}if(!_0x51216d){if(_0x3a407e[_0xfef0('0x42')]>0xc8){throw new Error(_0xfef0('0x43'));}else{throw new Error(_0xfef0('0x44')+_0x25a7b5+_0xfef0('0x45'));}}try{_0x51216d=eval(_0x51216d)[0x0];}catch(_0x3954ae){throw new Error(_0xfef0('0x46')+res[_0xfef0('0x20')]);}const _0x4b41ad=_0x51216d;_0x550ab6=path['resolve'](__dirname,_0xfef0('0x27'),rs[_0xfef0('0x28')](0x4)+_0xfef0('0x38'));fs[_0xfef0('0x2a')](_0x550ab6,_0x51216d,{'encoding':'base64'});_0x5930f0=path[_0xfef0('0x26')](__dirname,'tmp',rs[_0xfef0('0x28')](0x4)+_0xfef0('0x29'));return convertFile(_0x550ab6,_0x5930f0);})[_0xfef0('0x37')](function(){try{fs['unlink'](_0x550ab6);fs[_0xfef0('0x2c')](_0x5930f0,_0xfef0('0x2d'));}catch(_0x9ddaa0){logger['error'](_0x9ddaa0);}logger[_0xfef0('0x1c')](_0xfef0('0x47'),_0x5930f0['split']('.')[0x0]);return _0x5930f0[_0xfef0('0x2e')]('.')[0x0];});};exports[_0xfef0('0x48')]=function(_0x3ff673,_0x3b4d2f,_0x319a5d){return google[_0xfef0('0x49')](_0x3ff673,_0x3b4d2f,_0x319a5d)[_0xfef0('0x37')](function(_0x169bae){logger[_0xfef0('0x1c')](_0x169bae[_0xfef0('0x4a')]);return rp(_0x169bae);})['then'](function(_0x4b1602){var _0x25db81='';var _0x102dd0=0x0;try{fs['unlink'](_0x3ff673);}catch(_0x1114af){logger[_0xfef0('0x17')](_0x1114af);}if(_0x4b1602&&_0x4b1602['results']){_0x25db81=_0x4b1602['results'][_0xfef0('0x4b')](function(_0x13cde7){return _0x13cde7&&_0x13cde7[_0xfef0('0x4c')][0x0]&&_0x13cde7[_0xfef0('0x4c')][0x0]['transcript']?_0x13cde7['alternatives'][0x0][_0xfef0('0x4d')]:'';})['join']('\x0a');_0x102dd0=_0x4b1602[_0xfef0('0x4e')]['map'](function(_0x164c40){return _0x164c40&&_0x164c40['alternatives'][0x0]&&_0x164c40[_0xfef0('0x4c')][0x0][_0xfef0('0x4f')]?_0x164c40[_0xfef0('0x4c')][0x0][_0xfef0('0x4f')]:0x0;})[_0xfef0('0x50')]('\x0a');}logger['info'](_0xfef0('0x51'),_0x25db81);logger['info'](_0xfef0('0x52'),_0x102dd0);return{'transcript':_0x25db81,'confidence':_0x102dd0};})[_0xfef0('0x53')](function(_0x1e2b80){logger[_0xfef0('0x17')](_0xfef0('0x54'),_0x1e2b80[_0xfef0('0x16')],_0x1e2b80[_0xfef0('0x55')],_0x1e2b80[_0xfef0('0x56')]);});};exports[_0xfef0('0x57')]=function(_0x35f533,_0x44bac7,_0x6298cb,_0x248e11){var _0x58ce30=apiai(_0x44bac7,{'language':_0x248e11||'en'});return _0x58ce30[_0xfef0('0x58')](_0x6298cb,{'sessionId':md5(_0x35f533)})[_0xfef0('0x37')](function(_0x2b6556){logger[_0xfef0('0x1c')](JSON[_0xfef0('0x3f')](_0x2b6556));return{'source':_0x2b6556[_0xfef0('0x59')][_0xfef0('0x5a')],'resolvedQuery':_0x2b6556['result'][_0xfef0('0x5b')],'action':_0x2b6556[_0xfef0('0x59')][_0xfef0('0x5c')],'actionIncomplete':_0x2b6556[_0xfef0('0x59')][_0xfef0('0x5d')],'speech':_0x2b6556[_0xfef0('0x59')][_0xfef0('0x5e')][_0xfef0('0x5f')],'score':_0x2b6556['result'][_0xfef0('0x60')],'statusCode':_0x2b6556[_0xfef0('0x61')][_0xfef0('0x62')],'endConversation':_0x2b6556[_0xfef0('0x59')][_0xfef0('0x63')][_0xfef0('0x64')]||![],'isFallbackIntent':_0x2b6556[_0xfef0('0x59')]['metadata'][_0xfef0('0x65')]};});};exports[_0xfef0('0x66')]=function(_0x18edd5,_0x49a132,_0x292399,_0x455475,_0x477bbf,_0x5ba00c){var _0x48e968=_0x455475[_0xfef0('0x67')](/\\n/g,'\x0a');var _0x162388={'credentials':{'private_key':_0x48e968,'client_email':_0x292399}};var _0x2e277f=new dialogflow[(_0xfef0('0x68'))](_0x162388);var _0x20c5a0=_0x2e277f[_0xfef0('0x69')](_0x49a132,md5(_0x18edd5));var _0x2e6cae={'session':_0x20c5a0,'queryInput':{'text':{'text':_0x477bbf,'languageCode':_0x5ba00c}}};return _0x2e277f[_0xfef0('0x6a')](_0x2e6cae)[_0xfef0('0x37')](function(_0x15ecc4){if(_0x15ecc4&&_0x15ecc4[_0xfef0('0x42')]){logger[_0xfef0('0x1c')](_0xfef0('0x6b'),JSON[_0xfef0('0x3f')](_0x15ecc4));var _0x2a35ff=_0x15ecc4[0x0];if(_0x2a35ff){var _0x360558={'action':_0x2a35ff['queryResult']['action'],'allRequiredParamsPresent':_0x2a35ff[_0xfef0('0x6c')][_0xfef0('0x6d')],'endConversation':_0x2a35ff[_0xfef0('0x6c')][_0xfef0('0x6e')]&&_0x2a35ff['queryResult']['diagnosticInfo'][_0xfef0('0x6f')]?_0x2a35ff[_0xfef0('0x6c')]['diagnosticInfo'][_0xfef0('0x6f')][_0xfef0('0x70')]['boolValue']:![],'fulfillmentText':_0x2a35ff[_0xfef0('0x6c')]['fulfillmentText'],'intentName':_0x2a35ff[_0xfef0('0x6c')][_0xfef0('0x71')]['name'],'intentDisplayName':_0x2a35ff[_0xfef0('0x6c')][_0xfef0('0x71')][_0xfef0('0x72')],'isFallbackIntent':_0x2a35ff[_0xfef0('0x6c')][_0xfef0('0x71')]['isFallback'],'languageCode':_0x2a35ff[_0xfef0('0x6c')][_0xfef0('0x73')],'queryText':_0x2a35ff['queryResult']['queryText'],'responseId':_0x2a35ff[_0xfef0('0x74')],'score':_0x2a35ff[_0xfef0('0x6c')][_0xfef0('0x75')],'speech':_0x2a35ff[_0xfef0('0x6c')][_0xfef0('0x76')],'providerResponse':JSON[_0xfef0('0x3f')](_0x15ecc4)};return _0x360558;}}});};exports[_0xfef0('0x77')]=function(_0x1421aa,_0x10f960,_0x31bf1e,_0x39e499){return tilde['asr'](_0x1421aa,_0x10f960,_0x31bf1e,_0x39e499)['then'](function(_0x4749f9){try{fs['unlink'](_0x1421aa);}catch(_0x43414b){logger['error'](_0x43414b);}logger[_0xfef0('0x1c')](_0xfef0('0x78'),_0x4749f9[_0xfef0('0x4d')]);logger[_0xfef0('0x1c')]('Tilde\x20ASR\x20confidence',_0x4749f9[_0xfef0('0x4f')]);return _0x4749f9;});};exports[_0xfef0('0x79')]=function(_0x150b1a,_0xd9b992,_0x787771,_0x49cd95,_0x1208c9,_0x463a86){var _0x34245a=path[_0xfef0('0x26')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x297757;return aws['polly'](_0x150b1a,_0xd9b992,_0x787771,_0x49cd95,_0x1208c9,_0x463a86,_0x34245a)[_0xfef0('0x37')](function(){_0x297757=path[_0xfef0('0x26')](__dirname,'tmp',rs[_0xfef0('0x28')](0x4)+_0xfef0('0x29'));return convertFile(_0x34245a,_0x297757);})[_0xfef0('0x37')](function(){try{fs[_0xfef0('0x1e')](_0x34245a);fs[_0xfef0('0x2c')](_0x297757,'777');}catch(_0x8c1052){logger[_0xfef0('0x17')](_0x8c1052);}return _0x297757[_0xfef0('0x2e')]('.')[0x0];});};exports[_0xfef0('0x7a')]=function(_0x60032c,_0x19d91b,_0x286bf2,_0x1665b8,_0x18f3b8,_0x112ac9){return aws[_0xfef0('0x7b')](_0x60032c,_0x19d91b,_0x286bf2,_0x1665b8,_0x18f3b8,_0x112ac9)[_0xfef0('0x37')](function(_0x45384e){logger[_0xfef0('0x1c')](JSON['stringify'](_0x45384e));return _0x45384e;});};exports[_0xfef0('0x7c')]=function(_0x4c4c1a,_0x517e18,_0x18b42c,_0x21f06c){var _0xf60b86=util[_0xfef0('0x7d')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4c4c1a,encodeURIComponent(_0x517e18),_0x18b42c,_0x21f06c);var _0x55c83c=path['resolve'](__dirname,_0xfef0('0x27'),rs[_0xfef0('0x28')](0x4)+'.mp3');var _0x59cab6;return downloadFile(_0xf60b86,_0x55c83c)[_0xfef0('0x37')](function(){_0x59cab6=path['resolve'](__dirname,_0xfef0('0x27'),rs[_0xfef0('0x28')](0x4)+'.wav');return convertFile(_0x55c83c,_0x59cab6);})['then'](function(){try{fs[_0xfef0('0x1e')](_0x55c83c);fs['chmodSync'](_0x59cab6,'777');}catch(_0x337510){logger[_0xfef0('0x17')](_0x337510);}return _0x59cab6[_0xfef0('0x2e')]('.')[0x0];});};exports[_0xfef0('0x7e')]=function(_0x1e180f,_0x15ccae,_0x110e58,_0x173671){var _0xfecb8f=util['format'](_0xfef0('0x7f'),ISPEECH_API,_0x15ccae,_0x110e58,base64Encode(_0x1e180f),_0x173671?util['format'](_0xfef0('0x80'),encodeURIComponent(_0x173671)):_0xfef0('0x81'));return uploadFile(_0xfecb8f)[_0xfef0('0x37')](function(_0x268a29){return querystring['parse'](_0x268a29);});};exports[_0xfef0('0x82')]=function(_0x218115,_0xbd1896){return sestek[_0xfef0('0x83')](_0x218115,_0xbd1896)[_0xfef0('0x37')](function(_0x277335){logger[_0xfef0('0x1c')](JSON['stringify'](_0x277335));var _0x1d114a={'speech':_0x277335[_0xfef0('0x84')],'action':_0x277335[_0xfef0('0x85')]?_0x277335[_0xfef0('0x85')][_0xfef0('0x86')]:undefined,'actiondata':_0x277335[_0xfef0('0x85')]?_0x277335[_0xfef0('0x85')][_0xfef0('0x87')]:undefined};if(_0x277335[_0xfef0('0x85')]&&_0x277335[_0xfef0('0x85')]['AudioFromTts']){return base64Decode(_0x277335[_0xfef0('0x85')][_0xfef0('0x88')][_0xfef0('0x89')],path[_0xfef0('0x26')](__dirname,'tmp',rs[_0xfef0('0x28')](0x4)+_0xfef0('0x29')))[_0xfef0('0x37')](function(_0x47ea91){_0x1d114a['audiofile']=_0x47ea91;return _0x1d114a;});}return _0x1d114a;});};exports[_0xfef0('0x8a')]=function(){return __dirname;}; \ No newline at end of file +var _0x954c=['google-tts-api','url','parse','util','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','error','request\x20to\x20','statusMessage','statusCode','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','pipe','get','\x20failed,\x20status\x20code\x20=\x20','data','end','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','name','message','googleDialogflow','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','sessionPath','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','languageCode','queryText','intentDetectionConfidence','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','https','md5','querystring','request-promise','randomstring'];(function(_0x150ef5,_0x3a3644){var _0x3b9b88=function(_0x3640e6){while(--_0x3640e6){_0x150ef5['push'](_0x150ef5['shift']());}};_0x3b9b88(++_0x3a3644);}(_0x954c,0x19c));var _0xc954=function(_0x47fa07,_0x1b5de8){_0x47fa07=_0x47fa07-0x0;var _0x2c2a05=_0x954c[_0x47fa07];return _0x2c2a05;};'use strict';var apiai=require(_0xc954('0x0'));var BPromise=require(_0xc954('0x1'));var dialogflow=require(_0xc954('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xc954('0x3'));var md5=require(_0xc954('0x4'));var path=require('path');var querystring=require(_0xc954('0x5'));var rp=require(_0xc954('0x6'));var rs=require(_0xc954('0x7'));var sox=require('sox');var tts=require(_0xc954('0x8'));var urlParse=require(_0xc954('0x9'))[_0xc954('0xa')];var util=require(_0xc954('0xb'));var aws=require('./aws');var google=require('./google');var sestek=require(_0xc954('0xc'));var tilde=require(_0xc954('0xd'));var logger=require(_0xc954('0xe'))(_0xc954('0xf'));var ISPEECH_API=_0xc954('0x10');function downloadFile(_0x38ee3f,_0x24f92c){return new BPromise(function(_0x10ed3a,_0x5691ba){var _0x569d48=urlParse(_0x38ee3f);var _0x1a4881=_0x569d48[_0xc954('0x11')]===_0xc954('0x12')?https:http;var _0x54c44d={'host':_0x569d48[_0xc954('0x13')],'path':_0x569d48[_0xc954('0x14')],'headers':{'user-agent':_0xc954('0x15')}};_0x1a4881['get'](_0x54c44d,function(_0x47ef6a){if(_0x47ef6a['statusCode']!==0xc8){logger[_0xc954('0x16')](_0xc954('0x17')+_0x38ee3f+'\x20failed,\x20status\x20code\x20=\x20'+_0x47ef6a['statusCode']+'\x20('+_0x47ef6a[_0xc954('0x18')]+')');_0x5691ba(new Error('request\x20to\x20'+_0x38ee3f+'\x20failed,\x20status\x20code\x20=\x20'+_0x47ef6a[_0xc954('0x19')]+'\x20('+_0x47ef6a[_0xc954('0x18')]+')'));return;}var _0x394c51=fs[_0xc954('0x1a')](_0x24f92c);_0x394c51['on'](_0xc954('0x1b'),function(){logger[_0xc954('0x1c')](_0xc954('0x1d'));_0x394c51[_0xc954('0x1e')](_0x10ed3a);});_0x394c51['on'](_0xc954('0x16'),function(_0x3bacf6){fs[_0xc954('0x1f')](_0x24f92c);logger[_0xc954('0x16')]('download\x20error',_0x3bacf6);_0x5691ba(_0x3bacf6);});_0x47ef6a[_0xc954('0x20')](_0x394c51);})['on'](_0xc954('0x16'),function(_0x36f8cb){logger[_0xc954('0x16')](_0x36f8cb);_0x5691ba(_0x36f8cb);})['end']();});}function uploadFile(_0x38bc75){return new BPromise(function(_0x121261,_0x665f8a){var _0x3d1312=urlParse(_0x38bc75);var _0x4c446c=_0x3d1312['protocol']==='https:'?https:http;var _0x38125f={'host':_0x3d1312[_0xc954('0x13')],'path':_0x3d1312[_0xc954('0x14')],'headers':{'user-agent':_0xc954('0x15')}};_0x4c446c[_0xc954('0x21')](_0x38125f,function(_0x498163){if(_0x498163['statusCode']!==0xc8){_0x665f8a(new Error(_0xc954('0x17')+_0x38bc75+_0xc954('0x22')+_0x498163[_0xc954('0x19')]+'\x20('+_0x498163['statusMessage']+')'));return;}var _0x542da2='';_0x498163['on'](_0xc954('0x23'),function(_0x4090fd){_0x542da2+=_0x4090fd;});_0x498163['on'](_0xc954('0x24'),function(){_0x121261(_0x542da2);});})['on'](_0xc954('0x16'),function(_0x3b39a1){_0x665f8a(_0x3b39a1);})[_0xc954('0x24')]();});}function convertFile(_0x580aec,_0x1327af){return new BPromise(function(_0x1cbb26,_0x44f39a){var _0x36b37a=sox['transcode'](_0x580aec,_0x1327af,{'sampleRate':0x1f40,'format':_0xc954('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36b37a['on'](_0xc954('0x16'),function(_0x537184){logger[_0xc954('0x16')](_0xc954('0x26'),_0x537184);_0x44f39a(_0x537184);});_0x36b37a['on'](_0xc954('0x24'),function(){logger[_0xc954('0x1c')](_0xc954('0x27'));_0x1cbb26();});_0x36b37a[_0xc954('0x28')]();});}function base64Decode(_0x37120c,_0x3ad459){var _0x32cea2=path[_0xc954('0x29')](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+'.wav');fs[_0xc954('0x2c')](_0x32cea2,_0x37120c,_0xc954('0x2d'));return convertFile(_0x32cea2,_0x3ad459)[_0xc954('0x2e')](function(){try{fs[_0xc954('0x1f')](_0x32cea2);fs[_0xc954('0x2f')](_0x3ad459,_0xc954('0x30'));}catch(_0x2135e6){logger[_0xc954('0x16')](_0x2135e6);}return _0x3ad459[_0xc954('0x31')]('.')[0x0];});}function base64Encode(_0x166277){var _0x5ec7e3=fs[_0xc954('0x32')](_0x166277);return new Buffer(_0x5ec7e3)[_0xc954('0x33')](_0xc954('0x2d'));}exports[_0xc954('0x34')]=function(_0x310d0b,_0xfc7b83,_0x10e65e,_0x262788,_0x319bec,_0xf337f5){var _0x1804b5,_0x4fe1f2;var _0x464cbb=_0xc954('0x35');var _0x1e6e6f=_0xc954('0x36')+_0x310d0b;var _0x24d349={};if(_0xfc7b83===_0xc954('0x37')){_0x24d349[_0xc954('0x38')]={'ssml':_0x10e65e};}else{_0x24d349['input']={'text':_0x10e65e};};_0x24d349[_0xc954('0x39')]={'languageCode':_0x262788,'ssmlGender':_0x319bec};_0x24d349[_0xc954('0x3a')]={'audioEncoding':_0xc954('0x3b'),'sampleRateHertz':0x1f40};var _0x36a24a={'url':_0x464cbb+_0xc954('0x3c')+_0x1e6e6f,'method':_0xc954('0x3d'),'json':!![],'body':_0x24d349};return rp(_0x36a24a)[_0xc954('0x2e')](function(_0x5ccfee){return new BPromise(function(_0xf06b4b,_0x5a00bf){_0x1804b5=path[_0xc954('0x29')](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x3e'));var _0x553942=Buffer[_0xc954('0x3f')](_0x5ccfee[_0xc954('0x40')],'base64');return fs[_0xc954('0x41')](_0x1804b5,_0x553942,function(_0x12301a){_0x5a00bf(_0x12301a);},function(_0x2e81d1){fs[_0xc954('0x2f')](_0x1804b5,_0xc954('0x30'));_0xf06b4b(_0x2e81d1);});});})[_0xc954('0x2e')](function(_0x3bfc07){_0x4fe1f2=path['resolve'](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x42'));return convertFile(_0x1804b5,_0x4fe1f2);})[_0xc954('0x2e')](function(){try{fs[_0xc954('0x1f')](_0x1804b5);fs[_0xc954('0x2f')](_0x4fe1f2,_0xc954('0x30'));}catch(_0x507be6){logger['error'](_0x507be6);}logger[_0xc954('0x1c')](_0xc954('0x43'),_0x4fe1f2[_0xc954('0x31')]('.')[0x0]);return _0x4fe1f2[_0xc954('0x31')]('.')[0x0];});};exports[_0xc954('0x44')]=function(_0x39c9a9,_0x26e71a){var _0x4f7c07=_0xc954('0x45');var _0x43bbac,_0x3166a5;var _0x3b873e;var _0x19b7a8={'encoding':'utf8','method':_0xc954('0x3d'),'timeout':0x2710,'url':_0x4f7c07,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xc954('0x46')+encodeURIComponent(JSON[_0xc954('0x47')]([[[_0xc954('0x48'),JSON['stringify']([_0x39c9a9,_0x26e71a||'en',![],_0xc954('0x49')]),null,_0xc954('0x4a')]]]))};return rp(_0x19b7a8)[_0xc954('0x2e')](function(_0xfb09a6){try{_0x3b873e=eval(_0xfb09a6['slice'](0x5))[0x0][0x2];}catch(_0x4b4246){throw new Error(_0xc954('0x4b')+_0xfb09a6[_0xc954('0x23')]);}if(!_0x3b873e){if(_0x39c9a9[_0xc954('0x4c')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x26e71a+_0xc954('0x4d'));}}try{_0x3b873e=eval(_0x3b873e)[0x0];}catch(_0x392d20){throw new Error(_0xc954('0x4b')+res[_0xc954('0x23')]);}const _0x4abfa8=_0x3b873e;_0x43bbac=path['resolve'](__dirname,'tmp',rs[_0xc954('0x2b')](0x4)+_0xc954('0x3e'));fs['writeFileSync'](_0x43bbac,_0x3b873e,{'encoding':_0xc954('0x2d')});_0x3166a5=path['resolve'](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x42'));return convertFile(_0x43bbac,_0x3166a5);})['then'](function(){try{fs['unlink'](_0x43bbac);fs[_0xc954('0x2f')](_0x3166a5,_0xc954('0x30'));}catch(_0xe0a288){logger[_0xc954('0x16')](_0xe0a288);}logger[_0xc954('0x1c')](_0xc954('0x4e'),_0x3166a5[_0xc954('0x31')]('.')[0x0]);return _0x3166a5[_0xc954('0x31')]('.')[0x0];});};exports['googleASR']=function(_0x1beb56,_0x39a963,_0x145098){return google[_0xc954('0x4f')](_0x1beb56,_0x39a963,_0x145098)[_0xc954('0x2e')](function(_0x3aef5f){logger[_0xc954('0x1c')](_0x3aef5f[_0xc954('0x50')]);return rp(_0x3aef5f);})[_0xc954('0x2e')](function(_0x5c5d7a){var _0x29a9e9='';var _0x3174a4=0x0;try{fs[_0xc954('0x1f')](_0x1beb56);}catch(_0x486506){logger['error'](_0x486506);}if(_0x5c5d7a&&_0x5c5d7a['results']){_0x29a9e9=_0x5c5d7a[_0xc954('0x51')][_0xc954('0x52')](function(_0x12f86a){return _0x12f86a&&_0x12f86a[_0xc954('0x53')][0x0]&&_0x12f86a['alternatives'][0x0]['transcript']?_0x12f86a[_0xc954('0x53')][0x0][_0xc954('0x54')]:'';})[_0xc954('0x55')]('\x0a');_0x3174a4=_0x5c5d7a[_0xc954('0x51')][_0xc954('0x52')](function(_0x180899){return _0x180899&&_0x180899['alternatives'][0x0]&&_0x180899[_0xc954('0x53')][0x0]['confidence']?_0x180899[_0xc954('0x53')][0x0][_0xc954('0x56')]:0x0;})[_0xc954('0x55')]('\x0a');}logger[_0xc954('0x1c')](_0xc954('0x57'),_0x29a9e9);logger[_0xc954('0x1c')](_0xc954('0x58'),_0x3174a4);return{'transcript':_0x29a9e9,'confidence':_0x3174a4};})['catch'](function(_0xa8a479){logger[_0xc954('0x16')]('[%s]\x20%s:%s',_0xa8a479[_0xc954('0x19')],_0xa8a479[_0xc954('0x59')],_0xa8a479[_0xc954('0x5a')]);});};exports[_0xc954('0x5b')]=function(_0x417cd6,_0x5f4567,_0x2b10c3,_0x201821){var _0x41f60b=apiai(_0x5f4567,{'language':_0x201821||'en'});return _0x41f60b[_0xc954('0x5c')](_0x2b10c3,{'sessionId':md5(_0x417cd6)})[_0xc954('0x2e')](function(_0xf6c302){logger[_0xc954('0x1c')](JSON[_0xc954('0x47')](_0xf6c302));return{'source':_0xf6c302[_0xc954('0x5d')][_0xc954('0x5e')],'resolvedQuery':_0xf6c302[_0xc954('0x5d')][_0xc954('0x5f')],'action':_0xf6c302[_0xc954('0x5d')]['action'],'actionIncomplete':_0xf6c302[_0xc954('0x5d')][_0xc954('0x60')],'speech':_0xf6c302[_0xc954('0x5d')][_0xc954('0x61')][_0xc954('0x62')],'score':_0xf6c302[_0xc954('0x5d')][_0xc954('0x63')],'statusCode':_0xf6c302[_0xc954('0x64')][_0xc954('0x65')],'endConversation':_0xf6c302['result'][_0xc954('0x66')][_0xc954('0x67')]||![],'isFallbackIntent':_0xf6c302[_0xc954('0x5d')][_0xc954('0x66')][_0xc954('0x68')]};});};exports[_0xc954('0x69')]=function(_0x2ad6cc,_0x470a9b,_0x1e6af6,_0x35db30,_0x56a70e,_0x4633f7){var _0x208da3=_0x35db30['replace'](/\\n/g,'\x0a');var _0x589e8c={'credentials':{'private_key':_0x208da3,'client_email':_0x1e6af6}};var _0x5c354a=new dialogflow['SessionsClient'](_0x589e8c);var _0x3d4020=_0x5c354a[_0xc954('0x6a')](_0x470a9b,md5(_0x2ad6cc));var _0x3daa76={'session':_0x3d4020,'queryInput':{'text':{'text':_0x56a70e,'languageCode':_0x4633f7}}};return _0x5c354a['detectIntent'](_0x3daa76)['then'](function(_0x2a330b){if(_0x2a330b&&_0x2a330b['length']){logger[_0xc954('0x1c')](_0xc954('0x6b'),JSON[_0xc954('0x47')](_0x2a330b));var _0x3f0449=_0x2a330b[0x0];if(_0x3f0449){var _0x72464e={'action':_0x3f0449[_0xc954('0x6c')][_0xc954('0x6d')],'allRequiredParamsPresent':_0x3f0449[_0xc954('0x6c')]['allRequiredParamsPresent'],'endConversation':_0x3f0449['queryResult'][_0xc954('0x6e')]&&_0x3f0449[_0xc954('0x6c')][_0xc954('0x6e')]['fields']?_0x3f0449['queryResult'][_0xc954('0x6e')][_0xc954('0x6f')][_0xc954('0x70')][_0xc954('0x71')]:![],'fulfillmentText':_0x3f0449[_0xc954('0x6c')]['fulfillmentText'],'intentName':_0x3f0449[_0xc954('0x6c')][_0xc954('0x72')][_0xc954('0x59')],'intentDisplayName':_0x3f0449['queryResult'][_0xc954('0x72')][_0xc954('0x73')],'isFallbackIntent':_0x3f0449['queryResult'][_0xc954('0x72')]['isFallback'],'languageCode':_0x3f0449['queryResult'][_0xc954('0x74')],'queryText':_0x3f0449[_0xc954('0x6c')][_0xc954('0x75')],'responseId':_0x3f0449['responseId'],'score':_0x3f0449[_0xc954('0x6c')][_0xc954('0x76')],'speech':_0x3f0449[_0xc954('0x6c')]['fulfillmentText'],'providerResponse':JSON[_0xc954('0x47')](_0x2a330b)};return _0x72464e;}}});};exports['tildeASR']=function(_0xc38899,_0xf4b2fb,_0x33aa04,_0x66ba48){return tilde['asr'](_0xc38899,_0xf4b2fb,_0x33aa04,_0x66ba48)[_0xc954('0x2e')](function(_0x4c6ef7){try{fs[_0xc954('0x1f')](_0xc38899);}catch(_0x5db19f){logger[_0xc954('0x16')](_0x5db19f);}logger['info'](_0xc954('0x77'),_0x4c6ef7[_0xc954('0x54')]);logger[_0xc954('0x1c')]('Tilde\x20ASR\x20confidence',_0x4c6ef7[_0xc954('0x56')]);return _0x4c6ef7;});};exports[_0xc954('0x78')]=function(_0x22dfa2,_0x2a9893,_0x463c36,_0x232fe8,_0x210bf6,_0x576668){var _0x230b22=path[_0xc954('0x29')](__dirname,_0xc954('0x2a'),rs['generate'](0x4)+_0xc954('0x3e'));var _0x4928d0;return aws[_0xc954('0x79')](_0x22dfa2,_0x2a9893,_0x463c36,_0x232fe8,_0x210bf6,_0x576668,_0x230b22)[_0xc954('0x2e')](function(){_0x4928d0=path[_0xc954('0x29')](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x42'));return convertFile(_0x230b22,_0x4928d0);})[_0xc954('0x2e')](function(){try{fs[_0xc954('0x1f')](_0x230b22);fs[_0xc954('0x2f')](_0x4928d0,_0xc954('0x30'));}catch(_0x464182){logger['error'](_0x464182);}return _0x4928d0[_0xc954('0x31')]('.')[0x0];});};exports[_0xc954('0x7a')]=function(_0x3964bb,_0x58d743,_0x39aa7f,_0x16a524,_0x49b61d,_0x1ade7d){return aws[_0xc954('0x7b')](_0x3964bb,_0x58d743,_0x39aa7f,_0x16a524,_0x49b61d,_0x1ade7d)['then'](function(_0xef30c3){logger[_0xc954('0x1c')](JSON['stringify'](_0xef30c3));return _0xef30c3;});};exports[_0xc954('0x7c')]=function(_0x4728ad,_0x266ea8,_0xba3580,_0x4dbf3f){var _0x405fae=util[_0xc954('0x7d')](_0xc954('0x7e'),ISPEECH_API,_0x4728ad,encodeURIComponent(_0x266ea8),_0xba3580,_0x4dbf3f);var _0x58660d=path['resolve'](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x3e'));var _0x14a634;return downloadFile(_0x405fae,_0x58660d)[_0xc954('0x2e')](function(){_0x14a634=path['resolve'](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+_0xc954('0x42'));return convertFile(_0x58660d,_0x14a634);})[_0xc954('0x2e')](function(){try{fs[_0xc954('0x1f')](_0x58660d);fs['chmodSync'](_0x14a634,_0xc954('0x30'));}catch(_0x518cb9){logger[_0xc954('0x16')](_0x518cb9);}return _0x14a634[_0xc954('0x31')]('.')[0x0];});};exports[_0xc954('0x7f')]=function(_0x168317,_0x2a7d88,_0x37fe16,_0x64c4d2){var _0x4f8b52=util[_0xc954('0x7d')](_0xc954('0x80'),ISPEECH_API,_0x2a7d88,_0x37fe16,base64Encode(_0x168317),_0x64c4d2?util['format'](_0xc954('0x81'),encodeURIComponent(_0x64c4d2)):_0xc954('0x82'));return uploadFile(_0x4f8b52)[_0xc954('0x2e')](function(_0x392f29){return querystring[_0xc954('0xa')](_0x392f29);});};exports[_0xc954('0x83')]=function(_0x3888cb,_0x536ddd){return sestek[_0xc954('0x84')](_0x3888cb,_0x536ddd)[_0xc954('0x2e')](function(_0x11c227){logger[_0xc954('0x1c')](JSON[_0xc954('0x47')](_0x11c227));var _0x1ce4c7={'speech':_0x11c227[_0xc954('0x85')],'action':_0x11c227[_0xc954('0x86')]?_0x11c227[_0xc954('0x86')][_0xc954('0x87')]:undefined,'actiondata':_0x11c227[_0xc954('0x86')]?_0x11c227[_0xc954('0x86')][_0xc954('0x88')]:undefined};if(_0x11c227['channelData']&&_0x11c227[_0xc954('0x86')]['AudioFromTts']){return base64Decode(_0x11c227['channelData'][_0xc954('0x89')][_0xc954('0x8a')],path[_0xc954('0x29')](__dirname,_0xc954('0x2a'),rs[_0xc954('0x2b')](0x4)+'.wav'))[_0xc954('0x2e')](function(_0x78aaeb){_0x1ce4c7[_0xc954('0x8b')]=_0x78aaeb;return _0x1ce4c7;});}return _0x1ce4c7;});};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 b3448dc..f6a09fc 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 _0xd18d=['./nda','exports'];(function(_0x3a1d55,_0x3aae53){var _0x14b44f=function(_0x5aaac2){while(--_0x5aaac2){_0x3a1d55['push'](_0x3a1d55['shift']());}};_0x14b44f(++_0x3aae53);}(_0xd18d,0xb4));var _0xdd18=function(_0x31f095,_0x4ef11d){_0x31f095=_0x31f095-0x0;var _0xc7f71c=_0xd18d[_0x31f095];return _0xc7f71c;};var nda=require(_0xdd18('0x0'));module[_0xdd18('0x1')]={'nda':nda}; \ No newline at end of file +var _0xfd9b=['exports','./nda'];(function(_0x21dc4f,_0x50b632){var _0x31838e=function(_0x55de01){while(--_0x55de01){_0x21dc4f['push'](_0x21dc4f['shift']());}};_0x31838e(++_0x50b632);}(_0xfd9b,0x19b));var _0xbfd9=function(_0x34b819,_0x2db518){_0x34b819=_0x34b819-0x0;var _0x463ab2=_0xfd9b[_0x34b819];return _0x463ab2;};var nda=require(_0xbfd9('0x0'));module[_0xbfd9('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index ccbacfe..4ab7714 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 _0x765b=['access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','stringify','agi','POST','resolve','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','callerid','calleridname','dnid','extension','Bearer\x20'];(function(_0x36ae4d,_0x2166ab){var _0x1ef773=function(_0x12d574){while(--_0x12d574){_0x36ae4d['push'](_0x36ae4d['shift']());}};_0x1ef773(++_0x2166ab);}(_0x765b,0x18c));var _0xb765=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x765b[_0x51fe5f];return _0x4abce9;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require('../../../../../config/logger')(_0xb765('0x0'));module['exports']=function(_0x1db469,_0x530821){var _0x1e542f={'method':_0xb765('0x1'),'uri':url[_0xb765('0x2')](_0x530821['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x530821['username'],'password':_0x530821[_0xb765('0x3')]},'json':!![]};return rp(_0x1e542f)['then'](function(_0x179545){var _0x3d56b3={'method':_0xb765('0x1'),'uri':url['resolve'](_0x530821[_0xb765('0x4')],_0xb765('0x5')),'body':{'type':_0x530821[_0xb765('0x6')]||'message','channelId':'Nda','conversation':{'id':_0x1db469['uniqueid']},'from':{'id':_0x1db469[_0xb765('0x7')],'name':_0x1db469[_0xb765('0x8')]},'recipient':{'id':_0x1db469[_0xb765('0x9')],'name':_0x1db469[_0xb765('0xa')]},'text':_0x530821['text'],'channelData':{}},'headers':{'Authorization':_0xb765('0xb')+_0x179545[_0xb765('0xc')]},'json':!![]};if(_0x530821[_0xb765('0xd')]){_0x3d56b3[_0xb765('0xe')][_0xb765('0xf')][_0xb765('0x10')]=_0x530821[_0xb765('0xd')];}if(_0x530821[_0xb765('0x11')]=='1'){_0x3d56b3[_0xb765('0xe')]['channelData'][_0xb765('0x12')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x530821[_0xb765('0x13')]){_0x3d56b3[_0xb765('0xe')]['channelData']['CustomAction']=_0x530821[_0xb765('0x13')];if(_0x530821[_0xb765('0x14')]){_0x3d56b3[_0xb765('0xe')][_0xb765('0xf')][_0xb765('0x15')]=_0x530821[_0xb765('0x14')];}}logger[_0xb765('0x16')](JSON[_0xb765('0x17')](_0x3d56b3));return rp(_0x3d56b3);});}; \ No newline at end of file +var _0x9c5e=['exports','POST','resolve','/token','password','username','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','request-promise','url','../../../../../config/logger','agi'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x4ffc82,_0x23d4f4){_0x4ffc82=_0x4ffc82-0x0;var _0xf05e9f=_0x9c5e[_0x4ffc82];return _0xf05e9f;};'use strict';var rp=require(_0xe9c5('0x0'));var url=require(_0xe9c5('0x1'));var logger=require(_0xe9c5('0x2'))(_0xe9c5('0x3'));module[_0xe9c5('0x4')]=function(_0x5a6ce5,_0x51e921){var _0x595373={'method':_0xe9c5('0x5'),'uri':url[_0xe9c5('0x6')](_0x51e921['ndauth_url'],_0xe9c5('0x7')),'form':{'grant_type':_0xe9c5('0x8'),'username':_0x51e921[_0xe9c5('0x9')],'password':_0x51e921[_0xe9c5('0x8')]},'json':!![]};return rp(_0x595373)['then'](function(_0x2fa290){var _0x34ee69={'method':_0xe9c5('0x5'),'uri':url[_0xe9c5('0x6')](_0x51e921['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x51e921[_0xe9c5('0xa')]||_0xe9c5('0xb'),'channelId':_0xe9c5('0xc'),'conversation':{'id':_0x5a6ce5[_0xe9c5('0xd')]},'from':{'id':_0x5a6ce5[_0xe9c5('0xe')],'name':_0x5a6ce5[_0xe9c5('0xf')]},'recipient':{'id':_0x5a6ce5[_0xe9c5('0x10')],'name':_0x5a6ce5[_0xe9c5('0x11')]},'text':_0x51e921[_0xe9c5('0x12')],'channelData':{}},'headers':{'Authorization':_0xe9c5('0x13')+_0x2fa290[_0xe9c5('0x14')]},'json':!![]};if(_0x51e921[_0xe9c5('0x15')]){_0x34ee69[_0xe9c5('0x16')][_0xe9c5('0x17')][_0xe9c5('0x18')]=_0x51e921[_0xe9c5('0x15')];}if(_0x51e921['ndagenerate_audio']=='1'){_0x34ee69[_0xe9c5('0x16')][_0xe9c5('0x17')][_0xe9c5('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe9c5('0x1a')};}if(_0x51e921[_0xe9c5('0x1b')]){_0x34ee69[_0xe9c5('0x16')]['channelData'][_0xe9c5('0x1c')]=_0x51e921[_0xe9c5('0x1b')];if(_0x51e921['custom_action_data']){_0x34ee69[_0xe9c5('0x16')][_0xe9c5('0x17')][_0xe9c5('0x1d')]=_0x51e921[_0xe9c5('0x1e')];}}logger[_0xe9c5('0x1f')](JSON['stringify'](_0x34ee69));return rp(_0x34ee69);});}; \ 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 3de8875..5e7b29d 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 _0xdd83=['exports','./lib/api'];(function(_0xd41af5,_0x3f0d98){var _0x223db6=function(_0x4fca23){while(--_0x4fca23){_0xd41af5['push'](_0xd41af5['shift']());}};_0x223db6(++_0x3f0d98);}(_0xdd83,0xe1));var _0x3dd8=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xdd83[_0x51020b];return _0x371e47;};'use strict';var asr=require(_0x3dd8('0x0'));module[_0x3dd8('0x1')]=function(_0xb7958d,_0x351176,_0x466878,_0x2b4cdf){return asr(_0xb7958d,_0x351176,_0x466878,_0x2b4cdf);}; \ No newline at end of file +var _0xad20=['exports','./lib/api'];(function(_0x2404ab,_0x33d1de){var _0x5268b8=function(_0x4b8ac6){while(--_0x4b8ac6){_0x2404ab['push'](_0x2404ab['shift']());}};_0x5268b8(++_0x33d1de);}(_0xad20,0x69));var _0x0ad2=function(_0x412c8f,_0x11ec94){_0x412c8f=_0x412c8f-0x0;var _0x27c005=_0xad20[_0x412c8f];return _0x27c005;};'use strict';var asr=require(_0x0ad2('0x0'));module[_0x0ad2('0x1')]=function(_0x3a949e,_0x1a6559,_0x1733a8,_0x4916c6){return asr(_0x3a949e,_0x1a6559,_0x1733a8,_0x4916c6);}; \ 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 7ed4d56..eb0effa 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 _0x8319=['status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','EOS','error','Tilde\x20ASR\x20send\x20error','parse'];(function(_0x4a6301,_0x486c0f){var _0x12997a=function(_0x1bc115){while(--_0x1bc115){_0x4a6301['push'](_0x4a6301['shift']());}};_0x12997a(++_0x486c0f);}(_0x8319,0x183));var _0x9831=function(_0x1320de,_0x6ba896){_0x1320de=_0x1320de-0x0;var _0x4bfb09=_0x8319[_0x1320de];return _0x4bfb09;};'use strict';var BPromise=require(_0x9831('0x0'));var _=require(_0x9831('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9831('0x2'));var crypto=require(_0x9831('0x3'));var logger=require(_0x9831('0x4'))(_0x9831('0x5'));module[_0x9831('0x6')]=function(_0xef70b5,_0x43d7cf,_0x52f30f,_0x27dfd6){return new BPromise(function(_0x222c5a,_0x5f5994){logger[_0x9831('0x7')]('Tilde\x20URI',_0x27dfd6||_0x9831('0x8'));var _0x25e127=new WebSocket(_0x27dfd6||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x57a8f6='';var _0x483e28='0';var _0x80f3ce='1';var _0x39ff28=_0x9831('0x9');function _0x2184bf(_0x96a23e){var _0x539086=crypto[_0x9831('0xa')](_0x9831('0xb'));_0x539086[_0x9831('0xc')](_0x96a23e);return _0x539086[_0x9831('0xd')](_0x9831('0xe'));}function _0x5500b2(){try{logger[_0x9831('0x7')](_0x9831('0xf'));var _0x268c12=moment()[_0x9831('0x10')]();var _0x422ae7=_0x2184bf(_0x268c12+_0x43d7cf+_0x52f30f);_0x25e127[_0x9831('0x11')](JSON[_0x9831('0x12')]({'appID':_0x43d7cf,'timestamp':_0x268c12,'appKey':_0x422ae7}));var _0x2ba190=fs['createReadStream'](_0xef70b5);_0x2ba190['on']('data',function(_0x33011e){_0x25e127[_0x9831('0x11')](_0x33011e);});_0x2ba190['on']('close',function(){_0x25e127[_0x9831('0x11')](_0x9831('0x13'));});}catch(_0x3325d6){logger[_0x9831('0x14')](_0x9831('0x15'),JSON[_0x9831('0x12')](_0x3325d6));_0x25e127['terminate']();}}function _0x2deaf3(_0x4651d7){try{if(_0x4651d7){var _0x1c436f=JSON[_0x9831('0x16')](_0x4651d7);switch(_0x1c436f[_0x9831('0x17')]){case 0x0:if(_0x1c436f[_0x9831('0x18')]){if(_0x1c436f['result'][_0x9831('0x19')]){logger['info'](_0x9831('0x1a'),JSON[_0x9831('0x12')](_0x1c436f[_0x9831('0x18')][_0x9831('0x1b')]));_0x57a8f6=_0x1c436f[_0x9831('0x18')][_0x9831('0x1b')][0x0][_0x9831('0x1c')];_0x483e28=_0x1c436f[_0x9831('0x18')][_0x9831('0x1b')][0x0][_0x9831('0x1d')];_0x80f3ce='0';_0x39ff28=_0x9831('0x1e');_0x25e127['terminate']();}}break;case 0x1:logger[_0x9831('0x7')](_0x9831('0x9'));_0x80f3ce='1';_0x39ff28=_0x9831('0x9');break;case 0x2:logger[_0x9831('0x7')](_0x9831('0x1f'));_0x80f3ce='2';_0x39ff28=_0x9831('0x1f');break;case 0x9:logger[_0x9831('0x7')](_0x9831('0x20'));_0x80f3ce='9';_0x39ff28=_0x9831('0x20');break;case 0xa:logger['info'](_0x9831('0x21'));_0x80f3ce='10';_0x39ff28=_0x9831('0x21');break;case 0xb:logger[_0x9831('0x7')](_0x9831('0x22'));_0x80f3ce='11';_0x39ff28='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x28095b){logger[_0x9831('0x14')](_0x9831('0x23'),JSON[_0x9831('0x12')](_0x28095b));_0x25e127[_0x9831('0x24')]();}}function _0x2aa0f9(){logger[_0x9831('0x7')](_0x9831('0x25'));_0x222c5a({'transcript':_0x57a8f6,'confidence':_0x483e28,'status':_0x80f3ce,'status_message':_0x39ff28});}function _0x552354(_0x2384d1){logger[_0x9831('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x9831('0x26')](_0x2384d1)){logger[_0x9831('0x14')](_[_0x9831('0x27')](_0x2384d1)?JSON[_0x9831('0x12')](_0x2384d1):_0x2384d1);}}_0x25e127['on'](_0x9831('0x28'),_0x5500b2);_0x25e127['on']('message',_0x2deaf3);_0x25e127['on']('close',_0x2aa0f9);_0x25e127['on'](_0x9831('0x14'),_0x552354);});}; \ No newline at end of file +var _0x92e1=['hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','unix','send','stringify','createReadStream','close','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','transcript'];(function(_0x3249b5,_0x56c2e6){var _0x4a6dff=function(_0x576e8c){while(--_0x576e8c){_0x3249b5['push'](_0x3249b5['shift']());}};_0x4a6dff(++_0x56c2e6);}(_0x92e1,0x198));var _0x192e=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0x92e1[_0x9d14e3];return _0x19bf32;};'use strict';var BPromise=require(_0x192e('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x192e('0x1'));var crypto=require(_0x192e('0x2'));var logger=require(_0x192e('0x3'))(_0x192e('0x4'));module['exports']=function(_0x5d7720,_0x4f7e1a,_0x57021a,_0x22018e){return new BPromise(function(_0xcebe6b,_0x3bba34){logger[_0x192e('0x5')](_0x192e('0x6'),_0x22018e||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x374b13=new WebSocket(_0x22018e||_0x192e('0x7'),{'perMessageDeflate':![]});var _0x44e998='';var _0x1e0d40='0';var _0x254113='1';var _0x3eed20=_0x192e('0x8');function _0x7bfdce(_0x505984){var _0x270b05=crypto['createHash'](_0x192e('0x9'));_0x270b05[_0x192e('0xa')](_0x505984);return _0x270b05[_0x192e('0xb')](_0x192e('0xc'));}function _0x2f369f(){try{logger[_0x192e('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x537ed2=moment()[_0x192e('0xd')]();var _0x261ce8=_0x7bfdce(_0x537ed2+_0x4f7e1a+_0x57021a);_0x374b13[_0x192e('0xe')](JSON[_0x192e('0xf')]({'appID':_0x4f7e1a,'timestamp':_0x537ed2,'appKey':_0x261ce8}));var _0x1fdd3e=fs[_0x192e('0x10')](_0x5d7720);_0x1fdd3e['on']('data',function(_0x21f67f){_0x374b13['send'](_0x21f67f);});_0x1fdd3e['on'](_0x192e('0x11'),function(){_0x374b13[_0x192e('0xe')]('EOS');});}catch(_0x477723){logger['error'](_0x192e('0x12'),JSON[_0x192e('0xf')](_0x477723));_0x374b13[_0x192e('0x13')]();}}function _0x1f5fc0(_0x1b8178){try{if(_0x1b8178){var _0x1c9378=JSON[_0x192e('0x14')](_0x1b8178);switch(_0x1c9378[_0x192e('0x15')]){case 0x0:if(_0x1c9378[_0x192e('0x16')]){if(_0x1c9378[_0x192e('0x16')]['final']){logger[_0x192e('0x5')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x1c9378[_0x192e('0x16')]['hypotheses']));_0x44e998=_0x1c9378[_0x192e('0x16')]['hypotheses'][0x0][_0x192e('0x17')];_0x1e0d40=_0x1c9378['result'][_0x192e('0x18')][0x0]['likelihood'];_0x254113='0';_0x3eed20=_0x192e('0x19');_0x374b13['terminate']();}}break;case 0x1:logger[_0x192e('0x5')](_0x192e('0x8'));_0x254113='1';_0x3eed20=_0x192e('0x8');break;case 0x2:logger['info'](_0x192e('0x1a'));_0x254113='2';_0x3eed20=_0x192e('0x1a');break;case 0x9:logger[_0x192e('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x254113='9';_0x3eed20='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x192e('0x5')]('Authentication\x20failed.');_0x254113='10';_0x3eed20=_0x192e('0x1b');break;case 0xb:logger[_0x192e('0x5')](_0x192e('0x1c'));_0x254113='11';_0x3eed20=_0x192e('0x1c');}}}catch(_0x26aaa6){logger['error'](_0x192e('0x1d'),JSON[_0x192e('0xf')](_0x26aaa6));_0x374b13[_0x192e('0x13')]();}}function _0x23b629(){logger[_0x192e('0x5')](_0x192e('0x1e'));_0xcebe6b({'transcript':_0x44e998,'confidence':_0x1e0d40,'status':_0x254113,'status_message':_0x3eed20});}function _0x39487b(_0x7726f7){logger[_0x192e('0x1f')](_0x192e('0x20'));if(!_[_0x192e('0x21')](_0x7726f7)){logger['error'](_['isObject'](_0x7726f7)?JSON[_0x192e('0xf')](_0x7726f7):_0x7726f7);}}_0x374b13['on'](_0x192e('0x22'),_0x2f369f);_0x374b13['on'](_0x192e('0x23'),_0x1f5fc0);_0x374b13['on'](_0x192e('0x11'),_0x23b629);_0x374b13['on'](_0x192e('0x1f'),_0x39487b);});}; \ 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 018cf56..fb83f62 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 _0xc631=['exports','./asr'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0xc631,0x1e1));var _0x1c63=function(_0x1f08f0,_0x51f178){_0x1f08f0=_0x1f08f0-0x0;var _0x87b2e=_0xc631[_0x1f08f0];return _0x87b2e;};var asr=require(_0x1c63('0x0'));module[_0x1c63('0x1')]={'asr':asr}; \ No newline at end of file +var _0xab63=['./asr','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab63,0x166));var _0x3ab6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab63[_0x3dd15e];return _0x231fd0;};var asr=require(_0x3ab6('0x0'));module[_0x3ab6('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 7bbe47a..a987b4d 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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x6e2d32,_0x1f783e){var _0x4409cd=function(_0x5b5c58){while(--_0x5b5c58){_0x6e2d32['push'](_0x6e2d32['shift']());}};_0x4409cd(++_0x1f783e);}(_0x34e8,0x12c));var _0x834e=function(_0x4deff8,_0x166001){_0x4deff8=_0x4deff8-0x0;var _0x2637ac=_0x34e8[_0x4deff8];return _0x2637ac;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x46eb6f,_0x2a287f){var _0x1123ac=function(_0x53bcdf){while(--_0x53bcdf){_0x46eb6f['push'](_0x46eb6f['shift']());}};_0x1123ac(++_0x2a287f);}(_0x34e8,0x12c));var _0x834e=function(_0x4eb165,_0x3ce883){_0x4eb165=_0x4eb165-0x0;var _0x50b8bc=_0x34e8[_0x4eb165];return _0x50b8bc;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 82b3ccf..cab1c40 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 _0x0833=['mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','getSoundById','getMailAccountById','sendMailMessage','getIntervals','map','Intervals','interval','getSoundPath','format','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','createSquareRecording','uniqueid','callerid','context','extension','priority','accountcode','dnid','arg_1','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agentUnpause','agent','internal','%s/%s@from-sip/n','agentLogin','shellCommand','exec','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','timeout','number','includes','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','body','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','length','isString','replaceAllVariables','%s.%s','saveRestApiResult','setVariable','split','replaceAll','getAndSetVariable','result','extra','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','MRCPSynth','noop','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','RECOG_INPUT()','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','speech','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','out','dialogflowV2','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','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','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','first','substr','getsecretdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','beep','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','Enter\x20in\x20MATH\x20(%s)\x20block','math\x20%s','operation','%s[%s]','menu','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','opts','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','recordFile','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','statusMessage','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','subject','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','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','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','../../config/logger','../../config/environment','../../config/environment/shared','./scripts','rawHeaders','rawBody','channel','rpc'];(function(_0x19405f,_0xd92bae){var _0x580a3c=function(_0x46bc50){while(--_0x46bc50){_0x19405f['push'](_0x19405f['shift']());}};_0x580a3c(++_0xd92bae);}(_0x0833,0x1bd));var _0x3083=function(_0x5918a8,_0x1a0f92){_0x5918a8=_0x5918a8-0x0;var _0x2edae1=_0x0833[_0x5918a8];return _0x2edae1;};'use strict';var fs=require('fs');var util=require(_0x3083('0x0'));var _=require(_0x3083('0x1'));var sh=require(_0x3083('0x2'));var odbc=require(_0x3083('0x3'))();var rs=require(_0x3083('0x4'));var moment=require('moment');var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x3083('0x5'))('agi');var config=require(_0x3083('0x6'));var shared=require(_0x3083('0x7'));var scripts=require(_0x3083('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x3083('0x9'),_0x3083('0xa')];var verticesWithRetry=['menu','getdigits','getsecretdigits'];var AGIVertices=function(_0x44b807,_0x5f1109,_0x5cce3c){this[_0x3083('0xb')]=_0x44b807;this[_0x3083('0xc')]=_0x5f1109;this[_0x3083('0xd')]=_0x5cce3c;};AGIVertices[_0x3083('0xe')][_0x3083('0xf')]=function(_0x23bcf4,_0x17951a){this[_0x3083('0xc')][_0x3083('0x10')](_0x23bcf4)[_0x3083('0x11')](function(_0x3a2460){_0x17951a(null,_0x3a2460?_0x3a2460[_0x3083('0x12')]:![]);})[_0x3083('0x13')](function(_0x2dc6ab){_0x17951a(_0x2dc6ab);});};AGIVertices[_0x3083('0xe')]['getVoiceQueue']=function(_0x2fe399,_0x2a8cd0){this['rpc'][_0x3083('0x14')](_0x2fe399)[_0x3083('0x11')](function(_0x507441){_0x2a8cd0(null,_0x507441?_0x507441[_0x3083('0x12')]:![]);})[_0x3083('0x13')](function(_0x1b6955){_0x2a8cd0(_0x1b6955);});};AGIVertices[_0x3083('0xe')][_0x3083('0x15')]=function(_0x1de928,_0xecb368){this['rpc']['getSquareProjectById'](_0x1de928)['then'](function(_0x424c59){_0xecb368(null,_0x424c59?_0x424c59['name']:![]);})[_0x3083('0x13')](function(_0x2cdeca){_0xecb368(_0x2cdeca);});};AGIVertices[_0x3083('0xe')][_0x3083('0x16')]=function(_0x3bc7f0,_0x43d42a){this[_0x3083('0xc')][_0x3083('0x17')](_0x3bc7f0)[_0x3083('0x11')](function(_0x164988){_0x43d42a(null,_0x164988?_0x164988[_0x3083('0x18')]:![]);})[_0x3083('0x13')](function(_0x9a4aed){_0x43d42a(_0x9a4aed);});};AGIVertices[_0x3083('0xe')]['getUser']=function(_0x4c2a0b,_0x4dc9ad){this['rpc'][_0x3083('0x19')](_0x4c2a0b)[_0x3083('0x11')](function(_0x3e4f5a){_0x4dc9ad(null,_0x3e4f5a?_0x3e4f5a[_0x3083('0x12')]:![]);})[_0x3083('0x13')](function(_0x4170ab){_0x4dc9ad(_0x4170ab);});};AGIVertices[_0x3083('0xe')][_0x3083('0x1a')]=function(_0x4501b2,_0x569b8b){this[_0x3083('0xc')]['getTrunkById'](_0x4501b2)['then'](function(_0x1bea50){_0x569b8b(null,_0x1bea50?_0x1bea50[_0x3083('0x12')]:![]);})[_0x3083('0x13')](function(_0x2efe93){_0x569b8b(_0x2efe93);});};AGIVertices[_0x3083('0xe')][_0x3083('0x1b')]=function(_0x5369f4,_0xd38b35){var _0x57eade=this;this[_0x3083('0xc')][_0x3083('0x1c')](_0x5369f4)['then'](function(_0x3055d2){_0xd38b35(null,_0x3055d2?_0x57eade['getSoundPath'](_0x3055d2['save_name']):![]);})[_0x3083('0x13')](function(_0x233a81){_0xd38b35(_0x233a81);});};AGIVertices[_0x3083('0xe')]['getMailAccount']=function(_0x1a8b75,_0x235c09){this[_0x3083('0xc')][_0x3083('0x1d')](_0x1a8b75)[_0x3083('0x11')](function(_0x29146b){_0x235c09(null,_0x29146b?_0x29146b:![]);})[_0x3083('0x13')](function(_0x1b4680){_0x235c09(_0x1b4680);});};AGIVertices[_0x3083('0xe')][_0x3083('0x1e')]=function(_0x3bd45c,_0x30dcd1,_0xb56270){this[_0x3083('0xd')][_0x3083('0x1e')](_0x3bd45c,_0x30dcd1)[_0x3083('0x11')](function(){_0xb56270(null);})[_0x3083('0x13')](function(_0x300703){_0xb56270(_0x300703);});};AGIVertices[_0x3083('0xe')][_0x3083('0x1f')]=function(_0x4c3404,_0x25ec5f){this[_0x3083('0xc')]['getIntervalById'](_0x4c3404)[_0x3083('0x11')](function(_0x473f0b){if(_0x473f0b){if(_0x473f0b['IntervalId']){_0x25ec5f(null,[_0x473f0b['interval']]);}else{_0x25ec5f(null,_[_0x3083('0x20')](_0x473f0b[_0x3083('0x21')],_0x3083('0x22')));}}else{_0x25ec5f(null,![]);}})[_0x3083('0x13')](function(_0x5642f8){_0x25ec5f(_0x5642f8);});};AGIVertices['prototype'][_0x3083('0x23')]=function(_0x2ae3df){return util[_0x3083('0x24')]('%s/sounds/converted/%s',FILES_PATH,_0x2ae3df);};AGIVertices[_0x3083('0xe')][_0x3083('0x25')]=function(_0x12ff32,_0x418bb2,_0x408f33){odbc['open'](_0x12ff32,function(_0x4c5bbc){if(_0x4c5bbc){logger[_0x3083('0x26')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x4c5bbc);_0x408f33(_0x4c5bbc);}else{logger[_0x3083('0x27')](_0x3083('0x28'));odbc[_0x3083('0x29')](_0x418bb2,function(_0xf9ac6a,_0x56121c){if(_0xf9ac6a){logger[_0x3083('0x27')](_0x3083('0x2a'),_0x418bb2);_0x408f33(_0xf9ac6a);}else{logger[_0x3083('0x27')]('Query\x20executed\x20correctly\x20%s',_0x418bb2);odbc[_0x3083('0x2b')](function(_0x4b2456){if(_0x4b2456){logger[_0x3083('0x26')](_0x3083('0x2c'),_0x4b2456);}_0x408f33(null,_0x56121c);});}});}});};AGIVertices[_0x3083('0xe')][_0x3083('0x2d')]=function(_0x489292,_0x10380f){this['rpc'][_0x3083('0x2e')](_0x489292)[_0x3083('0x11')](function(_0x166162){_0x10380f(null,_0x166162?_0x166162:![]);})[_0x3083('0x13')](function(_0x4597e5){_0x10380f(_0x4597e5);});};AGIVertices['prototype'][_0x3083('0x2f')]=function(_0x28f37e,_0x334084){this[_0x3083('0xc')][_0x3083('0x2f')](_0x28f37e)[_0x3083('0x11')](function(_0x7c08d7){_0x334084(null,_0x7c08d7);})[_0x3083('0x13')](function(_0x3dbc69){_0x334084(_0x3dbc69);});};AGIVertices[_0x3083('0xe')]['createSquareDetailsReport']=function(_0x406d89,_0x505091,_0x5536c0){this[_0x3083('0xc')][_0x3083('0x30')]({'uniqueid':this[_0x3083('0xb')]['uniqueid'],'node':_0x406d89[_0x3083('0x31')],'application':_0x406d89[_0x3083('0x32')],'data':_0x505091||null,'project_name':this[_0x3083('0xb')]['arg_1'],'callerid':this[_0x3083('0xb')]['callerid']})[_0x3083('0x11')](function(_0x5137d3){if(_0x5536c0){_0x5536c0(null,_0x5137d3);}})[_0x3083('0x13')](function(_0x5ad75b){if(_0x5536c0){_0x5536c0(_0x5ad75b);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x553f7f,_0x45c26e,_0x3673b5,_0x3a2be6){this[_0x3083('0xc')][_0x3083('0x33')]({'uniqueid':this[_0x3083('0xb')][_0x3083('0x34')],'callerid':this[_0x3083('0xb')][_0x3083('0x35')],'calleridname':this[_0x3083('0xb')]['calleridname'],'context':this[_0x3083('0xb')][_0x3083('0x36')],'extension':this[_0x3083('0xb')][_0x3083('0x37')],'priority':this['channel'][_0x3083('0x38')],'accountcode':this[_0x3083('0xb')][_0x3083('0x39')],'dnid':this[_0x3083('0xb')][_0x3083('0x3a')],'projectName':this[_0x3083('0xb')][_0x3083('0x3b')],'saveName':_0x45c26e,'filename':_0x553f7f['file']||_0x45c26e,'savePath':_0x3673b5})[_0x3083('0x11')](function(_0x243ee0){_0x3a2be6(null,_0x243ee0);})[_0x3083('0x13')](function(_0x17bcf0){_0x3a2be6(_0x17bcf0);});};AGIVertices[_0x3083('0xe')][_0x3083('0x3c')]=function(_0x5dbfd2,_0x5ca6fa,_0x1637f6,_0x5d6ea1,_0x31891f){this[_0x3083('0xc')][_0x3083('0x3c')]({'uniqueid':this[_0x3083('0xb')][_0x3083('0x34')],'body':_0x5dbfd2,'direction':_0x5ca6fa,'providerName':_0x1637f6,'providerResponse':_0x5d6ea1})[_0x3083('0x11')](function(_0x21b779){if(_0x31891f){_0x31891f(null,_0x21b779);}})['catch'](function(_0x1dd15f){if(_0x31891f){_0x31891f(_0x1dd15f);}});};AGIVertices[_0x3083('0xe')][_0x3083('0x3d')]=function(_0x488943,_0x2e8c80){this['rpc'][_0x3083('0x3d')]({'firstName':_[_0x3083('0x3e')](_0x488943['name'])||_[_0x3083('0x3f')](_0x488943[_0x3083('0x12')])?_0x3083('0x40')+Math[_0x3083('0x41')]():_0x488943['name'],'lastName':_['isEmpty'](_0x488943[_0x3083('0x42')])||_[_0x3083('0x3f')](_0x488943[_0x3083('0x42')])?null:_0x488943[_0x3083('0x42')],'phone':_0x488943[_0x3083('0x43')],'ListId':_0x488943[_0x3083('0x44')],'scheduledat':_0x488943[_0x3083('0x45')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x3083('0x46'),'description':_0x3083('0x47')+_0x488943['scheduledAt'][_0x3083('0x48')](),'priority':_0x488943[_0x3083('0x49')]})[_0x3083('0x11')](function(_0x3944e0){_0x2e8c80(null,_0x3944e0);})[_0x3083('0x13')](function(_0x29f58d){_0x2e8c80(_0x29f58d);});};AGIVertices['prototype'][_0x3083('0x4a')]=function(_0x333456,_0x5ef25e){this[_0x3083('0xc')]['getPauseById'](_0x333456)[_0x3083('0x11')](function(_0x538d09){_0x5ef25e(null,_0x538d09?_0x538d09['name']:![]);})['catch'](function(_0x2b5e29){_0x5ef25e(_0x2b5e29);});};AGIVertices[_0x3083('0xe')][_0x3083('0x4b')]=function(_0x953e2f,_0x360f21,_0x1fa78c){var _0x5af85e={'role':'agent'};_0x5af85e[_0x953e2f]=this[_0x3083('0xb')]['callerid'];this[_0x3083('0xc')][_0x3083('0x4b')](_0x5af85e,_0x360f21,this[_0x3083('0xb')][_0x3083('0x34')])[_0x3083('0x11')](function(_0x25b43b){_0x1fa78c(null,_[_0x3083('0x3f')](_0x25b43b)?![]:!![]);})['catch'](function(_0x590b2b){logger[_0x3083('0x26')](_0x590b2b);_0x1fa78c(null,![]);});};AGIVertices[_0x3083('0xe')][_0x3083('0x4c')]=function(_0x44f745,_0x385dc3){var _0x586cd1={'role':_0x3083('0x4d')};_0x586cd1[_0x44f745]=this[_0x3083('0xb')]['callerid'];this[_0x3083('0xc')][_0x3083('0x4c')](_0x586cd1)[_0x3083('0x11')](function(_0x38448b){_0x385dc3(null,_[_0x3083('0x3f')](_0x38448b)?![]:!![]);})[_0x3083('0x13')](function(_0x41ed35){logger[_0x3083('0x26')](_0x41ed35);_0x385dc3(null,![]);});};AGIVertices[_0x3083('0xe')]['agentLogout']=function(_0xc2343b,_0x43e7c2){var _0x20a126={'role':_0x3083('0x4d')};_0x20a126[_0xc2343b]=this[_0x3083('0xb')][_0x3083('0x35')];this[_0x3083('0xc')]['agentLogout'](_0x20a126)[_0x3083('0x11')](function(_0x5dda6f){_0x43e7c2(null,_[_0x3083('0x3f')](_0x5dda6f)?![]:!![]);})[_0x3083('0x13')](function(_0x3f4ca9){logger[_0x3083('0x26')](_0x3f4ca9);_0x43e7c2(null,![]);});};AGIVertices[_0x3083('0xe')]['agentLogin']=function(_0x119f72,_0x44ac3c){var _0x377d26={'role':'agent'};_0x377d26[_0x119f72]=this[_0x3083('0xb')][_0x3083('0x35')];var _0x281d14=_0x119f72!=_0x3083('0x4e')?util[_0x3083('0x24')](_0x3083('0x4f'),'LOCAL',this[_0x3083('0xb')][_0x3083('0x35')]):undefined;this[_0x3083('0xc')][_0x3083('0x50')](_0x377d26,_0x281d14)['then'](function(_0x160c55){_0x44ac3c(null,_[_0x3083('0x3f')](_0x160c55)?![]:!![]);})[_0x3083('0x13')](function(_0x17f3f0){logger[_0x3083('0x26')](_0x17f3f0);_0x44ac3c(null,![]);});};AGIVertices[_0x3083('0xe')][_0x3083('0x51')]=function(_0x50ca12,_0x25656d){sh[_0x3083('0x52')](_['trim'](_0x50ca12),function(_0xa87e56,_0x531124){var _0x5baaa1=_0x531124[_0x3083('0x53')](/(\r\n|\n|\r)/gm,'');_0x25656d(null,_0x5baaa1);});};AGIVertices['prototype'][_0x3083('0x54')]=function(_0x13260a,_0x3dfb08){scripts['googleCloudTTS'](_0x13260a['apiKey'],_0x13260a[_0x3083('0x55')]||_0x3083('0x56'),_0x13260a[_0x3083('0x56')],_0x13260a[_0x3083('0x57')]||'en-US',_0x13260a[_0x3083('0x58')]||_0x3083('0x59'),_0x13260a[_0x3083('0x5a')]||_0x3083('0x5b'))[_0x3083('0x11')](function(_0xfed6e){_0x3dfb08(null,_0xfed6e);})[_0x3083('0x13')](function(_0x1f3fae){_0x3dfb08(_0x1f3fae);});};AGIVertices['prototype'][_0x3083('0x5c')]=function(_0x108e21,_0x2e0355){scripts['googleTTS'](_0x108e21[_0x3083('0x56')],_0x108e21[_0x3083('0x5d')]||'en',0x1)['then'](function(_0x4ad20e){_0x2e0355(null,_0x4ad20e);})[_0x3083('0x13')](function(_0x396c53){_0x2e0355(_0x396c53);});};AGIVertices[_0x3083('0xe')]['restAPI']=function(_0x315969,_0xb68216){var _0x10c758={'uri':_0x315969[_0x3083('0x5e')],'method':_0x315969[_0x3083('0x5f')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x315969[_0x3083('0x60')])===_0x3083('0x61')&&parseInt(_0x315969['timeout'])>=0x1?parseInt(_0x315969[_0x3083('0x60')])*0x3e8:0x5*0x3e8};if(_[_0x3083('0x62')]([_0x3083('0x63'),_0x3083('0x64')],_0x10c758[_0x3083('0x5f')][_0x3083('0x65')]())){try{_0x10c758['body']=_0x315969[_0x3083('0xa')]?JSON[_0x3083('0x66')](_0x315969[_0x3083('0xa')]):{};}catch(_0x68705d){logger[_0x3083('0x26')](_0x3083('0x67'),_0x68705d);}}try{_0x10c758[_0x3083('0x68')]=_0x315969['rawHeaders']?JSON[_0x3083('0x66')](_0x315969[_0x3083('0x9')]):{};}catch(_0x1a1214){logger[_0x3083('0x26')](_0x3083('0x69'),_0x1a1214);}if(_0x315969[_0x3083('0x6a')]){try{var _0x1e4c75=require(_0x315969['computedVariables'])[_0x3083('0x6b')](this,_0x10c758);_0x10c758[_0x3083('0x6c')]=Mustache['render'](_0x315969[_0x3083('0x5e')],_0x1e4c75,{},['$$','$$']);if(_0x10c758['headers']){_0x10c758['headers']=JSON[_0x3083('0x66')](Mustache['render'](JSON['stringify'](_0x10c758[_0x3083('0x68')]),_0x1e4c75,{},['$$','$$']));}if(_0x10c758[_0x3083('0x6d')]){_0x10c758['body']=JSON['parse'](Mustache[_0x3083('0x6e')](JSON[_0x3083('0x6f')](_0x10c758[_0x3083('0x6d')]),_0x1e4c75,{},['$$','$$']));}}catch(_0x4ba3fa){logger['error'](_0x3083('0x70'),_0x4ba3fa);}}rp(_0x10c758)[_0x3083('0x11')](function(_0x236267){var _0x3e07c3={'statusCode':_0x236267['statusCode']||0xc8,'statusMessage':_0x236267['statusMessage']||'OK','headers':_0x236267[_0x3083('0x68')]||{},'body':_0x236267[_0x3083('0x6d')]||{}};_0xb68216(null,_0x3e07c3);})[_0x3083('0x13')](function(_0x20f511){var _0x4d845f={'statusCode':_0x20f511[_0x3083('0x71')]||0x1f4,'statusMessage':_0x20f511[_0x3083('0x72')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x20f511[_0x3083('0x73')]['headers']||{},'body':_0x20f511['options']['body']||{}};_0xb68216(null,_0x4d845f);});};AGIVertices['prototype'][_0x3083('0x74')]=function(_0x3c8ae9,_0x1f1c21){scripts[_0x3083('0x74')](this[_0x3083('0xb')][_0x3083('0x34')],_0x3c8ae9[_0x3083('0x75')],_0x3c8ae9['text'],_0x3c8ae9[_0x3083('0x76')]||'en')[_0x3083('0x11')](function(_0x44280c){_0x1f1c21(null,_0x44280c);})[_0x3083('0x13')](function(_0x1bbd2d){_0x1f1c21(_0x1bbd2d);});};AGIVertices[_0x3083('0xe')][_0x3083('0x77')]=function(_0x144697,_0x20d5c5){scripts[_0x3083('0x77')](this[_0x3083('0xb')][_0x3083('0x34')],_0x144697['dialogflowV2_project_id'],_0x144697[_0x3083('0x78')],_0x144697[_0x3083('0x79')],_0x144697[_0x3083('0x56')],_0x144697[_0x3083('0x7a')]||'en')[_0x3083('0x11')](function(_0x40f938){_0x20d5c5(null,_0x40f938);})[_0x3083('0x13')](function(_0x3b4f17){_0x20d5c5(_0x3b4f17);});};AGIVertices['prototype']['sestekNDA']=function(_0x1a932a,_0x42033f){scripts[_0x3083('0x7b')](this['channel'],_0x1a932a)[_0x3083('0x11')](function(_0x4a4fe6){_0x42033f(null,_0x4a4fe6);})[_0x3083('0x13')](function(_0x477185){_0x42033f(_0x477185);});};AGIVertices[_0x3083('0xe')]['ispeechTTS']=function(_0x432d38,_0x53815a){scripts[_0x3083('0x7c')](_0x432d38['key'],_0x432d38['text'],_0x432d38[_0x3083('0x7d')]||_0x3083('0x7e'),_0x432d38['speed'])[_0x3083('0x11')](function(_0x2c2829){_0x53815a(null,_0x2c2829);})['catch'](function(_0x351cdf){_0x53815a(_0x351cdf);});};AGIVertices[_0x3083('0xe')][_0x3083('0x7f')]=function(_0x47a9cb,_0x5d832f,_0x157b6e){scripts[_0x3083('0x7f')](_0x5d832f,_0x47a9cb[_0x3083('0x75')],_0x47a9cb[_0x3083('0x80')]||_0x3083('0x7e'),this[_0x3083('0x81')](_0x47a9cb['model'])?_0x47a9cb[_0x3083('0x82')]:undefined)[_0x3083('0x11')](function(_0x381b5b){_0x157b6e(null,_0x381b5b);})[_0x3083('0x13')](function(_0x5ea17b){_0x157b6e(_0x5ea17b);});};AGIVertices[_0x3083('0xe')][_0x3083('0x83')]=function(_0x17478b,_0x279c12){scripts['awsPolly'](_0x17478b['aws_access_key_id'],_0x17478b[_0x3083('0x84')],_0x17478b[_0x3083('0x85')],_0x17478b[_0x3083('0x86')]||'Amy',_0x17478b['text'],_0x17478b[_0x3083('0x87')]||_0x3083('0x56'))[_0x3083('0x11')](function(_0x2b52bb){_0x279c12(null,_0x2b52bb);})[_0x3083('0x13')](function(_0x2ffb0e){_0x279c12(_0x2ffb0e);});};AGIVertices[_0x3083('0xe')][_0x3083('0x88')]=function(_0x2a26ea,_0xb7cb24){scripts[_0x3083('0x88')](this[_0x3083('0xb')][_0x3083('0x34')],_0x2a26ea[_0x3083('0x89')],_0x2a26ea[_0x3083('0x84')],_0x2a26ea[_0x3083('0x8a')],_0x2a26ea[_0x3083('0x56')],_0x2a26ea[_0x3083('0x8b')])['then'](function(_0x4a84ce){_0xb7cb24(null,_0x4a84ce);})['catch'](function(_0x594866){_0xb7cb24(_0x594866);});};AGIVertices['prototype']['googleASR']=function(_0x471140,_0x26de07,_0xee0500){scripts['googleASR'](_0x26de07,_0x471140[_0x3083('0x75')],_0x471140[_0x3083('0x8c')]||_0x3083('0x7e'))[_0x3083('0x11')](function(_0x51cd44){_0xee0500(null,_0x51cd44);})[_0x3083('0x13')](function(_0x48aa1f){_0xee0500(_0x48aa1f);});};AGIVertices['prototype'][_0x3083('0x8d')]=function(_0x44234d,_0x2e5ad1,_0x389c1c){scripts[_0x3083('0x8d')](_0x2e5ad1,_0x44234d[_0x3083('0x8e')],_0x44234d['appsecret'],_0x44234d[_0x3083('0x6c')])[_0x3083('0x11')](function(_0x3bb702){_0x389c1c(null,_0x3bb702);})['catch'](function(_0x563d60){_0x389c1c(_0x563d60);});};AGIVertices[_0x3083('0xe')][_0x3083('0x8f')]=function(_0x50629e){var _0x1a620c=_[_0x3083('0x62')](verticesWithRetry,_0x50629e[_0x3083('0x32')])?_0x50629e:_[_0x3083('0x90')](_0x50629e);for(var _0x2ec99d in _0x1a620c){if(_0x1a620c[_0x3083('0x91')](_0x2ec99d)){if(_0x1a620c[_0x2ec99d]&&_['isString'](_0x1a620c[_0x2ec99d])){if(_[_0x3083('0x62')](recursiveMapAttributes,_0x2ec99d)){_0x1a620c[_0x2ec99d]=this[_0x3083('0x92')](_0x1a620c[_0x2ec99d]);}else{_0x1a620c[_0x2ec99d]=this['replaceAllVariables'](_0x1a620c[_0x2ec99d]);}}}}return _0x1a620c;};AGIVertices[_0x3083('0xe')][_0x3083('0x93')]=function(_0xdc957f){for(var _0x1416c3 in _0xdc957f){if(_0xdc957f['hasOwnProperty'](_0x1416c3)){if(_[_0x3083('0x94')](_0xdc957f[_0x1416c3])){this[_0x3083('0x93')](_0xdc957f[_0x1416c3]);}else if(_['isArray'](_0xdc957f[_0x1416c3])){for(var _0x13f557=0x0;_0x13f557<_0xdc957f[_0x1416c3][_0x3083('0x95')];_0x13f557++){this['recursiveNodeIndex'](_0xdc957f[_0x1416c3][_0x13f557]);}}else if(_[_0x3083('0x96')](_0xdc957f[_0x1416c3])){_0xdc957f[_0x1416c3]=this[_0x3083('0x97')](_0xdc957f[_0x1416c3]);}}}};AGIVertices[_0x3083('0xe')]['saveRestApiResult']=function(_0x408830,_0x302396){for(var _0x54a515 in _0x408830){if(_0x408830[_0x3083('0x91')](_0x54a515)){if(_[_0x3083('0x94')](_0x408830[_0x54a515])){if(!_[_0x3083('0x3e')](_0x408830[_0x54a515])){this['saveRestApiResult'](_0x408830[_0x54a515],util[_0x3083('0x24')](_0x3083('0x98'),_0x302396,_0x54a515));}}else if(_['isArray'](_0x408830[_0x54a515])){for(var _0x1c8934=0x0;_0x1c8934<_0x408830[_0x54a515][_0x3083('0x95')];_0x1c8934++){this[_0x3083('0x99')](_0x408830[_0x54a515][_0x1c8934],util['format'](_0x3083('0x98'),_0x302396,_0x54a515+'['+_0x1c8934+']'));}}else{if(!_[_0x3083('0x3f')](_0x408830[_0x54a515])){this[_0x3083('0xb')][_0x3083('0x9a')](util['format']('%s.%s',_0x302396,_0x54a515),_0x408830[_0x54a515]);}}}}};AGIVertices['prototype'][_0x3083('0x92')]=function(_0x265c44){try{var _0x16be43=JSON[_0x3083('0x66')](_0x265c44);this['recursiveNodeIndex'](_0x16be43);return JSON['stringify'](_0x16be43);}catch(_0x2568d4){return this[_0x3083('0x97')](_0x265c44);}};AGIVertices[_0x3083('0xe')][_0x3083('0x97')]=function(_0x1b6508){var _0x1f8522=_0x1b6508[_0x3083('0x9b')]('{');for(var _0x420a33=0x1;_0x420a33<_0x1f8522[_0x3083('0x95')];_0x420a33+=0x1){var _0x3c6eb9=_0x1f8522[_0x420a33][_0x3083('0x9b')]('}');if(_0x3c6eb9[_0x3083('0x95')]>0x1){_0x1b6508=_0x1b6508[_0x3083('0x9c')]('{'+_0x3c6eb9[0x0]+'}',this['channel'][_0x3083('0xf')](_0x3c6eb9[0x0])['extra']||_0x3c6eb9[0x0]);}}if(_0x1f8522['length']===0x1){return _0x1b6508[_0x3083('0x48')]();}return this[_0x3083('0x97')](_0x1b6508);};AGIVertices[_0x3083('0xe')][_0x3083('0x9d')]=function(_0x113bb2,_0x1c9680){var _0x13ad38=this[_0x3083('0xb')][_0x3083('0xf')](_0x113bb2);if(_0x13ad38[_0x3083('0x9e')]===-0x1){return _0x13ad38;}logger[_0x3083('0x27')](util[_0x3083('0x24')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1c9680,_0x13ad38[_0x3083('0x9f')]));return this[_0x3083('0xb')]['setVariable'](_0x1c9680,_0x13ad38[_0x3083('0x9f')]);};AGIVertices[_0x3083('0xe')][_0x3083('0x81')]=function(_0xad0a7d){return _0xad0a7d&&_0xad0a7d!=='0'&&_0xad0a7d!=='-1'&&_0xad0a7d!=='';};AGIVertices[_0x3083('0xe')][_0x3083('0xa0')]=function(_0x49831d){this['createSquareDetailsReport'][_0x3083('0x6b')](this,_0x49831d,'-');_0x49831d['retry']=_0x49831d[_0x3083('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3083('0xe')][_0x3083('0xa1')]=function(_0x38767e){logger['info'](util[_0x3083('0x24')](_0x3083('0xa2'),_0x38767e[_0x3083('0x31')]));if(!this['isConfigured'](_0x38767e[_0x3083('0x56')])){return this[_0x3083('0xb')]['noop']('no\x20text\x20configured');}var _0x4853a2='\x22'+_0x38767e['text']+'\x22';if(this[_0x3083('0x81')](_0x38767e[_0x3083('0x73')])){_0x4853a2+=','+_0x38767e[_0x3083('0x73')];}var _0x3711f7=this['channel'][_0x3083('0x52')](_0x3083('0xa3'),_0x4853a2);if(_0x3711f7[_0x3083('0x9e')]===-0x1){return _0x3711f7;}return this['channel'][_0x3083('0xa4')](util[_0x3083('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4853a2));};AGIVertices['prototype'][_0x3083('0xa5')]=function(_0x592bc3){logger['info'](util[_0x3083('0x24')](_0x3083('0xa6'),_0x592bc3[_0x3083('0x31')]));if(!this['isConfigured'](_0x592bc3['grammar'])){return this['channel'][_0x3083('0xa4')](_0x3083('0xa7'));}var _0x24cb46=_0x592bc3['grammar'];if(this[_0x3083('0x81')](_0x592bc3[_0x3083('0x73')])){_0x24cb46+=','+_0x592bc3[_0x3083('0x73')];}var _0x5286fa=this[_0x3083('0xb')][_0x3083('0x52')](_0x3083('0xa8'),_0x24cb46);if(_0x5286fa[_0x3083('0x9e')]===-0x1){return _0x5286fa;}var _0x3ad258=this[_0x3083('0x9d')](_0x3083('0xa9'),_0x3083('0xaa'));if(_0x3ad258['result']===-0x1){return _0x3ad258;}var _0x2a3414=this[_0x3083('0x9d')]('RECOG_INPUT()',_0x3083('0xab'));if(_0x2a3414[_0x3083('0x9e')]===-0x1){return _0x2a3414;}var _0x25e468=this['getAndSetVariable'](_0x3083('0xac'),'MRCP_RECOG_INSTANCE');if(_0x25e468[_0x3083('0x9e')]===-0x1){return _0x25e468;}return this[_0x3083('0xb')]['noop'](util['format'](_0x3083('0xad'),_0x24cb46));};AGIVertices[_0x3083('0xe')][_0x3083('0xae')]=function(_0x251e04){logger[_0x3083('0x27')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x251e04['label']));return this[_0x3083('0xb')][_0x3083('0xae')]([_0x251e04[_0x3083('0xaf')],_0x251e04[_0x3083('0xb0')]]);};AGIVertices[_0x3083('0xe')][_0x3083('0xb1')]=function(_0x47edba){logger[_0x3083('0x27')](util[_0x3083('0x24')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x47edba[_0x3083('0x31')]));if(this[_0x3083('0x81')](_0x47edba[_0x3083('0x60')])){logger['info'](util[_0x3083('0x24')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x47edba[_0x3083('0x60')]));var _0x18edff=this['channel']['wait'](_0x47edba[_0x3083('0x60')]);if(_0x18edff[_0x3083('0x9e')]===-0x1){return _0x18edff;}}return this[_0x3083('0xb')][_0x3083('0xb1')]();};AGIVertices['prototype'][_0x3083('0x46')]=function(_0x27545c){logger['info'](util['format'](_0x3083('0xb2'),_0x27545c[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x27545c[_0x3083('0x44')])){return this[_0x3083('0xb')][_0x3083('0x26')](_0x27545c,_0x3083('0xb3'));}_0x27545c['scheduledAt']=moment();if(this[_0x3083('0x81')](_0x27545c[_0x3083('0xb4')])){_0x27545c[_0x3083('0x45')]=moment()['add'](_0x27545c['delay'],_0x3083('0xb5'));}if(!this[_0x3083('0x81')](_0x27545c[_0x3083('0x49')])){_0x27545c[_0x3083('0x49')]=0x2;}this[_0x3083('0x3d')]['sync'](this,_0x27545c);return this['channel']['noop'](util[_0x3083('0x24')](_0x3083('0xb6'),_0x27545c[_0x3083('0x43')],_0x27545c[_0x3083('0x44')],_0x27545c[_0x3083('0x45')]));};AGIVertices[_0x3083('0xe')][_0x3083('0xb7')]=function(_0x59419d){logger['info'](util[_0x3083('0x24')](_0x3083('0xb8'),_0x59419d[_0x3083('0x31')]));var _0x3bf77a=this[_0x3083('0xb')][_0x3083('0x52')](_0x59419d[_0x3083('0xb9')],_0x59419d[_0x3083('0x73')]);if(_0x3bf77a[_0x3083('0x9e')]===-0x1){return _0x3bf77a;}return this['channel'][_0x3083('0xa4')](util['format'](_0x3083('0xba'),_0x59419d[_0x3083('0xb9')],_0x59419d['options']));};AGIVertices[_0x3083('0xe')][_0x3083('0xbb')]=function(_0x15eb51){logger['info'](util[_0x3083('0x24')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x15eb51[_0x3083('0x31')]));if(!this['isConfigured'](_0x15eb51['text'])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0xbc'));}var _0x259b2b='\x22'+_0x15eb51['text']+'\x22';if(this[_0x3083('0x81')](_0x15eb51['options'])){_0x259b2b+=','+_0x15eb51[_0x3083('0x73')];}var _0x165277=this[_0x3083('0xb')][_0x3083('0x52')]('MRCPSynth',_0x259b2b);if(_0x165277[_0x3083('0x9e')]===-0x1){return _0x165277;}return this[_0x3083('0xb')][_0x3083('0xa4')](util['format'](_0x3083('0xbd'),_0x259b2b));};AGIVertices[_0x3083('0xe')][_0x3083('0xbe')]=function(_0x298a5e){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0xbf'),_0x298a5e[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x298a5e['text'])){return this[_0x3083('0xb')][_0x3083('0xa4')]('no\x20text\x20configured');}var _0x2bed10='\x22'+_0x298a5e[_0x3083('0x56')]+'\x22';if(this[_0x3083('0x81')](_0x298a5e[_0x3083('0x73')])){_0x2bed10+=','+_0x298a5e[_0x3083('0x73')];}var _0x12598d=this[_0x3083('0xb')][_0x3083('0x52')](_0x3083('0xa3'),_0x2bed10);if(_0x12598d['result']===-0x1){return _0x12598d;}return this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0xbd'),_0x2bed10));};AGIVertices[_0x3083('0xe')][_0x3083('0xc0')]=function(_0x58bcc8){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0xc1'),_0x58bcc8[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x58bcc8[_0x3083('0xc2')])){return this[_0x3083('0xb')][_0x3083('0xa4')]('no\x20grammar\x20configured');}var _0x15414f=_0x58bcc8[_0x3083('0xc2')];if(this[_0x3083('0x81')](_0x58bcc8[_0x3083('0x73')])){_0x15414f+=','+_0x58bcc8[_0x3083('0x73')];}var _0x22e3c4=this[_0x3083('0xb')][_0x3083('0x52')]('MRCPRecog',_0x15414f);if(_0x22e3c4[_0x3083('0x9e')]===-0x1){return _0x22e3c4;}var _0x21f69d=this[_0x3083('0x9d')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x21f69d['result']===-0x1){return _0x21f69d;}var _0x531676=this[_0x3083('0x9d')](_0x3083('0xc3'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x531676[_0x3083('0x9e')]===-0x1){return _0x531676;}var _0x302694=this['getAndSetVariable']('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x302694[_0x3083('0x9e')]===-0x1){return _0x302694;}return this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')]('Executed\x20command\x20MRCPRecog\x20%s',_0x15414f));};AGIVertices[_0x3083('0xe')][_0x3083('0xc4')]=function(_0x5141d0){logger[_0x3083('0x27')](util[_0x3083('0x24')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5141d0[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x5141d0['grammar'])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0xa7'));}var _0x5b598d=_0x5141d0[_0x3083('0xc2')];if(this[_0x3083('0x81')](_0x5141d0[_0x3083('0x73')])){_0x5b598d+=','+_0x5141d0['options'];}var _0x15ac09=this[_0x3083('0xb')][_0x3083('0x52')](_0x3083('0xa8'),_0x5b598d);if(_0x15ac09['result']===-0x1){return _0x15ac09;}var _0x4e62aa=this[_0x3083('0x9d')](_0x3083('0xa9'),_0x3083('0xc5'));if(_0x4e62aa[_0x3083('0x9e')]===-0x1){return _0x4e62aa;}var _0x1e18eb=this[_0x3083('0x9d')](_0x3083('0xc3'),_0x3083('0xc6'));if(_0x1e18eb['result']===-0x1){return _0x1e18eb;}var _0x4b15e5=this[_0x3083('0x9d')](_0x3083('0xac'),_0x3083('0xc7'));if(_0x4b15e5[_0x3083('0x9e')]===-0x1){return _0x4b15e5;}return this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0xad'),_0x5b598d));};AGIVertices[_0x3083('0xe')]['database']=function(_0x1d8c8e){logger['info'](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x1d8c8e[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x1d8c8e['odbc_id'])){return this[_0x3083('0xb')][_0x3083('0x26')](_0x1d8c8e,_0x3083('0xc8'));}var _0x4bb641=this[_0x3083('0x16')][_0x3083('0x6b')](this,_0x1d8c8e[_0x3083('0xc9')]);if(!_0x4bb641){return this[_0x3083('0xb')]['error'](_0x1d8c8e,_0x3083('0xca'));}if(!this['isConfigured'](_0x1d8c8e[_0x3083('0x29')])){return this['channel'][_0x3083('0x26')](_0x1d8c8e,_0x3083('0xcb'));}var _0x3a8122=_0x1d8c8e[_0x3083('0x29')][_0x3083('0x53')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3083('0xb')][_0x3083('0xa4')](util['format'](_0x3083('0xcc'),_0x3a8122));var _0x5c9913=this[_0x3083('0x25')]['sync'](this,_0x4bb641,_0x3a8122);this[_0x3083('0x30')][_0x3083('0x6b')](this,_0x1d8c8e,_0x3a8122);if(!this[_0x3083('0x81')](_0x1d8c8e[_0x3083('0xcd')])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0xce'));}var _0x42a74c=this[_0x3083('0xf')]['sync'](this,_0x1d8c8e['variable_id']);if(!_0x42a74c){return this[_0x3083('0xb')][_0x3083('0x26')](_0x1d8c8e,_0x3083('0xcf'));}var _0x560bc7=this;_0x5c9913[_0x3083('0xd0')](function(_0x919499,_0x1abbac){Object[_0x3083('0xd1')](_0x919499)[_0x3083('0xd0')](function(_0x4f5118){_0x560bc7[_0x3083('0xb')][_0x3083('0x9a')](util[_0x3083('0x24')](_0x3083('0xd2'),_0x42a74c,_0x1abbac,_0x4f5118),_0x919499[_0x4f5118]);});});this['channel'][_0x3083('0x9a')](util[_0x3083('0x24')](_0x3083('0xd3'),_0x42a74c),_0x5c9913[_0x3083('0x95')]);return this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0xd4'),_0x42a74c));};AGIVertices[_0x3083('0xe')][_0x3083('0xd5')]=function(_0xe970a9){logger[_0x3083('0xd6')](util['format'](_0x3083('0xd7'),_0xe970a9['label']));if(!this['isConfigured'](_0xe970a9[_0x3083('0xd8')])){return this[_0x3083('0xb')][_0x3083('0x26')](_0xe970a9,_0x3083('0xd9'));}var _0x3ec2b4=this[_0x3083('0xda')][_0x3083('0x6b')](this,_0xe970a9[_0x3083('0xd8')]);if(!_0x3ec2b4){return this['channel']['error'](_0xe970a9,_0x3083('0xdb'));}var _0x1630d9=this['channel'][_0x3083('0x52')](_0x3083('0xdc'),[util[_0x3083('0x24')](_0x3083('0xdd'),_0x3ec2b4),_0xe970a9[_0x3083('0x60')],_0xe970a9['opts'],_0xe970a9[_0x3083('0x5e')]]);if(_0x1630d9['result']===-0x1){return _0x1630d9;}return this[_0x3083('0xb')][_0x3083('0xa4')](util['format']('Executed\x20command\x20%s',_0x3083('0xdc')));};AGIVertices[_0x3083('0xe')]['dialogflow']=function(_0xe91ebe){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0xde'),_0xe91ebe[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0xe91ebe['key'])){return this[_0x3083('0xb')]['noop']('no\x20key\x20configured');}if(!this[_0x3083('0x81')](_0xe91ebe[_0x3083('0x56')])){return this['channel'][_0x3083('0xa4')](_0x3083('0xbc'));}this[_0x3083('0xb')][_0x3083('0xdf')]=!![];this['createSquareDetailsReport'](_0xe91ebe);this['createSquareMessage'](_0xe91ebe[_0x3083('0x56')],'in','','');this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')]('Trying\x20Dialogflow:\x20%s',_0xe91ebe[_0x3083('0x56')]));var _0x1050ee=this[_0x3083('0x74')][_0x3083('0x6b')](this,_0xe91ebe);if(_0x1050ee){for(var _0xff62c6 in _0x1050ee){if(_0x1050ee[_0x3083('0x91')](_0xff62c6)){this['channel'][_0x3083('0x9a')](util['format']('DIALOGFLOW_%s',_0xff62c6[_0x3083('0x65')]()),_0x1050ee[_0xff62c6]);}}this[_0x3083('0x3c')](_0x1050ee[_0x3083('0xe0')],'out',_0x3083('0xe1'),'');return this[_0x3083('0xb')]['noop'](util['format'](_0x3083('0xe2'),_0x1050ee[_0x3083('0xe0')]));}return this['channel'][_0x3083('0x26')](_0xe91ebe,_0x3083('0xe3'));};AGIVertices[_0x3083('0xe')]['dialogflowV2']=function(_0x476ec0){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0xe4'),_0x476ec0[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x476ec0['dialogflowV2_project_id'])){return this['channel'][_0x3083('0xa4')](_0x3083('0xe5'));}if(!this[_0x3083('0x81')](_0x476ec0['client_email'])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0xe6'));}if(!this[_0x3083('0x81')](_0x476ec0['private_key'])){return this[_0x3083('0xb')]['noop'](_0x3083('0xe7'));}if(!this['isConfigured'](_0x476ec0[_0x3083('0x7a')])){return this['channel']['noop'](_0x3083('0xe8'));}if(!this[_0x3083('0x81')](_0x476ec0['text'])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0xbc'));}this['channel'][_0x3083('0xdf')]=!![];this[_0x3083('0x30')](_0x476ec0);this[_0x3083('0x3c')](_0x476ec0[_0x3083('0x56')],'in','','');this['channel'][_0x3083('0xa4')](util[_0x3083('0x24')]('Trying\x20DialogflowV2:\x20%s',_0x476ec0[_0x3083('0x56')]));var _0x5f4fce=this[_0x3083('0x77')][_0x3083('0x6b')](this,_0x476ec0);if(_0x5f4fce){for(var _0x3eefd3 in _0x5f4fce){if(_0x5f4fce[_0x3083('0x91')](_0x3eefd3)){if(_0x3eefd3!==_0x3083('0xe9')){this['channel'][_0x3083('0x9a')](util[_0x3083('0x24')](_0x3083('0xea'),_0x3eefd3[_0x3083('0x65')]()),_0x5f4fce[_0x3eefd3]);}}}this['createSquareMessage'](_0x5f4fce[_0x3083('0xe0')],_0x3083('0xeb'),_0x3083('0xec'),_0x5f4fce[_0x3083('0xe9')]);return this[_0x3083('0xb')]['noop'](util[_0x3083('0x24')]('DialogflowV2\x20Result\x20%s',_0x5f4fce['speech']));}return this[_0x3083('0xb')][_0x3083('0x26')](_0x476ec0,_0x3083('0xed'));};AGIVertices['prototype']['sesteknda']=function(_0x29c4e7){logger['info'](util[_0x3083('0x24')](_0x3083('0xee'),_0x29c4e7[_0x3083('0x31')]));if(!this['isConfigured'](_0x29c4e7[_0x3083('0xef')])){return this[_0x3083('0xb')][_0x3083('0xa4')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x3083('0x81')](_0x29c4e7['username'])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0xf0'));}if(!this[_0x3083('0x81')](_0x29c4e7[_0x3083('0xf1')])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0xf2'));}if(!this[_0x3083('0x81')](_0x29c4e7[_0x3083('0xf3')])){return this['channel'][_0x3083('0xa4')](_0x3083('0xbc'));}this[_0x3083('0xb')][_0x3083('0xdf')]=!![];this[_0x3083('0x30')](_0x29c4e7);this['createSquareMessage'](_0x29c4e7[_0x3083('0x56')],'in','','');this[_0x3083('0xb')]['noop'](util['format']('Trying\x20SestekNDA:\x20%s',_0x29c4e7[_0x3083('0x56')]));var _0x5039be=this['sestekNDA']['sync'](this,_0x29c4e7);if(_0x5039be){for(var _0x1368e4 in _0x5039be){if(_0x5039be[_0x3083('0x91')](_0x1368e4)){this[_0x3083('0xb')][_0x3083('0x9a')](util[_0x3083('0x24')]('SESTEK_NDA_%s',_0x1368e4[_0x3083('0x65')]()),_0x5039be[_0x1368e4]);}}this['createSquareMessage'](_0x5039be[_0x3083('0xe0')],'out',_0x3083('0xf4'),'');if(_0x5039be[_0x3083('0xf5')]){this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0xf6'),_0x5039be[_0x3083('0xf5')]));var _0x57fcb0=this['channel'][_0x3083('0xf7')](_0x5039be['audiofile']);try{fs[_0x3083('0xf8')](_0x5039be[_0x3083('0xf5')]+_0x3083('0xf9'));}catch(_0x27eaea){logger['error'](_0x27eaea);}return _0x57fcb0;}else{return this['channel']['noop'](util['format'](_0x3083('0xfa'),_0x5039be['speech']));}}return this[_0x3083('0xb')]['error'](_0x29c4e7,_0x3083('0xfb'));};AGIVertices[_0x3083('0xe')]['end']=function(_0x480542){logger['info'](util[_0x3083('0x24')](_0x3083('0xfc'),_0x480542[_0x3083('0x31')]));return this[_0x3083('0xb')]['noop'](_0x3083('0xfd'));};AGIVertices['prototype']['ext_dial']=function(_0x60f53c){logger[_0x3083('0x27')](util[_0x3083('0x24')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x60f53c[_0x3083('0x31')]));var _0x4f923f='';if(_0x60f53c[_0x3083('0xfe')]){if(!this[_0x3083('0x81')](_0x60f53c[_0x3083('0xfe')])){return this['channel']['error'](_0x60f53c,_0x3083('0xff'));}else{var _0x244ec9=parseInt(_0x60f53c[_0x3083('0xfe')],0xa);if(isNaN(_0x244ec9)){_0x4f923f=_0x60f53c['trunk_id'];}else{_0x4f923f=this[_0x3083('0x1a')][_0x3083('0x6b')](this,_0x60f53c[_0x3083('0xfe')]);if(!_0x4f923f){return this[_0x3083('0xb')][_0x3083('0x26')](_0x60f53c,_0x3083('0x100'));}}}}else if(_0x60f53c['trunk_name']){_0x4f923f=_0x60f53c[_0x3083('0x101')];}else{return this[_0x3083('0xb')][_0x3083('0x26')](_0x60f53c,_0x3083('0xff'));}var _0x35652e=this['channel']['exec'](_0x3083('0xdc'),[util[_0x3083('0x24')](_0x3083('0x102'),_0x4f923f,_0x60f53c[_0x3083('0x43')]),_0x60f53c[_0x3083('0x60')],_0x60f53c['opts'],_0x60f53c[_0x3083('0x5e')]]);if(_0x35652e[_0x3083('0x9e')]===-0x1){return _0x35652e;}return this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')]('Executed\x20command\x20%s',_0x3083('0xdc')));};AGIVertices[_0x3083('0xe')]['finally']=function(_0x1f5443){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x103'),_0x1f5443[_0x3083('0x31')]));return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x104'));};AGIVertices[_0x3083('0xe')][_0x3083('0x105')]=function(_0x296bb2){logger[_0x3083('0x27')](util['format'](_0x3083('0x106'),_0x296bb2[_0x3083('0x31')]));if(_0x296bb2[_0x3083('0x107')]===0x0){return this[_0x3083('0xa0')](_0x296bb2);}_0x296bb2['retry']-=0x1;if(!this[_0x3083('0x81')](_0x296bb2[_0x3083('0x108')])){return this[_0x3083('0xb')]['error'](_0x296bb2,_0x3083('0x109'));}var _0x54c1b9=this[_0x3083('0x1b')][_0x3083('0x6b')](this,_0x296bb2[_0x3083('0x108')]);if(!_0x54c1b9){return this[_0x3083('0xb')][_0x3083('0x26')](_0x296bb2,_0x3083('0x10a'));}if(!this[_0x3083('0x81')](_0x296bb2[_0x3083('0xcd')])){return this[_0x3083('0xb')]['error'](_0x3083('0xce'));}var _0xf167b=this[_0x3083('0xb')][_0x3083('0x10b')](_0x54c1b9,_0x296bb2[_0x3083('0x10c')],_0x296bb2['maxdigit']);var _0x2c766b=_0xf167b[_0x3083('0x9e')]?_0xf167b[_0x3083('0x9e')]['toString']():'';logger['info'](_0x3083('0x10d'),JSON[_0x3083('0x6f')](_0xf167b));if(_0xf167b[_0x3083('0x9e')]===-0x1){this[_0x3083('0x30')][_0x3083('0x6b')](this,_0x296bb2,_0x2c766b);return _0xf167b;}else if(_0xf167b[_0x3083('0x9f')]===_0x3083('0x60')){_0xf167b[_0x3083('0x9e')]=_0x2c766b['length']>=parseInt(_0x296bb2[_0x3083('0x10e')])?'x':'i';}else{_0xf167b[_0x3083('0x9e')]=_0x2c766b[_0x3083('0x95')]>=parseInt(_0x296bb2[_0x3083('0x10e')])&&_0x2c766b[_0x3083('0x95')]<=parseInt(_0x296bb2[_0x3083('0x10f')])?'x':'i';}var _0x36fc03=this[_0x3083('0xf')][_0x3083('0x6b')](this,_0x296bb2[_0x3083('0xcd')]);if(!_0x36fc03){return this['channel']['error'](_0x296bb2,_0x3083('0xcf'));}this['channel'][_0x3083('0x9a')](_0x36fc03,_0x2c766b);if(this[_0x3083('0x81')](_0x296bb2[_0x3083('0x110')])){var _0x3bf641=parseInt(_0x296bb2[_0x3083('0x110')],0xa);var _0xcaffa0=rs[_0x3083('0x111')]({'charset':'*','length':_0x3bf641});var _0x4e6046=_0x2c766b[_0x3083('0x95')];if(_0x4e6046>0x0){if(_0x4e6046>_0x3bf641){this['createSquareDetailsReport']['sync'](this,_0x296bb2,_0x296bb2['hiddendigitspos']===_0x3083('0x112')?_0xcaffa0+_0x2c766b[_0x3083('0x113')](_0x3bf641):_0x2c766b[_0x3083('0x113')](0x0,_0x4e6046-_0x3bf641)+_0xcaffa0);}else{this['createSquareDetailsReport'][_0x3083('0x6b')](this,_0x296bb2,rs[_0x3083('0x111')]({'charset':'*','length':_0x4e6046}));}}else{this['createSquareDetailsReport'][_0x3083('0x6b')](this,_0x296bb2,'');}}else{this['createSquareDetailsReport'][_0x3083('0x6b')](this,_0x296bb2,_0x2c766b);}return _0xf167b;};AGIVertices['prototype'][_0x3083('0x114')]=function(_0x10330c){logger[_0x3083('0x27')](util[_0x3083('0x24')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x10330c[_0x3083('0x31')]));return this['getdigits'](_0x10330c);};AGIVertices[_0x3083('0xe')][_0x3083('0x115')]=function(_0x2ef4e4){logger['info'](util[_0x3083('0x24')](_0x3083('0x116'),_0x2ef4e4[_0x3083('0x31')]));this[_0x3083('0x30')][_0x3083('0x6b')](this,_0x2ef4e4,_0x2ef4e4[_0x3083('0x117')]);return this['channel'][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x118'),_0x2ef4e4[_0x3083('0x117')]));};AGIVertices[_0x3083('0xe')]['awspolly']=function(_0x570127){logger[_0x3083('0x27')](util['format'](_0x3083('0x119'),_0x570127['label']));if(!this[_0x3083('0x81')](_0x570127['aws_access_key_id'])||!this[_0x3083('0x81')](_0x570127[_0x3083('0x84')])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x11a'));}if(!this['isConfigured'](_0x570127[_0x3083('0x56')])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0xbc'));}this['channel'][_0x3083('0xa4')](util['format'](_0x3083('0x11b'),_0x570127['text']));var _0x5a5054=this[_0x3083('0x83')][_0x3083('0x6b')](this,_0x570127);if(_0x5a5054){this[_0x3083('0xb')]['noop'](util[_0x3083('0x24')](_0x3083('0x11c'),_0x5a5054));var _0x390fb0=this[_0x3083('0xb')][_0x3083('0xf7')](_0x5a5054);try{fs['unlink'](_0x5a5054+_0x3083('0xf9'));}catch(_0x5a43cd){logger[_0x3083('0x26')](_0x5a43cd);}return _0x390fb0;}return this[_0x3083('0xb')]['error'](_0x570127,_0x3083('0x11d'));};AGIVertices[_0x3083('0xe')][_0x3083('0x11e')]=function(_0x1076ed){logger['info'](util[_0x3083('0x24')](_0x3083('0x11f'),_0x1076ed[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x1076ed['aws_access_key_id'])||!this['isConfigured'](_0x1076ed[_0x3083('0x84')])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x11a'));}if(!this[_0x3083('0x81')](_0x1076ed[_0x3083('0x8b')])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x120'));}if(!this['isConfigured'](_0x1076ed[_0x3083('0x56')])){return this[_0x3083('0xb')][_0x3083('0xa4')]('no\x20text\x20configured');}this[_0x3083('0xb')]['bot']=!![];this[_0x3083('0x30')](_0x1076ed);this['createSquareMessage'](_0x1076ed['text'],'in','','');this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x121'),_0x1076ed[_0x3083('0x56')]));var _0xf7e6da=this['awsLex'][_0x3083('0x6b')](this,_0x1076ed);if(_0xf7e6da){for(var _0xacf661 in _0xf7e6da){if(_0xf7e6da['hasOwnProperty'](_0xacf661)&&_[_0x3083('0x96')](_0xf7e6da[_0xacf661])){this[_0x3083('0xb')]['setVariable'](util[_0x3083('0x24')]('AWS_LEX_%s',_0xacf661[_0x3083('0x65')]()),_0xf7e6da[_0xacf661]);}}if(_[_0x3083('0x3f')](_0xf7e6da['message'])){return this[_0x3083('0xb')][_0x3083('0xa4')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x3083('0x3c')](_0xf7e6da[_0x3083('0x72')],'out',_0x3083('0x122'),'');return this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x123'),_0xf7e6da[_0x3083('0x72')]));}}return this[_0x3083('0xb')]['error'](_0x1076ed,_0x3083('0x124'));};AGIVertices[_0x3083('0xe')][_0x3083('0x125')]=function(_0x130864){logger[_0x3083('0x27')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x130864[_0x3083('0x31')],_0x130864[_0x3083('0x60')]));if(!this[_0x3083('0x81')](_0x130864[_0x3083('0x75')])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x126'));}var _0x2f83ac=_0x3083('0x127');var _0x46fc72=util[_0x3083('0x24')](_0x3083('0x128'),FILES_PATH,rs[_0x3083('0x111')](0x4));var _0xe299=util[_0x3083('0x24')](_0x3083('0x98'),_0x46fc72,_0x2f83ac);var _0x3c2f73=!![];if(_0x130864['beep']==='NOBEEP'){_0x3c2f73=![];}var _0x5a5452=this[_0x3083('0xb')]['recordFile'](_0x46fc72,_0x2f83ac,_0x130864[_0x3083('0x129')],_0x130864['timeout'],undefined,_0x3c2f73);if(_0x5a5452['result']!==-0x1){this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x12a'),_0xe299));var _0x13a52b=this['googleASR'][_0x3083('0x6b')](this,_0x130864,_0xe299);if(_0x13a52b){for(var _0x1e76c4 in _0x13a52b){if(_0x13a52b[_0x3083('0x91')](_0x1e76c4)){this[_0x3083('0xb')]['setVariable'](util[_0x3083('0x24')](_0x3083('0x12b'),_0x1e76c4['toUpperCase']()),_0x13a52b[_0x1e76c4]);}}return this['channel'][_0x3083('0xa4')](util['format'](_0x3083('0x12c'),JSON[_0x3083('0x6f')](_0x13a52b)));}}return _0x5a5452;};AGIVertices[_0x3083('0xe')][_0x3083('0x12d')]=function(_0xe43471){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x12e'),_0xe43471[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0xe43471['appid'])){return this['channel']['noop'](_0x3083('0x12f'));}if(!this[_0x3083('0x81')](_0xe43471[_0x3083('0x130')])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x131'));}var _0x309245=_0x3083('0x127');var _0x2e8e7f=util[_0x3083('0x24')]('%s/recordings/%s',FILES_PATH,rs[_0x3083('0x111')](0x4));var _0x1c3334=util[_0x3083('0x24')]('%s.%s',_0x2e8e7f,_0x309245);var _0x3eb835=!![];if(_0xe43471[_0x3083('0x132')]===_0x3083('0x133')){_0x3eb835=![];}var _0x394ab7=this['channel']['recordFile'](_0x2e8e7f,_0x309245,_0xe43471[_0x3083('0x129')],_0xe43471['timeout'],undefined,_0x3eb835);if(_0x394ab7[_0x3083('0x9e')]!==-0x1){this['channel'][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x134'),_0x1c3334));var _0x3ae2b2=this[_0x3083('0x8d')]['sync'](this,_0xe43471,_0x1c3334);if(_0x3ae2b2){for(var _0x287634 in _0x3ae2b2){if(_0x3ae2b2['hasOwnProperty'](_0x287634)){this[_0x3083('0xb')][_0x3083('0x9a')](util['format']('TILDE_ASR_%s',_0x287634['toUpperCase']()),_0x3ae2b2[_0x287634]);}}return this['channel'][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x135'),JSON[_0x3083('0x6f')](_0x3ae2b2)));}}return _0x394ab7;};AGIVertices[_0x3083('0xe')][_0x3083('0x136')]=function(_0x3dc206){logger[_0x3083('0x27')](util['format'](_0x3083('0x137'),_0x3dc206[_0x3083('0x31')]));return this[_0x3083('0xb')]['continueAt'](_0x3dc206[_0x3083('0x36')],_0x3dc206[_0x3083('0x37')],_0x3dc206[_0x3083('0x38')]);};AGIVertices[_0x3083('0xe')][_0x3083('0x138')]=function(_0x33d327){logger['info'](util[_0x3083('0x24')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x33d327[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x33d327[_0x3083('0x139')])){return this[_0x3083('0xb')]['error'](_0x33d327,_0x3083('0x13a'));}try{var _0x4ad6bf=eval(_0x33d327['condition'])?_0x3083('0x13b'):'false';this['channel']['noop'](util['format'](_0x3083('0x13c'),_0x33d327[_0x3083('0x139')],_0x4ad6bf));return{'code':0xc8,'result':_0x4ad6bf};}catch(_0x39a27d){return{'code':0xc8,'result':_0x3083('0x13d')};}};AGIVertices[_0x3083('0xe')][_0x3083('0x13e')]=function(_0x4d4577){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x13f'),_0x4d4577[_0x3083('0x31')]));if(!this['isConfigured'](_0x4d4577[_0x3083('0x140')])){return this[_0x3083('0xb')][_0x3083('0x26')](_0x4d4577,_0x3083('0x141'));}var _0x1308ac=this[_0x3083('0x1f')][_0x3083('0x6b')](this,_0x4d4577[_0x3083('0x140')]);if(!_0x1308ac){return this['channel']['error'](_0x4d4577,_0x3083('0x142'));}for(var _0x20288f=0x0;_0x20288f<_0x1308ac[_0x3083('0x95')];_0x20288f+=0x1){var _0x10db2e=this['channel'][_0x3083('0xf')](util[_0x3083('0x24')](_0x3083('0x143'),_0x1308ac[_0x20288f]));if(_0x10db2e['result']===-0x1){return _0x10db2e;}logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x144'),_0x1308ac[_0x20288f],_0x10db2e[_0x3083('0x9f')]));if(_0x10db2e['extra']===_0x3083('0x13b')){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x144'),_0x1308ac[_0x20288f],_0x3083('0x13b')));this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x144'),_0x1308ac[_0x20288f],_0x3083('0x13b')));return{'code':0xc8,'result':'true'};}else{logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x144'),_0x1308ac[_0x20288f],_0x3083('0x13d')));this['channel'][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x144'),_0x1308ac[_0x20288f],_0x3083('0x13d')));}}return{'code':0xc8,'result':_0x3083('0x13d')};};AGIVertices[_0x3083('0xe')]['hangup']=function(_0x4af5fa){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x145'),_0x4af5fa[_0x3083('0x31')]));return this[_0x3083('0xb')][_0x3083('0x146')]();};AGIVertices[_0x3083('0xe')][_0x3083('0x147')]=function(_0x281ff3){logger[_0x3083('0x27')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x281ff3[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x281ff3[_0x3083('0x75')])){return this[_0x3083('0xb')]['noop']('no\x20key\x20configured');}var _0x39c619=_0x3083('0x127');var _0x3ec12b=util['format'](_0x3083('0x128'),FILES_PATH,rs['generate'](0x4));var _0xb900a8=util[_0x3083('0x24')](_0x3083('0x98'),_0x3ec12b,_0x39c619);var _0x5d3e10=!![];if(_0x281ff3[_0x3083('0x132')]==='NOBEEP'){_0x5d3e10=![];}var _0x43cc0b=this[_0x3083('0xb')]['recordFile'](_0x3ec12b,_0x39c619,_0x281ff3[_0x3083('0x129')],_0x281ff3[_0x3083('0x60')],undefined,_0x5d3e10);if(_0x43cc0b[_0x3083('0x9e')]!==-0x1){this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x148'),_0xb900a8));var _0x187643=this[_0x3083('0x7f')]['sync'](this,_0x281ff3,_0xb900a8);if(_0x187643){for(var _0x193868 in _0x187643){if(_0x187643['hasOwnProperty'](_0x193868)){this[_0x3083('0xb')][_0x3083('0x9a')](util[_0x3083('0x24')](_0x3083('0x149'),_0x193868['toUpperCase']()),_0x187643[_0x193868]);}}return this[_0x3083('0xb')]['noop'](util[_0x3083('0x24')]('IspeechASR\x20Result\x20%s',JSON[_0x3083('0x6f')](_0x187643)));}}return _0x43cc0b;};AGIVertices[_0x3083('0xe')][_0x3083('0x14a')]=function(_0x46e39d){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x14b'),_0x46e39d[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x46e39d['key'])){return this[_0x3083('0xb')]['noop'](_0x3083('0x126'));}if(!this[_0x3083('0x81')](_0x46e39d[_0x3083('0x56')])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0xbc'));}this[_0x3083('0xb')][_0x3083('0xa4')](util['format'](_0x3083('0x14c'),_0x46e39d[_0x3083('0x56')]));var _0x1679db=this[_0x3083('0x7c')][_0x3083('0x6b')](this,_0x46e39d);if(_0x1679db){this['channel'][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x148'),_0x1679db));var _0x2b047a=this[_0x3083('0xb')][_0x3083('0xf7')](_0x1679db,_0x46e39d['intKey']);try{fs[_0x3083('0xf8')](_0x1679db+_0x3083('0xf9'));}catch(_0x3050be){logger[_0x3083('0x26')](_0x3050be);}return _0x2b047a;}return this['channel']['error'](_0x46e39d,_0x3083('0x14d'));};AGIVertices['prototype'][_0x3083('0x14e')]=function(_0x29dcc6){logger[_0x3083('0x27')](util['format'](_0x3083('0x14f'),_0x29dcc6['label']));if(!this['isConfigured'](_0x29dcc6[_0x3083('0x150')])){return this[_0x3083('0xb')][_0x3083('0x26')](_0x29dcc6,_0x3083('0x151'));}logger['info'](util['format'](_0x3083('0x152'),this['channel'][_0x3083('0x35')],_0x29dcc6['findBy']));var _0x4d30ad=this[_0x3083('0x50')][_0x3083('0x6b')](this,_0x29dcc6[_0x3083('0x150')]);if(_0x4d30ad){logger[_0x3083('0x27')](util['format'](_0x3083('0x153'),this['channel'][_0x3083('0x35')],_0x29dcc6['findBy']));this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x153'),this[_0x3083('0xb')][_0x3083('0x35')],_0x29dcc6[_0x3083('0x150')]));return{'code':0xc8,'result':_0x3083('0x154')};}else{logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x155'),this[_0x3083('0xb')][_0x3083('0x35')],_0x29dcc6[_0x3083('0x150')]));this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3083('0xb')]['callerid'],_0x29dcc6['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3083('0xe')][_0x3083('0x156')]=function(_0x30ee5d){logger['info'](util[_0x3083('0x24')](_0x3083('0x157'),_0x30ee5d['label']));if(!this[_0x3083('0x81')](_0x30ee5d[_0x3083('0x150')])){return this[_0x3083('0xb')][_0x3083('0x26')](_0x30ee5d,_0x3083('0x151'));}logger[_0x3083('0x27')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x3083('0x35')],_0x30ee5d[_0x3083('0x150')]));var _0x4ec144=this['agentLogout'][_0x3083('0x6b')](this,_0x30ee5d[_0x3083('0x150')]);if(_0x4ec144){logger['info'](util[_0x3083('0x24')](_0x3083('0x153'),this[_0x3083('0xb')][_0x3083('0x35')],_0x30ee5d[_0x3083('0x150')]));this[_0x3083('0xb')]['noop'](util[_0x3083('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x3083('0x35')],_0x30ee5d['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x3083('0x24')](_0x3083('0x155'),this[_0x3083('0xb')][_0x3083('0x35')],_0x30ee5d[_0x3083('0x150')]));this['channel'][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x155'),this[_0x3083('0xb')][_0x3083('0x35')],_0x30ee5d[_0x3083('0x150')]));return{'code':0xc8,'result':_0x3083('0x158')};}};AGIVertices['prototype']['math']=function(_0x4310d3){logger['info'](util[_0x3083('0x24')](_0x3083('0x159'),_0x4310d3[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x4310d3['operation'])){return this['channel'][_0x3083('0x26')](_0x4310d3,'no\x20operation\x20configured');}this[_0x3083('0xb')]['noop'](util[_0x3083('0x24')](_0x3083('0x15a'),_0x4310d3['operation']));var _0x3acba5=eval(_0x4310d3[_0x3083('0x15b')]);if(!this[_0x3083('0x81')](_0x4310d3[_0x3083('0xcd')])){return this[_0x3083('0xb')][_0x3083('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1f27e3=this[_0x3083('0xf')][_0x3083('0x6b')](this,_0x4310d3[_0x3083('0xcd')]);if(!_0x1f27e3){return this[_0x3083('0xb')]['error'](_0x4310d3,_0x3083('0xcf'));}if(_['isArray'](_0x3acba5)){var _0x1e8498=this;_0x3acba5['forEach'](function(_0x204580,_0x3f4313){_0x1e8498[_0x3083('0xb')]['setVariable'](util[_0x3083('0x24')](_0x3083('0x15c'),_0x1f27e3,_0x3f4313),_0x204580);});return this['channel']['noop'](util[_0x3083('0x24')]('variable\x20%s[key]\x20set',_0x1f27e3));}else{return this[_0x3083('0xb')]['setVariable'](_0x1f27e3,_0x3acba5);}};AGIVertices[_0x3083('0xe')][_0x3083('0x15d')]=function(_0x142c99){logger[_0x3083('0x27')](util[_0x3083('0x24')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x142c99[_0x3083('0x31')]));if(_0x142c99[_0x3083('0x107')]===0x0){return this[_0x3083('0xa0')](_0x142c99);}_0x142c99[_0x3083('0x107')]-=0x1;if(!this[_0x3083('0x81')](_0x142c99[_0x3083('0x108')])){return this[_0x3083('0xb')][_0x3083('0x26')](_0x142c99,'no\x20file\x20audio\x20selected');}var _0x4f7bd9=this[_0x3083('0x1b')][_0x3083('0x6b')](this,_0x142c99[_0x3083('0x108')]);if(!_0x4f7bd9){return this[_0x3083('0xb')]['error'](_0x142c99,_0x3083('0x10a'));}var _0x4397fd=this['channel'][_0x3083('0x10b')](_0x4f7bd9,_0x142c99[_0x3083('0x10c')],_0x142c99[_0x3083('0x15e')]);var _0x2e770f=_0x4397fd[_0x3083('0x9e')];if(_0x4397fd[_0x3083('0x9e')]===-0x1){this[_0x3083('0x30')]['sync'](this,_0x142c99,'-1');return _0x4397fd;}else if(_0x4397fd[_0x3083('0x9f')]==='timeout'){_0x4397fd[_0x3083('0x9e')]=_0x4397fd['result'][_0x3083('0x95')]>0x0?_0x4397fd[_0x3083('0x9e')]:'t';}else if(_['isEmpty'](_0x4397fd[_0x3083('0x9e')])){_0x4397fd[_0x3083('0x9e')]='#';_0x2e770f='#';}if(!this[_0x3083('0x81')](_0x142c99[_0x3083('0xcd')])){this[_0x3083('0xb')]['noop'](_0x3083('0xce'));}else{var _0x55a8a1=this[_0x3083('0xf')][_0x3083('0x6b')](this,_0x142c99[_0x3083('0xcd')]);if(!_0x55a8a1){return this[_0x3083('0xb')][_0x3083('0x26')](_0x142c99,_0x3083('0xcf'));}this[_0x3083('0xb')][_0x3083('0x9a')](_0x55a8a1,_0x2e770f);}this['createSquareDetailsReport'][_0x3083('0x6b')](this,_0x142c99,_0x2e770f);return _0x4397fd;};AGIVertices['prototype'][_0x3083('0xa4')]=function(_0x2fdac9){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x15f'),_0x2fdac9[_0x3083('0x31')]));return this[_0x3083('0xb')][_0x3083('0xa4')](_0x2fdac9[_0x3083('0x160')]||_0x2fdac9[_0x3083('0x31')]);};AGIVertices[_0x3083('0xe')]['pause']=function(_0x42ce7d){logger[_0x3083('0x27')](util['format'](_0x3083('0x161'),_0x42ce7d[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x42ce7d[_0x3083('0x150')])){return this[_0x3083('0xb')]['error'](_0x42ce7d,_0x3083('0x151'));}logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x152'),this[_0x3083('0xb')]['callerid'],_0x42ce7d['findBy']));var _0x5f4b05=this[_0x3083('0x4a')]['sync'](this,_0x42ce7d[_0x3083('0x162')]);var _0x528a3a=this[_0x3083('0x4b')]['sync'](this,_0x42ce7d[_0x3083('0x150')],_0x5f4b05);if(_0x528a3a){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x153'),this['channel']['callerid'],_0x42ce7d[_0x3083('0x150')]));this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x153'),this[_0x3083('0xb')][_0x3083('0x35')],_0x42ce7d[_0x3083('0x150')]));return{'code':0xc8,'result':_0x3083('0x154')};}else{logger['info'](util['format'](_0x3083('0x155'),this[_0x3083('0xb')][_0x3083('0x35')],_0x42ce7d['findBy']));this[_0x3083('0xb')][_0x3083('0xa4')](util['format'](_0x3083('0x153'),this[_0x3083('0xb')][_0x3083('0x35')],_0x42ce7d[_0x3083('0x150')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3083('0xe')][_0x3083('0x163')]=function(_0x5c2db9){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x164'),_0x5c2db9[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x5c2db9['file_id'])){return this[_0x3083('0xb')][_0x3083('0x26')](_0x5c2db9,_0x3083('0x109'));}var _0x58cc32=this[_0x3083('0x1b')][_0x3083('0x6b')](this,_0x5c2db9[_0x3083('0x108')]);if(!_0x58cc32){return this['channel']['error'](_0x5c2db9,_0x3083('0x10a'));}var _0x349b71=this[_0x3083('0xb')][_0x3083('0x52')]('PLAYBACK',[_0x58cc32,_0x5c2db9['opts']]);if(_0x349b71[_0x3083('0x9e')]===-0x1){return _0x349b71;}return this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0xba'),_0x3083('0x165'),_0x58cc32));};AGIVertices[_0x3083('0xe')][_0x3083('0x166')]=function(_0x4c38e8){logger[_0x3083('0x27')](util['format'](_0x3083('0x167'),_0x4c38e8[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x4c38e8[_0x3083('0x168')])){return this[_0x3083('0xb')]['error'](_0x4c38e8,_0x3083('0x169'));}var _0x562aa8='';var _0x295f28=parseInt(_0x4c38e8[_0x3083('0x168')],0xa);if(isNaN(_0x295f28)){_0x562aa8=_0x4c38e8[_0x3083('0x168')];}else{_0x562aa8=this[_0x3083('0x16a')][_0x3083('0x6b')](this,_0x4c38e8[_0x3083('0x168')]);if(!_0x562aa8){return this[_0x3083('0xb')][_0x3083('0x26')](_0x4c38e8,'no\x20queue\x20found');}}var _0x82cf00='';if(this['isConfigured'](_0x4c38e8['file_id'])){var _0x392302=this[_0x3083('0x1b')][_0x3083('0x6b')](this,_0x4c38e8[_0x3083('0x108')]);if(_0x392302){_0x82cf00=_0x392302;}}this['createSquareDetailsReport'][_0x3083('0x6b')](this,_0x4c38e8,_0x562aa8);if(_0x4c38e8[_0x3083('0x16b')][_0x3083('0x16c')]('x')<0x0){_0x4c38e8[_0x3083('0x16b')]+='x';}if(_0x4c38e8[_0x3083('0x16b')][_0x3083('0x16c')]('X')<0x0){_0x4c38e8[_0x3083('0x16b')]+='X';}this[_0x3083('0xb')][_0x3083('0x9a')](_0x3083('0x16d'),_0x562aa8?_0x562aa8['toLowerCase']():'');var _0x1b5556=this['channel'][_0x3083('0x52')](_0x3083('0x16e'),[_0x562aa8,_0x4c38e8[_0x3083('0x16b')],_0x4c38e8[_0x3083('0x5e')],_0x82cf00,_0x4c38e8[_0x3083('0x60')],_0x4c38e8[_0x3083('0xae')],_0x4c38e8[_0x3083('0x16f')],_0x4c38e8[_0x3083('0x170')],'',_0x4c38e8[_0x3083('0x171')]]);if(_0x1b5556[_0x3083('0x9e')]===-0x1){return _0x1b5556;}return this['channel'][_0x3083('0xa4')](util['format'](_0x3083('0xba'),'QUEUE',_0x562aa8));};AGIVertices[_0x3083('0xe')][_0x3083('0x172')]=function(_0x3c96ab){logger['info'](util[_0x3083('0x24')](_0x3083('0x173'),_0x3c96ab[_0x3083('0x31')]));var _0x505a06=_0x3c96ab[_0x3083('0x174')]||'wav';var _0x40f9d3=util[_0x3083('0x24')](_0x3083('0x175'),this[_0x3083('0xb')][_0x3083('0x34')],rs[_0x3083('0x111')](0x5));var _0x5c6ab5=util[_0x3083('0x24')]('%s/recordings/%s.%s',FILES_PATH,_0x40f9d3,_0x505a06);var _0x459c2e=util['format'](_0x3083('0x128'),FILES_PATH,_0x40f9d3);this['createSquareRecording'][_0x3083('0x6b')](this,_0x3c96ab,_0x40f9d3,_0x5c6ab5);this[_0x3083('0xb')][_0x3083('0x9a')](_0x3083('0x176'),_0x40f9d3);logger[_0x3083('0x27')](_0x3083('0x177'),_0x459c2e,_0x505a06,_0x3c96ab[_0x3083('0x178')],_0x3c96ab[_0x3083('0x60')]);return this[_0x3083('0xb')][_0x3083('0x179')](_0x459c2e,_0x505a06,_0x3c96ab['escape_digits'],_0x3c96ab[_0x3083('0x60')],undefined,!![]);};AGIVertices['prototype'][_0x3083('0x17a')]=function(_0x3e4aa6){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x17b'),_0x3e4aa6['label']));if(!this[_0x3083('0x81')](_0x3e4aa6['url'])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x17c'));}var _0x2f5755=this['restAPI'][_0x3083('0x6b')](this,_0x3e4aa6);logger['info'](util[_0x3083('0x24')](_0x3083('0x17d'),util['inspect'](_0x2f5755,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3e4aa6[_0x3083('0xcd')])){return this['channel'][_0x3083('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x17b8c4=this['getVariable'][_0x3083('0x6b')](this,_0x3e4aa6['variable_id']);if(!_0x17b8c4){return this[_0x3083('0xb')]['error'](_0x3e4aa6,_0x3083('0xcf'));}this[_0x3083('0xb')][_0x3083('0x9a')](util['format'](_0x3083('0x17e'),_0x17b8c4),_0x2f5755['statusCode']?_0x2f5755[_0x3083('0x71')]:_0x3083('0x17f'));this[_0x3083('0xb')][_0x3083('0x9a')](util[_0x3083('0x24')]('%s_STATUS_MESSAGE',_0x17b8c4),_0x2f5755[_0x3083('0x180')]?_0x2f5755[_0x3083('0x180')]:'OK');if(_0x2f5755['body']){try{this[_0x3083('0x99')](_0x2f5755[_0x3083('0x6d')],_0x17b8c4);}catch(_0x26faf5){logger[_0x3083('0x26')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x17b8c4));}}return this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0xd4'),_0x17b8c4));};AGIVertices[_0x3083('0xe')][_0x3083('0x181')]=function(_0x309bda){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x182'),_0x309bda[_0x3083('0x31')]));return this[_0x3083('0xb')][_0x3083('0x183')](_0x309bda[_0x3083('0x184')][_0x3083('0x53')](/\s+/g,''),_0x309bda['escape_digits']);};AGIVertices[_0x3083('0xe')][_0x3083('0x185')]=function(_0xba518){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x186'),_0xba518[_0x3083('0x31')]));return this[_0x3083('0xb')][_0x3083('0x187')](_0xba518['number'][_0x3083('0x53')](/\s+/g,''),_0xba518['escape_digits']);};AGIVertices[_0x3083('0xe')][_0x3083('0x188')]=function(_0x136efc){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x189'),_0x136efc[_0x3083('0x31')]));return this[_0x3083('0xb')][_0x3083('0x18a')](_0x136efc['text'],_0x136efc[_0x3083('0x178')]);};AGIVertices[_0x3083('0xe')][_0x3083('0x18b')]=function(_0x1aa0cc){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x18c'),_0x1aa0cc[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x1aa0cc[_0x3083('0x18d')])){return this['channel'][_0x3083('0xa4')](_0x3083('0x18e'));}var _0x2dfe8d=this[_0x3083('0x18f')][_0x3083('0x6b')](this,_0x1aa0cc[_0x3083('0x18d')]);if(!_0x2dfe8d||!_0x2dfe8d[_0x3083('0x190')]){return this[_0x3083('0xb')][_0x3083('0x26')](_0x1aa0cc,'no\x20mail\x20account\x20found');}var _0x435fa4={'from':util['format'](_0x3083('0x191'),_0x2dfe8d['name'],_0x2dfe8d[_0x3083('0x192')]||_0x2dfe8d[_0x3083('0x190')]['user']),'to':_0x1aa0cc['to']||'','cc':_0x1aa0cc['cc']||'','bcc':_0x1aa0cc['bcc']||'','subject':_0x1aa0cc[_0x3083('0x193')],'html':_0x1aa0cc[_0x3083('0x56')],'text':_0x1aa0cc['text']};if(this[_0x3083('0x81')](_0x1aa0cc['template_id'])){}logger['debug']('sendMail\x20message',JSON['stringify'](_0x435fa4));this['createSquareDetailsReport'][_0x3083('0x6b')](this,_0x1aa0cc,_0x1aa0cc['account_id']);this['channel'][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x194'),_0x2dfe8d[_0x3083('0x12')]));this[_0x3083('0x1e')][_0x3083('0x6b')](this,_0x2dfe8d[_0x3083('0x195')],_0x435fa4);return this['channel'][_0x3083('0xa4')](_0x3083('0x196'));};AGIVertices['prototype'][_0x3083('0x197')]=function(_0x53ce2d){logger[_0x3083('0x27')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x53ce2d[_0x3083('0x31')]));return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x198'));};AGIVertices[_0x3083('0xe')][_0x3083('0x199')]=function(_0x100a83){logger['info'](util[_0x3083('0x24')](_0x3083('0x19a'),_0x100a83[_0x3083('0x31')]));if(!this['isConfigured'](_0x100a83[_0x3083('0x19b')])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x19c'));}var _0x4194a3=this[_0x3083('0x2d')][_0x3083('0x6b')](this,_0x100a83[_0x3083('0x19b')]);if(!_0x4194a3){return this['channel'][_0x3083('0x26')](_0x100a83,_0x3083('0x19d'));}var _0x399f3a={'body':_0x100a83[_0x3083('0x19e')],'phone':_0x100a83['to']||'','SmsAccountId':_0x4194a3['id']};logger[_0x3083('0xd6')]('sendSMS\x20message',JSON['stringify'](_0x399f3a));this[_0x3083('0x30')][_0x3083('0x6b')](this,_0x100a83,_0x100a83[_0x3083('0x19b')]);this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4194a3[_0x3083('0x12')]));this['createSmsMessage'][_0x3083('0x6b')](this,_0x399f3a);return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x19f'));};AGIVertices[_0x3083('0xe')][_0x3083('0x1a0')]=function(_0x4da2e6){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x1a1'),_0x4da2e6[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x4da2e6[_0x3083('0xcd')])){return this[_0x3083('0xb')][_0x3083('0x26')](_0x4da2e6,_0x3083('0x1a2'));}var _0x5d710e=this['getVariable'][_0x3083('0x6b')](this,_0x4da2e6[_0x3083('0xcd')]);if(!_0x5d710e){return this[_0x3083('0xb')][_0x3083('0x26')](_0x4da2e6,'no\x20variable\x20found');}return this['channel'][_0x3083('0x9a')](_0x5d710e,_0x4da2e6[_0x3083('0x1a3')]);};AGIVertices['prototype']['start']=function(_0x36abe9){logger['info'](util[_0x3083('0x24')]('Enter\x20in\x20START\x20(%s)\x20block',_0x36abe9[_0x3083('0x31')]));this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x1a4'));if(_0x36abe9[_0x3083('0xb1')]===_0x3083('0x1a5')){this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x1a6'));return this[_0x3083('0xb')]['answer']();}return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x1a7'));};AGIVertices[_0x3083('0xe')][_0x3083('0x1a8')]=function(_0x55efaf){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x1a9'),_0x55efaf[_0x3083('0x31')]));if(!this['isConfigured'](_0x55efaf['project_id'])){return this['channel'][_0x3083('0x26')](_0x55efaf,_0x3083('0x1aa'));}var _0x1ef4fb=this[_0x3083('0x15')][_0x3083('0x6b')](this,_0x55efaf[_0x3083('0x1ab')]);if(!this[_0x3083('0x81')](_0x1ef4fb)){return this['channel'][_0x3083('0x26')](_0x55efaf,util[_0x3083('0x24')](_0x3083('0x1ac'),_0x55efaf[_0x3083('0x1ab')]));}if(_0x1ef4fb===this['channel'][_0x3083('0x3b')]){return this[_0x3083('0xb')][_0x3083('0x26')](_0x55efaf,_0x3083('0x1ad'));}this[_0x3083('0x30')][_0x3083('0x6b')](this,_0x55efaf,_0x1ef4fb);var _0x3dba40=this[_0x3083('0xb')][_0x3083('0x52')](_0x3083('0x1ae'),util[_0x3083('0x24')](_0x3083('0x1af'),config['agi'][_0x3083('0x1b0')]||_0x3083('0x1b1'),_0x1ef4fb,this[_0x3083('0xb')][_0x3083('0x3b')]));if(_0x3dba40[_0x3083('0x9e')]===-0x1){return _0x3dba40;}return this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0xba'),_0x3083('0x1ae'),_0x1ef4fb));};AGIVertices[_0x3083('0xe')][_0x3083('0x1b2')]=function(_0x969e55){logger['info'](util[_0x3083('0x24')](_0x3083('0x1b3'),_0x969e55[_0x3083('0x31')]));var _0xb19c2b=this[_0x3083('0x51')]['sync'](this,_0x969e55['command']);this[_0x3083('0x30')][_0x3083('0x6b')](this,_0x969e55,_0x969e55[_0x3083('0xaf')]);if(this['isConfigured'](_0x969e55[_0x3083('0xcd')])){var _0x246d61=this[_0x3083('0xf')][_0x3083('0x6b')](this,_0x969e55[_0x3083('0xcd')]);if(_0x246d61){this[_0x3083('0xb')][_0x3083('0x9a')](_0x246d61,_0xb19c2b);return this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x1b4'),_0x969e55[_0x3083('0xaf')],_0x246d61));}}return this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x1b5'),_0x969e55[_0x3083('0xaf')]));};AGIVertices[_0x3083('0xe')][_0x3083('0x1b6')]=function(_0x115107){logger[_0x3083('0x27')](util[_0x3083('0x24')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x115107['label']));_0x115107['text']=_0x115107[_0x3083('0x56')][_0x3083('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3083('0x81')](_0x115107[_0x3083('0x1b7')])){return this[_0x3083('0xb')][_0x3083('0xa4')](_0x3083('0x1b8'));}if(!this[_0x3083('0x81')](_0x115107[_0x3083('0x56')])){return this[_0x3083('0xb')]['noop'](_0x3083('0xbc'));}this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x1b9'),_0x115107['text']));var _0x1375e3=this[_0x3083('0x54')][_0x3083('0x6b')](this,_0x115107);if(_0x1375e3){this[_0x3083('0xb')][_0x3083('0xa4')](util['format'](_0x3083('0x1ba'),_0x1375e3));var _0x31bf50=this[_0x3083('0xb')][_0x3083('0xf7')](_0x1375e3);try{fs[_0x3083('0xf8')](_0x1375e3+'.wav');}catch(_0x237eb9){logger[_0x3083('0x26')](_0x237eb9);}return _0x31bf50;}return this[_0x3083('0xb')][_0x3083('0x26')](_0x115107,_0x3083('0x1bb'));};AGIVertices[_0x3083('0xe')][_0x3083('0x1bc')]=function(_0x60429){logger['info'](util['format'](_0x3083('0x1bd'),_0x60429['label']));_0x60429['text']=_0x60429[_0x3083('0x56')][_0x3083('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3083('0x81')](_0x60429[_0x3083('0x56')])){return this[_0x3083('0xb')][_0x3083('0xa4')]('no\x20text\x20configured');}this['channel'][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x1be'),_0x60429[_0x3083('0x56')]));var _0x36c48f=this['googleTTS']['sync'](this,_0x60429);if(_0x36c48f){this[_0x3083('0xb')][_0x3083('0xa4')](util['format'](_0x3083('0x1bf'),_0x36c48f));var _0x438d59=this[_0x3083('0xb')]['streamFile'](_0x36c48f);try{fs[_0x3083('0xf8')](_0x36c48f+_0x3083('0xf9'));}catch(_0x58e6c3){logger['error'](_0x58e6c3);}return _0x438d59;}return this['channel'][_0x3083('0x26')](_0x60429,_0x3083('0x1c0'));};AGIVertices[_0x3083('0xe')][_0x3083('0x1c1')]=function(_0x2c3f1f){logger[_0x3083('0x27')](util[_0x3083('0x24')](_0x3083('0x1c2'),_0x2c3f1f[_0x3083('0x31')]));if(!this[_0x3083('0x81')](_0x2c3f1f[_0x3083('0x150')])){return this[_0x3083('0xb')][_0x3083('0x26')](_0x2c3f1f,'no\x20find\x20by\x20configured');}logger[_0x3083('0x27')](util['format'](_0x3083('0x152'),this[_0x3083('0xb')][_0x3083('0x35')],_0x2c3f1f[_0x3083('0x150')]));var _0x2aafda=this[_0x3083('0x4c')][_0x3083('0x6b')](this,_0x2c3f1f[_0x3083('0x150')]);if(_0x2aafda){logger['info'](util[_0x3083('0x24')](_0x3083('0x153'),this[_0x3083('0xb')][_0x3083('0x35')],_0x2c3f1f[_0x3083('0x150')]));this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')](_0x3083('0x153'),this[_0x3083('0xb')][_0x3083('0x35')],_0x2c3f1f[_0x3083('0x150')]));return{'code':0xc8,'result':_0x3083('0x154')};}else{logger['info'](util[_0x3083('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x2c3f1f[_0x3083('0x150')]));this[_0x3083('0xb')][_0x3083('0xa4')](util[_0x3083('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x3083('0x35')],_0x2c3f1f[_0x3083('0x150')]));return{'code':0xc8,'result':_0x3083('0x158')};}};AGIVertices[_0x3083('0xe')]['voicemail']=function(_0x2d9ba7){logger['info'](util[_0x3083('0x24')](_0x3083('0x1c3'),_0x2d9ba7[_0x3083('0x31')]));var _0x175f34=this[_0x3083('0xb')][_0x3083('0x52')](_0x3083('0x1c4'),[_0x2d9ba7[_0x3083('0x1c5')],_0x2d9ba7[_0x3083('0x73')]]);if(_0x175f34[_0x3083('0x9e')]===-0x1){return _0x175f34;}return this[_0x3083('0xb')]['noop'](util[_0x3083('0x24')](_0x3083('0xba'),_0x3083('0x1c4'),_0x2d9ba7[_0x3083('0x1c5')]));};AGIVertices[_0x3083('0xe')][_0x3083('0x1c6')]=function(_0x4b0fcd){logger['info'](util[_0x3083('0x24')](_0x3083('0x1c7'),_0x4b0fcd[_0x3083('0x31')]));if(!this['isConfigured'](_0x4b0fcd[_0x3083('0xcd')])){return this[_0x3083('0xb')][_0x3083('0x26')](_0x4b0fcd,_0x3083('0x1a2'));}var _0x2ac89e=this['getVariable'][_0x3083('0x6b')](this,_0x4b0fcd['variable_id']);if(!_0x2ac89e){return this[_0x3083('0xb')]['error'](_0x4b0fcd,_0x3083('0xcf'));}var _0x3db423=this[_0x3083('0xb')]['getVariable'](_0x2ac89e);return{'code':0xc8,'result':_0x3db423[_0x3083('0x9f')]?_0x3db423[_0x3083('0x9f')]:'-'};};String[_0x3083('0xe')]['replaceAll']=function(_0x23ca9e,_0x382c54){return this[_0x3083('0x9b')](_0x23ca9e)[_0x3083('0x1c8')](_0x382c54);};module[_0x3083('0x1c9')]=AGIVertices; \ No newline at end of file +var _0x151b=['computedVariables','sync','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','includes','replaceObjectAllVariables','isPlainObject','length','recursiveNodeIndex','replaceAllVariables','saveRestApiResult','%s.%s','isArray','setVariable','stringify','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','label','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','list_id','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','%s/recordings/%s','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','wav','beep','NOBEEP','recordFile','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','true','IFTIME\x20%s\x20%s','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','no\x20variable\x20found','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','gosub','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','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','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','yes','Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','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','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unlink','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','odbc','moment','mustache','request-promise','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','menu','getdigits','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','getVoiceQueue','catch','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','interval','map','Intervals','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','channel','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','url','method','timeout','number','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function'];(function(_0x38c184,_0x4fe373){var _0x1f5324=function(_0x261cf7){while(--_0x261cf7){_0x38c184['push'](_0x38c184['shift']());}};_0x1f5324(++_0x4fe373);}(_0x151b,0x153));var _0xb151=function(_0x13b199,_0xf89da3){_0x13b199=_0x13b199-0x0;var _0x394577=_0x151b[_0x13b199];return _0x394577;};'use strict';var fs=require('fs');var util=require(_0xb151('0x0'));var _=require('lodash');var sh=require('shelljs');var odbc=require(_0xb151('0x1'))();var rs=require('randomstring');var moment=require(_0xb151('0x2'));var Mustache=require(_0xb151('0x3'));var rp=require(_0xb151('0x4'));var logger=require('../../config/logger')('agi');var config=require(_0xb151('0x5'));var shared=require(_0xb151('0x6'));var scripts=require('./scripts');var FILES_PATH=_0xb151('0x7');var recursiveMapAttributes=['rawHeaders',_0xb151('0x8')];var verticesWithRetry=[_0xb151('0x9'),_0xb151('0xa'),'getsecretdigits'];var AGIVertices=function(_0x47baa2,_0x15cf84,_0x20f1b2){this['channel']=_0x47baa2;this['rpc']=_0x15cf84;this[_0xb151('0xb')]=_0x20f1b2;};AGIVertices[_0xb151('0xc')][_0xb151('0xd')]=function(_0x22c475,_0x3ee287){this[_0xb151('0xe')][_0xb151('0xf')](_0x22c475)[_0xb151('0x10')](function(_0x39cf22){_0x3ee287(null,_0x39cf22?_0x39cf22[_0xb151('0x11')]:![]);})['catch'](function(_0x1ae9b4){_0x3ee287(_0x1ae9b4);});};AGIVertices['prototype'][_0xb151('0x12')]=function(_0x389a96,_0x27f878){this[_0xb151('0xe')]['getVoiceQueueById'](_0x389a96)[_0xb151('0x10')](function(_0x2a5b24){_0x27f878(null,_0x2a5b24?_0x2a5b24[_0xb151('0x11')]:![]);})['catch'](function(_0x56ea81){_0x27f878(_0x56ea81);});};AGIVertices[_0xb151('0xc')]['getSquareProject']=function(_0x3ff606,_0x4ca435){this[_0xb151('0xe')]['getSquareProjectById'](_0x3ff606)['then'](function(_0x35aa2f){_0x4ca435(null,_0x35aa2f?_0x35aa2f[_0xb151('0x11')]:![]);})[_0xb151('0x13')](function(_0x2ba8bf){_0x4ca435(_0x2ba8bf);});};AGIVertices[_0xb151('0xc')][_0xb151('0x14')]=function(_0x1e2b38,_0x5525fd){this[_0xb151('0xe')][_0xb151('0x15')](_0x1e2b38)['then'](function(_0x1fe113){_0x5525fd(null,_0x1fe113?_0x1fe113[_0xb151('0x16')]:![]);})[_0xb151('0x13')](function(_0x3a211a){_0x5525fd(_0x3a211a);});};AGIVertices[_0xb151('0xc')][_0xb151('0x17')]=function(_0x3f375d,_0x8ab45){this[_0xb151('0xe')][_0xb151('0x18')](_0x3f375d)['then'](function(_0x432dce){_0x8ab45(null,_0x432dce?_0x432dce[_0xb151('0x11')]:![]);})[_0xb151('0x13')](function(_0x41c508){_0x8ab45(_0x41c508);});};AGIVertices[_0xb151('0xc')][_0xb151('0x19')]=function(_0xd22ee1,_0x40580d){this[_0xb151('0xe')]['getTrunkById'](_0xd22ee1)[_0xb151('0x10')](function(_0x46b235){_0x40580d(null,_0x46b235?_0x46b235[_0xb151('0x11')]:![]);})[_0xb151('0x13')](function(_0x2d65f8){_0x40580d(_0x2d65f8);});};AGIVertices[_0xb151('0xc')][_0xb151('0x1a')]=function(_0x2dc1b4,_0x5b6f83){var _0x37ff13=this;this['rpc'][_0xb151('0x1b')](_0x2dc1b4)[_0xb151('0x10')](function(_0x5e494c){_0x5b6f83(null,_0x5e494c?_0x37ff13[_0xb151('0x1c')](_0x5e494c['save_name']):![]);})[_0xb151('0x13')](function(_0x45dc3c){_0x5b6f83(_0x45dc3c);});};AGIVertices[_0xb151('0xc')][_0xb151('0x1d')]=function(_0x3ed573,_0x444af1){this[_0xb151('0xe')][_0xb151('0x1e')](_0x3ed573)['then'](function(_0x37722e){_0x444af1(null,_0x37722e?_0x37722e:![]);})[_0xb151('0x13')](function(_0x29d083){_0x444af1(_0x29d083);});};AGIVertices[_0xb151('0xc')][_0xb151('0x1f')]=function(_0x438888,_0xc363d2,_0x4c8388){this[_0xb151('0xb')][_0xb151('0x1f')](_0x438888,_0xc363d2)[_0xb151('0x10')](function(){_0x4c8388(null);})[_0xb151('0x13')](function(_0x2fdd66){_0x4c8388(_0x2fdd66);});};AGIVertices['prototype']['getIntervals']=function(_0x4032d7,_0x32ee08){this[_0xb151('0xe')][_0xb151('0x20')](_0x4032d7)['then'](function(_0x3e4b06){if(_0x3e4b06){if(_0x3e4b06['IntervalId']){_0x32ee08(null,[_0x3e4b06[_0xb151('0x21')]]);}else{_0x32ee08(null,_[_0xb151('0x22')](_0x3e4b06[_0xb151('0x23')],_0xb151('0x21')));}}else{_0x32ee08(null,![]);}})[_0xb151('0x13')](function(_0x29c011){_0x32ee08(_0x29c011);});};AGIVertices[_0xb151('0xc')][_0xb151('0x1c')]=function(_0x1378e9){return util[_0xb151('0x24')](_0xb151('0x25'),FILES_PATH,_0x1378e9);};AGIVertices['prototype'][_0xb151('0x26')]=function(_0x456de2,_0x260a1f,_0x5f22dd){odbc[_0xb151('0x27')](_0x456de2,function(_0x2f9f48){if(_0x2f9f48){logger[_0xb151('0x28')](_0xb151('0x29'),_0x2f9f48);_0x5f22dd(_0x2f9f48);}else{logger[_0xb151('0x2a')](_0xb151('0x2b'));odbc[_0xb151('0x2c')](_0x260a1f,function(_0x39dc3d,_0x76fc6){if(_0x39dc3d){logger[_0xb151('0x2a')](_0xb151('0x2d'),_0x260a1f);_0x5f22dd(_0x39dc3d);}else{logger['info'](_0xb151('0x2e'),_0x260a1f);odbc['close'](function(_0x31f1fb){if(_0x31f1fb){logger[_0xb151('0x28')](_0xb151('0x2f'),_0x31f1fb);}_0x5f22dd(null,_0x76fc6);});}});}});};AGIVertices[_0xb151('0xc')][_0xb151('0x30')]=function(_0x47035e,_0x88a7){this['rpc'][_0xb151('0x31')](_0x47035e)[_0xb151('0x10')](function(_0x135e52){_0x88a7(null,_0x135e52?_0x135e52:![]);})[_0xb151('0x13')](function(_0x802eba){_0x88a7(_0x802eba);});};AGIVertices[_0xb151('0xc')][_0xb151('0x32')]=function(_0x3b40e3,_0x31f531){this[_0xb151('0xe')][_0xb151('0x32')](_0x3b40e3)[_0xb151('0x10')](function(_0x2b0a07){_0x31f531(null,_0x2b0a07);})[_0xb151('0x13')](function(_0x3499ed){_0x31f531(_0x3499ed);});};AGIVertices[_0xb151('0xc')][_0xb151('0x33')]=function(_0x4075bf,_0x27fbe4,_0x407605){this[_0xb151('0xe')][_0xb151('0x33')]({'uniqueid':this[_0xb151('0x34')][_0xb151('0x35')],'node':_0x4075bf['label'],'application':_0x4075bf[_0xb151('0x36')],'data':_0x27fbe4||null,'project_name':this[_0xb151('0x34')][_0xb151('0x37')],'callerid':this[_0xb151('0x34')][_0xb151('0x38')]})[_0xb151('0x10')](function(_0x5c84b5){if(_0x407605){_0x407605(null,_0x5c84b5);}})[_0xb151('0x13')](function(_0x3ff2c0){if(_0x407605){_0x407605(_0x3ff2c0);}});};AGIVertices[_0xb151('0xc')][_0xb151('0x39')]=function(_0x19fe25,_0x1b9d80,_0xd016a,_0x9003e9){this[_0xb151('0xe')][_0xb151('0x39')]({'uniqueid':this['channel'][_0xb151('0x35')],'callerid':this['channel'][_0xb151('0x38')],'calleridname':this[_0xb151('0x34')][_0xb151('0x3a')],'context':this['channel'][_0xb151('0x3b')],'extension':this['channel'][_0xb151('0x3c')],'priority':this[_0xb151('0x34')][_0xb151('0x3d')],'accountcode':this[_0xb151('0x34')][_0xb151('0x3e')],'dnid':this['channel'][_0xb151('0x3f')],'projectName':this['channel'][_0xb151('0x37')],'saveName':_0x1b9d80,'filename':_0x19fe25[_0xb151('0x40')]||_0x1b9d80,'savePath':_0xd016a})[_0xb151('0x10')](function(_0x2ce3ca){_0x9003e9(null,_0x2ce3ca);})['catch'](function(_0x41b047){_0x9003e9(_0x41b047);});};AGIVertices[_0xb151('0xc')][_0xb151('0x41')]=function(_0x2cb92c,_0x5b722e,_0x409e96,_0x59aa3b,_0x3d67aa){this[_0xb151('0xe')][_0xb151('0x41')]({'uniqueid':this[_0xb151('0x34')][_0xb151('0x35')],'body':_0x2cb92c,'direction':_0x5b722e,'providerName':_0x409e96,'providerResponse':_0x59aa3b})['then'](function(_0x4bae3a){if(_0x3d67aa){_0x3d67aa(null,_0x4bae3a);}})[_0xb151('0x13')](function(_0x261aa5){if(_0x3d67aa){_0x3d67aa(_0x261aa5);}});};AGIVertices[_0xb151('0xc')][_0xb151('0x42')]=function(_0x20edbf,_0x4cb261){this[_0xb151('0xe')]['createCmContact']({'firstName':_[_0xb151('0x43')](_0x20edbf['name'])||_[_0xb151('0x44')](_0x20edbf[_0xb151('0x11')])?'callback_'+Math[_0xb151('0x45')]():_0x20edbf[_0xb151('0x11')],'lastName':_[_0xb151('0x43')](_0x20edbf[_0xb151('0x46')])||_[_0xb151('0x44')](_0x20edbf[_0xb151('0x46')])?null:_0x20edbf['lastName'],'phone':_0x20edbf['phone'],'ListId':_0x20edbf['list_id'],'scheduledat':_0x20edbf[_0xb151('0x47')],'callbackUniqueid':this[_0xb151('0x34')][_0xb151('0x35')],'tags':_0xb151('0x48'),'description':_0xb151('0x49')+_0x20edbf['scheduledAt'][_0xb151('0x4a')](),'priority':_0x20edbf['callback_priority']})['then'](function(_0x43a2bf){_0x4cb261(null,_0x43a2bf);})[_0xb151('0x13')](function(_0x5c6bfd){_0x4cb261(_0x5c6bfd);});};AGIVertices['prototype'][_0xb151('0x4b')]=function(_0x6ab98,_0x112c61){this[_0xb151('0xe')][_0xb151('0x4c')](_0x6ab98)[_0xb151('0x10')](function(_0x1f7eda){_0x112c61(null,_0x1f7eda?_0x1f7eda['name']:![]);})[_0xb151('0x13')](function(_0x15d695){_0x112c61(_0x15d695);});};AGIVertices[_0xb151('0xc')][_0xb151('0x4d')]=function(_0x4ca0fc,_0x1754b2,_0x384424){var _0x1da891={'role':_0xb151('0x4e')};_0x1da891[_0x4ca0fc]=this[_0xb151('0x34')][_0xb151('0x38')];this['rpc']['agentPause'](_0x1da891,_0x1754b2,this[_0xb151('0x34')][_0xb151('0x35')])[_0xb151('0x10')](function(_0xe59243){_0x384424(null,_[_0xb151('0x44')](_0xe59243)?![]:!![]);})['catch'](function(_0x3e8e48){logger[_0xb151('0x28')](_0x3e8e48);_0x384424(null,![]);});};AGIVertices['prototype'][_0xb151('0x4f')]=function(_0x442c8e,_0x213fa5){var _0x4d741e={'role':_0xb151('0x4e')};_0x4d741e[_0x442c8e]=this['channel'][_0xb151('0x38')];this[_0xb151('0xe')][_0xb151('0x4f')](_0x4d741e)[_0xb151('0x10')](function(_0x26a7e4){_0x213fa5(null,_[_0xb151('0x44')](_0x26a7e4)?![]:!![]);})[_0xb151('0x13')](function(_0xfd9abe){logger[_0xb151('0x28')](_0xfd9abe);_0x213fa5(null,![]);});};AGIVertices[_0xb151('0xc')][_0xb151('0x50')]=function(_0x996523,_0x5efd97){var _0x216575={'role':_0xb151('0x4e')};_0x216575[_0x996523]=this['channel'][_0xb151('0x38')];this[_0xb151('0xe')]['agentLogout'](_0x216575)[_0xb151('0x10')](function(_0x2ce42b){_0x5efd97(null,_[_0xb151('0x44')](_0x2ce42b)?![]:!![]);})[_0xb151('0x13')](function(_0x5994c3){logger[_0xb151('0x28')](_0x5994c3);_0x5efd97(null,![]);});};AGIVertices[_0xb151('0xc')][_0xb151('0x51')]=function(_0x50fc7d,_0x1723cb){var _0x197e73={'role':_0xb151('0x4e')};_0x197e73[_0x50fc7d]=this['channel'][_0xb151('0x38')];var _0x448ff0=_0x50fc7d!='internal'?util[_0xb151('0x24')](_0xb151('0x52'),_0xb151('0x53'),this[_0xb151('0x34')][_0xb151('0x38')]):undefined;this[_0xb151('0xe')][_0xb151('0x51')](_0x197e73,_0x448ff0)['then'](function(_0x1dcc8d){_0x1723cb(null,_[_0xb151('0x44')](_0x1dcc8d)?![]:!![]);})['catch'](function(_0x572c51){logger[_0xb151('0x28')](_0x572c51);_0x1723cb(null,![]);});};AGIVertices[_0xb151('0xc')][_0xb151('0x54')]=function(_0x46b7d0,_0x5d41d5){sh[_0xb151('0x55')](_[_0xb151('0x56')](_0x46b7d0),function(_0x4f65a0,_0x49e2fc){var _0x420b0c=_0x49e2fc[_0xb151('0x57')](/(\r\n|\n|\r)/gm,'');_0x5d41d5(null,_0x420b0c);});};AGIVertices['prototype'][_0xb151('0x58')]=function(_0x42a051,_0x326423){scripts['googleCloudTTS'](_0x42a051['apiKey'],_0x42a051[_0xb151('0x59')]||_0xb151('0x5a'),_0x42a051['text'],_0x42a051[_0xb151('0x5b')]||'en-US',_0x42a051[_0xb151('0x5c')]||_0xb151('0x5d'),_0x42a051[_0xb151('0x5e')]||_0xb151('0x5f'))[_0xb151('0x10')](function(_0x961666){_0x326423(null,_0x961666);})['catch'](function(_0x1a14c2){_0x326423(_0x1a14c2);});};AGIVertices[_0xb151('0xc')][_0xb151('0x60')]=function(_0xeb662e,_0x1dfb16){scripts[_0xb151('0x60')](_0xeb662e['text'],_0xeb662e['google_tts_language']||'en',0x1)['then'](function(_0x2ec1d9){_0x1dfb16(null,_0x2ec1d9);})['catch'](function(_0x238faa){_0x1dfb16(_0x238faa);});};AGIVertices['prototype']['restAPI']=function(_0x5f5c24,_0x145b10){var _0x1a9f1a={'uri':_0x5f5c24[_0xb151('0x61')],'method':_0x5f5c24[_0xb151('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5f5c24[_0xb151('0x63')])===_0xb151('0x64')&&parseInt(_0x5f5c24[_0xb151('0x63')])>=0x1?parseInt(_0x5f5c24['timeout'])*0x3e8:0x5*0x3e8};if(_['includes'](['POST','PUT'],_0x1a9f1a[_0xb151('0x62')][_0xb151('0x65')]())){try{_0x1a9f1a[_0xb151('0x66')]=_0x5f5c24[_0xb151('0x8')]?JSON[_0xb151('0x67')](_0x5f5c24[_0xb151('0x8')]):{};}catch(_0x3c946c){logger[_0xb151('0x28')](_0xb151('0x68'),_0x3c946c);}}try{_0x1a9f1a[_0xb151('0x69')]=_0x5f5c24['rawHeaders']?JSON[_0xb151('0x67')](_0x5f5c24['rawHeaders']):{};}catch(_0x64b1f3){logger['error'](_0xb151('0x6a'),_0x64b1f3);}if(_0x5f5c24['computedVariables']){try{var _0x53a2f2=require(_0x5f5c24[_0xb151('0x6b')])[_0xb151('0x6c')](this,_0x1a9f1a);_0x1a9f1a['uri']=Mustache[_0xb151('0x6d')](_0x5f5c24[_0xb151('0x61')],_0x53a2f2,{},['$$','$$']);if(_0x1a9f1a[_0xb151('0x69')]){_0x1a9f1a[_0xb151('0x69')]=JSON[_0xb151('0x67')](Mustache['render'](JSON['stringify'](_0x1a9f1a['headers']),_0x53a2f2,{},['$$','$$']));}if(_0x1a9f1a[_0xb151('0x66')]){_0x1a9f1a['body']=JSON['parse'](Mustache[_0xb151('0x6d')](JSON['stringify'](_0x1a9f1a[_0xb151('0x66')]),_0x53a2f2,{},['$$','$$']));}}catch(_0x3bb298){logger[_0xb151('0x28')](_0xb151('0x6e'),_0x3bb298);}}rp(_0x1a9f1a)[_0xb151('0x10')](function(_0x522684){var _0x520cee={'statusCode':_0x522684[_0xb151('0x6f')]||0xc8,'statusMessage':_0x522684[_0xb151('0x70')]||'OK','headers':_0x522684['headers']||{},'body':_0x522684[_0xb151('0x66')]||{}};_0x145b10(null,_0x520cee);})['catch'](function(_0x3cd8cb){var _0xfc2254={'statusCode':_0x3cd8cb[_0xb151('0x6f')]||0x1f4,'statusMessage':_0x3cd8cb[_0xb151('0x71')]||_0xb151('0x72'),'headers':_0x3cd8cb[_0xb151('0x73')][_0xb151('0x69')]||{},'body':_0x3cd8cb[_0xb151('0x73')][_0xb151('0x66')]||{}};_0x145b10(null,_0xfc2254);});};AGIVertices[_0xb151('0xc')]['googleDialogflow']=function(_0xd4ff2c,_0x233f85){scripts[_0xb151('0x74')](this[_0xb151('0x34')][_0xb151('0x35')],_0xd4ff2c[_0xb151('0x75')],_0xd4ff2c[_0xb151('0x5a')],_0xd4ff2c['dialogflow_language']||'en')['then'](function(_0x5622b7){_0x233f85(null,_0x5622b7);})['catch'](function(_0x45bcd1){_0x233f85(_0x45bcd1);});};AGIVertices[_0xb151('0xc')][_0xb151('0x76')]=function(_0x38e201,_0x29306c){scripts['googleDialogflowV2'](this[_0xb151('0x34')][_0xb151('0x35')],_0x38e201[_0xb151('0x77')],_0x38e201[_0xb151('0x78')],_0x38e201[_0xb151('0x79')],_0x38e201['text'],_0x38e201[_0xb151('0x7a')]||'en')[_0xb151('0x10')](function(_0x2fa331){_0x29306c(null,_0x2fa331);})[_0xb151('0x13')](function(_0x39c762){_0x29306c(_0x39c762);});};AGIVertices['prototype']['sestekNDA']=function(_0x1fb89e,_0x5170d9){scripts['sestekNDA'](this[_0xb151('0x34')],_0x1fb89e)[_0xb151('0x10')](function(_0x24c34d){_0x5170d9(null,_0x24c34d);})[_0xb151('0x13')](function(_0x42aa74){_0x5170d9(_0x42aa74);});};AGIVertices[_0xb151('0xc')]['ispeechTTS']=function(_0xe8e126,_0x4e4641){scripts[_0xb151('0x7b')](_0xe8e126['key'],_0xe8e126[_0xb151('0x5a')],_0xe8e126[_0xb151('0x7c')]||'en-US',_0xe8e126[_0xb151('0x7d')])['then'](function(_0x1ddc17){_0x4e4641(null,_0x1ddc17);})[_0xb151('0x13')](function(_0x86eba7){_0x4e4641(_0x86eba7);});};AGIVertices[_0xb151('0xc')]['ispeechASR']=function(_0x46075c,_0x45576d,_0x54707d){scripts[_0xb151('0x7e')](_0x45576d,_0x46075c['key'],_0x46075c[_0xb151('0x7f')]||_0xb151('0x80'),this[_0xb151('0x81')](_0x46075c[_0xb151('0x82')])?_0x46075c['model']:undefined)[_0xb151('0x10')](function(_0x275b87){_0x54707d(null,_0x275b87);})[_0xb151('0x13')](function(_0xa92c13){_0x54707d(_0xa92c13);});};AGIVertices[_0xb151('0xc')][_0xb151('0x83')]=function(_0x51951d,_0x255a11){scripts[_0xb151('0x83')](_0x51951d[_0xb151('0x84')],_0x51951d['aws_secret_access_key'],_0x51951d[_0xb151('0x85')],_0x51951d[_0xb151('0x86')]||_0xb151('0x87'),_0x51951d[_0xb151('0x5a')],_0x51951d[_0xb151('0x88')]||'text')[_0xb151('0x10')](function(_0x1b7806){_0x255a11(null,_0x1b7806);})[_0xb151('0x13')](function(_0x3e0694){_0x255a11(_0x3e0694);});};AGIVertices[_0xb151('0xc')][_0xb151('0x89')]=function(_0x11fa48,_0x3c03ee){scripts[_0xb151('0x89')](this['channel']['uniqueid'],_0x11fa48[_0xb151('0x84')],_0x11fa48[_0xb151('0x8a')],_0x11fa48['aws_lex_region'],_0x11fa48['text'],_0x11fa48[_0xb151('0x8b')])['then'](function(_0x100273){_0x3c03ee(null,_0x100273);})[_0xb151('0x13')](function(_0x4b51e0){_0x3c03ee(_0x4b51e0);});};AGIVertices[_0xb151('0xc')][_0xb151('0x8c')]=function(_0x558630,_0x57e182,_0x344754){scripts[_0xb151('0x8c')](_0x57e182,_0x558630[_0xb151('0x75')],_0x558630[_0xb151('0x8d')]||_0xb151('0x80'))['then'](function(_0x3d9257){_0x344754(null,_0x3d9257);})[_0xb151('0x13')](function(_0x1e547d){_0x344754(_0x1e547d);});};AGIVertices[_0xb151('0xc')][_0xb151('0x8e')]=function(_0x119fcf,_0x3ba748,_0x29523f){scripts[_0xb151('0x8e')](_0x3ba748,_0x119fcf[_0xb151('0x8f')],_0x119fcf[_0xb151('0x90')],_0x119fcf['uri'])[_0xb151('0x10')](function(_0x1bd1e3){_0x29523f(null,_0x1bd1e3);})[_0xb151('0x13')](function(_0x39e3cd){_0x29523f(_0x39e3cd);});};AGIVertices[_0xb151('0xc')][_0xb151('0x91')]=function(_0x197f3d){var _0x5d87da=_['includes'](verticesWithRetry,_0x197f3d['agicommand'])?_0x197f3d:_[_0xb151('0x92')](_0x197f3d);for(var _0x229319 in _0x5d87da){if(_0x5d87da[_0xb151('0x93')](_0x229319)){if(_0x5d87da[_0x229319]&&_[_0xb151('0x94')](_0x5d87da[_0x229319])){if(_[_0xb151('0x95')](recursiveMapAttributes,_0x229319)){_0x5d87da[_0x229319]=this[_0xb151('0x96')](_0x5d87da[_0x229319]);}else{_0x5d87da[_0x229319]=this['replaceAllVariables'](_0x5d87da[_0x229319]);}}}}return _0x5d87da;};AGIVertices[_0xb151('0xc')]['recursiveNodeIndex']=function(_0x18d210){for(var _0x4229ff in _0x18d210){if(_0x18d210[_0xb151('0x93')](_0x4229ff)){if(_[_0xb151('0x97')](_0x18d210[_0x4229ff])){this['recursiveNodeIndex'](_0x18d210[_0x4229ff]);}else if(_['isArray'](_0x18d210[_0x4229ff])){for(var _0x259f47=0x0;_0x259f47<_0x18d210[_0x4229ff][_0xb151('0x98')];_0x259f47++){this[_0xb151('0x99')](_0x18d210[_0x4229ff][_0x259f47]);}}else if(_[_0xb151('0x94')](_0x18d210[_0x4229ff])){_0x18d210[_0x4229ff]=this[_0xb151('0x9a')](_0x18d210[_0x4229ff]);}}}};AGIVertices[_0xb151('0xc')][_0xb151('0x9b')]=function(_0x2e223c,_0xfeebe2){for(var _0x54d292 in _0x2e223c){if(_0x2e223c[_0xb151('0x93')](_0x54d292)){if(_[_0xb151('0x97')](_0x2e223c[_0x54d292])){if(!_[_0xb151('0x43')](_0x2e223c[_0x54d292])){this[_0xb151('0x9b')](_0x2e223c[_0x54d292],util[_0xb151('0x24')](_0xb151('0x9c'),_0xfeebe2,_0x54d292));}}else if(_[_0xb151('0x9d')](_0x2e223c[_0x54d292])){for(var _0xdcff67=0x0;_0xdcff67<_0x2e223c[_0x54d292][_0xb151('0x98')];_0xdcff67++){this[_0xb151('0x9b')](_0x2e223c[_0x54d292][_0xdcff67],util[_0xb151('0x24')](_0xb151('0x9c'),_0xfeebe2,_0x54d292+'['+_0xdcff67+']'));}}else{if(!_['isNil'](_0x2e223c[_0x54d292])){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0x9c'),_0xfeebe2,_0x54d292),_0x2e223c[_0x54d292]);}}}}};AGIVertices[_0xb151('0xc')][_0xb151('0x96')]=function(_0x4fe2a4){try{var _0x1ba140=JSON[_0xb151('0x67')](_0x4fe2a4);this[_0xb151('0x99')](_0x1ba140);return JSON[_0xb151('0x9f')](_0x1ba140);}catch(_0x143afa){return this['replaceAllVariables'](_0x4fe2a4);}};AGIVertices['prototype'][_0xb151('0x9a')]=function(_0x519037){var _0x2d82df=_0x519037['split']('{');for(var _0x3528d4=0x1;_0x3528d4<_0x2d82df[_0xb151('0x98')];_0x3528d4+=0x1){var _0x1d222e=_0x2d82df[_0x3528d4][_0xb151('0xa0')]('}');if(_0x1d222e[_0xb151('0x98')]>0x1){_0x519037=_0x519037[_0xb151('0xa1')]('{'+_0x1d222e[0x0]+'}',this[_0xb151('0x34')][_0xb151('0xd')](_0x1d222e[0x0])[_0xb151('0xa2')]||_0x1d222e[0x0]);}}if(_0x2d82df['length']===0x1){return _0x519037[_0xb151('0x4a')]();}return this[_0xb151('0x9a')](_0x519037);};AGIVertices['prototype'][_0xb151('0xa3')]=function(_0x2e8f49,_0x173d16){var _0x4638d1=this[_0xb151('0x34')][_0xb151('0xd')](_0x2e8f49);if(_0x4638d1[_0xb151('0xa4')]===-0x1){return _0x4638d1;}logger['info'](util[_0xb151('0x24')](_0xb151('0xa5'),_0x173d16,_0x4638d1['extra']));return this[_0xb151('0x34')]['setVariable'](_0x173d16,_0x4638d1['extra']);};AGIVertices['prototype'][_0xb151('0x81')]=function(_0x357a87){return _0x357a87&&_0x357a87!=='0'&&_0x357a87!=='-1'&&_0x357a87!=='';};AGIVertices[_0xb151('0xc')][_0xb151('0xa6')]=function(_0x4ed97a){this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x4ed97a,'-');_0x4ed97a[_0xb151('0xa7')]=_0x4ed97a['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0xb151('0xc')][_0xb151('0xa8')]=function(_0x56f185){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xa9'),_0x56f185['label']));if(!this[_0xb151('0x81')](_0x56f185[_0xb151('0x5a')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xab'));}var _0x946625='\x22'+_0x56f185[_0xb151('0x5a')]+'\x22';if(this[_0xb151('0x81')](_0x56f185['options'])){_0x946625+=','+_0x56f185['options'];}var _0x410870=this[_0xb151('0x34')][_0xb151('0x55')]('MRCPSynth',_0x946625);if(_0x410870[_0xb151('0xa4')]===-0x1){return _0x410870;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x946625));};AGIVertices[_0xb151('0xc')]['mrcprecog']=function(_0x5e1319){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x5e1319[_0xb151('0xac')]));if(!this['isConfigured'](_0x5e1319[_0xb151('0xad')])){return this[_0xb151('0x34')]['noop'](_0xb151('0xae'));}var _0x3ce9b7=_0x5e1319[_0xb151('0xad')];if(this['isConfigured'](_0x5e1319['options'])){_0x3ce9b7+=','+_0x5e1319[_0xb151('0x73')];}var _0x226695=this[_0xb151('0x34')]['exec'](_0xb151('0xaf'),_0x3ce9b7);if(_0x226695[_0xb151('0xa4')]===-0x1){return _0x226695;}var _0x33d44d=this[_0xb151('0xa3')](_0xb151('0xb0'),_0xb151('0xb1'));if(_0x33d44d[_0xb151('0xa4')]===-0x1){return _0x33d44d;}var _0xd6d955=this['getAndSetVariable'](_0xb151('0xb2'),'MRCP_RECOG_TRANSCRIPT');if(_0xd6d955[_0xb151('0xa4')]===-0x1){return _0xd6d955;}var _0x5d200f=this[_0xb151('0xa3')](_0xb151('0xb3'),'MRCP_RECOG_INSTANCE');if(_0x5d200f[_0xb151('0xa4')]===-0x1){return _0x5d200f;}return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xb4'),_0x3ce9b7));};AGIVertices[_0xb151('0xc')][_0xb151('0xb5')]=function(_0x1206e1){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x1206e1[_0xb151('0xac')]));return this[_0xb151('0x34')][_0xb151('0xb5')]([_0x1206e1[_0xb151('0xb6')],_0x1206e1[_0xb151('0xb7')]]);};AGIVertices[_0xb151('0xc')][_0xb151('0xb8')]=function(_0x249ce2){logger['info'](util[_0xb151('0x24')](_0xb151('0xb9'),_0x249ce2[_0xb151('0xac')]));if(this[_0xb151('0x81')](_0x249ce2[_0xb151('0x63')])){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x249ce2['timeout']));var _0x177ee8=this[_0xb151('0x34')][_0xb151('0xba')](_0x249ce2[_0xb151('0x63')]);if(_0x177ee8['result']===-0x1){return _0x177ee8;}}return this[_0xb151('0x34')][_0xb151('0xb8')]();};AGIVertices[_0xb151('0xc')]['callback']=function(_0x54fbc2){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xbb'),_0x54fbc2['label']));if(!this[_0xb151('0x81')](_0x54fbc2['list_id'])){return this['channel'][_0xb151('0x28')](_0x54fbc2,'no\x20list\x20selected');}_0x54fbc2['scheduledAt']=moment();if(this[_0xb151('0x81')](_0x54fbc2[_0xb151('0xbc')])){_0x54fbc2['scheduledAt']=moment()[_0xb151('0xbd')](_0x54fbc2[_0xb151('0xbc')],_0xb151('0xbe'));}if(!this['isConfigured'](_0x54fbc2[_0xb151('0xbf')])){_0x54fbc2[_0xb151('0xbf')]=0x2;}this[_0xb151('0x42')][_0xb151('0x6c')](this,_0x54fbc2);return this[_0xb151('0x34')]['noop'](util[_0xb151('0x24')](_0xb151('0xc0'),_0x54fbc2[_0xb151('0xc1')],_0x54fbc2[_0xb151('0xc2')],_0x54fbc2[_0xb151('0x47')]));};AGIVertices[_0xb151('0xc')]['custom_app']=function(_0x14fe65){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x14fe65[_0xb151('0xac')]));var _0x10bee6=this[_0xb151('0x34')][_0xb151('0x55')](_0x14fe65[_0xb151('0xc3')],_0x14fe65[_0xb151('0x73')]);if(_0x10bee6[_0xb151('0xa4')]===-0x1){return _0x10bee6;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xc4'),_0x14fe65[_0xb151('0xc3')],_0x14fe65['options']));};AGIVertices[_0xb151('0xc')][_0xb151('0xc5')]=function(_0x26bd5f){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xc6'),_0x26bd5f[_0xb151('0xac')]));if(!this['isConfigured'](_0x26bd5f[_0xb151('0x5a')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20text\x20configured');}var _0x3cc2c2='\x22'+_0x26bd5f[_0xb151('0x5a')]+'\x22';if(this[_0xb151('0x81')](_0x26bd5f[_0xb151('0x73')])){_0x3cc2c2+=','+_0x26bd5f['options'];}var _0x4e6167=this['channel'][_0xb151('0x55')](_0xb151('0xc7'),_0x3cc2c2);if(_0x4e6167['result']===-0x1){return _0x4e6167;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xc8'),_0x3cc2c2));};AGIVertices[_0xb151('0xc')]['sestektts']=function(_0x4218f1){logger['info'](util[_0xb151('0x24')](_0xb151('0xc9'),_0x4218f1[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x4218f1['text'])){return this[_0xb151('0x34')]['noop'](_0xb151('0xab'));}var _0x49b7de='\x22'+_0x4218f1[_0xb151('0x5a')]+'\x22';if(this[_0xb151('0x81')](_0x4218f1[_0xb151('0x73')])){_0x49b7de+=','+_0x4218f1[_0xb151('0x73')];}var _0x468c4d=this[_0xb151('0x34')][_0xb151('0x55')]('MRCPSynth',_0x49b7de);if(_0x468c4d[_0xb151('0xa4')]===-0x1){return _0x468c4d;}return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xc8'),_0x49b7de));};AGIVertices[_0xb151('0xc')][_0xb151('0xca')]=function(_0x308c31){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xcb'),_0x308c31[_0xb151('0xac')]));if(!this['isConfigured'](_0x308c31[_0xb151('0xad')])){return this[_0xb151('0x34')]['noop']('no\x20grammar\x20configured');}var _0x2569ac=_0x308c31[_0xb151('0xad')];if(this[_0xb151('0x81')](_0x308c31['options'])){_0x2569ac+=','+_0x308c31[_0xb151('0x73')];}var _0x296ab1=this[_0xb151('0x34')][_0xb151('0x55')](_0xb151('0xaf'),_0x2569ac);if(_0x296ab1[_0xb151('0xa4')]===-0x1){return _0x296ab1;}var _0x5c8547=this['getAndSetVariable'](_0xb151('0xb0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x5c8547[_0xb151('0xa4')]===-0x1){return _0x5c8547;}var _0x161211=this[_0xb151('0xa3')](_0xb151('0xb2'),_0xb151('0xcc'));if(_0x161211['result']===-0x1){return _0x161211;}var _0x2d8305=this[_0xb151('0xa3')](_0xb151('0xb3'),_0xb151('0xcd'));if(_0x2d8305[_0xb151('0xa4')]===-0x1){return _0x2d8305;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xb4'),_0x2569ac));};AGIVertices[_0xb151('0xc')]['sestekasr']=function(_0x117053){logger[_0xb151('0x2a')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x117053[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x117053['grammar'])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xae'));}var _0x55d9fb=_0x117053[_0xb151('0xad')];if(this[_0xb151('0x81')](_0x117053[_0xb151('0x73')])){_0x55d9fb+=','+_0x117053[_0xb151('0x73')];}var _0x560a18=this['channel'][_0xb151('0x55')](_0xb151('0xaf'),_0x55d9fb);if(_0x560a18[_0xb151('0xa4')]===-0x1){return _0x560a18;}var _0x595a71=this[_0xb151('0xa3')]('RECOG_CONFIDENCE()',_0xb151('0xce'));if(_0x595a71['result']===-0x1){return _0x595a71;}var _0x5a1b46=this['getAndSetVariable'](_0xb151('0xb2'),_0xb151('0xcf'));if(_0x5a1b46['result']===-0x1){return _0x5a1b46;}var _0x4ac5e9=this[_0xb151('0xa3')](_0xb151('0xb3'),'SESTEK_ASR_INSTANCE');if(_0x4ac5e9[_0xb151('0xa4')]===-0x1){return _0x4ac5e9;}return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xb4'),_0x55d9fb));};AGIVertices[_0xb151('0xc')]['database']=function(_0x25b1a3){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xd0'),_0x25b1a3['label']));if(!this['isConfigured'](_0x25b1a3[_0xb151('0xd1')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x25b1a3,'no\x20database\x20selected');}var _0x291a8e=this['getSquareOdbc'][_0xb151('0x6c')](this,_0x25b1a3[_0xb151('0xd1')]);if(!_0x291a8e){return this[_0xb151('0x34')][_0xb151('0x28')](_0x25b1a3,_0xb151('0xd2'));}if(!this[_0xb151('0x81')](_0x25b1a3[_0xb151('0x2c')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x25b1a3,_0xb151('0xd3'));}var _0x3d0720=_0x25b1a3[_0xb151('0x2c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util['format'](_0xb151('0xd4'),_0x3d0720));var _0x8193e4=this[_0xb151('0x26')][_0xb151('0x6c')](this,_0x291a8e,_0x3d0720);this['createSquareDetailsReport']['sync'](this,_0x25b1a3,_0x3d0720);if(!this[_0xb151('0x81')](_0x25b1a3[_0xb151('0xd5')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xd6'));}var _0x5a7162=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x25b1a3[_0xb151('0xd5')]);if(!_0x5a7162){return this[_0xb151('0x34')][_0xb151('0x28')](_0x25b1a3,'no\x20variable\x20found');}var _0x4c98f1=this;_0x8193e4[_0xb151('0xd7')](function(_0x22141b,_0x3c0b68){Object[_0xb151('0xd8')](_0x22141b)['forEach'](function(_0x4f7bcb){_0x4c98f1[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0xd9'),_0x5a7162,_0x3c0b68,_0x4f7bcb),_0x22141b[_0x4f7bcb]);});});this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')]('%s_ROWS_COUNT',_0x5a7162),_0x8193e4[_0xb151('0x98')]);return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xda'),_0x5a7162));};AGIVertices['prototype'][_0xb151('0xdb')]=function(_0x32b619){logger[_0xb151('0xdc')](util[_0xb151('0x24')](_0xb151('0xdd'),_0x32b619[_0xb151('0xac')]));if(!this['isConfigured'](_0x32b619['sip_id'])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x32b619,'no\x20user\x20selected');}var _0x44581a=this[_0xb151('0x17')]['sync'](this,_0x32b619[_0xb151('0xde')]);if(!_0x44581a){return this[_0xb151('0x34')][_0xb151('0x28')](_0x32b619,_0xb151('0xdf'));}var _0x434112=this[_0xb151('0x34')][_0xb151('0x55')]('DIAL',[util['format'](_0xb151('0xe0'),_0x44581a),_0x32b619[_0xb151('0x63')],_0x32b619[_0xb151('0xe1')],_0x32b619[_0xb151('0x61')]]);if(_0x434112[_0xb151('0xa4')]===-0x1){return _0x434112;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xe2'),_0xb151('0xe3')));};AGIVertices[_0xb151('0xc')][_0xb151('0xe4')]=function(_0x347da5){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xe5'),_0x347da5[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x347da5[_0xb151('0x75')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20key\x20configured');}if(!this[_0xb151('0x81')](_0x347da5['text'])){return this['channel'][_0xb151('0xaa')](_0xb151('0xab'));}this[_0xb151('0x34')]['bot']=!![];this[_0xb151('0x33')](_0x347da5);this[_0xb151('0x41')](_0x347da5[_0xb151('0x5a')],'in','','');this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xe6'),_0x347da5[_0xb151('0x5a')]));var _0x499f84=this[_0xb151('0x74')][_0xb151('0x6c')](this,_0x347da5);if(_0x499f84){for(var _0x51aaba in _0x499f84){if(_0x499f84[_0xb151('0x93')](_0x51aaba)){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0xe7'),_0x51aaba['toUpperCase']()),_0x499f84[_0x51aaba]);}}this[_0xb151('0x41')](_0x499f84[_0xb151('0xe8')],_0xb151('0xe9'),'dialogflow','');return this[_0xb151('0x34')][_0xb151('0xaa')](util['format'](_0xb151('0xea'),_0x499f84['speech']));}return this[_0xb151('0x34')][_0xb151('0x28')](_0x347da5,_0xb151('0xeb'));};AGIVertices['prototype'][_0xb151('0xec')]=function(_0x278bb7){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0xed'),_0x278bb7['label']));if(!this[_0xb151('0x81')](_0x278bb7[_0xb151('0x77')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xee'));}if(!this[_0xb151('0x81')](_0x278bb7[_0xb151('0x78')])){return this[_0xb151('0x34')]['noop'](_0xb151('0xef'));}if(!this[_0xb151('0x81')](_0x278bb7[_0xb151('0x79')])){return this['channel'][_0xb151('0xaa')](_0xb151('0xf0'));}if(!this[_0xb151('0x81')](_0x278bb7[_0xb151('0x7a')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xf1'));}if(!this[_0xb151('0x81')](_0x278bb7[_0xb151('0x5a')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xf2')]=!![];this[_0xb151('0x33')](_0x278bb7);this[_0xb151('0x41')](_0x278bb7[_0xb151('0x5a')],'in','','');this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Trying\x20DialogflowV2:\x20%s',_0x278bb7[_0xb151('0x5a')]));var _0x3da3ac=this['googleDialogflowV2'][_0xb151('0x6c')](this,_0x278bb7);if(_0x3da3ac){for(var _0x5392be in _0x3da3ac){if(_0x3da3ac['hasOwnProperty'](_0x5392be)){if(_0x5392be!==_0xb151('0xf3')){this[_0xb151('0x34')]['setVariable'](util[_0xb151('0x24')](_0xb151('0xe7'),_0x5392be[_0xb151('0x65')]()),_0x3da3ac[_0x5392be]);}}}this[_0xb151('0x41')](_0x3da3ac['speech'],_0xb151('0xe9'),'dialogflowV2',_0x3da3ac['providerResponse']);return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xf4'),_0x3da3ac[_0xb151('0xe8')]));}return this[_0xb151('0x34')][_0xb151('0x28')](_0x278bb7,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0xb151('0xc')][_0xb151('0xf5')]=function(_0x59b3e6){logger['info'](util[_0xb151('0x24')](_0xb151('0xf6'),_0x59b3e6[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x59b3e6['ndauth_url'])){return this[_0xb151('0x34')]['noop'](_0xb151('0xf7'));}if(!this['isConfigured'](_0x59b3e6['username'])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xf8'));}if(!this['isConfigured'](_0x59b3e6['password'])){return this['channel'][_0xb151('0xaa')](_0xb151('0xf9'));}if(!this[_0xb151('0x81')](_0x59b3e6[_0xb151('0xfa')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xf2')]=!![];this[_0xb151('0x33')](_0x59b3e6);this['createSquareMessage'](_0x59b3e6['text'],'in','','');this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xfb'),_0x59b3e6['text']));var _0x36b625=this['sestekNDA'][_0xb151('0x6c')](this,_0x59b3e6);if(_0x36b625){for(var _0x5c3dec in _0x36b625){if(_0x36b625[_0xb151('0x93')](_0x5c3dec)){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0xfc'),_0x5c3dec[_0xb151('0x65')]()),_0x36b625[_0x5c3dec]);}}this[_0xb151('0x41')](_0x36b625[_0xb151('0xe8')],_0xb151('0xe9'),_0xb151('0xf5'),'');if(_0x36b625[_0xb151('0xfd')]){this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x36b625[_0xb151('0xfd')]));var _0x591ead=this[_0xb151('0x34')]['streamFile'](_0x36b625[_0xb151('0xfd')]);try{fs['unlink'](_0x36b625[_0xb151('0xfd')]+'.wav');}catch(_0x5f0f1a){logger[_0xb151('0x28')](_0x5f0f1a);}return _0x591ead;}else{return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xfe'),_0x36b625[_0xb151('0xe8')]));}}return this['channel']['error'](_0x59b3e6,_0xb151('0xff'));};AGIVertices['prototype'][_0xb151('0x100')]=function(_0x11b98d){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x101'),_0x11b98d[_0xb151('0xac')]));return this['channel'][_0xb151('0xaa')](_0xb151('0x100'));};AGIVertices['prototype']['ext_dial']=function(_0x4259f2){logger['info'](util[_0xb151('0x24')](_0xb151('0x102'),_0x4259f2[_0xb151('0xac')]));var _0x3e9090='';if(_0x4259f2['trunk_id']){if(!this['isConfigured'](_0x4259f2[_0xb151('0x103')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x4259f2,_0xb151('0x104'));}else{var _0xf1f2d=parseInt(_0x4259f2[_0xb151('0x103')],0xa);if(isNaN(_0xf1f2d)){_0x3e9090=_0x4259f2[_0xb151('0x103')];}else{_0x3e9090=this[_0xb151('0x19')][_0xb151('0x6c')](this,_0x4259f2[_0xb151('0x103')]);if(!_0x3e9090){return this[_0xb151('0x34')][_0xb151('0x28')](_0x4259f2,_0xb151('0x105'));}}}}else if(_0x4259f2[_0xb151('0x106')]){_0x3e9090=_0x4259f2[_0xb151('0x106')];}else{return this[_0xb151('0x34')][_0xb151('0x28')](_0x4259f2,'no\x20trunk\x20selected');}var _0x2839d0=this['channel'][_0xb151('0x55')](_0xb151('0xe3'),[util[_0xb151('0x24')]('SIP/%s/%s',_0x3e9090,_0x4259f2['phone']),_0x4259f2[_0xb151('0x63')],_0x4259f2[_0xb151('0xe1')],_0x4259f2[_0xb151('0x61')]]);if(_0x2839d0['result']===-0x1){return _0x2839d0;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xe2'),'DIAL'));};AGIVertices[_0xb151('0xc')][_0xb151('0x107')]=function(_0x1756d6){logger['info'](util[_0xb151('0x24')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x1756d6[_0xb151('0xac')]));return this['channel'][_0xb151('0xaa')]('finally');};AGIVertices[_0xb151('0xc')]['getdigits']=function(_0x90cc05){logger[_0xb151('0x2a')](util['format'](_0xb151('0x108'),_0x90cc05[_0xb151('0xac')]));if(_0x90cc05[_0xb151('0xa7')]===0x0){return this['maxRetry'](_0x90cc05);}_0x90cc05[_0xb151('0xa7')]-=0x1;if(!this[_0xb151('0x81')](_0x90cc05[_0xb151('0x109')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x90cc05,_0xb151('0x10a'));}var _0x2b7776=this[_0xb151('0x1a')]['sync'](this,_0x90cc05[_0xb151('0x109')]);if(!_0x2b7776){return this[_0xb151('0x34')][_0xb151('0x28')](_0x90cc05,_0xb151('0x10b'));}if(!this[_0xb151('0x81')](_0x90cc05[_0xb151('0xd5')])){return this['channel'][_0xb151('0x28')](_0xb151('0xd6'));}var _0x1b1b25=this[_0xb151('0x34')][_0xb151('0x10c')](_0x2b7776,_0x90cc05[_0xb151('0x10d')],_0x90cc05['maxdigit']);var _0x376ce8=_0x1b1b25[_0xb151('0xa4')]?_0x1b1b25[_0xb151('0xa4')][_0xb151('0x4a')]():'';logger[_0xb151('0x2a')](_0xb151('0x10e'),JSON['stringify'](_0x1b1b25));if(_0x1b1b25[_0xb151('0xa4')]===-0x1){this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x90cc05,_0x376ce8);return _0x1b1b25;}else if(_0x1b1b25['extra']===_0xb151('0x63')){_0x1b1b25[_0xb151('0xa4')]=_0x376ce8[_0xb151('0x98')]>=parseInt(_0x90cc05['mindigit'])?'x':'i';}else{_0x1b1b25[_0xb151('0xa4')]=_0x376ce8[_0xb151('0x98')]>=parseInt(_0x90cc05[_0xb151('0x10f')])&&_0x376ce8[_0xb151('0x98')]<=parseInt(_0x90cc05[_0xb151('0x110')])?'x':'i';}var _0x2e81c5=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x90cc05[_0xb151('0xd5')]);if(!_0x2e81c5){return this[_0xb151('0x34')]['error'](_0x90cc05,'no\x20variable\x20found');}this[_0xb151('0x34')]['setVariable'](_0x2e81c5,_0x376ce8);if(this[_0xb151('0x81')](_0x90cc05['hiddendigitsnum'])){var _0x4eba8c=parseInt(_0x90cc05[_0xb151('0x111')],0xa);var _0xccdf4=rs[_0xb151('0x112')]({'charset':'*','length':_0x4eba8c});var _0x4a6209=_0x376ce8[_0xb151('0x98')];if(_0x4a6209>0x0){if(_0x4a6209>_0x4eba8c){this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x90cc05,_0x90cc05[_0xb151('0x113')]===_0xb151('0x114')?_0xccdf4+_0x376ce8['substr'](_0x4eba8c):_0x376ce8[_0xb151('0x115')](0x0,_0x4a6209-_0x4eba8c)+_0xccdf4);}else{this['createSquareDetailsReport'][_0xb151('0x6c')](this,_0x90cc05,rs['generate']({'charset':'*','length':_0x4a6209}));}}else{this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x90cc05,'');}}else{this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x90cc05,_0x376ce8);}return _0x1b1b25;};AGIVertices[_0xb151('0xc')][_0xb151('0x116')]=function(_0x34fb7a){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x34fb7a[_0xb151('0xac')]));return this['getdigits'](_0x34fb7a);};AGIVertices[_0xb151('0xc')]['goal']=function(_0x359879){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x117'),_0x359879[_0xb151('0xac')]));this['createSquareDetailsReport'][_0xb151('0x6c')](this,_0x359879,_0x359879[_0xb151('0x118')]);return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x119'),_0x359879[_0xb151('0x118')]));};AGIVertices[_0xb151('0xc')][_0xb151('0x11a')]=function(_0x81f9b0){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x81f9b0[_0xb151('0xac')]));if(!this['isConfigured'](_0x81f9b0[_0xb151('0x84')])||!this[_0xb151('0x81')](_0x81f9b0['aws_secret_access_key'])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xb151('0x81')](_0x81f9b0[_0xb151('0x5a')])){return this['channel'][_0xb151('0xaa')]('no\x20text\x20configured');}this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')]('Trying\x20aws\x20Polly\x20%s',_0x81f9b0[_0xb151('0x5a')]));var _0x15d1f4=this['awsPolly']['sync'](this,_0x81f9b0);if(_0x15d1f4){this['channel']['noop'](util['format'](_0xb151('0x11b'),_0x15d1f4));var _0x4117c6=this[_0xb151('0x34')][_0xb151('0x11c')](_0x15d1f4);try{fs['unlink'](_0x15d1f4+_0xb151('0x11d'));}catch(_0x188926){logger['error'](_0x188926);}return _0x4117c6;}return this['channel'][_0xb151('0x28')](_0x81f9b0,_0xb151('0x11e'));};AGIVertices[_0xb151('0xc')][_0xb151('0x11f')]=function(_0xc5e512){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x120'),_0xc5e512[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0xc5e512['aws_access_key_id'])||!this[_0xb151('0x81')](_0xc5e512[_0xb151('0x8a')])){return this[_0xb151('0x34')]['noop'](_0xb151('0x121'));}if(!this[_0xb151('0x81')](_0xc5e512[_0xb151('0x8b')])){return this['channel']['noop'](_0xb151('0x122'));}if(!this[_0xb151('0x81')](_0xc5e512[_0xb151('0x5a')])){return this['channel']['noop'](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xf2')]=!![];this[_0xb151('0x33')](_0xc5e512);this[_0xb151('0x41')](_0xc5e512['text'],'in','','');this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Trying\x20Amazon\x20Lex:\x20%s',_0xc5e512[_0xb151('0x5a')]));var _0x41d612=this['awsLex']['sync'](this,_0xc5e512);if(_0x41d612){for(var _0x1a69d1 in _0x41d612){if(_0x41d612[_0xb151('0x93')](_0x1a69d1)&&_['isString'](_0x41d612[_0x1a69d1])){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')]('AWS_LEX_%s',_0x1a69d1[_0xb151('0x65')]()),_0x41d612[_0x1a69d1]);}}if(_['isNil'](_0x41d612[_0xb151('0x71')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x41d612[_0xb151('0x71')],_0xb151('0xe9'),_0xb151('0x123'),'');return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Amazon\x20Lex\x20Result\x20%s',_0x41d612[_0xb151('0x71')]));}}return this['channel']['error'](_0xc5e512,_0xb151('0x124'));};AGIVertices[_0xb151('0xc')][_0xb151('0x125')]=function(_0x322935){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x126'),_0x322935['label'],_0x322935[_0xb151('0x63')]));if(!this[_0xb151('0x81')](_0x322935['key'])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x127'));}var _0x528a54='wav';var _0x607c62=util[_0xb151('0x24')](_0xb151('0x128'),FILES_PATH,rs['generate'](0x4));var _0x16cae7=util[_0xb151('0x24')](_0xb151('0x9c'),_0x607c62,_0x528a54);var _0x420617=!![];if(_0x322935['beep']==='NOBEEP'){_0x420617=![];}var _0x44170c=this[_0xb151('0x34')]['recordFile'](_0x607c62,_0x528a54,_0x322935[_0xb151('0x129')],_0x322935[_0xb151('0x63')],undefined,_0x420617);if(_0x44170c[_0xb151('0xa4')]!==-0x1){this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x12a'),_0x16cae7));var _0x560edb=this['googleASR'][_0xb151('0x6c')](this,_0x322935,_0x16cae7);if(_0x560edb){for(var _0x23659b in _0x560edb){if(_0x560edb[_0xb151('0x93')](_0x23659b)){this['channel'][_0xb151('0x9e')](util['format'](_0xb151('0x12b'),_0x23659b[_0xb151('0x65')]()),_0x560edb[_0x23659b]);}}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x12c'),JSON[_0xb151('0x9f')](_0x560edb)));}}return _0x44170c;};AGIVertices['prototype'][_0xb151('0x12d')]=function(_0x2b212f){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x12e'),_0x2b212f[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x2b212f[_0xb151('0x8f')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20appid\x20configured');}if(!this[_0xb151('0x81')](_0x2b212f['appsecret'])){return this['channel'][_0xb151('0xaa')]('no\x20appsecret\x20configured');}var _0x121788=_0xb151('0x12f');var _0x596d23=util[_0xb151('0x24')](_0xb151('0x128'),FILES_PATH,rs[_0xb151('0x112')](0x4));var _0x35c15c=util[_0xb151('0x24')](_0xb151('0x9c'),_0x596d23,_0x121788);var _0x8421e3=!![];if(_0x2b212f[_0xb151('0x130')]===_0xb151('0x131')){_0x8421e3=![];}var _0x2e5e9a=this['channel'][_0xb151('0x132')](_0x596d23,_0x121788,_0x2b212f[_0xb151('0x129')],_0x2b212f[_0xb151('0x63')],undefined,_0x8421e3);if(_0x2e5e9a[_0xb151('0xa4')]!==-0x1){this['channel'][_0xb151('0xaa')](util['format']('tilde\x20%s\x20file\x20created',_0x35c15c));var _0x45e05d=this[_0xb151('0x8e')][_0xb151('0x6c')](this,_0x2b212f,_0x35c15c);if(_0x45e05d){for(var _0x13a425 in _0x45e05d){if(_0x45e05d[_0xb151('0x93')](_0x13a425)){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')]('TILDE_ASR_%s',_0x13a425[_0xb151('0x65')]()),_0x45e05d[_0x13a425]);}}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x133'),JSON[_0xb151('0x9f')](_0x45e05d)));}}return _0x2e5e9a;};AGIVertices['prototype']['gotoc']=function(_0x542da1){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x134'),_0x542da1[_0xb151('0xac')]));return this[_0xb151('0x34')][_0xb151('0x135')](_0x542da1[_0xb151('0x3b')],_0x542da1[_0xb151('0x3c')],_0x542da1[_0xb151('0x3d')]);};AGIVertices[_0xb151('0xc')][_0xb151('0x136')]=function(_0x2b83e3){logger[_0xb151('0x2a')](util['format'](_0xb151('0x137'),_0x2b83e3[_0xb151('0xac')]));if(!this['isConfigured'](_0x2b83e3[_0xb151('0x138')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x2b83e3,_0xb151('0x139'));}try{var _0x26f610=eval(_0x2b83e3[_0xb151('0x138')])?'true':'false';this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')]('EVAL\x20CONDITION\x20%s\x20%s',_0x2b83e3[_0xb151('0x138')],_0x26f610));return{'code':0xc8,'result':_0x26f610};}catch(_0x4b6286){return{'code':0xc8,'result':_0xb151('0x13a')};}};AGIVertices[_0xb151('0xc')][_0xb151('0x13b')]=function(_0x15f5da){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x13c'),_0x15f5da['label']));if(!this[_0xb151('0x81')](_0x15f5da[_0xb151('0x13d')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x15f5da,_0xb151('0x13e'));}var _0x5280bb=this['getIntervals'][_0xb151('0x6c')](this,_0x15f5da[_0xb151('0x13d')]);if(!_0x5280bb){return this['channel'][_0xb151('0x28')](_0x15f5da,_0xb151('0x13f'));}for(var _0xeb9550=0x0;_0xeb9550<_0x5280bb['length'];_0xeb9550+=0x1){var _0x5dc603=this[_0xb151('0x34')][_0xb151('0xd')](util[_0xb151('0x24')]('IFTIME(%s?true:false)',_0x5280bb[_0xeb9550]));if(_0x5dc603[_0xb151('0xa4')]===-0x1){return _0x5dc603;}logger[_0xb151('0x2a')](util[_0xb151('0x24')]('IFTIME\x20%s\x20%s',_0x5280bb[_0xeb9550],_0x5dc603[_0xb151('0xa2')]));if(_0x5dc603[_0xb151('0xa2')]===_0xb151('0x140')){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('IFTIME\x20%s\x20%s',_0x5280bb[_0xeb9550],_0xb151('0x140')));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('IFTIME\x20%s\x20%s',_0x5280bb[_0xeb9550],_0xb151('0x140')));return{'code':0xc8,'result':_0xb151('0x140')};}else{logger[_0xb151('0x2a')](util['format'](_0xb151('0x141'),_0x5280bb[_0xeb9550],'false'));this['channel']['noop'](util[_0xb151('0x24')](_0xb151('0x141'),_0x5280bb[_0xeb9550],_0xb151('0x13a')));}}return{'code':0xc8,'result':_0xb151('0x13a')};};AGIVertices[_0xb151('0xc')]['hangup']=function(_0x2630cd){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x2630cd['label']));return this['channel']['hangup']();};AGIVertices[_0xb151('0xc')][_0xb151('0x142')]=function(_0x1369e6){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x143'),_0x1369e6['label']));if(!this[_0xb151('0x81')](_0x1369e6[_0xb151('0x75')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x127'));}var _0x24c738=_0xb151('0x12f');var _0x3904ba=util['format'](_0xb151('0x128'),FILES_PATH,rs[_0xb151('0x112')](0x4));var _0xf06043=util['format'](_0xb151('0x9c'),_0x3904ba,_0x24c738);var _0x40b6de=!![];if(_0x1369e6[_0xb151('0x130')]===_0xb151('0x131')){_0x40b6de=![];}var _0x5528b3=this[_0xb151('0x34')][_0xb151('0x132')](_0x3904ba,_0x24c738,_0x1369e6[_0xb151('0x129')],_0x1369e6['timeout'],undefined,_0x40b6de);if(_0x5528b3['result']!==-0x1){this[_0xb151('0x34')][_0xb151('0xaa')](util['format'](_0xb151('0x144'),_0xf06043));var _0x3e272a=this[_0xb151('0x7e')][_0xb151('0x6c')](this,_0x1369e6,_0xf06043);if(_0x3e272a){for(var _0xd70117 in _0x3e272a){if(_0x3e272a['hasOwnProperty'](_0xd70117)){this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')]('ISPEECH_ASR_%s',_0xd70117[_0xb151('0x65')]()),_0x3e272a[_0xd70117]);}}return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x145'),JSON[_0xb151('0x9f')](_0x3e272a)));}}return _0x5528b3;};AGIVertices['prototype'][_0xb151('0x146')]=function(_0x3a1b93){logger['info'](util[_0xb151('0x24')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3a1b93['label']));if(!this[_0xb151('0x81')](_0x3a1b93[_0xb151('0x75')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x127'));}if(!this[_0xb151('0x81')](_0x3a1b93['text'])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x147'),_0x3a1b93[_0xb151('0x5a')]));var _0x3c75e5=this[_0xb151('0x7b')][_0xb151('0x6c')](this,_0x3a1b93);if(_0x3c75e5){this[_0xb151('0x34')][_0xb151('0xaa')](util['format'](_0xb151('0x144'),_0x3c75e5));var _0x17076b=this[_0xb151('0x34')][_0xb151('0x11c')](_0x3c75e5,_0x3a1b93[_0xb151('0x129')]);try{fs['unlink'](_0x3c75e5+_0xb151('0x11d'));}catch(_0x320463){logger[_0xb151('0x28')](_0x320463);}return _0x17076b;}return this[_0xb151('0x34')][_0xb151('0x28')](_0x3a1b93,_0xb151('0x148'));};AGIVertices['prototype'][_0xb151('0x149')]=function(_0x45f5de){logger['info'](util['format'](_0xb151('0x14a'),_0x45f5de[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x45f5de[_0xb151('0x14b')])){return this[_0xb151('0x34')]['error'](_0x45f5de,'no\x20find\x20by\x20configured');}logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x14c'),this[_0xb151('0x34')]['callerid'],_0x45f5de[_0xb151('0x14b')]));var _0x44680e=this[_0xb151('0x51')][_0xb151('0x6c')](this,_0x45f5de[_0xb151('0x14b')]);if(_0x44680e){logger[_0xb151('0x2a')](util['format'](_0xb151('0x14d'),this[_0xb151('0x34')][_0xb151('0x38')],_0x45f5de[_0xb151('0x14b')]));this['channel'][_0xb151('0xaa')](util['format'](_0xb151('0x14d'),this[_0xb151('0x34')]['callerid'],_0x45f5de[_0xb151('0x14b')]));return{'code':0xc8,'result':_0xb151('0x14e')};}else{logger[_0xb151('0x2a')](util[_0xb151('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x45f5de[_0xb151('0x14b')]));this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x45f5de[_0xb151('0x14b')]));return{'code':0xc8,'result':_0xb151('0x14f')};}};AGIVertices[_0xb151('0xc')][_0xb151('0x150')]=function(_0x5b1eae){logger[_0xb151('0x2a')](util['format'](_0xb151('0x151'),_0x5b1eae['label']));if(!this[_0xb151('0x81')](_0x5b1eae['findBy'])){return this[_0xb151('0x34')]['error'](_0x5b1eae,_0xb151('0x152'));}logger['info'](util[_0xb151('0x24')](_0xb151('0x14c'),this[_0xb151('0x34')]['callerid'],_0x5b1eae[_0xb151('0x14b')]));var _0x2cd6cf=this[_0xb151('0x50')][_0xb151('0x6c')](this,_0x5b1eae[_0xb151('0x14b')]);if(_0x2cd6cf){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x14d'),this[_0xb151('0x34')][_0xb151('0x38')],_0x5b1eae[_0xb151('0x14b')]));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x14d'),this['channel'][_0xb151('0x38')],_0x5b1eae[_0xb151('0x14b')]));return{'code':0xc8,'result':_0xb151('0x14e')};}else{logger['info'](util[_0xb151('0x24')](_0xb151('0x153'),this[_0xb151('0x34')][_0xb151('0x38')],_0x5b1eae['findBy']));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x153'),this[_0xb151('0x34')][_0xb151('0x38')],_0x5b1eae['findBy']));return{'code':0xc8,'result':_0xb151('0x14f')};}};AGIVertices[_0xb151('0xc')][_0xb151('0x154')]=function(_0x5c78c6){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x155'),_0x5c78c6[_0xb151('0xac')]));if(!this['isConfigured'](_0x5c78c6[_0xb151('0x156')])){return this['channel']['error'](_0x5c78c6,_0xb151('0x157'));}this[_0xb151('0x34')][_0xb151('0xaa')](util['format']('math\x20%s',_0x5c78c6[_0xb151('0x156')]));var _0xf9f71d=eval(_0x5c78c6['operation']);if(!this[_0xb151('0x81')](_0x5c78c6[_0xb151('0xd5')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xd6'));}var _0x3d3a97=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x5c78c6['variable_id']);if(!_0x3d3a97){return this['channel']['error'](_0x5c78c6,_0xb151('0x158'));}if(_[_0xb151('0x9d')](_0xf9f71d)){var _0x16ccc2=this;_0xf9f71d[_0xb151('0xd7')](function(_0x5dda78,_0x39bbac){_0x16ccc2[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0x159'),_0x3d3a97,_0x39bbac),_0x5dda78);});return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('variable\x20%s[key]\x20set',_0x3d3a97));}else{return this['channel'][_0xb151('0x9e')](_0x3d3a97,_0xf9f71d);}};AGIVertices['prototype']['menu']=function(_0x2acf45){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x15a'),_0x2acf45['label']));if(_0x2acf45[_0xb151('0xa7')]===0x0){return this[_0xb151('0xa6')](_0x2acf45);}_0x2acf45['retry']-=0x1;if(!this[_0xb151('0x81')](_0x2acf45[_0xb151('0x109')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x2acf45,_0xb151('0x10a'));}var _0x2a0dbd=this[_0xb151('0x1a')]['sync'](this,_0x2acf45[_0xb151('0x109')]);if(!_0x2a0dbd){return this[_0xb151('0x34')][_0xb151('0x28')](_0x2acf45,'no\x20file\x20audio\x20found');}var _0x573526=this[_0xb151('0x34')]['getData'](_0x2a0dbd,_0x2acf45['response'],_0x2acf45[_0xb151('0x15b')]);var _0x2a0122=_0x573526[_0xb151('0xa4')];if(_0x573526['result']===-0x1){this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x2acf45,'-1');return _0x573526;}else if(_0x573526[_0xb151('0xa2')]==='timeout'){_0x573526[_0xb151('0xa4')]=_0x573526[_0xb151('0xa4')]['length']>0x0?_0x573526[_0xb151('0xa4')]:'t';}else if(_[_0xb151('0x43')](_0x573526['result'])){_0x573526[_0xb151('0xa4')]='#';_0x2a0122='#';}if(!this[_0xb151('0x81')](_0x2acf45[_0xb151('0xd5')])){this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xd6'));}else{var _0x1beb01=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x2acf45[_0xb151('0xd5')]);if(!_0x1beb01){return this[_0xb151('0x34')][_0xb151('0x28')](_0x2acf45,_0xb151('0x158'));}this[_0xb151('0x34')][_0xb151('0x9e')](_0x1beb01,_0x2a0122);}this['createSquareDetailsReport']['sync'](this,_0x2acf45,_0x2a0122);return _0x573526;};AGIVertices[_0xb151('0xc')][_0xb151('0xaa')]=function(_0x12bba0){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x15c'),_0x12bba0[_0xb151('0xac')]));return this['channel']['noop'](_0x12bba0[_0xb151('0x15d')]||_0x12bba0[_0xb151('0xac')]);};AGIVertices[_0xb151('0xc')][_0xb151('0x15e')]=function(_0x58333d){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x15f'),_0x58333d['label']));if(!this[_0xb151('0x81')](_0x58333d['findBy'])){return this['channel']['error'](_0x58333d,_0xb151('0x152'));}logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x14c'),this['channel'][_0xb151('0x38')],_0x58333d[_0xb151('0x14b')]));var _0x110197=this[_0xb151('0x4b')][_0xb151('0x6c')](this,_0x58333d[_0xb151('0x160')]);var _0x59d177=this[_0xb151('0x4d')][_0xb151('0x6c')](this,_0x58333d[_0xb151('0x14b')],_0x110197);if(_0x59d177){logger[_0xb151('0x2a')](util['format'](_0xb151('0x14d'),this[_0xb151('0x34')][_0xb151('0x38')],_0x58333d[_0xb151('0x14b')]));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x14d'),this[_0xb151('0x34')]['callerid'],_0x58333d[_0xb151('0x14b')]));return{'code':0xc8,'result':_0xb151('0x14e')};}else{logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x153'),this['channel'][_0xb151('0x38')],_0x58333d['findBy']));this[_0xb151('0x34')][_0xb151('0xaa')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xb151('0x34')][_0xb151('0x38')],_0x58333d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xb151('0x161')]=function(_0x3015ea){logger[_0xb151('0x2a')](util['format'](_0xb151('0x162'),_0x3015ea[_0xb151('0xac')]));if(!this['isConfigured'](_0x3015ea['file_id'])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x3015ea,_0xb151('0x10a'));}var _0x5e79a8=this[_0xb151('0x1a')][_0xb151('0x6c')](this,_0x3015ea[_0xb151('0x109')]);if(!_0x5e79a8){return this['channel'][_0xb151('0x28')](_0x3015ea,_0xb151('0x10b'));}var _0xfd4d9d=this[_0xb151('0x34')]['exec'](_0xb151('0x163'),[_0x5e79a8,_0x3015ea['opts']]);if(_0xfd4d9d[_0xb151('0xa4')]===-0x1){return _0xfd4d9d;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xc4'),'PLAYBACK',_0x5e79a8));};AGIVertices['prototype']['queue']=function(_0x3eff95){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x164'),_0x3eff95[_0xb151('0xac')]));if(!this['isConfigured'](_0x3eff95[_0xb151('0x165')])){return this['channel'][_0xb151('0x28')](_0x3eff95,_0xb151('0x166'));}var _0x4659ec='';var _0x120d5a=parseInt(_0x3eff95['queue_id'],0xa);if(isNaN(_0x120d5a)){_0x4659ec=_0x3eff95[_0xb151('0x165')];}else{_0x4659ec=this[_0xb151('0x12')][_0xb151('0x6c')](this,_0x3eff95[_0xb151('0x165')]);if(!_0x4659ec){return this[_0xb151('0x34')][_0xb151('0x28')](_0x3eff95,'no\x20queue\x20found');}}var _0x5529aa='';if(this[_0xb151('0x81')](_0x3eff95[_0xb151('0x109')])){var _0x28b8e1=this['getSound'][_0xb151('0x6c')](this,_0x3eff95[_0xb151('0x109')]);if(_0x28b8e1){_0x5529aa=_0x28b8e1;}}this[_0xb151('0x33')][_0xb151('0x6c')](this,_0x3eff95,_0x4659ec);if(_0x3eff95[_0xb151('0xe1')][_0xb151('0x167')]('x')<0x0){_0x3eff95[_0xb151('0xe1')]+='x';}if(_0x3eff95['opts'][_0xb151('0x167')]('X')<0x0){_0x3eff95[_0xb151('0xe1')]+='X';}this['channel'][_0xb151('0x9e')]('XMCS-QUEUE',_0x4659ec?_0x4659ec[_0xb151('0x168')]():'');var _0x26e360=this[_0xb151('0x34')][_0xb151('0x55')]('QUEUE',[_0x4659ec,_0x3eff95[_0xb151('0xe1')],_0x3eff95[_0xb151('0x61')],_0x5529aa,_0x3eff95['timeout'],_0x3eff95['agi'],_0x3eff95['macro'],_0x3eff95[_0xb151('0x169')],'',_0x3eff95[_0xb151('0x16a')]]);if(_0x26e360[_0xb151('0xa4')]===-0x1){return _0x26e360;}return this['channel']['noop'](util[_0xb151('0x24')](_0xb151('0xc4'),_0xb151('0x16b'),_0x4659ec));};AGIVertices['prototype'][_0xb151('0x16c')]=function(_0x1fab15){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x16d'),_0x1fab15[_0xb151('0xac')]));var _0x24229a=_0x1fab15[_0xb151('0x16e')]||'wav';var _0x2d5301=util[_0xb151('0x24')]('%s_%s',this['channel']['uniqueid'],rs['generate'](0x5));var _0x22cf08=util[_0xb151('0x24')](_0xb151('0x16f'),FILES_PATH,_0x2d5301,_0x24229a);var _0x2c2262=util[_0xb151('0x24')](_0xb151('0x128'),FILES_PATH,_0x2d5301);this['createSquareRecording'][_0xb151('0x6c')](this,_0x1fab15,_0x2d5301,_0x22cf08);this['channel'][_0xb151('0x9e')](_0xb151('0x170'),_0x2d5301);logger[_0xb151('0x2a')](_0xb151('0x171'),_0x2c2262,_0x24229a,_0x1fab15[_0xb151('0x172')],_0x1fab15[_0xb151('0x63')]);return this['channel'][_0xb151('0x132')](_0x2c2262,_0x24229a,_0x1fab15[_0xb151('0x172')],_0x1fab15['timeout'],undefined,!![]);};AGIVertices[_0xb151('0xc')][_0xb151('0x173')]=function(_0x3b6c24){logger['info'](util[_0xb151('0x24')](_0xb151('0x174'),_0x3b6c24[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x3b6c24[_0xb151('0x61')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20url\x20configured');}var _0x34b3a2=this[_0xb151('0x175')][_0xb151('0x6c')](this,_0x3b6c24);logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x176'),util[_0xb151('0x177')](_0x34b3a2,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3b6c24[_0xb151('0xd5')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x178'));}var _0x4e7f37=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x3b6c24[_0xb151('0xd5')]);if(!_0x4e7f37){return this['channel'][_0xb151('0x28')](_0x3b6c24,_0xb151('0x158'));}this[_0xb151('0x34')][_0xb151('0x9e')](util[_0xb151('0x24')](_0xb151('0x179'),_0x4e7f37),_0x34b3a2[_0xb151('0x6f')]?_0x34b3a2['statusCode']:_0xb151('0x17a'));this[_0xb151('0x34')]['setVariable'](util[_0xb151('0x24')]('%s_STATUS_MESSAGE',_0x4e7f37),_0x34b3a2[_0xb151('0x70')]?_0x34b3a2[_0xb151('0x70')]:'OK');if(_0x34b3a2[_0xb151('0x66')]){try{this[_0xb151('0x9b')](_0x34b3a2[_0xb151('0x66')],_0x4e7f37);}catch(_0x856f0e){logger['error'](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x4e7f37));}}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('variable\x20%s\x20set',_0x4e7f37));};AGIVertices[_0xb151('0xc')]['saydigits']=function(_0x4dfe15){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x4dfe15[_0xb151('0xac')]));return this['channel'][_0xb151('0x17b')](_0x4dfe15[_0xb151('0x17c')]['replace'](/\s+/g,''),_0x4dfe15[_0xb151('0x172')]);};AGIVertices[_0xb151('0xc')]['saynumber']=function(_0x252d94){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x17d'),_0x252d94[_0xb151('0xac')]));return this['channel'][_0xb151('0x17e')](_0x252d94[_0xb151('0x64')]['replace'](/\s+/g,''),_0x252d94[_0xb151('0x172')]);};AGIVertices['prototype']['sayphonetic']=function(_0x6972e6){logger[_0xb151('0x2a')](util[_0xb151('0x24')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x6972e6[_0xb151('0xac')]));return this[_0xb151('0x34')][_0xb151('0x17f')](_0x6972e6[_0xb151('0x5a')],_0x6972e6[_0xb151('0x172')]);};AGIVertices[_0xb151('0xc')]['sendMail']=function(_0x5336d2){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x180'),_0x5336d2[_0xb151('0xac')]));if(!this['isConfigured'](_0x5336d2[_0xb151('0x181')])){return this[_0xb151('0x34')][_0xb151('0xaa')]('no\x20mail\x20account\x20configured');}var _0x3bd127=this[_0xb151('0x1d')]['sync'](this,_0x5336d2[_0xb151('0x181')]);if(!_0x3bd127||!_0x3bd127['Smtp']){return this[_0xb151('0x34')][_0xb151('0x28')](_0x5336d2,_0xb151('0x182'));}var _0x5d16e4={'from':util[_0xb151('0x24')](_0xb151('0x183'),_0x3bd127[_0xb151('0x11')],_0x3bd127[_0xb151('0x184')]||_0x3bd127[_0xb151('0x185')][_0xb151('0x186')]),'to':_0x5336d2['to']||'','cc':_0x5336d2['cc']||'','bcc':_0x5336d2[_0xb151('0x187')]||'','subject':_0x5336d2['subject'],'html':_0x5336d2[_0xb151('0x5a')],'text':_0x5336d2['text']};if(this[_0xb151('0x81')](_0x5336d2['template_id'])){}logger[_0xb151('0xdc')](_0xb151('0x188'),JSON[_0xb151('0x9f')](_0x5d16e4));this[_0xb151('0x33')]['sync'](this,_0x5336d2,_0x5336d2[_0xb151('0x181')]);this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x189'),_0x3bd127[_0xb151('0x11')]));this['sendMailMessage'][_0xb151('0x6c')](this,_0x3bd127[_0xb151('0x18a')],_0x5d16e4);return this['channel'][_0xb151('0xaa')](_0xb151('0x18b'));};AGIVertices[_0xb151('0xc')][_0xb151('0x18c')]=function(_0x431b4a){logger['info'](util['format'](_0xb151('0x18d'),_0x431b4a[_0xb151('0xac')]));return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x18e'));};AGIVertices[_0xb151('0xc')]['sendSMS']=function(_0xe17671){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x18f'),_0xe17671[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0xe17671[_0xb151('0x190')])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x191'));}var _0x12f0ae=this['getSmsAccount'][_0xb151('0x6c')](this,_0xe17671[_0xb151('0x190')]);if(!_0x12f0ae){return this['channel'][_0xb151('0x28')](_0xe17671,_0xb151('0x192'));}var _0x125bb1={'body':_0xe17671[_0xb151('0x193')],'phone':_0xe17671['to']||'','SmsAccountId':_0x12f0ae['id']};logger[_0xb151('0xdc')](_0xb151('0x194'),JSON[_0xb151('0x9f')](_0x125bb1));this[_0xb151('0x33')][_0xb151('0x6c')](this,_0xe17671,_0xe17671[_0xb151('0x190')]);this[_0xb151('0x34')][_0xb151('0xaa')](util['format'](_0xb151('0x195'),_0x12f0ae[_0xb151('0x11')]));this['createSmsMessage'][_0xb151('0x6c')](this,_0x125bb1);return this['channel'][_0xb151('0xaa')](_0xb151('0x196'));};AGIVertices[_0xb151('0xc')][_0xb151('0x197')]=function(_0x5242e3){logger['info'](util[_0xb151('0x24')](_0xb151('0x198'),_0x5242e3[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x5242e3[_0xb151('0xd5')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x5242e3,_0xb151('0x199'));}var _0x374d74=this[_0xb151('0xd')]['sync'](this,_0x5242e3[_0xb151('0xd5')]);if(!_0x374d74){return this['channel'][_0xb151('0x28')](_0x5242e3,_0xb151('0x158'));}return this['channel'][_0xb151('0x9e')](_0x374d74,_0x5242e3[_0xb151('0x19a')]);};AGIVertices[_0xb151('0xc')]['start']=function(_0x5e6bb0){logger['info'](util[_0xb151('0x24')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5e6bb0[_0xb151('0xac')]));this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x19b'));if(_0x5e6bb0[_0xb151('0xb8')]===_0xb151('0x19c')){this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0x19d'));return this[_0xb151('0x34')]['answer']();}return this['channel'][_0xb151('0xaa')]('Skipped\x20Answer');};AGIVertices['prototype'][_0xb151('0x19e')]=function(_0x49a619){logger[_0xb151('0x2a')](util['format'](_0xb151('0x19f'),_0x49a619[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x49a619[_0xb151('0x1a0')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x49a619,_0xb151('0x1a1'));}var _0x330d57=this[_0xb151('0x1a2')][_0xb151('0x6c')](this,_0x49a619[_0xb151('0x1a0')]);if(!this[_0xb151('0x81')](_0x330d57)){return this[_0xb151('0x34')][_0xb151('0x28')](_0x49a619,util[_0xb151('0x24')](_0xb151('0x1a3'),_0x49a619['project_id']));}if(_0x330d57===this[_0xb151('0x34')][_0xb151('0x37')]){return this[_0xb151('0x34')][_0xb151('0x28')](_0x49a619,_0xb151('0x1a4'));}this[_0xb151('0x33')]['sync'](this,_0x49a619,_0x330d57);var _0x1f15f2=this['channel'][_0xb151('0x55')](_0xb151('0x1a5'),util[_0xb151('0x24')](_0xb151('0x1a6'),config[_0xb151('0xb5')][_0xb151('0x1a7')]||_0xb151('0x1a8'),_0x330d57,this[_0xb151('0x34')]['arg_1']));if(_0x1f15f2[_0xb151('0xa4')]===-0x1){return _0x1f15f2;}return this[_0xb151('0x34')]['noop'](util[_0xb151('0x24')]('Executed\x20command\x20%s\x20%s',_0xb151('0x1a5'),_0x330d57));};AGIVertices['prototype'][_0xb151('0x1a9')]=function(_0x8322f1){logger[_0xb151('0x2a')](util['format'](_0xb151('0x1aa'),_0x8322f1['label']));var _0x577d98=this[_0xb151('0x54')]['sync'](this,_0x8322f1[_0xb151('0xb6')]);this['createSquareDetailsReport']['sync'](this,_0x8322f1,_0x8322f1[_0xb151('0xb6')]);if(this['isConfigured'](_0x8322f1[_0xb151('0xd5')])){var _0x2b2c6b=this[_0xb151('0xd')][_0xb151('0x6c')](this,_0x8322f1[_0xb151('0xd5')]);if(_0x2b2c6b){this['channel'][_0xb151('0x9e')](_0x2b2c6b,_0x577d98);return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x1ab'),_0x8322f1['command'],_0x2b2c6b));}}return this['channel'][_0xb151('0xaa')](util[_0xb151('0x24')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x8322f1[_0xb151('0xb6')]));};AGIVertices[_0xb151('0xc')][_0xb151('0x1ac')]=function(_0x42c98e){logger['info'](util[_0xb151('0x24')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x42c98e[_0xb151('0xac')]));_0x42c98e[_0xb151('0x5a')]=_0x42c98e[_0xb151('0x5a')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb151('0x81')](_0x42c98e[_0xb151('0x1ad')])){return this[_0xb151('0x34')]['noop'](_0xb151('0x1ae'));}if(!this[_0xb151('0x81')](_0x42c98e[_0xb151('0x5a')])){return this[_0xb151('0x34')]['noop'](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xaa')](util['format'](_0xb151('0x1af'),_0x42c98e[_0xb151('0x5a')]));var _0x4a0133=this[_0xb151('0x58')]['sync'](this,_0x42c98e);if(_0x4a0133){this[_0xb151('0x34')]['noop'](util[_0xb151('0x24')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x4a0133));var _0x49083d=this[_0xb151('0x34')][_0xb151('0x11c')](_0x4a0133);try{fs['unlink'](_0x4a0133+'.wav');}catch(_0x12c558){logger['error'](_0x12c558);}return _0x49083d;}return this['channel'][_0xb151('0x28')](_0x42c98e,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x3f7294){logger[_0xb151('0x2a')](util['format'](_0xb151('0x1b0'),_0x3f7294[_0xb151('0xac')]));_0x3f7294[_0xb151('0x5a')]=_0x3f7294[_0xb151('0x5a')][_0xb151('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xb151('0x81')](_0x3f7294['text'])){return this[_0xb151('0x34')][_0xb151('0xaa')](_0xb151('0xab'));}this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')]('Trying\x20Google\x20TTS\x20%s',_0x3f7294[_0xb151('0x5a')]));var _0x52076c=this[_0xb151('0x60')][_0xb151('0x6c')](this,_0x3f7294);if(_0x52076c){this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x1b1'),_0x52076c));var _0x17e420=this['channel'][_0xb151('0x11c')](_0x52076c);try{fs[_0xb151('0x1b2')](_0x52076c+_0xb151('0x11d'));}catch(_0x1eb233){logger[_0xb151('0x28')](_0x1eb233);}return _0x17e420;}return this[_0xb151('0x34')]['error'](_0x3f7294,_0xb151('0x1b3'));};AGIVertices[_0xb151('0xc')][_0xb151('0x1b4')]=function(_0x19b2c8){logger[_0xb151('0x2a')](util['format'](_0xb151('0x1b5'),_0x19b2c8[_0xb151('0xac')]));if(!this[_0xb151('0x81')](_0x19b2c8[_0xb151('0x14b')])){return this[_0xb151('0x34')][_0xb151('0x28')](_0x19b2c8,_0xb151('0x152'));}logger['info'](util[_0xb151('0x24')](_0xb151('0x14c'),this[_0xb151('0x34')]['callerid'],_0x19b2c8['findBy']));var _0xb2e367=this[_0xb151('0x4f')][_0xb151('0x6c')](this,_0x19b2c8[_0xb151('0x14b')]);if(_0xb2e367){logger[_0xb151('0x2a')](util[_0xb151('0x24')](_0xb151('0x14d'),this['channel'][_0xb151('0x38')],_0x19b2c8[_0xb151('0x14b')]));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x14d'),this[_0xb151('0x34')]['callerid'],_0x19b2c8[_0xb151('0x14b')]));return{'code':0xc8,'result':'success'};}else{logger[_0xb151('0x2a')](util['format'](_0xb151('0x153'),this[_0xb151('0x34')][_0xb151('0x38')],_0x19b2c8[_0xb151('0x14b')]));this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0x153'),this[_0xb151('0x34')]['callerid'],_0x19b2c8[_0xb151('0x14b')]));return{'code':0xc8,'result':_0xb151('0x14f')};}};AGIVertices[_0xb151('0xc')][_0xb151('0x1b6')]=function(_0x430990){logger[_0xb151('0x2a')](util['format'](_0xb151('0x1b7'),_0x430990['label']));var _0x1d3903=this['channel'][_0xb151('0x55')](_0xb151('0x1b8'),[_0x430990[_0xb151('0x1b9')],_0x430990['options']]);if(_0x1d3903[_0xb151('0xa4')]===-0x1){return _0x1d3903;}return this[_0xb151('0x34')][_0xb151('0xaa')](util[_0xb151('0x24')](_0xb151('0xc4'),_0xb151('0x1b8'),_0x430990[_0xb151('0x1b9')]));};AGIVertices['prototype'][_0xb151('0x1ba')]=function(_0xd37eb1){logger['info'](util[_0xb151('0x24')](_0xb151('0x1bb'),_0xd37eb1['label']));if(!this[_0xb151('0x81')](_0xd37eb1['variable_id'])){return this[_0xb151('0x34')][_0xb151('0x28')](_0xd37eb1,_0xb151('0x199'));}var _0x12bc9f=this['getVariable'][_0xb151('0x6c')](this,_0xd37eb1[_0xb151('0xd5')]);if(!_0x12bc9f){return this[_0xb151('0x34')]['error'](_0xd37eb1,_0xb151('0x158'));}var _0x231684=this['channel'][_0xb151('0xd')](_0x12bc9f);return{'code':0xc8,'result':_0x231684[_0xb151('0xa2')]?_0x231684[_0xb151('0xa2')]:'-'};};String[_0xb151('0xc')]['replaceAll']=function(_0x2071cf,_0x1589df){return this[_0xb151('0xa0')](_0x2071cf)[_0xb151('0x1bc')](_0x1589df);};module[_0xb151('0x1bd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 66b66a7..2cc1e71 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 _0xc90d=['format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','prototype','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','channels','agentconnect','syncAgentConnect','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','timers','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt'];(function(_0x196cfc,_0x186713){var _0x4e7116=function(_0x4c3213){while(--_0x4c3213){_0x196cfc['push'](_0x196cfc['shift']());}};_0x4e7116(++_0x186713);}(_0xc90d,0x1e5));var _0xdc90=function(_0x3f1b36,_0x205b14){_0x3f1b36=_0x3f1b36-0x0;var _0x56a704=_0xc90d[_0x3f1b36];return _0x56a704;};'use strict';var util=require(_0xdc90('0x0'));var _=require(_0xdc90('0x1'));var moment=require('moment');var ami=require(_0xdc90('0x2'));var logger=require('../../../config/logger')(_0xdc90('0x3'));var RpcUser=require(_0xdc90('0x4'));var RpcVoiceAgentReport=require(_0xdc90('0x5'));function Acw(_0x563be3){this[_0xdc90('0x6')]=_0x563be3[_0xdc90('0x6')];this[_0xdc90('0x7')]=_0x563be3[_0xdc90('0x7')];this['timers']=_0x563be3['timers'];this[_0xdc90('0x8')]={};ami['on'](_0xdc90('0x9'),this[_0xdc90('0xa')]['bind'](this));ami['on']('hanguprequest',this[_0xdc90('0xb')][_0xdc90('0xc')](this));ami['on'](_0xdc90('0xd'),this[_0xdc90('0xe')][_0xdc90('0xc')](this));ami['on'](_0xdc90('0xf'),this[_0xdc90('0x10')][_0xdc90('0xc')](this));ami['on']('attendedtransfer',this[_0xdc90('0x11')][_0xdc90('0xc')](this));ami['on'](_0xdc90('0x12'),this[_0xdc90('0x13')][_0xdc90('0xc')](this));ami['on'](_0xdc90('0x14'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x3c1160){var _0x47a025=moment()[_0xdc90('0x15')](0x0);var _0x4d39f3=moment(_0x3c1160)[_0xdc90('0x15')](0x0);return _0x47a025[_0xdc90('0x16')](_0x4d39f3,_0xdc90('0x17'));}Acw['prototype'][_0xdc90('0x18')]=function(_0x5f0d65){try{var _0x494722=this;var _0x3cc87a=this[_0xdc90('0x8')][_0x5f0d65][_0xdc90('0x19')];var _0x341ed6=this['channels'][_0x5f0d65][_0xdc90('0x1a')];var _0x3095cb=this[_0xdc90('0x6')][_0x341ed6];var _0x3ecdb5=![];var _0x35ae58=_0xdc90('0x1b');if(_0x3095cb[_0xdc90('0x1c')]){if(_0x3095cb[_0xdc90('0x1d')][_0xdc90('0x1e')]){_0x3ecdb5=!![];_0x35ae58=_0x3095cb[_0xdc90('0x1d')]['name'];}}ami['Action']({'action':'QueuePause','interface':_0x3cc87a,'paused':!![],'reason':_0x35ae58})[_0xdc90('0x1f')](function(_0x133605){if(_0x494722[_0xdc90('0x7')][_0x3cc87a]){return RpcUser[_0xdc90('0x20')](_0x494722[_0xdc90('0x7')][_0x3cc87a]['id'])[_0xdc90('0x1f')](function(_0x37ba4f){if(_0x37ba4f&&!_0x37ba4f[_0xdc90('0x21')]){logger['info'](_0xdc90('0x22'),_0x5f0d65,_0x3cc87a,_0x341ed6);var _0x35f636=_0x494722[_0xdc90('0x8')][_0x5f0d65][_0xdc90('0x23')]&&_0x494722[_0xdc90('0x8')][_0x5f0d65][_0xdc90('0x24')]?_0x494722[_0xdc90('0x8')][_0x5f0d65][_0xdc90('0x24')]:_0x5f0d65;return RpcUser[_0xdc90('0x25')](_0x494722[_0xdc90('0x7')][_0x3cc87a],_0x35ae58,_0x35f636)[_0xdc90('0x1f')](function(_0x1077fa){if(!_0x3ecdb5){_0x494722[_0xdc90('0x26')][_0x3cc87a]={};logger['info'](_0xdc90('0x27'),_0x5f0d65,_0x494722['voiceQueues'][_0x341ed6][_0xdc90('0x28')],_0x3cc87a,_0x341ed6);_0x494722[_0xdc90('0x26')][_0x3cc87a]['timer']=setTimeout(_0x494722[_0xdc90('0x29')][_0xdc90('0xc')](_0x494722,_0x3cc87a),_0x494722[_0xdc90('0x6')][_0x341ed6][_0xdc90('0x28')]*0x3e8);_0x494722[_0xdc90('0x26')][_0x3cc87a][_0xdc90('0x2a')]=moment()[_0xdc90('0x2b')](_0xdc90('0x2c'));_0x494722[_0xdc90('0x26')][_0x3cc87a]['uniqueid']=_0x5f0d65;_0x494722[_0xdc90('0x26')][_0x3cc87a][_0xdc90('0x1a')]=_0x341ed6;_0x494722['timers'][_0x3cc87a][_0xdc90('0x2d')]=function(){var _0x4e0ba6=getDiff(_0x494722[_0xdc90('0x26')][_0x3cc87a][_0xdc90('0x2a')]);clearTimeout(_0x494722[_0xdc90('0x26')][_0x3cc87a][_0xdc90('0x2e')]);_0x494722[_0xdc90('0x26')][_0x3cc87a][_0xdc90('0x2e')]=![];RpcVoiceAgentReport[_0xdc90('0x2f')]({'acwtime':_0x4e0ba6},_0x494722[_0xdc90('0x26')][_0x3cc87a][_0xdc90('0x30')],_0x3cc87a)[_0xdc90('0x1f')](function(_0x3857ef){logger[_0xdc90('0x31')](_0xdc90('0x32'),_0x5f0d65,_0x4e0ba6,_0x3857ef);})[_0xdc90('0x33')](function(_0x157649){logger[_0xdc90('0x34')](_0xdc90('0x35'),_0x5f0d65,_0x157649);});delete _0x494722['timers'][_0x3cc87a];};}});}else{logger[_0xdc90('0x31')](_0xdc90('0x36'),_0x5f0d65,_0x3cc87a,_0x341ed6);}});}})['catch'](function(_0x298833){logger[_0xdc90('0x34')](_0xdc90('0x27'),_0x5f0d65,_0x494722[_0xdc90('0x6')][_0x341ed6]['acwTimeout'],_0x3cc87a,_0x341ed6);})[_0xdc90('0x37')](function(){delete _0x494722[_0xdc90('0x8')][_0x5f0d65];});}catch(_0x55d5e9){logger[_0xdc90('0x34')](_0xdc90('0x38'),_0x55d5e9[_0xdc90('0x39')]);}};Acw['prototype'][_0xdc90('0x29')]=function(_0x58a53a){try{var _0x2d5c85=this;if(_0x2d5c85['timers'][_0x58a53a]){_0x2d5c85[_0xdc90('0x26')][_0x58a53a]['timer']=![];var _0x5af603=_0x2d5c85[_0xdc90('0x26')][_0x58a53a][_0xdc90('0x30')];var _0x136f91=_0x2d5c85['timers'][_0x58a53a][_0xdc90('0x1a')];var _0x2f4ff0=_0x2d5c85[_0xdc90('0x6')][_0x136f91][_0xdc90('0x28')];logger[_0xdc90('0x31')](_0xdc90('0x3a'),_0x5af603,_0x58a53a);RpcUser[_0xdc90('0x3b')](this['agents'][_0x58a53a]);RpcVoiceAgentReport[_0xdc90('0x2f')]({'acwtime':_0x2f4ff0,'agentacw':!![]},_0x5af603,_0x58a53a)[_0xdc90('0x1f')](function(_0x1f6968){logger[_0xdc90('0x31')](_0xdc90('0x32'),_0x5af603,_0x2f4ff0,_0x1f6968);})[_0xdc90('0x33')](function(_0x57ffff){logger[_0xdc90('0x34')]('[%s][UPDATE][ERRORS:%s]',_0x5af603,_0x57ffff);});}else{logger['error'](_0xdc90('0x3c'),_0x58a53a);if(_0x2d5c85[_0xdc90('0x26')]){logger[_0xdc90('0x31')]('[ACW][TIMERS]',JSON[_0xdc90('0x3d')](_0x2d5c85[_0xdc90('0x26')]));}}}catch(_0x50e2d6){logger[_0xdc90('0x34')]('[ACW][STOP]\x20%s',_0x50e2d6['message']);}};Acw[_0xdc90('0x3e')][_0xdc90('0xa')]=function(_0x163517){try{if(this['voiceQueues'][_0x163517['queue']]&&(this[_0xdc90('0x6')][_0x163517[_0xdc90('0x1a')]][_0xdc90('0x3')]||this[_0xdc90('0x6')][_0x163517[_0xdc90('0x1a')]][_0xdc90('0x1c')])){if(this[_0xdc90('0x7')][_0x163517[_0xdc90('0x19')]]){this[_0xdc90('0x8')][_0x163517[_0xdc90('0x30')]]={'queue':_0x163517['queue'],'interface':_0x163517[_0xdc90('0x19')],'destlinkedid':_0x163517[_0xdc90('0x24')]};}}}catch(_0x59fd9f){logger['error'](_0xdc90('0x3f'),_0x59fd9f[_0xdc90('0x39')]);}};Acw['prototype'][_0xdc90('0x40')]=function(_0xc03c38){try{if(this[_0xdc90('0x6')][_0xc03c38[_0xdc90('0x1a')]]&&(this[_0xdc90('0x6')][_0xc03c38[_0xdc90('0x1a')]][_0xdc90('0x3')]||this[_0xdc90('0x6')][_0xc03c38[_0xdc90('0x1a')]][_0xdc90('0x1c')])){if(this[_0xdc90('0x7')][_0xc03c38[_0xdc90('0x19')]]){this[_0xdc90('0x8')][_0xc03c38[_0xdc90('0x30')]]={'queue':_0xc03c38[_0xdc90('0x1a')],'interface':_0xc03c38[_0xdc90('0x19')]};}}}catch(_0x44f197){logger[_0xdc90('0x34')](_0xdc90('0x41'),_0x44f197['message']);}};Acw[_0xdc90('0x3e')]['syncHangupRequest']=function(_0x1524fc){try{if(this[_0xdc90('0x8')][_0x1524fc[_0xdc90('0x30')]]&&_[_0xdc90('0x42')](this[_0xdc90('0x8')][_0x1524fc[_0xdc90('0x30')]][_0xdc90('0x23')])){logger[_0xdc90('0x31')](_0xdc90('0x43'),_0x1524fc[_0xdc90('0x30')]);this['startAcw'](_0x1524fc[_0xdc90('0x30')]);}else if(this[_0xdc90('0x8')][_0x1524fc[_0xdc90('0x44')]]&&_[_0xdc90('0x42')](this[_0xdc90('0x8')][_0x1524fc[_0xdc90('0x44')]][_0xdc90('0x23')])){logger['info'](_0xdc90('0x45'),_0x1524fc[_0xdc90('0x44')]);this[_0xdc90('0x18')](_0x1524fc[_0xdc90('0x44')]);}}catch(_0x482fb0){logger[_0xdc90('0x34')](_0xdc90('0x46'),_0x482fb0[_0xdc90('0x39')]);}};Acw['prototype'][_0xdc90('0xe')]=function(_0x2ce501){try{if(this[_0xdc90('0x8')][_0x2ce501['uniqueid']]&&this[_0xdc90('0x8')][_0x2ce501[_0xdc90('0x30')]]['attended']){logger[_0xdc90('0x31')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x2ce501[_0xdc90('0x30')]);this['startAcw'](_0x2ce501[_0xdc90('0x30')]);}else if(this[_0xdc90('0x8')][_0x2ce501[_0xdc90('0x44')]]&&this['channels'][_0x2ce501[_0xdc90('0x44')]][_0xdc90('0x23')]){logger['info'](_0xdc90('0x47'),_0x2ce501['linkedid']);this[_0xdc90('0x18')](_0x2ce501[_0xdc90('0x44')]);}}catch(_0x35606a){logger[_0xdc90('0x34')](_0xdc90('0x48'),_0x35606a[_0xdc90('0x39')]);}};Acw[_0xdc90('0x3e')][_0xdc90('0x11')]=function(_0x13b583){try{if(!_[_0xdc90('0x49')](this[_0xdc90('0x8')][_0x13b583['transfereeuniqueid']])){this[_0xdc90('0x18')](_0x13b583[_0xdc90('0x4a')]);if(this['channels'][_0x13b583['secondtransfereruniqueid']]){this['channels'][_0x13b583[_0xdc90('0x4b')]][_0xdc90('0x23')]=!![];this['channels'][_0x13b583[_0xdc90('0x4c')]]=this[_0xdc90('0x8')][_0x13b583[_0xdc90('0x4b')]];delete this[_0xdc90('0x8')][_0x13b583['secondtransfereruniqueid']];}}else if(!_[_0xdc90('0x49')](this[_0xdc90('0x8')][_0x13b583[_0xdc90('0x4c')]])){this[_0xdc90('0x18')](_0x13b583[_0xdc90('0x4c')]);if(this[_0xdc90('0x8')][_0x13b583['origtransfereruniqueid']]){this[_0xdc90('0x8')][_0x13b583['origtransfereruniqueid']]['attended']=!![];this[_0xdc90('0x8')][_0x13b583[_0xdc90('0x4a')]]=this[_0xdc90('0x8')][_0x13b583['origtransfereruniqueid']];delete this[_0xdc90('0x8')][_0x13b583[_0xdc90('0x4d')]];}}}catch(_0x19b5cb){logger['error'](_0xdc90('0x4e'),_0x19b5cb[_0xdc90('0x39')]);}};Acw['prototype'][_0xdc90('0x13')]=function(_0x56e412){try{if(this[_0xdc90('0x8')][_0x56e412['transfereruniqueid']]){logger[_0xdc90('0x31')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xdc90('0x3d')](_0x56e412[_0xdc90('0x4f')]));this['startAcw'](_0x56e412[_0xdc90('0x4f')]);}else if(this[_0xdc90('0x8')][_0x56e412['transfererlinkedid']]){logger[_0xdc90('0x31')](_0xdc90('0x50'),JSON['stringify'](_0x56e412['transfererlinkedid']));this[_0xdc90('0x18')](_0x56e412[_0xdc90('0x51')]);}}catch(_0x5b5dda){logger[_0xdc90('0x34')](_0xdc90('0x52'),_0x5b5dda[_0xdc90('0x39')]);}};Acw['prototype'][_0xdc90('0x10')]=function(_0x538ba2){try{if(this[_0xdc90('0x6')][_0x538ba2[_0xdc90('0x1a')]]&&this['voiceQueues'][_0x538ba2['queue']][_0xdc90('0x53')]===_0xdc90('0x54')){if(this['agents'][_0x538ba2[_0xdc90('0x19')]]){logger[_0xdc90('0x31')](_0xdc90('0x55'),_0x538ba2[_0xdc90('0x30')],_0x538ba2[_0xdc90('0x19')],_0x538ba2[_0xdc90('0x1a')]);return RpcUser[_0xdc90('0x25')](this[_0xdc90('0x7')][_0x538ba2[_0xdc90('0x19')]],'Auto-Pause',_0x538ba2[_0xdc90('0x30')]);}}}catch(_0x5c6c58){logger['error'](_0xdc90('0x56'),_0x5c6c58[_0xdc90('0x39')]);}};module[_0xdc90('0x57')]=Acw; \ No newline at end of file +var _0xd17f=['queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw'];(function(_0x45cf07,_0xd190e4){var _0x109f1f=function(_0x34afbe){while(--_0x34afbe){_0x45cf07['push'](_0x45cf07['shift']());}};_0x109f1f(++_0xd190e4);}(_0xd17f,0x13f));var _0xfd17=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd17f[_0x3947c9];return _0x2e7871;};'use strict';var util=require(_0xfd17('0x0'));var _=require(_0xfd17('0x1'));var moment=require(_0xfd17('0x2'));var ami=require('../ami');var logger=require(_0xfd17('0x3'))(_0xfd17('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xfd17('0x5'));function Acw(_0x406a48){this['voiceQueues']=_0x406a48[_0xfd17('0x6')];this[_0xfd17('0x7')]=_0x406a48[_0xfd17('0x7')];this[_0xfd17('0x8')]=_0x406a48[_0xfd17('0x8')];this[_0xfd17('0x9')]={};ami['on'](_0xfd17('0xa'),this['syncAgentConnect'][_0xfd17('0xb')](this));ami['on'](_0xfd17('0xc'),this['syncHangupRequest'][_0xfd17('0xb')](this));ami['on'](_0xfd17('0xd'),this[_0xfd17('0xe')][_0xfd17('0xb')](this));ami['on'](_0xfd17('0xf'),this[_0xfd17('0x10')][_0xfd17('0xb')](this));ami['on']('attendedtransfer',this[_0xfd17('0x11')][_0xfd17('0xb')](this));ami['on']('blindtransfer',this[_0xfd17('0x12')][_0xfd17('0xb')](this));ami['on'](_0xfd17('0x13'),this[_0xfd17('0x14')][_0xfd17('0xb')](this));}function getDiff(_0x41b0ff){var _0x2ad6ba=moment()[_0xfd17('0x15')](0x0);var _0x55acc1=moment(_0x41b0ff)[_0xfd17('0x15')](0x0);return _0x2ad6ba['diff'](_0x55acc1,_0xfd17('0x16'));}Acw[_0xfd17('0x17')][_0xfd17('0x18')]=function(_0x47a37f){try{var _0x148545=this;var _0x1ffd8a=this[_0xfd17('0x9')][_0x47a37f]['interface'];var _0xdb3343=this[_0xfd17('0x9')][_0x47a37f][_0xfd17('0x19')];var _0x14ccda=this[_0xfd17('0x6')][_0xdb3343];var _0xc7d8c0=![];var _0x5dfe57=_0xfd17('0x1a');if(_0x14ccda[_0xfd17('0x1b')]){if(_0x14ccda[_0xfd17('0x1c')]['name']){_0xc7d8c0=!![];_0x5dfe57=_0x14ccda[_0xfd17('0x1c')][_0xfd17('0x1d')];}}ami[_0xfd17('0x1e')]({'action':'QueuePause','interface':_0x1ffd8a,'paused':!![],'reason':_0x5dfe57})[_0xfd17('0x1f')](function(_0x23ce15){if(_0x148545[_0xfd17('0x7')][_0x1ffd8a]){return RpcUser[_0xfd17('0x20')](_0x148545[_0xfd17('0x7')][_0x1ffd8a]['id'])['then'](function(_0x49c5f8){if(_0x49c5f8&&!_0x49c5f8[_0xfd17('0x21')]){logger[_0xfd17('0x22')](_0xfd17('0x23'),_0x47a37f,_0x1ffd8a,_0xdb3343);var _0x1637e5=_0x148545[_0xfd17('0x9')][_0x47a37f][_0xfd17('0x24')]&&_0x148545[_0xfd17('0x9')][_0x47a37f][_0xfd17('0x25')]?_0x148545[_0xfd17('0x9')][_0x47a37f]['destlinkedid']:_0x47a37f;return RpcUser['savePause'](_0x148545[_0xfd17('0x7')][_0x1ffd8a],_0x5dfe57,_0x1637e5)[_0xfd17('0x1f')](function(_0x511853){if(!_0xc7d8c0){_0x148545['timers'][_0x1ffd8a]={};logger[_0xfd17('0x22')](_0xfd17('0x26'),_0x47a37f,_0x148545[_0xfd17('0x6')][_0xdb3343][_0xfd17('0x27')],_0x1ffd8a,_0xdb3343);_0x148545[_0xfd17('0x8')][_0x1ffd8a][_0xfd17('0x28')]=setTimeout(_0x148545[_0xfd17('0x29')]['bind'](_0x148545,_0x1ffd8a),_0x148545[_0xfd17('0x6')][_0xdb3343][_0xfd17('0x27')]*0x3e8);_0x148545[_0xfd17('0x8')][_0x1ffd8a][_0xfd17('0x2a')]=moment()[_0xfd17('0x2b')](_0xfd17('0x2c'));_0x148545['timers'][_0x1ffd8a]['uniqueid']=_0x47a37f;_0x148545[_0xfd17('0x8')][_0x1ffd8a]['queue']=_0xdb3343;_0x148545[_0xfd17('0x8')][_0x1ffd8a][_0xfd17('0x2d')]=function(){var _0x2c7b1b=getDiff(_0x148545[_0xfd17('0x8')][_0x1ffd8a]['lastPauseAt']);clearTimeout(_0x148545[_0xfd17('0x8')][_0x1ffd8a][_0xfd17('0x28')]);_0x148545[_0xfd17('0x8')][_0x1ffd8a][_0xfd17('0x28')]=![];RpcVoiceAgentReport[_0xfd17('0x2e')]({'acwtime':_0x2c7b1b},_0x148545['timers'][_0x1ffd8a][_0xfd17('0x2f')],_0x1ffd8a)[_0xfd17('0x1f')](function(_0x350c54){logger[_0xfd17('0x22')](_0xfd17('0x30'),_0x47a37f,_0x2c7b1b,_0x350c54);})[_0xfd17('0x31')](function(_0xc2f08){logger[_0xfd17('0x32')](_0xfd17('0x33'),_0x47a37f,_0xc2f08);});delete _0x148545['timers'][_0x1ffd8a];};}});}else{logger['info'](_0xfd17('0x34'),_0x47a37f,_0x1ffd8a,_0xdb3343);}});}})[_0xfd17('0x31')](function(_0x2d48d8){logger[_0xfd17('0x32')](_0xfd17('0x26'),_0x47a37f,_0x148545[_0xfd17('0x6')][_0xdb3343][_0xfd17('0x27')],_0x1ffd8a,_0xdb3343);})[_0xfd17('0x35')](function(){delete _0x148545[_0xfd17('0x9')][_0x47a37f];});}catch(_0x4472c4){logger[_0xfd17('0x32')](_0xfd17('0x36'),_0x4472c4['message']);}};Acw[_0xfd17('0x17')][_0xfd17('0x29')]=function(_0x100baa){try{var _0x245b81=this;if(_0x245b81[_0xfd17('0x8')][_0x100baa]){_0x245b81[_0xfd17('0x8')][_0x100baa][_0xfd17('0x28')]=![];var _0x44df9d=_0x245b81['timers'][_0x100baa][_0xfd17('0x2f')];var _0xeade98=_0x245b81[_0xfd17('0x8')][_0x100baa][_0xfd17('0x19')];var _0x5f5715=_0x245b81['voiceQueues'][_0xeade98][_0xfd17('0x27')];logger[_0xfd17('0x22')](_0xfd17('0x37'),_0x44df9d,_0x100baa);RpcUser[_0xfd17('0x38')](this[_0xfd17('0x7')][_0x100baa]);RpcVoiceAgentReport[_0xfd17('0x2e')]({'acwtime':_0x5f5715,'agentacw':!![]},_0x44df9d,_0x100baa)['then'](function(_0x276bc4){logger[_0xfd17('0x22')](_0xfd17('0x30'),_0x44df9d,_0x5f5715,_0x276bc4);})['catch'](function(_0x1f2401){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x44df9d,_0x1f2401);});}else{logger[_0xfd17('0x32')](_0xfd17('0x39'),_0x100baa);if(_0x245b81[_0xfd17('0x8')]){logger['info'](_0xfd17('0x3a'),JSON[_0xfd17('0x3b')](_0x245b81[_0xfd17('0x8')]));}}}catch(_0x4b2c26){logger[_0xfd17('0x32')](_0xfd17('0x3c'),_0x4b2c26[_0xfd17('0x3d')]);}};Acw[_0xfd17('0x17')]['syncAgentConnect']=function(_0x559dc0){try{if(this['voiceQueues'][_0x559dc0[_0xfd17('0x19')]]&&(this[_0xfd17('0x6')][_0x559dc0[_0xfd17('0x19')]][_0xfd17('0x4')]||this['voiceQueues'][_0x559dc0[_0xfd17('0x19')]][_0xfd17('0x1b')])){if(this[_0xfd17('0x7')][_0x559dc0[_0xfd17('0x3e')]]){this[_0xfd17('0x9')][_0x559dc0[_0xfd17('0x2f')]]={'queue':_0x559dc0[_0xfd17('0x19')],'interface':_0x559dc0[_0xfd17('0x3e')],'destlinkedid':_0x559dc0[_0xfd17('0x25')]};}}}catch(_0x5cae41){logger[_0xfd17('0x32')](_0xfd17('0x3f'),_0x5cae41[_0xfd17('0x3d')]);}};Acw[_0xfd17('0x17')]['syncAgentConnectPreview']=function(_0x2ad83b){try{if(this[_0xfd17('0x6')][_0x2ad83b[_0xfd17('0x19')]]&&(this[_0xfd17('0x6')][_0x2ad83b[_0xfd17('0x19')]]['acw']||this['voiceQueues'][_0x2ad83b['queue']]['mandatoryDisposition'])){if(this[_0xfd17('0x7')][_0x2ad83b['interface']]){this[_0xfd17('0x9')][_0x2ad83b[_0xfd17('0x2f')]]={'queue':_0x2ad83b[_0xfd17('0x19')],'interface':_0x2ad83b[_0xfd17('0x3e')]};}}}catch(_0x27cfe6){logger['error'](_0xfd17('0x40'),_0x27cfe6[_0xfd17('0x3d')]);}};Acw['prototype'][_0xfd17('0x41')]=function(_0x17b9e2){try{if(this[_0xfd17('0x9')][_0x17b9e2[_0xfd17('0x2f')]]&&_[_0xfd17('0x42')](this[_0xfd17('0x9')][_0x17b9e2[_0xfd17('0x2f')]][_0xfd17('0x24')])){logger['info'](_0xfd17('0x43'),_0x17b9e2[_0xfd17('0x2f')]);this[_0xfd17('0x18')](_0x17b9e2[_0xfd17('0x2f')]);}else if(this[_0xfd17('0x9')][_0x17b9e2['linkedid']]&&_[_0xfd17('0x42')](this['channels'][_0x17b9e2['linkedid']]['attended'])){logger[_0xfd17('0x22')]('[%s][HANGUP:LINKEDID]',_0x17b9e2['linkedid']);this['startAcw'](_0x17b9e2[_0xfd17('0x44')]);}}catch(_0x37e50f){logger['error'](_0xfd17('0x45'),_0x37e50f[_0xfd17('0x3d')]);}};Acw[_0xfd17('0x17')]['syncHangup']=function(_0x1c9585){try{if(this[_0xfd17('0x9')][_0x1c9585[_0xfd17('0x2f')]]&&this['channels'][_0x1c9585[_0xfd17('0x2f')]][_0xfd17('0x24')]){logger[_0xfd17('0x22')](_0xfd17('0x46'),_0x1c9585[_0xfd17('0x2f')]);this[_0xfd17('0x18')](_0x1c9585['uniqueid']);}else if(this[_0xfd17('0x9')][_0x1c9585[_0xfd17('0x44')]]&&this[_0xfd17('0x9')][_0x1c9585[_0xfd17('0x44')]][_0xfd17('0x24')]){logger[_0xfd17('0x22')](_0xfd17('0x47'),_0x1c9585[_0xfd17('0x44')]);this['startAcw'](_0x1c9585['linkedid']);}}catch(_0x44787e){logger[_0xfd17('0x32')](_0xfd17('0x48'),_0x44787e[_0xfd17('0x3d')]);}};Acw[_0xfd17('0x17')][_0xfd17('0x11')]=function(_0x25f9db){try{if(!_[_0xfd17('0x49')](this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4a')]])){this['startAcw'](_0x25f9db[_0xfd17('0x4a')]);if(this['channels'][_0x25f9db[_0xfd17('0x4b')]]){this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4b')]][_0xfd17('0x24')]=!![];this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4c')]]=this[_0xfd17('0x9')][_0x25f9db['secondtransfereruniqueid']];delete this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4b')]];}}else if(!_[_0xfd17('0x49')](this[_0xfd17('0x9')][_0x25f9db['transfertargetuniqueid']])){this[_0xfd17('0x18')](_0x25f9db[_0xfd17('0x4c')]);if(this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4d')]]){this['channels'][_0x25f9db['origtransfereruniqueid']][_0xfd17('0x24')]=!![];this['channels'][_0x25f9db[_0xfd17('0x4a')]]=this['channels'][_0x25f9db[_0xfd17('0x4d')]];delete this[_0xfd17('0x9')][_0x25f9db[_0xfd17('0x4d')]];}}}catch(_0x1d26a0){logger[_0xfd17('0x32')](_0xfd17('0x4e'),_0x1d26a0[_0xfd17('0x3d')]);}};Acw['prototype'][_0xfd17('0x12')]=function(_0x25fd94){try{if(this[_0xfd17('0x9')][_0x25fd94[_0xfd17('0x4f')]]){logger[_0xfd17('0x22')](_0xfd17('0x50'),JSON[_0xfd17('0x3b')](_0x25fd94[_0xfd17('0x4f')]));this[_0xfd17('0x18')](_0x25fd94['transfereruniqueid']);}else if(this['channels'][_0x25fd94[_0xfd17('0x51')]]){logger[_0xfd17('0x22')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x25fd94[_0xfd17('0x51')]));this[_0xfd17('0x18')](_0x25fd94[_0xfd17('0x51')]);}}catch(_0x336013){logger[_0xfd17('0x32')]('[ACW][syncBlindTransfer]\x20%s',_0x336013['message']);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x2ad3b7){try{if(this[_0xfd17('0x6')][_0x2ad3b7[_0xfd17('0x19')]]&&this[_0xfd17('0x6')][_0x2ad3b7[_0xfd17('0x19')]][_0xfd17('0x52')]===_0xfd17('0x53')){if(this[_0xfd17('0x7')][_0x2ad3b7[_0xfd17('0x3e')]]){logger['info'](_0xfd17('0x54'),_0x2ad3b7[_0xfd17('0x2f')],_0x2ad3b7[_0xfd17('0x3e')],_0x2ad3b7[_0xfd17('0x19')]);return RpcUser['savePause'](this[_0xfd17('0x7')][_0x2ad3b7['interface']],'Auto-Pause',_0x2ad3b7[_0xfd17('0x2f')]);}}}catch(_0x4233d2){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x4233d2[_0xfd17('0x3d')]);}};module[_0xfd17('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 09c876d..1f755f5 100644 --- a/server/services/ami/ami.js +++ b/server/services/ami/ami.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['../../config/environment','asterisk','port','username','password','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','format','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipPeerStatus','catch','[ami.js][fullybooted]','once','asterisk-manager','moment','lodash','../../config/logger','ami'];(function(_0x4c987f,_0x5bb5d9){var _0x523598=function(_0x4e57ab){while(--_0x4e57ab){_0x4c987f['push'](_0x4c987f['shift']());}};_0x523598(++_0x5bb5d9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1979d8,_0x10d8f2){_0x1979d8=_0x1979d8-0x0;var _0x1d5bb3=_0x0b0e[_0x1979d8];return _0x1d5bb3;};'use strict';var Manager=require(_0xe0b0('0x0'));var BPromise=require('bluebird');var moment=require(_0xe0b0('0x1'));var util=require('util');var _=require(_0xe0b0('0x2'));var logger=require(_0xe0b0('0x3'))(_0xe0b0('0x4'));var config=require(_0xe0b0('0x5'));var ami=new Manager(config[_0xe0b0('0x6')][_0xe0b0('0x7')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')][_0xe0b0('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0xe0b0('0xa')](ami[_0xe0b0('0xb')]);function error(_0xc4a085){logger[_0xe0b0('0xc')](util['format'](_0xe0b0('0xd'),config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')]['port'],util[_0xe0b0('0xe')](_0xc4a085,![],null)));}function close(){logger[_0xe0b0('0xc')](util[_0xe0b0('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xe0b0('0x6')][_0xe0b0('0x8')],config[_0xe0b0('0x6')]['ip'],config[_0xe0b0('0x6')][_0xe0b0('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x11')});};};ami[_0xe0b0('0x12')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':_0xe0b0('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'sippeerstatus'});};};ami[_0xe0b0('0x14')]=function(){return function(){return ami[_0xe0b0('0x10')]({'action':'queuesummary'});};};ami[_0xe0b0('0x15')]=function(){return function(){return ami['Action']({'action':_0xe0b0('0x16')});};};function connect(_0x100204){logger['info'](util['format'](_0xe0b0('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0xe0b0('0x6')]['port']));ami['once'](_0xe0b0('0xc'),error);ami['once'](_0xe0b0('0x18'),close);}ami['on']('connect',connect);ami['on'](_0xe0b0('0x19'),function(_0x1cd7c4){logger[_0xe0b0('0x1a')](util[_0xe0b0('0xf')](_0xe0b0('0x1b'),config['asterisk']['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')],util[_0xe0b0('0xe')](_0x1cd7c4,![],null)));});ami['on']('fullybooted',function(_0x170ad8){logger['info'](util[_0xe0b0('0xf')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe0b0('0x6')]['username'],config[_0xe0b0('0x6')]['ip'],config['asterisk'][_0xe0b0('0x7')]));return BPromise['resolve']()[_0xe0b0('0x1c')](ami['actionSipShowRegistry']())[_0xe0b0('0x1c')](ami[_0xe0b0('0x12')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x1d')]())[_0xe0b0('0x1c')](ami[_0xe0b0('0x14')]())['then'](ami[_0xe0b0('0x15')]())[_0xe0b0('0x1e')](function(_0x5b7a64){logger[_0xe0b0('0xc')](_0xe0b0('0x1f'),util[_0xe0b0('0xe')](_0x5b7a64,{'showHidden':![],'depth':null}));});});ami[_0xe0b0('0x20')](_0xe0b0('0xc'),error);ami[_0xe0b0('0x20')](_0xe0b0('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0xbaf0=['once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','then','actionSipShowRegistry','catch','[ami.js][fullybooted]','exports','bluebird','moment','util','lodash','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x154ac3,_0x550800){var _0x1d3a71=function(_0x36e7bf){while(--_0x36e7bf){_0x154ac3['push'](_0x154ac3['shift']());}};_0x1d3a71(++_0x550800);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var _=require(_0x0baf('0x3'));var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var config=require('../../config/environment');var ami=new Manager(config[_0x0baf('0x6')][_0x0baf('0x7')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')][_0x0baf('0x9')],!![]);ami[_0x0baf('0xa')]();ami[_0x0baf('0xb')]=BPromise['promisify'](ami[_0x0baf('0xc')]);function error(_0x5f20aa){logger[_0x0baf('0xd')](util[_0x0baf('0xe')](_0x0baf('0xf'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')],util[_0x0baf('0x10')](_0x5f20aa,![],null)));}function close(){logger[_0x0baf('0xd')](util[_0x0baf('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x0baf('0xb')]({'action':'sipshowregistry'});};};ami[_0x0baf('0x11')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x12')});};};ami[_0x0baf('0x13')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x14')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0x0baf('0x15')});};};ami[_0x0baf('0x16')]=function(){return function(){return ami[_0x0baf('0xb')]({'action':_0x0baf('0x17')});};};function connect(_0x2cf7da){logger[_0x0baf('0x18')](util['format'](_0x0baf('0x19'),config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));ami['once']('error',error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);}ami['on'](_0x0baf('0x1c'),connect);ami['on'](_0x0baf('0x1d'),function(_0x1fa92b){logger[_0x0baf('0x18')](util[_0x0baf('0xe')](_0x0baf('0x1e'),config[_0x0baf('0x6')][_0x0baf('0x8')],config['asterisk']['ip'],config[_0x0baf('0x6')]['port'],util[_0x0baf('0x10')](_0x1fa92b,![],null)));});ami['on']('fullybooted',function(_0x4de74c){logger[_0x0baf('0x18')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x0baf('0x6')][_0x0baf('0x8')],config[_0x0baf('0x6')]['ip'],config[_0x0baf('0x6')][_0x0baf('0x7')]));return BPromise['resolve']()[_0x0baf('0x1f')](ami[_0x0baf('0x20')]())[_0x0baf('0x1f')](ami[_0x0baf('0x11')]())[_0x0baf('0x1f')](ami[_0x0baf('0x13')]())[_0x0baf('0x1f')](ami['actionQueueSummary']())[_0x0baf('0x1f')](ami[_0x0baf('0x16')]())[_0x0baf('0x21')](function(_0x265915){logger['error'](_0x0baf('0x22'),util[_0x0baf('0x10')](_0x265915,{'showHidden':![],'depth':null}));});});ami['once'](_0x0baf('0xd'),error);ami[_0x0baf('0x1a')](_0x0baf('0x1b'),close);module[_0x0baf('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 4a447ce..51f12f1 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 _0xda3f=['then','rpc','memberReport','error','message','result','catch','exports','bluebird','../../config/logger','Request','request'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xda3f,0xec));var _0xfda3=function(_0x38162e,_0x31266d){_0x38162e=_0x38162e-0x0;var _0x361218=_0xda3f[_0x38162e];return _0x361218;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('ami');var client=jayson['client']['http']({'port':0x2329});client[_0xfda3('0x2')]=function(_0x581693,_0x36dc71){return new BPromise(function(_0x22187d,_0x516500){return client[_0xfda3('0x3')](_0x581693,_0x36dc71)[_0xfda3('0x4')](function(_0x47e7e2){logger['debug'](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x36dc71,_0x47e7e2);if(_0x47e7e2[_0xfda3('0x7')]){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')],_0x36dc71);return _0x516500(_0x47e7e2[_0xfda3('0x7')][_0xfda3('0x8')]);}else{return _0x22187d(_0x47e7e2[_0xfda3('0x9')]);}})[_0xfda3('0xa')](function(_0x4d7841){logger[_0xfda3('0x7')](_0xfda3('0x5'),_0xfda3('0x6'),_0x581693,_0x4d7841,_0x36dc71);return _0x516500(_0x4d7841);});});};module[_0xfda3('0xb')]=client; \ No newline at end of file +var _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x471dbb,_0x50a0ed){var _0x16911f=function(_0x9ca5b4){while(--_0x9ca5b4){_0x471dbb['push'](_0x471dbb['shift']());}};_0x16911f(++_0x50a0ed);}(_0xf4eb,0xec));var _0xbf4e=function(_0x193de1,_0x4fa18f){_0x193de1=_0x193de1-0x0;var _0x238912=_0xf4eb[_0x193de1];return _0x238912;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 5a084bd..f61fafe 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf5bc=['VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','substring','voiceQueue','dialCutDigit','getQueue','isNil','string','name','Contact','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId'];(function(_0x183dc8,_0x44675d){var _0x555fc6=function(_0x2314eb){while(--_0x2314eb){_0x183dc8['push'](_0x183dc8['shift']());}};_0x555fc6(++_0x44675d);}(_0xf5bc,0x133));var _0xcf5b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf5bc[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x3d9c1a,_0x1eed1e,_0x3e8b70){var _0x149cb4='';if(!_[_0xcf5b('0x0')](_0x1eed1e)&&_0xcf5b('0x1')===typeof _0x1eed1e){_0x149cb4+=_0x1eed1e;}if(!_[_0xcf5b('0x0')](_0x3e8b70)&&_0xcf5b('0x1')===typeof _0x3e8b70){_0x149cb4+='\x20'+_0x3e8b70;}if(_0x149cb4!==''){return _0x149cb4;}return _0x3d9c1a;}function Action(_0x328fb6,_0x5986a5,_0x33bb87){this['voiceQueue']=_0x328fb6;this['uniqueid']=_0x33bb87||undefined;this[_0xcf5b('0x2')]=checkNameSurname(_0x5986a5[_0xcf5b('0x3')]['phone'],_0x5986a5[_0xcf5b('0x3')]['firstName'],_0x5986a5[_0xcf5b('0x3')]['lastName']);this[_0xcf5b('0x4')]=_0x5986a5[_0xcf5b('0x5')];this[_0xcf5b('0x6')]=_0x328fb6[_0xcf5b('0x2')];this[_0xcf5b('0x7')]=_0x5986a5[_0xcf5b('0x7')]||![];this[_0xcf5b('0x8')]=_0x328fb6[_0xcf5b('0x8')];this['dialQueueTimeout']=_0x328fb6[_0xcf5b('0x9')]||0x3;this[_0xcf5b('0xa')]=_0x5986a5[_0xcf5b('0xa')];this['countbusyretry']=_0x5986a5[_0xcf5b('0xb')];this[_0xcf5b('0xc')]=_0x5986a5[_0xcf5b('0xc')];this['countnoanswerretry']=_0x5986a5[_0xcf5b('0xd')];this[_0xcf5b('0xe')]=_0x5986a5[_0xcf5b('0xe')];this['countdropretry']=_0x5986a5[_0xcf5b('0xf')];this[_0xcf5b('0x10')]=_0x5986a5[_0xcf5b('0x10')];this['countmachineretry']=_0x5986a5['countmachineretry'];this[_0xcf5b('0x11')]=_0x5986a5[_0xcf5b('0x11')];this[_0xcf5b('0x12')]=_0x5986a5['ContactId'];this[_0xcf5b('0x13')]=_0x5986a5[_0xcf5b('0x13')];this[_0xcf5b('0x14')]=_0x5986a5['UserId'];this[_0xcf5b('0x15')]=_0x5986a5['VoiceQueueId'];this[_0xcf5b('0x16')]=_0x5986a5[_0xcf5b('0x16')];this[_0xcf5b('0x17')]=_0x5986a5['id'];this[_0xcf5b('0x18')]=_0x5986a5[_0xcf5b('0x3')][_0xcf5b('0x19')]||'';this[_0xcf5b('0x1a')]=moment()[_0xcf5b('0x1b')](_0xcf5b('0x1c'));this[_0xcf5b('0x1d')]=_0x5986a5[_0xcf5b('0x1d')];this[_0xcf5b('0x1e')]=_0x5986a5[_0xcf5b('0x1e')];this[_0xcf5b('0x1f')]=_0x5986a5[_0xcf5b('0x1f')];this[_0xcf5b('0x20')]=_0x5986a5[_0xcf5b('0x20')];this[_0xcf5b('0x21')]='';this[_0xcf5b('0x22')]='';}Action[_0xcf5b('0x23')][_0xcf5b('0x24')]=function(){return util[_0xcf5b('0x1b')]('\x22%s\x22\x20<%s>',this[_0xcf5b('0x2')],this['voiceQueue']['dialCutDigit']>0x0?this['number'][_0xcf5b('0x25')](this[_0xcf5b('0x26')][_0xcf5b('0x27')]):this[_0xcf5b('0x4')]);};Action[_0xcf5b('0x23')][_0xcf5b('0x28')]=function(){return this['queue'];};module['exports']=Action; \ No newline at end of file +var _0x53c2=['originatecalleridname','prototype','getCaller','format','dialCutDigit','queue','exports','util','lodash','moment','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum'];(function(_0x45c7c5,_0x43520e){var _0x596a3e=function(_0x3158c4){while(--_0x3158c4){_0x45c7c5['push'](_0x45c7c5['shift']());}};_0x596a3e(++_0x43520e);}(_0x53c2,0x15f));var _0x253c=function(_0x2ecc30,_0x1b0547){_0x2ecc30=_0x2ecc30-0x0;var _0x2ffa7e=_0x53c2[_0x2ecc30];return _0x2ffa7e;};'use strict';var util=require(_0x253c('0x0'));var _=require(_0x253c('0x1'));var moment=require(_0x253c('0x2'));function checkNameSurname(_0x11ff81,_0x1ae5bb,_0x2fcc7d){var _0x47a0e8='';if(!_['isNil'](_0x1ae5bb)&&'string'===typeof _0x1ae5bb){_0x47a0e8+=_0x1ae5bb;}if(!_['isNil'](_0x2fcc7d)&&_0x253c('0x3')===typeof _0x2fcc7d){_0x47a0e8+='\x20'+_0x2fcc7d;}if(_0x47a0e8!==''){return _0x47a0e8;}return _0x11ff81;}function Action(_0xee2d4,_0x411cf1,_0x49b368){this[_0x253c('0x4')]=_0xee2d4;this[_0x253c('0x5')]=_0x49b368||undefined;this[_0x253c('0x6')]=checkNameSurname(_0x411cf1[_0x253c('0x7')][_0x253c('0x8')],_0x411cf1[_0x253c('0x7')][_0x253c('0x9')],_0x411cf1[_0x253c('0x7')][_0x253c('0xa')]);this[_0x253c('0xb')]=_0x411cf1[_0x253c('0x8')];this['queue']=_0xee2d4[_0x253c('0x6')];this[_0x253c('0xc')]=_0x411cf1[_0x253c('0xc')]||![];this[_0x253c('0xd')]=_0xee2d4[_0x253c('0xd')];this[_0x253c('0xe')]=_0xee2d4[_0x253c('0xe')]||0x3;this[_0x253c('0xf')]=_0x411cf1[_0x253c('0xf')];this[_0x253c('0x10')]=_0x411cf1[_0x253c('0x10')];this[_0x253c('0x11')]=_0x411cf1['countcongestionretry'];this[_0x253c('0x12')]=_0x411cf1[_0x253c('0x12')];this[_0x253c('0x13')]=_0x411cf1[_0x253c('0x13')];this[_0x253c('0x14')]=_0x411cf1[_0x253c('0x14')];this[_0x253c('0x15')]=_0x411cf1['countabandonedretry'];this[_0x253c('0x16')]=_0x411cf1[_0x253c('0x16')];this[_0x253c('0x17')]=_0x411cf1[_0x253c('0x17')];this[_0x253c('0x18')]=_0x411cf1['ContactId'];this[_0x253c('0x19')]=_0x411cf1['ListId'];this[_0x253c('0x1a')]=_0x411cf1[_0x253c('0x1a')];this[_0x253c('0x1b')]=_0x411cf1[_0x253c('0x1b')];this[_0x253c('0x1c')]=_0x411cf1[_0x253c('0x1c')];this['idHopper']=_0x411cf1['id'];this['ContactFirstName']=_0x411cf1[_0x253c('0x7')][_0x253c('0x9')]||'';this[_0x253c('0x1d')]=moment()['format'](_0x253c('0x1e'));this[_0x253c('0x1f')]=_0x411cf1[_0x253c('0x1f')];this[_0x253c('0x20')]=_0x411cf1[_0x253c('0x20')];this[_0x253c('0x21')]=_0x411cf1['callbackat'];this[_0x253c('0x22')]=_0x411cf1[_0x253c('0x22')];this[_0x253c('0x23')]='';this[_0x253c('0x24')]='';}Action[_0x253c('0x25')][_0x253c('0x26')]=function(){return util[_0x253c('0x27')]('\x22%s\x22\x20<%s>',this[_0x253c('0x6')],this[_0x253c('0x4')][_0x253c('0x28')]>0x0?this[_0x253c('0xb')]['substring'](this[_0x253c('0x4')][_0x253c('0x28')]):this[_0x253c('0xb')]);};Action[_0x253c('0x25')]['getQueue']=function(){return this[_0x253c('0x29')];};module[_0x253c('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index ec93458..98f20e6 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4347=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','state','statedesc','Answer','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x3f369c,_0x1c5793){var _0x3f851a=function(_0x482e57){while(--_0x482e57){_0x3f369c['push'](_0x3f369c['shift']());}};_0x3f851a(++_0x1c5793);}(_0x4347,0xea));var _0x7434=function(_0x10c97a,_0x1dc52e){_0x10c97a=_0x10c97a-0x0;var _0x54e5a5=_0x4347[_0x10c97a];return _0x54e5a5;};'use strict';var util=require(_0x7434('0x0'));var _=require(_0x7434('0x1'));var moment=require('moment');function getSeconds(_0x2bda83,_0x3dd677){var _0x272b28=moment(_0x2bda83)[_0x7434('0x2')](0x0);var _0x3e4f33=moment(_0x3dd677)['milliseconds'](0x0);return _0x272b28[_0x7434('0x3')](_0x3e4f33,'seconds');}function AgentComplete(_0x220178,_0x17c603){this[_0x7434('0x4')]=0x4;this[_0x7434('0x5')]=_0x7434('0x6');this['scheduledat']=_0x220178[_0x7434('0x7')];this['type']=_0x220178['type'];this[_0x7434('0x8')]=_0x220178[_0x7434('0x9')]===_0x7434('0xa')?_0x7434('0xb'):_0x220178['type'];this[_0x7434('0xc')]=_0x220178['countbusyretry'];this[_0x7434('0xd')]=_0x220178['countcongestionretry'];this[_0x7434('0xe')]=_0x220178[_0x7434('0xe')];this[_0x7434('0xf')]=_0x220178[_0x7434('0xc')]+_0x220178[_0x7434('0xd')]+_0x220178[_0x7434('0xe')]+_0x220178['countnosuchnumberretry']+_0x220178[_0x7434('0x10')]+_0x220178[_0x7434('0x11')]+_0x220178[_0x7434('0x12')]+_0x220178[_0x7434('0x13')];this[_0x7434('0x14')]=_0x220178[_0x7434('0x14')];this[_0x7434('0x10')]=_0x220178[_0x7434('0x10')];this[_0x7434('0x11')]=_0x220178[_0x7434('0x11')];this[_0x7434('0x12')]=_0x220178[_0x7434('0x12')];this[_0x7434('0x13')]=_0x220178[_0x7434('0x13')];this[_0x7434('0x15')]=_0x17c603[_0x7434('0x15')];this[_0x7434('0x16')]=_0x220178[_0x7434('0x17')];this[_0x7434('0x18')]=_0x220178['number'];this[_0x7434('0x19')]=_0x220178[_0x7434('0x19')];this[_0x7434('0x1a')]=_0x220178[_0x7434('0x1a')];this[_0x7434('0x1b')]=_0x220178[_0x7434('0x1b')];this[_0x7434('0x1c')]=moment()[_0x7434('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7434('0x1e')]=getSeconds(_0x220178['responsetime'],_0x220178['starttime']);this[_0x7434('0x1f')]=getSeconds(_0x220178['answertime'],_0x220178[_0x7434('0x1a')]);this[_0x7434('0x20')]=getSeconds(this[_0x7434('0x1c')],_0x220178[_0x7434('0x1b')]);this[_0x7434('0xb')]=_0x17c603['queue'];this[_0x7434('0x21')]=_0x17c603['membername'];this['reason']=_0x17c603[_0x7434('0x22')];this[_0x7434('0x23')]=_0x220178[_0x7434('0x23')];this[_0x7434('0x24')]=_0x220178[_0x7434('0x24')];this['callbackat']=_0x220178['callbackat'];this[_0x7434('0x25')]=_0x220178[_0x7434('0x25')];this[_0x7434('0x26')]=_0x220178['ContactId'];this[_0x7434('0x27')]=_0x220178['ListId'];this[_0x7434('0x28')]=_0x220178[_0x7434('0x28')];this[_0x7434('0x29')]=_0x220178[_0x7434('0x29')];this[_0x7434('0x2a')]=_0x220178[_0x7434('0x2a')];this[_0x7434('0x2b')]=_0x220178[_0x7434('0x2b')]||'';this[_0x7434('0x2c')]=_0x220178[_0x7434('0x2c')]||'';}module[_0x7434('0x2d')]=AgentComplete; \ No newline at end of file +var _0x3e24=['talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','ringtime','holdtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e24,0x167));var _0x43e2=function(_0x4083da,_0x7aee27){_0x4083da=_0x4083da-0x0;var _0x46dfcc=_0x3e24[_0x4083da];return _0x46dfcc;};'use strict';var util=require(_0x43e2('0x0'));var _=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));function getSeconds(_0x3e321a,_0x1f5951){var _0x582ca4=moment(_0x3e321a)[_0x43e2('0x3')](0x0);var _0x1ff04b=moment(_0x1f5951)['milliseconds'](0x0);return _0x582ca4[_0x43e2('0x4')](_0x1ff04b,_0x43e2('0x5'));}function AgentComplete(_0x1a89fc,_0x28b144){this[_0x43e2('0x6')]=0x4;this[_0x43e2('0x7')]=_0x43e2('0x8');this['scheduledat']=_0x1a89fc[_0x43e2('0x9')];this[_0x43e2('0xa')]=_0x1a89fc['type'];this[_0x43e2('0xb')]=_0x1a89fc[_0x43e2('0xa')]==='outbound'?_0x43e2('0xc'):_0x1a89fc[_0x43e2('0xa')];this['countbusyretry']=_0x1a89fc[_0x43e2('0xd')];this['countcongestionretry']=_0x1a89fc['countcongestionretry'];this['countnoanswerretry']=_0x1a89fc[_0x43e2('0xe')];this[_0x43e2('0xf')]=_0x1a89fc[_0x43e2('0xd')]+_0x1a89fc[_0x43e2('0x10')]+_0x1a89fc[_0x43e2('0xe')]+_0x1a89fc[_0x43e2('0x11')]+_0x1a89fc[_0x43e2('0x12')]+_0x1a89fc[_0x43e2('0x13')]+_0x1a89fc[_0x43e2('0x14')]+_0x1a89fc[_0x43e2('0x15')];this[_0x43e2('0x11')]=_0x1a89fc[_0x43e2('0x11')];this['countdropretry']=_0x1a89fc[_0x43e2('0x12')];this[_0x43e2('0x13')]=_0x1a89fc[_0x43e2('0x13')];this[_0x43e2('0x14')]=_0x1a89fc['countmachineretry'];this['countagentrejectretry']=_0x1a89fc[_0x43e2('0x15')];this[_0x43e2('0x16')]=_0x28b144[_0x43e2('0x16')];this[_0x43e2('0x17')]=_0x1a89fc[_0x43e2('0x18')];this[_0x43e2('0x19')]=_0x1a89fc[_0x43e2('0x1a')];this[_0x43e2('0x1b')]=_0x1a89fc[_0x43e2('0x1b')];this[_0x43e2('0x1c')]=_0x1a89fc['responsetime'];this[_0x43e2('0x1d')]=_0x1a89fc[_0x43e2('0x1d')];this['endtime']=moment()[_0x43e2('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x43e2('0x1f')]=getSeconds(_0x1a89fc[_0x43e2('0x1c')],_0x1a89fc[_0x43e2('0x1b')]);this[_0x43e2('0x20')]=getSeconds(_0x1a89fc[_0x43e2('0x1d')],_0x1a89fc['responsetime']);this[_0x43e2('0x21')]=getSeconds(this[_0x43e2('0x22')],_0x1a89fc[_0x43e2('0x1d')]);this['queue']=_0x28b144[_0x43e2('0xc')];this[_0x43e2('0x23')]=_0x28b144[_0x43e2('0x23')];this[_0x43e2('0x24')]=_0x28b144['reason'];this[_0x43e2('0x25')]=_0x1a89fc[_0x43e2('0x25')];this[_0x43e2('0x26')]=_0x1a89fc[_0x43e2('0x26')];this[_0x43e2('0x27')]=_0x1a89fc[_0x43e2('0x27')];this[_0x43e2('0x28')]=_0x1a89fc[_0x43e2('0x28')];this[_0x43e2('0x29')]=_0x1a89fc[_0x43e2('0x29')];this[_0x43e2('0x2a')]=_0x1a89fc[_0x43e2('0x2a')];this['UserId']=_0x1a89fc[_0x43e2('0x2b')];this[_0x43e2('0x2c')]=_0x1a89fc['VoiceQueueId'];this[_0x43e2('0x2d')]=_0x1a89fc[_0x43e2('0x2d')];this[_0x43e2('0x2e')]=_0x1a89fc[_0x43e2('0x2e')]||'';this[_0x43e2('0x2f')]=_0x1a89fc['originatecalleridname']||'';}module[_0x43e2('0x30')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e9a23f4..8bffda1 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b84=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0x4b84[_0x2d344f];return _0x2e796b;};'use strict';var util=require(_0x44b8('0x0'));var _=require(_0x44b8('0x1'));var moment=require('moment');function getSeconds(_0x5005fd,_0x765943){var _0x519db3=moment(_0x5005fd)['milliseconds'](0x0);var _0x3b26c7=moment(_0x765943)[_0x44b8('0x2')](0x0);return _0x519db3[_0x44b8('0x3')](_0x3b26c7,'seconds');}function Final(_0x4f875e){this['uniqueid']=_0x4f875e[_0x44b8('0x4')];this['scheduledat']=_0x4f875e[_0x44b8('0x5')];this['type']=_0x4f875e[_0x44b8('0x6')];this['campaigntype']=_0x4f875e['type']===_0x44b8('0x7')?_0x44b8('0x8'):_0x4f875e[_0x44b8('0x6')];this['countbusyretry']=_0x4f875e[_0x44b8('0x9')];this[_0x44b8('0xa')]=_0x4f875e[_0x44b8('0xa')];this[_0x44b8('0xb')]=_0x4f875e[_0x44b8('0xb')];this[_0x44b8('0xc')]=_0x4f875e[_0x44b8('0x9')]+_0x4f875e['countcongestionretry']+_0x4f875e[_0x44b8('0xb')]+_0x4f875e[_0x44b8('0xd')]+_0x4f875e['countdropretry']+_0x4f875e[_0x44b8('0xe')]+_0x4f875e['countmachineretry']+_0x4f875e[_0x44b8('0xf')];this[_0x44b8('0xd')]=_0x4f875e['countnosuchnumberretry'];this[_0x44b8('0x10')]=_0x4f875e['countdropretry'];this['countabandonedretry']=_0x4f875e[_0x44b8('0xe')];this[_0x44b8('0x11')]=_0x4f875e[_0x44b8('0x11')];this[_0x44b8('0xf')]=_0x4f875e['countagentrejectretry'];this['queue']=_0x4f875e['queue'];this[_0x44b8('0x12')]=_0x4f875e['calleridname'];this[_0x44b8('0x13')]=_0x4f875e[_0x44b8('0x13')];this['starttime']=_0x4f875e[_0x44b8('0x14')];this[_0x44b8('0x15')]=_0x4f875e['responsetime'];this[_0x44b8('0x16')]=_0x4f875e[_0x44b8('0x15')];this['ringtime']=_0x4f875e[_0x44b8('0x17')]||0x0;this[_0x44b8('0x18')]=_0x4f875e[_0x44b8('0x18')]||0x0;this[_0x44b8('0x19')]=_0x4f875e[_0x44b8('0x19')]||0x0;this[_0x44b8('0x1a')]=_0x4f875e[_0x44b8('0x1a')];this[_0x44b8('0x1b')]=_0x4f875e[_0x44b8('0x1b')];this[_0x44b8('0x1c')]=_0x4f875e[_0x44b8('0x1c')];this[_0x44b8('0x1d')]=_0x4f875e['recallme'];this[_0x44b8('0x1e')]=_0x4f875e[_0x44b8('0x1e')];this[_0x44b8('0x1f')]=_0x4f875e[_0x44b8('0x1f')];this[_0x44b8('0x20')]=_0x4f875e['UserId'];this[_0x44b8('0x21')]=_0x4f875e['VoiceQueueId'];this[_0x44b8('0x22')]=_0x4f875e[_0x44b8('0x22')];this[_0x44b8('0x23')]=_0x4f875e[_0x44b8('0x23')]||'';this[_0x44b8('0x24')]=_0x4f875e['originatecalleridname']||'';}module[_0x44b8('0x25')]=Final; \ No newline at end of file +var _0xdc97=['CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xdc97,0x13b));var _0x7dc9=function(_0x48a3bb,_0x507bcc){_0x48a3bb=_0x48a3bb-0x0;var _0x765002=_0xdc97[_0x48a3bb];return _0x765002;};'use strict';var util=require(_0x7dc9('0x0'));var _=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));function getSeconds(_0x5f1f64,_0x2913e6){var _0x4f5c88=moment(_0x5f1f64)[_0x7dc9('0x3')](0x0);var _0x2b86da=moment(_0x2913e6)['milliseconds'](0x0);return _0x4f5c88[_0x7dc9('0x4')](_0x2b86da,_0x7dc9('0x5'));}function Final(_0xb15a0b){this[_0x7dc9('0x6')]=_0xb15a0b['uniqueid'];this[_0x7dc9('0x7')]=_0xb15a0b['scheduledat'];this['type']=_0xb15a0b[_0x7dc9('0x8')];this[_0x7dc9('0x9')]=_0xb15a0b[_0x7dc9('0x8')]===_0x7dc9('0xa')?_0x7dc9('0xb'):_0xb15a0b['type'];this[_0x7dc9('0xc')]=_0xb15a0b[_0x7dc9('0xc')];this[_0x7dc9('0xd')]=_0xb15a0b[_0x7dc9('0xd')];this[_0x7dc9('0xe')]=_0xb15a0b[_0x7dc9('0xe')];this[_0x7dc9('0xf')]=_0xb15a0b['countbusyretry']+_0xb15a0b['countcongestionretry']+_0xb15a0b['countnoanswerretry']+_0xb15a0b['countnosuchnumberretry']+_0xb15a0b[_0x7dc9('0x10')]+_0xb15a0b[_0x7dc9('0x11')]+_0xb15a0b['countmachineretry']+_0xb15a0b[_0x7dc9('0x12')];this[_0x7dc9('0x13')]=_0xb15a0b[_0x7dc9('0x13')];this[_0x7dc9('0x10')]=_0xb15a0b[_0x7dc9('0x10')];this[_0x7dc9('0x11')]=_0xb15a0b['countabandonedretry'];this[_0x7dc9('0x14')]=_0xb15a0b[_0x7dc9('0x14')];this[_0x7dc9('0x12')]=_0xb15a0b[_0x7dc9('0x12')];this[_0x7dc9('0xb')]=_0xb15a0b[_0x7dc9('0xb')];this[_0x7dc9('0x15')]=_0xb15a0b[_0x7dc9('0x15')];this[_0x7dc9('0x16')]=_0xb15a0b['calleridnum'];this[_0x7dc9('0x17')]=_0xb15a0b['starttime'];this[_0x7dc9('0x18')]=_0xb15a0b[_0x7dc9('0x18')];this['endtime']=_0xb15a0b[_0x7dc9('0x18')];this[_0x7dc9('0x19')]=_0xb15a0b[_0x7dc9('0x19')]||0x0;this[_0x7dc9('0x1a')]=_0xb15a0b[_0x7dc9('0x1a')]||0x0;this[_0x7dc9('0x1b')]=_0xb15a0b[_0x7dc9('0x1b')]||0x0;this[_0x7dc9('0x1c')]=_0xb15a0b[_0x7dc9('0x1c')];this[_0x7dc9('0x1d')]=_0xb15a0b['callbackuniqueid'];this['callbackat']=_0xb15a0b[_0x7dc9('0x1e')];this[_0x7dc9('0x1f')]=_0xb15a0b['recallme'];this[_0x7dc9('0x20')]=_0xb15a0b[_0x7dc9('0x20')];this['ListId']=_0xb15a0b[_0x7dc9('0x21')];this[_0x7dc9('0x22')]=_0xb15a0b[_0x7dc9('0x22')];this['VoiceQueueId']=_0xb15a0b[_0x7dc9('0x23')];this[_0x7dc9('0x24')]=_0xb15a0b[_0x7dc9('0x24')];this['originatecalleridnum']=_0xb15a0b['originatecalleridnum']||'';this['originatecalleridname']=_0xb15a0b[_0x7dc9('0x25')]||'';}module[_0x7dc9('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 6c45ebf..3229afd 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x214b=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','endtime','queue','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry'];(function(_0x227901,_0x1d8fca){var _0x5a55e4=function(_0x528862){while(--_0x528862){_0x227901['push'](_0x227901['shift']());}};_0x5a55e4(++_0x1d8fca);}(_0x214b,0x1a3));var _0xb214=function(_0x411b71,_0x38c1af){_0x411b71=_0x411b71-0x0;var _0x870e79=_0x214b[_0x411b71];return _0x870e79;};'use strict';var util=require(_0xb214('0x0'));var _=require('lodash');var moment=require(_0xb214('0x1'));function getSeconds(_0x181b37,_0x5b1a85){var _0x32a08d=moment(_0x181b37)[_0xb214('0x2')](0x0);var _0x384e9f=moment(_0x5b1a85)[_0xb214('0x2')](0x0);return _0x32a08d[_0xb214('0x3')](_0x384e9f,'seconds');}function Hangup(_0x154c2c,_0x409128){this[_0xb214('0x4')]=0x4;this[_0xb214('0x5')]=_0xb214('0x6');this[_0xb214('0x7')]=_0x154c2c['scheduledat'];this[_0xb214('0x8')]=_0x154c2c[_0xb214('0x8')];this[_0xb214('0x9')]=_0x154c2c[_0xb214('0x8')]==='outbound'?'queue':_0x154c2c[_0xb214('0x8')];this[_0xb214('0xa')]=_0x154c2c[_0xb214('0xa')];this['countcongestionretry']=_0x154c2c[_0xb214('0xb')];this[_0xb214('0xc')]=_0x154c2c[_0xb214('0xc')];this['countglobal']=_0x154c2c[_0xb214('0xa')]+_0x154c2c[_0xb214('0xb')]+_0x154c2c[_0xb214('0xc')]+_0x154c2c[_0xb214('0xd')]+_0x154c2c['countdropretry']+_0x154c2c[_0xb214('0xe')]+_0x154c2c['countmachineretry']+_0x154c2c[_0xb214('0xf')];this[_0xb214('0xd')]=_0x154c2c[_0xb214('0xd')];this[_0xb214('0x10')]=_0x154c2c[_0xb214('0x10')];this['countabandonedretry']=_0x154c2c[_0xb214('0xe')];this[_0xb214('0x11')]=_0x154c2c[_0xb214('0x11')];this[_0xb214('0xf')]=_0x154c2c['countagentrejectretry'];this[_0xb214('0x12')]=_0x409128[_0xb214('0x12')];this[_0xb214('0x13')]=_0x154c2c[_0xb214('0x14')];this[_0xb214('0x15')]=_0x154c2c[_0xb214('0x16')];this['starttime']=_0x154c2c[_0xb214('0x17')];this[_0xb214('0x18')]=_0x154c2c[_0xb214('0x18')];this['endtime']=moment()[_0xb214('0x19')](_0xb214('0x1a'));this[_0xb214('0x1b')]=getSeconds(_0x154c2c[_0xb214('0x18')],_0x154c2c[_0xb214('0x17')]);this['holdtime']=0x0;this[_0xb214('0x1c')]=getSeconds(this[_0xb214('0x1d')],_0x154c2c[_0xb214('0x18')]);this[_0xb214('0x1e')]=_0x154c2c[_0xb214('0x1e')];this['membername']=_0xb214('0x1f');this['reason']=_0x409128[_0xb214('0x20')];this[_0xb214('0x21')]=_0x154c2c['callback'];this[_0xb214('0x22')]=_0x154c2c[_0xb214('0x22')];this[_0xb214('0x23')]=_0x154c2c[_0xb214('0x23')];this[_0xb214('0x24')]=_0x154c2c['recallme'];this[_0xb214('0x25')]=_0x154c2c[_0xb214('0x25')];this[_0xb214('0x26')]=_0x154c2c[_0xb214('0x26')];this[_0xb214('0x27')]=_0x154c2c[_0xb214('0x27')];this[_0xb214('0x28')]=_0x154c2c[_0xb214('0x28')];this['CampaignId']=_0x154c2c[_0xb214('0x29')];}module[_0xb214('0x2a')]=Hangup; \ No newline at end of file +var _0xe74b=['ringtime','holdtime','talktime','queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format'];(function(_0x6505c,_0x5329a7){var _0x1a7a96=function(_0x5bb1c6){while(--_0x5bb1c6){_0x6505c['push'](_0x6505c['shift']());}};_0x1a7a96(++_0x5329a7);}(_0xe74b,0x1f4));var _0xbe74=function(_0x8d3b4b,_0xd1db47){_0x8d3b4b=_0x8d3b4b-0x0;var _0x509753=_0xe74b[_0x8d3b4b];return _0x509753;};'use strict';var util=require(_0xbe74('0x0'));var _=require(_0xbe74('0x1'));var moment=require('moment');function getSeconds(_0xc855f8,_0xdad173){var _0x1e587b=moment(_0xc855f8)['milliseconds'](0x0);var _0xaf5315=moment(_0xdad173)[_0xbe74('0x2')](0x0);return _0x1e587b['diff'](_0xaf5315,_0xbe74('0x3'));}function Hangup(_0x314ce7,_0x3e7680){this[_0xbe74('0x4')]=0x4;this[_0xbe74('0x5')]=_0xbe74('0x6');this[_0xbe74('0x7')]=_0x314ce7[_0xbe74('0x7')];this[_0xbe74('0x8')]=_0x314ce7[_0xbe74('0x8')];this[_0xbe74('0x9')]=_0x314ce7['type']==='outbound'?'queue':_0x314ce7['type'];this[_0xbe74('0xa')]=_0x314ce7['countbusyretry'];this[_0xbe74('0xb')]=_0x314ce7[_0xbe74('0xb')];this[_0xbe74('0xc')]=_0x314ce7[_0xbe74('0xc')];this[_0xbe74('0xd')]=_0x314ce7[_0xbe74('0xa')]+_0x314ce7[_0xbe74('0xb')]+_0x314ce7[_0xbe74('0xc')]+_0x314ce7[_0xbe74('0xe')]+_0x314ce7[_0xbe74('0xf')]+_0x314ce7[_0xbe74('0x10')]+_0x314ce7['countmachineretry']+_0x314ce7[_0xbe74('0x11')];this[_0xbe74('0xe')]=_0x314ce7[_0xbe74('0xe')];this[_0xbe74('0xf')]=_0x314ce7[_0xbe74('0xf')];this['countabandonedretry']=_0x314ce7['countabandonedretry'];this[_0xbe74('0x12')]=_0x314ce7[_0xbe74('0x12')];this[_0xbe74('0x11')]=_0x314ce7['countagentrejectretry'];this['uniqueid']=_0x3e7680[_0xbe74('0x13')];this[_0xbe74('0x14')]=_0x314ce7[_0xbe74('0x15')];this[_0xbe74('0x16')]=_0x314ce7[_0xbe74('0x17')];this[_0xbe74('0x18')]=_0x314ce7[_0xbe74('0x18')];this[_0xbe74('0x19')]=_0x314ce7[_0xbe74('0x19')];this[_0xbe74('0x1a')]=moment()[_0xbe74('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbe74('0x1c')]=getSeconds(_0x314ce7[_0xbe74('0x19')],_0x314ce7['starttime']);this[_0xbe74('0x1d')]=0x0;this[_0xbe74('0x1e')]=getSeconds(this[_0xbe74('0x1a')],_0x314ce7[_0xbe74('0x19')]);this[_0xbe74('0x1f')]=_0x314ce7[_0xbe74('0x1f')];this['membername']=_0xbe74('0x20');this[_0xbe74('0x21')]=_0x3e7680[_0xbe74('0x22')];this[_0xbe74('0x23')]=_0x314ce7[_0xbe74('0x23')];this[_0xbe74('0x24')]=_0x314ce7[_0xbe74('0x24')];this[_0xbe74('0x25')]=_0x314ce7[_0xbe74('0x25')];this['recallme']=_0x314ce7[_0xbe74('0x26')];this[_0xbe74('0x27')]=_0x314ce7[_0xbe74('0x27')];this['ListId']=_0x314ce7[_0xbe74('0x28')];this[_0xbe74('0x29')]=_0x314ce7[_0xbe74('0x29')];this[_0xbe74('0x2a')]=_0x314ce7['VoiceQueueId'];this[_0xbe74('0x2b')]=_0x314ce7['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index eddc231..f766e36 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3eb=['milliseconds','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0x3dc559,_0x31b77e){var _0x16e92f=function(_0xfd2f6b){while(--_0xfd2f6b){_0x3dc559['push'](_0x3dc559['shift']());}};_0x16e92f(++_0x31b77e);}(_0xa3eb,0x1c5));var _0xba3e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa3eb[_0x2bf141];return _0x48277b;};'use strict';var util=require(_0xba3e('0x0'));var _=require(_0xba3e('0x1'));var moment=require('moment');function getSeconds(_0x4222d6,_0x41dcef){var _0x16d3e7=moment(_0x4222d6)[_0xba3e('0x2')](0x0);var _0x27194d=moment(_0x41dcef)[_0xba3e('0x2')](0x0);return _0x16d3e7[_0xba3e('0x3')](_0x27194d,_0xba3e('0x4'));}function History(_0x168d54){this[_0xba3e('0x5')]=_0x168d54[_0xba3e('0x5')];this[_0xba3e('0x6')]=_0x168d54[_0xba3e('0x6')]||undefined;this[_0xba3e('0x7')]=_0x168d54['type'];this['campaigntype']=_0x168d54[_0xba3e('0x7')]==='outbound'?_0xba3e('0x8'):_0x168d54[_0xba3e('0x7')];this[_0xba3e('0x9')]=_0x168d54[_0xba3e('0x9')];this[_0xba3e('0xa')]=_0x168d54[_0xba3e('0xa')];this[_0xba3e('0xb')]=_0x168d54[_0xba3e('0xb')];this[_0xba3e('0xc')]=_0x168d54[_0xba3e('0x9')]+_0x168d54['countcongestionretry']+_0x168d54[_0xba3e('0xb')]+_0x168d54[_0xba3e('0xd')]+_0x168d54[_0xba3e('0xe')]+_0x168d54[_0xba3e('0xf')]+_0x168d54[_0xba3e('0x10')]+_0x168d54['countagentrejectretry'];this['countnosuchnumberretry']=_0x168d54['countnosuchnumberretry'];this['countdropretry']=_0x168d54['countdropretry'];this[_0xba3e('0xf')]=_0x168d54[_0xba3e('0xf')];this['countmachineretry']=_0x168d54[_0xba3e('0x10')];this[_0xba3e('0x11')]=_0x168d54['countagentrejectretry'];this[_0xba3e('0x8')]=_0x168d54[_0xba3e('0x8')];this['calleridname']=_0x168d54[_0xba3e('0x12')];this[_0xba3e('0x13')]=_0x168d54['number'];this['starttime']=_0x168d54['starttime'];this[_0xba3e('0x14')]=_0x168d54[_0xba3e('0x14')];this['endtime']=_0x168d54[_0xba3e('0x14')];this[_0xba3e('0x15')]=getSeconds(_0x168d54[_0xba3e('0x14')],_0x168d54['starttime']);this[_0xba3e('0x16')]=0x0;this['talktime']=0x0;this[_0xba3e('0x17')]=_0x168d54['callback'];this[_0xba3e('0x18')]=_0x168d54[_0xba3e('0x18')];this['callbackat']=_0x168d54[_0xba3e('0x19')];this[_0xba3e('0x1a')]=_0x168d54[_0xba3e('0x1a')];this[_0xba3e('0x1b')]=_0x168d54[_0xba3e('0x1b')];this[_0xba3e('0x1c')]=_0x168d54['ListId'];this[_0xba3e('0x1d')]=_0x168d54[_0xba3e('0x1d')];this['VoiceQueueId']=_0x168d54[_0xba3e('0x1e')];this[_0xba3e('0x1f')]=_0x168d54[_0xba3e('0x1f')];this[_0xba3e('0x20')]=_0x168d54[_0xba3e('0x20')]||'';this[_0xba3e('0x21')]=_0x168d54['originatecalleridname']||'';}module[_0xba3e('0x22')]=History; \ No newline at end of file +var _0x6d94=['countnosuchnumberretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','starttime','responsetime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countabandonedretry'];(function(_0x5d634e,_0x4c1390){var _0x41e329=function(_0x1165ce){while(--_0x1165ce){_0x5d634e['push'](_0x5d634e['shift']());}};_0x41e329(++_0x4c1390);}(_0x6d94,0x13c));var _0x46d9=function(_0x467c4e,_0x3cee92){_0x467c4e=_0x467c4e-0x0;var _0x348250=_0x6d94[_0x467c4e];return _0x348250;};'use strict';var util=require(_0x46d9('0x0'));var _=require(_0x46d9('0x1'));var moment=require('moment');function getSeconds(_0x44e8e7,_0x291b1a){var _0x4c49f0=moment(_0x44e8e7)[_0x46d9('0x2')](0x0);var _0x2d3f53=moment(_0x291b1a)[_0x46d9('0x2')](0x0);return _0x4c49f0[_0x46d9('0x3')](_0x2d3f53,_0x46d9('0x4'));}function History(_0x4ecda9){this[_0x46d9('0x5')]=_0x4ecda9[_0x46d9('0x5')];this[_0x46d9('0x6')]=_0x4ecda9[_0x46d9('0x6')]||undefined;this[_0x46d9('0x7')]=_0x4ecda9[_0x46d9('0x7')];this[_0x46d9('0x8')]=_0x4ecda9[_0x46d9('0x7')]===_0x46d9('0x9')?_0x46d9('0xa'):_0x4ecda9[_0x46d9('0x7')];this[_0x46d9('0xb')]=_0x4ecda9[_0x46d9('0xb')];this['countcongestionretry']=_0x4ecda9['countcongestionretry'];this[_0x46d9('0xc')]=_0x4ecda9[_0x46d9('0xc')];this[_0x46d9('0xd')]=_0x4ecda9[_0x46d9('0xb')]+_0x4ecda9[_0x46d9('0xe')]+_0x4ecda9[_0x46d9('0xc')]+_0x4ecda9['countnosuchnumberretry']+_0x4ecda9[_0x46d9('0xf')]+_0x4ecda9[_0x46d9('0x10')]+_0x4ecda9['countmachineretry']+_0x4ecda9['countagentrejectretry'];this[_0x46d9('0x11')]=_0x4ecda9[_0x46d9('0x11')];this[_0x46d9('0xf')]=_0x4ecda9[_0x46d9('0xf')];this[_0x46d9('0x10')]=_0x4ecda9[_0x46d9('0x10')];this[_0x46d9('0x12')]=_0x4ecda9[_0x46d9('0x12')];this[_0x46d9('0x13')]=_0x4ecda9[_0x46d9('0x13')];this[_0x46d9('0xa')]=_0x4ecda9['queue'];this[_0x46d9('0x14')]=_0x4ecda9[_0x46d9('0x15')];this[_0x46d9('0x16')]=_0x4ecda9['number'];this['starttime']=_0x4ecda9[_0x46d9('0x17')];this[_0x46d9('0x18')]=_0x4ecda9[_0x46d9('0x18')];this['endtime']=_0x4ecda9[_0x46d9('0x18')];this[_0x46d9('0x19')]=getSeconds(_0x4ecda9[_0x46d9('0x18')],_0x4ecda9[_0x46d9('0x17')]);this['holdtime']=0x0;this[_0x46d9('0x1a')]=0x0;this[_0x46d9('0x1b')]=_0x4ecda9[_0x46d9('0x1b')];this[_0x46d9('0x1c')]=_0x4ecda9[_0x46d9('0x1c')];this['callbackat']=_0x4ecda9[_0x46d9('0x1d')];this['recallme']=_0x4ecda9[_0x46d9('0x1e')];this[_0x46d9('0x1f')]=_0x4ecda9[_0x46d9('0x1f')];this[_0x46d9('0x20')]=_0x4ecda9['ListId'];this[_0x46d9('0x21')]=_0x4ecda9[_0x46d9('0x21')];this[_0x46d9('0x22')]=_0x4ecda9['VoiceQueueId'];this['CampaignId']=_0x4ecda9['CampaignId'];this['originatecalleridnum']=_0x4ecda9[_0x46d9('0x23')]||'';this['originatecalleridname']=_0x4ecda9[_0x46d9('0x24')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 63f64bf..4d9b816 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 _0xc4c4=['VoiceQueueId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','dropreason','voiceQueue','additional','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','queueBooked','push','merge','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','isArray','command','iftime\x20%s,%s','interval','timezones','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','dialPowerLevel','handlePower','method\x20not\x20recognized','checkPreviewRecallReminder','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialMethod','dialGlobalInterval','dialTimezone','[syncQueueSummary]','filter','online','map','Agent','pow','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','[originateError]:\x20%s','[originate][error]','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangAbandonmentRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','startMethodPredictive','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','maxNumberOriginate','dialOrderByScheduledAt','RUNNING','[actionOriginate]\x20','dialLimitQueue','not_inuse','emptyContact','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','Contact.phone','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','type','outbound','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','voice_queue:save','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\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','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','error','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','[getContactDialer2][Empty]','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','is\x20disactive','statedesc','starttime','[uniqueid]','actions','[actions]','clearZombieChannels','undefined','enqueue','Action','status','channel','catch','No\x20such\x20channel','ivr','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[createHistory]\x20','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','UserId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','syncVarSet','isNil','variable','amdstatus','exten','xcally-motion-dialer','value','state','membername','AMD','custom:amd','buildObj','amd','dialAMDActive','MACHINE','Machine','countmachineretry','countglobal','emit','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','CampaignId','[rescheduleContact][Machine]','HANGUP','uniqueid','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countcongestionretry','countagentrejectretry','reason19\x20machine....'];(function(_0x5496ff,_0x104d17){var _0x36881c=function(_0x395a82){while(--_0x395a82){_0x5496ff['push'](_0x5496ff['shift']());}};_0x36881c(++_0x104d17);}(_0xc4c4,0x11c));var _0x4c4c=function(_0x34311c,_0x52a317){_0x34311c=_0x34311c-0x0;var _0x4b8b35=_0xc4c4[_0x34311c];return _0x4b8b35;};'use strict';var util=require(_0x4c4c('0x0'));var _=require(_0x4c4c('0x1'));var uuid=require(_0x4c4c('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0x4c4c('0x3'));var Redis=require(_0x4c4c('0x4'));var ut=require(_0x4c4c('0x5'));var config=require(_0x4c4c('0x6'));var logger=require(_0x4c4c('0x7'))('dialer');var loggerBooked=require(_0x4c4c('0x7'))(_0x4c4c('0x8'));var loggerPredictive=require(_0x4c4c('0x7'))(_0x4c4c('0x9'));var loggerPredictiveCalls=require(_0x4c4c('0x7'))(_0x4c4c('0xa'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x4c4c('0xb'));var ami=require(_0x4c4c('0xc'));config['redis']=_[_0x4c4c('0xd')](config['redis'],{'host':_0x4c4c('0xe'),'port':0x18eb});var io=require(_0x4c4c('0xf'))(new Redis(config[_0x4c4c('0x10')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x4c4c('0x11'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x4c4c('0x12'));var voiceQueueRt=require(_0x4c4c('0x13'));var RpcSetting=require(_0x4c4c('0x14'));var Action=require(_0x4c4c('0x15'));var History=require(_0x4c4c('0x16'));var Final=require(_0x4c4c('0x17'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x4c4c('0x18'));var ipAgi=process[_0x4c4c('0x19')][_0x4c4c('0x1a')]||_0x4c4c('0x1b');var strategy={'rrmemory':_0x4c4c('0x1c'),'roundrobin':_0x4c4c('0x1d')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4c4c('0x1e')]['enqueue']=function(_0x24ccbc){this[_0x4c4c('0x1f')]=this[_0x4c4c('0x1f')]?this['tail'][_0x4c4c('0x20')](_0x24ccbc):_0x24ccbc();};function Dialer(_0x5522b6,_0x6b67fa){this[_0x4c4c('0x21')]=new Sequence();this['preview']=_0x6b67fa;this[_0x4c4c('0x22')]=_0x5522b6[_0x4c4c('0x22')];this[_0x4c4c('0x23')]=_0x5522b6[_0x4c4c('0x23')];this[_0x4c4c('0x24')]=_0x5522b6[_0x4c4c('0x24')];this[_0x4c4c('0x25')]=_0x5522b6[_0x4c4c('0x25')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x4c4c('0x26')]={};this['actions']={};this[_0x4c4c('0x27')]={};this[_0x4c4c('0x28')]={};this[_0x4c4c('0x29')]={};this[_0x4c4c('0x2a')]={};this[_0x4c4c('0x2b')]={};this[_0x4c4c('0x2c')]={};this['queueBooked']={};this[_0x4c4c('0x2d')]={};ami['on'](_0x4c4c('0x2e'),this['syncAgentConnect'][_0x4c4c('0x2f')](this));ami['on'](_0x4c4c('0x30'),this['syncQueueCallerAbandon'][_0x4c4c('0x2f')](this));ami['on'](_0x4c4c('0x31'),this[_0x4c4c('0x32')][_0x4c4c('0x2f')](this));ami['on']('agentcomplete',this[_0x4c4c('0x33')][_0x4c4c('0x2f')](this));ami['on'](_0x4c4c('0x34'),this[_0x4c4c('0xb')]['bind'](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete']['bind'](this));ami['on']('hangup',this[_0x4c4c('0x35')][_0x4c4c('0x2f')](this));ami['on'](_0x4c4c('0x36'),this[_0x4c4c('0x37')][_0x4c4c('0x2f')](this));ami['on'](_0x4c4c('0x38'),this['syncVarSet'][_0x4c4c('0x2f')](this));ami['on'](_0x4c4c('0x39'),this['syncQueueMember'][_0x4c4c('0x2f')](this));ami['on'](_0x4c4c('0x3a'),this[_0x4c4c('0x3b')][_0x4c4c('0x2f')](this));this['loopCampaigns']();this[_0x4c4c('0x3c')]();RpcSetting[_0x4c4c('0x3d')]()[_0x4c4c('0x3e')](function(_0x282398){previewRecallmeReminderInterval=_0x282398[_0x4c4c('0x3f')];});}function isNotNull(_0x2ab8cc){return _0x2ab8cc!==null&&!_[_0x4c4c('0x40')](_0x2ab8cc);}function checkIsLoggedIn(_0x5bed83,_0x493166){return function(){if(_0x493166<=0x0){_0x5bed83[_0x4c4c('0x41')]=_0x4c4c('0x42');throw _0x5bed83[_0x4c4c('0x43')]+_0x4c4c('0x44');}};}function isActive(_0x180a0a){return _0x180a0a;}function checkIsActive(_0x306b34,_0x2b5365){return function(){if(!isActive(_0x2b5365)){_0x306b34[_0x4c4c('0x41')]=_0x4c4c('0x45');throw _0x306b34[_0x4c4c('0x43')]+_0x4c4c('0x46');}};}function checkInterval(_0x5a1594){return function(){if(!isNotNull(_0x5a1594[_0x4c4c('0x47')])){_0x5a1594[_0x4c4c('0x41')]=_0x4c4c('0x48');throw _0x5a1594[_0x4c4c('0x43')]+_0x4c4c('0x49');}if(!isNotNull(_0x5a1594[_0x4c4c('0x47')][_0x4c4c('0x4a')])){_0x5a1594[_0x4c4c('0x41')]=_0x4c4c('0x48');throw _0x5a1594[_0x4c4c('0x43')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x4c4c('0x4b')](_0x5a1594[_0x4c4c('0x47')][_0x4c4c('0x4a')]))){_0x5a1594['message']=_0x4c4c('0x48');throw _0x5a1594[_0x4c4c('0x43')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x2f0aa9,_0x5c2463,_0x1626aa){return{'action':_0x2f0aa9,'response':_0x5c2463,'message':_0x1626aa,'stack':_0x1626aa};}function myreject(_0x39fb4d){return function(_0x41df7f){return _0x39fb4d(msgResponse(_0x4c4c('0x4c'),_0x4c4c('0x4d'),JSON[_0x4c4c('0x4e')](_0x41df7f)));};}function getSeconds(_0xe0c7fb,_0xda41e6){var _0x1844af=moment(_0xe0c7fb)[_0x4c4c('0x4f')](0x0);var _0x9a48d6=moment(_0xda41e6)[_0x4c4c('0x4f')](0x0);return _0x1844af[_0x4c4c('0x50')](_0x9a48d6,'seconds');}function emit(_0x3f4c71,_0x2cb788,_0x3ea043){io['to'](_0x3f4c71)['emit'](_0x2cb788,_0x3ea043);}function emitVoiceQueueSummary(_0x792d25){if(_0x792d25[_0x4c4c('0x51')]===_0x4c4c('0x52')){var _0x5ea522={'id':_0x792d25['id'],'name':_0x792d25[_0x4c4c('0x43')],'strategy':_0x792d25[_0x4c4c('0x53')],'answered':_0x792d25[_0x4c4c('0x54')],'available':_0x792d25['available'],'loggedIn':_0x792d25[_0x4c4c('0x55')],'pTalking':_0x792d25[_0x4c4c('0x56')],'sumBillable':_0x792d25['sumBillable'],'sumDuration':_0x792d25[_0x4c4c('0x57')],'sumHoldTime':_0x792d25[_0x4c4c('0x58')]||0x0,'talking':_0x792d25[_0x4c4c('0x59')],'total':_0x792d25[_0x4c4c('0x5a')],'type':_0x792d25[_0x4c4c('0x51')],'unmanaged':_0x792d25[_0x4c4c('0x5b')],'abandoned':_0x792d25[_0x4c4c('0x5c')],'waiting':_0x792d25[_0x4c4c('0x5d')],'loggedInDb':_0x792d25['loggedInDb'],'dialActive':_0x792d25[_0x4c4c('0x5e')],'dialMethod':_0x792d25['dialMethod'],'dialOriginateCallerIdName':_0x792d25[_0x4c4c('0x5f')],'dialOriginateCallerIdNumber':_0x792d25[_0x4c4c('0x60')],'dialOriginateTimeout':_0x792d25['dialOriginateTimeout'],'dialPrefix':_0x792d25['dialPrefix'],'outboundAnswerAgiCallsDay':_0x792d25[_0x4c4c('0x61')],'outboundAnswerCallsDay':_0x792d25[_0x4c4c('0x62')],'outboundBlacklistCallsDay':_0x792d25[_0x4c4c('0x63')],'outboundBusyCallsDay':_0x792d25[_0x4c4c('0x64')],'outboundCongestionCallsDay':_0x792d25[_0x4c4c('0x65')],'outboundDropCallsDayACS':_0x792d25['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x792d25[_0x4c4c('0x66')],'outboundDropCallsDayTimeout':_0x792d25[_0x4c4c('0x67')],'outboundNoAnswerCallsDay':_0x792d25['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x792d25['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x792d25[_0x4c4c('0x68')],'outboundReCallsDay':_0x792d25[_0x4c4c('0x69')],'outboundRejectCallsDay':_0x792d25[_0x4c4c('0x6a')],'outboundUnknownCallsDay':_0x792d25[_0x4c4c('0x6b')],'predictiveIntervalAnsweredCalls':_0x792d25[_0x4c4c('0x6c')],'predictiveIntervalAvgHoldtime':_0x792d25[_0x4c4c('0x6d')],'predictiveIntervalAvgTalktime':_0x792d25[_0x4c4c('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x792d25[_0x4c4c('0x6f')],'predictiveIntervalDroppedCallsTimeout':_0x792d25[_0x4c4c('0x70')],'predictiveIntervalErlangCalls':_0x792d25[_0x4c4c('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x792d25[_0x4c4c('0x72')],'predictiveIntervalHitRate':_0x792d25[_0x4c4c('0x73')],'predictiveIntervalMultiplicativeFactor':_0x792d25['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x792d25[_0x4c4c('0x74')],'predictiveIntervalAvailable':_0x792d25[_0x4c4c('0x75')],'predictiveIntervalTotalCalls':_0x792d25[_0x4c4c('0x76')],'message':_0x792d25[_0x4c4c('0x41')],'originated':_0x792d25[_0x4c4c('0x77')],'erlangCalls':_0x792d25['erlangCalls'],'erlangCallToSecond':_0x792d25[_0x4c4c('0x78')],'erlangAbandonmentRate':_0x792d25['erlangAbandonmentRate'],'erlangBusyFactor':_0x792d25[_0x4c4c('0x79')],'startPredictive':_0x792d25[_0x4c4c('0x2a')],'startProgressive':_0x792d25[_0x4c4c('0x2b')]};if(_0x792d25[_0x4c4c('0x7a')]){_0x5ea522['Trunk']={'id':_0x792d25[_0x4c4c('0x7a')]['id'],'name':_0x792d25[_0x4c4c('0x7a')][_0x4c4c('0x43')],'active':_0x792d25[_0x4c4c('0x7a')][_0x4c4c('0x7b')],'callerid':_0x792d25[_0x4c4c('0x7a')][_0x4c4c('0x7c')]};}if(_0x792d25[_0x4c4c('0x47')]){_0x5ea522[_0x4c4c('0x47')]={'id':_0x792d25[_0x4c4c('0x47')]['id'],'name':_0x792d25[_0x4c4c('0x47')][_0x4c4c('0x43')]};}var _0x22b5fc=md5(JSON['stringify'](_0x5ea522));if(_0x792d25[_0x4c4c('0x3')]!==_0x22b5fc){_0x792d25[_0x4c4c('0x3')]=_0x22b5fc;emit(util['format']('voice:queue:%s',_0x5ea522[_0x4c4c('0x43')]),_0x4c4c('0x7d'),_0x5ea522);}}}function emitCampaignSummary(_0x1e7968){if(_0x1e7968[_0x4c4c('0x51')]==='ivr'){emit(util[_0x4c4c('0x7e')](_0x4c4c('0x7f'),_0x1e7968[_0x4c4c('0x43')]),_0x4c4c('0x80'),_0x1e7968);}}function checkGetDataPredictive(_0x256ee6){if(isNotNull(_0x256ee6)&&!_[_0x4c4c('0x4b')](_0x256ee6)){loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x82'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x256ee6['predictiveIntervalTotalCalls']);loggerPredictive[_0x4c4c('0x81')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x256ee6[_0x4c4c('0x6c')]);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x83'),_0x256ee6[_0x4c4c('0x70')]);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x84'),_0x256ee6[_0x4c4c('0x6f')]);loggerPredictive['info'](_0x4c4c('0x85'),_0x256ee6[_0x4c4c('0x6d')]);loggerPredictive['info'](_0x4c4c('0x86'),_0x256ee6[_0x4c4c('0x6e')]);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x87'));if(_0x256ee6[_0x4c4c('0x76')]>0x0){if(!_[_0x4c4c('0x40')](_0x256ee6[_0x4c4c('0x6e')])&&_0x256ee6[_0x4c4c('0x6e')]>0x0){return!![];}loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x88'));if(!_[_0x4c4c('0x40')](_0x256ee6[_0x4c4c('0x6d')])&&_0x256ee6[_0x4c4c('0x6d')]>0x0){return!![];}loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x89'));}else{loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x8a'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x3e0775){return function(_0x47d907){loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x8b'));loggerPredictive['info'](_0x4c4c('0x8c'),_0x47d907[_0x4c4c('0x8d')]);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x8e'),_0x47d907['erlangCallToSecond']);loggerPredictive['info'](_0x4c4c('0x8f'),_0x47d907['erlangAbandonmentRate']);loggerPredictive[_0x4c4c('0x81')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x47d907['erlangBusyFactor']);loggerPredictive['info'](_0x4c4c('0x8f'),_0x47d907['erlangAbandonmentRate']);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x87'));_['merge'](_0x3e0775,_0x47d907);};}function getDiff(_0x4e8827){var _0x5a749=moment()[_0x4c4c('0x4f')](0x0);var _0x13c299=moment(_0x4e8827)[_0x4c4c('0x4f')](0x0);return _0x5a749[_0x4c4c('0x50')](_0x13c299,_0x4c4c('0x90'));}function ifInterval(_0x5f16cb,_0x474819){if(_[_0x4c4c('0x40')](_0x474819)){return![];}return getDiff(_0x474819)<_0x5f16cb*0x3c;}function freeVariablesPredictive(_0x29ee3e){if(isNotNull(_0x29ee3e)){if(!_[_0x4c4c('0x40')](_0x29ee3e['startProgressive'])){_0x29ee3e[_0x4c4c('0x2b')]=undefined;loggerPredictive[_0x4c4c('0x81')](_0x29ee3e[_0x4c4c('0x43')],_0x4c4c('0x91'));}if(!_[_0x4c4c('0x40')](_0x29ee3e[_0x4c4c('0x2a')])){_0x29ee3e['startPredictive']=undefined;loggerPredictive[_0x4c4c('0x81')](_0x29ee3e['name'],_0x4c4c('0x92'));}if(!_[_0x4c4c('0x40')](_0x29ee3e[_0x4c4c('0x93')])){clearInterval(_0x29ee3e[_0x4c4c('0x93')]);_0x29ee3e[_0x4c4c('0x93')]=undefined;loggerPredictive[_0x4c4c('0x81')](_0x29ee3e[_0x4c4c('0x43')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x42bc32,_0x1bbc92){if(_0x1bbc92===0x0){return 0x0;}var _0x4abd42=0x1;for(var _0x11d006=0x1;_0x11d006<=_0x1bbc92;_0x11d006+=0x1){_0x4abd42=0x1+_0x4abd42*_0x11d006/_0x42bc32;}return 0x1/_0x4abd42;}function isVoiceQueueOutbound(_0x185540){return _0x185540==='outbound';}function isNotPreview(_0x2e5027){return _0x2e5027!==_0x4c4c('0x94');}function isCampaignIvr(_0x3827b2){return _0x3827b2==='ivr';}function getCallerId(_0x4984d0,_0x4f9a34,_0x4bd8a1){if(!_[_0x4c4c('0x40')](_0x4bd8a1)&&typeof _0x4bd8a1===_0x4c4c('0x95')&&!_[_0x4c4c('0x4b')](_0x4bd8a1)){if(!_[_0x4c4c('0x40')](_0x4f9a34)&&typeof _0x4f9a34==='string'&&!_['isEmpty'](_0x4f9a34)){return util[_0x4c4c('0x7e')](_0x4c4c('0x96'),_0x4f9a34,_0x4bd8a1);}return util[_0x4c4c('0x7e')](_0x4c4c('0x96'),_0x4bd8a1,_0x4bd8a1);}if(!_[_0x4c4c('0x40')](_0x4984d0)&&typeof _0x4984d0===_0x4c4c('0x95')&&!_['isEmpty'](_0x4984d0)){return _0x4984d0;}return _0x4c4c('0x97');}function loggerCatchQueueSummary(_0x11505c,_0x160256){return function(_0x35d24f){freeVariablesPredictive(_0x160256);emitVoiceQueueSummary(_0x160256);emitCampaignSummary(_0x160256);loggerSyncQueueSummary[_0x4c4c('0x98')](_0x11505c,util['inspect'](_0x35d24f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5bfac3,_0x15e5e9){return function(_0x31fb95){loggerPredictive['error'](_0x15e5e9['name'],_0x5bfac3);loggerPredictive['error'](_0x31fb95['stack']);freeVariablesPredictive(_0x15e5e9);};}function loggerCatch(_0x98e9f6){return function(_0x26035a){logger[_0x4c4c('0x99')](_0x98e9f6,util[_0x4c4c('0x9a')](_0x26035a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x11db32){return _0x11db32&&!_[_0x4c4c('0x40')](_0x11db32)&&_0x11db32[_0x4c4c('0x9b')]>0x0;}function decremetOriginate(_0x5c33e9){if(!_[_0x4c4c('0x40')](_0x5c33e9)&&_0x5c33e9!==null){if(typeof _0x5c33e9[_0x4c4c('0x77')]!=='undefined'){if(_0x5c33e9[_0x4c4c('0x77')]>0x0){_0x5c33e9[_0x4c4c('0x77')]-=0x1;}else{logger[_0x4c4c('0x99')](_0x4c4c('0x9c'));}}}else{logger[_0x4c4c('0x99')](_0x4c4c('0x9d'));}}function checkContactLowerLimitOriginate(_0x3ca964,_0x350f6a,_0xb4470c){if(_0x350f6a>_0xb4470c){for(var _0x5c2293=0x0;_0x5c2293<_0x350f6a-_0xb4470c;_0x5c2293+=0x1){decremetOriginate(_0x3ca964);}}}function loggerGetContactDialer(_0x3718cc,_0x5bbe0f,_0x1dac71){return function(_0x57a8a2){checkContactLowerLimitOriginate(_0x5bbe0f,_0x1dac71,0x0);logger[_0x4c4c('0x99')](_0x3718cc,util[_0x4c4c('0x9a')](_0x57a8a2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x55f9fa){return function(_0x1c422c){if(isNotNull(_0x1c422c)&&isNotNull(_0x1c422c[0x0])){if(_0x1c422c[0x0]['contactsRescheduled']>0x0){_0x55f9fa[_0x4c4c('0x41')]='RESCHEDULED_CONTACTS';logger[_0x4c4c('0x81')](_0x4c4c('0x9e')+_0x55f9fa[_0x4c4c('0x43')],_0x1c422c[0x0][_0x4c4c('0x9f')],'contacts');}else{_0x55f9fa[_0x4c4c('0x41')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x4c4c('0x81')](_0x4c4c('0xa0')+_0x55f9fa[_0x4c4c('0x43')]);}}};}function notSendMessagesQueue(_0x36a0b9){if(_0x36a0b9[_0x4c4c('0xa1')]){freeVariablesPredictive(_0x36a0b9);if(_0x36a0b9['originated']===0x0&&_0x36a0b9[_0x4c4c('0x59')]===0x0&&_0x36a0b9['waiting']===0x0&&(_0x36a0b9[_0x4c4c('0x56')]||0x0)===0x0){_0x36a0b9['sendMessageOneNotActive']=![];_0x36a0b9[_0x4c4c('0xa2')]=0x0;_0x36a0b9[_0x4c4c('0x41')]=_0x4c4c('0x45');loggerSyncQueueSummary[_0x4c4c('0x98')](_0x4c4c('0xa3'),_0x36a0b9[_0x4c4c('0x43')],_0x4c4c('0xa4'));}else{_0x36a0b9[_0x4c4c('0x41')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x4c4c('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x36a0b9[_0x4c4c('0x43')],'is\x20disactive');}emitVoiceQueueSummary(_0x36a0b9);}}function notSendMessagesCampaign(_0x57715b){if(_0x57715b[_0x4c4c('0xa1')]){if(_0x57715b[_0x4c4c('0x77')]===0x0){_0x57715b[_0x4c4c('0xa1')]=![];_0x57715b[_0x4c4c('0x41')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x4c4c('0x98')](_0x4c4c('0xa5'),_0x57715b[_0x4c4c('0x43')],_0x4c4c('0xa4'));}else{_0x57715b[_0x4c4c('0x41')]=_0x4c4c('0xa6');loggerSyncQueueSummary[_0x4c4c('0x98')](_0x4c4c('0xa5'),_0x57715b[_0x4c4c('0x43')],_0x4c4c('0xa7'));}emitCampaignSummary(_0x57715b);}}function createObjHistory(_0x1f53e3,_0x5774e1,_0x1b4840,_0x2a02e9,_0x170579){_0x1f53e3[_0x4c4c('0x41')]=_0x1b4840;var _0x5b71dd=new Action(_0x1f53e3,_0x5774e1);var _0x23415b=new History(_0x5b71dd);_0x23415b['state']=_0x2a02e9;_0x23415b[_0x4c4c('0xa8')]=_0x170579;_0x23415b['endtime']=_0x5b71dd[_0x4c4c('0xa9')];return _0x23415b;}Dialer[_0x4c4c('0x1e')][_0x4c4c('0x3c')]=function(){var _0x5a4267=this;setInterval(function(){_0x5a4267['clearZombieChannels'](_0x5a4267[_0x4c4c('0x28')],_0x4c4c('0xaa'));_0x5a4267['clearZombieChannels'](_0x5a4267[_0x4c4c('0xab')],_0x4c4c('0xac'));},0x32c8);};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xad')]=function(_0x3bf697,_0x4f2e96){var _0x546a27=this;for(var _0x2ea0eb in _0x3bf697){if(typeof _0x3bf697[_0x2ea0eb]!==_0x4c4c('0xae')){this['sequence'][_0x4c4c('0xaf')](function(){if(!_['isNil'](_0x3bf697[_0x2ea0eb])){return ami[_0x4c4c('0xb0')]({'action':_0x4c4c('0xb1'),'channel':_0x3bf697[_0x2ea0eb][_0x4c4c('0xb2')]})[_0x4c4c('0xb3')](function(_0x545cc1){if(_0x545cc1[_0x4c4c('0x41')]===_0x4c4c('0xb4')){setTimeout(function(){if(_0x3bf697[_0x2ea0eb]&&_0x3bf697[_0x2ea0eb][_0x4c4c('0x51')]!==_0x4c4c('0xb5')){_0x546a27[_0x4c4c('0xb6')](_0x546a27[_0x4c4c('0x22')][_0x3bf697[_0x2ea0eb][_0x4c4c('0xb7')]]);logger[_0x4c4c('0x99')](_0x4c4c('0xb8'),_0x4f2e96,_0x2ea0eb,_0x3bf697[_0x2ea0eb][_0x4c4c('0xb7')]);delete _0x3bf697[_0x2ea0eb];}if(_0x3bf697[_0x2ea0eb]&&_0x3bf697[_0x2ea0eb][_0x4c4c('0x51')]===_0x4c4c('0xb5')){_0x546a27[_0x4c4c('0xb6')](_0x546a27[_0x4c4c('0x23')][_0x3bf697[_0x2ea0eb][_0x4c4c('0xb7')]]);logger[_0x4c4c('0x99')](_0x4c4c('0xb9'),_0x4f2e96,_0x2ea0eb,_0x3bf697[_0x2ea0eb]['queue']);delete _0x3bf697[_0x2ea0eb];}},0x2328);}});}});}}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xba')]=function(_0x4af4bd){return Promise[_0x4c4c('0xbb')]()[_0x4c4c('0x3e')](cmHopper[_0x4c4c('0xba')](_0x4af4bd))[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xbc')));};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xbd')]=function(_0x471851){return Promise['resolve']()[_0x4c4c('0x3e')](cmHopperBlack['checkIsBlackList'](_0x471851))['catch'](loggerCatch(_0x4c4c('0xbe')));};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xbf')]=function(_0x22b95c,_0xd31e55,_0x3e2fde){return Promise['resolve']()[_0x4c4c('0x3e')](cmHopperAdditionalPhone[_0x4c4c('0xbf')](_0x22b95c,_0xd31e55,_0x3e2fde))[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xc0')));};Dialer['prototype']['swapAdditionalPhones']=function(_0xcf816c,_0x19cc4c,_0x3d0742){return Promise[_0x4c4c('0xbb')]()[_0x4c4c('0x3e')](cmHopperAdditionalPhone[_0x4c4c('0xc1')](_0xcf816c,_0x19cc4c,_0x3d0742))[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xc2')));};Dialer[_0x4c4c('0x1e')]['checkIsBlackListIvr']=function(_0x39e69f){return Promise[_0x4c4c('0xbb')]()[_0x4c4c('0x3e')](cmHopperBlack[_0x4c4c('0xc3')](_0x39e69f))[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xc4')));};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xc5')]=function(_0x2cda96){return Promise[_0x4c4c('0xbb')]()[_0x4c4c('0x3e')](cmHopperHistory[_0x4c4c('0xc6')](_0x2cda96))[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xc7')));};Dialer['prototype'][_0x4c4c('0xc8')]=function(_0x4382b7){return Promise[_0x4c4c('0xbb')]()[_0x4c4c('0x3e')](cmHopper['rescheduleContact'](_0x4382b7))[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xc9')));};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xca')]=function(_0x5dc72c,_0x6d3504,_0x1e1376){return Promise[_0x4c4c('0xbb')]()['then'](cmHopper[_0x4c4c('0xca')](_0x5dc72c,_0x6d3504,_0x1e1376))[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xcb')));};Dialer['prototype']['getContactDialer']=function(_0x23a89f,_0x590938,_0x492009,_0xf1c7c0,_0x27f5c8){return Promise[_0x4c4c('0xbb')]()['then'](cmHopper['getContactDialer'](_0x23a89f,_0x590938,_0x492009,_0xf1c7c0))[_0x4c4c('0xb3')](function(_0x324be0){_0x27f5c8['temp']-=_0x492009;_0x27f5c8[_0x4c4c('0xcc')]=_0x27f5c8[_0x4c4c('0xcc')]>0x0?_0x27f5c8[_0x4c4c('0xcc')]:0x0;loggerCatch(_0x4c4c('0xcd'))(_0x324be0);});};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xce')]=function(_0x2424bb,_0x7c66d8,_0x380df5,_0x2f6c5a){return Promise['resolve']()['then'](cmHopper[_0x4c4c('0xce')](_0x2424bb,_0x7c66d8,_0x380df5))['catch'](function(_0x3cc4f3){_0x2f6c5a['temp']-=_0x7c66d8;_0x2f6c5a[_0x4c4c('0xcc')]=_0x2f6c5a[_0x4c4c('0xcc')]>0x0?_0x2f6c5a['temp']:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x3cc4f3);});};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xcf')]=function(_0x1c7460){return Promise[_0x4c4c('0xbb')]()[_0x4c4c('0x3e')](voiceQueueRt[_0x4c4c('0xcf')](_0x1c7460))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xd0')]=function(_0x1371fc){return Promise['resolve']()[_0x4c4c('0x3e')](cmHopper[_0x4c4c('0xd0')](_0x1371fc))[_0x4c4c('0xb3')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xd1')]=function(_0x60948e){return Promise[_0x4c4c('0xbb')]()[_0x4c4c('0x3e')](cmHopperHistory[_0x4c4c('0xd1')](_0x60948e))[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xd2')));};Dialer['prototype'][_0x4c4c('0xb6')]=function(_0x5d98f0){if(!_['isUndefined'](_0x5d98f0)&&_0x5d98f0!==null){if(typeof _0x5d98f0[_0x4c4c('0x77')]!==_0x4c4c('0xae')){if(_0x5d98f0[_0x4c4c('0x77')]>0x0){_0x5d98f0['originated']-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4c4c('0x99')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0x4c4c('0xd3')]=function(_0xf8b00b,_0x1ba646){var _0x3e6d73=this;return function(_0x5a51ab){_0x3e6d73[_0x4c4c('0xb6')](_0x1ba646);logger[_0x4c4c('0x99')](_0xf8b00b,util['inspect'](_0x5a51ab,{'showHidden':![],'depth':null}));};};Dialer[_0x4c4c('0x1e')]['emptyContact']=function(_0x3de51b,_0x2c8f37,_0x5c06ba){var _0x2cc412={'state':0x19,'statedesc':_0x4c4c('0xd4')};this['updateOriginated'](_0x2c8f37);this[_0x4c4c('0xd5')](_['merge'](_0x2cc412,_[_0x4c4c('0xd6')](_0x5c06ba,[_0x4c4c('0xd7'),_0x4c4c('0xd8'),_0x4c4c('0xd9'),'VoiceQueueId','CampaignId'])),_0x4c4c('0xda'),_0x4c4c('0xdb'));logger[_0x4c4c('0x99')](_0x3de51b);};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xdc')]=function(_0x4f39c6){return _0x4f39c6===_0x4c4c('0xdd');};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xde')]=function(_0x43d555){return!_[_0x4c4c('0x40')](_0x43d555)&&_0x43d555&&!_[_0x4c4c('0x40')](_0x43d555[_0x4c4c('0x43')])&&!_[_0x4c4c('0x40')](_0x43d555[_0x4c4c('0x7b')])&&_0x43d555['active']&&(this[_0x4c4c('0x25')][util[_0x4c4c('0x7e')]('SIP/%s',_0x43d555['name'])][_0x4c4c('0xb1')]===_0x4c4c('0xdf')||this[_0x4c4c('0x25')][util['format'](_0x4c4c('0xe0'),_0x43d555[_0x4c4c('0x43')])][_0x4c4c('0xb1')]===_0x4c4c('0xe1'));};Dialer[_0x4c4c('0x1e')]['saveInDb']=function(_0x10c672,_0x2d31ec,_0xb34385){this[_0x4c4c('0xd1')](_0x10c672)[_0x4c4c('0xb3')](loggerCatch(_0x2d31ec));this['moveContactManagedDialer'](_0x10c672)[_0x4c4c('0xb3')](loggerCatch(_0xb34385));};Dialer['prototype'][_0x4c4c('0xe2')]=function(_0x43de34){var _0x507bec=this;var _0xd50d2c=this['uniqueId'][_0x43de34['uniqueid']];var _0x4005bc;if(!_[_0x4c4c('0xe3')](_0x43de34)&&!_[_0x4c4c('0xe3')](_0x43de34[_0x4c4c('0xe4')])&&!_[_0x4c4c('0xe3')](_0x43de34[_0x4c4c('0xe4')][_0x4c4c('0xe5')])&&_0x43de34[_0x4c4c('0xe6')]===_0x4c4c('0xe7')&&_0xd50d2c){if(_0xd50d2c[_0x4c4c('0x51')]!==_0x4c4c('0xb5')&&this[_0x4c4c('0x22')][_0xd50d2c[_0x4c4c('0xb7')]]['dialAMDActive']&&_0x43de34[_0x4c4c('0xe8')]==='HANGUP'){delete this[_0x4c4c('0x28')][_0x43de34['uniqueid']];this[_0x4c4c('0xb6')](this[_0x4c4c('0x22')][_0xd50d2c['queue']]);this['voiceQueues'][_0xd50d2c[_0x4c4c('0xb7')]]['outboundAnswerCallsDay']+=0x1;this[_0x4c4c('0x22')][_0xd50d2c[_0x4c4c('0xb7')]][_0x4c4c('0x61')]+=0x1;_0x4005bc=new Hangup(_0xd50d2c,_0x43de34);_0x4005bc[_0x4c4c('0xe9')]=0x12;_0x4005bc['statedesc']='HangupInAMD';_0x4005bc[_0x4c4c('0xea')]=_0x4c4c('0xeb');ami['emit'](_0x4c4c('0xec'),ut[_0x4c4c('0xed')](_0x4005bc,_0x4c4c('0xee')));this[_0x4c4c('0xd5')](_0x4005bc,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0xd50d2c['type']!=='ivr'&&this['voiceQueues'][_0xd50d2c[_0x4c4c('0xb7')]][_0x4c4c('0xef')]&&_0x43de34['value']===_0x4c4c('0xf0')){return new Promise(function(_0x12e685,_0x22c2d3){delete _0x507bec[_0x4c4c('0x28')][_0x43de34['uniqueid']];_0x507bec[_0x4c4c('0xb6')](_0x507bec[_0x4c4c('0x22')][_0xd50d2c[_0x4c4c('0xb7')]]);_0x507bec[_0x4c4c('0x22')][_0xd50d2c['queue']][_0x4c4c('0x62')]+=0x1;_0x507bec['voiceQueues'][_0xd50d2c[_0x4c4c('0xb7')]][_0x4c4c('0x61')]+=0x1;var _0x44d83c=_0x507bec['voiceQueues'][_0xd50d2c[_0x4c4c('0xb7')]];var _0x2d00f2=new Hangup(_0xd50d2c,_0x43de34);_0x2d00f2['state']=0x13;_0x2d00f2[_0x4c4c('0xa8')]=_0x4c4c('0xf1');_0x2d00f2[_0x4c4c('0xea')]=_0x4c4c('0xeb');_0x2d00f2[_0x4c4c('0xf2')]+=0x1;_0x2d00f2[_0x4c4c('0xf3')]+=0x1;_0x2d00f2['amd']=!![];ami[_0x4c4c('0xf4')]('custom:amd',ut['buildObj'](_0x2d00f2,_0x4c4c('0xee')));_0x507bec[_0x4c4c('0xd1')](_0x2d00f2)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xf5')));if(_0x2d00f2[_0x4c4c('0xf6')]+_0x2d00f2['countcongestionretry']+_0x2d00f2[_0x4c4c('0xf7')]+_0x2d00f2[_0x4c4c('0xf8')]+_0x2d00f2[_0x4c4c('0xf9')]+_0x2d00f2[_0x4c4c('0xfa')]+_0x2d00f2[_0x4c4c('0xf2')]+_0x2d00f2['countagentrejectretry']>=_0x44d83c[_0x4c4c('0xfb')]){_0x507bec[_0x4c4c('0xfc')](_0x2d00f2,_0x12e685,_0x22c2d3,'reason19\x20machine....');}else{if(_0x2d00f2[_0x4c4c('0xf2')]>=_0x44d83c[_0x4c4c('0xfd')]){_0x507bec[_0x4c4c('0xfe')](_0x2d00f2,_0x12e685,_0x22c2d3,_0x4c4c('0xff'));}else{_0x507bec['rescheduleContact']({'active':![],'countmachineretry':_0x2d00f2[_0x4c4c('0xf2')],'scheduledat':moment()[_0x4c4c('0x100')](_0x44d83c[_0x4c4c('0x101')],_0x4c4c('0x102'))['format'](_0x4c4c('0x103')),'ContactId':_0x2d00f2[_0x4c4c('0xd7')],'ListId':_0x2d00f2[_0x4c4c('0xd8')],'VoiceQueueId':_0x2d00f2['VoiceQueueId']||undefined,'CampaignId':_0x2d00f2[_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x105')));_0x12e685({'reschedule':0x1});}}});}if(_0xd50d2c[_0x4c4c('0x51')]==='ivr'&&this['campaigns'][_0xd50d2c['queue']][_0x4c4c('0xef')]&&_0x43de34['value']===_0x4c4c('0x106')){delete this[_0x4c4c('0x28')][_0x43de34[_0x4c4c('0x107')]];this['updateOriginated'](this[_0x4c4c('0x23')][_0xd50d2c['queue']]);_0x4005bc=new Hangup(_0xd50d2c,_0x43de34);_0x4005bc[_0x4c4c('0xe9')]=0x12;_0x4005bc[_0x4c4c('0xa8')]=_0x4c4c('0x108');_0x4005bc[_0x4c4c('0xea')]=_0x4c4c('0xeb');ami[_0x4c4c('0xf4')](_0x4c4c('0xec'),ut[_0x4c4c('0xed')](_0x4005bc,'amd'));this['saveInDb'](_0x4005bc,_0x4c4c('0x109'),_0x4c4c('0x10a'));}if(_0xd50d2c[_0x4c4c('0x51')]===_0x4c4c('0xb5')&&this[_0x4c4c('0x23')][_0xd50d2c[_0x4c4c('0xb7')]]['dialAMDActive']&&_0x43de34[_0x4c4c('0xe8')]==='MACHINE'){return new Promise(function(_0x42bdbb,_0x1b6839){delete _0x507bec[_0x4c4c('0x28')][_0x43de34['uniqueid']];_0x507bec[_0x4c4c('0xb6')](_0x507bec[_0x4c4c('0x23')][_0xd50d2c[_0x4c4c('0xb7')]]);_0x507bec[_0x4c4c('0x23')][_0xd50d2c[_0x4c4c('0xb7')]][_0x4c4c('0x62')]+=0x1;_0x507bec[_0x4c4c('0x23')][_0xd50d2c[_0x4c4c('0xb7')]][_0x4c4c('0x61')]+=0x1;var _0x75a90c=_0x507bec[_0x4c4c('0x23')][_0xd50d2c[_0x4c4c('0xb7')]];var _0x44105b=new Hangup(_0xd50d2c,_0x43de34);_0x44105b[_0x4c4c('0xe9')]=0x13;_0x44105b['statedesc']=_0x4c4c('0xf1');_0x44105b['membername']=_0x4c4c('0xeb');_0x44105b['countmachineretry']+=0x1;_0x44105b[_0x4c4c('0xf3')]+=0x1;_0x44105b[_0x4c4c('0xee')]=!![];ami[_0x4c4c('0xf4')](_0x4c4c('0xec'),ut[_0x4c4c('0xed')](_0x44105b,'amd'));_0x507bec[_0x4c4c('0xd1')](_0x44105b)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xf5')));if(_0x44105b[_0x4c4c('0xf6')]+_0x44105b[_0x4c4c('0x10b')]+_0x44105b[_0x4c4c('0xf7')]+_0x44105b['countnosuchnumberretry']+_0x44105b[_0x4c4c('0xf9')]+_0x44105b[_0x4c4c('0xfa')]+_0x44105b[_0x4c4c('0xf2')]+_0x44105b[_0x4c4c('0x10c')]>=_0x75a90c[_0x4c4c('0xfb')]){_0x507bec['stateGlobal'](_0x44105b,_0x42bdbb,_0x1b6839,_0x4c4c('0x10d'));}else{if(_0x44105b['countmachineretry']>=_0x75a90c[_0x4c4c('0xfd')]){_0x507bec['createStateFinal'](_0x44105b,_0x42bdbb,_0x1b6839,_0x4c4c('0xff'));}else{_0x507bec['rescheduleContact']({'active':![],'countmachineretry':_0x44105b[_0x4c4c('0xf2')],'scheduledat':moment()[_0x4c4c('0x100')](_0x75a90c[_0x4c4c('0x101')],_0x4c4c('0x102'))['format'](_0x4c4c('0x103')),'ContactId':_0x44105b[_0x4c4c('0xd7')],'ListId':_0x44105b[_0x4c4c('0xd8')],'VoiceQueueId':_0x44105b[_0x4c4c('0x10e')]||undefined,'CampaignId':_0x44105b[_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x105')));_0x42bdbb({'reschedule':0x1});}}});}}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x35')]=function(_0x2bfa43){var _0x471348=this['uniqueId'][_0x2bfa43[_0x4c4c('0x107')]];var _0x414055;if(_0x471348&&_0x471348[_0x4c4c('0x51')]===_0x4c4c('0xb5')){delete this['uniqueId'][_0x2bfa43['uniqueid']];this[_0x4c4c('0xb6')](this[_0x4c4c('0x23')][_0x471348['queue']]);this[_0x4c4c('0x23')][_0x471348[_0x4c4c('0xb7')]][_0x4c4c('0x10f')]+=0x1;_0x414055=new Hangup(_0x471348,_0x2bfa43);this[_0x4c4c('0xd1')](_0x414055)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x110')));this['moveContactManagedDialer'](_0x414055)['catch'](loggerCatch(_0x4c4c('0x111')));}if(_0x471348&&_0x471348[_0x4c4c('0x51')]!=='ivr'&&isNotNull(this[_0x4c4c('0x22')][_0x471348[_0x4c4c('0xb7')]][_0x4c4c('0x112')])){delete this[_0x4c4c('0x28')][_0x2bfa43['uniqueid']];this[_0x4c4c('0xb6')](this[_0x4c4c('0x22')][_0x471348[_0x4c4c('0xb7')]]);this[_0x4c4c('0x22')][_0x471348[_0x4c4c('0xb7')]][_0x4c4c('0x62')]+=0x1;this[_0x4c4c('0x22')][_0x471348[_0x4c4c('0xb7')]]['outboundAnswerAgiCallsDay']+=0x1;_0x414055=new Hangup(_0x471348,_0x2bfa43);_0x414055[_0x4c4c('0xe9')]=0x10;_0x414055[_0x4c4c('0xa8')]=_0x4c4c('0x113');_0x414055[_0x4c4c('0xea')]=_0x4c4c('0x114');this['createHistory'](_0x414055)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x110')));this[_0x4c4c('0xd0')](_0x414055)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x111')));}if(_0x471348&&_0x471348['type']!==_0x4c4c('0xb5')&&!isNotNull(this[_0x4c4c('0x22')][_0x471348['queue']]['dialQueueProject'])){delete this[_0x4c4c('0x28')][_0x2bfa43['uniqueid']];this[_0x4c4c('0xb6')](this[_0x4c4c('0x22')][_0x471348[_0x4c4c('0xb7')]]);this[_0x4c4c('0x22')][_0x471348[_0x4c4c('0xb7')]][_0x4c4c('0x6b')]+=0x1;_0x414055=new Hangup(_0x471348,_0x2bfa43);_0x414055[_0x4c4c('0xe9')]=0xc;_0x414055['statedesc']=_0x2bfa43[_0x4c4c('0x115')];_0x414055[_0x4c4c('0xea')]=_0x4c4c('0x116');this[_0x4c4c('0xd1')](_0x414055)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x110')));this[_0x4c4c('0xd0')](_0x414055)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x111')));}};Dialer['prototype'][_0x4c4c('0x33')]=function(_0x1d0ba4){var _0x29cd7d=this['uniqueId'][_0x1d0ba4[_0x4c4c('0x107')]];if(this[_0x4c4c('0x22')][_0x1d0ba4[_0x4c4c('0xb7')]]){if(_0x29cd7d&&_0x29cd7d['type']!==_0x4c4c('0xb5')){delete this['uniqueId'][_0x1d0ba4[_0x4c4c('0x107')]];this[_0x4c4c('0x22')][_0x1d0ba4[_0x4c4c('0xb7')]]['outboundAnswerCallsDay']+=0x1;var _0xe15d79=new AgentComplete(_0x29cd7d,_0x1d0ba4);if(_0x1d0ba4[_0x4c4c('0x117')]===_0x4c4c('0x118')){_0xe15d79[_0x4c4c('0x119')]=this['voiceQueues'][_0x1d0ba4['queue']][_0x4c4c('0x11a')]&&this[_0x4c4c('0x22')][_0x1d0ba4['queue']][_0x4c4c('0x11b')]?moment()[_0x4c4c('0x7e')](_0x4c4c('0x103')):undefined;}this['createHistory'](_0xe15d79)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x11c')));this[_0x4c4c('0xd0')](_0xe15d79)['catch'](loggerCatch(_0x4c4c('0x11d')));}}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x11e')]=function(_0xd088c3){if(this[_0x4c4c('0x22')][_0xd088c3[_0x4c4c('0xb7')]]){if(this[_0x4c4c('0x28')][_0xd088c3[_0x4c4c('0x107')]]&&this[_0x4c4c('0x28')][_0xd088c3[_0x4c4c('0x107')]][_0x4c4c('0x51')]!==_0x4c4c('0xb5')){this[_0x4c4c('0xb6')](this[_0x4c4c('0x22')][_0xd088c3['queue']]);this[_0x4c4c('0x28')][_0xd088c3[_0x4c4c('0x107')]][_0x4c4c('0x11f')]=moment()[_0x4c4c('0x7e')](_0x4c4c('0x103'));}}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x120')]=function(_0x3974f2,_0x2a955b){this[_0x4c4c('0xd1')](_0x3974f2)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x11c')));if(_0x2a955b==0x0){this['moveContactManagedDialer'](_0x3974f2)['catch'](loggerCatch(_0x4c4c('0x121')));}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x122')]=function(_0x3b384d){var _0x38d61d=this[_0x4c4c('0x28')][_0x3b384d['uniqueid']];var _0x31e703=this;var _0x272e61=![];var _0x2cee58;var _0x18a84e;if(this[_0x4c4c('0x22')][_0x3b384d['queue']]){if(_0x38d61d&&_0x38d61d[_0x4c4c('0x51')]!==_0x4c4c('0xb5')){delete this[_0x4c4c('0x28')][_0x3b384d['uniqueid']];this[_0x4c4c('0xb6')](this['voiceQueues'][_0x3b384d[_0x4c4c('0xb7')]]);_0x38d61d[_0x4c4c('0x123')]=moment()[_0x4c4c('0x7e')](_0x4c4c('0x103'));var _0x862354=new QueueCallerAbandon(_0x38d61d,_0x3b384d);if(getSeconds(_0x38d61d[_0x4c4c('0x123')],_0x38d61d[_0x4c4c('0x124')])>=_0x38d61d[_0x4c4c('0x125')]){this[_0x4c4c('0x22')][_0x3b384d[_0x4c4c('0xb7')]][_0x4c4c('0x70')]+=0x1;this['voiceQueues'][_0x3b384d[_0x4c4c('0xb7')]][_0x4c4c('0x67')]+=0x1;this[_0x4c4c('0x22')][_0x3b384d['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x862354['state']=0xa;_0x862354[_0x4c4c('0xa8')]=_0x4c4c('0x126');_0x862354[_0x4c4c('0x127')]='TIMEOUT';_0x862354['agiafterat']=this[_0x4c4c('0x22')][_0x3b384d[_0x4c4c('0xb7')]][_0x4c4c('0x11a')]?moment()[_0x4c4c('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x862354[_0x4c4c('0xf9')]+=0x1;_0x862354['countglobal']+=0x1;_0x2cee58=this['voiceQueues'][_0x3b384d[_0x4c4c('0xb7')]]['dialDropRetryFrequency'];_0x18a84e=this[_0x4c4c('0x22')][_0x3b384d[_0x4c4c('0xb7')]]['callAdditionalPhoneAfterMin'];_0x31e703[_0x4c4c('0xbf')](_0x862354,_0x862354[_0x4c4c('0xe9')],_0x38d61d[_0x4c4c('0x128')])[_0x4c4c('0x3e')](function(_0x4b0c6f){_0x272e61=_0x4b0c6f[_0x4c4c('0x129')]==0x1;if(_0x862354[_0x4c4c('0xf9')]>=_0x31e703[_0x4c4c('0x22')][_0x3b384d['queue']][_0x4c4c('0x12a')]){_0x31e703[_0x4c4c('0x120')](_0x862354,_0x4b0c6f[_0x4c4c('0x129')]);}else{_0x31e703[_0x4c4c('0xc8')]({'active':![],'countdropretry':_0x862354[_0x4c4c('0xf9')],'scheduledat':moment()['add'](_0x31e703[_0x4c4c('0x22')][_0x3b384d[_0x4c4c('0xb7')]][_0x4c4c('0x12b')],_0x4c4c('0x102'))[_0x4c4c('0x7e')](_0x4c4c('0x103')),'ContactId':_0x38d61d['ContactId'],'ListId':_0x38d61d[_0x4c4c('0xd8')],'VoiceQueueId':_0x38d61d[_0x4c4c('0x10e')]||undefined,'CampaignId':_0x38d61d[_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x12c')));var _0x341eb1=new History(_0x862354);_0x341eb1['state']=0xa;_0x341eb1[_0x4c4c('0xa8')]=_0x4c4c('0x126');_0x341eb1[_0x4c4c('0xa9')]=moment()[_0x4c4c('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x341eb1['endtime']=_0x341eb1[_0x4c4c('0xa9')];_0x341eb1[_0x4c4c('0x12d')]=_0x862354[_0x4c4c('0x12d')];_0x341eb1[_0x4c4c('0x12e')]=_0x862354['calleridnum'];_0x31e703['createHistory'](_0x341eb1)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x12f')));}})[_0x4c4c('0x3e')](function(){if(_0x272e61)_0x31e703['swapAdditionalPhones'](_0x862354,_0x2cee58,_0x18a84e)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0x3b384d['queue']][_0x4c4c('0x6f')]+=0x1;this['voiceQueues'][_0x3b384d[_0x4c4c('0xb7')]][_0x4c4c('0x66')]+=0x1;_0x862354['state']=0xb;_0x862354['statedesc']=_0x4c4c('0x130');_0x862354['dropreason']=_0x4c4c('0x131');_0x862354[_0x4c4c('0xfa')]+=0x1;_0x862354[_0x4c4c('0xf3')]+=0x1;_0x2cee58=this['voiceQueues'][_0x3b384d[_0x4c4c('0xb7')]][_0x4c4c('0x132')];_0x18a84e=this['voiceQueues'][_0x3b384d[_0x4c4c('0xb7')]][_0x4c4c('0x133')];_0x31e703[_0x4c4c('0xbf')](_0x862354,_0x862354[_0x4c4c('0xe9')],_0x38d61d[_0x4c4c('0x128')])[_0x4c4c('0x3e')](function(_0x4a910d){if(_0x862354[_0x4c4c('0xfa')]>=_0x31e703[_0x4c4c('0x22')][_0x3b384d[_0x4c4c('0xb7')]][_0x4c4c('0x134')]){_0x31e703[_0x4c4c('0x120')](_0x862354,_0x4a910d[_0x4c4c('0x129')]);}else{_0x31e703[_0x4c4c('0xc8')]({'active':![],'countabandonedretry':_0x862354['countabandonedretry'],'scheduledat':moment()[_0x4c4c('0x100')](_0x31e703[_0x4c4c('0x22')][_0x3b384d[_0x4c4c('0xb7')]][_0x4c4c('0x132')],_0x4c4c('0x102'))[_0x4c4c('0x7e')](_0x4c4c('0x103')),'ContactId':_0x38d61d['ContactId'],'ListId':_0x38d61d[_0x4c4c('0xd8')],'VoiceQueueId':_0x38d61d[_0x4c4c('0x10e')]||undefined,'CampaignId':_0x38d61d[_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x205097=new History(_0x862354);_0x205097[_0x4c4c('0xe9')]=0xb;_0x205097['statedesc']=_0x4c4c('0x130');_0x205097['starttime']=moment()['format'](_0x4c4c('0x103'));_0x205097['endtime']=_0x205097['starttime'];_0x205097[_0x4c4c('0x12d')]=_0x862354['calleridname'];_0x205097[_0x4c4c('0x12e')]=_0x862354['calleridnum'];_0x31e703[_0x4c4c('0xd1')](_0x205097)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x135')));}})[_0x4c4c('0x3e')](function(){if(_0x272e61)_0x31e703['swapAdditionalPhones'](_0x862354,_0x2cee58,_0x18a84e)[_0x4c4c('0x3e')](function(){return 0x1;});});}}}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x37')]=function(_0x337e17){if(this[_0x4c4c('0xab')][_0x337e17[_0x4c4c('0x107')]]){this[_0x4c4c('0xab')][_0x337e17[_0x4c4c('0x107')]][_0x4c4c('0xb2')]=_0x337e17[_0x4c4c('0xb2')];}if(this[_0x4c4c('0x28')][_0x337e17[_0x4c4c('0x107')]]){this[_0x4c4c('0x28')][_0x337e17['uniqueid']][_0x4c4c('0xb2')]=_0x337e17['channel'];}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x136')]=function(_0x2f691c){if(strategy[this[_0x4c4c('0x22')][this['actions'][_0x2f691c[_0x4c4c('0x137')]][_0x4c4c('0xb7')]][_0x4c4c('0x53')]]===_0x4c4c('0x1d')){if(this['actions'][_0x2f691c[_0x4c4c('0x137')]]&&_['isNil'](this['actions'][_0x2f691c['actionid']][_0x4c4c('0x138')])&&_0x2f691c[_0x4c4c('0xb1')]==='1'&&_0x2f691c[_0x4c4c('0x139')]==='0'){if(this[_0x4c4c('0x24')][_0x2f691c['stateinterface']]){if(!this['agents'][_0x2f691c[_0x4c4c('0x13a')]][_0x4c4c('0x138')]){this[_0x4c4c('0x24')][_0x2f691c[_0x4c4c('0x13a')]][_0x4c4c('0x138')]=!![];this['actions'][_0x2f691c[_0x4c4c('0x137')]][_0x4c4c('0x138')]=!![];this['actions'][_0x2f691c['actionid']][_0x4c4c('0x13a')]=_0x2f691c['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0x2f691c[_0x4c4c('0x137')]][_0x4c4c('0xb7')]][_0x4c4c('0x53')]]||_0x4c4c('0x1c'))===_0x4c4c('0x1c')){if(this[_0x4c4c('0xab')][_0x2f691c[_0x4c4c('0x137')]]){if(this['agents'][_0x2f691c[_0x4c4c('0x13a')]]){this[_0x4c4c('0xab')][_0x2f691c[_0x4c4c('0x137')]][_0x4c4c('0x13a')]=_0x2f691c[_0x4c4c('0x13a')];if(_[_0x4c4c('0xe3')](this[_0x4c4c('0x13b')][this[_0x4c4c('0xab')][_0x2f691c[_0x4c4c('0x137')]][_0x4c4c('0xb7')]])){this[_0x4c4c('0x13b')][this[_0x4c4c('0xab')][_0x2f691c[_0x4c4c('0x137')]][_0x4c4c('0xb7')]]=[];}this[_0x4c4c('0x13b')][this[_0x4c4c('0xab')][_0x2f691c['actionid']]['queue']][_0x4c4c('0x13c')](_[_0x4c4c('0x13d')](_[_0x4c4c('0xd6')](this[_0x4c4c('0xab')][_0x2f691c[_0x4c4c('0x137')]],[_0x4c4c('0x13e'),_0x4c4c('0x13a')]),{'status':_0x2f691c[_0x4c4c('0xb1')],'paused':_0x2f691c[_0x4c4c('0x139')]}));}}}};function unlockQueueStatus(_0xb3dd82,_0x4358f0){setTimeout(function(){if(_[_0x4c4c('0x40')](_0xb3dd82[_0x4c4c('0x13f')])){loggerBooked[_0x4c4c('0x99')]('[unlockQueueStatus][undefined]',_0x4358f0);}_0xb3dd82[_0x4c4c('0x13f')]=!![];loggerBooked[_0x4c4c('0x81')](_0x4c4c('0x140'),_0x4358f0,JSON['stringify'](_['pick'](_0xb3dd82,['name',_0x4c4c('0x13f')])));},0x1f3);}Dialer[_0x4c4c('0x1e')][_0x4c4c('0x3b')]=function(_0x40d9c2){var _0x491666=this;var _0x126907=_0x491666[_0x4c4c('0x22')][_0x491666[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]][_0x4c4c('0xb7')]];if(strategy[this[_0x4c4c('0x22')][this['actions'][_0x40d9c2['actionid']][_0x4c4c('0xb7')]][_0x4c4c('0x53')]]===_0x4c4c('0x1d')){if(this['actions'][_0x40d9c2['actionid']]&&this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]][_0x4c4c('0x13a')]){this[_0x4c4c('0x94')][_0x4c4c('0x141')](this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]]['idHopper'],this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]][_0x4c4c('0x13a')])[_0x4c4c('0xb3')](function(_0x2de24e){logger['error'](_0x4c4c('0x142'),util[_0x4c4c('0x9a')](_0x2de24e,{'showHidden':![],'depth':null}));})[_0x4c4c('0x20')](function(){_0x491666[_0x4c4c('0xb6')](_0x491666['voiceQueues'][_0x491666['actions'][_0x40d9c2[_0x4c4c('0x137')]][_0x4c4c('0xb7')]]);_0x491666['agents'][_0x491666[_0x4c4c('0xab')][_0x40d9c2['actionid']]['stateinterface']]['locked']=![];delete _0x491666[_0x4c4c('0xab')][_0x40d9c2['actionid']];unlockQueueStatus(_0x126907);});}else{this[_0x4c4c('0xb6')](this[_0x4c4c('0x22')][this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]]['queue']]);this[_0x4c4c('0xc8')]({'active':![],'ContactId':this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]][_0x4c4c('0xd7')],'ListId':this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]][_0x4c4c('0xd8')],'VoiceQueueId':this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]][_0x4c4c('0x10e')]||undefined,'CampaignId':this[_0x4c4c('0xab')][_0x40d9c2['actionid']][_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x143')));delete this[_0x4c4c('0xab')][_0x40d9c2['actionid']];unlockQueueStatus(_0x126907);}}else if((strategy[this['voiceQueues'][this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]][_0x4c4c('0xb7')]][_0x4c4c('0x53')]]||_0x4c4c('0x1c'))===_0x4c4c('0x1c')){var _0x126012;if(this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]]&&!_[_0x4c4c('0x4b')](this[_0x4c4c('0x13b')][this[_0x4c4c('0xab')][_0x40d9c2['actionid']][_0x4c4c('0xb7')]])){if(this[_0x4c4c('0x2d')][_0x491666[_0x4c4c('0xab')][_0x40d9c2['actionid']][_0x4c4c('0xb7')]]){this[_0x4c4c('0x2d')][_0x491666[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]][_0x4c4c('0xb7')]]=this[_0x4c4c('0x2d')][this[_0x4c4c('0xab')][_0x40d9c2['actionid']][_0x4c4c('0xb7')]]?this[_0x4c4c('0x2d')][this[_0x4c4c('0xab')][_0x40d9c2['actionid']][_0x4c4c('0xb7')]]:this[_0x4c4c('0x13b')][this['actions'][_0x40d9c2['actionid']][_0x4c4c('0xb7')]]?this[_0x4c4c('0x13b')][this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]]['queue']]['_rr']||0x0:0x0;}this['queueBooked'][this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]][_0x4c4c('0xb7')]][_0x4c4c('0x144')]=this['queueBookedRR'][this[_0x4c4c('0xab')][_0x40d9c2[_0x4c4c('0x137')]][_0x4c4c('0xb7')]];for(var _0xef3535=0x0;_0xef3535=0x0;})['catch'](myreject(_0x2de0c7)));}}else{_0xb64f20[_0x4c4c('0x13c')](ami[_0x4c4c('0xb0')]({'action':_0x4c4c('0x15d'),'command':util['format'](_0x4c4c('0x15e'),_0x3b9692,!_[_0x4c4c('0x40')](config[_0x4c4c('0x160')][_0x1092d1])?_0x1092d1:'')})[_0x4c4c('0x3e')](function(_0x3c9488){return _0x3c9488['content']['indexOf'](_0x4c4c('0x163'))>=0x0;})['catch'](myreject(_0x2de0c7)));}Promise[_0x4c4c('0x164')](_0xb64f20)[_0x4c4c('0x3e')](function(_0x1a6760){var _0x53ea45=_[_0x4c4c('0x165')](_0x1a6760);if(_0x53ea45){return _0x593679(_0x53ea45);}else{_0x11bd99[_0x4c4c('0x41')]=_0x325386?_0x4c4c('0x166'):_0x4c4c('0x167');return _0x2de0c7(msgResponse(_0x4c4c('0x168'),_0x4c4c('0x157'),_0x4c4c('0x169')+_0x325386+'\x20'+_0x2ae9d2+_0x4c4c('0x16a')+util[_0x4c4c('0x9a')](_0x3b9692,{'showHidden':![],'depth':null})+_0x4c4c('0x16b')+_0x1092d1));}})[_0x4c4c('0xb3')](function(_0x51266a){return _0x2de0c7(msgResponse(_0x4c4c('0x155'),_0x4c4c('0x157'),JSON[_0x4c4c('0x4e')](_0x51266a)));});});};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x16c')]=function(_0x106b2a){var _0x292e17=this;return function(){switch(_0x106b2a['dialMethod']){case _0x4c4c('0x16d'):freeVariablesPredictive(_0x106b2a);_0x292e17['handlePower'](_0x106b2a,0x1);break;case'power':freeVariablesPredictive(_0x106b2a);_0x292e17['handlePower'](_0x106b2a,_0x106b2a[_0x4c4c('0x16e')]);break;case'predictive':_0x292e17[_0x4c4c('0x9')](_0x106b2a);break;case'booked':freeVariablesPredictive(_0x106b2a);_0x292e17[_0x4c4c('0x16f')](_0x106b2a,0x1);break;default:freeVariablesPredictive(_0x106b2a);logger[_0x4c4c('0x99')]('Queue',_0x106b2a['name'],_0x4c4c('0x170'));}};};Dialer['prototype'][_0x4c4c('0x171')]=function(_0x4c8a84){return Promise[_0x4c4c('0xbb')]()[_0x4c4c('0x3e')](cmHopper['handlePreviewRecallNotifications'](_0x4c8a84['id'],previewRecallmeReminderInterval))[_0x4c4c('0x3e')](function(_0x50ad01){for(var _0x1a3fdc=0x0;_0x1a3fdc<_0x50ad01[_0x4c4c('0x9b')];_0x1a3fdc++){var _0xdca1df=_0x50ad01[_0x1a3fdc]['Agent']['name'];if(_0xdca1df)io['to'](util[_0x4c4c('0x7e')](_0x4c4c('0x172'),_0xdca1df))[_0x4c4c('0xf4')](_0x4c4c('0x173'),{'hopper':_0x50ad01[_0x1a3fdc]});}})['catch'](function(){});};Dialer['prototype'][_0x4c4c('0x174')]=function(_0x4e844f){var _0x4ca317=this;return function(){_0x4ca317[_0x4c4c('0x175')](_0x4e844f);};};Dialer[_0x4c4c('0x1e')][_0x4c4c('0xb')]=function(_0x4c5e19){var _0x35d629=this;if(isNotPreview(_0x4c5e19[_0x4c4c('0x176')])){if(isVoiceQueueOutbound(_0x4c5e19[_0x4c4c('0x51')])&&isActive(_0x4c5e19[_0x4c4c('0x5e')])){_0x4c5e19['sendMessageOneNotActive']=!![];Promise[_0x4c4c('0xbb')]()[_0x4c4c('0x3e')](checkIsLoggedIn(_0x4c5e19,_0x4c5e19['loggedIn']))[_0x4c4c('0x3e')](checkIsActive(_0x4c5e19,_0x4c5e19[_0x4c4c('0x5e')]))['then'](checkInterval(_0x4c5e19))[_0x4c4c('0x3e')](_0x35d629[_0x4c4c('0x151')](_0x4c5e19))['then'](_0x35d629[_0x4c4c('0x154')](_0x4c5e19[_0x4c4c('0x177')],_0x4c5e19[_0x4c4c('0x178')],_0x4c5e19[_0x4c4c('0x43')],_0x4c5e19))[_0x4c4c('0x3e')](_0x35d629['checkIfTimeIntervals'](_0x4c5e19[_0x4c4c('0x47')],_0x4c5e19['dialTimezone'],_0x4c5e19[_0x4c4c('0x43')],_0x4c5e19))[_0x4c4c('0x3e')](_0x35d629[_0x4c4c('0x16c')](_0x4c5e19))[_0x4c4c('0xb3')](loggerCatchQueueSummary(_0x4c4c('0x179'),_0x4c5e19));}else{notSendMessagesQueue(_0x4c5e19);}}else{freeVariablesPredictive(_0x4c5e19);}};Dialer['prototype']['syncQueueSummaryComplete']=_['throttle'](function(){var _0x15f9d1=_[_0x4c4c('0x17a')](this[_0x4c4c('0x22')],function(_0x56e3f7){return _0x56e3f7['dialPreviewRecallmeReminder'];});var _0x2ff0d8=_[_0x4c4c('0x17a')](this[_0x4c4c('0x24')],function(_0x18c26f){return _0x18c26f[_0x4c4c('0x17b')]&&_0x18c26f[_0x4c4c('0xb1')]==='reachable';});if(_0x15f9d1[_0x4c4c('0x9b')]>0x0&&_0x2ff0d8[_0x4c4c('0x9b')]>0x0){return Promise[_0x4c4c('0xbb')]()[_0x4c4c('0x3e')](cmHopper['handlePreviewRecallNotifications'](_[_0x4c4c('0x17c')](_0x15f9d1,'id'),previewRecallmeReminderInterval,_[_0x4c4c('0x17c')](_0x2ff0d8,'id')))[_0x4c4c('0x3e')](function(_0x12d1e4){for(var _0x412aa6=0x0;_0x412aa6<_0x12d1e4[_0x4c4c('0x9b')];_0x412aa6++){var _0x56c097=_0x12d1e4[_0x412aa6][_0x4c4c('0x17d')][_0x4c4c('0x43')];if(_0x56c097)io['to'](util[_0x4c4c('0x7e')]('user:%s',_0x56c097))[_0x4c4c('0xf4')](_0x4c4c('0x173'),{'hopper':_0x12d1e4[_0x412aa6]});}})[_0x4c4c('0xb3')](function(_0x23e9ae){logger[_0x4c4c('0x99')](_0x4c4c('0x171'),_0x23e9ae);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4c4c('0x1e')]['syncCampaigns']=function(){var _0x345eb6=this;var _0x60fb2a;for(var _0x527f35 in this['campaigns']){if(typeof this[_0x4c4c('0x23')][_0x527f35]!=='undefined'){_0x60fb2a=this['campaigns'][_0x527f35];if(isCampaignIvr(_0x60fb2a[_0x4c4c('0x51')])&&isActive(_0x60fb2a[_0x4c4c('0x7b')])){_0x60fb2a['sendMessageOneNotActive']=!![];Promise[_0x4c4c('0xbb')]()['then'](checkIsActive(_0x60fb2a,_0x60fb2a[_0x4c4c('0x7b')]))[_0x4c4c('0x3e')](checkInterval(_0x60fb2a))[_0x4c4c('0x3e')](_0x345eb6[_0x4c4c('0x151')](_0x60fb2a))[_0x4c4c('0x3e')](_0x345eb6['checkIfTime'](_0x60fb2a[_0x4c4c('0x177')],_0x60fb2a[_0x4c4c('0x178')],_0x60fb2a[_0x4c4c('0x43')],_0x60fb2a))[_0x4c4c('0x3e')](_0x345eb6[_0x4c4c('0x156')](_0x60fb2a['Interval'],_0x60fb2a[_0x4c4c('0x178')],_0x60fb2a['name'],_0x60fb2a))[_0x4c4c('0x3e')](_0x345eb6['launchHandleIvr'](_0x60fb2a))[_0x4c4c('0xb3')](loggerCatchQueueSummary('[syncCampaigns]',_0x60fb2a));}else{notSendMessagesCampaign(_0x60fb2a);}}}};function getCallerIdRandom(_0x20a1bf,_0x1618a0){var _0x4c07e5;var _0x191523;var _0xb4ef20;if(_0x1618a0<=0x0){_0x1618a0=0x1;}_0x4c07e5=new RegExp('\x5cw{0,'+_0x1618a0+'}$');_0x191523=Math[_0x4c4c('0x17e')](0xa,_0x1618a0-0x1);_0xb4ef20=Math[_0x4c4c('0x17e')](0xa,_0x1618a0)-0x1;return util['format']('%s',_['replace'](_0x20a1bf,_0x4c07e5,_[_0x4c4c('0x17f')](_0x191523,_0xb4ef20)));}function extractCalleridName(_0x4ba110){var _0xc8d798=_0x4ba110[_0x4c4c('0x180')](/"(.*?)"/);return _0xc8d798?_0xc8d798[0x1]:_0x4ba110;}Dialer[_0x4c4c('0x1e')][_0x4c4c('0x181')]=function(_0xf68d0,_0x2ef42a){var _0x2faab4=this;var _0xdde858=uuid['v4']();this[_0x4c4c('0xab')][_0xdde858]=new Action(_0xf68d0,_0x2ef42a,_0xdde858);return new Promise(function(_0x195ec5,_0x3fd2a9){if(_[_0x4c4c('0x40')](_0xf68d0)&&typeof _0xf68d0!==_0x4c4c('0x182')){return _0x3fd2a9(msgResponse(_0x4c4c('0x183'),_0x4c4c('0x157'),_0x4c4c('0x184')));}if(_[_0x4c4c('0x40')](_0x2ef42a['phone'])||_0x2ef42a[_0x4c4c('0x185')]===null){return _0x3fd2a9(msgResponse('originate',_0x4c4c('0x157'),_0x4c4c('0x186')));}var _0x1850bf={'XMD-CALLERID':_0x2faab4[_0x4c4c('0xab')][_0xdde858][_0x4c4c('0x187')](),'XMD-AGI':_0xf68d0[_0x4c4c('0x112')]?util[_0x4c4c('0x7e')](_0x4c4c('0x188'),ipAgi,_0xf68d0['dialQueueProject']):_0x4c4c('0x189'),'XMD-AGIAFTER':_0xf68d0[_0x4c4c('0x11a')]?util['format'](_0x4c4c('0x188'),ipAgi,_0xf68d0['dialQueueProject2']):_0x4c4c('0x189'),'XMD-QUEUE':_0xf68d0[_0x4c4c('0x51')]===_0x4c4c('0x52')?util[_0x4c4c('0x7e')](_0x4c4c('0x18a'),_0xf68d0[_0x4c4c('0x43')],_0xf68d0[_0x4c4c('0x18b')]||'',_0xf68d0[_0x4c4c('0x11b')]?'c':'',_0xf68d0[_0x4c4c('0x125')]||0x3):_0x4c4c('0x189'),'XMD-CONTACTID':_0x2ef42a[_0x4c4c('0xd7')],'XMD-CDRTYPE':_0x4c4c('0x18c'),'CALLERID(all)':_0x2faab4[_0x4c4c('0xab')][_0xdde858][_0x4c4c('0x187')](),'XMD-AMD':_0xf68d0['dialAMDActive']?_0x4c4c('0x18d'):_0x4c4c('0x189'),'XMD-DESTINATION':_0x4c4c('0xe7')};if(_0xf68d0[_0x4c4c('0xef')]){_0x1850bf[_0x4c4c('0x18e')]=_0xf68d0['dialAMDInitialSilence']||0x9c4;_0x1850bf[_0x4c4c('0x18f')]=_0xf68d0['dialAMDGreeting']||0x5dc;_0x1850bf[_0x4c4c('0x190')]=_0xf68d0[_0x4c4c('0x191')]||0x320;_0x1850bf[_0x4c4c('0x192')]=_0xf68d0[_0x4c4c('0x193')]||0x1388;_0x1850bf['XMD-AMDMINWORDLENGTH']=_0xf68d0[_0x4c4c('0x194')]||0x64;_0x1850bf[_0x4c4c('0x195')]=_0xf68d0[_0x4c4c('0x196')]||0x32;_0x1850bf['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0xf68d0[_0x4c4c('0x197')]||0x3;_0x1850bf[_0x4c4c('0x198')]=_0xf68d0[_0x4c4c('0x199')]||0x100;_0x1850bf['XMD-AMDMAXIMUMWORDLENGTH']=_0xf68d0['dialAMDMaximumWordLength']||0x1388;}if(_0xf68d0['type']===_0x4c4c('0x52')){_0x1850bf[_0x4c4c('0x19a')]=_0x2ef42a['VoiceQueueId'];}else{_0x1850bf[_0x4c4c('0x19b')]=_0x2ef42a[_0x4c4c('0x104')];}for(var _0x8eb750 in _0x2ef42a[_0x4c4c('0x19c')]){if(typeof _0x2ef42a[_0x4c4c('0x19c')][_0x8eb750]!==_0x4c4c('0xae')){if(isNotNull(_0x2ef42a[_0x4c4c('0x19c')][_0x8eb750])&&_0x8eb750!=='id'&&_0x8eb750!==_0x4c4c('0x19d')&&_0x8eb750!=='createdAt'&&_0x8eb750!=='updatedAt'){_0x1850bf[util[_0x4c4c('0x7e')]('%s%s','XMD-',_[_0x4c4c('0x19e')](_0x8eb750))]=_0x2ef42a[_0x4c4c('0x19c')][_0x8eb750];}}}var _0x25b319=_0x2faab4[_0x4c4c('0xde')](_0xf68d0[_0x4c4c('0x7a')])?getCallerId(_0xf68d0['Trunk'][_0x4c4c('0x7c')],_0xf68d0[_0x4c4c('0x5f')],_0xf68d0[_0x4c4c('0x19f')]>0x0?getCallerIdRandom(_0xf68d0['dialOriginateCallerIdNumber'],_0xf68d0[_0x4c4c('0x19f')]):_0xf68d0[_0x4c4c('0x60')]):getCallerId(_[_0x4c4c('0xe3')](_0xf68d0[_0x4c4c('0x1a0')])?_0xf68d0[_0x4c4c('0x7a')][_0x4c4c('0x7c')]:_0xf68d0['TrunkBackup'][_0x4c4c('0x7c')],_0xf68d0[_0x4c4c('0x5f')],_0xf68d0['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0xf68d0[_0x4c4c('0x60')],_0xf68d0[_0x4c4c('0x19f')]):_0xf68d0[_0x4c4c('0x60')]);if(_0x25b319){_0x1850bf[_0x4c4c('0x1a1')]=_0x2faab4[_0x4c4c('0xab')][_0xdde858][_0x4c4c('0x1a2')]=extractCalleridName(_0x25b319);_0x1850bf['XMD-ORIGINATECALLERIDNUM']=_0x2ef42a[_0x4c4c('0x185')];}_0xf68d0['variables']=_0x1850bf;return ami[_0x4c4c('0xb0')]({'actionid':_0xdde858,'action':_0x4c4c('0x183'),'channel':_0x2faab4[_0x4c4c('0xde')](_0xf68d0[_0x4c4c('0x7a')])?util['format'](_0x4c4c('0x1a3'),_0xf68d0[_0x4c4c('0x7a')][_0x4c4c('0x43')],isNotNull(_0xf68d0[_0x4c4c('0x1a4')])?_0xf68d0[_0x4c4c('0x1a4')]['trim']()||'':'',_0xf68d0['dialCutDigit']>0x0?_0x2ef42a[_0x4c4c('0x185')][_0x4c4c('0x1a5')](_0xf68d0[_0x4c4c('0x1a6')]):_0x2ef42a[_0x4c4c('0x185')]):util[_0x4c4c('0x7e')](_0x4c4c('0x1a3'),_[_0x4c4c('0xe3')](_0xf68d0['TrunkBackup'])?_0xf68d0[_0x4c4c('0x7a')][_0x4c4c('0x43')]:_0xf68d0[_0x4c4c('0x1a0')]['name'],isNotNull(_0xf68d0[_0x4c4c('0x1a4')])?_0xf68d0['dialPrefix'][_0x4c4c('0x1a7')]()||'':'',_0xf68d0[_0x4c4c('0x1a6')]>0x0?_0x2ef42a[_0x4c4c('0x185')]['substring'](_0xf68d0[_0x4c4c('0x1a6')]):_0x2ef42a[_0x4c4c('0x185')]),'callerid':_0x25b319,'Exten':_0x4c4c('0xe7'),'Context':'from-sip','Priority':'1','variable':_0x1850bf,'timeout':(_0xf68d0['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xdde858})[_0x4c4c('0x3e')](function(_0x283f11){return _0x195ec5(_0x283f11);})[_0x4c4c('0xb3')](function(_0x2b0649){_0xf68d0['outboundOriginateFailureCallsDay']+=0x1;var _0x123c3e=new History(_0x2faab4[_0x4c4c('0xab')][_0xdde858]);logger[_0x4c4c('0x99')](util[_0x4c4c('0x7e')](_0x4c4c('0x1a8'),JSON[_0x4c4c('0x4e')](_0x2b0649)));_0x123c3e[_0x4c4c('0xe9')]=0xe;_0x123c3e[_0x4c4c('0xa8')]='OriginateError';_0x123c3e['starttime']=moment()[_0x4c4c('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x123c3e['endtime']=_0x123c3e[_0x4c4c('0xa9')];_0x2faab4[_0x4c4c('0xd1')](_0x123c3e)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x1a9')));_0x2faab4[_0x4c4c('0xd0')](_0x123c3e)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x1a9')))[_0x4c4c('0x20')](function(){delete _0x2faab4['actions'][_0xdde858];return _0x3fd2a9(msgResponse('originate',_0x4c4c('0x4d'),'originate\x20action\x20Error'));});});});};Dialer['prototype'][_0x4c4c('0x32')]=function(_0x57ae59){var _0x531f53=this['actions'][_0x57ae59[_0x4c4c('0x137')]];if(_0x531f53){delete this['actions'][_0x57ae59[_0x4c4c('0x137')]];_0x531f53[_0x4c4c('0x124')]=moment()['format'](_0x4c4c('0x103'));var _0x18d680=_0x531f53['type']===_0x4c4c('0xb5')?this[_0x4c4c('0x23')][_0x531f53[_0x4c4c('0xb7')]]:this[_0x4c4c('0x22')][_0x531f53[_0x4c4c('0x1aa')]()];if(!this['isSuccess'](_0x57ae59['response'])){this[_0x4c4c('0xb6')](_0x18d680);return this[_0x4c4c('0x1ab')](_0x531f53,_0x18d680,_0x57ae59)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x1ac')));}this[_0x4c4c('0x28')][_0x57ae59[_0x4c4c('0x107')]]=_0x531f53;}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x1ad')]=function(_0x522949,_0x1b07e3,_0x450ec0){var _0x17adf2=new History(_0x1b07e3);if(_0x17adf2[_0x4c4c('0xf6')]+_0x17adf2['countcongestionretry']+_0x17adf2[_0x4c4c('0xf7')]+_0x17adf2[_0x4c4c('0xf8')]+_0x17adf2['countdropretry']+_0x17adf2[_0x4c4c('0xfa')]+_0x17adf2[_0x4c4c('0xf2')]+_0x17adf2[_0x4c4c('0x10c')]>=_0x450ec0['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x522949){case 0x3:if(_0x17adf2['countnoanswerretry']>=_0x450ec0[_0x4c4c('0x1ae')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x17adf2['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x4c4c('0x100')](_0x450ec0[_0x4c4c('0x1af')],'minutes')[_0x4c4c('0x7e')](_0x4c4c('0x103')),'ContactId':_0x17adf2[_0x4c4c('0xd7')],'ListId':_0x17adf2[_0x4c4c('0xd8')],'VoiceQueueId':_0x17adf2['VoiceQueueId']||undefined,'CampaignId':_0x17adf2[_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x1b0')));break;case 0x5:if(_0x17adf2['countbusyretry']>=_0x450ec0['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x17adf2[_0x4c4c('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x450ec0[_0x4c4c('0x1b1')],_0x4c4c('0x102'))[_0x4c4c('0x7e')](_0x4c4c('0x103')),'ContactId':_0x17adf2[_0x4c4c('0xd7')],'ListId':_0x17adf2[_0x4c4c('0xd8')],'VoiceQueueId':_0x17adf2[_0x4c4c('0x10e')]||undefined,'CampaignId':_0x17adf2[_0x4c4c('0x104')]||undefined})['catch'](loggerCatch(_0x4c4c('0x1b2')));break;case 0x8:if(_0x17adf2[_0x4c4c('0x10b')]>=_0x450ec0['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x17adf2[_0x4c4c('0x10b')]+=0x1,'scheduledat':moment()[_0x4c4c('0x100')](_0x450ec0['dialCongestionRetryFrequency'],_0x4c4c('0x102'))[_0x4c4c('0x7e')](_0x4c4c('0x103')),'ContactId':_0x17adf2[_0x4c4c('0xd7')],'ListId':_0x17adf2[_0x4c4c('0xd8')],'VoiceQueueId':_0x17adf2['VoiceQueueId']||undefined,'CampaignId':_0x17adf2['CampaignId']||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x1b3')));break;case 0x0:if(_0x17adf2['countnosuchnumberretry']>=_0x450ec0[_0x4c4c('0x1b4')]-0x1){return!![];}else{this[_0x4c4c('0xc8')]({'active':![],'countnosuchnumberretry':_0x17adf2[_0x4c4c('0xf8')]+=0x1,'scheduledat':moment()[_0x4c4c('0x100')](_0x450ec0['dialNoSuchNumberRetryFrequency'],_0x4c4c('0x102'))[_0x4c4c('0x7e')](_0x4c4c('0x103')),'ContactId':_0x17adf2[_0x4c4c('0xd7')],'ListId':_0x17adf2['ListId'],'VoiceQueueId':_0x17adf2['VoiceQueueId']||undefined,'CampaignId':_0x17adf2[_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x1b5')));}break;case 0xa:if(_0x17adf2[_0x4c4c('0xf9')]>=_0x450ec0[_0x4c4c('0x12a')]-0x1){return!![];}this[_0x4c4c('0xc8')]({'active':![],'countdropretry':_0x17adf2[_0x4c4c('0xf9')]+=0x1,'scheduledat':moment()[_0x4c4c('0x100')](_0x450ec0['dialDropRetryFrequency'],_0x4c4c('0x102'))[_0x4c4c('0x7e')](_0x4c4c('0x103')),'ContactId':_0x17adf2[_0x4c4c('0xd7')],'ListId':_0x17adf2['ListId'],'VoiceQueueId':_0x17adf2[_0x4c4c('0x10e')]||undefined,'CampaignId':_0x17adf2[_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x12c')));break;case 0xb:if(_0x17adf2['countabandonedretry']>=_0x450ec0[_0x4c4c('0x134')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x17adf2[_0x4c4c('0xfa')]+=0x1,'scheduledat':moment()[_0x4c4c('0x100')](_0x450ec0['dialAbandonedRetryFrequency'],'minutes')[_0x4c4c('0x7e')](_0x4c4c('0x103')),'ContactId':_0x17adf2[_0x4c4c('0xd7')],'ListId':_0x17adf2[_0x4c4c('0xd8')],'VoiceQueueId':_0x17adf2[_0x4c4c('0x10e')]||undefined,'CampaignId':_0x17adf2[_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x17adf2['countmachineretry']>=_0x450ec0[_0x4c4c('0xfd')]-0x1){return!![];}this[_0x4c4c('0xc8')]({'active':![],'countmachineretry':_0x17adf2[_0x4c4c('0xf2')]+=0x1,'scheduledat':moment()[_0x4c4c('0x100')](_0x450ec0[_0x4c4c('0x101')],_0x4c4c('0x102'))[_0x4c4c('0x7e')](_0x4c4c('0x103')),'ContactId':_0x17adf2[_0x4c4c('0xd7')],'ListId':_0x17adf2[_0x4c4c('0xd8')],'VoiceQueueId':_0x17adf2[_0x4c4c('0x10e')]||undefined,'CampaignId':_0x17adf2['CampaignId']||undefined})[_0x4c4c('0xb3')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x17adf2[_0x4c4c('0x10c')]>=_0x450ec0[_0x4c4c('0x1b6')]-0x1){return!![];}this[_0x4c4c('0xc8')]({'active':![],'countagentrejectretry':_0x17adf2[_0x4c4c('0x10c')]+=0x1,'scheduledat':moment()[_0x4c4c('0x100')](_0x450ec0['dialAgentRejectRetryFrequency'],_0x4c4c('0x102'))[_0x4c4c('0x7e')](_0x4c4c('0x103')),'ContactId':_0x17adf2[_0x4c4c('0xd7')],'ListId':_0x17adf2[_0x4c4c('0xd8')],'VoiceQueueId':_0x17adf2[_0x4c4c('0x10e')]||undefined,'CampaignId':_0x17adf2[_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x1b7')));break;default:return!![];}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x1ab')]=function(_0x48e02d,_0x18cc17,_0x101b0f){var _0x2707d9=this;var _0x1b339f=new History(_0x48e02d);var _0x4a4579=![];var _0x1c9932;var _0xf04c18;return new Promise(function(_0x38d93e,_0x6bd8d0){if(_[_0x4c4c('0x40')](_0x18cc17)&&typeof _0x18cc17!==_0x4c4c('0x182')){return _0x6bd8d0(msgResponse(_0x4c4c('0x1b8'),_0x4c4c('0x157'),_0x4c4c('0x1b9')));}if(_[_0x4c4c('0x40')](_0x101b0f)&&typeof _0x101b0f!=='object'){return _0x6bd8d0(msgResponse(_0x4c4c('0x1b8'),_0x4c4c('0x157'),_0x4c4c('0x1ba')));}_0x2707d9[_0x4c4c('0xbf')](_0x1b339f,_0x101b0f['reason'],_0x18cc17)[_0x4c4c('0x3e')](function(_0x357a30){if(_0x357a30['additional']==0x1)_0x4a4579=!![];switch(_0x101b0f[_0x4c4c('0x117')]){case'0':_0x18cc17[_0x4c4c('0x1bb')]+=0x1;_0x1b339f[_0x4c4c('0xe9')]=0x0;_0x1b339f['statedesc']=_0x4c4c('0x1bc');_0x1b339f[_0x4c4c('0xf8')]+=0x1;_0x1b339f[_0x4c4c('0xf3')]+=0x1;ami[_0x4c4c('0xf4')]('custom:agentnosuchnumber',ut[_0x4c4c('0xed')](_0x48e02d,_0x4c4c('0x1bd')));_0x1c9932=_0x18cc17['dialNoSuchNumberRetryFrequency'];_0xf04c18=_0x18cc17[_0x4c4c('0x133')];_0x2707d9[_0x4c4c('0xd1')](_0x1b339f)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xf5')));if(_0x2707d9[_0x4c4c('0x1ad')](0x0,_0x48e02d,_0x18cc17)&&!_0x4a4579){if(_0x1b339f[_0x4c4c('0xf8')]>=_0x18cc17[_0x4c4c('0x1b4')]){_0x2707d9['createStateFinal'](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1be'));}else{_0x2707d9[_0x4c4c('0xfc')](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1be'));}}break;case'3':_0x18cc17[_0x4c4c('0x1bf')]+=0x1;_0x1b339f[_0x4c4c('0xe9')]=0x3;_0x1b339f[_0x4c4c('0xa8')]=_0x4c4c('0x1c0');_0x1b339f[_0x4c4c('0xf7')]+=0x1;_0x1b339f['countglobal']+=0x1;var _0x8aa3fb=ut['buildNoAnswerEventPayload'](_0x48e02d,_0x18cc17);ami[_0x4c4c('0xf4')](_0x4c4c('0x1c1'),_0x8aa3fb);_0x1c9932=_0x18cc17[_0x4c4c('0x1af')];_0xf04c18=_0x18cc17[_0x4c4c('0x133')];_0x2707d9[_0x4c4c('0xd1')](_0x1b339f)['catch'](loggerCatch(_0x4c4c('0x1c2')));if(_0x2707d9[_0x4c4c('0x1ad')](0x3,_0x48e02d,_0x18cc17)&&!_0x4a4579){if(_0x1b339f[_0x4c4c('0xf7')]>=_0x18cc17[_0x4c4c('0x1ae')]){_0x2707d9[_0x4c4c('0xfe')](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1c3'));}else{_0x2707d9['stateGlobal'](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1c3'));}}break;case'5':_0x18cc17[_0x4c4c('0x64')]+=0x1;_0x1b339f[_0x4c4c('0xe9')]=0x5;_0x1b339f['statedesc']='Busy';_0x1b339f[_0x4c4c('0xf6')]+=0x1;_0x1b339f[_0x4c4c('0xf3')]+=0x1;ami[_0x4c4c('0xf4')](_0x4c4c('0x1c4'),ut['buildObj'](_0x48e02d,_0x4c4c('0x1c5')));_0x1c9932=_0x18cc17[_0x4c4c('0x1b1')];_0xf04c18=_0x18cc17[_0x4c4c('0x133')];_0x2707d9[_0x4c4c('0xd1')](_0x1b339f)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x1c6')));if(_0x2707d9[_0x4c4c('0x1ad')](0x5,_0x48e02d,_0x18cc17)&&!_0x4a4579){if(_0x1b339f[_0x4c4c('0xf6')]>=_0x18cc17[_0x4c4c('0x1c7')]){_0x2707d9[_0x4c4c('0xfe')](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1c8'));}else{_0x2707d9[_0x4c4c('0xfc')](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1c8'));}}break;case'8':_0x18cc17['outboundCongestionCallsDay']+=0x1;_0x1b339f[_0x4c4c('0xe9')]=0x8;_0x1b339f[_0x4c4c('0xa8')]=_0x4c4c('0x1c9');_0x1b339f[_0x4c4c('0x10b')]+=0x1;_0x1b339f[_0x4c4c('0xf3')]+=0x1;_0x1c9932=_0x18cc17['dialCongestionRetryFrequency'];_0xf04c18=_0x18cc17['callAdditionalPhoneAfterMin'];ami[_0x4c4c('0xf4')](_0x4c4c('0x1ca'),ut[_0x4c4c('0xed')](_0x48e02d,'congestion'));_0x2707d9[_0x4c4c('0xd1')](_0x1b339f)[_0x4c4c('0xb3')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x2707d9[_0x4c4c('0x1ad')](0x8,_0x48e02d,_0x18cc17)&&!_0x4a4579){if(_0x1b339f[_0x4c4c('0x10b')]>=_0x18cc17[_0x4c4c('0x1cb')]){_0x2707d9[_0x4c4c('0xfe')](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1cc'));}else{_0x2707d9[_0x4c4c('0xfc')](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1cc'));}}break;case'11':_0x18cc17[_0x4c4c('0x1cd')]+=0x1;_0x1b339f[_0x4c4c('0xe9')]=0xb;_0x1b339f[_0x4c4c('0xa8')]=_0x4c4c('0x130');_0x1b339f[_0x4c4c('0xfa')]+=0x1;_0x1b339f[_0x4c4c('0xf3')]+=0x1;_0x1c9932=_0x18cc17[_0x4c4c('0x132')];_0xf04c18=_0x18cc17[_0x4c4c('0x133')];_0x2707d9['createHistory'](_0x1b339f)[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x135')));if(_0x2707d9[_0x4c4c('0x1ad')](0xb,_0x48e02d,_0x18cc17)&&!_0x4a4579){if(_0x1b339f[_0x4c4c('0xfa')]>=_0x18cc17[_0x4c4c('0x134')]){_0x2707d9[_0x4c4c('0xfe')](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1ce'));}else{_0x2707d9[_0x4c4c('0xfc')](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1ce'));}}break;case'20':_0x18cc17[_0x4c4c('0x6a')]+=0x1;_0x1b339f['state']=0x14;_0x1b339f[_0x4c4c('0xa8')]=_0x4c4c('0x1cf');_0x1b339f[_0x4c4c('0x10c')]+=0x1;_0x1b339f[_0x4c4c('0xf3')]+=0x1;_0x1c9932=_0x18cc17[_0x4c4c('0x1d0')];_0xf04c18=_0x18cc17[_0x4c4c('0x133')];ami[_0x4c4c('0xf4')](_0x4c4c('0x1d1'),ut[_0x4c4c('0xed')](_0x48e02d,'agentreject'));_0x2707d9['createHistory'](_0x1b339f)[_0x4c4c('0xb3')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2707d9[_0x4c4c('0x1ad')](0x14,_0x48e02d,_0x18cc17)&&!_0x4a4579){if(_0x1b339f['countagentrejectretry']>=_0x18cc17[_0x4c4c('0x1b6')]){_0x2707d9[_0x4c4c('0xfe')](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1d2'));}else{_0x2707d9[_0x4c4c('0xfc')](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x4c4c('0x1d2'));}}break;default:_0x18cc17[_0x4c4c('0x6b')]+=0x1;_0x1b339f[_0x4c4c('0xe9')]=0xc;_0x1b339f[_0x4c4c('0xa8')]=_0x101b0f[_0x4c4c('0x117')];_0x1c9932=_0x18cc17[_0x4c4c('0x1d0')];_0xf04c18=_0x18cc17['callAdditionalPhoneAfterMin'];_0x2707d9[_0x4c4c('0xd1')](_0x1b339f)[_0x4c4c('0xb3')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x2707d9[_0x4c4c('0x1ad')](_0x101b0f[_0x4c4c('0x117')],_0x48e02d,_0x18cc17)&&!_0x4a4579){if(_0x1b339f[_0x4c4c('0xf6')]+_0x1b339f[_0x4c4c('0x10b')]+_0x1b339f[_0x4c4c('0xf7')]+_0x1b339f[_0x4c4c('0xf8')]+_0x1b339f[_0x4c4c('0xf9')]+_0x1b339f[_0x4c4c('0xfa')]+_0x1b339f[_0x4c4c('0xf2')]+_0x1b339f[_0x4c4c('0x10c')]>=_0x18cc17[_0x4c4c('0xfb')]){_0x2707d9[_0x4c4c('0xfc')](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x101b0f[_0x4c4c('0x117')]);}else{_0x2707d9['createStateFinal'](_0x1b339f,_0x38d93e,_0x6bd8d0,_0x101b0f[_0x4c4c('0x117')]);}}}})[_0x4c4c('0x3e')](function(){if(_0x4a4579){_0x2707d9[_0x4c4c('0xc1')](_0x1b339f,_0x1c9932,_0xf04c18)[_0x4c4c('0x3e')](function(){return _0x38d93e(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x294b49,_0x9e7bd1,_0x4e408c,_0xa48b70){var _0x584bd3=new Final(_0x294b49);_0x584bd3[_0x4c4c('0xe9')]=0xf;_0x584bd3['statedesc']=_0x4c4c('0x1d3');this[_0x4c4c('0xfe')](_0x584bd3,_0x9e7bd1,_0x4e408c,_0xa48b70);};Dialer['prototype'][_0x4c4c('0xfe')]=function(_0x343f1a,_0x38615b,_0x2dfe1b,_0x32998d){this[_0x4c4c('0xd0')](_0x343f1a)[_0x4c4c('0x3e')](function(){return _0x38615b(msgResponse(_0x4c4c('0x1b8'),'Success',_0x32998d));})[_0x4c4c('0xb3')](function(){return _0x2dfe1b(msgResponse(_0x4c4c('0x1d4'),_0x4c4c('0x157'),_0x4c4c('0x1d5')));});};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x9')]=function(_0x5298fd){var _0x57721e=_0x5298fd[_0x4c4c('0x1d6')]/0x64;var _0x56ed54=_0x5298fd[_0x4c4c('0x67')]/(_0x5298fd['outboundDropCallsDayTimeout']+_0x5298fd[_0x4c4c('0x62')]);var _0x508f7e=Math[_0x4c4c('0x1d7')](_0x5298fd['predictiveIntervalAvailable']*(_0x5298fd[_0x4c4c('0x1d8')]/0x64));var _0x195ebc=Math[_0x4c4c('0x1d7')](_0x5298fd['predictiveIntervalAvailable']*(_0x5298fd[_0x4c4c('0x1d9')]/0x64));var _0x29524b=_0x5298fd[_0x4c4c('0xa2')]+_0x5298fd[_0x4c4c('0x59')];var _0x354098=Math['floor'](_0x5298fd[_0x4c4c('0x8d')]*_0x5298fd[_0x4c4c('0x1da')]*_0x5298fd[_0x4c4c('0x73')]*_0x5298fd[_0x4c4c('0x1db')]);if(_[_0x4c4c('0x40')](_0x5298fd[_0x4c4c('0x2b')])){if(!_[_0x4c4c('0x40')](_0x5298fd[_0x4c4c('0x2a')])){_0x5298fd['startPredictive']=undefined;loggerPredictive[_0x4c4c('0x99')]('[startMethodPredictive][StartProgressive]',_0x4c4c('0x1dc'));}if(!_[_0x4c4c('0x40')](_0x5298fd[_0x4c4c('0x93')])){loggerPredictive[_0x4c4c('0x99')](_0x4c4c('0x1dd'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5298fd[_0x4c4c('0x93')]);_0x5298fd[_0x4c4c('0x93')]=undefined;}_0x5298fd[_0x4c4c('0x2b')]=moment()['format'](_0x4c4c('0x103'));loggerPredictive[_0x4c4c('0x81')](_0x5298fd[_0x4c4c('0x43')],_0x4c4c('0x1de'),_0x5298fd['startProgressive']);this['handlePower'](_0x5298fd,0x1);}else if(ifInterval(_0x5298fd['dialPredictiveInterval'],_0x5298fd['startProgressive'])){this[_0x4c4c('0x16f')](_0x5298fd,0x1);loggerPredictiveCalls[_0x4c4c('0x81')](_0x4c4c('0x1df'),_0x5298fd[_0x4c4c('0x2b')],_0x5298fd[_0x4c4c('0x43')]);_0x5298fd['erlangCalls']=0x0;_0x5298fd[_0x4c4c('0x72')]=0x0;}else if(_0x57721e<_0x56ed54&&_0x5298fd['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x5298fd);loggerPredictive[_0x4c4c('0x81')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x4c4c('0x1e0'),_0x56ed54,_0x4c4c('0x2b'),_0x5298fd[_0x4c4c('0x43')]);}else if(_0x354098<_0x5298fd[_0x4c4c('0x72')]&&_0x5298fd[_0x4c4c('0x1e1')]===_0x4c4c('0x1e2')){freeVariablesPredictive(_0x5298fd);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x1e3'),_0x4c4c('0x1e4'),_0x354098,_0x4c4c('0x1e5'),_0x5298fd[_0x4c4c('0x72')],'startProgressive',_0x5298fd[_0x4c4c('0x43')]);}else if(!ifInterval(_0x5298fd[_0x4c4c('0x1e6')],_0x5298fd[_0x4c4c('0x2b')])&&_[_0x4c4c('0x40')](_0x5298fd[_0x4c4c('0x2a')])&&!_[_0x4c4c('0x40')](_0x5298fd[_0x4c4c('0x2b')])){_0x5298fd[_0x4c4c('0x2a')]=moment()[_0x4c4c('0x7e')](_0x4c4c('0x103'));loggerPredictive[_0x4c4c('0x81')](_0x5298fd[_0x4c4c('0x43')],'started\x20in\x20predictive\x20at',_0x5298fd[_0x4c4c('0x2a')]);this[_0x4c4c('0xc5')](_0x5298fd['dialPredictiveInterval'])[_0x4c4c('0x3e')](this['getDataPredictive'](_0x5298fd))[_0x4c4c('0x3e')](mergeDataErlangB(_0x5298fd))['then'](this[_0x4c4c('0x1e7')](_0x5298fd))[_0x4c4c('0xb3')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5298fd));}else if(!ifInterval(_0x5298fd[_0x4c4c('0x1e6')],_0x5298fd[_0x4c4c('0x2a')])){_0x5298fd[_0x4c4c('0x72')]=0x0;_0x5298fd[_0x4c4c('0x2a')]=moment()[_0x4c4c('0x7e')](_0x4c4c('0x103'));loggerPredictive['info'](_0x5298fd['name'],_0x4c4c('0x1e8'),_0x5298fd[_0x4c4c('0x2a')]);clearInterval(_0x5298fd[_0x4c4c('0x93')]);_0x5298fd[_0x4c4c('0x93')]=undefined;this['averageHandleTime'](_0x5298fd['dialPredictiveInterval'])['then'](this[_0x4c4c('0x1e9')](_0x5298fd))[_0x4c4c('0x3e')](mergeDataErlangB(_0x5298fd))[_0x4c4c('0x3e')](this[_0x4c4c('0x1e7')](_0x5298fd))[_0x4c4c('0xb3')](loggerCatchPredictive(_0x4c4c('0x1ea'),_0x5298fd));}else if(_0x5298fd[_0x4c4c('0x75')]&&_0x29524b<_0x5298fd[_0x4c4c('0x75')]-_0x195ebc){freeVariablesPredictive(_0x5298fd);loggerPredictive[_0x4c4c('0x81')](_0x5298fd['name'],_0x4c4c('0x1eb'),_0x29524b,_0x4c4c('0x1ec'),_0x5298fd[_0x4c4c('0x75')],'-',_0x195ebc,'=',_0x5298fd[_0x4c4c('0x75')]-_0x195ebc,')');}else if(_0x5298fd['predictiveIntervalAvailable']&&_0x29524b>_0x5298fd[_0x4c4c('0x75')]+_0x508f7e){freeVariablesPredictive(_0x5298fd);loggerPredictive[_0x4c4c('0x81')](_0x5298fd[_0x4c4c('0x43')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x29524b,')\x20are\x20more\x20than\x20threshold\x20(',_0x5298fd[_0x4c4c('0x75')],'+',_0x508f7e,'=',_0x5298fd[_0x4c4c('0x75')]+_0x508f7e,')');}};Dialer['prototype'][_0x4c4c('0x1e9')]=function(_0x4d2022){var _0x3db570=this;return function(_0x20e70e){return new Promise(function(_0x3ed4e9,_0xf88466){_[_0x4c4c('0x13d')](_0x4d2022,_0x20e70e[0x0]);if(checkGetDataPredictive(_0x20e70e[0x0])){var _0x10d945=_0x4d2022[_0x4c4c('0x75')]=_0x4d2022['talking']+_0x4d2022['available'];var _0x4bf6d9=_0x4d2022[_0x4c4c('0x1e6')]*0x3c;var _0x468b81=_0x20e70e[0x0][_0x4c4c('0x6e')]+_0x20e70e[0x0][_0x4c4c('0x6d')];var _0x28c784=(_0x20e70e[0x0][_0x4c4c('0x6c')]+_0x20e70e[0x0][_0x4c4c('0x70')]+_0x20e70e[0x0][_0x4c4c('0x6f')])/_0x20e70e[0x0][_0x4c4c('0x76')];_0x4d2022[_0x4c4c('0x73')]=_0x28c784>0x0?_0x28c784:0x1;switch(_0x4d2022[_0x4c4c('0x1e1')]){case _0x4c4c('0x1e2'):var _0x39a4c8=_0x4d2022[_0x4c4c('0x1d6')]/0x64;return _0x3db570['abandonmentRate'](_0x10d945,_0x4bf6d9,_0x468b81,_0x28c784,_0x39a4c8)[_0x4c4c('0x3e')](function(_0x7d05bb){return _0x3ed4e9(_0x7d05bb);});case _0x4c4c('0x1ed'):var _0x17ebae=_0x4d2022[_0x4c4c('0x1d6')]/0x64;return _0x3db570[_0x4c4c('0x1ee')](_0x10d945,_0x4bf6d9,_0x468b81,_0x28c784,_0x17ebae)['then'](function(_0x216634){return _0x3ed4e9(_0x216634);});default:return _0xf88466(msgResponse(_0x4c4c('0x1ef'),_0x4c4c('0x157'),_0x4c4c('0x1f0')));}}else{return _0xf88466(msgResponse(_0x4c4c('0x1ef'),'Failure',_0x4c4c('0x1f1')));}});};};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x1f2')]=function(_0x4319b3){var _0x3d2414=this;return function(_0x590c17){return new Promise(function(_0x5a9a60,_0x263331){_[_0x4c4c('0x13d')](_0x4319b3,_0x590c17[0x0]);if(checkGetDataPredictive(_0x590c17[0x0])){loggerPredictive[_0x4c4c('0x81')](JSON[_0x4c4c('0x4e')](_0x590c17[0x0]));if(_0x4319b3[_0x4c4c('0x1e1')]===_0x4c4c('0x1e2')){return _0x3d2414[_0x4c4c('0xcf')](_0x4319b3['id'])['then'](function(_0x545bae){var _0x2b209c=_0x4319b3[_0x4c4c('0x55')]-_0x545bae[0x0][_0x4c4c('0x1f3')];var _0x43da93=_0x4319b3[_0x4c4c('0x1e6')]*0x3c;var _0x203d1c=_0x590c17[0x0][_0x4c4c('0x6e')]+_0x590c17[0x0][_0x4c4c('0x6d')];var _0x37bf29=(_0x590c17[0x0][_0x4c4c('0x6c')]+_0x590c17[0x0][_0x4c4c('0x70')]+_0x590c17[0x0][_0x4c4c('0x6f')])/_0x590c17[0x0][_0x4c4c('0x76')];var _0x2eee97=_0x4319b3[_0x4c4c('0x1d6')]/0x64;_0x4319b3[_0x4c4c('0x74')]=_0x545bae[0x0]['outboundQueuePauses']||0x0;_0x4319b3['predictiveIntervalHitRate']=_0x37bf29>0x0?_0x37bf29:0x1;return _0x3d2414[_0x4c4c('0x1f4')](_0x2b209c,_0x43da93,_0x203d1c,_0x37bf29,_0x2eee97);})['then'](function(_0x5e3721){return _0x5a9a60(_0x5e3721);})[_0x4c4c('0xb3')](function(_0x4772c7){return _0x263331(msgResponse(_0x4c4c('0x1f5'),_0x4c4c('0x157'),JSON[_0x4c4c('0x4e')](_0x4772c7)));});}if(_0x4319b3['dialPredictiveOptimization']===_0x4c4c('0x1ed')){return _0x3d2414[_0x4c4c('0xcf')](_0x4319b3['id'])[_0x4c4c('0x3e')](function(_0x282e69){var _0xa4df92=_0x4319b3[_0x4c4c('0x55')]-_0x282e69[0x0][_0x4c4c('0x1f3')];var _0x39199d=_0x4319b3['dialPredictiveInterval']*0x3c;var _0x342305=_0x590c17[0x0][_0x4c4c('0x6e')]+_0x590c17[0x0]['predictiveIntervalAvgHoldtime'];var _0x216a8e=(_0x590c17[0x0][_0x4c4c('0x6c')]+_0x590c17[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x590c17[0x0][_0x4c4c('0x6f')])/_0x590c17[0x0][_0x4c4c('0x76')];var _0x41e979=_0x4319b3['dialPredictiveOptimizationPercentage']/0x64;_0x4319b3['predictiveIntervalPauses']=_0x282e69[0x0][_0x4c4c('0x1f3')]||0x0;_0x4319b3[_0x4c4c('0x73')]=_0x216a8e>0x0?_0x216a8e:0x1;return _0x3d2414['busyFactor'](_0xa4df92,_0x39199d,_0x342305,_0x216a8e,_0x41e979);})[_0x4c4c('0x3e')](function(_0x94c695){return _0x5a9a60(_0x94c695);})['catch'](function(_0x34cd33){return _0x263331(msgResponse(_0x4c4c('0x1f5'),_0x4c4c('0x157'),JSON[_0x4c4c('0x4e')](_0x34cd33)));});}}else{return _0x263331(msgResponse(_0x4c4c('0x1ef'),'Failure','check\x20failure'));}});};};Dialer[_0x4c4c('0x1e')]['startMethodPredictive']=function(_0x514a3c){var _0x4daf75=this;return function(){var _0x49de4b=0x0;var _0x9f1f29=Math[_0x4c4c('0x1f6')](_0x514a3c[_0x4c4c('0x78')]*0x3e8);if(_0x9f1f29>0x0){_0x9f1f29=_0x9f1f29<0x64?0x64:_0x9f1f29;loggerPredictive[_0x4c4c('0x81')](_0x514a3c['name'],_0x4c4c('0x1f7'),_0x9f1f29,'milliseconds');_0x514a3c['handlePredictive']=setInterval(function(){_0x4daf75[_0x4c4c('0x93')](_0x514a3c);loggerPredictiveCalls[_0x4c4c('0x81')](_0x4c4c('0x1f8'),_0x49de4b+=0x1);},_0x9f1f29);}else{loggerPredictive[_0x4c4c('0x81')](_0x514a3c[_0x4c4c('0x43')],_0x4c4c('0x1f9'));}};};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x1fa')]=function(_0x20a446,_0x1e4e0d){var _0x595114=this;return function(_0x169640){if(_['isEmpty'](_0x169640)){if(_[_0x4c4c('0xe3')](_0x1e4e0d[_0x4c4c('0xd9')])||!_0x1e4e0d[_0x4c4c('0x1fb')]){if(_0x20a446[_0x4c4c('0x176')]===_0x4c4c('0x8')){_0x20a446[_0x4c4c('0x13f')]=_[_0x4c4c('0x40')](_0x20a446[_0x4c4c('0x13f')])?!![]:_0x20a446[_0x4c4c('0x13f')];var _0x455075=uuid['v4']();_0x595114[_0x4c4c('0xab')][_0x455075]=new Action(_0x20a446,_0x1e4e0d,_0x455075);loggerBooked[_0x4c4c('0x81')](_0x4c4c('0x1fc'),_0x455075,_0x4c4c('0x1fd'),JSON[_0x4c4c('0x4e')](_0x20a446[_0x4c4c('0x13f')]),_0x4c4c('0x1fe'),_0x20a446[_0x4c4c('0x43')]);if(_0x20a446['queueStatusComplete']){_0x20a446['queueStatusComplete']=![];_0x595114[_0x4c4c('0x13b')][_0x595114[_0x4c4c('0xab')][_0x455075][_0x4c4c('0xb7')]]=[];ami[_0x4c4c('0xb0')]({'actionid':_0x455075,'action':_0x4c4c('0x1ff'),'queue':_0x20a446['name']})['catch'](function(){_0x595114[_0x4c4c('0xb6')](_0x20a446);_0x595114[_0x4c4c('0xc8')]({'active':![],'ContactId':_0x595114[_0x4c4c('0xab')][_0x455075][_0x4c4c('0xd7')],'ListId':_0x595114[_0x4c4c('0xab')][_0x455075][_0x4c4c('0xd8')],'VoiceQueueId':_0x595114['actions'][_0x455075]['VoiceQueueId']||undefined,'CampaignId':_0x595114[_0x4c4c('0xab')][_0x455075]['CampaignId']||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x200')));delete _0x595114['actions'][_0x455075];});}else{loggerBooked[_0x4c4c('0x81')](_0x4c4c('0x201'),JSON[_0x4c4c('0x4e')](_0x20a446['queueStatusComplete']),_0x4c4c('0x1fe'),_0x20a446['name']);_0x595114[_0x4c4c('0xb6')](_0x20a446);_0x595114[_0x4c4c('0xc8')]({'active':![],'ContactId':_0x595114[_0x4c4c('0xab')][_0x455075]['ContactId'],'ListId':_0x595114[_0x4c4c('0xab')][_0x455075][_0x4c4c('0xd8')],'VoiceQueueId':_0x595114[_0x4c4c('0xab')][_0x455075][_0x4c4c('0x10e')]||undefined,'CampaignId':_0x595114[_0x4c4c('0xab')][_0x455075][_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x200')));delete _0x595114[_0x4c4c('0xab')][_0x455075];}}else{return _0x595114[_0x4c4c('0x181')](_0x20a446,_0x1e4e0d);}}else{if(getDiff(_0x1e4e0d[_0x4c4c('0x202')])<_0x20a446[_0x4c4c('0x203')]*0x3c){if(_0x1e4e0d[_0x4c4c('0x17d')]&&!_0x1e4e0d[_0x4c4c('0x17d')]['voicePause']){_0x595114['preview'][_0x4c4c('0x141')](_0x1e4e0d['id'])[_0x4c4c('0x20')](function(){_0x595114[_0x4c4c('0xb6')](_0x20a446);});}else{_0x595114[_0x4c4c('0xca')]({'active':![]},_0x1e4e0d['id'],0x1)['finally'](function(){_0x595114['updateOriginated'](_0x20a446);});}}else{_0x20a446['outboundReCallsDay']+=0x1;_0x595114[_0x4c4c('0xb6')](_0x20a446);if(_0x20a446[_0x4c4c('0x204')]){_0x595114[_0x4c4c('0xc8')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1e4e0d[_0x4c4c('0xd7')],'ListId':_0x1e4e0d[_0x4c4c('0xd8')],'VoiceQueueId':_0x1e4e0d[_0x4c4c('0x10e')]||undefined,'CampaignId':_0x1e4e0d[_0x4c4c('0x104')]||undefined})[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x205')));_0x595114[_0x4c4c('0xd1')](createObjHistory(_0x20a446,_0x1e4e0d,_0x4c4c('0x206'),0x17,_0x4c4c('0x207')))[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0x208')));}else{_0x595114[_0x4c4c('0xd5')](createObjHistory(_0x20a446,_0x1e4e0d,'RECALLFAILEDTIMEOUT',0x16,_0x4c4c('0x209')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x20a446[_0x4c4c('0x63')]+=0x1;_0x595114['saveInDb'](createObjHistory(_0x20a446,_0x1e4e0d,_0x4c4c('0x20a'),0xd,_0x4c4c('0x20b')),_0x4c4c('0x20c'),_0x4c4c('0x20d'));throw'inBlackList';}};};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x175')]=function(_0x2795f0){var _0x4a8fa1=this;var _0x29823d=_0x2795f0['limitCalls']-_0x2795f0[_0x4c4c('0x77')]-_0x2795f0[_0x4c4c('0xcc')];emitCampaignSummary(_0x2795f0);if(_0x29823d>0x0){if(_0x29823d>this[_0x4c4c('0x20e')]){_0x29823d=this[_0x4c4c('0x20e')];}_0x2795f0[_0x4c4c('0xcc')]+=_0x29823d;this[_0x4c4c('0xce')](_0x2795f0['id'],_0x29823d,_0x2795f0[_0x4c4c('0x20f')],_0x2795f0)['then'](function(_0x3a85c6){_0x2795f0[_0x4c4c('0xcc')]-=_0x29823d;_0x2795f0[_0x4c4c('0xcc')]=_0x2795f0['temp']>0x0?_0x2795f0[_0x4c4c('0xcc')]:0x0;if(!checkContactEmpty(_0x3a85c6)){_0x2795f0[_0x4c4c('0x41')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x4c4c('0x81')]('[getContactCampaign2][Empty]'+_0x2795f0[_0x4c4c('0x43')]);}else{_0x2795f0['originated']+=_0x3a85c6['length'];_0x2795f0[_0x4c4c('0x41')]=_0x4c4c('0x210');for(var _0x4bf0d8=0x0;_0x4bf0d8<_0x3a85c6['length'];_0x4bf0d8+=0x1){_0x2795f0['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x3a85c6[_0x4bf0d8])||_['isNil'](_0x3a85c6[_0x4bf0d8]['Contact'])||_[_0x4c4c('0xe3')](_0x3a85c6[_0x4bf0d8][_0x4c4c('0x185')])){_0x4a8fa1['emptyContact'](_0x4c4c('0x211'),_0x2795f0,_0x3a85c6[_0x4bf0d8]);}else{_0x4a8fa1[_0x4c4c('0xc3')](_[_0x4c4c('0xd6')](_0x3a85c6[_0x4bf0d8],['CampaignId','Contact.phone']))[_0x4c4c('0x3e')](_0x4a8fa1[_0x4c4c('0x1fa')](_0x2795f0,_0x3a85c6[_0x4bf0d8]))[_0x4c4c('0xb3')](_0x4a8fa1[_0x4c4c('0xd3')]('[actionOriginateIvr]\x20',_0x2795f0));}}}})[_0x4c4c('0xb3')](loggerGetContactDialer('[getContactCampaign2]',_0x2795f0,_0x29823d));}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x16f')]=function(_0x3eac30,_0x552f74){var _0x375127=this;var _0x3272b2=[];var _0x3b2b6a=_0x552f74>=0x1?_0x552f74:0x1;if(_0x3eac30['dialMethod']===_0x4c4c('0x8')){_0x3b2b6a=0x1;}var _0x2ad8ac=Math[_0x4c4c('0x1f6')](_0x3eac30[_0x4c4c('0xa2')]*_0x3b2b6a)-_0x3eac30['originated']-_0x3eac30[_0x4c4c('0xcc')];emitVoiceQueueSummary(_0x3eac30);if(_0x3eac30[_0x4c4c('0x212')]>0x0){var _0x27121c=_0x3eac30[_0x4c4c('0x212')]-_0x3eac30['originated']-_0x3eac30['talking']-_0x3eac30[_0x4c4c('0xcc')]-_0x3eac30[_0x4c4c('0x56')];if(_0x2ad8ac>_0x27121c){_0x2ad8ac=_0x27121c;}}if(_0x2ad8ac>0x0){if(_0x3eac30[_0x4c4c('0x176')]===_0x4c4c('0x8')){_0x2ad8ac=0x1;}if(_0x2ad8ac>this['maxNumberOriginate']){_0x2ad8ac=this[_0x4c4c('0x20e')];}_0x3eac30[_0x4c4c('0xcc')]+=_0x2ad8ac;for(var _0xbfe55f in this[_0x4c4c('0x24')]){if(typeof this[_0x4c4c('0x24')][_0xbfe55f]!=='undefined'){if(this[_0x4c4c('0x24')][_0xbfe55f][_0x4c4c('0xe9')]===_0x4c4c('0x213')&&this[_0x4c4c('0x24')][_0xbfe55f]['status']===_0x4c4c('0xdf')){_0x3272b2['push'](this[_0x4c4c('0x24')][_0xbfe55f]['id']);}}}this['getContactDialer'](_0x3eac30['id'],_0x3272b2,_0x2ad8ac,_0x3eac30[_0x4c4c('0x20f')],_0x3eac30)[_0x4c4c('0x3e')](function(_0x335cea){_0x3eac30[_0x4c4c('0xcc')]-=_0x2ad8ac;_0x3eac30['temp']=_0x3eac30[_0x4c4c('0xcc')]>0x0?_0x3eac30[_0x4c4c('0xcc')]:0x0;if(!checkContactEmpty(_0x335cea)){_0x375127['countReScheduled'](_0x3eac30)[_0x4c4c('0x3e')](sendMessageReschedule(_0x3eac30))[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xbc')));}else{_0x3eac30['originated']+=_0x335cea['length'];_0x3eac30[_0x4c4c('0x41')]=_0x3eac30['dialMethod']==='booked'?_0x4c4c('0x18d'):_0x4c4c('0x210');for(var _0x278a4c=0x0;_0x278a4c<_0x335cea[_0x4c4c('0x9b')];_0x278a4c+=0x1){if(_['isNil'](_0x335cea[_0x278a4c])||_[_0x4c4c('0xe3')](_0x335cea[_0x278a4c][_0x4c4c('0x19c')])||_[_0x4c4c('0xe3')](_0x335cea[_0x278a4c][_0x4c4c('0x185')])){_0x375127[_0x4c4c('0x214')](_0x4c4c('0x211'),_0x3eac30,_0x335cea[_0x278a4c]);}else{_0x375127[_0x4c4c('0xbd')](_[_0x4c4c('0xd6')](_0x335cea[_0x278a4c],[_0x4c4c('0x10e'),'Contact.phone']))[_0x4c4c('0x3e')](_0x375127[_0x4c4c('0x1fa')](_0x3eac30,_0x335cea[_0x278a4c]))[_0x4c4c('0xb3')](_0x375127['loggerHandler'](_0x4c4c('0x211'),_0x3eac30));}}}})[_0x4c4c('0xb3')](loggerGetContactDialer(_0x4c4c('0x215'),_0x3eac30,_0x2ad8ac));}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x93')]=function(_0x19ce4d){if(_0x19ce4d[_0x4c4c('0x212')]>0x0){var _0x840def=_0x19ce4d['dialLimitQueue']-_0x19ce4d['originated']-_0x19ce4d[_0x4c4c('0x59')];if(_0x840def>0x0){this[_0x4c4c('0x216')](_0x19ce4d);}else{loggerPredictiveCalls[_0x4c4c('0x81')](_0x4c4c('0x217'));}}else{this[_0x4c4c('0x216')](_0x19ce4d);}};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x216')]=function(_0x3a10ea){var _0x5a8e01=this;var _0x4566ef=[];_0x3a10ea['originated']+=0x1;for(var _0x2d0832 in this[_0x4c4c('0x24')]){if(typeof this[_0x4c4c('0x24')][_0x2d0832]!==_0x4c4c('0xae')){if(this['agents'][_0x2d0832][_0x4c4c('0xe9')]===_0x4c4c('0x213')&&this['agents'][_0x2d0832][_0x4c4c('0xb1')]==='reachable'){_0x4566ef['push'](this[_0x4c4c('0x24')][_0x2d0832]['id']);}}}this[_0x4c4c('0x218')](_0x3a10ea['id'],_0x4566ef,0x1,_0x3a10ea['dialOrderByScheduledAt'],_0x3a10ea)[_0x4c4c('0x3e')](function(_0x524ba7){if(!checkContactEmpty(_0x524ba7)){checkContactLowerLimitOriginate(_0x3a10ea,0x1,0x0);_0x5a8e01[_0x4c4c('0xba')](_0x3a10ea)['then'](sendMessageReschedule(_0x3a10ea))[_0x4c4c('0xb3')](loggerCatch(_0x4c4c('0xbc')));}else{_0x3a10ea['message']=_0x4c4c('0x210');if(_[_0x4c4c('0xe3')](_0x524ba7[0x0])||_['isNil'](_0x524ba7[0x0]['Contact'])||_[_0x4c4c('0xe3')](_0x524ba7[0x0]['phone'])){_0x5a8e01['emptyContact'](_0x4c4c('0x211'),_0x3a10ea,_0x524ba7[0x0]);}else{_0x5a8e01[_0x4c4c('0xbd')](_[_0x4c4c('0xd6')](_0x524ba7[0x0],[_0x4c4c('0x10e'),_0x4c4c('0x219')]))[_0x4c4c('0x3e')](_0x5a8e01['checkContactBlack'](_0x3a10ea,_0x524ba7[0x0]))[_0x4c4c('0xb3')](_0x5a8e01[_0x4c4c('0xd3')]('[actionOriginatePredictive]\x20',_0x3a10ea));}}})[_0x4c4c('0xb3')](loggerGetContactDialer(_0x4c4c('0x21a'),_0x3a10ea,0x1));emitVoiceQueueSummary(_0x3a10ea);};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x1f4')]=function(_0x560a75,_0x29b18d,_0x3d2026,_0x687c65,_0x21b2a3,_0x2f8697){loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x21b'));loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x21c'),_0x560a75);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x21d'),_0x29b18d);loggerPredictive[_0x4c4c('0x81')]('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',_0x3d2026);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x21e'),_0x687c65);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x21f'),_0x21b2a3);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x87'));return new Promise(function(_0x311c9c,_0xc5c6d6){if(_0x560a75<=0x0||isNaN(_0x560a75)){return _0xc5c6d6(msgResponse(_0x4c4c('0x220'),_0x4c4c('0x4d'),_0x4c4c('0x221')+_0x560a75));}if(_0x3d2026<=0x0||isNaN(_0x3d2026)){return _0xc5c6d6(msgResponse('[abandonmentRate]','Error',_0x4c4c('0x222')+_0x3d2026));}if(_0x687c65<=0x0||isNaN(_0x687c65)){return _0xc5c6d6(msgResponse(_0x4c4c('0x220'),'Error',_0x4c4c('0x223')+_0x687c65));}if(_0x29b18d<=0x0||isNaN(_0x29b18d)){return _0xc5c6d6(msgResponse(_0x4c4c('0x220'),'Error','interval\x20=\x20'+_0x29b18d));}if(_0x21b2a3<=0x0||isNaN(_0x21b2a3)){return _0xc5c6d6(msgResponse(_0x4c4c('0x220'),_0x4c4c('0x4d'),_0x4c4c('0x224')+_0x21b2a3));}_0x2f8697=_0x2f8697||0x0;var _0x3292d4=0x1/_0x3d2026;var _0xf2dee0=0x0;var _0x256d70=0x0;var _0x2872c9=0x0;var _0x4cd48a=0x0;for(var _0x225e18=0x0;_0x2872c9<_0x21b2a3;_0x225e18+=0x1){_0x256d70=_0x225e18/_0x29b18d;_0xf2dee0=(_0x687c65*_0x256d70+_0x2f8697)/_0x3292d4;_0x2872c9=erlangb(_0xf2dee0,_0x560a75);_0x4cd48a=_0xf2dee0/_0x560a75*(0x1-erlangb(_0xf2dee0,_0x560a75));}return _0x311c9c({'erlangCalls':_0x225e18,'erlangCallToSecond':_0x29b18d/_0x225e18,'erlangAbandonmentRate':_0x2872c9,'erlangBusyFactor':_0x4cd48a});});};Dialer[_0x4c4c('0x1e')][_0x4c4c('0x1ee')]=function(_0x3d73c0,_0x561d5a,_0x4cf8fe,_0x5ec3b8,_0x1b6b42,_0x20482a){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x21c'),_0x3d73c0);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x21d'),_0x561d5a);loggerPredictive[_0x4c4c('0x81')]('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',_0x4cf8fe);loggerPredictive['info'](_0x4c4c('0x21e'),_0x5ec3b8);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x225'),_0x1b6b42);loggerPredictive[_0x4c4c('0x81')](_0x4c4c('0x87'));return new Promise(function(_0x12c2a2,_0x44c71a){if(_0x3d73c0<=0x0||isNaN(_0x3d73c0)){return _0x44c71a(msgResponse(_0x4c4c('0x226'),_0x4c4c('0x4d'),_0x4c4c('0x221')+_0x3d73c0));}if(_0x4cf8fe<=0x0||isNaN(_0x4cf8fe)){return _0x44c71a(msgResponse('[busyFactor]',_0x4c4c('0x4d'),_0x4c4c('0x222')+_0x4cf8fe));}if(_0x5ec3b8<=0x0||isNaN(_0x5ec3b8)){return _0x44c71a(msgResponse(_0x4c4c('0x226'),_0x4c4c('0x4d'),'p\x20=\x20'+_0x5ec3b8));}if(_0x561d5a<=0x0||isNaN(_0x561d5a)){return _0x44c71a(msgResponse(_0x4c4c('0x226'),'Error',_0x4c4c('0x227')+_0x561d5a));}if(_0x1b6b42<=0x0||isNaN(_0x1b6b42)){return _0x44c71a(msgResponse(_0x4c4c('0x226'),_0x4c4c('0x4d'),_0x4c4c('0x228')+_0x1b6b42));}_0x20482a=_0x20482a||0x0;var _0x1a58e6=0x1/_0x4cf8fe;var _0x49aa67=0x0;var _0x26df2b=0x0;var _0x56dd19=0x0;var _0xd7feef=0x0;for(var _0x5b58dc=0x0;_0xd7feef<_0x1b6b42;_0x5b58dc+=0x1){_0x26df2b=_0x5b58dc/_0x561d5a;_0x49aa67=(_0x5ec3b8*_0x26df2b+_0x20482a)/_0x1a58e6;_0x56dd19=erlangb(_0x49aa67,_0x3d73c0);_0xd7feef=_0x49aa67/_0x3d73c0*(0x1-erlangb(_0x49aa67,_0x3d73c0));}return _0x12c2a2({'erlangCalls':_0x5b58dc,'erlangCallToSecond':_0x561d5a/_0x5b58dc,'erlangAbandonmentRate':_0x56dd19,'erlangBusyFactor':_0xd7feef});});};module[_0x4c4c('0x229')]=Dialer; \ No newline at end of file +var _0xf13f=['NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','custom:agentreject','agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','limitCalls','getContactDialerIvr','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','RUNNING','[actionOriginatePredictive]\x20','[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','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','[abandonmentRate]','Error','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/voiceQueueRt','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','hangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','getSettings','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','pTalking','sumBillable','sumDuration','talking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','md5','format','voice:queue:%s','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','debug','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','status','channel','catch','No\x20such\x20channel','ivr','updateOriginated','queue','then','countReScheduled','[countReScheduled]\x20','checkIsBlackList','resolve','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','pick','ContactId','ListId','UserId','CampaignId','[emptyContact]','Success','isTrunkReachable','active','SIP/%s','reachable','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','custom:amd','buildObj','amd','MACHINE','outboundAnswerCallsDay','Machine','AMD','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','YYYY-MM-DD\x20HH:mm:ss','syncHangup','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','outboundDropCallsDayTimeout','Drop','dropreason','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','starttime','calleridname','calleridnum','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','interval','content','indexOf','true','iftime\x20%s,%s','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','map','checkIfTime','[syncCampaigns]','pow','random','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller'];(function(_0xc8a210,_0x38cb61){var _0x4446dd=function(_0x5252a6){while(--_0x5252a6){_0xc8a210['push'](_0xc8a210['shift']());}};_0x4446dd(++_0x38cb61);}(_0xf13f,0xa2));var _0xff13=function(_0x4bf4c1,_0x3f7335){_0x4bf4c1=_0x4bf4c1-0x0;var _0x20f76f=_0xf13f[_0x4bf4c1];return _0x20f76f;};'use strict';var util=require(_0xff13('0x0'));var _=require(_0xff13('0x1'));var uuid=require(_0xff13('0x2'));var moment=require(_0xff13('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xff13('0x4'));var ut=require(_0xff13('0x5'));var config=require(_0xff13('0x6'));var logger=require(_0xff13('0x7'))(_0xff13('0x8'));var loggerBooked=require(_0xff13('0x7'))(_0xff13('0x9'));var loggerPredictive=require(_0xff13('0x7'))('predictive');var loggerPredictiveCalls=require(_0xff13('0x7'))(_0xff13('0xa'));var loggerSyncQueueSummary=require(_0xff13('0x7'))(_0xff13('0xb'));var ami=require(_0xff13('0xc'));config[_0xff13('0xd')]=_[_0xff13('0xe')](config[_0xff13('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0xff13('0xf'))(new Redis(config[_0xff13('0xd')]));var cmHopper=require(_0xff13('0x10'));var cmHopperHistory=require(_0xff13('0x11'));var cmHopperAdditionalPhone=require(_0xff13('0x12'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xff13('0x13'));var RpcSetting=require('../rpc/setting');var Action=require('./action');var History=require(_0xff13('0x14'));var Final=require('./final');var AgentComplete=require(_0xff13('0x15'));var QueueCallerAbandon=require(_0xff13('0x16'));var Hangup=require(_0xff13('0x17'));var ipAgi=process[_0xff13('0x18')][_0xff13('0x19')]||_0xff13('0x1a');var strategy={'rrmemory':'rrmemory','roundrobin':_0xff13('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xff13('0x1c')][_0xff13('0x1d')]=function(_0x36e15d){this[_0xff13('0x1e')]=this[_0xff13('0x1e')]?this['tail'][_0xff13('0x1f')](_0x36e15d):_0x36e15d();};function Dialer(_0x23ca86,_0x174fa9){this[_0xff13('0x20')]=new Sequence();this[_0xff13('0x21')]=_0x174fa9;this[_0xff13('0x22')]=_0x23ca86['voiceQueues'];this[_0xff13('0x23')]=_0x23ca86[_0xff13('0x23')];this[_0xff13('0x24')]=_0x23ca86[_0xff13('0x24')];this['trunks']=_0x23ca86[_0xff13('0x25')];this[_0xff13('0x26')]=config[_0xff13('0x26')]||0x2;this[_0xff13('0x27')]={};this[_0xff13('0x28')]={};this['contactsId']={};this[_0xff13('0x29')]={};this[_0xff13('0x2a')]={};this[_0xff13('0x2b')]={};this['startProgressive']={};this[_0xff13('0x2c')]={};this[_0xff13('0x2d')]={};this['queueBookedRR']={};ami['on'](_0xff13('0x2e'),this[_0xff13('0x2f')][_0xff13('0x30')](this));ami['on'](_0xff13('0x31'),this[_0xff13('0x32')][_0xff13('0x30')](this));ami['on'](_0xff13('0x33'),this[_0xff13('0x34')][_0xff13('0x30')](this));ami['on']('agentcomplete',this[_0xff13('0x35')]['bind'](this));ami['on'](_0xff13('0x36'),this[_0xff13('0xb')][_0xff13('0x30')](this));ami['on'](_0xff13('0x37'),this['syncQueueSummaryComplete'][_0xff13('0x30')](this));ami['on'](_0xff13('0x38'),this['syncHangup'][_0xff13('0x30')](this));ami['on'](_0xff13('0x39'),this[_0xff13('0x3a')]['bind'](this));ami['on'](_0xff13('0x3b'),this['syncVarSet']['bind'](this));ami['on'](_0xff13('0x3c'),this[_0xff13('0x3d')]['bind'](this));ami['on']('queuestatuscomplete',this[_0xff13('0x3e')][_0xff13('0x30')](this));this['loopCampaigns']();this[_0xff13('0x3f')]();RpcSetting[_0xff13('0x40')]()['then'](function(_0x3112f8){previewRecallmeReminderInterval=_0x3112f8['previewRecallmeReminderInterval'];});}function isNotNull(_0x3331ec){return _0x3331ec!==null&&!_[_0xff13('0x41')](_0x3331ec);}function checkIsLoggedIn(_0x293f82,_0x23a932){return function(){if(_0x23a932<=0x0){_0x293f82[_0xff13('0x42')]=_0xff13('0x43');throw _0x293f82[_0xff13('0x44')]+_0xff13('0x45');}};}function isActive(_0x5c68a1){return _0x5c68a1;}function checkIsActive(_0x96d848,_0x4f788a){return function(){if(!isActive(_0x4f788a)){_0x96d848[_0xff13('0x42')]=_0xff13('0x46');throw _0x96d848['name']+_0xff13('0x47');}};}function checkInterval(_0x5ed1b8){return function(){if(!isNotNull(_0x5ed1b8[_0xff13('0x48')])){_0x5ed1b8['message']='INTERVAL_IS_NULL';throw _0x5ed1b8[_0xff13('0x44')]+_0xff13('0x49');}if(!isNotNull(_0x5ed1b8['Interval'][_0xff13('0x4a')])){_0x5ed1b8[_0xff13('0x42')]=_0xff13('0x4b');throw _0x5ed1b8[_0xff13('0x44')]+_0xff13('0x49');}if(!isNotNull(_[_0xff13('0x4c')](_0x5ed1b8[_0xff13('0x48')][_0xff13('0x4a')]))){_0x5ed1b8[_0xff13('0x42')]=_0xff13('0x4b');throw _0x5ed1b8[_0xff13('0x44')]+_0xff13('0x49');}};}function msgResponse(_0x190d61,_0x6fdd14,_0x5157f6){return{'action':_0x190d61,'response':_0x6fdd14,'message':_0x5157f6,'stack':_0x5157f6};}function myreject(_0x49c6e6){return function(_0x380d20){return _0x49c6e6(msgResponse(_0xff13('0x4d'),'Error',JSON[_0xff13('0x4e')](_0x380d20)));};}function getSeconds(_0x392afb,_0x4d8ff9){var _0x5e02d4=moment(_0x392afb)[_0xff13('0x4f')](0x0);var _0x58fe3b=moment(_0x4d8ff9)[_0xff13('0x4f')](0x0);return _0x5e02d4[_0xff13('0x50')](_0x58fe3b,_0xff13('0x51'));}function emit(_0x266468,_0x157c68,_0x4ff79c){io['to'](_0x266468)[_0xff13('0x52')](_0x157c68,_0x4ff79c);}function emitVoiceQueueSummary(_0x4d3cd9){if(_0x4d3cd9[_0xff13('0x53')]===_0xff13('0x54')){var _0x503808={'id':_0x4d3cd9['id'],'name':_0x4d3cd9['name'],'strategy':_0x4d3cd9[_0xff13('0x55')],'answered':_0x4d3cd9[_0xff13('0x56')],'available':_0x4d3cd9[_0xff13('0x57')],'loggedIn':_0x4d3cd9['loggedIn'],'pTalking':_0x4d3cd9[_0xff13('0x58')],'sumBillable':_0x4d3cd9[_0xff13('0x59')],'sumDuration':_0x4d3cd9[_0xff13('0x5a')],'sumHoldTime':_0x4d3cd9['sumHoldTime']||0x0,'talking':_0x4d3cd9[_0xff13('0x5b')],'total':_0x4d3cd9['total'],'type':_0x4d3cd9[_0xff13('0x53')],'unmanaged':_0x4d3cd9['unmanaged'],'abandoned':_0x4d3cd9['abandoned'],'waiting':_0x4d3cd9['waiting'],'loggedInDb':_0x4d3cd9['loggedInDb'],'dialActive':_0x4d3cd9[_0xff13('0x5c')],'dialMethod':_0x4d3cd9[_0xff13('0x5d')],'dialOriginateCallerIdName':_0x4d3cd9[_0xff13('0x5e')],'dialOriginateCallerIdNumber':_0x4d3cd9[_0xff13('0x5f')],'dialOriginateTimeout':_0x4d3cd9[_0xff13('0x60')],'dialPrefix':_0x4d3cd9[_0xff13('0x61')],'outboundAnswerAgiCallsDay':_0x4d3cd9[_0xff13('0x62')],'outboundAnswerCallsDay':_0x4d3cd9['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4d3cd9[_0xff13('0x63')],'outboundBusyCallsDay':_0x4d3cd9[_0xff13('0x64')],'outboundCongestionCallsDay':_0x4d3cd9[_0xff13('0x65')],'outboundDropCallsDayACS':_0x4d3cd9[_0xff13('0x66')],'outboundDropCallsDayCallersExit':_0x4d3cd9[_0xff13('0x67')],'outboundDropCallsDayTimeout':_0x4d3cd9['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4d3cd9[_0xff13('0x68')],'outboundNoSuchCallsDay':_0x4d3cd9['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4d3cd9[_0xff13('0x69')],'outboundReCallsDay':_0x4d3cd9[_0xff13('0x6a')],'outboundRejectCallsDay':_0x4d3cd9['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4d3cd9[_0xff13('0x6b')],'predictiveIntervalAnsweredCalls':_0x4d3cd9[_0xff13('0x6c')],'predictiveIntervalAvgHoldtime':_0x4d3cd9[_0xff13('0x6d')],'predictiveIntervalAvgTalktime':_0x4d3cd9[_0xff13('0x6e')],'predictiveIntervalDroppedCallsCallersExit':_0x4d3cd9['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4d3cd9[_0xff13('0x6f')],'predictiveIntervalErlangCalls':_0x4d3cd9['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x4d3cd9[_0xff13('0x70')],'predictiveIntervalHitRate':_0x4d3cd9[_0xff13('0x71')],'predictiveIntervalMultiplicativeFactor':_0x4d3cd9[_0xff13('0x72')],'predictiveIntervalPauses':_0x4d3cd9[_0xff13('0x73')],'predictiveIntervalAvailable':_0x4d3cd9[_0xff13('0x74')],'predictiveIntervalTotalCalls':_0x4d3cd9[_0xff13('0x75')],'message':_0x4d3cd9[_0xff13('0x42')],'originated':_0x4d3cd9[_0xff13('0x76')],'erlangCalls':_0x4d3cd9[_0xff13('0x77')],'erlangCallToSecond':_0x4d3cd9['erlangCallToSecond'],'erlangAbandonmentRate':_0x4d3cd9[_0xff13('0x78')],'erlangBusyFactor':_0x4d3cd9[_0xff13('0x79')],'startPredictive':_0x4d3cd9['startPredictive'],'startProgressive':_0x4d3cd9[_0xff13('0x7a')]};if(_0x4d3cd9[_0xff13('0x7b')]){_0x503808[_0xff13('0x7b')]={'id':_0x4d3cd9[_0xff13('0x7b')]['id'],'name':_0x4d3cd9['Trunk']['name'],'active':_0x4d3cd9['Trunk']['active'],'callerid':_0x4d3cd9[_0xff13('0x7b')][_0xff13('0x7c')]};}if(_0x4d3cd9[_0xff13('0x48')]){_0x503808[_0xff13('0x48')]={'id':_0x4d3cd9['Interval']['id'],'name':_0x4d3cd9[_0xff13('0x48')]['name']};}var _0x59225d=md5(JSON[_0xff13('0x4e')](_0x503808));if(_0x4d3cd9[_0xff13('0x7d')]!==_0x59225d){_0x4d3cd9[_0xff13('0x7d')]=_0x59225d;emit(util[_0xff13('0x7e')](_0xff13('0x7f'),_0x503808['name']),'voice_queue:save',_0x503808);}}}function emitCampaignSummary(_0x4232a0){if(_0x4232a0[_0xff13('0x53')]==='ivr'){emit(util['format'](_0xff13('0x80'),_0x4232a0[_0xff13('0x44')]),_0xff13('0x81'),_0x4232a0);}}function checkGetDataPredictive(_0x3cd5d0){if(isNotNull(_0x3cd5d0)&&!_[_0xff13('0x4c')](_0x3cd5d0)){loggerPredictive[_0xff13('0x82')](_0xff13('0x83'));loggerPredictive[_0xff13('0x82')](_0xff13('0x84'),_0x3cd5d0[_0xff13('0x75')]);loggerPredictive[_0xff13('0x82')](_0xff13('0x85'),_0x3cd5d0['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xff13('0x82')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3cd5d0[_0xff13('0x6f')]);loggerPredictive[_0xff13('0x82')](_0xff13('0x86'),_0x3cd5d0[_0xff13('0x87')]);loggerPredictive[_0xff13('0x82')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3cd5d0['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xff13('0x82')](_0xff13('0x88'),_0x3cd5d0['predictiveIntervalAvgTalktime']);loggerPredictive['info']('---------------------------');if(_0x3cd5d0[_0xff13('0x75')]>0x0){if(!_[_0xff13('0x41')](_0x3cd5d0[_0xff13('0x6e')])&&_0x3cd5d0[_0xff13('0x6e')]>0x0){return!![];}loggerPredictive[_0xff13('0x82')](_0xff13('0x89'));if(!_['isUndefined'](_0x3cd5d0[_0xff13('0x6d')])&&_0x3cd5d0[_0xff13('0x6d')]>0x0){return!![];}loggerPredictive[_0xff13('0x82')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xff13('0x82')](_0xff13('0x8a'));}}else{loggerPredictive[_0xff13('0x82')](_0xff13('0x8b'));}return![];}function mergeDataErlangB(_0x22f184){return function(_0x622a27){loggerPredictive['info'](_0xff13('0x8c'));loggerPredictive[_0xff13('0x82')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x622a27['erlangCalls']);loggerPredictive[_0xff13('0x82')](_0xff13('0x8d'),_0x622a27[_0xff13('0x8e')]);loggerPredictive[_0xff13('0x82')](_0xff13('0x8f'),_0x622a27['erlangAbandonmentRate']);loggerPredictive[_0xff13('0x82')](_0xff13('0x90'),_0x622a27[_0xff13('0x79')]);loggerPredictive[_0xff13('0x82')](_0xff13('0x8f'),_0x622a27[_0xff13('0x78')]);loggerPredictive['info']('---------------------------');_[_0xff13('0x91')](_0x22f184,_0x622a27);};}function getDiff(_0x250b49){var _0x20a71f=moment()[_0xff13('0x4f')](0x0);var _0x252f61=moment(_0x250b49)[_0xff13('0x4f')](0x0);return _0x20a71f['diff'](_0x252f61,'seconds');}function ifInterval(_0x542198,_0x20a1e7){if(_['isUndefined'](_0x20a1e7)){return![];}return getDiff(_0x20a1e7)<_0x542198*0x3c;}function freeVariablesPredictive(_0x181100){if(isNotNull(_0x181100)){if(!_[_0xff13('0x41')](_0x181100['startProgressive'])){_0x181100[_0xff13('0x7a')]=undefined;loggerPredictive[_0xff13('0x82')](_0x181100['name'],_0xff13('0x92'));}if(!_[_0xff13('0x41')](_0x181100[_0xff13('0x2b')])){_0x181100[_0xff13('0x2b')]=undefined;loggerPredictive['info'](_0x181100[_0xff13('0x44')],_0xff13('0x93'));}if(!_['isUndefined'](_0x181100['handlePredictive'])){clearInterval(_0x181100[_0xff13('0x94')]);_0x181100[_0xff13('0x94')]=undefined;loggerPredictive[_0xff13('0x82')](_0x181100[_0xff13('0x44')],_0xff13('0x95'));}}}function erlangb(_0x107786,_0x5e98f8){if(_0x5e98f8===0x0){return 0x0;}var _0x4280ef=0x1;for(var _0x3134e3=0x1;_0x3134e3<=_0x5e98f8;_0x3134e3+=0x1){_0x4280ef=0x1+_0x4280ef*_0x3134e3/_0x107786;}return 0x1/_0x4280ef;}function isVoiceQueueOutbound(_0x5cd9d2){return _0x5cd9d2===_0xff13('0x54');}function isNotPreview(_0x46cde0){return _0x46cde0!=='preview';}function isCampaignIvr(_0xe3e18){return _0xe3e18==='ivr';}function getCallerId(_0x448e5c,_0x4f53c8,_0x22c70b){if(!_[_0xff13('0x41')](_0x22c70b)&&typeof _0x22c70b===_0xff13('0x96')&&!_[_0xff13('0x4c')](_0x22c70b)){if(!_[_0xff13('0x41')](_0x4f53c8)&&typeof _0x4f53c8===_0xff13('0x96')&&!_[_0xff13('0x4c')](_0x4f53c8)){return util['format']('\x22%s\x22\x20<%s>',_0x4f53c8,_0x22c70b);}return util[_0xff13('0x7e')](_0xff13('0x97'),_0x22c70b,_0x22c70b);}if(!_[_0xff13('0x41')](_0x448e5c)&&typeof _0x448e5c===_0xff13('0x96')&&!_[_0xff13('0x4c')](_0x448e5c)){return _0x448e5c;}return _0xff13('0x98');}function loggerCatchQueueSummary(_0x4a7be7,_0x1d13a5){return function(_0x17f8dd){freeVariablesPredictive(_0x1d13a5);emitVoiceQueueSummary(_0x1d13a5);emitCampaignSummary(_0x1d13a5);loggerSyncQueueSummary['debug'](_0x4a7be7,util[_0xff13('0x99')](_0x17f8dd,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1c0b21,_0x27f6f0){return function(_0x490ecf){loggerPredictive['error'](_0x27f6f0[_0xff13('0x44')],_0x1c0b21);loggerPredictive['error'](_0x490ecf['stack']);freeVariablesPredictive(_0x27f6f0);};}function loggerCatch(_0x336699){return function(_0x1e7625){logger[_0xff13('0x9a')](_0x336699,util[_0xff13('0x99')](_0x1e7625,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3d6575){return _0x3d6575&&!_[_0xff13('0x41')](_0x3d6575)&&_0x3d6575[_0xff13('0x9b')]>0x0;}function decremetOriginate(_0x5d6668){if(!_[_0xff13('0x41')](_0x5d6668)&&_0x5d6668!==null){if(typeof _0x5d6668['originated']!=='undefined'){if(_0x5d6668[_0xff13('0x76')]>0x0){_0x5d6668[_0xff13('0x76')]-=0x1;}else{logger['error'](_0xff13('0x9c'));}}}else{logger['error'](_0xff13('0x9d'));}}function checkContactLowerLimitOriginate(_0x5789bc,_0x31736f,_0x4e9f39){if(_0x31736f>_0x4e9f39){for(var _0x32da7e=0x0;_0x32da7e<_0x31736f-_0x4e9f39;_0x32da7e+=0x1){decremetOriginate(_0x5789bc);}}}function loggerGetContactDialer(_0x1bcf36,_0x13a41b,_0x537115){return function(_0x5d4dc1){checkContactLowerLimitOriginate(_0x13a41b,_0x537115,0x0);logger[_0xff13('0x9a')](_0x1bcf36,util['inspect'](_0x5d4dc1,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1acf57){return function(_0x2245bf){if(isNotNull(_0x2245bf)&&isNotNull(_0x2245bf[0x0])){if(_0x2245bf[0x0][_0xff13('0x9e')]>0x0){_0x1acf57[_0xff13('0x42')]='RESCHEDULED_CONTACTS';logger['info'](_0xff13('0x9f')+_0x1acf57[_0xff13('0x44')],_0x2245bf[0x0][_0xff13('0x9e')],'contacts');}else{_0x1acf57[_0xff13('0x42')]=_0xff13('0xa0');logger['info'](_0xff13('0xa1')+_0x1acf57[_0xff13('0x44')]);}}};}function notSendMessagesQueue(_0x5e0dc1){if(_0x5e0dc1[_0xff13('0xa2')]){freeVariablesPredictive(_0x5e0dc1);if(_0x5e0dc1[_0xff13('0x76')]===0x0&&_0x5e0dc1[_0xff13('0x5b')]===0x0&&_0x5e0dc1['waiting']===0x0&&(_0x5e0dc1[_0xff13('0x58')]||0x0)===0x0){_0x5e0dc1[_0xff13('0xa2')]=![];_0x5e0dc1['available']=0x0;_0x5e0dc1[_0xff13('0x42')]=_0xff13('0x46');loggerSyncQueueSummary[_0xff13('0xa3')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5e0dc1[_0xff13('0x44')],_0xff13('0xa4'));}else{_0x5e0dc1[_0xff13('0x42')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xff13('0xa3')](_0xff13('0xa5'),_0x5e0dc1[_0xff13('0x44')],_0xff13('0xa6'));}emitVoiceQueueSummary(_0x5e0dc1);}}function notSendMessagesCampaign(_0x36a1f1){if(_0x36a1f1[_0xff13('0xa2')]){if(_0x36a1f1[_0xff13('0x76')]===0x0){_0x36a1f1[_0xff13('0xa2')]=![];_0x36a1f1[_0xff13('0x42')]=_0xff13('0x46');loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x36a1f1[_0xff13('0x44')],_0xff13('0xa4'));}else{_0x36a1f1[_0xff13('0x42')]=_0xff13('0xa7');loggerSyncQueueSummary[_0xff13('0xa3')](_0xff13('0xa8'),_0x36a1f1[_0xff13('0x44')],_0xff13('0xa6'));}emitCampaignSummary(_0x36a1f1);}}function createObjHistory(_0x400558,_0x432edf,_0x57eca4,_0x108f7d,_0x4a3457){_0x400558[_0xff13('0x42')]=_0x57eca4;var _0x575012=new Action(_0x400558,_0x432edf);var _0x5600ee=new History(_0x575012);_0x5600ee[_0xff13('0xa9')]=_0x108f7d;_0x5600ee[_0xff13('0xaa')]=_0x4a3457;_0x5600ee[_0xff13('0xab')]=_0x575012['starttime'];return _0x5600ee;}Dialer[_0xff13('0x1c')][_0xff13('0x3f')]=function(){var _0x69c1c1=this;setInterval(function(){_0x69c1c1[_0xff13('0xac')](_0x69c1c1[_0xff13('0x29')],_0xff13('0xad'));_0x69c1c1[_0xff13('0xac')](_0x69c1c1['actions'],_0xff13('0xae'));},0x32c8);};Dialer[_0xff13('0x1c')][_0xff13('0xac')]=function(_0x1ebc91,_0xde1a0e){var _0x2f2fe7=this;for(var _0x32cdeb in _0x1ebc91){if(typeof _0x1ebc91[_0x32cdeb]!==_0xff13('0xaf')){this[_0xff13('0x20')]['enqueue'](function(){if(!_[_0xff13('0xb0')](_0x1ebc91[_0x32cdeb])){return ami[_0xff13('0xb1')]({'action':_0xff13('0xb2'),'channel':_0x1ebc91[_0x32cdeb][_0xff13('0xb3')]})[_0xff13('0xb4')](function(_0x35c64b){if(_0x35c64b[_0xff13('0x42')]===_0xff13('0xb5')){setTimeout(function(){if(_0x1ebc91[_0x32cdeb]&&_0x1ebc91[_0x32cdeb][_0xff13('0x53')]!==_0xff13('0xb6')){_0x2f2fe7[_0xff13('0xb7')](_0x2f2fe7[_0xff13('0x22')][_0x1ebc91[_0x32cdeb]['queue']]);logger[_0xff13('0x9a')]('[Dialer][checkChannel]',_0xde1a0e,_0x32cdeb,_0x1ebc91[_0x32cdeb]['queue']);delete _0x1ebc91[_0x32cdeb];}if(_0x1ebc91[_0x32cdeb]&&_0x1ebc91[_0x32cdeb][_0xff13('0x53')]===_0xff13('0xb6')){_0x2f2fe7[_0xff13('0xb7')](_0x2f2fe7['campaigns'][_0x1ebc91[_0x32cdeb][_0xff13('0xb8')]]);logger[_0xff13('0x9a')]('[Dialer][checkChannel][ivr]',_0xde1a0e,_0x32cdeb,_0x1ebc91[_0x32cdeb]['queue']);delete _0x1ebc91[_0x32cdeb];}},0x2328);}});}});}}};Dialer[_0xff13('0x1c')]['countReScheduled']=function(_0x18b9ad){return Promise['resolve']()[_0xff13('0xb9')](cmHopper[_0xff13('0xba')](_0x18b9ad))[_0xff13('0xb4')](loggerCatch(_0xff13('0xbb')));};Dialer['prototype'][_0xff13('0xbc')]=function(_0xf0633d){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopperBlack[_0xff13('0xbc')](_0xf0633d))[_0xff13('0xb4')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0xff13('0x1c')][_0xff13('0xbe')]=function(_0x5b87e7,_0x51a387,_0x5ba957){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopperAdditionalPhone[_0xff13('0xbe')](_0x5b87e7,_0x51a387,_0x5ba957))[_0xff13('0xb4')](loggerCatch(_0xff13('0xbf')));};Dialer[_0xff13('0x1c')]['swapAdditionalPhones']=function(_0x430599,_0xa8cd6e,_0x212aee){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopperAdditionalPhone[_0xff13('0xc0')](_0x430599,_0xa8cd6e,_0x212aee))['catch'](loggerCatch(_0xff13('0xc1')));};Dialer[_0xff13('0x1c')][_0xff13('0xc2')]=function(_0x31e567){return Promise[_0xff13('0xbd')]()['then'](cmHopperBlack[_0xff13('0xc2')](_0x31e567))[_0xff13('0xb4')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xff13('0x1c')][_0xff13('0xc3')]=function(_0x56a664){return Promise['resolve']()[_0xff13('0xb9')](cmHopperHistory['avgHandleTime'](_0x56a664))['catch'](loggerCatch(_0xff13('0xc4')));};Dialer[_0xff13('0x1c')]['rescheduleContact']=function(_0x48428a){return Promise['resolve']()[_0xff13('0xb9')](cmHopper[_0xff13('0xc5')](_0x48428a))[_0xff13('0xb4')](loggerCatch(_0xff13('0xc6')));};Dialer['prototype'][_0xff13('0xc7')]=function(_0x2ce48a,_0x32b361,_0x456460){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopper[_0xff13('0xc7')](_0x2ce48a,_0x32b361,_0x456460))['catch'](loggerCatch(_0xff13('0xc8')));};Dialer['prototype'][_0xff13('0xc9')]=function(_0x5e51ba,_0x2139c3,_0x588956,_0x235797,_0x2a9a6a){return Promise[_0xff13('0xbd')]()['then'](cmHopper['getContactDialer'](_0x5e51ba,_0x2139c3,_0x588956,_0x235797))[_0xff13('0xb4')](function(_0x1d9d04){_0x2a9a6a[_0xff13('0xca')]-=_0x588956;_0x2a9a6a[_0xff13('0xca')]=_0x2a9a6a[_0xff13('0xca')]>0x0?_0x2a9a6a[_0xff13('0xca')]:0x0;loggerCatch(_0xff13('0xcb'))(_0x1d9d04);});};Dialer[_0xff13('0x1c')]['getContactDialerIvr']=function(_0x38f743,_0x1f74a2,_0x1c2330,_0x3834ea){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopper['getContactDialerIvr'](_0x38f743,_0x1f74a2,_0x1c2330))[_0xff13('0xb4')](function(_0x38c669){_0x3834ea['temp']-=_0x1f74a2;_0x3834ea[_0xff13('0xca')]=_0x3834ea[_0xff13('0xca')]>0x0?_0x3834ea['temp']:0x0;loggerCatch(_0xff13('0xcc'))(_0x38c669);});};Dialer[_0xff13('0x1c')][_0xff13('0xcd')]=function(_0x375af0){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](voiceQueueRt['getVoiceQueueRtPauses'](_0x375af0))['catch'](loggerCatch(_0xff13('0xce')));};Dialer[_0xff13('0x1c')]['moveContactManagedDialer']=function(_0x175e48){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopper[_0xff13('0xcf')](_0x175e48))[_0xff13('0xb4')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xff13('0x1c')][_0xff13('0xd0')]=function(_0x168eb3){return Promise['resolve']()[_0xff13('0xb9')](cmHopperHistory[_0xff13('0xd0')](_0x168eb3))[_0xff13('0xb4')](loggerCatch(_0xff13('0xd1')));};Dialer[_0xff13('0x1c')][_0xff13('0xb7')]=function(_0x3a1b39){if(!_[_0xff13('0x41')](_0x3a1b39)&&_0x3a1b39!==null){if(typeof _0x3a1b39['originated']!==_0xff13('0xaf')){if(_0x3a1b39[_0xff13('0x76')]>0x0){_0x3a1b39[_0xff13('0x76')]-=0x1;}else{logger[_0xff13('0x9a')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xff13('0x9a')](_0xff13('0xd2'));}};Dialer[_0xff13('0x1c')][_0xff13('0xd3')]=function(_0x3ea1fd,_0x141805){var _0x2219b7=this;return function(_0x15fd51){_0x2219b7[_0xff13('0xb7')](_0x141805);logger['error'](_0x3ea1fd,util[_0xff13('0x99')](_0x15fd51,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x591e05,_0x41dde3,_0x119ba9){var _0x2ad65f={'state':0x19,'statedesc':'notFound'};this[_0xff13('0xb7')](_0x41dde3);this[_0xff13('0xd4')](_[_0xff13('0x91')](_0x2ad65f,_[_0xff13('0xd5')](_0x119ba9,[_0xff13('0xd6'),_0xff13('0xd7'),_0xff13('0xd8'),'VoiceQueueId',_0xff13('0xd9')])),'[emptyContact][createHistory]',_0xff13('0xda'));logger[_0xff13('0x9a')](_0x591e05);};Dialer[_0xff13('0x1c')]['isSuccess']=function(_0x58a65d){return _0x58a65d===_0xff13('0xdb');};Dialer['prototype'][_0xff13('0xdc')]=function(_0x1e8157){return!_[_0xff13('0x41')](_0x1e8157)&&_0x1e8157&&!_[_0xff13('0x41')](_0x1e8157[_0xff13('0x44')])&&!_[_0xff13('0x41')](_0x1e8157[_0xff13('0xdd')])&&_0x1e8157['active']&&(this['trunks'][util[_0xff13('0x7e')](_0xff13('0xde'),_0x1e8157[_0xff13('0x44')])][_0xff13('0xb2')]===_0xff13('0xdf')||this[_0xff13('0x25')][util[_0xff13('0x7e')]('SIP/%s',_0x1e8157[_0xff13('0x44')])]['status']==='unmonitored');};Dialer[_0xff13('0x1c')]['saveInDb']=function(_0x47f133,_0xc92ffd,_0x542b07){this['createHistory'](_0x47f133)[_0xff13('0xb4')](loggerCatch(_0xc92ffd));this['moveContactManagedDialer'](_0x47f133)[_0xff13('0xb4')](loggerCatch(_0x542b07));};Dialer['prototype'][_0xff13('0xe0')]=function(_0x4199d0){var _0x4c385e=this;var _0x3ec8fe=this[_0xff13('0x29')][_0x4199d0[_0xff13('0xe1')]];var _0x5d948b;if(!_[_0xff13('0xb0')](_0x4199d0)&&!_[_0xff13('0xb0')](_0x4199d0[_0xff13('0xe2')])&&!_[_0xff13('0xb0')](_0x4199d0[_0xff13('0xe2')][_0xff13('0xe3')])&&_0x4199d0[_0xff13('0xe4')]===_0xff13('0xe5')&&_0x3ec8fe){if(_0x3ec8fe[_0xff13('0x53')]!==_0xff13('0xb6')&&this[_0xff13('0x22')][_0x3ec8fe['queue']][_0xff13('0xe6')]&&_0x4199d0[_0xff13('0xe7')]===_0xff13('0xe8')){delete this[_0xff13('0x29')][_0x4199d0['uniqueid']];this[_0xff13('0xb7')](this['voiceQueues'][_0x3ec8fe[_0xff13('0xb8')]]);this[_0xff13('0x22')][_0x3ec8fe['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xff13('0x22')][_0x3ec8fe[_0xff13('0xb8')]][_0xff13('0x62')]+=0x1;_0x5d948b=new Hangup(_0x3ec8fe,_0x4199d0);_0x5d948b[_0xff13('0xa9')]=0x12;_0x5d948b[_0xff13('0xaa')]=_0xff13('0xe9');_0x5d948b[_0xff13('0xea')]='AMD';ami[_0xff13('0x52')](_0xff13('0xeb'),ut[_0xff13('0xec')](_0x5d948b,_0xff13('0xed')));this[_0xff13('0xd4')](_0x5d948b,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x3ec8fe[_0xff13('0x53')]!==_0xff13('0xb6')&&this[_0xff13('0x22')][_0x3ec8fe[_0xff13('0xb8')]]['dialAMDActive']&&_0x4199d0[_0xff13('0xe7')]===_0xff13('0xee')){return new Promise(function(_0x577cdb,_0xaba899){delete _0x4c385e[_0xff13('0x29')][_0x4199d0[_0xff13('0xe1')]];_0x4c385e[_0xff13('0xb7')](_0x4c385e[_0xff13('0x22')][_0x3ec8fe['queue']]);_0x4c385e[_0xff13('0x22')][_0x3ec8fe[_0xff13('0xb8')]][_0xff13('0xef')]+=0x1;_0x4c385e['voiceQueues'][_0x3ec8fe[_0xff13('0xb8')]][_0xff13('0x62')]+=0x1;var _0x2e6ded=_0x4c385e['voiceQueues'][_0x3ec8fe['queue']];var _0x5af2c3=new Hangup(_0x3ec8fe,_0x4199d0);_0x5af2c3[_0xff13('0xa9')]=0x13;_0x5af2c3[_0xff13('0xaa')]=_0xff13('0xf0');_0x5af2c3[_0xff13('0xea')]=_0xff13('0xf1');_0x5af2c3[_0xff13('0xf2')]+=0x1;_0x5af2c3[_0xff13('0xf3')]+=0x1;_0x5af2c3['amd']=!![];ami['emit'](_0xff13('0xeb'),ut[_0xff13('0xec')](_0x5af2c3,'amd'));_0x4c385e['createHistory'](_0x5af2c3)[_0xff13('0xb4')](loggerCatch(_0xff13('0xf4')));if(_0x5af2c3[_0xff13('0xf5')]+_0x5af2c3[_0xff13('0xf6')]+_0x5af2c3[_0xff13('0xf7')]+_0x5af2c3[_0xff13('0xf8')]+_0x5af2c3['countdropretry']+_0x5af2c3[_0xff13('0xf9')]+_0x5af2c3['countmachineretry']+_0x5af2c3['countagentrejectretry']>=_0x2e6ded['dialGlobalMaxRetry']){_0x4c385e['stateGlobal'](_0x5af2c3,_0x577cdb,_0xaba899,_0xff13('0xfa'));}else{if(_0x5af2c3[_0xff13('0xf2')]>=_0x2e6ded[_0xff13('0xfb')]){_0x4c385e[_0xff13('0xfc')](_0x5af2c3,_0x577cdb,_0xaba899,_0xff13('0xfd'));}else{_0x4c385e[_0xff13('0xc5')]({'active':![],'countmachineretry':_0x5af2c3[_0xff13('0xf2')],'scheduledat':moment()[_0xff13('0xfe')](_0x2e6ded[_0xff13('0xff')],_0xff13('0x100'))[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5af2c3[_0xff13('0xd6')],'ListId':_0x5af2c3[_0xff13('0xd7')],'VoiceQueueId':_0x5af2c3[_0xff13('0x101')]||undefined,'CampaignId':_0x5af2c3[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x102')));_0x577cdb({'reschedule':0x1});}}});}if(_0x3ec8fe[_0xff13('0x53')]==='ivr'&&this[_0xff13('0x23')][_0x3ec8fe[_0xff13('0xb8')]][_0xff13('0xe6')]&&_0x4199d0[_0xff13('0xe7')]===_0xff13('0xe8')){delete this[_0xff13('0x29')][_0x4199d0['uniqueid']];this['updateOriginated'](this[_0xff13('0x23')][_0x3ec8fe['queue']]);_0x5d948b=new Hangup(_0x3ec8fe,_0x4199d0);_0x5d948b['state']=0x12;_0x5d948b['statedesc']=_0xff13('0xe9');_0x5d948b[_0xff13('0xea')]=_0xff13('0xf1');ami[_0xff13('0x52')](_0xff13('0xeb'),ut[_0xff13('0xec')](_0x5d948b,_0xff13('0xed')));this[_0xff13('0xd4')](_0x5d948b,_0xff13('0x103'),'[syncHangupInAMDIvr]');}if(_0x3ec8fe[_0xff13('0x53')]===_0xff13('0xb6')&&this[_0xff13('0x23')][_0x3ec8fe[_0xff13('0xb8')]]['dialAMDActive']&&_0x4199d0['value']===_0xff13('0xee')){return new Promise(function(_0x108040,_0x343ef1){delete _0x4c385e['uniqueId'][_0x4199d0['uniqueid']];_0x4c385e[_0xff13('0xb7')](_0x4c385e[_0xff13('0x23')][_0x3ec8fe[_0xff13('0xb8')]]);_0x4c385e['campaigns'][_0x3ec8fe[_0xff13('0xb8')]][_0xff13('0xef')]+=0x1;_0x4c385e[_0xff13('0x23')][_0x3ec8fe['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x34fd8b=_0x4c385e[_0xff13('0x23')][_0x3ec8fe['queue']];var _0x435177=new Hangup(_0x3ec8fe,_0x4199d0);_0x435177['state']=0x13;_0x435177[_0xff13('0xaa')]=_0xff13('0xf0');_0x435177[_0xff13('0xea')]='AMD';_0x435177[_0xff13('0xf2')]+=0x1;_0x435177[_0xff13('0xf3')]+=0x1;_0x435177[_0xff13('0xed')]=!![];ami[_0xff13('0x52')](_0xff13('0xeb'),ut['buildObj'](_0x435177,_0xff13('0xed')));_0x4c385e[_0xff13('0xd0')](_0x435177)[_0xff13('0xb4')](loggerCatch(_0xff13('0xf4')));if(_0x435177[_0xff13('0xf5')]+_0x435177[_0xff13('0xf6')]+_0x435177['countnoanswerretry']+_0x435177['countnosuchnumberretry']+_0x435177[_0xff13('0x104')]+_0x435177[_0xff13('0xf9')]+_0x435177[_0xff13('0xf2')]+_0x435177[_0xff13('0x105')]>=_0x34fd8b[_0xff13('0x106')]){_0x4c385e[_0xff13('0x107')](_0x435177,_0x108040,_0x343ef1,_0xff13('0xfa'));}else{if(_0x435177[_0xff13('0xf2')]>=_0x34fd8b[_0xff13('0xfb')]){_0x4c385e[_0xff13('0xfc')](_0x435177,_0x108040,_0x343ef1,_0xff13('0xfd'));}else{_0x4c385e[_0xff13('0xc5')]({'active':![],'countmachineretry':_0x435177['countmachineretry'],'scheduledat':moment()['add'](_0x34fd8b[_0xff13('0xff')],_0xff13('0x100'))[_0xff13('0x7e')](_0xff13('0x108')),'ContactId':_0x435177[_0xff13('0xd6')],'ListId':_0x435177[_0xff13('0xd7')],'VoiceQueueId':_0x435177[_0xff13('0x101')]||undefined,'CampaignId':_0x435177['CampaignId']||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x102')));_0x108040({'reschedule':0x1});}}});}}};Dialer[_0xff13('0x1c')][_0xff13('0x109')]=function(_0x1bf7e5){var _0x5ea44d=this[_0xff13('0x29')][_0x1bf7e5[_0xff13('0xe1')]];var _0x378430;if(_0x5ea44d&&_0x5ea44d['type']==='ivr'){delete this[_0xff13('0x29')][_0x1bf7e5[_0xff13('0xe1')]];this[_0xff13('0xb7')](this[_0xff13('0x23')][_0x5ea44d['queue']]);this[_0xff13('0x23')][_0x5ea44d[_0xff13('0xb8')]]['ivrAnswerCallsDay']+=0x1;_0x378430=new Hangup(_0x5ea44d,_0x1bf7e5);this[_0xff13('0xd0')](_0x378430)['catch'](loggerCatch(_0xff13('0x10a')));this[_0xff13('0xcf')](_0x378430)[_0xff13('0xb4')](loggerCatch(_0xff13('0x10b')));}if(_0x5ea44d&&_0x5ea44d['type']!==_0xff13('0xb6')&&isNotNull(this[_0xff13('0x22')][_0x5ea44d['queue']][_0xff13('0x10c')])){delete this[_0xff13('0x29')][_0x1bf7e5[_0xff13('0xe1')]];this[_0xff13('0xb7')](this[_0xff13('0x22')][_0x5ea44d[_0xff13('0xb8')]]);this['voiceQueues'][_0x5ea44d[_0xff13('0xb8')]][_0xff13('0xef')]+=0x1;this['voiceQueues'][_0x5ea44d[_0xff13('0xb8')]][_0xff13('0x62')]+=0x1;_0x378430=new Hangup(_0x5ea44d,_0x1bf7e5);_0x378430['state']=0x10;_0x378430[_0xff13('0xaa')]=_0xff13('0x10d');_0x378430[_0xff13('0xea')]='AGI';this['createHistory'](_0x378430)[_0xff13('0xb4')](loggerCatch(_0xff13('0x10a')));this['moveContactManagedDialer'](_0x378430)['catch'](loggerCatch(_0xff13('0x10b')));}if(_0x5ea44d&&_0x5ea44d[_0xff13('0x53')]!==_0xff13('0xb6')&&!isNotNull(this['voiceQueues'][_0x5ea44d['queue']][_0xff13('0x10c')])){delete this[_0xff13('0x29')][_0x1bf7e5[_0xff13('0xe1')]];this[_0xff13('0xb7')](this[_0xff13('0x22')][_0x5ea44d[_0xff13('0xb8')]]);this[_0xff13('0x22')][_0x5ea44d[_0xff13('0xb8')]]['outboundUnknownCallsDay']+=0x1;_0x378430=new Hangup(_0x5ea44d,_0x1bf7e5);_0x378430[_0xff13('0xa9')]=0xc;_0x378430['statedesc']=_0x1bf7e5['cause-txt'];_0x378430[_0xff13('0xea')]=_0xff13('0x10e');this['createHistory'](_0x378430)[_0xff13('0xb4')](loggerCatch(_0xff13('0x10a')));this[_0xff13('0xcf')](_0x378430)[_0xff13('0xb4')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xff13('0x1c')][_0xff13('0x35')]=function(_0x1c342b){var _0xe67532=this[_0xff13('0x29')][_0x1c342b[_0xff13('0xe1')]];if(this[_0xff13('0x22')][_0x1c342b['queue']]){if(_0xe67532&&_0xe67532[_0xff13('0x53')]!==_0xff13('0xb6')){delete this[_0xff13('0x29')][_0x1c342b[_0xff13('0xe1')]];this[_0xff13('0x22')][_0x1c342b[_0xff13('0xb8')]][_0xff13('0xef')]+=0x1;var _0x55f1c4=new AgentComplete(_0xe67532,_0x1c342b);if(_0x1c342b[_0xff13('0x10f')]===_0xff13('0x110')){_0x55f1c4[_0xff13('0x111')]=this['voiceQueues'][_0x1c342b[_0xff13('0xb8')]][_0xff13('0x112')]&&this[_0xff13('0x22')][_0x1c342b[_0xff13('0xb8')]][_0xff13('0x113')]?moment()[_0xff13('0x7e')](_0xff13('0x108')):undefined;}this[_0xff13('0xd0')](_0x55f1c4)[_0xff13('0xb4')](loggerCatch(_0xff13('0x114')));this[_0xff13('0xcf')](_0x55f1c4)[_0xff13('0xb4')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xff13('0x1c')][_0xff13('0x2f')]=function(_0x51478b){if(this['voiceQueues'][_0x51478b[_0xff13('0xb8')]]){if(this[_0xff13('0x29')][_0x51478b[_0xff13('0xe1')]]&&this['uniqueId'][_0x51478b[_0xff13('0xe1')]][_0xff13('0x53')]!==_0xff13('0xb6')){this[_0xff13('0xb7')](this[_0xff13('0x22')][_0x51478b[_0xff13('0xb8')]]);this['uniqueId'][_0x51478b[_0xff13('0xe1')]][_0xff13('0x115')]=moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0xff13('0x116')]=function(_0x48b78a,_0x5656ca){this[_0xff13('0xd0')](_0x48b78a)[_0xff13('0xb4')](loggerCatch(_0xff13('0x114')));if(_0x5656ca==0x0){this[_0xff13('0xcf')](_0x48b78a)[_0xff13('0xb4')](loggerCatch(_0xff13('0x117')));}};Dialer[_0xff13('0x1c')][_0xff13('0x32')]=function(_0x2c6c49){var _0x4dac2f=this['uniqueId'][_0x2c6c49['uniqueid']];var _0x186ae7=this;var _0x9dd5dc=![];var _0x59017c;var _0x36e1e6;if(this[_0xff13('0x22')][_0x2c6c49['queue']]){if(_0x4dac2f&&_0x4dac2f['type']!==_0xff13('0xb6')){delete this[_0xff13('0x29')][_0x2c6c49[_0xff13('0xe1')]];this['updateOriginated'](this['voiceQueues'][_0x2c6c49['queue']]);_0x4dac2f[_0xff13('0x118')]=moment()[_0xff13('0x7e')](_0xff13('0x108'));var _0x687e75=new QueueCallerAbandon(_0x4dac2f,_0x2c6c49);if(getSeconds(_0x4dac2f['droptime'],_0x4dac2f[_0xff13('0x119')])>=_0x4dac2f['dialQueueTimeout']){this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x6f')]+=0x1;this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x11a')]+=0x1;this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x687e75[_0xff13('0xa9')]=0xa;_0x687e75[_0xff13('0xaa')]=_0xff13('0x11b');_0x687e75[_0xff13('0x11c')]=_0xff13('0x11d');_0x687e75['agiafterat']=this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]]['dialQueueProject2']?moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x687e75[_0xff13('0x104')]+=0x1;_0x687e75[_0xff13('0xf3')]+=0x1;_0x59017c=this['voiceQueues'][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x11e')];_0x36e1e6=this[_0xff13('0x22')][_0x2c6c49['queue']][_0xff13('0x11f')];_0x186ae7['verifyAdditionalPhones'](_0x687e75,_0x687e75['state'],_0x4dac2f[_0xff13('0x120')])[_0xff13('0xb9')](function(_0x48160d){_0x9dd5dc=_0x48160d[_0xff13('0x121')]==0x1;if(_0x687e75[_0xff13('0x104')]>=_0x186ae7[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x122')]){_0x186ae7[_0xff13('0x116')](_0x687e75,_0x48160d['additional']);}else{_0x186ae7[_0xff13('0xc5')]({'active':![],'countdropretry':_0x687e75[_0xff13('0x104')],'scheduledat':moment()[_0xff13('0xfe')](_0x186ae7[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x11e')],_0xff13('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4dac2f['ContactId'],'ListId':_0x4dac2f[_0xff13('0xd7')],'VoiceQueueId':_0x4dac2f['VoiceQueueId']||undefined,'CampaignId':_0x4dac2f[_0xff13('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x1c9d7a=new History(_0x687e75);_0x1c9d7a[_0xff13('0xa9')]=0xa;_0x1c9d7a[_0xff13('0xaa')]=_0xff13('0x11b');_0x1c9d7a[_0xff13('0x123')]=moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c9d7a['endtime']=_0x1c9d7a[_0xff13('0x123')];_0x1c9d7a[_0xff13('0x124')]=_0x687e75[_0xff13('0x124')];_0x1c9d7a[_0xff13('0x125')]=_0x687e75['calleridnum'];_0x186ae7[_0xff13('0xd0')](_0x1c9d7a)[_0xff13('0xb4')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x9dd5dc)_0x186ae7[_0xff13('0xc0')](_0x687e75,_0x59017c,_0x36e1e6)['then'](function(){return 0x1;});});}else{this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x87')]+=0x1;this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]]['outboundDropCallsDayCallersExit']+=0x1;_0x687e75[_0xff13('0xa9')]=0xb;_0x687e75['statedesc']='Abandoned';_0x687e75[_0xff13('0x11c')]='CALLEREXIT';_0x687e75['countabandonedretry']+=0x1;_0x687e75['countglobal']+=0x1;_0x59017c=this[_0xff13('0x22')][_0x2c6c49['queue']][_0xff13('0x126')];_0x36e1e6=this[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x11f')];_0x186ae7[_0xff13('0xbe')](_0x687e75,_0x687e75[_0xff13('0xa9')],_0x4dac2f[_0xff13('0x120')])['then'](function(_0x1bfd8c){if(_0x687e75[_0xff13('0xf9')]>=_0x186ae7['voiceQueues'][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x127')]){_0x186ae7[_0xff13('0x116')](_0x687e75,_0x1bfd8c[_0xff13('0x121')]);}else{_0x186ae7[_0xff13('0xc5')]({'active':![],'countabandonedretry':_0x687e75[_0xff13('0xf9')],'scheduledat':moment()[_0xff13('0xfe')](_0x186ae7[_0xff13('0x22')][_0x2c6c49[_0xff13('0xb8')]][_0xff13('0x126')],_0xff13('0x100'))['format'](_0xff13('0x108')),'ContactId':_0x4dac2f['ContactId'],'ListId':_0x4dac2f[_0xff13('0xd7')],'VoiceQueueId':_0x4dac2f[_0xff13('0x101')]||undefined,'CampaignId':_0x4dac2f['CampaignId']||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x128')));var _0x230f52=new History(_0x687e75);_0x230f52[_0xff13('0xa9')]=0xb;_0x230f52[_0xff13('0xaa')]=_0xff13('0x129');_0x230f52[_0xff13('0x123')]=moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x230f52['endtime']=_0x230f52[_0xff13('0x123')];_0x230f52['calleridname']=_0x687e75[_0xff13('0x124')];_0x230f52['calleridnum']=_0x687e75['calleridnum'];_0x186ae7[_0xff13('0xd0')](_0x230f52)['catch'](loggerCatch(_0xff13('0x12a')));}})[_0xff13('0xb9')](function(){if(_0x9dd5dc)_0x186ae7[_0xff13('0xc0')](_0x687e75,_0x59017c,_0x36e1e6)[_0xff13('0xb9')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xff13('0x3a')]=function(_0x194347){if(this['actions'][_0x194347['uniqueid']]){this['actions'][_0x194347[_0xff13('0xe1')]][_0xff13('0xb3')]=_0x194347[_0xff13('0xb3')];}if(this[_0xff13('0x29')][_0x194347['uniqueid']]){this['uniqueId'][_0x194347['uniqueid']][_0xff13('0xb3')]=_0x194347[_0xff13('0xb3')];}};Dialer[_0xff13('0x1c')][_0xff13('0x3d')]=function(_0x227449){if(strategy[this[_0xff13('0x22')][this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]]['queue']][_0xff13('0x55')]]===_0xff13('0x1b')){if(this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]]&&_[_0xff13('0xb0')](this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]][_0xff13('0x12c')])&&_0x227449[_0xff13('0xb2')]==='1'&&_0x227449[_0xff13('0x12d')]==='0'){if(this[_0xff13('0x24')][_0x227449[_0xff13('0x12e')]]){if(!this['agents'][_0x227449['stateinterface']][_0xff13('0x12c')]){this['agents'][_0x227449[_0xff13('0x12e')]][_0xff13('0x12c')]=!![];this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]][_0xff13('0x12c')]=!![];this[_0xff13('0x28')][_0x227449['actionid']][_0xff13('0x12e')]=_0x227449[_0xff13('0x12e')];}}}}else if((strategy[this[_0xff13('0x22')][this['actions'][_0x227449[_0xff13('0x12b')]][_0xff13('0xb8')]][_0xff13('0x55')]]||_0xff13('0x12f'))===_0xff13('0x12f')){if(this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]]){if(this[_0xff13('0x24')][_0x227449[_0xff13('0x12e')]]){this['actions'][_0x227449['actionid']]['stateinterface']=_0x227449['stateinterface'];if(_[_0xff13('0xb0')](this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x227449['actionid']][_0xff13('0xb8')]])){this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]][_0xff13('0xb8')]]=[];}this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x227449[_0xff13('0x12b')]][_0xff13('0xb8')]][_0xff13('0x130')](_['merge'](_['pick'](this['actions'][_0x227449[_0xff13('0x12b')]],[_0xff13('0x131'),'stateinterface']),{'status':_0x227449['status'],'paused':_0x227449[_0xff13('0x12d')]}));}}}};function unlockQueueStatus(_0x10f978,_0x49e736){setTimeout(function(){if(_[_0xff13('0x41')](_0x10f978[_0xff13('0x132')])){loggerBooked['error']('[unlockQueueStatus][undefined]',_0x49e736);}_0x10f978[_0xff13('0x132')]=!![];loggerBooked['info'](_0xff13('0x133'),_0x49e736,JSON[_0xff13('0x4e')](_[_0xff13('0xd5')](_0x10f978,[_0xff13('0x44'),_0xff13('0x132')])));},0x1f3);}Dialer[_0xff13('0x1c')][_0xff13('0x3e')]=function(_0x1a4d3b){var _0x25b451=this;var _0x568ecd=_0x25b451['voiceQueues'][_0x25b451[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xb8')]];if(strategy[this[_0xff13('0x22')][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xb8')]]['strategy']]===_0xff13('0x1b')){if(this[_0xff13('0x28')][_0x1a4d3b['actionid']]&&this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0x12e')]){this[_0xff13('0x21')][_0xff13('0x134')](this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0x131')],this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['stateinterface'])[_0xff13('0xb4')](function(_0x3a9151){logger[_0xff13('0x9a')](_0xff13('0x135'),util[_0xff13('0x99')](_0x3a9151,{'showHidden':![],'depth':null}));})[_0xff13('0x1f')](function(){_0x25b451[_0xff13('0xb7')](_0x25b451[_0xff13('0x22')][_0x25b451['actions'][_0x1a4d3b['actionid']]['queue']]);_0x25b451['agents'][_0x25b451[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['stateinterface']][_0xff13('0x12c')]=![];delete _0x25b451[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]];unlockQueueStatus(_0x568ecd);});}else{this[_0xff13('0xb7')](this[_0xff13('0x22')][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['queue']]);this[_0xff13('0xc5')]({'active':![],'ContactId':this['actions'][_0x1a4d3b['actionid']][_0xff13('0xd6')],'ListId':this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xd7')],'VoiceQueueId':this['actions'][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0x101')]||undefined,'CampaignId':this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xd9')]||undefined})['catch'](loggerCatch(_0xff13('0x136')));delete this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]];unlockQueueStatus(_0x568ecd);}}else if((strategy[this[_0xff13('0x22')][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['queue']][_0xff13('0x55')]]||_0xff13('0x12f'))===_0xff13('0x12f')){var _0x26dc23;if(this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]&&!_[_0xff13('0x4c')](this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x1a4d3b['actionid']]['queue']])){if(this[_0xff13('0x137')][_0x25b451[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xb8')]]){this[_0xff13('0x137')][_0x25b451['actions'][_0x1a4d3b['actionid']][_0xff13('0xb8')]]=this[_0xff13('0x137')][this[_0xff13('0x28')][_0x1a4d3b['actionid']][_0xff13('0xb8')]]?this['queueBookedRR'][this['actions'][_0x1a4d3b[_0xff13('0x12b')]]['queue']]:this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]][_0xff13('0xb8')]]?this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['queue']][_0xff13('0x138')]||0x0:0x0;}this[_0xff13('0x2d')][this[_0xff13('0x28')][_0x1a4d3b['actionid']][_0xff13('0xb8')]][_0xff13('0x138')]=this['queueBookedRR'][this[_0xff13('0x28')][_0x1a4d3b[_0xff13('0x12b')]]['queue']];for(var _0x52f662=0x0;_0x52f662=0x0;})[_0xff13('0xb4')](myreject(_0x2b7102)));}}else{_0x180444['push'](ami['Action']({'action':_0xff13('0x151'),'command':util[_0xff13('0x7e')](_0xff13('0x156'),_0x2b23b1,!_[_0xff13('0x41')](config['timezones'][_0x3e8845])?_0x3e8845:'')})[_0xff13('0xb9')](function(_0x11da83){return _0x11da83['content'][_0xff13('0x154')]('true')>=0x0;})['catch'](myreject(_0x2b7102)));}Promise[_0xff13('0x157')](_0x180444)[_0xff13('0xb9')](function(_0x49335b){var _0x2c5750=_[_0xff13('0x158')](_0x49335b);if(_0x2c5750){return _0x4d5d16(_0x2c5750);}else{_0x1a8de3[_0xff13('0x42')]=_0x2c9a8c?'GLOBAL_INTERVAL_IS_OVERTIME':_0xff13('0x159');return _0x2b7102(msgResponse(_0xff13('0x15a'),_0xff13('0x14b'),_0xff13('0x15b')+_0x2c9a8c+'\x20'+_0x4bb609+_0xff13('0x15c')+util['inspect'](_0x2b23b1,{'showHidden':![],'depth':null})+_0xff13('0x15d')+_0x3e8845));}})[_0xff13('0xb4')](function(_0x6ec10c){return _0x2b7102(msgResponse('ifTime',_0xff13('0x14b'),JSON[_0xff13('0x4e')](_0x6ec10c)));});});};Dialer[_0xff13('0x1c')][_0xff13('0x15e')]=function(_0x9d658c){var _0x4996cb=this;return function(){switch(_0x9d658c[_0xff13('0x5d')]){case _0xff13('0x15f'):freeVariablesPredictive(_0x9d658c);_0x4996cb[_0xff13('0x160')](_0x9d658c,0x1);break;case _0xff13('0x161'):freeVariablesPredictive(_0x9d658c);_0x4996cb['handlePower'](_0x9d658c,_0x9d658c[_0xff13('0x162')]);break;case'predictive':_0x4996cb[_0xff13('0x163')](_0x9d658c);break;case'booked':freeVariablesPredictive(_0x9d658c);_0x4996cb[_0xff13('0x160')](_0x9d658c,0x1);break;default:freeVariablesPredictive(_0x9d658c);logger[_0xff13('0x9a')]('Queue',_0x9d658c[_0xff13('0x44')],_0xff13('0x164'));}};};Dialer[_0xff13('0x1c')][_0xff13('0x165')]=function(_0x633989){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopper[_0xff13('0x166')](_0x633989['id'],previewRecallmeReminderInterval))['then'](function(_0x2a67e9){for(var _0x1ac76d=0x0;_0x1ac76d<_0x2a67e9[_0xff13('0x9b')];_0x1ac76d++){var _0x2d8de0=_0x2a67e9[_0x1ac76d][_0xff13('0x167')][_0xff13('0x44')];if(_0x2d8de0)io['to'](util[_0xff13('0x7e')](_0xff13('0x168'),_0x2d8de0))[_0xff13('0x52')](_0xff13('0x169'),{'hopper':_0x2a67e9[_0x1ac76d]});}})[_0xff13('0xb4')](function(){});};Dialer['prototype'][_0xff13('0x16a')]=function(_0x4727c5){var _0x4c5561=this;return function(){_0x4c5561['handleIvr'](_0x4727c5);};};Dialer['prototype'][_0xff13('0xb')]=function(_0x3344f0){var _0xdbb5f8=this;if(isNotPreview(_0x3344f0[_0xff13('0x5d')])){if(isVoiceQueueOutbound(_0x3344f0[_0xff13('0x53')])&&isActive(_0x3344f0[_0xff13('0x5c')])){_0x3344f0[_0xff13('0xa2')]=!![];Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](checkIsLoggedIn(_0x3344f0,_0x3344f0[_0xff13('0x16b')]))['then'](checkIsActive(_0x3344f0,_0x3344f0[_0xff13('0x5c')]))['then'](checkInterval(_0x3344f0))[_0xff13('0xb9')](_0xdbb5f8[_0xff13('0x145')](_0x3344f0))[_0xff13('0xb9')](_0xdbb5f8['checkIfTime'](_0x3344f0[_0xff13('0x16c')],_0x3344f0[_0xff13('0x16d')],_0x3344f0[_0xff13('0x44')],_0x3344f0))[_0xff13('0xb9')](_0xdbb5f8[_0xff13('0x14a')](_0x3344f0[_0xff13('0x48')],_0x3344f0[_0xff13('0x16d')],_0x3344f0[_0xff13('0x44')],_0x3344f0))[_0xff13('0xb9')](_0xdbb5f8[_0xff13('0x15e')](_0x3344f0))[_0xff13('0xb4')](loggerCatchQueueSummary(_0xff13('0x16e'),_0x3344f0));}else{notSendMessagesQueue(_0x3344f0);}}else{freeVariablesPredictive(_0x3344f0);}};Dialer['prototype'][_0xff13('0x16f')]=_[_0xff13('0x170')](function(){var _0x6ec393=_[_0xff13('0x171')](this[_0xff13('0x22')],function(_0x39f0e0){return _0x39f0e0[_0xff13('0x172')];});var _0x1f5567=_[_0xff13('0x171')](this[_0xff13('0x24')],function(_0x3acc27){return _0x3acc27[_0xff13('0x173')]&&_0x3acc27[_0xff13('0xb2')]===_0xff13('0xdf');});if(_0x6ec393[_0xff13('0x9b')]>0x0&&_0x1f5567['length']>0x0){return Promise[_0xff13('0xbd')]()[_0xff13('0xb9')](cmHopper[_0xff13('0x166')](_[_0xff13('0x174')](_0x6ec393,'id'),previewRecallmeReminderInterval,_[_0xff13('0x174')](_0x1f5567,'id')))['then'](function(_0x50d204){for(var _0x41ec7e=0x0;_0x41ec7e<_0x50d204[_0xff13('0x9b')];_0x41ec7e++){var _0x37811a=_0x50d204[_0x41ec7e][_0xff13('0x167')][_0xff13('0x44')];if(_0x37811a)io['to'](util['format'](_0xff13('0x168'),_0x37811a))[_0xff13('0x52')]('user:dialPreviewRecallReminder',{'hopper':_0x50d204[_0x41ec7e]});}})['catch'](function(_0x5a7ceb){logger['error']('checkPreviewRecallReminder',_0x5a7ceb);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xff13('0x1c')][_0xff13('0x144')]=function(){var _0x53ba28=this;var _0x20917b;for(var _0x22eb71 in this[_0xff13('0x23')]){if(typeof this[_0xff13('0x23')][_0x22eb71]!==_0xff13('0xaf')){_0x20917b=this[_0xff13('0x23')][_0x22eb71];if(isCampaignIvr(_0x20917b[_0xff13('0x53')])&&isActive(_0x20917b['active'])){_0x20917b[_0xff13('0xa2')]=!![];Promise['resolve']()[_0xff13('0xb9')](checkIsActive(_0x20917b,_0x20917b[_0xff13('0xdd')]))[_0xff13('0xb9')](checkInterval(_0x20917b))['then'](_0x53ba28[_0xff13('0x145')](_0x20917b))['then'](_0x53ba28[_0xff13('0x175')](_0x20917b['dialGlobalInterval'],_0x20917b[_0xff13('0x16d')],_0x20917b['name'],_0x20917b))[_0xff13('0xb9')](_0x53ba28['checkIfTimeIntervals'](_0x20917b[_0xff13('0x48')],_0x20917b[_0xff13('0x16d')],_0x20917b['name'],_0x20917b))[_0xff13('0xb9')](_0x53ba28[_0xff13('0x16a')](_0x20917b))[_0xff13('0xb4')](loggerCatchQueueSummary(_0xff13('0x176'),_0x20917b));}else{notSendMessagesCampaign(_0x20917b);}}}};function getCallerIdRandom(_0x474a6d,_0x1d12f5){var _0x14f1b8;var _0x267dc4;var _0x3ade9b;if(_0x1d12f5<=0x0){_0x1d12f5=0x1;}_0x14f1b8=new RegExp('\x5cw{0,'+_0x1d12f5+'}$');_0x267dc4=Math[_0xff13('0x177')](0xa,_0x1d12f5-0x1);_0x3ade9b=Math['pow'](0xa,_0x1d12f5)-0x1;return util[_0xff13('0x7e')]('%s',_['replace'](_0x474a6d,_0x14f1b8,_[_0xff13('0x178')](_0x267dc4,_0x3ade9b)));}function extractCalleridName(_0x13a00d){var _0x40ac30=_0x13a00d['match'](/"(.*?)"/);return _0x40ac30?_0x40ac30[0x1]:_0x13a00d;}Dialer[_0xff13('0x1c')][_0xff13('0x179')]=function(_0x3b297f,_0x4c4454){var _0x391f46=this;var _0x598dad=uuid['v4']();this[_0xff13('0x28')][_0x598dad]=new Action(_0x3b297f,_0x4c4454,_0x598dad);return new Promise(function(_0x33797a,_0x532fad){if(_['isUndefined'](_0x3b297f)&&typeof _0x3b297f!=='object'){return _0x532fad(msgResponse(_0xff13('0x17a'),_0xff13('0x14b'),_0xff13('0x17b')));}if(_['isUndefined'](_0x4c4454[_0xff13('0x17c')])||_0x4c4454['phone']===null){return _0x532fad(msgResponse(_0xff13('0x17a'),_0xff13('0x14b'),_0xff13('0x17d')));}var _0x31073a={'XMD-CALLERID':_0x391f46[_0xff13('0x28')][_0x598dad][_0xff13('0x17e')](),'XMD-AGI':_0x3b297f[_0xff13('0x10c')]?util[_0xff13('0x7e')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3b297f['dialQueueProject']):_0xff13('0x17f'),'XMD-AGIAFTER':_0x3b297f[_0xff13('0x112')]?util[_0xff13('0x7e')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3b297f[_0xff13('0x112')]):'NONE','XMD-QUEUE':_0x3b297f[_0xff13('0x53')]===_0xff13('0x54')?util[_0xff13('0x7e')](_0xff13('0x180'),_0x3b297f['name'],_0x3b297f[_0xff13('0x181')]||'',_0x3b297f[_0xff13('0x113')]?'c':'',_0x3b297f[_0xff13('0x182')]||0x3):_0xff13('0x17f'),'XMD-CONTACTID':_0x4c4454[_0xff13('0xd6')],'XMD-CDRTYPE':_0xff13('0x8'),'CALLERID(all)':_0x391f46[_0xff13('0x28')][_0x598dad][_0xff13('0x17e')](),'XMD-AMD':_0x3b297f[_0xff13('0xe6')]?_0xff13('0x183'):_0xff13('0x17f'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x3b297f[_0xff13('0xe6')]){_0x31073a[_0xff13('0x184')]=_0x3b297f[_0xff13('0x185')]||0x9c4;_0x31073a[_0xff13('0x186')]=_0x3b297f[_0xff13('0x187')]||0x5dc;_0x31073a[_0xff13('0x188')]=_0x3b297f[_0xff13('0x189')]||0x320;_0x31073a[_0xff13('0x18a')]=_0x3b297f[_0xff13('0x18b')]||0x1388;_0x31073a[_0xff13('0x18c')]=_0x3b297f[_0xff13('0x18d')]||0x64;_0x31073a['XMD-AMDBETWEENWORDSSILENCE']=_0x3b297f[_0xff13('0x18e')]||0x32;_0x31073a[_0xff13('0x18f')]=_0x3b297f['dialAMDMaximumNumberOfWords']||0x3;_0x31073a[_0xff13('0x190')]=_0x3b297f[_0xff13('0x191')]||0x100;_0x31073a[_0xff13('0x192')]=_0x3b297f['dialAMDMaximumWordLength']||0x1388;}if(_0x3b297f['type']===_0xff13('0x54')){_0x31073a['XMD-VOICEQUEUEID']=_0x4c4454[_0xff13('0x101')];}else{_0x31073a[_0xff13('0x193')]=_0x4c4454[_0xff13('0xd9')];}for(var _0x52631a in _0x4c4454[_0xff13('0x194')]){if(typeof _0x4c4454[_0xff13('0x194')][_0x52631a]!==_0xff13('0xaf')){if(isNotNull(_0x4c4454[_0xff13('0x194')][_0x52631a])&&_0x52631a!=='id'&&_0x52631a!==_0xff13('0x195')&&_0x52631a!==_0xff13('0x196')&&_0x52631a!==_0xff13('0x197')){_0x31073a[util[_0xff13('0x7e')]('%s%s',_0xff13('0x198'),_[_0xff13('0x199')](_0x52631a))]=_0x4c4454[_0xff13('0x194')][_0x52631a];}}}var _0xeccb22=_0x391f46[_0xff13('0xdc')](_0x3b297f[_0xff13('0x7b')])?getCallerId(_0x3b297f['Trunk'][_0xff13('0x7c')],_0x3b297f[_0xff13('0x5e')],_0x3b297f[_0xff13('0x19a')]>0x0?getCallerIdRandom(_0x3b297f[_0xff13('0x5f')],_0x3b297f[_0xff13('0x19a')]):_0x3b297f['dialOriginateCallerIdNumber']):getCallerId(_[_0xff13('0xb0')](_0x3b297f['TrunkBackup'])?_0x3b297f['Trunk'][_0xff13('0x7c')]:_0x3b297f['TrunkBackup']['callerid'],_0x3b297f[_0xff13('0x5e')],_0x3b297f['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3b297f[_0xff13('0x5f')],_0x3b297f[_0xff13('0x19a')]):_0x3b297f[_0xff13('0x5f')]);if(_0xeccb22){_0x31073a['XMD-ORIGINATECALLERIDNAME']=_0x391f46[_0xff13('0x28')][_0x598dad][_0xff13('0x19b')]=extractCalleridName(_0xeccb22);_0x31073a[_0xff13('0x19c')]=_0x4c4454[_0xff13('0x17c')];}_0x3b297f['variables']=_0x31073a;return ami[_0xff13('0xb1')]({'actionid':_0x598dad,'action':'originate','channel':_0x391f46[_0xff13('0xdc')](_0x3b297f[_0xff13('0x7b')])?util[_0xff13('0x7e')]('SIP/%s/%s%s',_0x3b297f[_0xff13('0x7b')]['name'],isNotNull(_0x3b297f[_0xff13('0x61')])?_0x3b297f['dialPrefix'][_0xff13('0x19d')]()||'':'',_0x3b297f[_0xff13('0x19e')]>0x0?_0x4c4454[_0xff13('0x17c')][_0xff13('0x19f')](_0x3b297f[_0xff13('0x19e')]):_0x4c4454[_0xff13('0x17c')]):util[_0xff13('0x7e')](_0xff13('0x1a0'),_[_0xff13('0xb0')](_0x3b297f[_0xff13('0x146')])?_0x3b297f[_0xff13('0x7b')][_0xff13('0x44')]:_0x3b297f[_0xff13('0x146')][_0xff13('0x44')],isNotNull(_0x3b297f[_0xff13('0x61')])?_0x3b297f[_0xff13('0x61')]['trim']()||'':'',_0x3b297f[_0xff13('0x19e')]>0x0?_0x4c4454[_0xff13('0x17c')][_0xff13('0x19f')](_0x3b297f[_0xff13('0x19e')]):_0x4c4454[_0xff13('0x17c')]),'callerid':_0xeccb22,'Exten':_0xff13('0xe5'),'Context':_0xff13('0x1a1'),'Priority':'1','variable':_0x31073a,'timeout':(_0x3b297f[_0xff13('0x60')]||0x1e)*0x3e8,'async':!![],'channelid':_0x598dad})[_0xff13('0xb9')](function(_0x5281af){return _0x33797a(_0x5281af);})[_0xff13('0xb4')](function(_0x40ebfa){_0x3b297f['outboundOriginateFailureCallsDay']+=0x1;var _0x572347=new History(_0x391f46[_0xff13('0x28')][_0x598dad]);logger[_0xff13('0x9a')](util[_0xff13('0x7e')](_0xff13('0x1a2'),JSON[_0xff13('0x4e')](_0x40ebfa)));_0x572347['state']=0xe;_0x572347[_0xff13('0xaa')]=_0xff13('0x1a3');_0x572347['starttime']=moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0x572347[_0xff13('0xab')]=_0x572347[_0xff13('0x123')];_0x391f46[_0xff13('0xd0')](_0x572347)[_0xff13('0xb4')](loggerCatch(_0xff13('0x1a4')));_0x391f46['moveContactManagedDialer'](_0x572347)[_0xff13('0xb4')](loggerCatch('[originate][error]'))[_0xff13('0x1f')](function(){delete _0x391f46[_0xff13('0x28')][_0x598dad];return _0x532fad(msgResponse(_0xff13('0x17a'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0xff13('0x1c')]['syncOriginateResponse']=function(_0x5cb785){var _0x3a5b7e=this[_0xff13('0x28')][_0x5cb785['actionid']];if(_0x3a5b7e){delete this[_0xff13('0x28')][_0x5cb785[_0xff13('0x12b')]];_0x3a5b7e[_0xff13('0x119')]=moment()[_0xff13('0x7e')](_0xff13('0x108'));var _0x548ac5=_0x3a5b7e[_0xff13('0x53')]===_0xff13('0xb6')?this['campaigns'][_0x3a5b7e[_0xff13('0xb8')]]:this[_0xff13('0x22')][_0x3a5b7e['getQueue']()];if(!this['isSuccess'](_0x5cb785['response'])){this[_0xff13('0xb7')](_0x548ac5);return this[_0xff13('0x1a5')](_0x3a5b7e,_0x548ac5,_0x5cb785)[_0xff13('0xb4')](loggerCatch(_0xff13('0x1a6')));}this[_0xff13('0x29')][_0x5cb785['uniqueid']]=_0x3a5b7e;}};Dialer['prototype'][_0xff13('0x1a7')]=function(_0x2c089a,_0x2b5e0d,_0x276729){var _0xcb46d3=new History(_0x2b5e0d);if(_0xcb46d3['countbusyretry']+_0xcb46d3[_0xff13('0xf6')]+_0xcb46d3[_0xff13('0xf7')]+_0xcb46d3[_0xff13('0xf8')]+_0xcb46d3['countdropretry']+_0xcb46d3[_0xff13('0xf9')]+_0xcb46d3[_0xff13('0xf2')]+_0xcb46d3[_0xff13('0x105')]>=_0x276729[_0xff13('0x106')]-0x1){return!![];}switch(_0x2c089a){case 0x3:if(_0xcb46d3[_0xff13('0xf7')]>=_0x276729[_0xff13('0x1a8')]-0x1){return!![];}this[_0xff13('0xc5')]({'active':![],'countnoanswerretry':_0xcb46d3[_0xff13('0xf7')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729[_0xff13('0x1a9')],'minutes')['format'](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3['ListId'],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3['CampaignId']||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x1aa')));break;case 0x5:if(_0xcb46d3[_0xff13('0xf5')]>=_0x276729['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0xcb46d3[_0xff13('0xf5')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729[_0xff13('0x1ab')],_0xff13('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3['VoiceQueueId']||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})['catch'](loggerCatch(_0xff13('0x1ac')));break;case 0x8:if(_0xcb46d3[_0xff13('0xf6')]>=_0x276729[_0xff13('0x1ad')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0xcb46d3[_0xff13('0xf6')]+=0x1,'scheduledat':moment()['add'](_0x276729[_0xff13('0x1ae')],'minutes')[_0xff13('0x7e')](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})['catch'](loggerCatch(_0xff13('0x1af')));break;case 0x0:if(_0xcb46d3['countnosuchnumberretry']>=_0x276729[_0xff13('0x1b0')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0xcb46d3[_0xff13('0xf8')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729[_0xff13('0x1b1')],'minutes')[_0xff13('0x7e')](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0xcb46d3[_0xff13('0x104')]>=_0x276729[_0xff13('0x122')]-0x1){return!![];}this[_0xff13('0xc5')]({'active':![],'countdropretry':_0xcb46d3[_0xff13('0x104')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729['dialDropRetryFrequency'],_0xff13('0x100'))['format'](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x1b2')));break;case 0xb:if(_0xcb46d3[_0xff13('0xf9')]>=_0x276729['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xff13('0xc5')]({'active':![],'countabandonedretry':_0xcb46d3[_0xff13('0xf9')]+=0x1,'scheduledat':moment()['add'](_0x276729['dialAbandonedRetryFrequency'],_0xff13('0x100'))[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xcb46d3['ContactId'],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})['catch'](loggerCatch(_0xff13('0x128')));break;case 0x13:if(_0xcb46d3[_0xff13('0xf2')]>=_0x276729[_0xff13('0xfb')]-0x1){return!![];}this[_0xff13('0xc5')]({'active':![],'countmachineretry':_0xcb46d3[_0xff13('0xf2')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729[_0xff13('0xff')],_0xff13('0x100'))['format'](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3[_0xff13('0xd7')],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xcb46d3[_0xff13('0x105')]>=_0x276729['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xff13('0xc5')]({'active':![],'countagentrejectretry':_0xcb46d3[_0xff13('0x105')]+=0x1,'scheduledat':moment()[_0xff13('0xfe')](_0x276729[_0xff13('0x1b3')],_0xff13('0x100'))[_0xff13('0x7e')](_0xff13('0x108')),'ContactId':_0xcb46d3[_0xff13('0xd6')],'ListId':_0xcb46d3['ListId'],'VoiceQueueId':_0xcb46d3[_0xff13('0x101')]||undefined,'CampaignId':_0xcb46d3[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x1b4')));break;default:return!![];}};Dialer['prototype'][_0xff13('0x1a5')]=function(_0x21140b,_0x5a31a6,_0x50451f){var _0x39226f=this;var _0x52bc6b=new History(_0x21140b);var _0x16907c=![];var _0x2c99a3;var _0x1764a4;return new Promise(function(_0x3e721b,_0x4badfe){if(_[_0xff13('0x41')](_0x5a31a6)&&typeof _0x5a31a6!==_0xff13('0x1b5')){return _0x4badfe(msgResponse(_0xff13('0x1b6'),'Failure',_0xff13('0x1b7')));}if(_[_0xff13('0x41')](_0x50451f)&&typeof _0x50451f!==_0xff13('0x1b5')){return _0x4badfe(msgResponse(_0xff13('0x1b6'),_0xff13('0x14b'),'evt\x20is\x20undefine'));}_0x39226f[_0xff13('0xbe')](_0x52bc6b,_0x50451f['reason'],_0x5a31a6)[_0xff13('0xb9')](function(_0x8647c5){if(_0x8647c5['additional']==0x1)_0x16907c=!![];switch(_0x50451f[_0xff13('0x10f')]){case'0':_0x5a31a6['outboundNoSuchCallsDay']+=0x1;_0x52bc6b[_0xff13('0xa9')]=0x0;_0x52bc6b[_0xff13('0xaa')]=_0xff13('0x1b8');_0x52bc6b[_0xff13('0xf8')]+=0x1;_0x52bc6b[_0xff13('0xf3')]+=0x1;ami['emit'](_0xff13('0x1b9'),ut[_0xff13('0xec')](_0x21140b,_0xff13('0x1ba')));_0x2c99a3=_0x5a31a6[_0xff13('0x1b1')];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];_0x39226f['createHistory'](_0x52bc6b)[_0xff13('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x39226f['checkRetriveMax'](0x0,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b[_0xff13('0xf8')]>=_0x5a31a6[_0xff13('0x1b0')]){_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,'reason\x200\x20no\x20such\x20number....');}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1bb'));}}break;case'3':_0x5a31a6[_0xff13('0x68')]+=0x1;_0x52bc6b[_0xff13('0xa9')]=0x3;_0x52bc6b[_0xff13('0xaa')]='NoAnswer';_0x52bc6b[_0xff13('0xf7')]+=0x1;_0x52bc6b[_0xff13('0xf3')]+=0x1;var _0x2a81cd=ut[_0xff13('0x1bc')](_0x21140b,_0x5a31a6);ami[_0xff13('0x52')]('custom:agentnoanswer',_0x2a81cd);_0x2c99a3=_0x5a31a6['dialNoAnswerRetryFrequency'];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];_0x39226f[_0xff13('0xd0')](_0x52bc6b)[_0xff13('0xb4')](loggerCatch(_0xff13('0x1bd')));if(_0x39226f[_0xff13('0x1a7')](0x3,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b[_0xff13('0xf7')]>=_0x5a31a6[_0xff13('0x1a8')]){_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1be'));}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x5a31a6[_0xff13('0x64')]+=0x1;_0x52bc6b[_0xff13('0xa9')]=0x5;_0x52bc6b[_0xff13('0xaa')]=_0xff13('0x1bf');_0x52bc6b['countbusyretry']+=0x1;_0x52bc6b['countglobal']+=0x1;ami['emit'](_0xff13('0x1c0'),ut[_0xff13('0xec')](_0x21140b,'busy'));_0x2c99a3=_0x5a31a6[_0xff13('0x1ab')];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];_0x39226f[_0xff13('0xd0')](_0x52bc6b)[_0xff13('0xb4')](loggerCatch(_0xff13('0x1c1')));if(_0x39226f[_0xff13('0x1a7')](0x5,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b[_0xff13('0xf5')]>=_0x5a31a6['dialBusyMaxRetry']){_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c2'));}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c2'));}}break;case'8':_0x5a31a6[_0xff13('0x65')]+=0x1;_0x52bc6b[_0xff13('0xa9')]=0x8;_0x52bc6b[_0xff13('0xaa')]=_0xff13('0x1c3');_0x52bc6b[_0xff13('0xf6')]+=0x1;_0x52bc6b[_0xff13('0xf3')]+=0x1;_0x2c99a3=_0x5a31a6[_0xff13('0x1ae')];_0x1764a4=_0x5a31a6['callAdditionalPhoneAfterMin'];ami[_0xff13('0x52')](_0xff13('0x1c4'),ut[_0xff13('0xec')](_0x21140b,_0xff13('0x1c5')));_0x39226f[_0xff13('0xd0')](_0x52bc6b)[_0xff13('0xb4')](loggerCatch(_0xff13('0x1c6')));if(_0x39226f[_0xff13('0x1a7')](0x8,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b['countcongestionretry']>=_0x5a31a6['dialCongestionMaxRetry']){_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c7'));}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c7'));}}break;case'11':_0x5a31a6['outboundAbandonedCallsDay']+=0x1;_0x52bc6b[_0xff13('0xa9')]=0xb;_0x52bc6b[_0xff13('0xaa')]=_0xff13('0x129');_0x52bc6b['countabandonedretry']+=0x1;_0x52bc6b[_0xff13('0xf3')]+=0x1;_0x2c99a3=_0x5a31a6[_0xff13('0x126')];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];_0x39226f['createHistory'](_0x52bc6b)['catch'](loggerCatch(_0xff13('0x12a')));if(_0x39226f[_0xff13('0x1a7')](0xb,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b[_0xff13('0xf9')]>=_0x5a31a6['dialAbandonedMaxRetry']){_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c8'));}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1c8'));}}break;case'20':_0x5a31a6['outboundRejectCallsDay']+=0x1;_0x52bc6b[_0xff13('0xa9')]=0x14;_0x52bc6b[_0xff13('0xaa')]='AgentReject';_0x52bc6b['countagentrejectretry']+=0x1;_0x52bc6b[_0xff13('0xf3')]+=0x1;_0x2c99a3=_0x5a31a6['dialAgentRejectRetryFrequency'];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];ami[_0xff13('0x52')](_0xff13('0x1c9'),ut['buildObj'](_0x21140b,_0xff13('0x1ca')));_0x39226f['createHistory'](_0x52bc6b)[_0xff13('0xb4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x39226f['checkRetriveMax'](0x14,_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b[_0xff13('0x105')]>=_0x5a31a6[_0xff13('0x1cb')]){_0x39226f['createStateFinal'](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1cc'));}else{_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0xff13('0x1cc'));}}break;default:_0x5a31a6[_0xff13('0x6b')]+=0x1;_0x52bc6b[_0xff13('0xa9')]=0xc;_0x52bc6b[_0xff13('0xaa')]=_0x50451f[_0xff13('0x10f')];_0x2c99a3=_0x5a31a6['dialAgentRejectRetryFrequency'];_0x1764a4=_0x5a31a6[_0xff13('0x11f')];_0x39226f[_0xff13('0xd0')](_0x52bc6b)['catch'](loggerCatch(_0xff13('0x1cd')));if(_0x39226f[_0xff13('0x1a7')](_0x50451f['reason'],_0x21140b,_0x5a31a6)&&!_0x16907c){if(_0x52bc6b['countbusyretry']+_0x52bc6b[_0xff13('0xf6')]+_0x52bc6b[_0xff13('0xf7')]+_0x52bc6b[_0xff13('0xf8')]+_0x52bc6b[_0xff13('0x104')]+_0x52bc6b['countabandonedretry']+_0x52bc6b['countmachineretry']+_0x52bc6b[_0xff13('0x105')]>=_0x5a31a6[_0xff13('0x106')]){_0x39226f[_0xff13('0x107')](_0x52bc6b,_0x3e721b,_0x4badfe,_0x50451f[_0xff13('0x10f')]);}else{_0x39226f[_0xff13('0xfc')](_0x52bc6b,_0x3e721b,_0x4badfe,_0x50451f[_0xff13('0x10f')]);}}}})['then'](function(){if(_0x16907c){_0x39226f[_0xff13('0xc0')](_0x52bc6b,_0x2c99a3,_0x1764a4)[_0xff13('0xb9')](function(){return _0x3e721b(0x1);});}});});};Dialer['prototype'][_0xff13('0x107')]=function(_0x591797,_0x2dfaaf,_0x32bdaf,_0x1a8ed7){var _0x28690c=new Final(_0x591797);_0x28690c['state']=0xf;_0x28690c['statedesc']=_0xff13('0x1ce');this[_0xff13('0xfc')](_0x28690c,_0x2dfaaf,_0x32bdaf,_0x1a8ed7);};Dialer[_0xff13('0x1c')][_0xff13('0xfc')]=function(_0x374065,_0x4719f3,_0x23a4e3,_0x3c8c27){this[_0xff13('0xcf')](_0x374065)[_0xff13('0xb9')](function(){return _0x4719f3(msgResponse(_0xff13('0x1b6'),_0xff13('0xdb'),_0x3c8c27));})[_0xff13('0xb4')](function(){return _0x23a4e3(msgResponse(_0xff13('0x1cf'),'Failure',_0xff13('0x1d0')));});};Dialer[_0xff13('0x1c')][_0xff13('0x163')]=function(_0x554b0b){var _0x1dd172=_0x554b0b['dialPredictiveOptimizationPercentage']/0x64;var _0x349c3b=_0x554b0b[_0xff13('0x11a')]/(_0x554b0b[_0xff13('0x11a')]+_0x554b0b[_0xff13('0xef')]);var _0x446f7a=Math['round'](_0x554b0b[_0xff13('0x74')]*(_0x554b0b[_0xff13('0x1d1')]/0x64));var _0x247e98=Math['round'](_0x554b0b[_0xff13('0x74')]*(_0x554b0b['predictiveIntervalMinThreshold']/0x64));var _0x49c22d=_0x554b0b[_0xff13('0x57')]+_0x554b0b[_0xff13('0x5b')];var _0x44233f=Math[_0xff13('0x1d2')](_0x554b0b['erlangCalls']*_0x554b0b['erlangAbandonmentRate']*_0x554b0b[_0xff13('0x71')]*_0x554b0b['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x554b0b[_0xff13('0x7a')])){if(!_['isUndefined'](_0x554b0b['startPredictive'])){_0x554b0b[_0xff13('0x2b')]=undefined;loggerPredictive[_0xff13('0x9a')]('[startMethodPredictive][StartProgressive]',_0xff13('0x1d3'));}if(!_[_0xff13('0x41')](_0x554b0b[_0xff13('0x94')])){loggerPredictive[_0xff13('0x9a')](_0xff13('0x1d4'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x554b0b[_0xff13('0x94')]);_0x554b0b[_0xff13('0x94')]=undefined;}_0x554b0b['startProgressive']=moment()['format'](_0xff13('0x108'));loggerPredictive[_0xff13('0x82')](_0x554b0b[_0xff13('0x44')],_0xff13('0x1d5'),_0x554b0b['startProgressive']);this[_0xff13('0x160')](_0x554b0b,0x1);}else if(ifInterval(_0x554b0b['dialPredictiveInterval'],_0x554b0b[_0xff13('0x7a')])){this['handlePower'](_0x554b0b,0x1);loggerPredictiveCalls[_0xff13('0x82')]('[startMethodPredictive][StartProgressive][Loop]',_0x554b0b[_0xff13('0x7a')],_0x554b0b[_0xff13('0x44')]);_0x554b0b['erlangCalls']=0x0;_0x554b0b[_0xff13('0x70')]=0x0;}else if(_0x1dd172<_0x349c3b&&_0x554b0b['dialPredictiveOptimization']===_0xff13('0x1d6')){freeVariablesPredictive(_0x554b0b);loggerPredictive[_0xff13('0x82')](_0xff13('0x1d7'),_0xff13('0x1d8'),_0x349c3b,_0xff13('0x7a'),_0x554b0b[_0xff13('0x44')]);}else if(_0x44233f<_0x554b0b[_0xff13('0x70')]&&_0x554b0b['dialPredictiveOptimization']===_0xff13('0x1d6')){freeVariablesPredictive(_0x554b0b);loggerPredictive[_0xff13('0x82')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xff13('0x1d9'),_0x44233f,_0xff13('0x1da'),_0x554b0b[_0xff13('0x70')],_0xff13('0x7a'),_0x554b0b['name']);}else if(!ifInterval(_0x554b0b[_0xff13('0x1db')],_0x554b0b[_0xff13('0x7a')])&&_[_0xff13('0x41')](_0x554b0b['startPredictive'])&&!_[_0xff13('0x41')](_0x554b0b[_0xff13('0x7a')])){_0x554b0b['startPredictive']=moment()[_0xff13('0x7e')](_0xff13('0x108'));loggerPredictive[_0xff13('0x82')](_0x554b0b[_0xff13('0x44')],_0xff13('0x1dc'),_0x554b0b['startPredictive']);this[_0xff13('0xc3')](_0x554b0b[_0xff13('0x1db')])[_0xff13('0xb9')](this[_0xff13('0x1dd')](_0x554b0b))[_0xff13('0xb9')](mergeDataErlangB(_0x554b0b))[_0xff13('0xb9')](this[_0xff13('0x1de')](_0x554b0b))[_0xff13('0xb4')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x554b0b));}else if(!ifInterval(_0x554b0b[_0xff13('0x1db')],_0x554b0b[_0xff13('0x2b')])){_0x554b0b[_0xff13('0x70')]=0x0;_0x554b0b['startPredictive']=moment()[_0xff13('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xff13('0x82')](_0x554b0b['name'],_0xff13('0x1df'),_0x554b0b[_0xff13('0x2b')]);clearInterval(_0x554b0b[_0xff13('0x94')]);_0x554b0b[_0xff13('0x94')]=undefined;this[_0xff13('0xc3')](_0x554b0b['dialPredictiveInterval'])['then'](this[_0xff13('0x1dd')](_0x554b0b))[_0xff13('0xb9')](mergeDataErlangB(_0x554b0b))[_0xff13('0xb9')](this[_0xff13('0x1de')](_0x554b0b))[_0xff13('0xb4')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x554b0b));}else if(_0x554b0b[_0xff13('0x74')]&&_0x49c22d<_0x554b0b[_0xff13('0x74')]-_0x247e98){freeVariablesPredictive(_0x554b0b);loggerPredictive[_0xff13('0x82')](_0x554b0b[_0xff13('0x44')],_0xff13('0x1e0'),_0x49c22d,_0xff13('0x1e1'),_0x554b0b[_0xff13('0x74')],'-',_0x247e98,'=',_0x554b0b['predictiveIntervalAvailable']-_0x247e98,')');}else if(_0x554b0b[_0xff13('0x74')]&&_0x49c22d>_0x554b0b[_0xff13('0x74')]+_0x446f7a){freeVariablesPredictive(_0x554b0b);loggerPredictive[_0xff13('0x82')](_0x554b0b[_0xff13('0x44')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x49c22d,')\x20are\x20more\x20than\x20threshold\x20(',_0x554b0b['predictiveIntervalAvailable'],'+',_0x446f7a,'=',_0x554b0b[_0xff13('0x74')]+_0x446f7a,')');}};Dialer['prototype'][_0xff13('0x1dd')]=function(_0x52ca27){var _0xa5b2eb=this;return function(_0x396b7e){return new Promise(function(_0x54b8b7,_0xe3f143){_[_0xff13('0x91')](_0x52ca27,_0x396b7e[0x0]);if(checkGetDataPredictive(_0x396b7e[0x0])){var _0x54c4f0=_0x52ca27['predictiveIntervalAvailable']=_0x52ca27[_0xff13('0x5b')]+_0x52ca27[_0xff13('0x57')];var _0x24107c=_0x52ca27[_0xff13('0x1db')]*0x3c;var _0x4ae15d=_0x396b7e[0x0][_0xff13('0x6e')]+_0x396b7e[0x0]['predictiveIntervalAvgHoldtime'];var _0x31d807=(_0x396b7e[0x0][_0xff13('0x6c')]+_0x396b7e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x396b7e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x396b7e[0x0][_0xff13('0x75')];_0x52ca27['predictiveIntervalHitRate']=_0x31d807>0x0?_0x31d807:0x1;switch(_0x52ca27[_0xff13('0x1e2')]){case _0xff13('0x1d6'):var _0x4a29a6=_0x52ca27[_0xff13('0x1e3')]/0x64;return _0xa5b2eb[_0xff13('0x1e4')](_0x54c4f0,_0x24107c,_0x4ae15d,_0x31d807,_0x4a29a6)['then'](function(_0x469cdb){return _0x54b8b7(_0x469cdb);});case _0xff13('0x1e5'):var _0x37dba6=_0x52ca27[_0xff13('0x1e3')]/0x64;return _0xa5b2eb[_0xff13('0x1e6')](_0x54c4f0,_0x24107c,_0x4ae15d,_0x31d807,_0x37dba6)[_0xff13('0xb9')](function(_0x1ba11e){return _0x54b8b7(_0x1ba11e);});default:return _0xe3f143(msgResponse('[getDataPredictive]','Failure',_0xff13('0x1e7')));}}else{return _0xe3f143(msgResponse(_0xff13('0x1e8'),'Failure',_0xff13('0x1e9')));}});};};Dialer[_0xff13('0x1c')][_0xff13('0x1ea')]=function(_0x281457){var _0xe703d7=this;return function(_0x397b0d){return new Promise(function(_0x130a1c,_0x595640){_[_0xff13('0x91')](_0x281457,_0x397b0d[0x0]);if(checkGetDataPredictive(_0x397b0d[0x0])){loggerPredictive[_0xff13('0x82')](JSON['stringify'](_0x397b0d[0x0]));if(_0x281457[_0xff13('0x1e2')]===_0xff13('0x1d6')){return _0xe703d7['getVoiceQueueRtPauses'](_0x281457['id'])[_0xff13('0xb9')](function(_0x35d62c){var _0x2da03f=_0x281457[_0xff13('0x16b')]-_0x35d62c[0x0][_0xff13('0x1eb')];var _0xa0f4b7=_0x281457[_0xff13('0x1db')]*0x3c;var _0x356f11=_0x397b0d[0x0][_0xff13('0x6e')]+_0x397b0d[0x0][_0xff13('0x6d')];var _0x339bf0=(_0x397b0d[0x0]['predictiveIntervalAnsweredCalls']+_0x397b0d[0x0][_0xff13('0x6f')]+_0x397b0d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x397b0d[0x0][_0xff13('0x75')];var _0x2e3e67=_0x281457[_0xff13('0x1e3')]/0x64;_0x281457['predictiveIntervalPauses']=_0x35d62c[0x0][_0xff13('0x1eb')]||0x0;_0x281457[_0xff13('0x71')]=_0x339bf0>0x0?_0x339bf0:0x1;return _0xe703d7[_0xff13('0x1e4')](_0x2da03f,_0xa0f4b7,_0x356f11,_0x339bf0,_0x2e3e67);})[_0xff13('0xb9')](function(_0x2fe6ef){return _0x130a1c(_0x2fe6ef);})[_0xff13('0xb4')](function(_0x23ce08){return _0x595640(msgResponse(_0xff13('0x1ec'),'Failure',JSON['stringify'](_0x23ce08)));});}if(_0x281457['dialPredictiveOptimization']===_0xff13('0x1e5')){return _0xe703d7[_0xff13('0xcd')](_0x281457['id'])[_0xff13('0xb9')](function(_0x2aa5b5){var _0x32216f=_0x281457[_0xff13('0x16b')]-_0x2aa5b5[0x0]['outboundQueuePauses'];var _0x3dbf8e=_0x281457[_0xff13('0x1db')]*0x3c;var _0x811099=_0x397b0d[0x0][_0xff13('0x6e')]+_0x397b0d[0x0]['predictiveIntervalAvgHoldtime'];var _0x58313c=(_0x397b0d[0x0][_0xff13('0x6c')]+_0x397b0d[0x0][_0xff13('0x6f')]+_0x397b0d[0x0][_0xff13('0x87')])/_0x397b0d[0x0]['predictiveIntervalTotalCalls'];var _0x2d879c=_0x281457[_0xff13('0x1e3')]/0x64;_0x281457[_0xff13('0x73')]=_0x2aa5b5[0x0]['outboundQueuePauses']||0x0;_0x281457[_0xff13('0x71')]=_0x58313c>0x0?_0x58313c:0x1;return _0xe703d7[_0xff13('0x1e6')](_0x32216f,_0x3dbf8e,_0x811099,_0x58313c,_0x2d879c);})[_0xff13('0xb9')](function(_0x412fdd){return _0x130a1c(_0x412fdd);})[_0xff13('0xb4')](function(_0x5d4d21){return _0x595640(msgResponse(_0xff13('0x1ec'),_0xff13('0x14b'),JSON[_0xff13('0x4e')](_0x5d4d21)));});}}else{return _0x595640(msgResponse(_0xff13('0x1e8'),_0xff13('0x14b'),_0xff13('0x1e9')));}});};};Dialer[_0xff13('0x1c')]['startMethodPredictive']=function(_0x43fd1e){var _0x2c080b=this;return function(){var _0x263442=0x0;var _0x1be92b=Math[_0xff13('0x1d2')](_0x43fd1e[_0xff13('0x8e')]*0x3e8);if(_0x1be92b>0x0){_0x1be92b=_0x1be92b<0x64?0x64:_0x1be92b;loggerPredictive['info'](_0x43fd1e[_0xff13('0x44')],_0xff13('0x1ed'),_0x1be92b,'milliseconds');_0x43fd1e[_0xff13('0x94')]=setInterval(function(){_0x2c080b[_0xff13('0x94')](_0x43fd1e);loggerPredictiveCalls['info'](_0xff13('0x1ee'),_0x263442+=0x1);},_0x1be92b);}else{loggerPredictive[_0xff13('0x82')](_0x43fd1e[_0xff13('0x44')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xff13('0x1c')][_0xff13('0x1ef')]=function(_0x26e0ab,_0x24dd85){var _0x416c73=this;return function(_0x190d55){if(_['isEmpty'](_0x190d55)){if(_[_0xff13('0xb0')](_0x24dd85[_0xff13('0xd8')])||!_0x24dd85[_0xff13('0x1f0')]){if(_0x26e0ab[_0xff13('0x5d')]===_0xff13('0x9')){_0x26e0ab['queueStatusComplete']=_[_0xff13('0x41')](_0x26e0ab[_0xff13('0x132')])?!![]:_0x26e0ab['queueStatusComplete'];var _0x5da937=uuid['v4']();_0x416c73['actions'][_0x5da937]=new Action(_0x26e0ab,_0x24dd85,_0x5da937);loggerBooked[_0xff13('0x82')]('[booked][checkContactBlack]',_0x5da937,'queueStatusComplete:\x20',JSON['stringify'](_0x26e0ab[_0xff13('0x132')]),_0xff13('0x1f1'),_0x26e0ab[_0xff13('0x44')]);if(_0x26e0ab[_0xff13('0x132')]){_0x26e0ab[_0xff13('0x132')]=![];_0x416c73[_0xff13('0x2d')][_0x416c73[_0xff13('0x28')][_0x5da937][_0xff13('0xb8')]]=[];ami[_0xff13('0xb1')]({'actionid':_0x5da937,'action':'queuestatus','queue':_0x26e0ab['name']})[_0xff13('0xb4')](function(){_0x416c73[_0xff13('0xb7')](_0x26e0ab);_0x416c73[_0xff13('0xc5')]({'active':![],'ContactId':_0x416c73[_0xff13('0x28')][_0x5da937][_0xff13('0xd6')],'ListId':_0x416c73[_0xff13('0x28')][_0x5da937][_0xff13('0xd7')],'VoiceQueueId':_0x416c73[_0xff13('0x28')][_0x5da937][_0xff13('0x101')]||undefined,'CampaignId':_0x416c73['actions'][_0x5da937][_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x416c73[_0xff13('0x28')][_0x5da937];});}else{loggerBooked[_0xff13('0x82')](_0xff13('0x1f2'),JSON[_0xff13('0x4e')](_0x26e0ab[_0xff13('0x132')]),_0xff13('0x1f1'),_0x26e0ab[_0xff13('0x44')]);_0x416c73['updateOriginated'](_0x26e0ab);_0x416c73[_0xff13('0xc5')]({'active':![],'ContactId':_0x416c73[_0xff13('0x28')][_0x5da937]['ContactId'],'ListId':_0x416c73['actions'][_0x5da937][_0xff13('0xd7')],'VoiceQueueId':_0x416c73[_0xff13('0x28')][_0x5da937][_0xff13('0x101')]||undefined,'CampaignId':_0x416c73['actions'][_0x5da937][_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x1f3')));delete _0x416c73[_0xff13('0x28')][_0x5da937];}}else{return _0x416c73[_0xff13('0x179')](_0x26e0ab,_0x24dd85);}}else{if(getDiff(_0x24dd85[_0xff13('0x1f4')])<_0x26e0ab['dialRecallMeTimeout']*0x3c){if(_0x24dd85['Agent']&&!_0x24dd85[_0xff13('0x167')][_0xff13('0x1f5')]){_0x416c73[_0xff13('0x21')][_0xff13('0x134')](_0x24dd85['id'])[_0xff13('0x1f')](function(){_0x416c73[_0xff13('0xb7')](_0x26e0ab);});}else{_0x416c73['unlockContact']({'active':![]},_0x24dd85['id'],0x1)[_0xff13('0x1f')](function(){_0x416c73[_0xff13('0xb7')](_0x26e0ab);});}}else{_0x26e0ab[_0xff13('0x6a')]+=0x1;_0x416c73['updateOriginated'](_0x26e0ab);if(_0x26e0ab['dialRecallInQueue']){_0x416c73[_0xff13('0xc5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x24dd85[_0xff13('0xd6')],'ListId':_0x24dd85[_0xff13('0xd7')],'VoiceQueueId':_0x24dd85[_0xff13('0x101')]||undefined,'CampaignId':_0x24dd85[_0xff13('0xd9')]||undefined})[_0xff13('0xb4')](loggerCatch(_0xff13('0x1f6')));_0x416c73['createHistory'](createObjHistory(_0x26e0ab,_0x24dd85,_0xff13('0x1f7'),0x17,_0xff13('0x1f8')))[_0xff13('0xb4')](loggerCatch(_0xff13('0x1f9')));}else{_0x416c73[_0xff13('0xd4')](createObjHistory(_0x26e0ab,_0x24dd85,_0xff13('0x1fa'),0x16,_0xff13('0x1fb')),_0xff13('0x1fc'),_0xff13('0x1fd'));}}}}else{_0x26e0ab[_0xff13('0x63')]+=0x1;_0x416c73[_0xff13('0xd4')](createObjHistory(_0x26e0ab,_0x24dd85,'BLACKLIST',0xd,_0xff13('0x1fe')),_0xff13('0x1ff'),_0xff13('0x200'));throw'inBlackList';}};};Dialer[_0xff13('0x1c')][_0xff13('0x201')]=function(_0x36c0f7){var _0x5a1c22=this;var _0x4ed386=_0x36c0f7[_0xff13('0x202')]-_0x36c0f7[_0xff13('0x76')]-_0x36c0f7[_0xff13('0xca')];emitCampaignSummary(_0x36c0f7);if(_0x4ed386>0x0){if(_0x4ed386>this[_0xff13('0x26')]){_0x4ed386=this[_0xff13('0x26')];}_0x36c0f7[_0xff13('0xca')]+=_0x4ed386;this[_0xff13('0x203')](_0x36c0f7['id'],_0x4ed386,_0x36c0f7['dialOrderByScheduledAt'],_0x36c0f7)['then'](function(_0xe9fc98){_0x36c0f7[_0xff13('0xca')]-=_0x4ed386;_0x36c0f7[_0xff13('0xca')]=_0x36c0f7[_0xff13('0xca')]>0x0?_0x36c0f7['temp']:0x0;if(!checkContactEmpty(_0xe9fc98)){_0x36c0f7[_0xff13('0x42')]=_0xff13('0xa0');logger[_0xff13('0x82')](_0xff13('0x204')+_0x36c0f7[_0xff13('0x44')]);}else{_0x36c0f7['originated']+=_0xe9fc98[_0xff13('0x9b')];_0x36c0f7['message']='RUNNING';for(var _0x28f566=0x0;_0x28f566<_0xe9fc98[_0xff13('0x9b')];_0x28f566+=0x1){_0x36c0f7[_0xff13('0x205')]+=0x1;if(_[_0xff13('0xb0')](_0xe9fc98[_0x28f566])||_[_0xff13('0xb0')](_0xe9fc98[_0x28f566][_0xff13('0x194')])||_[_0xff13('0xb0')](_0xe9fc98[_0x28f566][_0xff13('0x17c')])){_0x5a1c22[_0xff13('0x206')]('[actionOriginate]\x20',_0x36c0f7,_0xe9fc98[_0x28f566]);}else{_0x5a1c22[_0xff13('0xc2')](_['pick'](_0xe9fc98[_0x28f566],[_0xff13('0xd9'),'phone']))[_0xff13('0xb9')](_0x5a1c22[_0xff13('0x1ef')](_0x36c0f7,_0xe9fc98[_0x28f566]))[_0xff13('0xb4')](_0x5a1c22[_0xff13('0xd3')]('[actionOriginateIvr]\x20',_0x36c0f7));}}}})[_0xff13('0xb4')](loggerGetContactDialer(_0xff13('0x207'),_0x36c0f7,_0x4ed386));}};Dialer[_0xff13('0x1c')][_0xff13('0x160')]=function(_0x48399,_0xaa784e){var _0x2d9a62=this;var _0x3731f5=[];var _0x45d098=_0xaa784e>=0x1?_0xaa784e:0x1;if(_0x48399['dialMethod']===_0xff13('0x9')){_0x45d098=0x1;}var _0x5c33bc=Math[_0xff13('0x1d2')](_0x48399[_0xff13('0x57')]*_0x45d098)-_0x48399['originated']-_0x48399[_0xff13('0xca')];emitVoiceQueueSummary(_0x48399);if(_0x48399[_0xff13('0x208')]>0x0){var _0x33b5b4=_0x48399[_0xff13('0x208')]-_0x48399[_0xff13('0x76')]-_0x48399[_0xff13('0x5b')]-_0x48399[_0xff13('0xca')]-_0x48399[_0xff13('0x58')];if(_0x5c33bc>_0x33b5b4){_0x5c33bc=_0x33b5b4;}}if(_0x5c33bc>0x0){if(_0x48399[_0xff13('0x5d')]==='booked'){_0x5c33bc=0x1;}if(_0x5c33bc>this[_0xff13('0x26')]){_0x5c33bc=this['maxNumberOriginate'];}_0x48399[_0xff13('0xca')]+=_0x5c33bc;for(var _0x422dd6 in this[_0xff13('0x24')]){if(typeof this[_0xff13('0x24')][_0x422dd6]!=='undefined'){if(this['agents'][_0x422dd6]['state']===_0xff13('0x209')&&this[_0xff13('0x24')][_0x422dd6][_0xff13('0xb2')]==='reachable'){_0x3731f5[_0xff13('0x130')](this['agents'][_0x422dd6]['id']);}}}this[_0xff13('0xc9')](_0x48399['id'],_0x3731f5,_0x5c33bc,_0x48399['dialOrderByScheduledAt'],_0x48399)[_0xff13('0xb9')](function(_0x3c45e5){_0x48399[_0xff13('0xca')]-=_0x5c33bc;_0x48399[_0xff13('0xca')]=_0x48399[_0xff13('0xca')]>0x0?_0x48399['temp']:0x0;if(!checkContactEmpty(_0x3c45e5)){_0x2d9a62[_0xff13('0xba')](_0x48399)['then'](sendMessageReschedule(_0x48399))[_0xff13('0xb4')](loggerCatch(_0xff13('0xbb')));}else{_0x48399[_0xff13('0x76')]+=_0x3c45e5[_0xff13('0x9b')];_0x48399[_0xff13('0x42')]=_0x48399[_0xff13('0x5d')]===_0xff13('0x9')?_0xff13('0x183'):'RUNNING';for(var _0x5b02bd=0x0;_0x5b02bd<_0x3c45e5[_0xff13('0x9b')];_0x5b02bd+=0x1){if(_[_0xff13('0xb0')](_0x3c45e5[_0x5b02bd])||_[_0xff13('0xb0')](_0x3c45e5[_0x5b02bd][_0xff13('0x194')])||_[_0xff13('0xb0')](_0x3c45e5[_0x5b02bd][_0xff13('0x17c')])){_0x2d9a62[_0xff13('0x206')]('[actionOriginate]\x20',_0x48399,_0x3c45e5[_0x5b02bd]);}else{_0x2d9a62[_0xff13('0xbc')](_['pick'](_0x3c45e5[_0x5b02bd],['VoiceQueueId',_0xff13('0x17c')]))[_0xff13('0xb9')](_0x2d9a62['checkContactBlack'](_0x48399,_0x3c45e5[_0x5b02bd]))[_0xff13('0xb4')](_0x2d9a62[_0xff13('0xd3')]('[actionOriginate]\x20',_0x48399));}}}})[_0xff13('0xb4')](loggerGetContactDialer(_0xff13('0x20a'),_0x48399,_0x5c33bc));}};Dialer[_0xff13('0x1c')][_0xff13('0x94')]=function(_0x2f4ef0){if(_0x2f4ef0[_0xff13('0x208')]>0x0){var _0x3a07fd=_0x2f4ef0[_0xff13('0x208')]-_0x2f4ef0[_0xff13('0x76')]-_0x2f4ef0[_0xff13('0x5b')];if(_0x3a07fd>0x0){this[_0xff13('0x20b')](_0x2f4ef0);}else{loggerPredictiveCalls[_0xff13('0x82')](_0xff13('0x20c'));}}else{this[_0xff13('0x20b')](_0x2f4ef0);}};Dialer[_0xff13('0x1c')][_0xff13('0x20b')]=function(_0x496098){var _0x46e5f5=this;var _0x470784=[];_0x496098[_0xff13('0x76')]+=0x1;for(var _0x266ad8 in this[_0xff13('0x24')]){if(typeof this[_0xff13('0x24')][_0x266ad8]!==_0xff13('0xaf')){if(this['agents'][_0x266ad8][_0xff13('0xa9')]===_0xff13('0x209')&&this[_0xff13('0x24')][_0x266ad8]['status']===_0xff13('0xdf')){_0x470784[_0xff13('0x130')](this['agents'][_0x266ad8]['id']);}}}this['getContactDialer'](_0x496098['id'],_0x470784,0x1,_0x496098[_0xff13('0x20d')],_0x496098)[_0xff13('0xb9')](function(_0x28deee){if(!checkContactEmpty(_0x28deee)){checkContactLowerLimitOriginate(_0x496098,0x1,0x0);_0x46e5f5[_0xff13('0xba')](_0x496098)[_0xff13('0xb9')](sendMessageReschedule(_0x496098))[_0xff13('0xb4')](loggerCatch(_0xff13('0xbb')));}else{_0x496098[_0xff13('0x42')]=_0xff13('0x20e');if(_[_0xff13('0xb0')](_0x28deee[0x0])||_['isNil'](_0x28deee[0x0][_0xff13('0x194')])||_[_0xff13('0xb0')](_0x28deee[0x0][_0xff13('0x17c')])){_0x46e5f5['emptyContact']('[actionOriginate]\x20',_0x496098,_0x28deee[0x0]);}else{_0x46e5f5[_0xff13('0xbc')](_[_0xff13('0xd5')](_0x28deee[0x0],[_0xff13('0x101'),'phone']))[_0xff13('0xb9')](_0x46e5f5['checkContactBlack'](_0x496098,_0x28deee[0x0]))[_0xff13('0xb4')](_0x46e5f5['loggerHandler'](_0xff13('0x20f'),_0x496098));}}})[_0xff13('0xb4')](loggerGetContactDialer(_0xff13('0x210'),_0x496098,0x1));emitVoiceQueueSummary(_0x496098);};Dialer[_0xff13('0x1c')][_0xff13('0x1e4')]=function(_0x624645,_0xfec824,_0x49c06a,_0x182ce5,_0x416436,_0x54aeb2){loggerPredictive[_0xff13('0x82')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xff13('0x82')](_0xff13('0x211'),_0x624645);loggerPredictive[_0xff13('0x82')](_0xff13('0x212'),_0xfec824);loggerPredictive[_0xff13('0x82')](_0xff13('0x213'),_0x49c06a);loggerPredictive[_0xff13('0x82')](_0xff13('0x214'),_0x182ce5);loggerPredictive[_0xff13('0x82')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x416436);loggerPredictive[_0xff13('0x82')]('---------------------------');return new Promise(function(_0x582fdb,_0x1789ee){if(_0x624645<=0x0||isNaN(_0x624645)){return _0x1789ee(msgResponse(_0xff13('0x215'),_0xff13('0x216'),'m\x20=\x20'+_0x624645));}if(_0x49c06a<=0x0||isNaN(_0x49c06a)){return _0x1789ee(msgResponse(_0xff13('0x215'),_0xff13('0x216'),_0xff13('0x217')+_0x49c06a));}if(_0x182ce5<=0x0||isNaN(_0x182ce5)){return _0x1789ee(msgResponse('[abandonmentRate]',_0xff13('0x216'),_0xff13('0x218')+_0x182ce5));}if(_0xfec824<=0x0||isNaN(_0xfec824)){return _0x1789ee(msgResponse(_0xff13('0x215'),_0xff13('0x216'),_0xff13('0x219')+_0xfec824));}if(_0x416436<=0x0||isNaN(_0x416436)){return _0x1789ee(msgResponse('[abandonmentRate]',_0xff13('0x216'),_0xff13('0x21a')+_0x416436));}_0x54aeb2=_0x54aeb2||0x0;var _0x228bb1=0x1/_0x49c06a;var _0x17c73a=0x0;var _0x2c7277=0x0;var _0x4a807c=0x0;var _0x23488d=0x0;for(var _0xbf2cc2=0x0;_0x4a807c<_0x416436;_0xbf2cc2+=0x1){_0x2c7277=_0xbf2cc2/_0xfec824;_0x17c73a=(_0x182ce5*_0x2c7277+_0x54aeb2)/_0x228bb1;_0x4a807c=erlangb(_0x17c73a,_0x624645);_0x23488d=_0x17c73a/_0x624645*(0x1-erlangb(_0x17c73a,_0x624645));}return _0x582fdb({'erlangCalls':_0xbf2cc2,'erlangCallToSecond':_0xfec824/_0xbf2cc2,'erlangAbandonmentRate':_0x4a807c,'erlangBusyFactor':_0x23488d});});};Dialer[_0xff13('0x1c')][_0xff13('0x1e6')]=function(_0x38f247,_0x39fcec,_0xad0c74,_0x375f46,_0x19a9b1,_0x5c93f5){loggerPredictive[_0xff13('0x82')](_0xff13('0x21b'));loggerPredictive[_0xff13('0x82')]('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',_0x38f247);loggerPredictive[_0xff13('0x82')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x39fcec);loggerPredictive[_0xff13('0x82')](_0xff13('0x213'),_0xad0c74);loggerPredictive[_0xff13('0x82')]('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',_0x375f46);loggerPredictive[_0xff13('0x82')](_0xff13('0x21c'),_0x19a9b1);loggerPredictive[_0xff13('0x82')](_0xff13('0x21d'));return new Promise(function(_0x35b027,_0x4129ea){if(_0x38f247<=0x0||isNaN(_0x38f247)){return _0x4129ea(msgResponse('[busyFactor]','Error','m\x20=\x20'+_0x38f247));}if(_0xad0c74<=0x0||isNaN(_0xad0c74)){return _0x4129ea(msgResponse(_0xff13('0x21e'),_0xff13('0x216'),_0xff13('0x217')+_0xad0c74));}if(_0x375f46<=0x0||isNaN(_0x375f46)){return _0x4129ea(msgResponse('[busyFactor]','Error','p\x20=\x20'+_0x375f46));}if(_0x39fcec<=0x0||isNaN(_0x39fcec)){return _0x4129ea(msgResponse('[busyFactor]',_0xff13('0x216'),_0xff13('0x219')+_0x39fcec));}if(_0x19a9b1<=0x0||isNaN(_0x19a9b1)){return _0x4129ea(msgResponse(_0xff13('0x21e'),_0xff13('0x216'),_0xff13('0x21f')+_0x19a9b1));}_0x5c93f5=_0x5c93f5||0x0;var _0x3bb81c=0x1/_0xad0c74;var _0x26f980=0x0;var _0x26efe1=0x0;var _0x58c728=0x0;var _0xe0e98f=0x0;for(var _0x47212b=0x0;_0xe0e98f<_0x19a9b1;_0x47212b+=0x1){_0x26efe1=_0x47212b/_0x39fcec;_0x26f980=(_0x375f46*_0x26efe1+_0x5c93f5)/_0x3bb81c;_0x58c728=erlangb(_0x26f980,_0x38f247);_0xe0e98f=_0x26f980/_0x38f247*(0x1-erlangb(_0x26f980,_0x38f247));}return _0x35b027({'erlangCalls':_0x47212b,'erlangCallToSecond':_0x39fcec/_0x47212b,'erlangAbandonmentRate':_0x58c728,'erlangBusyFactor':_0xe0e98f});});};module[_0xff13('0x220')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 9cdce0c..23633cf 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fed=['countnosuchnumberretry','countabandonedretry','uniqueid','name','number','starttime','responsetime','droptime','endtime','ringtime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5fed,0x1a7));var _0xd5fe=function(_0x2d97fa,_0x5b488a){_0x2d97fa=_0x2d97fa-0x0;var _0x575d9c=_0x5fed[_0x2d97fa];return _0x575d9c;};'use strict';var util=require(_0xd5fe('0x0'));var _=require(_0xd5fe('0x1'));var moment=require(_0xd5fe('0x2'));function getSeconds(_0x392169,_0x418c3b){var _0x481ef4=moment(_0x392169)[_0xd5fe('0x3')](0x0);var _0x1bc337=moment(_0x418c3b)[_0xd5fe('0x3')](0x0);return _0x481ef4['diff'](_0x1bc337,_0xd5fe('0x4'));}function QueueCallerAbandon(_0x2a2307,_0x27c81f){this[_0xd5fe('0x5')]=_0x2a2307[_0xd5fe('0x5')];this['type']=_0x2a2307['type'];this[_0xd5fe('0x6')]=_0x2a2307[_0xd5fe('0x7')]===_0xd5fe('0x8')?_0xd5fe('0x9'):_0x2a2307[_0xd5fe('0x7')];this['countbusyretry']=_0x2a2307[_0xd5fe('0xa')];this[_0xd5fe('0xb')]=_0x2a2307[_0xd5fe('0xb')];this[_0xd5fe('0xc')]=_0x2a2307[_0xd5fe('0xc')];this[_0xd5fe('0xd')]=_0x2a2307[_0xd5fe('0xa')]+_0x2a2307[_0xd5fe('0xb')]+_0x2a2307['countnoanswerretry']+_0x2a2307['countnosuchnumberretry']+_0x2a2307[_0xd5fe('0xe')]+_0x2a2307['countabandonedretry']+_0x2a2307[_0xd5fe('0xf')]+_0x2a2307[_0xd5fe('0x10')];this[_0xd5fe('0x11')]=_0x2a2307[_0xd5fe('0x11')];this[_0xd5fe('0xe')]=_0x2a2307['countdropretry'];this[_0xd5fe('0x12')]=_0x2a2307['countabandonedretry'];this[_0xd5fe('0xf')]=_0x2a2307[_0xd5fe('0xf')];this[_0xd5fe('0x10')]=_0x2a2307[_0xd5fe('0x10')];this['uniqueid']=_0x27c81f[_0xd5fe('0x13')];this['calleridname']=_0x2a2307[_0xd5fe('0x14')];this['calleridnum']=_0x2a2307[_0xd5fe('0x15')];this['starttime']=_0x2a2307[_0xd5fe('0x16')];this[_0xd5fe('0x17')]=_0x2a2307[_0xd5fe('0x17')];this[_0xd5fe('0x18')]=_0x2a2307[_0xd5fe('0x18')];this[_0xd5fe('0x19')]=this['droptime'];this[_0xd5fe('0x1a')]=getSeconds(_0x2a2307[_0xd5fe('0x17')],_0x2a2307[_0xd5fe('0x16')]);this['holdtime']=getSeconds(this[_0xd5fe('0x18')],_0x2a2307[_0xd5fe('0x17')]);this['talktime']=0x0;this['queue']=_0x27c81f[_0xd5fe('0x9')];this['membername']=_0x27c81f[_0xd5fe('0x1b')];this[_0xd5fe('0x1c')]=_0x27c81f[_0xd5fe('0x1c')];this[_0xd5fe('0x1d')]=_0x2a2307[_0xd5fe('0x1d')];this['callbackuniqueid']=_0x2a2307[_0xd5fe('0x1e')];this[_0xd5fe('0x1f')]=_0x2a2307[_0xd5fe('0x1f')];this['recallme']=_0x2a2307[_0xd5fe('0x20')];this[_0xd5fe('0x21')]=_0x2a2307[_0xd5fe('0x21')];this[_0xd5fe('0x22')]=_0x2a2307[_0xd5fe('0x22')];this['UserId']=_0x2a2307[_0xd5fe('0x23')];this['VoiceQueueId']=_0x2a2307[_0xd5fe('0x24')];this[_0xd5fe('0x25')]=_0x2a2307[_0xd5fe('0x25')];this['originatecalleridnum']=_0x2a2307[_0xd5fe('0x26')]||'';this[_0xd5fe('0x27')]=_0x2a2307[_0xd5fe('0x27')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x4629=['scheduledat','campaigntype','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds'];(function(_0x44ac95,_0x41f1fb){var _0x5c8401=function(_0x15fceb){while(--_0x15fceb){_0x44ac95['push'](_0x44ac95['shift']());}};_0x5c8401(++_0x41f1fb);}(_0x4629,0x136));var _0x9462=function(_0x542288,_0x52559e){_0x542288=_0x542288-0x0;var _0x157624=_0x4629[_0x542288];return _0x157624;};'use strict';var util=require('util');var _=require(_0x9462('0x0'));var moment=require(_0x9462('0x1'));function getSeconds(_0x5a3d4a,_0x386ee4){var _0x34e7c2=moment(_0x5a3d4a)[_0x9462('0x2')](0x0);var _0x313ede=moment(_0x386ee4)[_0x9462('0x2')](0x0);return _0x34e7c2[_0x9462('0x3')](_0x313ede,_0x9462('0x4'));}function QueueCallerAbandon(_0xbc2300,_0x32bc87){this[_0x9462('0x5')]=_0xbc2300[_0x9462('0x5')];this['type']=_0xbc2300['type'];this[_0x9462('0x6')]=_0xbc2300['type']===_0x9462('0x7')?_0x9462('0x8'):_0xbc2300[_0x9462('0x9')];this[_0x9462('0xa')]=_0xbc2300['countbusyretry'];this[_0x9462('0xb')]=_0xbc2300[_0x9462('0xb')];this['countnoanswerretry']=_0xbc2300[_0x9462('0xc')];this[_0x9462('0xd')]=_0xbc2300[_0x9462('0xa')]+_0xbc2300[_0x9462('0xb')]+_0xbc2300['countnoanswerretry']+_0xbc2300[_0x9462('0xe')]+_0xbc2300[_0x9462('0xf')]+_0xbc2300[_0x9462('0x10')]+_0xbc2300[_0x9462('0x11')]+_0xbc2300[_0x9462('0x12')];this['countnosuchnumberretry']=_0xbc2300[_0x9462('0xe')];this[_0x9462('0xf')]=_0xbc2300[_0x9462('0xf')];this[_0x9462('0x10')]=_0xbc2300['countabandonedretry'];this['countmachineretry']=_0xbc2300['countmachineretry'];this['countagentrejectretry']=_0xbc2300[_0x9462('0x12')];this[_0x9462('0x13')]=_0x32bc87[_0x9462('0x13')];this[_0x9462('0x14')]=_0xbc2300[_0x9462('0x15')];this[_0x9462('0x16')]=_0xbc2300[_0x9462('0x17')];this[_0x9462('0x18')]=_0xbc2300[_0x9462('0x18')];this[_0x9462('0x19')]=_0xbc2300[_0x9462('0x19')];this[_0x9462('0x1a')]=_0xbc2300[_0x9462('0x1a')];this[_0x9462('0x1b')]=this[_0x9462('0x1a')];this[_0x9462('0x1c')]=getSeconds(_0xbc2300[_0x9462('0x19')],_0xbc2300[_0x9462('0x18')]);this[_0x9462('0x1d')]=getSeconds(this['droptime'],_0xbc2300[_0x9462('0x19')]);this[_0x9462('0x1e')]=0x0;this[_0x9462('0x8')]=_0x32bc87[_0x9462('0x8')];this[_0x9462('0x1f')]=_0x32bc87[_0x9462('0x20')];this[_0x9462('0x21')]=_0x32bc87[_0x9462('0x21')];this[_0x9462('0x22')]=_0xbc2300[_0x9462('0x22')];this[_0x9462('0x23')]=_0xbc2300[_0x9462('0x23')];this[_0x9462('0x24')]=_0xbc2300[_0x9462('0x24')];this[_0x9462('0x25')]=_0xbc2300[_0x9462('0x25')];this[_0x9462('0x26')]=_0xbc2300[_0x9462('0x26')];this['ListId']=_0xbc2300[_0x9462('0x27')];this[_0x9462('0x28')]=_0xbc2300[_0x9462('0x28')];this[_0x9462('0x29')]=_0xbc2300[_0x9462('0x29')];this[_0x9462('0x2a')]=_0xbc2300[_0x9462('0x2a')];this[_0x9462('0x2b')]=_0xbc2300[_0x9462('0x2b')]||'';this[_0x9462('0x2c')]=_0xbc2300['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index d62c89a..8985a90 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(_0xd5d76f,_0x3baa98){var _0x84dcf=function(_0x27cb16){while(--_0x27cb16){_0xd5d76f['push'](_0xd5d76f['shift']());}};_0x84dcf(++_0x3baa98);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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(_0x1f09fe,_0x1ffc3b){var _0x4ded1b=function(_0x155c05){while(--_0x155c05){_0x1f09fe['push'](_0x1f09fe['shift']());}};_0x4ded1b(++_0x1ffc3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 1a4c397..9c399d2 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 _0x834d=['context','hasOwnProperty','exten','uniqueid','channel','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','notify','catch','error','stringify','\x20receiveFax\x20','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','then','[Fax][Message][NoUpdate1]','finally','name','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','message','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','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','uuid','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0x834d,0x140));var _0xd834=function(_0x27913d,_0x594c03){_0x27913d=_0x27913d-0x0;var _0x5beaf1=_0x834d[_0x27913d];return _0x5beaf1;};'use strict';var util=require(_0xd834('0x0'));var _=require(_0xd834('0x1'));var BPromise=require('bluebird');var uuid=require(_0xd834('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xd834('0x3'));var gs=require(_0xd834('0x4'));var logger=require(_0xd834('0x5'))(_0xd834('0x6'));var ami=require('../ami');var rpcDb=require(_0xd834('0x7'));var Channel=require(_0xd834('0x8'));var ut=require(_0xd834('0x9'));var Action=require(_0xd834('0xa'));var faxAccount=require(_0xd834('0xb'));var attachment=require(_0xd834('0xc'));var faxMessage=require(_0xd834('0xd'));function Fax(_0x6ab9ae){this[_0xd834('0xe')]={};this[_0xd834('0xf')]=_0x6ab9ae['faxAccounts'];this[_0xd834('0x10')]=_0x6ab9ae[_0xd834('0x10')];this['actions']={};ami['on'](_0xd834('0x11'),this[_0xd834('0x12')]['bind'](this));ami['on'](_0xd834('0x13'),this[_0xd834('0x14')][_0xd834('0x15')](this));ami['on'](_0xd834('0x16'),this[_0xd834('0x17')][_0xd834('0x15')](this));ami['on'](_0xd834('0x18'),this[_0xd834('0x19')][_0xd834('0x15')](this));ami['on'](_0xd834('0x1a'),this[_0xd834('0x1b')]['bind'](this));ami['on'](_0xd834('0x1c'),this[_0xd834('0x1d')][_0xd834('0x15')](this));ami['on']('hangup',this[_0xd834('0x1e')][_0xd834('0x15')](this));ami['on'](_0xd834('0x1f'),this[_0xd834('0x20')]['bind'](this));}Fax[_0xd834('0x21')][_0xd834('0x12')]=function(_0x375fdd){if(_0x375fdd[_0xd834('0x22')]==='from-voip-provider'){for(var _0x21ce1a in this[_0xd834('0xf')]){if(this['faxAccounts'][_0xd834('0x23')](_0x21ce1a)){if(_0x375fdd[_0xd834('0x24')]===this[_0xd834('0xf')][_0x21ce1a]['localstationid']){this[_0xd834('0xe')][_0x375fdd['uniqueid']]={};this[_0xd834('0xe')][_0x375fdd[_0xd834('0x25')]]['channel']=_0x375fdd[_0xd834('0x26')];this[_0xd834('0xe')][_0x375fdd[_0xd834('0x25')]]['id']=this[_0xd834('0xf')][_0x21ce1a]['id'];this[_0xd834('0xe')][_0x375fdd[_0xd834('0x25')]]['name']=this[_0xd834('0xf')][_0x21ce1a]['name'];logger[_0xd834('0x27')](_0x375fdd['uniqueid'],_0xd834('0x28'));}}}}if(this[_0xd834('0x29')][_0x375fdd[_0xd834('0x25')]]){this['channels'][_0x375fdd['uniqueid']]={};this['channels'][_0x375fdd[_0xd834('0x25')]]['channel']=_0x375fdd[_0xd834('0x26')];logger['info'](_0x375fdd[_0xd834('0x25')],'\x20syncNewchannel\x20');}};Fax[_0xd834('0x21')][_0xd834('0x14')]=function(_0x3a412a){if(this[_0xd834('0xe')][_0x3a412a[_0xd834('0x25')]]){for(var _0x570c95 in _0x3a412a[_0xd834('0x2a')]){if(_0x3a412a['variable'][_0xd834('0x23')](_0x570c95)){this[_0xd834('0xe')][_0x3a412a[_0xd834('0x25')]][_0x570c95]=_0x3a412a[_0xd834('0x2b')];}}}};Fax['prototype']['syncNewState']=function(_0x297bd5){if(this['channels'][_0x297bd5['uniqueid']]){this['channels'][_0x297bd5[_0xd834('0x25')]][_0xd834('0x2c')]=_0x297bd5[_0xd834('0x2c')];this['channels'][_0x297bd5['uniqueid']][_0xd834('0x2d')]=_0x297bd5[_0xd834('0x2d')];}};Fax[_0xd834('0x21')][_0xd834('0x19')]=function(_0x32eb87){if(this[_0xd834('0xe')][_0x32eb87[_0xd834('0x25')]]){for(var _0x3234a4 in _0x32eb87['variable']){if(_0x32eb87[_0xd834('0x2a')]['hasOwnProperty'](_0x3234a4)){this[_0xd834('0xe')][_0x32eb87[_0xd834('0x25')]][_0x3234a4]=_0x32eb87['value'];}}}};Fax[_0xd834('0x21')][_0xd834('0x1b')]=function(_0x4a14c3){if(this[_0xd834('0xe')][_0x4a14c3['uniqueid']]){this[_0xd834('0xe')][_0x4a14c3[_0xd834('0x25')]][_0xd834('0x2e')]=_0x4a14c3['operation'];this[_0xd834('0xe')][_0x4a14c3['uniqueid']][_0xd834('0x2f')]=_0x4a14c3[_0xd834('0x2f')];this['channels'][_0x4a14c3[_0xd834('0x25')]][_0xd834('0x30')]=_0x4a14c3['localstationid'];this[_0xd834('0xe')][_0x4a14c3[_0xd834('0x25')]][_0xd834('0x31')]=_0x4a14c3['filename'];logger[_0xd834('0x27')](_0x4a14c3['uniqueid'],_0xd834('0x32'));}};Fax['prototype'][_0xd834('0x1d')]=function(_0x1a8eb3){var _0x441f28=this;if(this['channels'][_0x1a8eb3[_0xd834('0x25')]]){var _0x2e5e30=this[_0xd834('0xe')][_0x1a8eb3[_0xd834('0x25')]]['id'];this[_0xd834('0xe')][_0x1a8eb3[_0xd834('0x25')]][_0xd834('0x33')]=_0x1a8eb3['remotestationid'];this[_0xd834('0xe')][_0x1a8eb3[_0xd834('0x25')]][_0xd834('0x34')]=_0x1a8eb3[_0xd834('0x34')];this[_0xd834('0xe')][_0x1a8eb3['uniqueid']][_0xd834('0x30')]=_0x1a8eb3[_0xd834('0x30')];this[_0xd834('0xe')][_0x1a8eb3['uniqueid']]['resolution']=_0x1a8eb3['resolution'];this[_0xd834('0xe')][_0x1a8eb3[_0xd834('0x25')]][_0xd834('0x35')]=_0x1a8eb3['transferrate'];this[_0xd834('0xe')][_0x1a8eb3[_0xd834('0x25')]][_0xd834('0x31')]=_0x1a8eb3[_0xd834('0x31')];this[_0xd834('0xe')][_0x1a8eb3['uniqueid']][_0xd834('0x36')]=_0x1a8eb3[_0xd834('0x36')];if(this[_0xd834('0xe')][_0x1a8eb3[_0xd834('0x25')]][_0xd834('0x34')]>0x0){tiff2pdf(_0x1a8eb3['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x34cee3){logger[_0xd834('0x27')](_0x1a8eb3[_0xd834('0x25')],_0xd834('0x37'),_0x34cee3['message']);attachment['create']({'name':path['parse'](_0x1a8eb3[_0xd834('0x31')])['name'],'basename':path[_0xd834('0x38')](_0x1a8eb3['filename'])['name']+_0xd834('0x39'),'type':_0xd834('0x3a')})['then'](function(_0x5ef2ef){faxAccount[_0xd834('0x3b')](_0x2e5e30,{'from':_0x1a8eb3['calleridnum'],'mapKey':_0xd834('0x6'),'body':path['parse'](_0x1a8eb3[_0xd834('0x31')])['name']+'.pdf','AttachmentId':_0x5ef2ef['id']})[_0xd834('0x3c')](function(_0x2fc3fa){logger[_0xd834('0x3d')](_0x1a8eb3[_0xd834('0x25')],'\x20notify\x20',JSON[_0xd834('0x3e')](_0x2fc3fa));});})[_0xd834('0x3c')](function(_0x45cc71){logger[_0xd834('0x3d')](_0x1a8eb3[_0xd834('0x25')],_0xd834('0x3f'),JSON['stringify'](_0x45cc71));});});}logger[_0xd834('0x27')](_0x1a8eb3[_0xd834('0x25')],'\x20receiveFax\x20');}};Fax[_0xd834('0x21')]['syncOriginateResponse']=function(_0x2cbb69){if(this['actions'][_0x2cbb69[_0xd834('0x25')]]){_['merge'](this[_0xd834('0xe')][_0x2cbb69[_0xd834('0x25')]],_['pick'](_0x2cbb69,[_0xd834('0x40'),_0xd834('0x41')]));}};function updateStatus(_0x52b049){if(_0x52b049['AttachmentId']){faxMessage[_0xd834('0x42')](_0x52b049[_0xd834('0x43')],{'failMessage':_0xd834('0x44')})['then'](function(_0x307502){ut[_0xd834('0x45')](_0xd834('0x46'),_0x307502);})[_0xd834('0x3c')](function(_0x1a7b14){ut[_0xd834('0x45')](_0xd834('0x47'),_0x1a7b14);});}else{ut[_0xd834('0x45')](_0xd834('0x48'));}}Fax[_0xd834('0x21')]['updateStatus']=function(_0x203d5b,_0x2ab921,_0x5bcd52){var _0x3cc674=this;var _0x17c908={};if(_0x2ab921){_0x17c908={'read':_0x2ab921};}else{_0x17c908={'failMessage':_0x5bcd52};}if(this[_0xd834('0x29')][_0x203d5b][_0xd834('0x43')]){faxMessage[_0xd834('0x42')](this['actions'][_0x203d5b][_0xd834('0x43')],_0x17c908)[_0xd834('0x49')](function(_0x2dc9dc){ut[_0xd834('0x45')]('[Fax][Message][Updated]',_0x2dc9dc);})['catch'](function(_0x10e265){ut[_0xd834('0x45')](_0xd834('0x4a'),_0x10e265);})[_0xd834('0x4b')](function(){delete _0x3cc674[_0xd834('0xe')][_0x203d5b];delete _0x3cc674[_0xd834('0x29')][_0x203d5b];});}else{ut[_0xd834('0x45')]('[Fax][Message][NoUpdate2]');delete this[_0xd834('0xe')][_0x203d5b];delete this[_0xd834('0x29')][_0x203d5b];}};Fax[_0xd834('0x21')][_0xd834('0x1e')]=function(_0x358ba0){var _0x3de389=this;if(this[_0xd834('0xe')][_0x358ba0[_0xd834('0x25')]]){if(this[_0xd834('0x29')][_0x358ba0[_0xd834('0x25')]]){this[_0xd834('0xe')][_0x358ba0[_0xd834('0x25')]]['id']=this[_0xd834('0x29')][_0x358ba0[_0xd834('0x25')]]['id'];this[_0xd834('0xe')][_0x358ba0[_0xd834('0x25')]][_0xd834('0x4c')]=this['actions'][_0x358ba0[_0xd834('0x25')]]['name'];}logger[_0xd834('0x27')](_0x358ba0[_0xd834('0x25')],this[_0xd834('0x29')][_0x358ba0[_0xd834('0x25')]]?_0xd834('0x4d'):_0xd834('0x4e'),JSON[_0xd834('0x3e')](this[_0xd834('0xe')][_0x358ba0[_0xd834('0x25')]]));if(this[_0xd834('0x29')][_0x358ba0['uniqueid']]){if(this[_0xd834('0xe')][_0x358ba0[_0xd834('0x25')]][_0xd834('0x4f')]>0x0&&this[_0xd834('0xe')][_0x358ba0[_0xd834('0x25')]][_0xd834('0x1a')]===_0xd834('0x50')){this['updateStatus'](_0x358ba0[_0xd834('0x25')],!![]);}else{this[_0xd834('0x51')](_0x358ba0[_0xd834('0x25')],![],this[_0xd834('0xe')][_0x358ba0['uniqueid']]['faxstatusstring']?_0xd834('0x52')+this[_0xd834('0xe')][_0x358ba0[_0xd834('0x25')]]['faxstatusstring']:_0xd834('0x53'));}}}};Fax[_0xd834('0x21')][_0xd834('0x54')]=function(_0x1f642f){var _0x2b5795=this;return new BPromise(function(_0x1ceb98,_0x57f1d1){_0x2b5795[_0xd834('0x55')](_0x1f642f,_0x2b5795['faxAccounts'][_0x1f642f[_0xd834('0x56')]])[_0xd834('0x49')](function(_0x2f8c04){ut[_0xd834('0x45')]('[Fax][execOriginate][success]',_0x2f8c04);_0x1ceb98(ut[_0xd834('0x57')]('Fax\x20received'));})[_0xd834('0x3c')](function(_0x544c1c){ut['logger'](_0xd834('0x58'),_0x544c1c);updateStatus(_0x1f642f);_0x57f1d1(ut['message'](_0xd834('0x59')));});});};Fax[_0xd834('0x21')]['checkAfterSend']=function(_0x365478){var _0x498070=this;return new BPromise(function(_0x1bd276,_0x387ba2){var _0x2c8c86=_0x498070[_0xd834('0x5a')](_0x498070[_0xd834('0xf')][_0x365478[_0xd834('0x56')]][_0xd834('0x5b')],_0x365478);if(_0x2c8c86[_0xd834('0x5c')]){_0x1bd276(ut[_0xd834('0x57')](_0xd834('0x5d')));}else{_0x387ba2(ut[_0xd834('0x57')](_0x2c8c86[_0xd834('0x57')]));}});};function originate(_0x3795f3,_0x12be61,_0x33ed5b){return new BPromise(function(_0x1a9e0d,_0x5528f9){if(_0x33ed5b){var _0x48f4d9=util['format'](_0xd834('0x5e'),path[_0xd834('0x38')](_0x3795f3['path'])[_0xd834('0x4c')],_0x3795f3[_0xd834('0x5f')]);gs['execute'](_0x48f4d9)['then'](function(){_0x3795f3[_0xd834('0x5f')]=util[_0xd834('0x60')](_0xd834('0x61'),path[_0xd834('0x38')](_0x3795f3[_0xd834('0x5f')])[_0xd834('0x62')],path[_0xd834('0x38')](_0x3795f3[_0xd834('0x5f')])['name']);_0x12be61[_0xd834('0x63')]=_0x3795f3[_0xd834('0x5f')];ut[_0xd834('0x45')](_0xd834('0x64'),'');ami['Action'](ut[_0xd834('0x65')](_0x3795f3,_0x12be61))[_0xd834('0x49')](function(_0x27957a){_0x1a9e0d(_0x27957a);})[_0xd834('0x3c')](function(_0x244d1e){_0x5528f9(_0x244d1e);});})[_0xd834('0x3c')](function(_0x3ff1a4){_0x5528f9(_0x3ff1a4);});}else{ami[_0xd834('0x66')](ut[_0xd834('0x65')](_0x3795f3,_0x12be61))[_0xd834('0x49')](function(_0x57942a){_0x1a9e0d(_0x57942a);})['catch'](function(_0x1c16ec){_0x5528f9(_0x1c16ec);});}});}Fax[_0xd834('0x21')][_0xd834('0x55')]=function(_0x3b009c,_0x12bfd7){var _0x53abe6=this;return new BPromise(function(_0x4ab4eb,_0x27e893){var _0x5af59a=uuid['v4']();var _0x1a51c1=ut[_0xd834('0x67')](_0x3b009c,_0x12bfd7);_0x53abe6['actions'][_0x5af59a]=new Action(_0x5af59a,_0x12bfd7,_0x3b009c);var _0x158f2f=_0x53abe6[_0xd834('0x29')][_0x5af59a];if(path[_0xd834('0x38')](_0x3b009c['path'])[_0xd834('0x68')]===_0xd834('0x39')){originate(_0x158f2f,_0x1a51c1,!![])['then'](function(_0x195596){_0x4ab4eb(_0x195596);})[_0xd834('0x3c')](function(_0xb0bb5b){_0x27e893(_0xb0bb5b);});}else{originate(_0x158f2f,_0x1a51c1,![])[_0xd834('0x49')](function(_0xa2f12f){_0x4ab4eb(_0xa2f12f);})[_0xd834('0x3c')](function(_0x51fef8){_0x27e893(_0x51fef8);});}});};Fax[_0xd834('0x21')][_0xd834('0x69')]=function(_0x4adf06){return!_[_0xd834('0x6a')](_0x4adf06)&&!_['isNil'](_0x4adf06['name'])&&!_['isNil'](_0x4adf06[_0xd834('0x6b')])&&_0x4adf06['active']&&!_['isNil'](this[_0xd834('0x10')][util[_0xd834('0x60')](_0xd834('0x6c'),_0x4adf06[_0xd834('0x4c')])])&&!_[_0xd834('0x6a')](this[_0xd834('0x10')][util['format']('SIP/%s',_0x4adf06[_0xd834('0x4c')])][_0xd834('0x2f')])&&(this[_0xd834('0x10')][util[_0xd834('0x60')]('SIP/%s',_0x4adf06[_0xd834('0x4c')])][_0xd834('0x2f')]===_0xd834('0x6d')||this[_0xd834('0x10')][util['format'](_0xd834('0x6c'),_0x4adf06[_0xd834('0x4c')])][_0xd834('0x2f')]===_0xd834('0x6e'));};Fax[_0xd834('0x21')][_0xd834('0x5a')]=function(_0x1090d8,_0x486a4a){if(!this[_0xd834('0x69')](_0x1090d8)){ut['logger'](_0xd834('0x6f'),_[_0xd834('0x6a')](_0x1090d8)?'':_0x1090d8[_0xd834('0x4c')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xd834('0x70')};}if(_['isNil'](_0x486a4a[_0xd834('0x6')])){ut[_0xd834('0x45')](_0xd834('0x71'),JSON['stringify'](_0x486a4a));return{'isValid':![],'message':_0xd834('0x72')};}if(_[_0xd834('0x6a')](_0x486a4a[_0xd834('0x5f')])){ut[_0xd834('0x45')](_0xd834('0x73'),JSON[_0xd834('0x3e')](_0x486a4a));return{'isValid':![],'message':_0xd834('0x74')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xd834('0x75')]=Fax; \ No newline at end of file +var _0x46f4=['variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','name','.pdf','application/pdf','then','notify','fax','error','\x20notify\x20','catch','\x20receiveFax\x20','stringify','merge','response','reason','update','AttachmentId','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','format','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channel','uniqueid','\x20syncNewchannel\x20','info'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x46f4,0x13a));var _0x446f=function(_0x4eb376,_0x256fc9){_0x4eb376=_0x4eb376-0x0;var _0x362d9f=_0x46f4[_0x4eb376];return _0x362d9f;};'use strict';var util=require(_0x446f('0x0'));var _=require(_0x446f('0x1'));var BPromise=require('bluebird');var uuid=require(_0x446f('0x2'));var moment=require(_0x446f('0x3'));var path=require('path');var tiff2pdf=require(_0x446f('0x4'));var gs=require(_0x446f('0x5'));var logger=require(_0x446f('0x6'))('fax');var ami=require(_0x446f('0x7'));var rpcDb=require(_0x446f('0x8'));var Channel=require(_0x446f('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x446f('0xa'));var attachment=require(_0x446f('0xb'));var faxMessage=require(_0x446f('0xc'));function Fax(_0x3e7f1f){this[_0x446f('0xd')]={};this[_0x446f('0xe')]=_0x3e7f1f[_0x446f('0xe')];this[_0x446f('0xf')]=_0x3e7f1f[_0x446f('0xf')];this[_0x446f('0x10')]={};ami['on'](_0x446f('0x11'),this[_0x446f('0x12')]['bind'](this));ami['on'](_0x446f('0x13'),this[_0x446f('0x14')][_0x446f('0x15')](this));ami['on']('newstate',this[_0x446f('0x16')][_0x446f('0x15')](this));ami['on']('newexten',this[_0x446f('0x17')]['bind'](this));ami['on'](_0x446f('0x18'),this[_0x446f('0x19')]['bind'](this));ami['on'](_0x446f('0x1a'),this['syncReceiveFax'][_0x446f('0x15')](this));ami['on']('hangup',this[_0x446f('0x1b')][_0x446f('0x15')](this));ami['on'](_0x446f('0x1c'),this[_0x446f('0x1d')][_0x446f('0x15')](this));}Fax[_0x446f('0x1e')][_0x446f('0x12')]=function(_0x39dc5a){if(_0x39dc5a[_0x446f('0x1f')]===_0x446f('0x20')){for(var _0x4000e9 in this[_0x446f('0xe')]){if(this[_0x446f('0xe')][_0x446f('0x21')](_0x4000e9)){if(_0x39dc5a[_0x446f('0x22')]===this[_0x446f('0xe')][_0x4000e9][_0x446f('0x23')]){this['channels'][_0x39dc5a['uniqueid']]={};this['channels'][_0x39dc5a['uniqueid']][_0x446f('0x24')]=_0x39dc5a[_0x446f('0x24')];this[_0x446f('0xd')][_0x39dc5a[_0x446f('0x25')]]['id']=this[_0x446f('0xe')][_0x4000e9]['id'];this[_0x446f('0xd')][_0x39dc5a[_0x446f('0x25')]]['name']=this[_0x446f('0xe')][_0x4000e9]['name'];logger['info'](_0x39dc5a[_0x446f('0x25')],_0x446f('0x26'));}}}}if(this[_0x446f('0x10')][_0x39dc5a[_0x446f('0x25')]]){this[_0x446f('0xd')][_0x39dc5a[_0x446f('0x25')]]={};this[_0x446f('0xd')][_0x39dc5a[_0x446f('0x25')]][_0x446f('0x24')]=_0x39dc5a[_0x446f('0x24')];logger[_0x446f('0x27')](_0x39dc5a[_0x446f('0x25')],_0x446f('0x26'));}};Fax[_0x446f('0x1e')][_0x446f('0x14')]=function(_0x598232){if(this[_0x446f('0xd')][_0x598232[_0x446f('0x25')]]){for(var _0x3b9be7 in _0x598232[_0x446f('0x28')]){if(_0x598232[_0x446f('0x28')][_0x446f('0x21')](_0x3b9be7)){this['channels'][_0x598232[_0x446f('0x25')]][_0x3b9be7]=_0x598232[_0x446f('0x29')];}}}};Fax[_0x446f('0x1e')]['syncNewState']=function(_0x1ca8c8){if(this['channels'][_0x1ca8c8[_0x446f('0x25')]]){this[_0x446f('0xd')][_0x1ca8c8[_0x446f('0x25')]][_0x446f('0x2a')]=_0x1ca8c8[_0x446f('0x2a')];this['channels'][_0x1ca8c8[_0x446f('0x25')]][_0x446f('0x2b')]=_0x1ca8c8[_0x446f('0x2b')];}};Fax['prototype'][_0x446f('0x17')]=function(_0x2b8eb0){if(this[_0x446f('0xd')][_0x2b8eb0[_0x446f('0x25')]]){for(var _0x258bc7 in _0x2b8eb0[_0x446f('0x28')]){if(_0x2b8eb0[_0x446f('0x28')][_0x446f('0x21')](_0x258bc7)){this[_0x446f('0xd')][_0x2b8eb0[_0x446f('0x25')]][_0x258bc7]=_0x2b8eb0[_0x446f('0x29')];}}}};Fax[_0x446f('0x1e')][_0x446f('0x19')]=function(_0x78975b){if(this[_0x446f('0xd')][_0x78975b['uniqueid']]){this['channels'][_0x78975b[_0x446f('0x25')]]['operation']=_0x78975b[_0x446f('0x2c')];this[_0x446f('0xd')][_0x78975b['uniqueid']][_0x446f('0x2d')]=_0x78975b[_0x446f('0x2d')];this[_0x446f('0xd')][_0x78975b['uniqueid']][_0x446f('0x23')]=_0x78975b['localstationid'];this[_0x446f('0xd')][_0x78975b[_0x446f('0x25')]][_0x446f('0x2e')]=_0x78975b[_0x446f('0x2e')];logger['info'](_0x78975b['uniqueid'],_0x446f('0x2f'));}};Fax['prototype']['syncReceiveFax']=function(_0x1b9643){var _0x447a43=this;if(this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]]){var _0x548c2d=this[_0x446f('0xd')][_0x1b9643['uniqueid']]['id'];this['channels'][_0x1b9643[_0x446f('0x25')]][_0x446f('0x30')]=_0x1b9643[_0x446f('0x30')];this[_0x446f('0xd')][_0x1b9643['uniqueid']][_0x446f('0x31')]=_0x1b9643[_0x446f('0x31')];this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]][_0x446f('0x23')]=_0x1b9643[_0x446f('0x23')];this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]][_0x446f('0x32')]=_0x1b9643[_0x446f('0x32')];this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]]['transferrate']=_0x1b9643[_0x446f('0x33')];this['channels'][_0x1b9643['uniqueid']][_0x446f('0x2e')]=_0x1b9643[_0x446f('0x2e')];this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]][_0x446f('0x34')]=_0x1b9643[_0x446f('0x34')];if(this[_0x446f('0xd')][_0x1b9643[_0x446f('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0x1b9643[_0x446f('0x2e')],_0x446f('0x35'),function(_0x1e641c){logger['info'](_0x1b9643[_0x446f('0x25')],'\x20result\x20conversion\x20file\x20',_0x1e641c[_0x446f('0x36')]);attachment['create']({'name':path[_0x446f('0x37')](_0x1b9643[_0x446f('0x2e')])[_0x446f('0x38')],'basename':path[_0x446f('0x37')](_0x1b9643[_0x446f('0x2e')])[_0x446f('0x38')]+_0x446f('0x39'),'type':_0x446f('0x3a')})[_0x446f('0x3b')](function(_0x3294bd){faxAccount[_0x446f('0x3c')](_0x548c2d,{'from':_0x1b9643[_0x446f('0x34')],'mapKey':_0x446f('0x3d'),'body':path[_0x446f('0x37')](_0x1b9643[_0x446f('0x2e')])[_0x446f('0x38')]+_0x446f('0x39'),'AttachmentId':_0x3294bd['id']})['catch'](function(_0xebd44){logger[_0x446f('0x3e')](_0x1b9643[_0x446f('0x25')],_0x446f('0x3f'),JSON['stringify'](_0xebd44));});})[_0x446f('0x40')](function(_0x552821){logger[_0x446f('0x3e')](_0x1b9643[_0x446f('0x25')],_0x446f('0x41'),JSON[_0x446f('0x42')](_0x552821));});});}logger[_0x446f('0x27')](_0x1b9643['uniqueid'],_0x446f('0x41'));}};Fax[_0x446f('0x1e')]['syncOriginateResponse']=function(_0x578c71){if(this['actions'][_0x578c71[_0x446f('0x25')]]){_[_0x446f('0x43')](this[_0x446f('0xd')][_0x578c71[_0x446f('0x25')]],_['pick'](_0x578c71,[_0x446f('0x44'),_0x446f('0x45')]));}};function updateStatus(_0x873777){if(_0x873777['AttachmentId']){faxMessage[_0x446f('0x46')](_0x873777[_0x446f('0x47')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x4904e3){ut[_0x446f('0x48')](_0x446f('0x49'),_0x4904e3);})['catch'](function(_0x3188bd){ut[_0x446f('0x48')](_0x446f('0x4a'),_0x3188bd);});}else{ut[_0x446f('0x48')](_0x446f('0x4b'));}}Fax[_0x446f('0x1e')][_0x446f('0x4c')]=function(_0x542ed6,_0x3e2b9a,_0x50c930){var _0x20e7b7=this;var _0x49823b={};if(_0x3e2b9a){_0x49823b={'read':_0x3e2b9a};}else{_0x49823b={'failMessage':_0x50c930};}if(this[_0x446f('0x10')][_0x542ed6][_0x446f('0x47')]){faxMessage[_0x446f('0x46')](this[_0x446f('0x10')][_0x542ed6]['AttachmentId'],_0x49823b)[_0x446f('0x3b')](function(_0x116714){ut[_0x446f('0x48')](_0x446f('0x4d'),_0x116714);})[_0x446f('0x40')](function(_0x2908dc){ut[_0x446f('0x48')](_0x446f('0x4e'),_0x2908dc);})[_0x446f('0x4f')](function(){delete _0x20e7b7[_0x446f('0xd')][_0x542ed6];delete _0x20e7b7[_0x446f('0x10')][_0x542ed6];});}else{ut[_0x446f('0x48')](_0x446f('0x50'));delete this[_0x446f('0xd')][_0x542ed6];delete this['actions'][_0x542ed6];}};Fax['prototype']['syncHangup']=function(_0x1d6d13){var _0x2a44b8=this;if(this[_0x446f('0xd')][_0x1d6d13['uniqueid']]){if(this[_0x446f('0x10')][_0x1d6d13['uniqueid']]){this[_0x446f('0xd')][_0x1d6d13['uniqueid']]['id']=this['actions'][_0x1d6d13['uniqueid']]['id'];this[_0x446f('0xd')][_0x1d6d13[_0x446f('0x25')]][_0x446f('0x38')]=this[_0x446f('0x10')][_0x1d6d13[_0x446f('0x25')]][_0x446f('0x38')];}logger[_0x446f('0x27')](_0x1d6d13[_0x446f('0x25')],this[_0x446f('0x10')][_0x1d6d13[_0x446f('0x25')]]?_0x446f('0x51'):_0x446f('0x52'),JSON[_0x446f('0x42')](this[_0x446f('0xd')][_0x1d6d13[_0x446f('0x25')]]));if(this[_0x446f('0x10')][_0x1d6d13[_0x446f('0x25')]]){if(this[_0x446f('0xd')][_0x1d6d13[_0x446f('0x25')]][_0x446f('0x53')]>0x0&&this[_0x446f('0xd')][_0x1d6d13['uniqueid']][_0x446f('0x18')]===_0x446f('0x54')){this[_0x446f('0x4c')](_0x1d6d13['uniqueid'],!![]);}else{this['updateStatus'](_0x1d6d13['uniqueid'],![],this['channels'][_0x1d6d13['uniqueid']][_0x446f('0x55')]?_0x446f('0x56')+this[_0x446f('0xd')][_0x1d6d13[_0x446f('0x25')]][_0x446f('0x55')]:_0x446f('0x57'));}}}};Fax[_0x446f('0x1e')][_0x446f('0x58')]=function(_0x37afbd){var _0x15db8f=this;return new BPromise(function(_0x187955,_0x2b3e48){_0x15db8f[_0x446f('0x59')](_0x37afbd,_0x15db8f[_0x446f('0xe')][_0x37afbd[_0x446f('0x5a')]])[_0x446f('0x3b')](function(_0x582337){ut[_0x446f('0x48')](_0x446f('0x5b'),_0x582337);_0x187955(ut[_0x446f('0x36')]('Fax\x20received'));})['catch'](function(_0x5482a3){ut['logger'](_0x446f('0x5c'),_0x5482a3);updateStatus(_0x37afbd);_0x2b3e48(ut['message'](_0x446f('0x5d')));});});};Fax[_0x446f('0x1e')][_0x446f('0x5e')]=function(_0xb1a052){var _0x1944e1=this;return new BPromise(function(_0x1f21e7,_0x59f9ea){var _0x30ac8e=_0x1944e1[_0x446f('0x5f')](_0x1944e1['faxAccounts'][_0xb1a052[_0x446f('0x5a')]][_0x446f('0x60')],_0xb1a052);if(_0x30ac8e['isValid']){_0x1f21e7(ut[_0x446f('0x36')](_0x446f('0x61')));}else{_0x59f9ea(ut[_0x446f('0x36')](_0x30ac8e[_0x446f('0x36')]));}});};function originate(_0x2625ad,_0x29e235,_0x2b79d0){return new BPromise(function(_0x1f7275,_0x5d9380){if(_0x2b79d0){var _0x30cf22=util['format'](_0x446f('0x62'),path[_0x446f('0x37')](_0x2625ad['path'])['name'],_0x2625ad[_0x446f('0x63')]);gs['execute'](_0x30cf22)['then'](function(){_0x2625ad[_0x446f('0x63')]=util[_0x446f('0x64')](_0x446f('0x65'),path[_0x446f('0x37')](_0x2625ad[_0x446f('0x63')])[_0x446f('0x66')],path[_0x446f('0x37')](_0x2625ad[_0x446f('0x63')])['name']);_0x29e235['XMF-PATH']=_0x2625ad['path'];ut[_0x446f('0x48')](_0x446f('0x67'),'');ami[_0x446f('0x68')](ut['variablesAction'](_0x2625ad,_0x29e235))[_0x446f('0x3b')](function(_0x1f53fc){_0x1f7275(_0x1f53fc);})[_0x446f('0x40')](function(_0x58f247){_0x5d9380(_0x58f247);});})[_0x446f('0x40')](function(_0x47320c){_0x5d9380(_0x47320c);});}else{ami['Action'](ut[_0x446f('0x69')](_0x2625ad,_0x29e235))[_0x446f('0x3b')](function(_0x23c7fd){_0x1f7275(_0x23c7fd);})[_0x446f('0x40')](function(_0x5655ff){_0x5d9380(_0x5655ff);});}});}Fax[_0x446f('0x1e')][_0x446f('0x59')]=function(_0x486eb1,_0x299e15){var _0x313894=this;return new BPromise(function(_0x445603,_0x5eb4c0){var _0x26707d=uuid['v4']();var _0x828bac=ut[_0x446f('0x6a')](_0x486eb1,_0x299e15);_0x313894[_0x446f('0x10')][_0x26707d]=new Action(_0x26707d,_0x299e15,_0x486eb1);var _0x48910b=_0x313894[_0x446f('0x10')][_0x26707d];if(path[_0x446f('0x37')](_0x486eb1[_0x446f('0x63')])['ext']==='.pdf'){originate(_0x48910b,_0x828bac,!![])[_0x446f('0x3b')](function(_0x2cdcd7){_0x445603(_0x2cdcd7);})['catch'](function(_0x10b62a){_0x5eb4c0(_0x10b62a);});}else{originate(_0x48910b,_0x828bac,![])[_0x446f('0x3b')](function(_0x38b45e){_0x445603(_0x38b45e);})[_0x446f('0x40')](function(_0x1b80cd){_0x5eb4c0(_0x1b80cd);});}});};Fax[_0x446f('0x1e')][_0x446f('0x6b')]=function(_0x276c9b){return!_['isNil'](_0x276c9b)&&!_[_0x446f('0x6c')](_0x276c9b['name'])&&!_['isNil'](_0x276c9b[_0x446f('0x6d')])&&_0x276c9b[_0x446f('0x6d')]&&!_[_0x446f('0x6c')](this[_0x446f('0xf')][util[_0x446f('0x64')](_0x446f('0x6e'),_0x276c9b[_0x446f('0x38')])])&&!_[_0x446f('0x6c')](this[_0x446f('0xf')][util[_0x446f('0x64')]('SIP/%s',_0x276c9b[_0x446f('0x38')])][_0x446f('0x2d')])&&(this['trunks'][util[_0x446f('0x64')](_0x446f('0x6e'),_0x276c9b['name'])][_0x446f('0x2d')]==='reachable'||this[_0x446f('0xf')][util[_0x446f('0x64')](_0x446f('0x6e'),_0x276c9b[_0x446f('0x38')])][_0x446f('0x2d')]==='unmonitored');};Fax[_0x446f('0x1e')][_0x446f('0x5f')]=function(_0xa1a082,_0x4196b5){if(!this['isTrunkReachable'](_0xa1a082)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_['isNil'](_0xa1a082)?'':_0xa1a082['name']+_0x446f('0x6f'));return{'isValid':![],'message':_0x446f('0x70')};}if(_[_0x446f('0x6c')](_0x4196b5['fax'])){ut[_0x446f('0x48')](_0x446f('0x71'),JSON['stringify'](_0x4196b5));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x446f('0x6c')](_0x4196b5[_0x446f('0x63')])){ut['logger'](_0x446f('0x72'),JSON['stringify'](_0x4196b5));return{'isValid':![],'message':_0x446f('0x73')};}return{'isValid':!![],'message':_0x446f('0x74')};};module[_0x446f('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index cd77cde..01aac0e 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 _0x6535=['lodash','error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','preview'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x6535,0xe4));var _0x5653=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6535[_0x4b369d];return _0x571a98;};'use strict';var util=require(_0x5653('0x0'));var BPromise=require(_0x5653('0x1'));var logger=require('../../../config/logger')(_0x5653('0x2'));var _=require(_0x5653('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x1a00ee){return function(_0x32c005){logger[_0x5653('0x4')](_0x1a00ee,util[_0x5653('0x5')](_0x32c005,{'showHidden':![],'depth':null}));};}exports[_0x5653('0x6')]=function(_0x4d899f,_0x93ac08){return BPromise[_0x5653('0x7')]()[_0x5653('0x8')](faxAccount[_0x5653('0x6')](_0x4d899f,_0x93ac08))[_0x5653('0x9')](loggerCatch(_0x5653('0xa')));}; \ No newline at end of file +var _0xef2b=['catch','bluebird','../../../config/logger','preview','../rpc/faxAccount','error','notify','resolve','then'];(function(_0x84261a,_0x315d87){var _0x4b9d50=function(_0x590a5a){while(--_0x590a5a){_0x84261a['push'](_0x84261a['shift']());}};_0x4b9d50(++_0x315d87);}(_0xef2b,0x88));var _0xbef2=function(_0x303074,_0x1c1b0d){_0x303074=_0x303074-0x0;var _0x3a0f26=_0xef2b[_0x303074];return _0x3a0f26;};'use strict';var util=require('util');var BPromise=require(_0xbef2('0x0'));var logger=require(_0xbef2('0x1'))(_0xbef2('0x2'));var _=require('lodash');var faxAccount=require(_0xbef2('0x3'));function loggerCatch(_0x1c6bd9){return function(_0x173a5d){logger[_0xbef2('0x4')](_0x1c6bd9,util['inspect'](_0x173a5d,{'showHidden':![],'depth':null}));};}exports[_0xbef2('0x5')]=function(_0x556054,_0x2695ac){return BPromise[_0xbef2('0x6')]()[_0xbef2('0x7')](faxAccount[_0xbef2('0x5')](_0x556054,_0x2695ac))[_0xbef2('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index c317489..c232c51 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 _0x6e82=['../../../../config/logger','bluebird','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x6e82,0x8c));var _0x26e8=function(_0x31bcb2,_0x23cc0e){_0x31bcb2=_0x31bcb2-0x0;var _0x3f150c=_0x6e82[_0x31bcb2];return _0x3f150c;};'use strict';var util=require('util');var logger=require(_0x26e8('0x0'))('fax');var BPromise=require(_0x26e8('0x1'));var exec=require('child_process')['exec'];exports[_0x26e8('0x2')]=function(_0x26a500){return new BPromise(function(_0x1ef53d,_0x494d90){exec(_0x26a500,function(_0x1b203f,_0x251a9f,_0x148b6){logger[_0x26e8('0x3')](_0x26e8('0x4'),_0x251a9f);if(_0x1b203f){logger['info'](_0x26e8('0x4'),_0x26e8('0x5'),util[_0x26e8('0x6')](_0x1b203f,{'showHidden':![],'depth':null}),_0x251a9f,_0x148b6);_0x494d90(_0x1b203f);}_0x1ef53d(_0x251a9f);});});}; \ No newline at end of file +var _0x9c12=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','bluebird'];(function(_0x58afc9,_0x3101c8){var _0x208640=function(_0x21c4df){while(--_0x21c4df){_0x58afc9['push'](_0x58afc9['shift']());}};_0x208640(++_0x3101c8);}(_0x9c12,0x146));var _0x29c1=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x9c12[_0x565ed7];return _0x183ad7;};'use strict';var util=require(_0x29c1('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x29c1('0x1'));var exec=require('child_process')[_0x29c1('0x2')];exports[_0x29c1('0x3')]=function(_0xf4f593){return new BPromise(function(_0x3e1d29,_0xaa3e1d){exec(_0xf4f593,function(_0x43ec22,_0x1e8488,_0x8c8533){logger[_0x29c1('0x4')](_0x29c1('0x5'),_0x1e8488);if(_0x43ec22){logger[_0x29c1('0x4')]('Exec\x20gs',_0x29c1('0x6'),util[_0x29c1('0x7')](_0x43ec22,{'showHidden':![],'depth':null}),_0x1e8488,_0x8c8533);_0xaa3e1d(_0x43ec22);}_0x3e1d29(_0x1e8488);});});}; \ 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 5f8f234..1db32d2 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 _0x4fa6=['\x22%s\x22\x20<%s>','moment','../../../../config/logger','fax','info','inspect','ecm','headerinfo','minrate','maxrate','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','xcally-motion-fax','from-sip'];(function(_0x337aae,_0x5387ca){var _0x4a6713=function(_0x9b01d5){while(--_0x9b01d5){_0x337aae['push'](_0x337aae['shift']());}};_0x4a6713(++_0x5387ca);}(_0x4fa6,0xd2));var _0x64fa=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x4fa6[_0x525c7b];return _0x27b33e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x64fa('0x0'));var logger=require(_0x64fa('0x1'))(_0x64fa('0x2'));exports['message']=function(_0xaaa562){return{'message':_0xaaa562};};exports['logger']=function(_0x1d1373,_0x4acda5){logger[_0x64fa('0x3')](_0x1d1373,util[_0x64fa('0x4')](_0x4acda5,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x211bf1,_0x1954f2){var _0x387b00={'XMF-ECM':_0x1954f2[_0x64fa('0x5')],'XMF-HEADERINFO':_0x1954f2[_0x64fa('0x6')],'XMF-MINRATE':_0x1954f2[_0x64fa('0x7')],'XMF-MAXRATE':_0x1954f2[_0x64fa('0x8')],'XMF-MODEM':util['format']('\x22%s\x22',_0x1954f2[_0x64fa('0x9')]),'XMF-GATEWAY':_0x1954f2[_0x64fa('0xa')],'XMF-FAXDETECT':_0x1954f2[_0x64fa('0xb')],'XMF-T38TIMEOUT':_0x1954f2[_0x64fa('0xc')],'XMF-LOCALSTATIONID':_0x1954f2[_0x64fa('0xd')],'XMF-PATH':_0x211bf1[_0x64fa('0xe')]};return _0x387b00;};exports[_0x64fa('0xf')]=function(_0x547202,_0x2c6a8c){return{'actionid':_0x547202['uniqueid'],'action':'originate','channel':_0x547202['channel'],'Exten':_0x64fa('0x10'),'Context':_0x64fa('0x11'),'Priority':'1','callerid':util['format'](_0x64fa('0x12'),_0x547202[_0x64fa('0x6')]?_0x547202[_0x64fa('0x6')]:'',_0x547202[_0x64fa('0xd')]),'variable':_0x2c6a8c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x547202['uniqueid']};}; \ No newline at end of file +var _0x05d9=['variablesAction','uniqueid','originate','channel','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','localstationid','path'];(function(_0x3efaf7,_0x520312){var _0x17788b=function(_0x1ab7c7){while(--_0x1ab7c7){_0x3efaf7['push'](_0x3efaf7['shift']());}};_0x17788b(++_0x520312);}(_0x05d9,0xde));var _0x905d=function(_0x3b6a26,_0x35faf8){_0x3b6a26=_0x3b6a26-0x0;var _0x12235a=_0x05d9[_0x3b6a26];return _0x12235a;};'use strict';var util=require(_0x905d('0x0'));var _=require(_0x905d('0x1'));var moment=require(_0x905d('0x2'));var logger=require(_0x905d('0x3'))(_0x905d('0x4'));exports[_0x905d('0x5')]=function(_0x560582){return{'message':_0x560582};};exports[_0x905d('0x6')]=function(_0x49f4cc,_0x442df6){logger[_0x905d('0x7')](_0x49f4cc,util[_0x905d('0x8')](_0x442df6,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x555d29,_0xb1d74f){var _0x4979d9={'XMF-ECM':_0xb1d74f[_0x905d('0x9')],'XMF-HEADERINFO':_0xb1d74f['headerinfo'],'XMF-MINRATE':_0xb1d74f[_0x905d('0xa')],'XMF-MAXRATE':_0xb1d74f[_0x905d('0xb')],'XMF-MODEM':util[_0x905d('0xc')](_0x905d('0xd'),_0xb1d74f[_0x905d('0xe')]),'XMF-GATEWAY':_0xb1d74f[_0x905d('0xf')],'XMF-FAXDETECT':_0xb1d74f['faxdetect'],'XMF-T38TIMEOUT':_0xb1d74f['t38timeout'],'XMF-LOCALSTATIONID':_0xb1d74f[_0x905d('0x10')],'XMF-PATH':_0x555d29[_0x905d('0x11')]};return _0x4979d9;};exports[_0x905d('0x12')]=function(_0x248c8b,_0x70c5a6){return{'actionid':_0x248c8b[_0x905d('0x13')],'action':_0x905d('0x14'),'channel':_0x248c8b[_0x905d('0x15')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x905d('0xc')](_0x905d('0x16'),_0x248c8b[_0x905d('0x17')]?_0x248c8b[_0x905d('0x17')]:'',_0x248c8b['localstationid']),'variable':_0x70c5a6,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x248c8b[_0x905d('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 55425b3..e0657e7 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 _0x1428=['initCampaignHopperHistory','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','error','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','then','getAgents','getTelephones','initTelephones','initVoiceQueues','initTemplates','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory'];(function(_0x4c7134,_0x1eae0b){var _0x54da70=function(_0x5ebfa3){while(--_0x5ebfa3){_0x4c7134['push'](_0x4c7134['shift']());}};_0x54da70(++_0x1eae0b);}(_0x1428,0x1c8));var _0x8142=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x1428[_0x3054be];return _0x3df150;};'use strict';var BPromise=require('bluebird');var util=require('util');var moment=require('moment');var server=require(_0x8142('0x0'));var Realtime=require(_0x8142('0x1'));var Report=require(_0x8142('0x2'));var Acw=require('./acw');var Trigger=require(_0x8142('0x3'));var Dialer=require(_0x8142('0x4'));var Preview=require(_0x8142('0x5'));var Fax=require(_0x8142('0x6'));var user=require('./rpc/user');var voiceQueue=require(_0x8142('0x7'));var voiceQueueReport=require(_0x8142('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x8142('0x9'));var trigger=require(_0x8142('0xa'));var template=require(_0x8142('0xb'));var cmHopperHistory=require(_0x8142('0xc'));var campaign=require(_0x8142('0xd'));var voiceExtension=require(_0x8142('0xe'));var faxAccount=require(_0x8142('0xf'));var zendesk=require(_0x8142('0x10'));var salesforce=require(_0x8142('0x11'));var sugarcrm=require(_0x8142('0x12'));var freshdesk=require(_0x8142('0x13'));var desk=require(_0x8142('0x14'));var zoho=require(_0x8142('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x8142('0x16'));var servicenow=require(_0x8142('0x17'));var dynamics365=require(_0x8142('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x8142('0x19'))(_0x8142('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x8142('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x8142('0x1c')](_0x8142('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x8142('0x1d')]()[_0x8142('0x1e')](user[_0x8142('0x1f')]())[_0x8142('0x1e')](realtime['initAgents']())[_0x8142('0x1e')](user[_0x8142('0x20')]())[_0x8142('0x1e')](realtime[_0x8142('0x21')]())[_0x8142('0x1e')](trunk['getTrunks']())['then'](realtime['initTrunks']())[_0x8142('0x1e')](voiceQueue['getVoiceQueues']())[_0x8142('0x1e')](realtime[_0x8142('0x22')]())[_0x8142('0x1e')](trigger['getTriggers']())[_0x8142('0x1e')](realtime['initTriggers']())[_0x8142('0x1e')](template['getTemplates']())['then'](realtime[_0x8142('0x23')]())[_0x8142('0x1e')](zendesk['getZendeskAccounts']())['then'](realtime['initZendeskAccounts']())[_0x8142('0x1e')](salesforce[_0x8142('0x24')]())[_0x8142('0x1e')](realtime['initSalesforceAccounts']())[_0x8142('0x1e')](sugarcrm[_0x8142('0x25')]())['then'](realtime[_0x8142('0x26')]())[_0x8142('0x1e')](freshdesk['getFreshdeskAccounts']())['then'](realtime['initFreshdeskAccounts']())[_0x8142('0x1e')](desk[_0x8142('0x27')]())[_0x8142('0x1e')](realtime[_0x8142('0x28')]())[_0x8142('0x1e')](zoho[_0x8142('0x29')]())['then'](realtime['initZohoAccounts']())[_0x8142('0x1e')](vtiger['getVtigerAccounts']())[_0x8142('0x1e')](realtime[_0x8142('0x2a')]())[_0x8142('0x1e')](freshsales[_0x8142('0x2b')]())[_0x8142('0x1e')](realtime[_0x8142('0x2c')]())['then'](servicenow[_0x8142('0x2d')]())[_0x8142('0x1e')](realtime[_0x8142('0x2e')]())[_0x8142('0x1e')](dynamics365[_0x8142('0x2f')]())['then'](realtime['initDynamics365Accounts']())[_0x8142('0x1e')](campaign[_0x8142('0x30')]())[_0x8142('0x1e')](realtime[_0x8142('0x31')]())[_0x8142('0x1e')](voiceExtension[_0x8142('0x32')]())['then'](realtime[_0x8142('0x33')]())['then'](faxAccount[_0x8142('0x34')]())[_0x8142('0x1e')](realtime[_0x8142('0x35')]())[_0x8142('0x1e')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x8142('0x1e')](voiceQueueReport[_0x8142('0x36')]())[_0x8142('0x1e')](realtime['initVoiceQueueReports']())[_0x8142('0x1e')](cmHopperHistory[_0x8142('0x37')]())[_0x8142('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0x8142('0x1e')](cmHopperHistory['getCampaignHopperHistory']())[_0x8142('0x1e')](realtime[_0x8142('0x38')]())[_0x8142('0x1e')](voiceCallReport['getVoiceCallReports']())[_0x8142('0x1e')](realtime[_0x8142('0x39')]())[_0x8142('0x3a')](function(_0x4b6db9){logger['error'](_0x8142('0x3b'),util[_0x8142('0x3c')](_0x4b6db9,{'showHidden':![],'depth':null}));});}function main(){return server[_0x8142('0x3d')](realtime,preview,fax)['then'](function(_0x4c55bb){return initRealtime();})[_0x8142('0x1e')](function(){return initParams();})[_0x8142('0x1e')](function(){report[_0x8142('0x3e')]();setInterval(initRealtime,0x1388);})[_0x8142('0x3a')](function(_0xcd6dc){logger[_0x8142('0x3f')]('[index.js][main]',util[_0x8142('0x3c')](_0xcd6dc,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xf1f0=['initTemplates','getZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','bluebird','./server','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTriggers','initTriggers','getTemplates'];(function(_0x56b138,_0x2396d6){var _0x3df878=function(_0x4b3ccc){while(--_0x4b3ccc){_0x56b138['push'](_0x56b138['shift']());}};_0x3df878(++_0x2396d6);}(_0xf1f0,0xe0));var _0x0f1f=function(_0x379a66,_0x291e76){_0x379a66=_0x379a66-0x0;var _0x379ccd=_0xf1f0[_0x379a66];return _0x379ccd;};'use strict';var BPromise=require(_0x0f1f('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x0f1f('0x1'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x0f1f('0x2'));var Trigger=require('./trigger');var Dialer=require(_0x0f1f('0x3'));var Preview=require(_0x0f1f('0x4'));var Fax=require(_0x0f1f('0x5'));var user=require(_0x0f1f('0x6'));var voiceQueue=require(_0x0f1f('0x7'));var voiceQueueReport=require(_0x0f1f('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x0f1f('0x9'));var template=require(_0x0f1f('0xa'));var cmHopperHistory=require(_0x0f1f('0xb'));var campaign=require(_0x0f1f('0xc'));var voiceExtension=require(_0x0f1f('0xd'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x0f1f('0xe'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x0f1f('0xf'));var zoho=require(_0x0f1f('0x10'));var vtiger=require(_0x0f1f('0x11'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x0f1f('0x12'));var dynamics365=require(_0x0f1f('0x13'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x0f1f('0x14'))(_0x0f1f('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x0f1f('0x16')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x0f1f('0x16')](_0x0f1f('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x0f1f('0x18')]()[_0x0f1f('0x19')](user[_0x0f1f('0x1a')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x1b')]())[_0x0f1f('0x19')](user[_0x0f1f('0x1c')]())['then'](realtime['initTelephones']())[_0x0f1f('0x19')](trunk['getTrunks']())[_0x0f1f('0x19')](realtime['initTrunks']())[_0x0f1f('0x19')](voiceQueue['getVoiceQueues']())[_0x0f1f('0x19')](realtime['initVoiceQueues']())[_0x0f1f('0x19')](trigger[_0x0f1f('0x1d')]())['then'](realtime[_0x0f1f('0x1e')]())[_0x0f1f('0x19')](template[_0x0f1f('0x1f')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x20')]())[_0x0f1f('0x19')](zendesk[_0x0f1f('0x21')]())[_0x0f1f('0x19')](realtime['initZendeskAccounts']())[_0x0f1f('0x19')](salesforce['getSalesforceAccounts']())[_0x0f1f('0x19')](realtime[_0x0f1f('0x22')]())['then'](sugarcrm[_0x0f1f('0x23')]())['then'](realtime['initSugarcrmAccounts']())[_0x0f1f('0x19')](freshdesk['getFreshdeskAccounts']())[_0x0f1f('0x19')](realtime[_0x0f1f('0x24')]())[_0x0f1f('0x19')](desk[_0x0f1f('0x25')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x26')]())[_0x0f1f('0x19')](zoho['getZohoAccounts']())[_0x0f1f('0x19')](realtime[_0x0f1f('0x27')]())[_0x0f1f('0x19')](vtiger['getVtigerAccounts']())[_0x0f1f('0x19')](realtime[_0x0f1f('0x28')]())[_0x0f1f('0x19')](freshsales['getFreshsalesAccounts']())[_0x0f1f('0x19')](realtime[_0x0f1f('0x29')]())['then'](servicenow[_0x0f1f('0x2a')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x2b')]())['then'](dynamics365[_0x0f1f('0x2c')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x2d')]())[_0x0f1f('0x19')](campaign['getCampaigns']())[_0x0f1f('0x19')](realtime['initCampaigns']())[_0x0f1f('0x19')](voiceExtension[_0x0f1f('0x2e')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x2f')]())[_0x0f1f('0x19')](faxAccount[_0x0f1f('0x30')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x31')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x0f1f('0x18')]()['then'](voiceQueueReport[_0x0f1f('0x32')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x33')]())[_0x0f1f('0x19')](cmHopperHistory[_0x0f1f('0x34')]())[_0x0f1f('0x19')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0x0f1f('0x35')]())[_0x0f1f('0x19')](realtime[_0x0f1f('0x36')]())[_0x0f1f('0x19')](voiceCallReport[_0x0f1f('0x37')]())['then'](realtime[_0x0f1f('0x38')]())[_0x0f1f('0x39')](function(_0x22352a){logger[_0x0f1f('0x3a')](_0x0f1f('0x3b'),util[_0x0f1f('0x3c')](_0x22352a,{'showHidden':![],'depth':null}));});}function main(){return server[_0x0f1f('0x3d')](realtime,preview,fax)[_0x0f1f('0x19')](function(_0xc8b2e){return initRealtime();})['then'](function(){return initParams();})[_0x0f1f('0x19')](function(){report[_0x0f1f('0x3e')]();setInterval(initRealtime,0x1388);})[_0x0f1f('0x39')](function(_0x3b76a7){logger[_0x0f1f('0x3a')](_0x0f1f('0x3f'),util['inspect'](_0x3b76a7,{'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 b53841d..4091359 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 _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x5a29bf,_0xc8da9){var _0x4b25c6=function(_0x3f9d9e){while(--_0x3f9d9e){_0x5a29bf['push'](_0x5a29bf['shift']());}};_0x4b25c6(++_0xc8da9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x967959,_0x53c5c1){_0x967959=_0x967959-0x0;var _0x5c4489=_0xcb91[_0x967959];return _0x5c4489;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file +var _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xedd9,0xfc));var _0x9edd=function(_0xf392f6,_0x8037c4){_0xf392f6=_0xf392f6-0x0;var _0x443f38=_0xedd9[_0xf392f6];return _0x443f38;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('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 477ba9e..26c8f6c 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 _0xa8e1=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0xa8e1,0xfe));var _0x1a8e=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0xa8e1[_0x4d7a70];return _0x3aafbb;};'use strict';function Campaign(_0x595102){this['id']=_0x595102['id']||0x0;this[_0x1a8e('0x0')]=_0x595102['name']||'';this[_0x1a8e('0x1')]=_0x595102[_0x1a8e('0x1')]||'campaign';this['originated']=0x0;this[_0x1a8e('0x2')]=0x0;this[_0x1a8e('0x3')]=0x0;this[_0x1a8e('0x4')]=0x0;this[_0x1a8e('0x5')]='';this[_0x1a8e('0x6')]=!![];this[_0x1a8e('0x7')]=_0x595102[_0x1a8e('0x7')];this[_0x1a8e('0x8')]=_0x595102['limitCalls'];this['dialTimezone']=_0x595102[_0x1a8e('0x9')]||null;this[_0x1a8e('0xa')]=_0x595102['dialGlobalInterval']?_0x595102[_0x1a8e('0xa')]:null;this[_0x1a8e('0xb')]=_0x595102[_0x1a8e('0xb')];this['dialOriginateCallerIdNumber']=_0x595102[_0x1a8e('0xc')];this[_0x1a8e('0xd')]=_0x595102[_0x1a8e('0xd')]||0x1e;this[_0x1a8e('0xe')]=_0x595102[_0x1a8e('0xe')];this[_0x1a8e('0xf')]=_0x595102[_0x1a8e('0xf')];this['dialBusyMaxRetry']=_0x595102[_0x1a8e('0x10')];this['dialBusyRetryFrequency']=_0x595102[_0x1a8e('0x11')];this[_0x1a8e('0x12')]=_0x595102[_0x1a8e('0x12')];this[_0x1a8e('0x13')]=_0x595102['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x595102['dialGlobalMaxRetry'];this['dialNoSuchNumberMaxRetry']=_0x595102[_0x1a8e('0x14')]||0x3;this[_0x1a8e('0x15')]=_0x595102[_0x1a8e('0x15')]||0x96;this[_0x1a8e('0x16')]=_0x595102[_0x1a8e('0x16')]||0x3;this['dialDropRetryFrequency']=_0x595102[_0x1a8e('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x595102[_0x1a8e('0x18')]||0x3;this[_0x1a8e('0x19')]=_0x595102['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x595102['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x595102[_0x1a8e('0x1a')]||0x96;this[_0x1a8e('0x1b')]=_0x595102[_0x1a8e('0x1b')]||0x3;this[_0x1a8e('0x1c')]=_0x595102[_0x1a8e('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x595102[_0x1a8e('0x1d')]||_0x1a8e('0x1e');this[_0x1a8e('0x1f')]=_0x595102[_0x1a8e('0x1f')]||undefined;this[_0x1a8e('0x20')]=_0x595102[_0x1a8e('0x20')]||undefined;this[_0x1a8e('0x21')]=_0x595102[_0x1a8e('0x21')]||undefined;this[_0x1a8e('0x22')]=_0x595102[_0x1a8e('0x22')]?_0x595102[_0x1a8e('0x22')]:undefined;this[_0x1a8e('0x23')]=_0x595102[_0x1a8e('0x23')]?_0x595102[_0x1a8e('0x23')]:undefined;this[_0x1a8e('0x24')]=_0x595102[_0x1a8e('0x24')]?_0x595102[_0x1a8e('0x24')]:undefined;this['SquareProject']=_0x595102[_0x1a8e('0x25')]?_0x595102['SquareProject']:undefined;this['dialQueueProject']=_0x595102[_0x1a8e('0x25')]?_0x595102[_0x1a8e('0x25')][_0x1a8e('0x0')]:undefined;this[_0x1a8e('0x26')]=_0x595102[_0x1a8e('0x26')]||![];this[_0x1a8e('0x27')]=_0x595102['dialAMDInitialSilence'];this[_0x1a8e('0x28')]=_0x595102['dialAMDGreeting'];this[_0x1a8e('0x29')]=_0x595102['dialAMDAfterGreetingSilence'];this[_0x1a8e('0x2a')]=_0x595102[_0x1a8e('0x2a')];this['dialAMDMinWordLength']=_0x595102[_0x1a8e('0x2b')];this[_0x1a8e('0x2c')]=_0x595102['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x595102[_0x1a8e('0x2d')];this[_0x1a8e('0x2e')]=_0x595102['dialAMDSilenceThreshold'];this[_0x1a8e('0x2f')]=_0x595102[_0x1a8e('0x2f')];}module[_0x1a8e('0x30')]=Campaign; \ No newline at end of file +var _0xb35c=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval'];(function(_0x1c6c66,_0x1ae960){var _0x4f620c=function(_0x4b2540){while(--_0x4b2540){_0x1c6c66['push'](_0x1c6c66['shift']());}};_0x4f620c(++_0x1ae960);}(_0xb35c,0xba));var _0xcb35=function(_0x3a49c4,_0x3d6e0c){_0x3a49c4=_0x3a49c4-0x0;var _0x568d62=_0xb35c[_0x3a49c4];return _0x568d62;};'use strict';function Campaign(_0x15c746){this['id']=_0x15c746['id']||0x0;this[_0xcb35('0x0')]=_0x15c746[_0xcb35('0x0')]||'';this[_0xcb35('0x1')]=_0x15c746['type']||_0xcb35('0x2');this[_0xcb35('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0xcb35('0x4')]=0x0;this['message']='';this[_0xcb35('0x5')]=!![];this['active']=_0x15c746[_0xcb35('0x6')];this[_0xcb35('0x7')]=_0x15c746['limitCalls'];this[_0xcb35('0x8')]=_0x15c746[_0xcb35('0x8')]||null;this[_0xcb35('0x9')]=_0x15c746[_0xcb35('0x9')]?_0x15c746[_0xcb35('0x9')]:null;this[_0xcb35('0xa')]=_0x15c746['dialOriginateCallerIdName'];this[_0xcb35('0xb')]=_0x15c746['dialOriginateCallerIdNumber'];this[_0xcb35('0xc')]=_0x15c746[_0xcb35('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x15c746['dialCongestionMaxRetry'];this[_0xcb35('0xd')]=_0x15c746[_0xcb35('0xd')];this[_0xcb35('0xe')]=_0x15c746['dialBusyMaxRetry'];this[_0xcb35('0xf')]=_0x15c746[_0xcb35('0xf')];this[_0xcb35('0x10')]=_0x15c746['dialNoAnswerMaxRetry'];this[_0xcb35('0x11')]=_0x15c746[_0xcb35('0x11')];this[_0xcb35('0x12')]=_0x15c746['dialGlobalMaxRetry'];this[_0xcb35('0x13')]=_0x15c746[_0xcb35('0x13')]||0x3;this[_0xcb35('0x14')]=_0x15c746[_0xcb35('0x14')]||0x96;this[_0xcb35('0x15')]=_0x15c746[_0xcb35('0x15')]||0x3;this[_0xcb35('0x16')]=_0x15c746[_0xcb35('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x15c746[_0xcb35('0x17')]||0x3;this[_0xcb35('0x18')]=_0x15c746[_0xcb35('0x18')]||0x96;this[_0xcb35('0x19')]=_0x15c746[_0xcb35('0x19')]||0x3;this[_0xcb35('0x1a')]=_0x15c746[_0xcb35('0x1a')]||0x96;this[_0xcb35('0x1b')]=_0x15c746[_0xcb35('0x1b')]||0x3;this[_0xcb35('0x1c')]=_0x15c746[_0xcb35('0x1c')]||0x96;this[_0xcb35('0x1d')]=_0x15c746[_0xcb35('0x1d')]||'DESC';this[_0xcb35('0x1e')]=_0x15c746[_0xcb35('0x1e')]||undefined;this[_0xcb35('0x1f')]=_0x15c746[_0xcb35('0x1f')]||undefined;this[_0xcb35('0x20')]=_0x15c746[_0xcb35('0x20')]||undefined;this[_0xcb35('0x21')]=_0x15c746['TrunkBackup']?_0x15c746[_0xcb35('0x21')]:undefined;this[_0xcb35('0x22')]=_0x15c746[_0xcb35('0x22')]?_0x15c746['Trunk']:undefined;this[_0xcb35('0x23')]=_0x15c746[_0xcb35('0x23')]?_0x15c746[_0xcb35('0x23')]:undefined;this['SquareProject']=_0x15c746[_0xcb35('0x24')]?_0x15c746[_0xcb35('0x24')]:undefined;this[_0xcb35('0x25')]=_0x15c746['SquareProject']?_0x15c746[_0xcb35('0x24')][_0xcb35('0x0')]:undefined;this[_0xcb35('0x26')]=_0x15c746['dialAMDActive']||![];this[_0xcb35('0x27')]=_0x15c746[_0xcb35('0x27')];this[_0xcb35('0x28')]=_0x15c746[_0xcb35('0x28')];this[_0xcb35('0x29')]=_0x15c746['dialAMDAfterGreetingSilence'];this[_0xcb35('0x2a')]=_0x15c746['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x15c746[_0xcb35('0x2b')];this[_0xcb35('0x2c')]=_0x15c746[_0xcb35('0x2c')];this[_0xcb35('0x2d')]=_0x15c746[_0xcb35('0x2d')];this['dialAMDSilenceThreshold']=_0x15c746[_0xcb35('0x2e')];this['dialAMDMaximumWordLength']=_0x15c746[_0xcb35('0x2f')];}module[_0xcb35('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index a8f9528..e853b9f 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 _0xe1c4=['destinationchannel','connectedlinenum','accountcode','context','uniqueid','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel'];(function(_0x10990e,_0x227b0c){var _0x261527=function(_0x7eb641){while(--_0x7eb641){_0x10990e['push'](_0x10990e['shift']());}};_0x261527(++_0x227b0c);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x40f1d0,_0x45dd7b){_0x40f1d0=_0x40f1d0-0x0;var _0x45f139=_0xe1c4[_0x40f1d0];return _0x45f139;};'use strict';function Channel(){this[_0x4e1c('0x0')]=null;this[_0x4e1c('0x1')]='';this[_0x4e1c('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x4e1c('0x3')]=undefined;this['connectedlinename']=undefined;this[_0x4e1c('0x4')]=0x0;this[_0x4e1c('0x5')]='';this[_0x4e1c('0x6')]=0x0;this['linkedid']=0x0;this['exten']=0x0;this[_0x4e1c('0x7')]=![];this[_0x4e1c('0x8')]=null;this[_0x4e1c('0x9')]=null;this[_0x4e1c('0xa')]=![];this[_0x4e1c('0xb')]=![];this[_0x4e1c('0xc')]='';this[_0x4e1c('0xd')]='';this[_0x4e1c('0xe')]=0x0;this[_0x4e1c('0xf')]=0x0;this[_0x4e1c('0x10')]=0x0;this[_0x4e1c('0x11')]=null;this[_0x4e1c('0x12')]=null;this[_0x4e1c('0x13')]=null;this['monitor']=![];this[_0x4e1c('0x14')]=null;this[_0x4e1c('0x15')]=null;this['monitors']=[];this[_0x4e1c('0x16')]=undefined;this[_0x4e1c('0x17')]=undefined;this[_0x4e1c('0x18')]=undefined;this[_0x4e1c('0x19')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0xeec6=['calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastapplication','duration','billableseconds','holdtime','tag','monitor','monitorFilename','queue','transferType','starttime'];(function(_0x256ea9,_0x390904){var _0x32127e=function(_0x23cb8a){while(--_0x23cb8a){_0x256ea9['push'](_0x256ea9['shift']());}};_0x32127e(++_0x390904);}(_0xeec6,0x125));var _0x6eec=function(_0x3116d6,_0x2d574f){_0x3116d6=_0x3116d6-0x0;var _0x18729d=_0xeec6[_0x3116d6];return _0x18729d;};'use strict';function Channel(){this[_0x6eec('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x6eec('0x1')]=0x0;this[_0x6eec('0x2')]='';this[_0x6eec('0x3')]=undefined;this[_0x6eec('0x4')]=undefined;this['accountcode']=0x0;this[_0x6eec('0x5')]='';this[_0x6eec('0x6')]=0x0;this['linkedid']=0x0;this[_0x6eec('0x7')]=0x0;this[_0x6eec('0x8')]=![];this['answertime']=null;this[_0x6eec('0x9')]=null;this[_0x6eec('0xa')]=![];this[_0x6eec('0xb')]=![];this[_0x6eec('0xc')]='';this['lastdata']='';this[_0x6eec('0xd')]=0x0;this[_0x6eec('0xe')]=0x0;this[_0x6eec('0xf')]=0x0;this['type']=null;this[_0x6eec('0x10')]=null;this['disposition']=null;this[_0x6eec('0x11')]=![];this[_0x6eec('0x12')]=null;this[_0x6eec('0x13')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x6eec('0x14')]=undefined;this['mohtime']=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 7bd2a64..e168f94 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 _0x04e6=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0x293db4,_0x9f8c9a){var _0x6f200f=function(_0x219957){while(--_0x219957){_0x293db4['push'](_0x293db4['shift']());}};_0x6f200f(++_0x9f8c9a);}(_0x04e6,0x8e));var _0x604e=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0x04e6[_0x496333];return _0x44256e;};'use strict';function DeskAccount(_0x17c727){this['id']=_0x17c727['id']||0x0;this['name']=_0x17c727[_0x604e('0x0')]||'';this[_0x604e('0x1')]=_0x17c727['username']||'';this[_0x604e('0x2')]=_0x17c727['remoteUri']||'';this['authType']=_0x17c727[_0x604e('0x3')]||'';this['password']=_0x17c727[_0x604e('0x4')]||'';this[_0x604e('0x5')]=_0x17c727[_0x604e('0x5')]||'';this[_0x604e('0x6')]=_0x17c727['consumerSecret']||'';this[_0x604e('0x7')]=_0x17c727['token']||'';this[_0x604e('0x8')]=_0x17c727[_0x604e('0x8')]||'';this[_0x604e('0x9')]=_0x17c727[_0x604e('0x9')]||'';this[_0x604e('0xa')]=_0x17c727[_0x604e('0xa')]||'';this[_0x604e('0xb')]=_0x17c727[_0x604e('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xef66=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x12c45d,_0x97707a){var _0x4f2a58=function(_0x1a2c78){while(--_0x1a2c78){_0x12c45d['push'](_0x12c45d['shift']());}};_0x4f2a58(++_0x97707a);}(_0xef66,0x16b));var _0x6ef6=function(_0xb78efc,_0x5f4c39){_0xb78efc=_0xb78efc-0x0;var _0x2e2650=_0xef66[_0xb78efc];return _0x2e2650;};'use strict';function DeskAccount(_0x9eb3c2){this['id']=_0x9eb3c2['id']||0x0;this[_0x6ef6('0x0')]=_0x9eb3c2[_0x6ef6('0x0')]||'';this[_0x6ef6('0x1')]=_0x9eb3c2[_0x6ef6('0x1')]||'';this[_0x6ef6('0x2')]=_0x9eb3c2[_0x6ef6('0x2')]||'';this[_0x6ef6('0x3')]=_0x9eb3c2[_0x6ef6('0x3')]||'';this['password']=_0x9eb3c2[_0x6ef6('0x4')]||'';this[_0x6ef6('0x5')]=_0x9eb3c2[_0x6ef6('0x5')]||'';this[_0x6ef6('0x6')]=_0x9eb3c2[_0x6ef6('0x6')]||'';this[_0x6ef6('0x7')]=_0x9eb3c2['token']||'';this[_0x6ef6('0x8')]=_0x9eb3c2[_0x6ef6('0x8')]||'';this[_0x6ef6('0x9')]=_0x9eb3c2[_0x6ef6('0x9')]||'';this['serverUrl']=_0x9eb3c2[_0x6ef6('0xa')]||'';this['Configurations']=_0x9eb3c2[_0x6ef6('0xb')]||{};}module[_0x6ef6('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 8abc7a1..600bddf 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 _0x9a14=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9a14,0x1eb));var _0x49a1=function(_0x42828b,_0x5df5dd){_0x42828b=_0x42828b-0x0;var _0x2d17c7=_0x9a14[_0x42828b];return _0x2d17c7;};'use strict';function Dynamics365Account(_0x192fa6){this['id']=_0x192fa6['id']||0x0;this[_0x49a1('0x0')]=_0x192fa6[_0x49a1('0x0')]||'';this[_0x49a1('0x1')]=_0x192fa6[_0x49a1('0x1')]||'';this[_0x49a1('0x2')]=_0x192fa6[_0x49a1('0x2')]||'';this[_0x49a1('0x3')]=_0x192fa6[_0x49a1('0x3')]||'';this['tenantId']=_0x192fa6[_0x49a1('0x4')]||'';this[_0x49a1('0x5')]=_0x192fa6[_0x49a1('0x5')]||'';this[_0x49a1('0x6')]=_0x192fa6[_0x49a1('0x6')]||{};this['serverUrl']=_0x192fa6[_0x49a1('0x7')]||'';this[_0x49a1('0x8')]=_0x192fa6[_0x49a1('0x8')]||![];this[_0x49a1('0x9')]=_0x192fa6[_0x49a1('0x9')]||{};this[_0x49a1('0xa')]=_0x192fa6[_0x49a1('0xa')]||{};}module[_0x49a1('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x1efd=['serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x3f397a,_0x5e6677){var _0x2e2625=function(_0x4acb58){while(--_0x4acb58){_0x3f397a['push'](_0x3f397a['shift']());}};_0x2e2625(++_0x5e6677);}(_0x1efd,0xa1));var _0xd1ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1efd[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x4ef4cb){this['id']=_0x4ef4cb['id']||0x0;this[_0xd1ef('0x0')]=_0x4ef4cb['name']||'';this[_0xd1ef('0x1')]=_0x4ef4cb[_0xd1ef('0x1')]||'';this['password']=_0x4ef4cb[_0xd1ef('0x2')]||'';this[_0xd1ef('0x3')]=_0x4ef4cb['remoteUri']||'';this[_0xd1ef('0x4')]=_0x4ef4cb['tenantId']||'';this[_0xd1ef('0x5')]=_0x4ef4cb[_0xd1ef('0x5')]||'';this['clientSecret']=_0x4ef4cb[_0xd1ef('0x6')]||{};this[_0xd1ef('0x7')]=_0x4ef4cb['serverUrl']||'';this[_0xd1ef('0x8')]=_0x4ef4cb[_0xd1ef('0x8')]||![];this[_0xd1ef('0x9')]=_0x4ef4cb['Configurations']||{};this[_0xd1ef('0xa')]=_0x4ef4cb['CloudProvider']||{};}module[_0xd1ef('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index b1d3637..7741bf0 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 _0xcdef=['tech','SIP','Trunk','ListId','key','exports','name','headerinfo','localstationid','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x4df85c,_0x248dfb){var _0x4e2a61=function(_0x4e2c8e){while(--_0x4e2c8e){_0x4df85c['push'](_0x4df85c['shift']());}};_0x4e2a61(++_0x248dfb);}(_0xcdef,0xca));var _0xfcde=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xcdef[_0x42cae2];return _0x5f256f;};'use strict';function FaxAccount(_0x452e07){this['id']=_0x452e07['id']||0x0;this[_0xfcde('0x0')]=_0x452e07[_0xfcde('0x0')]||'';this['description']=_0x452e07['description'];this['ecm']=_0x452e07['ecm'];this[_0xfcde('0x1')]=_0x452e07[_0xfcde('0x1')];this[_0xfcde('0x2')]=_0x452e07['localstationid'];this['minrate']=_0x452e07['minrate']||0x960;this[_0xfcde('0x3')]=_0x452e07[_0xfcde('0x3')]||0x3840;this[_0xfcde('0x4')]=_0x452e07['modem']||'v17,v27,v29';this['gateway']=_0x452e07[_0xfcde('0x5')]||'no';this[_0xfcde('0x6')]=_0x452e07[_0xfcde('0x6')]||'no';this[_0xfcde('0x7')]=_0x452e07['t38timeout']||0x1388;this[_0xfcde('0x8')]=_0x452e07[_0xfcde('0x8')]||_0xfcde('0x9');this[_0xfcde('0xa')]=_0x452e07[_0xfcde('0xa')]?_0x452e07['Trunk']:undefined;this[_0xfcde('0xb')]=_0x452e07[_0xfcde('0xb')];this[_0xfcde('0xc')]=_0x452e07[_0xfcde('0xc')];}module[_0xfcde('0xd')]=FaxAccount; \ No newline at end of file +var _0xffe1=['tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x2050d1,_0xbc3574){var _0x4b76e1=function(_0x5d0c39){while(--_0x5d0c39){_0x2050d1['push'](_0x2050d1['shift']());}};_0x4b76e1(++_0xbc3574);}(_0xffe1,0xcc));var _0x1ffe=function(_0x21de65,_0x3655c5){_0x21de65=_0x21de65-0x0;var _0x3f744a=_0xffe1[_0x21de65];return _0x3f744a;};'use strict';function FaxAccount(_0x237af7){this['id']=_0x237af7['id']||0x0;this[_0x1ffe('0x0')]=_0x237af7[_0x1ffe('0x0')]||'';this[_0x1ffe('0x1')]=_0x237af7[_0x1ffe('0x1')];this[_0x1ffe('0x2')]=_0x237af7[_0x1ffe('0x2')];this[_0x1ffe('0x3')]=_0x237af7['headerinfo'];this[_0x1ffe('0x4')]=_0x237af7[_0x1ffe('0x4')];this[_0x1ffe('0x5')]=_0x237af7[_0x1ffe('0x5')]||0x960;this[_0x1ffe('0x6')]=_0x237af7['maxrate']||0x3840;this[_0x1ffe('0x7')]=_0x237af7[_0x1ffe('0x7')]||_0x1ffe('0x8');this[_0x1ffe('0x9')]=_0x237af7[_0x1ffe('0x9')]||'no';this[_0x1ffe('0xa')]=_0x237af7[_0x1ffe('0xa')]||'no';this[_0x1ffe('0xb')]=_0x237af7[_0x1ffe('0xb')]||0x1388;this[_0x1ffe('0xc')]=_0x237af7[_0x1ffe('0xc')]||_0x1ffe('0xd');this[_0x1ffe('0xe')]=_0x237af7['Trunk']?_0x237af7[_0x1ffe('0xe')]:undefined;this[_0x1ffe('0xf')]=_0x237af7[_0x1ffe('0xf')];this[_0x1ffe('0x10')]=_0x237af7[_0x1ffe('0x10')];}module[_0x1ffe('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 6298f70..3731e3f 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 _0xc89f=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x4398c1,_0xb83ec1){var _0xd720f1=function(_0x51ffe1){while(--_0x51ffe1){_0x4398c1['push'](_0x4398c1['shift']());}};_0xd720f1(++_0xb83ec1);}(_0xc89f,0x1c2));var _0xfc89=function(_0x5d4f70,_0x5e8506){_0x5d4f70=_0x5d4f70-0x0;var _0x39bc3b=_0xc89f[_0x5d4f70];return _0x39bc3b;};'use strict';function FreshdeskAccount(_0x7385be){this['id']=_0x7385be['id']||0x0;this[_0xfc89('0x0')]=_0x7385be[_0xfc89('0x0')]||'';this[_0xfc89('0x1')]=_0x7385be[_0xfc89('0x1')]||'';this[_0xfc89('0x2')]=_0x7385be[_0xfc89('0x3')]||'';this[_0xfc89('0x4')]=_0x7385be[_0xfc89('0x4')]||'';this[_0xfc89('0x5')]=_0x7385be['serverUrl']||'';this[_0xfc89('0x6')]=_0x7385be[_0xfc89('0x6')]||{};}module[_0xfc89('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x2dc0=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0x2dc0,0x67));var _0x02dc=function(_0x330b67,_0x477566){_0x330b67=_0x330b67-0x0;var _0x58ca9d=_0x2dc0[_0x330b67];return _0x58ca9d;};'use strict';function FreshdeskAccount(_0x33fa99){this['id']=_0x33fa99['id']||0x0;this[_0x02dc('0x0')]=_0x33fa99[_0x02dc('0x0')]||'';this['username']=_0x33fa99[_0x02dc('0x1')]||'';this[_0x02dc('0x2')]=_0x33fa99[_0x02dc('0x3')]||'';this[_0x02dc('0x4')]=_0x33fa99['remoteUri']||'';this[_0x02dc('0x5')]=_0x33fa99[_0x02dc('0x5')]||'';this['Configurations']=_0x33fa99[_0x02dc('0x6')]||{};}module[_0x02dc('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 3654b11..66d6ffd 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 _0x16a6=['apiKey','token','remoteUri','serverUrl','Configurations','name','username'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x16a6,0x15c));var _0x616a=function(_0x115621,_0x341cde){_0x115621=_0x115621-0x0;var _0x5ef5ce=_0x16a6[_0x115621];return _0x5ef5ce;};'use strict';function FreshsalesAccount(_0x563d7e){this['id']=_0x563d7e['id']||0x0;this[_0x616a('0x0')]=_0x563d7e['name']||'';this[_0x616a('0x1')]=_0x563d7e[_0x616a('0x1')]||'';this[_0x616a('0x2')]=_0x563d7e[_0x616a('0x3')]||'';this[_0x616a('0x4')]=_0x563d7e[_0x616a('0x4')]||'';this['serverUrl']=_0x563d7e[_0x616a('0x5')]||'';this[_0x616a('0x6')]=_0x563d7e['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x6bac=['serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x52a10e,_0xc26ed6){var _0x5be064=function(_0x3a983b){while(--_0x3a983b){_0x52a10e['push'](_0x52a10e['shift']());}};_0x5be064(++_0xc26ed6);}(_0x6bac,0xa5));var _0xc6ba=function(_0xdec2e,_0x2301e3){_0xdec2e=_0xdec2e-0x0;var _0x33e269=_0x6bac[_0xdec2e];return _0x33e269;};'use strict';function FreshsalesAccount(_0xf320e2){this['id']=_0xf320e2['id']||0x0;this['name']=_0xf320e2[_0xc6ba('0x0')]||'';this[_0xc6ba('0x1')]=_0xf320e2[_0xc6ba('0x1')]||'';this[_0xc6ba('0x2')]=_0xf320e2['token']||'';this['remoteUri']=_0xf320e2['remoteUri']||'';this[_0xc6ba('0x3')]=_0xf320e2[_0xc6ba('0x3')]||'';this['Configurations']=_0xf320e2[_0xc6ba('0x4')]||{};}module[_0xc6ba('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8fa17c6..0b20006 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 _0x627d=['channel','connectedlinename','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition'];(function(_0x24fd2b,_0x58c575){var _0x571d2a=function(_0x3fbcf1){while(--_0x3fbcf1){_0x24fd2b['push'](_0x24fd2b['shift']());}};_0x571d2a(++_0x58c575);}(_0x627d,0xab));var _0xd627=function(_0xd341a,_0x238ce0){_0xd341a=_0xd341a-0x0;var _0x545c03=_0x627d[_0xd341a];return _0x545c03;};'use strict';function QueueReport(){this[_0xd627('0x0')]=_0xd627('0x1');this['uniqueid']='';this['calleridnum']='';this[_0xd627('0x2')]='';this['queue']='';this[_0xd627('0x3')]=null;this[_0xd627('0x4')]=null;this[_0xd627('0x5')]=0x1;this[_0xd627('0x6')]=0x1;this[_0xd627('0x7')]=![];this[_0xd627('0x8')]=null;this['queuecallercomplete']=![];this[_0xd627('0x9')]=null;this[_0xd627('0xa')]=![];this[_0xd627('0xb')]=null;this[_0xd627('0xc')]=0x1;this[_0xd627('0xd')]='';this['connectedlinenum']='';this[_0xd627('0xe')]='';this['accountcode']='';this['context']='';this['exten']='';this[_0xd627('0xf')]='';this[_0xd627('0x10')]=0x0;this[_0xd627('0x11')]=![];this[_0xd627('0x12')]='';this[_0xd627('0x13')]=_0xd627('0x14');this[_0xd627('0x15')]=0x0;this[_0xd627('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x170e=['priority','holdtime','assigned','lastAssignedTo','motionChannel','variables','exports','type','calleridnum','queue','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x170e,0xb7));var _0xe170=function(_0x51df00,_0x4ac573){_0x51df00=_0x51df00-0x0;var _0x198328=_0x170e[_0x51df00];return _0x198328;};'use strict';function QueueReport(){this[_0xe170('0x0')]='inbound';this['uniqueid']='';this[_0xe170('0x1')]='';this['calleridname']='';this[_0xe170('0x2')]='';this['queuecallerjoinAt']=null;this[_0xe170('0x3')]=null;this[_0xe170('0x4')]=0x1;this[_0xe170('0x5')]=0x1;this['queuecallerabandon']=![];this[_0xe170('0x6')]=null;this[_0xe170('0x7')]=![];this[_0xe170('0x8')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xe170('0x9')]=0x1;this[_0xe170('0xa')]='';this[_0xe170('0xb')]='';this[_0xe170('0xc')]='';this['accountcode']='';this[_0xe170('0xd')]='';this[_0xe170('0xe')]='';this[_0xe170('0xf')]='';this[_0xe170('0x10')]=0x0;this[_0xe170('0x11')]=![];this[_0xe170('0x12')]='';this[_0xe170('0x13')]='voice';this['mohtime']=0x0;this[_0xe170('0x14')]={};}module[_0xe170('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index bcf144c..07bb87c 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 _0x07b2=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x56e891,_0x28e6e4){var _0x1af3ab=function(_0x5e4069){while(--_0x5e4069){_0x56e891['push'](_0x56e891['shift']());}};_0x1af3ab(++_0x28e6e4);}(_0x07b2,0x1ee));var _0x207b=function(_0x1a55a8,_0x4e2b57){_0x1a55a8=_0x1a55a8-0x0;var _0x4f37c4=_0x07b2[_0x1a55a8];return _0x4f37c4;};'use strict';function SalesforceAccount(_0x232c0a){this['id']=_0x232c0a['id']||0x0;this['name']=_0x232c0a[_0x207b('0x0')]||'';this['username']=_0x232c0a[_0x207b('0x1')]||'';this[_0x207b('0x2')]=_0x232c0a[_0x207b('0x2')]||'';this[_0x207b('0x3')]=_0x232c0a[_0x207b('0x3')]||'';this[_0x207b('0x4')]=_0x232c0a[_0x207b('0x4')]||'';this[_0x207b('0x5')]=_0x232c0a['clientSecret']||'';this[_0x207b('0x6')]=_0x232c0a['securityToken']||'';this[_0x207b('0x7')]=_0x232c0a[_0x207b('0x7')]||_0x207b('0x8');this['serverUrl']=_0x232c0a[_0x207b('0x9')]||'';this[_0x207b('0xa')]=_0x232c0a[_0x207b('0xa')]||{};}module[_0x207b('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x5809=['clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x486a89,_0x5cbb88){var _0x156863=function(_0x266ee7){while(--_0x266ee7){_0x486a89['push'](_0x486a89['shift']());}};_0x156863(++_0x5cbb88);}(_0x5809,0x6a));var _0x9580=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5809[_0x40a045];return _0x1a687c;};'use strict';function SalesforceAccount(_0xcc582f){this['id']=_0xcc582f['id']||0x0;this[_0x9580('0x0')]=_0xcc582f[_0x9580('0x0')]||'';this[_0x9580('0x1')]=_0xcc582f[_0x9580('0x1')]||'';this[_0x9580('0x2')]=_0xcc582f['remoteUri']||'';this[_0x9580('0x3')]=_0xcc582f[_0x9580('0x3')]||'';this[_0x9580('0x4')]=_0xcc582f[_0x9580('0x4')]||'';this[_0x9580('0x5')]=_0xcc582f[_0x9580('0x5')]||'';this['securityToken']=_0xcc582f[_0x9580('0x6')]||'';this[_0x9580('0x7')]=_0xcc582f[_0x9580('0x7')]||'integrationTab';this[_0x9580('0x8')]=_0xcc582f[_0x9580('0x8')]||'';this[_0x9580('0x9')]=_0xcc582f['Configurations']||{};}module[_0x9580('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 844c816..43fdf91 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 _0x8cc4=['Configurations','exports','name','remoteUri','serverUrl'];(function(_0xf67a90,_0x2eb2f3){var _0x648b2=function(_0x298232){while(--_0x298232){_0xf67a90['push'](_0xf67a90['shift']());}};_0x648b2(++_0x2eb2f3);}(_0x8cc4,0xd9));var _0x48cc=function(_0x488982,_0x3e260c){_0x488982=_0x488982-0x0;var _0xfe389c=_0x8cc4[_0x488982];return _0xfe389c;};'use strict';function ServicenowAccount(_0x3cd196){this['id']=_0x3cd196['id']||0x0;this[_0x48cc('0x0')]=_0x3cd196[_0x48cc('0x0')]||'';this['username']=_0x3cd196['username']||'';this['password']=_0x3cd196['password']||'';this[_0x48cc('0x1')]=_0x3cd196[_0x48cc('0x1')]||'';this[_0x48cc('0x2')]=_0x3cd196['serverUrl']||'';this[_0x48cc('0x3')]=_0x3cd196['Configurations']||{};}module[_0x48cc('0x4')]=ServicenowAccount; \ No newline at end of file +var _0x65a9=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x4a1353,_0x2fbe86){var _0x3805cc=function(_0x39a7ee){while(--_0x39a7ee){_0x4a1353['push'](_0x4a1353['shift']());}};_0x3805cc(++_0x2fbe86);}(_0x65a9,0x1df));var _0x965a=function(_0x1df6a7,_0x21e3c4){_0x1df6a7=_0x1df6a7-0x0;var _0x5e09cf=_0x65a9[_0x1df6a7];return _0x5e09cf;};'use strict';function ServicenowAccount(_0x32f35a){this['id']=_0x32f35a['id']||0x0;this['name']=_0x32f35a[_0x965a('0x0')]||'';this[_0x965a('0x1')]=_0x32f35a['username']||'';this[_0x965a('0x2')]=_0x32f35a[_0x965a('0x2')]||'';this['remoteUri']=_0x32f35a[_0x965a('0x3')]||'';this[_0x965a('0x4')]=_0x32f35a['serverUrl']||'';this['Configurations']=_0x32f35a[_0x965a('0x5')]||{};}module[_0x965a('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 3c38377..8f54603 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 _0x3a08=['password','serverUrl','Configurations','exports','name','username'];(function(_0x361736,_0xe0804e){var _0xd70b31=function(_0x25604b){while(--_0x25604b){_0x361736['push'](_0x361736['shift']());}};_0xd70b31(++_0xe0804e);}(_0x3a08,0x10c));var _0x83a0=function(_0x4e4a3f,_0x42009f){_0x4e4a3f=_0x4e4a3f-0x0;var _0x3b2b12=_0x3a08[_0x4e4a3f];return _0x3b2b12;};'use strict';function SugarcrmAccount(_0x36587f){this['id']=_0x36587f['id']||0x0;this[_0x83a0('0x0')]=_0x36587f['name']||'';this[_0x83a0('0x1')]=_0x36587f[_0x83a0('0x1')]||'';this[_0x83a0('0x2')]=_0x36587f[_0x83a0('0x2')]||'';this['remoteUri']=_0x36587f['remoteUri']||'';this[_0x83a0('0x3')]=_0x36587f['serverUrl']||'';this[_0x83a0('0x4')]=_0x36587f[_0x83a0('0x4')]||{};}module[_0x83a0('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x757d=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x47e26b,_0x54393c){var _0x3e8d29=function(_0x254aa5){while(--_0x254aa5){_0x47e26b['push'](_0x47e26b['shift']());}};_0x3e8d29(++_0x54393c);}(_0x757d,0x193));var _0xd757=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x757d[_0xe8129c];return _0x709fc5;};'use strict';function SugarcrmAccount(_0x1aadc5){this['id']=_0x1aadc5['id']||0x0;this['name']=_0x1aadc5[_0xd757('0x0')]||'';this['username']=_0x1aadc5[_0xd757('0x1')]||'';this[_0xd757('0x2')]=_0x1aadc5[_0xd757('0x2')]||'';this[_0xd757('0x3')]=_0x1aadc5[_0xd757('0x3')]||'';this[_0xd757('0x4')]=_0x1aadc5['serverUrl']||'';this[_0xd757('0x5')]=_0x1aadc5[_0xd757('0x5')]||{};}module[_0xd757('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 5765a44..d7fd919 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 _0xebb1=['status','address','exports','name','accountcode','state','unknown','stateTime'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xebb1,0x1e3));var _0x1ebb=function(_0x1bb7f2,_0x1f3733){_0x1bb7f2=_0x1bb7f2-0x0;var _0x57ff7e=_0xebb1[_0x1bb7f2];return _0x57ff7e;};'use strict';function Telephone(_0x5edf3c){this['id']=_0x5edf3c['id']||0x0;this[_0x1ebb('0x0')]=_0x5edf3c[_0x1ebb('0x0')]||'';this[_0x1ebb('0x1')]=_0x5edf3c[_0x1ebb('0x1')]||'';this[_0x1ebb('0x2')]=_0x1ebb('0x3');this[_0x1ebb('0x4')]=0x0;this[_0x1ebb('0x5')]=_0x1ebb('0x3');this[_0x1ebb('0x6')]='';}module[_0x1ebb('0x7')]=Telephone; \ No newline at end of file +var _0x6f75=['status','address','exports','name','accountcode','state','unknown'];(function(_0x1b0cc9,_0x1eb60a){var _0x4f0fe1=function(_0x5c19b6){while(--_0x5c19b6){_0x1b0cc9['push'](_0x1b0cc9['shift']());}};_0x4f0fe1(++_0x1eb60a);}(_0x6f75,0x15a));var _0x56f7=function(_0xa951fe,_0x4ba978){_0xa951fe=_0xa951fe-0x0;var _0x4da18f=_0x6f75[_0xa951fe];return _0x4da18f;};'use strict';function Telephone(_0x508743){this['id']=_0x508743['id']||0x0;this['name']=_0x508743[_0x56f7('0x0')]||'';this['accountcode']=_0x508743[_0x56f7('0x1')]||'';this[_0x56f7('0x2')]=_0x56f7('0x3');this['stateTime']=0x0;this[_0x56f7('0x4')]='unknown';this[_0x56f7('0x5')]='';}module[_0x56f7('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 7aba59d..96b1f37 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x206c96,_0x355232){var _0x413575=function(_0x599454){while(--_0x599454){_0x206c96['push'](_0x206c96['shift']());}};_0x413575(++_0x355232);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x429ba5,_0x5d7231){var _0x269d04=function(_0x3b5d70){while(--_0x3b5d70){_0x429ba5['push'](_0x429ba5['shift']());}};_0x269d04(++_0x5d7231);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 9d76ac8..19bf8a9 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 _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x53c148,_0x5b5327){var _0x59377d=function(_0xda2130){while(--_0xda2130){_0x53c148['push'](_0x53c148['shift']());}};_0x59377d(++_0x5b5327);}(_0xda3f,0xec));var _0xfda3=function(_0x32d709,_0x3df305){_0x32d709=_0x32d709-0x0;var _0x6d0864=_0xda3f[_0x32d709];return _0x6d0864;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1a85,0x178));var _0x51a8=function(_0xa4f047,_0x30cffe){_0xa4f047=_0xa4f047-0x0;var _0x280a03=_0x1a85[_0xa4f047];return _0x280a03;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 2cfa927..bb32d56 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 _0x9910=['split','host','port','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','unknown','status','registry','indexOf'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x9910,0x69));var _0x0991=function(_0xa8c58e,_0xfbc3cd){_0xa8c58e=_0xa8c58e-0x0;var _0x56ffdf=_0x9910[_0xa8c58e];return _0x56ffdf;};'use strict';function Trunk(_0x5a40e2){this['id']=_0x5a40e2['id']||0x0;this[_0x0991('0x0')]=_0x5a40e2[_0x0991('0x0')]||![];this[_0x0991('0x1')]=_0x5a40e2[_0x0991('0x1')]||'';this[_0x0991('0x2')]=_0x0991('0x3');this['stateTime']=0x0;this[_0x0991('0x4')]=_0x0991('0x3');this[_0x0991('0x5')]=_0x5a40e2[_0x0991('0x5')]&&_0x5a40e2[_0x0991('0x5')][_0x0991('0x6')](':')?_0x5a40e2[_0x0991('0x5')][_0x0991('0x7')](':')[0x0]:'';this[_0x0991('0x8')]='';this[_0x0991('0x9')]='';this['domain']='';this[_0x0991('0xa')]='';this[_0x0991('0xb')]='';this[_0x0991('0xc')]=_0x0991('0x3');this[_0x0991('0xd')]='';this[_0x0991('0xe')]='';this[_0x0991('0xf')]=_0x5a40e2[_0x0991('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x463f=['domainport','registrationtime','defaultuser','exports','active','name','unknown','stateTime','status','registry','indexOf','split','port'];(function(_0x4e027f,_0x5ee901){var _0x578d11=function(_0x31831b){while(--_0x31831b){_0x4e027f['push'](_0x4e027f['shift']());}};_0x578d11(++_0x5ee901);}(_0x463f,0xc7));var _0xf463=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x463f[_0x4e676e];return _0x336a3c;};'use strict';function Trunk(_0x59291c){this['id']=_0x59291c['id']||0x0;this[_0xf463('0x0')]=_0x59291c[_0xf463('0x0')]||![];this[_0xf463('0x1')]=_0x59291c['name']||'';this['state']=_0xf463('0x2');this[_0xf463('0x3')]=0x0;this[_0xf463('0x4')]='unknown';this[_0xf463('0x5')]=_0x59291c['registry']&&_0x59291c[_0xf463('0x5')][_0xf463('0x6')](':')?_0x59291c[_0xf463('0x5')][_0xf463('0x7')](':')[0x0]:'';this['host']='';this[_0xf463('0x8')]='';this['domain']='';this[_0xf463('0x9')]='';this['refresh']='';this['stateRegistry']=_0xf463('0x2');this[_0xf463('0xa')]='';this['address']='';this[_0xf463('0xb')]=_0x59291c['defaultuser']||'';}module[_0xf463('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 6a9c889..8a491d0 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 _0x586e=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x586e,0x7f));var _0xe586=function(_0x2525f1,_0x47034f){_0x2525f1=_0x2525f1-0x0;var _0x13c1b5=_0x586e[_0x2525f1];return _0x13c1b5;};'use strict';function voiceExtension(_0x113f80){this['id']=_0x113f80['id']||0x0;this[_0xe586('0x0')]=_0x113f80[_0xe586('0x0')]||'';this[_0xe586('0x1')]=_0x113f80[_0xe586('0x1')]||'none';this[_0xe586('0x2')]=_0x113f80[_0xe586('0x2')]||![];}module[_0xe586('0x3')]=voiceExtension; \ No newline at end of file +var _0xa2b4=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x4a0be4,_0xdb0076){var _0x320489=function(_0x4605ea){while(--_0x4605ea){_0x4a0be4['push'](_0x4a0be4['shift']());}};_0x320489(++_0xdb0076);}(_0xa2b4,0x111));var _0x4a2b=function(_0x4b0d5,_0x588199){_0x4b0d5=_0x4b0d5-0x0;var _0x2e8607=_0xa2b4[_0x4b0d5];return _0x2e8607;};'use strict';function voiceExtension(_0x49693e){this['id']=_0x49693e['id']||0x0;this[_0x4a2b('0x0')]=_0x49693e['exten']||'';this['recordingFormat']=_0x49693e[_0x4a2b('0x1')]||_0x4a2b('0x2');this[_0x4a2b('0x3')]=_0x49693e[_0x4a2b('0x3')]||![];}module[_0x4a2b('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 5b6f641..469f271 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 _0xd99e=['predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','ringing','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold'];(function(_0x3420d6,_0x395bc6){var _0x487efc=function(_0x366b9a){while(--_0x366b9a){_0x3420d6['push'](_0x3420d6['shift']());}};_0x487efc(++_0x395bc6);}(_0xd99e,0x102));var _0xed99=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0xd99e[_0xa9a245];return _0x2d0eaa;};'use strict';var statusDesc=[_0xed99('0x0'),'not_inuse',_0xed99('0x1'),_0xed99('0x2'),_0xed99('0x3'),'unavailable',_0xed99('0x4'),_0xed99('0x5'),_0xed99('0x6')];var monitorFormat={'wav':_0xed99('0x7'),'wav49':'wav49','gsm':_0xed99('0x8')};var strategy={'rrmemory':_0xed99('0x9'),'roundrobin':_0xed99('0xa')};function VoiceQueue(_0x4542f4){this['id']=_0x4542f4['id']||0x0;this[_0xed99('0xb')]=_0x4542f4[_0xed99('0xb')]||'';this['monitor_format']=_0x4542f4[_0xed99('0xc')]||'';this['type']=_0x4542f4[_0xed99('0xd')]||_0xed99('0xe');this[_0xed99('0xf')]=0x0;this[_0xed99('0x10')]=0x0;this[_0xed99('0x11')]=0x0;this[_0xed99('0x12')]=0x0;this[_0xed99('0x13')]=0x0;this[_0xed99('0x14')]=0x0;this[_0xed99('0x15')]=0x0;this[_0xed99('0x16')]=0x0;this[_0xed99('0x17')]=0x0;this['loggedIn']=0x0;this[_0xed99('0x18')]=0x0;this[_0xed99('0x19')]=_0x4542f4[_0xed99('0x19')]||![];this['acwTimeout']=_0x4542f4[_0xed99('0x1a')]||0xa;this[_0xed99('0x1b')]=_0x4542f4[_0xed99('0x1b')]||'no';this[_0xed99('0x1c')]=!![];this['message']='';this[_0xed99('0x1d')]=0x0;this['temp']=0x0;this['dialTimezone']=_0x4542f4[_0xed99('0x1e')]||null;this[_0xed99('0x1f')]=_0x4542f4[_0xed99('0x1f')]?_0x4542f4['dialGlobalInterval']:null;this[_0xed99('0x20')]=_0x4542f4[_0xed99('0x20')];this[_0xed99('0x21')]=_0x4542f4[_0xed99('0x21')]||_0xed99('0x22');this[_0xed99('0x23')]=_0x4542f4[_0xed99('0x23')]||0x0;this[_0xed99('0x24')]=_0x4542f4[_0xed99('0x24')]||0x0;this[_0xed99('0x25')]=_0x4542f4[_0xed99('0x25')]||0x1;this[_0xed99('0x26')]=_0x4542f4[_0xed99('0x26')]||_0xed99('0x27');this[_0xed99('0x28')]=_0x4542f4[_0xed99('0x28')]||0.03;this[_0xed99('0x29')]=_0x4542f4['dialPredictiveInterval']||0x258;this[_0xed99('0x2a')]=_0x4542f4['dialOriginateCallerIdName']||_0xed99('0x2b');this['dialOriginateCallerIdNumber']=_0x4542f4['dialOriginateCallerIdNumber']||_0xed99('0x2b');this[_0xed99('0x2c')]=_0x4542f4['dialOriginateTimeout']||0x1e;this[_0xed99('0x2d')]=_0x4542f4[_0xed99('0x2d')]||'tTxX';this[_0xed99('0x2e')]=_0x4542f4['dialQueueTimeout']||0x3;this[_0xed99('0x2f')]=_0x4542f4[_0xed99('0x2f')]||undefined;this[_0xed99('0x30')]=_0x4542f4[_0xed99('0x30')]||0x3;this['dialCongestionRetryFrequency']=_0x4542f4[_0xed99('0x31')]||0x96;this[_0xed99('0x32')]=_0x4542f4[_0xed99('0x32')]||0x3;this[_0xed99('0x33')]=_0x4542f4[_0xed99('0x33')]||0x96;this['dialNoAnswerMaxRetry']=_0x4542f4[_0xed99('0x34')]||0x3;this['dialNoAnswerRetryFrequency']=_0x4542f4[_0xed99('0x35')]||0x96;this[_0xed99('0x36')]=_0x4542f4[_0xed99('0x36')]||0x3;this[_0xed99('0x37')]=_0x4542f4[_0xed99('0x37')]||0x96;this[_0xed99('0x38')]=_0x4542f4[_0xed99('0x38')]||0x3;this[_0xed99('0x39')]=_0x4542f4[_0xed99('0x39')]||0x96;this[_0xed99('0x3a')]=_0x4542f4['dialAbandonedMaxRetry']||0x3;this[_0xed99('0x3b')]=_0x4542f4[_0xed99('0x3b')]||0x96;this['dialMachineMaxRetry']=_0x4542f4['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x4542f4[_0xed99('0x3c')]||0x96;this[_0xed99('0x3d')]=_0x4542f4[_0xed99('0x3d')]||0x3;this[_0xed99('0x3e')]=_0x4542f4[_0xed99('0x3e')]||0x96;this['callAdditionalPhoneAfterMin']=_0x4542f4['callAdditionalPhoneAfterMin']||0x3;this[_0xed99('0x3f')]=_0x4542f4['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x4542f4[_0xed99('0x40')]?_0x4542f4[_0xed99('0x40')]:undefined;this[_0xed99('0x41')]=_0x4542f4[_0xed99('0x41')]?_0x4542f4[_0xed99('0x41')]:undefined;this['dialPrefix']=_0x4542f4[_0xed99('0x42')]||undefined;this['Interval']=_0x4542f4[_0xed99('0x43')]?_0x4542f4[_0xed99('0x43')]:undefined;this['dialOrderByScheduledAt']=_0x4542f4[_0xed99('0x44')]||_0xed99('0x45');this['dialRandomLastDigitCallerIdNumber']=_0x4542f4[_0xed99('0x46')]||undefined;this['dialCutDigit']=_0x4542f4[_0xed99('0x47')]||undefined;this['strategy']=strategy[_0x4542f4[_0xed99('0x48')]]||_0xed99('0x9');this[_0xed99('0x49')]=!![];this[_0xed99('0x4a')]=_0x4542f4[_0xed99('0x4a')]||![];this[_0xed99('0x4b')]=_0x4542f4[_0xed99('0x4b')];this[_0xed99('0x4c')]=_0x4542f4['dialAMDGreeting'];this[_0xed99('0x4d')]=_0x4542f4[_0xed99('0x4d')];this[_0xed99('0x4e')]=_0x4542f4[_0xed99('0x4e')];this[_0xed99('0x4f')]=_0x4542f4[_0xed99('0x4f')];this[_0xed99('0x50')]=_0x4542f4[_0xed99('0x50')];this['dialAMDMaximumNumberOfWords']=_0x4542f4[_0xed99('0x51')];this['dialAMDSilenceThreshold']=_0x4542f4[_0xed99('0x52')];this[_0xed99('0x53')]=_0x4542f4['dialAMDMaximumWordLength'];this[_0xed99('0x54')]=0x0;this[_0xed99('0x55')]=0x0;this[_0xed99('0x56')]=_0x4542f4[_0xed99('0x56')];this[_0xed99('0x57')]=0x0;this[_0xed99('0x58')]=0x0;this[_0xed99('0x59')]=0x0;this[_0xed99('0x5a')]=0x0;this[_0xed99('0x5b')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xed99('0x5c')]=0x0;this[_0xed99('0x5d')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xed99('0x5e')]=0x0;this[_0xed99('0x5f')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0xed99('0x60')]=undefined;this[_0xed99('0x61')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xed99('0x62')]=0x0;this[_0xed99('0x63')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xed99('0x64')]=0x0;this[_0xed99('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xed99('0x66')]=0x0;this['predictiveIntervalMaxThreshold']=_0x4542f4[_0xed99('0x67')]||0x14;this[_0xed99('0x68')]=_0x4542f4[_0xed99('0x67')]||0xa;this[_0xed99('0x69')]=0x0;this[_0xed99('0x6a')]=0x0;this[_0xed99('0x6b')]=0x1;this[_0xed99('0x6c')]=0x0;this[_0xed99('0x6d')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xed99('0x6e')]=0x0;this['dialRecallMeTimeout']=_0x4542f4[_0xed99('0x6f')]||0x1e;this['dialRecallInQueue']=_0x4542f4[_0xed99('0x70')]||![];this[_0xed99('0x71')]=!!_0x4542f4[_0xed99('0x71')]||![];this[_0xed99('0x72')]=!!_0x4542f4[_0xed99('0x72')]||![];this[_0xed99('0x73')]=_0x4542f4[_0xed99('0x73')]||undefined;this[_0xed99('0x74')]=_0x4542f4[_0xed99('0x74')]||![];this[_0xed99('0x75')]=_0x4542f4['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x4542f4[_0xed99('0xc')]]?monitorFormat[_0x4542f4[_0xed99('0xc')]]:undefined;this[_0xed99('0x76')]=_0x4542f4['mandatoryDisposition']||![];this[_0xed99('0x77')]=_0x4542f4[_0xed99('0x77')]?_0x4542f4[_0xed99('0x77')]:undefined;}module[_0xed99('0x78')]=VoiceQueue; \ No newline at end of file +var _0xd37c=['anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','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','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName'];(function(_0x159a82,_0x16f604){var _0x515198=function(_0x224fbb){while(--_0x224fbb){_0x159a82['push'](_0x159a82['shift']());}};_0x515198(++_0x16f604);}(_0xd37c,0x137));var _0xcd37=function(_0x2301d0,_0x53af71){_0x2301d0=_0x2301d0-0x0;var _0x101190=_0xd37c[_0x2301d0];return _0x101190;};'use strict';var statusDesc=[_0xcd37('0x0'),_0xcd37('0x1'),_0xcd37('0x2'),'busy',_0xcd37('0x3'),_0xcd37('0x4'),_0xcd37('0x5'),_0xcd37('0x6'),_0xcd37('0x7')];var monitorFormat={'wav':_0xcd37('0x8'),'wav49':'wav49','gsm':_0xcd37('0x9')};var strategy={'rrmemory':_0xcd37('0xa'),'roundrobin':_0xcd37('0xb')};function VoiceQueue(_0x1e9d30){this['id']=_0x1e9d30['id']||0x0;this[_0xcd37('0xc')]=_0x1e9d30[_0xcd37('0xc')]||'';this[_0xcd37('0xd')]=_0x1e9d30[_0xcd37('0xd')]||'';this['type']=_0x1e9d30[_0xcd37('0xe')]||_0xcd37('0xf');this['waiting']=0x0;this['talking']=0x0;this['total']=0x0;this['answered']=0x0;this[_0xcd37('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0xcd37('0x11')]=0x0;this[_0xcd37('0x12')]=0x0;this[_0xcd37('0x13')]=0x0;this[_0xcd37('0x14')]=0x0;this['available']=0x0;this[_0xcd37('0x15')]=_0x1e9d30[_0xcd37('0x15')]||![];this[_0xcd37('0x16')]=_0x1e9d30[_0xcd37('0x16')]||0xa;this[_0xcd37('0x17')]=_0x1e9d30[_0xcd37('0x17')]||'no';this[_0xcd37('0x18')]=!![];this[_0xcd37('0x19')]='';this[_0xcd37('0x1a')]=0x0;this[_0xcd37('0x1b')]=0x0;this[_0xcd37('0x1c')]=_0x1e9d30[_0xcd37('0x1c')]||null;this[_0xcd37('0x1d')]=_0x1e9d30['dialGlobalInterval']?_0x1e9d30[_0xcd37('0x1d')]:null;this[_0xcd37('0x1e')]=_0x1e9d30['dialActive'];this['dialMethod']=_0x1e9d30[_0xcd37('0x1f')]||_0xcd37('0x20');this['dialLimitChannel']=_0x1e9d30[_0xcd37('0x21')]||0x0;this['dialLimitQueue']=_0x1e9d30['dialLimitQueue']||0x0;this[_0xcd37('0x22')]=_0x1e9d30[_0xcd37('0x22')]||0x1;this[_0xcd37('0x23')]=_0x1e9d30[_0xcd37('0x23')]||_0xcd37('0x24');this['dialPredictiveOptimizationPercentage']=_0x1e9d30[_0xcd37('0x25')]||0.03;this[_0xcd37('0x26')]=_0x1e9d30[_0xcd37('0x26')]||0x258;this['dialOriginateCallerIdName']=_0x1e9d30[_0xcd37('0x27')]||_0xcd37('0x28');this[_0xcd37('0x29')]=_0x1e9d30[_0xcd37('0x29')]||_0xcd37('0x28');this[_0xcd37('0x2a')]=_0x1e9d30[_0xcd37('0x2a')]||0x1e;this[_0xcd37('0x2b')]=_0x1e9d30['dialQueueOptions']||'tTxX';this[_0xcd37('0x2c')]=_0x1e9d30[_0xcd37('0x2c')]||0x3;this['dialQueueProject']=_0x1e9d30[_0xcd37('0x2d')]||undefined;this[_0xcd37('0x2e')]=_0x1e9d30[_0xcd37('0x2e')]||0x3;this[_0xcd37('0x2f')]=_0x1e9d30['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x1e9d30['dialBusyMaxRetry']||0x3;this[_0xcd37('0x30')]=_0x1e9d30[_0xcd37('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0x1e9d30['dialNoAnswerMaxRetry']||0x3;this[_0xcd37('0x31')]=_0x1e9d30[_0xcd37('0x31')]||0x96;this[_0xcd37('0x32')]=_0x1e9d30[_0xcd37('0x32')]||0x3;this[_0xcd37('0x33')]=_0x1e9d30[_0xcd37('0x33')]||0x96;this[_0xcd37('0x34')]=_0x1e9d30[_0xcd37('0x34')]||0x3;this[_0xcd37('0x35')]=_0x1e9d30['dialDropRetryFrequency']||0x96;this[_0xcd37('0x36')]=_0x1e9d30[_0xcd37('0x36')]||0x3;this['dialAbandonedRetryFrequency']=_0x1e9d30[_0xcd37('0x37')]||0x96;this[_0xcd37('0x38')]=_0x1e9d30[_0xcd37('0x38')]||0x3;this[_0xcd37('0x39')]=_0x1e9d30[_0xcd37('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x1e9d30[_0xcd37('0x3a')]||0x3;this[_0xcd37('0x3b')]=_0x1e9d30[_0xcd37('0x3b')]||0x96;this[_0xcd37('0x3c')]=_0x1e9d30[_0xcd37('0x3c')]||0x3;this['dialGlobalMaxRetry']=_0x1e9d30[_0xcd37('0x3d')]||0x4;this[_0xcd37('0x3e')]=_0x1e9d30[_0xcd37('0x3e')]?_0x1e9d30['Trunk']:undefined;this['TrunkBackup']=_0x1e9d30[_0xcd37('0x3f')]?_0x1e9d30[_0xcd37('0x3f')]:undefined;this[_0xcd37('0x40')]=_0x1e9d30[_0xcd37('0x40')]||undefined;this['Interval']=_0x1e9d30['Interval']?_0x1e9d30[_0xcd37('0x41')]:undefined;this[_0xcd37('0x42')]=_0x1e9d30[_0xcd37('0x42')]||_0xcd37('0x43');this[_0xcd37('0x44')]=_0x1e9d30[_0xcd37('0x44')]||undefined;this[_0xcd37('0x45')]=_0x1e9d30[_0xcd37('0x45')]||undefined;this[_0xcd37('0x46')]=strategy[_0x1e9d30['strategy']]||_0xcd37('0xa');this['queueStatusComplete']=!![];this[_0xcd37('0x47')]=_0x1e9d30[_0xcd37('0x47')]||![];this[_0xcd37('0x48')]=_0x1e9d30[_0xcd37('0x48')];this[_0xcd37('0x49')]=_0x1e9d30[_0xcd37('0x49')];this[_0xcd37('0x4a')]=_0x1e9d30['dialAMDAfterGreetingSilence'];this[_0xcd37('0x4b')]=_0x1e9d30[_0xcd37('0x4b')];this[_0xcd37('0x4c')]=_0x1e9d30[_0xcd37('0x4c')];this[_0xcd37('0x4d')]=_0x1e9d30[_0xcd37('0x4d')];this[_0xcd37('0x4e')]=_0x1e9d30['dialAMDMaximumNumberOfWords'];this[_0xcd37('0x4f')]=_0x1e9d30['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x1e9d30[_0xcd37('0x50')];this[_0xcd37('0x51')]=0x0;this[_0xcd37('0x52')]=0x0;this[_0xcd37('0x53')]=_0x1e9d30[_0xcd37('0x53')];this['outboundAnswerCallsDay']=0x0;this[_0xcd37('0x54')]=0x0;this[_0xcd37('0x55')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xcd37('0x56')]=0x0;this[_0xcd37('0x57')]=0x0;this[_0xcd37('0x58')]=0x0;this[_0xcd37('0x59')]=0x0;this[_0xcd37('0x5a')]=0x0;this[_0xcd37('0x5b')]=0x0;this[_0xcd37('0x5c')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xcd37('0x5d')]=0x0;this[_0xcd37('0x5e')]=0x0;this['startProgressive']=undefined;this[_0xcd37('0x5f')]=undefined;this[_0xcd37('0x60')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xcd37('0x61')]=0x0;this[_0xcd37('0x62')]=0x0;this[_0xcd37('0x63')]=0x0;this[_0xcd37('0x64')]=0x0;this[_0xcd37('0x65')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xcd37('0x66')]=0x0;this['predictiveIntervalMaxThreshold']=_0x1e9d30[_0xcd37('0x67')]||0x14;this[_0xcd37('0x68')]=_0x1e9d30[_0xcd37('0x67')]||0xa;this[_0xcd37('0x69')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this['erlangCallToSecond']=0x0;this[_0xcd37('0x6a')]=0x0;this[_0xcd37('0x6b')]=0x0;this['dialRecallMeTimeout']=_0x1e9d30['dialRecallMeTimeout']||0x1e;this[_0xcd37('0x6c')]=_0x1e9d30['dialRecallInQueue']||![];this[_0xcd37('0x6d')]=!!_0x1e9d30['dialPreviewAutoRecallMe']||![];this[_0xcd37('0x6e')]=!!_0x1e9d30[_0xcd37('0x6e')]||![];this[_0xcd37('0x6f')]=_0x1e9d30[_0xcd37('0x6f')]||undefined;this[_0xcd37('0x70')]=_0x1e9d30[_0xcd37('0x70')]||![];this[_0xcd37('0x71')]=_0x1e9d30[_0xcd37('0x71')]||![];this[_0xcd37('0xd')]=monitorFormat[_0x1e9d30['monitor_format']]?monitorFormat[_0x1e9d30[_0xcd37('0xd')]]:undefined;this[_0xcd37('0x72')]=_0x1e9d30[_0xcd37('0x72')]||![];this[_0xcd37('0x73')]=_0x1e9d30[_0xcd37('0x73')]?_0x1e9d30[_0xcd37('0x73')]:undefined;}module[_0xcd37('0x74')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 038abad..dfbc923 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 _0x216e=['serverUrl','Configurations','exports','name','accessKey','remoteUri'];(function(_0x299ef7,_0x106e8c){var _0x283d59=function(_0xc7abe5){while(--_0xc7abe5){_0x299ef7['push'](_0x299ef7['shift']());}};_0x283d59(++_0x106e8c);}(_0x216e,0x117));var _0xe216=function(_0x4bdcdd,_0x5b0462){_0x4bdcdd=_0x4bdcdd-0x0;var _0x3c1555=_0x216e[_0x4bdcdd];return _0x3c1555;};'use strict';function VtigerAccount(_0x14077e){this['id']=_0x14077e['id']||0x0;this[_0xe216('0x0')]=_0x14077e[_0xe216('0x0')]||'';this['username']=_0x14077e['username']||'';this[_0xe216('0x1')]=_0x14077e['accessKey']||'';this[_0xe216('0x2')]=_0x14077e[_0xe216('0x2')]||'';this['serverUrl']=_0x14077e[_0xe216('0x3')]||'';this[_0xe216('0x4')]=_0x14077e[_0xe216('0x4')]||{};}module[_0xe216('0x5')]=VtigerAccount; \ No newline at end of file +var _0x39e0=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x212d06,_0x312158){var _0x742812=function(_0x29d819){while(--_0x29d819){_0x212d06['push'](_0x212d06['shift']());}};_0x742812(++_0x312158);}(_0x39e0,0x18e));var _0x039e=function(_0x225e61,_0xb3c102){_0x225e61=_0x225e61-0x0;var _0x41bdad=_0x39e0[_0x225e61];return _0x41bdad;};'use strict';function VtigerAccount(_0x5e28f9){this['id']=_0x5e28f9['id']||0x0;this[_0x039e('0x0')]=_0x5e28f9[_0x039e('0x0')]||'';this[_0x039e('0x1')]=_0x5e28f9['username']||'';this[_0x039e('0x2')]=_0x5e28f9[_0x039e('0x2')]||'';this[_0x039e('0x3')]=_0x5e28f9['remoteUri']||'';this[_0x039e('0x4')]=_0x5e28f9[_0x039e('0x4')]||'';this[_0x039e('0x5')]=_0x5e28f9[_0x039e('0x5')]||{};}module[_0x039e('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 3390c83..7dd230c 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 _0xc9e6=['token','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x28f83c,_0x2f1257){var _0x4210ba=function(_0x485ac1){while(--_0x485ac1){_0x28f83c['push'](_0x28f83c['shift']());}};_0x4210ba(++_0x2f1257);}(_0xc9e6,0x7d));var _0x6c9e=function(_0x4571ba,_0x8f4c5d){_0x4571ba=_0x4571ba-0x0;var _0x226f48=_0xc9e6[_0x4571ba];return _0x226f48;};'use strict';function ZendeskAccount(_0x57aa16){this['id']=_0x57aa16['id']||0x0;this[_0x6c9e('0x0')]=_0x57aa16[_0x6c9e('0x0')]||'';this[_0x6c9e('0x1')]=_0x57aa16['username']||'';this[_0x6c9e('0x2')]=_0x57aa16[_0x6c9e('0x2')]||'';this[_0x6c9e('0x3')]=_0x57aa16['token']||'';this['remoteUri']=_0x57aa16['remoteUri']||'';this['authType']=_0x57aa16['authType']||'';this[_0x6c9e('0x4')]=_0x57aa16[_0x6c9e('0x4')]||_0x6c9e('0x5');this[_0x6c9e('0x6')]=_0x57aa16[_0x6c9e('0x6')]||'';this[_0x6c9e('0x7')]=_0x57aa16[_0x6c9e('0x7')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xdd65=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x50d7fd,_0x30cd62){var _0x512b17=function(_0x305414){while(--_0x305414){_0x50d7fd['push'](_0x50d7fd['shift']());}};_0x512b17(++_0x30cd62);}(_0xdd65,0x18b));var _0x5dd6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xdd65[_0x21a9d9];return _0x46adce;};'use strict';function ZendeskAccount(_0x27ccf7){this['id']=_0x27ccf7['id']||0x0;this[_0x5dd6('0x0')]=_0x27ccf7[_0x5dd6('0x0')]||'';this[_0x5dd6('0x1')]=_0x27ccf7[_0x5dd6('0x1')]||'';this[_0x5dd6('0x2')]=_0x27ccf7[_0x5dd6('0x2')]||'';this['token']=_0x27ccf7[_0x5dd6('0x3')]||'';this[_0x5dd6('0x4')]=_0x27ccf7[_0x5dd6('0x4')]||'';this[_0x5dd6('0x5')]=_0x27ccf7[_0x5dd6('0x5')]||'';this['type']=_0x27ccf7[_0x5dd6('0x6')]||_0x5dd6('0x7');this[_0x5dd6('0x8')]=_0x27ccf7[_0x5dd6('0x8')]||'';this[_0x5dd6('0x9')]=_0x27ccf7['Configurations']||{};}module[_0x5dd6('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 6e38cbc..704efd3 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 _0x29a5=['name','description','host','zone','clientId','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x279c9a,_0x2095ce){var _0x4b712b=function(_0x391c9b){while(--_0x391c9b){_0x279c9a['push'](_0x279c9a['shift']());}};_0x4b712b(++_0x2095ce);}(_0x29a5,0x19a));var _0x529a=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x29a5[_0xa8883];return _0x479426;};'use strict';function ZohoAccount(_0x49b04a){this['id']=_0x49b04a['id']||0x0;this[_0x529a('0x0')]=_0x49b04a['name']||'';this[_0x529a('0x1')]=_0x49b04a[_0x529a('0x1')]||'';this[_0x529a('0x2')]=_0x49b04a[_0x529a('0x2')]||'';this[_0x529a('0x3')]=_0x49b04a[_0x529a('0x3')]||'';this[_0x529a('0x4')]=_0x49b04a['clientId']||'';this['clientSecret']=_0x49b04a['clientSecret']||'';this[_0x529a('0x5')]=_0x49b04a[_0x529a('0x5')]||'';this[_0x529a('0x6')]=_0x49b04a[_0x529a('0x6')]||'';this['refreshToken']=_0x49b04a[_0x529a('0x7')]||'';this[_0x529a('0x8')]=_0x49b04a[_0x529a('0x8')]||{};}module[_0x529a('0x9')]=ZohoAccount; \ No newline at end of file +var _0xb5d7=['Configurations','exports','name','description','host','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x555069,_0x23d66a){var _0x100af7=function(_0x1606bd){while(--_0x1606bd){_0x555069['push'](_0x555069['shift']());}};_0x100af7(++_0x23d66a);}(_0xb5d7,0xa2));var _0x7b5d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb5d7[_0x1035c1];return _0x308d67;};'use strict';function ZohoAccount(_0x439835){this['id']=_0x439835['id']||0x0;this['name']=_0x439835[_0x7b5d('0x0')]||'';this[_0x7b5d('0x1')]=_0x439835['description']||'';this[_0x7b5d('0x2')]=_0x439835[_0x7b5d('0x2')]||'';this['zone']=_0x439835['zone']||'';this[_0x7b5d('0x3')]=_0x439835[_0x7b5d('0x3')]||'';this[_0x7b5d('0x4')]=_0x439835[_0x7b5d('0x4')]||'';this[_0x7b5d('0x5')]=_0x439835[_0x7b5d('0x5')]||'';this[_0x7b5d('0x6')]=_0x439835['code']||'';this[_0x7b5d('0x7')]=_0x439835[_0x7b5d('0x7')]||'';this[_0x7b5d('0x8')]=_0x439835['Configurations']||{};}module[_0x7b5d('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 715739e..2a1669b 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 _0x0b0e=['prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','string','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x362c30,_0x392f61){var _0x53f3ee=function(_0x30c39d){while(--_0x30c39d){_0x362c30['push'](_0x362c30['shift']());}};_0x53f3ee(++_0x392f61);}(_0x0b0e,0x187));var _0xe0b0=function(_0x232cf2,_0x4ffb79){_0x232cf2=_0x232cf2-0x0;var _0x463cec=_0x0b0e[_0x232cf2];return _0x463cec;};'use strict';var util=require(_0xe0b0('0x0'));var _=require('lodash');var moment=require(_0xe0b0('0x1'));function checkNameSurname(_0x536e9b,_0x7e5a8a,_0xdf715e){var _0x3b5e2b='';if(!_[_0xe0b0('0x2')](_0x7e5a8a)&&_0xe0b0('0x3')===typeof _0x7e5a8a){_0x3b5e2b+=_0x7e5a8a;}if(!_[_0xe0b0('0x2')](_0xdf715e)&&_0xe0b0('0x3')===typeof _0xdf715e){_0x3b5e2b+='\x20'+_0xdf715e;}if(_0x3b5e2b!==''){return _0x3b5e2b;}return _0x536e9b;}function Action(_0x185efa,_0x30e20d,_0x28e40f,_0x219b1c,_0x5cf9cc){this['uniqueid']=_0x28e40f||undefined;this[_0xe0b0('0x4')]=_0x185efa['id'];this[_0xe0b0('0x5')]=_0x30e20d[_0xe0b0('0x6')];this[_0xe0b0('0x7')]=_0x30e20d['type'];this[_0xe0b0('0x8')]=_0xe0b0('0x5');this['dialAnswer']=![];this[_0xe0b0('0x9')]=_[_0xe0b0('0x2')](_0x185efa['Agent'])?undefined:_0x185efa[_0xe0b0('0xa')][_0xe0b0('0x6')];this[_0xe0b0('0xb')]=this['membername']?util[_0xe0b0('0xc')](_0xe0b0('0xd'),this[_0xe0b0('0x9')]):_0x219b1c||undefined;this[_0xe0b0('0xe')]=checkNameSurname(_0x185efa[_0xe0b0('0xf')]['phone'],_0x185efa[_0xe0b0('0xf')][_0xe0b0('0x10')],_0x185efa[_0xe0b0('0xf')][_0xe0b0('0x11')]);this[_0xe0b0('0x12')]=_0x185efa['active']||![];this[_0xe0b0('0x13')]=_0x185efa['phone'];this[_0xe0b0('0x14')]=_0x185efa[_0xe0b0('0x14')];this['countbusyretry']=_0x185efa[_0xe0b0('0x15')]||0x0;this['countcongestionretry']=_0x185efa[_0xe0b0('0x16')]||0x0;this[_0xe0b0('0x17')]=_0x185efa['countnoanswerretry']||0x0;this['countglobal']=(_0x185efa[_0xe0b0('0x15')]||0x0)+(_0x185efa['countcongestionretry']||0x0)+(_0x185efa['countnoanswerretry']||0x0)+(_0x185efa['countnosuchnumberretry']||0x0)+(_0x185efa[_0xe0b0('0x18')]||0x0)+(_0x185efa['countabandonedretry']||0x0)+(_0x185efa['countmachineretry']||0x0)+(_0x185efa[_0xe0b0('0x19')]||0x0);this['countnosuchnumberretry']=_0x185efa[_0xe0b0('0x1a')]||0x0;this['countdropretry']=_0x185efa[_0xe0b0('0x18')]||0x0;this[_0xe0b0('0x1b')]=_0x185efa[_0xe0b0('0x1b')]||0x0;this[_0xe0b0('0x1c')]=_0x185efa[_0xe0b0('0x1c')]||0x0;this['countagentrejectretry']=_0x185efa['countagentrejectretry']||0x0;this[_0xe0b0('0x1d')]=_0x185efa['callback'];this[_0xe0b0('0x1e')]=_0x185efa[_0xe0b0('0x1e')];this['callbackat']=_0x185efa[_0xe0b0('0x1f')];this['recallme']=_0x185efa[_0xe0b0('0x20')];this['ContactId']=_0x185efa[_0xe0b0('0x21')];this['ListId']=_0x185efa[_0xe0b0('0x22')];this['UserId']=_[_0xe0b0('0x2')](_0x185efa['Agent'])?_0x185efa[_0xe0b0('0x23')]:_0x185efa['Agent']['id'];this[_0xe0b0('0x24')]=_0x185efa[_0xe0b0('0x24')];this[_0xe0b0('0x25')]='';this[_0xe0b0('0x26')]='';}Action[_0xe0b0('0x27')][_0xe0b0('0x28')]=function(){return util['format'](_0xe0b0('0x29'),this[_0xe0b0('0xe')],this['number']);};module[_0xe0b0('0x2a')]=Action; \ No newline at end of file +var _0xa30a=['Agent','channelAgent','membername','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','queue','name','type','campaigntype'];(function(_0x351dcd,_0x292f43){var _0x24185c=function(_0x4340a3){while(--_0x4340a3){_0x351dcd['push'](_0x351dcd['shift']());}};_0x24185c(++_0x292f43);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xaa30('0x0'));var _=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));function checkNameSurname(_0x4dfa7e,_0x49b545,_0x1ebf61){var _0x36f517='';if(!_[_0xaa30('0x3')](_0x49b545)&&_0xaa30('0x4')===typeof _0x49b545){_0x36f517+=_0x49b545;}if(!_[_0xaa30('0x3')](_0x1ebf61)&&_0xaa30('0x4')===typeof _0x1ebf61){_0x36f517+='\x20'+_0x1ebf61;}if(_0x36f517!==''){return _0x36f517;}return _0x4dfa7e;}function Action(_0x555947,_0x347cd5,_0x4efe89,_0x8af448,_0x14fe09){this[_0xaa30('0x5')]=_0x4efe89||undefined;this['idContact']=_0x555947['id'];this[_0xaa30('0x6')]=_0x347cd5[_0xaa30('0x7')];this[_0xaa30('0x8')]=_0x347cd5[_0xaa30('0x8')];this[_0xaa30('0x9')]=_0xaa30('0x6');this['dialAnswer']=![];this['membername']=_[_0xaa30('0x3')](_0x555947['Agent'])?undefined:_0x555947[_0xaa30('0xa')][_0xaa30('0x7')];this[_0xaa30('0xb')]=this[_0xaa30('0xc')]?util['format'](_0xaa30('0xd'),this[_0xaa30('0xc')]):_0x8af448||undefined;this[_0xaa30('0xe')]=checkNameSurname(_0x555947['Contact'][_0xaa30('0xf')],_0x555947[_0xaa30('0x10')][_0xaa30('0x11')],_0x555947[_0xaa30('0x10')][_0xaa30('0x12')]);this[_0xaa30('0x13')]=_0x555947[_0xaa30('0x13')]||![];this[_0xaa30('0x14')]=_0x555947[_0xaa30('0xf')];this[_0xaa30('0x15')]=_0x555947['scheduledat'];this[_0xaa30('0x16')]=_0x555947['countbusyretry']||0x0;this['countcongestionretry']=_0x555947[_0xaa30('0x17')]||0x0;this[_0xaa30('0x18')]=_0x555947[_0xaa30('0x18')]||0x0;this['countglobal']=(_0x555947['countbusyretry']||0x0)+(_0x555947['countcongestionretry']||0x0)+(_0x555947[_0xaa30('0x18')]||0x0)+(_0x555947['countnosuchnumberretry']||0x0)+(_0x555947[_0xaa30('0x19')]||0x0)+(_0x555947[_0xaa30('0x1a')]||0x0)+(_0x555947['countmachineretry']||0x0)+(_0x555947['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x555947[_0xaa30('0x1b')]||0x0;this[_0xaa30('0x19')]=_0x555947[_0xaa30('0x19')]||0x0;this[_0xaa30('0x1a')]=_0x555947[_0xaa30('0x1a')]||0x0;this['countmachineretry']=_0x555947[_0xaa30('0x1c')]||0x0;this[_0xaa30('0x1d')]=_0x555947[_0xaa30('0x1d')]||0x0;this[_0xaa30('0x1e')]=_0x555947[_0xaa30('0x1e')];this['callbackuniqueid']=_0x555947[_0xaa30('0x1f')];this[_0xaa30('0x20')]=_0x555947[_0xaa30('0x20')];this[_0xaa30('0x21')]=_0x555947['recallme'];this[_0xaa30('0x22')]=_0x555947[_0xaa30('0x22')];this[_0xaa30('0x23')]=_0x555947[_0xaa30('0x23')];this[_0xaa30('0x24')]=_[_0xaa30('0x3')](_0x555947['Agent'])?_0x555947[_0xaa30('0x24')]:_0x555947[_0xaa30('0xa')]['id'];this['VoiceQueueId']=_0x555947[_0xaa30('0x25')];this['originatecalleridnum']='';this[_0xaa30('0x26')]='';}Action[_0xaa30('0x27')][_0xaa30('0x28')]=function(){return util[_0xaa30('0x29')](_0xaa30('0x2a'),this[_0xaa30('0xe')],this[_0xaa30('0x2b')]);};module[_0xaa30('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 32d04be..4b1c0b5 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 _0x9b44=['custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','countabandonedretry','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','dialAgentRejectRetryFrequency','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','originated:\x20','resolve','[verifyAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unlock','execRun','getContactPreview','recallme','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridnum','extractCalleridNumber','addVariables','merge','variables','variablesAction','[originateFailure][logOriginateFailure]','syncNewExten','actionid','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','Answer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','util','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../rpc/cmHopperAdditionalPhone','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','strategy','available','loggedIn','pTalking','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','type','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','stringify','dialAnswer','pick','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[action]','size','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','rescheduleContactInQueue','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','dialActive','isTrunkReachable','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','buildAcw','complete','[16]','[callProgressDetectingCustomer][logAnswer]','talktime','sumBillable','linkedid','BUSY','countbusyretry','totalGlobal','Busy','verifyAdditionalPhones','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency'];(function(_0x34fcee,_0x21b407){var _0xaf2194=function(_0x2ad21a){while(--_0x2ad21a){_0x34fcee['push'](_0x34fcee['shift']());}};_0xaf2194(++_0x21b407);}(_0x9b44,0x1ea));var _0x49b4=function(_0x4b9dc9,_0x14b3a2){_0x4b9dc9=_0x4b9dc9-0x0;var _0x57b302=_0x9b44[_0x4b9dc9];return _0x57b302;};'use strict';var util=require(_0x49b4('0x0'));var _=require(_0x49b4('0x1'));var uuid=require('uuid');var moment=require(_0x49b4('0x2'));var md5=require(_0x49b4('0x3'));var Redis=require(_0x49b4('0x4'));var config=require(_0x49b4('0x5'));var logger=require(_0x49b4('0x6'))(_0x49b4('0x7'));var loggerAction=require(_0x49b4('0x6'))(_0x49b4('0x8'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x49b4('0x9'));var Action=require('./action');var ut=require(_0x49b4('0xa'));config[_0x49b4('0xb')]=_[_0x49b4('0xc')](config[_0x49b4('0xb')],{'host':_0x49b4('0xd'),'port':0x18eb});var io=require(_0x49b4('0xe'))(new Redis(config[_0x49b4('0xb')]));var Sequence=function(){};Sequence[_0x49b4('0xf')]['enqueue']=function(_0x1239a9){this[_0x49b4('0x10')]=this[_0x49b4('0x10')]?this[_0x49b4('0x10')][_0x49b4('0x11')](_0x1239a9):_0x1239a9();};function Preview(_0x5c034f){this[_0x49b4('0x12')]=new Sequence();this[_0x49b4('0x13')]=_0x5c034f[_0x49b4('0x14')];this[_0x49b4('0x15')]=_0x5c034f['trunks'];this[_0x49b4('0x16')]={};this[_0x49b4('0x17')]=_0x5c034f[_0x49b4('0x17')];this[_0x49b4('0x18')]=0x0;ami['on'](_0x49b4('0x19'),this[_0x49b4('0x1a')][_0x49b4('0x1b')](this));ami['on']('hangup',this[_0x49b4('0x1c')][_0x49b4('0x1b')](this));ami['on'](_0x49b4('0x1d'),this[_0x49b4('0x1e')][_0x49b4('0x1b')](this));ami['on'](_0x49b4('0x1f'),this[_0x49b4('0x20')][_0x49b4('0x1b')](this));ami['on']('newexten',this['syncNewExten'][_0x49b4('0x1b')](this));ami['on'](_0x49b4('0x21'),this[_0x49b4('0x22')][_0x49b4('0x1b')](this));ami['on'](_0x49b4('0x23'),this[_0x49b4('0x24')]['bind'](this));ami['on']('blindtransfer',this[_0x49b4('0x25')][_0x49b4('0x1b')](this));this[_0x49b4('0x26')](this['campaignsPreview']);}function emit(_0x537ec2,_0x14e55e,_0xcb597d){io['to'](_0x537ec2)[_0x49b4('0x27')](_0x14e55e,_0xcb597d);}function emitCampaignPreview(_0x5a5bc7){if(_0x5a5bc7['type']==='outbound'){var _0xfa5149={'id':_0x5a5bc7['id'],'name':_0x5a5bc7['name'],'strategy':_0x5a5bc7[_0x49b4('0x28')],'answered':_0x5a5bc7['answered'],'available':_0x5a5bc7[_0x49b4('0x29')],'loggedIn':_0x5a5bc7[_0x49b4('0x2a')],'pTalking':_0x5a5bc7[_0x49b4('0x2b')],'sumBillable':_0x5a5bc7['sumBillable'],'sumDuration':_0x5a5bc7['sumDuration'],'sumHoldTime':_0x5a5bc7[_0x49b4('0x2c')]||0x0,'talking':_0x5a5bc7[_0x49b4('0x2d')],'total':_0x5a5bc7[_0x49b4('0x2e')],'type':_0x5a5bc7['type'],'unmanaged':_0x5a5bc7[_0x49b4('0x2f')],'abandoned':_0x5a5bc7[_0x49b4('0x30')],'waiting':_0x5a5bc7[_0x49b4('0x31')],'loggedInDb':_0x5a5bc7[_0x49b4('0x32')],'dialActive':_0x5a5bc7['dialActive'],'dialMethod':_0x5a5bc7[_0x49b4('0x33')],'dialOriginateCallerIdName':_0x5a5bc7['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x5a5bc7['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x5a5bc7[_0x49b4('0x34')],'dialPrefix':_0x5a5bc7['dialPrefix'],'outboundAnswerAgiCallsDay':_0x5a5bc7['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x5a5bc7[_0x49b4('0x35')],'outboundBlacklistCallsDay':_0x5a5bc7[_0x49b4('0x36')],'outboundBusyCallsDay':_0x5a5bc7[_0x49b4('0x37')],'outboundCongestionCallsDay':_0x5a5bc7[_0x49b4('0x38')],'outboundDropCallsDayACS':_0x5a5bc7['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x5a5bc7['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5a5bc7[_0x49b4('0x39')],'outboundNoAnswerCallsDay':_0x5a5bc7[_0x49b4('0x3a')],'outboundNoSuchCallsDay':_0x5a5bc7[_0x49b4('0x3b')],'outboundOriginateFailureCallsDay':_0x5a5bc7['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5a5bc7['outboundReCallsDay'],'outboundRejectCallsDay':_0x5a5bc7[_0x49b4('0x3c')],'outboundUnknownCallsDay':_0x5a5bc7[_0x49b4('0x3d')],'outboundAbandonedCallsDay':_0x5a5bc7[_0x49b4('0x3e')],'predictiveIntervalAnsweredCalls':_0x5a5bc7['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5a5bc7[_0x49b4('0x3f')],'predictiveIntervalAvgTalktime':_0x5a5bc7[_0x49b4('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x5a5bc7[_0x49b4('0x41')],'predictiveIntervalDroppedCallsTimeout':_0x5a5bc7[_0x49b4('0x42')],'predictiveIntervalErlangCalls':_0x5a5bc7[_0x49b4('0x43')],'predictiveIntervalErlangCallsDroppedCalls':_0x5a5bc7[_0x49b4('0x44')],'predictiveIntervalHitRate':_0x5a5bc7[_0x49b4('0x45')],'predictiveIntervalMultiplicativeFactor':_0x5a5bc7[_0x49b4('0x46')],'predictiveIntervalPauses':_0x5a5bc7[_0x49b4('0x47')],'predictiveIntervalAvailable':_0x5a5bc7[_0x49b4('0x48')],'predictiveIntervalTotalCalls':_0x5a5bc7[_0x49b4('0x49')],'message':_0x5a5bc7[_0x49b4('0x4a')],'originated':_0x5a5bc7[_0x49b4('0x4b')],'erlangCalls':_0x5a5bc7[_0x49b4('0x4c')],'erlangCallToSecond':_0x5a5bc7[_0x49b4('0x4d')],'erlangAbandonmentRate':_0x5a5bc7[_0x49b4('0x4e')],'erlangBusyFactor':_0x5a5bc7[_0x49b4('0x4f')],'startPredictive':_0x5a5bc7[_0x49b4('0x50')],'startProgressive':_0x5a5bc7[_0x49b4('0x51')]};if(_0x5a5bc7[_0x49b4('0x52')]){_0xfa5149[_0x49b4('0x52')]={'id':_0x5a5bc7['Trunk']['id'],'name':_0x5a5bc7[_0x49b4('0x52')]['name'],'active':_0x5a5bc7[_0x49b4('0x52')][_0x49b4('0x53')],'callerid':_0x5a5bc7[_0x49b4('0x52')][_0x49b4('0x54')]};}if(_0x5a5bc7['Interval']){_0xfa5149[_0x49b4('0x55')]={'id':_0x5a5bc7[_0x49b4('0x55')]['id'],'name':_0x5a5bc7['Interval'][_0x49b4('0x56')]};}var _0x19c39b=md5(JSON['stringify'](_0xfa5149));if(_0x5a5bc7[_0x49b4('0x3')]!==_0x19c39b){_0x5a5bc7[_0x49b4('0x3')]=_0x19c39b;emit(util['format'](_0x49b4('0x57'),_0xfa5149['name']),_0x49b4('0x58'),_0xfa5149);}}}function emitVoiceQueueChannelRemove(_0x18b564){logger[_0x49b4('0x59')](_0x49b4('0x5a'),JSON['stringify'](_0x18b564));emit(util[_0x49b4('0x5b')](_0x49b4('0x57'),_0x18b564[_0x49b4('0x56')]),'voice_queue_channel:remove',_0x18b564);io[_0x49b4('0x27')]('voice_queue_presence:remove',_0x18b564);}function notSendMessagesQueue(_0x579962){if(_0x579962[_0x49b4('0x5c')]){if(_0x579962[_0x49b4('0x4b')]===0x0&&_0x579962[_0x49b4('0x2b')]===0x0){_0x579962[_0x49b4('0x5c')]=![];_0x579962['available']=0x0;_0x579962[_0x49b4('0x5d')]=0x0;_0x579962[_0x49b4('0x4a')]=_0x49b4('0x5e');ut[_0x49b4('0x5f')](_0x49b4('0x60'),_0x579962[_0x49b4('0x56')]+_0x49b4('0x61'));}else{_0x579962[_0x49b4('0x4a')]=_0x49b4('0x62');ut['logger'](_0x49b4('0x60'),_0x579962['name']+_0x49b4('0x63'));}emitCampaignPreview(_0x579962);}}Preview[_0x49b4('0xf')][_0x49b4('0x26')]=function(){var _0xbecf2=this;setInterval(function(){_0xbecf2[_0x49b4('0x64')]();},0x7cf);};Preview[_0x49b4('0xf')][_0x49b4('0x64')]=function(){var _0x11234c=this['campaignsPreview'];this[_0x49b4('0x18')]+=0x1;for(var _0x220319 in _0x11234c){if(_0x11234c[_0x49b4('0x65')](_0x220319)&&(_0x11234c[_0x220319][_0x49b4('0x33')]===_0x49b4('0x7')||_0x11234c[_0x220319]['dialMethod']==='booked')&&_0x11234c[_0x220319][_0x49b4('0x66')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x49b4('0x18')]=0x0;this[_0x49b4('0x67')]();}}if(_0x11234c[_0x49b4('0x65')](_0x220319)&&_0x11234c[_0x220319]['dialMethod']===_0x49b4('0x7')&&_0x11234c[_0x220319][_0x49b4('0x66')]==='outbound'){if(_0x11234c[_0x220319]['dialActive']){this[_0x49b4('0x68')](_0x11234c[_0x220319]);if(_0x11234c[_0x220319][_0x49b4('0x69')])this[_0x49b4('0x6a')](_0x11234c[_0x220319]);}else{notSendMessagesQueue(_0x11234c[_0x220319]);}}}};Preview[_0x49b4('0xf')][_0x49b4('0x6b')]=function(_0xbad117){var _0x5e37ee=this;this[_0x49b4('0x12')][_0x49b4('0x6c')](function(){if(!_[_0x49b4('0x6d')](_0x5e37ee['actions'][_0xbad117])){loggerAction['info'](_0x49b4('0x6e'),_0xbad117,_0x49b4('0x6f'),_0x5e37ee['actions'][_0xbad117][_0x49b4('0x70')],'originated:\x20',JSON[_0x49b4('0x71')](_0x5e37ee[_0x49b4('0x13')][_0x5e37ee[_0x49b4('0x16')][_0xbad117][_0x49b4('0x70')]][_0x49b4('0x4b')]),'pTalking:\x20',JSON[_0x49b4('0x71')](_0x5e37ee['campaignsPreview'][_0x5e37ee[_0x49b4('0x16')][_0xbad117][_0x49b4('0x70')]][_0x49b4('0x2b')]),JSON[_0x49b4('0x71')](_0x5e37ee['actions'][_0xbad117][_0x49b4('0x72')]),JSON['stringify'](_[_0x49b4('0x73')](_0x5e37ee['actions'][_0xbad117],['contactId',_0x49b4('0x74'),'VoiceQueueId',_0x49b4('0x75')])));return ami[_0x49b4('0x76')]({'action':_0x49b4('0x77'),'channel':_0x5e37ee[_0x49b4('0x16')][_0xbad117][_0x49b4('0x78')]})[_0x49b4('0x79')](function(_0x285faf){if(_0x285faf[_0x49b4('0x4a')]===_0x49b4('0x7a')){setTimeout(function(){if(_0x5e37ee[_0x49b4('0x16')][_0xbad117]){ut['updateOriginated'](_0x5e37ee[_0x49b4('0x13')][_0x5e37ee[_0x49b4('0x16')][_0xbad117][_0x49b4('0x70')]],_0x49b4('0x7b'));if(_0x5e37ee['actions'][_0xbad117][_0x49b4('0x72')]===!![]){ut[_0x49b4('0x7c')](_0x5e37ee[_0x49b4('0x13')][_0x5e37ee[_0x49b4('0x16')][_0xbad117][_0x49b4('0x70')]],'[clearZombieChannel]');ut['loggerError'](_0x49b4('0x7d')+_0xbad117,_0x5e37ee[_0x49b4('0x16')][_0xbad117]['queue']);}ut[_0x49b4('0x7e')]('[Dialer][checkChannel][Preview]'+_0xbad117,_0x5e37ee[_0x49b4('0x16')][_0xbad117][_0x49b4('0x70')]);delete _0x5e37ee[_0x49b4('0x16')][_0xbad117];}},0x2328);}});}});};Preview[_0x49b4('0xf')][_0x49b4('0x67')]=function(){var _0x121e61=this;loggerAction[_0x49b4('0x59')](_0x49b4('0x7f'),_[_0x49b4('0x80')](this[_0x49b4('0x16')]));for(var _0x27e904 in this[_0x49b4('0x16')]){if(_0x121e61[_0x49b4('0x16')][_0x49b4('0x65')](_0x27e904)){_0x121e61[_0x49b4('0x6b')](_0x27e904);}}};Preview['prototype'][_0x49b4('0x6a')]=function(_0x1e6871){var _0x3cbcfd=this;rpcDb['getContactRecallMe'](_0x1e6871['id'],ut['agentReadyId'](this[_0x49b4('0x17')]))[_0x49b4('0x81')](function(_0x209be3){if(!_[_0x49b4('0x6d')](_0x209be3)){for(var _0x21c02e=0x0;_0x21c02e<_0x209be3[_0x49b4('0x82')];_0x21c02e+=0x1){if(ut['getDiff'](_0x209be3[_0x21c02e][_0x49b4('0x83')])<_0x1e6871[_0x49b4('0x84')]*0x3c){if(_0x209be3[_0x21c02e][_0x49b4('0x85')]&&!_0x209be3[_0x21c02e]['Agent'][_0x49b4('0x86')]){_0x3cbcfd[_0x49b4('0x87')](_0x209be3[_0x21c02e]['id'])[_0x49b4('0x81')](ut['logger2'](_0x49b4('0x88')))['catch'](ut[_0x49b4('0x89')](_0x49b4('0x88')));}else{rpcDb[_0x49b4('0x8a')](_0x209be3[_0x21c02e]['id']);}}else{var _0x75341=new Action(_0x209be3[_0x21c02e],_0x1e6871);_0x75341[_0x49b4('0x8b')]=moment()[_0x49b4('0x5b')](_0x49b4('0x8c'));_0x1e6871[_0x49b4('0x8d')]+=0x1;ut[_0x49b4('0x8e')](_0x75341,0x17,_0x49b4('0x8f'));if(_0x1e6871['dialRecallInQueue']){rpcDb[_0x49b4('0x90')](ut['createBody'](_0x209be3[_0x21c02e]));rpcDb[_0x49b4('0x91')](_0x75341,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x49b4('0x8e')](_0x75341,0x16,_0x49b4('0x92'));rpcDb[_0x49b4('0x91')](_0x75341,_0x49b4('0x93'));rpcDb['createCustomerFinal'](_0x75341,_0x49b4('0x93'));}}}}})['catch'](ut[_0x49b4('0x89')](_0x49b4('0x94')));};Preview[_0x49b4('0xf')][_0x49b4('0x68')]=function(_0x2fdcec){_0x2fdcec[_0x49b4('0x5c')]=!![];if(ut[_0x49b4('0x95')](_0x2fdcec['loggedIn'])){_0x2fdcec[_0x49b4('0x4a')]=_0x49b4('0x96');}else if(!ut['isActive'](_0x2fdcec[_0x49b4('0x97')])){_0x2fdcec[_0x49b4('0x4a')]=_0x49b4('0x5e');}else if(!this['isTrunkReachable'](_0x2fdcec['Trunk'])){if(!this[_0x49b4('0x98')](_0x2fdcec['TrunkBackup'])){_0x2fdcec[_0x49b4('0x4a')]='TRUNK_IS_NOT_REACHABLE';}else{_0x2fdcec[_0x49b4('0x4a')]='ACTIVE';}}else{_0x2fdcec['message']=_0x49b4('0x99');}emitCampaignPreview(_0x2fdcec);};Preview[_0x49b4('0xf')][_0x49b4('0x9a')]=function(_0x45d71a,_0x5de247,_0x4b5eb1){var _0x577062=this;var _0x41e9aa=this[_0x49b4('0x16')][_0x5de247];var _0x559499=this['campaignsPreview'][_0x41e9aa['queue']];var _0x4a58c6;var _0x233fb4=![];var _0x52708e=0x2;var _0x45c6ec=0x3;if(_0x559499){switch(_0x4b5eb1){case'1':_0x559499['outboundNoSuchCallsDay']+=0x1;_0x41e9aa[_0x49b4('0x9b')]+=0x1;_0x41e9aa[_0x49b4('0x9c')]=ut['totalGlobal'](_0x41e9aa);ut['logCustomer'](_0x41e9aa,0x0,_0x49b4('0x9d'));ami[_0x49b4('0x27')](_0x49b4('0x9e'),ut[_0x49b4('0x9f')](_0x41e9aa,_0x49b4('0xa0')));rpcDb[_0x49b4('0x91')](_0x41e9aa,_0x49b4('0xa1'));_0x577062['verifyAdditionalPhones'](_0x41e9aa,'0',_0x559499)['then'](function(_0x4d59d4){_0x233fb4=_0x4d59d4[_0x49b4('0xa2')]==0x1;_0x52708e=_0x559499[_0x49b4('0xa3')];_0x45c6ec=_0x559499[_0x49b4('0xa4')];if(!_0x233fb4){if(ut['totalGlobal'](_0x41e9aa)>=_0x559499['dialGlobalMaxRetry']){_0x4a58c6=ut['cloneAction'](_0x41e9aa,0xf,_0x49b4('0xa5'));rpcDb[_0x49b4('0xa6')](_0x4a58c6,_0x49b4('0xa7'));}else{if(_0x41e9aa[_0x49b4('0x9b')]>=_0x559499[_0x49b4('0xa8')]){rpcDb[_0x49b4('0xa6')](_0x41e9aa,_0x49b4('0xa7'));}else{rpcDb['rescheduleContact'](ut[_0x49b4('0xa9')](_0x41e9aa,_0x49b4('0x9b'),_0x559499[_0x49b4('0xa3')]),_0x41e9aa[_0x49b4('0xaa')],_0x41e9aa[_0x49b4('0xab')]);}}delete this[_0x49b4('0x16')][_0x45d71a['linkedid']];}else{_0x41e9aa[_0x49b4('0x9b')]++;logger[_0x49b4('0x59')]('actioncountonusuch',_0x41e9aa['countnosuchnumberretry']);logger[_0x49b4('0x59')]('id',_0x41e9aa['idContact']);_0x577062[_0x49b4('0xac')]({'id':_0x41e9aa[_0x49b4('0xad')],'field':{'countnosuchnumberretry':_0x41e9aa['countnosuchnumberretry']}})[_0x49b4('0x81')](function(){_0x577062[_0x49b4('0xae')](_0x41e9aa,_0x52708e,_0x45c6ec)[_0x49b4('0x81')](function(){});});}});break;case _0x49b4('0xaf'):var _0x13b756=moment()[_0x49b4('0x5b')](_0x49b4('0x8c'));_0x41e9aa[_0x49b4('0xb0')]=_0x13b756;_0x41e9aa[_0x49b4('0xb1')]=_0x13b756;_0x41e9aa[_0x49b4('0x72')]=!![];_0x559499[_0x49b4('0x2b')]+=0x1;logger[_0x49b4('0x59')](_0x49b4('0xb2'),_0x41e9aa[_0x49b4('0xb3')],_0x49b4('0xb4'),_0x559499[_0x49b4('0x56')],_0x49b4('0xb5'),_0x559499[_0x49b4('0x2b')]);ami['emit'](_0x49b4('0xb6'),ut[_0x49b4('0x9f')](_0x41e9aa,_0x49b4('0xb7'),this[_0x49b4('0x13')][_0x41e9aa[_0x49b4('0x70')]]));if(_0x559499['acw']){ami[_0x49b4('0x27')]('custom:agentConnectPreview',ut[_0x49b4('0xb8')](_0x41e9aa));}break;case'16':ami[_0x49b4('0x27')]('custom:agentcomplete',ut[_0x49b4('0x9f')](_0x41e9aa,_0x49b4('0xb9'),this[_0x49b4('0x13')][_0x41e9aa[_0x49b4('0x70')]]));emitVoiceQueueChannelRemove(ut[_0x49b4('0x9f')](_0x41e9aa,_0x49b4('0xb9')));_0x559499[_0x49b4('0x35')]+=0x1;_0x559499[_0x49b4('0x2e')]+=0x1;_0x559499['answered']+=0x1;ut[_0x49b4('0x7c')](_0x559499,_0x49b4('0xba'));_0x41e9aa[_0x49b4('0x9c')]=ut['totalGlobal'](_0x41e9aa);ut[_0x49b4('0x8e')](_0x41e9aa,0x4,'Answer');rpcDb[_0x49b4('0x91')](_0x41e9aa,_0x49b4('0xbb'));rpcDb[_0x49b4('0xa6')](_0x41e9aa,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x41e9aa);_0x559499['sumDuration']+=_0x41e9aa[_0x49b4('0xbc')];_0x559499[_0x49b4('0xbd')]+=_0x41e9aa[_0x49b4('0xbc')];logger[_0x49b4('0x59')]('[syncHangup][talking][decrement]',_0x41e9aa[_0x49b4('0xb3')],_0x49b4('0xb4'),_0x559499[_0x49b4('0x56')],_0x49b4('0xb5'),_0x559499[_0x49b4('0x2b')]);delete this['actions'][_0x45d71a[_0x49b4('0xbe')]];break;case _0x49b4('0xbf'):_0x559499[_0x49b4('0x37')]+=0x1;_0x41e9aa[_0x49b4('0xc0')]+=0x1;_0x41e9aa[_0x49b4('0x9c')]=ut[_0x49b4('0xc1')](_0x41e9aa);ut['logCustomer'](_0x41e9aa,0x5,_0x49b4('0xc2'));_0x52708e=_0x559499['dialBusyRetryFrequency'];_0x45c6ec=_0x559499[_0x49b4('0xa4')];ami[_0x49b4('0x27')]('custom:agentbusy',ut[_0x49b4('0x9f')](_0x41e9aa,'busy'));rpcDb[_0x49b4('0x91')](_0x41e9aa,'[callProgressDetectingCustomer][logBusy]');_0x577062[_0x49b4('0xc3')](_0x41e9aa,'5',_0x559499)[_0x49b4('0x81')](function(_0x2b8a38){_0x233fb4=_0x2b8a38[_0x49b4('0xa2')]==0x1;if(!_0x233fb4){if(ut[_0x49b4('0xc1')](_0x41e9aa)>=_0x559499[_0x49b4('0xc4')]){_0x4a58c6=ut[_0x49b4('0xc5')](_0x41e9aa,0xf,'Global');rpcDb['createCustomerFinal'](_0x4a58c6,_0x49b4('0xc6'));}else{if(_0x41e9aa[_0x49b4('0xc0')]>=_0x559499[_0x49b4('0xc7')]){rpcDb[_0x49b4('0xa6')](_0x41e9aa,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x49b4('0xc8')](ut[_0x49b4('0xa9')](_0x41e9aa,_0x49b4('0xc0'),_0x559499[_0x49b4('0xc9')]),_0x41e9aa[_0x49b4('0xaa')],_0x41e9aa[_0x49b4('0xab')]);}}}else{_0x41e9aa[_0x49b4('0xc0')]++;_0x577062['incrementPreviewCounters']({'id':_0x41e9aa['idContact'],'field':{'countbusyretry':_0x41e9aa[_0x49b4('0xc0')]}})[_0x49b4('0x81')](function(){_0x577062['swapAdditionalPhones'](_0x41e9aa,_0x52708e,_0x45c6ec)[_0x49b4('0x81')](function(){});});}});break;case _0x49b4('0xca'):_0x559499[_0x49b4('0x3a')]+=0x1;_0x41e9aa[_0x49b4('0xcb')]+=0x1;_0x41e9aa['countglobal']=ut[_0x49b4('0xc1')](_0x41e9aa);ut[_0x49b4('0x8e')](_0x41e9aa,0x3,_0x49b4('0xcc'));_0x52708e=_0x559499[_0x49b4('0xcd')];_0x45c6ec=_0x559499['callAdditionalPhoneAfterMin'];var _0x5ddf8b=ut['buildNoAnswerEventPayload'](_0x41e9aa,_0x559499);ami[_0x49b4('0x27')](_0x49b4('0xce'),_0x5ddf8b);rpcDb[_0x49b4('0x91')](_0x41e9aa,'[callProgressDetectingCustomer][logNoAnswer]');_0x577062[_0x49b4('0xc3')](_0x41e9aa,'3',_0x559499)['then'](function(_0x4ca822){_0x233fb4=_0x4ca822[_0x49b4('0xa2')]==0x1;if(!_0x233fb4){if(ut[_0x49b4('0xc1')](_0x41e9aa)>=_0x559499['dialGlobalMaxRetry']){_0x4a58c6=ut[_0x49b4('0xc5')](_0x41e9aa,0xf,_0x49b4('0xa5'));rpcDb[_0x49b4('0xa6')](_0x4a58c6,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x41e9aa['countnoanswerretry']>=_0x559499[_0x49b4('0xcf')]){rpcDb[_0x49b4('0xa6')](_0x41e9aa,_0x49b4('0xd0'));}else{rpcDb[_0x49b4('0xc8')](ut['scheduledAt'](_0x41e9aa,'countnoanswerretry',_0x559499[_0x49b4('0xcd')]),_0x41e9aa['unlockAgent'],_0x41e9aa[_0x49b4('0xab')]);}}}else{_0x41e9aa['countnoanswerretry']++;_0x577062[_0x49b4('0xac')]({'id':_0x41e9aa['idContact'],'field':{'countnoanswerretry':_0x41e9aa[_0x49b4('0xcb')]}})[_0x49b4('0x81')](function(){_0x577062[_0x49b4('0xae')](_0x41e9aa,_0x52708e,_0x45c6ec)[_0x49b4('0x81')](function(){});});}});break;case'CONGESTION':_0x559499[_0x49b4('0x38')]+=0x1;_0x41e9aa[_0x49b4('0xd1')]+=0x1;_0x41e9aa[_0x49b4('0x9c')]=ut[_0x49b4('0xc1')](_0x41e9aa);ut[_0x49b4('0x8e')](_0x41e9aa,0x8,'Congestion');_0x52708e=_0x559499[_0x49b4('0xd2')];_0x45c6ec=_0x559499[_0x49b4('0xa4')];ami['emit'](_0x49b4('0xd3'),ut[_0x49b4('0x9f')](_0x41e9aa,_0x49b4('0xd4')));rpcDb['createCustomerHistory'](_0x41e9aa,_0x49b4('0xd5'));_0x577062['verifyAdditionalPhones'](_0x41e9aa,'8',_0x559499)[_0x49b4('0x81')](function(_0x482047){_0x233fb4=_0x482047[_0x49b4('0xa2')]==0x1;if(!_0x233fb4){if(ut['totalGlobal'](_0x41e9aa)>=_0x559499[_0x49b4('0xc4')]){_0x4a58c6=ut[_0x49b4('0xc5')](_0x41e9aa,0xf,_0x49b4('0xa5'));rpcDb[_0x49b4('0xa6')](_0x4a58c6,_0x49b4('0xd6'));}else{if(_0x41e9aa[_0x49b4('0xd1')]>=_0x559499[_0x49b4('0xd7')]){rpcDb[_0x49b4('0xa6')](_0x41e9aa,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x49b4('0xa9')](_0x41e9aa,_0x49b4('0xd1'),_0x559499[_0x49b4('0xc9')]),_0x41e9aa[_0x49b4('0xaa')],_0x41e9aa['activeContact']);}}}else{_0x41e9aa['countcongestionretry']++;_0x577062[_0x49b4('0xac')]({'id':_0x41e9aa[_0x49b4('0xad')],'field':{'countcongestionretry':_0x41e9aa['countcongestionretry']}})[_0x49b4('0x81')](function(){_0x577062['swapAdditionalPhones'](_0x41e9aa,_0x52708e,_0x45c6ec)[_0x49b4('0x81')](function(){});});}});break;case _0x49b4('0xd8'):_0x559499[_0x49b4('0x3c')]+=0x1;_0x41e9aa['countagentrejectretry']+=0x1;_0x41e9aa['countglobal']=ut[_0x49b4('0xc1')](_0x41e9aa);ut['logCustomer'](_0x41e9aa,0x14,'AgentReject');_0x52708e=_0x559499['dialAgentRejectRetryFrequency'];_0x45c6ec=_0x559499[_0x49b4('0xa4')];ami[_0x49b4('0x27')](_0x49b4('0xd9'),ut[_0x49b4('0x9f')](_0x41e9aa,_0x49b4('0xda')));rpcDb[_0x49b4('0x91')](_0x41e9aa,_0x49b4('0xdb'));_0x577062[_0x49b4('0xc3')](_0x41e9aa,'20',_0x559499)[_0x49b4('0x81')](function(_0x5ca749){_0x233fb4=_0x5ca749[_0x49b4('0xa2')]==0x1;if(!_0x233fb4){if(ut[_0x49b4('0xc1')](_0x41e9aa)>=_0x559499[_0x49b4('0xc4')]){_0x4a58c6=ut[_0x49b4('0xc5')](_0x41e9aa,0x14,_0x49b4('0xdc'));rpcDb[_0x49b4('0xa6')](_0x4a58c6,_0x49b4('0xdd'));}else{if(_0x41e9aa['countagentrejectretry']>=_0x559499[_0x49b4('0xde')]){rpcDb[_0x49b4('0xa6')](_0x41e9aa,_0x49b4('0xdd'));}else{rpcDb[_0x49b4('0xc8')](ut['scheduledAt'](_0x41e9aa,_0x49b4('0xdf'),_0x559499['dialAgentRejectRetryFrequency']),_0x41e9aa[_0x49b4('0xaa')],_0x41e9aa[_0x49b4('0xab')]);}}}else{_0x41e9aa[_0x49b4('0xcb')]++;_0x577062[_0x49b4('0xac')]({'id':_0x41e9aa['idContact'],'field':{'countnoanswerretry':_0x41e9aa[_0x49b4('0xcb')]}})[_0x49b4('0x81')](function(){_0x577062['swapAdditionalPhones'](_0x41e9aa,_0x52708e,_0x45c6ec)['then'](function(){});});}});break;case _0x49b4('0xe0'):_0x559499[_0x49b4('0x3e')]+=0x1;_0x41e9aa['countabandonedretry']+=0x1;_0x41e9aa[_0x49b4('0x9c')]=ut[_0x49b4('0xc1')](_0x41e9aa);ut[_0x49b4('0x8e')](_0x41e9aa,0xb,_0x49b4('0xe1'));rpcDb[_0x49b4('0x91')](_0x41e9aa,_0x49b4('0xe2'));_0x577062[_0x49b4('0xc3')](_0x41e9aa,'11',_0x559499)[_0x49b4('0x81')](function(_0x154a7a){_0x233fb4=_0x154a7a[_0x49b4('0xa2')]==0x1;if(!_0x233fb4){if(ut['totalGlobal'](_0x41e9aa)>=_0x559499[_0x49b4('0xc4')]){_0x4a58c6=ut[_0x49b4('0xc5')](_0x41e9aa,0xf,_0x49b4('0xa5'));rpcDb[_0x49b4('0xa6')](_0x4a58c6,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x41e9aa[_0x49b4('0xe3')]>=_0x559499['dialAbandonedMaxRety']){rpcDb[_0x49b4('0xa6')](_0x41e9aa,_0x49b4('0xe2'));}else{rpcDb[_0x49b4('0xc8')](ut['scheduledAt'](_0x41e9aa,_0x49b4('0xe4'),_0x559499['dialAbandonedRetryFrequency']),_0x41e9aa['unlockAgent'],_0x41e9aa[_0x49b4('0xab')]);}}}else{_0x41e9aa[_0x49b4('0xcb')]++;_0x577062[_0x49b4('0xac')]({'id':_0x41e9aa[_0x49b4('0xad')],'field':{'countnoanswerretry':_0x41e9aa[_0x49b4('0xcb')]}})[_0x49b4('0x81')](function(){_0x577062[_0x49b4('0xae')](_0x41e9aa,_0x52708e,_0x45c6ec)[_0x49b4('0x81')](function(){});});}});break;case'18':_0x559499[_0x49b4('0x3d')]+=0x1;_0x41e9aa[_0x49b4('0xe5')]+=0x1;_0x41e9aa[_0x49b4('0x9c')]=ut[_0x49b4('0xc1')](_0x41e9aa);ut[_0x49b4('0x8e')](_0x41e9aa,0x12,_0x45d71a[_0x49b4('0xe6')]||_0x45d71a[_0x49b4('0xe7')]);ami[_0x49b4('0x27')](_0x49b4('0xe8'),ut[_0x49b4('0x9f')](_0x41e9aa,_0x49b4('0xe9')));rpcDb[_0x49b4('0x91')](_0x41e9aa,_0x49b4('0xea'));_0x577062[_0x49b4('0xc3')](_0x41e9aa,'18',_0x559499)[_0x49b4('0x81')](function(_0x129882){_0x233fb4=_0x129882[_0x49b4('0xa2')]==0x1;if(!_0x233fb4){if(ut[_0x49b4('0xc1')](_0x41e9aa)>=_0x559499[_0x49b4('0xc4')]){_0x4a58c6=ut['cloneAction'](_0x41e9aa,0x12,'Global');rpcDb[_0x49b4('0xa6')](_0x4a58c6,_0x49b4('0xea'));}else{rpcDb[_0x49b4('0xa6')](_0x41e9aa,_0x49b4('0xea'));}}else{_0x41e9aa['countnoanswerretry']++;_0x577062[_0x49b4('0xac')]({'id':_0x41e9aa[_0x49b4('0xad')],'field':{'countnoanswerretry':_0x41e9aa['countnoanswerretry']}})[_0x49b4('0x81')](function(){_0x577062[_0x49b4('0xae')](_0x41e9aa,_0x52708e,_0x45c6ec)['then'](function(){});});}});delete this['actions'][_0x45d71a[_0x49b4('0xbe')]];break;case'19':_0x559499[_0x49b4('0x3d')]+=0x1;_0x41e9aa[_0x49b4('0x9c')]=ut['totalGlobal'](_0x41e9aa);ut['logCustomer'](_0x41e9aa,0x13,_0x45d71a[_0x49b4('0xe6')]||_0x45d71a[_0x49b4('0xe7')]);ami[_0x49b4('0x27')]('custom:amd',ut['buildObj'](_0x41e9aa,'amd'));rpcDb['createCustomerHistory'](_0x41e9aa,_0x49b4('0xeb'));_0x577062['verifyAdditionalPhones'](_0x41e9aa,'18',_0x559499)['then'](function(_0x241218){_0x233fb4=_0x241218[_0x49b4('0xa2')]==0x1;if(!_0x233fb4){if(ut['totalGlobal'](_0x41e9aa)>=_0x559499[_0x49b4('0xc4')]){_0x4a58c6=ut[_0x49b4('0xc5')](_0x41e9aa,0xf,_0x49b4('0xa5'));rpcDb[_0x49b4('0xa6')](_0x4a58c6,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x49b4('0xa6')](_0x41e9aa,_0x49b4('0xeb'));}}else{_0x41e9aa['countnoanswerretry']++;_0x577062['incrementPreviewCounters']({'id':_0x41e9aa[_0x49b4('0xad')],'field':{'countnoanswerretry':_0x41e9aa['countnoanswerretry']}})[_0x49b4('0x81')](function(){_0x577062[_0x49b4('0xae')](_0x41e9aa,_0x52708e,_0x45c6ec)[_0x49b4('0x81')](function(){});});}});delete this[_0x49b4('0x16')][_0x45d71a[_0x49b4('0xbe')]];break;default:if(_0x41e9aa[_0x49b4('0x72')]){ut[_0x49b4('0x7c')](_0x559499,_0x49b4('0xec'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x559499[_0x49b4('0x56')],_0x45d71a);}_0x559499[_0x49b4('0x3d')]+=0x1;_0x41e9aa[_0x49b4('0x9c')]=ut['totalGlobal'](_0x41e9aa);ut[_0x49b4('0x8e')](_0x41e9aa,0xc,_0x45d71a[_0x49b4('0xe6')]||_0x45d71a['dialstatus']);_0x52708e=_0x559499[_0x49b4('0xed')];_0x45c6ec=_0x559499[_0x49b4('0xa4')];rpcDb[_0x49b4('0x91')](_0x41e9aa,_0x49b4('0xee'));_0x577062[_0x49b4('0xc3')](_0x41e9aa,'20',_0x559499)[_0x49b4('0x81')](function(_0x381416){_0x233fb4=_0x381416[_0x49b4('0xa2')]==0x1;if(!_0x233fb4){if(ut[_0x49b4('0xc1')](_0x41e9aa)>=_0x559499[_0x49b4('0xc4')]){_0x4a58c6=ut[_0x49b4('0xc5')](_0x41e9aa,0xf,'Global');rpcDb[_0x49b4('0xa6')](_0x4a58c6,_0x49b4('0xef'));}else{rpcDb['createCustomerFinal'](_0x41e9aa,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x45d71a[_0x49b4('0xbe')]];}else{_0x577062[_0x49b4('0xae')](_0x41e9aa,_0x52708e,_0x45c6ec)['then'](function(){});}});}if(!(_0x41e9aa[_0x49b4('0x72')]&&_0x4b5eb1==='16')){ut[_0x49b4('0xf0')](_0x559499,_0x49b4('0xf1'));logger[_0x49b4('0x59')](_0x49b4('0xf2'),_0x41e9aa[_0x49b4('0xb3')],_0x49b4('0xb4'),_0x559499[_0x49b4('0x56')],'originated:\x20',_0x559499['originated']);}if(_0x4b5eb1!==_0x49b4('0xaf')){delete this['actions'][_0x45d71a[_0x49b4('0xbe')]];delete this[_0x49b4('0x16')][_0x45d71a[_0x49b4('0xf3')]];}}};Preview[_0x49b4('0xf')][_0x49b4('0xf4')]=function(_0x44e04c,_0x245feb,_0x23c1dc){if(_['isUndefined'](_0x245feb)&&_0x49b4('0xf5')!==typeof _0x245feb){return;}if(_[_0x49b4('0xf6')](_0x23c1dc)&&'object'!==typeof _0x23c1dc){return;}switch(_0x23c1dc[_0x49b4('0xf7')]){case'0':ut[_0x49b4('0xf8')](_0x44e04c,0x0,_0x49b4('0x9d'));rpcDb[_0x49b4('0xf9')](_0x44e04c,_0x49b4('0xfa'));break;case'3':ut[_0x49b4('0xf8')](_0x44e04c,0x3,_0x49b4('0xcc'));rpcDb[_0x49b4('0xf9')](_0x44e04c,_0x49b4('0xfb'));break;case'5':ut[_0x49b4('0xf8')](_0x44e04c,0x5,_0x49b4('0xc2'));rpcDb[_0x49b4('0xf9')](_0x44e04c,_0x49b4('0xfc'));break;case'8':ut[_0x49b4('0xf8')](_0x44e04c,0x8,_0x49b4('0xfd'));rpcDb[_0x49b4('0xf9')](_0x44e04c,_0x49b4('0xfe'));break;case'22':ut[_0x49b4('0xf8')](_0x44e04c,0x16,_0x49b4('0xff'));rpcDb[_0x49b4('0xf9')](_0x44e04c,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x44e04c,0xc,_0x23c1dc[_0x49b4('0xf7')]);rpcDb[_0x49b4('0xf9')](_0x44e04c,_0x49b4('0xfe'));}ut[_0x49b4('0xf0')](_0x245feb,_0x49b4('0x100'));logger[_0x49b4('0x59')](_0x49b4('0x101'),_0x44e04c['uniqueid'],_0x49b4('0xb4'),_0x245feb[_0x49b4('0x56')],_0x49b4('0x102'),_0x245feb[_0x49b4('0x4b')]);delete this[_0x49b4('0x16')][_0x44e04c['uniqueid']];};Preview['prototype'][_0x49b4('0xc3')]=function(_0x3877e9,_0x54bc5f,_0x31d33d){return Promise[_0x49b4('0x103')]()[_0x49b4('0x81')](cmHopperAdditionalPhone[_0x49b4('0xc3')](_0x3877e9,_0x54bc5f,_0x31d33d))[_0x49b4('0x79')](logger[_0x49b4('0x59')](_0x49b4('0x104')));};Preview['prototype'][_0x49b4('0xae')]=function(_0x355fe8,_0x166f06,_0x37b8de){return Promise[_0x49b4('0x103')]()[_0x49b4('0x81')](cmHopperAdditionalPhone[_0x49b4('0xae')](_0x355fe8,_0x166f06,_0x37b8de))[_0x49b4('0x79')](logger[_0x49b4('0x59')]('[swapAdditionalPhone]\x20'));};Preview[_0x49b4('0xf')][_0x49b4('0xac')]=function(_0x256541){return Promise[_0x49b4('0x103')]()[_0x49b4('0x81')](cmHopperAdditionalPhone[_0x49b4('0xac')](_0x256541))['catch'](logger[_0x49b4('0x59')](_0x49b4('0x105')));};Preview[_0x49b4('0xf')][_0x49b4('0x106')]=function(_0x1c8b92,_0x1afa0f,_0x2facff,_0x25c79e,_0x4ded40){var _0x378d8d=this;return new Promise(function(_0x2de4f4,_0x33f4d5){if(_[_0x49b4('0x6d')](_0x1afa0f)||_['isNil'](_0x1afa0f[_0x49b4('0x107')])||_[_0x49b4('0x6d')](_0x1afa0f[_0x49b4('0x108')])||_[_0x49b4('0x6d')](_0x1afa0f[_0x49b4('0x109')])){_0x33f4d5(ut[_0x49b4('0x4a')](_0x49b4('0x10a'),_0x25c79e,_0x4ded40));return;}var _0x2f387d=uuid['v4']();var _0x1a3606=_0x378d8d['campaignsPreview'][_0x1afa0f[_0x49b4('0x6f')][_0x49b4('0x56')]];var _0x18d426=_0x2facff?_0x378d8d['agents'][_0x2facff]['id']:undefined;_0x378d8d['actions'][_0x2f387d]=new Action(_0x1afa0f,_0x1a3606,_0x2f387d,_0x2facff,_0x18d426);var _0x333852=_0x378d8d['actions'][_0x2f387d];_0x333852['unlockAgent']=_0x25c79e;_0x333852[_0x49b4('0xab')]=_0x4ded40;_0x333852[_0x49b4('0x10b')]=_0x2facff;if(_[_0x49b4('0x10c')](_0x1c8b92)){_0x378d8d[_0x49b4('0x10d')](_0x333852,_0x1a3606,_0x1afa0f,_0x2facff)['then'](function(_0x24645b){logger[_0x49b4('0x59')](_0x49b4('0x10e'),_0x49b4('0x10f')+_0x333852['queue']+'\x20IdHopper:\x20'+_0x333852['idContact'],JSON[_0x49b4('0x71')](_0x24645b));ami[_0x49b4('0x27')](_0x49b4('0x110'),ut[_0x49b4('0x9f')](_0x333852,_0x49b4('0x111'),_0x378d8d['campaignsPreview'][_0x333852[_0x49b4('0x70')]]));_0x2de4f4(ut[_0x49b4('0x4a')](_0x49b4('0x112')));})[_0x49b4('0x79')](function(_0x14e591){ut[_0x49b4('0x5f')](_0x49b4('0x113'),_0x14e591);_0x33f4d5(ut[_0x49b4('0x4a')](_0x49b4('0x114'),_0x25c79e,_0x4ded40));});}else{_0x1a3606[_0x49b4('0x36')]+=0x1;ut['logBlacklist'](_0x333852);rpcDb[_0x49b4('0x115')](_0x333852,_0x49b4('0x116'));delete _0x378d8d[_0x49b4('0x16')][_0x2f387d];_0x33f4d5(ut[_0x49b4('0x4a')](_0x49b4('0x117'),_0x25c79e,_0x4ded40));}});};Preview['prototype']['isTrunkReachable']=function(_0x21d14d){return!_['isNil'](_0x21d14d)&&!_['isNil'](_0x21d14d[_0x49b4('0x56')])&&!_[_0x49b4('0x6d')](_0x21d14d[_0x49b4('0x53')])&&_0x21d14d[_0x49b4('0x53')]&&!_['isNil'](this['trunks'][util[_0x49b4('0x5b')]('SIP/%s',_0x21d14d['name'])])&&!_[_0x49b4('0x6d')](this[_0x49b4('0x15')][util['format'](_0x49b4('0x118'),_0x21d14d[_0x49b4('0x56')])][_0x49b4('0x77')])&&(this['trunks'][util[_0x49b4('0x5b')]('SIP/%s',_0x21d14d[_0x49b4('0x56')])][_0x49b4('0x77')]===_0x49b4('0x119')||this[_0x49b4('0x15')][util[_0x49b4('0x5b')](_0x49b4('0x118'),_0x21d14d[_0x49b4('0x56')])][_0x49b4('0x77')]==='unmonitored');};Preview[_0x49b4('0xf')][_0x49b4('0x87')]=function(_0x250844,_0x22b861){var _0x5bab8e=this;return new Promise(function(_0x4499b5,_0x539269){_0x5bab8e['execRun'](_0x250844,_0x22b861)[_0x49b4('0x81')](function(_0x4d81df){_0x4499b5(_['pick'](_0x4d81df,[_0x49b4('0x4a')]));})[_0x49b4('0x79')](function(_0x46ccf9){if(_0x46ccf9[_0x49b4('0x11a')]){rpcDb['unlockContact'](_0x250844);}if(_0x46ccf9['active']){rpcDb[_0x49b4('0x8a')](_0x250844);}_0x539269(_[_0x49b4('0x73')](_0x46ccf9,[_0x49b4('0x4a')]));});});};Preview[_0x49b4('0xf')][_0x49b4('0x11b')]=function(_0x350757,_0x3dfd15){var _0x4b1421=this;return new Promise(function(_0x29a8fa,_0x2a81fa){var _0x46f3f3,_0x30cf5c;rpcDb[_0x49b4('0x11c')](_0x350757)[_0x49b4('0x81')](function(_0x393449){if(!_[_0x49b4('0x6d')](_0x393449[0x0])){_0x30cf5c=_0x393449[0x0][_0x49b4('0x11d')]?![]:!![];_0x46f3f3=_0x393449[0x0][_0x49b4('0x11d')]?!![]:![];_0x46f3f3=_0x3dfd15?!![]:_0x46f3f3;}var _0x85fba=_0x4b1421['validateContact'](_0x393449);if(_0x85fba[_0x49b4('0x11e')]){rpcDb[_0x49b4('0x11f')](_['pick'](_0x393449[0x0],[_0x49b4('0x109'),_0x49b4('0x108')]))[_0x49b4('0x81')](function(_0x49848f){_0x4b1421[_0x49b4('0x106')](_0x49848f,_0x393449[0x0],_0x3dfd15,_0x30cf5c,_0x46f3f3)[_0x49b4('0x81')](function(_0x2307ea){_0x29a8fa(_0x2307ea);})[_0x49b4('0x79')](function(_0x24240a){_0x2a81fa(_0x24240a);});})[_0x49b4('0x79')](function(_0x599ec5){ut['logger'](_0x49b4('0x120'),_0x599ec5);_0x2a81fa(ut[_0x49b4('0x4a')]('Call\x20unsuccessful',_0x30cf5c,_0x46f3f3));});}else{_0x2a81fa(ut[_0x49b4('0x4a')](_0x85fba[_0x49b4('0x4a')],_0x30cf5c,_0x46f3f3));}})[_0x49b4('0x79')](function(_0x2e51a4){ut[_0x49b4('0x5f')](_0x49b4('0x121'),_0x2e51a4);_0x2a81fa(ut[_0x49b4('0x4a')](_0x49b4('0x122'),![],!![]));});});};Preview[_0x49b4('0xf')]['validateContact']=function(_0x43dee9){if(_[_0x49b4('0x6d')](_0x43dee9)||_[_0x49b4('0x10c')](_0x43dee9)||!_[_0x49b4('0x6d')](_0x43dee9[0x0][_0x49b4('0x85')])&&_[_0x49b4('0x6d')](_0x43dee9[0x0][_0x49b4('0x85')][_0x49b4('0x56')])){ut['logger'](_0x49b4('0x123'),_0x43dee9);return{'isValid':![],'message':_0x49b4('0x124')};}var _0x46d225=this[_0x49b4('0x13')][_0x43dee9[0x0][_0x49b4('0x6f')]['name']];_0x46d225['message']=_0x49b4('0x99');if(_['isNil'](_0x46d225)){ut['logger'](_0x49b4('0x125'),_0x46d225);return{'isValid':![],'message':_0x49b4('0x126')};}if(!this[_0x49b4('0x98')](_0x46d225['Trunk'])){ut[_0x49b4('0x5f')](_0x49b4('0x127'),'campaign\x20Name:\x20'+_0x46d225[_0x49b4('0x56')]+_0x49b4('0x128'));if(!this['isTrunkReachable'](_0x46d225[_0x49b4('0x129')])){ut['logger'](_0x49b4('0x127'),_0x46d225['name']+_0x49b4('0x12a'));return{'isValid':![],'message':_0x49b4('0x12b')};}}if(!ut[_0x49b4('0x12c')](_0x46d225[_0x49b4('0x97')])){ut[_0x49b4('0x5f')](_0x49b4('0x12d'),_0x46d225[_0x49b4('0x56')]+_0x49b4('0x12e'));return{'isValid':![],'message':_0x49b4('0x12f')+_0x46d225['name']+_0x49b4('0x12e')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview['prototype']['execCall']=function(_0x29fee3,_0x156104,_0xc8290e,_0x344bc6){var _0x1acecd=this;return new Promise(function(_0x2a9af6,_0x15fbe5){var _0x1617f9=_0x29fee3['uniqueid'];var _0x20dec1=_0x1acecd[_0x49b4('0x98')](_0x156104[_0x49b4('0x52')])?util[_0x49b4('0x5b')](_0x49b4('0x130'),_0x156104[_0x49b4('0x52')][_0x49b4('0x56')],_[_0x49b4('0x6d')](_0x156104['dialPrefix'])?'':_0x156104[_0x49b4('0x131')][_0x49b4('0x132')]()||'',_0x156104['dialCutDigit']>0x0?_0xc8290e['phone']['substring'](_0x156104['dialCutDigit']):_0xc8290e[_0x49b4('0x108')]):util[_0x49b4('0x5b')](_0x49b4('0x130'),_[_0x49b4('0x6d')](_0x156104['TrunkBackup'])?_0x156104[_0x49b4('0x52')]['name']:_0x156104[_0x49b4('0x129')][_0x49b4('0x56')],_['isNil'](_0x156104[_0x49b4('0x131')])?'':_0x156104['dialPrefix']['trim']()||'',_0x156104[_0x49b4('0x133')]>0x0?_0xc8290e[_0x49b4('0x108')][_0x49b4('0x134')](_0x156104[_0x49b4('0x133')]):_0xc8290e[_0x49b4('0x108')]);var _0xd4361b=_0x1acecd['isTrunkReachable'](_0x156104[_0x49b4('0x52')])?ut[_0x49b4('0x135')](_0x156104[_0x49b4('0x52')][_0x49b4('0x54')],_0x156104[_0x49b4('0x136')],_0x156104['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x49b4('0x137')](_0x156104['dialOriginateCallerIdNumber'],_0x156104['dialRandomLastDigitCallerIdNumber']):_0x156104[_0x49b4('0x138')]):ut[_0x49b4('0x135')](_[_0x49b4('0x6d')](_0x156104[_0x49b4('0x129')])?_0x156104[_0x49b4('0x52')]['callerid']:_0x156104[_0x49b4('0x129')][_0x49b4('0x54')],_0x156104['dialOriginateCallerIdName'],_0x156104[_0x49b4('0x139')]>0x0?ut[_0x49b4('0x137')](_0x156104[_0x49b4('0x138')],_0x156104['dialRandomLastDigitCallerIdNumber']):_0x156104[_0x49b4('0x138')]);if(_0xd4361b){_0x29fee3['originatecalleridname']=ut['extractCalleridName'](_0xd4361b);_0x29fee3[_0x49b4('0x13a')]=ut[_0x49b4('0x13b')](_0xd4361b);}var _0x58a00f=ut[_0x49b4('0x13c')](_0x156104,_0xc8290e,_0x20dec1,_0xd4361b,_0x1617f9,_0x29fee3);_[_0x49b4('0x13d')](_0x29fee3,ut['toLowerVariables'](_0x58a00f));_0x29fee3['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x156104[_0x49b4('0x13e')]=_0x58a00f;ami['Action'](ut[_0x49b4('0x13f')](_0x29fee3,_0x156104,_0x58a00f,_0x29fee3['activeContact'],_0x344bc6))[_0x49b4('0x81')](function(_0x11ae16){_0x156104[_0x49b4('0x4b')]+=0x1;logger[_0x49b4('0x59')]('[originated][increment]',_0x1617f9,_0x49b4('0xb4'),_0x156104[_0x49b4('0x56')],'originated:\x20',_0x156104[_0x49b4('0x4b')]);_0x2a9af6(_0x11ae16);})['catch'](function(_0x44768b){ut[_0x49b4('0xf8')](_0x29fee3,0xe,'OriginateError');rpcDb[_0x49b4('0xf9')](_0x29fee3,_0x49b4('0x140'));_0x15fbe5(_0x44768b);});});};Preview[_0x49b4('0xf')][_0x49b4('0x141')]=function(_0x3b0044){if(this['actions'][_0x3b0044[_0x49b4('0xbe')]]){this[_0x49b4('0x16')][_0x3b0044[_0x49b4('0xbe')]][_0x49b4('0x78')]=_0x3b0044[_0x49b4('0x78')];}};Preview[_0x49b4('0xf')][_0x49b4('0x1a')]=function(_0x34ae96){var _0x5e1f67=this;var _0x138e41=this['actions'][_0x34ae96[_0x49b4('0x142')]];if(_0x138e41){if(_0x138e41[_0x49b4('0x10b')]&&this[_0x49b4('0x17')][_0x138e41[_0x49b4('0x10b')]]){ut[_0x49b4('0x143')](_0x138e41,this[_0x49b4('0x17')][_0x138e41[_0x49b4('0x10b')]]['name'],this[_0x49b4('0x17')][_0x138e41['lookAgent']]['id']);}var _0x1adb67=_[_0x49b4('0x144')](_0x138e41);_0x1adb67['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x278940=_0x5e1f67[_0x49b4('0x13')][_0x138e41[_0x49b4('0x70')]];if(ut[_0x49b4('0x145')](_0x34ae96[_0x49b4('0x146')])){if(_0x138e41[_0x49b4('0xaa')]){rpcDb[_0x49b4('0x147')](_0x138e41[_0x49b4('0xad')]);}if(_0x138e41[_0x49b4('0xab')]){rpcDb['disableContact'](_0x138e41[_0x49b4('0xad')]);}ami[_0x49b4('0x27')](_0x49b4('0x148'),ut[_0x49b4('0x9f')](_0x138e41,'rejected',this[_0x49b4('0x13')][_0x138e41[_0x49b4('0x70')]]));this[_0x49b4('0xf4')](_0x1adb67,_0x278940,_0x34ae96);}else{_0x138e41['starttime']=moment()[_0x49b4('0x5b')](_0x49b4('0x8c'));ut[_0x49b4('0xf8')](_0x1adb67,0x4,_0x49b4('0x149'));rpcDb[_0x49b4('0xf9')](_0x1adb67,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x49b4('0xf')]['syncHangup']=function(_0x2bec5c){var _0x421e80=this[_0x49b4('0x16')][_0x2bec5c[_0x49b4('0xbe')]];var _0x21fee2;if(_0x421e80){_0x21fee2=this[_0x49b4('0x13')][_0x421e80['queue']];logger[_0x49b4('0x59')]('[syncHangup][talking]',_0x2bec5c[_0x49b4('0xbe')],_0x49b4('0xb4'),_0x21fee2['name'],_0x49b4('0xb5'),_0x21fee2[_0x49b4('0x2b')]);}if(this[_0x49b4('0x16')][_0x2bec5c[_0x49b4('0xbe')]]&&_0x2bec5c[_0x49b4('0xbe')]!==_0x2bec5c['uniqueid']){if(_0x2bec5c['cause']==='16'&&this[_0x49b4('0x16')][_0x2bec5c[_0x49b4('0xbe')]]['dialAnswer']){this[_0x49b4('0x9a')](_0x2bec5c,_0x2bec5c[_0x49b4('0xbe')],_0x2bec5c[_0x49b4('0x14a')]);}else if(this[_0x49b4('0x16')][_0x2bec5c[_0x49b4('0xbe')]][_0x49b4('0x72')]){logger[_0x49b4('0x59')](_0x49b4('0x14b'),_0x2bec5c[_0x49b4('0xbe')],_0x2bec5c['cause'],_0x49b4('0xb4'),_0x21fee2[_0x49b4('0x56')],_0x49b4('0xb5'),_0x21fee2[_0x49b4('0x2b')]);this[_0x49b4('0x9a')](_0x2bec5c,_0x2bec5c[_0x49b4('0xbe')],_0x2bec5c[_0x49b4('0x14a')]);}}else if(_0x421e80&&_[_0x49b4('0x6d')](_0x421e80[_0x49b4('0x14c')])&&_0x21fee2[_0x49b4('0x14d')]&&_0x2bec5c[_0x49b4('0xbe')]===_0x2bec5c[_0x49b4('0xb3')]&&_[_0x49b4('0x6d')](_0x2bec5c[_0x49b4('0xf7')])&&_0x2bec5c[_0x49b4('0x14a')]==='16'&&_0x2bec5c[_0x49b4('0x14e')]==='6'&&_[_0x49b4('0xf6')](_0x421e80[_0x49b4('0x14f')])){if(_0x421e80[_0x49b4('0xaa')]){rpcDb['unlockContact'](_0x421e80[_0x49b4('0xad')]);}if(_0x421e80[_0x49b4('0xab')]){rpcDb[_0x49b4('0x8a')](_0x421e80[_0x49b4('0xad')]);}_0x2bec5c[_0x49b4('0xf7')]='22';this['callProgressDetectingAgent'](_0x421e80,_0x21fee2,_0x2bec5c);}else if(_0x421e80&&_0x421e80['transfer']){if(_0x2bec5c[_0x49b4('0x14a')]==='16'&&this[_0x49b4('0x16')][_0x2bec5c[_0x49b4('0xbe')]][_0x49b4('0x72')]){logger[_0x49b4('0x59')](_0x49b4('0x150'),_0x2bec5c[_0x49b4('0xbe')],_0x2bec5c['cause'],'\x20Queue',_0x21fee2['name'],'pTalking:\x20',_0x21fee2[_0x49b4('0x2b')]);this[_0x49b4('0x9a')](_0x2bec5c,_0x2bec5c['linkedid'],_0x2bec5c['cause']);}else if(this[_0x49b4('0x16')][_0x2bec5c['linkedid']]['dialAnswer']){logger[_0x49b4('0x59')](_0x49b4('0x14b'),_0x2bec5c[_0x49b4('0xbe')],_0x2bec5c['cause'],_0x49b4('0xb4'),_0x21fee2[_0x49b4('0x56')],_0x49b4('0xb5'),_0x21fee2[_0x49b4('0x2b')]);this[_0x49b4('0x9a')](_0x2bec5c,_0x2bec5c[_0x49b4('0xbe')],_0x2bec5c['cause']);}}};Preview[_0x49b4('0xf')][_0x49b4('0x20')]=function(_0x25a4e9){if(this[_0x49b4('0x16')][_0x25a4e9['destlinkedid']]&&_0x25a4e9[_0x49b4('0xf3')]!==_0x25a4e9[_0x49b4('0x151')]){this['callProgressDetectingCustomer'](_0x25a4e9,_0x25a4e9['destlinkedid'],_0x25a4e9['dialstatus']);}};Preview[_0x49b4('0xf')][_0x49b4('0x1e')]=function(_0x1fc035){if(this[_0x49b4('0x16')][_0x1fc035[_0x49b4('0xbe')]]&&_0x1fc035[_0x49b4('0xbe')]!==_0x1fc035[_0x49b4('0xb3')]&&!this[_0x49b4('0x16')][_0x1fc035['linkedid']]['dialAnswer']){if(_0x1fc035[_0x49b4('0x14a')]==='1'){this[_0x49b4('0x9a')](_0x1fc035,_0x1fc035[_0x49b4('0xbe')],_0x1fc035[_0x49b4('0x14a')]);}}};Preview[_0x49b4('0xf')][_0x49b4('0x152')]=function(_0x6345de,_0x267f9d,_0x3a949d){if(this[_0x49b4('0x16')][_0x6345de]){if(_[_0x49b4('0x6d')](this[_0x49b4('0x16')][_0x6345de][_0x49b4('0x13e')])){this['actions'][_0x6345de]['variables']={};}this['actions'][_0x6345de][_0x49b4('0x13e')][_0x267f9d]=_0x3a949d;}};Preview['prototype'][_0x49b4('0x22')]=function(_0x2b8ce7){try{if(!_['isNil'](_0x2b8ce7)){if(ut[_0x49b4('0x153')](_[_0x49b4('0x154')](_0x2b8ce7[_0x49b4('0x155')])[0x0])){this[_0x49b4('0x152')](_0x2b8ce7[_0x49b4('0xb3')],_['keys'](_0x2b8ce7['variable'])[0x0],_0x2b8ce7[_0x49b4('0x156')]);}}}catch(_0x43341d){logger[_0x49b4('0x157')](_0x49b4('0x158'),util[_0x49b4('0x159')](_0x43341d,{'showHidden':![],'depth':null}));}};Preview[_0x49b4('0xf')]['syncAttendedTransfer']=function(_0x13202d){if(_0x13202d){if(this['actions'][_0x13202d[_0x49b4('0x15a')]]){this[_0x49b4('0x16')][_0x13202d['transfertargetlinkedid']][_0x49b4('0x14f')]=!![];}}};Preview[_0x49b4('0xf')]['syncBlindTransfer']=function(_0x59337d){if(_0x59337d){if(this[_0x49b4('0x16')][_0x59337d['transfererlinkedid']]){this[_0x49b4('0x16')][_0x59337d['transfererlinkedid']][_0x49b4('0x14f')]=!![];}}};module[_0x49b4('0x15b')]=Preview; \ No newline at end of file +var _0xfbd4=['dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','variables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','lookAgent','responsetime','YYYY-MM-DD\x20HH:mm:ss','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','starttime','Answer','[callProgressDetectingAgent][logAnswer]','cause','statedesc','dialQueueProject','transfer','destlinkedid','addVariable','filterKey','variable','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','defaults','socket.io-emitter','prototype','tail','finally','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','loopCampaigns','campaignsPreview','emit','type','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','message','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','info','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','syncCampaigns','hasOwnProperty','preview','dialMethod','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','enqueue','isNil','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','agentReadyId','then','length','dialRecallMeTimeout','Agent','logger2','[RecallMe]','disableContact','RecallInQueue','dialRecallInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','idContact','swapAdditionalPhones','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','incrementPreviewCounters','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectRetryFrequency','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','object','isUndefined','reason','[callProgressDetectingAgent][logNoSuch]','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','run','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfbd4,0x182));var _0x4fbd=function(_0x19bbd6,_0x7beb2a){_0x19bbd6=_0x19bbd6-0x0;var _0xb38a0=_0xfbd4[_0x19bbd6];return _0xb38a0;};'use strict';var util=require(_0x4fbd('0x0'));var _=require('lodash');var uuid=require(_0x4fbd('0x1'));var moment=require(_0x4fbd('0x2'));var md5=require(_0x4fbd('0x3'));var Redis=require(_0x4fbd('0x4'));var config=require(_0x4fbd('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x4fbd('0x6'))('actionPreview');var ami=require(_0x4fbd('0x7'));var rpcDb=require(_0x4fbd('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x4fbd('0x9'));var ut=require(_0x4fbd('0xa'));config[_0x4fbd('0xb')]=_[_0x4fbd('0xc')](config[_0x4fbd('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x4fbd('0xd'))(new Redis(config[_0x4fbd('0xb')]));var Sequence=function(){};Sequence[_0x4fbd('0xe')]['enqueue']=function(_0x195bda){this['tail']=this['tail']?this[_0x4fbd('0xf')][_0x4fbd('0x10')](_0x195bda):_0x195bda();};function Preview(_0x47d36b){this['sequence']=new Sequence();this['campaignsPreview']=_0x47d36b['voiceQueues'];this[_0x4fbd('0x11')]=_0x47d36b[_0x4fbd('0x11')];this[_0x4fbd('0x12')]={};this[_0x4fbd('0x13')]=_0x47d36b[_0x4fbd('0x13')];this[_0x4fbd('0x14')]=0x0;ami['on'](_0x4fbd('0x15'),this[_0x4fbd('0x16')][_0x4fbd('0x17')](this));ami['on'](_0x4fbd('0x18'),this[_0x4fbd('0x19')][_0x4fbd('0x17')](this));ami['on']('hanguprequest',this[_0x4fbd('0x1a')][_0x4fbd('0x17')](this));ami['on'](_0x4fbd('0x1b'),this[_0x4fbd('0x1c')][_0x4fbd('0x17')](this));ami['on'](_0x4fbd('0x1d'),this[_0x4fbd('0x1e')][_0x4fbd('0x17')](this));ami['on'](_0x4fbd('0x1f'),this[_0x4fbd('0x20')]['bind'](this));ami['on']('attendedtransfer',this[_0x4fbd('0x21')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x4fbd('0x17')](this));this[_0x4fbd('0x22')](this[_0x4fbd('0x23')]);}function emit(_0x1d4750,_0x1780fc,_0x24ab51){io['to'](_0x1d4750)[_0x4fbd('0x24')](_0x1780fc,_0x24ab51);}function emitCampaignPreview(_0x4efa35){if(_0x4efa35[_0x4fbd('0x25')]==='outbound'){var _0x1fc9f5={'id':_0x4efa35['id'],'name':_0x4efa35[_0x4fbd('0x26')],'strategy':_0x4efa35[_0x4fbd('0x27')],'answered':_0x4efa35[_0x4fbd('0x28')],'available':_0x4efa35[_0x4fbd('0x29')],'loggedIn':_0x4efa35[_0x4fbd('0x2a')],'pTalking':_0x4efa35[_0x4fbd('0x2b')],'sumBillable':_0x4efa35[_0x4fbd('0x2c')],'sumDuration':_0x4efa35[_0x4fbd('0x2d')],'sumHoldTime':_0x4efa35[_0x4fbd('0x2e')]||0x0,'talking':_0x4efa35[_0x4fbd('0x2f')],'total':_0x4efa35[_0x4fbd('0x30')],'type':_0x4efa35[_0x4fbd('0x25')],'unmanaged':_0x4efa35[_0x4fbd('0x31')],'abandoned':_0x4efa35[_0x4fbd('0x32')],'waiting':_0x4efa35['waiting'],'loggedInDb':_0x4efa35[_0x4fbd('0x33')],'dialActive':_0x4efa35[_0x4fbd('0x34')],'dialMethod':_0x4efa35['dialMethod'],'dialOriginateCallerIdName':_0x4efa35[_0x4fbd('0x35')],'dialOriginateCallerIdNumber':_0x4efa35['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4efa35[_0x4fbd('0x36')],'dialPrefix':_0x4efa35[_0x4fbd('0x37')],'outboundAnswerAgiCallsDay':_0x4efa35[_0x4fbd('0x38')],'outboundAnswerCallsDay':_0x4efa35['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4efa35['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4efa35[_0x4fbd('0x39')],'outboundCongestionCallsDay':_0x4efa35['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x4efa35[_0x4fbd('0x3a')],'outboundDropCallsDayCallersExit':_0x4efa35[_0x4fbd('0x3b')],'outboundDropCallsDayTimeout':_0x4efa35[_0x4fbd('0x3c')],'outboundNoAnswerCallsDay':_0x4efa35[_0x4fbd('0x3d')],'outboundNoSuchCallsDay':_0x4efa35[_0x4fbd('0x3e')],'outboundOriginateFailureCallsDay':_0x4efa35['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4efa35[_0x4fbd('0x3f')],'outboundRejectCallsDay':_0x4efa35[_0x4fbd('0x40')],'outboundUnknownCallsDay':_0x4efa35['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x4efa35['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4efa35[_0x4fbd('0x41')],'predictiveIntervalAvgHoldtime':_0x4efa35[_0x4fbd('0x42')],'predictiveIntervalAvgTalktime':_0x4efa35[_0x4fbd('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x4efa35[_0x4fbd('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x4efa35[_0x4fbd('0x45')],'predictiveIntervalErlangCalls':_0x4efa35['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x4efa35['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4efa35[_0x4fbd('0x46')],'predictiveIntervalMultiplicativeFactor':_0x4efa35[_0x4fbd('0x47')],'predictiveIntervalPauses':_0x4efa35[_0x4fbd('0x48')],'predictiveIntervalAvailable':_0x4efa35[_0x4fbd('0x49')],'predictiveIntervalTotalCalls':_0x4efa35['predictiveIntervalTotalCalls'],'message':_0x4efa35[_0x4fbd('0x4a')],'originated':_0x4efa35['originated'],'erlangCalls':_0x4efa35[_0x4fbd('0x4b')],'erlangCallToSecond':_0x4efa35['erlangCallToSecond'],'erlangAbandonmentRate':_0x4efa35[_0x4fbd('0x4c')],'erlangBusyFactor':_0x4efa35[_0x4fbd('0x4d')],'startPredictive':_0x4efa35[_0x4fbd('0x4e')],'startProgressive':_0x4efa35[_0x4fbd('0x4f')]};if(_0x4efa35[_0x4fbd('0x50')]){_0x1fc9f5[_0x4fbd('0x50')]={'id':_0x4efa35[_0x4fbd('0x50')]['id'],'name':_0x4efa35[_0x4fbd('0x50')][_0x4fbd('0x26')],'active':_0x4efa35['Trunk'][_0x4fbd('0x51')],'callerid':_0x4efa35['Trunk'][_0x4fbd('0x52')]};}if(_0x4efa35[_0x4fbd('0x53')]){_0x1fc9f5['Interval']={'id':_0x4efa35['Interval']['id'],'name':_0x4efa35[_0x4fbd('0x53')][_0x4fbd('0x26')]};}var _0x491f69=md5(JSON[_0x4fbd('0x54')](_0x1fc9f5));if(_0x4efa35['md5']!==_0x491f69){_0x4efa35[_0x4fbd('0x3')]=_0x491f69;emit(util[_0x4fbd('0x55')](_0x4fbd('0x56'),_0x1fc9f5[_0x4fbd('0x26')]),'voice_queue:save',_0x1fc9f5);}}}function emitVoiceQueueChannelRemove(_0x30ae30){logger[_0x4fbd('0x57')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x30ae30));emit(util[_0x4fbd('0x55')](_0x4fbd('0x56'),_0x30ae30[_0x4fbd('0x26')]),'voice_queue_channel:remove',_0x30ae30);io[_0x4fbd('0x24')](_0x4fbd('0x58'),_0x30ae30);}function notSendMessagesQueue(_0x35ef4e){if(_0x35ef4e[_0x4fbd('0x59')]){if(_0x35ef4e[_0x4fbd('0x5a')]===0x0&&_0x35ef4e[_0x4fbd('0x2b')]===0x0){_0x35ef4e['sendMessageOneNotActive']=![];_0x35ef4e[_0x4fbd('0x29')]=0x0;_0x35ef4e[_0x4fbd('0x5b')]=0x0;_0x35ef4e[_0x4fbd('0x4a')]='NOT_ACTIVE';ut['logger'](_0x4fbd('0x5c'),_0x35ef4e['name']+'\x20is\x20not\x20active');}else{_0x35ef4e['message']=_0x4fbd('0x5d');ut['logger'](_0x4fbd('0x5c'),_0x35ef4e[_0x4fbd('0x26')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x35ef4e);}}Preview[_0x4fbd('0xe')][_0x4fbd('0x22')]=function(){var _0x2d089d=this;setInterval(function(){_0x2d089d[_0x4fbd('0x5e')]();},0x7cf);};Preview[_0x4fbd('0xe')][_0x4fbd('0x5e')]=function(){var _0x33fdf1=this[_0x4fbd('0x23')];this[_0x4fbd('0x14')]+=0x1;for(var _0x86450 in _0x33fdf1){if(_0x33fdf1[_0x4fbd('0x5f')](_0x86450)&&(_0x33fdf1[_0x86450]['dialMethod']===_0x4fbd('0x60')||_0x33fdf1[_0x86450]['dialMethod']==='booked')&&_0x33fdf1[_0x86450][_0x4fbd('0x25')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x4fbd('0x14')]=0x0;this['clearZombieChannels']();}}if(_0x33fdf1['hasOwnProperty'](_0x86450)&&_0x33fdf1[_0x86450][_0x4fbd('0x61')]===_0x4fbd('0x60')&&_0x33fdf1[_0x86450][_0x4fbd('0x25')]==='outbound'){if(_0x33fdf1[_0x86450][_0x4fbd('0x34')]){this[_0x4fbd('0x62')](_0x33fdf1[_0x86450]);if(_0x33fdf1[_0x86450][_0x4fbd('0x63')])this[_0x4fbd('0x64')](_0x33fdf1[_0x86450]);}else{notSendMessagesQueue(_0x33fdf1[_0x86450]);}}}};Preview['prototype'][_0x4fbd('0x65')]=function(_0x2ca8f0){var _0x58d090=this;this[_0x4fbd('0x66')][_0x4fbd('0x67')](function(){if(!_[_0x4fbd('0x68')](_0x58d090[_0x4fbd('0x12')][_0x2ca8f0])){loggerAction['info']('[clearZombieChannels][talking]',_0x2ca8f0,_0x4fbd('0x69'),_0x58d090['actions'][_0x2ca8f0][_0x4fbd('0x6a')],_0x4fbd('0x6b'),JSON['stringify'](_0x58d090[_0x4fbd('0x23')][_0x58d090[_0x4fbd('0x12')][_0x2ca8f0]['queue']][_0x4fbd('0x5a')]),_0x4fbd('0x6c'),JSON[_0x4fbd('0x54')](_0x58d090[_0x4fbd('0x23')][_0x58d090['actions'][_0x2ca8f0]['queue']]['pTalking']),JSON[_0x4fbd('0x54')](_0x58d090[_0x4fbd('0x12')][_0x2ca8f0][_0x4fbd('0x6d')]),JSON[_0x4fbd('0x54')](_[_0x4fbd('0x6e')](_0x58d090[_0x4fbd('0x12')][_0x2ca8f0],[_0x4fbd('0x6f'),_0x4fbd('0x70'),_0x4fbd('0x71'),_0x4fbd('0x72')])));return ami[_0x4fbd('0x73')]({'action':'status','channel':_0x58d090['actions'][_0x2ca8f0][_0x4fbd('0x74')]})[_0x4fbd('0x75')](function(_0x27d480){if(_0x27d480[_0x4fbd('0x4a')]===_0x4fbd('0x76')){setTimeout(function(){if(_0x58d090[_0x4fbd('0x12')][_0x2ca8f0]){ut[_0x4fbd('0x77')](_0x58d090[_0x4fbd('0x23')][_0x58d090[_0x4fbd('0x12')][_0x2ca8f0]['queue']],_0x4fbd('0x78'));if(_0x58d090[_0x4fbd('0x12')][_0x2ca8f0][_0x4fbd('0x6d')]===!![]){ut[_0x4fbd('0x79')](_0x58d090[_0x4fbd('0x23')][_0x58d090[_0x4fbd('0x12')][_0x2ca8f0][_0x4fbd('0x6a')]],_0x4fbd('0x78'));ut[_0x4fbd('0x7a')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2ca8f0,_0x58d090[_0x4fbd('0x12')][_0x2ca8f0][_0x4fbd('0x6a')]);}ut['loggerError'](_0x4fbd('0x7b')+_0x2ca8f0,_0x58d090[_0x4fbd('0x12')][_0x2ca8f0][_0x4fbd('0x6a')]);delete _0x58d090[_0x4fbd('0x12')][_0x2ca8f0];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x1ef788=this;loggerAction['info'](_0x4fbd('0x7c'),_['size'](this[_0x4fbd('0x12')]));for(var _0xd27193 in this['actions']){if(_0x1ef788[_0x4fbd('0x12')][_0x4fbd('0x5f')](_0xd27193)){_0x1ef788[_0x4fbd('0x65')](_0xd27193);}}};Preview[_0x4fbd('0xe')][_0x4fbd('0x64')]=function(_0x334683){var _0x298015=this;rpcDb['getContactRecallMe'](_0x334683['id'],ut[_0x4fbd('0x7d')](this[_0x4fbd('0x13')]))[_0x4fbd('0x7e')](function(_0x4a72cf){if(!_[_0x4fbd('0x68')](_0x4a72cf)){for(var _0x560754=0x0;_0x560754<_0x4a72cf[_0x4fbd('0x7f')];_0x560754+=0x1){if(ut['getDiff'](_0x4a72cf[_0x560754]['scheduledat'])<_0x334683[_0x4fbd('0x80')]*0x3c){if(_0x4a72cf[_0x560754][_0x4fbd('0x81')]&&!_0x4a72cf[_0x560754]['Agent']['voicePause']){_0x298015['run'](_0x4a72cf[_0x560754]['id'])[_0x4fbd('0x7e')](ut[_0x4fbd('0x82')]('[RecallMe]'))['catch'](ut[_0x4fbd('0x82')](_0x4fbd('0x83')));}else{rpcDb[_0x4fbd('0x84')](_0x4a72cf[_0x560754]['id']);}}else{var _0x5d2a19=new Action(_0x4a72cf[_0x560754],_0x334683);_0x5d2a19['starttime']=moment()[_0x4fbd('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x334683[_0x4fbd('0x3f')]+=0x1;ut['logCustomer'](_0x5d2a19,0x17,_0x4fbd('0x85'));if(_0x334683[_0x4fbd('0x86')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x4a72cf[_0x560754]));rpcDb[_0x4fbd('0x87')](_0x5d2a19,_0x4fbd('0x88'));}else{ut[_0x4fbd('0x89')](_0x5d2a19,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x5d2a19,_0x4fbd('0x8a'));rpcDb['createCustomerFinal'](_0x5d2a19,_0x4fbd('0x8a'));}}}}})[_0x4fbd('0x75')](ut['logger2'](_0x4fbd('0x8b')));};Preview['prototype'][_0x4fbd('0x62')]=function(_0x2b6a8d){_0x2b6a8d[_0x4fbd('0x59')]=!![];if(ut[_0x4fbd('0x8c')](_0x2b6a8d[_0x4fbd('0x2a')])){_0x2b6a8d[_0x4fbd('0x4a')]=_0x4fbd('0x8d');}else if(!ut[_0x4fbd('0x8e')](_0x2b6a8d[_0x4fbd('0x34')])){_0x2b6a8d[_0x4fbd('0x4a')]=_0x4fbd('0x8f');}else if(!this['isTrunkReachable'](_0x2b6a8d[_0x4fbd('0x50')])){if(!this[_0x4fbd('0x90')](_0x2b6a8d['TrunkBackup'])){_0x2b6a8d[_0x4fbd('0x4a')]=_0x4fbd('0x91');}else{_0x2b6a8d[_0x4fbd('0x4a')]='ACTIVE';}}else{_0x2b6a8d['message']='ACTIVE';}emitCampaignPreview(_0x2b6a8d);};Preview[_0x4fbd('0xe')][_0x4fbd('0x92')]=function(_0x43fb24,_0x19f213,_0x4b9ff3){var _0x498709=this;var _0x582f58=this[_0x4fbd('0x12')][_0x19f213];var _0x4ce191=this[_0x4fbd('0x23')][_0x582f58[_0x4fbd('0x6a')]];var _0x3a8d83;var _0x904ad7=![];var _0x44825c=0x2;var _0x841e9=0x3;if(_0x4ce191){switch(_0x4b9ff3){case'1':_0x4ce191['outboundNoSuchCallsDay']+=0x1;_0x582f58[_0x4fbd('0x93')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0x0,_0x4fbd('0x96'));ami['emit'](_0x4fbd('0x97'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0x99')));rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0x9a'));_0x498709[_0x4fbd('0x9b')](_0x582f58,'0',_0x4ce191)[_0x4fbd('0x7e')](function(_0xe68ef9){_0x904ad7=_0xe68ef9[_0x4fbd('0x9c')]==0x1;_0x44825c=_0x4ce191['dialNoSuchNumberRetryFrequency'];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191[_0x4fbd('0x9e')]){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xa2'));}else{if(_0x582f58[_0x4fbd('0x93')]>=_0x4ce191[_0x4fbd('0xa3')]){rpcDb[_0x4fbd('0xa1')](_0x582f58,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x4fbd('0xa4')](ut[_0x4fbd('0xa5')](_0x582f58,_0x4fbd('0x93'),_0x4ce191[_0x4fbd('0xa6')]),_0x582f58[_0x4fbd('0xa7')],_0x582f58[_0x4fbd('0xa8')]);}}delete this['actions'][_0x43fb24[_0x4fbd('0xa9')]];}else{_0x582f58['countnosuchnumberretry']++;logger[_0x4fbd('0x57')]('actioncountonusuch',_0x582f58[_0x4fbd('0x93')]);logger[_0x4fbd('0x57')]('id',_0x582f58['idContact']);_0x498709['incrementPreviewCounters']({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countnosuchnumberretry':_0x582f58[_0x4fbd('0x93')]}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case _0x4fbd('0xac'):var _0x6561dd=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x582f58['responsetime']=_0x6561dd;_0x582f58[_0x4fbd('0xad')]=_0x6561dd;_0x582f58[_0x4fbd('0x6d')]=!![];_0x4ce191[_0x4fbd('0x2b')]+=0x1;logger[_0x4fbd('0x57')](_0x4fbd('0xae'),_0x582f58[_0x4fbd('0xaf')],_0x4fbd('0xb0'),_0x4ce191[_0x4fbd('0x26')],_0x4fbd('0x6c'),_0x4ce191[_0x4fbd('0x2b')]);ami[_0x4fbd('0x24')](_0x4fbd('0xb1'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xb2'),this[_0x4fbd('0x23')][_0x582f58[_0x4fbd('0x6a')]]));if(_0x4ce191[_0x4fbd('0xb3')]){ami['emit']('custom:agentConnectPreview',ut['buildAcw'](_0x582f58));}break;case'16':ami['emit'](_0x4fbd('0xb4'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xb5'),this['campaignsPreview'][_0x582f58['queue']]));emitVoiceQueueChannelRemove(ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xb5')));_0x4ce191[_0x4fbd('0xb6')]+=0x1;_0x4ce191[_0x4fbd('0x30')]+=0x1;_0x4ce191['answered']+=0x1;ut[_0x4fbd('0x79')](_0x4ce191,_0x4fbd('0xb7'));_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0x4,'Answer');rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xb8'));rpcDb[_0x4fbd('0xa1')](_0x582f58,_0x4fbd('0xb9'));rpcDb[_0x4fbd('0xba')](_0x582f58);_0x4ce191['sumDuration']+=_0x582f58[_0x4fbd('0xbb')];_0x4ce191[_0x4fbd('0x2c')]+=_0x582f58[_0x4fbd('0xbb')];logger[_0x4fbd('0x57')](_0x4fbd('0xbc'),_0x582f58['uniqueid'],_0x4fbd('0xb0'),_0x4ce191[_0x4fbd('0x26')],'pTalking:\x20',_0x4ce191[_0x4fbd('0x2b')]);delete this[_0x4fbd('0x12')][_0x43fb24['linkedid']];break;case _0x4fbd('0xbd'):_0x4ce191['outboundBusyCallsDay']+=0x1;_0x582f58[_0x4fbd('0xbe')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut['logCustomer'](_0x582f58,0x5,_0x4fbd('0xbf'));_0x44825c=_0x4ce191[_0x4fbd('0xc0')];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];ami['emit'](_0x4fbd('0xc1'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xc2')));rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xc3'));_0x498709['verifyAdditionalPhones'](_0x582f58,'5',_0x4ce191)['then'](function(_0x5b2462){_0x904ad7=_0x5b2462[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut['totalGlobal'](_0x582f58)>=_0x4ce191['dialGlobalMaxRetry']){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xc4'));}else{if(_0x582f58[_0x4fbd('0xbe')]>=_0x4ce191[_0x4fbd('0xc5')]){rpcDb[_0x4fbd('0xa1')](_0x582f58,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x4fbd('0xa4')](ut[_0x4fbd('0xa5')](_0x582f58,'countbusyretry',_0x4ce191[_0x4fbd('0xc0')]),_0x582f58['unlockAgent'],_0x582f58[_0x4fbd('0xa8')]);}}}else{_0x582f58[_0x4fbd('0xbe')]++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countbusyretry':_0x582f58[_0x4fbd('0xbe')]}})[_0x4fbd('0x7e')](function(){_0x498709['swapAdditionalPhones'](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case'NOANSWER':_0x4ce191[_0x4fbd('0x3d')]+=0x1;_0x582f58[_0x4fbd('0xc7')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut['logCustomer'](_0x582f58,0x3,_0x4fbd('0xc8'));_0x44825c=_0x4ce191[_0x4fbd('0xc9')];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];var _0x16e75a=ut[_0x4fbd('0xca')](_0x582f58,_0x4ce191);ami[_0x4fbd('0x24')](_0x4fbd('0xcb'),_0x16e75a);rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xcc'));_0x498709['verifyAdditionalPhones'](_0x582f58,'3',_0x4ce191)['then'](function(_0x4ba66e){_0x904ad7=_0x4ba66e[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut['totalGlobal'](_0x582f58)>=_0x4ce191[_0x4fbd('0x9e')]){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x582f58[_0x4fbd('0xc7')]>=_0x4ce191['dialNoAnswerMaxRetry']){rpcDb[_0x4fbd('0xa1')](_0x582f58,_0x4fbd('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x4fbd('0xa5')](_0x582f58,_0x4fbd('0xc7'),_0x4ce191[_0x4fbd('0xc9')]),_0x582f58[_0x4fbd('0xa7')],_0x582f58['activeContact']);}}}else{_0x582f58[_0x4fbd('0xc7')]++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countnoanswerretry':_0x582f58['countnoanswerretry']}})['then'](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case _0x4fbd('0xcd'):_0x4ce191[_0x4fbd('0xce')]+=0x1;_0x582f58[_0x4fbd('0xcf')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut['totalGlobal'](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0x8,_0x4fbd('0xd0'));_0x44825c=_0x4ce191[_0x4fbd('0xd1')];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];ami[_0x4fbd('0x24')](_0x4fbd('0xd2'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xd3')));rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xd4'));_0x498709['verifyAdditionalPhones'](_0x582f58,'8',_0x4ce191)[_0x4fbd('0x7e')](function(_0x3c2a23){_0x904ad7=_0x3c2a23['additional']==0x1;if(!_0x904ad7){if(ut['totalGlobal'](_0x582f58)>=_0x4ce191['dialGlobalMaxRetry']){_0x3a8d83=ut['cloneAction'](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xd5'));}else{if(_0x582f58['countcongestionretry']>=_0x4ce191['dialCongestionMaxRetry']){rpcDb[_0x4fbd('0xa1')](_0x582f58,_0x4fbd('0xd4'));}else{rpcDb['rescheduleContact'](ut[_0x4fbd('0xa5')](_0x582f58,_0x4fbd('0xcf'),_0x4ce191[_0x4fbd('0xc0')]),_0x582f58[_0x4fbd('0xa7')],_0x582f58[_0x4fbd('0xa8')]);}}}else{_0x582f58[_0x4fbd('0xcf')]++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countcongestionretry':_0x582f58[_0x4fbd('0xcf')]}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case _0x4fbd('0xd6'):_0x4ce191[_0x4fbd('0x40')]+=0x1;_0x582f58[_0x4fbd('0xd7')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut['logCustomer'](_0x582f58,0x14,'AgentReject');_0x44825c=_0x4ce191['dialAgentRejectRetryFrequency'];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];ami[_0x4fbd('0x24')](_0x4fbd('0xd8'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xd9')));rpcDb['createCustomerHistory'](_0x582f58,_0x4fbd('0xda'));_0x498709['verifyAdditionalPhones'](_0x582f58,'20',_0x4ce191)[_0x4fbd('0x7e')](function(_0xe9d802){_0x904ad7=_0xe9d802[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191[_0x4fbd('0x9e')]){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0x14,'AgentReject');rpcDb[_0x4fbd('0xa1')](_0x3a8d83,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x582f58['countagentrejectretry']>=_0x4ce191['dialAgentRejectMaxRetry']){rpcDb[_0x4fbd('0xa1')](_0x582f58,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x4fbd('0xa4')](ut[_0x4fbd('0xa5')](_0x582f58,'countagentrejectretry',_0x4ce191[_0x4fbd('0xdb')]),_0x582f58[_0x4fbd('0xa7')],_0x582f58['activeContact']);}}}else{_0x582f58[_0x4fbd('0xc7')]++;_0x498709['incrementPreviewCounters']({'id':_0x582f58['idContact'],'field':{'countnoanswerretry':_0x582f58[_0x4fbd('0xc7')]}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case'ABANDONED':_0x4ce191[_0x4fbd('0xdc')]+=0x1;_0x582f58[_0x4fbd('0xdd')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0xb,'Abandoned');rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xde'));_0x498709['verifyAdditionalPhones'](_0x582f58,'11',_0x4ce191)[_0x4fbd('0x7e')](function(_0x28b61b){_0x904ad7=_0x28b61b[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191[_0x4fbd('0x9e')]){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xde'));}else{if(_0x582f58['countabandonedetry']>=_0x4ce191[_0x4fbd('0xdf')]){rpcDb[_0x4fbd('0xa1')](_0x582f58,_0x4fbd('0xde'));}else{rpcDb[_0x4fbd('0xa4')](ut[_0x4fbd('0xa5')](_0x582f58,_0x4fbd('0xdd'),_0x4ce191['dialAbandonedRetryFrequency']),_0x582f58[_0x4fbd('0xa7')],_0x582f58[_0x4fbd('0xa8')]);}}}else{_0x582f58['countnoanswerretry']++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countnoanswerretry':_0x582f58['countnoanswerretry']}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});break;case'18':_0x4ce191[_0x4fbd('0xe0')]+=0x1;_0x582f58[_0x4fbd('0xe1')]+=0x1;_0x582f58['countglobal']=ut['totalGlobal'](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0x12,_0x43fb24[_0x4fbd('0xe2')]||_0x43fb24[_0x4fbd('0xe3')]);ami['emit'](_0x4fbd('0xe4'),ut[_0x4fbd('0x98')](_0x582f58,'amd'));rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xe5'));_0x498709[_0x4fbd('0x9b')](_0x582f58,'18',_0x4ce191)[_0x4fbd('0x7e')](function(_0x3b2996){_0x904ad7=_0x3b2996[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191['dialGlobalMaxRetry']){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0x12,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x582f58,_0x4fbd('0xe5'));}}else{_0x582f58[_0x4fbd('0xc7')]++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58['idContact'],'field':{'countnoanswerretry':_0x582f58[_0x4fbd('0xc7')]}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});});}});delete this[_0x4fbd('0x12')][_0x43fb24[_0x4fbd('0xa9')]];break;case'19':_0x4ce191[_0x4fbd('0xe0')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0x13,_0x43fb24[_0x4fbd('0xe2')]||_0x43fb24['dialstatus']);ami['emit'](_0x4fbd('0xe4'),ut[_0x4fbd('0x98')](_0x582f58,_0x4fbd('0xe6')));rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xe7'));_0x498709[_0x4fbd('0x9b')](_0x582f58,'18',_0x4ce191)[_0x4fbd('0x7e')](function(_0x26f448){_0x904ad7=_0x26f448[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191['dialGlobalMaxRetry']){_0x3a8d83=ut[_0x4fbd('0x9f')](_0x582f58,0xf,_0x4fbd('0xa0'));rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xe7'));}else{rpcDb[_0x4fbd('0xa1')](_0x582f58,'[callProgressDetectingCustomer][machine]');}}else{_0x582f58[_0x4fbd('0xc7')]++;_0x498709[_0x4fbd('0xc6')]({'id':_0x582f58[_0x4fbd('0xaa')],'field':{'countnoanswerretry':_0x582f58['countnoanswerretry']}})[_0x4fbd('0x7e')](function(){_0x498709[_0x4fbd('0xab')](_0x582f58,_0x44825c,_0x841e9)['then'](function(){});});}});delete this[_0x4fbd('0x12')][_0x43fb24[_0x4fbd('0xa9')]];break;default:if(_0x582f58['dialAnswer']){ut['decrementTalkink'](_0x4ce191,_0x4fbd('0xe8'));ut[_0x4fbd('0x7a')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x4ce191[_0x4fbd('0x26')],_0x43fb24);}_0x4ce191[_0x4fbd('0xe0')]+=0x1;_0x582f58[_0x4fbd('0x94')]=ut[_0x4fbd('0x95')](_0x582f58);ut[_0x4fbd('0x89')](_0x582f58,0xc,_0x43fb24[_0x4fbd('0xe2')]||_0x43fb24[_0x4fbd('0xe3')]);_0x44825c=_0x4ce191[_0x4fbd('0xdb')];_0x841e9=_0x4ce191[_0x4fbd('0x9d')];rpcDb[_0x4fbd('0x87')](_0x582f58,_0x4fbd('0xe9'));_0x498709[_0x4fbd('0x9b')](_0x582f58,'20',_0x4ce191)[_0x4fbd('0x7e')](function(_0x2bc4e1){_0x904ad7=_0x2bc4e1[_0x4fbd('0x9c')]==0x1;if(!_0x904ad7){if(ut[_0x4fbd('0x95')](_0x582f58)>=_0x4ce191[_0x4fbd('0x9e')]){_0x3a8d83=ut['cloneAction'](_0x582f58,0xf,'Global');rpcDb[_0x4fbd('0xa1')](_0x3a8d83,_0x4fbd('0xea'));}else{rpcDb[_0x4fbd('0xa1')](_0x582f58,_0x4fbd('0xea'));}delete this[_0x4fbd('0x12')][_0x43fb24[_0x4fbd('0xa9')]];}else{_0x498709['swapAdditionalPhones'](_0x582f58,_0x44825c,_0x841e9)[_0x4fbd('0x7e')](function(){});}});}if(!(_0x582f58[_0x4fbd('0x6d')]&&_0x4b9ff3==='16')){ut['updateOriginated'](_0x4ce191,'[callProgressDetectingCustomer]');logger[_0x4fbd('0x57')](_0x4fbd('0xeb'),_0x582f58[_0x4fbd('0xaf')],_0x4fbd('0xb0'),_0x4ce191[_0x4fbd('0x26')],_0x4fbd('0x6b'),_0x4ce191[_0x4fbd('0x5a')]);}if(_0x4b9ff3!==_0x4fbd('0xac')){delete this[_0x4fbd('0x12')][_0x43fb24[_0x4fbd('0xa9')]];delete this[_0x4fbd('0x12')][_0x43fb24['destlinkedid']];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x3045a8,_0x4f53a8,_0x9fdb42){if(_['isUndefined'](_0x4f53a8)&&_0x4fbd('0xec')!==typeof _0x4f53a8){return;}if(_[_0x4fbd('0xed')](_0x9fdb42)&&_0x4fbd('0xec')!==typeof _0x9fdb42){return;}switch(_0x9fdb42[_0x4fbd('0xee')]){case'0':ut['logAgent'](_0x3045a8,0x0,_0x4fbd('0x96'));rpcDb['createAgentHistory'](_0x3045a8,_0x4fbd('0xef'));break;case'3':ut[_0x4fbd('0xf0')](_0x3045a8,0x3,_0x4fbd('0xc8'));rpcDb[_0x4fbd('0xf1')](_0x3045a8,_0x4fbd('0xf2'));break;case'5':ut[_0x4fbd('0xf0')](_0x3045a8,0x5,'Busy');rpcDb['createAgentHistory'](_0x3045a8,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x4fbd('0xf0')](_0x3045a8,0x8,_0x4fbd('0xd0'));rpcDb[_0x4fbd('0xf1')](_0x3045a8,_0x4fbd('0xf3'));break;case'22':ut['logAgent'](_0x3045a8,0x16,'AnswerAGI');rpcDb[_0x4fbd('0xf1')](_0x3045a8,_0x4fbd('0xf4'));break;default:ut[_0x4fbd('0xf0')](_0x3045a8,0xc,_0x9fdb42[_0x4fbd('0xee')]);rpcDb['createAgentHistory'](_0x3045a8,_0x4fbd('0xf3'));}ut['updateOriginated'](_0x4f53a8,_0x4fbd('0xf5'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x3045a8[_0x4fbd('0xaf')],_0x4fbd('0xb0'),_0x4f53a8['name'],'originated:\x20',_0x4f53a8[_0x4fbd('0x5a')]);delete this[_0x4fbd('0x12')][_0x3045a8[_0x4fbd('0xaf')]];};Preview[_0x4fbd('0xe')][_0x4fbd('0x9b')]=function(_0xfaf899,_0x44b652,_0x18f6a3){return Promise[_0x4fbd('0xf6')]()[_0x4fbd('0x7e')](cmHopperAdditionalPhone[_0x4fbd('0x9b')](_0xfaf899,_0x44b652,_0x18f6a3))[_0x4fbd('0x75')](logger[_0x4fbd('0x57')](_0x4fbd('0xf7')));};Preview[_0x4fbd('0xe')]['swapAdditionalPhones']=function(_0x1bdbf0,_0x503fbd,_0x378b57){return Promise[_0x4fbd('0xf6')]()[_0x4fbd('0x7e')](cmHopperAdditionalPhone[_0x4fbd('0xab')](_0x1bdbf0,_0x503fbd,_0x378b57))[_0x4fbd('0x75')](logger[_0x4fbd('0x57')](_0x4fbd('0xf8')));};Preview['prototype']['incrementPreviewCounters']=function(_0xaa649a){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0x4fbd('0xc6')](_0xaa649a))[_0x4fbd('0x75')](logger[_0x4fbd('0x57')](_0x4fbd('0xf9')));};Preview[_0x4fbd('0xe')][_0x4fbd('0xfa')]=function(_0x5dbd9b,_0x3e695b,_0x3a4c3b,_0x325fd2,_0x36d9d7){var _0x36f018=this;return new Promise(function(_0x266205,_0x491f8c){if(_[_0x4fbd('0x68')](_0x3e695b)||_[_0x4fbd('0x68')](_0x3e695b[_0x4fbd('0xfb')])||_['isNil'](_0x3e695b[_0x4fbd('0xfc')])||_['isNil'](_0x3e695b['VoiceQueueId'])){_0x491f8c(ut[_0x4fbd('0x4a')](_0x4fbd('0xfd'),_0x325fd2,_0x36d9d7));return;}var _0x4620e2=uuid['v4']();var _0x25e187=_0x36f018[_0x4fbd('0x23')][_0x3e695b[_0x4fbd('0x69')][_0x4fbd('0x26')]];var _0x294554=_0x3a4c3b?_0x36f018['agents'][_0x3a4c3b]['id']:undefined;_0x36f018[_0x4fbd('0x12')][_0x4620e2]=new Action(_0x3e695b,_0x25e187,_0x4620e2,_0x3a4c3b,_0x294554);var _0x5f326a=_0x36f018[_0x4fbd('0x12')][_0x4620e2];_0x5f326a['unlockAgent']=_0x325fd2;_0x5f326a['activeContact']=_0x36d9d7;_0x5f326a['lookAgent']=_0x3a4c3b;if(_[_0x4fbd('0xfe')](_0x5dbd9b)){_0x36f018[_0x4fbd('0xff')](_0x5f326a,_0x25e187,_0x3e695b,_0x3a4c3b)['then'](function(_0x4c4131){logger[_0x4fbd('0x57')]('[Preview][execCall][success]',_0x4fbd('0x100')+_0x5f326a[_0x4fbd('0x6a')]+_0x4fbd('0x101')+_0x5f326a[_0x4fbd('0xaa')],JSON[_0x4fbd('0x54')](_0x4c4131));ami[_0x4fbd('0x24')](_0x4fbd('0x102'),ut[_0x4fbd('0x98')](_0x5f326a,_0x4fbd('0x103'),_0x36f018[_0x4fbd('0x23')][_0x5f326a[_0x4fbd('0x6a')]]));_0x266205(ut[_0x4fbd('0x4a')](_0x4fbd('0x104')));})['catch'](function(_0x175239){ut[_0x4fbd('0x105')](_0x4fbd('0x106'),_0x175239);_0x491f8c(ut['message'](_0x4fbd('0x107'),_0x325fd2,_0x36d9d7));});}else{_0x25e187[_0x4fbd('0x108')]+=0x1;ut[_0x4fbd('0x109')](_0x5f326a);rpcDb[_0x4fbd('0x10a')](_0x5f326a,'[Blacklist][error]');delete _0x36f018[_0x4fbd('0x12')][_0x4620e2];_0x491f8c(ut[_0x4fbd('0x4a')](_0x4fbd('0x10b'),_0x325fd2,_0x36d9d7));}});};Preview[_0x4fbd('0xe')][_0x4fbd('0x90')]=function(_0x2aabf9){return!_['isNil'](_0x2aabf9)&&!_[_0x4fbd('0x68')](_0x2aabf9[_0x4fbd('0x26')])&&!_['isNil'](_0x2aabf9[_0x4fbd('0x51')])&&_0x2aabf9[_0x4fbd('0x51')]&&!_[_0x4fbd('0x68')](this[_0x4fbd('0x11')][util[_0x4fbd('0x55')](_0x4fbd('0x10c'),_0x2aabf9['name'])])&&!_[_0x4fbd('0x68')](this[_0x4fbd('0x11')][util[_0x4fbd('0x55')](_0x4fbd('0x10c'),_0x2aabf9[_0x4fbd('0x26')])]['status'])&&(this[_0x4fbd('0x11')][util['format'](_0x4fbd('0x10c'),_0x2aabf9['name'])][_0x4fbd('0x10d')]===_0x4fbd('0x10e')||this['trunks'][util['format'](_0x4fbd('0x10c'),_0x2aabf9[_0x4fbd('0x26')])][_0x4fbd('0x10d')]===_0x4fbd('0x10f'));};Preview['prototype'][_0x4fbd('0x110')]=function(_0x4bb0ad,_0x4b24dc){var _0x533284=this;return new Promise(function(_0x1de862,_0xc96e89){_0x533284['execRun'](_0x4bb0ad,_0x4b24dc)[_0x4fbd('0x7e')](function(_0x3a6a80){_0x1de862(_[_0x4fbd('0x6e')](_0x3a6a80,[_0x4fbd('0x4a')]));})['catch'](function(_0x1ee3a7){if(_0x1ee3a7[_0x4fbd('0x111')]){rpcDb[_0x4fbd('0x112')](_0x4bb0ad);}if(_0x1ee3a7[_0x4fbd('0x51')]){rpcDb[_0x4fbd('0x84')](_0x4bb0ad);}_0xc96e89(_[_0x4fbd('0x6e')](_0x1ee3a7,['message']));});});};Preview['prototype'][_0x4fbd('0x113')]=function(_0x1daa42,_0x35c381){var _0x58c76b=this;return new Promise(function(_0x4b7212,_0x4d6858){var _0x126093,_0x2a96bd;rpcDb[_0x4fbd('0x114')](_0x1daa42)[_0x4fbd('0x7e')](function(_0x514d38){if(!_['isNil'](_0x514d38[0x0])){_0x2a96bd=_0x514d38[0x0][_0x4fbd('0x115')]?![]:!![];_0x126093=_0x514d38[0x0][_0x4fbd('0x115')]?!![]:![];_0x126093=_0x35c381?!![]:_0x126093;}var _0x124e5d=_0x58c76b[_0x4fbd('0x116')](_0x514d38);if(_0x124e5d[_0x4fbd('0x117')]){rpcDb[_0x4fbd('0x118')](_[_0x4fbd('0x6e')](_0x514d38[0x0],[_0x4fbd('0x71'),_0x4fbd('0xfc')]))[_0x4fbd('0x7e')](function(_0x32e6f7){_0x58c76b[_0x4fbd('0xfa')](_0x32e6f7,_0x514d38[0x0],_0x35c381,_0x2a96bd,_0x126093)['then'](function(_0x5ac6eb){_0x4b7212(_0x5ac6eb);})['catch'](function(_0x1b7f6f){_0x4d6858(_0x1b7f6f);});})[_0x4fbd('0x75')](function(_0x272f88){ut['logger'](_0x4fbd('0x119'),_0x272f88);_0x4d6858(ut['message'](_0x4fbd('0x11a'),_0x2a96bd,_0x126093));});}else{_0x4d6858(ut[_0x4fbd('0x4a')](_0x124e5d['message'],_0x2a96bd,_0x126093));}})[_0x4fbd('0x75')](function(_0x10ba7f){ut['logger'](_0x4fbd('0x11b'),_0x10ba7f);_0x4d6858(ut['message'](_0x4fbd('0x11a'),![],!![]));});});};Preview[_0x4fbd('0xe')][_0x4fbd('0x116')]=function(_0x3c41c4){if(_[_0x4fbd('0x68')](_0x3c41c4)||_[_0x4fbd('0xfe')](_0x3c41c4)||!_[_0x4fbd('0x68')](_0x3c41c4[0x0][_0x4fbd('0x81')])&&_[_0x4fbd('0x68')](_0x3c41c4[0x0][_0x4fbd('0x81')][_0x4fbd('0x26')])){ut['logger'](_0x4fbd('0x11c'),_0x3c41c4);return{'isValid':![],'message':_0x4fbd('0x11d')};}var _0xf18bb7=this[_0x4fbd('0x23')][_0x3c41c4[0x0][_0x4fbd('0x69')][_0x4fbd('0x26')]];_0xf18bb7[_0x4fbd('0x4a')]=_0x4fbd('0x11e');if(_[_0x4fbd('0x68')](_0xf18bb7)){ut[_0x4fbd('0x105')](_0x4fbd('0x11f'),_0xf18bb7);return{'isValid':![],'message':_0x4fbd('0x120')};}if(!this[_0x4fbd('0x90')](_0xf18bb7[_0x4fbd('0x50')])){ut['logger'](_0x4fbd('0x121'),_0x4fbd('0x122')+_0xf18bb7[_0x4fbd('0x26')]+_0x4fbd('0x123'));if(!this[_0x4fbd('0x90')](_0xf18bb7[_0x4fbd('0x124')])){ut[_0x4fbd('0x105')](_0x4fbd('0x121'),_0xf18bb7[_0x4fbd('0x26')]+_0x4fbd('0x125'));return{'isValid':![],'message':_0x4fbd('0x126')};}}if(!ut['isActive'](_0xf18bb7['dialActive'])){ut['logger'](_0x4fbd('0x127'),_0xf18bb7[_0x4fbd('0x26')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x4fbd('0x122')+_0xf18bb7[_0x4fbd('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x4fbd('0x128')};};Preview['prototype']['execCall']=function(_0x50e075,_0x55a9d4,_0x136b0b,_0x2a26f9){var _0x2d1bbf=this;return new Promise(function(_0x889845,_0x3e107f){var _0x2c31fa=_0x50e075[_0x4fbd('0xaf')];var _0xfaf6a4=_0x2d1bbf[_0x4fbd('0x90')](_0x55a9d4['Trunk'])?util['format'](_0x4fbd('0x129'),_0x55a9d4[_0x4fbd('0x50')]['name'],_[_0x4fbd('0x68')](_0x55a9d4[_0x4fbd('0x37')])?'':_0x55a9d4[_0x4fbd('0x37')][_0x4fbd('0x12a')]()||'',_0x55a9d4[_0x4fbd('0x12b')]>0x0?_0x136b0b['phone']['substring'](_0x55a9d4['dialCutDigit']):_0x136b0b[_0x4fbd('0xfc')]):util[_0x4fbd('0x55')](_0x4fbd('0x129'),_[_0x4fbd('0x68')](_0x55a9d4['TrunkBackup'])?_0x55a9d4['Trunk'][_0x4fbd('0x26')]:_0x55a9d4['TrunkBackup'][_0x4fbd('0x26')],_['isNil'](_0x55a9d4['dialPrefix'])?'':_0x55a9d4[_0x4fbd('0x37')][_0x4fbd('0x12a')]()||'',_0x55a9d4[_0x4fbd('0x12b')]>0x0?_0x136b0b['phone'][_0x4fbd('0x12c')](_0x55a9d4[_0x4fbd('0x12b')]):_0x136b0b[_0x4fbd('0xfc')]);var _0x4fdda8=_0x2d1bbf[_0x4fbd('0x90')](_0x55a9d4[_0x4fbd('0x50')])?ut[_0x4fbd('0x12d')](_0x55a9d4[_0x4fbd('0x50')][_0x4fbd('0x52')],_0x55a9d4['dialOriginateCallerIdName'],_0x55a9d4[_0x4fbd('0x12e')]>0x0?ut[_0x4fbd('0x12f')](_0x55a9d4['dialOriginateCallerIdNumber'],_0x55a9d4[_0x4fbd('0x12e')]):_0x55a9d4[_0x4fbd('0x130')]):ut['getCallerId'](_[_0x4fbd('0x68')](_0x55a9d4[_0x4fbd('0x124')])?_0x55a9d4[_0x4fbd('0x50')][_0x4fbd('0x52')]:_0x55a9d4[_0x4fbd('0x124')][_0x4fbd('0x52')],_0x55a9d4[_0x4fbd('0x35')],_0x55a9d4['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x4fbd('0x12f')](_0x55a9d4['dialOriginateCallerIdNumber'],_0x55a9d4[_0x4fbd('0x12e')]):_0x55a9d4[_0x4fbd('0x130')]);if(_0x4fdda8){_0x50e075[_0x4fbd('0x131')]=ut[_0x4fbd('0x132')](_0x4fdda8);_0x50e075['originatecalleridnum']=ut[_0x4fbd('0x133')](_0x4fdda8);}var _0x204e5a=ut[_0x4fbd('0x134')](_0x55a9d4,_0x136b0b,_0xfaf6a4,_0x4fdda8,_0x2c31fa,_0x50e075);_[_0x4fbd('0x135')](_0x50e075,ut['toLowerVariables'](_0x204e5a));_0x50e075['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x55a9d4[_0x4fbd('0x136')]=_0x204e5a;ami[_0x4fbd('0x73')](ut[_0x4fbd('0x137')](_0x50e075,_0x55a9d4,_0x204e5a,_0x50e075[_0x4fbd('0xa8')],_0x2a26f9))[_0x4fbd('0x7e')](function(_0xf8efbc){_0x55a9d4['originated']+=0x1;logger[_0x4fbd('0x57')](_0x4fbd('0x138'),_0x2c31fa,_0x4fbd('0xb0'),_0x55a9d4[_0x4fbd('0x26')],_0x4fbd('0x6b'),_0x55a9d4[_0x4fbd('0x5a')]);_0x889845(_0xf8efbc);})[_0x4fbd('0x75')](function(_0x3e5c8f){ut[_0x4fbd('0xf0')](_0x50e075,0xe,_0x4fbd('0x139'));rpcDb['createAgentHistory'](_0x50e075,_0x4fbd('0x13a'));_0x3e107f(_0x3e5c8f);});});};Preview['prototype'][_0x4fbd('0x1e')]=function(_0x4ce09a){if(this[_0x4fbd('0x12')][_0x4ce09a[_0x4fbd('0xa9')]]){this[_0x4fbd('0x12')][_0x4ce09a[_0x4fbd('0xa9')]][_0x4fbd('0x74')]=_0x4ce09a[_0x4fbd('0x74')];}};Preview[_0x4fbd('0xe')][_0x4fbd('0x16')]=function(_0x2003ca){var _0x1f482b=this;var _0x521d1f=this[_0x4fbd('0x12')][_0x2003ca[_0x4fbd('0x13b')]];if(_0x521d1f){if(_0x521d1f['lookAgent']&&this['agents'][_0x521d1f['lookAgent']]){ut[_0x4fbd('0x13c')](_0x521d1f,this[_0x4fbd('0x13')][_0x521d1f['lookAgent']][_0x4fbd('0x26')],this[_0x4fbd('0x13')][_0x521d1f[_0x4fbd('0x13d')]]['id']);}var _0x1fa98c=_['clone'](_0x521d1f);_0x1fa98c[_0x4fbd('0x13e')]=moment()[_0x4fbd('0x55')](_0x4fbd('0x13f'));var _0x4be990=_0x1f482b[_0x4fbd('0x23')][_0x521d1f[_0x4fbd('0x6a')]];if(ut[_0x4fbd('0x140')](_0x2003ca[_0x4fbd('0x141')])){if(_0x521d1f[_0x4fbd('0xa7')]){rpcDb[_0x4fbd('0x112')](_0x521d1f[_0x4fbd('0xaa')]);}if(_0x521d1f[_0x4fbd('0xa8')]){rpcDb['disableContact'](_0x521d1f[_0x4fbd('0xaa')]);}ami[_0x4fbd('0x24')](_0x4fbd('0x142'),ut[_0x4fbd('0x98')](_0x521d1f,_0x4fbd('0x143'),this[_0x4fbd('0x23')][_0x521d1f[_0x4fbd('0x6a')]]));this[_0x4fbd('0x144')](_0x1fa98c,_0x4be990,_0x2003ca);}else{_0x521d1f[_0x4fbd('0x145')]=moment()[_0x4fbd('0x55')](_0x4fbd('0x13f'));ut[_0x4fbd('0xf0')](_0x1fa98c,0x4,_0x4fbd('0x146'));rpcDb[_0x4fbd('0xf1')](_0x1fa98c,_0x4fbd('0x147'));}}};Preview[_0x4fbd('0xe')][_0x4fbd('0x19')]=function(_0x5c19bd){var _0x5e275a=this[_0x4fbd('0x12')][_0x5c19bd[_0x4fbd('0xa9')]];var _0xd7530;if(_0x5e275a){_0xd7530=this[_0x4fbd('0x23')][_0x5e275a['queue']];logger[_0x4fbd('0x57')]('[syncHangup][talking]',_0x5c19bd[_0x4fbd('0xa9')],'\x20Queue',_0xd7530[_0x4fbd('0x26')],_0x4fbd('0x6c'),_0xd7530[_0x4fbd('0x2b')]);}if(this[_0x4fbd('0x12')][_0x5c19bd[_0x4fbd('0xa9')]]&&_0x5c19bd[_0x4fbd('0xa9')]!==_0x5c19bd[_0x4fbd('0xaf')]){if(_0x5c19bd[_0x4fbd('0x148')]==='16'&&this[_0x4fbd('0x12')][_0x5c19bd['linkedid']][_0x4fbd('0x6d')]){this[_0x4fbd('0x92')](_0x5c19bd,_0x5c19bd['linkedid'],_0x5c19bd['cause']);}else if(this[_0x4fbd('0x12')][_0x5c19bd[_0x4fbd('0xa9')]]['dialAnswer']){logger['info']('[syncHangup][talking][cause]',_0x5c19bd[_0x4fbd('0xa9')],_0x5c19bd[_0x4fbd('0x148')],'\x20Queue',_0xd7530[_0x4fbd('0x26')],'pTalking:\x20',_0xd7530['pTalking']);this[_0x4fbd('0x92')](_0x5c19bd,_0x5c19bd[_0x4fbd('0xa9')],_0x5c19bd['cause']);}}else if(_0x5e275a&&_['isNil'](_0x5e275a[_0x4fbd('0x149')])&&_0xd7530[_0x4fbd('0x14a')]&&_0x5c19bd[_0x4fbd('0xa9')]===_0x5c19bd[_0x4fbd('0xaf')]&&_[_0x4fbd('0x68')](_0x5c19bd['reason'])&&_0x5c19bd[_0x4fbd('0x148')]==='16'&&_0x5c19bd['channelstate']==='6'&&_[_0x4fbd('0xed')](_0x5e275a[_0x4fbd('0x14b')])){if(_0x5e275a[_0x4fbd('0xa7')]){rpcDb[_0x4fbd('0x112')](_0x5e275a[_0x4fbd('0xaa')]);}if(_0x5e275a['activeContact']){rpcDb[_0x4fbd('0x84')](_0x5e275a[_0x4fbd('0xaa')]);}_0x5c19bd[_0x4fbd('0xee')]='22';this['callProgressDetectingAgent'](_0x5e275a,_0xd7530,_0x5c19bd);}else if(_0x5e275a&&_0x5e275a['transfer']){if(_0x5c19bd[_0x4fbd('0x148')]==='16'&&this[_0x4fbd('0x12')][_0x5c19bd[_0x4fbd('0xa9')]][_0x4fbd('0x6d')]){logger[_0x4fbd('0x57')]('[syncHangup][talking][transfer]',_0x5c19bd['linkedid'],_0x5c19bd[_0x4fbd('0x148')],_0x4fbd('0xb0'),_0xd7530[_0x4fbd('0x26')],_0x4fbd('0x6c'),_0xd7530[_0x4fbd('0x2b')]);this[_0x4fbd('0x92')](_0x5c19bd,_0x5c19bd['linkedid'],_0x5c19bd['cause']);}else if(this[_0x4fbd('0x12')][_0x5c19bd[_0x4fbd('0xa9')]][_0x4fbd('0x6d')]){logger[_0x4fbd('0x57')]('[syncHangup][talking][cause]',_0x5c19bd[_0x4fbd('0xa9')],_0x5c19bd['cause'],'\x20Queue',_0xd7530['name'],_0x4fbd('0x6c'),_0xd7530[_0x4fbd('0x2b')]);this[_0x4fbd('0x92')](_0x5c19bd,_0x5c19bd[_0x4fbd('0xa9')],_0x5c19bd['cause']);}}};Preview['prototype'][_0x4fbd('0x1c')]=function(_0x25b710){if(this['actions'][_0x25b710['destlinkedid']]&&_0x25b710[_0x4fbd('0x14c')]!==_0x25b710['destuniqueid']){this[_0x4fbd('0x92')](_0x25b710,_0x25b710[_0x4fbd('0x14c')],_0x25b710[_0x4fbd('0xe3')]);}};Preview[_0x4fbd('0xe')][_0x4fbd('0x1a')]=function(_0x322037){if(this[_0x4fbd('0x12')][_0x322037[_0x4fbd('0xa9')]]&&_0x322037[_0x4fbd('0xa9')]!==_0x322037[_0x4fbd('0xaf')]&&!this[_0x4fbd('0x12')][_0x322037[_0x4fbd('0xa9')]][_0x4fbd('0x6d')]){if(_0x322037['cause']==='1'){this[_0x4fbd('0x92')](_0x322037,_0x322037[_0x4fbd('0xa9')],_0x322037[_0x4fbd('0x148')]);}}};Preview['prototype'][_0x4fbd('0x14d')]=function(_0x416421,_0x4a9e87,_0x1ec77e){if(this[_0x4fbd('0x12')][_0x416421]){if(_[_0x4fbd('0x68')](this['actions'][_0x416421][_0x4fbd('0x136')])){this[_0x4fbd('0x12')][_0x416421][_0x4fbd('0x136')]={};}this[_0x4fbd('0x12')][_0x416421]['variables'][_0x4a9e87]=_0x1ec77e;}};Preview[_0x4fbd('0xe')][_0x4fbd('0x20')]=function(_0x5c8880){try{if(!_[_0x4fbd('0x68')](_0x5c8880)){if(ut[_0x4fbd('0x14e')](_['keys'](_0x5c8880[_0x4fbd('0x14f')])[0x0])){this[_0x4fbd('0x14d')](_0x5c8880['uniqueid'],_[_0x4fbd('0x150')](_0x5c8880[_0x4fbd('0x14f')])[0x0],_0x5c8880[_0x4fbd('0x151')]);}}}catch(_0x58e7d3){logger[_0x4fbd('0x152')](_0x4fbd('0x153'),util[_0x4fbd('0x154')](_0x58e7d3,{'showHidden':![],'depth':null}));}};Preview[_0x4fbd('0xe')][_0x4fbd('0x21')]=function(_0x34e0cf){if(_0x34e0cf){if(this[_0x4fbd('0x12')][_0x34e0cf[_0x4fbd('0x155')]]){this[_0x4fbd('0x12')][_0x34e0cf['transfertargetlinkedid']]['transfer']=!![];}}};Preview['prototype'][_0x4fbd('0x156')]=function(_0x2cc362){if(_0x2cc362){if(this[_0x4fbd('0x12')][_0x2cc362[_0x4fbd('0x157')]]){this[_0x4fbd('0x12')][_0x2cc362[_0x4fbd('0x157')]][_0x4fbd('0x14b')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 5d49318..9818f78 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 _0xbc5d=['../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','endtime','connectedlinename','membername','context','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash'];(function(_0x2ecd37,_0x4c1b3a){var _0x2c5c63=function(_0x3625a2){while(--_0x3625a2){_0x2ecd37['push'](_0x2ecd37['shift']());}};_0x2c5c63(++_0x4c1b3a);}(_0xbc5d,0x146));var _0xdbc5=function(_0x117677,_0xc892df){_0x117677=_0x117677-0x0;var _0x2584e6=_0xbc5d[_0x117677];return _0x2584e6;};'use strict';var util=require(_0xdbc5('0x0'));var BPromise=require(_0xdbc5('0x1'));var logger=require('../../../config/logger')(_0xdbc5('0x2'));var _=require(_0xdbc5('0x3'));var cmHopper=require(_0xdbc5('0x4'));var cmHopperFinal=require(_0xdbc5('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xdbc5('0x6'));var voiceQueueRt=require(_0xdbc5('0x7'));var agentReportPreview=require(_0xdbc5('0x8'));var voiceQueueReport=require(_0xdbc5('0x9'));function loggerCatch(_0x56db9f){return function(_0x14aa73){logger['error'](_0x56db9f,util['inspect'](_0x14aa73,{'showHidden':![],'depth':null}));};}function create(_0x36915f){return BPromise[_0xdbc5('0xa')]()[_0xdbc5('0xb')](cmHopperHistory[_0xdbc5('0xc')](_0x36915f))[_0xdbc5('0xd')](loggerCatch(_0xdbc5('0xe')));}function createAgent(_0x237fc8){return BPromise[_0xdbc5('0xa')]()['then'](agentReportPreview[_0xdbc5('0xc')](_0x237fc8))[_0xdbc5('0xd')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2dd8ac){return BPromise[_0xdbc5('0xa')]()['then'](cmHopper[_0xdbc5('0xf')](_0x2dd8ac,!![]))['catch'](loggerCatch(_0xdbc5('0x10')));}exports[_0xdbc5('0x11')]=function(_0x4179ce){return BPromise[_0xdbc5('0xa')]()[_0xdbc5('0xb')](cmHopperBlack['checkIsBlackList'](_0x4179ce))[_0xdbc5('0xd')](loggerCatch(_0xdbc5('0x12')));};exports['getContactPreview']=function(_0x518f3d){return BPromise[_0xdbc5('0xa')]()['then'](cmHopper['getContactPreview'](_0x518f3d))[_0xdbc5('0xd')](loggerCatch(_0xdbc5('0x13')));};exports[_0xdbc5('0xc')]=function(_0x4e170b,_0x1a2330){create(_0x4e170b)[_0xdbc5('0xd')](loggerCatch(_0x1a2330));moveContact(_0x4e170b)[_0xdbc5('0xd')](loggerCatch(_0x1a2330));};exports[_0xdbc5('0x14')]=function(_0x3cfdf8,_0x3890c7){createAgent(_0x3cfdf8)[_0xdbc5('0xd')](loggerCatch(_0x3890c7));};exports[_0xdbc5('0x15')]=function(_0x17225a,_0x82e88f){create(_0x17225a)[_0xdbc5('0xd')](loggerCatch(_0x82e88f));};exports['createCustomerFinal']=function(_0x470229,_0x449759){moveContact(_0x470229)['catch'](loggerCatch(_0x449759));};exports[_0xdbc5('0x16')]=function(_0x16216d,_0x175ab4,_0x5f15a2){if(_0x175ab4){_0x16216d[_0xdbc5('0x17')]=null;}if(_0x5f15a2){_0x16216d[_0xdbc5('0x18')]=![];}return BPromise[_0xdbc5('0xa')]()[_0xdbc5('0xb')](cmHopper[_0xdbc5('0x16')](_0x16216d))[_0xdbc5('0xd')](loggerCatch(_0xdbc5('0x19')));};exports[_0xdbc5('0x1a')]=function(_0x339c8c){return BPromise[_0xdbc5('0xa')]()[_0xdbc5('0xb')](cmHopper[_0xdbc5('0x1a')](_0x339c8c))[_0xdbc5('0xd')](loggerCatch(_0xdbc5('0x1b')));};exports[_0xdbc5('0x1c')]=function(_0x30db6f){return BPromise[_0xdbc5('0xa')]()[_0xdbc5('0xb')](cmHopper[_0xdbc5('0x1c')]({'UserId':null},_0x30db6f,0x1))['catch'](loggerCatch(_0xdbc5('0x1d')));};exports[_0xdbc5('0x1e')]=function(_0x1088e7){return BPromise[_0xdbc5('0xa')]()[_0xdbc5('0xb')](cmHopper['unlockContact']({'active':![]},_0x1088e7,0x1))[_0xdbc5('0xd')](loggerCatch(_0xdbc5('0x1f')));};exports[_0xdbc5('0x20')]=function(_0x3aa0df){var _0x1b5bfa={};_0x1b5bfa['type']=_0x3aa0df[_0xdbc5('0x21')];_0x1b5bfa[_0xdbc5('0x22')]=_0x3aa0df[_0xdbc5('0x22')];_0x1b5bfa[_0xdbc5('0x23')]=_0x3aa0df[_0xdbc5('0x23')];_0x1b5bfa[_0xdbc5('0x24')]=_0x3aa0df[_0xdbc5('0x24')];_0x1b5bfa[_0xdbc5('0x25')]=_0x3aa0df[_0xdbc5('0x25')];_0x1b5bfa[_0xdbc5('0x26')]=_0x3aa0df['answertime'];_0x1b5bfa['queuecallerleaveAt']=_0x3aa0df[_0xdbc5('0x27')];_0x1b5bfa[_0xdbc5('0x28')]=0x1;_0x1b5bfa['queuecallercompleteAt']=_0x3aa0df[_0xdbc5('0x29')];_0x1b5bfa[_0xdbc5('0x2a')]=_0x3aa0df[_0xdbc5('0x2b')];_0x1b5bfa[_0xdbc5('0x2c')]='from-sip';_0x1b5bfa[_0xdbc5('0x2d')]='xcally-motion-preview';_0x1b5bfa[_0xdbc5('0x2e')]=0x0;_0x1b5bfa[_0xdbc5('0x2f')]=0x1;_0x1b5bfa[_0xdbc5('0x30')]=_0x3aa0df[_0xdbc5('0x2b')];_0x1b5bfa[_0xdbc5('0x31')]=_0xdbc5('0x32');return BPromise['resolve']()[_0xdbc5('0xb')](voiceQueueReport[_0xdbc5('0x33')](_0x1b5bfa))[_0xdbc5('0xd')](loggerCatch(_0xdbc5('0x34')));};exports['getContactRecallMe']=function(_0x15307c,_0x1b1655){return BPromise[_0xdbc5('0xa')]()[_0xdbc5('0xb')](cmHopper[_0xdbc5('0x35')](_0x15307c,_0x1b1655))[_0xdbc5('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x1ff3b5){return BPromise[_0xdbc5('0xa')]()[_0xdbc5('0xb')](cmHopper['rescheduleContact'](_0x1ff3b5,!![],!![]))['catch'](loggerCatch(_0xdbc5('0x36')));}; \ No newline at end of file +var _0x4b7b=['membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','[voiceQueueReport]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4b7b,0x1c3));var _0xb4b7=function(_0x4f8297,_0x22d98d){_0x4f8297=_0x4f8297-0x0;var _0x1e2dc6=_0x4b7b[_0x4f8297];return _0x1e2dc6;};'use strict';var util=require(_0xb4b7('0x0'));var BPromise=require(_0xb4b7('0x1'));var logger=require(_0xb4b7('0x2'))(_0xb4b7('0x3'));var _=require(_0xb4b7('0x4'));var cmHopper=require(_0xb4b7('0x5'));var cmHopperFinal=require(_0xb4b7('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xb4b7('0x7'));var voiceQueueRt=require(_0xb4b7('0x8'));var agentReportPreview=require(_0xb4b7('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4b5cbe){return function(_0x5d1fd5){logger['error'](_0x4b5cbe,util[_0xb4b7('0xa')](_0x5d1fd5,{'showHidden':![],'depth':null}));};}function create(_0x64fcf3){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopperHistory[_0xb4b7('0xd')](_0x64fcf3))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0xf')));}function createAgent(_0x5b9b64){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](agentReportPreview[_0xb4b7('0xd')](_0x5b9b64))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0xf')));}function moveContact(_0x16eaa8){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper[_0xb4b7('0x10')](_0x16eaa8,!![]))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0x11')));}exports[_0xb4b7('0x12')]=function(_0x21e9f2){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopperBlack[_0xb4b7('0x12')](_0x21e9f2))['catch'](loggerCatch(_0xb4b7('0x13')));};exports['getContactPreview']=function(_0x16f62c){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper[_0xb4b7('0x14')](_0x16f62c))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0x15')));};exports[_0xb4b7('0xd')]=function(_0x1a3088,_0x41689f){create(_0x1a3088)[_0xb4b7('0xe')](loggerCatch(_0x41689f));moveContact(_0x1a3088)[_0xb4b7('0xe')](loggerCatch(_0x41689f));};exports['createAgentHistory']=function(_0x13f5f9,_0x3eda01){createAgent(_0x13f5f9)[_0xb4b7('0xe')](loggerCatch(_0x3eda01));};exports[_0xb4b7('0x16')]=function(_0x21c494,_0x5fd966){create(_0x21c494)[_0xb4b7('0xe')](loggerCatch(_0x5fd966));};exports[_0xb4b7('0x17')]=function(_0x1f1d1f,_0x580cdf){moveContact(_0x1f1d1f)['catch'](loggerCatch(_0x580cdf));};exports[_0xb4b7('0x18')]=function(_0x4a09c8,_0x2d31a1,_0x2d767b){if(_0x2d31a1){_0x4a09c8[_0xb4b7('0x19')]=null;}if(_0x2d767b){_0x4a09c8[_0xb4b7('0x1a')]=![];}return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper['rescheduleContact'](_0x4a09c8))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0xb4b7('0x1b')]=function(_0x50363b){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper[_0xb4b7('0x1b')](_0x50363b))['catch'](loggerCatch(_0xb4b7('0x1c')));};exports[_0xb4b7('0x1d')]=function(_0x372a19){return BPromise['resolve']()[_0xb4b7('0xc')](cmHopper['unlockContact']({'UserId':null},_0x372a19,0x1))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0x1e')));};exports['disableContact']=function(_0x4a6662){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper['unlockContact']({'active':![]},_0x4a6662,0x1))['catch'](loggerCatch(_0xb4b7('0x1f')));};exports[_0xb4b7('0x20')]=function(_0x44a8a3){var _0x2acaa7={};_0x2acaa7['type']=_0x44a8a3[_0xb4b7('0x21')];_0x2acaa7[_0xb4b7('0x22')]=_0x44a8a3['uniqueid'];_0x2acaa7['calleridnum']=_0x44a8a3[_0xb4b7('0x23')];_0x2acaa7[_0xb4b7('0x24')]=_0x44a8a3['calleridname'];_0x2acaa7[_0xb4b7('0x25')]=_0x44a8a3[_0xb4b7('0x25')];_0x2acaa7[_0xb4b7('0x26')]=_0x44a8a3[_0xb4b7('0x27')];_0x2acaa7['queuecallerleaveAt']=_0x44a8a3[_0xb4b7('0x27')];_0x2acaa7[_0xb4b7('0x28')]=0x1;_0x2acaa7[_0xb4b7('0x29')]=_0x44a8a3[_0xb4b7('0x2a')];_0x2acaa7[_0xb4b7('0x2b')]=_0x44a8a3[_0xb4b7('0x2c')];_0x2acaa7[_0xb4b7('0x2d')]=_0xb4b7('0x2e');_0x2acaa7['exten']=_0xb4b7('0x2f');_0x2acaa7[_0xb4b7('0x30')]=0x0;_0x2acaa7[_0xb4b7('0x31')]=0x1;_0x2acaa7[_0xb4b7('0x32')]=_0x44a8a3[_0xb4b7('0x2c')];_0x2acaa7['queuecallerexitreason']=_0xb4b7('0x33');return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](voiceQueueReport['create'](_0x2acaa7))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0x34')));};exports['getContactRecallMe']=function(_0x14c99b,_0x520a2a){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper['getContactRecallMe'](_0x14c99b,_0x520a2a))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xb4b7('0x35')]=function(_0xdf742e){return BPromise[_0xb4b7('0xb')]()[_0xb4b7('0xc')](cmHopper[_0xb4b7('0x18')](_0xdf742e,!![],!![]))[_0xb4b7('0xe')](loggerCatch(_0xb4b7('0x36')));}; \ 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 3b9a349..f8da8cc 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 _0x92e1=['forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','endtime','statedesc','ringtime','starttime','membername','talktime','answertime','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','reachable','push','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countglobal','callbackuniqueid','callbackat','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','rtpaudioqosrttbridged','bridgepvtcallid','pow','replace','random','extractCalleridName','extractCalleridNumber','noanswer','variables'];(function(_0x575f10,_0x2da96a){var _0x1aa2fb=function(_0x420d93){while(--_0x420d93){_0x575f10['push'](_0x575f10['shift']());}};_0x1aa2fb(++_0x2da96a);}(_0x92e1,0x1c8));var _0x192e=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x92e1[_0x1abb09];return _0xea1c07;};'use strict';var util=require(_0x192e('0x0'));var _=require(_0x192e('0x1'));var moment=require(_0x192e('0x2'));var logger=require(_0x192e('0x3'))(_0x192e('0x4'));var ipAgi=process[_0x192e('0x5')][_0x192e('0x6')]||_0x192e('0x7');function getSeconds(_0x2b2fa1,_0x263e6e){var _0x351aab=moment(_0x2b2fa1)[_0x192e('0x8')](0x0);var _0x10efd1=moment(_0x263e6e)[_0x192e('0x8')](0x0);return _0x351aab[_0x192e('0x9')](_0x10efd1,_0x192e('0xa'));}exports[_0x192e('0xb')]=function(_0x4cdcb7){return function(_0x99bf41){logger[_0x192e('0xc')](_0x4cdcb7,util[_0x192e('0xd')](_0x99bf41,{'showHidden':![],'depth':null}));};};exports[_0x192e('0xe')]=function(_0x5ee574,_0x4a44a1){logger[_0x192e('0xf')](_0x5ee574,util[_0x192e('0xd')](_0x4a44a1,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x21d125,_0x30a7df){logger[_0x192e('0xc')](_0x21d125,util[_0x192e('0xd')](_0x30a7df,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x59fa48){return function(_0x53330d){logger[_0x192e('0xf')](_0x59fa48,util['inspect'](_0x53330d,{'showHidden':![],'depth':null}));};};exports[_0x192e('0x10')]=function(_0x1704ac,_0x167fca,_0x26ef3e){return{'message':_0x1704ac,'unlock':_0x167fca,'active':_0x26ef3e};};exports[_0x192e('0x11')]=function(_0x1308bf,_0x4c5fdd,_0x3824f1){if(!_[_0x192e('0x12')](_0x3824f1)&&_0x192e('0x13')===typeof _0x3824f1&&!_[_0x192e('0x14')](_0x3824f1)){if(!_[_0x192e('0x12')](_0x4c5fdd)&&_0x192e('0x13')===typeof _0x4c5fdd&&!_['isEmpty'](_0x4c5fdd)){return util[_0x192e('0x15')](_0x192e('0x16'),_0x4c5fdd,_0x3824f1);}return util[_0x192e('0x15')](_0x192e('0x16'),_0x3824f1,_0x3824f1);}if(!_['isUndefined'](_0x1308bf)&&_0x192e('0x13')===typeof _0x1308bf&&!_[_0x192e('0x14')](_0x1308bf)){return _0x1308bf;}return'\x22\x22\x20<>';};exports[_0x192e('0x17')]=function(_0x4977b){if(_[_0x192e('0x18')](_0x4977b)){return![];}return _0x4977b;};exports[_0x192e('0x19')]=function(_0x4436ce,_0x24abcf,_0x5362e0,_0x47bf95,_0x5e7092,_0x5c2b8b){var _0x9480d1={'XMD-QUEUE':_0x24abcf[_0x192e('0x1a')]?_0x24abcf[_0x192e('0x1a')][_0x192e('0x1b')]:'','XMD-CALLERID':_0x47bf95,'XMD-CALLERID-PREVIEW':_0x5c2b8b?util[_0x192e('0x15')](_0x192e('0x16'),_0x5c2b8b['calleridname'],_0x5c2b8b[_0x192e('0x1c')]):_0x47bf95,'XMD-DIALID':_0x5e7092,'XMD-CONTACTID':_0x24abcf[_0x192e('0x1d')],'XMD-CDRTYPE':_0x192e('0x1e'),'CALLERID(all)':_0x47bf95,'XMD-VOICEQUEUEID':_0x24abcf[_0x192e('0x1f')],'XMD-DIALCHANNEL':_0x5362e0,'XMD-DIALTIMEOUT':_0x4436ce[_0x192e('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x192e('0x15')](_0x192e('0x21'),_0x4436ce[_0x192e('0x22')]?'g':'',_[_0x192e('0x14')](_0x4436ce[_0x192e('0x23')])?'':_0x192e('0x24')),'XMD-DIALURL':_0x4436ce[_0x192e('0x25')]||'','XMD-AGI':_0x4436ce[_0x192e('0x26')]?util[_0x192e('0x15')](_0x192e('0x27'),ipAgi,_0x4436ce[_0x192e('0x26')]):'NONE','XMD-AGIAFTER':_0x4436ce[_0x192e('0x22')]?util[_0x192e('0x15')](_0x192e('0x27'),ipAgi,_0x4436ce[_0x192e('0x22')]):_0x192e('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x5c2b8b?_0x5c2b8b[_0x192e('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x5c2b8b?_0x5c2b8b[_0x192e('0x2a')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x192e('0x14')](_0x4436ce[_0x192e('0x23')])){_0x9480d1[util[_0x192e('0x15')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x4436ce[_0x192e('0x23')];_0x9480d1[util['format']('%s',_0x192e('0x2b'))]=_0x5e7092;}if(_0x24abcf&&_0x24abcf[_0x192e('0x2c')]){for(var _0x14388d in _0x24abcf[_0x192e('0x2c')]){if(_0x24abcf[_0x192e('0x2c')][_0x192e('0x2d')](_0x14388d)){if(!_[_0x192e('0x18')](_0x24abcf[_0x192e('0x2c')][_0x14388d])&&_0x14388d!=='id'&&_0x14388d!==_0x192e('0x2e')&&_0x14388d!==_0x192e('0x2f')&&_0x14388d!==_0x192e('0x30')){_0x9480d1[util[_0x192e('0x15')](_0x192e('0x31'),_0x192e('0x32'),_[_0x192e('0x33')](_0x14388d))]=_0x24abcf[_0x192e('0x2c')][_0x14388d];}}}}return _0x9480d1;};exports[_0x192e('0x34')]=function(_0xbb4103){var _0x47d7a3={};for(var _0x4b9b8e in _0xbb4103){if(_0xbb4103[_0x192e('0x2d')](_0x4b9b8e)){_0x47d7a3[util[_0x192e('0x15')]('%s',_[_0x192e('0x35')](_0x4b9b8e))]=_0xbb4103[_0x4b9b8e];}}return{'variables':_0x47d7a3};};exports[_0x192e('0x36')]=function(_0x2b3b34,_0x5335e8){if(!_[_0x192e('0x18')](_0x2b3b34)){if(_0x2b3b34[_0x192e('0x2d')]('originated')){if(_0x2b3b34[_0x192e('0x37')]>0x0){_0x2b3b34[_0x192e('0x37')]-=0x1;}else{logger[_0x192e('0xc')](_0x192e('0x38'),_0x5335e8);}}}else{logger['error'](_0x192e('0x39'),_0x5335e8);}};exports[_0x192e('0x3a')]=function(_0x41a236){var _0x61f1da=moment()[_0x192e('0x15')](_0x192e('0x3b'));_0x41a236[_0x192e('0x3c')]=0xd;_0x41a236['statedesc']=_0x192e('0x3d');_0x41a236['starttime']=_0x61f1da;_0x41a236[_0x192e('0x3e')]=_0x61f1da;_0x41a236[_0x192e('0x3f')]=_0x61f1da;};exports['logAgent']=function(_0xcedcb8,_0x53c5dd,_0x20cbf8){var _0x19e31c=moment()[_0x192e('0x15')](_0x192e('0x3b'));_0xcedcb8[_0x192e('0x3c')]=_0x53c5dd;_0xcedcb8[_0x192e('0x40')]=_0x20cbf8;_0xcedcb8[_0x192e('0x3e')]=_0x19e31c;_0xcedcb8[_0x192e('0x41')]=getSeconds(_0xcedcb8[_0x192e('0x3e')],_0xcedcb8[_0x192e('0x42')]);};exports['logLookAgent']=function(_0x59881b,_0x22602a,_0x110a93){_0x59881b[_0x192e('0x43')]=_0x22602a;_0x59881b['UserId']=_0x110a93;};exports['logCustomer']=function(_0x11e4e2,_0x4c92c4,_0x35d34f){var _0x1add7c=moment()[_0x192e('0x15')](_0x192e('0x3b'));_0x11e4e2[_0x192e('0x3c')]=_0x4c92c4;_0x11e4e2[_0x192e('0x40')]=_0x35d34f;_0x11e4e2[_0x192e('0x3e')]=_0x11e4e2[_0x192e('0x3e')]?_0x11e4e2[_0x192e('0x3e')]:_0x1add7c;_0x11e4e2[_0x192e('0x3f')]=_0x11e4e2['endtime']?_0x11e4e2[_0x192e('0x3f')]:_0x1add7c;_0x11e4e2[_0x192e('0x41')]=getSeconds(_0x11e4e2[_0x192e('0x3e')]||0x0,_0x11e4e2['starttime']||0x0);_0x11e4e2[_0x192e('0x44')]=_0x11e4e2['answertime']?getSeconds(_0x11e4e2[_0x192e('0x3f')],_0x11e4e2[_0x192e('0x45')]):0x0;};exports['isFailure']=function(_0x708884){return _0x708884==='Failure';};exports[_0x192e('0x46')]=function(_0x120e5d,_0xef1050,_0x22d869,_0x319d56,_0x3c8f36){var _0x4d04b2=_0x319d56?_0x192e('0x47'):_0x120e5d[_0x192e('0x48')];_0x4d04b2=_0x3c8f36?_0x192e('0x49'):_0x4d04b2;return{'actionid':_0x120e5d[_0x192e('0x4a')],'action':_0x192e('0x4b'),'channel':_0x120e5d[_0x192e('0x4c')],'callerid':util[_0x192e('0x15')](_0x192e('0x16'),_0x4d04b2,_0x120e5d[_0x192e('0x1c')]),'Exten':_0x192e('0x4d'),'Context':_0x192e('0x4e'),'Priority':'1','variable':_0x22d869,'timeout':(_0xef1050[_0x192e('0x4f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x120e5d['uniqueid']};};exports[_0x192e('0x50')]=function(_0x4ef64d){return _0x4ef64d[_0x192e('0x51')]+_0x4ef64d[_0x192e('0x52')]+_0x4ef64d[_0x192e('0x53')]+_0x4ef64d[_0x192e('0x54')]+_0x4ef64d[_0x192e('0x55')];};exports[_0x192e('0x56')]=function(_0x1533c9){var _0x24c1d4=_[_0x192e('0x57')](_0x1533c9);_0x24c1d4[_0x192e('0x3c')]=0xf;_0x24c1d4[_0x192e('0x40')]=_0x192e('0x58');return _0x24c1d4;};exports['scheduledAt']=function(_0xd088b9,_0x2c0b52,_0x35f71b){var _0x5c9b29={};_0x5c9b29[_0x2c0b52]=_0xd088b9[_0x2c0b52];_0x5c9b29[_0x192e('0x59')]=![];_0x5c9b29[_0x192e('0x5a')]=moment()['add'](_0x35f71b,_0x192e('0x5b'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5c9b29[_0x192e('0x1d')]=_0xd088b9[_0x192e('0x1d')];_0x5c9b29[_0x192e('0x5c')]=_0xd088b9[_0x192e('0x5c')];_0x5c9b29[_0x192e('0x1f')]=_0xd088b9[_0x192e('0x1f')]||undefined;return _0x5c9b29;};exports[_0x192e('0x5d')]=function(_0x4a9883,_0x46ef4c){if(!_['isNil'](_0x4a9883)){if(_0x4a9883['pTalking']>0x0){_0x4a9883[_0x192e('0x5e')]-=0x1;}else{logger[_0x192e('0xc')](_0x46ef4c,_0x192e('0x5f'));}}else{logger[_0x192e('0xc')](_0x46ef4c,_0x192e('0x60'));}};exports[_0x192e('0x61')]=function(_0x4f3f58){if(_0x4f3f58<=0x0){return!![];}return![];};function buildObj(_0x5dbe93,_0x8fe797,_0x9f806c){_0x5dbe93[_0x192e('0x62')]=_0x8fe797;_0x5dbe93[_0x192e('0x1b')]=_0x5dbe93[_0x192e('0x63')];_0x5dbe93[_0x192e('0x64')]=_0x5dbe93['channelAgent'];_0x5dbe93[_0x192e('0x65')]=_0x192e('0x66');if(_0x9f806c){_0x5dbe93['mandatoryDisposition']=_0x9f806c[_0x192e('0x67')];}return _0x5dbe93;}exports[_0x192e('0x68')]=buildObj;exports[_0x192e('0x69')]=function(_0x115f13){var _0xa09c0c={};_0xa09c0c['queue']=_0x115f13['queue'];_0xa09c0c['interface']=_0x115f13[_0x192e('0x4c')];_0xa09c0c[_0x192e('0x4a')]=_0x115f13['uniqueid'];return _0xa09c0c;};exports[_0x192e('0x6a')]=function(_0x56a51b){var _0x2c61b1=[];for(var _0x2ce32d in _0x56a51b){if(_0x56a51b[_0x192e('0x2d')](_0x2ce32d)){if(!_['isNil'](_0x56a51b[_0x2ce32d])&&_0x56a51b[_0x2ce32d]['state']===_0x192e('0x6b')&&_0x56a51b[_0x2ce32d][_0x192e('0x6c')]===_0x192e('0x6d')){_0x2c61b1[_0x192e('0x6e')](_0x56a51b[_0x2ce32d]['id']);}}}return _0x2c61b1;};exports['getDiff']=function(_0x2fd794){var _0x190a21=moment()[_0x192e('0x8')](0x0);var _0x44aeae=moment(_0x2fd794)[_0x192e('0x8')](0x0);return _0x190a21[_0x192e('0x9')](_0x44aeae,_0x192e('0xa'));};exports[_0x192e('0x6f')]=function(_0x129977){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x129977[_0x192e('0x1d')],'ListId':_0x129977[_0x192e('0x5c')],'VoiceQueueId':_0x129977[_0x192e('0x1f')]||undefined,'CampaignId':_0x129977[_0x192e('0x70')]||undefined};};exports[_0x192e('0x71')]=function(_0x4082e7){if(_0x4082e7===_0x192e('0x4a')||_0x4082e7===_0x192e('0x72')||_0x4082e7===_0x192e('0x63')||_0x4082e7==='type'||_0x4082e7===_0x192e('0x73')||_0x4082e7===_0x192e('0x74')||_0x4082e7===_0x192e('0x43')||_0x4082e7==='channelAgent'||_0x4082e7===_0x192e('0x48')||_0x4082e7==='active'||_0x4082e7==='calleridnum'||_0x4082e7===_0x192e('0x5a')||_0x4082e7===_0x192e('0x51')||_0x4082e7===_0x192e('0x52')||_0x4082e7===_0x192e('0x53')||_0x4082e7===_0x192e('0x75')||_0x4082e7==='callback'||_0x4082e7===_0x192e('0x76')||_0x4082e7===_0x192e('0x77')||_0x4082e7==='recallme'||_0x4082e7===_0x192e('0x1d')||_0x4082e7===_0x192e('0x5c')||_0x4082e7===_0x192e('0x78')||_0x4082e7===_0x192e('0x1f')||_0x4082e7===_0x192e('0x79')||_0x4082e7===_0x192e('0x7a')||_0x4082e7===_0x192e('0x7b')||_0x4082e7==='xmd-phone'||_0x4082e7===_0x192e('0x7c')||_0x4082e7===_0x192e('0x7d')||_0x4082e7===_0x192e('0x7e')||_0x4082e7===_0x192e('0x7f')||_0x4082e7==='xmd-dialid'||_0x4082e7===_0x192e('0x80')||_0x4082e7==='xmd-contactid'||_0x4082e7==='xmd-cdrtype'||_0x4082e7===_0x192e('0x81')||_0x4082e7===_0x192e('0x82')||_0x4082e7===_0x192e('0x83')||_0x4082e7==='rtpaudioqos'||_0x4082e7===_0x192e('0x84')||_0x4082e7===_0x192e('0x85')||_0x4082e7===_0x192e('0x86')||_0x4082e7===_0x192e('0x87')||_0x4082e7===_0x192e('0x88')||_0x4082e7===_0x192e('0x89')||_0x4082e7==='rtpaudioqosrttbridged'||_0x4082e7===_0x192e('0x8a')||_0x4082e7===_0x192e('0x84')||_0x4082e7===_0x192e('0x85')||_0x4082e7===_0x192e('0x86')||_0x4082e7===_0x192e('0x87')||_0x4082e7===_0x192e('0x88')||_0x4082e7===_0x192e('0x89')||_0x4082e7===_0x192e('0x8b')||_0x4082e7==='bridgepeer'||_0x4082e7===_0x192e('0x8c')||_0x4082e7===_0x192e('0x3c')||_0x4082e7==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x283158,_0xb7e887){var _0x21f13f,_0x540928,_0x1212e8;if(_0xb7e887<=0x0){_0xb7e887=0x1;}_0x21f13f=new RegExp('\x5cw{0,'+_0xb7e887+'}$');_0x540928=Math[_0x192e('0x8d')](0xa,_0xb7e887-0x1);_0x1212e8=Math[_0x192e('0x8d')](0xa,_0xb7e887)-0x1;return util[_0x192e('0x15')]('%s',_[_0x192e('0x8e')](_0x283158,_0x21f13f,_[_0x192e('0x8f')](_0x540928,_0x1212e8)));};exports[_0x192e('0x90')]=function(_0x9b4df2){var _0x135758=_0x9b4df2['match'](/"(.*?)"/);return _0x135758?_0x135758[0x1]:_0x9b4df2;};exports[_0x192e('0x91')]=function(_0x59435d){var _0x43c710=_0x59435d['match'](/<(.*?)>/);return _0x43c710?_0x43c710[0x1]:_0x59435d;};function buildNoAnswerEventPayload(_0x1bc56c,_0x512ffa){var _0x22959a=buildObj(_0x1bc56c,_0x192e('0x92'));if(!_['isEmpty'](_0x512ffa[_0x192e('0x93')])){Object['keys'](_0x512ffa[_0x192e('0x93')])[_0x192e('0x94')](function(_0x565e8f){_0x22959a[_0x565e8f[_0x192e('0x95')]()]=_0x512ffa[_0x192e('0x93')][_0x565e8f];});}return _0x22959a;}exports[_0x192e('0x96')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x82fb=['format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','logLookAgent','UserId','endtime','ringtime','talktime','answertime','Failure','BOOKED','uniqueid','from-sip','timeout','totalGlobal','countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','active','scheduledat','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','queue','voice','mandatoryDisposition','buildObj','buildAcw','interface','not_inuse','status','reachable','push','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','channelAgent','countcongestionretry','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty'];(function(_0x11471d,_0x47f2ad){var _0x197d16=function(_0x47a4a2){while(--_0x47a4a2){_0x11471d['push'](_0x11471d['shift']());}};_0x197d16(++_0x47f2ad);}(_0x82fb,0x194));var _0xb82f=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x82fb[_0x502c7d];return _0x30b7ed;};'use strict';var util=require(_0xb82f('0x0'));var _=require(_0xb82f('0x1'));var moment=require(_0xb82f('0x2'));var logger=require(_0xb82f('0x3'))(_0xb82f('0x4'));var ipAgi=process['env'][_0xb82f('0x5')]||_0xb82f('0x6');function getSeconds(_0x70e62d,_0x387ebb){var _0x33d7c8=moment(_0x70e62d)[_0xb82f('0x7')](0x0);var _0x37ad12=moment(_0x387ebb)[_0xb82f('0x7')](0x0);return _0x33d7c8[_0xb82f('0x8')](_0x37ad12,_0xb82f('0x9'));}exports[_0xb82f('0xa')]=function(_0xaca1f6){return function(_0x11b55b){logger[_0xb82f('0xb')](_0xaca1f6,util[_0xb82f('0xc')](_0x11b55b,{'showHidden':![],'depth':null}));};};exports[_0xb82f('0xd')]=function(_0x288035,_0x2f1121){logger[_0xb82f('0xe')](_0x288035,util[_0xb82f('0xc')](_0x2f1121,{'showHidden':![],'depth':null}));};exports[_0xb82f('0xf')]=function(_0x31ab13,_0x3c4201){logger[_0xb82f('0xb')](_0x31ab13,util[_0xb82f('0xc')](_0x3c4201,{'showHidden':![],'depth':null}));};exports[_0xb82f('0x10')]=function(_0xd883ed){return function(_0x3e9f87){logger[_0xb82f('0xe')](_0xd883ed,util[_0xb82f('0xc')](_0x3e9f87,{'showHidden':![],'depth':null}));};};exports[_0xb82f('0x11')]=function(_0x1a3686,_0x5697ad,_0x4a9c20){return{'message':_0x1a3686,'unlock':_0x5697ad,'active':_0x4a9c20};};exports[_0xb82f('0x12')]=function(_0x1afb4d,_0x1dd31e,_0x11bece){if(!_[_0xb82f('0x13')](_0x11bece)&&_0xb82f('0x14')===typeof _0x11bece&&!_[_0xb82f('0x15')](_0x11bece)){if(!_['isUndefined'](_0x1dd31e)&&_0xb82f('0x14')===typeof _0x1dd31e&&!_[_0xb82f('0x15')](_0x1dd31e)){return util[_0xb82f('0x16')](_0xb82f('0x17'),_0x1dd31e,_0x11bece);}return util[_0xb82f('0x16')](_0xb82f('0x17'),_0x11bece,_0x11bece);}if(!_[_0xb82f('0x13')](_0x1afb4d)&&_0xb82f('0x14')===typeof _0x1afb4d&&!_['isEmpty'](_0x1afb4d)){return _0x1afb4d;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x52a94d){if(_[_0xb82f('0x18')](_0x52a94d)){return![];}return _0x52a94d;};exports[_0xb82f('0x19')]=function(_0x39d68c,_0x8d0c8b,_0x3103eb,_0x54b96a,_0x44aa39,_0x125737){var _0x8913be={'XMD-QUEUE':_0x8d0c8b['Queue']?_0x8d0c8b[_0xb82f('0x1a')][_0xb82f('0x1b')]:'','XMD-CALLERID':_0x54b96a,'XMD-CALLERID-PREVIEW':_0x125737?util[_0xb82f('0x16')]('\x22%s\x22\x20<%s>',_0x125737['calleridname'],_0x125737[_0xb82f('0x1c')]):_0x54b96a,'XMD-DIALID':_0x44aa39,'XMD-CONTACTID':_0x8d0c8b[_0xb82f('0x1d')],'XMD-CDRTYPE':_0xb82f('0x1e'),'CALLERID(all)':_0x54b96a,'XMD-VOICEQUEUEID':_0x8d0c8b[_0xb82f('0x1f')],'XMD-DIALCHANNEL':_0x3103eb,'XMD-DIALTIMEOUT':_0x39d68c[_0xb82f('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0xb82f('0x16')](_0xb82f('0x21'),_0x39d68c[_0xb82f('0x22')]?'g':'',_[_0xb82f('0x15')](_0x39d68c[_0xb82f('0x23')])?'':_0xb82f('0x24')),'XMD-DIALURL':_0x39d68c[_0xb82f('0x25')]||'','XMD-AGI':_0x39d68c[_0xb82f('0x26')]?util[_0xb82f('0x16')](_0xb82f('0x27'),ipAgi,_0x39d68c[_0xb82f('0x26')]):_0xb82f('0x28'),'XMD-AGIAFTER':_0x39d68c['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x39d68c[_0xb82f('0x22')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x125737?_0x125737[_0xb82f('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x125737?_0x125737['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xb82f('0x2a')};if(!_[_0xb82f('0x15')](_0x39d68c[_0xb82f('0x23')])){_0x8913be[util[_0xb82f('0x16')]('%s',_0xb82f('0x2b'))]=_0x39d68c['monitor_format'];_0x8913be[util[_0xb82f('0x16')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x44aa39;}if(_0x8d0c8b&&_0x8d0c8b[_0xb82f('0x2c')]){for(var _0x1dd153 in _0x8d0c8b[_0xb82f('0x2c')]){if(_0x8d0c8b[_0xb82f('0x2c')][_0xb82f('0x2d')](_0x1dd153)){if(!_[_0xb82f('0x18')](_0x8d0c8b['Contact'][_0x1dd153])&&_0x1dd153!=='id'&&_0x1dd153!==_0xb82f('0x2e')&&_0x1dd153!==_0xb82f('0x2f')&&_0x1dd153!==_0xb82f('0x30')){_0x8913be[util[_0xb82f('0x16')]('%s%s','XMD-',_['toUpper'](_0x1dd153))]=_0x8d0c8b[_0xb82f('0x2c')][_0x1dd153];}}}}return _0x8913be;};exports['toLowerVariables']=function(_0x541d45){var _0x3c0ec2={};for(var _0x2093f8 in _0x541d45){if(_0x541d45[_0xb82f('0x2d')](_0x2093f8)){_0x3c0ec2[util[_0xb82f('0x16')]('%s',_['toLower'](_0x2093f8))]=_0x541d45[_0x2093f8];}}return{'variables':_0x3c0ec2};};exports[_0xb82f('0x31')]=function(_0x207002,_0x9f4892){if(!_['isNil'](_0x207002)){if(_0x207002[_0xb82f('0x2d')]('originated')){if(_0x207002[_0xb82f('0x32')]>0x0){_0x207002[_0xb82f('0x32')]-=0x1;}else{logger[_0xb82f('0xb')](_0xb82f('0x33'),_0x9f4892);}}}else{logger['error'](_0xb82f('0x34'),_0x9f4892);}};exports[_0xb82f('0x35')]=function(_0x135d62){var _0x4a1126=moment()[_0xb82f('0x16')](_0xb82f('0x36'));_0x135d62[_0xb82f('0x37')]=0xd;_0x135d62[_0xb82f('0x38')]='Blacklist';_0x135d62[_0xb82f('0x39')]=_0x4a1126;_0x135d62[_0xb82f('0x3a')]=_0x4a1126;_0x135d62['endtime']=_0x4a1126;};exports['logAgent']=function(_0x4a00aa,_0x7a291a,_0x22ee03){var _0x19e2ed=moment()['format'](_0xb82f('0x36'));_0x4a00aa[_0xb82f('0x37')]=_0x7a291a;_0x4a00aa[_0xb82f('0x38')]=_0x22ee03;_0x4a00aa['responsetime']=_0x19e2ed;_0x4a00aa['ringtime']=getSeconds(_0x4a00aa['responsetime'],_0x4a00aa[_0xb82f('0x39')]);};exports[_0xb82f('0x3b')]=function(_0x44c7b9,_0x26f914,_0x1a0efa){_0x44c7b9['membername']=_0x26f914;_0x44c7b9[_0xb82f('0x3c')]=_0x1a0efa;};exports['logCustomer']=function(_0x2d1e87,_0x433ed6,_0x4f313b){var _0x5c3565=moment()[_0xb82f('0x16')](_0xb82f('0x36'));_0x2d1e87[_0xb82f('0x37')]=_0x433ed6;_0x2d1e87['statedesc']=_0x4f313b;_0x2d1e87[_0xb82f('0x3a')]=_0x2d1e87[_0xb82f('0x3a')]?_0x2d1e87[_0xb82f('0x3a')]:_0x5c3565;_0x2d1e87[_0xb82f('0x3d')]=_0x2d1e87[_0xb82f('0x3d')]?_0x2d1e87[_0xb82f('0x3d')]:_0x5c3565;_0x2d1e87[_0xb82f('0x3e')]=getSeconds(_0x2d1e87['responsetime']||0x0,_0x2d1e87[_0xb82f('0x39')]||0x0);_0x2d1e87[_0xb82f('0x3f')]=_0x2d1e87['answertime']?getSeconds(_0x2d1e87[_0xb82f('0x3d')],_0x2d1e87[_0xb82f('0x40')]):0x0;};exports['isFailure']=function(_0x220eae){return _0x220eae===_0xb82f('0x41');};exports['variablesAction']=function(_0x41407a,_0x15ed9c,_0x22341e,_0x1bacc0,_0x54945c){var _0x29fa3a=_0x1bacc0?'RECALL':_0x41407a['calleridname'];_0x29fa3a=_0x54945c?_0xb82f('0x42'):_0x29fa3a;return{'actionid':_0x41407a[_0xb82f('0x43')],'action':'originate','channel':_0x41407a['channelAgent'],'callerid':util[_0xb82f('0x16')](_0xb82f('0x17'),_0x29fa3a,_0x41407a[_0xb82f('0x1c')]),'Exten':'xcally-motion-preview','Context':_0xb82f('0x44'),'Priority':'1','variable':_0x22341e,'timeout':(_0x15ed9c[_0xb82f('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x41407a[_0xb82f('0x43')]};};exports[_0xb82f('0x46')]=function(_0x377f4c){return _0x377f4c[_0xb82f('0x47')]+_0x377f4c['countcongestionretry']+_0x377f4c[_0xb82f('0x48')]+_0x377f4c[_0xb82f('0x49')]+_0x377f4c[_0xb82f('0x4a')];};exports[_0xb82f('0x4b')]=function(_0x1729f3){var _0x41a8d0=_['clone'](_0x1729f3);_0x41a8d0[_0xb82f('0x37')]=0xf;_0x41a8d0['statedesc']=_0xb82f('0x4c');return _0x41a8d0;};exports['scheduledAt']=function(_0x2c7e0a,_0x532963,_0x2402bf){var _0x119a55={};_0x119a55[_0x532963]=_0x2c7e0a[_0x532963];_0x119a55[_0xb82f('0x4d')]=![];_0x119a55[_0xb82f('0x4e')]=moment()['add'](_0x2402bf,_0xb82f('0x4f'))[_0xb82f('0x16')](_0xb82f('0x36'));_0x119a55[_0xb82f('0x1d')]=_0x2c7e0a[_0xb82f('0x1d')];_0x119a55[_0xb82f('0x50')]=_0x2c7e0a['ListId'];_0x119a55[_0xb82f('0x1f')]=_0x2c7e0a[_0xb82f('0x1f')]||undefined;return _0x119a55;};exports['decrementTalkink']=function(_0x28009d,_0x1cc914){if(!_[_0xb82f('0x18')](_0x28009d)){if(_0x28009d[_0xb82f('0x51')]>0x0){_0x28009d[_0xb82f('0x51')]-=0x1;}else{logger[_0xb82f('0xb')](_0x1cc914,_0xb82f('0x52'));}}else{logger[_0xb82f('0xb')](_0x1cc914,_0xb82f('0x53'));}};exports['IsNotLoggedIn']=function(_0x37239d){if(_0x37239d<=0x0){return!![];}return![];};function buildObj(_0x353972,_0x11f4e5,_0x29110f){_0x353972[_0xb82f('0x54')]=_0x11f4e5;_0x353972[_0xb82f('0x1b')]=_0x353972[_0xb82f('0x55')];_0x353972['interface']=_0x353972['channelAgent'];_0x353972['motionChannel']=_0xb82f('0x56');if(_0x29110f){_0x353972['mandatoryDisposition']=_0x29110f[_0xb82f('0x57')];}return _0x353972;}exports[_0xb82f('0x58')]=buildObj;exports[_0xb82f('0x59')]=function(_0x37cf97){var _0x43c949={};_0x43c949['queue']=_0x37cf97[_0xb82f('0x55')];_0x43c949[_0xb82f('0x5a')]=_0x37cf97['channelAgent'];_0x43c949[_0xb82f('0x43')]=_0x37cf97[_0xb82f('0x43')];return _0x43c949;};exports['agentReadyId']=function(_0x527d88){var _0x1b474b=[];for(var _0x534427 in _0x527d88){if(_0x527d88[_0xb82f('0x2d')](_0x534427)){if(!_[_0xb82f('0x18')](_0x527d88[_0x534427])&&_0x527d88[_0x534427]['state']===_0xb82f('0x5b')&&_0x527d88[_0x534427][_0xb82f('0x5c')]===_0xb82f('0x5d')){_0x1b474b[_0xb82f('0x5e')](_0x527d88[_0x534427]['id']);}}}return _0x1b474b;};exports[_0xb82f('0x5f')]=function(_0x4d7a27){var _0x260f93=moment()[_0xb82f('0x7')](0x0);var _0x5ae9d8=moment(_0x4d7a27)[_0xb82f('0x7')](0x0);return _0x260f93[_0xb82f('0x8')](_0x5ae9d8,_0xb82f('0x9'));};exports[_0xb82f('0x60')]=function(_0x369f44){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x369f44[_0xb82f('0x1d')],'ListId':_0x369f44[_0xb82f('0x50')],'VoiceQueueId':_0x369f44['VoiceQueueId']||undefined,'CampaignId':_0x369f44[_0xb82f('0x61')]||undefined};};exports[_0xb82f('0x62')]=function(_0x137e81){if(_0x137e81===_0xb82f('0x43')||_0x137e81===_0xb82f('0x63')||_0x137e81===_0xb82f('0x55')||_0x137e81===_0xb82f('0x64')||_0x137e81===_0xb82f('0x65')||_0x137e81===_0xb82f('0x66')||_0x137e81===_0xb82f('0x67')||_0x137e81===_0xb82f('0x68')||_0x137e81==='calleridname'||_0x137e81==='active'||_0x137e81===_0xb82f('0x1c')||_0x137e81===_0xb82f('0x4e')||_0x137e81===_0xb82f('0x47')||_0x137e81===_0xb82f('0x69')||_0x137e81==='countnoanswerretry'||_0x137e81===_0xb82f('0x6a')||_0x137e81===_0xb82f('0x6b')||_0x137e81===_0xb82f('0x6c')||_0x137e81==='callbackat'||_0x137e81===_0xb82f('0x6d')||_0x137e81===_0xb82f('0x1d')||_0x137e81===_0xb82f('0x50')||_0x137e81==='UserId'||_0x137e81==='VoiceQueueId'||_0x137e81===_0xb82f('0x6e')||_0x137e81===_0xb82f('0x6f')||_0x137e81===_0xb82f('0x70')||_0x137e81===_0xb82f('0x71')||_0x137e81==='xmd-listid'||_0x137e81===_0xb82f('0x72')||_0x137e81==='xmd-dialtimeout'||_0x137e81==='xmd-dialoptions'||_0x137e81===_0xb82f('0x73')||_0x137e81==='xmd-dialchannel'||_0x137e81===_0xb82f('0x74')||_0x137e81===_0xb82f('0x75')||_0x137e81===_0xb82f('0x76')||_0x137e81===_0xb82f('0x77')||_0x137e81==='xmd-agi'||_0x137e81===_0xb82f('0x78')||_0x137e81===_0xb82f('0x79')||_0x137e81===_0xb82f('0x7a')||_0x137e81===_0xb82f('0x7b')||_0x137e81==='rtpaudioqosloss'||_0x137e81===_0xb82f('0x7c')||_0x137e81==='rtpaudioqosrtt'||_0x137e81===_0xb82f('0x7d')||_0x137e81==='rtpaudioqos'||_0x137e81===_0xb82f('0x79')||_0x137e81===_0xb82f('0x7a')||_0x137e81===_0xb82f('0x7b')||_0x137e81===_0xb82f('0x7e')||_0x137e81===_0xb82f('0x7c')||_0x137e81===_0xb82f('0x7f')||_0x137e81==='rtpaudioqosrttbridged'||_0x137e81===_0xb82f('0x80')||_0x137e81==='bridgepvtcallid'||_0x137e81==='state'||_0x137e81===_0xb82f('0x38')){return![];}return!![];};exports[_0xb82f('0x81')]=function(_0x47e408,_0xdb5b7b){var _0x339ebf,_0x1870ae,_0xdcf83b;if(_0xdb5b7b<=0x0){_0xdb5b7b=0x1;}_0x339ebf=new RegExp(_0xb82f('0x82')+_0xdb5b7b+'}$');_0x1870ae=Math['pow'](0xa,_0xdb5b7b-0x1);_0xdcf83b=Math[_0xb82f('0x83')](0xa,_0xdb5b7b)-0x1;return util[_0xb82f('0x16')]('%s',_['replace'](_0x47e408,_0x339ebf,_[_0xb82f('0x84')](_0x1870ae,_0xdcf83b)));};exports[_0xb82f('0x85')]=function(_0x33b329){var _0x18268a=_0x33b329[_0xb82f('0x86')](/"(.*?)"/);return _0x18268a?_0x18268a[0x1]:_0x33b329;};exports[_0xb82f('0x87')]=function(_0xd5afb7){var _0x3d8b5c=_0xd5afb7[_0xb82f('0x86')](/<(.*?)>/);return _0x3d8b5c?_0x3d8b5c[0x1]:_0xd5afb7;};function buildNoAnswerEventPayload(_0xeb082f,_0x4354b2){var _0x2315ab=buildObj(_0xeb082f,_0xb82f('0x88'));if(!_[_0xb82f('0x15')](_0x4354b2[_0xb82f('0x89')])){Object[_0xb82f('0x8a')](_0x4354b2[_0xb82f('0x89')])[_0xb82f('0x8b')](function(_0x9df1d9){_0x2315ab[_0x9df1d9[_0xb82f('0x8c')]()]=_0x4354b2[_0xb82f('0x89')][_0x9df1d9];});}return _0x2315ab;}exports[_0xb82f('0x8d')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8fda93f..d7c13d7 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 _0x8f19=['string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8f19,0xb3));var _0x98f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f19[_0x3dd15e];return _0x231fd0;};'use strict';exports[_0x98f1('0x0')]={'queue':{'type':_0x98f1('0x1'),'required':!![]},'interface':{'type':_0x98f1('0x1'),'required':!![]},'membername':{'type':_0x98f1('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x98f1('0x2'),'required':![]}};exports[_0x98f1('0x3')]={'queue':{'type':_0x98f1('0x1'),'required':!![]},'interface':{'type':_0x98f1('0x1'),'required':!![]}};exports[_0x98f1('0x4')]={'interface':{'type':_0x98f1('0x1'),'required':!![]},'paused':{'type':_0x98f1('0x2')},'reason':{'type':_0x98f1('0x1'),'required':![]}};exports[_0x98f1('0x5')]={'module':{'type':_0x98f1('0x1'),'required':![]}};exports[_0x98f1('0x6')]={'uniqueid':{'type':_0x98f1('0x1'),'required':!![]}};exports[_0x98f1('0x7')]={'uniqueid':{'type':_0x98f1('0x1'),'required':!![]},'filename':{'type':_0x98f1('0x1')},'format':{'type':_0x98f1('0x1')},'mixmonitorid':{'type':'string'}};exports[_0x98f1('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x98f1('0x9')]={'uniqueid':{'type':_0x98f1('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x98f1('0x1')}}; \ No newline at end of file +var _0x9237=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queuepause'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x9237,0x149));var _0x7923=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x9237[_0x3f0b30];return _0x2748a5;};'use strict';exports[_0x7923('0x0')]={'queue':{'type':_0x7923('0x1'),'required':!![]},'interface':{'type':_0x7923('0x1'),'required':!![]},'membername':{'type':_0x7923('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x7923('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0x7923('0x1'),'required':!![]},'interface':{'type':_0x7923('0x1'),'required':!![]}};exports[_0x7923('0x3')]={'interface':{'type':_0x7923('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0x7923('0x1'),'required':![]}};exports[_0x7923('0x4')]={'module':{'type':_0x7923('0x1'),'required':![]}};exports[_0x7923('0x5')]={'uniqueid':{'type':_0x7923('0x1'),'required':!![]}};exports[_0x7923('0x6')]={'uniqueid':{'type':_0x7923('0x1'),'required':!![]},'filename':{'type':_0x7923('0x1')},'format':{'type':_0x7923('0x1')},'mixmonitorid':{'type':_0x7923('0x1')}};exports[_0x7923('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x7923('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x7923('0x1'),'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 79fcf5d..1c86cc4 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 _0xf47e=['initFaxAccounts','faxAccounts','exports','util','lodash','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','settings','salesforceAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','format','SIP/%s','name','isNil','interface','hasOwnProperty','total','sumHoldTime','sumDuration','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','isUndefined','initTelephones','length','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','deskAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallercomplete','answered','sumBillable','initVoiceCallReports','duration','disposition','billableseconds','SquareProject','initVoiceExtensions','initCampaignHopperHistory'];(function(_0x2b8e40,_0x1087af){var _0x874dd7=function(_0x59e68f){while(--_0x59e68f){_0x2b8e40['push'](_0x2b8e40['shift']());}};_0x874dd7(++_0x1087af);}(_0xf47e,0x1bf));var _0xef47=function(_0x48cf46,_0x319824){_0x48cf46=_0x48cf46-0x0;var _0x39984e=_0xf47e[_0x48cf46];return _0x39984e;};'use strict';var util=require(_0xef47('0x0'));var _=require(_0xef47('0x1'));var moment=require('moment');var Agent=require(_0xef47('0x2'));var Telephone=require(_0xef47('0x3'));var Trunk=require(_0xef47('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xef47('0x5'));var Template=require(_0xef47('0x6'));var Campaign=require(_0xef47('0x7'));var VoiceExtension=require(_0xef47('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xef47('0x9'));var FreshdeskAccount=require(_0xef47('0xa'));var SugarcrmAccount=require(_0xef47('0xb'));var ZohoAccount=require(_0xef47('0xc'));var DeskAccount=require(_0xef47('0xd'));var VtigerAccount=require(_0xef47('0xe'));var ServicenowAccount=require(_0xef47('0xf'));var Dynamics365Account=require(_0xef47('0x10'));var FreshsalesAccount=require(_0xef47('0x11'));var FaxAccount=require(_0xef47('0x12'));var Realtime=function(){this[_0xef47('0x13')]={};this[_0xef47('0x14')]={};this[_0xef47('0x15')]={};this[_0xef47('0x16')]={};this[_0xef47('0x17')]={};this[_0xef47('0x18')]={};this[_0xef47('0x19')]={};this[_0xef47('0x1a')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xef47('0x1b')]={};this[_0xef47('0x1c')]={};this[_0xef47('0x1d')]={};this['outboundChannels']={};this['timers']={};this[_0xef47('0x1e')]={};this['zendeskAccounts']={};this[_0xef47('0x1f')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xef47('0x20')]={};this[_0xef47('0x21')]={};this[_0xef47('0x22')]={};this[_0xef47('0x23')]={};this['faxAccounts']={};};function freeIsNotKey(_0x11fff1,_0x47f249,_0x3ed50a){var _0x5cda37=_['mapKeys'](_0x11fff1,function(_0x151902,_0x3370a0){return _0x151902[_0x3ed50a];});for(var _0x53c355 in _0x47f249){if(_0x47f249['hasOwnProperty'](_0x53c355)){if(!_0x5cda37[_0x53c355]){delete _0x47f249[_0x53c355];}}}}function freeIsNotKeySip(_0x366bcc,_0x4d61c6){var _0x544224=_[_0xef47('0x24')](_0x366bcc,function(_0x59ecc8,_0x58e502){return util[_0xef47('0x25')](_0xef47('0x26'),_0x59ecc8[_0xef47('0x27')]);});for(var _0x521426 in _0x4d61c6){if(_0x4d61c6['hasOwnProperty'](_0x521426)){if(!_0x544224[_0x521426]){delete _0x4d61c6[_0x521426];}}}}function freeIsNotKeyAgent(_0x43000a,_0x36592a){var _0x5813a2=_[_0xef47('0x24')](_0x43000a,function(_0x4186f0,_0x395bd3){var _0x36cd70=_[_0xef47('0x28')](_0x4186f0['interface'])?util[_0xef47('0x25')]('SIP/%s',_0x4186f0[_0xef47('0x27')]):_0x4186f0[_0xef47('0x29')];return _0x36cd70;});for(var _0x11931d in _0x36592a){if(_0x36592a[_0xef47('0x2a')](_0x11931d)){if(!_0x5813a2[_0x11931d]){delete _0x36592a[_0x11931d];}}}}function clearVoiceCallReports(_0x2468fe){_0x2468fe[_0xef47('0x2b')]=0x0;_0x2468fe['answered']=0x0;_0x2468fe[_0xef47('0x2c')]=0x0;_0x2468fe[_0xef47('0x2d')]=0x0;_0x2468fe['sumBillable']=0x0;}function clearCampaigns(_0x36e441){if(!_['isEmpty'](_0x36e441)){for(var _0x4c56e4 in _0x36e441){if(_0x36e441['hasOwnProperty'](_0x4c56e4)){_0x36e441[_0x4c56e4][_0xef47('0x2e')]=0x0;_0x36e441[_0x4c56e4][_0xef47('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x50b018){if(!_['isEmpty'](_0x50b018)){for(var _0x307856 in _0x50b018){if(_0x50b018[_0xef47('0x2a')](_0x307856)){_0x50b018[_0x307856][_0xef47('0x2b')]=0x0;_0x50b018[_0x307856]['answered']=0x0;_0x50b018[_0x307856][_0xef47('0x30')]=0x0;_0x50b018[_0x307856][_0xef47('0x31')]=0x0;_0x50b018[_0x307856][_0xef47('0x2c')]=0x0;_0x50b018[_0x307856][_0xef47('0x2d')]=0x0;_0x50b018[_0x307856]['sumBillable']=0x0;_0x50b018[_0x307856][_0xef47('0x32')]=0x0;_0x50b018[_0x307856][_0xef47('0x33')]=0x0;_0x50b018[_0x307856][_0xef47('0x34')]=0x0;_0x50b018[_0x307856][_0xef47('0x35')]=0x0;_0x50b018[_0x307856][_0xef47('0x36')]=0x0;_0x50b018[_0x307856][_0xef47('0x37')]=0x0;_0x50b018[_0x307856][_0xef47('0x38')]=0x0;_0x50b018[_0x307856]['outboundDropCallsDayCallersExit']=0x0;_0x50b018[_0x307856][_0xef47('0x39')]=0x0;_0x50b018[_0x307856][_0xef47('0x3a')]=0x0;_0x50b018[_0x307856]['outboundRejectCallsDay']=0x0;_0x50b018[_0x307856][_0xef47('0x3b')]=0x0;_0x50b018[_0x307856][_0xef47('0x32')]=0x0;_0x50b018[_0x307856][_0xef47('0x3c')]=0x0;_0x50b018[_0x307856][_0xef47('0x3d')]=!![];}}}}Realtime[_0xef47('0x3e')][_0xef47('0x3f')]=function(_0x5db33a,_0x57984a){for(var _0x5dbc49 in _0x57984a){if(_0x5db33a[_0xef47('0x2a')](_0x5dbc49)){_0x5db33a[_0x5dbc49]=_0x57984a[_0x5dbc49];}}};Realtime[_0xef47('0x3e')][_0xef47('0x40')]=function(){var _0x23e87e=this;return function(_0x98f373){if(_0x98f373){freeIsNotKeyAgent(_0x98f373,_0x23e87e[_0xef47('0x13')]);for(var _0x555d71=0x0,_0x1c7fcd={},_0xee780f={};_0x555d71<_0x98f373['length'];_0x555d71+=0x1){_0x1c7fcd=_0x98f373[_0x555d71];var _0x1067d5=_[_0xef47('0x28')](_0x1c7fcd['interface'])?util['format']('SIP/%s',_0x1c7fcd[_0xef47('0x27')]):_0x1c7fcd[_0xef47('0x29')];if(_[_0xef47('0x41')](_0x23e87e[_0xef47('0x13')][_0x1067d5])){_0x23e87e[_0xef47('0x13')][_0x1067d5]=new Agent(_0x1c7fcd);}else{_0x23e87e[_0xef47('0x3f')](_0x23e87e[_0xef47('0x13')][_0x1067d5],_0x1c7fcd);}}}return _0x23e87e[_0xef47('0x13')];};};Realtime[_0xef47('0x3e')][_0xef47('0x42')]=function(){var _0xa23e3d=this;return function(_0x1bd222){if(_0x1bd222){freeIsNotKeySip(_0x1bd222,_0xa23e3d[_0xef47('0x14')]);for(var _0x5b9f40=0x0,_0x4e5fe1={},_0x535ed3={};_0x5b9f40<_0x1bd222[_0xef47('0x43')];_0x5b9f40+=0x1){_0x4e5fe1=_0x1bd222[_0x5b9f40];if(_['isUndefined'](_0xa23e3d[_0xef47('0x14')][util[_0xef47('0x25')](_0xef47('0x26'),_0x4e5fe1[_0xef47('0x27')])])){_0xa23e3d['telephones'][util['format'](_0xef47('0x26'),_0x4e5fe1[_0xef47('0x27')])]=new Telephone(_0x4e5fe1);}else{_0xa23e3d[_0xef47('0x3f')](_0xa23e3d[_0xef47('0x14')][util['format'](_0xef47('0x26'),_0x4e5fe1['name'])],_0x4e5fe1);}}}return _0xa23e3d[_0xef47('0x14')];};};Realtime['prototype'][_0xef47('0x44')]=function(){var _0x5a0077=this;return function(_0x5a3848){if(_0x5a3848){freeIsNotKeySip(_0x5a3848,_0x5a0077['trunks']);for(var _0x424cd7=0x0,_0x5e47cc={},_0x2d9a05={};_0x424cd7<_0x5a3848[_0xef47('0x43')];_0x424cd7+=0x1){_0x5e47cc=_0x5a3848[_0x424cd7];if(_[_0xef47('0x41')](_0x5a0077[_0xef47('0x15')][util[_0xef47('0x25')](_0xef47('0x26'),_0x5e47cc['name'])])){_0x5a0077['trunks'][util[_0xef47('0x25')](_0xef47('0x26'),_0x5e47cc[_0xef47('0x27')])]=new Trunk(_0x5e47cc);}else{_0x5a0077['mergeFromDatabase'](_0x5a0077[_0xef47('0x15')][util[_0xef47('0x25')](_0xef47('0x26'),_0x5e47cc[_0xef47('0x27')])],_0x5e47cc);}}}return _0x5a0077[_0xef47('0x15')];};};Realtime['prototype'][_0xef47('0x45')]=function(){var _0x283f78=this;return function(_0x48258d){if(_0x48258d){freeIsNotKey(_0x48258d,_0x283f78[_0xef47('0x16')],_0xef47('0x27'));for(var _0x6e5b02=0x0,_0x51f9ed={},_0x53a3e1={};_0x6e5b02<_0x48258d[_0xef47('0x43')];_0x6e5b02+=0x1){_0x51f9ed=_0x48258d[_0x6e5b02];if(_[_0xef47('0x41')](_0x283f78[_0xef47('0x16')][_0x51f9ed[_0xef47('0x27')]])){_0x283f78[_0xef47('0x16')][_0x51f9ed[_0xef47('0x27')]]=new VoiceQueue(_0x51f9ed);}else{_0x283f78['mergeFromDatabase'](_0x283f78[_0xef47('0x16')][_0x51f9ed[_0xef47('0x27')]],_0x51f9ed);}}}return _0x283f78[_0xef47('0x16')];};};Realtime[_0xef47('0x3e')][_0xef47('0x46')]=function(){var _0x3e17c9=this;return function(_0x41b0f8){if(_0x41b0f8){freeIsNotKey(_0x41b0f8,_0x3e17c9[_0xef47('0x17')],'id');for(var _0xe0b0f=0x0,_0x1991c8={},_0x46b9e3={};_0xe0b0f<_0x41b0f8[_0xef47('0x43')];_0xe0b0f+=0x1){_0x1991c8=_0x41b0f8[_0xe0b0f];if(_['isUndefined'](_0x3e17c9['triggers'][_0x1991c8['id']])){_0x3e17c9[_0xef47('0x17')][_0x1991c8['id']]=new Trigger(_0x1991c8);}else{_0x3e17c9[_0xef47('0x3f')](_0x3e17c9[_0xef47('0x17')][_0x1991c8['id']],_0x1991c8);}}}return _0x3e17c9[_0xef47('0x17')];};};Realtime[_0xef47('0x3e')][_0xef47('0x47')]=function(){var _0x31ca33=this;return function(_0x4eea53){if(_0x4eea53){freeIsNotKey(_0x4eea53,_0x31ca33[_0xef47('0x19')],'id');for(var _0x182fb1=0x0,_0x469af3={},_0x11d476={};_0x182fb1<_0x4eea53[_0xef47('0x43')];_0x182fb1+=0x1){_0x469af3=_0x4eea53[_0x182fb1];if(_[_0xef47('0x41')](_0x31ca33[_0xef47('0x19')][_0x469af3['id']])){_0x31ca33[_0xef47('0x19')][_0x469af3['id']]=new Template(_0x469af3);}else{_0x31ca33[_0xef47('0x3f')](_0x31ca33[_0xef47('0x19')][_0x469af3['id']],_0x469af3);}}}return _0x31ca33[_0xef47('0x19')];};};Realtime[_0xef47('0x3e')][_0xef47('0x48')]=function(){var _0x3ba8bc=this;return function(_0x405636){if(_0x405636){freeIsNotKey(_0x405636,_0x3ba8bc[_0xef47('0x49')],'id');for(var _0x444d57=0x0,_0x2d6469={},_0x219b4f={};_0x444d57<_0x405636['length'];_0x444d57+=0x1){_0x2d6469=_0x405636[_0x444d57];if(_['isUndefined'](_0x3ba8bc[_0xef47('0x49')][_0x2d6469['id']])){_0x3ba8bc['zendeskAccounts'][_0x2d6469['id']]=new ZendeskAccount(_0x2d6469);}else{_0x3ba8bc[_0xef47('0x3f')](_0x3ba8bc['zendeskAccounts'][_0x2d6469['id']],_0x2d6469);}}}return _0x3ba8bc['zendeskAccounts'];};};Realtime[_0xef47('0x3e')][_0xef47('0x4a')]=function(){var _0x1709d0=this;return function(_0x523f0f){if(_0x523f0f){freeIsNotKey(_0x523f0f,_0x1709d0[_0xef47('0x1f')],'id');for(var _0x4b3d86=0x0,_0x36ac07={},_0x4252d3={};_0x4b3d86<_0x523f0f['length'];_0x4b3d86+=0x1){_0x36ac07=_0x523f0f[_0x4b3d86];if(_[_0xef47('0x41')](_0x1709d0[_0xef47('0x1f')][_0x36ac07['id']])){_0x1709d0[_0xef47('0x1f')][_0x36ac07['id']]=new SalesforceAccount(_0x36ac07);}else{_0x1709d0[_0xef47('0x3f')](_0x1709d0[_0xef47('0x1f')][_0x36ac07['id']],_0x36ac07);}}}return _0x1709d0['salesforceAccounts'];};};Realtime[_0xef47('0x3e')]['initFreshdeskAccounts']=function(){var _0xdcd0ea=this;return function(_0x46dfb8){if(_0x46dfb8){freeIsNotKey(_0x46dfb8,_0xdcd0ea['freshdeskAccounts'],'id');for(var _0x3bdd25=0x0,_0x530eaa={},_0x426f3e={};_0x3bdd25<_0x46dfb8[_0xef47('0x43')];_0x3bdd25+=0x1){_0x530eaa=_0x46dfb8[_0x3bdd25];if(_[_0xef47('0x41')](_0xdcd0ea[_0xef47('0x4b')][_0x530eaa['id']])){_0xdcd0ea[_0xef47('0x4b')][_0x530eaa['id']]=new FreshdeskAccount(_0x530eaa);}else{_0xdcd0ea[_0xef47('0x3f')](_0xdcd0ea[_0xef47('0x4b')][_0x530eaa['id']],_0x530eaa);}}}return _0xdcd0ea[_0xef47('0x4b')];};};Realtime['prototype'][_0xef47('0x4c')]=function(){var _0x4bd165=this;return function(_0x513281){if(_0x513281){freeIsNotKey(_0x513281,_0x4bd165[_0xef47('0x4d')],'id');for(var _0x3a0f3d=0x0,_0x58e8f8={},_0x4e4a41={};_0x3a0f3d<_0x513281[_0xef47('0x43')];_0x3a0f3d+=0x1){_0x58e8f8=_0x513281[_0x3a0f3d];if(_[_0xef47('0x41')](_0x4bd165[_0xef47('0x4d')][_0x58e8f8['id']])){_0x4bd165[_0xef47('0x4d')][_0x58e8f8['id']]=new ZohoAccount(_0x58e8f8);}else{_0x4bd165[_0xef47('0x3f')](_0x4bd165[_0xef47('0x4d')][_0x58e8f8['id']],_0x58e8f8);}}}return _0x4bd165[_0xef47('0x4d')];};};Realtime[_0xef47('0x3e')][_0xef47('0x4e')]=function(){var _0x2f5b5a=this;return function(_0x46cc64){if(_0x46cc64){freeIsNotKey(_0x46cc64,_0x2f5b5a[_0xef47('0x4f')],'id');for(var _0x109ff2=0x0,_0x3aeb85={},_0x2ff96a={};_0x109ff2<_0x46cc64['length'];_0x109ff2+=0x1){_0x3aeb85=_0x46cc64[_0x109ff2];if(_[_0xef47('0x41')](_0x2f5b5a[_0xef47('0x4f')][_0x3aeb85['id']])){_0x2f5b5a[_0xef47('0x4f')][_0x3aeb85['id']]=new DeskAccount(_0x3aeb85);}else{_0x2f5b5a[_0xef47('0x3f')](_0x2f5b5a['deskAccounts'][_0x3aeb85['id']],_0x3aeb85);}}}return _0x2f5b5a[_0xef47('0x4f')];};};Realtime[_0xef47('0x3e')]['initSugarcrmAccounts']=function(){var _0x431ecb=this;return function(_0x4fcb07){if(_0x4fcb07){freeIsNotKey(_0x4fcb07,_0x431ecb['sugarcrmAccounts'],'id');for(var _0x403230=0x0,_0x2ba8d3={},_0x7b412={};_0x403230<_0x4fcb07[_0xef47('0x43')];_0x403230+=0x1){_0x2ba8d3=_0x4fcb07[_0x403230];if(_['isUndefined'](_0x431ecb[_0xef47('0x50')][_0x2ba8d3['id']])){_0x431ecb[_0xef47('0x50')][_0x2ba8d3['id']]=new SugarcrmAccount(_0x2ba8d3);}else{_0x431ecb[_0xef47('0x3f')](_0x431ecb[_0xef47('0x50')][_0x2ba8d3['id']],_0x2ba8d3);}}}return _0x431ecb[_0xef47('0x50')];};};Realtime[_0xef47('0x3e')][_0xef47('0x51')]=function(){var _0x34f36a=this;return function(_0x57056f){if(_0x57056f){freeIsNotKey(_0x57056f,_0x34f36a[_0xef47('0x20')],'id');for(var _0x488383=0x0,_0x36eda2={},_0x18cd0a={};_0x488383<_0x57056f[_0xef47('0x43')];_0x488383+=0x1){_0x36eda2=_0x57056f[_0x488383];if(_[_0xef47('0x41')](_0x34f36a[_0xef47('0x20')][_0x36eda2['id']])){_0x34f36a[_0xef47('0x20')][_0x36eda2['id']]=new VtigerAccount(_0x36eda2);}else{_0x34f36a[_0xef47('0x3f')](_0x34f36a[_0xef47('0x20')][_0x36eda2['id']],_0x36eda2);}}}return _0x34f36a[_0xef47('0x20')];};};Realtime[_0xef47('0x3e')][_0xef47('0x52')]=function(){var _0x4ab4f1=this;return function(_0x4ea398){if(_0x4ea398){freeIsNotKey(_0x4ea398,_0x4ab4f1[_0xef47('0x21')],'id');for(var _0x460514=0x0,_0x12a61f={},_0x2ab34b={};_0x460514<_0x4ea398[_0xef47('0x43')];_0x460514+=0x1){_0x12a61f=_0x4ea398[_0x460514];if(_[_0xef47('0x41')](_0x4ab4f1['servicenowAccounts'][_0x12a61f['id']])){_0x4ab4f1[_0xef47('0x21')][_0x12a61f['id']]=new ServicenowAccount(_0x12a61f);}else{_0x4ab4f1[_0xef47('0x3f')](_0x4ab4f1[_0xef47('0x21')][_0x12a61f['id']],_0x12a61f);}}}return _0x4ab4f1[_0xef47('0x21')];};};Realtime[_0xef47('0x3e')][_0xef47('0x53')]=function(){var _0x3c1e13=this;return function(_0x4f1c0f){if(_0x4f1c0f){freeIsNotKey(_0x4f1c0f,_0x3c1e13[_0xef47('0x22')],'id');for(var _0x8b30ec=0x0,_0x289cf4={},_0x349d1a={};_0x8b30ec<_0x4f1c0f[_0xef47('0x43')];_0x8b30ec+=0x1){_0x289cf4=_0x4f1c0f[_0x8b30ec];if(_[_0xef47('0x41')](_0x3c1e13[_0xef47('0x22')][_0x289cf4['id']])){_0x3c1e13['dynamics365Accounts'][_0x289cf4['id']]=new Dynamics365Account(_0x289cf4);}else{_0x3c1e13[_0xef47('0x3f')](_0x3c1e13['dynamics365Accounts'][_0x289cf4['id']],_0x289cf4);}}}return _0x3c1e13['dynamics365Accounts'];};};Realtime[_0xef47('0x3e')][_0xef47('0x54')]=function(){var _0x573db6=this;return function(_0x40b234){if(_0x40b234){freeIsNotKey(_0x40b234,_0x573db6['freshsalesAccounts'],'id');for(var _0x117d49=0x0,_0x4f3a7d={},_0x567b1e={};_0x117d49<_0x40b234[_0xef47('0x43')];_0x117d49+=0x1){_0x4f3a7d=_0x40b234[_0x117d49];if(_[_0xef47('0x41')](_0x573db6[_0xef47('0x23')][_0x4f3a7d['id']])){_0x573db6['freshsalesAccounts'][_0x4f3a7d['id']]=new FreshsalesAccount(_0x4f3a7d);}else{_0x573db6[_0xef47('0x3f')](_0x573db6[_0xef47('0x23')][_0x4f3a7d['id']],_0x4f3a7d);}}}return _0x573db6['freshsalesAccounts'];};};Realtime['prototype'][_0xef47('0x55')]=function(){var _0x52e799=this;return function(_0x46c6ac){for(var _0x500fb2=0x0;_0x500fb2<_0x46c6ac[_0xef47('0x43')];_0x500fb2+=0x1){_[_0xef47('0x56')](_0x52e799[_0xef47('0x16')][_0x46c6ac[_0x500fb2][_0xef47('0x27')]],_0x46c6ac[_0x500fb2]);}return _0x52e799[_0xef47('0x16')];};};Realtime['prototype'][_0xef47('0x57')]=function(){var _0x2a8366=this;return function(_0x4e2c7f){clearVoiceQueues(_0x2a8366[_0xef47('0x16')]);if(_0x4e2c7f){_0x4e2c7f=_['groupBy'](_0x4e2c7f,_0xef47('0x58'));for(var _0x113baf in _0x4e2c7f){if(_0x4e2c7f[_0xef47('0x2a')](_0x113baf)){var _0x5ab3d0={};for(var _0x5ac971=0x0;_0x5ac971<_0x4e2c7f[_0x113baf]['length'];_0x5ac971+=0x1){var _0x309338=_0x4e2c7f[_0x113baf][_0x5ac971][_0xef47('0x59')];if(_0x2a8366[_0xef47('0x16')][_0x309338]){if(_0x4e2c7f[_0x113baf][_0x5ac971][_0xef47('0x5a')]){_0x2a8366['voiceQueues'][_0x309338][_0xef47('0x30')]+=0x1;}if(_0x4e2c7f[_0x113baf][_0x5ac971][_0xef47('0x5b')]){_0x2a8366['voiceQueues'][_0x309338]['abandoned']+=0x1;}_0x2a8366[_0xef47('0x16')][_0x309338][_0xef47('0x2c')]+=moment(_0x4e2c7f[_0x113baf][_0x5ac971][_0xef47('0x5c')])[_0xef47('0x5d')](moment(_0x4e2c7f[_0x113baf][_0x5ac971][_0xef47('0x5e')]),_0xef47('0x5f'))||0x0;if(_0x5ac971===_0x4e2c7f[_0x113baf][_0xef47('0x43')]-0x1){_0x2a8366[_0xef47('0x16')][_0x309338][_0xef47('0x2d')]+=moment(_0x4e2c7f[_0x113baf][_0x5ac971][_0xef47('0x60')]||_0x4e2c7f[_0x113baf][_0x5ac971][_0xef47('0x61')]||_0x4e2c7f[_0x113baf][_0x5ac971]['queuecallerexitAt'])['diff'](moment(_0x4e2c7f[_0x113baf][_0x5ac971][_0xef47('0x5e')]),'seconds')||0x0;_0x2a8366[_0xef47('0x16')][_0x309338][_0xef47('0x2b')]+=0x1;if(_0x4e2c7f[_0x113baf][_0x5ac971][_0xef47('0x62')]){_0x2a8366[_0xef47('0x16')][_0x309338][_0xef47('0x63')]+=0x1;_0x2a8366[_0xef47('0x16')][_0x309338][_0xef47('0x64')]+=moment(_0x4e2c7f[_0x113baf][_0x5ac971][_0xef47('0x60')])[_0xef47('0x5d')](moment(_0x4e2c7f[_0x113baf][_0x5ac971][_0xef47('0x5c')]),_0xef47('0x5f'))||0x0;}}else{_0x2a8366[_0xef47('0x16')][_0x309338][_0xef47('0x2d')]+=_0x2a8366[_0xef47('0x16')][_0x309338]['sumHoldTime']||0x0;}}}}}}return _0x2a8366[_0xef47('0x16')];};};Realtime[_0xef47('0x3e')][_0xef47('0x65')]=function(){var _0x130ea5=this;return function(_0x4563ac){clearVoiceCallReports(_0x130ea5['outbound']);if(_0x4563ac){for(var _0x1902ec=0x0;_0x1902ec<_0x4563ac[_0xef47('0x43')];_0x1902ec+=0x1){_0x130ea5[_0xef47('0x1a')]['total']+=0x1;_0x130ea5[_0xef47('0x1a')]['sumDuration']+=_0x4563ac[_0x1902ec][_0xef47('0x66')];if(_0x4563ac[_0x1902ec][_0xef47('0x67')]==='ANSWERED'){_0x130ea5[_0xef47('0x1a')]['answered']+=0x1;_0x130ea5[_0xef47('0x1a')]['sumHoldTime']+=_0x4563ac[_0x1902ec][_0xef47('0x66')]-_0x4563ac[_0x1902ec][_0xef47('0x68')]||0x0;_0x130ea5[_0xef47('0x1a')][_0xef47('0x64')]+=_0x4563ac[_0x1902ec][_0xef47('0x68')];}}}return _0x130ea5[_0xef47('0x1a')];};};Realtime[_0xef47('0x3e')]['initCampaigns']=function(){var _0x4cdf41=this;return function(_0x39e029){if(_0x39e029){freeIsNotKey(_0x39e029,_0x4cdf41[_0xef47('0x18')],'name');for(var _0x57d576=0x0,_0x410bf5={};_0x57d576<_0x39e029[_0xef47('0x43')];_0x57d576+=0x1){_0x410bf5=_0x39e029[_0x57d576];if(_[_0xef47('0x41')](_0x4cdf41[_0xef47('0x18')][_0x410bf5['name']])){_0x4cdf41['campaigns'][_0x410bf5[_0xef47('0x27')]]=new Campaign(_0x410bf5);}else{_0x4cdf41[_0xef47('0x3f')](_0x4cdf41[_0xef47('0x18')][_0x410bf5[_0xef47('0x27')]],_0x410bf5);_0x4cdf41['campaigns'][_0x410bf5[_0xef47('0x27')]]['dialQueueProject']=_0x410bf5[_0xef47('0x69')]?_0x410bf5[_0xef47('0x69')][_0xef47('0x27')]:undefined;}}}return _0x4cdf41[_0xef47('0x18')];};};Realtime[_0xef47('0x3e')][_0xef47('0x6a')]=function(){var _0x387eb9=this;return function(_0x398114){if(_0x398114){freeIsNotKey(_0x398114,_0x387eb9['voiceExtensions'],'id');for(var _0x385842=0x0,_0x306f2a={};_0x385842<_0x398114[_0xef47('0x43')];_0x385842+=0x1){_0x306f2a=_0x398114[_0x385842];if(_[_0xef47('0x41')](_0x387eb9[_0xef47('0x1b')][_0x306f2a['id']])){_0x387eb9[_0xef47('0x1b')][_0x306f2a['id']]=new VoiceExtension(_0x306f2a);}else{_0x387eb9[_0xef47('0x3f')](_0x387eb9['voiceExtensions'][_0x306f2a['id']],_0x306f2a);}}}return _0x387eb9[_0xef47('0x1b')];};};Realtime['prototype'][_0xef47('0x6b')]=function(){var _0x521012=this;return function(_0x4e36c6){clearCampaigns(_0x521012[_0xef47('0x18')]);for(var _0x3402d6=0x0;_0x3402d6<_0x4e36c6[_0xef47('0x43')];_0x3402d6+=0x1){_[_0xef47('0x56')](_0x521012[_0xef47('0x18')][_0x4e36c6[_0x3402d6][_0xef47('0x27')]],_0x4e36c6[_0x3402d6]);}return _0x521012[_0xef47('0x18')];};};Realtime[_0xef47('0x3e')][_0xef47('0x6c')]=function(){var _0x29f734=this;return function(_0x3cdc82){if(_0x3cdc82){freeIsNotKey(_0x3cdc82,_0x29f734[_0xef47('0x6d')],'id');for(var _0xb8a584=0x0,_0xc966e7={},_0x4acbb1={};_0xb8a584<_0x3cdc82[_0xef47('0x43')];_0xb8a584+=0x1){_0xc966e7=_0x3cdc82[_0xb8a584];if(_[_0xef47('0x41')](_0x29f734[_0xef47('0x6d')][_0xc966e7['id']])){_0x29f734[_0xef47('0x6d')][_0xc966e7['id']]=new FaxAccount(_0xc966e7);}else{_0x29f734['mergeFromDatabase'](_0x29f734['faxAccounts'][_0xc966e7['id']],_0xc966e7);}}}return _0x29f734[_0xef47('0x6d')];};};module[_0xef47('0x6e')]=Realtime; \ No newline at end of file +var _0x0f9f=['SIP/%s','isNil','format','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','prototype','mergeFromDatabase','length','name','isUndefined','initTelephones','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','initVoiceCallReports','duration','disposition','ANSWERED','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','freshdeskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty'];(function(_0x1b7875,_0x3a95ef){var _0x522377=function(_0x42325c){while(--_0x42325c){_0x1b7875['push'](_0x1b7875['shift']());}};_0x522377(++_0x3a95ef);}(_0x0f9f,0xae));var _0xf0f9=function(_0x2420bd,_0xb58e4e){_0x2420bd=_0x2420bd-0x0;var _0x5610b8=_0x0f9f[_0x2420bd];return _0x5610b8;};'use strict';var util=require(_0xf0f9('0x0'));var _=require(_0xf0f9('0x1'));var moment=require(_0xf0f9('0x2'));var Agent=require(_0xf0f9('0x3'));var Telephone=require(_0xf0f9('0x4'));var Trunk=require(_0xf0f9('0x5'));var VoiceQueue=require(_0xf0f9('0x6'));var Trigger=require(_0xf0f9('0x7'));var Template=require(_0xf0f9('0x8'));var Campaign=require(_0xf0f9('0x9'));var VoiceExtension=require(_0xf0f9('0xa'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xf0f9('0xb'));var FreshdeskAccount=require(_0xf0f9('0xc'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xf0f9('0xd'));var DeskAccount=require(_0xf0f9('0xe'));var VtigerAccount=require(_0xf0f9('0xf'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xf0f9('0x10'));var FreshsalesAccount=require(_0xf0f9('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xf0f9('0x12')]={};this[_0xf0f9('0x13')]={};this[_0xf0f9('0x14')]={};this[_0xf0f9('0x15')]={};this[_0xf0f9('0x16')]={};this[_0xf0f9('0x17')]={};this[_0xf0f9('0x18')]={};this[_0xf0f9('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf0f9('0x1a')]={};this[_0xf0f9('0x1b')]={};this[_0xf0f9('0x1c')]={};this[_0xf0f9('0x1d')]={};this['settings']={};this[_0xf0f9('0x1e')]={};this[_0xf0f9('0x1f')]={};this['sugarcrmAccounts']={};this[_0xf0f9('0x20')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0xf0f9('0x21')]={};this['servicenowAccounts']={};this[_0xf0f9('0x22')]={};this['freshsalesAccounts']={};this[_0xf0f9('0x23')]={};};function freeIsNotKey(_0x336483,_0x1a3a82,_0xf4d805){var _0x236cbd=_[_0xf0f9('0x24')](_0x336483,function(_0x10dae6,_0x50d462){return _0x10dae6[_0xf4d805];});for(var _0x44d248 in _0x1a3a82){if(_0x1a3a82[_0xf0f9('0x25')](_0x44d248)){if(!_0x236cbd[_0x44d248]){delete _0x1a3a82[_0x44d248];}}}}function freeIsNotKeySip(_0x43de16,_0x28cc18){var _0x3dc0e3=_[_0xf0f9('0x24')](_0x43de16,function(_0x1765ad,_0x46db47){return util['format'](_0xf0f9('0x26'),_0x1765ad['name']);});for(var _0x3664ff in _0x28cc18){if(_0x28cc18['hasOwnProperty'](_0x3664ff)){if(!_0x3dc0e3[_0x3664ff]){delete _0x28cc18[_0x3664ff];}}}}function freeIsNotKeyAgent(_0x3f4f97,_0x1d5965){var _0x1d90ad=_[_0xf0f9('0x24')](_0x3f4f97,function(_0xaff53c,_0x1b9740){var _0x49bddc=_[_0xf0f9('0x27')](_0xaff53c['interface'])?util[_0xf0f9('0x28')](_0xf0f9('0x26'),_0xaff53c['name']):_0xaff53c[_0xf0f9('0x29')];return _0x49bddc;});for(var _0x20b5dc in _0x1d5965){if(_0x1d5965['hasOwnProperty'](_0x20b5dc)){if(!_0x1d90ad[_0x20b5dc]){delete _0x1d5965[_0x20b5dc];}}}}function clearVoiceCallReports(_0xbbccd9){_0xbbccd9[_0xf0f9('0x2a')]=0x0;_0xbbccd9[_0xf0f9('0x2b')]=0x0;_0xbbccd9[_0xf0f9('0x2c')]=0x0;_0xbbccd9[_0xf0f9('0x2d')]=0x0;_0xbbccd9[_0xf0f9('0x2e')]=0x0;}function clearCampaigns(_0x4c7c7c){if(!_[_0xf0f9('0x2f')](_0x4c7c7c)){for(var _0x4c31f2 in _0x4c7c7c){if(_0x4c7c7c[_0xf0f9('0x25')](_0x4c31f2)){_0x4c7c7c[_0x4c31f2][_0xf0f9('0x30')]=0x0;_0x4c7c7c[_0x4c31f2][_0xf0f9('0x31')]=0x0;}}}}function clearVoiceQueues(_0x14e40f){if(!_['isEmpty'](_0x14e40f)){for(var _0x100543 in _0x14e40f){if(_0x14e40f[_0xf0f9('0x25')](_0x100543)){_0x14e40f[_0x100543][_0xf0f9('0x2a')]=0x0;_0x14e40f[_0x100543]['answered']=0x0;_0x14e40f[_0x100543][_0xf0f9('0x32')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x33')]=0x0;_0x14e40f[_0x100543]['sumHoldTime']=0x0;_0x14e40f[_0x100543][_0xf0f9('0x2d')]=0x0;_0x14e40f[_0x100543]['sumBillable']=0x0;_0x14e40f[_0x100543][_0xf0f9('0x34')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x35')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x36')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x37')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x38')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x39')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x3a')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x3b')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x3c')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x3d')]=0x0;_0x14e40f[_0x100543]['outboundRejectCallsDay']=0x0;_0x14e40f[_0x100543][_0xf0f9('0x3e')]=0x0;_0x14e40f[_0x100543][_0xf0f9('0x34')]=0x0;_0x14e40f[_0x100543]['outboundAnswerCallsDay']=0x0;_0x14e40f[_0x100543]['queueStatusComplete']=!![];}}}}Realtime[_0xf0f9('0x3f')][_0xf0f9('0x40')]=function(_0x3ca015,_0x39f6ed){for(var _0xb54f98 in _0x39f6ed){if(_0x3ca015[_0xf0f9('0x25')](_0xb54f98)){_0x3ca015[_0xb54f98]=_0x39f6ed[_0xb54f98];}}};Realtime[_0xf0f9('0x3f')]['initAgents']=function(){var _0x2733e8=this;return function(_0x51a9d6){if(_0x51a9d6){freeIsNotKeyAgent(_0x51a9d6,_0x2733e8[_0xf0f9('0x12')]);for(var _0x3a2fcc=0x0,_0x232561={},_0x555130={};_0x3a2fcc<_0x51a9d6[_0xf0f9('0x41')];_0x3a2fcc+=0x1){_0x232561=_0x51a9d6[_0x3a2fcc];var _0x559498=_[_0xf0f9('0x27')](_0x232561['interface'])?util['format'](_0xf0f9('0x26'),_0x232561[_0xf0f9('0x42')]):_0x232561[_0xf0f9('0x29')];if(_[_0xf0f9('0x43')](_0x2733e8[_0xf0f9('0x12')][_0x559498])){_0x2733e8[_0xf0f9('0x12')][_0x559498]=new Agent(_0x232561);}else{_0x2733e8['mergeFromDatabase'](_0x2733e8['agents'][_0x559498],_0x232561);}}}return _0x2733e8[_0xf0f9('0x12')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x44')]=function(){var _0x55d3a3=this;return function(_0x5b478b){if(_0x5b478b){freeIsNotKeySip(_0x5b478b,_0x55d3a3[_0xf0f9('0x13')]);for(var _0x56832a=0x0,_0x101b93={},_0x2d74bd={};_0x56832a<_0x5b478b[_0xf0f9('0x41')];_0x56832a+=0x1){_0x101b93=_0x5b478b[_0x56832a];if(_[_0xf0f9('0x43')](_0x55d3a3['telephones'][util[_0xf0f9('0x28')](_0xf0f9('0x26'),_0x101b93[_0xf0f9('0x42')])])){_0x55d3a3[_0xf0f9('0x13')][util['format']('SIP/%s',_0x101b93['name'])]=new Telephone(_0x101b93);}else{_0x55d3a3[_0xf0f9('0x40')](_0x55d3a3[_0xf0f9('0x13')][util[_0xf0f9('0x28')](_0xf0f9('0x26'),_0x101b93[_0xf0f9('0x42')])],_0x101b93);}}}return _0x55d3a3[_0xf0f9('0x13')];};};Realtime[_0xf0f9('0x3f')]['initTrunks']=function(){var _0x39a255=this;return function(_0x472264){if(_0x472264){freeIsNotKeySip(_0x472264,_0x39a255[_0xf0f9('0x14')]);for(var _0x2b06a4=0x0,_0x2ee60e={},_0x2bfa1d={};_0x2b06a4<_0x472264['length'];_0x2b06a4+=0x1){_0x2ee60e=_0x472264[_0x2b06a4];if(_[_0xf0f9('0x43')](_0x39a255['trunks'][util[_0xf0f9('0x28')](_0xf0f9('0x26'),_0x2ee60e[_0xf0f9('0x42')])])){_0x39a255[_0xf0f9('0x14')][util[_0xf0f9('0x28')]('SIP/%s',_0x2ee60e[_0xf0f9('0x42')])]=new Trunk(_0x2ee60e);}else{_0x39a255['mergeFromDatabase'](_0x39a255[_0xf0f9('0x14')][util[_0xf0f9('0x28')](_0xf0f9('0x26'),_0x2ee60e[_0xf0f9('0x42')])],_0x2ee60e);}}}return _0x39a255[_0xf0f9('0x14')];};};Realtime[_0xf0f9('0x3f')]['initVoiceQueues']=function(){var _0x1a4939=this;return function(_0x344d0b){if(_0x344d0b){freeIsNotKey(_0x344d0b,_0x1a4939[_0xf0f9('0x15')],'name');for(var _0x161f45=0x0,_0x4fa0a1={},_0xcb8767={};_0x161f45<_0x344d0b['length'];_0x161f45+=0x1){_0x4fa0a1=_0x344d0b[_0x161f45];if(_['isUndefined'](_0x1a4939['voiceQueues'][_0x4fa0a1['name']])){_0x1a4939[_0xf0f9('0x15')][_0x4fa0a1['name']]=new VoiceQueue(_0x4fa0a1);}else{_0x1a4939[_0xf0f9('0x40')](_0x1a4939[_0xf0f9('0x15')][_0x4fa0a1['name']],_0x4fa0a1);}}}return _0x1a4939[_0xf0f9('0x15')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x45')]=function(){var _0x2789c6=this;return function(_0x21b236){if(_0x21b236){freeIsNotKey(_0x21b236,_0x2789c6['triggers'],'id');for(var _0x1a5353=0x0,_0x9f839c={},_0x10c9b0={};_0x1a5353<_0x21b236[_0xf0f9('0x41')];_0x1a5353+=0x1){_0x9f839c=_0x21b236[_0x1a5353];if(_['isUndefined'](_0x2789c6[_0xf0f9('0x16')][_0x9f839c['id']])){_0x2789c6[_0xf0f9('0x16')][_0x9f839c['id']]=new Trigger(_0x9f839c);}else{_0x2789c6[_0xf0f9('0x40')](_0x2789c6[_0xf0f9('0x16')][_0x9f839c['id']],_0x9f839c);}}}return _0x2789c6[_0xf0f9('0x16')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x46')]=function(){var _0x299cec=this;return function(_0x248dd2){if(_0x248dd2){freeIsNotKey(_0x248dd2,_0x299cec[_0xf0f9('0x18')],'id');for(var _0x1dcb00=0x0,_0x6514f={},_0x499129={};_0x1dcb00<_0x248dd2[_0xf0f9('0x41')];_0x1dcb00+=0x1){_0x6514f=_0x248dd2[_0x1dcb00];if(_[_0xf0f9('0x43')](_0x299cec[_0xf0f9('0x18')][_0x6514f['id']])){_0x299cec['templates'][_0x6514f['id']]=new Template(_0x6514f);}else{_0x299cec[_0xf0f9('0x40')](_0x299cec[_0xf0f9('0x18')][_0x6514f['id']],_0x6514f);}}}return _0x299cec[_0xf0f9('0x18')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x47')]=function(){var _0x214439=this;return function(_0x177d56){if(_0x177d56){freeIsNotKey(_0x177d56,_0x214439[_0xf0f9('0x1e')],'id');for(var _0x4ea226=0x0,_0x850e62={},_0x14280e={};_0x4ea226<_0x177d56['length'];_0x4ea226+=0x1){_0x850e62=_0x177d56[_0x4ea226];if(_[_0xf0f9('0x43')](_0x214439[_0xf0f9('0x1e')][_0x850e62['id']])){_0x214439[_0xf0f9('0x1e')][_0x850e62['id']]=new ZendeskAccount(_0x850e62);}else{_0x214439[_0xf0f9('0x40')](_0x214439['zendeskAccounts'][_0x850e62['id']],_0x850e62);}}}return _0x214439[_0xf0f9('0x1e')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x48')]=function(){var _0x4cacda=this;return function(_0x1c7c33){if(_0x1c7c33){freeIsNotKey(_0x1c7c33,_0x4cacda['salesforceAccounts'],'id');for(var _0x34d364=0x0,_0x6ea364={},_0x364333={};_0x34d364<_0x1c7c33[_0xf0f9('0x41')];_0x34d364+=0x1){_0x6ea364=_0x1c7c33[_0x34d364];if(_[_0xf0f9('0x43')](_0x4cacda['salesforceAccounts'][_0x6ea364['id']])){_0x4cacda[_0xf0f9('0x1f')][_0x6ea364['id']]=new SalesforceAccount(_0x6ea364);}else{_0x4cacda[_0xf0f9('0x40')](_0x4cacda[_0xf0f9('0x1f')][_0x6ea364['id']],_0x6ea364);}}}return _0x4cacda[_0xf0f9('0x1f')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x49')]=function(){var _0xef3fc4=this;return function(_0x296ad9){if(_0x296ad9){freeIsNotKey(_0x296ad9,_0xef3fc4[_0xf0f9('0x20')],'id');for(var _0x266cca=0x0,_0x59b700={},_0x3cbc15={};_0x266cca<_0x296ad9['length'];_0x266cca+=0x1){_0x59b700=_0x296ad9[_0x266cca];if(_[_0xf0f9('0x43')](_0xef3fc4[_0xf0f9('0x20')][_0x59b700['id']])){_0xef3fc4[_0xf0f9('0x20')][_0x59b700['id']]=new FreshdeskAccount(_0x59b700);}else{_0xef3fc4['mergeFromDatabase'](_0xef3fc4[_0xf0f9('0x20')][_0x59b700['id']],_0x59b700);}}}return _0xef3fc4[_0xf0f9('0x20')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x4a')]=function(){var _0x320b39=this;return function(_0x5d150a){if(_0x5d150a){freeIsNotKey(_0x5d150a,_0x320b39[_0xf0f9('0x4b')],'id');for(var _0x24e31f=0x0,_0xf49044={},_0x228d12={};_0x24e31f<_0x5d150a['length'];_0x24e31f+=0x1){_0xf49044=_0x5d150a[_0x24e31f];if(_[_0xf0f9('0x43')](_0x320b39[_0xf0f9('0x4b')][_0xf49044['id']])){_0x320b39['zohoAccounts'][_0xf49044['id']]=new ZohoAccount(_0xf49044);}else{_0x320b39['mergeFromDatabase'](_0x320b39[_0xf0f9('0x4b')][_0xf49044['id']],_0xf49044);}}}return _0x320b39[_0xf0f9('0x4b')];};};Realtime[_0xf0f9('0x3f')]['initDeskAccounts']=function(){var _0x3abb24=this;return function(_0x27175a){if(_0x27175a){freeIsNotKey(_0x27175a,_0x3abb24[_0xf0f9('0x4c')],'id');for(var _0x31cfd0=0x0,_0x464ee7={},_0x189c7a={};_0x31cfd0<_0x27175a[_0xf0f9('0x41')];_0x31cfd0+=0x1){_0x464ee7=_0x27175a[_0x31cfd0];if(_[_0xf0f9('0x43')](_0x3abb24[_0xf0f9('0x4c')][_0x464ee7['id']])){_0x3abb24[_0xf0f9('0x4c')][_0x464ee7['id']]=new DeskAccount(_0x464ee7);}else{_0x3abb24[_0xf0f9('0x40')](_0x3abb24[_0xf0f9('0x4c')][_0x464ee7['id']],_0x464ee7);}}}return _0x3abb24[_0xf0f9('0x4c')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x4d')]=function(){var _0x2e172e=this;return function(_0x50ddb6){if(_0x50ddb6){freeIsNotKey(_0x50ddb6,_0x2e172e['sugarcrmAccounts'],'id');for(var _0x1f6c19=0x0,_0x3e9756={},_0x4efd30={};_0x1f6c19<_0x50ddb6['length'];_0x1f6c19+=0x1){_0x3e9756=_0x50ddb6[_0x1f6c19];if(_[_0xf0f9('0x43')](_0x2e172e['sugarcrmAccounts'][_0x3e9756['id']])){_0x2e172e[_0xf0f9('0x4e')][_0x3e9756['id']]=new SugarcrmAccount(_0x3e9756);}else{_0x2e172e[_0xf0f9('0x40')](_0x2e172e[_0xf0f9('0x4e')][_0x3e9756['id']],_0x3e9756);}}}return _0x2e172e['sugarcrmAccounts'];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x4f')]=function(){var _0x377589=this;return function(_0x258c9f){if(_0x258c9f){freeIsNotKey(_0x258c9f,_0x377589[_0xf0f9('0x21')],'id');for(var _0x2ca137=0x0,_0x3700e0={},_0x5b3ffc={};_0x2ca137<_0x258c9f[_0xf0f9('0x41')];_0x2ca137+=0x1){_0x3700e0=_0x258c9f[_0x2ca137];if(_['isUndefined'](_0x377589['vtigerAccounts'][_0x3700e0['id']])){_0x377589[_0xf0f9('0x21')][_0x3700e0['id']]=new VtigerAccount(_0x3700e0);}else{_0x377589[_0xf0f9('0x40')](_0x377589[_0xf0f9('0x21')][_0x3700e0['id']],_0x3700e0);}}}return _0x377589['vtigerAccounts'];};};Realtime[_0xf0f9('0x3f')]['initServicenowAccounts']=function(){var _0xcf32fa=this;return function(_0x72f66d){if(_0x72f66d){freeIsNotKey(_0x72f66d,_0xcf32fa[_0xf0f9('0x50')],'id');for(var _0x3c7eda=0x0,_0x59313e={},_0x2759d3={};_0x3c7eda<_0x72f66d[_0xf0f9('0x41')];_0x3c7eda+=0x1){_0x59313e=_0x72f66d[_0x3c7eda];if(_[_0xf0f9('0x43')](_0xcf32fa[_0xf0f9('0x50')][_0x59313e['id']])){_0xcf32fa[_0xf0f9('0x50')][_0x59313e['id']]=new ServicenowAccount(_0x59313e);}else{_0xcf32fa[_0xf0f9('0x40')](_0xcf32fa[_0xf0f9('0x50')][_0x59313e['id']],_0x59313e);}}}return _0xcf32fa[_0xf0f9('0x50')];};};Realtime[_0xf0f9('0x3f')]['initDynamics365Accounts']=function(){var _0x5c73fc=this;return function(_0x1664fb){if(_0x1664fb){freeIsNotKey(_0x1664fb,_0x5c73fc[_0xf0f9('0x22')],'id');for(var _0x4bf195=0x0,_0x5a143e={},_0x51a456={};_0x4bf195<_0x1664fb[_0xf0f9('0x41')];_0x4bf195+=0x1){_0x5a143e=_0x1664fb[_0x4bf195];if(_[_0xf0f9('0x43')](_0x5c73fc['dynamics365Accounts'][_0x5a143e['id']])){_0x5c73fc['dynamics365Accounts'][_0x5a143e['id']]=new Dynamics365Account(_0x5a143e);}else{_0x5c73fc[_0xf0f9('0x40')](_0x5c73fc[_0xf0f9('0x22')][_0x5a143e['id']],_0x5a143e);}}}return _0x5c73fc[_0xf0f9('0x22')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x51')]=function(){var _0xf93b89=this;return function(_0x44495e){if(_0x44495e){freeIsNotKey(_0x44495e,_0xf93b89[_0xf0f9('0x52')],'id');for(var _0x54211d=0x0,_0x216c6c={},_0x51503d={};_0x54211d<_0x44495e[_0xf0f9('0x41')];_0x54211d+=0x1){_0x216c6c=_0x44495e[_0x54211d];if(_[_0xf0f9('0x43')](_0xf93b89[_0xf0f9('0x52')][_0x216c6c['id']])){_0xf93b89['freshsalesAccounts'][_0x216c6c['id']]=new FreshsalesAccount(_0x216c6c);}else{_0xf93b89[_0xf0f9('0x40')](_0xf93b89[_0xf0f9('0x52')][_0x216c6c['id']],_0x216c6c);}}}return _0xf93b89[_0xf0f9('0x52')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x53')]=function(){var _0x220d96=this;return function(_0xa55ddb){for(var _0x35b0fe=0x0;_0x35b0fe<_0xa55ddb['length'];_0x35b0fe+=0x1){_[_0xf0f9('0x54')](_0x220d96[_0xf0f9('0x15')][_0xa55ddb[_0x35b0fe][_0xf0f9('0x42')]],_0xa55ddb[_0x35b0fe]);}return _0x220d96[_0xf0f9('0x15')];};};Realtime['prototype'][_0xf0f9('0x55')]=function(){var _0x4baed8=this;return function(_0x82a45a){clearVoiceQueues(_0x4baed8['voiceQueues']);if(_0x82a45a){_0x82a45a=_[_0xf0f9('0x56')](_0x82a45a,_0xf0f9('0x57'));for(var _0x52efee in _0x82a45a){if(_0x82a45a['hasOwnProperty'](_0x52efee)){var _0x1737cc={};for(var _0x57422a=0x0;_0x57422a<_0x82a45a[_0x52efee][_0xf0f9('0x41')];_0x57422a+=0x1){var _0x601d32=_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x58')];if(_0x4baed8[_0xf0f9('0x15')][_0x601d32]){if(_0x82a45a[_0x52efee][_0x57422a]['queuecallerexit']){_0x4baed8[_0xf0f9('0x15')][_0x601d32][_0xf0f9('0x32')]+=0x1;}if(_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x59')]){_0x4baed8[_0xf0f9('0x15')][_0x601d32][_0xf0f9('0x33')]+=0x1;}_0x4baed8['voiceQueues'][_0x601d32]['sumHoldTime']+=moment(_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x5a')])[_0xf0f9('0x5b')](moment(_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x5c')]),_0xf0f9('0x5d'))||0x0;if(_0x57422a===_0x82a45a[_0x52efee][_0xf0f9('0x41')]-0x1){_0x4baed8[_0xf0f9('0x15')][_0x601d32][_0xf0f9('0x2d')]+=moment(_0x82a45a[_0x52efee][_0x57422a]['queuecallercompleteAt']||_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x5e')]||_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x5f')])['diff'](moment(_0x82a45a[_0x52efee][_0x57422a][_0xf0f9('0x5c')]),_0xf0f9('0x5d'))||0x0;_0x4baed8['voiceQueues'][_0x601d32][_0xf0f9('0x2a')]+=0x1;if(_0x82a45a[_0x52efee][_0x57422a]['queuecallercomplete']){_0x4baed8['voiceQueues'][_0x601d32]['answered']+=0x1;_0x4baed8['voiceQueues'][_0x601d32][_0xf0f9('0x2e')]+=moment(_0x82a45a[_0x52efee][_0x57422a]['queuecallercompleteAt'])['diff'](moment(_0x82a45a[_0x52efee][_0x57422a]['queuecallerleaveAt']),_0xf0f9('0x5d'))||0x0;}}else{_0x4baed8[_0xf0f9('0x15')][_0x601d32][_0xf0f9('0x2d')]+=_0x4baed8['voiceQueues'][_0x601d32][_0xf0f9('0x2c')]||0x0;}}}}}}return _0x4baed8['voiceQueues'];};};Realtime['prototype'][_0xf0f9('0x60')]=function(){var _0x5226bd=this;return function(_0x2d739e){clearVoiceCallReports(_0x5226bd['outbound']);if(_0x2d739e){for(var _0x443f17=0x0;_0x443f17<_0x2d739e[_0xf0f9('0x41')];_0x443f17+=0x1){_0x5226bd[_0xf0f9('0x19')][_0xf0f9('0x2a')]+=0x1;_0x5226bd[_0xf0f9('0x19')][_0xf0f9('0x2d')]+=_0x2d739e[_0x443f17][_0xf0f9('0x61')];if(_0x2d739e[_0x443f17][_0xf0f9('0x62')]===_0xf0f9('0x63')){_0x5226bd[_0xf0f9('0x19')][_0xf0f9('0x2b')]+=0x1;_0x5226bd[_0xf0f9('0x19')][_0xf0f9('0x2c')]+=_0x2d739e[_0x443f17][_0xf0f9('0x61')]-_0x2d739e[_0x443f17]['billableseconds']||0x0;_0x5226bd[_0xf0f9('0x19')]['sumBillable']+=_0x2d739e[_0x443f17]['billableseconds'];}}}return _0x5226bd['outbound'];};};Realtime[_0xf0f9('0x3f')]['initCampaigns']=function(){var _0x3ece7e=this;return function(_0x21c2d5){if(_0x21c2d5){freeIsNotKey(_0x21c2d5,_0x3ece7e[_0xf0f9('0x17')],'name');for(var _0x2609d9=0x0,_0x3b9b17={};_0x2609d9<_0x21c2d5[_0xf0f9('0x41')];_0x2609d9+=0x1){_0x3b9b17=_0x21c2d5[_0x2609d9];if(_[_0xf0f9('0x43')](_0x3ece7e[_0xf0f9('0x17')][_0x3b9b17[_0xf0f9('0x42')]])){_0x3ece7e[_0xf0f9('0x17')][_0x3b9b17[_0xf0f9('0x42')]]=new Campaign(_0x3b9b17);}else{_0x3ece7e[_0xf0f9('0x40')](_0x3ece7e['campaigns'][_0x3b9b17['name']],_0x3b9b17);_0x3ece7e['campaigns'][_0x3b9b17[_0xf0f9('0x42')]][_0xf0f9('0x64')]=_0x3b9b17[_0xf0f9('0x65')]?_0x3b9b17[_0xf0f9('0x65')]['name']:undefined;}}}return _0x3ece7e[_0xf0f9('0x17')];};};Realtime[_0xf0f9('0x3f')]['initVoiceExtensions']=function(){var _0x19a5fc=this;return function(_0x3fe0dc){if(_0x3fe0dc){freeIsNotKey(_0x3fe0dc,_0x19a5fc[_0xf0f9('0x66')],'id');for(var _0x4d9e01=0x0,_0x28e3b5={};_0x4d9e01<_0x3fe0dc[_0xf0f9('0x41')];_0x4d9e01+=0x1){_0x28e3b5=_0x3fe0dc[_0x4d9e01];if(_[_0xf0f9('0x43')](_0x19a5fc[_0xf0f9('0x66')][_0x28e3b5['id']])){_0x19a5fc[_0xf0f9('0x66')][_0x28e3b5['id']]=new VoiceExtension(_0x28e3b5);}else{_0x19a5fc[_0xf0f9('0x40')](_0x19a5fc[_0xf0f9('0x66')][_0x28e3b5['id']],_0x28e3b5);}}}return _0x19a5fc[_0xf0f9('0x66')];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x67')]=function(){var _0x20dd41=this;return function(_0x323116){clearCampaigns(_0x20dd41[_0xf0f9('0x17')]);for(var _0x8954a1=0x0;_0x8954a1<_0x323116['length'];_0x8954a1+=0x1){_[_0xf0f9('0x54')](_0x20dd41[_0xf0f9('0x17')][_0x323116[_0x8954a1][_0xf0f9('0x42')]],_0x323116[_0x8954a1]);}return _0x20dd41['campaigns'];};};Realtime[_0xf0f9('0x3f')][_0xf0f9('0x68')]=function(){var _0x4825c1=this;return function(_0x31ba02){if(_0x31ba02){freeIsNotKey(_0x31ba02,_0x4825c1[_0xf0f9('0x23')],'id');for(var _0x5c6a84=0x0,_0x32881c={},_0x15173a={};_0x5c6a84<_0x31ba02['length'];_0x5c6a84+=0x1){_0x32881c=_0x31ba02[_0x5c6a84];if(_[_0xf0f9('0x43')](_0x4825c1[_0xf0f9('0x23')][_0x32881c['id']])){_0x4825c1['faxAccounts'][_0x32881c['id']]=new FaxAccount(_0x32881c);}else{_0x4825c1['mergeFromDatabase'](_0x4825c1[_0xf0f9('0x23')][_0x32881c['id']],_0x32881c);}}}return _0x4825c1[_0xf0f9('0x23')];};};module[_0xf0f9('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index d31bb0b..58b01e9 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 _0x91dd=['voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','interface','format','assigned','lastAssignedTo','isNil','SIP/%s','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','getAgentByInternal','keys','split','outbound','internal','destination','type','dialer','lastapplication','lastdata','queue','from-voip-provider','callerid','context','from-sip','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','getCallType','UserId','membername','monitors','length','monitorFilename','createdAt','exten','xcally-motion-preview','connectedlinenum','xcally-motion-dialer','create','startsWith','Local','indexOf','mobile','substring','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport'];(function(_0x3df186,_0x12592c){var _0x5440fc=function(_0x2a7a70){while(--_0x2a7a70){_0x3df186['push'](_0x3df186['shift']());}};_0x5440fc(++_0x12592c);}(_0x91dd,0x1c7));var _0xd91d=function(_0x1bd1aa,_0x22d6ab){_0x1bd1aa=_0x1bd1aa-0x0;var _0x381579=_0x91dd[_0x1bd1aa];return _0x381579;};'use strict';var _=require(_0xd91d('0x0'));var moment=require(_0xd91d('0x1'));var util=require(_0xd91d('0x2'));var config=require(_0xd91d('0x3'));var ami=require(_0xd91d('0x4'));var RpcVoiceAgentReport=require(_0xd91d('0x5'));var RpcVoiceCallReport=require(_0xd91d('0x6'));var RpcVoiceDialReport=require(_0xd91d('0x7'));var RpcMemberReport=require(_0xd91d('0x8'));var RpcVoiceQueueReport=require(_0xd91d('0x9'));var RpcVoiceRecording=require(_0xd91d('0xa'));var RpcVoiceTransferReport=require(_0xd91d('0xb'));var VoiceQueueReport=require(_0xd91d('0xc'));var VoiceCallReport=require(_0xd91d('0xd'));var VoiceAgentReport=require(_0xd91d('0xe'));var VoiceDialReport=require(_0xd91d('0xf'));var UserReport=require(_0xd91d('0x10'));function Report(_0x49d210){this[_0xd91d('0x11')]=_0x49d210;this[_0xd91d('0x12')]=_0x49d210[_0xd91d('0x12')];this[_0xd91d('0x13')]=_0x49d210['telephones'];}Report[_0xd91d('0x14')][_0xd91d('0x15')]=function(_0x2bf434){var _0x2119d5=new VoiceQueueReport(this[_0xd91d('0x11')]);var _0x16d26e=new VoiceAgentReport(this[_0xd91d('0x11')]);var _0x22453e=new VoiceDialReport(this[_0xd91d('0x11')]);var _0x575a23=new VoiceCallReport(this['realtime']);var _0x14a3c2=new UserReport(this[_0xd91d('0x11')]);if(config[_0xd91d('0x16')]&&config[_0xd91d('0x16')][_0xd91d('0x17')]){ami['on'](_0xd91d('0x18'),this[_0xd91d('0x19')]['bind'](this));ami['on'](_0xd91d('0x1a'),this[_0xd91d('0x1b')][_0xd91d('0x1c')](this));ami['on'](_0xd91d('0x1d'),this[_0xd91d('0x1e')][_0xd91d('0x1c')](this));ami['on']('custom:voiceDialReport',this[_0xd91d('0x1f')][_0xd91d('0x1c')](this));ami['on'](_0xd91d('0x20'),this[_0xd91d('0x21')][_0xd91d('0x1c')](this));ami['on'](_0xd91d('0x22'),this['attendedTransfer'][_0xd91d('0x1c')](this));}};Report[_0xd91d('0x14')][_0xd91d('0x23')]=function(_0x27ffd6){var _0xd7f9f6;_0xd7f9f6=_[_0xd91d('0x24')](this['agents'],function(_0x576c58){return _0x576c58[_0xd91d('0x25')]==_0x27ffd6||_0x576c58[_0xd91d('0x26')]==_0x27ffd6;});if(_['isNil'](_0xd7f9f6)){var _0x7f5dc2=_[_0xd91d('0x24')](this['telephones'],function(_0x453f7e){return _0x453f7e[_0xd91d('0x25')]==_0x27ffd6||_0x453f7e[_0xd91d('0x26')]==_0x27ffd6;});if(_0x7f5dc2){_0xd7f9f6=_['find'](this[_0xd91d('0x12')],function(_0x14d47a){return _0x14d47a[_0xd91d('0x27')]==util[_0xd91d('0x28')]('SIP/%s',_0x7f5dc2[_0xd91d('0x26')]);});}}return _0xd7f9f6;};Report[_0xd91d('0x14')][_0xd91d('0x19')]=function(_0x27f73a){for(var _0x221933=0x0;_0x221933<_0x27f73a['length'];_0x221933+=0x1){var _0x7bb9f7=this['findAgent'](_0x27f73a[_0x221933]['connectedlinenum']);if(_0x7bb9f7){_0x27f73a[_0x221933][_0xd91d('0x25')]=_0x7bb9f7['accountcode'];_0x27f73a[_0x221933][_0xd91d('0x29')]=!![];_0x27f73a[_0x221933][_0xd91d('0x2a')]=_0x7bb9f7[_0xd91d('0x26')];_0x27f73a[_0x221933][_0xd91d('0x27')]=_[_0xd91d('0x2b')](_0x7bb9f7[_0xd91d('0x27')])?util['format'](_0xd91d('0x2c'),_0x7bb9f7[_0xd91d('0x26')]):_0x7bb9f7[_0xd91d('0x27')];if(_0x27f73a[_0x221933][_0xd91d('0x2d')]){_0x27f73a[_0x221933][_0xd91d('0x2e')]=moment()[_0xd91d('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x27f73a[_0x221933][_0xd91d('0x2f')]){_0x27f73a[_0x221933][_0xd91d('0x30')]=moment()[_0xd91d('0x28')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x27f73a[_0x221933]);}RpcVoiceQueueReport['create'](_0x27f73a[_0x221933]);}};function extractCalleridNumber(_0x345efa){var _0x27e769=_0x345efa['match'](/<(.*?)>/);return _0x27e769?_0x27e769[0x1]:_0x345efa;}Report['prototype'][_0xd91d('0x31')]=function(_0x3d1336){for(var _0x24af03=0x0;_0x24af03','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','type','UserId','membername','monitors','createdAt','exten','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports'];(function(_0x4f5113,_0x297049){var _0x5e0bd5=function(_0x4d3c6c){while(--_0x4d3c6c){_0x4f5113['push'](_0x4f5113['shift']());}};_0x5e0bd5(++_0x297049);}(_0x6f16,0x1cc));var _0x66f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f16[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x66f1('0x0'));var moment=require(_0x66f1('0x1'));var util=require(_0x66f1('0x2'));var config=require(_0x66f1('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x66f1('0x4'));var RpcVoiceCallReport=require(_0x66f1('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x66f1('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x66f1('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x66f1('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x66f1('0x9'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x66f1('0xa'));function Report(_0x464b9d){this['realtime']=_0x464b9d;this[_0x66f1('0xb')]=_0x464b9d['agents'];this[_0x66f1('0xc')]=_0x464b9d[_0x66f1('0xc')];}Report[_0x66f1('0xd')][_0x66f1('0xe')]=function(_0x5c9dc3){var _0x58ece4=new VoiceQueueReport(this[_0x66f1('0xf')]);var _0x5c5d5f=new VoiceAgentReport(this[_0x66f1('0xf')]);var _0x34f0f6=new VoiceDialReport(this['realtime']);var _0x424e97=new VoiceCallReport(this[_0x66f1('0xf')]);var _0x25c906=new UserReport(this['realtime']);if(config[_0x66f1('0x10')]&&config['xdr'][_0x66f1('0x11')]){ami['on'](_0x66f1('0x12'),this[_0x66f1('0x13')][_0x66f1('0x14')](this));ami['on']('custom:voiceCallReport',this[_0x66f1('0x15')][_0x66f1('0x14')](this));ami['on'](_0x66f1('0x16'),this[_0x66f1('0x17')]['bind'](this));ami['on'](_0x66f1('0x18'),this[_0x66f1('0x19')][_0x66f1('0x14')](this));ami['on'](_0x66f1('0x1a'),this['blindTransfer'][_0x66f1('0x14')](this));ami['on'](_0x66f1('0x1b'),this[_0x66f1('0x1c')]['bind'](this));}};Report[_0x66f1('0xd')]['findAgent']=function(_0x31ef6){var _0x137ec5;_0x137ec5=_[_0x66f1('0x1d')](this[_0x66f1('0xb')],function(_0x39f9a7){return _0x39f9a7[_0x66f1('0x1e')]==_0x31ef6||_0x39f9a7[_0x66f1('0x1f')]==_0x31ef6;});if(_[_0x66f1('0x20')](_0x137ec5)){var _0x4cdc8a=_[_0x66f1('0x1d')](this[_0x66f1('0xc')],function(_0x196edb){return _0x196edb[_0x66f1('0x1e')]==_0x31ef6||_0x196edb[_0x66f1('0x1f')]==_0x31ef6;});if(_0x4cdc8a){_0x137ec5=_[_0x66f1('0x1d')](this[_0x66f1('0xb')],function(_0xa9ecbb){return _0xa9ecbb[_0x66f1('0x21')]==util[_0x66f1('0x22')](_0x66f1('0x23'),_0x4cdc8a[_0x66f1('0x1f')]);});}}return _0x137ec5;};Report[_0x66f1('0xd')]['voiceQueueReport']=function(_0x2c6f61){for(var _0x30da73=0x0;_0x30da73<_0x2c6f61[_0x66f1('0x24')];_0x30da73+=0x1){var _0x2662c7=this[_0x66f1('0x25')](_0x2c6f61[_0x30da73][_0x66f1('0x26')]);if(_0x2662c7){_0x2c6f61[_0x30da73][_0x66f1('0x1e')]=_0x2662c7[_0x66f1('0x1e')];_0x2c6f61[_0x30da73][_0x66f1('0x27')]=!![];_0x2c6f61[_0x30da73][_0x66f1('0x28')]=_0x2662c7['name'];_0x2c6f61[_0x30da73][_0x66f1('0x21')]=_['isNil'](_0x2662c7[_0x66f1('0x21')])?util[_0x66f1('0x22')](_0x66f1('0x23'),_0x2662c7[_0x66f1('0x1f')]):_0x2662c7[_0x66f1('0x21')];if(_0x2c6f61[_0x30da73]['queuecallercomplete']){_0x2c6f61[_0x30da73][_0x66f1('0x29')]=moment()['format'](_0x66f1('0x2a'));}if(_0x2c6f61[_0x30da73][_0x66f1('0x2b')]){_0x2c6f61[_0x30da73][_0x66f1('0x2c')]=moment()[_0x66f1('0x22')](_0x66f1('0x2a'));}RpcMemberReport[_0x66f1('0x13')](_0x2c6f61[_0x30da73]);}RpcVoiceQueueReport[_0x66f1('0x2d')](_0x2c6f61[_0x30da73]);}};function extractCalleridNumber(_0x471e03){var _0x2ea38b=_0x471e03['match'](/<(.*?)>/);return _0x2ea38b?_0x2ea38b[0x1]:_0x471e03;}Report[_0x66f1('0xd')]['getAgentByInternal']=function(_0x557444){for(var _0x52f0bc=0x0;_0x52f0bc0x0?_0x3b3096:0x0;this[_0x9e0c('0x45')][_0x20a43a[_0x9e0c('0x69')]]['talking']=this[_0x9e0c('0x45')][_0x20a43a[_0x9e0c('0x69')]][_0x9e0c('0x31')]>_[_0x9e0c('0x6e')](_0x20a43a[_0x9e0c('0x6f')])?_['toNumber'](_0x20a43a[_0x9e0c('0x6f')]):this['voiceQueues'][_0x20a43a[_0x9e0c('0x69')]][_0x9e0c('0x31')];this[_0x9e0c('0x70')](this[_0x9e0c('0x45')][_0x20a43a['queue']],'queuesummary');}logger[_0x9e0c('0x48')](_0x9e0c('0x71'),util[_0x9e0c('0x41')](this['voiceQueues'][_0x20a43a[_0x9e0c('0x69')]],{'showHidden':![],'depth':null}));ami[_0x9e0c('0x46')](_0x9e0c('0x72'),this[_0x9e0c('0x45')][_0x20a43a[_0x9e0c('0x69')]]);}}}catch(_0x2c985d){logger[_0x9e0c('0x3e')](_0x9e0c('0x67'),util[_0x9e0c('0x41')](_0x2c985d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e0c('0xb')][_0x9e0c('0x18')]=function(_0x810a4b){logger[_0x9e0c('0x48')](_0x9e0c('0x73'),util['inspect'](_0x810a4b,{'showHidden':![],'depth':null}));ami[_0x9e0c('0x46')](_0x9e0c('0x74'),{});this[_0x9e0c('0x12')]=!![];};VoiceQueueReport[_0x9e0c('0xb')][_0x9e0c('0x1a')]=function(_0x59cc92){try{if(this['isNotNull'](_0x59cc92)){logger['debug'](_0x9e0c('0x75'),_0x59cc92[_0x9e0c('0x76')],util[_0x9e0c('0x41')](_0x59cc92,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x9e0c('0xf')][_0x59cc92[_0x9e0c('0x76')]]))this[_0x9e0c('0xf')][_0x59cc92[_0x9e0c('0x76')]]=[];if(_['isUndefined'](this[_0x9e0c('0x37')][_0x59cc92['uniqueid']]))this[_0x9e0c('0x37')][_0x59cc92[_0x9e0c('0x76')]]={};var _0x1dcb1b=new QueueReport();_0x1dcb1b[_0x9e0c('0x4b')]=_0x59cc92[_0x9e0c('0x69')];_0x1dcb1b['type']=this[_0x9e0c('0x45')][_0x1dcb1b[_0x9e0c('0x4b')]]&&this[_0x9e0c('0x45')][_0x1dcb1b[_0x9e0c('0x4b')]][_0x9e0c('0x52')]?this[_0x9e0c('0x45')][_0x1dcb1b['name']]['type']||_0x9e0c('0x53'):'inbound';_0x1dcb1b[_0x9e0c('0x69')]=_0x59cc92['queue'];_0x1dcb1b[_0x9e0c('0x77')]=moment()[_0x9e0c('0x49')](_0x9e0c('0x78'));_0x1dcb1b['position']=_0x59cc92[_0x9e0c('0x79')];_0x1dcb1b[_0x9e0c('0x7a')]=_0x59cc92[_0x9e0c('0x7a')];_0x1dcb1b[_0x9e0c('0x76')]=_0x59cc92[_0x9e0c('0x76')];_0x1dcb1b[_0x9e0c('0x7b')]=this[_0x9e0c('0x37')][_0x59cc92[_0x9e0c('0x76')]][_0x9e0c('0x7b')];logger[_0x9e0c('0x6a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1dcb1b[_0x9e0c('0x4b')],_0x1dcb1b[_0x9e0c('0x52')]);_[_0x9e0c('0x7c')](_0x1dcb1b,_[_0x9e0c('0x7d')](_0x59cc92,_['keys'](_0x1dcb1b)));this['queueReports'][_0x59cc92[_0x9e0c('0x76')]][_0x9e0c('0x7e')](_0x1dcb1b);this[_0x9e0c('0x37')][_0x59cc92[_0x9e0c('0x76')]]=_0x1dcb1b;this[_0x9e0c('0x47')](_0x1dcb1b,_0x9e0c('0x19'));}}catch(_0x252286){logger[_0x9e0c('0x3e')]('[%s][voiceQueueReport][queuecallerjoin]',_0x59cc92['uniqueid'],util[_0x9e0c('0x41')](_0x252286,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x279138){try{if(this['isNotNull'](_0x279138)){logger[_0x9e0c('0x48')](_0x9e0c('0x7f'),_0x279138[_0x9e0c('0x76')],util[_0x9e0c('0x41')](_0x279138,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x279138[_0x9e0c('0x76')]]){var _0x4dd7f3=_[_0x9e0c('0x80')](this[_0x9e0c('0xf')][_0x279138[_0x9e0c('0x76')]]);_0x4dd7f3['queuecallercomplete']=![];_0x4dd7f3['queuecallercompleteAt']=null;_0x4dd7f3['holdtime']=_0x279138[_0x9e0c('0x81')];_0x4dd7f3[_0x9e0c('0x82')]=_0x279138[_0x9e0c('0x82')];_0x4dd7f3[_0x9e0c('0x1b')]=!![];_0x4dd7f3['queuecallerabandonAt']=moment()[_0x9e0c('0x49')](_0x9e0c('0x78'));_0x4dd7f3['queuecallerexitreason']=_0x9e0c('0x83');_0x4dd7f3[_0x9e0c('0x84')]=null;logger[_0x9e0c('0x6a')](_0x9e0c('0x85'),_0x4dd7f3['name'],_0x4dd7f3[_0x9e0c('0x52')]);this['channels'][_0x279138[_0x9e0c('0x76')]]=_0x4dd7f3;this[_0x9e0c('0x86')](_0x4dd7f3,_0x9e0c('0x1b'));}}}catch(_0x3407f9){logger[_0x9e0c('0x3e')](_0x9e0c('0x7f'),_0x279138[_0x9e0c('0x76')],util[_0x9e0c('0x41')](_0x3407f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e0c('0xb')][_0x9e0c('0x1f')]=function(_0xd5f2a0){try{if(this[_0x9e0c('0x68')](_0xd5f2a0)){logger[_0x9e0c('0x48')](_0x9e0c('0x87'),_0xd5f2a0[_0x9e0c('0x76')],util[_0x9e0c('0x41')](_0xd5f2a0,{'showHidden':![],'depth':null}));if(this[_0x9e0c('0xf')][_0xd5f2a0[_0x9e0c('0x76')]]){var _0x5333ee=_['last'](this['queueReports'][_0xd5f2a0[_0x9e0c('0x76')]]);_0x5333ee[_0x9e0c('0x88')]=moment()['format'](_0x9e0c('0x78'));_0x5333ee['connectedlinenum']=_0xd5f2a0[_0x9e0c('0x89')];_0x5333ee[_0x9e0c('0x8a')]=_0xd5f2a0[_0x9e0c('0x8a')];logger[_0x9e0c('0x6a')](_0x9e0c('0x8b'),_0x5333ee[_0x9e0c('0x4b')],_0x5333ee['type'],_0xd5f2a0['connectedlinenum'],_0xd5f2a0[_0x9e0c('0x8a')]);this['channels'][_0xd5f2a0[_0x9e0c('0x76')]]=_0x5333ee;this[_0x9e0c('0x47')](_0x5333ee,_0x9e0c('0x1e'));}}}catch(_0x31ed71){logger['error'](_0x9e0c('0x87'),_0xd5f2a0[_0x9e0c('0x76')],util[_0x9e0c('0x41')](_0x31ed71,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e0c('0xb')]['syncAgentConnect']=function(_0xec1d0f){try{if(this[_0x9e0c('0x68')](_0xec1d0f)){logger['debug'](_0x9e0c('0x8c'),_0xec1d0f[_0x9e0c('0x76')],util[_0x9e0c('0x41')](_0xec1d0f,{'showHidden':![],'depth':null}));if(this[_0x9e0c('0xf')][_0xec1d0f['uniqueid']]){var _0x2aed69=_[_0x9e0c('0x80')](this[_0x9e0c('0xf')][_0xec1d0f['uniqueid']]);_0x2aed69[_0x9e0c('0x8d')]=!![];_0x2aed69[_0x9e0c('0x8e')]=_0x9e0c('0x8f');logger[_0x9e0c('0x6a')](_0x9e0c('0x90'),_0x2aed69[_0x9e0c('0x4b')],_0x2aed69[_0x9e0c('0x52')]);}}}catch(_0x236328){logger[_0x9e0c('0x3e')](_0x9e0c('0x8c'),_0xec1d0f[_0x9e0c('0x76')],util[_0x9e0c('0x41')](_0x236328,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0x3d40cb){try{if(this[_0x9e0c('0x68')](_0x3d40cb)){logger[_0x9e0c('0x48')](_0x9e0c('0x91'),_0x3d40cb['uniqueid'],util[_0x9e0c('0x41')](_0x3d40cb,{'showHidden':![],'depth':null}));if(this[_0x9e0c('0xf')][_0x3d40cb[_0x9e0c('0x76')]]){var _0x4b824a=_['last'](this['queueReports'][_0x3d40cb['uniqueid']]);_0x4b824a[_0x9e0c('0x1b')]=![];_0x4b824a[_0x9e0c('0x92')]=null;_0x4b824a['assigned']=!![];_0x4b824a[_0x9e0c('0x84')]=_0x3d40cb[_0x9e0c('0x93')];_0x4b824a[_0x9e0c('0x81')]=_0x3d40cb[_0x9e0c('0x81')];_0x4b824a[_0x9e0c('0x8d')]=!![];_0x4b824a[_0x9e0c('0x94')]=![];_0x4b824a[_0x9e0c('0x95')]=null;if(!_0x4b824a[_0x9e0c('0x96')]){if(_0x3d40cb['reason']=='transfer'){_0x4b824a[_0x9e0c('0x8e')]='COMPLETED';logger[_0x9e0c('0x6a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4b824a['name'],_0x4b824a[_0x9e0c('0x52')]);}else{if(_[_0x9e0c('0x97')](_0x3d40cb[_0x9e0c('0x3c')][_0x9e0c('0x98')](),_0x9e0c('0x99'))){if(this[_0x9e0c('0xf')][_0x3d40cb[_0x9e0c('0x9a')]]){var _0x4cc5c8=_[_0x9e0c('0x80')](this['queueReports'][_0x3d40cb['linkedid']]);_0x4cc5c8[_0x9e0c('0x8d')]=![];_0x4cc5c8['queuecallerexit']=!![];_0x4cc5c8[_0x9e0c('0x95')]=moment(_0x4b824a[_0x9e0c('0x77')])[_0x9e0c('0x9b')](_0x3d40cb[_0x9e0c('0x81')],'seconds')['format'](_0x9e0c('0x78'));_0x4cc5c8['queuecallerexitreason']='FORWARDTRANSFER';_0x4cc5c8[_0x9e0c('0x96')]=!![];_0x4cc5c8[_0x9e0c('0x9c')]='FORWARD';_0x4cc5c8[_0x9e0c('0x9d')]=_0x3d40cb['destexten'];_0x4cc5c8[_0x9e0c('0x9e')]=_0x3d40cb[_0x9e0c('0x76')];logger[_0x9e0c('0x6a')](_0x9e0c('0x9f'),_0x4cc5c8[_0x9e0c('0x4b')],_0x4cc5c8[_0x9e0c('0x52')]);var _0x5cbeae=this[_0x9e0c('0xf')][_0x3d40cb[_0x9e0c('0x9a')]];this[_0x9e0c('0xf')][_0x3d40cb['linkedid']]=this[_0x9e0c('0xf')][_0x3d40cb[_0x9e0c('0x76')]];this[_0x9e0c('0xf')][_0x3d40cb[_0x9e0c('0x76')]]=_0x5cbeae;}}else{_0x4b824a['queuecallerexitreason']=_0x9e0c('0xa0')+_0x3d40cb['reason'][_0x9e0c('0xa1')]();logger['info'](_0x9e0c('0xa2'),_0x4b824a[_0x9e0c('0x4b')],_0x4b824a[_0x9e0c('0x52')],_0x4b824a[_0x9e0c('0x8e')]);}}}this[_0x9e0c('0x37')][_0x3d40cb['uniqueid']]=_0x4b824a;this[_0x9e0c('0x86')](_0x4b824a,_0x9e0c('0x20'));}}}catch(_0x463b79){logger[_0x9e0c('0x3e')](_0x9e0c('0x91'),_0x3d40cb[_0x9e0c('0x76')],util[_0x9e0c('0x41')](_0x463b79,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e0c('0xb')][_0x9e0c('0xa3')]=function(_0xffdecf){try{if(this[_0x9e0c('0x68')](_0xffdecf)){logger[_0x9e0c('0x48')](_0x9e0c('0xa4'),_0xffdecf['uniqueid'],util[_0x9e0c('0x41')](_0xffdecf,{'showHidden':![],'depth':null}));this[_0x9e0c('0xa5')](_0xffdecf[_0x9e0c('0x76')],_[_0x9e0c('0xa6')](_0xffdecf[_0x9e0c('0xa7')])[0x0],_0xffdecf['value']);if(this[_0x9e0c('0xf')][_0xffdecf[_0x9e0c('0x76')]]){var _0x9852fe=_[_0x9e0c('0x80')](this[_0x9e0c('0xf')][_0xffdecf[_0x9e0c('0x76')]]);if(_0x9852fe){if(this[_0x9e0c('0x68')](_0xffdecf[_0x9e0c('0xa7')])&&this['isNotNull'](_0xffdecf[_0x9e0c('0xa7')][_0x9e0c('0xa8')])){switch(_0xffdecf[_0x9e0c('0xa9')]){case _0x9e0c('0xaa'):_0x9852fe[_0x9e0c('0x94')]=![];_0x9852fe[_0x9e0c('0x95')]=null;break;case _0x9e0c('0xab'):_0x9852fe[_0x9e0c('0xac')]=_0x9e0c('0xad');_0x9852fe['queuecallerexit']=!![];_0x9852fe['queuecallerexitAt']=moment()[_0x9e0c('0x49')](_0x9e0c('0x78'));_0x9852fe[_0x9e0c('0x88')]=moment()[_0x9e0c('0x49')](_0x9e0c('0x78'));logger[_0x9e0c('0x48')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0xffdecf[_0x9e0c('0x76')],util[_0x9e0c('0x41')](_0x9852fe,{'showHidden':![],'depth':null}));ami[_0x9e0c('0x46')](_0x9e0c('0xae'),_0x9852fe);break;default:_0x9852fe[_0x9e0c('0x94')]=!![];_0x9852fe[_0x9e0c('0x95')]=moment()[_0x9e0c('0x49')](_0x9e0c('0x78'));_0x9852fe['queuecallerleaveAt']=moment()['format'](_0x9e0c('0x78'));}_0x9852fe[_0x9e0c('0x1b')]=![];_0x9852fe[_0x9e0c('0x92')]=null;_0x9852fe[_0x9e0c('0x8e')]=_0xffdecf[_0x9e0c('0xa9')];this['channels'][_0xffdecf[_0x9e0c('0x76')]]=_0x9852fe;this['emitVoiceQueueChannelRemove'](_0x9852fe,'varset');}else if(this[_0x9e0c('0x68')](_0xffdecf[_0x9e0c('0xa7')])&&this[_0x9e0c('0x68')](_0xffdecf[_0x9e0c('0xa7')][_0x9e0c('0xaf')])){if(!_0x9852fe[_0x9e0c('0x1b')]){_0x9852fe['queuecallerexit']=!![];_0x9852fe[_0x9e0c('0x95')]=moment()[_0x9e0c('0x49')](_0x9e0c('0x78'));_0x9852fe['queuecallerexitreason']=_0x9e0c('0xb0');_0x9852fe[_0x9e0c('0x88')]=moment()['format'](_0x9e0c('0x78'));this[_0x9e0c('0x37')][_0xffdecf[_0x9e0c('0x76')]]=_0x9852fe;}}logger['info'](_0x9e0c('0xb1'),_0xffdecf['uniqueid'],_0x9852fe[_0x9e0c('0x4b')],_0x9852fe[_0x9e0c('0x52')],_[_0x9e0c('0xa6')](_0xffdecf[_0x9e0c('0xa7')])[0x0],_0xffdecf[_0x9e0c('0xa9')]);_0x9852fe[_0x9e0c('0x14')]=this['variables'][_0xffdecf[_0x9e0c('0x76')]];}}}}catch(_0x53364d){logger[_0x9e0c('0x3e')]('[%s][voiceQueueReport][varset]',_0xffdecf[_0x9e0c('0x76')],util[_0x9e0c('0x41')](_0x53364d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x9e0c('0xb')][_0x9e0c('0xa5')]=function(_0x4b3d2a,_0x529c76,_0x49a9a9){var _0x1713b4=['rtpaudioqos',_0x9e0c('0xb2'),_0x9e0c('0xb3'),_0x9e0c('0xb4'),_0x9e0c('0xb5'),_0x9e0c('0xb6'),_0x9e0c('0xb7'),'rtpaudioqosrttbridged',_0x9e0c('0xb8'),_0x9e0c('0xb9'),_0x9e0c('0xba'),_0x9e0c('0xbb'),_0x9e0c('0xbc'),'memberdynamic',_0x9e0c('0xbd'),_0x9e0c('0xbe'),_0x9e0c('0x93'),'memberpenalty',_0x9e0c('0xbf')];if(!_['isNil'](_0x529c76)&&!_['includes'](_0x1713b4,_0x529c76)){if(_[_0x9e0c('0x63')](this[_0x9e0c('0x14')][_0x4b3d2a])){this[_0x9e0c('0x14')][_0x4b3d2a]={};}this[_0x9e0c('0x14')][_0x4b3d2a][_0x529c76]=_0x49a9a9;}};VoiceQueueReport[_0x9e0c('0xb')]['handleHangup']=function(_0x3a79ce,_0x195165,_0x9491c4){var _0xa067e7={};for(var _0x1a7739=0x0;_0x1a77390x0?_0x54d2d5:0x0;this['voiceQueues'][_0x47fa64['queue']][_0xfbe5('0x34')]=this[_0xfbe5('0x14')][_0x47fa64[_0xfbe5('0x70')]][_0xfbe5('0x34')]>_[_0xfbe5('0x74')](_0x47fa64[_0xfbe5('0x75')])?_['toNumber'](_0x47fa64[_0xfbe5('0x75')]):this[_0xfbe5('0x14')][_0x47fa64[_0xfbe5('0x70')]][_0xfbe5('0x34')];this[_0xfbe5('0x57')](this[_0xfbe5('0x14')][_0x47fa64[_0xfbe5('0x70')]],'queuesummary');}logger['debug'](_0xfbe5('0x76'),util['inspect'](this[_0xfbe5('0x14')][_0x47fa64['queue']],{'showHidden':![],'depth':null}));ami[_0xfbe5('0x49')](_0xfbe5('0x77'),this['voiceQueues'][_0x47fa64[_0xfbe5('0x70')]]);}}}catch(_0x47c629){logger['error']('[voiceQueueReport][queuesummary]',util['inspect'](_0x47c629,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbe5('0xb')][_0xfbe5('0x19')]=function(_0x4dd357){logger[_0xfbe5('0x4b')](_0xfbe5('0x78'),util[_0xfbe5('0x41')](_0x4dd357,{'showHidden':![],'depth':null}));ami[_0xfbe5('0x49')](_0xfbe5('0x79'),{});this[_0xfbe5('0x6c')]=!![];};VoiceQueueReport[_0xfbe5('0xb')]['syncQueueCallerJoin']=function(_0x1dc22a){try{if(this[_0xfbe5('0x6f')](_0x1dc22a)){logger[_0xfbe5('0x4b')](_0xfbe5('0x7a'),_0x1dc22a[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x1dc22a,{'showHidden':![],'depth':null}));if(_[_0xfbe5('0x68')](this[_0xfbe5('0x10')][_0x1dc22a[_0xfbe5('0x4e')]]))this[_0xfbe5('0x10')][_0x1dc22a['uniqueid']]=[];if(_[_0xfbe5('0x68')](this[_0xfbe5('0x12')][_0x1dc22a[_0xfbe5('0x4e')]]))this[_0xfbe5('0x12')][_0x1dc22a[_0xfbe5('0x4e')]]={};var _0x5b2d22=new QueueReport();_0x5b2d22[_0xfbe5('0x51')]=_0x1dc22a['queue'];_0x5b2d22[_0xfbe5('0x58')]=this[_0xfbe5('0x14')][_0x5b2d22[_0xfbe5('0x51')]]&&this[_0xfbe5('0x14')][_0x5b2d22[_0xfbe5('0x51')]]['type']?this[_0xfbe5('0x14')][_0x5b2d22[_0xfbe5('0x51')]]['type']||_0xfbe5('0x7b'):_0xfbe5('0x7b');_0x5b2d22[_0xfbe5('0x70')]=_0x1dc22a['queue'];_0x5b2d22['queuecallerjoinAt']=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));_0x5b2d22[_0xfbe5('0x7d')]=_0x1dc22a['position'];_0x5b2d22[_0xfbe5('0x7e')]=_0x1dc22a[_0xfbe5('0x7e')];_0x5b2d22[_0xfbe5('0x4e')]=_0x1dc22a[_0xfbe5('0x4e')];_0x5b2d22[_0xfbe5('0x7f')]=this[_0xfbe5('0x12')][_0x1dc22a[_0xfbe5('0x4e')]][_0xfbe5('0x7f')];logger[_0xfbe5('0x80')](_0xfbe5('0x81'),_0x5b2d22[_0xfbe5('0x51')],_0x5b2d22[_0xfbe5('0x58')]);_[_0xfbe5('0x82')](_0x5b2d22,_[_0xfbe5('0x83')](_0x1dc22a,_[_0xfbe5('0x84')](_0x5b2d22)));this[_0xfbe5('0x10')][_0x1dc22a[_0xfbe5('0x4e')]][_0xfbe5('0x85')](_0x5b2d22);this[_0xfbe5('0x12')][_0x1dc22a[_0xfbe5('0x4e')]]=_0x5b2d22;this['emitVoiceQueueChannelSave'](_0x5b2d22,'queuecallerjoin');}}catch(_0x44d434){logger[_0xfbe5('0x43')](_0xfbe5('0x7a'),_0x1dc22a[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x44d434,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbe5('0xb')][_0xfbe5('0x1e')]=function(_0x8b367e){try{if(this[_0xfbe5('0x6f')](_0x8b367e)){logger[_0xfbe5('0x4b')](_0xfbe5('0x86'),_0x8b367e[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x8b367e,{'showHidden':![],'depth':null}));if(this[_0xfbe5('0x10')][_0x8b367e[_0xfbe5('0x4e')]]){var _0x4fbf7c=_[_0xfbe5('0x87')](this[_0xfbe5('0x10')][_0x8b367e[_0xfbe5('0x4e')]]);_0x4fbf7c[_0xfbe5('0x88')]=![];_0x4fbf7c['queuecallercompleteAt']=null;_0x4fbf7c[_0xfbe5('0x89')]=_0x8b367e[_0xfbe5('0x89')];_0x4fbf7c[_0xfbe5('0x8a')]=_0x8b367e['originalposition'];_0x4fbf7c[_0xfbe5('0x1d')]=!![];_0x4fbf7c[_0xfbe5('0x8b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4fbf7c['queuecallerexitreason']=_0xfbe5('0x8c');_0x4fbf7c['lastAssignedTo']=null;logger[_0xfbe5('0x80')](_0xfbe5('0x8d'),_0x4fbf7c['name'],_0x4fbf7c[_0xfbe5('0x58')]);this['channels'][_0x8b367e[_0xfbe5('0x4e')]]=_0x4fbf7c;this[_0xfbe5('0x47')](_0x4fbf7c,_0xfbe5('0x1d'));}}}catch(_0x446beb){logger[_0xfbe5('0x43')](_0xfbe5('0x86'),_0x8b367e[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x446beb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x15f1ff){try{if(this['isNotNull'](_0x15f1ff)){logger[_0xfbe5('0x4b')](_0xfbe5('0x8e'),_0x15f1ff[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x15f1ff,{'showHidden':![],'depth':null}));if(this[_0xfbe5('0x10')][_0x15f1ff[_0xfbe5('0x4e')]]){var _0x15030c=_['last'](this[_0xfbe5('0x10')][_0x15f1ff[_0xfbe5('0x4e')]]);_0x15030c[_0xfbe5('0x8f')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));_0x15030c['connectedlinenum']=_0x15f1ff[_0xfbe5('0x90')];_0x15030c['connectedlinename']=_0x15f1ff[_0xfbe5('0x91')];logger[_0xfbe5('0x80')](_0xfbe5('0x92'),_0x15030c['name'],_0x15030c[_0xfbe5('0x58')],_0x15f1ff[_0xfbe5('0x90')],_0x15f1ff['connectedlinename']);this[_0xfbe5('0x12')][_0x15f1ff[_0xfbe5('0x4e')]]=_0x15030c;this[_0xfbe5('0x4a')](_0x15030c,_0xfbe5('0x1f'));}}}catch(_0x20129c){logger['error'](_0xfbe5('0x8e'),_0x15f1ff[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x20129c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbe5('0xb')]['syncAgentConnect']=function(_0x470994){try{if(this[_0xfbe5('0x6f')](_0x470994)){logger['debug'](_0xfbe5('0x93'),_0x470994[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x470994,{'showHidden':![],'depth':null}));if(this[_0xfbe5('0x10')][_0x470994[_0xfbe5('0x4e')]]){var _0x59228f=_[_0xfbe5('0x87')](this[_0xfbe5('0x10')][_0x470994[_0xfbe5('0x4e')]]);_0x59228f[_0xfbe5('0x88')]=!![];_0x59228f[_0xfbe5('0x55')]='COMPLETEDBYAGENT';logger['info'](_0xfbe5('0x94'),_0x59228f[_0xfbe5('0x51')],_0x59228f[_0xfbe5('0x58')]);}}}catch(_0x5a792e){logger['error'](_0xfbe5('0x93'),_0x470994[_0xfbe5('0x4e')],util['inspect'](_0x5a792e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbe5('0xb')][_0xfbe5('0x21')]=function(_0x4f558c){try{if(this[_0xfbe5('0x6f')](_0x4f558c)){logger[_0xfbe5('0x4b')](_0xfbe5('0x95'),_0x4f558c[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0x4f558c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4f558c[_0xfbe5('0x4e')]]){var _0x34fdba=_[_0xfbe5('0x87')](this[_0xfbe5('0x10')][_0x4f558c[_0xfbe5('0x4e')]]);_0x34fdba[_0xfbe5('0x1d')]=![];_0x34fdba[_0xfbe5('0x8b')]=null;_0x34fdba[_0xfbe5('0x96')]=!![];_0x34fdba[_0xfbe5('0x97')]=_0x4f558c[_0xfbe5('0x98')];_0x34fdba[_0xfbe5('0x89')]=_0x4f558c[_0xfbe5('0x89')];_0x34fdba[_0xfbe5('0x88')]=!![];_0x34fdba[_0xfbe5('0x99')]=![];_0x34fdba[_0xfbe5('0x9a')]=null;if(!_0x34fdba['transfer']){if(_0x4f558c[_0xfbe5('0x9b')]==_0xfbe5('0x9c')){_0x34fdba['queuecallerexitreason']='COMPLETED';logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x34fdba[_0xfbe5('0x51')],_0x34fdba['type']);}else{if(_[_0xfbe5('0x9d')](_0x4f558c[_0xfbe5('0x3c')][_0xfbe5('0x9e')](),_0xfbe5('0x9f'))){if(this[_0xfbe5('0x10')][_0x4f558c[_0xfbe5('0xa0')]]){var _0x598e73=_[_0xfbe5('0x87')](this[_0xfbe5('0x10')][_0x4f558c['linkedid']]);_0x598e73[_0xfbe5('0x88')]=![];_0x598e73[_0xfbe5('0x99')]=!![];_0x598e73[_0xfbe5('0x9a')]=moment(_0x34fdba[_0xfbe5('0xa1')])['add'](_0x4f558c[_0xfbe5('0x89')],'seconds')['format'](_0xfbe5('0x7c'));_0x598e73[_0xfbe5('0x55')]='FORWARDTRANSFER';_0x598e73['transfer']=!![];_0x598e73[_0xfbe5('0xa2')]='FORWARD';_0x598e73[_0xfbe5('0xa3')]=_0x4f558c[_0xfbe5('0xa4')];_0x598e73['transferuniqueid']=_0x4f558c[_0xfbe5('0x4e')];logger['info'](_0xfbe5('0xa5'),_0x598e73['name'],_0x598e73[_0xfbe5('0x58')]);var _0xadb3f0=this[_0xfbe5('0x10')][_0x4f558c[_0xfbe5('0xa0')]];this[_0xfbe5('0x10')][_0x4f558c[_0xfbe5('0xa0')]]=this[_0xfbe5('0x10')][_0x4f558c[_0xfbe5('0x4e')]];this['queueReports'][_0x4f558c[_0xfbe5('0x4e')]]=_0xadb3f0;}}else{_0x34fdba[_0xfbe5('0x55')]=_0xfbe5('0xa6')+_0x4f558c[_0xfbe5('0x9b')][_0xfbe5('0xa7')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x34fdba['name'],_0x34fdba[_0xfbe5('0x58')],_0x34fdba[_0xfbe5('0x55')]);}}}this[_0xfbe5('0x12')][_0x4f558c[_0xfbe5('0x4e')]]=_0x34fdba;this[_0xfbe5('0x47')](_0x34fdba,_0xfbe5('0xa8'));}}}catch(_0xf1cd33){logger[_0xfbe5('0x43')](_0xfbe5('0x95'),_0x4f558c[_0xfbe5('0x4e')],util[_0xfbe5('0x41')](_0xf1cd33,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfbe5('0xb')][_0xfbe5('0x24')]=function(_0x3f062f){try{if(this[_0xfbe5('0x6f')](_0x3f062f)){logger[_0xfbe5('0x4b')](_0xfbe5('0xa9'),_0x3f062f[_0xfbe5('0x4e')],util['inspect'](_0x3f062f,{'showHidden':![],'depth':null}));this['addVariable'](_0x3f062f['uniqueid'],_[_0xfbe5('0x84')](_0x3f062f[_0xfbe5('0xaa')])[0x0],_0x3f062f[_0xfbe5('0xab')]);if(this[_0xfbe5('0x10')][_0x3f062f[_0xfbe5('0x4e')]]){var _0x1e0664=_[_0xfbe5('0x87')](this['queueReports'][_0x3f062f['uniqueid']]);if(_0x1e0664){if(this[_0xfbe5('0x6f')](_0x3f062f['variable'])&&this['isNotNull'](_0x3f062f[_0xfbe5('0xaa')][_0xfbe5('0xac')])){switch(_0x3f062f[_0xfbe5('0xab')]){case _0xfbe5('0xad'):_0x1e0664['queuecallerexit']=![];_0x1e0664['queuecallerexitAt']=null;break;case _0xfbe5('0xae'):_0x1e0664[_0xfbe5('0xaf')]=_0xfbe5('0xb0');_0x1e0664[_0xfbe5('0x99')]=!![];_0x1e0664[_0xfbe5('0x9a')]=moment()[_0xfbe5('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e0664[_0xfbe5('0x8f')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));logger[_0xfbe5('0x4b')](_0xfbe5('0xb1'),_0x3f062f[_0xfbe5('0x4e')],util['inspect'](_0x1e0664,{'showHidden':![],'depth':null}));ami[_0xfbe5('0x49')]('custom:timeout',_0x1e0664);break;default:_0x1e0664[_0xfbe5('0x99')]=!![];_0x1e0664[_0xfbe5('0x9a')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));_0x1e0664[_0xfbe5('0x8f')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));}_0x1e0664[_0xfbe5('0x1d')]=![];_0x1e0664[_0xfbe5('0x8b')]=null;_0x1e0664[_0xfbe5('0x55')]=_0x3f062f[_0xfbe5('0xab')];this['channels'][_0x3f062f[_0xfbe5('0x4e')]]=_0x1e0664;this[_0xfbe5('0x47')](_0x1e0664,'varset');}else if(this[_0xfbe5('0x6f')](_0x3f062f['variable'])&&this[_0xfbe5('0x6f')](_0x3f062f[_0xfbe5('0xaa')][_0xfbe5('0xb2')])){if(!_0x1e0664[_0xfbe5('0x1d')]){_0x1e0664[_0xfbe5('0x99')]=!![];_0x1e0664[_0xfbe5('0x9a')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));_0x1e0664['queuecallerexitreason']=_0xfbe5('0xb3');_0x1e0664[_0xfbe5('0x8f')]=moment()[_0xfbe5('0x4f')](_0xfbe5('0x7c'));this[_0xfbe5('0x12')][_0x3f062f[_0xfbe5('0x4e')]]=_0x1e0664;}}logger[_0xfbe5('0x80')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x3f062f[_0xfbe5('0x4e')],_0x1e0664[_0xfbe5('0x51')],_0x1e0664[_0xfbe5('0x58')],_[_0xfbe5('0x84')](_0x3f062f['variable'])[0x0],_0x3f062f['value']);_0x1e0664[_0xfbe5('0x16')]=this['variables'][_0x3f062f[_0xfbe5('0x4e')]];}}}}catch(_0xf8629e){logger[_0xfbe5('0x43')]('[%s][voiceQueueReport][varset]',_0x3f062f['uniqueid'],util[_0xfbe5('0x41')](_0xf8629e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xfbe5('0xb4')]=function(_0x113434,_0x29ec29,_0x3ac8b2){var _0x3c6e66=[_0xfbe5('0xb5'),_0xfbe5('0xb6'),_0xfbe5('0xb7'),_0xfbe5('0xb8'),_0xfbe5('0xb9'),_0xfbe5('0xba'),_0xfbe5('0xbb'),_0xfbe5('0xbc'),_0xfbe5('0xbd'),_0xfbe5('0xbe'),_0xfbe5('0xbf'),_0xfbe5('0xc0'),_0xfbe5('0xc1'),_0xfbe5('0xc2'),_0xfbe5('0xc3'),_0xfbe5('0xc4'),'membername',_0xfbe5('0xc5'),'memberrealtime'];if(!_[_0xfbe5('0x3a')](_0x29ec29)&&!_['includes'](_0x3c6e66,_0x29ec29)){if(_['isUndefined'](this['variables'][_0x113434])){this['variables'][_0x113434]={};}this[_0xfbe5('0x16')][_0x113434][_0x29ec29]=_0x3ac8b2;}};VoiceQueueReport[_0xfbe5('0xb')][_0xfbe5('0xc6')]=function(_0x1281df,_0x1eab8c,_0x1bf886){var _0x3b158b={};for(var _0x15f8e9=0x0;_0x15f8e9=0x0?moment(_0x2ff7a1['endtime'])[_0xd8b5('0xc')](_0x2ff7a1[_0xd8b5('0x1c')],_0xd8b5('0xe')):null,'data1':'outbound','data2':_0x2ff7a1[_0xd8b5('0x13')],'data3':_0x2ff7a1['exten'],'data4':_0x2ff7a1[_0xd8b5('0x1e')]||null,'role':_0xd8b5('0x12'),'internal':_0x2ff7a1['accountcode']?_[_0xd8b5('0x14')](_0x2ff7a1[_0xd8b5('0x13')]):undefined,'uniqueid':_0x2ff7a1['uniqueid']},'log':_0xd8b5('0x16')});}; \ No newline at end of file +var _0x7a47=['moment','lodash','util','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','isNil','format','SIP/%s','lastAssignedTo','interface','queuecallerleaveAt','seconds','calleridnum','queue','accountcode','toNumber','uniqueid','membername','TALKING','starttime','endtime','diff','agent'];(function(_0x1a786f,_0x316073){var _0x2898c1=function(_0x4dd474){while(--_0x4dd474){_0x1a786f['push'](_0x1a786f['shift']());}};_0x2898c1(++_0x316073);}(_0x7a47,0x11e));var _0x77a4=function(_0xd5e005,_0x2d3ce4){_0xd5e005=_0xd5e005-0x0;var _0xbca7aa=_0x7a47[_0xd5e005];return _0xbca7aa;};'use strict';var moment=require(_0x77a4('0x0'));var _=require(_0x77a4('0x1'));var util=require(_0x77a4('0x2'));var client=require('../client');exports['voiceQueueReport']=function(_0x4493e8){var _0x3a072f=_0x4493e8[_0x77a4('0x3')]||_0x4493e8[_0x77a4('0x4')];return client[_0x77a4('0x5')](_0x77a4('0x6'),{'body':{'channel':_0x77a4('0x7'),'membername':_0x4493e8['lastAssignedTo'],'interface':_[_0x77a4('0x8')](_0x4493e8['interface'])?util[_0x77a4('0x9')](_0x77a4('0xa'),_0x4493e8[_0x77a4('0xb')]):_0x4493e8[_0x77a4('0xc')],'type':'TALKING','enterAt':_0x4493e8[_0x77a4('0xd')],'exitAt':_0x3a072f,'duration':moment(_0x3a072f)['diff'](_0x4493e8[_0x77a4('0xd')],_0x77a4('0xe')),'data1':'inbound','data2':_0x4493e8[_0x77a4('0xf')],'data3':_0x4493e8['exten'],'data4':null,'data5':_0x4493e8[_0x77a4('0x10')],'role':'agent','internal':_0x4493e8[_0x77a4('0x11')]?_[_0x77a4('0x12')](_0x4493e8[_0x77a4('0x11')]):undefined,'uniqueid':_0x4493e8[_0x77a4('0x13')]},'log':_0x77a4('0x6')});};exports['voiceDialReport']=function(_0x582dd1){return client[_0x77a4('0x5')](_0x77a4('0x6'),{'body':{'channel':_0x77a4('0x7'),'membername':_0x582dd1[_0x77a4('0x14')],'interface':_0x582dd1['interface'],'type':_0x77a4('0x15'),'enterAt':_0x582dd1[_0x77a4('0x16')],'exitAt':_0x582dd1[_0x77a4('0x17')],'duration':moment(_0x582dd1[_0x77a4('0x17')])[_0x77a4('0x18')](_0x582dd1[_0x77a4('0x16')],_0x77a4('0xe'))>=0x0?moment(_0x582dd1[_0x77a4('0x17')])[_0x77a4('0x18')](_0x582dd1[_0x77a4('0x16')],_0x77a4('0xe')):null,'data1':'outbound','data2':_0x582dd1['accountcode'],'data3':_0x582dd1['exten'],'data4':_0x582dd1['dialstring']||null,'role':_0x77a4('0x19'),'internal':_0x582dd1['accountcode']?_[_0x77a4('0x12')](_0x582dd1[_0x77a4('0x11')]):undefined,'uniqueid':_0x582dd1[_0x77a4('0x13')]},'log':_0x77a4('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index c7788a2..de7b7c1 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 _0xe195=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','Request'];(function(_0x109dc3,_0xf6b661){var _0x41a1c=function(_0x558639){while(--_0x558639){_0x109dc3['push'](_0x109dc3['shift']());}};_0x41a1c(++_0xf6b661);}(_0xe195,0x1c6));var _0x5e19=function(_0x241c4a,_0x4d97e3){_0x241c4a=_0x241c4a-0x0;var _0x3e2544=_0xe195[_0x241c4a];return _0x3e2544;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x5e19('0x0')](_0x5e19('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x5e19('0x2'),_0x5e19('0x3')]},'log':_0x5e19('0x4')});}; \ No newline at end of file +var _0x41fa=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x41fa,0x1f1));var _0xa41f=function(_0x206338,_0x2d800b){_0x206338=_0x206338-0x0;var _0x2b87f2=_0x41fa[_0x206338];return _0x2b87f2;};'use strict';var client=require(_0xa41f('0x0'));exports[_0xa41f('0x1')]=function(){return client[_0xa41f('0x2')](_0xa41f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa41f('0x4'),_0xa41f('0x5')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 5fb86fc..2330a64 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 _0x9ff3=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x3db61b,_0x19c164){var _0x5ce7c1=function(_0x26dfb9){while(--_0x26dfb9){_0x3db61b['push'](_0x3db61b['shift']());}};_0x5ce7c1(++_0x19c164);}(_0x9ff3,0x104));var _0x39ff=function(_0x379edb,_0xd2ff59){_0x379edb=_0x379edb-0x0;var _0x30b6e3=_0x9ff3[_0x379edb];return _0x30b6e3;};'use strict';var client=require(_0x39ff('0x0'));exports[_0x39ff('0x1')]=function(_0x372745){return function(_0x575aa0){return client[_0x39ff('0x2')](_0x39ff('0x3'),{'options':{'raw':!![],'attributes':['id',_0x39ff('0x4'),_0x39ff('0x5')]},'log':_0x39ff('0x3')});};}; \ No newline at end of file +var _0x7f0d=['name','html','GetTemplate'];(function(_0x573a19,_0x5939b5){var _0x1e4cc4=function(_0x54e19e){while(--_0x54e19e){_0x573a19['push'](_0x573a19['shift']());}};_0x1e4cc4(++_0x5939b5);}(_0x7f0d,0x89));var _0xd7f0=function(_0x6252a5,_0x5dea1d){_0x6252a5=_0x6252a5-0x0;var _0x1feb94=_0x7f0d[_0x6252a5];return _0x1feb94;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x548c1f){return function(_0x4949c1){return client['Request'](_0xd7f0('0x0'),{'options':{'raw':!![],'attributes':['id',_0xd7f0('0x1'),_0xd7f0('0x2')]},'log':_0xd7f0('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 26e6ced..7ee0dd9 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 _0xd1de=['AllConditions','operator','value','AnyConditions','field','Action','Actions','data1','data3','data4','data5','data6','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xd1de,0x124));var _0xed1d=function(_0x320f5f,_0x3166ca){_0x320f5f=_0x320f5f-0x0;var _0x16ff4c=_0xd1de[_0x320f5f];return _0x16ff4c;};'use strict';var client=require(_0xed1d('0x0'));exports[_0xed1d('0x1')]=function(_0x3bead1){return function(_0x3bc8da){return client[_0xed1d('0x2')](_0xed1d('0x3'),{'options':{'raw':![],'attributes':['id',_0xed1d('0x4'),_0xed1d('0x5'),_0xed1d('0x6')],'include':[{'model':_0xed1d('0x7'),'as':_0xed1d('0x8'),'attributes':['id','field',_0xed1d('0x9'),_0xed1d('0xa')]},{'model':'Condition','as':_0xed1d('0xb'),'attributes':['id',_0xed1d('0xc'),_0xed1d('0x9'),_0xed1d('0xa')]},{'model':_0xed1d('0xd'),'as':_0xed1d('0xe'),'attributes':['id','action',_0xed1d('0xf'),'data2',_0xed1d('0x10'),_0xed1d('0x11'),_0xed1d('0x12'),_0xed1d('0x13'),'data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x5d42=['GetTrigger','../client','getTriggers','Request','name','channel','status','Condition','operator','value','AnyConditions','Action','data1','data4','data5','data6','data7'];(function(_0x46661a,_0x301e97){var _0x6a59ea=function(_0x52ba77){while(--_0x52ba77){_0x46661a['push'](_0x46661a['shift']());}};_0x6a59ea(++_0x301e97);}(_0x5d42,0x144));var _0x25d4=function(_0x40fa5e,_0x3c0b6a){_0x40fa5e=_0x40fa5e-0x0;var _0x317e8f=_0x5d42[_0x40fa5e];return _0x317e8f;};'use strict';var client=require(_0x25d4('0x0'));exports[_0x25d4('0x1')]=function(_0x3eeeff){return function(_0x498a27){return client[_0x25d4('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x25d4('0x3'),_0x25d4('0x4'),_0x25d4('0x5')],'include':[{'model':_0x25d4('0x6'),'as':'AllConditions','attributes':['id','field',_0x25d4('0x7'),_0x25d4('0x8')]},{'model':'Condition','as':_0x25d4('0x9'),'attributes':['id','field','operator',_0x25d4('0x8')]},{'model':_0x25d4('0xa'),'as':'Actions','attributes':['id','action',_0x25d4('0xb'),'data2','data3',_0x25d4('0xc'),_0x25d4('0xd'),_0x25d4('0xe'),_0x25d4('0xf')]}]},'log':_0x25d4('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 90f6f5c..5647ac3 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 _0x4d9e=['../client','GetTrunk','registry','defaultuser'];(function(_0x2876c0,_0x118594){var _0xe572e2=function(_0x16ab89){while(--_0x16ab89){_0x2876c0['push'](_0x2876c0['shift']());}};_0xe572e2(++_0x118594);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x16d65c,_0x296e81){_0x16d65c=_0x16d65c-0x0;var _0x39f9ab=_0x4d9e[_0x16d65c];return _0x39f9ab;};'use strict';var client=require(_0xe4d9('0x0'));exports['getTrunks']=function(_0x4da72e){return function(_0x46e8c2){return client['Request'](_0xe4d9('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xe4d9('0x2'),_0xe4d9('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xc6f6=['../client','getTrunks','GetTrunk','registry','defaultuser'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0xc6f6,0xeb));var _0x6c6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc6f6[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x6c6f('0x0'));exports[_0x6c6f('0x1')]=function(_0x82014a){return function(_0x47e593){return client['Request'](_0x6c6f('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x6c6f('0x3'),_0x6c6f('0x4')]},'log':_0x6c6f('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 3394237..a316a52 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xe706,0xa3));var _0x6e70=function(_0x10e3f7,_0x353b97){_0x10e3f7=_0x10e3f7-0x0;var _0x3ee398=_0xe706[_0x10e3f7];return _0x3ee398;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x1f862d,_0x108173){var _0x97964c=function(_0x56f563){while(--_0x56f563){_0x1f862d['push'](_0x1f862d['shift']());}};_0x97964c(++_0x108173);}(_0x70e0,0x17b));var _0x070e=function(_0x2994d0,_0x44b533){_0x2994d0=_0x2994d0-0x0;var _0x2e2462=_0x70e0[_0x2994d0];return _0x2e2462;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 9deb24f..dde2e51 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 _0x432d=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x559f51,_0x46e5e8){var _0x1262f3=function(_0x2beed3){while(--_0x2beed3){_0x559f51['push'](_0x559f51['shift']());}};_0x1262f3(++_0x46e5e8);}(_0x432d,0x12a));var _0xd432=function(_0x2e0763,_0x37e6e4){_0x2e0763=_0x2e0763-0x0;var _0x189643=_0x432d[_0x2e0763];return _0x189643;};'use strict';var client=require(_0xd432('0x0'));exports[_0xd432('0x1')]=function(_0x589793){return client[_0xd432('0x2')]('CreateVoiceAgentReport',{'body':_0x589793,'log':_0xd432('0x3')});};exports[_0xd432('0x4')]=function(_0x1ad9f3,_0x4b3e24,_0x30700b){return client[_0xd432('0x2')](_0xd432('0x5'),{'body':_0x1ad9f3,'options':{'where':{'uniqueid':_0x4b3e24,'interface':_0x30700b,'agentcomplete':!![]}},'log':_0xd432('0x5')});}; \ No newline at end of file +var _0x74f0=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x5c38a2,_0x40e4e4){var _0x22869c=function(_0x4601ce){while(--_0x4601ce){_0x5c38a2['push'](_0x5c38a2['shift']());}};_0x22869c(++_0x40e4e4);}(_0x74f0,0xfd));var _0x074f=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x74f0[_0x170772];return _0x3ef69c;};'use strict';var client=require(_0x074f('0x0'));exports[_0x074f('0x1')]=function(_0xf3704c){return client[_0x074f('0x2')]('CreateVoiceAgentReport',{'body':_0xf3704c,'log':_0x074f('0x3')});};exports[_0x074f('0x4')]=function(_0x5b96a,_0x465d5c,_0x5239f5){return client[_0x074f('0x2')](_0x074f('0x5'),{'body':_0x5b96a,'options':{'where':{'uniqueid':_0x465d5c,'interface':_0x5239f5,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index fbe6cf8..78bea7d 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 _0xb351=['GetVoiceCallReports','util','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','billableseconds'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xb351,0x94));var _0x1b35=function(_0x39d56f,_0x2bacbe){_0x39d56f=_0x39d56f-0x0;var _0x18484c=_0xb351[_0x39d56f];return _0x18484c;};'use strict';var moment=require('moment');var util=require(_0x1b35('0x0'));var _=require(_0x1b35('0x1'));var client=require('../client');exports[_0x1b35('0x2')]=function(_0x47856c){return client[_0x1b35('0x3')](_0x1b35('0x4'),{'body':_[_0x1b35('0x5')](_0x47856c,{'source':_0x47856c[_0x1b35('0x6')],'destinationcontext':_0x47856c[_0x1b35('0x7')],'callerid':_0x47856c[_0x1b35('0x8')],'amaflags':_0x1b35('0x9')}),'log':_0x1b35('0x4')});};exports[_0x1b35('0xa')]=function(){return function(){return client[_0x1b35('0x3')](_0x1b35('0xb'),{'options':{'where':{'type':[_0x1b35('0xc')],'createdAt':{'$between':[moment()[_0x1b35('0xd')](_0x1b35('0xe'))[_0x1b35('0xf')](_0x1b35('0x10')),moment()['endOf']('day')[_0x1b35('0xf')](_0x1b35('0x10'))]}},'attributes':[_0x1b35('0x11'),_0x1b35('0x12'),'duration',_0x1b35('0x13')]},'log':_0x1b35('0x14')});};}; \ No newline at end of file +var _0xbac8=['DOCUMENTATION','Request','GetVoiceCallReport','startOf','day','endOf','format','YYYY-MM-DD\x20HH:mm:ss','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','CreateVoiceCallReport','merge','context'];(function(_0xf8dbfa,_0x2aa864){var _0xf44120=function(_0x36f1ec){while(--_0x36f1ec){_0xf8dbfa['push'](_0xf8dbfa['shift']());}};_0xf44120(++_0x2aa864);}(_0xbac8,0x1cd));var _0x8bac=function(_0x2e127a,_0x5548d5){_0x2e127a=_0x2e127a-0x0;var _0x221148=_0xbac8[_0x2e127a];return _0x221148;};'use strict';var moment=require(_0x8bac('0x0'));var util=require(_0x8bac('0x1'));var _=require(_0x8bac('0x2'));var client=require(_0x8bac('0x3'));exports['create']=function(_0x5986da){return client['Request'](_0x8bac('0x4'),{'body':_[_0x8bac('0x5')](_0x5986da,{'source':_0x5986da['calleridnum'],'destinationcontext':_0x5986da[_0x8bac('0x6')],'callerid':_0x5986da['callerid'],'amaflags':_0x8bac('0x7')}),'log':_0x8bac('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x8bac('0x8')](_0x8bac('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x8bac('0xa')](_0x8bac('0xb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x8bac('0xc')](_0x8bac('0xb'))[_0x8bac('0xd')](_0x8bac('0xe'))]}},'attributes':['type','disposition',_0x8bac('0xf'),_0x8bac('0x10')]},'log':_0x8bac('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 7f5a451..fadea32 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 _0x08f4=['CreateVoiceDialReport','create'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x08f4,0xd3));var _0x408f=function(_0x18b1d3,_0x4b42fc){_0x18b1d3=_0x18b1d3-0x0;var _0x5144c7=_0x08f4[_0x18b1d3];return _0x5144c7;};'use strict';var client=require('../client');exports[_0x408f('0x0')]=function(_0x4edd67){return client['Request'](_0x408f('0x1'),{'body':_0x4edd67,'log':_0x408f('0x1')});}; \ No newline at end of file +var _0x17d6=['Request','CreateVoiceDialReport','../client'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x17d6,0x86));var _0x617d=function(_0x584bb7,_0x56f051){_0x584bb7=_0x584bb7-0x0;var _0x302722=_0x17d6[_0x584bb7];return _0x302722;};'use strict';var client=require(_0x617d('0x0'));exports['create']=function(_0x2c4665){return client[_0x617d('0x1')]('CreateVoiceDialReport',{'body':_0x2c4665,'log':_0x617d('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index ee8fb56..b41bf1e 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 _0xe3ee=['GetVoiceExtension','getVoiceExtensions','Request'];(function(_0x24c396,_0x2c9192){var _0x148e0c=function(_0x5ca55a){while(--_0x5ca55a){_0x24c396['push'](_0x24c396['shift']());}};_0x148e0c(++_0x2c9192);}(_0xe3ee,0x116));var _0xee3e=function(_0x53b3e0,_0x522724){_0x53b3e0=_0x53b3e0-0x0;var _0x1fd4ce=_0xe3ee[_0x53b3e0];return _0x1fd4ce;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0xee3e('0x0')](_0xee3e('0x1'),{'options':{'raw':!![],'attributes':['id','exten','recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xee3e('0x2')});};}; \ No newline at end of file +var _0xcea2=['getVoiceExtensions','../client','Request','exten','recordingFormat'];(function(_0xcdac34,_0x43f665){var _0x269d23=function(_0x3f2d6f){while(--_0x3f2d6f){_0xcdac34['push'](_0xcdac34['shift']());}};_0x269d23(++_0x43f665);}(_0xcea2,0x15a));var _0x2cea=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xcea2[_0x500419];return _0x241c1a;};'use strict';var client=require(_0x2cea('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x2cea('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x2cea('0x2'),_0x2cea('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x2cea('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index ffa90fb..10e101d 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 _0x05e4=['timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','callAdditionalPhoneAfterMin','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence'];(function(_0x4cd4a8,_0xa2e25a){var _0x2c4f84=function(_0x474116){while(--_0x474116){_0x4cd4a8['push'](_0x4cd4a8['shift']());}};_0x2c4f84(++_0xa2e25a);}(_0x05e4,0x1ba));var _0x405e=function(_0x404c6e,_0x42c0e1){_0x404c6e=_0x404c6e-0x0;var _0x2b6c07=_0x05e4[_0x404c6e];return _0x2b6c07;};'use strict';var client=require('../client');exports[_0x405e('0x0')]=function(){return function(){return client[_0x405e('0x1')](_0x405e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x405e('0x3'),_0x405e('0x4'),_0x405e('0x5'),_0x405e('0x6'),_0x405e('0x7'),_0x405e('0x8'),_0x405e('0x9'),_0x405e('0xa'),'dialLimitQueue',_0x405e('0xb'),_0x405e('0xc'),_0x405e('0xd'),'dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0x405e('0xe'),_0x405e('0xf'),_0x405e('0x10'),_0x405e('0x11'),_0x405e('0x12'),_0x405e('0x13'),_0x405e('0x14'),'dialBusyRetryFrequency',_0x405e('0x15'),'dialNoAnswerRetryFrequency',_0x405e('0x16'),'dialTimezone',_0x405e('0x17'),_0x405e('0x18'),_0x405e('0x19'),_0x405e('0x1a'),'dialAMDInitialSilence',_0x405e('0x1b'),'dialAMDAfterGreetingSilence',_0x405e('0x1c'),'dialAMDMinWordLength',_0x405e('0x1d'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x405e('0x1e'),'dialRecallMeTimeout',_0x405e('0x1f'),_0x405e('0x20'),_0x405e('0x21'),'dialAgiAfterHangupClient',_0x405e('0x22'),_0x405e('0x6'),'strategy',_0x405e('0x23'),'dialCutDigit',_0x405e('0x24'),_0x405e('0x25'),_0x405e('0x26'),_0x405e('0x27'),_0x405e('0x28'),_0x405e('0x29'),_0x405e('0x2a'),_0x405e('0x2b'),'dialAgentRejectMaxRetry',_0x405e('0x2c'),'mandatoryDisposition',_0x405e('0x2d'),_0x405e('0x2e'),_0x405e('0x2f'),'dialPreviewRecallmeReminder',_0x405e('0x30')],'include':[{'model':_0x405e('0x31'),'as':_0x405e('0x31'),'attributes':['id',_0x405e('0x32'),_0x405e('0x33'),_0x405e('0x34')]},{'model':_0x405e('0x35'),'as':_0x405e('0x36'),'attributes':['id',_0x405e('0x32')]},{'model':'Trunk','as':_0x405e('0x37'),'attributes':['id',_0x405e('0x32'),'callerid',_0x405e('0x34')]},{'model':_0x405e('0x38'),'as':_0x405e('0x38'),'attributes':['id',_0x405e('0x32')],'include':[{'model':_0x405e('0x38'),'as':_0x405e('0x39'),'attributes':['id',_0x405e('0x32'),_0x405e('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x2fe3=['dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','TrunkBackup','Interval','../client','getVoiceQueues','name','acwTimeout','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','strategy'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x2fe3,0x87));var _0x32fe=function(_0x37593f,_0x2e505b){_0x37593f=_0x37593f-0x0;var _0x33c524=_0x2fe3[_0x37593f];return _0x33c524;};'use strict';var client=require(_0x32fe('0x0'));exports[_0x32fe('0x1')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x32fe('0x2'),'acw',_0x32fe('0x3'),'autopause','monitor_format',_0x32fe('0x4'),_0x32fe('0x5'),'dialMethod',_0x32fe('0x6'),_0x32fe('0x7'),_0x32fe('0x8'),_0x32fe('0x9'),_0x32fe('0xa'),_0x32fe('0xb'),'dialOriginateCallerIdName',_0x32fe('0xc'),_0x32fe('0xd'),_0x32fe('0xe'),_0x32fe('0xf'),'dialQueueProject','dialCongestionMaxRetry',_0x32fe('0x10'),_0x32fe('0x11'),_0x32fe('0x12'),_0x32fe('0x13'),'dialNoAnswerRetryFrequency',_0x32fe('0x14'),'dialTimezone','dialGlobalInterval',_0x32fe('0x15'),_0x32fe('0x16'),_0x32fe('0x17'),_0x32fe('0x18'),_0x32fe('0x19'),_0x32fe('0x1a'),_0x32fe('0x1b'),_0x32fe('0x1c'),_0x32fe('0x1d'),_0x32fe('0x1e'),_0x32fe('0x1f'),_0x32fe('0x20'),_0x32fe('0x21'),_0x32fe('0x22'),_0x32fe('0x23'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x32fe('0x24'),_0x32fe('0x25'),'monitor_format',_0x32fe('0x26'),_0x32fe('0x27'),_0x32fe('0x28'),'dialNoSuchNumberMaxRetry',_0x32fe('0x29'),_0x32fe('0x2a'),_0x32fe('0x2b'),_0x32fe('0x2c'),'dialAbandonedRetryFrequency',_0x32fe('0x2d'),'dialMachineRetryFrequency',_0x32fe('0x2e'),_0x32fe('0x2f'),_0x32fe('0x30'),_0x32fe('0x31'),'dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe',_0x32fe('0x32'),_0x32fe('0x33')],'include':[{'model':_0x32fe('0x34'),'as':_0x32fe('0x34'),'attributes':['id',_0x32fe('0x2'),_0x32fe('0x35'),_0x32fe('0x36')]},{'model':_0x32fe('0x37'),'as':'mandatoryDispositionPause','attributes':['id',_0x32fe('0x2')]},{'model':'Trunk','as':_0x32fe('0x38'),'attributes':['id',_0x32fe('0x2'),'callerid',_0x32fe('0x36')]},{'model':_0x32fe('0x39'),'as':_0x32fe('0x39'),'attributes':['id',_0x32fe('0x2')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x32fe('0x2'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 4a9a2b4..40181a5 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(_0x33beb4,_0x43f142){var _0x591f05=function(_0x15c88d){while(--_0x15c88d){_0x33beb4['push'](_0x33beb4['shift']());}};_0x591f05(++_0x43f142);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x30ef7e,_0x4963a5){var _0x244a93=function(_0x4cf486){while(--_0x4cf486){_0x30ef7e['push'](_0x30ef7e['shift']());}};_0x244a93(++_0x4963a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 ab6c0ac..14533ad 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 _0x349b=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x5a7f64,_0x347d57){var _0x3d30f1=function(_0x4bd1d6){while(--_0x4bd1d6){_0x5a7f64['push'](_0x5a7f64['shift']());}};_0x3d30f1(++_0x347d57);}(_0x349b,0xc6));var _0xb349=function(_0x5c9e15,_0x3f4293){_0x5c9e15=_0x5c9e15-0x0;var _0x10077f=_0x349b[_0x5c9e15];return _0x10077f;};'use strict';var client=require('../client');exports[_0xb349('0x0')]=function(_0x2ce25b){return function(){return client[_0xb349('0x1')](_0xb349('0x2'),{'options':{'where':{'VoiceQueueId':_0x2ce25b,'paused':!![]},'raw':!![]},'log':_0xb349('0x0')});};}; \ No newline at end of file +var _0xe398=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x2aaeb1,_0x26224d){var _0x569072=function(_0x1b42d7){while(--_0x1b42d7){_0x2aaeb1['push'](_0x2aaeb1['shift']());}};_0x569072(++_0x26224d);}(_0xe398,0x160));var _0x8e39=function(_0x26ab33,_0x511764){_0x26ab33=_0x26ab33-0x0;var _0x3e639e=_0xe398[_0x26ab33];return _0x3e639e;};'use strict';var client=require(_0x8e39('0x0'));exports[_0x8e39('0x1')]=function(_0x779498){return function(){return client[_0x8e39('0x2')](_0x8e39('0x3'),{'options':{'where':{'VoiceQueueId':_0x779498,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 029a8a5..d419893 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(_0x57606f,_0x21b162){var _0x39af18=function(_0x225b66){while(--_0x225b66){_0x57606f['push'](_0x57606f['shift']());}};_0x39af18(++_0x21b162);}(_0x7a54,0x106));var _0x47a5=function(_0x5d9eaa,_0x4c218b){_0x5d9eaa=_0x5d9eaa-0x0;var _0x259173=_0x7a54[_0x5d9eaa];return _0x259173;};'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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x449549,_0x3f885c){var _0x4fbe40=function(_0x41eed7){while(--_0x41eed7){_0x449549['push'](_0x449549['shift']());}};_0x4fbe40(++_0x3f885c);}(_0x7a54,0x106));var _0x47a5=function(_0x429189,_0x13c66c){_0x429189=_0x429189-0x0;var _0x43f635=_0x7a54[_0x429189];return _0x43f635;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index a4806ac..a0978bf 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 _0x5a46=['transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel'];(function(_0x376efa,_0x1bceb7){var _0x1d8e2d=function(_0x2e5716){while(--_0x2e5716){_0x376efa['push'](_0x376efa['shift']());}};_0x1d8e2d(++_0x1bceb7);}(_0x5a46,0xe0));var _0x65a4=function(_0xaf4441,_0x4b477c){_0xaf4441=_0xaf4441-0x0;var _0x26dbea=_0x5a46[_0xaf4441];return _0x26dbea;};'use strict';var client=require(_0x65a4('0x0'));exports[_0x65a4('0x1')]={};exports['blindTransfer']=function(_0x732ce8){return client[_0x65a4('0x2')](_0x65a4('0x3'),{'body':{'result':_0x732ce8['result'],'transfererchannel':_0x732ce8[_0x65a4('0x4')],'transferercalleridnum':_0x732ce8[_0x65a4('0x5')],'transferercalleridname':_0x732ce8[_0x65a4('0x6')],'transfererconnectedlinenum':_0x732ce8[_0x65a4('0x7')],'transfererconnectedlinename':_0x732ce8['transfererconnectedlinename'],'transfereraccountcode':_0x732ce8['transfereraccountcode'],'transferercontext':_0x732ce8[_0x65a4('0x8')],'transfererexten':_0x732ce8[_0x65a4('0x9')],'transfererlinkedid':_0x732ce8['transfererlinkedid'],'transfereechannel':_0x732ce8[_0x65a4('0xa')],'transfereecalleridnum':_0x732ce8[_0x65a4('0xb')],'transfereecalleridname':_0x732ce8[_0x65a4('0xc')],'transfereeconnectedlinenum':_0x732ce8['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x732ce8[_0x65a4('0xd')],'transfereeaccountcode':_0x732ce8[_0x65a4('0xe')],'transfereecontext':_0x732ce8[_0x65a4('0xf')],'transfereeexten':_0x732ce8['transfereeexten'],'transfereelinkedid':_0x732ce8[_0x65a4('0x10')],'isexternal':_0x732ce8[_0x65a4('0x11')],'context':_0x732ce8[_0x65a4('0x12')],'extension':_0x732ce8[_0x65a4('0x13')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x446075){return client['Request'](_0x65a4('0x3'),{'body':{'result':_0x446075['result'],'transfererchannel':_0x446075[_0x65a4('0x14')],'transferercalleridnum':_0x446075[_0x65a4('0x15')],'transferercalleridname':_0x446075[_0x65a4('0x16')],'transfererconnectedlinenum':_0x446075['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x446075[_0x65a4('0x17')],'transfereraccountcode':_0x446075['origtransfereraccountcode'],'transferercontext':_0x446075[_0x65a4('0x18')],'transfererexten':_0x446075[_0x65a4('0x19')],'transfererlinkedid':_0x446075[_0x65a4('0x1a')],'transfereechannel':_0x446075[_0x65a4('0x1b')],'transfereecalleridnum':_0x446075['transfertargetcalleridnum'],'transfereecalleridname':_0x446075[_0x65a4('0x1c')],'transfereeconnectedlinenum':_0x446075['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x446075['transfertargetconnectedlinename'],'transfereeaccountcode':_0x446075[_0x65a4('0x1d')],'transfereecontext':_0x446075[_0x65a4('0x1e')],'transfereeexten':_0x446075[_0x65a4('0x1f')],'transfereelinkedid':_0x446075[_0x65a4('0x20')],'isexternal':_0x446075[_0x65a4('0x11')],'context':_0x446075[_0x65a4('0x21')],'extension':_0x446075[_0x65a4('0x22')],'type':_0x65a4('0x23')},'log':_0x65a4('0x3')});}; \ No newline at end of file +var _0xd1d7=['transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','extension','CreateVoiceTransferReport','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','attended','blindTransfer','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xd1d7,0xbc));var _0x7d1d=function(_0x4d4a74,_0x344a11){_0x4d4a74=_0x4d4a74-0x0;var _0x5491d8=_0xd1d7[_0x4d4a74];return _0x5491d8;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x7d1d('0x0')]=function(_0x252ee2){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x252ee2[_0x7d1d('0x1')],'transfererchannel':_0x252ee2[_0x7d1d('0x2')],'transferercalleridnum':_0x252ee2['transferercalleridnum'],'transferercalleridname':_0x252ee2[_0x7d1d('0x3')],'transfererconnectedlinenum':_0x252ee2[_0x7d1d('0x4')],'transfererconnectedlinename':_0x252ee2[_0x7d1d('0x5')],'transfereraccountcode':_0x252ee2[_0x7d1d('0x6')],'transferercontext':_0x252ee2[_0x7d1d('0x7')],'transfererexten':_0x252ee2[_0x7d1d('0x8')],'transfererlinkedid':_0x252ee2[_0x7d1d('0x9')],'transfereechannel':_0x252ee2[_0x7d1d('0xa')],'transfereecalleridnum':_0x252ee2[_0x7d1d('0xb')],'transfereecalleridname':_0x252ee2[_0x7d1d('0xc')],'transfereeconnectedlinenum':_0x252ee2[_0x7d1d('0xd')],'transfereeconnectedlinename':_0x252ee2['transfereeconnectedlinename'],'transfereeaccountcode':_0x252ee2[_0x7d1d('0xe')],'transfereecontext':_0x252ee2[_0x7d1d('0xf')],'transfereeexten':_0x252ee2[_0x7d1d('0x10')],'transfereelinkedid':_0x252ee2[_0x7d1d('0x11')],'isexternal':_0x252ee2['isexternal'],'context':_0x252ee2['context'],'extension':_0x252ee2[_0x7d1d('0x12')],'type':'blind'},'log':_0x7d1d('0x13')});};exports[_0x7d1d('0x14')]=function(_0x4d93bd){return client[_0x7d1d('0x15')]('CreateVoiceTransferReport',{'body':{'result':_0x4d93bd[_0x7d1d('0x1')],'transfererchannel':_0x4d93bd[_0x7d1d('0x16')],'transferercalleridnum':_0x4d93bd[_0x7d1d('0x17')],'transferercalleridname':_0x4d93bd[_0x7d1d('0x18')],'transfererconnectedlinenum':_0x4d93bd[_0x7d1d('0x19')],'transfererconnectedlinename':_0x4d93bd[_0x7d1d('0x1a')],'transfereraccountcode':_0x4d93bd[_0x7d1d('0x1b')],'transferercontext':_0x4d93bd[_0x7d1d('0x1c')],'transfererexten':_0x4d93bd['secondtransfererexten'],'transfererlinkedid':_0x4d93bd[_0x7d1d('0x1d')],'transfereechannel':_0x4d93bd[_0x7d1d('0x1e')],'transfereecalleridnum':_0x4d93bd['transfertargetcalleridnum'],'transfereecalleridname':_0x4d93bd['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4d93bd['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4d93bd[_0x7d1d('0x1f')],'transfereeaccountcode':_0x4d93bd[_0x7d1d('0x20')],'transfereecontext':_0x4d93bd[_0x7d1d('0x21')],'transfereeexten':_0x4d93bd[_0x7d1d('0x22')],'transfereelinkedid':_0x4d93bd[_0x7d1d('0x23')],'isexternal':_0x4d93bd[_0x7d1d('0x24')],'context':_0x4d93bd[_0x7d1d('0x25')],'extension':_0x4d93bd['origtransfererexten'],'type':_0x7d1d('0x26')},'log':_0x7d1d('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 1bbc05a..6fd1288 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 _0x8130=['erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','omit','undefined','voicechannel','find','uniqueid','channel','filename','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','channels','resolve','StopMixMonitor','destinationchannel','%s.%s','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','values','trunks','outboundChannels','run','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','name','timers','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','join','keys','action','Reload','Action','then','message','catch','error','username','pick','command','Command','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8130,0x146));var _0x0813=function(_0x2f8f15,_0x1cfd5d){_0x2f8f15=_0x2f8f15-0x0;var _0x87c1c8=_0x8130[_0x2f8f15];return _0x87c1c8;};'use strict';var _=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var jayson=require('jayson/promise');var schema=require(_0x0813('0x2'));var moment=require(_0x0813('0x3'));var config=require(_0x0813('0x4'));var properties=require(_0x0813('0x5'));var ami=require(_0x0813('0x6'));exports[_0x0813('0x7')]=function(_0x4e66f4,_0x442a9b,_0x578c7c){return new Promise(function(_0x563ee2,_0x306454){var _0x2df45a={'QueuePause':function(_0x2bbdfd){return new Promise(function(_0x19a508){var _0x2ab8f0=util[_0x0813('0x8')](_0x0813('0x9'),'SIP',_0x2bbdfd[_0x0813('0xa')]);if(_0x4e66f4[_0x0813('0xb')]&&_0x4e66f4[_0x0813('0xb')][_0x2ab8f0]&&_0x4e66f4['timers'][_0x2ab8f0]['timer']){_0x4e66f4[_0x0813('0xb')][_0x2ab8f0]['updateAcw']();}if(_0x4e66f4[_0x0813('0xc')][_0x2ab8f0]){_0x4e66f4['agents'][_0x2ab8f0][_0x0813('0xd')]({'statePause':_0x2bbdfd[_0x0813('0xe')]?!![]:![]});}_0x19a508({'code':0xc8,'message':_0x0813('0xf')});});},'Reload':function(_0x230ec7){var _0x5b17f2=this;return new Promise(function(_0x4dcc3a,_0x29bdd8){if(ami[_0x0813('0x10')]()==![]){return _0x29bdd8(_0x5b17f2['error'](0x1f4,[config[_0x0813('0x11')]['ip'],config['asterisk']['username'],_0x0813('0x12')][_0x0813('0x13')]('\x20')));}_0x230ec7=_['pick'](_0x230ec7,_[_0x0813('0x14')](properties['module']));_0x230ec7[_0x0813('0x15')]=_0x0813('0x16');return ami[_0x0813('0x17')](_0x230ec7)[_0x0813('0x18')](function(_0x96a8){_0x4dcc3a({'code':0xc8,'message':_0x96a8[_0x0813('0x19')]});})[_0x0813('0x1a')](function(_0x3e15da){_0x29bdd8(_0x5b17f2['error'](0x1f5,_0x3e15da[_0x0813('0x19')]));});});},'Command':function(_0x555c32){var _0x112720=this;return new Promise(function(_0x14c55c,_0x518923){if(ami[_0x0813('0x10')]()==![]){return _0x518923(_0x112720[_0x0813('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0x0813('0x11')][_0x0813('0x1c')],'ami\x20disconnected'][_0x0813('0x13')]('\x20')));}_0x555c32=_[_0x0813('0x1d')](_0x555c32,_0x0813('0x1e'));_0x555c32[_0x0813('0x15')]=_0x0813('0x1f');return ami['Action'](_0x555c32)[_0x0813('0x18')](function(_0x3aa1b6){_0x14c55c({'code':0xc8,'message':_0x3aa1b6[_0x0813('0x20')]});})['catch'](function(_0x35b3d6){_0x518923(_0x112720['error'](0x1f5,_0x35b3d6['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x2655b6){var _0x50ad7b=[];for(var _0x5eb50e in _0x4e66f4[_0x0813('0x21')]){if(_0x4e66f4[_0x0813('0x21')][_0x0813('0x22')](_0x5eb50e)){var _0x2f8849=_0x4e66f4[_0x0813('0x21')][_0x5eb50e];var _0x1418c7={'id':_0x2f8849['id'],'name':_0x2f8849[_0x0813('0xa')],'strategy':_0x2f8849[_0x0813('0x23')],'answered':_0x2f8849['answered'],'available':_0x2f8849[_0x0813('0x24')],'loggedIn':_0x2f8849[_0x0813('0x25')],'pTalking':_0x2f8849[_0x0813('0x26')],'sumBillable':_0x2f8849[_0x0813('0x27')],'sumDuration':_0x2f8849[_0x0813('0x28')],'sumHoldTime':_0x2f8849[_0x0813('0x29')]||0x0,'talking':_0x2f8849['talking'],'total':_0x2f8849[_0x0813('0x2a')],'type':_0x2f8849[_0x0813('0x2b')],'unmanaged':_0x2f8849['unmanaged'],'abandoned':_0x2f8849['abandoned'],'waiting':_0x2f8849[_0x0813('0x2c')],'loggedInDb':_0x2f8849[_0x0813('0x2d')]};if(_0x2f8849[_0x0813('0x2b')]===_0x0813('0x2e')){_0x1418c7[_0x0813('0x2f')]=_0x2f8849[_0x0813('0x2f')];_0x1418c7['dialMethod']=_0x2f8849[_0x0813('0x30')];_0x1418c7[_0x0813('0x31')]=_0x2f8849['dialOriginateCallerIdName'];_0x1418c7['dialOriginateCallerIdNumber']=_0x2f8849[_0x0813('0x32')];_0x1418c7[_0x0813('0x33')]=_0x2f8849[_0x0813('0x33')];_0x1418c7['dialPrefix']=_0x2f8849[_0x0813('0x34')];_0x1418c7[_0x0813('0x35')]=_0x2f8849['temp'];_0x1418c7['outboundAnswerAgiCallsDay']=_0x2f8849[_0x0813('0x36')];_0x1418c7[_0x0813('0x37')]=_0x2f8849[_0x0813('0x37')];_0x1418c7[_0x0813('0x38')]=_0x2f8849['outboundBlacklistCallsDay'];_0x1418c7[_0x0813('0x39')]=_0x2f8849[_0x0813('0x39')];_0x1418c7[_0x0813('0x3a')]=_0x2f8849[_0x0813('0x3a')];_0x1418c7['outboundDropCallsDayACS']=_0x2f8849['outboundDropCallsDayACS'];_0x1418c7[_0x0813('0x3b')]=_0x2f8849[_0x0813('0x3b')];_0x1418c7[_0x0813('0x3c')]=_0x2f8849['outboundDropCallsDayTimeout'];_0x1418c7[_0x0813('0x3d')]=_0x2f8849[_0x0813('0x3d')];_0x1418c7[_0x0813('0x3e')]=_0x2f8849['outboundNoSuchCallsDay'];_0x1418c7['outboundOriginateFailureCallsDay']=_0x2f8849[_0x0813('0x3f')];_0x1418c7[_0x0813('0x40')]=_0x2f8849[_0x0813('0x40')];_0x1418c7[_0x0813('0x41')]=_0x2f8849[_0x0813('0x41')];_0x1418c7[_0x0813('0x42')]=_0x2f8849['outboundUnknownCallsDay'];_0x1418c7[_0x0813('0x43')]=_0x2f8849['predictiveIntervalAnsweredCalls'];_0x1418c7['predictiveIntervalAvgHoldtime']=_0x2f8849['predictiveIntervalAvgHoldtime'];_0x1418c7[_0x0813('0x44')]=_0x2f8849[_0x0813('0x44')];_0x1418c7['predictiveIntervalDroppedCallsCallersExit']=_0x2f8849['predictiveIntervalDroppedCallsCallersExit'];_0x1418c7[_0x0813('0x45')]=_0x2f8849[_0x0813('0x45')];_0x1418c7[_0x0813('0x46')]=_0x2f8849[_0x0813('0x46')];_0x1418c7[_0x0813('0x47')]=_0x2f8849[_0x0813('0x47')];_0x1418c7[_0x0813('0x48')]=_0x2f8849[_0x0813('0x48')];_0x1418c7[_0x0813('0x49')]=_0x2f8849[_0x0813('0x49')];_0x1418c7['predictiveIntervalPauses']=_0x2f8849['predictiveIntervalPauses'];_0x1418c7['predictiveIntervalAvailable']=_0x2f8849[_0x0813('0x4a')];_0x1418c7[_0x0813('0x4b')]=_0x2f8849['predictiveIntervalTotalCalls'];_0x1418c7[_0x0813('0x19')]=_0x2f8849[_0x0813('0x19')];_0x1418c7[_0x0813('0x4c')]=_0x2f8849['originated'];_0x1418c7[_0x0813('0x4d')]=_0x2f8849[_0x0813('0x4d')];_0x1418c7[_0x0813('0x4e')]=_0x2f8849['erlangCallToSecond'];_0x1418c7[_0x0813('0x4f')]=_0x2f8849[_0x0813('0x4f')];_0x1418c7[_0x0813('0x50')]=_0x2f8849['erlangBusyFactor'];_0x1418c7[_0x0813('0x51')]=_0x2f8849[_0x0813('0x51')];_0x1418c7['startProgressive']=_0x2f8849[_0x0813('0x52')];}if(_0x2f8849[_0x0813('0x53')]){_0x1418c7['Trunk']={'id':_0x2f8849[_0x0813('0x53')]['id'],'name':_0x2f8849['Trunk'][_0x0813('0xa')],'active':_0x2f8849[_0x0813('0x53')][_0x0813('0x54')],'callerid':_0x2f8849['Trunk'][_0x0813('0x55')]};}if(_0x2f8849['Interval']){_0x1418c7[_0x0813('0x56')]={'id':_0x2f8849[_0x0813('0x56')]['id'],'name':_0x2f8849[_0x0813('0x56')][_0x0813('0xa')]};}_0x50ad7b[_0x0813('0x57')](_0x1418c7);}}_0x2655b6({'count':_0x50ad7b[_0x0813('0x58')],'rows':_0x50ad7b});});},'UpdateVoiceQueue':function(_0x48e8aa){return new Promise(function(_0x146546,_0x594d1d){var _0x182154=_['find'](_0x4e66f4['voiceQueues'],{'id':parseInt(_0x48e8aa['id'])});var _0x54647c=_[_0x0813('0x59')](_0x48e8aa,['id']);if(_0x182154){for(var _0x141049 in _0x54647c){if(typeof _0x54647c[_0x141049]!==_0x0813('0x5a')&&typeof _0x182154[_0x141049]!==_0x0813('0x5a')){_0x182154[_0x141049]=_0x54647c[_0x141049];}}_0x146546(_0x182154);}else{_0x594d1d();}});},'VoiceChannels':function(){return new Promise(function(_0x1a07f6){var _0x308081=_['values'](_0x4e66f4['channels']);_0x1a07f6({'count':_0x308081[_0x0813('0x58')],'rows':_0x308081});});},'VoiceChannelMixMonitor':function(_0x82a59b){var _0x19fab7=this;return new Promise(function(_0x3fd5f9,_0xadaead){if(ami[_0x0813('0x10')]()==![]){return _0xadaead(_0x19fab7[_0x0813('0x1b')](0x1f4,[config[_0x0813('0x11')]['ip'],config['asterisk'][_0x0813('0x1c')],_0x0813('0x12')][_0x0813('0x13')]('\x20')));}var _0x1baf77=schema(properties[_0x0813('0x5b')])[_0x0813('0x2')](_0x82a59b);if(_0x1baf77['length']>0x0){return _0xadaead(_0x19fab7[_0x0813('0x1b')](0x1f4,_['map'](_0x1baf77,_0x0813('0x19'))[_0x0813('0x13')](',\x20')));}var _0x10e3b9=_[_0x0813('0x5c')](_0x4e66f4['channels'],{'uniqueid':_0x82a59b[_0x0813('0x5d')]});if(_0x10e3b9&&_0x10e3b9[_0x0813('0x5e')]){var _0x353e25=util[_0x0813('0x8')]('%s.%s',_0x82a59b[_0x0813('0x5f')]||_0x82a59b[_0x0813('0x5d')],_0x82a59b['format']||'wav');return ami[_0x0813('0x17')]({'action':_0x0813('0x60'),'channel':_0x10e3b9[_0x0813('0x5e')],'file':_0x353e25,'options':'ai(mixmonitorid)'})['then'](function(_0x5c596a){var _0x497aab=_[_0x0813('0x5c')](_0x10e3b9[_0x0813('0x61')],{'filename':_0x0813('0x62')+_0x353e25[_0x0813('0x63')]()});if(_['isNil'](_0x497aab)){_0x10e3b9[_0x0813('0x61')][_0x0813('0x57')]({'filename':'/var/spool/asterisk/monitor/'+_0x353e25['toLowerCase'](),'createdAt':moment()[_0x0813('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5c596a[_0x0813('0x64')],'status':_0x0813('0x65')});}else{_0x497aab[_0x0813('0x64')]=_0x5c596a['mixmonitorid'];_0x497aab[_0x0813('0x66')]=_0x0813('0x65');}_0x3fd5f9({'code':0xc8,'message':[_0x82a59b[_0x0813('0x5d')],_0x0813('0x67'),_0x5c596a[_0x0813('0x64')]][_0x0813('0x13')]('\x20'),'mixmonitorid':_0x5c596a['mixmonitorid']});})['catch'](function(_0x40ae2d){_0xadaead(_0x19fab7[_0x0813('0x1b')](0x1f5,[_0x82a59b[_0x0813('0x5d')],_0x40ae2d[_0x0813('0x19')]['toLowerCase']()][_0x0813('0x13')]('\x20')));});}else{return _0xadaead(_0x19fab7['error'](0x1f5,_0x0813('0x68')));}});},'VoiceChannelStopMixMonitor':function(_0x13e1fc){var _0x76fecb=this;return new Promise(function(_0x28a05,_0x19b183){if(ami[_0x0813('0x10')]()==![]){return _0x19b183(_0x76fecb[_0x0813('0x1b')](0x1f4,[config[_0x0813('0x11')]['ip'],config['asterisk'][_0x0813('0x1c')],_0x0813('0x12')][_0x0813('0x13')]('\x20')));}var _0x3dc5ec=schema(properties[_0x0813('0x5b')])[_0x0813('0x2')](_0x13e1fc);if(_0x3dc5ec[_0x0813('0x58')]>0x0){return _0x19b183(_0x76fecb['error'](0x1f4,_[_0x0813('0x69')](_0x3dc5ec,_0x0813('0x19'))[_0x0813('0x13')](',\x20')));}var _0x573cdf=_[_0x0813('0x5c')](_0x4e66f4[_0x0813('0x6a')],{'uniqueid':_0x13e1fc[_0x0813('0x5d')]});if(_0x573cdf){return Promise[_0x0813('0x6b')]()[_0x0813('0x18')](function(){if(_0x573cdf[_0x0813('0x5e')]){return ami[_0x0813('0x17')]({'action':_0x0813('0x6c'),'channel':_0x573cdf[_0x0813('0x5e')],'mixmonitorid':_0x13e1fc[_0x0813('0x64')]})[_0x0813('0x1a')](function(){});}})['then'](function(){if(_0x573cdf[_0x0813('0x6d')]){return ami[_0x0813('0x17')]({'action':'StopMixMonitor','channel':_0x573cdf[_0x0813('0x6d')],'mixmonitorid':_0x13e1fc['mixmonitorid']})[_0x0813('0x1a')](function(){});}})['then'](function(){var _0x587645=_['find'](_0x573cdf[_0x0813('0x61')],{'mixmonitorid':_0x13e1fc[_0x0813('0x64')]});if(_0x587645){_0x587645[_0x0813('0x66')]='stop';}})[_0x0813('0x18')](function(){var _0x5783cd=util['format'](_0x0813('0x6e'),_0x13e1fc['filename']||_0x13e1fc[_0x0813('0x5d')],_0x13e1fc[_0x0813('0x8')]||_0x0813('0x6f'));var _0x341f04=_[_0x0813('0x5c')](_0x573cdf[_0x0813('0x61')],{'filename':_0x0813('0x62')+_0x5783cd[_0x0813('0x63')]()});if(_0x341f04){_0x341f04[_0x0813('0x66')]='stop';}})['then'](function(){_0x28a05({'code':0xc8,'message':[_0x13e1fc['uniqueid'],_0x0813('0x70')][_0x0813('0x13')]('\x20')});})[_0x0813('0x1a')](function(_0xf556f0){_0x19b183(_0x76fecb[_0x0813('0x1b')](0x1f5,[_0x13e1fc['uniqueid'],_0xf556f0['message'][_0x0813('0x63')]()]['join']('\x20')));});}else{return _0x19b183(_0x76fecb[_0x0813('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x447fed){var _0x35b22d=_['values'](_0x4e66f4['queueChannels']);_0x447fed({'count':_0x35b22d[_0x0813('0x58')],'rows':_0x35b22d});});},'VoiceQueuesChannel':function(_0x3c962a){var _0x17083f=this;return new Promise(function(_0x527bfa,_0x315944){var _0xbdf9fd=schema(properties['voicequeuechannel'])[_0x0813('0x2')](_0x3c962a);if(_0xbdf9fd[_0x0813('0x58')]>0x0){return _0x315944(_0x17083f['error'](0x1f4,_[_0x0813('0x69')](_0xbdf9fd,_0x0813('0x19'))[_0x0813('0x13')](',\x20')));}var _0x50d940=_[_0x0813('0x5c')](_0x4e66f4[_0x0813('0x71')],{'uniqueid':_0x3c962a['uniqueid']});if(_0x50d940){_0x527bfa(_0x50d940);}else{return _0x315944(_0x17083f[_0x0813('0x1b')](0x1f5,_0x0813('0x68')));}});},'VoiceQueuesChannelHangup':function(_0x2b07c6){var _0x3f3615=this;return new Promise(function(_0x334b91,_0x17d4f4){if(ami['isConnected']()==![]){return _0x17d4f4(_0x3f3615[_0x0813('0x1b')](0x1f4,[config[_0x0813('0x11')]['ip'],config['asterisk']['username'],_0x0813('0x12')][_0x0813('0x13')]('\x20')));}var _0x44e141=schema(properties[_0x0813('0x72')])['validate'](_0x2b07c6);if(_0x44e141['length']>0x0){return _0x17d4f4(_0x3f3615[_0x0813('0x1b')](0x1f4,_[_0x0813('0x69')](_0x44e141,_0x0813('0x19'))['join'](',\x20')));}var _0x3ca55b=_[_0x0813('0x5c')](_0x4e66f4[_0x0813('0x71')],{'uniqueid':_0x2b07c6[_0x0813('0x5d')]});if(_0x3ca55b&&_0x3ca55b['channel']){return ami[_0x0813('0x17')]({'action':_0x0813('0x73'),'channel':_0x3ca55b[_0x0813('0x5e')]})[_0x0813('0x18')](function(_0x3ca560){_0x334b91({'code':0xc8,'message':[_0x2b07c6[_0x0813('0x5d')],_0x3ca560[_0x0813('0x19')][_0x0813('0x63')]()][_0x0813('0x13')]('\x20')});})[_0x0813('0x1a')](function(_0x477281){_0x17d4f4(_0x3f3615[_0x0813('0x1b')](0x1f5,[_0x2b07c6[_0x0813('0x5d')],_0x477281[_0x0813('0x19')][_0x0813('0x63')]()][_0x0813('0x13')]('\x20')));});}else{return _0x17d4f4(_0x3f3615['error'](0x1f5,_0x0813('0x68')));}});},'VoiceQueuesChannelRedirect':function(_0x149fb7){var _0x2d7316=this;return new Promise(function(_0x29af6d,_0x48ee01){if(ami['isConnected']()==![]){return _0x48ee01(_0x2d7316['error'](0x1f4,[config[_0x0813('0x11')]['ip'],config[_0x0813('0x11')]['username'],_0x0813('0x12')][_0x0813('0x13')]('\x20')));}var _0x5a61c5=schema(properties[_0x0813('0x74')])[_0x0813('0x2')](_0x149fb7);if(_0x5a61c5[_0x0813('0x58')]>0x0){return _0x48ee01(_0x2d7316[_0x0813('0x1b')](0x1f4,_[_0x0813('0x69')](_0x5a61c5,_0x0813('0x19'))['join'](',\x20')));}var _0x235e61=_['find'](_0x4e66f4[_0x0813('0x71')],{'uniqueid':_0x149fb7[_0x0813('0x5d')]});if(_0x235e61&&_0x235e61[_0x0813('0x5e')]){return ami[_0x0813('0x17')]({'action':_0x0813('0x75'),'channel':_0x235e61['channel'],'exten':_0x149fb7[_0x0813('0x76')],'context':_0x149fb7[_0x0813('0x77')]||_0x235e61[_0x0813('0x77')],'priority':0x1})['then'](function(_0x5e5969){_0x29af6d({'code':0xc8,'message':[_0x149fb7[_0x0813('0x5d')],_0x5e5969[_0x0813('0x19')][_0x0813('0x63')]()][_0x0813('0x13')]('\x20')});})[_0x0813('0x1a')](function(_0x4ad155){_0x48ee01(_0x2d7316[_0x0813('0x1b')](0x1f5,[_0x149fb7[_0x0813('0x5d')],_0x4ad155['message'][_0x0813('0x63')]()][_0x0813('0x13')]('\x20')));});}else{return _0x48ee01(_0x2d7316[_0x0813('0x1b')](0x1f5,_0x0813('0x68')));}});},'Agents':function(_0x24867c){return new Promise(function(_0x24e229){var _0x4f82a7=_[_0x0813('0x78')](_0x4e66f4[_0x0813('0xc')]);if(_0x24867c&&_0x24867c['id']){var _0x5ed158=_[_0x0813('0x5c')](_0x4f82a7,function(_0x39ee17){return _0x39ee17['id']===_0x24867c['id'];});_0x24e229(_0x5ed158);}else{_0x24e229({'count':_0x4f82a7['length'],'rows':_0x4f82a7});}});},'Telephones':function(){return new Promise(function(_0x4342d3){var _0x58315a=_[_0x0813('0x78')](_0x4e66f4['telephones']);_0x4342d3({'count':_0x58315a[_0x0813('0x58')],'rows':_0x58315a});});},'Trunks':function(){return new Promise(function(_0x222a98){var _0xa29fbc=_['values'](_0x4e66f4[_0x0813('0x79')]);_0x222a98({'count':_0xa29fbc[_0x0813('0x58')],'rows':_0xa29fbc});});},'OutboundChannels':function(){return new Promise(function(_0x4c2251){var _0x3662fc=_[_0x0813('0x78')](_0x4e66f4[_0x0813('0x7a')]);_0x4c2251({'count':_0x3662fc[_0x0813('0x58')],'rows':_0x3662fc});});},'Outbound':function(){return new Promise(function(_0x5c3891){_0x5c3891(_0x4e66f4[_0x0813('0x2e')]);});},'Campaigns':function(){return new Promise(function(_0x59c0cd){var _0x13ff2a=_['values'](_0x4e66f4['campaigns']);_0x59c0cd({'count':_0x13ff2a[_0x0813('0x58')],'rows':_0x13ff2a});});},'VoiceQueuesPreview':function(_0x49dd7d){var _0x11d58a=this;return new Promise(function(_0x174374,_0x313ec0){_0x442a9b[_0x0813('0x7b')](_0x49dd7d['id'])['then'](function(_0x2d074e){_0x174374({'code':0xc8,'message':_0x2d074e[_0x0813('0x19')]});})[_0x0813('0x1a')](function(_0x17f2ad){_0x313ec0(_0x11d58a['error'](0x1f4,_0x17f2ad[_0x0813('0x19')]));});});},'EventManager':function(_0x401fa3){var _0x21b632=this;return new Promise(function(_0x5461cb,_0x13e5f1){if(!_0x401fa3['event']){return _0x13e5f1(_0x21b632['error'](0x1f4,_0x0813('0x7c')));}ami[_0x0813('0x7d')](_0x0813('0x7e')+_0x401fa3['event'],_0x401fa3['message']);_0x5461cb({'code':0xc8,'message':_0x401fa3});});},'FaxAccounts':function(){return new Promise(function(_0x34c269){var _0x40530e=_['values'](_0x4e66f4[_0x0813('0x7f')]);_0x34c269({'count':_0x40530e[_0x0813('0x58')],'rows':_0x40530e});});},'SendFax':function(_0xdbb037){var _0x1e49d7=this;return new Promise(function(_0x313f59,_0x5ab3c5){_0x578c7c[_0x0813('0x80')](_0xdbb037)['then'](function(_0x57f98a){_0x313f59({'code':0xc8,'message':_0x57f98a[_0x0813('0x19')]});})[_0x0813('0x1a')](function(_0x299fd){_0x5ab3c5(_0x1e49d7['error'](0x1f4,_0x299fd[_0x0813('0x19')]));});});},'CheckAfterSend':function(_0x597df9){var _0x41b0bb=this;return new Promise(function(_0x3c12ab,_0xcc5884){_0x578c7c[_0x0813('0x81')](_0x597df9)[_0x0813('0x18')](function(_0x234fe6){_0x3c12ab({'code':0xc8,'message':_0x234fe6['message']});})[_0x0813('0x1a')](function(_0x294360){_0xcc5884(_0x41b0bb[_0x0813('0x1b')](0x1f4,_0x294360[_0x0813('0x19')]));});});}};var _0x3ba596=jayson[_0x0813('0x82')](_0x2df45a)[_0x0813('0x83')]();_0x3ba596['on'](_0x0813('0x1b'),function(_0x3d69c8){return _0x306454(_0x3d69c8);});_0x3ba596[_0x0813('0x7')](0x232a,_0x0813('0x84'),function(){console['log'](_0x0813('0x85'),0x232a);return _0x563ee2(_0x0813('0x86')+0x232a);});});}; \ No newline at end of file +var _0x6c76=['content','catch','voiceQueues','hasOwnProperty','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','push','length','omit','undefined','values','voicechannel','validate','map','find','channels','channel','%s.%s','uniqueid','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','stop','filename','wav','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','campaigns','run','event','emit','custom:','faxAccounts','send','checkAfterSend','server','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','moment','../../../config/environment','listen','format','%s/%s','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','pick','module','action','Reload','Action','then','message','join','command'];(function(_0x4b6f5c,_0x56f7ce){var _0x55548b=function(_0x125619){while(--_0x125619){_0x4b6f5c['push'](_0x4b6f5c['shift']());}};_0x55548b(++_0x56f7ce);}(_0x6c76,0x184));var _0x66c7=function(_0x5eb64f,_0x100549){_0x5eb64f=_0x5eb64f-0x0;var _0x3b8cda=_0x6c76[_0x5eb64f];return _0x3b8cda;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var jayson=require(_0x66c7('0x2'));var schema=require('validate');var moment=require(_0x66c7('0x3'));var config=require(_0x66c7('0x4'));var properties=require('../properties');var ami=require('../ami');exports[_0x66c7('0x5')]=function(_0x2b7cf3,_0x49d437,_0x175da0){return new Promise(function(_0x45b0a5,_0x52f71b){var _0x23408c={'QueuePause':function(_0x4dffcd){return new Promise(function(_0x4fa6ce){var _0x208d06=util[_0x66c7('0x6')](_0x66c7('0x7'),'SIP',_0x4dffcd[_0x66c7('0x8')]);if(_0x2b7cf3[_0x66c7('0x9')]&&_0x2b7cf3[_0x66c7('0x9')][_0x208d06]&&_0x2b7cf3[_0x66c7('0x9')][_0x208d06]['timer']){_0x2b7cf3[_0x66c7('0x9')][_0x208d06][_0x66c7('0xa')]();}if(_0x2b7cf3[_0x66c7('0xb')][_0x208d06]){_0x2b7cf3[_0x66c7('0xb')][_0x208d06][_0x66c7('0xc')]({'statePause':_0x4dffcd[_0x66c7('0xd')]?!![]:![]});}_0x4fa6ce({'code':0xc8,'message':_0x66c7('0xe')});});},'Reload':function(_0x5176a3){var _0x18c309=this;return new Promise(function(_0x760e36,_0x35cbc2){if(ami[_0x66c7('0xf')]()==![]){return _0x35cbc2(_0x18c309[_0x66c7('0x10')](0x1f4,[config[_0x66c7('0x11')]['ip'],config[_0x66c7('0x11')][_0x66c7('0x12')],_0x66c7('0x13')]['join']('\x20')));}_0x5176a3=_[_0x66c7('0x14')](_0x5176a3,_['keys'](properties[_0x66c7('0x15')]));_0x5176a3[_0x66c7('0x16')]=_0x66c7('0x17');return ami[_0x66c7('0x18')](_0x5176a3)[_0x66c7('0x19')](function(_0x4e229a){_0x760e36({'code':0xc8,'message':_0x4e229a['message']});})['catch'](function(_0x5129f6){_0x35cbc2(_0x18c309[_0x66c7('0x10')](0x1f5,_0x5129f6[_0x66c7('0x1a')]));});});},'Command':function(_0x47a299){var _0x524e87=this;return new Promise(function(_0x256b0a,_0x9b65cf){if(ami[_0x66c7('0xf')]()==![]){return _0x9b65cf(_0x524e87[_0x66c7('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x66c7('0x12')],_0x66c7('0x13')][_0x66c7('0x1b')]('\x20')));}_0x47a299=_[_0x66c7('0x14')](_0x47a299,_0x66c7('0x1c'));_0x47a299[_0x66c7('0x16')]='Command';return ami[_0x66c7('0x18')](_0x47a299)[_0x66c7('0x19')](function(_0x4a2b90){_0x256b0a({'code':0xc8,'message':_0x4a2b90[_0x66c7('0x1d')]});})[_0x66c7('0x1e')](function(_0x44bdef){_0x9b65cf(_0x524e87[_0x66c7('0x10')](0x1f5,_0x44bdef['message']));});});},'VoiceQueues':function(){return new Promise(function(_0x2736df){var _0x42ca37=[];for(var _0x5b28e6 in _0x2b7cf3[_0x66c7('0x1f')]){if(_0x2b7cf3[_0x66c7('0x1f')][_0x66c7('0x20')](_0x5b28e6)){var _0x2ef6a2=_0x2b7cf3[_0x66c7('0x1f')][_0x5b28e6];var _0x54d45d={'id':_0x2ef6a2['id'],'name':_0x2ef6a2['name'],'strategy':_0x2ef6a2['strategy'],'answered':_0x2ef6a2[_0x66c7('0x21')],'available':_0x2ef6a2[_0x66c7('0x22')],'loggedIn':_0x2ef6a2['loggedIn'],'pTalking':_0x2ef6a2[_0x66c7('0x23')],'sumBillable':_0x2ef6a2[_0x66c7('0x24')],'sumDuration':_0x2ef6a2[_0x66c7('0x25')],'sumHoldTime':_0x2ef6a2[_0x66c7('0x26')]||0x0,'talking':_0x2ef6a2[_0x66c7('0x27')],'total':_0x2ef6a2[_0x66c7('0x28')],'type':_0x2ef6a2['type'],'unmanaged':_0x2ef6a2[_0x66c7('0x29')],'abandoned':_0x2ef6a2[_0x66c7('0x2a')],'waiting':_0x2ef6a2[_0x66c7('0x2b')],'loggedInDb':_0x2ef6a2[_0x66c7('0x2c')]};if(_0x2ef6a2[_0x66c7('0x2d')]==='outbound'){_0x54d45d[_0x66c7('0x2e')]=_0x2ef6a2['dialActive'];_0x54d45d[_0x66c7('0x2f')]=_0x2ef6a2['dialMethod'];_0x54d45d[_0x66c7('0x30')]=_0x2ef6a2[_0x66c7('0x30')];_0x54d45d[_0x66c7('0x31')]=_0x2ef6a2[_0x66c7('0x31')];_0x54d45d[_0x66c7('0x32')]=_0x2ef6a2[_0x66c7('0x32')];_0x54d45d['dialPrefix']=_0x2ef6a2['dialPrefix'];_0x54d45d[_0x66c7('0x33')]=_0x2ef6a2[_0x66c7('0x33')];_0x54d45d[_0x66c7('0x34')]=_0x2ef6a2[_0x66c7('0x34')];_0x54d45d[_0x66c7('0x35')]=_0x2ef6a2[_0x66c7('0x35')];_0x54d45d[_0x66c7('0x36')]=_0x2ef6a2[_0x66c7('0x36')];_0x54d45d[_0x66c7('0x37')]=_0x2ef6a2[_0x66c7('0x37')];_0x54d45d[_0x66c7('0x38')]=_0x2ef6a2[_0x66c7('0x38')];_0x54d45d['outboundDropCallsDayACS']=_0x2ef6a2['outboundDropCallsDayACS'];_0x54d45d[_0x66c7('0x39')]=_0x2ef6a2[_0x66c7('0x39')];_0x54d45d[_0x66c7('0x3a')]=_0x2ef6a2[_0x66c7('0x3a')];_0x54d45d[_0x66c7('0x3b')]=_0x2ef6a2[_0x66c7('0x3b')];_0x54d45d[_0x66c7('0x3c')]=_0x2ef6a2['outboundNoSuchCallsDay'];_0x54d45d[_0x66c7('0x3d')]=_0x2ef6a2[_0x66c7('0x3d')];_0x54d45d[_0x66c7('0x3e')]=_0x2ef6a2[_0x66c7('0x3e')];_0x54d45d[_0x66c7('0x3f')]=_0x2ef6a2[_0x66c7('0x3f')];_0x54d45d[_0x66c7('0x40')]=_0x2ef6a2[_0x66c7('0x40')];_0x54d45d[_0x66c7('0x41')]=_0x2ef6a2[_0x66c7('0x41')];_0x54d45d[_0x66c7('0x42')]=_0x2ef6a2['predictiveIntervalAvgHoldtime'];_0x54d45d['predictiveIntervalAvgTalktime']=_0x2ef6a2[_0x66c7('0x43')];_0x54d45d[_0x66c7('0x44')]=_0x2ef6a2[_0x66c7('0x44')];_0x54d45d['predictiveIntervalDroppedCallsTimeout']=_0x2ef6a2['predictiveIntervalDroppedCallsTimeout'];_0x54d45d[_0x66c7('0x45')]=_0x2ef6a2[_0x66c7('0x45')];_0x54d45d['predictiveIntervalErlangCallsDroppedCalls']=_0x2ef6a2[_0x66c7('0x46')];_0x54d45d[_0x66c7('0x47')]=_0x2ef6a2[_0x66c7('0x47')];_0x54d45d['predictiveIntervalMultiplicativeFactor']=_0x2ef6a2[_0x66c7('0x48')];_0x54d45d[_0x66c7('0x49')]=_0x2ef6a2[_0x66c7('0x49')];_0x54d45d[_0x66c7('0x4a')]=_0x2ef6a2[_0x66c7('0x4a')];_0x54d45d[_0x66c7('0x4b')]=_0x2ef6a2[_0x66c7('0x4b')];_0x54d45d[_0x66c7('0x1a')]=_0x2ef6a2[_0x66c7('0x1a')];_0x54d45d['originated']=_0x2ef6a2[_0x66c7('0x4c')];_0x54d45d[_0x66c7('0x4d')]=_0x2ef6a2[_0x66c7('0x4d')];_0x54d45d[_0x66c7('0x4e')]=_0x2ef6a2[_0x66c7('0x4e')];_0x54d45d[_0x66c7('0x4f')]=_0x2ef6a2[_0x66c7('0x4f')];_0x54d45d[_0x66c7('0x50')]=_0x2ef6a2[_0x66c7('0x50')];_0x54d45d[_0x66c7('0x51')]=_0x2ef6a2['startPredictive'];_0x54d45d['startProgressive']=_0x2ef6a2['startProgressive'];}if(_0x2ef6a2[_0x66c7('0x52')]){_0x54d45d[_0x66c7('0x52')]={'id':_0x2ef6a2['Trunk']['id'],'name':_0x2ef6a2['Trunk'][_0x66c7('0x8')],'active':_0x2ef6a2[_0x66c7('0x52')][_0x66c7('0x53')],'callerid':_0x2ef6a2[_0x66c7('0x52')][_0x66c7('0x54')]};}if(_0x2ef6a2['Interval']){_0x54d45d[_0x66c7('0x55')]={'id':_0x2ef6a2['Interval']['id'],'name':_0x2ef6a2['Interval'][_0x66c7('0x8')]};}_0x42ca37[_0x66c7('0x56')](_0x54d45d);}}_0x2736df({'count':_0x42ca37[_0x66c7('0x57')],'rows':_0x42ca37});});},'UpdateVoiceQueue':function(_0xc61a88){return new Promise(function(_0x519f10,_0x5cf5c1){var _0x3e89f8=_['find'](_0x2b7cf3['voiceQueues'],{'id':parseInt(_0xc61a88['id'])});var _0x1ec272=_[_0x66c7('0x58')](_0xc61a88,['id']);if(_0x3e89f8){for(var _0x2b89e1 in _0x1ec272){if(typeof _0x1ec272[_0x2b89e1]!==_0x66c7('0x59')&&typeof _0x3e89f8[_0x2b89e1]!=='undefined'){_0x3e89f8[_0x2b89e1]=_0x1ec272[_0x2b89e1];}}_0x519f10(_0x3e89f8);}else{_0x5cf5c1();}});},'VoiceChannels':function(){return new Promise(function(_0x81912b){var _0x108a92=_[_0x66c7('0x5a')](_0x2b7cf3['channels']);_0x81912b({'count':_0x108a92[_0x66c7('0x57')],'rows':_0x108a92});});},'VoiceChannelMixMonitor':function(_0x24a7c8){var _0x88fe1e=this;return new Promise(function(_0x3c45cd,_0x1b78a6){if(ami[_0x66c7('0xf')]()==![]){return _0x1b78a6(_0x88fe1e[_0x66c7('0x10')](0x1f4,[config[_0x66c7('0x11')]['ip'],config['asterisk'][_0x66c7('0x12')],_0x66c7('0x13')][_0x66c7('0x1b')]('\x20')));}var _0x1386a2=schema(properties[_0x66c7('0x5b')])[_0x66c7('0x5c')](_0x24a7c8);if(_0x1386a2[_0x66c7('0x57')]>0x0){return _0x1b78a6(_0x88fe1e[_0x66c7('0x10')](0x1f4,_[_0x66c7('0x5d')](_0x1386a2,_0x66c7('0x1a'))[_0x66c7('0x1b')](',\x20')));}var _0x1096e3=_[_0x66c7('0x5e')](_0x2b7cf3[_0x66c7('0x5f')],{'uniqueid':_0x24a7c8['uniqueid']});if(_0x1096e3&&_0x1096e3[_0x66c7('0x60')]){var _0x225fb6=util[_0x66c7('0x6')](_0x66c7('0x61'),_0x24a7c8['filename']||_0x24a7c8[_0x66c7('0x62')],_0x24a7c8[_0x66c7('0x6')]||'wav');return ami[_0x66c7('0x18')]({'action':_0x66c7('0x63'),'channel':_0x1096e3[_0x66c7('0x60')],'file':_0x225fb6,'options':_0x66c7('0x64')})[_0x66c7('0x19')](function(_0x1c88c0){var _0x1ed21e=_['find'](_0x1096e3[_0x66c7('0x65')],{'filename':_0x66c7('0x66')+_0x225fb6['toLowerCase']()});if(_[_0x66c7('0x67')](_0x1ed21e)){_0x1096e3[_0x66c7('0x65')][_0x66c7('0x56')]({'filename':'/var/spool/asterisk/monitor/'+_0x225fb6[_0x66c7('0x68')](),'createdAt':moment()[_0x66c7('0x6')](_0x66c7('0x69')),'mixmonitorid':_0x1c88c0[_0x66c7('0x6a')],'status':_0x66c7('0x6b')});}else{_0x1ed21e[_0x66c7('0x6a')]=_0x1c88c0[_0x66c7('0x6a')];_0x1ed21e[_0x66c7('0x6c')]='rec';}_0x3c45cd({'code':0xc8,'message':[_0x24a7c8[_0x66c7('0x62')],_0x66c7('0x6d'),_0x1c88c0['mixmonitorid']][_0x66c7('0x1b')]('\x20'),'mixmonitorid':_0x1c88c0[_0x66c7('0x6a')]});})[_0x66c7('0x1e')](function(_0x577d19){_0x1b78a6(_0x88fe1e['error'](0x1f5,[_0x24a7c8[_0x66c7('0x62')],_0x577d19['message'][_0x66c7('0x68')]()][_0x66c7('0x1b')]('\x20')));});}else{return _0x1b78a6(_0x88fe1e[_0x66c7('0x10')](0x1f5,_0x66c7('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0xebff6b){var _0x1ff8a0=this;return new Promise(function(_0x5b35cf,_0x58f938){if(ami[_0x66c7('0xf')]()==![]){return _0x58f938(_0x1ff8a0[_0x66c7('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x66c7('0x12')],'ami\x20disconnected'][_0x66c7('0x1b')]('\x20')));}var _0x34dc58=schema(properties[_0x66c7('0x5b')])[_0x66c7('0x5c')](_0xebff6b);if(_0x34dc58['length']>0x0){return _0x58f938(_0x1ff8a0[_0x66c7('0x10')](0x1f4,_[_0x66c7('0x5d')](_0x34dc58,_0x66c7('0x1a'))[_0x66c7('0x1b')](',\x20')));}var _0x73dc15=_[_0x66c7('0x5e')](_0x2b7cf3['channels'],{'uniqueid':_0xebff6b[_0x66c7('0x62')]});if(_0x73dc15){return Promise[_0x66c7('0x6f')]()[_0x66c7('0x19')](function(){if(_0x73dc15['channel']){return ami[_0x66c7('0x18')]({'action':'StopMixMonitor','channel':_0x73dc15[_0x66c7('0x60')],'mixmonitorid':_0xebff6b[_0x66c7('0x6a')]})[_0x66c7('0x1e')](function(){});}})[_0x66c7('0x19')](function(){if(_0x73dc15[_0x66c7('0x70')]){return ami[_0x66c7('0x18')]({'action':'StopMixMonitor','channel':_0x73dc15[_0x66c7('0x70')],'mixmonitorid':_0xebff6b[_0x66c7('0x6a')]})[_0x66c7('0x1e')](function(){});}})[_0x66c7('0x19')](function(){var _0x8f9402=_['find'](_0x73dc15[_0x66c7('0x65')],{'mixmonitorid':_0xebff6b[_0x66c7('0x6a')]});if(_0x8f9402){_0x8f9402[_0x66c7('0x6c')]=_0x66c7('0x71');}})[_0x66c7('0x19')](function(){var _0x22ab1d=util[_0x66c7('0x6')](_0x66c7('0x61'),_0xebff6b[_0x66c7('0x72')]||_0xebff6b[_0x66c7('0x62')],_0xebff6b[_0x66c7('0x6')]||_0x66c7('0x73'));var _0x50f72d=_[_0x66c7('0x5e')](_0x73dc15[_0x66c7('0x65')],{'filename':_0x66c7('0x66')+_0x22ab1d[_0x66c7('0x68')]()});if(_0x50f72d){_0x50f72d[_0x66c7('0x6c')]=_0x66c7('0x71');}})[_0x66c7('0x19')](function(){_0x5b35cf({'code':0xc8,'message':[_0xebff6b['uniqueid'],_0x66c7('0x74')][_0x66c7('0x1b')]('\x20')});})[_0x66c7('0x1e')](function(_0x217ccf){_0x58f938(_0x1ff8a0[_0x66c7('0x10')](0x1f5,[_0xebff6b[_0x66c7('0x62')],_0x217ccf[_0x66c7('0x1a')][_0x66c7('0x68')]()][_0x66c7('0x1b')]('\x20')));});}else{return _0x58f938(_0x1ff8a0[_0x66c7('0x10')](0x1f5,_0x66c7('0x6e')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x450b14){var _0x2e5a47=_[_0x66c7('0x5a')](_0x2b7cf3[_0x66c7('0x75')]);_0x450b14({'count':_0x2e5a47[_0x66c7('0x57')],'rows':_0x2e5a47});});},'VoiceQueuesChannel':function(_0x5bca99){var _0x16d404=this;return new Promise(function(_0x31bc19,_0x43a623){var _0x153714=schema(properties[_0x66c7('0x76')])[_0x66c7('0x5c')](_0x5bca99);if(_0x153714[_0x66c7('0x57')]>0x0){return _0x43a623(_0x16d404[_0x66c7('0x10')](0x1f4,_[_0x66c7('0x5d')](_0x153714,_0x66c7('0x1a'))[_0x66c7('0x1b')](',\x20')));}var _0x326a6c=_[_0x66c7('0x5e')](_0x2b7cf3[_0x66c7('0x75')],{'uniqueid':_0x5bca99[_0x66c7('0x62')]});if(_0x326a6c){_0x31bc19(_0x326a6c);}else{return _0x43a623(_0x16d404[_0x66c7('0x10')](0x1f5,_0x66c7('0x6e')));}});},'VoiceQueuesChannelHangup':function(_0x56b4b4){var _0x42485b=this;return new Promise(function(_0x44bbaf,_0x188d9c){if(ami[_0x66c7('0xf')]()==![]){return _0x188d9c(_0x42485b[_0x66c7('0x10')](0x1f4,[config[_0x66c7('0x11')]['ip'],config['asterisk']['username'],_0x66c7('0x13')]['join']('\x20')));}var _0x1d2af2=schema(properties[_0x66c7('0x77')])[_0x66c7('0x5c')](_0x56b4b4);if(_0x1d2af2[_0x66c7('0x57')]>0x0){return _0x188d9c(_0x42485b[_0x66c7('0x10')](0x1f4,_[_0x66c7('0x5d')](_0x1d2af2,_0x66c7('0x1a'))[_0x66c7('0x1b')](',\x20')));}var _0x1f0a06=_[_0x66c7('0x5e')](_0x2b7cf3[_0x66c7('0x75')],{'uniqueid':_0x56b4b4[_0x66c7('0x62')]});if(_0x1f0a06&&_0x1f0a06['channel']){return ami[_0x66c7('0x18')]({'action':_0x66c7('0x78'),'channel':_0x1f0a06[_0x66c7('0x60')]})[_0x66c7('0x19')](function(_0x51fb54){_0x44bbaf({'code':0xc8,'message':[_0x56b4b4[_0x66c7('0x62')],_0x51fb54[_0x66c7('0x1a')]['toLowerCase']()][_0x66c7('0x1b')]('\x20')});})[_0x66c7('0x1e')](function(_0x3f25c0){_0x188d9c(_0x42485b[_0x66c7('0x10')](0x1f5,[_0x56b4b4[_0x66c7('0x62')],_0x3f25c0[_0x66c7('0x1a')]['toLowerCase']()]['join']('\x20')));});}else{return _0x188d9c(_0x42485b[_0x66c7('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x570a63){var _0x5477a5=this;return new Promise(function(_0xb61ce5,_0x1e8f00){if(ami[_0x66c7('0xf')]()==![]){return _0x1e8f00(_0x5477a5[_0x66c7('0x10')](0x1f4,[config[_0x66c7('0x11')]['ip'],config[_0x66c7('0x11')][_0x66c7('0x12')],'ami\x20disconnected'][_0x66c7('0x1b')]('\x20')));}var _0x508e2c=schema(properties[_0x66c7('0x79')])[_0x66c7('0x5c')](_0x570a63);if(_0x508e2c[_0x66c7('0x57')]>0x0){return _0x1e8f00(_0x5477a5[_0x66c7('0x10')](0x1f4,_[_0x66c7('0x5d')](_0x508e2c,_0x66c7('0x1a'))[_0x66c7('0x1b')](',\x20')));}var _0x13a5d1=_[_0x66c7('0x5e')](_0x2b7cf3[_0x66c7('0x75')],{'uniqueid':_0x570a63[_0x66c7('0x62')]});if(_0x13a5d1&&_0x13a5d1[_0x66c7('0x60')]){return ami[_0x66c7('0x18')]({'action':_0x66c7('0x7a'),'channel':_0x13a5d1[_0x66c7('0x60')],'exten':_0x570a63[_0x66c7('0x7b')],'context':_0x570a63[_0x66c7('0x7c')]||_0x13a5d1[_0x66c7('0x7c')],'priority':0x1})[_0x66c7('0x19')](function(_0x379dc4){_0xb61ce5({'code':0xc8,'message':[_0x570a63[_0x66c7('0x62')],_0x379dc4[_0x66c7('0x1a')][_0x66c7('0x68')]()][_0x66c7('0x1b')]('\x20')});})[_0x66c7('0x1e')](function(_0x48bd82){_0x1e8f00(_0x5477a5[_0x66c7('0x10')](0x1f5,[_0x570a63[_0x66c7('0x62')],_0x48bd82[_0x66c7('0x1a')]['toLowerCase']()][_0x66c7('0x1b')]('\x20')));});}else{return _0x1e8f00(_0x5477a5[_0x66c7('0x10')](0x1f5,_0x66c7('0x6e')));}});},'Agents':function(_0x5cc59c){return new Promise(function(_0x2748b5){var _0x12994c=_[_0x66c7('0x5a')](_0x2b7cf3['agents']);if(_0x5cc59c&&_0x5cc59c['id']){var _0x66516=_[_0x66c7('0x5e')](_0x12994c,function(_0x280cdc){return _0x280cdc['id']===_0x5cc59c['id'];});_0x2748b5(_0x66516);}else{_0x2748b5({'count':_0x12994c[_0x66c7('0x57')],'rows':_0x12994c});}});},'Telephones':function(){return new Promise(function(_0x4d9143){var _0x228f85=_[_0x66c7('0x5a')](_0x2b7cf3[_0x66c7('0x7d')]);_0x4d9143({'count':_0x228f85[_0x66c7('0x57')],'rows':_0x228f85});});},'Trunks':function(){return new Promise(function(_0x5cb5a5){var _0x596f63=_[_0x66c7('0x5a')](_0x2b7cf3[_0x66c7('0x7e')]);_0x5cb5a5({'count':_0x596f63[_0x66c7('0x57')],'rows':_0x596f63});});},'OutboundChannels':function(){return new Promise(function(_0x3c8fcf){var _0x114f47=_['values'](_0x2b7cf3[_0x66c7('0x7f')]);_0x3c8fcf({'count':_0x114f47[_0x66c7('0x57')],'rows':_0x114f47});});},'Outbound':function(){return new Promise(function(_0x174a79){_0x174a79(_0x2b7cf3[_0x66c7('0x80')]);});},'Campaigns':function(){return new Promise(function(_0x524806){var _0x564a46=_[_0x66c7('0x5a')](_0x2b7cf3[_0x66c7('0x81')]);_0x524806({'count':_0x564a46[_0x66c7('0x57')],'rows':_0x564a46});});},'VoiceQueuesPreview':function(_0x10b7d5){var _0x34910d=this;return new Promise(function(_0x4310e6,_0x9b1421){_0x49d437[_0x66c7('0x82')](_0x10b7d5['id'])['then'](function(_0x32fb79){_0x4310e6({'code':0xc8,'message':_0x32fb79[_0x66c7('0x1a')]});})[_0x66c7('0x1e')](function(_0x574e42){_0x9b1421(_0x34910d[_0x66c7('0x10')](0x1f4,_0x574e42[_0x66c7('0x1a')]));});});},'EventManager':function(_0x41ba9a){var _0x237485=this;return new Promise(function(_0x14045a,_0x2e528e){if(!_0x41ba9a[_0x66c7('0x83')]){return _0x2e528e(_0x237485[_0x66c7('0x10')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x66c7('0x84')](_0x66c7('0x85')+_0x41ba9a[_0x66c7('0x83')],_0x41ba9a[_0x66c7('0x1a')]);_0x14045a({'code':0xc8,'message':_0x41ba9a});});},'FaxAccounts':function(){return new Promise(function(_0x3d12ed){var _0x39f425=_['values'](_0x2b7cf3[_0x66c7('0x86')]);_0x3d12ed({'count':_0x39f425[_0x66c7('0x57')],'rows':_0x39f425});});},'SendFax':function(_0x109d6a){var _0x223ab1=this;return new Promise(function(_0x12085a,_0x14608f){_0x175da0[_0x66c7('0x87')](_0x109d6a)[_0x66c7('0x19')](function(_0x5c3e71){_0x12085a({'code':0xc8,'message':_0x5c3e71[_0x66c7('0x1a')]});})[_0x66c7('0x1e')](function(_0x4611ce){_0x14608f(_0x223ab1['error'](0x1f4,_0x4611ce[_0x66c7('0x1a')]));});});},'CheckAfterSend':function(_0x2f0bf0){var _0x46aa68=this;return new Promise(function(_0x3dd1f5,_0x94fa70){_0x175da0[_0x66c7('0x88')](_0x2f0bf0)[_0x66c7('0x19')](function(_0x4c2f20){_0x3dd1f5({'code':0xc8,'message':_0x4c2f20[_0x66c7('0x1a')]});})['catch'](function(_0x5eaa50){_0x94fa70(_0x46aa68['error'](0x1f4,_0x5eaa50['message']));});});}};var _0x306c8b=jayson[_0x66c7('0x89')](_0x23408c)['http']();_0x306c8b['on']('error',function(_0x3b4298){return _0x52f71b(_0x3b4298);});_0x306c8b[_0x66c7('0x5')](0x232a,'127.0.0.1',function(){console['log'](_0x66c7('0x8a'),0x232a);return _0x45b0a5('RPC\x20listening\x20on\x20port:'+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 4fb2a0e..b9b304a 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 _0xb8f0=['util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','info','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','lastName','phone','mobile','fax','createdAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','firstName','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','calleridnum','format','user:%s','trigger:%s','action','merge','ioredis'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb8f0,0x6d));var _0x0b8f=function(_0x3ddca9,_0x576a5b){_0x3ddca9=_0x3ddca9-0x0;var _0x527f02=_0xb8f0[_0x3ddca9];return _0x527f02;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x0b8f('0x0'));var util=require(_0x0b8f('0x1'));var config=require(_0x0b8f('0x2'));var logger=require(_0x0b8f('0x3'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x0b8f('0x4')](config[_0x0b8f('0x5')],{'host':_0x0b8f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0b8f('0x5')]));function emit(_0x45d201,_0x2fbc42,_0x5e2ce4,_0x1ea34b,_0x525701){logger[_0x0b8f('0x7')](_0x0b8f('0x8'),_0x45d201,_0x2fbc42['id'],_0x5e2ce4,_0x1ea34b,JSON[_0x0b8f('0x9')](_0x525701));io['to'](_0x5e2ce4)[_0x0b8f('0xa')](_0x1ea34b,_0x525701);}exports['exec']=function(_0xf35b54,_0x304f4b,_0x2e0631,_0x6e325c){var _0x5581ed,_0x637f6b;var _0x1957f5={};var _0x42f30d;var _0x27ec33=Number(_0x2e0631[_0x0b8f('0xb')]);var _0x3da90b=_0x2e0631[_0x0b8f('0xc')]?Boolean(Number(_0x2e0631[_0x0b8f('0xc')])):![];var _0x570d8d;var _0x321b44=![];if(!_[_0x0b8f('0xd')](_0x2e0631[_0x0b8f('0xe')])){if(_0x2e0631[_0x0b8f('0xe')]=='1')_0x321b44=!![];}if(!_0x321b44){if(_0x6e325c[_0x0b8f('0xf')]){_0x1957f5['id']=_0x6e325c[_0x0b8f('0xf')];}}if(!_0x1957f5['id']){_0x1957f5[_0x0b8f('0x10')]=_0x27ec33;_0x570d8d=_0x2e0631[_0x0b8f('0x11')]&&_0x2e0631[_0x0b8f('0x11')]!=='0'?_0x2e0631[_0x0b8f('0x11')][_0x0b8f('0x12')](','):['phone'];_0x1957f5[_0x0b8f('0x13')]=_[_0x0b8f('0x14')](_0x570d8d,function(_0x6534dc){var _0x303e3a={};_0x303e3a[_0x6534dc]=_0x6e325c[_0x0b8f('0x15')]?_0x6e325c[_0x0b8f('0x16')]:_0x6e325c['calleridnum'];return _0x303e3a;});_0x42f30d=_0x6e325c['routeId']?_0x6e325c[_0x0b8f('0x16')]:_0x6e325c['calleridnum'];}var _0x1cbe18=['id','firstName',_0x0b8f('0x17'),_0x0b8f('0x18'),_0x0b8f('0x19'),_0x0b8f('0x1a'),'ListId',_0x0b8f('0x1b'),'scheduledAt',_0x0b8f('0x1c')];var _0x4ee2d0=_[_0x0b8f('0x1d')](_0x1cbe18,_0x570d8d);BPromise[_0x0b8f('0x1e')]()[_0x0b8f('0x1f')](cmContactRpc['getContacts']({'attributes':_0x4ee2d0,'where':_0x1957f5,'phone':_0x42f30d}))['then'](function(_0x4d5584){_0x637f6b=_0x4d5584;if(!_[_0x0b8f('0x20')](_0x637f6b)){if(_0x637f6b[_0x0b8f('0x21')]===0x1){_0x5581ed=_0x637f6b[0x0];logger[_0x0b8f('0x7')](_0x0b8f('0x22'),_0x6e325c[_0x0b8f('0x23')],_0x304f4b['id'],_0x5581ed['id']);}else{logger[_0x0b8f('0x7')](_0x0b8f('0x24'),_0x6e325c['uniqueid'],_0x304f4b['id'],_[_0x0b8f('0x14')](_0x637f6b,'id')[_0x0b8f('0x25')](','));}return;}else{logger[_0x0b8f('0x7')](_0x0b8f('0x26'),_0x6e325c[_0x0b8f('0x23')],_0x304f4b['id']);var _0x1c2800={'ListId':_0x27ec33};var _0x17d83b=_0x2e0631['data4']&&_0x2e0631['data4']!=='0'?_0x2e0631[_0x0b8f('0x27')]:'phone';if(_0x3da90b){logger[_0x0b8f('0x7')](_0x0b8f('0x28'),_0x6e325c[_0x0b8f('0x23')],_0x304f4b['id']);_0x1c2800[_0x17d83b]=_[_0x0b8f('0xd')](_0x6e325c[_0x0b8f('0x15')])?_0x6e325c['calleridnum']:_0x6e325c[_0x0b8f('0x16')];if(_[_0x0b8f('0xd')](_0x6e325c[_0x0b8f('0x15')])){_0x1c2800['firstName']=_0x6e325c[_0x0b8f('0x29')]&&_0x6e325c[_0x0b8f('0x29')]!==_0x0b8f('0x2a')?_0x6e325c['calleridname']:_0x0b8f('0x2b');}else{_0x1c2800[_0x0b8f('0x2c')]=_0x6e325c['destcalleridname']&&_0x6e325c[_0x0b8f('0x2d')]!==_0x0b8f('0x2a')?_0x6e325c[_0x0b8f('0x2d')]:'Unknown';}return BPromise['resolve']()[_0x0b8f('0x1f')](cmContactRpc[_0x0b8f('0x2e')](_0x1c2800))[_0x0b8f('0x1f')](function(_0x10e7bf){_0x5581ed=_0x10e7bf;_0x637f6b[_0x0b8f('0x2f')](_0x10e7bf);if(_0x5581ed){logger[_0x0b8f('0x7')](_0x0b8f('0x30'),_0x6e325c['uniqueid'],_0x304f4b['id'],_0x5581ed['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x6e325c[_0x0b8f('0x23')],_0x304f4b['id']);_0x1c2800[_0x17d83b]=_['isNil'](_0x6e325c[_0x0b8f('0x15')])?_0x6e325c[_0x0b8f('0x31')]:_0x6e325c['destcalleridnum'];if(_[_0x0b8f('0xd')](_0x6e325c[_0x0b8f('0x15')])){_0x1c2800[_0x0b8f('0x2c')]=_0x6e325c['calleridname']&&_0x6e325c[_0x0b8f('0x29')]!==_0x0b8f('0x2a')?_0x6e325c[_0x0b8f('0x29')]:_0x0b8f('0x2b');}else{_0x1c2800['firstName']=_0x6e325c[_0x0b8f('0x2d')]&&_0x6e325c[_0x0b8f('0x2d')]!==_0x0b8f('0x2a')?_0x6e325c[_0x0b8f('0x2d')]:_0x0b8f('0x2b');}_0x5581ed=_0x1c2800;_0x637f6b[_0x0b8f('0x2f')](_0x1c2800);return;}}})[_0x0b8f('0x1f')](function(){if(_0xf35b54){emit(_0x6e325c['uniqueid'],_0x304f4b,util[_0x0b8f('0x32')](_0x0b8f('0x33'),_0xf35b54['name']),util[_0x0b8f('0x32')](_0x0b8f('0x34'),_0x2e0631[_0x0b8f('0x35')]['toLowerCase']()),{'evt':_[_0x0b8f('0x36')](_0x6e325c,{'autoCreate':_0x3da90b}),'contact':_0x5581ed===undefined?{}:_0x5581ed,'contacts':_0x637f6b[_0x0b8f('0x21')]===0x0?undefined:_0x637f6b});}});}; \ No newline at end of file +var _0xa76a=['[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','calleridname','','Unknown','destcalleridname','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','name','trigger:%s','merge','bluebird','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','split','map','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','scheduledAt','resolve','getContacts','then','isEmpty','length'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa76a,0xad));var _0xaa76=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa76a[_0x5b78e8];return _0xf2c321;};'use strict';var _=require('lodash');var BPromise=require(_0xaa76('0x0'));var Redis=require(_0xaa76('0x1'));var util=require(_0xaa76('0x2'));var config=require('../../../../config/environment');var logger=require(_0xaa76('0x3'))(_0xaa76('0x4'));var cmContactRpc=require(_0xaa76('0x5'));config[_0xaa76('0x6')]=_[_0xaa76('0x7')](config[_0xaa76('0x6')],{'host':_0xaa76('0x8'),'port':0x18eb});var io=require(_0xaa76('0x9'))(new Redis(config[_0xaa76('0x6')]));function emit(_0x3b869a,_0x5e1f71,_0x3f8790,_0x3a8c79,_0x3717ba){logger[_0xaa76('0xa')](_0xaa76('0xb'),_0x3b869a,_0x5e1f71['id'],_0x3f8790,_0x3a8c79,JSON['stringify'](_0x3717ba));io['to'](_0x3f8790)[_0xaa76('0xc')](_0x3a8c79,_0x3717ba);}exports[_0xaa76('0xd')]=function(_0x60d688,_0x6a5aba,_0x567bdf,_0x1bb0de){var _0x30f5b1,_0x34653a;var _0x40af1d={};var _0x2c965c;var _0xb9de7c=Number(_0x567bdf[_0xaa76('0xe')]);var _0x2dce5a=_0x567bdf[_0xaa76('0xf')]?Boolean(Number(_0x567bdf[_0xaa76('0xf')])):![];var _0x2897ba;var _0x2c9c3d=![];if(!_['isNil'](_0x567bdf[_0xaa76('0x10')])){if(_0x567bdf['data5']=='1')_0x2c9c3d=!![];}if(!_0x2c9c3d){if(_0x1bb0de['xmd-contactid']){_0x40af1d['id']=_0x1bb0de[_0xaa76('0x11')];}}if(!_0x40af1d['id']){_0x40af1d[_0xaa76('0x12')]=_0xb9de7c;_0x2897ba=_0x567bdf['data3']&&_0x567bdf['data3']!=='0'?_0x567bdf[_0xaa76('0x13')][_0xaa76('0x14')](','):['phone'];_0x40af1d['$or']=_[_0xaa76('0x15')](_0x2897ba,function(_0x88a4f0){var _0x15f507={};_0x15f507[_0x88a4f0]=_0x1bb0de[_0xaa76('0x16')]?_0x1bb0de[_0xaa76('0x17')]:_0x1bb0de[_0xaa76('0x18')];return _0x15f507;});_0x2c965c=_0x1bb0de['routeId']?_0x1bb0de[_0xaa76('0x17')]:_0x1bb0de[_0xaa76('0x18')];}var _0xdeae4c=['id',_0xaa76('0x19'),_0xaa76('0x1a'),_0xaa76('0x1b'),_0xaa76('0x1c'),'fax',_0xaa76('0x12'),'createdAt',_0xaa76('0x1d'),'updatedAt'];var _0x3e2ea7=_['union'](_0xdeae4c,_0x2897ba);BPromise[_0xaa76('0x1e')]()['then'](cmContactRpc[_0xaa76('0x1f')]({'attributes':_0x3e2ea7,'where':_0x40af1d,'phone':_0x2c965c}))[_0xaa76('0x20')](function(_0x3cabe5){_0x34653a=_0x3cabe5;if(!_[_0xaa76('0x21')](_0x34653a)){if(_0x34653a[_0xaa76('0x22')]===0x1){_0x30f5b1=_0x34653a[0x0];logger[_0xaa76('0xa')](_0xaa76('0x23'),_0x1bb0de['uniqueid'],_0x6a5aba['id'],_0x30f5b1['id']);}else{logger[_0xaa76('0xa')](_0xaa76('0x24'),_0x1bb0de[_0xaa76('0x25')],_0x6a5aba['id'],_[_0xaa76('0x15')](_0x34653a,'id')[_0xaa76('0x26')](','));}return;}else{logger[_0xaa76('0xa')](_0xaa76('0x27'),_0x1bb0de[_0xaa76('0x25')],_0x6a5aba['id']);var _0x1ce4b5={'ListId':_0xb9de7c};var _0x379ad9=_0x567bdf['data4']&&_0x567bdf['data4']!=='0'?_0x567bdf[_0xaa76('0x28')]:_0xaa76('0x1b');if(_0x2dce5a){logger[_0xaa76('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x1bb0de[_0xaa76('0x25')],_0x6a5aba['id']);_0x1ce4b5[_0x379ad9]=_['isNil'](_0x1bb0de['routeId'])?_0x1bb0de[_0xaa76('0x18')]:_0x1bb0de['destcalleridnum'];if(_[_0xaa76('0x29')](_0x1bb0de[_0xaa76('0x16')])){_0x1ce4b5[_0xaa76('0x19')]=_0x1bb0de[_0xaa76('0x2a')]&&_0x1bb0de['calleridname']!==_0xaa76('0x2b')?_0x1bb0de[_0xaa76('0x2a')]:_0xaa76('0x2c');}else{_0x1ce4b5[_0xaa76('0x19')]=_0x1bb0de[_0xaa76('0x2d')]&&_0x1bb0de[_0xaa76('0x2d')]!==_0xaa76('0x2b')?_0x1bb0de[_0xaa76('0x2d')]:_0xaa76('0x2c');}return BPromise[_0xaa76('0x1e')]()[_0xaa76('0x20')](cmContactRpc['createContact'](_0x1ce4b5))[_0xaa76('0x20')](function(_0x19a836){_0x30f5b1=_0x19a836;_0x34653a['push'](_0x19a836);if(_0x30f5b1){logger[_0xaa76('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x1bb0de[_0xaa76('0x25')],_0x6a5aba['id'],_0x30f5b1['id']);}return;});}else{logger[_0xaa76('0xa')](_0xaa76('0x2e'),_0x1bb0de[_0xaa76('0x25')],_0x6a5aba['id']);_0x1ce4b5[_0x379ad9]=_[_0xaa76('0x29')](_0x1bb0de[_0xaa76('0x16')])?_0x1bb0de[_0xaa76('0x18')]:_0x1bb0de[_0xaa76('0x17')];if(_[_0xaa76('0x29')](_0x1bb0de[_0xaa76('0x16')])){_0x1ce4b5['firstName']=_0x1bb0de['calleridname']&&_0x1bb0de['calleridname']!==_0xaa76('0x2b')?_0x1bb0de[_0xaa76('0x2a')]:_0xaa76('0x2c');}else{_0x1ce4b5['firstName']=_0x1bb0de[_0xaa76('0x2d')]&&_0x1bb0de[_0xaa76('0x2d')]!==''?_0x1bb0de[_0xaa76('0x2d')]:'Unknown';}_0x30f5b1=_0x1ce4b5;_0x34653a[_0xaa76('0x2f')](_0x1ce4b5);return;}}})[_0xaa76('0x20')](function(){if(_0x60d688){emit(_0x1bb0de['uniqueid'],_0x6a5aba,util[_0xaa76('0x30')]('user:%s',_0x60d688[_0xaa76('0x31')]),util['format'](_0xaa76('0x32'),_0x567bdf['action']['toLowerCase']()),{'evt':_[_0xaa76('0x33')](_0x1bb0de,{'autoCreate':_0x2dce5a}),'contact':_0x30f5b1===undefined?{}:_0x30f5b1,'contacts':_0x34653a[_0xaa76('0x22')]===0x0?undefined:_0x34653a});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 5cd203c..188b53c 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 _0xd65f=['location','windowWidth','data5','windowHeight','data6','600','winapp','winArguments','format','user:%s','name','trigger:%s:%s','action','data1','merge','jscripty','trigger:%s','contactmanager','integration','queue','routeId','exec','parse','query','replace','channel','every','AllConditions','AnyConditions','length','some','checkConditions','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','lodash','mustache','ioredis','./urlforward','./integration','./script','../../../config/environment','../ami','defaults','redis','localhost','socket.io-emitter','popup','url','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:queuecallerabandon','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','emit','stringify','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','checkTrigger','Actions','toLowerCase','browser','html','data2','render','template\x20not\x20found','uri','buildUri','data3','isNil','data4'];(function(_0x2fde73,_0x1852cf){var _0x519f8d=function(_0x3384de){while(--_0x3384de){_0x2fde73['push'](_0x2fde73['shift']());}};_0x519f8d(++_0x1852cf);}(_0xd65f,0x198));var _0xfd65=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0xd65f[_0x10dfdf];return _0x4d857d;};'use strict';var util=require('util');var _=require(_0xfd65('0x0'));var url=require('url');var Mustache=require(_0xfd65('0x1'));var Redis=require(_0xfd65('0x2'));var urlforward=require(_0xfd65('0x3'));var integration=require(_0xfd65('0x4'));var cmContact=require('./cmContact');var script=require(_0xfd65('0x5'));var config=require(_0xfd65('0x6'));var logger=require('../../../config/logger')('trigger');var ami=require(_0xfd65('0x7'));config['redis']=_[_0xfd65('0x8')](config[_0xfd65('0x9')],{'host':_0xfd65('0xa'),'port':0x18eb});var io=require(_0xfd65('0xb'))(new Redis(config['redis']));var operators={'equals':function(_0x1bba87,_0x195b6e){return _0x1bba87==_0x195b6e;},'not_equals':function(_0x53d92a,_0x41f3eb){return _0x53d92a!=_0x41f3eb;}};var barAndWebActions=[_0xfd65('0xc'),_0xfd65('0xd'),'winapp'];function Trigger(_0x58ff87){this[_0xfd65('0xe')]=_0x58ff87[_0xfd65('0xe')];this[_0xfd65('0xf')]=_0x58ff87[_0xfd65('0xf')];this['voiceQueues']=_0x58ff87[_0xfd65('0x10')];this[_0xfd65('0x11')]=_0x58ff87['templates'];this[_0xfd65('0x12')]=_0x58ff87[_0xfd65('0x12')];this[_0xfd65('0x13')]=_0x58ff87['zendeskAccounts'];this[_0xfd65('0x14')]=_0x58ff87['freshdeskAccounts'];this[_0xfd65('0x15')]=_0x58ff87['salesforceAccounts'];this[_0xfd65('0x16')]=_0x58ff87[_0xfd65('0x16')];this[_0xfd65('0x17')]=_0x58ff87[_0xfd65('0x17')];this[_0xfd65('0x18')]=_0x58ff87[_0xfd65('0x18')];this['vtigerAccounts']=_0x58ff87[_0xfd65('0x19')];this[_0xfd65('0x1a')]=_0x58ff87['servicenowAccounts'];this[_0xfd65('0x1b')]=_0x58ff87[_0xfd65('0x1b')];this['freshsalesAccounts']=_0x58ff87['freshsalesAccounts'];this[_0xfd65('0x1c')]={'zendesk':this[_0xfd65('0x13')],'salesforce':this[_0xfd65('0x15')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xfd65('0x16')],'zoho':this[_0xfd65('0x17')],'desk':this[_0xfd65('0x18')],'vtiger':this[_0xfd65('0x19')],'dynamics365':this[_0xfd65('0x1b')],'freshsales':this[_0xfd65('0x1d')],'servicenow':this[_0xfd65('0x1a')]};ami['on'](_0xfd65('0x1e'),this[_0xfd65('0x1f')]['bind'](this));ami['on'](_0xfd65('0x20'),this[_0xfd65('0x1f')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x22'),this['syncCustomEvent'][_0xfd65('0x21')](this));ami['on']('custom:agentcomplete',this[_0xfd65('0x1f')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x23'),this[_0xfd65('0x1f')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x24'),this[_0xfd65('0x1f')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x25'),this['syncCustomEvent'][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x26'),this[_0xfd65('0x1f')]['bind'](this));ami['on']('custom:agentreject',this['syncCustomEvent'][_0xfd65('0x21')](this));ami['on']('custom:amd',this[_0xfd65('0x1f')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x27'),this['syncCustomEvent'][_0xfd65('0x21')](this));ami['on']('custom:timeout',this[_0xfd65('0x1f')]['bind'](this));ami['on']('custom:dialbegin',this[_0xfd65('0x28')]['bind'](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x29'),this[_0xfd65('0x28')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x2a'),this[_0xfd65('0x1f')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x2b'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfd65('0x2c'),this[_0xfd65('0x1f')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x2d'),this[_0xfd65('0x1f')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x2e'),this[_0xfd65('0x1f')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x2f'),this[_0xfd65('0x1f')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x30'),this[_0xfd65('0x1f')][_0xfd65('0x21')](this));ami['on'](_0xfd65('0x31'),this[_0xfd65('0x1f')][_0xfd65('0x21')](this));}Trigger[_0xfd65('0x32')][_0xfd65('0x33')]=function(_0x485c57,_0x110ae7,_0x22ce47){logger['info'](_0x485c57,_0x110ae7,JSON[_0xfd65('0x34')](_0x22ce47));io['to'](_0x485c57)[_0xfd65('0x33')](_0x110ae7,_0x22ce47);};Trigger[_0xfd65('0x32')][_0xfd65('0x1f')]=function(_0x4d36f1){var _0x187ca9=_['clone'](_0x4d36f1);if(typeof _0x187ca9[_0xfd65('0x35')]===_0xfd65('0x36')){_0x187ca9[_0xfd65('0x35')]=_0xfd65('0x37');}this[_0xfd65('0x38')](_0x187ca9);};Trigger[_0xfd65('0x32')][_0xfd65('0x28')]=function(_0x325877){if(this[_0xfd65('0xf')][_0x325877[_0xfd65('0x39')]]){this[_0xfd65('0x1f')](_0x325877);}};Trigger[_0xfd65('0x32')]['checkTriggers']=function(_0x1c267a){var _0x942ecc;for(var _0x1889d5 in this[_0xfd65('0xe')]){if(this[_0xfd65('0xe')][_0xfd65('0x3a')](_0x1889d5)){if(this[_0xfd65('0xe')][_0x1889d5]['status']){_0x942ecc=this[_0xfd65('0x3b')](this['triggers'][_0x1889d5],_0x1c267a);if(_0x942ecc){_['merge'](_0x1c267a,_0x1c267a['variables']);for(var _0x28674c=0x0,_0x271f0b,_0x592191,_0x11057f;_0x28674c0x0){_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 _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x23f925,_0x145c52){var _0x19af12=function(_0x5ca76b){while(--_0x5ca76b){_0x23f925['push'](_0x23f925['shift']());}};_0x19af12(++_0x145c52);}(_0x7217,0x19e));var _0x7721=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x7217[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index b474aca..a94c773 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 _0x668f=['Descriptions','Fields','phonecall','queue','/contacts(','callDirection','phonecalls','assign','calleridnum','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%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','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','POST','clientId','username','password','then','access_token',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','userId','userEmail','systemuserid','catch','message','outbound','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','destcalleridnum','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','picklist','type','customField','idField','indexOf','ticketType','incident','incidents','Subjects','getString'];(function(_0x43763f,_0x338f0b){var _0x1132c3=function(_0xe79bc2){while(--_0xe79bc2){_0x43763f['push'](_0x43763f['shift']());}};_0x1132c3(++_0x338f0b);}(_0x668f,0x165));var _0xf668=function(_0x4d3ce4,_0x9b6ae8){_0x4d3ce4=_0x4d3ce4-0x0;var _0x2d578a=_0x668f[_0x4d3ce4];return _0x2d578a;};'use strict';var _=require(_0xf668('0x0'));var rp=require(_0xf668('0x1'));var util=require(_0xf668('0x2'));var intUtil=require(_0xf668('0x3'));var md5=require(_0xf668('0x4'));var Redis=require(_0xf668('0x5'));var logger=require(_0xf668('0x6'))(_0xf668('0x7'));var config=require('../../../../config/environment');config['redis']=_['defaults'](config[_0xf668('0x8')],{'host':_0xf668('0x9'),'port':0x18eb});var io=require(_0xf668('0xa'))(new Redis(config[_0xf668('0x8')]));function getAuthToken(_0x311588,_0x5082a4,_0x33f2ed){if(_0x311588[_0xf668('0xb')]){_0x311588[_0xf668('0xc')]=_0x311588[_0xf668('0xd')]['data7'];_0x311588[_0xf668('0xe')]=_0x311588[_0xf668('0xd')]['data2'];return Promise['resolve'](_0x311588[_0xf668('0xd')]['data5']);}var _0x9fd99a={'method':_0xf668('0xf'),'uri':_0x5082a4,'form':{'client_id':_0x311588[_0xf668('0x10')],'resource':_0x311588['remoteUri'],'username':_0x311588[_0xf668('0x11')],'password':_0x311588[_0xf668('0x12')],'grant_type':'password','client_secret':_0x311588['clientSecret']},'json':!![]};return rp(_0x9fd99a)[_0xf668('0x13')](function(_0x555d54){return _0x555d54[_0xf668('0x14')];})['catch'](function(_0x15b514){logger['error']('['+[_0x33f2ed['toUpperCase']()]+_0xf668('0x15'));return _0x15b514['message'];});}function getUser(_0x2c77df,_0x57e632,_0x1e36f5,_0x327d3d,_0x2c53a2,_0x4f4400){return new Promise(function(_0x1e099c,_0x400283){return getAuthToken(_0x57e632,_0x327d3d,_0x4f4400)[_0xf668('0x13')](function(_0x36ed46){var _0x5ab16b={'method':_0xf668('0x16'),'uri':_0x2c53a2+_0xf668('0x17'),'headers':{'Authorization':_0xf668('0x18')+_0x36ed46,'OData-Version':_0xf668('0x19')},'json':!![]};return rp(_0x5ab16b);})['then'](function(_0x5d1485){var _0x5ec6c2=_0x5d1485[_0xf668('0x1a')];var _0x46d124=![];var _0x313119=null;if(!_[_0xf668('0x1b')](_0x1e36f5)){if(intUtil['validateEmail'](_0x1e36f5['email'])){_0x2c77df['userEmail']=_0x1e36f5['email'];for(_0x313119=0x0;_0x313119<_0x5ec6c2[_0xf668('0x1c')];_0x313119++){if(_0x5ec6c2[_0x313119][_0xf668('0x1d')]===_0x1e36f5['email']&&!_0x5ec6c2[_0x313119]['isdisabled']){_0x46d124=!![];logger[_0xf668('0x1e')]('['+[_0x4f4400[_0xf668('0x1f')]()]+_0xf668('0x20')+_0x5ec6c2[_0x313119]['systemuserid']+'!');_0x2c77df[_0xf668('0x21')]=_0x5ec6c2[_0x313119]['systemuserid'];}}}}if(!_0x46d124){logger[_0xf668('0x1e')]('['+[_0x4f4400[_0xf668('0x1f')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x2c77df[_0xf668('0x22')]=_0x57e632[_0xf668('0x11')];for(_0x313119=0x0;_0x313119<_0x5ec6c2[_0xf668('0x1c')];_0x313119++){if(_0x5ec6c2[_0x313119]['internalemailaddress']===_0x57e632[_0xf668('0x11')]){_0x2c77df[_0xf668('0x21')]=_0x5ec6c2[_0x313119][_0xf668('0x23')];}}}_0x1e099c(_0x2c77df);})[_0xf668('0x24')](function(_0x2527f7){_0x400283(_0x2527f7[_0xf668('0x25')]);});});}function createEndUser(_0x1aa376,_0x29f2ae,_0x540192,_0x136f01,_0x1fa106,_0x5ea835,_0x45ad6e){return new Promise(function(_0x4ca9da,_0x1fc812){return getAuthToken(_0x29f2ae,_0x540192,_0x5ea835)[_0xf668('0x13')](function(_0x386e8f){var _0x525a93=_0x5ea835['toLowerCase']()===_0xf668('0x26')?_0x1fa106['destcalleridnum']:_0x1fa106['calleridnum'];var _0x5170b4={'method':'POST','uri':_0x136f01+'contacts','body':{'fullname':_0x525a93,'firstname':_0x525a93,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xf668('0x27')+_0x1aa376[_0xf668('0x21')]+')'},'headers':{'Authorization':_0xf668('0x18')+_0x386e8f,'OData-Version':_0xf668('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x5170b4['body'][_0x45ad6e]=_0x525a93;return rp(_0x5170b4);})['then'](function(_0x59221e){var _0x466369=_0x59221e[_0xf668('0x28')][_0xf668('0x29')];var _0x3cf52e=_0x466369[_0xf668('0x2a')](_0x466369[_0xf668('0x2b')]('(')+0x1,_0x466369[_0xf668('0x2b')](')'));_0x1aa376[_0xf668('0x2c')]=_0x3cf52e;_0x4ca9da(_0x1aa376);})[_0xf668('0x24')](function(_0x4400b7){_0x1fc812(_0x4400b7[_0xf668('0x25')]);});});}function getEndUser(_0x2f404e,_0x41fb6e,_0x50e05c,_0x591579,_0x471279,_0x129256,_0x5e2a6d,_0x26af7b){var _0x3f70aa=_0x129256[_0xf668('0x2d')]()===_0xf668('0x26')?_0x471279[_0xf668('0x2e')]:_0x471279['calleridnum'];return getAuthToken(_0x41fb6e,_0x50e05c,_0x129256)[_0xf668('0x13')](function(_0x2fb46a){_0x26af7b=_0x26af7b?_0x26af7b:_0xf668('0x2f');var _0x4e27ae={'method':_0xf668('0x16'),'uri':_0x591579+_0xf668('0x30')+_0x26af7b+_0xf668('0x31')+_0x26af7b+_0xf668('0x32')+_0x3f70aa[_0xf668('0x33')]('+',_0xf668('0x34'))+'\x27','headers':{'Authorization':_0xf668('0x18')+_0x2fb46a,'If-None-Match':null,'OData-Version':_0xf668('0x19')},'json':!![]};return rp(_0x4e27ae);})[_0xf668('0x13')](function(_0x2da99c){var _0x2363d9=![];if(!_0x2da99c)return _0x2363d9;var _0x4ca4fa=_0x2da99c[_0xf668('0x1a')];for(var _0x5873d2=0x0;_0x5873d2<_0x4ca4fa[_0xf668('0x1c')];_0x5873d2++){if(_0x4ca4fa[_0x5873d2][_0x26af7b]===_0x3f70aa){_0x2363d9=!![];_0x2f404e[_0xf668('0x2c')]=_0x4ca4fa[_0x5873d2][_0xf668('0x35')];}}return _0x2363d9;})[_0xf668('0x13')](function(_0x1c93ce){if(_0x1c93ce)return _0x2f404e;if(_0x5e2a6d===_0xf668('0x36')){logger[_0xf668('0x1e')]('['+[_0x129256['toUpperCase']()]+_0xf668('0x37'));return _0x2f404e;}return createEndUser(_0x2f404e,_0x41fb6e,_0x50e05c,_0x591579,_0x471279,_0x129256,_0x26af7b)[_0xf668('0x13')](function(_0x5cdace){logger['info']('['+[_0x129256[_0xf668('0x1f')]()]+']\x20Enduser\x20created!',_0x5cdace[_0xf668('0x2c')]);return _0x5cdace;});});}function getCustomFields(_0x3613ea,_0x49ed1c,_0xf9643b){var _0x14504f={};if(_0x3613ea[_0xf668('0x1c')]>0x0){_[_0xf668('0x38')](_0x3613ea,function(_0x37c26d){if(_['includes'](['string',_0xf668('0x39')],_0x37c26d[_0xf668('0x3a')])&&_0x37c26d['nameField']&&!_0x37c26d[_0xf668('0x3b')]){var _0x31f61b=_0x37c26d[_0xf668('0x3c')][_0xf668('0x2d')]();var _0xc618b0=_0x31f61b[_0xf668('0x2a')](0x0,_0x31f61b[_0xf668('0x3d')]('_'));var _0x2db86c=_0x31f61b[_0xf668('0x2a')](_0x31f61b[_0xf668('0x3d')]('_')+0x1);if(_0xc618b0===_0xf9643b){_0x14504f[_0x2db86c]=_0x37c26d['content'];}}});}return _0x14504f;}function getTicket(_0x41d32e,_0x54a694,_0x4eb6ae,_0x3c4450,_0x3e501f,_0x5206b7,_0x585d4c){return new Promise(function(_0x2c3af6,_0x2938e0){var _0x5baa02;return getAuthToken(_0x54a694,_0x4eb6ae,_0x585d4c)[_0xf668('0x13')](function(_0x171b18){if(_0x5206b7[_0xf668('0x3e')]===_0xf668('0x3f')){_0x5baa02={'method':'POST','uri':_0x3c4450+_0xf668('0x40'),'body':Object['assign']({},{'title':intUtil['getString'](_0x5206b7[_0xf668('0x41')],_0x3e501f,'\x20'),'description':intUtil[_0xf668('0x42')](_0x5206b7[_0xf668('0x43')],_0x3e501f,'\x0a'),'customerid_contact@odata.bind':_0x41d32e[_0xf668('0x2c')]?'/contacts('+_0x41d32e[_0xf668('0x2c')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x41d32e[_0xf668('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x5206b7[_0xf668('0x44')],_0x3e501f,_0x5206b7[_0xf668('0x3e')])),'headers':{'Authorization':_0xf668('0x18')+_0x171b18,'OData-Version':_0xf668('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5206b7['ticketType']===_0xf668('0x45')){var _0x3181f6=_0x41d32e[_0xf668('0x2c')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x41d32e[_0xf668('0x21')]+')','participationtypemask':_0x41d32e['callDirection']===_0xf668('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0xf668('0x47')+_0x41d32e[_0xf668('0x2c')]+')','participationtypemask':_0x41d32e['callDirection']===_0xf668('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xf668('0x27')+_0x41d32e[_0xf668('0x21')]+')','participationtypemask':_0x41d32e[_0xf668('0x48')]===_0xf668('0x46')?0x2:0x1}];_0x5baa02={'method':_0xf668('0xf'),'uri':_0x3c4450+_0xf668('0x49'),'body':Object[_0xf668('0x4a')]({},{'subject':intUtil[_0xf668('0x42')](_0x5206b7[_0xf668('0x41')],_0x3e501f,'\x20'),'phonenumber':String(_0x3e501f[_0xf668('0x4b')]),'description':intUtil[_0xf668('0x42')](_0x5206b7['Descriptions'],_0x3e501f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x41d32e[_0xf668('0x2c')]?_0xf668('0x47')+_0x41d32e[_0xf668('0x2c')]+')':undefined,'ownerid@odata.bind':_0xf668('0x27')+_0x41d32e[_0xf668('0x21')]+')','directioncode':_0x41d32e['callDirection']===_0xf668('0x46')?![]:!![],'phonecall_activity_parties':_0x3181f6},getCustomFields(_0x5206b7[_0xf668('0x44')],_0x3e501f,_0x5206b7[_0xf668('0x3e')])),'headers':{'Authorization':_0xf668('0x18')+_0x171b18,'OData-Version':_0xf668('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5baa02);})[_0xf668('0x13')](function(_0x173066){var _0x26d320=_0x173066[_0xf668('0x28')][_0xf668('0x29')];var _0x2d0261=_0x26d320['substring'](_0x26d320[_0xf668('0x2b')]('(')+0x1,_0x26d320[_0xf668('0x2b')](')'));_0x41d32e['ticketId']=_0x2d0261;_0x2c3af6(_0x41d32e);})[_0xf668('0x24')](function(_0x1f115a){_0x2938e0(_0x1f115a[_0xf668('0x25')]);});});}function emit(_0x1b01ea,_0x33fd0d,_0xaca168,_0x18b06e){var _0x7b8ab1={'uri':util[_0xf668('0x4c')](_0xf668('0x4d'),_0x1b01ea,_0xaca168,_0x18b06e)};io['to'](util[_0xf668('0x4c')]('user:%s',_0x33fd0d))['emit'](_0xf668('0x4e'),_0x7b8ab1);}exports['cs']=function(_0x45d896,_0x3be4a2,_0x5b529c,_0x3daff4,_0x28ecdb,_0x4479e3,_0x9c59b6,_0x8d333a){var _0x312a3a={};_0x4479e3[_0xf668('0xc')]=_0x4479e3['modernAuthentication']?intUtil[_0xf668('0x4f')](_0x4479e3[_0xf668('0xd')][_0xf668('0x50')]):intUtil[_0xf668('0x4f')](_0x4479e3['remoteUri']);_0x4479e3[_0xf668('0x51')]=intUtil[_0xf668('0x4f')](_0x4479e3['serverUrl']);_0x312a3a['callDirection']=_0x8d333a===_0xf668('0x46')||_0x8d333a===_0xf668('0x52')?_0xf668('0x46'):_0xf668('0x26');var _0x5b9673=_0x4479e3[_0xf668('0xb')]?util[_0xf668('0x4c')](_0xf668('0x53'),_0x4479e3[_0xf668('0xd')][_0xf668('0x50')]):util[_0xf668('0x4c')]('%s/api/data/v9.0/',_0x4479e3[_0xf668('0xc')]);var _0x3d1976=util[_0xf668('0x4c')](_0xf668('0x54'),_0x4479e3[_0xf668('0xe')]);var _0x369b67=util['format'](_0xf668('0x55'),_0x4479e3[_0xf668('0x51')],_0x3be4a2[_0xf668('0x56')],md5(_0x3be4a2[_0xf668('0x56')]));if(_0x28ecdb&&_0x28ecdb[_0xf668('0x57')]){logger[_0xf668('0x1e')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3be4a2[_0xf668('0x58')]=_0x369b67;}else if(_0x9c59b6&&_0x9c59b6[_0xf668('0x59')]&&_0x9c59b6[_0xf668('0x59')]!==_0xf668('0x5a')){logger[_0xf668('0x1e')](_0xf668('0x5b'),_0xf668('0x5c'));_0x3be4a2[_0xf668('0x58')]=_0x369b67;}else{_0x3be4a2[_0xf668('0x58')]='';}return getUser(_0x312a3a,_0x4479e3,_0x3daff4,_0x3d1976,_0x5b9673,_0x8d333a)[_0xf668('0x13')](function(_0x5eb160){logger['info']('['+_0x8d333a[_0xf668('0x1f')]()+_0xf668('0x5d'),_0x5eb160[_0xf668('0x21')]);logger['info']('['+_0x8d333a[_0xf668('0x1f')]()+']\x20The\x20User\x20email\x20is:',_0x5eb160[_0xf668('0x22')]);return getEndUser(_0x5eb160,_0x4479e3,_0x3d1976,_0x5b9673,_0x3be4a2,_0x8d333a,_0x5b529c[_0xf668('0x5e')],_0x5b529c[_0xf668('0x5f')]);})['then'](function(_0x3678b3){logger[_0xf668('0x1e')]('['+_0x8d333a[_0xf668('0x1f')]()+_0xf668('0x60'),_0x3678b3[_0xf668('0x2c')]);logger[_0xf668('0x1e')]('['+_0x8d333a[_0xf668('0x1f')]()+_0xf668('0x61'),_0x3be4a2[_0xf668('0x4b')]);return getTicket(_0x3678b3,_0x4479e3,_0x3d1976,_0x5b9673,_0x3be4a2,_0x5b529c,_0x8d333a);})[_0xf668('0x13')](function(_0x41e6b9){logger['info'](util[_0xf668('0x4c')]('['+_0x8d333a[_0xf668('0x1f')]()+_0xf668('0x62'),_0x5b529c[_0xf668('0x3e')],_0x41e6b9[_0xf668('0x63')]));logger[_0xf668('0x1e')](util['format']('['+_0x8d333a[_0xf668('0x1f')]()+']\x20Call\x20direction:\x20%s',_0x8d333a));if(_0x8d333a!==_0xf668('0x52')&&_0x5b529c[_0xf668('0x64')]){logger[_0xf668('0x1e')]('['+_0x8d333a[_0xf668('0x1f')]()+']',_0xf668('0x65'));emit(_0x4479e3[_0xf668('0xc')],_0x3daff4[_0xf668('0x66')],_0x5b529c[_0xf668('0x3e')],_0x41e6b9[_0xf668('0x63')]);}})[_0xf668('0x24')](function(_0x3e782e){logger[_0xf668('0x67')]('['+_0x8d333a[_0xf668('0x1f')]()+_0xf668('0x68'),_0x3e782e[_0xf668('0x25')]);console[_0xf668('0x67')](_0xf668('0x69'),_0x3e782e);});}; \ No newline at end of file +var _0xcc27=['isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','outbound','destcalleridnum','calleridnum','POST','/systemusers(','body','headers','lastIndexOf','enduserId','telephone1','contacts?$select=','&$filter=','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','length','forEach','includes','picklist','type','nameField','customField','idField','substring','indexOf','content','ticketType','incident','incidents','getString','Subjects','/contacts(','Fields','phonecall','queue','callDirection','phonecalls','assign','Descriptions','odata-entityid','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','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','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\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','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','CloudProvider','tenantId','resolve','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','userEmail','email','internalemailaddress'];(function(_0x65404,_0x34da3c){var _0x48b94d=function(_0x3d2d68){while(--_0x3d2d68){_0x65404['push'](_0x65404['shift']());}};_0x48b94d(++_0x34da3c);}(_0xcc27,0x19e));var _0x7cc2=function(_0x28996c,_0x4ecba6){_0x28996c=_0x28996c-0x0;var _0x2690eb=_0xcc27[_0x28996c];return _0x2690eb;};'use strict';var _=require('lodash');var rp=require(_0x7cc2('0x0'));var util=require(_0x7cc2('0x1'));var intUtil=require(_0x7cc2('0x2'));var md5=require(_0x7cc2('0x3'));var Redis=require(_0x7cc2('0x4'));var logger=require(_0x7cc2('0x5'))(_0x7cc2('0x6'));var config=require(_0x7cc2('0x7'));config[_0x7cc2('0x8')]=_[_0x7cc2('0x9')](config[_0x7cc2('0x8')],{'host':_0x7cc2('0xa'),'port':0x18eb});var io=require(_0x7cc2('0xb'))(new Redis(config[_0x7cc2('0x8')]));function getAuthToken(_0x5c40cf,_0x205bf5,_0x5aa741){if(_0x5c40cf['modernAuthentication']){_0x5c40cf[_0x7cc2('0xc')]=_0x5c40cf[_0x7cc2('0xd')]['data7'];_0x5c40cf[_0x7cc2('0xe')]=_0x5c40cf[_0x7cc2('0xd')]['data2'];return Promise[_0x7cc2('0xf')](_0x5c40cf[_0x7cc2('0xd')]['data5']);}var _0x2effe4={'method':'POST','uri':_0x205bf5,'form':{'client_id':_0x5c40cf['clientId'],'resource':_0x5c40cf[_0x7cc2('0xc')],'username':_0x5c40cf[_0x7cc2('0x10')],'password':_0x5c40cf['password'],'grant_type':_0x7cc2('0x11'),'client_secret':_0x5c40cf[_0x7cc2('0x12')]},'json':!![]};return rp(_0x2effe4)[_0x7cc2('0x13')](function(_0x2be1c1){return _0x2be1c1[_0x7cc2('0x14')];})[_0x7cc2('0x15')](function(_0x37cc83){logger[_0x7cc2('0x16')]('['+[_0x5aa741[_0x7cc2('0x17')]()]+_0x7cc2('0x18'));return _0x37cc83['message'];});}function getUser(_0x228d33,_0x98874c,_0x1cd2fb,_0x44e81f,_0x1ccb50,_0x1b85e5){return new Promise(function(_0x487f30,_0x357378){return getAuthToken(_0x98874c,_0x44e81f,_0x1b85e5)[_0x7cc2('0x13')](function(_0x331f5a){var _0x2d1052={'method':_0x7cc2('0x19'),'uri':_0x1ccb50+_0x7cc2('0x1a'),'headers':{'Authorization':_0x7cc2('0x1b')+_0x331f5a,'OData-Version':_0x7cc2('0x1c')},'json':!![]};return rp(_0x2d1052);})[_0x7cc2('0x13')](function(_0x53883b){var _0x43cea5=_0x53883b[_0x7cc2('0x1d')];var _0x336ad9=![];var _0xac3b7f=null;if(!_[_0x7cc2('0x1e')](_0x1cd2fb)){if(intUtil['validateEmail'](_0x1cd2fb['email'])){_0x228d33[_0x7cc2('0x1f')]=_0x1cd2fb[_0x7cc2('0x20')];for(_0xac3b7f=0x0;_0xac3b7f<_0x43cea5['length'];_0xac3b7f++){if(_0x43cea5[_0xac3b7f][_0x7cc2('0x21')]===_0x1cd2fb[_0x7cc2('0x20')]&&!_0x43cea5[_0xac3b7f][_0x7cc2('0x22')]){_0x336ad9=!![];logger[_0x7cc2('0x23')]('['+[_0x1b85e5[_0x7cc2('0x17')]()]+_0x7cc2('0x24')+_0x43cea5[_0xac3b7f][_0x7cc2('0x25')]+'!');_0x228d33[_0x7cc2('0x26')]=_0x43cea5[_0xac3b7f]['systemuserid'];}}}}if(!_0x336ad9){logger[_0x7cc2('0x23')]('['+[_0x1b85e5[_0x7cc2('0x17')]()]+_0x7cc2('0x27'));_0x228d33[_0x7cc2('0x1f')]=_0x98874c['username'];for(_0xac3b7f=0x0;_0xac3b7f<_0x43cea5['length'];_0xac3b7f++){if(_0x43cea5[_0xac3b7f][_0x7cc2('0x21')]===_0x98874c['username']){_0x228d33['userId']=_0x43cea5[_0xac3b7f]['systemuserid'];}}}_0x487f30(_0x228d33);})[_0x7cc2('0x15')](function(_0x3ae51a){_0x357378(_0x3ae51a[_0x7cc2('0x28')]);});});}function createEndUser(_0xed3daa,_0x4cbd64,_0x5222f9,_0x53507d,_0x2b6e25,_0x21271b,_0x574747){return new Promise(function(_0x32548f,_0x1436c6){return getAuthToken(_0x4cbd64,_0x5222f9,_0x21271b)[_0x7cc2('0x13')](function(_0x170a19){var _0xe614b6=_0x21271b[_0x7cc2('0x29')]()===_0x7cc2('0x2a')?_0x2b6e25[_0x7cc2('0x2b')]:_0x2b6e25[_0x7cc2('0x2c')];var _0x328f00={'method':_0x7cc2('0x2d'),'uri':_0x53507d+'contacts','body':{'fullname':_0xe614b6,'firstname':_0xe614b6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x7cc2('0x2e')+_0xed3daa['userId']+')'},'headers':{'Authorization':_0x7cc2('0x1b')+_0x170a19,'OData-Version':_0x7cc2('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x328f00[_0x7cc2('0x2f')][_0x574747]=_0xe614b6;return rp(_0x328f00);})['then'](function(_0x4eab64){var _0x53f882=_0x4eab64[_0x7cc2('0x30')]['odata-entityid'];var _0x53ced5=_0x53f882['substring'](_0x53f882[_0x7cc2('0x31')]('(')+0x1,_0x53f882[_0x7cc2('0x31')](')'));_0xed3daa[_0x7cc2('0x32')]=_0x53ced5;_0x32548f(_0xed3daa);})[_0x7cc2('0x15')](function(_0x483f48){_0x1436c6(_0x483f48[_0x7cc2('0x28')]);});});}function getEndUser(_0x20de40,_0x18b3cd,_0x50a059,_0x1d4137,_0xb85cef,_0x259f5c,_0x9c0faf,_0xb74009){var _0x164503=_0x259f5c[_0x7cc2('0x29')]()===_0x7cc2('0x2a')?_0xb85cef[_0x7cc2('0x2b')]:_0xb85cef[_0x7cc2('0x2c')];return getAuthToken(_0x18b3cd,_0x50a059,_0x259f5c)[_0x7cc2('0x13')](function(_0x5ef556){_0xb74009=_0xb74009?_0xb74009:_0x7cc2('0x33');var _0x124243={'method':'GET','uri':_0x1d4137+_0x7cc2('0x34')+_0xb74009+_0x7cc2('0x35')+_0xb74009+'\x20eq\x20\x27'+_0x164503[_0x7cc2('0x36')]('+',_0x7cc2('0x37'))+'\x27','headers':{'Authorization':_0x7cc2('0x1b')+_0x5ef556,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x124243);})['then'](function(_0x3ad94d){var _0xbf3192=![];if(!_0x3ad94d)return _0xbf3192;var _0x1f8236=_0x3ad94d[_0x7cc2('0x1d')];for(var _0x4f4193=0x0;_0x4f4193<_0x1f8236['length'];_0x4f4193++){if(_0x1f8236[_0x4f4193][_0xb74009]===_0x164503){_0xbf3192=!![];_0x20de40['enduserId']=_0x1f8236[_0x4f4193][_0x7cc2('0x38')];}}return _0xbf3192;})[_0x7cc2('0x13')](function(_0x447705){if(_0x447705)return _0x20de40;if(_0x9c0faf===_0x7cc2('0x39')){logger['info']('['+[_0x259f5c[_0x7cc2('0x17')]()]+_0x7cc2('0x3a'));return _0x20de40;}return createEndUser(_0x20de40,_0x18b3cd,_0x50a059,_0x1d4137,_0xb85cef,_0x259f5c,_0xb74009)[_0x7cc2('0x13')](function(_0x291945){logger[_0x7cc2('0x23')]('['+[_0x259f5c[_0x7cc2('0x17')]()]+']\x20Enduser\x20created!',_0x291945[_0x7cc2('0x32')]);return _0x291945;});});}function getCustomFields(_0x265387,_0x54a822,_0x43ebf5){var _0x9e3993={};if(_0x265387[_0x7cc2('0x3b')]>0x0){_[_0x7cc2('0x3c')](_0x265387,function(_0xbadbcd){if(_[_0x7cc2('0x3d')](['string',_0x7cc2('0x3e')],_0xbadbcd[_0x7cc2('0x3f')])&&_0xbadbcd[_0x7cc2('0x40')]&&!_0xbadbcd[_0x7cc2('0x41')]){var _0x2d5872=_0xbadbcd[_0x7cc2('0x42')][_0x7cc2('0x29')]();var _0x2bd66f=_0x2d5872[_0x7cc2('0x43')](0x0,_0x2d5872['indexOf']('_'));var _0x6fe220=_0x2d5872[_0x7cc2('0x43')](_0x2d5872[_0x7cc2('0x44')]('_')+0x1);if(_0x2bd66f===_0x43ebf5){_0x9e3993[_0x6fe220]=_0xbadbcd[_0x7cc2('0x45')];}}});}return _0x9e3993;}function getTicket(_0x3481a2,_0x44c294,_0xed2c2a,_0x32f0b7,_0x26bf68,_0x43000e,_0x224018){return new Promise(function(_0x404b92,_0x550a47){var _0x201ebd;return getAuthToken(_0x44c294,_0xed2c2a,_0x224018)[_0x7cc2('0x13')](function(_0x92d222){if(_0x43000e[_0x7cc2('0x46')]===_0x7cc2('0x47')){_0x201ebd={'method':_0x7cc2('0x2d'),'uri':_0x32f0b7+_0x7cc2('0x48'),'body':Object['assign']({},{'title':intUtil[_0x7cc2('0x49')](_0x43000e[_0x7cc2('0x4a')],_0x26bf68,'\x20'),'description':intUtil[_0x7cc2('0x49')](_0x43000e['Descriptions'],_0x26bf68,'\x0a'),'customerid_contact@odata.bind':_0x3481a2['enduserId']?_0x7cc2('0x4b')+_0x3481a2[_0x7cc2('0x32')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x3481a2[_0x7cc2('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x43000e[_0x7cc2('0x4c')],_0x26bf68,_0x43000e[_0x7cc2('0x46')])),'headers':{'Authorization':_0x7cc2('0x1b')+_0x92d222,'OData-Version':_0x7cc2('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x43000e['ticketType']===_0x7cc2('0x4d')){var _0x26c9c8=_0x3481a2[_0x7cc2('0x32')]?[{'partyid_systemuser@odata.bind':_0x7cc2('0x2e')+_0x3481a2['userId']+')','participationtypemask':_0x3481a2['callDirection']===_0x7cc2('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0x7cc2('0x4b')+_0x3481a2[_0x7cc2('0x32')]+')','participationtypemask':_0x3481a2[_0x7cc2('0x4f')]===_0x7cc2('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x3481a2[_0x7cc2('0x26')]+')','participationtypemask':_0x3481a2['callDirection']===_0x7cc2('0x4e')?0x2:0x1}];_0x201ebd={'method':'POST','uri':_0x32f0b7+_0x7cc2('0x50'),'body':Object[_0x7cc2('0x51')]({},{'subject':intUtil[_0x7cc2('0x49')](_0x43000e[_0x7cc2('0x4a')],_0x26bf68,'\x20'),'phonenumber':String(_0x26bf68['calleridnum']),'description':intUtil['getString'](_0x43000e[_0x7cc2('0x52')],_0x26bf68,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3481a2[_0x7cc2('0x32')]?_0x7cc2('0x4b')+_0x3481a2[_0x7cc2('0x32')]+')':undefined,'ownerid@odata.bind':_0x7cc2('0x2e')+_0x3481a2[_0x7cc2('0x26')]+')','directioncode':_0x3481a2[_0x7cc2('0x4f')]===_0x7cc2('0x4e')?![]:!![],'phonecall_activity_parties':_0x26c9c8},getCustomFields(_0x43000e[_0x7cc2('0x4c')],_0x26bf68,_0x43000e[_0x7cc2('0x46')])),'headers':{'Authorization':_0x7cc2('0x1b')+_0x92d222,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x201ebd);})['then'](function(_0x5d69d7){var _0x107434=_0x5d69d7[_0x7cc2('0x30')][_0x7cc2('0x53')];var _0x3f6856=_0x107434[_0x7cc2('0x43')](_0x107434['lastIndexOf']('(')+0x1,_0x107434[_0x7cc2('0x31')](')'));_0x3481a2[_0x7cc2('0x54')]=_0x3f6856;_0x404b92(_0x3481a2);})['catch'](function(_0x26258e){_0x550a47(_0x26258e[_0x7cc2('0x28')]);});});}function emit(_0x3f7c68,_0x73dcea,_0xd19fb8,_0x340b13){var _0x5d24d4={'uri':util[_0x7cc2('0x55')](_0x7cc2('0x56'),_0x3f7c68,_0xd19fb8,_0x340b13)};io['to'](util[_0x7cc2('0x55')](_0x7cc2('0x57'),_0x73dcea))['emit'](_0x7cc2('0x58'),_0x5d24d4);}exports['cs']=function(_0x429d5d,_0x1222ba,_0xb852a7,_0x1b85d0,_0x203602,_0x2b332f,_0x36ed04,_0x3ca3b7){var _0x2464c8={};_0x2b332f[_0x7cc2('0xc')]=_0x2b332f['modernAuthentication']?intUtil[_0x7cc2('0x59')](_0x2b332f[_0x7cc2('0xd')][_0x7cc2('0x5a')]):intUtil[_0x7cc2('0x59')](_0x2b332f['remoteUri']);_0x2b332f['serverUrl']=intUtil[_0x7cc2('0x59')](_0x2b332f[_0x7cc2('0x5b')]);_0x2464c8[_0x7cc2('0x4f')]=_0x3ca3b7==='queue'||_0x3ca3b7===_0x7cc2('0x5c')?_0x7cc2('0x4e'):_0x7cc2('0x2a');var _0x3e414b=_0x2b332f['modernAuthentication']?util['format'](_0x7cc2('0x5d'),_0x2b332f[_0x7cc2('0xd')][_0x7cc2('0x5a')]):util['format']('%s/api/data/v9.0/',_0x2b332f[_0x7cc2('0xc')]);var _0x42c58f=util['format'](_0x7cc2('0x5e'),_0x2b332f[_0x7cc2('0xe')]);var _0x5c4bd9=util[_0x7cc2('0x55')](_0x7cc2('0x5f'),_0x2b332f['serverUrl'],_0x1222ba[_0x7cc2('0x60')],md5(_0x1222ba[_0x7cc2('0x60')]));if(_0x203602&&_0x203602['monitor_format']){logger[_0x7cc2('0x23')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1222ba[_0x7cc2('0x61')]=_0x5c4bd9;}else if(_0x36ed04&&_0x36ed04[_0x7cc2('0x62')]&&_0x36ed04[_0x7cc2('0x62')]!==_0x7cc2('0x63')){logger[_0x7cc2('0x23')]('[OUTBOUND]',_0x7cc2('0x64'));_0x1222ba[_0x7cc2('0x61')]=_0x5c4bd9;}else{_0x1222ba['recordingURL']='';}return getUser(_0x2464c8,_0x2b332f,_0x1b85d0,_0x42c58f,_0x3e414b,_0x3ca3b7)[_0x7cc2('0x13')](function(_0xc1020c){logger[_0x7cc2('0x23')]('['+_0x3ca3b7[_0x7cc2('0x17')]()+']\x20The\x20User\x20ID\x20is:',_0xc1020c[_0x7cc2('0x26')]);logger[_0x7cc2('0x23')]('['+_0x3ca3b7['toUpperCase']()+_0x7cc2('0x65'),_0xc1020c[_0x7cc2('0x1f')]);return getEndUser(_0xc1020c,_0x2b332f,_0x42c58f,_0x3e414b,_0x1222ba,_0x3ca3b7,_0xb852a7[_0x7cc2('0x66')],_0xb852a7[_0x7cc2('0x67')]);})[_0x7cc2('0x13')](function(_0x67f040){logger[_0x7cc2('0x23')]('['+_0x3ca3b7[_0x7cc2('0x17')]()+_0x7cc2('0x68'),_0x67f040[_0x7cc2('0x32')]);logger['info']('['+_0x3ca3b7[_0x7cc2('0x17')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1222ba[_0x7cc2('0x2c')]);return getTicket(_0x67f040,_0x2b332f,_0x42c58f,_0x3e414b,_0x1222ba,_0xb852a7,_0x3ca3b7);})[_0x7cc2('0x13')](function(_0x28a9c0){logger[_0x7cc2('0x23')](util['format']('['+_0x3ca3b7[_0x7cc2('0x17')]()+_0x7cc2('0x69'),_0xb852a7[_0x7cc2('0x46')],_0x28a9c0['ticketId']));logger['info'](util[_0x7cc2('0x55')]('['+_0x3ca3b7['toUpperCase']()+_0x7cc2('0x6a'),_0x3ca3b7));if(_0x3ca3b7!==_0x7cc2('0x5c')&&_0xb852a7[_0x7cc2('0x6b')]){logger[_0x7cc2('0x23')]('['+_0x3ca3b7['toUpperCase']()+']',_0x7cc2('0x6c'));emit(_0x2b332f[_0x7cc2('0xc')],_0x1b85d0[_0x7cc2('0x6d')],_0xb852a7[_0x7cc2('0x46')],_0x28a9c0[_0x7cc2('0x54')]);}})['catch'](function(_0x105e2e){logger['error']('['+_0x3ca3b7[_0x7cc2('0x17')]()+_0x7cc2('0x6e'),_0x105e2e['message']);console['error'](_0x7cc2('0x6f'),_0x105e2e);});}; \ 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 ceaad22..bcc0f3a 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 _0x7ee9=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','[QUEUE]','user:%s','catch','error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','Authorization','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','
','Tags','name','custom_fields','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','%s/api/v2/agents','length','info','Agent\x20found!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','[HTTP]','stringify','GET','map','picklist','nameField','customField','toLowerCase','content','includes','string','type','idField','push','variable','variableName','customVariable','Variable','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL'];(function(_0x27ec50,_0x1d8698){var _0x2da0f5=function(_0x206a3e){while(--_0x206a3e){_0x27ec50['push'](_0x27ec50['shift']());}};_0x2da0f5(++_0x1d8698);}(_0x7ee9,0x6f));var _0x97ee=function(_0x2610f9,_0x531c0b){_0x2610f9=_0x2610f9-0x0;var _0x553bc1=_0x7ee9[_0x2610f9];return _0x553bc1;};'use strict';var _=require(_0x97ee('0x0'));var rp=require(_0x97ee('0x1'));var md5=require(_0x97ee('0x2'));var util=require(_0x97ee('0x3'));var Redis=require(_0x97ee('0x4'));var intUtil=require('./util');var config=require(_0x97ee('0x5'));var logger=require(_0x97ee('0x6'))(_0x97ee('0x7'));config[_0x97ee('0x8')]=_[_0x97ee('0x9')](config[_0x97ee('0x8')],{'host':_0x97ee('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x97ee('0x8')]));var headers={'Content-Type':_0x97ee('0xb'),'Accept':_0x97ee('0xb')};function emit(_0x2d6a37,_0x1c9da8,_0x4ac174){io['to'](_0x2d6a37)[_0x97ee('0xc')](_0x1c9da8,_0x4ac174);}function getTicket(_0x359627,_0x35138d,_0x5d280b,_0xecbfe5,_0x7fbe9a){logger['info'](_0x97ee('0xd'));var _0x11f774=_[_0x97ee('0xe')]({'responder_id':_0x35138d['id'],'requester_id':_0x5d280b['id'],'name':util[_0x97ee('0xf')](_0x97ee('0x10'),_0x7fbe9a[_0x97ee('0x11')]),'phone':_0x7fbe9a['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x97ee('0x12')](_0xecbfe5['Subjects'],_0x7fbe9a,'\x20'),'description':intUtil[_0x97ee('0x12')](_0xecbfe5[_0x97ee('0x13')],_0x7fbe9a,_0x97ee('0x14')),'tags':getTags(_0xecbfe5[_0x97ee('0x15')],_0x97ee('0x16'))},getCustomFields(_0xecbfe5['Fields'],_0x7fbe9a));_0x11f774[_0x97ee('0x17')]=_['mapValues'](_['keyBy'](_0x11f774['custom_fields'],'id'),_0x97ee('0x18'));return request({'uri':util[_0x97ee('0xf')](_0x97ee('0x19'),_0x359627[_0x97ee('0x1a')]),'method':'POST','body':_0x11f774})[_0x97ee('0x1b')](function(_0x25fe5d){logger['info'](_0x97ee('0x1c'));return _0x25fe5d;});}function getUser(_0x2c9292,_0x4e5f42){if(intUtil['validateEmail'](_0x4e5f42)){return request({'uri':util[_0x97ee('0xf')](_0x97ee('0x1d'),_0x2c9292[_0x97ee('0x1a')]),'qs':{'email':_0x4e5f42}})[_0x97ee('0x1b')](function(_0x34f337){if(_0x34f337[_0x97ee('0x1e')]){logger[_0x97ee('0x1f')](_0x97ee('0x20'));return _['find'](_0x34f337,function(_0x4db170){return _0x4db170['contact']['email']===_0x4e5f42;});}else{logger[_0x97ee('0x1f')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x97ee('0xf')](_0x97ee('0x21'),_0x2c9292[_0x97ee('0x1a')])})[_0x97ee('0x1b')](function(_0x216520){logger['info'](_0x97ee('0x22'));return _0x216520;});}});}else{logger[_0x97ee('0x1f')](_0x97ee('0x23'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x2c9292[_0x97ee('0x1a')])})[_0x97ee('0x1b')](function(_0x111949){logger[_0x97ee('0x1f')](_0x97ee('0x22'));return _0x111949;});}}function getEndUser(_0x31f3a0,_0x37d63f,_0x3b05f1){logger['info']('Searching\x20enduser\x20with\x20phone',_0x3b05f1);return request({'uri':util[_0x97ee('0xf')](_0x97ee('0x24'),_0x31f3a0[_0x97ee('0x1a')]),'qs':{'phone':_0x3b05f1}})[_0x97ee('0x1b')](function(_0x5d0eea){if(_0x5d0eea[_0x97ee('0x1e')]){logger['info'](_0x97ee('0x25'));return _['find'](_0x5d0eea,{'phone':_0x3b05f1});}else{logger[_0x97ee('0x1f')](_0x97ee('0x26'));return request({'uri':util[_0x97ee('0xf')]('%s/api/v2/contacts',_0x31f3a0[_0x97ee('0x1a')]),'method':_0x97ee('0x27'),'body':{'name':_0x37d63f,'phone':_0x3b05f1}})[_0x97ee('0x1b')](function(_0x2a516e){logger[_0x97ee('0x1f')](_0x97ee('0x28'));return _0x2a516e;});}});}function getAuth(_0x552415){return util[_0x97ee('0xf')](_0x97ee('0x29'),new Buffer(_0x552415[_0x97ee('0x2a')]+':X')[_0x97ee('0x2b')]('base64'));}function request(_0x524a7c){logger['debug'](_0x97ee('0x2c'),JSON[_0x97ee('0x2d')](_0x524a7c));return rp(_[_0x97ee('0x9')](_0x524a7c,{'method':_0x97ee('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x2d356b,_0x1a8092){var _0x37c25a=[];if(_0x2d356b&&_0x2d356b[_0x97ee('0x1e')]>0x0){_0x37c25a=_[_0x97ee('0x2f')](_0x2d356b,_0x1a8092);}return _0x37c25a;}function getCustomFields(_0x493ba7,_0xfb62b){var _0x2ee3b4=[];var _0x3b8c7e={'custom_fields':[]};if(_0x493ba7['length']>0x0){_['forEach'](_0x493ba7,function(_0x61eaef){if(_['includes'](['string',_0x97ee('0x30')],_0x61eaef['type'])&&_0x61eaef[_0x97ee('0x31')]&&!_0x61eaef[_0x97ee('0x32')]){_0x3b8c7e[_0x61eaef[_0x97ee('0x31')][_0x97ee('0x33')]()]=_0x61eaef[_0x97ee('0x34')][_0x97ee('0x2b')]();}else if(_[_0x97ee('0x35')]([_0x97ee('0x36'),'picklist'],_0x61eaef[_0x97ee('0x37')])&&_0x61eaef[_0x97ee('0x38')]&&_0x61eaef[_0x97ee('0x32')]){_0x3b8c7e[_0x97ee('0x17')][_0x97ee('0x39')]({'id':_0x61eaef['idField'],'value':_0x61eaef[_0x97ee('0x34')][_0x97ee('0x2b')]()});}else if(_0x61eaef['type']===_0x97ee('0x3a')&&_0x61eaef['variableName']&&_0x61eaef[_0x97ee('0x38')]&&_0x61eaef[_0x97ee('0x32')]){_0xfb62b[_0x61eaef[_0x97ee('0x3b')]]&&_0x3b8c7e[_0x97ee('0x17')][_0x97ee('0x39')]({'id':_0x61eaef[_0x97ee('0x38')],'value':_0xfb62b[_0x61eaef[_0x97ee('0x3b')]][_0x97ee('0x2b')]()});}else if(_0x61eaef[_0x97ee('0x37')]===_0x97ee('0x3c')&&_0x61eaef['Variable']&&_0x61eaef[_0x97ee('0x3d')]['name']&&_0x61eaef[_0x97ee('0x38')]&&_0x61eaef[_0x97ee('0x32')]){_0xfb62b[_0x61eaef[_0x97ee('0x3d')][_0x97ee('0x16')]['toLowerCase']()]&&_0x3b8c7e[_0x97ee('0x17')][_0x97ee('0x39')]({'id':_0x61eaef[_0x97ee('0x38')],'value':_0xfb62b[_0x61eaef[_0x97ee('0x3d')][_0x97ee('0x16')]['toLowerCase']()][_0x97ee('0x2b')]()});}});}return _0x3b8c7e;}exports[_0x97ee('0x3e')]=function(_0x4377b4,_0x60323,_0x4ffbac,_0x1807dd,_0x5bdbfa,_0x87c28b){var _0x4b2ae1,_0x27906e;_0x87c28b[_0x97ee('0x1a')]=intUtil['stripTrailingSlash'](_0x87c28b[_0x97ee('0x1a')]);_0x87c28b[_0x97ee('0x3f')]=intUtil['stripTrailingSlash'](_0x87c28b[_0x97ee('0x3f')]);if(_0x5bdbfa&&_0x5bdbfa[_0x97ee('0x40')]){logger[_0x97ee('0x1f')]('[QUEUE]',_0x97ee('0x41'));_0x60323[_0x97ee('0x42')]=util['format'](_0x97ee('0x43'),_0x87c28b['serverUrl'],_0x60323['uniqueid'],md5(_0x60323[_0x97ee('0x44')]));}else{_0x60323[_0x97ee('0x42')]='';}headers['Authorization']=getAuth(_0x87c28b);return getUser(_0x87c28b,_0x1807dd[_0x97ee('0x45')])[_0x97ee('0x1b')](function(_0x5144b1){_0x4b2ae1=_0x5144b1;logger[_0x97ee('0x1f')](_0x97ee('0x46'),_0x4b2ae1['id']);return getEndUser(_0x87c28b,_0x60323[_0x97ee('0x11')],_0x60323[_0x97ee('0x47')]);})[_0x97ee('0x1b')](function(_0x49660e){_0x27906e=_0x49660e;logger[_0x97ee('0x1f')](_0x97ee('0x48'),_0x27906e['id']);return getTicket(_0x87c28b,_0x4b2ae1,_0x27906e,_0x4ffbac,_0x60323);})[_0x97ee('0x1b')](function(_0x247717){if(_0x247717&&_0x247717['id']){logger[_0x97ee('0x1f')](_0x97ee('0x1c'));logger[_0x97ee('0x1f')]('The\x20Ticket\x20ID\x20is:',_0x247717['id']);logger[_0x97ee('0x1f')](_0x97ee('0x49'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x97ee('0xf')](_0x97ee('0x4a'),_0x1807dd[_0x97ee('0x16')]),'trigger:browser:url',{'uri':util[_0x97ee('0xf')]('%s/helpdesk/tickets/%d',_0x87c28b[_0x97ee('0x1a')],_0x247717['id'])});}})[_0x97ee('0x4b')](function(_0x24a707){logger[_0x97ee('0x4c')](_0x97ee('0x49'),JSON[_0x97ee('0x2d')](_0x24a707));});};exports[_0x97ee('0x4d')]=function(_0x1b0800,_0x5f0c88,_0x47bdd3,_0x57525c,_0x276717,_0x1e831e,_0x4e10db){var _0x50b4c9,_0x3fa8f6;_0x1e831e['remoteUri']=intUtil['stripTrailingSlash'](_0x1e831e[_0x97ee('0x1a')]);_0x1e831e['serverUrl']=intUtil[_0x97ee('0x4e')](_0x1e831e[_0x97ee('0x3f')]);if(_0x4e10db&&_0x4e10db[_0x97ee('0x4f')]&&_0x4e10db[_0x97ee('0x4f')]!==_0x97ee('0x50')){logger['info'](_0x97ee('0x51'),_0x97ee('0x41'));_0x5f0c88[_0x97ee('0x42')]=util[_0x97ee('0xf')](_0x97ee('0x43'),_0x1e831e['serverUrl'],_0x5f0c88[_0x97ee('0x44')],md5(_0x5f0c88[_0x97ee('0x44')]));}headers[_0x97ee('0x52')]=getAuth(_0x1e831e);return getUser(_0x1e831e,_0x57525c['email'])[_0x97ee('0x1b')](function(_0x4bbbc6){_0x50b4c9=_0x4bbbc6;logger[_0x97ee('0x1f')]('The\x20User\x20ID\x20is:',_0x50b4c9['id']);return getEndUser(_0x1e831e,_0x5f0c88['destcalleridname'],_0x5f0c88['destcalleridnum']);})[_0x97ee('0x1b')](function(_0x234d75){_0x3fa8f6=_0x234d75;logger[_0x97ee('0x1f')](_0x97ee('0x48'),_0x3fa8f6['id']);return getTicket(_0x1e831e,_0x50b4c9,_0x3fa8f6,_0x47bdd3,_0x5f0c88);})[_0x97ee('0x1b')](function(_0x1e43a1){if(_0x1e43a1&&_0x1e43a1['id']){logger['info'](_0x97ee('0x1c'));logger['info'](_0x97ee('0x53'),_0x1e43a1['id']);logger['info'](_0x97ee('0x51'),_0x97ee('0x54'));emit(util['format']('user:%s',_0x57525c[_0x97ee('0x16')]),_0x97ee('0x55'),{'uri':util[_0x97ee('0xf')](_0x97ee('0x56'),_0x1e831e['remoteUri'],_0x1e43a1['id'])});}})[_0x97ee('0x4b')](function(_0x1f9df0){logger[_0x97ee('0x4c')](_0x97ee('0x51'),JSON[_0x97ee('0x2d')](_0x1f9df0));});};exports['unmanaged']=function(_0xc89308,_0x55596f,_0xe17d32,_0x437643,_0x5b93ec,_0x1c9653){var _0xec9caf,_0x5952f3;_0x1c9653[_0x97ee('0x1a')]=intUtil[_0x97ee('0x4e')](_0x1c9653[_0x97ee('0x1a')]);_0x1c9653[_0x97ee('0x3f')]=intUtil[_0x97ee('0x4e')](_0x1c9653[_0x97ee('0x3f')]);if(_0x5b93ec&&_0x5b93ec[_0x97ee('0x40')]){logger[_0x97ee('0x1f')]('['+_0x55596f[_0x97ee('0x57')][_0x97ee('0x58')]()+']',_0x97ee('0x41'));_0x55596f[_0x97ee('0x42')]=util[_0x97ee('0xf')](_0x97ee('0x43'),_0x1c9653[_0x97ee('0x3f')],_0x55596f[_0x97ee('0x44')],md5(_0x55596f[_0x97ee('0x44')]));}else{_0x55596f[_0x97ee('0x42')]='';}headers[_0x97ee('0x52')]=getAuth(_0x1c9653);return getUser(_0x1c9653,'')[_0x97ee('0x1b')](function(_0x13b6e4){_0xec9caf=_0x13b6e4;logger[_0x97ee('0x1f')]('The\x20User\x20ID\x20is:',_0xec9caf['id']);return getEndUser(_0x1c9653,_0x55596f['calleridname'],_0x55596f['calleridnum']);})[_0x97ee('0x1b')](function(_0x3c3e6e){_0x5952f3=_0x3c3e6e;logger[_0x97ee('0x1f')](_0x97ee('0x48'),_0x5952f3['id']);return getTicket(_0x1c9653,_0xec9caf,_0x5952f3,_0xe17d32,_0x55596f);})['then'](function(_0x24a825){if(_0x24a825){logger[_0x97ee('0x1f')](_0x97ee('0x1c'));logger['info'](_0x97ee('0x53'),_0x24a825['id']);}})[_0x97ee('0x4b')](function(_0x7b1a64){logger[_0x97ee('0x4c')]('['+_0x55596f[_0x97ee('0x57')][_0x97ee('0x58')]()+']',JSON[_0x97ee('0x2d')](_0x7b1a64));});}; \ No newline at end of file +var _0x4847=['Authorization','lodash','request-promise','util','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','[HTTP]','stringify','forEach','includes','string','nameField','toLowerCase','content','picklist','type','idField','customField','variable','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x4847,0x11e));var _0x7484=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4847[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x7484('0x0'));var rp=require(_0x7484('0x1'));var md5=require('md5');var util=require(_0x7484('0x2'));var Redis=require('ioredis');var intUtil=require(_0x7484('0x3'));var config=require('../../../../config/environment');var logger=require(_0x7484('0x4'))(_0x7484('0x5'));config[_0x7484('0x6')]=_[_0x7484('0x7')](config[_0x7484('0x6')],{'host':_0x7484('0x8'),'port':0x18eb});var io=require(_0x7484('0x9'))(new Redis(config[_0x7484('0x6')]));var headers={'Content-Type':_0x7484('0xa'),'Accept':_0x7484('0xa')};function emit(_0x46aa5a,_0x44fd6c,_0x4901c3){io['to'](_0x46aa5a)[_0x7484('0xb')](_0x44fd6c,_0x4901c3);}function getTicket(_0x262cf5,_0x5c7c3a,_0x11ac46,_0x2bfdc1,_0x278359){logger[_0x7484('0xc')](_0x7484('0xd'));var _0x52efa6=_[_0x7484('0xe')]({'responder_id':_0x5c7c3a['id'],'requester_id':_0x11ac46['id'],'name':util[_0x7484('0xf')](_0x7484('0x10'),_0x278359[_0x7484('0x11')]),'phone':_0x278359['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7484('0x12')](_0x2bfdc1['Subjects'],_0x278359,'\x20'),'description':intUtil['getString'](_0x2bfdc1[_0x7484('0x13')],_0x278359,_0x7484('0x14')),'tags':getTags(_0x2bfdc1[_0x7484('0x15')],_0x7484('0x16'))},getCustomFields(_0x2bfdc1[_0x7484('0x17')],_0x278359));_0x52efa6[_0x7484('0x18')]=_[_0x7484('0x19')](_[_0x7484('0x1a')](_0x52efa6[_0x7484('0x18')],'id'),_0x7484('0x1b'));return request({'uri':util[_0x7484('0xf')](_0x7484('0x1c'),_0x262cf5[_0x7484('0x1d')]),'method':_0x7484('0x1e'),'body':_0x52efa6})[_0x7484('0x1f')](function(_0x32274c){logger[_0x7484('0xc')](_0x7484('0x20'));return _0x32274c;});}function getUser(_0x17ec60,_0x5b5997){if(intUtil[_0x7484('0x21')](_0x5b5997)){return request({'uri':util[_0x7484('0xf')]('%s/api/v2/agents',_0x17ec60[_0x7484('0x1d')]),'qs':{'email':_0x5b5997}})['then'](function(_0x47ed1d){if(_0x47ed1d[_0x7484('0x22')]){logger[_0x7484('0xc')](_0x7484('0x23'));return _[_0x7484('0x24')](_0x47ed1d,function(_0x19f12a){return _0x19f12a[_0x7484('0x25')][_0x7484('0x26')]===_0x5b5997;});}else{logger[_0x7484('0xc')](_0x7484('0x27'));return request({'uri':util['format'](_0x7484('0x28'),_0x17ec60[_0x7484('0x1d')])})[_0x7484('0x1f')](function(_0x42c4e0){logger[_0x7484('0xc')](_0x7484('0x29'));return _0x42c4e0;});}});}else{logger[_0x7484('0xc')](_0x7484('0x2a'));return request({'uri':util['format'](_0x7484('0x28'),_0x17ec60['remoteUri'])})[_0x7484('0x1f')](function(_0x5cf355){logger['info'](_0x7484('0x29'));return _0x5cf355;});}}function getEndUser(_0xca0094,_0x2fda3e,_0x335ef0){logger[_0x7484('0xc')]('Searching\x20enduser\x20with\x20phone',_0x335ef0);return request({'uri':util[_0x7484('0xf')](_0x7484('0x2b'),_0xca0094[_0x7484('0x1d')]),'qs':{'phone':_0x335ef0}})[_0x7484('0x1f')](function(_0x44142b){if(_0x44142b[_0x7484('0x22')]){logger[_0x7484('0xc')](_0x7484('0x2c'));return _[_0x7484('0x24')](_0x44142b,{'phone':_0x335ef0});}else{logger[_0x7484('0xc')](_0x7484('0x2d'));return request({'uri':util[_0x7484('0xf')](_0x7484('0x2b'),_0xca0094[_0x7484('0x1d')]),'method':_0x7484('0x1e'),'body':{'name':_0x2fda3e,'phone':_0x335ef0}})['then'](function(_0x7e1fa){logger[_0x7484('0xc')](_0x7484('0x2e'));return _0x7e1fa;});}});}function getAuth(_0xf3270c){return util[_0x7484('0xf')](_0x7484('0x2f'),new Buffer(_0xf3270c[_0x7484('0x30')]+':X')[_0x7484('0x31')]('base64'));}function request(_0x585be2){logger['debug'](_0x7484('0x32'),JSON[_0x7484('0x33')](_0x585be2));return rp(_[_0x7484('0x7')](_0x585be2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x516d20,_0x50751b){var _0x3457a6=[];if(_0x516d20&&_0x516d20[_0x7484('0x22')]>0x0){_0x3457a6=_['map'](_0x516d20,_0x50751b);}return _0x3457a6;}function getCustomFields(_0x5b174d,_0x2dcdb0){var _0x47d929=[];var _0x187c83={'custom_fields':[]};if(_0x5b174d[_0x7484('0x22')]>0x0){_[_0x7484('0x34')](_0x5b174d,function(_0x27840c){if(_[_0x7484('0x35')]([_0x7484('0x36'),'picklist'],_0x27840c['type'])&&_0x27840c[_0x7484('0x37')]&&!_0x27840c['customField']){_0x187c83[_0x27840c['nameField'][_0x7484('0x38')]()]=_0x27840c[_0x7484('0x39')][_0x7484('0x31')]();}else if(_['includes']([_0x7484('0x36'),_0x7484('0x3a')],_0x27840c[_0x7484('0x3b')])&&_0x27840c[_0x7484('0x3c')]&&_0x27840c[_0x7484('0x3d')]){_0x187c83[_0x7484('0x18')]['push']({'id':_0x27840c[_0x7484('0x3c')],'value':_0x27840c[_0x7484('0x39')]['toString']()});}else if(_0x27840c[_0x7484('0x3b')]===_0x7484('0x3e')&&_0x27840c['variableName']&&_0x27840c[_0x7484('0x3c')]&&_0x27840c['customField']){_0x2dcdb0[_0x27840c['variableName']]&&_0x187c83[_0x7484('0x18')][_0x7484('0x3f')]({'id':_0x27840c[_0x7484('0x3c')],'value':_0x2dcdb0[_0x27840c['variableName']]['toString']()});}else if(_0x27840c[_0x7484('0x3b')]===_0x7484('0x40')&&_0x27840c[_0x7484('0x41')]&&_0x27840c[_0x7484('0x41')][_0x7484('0x16')]&&_0x27840c[_0x7484('0x3c')]&&_0x27840c['customField']){_0x2dcdb0[_0x27840c[_0x7484('0x41')][_0x7484('0x16')]['toLowerCase']()]&&_0x187c83['custom_fields'][_0x7484('0x3f')]({'id':_0x27840c[_0x7484('0x3c')],'value':_0x2dcdb0[_0x27840c[_0x7484('0x41')][_0x7484('0x16')][_0x7484('0x38')]()][_0x7484('0x31')]()});}});}return _0x187c83;}exports[_0x7484('0x42')]=function(_0x34b4e0,_0x438a2e,_0x2efe6c,_0x30efe5,_0x3ff4e7,_0x4751a8){var _0x43e3dc,_0x504afb;_0x4751a8['remoteUri']=intUtil[_0x7484('0x43')](_0x4751a8[_0x7484('0x1d')]);_0x4751a8['serverUrl']=intUtil[_0x7484('0x43')](_0x4751a8[_0x7484('0x44')]);if(_0x3ff4e7&&_0x3ff4e7[_0x7484('0x45')]){logger[_0x7484('0xc')](_0x7484('0x46'),'Recording\x20is\x20enabled!');_0x438a2e[_0x7484('0x47')]=util['format'](_0x7484('0x48'),_0x4751a8[_0x7484('0x44')],_0x438a2e[_0x7484('0x49')],md5(_0x438a2e[_0x7484('0x49')]));}else{_0x438a2e[_0x7484('0x47')]='';}headers['Authorization']=getAuth(_0x4751a8);return getUser(_0x4751a8,_0x30efe5[_0x7484('0x26')])['then'](function(_0x25bb91){_0x43e3dc=_0x25bb91;logger[_0x7484('0xc')](_0x7484('0x4a'),_0x43e3dc['id']);return getEndUser(_0x4751a8,_0x438a2e[_0x7484('0x11')],_0x438a2e[_0x7484('0x4b')]);})[_0x7484('0x1f')](function(_0x5ab2b9){_0x504afb=_0x5ab2b9;logger['info'](_0x7484('0x4c'),_0x504afb['id']);return getTicket(_0x4751a8,_0x43e3dc,_0x504afb,_0x2efe6c,_0x438a2e);})['then'](function(_0x47bd2d){if(_0x47bd2d&&_0x47bd2d['id']){logger[_0x7484('0xc')](_0x7484('0x20'));logger[_0x7484('0xc')](_0x7484('0x4d'),_0x47bd2d['id']);logger[_0x7484('0xc')](_0x7484('0x46'),_0x7484('0x4e'));emit(util[_0x7484('0xf')]('user:%s',_0x30efe5[_0x7484('0x16')]),_0x7484('0x4f'),{'uri':util[_0x7484('0xf')](_0x7484('0x50'),_0x4751a8['remoteUri'],_0x47bd2d['id'])});}})[_0x7484('0x51')](function(_0x24b43e){logger[_0x7484('0x52')](_0x7484('0x46'),JSON[_0x7484('0x33')](_0x24b43e));});};exports[_0x7484('0x53')]=function(_0x34dda3,_0x5361b1,_0x36eee6,_0x3c3067,_0x28407d,_0x27a776,_0x4bdf60){var _0x1d9899,_0x578756;_0x27a776['remoteUri']=intUtil[_0x7484('0x43')](_0x27a776[_0x7484('0x1d')]);_0x27a776[_0x7484('0x44')]=intUtil[_0x7484('0x43')](_0x27a776[_0x7484('0x44')]);if(_0x4bdf60&&_0x4bdf60['recordingFormat']&&_0x4bdf60[_0x7484('0x54')]!==_0x7484('0x55')){logger[_0x7484('0xc')](_0x7484('0x56'),'Recording\x20is\x20enabled!');_0x5361b1[_0x7484('0x47')]=util[_0x7484('0xf')](_0x7484('0x48'),_0x27a776[_0x7484('0x44')],_0x5361b1[_0x7484('0x49')],md5(_0x5361b1[_0x7484('0x49')]));}headers['Authorization']=getAuth(_0x27a776);return getUser(_0x27a776,_0x3c3067[_0x7484('0x26')])[_0x7484('0x1f')](function(_0x1a9090){_0x1d9899=_0x1a9090;logger[_0x7484('0xc')](_0x7484('0x4a'),_0x1d9899['id']);return getEndUser(_0x27a776,_0x5361b1[_0x7484('0x57')],_0x5361b1[_0x7484('0x58')]);})[_0x7484('0x1f')](function(_0x4b7773){_0x578756=_0x4b7773;logger[_0x7484('0xc')](_0x7484('0x4c'),_0x578756['id']);return getTicket(_0x27a776,_0x1d9899,_0x578756,_0x36eee6,_0x5361b1);})['then'](function(_0x2f1be7){if(_0x2f1be7&&_0x2f1be7['id']){logger['info'](_0x7484('0x20'));logger[_0x7484('0xc')](_0x7484('0x4d'),_0x2f1be7['id']);logger['info'](_0x7484('0x56'),_0x7484('0x4e'));emit(util[_0x7484('0xf')](_0x7484('0x59'),_0x3c3067[_0x7484('0x16')]),_0x7484('0x4f'),{'uri':util[_0x7484('0xf')](_0x7484('0x50'),_0x27a776[_0x7484('0x1d')],_0x2f1be7['id'])});}})['catch'](function(_0xe3417f){logger[_0x7484('0x52')]('[OUTBOUND]',JSON['stringify'](_0xe3417f));});};exports[_0x7484('0x5a')]=function(_0x3b4198,_0x2943c0,_0x2fc235,_0x23a56c,_0x33738a,_0x22bb67){var _0x529c0b,_0x28e6c5;_0x22bb67[_0x7484('0x1d')]=intUtil[_0x7484('0x43')](_0x22bb67[_0x7484('0x1d')]);_0x22bb67['serverUrl']=intUtil[_0x7484('0x43')](_0x22bb67[_0x7484('0x44')]);if(_0x33738a&&_0x33738a[_0x7484('0x45')]){logger[_0x7484('0xc')]('['+_0x2943c0[_0x7484('0x5b')][_0x7484('0x5c')]()+']',_0x7484('0x5d'));_0x2943c0[_0x7484('0x47')]=util[_0x7484('0xf')](_0x7484('0x48'),_0x22bb67[_0x7484('0x44')],_0x2943c0[_0x7484('0x49')],md5(_0x2943c0[_0x7484('0x49')]));}else{_0x2943c0[_0x7484('0x47')]='';}headers[_0x7484('0x5e')]=getAuth(_0x22bb67);return getUser(_0x22bb67,'')[_0x7484('0x1f')](function(_0x5f554d){_0x529c0b=_0x5f554d;logger[_0x7484('0xc')](_0x7484('0x4a'),_0x529c0b['id']);return getEndUser(_0x22bb67,_0x2943c0[_0x7484('0x11')],_0x2943c0[_0x7484('0x4b')]);})['then'](function(_0x2e8aea){_0x28e6c5=_0x2e8aea;logger[_0x7484('0xc')](_0x7484('0x4c'),_0x28e6c5['id']);return getTicket(_0x22bb67,_0x529c0b,_0x28e6c5,_0x2fc235,_0x2943c0);})['then'](function(_0x4f49f8){if(_0x4f49f8){logger['info'](_0x7484('0x20'));logger[_0x7484('0xc')](_0x7484('0x4d'),_0x4f49f8['id']);}})[_0x7484('0x51')](function(_0x197bab){logger[_0x7484('0x52')]('['+_0x2943c0[_0x7484('0x5b')][_0x7484('0x5c')]()+']',JSON[_0x7484('0x33')](_0x197bab));});}; \ 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 29297cf..00c74c1 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 _0x4622=['inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','headers','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','GET','/api/selector/owners','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','message','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','catch','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','Task\x20created:','error','toUpperCase','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration'];(function(_0x2fe19b,_0x341817){var _0x4c0fe8=function(_0x3ae58c){while(--_0x3ae58c){_0x2fe19b['push'](_0x2fe19b['shift']());}};_0x4c0fe8(++_0x341817);}(_0x4622,0x112));var _0x2462=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0x4622[_0x503950];return _0x1657a9;};'use strict';var _=require(_0x2462('0x0'));var rp=require(_0x2462('0x1'));var md5=require(_0x2462('0x2'));var util=require('util');var moment=require(_0x2462('0x3'));var Promise=require(_0x2462('0x4'));var Redis=require(_0x2462('0x5'));var intUtil=require(_0x2462('0x6'));var config=require(_0x2462('0x7'));var logger=require('../../../../config/logger')(_0x2462('0x8'));config[_0x2462('0x9')]=_[_0x2462('0xa')](config[_0x2462('0x9')],{'host':_0x2462('0xb'),'port':0x18eb});var io=require(_0x2462('0xc'))(new Redis(config['redis']));function getAdminId(_0x5791df,_0xf42612,_0x153ad8,_0x33bb26){return new Promise(function(_0x5ba0ac,_0x4f3d67){var _0x49273a=![];var _0x466991={'method':'GET','uri':_0x33bb26+'/api/selector/owners','json':!![]};_0x466991[_0x2462('0xd')]=_0x153ad8;logger['info'](_0x2462('0xe'));return rp(_0x466991)[_0x2462('0xf')](function(_0x1bfa2d){if(_0x1bfa2d){var _0x1b7aaa=_0x1bfa2d['users'];var _0x13d67b=null;for(_0x13d67b=0x0;_0x13d67b<_0x1b7aaa[_0x2462('0x10')];_0x13d67b++){if(_0x1b7aaa[_0x13d67b][_0x2462('0x11')]===_0x5791df[_0x2462('0x12')]){_0x5791df[_0x2462('0x13')]=_0x1b7aaa[_0x13d67b]['id'];_0x49273a=!![];}}if(_0x49273a){logger[_0x2462('0x14')](_0x2462('0x15'),_0x5791df[_0x2462('0x13')]);_0x5ba0ac(_0x5791df);}else{_0x4f3d67({'statusCode':0x194,'message':_0x2462('0x16')});}}else{_0x4f3d67({'statusCode':0x194,'message':_0x2462('0x16')});}})['catch'](function(_0x165ccf){logger['error']('['+[_0xf42612['toUpperCase']()]+']',_0x165ccf['message']);_0x4f3d67(_0x165ccf);});});}function getUser(_0x5d1de1,_0x4769c8,_0x13c9fc){return function(_0x48d8d7){return new Promise(function(_0x1f81b2,_0x431b8e){var _0x11899f={'method':_0x2462('0x17'),'uri':_0x13c9fc+_0x2462('0x18'),'json':!![]};_0x11899f[_0x2462('0xd')]=_0x4769c8;logger[_0x2462('0x14')]('Getting\x20user\x20list');return rp(_0x11899f)[_0x2462('0xf')](function(_0xa375dc){if(_0xa375dc){var _0x292425=_0xa375dc['users'];var _0x48ee31=![];var _0x424392=null;if(_0x48d8d7[_0x2462('0x19')]!==null){logger[_0x2462('0x14')](_0x2462('0x1a'),_0x48d8d7['agentEmail']);_0x48d8d7[_0x2462('0x1b')]=_0x48d8d7[_0x2462('0x19')];for(_0x424392=0x0;_0x424392<_0x292425[_0x2462('0x10')];_0x424392++){if(_0x292425[_0x424392][_0x2462('0x11')]===_0x48d8d7[_0x2462('0x19')]){_0x48ee31=!![];_0x48d8d7['userId']=_0x292425[_0x424392]['id'];logger['info'](_0x2462('0x1c'),_0x48d8d7[_0x2462('0x1d')]);}}}if(!_0x48ee31){logger[_0x2462('0x14')](_0x2462('0x1e'));_0x48d8d7[_0x2462('0x1b')]=_0x48d8d7[_0x2462('0x12')];_0x48d8d7['userId']=_0x48d8d7[_0x2462('0x13')];_0x48ee31=!![];}if(_0x48ee31){_0x1f81b2(_0x48d8d7);}else{_0x431b8e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x431b8e({'statusCode':0x194,'message':_0x2462('0x16')});}})['catch'](function(_0x1a302f){logger['error']('['+[_0x5d1de1['toUpperCase']()]+']',_0x1a302f[_0x2462('0x1f')]);_0x431b8e(_0x1a302f);});});};}function searchContact(_0x4eb4b5,_0x17cee9,_0x55c7f1,_0x176f43){return new Promise(function(_0x280131,_0xe64854){var _0x427d91={'method':_0x2462('0x17'),'headers':_0x17cee9,'uri':_0x4eb4b5+_0x2462('0x20')+_0x176f43+_0x2462('0x21')+_0x55c7f1+_0x2462('0x22'),'json':!![]};rp(_0x427d91)['then'](function(_0x5bf676){var _0x168d5b=_[_0x2462('0x23')](_0x5bf676[_0x2462('0x24')][_0x2462('0x24')],[_0x55c7f1,_0x176f43]);_0x280131(_0x168d5b);})['catch'](function(_0x218080){_0xe64854(_0x218080);});});}function getEndUser(_0x10d0bb,_0x4d8b23,_0x2c53cb){return function(_0x1fa169){return new Promise(function(_0xbed7ce,_0xe26bc){logger[_0x2462('0x14')](util[_0x2462('0x25')](_0x2462('0x26'),_0x1fa169['contactNumber']));searchContact(_0x2c53cb,_0x4d8b23,_0x2462('0x27'),_0x1fa169[_0x2462('0x28')])[_0x2462('0xf')](function(_0x29271c){if(_0x29271c){_0x1fa169[_0x2462('0x29')]=_0x29271c['id'];logger['info'](_0x2462('0x2a'),_0x1fa169[_0x2462('0x29')]);return _0xbed7ce(_0x1fa169);}searchContact(_0x2c53cb,_0x4d8b23,_0x2462('0x2b'),_0x1fa169[_0x2462('0x28')])[_0x2462('0xf')](function(_0x20c513){if(_0x20c513){_0x1fa169[_0x2462('0x29')]=_0x20c513['id'];logger[_0x2462('0x14')](_0x2462('0x2c'),_0x1fa169[_0x2462('0x29')]);return _0xbed7ce(_0x1fa169);}createEndUser(_0x1fa169,_0x10d0bb,_0x4d8b23,_0x2c53cb)['then'](function(_0x47b747){logger[_0x2462('0x14')](_0x2462('0x2d'),_0x47b747[_0x2462('0x29')]);return _0xbed7ce(_0x47b747);});});})[_0x2462('0x2e')](function(_0x49f820){_0xe26bc(_0x49f820);});});};}function createEndUser(_0x41feeb,_0x50bd0c,_0x3bd1e9,_0x4b9475){return new Promise(function(_0x24ab23,_0x46cace){var _0x2d9073=moment();var _0x55cab1={'method':'POST','uri':_0x4b9475+'/api/contacts','body':{'contact':{'last_name':_0x41feeb['contactNumber'],'work_number':_0x41feeb[_0x2462('0x28')],'mobile_number':_0x41feeb['contactNumber'],'owner_id':_0x41feeb[_0x2462('0x1d')],'created_at':_0x2d9073['format'](_0x2462('0x2f'))}},'json':!![]};_0x55cab1[_0x2462('0xd')]=_0x3bd1e9;logger[_0x2462('0x14')](_0x2462('0x30'));return rp(_0x55cab1)[_0x2462('0xf')](function(_0x2ca7ef){_0x41feeb[_0x2462('0x29')]=_0x2ca7ef[_0x2462('0x31')]['id'];_0x24ab23(_0x41feeb);})['catch'](function(_0x3d1b6b){logger['error']('['+[_0x50bd0c['toUpperCase']()]+']',_0x3d1b6b[_0x2462('0x1f')]);_0x46cace(_0x3d1b6b[_0x2462('0x1f')]);});});}function getTicket(_0x5df3ef,_0xc174aa,_0x930c2c,_0x4d6165,_0x5f07c){return function(_0x22db6b){logger[_0x2462('0x14')](_0x2462('0x32'));return new Promise(function(_0x35d02c,_0x4fe7de){var _0x4ed044=moment();var _0x2f771c={'method':_0x2462('0x33'),'uri':_0x930c2c+_0x2462('0x34'),'body':{'title':intUtil[_0x2462('0x35')](_0x4d6165[_0x2462('0x36')],_0x5f07c,'\x20'),'description':intUtil[_0x2462('0x35')](_0x4d6165[_0x2462('0x37')],_0x5f07c,'\x0a'),'owner_id':_0x22db6b[_0x2462('0x1d')],'creater_id':_0x22db6b[_0x2462('0x13')],'targetable_id':_0x22db6b[_0x2462('0x29')],'targetable_type':_0x2462('0x38'),'created_at':_0x4ed044[_0x2462('0x25')](_0x2462('0x2f')),'due_date':_0x4ed044[_0x2462('0x39')](0x1e,'m')[_0x2462('0x25')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x2f771c[_0x2462('0xd')]=_0xc174aa;return rp(_0x2f771c)[_0x2462('0xf')](function(_0xfa0f76){_0x22db6b[_0x2462('0x3a')]=_0xfa0f76[_0x2462('0x3b')]['id'];logger[_0x2462('0x14')](_0x2462('0x3c'),_0x22db6b[_0x2462('0x3a')]);_0x35d02c(_0x22db6b);})[_0x2462('0x2e')](function(_0x24601d){logger[_0x2462('0x3d')]('['+[_0x5df3ef[_0x2462('0x3e')]()]+']',_0x24601d[_0x2462('0x1f')]);_0x4fe7de(_0x24601d[_0x2462('0x1f')]);});});};}function emit(_0x3e3bda,_0x103ac0,_0xf4bf51){var _0x57c99e={'uri':_0x3e3bda+_0x2462('0x3f')+_0xf4bf51};io['to'](util[_0x2462('0x25')](_0x2462('0x40'),_0x103ac0))[_0x2462('0x41')](_0x2462('0x42'),_0x57c99e);}exports['cs']=function(_0x598aa3,_0x2f1c23,_0x480944,_0x4a8a2e,_0x1d095c,_0x5eb977,_0x4c810b,_0x179891){var _0x355d06={};var _0x984f85={'Authorization':_0x2462('0x43')+_0x5eb977[_0x2462('0x44')]};_0x5eb977[_0x2462('0x45')]=intUtil[_0x2462('0x46')](_0x5eb977[_0x2462('0x45')]);_0x5eb977['serverUrl']=intUtil[_0x2462('0x46')](_0x5eb977[_0x2462('0x47')]);var _0x170e6b=_0x5eb977['remoteUri'];_0x355d06[_0x2462('0x12')]=_0x5eb977[_0x2462('0x48')];_0x355d06[_0x2462('0x28')]=_0x179891[_0x2462('0x49')]()===_0x2462('0x4a')?_0x2f1c23['destcalleridnum']:_0x2f1c23[_0x2462('0x4b')];_0x355d06[_0x2462('0x4c')]=_0x179891===_0x2462('0x4d')||_0x179891==='unmanaged'?_0x2462('0x4d'):_0x2462('0x4a');if(_0x4a8a2e){_0x355d06[_0x2462('0x19')]=_0x4a8a2e[_0x2462('0x11')];}var _0x438cca=util[_0x2462('0x25')](_0x2462('0x4e'),_0x5eb977[_0x2462('0x47')],_0x2f1c23[_0x2462('0x4f')],md5(_0x2f1c23[_0x2462('0x4f')]));if(_0x1d095c&&_0x1d095c[_0x2462('0x50')]){logger['info'](_0x2462('0x51'),_0x2462('0x52'));_0x2f1c23[_0x2462('0x53')]=_0x438cca;}else if(_0x4c810b&&_0x4c810b[_0x2462('0x54')]&&_0x4c810b[_0x2462('0x54')]!=='none'){logger[_0x2462('0x14')](_0x2462('0x55'),_0x2462('0x52'));_0x2f1c23[_0x2462('0x53')]=_0x438cca;}else{_0x2f1c23[_0x2462('0x53')]='';}return getAdminId(_0x355d06,_0x179891,_0x984f85,_0x170e6b)[_0x2462('0xf')](getUser(_0x179891,_0x984f85,_0x170e6b))['then'](getEndUser(_0x179891,_0x984f85,_0x170e6b))[_0x2462('0xf')](getTicket(_0x179891,_0x984f85,_0x170e6b,_0x480944,_0x2f1c23))['then'](function(_0xa48712){logger['info'](util['format'](_0x2462('0x56'),_0xa48712[_0x2462('0x3a')]));if(_0x179891!==_0x2462('0x57')){logger[_0x2462('0x14')]('['+[_0x179891[_0x2462('0x3e')]()]+']',_0x2462('0x58'));emit(_0x170e6b,_0x4a8a2e['name'],_0xa48712[_0x2462('0x29')]);}})[_0x2462('0x2e')](function(_0x134f9e){logger[_0x2462('0x3d')]('['+[_0x179891[_0x2462('0x3e')]()]+_0x2462('0x59'),util[_0x2462('0x5a')](_0x134f9e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfafd=['Descriptions','Contact','add','format','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username','toLowerCase','outbound','calleridnum','callDirection','queue','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','none','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','localhost','socket.io-emitter','redis','GET','/api/selector/owners','headers','info','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','message','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','toUpperCase','/api/lookup?q=','&f=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','POST','/api/tasks','getString'];(function(_0x53accb,_0x1b4eb6){var _0x5a9de8=function(_0xb10d8){while(--_0xb10d8){_0x53accb['push'](_0x53accb['shift']());}};_0x5a9de8(++_0x1b4eb6);}(_0xfafd,0x172));var _0xdfaf=function(_0x2f7612,_0x3e2402){_0x2f7612=_0x2f7612-0x0;var _0x193a44=_0xfafd[_0x2f7612];return _0x193a44;};'use strict';var _=require('lodash');var rp=require(_0xdfaf('0x0'));var md5=require(_0xdfaf('0x1'));var util=require(_0xdfaf('0x2'));var moment=require(_0xdfaf('0x3'));var Promise=require(_0xdfaf('0x4'));var Redis=require(_0xdfaf('0x5'));var intUtil=require(_0xdfaf('0x6'));var config=require(_0xdfaf('0x7'));var logger=require(_0xdfaf('0x8'))(_0xdfaf('0x9'));config['redis']=_['defaults'](config['redis'],{'host':_0xdfaf('0xa'),'port':0x18eb});var io=require(_0xdfaf('0xb'))(new Redis(config[_0xdfaf('0xc')]));function getAdminId(_0x23b036,_0x59fdba,_0x192788,_0x5bac6d){return new Promise(function(_0x4a8fa7,_0x7c6822){var _0x46c72e=![];var _0x2b1277={'method':_0xdfaf('0xd'),'uri':_0x5bac6d+_0xdfaf('0xe'),'json':!![]};_0x2b1277[_0xdfaf('0xf')]=_0x192788;logger[_0xdfaf('0x10')]('Getting\x20admin\x20information');return rp(_0x2b1277)[_0xdfaf('0x11')](function(_0xdf43f5){if(_0xdf43f5){var _0x49a50f=_0xdf43f5[_0xdfaf('0x12')];var _0x2bfce1=null;for(_0x2bfce1=0x0;_0x2bfce1<_0x49a50f[_0xdfaf('0x13')];_0x2bfce1++){if(_0x49a50f[_0x2bfce1]['email']===_0x23b036[_0xdfaf('0x14')]){_0x23b036[_0xdfaf('0x15')]=_0x49a50f[_0x2bfce1]['id'];_0x46c72e=!![];}}if(_0x46c72e){logger[_0xdfaf('0x10')](_0xdfaf('0x16'),_0x23b036[_0xdfaf('0x15')]);_0x4a8fa7(_0x23b036);}else{_0x7c6822({'statusCode':0x194,'message':_0xdfaf('0x17')});}}else{_0x7c6822({'statusCode':0x194,'message':_0xdfaf('0x17')});}})[_0xdfaf('0x18')](function(_0x38917f){logger['error']('['+[_0x59fdba['toUpperCase']()]+']',_0x38917f[_0xdfaf('0x19')]);_0x7c6822(_0x38917f);});});}function getUser(_0x428b82,_0x106a07,_0x43b010){return function(_0x157567){return new Promise(function(_0xde1960,_0x4e34a1){var _0x528132={'method':_0xdfaf('0xd'),'uri':_0x43b010+_0xdfaf('0xe'),'json':!![]};_0x528132[_0xdfaf('0xf')]=_0x106a07;logger[_0xdfaf('0x10')](_0xdfaf('0x1a'));return rp(_0x528132)[_0xdfaf('0x11')](function(_0x162f6e){if(_0x162f6e){var _0x193b42=_0x162f6e[_0xdfaf('0x12')];var _0x167285=![];var _0x37ee6d=null;if(_0x157567[_0xdfaf('0x1b')]!==null){logger[_0xdfaf('0x10')]('Getting\x20user\x20with\x20email',_0x157567[_0xdfaf('0x1b')]);_0x157567[_0xdfaf('0x1c')]=_0x157567[_0xdfaf('0x1b')];for(_0x37ee6d=0x0;_0x37ee6d<_0x193b42[_0xdfaf('0x13')];_0x37ee6d++){if(_0x193b42[_0x37ee6d]['email']===_0x157567[_0xdfaf('0x1b')]){_0x167285=!![];_0x157567[_0xdfaf('0x1d')]=_0x193b42[_0x37ee6d]['id'];logger[_0xdfaf('0x10')](_0xdfaf('0x1e'),_0x157567['userId']);}}}if(!_0x167285){logger['info']('Admin\x20selected');_0x157567[_0xdfaf('0x1c')]=_0x157567[_0xdfaf('0x14')];_0x157567[_0xdfaf('0x1d')]=_0x157567[_0xdfaf('0x15')];_0x167285=!![];}if(_0x167285){_0xde1960(_0x157567);}else{_0x4e34a1({'statusCode':0x194,'message':_0xdfaf('0x17')});}}else{_0x4e34a1({'statusCode':0x194,'message':_0xdfaf('0x17')});}})[_0xdfaf('0x18')](function(_0x591f8d){logger['error']('['+[_0x428b82[_0xdfaf('0x1f')]()]+']',_0x591f8d[_0xdfaf('0x19')]);_0x4e34a1(_0x591f8d);});});};}function searchContact(_0x15729a,_0xe8c6cd,_0x3f48b8,_0x4649b8){return new Promise(function(_0x365627,_0x471bd4){var _0x3f8315={'method':_0xdfaf('0xd'),'headers':_0xe8c6cd,'uri':_0x15729a+_0xdfaf('0x20')+_0x4649b8+_0xdfaf('0x21')+_0x3f48b8+'&entities=contact','json':!![]};rp(_0x3f8315)[_0xdfaf('0x11')](function(_0x28b451){var _0x519c90=_[_0xdfaf('0x22')](_0x28b451[_0xdfaf('0x23')][_0xdfaf('0x23')],[_0x3f48b8,_0x4649b8]);_0x365627(_0x519c90);})[_0xdfaf('0x18')](function(_0x18270e){_0x471bd4(_0x18270e);});});}function getEndUser(_0x150165,_0x6d4106,_0x536d1e){return function(_0x1207cb){return new Promise(function(_0x3778da,_0x2ab953){logger[_0xdfaf('0x10')](util['format'](_0xdfaf('0x24'),_0x1207cb['contactNumber']));searchContact(_0x536d1e,_0x6d4106,_0xdfaf('0x25'),_0x1207cb[_0xdfaf('0x26')])[_0xdfaf('0x11')](function(_0x31e804){if(_0x31e804){_0x1207cb[_0xdfaf('0x27')]=_0x31e804['id'];logger[_0xdfaf('0x10')](_0xdfaf('0x28'),_0x1207cb[_0xdfaf('0x27')]);return _0x3778da(_0x1207cb);}searchContact(_0x536d1e,_0x6d4106,_0xdfaf('0x29'),_0x1207cb['contactNumber'])[_0xdfaf('0x11')](function(_0x5dcc92){if(_0x5dcc92){_0x1207cb[_0xdfaf('0x27')]=_0x5dcc92['id'];logger[_0xdfaf('0x10')](_0xdfaf('0x2a'),_0x1207cb[_0xdfaf('0x27')]);return _0x3778da(_0x1207cb);}createEndUser(_0x1207cb,_0x150165,_0x6d4106,_0x536d1e)[_0xdfaf('0x11')](function(_0x474464){logger['info']('Contact\x20created:',_0x474464['endUserId']);return _0x3778da(_0x474464);});});})['catch'](function(_0x12af8a){_0x2ab953(_0x12af8a);});});};}function createEndUser(_0x3dbba6,_0x484287,_0x18e1f0,_0x4ead75){return new Promise(function(_0x113e40,_0x486cba){var _0x3a6080=moment();var _0x737cbd={'method':'POST','uri':_0x4ead75+_0xdfaf('0x2b'),'body':{'contact':{'last_name':_0x3dbba6[_0xdfaf('0x26')],'work_number':_0x3dbba6[_0xdfaf('0x26')],'mobile_number':_0x3dbba6[_0xdfaf('0x26')],'owner_id':_0x3dbba6['userId'],'created_at':_0x3a6080['format'](_0xdfaf('0x2c'))}},'json':!![]};_0x737cbd['headers']=_0x18e1f0;logger[_0xdfaf('0x10')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x737cbd)[_0xdfaf('0x11')](function(_0x4cfe6d){_0x3dbba6[_0xdfaf('0x27')]=_0x4cfe6d[_0xdfaf('0x2d')]['id'];_0x113e40(_0x3dbba6);})[_0xdfaf('0x18')](function(_0xa7739b){logger['error']('['+[_0x484287[_0xdfaf('0x1f')]()]+']',_0xa7739b[_0xdfaf('0x19')]);_0x486cba(_0xa7739b[_0xdfaf('0x19')]);});});}function getTicket(_0x1e7710,_0x541cc7,_0xbcf1b3,_0x23ddd0,_0x1723a6){return function(_0x425eef){logger[_0xdfaf('0x10')](_0xdfaf('0x2e'));return new Promise(function(_0x3175ff,_0x32959a){var _0x24ab2d=moment();var _0x102d40={'method':_0xdfaf('0x2f'),'uri':_0xbcf1b3+_0xdfaf('0x30'),'body':{'title':intUtil[_0xdfaf('0x31')](_0x23ddd0['Subjects'],_0x1723a6,'\x20'),'description':intUtil[_0xdfaf('0x31')](_0x23ddd0[_0xdfaf('0x32')],_0x1723a6,'\x0a'),'owner_id':_0x425eef['userId'],'creater_id':_0x425eef[_0xdfaf('0x15')],'targetable_id':_0x425eef[_0xdfaf('0x27')],'targetable_type':_0xdfaf('0x33'),'created_at':_0x24ab2d['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x24ab2d[_0xdfaf('0x34')](0x1e,'m')[_0xdfaf('0x35')](_0xdfaf('0x2c'))},'json':!![]};_0x102d40[_0xdfaf('0xf')]=_0x541cc7;return rp(_0x102d40)['then'](function(_0x11416e){_0x425eef[_0xdfaf('0x36')]=_0x11416e[_0xdfaf('0x37')]['id'];logger[_0xdfaf('0x10')]('Task\x20created:',_0x425eef[_0xdfaf('0x36')]);_0x3175ff(_0x425eef);})['catch'](function(_0x5c7925){logger['error']('['+[_0x1e7710[_0xdfaf('0x1f')]()]+']',_0x5c7925[_0xdfaf('0x19')]);_0x32959a(_0x5c7925[_0xdfaf('0x19')]);});});};}function emit(_0xc5b751,_0x55aeea,_0x5e49fe){var _0x1ba806={'uri':_0xc5b751+_0xdfaf('0x38')+_0x5e49fe};io['to'](util[_0xdfaf('0x35')](_0xdfaf('0x39'),_0x55aeea))[_0xdfaf('0x3a')](_0xdfaf('0x3b'),_0x1ba806);}exports['cs']=function(_0x544bfc,_0xd6f13c,_0x520869,_0x5e818b,_0x24f17f,_0x49b4c9,_0x13a568,_0x183c01){var _0x4aed05={};var _0x2c9c0f={'Authorization':_0xdfaf('0x3c')+_0x49b4c9['apiKey']};_0x49b4c9[_0xdfaf('0x3d')]=intUtil[_0xdfaf('0x3e')](_0x49b4c9[_0xdfaf('0x3d')]);_0x49b4c9['serverUrl']=intUtil['stripTrailingSlash'](_0x49b4c9['serverUrl']);var _0x2ac409=_0x49b4c9[_0xdfaf('0x3d')];_0x4aed05[_0xdfaf('0x14')]=_0x49b4c9[_0xdfaf('0x3f')];_0x4aed05[_0xdfaf('0x26')]=_0x183c01[_0xdfaf('0x40')]()===_0xdfaf('0x41')?_0xd6f13c['destcalleridnum']:_0xd6f13c[_0xdfaf('0x42')];_0x4aed05[_0xdfaf('0x43')]=_0x183c01===_0xdfaf('0x44')||_0x183c01==='unmanaged'?_0xdfaf('0x44'):_0xdfaf('0x41');if(_0x5e818b){_0x4aed05[_0xdfaf('0x1b')]=_0x5e818b[_0xdfaf('0x45')];}var _0x1be388=util[_0xdfaf('0x35')](_0xdfaf('0x46'),_0x49b4c9[_0xdfaf('0x47')],_0xd6f13c['uniqueid'],md5(_0xd6f13c[_0xdfaf('0x48')]));if(_0x24f17f&&_0x24f17f[_0xdfaf('0x49')]){logger[_0xdfaf('0x10')](_0xdfaf('0x4a'),_0xdfaf('0x4b'));_0xd6f13c['recordingURL']=_0x1be388;}else if(_0x13a568&&_0x13a568['recordingFormat']&&_0x13a568['recordingFormat']!==_0xdfaf('0x4c')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0xd6f13c['recordingURL']=_0x1be388;}else{_0xd6f13c['recordingURL']='';}return getAdminId(_0x4aed05,_0x183c01,_0x2c9c0f,_0x2ac409)['then'](getUser(_0x183c01,_0x2c9c0f,_0x2ac409))[_0xdfaf('0x11')](getEndUser(_0x183c01,_0x2c9c0f,_0x2ac409))['then'](getTicket(_0x183c01,_0x2c9c0f,_0x2ac409,_0x520869,_0xd6f13c))[_0xdfaf('0x11')](function(_0x21b972){logger[_0xdfaf('0x10')](util[_0xdfaf('0x35')](_0xdfaf('0x4d'),_0x21b972['ticketId']));if(_0x183c01!==_0xdfaf('0x4e')){logger[_0xdfaf('0x10')]('['+[_0x183c01['toUpperCase']()]+']',_0xdfaf('0x4f'));emit(_0x2ac409,_0x5e818b[_0xdfaf('0x50')],_0x21b972[_0xdfaf('0x27')]);}})[_0xdfaf('0x18')](function(_0x509437){logger[_0xdfaf('0x51')]('['+[_0x183c01[_0xdfaf('0x1f')]()]+_0xdfaf('0x52'),util[_0xdfaf('0x53')](_0x509437,{'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 7aa4697..b5b4e7b 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 _0x9bd9=['freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data2','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','data1','unknown\x20integration','error','[EXEC]','format','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm'];(function(_0x87a0d9,_0x37386e){var _0x219984=function(_0x410c8b){while(--_0x410c8b){_0x87a0d9['push'](_0x87a0d9['shift']());}};_0x219984(++_0x37386e);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x2a1465,_0x8bf785){_0x2a1465=_0x2a1465-0x0;var _0x128933=_0x9bd9[_0x2a1465];return _0x128933;};'use strict';var _=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var zendesk=require(_0x99bd('0x2'));var salesforce=require(_0x99bd('0x3'));var sugarcrm=require(_0x99bd('0x4'));var freshdesk=require(_0x99bd('0x5'));var zoho=require('./zoho');var desk=require(_0x99bd('0x6'));var vtiger=require('./vtiger');var servicenow=require(_0x99bd('0x7'));var dynamics365=require(_0x99bd('0x8'));var freshsales=require('./freshsales');var integrations=[_0x99bd('0x9'),_0x99bd('0xa'),_0x99bd('0xb'),_0x99bd('0xc'),_0x99bd('0xd'),_0x99bd('0xe'),_0x99bd('0xf'),_0x99bd('0x10'),_0x99bd('0x11'),_0x99bd('0x12')];exports[_0x99bd('0x13')]=function(_0x468b6e,_0x2ded61,_0x2c479b,_0x521f4c,_0x2b836f,_0x529796){if(_0x2c479b){if(_[_0x99bd('0x14')](integrations,_0x468b6e['data1'][_0x99bd('0x15')]())){try{var _0x219902=null;var _0x4a8bd9='';var _0x22237c=_0x2c479b[_0x468b6e['data1'][_0x99bd('0x15')]()];if(_0x22237c){var _0x48b2aa=_0x22237c[_0x468b6e[_0x99bd('0x16')]];if(_0x48b2aa){var _0x401299=_[_0x99bd('0x17')](_0x48b2aa['Configurations'],{'id':parseInt(_0x468b6e[_0x99bd('0x18')],0xa)});if(_0x401299){if(_0x521f4c){if(_0x2b836f&&_0x2ded61[_0x99bd('0x19')]){_0x4a8bd9=_0x99bd('0x19');}else if(_0x2ded61[_0x99bd('0x1a')]){_0x4a8bd9=_0x99bd('0x1b');}else{console[_0x99bd('0x1c')](_0x99bd('0x1d'),_0x2ded61);}}else{_0x4a8bd9=_0x99bd('0x1e');}switch(_0x468b6e[_0x99bd('0x1f')]['toLowerCase']()){case _0x99bd('0x9'):zendesk[_0x4a8bd9](_0x468b6e,_0x2ded61,_0x401299,_0x521f4c,_0x2b836f,_0x48b2aa,_0x529796);break;case _0x99bd('0xa'):salesforce[_0x4a8bd9](_0x468b6e,_0x2ded61,_0x401299,_0x521f4c,_0x2b836f,_0x48b2aa,_0x529796);break;case _0x99bd('0xb'):sugarcrm[_0x4a8bd9](_0x468b6e,_0x2ded61,_0x401299,_0x521f4c,_0x2b836f,_0x48b2aa,_0x529796);break;case'freshdesk':freshdesk[_0x4a8bd9](_0x468b6e,_0x2ded61,_0x401299,_0x521f4c,_0x2b836f,_0x48b2aa,_0x529796);break;case'zoho':zoho[_0x4a8bd9](_0x468b6e,_0x2ded61,_0x401299,_0x521f4c,_0x2b836f,_0x48b2aa,_0x529796);break;case _0x99bd('0xe'):desk[_0x4a8bd9](_0x468b6e,_0x2ded61,_0x401299,_0x521f4c,_0x2b836f,_0x48b2aa,_0x529796);break;case _0x99bd('0xf'):vtiger[_0x4a8bd9](_0x468b6e,_0x2ded61,_0x401299,_0x521f4c,_0x2b836f,_0x48b2aa,_0x529796);break;case _0x99bd('0x11'):freshsales['cs'](_0x468b6e,_0x2ded61,_0x401299,_0x521f4c,_0x2b836f,_0x48b2aa,_0x529796,_0x4a8bd9);break;case _0x99bd('0x12'):servicenow['cs'](_0x468b6e,_0x2ded61,_0x401299,_0x521f4c,_0x2b836f,_0x48b2aa,_0x529796,_0x4a8bd9);break;case _0x99bd('0x10'):dynamics365['cs'](_0x468b6e,_0x2ded61,_0x401299,_0x521f4c,_0x2b836f,_0x48b2aa,_0x529796,_0x4a8bd9);break;default:console['log'](_0x99bd('0x20'));}}else{_0x219902=require('../../../../config/logger')(_0x468b6e[_0x99bd('0x1f')][_0x99bd('0x15')]());_0x219902[_0x99bd('0x21')](_0x99bd('0x22'),util[_0x99bd('0x23')]('%s\x20configuration\x20#%s\x20not\x20found',_0x468b6e[_0x99bd('0x1f')][_0x99bd('0x15')](),_0x468b6e[_0x99bd('0x18')]));}}else{_0x219902=require('../../../../config/logger')(_0x468b6e[_0x99bd('0x1f')]['toLowerCase']());_0x219902['error'](_0x99bd('0x22'),util[_0x99bd('0x23')]('%s\x20account\x20#%s\x20not\x20found',_0x468b6e[_0x99bd('0x1f')][_0x99bd('0x15')](),_0x468b6e[_0x99bd('0x16')]));}}else{}}catch(_0x3f7bf4){console['error'](_0x3f7bf4);}}}}; \ No newline at end of file +var _0x4c82=['log','unmanaged','freshdesk','desk','freshsales','error','format','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','zoho','vtiger','dynamics365','servicenow','includes','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound'];(function(_0x2a32a1,_0x252aed){var _0x32813f=function(_0x52cf27){while(--_0x52cf27){_0x2a32a1['push'](_0x2a32a1['shift']());}};_0x32813f(++_0x252aed);}(_0x4c82,0xb5));var _0x24c8=function(_0xc0754,_0x37f107){_0xc0754=_0xc0754-0x0;var _0x195498=_0x4c82[_0xc0754];return _0x195498;};'use strict';var _=require(_0x24c8('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x24c8('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x24c8('0x2'));var zoho=require('./zoho');var desk=require(_0x24c8('0x3'));var vtiger=require(_0x24c8('0x4'));var servicenow=require(_0x24c8('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0x24c8('0x6'));var integrations=[_0x24c8('0x7'),_0x24c8('0x8'),_0x24c8('0x9'),'freshdesk',_0x24c8('0xa'),'desk',_0x24c8('0xb'),_0x24c8('0xc'),'freshsales',_0x24c8('0xd')];exports['exec']=function(_0x5e6afe,_0x1c49fa,_0x58cdfd,_0x2b2526,_0x6ce0a2,_0x4193ac){if(_0x58cdfd){if(_[_0x24c8('0xe')](integrations,_0x5e6afe[_0x24c8('0xf')][_0x24c8('0x10')]())){try{var _0x3cef2a=null;var _0xb60b0f='';var _0x286da6=_0x58cdfd[_0x5e6afe['data1'][_0x24c8('0x10')]()];if(_0x286da6){var _0x49d0f6=_0x286da6[_0x5e6afe[_0x24c8('0x11')]];if(_0x49d0f6){var _0x2a8e23=_[_0x24c8('0x12')](_0x49d0f6[_0x24c8('0x13')],{'id':parseInt(_0x5e6afe['data3'],0xa)});if(_0x2a8e23){if(_0x2b2526){if(_0x6ce0a2&&_0x1c49fa[_0x24c8('0x14')]){_0xb60b0f='queue';}else if(_0x1c49fa[_0x24c8('0x15')]){_0xb60b0f=_0x24c8('0x16');}else{console[_0x24c8('0x17')]('EVENT\x20UNKNOWN',_0x1c49fa);}}else{_0xb60b0f=_0x24c8('0x18');}switch(_0x5e6afe[_0x24c8('0xf')][_0x24c8('0x10')]()){case _0x24c8('0x7'):zendesk[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case'salesforce':salesforce[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case'sugarcrm':sugarcrm[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case _0x24c8('0x19'):freshdesk[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case'zoho':zoho[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case _0x24c8('0x1a'):desk[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case'vtiger':vtiger[_0xb60b0f](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac);break;case _0x24c8('0x1b'):freshsales['cs'](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac,_0xb60b0f);break;case _0x24c8('0xd'):servicenow['cs'](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac,_0xb60b0f);break;case _0x24c8('0xc'):dynamics365['cs'](_0x5e6afe,_0x1c49fa,_0x2a8e23,_0x2b2526,_0x6ce0a2,_0x49d0f6,_0x4193ac,_0xb60b0f);break;default:console[_0x24c8('0x17')]('unknown\x20integration');}}else{_0x3cef2a=require('../../../../config/logger')(_0x5e6afe['data1'][_0x24c8('0x10')]());_0x3cef2a[_0x24c8('0x1c')]('[EXEC]',util[_0x24c8('0x1d')](_0x24c8('0x1e'),_0x5e6afe[_0x24c8('0xf')][_0x24c8('0x10')](),_0x5e6afe[_0x24c8('0x1f')]));}}else{_0x3cef2a=require('../../../../config/logger')(_0x5e6afe[_0x24c8('0xf')]['toLowerCase']());_0x3cef2a[_0x24c8('0x1c')](_0x24c8('0x20'),util[_0x24c8('0x1d')](_0x24c8('0x21'),_0x5e6afe[_0x24c8('0xf')][_0x24c8('0x10')](),_0x5e6afe['data2']));}}else{}}catch(_0x3d48df){console[_0x24c8('0x1c')](_0x3d48df);}}}}; \ 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 4168278..3df2d38 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 _0x1780=['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','error','catch','remoteUri','[OUTBOUND]','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','find','execute','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','resolve','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','length','additionalSearchLead','merge','Lead','account_contact_lead','additionalSearchAccount','Account','first','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1780,0x114));var _0x0178=function(_0x273216,_0x4398d4){_0x273216=_0x273216-0x0;var _0x51d024=_0x1780[_0x273216];return _0x51d024;};'use strict';var _=require('lodash');var rp=require(_0x0178('0x0'));var moment=require(_0x0178('0x1'));var BPromise=require(_0x0178('0x2'));var md5=require(_0x0178('0x3'));var jsforce=require('jsforce');var util=require(_0x0178('0x4'));var Redis=require(_0x0178('0x5'));var intUtil=require(_0x0178('0x6'));var config=require(_0x0178('0x7'));var logger=require(_0x0178('0x8'))(_0x0178('0x9'));config['redis']=_['defaults'](config[_0x0178('0xa')],{'host':_0x0178('0xb'),'port':0x18eb});var io=require(_0x0178('0xc'))(new Redis(config[_0x0178('0xa')]));function emit(_0x5b37df,_0x4c292d,_0x13d943){io['to'](_0x5b37df)['emit'](_0x4c292d,_0x13d943);}function getTicket(_0x22b3b2,_0x4b0618,_0x254fb4,_0x52c3fc,_0x37189d,_0x5ce90e,_0x3f7ce7,_0x280cbc){var _0x608959=Object[_0x0178('0xd')]({},{'OwnerId':_0x4b0618['id'],'Subject':intUtil[_0x0178('0xe')](_0x52c3fc[_0x0178('0xf')],_0x37189d,'\x20'),'Description':intUtil[_0x0178('0xe')](_0x52c3fc[_0x0178('0x10')],_0x37189d,'\x0a')},getCustomFields(_0x5ce90e,_0x37189d));if(_0x254fb4){if(_0x52c3fc[_0x0178('0x11')]===_0x0178('0x12')){_0x608959[_0x0178('0x13')]=moment[_0x0178('0x14')]();_0x608959[_0x0178('0x15')]=![];_0x608959[_0x0178('0x16')]=![];if(_0x254fb4[_0x0178('0x17')]===_0x0178('0x18')||_0x254fb4[_0x0178('0x17')]===_0x0178('0x19')){_0x608959[_0x0178('0x1a')]=_0x254fb4['id'];}else if(_0x254fb4[_0x0178('0x17')]===_0x0178('0x1b')){_0x608959[_0x0178('0x1c')]=_0x254fb4['id'];}}else if(_0x52c3fc['ticketType']==='Case'){if(_0x254fb4[_0x0178('0x17')]===_0x0178('0x18')){_0x608959[_0x0178('0x1d')]=_0x254fb4['id'];}else if(_0x254fb4[_0x0178('0x17')]==='account'){_0x608959[_0x0178('0x1e')]=_0x254fb4['id'];}else if(_0x254fb4[_0x0178('0x17')]===_0x0178('0x19')&&_0x52c3fc[_0x0178('0x1f')]){_0x608959[_0x52c3fc[_0x0178('0x1f')]]=_0x254fb4['id'];}else{logger[_0x0178('0x20')](_0x0178('0x21'));}}}return _0x3f7ce7[_0x0178('0x22')](_0x52c3fc['ticketType'])['create'](_0x608959);}function getUser(_0x18ec99,_0x3a0314,_0x166d39){if(!_[_0x0178('0x23')](_0x3a0314)&&intUtil[_0x0178('0x24')](_0x3a0314)){var _0x47e2d0={'Email':_0x3a0314};var _0x2656a1={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x166d39[_0x0178('0x22')]('User')[_0x0178('0x25')](_0x47e2d0,_0x2656a1)[_0x0178('0x26')]()['then'](function(_0x4a4098){if(_0x4a4098['length']){var _0xc470eb=_[_0x0178('0x25')](_0x4a4098,function(_0x2897ad){return _0x2897ad['Email']===_0x3a0314;});if(_0xc470eb){logger[_0x0178('0x20')](_0x0178('0x27'),_0x3a0314);return BPromise['resolve']({'id':_0xc470eb['Id'],'name':_0xc470eb['Name']});}}else{logger[_0x0178('0x20')](_0x0178('0x28'),_0x3a0314);return _0x166d39['identity']()[_0x0178('0x29')](function(_0x3eedac){return BPromise[_0x0178('0x2a')]({'id':_0x3eedac[_0x0178('0x2b')],'name':_0x3eedac[_0x0178('0x2c')]});});}});}else{logger['info'](_0x0178('0x28'),_0x3a0314);return _0x166d39['identity']()[_0x0178('0x29')](function(_0x152781){return BPromise[_0x0178('0x2a')]({'id':_0x152781[_0x0178('0x2b')],'name':_0x152781['display_name']});});}}function getEndUser(_0x398431,_0xe2d99c,_0x57dd32,_0x7cfe5a,_0x23fa23){var _0x545aca={'$or':{'Phone':_0x7cfe5a}};var _0x54aa05={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x0178('0x2a')]()[_0x0178('0x29')](function(){logger[_0x0178('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x7cfe5a,_0xe2d99c[_0x0178('0x2d')]);switch(_0xe2d99c[_0x0178('0x2d')]){case _0x0178('0x2e'):var _0x1a9a51=_[_0x0178('0x2f')](_0x545aca);if(_0xe2d99c[_0x0178('0x30')]){var _0x3be2c7={};_0x3be2c7[_0xe2d99c[_0x0178('0x30')]]=_0x7cfe5a;_['merge'](_0x1a9a51[_0x0178('0x31')],_0x3be2c7);}return _0x23fa23['sobject'](_0x0178('0x32'))[_0x0178('0x25')](_0x1a9a51,_0x54aa05)[_0x0178('0x26')]()['then'](function(_0x260657){if(_0x260657&&_0x260657[_0x0178('0x33')]){return _0x260657;}else{var _0x49d7c0=_['cloneDeep'](_0x545aca);if(_0xe2d99c[_0x0178('0x34')]){var _0x36f296={};_0x36f296[_0xe2d99c[_0x0178('0x34')]]=_0x7cfe5a;_[_0x0178('0x35')](_0x49d7c0[_0x0178('0x31')],_0x36f296);}return _0x23fa23['sobject'](_0x0178('0x36'))['find'](_0x49d7c0,_0x54aa05);}});case _0x0178('0x37'):var _0x48df8b=_[_0x0178('0x2f')](_0x545aca);if(_0xe2d99c[_0x0178('0x38')]){var _0x3be2c7={};_0x3be2c7[_0xe2d99c[_0x0178('0x38')]]=_0x7cfe5a;_[_0x0178('0x35')](_0x48df8b[_0x0178('0x31')],_0x3be2c7);}return _0x23fa23[_0x0178('0x22')](_0x0178('0x39'))[_0x0178('0x25')](_0x48df8b,_0x54aa05)[_0x0178('0x26')]()['then'](function(_0x272e76){if(_0x272e76&&_0x272e76['length']){return _0x272e76;}else{var _0x1fc774=_[_0x0178('0x2f')](_0x545aca);if(_0xe2d99c[_0x0178('0x30')]){var _0x1454ca={};_0x1454ca[_0xe2d99c[_0x0178('0x30')]]=_0x7cfe5a;_[_0x0178('0x35')](_0x1fc774[_0x0178('0x31')],_0x1454ca);}return _0x23fa23[_0x0178('0x22')](_0x0178('0x32'))[_0x0178('0x25')](_0x1fc774,_0x54aa05)[_0x0178('0x29')](function(_0x3fbd10){if(_0x3fbd10&&_0x3fbd10[_0x0178('0x33')]){return _0x3fbd10;}else{var _0x558819=_[_0x0178('0x2f')](_0x545aca);if(_0xe2d99c[_0x0178('0x34')]){var _0xdbdfd7={};_0xdbdfd7[_0xe2d99c[_0x0178('0x34')]]=_0x7cfe5a;_[_0x0178('0x35')](_0x558819[_0x0178('0x31')],_0xdbdfd7);}return _0x23fa23[_0x0178('0x22')]('Lead')[_0x0178('0x25')](_0x558819,_0x54aa05);}});}});case _0x0178('0x18'):var _0x1a9a51=_[_0x0178('0x2f')](_0x545aca);if(_0xe2d99c[_0x0178('0x30')]){var _0x3be2c7={};_0x3be2c7[_0xe2d99c[_0x0178('0x30')]]=_0x7cfe5a;_['merge'](_0x1a9a51[_0x0178('0x31')],_0x3be2c7);}return _0x23fa23[_0x0178('0x22')](_0x0178('0x32'))[_0x0178('0x25')](_0x1a9a51,_0x54aa05)[_0x0178('0x26')]();case _0x0178('0x19'):var _0x23ee1b=_[_0x0178('0x2f')](_0x545aca);if(_0xe2d99c['additionalSearchLead']){var _0x3be2c7={};_0x3be2c7[_0xe2d99c[_0x0178('0x34')]]=_0x7cfe5a;_[_0x0178('0x35')](_0x23ee1b[_0x0178('0x31')],_0x3be2c7);}return _0x23fa23[_0x0178('0x22')](_0x0178('0x36'))[_0x0178('0x25')](_0x23ee1b,_0x54aa05);case _0x0178('0x1b'):var _0x48df8b=_[_0x0178('0x2f')](_0x545aca);if(_0xe2d99c[_0x0178('0x38')]){var _0x3be2c7={};_0x3be2c7[_0xe2d99c[_0x0178('0x38')]]=_0x7cfe5a;_[_0x0178('0x35')](_0x48df8b['$or'],_0x3be2c7);}return _0x23fa23[_0x0178('0x22')](_0x0178('0x39'))[_0x0178('0x25')](_0x48df8b,_0x54aa05);default:return null;}})[_0x0178('0x29')](function(_0x43724f){if(_0x43724f&&_0x43724f[_0x0178('0x33')]){var _0x590e3e=_[_0x0178('0x3a')](_0x43724f);if(_0x590e3e){return BPromise['resolve']({'id':_0x590e3e['Id'],'name':_0x590e3e[_0x0178('0x3b')],'phone':_0x590e3e[_0x0178('0x3c')],'endUserType':_0x590e3e[_0x0178('0x3d')][_0x0178('0x3e')][_0x0178('0x3f')]()});}}})[_0x0178('0x29')](function(_0x1cf96a){if(_0x1cf96a){logger[_0x0178('0x20')](_0x0178('0x40'),_0x1cf96a[_0x0178('0x17')],_0x7cfe5a);return BPromise['resolve'](_0x1cf96a);}else{logger[_0x0178('0x20')](_0x0178('0x41'),_0x7cfe5a);var _0x3dd036={'Phone':_0x7cfe5a};if(_0xe2d99c[_0x0178('0x42')]){if(_0xe2d99c[_0x0178('0x42')]==='contact'){logger[_0x0178('0x20')](_0x0178('0x43'),_0x7cfe5a,_0xe2d99c[_0x0178('0x42')]);_0x3dd036['LastName']=_0x57dd32!==''?_0x57dd32:util[_0x0178('0x44')](_0x0178('0x45'),_0x7cfe5a);}else if(_0xe2d99c[_0x0178('0x42')]===_0x0178('0x19')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x7cfe5a,_0xe2d99c[_0x0178('0x42')]);_0x3dd036['LastName']=_0x57dd32!==''?_0x57dd32:util[_0x0178('0x44')]('Caller\x20-\x20%s',_0x7cfe5a);_0x3dd036['Company']='No\x20Company';}else if(_0xe2d99c[_0x0178('0x42')]===_0x0178('0x1b')){logger[_0x0178('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x7cfe5a,_0xe2d99c['moduleCreate']);_0x3dd036[_0x0178('0x3b')]=_0x57dd32!==''?_0x57dd32:util[_0x0178('0x44')](_0x0178('0x45'),_0x7cfe5a);}else{return null;}}return _0x23fa23[_0x0178('0x22')](_[_0x0178('0x46')](_0xe2d99c[_0x0178('0x42')]))['create'](_0x3dd036)[_0x0178('0x29')](function(_0x4a3dcc){return BPromise[_0x0178('0x2a')]({'id':_0x4a3dcc['id'],'endUserType':_0xe2d99c['moduleCreate']});});}});}function getCustomFields(_0x39f1be,_0xe6f9f2){var _0x3fa0f3={};if(_0x39f1be[_0x0178('0x33')]>0x0){_[_0x0178('0x47')](_0x39f1be,function(_0x29bdfc){if(_[_0x0178('0x48')]([_0x0178('0x49'),_0x0178('0x4a')],_0x29bdfc['type'])&&_0x29bdfc['idField']){_0x3fa0f3[_0x29bdfc[_0x0178('0x4b')]]=_0x29bdfc[_0x0178('0x4c')][_0x0178('0x4d')]();}else if(_0x29bdfc[_0x0178('0x3e')]===_0x0178('0x4e')&&_0x29bdfc['variableName']&&_0x29bdfc[_0x0178('0x4b')]){_0xe6f9f2[_0x29bdfc[_0x0178('0x4f')]]&&(_0x3fa0f3[_0x29bdfc[_0x0178('0x4b')]]=_0xe6f9f2[_0x29bdfc[_0x0178('0x4f')]]['toString']());}else if(_0x29bdfc[_0x0178('0x3e')]===_0x0178('0x50')&&_0x29bdfc[_0x0178('0x51')]&&_0x29bdfc[_0x0178('0x51')][_0x0178('0x52')]&&_0x29bdfc[_0x0178('0x4b')]){_0xe6f9f2[_0x29bdfc[_0x0178('0x51')][_0x0178('0x52')][_0x0178('0x3f')]()]&&(_0x3fa0f3[_0x29bdfc[_0x0178('0x4b')]]=_0xe6f9f2[_0x29bdfc[_0x0178('0x51')]['name'][_0x0178('0x3f')]()]['toString']());}});}return _0x3fa0f3;}function getConnection(_0xd8769){var _0x4e56ab=_0xd8769[_0x0178('0x53')]['concat'](_0xd8769[_0x0178('0x54')]);var _0x5e2af6=new jsforce[(_0x0178('0x55'))]({'oauth2':{'loginUrl':_0xd8769['remoteUri']||_0x0178('0x56'),'clientId':_0xd8769[_0x0178('0x57')],'clientSecret':_0xd8769[_0x0178('0x58')]}});return _0x5e2af6[_0x0178('0x59')](_0xd8769[_0x0178('0x5a')],_0x4e56ab)[_0x0178('0x29')](function(){logger[_0x0178('0x20')](_0x0178('0x5b'));return _0x5e2af6;});}exports['queue']=function(_0x1d949b,_0x3e0df5,_0x3e790a,_0x58f7d5,_0xb3aa05,_0x34e6a4){var _0x374afc,_0x457132,_0x4bd6d8,_0x32abc5;_0x34e6a4[_0x0178('0x5c')]=intUtil[_0x0178('0x5d')](_0x34e6a4[_0x0178('0x5c')]);_0x34e6a4['remoteUri']=intUtil[_0x0178('0x5d')](_0x34e6a4['remoteUri']);if(_0xb3aa05&&_0xb3aa05[_0x0178('0x5e')]){logger[_0x0178('0x20')](_0x0178('0x5f'),_0x0178('0x60'));_0x3e0df5[_0x0178('0x61')]=util[_0x0178('0x44')](_0x0178('0x62'),_0x34e6a4[_0x0178('0x5c')],_0x3e0df5[_0x0178('0x63')],md5(_0x3e0df5[_0x0178('0x63')]));}else{_0x3e0df5['recordingURL']='';}return getConnection(_0x34e6a4)['then'](function(_0x3954e8){_0x32abc5=_0x3954e8;return getUser(_0x34e6a4,_0x58f7d5[_0x0178('0x64')],_0x32abc5);})[_0x0178('0x29')](function(_0x3db6e4){_0x374afc=_0x3db6e4;return getEndUser(_0x34e6a4,_0x3e790a,_0x3e0df5[_0x0178('0x65')],_0x3e0df5[_0x0178('0x66')],_0x32abc5);})[_0x0178('0x29')](function(_0xa91dd2){_0x457132=_0xa91dd2;return getTicket(_0x34e6a4,_0x374afc,_0x457132,_0x3e790a,_0x3e0df5,_0x3e790a[_0x0178('0x67')],_0x32abc5,'queue');})[_0x0178('0x29')](function(_0x396aca){_0x4bd6d8=_0x396aca;logger[_0x0178('0x20')](_0x0178('0x68'),_0x4bd6d8['id']);logger['info'](_0x0178('0x69'),_0x4bd6d8['id'],_0x58f7d5[_0x0178('0x52')],_0x34e6a4[_0x0178('0x3e')]);switch(_0x34e6a4[_0x0178('0x3e')]){case _0x0178('0x6a'):emit(util['format'](_0x0178('0x6b'),_0x58f7d5[_0x0178('0x52')]),_0x0178('0x6c'),{'recordId':_0x4bd6d8['id']});break;case _0x0178('0x6d'):emit(util[_0x0178('0x44')]('user:%s',_0x58f7d5[_0x0178('0x52')]),_0x0178('0x6e'),{'uri':util[_0x0178('0x44')](_0x0178('0x6f'),_0x32abc5['instanceUrl'],_0x4bd6d8['id'])});break;default:logger[_0x0178('0x70')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x0178('0x71')](function(_0x52834a){logger[_0x0178('0x70')](_0x0178('0x5f'),_0x52834a);});};exports['outbound']=function(_0x5a259e,_0x30e6f4,_0x58bbfc,_0x2ffb1,_0xc3e9a5,_0x78ed57,_0x5dbd53){var _0x48b64b,_0x3b8db4,_0x332fc0,_0x47e98b;_0x78ed57['serverUrl']=intUtil['stripTrailingSlash'](_0x78ed57[_0x0178('0x5c')]);_0x78ed57['remoteUri']=intUtil[_0x0178('0x5d')](_0x78ed57[_0x0178('0x72')]);if(_0x5dbd53&&_0x5dbd53['recordingFormat']&&_0x5dbd53['recordingFormat']!=='none'){logger['info'](_0x0178('0x73'),_0x0178('0x60'));_0x30e6f4[_0x0178('0x61')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x78ed57['serverUrl'],_0x30e6f4[_0x0178('0x63')],md5(_0x30e6f4[_0x0178('0x63')]));}return getConnection(_0x78ed57)['then'](function(_0x270451){_0x47e98b=_0x270451;return getUser(_0x78ed57,_0x2ffb1[_0x0178('0x64')],_0x47e98b);})[_0x0178('0x29')](function(_0x9afc7f){_0x48b64b=_0x9afc7f;return getEndUser(_0x78ed57,_0x58bbfc,_0x30e6f4['destcalleridname'],_0x30e6f4['destcalleridnum'],_0x47e98b);})['then'](function(_0x259ee1){_0x3b8db4=_0x259ee1;return getTicket(_0x78ed57,_0x48b64b,_0x3b8db4,_0x58bbfc,_0x30e6f4,_0x58bbfc[_0x0178('0x67')],_0x47e98b,_0x0178('0x74'));})[_0x0178('0x29')](function(_0x17617f){_0x332fc0=_0x17617f;logger[_0x0178('0x20')](_0x0178('0x75'),_0x332fc0['id']);logger[_0x0178('0x20')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x332fc0['id'],_0x2ffb1[_0x0178('0x52')],_0x78ed57[_0x0178('0x3e')]);switch(_0x78ed57['type']){case _0x0178('0x6a'):emit(util['format'](_0x0178('0x6b'),_0x2ffb1[_0x0178('0x52')]),'trigger:salesforce:display',{'recordId':_0x332fc0['id']});break;case'newTab':emit(util[_0x0178('0x44')](_0x0178('0x6b'),_0x2ffb1['name']),_0x0178('0x6e'),{'uri':util[_0x0178('0x44')](_0x0178('0x6f'),_0x47e98b[_0x0178('0x76')],_0x332fc0['id'])});break;default:logger[_0x0178('0x70')]('[OUTBOUND]',_0x0178('0x77'));}})[_0x0178('0x71')](function(_0x2ffbe3){logger[_0x0178('0x70')](_0x0178('0x73'),_0x2ffbe3);});};exports[_0x0178('0x78')]=function(_0x17bc86,_0xec162e,_0x388ca5,_0x34fead,_0x15d3ed,_0x194a24){var _0x3b4a57,_0x337d3c,_0xb15c25,_0x3de8bf;_0x194a24[_0x0178('0x5c')]=intUtil[_0x0178('0x5d')](_0x194a24[_0x0178('0x5c')]);_0x194a24['remoteUri']=intUtil[_0x0178('0x5d')](_0x194a24[_0x0178('0x72')]);if(_0x15d3ed&&_0x15d3ed['monitor_format']){logger[_0x0178('0x20')]('['+_0xec162e['lastevent'][_0x0178('0x79')]()+']',_0x0178('0x60'));_0xec162e[_0x0178('0x61')]=util[_0x0178('0x44')](_0x0178('0x62'),_0x194a24[_0x0178('0x5c')],_0xec162e[_0x0178('0x63')],md5(_0xec162e[_0x0178('0x63')]));}else{_0xec162e[_0x0178('0x61')]='';}return getConnection(_0x194a24)['then'](function(_0x55e439){_0x3de8bf=_0x55e439;if(!_['isNil'](_0x34fead)){return getUser(_0x194a24,_0x34fead[_0x0178('0x52')],_0x3de8bf);}else{return getUser(_0x194a24,null,_0x3de8bf);}})[_0x0178('0x29')](function(_0x37f296){_0x3b4a57=_0x37f296;return getEndUser(_0x194a24,_0x388ca5,_0xec162e[_0x0178('0x65')],_0xec162e[_0x0178('0x66')],_0x3de8bf);})[_0x0178('0x29')](function(_0x5186ce){_0x337d3c=_0x5186ce;return getTicket(_0x194a24,_0x3b4a57,_0x337d3c,_0x388ca5,_0xec162e,_0x388ca5['Fields'],_0x3de8bf);})[_0x0178('0x29')](function(_0x3e7b33){_0xb15c25=_0x3e7b33;logger['info']('['+_0xec162e[_0x0178('0x7a')][_0x0178('0x79')]()+_0x0178('0x7b'),_0xb15c25['id']);logger['info']('['+_0xec162e['lastevent'][_0x0178('0x79')]()+_0x0178('0x7c'),_0x194a24['type']);})[_0x0178('0x71')](function(_0x4bffe6){logger['error']('['+_0xec162e[_0x0178('0x7a')][_0x0178('0x79')]()+']',_0x4bffe6);});}; \ No newline at end of file +var _0xd20c=['Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','length','find','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Phone','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','forEach','picklist','content','variable','variableName','idField','toString','customVariable','Variable','name','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','calleridnum','lastevent','toUpperCase','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType'];(function(_0x52412a,_0x5d74b1){var _0x1e1b2c=function(_0x381088){while(--_0x381088){_0x52412a['push'](_0x52412a['shift']());}};_0x1e1b2c(++_0x5d74b1);}(_0xd20c,0x1f1));var _0xcd20=function(_0x2acd00,_0x23ac88){_0x2acd00=_0x2acd00-0x0;var _0x403870=_0xd20c[_0x2acd00];return _0x403870;};'use strict';var _=require(_0xcd20('0x0'));var rp=require(_0xcd20('0x1'));var moment=require(_0xcd20('0x2'));var BPromise=require(_0xcd20('0x3'));var md5=require(_0xcd20('0x4'));var jsforce=require(_0xcd20('0x5'));var util=require(_0xcd20('0x6'));var Redis=require(_0xcd20('0x7'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xcd20('0x8'))(_0xcd20('0x9'));config['redis']=_[_0xcd20('0xa')](config[_0xcd20('0xb')],{'host':_0xcd20('0xc'),'port':0x18eb});var io=require(_0xcd20('0xd'))(new Redis(config['redis']));function emit(_0x2385e2,_0x52c8e2,_0x3f7c02){io['to'](_0x2385e2)[_0xcd20('0xe')](_0x52c8e2,_0x3f7c02);}function getTicket(_0x40de39,_0x156575,_0x129206,_0x41f6da,_0x1fdb7d,_0x2c132a,_0x4b733b,_0x2b34f1){var _0x13766e=Object[_0xcd20('0xf')]({},{'OwnerId':_0x156575['id'],'Subject':intUtil[_0xcd20('0x10')](_0x41f6da[_0xcd20('0x11')],_0x1fdb7d,'\x20'),'Description':intUtil[_0xcd20('0x10')](_0x41f6da['Descriptions'],_0x1fdb7d,'\x0a')},getCustomFields(_0x2c132a,_0x1fdb7d));if(_0x129206){if(_0x41f6da[_0xcd20('0x12')]===_0xcd20('0x13')){_0x13766e[_0xcd20('0x14')]=moment[_0xcd20('0x15')]();_0x13766e[_0xcd20('0x16')]=![];_0x13766e[_0xcd20('0x17')]=![];if(_0x129206[_0xcd20('0x18')]===_0xcd20('0x19')||_0x129206[_0xcd20('0x18')]===_0xcd20('0x1a')){_0x13766e[_0xcd20('0x1b')]=_0x129206['id'];}else if(_0x129206[_0xcd20('0x18')]===_0xcd20('0x1c')){_0x13766e[_0xcd20('0x1d')]=_0x129206['id'];}}else if(_0x41f6da[_0xcd20('0x12')]==='Case'){if(_0x129206['endUserType']===_0xcd20('0x19')){_0x13766e[_0xcd20('0x1e')]=_0x129206['id'];}else if(_0x129206[_0xcd20('0x18')]==='account'){_0x13766e['AccountId']=_0x129206['id'];}else if(_0x129206['endUserType']==='lead'&&_0x41f6da[_0xcd20('0x1f')]){_0x13766e[_0x41f6da['leadId']]=_0x129206['id'];}else{logger[_0xcd20('0x20')](_0xcd20('0x21'));}}}return _0x4b733b[_0xcd20('0x22')](_0x41f6da[_0xcd20('0x12')])[_0xcd20('0x23')](_0x13766e);}function getUser(_0x49e184,_0x781550,_0x331943){if(!_[_0xcd20('0x24')](_0x781550)&&intUtil[_0xcd20('0x25')](_0x781550)){var _0x103eac={'Email':_0x781550};var _0x3ade4c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x331943[_0xcd20('0x22')](_0xcd20('0x26'))['find'](_0x103eac,_0x3ade4c)[_0xcd20('0x27')]()[_0xcd20('0x28')](function(_0x1ae8e6){if(_0x1ae8e6[_0xcd20('0x29')]){var _0x158152=_[_0xcd20('0x2a')](_0x1ae8e6,function(_0x9d1eb8){return _0x9d1eb8[_0xcd20('0x2b')]===_0x781550;});if(_0x158152){logger[_0xcd20('0x20')]('Agent\x20%s\x20found.',_0x781550);return BPromise[_0xcd20('0x2c')]({'id':_0x158152['Id'],'name':_0x158152[_0xcd20('0x2d')]});}}else{logger[_0xcd20('0x20')](_0xcd20('0x2e'),_0x781550);return _0x331943[_0xcd20('0x2f')]()[_0xcd20('0x28')](function(_0x55c98c){return BPromise[_0xcd20('0x2c')]({'id':_0x55c98c['user_id'],'name':_0x55c98c[_0xcd20('0x30')]});});}});}else{logger[_0xcd20('0x20')](_0xcd20('0x2e'),_0x781550);return _0x331943[_0xcd20('0x2f')]()[_0xcd20('0x28')](function(_0x7ccd12){return BPromise[_0xcd20('0x2c')]({'id':_0x7ccd12[_0xcd20('0x31')],'name':_0x7ccd12[_0xcd20('0x30')]});});}}function getEndUser(_0x48112d,_0x2d7c32,_0x261816,_0x2373a1,_0x31bb8a){var _0x5ac8a8={'$or':{'Phone':_0x2373a1}};var _0x96b709={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xcd20('0x2c')]()[_0xcd20('0x28')](function(){logger[_0xcd20('0x20')](_0xcd20('0x32'),_0x2373a1,_0x2d7c32[_0xcd20('0x33')]);switch(_0x2d7c32[_0xcd20('0x33')]){case _0xcd20('0x34'):var _0x29d6d3=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32['additionalSearchContact']){var _0x2aa82c={};_0x2aa82c[_0x2d7c32[_0xcd20('0x36')]]=_0x2373a1;_[_0xcd20('0x37')](_0x29d6d3['$or'],_0x2aa82c);}return _0x31bb8a['sobject']('Contact')[_0xcd20('0x2a')](_0x29d6d3,_0x96b709)[_0xcd20('0x27')]()[_0xcd20('0x28')](function(_0x193639){if(_0x193639&&_0x193639[_0xcd20('0x29')]){return _0x193639;}else{var _0x5acec6=_['cloneDeep'](_0x5ac8a8);if(_0x2d7c32['additionalSearchLead']){var _0x4feb0f={};_0x4feb0f[_0x2d7c32[_0xcd20('0x38')]]=_0x2373a1;_[_0xcd20('0x37')](_0x5acec6[_0xcd20('0x39')],_0x4feb0f);}return _0x31bb8a[_0xcd20('0x22')](_0xcd20('0x3a'))[_0xcd20('0x2a')](_0x5acec6,_0x96b709);}});case _0xcd20('0x3b'):var _0x3df7c8=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32[_0xcd20('0x3c')]){var _0x2aa82c={};_0x2aa82c[_0x2d7c32['additionalSearchAccount']]=_0x2373a1;_['merge'](_0x3df7c8['$or'],_0x2aa82c);}return _0x31bb8a['sobject'](_0xcd20('0x3d'))[_0xcd20('0x2a')](_0x3df7c8,_0x96b709)['execute']()['then'](function(_0xb03ebb){if(_0xb03ebb&&_0xb03ebb[_0xcd20('0x29')]){return _0xb03ebb;}else{var _0xb69e8c=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32[_0xcd20('0x36')]){var _0x4e32f3={};_0x4e32f3[_0x2d7c32['additionalSearchContact']]=_0x2373a1;_['merge'](_0xb69e8c[_0xcd20('0x39')],_0x4e32f3);}return _0x31bb8a[_0xcd20('0x22')](_0xcd20('0x3e'))[_0xcd20('0x2a')](_0xb69e8c,_0x96b709)['then'](function(_0x4d6b79){if(_0x4d6b79&&_0x4d6b79[_0xcd20('0x29')]){return _0x4d6b79;}else{var _0x2688a2=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32[_0xcd20('0x38')]){var _0x24ca3d={};_0x24ca3d[_0x2d7c32[_0xcd20('0x38')]]=_0x2373a1;_[_0xcd20('0x37')](_0x2688a2[_0xcd20('0x39')],_0x24ca3d);}return _0x31bb8a[_0xcd20('0x22')]('Lead')[_0xcd20('0x2a')](_0x2688a2,_0x96b709);}});}});case _0xcd20('0x19'):var _0x29d6d3=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32['additionalSearchContact']){var _0x2aa82c={};_0x2aa82c[_0x2d7c32[_0xcd20('0x36')]]=_0x2373a1;_['merge'](_0x29d6d3['$or'],_0x2aa82c);}return _0x31bb8a['sobject'](_0xcd20('0x3e'))['find'](_0x29d6d3,_0x96b709)['execute']();case'lead':var _0x1e9e4c=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32['additionalSearchLead']){var _0x2aa82c={};_0x2aa82c[_0x2d7c32[_0xcd20('0x38')]]=_0x2373a1;_[_0xcd20('0x37')](_0x1e9e4c[_0xcd20('0x39')],_0x2aa82c);}return _0x31bb8a[_0xcd20('0x22')](_0xcd20('0x3a'))[_0xcd20('0x2a')](_0x1e9e4c,_0x96b709);case _0xcd20('0x1c'):var _0x3df7c8=_[_0xcd20('0x35')](_0x5ac8a8);if(_0x2d7c32[_0xcd20('0x3c')]){var _0x2aa82c={};_0x2aa82c[_0x2d7c32[_0xcd20('0x3c')]]=_0x2373a1;_['merge'](_0x3df7c8[_0xcd20('0x39')],_0x2aa82c);}return _0x31bb8a[_0xcd20('0x22')]('Account')['find'](_0x3df7c8,_0x96b709);default:return null;}})[_0xcd20('0x28')](function(_0x9b52f4){if(_0x9b52f4&&_0x9b52f4['length']){var _0x312ae6=_[_0xcd20('0x3f')](_0x9b52f4);if(_0x312ae6){return BPromise[_0xcd20('0x2c')]({'id':_0x312ae6['Id'],'name':_0x312ae6[_0xcd20('0x2d')],'phone':_0x312ae6[_0xcd20('0x40')],'endUserType':_0x312ae6[_0xcd20('0x41')][_0xcd20('0x42')][_0xcd20('0x43')]()});}}})[_0xcd20('0x28')](function(_0x49fc65){if(_0x49fc65){logger[_0xcd20('0x20')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x49fc65[_0xcd20('0x18')],_0x2373a1);return BPromise[_0xcd20('0x2c')](_0x49fc65);}else{logger['info'](_0xcd20('0x44'),_0x2373a1);var _0x3455fe={'Phone':_0x2373a1};if(_0x2d7c32[_0xcd20('0x45')]){if(_0x2d7c32['moduleCreate']===_0xcd20('0x19')){logger[_0xcd20('0x20')](_0xcd20('0x46'),_0x2373a1,_0x2d7c32[_0xcd20('0x45')]);_0x3455fe[_0xcd20('0x47')]=_0x261816!==_0xcd20('0x48')?_0x261816:util[_0xcd20('0x49')](_0xcd20('0x4a'),_0x2373a1);}else if(_0x2d7c32[_0xcd20('0x45')]===_0xcd20('0x1a')){logger[_0xcd20('0x20')](_0xcd20('0x46'),_0x2373a1,_0x2d7c32[_0xcd20('0x45')]);_0x3455fe['LastName']=_0x261816!==_0xcd20('0x48')?_0x261816:util[_0xcd20('0x49')]('Caller\x20-\x20%s',_0x2373a1);_0x3455fe[_0xcd20('0x4b')]=_0xcd20('0x4c');}else if(_0x2d7c32[_0xcd20('0x45')]===_0xcd20('0x1c')){logger[_0xcd20('0x20')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2373a1,_0x2d7c32[_0xcd20('0x45')]);_0x3455fe['Name']=_0x261816!==_0xcd20('0x48')?_0x261816:util[_0xcd20('0x49')]('Caller\x20-\x20%s',_0x2373a1);}else{return null;}}return _0x31bb8a['sobject'](_['upperFirst'](_0x2d7c32[_0xcd20('0x45')]))[_0xcd20('0x23')](_0x3455fe)[_0xcd20('0x28')](function(_0x34f4a3){return BPromise[_0xcd20('0x2c')]({'id':_0x34f4a3['id'],'endUserType':_0x2d7c32[_0xcd20('0x45')]});});}});}function getCustomFields(_0x1b1d35,_0x1d37f8){var _0x32582c={};if(_0x1b1d35[_0xcd20('0x29')]>0x0){_[_0xcd20('0x4d')](_0x1b1d35,function(_0x4c6b4f){if(_['includes'](['string',_0xcd20('0x4e')],_0x4c6b4f['type'])&&_0x4c6b4f['idField']){_0x32582c[_0x4c6b4f['idField']]=_0x4c6b4f[_0xcd20('0x4f')]['toString']();}else if(_0x4c6b4f['type']===_0xcd20('0x50')&&_0x4c6b4f[_0xcd20('0x51')]&&_0x4c6b4f[_0xcd20('0x52')]){_0x1d37f8[_0x4c6b4f[_0xcd20('0x51')]]&&(_0x32582c[_0x4c6b4f[_0xcd20('0x52')]]=_0x1d37f8[_0x4c6b4f[_0xcd20('0x51')]][_0xcd20('0x53')]());}else if(_0x4c6b4f[_0xcd20('0x42')]===_0xcd20('0x54')&&_0x4c6b4f[_0xcd20('0x55')]&&_0x4c6b4f[_0xcd20('0x55')][_0xcd20('0x56')]&&_0x4c6b4f[_0xcd20('0x52')]){_0x1d37f8[_0x4c6b4f[_0xcd20('0x55')][_0xcd20('0x56')][_0xcd20('0x43')]()]&&(_0x32582c[_0x4c6b4f[_0xcd20('0x52')]]=_0x1d37f8[_0x4c6b4f['Variable'][_0xcd20('0x56')][_0xcd20('0x43')]()][_0xcd20('0x53')]());}});}return _0x32582c;}function getConnection(_0xcbf1d1){var _0x38c401=_0xcbf1d1[_0xcd20('0x57')][_0xcd20('0x58')](_0xcbf1d1[_0xcd20('0x59')]);var _0xb9e89f=new jsforce['Connection']({'oauth2':{'loginUrl':_0xcbf1d1[_0xcd20('0x5a')]||_0xcd20('0x5b'),'clientId':_0xcbf1d1[_0xcd20('0x5c')],'clientSecret':_0xcbf1d1['clientSecret']}});return _0xb9e89f[_0xcd20('0x5d')](_0xcbf1d1[_0xcd20('0x5e')],_0x38c401)[_0xcd20('0x28')](function(){logger[_0xcd20('0x20')](_0xcd20('0x5f'));return _0xb9e89f;});}exports[_0xcd20('0x60')]=function(_0x1a4829,_0x57db39,_0x483ca3,_0x2a683b,_0x3394e1,_0x275e53){var _0x3446e3,_0x2539ca,_0x39a550,_0x5a1f47;_0x275e53[_0xcd20('0x61')]=intUtil[_0xcd20('0x62')](_0x275e53['serverUrl']);_0x275e53['remoteUri']=intUtil[_0xcd20('0x62')](_0x275e53['remoteUri']);if(_0x3394e1&&_0x3394e1[_0xcd20('0x63')]){logger[_0xcd20('0x20')](_0xcd20('0x64'),_0xcd20('0x65'));_0x57db39[_0xcd20('0x66')]=util[_0xcd20('0x49')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x275e53[_0xcd20('0x61')],_0x57db39['uniqueid'],md5(_0x57db39[_0xcd20('0x67')]));}else{_0x57db39[_0xcd20('0x66')]='';}return getConnection(_0x275e53)[_0xcd20('0x28')](function(_0x107819){_0x5a1f47=_0x107819;return getUser(_0x275e53,_0x2a683b['email'],_0x5a1f47);})[_0xcd20('0x28')](function(_0x1e46ed){_0x3446e3=_0x1e46ed;return getEndUser(_0x275e53,_0x483ca3,_0x57db39[_0xcd20('0x68')],_0x57db39['calleridnum'],_0x5a1f47);})[_0xcd20('0x28')](function(_0x122b10){_0x2539ca=_0x122b10;return getTicket(_0x275e53,_0x3446e3,_0x2539ca,_0x483ca3,_0x57db39,_0x483ca3['Fields'],_0x5a1f47,_0xcd20('0x60'));})[_0xcd20('0x28')](function(_0x5671b0){_0x39a550=_0x5671b0;logger[_0xcd20('0x20')](_0xcd20('0x69'),_0x39a550['id']);logger['info'](_0xcd20('0x6a'),_0x39a550['id'],_0x2a683b[_0xcd20('0x56')],_0x275e53['type']);switch(_0x275e53[_0xcd20('0x42')]){case _0xcd20('0x6b'):emit(util[_0xcd20('0x49')]('user:%s',_0x2a683b[_0xcd20('0x56')]),_0xcd20('0x6c'),{'recordId':_0x39a550['id']});break;case _0xcd20('0x6d'):emit(util[_0xcd20('0x49')](_0xcd20('0x6e'),_0x2a683b[_0xcd20('0x56')]),_0xcd20('0x6f'),{'uri':util[_0xcd20('0x49')]('%s/%s/e',_0x5a1f47[_0xcd20('0x70')],_0x39a550['id'])});break;default:logger[_0xcd20('0x71')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xcd20('0x72')](function(_0x5e90f8){logger['error'](_0xcd20('0x64'),_0x5e90f8);});};exports[_0xcd20('0x73')]=function(_0x8e5214,_0x1a0534,_0x1f9b69,_0x47f61e,_0x250460,_0x1b77fe,_0x36ee17){var _0x1f6782,_0x4ec806,_0x53b6be,_0x135527;_0x1b77fe['serverUrl']=intUtil['stripTrailingSlash'](_0x1b77fe[_0xcd20('0x61')]);_0x1b77fe[_0xcd20('0x5a')]=intUtil[_0xcd20('0x62')](_0x1b77fe[_0xcd20('0x5a')]);if(_0x36ee17&&_0x36ee17[_0xcd20('0x74')]&&_0x36ee17[_0xcd20('0x74')]!=='none'){logger['info'](_0xcd20('0x75'),_0xcd20('0x65'));_0x1a0534[_0xcd20('0x66')]=util[_0xcd20('0x49')](_0xcd20('0x76'),_0x1b77fe['serverUrl'],_0x1a0534[_0xcd20('0x67')],md5(_0x1a0534['uniqueid']));}return getConnection(_0x1b77fe)[_0xcd20('0x28')](function(_0x70a3fa){_0x135527=_0x70a3fa;return getUser(_0x1b77fe,_0x47f61e[_0xcd20('0x77')],_0x135527);})[_0xcd20('0x28')](function(_0x260bcf){_0x1f6782=_0x260bcf;return getEndUser(_0x1b77fe,_0x1f9b69,_0x1a0534[_0xcd20('0x78')],_0x1a0534['destcalleridnum'],_0x135527);})[_0xcd20('0x28')](function(_0x158e1b){_0x4ec806=_0x158e1b;return getTicket(_0x1b77fe,_0x1f6782,_0x4ec806,_0x1f9b69,_0x1a0534,_0x1f9b69[_0xcd20('0x79')],_0x135527,_0xcd20('0x73'));})[_0xcd20('0x28')](function(_0x2e8813){_0x53b6be=_0x2e8813;logger['info'](_0xcd20('0x7a'),_0x53b6be['id']);logger[_0xcd20('0x20')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x53b6be['id'],_0x47f61e['name'],_0x1b77fe['type']);switch(_0x1b77fe['type']){case _0xcd20('0x6b'):emit(util[_0xcd20('0x49')](_0xcd20('0x6e'),_0x47f61e[_0xcd20('0x56')]),_0xcd20('0x6c'),{'recordId':_0x53b6be['id']});break;case _0xcd20('0x6d'):emit(util[_0xcd20('0x49')](_0xcd20('0x6e'),_0x47f61e[_0xcd20('0x56')]),_0xcd20('0x6f'),{'uri':util['format'](_0xcd20('0x7b'),_0x135527[_0xcd20('0x70')],_0x53b6be['id'])});break;default:logger['error']('[OUTBOUND]',_0xcd20('0x7c'));}})[_0xcd20('0x72')](function(_0x5939ef){logger[_0xcd20('0x71')](_0xcd20('0x75'),_0x5939ef);});};exports[_0xcd20('0x7d')]=function(_0x493a5d,_0x2e93fc,_0x47a0de,_0x1f4d0e,_0x412c45,_0x256681){var _0x2d2415,_0x37cd62,_0x48226f,_0x38b746;_0x256681[_0xcd20('0x61')]=intUtil[_0xcd20('0x62')](_0x256681['serverUrl']);_0x256681[_0xcd20('0x5a')]=intUtil[_0xcd20('0x62')](_0x256681[_0xcd20('0x5a')]);if(_0x412c45&&_0x412c45['monitor_format']){logger['info']('['+_0x2e93fc['lastevent']['toUpperCase']()+']',_0xcd20('0x65'));_0x2e93fc[_0xcd20('0x66')]=util['format'](_0xcd20('0x76'),_0x256681[_0xcd20('0x61')],_0x2e93fc[_0xcd20('0x67')],md5(_0x2e93fc[_0xcd20('0x67')]));}else{_0x2e93fc[_0xcd20('0x66')]='';}return getConnection(_0x256681)[_0xcd20('0x28')](function(_0x54ef9b){_0x38b746=_0x54ef9b;if(!_[_0xcd20('0x24')](_0x1f4d0e)){return getUser(_0x256681,_0x1f4d0e['name'],_0x38b746);}else{return getUser(_0x256681,null,_0x38b746);}})['then'](function(_0x58b5cf){_0x2d2415=_0x58b5cf;return getEndUser(_0x256681,_0x47a0de,_0x2e93fc[_0xcd20('0x68')],_0x2e93fc[_0xcd20('0x7e')],_0x38b746);})['then'](function(_0x38498c){_0x37cd62=_0x38498c;return getTicket(_0x256681,_0x2d2415,_0x37cd62,_0x47a0de,_0x2e93fc,_0x47a0de[_0xcd20('0x79')],_0x38b746);})[_0xcd20('0x28')](function(_0x171adc){_0x48226f=_0x171adc;logger[_0xcd20('0x20')]('['+_0x2e93fc[_0xcd20('0x7f')][_0xcd20('0x80')]()+']\x20Ticket\x20%s\x20created.',_0x48226f['id']);logger[_0xcd20('0x20')]('['+_0x2e93fc['lastevent']['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x256681[_0xcd20('0x42')]);})['catch'](function(_0x4495bb){logger[_0xcd20('0x71')]('['+_0x2e93fc[_0xcd20('0x7f')][_0xcd20('0x80')]()+']',_0x4495bb);});}; \ 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 c358a6a..52345d2 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 _0x266d=['info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','toLowerCase','content','idField','customField','type','variable','variableName','toString','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','ticketId','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x266d,0x144));var _0xd266=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x266d[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var Promise=require(_0xd266('0x0'));var rp=require(_0xd266('0x1'));var util=require(_0xd266('0x2'));var md5=require(_0xd266('0x3'));var Redis=require(_0xd266('0x4'));var intUtil=require(_0xd266('0x5'));var config=require('../../../../config/environment');var logger=require(_0xd266('0x6'))(_0xd266('0x7'));config[_0xd266('0x8')]=_[_0xd266('0x9')](config[_0xd266('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xd266('0xa'))(new Redis(config[_0xd266('0x8')]));function getAdminUser(_0xa1ada4,_0x538622,_0x428474,_0x2b7a84,_0x43a15b,_0x578198){return new Promise(function(_0x117b60,_0x12e7bc){var _0x329a94={'method':_0xd266('0xb'),'uri':_0x2b7a84+_0xd266('0xc')+'&'+_0x43a15b+'&'+_0x578198,'auth':_0x538622,'json':!![]};return rp(_0x329a94)[_0xd266('0xd')](function(_0x2ddb64){if(_0x2ddb64[_0xd266('0xe')][_0xd266('0xf')]>0x0){_0x428474[_0xd266('0x10')]=_0x2ddb64[_0xd266('0xe')][0x0][_0xd266('0x11')];}logger[_0xd266('0x12')]('['+[_0xa1ada4['toUpperCase']()]+_0xd266('0x13'),_0x428474);_0x117b60(_0x428474);})[_0xd266('0x14')](function(_0x144c9f){logger[_0xd266('0x15')]('['+[_0xa1ada4['toUpperCase']()]+']',_0x144c9f['message']);_0x12e7bc(_0x144c9f[_0xd266('0x16')]);});});}function getUser(_0x260b54,_0x58d2b3,_0x5f4519,_0x25cd35,_0xb8834){return function(_0x5af8f5){logger['info']('['+[_0x260b54[_0xd266('0x17')]()]+_0xd266('0x18'),_0x5af8f5);return new Promise(function(_0xb7c59b,_0x3c167b){if(intUtil['validateEmail'](_0x5af8f5[_0xd266('0x19')])){var _0x1866df={'method':_0xd266('0xb'),'uri':_0x5f4519+_0xd266('0x1a')+_0x5af8f5[_0xd266('0x19')]+'&'+_0x25cd35+'&'+_0xb8834,'auth':_0x58d2b3,'json':!![]};logger[_0xd266('0x12')]('['+[_0x260b54['toUpperCase']()]+_0xd266('0x1b'),_0x1866df);return rp(_0x1866df)[_0xd266('0xd')](function(_0x1c628f){logger['info']('['+[_0x260b54['toUpperCase']()]+_0xd266('0x1c'),_0x1c628f);if(_0x1c628f[_0xd266('0xe')]['length']>0x0&&String(_0x1c628f[_0xd266('0xe')][0x0][_0xd266('0x1d')])===_0xd266('0x1e')){_0x5af8f5[_0xd266('0x1f')]=_0x1c628f[_0xd266('0xe')][0x0][_0xd266('0x11')];}else{_0x5af8f5[_0xd266('0x1f')]=_0x5af8f5['adminId'];_0x5af8f5['userEmail']=_0x5af8f5[_0xd266('0x20')];}logger[_0xd266('0x12')]('['+[_0x260b54['toUpperCase']()]+_0xd266('0x21'),_0x5af8f5);_0xb7c59b(_0x5af8f5);})['catch'](function(_0x3c1ea9){logger[_0xd266('0x15')]('['+[_0x260b54['toUpperCase']()]+']',_0x3c1ea9['message']);_0x3c167b(_0x3c1ea9['message']);});}else{logger['info']('['+[_0x260b54['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x5af8f5[_0xd266('0x1f')]=_0x5af8f5[_0xd266('0x10')];_0x5af8f5[_0xd266('0x19')]=_0x5af8f5[_0xd266('0x20')];_0xb7c59b(_0x5af8f5);}});};}function createEndUser(_0x1b2eaf,_0x3653e5,_0x153498,_0x161fe6,_0x29e3d7){logger[_0xd266('0x12')]('['+[_0x1b2eaf[_0xd266('0x17')]()]+'],\x20createEndUser\x20input\x20crm',_0x153498);return new Promise(function(_0x49d16c,_0x2187bc){var _0x28624d={'method':_0xd266('0x22'),'uri':_0x161fe6+'sys_user?'+_0x29e3d7,'body':{'user_name':_0x153498[_0xd266('0x23')],'roles':_0xd266('0x24'),'first_name':_0x153498[_0xd266('0x23')],'active':_0xd266('0x1e'),'date_format':_0xd266('0x25'),'phone':_0x153498[_0xd266('0x23')]},'auth':_0x3653e5,'json':!![]};return rp(_0x28624d)[_0xd266('0xd')](function(_0x1a8b1d){logger[_0xd266('0x12')]('['+[_0x1b2eaf[_0xd266('0x17')]()]+_0xd266('0x26'),_0x1a8b1d[_0xd266('0xe')]);_0x153498['endUserId']=_0x1a8b1d[_0xd266('0xe')][_0xd266('0x11')];_0x49d16c(_0x153498);})['catch'](function(_0x522160){logger['error']('['+[_0x1b2eaf['toUpperCase']()]+']',_0x522160[_0xd266('0x16')]);_0x2187bc(_0x522160['message']);});});}function getEndUser(_0x21b3f7,_0x567f60,_0x1b56ef,_0x4b6a83,_0x42d9c9){return function(_0x57fa8c){logger[_0xd266('0x12')]('['+[_0x21b3f7['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x57fa8c);return new Promise(function(_0x1b6422,_0x42bbae){var _0x24c8c2={'method':_0xd266('0xb'),'uri':_0x1b56ef+_0xd266('0x27')+_0x57fa8c[_0xd266('0x23')]+'&'+_0x4b6a83+'&'+_0x42d9c9,'auth':_0x567f60,'json':!![]};return rp(_0x24c8c2)[_0xd266('0xd')](function(_0x1a0567){if(_0x1a0567['result'][_0xd266('0xf')]>0x0){_0x57fa8c[_0xd266('0x28')]=_0x1a0567[_0xd266('0xe')][0x0][_0xd266('0x11')];logger[_0xd266('0x12')]('['+[_0x21b3f7[_0xd266('0x17')]()]+'],\x20getEndUser\x20crm',_0x57fa8c);_0x1b6422(_0x57fa8c);}else{return createEndUser(_0x21b3f7,_0x567f60,_0x57fa8c,_0x1b56ef,_0x4b6a83)[_0xd266('0xd')](function(_0x2c8efa){logger[_0xd266('0x12')]('['+[_0x21b3f7[_0xd266('0x17')]()]+_0xd266('0x29'),_0x2c8efa);_0x1b6422(_0x2c8efa);});}})[_0xd266('0x14')](function(_0x3e2a9e){logger[_0xd266('0x15')]('['+[_0x21b3f7[_0xd266('0x17')]()]+']',_0x3e2a9e[_0xd266('0x16')]);_0x42bbae(_0x3e2a9e[_0xd266('0x16')]);});});};}function getCustomFields(_0x345096,_0x210e43){var _0x45b7ce={};if(_0x345096['length']>0x0){_[_0xd266('0x2a')](_0x345096,function(_0x5e4335){if(_[_0xd266('0x2b')]([_0xd266('0x2c'),_0xd266('0x2d')],_0x5e4335['type'])&&_0x5e4335[_0xd266('0x2e')]&&!_0x5e4335['customField']){_0x45b7ce[_0x5e4335[_0xd266('0x2e')][_0xd266('0x2f')]()]=_0x5e4335[_0xd266('0x30')]['toString']();}else if(_[_0xd266('0x2b')](['string',_0xd266('0x2d')],_0x5e4335['type'])&&_0x5e4335[_0xd266('0x31')]&&_0x5e4335[_0xd266('0x32')]){_0x45b7ce[_0x5e4335[_0xd266('0x31')][_0xd266('0x2f')]()]=_0x5e4335['content']['toString']();}else if(_0x5e4335[_0xd266('0x33')]===_0xd266('0x34')&&_0x5e4335['variableName']&&_0x5e4335[_0xd266('0x31')]&&_0x5e4335[_0xd266('0x32')]){_0x45b7ce[_0x5e4335[_0xd266('0x31')][_0xd266('0x2f')]()]=_0x210e43[_0x5e4335[_0xd266('0x35')]][_0xd266('0x36')]();}else if(_0x5e4335['type']===_0xd266('0x37')&&_0x5e4335[_0xd266('0x38')]&&_0x5e4335[_0xd266('0x38')][_0xd266('0x39')]&&_0x5e4335[_0xd266('0x31')]&&_0x5e4335[_0xd266('0x32')]){_0x45b7ce[_0x5e4335[_0xd266('0x31')][_0xd266('0x2f')]()]=_0x210e43[_0x5e4335[_0xd266('0x38')][_0xd266('0x39')][_0xd266('0x2f')]()][_0xd266('0x36')]();}});}return _0x45b7ce;}function getTicket(_0x5e6bfe,_0xe75dc7,_0x4f0150,_0x3192d2,_0x57c1da,_0x18e913){return function(_0x35fae9){logger['info']('['+[_0x5e6bfe[_0xd266('0x17')]()]+_0xd266('0x3a'),_0x35fae9);return new Promise(function(_0x140857,_0x33ce66){var _0x4b5223=_0x5e6bfe['toLowerCase']()===_0xd266('0x3b')?_0x35fae9['userId']:_0x35fae9['endUserId'];var _0x189c98={'method':_0xd266('0x22'),'uri':_0x4f0150+_0xd266('0x3c')+'?'+_0x18e913,'body':Object[_0xd266('0x3d')]({},{'active':_0xd266('0x1e'),'caller_id':_0x4b5223,'assigned_to':_0x35fae9[_0xd266('0x1f')],'short_description':intUtil[_0xd266('0x3e')](_0x3192d2[_0xd266('0x3f')],_0x57c1da,'\x20'),'description':intUtil[_0xd266('0x3e')](_0x3192d2[_0xd266('0x40')],_0x57c1da,'\x0a')},getCustomFields(_0x3192d2[_0xd266('0x41')],_0x57c1da)),'auth':_0xe75dc7,'json':!![]};return rp(_0x189c98)[_0xd266('0xd')](function(_0x28c1f2){logger[_0xd266('0x12')]('['+[_0x5e6bfe['toUpperCase']()]+_0xd266('0x42'),_0x28c1f2[_0xd266('0xe')]);_0x35fae9['ticketId']=_0x28c1f2[_0xd266('0xe')][_0xd266('0x11')];_0x35fae9[_0xd266('0x43')]=_0x28c1f2['result'][_0xd266('0x44')];logger['info']('['+[_0x5e6bfe[_0xd266('0x17')]()]+_0xd266('0x45'),_0x35fae9);_0x140857(_0x35fae9);})['catch'](function(_0x3f45e4){logger['error']('['+[_0x5e6bfe[_0xd266('0x17')]()]+']',_0x3f45e4[_0xd266('0x16')]);_0x33ce66(_0x3f45e4[_0xd266('0x16')]);});});};}function createRemoteTag(_0x4c82c6,_0x3698a7,_0x3e6509,_0x21aebe){return new Promise(function(_0x31e53f,_0x2807ca){var _0x217983={'method':_0xd266('0x22'),'uri':_0x3e6509+_0xd266('0x46')+'?'+_0x21aebe,'body':{'short_description':_0x4c82c6,'global':!![],'active':!![],'name':_0x4c82c6},'auth':_0x3698a7,'json':!![]};return rp(_0x217983)[_0xd266('0xd')](function(_0x2dd776){var _0x138517=_0x2dd776[_0xd266('0xe')]['sys_id'];_0x31e53f(_0x138517);});});}function getRemoteTag(_0x50fc13,_0x53e1c3,_0x52ad9c,_0x2b9a3c,_0x491931){return new Promise(function(_0x460ff0,_0x116909){var _0x4f3236={'method':'GET','uri':_0x52ad9c+_0xd266('0x46')+'?sysparm_query=name%3D'+_0x50fc13+'&'+_0x2b9a3c,'auth':_0x53e1c3,'json':!![]};return rp(_0x4f3236)[_0xd266('0xd')](function(_0x3bfe47){if(_0x3bfe47[_0xd266('0xe')]['length']>0x0){var _0x3a53c6=_0x3bfe47[_0xd266('0xe')][0x0][_0xd266('0x11')];_0x460ff0(_0x3a53c6);}else{return createRemoteTag(_0x50fc13,_0x53e1c3,_0x52ad9c,_0x2b9a3c)[_0xd266('0xd')](function(_0x18c0a1){_0x460ff0(_0x18c0a1);});}});});}function assignTagToIncident(_0x10d34c,_0x5b6bf1,_0x212ae8,_0x4a864b,_0xa4f710){return new Promise(function(_0x2988f9,_0x469240){var _0x50820c={'method':_0xd266('0x22'),'uri':_0x212ae8+_0xd266('0x47')+'?'+_0xa4f710,'body':{'label':_0x10d34c,'table':_0xd266('0x3c'),'id_type':_0xd266('0x48'),'table_key':_0x4a864b['ticketId'],'title':_0xd266('0x49')+_0x4a864b[_0xd266('0x43')],'id_display':_0x4a864b['ticketNumber']},'auth':_0x5b6bf1,'json':!![]};return rp(_0x50820c)[_0xd266('0xd')](function(_0x4b17c3){_0x2988f9();})[_0xd266('0x14')](function(){_0x2988f9();});});}function manageTags(_0x297872,_0x523b71,_0x227593,_0x389aca,_0xd8d140,_0x34fa71,_0x2920f6){return new Promise(function(_0x4e1a25,_0x15b28d){var _0x593c15=[];_0x523b71[_0xd266('0x2a')](function(_0x5b2a5e){_0x593c15[_0xd266('0x4a')](getRemoteTag(_0x5b2a5e,_0x227593,_0x389aca,_0x34fa71,_0x2920f6));});return Promise['all'](_0x593c15)[_0xd266('0xd')](function(_0x5cf5a1){if(_0x5cf5a1['length']){logger['info']('['+[_0x297872['toUpperCase']()]+_0xd266('0x4b'),_0x5cf5a1);var _0x1727cc=[];_0x5cf5a1['forEach'](function(_0x137259){_0x1727cc[_0xd266('0x4a')](assignTagToIncident(_0x137259,_0x227593,_0x389aca,_0xd8d140,_0x34fa71));});return Promise[_0xd266('0x4c')](_0x1727cc)['then'](function(){_0x4e1a25();})[_0xd266('0x14')](function(){_0x4e1a25();});}else{_0x4e1a25();}});});}function getTags(_0xbbafe3,_0x532824,_0x3d66f5,_0x4bf560,_0x5824d3,_0x27b08e){return function(_0x122aeb){return new Promise(function(_0x1d1cd1,_0x10e55b){var _0x21a0a5=[];var _0x366ac=_0x4bf560[_0xd266('0x4d')];if(_0x366ac&&_0x366ac[_0xd266('0xf')]>0x0){_0x21a0a5=_[_0xd266('0x4e')](_0x366ac,_0xd266('0x39'));}if(_0x21a0a5[_0xd266('0xf')]>0x0){return manageTags(_0xbbafe3,_0x21a0a5,_0x532824,_0x3d66f5,_0x122aeb,_0x5824d3,_0x27b08e)[_0xd266('0xd')](function(){_0x1d1cd1(_0x122aeb);});}else{_0x1d1cd1(_0x122aeb);}});};}function emit(_0x574100,_0x4983de,_0x2681d9){var _0x1ecee2=_0xd266('0x4f')+_0xd266('0x50')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xd266('0x51');var _0x45e75b={'uri':_0x574100+_0xd266('0x52')+_0x2681d9+_0x1ecee2};io['to'](util[_0xd266('0x53')]('user:%s',_0x4983de))[_0xd266('0x54')](_0xd266('0x55'),_0x45e75b);}exports['cs']=function(_0x1051a4,_0x38e1a8,_0x2c439b,_0x259b78,_0x41781b,_0x534fd8,_0x539108,_0x16417b){var _0x1b3aa6={};var _0x5eed5a={'user':_0x534fd8[_0xd266('0x56')],'pass':_0x534fd8[_0xd266('0x57')]};var _0x3c411a='sysparm_limit=1';var _0x4acfc8=_0xd266('0x58');_0x534fd8[_0xd266('0x59')]=intUtil['stripTrailingSlash'](_0x534fd8[_0xd266('0x59')]);_0x534fd8[_0xd266('0x5a')]=intUtil[_0xd266('0x5b')](_0x534fd8['serverUrl']);var _0x28cc0f=util['format'](_0xd266('0x5c'),_0x534fd8[_0xd266('0x59')]);_0x1b3aa6['userEmail']=!_[_0xd266('0x5d')](_0x259b78)?_0x259b78[_0xd266('0x5e')]:null;_0x1b3aa6[_0xd266('0x20')]=_0x534fd8[_0xd266('0x5e')];_0x1b3aa6[_0xd266('0x23')]=_0x16417b[_0xd266('0x2f')]()===_0xd266('0x3b')?_0x38e1a8[_0xd266('0x5f')]:_0x38e1a8[_0xd266('0x60')];_0x1b3aa6[_0xd266('0x61')]=_0x16417b==='queue'||_0x16417b===_0xd266('0x62')?_0xd266('0x63'):'outbound';var _0x1b3b5e=util[_0xd266('0x53')](_0xd266('0x64'),_0x534fd8[_0xd266('0x5a')],_0x38e1a8[_0xd266('0x65')],md5(_0x38e1a8[_0xd266('0x65')]));if(_0x41781b&&_0x41781b[_0xd266('0x66')]){logger[_0xd266('0x12')](_0xd266('0x67'),_0xd266('0x68'));_0x38e1a8[_0xd266('0x69')]=_0x1b3b5e;}else if(_0x539108&&_0x539108[_0xd266('0x6a')]&&_0x539108[_0xd266('0x6a')]!==_0xd266('0x6b')){logger[_0xd266('0x12')]('[OUTBOUND]',_0xd266('0x68'));_0x38e1a8[_0xd266('0x69')]=_0x1b3b5e;}else{_0x38e1a8[_0xd266('0x69')]='';}return getAdminUser(_0x16417b,_0x5eed5a,_0x1b3aa6,_0x28cc0f,_0x4acfc8,_0x3c411a)[_0xd266('0xd')](getUser(_0x16417b,_0x5eed5a,_0x28cc0f,_0x4acfc8,_0x3c411a))[_0xd266('0xd')](getEndUser(_0x16417b,_0x5eed5a,_0x28cc0f,_0x4acfc8,_0x3c411a))[_0xd266('0xd')](getTicket(_0x16417b,_0x5eed5a,_0x28cc0f,_0x2c439b,_0x38e1a8,_0x4acfc8))[_0xd266('0xd')](function(_0x1e4965){logger[_0xd266('0x12')](util[_0xd266('0x53')](_0xd266('0x6c'),_0x1e4965[_0xd266('0x6d')]));logger[_0xd266('0x12')](util['format'](_0xd266('0x6e'),_0x16417b));if(_0x16417b!=='unmanaged'){logger[_0xd266('0x12')]('['+[_0x16417b[_0xd266('0x17')]()]+']',_0xd266('0x6f'));emit(_0x534fd8[_0xd266('0x59')],_0x259b78[_0xd266('0x39')],_0x1e4965[_0xd266('0x6d')]);}})[_0xd266('0x14')](function(_0x5710d7){logger[_0xd266('0x15')]('['+[_0x16417b[_0xd266('0x17')]()]+_0xd266('0x70'),util[_0xd266('0x71')](_0x5710d7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa918=['then','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','true','userId','adminId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','nameField','customField','toLowerCase','toString','idField','content','type','variableName','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','POST','incident','getString','Subjects','Fields','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','stripTrailingSlash','remoteUri','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa918,0x1a0));var _0x8a91=function(_0x4b0733,_0xb0b8c6){_0x4b0733=_0x4b0733-0x0;var _0x5e7a2d=_0xa918[_0x4b0733];return _0x5e7a2d;};'use strict';var _=require('lodash');var Promise=require(_0x8a91('0x0'));var rp=require(_0x8a91('0x1'));var util=require('util');var md5=require(_0x8a91('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x8a91('0x3'));var logger=require(_0x8a91('0x4'))(_0x8a91('0x5'));config[_0x8a91('0x6')]=_[_0x8a91('0x7')](config[_0x8a91('0x6')],{'host':_0x8a91('0x8'),'port':0x18eb});var io=require(_0x8a91('0x9'))(new Redis(config['redis']));function getAdminUser(_0xf16342,_0x16c719,_0x4e270b,_0x40af87,_0x164800,_0x23a29f){return new Promise(function(_0x27a62c,_0x585a52){var _0xec3327={'method':_0x8a91('0xa'),'uri':_0x40af87+_0x8a91('0xb')+'&'+_0x164800+'&'+_0x23a29f,'auth':_0x16c719,'json':!![]};return rp(_0xec3327)[_0x8a91('0xc')](function(_0x13c90d){if(_0x13c90d[_0x8a91('0xd')][_0x8a91('0xe')]>0x0){_0x4e270b['adminId']=_0x13c90d[_0x8a91('0xd')][0x0][_0x8a91('0xf')];}logger[_0x8a91('0x10')]('['+[_0xf16342[_0x8a91('0x11')]()]+_0x8a91('0x12'),_0x4e270b);_0x27a62c(_0x4e270b);})['catch'](function(_0x19a604){logger[_0x8a91('0x13')]('['+[_0xf16342[_0x8a91('0x11')]()]+']',_0x19a604['message']);_0x585a52(_0x19a604[_0x8a91('0x14')]);});});}function getUser(_0x2cdd28,_0x5bb335,_0x298011,_0x3bb4e2,_0x63e8c3){return function(_0x495239){logger[_0x8a91('0x10')]('['+[_0x2cdd28[_0x8a91('0x11')]()]+_0x8a91('0x15'),_0x495239);return new Promise(function(_0x46d8fe,_0x5a2f7e){if(intUtil['validateEmail'](_0x495239[_0x8a91('0x16')])){var _0x268239={'method':_0x8a91('0xa'),'uri':_0x298011+_0x8a91('0x17')+_0x495239[_0x8a91('0x16')]+'&'+_0x3bb4e2+'&'+_0x63e8c3,'auth':_0x5bb335,'json':!![]};logger[_0x8a91('0x10')]('['+[_0x2cdd28[_0x8a91('0x11')]()]+_0x8a91('0x18'),_0x268239);return rp(_0x268239)[_0x8a91('0xc')](function(_0x3245a2){logger[_0x8a91('0x10')]('['+[_0x2cdd28[_0x8a91('0x11')]()]+'],\x20getUser\x20entity',_0x3245a2);if(_0x3245a2[_0x8a91('0xd')][_0x8a91('0xe')]>0x0&&String(_0x3245a2['result'][0x0]['active'])===_0x8a91('0x19')){_0x495239['userId']=_0x3245a2[_0x8a91('0xd')][0x0][_0x8a91('0xf')];}else{_0x495239[_0x8a91('0x1a')]=_0x495239[_0x8a91('0x1b')];_0x495239[_0x8a91('0x16')]=_0x495239[_0x8a91('0x1c')];}logger[_0x8a91('0x10')]('['+[_0x2cdd28[_0x8a91('0x11')]()]+_0x8a91('0x1d'),_0x495239);_0x46d8fe(_0x495239);})[_0x8a91('0x1e')](function(_0x1161c6){logger['error']('['+[_0x2cdd28[_0x8a91('0x11')]()]+']',_0x1161c6[_0x8a91('0x14')]);_0x5a2f7e(_0x1161c6['message']);});}else{logger[_0x8a91('0x10')]('['+[_0x2cdd28[_0x8a91('0x11')]()]+_0x8a91('0x1f'));_0x495239[_0x8a91('0x1a')]=_0x495239['adminId'];_0x495239['userEmail']=_0x495239[_0x8a91('0x1c')];_0x46d8fe(_0x495239);}});};}function createEndUser(_0x3d8f8e,_0x1f2d97,_0x5038a5,_0x56973c,_0x8efb90){logger[_0x8a91('0x10')]('['+[_0x3d8f8e[_0x8a91('0x11')]()]+_0x8a91('0x20'),_0x5038a5);return new Promise(function(_0x540d23,_0x5c50da){var _0xdd5abc={'method':'POST','uri':_0x56973c+_0x8a91('0x21')+_0x8efb90,'body':{'user_name':_0x5038a5[_0x8a91('0x22')],'roles':_0x8a91('0x23'),'first_name':_0x5038a5[_0x8a91('0x22')],'active':_0x8a91('0x19'),'date_format':'System','phone':_0x5038a5[_0x8a91('0x22')]},'auth':_0x1f2d97,'json':!![]};return rp(_0xdd5abc)[_0x8a91('0xc')](function(_0x3fd6e2){logger[_0x8a91('0x10')]('['+[_0x3d8f8e[_0x8a91('0x11')]()]+_0x8a91('0x24'),_0x3fd6e2[_0x8a91('0xd')]);_0x5038a5[_0x8a91('0x25')]=_0x3fd6e2[_0x8a91('0xd')][_0x8a91('0xf')];_0x540d23(_0x5038a5);})[_0x8a91('0x1e')](function(_0x5cb5f6){logger[_0x8a91('0x13')]('['+[_0x3d8f8e[_0x8a91('0x11')]()]+']',_0x5cb5f6['message']);_0x5c50da(_0x5cb5f6['message']);});});}function getEndUser(_0x510df8,_0x5b9cb3,_0x312463,_0x4a70fa,_0x3af5c6){return function(_0x570d51){logger[_0x8a91('0x10')]('['+[_0x510df8[_0x8a91('0x11')]()]+_0x8a91('0x26'),_0x570d51);return new Promise(function(_0x39a90f,_0x4e7fe2){var _0x40006c={'method':'GET','uri':_0x312463+_0x8a91('0x27')+_0x570d51[_0x8a91('0x22')]+'&'+_0x4a70fa+'&'+_0x3af5c6,'auth':_0x5b9cb3,'json':!![]};return rp(_0x40006c)[_0x8a91('0xc')](function(_0x10a795){if(_0x10a795[_0x8a91('0xd')]['length']>0x0){_0x570d51[_0x8a91('0x25')]=_0x10a795[_0x8a91('0xd')][0x0]['sys_id'];logger[_0x8a91('0x10')]('['+[_0x510df8[_0x8a91('0x11')]()]+_0x8a91('0x28'),_0x570d51);_0x39a90f(_0x570d51);}else{return createEndUser(_0x510df8,_0x5b9cb3,_0x570d51,_0x312463,_0x4a70fa)['then'](function(_0x15fba1){logger[_0x8a91('0x10')]('['+[_0x510df8['toUpperCase']()]+_0x8a91('0x29'),_0x15fba1);_0x39a90f(_0x15fba1);});}})[_0x8a91('0x1e')](function(_0x49f7aa){logger[_0x8a91('0x13')]('['+[_0x510df8[_0x8a91('0x11')]()]+']',_0x49f7aa[_0x8a91('0x14')]);_0x4e7fe2(_0x49f7aa['message']);});});};}function getCustomFields(_0x54065e,_0x15043c){var _0x48a46b={};if(_0x54065e[_0x8a91('0xe')]>0x0){_[_0x8a91('0x2a')](_0x54065e,function(_0x71cb9a){if(_[_0x8a91('0x2b')](['string',_0x8a91('0x2c')],_0x71cb9a['type'])&&_0x71cb9a[_0x8a91('0x2d')]&&!_0x71cb9a[_0x8a91('0x2e')]){_0x48a46b[_0x71cb9a[_0x8a91('0x2d')][_0x8a91('0x2f')]()]=_0x71cb9a['content'][_0x8a91('0x30')]();}else if(_[_0x8a91('0x2b')](['string',_0x8a91('0x2c')],_0x71cb9a['type'])&&_0x71cb9a[_0x8a91('0x31')]&&_0x71cb9a[_0x8a91('0x2e')]){_0x48a46b[_0x71cb9a[_0x8a91('0x31')][_0x8a91('0x2f')]()]=_0x71cb9a[_0x8a91('0x32')][_0x8a91('0x30')]();}else if(_0x71cb9a[_0x8a91('0x33')]==='variable'&&_0x71cb9a[_0x8a91('0x34')]&&_0x71cb9a[_0x8a91('0x31')]&&_0x71cb9a[_0x8a91('0x2e')]){_0x48a46b[_0x71cb9a[_0x8a91('0x31')][_0x8a91('0x2f')]()]=_0x15043c[_0x71cb9a['variableName']][_0x8a91('0x30')]();}else if(_0x71cb9a[_0x8a91('0x33')]===_0x8a91('0x35')&&_0x71cb9a[_0x8a91('0x36')]&&_0x71cb9a[_0x8a91('0x36')]['name']&&_0x71cb9a[_0x8a91('0x31')]&&_0x71cb9a[_0x8a91('0x2e')]){_0x48a46b[_0x71cb9a[_0x8a91('0x31')][_0x8a91('0x2f')]()]=_0x15043c[_0x71cb9a[_0x8a91('0x36')]['name'][_0x8a91('0x2f')]()][_0x8a91('0x30')]();}});}return _0x48a46b;}function getTicket(_0x2320e2,_0x32f0e4,_0x6eb7da,_0x1efa39,_0xa41164,_0x3b281b){return function(_0x1ac52d){logger[_0x8a91('0x10')]('['+[_0x2320e2[_0x8a91('0x11')]()]+_0x8a91('0x37'),_0x1ac52d);return new Promise(function(_0x5a5dc1,_0x1ffd70){var _0x939e49=_0x2320e2[_0x8a91('0x2f')]()===_0x8a91('0x38')?_0x1ac52d['userId']:_0x1ac52d[_0x8a91('0x25')];var _0x29ebb8={'method':_0x8a91('0x39'),'uri':_0x6eb7da+_0x8a91('0x3a')+'?'+_0x3b281b,'body':Object['assign']({},{'active':_0x8a91('0x19'),'caller_id':_0x939e49,'assigned_to':_0x1ac52d['userId'],'short_description':intUtil[_0x8a91('0x3b')](_0x1efa39[_0x8a91('0x3c')],_0xa41164,'\x20'),'description':intUtil[_0x8a91('0x3b')](_0x1efa39['Descriptions'],_0xa41164,'\x0a')},getCustomFields(_0x1efa39[_0x8a91('0x3d')],_0xa41164)),'auth':_0x32f0e4,'json':!![]};return rp(_0x29ebb8)[_0x8a91('0xc')](function(_0x325c2d){logger[_0x8a91('0x10')]('['+[_0x2320e2[_0x8a91('0x11')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x325c2d[_0x8a91('0xd')]);_0x1ac52d[_0x8a91('0x3e')]=_0x325c2d[_0x8a91('0xd')][_0x8a91('0xf')];_0x1ac52d[_0x8a91('0x3f')]=_0x325c2d['result'][_0x8a91('0x40')];logger[_0x8a91('0x10')]('['+[_0x2320e2[_0x8a91('0x11')]()]+']\x20getTicket\x20crm',_0x1ac52d);_0x5a5dc1(_0x1ac52d);})['catch'](function(_0x57786a){logger[_0x8a91('0x13')]('['+[_0x2320e2[_0x8a91('0x11')]()]+']',_0x57786a['message']);_0x1ffd70(_0x57786a[_0x8a91('0x14')]);});});};}function createRemoteTag(_0x509034,_0x5bc8a3,_0x3a6603,_0x400804){return new Promise(function(_0x54a6f5,_0x370ca7){var _0x1317d7={'method':'POST','uri':_0x3a6603+'label'+'?'+_0x400804,'body':{'short_description':_0x509034,'global':!![],'active':!![],'name':_0x509034},'auth':_0x5bc8a3,'json':!![]};return rp(_0x1317d7)[_0x8a91('0xc')](function(_0x3d2676){var _0x55bd33=_0x3d2676['result'][_0x8a91('0xf')];_0x54a6f5(_0x55bd33);});});}function getRemoteTag(_0x304aa2,_0x3b6470,_0x1acd4e,_0xd621f6,_0x49c13f){return new Promise(function(_0x1b57d1,_0x202600){var _0x5eafaf={'method':_0x8a91('0xa'),'uri':_0x1acd4e+_0x8a91('0x41')+_0x8a91('0x42')+_0x304aa2+'&'+_0xd621f6,'auth':_0x3b6470,'json':!![]};return rp(_0x5eafaf)[_0x8a91('0xc')](function(_0x4d4691){if(_0x4d4691[_0x8a91('0xd')]['length']>0x0){var _0x581b76=_0x4d4691['result'][0x0][_0x8a91('0xf')];_0x1b57d1(_0x581b76);}else{return createRemoteTag(_0x304aa2,_0x3b6470,_0x1acd4e,_0xd621f6)['then'](function(_0x31589a){_0x1b57d1(_0x31589a);});}});});}function assignTagToIncident(_0x58e7b0,_0x333d52,_0x34fa0d,_0x369f41,_0x12e74f){return new Promise(function(_0x2be29f,_0x41201a){var _0x2d9030={'method':_0x8a91('0x39'),'uri':_0x34fa0d+_0x8a91('0x43')+'?'+_0x12e74f,'body':{'label':_0x58e7b0,'table':'incident','id_type':_0x8a91('0x44'),'table_key':_0x369f41[_0x8a91('0x3e')],'title':_0x8a91('0x45')+_0x369f41[_0x8a91('0x3f')],'id_display':_0x369f41['ticketNumber']},'auth':_0x333d52,'json':!![]};return rp(_0x2d9030)['then'](function(_0x487bf2){_0x2be29f();})[_0x8a91('0x1e')](function(){_0x2be29f();});});}function manageTags(_0x3def1c,_0x520511,_0x19c73b,_0x466b7f,_0x3375d5,_0x15e759,_0x1f6d0b){return new Promise(function(_0x462d87,_0x2f8ea4){var _0x3b19e6=[];_0x520511['forEach'](function(_0x13e8f8){_0x3b19e6[_0x8a91('0x46')](getRemoteTag(_0x13e8f8,_0x19c73b,_0x466b7f,_0x15e759,_0x1f6d0b));});return Promise['all'](_0x3b19e6)['then'](function(_0x34327f){if(_0x34327f[_0x8a91('0xe')]){logger['info']('['+[_0x3def1c[_0x8a91('0x11')]()]+_0x8a91('0x47'),_0x34327f);var _0x11d955=[];_0x34327f[_0x8a91('0x2a')](function(_0x465842){_0x11d955[_0x8a91('0x46')](assignTagToIncident(_0x465842,_0x19c73b,_0x466b7f,_0x3375d5,_0x15e759));});return Promise[_0x8a91('0x48')](_0x11d955)['then'](function(){_0x462d87();})[_0x8a91('0x1e')](function(){_0x462d87();});}else{_0x462d87();}});});}function getTags(_0x3daddc,_0x3d7678,_0x8710c4,_0x4d07b7,_0x228767,_0x54ab0a){return function(_0x10499c){return new Promise(function(_0x5951e4,_0x2c03d8){var _0x55aeee=[];var _0x7a4de2=_0x4d07b7['Tags'];if(_0x7a4de2&&_0x7a4de2[_0x8a91('0xe')]>0x0){_0x55aeee=_[_0x8a91('0x49')](_0x7a4de2,_0x8a91('0x4a'));}if(_0x55aeee['length']>0x0){return manageTags(_0x3daddc,_0x55aeee,_0x3d7678,_0x8710c4,_0x10499c,_0x228767,_0x54ab0a)[_0x8a91('0xc')](function(){_0x5951e4(_0x10499c);});}else{_0x5951e4(_0x10499c);}});};}function emit(_0x1cac4a,_0x1c1c33,_0x4a8421){var _0x51bb44=_0x8a91('0x4b')+_0x8a91('0x4c')+_0x8a91('0x4d')+_0x8a91('0x4e');var _0x181dd4={'uri':_0x1cac4a+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x4a8421+_0x51bb44};io['to'](util[_0x8a91('0x4f')](_0x8a91('0x50'),_0x1c1c33))['emit'](_0x8a91('0x51'),_0x181dd4);}exports['cs']=function(_0xfcc0bc,_0x123cee,_0x12496f,_0x14d480,_0x3b8b6a,_0x30195d,_0x3613de,_0x23d29a){var _0x40f78f={};var _0x34a248={'user':_0x30195d[_0x8a91('0x52')],'pass':_0x30195d[_0x8a91('0x53')]};var _0x354e61=_0x8a91('0x54');var _0x5b84e0='sysparm_display_value=true';_0x30195d['remoteUri']=intUtil[_0x8a91('0x55')](_0x30195d[_0x8a91('0x56')]);_0x30195d['serverUrl']=intUtil[_0x8a91('0x55')](_0x30195d['serverUrl']);var _0x2a6947=util[_0x8a91('0x4f')](_0x8a91('0x57'),_0x30195d[_0x8a91('0x56')]);_0x40f78f[_0x8a91('0x16')]=!_[_0x8a91('0x58')](_0x14d480)?_0x14d480[_0x8a91('0x59')]:null;_0x40f78f['adminEmail']=_0x30195d['email'];_0x40f78f[_0x8a91('0x22')]=_0x23d29a[_0x8a91('0x2f')]()===_0x8a91('0x38')?_0x123cee[_0x8a91('0x5a')]:_0x123cee['calleridnum'];_0x40f78f[_0x8a91('0x5b')]=_0x23d29a===_0x8a91('0x5c')||_0x23d29a===_0x8a91('0x5d')?_0x8a91('0x5c'):_0x8a91('0x38');var _0x479988=util[_0x8a91('0x4f')](_0x8a91('0x5e'),_0x30195d[_0x8a91('0x5f')],_0x123cee['uniqueid'],md5(_0x123cee[_0x8a91('0x60')]));if(_0x3b8b6a&&_0x3b8b6a['monitor_format']){logger[_0x8a91('0x10')](_0x8a91('0x61'),_0x8a91('0x62'));_0x123cee[_0x8a91('0x63')]=_0x479988;}else if(_0x3613de&&_0x3613de[_0x8a91('0x64')]&&_0x3613de[_0x8a91('0x64')]!==_0x8a91('0x65')){logger[_0x8a91('0x10')](_0x8a91('0x66'),_0x8a91('0x62'));_0x123cee[_0x8a91('0x63')]=_0x479988;}else{_0x123cee[_0x8a91('0x63')]='';}return getAdminUser(_0x23d29a,_0x34a248,_0x40f78f,_0x2a6947,_0x5b84e0,_0x354e61)[_0x8a91('0xc')](getUser(_0x23d29a,_0x34a248,_0x2a6947,_0x5b84e0,_0x354e61))['then'](getEndUser(_0x23d29a,_0x34a248,_0x2a6947,_0x5b84e0,_0x354e61))[_0x8a91('0xc')](getTicket(_0x23d29a,_0x34a248,_0x2a6947,_0x12496f,_0x123cee,_0x5b84e0))[_0x8a91('0xc')](function(_0x21f16c){logger[_0x8a91('0x10')](util[_0x8a91('0x4f')]('The\x20ticket\x20ID\x20is:\x20%s',_0x21f16c[_0x8a91('0x3e')]));logger[_0x8a91('0x10')](util['format'](_0x8a91('0x67'),_0x23d29a));if(_0x23d29a!=='unmanaged'){logger[_0x8a91('0x10')]('['+[_0x23d29a[_0x8a91('0x11')]()]+']',_0x8a91('0x68'));emit(_0x30195d['remoteUri'],_0x14d480[_0x8a91('0x4a')],_0x21f16c[_0x8a91('0x3e')]);}})[_0x8a91('0x1e')](function(_0x48cfee){logger[_0x8a91('0x13')]('['+[_0x23d29a[_0x8a91('0x11')]()]+_0x8a91('0x69'),util[_0x8a91('0x6a')](_0x48cfee,{'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 3e0cede..aa0f6d4 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 _0x73af=['slice','replace','duration_hours','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','then','find','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','value','user_name','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Enduser\x20created.','first_name','[HTTP]','merge','map','string','nameField','toLowerCase','content','type','idField','customField','custom_fields','variable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','Inbound','lodash','bluebird','md5','util','ioredis','./util','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','date_start','toISOString'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x73af,0x152));var _0xf73a=function(_0x20c512,_0x36c198){_0x20c512=_0x20c512-0x0;var _0x25236e=_0x73af[_0x20c512];return _0x25236e;};'use strict';var _=require(_0xf73a('0x0'));var rp=require('request-promise');var BPromise=require(_0xf73a('0x1'));var md5=require(_0xf73a('0x2'));var util=require(_0xf73a('0x3'));var Redis=require(_0xf73a('0x4'));var intUtil=require(_0xf73a('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xf73a('0x6'));config[_0xf73a('0x7')]=_[_0xf73a('0x8')](config[_0xf73a('0x7')],{'host':_0xf73a('0x9'),'port':0x18eb});var io=require(_0xf73a('0xa'))(new Redis(config[_0xf73a('0x7')]));var def={'method':_0xf73a('0xb'),'json':!![]};function emit(_0x3b5cd0,_0x549cd4,_0x3ac6c3){io['to'](_0x3b5cd0)[_0xf73a('0xc')](_0x549cd4,_0x3ac6c3);}function getTicket(_0x4f0ada,_0x266d2e,_0xf8e545,_0x54998a,_0x28ea06,_0x41be30,_0x23f08a,_0x5ba14d){logger[_0xf73a('0xd')](_0xf73a('0xe'));var _0x36a64c=new Date();var _0x770ca=[{'name':_0xf73a('0xf'),'value':intUtil[_0xf73a('0x10')](_0x54998a[_0xf73a('0x11')],_0x28ea06,'\x20')},{'name':'assigned_user_id','value':_0x266d2e['id']},{'name':_0xf73a('0x12'),'value':_0x266d2e['id']},{'name':_0xf73a('0x13'),'value':intUtil[_0xf73a('0x10')](_0x54998a['Descriptions'],_0x28ea06,'\x0a')},{'name':_0xf73a('0x14'),'value':_0x36a64c[_0xf73a('0x15')]()[_0xf73a('0x16')](0x0,0x13)[_0xf73a('0x17')]('T','\x20')},{'name':_0xf73a('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0xf8e545['id']},{'name':_0xf73a('0x19'),'value':_0xf73a('0x1a')},{'name':_0xf73a('0x1b'),'value':_0xf8e545[_0xf73a('0xf')]},{'name':_0xf73a('0x1c'),'value':_0x5ba14d}];if(_0x41be30[_0xf73a('0x1d')]){_[_0xf73a('0x1e')](_0x41be30,function(_0x62099e){if(_0x28ea06[_0x62099e[_0xf73a('0x1f')]]){_0x770ca[_0xf73a('0x20')]({'name':_0x62099e['idField'],'value':_0x28ea06[_0x62099e['variableName']]});}});}return request({'form':{'method':_0xf73a('0x21'),'input_type':'JSON','response_type':_0xf73a('0x22'),'rest_data':JSON[_0xf73a('0x23')]({'session':_0x23f08a['id'],'module_name':_0xf73a('0x24'),'name_value_list':_0x770ca})}});}function getAuth(_0x4fb702){return util[_0xf73a('0x25')](_0xf73a('0x26'),new Buffer(_0x4fb702['apiKey']+':X')[_0xf73a('0x27')](_0xf73a('0x28')));}function getServerInfo(_0x3c9e49){return request({'form':{'method':_0xf73a('0x29'),'input_type':_0xf73a('0x22'),'response_type':_0xf73a('0x22'),'rest_data':JSON['stringify']({'session':_0x3c9e49['id']})}});}function getUser(_0x1cf64a,_0x271420,_0x383158){if(!_[_0xf73a('0x2a')](_0x271420)){logger[_0xf73a('0xd')](_0xf73a('0x2b'),_0x271420);return request({'form':{'method':'get_entry_list','input_type':_0xf73a('0x22'),'response_type':_0xf73a('0x22'),'rest_data':JSON[_0xf73a('0x23')]({'session':_0x383158['id'],'module_name':_0xf73a('0x2c'),'query':util[_0xf73a('0x25')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x271420),'order_by':'','offset':'0','select_fields':['id',_0xf73a('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf73a('0x2d')](function(_0x2f9569){if(_0x2f9569['entry_list'][_0xf73a('0x1d')]){var _0x552f06=_[_0xf73a('0x2e')](_0x2f9569['entry_list'],function(_0x4affb8){return _0x4affb8['name_value_list']['user_name']['value']===_0x271420;});if(_0x552f06){logger[_0xf73a('0xd')](_0xf73a('0x2f'));return BPromise[_0xf73a('0x30')]({'id':_0x552f06[_0xf73a('0x31')]['id']['value'],'name':_0x552f06['name_value_list'][_0xf73a('0xf')]['value']});}}logger[_0xf73a('0xd')](_0xf73a('0x32'));return BPromise[_0xf73a('0x30')]({'id':_0x383158[_0xf73a('0x31')][_0xf73a('0x33')][_0xf73a('0x34')],'name':_0x383158[_0xf73a('0x31')][_0xf73a('0x35')][_0xf73a('0x34')]});});}else{logger[_0xf73a('0xd')](_0xf73a('0x36'));return BPromise[_0xf73a('0x30')]({'id':_0x383158['name_value_list'][_0xf73a('0x33')][_0xf73a('0x34')],'name':_0x383158[_0xf73a('0x31')][_0xf73a('0x35')][_0xf73a('0x34')]});}}function getEndUser(_0x566388,_0x39c520,_0x2913a9,_0x1906b7){logger['info']('Searching\x20enduser\x20with\x20phone',_0x2913a9);return request({'form':{'method':_0xf73a('0x37'),'input_type':_0xf73a('0x22'),'response_type':_0xf73a('0x22'),'rest_data':JSON['stringify']({'session':_0x1906b7['id'],'module_name':_0xf73a('0x1a'),'query':util[_0xf73a('0x25')](_0xf73a('0x38'),_0x2913a9),'order_by':'','offset':'0','select_fields':['id',_0xf73a('0xf'),_0xf73a('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf73a('0x2d')](function(_0x298c3a){if(_0x298c3a[_0xf73a('0x3a')][_0xf73a('0x1d')]){var _0x31e3f0=_[_0xf73a('0x2e')](_0x298c3a[_0xf73a('0x3a')],function(_0x34f29d){return _0x34f29d[_0xf73a('0x31')][_0xf73a('0x39')][_0xf73a('0x34')]===_0x2913a9;});if(_0x31e3f0){logger[_0xf73a('0xd')]('Enduser\x20found!');return BPromise[_0xf73a('0x30')]({'id':_0x31e3f0[_0xf73a('0x31')]['id']['value'],'name':_0x31e3f0[_0xf73a('0x31')][_0xf73a('0xf')][_0xf73a('0x34')],'phone':_0x31e3f0[_0xf73a('0x31')][_0xf73a('0x39')][_0xf73a('0x34')]});}}else{logger[_0xf73a('0xd')](_0xf73a('0x3b'));return request({'form':{'method':'set_entry','input_type':_0xf73a('0x22'),'response_type':'JSON','rest_data':JSON[_0xf73a('0x23')]({'session':_0x1906b7['id'],'module_name':_0xf73a('0x1a'),'name_value_list':[{'name':'first_name','value':_0x39c520!==_0xf73a('0x3c')?_0x39c520:util[_0xf73a('0x25')]('Caller\x20-\x20%s',_0x2913a9)},{'name':_0xf73a('0x39'),'value':_0x2913a9}]})}})['then'](function(_0x5f2453){logger[_0xf73a('0xd')](_0xf73a('0x3d'));return BPromise[_0xf73a('0x30')]({'id':_0x5f2453['id'],'name':_0x5f2453['entry_list'][_0xf73a('0x3e')]['value'],'phone':_0x5f2453[_0xf73a('0x3a')][_0xf73a('0x39')]['value']});});}});}function request(_0x335d44){logger['debug'](_0xf73a('0x3f'),JSON[_0xf73a('0x23')](_0x335d44));return rp(_[_0xf73a('0x40')](def,_0x335d44));}function getTags(_0x358015,_0x243755){var _0x5e01a9=[];if(_0x358015&&_0x358015['length']>0x0){_0x5e01a9=_[_0xf73a('0x41')](_0x358015,_0x243755);}return _0x5e01a9;}function getCustomFields(_0x3815bb,_0x1e337a){var _0x3239f5=[];var _0x34e57d={'custom_fields':[]};if(_0x3815bb[_0xf73a('0x1d')]>0x0){_[_0xf73a('0x1e')](_0x3815bb,function(_0x21ec17){if(_0x21ec17['type']===_0xf73a('0x42')&&_0x21ec17['nameField']&&!_0x21ec17['customField']){_0x34e57d[_0x21ec17[_0xf73a('0x43')][_0xf73a('0x44')]()]=_0x21ec17[_0xf73a('0x45')]['toString']();}else if(_0x21ec17[_0xf73a('0x46')]===_0xf73a('0x42')&&_0x21ec17[_0xf73a('0x47')]&&_0x21ec17[_0xf73a('0x48')]){_0x34e57d[_0xf73a('0x49')]['push']({'id':_0x21ec17[_0xf73a('0x47')],'value':_0x21ec17['content'][_0xf73a('0x27')]()});}else if(_0x21ec17['type']===_0xf73a('0x4a')&&_0x21ec17[_0xf73a('0x1f')]&&_0x21ec17[_0xf73a('0x47')]&&_0x21ec17[_0xf73a('0x48')]){_0x1e337a[_0x21ec17[_0xf73a('0x1f')]]&&_0x34e57d[_0xf73a('0x49')][_0xf73a('0x20')]({'id':_0x21ec17[_0xf73a('0x47')],'value':_0x1e337a[_0x21ec17['variableName']][_0xf73a('0x27')]()});}else if(_0x21ec17[_0xf73a('0x46')]==='customVariable'&&_0x21ec17[_0xf73a('0x4b')]&&_0x21ec17[_0xf73a('0x4b')][_0xf73a('0xf')]&&_0x21ec17[_0xf73a('0x47')]&&_0x21ec17[_0xf73a('0x48')]){_0x1e337a[_0x21ec17['Variable']['name'][_0xf73a('0x44')]()]&&_0x34e57d[_0xf73a('0x49')][_0xf73a('0x20')]({'id':_0x21ec17[_0xf73a('0x47')],'value':_0x1e337a[_0x21ec17[_0xf73a('0x4b')][_0xf73a('0xf')][_0xf73a('0x44')]()][_0xf73a('0x27')]()});}});}return _0x34e57d;}function getConnection(_0xe6aaa6){return request({'method':_0xf73a('0xb'),'form':{'method':_0xf73a('0x4c'),'input_type':_0xf73a('0x22'),'response_type':_0xf73a('0x22'),'rest_data':JSON[_0xf73a('0x23')]({'user_auth':{'user_name':_0xe6aaa6['username'],'password':_0xe6aaa6[_0xf73a('0x4d')],'encryption':_0xf73a('0x4e')},'application':_0xf73a('0x4f')})}})[_0xf73a('0x2d')](function(_0xb9e7dd){var _0x4c4274=_0xb9e7dd;if(_0x4c4274['id']){def[_0xf73a('0x50')]=_0x4c4274['id'];return BPromise['resolve'](_0x4c4274);}else{throw new Error(util[_0xf73a('0x25')]('Account\x20%d\x20is\x20not\x20valid',_0xe6aaa6['id']));}});}function setRelationship(_0x51f7bd,_0x4b81b6,_0x3d0e73,_0x533014){return request({'form':{'method':_0xf73a('0x51'),'input_type':_0xf73a('0x22'),'response_type':_0xf73a('0x22'),'rest_data':JSON['stringify']({'session':_0x51f7bd['id'],'module_name':_0xf73a('0x24'),'module_id':_0x3d0e73['id'],'link_field_name':_0x533014,'related_ids':[_0x4b81b6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf73a('0x52')]=function(_0x590749,_0x556320,_0x4ca6ef,_0x18cf4e,_0x3f4d15,_0x3be414){var _0x3b462c,_0xcff102,_0xfabf75,_0x48e098;_0x3be414[_0xf73a('0x53')]=intUtil[_0xf73a('0x54')](_0x3be414[_0xf73a('0x53')]);_0x3be414[_0xf73a('0x55')]=intUtil[_0xf73a('0x54')](_0x3be414[_0xf73a('0x55')]);def[_0xf73a('0x56')]=util[_0xf73a('0x25')]('%s/service/v4_1/rest.php',_0x3be414[_0xf73a('0x53')]);if(_0x3f4d15&&_0x3f4d15[_0xf73a('0x57')]){logger[_0xf73a('0xd')](_0xf73a('0x58'),_0xf73a('0x59'));_0x556320['recordingURL']=util[_0xf73a('0x25')](_0xf73a('0x5a'),_0x3be414[_0xf73a('0x55')],_0x556320[_0xf73a('0x5b')],md5(_0x556320['uniqueid']));}else{_0x556320[_0xf73a('0x5c')]='';}return getConnection(_0x3be414)['then'](function(_0x352224){_0x48e098=_0x352224;return getUser(_0x3be414,_0x18cf4e[_0xf73a('0xf')],_0x48e098);})['then'](function(_0x2dcabe){_0x3b462c=_0x2dcabe;logger[_0xf73a('0xd')]('The\x20User\x20ID\x20is:',_0x3b462c['id']);return getEndUser(_0x3be414,_0x556320[_0xf73a('0x5d')],_0x556320[_0xf73a('0x5e')],_0x48e098);})[_0xf73a('0x2d')](function(_0x1e7abd){_0xcff102=_0x1e7abd;logger[_0xf73a('0xd')]('The\x20Enduser\x20ID\x20is:',_0xcff102['id']);return getTicket(_0x3be414,_0x3b462c,_0xcff102,_0x4ca6ef,_0x556320,_0x4ca6ef[_0xf73a('0x5f')],_0x48e098,'Inbound');})['then'](function(_0x4ab59e){_0xfabf75=_0x4ab59e;logger[_0xf73a('0xd')](_0xf73a('0x60'));logger[_0xf73a('0xd')](_0xf73a('0x61'),_0xfabf75['id']);return setRelationship(_0x48e098,_0x3b462c,_0xfabf75,_0xf73a('0x62'));})[_0xf73a('0x2d')](function(){return setRelationship(_0x48e098,_0xcff102,_0xfabf75,_0xf73a('0x63'));})[_0xf73a('0x2d')](function(){return getServerInfo(_0x48e098);})[_0xf73a('0x2d')](function(_0x41c440){var _0x2cfcf3=parseInt(_0x41c440[_0xf73a('0x64')][_0xf73a('0x65')](0x0));var _0x15d3f6=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3be414['remoteUri'],_0xfabf75['id']);if(_0x2cfcf3>0x6){_0x15d3f6=util[_0xf73a('0x25')](_0xf73a('0x66'),_0x3be414['remoteUri'],_0xfabf75['id']);}logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf73a('0x25')](_0xf73a('0x67'),_0x18cf4e[_0xf73a('0xf')]),_0xf73a('0x68'),{'uri':_0x15d3f6});})[_0xf73a('0x69')](function(_0x41ff08){logger[_0xf73a('0x6a')](_0xf73a('0x58'),JSON['stringify'](_0x41ff08));});};exports['outbound']=function(_0x383966,_0x23be72,_0x25f763,_0x634c4d,_0x1fc082,_0x2df259,_0x4bbe8b){var _0x261439,_0x5d0ec3,_0x23ca23,_0x318339;_0x2df259[_0xf73a('0x53')]=intUtil[_0xf73a('0x54')](_0x2df259['remoteUri']);_0x2df259[_0xf73a('0x55')]=intUtil[_0xf73a('0x54')](_0x2df259[_0xf73a('0x55')]);def['uri']=util[_0xf73a('0x25')](_0xf73a('0x6b'),_0x2df259[_0xf73a('0x53')]);if(_0x4bbe8b&&_0x4bbe8b[_0xf73a('0x6c')]&&_0x4bbe8b[_0xf73a('0x6c')]!==_0xf73a('0x6d')){logger[_0xf73a('0xd')](_0xf73a('0x6e'),_0xf73a('0x59'));_0x23be72[_0xf73a('0x5c')]=util[_0xf73a('0x25')](_0xf73a('0x5a'),_0x2df259[_0xf73a('0x55')],_0x23be72[_0xf73a('0x5b')],md5(_0x23be72[_0xf73a('0x5b')]));}return getConnection(_0x2df259)[_0xf73a('0x2d')](function(_0x2b0818){_0x318339=_0x2b0818;return getUser(_0x2df259,_0x634c4d['name'],_0x318339);})[_0xf73a('0x2d')](function(_0x2c0ba6){_0x261439=_0x2c0ba6;logger[_0xf73a('0xd')]('The\x20User\x20ID\x20is:',_0x261439['id']);return getEndUser(_0x2df259,_0x23be72['destcalleridname'],_0x23be72[_0xf73a('0x6f')],_0x318339);})[_0xf73a('0x2d')](function(_0x22bcd2){_0x5d0ec3=_0x22bcd2;logger[_0xf73a('0xd')](_0xf73a('0x70'),_0x5d0ec3['id']);return getTicket(_0x2df259,_0x261439,_0x5d0ec3,_0x25f763,_0x23be72,_0x25f763[_0xf73a('0x5f')],_0x318339,'Outbound');})[_0xf73a('0x2d')](function(_0x233b5c){_0x23ca23=_0x233b5c;logger[_0xf73a('0xd')](_0xf73a('0x60'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x23ca23['id']);return setRelationship(_0x318339,_0x261439,_0x23ca23,'users');})['then'](function(){return setRelationship(_0x318339,_0x5d0ec3,_0x23ca23,_0xf73a('0x63'));})[_0xf73a('0x2d')](function(){return getServerInfo(_0x318339);})[_0xf73a('0x2d')](function(_0x599be7){var _0x4afcf3=parseInt(_0x599be7['version'][_0xf73a('0x65')](0x0));var _0x22a0bb=util['format'](_0xf73a('0x71'),_0x2df259['remoteUri'],_0x23ca23['id']);if(_0x4afcf3>0x6){_0x22a0bb=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2df259[_0xf73a('0x53')],_0x23ca23['id']);}logger['info'](_0xf73a('0x6e'),_0xf73a('0x72'));emit(util['format'](_0xf73a('0x67'),_0x634c4d[_0xf73a('0xf')]),'trigger:browser:url',{'uri':_0x22a0bb});})[_0xf73a('0x69')](function(_0x53d569){logger[_0xf73a('0x6a')](_0xf73a('0x6e'),JSON[_0xf73a('0x23')](_0x53d569));});};exports[_0xf73a('0x73')]=function(_0x574d29,_0x3efbe5,_0x3cc977,_0x4a1891,_0x2af8d5,_0x3a0403){var _0x46e3e4,_0x534d9c,_0x442079,_0x3c375f;_0x3a0403[_0xf73a('0x53')]=intUtil['stripTrailingSlash'](_0x3a0403[_0xf73a('0x53')]);_0x3a0403[_0xf73a('0x55')]=intUtil[_0xf73a('0x54')](_0x3a0403[_0xf73a('0x55')]);def[_0xf73a('0x56')]=util[_0xf73a('0x25')](_0xf73a('0x6b'),_0x3a0403[_0xf73a('0x53')]);if(_0x2af8d5&&_0x2af8d5[_0xf73a('0x57')]){logger[_0xf73a('0xd')]('['+_0x3efbe5[_0xf73a('0x74')][_0xf73a('0x75')]()+']',_0xf73a('0x59'));_0x3efbe5[_0xf73a('0x5c')]=util['format'](_0xf73a('0x5a'),_0x3a0403[_0xf73a('0x55')],_0x3efbe5['uniqueid'],md5(_0x3efbe5[_0xf73a('0x5b')]));}else{_0x3efbe5[_0xf73a('0x5c')]='';}return getConnection(_0x3a0403)[_0xf73a('0x2d')](function(_0x39f029){_0x3c375f=_0x39f029;if(!_[_0xf73a('0x2a')](_0x4a1891)){return getUser(_0x3a0403,_0x4a1891[_0xf73a('0xf')],_0x3c375f);}else{return getUser(_0x3a0403,null,_0x3c375f);}})[_0xf73a('0x2d')](function(_0x581b9e){_0x46e3e4=_0x581b9e;logger[_0xf73a('0xd')](_0xf73a('0x76'),_0x46e3e4['id']);return getEndUser(_0x3a0403,_0x3efbe5[_0xf73a('0x5d')],_0x3efbe5[_0xf73a('0x5e')],_0x3c375f);})['then'](function(_0x4a76ec){_0x534d9c=_0x4a76ec;logger['info']('The\x20Enduser\x20ID\x20is:',_0x534d9c['id']);return getTicket(_0x3a0403,_0x46e3e4,_0x534d9c,_0x3cc977,_0x3efbe5,_0x3cc977[_0xf73a('0x5f')],_0x3c375f,_0xf73a('0x77'));})[_0xf73a('0x2d')](function(_0x49cdae){_0x442079=_0x49cdae;logger['info'](_0xf73a('0x60'));logger[_0xf73a('0xd')](_0xf73a('0x61'),_0x442079['id']);return setRelationship(_0x3c375f,_0x46e3e4,_0x442079,_0xf73a('0x62'));})['then'](function(){return setRelationship(_0x3c375f,_0x534d9c,_0x442079,'contacts');})[_0xf73a('0x2d')](function(){return getServerInfo(_0x3c375f);})[_0xf73a('0x69')](function(_0x12849e){logger[_0xf73a('0x6a')]('['+_0x3efbe5[_0xf73a('0x74')]['toUpperCase']()+']',JSON[_0xf73a('0x23')](_0x12849e));});}; \ No newline at end of file +var _0x669b=['direction','forEach','variableName','push','idField','JSON','stringify','Calls','Basic\x20%s','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','entry_list','length','find','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','value','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','set_entry','first_name','','Caller\x20-\x20%s','then','Enduser\x20created.','debug','[HTTP]','map','type','nameField','customField','content','string','variable','custom_fields','Variable','toLowerCase','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','unmanaged','isNil','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name'];(function(_0x1df467,_0x3839b3){var _0x30cfff=function(_0x1a8bbb){while(--_0x1a8bbb){_0x1df467['push'](_0x1df467['shift']());}};_0x30cfff(++_0x3839b3);}(_0x669b,0x1bd));var _0xb669=function(_0x368a1e,_0x13e6ce){_0x368a1e=_0x368a1e-0x0;var _0x18d3da=_0x669b[_0x368a1e];return _0x18d3da;};'use strict';var _=require(_0xb669('0x0'));var rp=require(_0xb669('0x1'));var BPromise=require('bluebird');var md5=require(_0xb669('0x2'));var util=require(_0xb669('0x3'));var Redis=require('ioredis');var intUtil=require(_0xb669('0x4'));var config=require('../../../../config/environment');var logger=require(_0xb669('0x5'))(_0xb669('0x6'));config[_0xb669('0x7')]=_[_0xb669('0x8')](config[_0xb669('0x7')],{'host':_0xb669('0x9'),'port':0x18eb});var io=require(_0xb669('0xa'))(new Redis(config['redis']));var def={'method':_0xb669('0xb'),'json':!![]};function emit(_0x44eefe,_0x56007e,_0x248c3e){io['to'](_0x44eefe)[_0xb669('0xc')](_0x56007e,_0x248c3e);}function getTicket(_0x1ca7c0,_0x104f29,_0x3a9361,_0x519f32,_0x2287ad,_0x1c5057,_0x5dab46,_0x43d387){logger[_0xb669('0xd')](_0xb669('0xe'));var _0x3f5b77=new Date();var _0x53b20a=[{'name':'name','value':intUtil[_0xb669('0xf')](_0x519f32[_0xb669('0x10')],_0x2287ad,'\x20')},{'name':_0xb669('0x11'),'value':_0x104f29['id']},{'name':_0xb669('0x12'),'value':_0x104f29['id']},{'name':_0xb669('0x13'),'value':intUtil[_0xb669('0xf')](_0x519f32[_0xb669('0x14')],_0x2287ad,'\x0a')},{'name':'date_start','value':_0x3f5b77['toISOString']()['slice'](0x0,0x13)[_0xb669('0x15')]('T','\x20')},{'name':_0xb669('0x16'),'value':'0'},{'name':_0xb669('0x17'),'value':'15'},{'name':_0xb669('0x18'),'value':_0x3a9361['id']},{'name':'parent_type','value':_0xb669('0x19')},{'name':_0xb669('0x1a'),'value':_0x3a9361['name']},{'name':_0xb669('0x1b'),'value':_0x43d387}];if(_0x1c5057['length']){_[_0xb669('0x1c')](_0x1c5057,function(_0x39968d){if(_0x2287ad[_0x39968d[_0xb669('0x1d')]]){_0x53b20a[_0xb669('0x1e')]({'name':_0x39968d[_0xb669('0x1f')],'value':_0x2287ad[_0x39968d[_0xb669('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xb669('0x20'),'response_type':'JSON','rest_data':JSON[_0xb669('0x21')]({'session':_0x5dab46['id'],'module_name':_0xb669('0x22'),'name_value_list':_0x53b20a})}});}function getAuth(_0x18e5fa){return util['format'](_0xb669('0x23'),new Buffer(_0x18e5fa['apiKey']+':X')[_0xb669('0x24')](_0xb669('0x25')));}function getServerInfo(_0x507c7d){return request({'form':{'method':_0xb669('0x26'),'input_type':_0xb669('0x20'),'response_type':_0xb669('0x20'),'rest_data':JSON['stringify']({'session':_0x507c7d['id']})}});}function getUser(_0xe0ec07,_0x25ed69,_0x3943bd){if(!_['isNil'](_0x25ed69)){logger[_0xb669('0xd')](_0xb669('0x27'),_0x25ed69);return request({'form':{'method':_0xb669('0x28'),'input_type':_0xb669('0x20'),'response_type':_0xb669('0x20'),'rest_data':JSON[_0xb669('0x21')]({'session':_0x3943bd['id'],'module_name':_0xb669('0x29'),'query':util[_0xb669('0x2a')](_0xb669('0x2b'),_0x25ed69),'order_by':'','offset':'0','select_fields':['id',_0xb669('0x2c'),_0xb669('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3770a7){if(_0x3770a7[_0xb669('0x2e')][_0xb669('0x2f')]){var _0x1b9b76=_[_0xb669('0x30')](_0x3770a7[_0xb669('0x2e')],function(_0x6289b7){return _0x6289b7['name_value_list'][_0xb669('0x2d')]['value']===_0x25ed69;});if(_0x1b9b76){logger[_0xb669('0xd')]('Agent\x20found!');return BPromise[_0xb669('0x31')]({'id':_0x1b9b76[_0xb669('0x32')]['id']['value'],'name':_0x1b9b76[_0xb669('0x32')][_0xb669('0x2c')]['value']});}}logger[_0xb669('0xd')](_0xb669('0x33'));return BPromise[_0xb669('0x31')]({'id':_0x3943bd['name_value_list'][_0xb669('0x34')][_0xb669('0x35')],'name':_0x3943bd[_0xb669('0x32')][_0xb669('0x2d')][_0xb669('0x35')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb669('0x31')]({'id':_0x3943bd[_0xb669('0x32')][_0xb669('0x34')][_0xb669('0x35')],'name':_0x3943bd[_0xb669('0x32')][_0xb669('0x2d')][_0xb669('0x35')]});}}function getEndUser(_0x216c14,_0x4657fe,_0xc95d3b,_0x591dda){logger[_0xb669('0xd')](_0xb669('0x36'),_0xc95d3b);return request({'form':{'method':_0xb669('0x28'),'input_type':_0xb669('0x20'),'response_type':_0xb669('0x20'),'rest_data':JSON[_0xb669('0x21')]({'session':_0x591dda['id'],'module_name':_0xb669('0x19'),'query':util['format'](_0xb669('0x37'),_0xc95d3b),'order_by':'','offset':'0','select_fields':['id','name',_0xb669('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4370db){if(_0x4370db[_0xb669('0x2e')][_0xb669('0x2f')]){var _0x41119d=_[_0xb669('0x30')](_0x4370db[_0xb669('0x2e')],function(_0x804648){return _0x804648['name_value_list'][_0xb669('0x38')][_0xb669('0x35')]===_0xc95d3b;});if(_0x41119d){logger[_0xb669('0xd')]('Enduser\x20found!');return BPromise[_0xb669('0x31')]({'id':_0x41119d[_0xb669('0x32')]['id'][_0xb669('0x35')],'name':_0x41119d['name_value_list'][_0xb669('0x2c')]['value'],'phone':_0x41119d['name_value_list'][_0xb669('0x38')]['value']});}}else{logger[_0xb669('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xb669('0x39'),'input_type':_0xb669('0x20'),'response_type':_0xb669('0x20'),'rest_data':JSON['stringify']({'session':_0x591dda['id'],'module_name':_0xb669('0x19'),'name_value_list':[{'name':_0xb669('0x3a'),'value':_0x4657fe!==_0xb669('0x3b')?_0x4657fe:util[_0xb669('0x2a')](_0xb669('0x3c'),_0xc95d3b)},{'name':_0xb669('0x38'),'value':_0xc95d3b}]})}})[_0xb669('0x3d')](function(_0x208bfa){logger[_0xb669('0xd')](_0xb669('0x3e'));return BPromise[_0xb669('0x31')]({'id':_0x208bfa['id'],'name':_0x208bfa[_0xb669('0x2e')][_0xb669('0x3a')][_0xb669('0x35')],'phone':_0x208bfa[_0xb669('0x2e')][_0xb669('0x38')]['value']});});}});}function request(_0x2a0974){logger[_0xb669('0x3f')](_0xb669('0x40'),JSON[_0xb669('0x21')](_0x2a0974));return rp(_['merge'](def,_0x2a0974));}function getTags(_0x160f65,_0x3dd3a2){var _0x317f42=[];if(_0x160f65&&_0x160f65[_0xb669('0x2f')]>0x0){_0x317f42=_[_0xb669('0x41')](_0x160f65,_0x3dd3a2);}return _0x317f42;}function getCustomFields(_0x4dd5ae,_0x5cd696){var _0xe20593=[];var _0x4c6451={'custom_fields':[]};if(_0x4dd5ae[_0xb669('0x2f')]>0x0){_[_0xb669('0x1c')](_0x4dd5ae,function(_0x1960cb){if(_0x1960cb[_0xb669('0x42')]==='string'&&_0x1960cb[_0xb669('0x43')]&&!_0x1960cb[_0xb669('0x44')]){_0x4c6451[_0x1960cb[_0xb669('0x43')]['toLowerCase']()]=_0x1960cb[_0xb669('0x45')][_0xb669('0x24')]();}else if(_0x1960cb[_0xb669('0x42')]===_0xb669('0x46')&&_0x1960cb[_0xb669('0x1f')]&&_0x1960cb[_0xb669('0x44')]){_0x4c6451['custom_fields'][_0xb669('0x1e')]({'id':_0x1960cb[_0xb669('0x1f')],'value':_0x1960cb[_0xb669('0x45')][_0xb669('0x24')]()});}else if(_0x1960cb[_0xb669('0x42')]===_0xb669('0x47')&&_0x1960cb[_0xb669('0x1d')]&&_0x1960cb[_0xb669('0x1f')]&&_0x1960cb[_0xb669('0x44')]){_0x5cd696[_0x1960cb[_0xb669('0x1d')]]&&_0x4c6451[_0xb669('0x48')][_0xb669('0x1e')]({'id':_0x1960cb[_0xb669('0x1f')],'value':_0x5cd696[_0x1960cb['variableName']][_0xb669('0x24')]()});}else if(_0x1960cb[_0xb669('0x42')]==='customVariable'&&_0x1960cb[_0xb669('0x49')]&&_0x1960cb[_0xb669('0x49')]['name']&&_0x1960cb[_0xb669('0x1f')]&&_0x1960cb[_0xb669('0x44')]){_0x5cd696[_0x1960cb[_0xb669('0x49')][_0xb669('0x2c')][_0xb669('0x4a')]()]&&_0x4c6451['custom_fields'][_0xb669('0x1e')]({'id':_0x1960cb[_0xb669('0x1f')],'value':_0x5cd696[_0x1960cb['Variable'][_0xb669('0x2c')][_0xb669('0x4a')]()][_0xb669('0x24')]()});}});}return _0x4c6451;}function getConnection(_0x2bc5ef){return request({'method':'POST','form':{'method':'login','input_type':_0xb669('0x20'),'response_type':'JSON','rest_data':JSON[_0xb669('0x21')]({'user_auth':{'user_name':_0x2bc5ef['username'],'password':_0x2bc5ef['password'],'encryption':'PLAIN'},'application':_0xb669('0x4b')})}})[_0xb669('0x3d')](function(_0x406a9c){var _0x266b1e=_0x406a9c;if(_0x266b1e['id']){def[_0xb669('0x4c')]=_0x266b1e['id'];return BPromise['resolve'](_0x266b1e);}else{throw new Error(util[_0xb669('0x2a')](_0xb669('0x4d'),_0x2bc5ef['id']));}});}function setRelationship(_0x12b116,_0x330cd8,_0x447f30,_0x56186e){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x12b116['id'],'module_name':'Calls','module_id':_0x447f30['id'],'link_field_name':_0x56186e,'related_ids':[_0x330cd8['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xb669('0x4e')]=function(_0x279c26,_0x2697ce,_0x54fb54,_0xacdbf8,_0xf85d94,_0x5228ac){var _0x206f40,_0x599b2f,_0x1eb8c5,_0x3b7439;_0x5228ac[_0xb669('0x4f')]=intUtil[_0xb669('0x50')](_0x5228ac[_0xb669('0x4f')]);_0x5228ac['serverUrl']=intUtil[_0xb669('0x50')](_0x5228ac[_0xb669('0x51')]);def[_0xb669('0x52')]=util[_0xb669('0x2a')](_0xb669('0x53'),_0x5228ac[_0xb669('0x4f')]);if(_0xf85d94&&_0xf85d94[_0xb669('0x54')]){logger[_0xb669('0xd')](_0xb669('0x55'),_0xb669('0x56'));_0x2697ce['recordingURL']=util[_0xb669('0x2a')](_0xb669('0x57'),_0x5228ac['serverUrl'],_0x2697ce[_0xb669('0x58')],md5(_0x2697ce[_0xb669('0x58')]));}else{_0x2697ce[_0xb669('0x59')]='';}return getConnection(_0x5228ac)['then'](function(_0x38f0d7){_0x3b7439=_0x38f0d7;return getUser(_0x5228ac,_0xacdbf8['name'],_0x3b7439);})['then'](function(_0x25876b){_0x206f40=_0x25876b;logger[_0xb669('0xd')]('The\x20User\x20ID\x20is:',_0x206f40['id']);return getEndUser(_0x5228ac,_0x2697ce[_0xb669('0x5a')],_0x2697ce['calleridnum'],_0x3b7439);})[_0xb669('0x3d')](function(_0x333449){_0x599b2f=_0x333449;logger['info'](_0xb669('0x5b'),_0x599b2f['id']);return getTicket(_0x5228ac,_0x206f40,_0x599b2f,_0x54fb54,_0x2697ce,_0x54fb54[_0xb669('0x5c')],_0x3b7439,_0xb669('0x5d'));})[_0xb669('0x3d')](function(_0x4579a0){_0x1eb8c5=_0x4579a0;logger['info'](_0xb669('0x5e'));logger[_0xb669('0xd')](_0xb669('0x5f'),_0x1eb8c5['id']);return setRelationship(_0x3b7439,_0x206f40,_0x1eb8c5,_0xb669('0x60'));})['then'](function(){return setRelationship(_0x3b7439,_0x599b2f,_0x1eb8c5,_0xb669('0x61'));})['then'](function(){return getServerInfo(_0x3b7439);})[_0xb669('0x3d')](function(_0x1309bc){var _0x4f6d6e=parseInt(_0x1309bc[_0xb669('0x62')][_0xb669('0x63')](0x0));var _0x342a8a=util[_0xb669('0x2a')](_0xb669('0x64'),_0x5228ac[_0xb669('0x4f')],_0x1eb8c5['id']);if(_0x4f6d6e>0x6){_0x342a8a=util[_0xb669('0x2a')](_0xb669('0x65'),_0x5228ac['remoteUri'],_0x1eb8c5['id']);}logger['info'](_0xb669('0x55'),_0xb669('0x66'));emit(util[_0xb669('0x2a')](_0xb669('0x67'),_0xacdbf8[_0xb669('0x2c')]),_0xb669('0x68'),{'uri':_0x342a8a});})[_0xb669('0x69')](function(_0x1350ee){logger[_0xb669('0x6a')](_0xb669('0x55'),JSON[_0xb669('0x21')](_0x1350ee));});};exports[_0xb669('0x6b')]=function(_0x7b0dea,_0x267df6,_0x3bce56,_0x2a0c5c,_0x2f3296,_0x1127e3,_0x2ed693){var _0x29bfda,_0x3262c9,_0x5ad57e,_0x4c6447;_0x1127e3['remoteUri']=intUtil[_0xb669('0x50')](_0x1127e3['remoteUri']);_0x1127e3[_0xb669('0x51')]=intUtil[_0xb669('0x50')](_0x1127e3[_0xb669('0x51')]);def[_0xb669('0x52')]=util['format'](_0xb669('0x53'),_0x1127e3[_0xb669('0x4f')]);if(_0x2ed693&&_0x2ed693[_0xb669('0x6c')]&&_0x2ed693[_0xb669('0x6c')]!==_0xb669('0x6d')){logger[_0xb669('0xd')](_0xb669('0x6e'),_0xb669('0x56'));_0x267df6[_0xb669('0x59')]=util['format'](_0xb669('0x57'),_0x1127e3[_0xb669('0x51')],_0x267df6[_0xb669('0x58')],md5(_0x267df6[_0xb669('0x58')]));}return getConnection(_0x1127e3)[_0xb669('0x3d')](function(_0x22bde8){_0x4c6447=_0x22bde8;return getUser(_0x1127e3,_0x2a0c5c[_0xb669('0x2c')],_0x4c6447);})[_0xb669('0x3d')](function(_0x1cc9a1){_0x29bfda=_0x1cc9a1;logger['info'](_0xb669('0x6f'),_0x29bfda['id']);return getEndUser(_0x1127e3,_0x267df6['destcalleridname'],_0x267df6[_0xb669('0x70')],_0x4c6447);})[_0xb669('0x3d')](function(_0x3341ec){_0x3262c9=_0x3341ec;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3262c9['id']);return getTicket(_0x1127e3,_0x29bfda,_0x3262c9,_0x3bce56,_0x267df6,_0x3bce56[_0xb669('0x5c')],_0x4c6447,_0xb669('0x71'));})[_0xb669('0x3d')](function(_0x5ed4e3){_0x5ad57e=_0x5ed4e3;logger[_0xb669('0xd')](_0xb669('0x5e'));logger[_0xb669('0xd')](_0xb669('0x5f'),_0x5ad57e['id']);return setRelationship(_0x4c6447,_0x29bfda,_0x5ad57e,'users');})[_0xb669('0x3d')](function(){return setRelationship(_0x4c6447,_0x3262c9,_0x5ad57e,'contacts');})[_0xb669('0x3d')](function(){return getServerInfo(_0x4c6447);})[_0xb669('0x3d')](function(_0x126d42){var _0x32cfc4=parseInt(_0x126d42[_0xb669('0x62')][_0xb669('0x63')](0x0));var _0x2a7efc=util[_0xb669('0x2a')](_0xb669('0x64'),_0x1127e3[_0xb669('0x4f')],_0x5ad57e['id']);if(_0x32cfc4>0x6){_0x2a7efc=util[_0xb669('0x2a')](_0xb669('0x65'),_0x1127e3['remoteUri'],_0x5ad57e['id']);}logger['info'](_0xb669('0x6e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb669('0x2a')]('user:%s',_0x2a0c5c[_0xb669('0x2c')]),'trigger:browser:url',{'uri':_0x2a7efc});})[_0xb669('0x69')](function(_0x17c40b){logger[_0xb669('0x6a')](_0xb669('0x6e'),JSON[_0xb669('0x21')](_0x17c40b));});};exports[_0xb669('0x72')]=function(_0x32bc4f,_0x1aa7b4,_0x4a9e15,_0x241235,_0xd14ac1,_0x129ff8){var _0xa3d47d,_0x2f85b8,_0x393199,_0x103529;_0x129ff8[_0xb669('0x4f')]=intUtil[_0xb669('0x50')](_0x129ff8[_0xb669('0x4f')]);_0x129ff8[_0xb669('0x51')]=intUtil['stripTrailingSlash'](_0x129ff8[_0xb669('0x51')]);def[_0xb669('0x52')]=util[_0xb669('0x2a')](_0xb669('0x53'),_0x129ff8[_0xb669('0x4f')]);if(_0xd14ac1&&_0xd14ac1['monitor_format']){logger[_0xb669('0xd')]('['+_0x1aa7b4['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1aa7b4[_0xb669('0x59')]=util[_0xb669('0x2a')](_0xb669('0x57'),_0x129ff8[_0xb669('0x51')],_0x1aa7b4[_0xb669('0x58')],md5(_0x1aa7b4[_0xb669('0x58')]));}else{_0x1aa7b4[_0xb669('0x59')]='';}return getConnection(_0x129ff8)['then'](function(_0x33dc50){_0x103529=_0x33dc50;if(!_[_0xb669('0x73')](_0x241235)){return getUser(_0x129ff8,_0x241235[_0xb669('0x2c')],_0x103529);}else{return getUser(_0x129ff8,null,_0x103529);}})[_0xb669('0x3d')](function(_0x20f7f6){_0xa3d47d=_0x20f7f6;logger[_0xb669('0xd')](_0xb669('0x6f'),_0xa3d47d['id']);return getEndUser(_0x129ff8,_0x1aa7b4[_0xb669('0x5a')],_0x1aa7b4['calleridnum'],_0x103529);})['then'](function(_0x400dd0){_0x2f85b8=_0x400dd0;logger['info'](_0xb669('0x5b'),_0x2f85b8['id']);return getTicket(_0x129ff8,_0xa3d47d,_0x2f85b8,_0x4a9e15,_0x1aa7b4,_0x4a9e15[_0xb669('0x5c')],_0x103529,_0xb669('0x5d'));})[_0xb669('0x3d')](function(_0x432fdf){_0x393199=_0x432fdf;logger[_0xb669('0xd')]('Ticket\x20created!');logger[_0xb669('0xd')](_0xb669('0x5f'),_0x393199['id']);return setRelationship(_0x103529,_0xa3d47d,_0x393199,_0xb669('0x60'));})['then'](function(){return setRelationship(_0x103529,_0x2f85b8,_0x393199,_0xb669('0x61'));})[_0xb669('0x3d')](function(){return getServerInfo(_0x103529);})[_0xb669('0x69')](function(_0x10f464){logger[_0xb669('0x6a')]('['+_0x1aa7b4[_0xb669('0x74')][_0xb669('0x75')]()+']',JSON[_0xb669('0x21')](_0x10f464));});}; \ 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 3029c58..6e34f68 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 _0x7db2=['substring','lastIndexOf','isNil','test','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','%s:\x20%s','keyContent','format','key','join','stripTrailingSlash','slice'];(function(_0x51dcbc,_0x7dabfd){var _0x4ad2e2=function(_0x47b2d4){while(--_0x47b2d4){_0x51dcbc['push'](_0x51dcbc['shift']());}};_0x4ad2e2(++_0x7dabfd);}(_0x7db2,0x154));var _0x27db=function(_0xaa7b4e,_0x40912f){_0xaa7b4e=_0xaa7b4e-0x0;var _0x561494=_0x7db2[_0xaa7b4e];return _0x561494;};'use strict';var _=require(_0x27db('0x0'));var util=require(_0x27db('0x1'));exports[_0x27db('0x2')]=function(_0x5ac347,_0x2b0bbf,_0x6af3ac){var _0x96132a=[];if(_0x5ac347[_0x27db('0x3')]>0x0){var _0x374a59=_[_0x27db('0x4')](_0x5ac347,['id']);for(var _0x307bc8=0x0;_0x307bc8<_0x374a59[_0x27db('0x3')];_0x307bc8++){var _0x2783a8=_0x374a59[_0x307bc8];if(_0x2783a8[_0x27db('0x5')]===_0x27db('0x6')){_0x96132a[_0x27db('0x7')](_0x2783a8['content']);}else if(_0x2783a8[_0x27db('0x5')]===_0x27db('0x8')&&_0x2783a8[_0x27db('0x9')]){_0x2b0bbf[_0x2783a8['variableName']]&&_0x96132a[_0x27db('0x7')](_0x2b0bbf[_0x2783a8[_0x27db('0x9')]][_0x27db('0xa')]());}else if(_0x2783a8[_0x27db('0x5')]===_0x27db('0xb')&&_0x2783a8['Variable']&&_0x2783a8[_0x27db('0xc')][_0x27db('0xd')]){_0x2b0bbf[_0x2783a8[_0x27db('0xc')][_0x27db('0xd')][_0x27db('0xe')]()]&&_0x96132a[_0x27db('0x7')](_0x2b0bbf[_0x2783a8[_0x27db('0xc')][_0x27db('0xd')][_0x27db('0xe')]()][_0x27db('0xa')]());}else if(_0x2783a8[_0x27db('0x5')]===_0x27db('0xf')){if(_0x2783a8[_0x27db('0x10')]==='string'&&_0x2783a8['key']){_0x96132a[_0x27db('0x7')](util['format'](_0x27db('0x11'),_0x2783a8['key'],_0x2783a8[_0x27db('0x12')]));}else if(_0x2783a8[_0x27db('0x10')]===_0x27db('0x8')&&_0x2783a8[_0x27db('0x9')]&&_0x2783a8['key']){_0x2b0bbf[_0x2783a8[_0x27db('0x9')]]&&_0x96132a[_0x27db('0x7')](util[_0x27db('0x13')](_0x27db('0x11'),_0x2783a8[_0x27db('0x14')],_0x2b0bbf[_0x2783a8[_0x27db('0x9')]]));}else if(_0x2783a8['keyType']===_0x27db('0xb')&&_0x2783a8[_0x27db('0xc')]&&_0x2783a8[_0x27db('0xc')][_0x27db('0xd')]&&_0x2783a8[_0x27db('0x14')]){_0x2b0bbf[_0x2783a8[_0x27db('0xc')][_0x27db('0xd')][_0x27db('0xe')]()]&&_0x96132a[_0x27db('0x7')](util[_0x27db('0x13')](_0x27db('0x11'),_0x2783a8[_0x27db('0x14')],_0x2b0bbf[_0x2783a8['Variable'][_0x27db('0xd')][_0x27db('0xe')]()]));}}}}return _0x96132a[_0x27db('0x15')](_0x6af3ac);};exports[_0x27db('0x16')]=function(_0x250b07){var _0x4746dd=_0x250b07[_0x27db('0x17')](-0x1);if(_0x4746dd==='/'){_0x250b07=_0x250b07[_0x27db('0x18')](0x0,_0x250b07[_0x27db('0x19')](_0x4746dd));}return _0x250b07;};exports['validateEmail']=function(_0x2c322e){if(!_[_0x27db('0x1a')](_0x2c322e)&&_0x2c322e!==''){var _0x38773e=/^(([^<>()\[\]\\.,;:\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 _0x38773e[_0x27db('0x1b')](String(_0x2c322e)[_0x27db('0xe')]());}else{return![];}}; \ No newline at end of file +var _0xc775=['slice','substring','lastIndexOf','isNil','test','util','getString','length','sortBy','string','type','variable','variableName','push','customVariable','Variable','name','toLowerCase','toString','keyValue','key','format','keyType','%s:\x20%s','join','stripTrailingSlash'];(function(_0x154aae,_0x1ea106){var _0x33ebfa=function(_0x56f935){while(--_0x56f935){_0x154aae['push'](_0x154aae['shift']());}};_0x33ebfa(++_0x1ea106);}(_0xc775,0xef));var _0x5c77=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc775[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x5c77('0x0'));exports[_0x5c77('0x1')]=function(_0x2659b7,_0x51ad12,_0x4432d1){var _0x54cc4e=[];if(_0x2659b7[_0x5c77('0x2')]>0x0){var _0x49bc3f=_[_0x5c77('0x3')](_0x2659b7,['id']);for(var _0x167dff=0x0;_0x167dff<_0x49bc3f[_0x5c77('0x2')];_0x167dff++){var _0x4c0c42=_0x49bc3f[_0x167dff];if(_0x4c0c42['type']===_0x5c77('0x4')){_0x54cc4e['push'](_0x4c0c42['content']);}else if(_0x4c0c42[_0x5c77('0x5')]===_0x5c77('0x6')&&_0x4c0c42['variableName']){_0x51ad12[_0x4c0c42[_0x5c77('0x7')]]&&_0x54cc4e[_0x5c77('0x8')](_0x51ad12[_0x4c0c42[_0x5c77('0x7')]]['toString']());}else if(_0x4c0c42[_0x5c77('0x5')]===_0x5c77('0x9')&&_0x4c0c42[_0x5c77('0xa')]&&_0x4c0c42[_0x5c77('0xa')][_0x5c77('0xb')]){_0x51ad12[_0x4c0c42[_0x5c77('0xa')][_0x5c77('0xb')]['toLowerCase']()]&&_0x54cc4e['push'](_0x51ad12[_0x4c0c42[_0x5c77('0xa')][_0x5c77('0xb')][_0x5c77('0xc')]()][_0x5c77('0xd')]());}else if(_0x4c0c42[_0x5c77('0x5')]===_0x5c77('0xe')){if(_0x4c0c42['keyType']===_0x5c77('0x4')&&_0x4c0c42[_0x5c77('0xf')]){_0x54cc4e[_0x5c77('0x8')](util[_0x5c77('0x10')]('%s:\x20%s',_0x4c0c42[_0x5c77('0xf')],_0x4c0c42['keyContent']));}else if(_0x4c0c42[_0x5c77('0x11')]===_0x5c77('0x6')&&_0x4c0c42[_0x5c77('0x7')]&&_0x4c0c42[_0x5c77('0xf')]){_0x51ad12[_0x4c0c42['variableName']]&&_0x54cc4e['push'](util[_0x5c77('0x10')]('%s:\x20%s',_0x4c0c42[_0x5c77('0xf')],_0x51ad12[_0x4c0c42[_0x5c77('0x7')]]));}else if(_0x4c0c42[_0x5c77('0x11')]===_0x5c77('0x9')&&_0x4c0c42[_0x5c77('0xa')]&&_0x4c0c42[_0x5c77('0xa')]['name']&&_0x4c0c42[_0x5c77('0xf')]){_0x51ad12[_0x4c0c42[_0x5c77('0xa')][_0x5c77('0xb')]['toLowerCase']()]&&_0x54cc4e[_0x5c77('0x8')](util[_0x5c77('0x10')](_0x5c77('0x12'),_0x4c0c42['key'],_0x51ad12[_0x4c0c42[_0x5c77('0xa')][_0x5c77('0xb')][_0x5c77('0xc')]()]));}}}}return _0x54cc4e[_0x5c77('0x13')](_0x4432d1);};exports[_0x5c77('0x14')]=function(_0x29f248){var _0x2f60e2=_0x29f248[_0x5c77('0x15')](-0x1);if(_0x2f60e2==='/'){_0x29f248=_0x29f248[_0x5c77('0x16')](0x0,_0x29f248[_0x5c77('0x17')](_0x2f60e2));}return _0x29f248;};exports['validateEmail']=function(_0x4ede50){if(!_[_0x5c77('0x18')](_0x4ede50)&&_0x4ede50!==''){var _0x962042=/^(([^<>()\[\]\\.,;:\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 _0x962042[_0x5c77('0x19')](String(_0x4ede50)[_0x5c77('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 84fed9e..837afce 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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0xddfbc6,_0x1e1f7f){var _0x28a264=function(_0x2c5a28){while(--_0x2c5a28){_0xddfbc6['push'](_0xddfbc6['shift']());}};_0x28a264(++_0x1e1f7f);}(_0x34e8,0x12c));var _0x834e=function(_0x5a8582,_0x4515a3){_0x5a8582=_0x5a8582-0x0;var _0x55073e=_0x34e8[_0x5a8582];return _0x55073e;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x3ed720,_0x478e3d){var _0x257fcb=function(_0x3a96b6){while(--_0x3a96b6){_0x3ed720['push'](_0x3ed720['shift']());}};_0x257fcb(++_0x478e3d);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index a540743..2625f43 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 _0xf92d=['newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','Recording\x20is\x20enabled!','Authorization','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','username','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','picklist','type','customField','toLowerCase','content','includes','idField','custom_fields','variable','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...'];(function(_0x3a347b,_0x5a9a7a){var _0x12cd00=function(_0x877674){while(--_0x877674){_0x3a347b['push'](_0x3a347b['shift']());}};_0x12cd00(++_0x5a9a7a);}(_0xf92d,0xec));var _0xdf92=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xf92d[_0xc77819];return _0x1c9434;};'use strict';var _=require(_0xdf92('0x0'));var rp=require('request-promise');var md5=require(_0xdf92('0x1'));var util=require(_0xdf92('0x2'));var Redis=require(_0xdf92('0x3'));var intUtil=require(_0xdf92('0x4'));var config=require(_0xdf92('0x5'));var logger=require('../../../../config/logger')('zendesk');config[_0xdf92('0x6')]=_[_0xdf92('0x7')](config[_0xdf92('0x6')],{'host':_0xdf92('0x8'),'port':0x18eb});var io=require(_0xdf92('0x9'))(new Redis(config['redis']));function emit(_0x5e0dc6,_0x4d665a,_0x39592f){io['to'](_0x5e0dc6)[_0xdf92('0xa')](_0x4d665a,_0x39592f);}var headers={'Content-Type':_0xdf92('0xb'),'Accept':_0xdf92('0xb')};function getTicket(_0x391d04,_0x5a75db,_0x5e0bd0,_0x19c0aa,_0x6556ea){logger[_0xdf92('0xc')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xdf92('0xd')]('%s/tickets.json',_0x391d04[_0xdf92('0xe')]),'method':_0xdf92('0xf'),'body':{'ticket':_[_0xdf92('0x10')]({'requester_id':_0x5e0bd0['id'],'submitter_id':_0x5a75db?_0x5a75db['id']:undefined,'assignee_id':_0x5a75db?_0x5a75db['id']:undefined,'tags':getTags(_0x19c0aa[_0xdf92('0x11')],'name'),'subject':intUtil[_0xdf92('0x12')](_0x19c0aa[_0xdf92('0x13')],_0x6556ea,'\x20'),'description':intUtil[_0xdf92('0x12')](_0x19c0aa[_0xdf92('0x14')],_0x6556ea,'\x0a'),'comment':{'public':![],'body':intUtil[_0xdf92('0x12')](_0x19c0aa['Descriptions'],_0x6556ea,'\x0a')}},getCustomFields(_0x19c0aa['Fields'],_0x6556ea))}})[_0xdf92('0x15')](function(_0x24d054){logger[_0xdf92('0xc')](_0xdf92('0x16'));return _0x24d054[_0xdf92('0x17')];});}function getUser(_0x20e706,_0x323771){if(intUtil['validateEmail'](_0x323771)){logger[_0xdf92('0xc')](_0xdf92('0x18'),_0x323771);return request({'uri':util['format'](_0xdf92('0x19'),_0x20e706['remoteUri']),'qs':{'query':util[_0xdf92('0xd')](_0xdf92('0x1a'),_0x323771)}})[_0xdf92('0x15')](function(_0x4e217b){if(_0x4e217b[_0xdf92('0x1b')]){logger[_0xdf92('0xc')](_0xdf92('0x1c'));return _['find'](_0x4e217b[_0xdf92('0x1d')],{'email':_0x323771,'role':_0xdf92('0x1e')});}else{logger[_0xdf92('0xc')](_0xdf92('0x1f'));return request({'uri':util[_0xdf92('0xd')](_0xdf92('0x20'),_0x20e706['remoteUri'])})[_0xdf92('0x15')](function(_0x891582){logger[_0xdf92('0xc')](_0xdf92('0x21'));return _0x891582[_0xdf92('0x22')];});}});}else{logger[_0xdf92('0xc')](_0xdf92('0x1f'));return request({'uri':util[_0xdf92('0xd')](_0xdf92('0x20'),_0x20e706['remoteUri'])})[_0xdf92('0x15')](function(_0x593088){logger[_0xdf92('0xc')](_0xdf92('0x21'));return _0x593088[_0xdf92('0x22')];});}}function getEndUser(_0x58ea45,_0x4ff0a6,_0x4bde55){logger['info'](_0xdf92('0x23'),_0x4bde55);return request({'uri':util['format'](_0xdf92('0x19'),_0x58ea45[_0xdf92('0xe')]),'qs':{'query':util[_0xdf92('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x4bde55)}})[_0xdf92('0x15')](function(_0x130711){var _0x181608;if(_0x130711['results'][_0xdf92('0x24')]){_0x130711[_0xdf92('0x1d')]=_[_0xdf92('0x25')](_0x130711[_0xdf92('0x1d')],{'suspended':![],'role':_0xdf92('0x26')});if(_0x130711[_0xdf92('0x1d')][_0xdf92('0x24')]){_0x181608=_['first'](_0x130711[_0xdf92('0x1d')]);}}if(_0x181608){logger[_0xdf92('0xc')](_0xdf92('0x27'));return _0x181608;}else{logger[_0xdf92('0xc')](_0xdf92('0x28'));return request({'uri':util[_0xdf92('0xd')](_0xdf92('0x29'),_0x58ea45[_0xdf92('0xe')]),'method':_0xdf92('0xf'),'body':{'user':{'role':'end-user','name':util[_0xdf92('0xd')](_0xdf92('0x2a'),_0x4ff0a6||_0x4bde55),'phone':_0x4bde55}}})['then'](function(_0x3fee08){logger[_0xdf92('0xc')]('Enduser\x20created.');return _0x3fee08[_0xdf92('0x22')];});}});}function getAuth(_0x59fc5f){var _0xb3ccad;if(_0x59fc5f['authType']==='password'){_0xb3ccad=util['format']('%s:%s',_0x59fc5f[_0xdf92('0x2b')],_0x59fc5f['password']);}else if(_0x59fc5f['authType']==='token'){_0xb3ccad=util[_0xdf92('0xd')](_0xdf92('0x2c'),_0x59fc5f[_0xdf92('0x2b')],_0x59fc5f[_0xdf92('0x2d')]);}return util[_0xdf92('0xd')](_0xdf92('0x2e'),new Buffer(_0xb3ccad)[_0xdf92('0x2f')](_0xdf92('0x30')));}function request(_0x151326){logger[_0xdf92('0x31')](_0xdf92('0x32'),JSON[_0xdf92('0x33')](_0x151326));return rp(_[_0xdf92('0x7')](_0x151326,{'method':_0xdf92('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x252f19,_0x71a33){var _0x53dcce=[];if(_0x252f19&&_0x252f19[_0xdf92('0x24')]>0x0){_0x53dcce=_[_0xdf92('0x35')](_0x252f19,_0x71a33);}return _0x53dcce;}function getCustomFields(_0x221abe,_0x5c6251){var _0x5f0e9a=[];var _0x3f0915={'custom_fields':[]};if(_0x221abe['length']>0x0){_['forEach'](_0x221abe,function(_0x5166f3){if(_['includes'](['string',_0xdf92('0x36')],_0x5166f3[_0xdf92('0x37')])&&_0x5166f3['nameField']&&!_0x5166f3[_0xdf92('0x38')]){_0x3f0915[_0x5166f3['nameField'][_0xdf92('0x39')]()]=_0x5166f3[_0xdf92('0x3a')][_0xdf92('0x2f')]();}else if(_[_0xdf92('0x3b')](['string',_0xdf92('0x36')],_0x5166f3['type'])&&_0x5166f3[_0xdf92('0x3c')]&&_0x5166f3[_0xdf92('0x38')]){_0x3f0915[_0xdf92('0x3d')]['push']({'id':_0x5166f3[_0xdf92('0x3c')],'value':_0x5166f3[_0xdf92('0x3a')][_0xdf92('0x2f')]()});}else if(_0x5166f3[_0xdf92('0x37')]===_0xdf92('0x3e')&&_0x5166f3[_0xdf92('0x3f')]&&_0x5166f3[_0xdf92('0x3c')]&&_0x5166f3[_0xdf92('0x38')]){_0x5c6251[_0x5166f3[_0xdf92('0x3f')]]&&_0x3f0915[_0xdf92('0x3d')][_0xdf92('0x40')]({'id':_0x5166f3[_0xdf92('0x3c')],'value':_0x5c6251[_0x5166f3[_0xdf92('0x3f')]]['toString']()});}else if(_0x5166f3[_0xdf92('0x37')]===_0xdf92('0x41')&&_0x5166f3[_0xdf92('0x42')]&&_0x5166f3[_0xdf92('0x42')][_0xdf92('0x43')]&&_0x5166f3[_0xdf92('0x3c')]&&_0x5166f3['customField']){_0x5c6251[_0x5166f3[_0xdf92('0x42')][_0xdf92('0x43')][_0xdf92('0x39')]()]&&_0x3f0915[_0xdf92('0x3d')][_0xdf92('0x40')]({'id':_0x5166f3[_0xdf92('0x3c')],'value':_0x5c6251[_0x5166f3[_0xdf92('0x42')][_0xdf92('0x43')][_0xdf92('0x39')]()]['toString']()});}});}return _0x3f0915;}exports[_0xdf92('0x44')]=function(_0x1b7759,_0x213991,_0x336742,_0x1fa629,_0x588aed,_0x4e1fd5){var _0x44a027,_0x3938eb;_0x4e1fd5[_0xdf92('0xe')]=intUtil[_0xdf92('0x45')](_0x4e1fd5['remoteUri']);_0x4e1fd5[_0xdf92('0x46')]=intUtil[_0xdf92('0x45')](_0x4e1fd5[_0xdf92('0x46')]);if(_0x588aed&&_0x588aed[_0xdf92('0x47')]){logger[_0xdf92('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x213991[_0xdf92('0x48')]=util[_0xdf92('0xd')](_0xdf92('0x49'),_0x4e1fd5[_0xdf92('0x46')],_0x213991[_0xdf92('0x4a')],md5(_0x213991[_0xdf92('0x4a')]));}else{_0x213991[_0xdf92('0x48')]='';}headers['Authorization']=getAuth(_0x4e1fd5);return getUser(_0x4e1fd5,_0x1fa629[_0xdf92('0x4b')])[_0xdf92('0x15')](function(_0x29b9b2){_0x44a027=_0x29b9b2;logger[_0xdf92('0xc')](_0xdf92('0x4c'),_0x44a027['id']);return getEndUser(_0x4e1fd5,_0x213991[_0xdf92('0x4d')],_0x213991['calleridnum']);})[_0xdf92('0x15')](function(_0x4a7627){_0x3938eb=_0x4a7627;logger['info'](_0xdf92('0x4e'),_0x3938eb['id']);return getTicket(_0x4e1fd5,_0x44a027,_0x3938eb,_0x336742,_0x213991);})[_0xdf92('0x15')](function(_0x4c20c4){if(_0x4c20c4){logger[_0xdf92('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4c20c4['id']);switch(_0x4e1fd5['type']){case _0xdf92('0x4f'):logger['info'](_0xdf92('0x50'),_0xdf92('0x51'));return request({'uri':util[_0xdf92('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4e1fd5['remoteUri'],_0x44a027['id'],_0x4c20c4['id']),'method':_0xdf92('0xf')});case _0xdf92('0x52'):logger['info'](_0xdf92('0x50'),_0xdf92('0x53'));emit(util[_0xdf92('0xd')](_0xdf92('0x54'),_0x1fa629[_0xdf92('0x43')]),_0xdf92('0x55'),{'uri':util[_0xdf92('0xd')](_0xdf92('0x56'),_0x4e1fd5[_0xdf92('0xe')]['replace'](_0xdf92('0x57'),''),_0x4c20c4['id'])});break;default:logger[_0xdf92('0x58')](_0xdf92('0x50'),_0xdf92('0x59'));}}})[_0xdf92('0x5a')](function(_0x327f6e){logger[_0xdf92('0x58')](_0xdf92('0x5b'),util[_0xdf92('0x5c')](_0x327f6e,{'showHidden':!![],'depth':null}));});};exports[_0xdf92('0x5d')]=function(_0x329bb5,_0x2ee7f7,_0xc9996c,_0xc41ac3,_0x23dffa,_0x41018c,_0x4734d6){var _0x113aae,_0x1631b3;_0x41018c[_0xdf92('0xe')]=intUtil[_0xdf92('0x45')](_0x41018c[_0xdf92('0xe')]);_0x41018c[_0xdf92('0x46')]=intUtil['stripTrailingSlash'](_0x41018c[_0xdf92('0x46')]);if(_0x4734d6&&_0x4734d6[_0xdf92('0x5e')]&&_0x4734d6[_0xdf92('0x5e')]!==_0xdf92('0x5f')){logger['info'](_0xdf92('0x60'),'Recording\x20is\x20enabled!');_0x2ee7f7['recordingURL']=util['format'](_0xdf92('0x49'),_0x41018c[_0xdf92('0x46')],_0x2ee7f7['uniqueid'],md5(_0x2ee7f7[_0xdf92('0x4a')]));}headers['Authorization']=getAuth(_0x41018c);return getUser(_0x41018c,_0xc41ac3[_0xdf92('0x4b')])[_0xdf92('0x15')](function(_0x317e89){_0x113aae=_0x317e89;logger[_0xdf92('0xc')](_0xdf92('0x4c'),_0x113aae['id']);return getEndUser(_0x41018c,_0x2ee7f7[_0xdf92('0x61')],_0x2ee7f7['destcalleridnum']);})[_0xdf92('0x15')](function(_0x425e93){_0x1631b3=_0x425e93;logger[_0xdf92('0xc')](_0xdf92('0x4e'),_0x1631b3['id']);return getTicket(_0x41018c,_0x113aae,_0x1631b3,_0xc9996c,_0x2ee7f7);})[_0xdf92('0x15')](function(_0x4666d0){if(_0x4666d0){logger[_0xdf92('0xc')]('The\x20Ticket\x20ID\x20is:',_0x4666d0['id']);switch(_0x41018c[_0xdf92('0x37')]){case _0xdf92('0x4f'):logger['info'](_0xdf92('0x60'),_0xdf92('0x51'));return request({'uri':util[_0xdf92('0xd')](_0xdf92('0x62'),_0x41018c['remoteUri'],_0x113aae['id'],_0x4666d0['id']),'method':_0xdf92('0xf')});case _0xdf92('0x52'):logger[_0xdf92('0xc')](_0xdf92('0x60'),_0xdf92('0x53'));emit(util[_0xdf92('0xd')](_0xdf92('0x54'),_0xc41ac3[_0xdf92('0x43')]),_0xdf92('0x55'),{'uri':util[_0xdf92('0xd')](_0xdf92('0x56'),_0x41018c[_0xdf92('0xe')]['replace'](_0xdf92('0x57'),''),_0x4666d0['id'])});break;default:logger[_0xdf92('0x58')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xdf92('0x5a')](function(_0x564d1c){logger[_0xdf92('0x58')](_0xdf92('0x63'),util['inspect'](_0x564d1c,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1e73d0,_0x5b817b,_0x21bfae,_0x5200bf,_0x2c4b3d,_0x106282){var _0x39d3bb,_0x517dc1;_0x106282['remoteUri']=intUtil['stripTrailingSlash'](_0x106282[_0xdf92('0xe')]);_0x106282['serverUrl']=intUtil['stripTrailingSlash'](_0x106282[_0xdf92('0x46')]);if(_0x2c4b3d&&_0x2c4b3d['monitor_format']){logger[_0xdf92('0xc')]('['+_0x5b817b[_0xdf92('0x64')][_0xdf92('0x65')]()+']',_0xdf92('0x66'));_0x5b817b[_0xdf92('0x48')]=util['format'](_0xdf92('0x49'),_0x106282[_0xdf92('0x46')],_0x5b817b['uniqueid'],md5(_0x5b817b[_0xdf92('0x4a')]));}else{_0x5b817b[_0xdf92('0x48')]='';}headers[_0xdf92('0x67')]=getAuth(_0x106282);return getUser(_0x106282)[_0xdf92('0x15')](function(_0x568367){_0x39d3bb=_0x568367;logger[_0xdf92('0xc')]('The\x20User\x20ID\x20is:',_0x39d3bb['id']);return getEndUser(_0x106282,_0x5b817b[_0xdf92('0x4d')],_0x5b817b['calleridnum']);})['then'](function(_0x16a348){_0x517dc1=_0x16a348;logger[_0xdf92('0xc')]('The\x20Enduser\x20ID\x20is:',_0x517dc1['id']);return getTicket(_0x106282,_0x39d3bb,_0x517dc1,_0x21bfae,_0x5b817b);})['then'](function(_0x1448b5){if(_0x1448b5){logger[_0xdf92('0xc')](_0xdf92('0x68'),_0x1448b5['id']);}})[_0xdf92('0x5a')](function(_0x2f49e6){logger[_0xdf92('0x58')]('['+_0x5b817b[_0xdf92('0x64')]['toUpperCase']()+']'+_0xdf92('0x69'),util[_0xdf92('0x5c')](_0x2f49e6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa56c=['catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridnum','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','The\x20Ticket\x20ID\x20is:','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','merge','name','getString','Subjects','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','remoteUri','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','length','filter','end-user','first','Enduser\x20found!','%s/users.json','POST','Caller\x20-\x20%s','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','forEach','string','picklist','nameField','customField','content','includes','custom_fields','push','idField','variable','variableName','type','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error'];(function(_0xca6f18,_0x2adea0){var _0x38495e=function(_0x286939){while(--_0x286939){_0xca6f18['push'](_0xca6f18['shift']());}};_0x38495e(++_0x2adea0);}(_0xa56c,0x1cd));var _0xca56=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xa56c[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0xca56('0x0'));var rp=require(_0xca56('0x1'));var md5=require(_0xca56('0x2'));var util=require(_0xca56('0x3'));var Redis=require(_0xca56('0x4'));var intUtil=require(_0xca56('0x5'));var config=require(_0xca56('0x6'));var logger=require(_0xca56('0x7'))(_0xca56('0x8'));config[_0xca56('0x9')]=_[_0xca56('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xca56('0x9')]));function emit(_0x1df449,_0x4fbe81,_0x4580bf){io['to'](_0x1df449)[_0xca56('0xb')](_0x4fbe81,_0x4580bf);}var headers={'Content-Type':_0xca56('0xc'),'Accept':_0xca56('0xc')};function getTicket(_0x173aec,_0x22810e,_0x4ef59e,_0x3a3922,_0x50ca93){logger[_0xca56('0xd')](_0xca56('0xe'));return request({'uri':util[_0xca56('0xf')](_0xca56('0x10'),_0x173aec['remoteUri']),'method':'POST','body':{'ticket':_[_0xca56('0x11')]({'requester_id':_0x4ef59e['id'],'submitter_id':_0x22810e?_0x22810e['id']:undefined,'assignee_id':_0x22810e?_0x22810e['id']:undefined,'tags':getTags(_0x3a3922['Tags'],_0xca56('0x12')),'subject':intUtil[_0xca56('0x13')](_0x3a3922[_0xca56('0x14')],_0x50ca93,'\x20'),'description':intUtil[_0xca56('0x13')](_0x3a3922[_0xca56('0x15')],_0x50ca93,'\x0a'),'comment':{'public':![],'body':intUtil[_0xca56('0x13')](_0x3a3922['Descriptions'],_0x50ca93,'\x0a')}},getCustomFields(_0x3a3922[_0xca56('0x16')],_0x50ca93))}})[_0xca56('0x17')](function(_0x2e125d){logger[_0xca56('0xd')]('Ticket\x20created!');return _0x2e125d[_0xca56('0x18')];});}function getUser(_0x36e86f,_0x35ccf9){if(intUtil['validateEmail'](_0x35ccf9)){logger[_0xca56('0xd')](_0xca56('0x19'),_0x35ccf9);return request({'uri':util[_0xca56('0xf')](_0xca56('0x1a'),_0x36e86f['remoteUri']),'qs':{'query':util[_0xca56('0xf')](_0xca56('0x1b'),_0x35ccf9)}})[_0xca56('0x17')](function(_0x562add){if(_0x562add['count']){logger[_0xca56('0xd')]('Agent\x20found!');return _[_0xca56('0x1c')](_0x562add['results'],{'email':_0x35ccf9,'role':_0xca56('0x1d')});}else{logger[_0xca56('0xd')](_0xca56('0x1e'));return request({'uri':util[_0xca56('0xf')](_0xca56('0x1f'),_0x36e86f[_0xca56('0x20')])})[_0xca56('0x17')](function(_0x27a687){logger[_0xca56('0xd')](_0xca56('0x21'));return _0x27a687[_0xca56('0x22')];});}});}else{logger[_0xca56('0xd')](_0xca56('0x1e'));return request({'uri':util[_0xca56('0xf')](_0xca56('0x1f'),_0x36e86f[_0xca56('0x20')])})[_0xca56('0x17')](function(_0x4183f4){logger[_0xca56('0xd')](_0xca56('0x21'));return _0x4183f4['user'];});}}function getEndUser(_0x5d8153,_0x82b74a,_0x4cd3ad){logger['info'](_0xca56('0x23'),_0x4cd3ad);return request({'uri':util[_0xca56('0xf')](_0xca56('0x1a'),_0x5d8153[_0xca56('0x20')]),'qs':{'query':util[_0xca56('0xf')]('type:user\x20role:end-user\x20phone:%s',_0x4cd3ad)}})[_0xca56('0x17')](function(_0x2446df){var _0x492c4a;if(_0x2446df[_0xca56('0x24')][_0xca56('0x25')]){_0x2446df[_0xca56('0x24')]=_[_0xca56('0x26')](_0x2446df['results'],{'suspended':![],'role':_0xca56('0x27')});if(_0x2446df[_0xca56('0x24')][_0xca56('0x25')]){_0x492c4a=_[_0xca56('0x28')](_0x2446df[_0xca56('0x24')]);}}if(_0x492c4a){logger['info'](_0xca56('0x29'));return _0x492c4a;}else{logger[_0xca56('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xca56('0xf')](_0xca56('0x2a'),_0x5d8153['remoteUri']),'method':_0xca56('0x2b'),'body':{'user':{'role':_0xca56('0x27'),'name':util[_0xca56('0xf')](_0xca56('0x2c'),_0x82b74a||_0x4cd3ad),'phone':_0x4cd3ad}}})[_0xca56('0x17')](function(_0x375425){logger['info']('Enduser\x20created.');return _0x375425['user'];});}});}function getAuth(_0x2a5e61){var _0x3d5b9a;if(_0x2a5e61['authType']===_0xca56('0x2d')){_0x3d5b9a=util[_0xca56('0xf')](_0xca56('0x2e'),_0x2a5e61[_0xca56('0x2f')],_0x2a5e61[_0xca56('0x2d')]);}else if(_0x2a5e61['authType']===_0xca56('0x30')){_0x3d5b9a=util['format']('%s/token:%s',_0x2a5e61['username'],_0x2a5e61[_0xca56('0x30')]);}return util[_0xca56('0xf')](_0xca56('0x31'),new Buffer(_0x3d5b9a)[_0xca56('0x32')](_0xca56('0x33')));}function request(_0x2b8c35){logger[_0xca56('0x34')](_0xca56('0x35'),JSON[_0xca56('0x36')](_0x2b8c35));return rp(_[_0xca56('0xa')](_0x2b8c35,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x590d93,_0x2b5daf){var _0x5de496=[];if(_0x590d93&&_0x590d93[_0xca56('0x25')]>0x0){_0x5de496=_['map'](_0x590d93,_0x2b5daf);}return _0x5de496;}function getCustomFields(_0x4d69fa,_0x127b01){var _0x2ebd13=[];var _0x48a0ee={'custom_fields':[]};if(_0x4d69fa['length']>0x0){_[_0xca56('0x37')](_0x4d69fa,function(_0xf629b9){if(_['includes']([_0xca56('0x38'),_0xca56('0x39')],_0xf629b9['type'])&&_0xf629b9[_0xca56('0x3a')]&&!_0xf629b9[_0xca56('0x3b')]){_0x48a0ee[_0xf629b9[_0xca56('0x3a')]['toLowerCase']()]=_0xf629b9[_0xca56('0x3c')][_0xca56('0x32')]();}else if(_[_0xca56('0x3d')]([_0xca56('0x38'),_0xca56('0x39')],_0xf629b9['type'])&&_0xf629b9['idField']&&_0xf629b9[_0xca56('0x3b')]){_0x48a0ee[_0xca56('0x3e')][_0xca56('0x3f')]({'id':_0xf629b9[_0xca56('0x40')],'value':_0xf629b9[_0xca56('0x3c')][_0xca56('0x32')]()});}else if(_0xf629b9['type']===_0xca56('0x41')&&_0xf629b9[_0xca56('0x42')]&&_0xf629b9[_0xca56('0x40')]&&_0xf629b9[_0xca56('0x3b')]){_0x127b01[_0xf629b9[_0xca56('0x42')]]&&_0x48a0ee[_0xca56('0x3e')][_0xca56('0x3f')]({'id':_0xf629b9[_0xca56('0x40')],'value':_0x127b01[_0xf629b9['variableName']][_0xca56('0x32')]()});}else if(_0xf629b9[_0xca56('0x43')]===_0xca56('0x44')&&_0xf629b9[_0xca56('0x45')]&&_0xf629b9[_0xca56('0x45')][_0xca56('0x12')]&&_0xf629b9[_0xca56('0x40')]&&_0xf629b9[_0xca56('0x3b')]){_0x127b01[_0xf629b9[_0xca56('0x45')][_0xca56('0x12')]['toLowerCase']()]&&_0x48a0ee[_0xca56('0x3e')]['push']({'id':_0xf629b9['idField'],'value':_0x127b01[_0xf629b9[_0xca56('0x45')][_0xca56('0x12')][_0xca56('0x46')]()][_0xca56('0x32')]()});}});}return _0x48a0ee;}exports[_0xca56('0x47')]=function(_0x40fd08,_0x3e0981,_0x4a3c2c,_0x1bd15a,_0x3b3e95,_0x511b6e){var _0x2f4784,_0x550551;_0x511b6e[_0xca56('0x20')]=intUtil[_0xca56('0x48')](_0x511b6e[_0xca56('0x20')]);_0x511b6e['serverUrl']=intUtil[_0xca56('0x48')](_0x511b6e['serverUrl']);if(_0x3b3e95&&_0x3b3e95[_0xca56('0x49')]){logger['info'](_0xca56('0x4a'),_0xca56('0x4b'));_0x3e0981['recordingURL']=util[_0xca56('0xf')](_0xca56('0x4c'),_0x511b6e[_0xca56('0x4d')],_0x3e0981['uniqueid'],md5(_0x3e0981[_0xca56('0x4e')]));}else{_0x3e0981[_0xca56('0x4f')]='';}headers['Authorization']=getAuth(_0x511b6e);return getUser(_0x511b6e,_0x1bd15a['email'])[_0xca56('0x17')](function(_0x3e04bc){_0x2f4784=_0x3e04bc;logger[_0xca56('0xd')](_0xca56('0x50'),_0x2f4784['id']);return getEndUser(_0x511b6e,_0x3e0981[_0xca56('0x51')],_0x3e0981[_0xca56('0x52')]);})[_0xca56('0x17')](function(_0x1b62ca){_0x550551=_0x1b62ca;logger['info'](_0xca56('0x53'),_0x550551['id']);return getTicket(_0x511b6e,_0x2f4784,_0x550551,_0x4a3c2c,_0x3e0981);})[_0xca56('0x17')](function(_0x3b494b){if(_0x3b494b){logger[_0xca56('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3b494b['id']);switch(_0x511b6e[_0xca56('0x43')]){case _0xca56('0x54'):logger['info'](_0xca56('0x4a'),_0xca56('0x55'));return request({'uri':util[_0xca56('0xf')](_0xca56('0x56'),_0x511b6e[_0xca56('0x20')],_0x2f4784['id'],_0x3b494b['id']),'method':_0xca56('0x2b')});case _0xca56('0x57'):logger['info'](_0xca56('0x4a'),_0xca56('0x58'));emit(util[_0xca56('0xf')]('user:%s',_0x1bd15a['name']),_0xca56('0x59'),{'uri':util['format'](_0xca56('0x5a'),_0x511b6e[_0xca56('0x20')][_0xca56('0x5b')](_0xca56('0x5c'),''),_0x3b494b['id'])});break;default:logger[_0xca56('0x5d')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xca56('0x5e')](function(_0x37542d){logger['error'](_0xca56('0x5f'),util[_0xca56('0x60')](_0x37542d,{'showHidden':!![],'depth':null}));});};exports[_0xca56('0x61')]=function(_0x1c3b53,_0x3e681e,_0x4345a9,_0x42d600,_0xdb9848,_0x3fa31b,_0x102d38){var _0x5a40a9,_0x57f458;_0x3fa31b[_0xca56('0x20')]=intUtil[_0xca56('0x48')](_0x3fa31b[_0xca56('0x20')]);_0x3fa31b['serverUrl']=intUtil[_0xca56('0x48')](_0x3fa31b[_0xca56('0x4d')]);if(_0x102d38&&_0x102d38[_0xca56('0x62')]&&_0x102d38[_0xca56('0x62')]!==_0xca56('0x63')){logger[_0xca56('0xd')](_0xca56('0x64'),_0xca56('0x4b'));_0x3e681e[_0xca56('0x4f')]=util['format'](_0xca56('0x4c'),_0x3fa31b[_0xca56('0x4d')],_0x3e681e[_0xca56('0x4e')],md5(_0x3e681e[_0xca56('0x4e')]));}headers[_0xca56('0x65')]=getAuth(_0x3fa31b);return getUser(_0x3fa31b,_0x42d600[_0xca56('0x66')])['then'](function(_0x58d33){_0x5a40a9=_0x58d33;logger[_0xca56('0xd')](_0xca56('0x50'),_0x5a40a9['id']);return getEndUser(_0x3fa31b,_0x3e681e['destcalleridname'],_0x3e681e[_0xca56('0x67')]);})[_0xca56('0x17')](function(_0x446d86){_0x57f458=_0x446d86;logger[_0xca56('0xd')](_0xca56('0x53'),_0x57f458['id']);return getTicket(_0x3fa31b,_0x5a40a9,_0x57f458,_0x4345a9,_0x3e681e);})['then'](function(_0x13f2ec){if(_0x13f2ec){logger['info']('The\x20Ticket\x20ID\x20is:',_0x13f2ec['id']);switch(_0x3fa31b[_0xca56('0x43')]){case _0xca56('0x54'):logger[_0xca56('0xd')](_0xca56('0x64'),_0xca56('0x55'));return request({'uri':util[_0xca56('0xf')](_0xca56('0x56'),_0x3fa31b['remoteUri'],_0x5a40a9['id'],_0x13f2ec['id']),'method':'POST'});case _0xca56('0x57'):logger[_0xca56('0xd')]('[OUTBOUND]',_0xca56('0x58'));emit(util['format'](_0xca56('0x68'),_0x42d600[_0xca56('0x12')]),_0xca56('0x59'),{'uri':util['format'](_0xca56('0x5a'),_0x3fa31b[_0xca56('0x20')][_0xca56('0x5b')](_0xca56('0x5c'),''),_0x13f2ec['id'])});break;default:logger[_0xca56('0x5d')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xca56('0x5e')](function(_0x165a16){logger[_0xca56('0x5d')](_0xca56('0x69'),util[_0xca56('0x60')](_0x165a16,{'showHidden':!![],'depth':null}));});};exports[_0xca56('0x6a')]=function(_0x534e09,_0x27a0fd,_0xaa41b5,_0x1c8683,_0x5e496e,_0x18600b){var _0x23ec20,_0x412d5b;_0x18600b[_0xca56('0x20')]=intUtil[_0xca56('0x48')](_0x18600b['remoteUri']);_0x18600b['serverUrl']=intUtil[_0xca56('0x48')](_0x18600b[_0xca56('0x4d')]);if(_0x5e496e&&_0x5e496e[_0xca56('0x49')]){logger[_0xca56('0xd')]('['+_0x27a0fd[_0xca56('0x6b')][_0xca56('0x6c')]()+']','Recording\x20is\x20enabled!');_0x27a0fd['recordingURL']=util[_0xca56('0xf')](_0xca56('0x4c'),_0x18600b[_0xca56('0x4d')],_0x27a0fd[_0xca56('0x4e')],md5(_0x27a0fd[_0xca56('0x4e')]));}else{_0x27a0fd[_0xca56('0x4f')]='';}headers[_0xca56('0x65')]=getAuth(_0x18600b);return getUser(_0x18600b)['then'](function(_0x389281){_0x23ec20=_0x389281;logger[_0xca56('0xd')](_0xca56('0x50'),_0x23ec20['id']);return getEndUser(_0x18600b,_0x27a0fd[_0xca56('0x51')],_0x27a0fd[_0xca56('0x52')]);})['then'](function(_0x46b1c6){_0x412d5b=_0x46b1c6;logger[_0xca56('0xd')]('The\x20Enduser\x20ID\x20is:',_0x412d5b['id']);return getTicket(_0x18600b,_0x23ec20,_0x412d5b,_0xaa41b5,_0x27a0fd);})['then'](function(_0x4a3a84){if(_0x4a3a84){logger['info'](_0xca56('0x6d'),_0x4a3a84['id']);}})[_0xca56('0x5e')](function(_0x4ce4fe){logger['error']('['+_0x27a0fd[_0xca56('0x6b')]['toUpperCase']()+']'+_0xca56('0x6e'),util[_0xca56('0x60')](_0x4ce4fe,{'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 0d91996..6951675 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 _0xd23b=['Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','startCase','Error:\x20','log','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','details','err','stack','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','destcalleridnum','user:%s','unmanaged','toUpperCase','calleridnum','lodash','request-promise','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','[HTTP]','forEach','includes','string','type','idField','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xd23b,0x199));var _0xbd23=function(_0x31e584,_0x4d9f7f){_0x31e584=_0x31e584-0x0;var _0x5686d0=_0xd23b[_0x31e584];return _0x5686d0;};'use strict';var _=require(_0xbd23('0x0'));var rp=require(_0xbd23('0x1'));var md5=require('md5');var util=require('util');var intUtil=require('./util');var moment=require(_0xbd23('0x2'));var Redis=require(_0xbd23('0x3'));var BPromise=require('bluebird');var config=require(_0xbd23('0x4'));var logger=require(_0xbd23('0x5'))(_0xbd23('0x6'));config[_0xbd23('0x7')]=_[_0xbd23('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xbd23('0x9'))(new Redis(config[_0xbd23('0x7')]));function emit(_0x1800e2,_0x40004d,_0x28ec84){io['to'](_0x1800e2)[_0xbd23('0xa')](_0x40004d,_0x28ec84);}function request(_0x211e41){logger['debug'](_0xbd23('0xb'),JSON['stringify'](_0x211e41));return rp(_0x211e41);}function getCustomFields(_0x220306,_0xaceb1e){var _0x53b294={};if(_0x220306['length']>0x0){_[_0xbd23('0xc')](_0x220306,function(_0x41a529){if(_[_0xbd23('0xd')]([_0xbd23('0xe'),'picklist'],_0x41a529[_0xbd23('0xf')])&&_0x41a529[_0xbd23('0x10')]){_0x53b294[_0x41a529[_0xbd23('0x10')]]=_0x41a529['content'][_0xbd23('0x11')]();}else if(_0x41a529[_0xbd23('0xf')]===_0xbd23('0x12')&&_0x41a529[_0xbd23('0x13')]&&_0x41a529[_0xbd23('0x10')]&&_0xaceb1e[_0x41a529[_0xbd23('0x13')]]){_0x53b294[_0x41a529[_0xbd23('0x10')]]=_0xaceb1e[_0x41a529[_0xbd23('0x13')]][_0xbd23('0x11')]();}else if(_0x41a529[_0xbd23('0xf')]==='customVariable'&&_0x41a529[_0xbd23('0x14')]&&_0x41a529[_0xbd23('0x14')][_0xbd23('0x15')]&&_0x41a529['idField']&&_0xaceb1e[_0x41a529[_0xbd23('0x14')]['name'][_0xbd23('0x16')]()]){_0x53b294[_0x41a529[_0xbd23('0x10')]]=_0xaceb1e[_0x41a529[_0xbd23('0x14')][_0xbd23('0x15')][_0xbd23('0x16')]()][_0xbd23('0x11')]();}});}return _0x53b294;}function getName(_0x2f439e){if(_0x2f439e[_0xbd23('0x17')]('\x20')>0x0){var _0x542952=_0x2f439e[_0xbd23('0x18')](/ (.+)/);if(_0x542952[0x1]){return _0x542952;}}return[_0x2f439e,_0x2f439e];}var accountsTokens={};function getAccessToken(_0x15ea5a){return new Promise(function(_0x205a0a,_0x2603b3){if(!_[_0xbd23('0x19')](accountsTokens[_0x15ea5a['id']])&&!_[_0xbd23('0x19')](accountsTokens[_0x15ea5a['id']][_0xbd23('0x1a')])){if(moment()['isBefore'](accountsTokens[_0x15ea5a['id']][_0xbd23('0x1b')])){_0x205a0a(accountsTokens[_0x15ea5a['id']]['access_token']);}}var _0xccf0f7;switch(_0x15ea5a[_0xbd23('0x1c')]){case'US':_0xccf0f7=_0xbd23('0x1d');break;case'AU':_0xccf0f7=_0xbd23('0x1e');break;case'EU':_0xccf0f7='https://accounts.zoho.eu';break;case'IN':_0xccf0f7=_0xbd23('0x1f');break;case'CN':_0xccf0f7=_0xbd23('0x20');break;default:_0xccf0f7=_0xbd23('0x21');break;}var _0xcc4841={'method':_0xbd23('0x22'),'uri':_0xccf0f7+_0xbd23('0x23'),'qs':{'refresh_token':_0x15ea5a[_0xbd23('0x24')],'client_id':_0x15ea5a[_0xbd23('0x25')],'client_secret':_0x15ea5a[_0xbd23('0x26')],'grant_type':_0xbd23('0x27')},'json':!![]};return rp(_0xcc4841)['then'](function(_0x166f0b){accountsTokens[_0x15ea5a['id']]={'access_token':_0x166f0b['access_token'],'expires_in':moment()[_0xbd23('0x28')](_0x166f0b['expires_in'],'seconds')};_0x205a0a(_0x166f0b[_0xbd23('0x1a')]);})[_0xbd23('0x29')](function(_0x4c75b0){logger[_0xbd23('0x2a')](_0xbd23('0x2b'),_0x4c75b0['stack']);_0x2603b3(_0x4c75b0);});});}function getUser(_0x49a148,_0x1f32ce,_0x2e465b,_0x2214ba){logger[_0xbd23('0x2c')](_0xbd23('0x2d'));return request({'method':_0xbd23('0x2e'),'uri':util[_0xbd23('0x2f')](_0xbd23('0x30'),_0x1f32ce),'qs':{'type':_0xbd23('0x31')},'headers':{'Authorization':_0xbd23('0x32')+_0x49a148},'json':!![]})[_0xbd23('0x33')](function(_0x45be7a){if(_0x45be7a[_0xbd23('0x34')]){var _0x4e7592=-0x1;if(_[_0xbd23('0x35')](_0x45be7a[_0xbd23('0x34')])){if(!_[_0xbd23('0x19')](_0x2214ba)){_0x4e7592=_['findIndex'](_0x45be7a[_0xbd23('0x34')],function(_0x2a6504){return _0x2a6504[_0xbd23('0x36')]===_0x2214ba;});}if(_0x4e7592>=0x0){logger[_0xbd23('0x2c')](_0xbd23('0x37'));}else{logger[_0xbd23('0x2c')](_0xbd23('0x38'));_0x4e7592=_[_0xbd23('0x39')](_0x45be7a[_0xbd23('0x34')],function(_0x1cb0b7){return _0x1cb0b7[_0xbd23('0x3a')]['name']===_0xbd23('0x3b');});}return _0x45be7a[_0xbd23('0x34')][_0x4e7592];}else{if(_0x45be7a[_0xbd23('0x3c')][_0xbd23('0x3a')][_0xbd23('0x15')]===_0xbd23('0x3b')){logger['info'](_0xbd23('0x38'));user=_0x45be7a[_0xbd23('0x3c')];return user;}else{logger[_0xbd23('0x2a')](_0xbd23('0x3d'),JSON[_0xbd23('0x3e')](_0x45be7a));throw new Error(_0xbd23('0x3f')+JSON[_0xbd23('0x3e')](_0x45be7a));}}}else{logger['error'](_0xbd23('0x3d'),JSON[_0xbd23('0x3e')](_0x45be7a));throw new Error(_0xbd23('0x3f')+JSON[_0xbd23('0x3e')](_0x45be7a));}})['catch'](function(_0x4ac446){console['error'](_0x4ac446);});}function getZohoUser(_0xa44a57,_0x1d1d8c){return new BPromise(function(_0x819f10,_0x3f4976){request(_0xa44a57)[_0xbd23('0x33')](function(_0x2f9a27){var _0x8663c1=null;if(_0x2f9a27){_0x8663c1=_0x2f9a27[_0xbd23('0x40')][0x0];_0x8663c1[_0xbd23('0x41')]=_0x1d1d8c;}_0x819f10(_0x8663c1);})[_0xbd23('0x29')](function(_0x55ec8e){_0x3f4976(_0x55ec8e);});});}function createEndUser(_0x524110,_0x209fa9,_0x28ba40,_0xdb00f2,_0x1172bc,_0x19e79d){var _0x28ba40=getName(_0x28ba40);return request({'method':_0xbd23('0x22'),'uri':_0xbd23('0x42')+_0x209fa9+_0xbd23('0x43')+_['startCase'](_0x19e79d[_0xbd23('0x44')])+'s','body':{'data':[{'Last_Name':_0x28ba40[0x1],'First_Name':_0x28ba40[0x0],'Phone':_0xdb00f2,'Owner':{'name':!_[_0xbd23('0x19')](_0x1172bc['role']['name'])?_0x1172bc[_0xbd23('0x45')]['name']:!_[_0xbd23('0x19')](_0x1172bc[_0xbd23('0x46')])?_0x1172bc[_0xbd23('0x46')]+'\x20'+_0x1172bc[_0xbd23('0x47')]:_0x1172bc[_0xbd23('0x47')],'id':_0x1172bc['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x524110},'json':!![]})['then'](function(_0x9bd377){if(_0x9bd377&&_0x9bd377[_0xbd23('0x40')][0x0][_0xbd23('0x48')]==='SUCCESS'){var _0x261b2d=_0x9bd377[_0xbd23('0x40')][0x0]['details'];_0x261b2d[_0xbd23('0x41')]=_[_0xbd23('0x49')](_0x19e79d[_0xbd23('0x44')])+'s';return _0x261b2d;}logger['error'](_0xbd23('0x3d'),JSON[_0xbd23('0x3e')](data));throw new Error(_0xbd23('0x4a')+JSON['stringify'](data));})[_0xbd23('0x29')](function(_0x5f26b1){console[_0xbd23('0x4b')]('CREATE\x20ERROR',_0x5f26b1);});}function getEndUser(_0x296cd7,_0x32e1c0,_0x2470be,_0x4c4439,_0x29c6e6,_0x2d8c5f,_0x51521c){var _0x5b8e2a={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x296cd7},'json':!![]};switch(_0x51521c['moduleSearch']){case'contact_lead':_0x5b8e2a[_0xbd23('0x4c')]=_0xbd23('0x42')+_0x32e1c0+_0xbd23('0x4d')+_0x29c6e6+'))';return getZohoUser(_0x5b8e2a,_0xbd23('0x4e'))[_0xbd23('0x33')](function(_0x11911d){if(_0x11911d)return _0x11911d;_0x5b8e2a[_0xbd23('0x4c')]=_0xbd23('0x42')+_0x32e1c0+_0xbd23('0x4f')+_0x29c6e6+'))';return getZohoUser(_0x5b8e2a,_0xbd23('0x50'))[_0xbd23('0x33')](function(_0x1683f9){if(_0x1683f9)return _0x1683f9;if(_0x51521c[_0xbd23('0x44')]!='nothing'){return createEndUser(_0x296cd7,_0x32e1c0,_0x4c4439,_0x29c6e6,_0x2d8c5f,_0x51521c);}else{return{};}});});break;case _0xbd23('0x51'):_0x5b8e2a[_0xbd23('0x4c')]='https://www.zohoapis.'+_0x32e1c0+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x29c6e6+'))';return getZohoUser(_0x5b8e2a,_0xbd23('0x4e'))[_0xbd23('0x33')](function(_0x138987){if(_0x138987)return _0x138987;if(_0x51521c['moduleCreate']!=_0xbd23('0x52')){return createEndUser(_0x296cd7,_0x32e1c0,_0x4c4439,_0x29c6e6,_0x2d8c5f,_0x51521c);}else{return{};}});break;case _0xbd23('0x53'):_0x5b8e2a['uri']=_0xbd23('0x42')+_0x32e1c0+_0xbd23('0x4f')+_0x29c6e6+'))';return getZohoUser(_0x5b8e2a,_0xbd23('0x50'))[_0xbd23('0x33')](function(_0x7e639f){if(_0x7e639f)return _0x7e639f;if(_0x51521c[_0xbd23('0x44')]!='nothing'){return createEndUser(_0x296cd7,_0x32e1c0,_0x4c4439,_0x29c6e6,_0x2d8c5f,_0x51521c);}else{return{};}});break;}}function getCall(_0x3e8212,_0x51d328,_0x106b28,_0x4ac29e,_0x51a4a9,_0xf0a10f,_0x35bf9c,_0x1ffb4a){logger[_0xbd23('0x2c')](_0xbd23('0x54'));var _0x2296bb={};_0x2296bb[_0xbd23('0x55')]={'name':!_[_0xbd23('0x19')](_0x4ac29e['role']['name'])&&!_['isNil'](_0x4ac29e[_0xbd23('0x3a')][_0xbd23('0x15')])&&_0x4ac29e[_0xbd23('0x3a')]['name']===_0xbd23('0x56')?_0x4ac29e[_0xbd23('0x45')][_0xbd23('0x15')]:!_['isNil'](_0x4ac29e[_0xbd23('0x46')])?_0x4ac29e[_0xbd23('0x46')]+'\x20'+_0x4ac29e[_0xbd23('0x47')]:_0x4ac29e[_0xbd23('0x47')],'id':_0x4ac29e['id']};_0x2296bb['Subject']=intUtil[_0xbd23('0x57')](_0xf0a10f[_0xbd23('0x58')],_0x35bf9c,'\x20');_0x2296bb[_0xbd23('0x59')]=intUtil[_0xbd23('0x57')](_0xf0a10f['Descriptions'],_0x35bf9c,'\x0a');if(_0x51a4a9[_0xbd23('0x41')]===_0xbd23('0x4e')){_0x2296bb[_0xbd23('0x5a')]={'name':!_[_0xbd23('0x19')](_0x51a4a9[_0xbd23('0x5b')])?_0x51a4a9[_0xbd23('0x5b')]:!_[_0xbd23('0x19')](_0x51a4a9[_0xbd23('0x5c')])?_0x51a4a9[_0xbd23('0x5c')]+'\x20'+_0x51a4a9[_0xbd23('0x5d')]:_0x51a4a9['Last_Name'],'id':_0x51a4a9['id']};}if(_0x51a4a9[_0xbd23('0x41')]===_0xbd23('0x50')){_0x2296bb[_0xbd23('0x5e')]={'name':!_[_0xbd23('0x19')](_0x51a4a9[_0xbd23('0x5b')])?_0x51a4a9[_0xbd23('0x5b')]:!_['isNil'](_0x51a4a9['First_Name'])?_0x51a4a9[_0xbd23('0x5c')]+'\x20'+_0x51a4a9[_0xbd23('0x5d')]:_0x51a4a9[_0xbd23('0x5d')],'id':_0x51a4a9['id']};_0x2296bb[_0xbd23('0x5f')]=_[_0xbd23('0x49')](_0x51a4a9['enduserType']);}if(_0x35bf9c[_0xbd23('0x60')]){_0x2296bb['Call_Duration']=moment[_0xbd23('0x61')](parseInt(_0x35bf9c['talktime'])*0x3e8)['format'](_0xbd23('0x62'));}else if(_0x35bf9c[_0xbd23('0x63')]&&_0x35bf9c[_0xbd23('0x64')]){_0x2296bb[_0xbd23('0x65')]=moment[_0xbd23('0x61')](moment(_0x35bf9c[_0xbd23('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xbd23('0x66')](moment(_0x35bf9c[_0xbd23('0x67')],_0xbd23('0x68'))))[_0xbd23('0x2f')](_0xbd23('0x62'));}switch(_0x35bf9c[_0xbd23('0x69')]){case'called':_0x2296bb[_0xbd23('0x6a')]=_0xbd23('0x6b');break;case _0xbd23('0x6c'):case _0xbd23('0x6d'):_0x2296bb['Call_Result']=_0xbd23('0x6e');break;case _0xbd23('0x6f'):_0x2296bb[_0xbd23('0x6a')]=_0xbd23('0x70');break;case _0xbd23('0x71'):_0x2296bb[_0xbd23('0x6a')]=_0xbd23('0x72');break;case _0xbd23('0x73'):_0x2296bb[_0xbd23('0x6a')]=_0xbd23('0x74');default:}_0x2296bb[_0xbd23('0x75')]=(_0x1ffb4a===_0xbd23('0x76')?moment(_0x35bf9c[_0xbd23('0x67')])[_0xbd23('0x2f')](_0xbd23('0x68')):moment(_0x35bf9c[_0xbd23('0x77')])[_0xbd23('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xbd23('0x2f')](_0xbd23('0x68'));_0x2296bb[_0xbd23('0x78')]=_0x1ffb4a||_0xbd23('0x79');_0x2296bb=_['merge'](_0x2296bb,getCustomFields(_0xf0a10f[_0xbd23('0x7a')],_0x35bf9c));return request({'method':_0xbd23('0x22'),'uri':_0xbd23('0x42')+_0x51d328+_0xbd23('0x7b'),'headers':{'Authorization':_0xbd23('0x32')+_0x3e8212},'body':{'data':[_0x2296bb]},'json':!![]})['then'](function(_0x347f3a){if(_0x347f3a&&_0x347f3a[_0xbd23('0x40')][0x0][_0xbd23('0x48')]==='SUCCESS'){logger[_0xbd23('0x2c')](_0xbd23('0x7c'));return{'id':_0x347f3a[_0xbd23('0x40')][0x0][_0xbd23('0x7d')]['id']};}})[_0xbd23('0x29')](function(_0x4a93b8){logger['info'](_0xbd23('0x7e'),_0x4a93b8[_0xbd23('0x7f')]);console['log'](_0xbd23('0x7e'),_0x4a93b8);});}exports[_0xbd23('0x80')]=function(_0x5cef19,_0x458878,_0x58fd93,_0x162cc0,_0x319d62,_0x1988ef){var _0x3ced2,_0x5530a4,_0x4b4f39;_0x1988ef[_0xbd23('0x81')]=intUtil[_0xbd23('0x82')](_0x1988ef[_0xbd23('0x81')]);_0x1988ef['serverUrl']=intUtil[_0xbd23('0x82')](_0x1988ef[_0xbd23('0x83')]);if(_0x319d62&&_0x319d62[_0xbd23('0x84')]){logger[_0xbd23('0x2c')](_0xbd23('0x85'),_0xbd23('0x86'));_0x458878[_0xbd23('0x87')]=_0x1988ef[_0xbd23('0x83')]+'/api/voice/recordings/'+_0x458878[_0xbd23('0x88')]+_0xbd23('0x89')+md5(_0x458878[_0xbd23('0x88')]);}else{_0x458878[_0xbd23('0x87')]='';}var _0x4bc9c2=_0x1988ef[_0xbd23('0x81')]===_0xbd23('0x8a')?'eu':_0xbd23('0x8b');return getAccessToken(_0x1988ef)[_0xbd23('0x33')](function(_0x40080d){_0x4b4f39=_0x40080d;return getUser(_0x4b4f39,_0x4bc9c2,_0x1988ef,_0x162cc0[_0xbd23('0x36')]);})[_0xbd23('0x33')](function(_0x2b9edf){_0x3ced2=_0x2b9edf;logger['info'](_0xbd23('0x8c'),_0x3ced2['id']);return getEndUser(_0x4b4f39,_0x4bc9c2,_0x1988ef,_0x458878[_0xbd23('0x8d')],_0x458878['calleridnum'],_0x3ced2,_0x58fd93);})[_0xbd23('0x33')](function(_0x29e8f4){_0x5530a4=_0x29e8f4;return getCall(_0x4b4f39,_0x4bc9c2,_0x1988ef,_0x3ced2,_0x5530a4,_0x58fd93,_0x458878,_0xbd23('0x79'));})[_0xbd23('0x33')](function(_0x4ccd2d){if(_0x4ccd2d){logger[_0xbd23('0x2c')](_0xbd23('0x8e'),_0x4ccd2d['id']);logger[_0xbd23('0x2c')](_0xbd23('0x85'),_0xbd23('0x8f'));emit(util['format']('user:%s',_0x162cc0[_0xbd23('0x15')]),_0xbd23('0x90'),{'uri':_0xbd23('0x91')+_0x1988ef[_0xbd23('0x81')]+_0xbd23('0x92')+_0x4ccd2d['id']});}})[_0xbd23('0x29')](function(_0x20f9b9){logger[_0xbd23('0x2a')](_0xbd23('0x85'),JSON['stringify'](_0x20f9b9));});};exports['outbound']=function(_0x173812,_0x531158,_0xfcb8fd,_0x369e28,_0x22d433,_0xcb5ec7,_0x41dbc8){var _0xe2013d,_0x5b06f2,_0x20ed89;_0xcb5ec7[_0xbd23('0x81')]=intUtil[_0xbd23('0x82')](_0xcb5ec7[_0xbd23('0x81')]);_0xcb5ec7[_0xbd23('0x83')]=intUtil[_0xbd23('0x82')](_0xcb5ec7['serverUrl']);if(_0x41dbc8&&_0x41dbc8[_0xbd23('0x93')]&&_0x41dbc8[_0xbd23('0x93')]!==_0xbd23('0x94')){logger['info'](_0xbd23('0x95'),_0xbd23('0x86'));_0x531158[_0xbd23('0x87')]=_0xcb5ec7['serverUrl']+_0xbd23('0x96')+_0x531158[_0xbd23('0x88')]+_0xbd23('0x89')+md5(_0x531158['uniqueid']);}var _0x30b91c=_0xcb5ec7[_0xbd23('0x81')]===_0xbd23('0x8a')?'eu':'com';return getAccessToken(_0xcb5ec7)[_0xbd23('0x33')](function(_0x2fda03){_0x20ed89=_0x2fda03;return getUser(_0x20ed89,_0x30b91c,_0xcb5ec7,_0x369e28['email']);})[_0xbd23('0x33')](function(_0x62b224){_0xe2013d=_0x62b224;logger['info'](_0xbd23('0x8c'),_0xe2013d['id']);return getEndUser(_0x20ed89,_0x30b91c,_0xcb5ec7,_0x531158['destcalleridname'],_0x531158[_0xbd23('0x97')],_0xe2013d,_0xfcb8fd);})['then'](function(_0x30df43){_0x5b06f2=_0x30df43;return getCall(_0x20ed89,_0x30b91c,_0xcb5ec7,_0xe2013d,_0x5b06f2,_0xfcb8fd,_0x531158,'Outbound');})[_0xbd23('0x33')](function(_0x4eaeb8){if(_0x4eaeb8){logger[_0xbd23('0x2c')](_0xbd23('0x8e'),_0x4eaeb8['id']);logger[_0xbd23('0x2c')](_0xbd23('0x95'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xbd23('0x2f')](_0xbd23('0x98'),_0x369e28['name']),_0xbd23('0x90'),{'uri':_0xbd23('0x91')+_0xcb5ec7['host']+_0xbd23('0x92')+_0x4eaeb8['id']});}})['catch'](function(_0x37936f){logger[_0xbd23('0x2a')]('[OUTBOUND]',JSON[_0xbd23('0x3e')](_0x37936f));});};exports[_0xbd23('0x99')]=function(_0x2164b8,_0x3f31f8,_0x221c88,_0x31d070,_0x236a2f,_0x870bed){var _0x4420d2,_0x470443,_0x3f560;_0x870bed[_0xbd23('0x81')]=intUtil[_0xbd23('0x82')](_0x870bed[_0xbd23('0x81')]);_0x870bed[_0xbd23('0x83')]=intUtil[_0xbd23('0x82')](_0x870bed[_0xbd23('0x83')]);if(_0x236a2f&&_0x236a2f[_0xbd23('0x84')]){logger[_0xbd23('0x2c')]('['+_0x3f31f8[_0xbd23('0x69')][_0xbd23('0x9a')]()+']','Recording\x20is\x20enabled!');_0x3f31f8['recordingURL']=_0x870bed['serverUrl']+_0xbd23('0x96')+_0x3f31f8[_0xbd23('0x88')]+_0xbd23('0x89')+md5(_0x3f31f8[_0xbd23('0x88')]);}else{_0x3f31f8[_0xbd23('0x87')]='';}var _0x5132f6=_0x870bed[_0xbd23('0x81')]===_0xbd23('0x8a')?'eu':_0xbd23('0x8b');return getAccessToken(_0x870bed)['then'](function(_0x3506e5){_0x3f560=_0x3506e5;return getUser(_0x3f560,_0x5132f6,_0x870bed);})[_0xbd23('0x33')](function(_0x495d86){_0x4420d2=_0x495d86;logger['info'](_0xbd23('0x8c'),_0x4420d2['id']);return getEndUser(_0x3f560,_0x5132f6,_0x870bed,_0x3f31f8[_0xbd23('0x8d')],_0x3f31f8[_0xbd23('0x9b')],_0x4420d2,_0x221c88);})[_0xbd23('0x33')](function(_0x42d9a9){_0x470443=_0x42d9a9;return getCall(_0x3f560,_0x5132f6,_0x870bed,_0x4420d2,_0x470443,_0x221c88,_0x3f31f8,'Inbound');})[_0xbd23('0x33')](function(_0xa6f1da){if(_0xa6f1da){logger[_0xbd23('0x2c')](_0xbd23('0x8e'),_0xa6f1da['id']);}})['catch'](function(_0x478687){logger[_0xbd23('0x2a')]('['+_0x3f31f8[_0xbd23('0x69')]['toUpperCase']()+']',JSON[_0xbd23('0x3e')](_0x478687));});}; \ No newline at end of file +var _0x6400=['queue','host','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','user:%s','unmanaged','monitor_format','lastevent','toUpperCase','lodash','md5','moment','ioredis','bluebird','../../../../config/environment','zoho','defaults','redis','localhost','socket.io-emitter','debug','stringify','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','email','Agent\x20found!','findIndex','profile','Administrator','user','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','SUCCESS','details','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','Owner','administrator','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err'];(function(_0x2f4a7e,_0x4931f2){var _0xacf4a3=function(_0x217d9a){while(--_0x217d9a){_0x2f4a7e['push'](_0x2f4a7e['shift']());}};_0xacf4a3(++_0x4931f2);}(_0x6400,0x1ee));var _0x0640=function(_0x29631f,_0xdb767){_0x29631f=_0x29631f-0x0;var _0x486d87=_0x6400[_0x29631f];return _0x486d87;};'use strict';var _=require(_0x0640('0x0'));var rp=require('request-promise');var md5=require(_0x0640('0x1'));var util=require('util');var intUtil=require('./util');var moment=require(_0x0640('0x2'));var Redis=require(_0x0640('0x3'));var BPromise=require(_0x0640('0x4'));var config=require(_0x0640('0x5'));var logger=require('../../../../config/logger')(_0x0640('0x6'));config['redis']=_[_0x0640('0x7')](config[_0x0640('0x8')],{'host':_0x0640('0x9'),'port':0x18eb});var io=require(_0x0640('0xa'))(new Redis(config[_0x0640('0x8')]));function emit(_0x17655d,_0x36f68b,_0x5cb107){io['to'](_0x17655d)['emit'](_0x36f68b,_0x5cb107);}function request(_0x429bfc){logger[_0x0640('0xb')]('[HTTP]',JSON[_0x0640('0xc')](_0x429bfc));return rp(_0x429bfc);}function getCustomFields(_0xb83ba3,_0x21ec6b){var _0x2d32f5={};if(_0xb83ba3['length']>0x0){_['forEach'](_0xb83ba3,function(_0x378f75){if(_[_0x0640('0xd')]([_0x0640('0xe'),_0x0640('0xf')],_0x378f75[_0x0640('0x10')])&&_0x378f75[_0x0640('0x11')]){_0x2d32f5[_0x378f75['idField']]=_0x378f75['content'][_0x0640('0x12')]();}else if(_0x378f75[_0x0640('0x10')]===_0x0640('0x13')&&_0x378f75[_0x0640('0x14')]&&_0x378f75['idField']&&_0x21ec6b[_0x378f75[_0x0640('0x14')]]){_0x2d32f5[_0x378f75['idField']]=_0x21ec6b[_0x378f75[_0x0640('0x14')]]['toString']();}else if(_0x378f75[_0x0640('0x10')]===_0x0640('0x15')&&_0x378f75[_0x0640('0x16')]&&_0x378f75[_0x0640('0x16')][_0x0640('0x17')]&&_0x378f75[_0x0640('0x11')]&&_0x21ec6b[_0x378f75[_0x0640('0x16')][_0x0640('0x17')][_0x0640('0x18')]()]){_0x2d32f5[_0x378f75[_0x0640('0x11')]]=_0x21ec6b[_0x378f75['Variable'][_0x0640('0x17')][_0x0640('0x18')]()][_0x0640('0x12')]();}});}return _0x2d32f5;}function getName(_0xa01af1){if(_0xa01af1[_0x0640('0x19')]('\x20')>0x0){var _0x532fb0=_0xa01af1[_0x0640('0x1a')](/ (.+)/);if(_0x532fb0[0x1]){return _0x532fb0;}}return[_0xa01af1,_0xa01af1];}var accountsTokens={};function getAccessToken(_0x2ac318){return new Promise(function(_0x585b0b,_0xfee098){if(!_[_0x0640('0x1b')](accountsTokens[_0x2ac318['id']])&&!_[_0x0640('0x1b')](accountsTokens[_0x2ac318['id']][_0x0640('0x1c')])){if(moment()[_0x0640('0x1d')](accountsTokens[_0x2ac318['id']][_0x0640('0x1e')])){_0x585b0b(accountsTokens[_0x2ac318['id']][_0x0640('0x1c')]);}}var _0x1a94e1;switch(_0x2ac318[_0x0640('0x1f')]){case'US':_0x1a94e1='https://accounts.zoho.com';break;case'AU':_0x1a94e1=_0x0640('0x20');break;case'EU':_0x1a94e1=_0x0640('0x21');break;case'IN':_0x1a94e1=_0x0640('0x22');break;case'CN':_0x1a94e1=_0x0640('0x23');break;default:_0x1a94e1=_0x0640('0x21');break;}var _0x1d0b3c={'method':_0x0640('0x24'),'uri':_0x1a94e1+_0x0640('0x25'),'qs':{'refresh_token':_0x2ac318[_0x0640('0x26')],'client_id':_0x2ac318[_0x0640('0x27')],'client_secret':_0x2ac318['clientSecret'],'grant_type':_0x0640('0x28')},'json':!![]};return rp(_0x1d0b3c)[_0x0640('0x29')](function(_0x2e995b){accountsTokens[_0x2ac318['id']]={'access_token':_0x2e995b[_0x0640('0x1c')],'expires_in':moment()[_0x0640('0x2a')](_0x2e995b[_0x0640('0x1e')],_0x0640('0x2b'))};_0x585b0b(_0x2e995b[_0x0640('0x1c')]);})[_0x0640('0x2c')](function(_0x5e619e){logger[_0x0640('0x2d')](_0x0640('0x2e'),_0x5e619e[_0x0640('0x2f')]);_0xfee098(_0x5e619e);});});}function getUser(_0x143457,_0x415dd9,_0x5b278a,_0x31e27c){logger[_0x0640('0x30')]('Search\x20user');return request({'method':_0x0640('0x31'),'uri':util[_0x0640('0x32')](_0x0640('0x33'),_0x415dd9),'qs':{'type':_0x0640('0x34')},'headers':{'Authorization':_0x0640('0x35')+_0x143457},'json':!![]})['then'](function(_0x42919a){if(_0x42919a[_0x0640('0x36')]){var _0x135beb=-0x1;if(_['isArrayLikeObject'](_0x42919a[_0x0640('0x36')])){if(!_[_0x0640('0x1b')](_0x31e27c)){_0x135beb=_['findIndex'](_0x42919a[_0x0640('0x36')],function(_0x125950){return _0x125950[_0x0640('0x37')]===_0x31e27c;});}if(_0x135beb>=0x0){logger[_0x0640('0x30')](_0x0640('0x38'));}else{logger[_0x0640('0x30')]('Using\x20the\x20admin\x20account!');_0x135beb=_[_0x0640('0x39')](_0x42919a[_0x0640('0x36')],function(_0x2bf89b){return _0x2bf89b[_0x0640('0x3a')][_0x0640('0x17')]===_0x0640('0x3b');});}return _0x42919a[_0x0640('0x36')][_0x135beb];}else{if(_0x42919a[_0x0640('0x3c')]['profile']['name']===_0x0640('0x3b')){logger['info'](_0x0640('0x3d'));user=_0x42919a['user'];return user;}else{logger[_0x0640('0x2d')](_0x0640('0x3e'),JSON[_0x0640('0xc')](_0x42919a));throw new Error(_0x0640('0x3f')+JSON[_0x0640('0xc')](_0x42919a));}}}else{logger['error'](_0x0640('0x3e'),JSON[_0x0640('0xc')](_0x42919a));throw new Error(_0x0640('0x3f')+JSON[_0x0640('0xc')](_0x42919a));}})[_0x0640('0x2c')](function(_0x38fce9){console[_0x0640('0x2d')](_0x38fce9);});}function getZohoUser(_0x15a6d7,_0x274e75){return new BPromise(function(_0xaf19c,_0x396abc){request(_0x15a6d7)[_0x0640('0x29')](function(_0xb97a51){var _0x42420=null;if(_0xb97a51){_0x42420=_0xb97a51[_0x0640('0x40')][0x0];_0x42420[_0x0640('0x41')]=_0x274e75;}_0xaf19c(_0x42420);})[_0x0640('0x2c')](function(_0x47cc8b){_0x396abc(_0x47cc8b);});});}function createEndUser(_0x2c7a48,_0x230f9c,_0x1035ba,_0xac4da4,_0x4e2dd3,_0x3c24b9){var _0x1035ba=getName(_0x1035ba);return request({'method':'POST','uri':_0x0640('0x42')+_0x230f9c+_0x0640('0x43')+_[_0x0640('0x44')](_0x3c24b9['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1035ba[0x1],'First_Name':_0x1035ba[0x0],'Phone':_0xac4da4,'Owner':{'name':!_[_0x0640('0x1b')](_0x4e2dd3[_0x0640('0x45')][_0x0640('0x17')])?_0x4e2dd3[_0x0640('0x45')][_0x0640('0x17')]:!_[_0x0640('0x1b')](_0x4e2dd3[_0x0640('0x46')])?_0x4e2dd3['first_name']+'\x20'+_0x4e2dd3['last_name']:_0x4e2dd3[_0x0640('0x47')],'id':_0x4e2dd3['id']}}]},'headers':{'Authorization':_0x0640('0x35')+_0x2c7a48},'json':!![]})[_0x0640('0x29')](function(_0x90dad3){if(_0x90dad3&&_0x90dad3[_0x0640('0x40')][0x0]['code']===_0x0640('0x48')){var _0x4b92b2=_0x90dad3[_0x0640('0x40')][0x0][_0x0640('0x49')];_0x4b92b2[_0x0640('0x41')]=_[_0x0640('0x44')](_0x3c24b9[_0x0640('0x4a')])+'s';return _0x4b92b2;}logger[_0x0640('0x2d')]('The\x20failing\x20result\x20is',JSON[_0x0640('0xc')](data));throw new Error(_0x0640('0x4b')+JSON['stringify'](data));})[_0x0640('0x2c')](function(_0x1fa790){console[_0x0640('0x4c')](_0x0640('0x4d'),_0x1fa790);});}function getEndUser(_0x2a84c2,_0x5f04a5,_0x6bb27a,_0x23c007,_0x5e8e58,_0x24cd4e,_0x1d008c){var _0x187074={'method':_0x0640('0x31'),'uri':'','headers':{'Authorization':_0x0640('0x35')+_0x2a84c2},'json':!![]};switch(_0x1d008c[_0x0640('0x4e')]){case'contact_lead':_0x187074['uri']=_0x0640('0x42')+_0x5f04a5+_0x0640('0x4f')+_0x5e8e58+'))';return getZohoUser(_0x187074,_0x0640('0x50'))[_0x0640('0x29')](function(_0x20f1c4){if(_0x20f1c4)return _0x20f1c4;_0x187074[_0x0640('0x51')]=_0x0640('0x42')+_0x5f04a5+_0x0640('0x52')+_0x5e8e58+'))';return getZohoUser(_0x187074,'Leads')[_0x0640('0x29')](function(_0x17cbda){if(_0x17cbda)return _0x17cbda;if(_0x1d008c[_0x0640('0x4a')]!=_0x0640('0x53')){return createEndUser(_0x2a84c2,_0x5f04a5,_0x23c007,_0x5e8e58,_0x24cd4e,_0x1d008c);}else{return{};}});});break;case _0x0640('0x54'):_0x187074[_0x0640('0x51')]=_0x0640('0x42')+_0x5f04a5+_0x0640('0x4f')+_0x5e8e58+'))';return getZohoUser(_0x187074,_0x0640('0x50'))[_0x0640('0x29')](function(_0x150819){if(_0x150819)return _0x150819;if(_0x1d008c[_0x0640('0x4a')]!=_0x0640('0x53')){return createEndUser(_0x2a84c2,_0x5f04a5,_0x23c007,_0x5e8e58,_0x24cd4e,_0x1d008c);}else{return{};}});break;case _0x0640('0x55'):_0x187074[_0x0640('0x51')]=_0x0640('0x42')+_0x5f04a5+_0x0640('0x52')+_0x5e8e58+'))';return getZohoUser(_0x187074,_0x0640('0x56'))[_0x0640('0x29')](function(_0x2857f0){if(_0x2857f0)return _0x2857f0;if(_0x1d008c[_0x0640('0x4a')]!=_0x0640('0x53')){return createEndUser(_0x2a84c2,_0x5f04a5,_0x23c007,_0x5e8e58,_0x24cd4e,_0x1d008c);}else{return{};}});break;}}function getCall(_0x272517,_0x59ab7a,_0x115b2e,_0x57a351,_0x461e7a,_0x30cc34,_0xe6ea5c,_0xd5cf5){logger[_0x0640('0x30')](_0x0640('0x57'));var _0xa9891d={};_0xa9891d[_0x0640('0x58')]={'name':!_[_0x0640('0x1b')](_0x57a351['role'][_0x0640('0x17')])&&!_['isNil'](_0x57a351[_0x0640('0x3a')][_0x0640('0x17')])&&_0x57a351['profile'][_0x0640('0x17')]===_0x0640('0x59')?_0x57a351['role'][_0x0640('0x17')]:!_[_0x0640('0x1b')](_0x57a351[_0x0640('0x46')])?_0x57a351['first_name']+'\x20'+_0x57a351['last_name']:_0x57a351[_0x0640('0x47')],'id':_0x57a351['id']};_0xa9891d['Subject']=intUtil[_0x0640('0x5a')](_0x30cc34[_0x0640('0x5b')],_0xe6ea5c,'\x20');_0xa9891d[_0x0640('0x5c')]=intUtil[_0x0640('0x5a')](_0x30cc34[_0x0640('0x5d')],_0xe6ea5c,'\x0a');if(_0x461e7a[_0x0640('0x41')]===_0x0640('0x50')){_0xa9891d[_0x0640('0x5e')]={'name':!_[_0x0640('0x1b')](_0x461e7a[_0x0640('0x5f')])?_0x461e7a[_0x0640('0x5f')]:!_['isNil'](_0x461e7a[_0x0640('0x60')])?_0x461e7a[_0x0640('0x60')]+'\x20'+_0x461e7a[_0x0640('0x61')]:_0x461e7a[_0x0640('0x61')],'id':_0x461e7a['id']};}if(_0x461e7a['enduserType']==='Leads'){_0xa9891d[_0x0640('0x62')]={'name':!_[_0x0640('0x1b')](_0x461e7a[_0x0640('0x5f')])?_0x461e7a[_0x0640('0x5f')]:!_['isNil'](_0x461e7a['First_Name'])?_0x461e7a[_0x0640('0x60')]+'\x20'+_0x461e7a[_0x0640('0x61')]:_0x461e7a[_0x0640('0x61')],'id':_0x461e7a['id']};_0xa9891d['$se_module']=_[_0x0640('0x44')](_0x461e7a[_0x0640('0x41')]);}if(_0xe6ea5c[_0x0640('0x63')]){_0xa9891d[_0x0640('0x64')]=moment[_0x0640('0x65')](parseInt(_0xe6ea5c[_0x0640('0x63')])*0x3e8)[_0x0640('0x32')](_0x0640('0x66'));}else if(_0xe6ea5c['answertime']&&_0xe6ea5c[_0x0640('0x67')]){_0xa9891d[_0x0640('0x64')]=moment[_0x0640('0x65')](moment(_0xe6ea5c['endtime'],_0x0640('0x68'))[_0x0640('0x69')](moment(_0xe6ea5c['starttime'],_0x0640('0x68'))))['format']('mm:ss');}switch(_0xe6ea5c['lastevent']){case _0x0640('0x6a'):_0xa9891d[_0x0640('0x6b')]=_0x0640('0x6c');break;case _0x0640('0x6d'):case _0x0640('0x6e'):_0xa9891d['Call_Result']=_0x0640('0x6f');break;case _0x0640('0x70'):_0xa9891d['Call_Result']=_0x0640('0x71');break;case'abandoned':_0xa9891d[_0x0640('0x6b')]=_0x0640('0x72');break;case _0x0640('0x73'):_0xa9891d[_0x0640('0x6b')]='Timeout';default:}_0xa9891d[_0x0640('0x74')]=(_0xd5cf5===_0x0640('0x75')?moment(_0xe6ea5c[_0x0640('0x76')])['format'](_0x0640('0x68')):moment(_0xe6ea5c[_0x0640('0x77')])[_0x0640('0x32')](_0x0640('0x68')))||moment()[_0x0640('0x32')](_0x0640('0x68'));_0xa9891d[_0x0640('0x78')]=_0xd5cf5||_0x0640('0x79');_0xa9891d=_[_0x0640('0x7a')](_0xa9891d,getCustomFields(_0x30cc34['Fields'],_0xe6ea5c));return request({'method':'POST','uri':_0x0640('0x42')+_0x59ab7a+_0x0640('0x7b'),'headers':{'Authorization':_0x0640('0x35')+_0x272517},'body':{'data':[_0xa9891d]},'json':!![]})[_0x0640('0x29')](function(_0xfb1600){if(_0xfb1600&&_0xfb1600[_0x0640('0x40')][0x0]['code']===_0x0640('0x48')){logger[_0x0640('0x30')](_0x0640('0x7c'));return{'id':_0xfb1600[_0x0640('0x40')][0x0][_0x0640('0x49')]['id']};}})['catch'](function(_0x460aba){logger[_0x0640('0x30')]('err',_0x460aba[_0x0640('0x2f')]);console[_0x0640('0x4c')](_0x0640('0x7d'),_0x460aba);});}exports[_0x0640('0x7e')]=function(_0x3fce20,_0x1816df,_0x5b0d21,_0x25286b,_0x1d3543,_0x40175b){var _0x4d729d,_0x657ec8,_0x4f3bee;_0x40175b[_0x0640('0x7f')]=intUtil[_0x0640('0x80')](_0x40175b[_0x0640('0x7f')]);_0x40175b[_0x0640('0x81')]=intUtil['stripTrailingSlash'](_0x40175b['serverUrl']);if(_0x1d3543&&_0x1d3543['monitor_format']){logger[_0x0640('0x30')](_0x0640('0x82'),'Recording\x20is\x20enabled!');_0x1816df[_0x0640('0x83')]=_0x40175b[_0x0640('0x81')]+'/api/voice/recordings/'+_0x1816df[_0x0640('0x84')]+_0x0640('0x85')+md5(_0x1816df[_0x0640('0x84')]);}else{_0x1816df[_0x0640('0x83')]='';}var _0x12736a=_0x40175b[_0x0640('0x7f')]===_0x0640('0x86')?'eu':_0x0640('0x87');return getAccessToken(_0x40175b)['then'](function(_0x17a1b4){_0x4f3bee=_0x17a1b4;return getUser(_0x4f3bee,_0x12736a,_0x40175b,_0x25286b['email']);})[_0x0640('0x29')](function(_0x559d03){_0x4d729d=_0x559d03;logger[_0x0640('0x30')]('The\x20User\x20ID\x20is:',_0x4d729d['id']);return getEndUser(_0x4f3bee,_0x12736a,_0x40175b,_0x1816df[_0x0640('0x88')],_0x1816df['calleridnum'],_0x4d729d,_0x5b0d21);})['then'](function(_0x3b8952){_0x657ec8=_0x3b8952;return getCall(_0x4f3bee,_0x12736a,_0x40175b,_0x4d729d,_0x657ec8,_0x5b0d21,_0x1816df,_0x0640('0x79'));})['then'](function(_0x5030e4){if(_0x5030e4){logger['info'](_0x0640('0x89'),_0x5030e4['id']);logger['info'](_0x0640('0x82'),_0x0640('0x8a'));emit(util[_0x0640('0x32')]('user:%s',_0x25286b[_0x0640('0x17')]),_0x0640('0x8b'),{'uri':_0x0640('0x8c')+_0x40175b['host']+_0x0640('0x8d')+_0x5030e4['id']});}})[_0x0640('0x2c')](function(_0x36a86c){logger[_0x0640('0x2d')]('[QUEUE]',JSON[_0x0640('0xc')](_0x36a86c));});};exports['outbound']=function(_0x24b218,_0x31e7df,_0x25ac29,_0xe0e093,_0x427e6b,_0x4466d4,_0x20ed55){var _0x518609,_0x514141,_0x5c1f26;_0x4466d4[_0x0640('0x7f')]=intUtil[_0x0640('0x80')](_0x4466d4['host']);_0x4466d4[_0x0640('0x81')]=intUtil[_0x0640('0x80')](_0x4466d4['serverUrl']);if(_0x20ed55&&_0x20ed55[_0x0640('0x8e')]&&_0x20ed55[_0x0640('0x8e')]!=='none'){logger['info'](_0x0640('0x8f'),_0x0640('0x90'));_0x31e7df[_0x0640('0x83')]=_0x4466d4[_0x0640('0x81')]+_0x0640('0x91')+_0x31e7df['uniqueid']+_0x0640('0x85')+md5(_0x31e7df[_0x0640('0x84')]);}var _0x1b65a8=_0x4466d4[_0x0640('0x7f')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x4466d4)[_0x0640('0x29')](function(_0x2ab18e){_0x5c1f26=_0x2ab18e;return getUser(_0x5c1f26,_0x1b65a8,_0x4466d4,_0xe0e093['email']);})[_0x0640('0x29')](function(_0x24dfec){_0x518609=_0x24dfec;logger[_0x0640('0x30')](_0x0640('0x92'),_0x518609['id']);return getEndUser(_0x5c1f26,_0x1b65a8,_0x4466d4,_0x31e7df[_0x0640('0x93')],_0x31e7df[_0x0640('0x94')],_0x518609,_0x25ac29);})[_0x0640('0x29')](function(_0x2116a4){_0x514141=_0x2116a4;return getCall(_0x5c1f26,_0x1b65a8,_0x4466d4,_0x518609,_0x514141,_0x25ac29,_0x31e7df,_0x0640('0x95'));})[_0x0640('0x29')](function(_0x3bcd20){if(_0x3bcd20){logger[_0x0640('0x30')](_0x0640('0x89'),_0x3bcd20['id']);logger[_0x0640('0x30')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x0640('0x96'),_0xe0e093[_0x0640('0x17')]),_0x0640('0x8b'),{'uri':'https://crm.'+_0x4466d4[_0x0640('0x7f')]+_0x0640('0x8d')+_0x3bcd20['id']});}})[_0x0640('0x2c')](function(_0x30b6f5){logger['error'](_0x0640('0x8f'),JSON[_0x0640('0xc')](_0x30b6f5));});};exports[_0x0640('0x97')]=function(_0x22ca9b,_0x271312,_0x5afbac,_0x192072,_0x575485,_0x4ebd13){var _0x479d0f,_0x436f4e,_0x32c1ac;_0x4ebd13[_0x0640('0x7f')]=intUtil['stripTrailingSlash'](_0x4ebd13[_0x0640('0x7f')]);_0x4ebd13['serverUrl']=intUtil[_0x0640('0x80')](_0x4ebd13[_0x0640('0x81')]);if(_0x575485&&_0x575485[_0x0640('0x98')]){logger[_0x0640('0x30')]('['+_0x271312[_0x0640('0x99')][_0x0640('0x9a')]()+']',_0x0640('0x90'));_0x271312['recordingURL']=_0x4ebd13[_0x0640('0x81')]+_0x0640('0x91')+_0x271312[_0x0640('0x84')]+_0x0640('0x85')+md5(_0x271312[_0x0640('0x84')]);}else{_0x271312[_0x0640('0x83')]='';}var _0x2f1010=_0x4ebd13[_0x0640('0x7f')]===_0x0640('0x86')?'eu':_0x0640('0x87');return getAccessToken(_0x4ebd13)[_0x0640('0x29')](function(_0x108e1d){_0x32c1ac=_0x108e1d;return getUser(_0x32c1ac,_0x2f1010,_0x4ebd13);})['then'](function(_0xa9897f){_0x479d0f=_0xa9897f;logger[_0x0640('0x30')](_0x0640('0x92'),_0x479d0f['id']);return getEndUser(_0x32c1ac,_0x2f1010,_0x4ebd13,_0x271312[_0x0640('0x88')],_0x271312['calleridnum'],_0x479d0f,_0x5afbac);})[_0x0640('0x29')](function(_0x19162c){_0x436f4e=_0x19162c;return getCall(_0x32c1ac,_0x2f1010,_0x4ebd13,_0x479d0f,_0x436f4e,_0x5afbac,_0x271312,_0x0640('0x79'));})[_0x0640('0x29')](function(_0x548f5d){if(_0x548f5d){logger[_0x0640('0x30')](_0x0640('0x89'),_0x548f5d['id']);}})[_0x0640('0x2c')](function(_0x393889){logger['error']('['+_0x271312[_0x0640('0x99')]['toUpperCase']()+']',JSON[_0x0640('0xc')](_0x393889));});}; \ 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 b9a8e08..46b2a73 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 _0x245a=['../../../../config/logger','exec','data2','Script','data3','render','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','util','shelljs','mustache'];(function(_0x49e340,_0xaeeafb){var _0x1c736a=function(_0x381eb0){while(--_0x381eb0){_0x49e340['push'](_0x49e340['shift']());}};_0x1c736a(++_0xaeeafb);}(_0x245a,0x141));var _0xa245=function(_0x1d28ec,_0x2c0be1){_0x1d28ec=_0x1d28ec-0x0;var _0x5dc011=_0x245a[_0x1d28ec];return _0x5dc011;};'use strict';var util=require(_0xa245('0x0'));var sh=require(_0xa245('0x1'));var Mustache=require(_0xa245('0x2'));var logger=require(_0xa245('0x3'))('trigger');exports[_0xa245('0x4')]=function(_0x546af3,_0x21cbe5){var _0x5d03b2=_0x546af3[_0xa245('0x5')]?_0x546af3[_0xa245('0x5')]:_0xa245('0x6');var _0x2ea9b4=_0x546af3[_0xa245('0x7')]?Mustache[_0xa245('0x8')](_0x546af3[_0xa245('0x7')],_0x21cbe5):_0x21cbe5;sh[_0xa245('0x4')](_0x2ea9b4,function(_0x4b74d7,_0x319149,_0x3c1437){if(_0x4b74d7!==0x0){logger['error'](util['format'](_0xa245('0x9'),_0x5d03b2,_0x2ea9b4,_0x4b74d7,_0x3c1437));}else{logger[_0xa245('0xa')](util[_0xa245('0xb')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x5d03b2,_0x2ea9b4,_0x319149));}});}; \ No newline at end of file +var _0xa3ad=['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','../../../../config/logger','exec','data2','Script','data3','render','error'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xa3ad,0x1ee));var _0xda3a=function(_0x3f4c15,_0x2c8025){_0x3f4c15=_0x3f4c15-0x0;var _0x546cfa=_0xa3ad[_0x3f4c15];return _0x546cfa;};'use strict';var util=require(_0xda3a('0x0'));var sh=require(_0xda3a('0x1'));var Mustache=require(_0xda3a('0x2'));var logger=require(_0xda3a('0x3'))('trigger');exports[_0xda3a('0x4')]=function(_0x1d4c0a,_0x420a54){var _0x11f3aa=_0x1d4c0a[_0xda3a('0x5')]?_0x1d4c0a['data2']:_0xda3a('0x6');var _0x3d6e82=_0x1d4c0a[_0xda3a('0x7')]?Mustache[_0xda3a('0x8')](_0x1d4c0a[_0xda3a('0x7')],_0x420a54):_0x420a54;sh['exec'](_0x3d6e82,function(_0x52e25c,_0x41402d,_0x2fea2f){if(_0x52e25c!==0x0){logger[_0xda3a('0x9')](util[_0xda3a('0xa')](_0xda3a('0xb'),_0x11f3aa,_0x3d6e82,_0x52e25c,_0x2fea2f));}else{logger[_0xda3a('0xc')](util[_0xda3a('0xa')](_0xda3a('0xd'),_0x11f3aa,_0x3d6e82,_0x41402d));}});}; \ 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 f48196d..934e634 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 _0x7a8f=['data7','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','data1','toUpperCase','render','data2','data5','headers','data6','parse','error','GET','DELETE','POST','PUT'];(function(_0x1b7980,_0xce7b6f){var _0x50d300=function(_0x4cc76a){while(--_0x4cc76a){_0x1b7980['push'](_0x1b7980['shift']());}};_0x50d300(++_0xce7b6f);}(_0x7a8f,0x95));var _0xf7a8=function(_0x4d05c2,_0x3a05fc){_0x4d05c2=_0x4d05c2-0x0;var _0x38512a=_0x7a8f[_0x4d05c2];return _0x38512a;};'use strict';var rp=require(_0xf7a8('0x0'));var util=require(_0xf7a8('0x1'));var _=require(_0xf7a8('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x37da95,_0x2285f6){var _0x28298a,_0x15a3e2;var _0x22112d={'method':_0x37da95[_0xf7a8('0x3')][_0xf7a8('0x4')](),'uri':Mustache[_0xf7a8('0x5')](_0x37da95[_0xf7a8('0x6')],_0x2285f6),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x37da95[_0xf7a8('0x7')])==='number'&&parseInt(_0x37da95[_0xf7a8('0x7')])>=0x1&&parseInt(_0x37da95[_0xf7a8('0x7')])<=0xa?parseInt(_0x37da95[_0xf7a8('0x7')])*0x3e8:0x5*0x3e8};try{_0x22112d[_0xf7a8('0x8')]=_0x37da95[_0xf7a8('0x9')]?JSON[_0xf7a8('0xa')](Mustache[_0xf7a8('0x5')](_0x37da95[_0xf7a8('0x9')],_0x2285f6)):{};}catch(_0x4d43da){logger[_0xf7a8('0xb')](_0x4d43da['stack']);}switch(_0x37da95[_0xf7a8('0x3')][_0xf7a8('0x4')]()){case _0xf7a8('0xc'):case _0xf7a8('0xd'):_0x28298a=null;_0x22112d['qs']=_0x2285f6;break;case _0xf7a8('0xe'):case _0xf7a8('0xf'):if(_0x37da95[_0xf7a8('0x10')]){try{_0x28298a=JSON['parse'](Mustache[_0xf7a8('0x5')](_0x37da95[_0xf7a8('0x10')],_0x2285f6));_0x22112d['body']=_0x28298a;}catch(_0x596791){logger[_0xf7a8('0xb')](_0x596791[_0xf7a8('0x11')]);logger[_0xf7a8('0xb')](_0xf7a8('0x12'));}}else{_0x28298a=_0x2285f6;_0x22112d[_0xf7a8('0x13')]=_0x28298a;}break;}logger[_0xf7a8('0x14')](util[_0xf7a8('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x37da95['data1'],_0x37da95[_0xf7a8('0x6')],JSON[_0xf7a8('0x16')](_0x22112d)));rp(_0x22112d)[_0xf7a8('0x17')](function(_0x34e9b9){_0x28298a=!_[_0xf7a8('0x18')](_0x28298a)?_0xf7a8('0x19')+_0x28298a:'';_0x15a3e2=typeof _0x34e9b9[_0xf7a8('0x13')]===_0xf7a8('0x1a')?JSON['stringify'](_0x34e9b9[_0xf7a8('0x13')]):_0x34e9b9['body'];logger[_0xf7a8('0x14')](util[_0xf7a8('0x15')](_0xf7a8('0x1b'),_0x37da95['data1'],_0x37da95[_0xf7a8('0x6')],_0x34e9b9[_0xf7a8('0x1c')],_0x15a3e2));})[_0xf7a8('0x1d')](function(_0x1fe081){logger[_0xf7a8('0xb')](util[_0xf7a8('0x15')](_0xf7a8('0x1e'),_0x37da95['data1'],_0x37da95[_0xf7a8('0x6')],_0x1fe081[_0xf7a8('0x1c')],_0x1fe081[_0xf7a8('0x1f')],_0x1fe081[_0xf7a8('0x20')]));});}; \ No newline at end of file +var _0x6a93=['util','lodash','mustache','../../../../config/logger','trigger','data1','render','data5','number','headers','data6','error','stack','toUpperCase','GET','DELETE','PUT','parse','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','message','request-promise'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6a93,0x8b));var _0x36a9=function(_0x4eec2b,_0x4cb198){_0x4eec2b=_0x4eec2b-0x0;var _0x10662c=_0x6a93[_0x4eec2b];return _0x10662c;};'use strict';var rp=require(_0x36a9('0x0'));var util=require(_0x36a9('0x1'));var _=require(_0x36a9('0x2'));var Mustache=require(_0x36a9('0x3'));var logger=require(_0x36a9('0x4'))(_0x36a9('0x5'));exports['exec']=function(_0x4be75d,_0x45dcdd){var _0x2428ac,_0xb78de1;var _0xe2031c={'method':_0x4be75d[_0x36a9('0x6')]['toUpperCase'](),'uri':Mustache[_0x36a9('0x7')](_0x4be75d['data2'],_0x45dcdd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4be75d[_0x36a9('0x8')])===_0x36a9('0x9')&&parseInt(_0x4be75d[_0x36a9('0x8')])>=0x1&&parseInt(_0x4be75d[_0x36a9('0x8')])<=0xa?parseInt(_0x4be75d[_0x36a9('0x8')])*0x3e8:0x5*0x3e8};try{_0xe2031c[_0x36a9('0xa')]=_0x4be75d[_0x36a9('0xb')]?JSON['parse'](Mustache['render'](_0x4be75d['data6'],_0x45dcdd)):{};}catch(_0x1e0ffd){logger[_0x36a9('0xc')](_0x1e0ffd[_0x36a9('0xd')]);}switch(_0x4be75d[_0x36a9('0x6')][_0x36a9('0xe')]()){case _0x36a9('0xf'):case _0x36a9('0x10'):_0x2428ac=null;_0xe2031c['qs']=_0x45dcdd;break;case'POST':case _0x36a9('0x11'):if(_0x4be75d['data7']){try{_0x2428ac=JSON[_0x36a9('0x12')](Mustache[_0x36a9('0x7')](_0x4be75d[_0x36a9('0x13')],_0x45dcdd));_0xe2031c[_0x36a9('0x14')]=_0x2428ac;}catch(_0x833ed){logger[_0x36a9('0xc')](_0x833ed['stack']);logger[_0x36a9('0xc')](_0x36a9('0x15'));}}else{_0x2428ac=_0x45dcdd;_0xe2031c['body']=_0x2428ac;}break;}logger[_0x36a9('0x16')](util[_0x36a9('0x17')](_0x36a9('0x18'),_0x4be75d[_0x36a9('0x6')],_0x4be75d[_0x36a9('0x19')],JSON['stringify'](_0xe2031c)));rp(_0xe2031c)[_0x36a9('0x1a')](function(_0x5a3d23){_0x2428ac=!_[_0x36a9('0x1b')](_0x2428ac)?_0x36a9('0x1c')+_0x2428ac:'';_0xb78de1=typeof _0x5a3d23['body']===_0x36a9('0x1d')?JSON[_0x36a9('0x1e')](_0x5a3d23['body']):_0x5a3d23[_0x36a9('0x14')];logger[_0x36a9('0x16')](util[_0x36a9('0x17')](_0x36a9('0x1f'),_0x4be75d[_0x36a9('0x6')],_0x4be75d[_0x36a9('0x19')],_0x5a3d23[_0x36a9('0x20')],_0xb78de1));})[_0x36a9('0x21')](function(_0x4dedf1){logger[_0x36a9('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4be75d['data1'],_0x4be75d[_0x36a9('0x19')],_0x4dedf1[_0x36a9('0x20')],_0x4dedf1['name'],_0x4dedf1[_0x36a9('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index d24e1d3..ddc747b 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 _0x4938=['jayson/promise','bluebird','../../config/logger','routing','http','request','then','debug','rpc','error','message','result','catch'];(function(_0x46aed3,_0x1331f2){var _0x22724e=function(_0x51e6c9){while(--_0x51e6c9){_0x46aed3['push'](_0x46aed3['shift']());}};_0x22724e(++_0x1331f2);}(_0x4938,0x145));var _0x8493=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x4938[_0x77773a];return _0x1091a2;};'use strict';var jayson=require(_0x8493('0x0'));var BPromise=require(_0x8493('0x1'));var logger=require(_0x8493('0x2'))(_0x8493('0x3'));var client=jayson['client'][_0x8493('0x4')]({'port':0x2329});client['Request']=function(_0x3604d2,_0x40d9f7){return new BPromise(function(_0x10a62b,_0x44e23f){return client[_0x8493('0x5')](_0x3604d2,_0x40d9f7)[_0x8493('0x6')](function(_0x3ffff1){logger[_0x8493('0x7')](_0x8493('0x8'),_0x8493('0x3'),_0x3604d2,_0x40d9f7,_0x3ffff1);if(_0x3ffff1[_0x8493('0x9')]){logger['error']('rpc','routing',_0x3604d2,_0x3ffff1[_0x8493('0x9')][_0x8493('0xa')],_0x40d9f7);return _0x44e23f(_0x3ffff1['error'][_0x8493('0xa')]);}else{return _0x10a62b(_0x3ffff1[_0x8493('0xb')]);}})[_0x8493('0xc')](function(_0x50c53c){logger['error'](_0x8493('0x8'),_0x8493('0x3'),_0x3604d2,_0x50c53c,_0x40d9f7);return _0x44e23f(_0x50c53c);});});};module['exports']=client; \ No newline at end of file +var _0xef6a=['http','Request','request','then','debug','error','result','catch','rpc','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x51bdda,_0x5666ca){var _0x998aab=function(_0x3f4029){while(--_0x3f4029){_0x51bdda['push'](_0x51bdda['shift']());}};_0x998aab(++_0x5666ca);}(_0xef6a,0x1bd));var _0xaef6=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xef6a[_0x17b6e3];return _0x3906f3;};'use strict';var jayson=require(_0xaef6('0x0'));var BPromise=require(_0xaef6('0x1'));var logger=require(_0xaef6('0x2'))(_0xaef6('0x3'));var client=jayson[_0xaef6('0x4')][_0xaef6('0x5')]({'port':0x2329});client[_0xaef6('0x6')]=function(_0x390ad4,_0x3eb765){return new BPromise(function(_0x29ca02,_0x58e2d1){return client[_0xaef6('0x7')](_0x390ad4,_0x3eb765)[_0xaef6('0x8')](function(_0x38a998){logger[_0xaef6('0x9')]('rpc',_0xaef6('0x3'),_0x390ad4,_0x3eb765,_0x38a998);if(_0x38a998[_0xaef6('0xa')]){logger[_0xaef6('0xa')]('rpc','routing',_0x390ad4,_0x38a998[_0xaef6('0xa')]['message'],_0x3eb765);return _0x58e2d1(_0x38a998['error']['message']);}else{return _0x29ca02(_0x38a998[_0xaef6('0xb')]);}})[_0xaef6('0xc')](function(_0x50f17a){logger['error'](_0xaef6('0xd'),_0xaef6('0x3'),_0x390ad4,_0x50f17a,_0x3eb765);return _0x58e2d1(_0x50f17a);});});};module[_0xaef6('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 7df37c2..839f07d 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 _0x1f51=['./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime'];(function(_0x422e2d,_0x482168){var _0x548f4b=function(_0x34b630){while(--_0x34b630){_0x422e2d['push'](_0x422e2d['shift']());}};_0x548f4b(++_0x482168);}(_0x1f51,0x7c));var _0x11f5=function(_0x196fb8,_0x669ab9){_0x196fb8=_0x196fb8-0x0;var _0x1b1963=_0x1f51[_0x196fb8];return _0x1b1963;};'use strict';var server=require(_0x11f5('0x0'));var Realtime=require(_0x11f5('0x1'));var EmailChannel=require(_0x11f5('0x2'));var mailAccount=require(_0x11f5('0x3'));var setting=require(_0x11f5('0x4'));var logger=require(_0x11f5('0x5'))(_0x11f5('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x11f5('0x7')]()[_0x11f5('0x8')](mailAccount[_0x11f5('0x9')]())[_0x11f5('0x8')](realtime[_0x11f5('0xa')]())[_0x11f5('0x8')](function(){email[_0x11f5('0xb')](realtime[_0x11f5('0xc')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x11f5('0x8')](function(){return initRealtime();})[_0x11f5('0x8')](function(){return setting[_0x11f5('0xd')]();})[_0x11f5('0x8')](function(_0xe71508){return setInterval(initRealtime,_0xe71508[_0x11f5('0xe')]*0x3e8);})[_0x11f5('0xf')](function(_0x4ce78f){logger[_0x11f5('0x10')](_0x11f5('0x11'),_0x4ce78f);});}main(); \ No newline at end of file +var _0x692b=['./server','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','initMailAccounts','then','refresh','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization'];(function(_0x4b4dd0,_0x4b7586){var _0x42da25=function(_0x48ed2c){while(--_0x48ed2c){_0x4b4dd0['push'](_0x4b4dd0['shift']());}};_0x42da25(++_0x4b7586);}(_0x692b,0x1a4));var _0xb692=function(_0xa58294,_0x13ab28){_0xa58294=_0xa58294-0x0;var _0x3c85fb=_0x692b[_0xa58294];return _0x3c85fb;};'use strict';var server=require(_0xb692('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xb692('0x1'));var mailAccount=require(_0xb692('0x2'));var setting=require(_0xb692('0x3'));var logger=require(_0xb692('0x4'))(_0xb692('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xb692('0x6')]()['then'](mailAccount['getMailAccounts']())['then'](realtime[_0xb692('0x7')]())[_0xb692('0x8')](function(){email[_0xb692('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xb692('0xa')](realtime,email)[_0xb692('0x8')](function(){return initRealtime();})['then'](function(){return setting[_0xb692('0xb')]();})[_0xb692('0x8')](function(_0x3a91c7){return setInterval(initRealtime,_0x3a91c7[_0xb692('0xc')]*0x3e8);})['catch'](function(_0xb5d616){logger[_0xb692('0xd')](_0xb692('0xe'),_0xb5d616);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index bcf3891..4400d51 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 _0x0719=['end','error','handleImapError','isNil','status','messages','firstName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','lodash','bluebird','md5','ioredis','../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','messageStatus','total','stringify','mailAccount:update','refresh','custom','provider','hasOwnProperty','box','handleImapBox','handleImapEmail','bind'];(function(_0x43e97d,_0x56a06b){var _0x424cd9=function(_0x4f574b){while(--_0x4f574b){_0x43e97d['push'](_0x43e97d['shift']());}};_0x424cd9(++_0x56a06b);}(_0x0719,0x12c));var _0x9071=function(_0x4a96d2,_0x3fe8f4){_0x4a96d2=_0x4a96d2-0x0;var _0x23e6b3=_0x0719[_0x4a96d2];return _0x23e6b3;};'use strict';var _=require(_0x9071('0x0'));var moment=require('moment');var BPromise=require(_0x9071('0x1'));var md5=require(_0x9071('0x2'));var Redis=require(_0x9071('0x3'));var config=require('../../../config/environment');var logger=require(_0x9071('0x4'))(_0x9071('0x5'));config['redis']=_[_0x9071('0x6')](config['redis'],{'host':_0x9071('0x7'),'port':0x18eb});var io=require(_0x9071('0x8'))(new Redis(config[_0x9071('0x9')]));var EmailImap=require(_0x9071('0xa'));var EmailSmtp=require(_0x9071('0xb'));var mailAccount=require(_0x9071('0xc'));var md5Accounts={};function EmailChannel(_0x81849a){logger[_0x9071('0xd')](_0x9071('0xe'));this[_0x9071('0xf')]=_0x81849a[_0x9071('0xf')];this[_0x9071('0x10')]={};this[_0x9071('0x11')]=new EmailSmtp();}EmailChannel[_0x9071('0x12')][_0x9071('0x13')]=function(_0x249a30){var _0x2fb519=this[_0x9071('0xf')][_0x249a30];var _0x5f484d={'id':_0x2fb519['id'],'name':_0x2fb519[_0x9071('0x14')],'key':_0x2fb519[_0x9071('0x15')],'active':_0x2fb519[_0x9071('0x16')],'Imap':{'status':_0x2fb519[_0x9071('0x17')]['status'],'messageStatus':_0x2fb519[_0x9071('0x17')][_0x9071('0x18')],'total':_0x2fb519['Imap'][_0x9071('0x19')]}};if(_['isNil'](md5Accounts[_0x249a30])){md5Accounts[_0x249a30]={};}var _0x2021eb=md5(JSON[_0x9071('0x1a')](_0x5f484d));if(md5Accounts[_0x249a30][_0x9071('0x2')]!==_0x2021eb){md5Accounts[_0x249a30]['md5']=_0x2021eb;io['emit'](_0x9071('0x1b'),_0x5f484d);}};EmailChannel[_0x9071('0x12')][_0x9071('0x1c')]=function(_0x8fbaaf){for(var _0x45530c in _0x8fbaaf){if(_0x8fbaaf['hasOwnProperty'](_0x45530c)){if(_0x8fbaaf[_0x45530c][_0x9071('0x17')]&&_0x8fbaaf[_0x45530c]['active']){var _0x1f08c9=_0x8fbaaf[_0x45530c][_0x9071('0x17')];if(!_0x1f08c9['service']&&_0x8fbaaf[_0x45530c]['provider']!==_0x9071('0x1d'))_0x1f08c9['service']=_0x8fbaaf[_0x45530c][_0x9071('0x1e')];if(!this['imapAccounts'][_0x9071('0x1f')](_0x1f08c9['id'])){this[_0x9071('0x10')][_0x1f08c9['id']]=new EmailImap(_0x1f08c9,_0x8fbaaf[_0x45530c][_0x9071('0x5')]);this[_0x9071('0x10')][_0x1f08c9['id']]['on'](_0x9071('0x20'),this[_0x9071('0x21')]['bind'](this,_0x45530c));this[_0x9071('0x10')][_0x1f08c9['id']]['on'](_0x9071('0x5'),this[_0x9071('0x22')][_0x9071('0x23')](this,_0x45530c));this['imapAccounts'][_0x1f08c9['id']]['on'](_0x9071('0x24'),this['handleImapEnd'][_0x9071('0x23')](this,_0x45530c));this[_0x9071('0x10')][_0x1f08c9['id']]['on'](_0x9071('0x25'),this[_0x9071('0x26')][_0x9071('0x23')](this,_0x45530c));}}else{if(_[_0x9071('0x27')](this[_0x9071('0xf')][_0x45530c][_0x9071('0x17')])){this[_0x9071('0xf')][_0x45530c][_0x9071('0x17')]={};}this[_0x9071('0xf')][_0x45530c][_0x9071('0x17')][_0x9071('0x28')]='disabled';this[_0x9071('0xf')][_0x45530c][_0x9071('0x17')][_0x9071('0x18')]='';this[_0x9071('0x13')](_0x45530c);}}}};EmailChannel[_0x9071('0x12')][_0x9071('0x21')]=function(_0x471881,_0x4bd049){if(this[_0x9071('0xf')][_0x471881]){this[_0x9071('0xf')][_0x471881][_0x9071('0x17')]['status']='connected';this['mailAccounts'][_0x471881][_0x9071('0x17')][_0x9071('0x18')]=_0x4bd049['name'];if(_0x4bd049[_0x9071('0x29')]){this['mailAccounts'][_0x471881]['Imap'][_0x9071('0x19')]=_0x4bd049[_0x9071('0x29')]['total'];}return this[_0x9071('0x13')](_0x471881);}};EmailChannel[_0x9071('0x12')][_0x9071('0x22')]=function(_0x16f7d9,_0x3021af){logger[_0x9071('0xd')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3021af[_0x9071('0x2a')],_0x3021af['lastName'],_0x3021af['from'],_0x16f7d9);if(this[_0x9071('0xf')][_0x16f7d9]){return mailAccount[_0x9071('0x2b')](_0x16f7d9,_0x3021af)[_0x9071('0x2c')](function(_0x166268){if(_0x166268){logger['info'](_0x9071('0x2d'));}})[_0x9071('0x2e')](function(_0x45dbdc){logger[_0x9071('0x25')](_0x9071('0x2f'),JSON[_0x9071('0x1a')](_0x45dbdc));});}};EmailChannel[_0x9071('0x12')][_0x9071('0x30')]=function(_0x404e44){if(this[_0x9071('0xf')][_0x404e44]&&this['mailAccounts'][_0x404e44][_0x9071('0x17')]){if(this[_0x9071('0x10')][this[_0x9071('0xf')][_0x404e44][_0x9071('0x17')]['id']]){delete this[_0x9071('0x10')][this['mailAccounts'][_0x404e44]['Imap']['id']];}this['mailAccounts'][_0x404e44][_0x9071('0x17')][_0x9071('0x31')]=moment();this[_0x9071('0x13')](_0x404e44);}};EmailChannel[_0x9071('0x12')][_0x9071('0x26')]=function(_0x585090,_0xfce44f){if(this[_0x9071('0xf')][_0x585090]){this[_0x9071('0xf')][_0x585090][_0x9071('0x17')][_0x9071('0x28')]=_0x9071('0x25');this[_0x9071('0xf')][_0x585090][_0x9071('0x17')][_0x9071('0x18')]=_0xfce44f;return this[_0x9071('0x13')](_0x585090);}};EmailChannel[_0x9071('0x12')][_0x9071('0x32')]=function(_0x1936ed,_0x1e3f5d){return this[_0x9071('0x11')][_0x9071('0x33')](_0x1936ed,_0x1e3f5d);};EmailChannel[_0x9071('0x12')][_0x9071('0x34')]=function(_0x3c9228){var _0x552d09=this;if(this[_0x9071('0xf')][_0x3c9228['id']]){if(_[_0x9071('0x27')](this[_0x9071('0xf')][_0x3c9228['id']][_0x9071('0x35')])){this[_0x9071('0xf')][_0x3c9228['id']][_0x9071('0x35')]={};}this[_0x9071('0xf')][_0x3c9228['id']]['Smtp']['lastSync']=moment();return new BPromise(function(_0x1a135e,_0x3fe078){return _0x552d09['smtp'][_0x9071('0x36')](_0x3c9228)[_0x9071('0x2c')](function(_0x6de721){_0x552d09[_0x9071('0xf')][_0x3c9228['id']][_0x9071('0x35')][_0x9071('0x28')]=_0x9071('0x37');_0x552d09[_0x9071('0xf')][_0x3c9228['id']][_0x9071('0x35')][_0x9071('0x18')]='';_0x552d09['emit'](_0x3c9228['id']);_0x1a135e(_0x6de721);})['catch'](function(_0x46f1b0){_0x552d09[_0x9071('0xf')][_0x3c9228['id']]['Smtp'][_0x9071('0x28')]=_0x9071('0x25');_0x552d09[_0x9071('0xf')][_0x3c9228['id']][_0x9071('0x35')][_0x9071('0x18')]=_0x46f1b0;_0x552d09['emit'](_0x3c9228['id']);_0x3fe078(_0x46f1b0);});});}return this[_0x9071('0x11')][_0x9071('0x36')](_0x3c9228);};module['exports']=EmailChannel; \ No newline at end of file +var _0x134d=['localhost','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','emit','key','status','Imap','messageStatus','total','isNil','stringify','hasOwnProperty','active','service','custom','provider','imapAccounts','box','handleImapBox','bind','end','handleImapEnd','handleImapError','disabled','prototype','name','messages','handleImapEmail','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','error','sendMail','smtp','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','defaults','redis'];(function(_0x562c3d,_0x35cb0b){var _0x247f47=function(_0x68dab6){while(--_0x68dab6){_0x562c3d['push'](_0x562c3d['shift']());}};_0x247f47(++_0x35cb0b);}(_0x134d,0x1bf));var _0xd134=function(_0x48b7e7,_0x51eae1){_0x48b7e7=_0x48b7e7-0x0;var _0xcb810e=_0x134d[_0x48b7e7];return _0xcb810e;};'use strict';var _=require(_0xd134('0x0'));var moment=require(_0xd134('0x1'));var BPromise=require(_0xd134('0x2'));var md5=require(_0xd134('0x3'));var Redis=require(_0xd134('0x4'));var config=require('../../../config/environment');var logger=require(_0xd134('0x5'))(_0xd134('0x6'));config['redis']=_[_0xd134('0x7')](config[_0xd134('0x8')],{'host':_0xd134('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xd134('0xa'));var EmailSmtp=require(_0xd134('0xb'));var mailAccount=require(_0xd134('0xc'));var md5Accounts={};function EmailChannel(_0x3c0d3f){logger['info'](_0xd134('0xd'));this['mailAccounts']=_0x3c0d3f[_0xd134('0xe')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0xd134('0xf')]=function(_0xbe4c10){var _0x4beee9=this[_0xd134('0xe')][_0xbe4c10];var _0x14dbba={'id':_0x4beee9['id'],'name':_0x4beee9['name'],'key':_0x4beee9[_0xd134('0x10')],'active':_0x4beee9['active'],'Imap':{'status':_0x4beee9['Imap'][_0xd134('0x11')],'messageStatus':_0x4beee9[_0xd134('0x12')][_0xd134('0x13')],'total':_0x4beee9[_0xd134('0x12')][_0xd134('0x14')]}};if(_[_0xd134('0x15')](md5Accounts[_0xbe4c10])){md5Accounts[_0xbe4c10]={};}var _0x343ca6=md5(JSON[_0xd134('0x16')](_0x14dbba));if(md5Accounts[_0xbe4c10]['md5']!==_0x343ca6){md5Accounts[_0xbe4c10]['md5']=_0x343ca6;io[_0xd134('0xf')]('mailAccount:update',_0x14dbba);}};EmailChannel['prototype']['refresh']=function(_0x579dcd){for(var _0x489e1f in _0x579dcd){if(_0x579dcd[_0xd134('0x17')](_0x489e1f)){if(_0x579dcd[_0x489e1f]['Imap']&&_0x579dcd[_0x489e1f][_0xd134('0x18')]){var _0x350d78=_0x579dcd[_0x489e1f]['Imap'];if(!_0x350d78[_0xd134('0x19')]&&_0x579dcd[_0x489e1f]['provider']!==_0xd134('0x1a'))_0x350d78[_0xd134('0x19')]=_0x579dcd[_0x489e1f][_0xd134('0x1b')];if(!this[_0xd134('0x1c')]['hasOwnProperty'](_0x350d78['id'])){this['imapAccounts'][_0x350d78['id']]=new EmailImap(_0x350d78,_0x579dcd[_0x489e1f][_0xd134('0x6')]);this[_0xd134('0x1c')][_0x350d78['id']]['on'](_0xd134('0x1d'),this[_0xd134('0x1e')][_0xd134('0x1f')](this,_0x489e1f));this[_0xd134('0x1c')][_0x350d78['id']]['on']('email',this['handleImapEmail']['bind'](this,_0x489e1f));this['imapAccounts'][_0x350d78['id']]['on'](_0xd134('0x20'),this[_0xd134('0x21')][_0xd134('0x1f')](this,_0x489e1f));this[_0xd134('0x1c')][_0x350d78['id']]['on']('error',this[_0xd134('0x22')][_0xd134('0x1f')](this,_0x489e1f));}}else{if(_['isNil'](this[_0xd134('0xe')][_0x489e1f][_0xd134('0x12')])){this[_0xd134('0xe')][_0x489e1f][_0xd134('0x12')]={};}this[_0xd134('0xe')][_0x489e1f][_0xd134('0x12')][_0xd134('0x11')]=_0xd134('0x23');this[_0xd134('0xe')][_0x489e1f][_0xd134('0x12')]['messageStatus']='';this[_0xd134('0xf')](_0x489e1f);}}}};EmailChannel[_0xd134('0x24')][_0xd134('0x1e')]=function(_0x3a680c,_0x167989){if(this[_0xd134('0xe')][_0x3a680c]){this[_0xd134('0xe')][_0x3a680c][_0xd134('0x12')][_0xd134('0x11')]='connected';this[_0xd134('0xe')][_0x3a680c][_0xd134('0x12')]['messageStatus']=_0x167989[_0xd134('0x25')];if(_0x167989[_0xd134('0x26')]){this['mailAccounts'][_0x3a680c][_0xd134('0x12')][_0xd134('0x14')]=_0x167989[_0xd134('0x26')]['total'];}return this[_0xd134('0xf')](_0x3a680c);}};EmailChannel['prototype'][_0xd134('0x27')]=function(_0x3ef366,_0x1ebec5){logger[_0xd134('0x28')](_0xd134('0x29'),_0x1ebec5[_0xd134('0x2a')],_0x1ebec5['lastName'],_0x1ebec5['from'],_0x3ef366);if(this[_0xd134('0xe')][_0x3ef366]){return mailAccount['notify'](_0x3ef366,_0x1ebec5)[_0xd134('0x2b')](function(_0x29f19e){if(_0x29f19e){logger['info'](_0xd134('0x2c'));}})[_0xd134('0x2d')](function(_0x313f8e){logger['error'](_0xd134('0x2e'),JSON[_0xd134('0x16')](_0x313f8e));});}};EmailChannel[_0xd134('0x24')]['handleImapEnd']=function(_0x449398){if(this[_0xd134('0xe')][_0x449398]&&this[_0xd134('0xe')][_0x449398]['Imap']){if(this[_0xd134('0x1c')][this['mailAccounts'][_0x449398]['Imap']['id']]){delete this[_0xd134('0x1c')][this['mailAccounts'][_0x449398][_0xd134('0x12')]['id']];}this[_0xd134('0xe')][_0x449398][_0xd134('0x12')][_0xd134('0x2f')]=moment();this[_0xd134('0xf')](_0x449398);}};EmailChannel['prototype'][_0xd134('0x22')]=function(_0x19850a,_0x1039c9){if(this['mailAccounts'][_0x19850a]){this[_0xd134('0xe')][_0x19850a]['Imap'][_0xd134('0x11')]=_0xd134('0x30');this[_0xd134('0xe')][_0x19850a]['Imap'][_0xd134('0x13')]=_0x1039c9;return this[_0xd134('0xf')](_0x19850a);}};EmailChannel[_0xd134('0x24')][_0xd134('0x31')]=function(_0x54e126,_0x3ca010){return this[_0xd134('0x32')][_0xd134('0x33')](_0x54e126,_0x3ca010);};EmailChannel['prototype'][_0xd134('0x34')]=function(_0x2c4174){var _0x393cf8=this;if(this['mailAccounts'][_0x2c4174['id']]){if(_[_0xd134('0x15')](this[_0xd134('0xe')][_0x2c4174['id']][_0xd134('0x35')])){this[_0xd134('0xe')][_0x2c4174['id']][_0xd134('0x35')]={};}this['mailAccounts'][_0x2c4174['id']]['Smtp'][_0xd134('0x2f')]=moment();return new BPromise(function(_0x267f27,_0x5d45ec){return _0x393cf8[_0xd134('0x32')][_0xd134('0x36')](_0x2c4174)['then'](function(_0x330c7e){_0x393cf8['mailAccounts'][_0x2c4174['id']]['Smtp'][_0xd134('0x11')]=_0xd134('0x37');_0x393cf8[_0xd134('0xe')][_0x2c4174['id']][_0xd134('0x35')][_0xd134('0x13')]='';_0x393cf8['emit'](_0x2c4174['id']);_0x267f27(_0x330c7e);})['catch'](function(_0x37a67e){_0x393cf8['mailAccounts'][_0x2c4174['id']][_0xd134('0x35')][_0xd134('0x11')]='error';_0x393cf8[_0xd134('0xe')][_0x2c4174['id']][_0xd134('0x35')]['messageStatus']=_0x37a67e;_0x393cf8[_0xd134('0xf')](_0x2c4174['id']);_0x5d45ec(_0x37a67e);});});}return this[_0xd134('0x32')][_0xd134('0x36')](_0x2c4174);};module[_0xd134('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 1736a03..ffd9df5 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 _0xafc4=['connect','inherits','prototype','getAccount','connTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','required','handleOpenBox','emit','box','readUnseen','handleCloseBox','end','search','UNSEEN','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','upperFirst','exports','lodash','imap','simpleParser','iconv','Iconv','events','email','mailbox','INBOX','account','once','ready','handleReady','handleEnd','bind','error','handleError'];(function(_0x24679e,_0x22d9d7){var _0x291f21=function(_0x329529){while(--_0x329529){_0x24679e['push'](_0x24679e['shift']());}};_0x291f21(++_0x22d9d7);}(_0xafc4,0x69));var _0x4afc=function(_0x45b4c3,_0x11bbb2){_0x45b4c3=_0x45b4c3-0x0;var _0x2427b0=_0xafc4[_0x45b4c3];return _0x2427b0;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var Imap=require(_0x4afc('0x1'));var simpleParser=require('mailparser')[_0x4afc('0x2')];var Iconv=require(_0x4afc('0x3'))[_0x4afc('0x4')];var EventEmitter=require(_0x4afc('0x5'))['EventEmitter'];var utils=require('./utils');var logger=require('../../../config/logger')(_0x4afc('0x6'));function EmailImap(_0x471d45,_0x16953b){this[_0x4afc('0x7')]=_0x4afc('0x8');this[_0x4afc('0x9')]=this['getAccount'](_0x471d45,_0x16953b);this[_0x4afc('0x1')]=new Imap(this[_0x4afc('0x9')]);this[_0x4afc('0x1')][_0x4afc('0xa')](_0x4afc('0xb'),this[_0x4afc('0xc')]['bind'](this));this['imap'][_0x4afc('0xa')]('end',this[_0x4afc('0xd')][_0x4afc('0xe')](this));this['imap']['on'](_0x4afc('0xf'),this[_0x4afc('0x10')][_0x4afc('0xe')](this));this[_0x4afc('0x1')][_0x4afc('0x11')]();}util[_0x4afc('0x12')](EmailImap,EventEmitter);EmailImap[_0x4afc('0x13')][_0x4afc('0x14')]=function(_0x5effb4,_0x26f3f1){var _0x429fd8={'connTimeout':_0x5effb4[_0x4afc('0x15')]?_0x5effb4[_0x4afc('0x15')]*0x3e8:0x2710,'authTimeout':_0x5effb4['authTimeout']?_0x5effb4['authTimeout']*0x3e8:0x1388};if(_0x5effb4[_0x4afc('0x16')]){_0x429fd8['user']=_0x5effb4[_0x4afc('0x17')];_0x429fd8[_0x4afc('0x6')]=_0x26f3f1||_0x5effb4[_0x4afc('0x17')]||_0x4afc('0x18');if(_0x5effb4[_0x4afc('0x19')]){_0x429fd8[_0x4afc('0x1a')]=utils[_0x4afc('0x1b')](_0x5effb4[_0x4afc('0x1c')][_0x4afc('0x1d')],_0x5effb4[_0x4afc('0x17')]);}else{_0x429fd8[_0x4afc('0x1e')]=_0x5effb4['password'];}}else{if(_0x5effb4[_0x4afc('0x1f')]){_0x429fd8[_0x4afc('0x17')]=_0x5effb4[_0x4afc('0x17')];_0x429fd8[_0x4afc('0x1e')]=_0x5effb4['password'];}}_0x429fd8[_0x4afc('0x20')]=_0x5effb4[_0x4afc('0x20')];_0x429fd8[_0x4afc('0x21')]=_0x5effb4[_0x4afc('0x21')]||0x3e1;if(_0x5effb4[_0x4afc('0x22')]){_0x429fd8[_0x4afc('0x22')]=!![];}else{_0x429fd8[_0x4afc('0x22')]=![];_0x429fd8['autotls']=_0x4afc('0x23');}return _0x429fd8;};EmailImap[_0x4afc('0x13')]['handleReady']=function(){this[_0x4afc('0x1')]['openBox'](this[_0x4afc('0x7')],![],this[_0x4afc('0x24')][_0x4afc('0xe')](this));};EmailImap[_0x4afc('0x13')][_0x4afc('0x24')]=function(_0x28a86c,_0x40a0db){if(_0x28a86c){this[_0x4afc('0x10')](_0x28a86c,!![]);}else{this[_0x4afc('0x25')](_0x4afc('0x26'),_0x40a0db);this[_0x4afc('0x27')]();}};EmailImap[_0x4afc('0x13')][_0x4afc('0x28')]=function(_0x55842c){if(_0x55842c){this[_0x4afc('0x10')](_0x55842c,!![]);}else{this[_0x4afc('0x1')][_0x4afc('0x29')]();}};EmailImap['prototype']['readUnseen']=function(){this['imap'][_0x4afc('0x2a')]([_0x4afc('0x2b')],this['handleReadUnseen'][_0x4afc('0xe')](this));};EmailImap[_0x4afc('0x13')]['handleReadUnseen']=function(_0x514278,_0x52e3dd){if(_0x514278){this[_0x4afc('0x10')](_0x514278,!![]);}else{if(_0x52e3dd[_0x4afc('0x2c')]){try{var _0x17a43d=this[_0x4afc('0x1')][_0x4afc('0x2d')](_0x52e3dd,{'bodies':'','markSeen':!![]});_0x17a43d['on'](_0x4afc('0x2e'),this['handleFetchMessage'][_0x4afc('0xe')](this));_0x17a43d[_0x4afc('0xa')](_0x4afc('0xf'),this[_0x4afc('0x2f')][_0x4afc('0xe')](this));_0x17a43d[_0x4afc('0xa')](_0x4afc('0x29'),this[_0x4afc('0x30')]['bind'](this));}catch(_0x1383cf){logger['error'](_0x1383cf);}}else{this['imap'][_0x4afc('0x31')](!![],this[_0x4afc('0x28')][_0x4afc('0xe')](this));}}};EmailImap[_0x4afc('0x13')][_0x4afc('0x32')]=function(_0x3f50cc){_0x3f50cc['on']('body',this[_0x4afc('0x33')][_0x4afc('0xe')](this));_0x3f50cc[_0x4afc('0xa')](_0x4afc('0x34'),this[_0x4afc('0x35')][_0x4afc('0xe')](this));_0x3f50cc['once'](_0x4afc('0x29'),this[_0x4afc('0x36')][_0x4afc('0xe')](this));};EmailImap[_0x4afc('0x13')]['handleMessageBody']=function(_0x4be1e6){simpleParser(_0x4be1e6,{'Iconv':Iconv},this[_0x4afc('0x37')][_0x4afc('0xe')](this));};EmailImap[_0x4afc('0x13')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x4afc('0x36')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x295b53,_0x1dc853){if(_0x295b53){logger[_0x4afc('0xf')](_0x295b53);}else{var _0x3e41f5=this;utils[_0x4afc('0x38')](this[_0x4afc('0x9')],_0x1dc853,function(_0x453e12){_0x3e41f5[_0x4afc('0x25')](_0x4afc('0x6'),_0x453e12);});}};EmailImap[_0x4afc('0x13')][_0x4afc('0x30')]=function(){this[_0x4afc('0x1')][_0x4afc('0x31')](!![],this[_0x4afc('0x28')][_0x4afc('0xe')](this));};EmailImap['prototype'][_0x4afc('0x2f')]=function(_0x6a8345){this[_0x4afc('0x10')](_0x6a8345);this[_0x4afc('0x1')][_0x4afc('0x31')](!![],this[_0x4afc('0x28')][_0x4afc('0xe')](this));};EmailImap['prototype']['handleEnd']=function(){this['emit'](_0x4afc('0x29'));};EmailImap[_0x4afc('0x13')]['handleError']=function(_0xe62748,_0x38a1bb){logger[_0x4afc('0xf')](_0x4afc('0x10'),this['account'][_0x4afc('0x6')],JSON[_0x4afc('0x39')](_0xe62748));var _0x348bc1='';if(_0xe62748){if(_0xe62748[_0x4afc('0x3a')]){_0x348bc1=_0xe62748[_0x4afc('0x3a')];}else{for(var _0x2404fc in _0xe62748){if(_0xe62748['hasOwnProperty'](_0x2404fc)){_0x348bc1+=_[_0x4afc('0x3b')](_0x2404fc)+':\x20'+_0xe62748[_0x2404fc]+'\x0a';}}}}if(_0x38a1bb){this['imap'][_0x4afc('0x29')]();}else{this[_0x4afc('0x25')](_0x4afc('0xf'),_0x348bc1);this['emit']('end');}};module[_0x4afc('0x3c')]=EmailImap; \ No newline at end of file +var _0x0af5=['generateXOAuth2Token','CloudProvider','data5','password','host','port','tls','autotls','required','prototype','openBox','mailbox','handleOpenBox','box','readUnseen','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','textCode','upperFirst','exports','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','connTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2'];(function(_0x47a9ce,_0x1fbda6){var _0x320567=function(_0x2b1abb){while(--_0x2b1abb){_0x47a9ce['push'](_0x47a9ce['shift']());}};_0x320567(++_0x1fbda6);}(_0x0af5,0x158));var _0x50af=function(_0x9faf84,_0x58c079){_0x9faf84=_0x9faf84-0x0;var _0x5aaa3a=_0x0af5[_0x9faf84];return _0x5aaa3a;};'use strict';var _=require('lodash');var util=require(_0x50af('0x0'));var Imap=require(_0x50af('0x1'));var simpleParser=require(_0x50af('0x2'))[_0x50af('0x3')];var Iconv=require(_0x50af('0x4'))[_0x50af('0x5')];var EventEmitter=require(_0x50af('0x6'))[_0x50af('0x7')];var utils=require(_0x50af('0x8'));var logger=require(_0x50af('0x9'))(_0x50af('0xa'));function EmailImap(_0xe37b1,_0x5e94f8){this['mailbox']=_0x50af('0xb');this[_0x50af('0xc')]=this['getAccount'](_0xe37b1,_0x5e94f8);this['imap']=new Imap(this[_0x50af('0xc')]);this[_0x50af('0x1')]['once']('ready',this[_0x50af('0xd')][_0x50af('0xe')](this));this['imap'][_0x50af('0xf')](_0x50af('0x10'),this[_0x50af('0x11')][_0x50af('0xe')](this));this['imap']['on'](_0x50af('0x12'),this[_0x50af('0x13')][_0x50af('0xe')](this));this[_0x50af('0x1')][_0x50af('0x14')]();}util[_0x50af('0x15')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x569851,_0x620389){var _0x561cd2={'connTimeout':_0x569851[_0x50af('0x16')]?_0x569851[_0x50af('0x16')]*0x3e8:0x2710,'authTimeout':_0x569851['authTimeout']?_0x569851['authTimeout']*0x3e8:0x1388};if(_0x569851[_0x50af('0x17')]){_0x561cd2[_0x50af('0x18')]=_0x569851['user'];_0x561cd2['email']=_0x620389||_0x569851[_0x50af('0x18')]||_0x50af('0x19');if(_0x569851[_0x50af('0x1a')]){_0x561cd2[_0x50af('0x1b')]=utils[_0x50af('0x1c')](_0x569851[_0x50af('0x1d')][_0x50af('0x1e')],_0x569851[_0x50af('0x18')]);}else{_0x561cd2[_0x50af('0x1f')]=_0x569851[_0x50af('0x1f')];}}else{if(_0x569851['authentication']){_0x561cd2[_0x50af('0x18')]=_0x569851[_0x50af('0x18')];_0x561cd2[_0x50af('0x1f')]=_0x569851[_0x50af('0x1f')];}}_0x561cd2['host']=_0x569851[_0x50af('0x20')];_0x561cd2[_0x50af('0x21')]=_0x569851[_0x50af('0x21')]||0x3e1;if(_0x569851[_0x50af('0x22')]){_0x561cd2[_0x50af('0x22')]=!![];}else{_0x561cd2[_0x50af('0x22')]=![];_0x561cd2[_0x50af('0x23')]=_0x50af('0x24');}return _0x561cd2;};EmailImap[_0x50af('0x25')][_0x50af('0xd')]=function(){this['imap'][_0x50af('0x26')](this[_0x50af('0x27')],![],this[_0x50af('0x28')][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x28')]=function(_0x4db72d,_0xb3c15a){if(_0x4db72d){this[_0x50af('0x13')](_0x4db72d,!![]);}else{this['emit'](_0x50af('0x29'),_0xb3c15a);this[_0x50af('0x2a')]();}};EmailImap[_0x50af('0x25')]['handleCloseBox']=function(_0x53af9d){if(_0x53af9d){this[_0x50af('0x13')](_0x53af9d,!![]);}else{this[_0x50af('0x1')][_0x50af('0x10')]();}};EmailImap[_0x50af('0x25')][_0x50af('0x2a')]=function(){this[_0x50af('0x1')][_0x50af('0x2b')]([_0x50af('0x2c')],this['handleReadUnseen'][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x2d')]=function(_0x4db406,_0x43f1c8){if(_0x4db406){this['handleError'](_0x4db406,!![]);}else{if(_0x43f1c8[_0x50af('0x2e')]){try{var _0x52d65a=this['imap']['fetch'](_0x43f1c8,{'bodies':'','markSeen':!![]});_0x52d65a['on'](_0x50af('0x2f'),this[_0x50af('0x30')][_0x50af('0xe')](this));_0x52d65a[_0x50af('0xf')](_0x50af('0x12'),this[_0x50af('0x31')][_0x50af('0xe')](this));_0x52d65a[_0x50af('0xf')](_0x50af('0x10'),this[_0x50af('0x32')]['bind'](this));}catch(_0x4ad19b){logger[_0x50af('0x12')](_0x4ad19b);}}else{this[_0x50af('0x1')][_0x50af('0x33')](!![],this[_0x50af('0x34')]['bind'](this));}}};EmailImap[_0x50af('0x25')]['handleFetchMessage']=function(_0x5ac19f){_0x5ac19f['on']('body',this[_0x50af('0x35')][_0x50af('0xe')](this));_0x5ac19f[_0x50af('0xf')](_0x50af('0x36'),this[_0x50af('0x37')]['bind'](this));_0x5ac19f['once'](_0x50af('0x10'),this[_0x50af('0x38')][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x35')]=function(_0x5560e8){simpleParser(_0x5560e8,{'Iconv':Iconv},this[_0x50af('0x39')][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x37')]=function(){};EmailImap['prototype'][_0x50af('0x38')]=function(){};EmailImap[_0x50af('0x25')][_0x50af('0x39')]=function(_0x4bab50,_0x220fd8){if(_0x4bab50){logger['error'](_0x4bab50);}else{var _0x50ce3f=this;utils['parser'](this[_0x50af('0xc')],_0x220fd8,function(_0x35d38f){_0x50ce3f[_0x50af('0x3a')](_0x50af('0xa'),_0x35d38f);});}};EmailImap[_0x50af('0x25')][_0x50af('0x32')]=function(){this[_0x50af('0x1')][_0x50af('0x33')](!![],this[_0x50af('0x34')][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x31')]=function(_0x42fc7d){this[_0x50af('0x13')](_0x42fc7d);this[_0x50af('0x1')][_0x50af('0x33')](!![],this['handleCloseBox'][_0x50af('0xe')](this));};EmailImap[_0x50af('0x25')][_0x50af('0x11')]=function(){this['emit']('end');};EmailImap[_0x50af('0x25')][_0x50af('0x13')]=function(_0x18f9dc,_0x456d1c){logger[_0x50af('0x12')](_0x50af('0x13'),this[_0x50af('0xc')][_0x50af('0xa')],JSON['stringify'](_0x18f9dc));var _0x59e451='';if(_0x18f9dc){if(_0x18f9dc[_0x50af('0x3b')]){_0x59e451=_0x18f9dc[_0x50af('0x3b')];}else{for(var _0x52fcb4 in _0x18f9dc){if(_0x18f9dc['hasOwnProperty'](_0x52fcb4)){_0x59e451+=_[_0x50af('0x3c')](_0x52fcb4)+':\x20'+_0x18f9dc[_0x52fcb4]+'\x0a';}}}}if(_0x456d1c){this[_0x50af('0x1')][_0x50af('0x10')]();}else{this['emit'](_0x50af('0x12'),_0x59e451);this[_0x50af('0x3a')](_0x50af('0x10'));}};module[_0x50af('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 808dccd..d9343f8 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 _0x16a8=['verify','toString','Not\x20verifired','nodemailer','prototype','send','createTransport','use','compile','sendMail'];(function(_0xf07ddf,_0x146cb6){var _0x7aef5=function(_0x519bd8){while(--_0x519bd8){_0xf07ddf['push'](_0xf07ddf['shift']());}};_0x7aef5(++_0x146cb6);}(_0x16a8,0x107));var _0x816a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x16a8[_0x4b369d];return _0x571a98;};'use strict';var nodemailer=require(_0x816a('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x816a('0x1')][_0x816a('0x2')]=function(_0x7dfb28,_0x10a95f){return new Promise(function(_0x1c0538,_0x50aa24){var _0x47d931=nodemailer[_0x816a('0x3')](_0x7dfb28);_0x47d931[_0x816a('0x4')](_0x816a('0x5'),inlineBase64());_0x47d931[_0x816a('0x6')](_0x10a95f,function(_0x292bd2,_0x242161){if(_0x292bd2){_0x50aa24(_0x292bd2['toString']());}else{_0x1c0538(_0x242161);}});});};EmailSmtp[_0x816a('0x1')][_0x816a('0x7')]=function(_0x1dc9c4){return new Promise(function(_0x572ad5,_0x20fdbb){var _0x284aaa=nodemailer[_0x816a('0x3')](_0x1dc9c4);_0x284aaa[_0x816a('0x7')](function(_0x5b5b7f,_0x30a858){if(_0x5b5b7f){_0x20fdbb(_0x5b5b7f[_0x816a('0x8')]());}else{if(_0x30a858){_0x572ad5(_0x30a858);}else{_0x20fdbb(_0x816a('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0xf717=['compile','toString','verify','createTransport','nodemailer','nodemailer-plugin-inline-base64','prototype','send'];(function(_0x4fb432,_0x32e550){var _0x1d6454=function(_0x4d202e){while(--_0x4d202e){_0x4fb432['push'](_0x4fb432['shift']());}};_0x1d6454(++_0x32e550);}(_0xf717,0x13c));var _0x7f71=function(_0x84d960,_0x3dc95f){_0x84d960=_0x84d960-0x0;var _0x493ee0=_0xf717[_0x84d960];return _0x493ee0;};'use strict';var nodemailer=require(_0x7f71('0x0'));var inlineBase64=require(_0x7f71('0x1'));function EmailSmtp(){}EmailSmtp[_0x7f71('0x2')][_0x7f71('0x3')]=function(_0x2faa38,_0x4b599b){return new Promise(function(_0x38d443,_0x50306e){var _0xbcaaed=nodemailer['createTransport'](_0x2faa38);_0xbcaaed['use'](_0x7f71('0x4'),inlineBase64());_0xbcaaed['sendMail'](_0x4b599b,function(_0x45ae20,_0x66b54e){if(_0x45ae20){_0x50306e(_0x45ae20[_0x7f71('0x5')]());}else{_0x38d443(_0x66b54e);}});});};EmailSmtp[_0x7f71('0x2')][_0x7f71('0x6')]=function(_0x39fab2){return new Promise(function(_0x5032a5,_0x3b9a64){var _0x2eb446=nodemailer[_0x7f71('0x7')](_0x39fab2);_0x2eb446['verify'](function(_0x19ad56,_0x2c521b){if(_0x19ad56){_0x3b9a64(_0x19ad56[_0x7f71('0x5')]());}else{if(_0x2c521b){_0x5032a5(_0x2c521b);}else{_0x3b9a64('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a1ddbb7..37238ea 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 _0x8c5d=['server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','line','isAutoreply','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','filter','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Data','auth=Bearer\x20','utf-8','base64','lodash','moment','path','util','node-tnef','../../../config/logger','../../../config/environment','head','address','generate','@xcally.com','value','name','indexOf','slice','join','Anonymous','split','length','anonymous','html','test','replace','','body','textAsHtml','0x1?_0x33d610[_0xd8c5('0xe')](0x0,-0x1)[_0xd8c5('0xf')]('\x20'):_0x594bc4[_0xd8c5('0xc')];}return _0xd8c5('0x10');}function getLastName(_0xd361e5){var _0x33c0d9=_['head'](_0xd361e5['value']);if(_0x33c0d9&&_0x33c0d9[_0xd8c5('0xc')]){var _0x3977ff=_0x33c0d9[_0xd8c5('0xc')][_0xd8c5('0x11')](/\s+/);return _0x3977ff['length']>0x1?_0x3977ff['pop']():'';}return'';}function getMails(_0x214d10,_0x39a344){var _0x573295='';for(var _0x2cfac4=0x0;_0x2cfac4<_0x39a344[_0xd8c5('0xb')][_0xd8c5('0x12')];_0x2cfac4+=0x1){if(_0x39a344['value'][_0x2cfac4][_0xd8c5('0x8')]!==_0x214d10){if(!_['isEmpty'](_0x573295)){_0x573295+=',';}_0x573295+=_0x39a344[_0xd8c5('0xb')][_0x2cfac4][_0xd8c5('0xc')]||_0x39a344[_0xd8c5('0xb')][_0x2cfac4][_0xd8c5('0x8')]||'';_0x573295+='\x20<';_0x573295+=_0x39a344[_0xd8c5('0xb')][_0x2cfac4][_0xd8c5('0x8')]?_0x39a344['value'][_0x2cfac4][_0xd8c5('0x8')]:_0xd8c5('0x13')+random[_0xd8c5('0x9')](0x6)+'@xcally.com';_0x573295+='>';}}return _0x573295;}function parseEmail(_0x31b5c9,_0x2c7f16,_0x465802){if(_0x2c7f16[_0xd8c5('0x14')]){var _0x36735b=/)<[^<]*)*<\/script>/gi;while(_0x36735b[_0xd8c5('0x15')](_0x2c7f16[_0xd8c5('0x14')])){_0x2c7f16[_0xd8c5('0x14')]=_0x2c7f16[_0xd8c5('0x14')][_0xd8c5('0x16')](_0x36735b,'');}if(_0x2c7f16[_0xd8c5('0x14')]['includes'](_0xd8c5('0x17'))){var _0x3a5ae2=[];_0x2c7f16[_0xd8c5('0x18')]['forEach'](_0x4a5020=>{_0x3a5ae2[_0xd8c5('0x19')](_0x4a5020[_0xd8c5('0x1a')]);});var _0x5b668c=/]+>/g;var _0x16787c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1c41a8=_0x2c7f16[_0xd8c5('0x14')]['replace'](_0x16787c,_0xd8c5('0x1b'));var _0x47fd86=_0x1c41a8[_0xd8c5('0x16')](_0x5b668c,_0xd8c5('0x1c'));for(let _0x43f97b=0x0;_0x43f97b<_0x3a5ae2['length'];_0x43f97b++){var _0x864bbc=_0x47fd86[_0xd8c5('0x16')]('_IMG','\x20[Attachment:\x20'+_0x3a5ae2[_0x43f97b]+_0xd8c5('0x1d'));_0x47fd86=_0x864bbc;}_0x2c7f16[_0xd8c5('0x14')]=_0x47fd86;}_0x465802[_0xd8c5('0x1e')]=_0x2c7f16[_0xd8c5('0x14')];}else{_0x465802['body']=_0x2c7f16[_0xd8c5('0x1f')];}if(_0x465802['body']){_0x465802[_0xd8c5('0x1e')]=_0x465802[_0xd8c5('0x1e')][_0xd8c5('0x16')](/0x0){var _0x56b140=[_0xd8c5('0x33'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x59bf10=0x0;_0x59bf10<_0x2c7f16[_0xd8c5('0x32')][_0xd8c5('0x12')];_0x59bf10++){var _0x209566=_['indexOf'](_0x56b140,_0x2c7f16['headerLines'][_0x59bf10][_0xd8c5('0x34')]);if(_0x209566>=0x0){_0x465802[_0xd8c5('0x35')]=!![];}}}return _0x465802;}exports['parser']=function(_0xf95645,_0x3f1f78,_0x2f4917){var _0x2dcb9a={'from':getAddress(_0x3f1f78[_0xd8c5('0x36')]),'firstName':getFirstName(_0x3f1f78[_0xd8c5('0x36')]),'lastName':getLastName(_0x3f1f78[_0xd8c5('0x36')]),'mapKey':_0xd8c5('0x23'),'message':{'from':getMails(_0xf95645[_0xd8c5('0x23')],_0x3f1f78[_0xd8c5('0x36')]),'to':_0xf95645[_0xd8c5('0x23')],'cc':'','subject':_0x3f1f78[_0xd8c5('0x37')]||'','messageId':_0x3f1f78[_0xd8c5('0x38')],'inReplyTo':_0x3f1f78['inReplyTo'],'sentAt':moment(_0x3f1f78[_0xd8c5('0x39')])[_0xd8c5('0x2a')](_0xd8c5('0x3a')),'attach':![],'attachments':[]}};if(!_0x3f1f78['html']&&!_0x3f1f78[_0xd8c5('0x1f')]){var _0x53cb2f=_[_0xd8c5('0x3b')](_0x3f1f78['attachments'],{'contentType':'application/ms-tnef'});if(_0x53cb2f[_0xd8c5('0x12')]){logger['info'](util[_0xd8c5('0x2a')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x3f1f78[_0xd8c5('0x38')]));tnef[_0xd8c5('0x3c')](_[_0xd8c5('0x3d')](_0x53cb2f)[_0xd8c5('0x30')],function(_0x38a930,_0x337d5d){if(_0x337d5d){_0x3f1f78[_0xd8c5('0x14')]=_0x337d5d[_0xd8c5('0x3e')]||_0xd8c5('0x3f');if(_0x337d5d[_0xd8c5('0x40')]){for(var _0x1c9117=0x0;_0x1c9117<_0x337d5d['Attachments'][_0xd8c5('0x12')];_0x1c9117++){var _0x25b96f=_0x337d5d[_0xd8c5('0x40')][_0x1c9117];_0x2dcb9a[_0xd8c5('0x21')][_0xd8c5('0x18')][_0xd8c5('0x19')]({'filename':_0x25b96f['Title'],'content':Buffer['from'](_0x25b96f[_0xd8c5('0x41')])});}}}_0x2f4917(parseEmail(_0xf95645,_0x3f1f78,_0x2dcb9a));});}else{_0x3f1f78[_0xd8c5('0x14')]=_0xd8c5('0x3f');_0x2f4917(parseEmail(_0xf95645,_0x3f1f78,_0x2dcb9a));}}else{_0x2f4917(parseEmail(_0xf95645,_0x3f1f78,_0x2dcb9a));}};exports['generateXOAuth2Token']=function(_0x268bd6,_0x1fa06e){var _0x248e8f=['user='+(_0x1fa06e||''),_0xd8c5('0x42')+_0x268bd6,'',''];return Buffer[_0xd8c5('0x36')](_0x248e8f[_0xd8c5('0xf')](''),_0xd8c5('0x43'))['toString'](_0xd8c5('0x44'));}; \ No newline at end of file +var _0xd24a=['path','../../../config/logger','email','value','address','anonymous','@xcally.com','head','name','substring','indexOf','split','slice','Anonymous','length','pop','isEmpty','generate','html','test','replace','attachments','forEach','push','filename','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','user=','auth=Bearer\x20','join','utf-8','toString','randomstring'];(function(_0x3e8fa1,_0x8c055c){var _0x5e1ab8=function(_0x4205f4){while(--_0x4205f4){_0x3e8fa1['push'](_0x3e8fa1['shift']());}};_0x5e1ab8(++_0x8c055c);}(_0xd24a,0x1c7));var _0xad24=function(_0x4953ea,_0x20a7bc){_0x4953ea=_0x4953ea-0x0;var _0x115f04=_0xd24a[_0x4953ea];return _0x115f04;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0xad24('0x0'));var fs=require('fs');var path=require(_0xad24('0x1'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0xad24('0x2'))(_0xad24('0x3'));var config=require('../../../config/environment');function getAddress(_0x34c86d){var _0x4d8f4a=_['head'](_0x34c86d[_0xad24('0x4')]);return _0x4d8f4a&&_0x4d8f4a['address']?_0x4d8f4a[_0xad24('0x5')]:_0xad24('0x6')+random['generate'](0x6)+_0xad24('0x7');}function getFirstName(_0x184a0c){var _0x2cfcc6=_[_0xad24('0x8')](_0x184a0c['value']);if(_0x2cfcc6&&_0x2cfcc6['name']){if(_0x2cfcc6['name']==_0x2cfcc6['address']){return _0x2cfcc6[_0xad24('0x9')][_0xad24('0xa')](0x0,_0x2cfcc6[_0xad24('0x9')][_0xad24('0xb')]('@'));}var _0x152774=_0x2cfcc6[_0xad24('0x9')][_0xad24('0xc')](/\s+/);return _0x152774['length']>0x1?_0x152774[_0xad24('0xd')](0x0,-0x1)['join']('\x20'):_0x2cfcc6[_0xad24('0x9')];}return _0xad24('0xe');}function getLastName(_0x2f62b1){var _0x11ea90=_[_0xad24('0x8')](_0x2f62b1[_0xad24('0x4')]);if(_0x11ea90&&_0x11ea90[_0xad24('0x9')]){var _0x298b14=_0x11ea90['name'][_0xad24('0xc')](/\s+/);return _0x298b14[_0xad24('0xf')]>0x1?_0x298b14[_0xad24('0x10')]():'';}return'';}function getMails(_0x31e323,_0x4c2f11){var _0x512786='';for(var _0x10a9b7=0x0;_0x10a9b7<_0x4c2f11[_0xad24('0x4')]['length'];_0x10a9b7+=0x1){if(_0x4c2f11[_0xad24('0x4')][_0x10a9b7][_0xad24('0x5')]!==_0x31e323){if(!_[_0xad24('0x11')](_0x512786)){_0x512786+=',';}_0x512786+=_0x4c2f11['value'][_0x10a9b7]['name']||_0x4c2f11[_0xad24('0x4')][_0x10a9b7][_0xad24('0x5')]||'';_0x512786+='\x20<';_0x512786+=_0x4c2f11[_0xad24('0x4')][_0x10a9b7]['address']?_0x4c2f11['value'][_0x10a9b7]['address']:_0xad24('0x6')+random[_0xad24('0x12')](0x6)+_0xad24('0x7');_0x512786+='>';}}return _0x512786;}function parseEmail(_0x1762e1,_0x1c4117,_0x506606){if(_0x1c4117[_0xad24('0x13')]){var _0x380926=/)<[^<]*)*<\/script>/gi;while(_0x380926[_0xad24('0x14')](_0x1c4117[_0xad24('0x13')])){_0x1c4117[_0xad24('0x13')]=_0x1c4117[_0xad24('0x13')][_0xad24('0x15')](_0x380926,'');}if(_0x1c4117[_0xad24('0x13')]['includes']('{_0x4e34b9[_0xad24('0x18')](_0x237af8[_0xad24('0x19')]);});var _0x1bf4cb=/]+>/g;var _0x12fa6f=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x57acbb=_0x1c4117[_0xad24('0x13')][_0xad24('0x15')](_0x12fa6f,_0xad24('0x1a'));var _0x306eed=_0x57acbb[_0xad24('0x15')](_0x1bf4cb,'_IMG');for(let _0x4a3030=0x0;_0x4a3030<_0x4e34b9[_0xad24('0xf')];_0x4a3030++){var _0x41dcd5=_0x306eed[_0xad24('0x15')](_0xad24('0x1b'),_0xad24('0x1c')+_0x4e34b9[_0x4a3030]+_0xad24('0x1d'));_0x306eed=_0x41dcd5;}_0x1c4117[_0xad24('0x13')]=_0x306eed;}_0x506606['body']=_0x1c4117[_0xad24('0x13')];}else{_0x506606[_0xad24('0x1e')]=_0x1c4117[_0xad24('0x1f')];}if(_0x506606[_0xad24('0x1e')]){_0x506606[_0xad24('0x1e')]=_0x506606[_0xad24('0x1e')]['replace'](/0x0){var _0x198984=[_0xad24('0x31'),'X-Auto-Response-Suppress:\x20All',_0xad24('0x32')];for(var _0x638725=0x0;_0x638725<_0x1c4117['headerLines'][_0xad24('0xf')];_0x638725++){var _0x2bbe2c=_[_0xad24('0xb')](_0x198984,_0x1c4117[_0xad24('0x30')][_0x638725][_0xad24('0x33')]);if(_0x2bbe2c>=0x0){_0x506606[_0xad24('0x34')]=!![];}}}return _0x506606;}exports[_0xad24('0x35')]=function(_0x143264,_0x2a6050,_0x5aa25e){var _0x445b17={'from':getAddress(_0x2a6050['from']),'firstName':getFirstName(_0x2a6050[_0xad24('0x36')]),'lastName':getLastName(_0x2a6050[_0xad24('0x36')]),'mapKey':'email','message':{'from':getMails(_0x143264['email'],_0x2a6050['from']),'to':_0x143264[_0xad24('0x3')],'cc':'','subject':_0x2a6050[_0xad24('0x37')]||'','messageId':_0x2a6050['messageId'],'inReplyTo':_0x2a6050[_0xad24('0x38')],'sentAt':moment(_0x2a6050['date'])[_0xad24('0x39')](_0xad24('0x3a')),'attach':![],'attachments':[]}};if(!_0x2a6050['html']&&!_0x2a6050[_0xad24('0x1f')]){var _0x3e1fdf=_[_0xad24('0x3b')](_0x2a6050[_0xad24('0x16')],{'contentType':_0xad24('0x3c')});if(_0x3e1fdf[_0xad24('0xf')]){logger[_0xad24('0x3d')](util[_0xad24('0x39')](_0xad24('0x3e'),_0x2a6050[_0xad24('0x3f')]));tnef[_0xad24('0x40')](_[_0xad24('0x41')](_0x3e1fdf)[_0xad24('0x2e')],function(_0x4eae00,_0x2ab428){if(_0x2ab428){_0x2a6050[_0xad24('0x13')]=_0x2ab428[_0xad24('0x42')]||_0xad24('0x43');if(_0x2ab428[_0xad24('0x44')]){for(var _0x491c90=0x0;_0x491c90<_0x2ab428[_0xad24('0x44')]['length'];_0x491c90++){var _0x5275da=_0x2ab428[_0xad24('0x44')][_0x491c90];_0x445b17[_0xad24('0x21')][_0xad24('0x16')][_0xad24('0x18')]({'filename':_0x5275da[_0xad24('0x45')],'content':Buffer[_0xad24('0x36')](_0x5275da[_0xad24('0x46')])});}}}_0x5aa25e(parseEmail(_0x143264,_0x2a6050,_0x445b17));});}else{_0x2a6050[_0xad24('0x13')]='

Empty\x20message

';_0x5aa25e(parseEmail(_0x143264,_0x2a6050,_0x445b17));}}else{_0x5aa25e(parseEmail(_0x143264,_0x2a6050,_0x445b17));}};exports['generateXOAuth2Token']=function(_0x4c7f3b,_0x993208){var _0x1f54fc=[_0xad24('0x47')+(_0x993208||''),_0xad24('0x48')+_0x4c7f3b,'',''];return Buffer[_0xad24('0x36')](_0x1f54fc[_0xad24('0x49')](''),_0xad24('0x4a'))[_0xad24('0x4b')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index a97b391..df502b0 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 _0xd6b4=['lodash','name','Service','key','active','Imap','Smtp','exports'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xd6b4,0x150));var _0x4d6b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd6b4[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x4d6b('0x0'));function MailAccount(_0xc7627d){this['id']=_0xc7627d['id']||0x0;this[_0x4d6b('0x1')]=_0xc7627d[_0x4d6b('0x1')]||_0x4d6b('0x2');this[_0x4d6b('0x3')]=_0xc7627d[_0x4d6b('0x3')]||'SERV';this[_0x4d6b('0x4')]=_0xc7627d['active']||![];this[_0x4d6b('0x5')]=_0xc7627d[_0x4d6b('0x5')]||[];this[_0x4d6b('0x6')]=_0xc7627d[_0x4d6b('0x6')]||[];}module[_0x4d6b('0x7')]=MailAccount; \ No newline at end of file +var _0xb11f=['lodash','name','Service','key','active','Imap','Smtp'];(function(_0x4c79ce,_0x382dc3){var _0x1826d2=function(_0x744ac0){while(--_0x744ac0){_0x4c79ce['push'](_0x4c79ce['shift']());}};_0x1826d2(++_0x382dc3);}(_0xb11f,0x7e));var _0xfb11=function(_0x4caf4f,_0x1f9d37){_0x4caf4f=_0x4caf4f-0x0;var _0xf64dd9=_0xb11f[_0x4caf4f];return _0xf64dd9;};'use strict';var _=require(_0xfb11('0x0'));function MailAccount(_0x5437fb){this['id']=_0x5437fb['id']||0x0;this[_0xfb11('0x1')]=_0x5437fb[_0xfb11('0x1')]||_0xfb11('0x2');this['key']=_0x5437fb[_0xfb11('0x3')]||'SERV';this[_0xfb11('0x4')]=_0x5437fb['active']||![];this[_0xfb11('0x5')]=_0x5437fb['Imap']||[];this[_0xfb11('0x6')]=_0x5437fb[_0xfb11('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 3a7c02c..80c2ba5 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 _0x644b=['prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0xf77fa6,_0x4c9df8){var _0x5bd317=function(_0x4af34a){while(--_0x4af34a){_0xf77fa6['push'](_0xf77fa6['shift']());}};_0x5bd317(++_0x4c9df8);}(_0x644b,0x14b));var _0xb644=function(_0x1a8506,_0x4f55a8){_0x1a8506=_0x1a8506-0x0;var _0x2648b5=_0x644b[_0x1a8506];return _0x2648b5;};'use strict';var _=require(_0xb644('0x0'));var MailAccount=require(_0xb644('0x1'));var Realtime=function(){this[_0xb644('0x2')]={};};function freeIsNotKey(_0x27c9ef,_0x4d8e9b,_0x16647a){var _0x2e9d05=_[_0xb644('0x3')](_0x27c9ef,function(_0x3602df,_0x407940){return _0x3602df[_0x16647a];});for(var _0x662fd5 in _0x4d8e9b){if(_0x4d8e9b[_0xb644('0x4')](_0x662fd5)){if(!_0x2e9d05[_0x662fd5]){delete _0x4d8e9b[_0x662fd5];}}}}Realtime[_0xb644('0x5')][_0xb644('0x6')]=function(_0x7432c6,_0x2fb62f){for(var _0x1c51ed in _0x2fb62f){if(_0x7432c6[_0xb644('0x4')](_0x1c51ed)){_0x7432c6[_0x1c51ed]=_0x2fb62f[_0x1c51ed];}}};Realtime[_0xb644('0x5')][_0xb644('0x7')]=function(){var _0x4cc425=this;return function(_0x5df4e5){if(_0x5df4e5){freeIsNotKey(_0x5df4e5,_0x4cc425[_0xb644('0x2')],'id');for(var _0xdee0c0=0x0,_0x39858d={},_0x43f208={};_0xdee0c0<_0x5df4e5[_0xb644('0x8')];_0xdee0c0+=0x1){_0x39858d=_0x5df4e5[_0xdee0c0];if(_[_0xb644('0x9')](_0x4cc425[_0xb644('0x2')][_0x39858d['id']])){_0x4cc425[_0xb644('0x2')][_0x39858d['id']]=new MailAccount(_0x39858d);}else{_[_0xb644('0xa')](_0x4cc425[_0xb644('0x2')][_0x39858d['id']],_0x39858d);}}}return _0x4cc425['mailAccounts'];};};module[_0xb644('0xb')]=Realtime; \ No newline at end of file +var _0x0d67=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','merge','lodash'];(function(_0x183a9b,_0x5edd00){var _0x58fa64=function(_0x7d5ad2){while(--_0x7d5ad2){_0x183a9b['push'](_0x183a9b['shift']());}};_0x58fa64(++_0x5edd00);}(_0x0d67,0xc5));var _0x70d6=function(_0x3b5ccb,_0x3c7d78){_0x3b5ccb=_0x3b5ccb-0x0;var _0x2c6c10=_0x0d67[_0x3b5ccb];return _0x2c6c10;};'use strict';var _=require(_0x70d6('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x70d6('0x1')]={};};function freeIsNotKey(_0x141c96,_0x5a1aec,_0x4db3b8){var _0x2c40aa=_[_0x70d6('0x2')](_0x141c96,function(_0xb83dc9,_0x1c2977){return _0xb83dc9[_0x4db3b8];});for(var _0x531f7c in _0x5a1aec){if(_0x5a1aec[_0x70d6('0x3')](_0x531f7c)){if(!_0x2c40aa[_0x531f7c]){delete _0x5a1aec[_0x531f7c];}}}}Realtime[_0x70d6('0x4')][_0x70d6('0x5')]=function(_0x21ca7b,_0x940f07){for(var _0x188737 in _0x940f07){if(_0x21ca7b[_0x70d6('0x3')](_0x188737)){_0x21ca7b[_0x188737]=_0x940f07[_0x188737];}}};Realtime['prototype'][_0x70d6('0x6')]=function(){var _0x351562=this;return function(_0x3e9dd9){if(_0x3e9dd9){freeIsNotKey(_0x3e9dd9,_0x351562[_0x70d6('0x1')],'id');for(var _0x317be6=0x0,_0x2ec434={},_0x3e3037={};_0x317be6<_0x3e9dd9[_0x70d6('0x7')];_0x317be6+=0x1){_0x2ec434=_0x3e9dd9[_0x317be6];if(_['isUndefined'](_0x351562['mailAccounts'][_0x2ec434['id']])){_0x351562[_0x70d6('0x1')][_0x2ec434['id']]=new MailAccount(_0x2ec434);}else{_[_0x70d6('0x8')](_0x351562['mailAccounts'][_0x2ec434['id']],_0x2ec434);}}}return _0x351562[_0x70d6('0x1')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 2b65f34..d2ba9ac 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 _0xdbfa=['type','MailServerOut','Smtp','data5','getMailAccount','notify','Request','NotifyMailAccount','GetMailAccount','provider','service','active','key','ListId','TemplateId','MailServerIn','CloudProvider','name'];(function(_0x4614cc,_0x1253ac){var _0x4debec=function(_0x6c4a58){while(--_0x6c4a58){_0x4614cc['push'](_0x4614cc['shift']());}};_0x4debec(++_0x1253ac);}(_0xdbfa,0x128));var _0xadbf=function(_0x20ce09,_0x2a1e86){_0x20ce09=_0x20ce09-0x0;var _0x1ea138=_0xdbfa[_0x20ce09];return _0x1ea138;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request'](_0xadbf('0x0'),{'options':{'attributes':['id','name',_0xadbf('0x1'),_0xadbf('0x2'),'email',_0xadbf('0x3'),_0xadbf('0x4'),_0xadbf('0x5'),_0xadbf('0x6')],'raw':![],'include':[{'model':_0xadbf('0x7'),'as':'Imap','include':[{'model':_0xadbf('0x8'),'attributes':['id',_0xadbf('0x9'),_0xadbf('0x2'),_0xadbf('0xa'),'data5'],'as':_0xadbf('0x8')}]},{'model':_0xadbf('0xb'),'as':_0xadbf('0xc'),'include':[{'model':'CloudProvider','attributes':['id',_0xadbf('0x9'),_0xadbf('0x2'),_0xadbf('0xa'),_0xadbf('0xd')],'as':_0xadbf('0x8')}]}]},'log':_0xadbf('0xe')});};};exports[_0xadbf('0xf')]=function(_0x11b6c1,_0x53e912){return client[_0xadbf('0x10')](_0xadbf('0x11'),{'account':{'id':_0x11b6c1},'body':_0x53e912,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x147b=['getMailAccount','notify','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount','name','service','email','active','ListId','MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp'];(function(_0x575934,_0x4a6760){var _0x109a3d=function(_0x1c20a1){while(--_0x1c20a1){_0x575934['push'](_0x575934['shift']());}};_0x109a3d(++_0x4a6760);}(_0x147b,0x193));var _0xb147=function(_0x30af23,_0x1b9d6a){_0x30af23=_0x30af23-0x0;var _0x5cea96=_0x147b[_0x30af23];return _0x5cea96;};'use strict';var client=require(_0xb147('0x0'));exports[_0xb147('0x1')]=function(){return function(){return client['Request'](_0xb147('0x2'),{'options':{'attributes':['id',_0xb147('0x3'),'provider',_0xb147('0x4'),_0xb147('0x5'),_0xb147('0x6'),'key',_0xb147('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0xb147('0x8'),'as':_0xb147('0x9'),'include':[{'model':_0xb147('0xa'),'attributes':['id','name','service',_0xb147('0xb'),_0xb147('0xc')],'as':_0xb147('0xa')}]},{'model':_0xb147('0xd'),'as':_0xb147('0xe'),'include':[{'model':_0xb147('0xa'),'attributes':['id',_0xb147('0x3'),_0xb147('0x4'),'type','data5'],'as':_0xb147('0xa')}]}]},'log':_0xb147('0xf')});};};exports[_0xb147('0x10')]=function(_0x177a8f,_0x2d209e){return client[_0xb147('0x11')](_0xb147('0x12'),{'account':{'id':_0x177a8f},'body':_0x2d209e,'log':_0xb147('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index fa82509..e844fd9 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 _0xad44=['getSettings','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x23efc4,_0x40fc50){var _0x470d95=function(_0x2cb92a){while(--_0x2cb92a){_0x23efc4['push'](_0x23efc4['shift']());}};_0x470d95(++_0x40fc50);}(_0xad44,0x162));var _0x4ad4=function(_0x3d2d6f,_0x368872){_0x3d2d6f=_0x3d2d6f-0x0;var _0x5c0022=_0xad44[_0x3d2d6f];return _0x5c0022;};'use strict';var client=require(_0x4ad4('0x0'));exports[_0x4ad4('0x1')]=function(){return client['Request'](_0x4ad4('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x4ad4('0x3')]},'log':_0x4ad4('0x4')});}; \ No newline at end of file +var _0xb76e=['getSettings','Request','ShowSetting','GetSettings','../client'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xb76e,0x16c));var _0xeb76=function(_0xc3750e,_0x1618cc){_0xc3750e=_0xc3750e-0x0;var _0x1e2f02=_0xb76e[_0xc3750e];return _0x1e2f02;};'use strict';var client=require(_0xeb76('0x0'));exports[_0xeb76('0x1')]=function(){return client[_0xeb76('0x2')](_0xeb76('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xeb76('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 38090b9..f274fac 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(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 424d950..5bc0662 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 _0x5d32=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','timeout','listen','socket.io','polling','redis','defaults','localhost','adapter','../../config/socketio','default','../../routes'];(function(_0xb2fa87,_0x68ed62){var _0x1f4ddd=function(_0x433414){while(--_0x433414){_0xb2fa87['push'](_0xb2fa87['shift']());}};_0x1f4ddd(++_0x68ed62);}(_0x5d32,0xc1));var _0x25d3=function(_0x51539c,_0x25f587){_0x51539c=_0x51539c-0x0;var _0x4f7914=_0x5d32[_0x51539c];return _0x4f7914;};'use strict';var _=require(_0x25d3('0x0'));var http=require(_0x25d3('0x1'));var express=require(_0x25d3('0x2'));var sticky=require(_0x25d3('0x3'));var Redis=require(_0x25d3('0x4'));var config=require(_0x25d3('0x5'));var app=express();var server=http['createServer'](app);server[_0x25d3('0x6')]=0xdbba0;if(sticky[_0x25d3('0x7')](server,config['port'])){var socketio=require(_0x25d3('0x8'))(server,{'transports':['websocket',_0x25d3('0x9')]});config[_0x25d3('0xa')]=_[_0x25d3('0xb')](config[_0x25d3('0xa')],{'host':_0x25d3('0xc'),'port':0x18eb});socketio[_0x25d3('0xd')](require('socket.io-redis')({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x25d3('0xa')])}));require('../../config/triggers')['default']();require(_0x25d3('0xe'))[_0x25d3('0xf')](socketio);require('../../config/express')[_0x25d3('0xf')](app);require(_0x25d3('0x10'))[_0x25d3('0xf')](app);}else{server['once']('listening',function(){console[_0x25d3('0x11')](_0x25d3('0x12'),config[_0x25d3('0x13')]);});}exports=module[_0x25d3('0x14')]=app; \ No newline at end of file +var _0xc054=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','express','ioredis','createServer','timeout','listen','socket.io','polling','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','once','listening'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0xc054,0x174));var _0x4c05=function(_0x32bda5,_0x1a809b){_0x32bda5=_0x32bda5-0x0;var _0x383d68=_0xc054[_0x32bda5];return _0x383d68;};'use strict';var _=require(_0x4c05('0x0'));var http=require('http');var express=require(_0x4c05('0x1'));var sticky=require('sticky-session');var Redis=require(_0x4c05('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0x4c05('0x3')](app);server[_0x4c05('0x4')]=0xdbba0;if(sticky[_0x4c05('0x5')](server,config['port'])){var socketio=require(_0x4c05('0x6'))(server,{'transports':['websocket',_0x4c05('0x7')]});config[_0x4c05('0x8')]=_[_0x4c05('0x9')](config['redis'],{'host':_0x4c05('0xa'),'port':0x18eb});socketio[_0x4c05('0xb')](require(_0x4c05('0xc'))({'pubClient':new Redis(config[_0x4c05('0x8')]),'subClient':new Redis(config[_0x4c05('0x8')])}));require('../../config/triggers')[_0x4c05('0xd')]();require(_0x4c05('0xe'))['default'](socketio);require(_0x4c05('0xf'))[_0x4c05('0xd')](app);require(_0x4c05('0x10'))['default'](app);}else{server[_0x4c05('0x11')](_0x4c05('0x12'),function(){console[_0x4c05('0x13')](_0x4c05('0x14'),config[_0x4c05('0x15')]);});}exports=module[_0x4c05('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index f45ccb4..b8d3ab8 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 _0x2c94=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','routing','message'];(function(_0x514edf,_0x2d3111){var _0x1b0c8d=function(_0x283116){while(--_0x283116){_0x514edf['push'](_0x514edf['shift']());}};_0x1b0c8d(++_0x2d3111);}(_0x2c94,0x92));var _0x42c9=function(_0x536105,_0x3b9730){_0x536105=_0x536105-0x0;var _0x2d6651=_0x2c94[_0x536105];return _0x2d6651;};'use strict';var jayson=require(_0x42c9('0x0'));var BPromise=require(_0x42c9('0x1'));var logger=require(_0x42c9('0x2'))('routing');var client=jayson['client'][_0x42c9('0x3')]({'port':0x2329});client['Request']=function(_0x556c22,_0x225e91){return new BPromise(function(_0x33761b,_0x1072a8){return client[_0x42c9('0x4')](_0x556c22,_0x225e91)['then'](function(_0x4d79ee){logger[_0x42c9('0x5')](_0x42c9('0x6'),'routing',_0x556c22,_0x225e91,_0x4d79ee);if(_0x4d79ee[_0x42c9('0x7')]){logger[_0x42c9('0x7')](_0x42c9('0x6'),_0x42c9('0x8'),_0x556c22,_0x4d79ee[_0x42c9('0x7')][_0x42c9('0x9')],_0x225e91);return _0x1072a8(_0x4d79ee['error'][_0x42c9('0x9')]);}else{return _0x33761b(_0x4d79ee[_0x42c9('0xa')]);}})[_0x42c9('0xb')](function(_0x1e0882){logger[_0x42c9('0x7')](_0x42c9('0x6'),_0x42c9('0x8'),_0x556c22,_0x1e0882,_0x225e91);return _0x1072a8(_0x1e0882);});});};module[_0x42c9('0xc')]=client; \ No newline at end of file +var _0x2077=['routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','bluebird','../../config/logger'];(function(_0x4fc104,_0x5a0d64){var _0x20515d=function(_0x41813b){while(--_0x41813b){_0x4fc104['push'](_0x4fc104['shift']());}};_0x20515d(++_0x5a0d64);}(_0x2077,0x1de));var _0x7207=function(_0x27456c,_0x2de858){_0x27456c=_0x27456c-0x0;var _0x446b02=_0x2077[_0x27456c];return _0x446b02;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7207('0x0'));var logger=require(_0x7207('0x1'))(_0x7207('0x2'));var client=jayson[_0x7207('0x3')][_0x7207('0x4')]({'port':0x2329});client[_0x7207('0x5')]=function(_0xbb7ef0,_0x22536e){return new BPromise(function(_0x35d22d,_0x17cca3){return client[_0x7207('0x6')](_0xbb7ef0,_0x22536e)[_0x7207('0x7')](function(_0x57a30e){logger[_0x7207('0x8')](_0x7207('0x9'),'routing',_0xbb7ef0,_0x22536e,_0x57a30e);if(_0x57a30e[_0x7207('0xa')]){logger[_0x7207('0xa')](_0x7207('0x9'),_0x7207('0x2'),_0xbb7ef0,_0x57a30e[_0x7207('0xa')]['message'],_0x22536e);return _0x17cca3(_0x57a30e[_0x7207('0xa')][_0x7207('0xb')]);}else{return _0x35d22d(_0x57a30e[_0x7207('0xc')]);}})[_0x7207('0xd')](function(_0x2554c7){logger[_0x7207('0xa')](_0x7207('0x9'),_0x7207('0x2'),_0xbb7ef0,_0x2554c7,_0x22536e);return _0x17cca3(_0x2554c7);});});};module[_0x7207('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 6e70cfe..4a7111a 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 _0xc760=['./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue'];(function(_0xe44297,_0x2d72fe){var _0x2b2f1a=function(_0x54655c){while(--_0x54655c){_0xe44297['push'](_0xe44297['shift']());}};_0x2b2f1a(++_0x2d72fe);}(_0xc760,0x103));var _0x0c76=function(_0x17e2c5,_0x3b0464){_0x17e2c5=_0x17e2c5-0x0;var _0x1e15c7=_0xc760[_0x17e2c5];return _0x1e15c7;};'use strict';var BPromise=require('bluebird');var server=require(_0x0c76('0x0'));var Realtime=require(_0x0c76('0x1'));var user=require(_0x0c76('0x2'));var interval=require(_0x0c76('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x0c76('0x4'));var smsQueue=require(_0x0c76('0x5'));var mailQueue=require(_0x0c76('0x6'));var faxQueue=require(_0x0c76('0x7'));var whatsappQueue=require(_0x0c76('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x0c76('0x9')](user['getAgents']())[_0x0c76('0x9')](realtime[_0x0c76('0xa')]())[_0x0c76('0x9')](interval[_0x0c76('0xb')]())[_0x0c76('0x9')](realtime[_0x0c76('0xc')]())[_0x0c76('0x9')](openchannelQueue[_0x0c76('0xd')]())[_0x0c76('0x9')](realtime[_0x0c76('0xe')]())[_0x0c76('0x9')](chatQueue[_0x0c76('0xf')]())[_0x0c76('0x9')](realtime['initChatQueues']())['then'](smsQueue['getSmsQueues']())[_0x0c76('0x9')](realtime[_0x0c76('0x10')]())[_0x0c76('0x9')](mailQueue[_0x0c76('0x11')]())[_0x0c76('0x9')](realtime[_0x0c76('0x12')]())[_0x0c76('0x9')](faxQueue[_0x0c76('0x13')]())[_0x0c76('0x9')](realtime[_0x0c76('0x14')]())[_0x0c76('0x9')](whatsappQueue['getWhatsappQueues']())[_0x0c76('0x9')](realtime['initWhatsappQueues']())[_0x0c76('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x0c76('0x9')](function(_0x4fbb32){return initRealtime();})[_0x0c76('0x9')](function(_0xf688e8){return setInterval(initRealtime,0x1388);})['catch'](function(_0x10e051){console[_0x0c76('0x15')](_0x10e051);});}main(); \ No newline at end of file +var _0xc92e=['initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','listen','catch','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','getOpenchannelQueues'];(function(_0x44f498,_0x56866c){var _0x45891b=function(_0x1dc3f8){while(--_0x1dc3f8){_0x44f498['push'](_0x44f498['shift']());}};_0x45891b(++_0x56866c);}(_0xc92e,0x14c));var _0xec92=function(_0x4dcf45,_0x4b7b7b){_0x4dcf45=_0x4dcf45-0x0;var _0x4cd6ab=_0xc92e[_0x4dcf45];return _0x4cd6ab;};'use strict';var BPromise=require(_0xec92('0x0'));var server=require(_0xec92('0x1'));var Realtime=require('./realtime');var user=require(_0xec92('0x2'));var interval=require(_0xec92('0x3'));var openchannelQueue=require(_0xec92('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xec92('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xec92('0x6'));var whatsappQueue=require(_0xec92('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xec92('0x8')]()[_0xec92('0x9')](user['getAgents']())[_0xec92('0x9')](realtime[_0xec92('0xa')]())[_0xec92('0x9')](interval[_0xec92('0xb')]())[_0xec92('0x9')](realtime['initIntervals']())[_0xec92('0x9')](openchannelQueue[_0xec92('0xc')]())[_0xec92('0x9')](realtime[_0xec92('0xd')]())[_0xec92('0x9')](chatQueue['getChatQueues']())['then'](realtime[_0xec92('0xe')]())[_0xec92('0x9')](smsQueue[_0xec92('0xf')]())[_0xec92('0x9')](realtime[_0xec92('0x10')]())[_0xec92('0x9')](mailQueue[_0xec92('0x11')]())[_0xec92('0x9')](realtime[_0xec92('0x12')]())['then'](faxQueue['getFaxQueues']())[_0xec92('0x9')](realtime[_0xec92('0x13')]())[_0xec92('0x9')](whatsappQueue['getWhatsappQueues']())[_0xec92('0x9')](realtime['initWhatsappQueues']())[_0xec92('0x9')](function(){return realtime;});}function main(){return server[_0xec92('0x14')](realtime)['then'](function(_0x12ed26){return initRealtime();})[_0xec92('0x9')](function(_0x6a5acd){return setInterval(initRealtime,0x1388);})[_0xec92('0x15')](function(_0x441fb1){console[_0xec92('0x16')](_0x441fb1);});}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 af22538..47685cc 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['next','isEqual','restart','condition','matches','filter','turn','prioritize','findRules','length','priority','toJSON','map','toString','fromJSON','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','rules','activeRules','prototype','isArray','concat','push','sync','orderBy','result','clone','consequence','name','index_','nextTick','ruleRef','call'];(function(_0x2010f0,_0x4f3471){var _0x53d72d=function(_0x5e23d3){while(--_0x5e23d3){_0x2010f0['push'](_0x2010f0['shift']());}};_0x53d72d(++_0x4f3471);}(_0x2ef3,0xba));var _0x32ef=function(_0x1fde93,_0xd6c414){_0x1fde93=_0x1fde93-0x0;var _0x43af5a=_0x2ef3[_0x1fde93];return _0x43af5a;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var EventEmitter=require(_0x32ef('0x2'))[_0x32ef('0x3')];function RuleEngine(_0x3944df,_0x38047b){this['init']();if(!_[_0x32ef('0x4')](_0x3944df)){this[_0x32ef('0x5')](_0x3944df);}if(_0x38047b){this['ignoreFactChanges']=_0x38047b[_0x32ef('0x6')];}return this;}util[_0x32ef('0x7')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x2c0089){this[_0x32ef('0x8')]=[];this[_0x32ef('0x9')]=[];};RuleEngine[_0x32ef('0xa')][_0x32ef('0x5')]=function(_0x298066){if(Array[_0x32ef('0xb')](_0x298066)){this[_0x32ef('0x8')]=this[_0x32ef('0x8')][_0x32ef('0xc')](_0x298066);}else if(_0x298066!==null&&_['isObject'](_0x298066)){this['rules'][_0x32ef('0xd')](_0x298066);}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0xe')]=function(){this['activeRules']=this[_0x32ef('0x8')]['filter'](function(_0x1a5106){if(_['isNil'](_0x1a5106['on'])){_0x1a5106['on']=!![];}if(_0x1a5106['on']===!![]){return _0x1a5106;}});this[_0x32ef('0x9')]=_[_0x32ef('0xf')](this['activeRules'],['p'],['asc']);};RuleEngine[_0x32ef('0xa')]['execute']=function(_0x326fce,_0x40a6e6){var _0x93d492=![];_0x326fce[_0x32ef('0x10')]=!![];var _0x57aff1=_['clone'](_0x326fce);var _0x531e30=_[_0x32ef('0x11')](_0x326fce);var _0x3950e6=this[_0x32ef('0x9')];var _0x53a5ca=[];var _0x5d559b=this[_0x32ef('0x6')];(function FnRuleLoop(_0x1a9476){var _0x286bfb={'rules':function(){return _0x3950e6;},'rule':function(){return _0x3950e6[_0x1a9476];},'when':function(_0x57863c){if(_0x57863c){var _0xbe37f6=_0x3950e6[_0x1a9476][_0x32ef('0x12')];_0xbe37f6['ruleRef']=_0x3950e6[_0x1a9476]['id']||_0x3950e6[_0x1a9476][_0x32ef('0x13')]||_0x32ef('0x14')+_0x1a9476;process[_0x32ef('0x15')](function(){_0x53a5ca[_0x32ef('0xd')](_0xbe37f6[_0x32ef('0x16')]);_0xbe37f6[_0x32ef('0x17')](_0x57aff1,_0x286bfb);});}else{process['nextTick'](function(){_0x286bfb[_0x32ef('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x93d492=!![];return FnRuleLoop(0x0);},'next':function(_0x5cc3ef){if(!_0x5d559b&&!_[_0x32ef('0x19')](_0x531e30,_0x57aff1)){_0x531e30=_[_0x32ef('0x11')](_0x57aff1);process['nextTick'](function(){_0x286bfb[_0x32ef('0x1a')]();});}else{process[_0x32ef('0x15')](function(){if(_[_0x32ef('0x4')](_0x5cc3ef)){return FnRuleLoop(_0x1a9476+0x1);}else{return FnRuleLoop(_0x5cc3ef);}});}}};if(_0x1a9476<_0x3950e6['length']&&_0x93d492===![]){var _0x57f5e5=_0x3950e6[_0x1a9476][_0x32ef('0x1b')];_0x57f5e5[_0x32ef('0x17')](_0x57aff1,_0x286bfb);}else{process[_0x32ef('0x15')](function(){_0x57aff1['matchPath']=_0x53a5ca;return _0x40a6e6?_0x40a6e6(_0x57aff1):_['noop']();});}}(0x0));};RuleEngine[_0x32ef('0xa')]['findRules']=function(_0x51a412){if(_[_0x32ef('0x4')](_0x51a412)){return this[_0x32ef('0x8')];}else{var _0x371540=_[_0x32ef('0x1c')](_0x51a412);return _[_0x32ef('0x1d')](this[_0x32ef('0x8')],_0x371540);}};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1e')]=function(_0x338f19,_0x2f52d7){var _0x1335e2=_0x338f19==='on'||_0x338f19==='ON'?!![]:![];var _0xba4b3f=this['findRules'](_0x2f52d7);for(var _0xd65fde=0x0,_0x2f5d06=_0xba4b3f['length'];_0xd65fde<_0x2f5d06;_0xd65fde+=0x1){_0xba4b3f[_0xd65fde]['on']=_0x1335e2;}this[_0x32ef('0xe')]();};RuleEngine[_0x32ef('0xa')][_0x32ef('0x1f')]=function(_0x26e207,_0x50a95b){_0x26e207=parseInt(_0x26e207,0xa);var _0x10e38c=this[_0x32ef('0x20')](_0x50a95b);for(var _0x31dbc3=0x0,_0x2ac686=_0x10e38c[_0x32ef('0x21')];_0x31dbc3<_0x2ac686;_0x31dbc3+=0x1){_0x10e38c[_0x31dbc3][_0x32ef('0x22')]=_0x26e207;}this[_0x32ef('0xe')]();};RuleEngine['prototype'][_0x32ef('0x23')]=function(){var _0x537214=this[_0x32ef('0x8')];if(_0x537214 instanceof Array){_0x537214=_0x537214[_0x32ef('0x24')](function(_0x5a9565){_0x5a9565[_0x32ef('0x1b')]=_0x5a9565[_0x32ef('0x1b')][_0x32ef('0x25')]();_0x5a9565[_0x32ef('0x12')]=_0x5a9565[_0x32ef('0x12')]['toString']();return _0x5a9565;});}else if(!_['isNil'](_0x537214)){_0x537214[_0x32ef('0x1b')]=_0x537214['condition'][_0x32ef('0x25')]();_0x537214[_0x32ef('0x12')]=_0x537214[_0x32ef('0x12')][_0x32ef('0x25')]();}return _0x537214;};RuleEngine[_0x32ef('0xa')][_0x32ef('0x26')]=function(_0x566b56){this['init']();if(_['isString'](_0x566b56)){_0x566b56=JSON[_0x32ef('0x27')](_0x566b56);}if(_0x566b56 instanceof Array){_0x566b56=_0x566b56[_0x32ef('0x24')](function(_0x136b02){_0x136b02['condition']=eval('('+_0x136b02['condition']+')');_0x136b02[_0x32ef('0x12')]=eval('('+_0x136b02[_0x32ef('0x12')]+')');return _0x136b02;});}else if(_0x566b56!==null&&typeof _0x566b56==_0x32ef('0x28')){_0x566b56['condition']=eval('('+_0x566b56['condition']+')');_0x566b56[_0x32ef('0x12')]=eval('('+_0x566b56[_0x32ef('0x12')]+')');}this[_0x32ef('0x5')](_0x566b56);};module[_0x32ef('0x29')]=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x13ce62,_0x189733){var _0x659d2=function(_0xe7468b){while(--_0xe7468b){_0x13ce62['push'](_0x13ce62['shift']());}};_0x659d2(++_0x189733);}(_0x326f,0xd1));var _0xf326=function(_0x2651ad,_0x2f4b69){_0x2651ad=_0x2651ad-0x0;var _0x3b7082=_0x326f[_0x2651ad];return _0x3b7082;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 3c2f2fc..dc7d016 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 _0x07e5=['then','error','result','catch','sendMailMessage','bluebird','client','http','request'];(function(_0x3411c5,_0x41d0c3){var _0x77b0e7=function(_0x3ebcf8){while(--_0x3ebcf8){_0x3411c5['push'](_0x3411c5['shift']());}};_0x77b0e7(++_0x41d0c3);}(_0x07e5,0x1d9));var _0x507e=function(_0x195f7d,_0x47ca49){_0x195f7d=_0x195f7d-0x0;var _0x519fb9=_0x07e5[_0x195f7d];return _0x519fb9;};'use strict';var BPromise=require(_0x507e('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x507e('0x1')][_0x507e('0x2')]({'port':0x232b});function request(_0x55a668,_0x45a363){return new BPromise(function(_0x4c71a9,_0x33d400){return client[_0x507e('0x3')](_0x55a668,_0x45a363)[_0x507e('0x4')](function(_0x59af6d){if(_0x59af6d[_0x507e('0x5')]){return _0x33d400(_0x59af6d['error']['message']);}else{return _0x4c71a9(_0x59af6d[_0x507e('0x6')]);}})[_0x507e('0x7')](function(_0x519415){return _0x33d400(_0x519415);});});}exports[_0x507e('0x8')]=function(_0x47306e,_0x3aa769){return request('SendMail',{'account':_0x47306e,'message':_0x3aa769});}; \ No newline at end of file +var _0x3375=['bluebird','http','then','error','message','result','catch'];(function(_0x4fdf63,_0x3ff15f){var _0x543c2f=function(_0x4cc6cb){while(--_0x4cc6cb){_0x4fdf63['push'](_0x4fdf63['shift']());}};_0x543c2f(++_0x3ff15f);}(_0x3375,0xcb));var _0x5337=function(_0x55558f,_0xf63628){_0x55558f=_0x55558f-0x0;var _0x2649be=_0x3375[_0x55558f];return _0x2649be;};'use strict';var BPromise=require(_0x5337('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5337('0x1')]({'port':0x232b});function request(_0x1e8686,_0x415bd2){return new BPromise(function(_0x691b83,_0x2f7871){return client['request'](_0x1e8686,_0x415bd2)[_0x5337('0x2')](function(_0x4aa53f){if(_0x4aa53f[_0x5337('0x3')]){return _0x2f7871(_0x4aa53f[_0x5337('0x3')][_0x5337('0x4')]);}else{return _0x691b83(_0x4aa53f[_0x5337('0x5')]);}})[_0x5337('0x6')](function(_0x34d750){return _0x2f7871(_0x34d750);});});}exports['sendMailMessage']=function(_0x599dbb,_0x1fefa0){return request('SendMail',{'account':_0x599dbb,'message':_0x1fefa0});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index c332545..3424444 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 _0x729a=['redis','defaults','localhost','socket.io-emitter','name','online','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','unknown','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','fax','length','Status','toNumber','format','mailCapacity','mailCurrentCapacity','faxStatus','faxCurrentCapacity','openchannelCurrentCapacity','stringify','exports','lodash','md5','../../../config/environment'];(function(_0x43736b,_0x387962){var _0x57e799=function(_0x57e452){while(--_0x57e452){_0x43736b['push'](_0x43736b['shift']());}};_0x57e799(++_0x387962);}(_0x729a,0x177));var _0xa729=function(_0x347402,_0x5efc6f){_0x347402=_0x347402-0x0;var _0xde66f9=_0x729a[_0x347402];return _0xde66f9;};'use strict';var _=require(_0xa729('0x0'));var moment=require('moment');var md5=require(_0xa729('0x1'));var Redis=require('ioredis');var config=require(_0xa729('0x2'));config[_0xa729('0x3')]=_[_0xa729('0x4')](config['redis'],{'host':_0xa729('0x5'),'port':0x18eb});var io=require(_0xa729('0x6'))(new Redis(config[_0xa729('0x3')]));function Agent(_0x207e07){this['id']=_0x207e07['id']||0x0;this[_0xa729('0x7')]=_0x207e07[_0xa729('0x7')]||'';this['online']=_0x207e07[_0xa729('0x8')]||!![];this['voicePause']=_0x207e07['voicePause']||![];this[_0xa729('0x9')]=_0x207e07[_0xa729('0x9')]||![];this['mailPause']=_0x207e07[_0xa729('0xa')]||![];this[_0xa729('0xb')]=_0x207e07[_0xa729('0xb')]||![];this[_0xa729('0xc')]=_0x207e07[_0xa729('0xc')]||![];this[_0xa729('0xd')]=_0x207e07[_0xa729('0xd')]||![];this[_0xa729('0xe')]='unknown';this['chatStatusTime']=0x0;this[_0xa729('0xf')]=_0x207e07['chatCapacity']||0x0;this[_0xa729('0x10')]=0x0;this['mailStatus']=_0xa729('0x11');this['mailStatusTime']=0x0;this['mailCapacity']=_0x207e07['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0xa729('0x12')]=0x0;this[_0xa729('0x13')]=_0x207e07[_0xa729('0x13')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xa729('0x14')]=_0xa729('0x11');this[_0xa729('0x15')]=0x0;this[_0xa729('0x16')]=_0x207e07[_0xa729('0x16')]||0x0;this[_0xa729('0x17')]=0x0;this['whatsappStatus']=_0xa729('0x11');this[_0xa729('0x18')]=0x0;this[_0xa729('0x19')]=_0x207e07[_0xa729('0x19')]||0x0;this[_0xa729('0x1a')]=0x0;this[_0xa729('0x1b')]=_0xa729('0x11');this[_0xa729('0x1c')]=0x0;this[_0xa729('0x1d')]=_0x207e07[_0xa729('0x1d')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xa729('0x1e')]=![];this[_0xa729('0x1f')]=undefined;this[_0xa729('0x1')]='';this[_0xa729('0x20')]();}Agent['prototype'][_0xa729('0x21')]=function(_0x2b1d10){if(this[_0x2b1d10+_0xa729('0x22')]>0x0){if(this[_0x2b1d10+_0xa729('0x23')]>0x0&&this[_0x2b1d10+_0xa729('0x22')]>=this[_0x2b1d10+'Capacity']){return _0xa729('0x24');}else{return _0xa729('0x25');}}else{return _0xa729('0x26');}};Agent[_0xa729('0x27')][_0xa729('0x20')]=function(){var _0x1daf0d=[_0xa729('0x28'),_0xa729('0x29'),'openchannel',_0xa729('0x2a'),'sms','whatsapp'];for(var _0x55b01f=0x0;_0x55b01f<_0x1daf0d[_0xa729('0x2b')];_0x55b01f+=0x1){var _0x2ce884=this['getChannelStatus'](_0x1daf0d[_0x55b01f]);if(this[_0x1daf0d[_0x55b01f]+_0xa729('0x2c')]!==_0x2ce884){this[_0x1daf0d[_0x55b01f]+'StatusTime']=_[_0xa729('0x2d')](moment()[_0xa729('0x2e')]('x'));}this[_0x1daf0d[_0x55b01f]+_0xa729('0x2c')]=_0x2ce884;}var _0x592afc={'id':this['id'],'name':this[_0xa729('0x7')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0xa729('0x9')],'mailPause':this[_0xa729('0xa')],'smsPause':this[_0xa729('0xc')],'faxPause':this[_0xa729('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xa729('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xa729('0x10')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xa729('0x2f')],'mailCurrentCapacity':this[_0xa729('0x30')],'faxStatus':this[_0xa729('0x31')],'faxStatusTime':this[_0xa729('0x12')],'faxCapacity':this[_0xa729('0x13')],'faxCurrentCapacity':this[_0xa729('0x32')],'smsStatus':this[_0xa729('0x14')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xa729('0x16')],'smsCurrentCapacity':this[_0xa729('0x17')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xa729('0x18')],'whatsappCapacity':this[_0xa729('0x19')],'whatsappCurrentCapacity':this[_0xa729('0x1a')],'openchannelStatus':this[_0xa729('0x1b')],'openchannelStatusTime':this[_0xa729('0x1c')],'openchannelCapacity':this[_0xa729('0x1d')],'openchannelCurrentCapacity':this[_0xa729('0x33')],'busy':this['busy'],'busyQueue':this[_0xa729('0x1f')]};var _0x10355c=md5(JSON[_0xa729('0x34')](_0x592afc));if(this[_0xa729('0x1')]!==_0x10355c){this[_0xa729('0x1')]=_0x10355c;io['emit']('user:save',_0x592afc);}};module[_0xa729('0x35')]=Agent; \ No newline at end of file +var _0x48b1=['unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','mail','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','name','openchannelPause','chatCurrentCapacity','mailCurrentCapacity','whatsappStatusTime','whatsappCapacity','openchannelCurrentCapacity','emit','user:save','exports','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus'];(function(_0x3cd6d0,_0x4a64f3){var _0x511d29=function(_0x2cc5ad){while(--_0x2cc5ad){_0x3cd6d0['push'](_0x3cd6d0['shift']());}};_0x511d29(++_0x4a64f3);}(_0x48b1,0x197));var _0x148b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x48b1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require(_0x148b('0x0'));var config=require(_0x148b('0x1'));config[_0x148b('0x2')]=_[_0x148b('0x3')](config[_0x148b('0x2')],{'host':_0x148b('0x4'),'port':0x18eb});var io=require(_0x148b('0x5'))(new Redis(config[_0x148b('0x2')]));function Agent(_0x1d25ef){this['id']=_0x1d25ef['id']||0x0;this['name']=_0x1d25ef['name']||'';this[_0x148b('0x6')]=_0x1d25ef[_0x148b('0x6')]||!![];this[_0x148b('0x7')]=_0x1d25ef[_0x148b('0x7')]||![];this[_0x148b('0x8')]=_0x1d25ef['chatPause']||![];this[_0x148b('0x9')]=_0x1d25ef['mailPause']||![];this[_0x148b('0xa')]=_0x1d25ef[_0x148b('0xa')]||![];this['smsPause']=_0x1d25ef[_0x148b('0xb')]||![];this['openchannelPause']=_0x1d25ef['openchannelPause']||![];this[_0x148b('0xc')]=_0x148b('0xd');this[_0x148b('0xe')]=0x0;this[_0x148b('0xf')]=_0x1d25ef[_0x148b('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x148b('0x10')]=_0x148b('0xd');this[_0x148b('0x11')]=0x0;this[_0x148b('0x12')]=_0x1d25ef[_0x148b('0x12')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x148b('0x13')]=_0x148b('0xd');this[_0x148b('0x14')]=0x0;this[_0x148b('0x15')]=_0x1d25ef[_0x148b('0x15')]||0x0;this[_0x148b('0x16')]=0x0;this[_0x148b('0x17')]=_0x148b('0xd');this[_0x148b('0x18')]=0x0;this['smsCapacity']=_0x1d25ef[_0x148b('0x19')]||0x0;this[_0x148b('0x1a')]=0x0;this['whatsappStatus']=_0x148b('0xd');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x1d25ef['whatsappCapacity']||0x0;this[_0x148b('0x1b')]=0x0;this[_0x148b('0x1c')]='unknown';this[_0x148b('0x1d')]=0x0;this[_0x148b('0x1e')]=_0x1d25ef['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x148b('0x1f')]=![];this[_0x148b('0x20')]=undefined;this[_0x148b('0x21')]='';this[_0x148b('0x22')]();}Agent[_0x148b('0x23')][_0x148b('0x24')]=function(_0x1fc2f8){if(this[_0x1fc2f8+_0x148b('0x25')]>0x0){if(this[_0x1fc2f8+'Capacity']>0x0&&this[_0x1fc2f8+_0x148b('0x25')]>=this[_0x1fc2f8+'Capacity']){return _0x148b('0x26');}else{return _0x148b('0x27');}}else{return'idle';}};Agent[_0x148b('0x23')][_0x148b('0x22')]=function(){var _0x3253ef=[_0x148b('0x28'),_0x148b('0x29'),_0x148b('0x2a'),'fax',_0x148b('0x2b'),_0x148b('0x2c')];for(var _0x26a107=0x0;_0x26a107<_0x3253ef[_0x148b('0x2d')];_0x26a107+=0x1){var _0x65b099=this[_0x148b('0x24')](_0x3253ef[_0x26a107]);if(this[_0x3253ef[_0x26a107]+_0x148b('0x2e')]!==_0x65b099){this[_0x3253ef[_0x26a107]+_0x148b('0x2f')]=_[_0x148b('0x30')](moment()[_0x148b('0x31')]('x'));}this[_0x3253ef[_0x26a107]+'Status']=_0x65b099;}var _0x246104={'id':this['id'],'name':this[_0x148b('0x32')],'online':this[_0x148b('0x6')],'voicePause':this[_0x148b('0x7')],'chatPause':this[_0x148b('0x8')],'mailPause':this[_0x148b('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x148b('0xa')],'openchannelPause':this[_0x148b('0x33')],'chatStatus':this[_0x148b('0xc')],'chatStatusTime':this[_0x148b('0xe')],'chatCapacity':this[_0x148b('0xf')],'chatCurrentCapacity':this[_0x148b('0x34')],'mailStatus':this[_0x148b('0x10')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x148b('0x12')],'mailCurrentCapacity':this[_0x148b('0x35')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x148b('0x14')],'faxCapacity':this[_0x148b('0x15')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x148b('0x18')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x148b('0x1a')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x148b('0x36')],'whatsappCapacity':this[_0x148b('0x37')],'whatsappCurrentCapacity':this[_0x148b('0x1b')],'openchannelStatus':this[_0x148b('0x1c')],'openchannelStatusTime':this[_0x148b('0x1d')],'openchannelCapacity':this[_0x148b('0x1e')],'openchannelCurrentCapacity':this[_0x148b('0x38')],'busy':this[_0x148b('0x1f')],'busyQueue':this[_0x148b('0x20')]};var _0x4003de=md5(JSON['stringify'](_0x246104));if(this[_0x148b('0x21')]!==_0x4003de){this[_0x148b('0x21')]=_0x4003de;io[_0x148b('0x39')](_0x148b('0x3a'),_0x246104);}};module[_0x148b('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 635b9bd..ab9d72e 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 _0x50ce=['exports','lodash','md5','util','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','updateRouting','updateRealtime','prototype','map','Agents','loggedIn','paused','length','online','chatPause','available','waiting','stringify','format','chat:queue:%s','chat_queue:save'];(function(_0x5e5c20,_0x3966cb){var _0x412a1e=function(_0x8f0c45){while(--_0x8f0c45){_0x5e5c20['push'](_0x5e5c20['shift']());}};_0x412a1e(++_0x3966cb);}(_0x50ce,0x169));var _0xe50c=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x50ce[_0x276468];return _0x36dc3a;};'use strict';var _=require(_0xe50c('0x0'));var md5=require(_0xe50c('0x1'));var util=require(_0xe50c('0x2'));var Redis=require('ioredis');var config=require(_0xe50c('0x3'));config['redis']=_[_0xe50c('0x4')](config[_0xe50c('0x5')],{'host':_0xe50c('0x6'),'port':0x18eb});var io=require(_0xe50c('0x7'))(new Redis(config[_0xe50c('0x5')]));function ChatQueue(_0x5eb190){this['id']=_0x5eb190['id']||0x0;this[_0xe50c('0x8')]=_0x5eb190[_0xe50c('0x8')]||'';this[_0xe50c('0x9')]=_0x5eb190[_0xe50c('0x9')]||0xa;this[_0xe50c('0xa')]=_0x5eb190[_0xe50c('0xa')]||_0xe50c('0xb');this['Agents']=_0x5eb190['Agents'];this[_0xe50c('0xc')]={};this['waiting']=0x0;this[_0xe50c('0x1')]='';this[_0xe50c('0xd')]();this[_0xe50c('0xe')]();}ChatQueue[_0xe50c('0xf')][_0xe50c('0xd')]=function(){var _0x5858be=this[_0xe50c('0xc')]['_rr'];this[_0xe50c('0xc')]=_[_0xe50c('0x10')](this[_0xe50c('0x11')],'id');this[_0xe50c('0xc')]['_rr']=_0x5858be;};ChatQueue[_0xe50c('0xf')][_0xe50c('0xe')]=function(){this[_0xe50c('0x12')]=0x0;this[_0xe50c('0x13')]=0x0;for(var _0x2012d7=0x0;_0x2012d7=0x0?this[_0xe50c('0x17')]:0x0;var _0x3b91f6={'id':this['id'],'available':this[_0xe50c('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xe50c('0x13')],'waiting':this[_0xe50c('0x18')]};var _0x278ce1=md5(JSON[_0xe50c('0x19')](_0x3b91f6));if(this[_0xe50c('0x1')]!==_0x278ce1){this[_0xe50c('0x1')]=_0x278ce1;io['to'](util[_0xe50c('0x1a')](_0xe50c('0x1b'),_0x3b91f6[_0xe50c('0x8')]))['emit'](_0xe50c('0x1c'),_0x3b91f6);}};module[_0xe50c('0x1d')]=ChatQueue; \ No newline at end of file +var _0x920e=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','map','updateRealtime','paused','length','online','chatPause','available','loggedIn','stringify','format','chat:queue:%s','emit','exports','md5','util','redis','defaults'];(function(_0x1ab758,_0x3dbede){var _0x5788a0=function(_0x324d24){while(--_0x324d24){_0x1ab758['push'](_0x1ab758['shift']());}};_0x5788a0(++_0x3dbede);}(_0x920e,0x1e9));var _0xe920=function(_0x4f68a8,_0x4fbf35){_0x4f68a8=_0x4f68a8-0x0;var _0x11e82c=_0x920e[_0x4f68a8];return _0x11e82c;};'use strict';var _=require('lodash');var md5=require(_0xe920('0x0'));var util=require(_0xe920('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xe920('0x2')]=_[_0xe920('0x3')](config[_0xe920('0x2')],{'host':_0xe920('0x4'),'port':0x18eb});var io=require(_0xe920('0x5'))(new Redis(config[_0xe920('0x2')]));function ChatQueue(_0xaf8d24){this['id']=_0xaf8d24['id']||0x0;this[_0xe920('0x6')]=_0xaf8d24['name']||'';this[_0xe920('0x7')]=_0xaf8d24['timeout']||0xa;this[_0xe920('0x8')]=_0xaf8d24['strategy']||_0xe920('0x9');this[_0xe920('0xa')]=_0xaf8d24['Agents'];this[_0xe920('0xb')]={};this[_0xe920('0xc')]=0x0;this[_0xe920('0x0')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xe920('0xd')][_0xe920('0xe')]=function(){var _0x1d3278=this[_0xe920('0xb')][_0xe920('0xf')];this[_0xe920('0xb')]=_[_0xe920('0x10')](this['Agents'],'id');this[_0xe920('0xb')][_0xe920('0xf')]=_0x1d3278;};ChatQueue[_0xe920('0xd')][_0xe920('0x11')]=function(){this['loggedIn']=0x0;this[_0xe920('0x12')]=0x0;for(var _0x2cccb5=0x0;_0x2cccb5=0x0?this[_0xe920('0x16')]:0x0;var _0x5289e6={'id':this['id'],'available':this['available'],'loggedIn':this[_0xe920('0x17')],'name':this[_0xe920('0x6')],'paused':this['paused'],'waiting':this[_0xe920('0xc')]};var _0x5b9ee0=md5(JSON[_0xe920('0x18')](_0x5289e6));if(this['md5']!==_0x5b9ee0){this[_0xe920('0x0')]=_0x5b9ee0;io['to'](util[_0xe920('0x19')](_0xe920('0x1a'),_0x5289e6[_0xe920('0x6')]))[_0xe920('0x1b')]('chat_queue:save',_0x5289e6);}};module[_0xe920('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 976ddd1..88b7752 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 _0x3a01=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','exports','ioredis','../../../config/environment','defaults','redis','localhost'];(function(_0x4b7e4d,_0x82d2ab){var _0x38d6af=function(_0x227432){while(--_0x227432){_0x4b7e4d['push'](_0x4b7e4d['shift']());}};_0x38d6af(++_0x82d2ab);}(_0x3a01,0x191));var _0x13a0=function(_0x2465d0,_0x8be961){_0x2465d0=_0x2465d0-0x0;var _0x3e1be3=_0x3a01[_0x2465d0];return _0x3e1be3;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x13a0('0x0'));var config=require(_0x13a0('0x1'));config['redis']=_[_0x13a0('0x2')](config[_0x13a0('0x3')],{'host':_0x13a0('0x4'),'port':0x18eb});var io=require(_0x13a0('0x5'))(new Redis(config[_0x13a0('0x3')]));function FaxQueue(_0x239e0c){this['id']=_0x239e0c['id']||0x0;this[_0x13a0('0x6')]=_0x239e0c[_0x13a0('0x6')]||'';this[_0x13a0('0x7')]=_0x239e0c[_0x13a0('0x7')]||0xa;this[_0x13a0('0x8')]=_0x239e0c[_0x13a0('0x8')]||_0x13a0('0x9');this[_0x13a0('0xa')]=_0x239e0c[_0x13a0('0xa')];this[_0x13a0('0xb')]={};this[_0x13a0('0xc')]=0x0;this[_0x13a0('0xd')]='';this[_0x13a0('0xe')]();this[_0x13a0('0xf')]();}FaxQueue[_0x13a0('0x10')][_0x13a0('0xe')]=function(){var _0x33cb00=this['mapAgentsId'][_0x13a0('0x11')];this[_0x13a0('0xb')]=_['map'](this[_0x13a0('0xa')],'id');this[_0x13a0('0xb')]['_rr']=_0x33cb00;};FaxQueue[_0x13a0('0x10')]['updateRealtime']=function(){this[_0x13a0('0x12')]=0x0;this[_0x13a0('0x13')]=0x0;for(var _0x29bd41=0x0;_0x29bd41=0x0?this[_0x13a0('0x17')]:0x0;var _0x58e7b1={'id':this['id'],'available':this[_0x13a0('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x13a0('0x13')],'waiting':this['waiting']};var _0x3d7627=md5(JSON[_0x13a0('0x18')](_0x58e7b1));if(this['md5']!==_0x3d7627){this[_0x13a0('0xd')]=_0x3d7627;io['to'](util[_0x13a0('0x19')](_0x13a0('0x1a'),_0x58e7b1[_0x13a0('0x6')]))[_0x13a0('0x1b')]('fax_queue:save',_0x58e7b1);}};module[_0x13a0('0x1c')]=FaxQueue; \ No newline at end of file +var _0x81f7=['format','fax:queue:%s','emit','fax_queue:save','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','map','updateRealtime','loggedIn','paused','length','faxPause','available','stringify'];(function(_0x990980,_0x1301bc){var _0x42f782=function(_0x2843c2){while(--_0x2843c2){_0x990980['push'](_0x990980['shift']());}};_0x42f782(++_0x1301bc);}(_0x81f7,0x156));var _0x781f=function(_0x5d2438,_0x6c8466){_0x5d2438=_0x5d2438-0x0;var _0x26e9d7=_0x81f7[_0x5d2438];return _0x26e9d7;};'use strict';var _=require('lodash');var md5=require(_0x781f('0x0'));var util=require(_0x781f('0x1'));var Redis=require(_0x781f('0x2'));var config=require(_0x781f('0x3'));config[_0x781f('0x4')]=_['defaults'](config[_0x781f('0x4')],{'host':_0x781f('0x5'),'port':0x18eb});var io=require(_0x781f('0x6'))(new Redis(config['redis']));function FaxQueue(_0x3ac765){this['id']=_0x3ac765['id']||0x0;this[_0x781f('0x7')]=_0x3ac765['name']||'';this[_0x781f('0x8')]=_0x3ac765['timeout']||0xa;this[_0x781f('0x9')]=_0x3ac765[_0x781f('0x9')]||'beepall';this[_0x781f('0xa')]=_0x3ac765[_0x781f('0xa')];this[_0x781f('0xb')]={};this[_0x781f('0xc')]=0x0;this[_0x781f('0x0')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue['prototype'][_0x781f('0xd')]=function(){var _0x58a941=this[_0x781f('0xb')]['_rr'];this['mapAgentsId']=_[_0x781f('0xe')](this[_0x781f('0xa')],'id');this[_0x781f('0xb')]['_rr']=_0x58a941;};FaxQueue['prototype'][_0x781f('0xf')]=function(){this[_0x781f('0x10')]=0x0;this[_0x781f('0x11')]=0x0;for(var _0x263286=0x0;_0x263286=0x0?this[_0x781f('0x14')]:0x0;var _0x22eb0d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x781f('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x781f('0xc')]};var _0x3506d6=md5(JSON[_0x781f('0x15')](_0x22eb0d));if(this[_0x781f('0x0')]!==_0x3506d6){this['md5']=_0x3506d6;io['to'](util[_0x781f('0x16')](_0x781f('0x17'),_0x22eb0d[_0x781f('0x7')]))[_0x781f('0x18')](_0x781f('0x19'),_0x22eb0d);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index a867c6f..56e074d 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 _0xaba6=['name','Intervals'];(function(_0x13332c,_0x2bfb4f){var _0x478d46=function(_0x296714){while(--_0x296714){_0x13332c['push'](_0x13332c['shift']());}};_0x478d46(++_0x2bfb4f);}(_0xaba6,0x190));var _0x6aba=function(_0x280cb6,_0x4b92fa){_0x280cb6=_0x280cb6-0x0;var _0xbaf53=_0xaba6[_0x280cb6];return _0xbaf53;};'use strict';function Interval(_0x36821a){this['id']=_0x36821a['id']||0x0;this[_0x6aba('0x0')]=_0x36821a[_0x6aba('0x0')]||'';this['Intervals']=_0x36821a[_0x6aba('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0x7bfc=['Intervals','exports'];(function(_0x310c3c,_0x242559){var _0x3cbb46=function(_0x3c9182){while(--_0x3c9182){_0x310c3c['push'](_0x310c3c['shift']());}};_0x3cbb46(++_0x242559);}(_0x7bfc,0x15c));var _0xc7bf=function(_0xd3e6cf,_0x2335f9){_0xd3e6cf=_0xd3e6cf-0x0;var _0x242782=_0x7bfc[_0xd3e6cf];return _0x242782;};'use strict';function Interval(_0x4c9c9a){this['id']=_0x4c9c9a['id']||0x0;this['name']=_0x4c9c9a['name']||'';this[_0xc7bf('0x0')]=_0x4c9c9a['Intervals']||{};}module[_0xc7bf('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index c3c7d29..5839c25 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 _0x0e60=['socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','length','online','mailPause','paused','available','stringify','format','mail:queue:%s','emit','mail_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e60,0x1ab));var _0x00e6=function(_0x266efd,_0x1893b7){_0x266efd=_0x266efd-0x0;var _0x36a5ca=_0x0e60[_0x266efd];return _0x36a5ca;};'use strict';var _=require('lodash');var md5=require(_0x00e6('0x0'));var util=require(_0x00e6('0x1'));var Redis=require(_0x00e6('0x2'));var config=require(_0x00e6('0x3'));config[_0x00e6('0x4')]=_[_0x00e6('0x5')](config[_0x00e6('0x4')],{'host':_0x00e6('0x6'),'port':0x18eb});var io=require(_0x00e6('0x7'))(new Redis(config[_0x00e6('0x4')]));function MailQueue(_0x92059b){this['id']=_0x92059b['id']||0x0;this[_0x00e6('0x8')]=_0x92059b[_0x00e6('0x8')]||'';this[_0x00e6('0x9')]=_0x92059b[_0x00e6('0x9')]||0xa;this[_0x00e6('0xa')]=_0x92059b[_0x00e6('0xa')]||_0x00e6('0xb');this['Agents']=_0x92059b['Agents'];this[_0x00e6('0xc')]={};this[_0x00e6('0xd')]=0x0;this['md5']='';this[_0x00e6('0xe')]();this[_0x00e6('0xf')]();}MailQueue[_0x00e6('0x10')][_0x00e6('0xe')]=function(){var _0x2ac14d=this['mapAgentsId'][_0x00e6('0x11')];this[_0x00e6('0xc')]=_[_0x00e6('0x12')](this[_0x00e6('0x13')],'id');this[_0x00e6('0xc')][_0x00e6('0x11')]=_0x2ac14d;};MailQueue['prototype'][_0x00e6('0xf')]=function(){this[_0x00e6('0x14')]=0x0;this['paused']=0x0;for(var _0x52d600=0x0;_0x52d600=0x0?this[_0x00e6('0x19')]:0x0;var _0x1154d6={'id':this['id'],'available':this[_0x00e6('0x19')],'loggedIn':this['loggedIn'],'name':this[_0x00e6('0x8')],'paused':this[_0x00e6('0x18')],'waiting':this[_0x00e6('0xd')]};var _0x15d7a3=md5(JSON[_0x00e6('0x1a')](_0x1154d6));if(this[_0x00e6('0x0')]!==_0x15d7a3){this[_0x00e6('0x0')]=_0x15d7a3;io['to'](util[_0x00e6('0x1b')](_0x00e6('0x1c'),_0x1154d6['name']))[_0x00e6('0x1d')](_0x00e6('0x1e'),_0x1154d6);}};module['exports']=MailQueue; \ No newline at end of file +var _0x721f=['updateRouting','updateRealtime','_rr','map','prototype','paused','online','mailPause','available','loggedIn','stringify','format','emit','exports','lodash','md5','util','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x1f3130,_0x114989){var _0x1c3221=function(_0x44dbc0){while(--_0x44dbc0){_0x1f3130['push'](_0x1f3130['shift']());}};_0x1c3221(++_0x114989);}(_0x721f,0x1ea));var _0xf721=function(_0x4e9c7b,_0x596ba9){_0x4e9c7b=_0x4e9c7b-0x0;var _0x52e053=_0x721f[_0x4e9c7b];return _0x52e053;};'use strict';var _=require(_0xf721('0x0'));var md5=require(_0xf721('0x1'));var util=require(_0xf721('0x2'));var Redis=require(_0xf721('0x3'));var config=require('../../../config/environment');config[_0xf721('0x4')]=_[_0xf721('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xf721('0x6'))(new Redis(config['redis']));function MailQueue(_0x5d4f84){this['id']=_0x5d4f84['id']||0x0;this[_0xf721('0x7')]=_0x5d4f84['name']||'';this[_0xf721('0x8')]=_0x5d4f84[_0xf721('0x8')]||0xa;this[_0xf721('0x9')]=_0x5d4f84['strategy']||_0xf721('0xa');this[_0xf721('0xb')]=_0x5d4f84[_0xf721('0xb')];this[_0xf721('0xc')]={};this[_0xf721('0xd')]=0x0;this[_0xf721('0x1')]='';this[_0xf721('0xe')]();this[_0xf721('0xf')]();}MailQueue['prototype'][_0xf721('0xe')]=function(){var _0x5abf71=this[_0xf721('0xc')][_0xf721('0x10')];this[_0xf721('0xc')]=_[_0xf721('0x11')](this[_0xf721('0xb')],'id');this[_0xf721('0xc')][_0xf721('0x10')]=_0x5abf71;};MailQueue[_0xf721('0x12')][_0xf721('0xf')]=function(){this['loggedIn']=0x0;this[_0xf721('0x13')]=0x0;for(var _0x5156b9=0x0;_0x5156b9=0x0?this[_0xf721('0x16')]:0x0;var _0x27f035={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf721('0x17')],'name':this[_0xf721('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x354fdd=md5(JSON[_0xf721('0x18')](_0x27f035));if(this[_0xf721('0x1')]!==_0x354fdd){this['md5']=_0x354fdd;io['to'](util[_0xf721('0x19')]('mail:queue:%s',_0x27f035[_0xf721('0x7')]))[_0xf721('0x1a')]('mail_queue:save',_0x27f035);}};module[_0xf721('0x1b')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 632da77..0ba4baf 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x31a37b,_0x826249){var _0x49ae16=function(_0x2e8d52){while(--_0x2e8d52){_0x31a37b['push'](_0x31a37b['shift']());}};_0x49ae16(++_0x826249);}(_0x2ef3,0xba));var _0x32ef=function(_0x3149b2,_0x2303c2){_0x3149b2=_0x3149b2-0x0;var _0x841b56=_0x2ef3[_0x3149b2];return _0x841b56;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 2530401..2799734 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 _0x0207=['emit','sms_queue:save','exports','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','updateRealtime','paused','length','online','loggedIn','available','format','sms:queue:%s'];(function(_0x2639ed,_0x4f5769){var _0x4ed95f=function(_0x354ff2){while(--_0x354ff2){_0x2639ed['push'](_0x2639ed['shift']());}};_0x4ed95f(++_0x4f5769);}(_0x0207,0x162));var _0x7020=function(_0x1e1962,_0x5a2061){_0x1e1962=_0x1e1962-0x0;var _0x3c06be=_0x0207[_0x1e1962];return _0x3c06be;};'use strict';var _=require('lodash');var md5=require(_0x7020('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x7020('0x1'));config[_0x7020('0x2')]=_[_0x7020('0x3')](config[_0x7020('0x2')],{'host':_0x7020('0x4'),'port':0x18eb});var io=require(_0x7020('0x5'))(new Redis(config[_0x7020('0x2')]));function SmsQueue(_0x5b7cf1){this['id']=_0x5b7cf1['id']||0x0;this['name']=_0x5b7cf1[_0x7020('0x6')]||'';this[_0x7020('0x7')]=_0x5b7cf1[_0x7020('0x7')]||0xa;this[_0x7020('0x8')]=_0x5b7cf1[_0x7020('0x8')]||_0x7020('0x9');this[_0x7020('0xa')]=_0x5b7cf1['Agents'];this['mapAgentsId']={};this[_0x7020('0xb')]=0x0;this[_0x7020('0x0')]='';this[_0x7020('0xc')]();this['updateRealtime']();}SmsQueue[_0x7020('0xd')][_0x7020('0xc')]=function(){var _0x4e16da=this[_0x7020('0xe')][_0x7020('0xf')];this[_0x7020('0xe')]=_['map'](this[_0x7020('0xa')],'id');this[_0x7020('0xe')][_0x7020('0xf')]=_0x4e16da;};SmsQueue[_0x7020('0xd')][_0x7020('0x10')]=function(){this['loggedIn']=0x0;this[_0x7020('0x11')]=0x0;for(var _0x5f5872=0x0;_0x5f5872=0x0?this['available']:0x0;var _0x3d5d25={'id':this['id'],'available':this[_0x7020('0x15')],'loggedIn':this[_0x7020('0x14')],'name':this[_0x7020('0x6')],'paused':this[_0x7020('0x11')],'waiting':this[_0x7020('0xb')]};var _0x59b5d2=md5(JSON['stringify'](_0x3d5d25));if(this[_0x7020('0x0')]!==_0x59b5d2){this[_0x7020('0x0')]=_0x59b5d2;io['to'](util[_0x7020('0x16')](_0x7020('0x17'),_0x3d5d25['name']))[_0x7020('0x18')](_0x7020('0x19'),_0x3d5d25);}};module[_0x7020('0x1a')]=SmsQueue; \ No newline at end of file +var _0xa3e6=['name','timeout','strategy','Agents','md5','updateRealtime','updateRouting','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','smsPause','available','waiting','format','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost'];(function(_0x298abc,_0x3d2c9d){var _0x28051e=function(_0xf7a936){while(--_0xf7a936){_0x298abc['push'](_0x298abc['shift']());}};_0x28051e(++_0x3d2c9d);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x43a07c,_0x45f600){_0x43a07c=_0x43a07c-0x0;var _0x3bc7bc=_0xa3e6[_0x43a07c];return _0x3bc7bc;};'use strict';var _=require(_0x6a3e('0x0'));var md5=require('md5');var util=require(_0x6a3e('0x1'));var Redis=require('ioredis');var config=require(_0x6a3e('0x2'));config[_0x6a3e('0x3')]=_[_0x6a3e('0x4')](config['redis'],{'host':_0x6a3e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a3e('0x3')]));function SmsQueue(_0x23599b){this['id']=_0x23599b['id']||0x0;this[_0x6a3e('0x6')]=_0x23599b[_0x6a3e('0x6')]||'';this[_0x6a3e('0x7')]=_0x23599b['timeout']||0xa;this[_0x6a3e('0x8')]=_0x23599b[_0x6a3e('0x8')]||'beepall';this['Agents']=_0x23599b[_0x6a3e('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x6a3e('0xa')]='';this['updateRouting']();this[_0x6a3e('0xb')]();}SmsQueue['prototype'][_0x6a3e('0xc')]=function(){var _0x3159db=this[_0x6a3e('0xd')][_0x6a3e('0xe')];this[_0x6a3e('0xd')]=_[_0x6a3e('0xf')](this['Agents'],'id');this[_0x6a3e('0xd')][_0x6a3e('0xe')]=_0x3159db;};SmsQueue[_0x6a3e('0x10')][_0x6a3e('0xb')]=function(){this[_0x6a3e('0x11')]=0x0;this[_0x6a3e('0x12')]=0x0;for(var _0x222f7c=0x0;_0x222f7c=0x0?this[_0x6a3e('0x16')]:0x0;var _0x467e2c={'id':this['id'],'available':this[_0x6a3e('0x16')],'loggedIn':this[_0x6a3e('0x11')],'name':this[_0x6a3e('0x6')],'paused':this[_0x6a3e('0x12')],'waiting':this[_0x6a3e('0x17')]};var _0x2f2150=md5(JSON['stringify'](_0x467e2c));if(this[_0x6a3e('0xa')]!==_0x2f2150){this['md5']=_0x2f2150;io['to'](util[_0x6a3e('0x18')]('sms:queue:%s',_0x467e2c[_0x6a3e('0x6')]))[_0x6a3e('0x19')](_0x6a3e('0x1a'),_0x467e2c);}};module[_0x6a3e('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 6c55cd7..e49a8d2 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 _0x1068=['online','available','stringify','emit','whatsapp_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','length'];(function(_0x2833fd,_0x28c021){var _0x3331a0=function(_0x10851d){while(--_0x10851d){_0x2833fd['push'](_0x2833fd['shift']());}};_0x3331a0(++_0x28c021);}(_0x1068,0x13d));var _0x8106=function(_0x4c17e0,_0x3701c7){_0x4c17e0=_0x4c17e0-0x0;var _0x17448d=_0x1068[_0x4c17e0];return _0x17448d;};'use strict';var _=require(_0x8106('0x0'));var md5=require(_0x8106('0x1'));var util=require(_0x8106('0x2'));var Redis=require(_0x8106('0x3'));var config=require(_0x8106('0x4'));config['redis']=_[_0x8106('0x5')](config['redis'],{'host':_0x8106('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x3f614d){this['id']=_0x3f614d['id']||0x0;this[_0x8106('0x7')]=_0x3f614d[_0x8106('0x7')]||'';this[_0x8106('0x8')]=_0x3f614d['timeout']||0xa;this[_0x8106('0x9')]=_0x3f614d[_0x8106('0x9')]||_0x8106('0xa');this['Agents']=_0x3f614d[_0x8106('0xb')];this[_0x8106('0xc')]={};this[_0x8106('0xd')]=0x0;this[_0x8106('0x1')]='';this[_0x8106('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x8106('0xf')]['updateRouting']=function(){var _0x164b8d=this[_0x8106('0xc')][_0x8106('0x10')];this[_0x8106('0xc')]=_[_0x8106('0x11')](this[_0x8106('0xb')],'id');this['mapAgentsId'][_0x8106('0x10')]=_0x164b8d;};WhatsappQueue[_0x8106('0xf')]['updateRealtime']=function(){this[_0x8106('0x12')]=0x0;this[_0x8106('0x13')]=0x0;for(var _0x3496e2=0x0;_0x3496e2=0x0?this['available']:0x0;var _0x56011c={'id':this['id'],'available':this[_0x8106('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x8106('0x7')],'paused':this[_0x8106('0x13')],'waiting':this[_0x8106('0xd')]};var _0x5b294=md5(JSON[_0x8106('0x17')](_0x56011c));if(this['md5']!==_0x5b294){this['md5']=_0x5b294;io['to'](util['format']('whatsapp:queue:%s',_0x56011c[_0x8106('0x7')]))[_0x8106('0x18')](_0x8106('0x19'),_0x56011c);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0xc9e9=['whatsappPause','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','redis','defaults','localhost','name','timeout','strategy','Agents','updateRouting','updateRealtime','prototype','_rr','mapAgentsId','map','loggedIn','paused','length','online'];(function(_0x1989e2,_0x5a3b47){var _0x218d38=function(_0x572af8){while(--_0x572af8){_0x1989e2['push'](_0x1989e2['shift']());}};_0x218d38(++_0x5a3b47);}(_0xc9e9,0xe7));var _0x9c9e=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xc9e9[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0x9c9e('0x0'));var md5=require(_0x9c9e('0x1'));var util=require(_0x9c9e('0x2'));var Redis=require(_0x9c9e('0x3'));var config=require('../../../config/environment');config[_0x9c9e('0x4')]=_[_0x9c9e('0x5')](config[_0x9c9e('0x4')],{'host':_0x9c9e('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9c9e('0x4')]));function WhatsappQueue(_0x325e2a){this['id']=_0x325e2a['id']||0x0;this[_0x9c9e('0x7')]=_0x325e2a[_0x9c9e('0x7')]||'';this[_0x9c9e('0x8')]=_0x325e2a[_0x9c9e('0x8')]||0xa;this[_0x9c9e('0x9')]=_0x325e2a[_0x9c9e('0x9')]||'beepall';this[_0x9c9e('0xa')]=_0x325e2a['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x9c9e('0x1')]='';this[_0x9c9e('0xb')]();this[_0x9c9e('0xc')]();}WhatsappQueue[_0x9c9e('0xd')][_0x9c9e('0xb')]=function(){var _0x3563f9=this['mapAgentsId'][_0x9c9e('0xe')];this[_0x9c9e('0xf')]=_[_0x9c9e('0x10')](this['Agents'],'id');this[_0x9c9e('0xf')][_0x9c9e('0xe')]=_0x3563f9;};WhatsappQueue[_0x9c9e('0xd')]['updateRealtime']=function(){this[_0x9c9e('0x11')]=0x0;this[_0x9c9e('0x12')]=0x0;for(var _0x165a26=0x0;_0x165a26=0x0?this['available']:0x0;var _0xb454d5={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x9c9e('0x12')],'waiting':this['waiting']};var _0x21d16b=md5(JSON[_0x9c9e('0x17')](_0xb454d5));if(this['md5']!==_0x21d16b){this[_0x9c9e('0x1')]=_0x21d16b;io['to'](util['format'](_0x9c9e('0x18'),_0xb454d5[_0x9c9e('0x7')]))[_0x9c9e('0x19')](_0x9c9e('0x1a'),_0xb454d5);}};module[_0x9c9e('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 5a86031..10f9ea5 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x2c1f99,_0x24ee3b){var _0x7f6f6a=function(_0x58960c){while(--_0x58960c){_0x2c1f99['push'](_0x2c1f99['shift']());}};_0x7f6f6a(++_0x24ee3b);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f042c,_0x3d2cfe){_0x3f042c=_0x3f042c-0x0;var _0x280d2e=_0xb10b[_0x3f042c];return _0x280d2e;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index e14cc4a..86e7e9d 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 _0x0adf=['UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client','update','Request'];(function(_0x27cf08,_0x2d56ed){var _0x2f6d6e=function(_0x46f8c5){while(--_0x46f8c5){_0x27cf08['push'](_0x27cf08['shift']());}};_0x2f6d6e(++_0x2d56ed);}(_0x0adf,0xeb));var _0xf0ad=function(_0x4b4c7d,_0x30ae2b){_0x4b4c7d=_0x4b4c7d-0x0;var _0x2d586=_0x0adf[_0x4b4c7d];return _0x2d586;};'use strict';var client=require(_0xf0ad('0x0'));exports[_0xf0ad('0x1')]=function(_0xeea790,_0x58a1f1){return client[_0xf0ad('0x2')](_0xf0ad('0x3'),{'body':_0x58a1f1,'options':{'where':{'id':_0xeea790}},'log':_0xf0ad('0x4')});};exports[_0xf0ad('0x5')]=function(_0x370c8f,_0x21b386){return client[_0xf0ad('0x2')]('AddTagsToChatInteraction',{'body':_0x21b386,'options':{'where':{'id':_0x370c8f}},'log':_0xf0ad('0x6')});}; \ No newline at end of file +var _0xb0eb=['AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','addTags'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb0eb,0x1b1));var _0xbb0e=function(_0x49b602,_0x5e318a){_0x49b602=_0x49b602-0x0;var _0x343299=_0xb0eb[_0x49b602];return _0x343299;};'use strict';var client=require(_0xbb0e('0x0'));exports[_0xbb0e('0x1')]=function(_0x6cb392,_0x24a6d1){return client[_0xbb0e('0x2')](_0xbb0e('0x3'),{'body':_0x24a6d1,'options':{'where':{'id':_0x6cb392}},'log':'updateChatInteraction'});};exports[_0xbb0e('0x4')]=function(_0xed9e0a,_0x1fb1c7){return client['Request'](_0xbb0e('0x5'),{'body':_0x1fb1c7,'options':{'where':{'id':_0xed9e0a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index eb74190..6663b6c 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 _0x2bcb=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x391ccc,_0x14926f){var _0x50d327=function(_0x34e7a0){while(--_0x34e7a0){_0x391ccc['push'](_0x391ccc['shift']());}};_0x50d327(++_0x14926f);}(_0x2bcb,0x74));var _0xb2bc=function(_0x4165f8,_0x182b87){_0x4165f8=_0x4165f8-0x0;var _0xd8644d=_0x2bcb[_0x4165f8];return _0xd8644d;};'use strict';var client=require(_0xb2bc('0x0'));exports[_0xb2bc('0x1')]=function(_0x17f6a6){return client['Request'](_0xb2bc('0x2'),{'body':_0x17f6a6,'log':_0xb2bc('0x3')});}; \ No newline at end of file +var _0xae71=['createChatMessage','../client','Request'];(function(_0x45efed,_0x375d0b){var _0x20ae3b=function(_0x38996d){while(--_0x38996d){_0x45efed['push'](_0x45efed['shift']());}};_0x20ae3b(++_0x375d0b);}(_0xae71,0xca));var _0x1ae7=function(_0xce84b7,_0x1be375){_0xce84b7=_0xce84b7-0x0;var _0xf02e59=_0xae71[_0xce84b7];return _0xf02e59;};'use strict';var client=require(_0x1ae7('0x0'));exports['create']=function(_0x767e6e){return client[_0x1ae7('0x1')]('CreateChatMessage',{'body':_0x767e6e,'log':_0x1ae7('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 4f8cf33..73d612d 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 _0x482d=['strategy','User','online','chatPause','Request','GetChatQueue','name','timeout'];(function(_0x20a270,_0x8b8437){var _0x49429a=function(_0x4dc00b){while(--_0x4dc00b){_0x20a270['push'](_0x20a270['shift']());}};_0x49429a(++_0x8b8437);}(_0x482d,0x16c));var _0xd482=function(_0x2c533c,_0x5129f9){_0x2c533c=_0x2c533c-0x0;var _0x583bd2=_0x482d[_0x2c533c];return _0x583bd2;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0xd482('0x0')](_0xd482('0x1'),{'options':{'raw':![],'attributes':['id',_0xd482('0x2'),_0xd482('0x3'),_0xd482('0x4')],'include':[{'model':_0xd482('0x5'),'as':'Agents','attributes':['id',_0xd482('0x2'),_0xd482('0x6'),_0xd482('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x3148=['getChatQueues','GetChatQueue','name','timeout','strategy','Agents','online','chatPause','../client'];(function(_0x145204,_0x30d112){var _0x12cda3=function(_0x21880e){while(--_0x21880e){_0x145204['push'](_0x145204['shift']());}};_0x12cda3(++_0x30d112);}(_0x3148,0x1d3));var _0x8314=function(_0x412686,_0x3fde24){_0x412686=_0x412686-0x0;var _0x18619e=_0x3148[_0x412686];return _0x18619e;};'use strict';var client=require(_0x8314('0x0'));exports[_0x8314('0x1')]=function(){return function(){return client['Request'](_0x8314('0x2'),{'options':{'raw':![],'attributes':['id',_0x8314('0x3'),_0x8314('0x4'),_0x8314('0x5')],'include':[{'model':'User','as':_0x8314('0x6'),'attributes':['id',_0x8314('0x3'),_0x8314('0x7'),_0x8314('0x8')]}]},'log':_0x8314('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index ba8b495..0daf234 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 _0xe105=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x3f3a19,_0x50cf2b){var _0x4855ae=function(_0x3a0276){while(--_0x3a0276){_0x3f3a19['push'](_0x3f3a19['shift']());}};_0x4855ae(++_0x50cf2b);}(_0xe105,0xef));var _0x5e10=function(_0x1ffa4b,_0x583f78){_0x1ffa4b=_0x1ffa4b-0x0;var _0x4fd7d6=_0xe105[_0x1ffa4b];return _0x4fd7d6;};'use strict';var client=require(_0x5e10('0x0'));exports['create']=function(_0x4d5a73){return client['Request']('CreateChatQueueReport',{'body':_0x4d5a73,'log':_0x5e10('0x1')});};exports[_0x5e10('0x2')]=function(_0x1cddb3,_0x191ab2){return client['Request'](_0x5e10('0x3'),{'body':_0x191ab2,'options':{'where':{'uniqueid':_0x1cddb3},'order':[['id',_0x5e10('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xbdeb=['update','DESC','UpdateChatQueueReport','create','Request','CreateChatQueueReport'];(function(_0x57391c,_0x1a2a94){var _0x3de79b=function(_0x573b23){while(--_0x573b23){_0x57391c['push'](_0x57391c['shift']());}};_0x3de79b(++_0x1a2a94);}(_0xbdeb,0x6f));var _0xbbde=function(_0x5e3139,_0x5bad26){_0x5e3139=_0x5e3139-0x0;var _0x3cdf31=_0xbdeb[_0x5e3139];return _0x3cdf31;};'use strict';var client=require('../client');exports[_0xbbde('0x0')]=function(_0x4b7192){return client[_0xbbde('0x1')]('CreateChatQueueReport',{'body':_0x4b7192,'log':_0xbbde('0x2')});};exports[_0xbbde('0x3')]=function(_0x20d4f0,_0x3ee0ec){return client['Request']('UpdateChatQueueReport',{'body':_0x3ee0ec,'options':{'where':{'uniqueid':_0x20d4f0},'order':[['id',_0xbbde('0x4')]],'limit':0x1},'log':_0xbbde('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 9a87e74..781cae2 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x7a54,0x106));var _0x47a5=function(_0x3e990b,_0x36056b){_0x3e990b=_0x3e990b-0x0;var _0x5e07cf=_0x7a54[_0x3e990b];return _0x5e07cf;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x27ac32,_0x42771f){var _0x20c811=function(_0x12d837){while(--_0x12d837){_0x27ac32['push'](_0x27ac32['shift']());}};_0x20c811(++_0x42771f);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 7169639..b6bd0c0 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 _0x6510=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x585f40,_0x4a3091){var _0x44fc86=function(_0x5bcedc){while(--_0x5bcedc){_0x585f40['push'](_0x585f40['shift']());}};_0x44fc86(++_0x4a3091);}(_0x6510,0xf1));var _0x0651=function(_0x61e0a5,_0x4722c3){_0x61e0a5=_0x61e0a5-0x0;var _0x5da5e4=_0x6510[_0x61e0a5];return _0x5da5e4;};'use strict';var client=require(_0x0651('0x0'));exports[_0x0651('0x1')]=function(_0x3adcf4){return client[_0x0651('0x2')](_0x0651('0x3'),{'body':_0x3adcf4,'log':_0x0651('0x4')});}; \ No newline at end of file +var _0xbc81=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x2027eb,_0x5508f5){var _0x12a791=function(_0x220f59){while(--_0x220f59){_0x2027eb['push'](_0x2027eb['shift']());}};_0x12a791(++_0x5508f5);}(_0xbc81,0x8d));var _0x1bc8=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xbc81[_0x599f41];return _0x2e4d58;};'use strict';var client=require(_0x1bc8('0x0'));exports[_0x1bc8('0x1')]=function(_0xe9f772){return client[_0x1bc8('0x2')](_0x1bc8('0x3'),{'body':_0xe9f772,'log':_0x1bc8('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 323a675..1371dda 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 _0x2df4=['faxPause','getFaxQueues','Request','strategy','User','Agents','name','online'];(function(_0x725e56,_0xa5d92d){var _0x173bfc=function(_0x453c44){while(--_0x453c44){_0x725e56['push'](_0x725e56['shift']());}};_0x173bfc(++_0xa5d92d);}(_0x2df4,0x1c9));var _0x42df=function(_0x4978de,_0x5912e4){_0x4978de=_0x4978de-0x0;var _0x675221=_0x2df4[_0x4978de];return _0x675221;};'use strict';var client=require('../client');exports[_0x42df('0x0')]=function(){return function(){return client[_0x42df('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x42df('0x2')],'include':[{'model':_0x42df('0x3'),'as':_0x42df('0x4'),'attributes':['id',_0x42df('0x5'),_0x42df('0x6'),_0x42df('0x7')]}]},'log':_0x42df('0x0')});};}; \ No newline at end of file +var _0x0e1f=['Agents','online','faxPause','getFaxQueues','../client','Request','name','timeout','strategy','User'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0x0e1f,0x162));var _0xf0e1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0e1f[_0x1facfa];return _0x9ec701;};'use strict';var client=require(_0xf0e1('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xf0e1('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xf0e1('0x2'),_0xf0e1('0x3'),_0xf0e1('0x4')],'include':[{'model':_0xf0e1('0x5'),'as':_0xf0e1('0x6'),'attributes':['id',_0xf0e1('0x2'),_0xf0e1('0x7'),_0xf0e1('0x8')]}]},'log':_0xf0e1('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e8d653d..34080a1 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 _0x8b62=['DESC','UpdateFaxQueueReport','create','Request','CreateFaxQueueReport','update'];(function(_0x56407a,_0x51ab09){var _0x2e7c2e=function(_0x5870d2){while(--_0x5870d2){_0x56407a['push'](_0x56407a['shift']());}};_0x2e7c2e(++_0x51ab09);}(_0x8b62,0xb6));var _0x28b6=function(_0x47e93d,_0x26bbdd){_0x47e93d=_0x47e93d-0x0;var _0xe86c46=_0x8b62[_0x47e93d];return _0xe86c46;};'use strict';var client=require('../client');exports[_0x28b6('0x0')]=function(_0x28a2ba){return client[_0x28b6('0x1')](_0x28b6('0x2'),{'body':_0x28a2ba,'log':_0x28b6('0x2')});};exports[_0x28b6('0x3')]=function(_0x2a2fea,_0x3ab766){return client[_0x28b6('0x1')]('UpdateFaxQueueReport',{'body':_0x3ab766,'options':{'where':{'uniqueid':_0x2a2fea},'order':[['id',_0x28b6('0x4')]],'limit':0x1},'log':_0x28b6('0x5')});}; \ No newline at end of file +var _0x9c91=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x43aea8,_0x52fb4e){var _0x408de2=function(_0x4b28c7){while(--_0x4b28c7){_0x43aea8['push'](_0x43aea8['shift']());}};_0x408de2(++_0x52fb4e);}(_0x9c91,0x153));var _0x19c9=function(_0x525c13,_0x3a7272){_0x525c13=_0x525c13-0x0;var _0x3123b6=_0x9c91[_0x525c13];return _0x3123b6;};'use strict';var client=require(_0x19c9('0x0'));exports[_0x19c9('0x1')]=function(_0x38aeaa){return client[_0x19c9('0x2')](_0x19c9('0x3'),{'body':_0x38aeaa,'log':_0x19c9('0x3')});};exports[_0x19c9('0x4')]=function(_0x59bcd9,_0x5d5653){return client[_0x19c9('0x2')](_0x19c9('0x5'),{'body':_0x5d5653,'options':{'where':{'uniqueid':_0x59bcd9},'order':[['id',_0x19c9('0x6')]],'limit':0x1},'log':_0x19c9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 6109fbd..2da644e 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 _0xe2e1=['interval','../client','getIntervals','Request','GetInterval','Interval'];(function(_0x317ba6,_0x415351){var _0x356f9c=function(_0x29249b){while(--_0x29249b){_0x317ba6['push'](_0x317ba6['shift']());}};_0x356f9c(++_0x415351);}(_0xe2e1,0x157));var _0x1e2e=function(_0x2b4f49,_0x200f03){_0x2b4f49=_0x2b4f49-0x0;var _0x223a76=_0xe2e1[_0x2b4f49];return _0x223a76;};'use strict';var client=require(_0x1e2e('0x0'));exports[_0x1e2e('0x1')]=function(){return function(){return client[_0x1e2e('0x2')](_0x1e2e('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x1e2e('0x4'),'as':'Intervals','attributes':['id','name',_0x1e2e('0x5')]}]},'log':_0x1e2e('0x1')});};}; \ No newline at end of file +var _0x2674=['interval','../client','getIntervals','name','Interval','Intervals'];(function(_0x1db59b,_0x351d51){var _0x565f5c=function(_0x49e39e){while(--_0x49e39e){_0x1db59b['push'](_0x1db59b['shift']());}};_0x565f5c(++_0x351d51);}(_0x2674,0xa9));var _0x4267=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2674[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x4267('0x0'));exports[_0x4267('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x4267('0x2')],'include':[{'model':_0x4267('0x3'),'as':_0x4267('0x4'),'attributes':['id',_0x4267('0x2'),_0x4267('0x5')]}]},'log':_0x4267('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index b9e01f0..f62b56d 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 _0xe820=['../client','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0xa51e3e,_0xea78db){var _0x11147c=function(_0x2c9918){while(--_0x2c9918){_0xa51e3e['push'](_0xa51e3e['shift']());}};_0x11147c(++_0xea78db);}(_0xe820,0xd2));var _0x0e82=function(_0x5c8b35,_0x5154d0){_0x5c8b35=_0x5c8b35-0x0;var _0x214007=_0xe820[_0x5c8b35];return _0x214007;};'use strict';var client=require(_0x0e82('0x0'));exports['update']=function(_0x908a54,_0x4e6b50){return client['Request'](_0x0e82('0x1'),{'body':_0x4e6b50,'options':{'where':{'id':_0x908a54}},'log':_0x0e82('0x2')});};exports[_0x0e82('0x3')]=function(_0x59b28d,_0xc6d61e){return client['Request'](_0x0e82('0x4'),{'body':_0xc6d61e,'options':{'where':{'id':_0x59b28d}},'log':_0x0e82('0x5')});}; \ No newline at end of file +var _0x7916=['Request','addTagsToChatInteraction','../client','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x4375bc,_0x1d2193){var _0x24f7c0=function(_0x5efe75){while(--_0x5efe75){_0x4375bc['push'](_0x4375bc['shift']());}};_0x24f7c0(++_0x1d2193);}(_0x7916,0x128));var _0x6791=function(_0x16a08e,_0x2c9e3b){_0x16a08e=_0x16a08e-0x0;var _0x1594a0=_0x7916[_0x16a08e];return _0x1594a0;};'use strict';var client=require(_0x6791('0x0'));exports['update']=function(_0xeb0b9f,_0xdaaf2b){return client['Request'](_0x6791('0x1'),{'body':_0xdaaf2b,'options':{'where':{'id':_0xeb0b9f}},'log':_0x6791('0x2')});};exports[_0x6791('0x3')]=function(_0x330476,_0x5e6303){return client[_0x6791('0x4')]('AddTagsToMailInteraction',{'body':_0x5e6303,'options':{'where':{'id':_0x330476}},'log':_0x6791('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 61ef37b..8aa8891 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 _0x5eff=['Request','CreateMailMessage','createMailMessage','../client'];(function(_0x33e664,_0x22fc9f){var _0x52c1e8=function(_0x28d6c0){while(--_0x28d6c0){_0x33e664['push'](_0x33e664['shift']());}};_0x52c1e8(++_0x22fc9f);}(_0x5eff,0x177));var _0xf5ef=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x5eff[_0xa148b7];return _0x51efd3;};'use strict';var client=require(_0xf5ef('0x0'));exports['create']=function(_0x1b4d50){return client[_0xf5ef('0x1')](_0xf5ef('0x2'),{'body':_0x1b4d50,'log':_0xf5ef('0x3')});}; \ No newline at end of file +var _0x77dc=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x43dabb,_0x1dcda3){var _0x44f079=function(_0x43d89c){while(--_0x43d89c){_0x43dabb['push'](_0x43dabb['shift']());}};_0x44f079(++_0x1dcda3);}(_0x77dc,0x114));var _0xc77d=function(_0x4a491c,_0x14fc45){_0x4a491c=_0x4a491c-0x0;var _0x5d52fd=_0x77dc[_0x4a491c];return _0x5d52fd;};'use strict';var client=require(_0xc77d('0x0'));exports[_0xc77d('0x1')]=function(_0x581fc9){return client['Request'](_0xc77d('0x2'),{'body':_0x581fc9,'log':_0xc77d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index f95b8a5..c259fa3 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 _0xf6da=['timeout','strategy','User','Agents','mailPause','../client','getMailQueues','Request','GetMailQueue','name'];(function(_0x703c94,_0x273a5b){var _0x586fb9=function(_0x12dca7){while(--_0x12dca7){_0x703c94['push'](_0x703c94['shift']());}};_0x586fb9(++_0x273a5b);}(_0xf6da,0x19f));var _0xaf6d=function(_0x2a276d,_0x11589e){_0x2a276d=_0x2a276d-0x0;var _0x8441bf=_0xf6da[_0x2a276d];return _0x8441bf;};'use strict';var client=require(_0xaf6d('0x0'));exports[_0xaf6d('0x1')]=function(){return function(){return client[_0xaf6d('0x2')](_0xaf6d('0x3'),{'options':{'raw':![],'attributes':['id',_0xaf6d('0x4'),_0xaf6d('0x5'),_0xaf6d('0x6')],'include':[{'model':_0xaf6d('0x7'),'as':_0xaf6d('0x8'),'attributes':['id',_0xaf6d('0x4'),'online',_0xaf6d('0x9')]}]},'log':_0xaf6d('0x1')});};}; \ No newline at end of file +var _0xf32f=['getMailQueues','GetMailQueue','name','strategy','User','Agents','online','../client'];(function(_0x2366cf,_0x36bbf9){var _0x2dcef9=function(_0x113766){while(--_0x113766){_0x2366cf['push'](_0x2366cf['shift']());}};_0x2dcef9(++_0x36bbf9);}(_0xf32f,0x1ef));var _0xff32=function(_0x3a234a,_0x16d323){_0x3a234a=_0x3a234a-0x0;var _0x35c10a=_0xf32f[_0x3a234a];return _0x35c10a;};'use strict';var client=require(_0xff32('0x0'));exports[_0xff32('0x1')]=function(){return function(){return client['Request'](_0xff32('0x2'),{'options':{'raw':![],'attributes':['id',_0xff32('0x3'),'timeout',_0xff32('0x4')],'include':[{'model':_0xff32('0x5'),'as':_0xff32('0x6'),'attributes':['id',_0xff32('0x3'),_0xff32('0x7'),'mailPause']}]},'log':_0xff32('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 1eff7c8..73134a0 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 _0xe326=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xe326,0x176));var _0x6e32=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0xe326[_0x34ad72];return _0x5c9aa8;};'use strict';var client=require(_0x6e32('0x0'));exports[_0x6e32('0x1')]=function(_0x2cc672){return client[_0x6e32('0x2')](_0x6e32('0x3'),{'body':_0x2cc672,'log':_0x6e32('0x3')});};exports[_0x6e32('0x4')]=function(_0xcf7594,_0x1c7ed9){return client['Request'](_0x6e32('0x5'),{'body':_0x1c7ed9,'options':{'where':{'uniqueid':_0xcf7594},'order':[['id',_0x6e32('0x6')]],'limit':0x1},'log':_0x6e32('0x5')});}; \ No newline at end of file +var _0xd0d9=['create','CreateMailQueueReport','Request','UpdateMailQueueReport','../client'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd0d9,0x11c));var _0x9d0d=function(_0xe1a8d0,_0x292e4c){_0xe1a8d0=_0xe1a8d0-0x0;var _0x3a9c90=_0xd0d9[_0xe1a8d0];return _0x3a9c90;};'use strict';var client=require(_0x9d0d('0x0'));exports[_0x9d0d('0x1')]=function(_0x2e59d3){return client['Request'](_0x9d0d('0x2'),{'body':_0x2e59d3,'log':'CreateMailQueueReport'});};exports['update']=function(_0x1fe491,_0x2d5260){return client[_0x9d0d('0x3')](_0x9d0d('0x4'),{'body':_0x2d5260,'options':{'where':{'uniqueid':_0x1fe491},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 0867f3c..40697d9 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 _0xd039=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x37fccd,_0x15f747){var _0x1ce641=function(_0x5aa2d3){while(--_0x5aa2d3){_0x37fccd['push'](_0x37fccd['shift']());}};_0x1ce641(++_0x15f747);}(_0xd039,0x110));var _0x9d03=function(_0x3032ac,_0x34980c){_0x3032ac=_0x3032ac-0x0;var _0x43f1b6=_0xd039[_0x3032ac];return _0x43f1b6;};'use strict';var client=require(_0x9d03('0x0'));exports[_0x9d03('0x1')]=function(_0x121c64,_0x2c54eb){return client[_0x9d03('0x2')](_0x9d03('0x3'),{'body':_0x2c54eb,'options':{'where':{'id':_0x121c64}},'log':_0x9d03('0x4')});};exports[_0x9d03('0x5')]=function(_0x667a5,_0x5edc1a){return client[_0x9d03('0x2')](_0x9d03('0x6'),{'body':_0x5edc1a,'options':{'where':{'id':_0x667a5}},'log':_0x9d03('0x7')});}; \ No newline at end of file +var _0x968a=['addTags','AddTagsToOpenchannelInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x968a,0x1b8));var _0xa968=function(_0x577d63,_0x21cf6d){_0x577d63=_0x577d63-0x0;var _0x7bb968=_0x968a[_0x577d63];return _0x7bb968;};'use strict';var client=require(_0xa968('0x0'));exports['update']=function(_0xf5304f,_0x1a4597){return client[_0xa968('0x1')](_0xa968('0x2'),{'body':_0x1a4597,'options':{'where':{'id':_0xf5304f}},'log':_0xa968('0x3')});};exports[_0xa968('0x4')]=function(_0x51c880,_0x15502f){return client['Request'](_0xa968('0x5'),{'body':_0x15502f,'options':{'where':{'id':_0x51c880}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index ede055c..1494568 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 _0xed2f=['createOpenchannelMessage','../client','create','Request'];(function(_0x211825,_0x5a09ac){var _0xd40b05=function(_0x47031e){while(--_0x47031e){_0x211825['push'](_0x211825['shift']());}};_0xd40b05(++_0x5a09ac);}(_0xed2f,0x185));var _0xfed2=function(_0x2cd411,_0x4d1181){_0x2cd411=_0x2cd411-0x0;var _0x39bdcc=_0xed2f[_0x2cd411];return _0x39bdcc;};'use strict';var client=require(_0xfed2('0x0'));exports[_0xfed2('0x1')]=function(_0x31ea4f){return client[_0xfed2('0x2')]('CreateOpenchannelMessage',{'body':_0x31ea4f,'log':_0xfed2('0x3')});}; \ No newline at end of file +var _0x0497=['Request','createOpenchannelMessage','../client','create'];(function(_0x546763,_0xf1294d){var _0x21fb72=function(_0x15db31){while(--_0x15db31){_0x546763['push'](_0x546763['shift']());}};_0x21fb72(++_0xf1294d);}(_0x0497,0x96));var _0x7049=function(_0x1469bd,_0x15e0f5){_0x1469bd=_0x1469bd-0x0;var _0x2e560d=_0x0497[_0x1469bd];return _0x2e560d;};'use strict';var client=require(_0x7049('0x0'));exports[_0x7049('0x1')]=function(_0x29a0ad){return client[_0x7049('0x2')]('CreateOpenchannelMessage',{'body':_0x29a0ad,'log':_0x7049('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 3777bfe..0dabac6 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 _0xccb3=['online','openchannelPause','getOpenchannelQueues','Request','timeout','strategy','User','name'];(function(_0x157432,_0x48a4dc){var _0x21fa86=function(_0x52814a){while(--_0x52814a){_0x157432['push'](_0x157432['shift']());}};_0x21fa86(++_0x48a4dc);}(_0xccb3,0x15a));var _0x3ccb=function(_0x4d6bfd,_0x8d79ff){_0x4d6bfd=_0x4d6bfd-0x0;var _0x243a46=_0xccb3[_0x4d6bfd];return _0x243a46;};'use strict';var client=require('../client');exports[_0x3ccb('0x0')]=function(){return function(){return client[_0x3ccb('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id','name',_0x3ccb('0x2'),_0x3ccb('0x3')],'include':[{'model':_0x3ccb('0x4'),'as':'Agents','attributes':['id',_0x3ccb('0x5'),_0x3ccb('0x6'),_0x3ccb('0x7')]}]},'log':_0x3ccb('0x0')});};}; \ No newline at end of file +var _0x3583=['online','getOpenchannelQueues','../client','Request','name','timeout','strategy','User','Agents'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x3583,0xa4));var _0x3358=function(_0x395a69,_0x422258){_0x395a69=_0x395a69-0x0;var _0x969131=_0x3583[_0x395a69];return _0x969131;};'use strict';var client=require(_0x3358('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x3358('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x3358('0x2'),_0x3358('0x3'),_0x3358('0x4')],'include':[{'model':_0x3358('0x5'),'as':_0x3358('0x6'),'attributes':['id',_0x3358('0x2'),_0x3358('0x7'),'openchannelPause']}]},'log':_0x3358('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 3805dd7..a0a09ec 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 _0x2357=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','create'];(function(_0x1b21d8,_0x3cc422){var _0x1cdc25=function(_0x691aff){while(--_0x691aff){_0x1b21d8['push'](_0x1b21d8['shift']());}};_0x1cdc25(++_0x3cc422);}(_0x2357,0xa9));var _0x7235=function(_0x5d107c,_0x1f204d){_0x5d107c=_0x5d107c-0x0;var _0x53bd5a=_0x2357[_0x5d107c];return _0x53bd5a;};'use strict';var client=require('../client');exports[_0x7235('0x0')]=function(_0x3fa6d3){return client[_0x7235('0x1')](_0x7235('0x2'),{'body':_0x3fa6d3,'log':_0x7235('0x2')});};exports[_0x7235('0x3')]=function(_0x2e5bcb,_0x39b704){return client['Request'](_0x7235('0x4'),{'body':_0x39b704,'options':{'where':{'uniqueid':_0x2e5bcb},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x1605=['create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC'];(function(_0x31423b,_0x1e0d70){var _0x26110b=function(_0x14119c){while(--_0x14119c){_0x31423b['push'](_0x31423b['shift']());}};_0x26110b(++_0x1e0d70);}(_0x1605,0x1d4));var _0x5160=function(_0x23f723,_0x41393a){_0x23f723=_0x23f723-0x0;var _0x14714c=_0x1605[_0x23f723];return _0x14714c;};'use strict';var client=require('../client');exports[_0x5160('0x0')]=function(_0x12d813){return client['Request'](_0x5160('0x1'),{'body':_0x12d813,'log':_0x5160('0x1')});};exports[_0x5160('0x2')]=function(_0xac9ae6,_0x3bbba1){return client[_0x5160('0x3')](_0x5160('0x4'),{'body':_0x3bbba1,'options':{'where':{'uniqueid':_0xac9ae6},'order':[['id',_0x5160('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e6ea224..f68ee66 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 _0x52ad=['../client','update','UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction'];(function(_0x5b383a,_0x119991){var _0x596055=function(_0x3c4e4e){while(--_0x3c4e4e){_0x5b383a['push'](_0x5b383a['shift']());}};_0x596055(++_0x119991);}(_0x52ad,0x1d8));var _0xd52a=function(_0x34db04,_0x4a8d43){_0x34db04=_0x34db04-0x0;var _0x3e3d72=_0x52ad[_0x34db04];return _0x3e3d72;};'use strict';var client=require(_0xd52a('0x0'));exports[_0xd52a('0x1')]=function(_0x44ae9f,_0xd42738){return client['Request'](_0xd52a('0x2'),{'body':_0xd42738,'options':{'where':{'id':_0x44ae9f}},'log':_0xd52a('0x3')});};exports[_0xd52a('0x4')]=function(_0xf1d12e,_0x69fd93){return client[_0xd52a('0x5')](_0xd52a('0x6'),{'body':_0x69fd93,'options':{'where':{'id':_0xf1d12e}},'log':_0xd52a('0x7')});}; \ No newline at end of file +var _0x2fda=['UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request'];(function(_0x35f704,_0x2fb3b3){var _0xa307a3=function(_0x35ceee){while(--_0x35ceee){_0x35f704['push'](_0x35f704['shift']());}};_0xa307a3(++_0x2fb3b3);}(_0x2fda,0x186));var _0xa2fd=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x2fda[_0x481bf7];return _0x461787;};'use strict';var client=require(_0xa2fd('0x0'));exports['update']=function(_0x5bfb50,_0x2a1c31){return client[_0xa2fd('0x1')](_0xa2fd('0x2'),{'body':_0x2a1c31,'options':{'where':{'id':_0x5bfb50}},'log':_0xa2fd('0x3')});};exports[_0xa2fd('0x4')]=function(_0x5a36d9,_0x497c5f){return client['Request'](_0xa2fd('0x5'),{'body':_0x497c5f,'options':{'where':{'id':_0x5a36d9}},'log':_0xa2fd('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 8a361fe..77de704 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 _0xcd5f=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x81f000,_0x15df85){var _0x337aa2=function(_0x37f6a4){while(--_0x37f6a4){_0x81f000['push'](_0x81f000['shift']());}};_0x337aa2(++_0x15df85);}(_0xcd5f,0xd4));var _0xfcd5=function(_0x3c65e5,_0x1a175d){_0x3c65e5=_0x3c65e5-0x0;var _0x2ab862=_0xcd5f[_0x3c65e5];return _0x2ab862;};'use strict';var client=require(_0xfcd5('0x0'));exports[_0xfcd5('0x1')]=function(_0x52ec44){return client[_0xfcd5('0x2')](_0xfcd5('0x3'),{'body':_0x52ec44,'log':_0xfcd5('0x4')});}; \ No newline at end of file +var _0x81be=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x81be,0xf4));var _0xe81b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x81be[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0xe81b('0x0'));exports[_0xe81b('0x1')]=function(_0x528009){return client['Request'](_0xe81b('0x2'),{'body':_0x528009,'log':_0xe81b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 3eccfa5..ba58755 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x190a9f,_0x31b462){var _0x3d944f=function(_0x41804d){while(--_0x41804d){_0x190a9f['push'](_0x190a9f['shift']());}};_0x3d944f(++_0x31b462);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x264e0b,_0x9f827f){var _0x40616b=function(_0x237658){while(--_0x237658){_0x264e0b['push'](_0x264e0b['shift']());}};_0x40616b(++_0x9f827f);}(_0x70e0,0x17b));var _0x070e=function(_0x49cc49,_0x13a261){_0x49cc49=_0x49cc49-0x0;var _0x6cf7b2=_0x70e0[_0x49cc49];return _0x6cf7b2;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 0e12f50..fdc216b 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 _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0xa3de09,_0x191222){var _0x20d31c=function(_0x1b26e8){while(--_0x1b26e8){_0xa3de09['push'](_0xa3de09['shift']());}};_0x20d31c(++_0x191222);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x2cc1d3,_0x2614a2){var _0x249e05=function(_0x20f302){while(--_0x20f302){_0x2cc1d3['push'](_0x2cc1d3['shift']());}};_0x249e05(++_0x2614a2);}(_0x70e0,0x17b));var _0x070e=function(_0x31e71e,_0x29930c){_0x31e71e=_0x31e71e-0x0;var _0x5776ec=_0x70e0[_0x31e71e];return _0x5776ec;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2f331dd..1d4c95f 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(_0x5e055e,_0x36b550){var _0x4ce50d=function(_0x21446e){while(--_0x21446e){_0x5e055e['push'](_0x5e055e['shift']());}};_0x4ce50d(++_0x36b550);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x73df09,_0x5b217b){var _0x2c23a0=function(_0x11f752){while(--_0x11f752){_0x73df09['push'](_0x73df09['shift']());}};_0x2c23a0(++_0x5b217b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 d03372c..8c07e48 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 _0x1224=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x392dc2,_0x47c3f3){var _0x14150f=function(_0x9f305a){while(--_0x9f305a){_0x392dc2['push'](_0x392dc2['shift']());}};_0x14150f(++_0x47c3f3);}(_0x1224,0x10d));var _0x4122=function(_0xb1ee0e,_0x2126df){_0xb1ee0e=_0xb1ee0e-0x0;var _0x376116=_0x1224[_0xb1ee0e];return _0x376116;};'use strict';var client=require(_0x4122('0x0'));exports[_0x4122('0x1')]=function(_0x23c391,_0x4122fd){return client[_0x4122('0x2')](_0x4122('0x3'),{'body':_0x4122fd,'options':{'where':{'id':_0x23c391}},'log':'updateWhatsappInteraction'});};exports[_0x4122('0x4')]=function(_0x1f1533,_0x2f506b){return client['Request'](_0x4122('0x5'),{'body':_0x2f506b,'options':{'where':{'id':_0x1f1533}},'log':_0x4122('0x6')});}; \ No newline at end of file +var _0x2f74=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','../client','Request'];(function(_0x41031d,_0x17a3ee){var _0x2606c8=function(_0x24b03a){while(--_0x24b03a){_0x41031d['push'](_0x41031d['shift']());}};_0x2606c8(++_0x17a3ee);}(_0x2f74,0x7b));var _0x42f7=function(_0x6aa32f,_0x3820f7){_0x6aa32f=_0x6aa32f-0x0;var _0x52bfee=_0x2f74[_0x6aa32f];return _0x52bfee;};'use strict';var client=require(_0x42f7('0x0'));exports['update']=function(_0x216970,_0x32d116){return client[_0x42f7('0x1')](_0x42f7('0x2'),{'body':_0x32d116,'options':{'where':{'id':_0x216970}},'log':_0x42f7('0x3')});};exports[_0x42f7('0x4')]=function(_0x43a650,_0x16d639){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x16d639,'options':{'where':{'id':_0x43a650}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 2805b16..e630187 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 _0x5bfb=['createWhatsappMessage','create','CreateWhatsappMessage'];(function(_0x3926dd,_0x291f75){var _0x3446f8=function(_0x5a54ae){while(--_0x5a54ae){_0x3926dd['push'](_0x3926dd['shift']());}};_0x3446f8(++_0x291f75);}(_0x5bfb,0xeb));var _0xb5bf=function(_0x5815d7,_0x150c8c){_0x5815d7=_0x5815d7-0x0;var _0x24e44e=_0x5bfb[_0x5815d7];return _0x24e44e;};'use strict';var client=require('../client');exports[_0xb5bf('0x0')]=function(_0x35d2b3){return client['Request'](_0xb5bf('0x1'),{'body':_0x35d2b3,'log':_0xb5bf('0x2')});}; \ No newline at end of file +var _0xd601=['create','createWhatsappMessage','../client'];(function(_0x50832e,_0x91fdb8){var _0x8b6132=function(_0x12dd44){while(--_0x12dd44){_0x50832e['push'](_0x50832e['shift']());}};_0x8b6132(++_0x91fdb8);}(_0xd601,0x10d));var _0x1d60=function(_0x54e486,_0xf54b2b){_0x54e486=_0x54e486-0x0;var _0x3d9dc0=_0xd601[_0x54e486];return _0x3d9dc0;};'use strict';var client=require(_0x1d60('0x0'));exports[_0x1d60('0x1')]=function(_0x42050c){return client['Request']('CreateWhatsappMessage',{'body':_0x42050c,'log':_0x1d60('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 5bf0dce..3e486da 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 _0x2545=['GetWhatsappQueue','name','timeout','User','Agents','getWhatsappQueues','Request'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2545,0x148));var _0x5254=function(_0x33cb98,_0x59d992){_0x33cb98=_0x33cb98-0x0;var _0x1edd8f=_0x2545[_0x33cb98];return _0x1edd8f;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x5254('0x0')](_0x5254('0x1'),{'options':{'raw':![],'attributes':['id',_0x5254('0x2'),_0x5254('0x3'),'strategy'],'include':[{'model':_0x5254('0x4'),'as':_0x5254('0x5'),'attributes':['id','name','online','whatsappPause']}]},'log':_0x5254('0x6')});};}; \ No newline at end of file +var _0xd77a=['../client','GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause'];(function(_0xc451b5,_0x396498){var _0x193963=function(_0x420800){while(--_0x420800){_0xc451b5['push'](_0xc451b5['shift']());}};_0x193963(++_0x396498);}(_0xd77a,0xb0));var _0xad77=function(_0x23b3d8,_0x4459c3){_0x23b3d8=_0x23b3d8-0x0;var _0x68eb4=_0xd77a[_0x23b3d8];return _0x68eb4;};'use strict';var client=require(_0xad77('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xad77('0x1'),{'options':{'raw':![],'attributes':['id',_0xad77('0x2'),_0xad77('0x3'),_0xad77('0x4')],'include':[{'model':_0xad77('0x5'),'as':'Agents','attributes':['id',_0xad77('0x2'),_0xad77('0x6'),_0xad77('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 4e694af..351e7ff 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 _0x5980=['Request','UpdateWhatsappQueueReport','DESC','../client','CreateWhatsappQueueReport','update'];(function(_0x1127bf,_0x542714){var _0x5bdfce=function(_0x29b766){while(--_0x29b766){_0x1127bf['push'](_0x1127bf['shift']());}};_0x5bdfce(++_0x542714);}(_0x5980,0x1b3));var _0x0598=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x5980[_0x999b85];return _0x1d7124;};'use strict';var client=require(_0x0598('0x0'));exports['create']=function(_0x378884){return client['Request'](_0x0598('0x1'),{'body':_0x378884,'log':_0x0598('0x1')});};exports[_0x0598('0x2')]=function(_0x5a5acf,_0x2e10bf){return client[_0x0598('0x3')](_0x0598('0x4'),{'body':_0x2e10bf,'options':{'where':{'uniqueid':_0x5a5acf},'order':[['id',_0x0598('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x7d10=['../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x41074d,_0x19b20f){var _0x1f61b9=function(_0x34458c){while(--_0x34458c){_0x41074d['push'](_0x41074d['shift']());}};_0x1f61b9(++_0x19b20f);}(_0x7d10,0x12c));var _0x07d1=function(_0x1d817b,_0x3384a1){_0x1d817b=_0x1d817b-0x0;var _0x3c7278=_0x7d10[_0x1d817b];return _0x3c7278;};'use strict';var client=require(_0x07d1('0x0'));exports['create']=function(_0x346643){return client[_0x07d1('0x1')](_0x07d1('0x2'),{'body':_0x346643,'log':'CreateWhatsappQueueReport'});};exports[_0x07d1('0x3')]=function(_0x2cdae9,_0x225e2d){return client[_0x07d1('0x1')](_0x07d1('0x4'),{'body':_0x225e2d,'options':{'where':{'uniqueid':_0x2cdae9},'order':[['id',_0x07d1('0x5')]],'limit':0x1},'log':_0x07d1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 73af33d..eed5e80 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 _0x05b9=['atimeout','channel','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','join','stop','find','timeout'];(function(_0x29d849,_0x209ceb){var _0x30b104=function(_0x2a1669){while(--_0x2a1669){_0x29d849['push'](_0x29d849['shift']());}};_0x30b104(++_0x209ceb);}(_0x05b9,0xc3));var _0x905b=function(_0x4e84d3,_0x1add05){_0x4e84d3=_0x4e84d3-0x0;var _0x1a0df6=_0x05b9[_0x4e84d3];return _0x1a0df6;};'use strict';var schema=require(_0x905b('0x0'));var _=require('lodash');var util=require(_0x905b('0x1'));var seqqueue=require(_0x905b('0x2'));var logger=require(_0x905b('0x3'))(_0x905b('0x4'));var strategy=require(_0x905b('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x905b('0x6')},'timeout':{'type':_0x905b('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0xe8e373,_0x4f3383,_0xc7cbb5){return logger[_0x905b('0x8')](util[_0x905b('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0xe8e373,_0x4f3383['name'],_0xc7cbb5));}function handleFindAgent(_0x1b3401){return function(_0x491594){return _0x491594[_0x905b('0xa')]['toLowerCase']()===_0x1b3401[_0x905b('0xb')]();};}exports[_0x905b('0xc')]=function(_0x3224d1,_0xfe32c3,_0x51f203,_0x4438d6){return function(_0x45bb5a){try{var _0x2a494f={'name':_0xfe32c3[0x0],'timeout':_0xfe32c3[0x1]};var _0xd6599f=queue[_0x905b('0x0')](_0x2a494f,{'typecast':!![]});if(_0xd6599f[_0x905b('0xd')]){logger[_0x905b('0xe')](_0x905b('0xf'),_0x3224d1,_['map'](_0xd6599f,_0x905b('0x10'))[_0x905b('0x11')](',\x20'));_0x45bb5a[_0x905b('0x12')]();}else{var _0x2623ec=_[_0x905b('0x13')](_0x51f203['agents'],handleFindAgent(_0x2a494f[_0x905b('0xa')]));if(_0x2623ec){var _0x1a86f0=(_0x2a494f[_0x905b('0x14')]||0xa)*0x3e8;var _0x25bbc1,_0x46f611;var _0x1b1aa6=seqqueue['createQueue'](_0x1a86f0);_0x1b1aa6['id']=_0x3224d1;_0x1b1aa6[_0x905b('0x15')]=_0x1a86f0;_0x1b1aa6['channel']=_0x4438d6[_0x905b('0x16')];writeLog(_0x3224d1,_0x2623ec,util[_0x905b('0x9')](_0x905b('0x17'),_0x1a86f0));_0x51f203['rules'][_0x3224d1]['on'](_0x905b('0x18'),function(){logger[_0x905b('0x8')](_0x905b('0x19'),_0x3224d1);clearTimeout(_0x46f611);_0x46f611=undefined;_0x1b1aa6[_0x905b('0x1a')]();if(_0x51f203[_0x905b('0x1b')][_0x3224d1]){delete _0x51f203['rules'][_0x3224d1];}_0x45bb5a[_0x905b('0x12')]();});_0x51f203['rules'][_0x3224d1]['on'](_0x905b('0x1c'),function(){if(_0x51f203['rules'][_0x3224d1]){delete _0x51f203[_0x905b('0x1b')][_0x3224d1];}});_0x46f611=setTimeout(function(){logger[_0x905b('0x8')](_0x905b('0x1d'),_0x3224d1);clearTimeout(_0x46f611);_0x1b1aa6[_0x905b('0x1a')]();_0x45bb5a[_0x905b('0x1e')]();},_0x1a86f0);strategy[_0x905b('0x1f')](_0x1b1aa6,_0x2623ec,_0x51f203,_0x4438d6);}else{logger[_0x905b('0xe')](_0x905b('0x20'),_0x3224d1,_0x2a494f['name']);_0x45bb5a['stop']();}}}catch(_0x32bd0c){console[_0x905b('0x21')](_0x32bd0c);logger[_0x905b('0xe')](_0x905b('0x22'),_0x3224d1,_0x32bd0c[_0x905b('0x23')]);_0x45bb5a[_0x905b('0x12')]();}};}; \ No newline at end of file +var _0x2d44=['error','message','agents','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','stop','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length'];(function(_0x2d549a,_0x3f9945){var _0x5f5938=function(_0x1071ca){while(--_0x1071ca){_0x2d549a['push'](_0x2d549a['shift']());}};_0x5f5938(++_0x3f9945);}(_0x2d44,0x1c4));var _0x42d4=function(_0x344cd2,_0x77b6ae){_0x344cd2=_0x344cd2-0x0;var _0x28688f=_0x2d44[_0x344cd2];return _0x28688f;};'use strict';var schema=require(_0x42d4('0x0'));var _=require(_0x42d4('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x42d4('0x2'))(_0x42d4('0x3'));var strategy=require(_0x42d4('0x4'));var queue=schema({'name':{'type':_0x42d4('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x42d4('0x6')}});function writeLog(_0x125c53,_0x339ce7,_0x1ad54c){return logger[_0x42d4('0x7')](util[_0x42d4('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x125c53,_0x339ce7[_0x42d4('0x9')],_0x1ad54c));}function handleFindAgent(_0x2fd7f9){return function(_0x18ca32){return _0x18ca32[_0x42d4('0x9')]['toLowerCase']()===_0x2fd7f9[_0x42d4('0xa')]();};}exports[_0x42d4('0xb')]=function(_0x17a6f6,_0x1e2aa3,_0x49c4d9,_0x25e5bc){return function(_0xf96327){try{var _0x4ec13c={'name':_0x1e2aa3[0x0],'timeout':_0x1e2aa3[0x1]};var _0x2a96d3=queue['validate'](_0x4ec13c,{'typecast':!![]});if(_0x2a96d3[_0x42d4('0xc')]){logger[_0x42d4('0xd')]('[%s][AGENT]\x20%s',_0x17a6f6,_['map'](_0x2a96d3,_0x42d4('0xe'))['join'](',\x20'));_0xf96327['stop']();}else{var _0x459e36=_['find'](_0x49c4d9[_0x42d4('0xf')],handleFindAgent(_0x4ec13c['name']));if(_0x459e36){var _0x53e99c=(_0x4ec13c['timeout']||0xa)*0x3e8;var _0x4d9276,_0x1cfc7a;var _0x3471cb=seqqueue[_0x42d4('0x10')](_0x53e99c);_0x3471cb['id']=_0x17a6f6;_0x3471cb['atimeout']=_0x53e99c;_0x3471cb[_0x42d4('0x11')]=_0x25e5bc[_0x42d4('0x11')];writeLog(_0x17a6f6,_0x459e36,util[_0x42d4('0x8')](_0x42d4('0x12'),_0x53e99c));_0x49c4d9[_0x42d4('0x13')][_0x17a6f6]['on'](_0x42d4('0x14'),function(){logger[_0x42d4('0x7')](_0x42d4('0x15'),_0x17a6f6);clearTimeout(_0x1cfc7a);_0x1cfc7a=undefined;_0x3471cb['close']();if(_0x49c4d9[_0x42d4('0x13')][_0x17a6f6]){delete _0x49c4d9[_0x42d4('0x13')][_0x17a6f6];}_0xf96327[_0x42d4('0x16')]();});_0x49c4d9[_0x42d4('0x13')][_0x17a6f6]['on'](_0x42d4('0x17'),function(){if(_0x49c4d9[_0x42d4('0x13')][_0x17a6f6]){delete _0x49c4d9[_0x42d4('0x13')][_0x17a6f6];}});_0x1cfc7a=setTimeout(function(){logger['info'](_0x42d4('0x18'),_0x17a6f6);clearTimeout(_0x1cfc7a);_0x3471cb[_0x42d4('0x19')]();_0xf96327[_0x42d4('0x1a')]();},_0x53e99c);strategy['agent'](_0x3471cb,_0x459e36,_0x49c4d9,_0x25e5bc);}else{logger[_0x42d4('0xd')](_0x42d4('0x1b'),_0x17a6f6,_0x4ec13c[_0x42d4('0x9')]);_0xf96327['stop']();}}}catch(_0x5b8e81){console[_0x42d4('0x1c')](_0x5b8e81);logger[_0x42d4('0xd')](_0x42d4('0x1d'),_0x17a6f6,_0x5b8e81[_0x42d4('0x1e')]);_0xf96327[_0x42d4('0x16')]();}};}; \ 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 b063847..dc017a2 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 _0x47d6=['then','catch','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','error','message','amazonlex','providerName','providerResponse','create','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','body','getMustacheRender','Message'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x47d6,0x190));var _0x647d=function(_0x1b915e,_0x367c64){_0x1b915e=_0x1b915e-0x0;var _0x2673ff=_0x47d6[_0x1b915e];return _0x2673ff;};'use strict';var _=require(_0x647d('0x0'));var moment=require(_0x647d('0x1'));var AWS=require(_0x647d('0x2'));var utils=require(_0x647d('0x3'));var logger=require('../../../../config/logger')(_0x647d('0x4'));var rpc={'chatMessage':require(_0x647d('0x5')),'openchannelMessage':require(_0x647d('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x647d('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x647d('0x8')]=function(_0x357e5d,_0x3d96bc){return function(_0x1ee928){try{if(!_[_0x647d('0x9')](this['interaction'][_0x647d('0xa')])){logger[_0x647d('0xb')](_0x647d('0xc'),_0x357e5d,_0x647d('0xd'));return _0x1ee928[_0x647d('0xe')]();}var _0x359fc7={'ContactId':this[_0x647d('0xf')]['id'],'sentAt':moment()[_0x647d('0x10')](_0x647d('0x11')),'direction':'out'};if(this['channel']===_0x647d('0x12')||this[_0x647d('0x13')]===_0x647d('0x14')){_0x359fc7[_0x647d('0x15')]=this[_0x647d('0x16')]['phone'];}var _0x4a65ce=this[_0x647d('0x13')];if(_0x4a65ce===_0x647d('0x17')){_0x359fc7[_0x647d('0x18')]=this[_0x647d('0x19')]['id'];}else{_0x359fc7[_[_0x647d('0x1a')](_0x4a65ce)+'AccountId']=this[_0x647d('0x19')]['id'];}_0x359fc7[_['upperFirst'](_0x4a65ce)+_0x647d('0x1b')]=this[_0x647d('0x16')]['id'];if(this['interaction'][_0x647d('0x1c')]){var _0x3bef84=_0x3d96bc[0x4];if(!_['isEmpty'](_0x3bef84)){_0x359fc7[_0x647d('0x1d')]=utils[_0x647d('0x1e')](_0x3bef84,this);return rpc[_0x4a65ce+_0x647d('0x1f')]['create'](_0x359fc7)[_0x647d('0x20')](function(_0x539a47){logger[_0x647d('0xb')](_0x647d('0xc'),_0x357e5d,_0x359fc7[_0x647d('0x1d')]);})[_0x647d('0x21')](function(_0x150fd5){logger['error']('[%s][AMAZONLEX]\x20%s',_0x357e5d,JSON[_0x647d('0x22')](_0x150fd5));})[_0x647d('0x23')](function(){logger['info'](_0x647d('0x24'),_0x357e5d);_0x1ee928[_0x647d('0x25')]();});}else{logger[_0x647d('0xb')](_0x647d('0x26'),_0x357e5d);_0x1ee928[_0x647d('0x25')]();}}else{var _0x76f19a=this;var _0x1c4a4b=new AWS[(_0x647d('0x27'))]({'accessKeyId':_0x3d96bc[0x0],'secretAccessKey':_0x3d96bc[0x1],'region':_0x3d96bc[0x2]});var _0x4d0e63={'botAlias':_0x647d('0x28'),'botName':_0x3d96bc[0x3],'inputText':this['message'][_0x647d('0x1d')],'userId':this[_0x647d('0x13')]+':'+this['interaction']['id']['toString']()};_0x1c4a4b['postText'](_0x4d0e63,function(_0x594619,_0x4db156){if(_0x594619){logger[_0x647d('0x29')]('[%s][AMAZONLEX]\x20%s',_0x357e5d,_0x594619[_0x647d('0x2a')]);_0x1ee928[_0x647d('0xe')]();}else if(_0x4db156&&_0x4db156[_0x647d('0x2a')]){_0x76f19a[_0x647d('0x1d')][_0x647d('0x2b')]=_0x4db156;_0x359fc7[_0x647d('0x1d')]=_0x4db156[_0x647d('0x2a')];_0x359fc7[_0x647d('0x2c')]=_0x647d('0x2b');_0x359fc7[_0x647d('0x2d')]=JSON[_0x647d('0x22')](_0x4db156);return rpc[_0x4a65ce+_0x647d('0x1f')][_0x647d('0x2e')](_0x359fc7)[_0x647d('0x20')](function(_0x500be0){logger[_0x647d('0xb')](_0x647d('0xc'),_0x357e5d,_0x359fc7[_0x647d('0x1d')]);if(_0x4db156['dialogState']==_0x647d('0x2f')){_0x1ee928[_0x647d('0xe')]();}else{_0x1ee928[_0x647d('0x25')]();}})[_0x647d('0x21')](function(_0x273e65){logger['error'](_0x647d('0xc'),_0x357e5d,JSON[_0x647d('0x22')](_0x273e65));_0x1ee928[_0x647d('0xe')]();});}else{_0x1ee928[_0x647d('0xe')]();}});}}catch(_0x3897b7){logger['error']('[%s][AMAZONLEX]\x20%s',_0x357e5d,JSON[_0x647d('0x22')](_0x3897b7));_0x1ee928[_0x647d('0x25')]();}};}; \ No newline at end of file +var _0xe589=['Message','create','then','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','body','toString','postText','amazonlex','providerName','providerResponse','dialogState','Failed','next','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','info','[%s][AMAZONLEX]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','InteractionId','interaction','created','isEmpty','getMustacheRender'];(function(_0x24578a,_0x40786a){var _0x1722d3=function(_0x1227f3){while(--_0x1227f3){_0x24578a['push'](_0x24578a['shift']());}};_0x1722d3(++_0x40786a);}(_0xe589,0x10f));var _0x9e58=function(_0x4ec96a,_0x1f08e7){_0x4ec96a=_0x4ec96a-0x0;var _0x3395f5=_0xe589[_0x4ec96a];return _0x3395f5;};'use strict';var _=require(_0x9e58('0x0'));var moment=require(_0x9e58('0x1'));var AWS=require(_0x9e58('0x2'));var utils=require(_0x9e58('0x3'));var logger=require(_0x9e58('0x4'))(_0x9e58('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x9e58('0x6')),'smsMessage':require(_0x9e58('0x7')),'faxMessage':require(_0x9e58('0x8')),'whatsappMessage':require(_0x9e58('0x9'))};exports[_0x9e58('0xa')]=function(_0x40e548,_0x607d40){return function(_0x26f3e8){try{if(!_['isNil'](this['interaction'][_0x9e58('0xb')])){logger[_0x9e58('0xc')](_0x9e58('0xd'),_0x40e548,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x26f3e8['next']();}var _0x51b426={'ContactId':this[_0x9e58('0xe')]['id'],'sentAt':moment()[_0x9e58('0xf')](_0x9e58('0x10')),'direction':'out'};if(this[_0x9e58('0x11')]==='sms'||this[_0x9e58('0x11')]===_0x9e58('0x12')){_0x51b426[_0x9e58('0x13')]=this['interaction'][_0x9e58('0x13')];}var _0x211834=this[_0x9e58('0x11')];if(_0x211834===_0x9e58('0x14')){_0x51b426[_0x9e58('0x15')]=this[_0x9e58('0x16')]['id'];}else{_0x51b426[_['upperFirst'](_0x211834)+_0x9e58('0x17')]=this[_0x9e58('0x16')]['id'];}_0x51b426[_['upperFirst'](_0x211834)+_0x9e58('0x18')]=this[_0x9e58('0x19')]['id'];if(this[_0x9e58('0x19')][_0x9e58('0x1a')]){var _0x46edc5=_0x607d40[0x4];if(!_[_0x9e58('0x1b')](_0x46edc5)){_0x51b426['body']=utils[_0x9e58('0x1c')](_0x46edc5,this);return rpc[_0x211834+_0x9e58('0x1d')][_0x9e58('0x1e')](_0x51b426)[_0x9e58('0x1f')](function(_0x25eaef){logger[_0x9e58('0xc')]('[%s][AMAZONLEX]\x20%s',_0x40e548,_0x51b426['body']);})[_0x9e58('0x20')](function(_0x1951f8){logger[_0x9e58('0x21')](_0x9e58('0xd'),_0x40e548,JSON[_0x9e58('0x22')](_0x1951f8));})['finally'](function(){logger['info'](_0x9e58('0x23'),_0x40e548);_0x26f3e8['stop']();});}else{logger[_0x9e58('0xc')](_0x9e58('0x24'),_0x40e548);_0x26f3e8[_0x9e58('0x25')]();}}else{var _0x5c0edf=this;var _0x46792c=new AWS[(_0x9e58('0x26'))]({'accessKeyId':_0x607d40[0x0],'secretAccessKey':_0x607d40[0x1],'region':_0x607d40[0x2]});var _0x3941cb={'botAlias':_0x9e58('0x27'),'botName':_0x607d40[0x3],'inputText':this[_0x9e58('0x28')][_0x9e58('0x29')],'userId':this[_0x9e58('0x11')]+':'+this[_0x9e58('0x19')]['id'][_0x9e58('0x2a')]()};_0x46792c[_0x9e58('0x2b')](_0x3941cb,function(_0x468e2f,_0x2d8888){if(_0x468e2f){logger['error']('[%s][AMAZONLEX]\x20%s',_0x40e548,_0x468e2f[_0x9e58('0x28')]);_0x26f3e8['next']();}else if(_0x2d8888&&_0x2d8888[_0x9e58('0x28')]){_0x5c0edf[_0x9e58('0x29')][_0x9e58('0x2c')]=_0x2d8888;_0x51b426[_0x9e58('0x29')]=_0x2d8888[_0x9e58('0x28')];_0x51b426[_0x9e58('0x2d')]=_0x9e58('0x2c');_0x51b426[_0x9e58('0x2e')]=JSON[_0x9e58('0x22')](_0x2d8888);return rpc[_0x211834+_0x9e58('0x1d')][_0x9e58('0x1e')](_0x51b426)[_0x9e58('0x1f')](function(_0x12cdb9){logger[_0x9e58('0xc')](_0x9e58('0xd'),_0x40e548,_0x51b426[_0x9e58('0x29')]);if(_0x2d8888[_0x9e58('0x2f')]==_0x9e58('0x30')){_0x26f3e8[_0x9e58('0x31')]();}else{_0x26f3e8[_0x9e58('0x25')]();}})[_0x9e58('0x20')](function(_0x2420d5){logger[_0x9e58('0x21')](_0x9e58('0xd'),_0x40e548,JSON['stringify'](_0x2420d5));_0x26f3e8['next']();});}else{_0x26f3e8['next']();}});}}catch(_0x2d5dc7){logger[_0x9e58('0x21')](_0x9e58('0xd'),_0x40e548,JSON[_0x9e58('0x22')](_0x2d5dc7));_0x26f3e8['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 6cb573a..517a489 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 _0xd492=['html','','replace','','headers','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','inReplyTo','messageId'];(function(_0x4123ec,_0x47061c){var _0x1931e1=function(_0x5067f9){while(--_0x5067f9){_0x4123ec['push'](_0x4123ec['shift']());}};_0x1931e1(++_0x47061c);}(_0xd492,0xe4));var _0x2d49=function(_0xbb85d9,_0x2ae27b){_0xbb85d9=_0xbb85d9-0x0;var _0x1676c7=_0xd492[_0xbb85d9];return _0x1676c7;};'use strict';var _=require(_0x2d49('0x0'));var moment=require(_0x2d49('0x1'));var utils=require(_0x2d49('0x2'));var logger=require(_0x2d49('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2d49('0x4')),'mailMessage':require(_0x2d49('0x5')),'smsMessage':require(_0x2d49('0x6')),'faxMessage':require(_0x2d49('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x2d49('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x2d49('0x9')),'smsInteraction':require(_0x2d49('0xa')),'faxInteraction':require(_0x2d49('0xb')),'whatsappInteraction':require(_0x2d49('0xc'))};var mailRpc=require(_0x2d49('0xd'));exports['consequence']=function(_0x339ba8,_0x3df680,_0x40f571,_0x88dca1){return function(_0x17886c){try{var _0x189735=this[_0x2d49('0xe')];if(_0x189735===_0x2d49('0xf')&&_0x88dca1[_0x2d49('0x10')][_0x2d49('0x11')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0x339ba8,_0x2d49('0x12'));return _0x17886c[_0x2d49('0x13')]();}if(_0x3df680[0x0]==='1'&&(_[_0x2d49('0x14')](this['interaction']['created'])||!this[_0x2d49('0x15')][_0x2d49('0x16')])){logger[_0x2d49('0x17')](_0x2d49('0x18'),_0x339ba8,_0x2d49('0x19'));return _0x17886c[_0x2d49('0x13')]();}if(_0x3df680[0x0]==='2'&&this[_0x2d49('0x15')]['autoreplyExecuted']){logger[_0x2d49('0x17')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x339ba8,_0x2d49('0x1a'));return _0x17886c[_0x2d49('0x13')]();}var _0x194333={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2d49('0x1b')](_0x2d49('0x1c')),'direction':_0x2d49('0x1d')};if(this['channel']===_0x2d49('0xf')){_0x194333[_0x2d49('0x10')]=utils[_0x2d49('0x1e')](_0x3df680[0x2],this);}else{_0x194333[_0x2d49('0x10')]=utils[_0x2d49('0x1e')](_0x3df680[0x1],this);}if(this[_0x2d49('0x1f')]){_0x194333['to']=this[_0x2d49('0x1f')]['from']||'';if(this[_0x2d49('0xe')]==='mail'&&_0x3df680[0x1]==='1'){_0x194333['cc']=this['message']['cc']||'';}_0x194333[_0x2d49('0x20')]=this[_0x2d49('0x1f')]['to']||'';_0x194333[_0x2d49('0x21')]=this[_0x2d49('0x1f')][_0x2d49('0x21')]||'';_0x194333['read']=!![];if(this['message'][_0x2d49('0x22')]){_0x194333[_0x2d49('0x22')]='';_0x194333[_0x2d49('0x22')]+=_[_0x2d49('0x23')](this[_0x2d49('0x1f')][_0x2d49('0x22')],'Re:')?'':'Re:\x20';_0x194333[_0x2d49('0x22')]+=this[_0x2d49('0x1f')][_0x2d49('0x22')];}}if(this[_0x2d49('0xe')]===_0x2d49('0x24')){_0x194333[_0x2d49('0x25')]=this[_0x2d49('0x26')]['id'];}else{_0x194333[_[_0x2d49('0x27')](this[_0x2d49('0xe')])+_0x2d49('0x28')]=this[_0x2d49('0x26')]['id'];}_0x194333[_[_0x2d49('0x27')](this[_0x2d49('0xe')])+_0x2d49('0x29')]=this['interaction']['id'];var _0x5c8997=this[_0x2d49('0x15')];if(rpc[this['channel']+'Message']){if(this[_0x2d49('0xe')]===_0x2d49('0xf')){_0x194333[_0x2d49('0x2a')]=this[_0x2d49('0x1f')][_0x2d49('0x2b')];_0x194333[_0x2d49('0x2c')]=_0x2d49('0x2d')+_[_0x2d49('0x2e')](_0x194333['body'],_0x2d49('0x2f'),_0x2d49('0x30'))+_0x2d49('0x31');_0x194333[_0x2d49('0x32')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x2d49('0x33'),'Precedence':_0x2d49('0x34')};return mailRpc['sendMailMessage'](this[_0x2d49('0x26')]['smtpOptions'],_0x194333)[_0x2d49('0x35')](function(_0x30f962){logger[_0x2d49('0x17')](_0x2d49('0x36'),_0x339ba8);_0x194333[_0x2d49('0x2b')]=_0x30f962[_0x2d49('0x1f')][_0x2d49('0x2b')];return rpc[_0x189735+_0x2d49('0x37')]['create'](_0x194333);})['then'](function(_0x16d4ff){logger[_0x2d49('0x17')](_0x2d49('0x18'),_0x339ba8,JSON[_0x2d49('0x38')](_0x16d4ff));})['catch'](function(_0x1d6c33){logger[_0x2d49('0x39')](_0x2d49('0x3a'),_0x339ba8,JSON[_0x2d49('0x38')](_0x1d6c33));})[_0x2d49('0x3b')](function(){Promise[_0x2d49('0x3c')]()[_0x2d49('0x35')](function(){if(_0x3df680[0x0]!=='2'||_0x5c8997[_0x2d49('0x3d')])return;return rpc[_0x189735+_0x2d49('0x3e')][_0x2d49('0x3f')](_0x5c8997['id'],{'autoreplyExecuted':!![]})[_0x2d49('0x35')](function(_0x2d7189){logger[_0x2d49('0x17')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x339ba8,JSON[_0x2d49('0x38')](_0x2d7189));})[_0x2d49('0x40')](function(_0x305219){logger[_0x2d49('0x39')](_0x2d49('0x41'),_0x339ba8,JSON[_0x2d49('0x38')](_0x305219));});})['then'](function(){_0x17886c[_0x2d49('0x13')]();});});}else{return rpc[this[_0x2d49('0xe')]+_0x2d49('0x37')][_0x2d49('0x42')](_0x194333)[_0x2d49('0x35')](function(){logger['info'](_0x2d49('0x18'),_0x339ba8,_0x194333[_0x2d49('0x10')]);})[_0x2d49('0x40')](function(_0x530856){logger[_0x2d49('0x39')](_0x2d49('0x18'),_0x339ba8,JSON['stringify'](_0x530856));})['finally'](function(){Promise[_0x2d49('0x3c')]()[_0x2d49('0x35')](function(){if(_0x3df680[0x0]!=='2'||_0x5c8997['autoreplyExecuted'])return;return rpc[_0x189735+_0x2d49('0x3e')][_0x2d49('0x3f')](_0x5c8997['id'],{'autoreplyExecuted':!![]})['then'](function(_0x2a45c6){logger[_0x2d49('0x17')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x339ba8,JSON[_0x2d49('0x38')](_0x2a45c6));})[_0x2d49('0x40')](function(_0x38365e){logger['error'](_0x2d49('0x41'),_0x339ba8,JSON[_0x2d49('0x38')](_0x38365e));});})['then'](function(){_0x17886c[_0x2d49('0x13')]();});});}}}catch(_0x1b9446){logger[_0x2d49('0x39')](_0x2d49('0x18'),_0x339ba8,JSON[_0x2d49('0x38')](_0x1b9446));_0x17886c[_0x2d49('0x43')]();}};}; \ No newline at end of file +var _0x236e=['messageId','html','','replace','';_0x21ed49[_0xe236('0x30')]={'Auto-Submitted':_0xe236('0x31'),'X-Auto-Response-Suppress':_0xe236('0x32'),'Precedence':_0xe236('0x33')};return mailRpc[_0xe236('0x34')](this['account'][_0xe236('0x35')],_0x21ed49)[_0xe236('0x36')](function(_0x16376a){logger[_0xe236('0xc')](_0xe236('0x37'),_0x39af8e);_0x21ed49[_0xe236('0x2a')]=_0x16376a['message'][_0xe236('0x2a')];return rpc[_0x5ba3d3+_0xe236('0x28')][_0xe236('0x38')](_0x21ed49);})[_0xe236('0x36')](function(_0x2674f7){logger[_0xe236('0xc')](_0xe236('0x39'),_0x39af8e,JSON[_0xe236('0x3a')](_0x2674f7));})[_0xe236('0x3b')](function(_0x443094){logger[_0xe236('0x3c')](_0xe236('0x3d'),_0x39af8e,JSON[_0xe236('0x3a')](_0x443094));})[_0xe236('0x3e')](function(){Promise[_0xe236('0x3f')]()[_0xe236('0x36')](function(){if(_0x4f9ca2[0x0]!=='2'||_0x435840[_0xe236('0x13')])return;return rpc[_0x5ba3d3+_0xe236('0x40')][_0xe236('0x41')](_0x435840['id'],{'autoreplyExecuted':!![]})[_0xe236('0x36')](function(_0x144ffd){logger[_0xe236('0xc')](_0xe236('0x14'),_0x39af8e,JSON['stringify'](_0x144ffd));})[_0xe236('0x3b')](function(_0x15d245){logger[_0xe236('0x3c')](_0xe236('0x42'),_0x39af8e,JSON[_0xe236('0x3a')](_0x15d245));});})[_0xe236('0x36')](function(){_0x32e83a[_0xe236('0xe')]();});});}else{return rpc[this['channel']+'Message'][_0xe236('0x38')](_0x21ed49)['then'](function(){logger[_0xe236('0xc')](_0xe236('0x39'),_0x39af8e,_0x21ed49[_0xe236('0x1a')]);})['catch'](function(_0x8b42ec){logger[_0xe236('0x3c')](_0xe236('0x39'),_0x39af8e,JSON['stringify'](_0x8b42ec));})[_0xe236('0x3e')](function(){Promise[_0xe236('0x3f')]()[_0xe236('0x36')](function(){if(_0x4f9ca2[0x0]!=='2'||_0x435840['autoreplyExecuted'])return;return rpc[_0x5ba3d3+'Interaction']['update'](_0x435840['id'],{'autoreplyExecuted':!![]})[_0xe236('0x36')](function(_0x32242e){logger[_0xe236('0xc')](_0xe236('0x14'),_0x39af8e,JSON[_0xe236('0x3a')](_0x32242e));})[_0xe236('0x3b')](function(_0x31daa6){logger[_0xe236('0x3c')](_0xe236('0x42'),_0x39af8e,JSON[_0xe236('0x3a')](_0x31daa6));});})[_0xe236('0x36')](function(){_0x32e83a[_0xe236('0xe')]();});});}}}catch(_0x39d27a){logger['error'](_0xe236('0x39'),_0x39af8e,JSON['stringify'](_0x39d27a));_0x32e83a[_0xe236('0x43')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 4ae0908..46b36f5 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 _0x217f=['then','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update'];(function(_0x23dc4c,_0x188a42){var _0xb5377d=function(_0x31bebc){while(--_0x31bebc){_0x23dc4c['push'](_0x23dc4c['shift']());}};_0xb5377d(++_0x188a42);}(_0x217f,0xd6));var _0xf217=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x217f[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xf217('0x0'));var logger=require(_0xf217('0x1'))(_0xf217('0x2'));var rpc={'chatInteraction':require(_0xf217('0x3')),'openchannelInteraction':require(_0xf217('0x4')),'smsInteraction':require(_0xf217('0x5')),'mailInteraction':require(_0xf217('0x6')),'faxInteraction':require(_0xf217('0x7')),'whatsappInteraction':require(_0xf217('0x8'))};exports[_0xf217('0x9')]=function(_0xb5e42b,_0x1d21ea,_0x1f6cbf,_0x5768a4){return function(_0x31372e){try{logger[_0xf217('0xa')](_0xf217('0xb'),_0xb5e42b,_0x1d21ea[0x0]);var _0x57b404={'closed':0x1,'closedAt':moment()['format'](_0xf217('0xc')),'closeReason':'system','disposition':_0x1d21ea[0x0]};if(rpc[_0x5768a4[_0xf217('0xd')]+_0xf217('0xe')]){rpc[_0x5768a4[_0xf217('0xd')]+'Interaction'][_0xf217('0xf')](_0x5768a4['interaction']['id'],_0x57b404)[_0xf217('0x10')](function(_0x4847dc){logger[_0xf217('0xa')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0xb5e42b,_0x5768a4[_0xf217('0x11')]['id']);})[_0xf217('0x12')](function(_0x293468){logger[_0xf217('0x13')](_0xf217('0x14'),_0xb5e42b,JSON[_0xf217('0x15')](_0x293468));})['finally'](function(){_0x31372e['stop']();});}}catch(_0x46f2bf){logger['error'](_0xf217('0x14'),_0xb5e42b,JSON[_0xf217('0x15')](_0x46f2bf));_0x31372e[_0xf217('0x16')]();}};}; \ No newline at end of file +var _0x4ffa=['stop','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','finally','[%s][CLOSE]\x20%s'];(function(_0x1372c8,_0x1ded5e){var _0x53a934=function(_0x538a44){while(--_0x538a44){_0x1372c8['push'](_0x1372c8['shift']());}};_0x53a934(++_0x1ded5e);}(_0x4ffa,0xc9));var _0xa4ff=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4ffa[_0x46698a];return _0x356db0;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0xa4ff('0x0'));var rpc={'chatInteraction':require(_0xa4ff('0x1')),'openchannelInteraction':require(_0xa4ff('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xa4ff('0x3')),'faxInteraction':require(_0xa4ff('0x4')),'whatsappInteraction':require(_0xa4ff('0x5'))};exports['consequence']=function(_0x2cd65d,_0x4ff32b,_0x2bd0b8,_0x4f08af){return function(_0x2460f0){try{logger[_0xa4ff('0x6')](_0xa4ff('0x7'),_0x2cd65d,_0x4ff32b[0x0]);var _0x481610={'closed':0x1,'closedAt':moment()['format'](_0xa4ff('0x8')),'closeReason':_0xa4ff('0x9'),'disposition':_0x4ff32b[0x0]};if(rpc[_0x4f08af['channel']+_0xa4ff('0xa')]){rpc[_0x4f08af[_0xa4ff('0xb')]+_0xa4ff('0xa')][_0xa4ff('0xc')](_0x4f08af[_0xa4ff('0xd')]['id'],_0x481610)['then'](function(_0x14fb00){logger[_0xa4ff('0x6')](_0xa4ff('0xe'),_0x2cd65d,_0x4f08af[_0xa4ff('0xd')]['id']);})[_0xa4ff('0xf')](function(_0x4ad0ec){logger[_0xa4ff('0x10')]('[%s][CLOSE]\x20%s',_0x2cd65d,JSON['stringify'](_0x4ad0ec));})[_0xa4ff('0x11')](function(){_0x2460f0['stop']();});}}catch(_0x2f682d){logger['error'](_0xa4ff('0x12'),_0x2cd65d,JSON['stringify'](_0x2f682d));_0x2460f0[_0xa4ff('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 607546b..58102ff 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 _0xd2f5=['interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','body','getMustacheRender','Message','create','[%s][DIALOGFLOW]\x20%s','catch','error','[%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','fulfillment','speech','providerName','providerResponse','stringify','result','endConversation','lodash','apiai-promise','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xd2f5,0x144));var _0x5d2f=function(_0xef233b,_0xe5f011){_0xef233b=_0xef233b-0x0;var _0x451b24=_0xd2f5[_0xef233b];return _0x451b24;};'use strict';var _=require(_0x5d2f('0x0'));var moment=require('moment');var apiai=require(_0x5d2f('0x1'));var md5=require('md5');var utils=require(_0x5d2f('0x2'));var logger=require('../../../../config/logger')(_0x5d2f('0x3'));var rpc={'chatMessage':require(_0x5d2f('0x4')),'openchannelMessage':require(_0x5d2f('0x5')),'mailMessage':require(_0x5d2f('0x6')),'smsMessage':require(_0x5d2f('0x7')),'faxMessage':require(_0x5d2f('0x8')),'whatsappMessage':require(_0x5d2f('0x9'))};exports[_0x5d2f('0xa')]=function(_0x4b2540,_0x443779){return function(_0x908c6){try{if(!_[_0x5d2f('0xb')](this[_0x5d2f('0xc')][_0x5d2f('0xd')])){logger[_0x5d2f('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x4b2540,_0x5d2f('0xf'));return _0x908c6[_0x5d2f('0x10')]();}var _0x4e24af={'ContactId':this[_0x5d2f('0x11')]['id'],'sentAt':moment()[_0x5d2f('0x12')](_0x5d2f('0x13')),'direction':'out'};if(this[_0x5d2f('0x14')]===_0x5d2f('0x15')||this[_0x5d2f('0x14')]==='whatsapp'){_0x4e24af['phone']=this[_0x5d2f('0xc')]['phone'];}var _0x293e95=this[_0x5d2f('0x14')];if(_0x293e95==='chat'){_0x4e24af[_0x5d2f('0x16')]=this['account']['id'];}else{_0x4e24af[_[_0x5d2f('0x17')](_0x293e95)+_0x5d2f('0x18')]=this[_0x5d2f('0x19')]['id'];}_0x4e24af[_['upperFirst'](_0x293e95)+_0x5d2f('0x1a')]=this[_0x5d2f('0xc')]['id'];if(this[_0x5d2f('0xc')][_0x5d2f('0x1b')]){var _0x1536ee=_0x443779[0x2];if(!_['isEmpty'](_0x1536ee)){_0x4e24af[_0x5d2f('0x1c')]=utils[_0x5d2f('0x1d')](_0x1536ee,this);return rpc[_0x293e95+_0x5d2f('0x1e')][_0x5d2f('0x1f')](_0x4e24af)['then'](function(_0x27e16d){logger[_0x5d2f('0xe')](_0x5d2f('0x20'),_0x4b2540,_0x4e24af[_0x5d2f('0x1c')]);})[_0x5d2f('0x21')](function(_0x32ec09){logger[_0x5d2f('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x4b2540,JSON['stringify'](_0x32ec09));})['finally'](function(){logger[_0x5d2f('0xe')](_0x5d2f('0x23'),_0x4b2540);_0x908c6[_0x5d2f('0x24')]();});}else{logger[_0x5d2f('0xe')](_0x5d2f('0x25'),_0x4b2540);_0x908c6['stop']();}}else{var _0x5cc8d6=this;var _0x368693=apiai(_0x443779[0x0],{'language':_0x443779[0x1]||'en'});return _0x368693['textRequest'](this[_0x5d2f('0x26')][_0x5d2f('0x1c')],{'sessionId':md5(this[_0x5d2f('0xc')]['id'])})[_0x5d2f('0x27')](function(_0x6d4ad2){_0x5cc8d6[_0x5d2f('0x1c')][_0x5d2f('0x28')]=_0x6d4ad2;_0x4e24af[_0x5d2f('0x1c')]=_0x6d4ad2['result'][_0x5d2f('0x29')][_0x5d2f('0x2a')];_0x4e24af[_0x5d2f('0x2b')]=_0x5d2f('0x28');_0x4e24af[_0x5d2f('0x2c')]=JSON[_0x5d2f('0x2d')](_0x6d4ad2);return rpc[_0x293e95+_0x5d2f('0x1e')][_0x5d2f('0x1f')](_0x4e24af)['then'](function(_0x10351a){logger[_0x5d2f('0xe')](_0x5d2f('0x20'),_0x4b2540,_0x4e24af[_0x5d2f('0x1c')]);if(_0x6d4ad2[_0x5d2f('0x2e')]['metadata'][_0x5d2f('0x2f')]){_0x908c6[_0x5d2f('0x10')]();}else{_0x908c6[_0x5d2f('0x24')]();}})[_0x5d2f('0x21')](function(_0x536f1d){logger[_0x5d2f('0x22')](_0x5d2f('0x20'),_0x4b2540,JSON['stringify'](_0x536f1d));_0x908c6[_0x5d2f('0x10')]();});})[_0x5d2f('0x21')](function(_0x26e988){logger['error'](_0x5d2f('0x20'),_0x4b2540,_0x26e988[_0x5d2f('0x26')]);_0x908c6[_0x5d2f('0x10')]();});}}catch(_0x4b30e4){logger[_0x5d2f('0x22')](_0x5d2f('0x20'),_0x4b2540,JSON['stringify'](_0x4b30e4));_0x908c6[_0x5d2f('0x24')]();}};}; \ No newline at end of file +var _0xf1c6=['then','dialogflow','fulfillment','speech','providerResponse','result','metadata','endConversation','error','stringify','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','next','format','YYYY-MM-DD\x20HH:mm:ss','whatsapp','chat','ChatWebsiteId','account','AccountId','upperFirst','isEmpty','body','getMustacheRender','Message','create','info','catch','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','message'];(function(_0x20dd42,_0x11bd6f){var _0x252f57=function(_0xd4fb44){while(--_0xd4fb44){_0x20dd42['push'](_0x20dd42['shift']());}};_0x252f57(++_0x11bd6f);}(_0xf1c6,0x145));var _0x6f1c=function(_0x284c99,_0x23394f){_0x284c99=_0x284c99-0x0;var _0x1c8b0f=_0xf1c6[_0x284c99];return _0x1c8b0f;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0x6f1c('0x0'));var md5=require(_0x6f1c('0x1'));var utils=require(_0x6f1c('0x2'));var logger=require(_0x6f1c('0x3'))(_0x6f1c('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x6f1c('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6f1c('0x6')),'whatsappMessage':require(_0x6f1c('0x7'))};exports[_0x6f1c('0x8')]=function(_0x537c4f,_0x1c1751){return function(_0x564a8f){try{if(!_[_0x6f1c('0x9')](this[_0x6f1c('0xa')][_0x6f1c('0xb')])){logger['info'](_0x6f1c('0xc'),_0x537c4f,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x564a8f[_0x6f1c('0xd')]();}var _0x13136d={'ContactId':this['contact']['id'],'sentAt':moment()[_0x6f1c('0xe')](_0x6f1c('0xf')),'direction':'out'};if(this['channel']==='sms'||this['channel']===_0x6f1c('0x10')){_0x13136d['phone']=this['interaction']['phone'];}var _0x57dc6a=this['channel'];if(_0x57dc6a===_0x6f1c('0x11')){_0x13136d[_0x6f1c('0x12')]=this[_0x6f1c('0x13')]['id'];}else{_0x13136d[_['upperFirst'](_0x57dc6a)+_0x6f1c('0x14')]=this[_0x6f1c('0x13')]['id'];}_0x13136d[_[_0x6f1c('0x15')](_0x57dc6a)+'InteractionId']=this[_0x6f1c('0xa')]['id'];if(this[_0x6f1c('0xa')]['created']){var _0x28fc5f=_0x1c1751[0x2];if(!_[_0x6f1c('0x16')](_0x28fc5f)){_0x13136d[_0x6f1c('0x17')]=utils[_0x6f1c('0x18')](_0x28fc5f,this);return rpc[_0x57dc6a+_0x6f1c('0x19')][_0x6f1c('0x1a')](_0x13136d)['then'](function(_0x2f9949){logger[_0x6f1c('0x1b')](_0x6f1c('0xc'),_0x537c4f,_0x13136d[_0x6f1c('0x17')]);})[_0x6f1c('0x1c')](function(_0x3e642f){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x537c4f,JSON['stringify'](_0x3e642f));})[_0x6f1c('0x1d')](function(){logger['info'](_0x6f1c('0x1e'),_0x537c4f);_0x564a8f['stop']();});}else{logger[_0x6f1c('0x1b')](_0x6f1c('0x1f'),_0x537c4f);_0x564a8f[_0x6f1c('0x20')]();}}else{var _0x14effb=this;var _0x2ed8f1=apiai(_0x1c1751[0x0],{'language':_0x1c1751[0x1]||'en'});return _0x2ed8f1[_0x6f1c('0x21')](this[_0x6f1c('0x22')][_0x6f1c('0x17')],{'sessionId':md5(this[_0x6f1c('0xa')]['id'])})[_0x6f1c('0x23')](function(_0x130bae){_0x14effb[_0x6f1c('0x17')][_0x6f1c('0x24')]=_0x130bae;_0x13136d[_0x6f1c('0x17')]=_0x130bae['result'][_0x6f1c('0x25')][_0x6f1c('0x26')];_0x13136d['providerName']=_0x6f1c('0x24');_0x13136d[_0x6f1c('0x27')]=JSON['stringify'](_0x130bae);return rpc[_0x57dc6a+'Message']['create'](_0x13136d)['then'](function(_0x16fe5a){logger[_0x6f1c('0x1b')](_0x6f1c('0xc'),_0x537c4f,_0x13136d[_0x6f1c('0x17')]);if(_0x130bae[_0x6f1c('0x28')][_0x6f1c('0x29')][_0x6f1c('0x2a')]){_0x564a8f[_0x6f1c('0xd')]();}else{_0x564a8f[_0x6f1c('0x20')]();}})[_0x6f1c('0x1c')](function(_0x33db9d){logger[_0x6f1c('0x2b')]('[%s][DIALOGFLOW]\x20%s',_0x537c4f,JSON['stringify'](_0x33db9d));_0x564a8f[_0x6f1c('0xd')]();});})[_0x6f1c('0x1c')](function(_0x383802){logger[_0x6f1c('0x2b')](_0x6f1c('0xc'),_0x537c4f,_0x383802['message']);_0x564a8f[_0x6f1c('0xd')]();});}}catch(_0x5061e9){logger[_0x6f1c('0x2b')]('[%s][DIALOGFLOW]\x20%s',_0x537c4f,JSON[_0x6f1c('0x2c')](_0x5061e9));_0x564a8f[_0x6f1c('0x20')]();}};}; \ 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 79d4bbd..5c04900 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 _0xccaf=['DIALOGFLOWV2_ISFALLBACKINTENT','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','all','next','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','created','getMustacheRender','catch','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','name','displayName'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xccaf,0x139));var _0xfcca=function(_0x42184d,_0x264f92){_0x42184d=_0x42184d-0x0;var _0x144722=_0xccaf[_0x42184d];return _0x144722;};'use strict';var _=require(_0xfcca('0x0'));var dialogflow=require(_0xfcca('0x1'));var md5=require(_0xfcca('0x2'));var moment=require(_0xfcca('0x3'));var Promise=require(_0xfcca('0x4'));var logger=require(_0xfcca('0x5'))(_0xfcca('0x6'));var utils=require(_0xfcca('0x7'));var rpc={'chatMessage':require(_0xfcca('0x8')),'openchannelMessage':require(_0xfcca('0x9')),'mailMessage':require(_0xfcca('0xa')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xfcca('0xb'))};function createMessage(_0x31338c,_0x404452,_0x4114a7,_0x329d40){return new Promise(function(_0x26796e,_0x4db5a8){var _0x20e48b=_[_0xfcca('0xc')](_0x4114a7);_0x20e48b[_0xfcca('0xd')]=_0x329d40;return rpc[_0x404452+_0xfcca('0xe')][_0xfcca('0xf')](_0x20e48b)[_0xfcca('0x10')](function(){logger[_0xfcca('0x11')]('[%s][DIALOGFLOWV2]\x20%s',_0x31338c,_0x20e48b['body']);_0x26796e();})['catch'](function(_0x12cfa0){logger['error'](_0xfcca('0x12'),_0x31338c,JSON[_0xfcca('0x13')](_0x12cfa0));_0x4db5a8(_0x12cfa0);});});}exports[_0xfcca('0x14')]=function(_0x1615b4,_0x4e12f5){return function(_0x1e6344){try{if(!_[_0xfcca('0x15')](this['interaction']['UserId'])){logger[_0xfcca('0x11')](_0xfcca('0x12'),_0x1615b4,_0xfcca('0x16'));return _0x1e6344['next']();}var _0x5f48fc={'ContactId':this[_0xfcca('0x17')]['id'],'sentAt':moment()['format'](_0xfcca('0x18')),'direction':_0xfcca('0x19')};if(this[_0xfcca('0x1a')]===_0xfcca('0x1b')||this['channel']===_0xfcca('0x1c')){_0x5f48fc[_0xfcca('0x1d')]=this[_0xfcca('0x1e')][_0xfcca('0x1d')];}var _0x444107=this['channel'];if(_0x444107===_0xfcca('0x1f')){_0x5f48fc[_0xfcca('0x20')]=this[_0xfcca('0x21')]['id'];}else{_0x5f48fc[_[_0xfcca('0x22')](_0x444107)+_0xfcca('0x23')]=this[_0xfcca('0x21')]['id'];}_0x5f48fc[_[_0xfcca('0x22')](_0x444107)+'InteractionId']=this[_0xfcca('0x1e')]['id'];if(this[_0xfcca('0x1e')][_0xfcca('0x24')]){var _0x59a82c=_0x4e12f5[0x4];if(!_['isEmpty'](_0x59a82c)){_0x5f48fc['body']=utils[_0xfcca('0x25')](_0x59a82c,this);return rpc[_0x444107+_0xfcca('0xe')][_0xfcca('0xf')](_0x5f48fc)[_0xfcca('0x10')](function(_0x1d4ece){logger['info'](_0xfcca('0x12'),_0x1615b4,_0x5f48fc['body']);})[_0xfcca('0x26')](function(_0x57c0f8){logger[_0xfcca('0x27')]('[%s][DIALOGFLOWV2]\x20%s',_0x1615b4,JSON['stringify'](_0x57c0f8));})[_0xfcca('0x28')](function(){logger[_0xfcca('0x11')](_0xfcca('0x29'),_0x1615b4);_0x1e6344[_0xfcca('0x2a')]();});}else{logger['info'](_0xfcca('0x2b'),_0x1615b4);_0x1e6344['stop']();}}else{var _0x19ed7a=this;var _0x4288a1=_0x4e12f5[0x2]['replace'](/\\n/g,'\x0a');var _0x1ef634={'credentials':{'private_key':_0x4288a1,'client_email':_0x4e12f5[0x1]}};var _0x35672e=new dialogflow[(_0xfcca('0x2c'))](_0x1ef634);var _0x21e8c3=_0x35672e['sessionPath'](_0x4e12f5[0x0],md5(_0x19ed7a[_0xfcca('0x1e')]['id']));var _0x4c20db={'session':_0x21e8c3,'queryInput':{'text':{'text':_0x19ed7a[_0xfcca('0x2d')][_0xfcca('0xd')],'languageCode':_0x4e12f5[0x3]||'en'}}};return _0x35672e[_0xfcca('0x2e')](_0x4c20db)[_0xfcca('0x10')](function(_0x25465c){if(_0x25465c&&_0x25465c[_0xfcca('0x2f')]){_0x19ed7a[_0xfcca('0xd')][_0xfcca('0x30')]=_0x25465c;var _0x4915cb=_0x25465c[0x0];var _0x4b9aa2=_0x4915cb[_0xfcca('0x31')][_0xfcca('0x32')]&&_0x4915cb[_0xfcca('0x31')][_0xfcca('0x32')][_0xfcca('0x33')]?_0x4915cb[_0xfcca('0x31')][_0xfcca('0x32')][_0xfcca('0x33')]['end_conversation'][_0xfcca('0x34')]:![];_0x19ed7a[_0xfcca('0xd')][_0xfcca('0x35')]=_0x4915cb[_0xfcca('0x31')][_0xfcca('0x36')];_0x19ed7a[_0xfcca('0xd')][_0xfcca('0x37')]=_0x4915cb['queryResult'][_0xfcca('0x38')];_0x19ed7a[_0xfcca('0xd')][_0xfcca('0x39')]=_0x4915cb[_0xfcca('0x31')][_0xfcca('0x32')]&&_0x4915cb[_0xfcca('0x31')][_0xfcca('0x32')][_0xfcca('0x33')]?_0x4915cb[_0xfcca('0x31')][_0xfcca('0x32')][_0xfcca('0x33')][_0xfcca('0x3a')][_0xfcca('0x34')]:![];_0x19ed7a['body'][_0xfcca('0x3b')]=_0x4915cb['queryResult']['intent'][_0xfcca('0x3c')];_0x19ed7a['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x4915cb[_0xfcca('0x31')]['intent'][_0xfcca('0x3d')];_0x19ed7a[_0xfcca('0xd')][_0xfcca('0x3e')]=_0x4915cb[_0xfcca('0x31')][_0xfcca('0x3f')][_0xfcca('0x40')];_0x19ed7a['body'][_0xfcca('0x41')]=_0x4915cb[_0xfcca('0x31')]['languageCode'];_0x19ed7a[_0xfcca('0xd')][_0xfcca('0x42')]=_0x4915cb[_0xfcca('0x31')][_0xfcca('0x43')];_0x19ed7a[_0xfcca('0xd')][_0xfcca('0x44')]=_0x4915cb['queryResult'][_0xfcca('0x45')];_0x5f48fc[_0xfcca('0x46')]=_0xfcca('0x30');_0x5f48fc[_0xfcca('0x47')]=JSON[_0xfcca('0x13')](_0x25465c);var _0xfcb572=[];for(var _0x39f22f=0x0;_0x39f22f<_0x25465c[_0xfcca('0x2f')];_0x39f22f++){var _0x409964=_0x25465c[_0x39f22f];if(_0x409964&&_0x409964[_0xfcca('0x31')]&&_0x409964[_0xfcca('0x31')][_0xfcca('0x48')]){_0xfcb572['push'](createMessage(_0x1615b4,_0x444107,_0x5f48fc,_0x409964[_0xfcca('0x31')][_0xfcca('0x48')]));}}return Promise[_0xfcca('0x49')](_0xfcb572)[_0xfcca('0x10')](function(){if(_0x4b9aa2){_0x1e6344['next']();}else{_0x1e6344[_0xfcca('0x2a')]();}})[_0xfcca('0x26')](function(_0x5088fd){logger['error'](_0xfcca('0x12'),_0x1615b4,JSON[_0xfcca('0x13')](_0x5088fd));_0x1e6344[_0xfcca('0x4a')]();});}})[_0xfcca('0x26')](function(_0x29adef){logger[_0xfcca('0x27')](_0xfcca('0x12'),_0x1615b4,_0x29adef[_0xfcca('0x2d')]);_0x1e6344[_0xfcca('0x4a')]();});}}catch(_0x4a9c3c){logger['error'](_0xfcca('0x12'),_0x1615b4,JSON[_0xfcca('0x13')](_0x4a9c3c));_0x1e6344[_0xfcca('0x2a')]();}};}; \ No newline at end of file +var _0xce9b=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','created','getMustacheRender','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','SessionsClient','sessionPath','length','queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','displayName','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','message','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','interaction','UserId'];(function(_0x2035ef,_0x3f7d39){var _0x86c909=function(_0x382910){while(--_0x382910){_0x2035ef['push'](_0x2035ef['shift']());}};_0x86c909(++_0x3f7d39);}(_0xce9b,0xed));var _0xbce9=function(_0x487090,_0x5e5eff){_0x487090=_0x487090-0x0;var _0x4fed4e=_0xce9b[_0x487090];return _0x4fed4e;};'use strict';var _=require(_0xbce9('0x0'));var dialogflow=require(_0xbce9('0x1'));var md5=require(_0xbce9('0x2'));var moment=require('moment');var Promise=require(_0xbce9('0x3'));var logger=require(_0xbce9('0x4'))(_0xbce9('0x5'));var utils=require(_0xbce9('0x6'));var rpc={'chatMessage':require(_0xbce9('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xbce9('0x8')),'smsMessage':require(_0xbce9('0x9')),'faxMessage':require(_0xbce9('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x2ee6f8,_0x113c0b,_0x5d2dc6,_0x394a05){return new Promise(function(_0x4441d9,_0x5d0a3b){var _0x4b715a=_[_0xbce9('0xb')](_0x5d2dc6);_0x4b715a[_0xbce9('0xc')]=_0x394a05;return rpc[_0x113c0b+_0xbce9('0xd')][_0xbce9('0xe')](_0x4b715a)[_0xbce9('0xf')](function(){logger[_0xbce9('0x10')](_0xbce9('0x11'),_0x2ee6f8,_0x4b715a[_0xbce9('0xc')]);_0x4441d9();})[_0xbce9('0x12')](function(_0x5c460e){logger['error'](_0xbce9('0x11'),_0x2ee6f8,JSON[_0xbce9('0x13')](_0x5c460e));_0x5d0a3b(_0x5c460e);});});}exports[_0xbce9('0x14')]=function(_0x51ad26,_0x46063f){return function(_0x49e131){try{if(!_['isNil'](this[_0xbce9('0x15')][_0xbce9('0x16')])){logger[_0xbce9('0x10')](_0xbce9('0x11'),_0x51ad26,_0xbce9('0x17'));return _0x49e131[_0xbce9('0x18')]();}var _0x6f3834={'ContactId':this[_0xbce9('0x19')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xbce9('0x1a')]===_0xbce9('0x1b')||this[_0xbce9('0x1a')]===_0xbce9('0x1c')){_0x6f3834[_0xbce9('0x1d')]=this[_0xbce9('0x15')][_0xbce9('0x1d')];}var _0x3d96a0=this[_0xbce9('0x1a')];if(_0x3d96a0==='chat'){_0x6f3834[_0xbce9('0x1e')]=this[_0xbce9('0x1f')]['id'];}else{_0x6f3834[_[_0xbce9('0x20')](_0x3d96a0)+'AccountId']=this['account']['id'];}_0x6f3834[_[_0xbce9('0x20')](_0x3d96a0)+'InteractionId']=this['interaction']['id'];if(this[_0xbce9('0x15')][_0xbce9('0x21')]){var _0x100827=_0x46063f[0x4];if(!_['isEmpty'](_0x100827)){_0x6f3834[_0xbce9('0xc')]=utils[_0xbce9('0x22')](_0x100827,this);return rpc[_0x3d96a0+_0xbce9('0xd')][_0xbce9('0xe')](_0x6f3834)[_0xbce9('0xf')](function(_0x409cdb){logger[_0xbce9('0x10')](_0xbce9('0x11'),_0x51ad26,_0x6f3834[_0xbce9('0xc')]);})['catch'](function(_0x383f7c){logger[_0xbce9('0x23')](_0xbce9('0x11'),_0x51ad26,JSON[_0xbce9('0x13')](_0x383f7c));})[_0xbce9('0x24')](function(){logger[_0xbce9('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x51ad26);_0x49e131['stop']();});}else{logger[_0xbce9('0x10')](_0xbce9('0x25'),_0x51ad26);_0x49e131[_0xbce9('0x26')]();}}else{var _0x6ff02d=this;var _0x129780=_0x46063f[0x2]['replace'](/\\n/g,'\x0a');var _0x587923={'credentials':{'private_key':_0x129780,'client_email':_0x46063f[0x1]}};var _0x569594=new dialogflow[(_0xbce9('0x27'))](_0x587923);var _0x2d1d10=_0x569594[_0xbce9('0x28')](_0x46063f[0x0],md5(_0x6ff02d[_0xbce9('0x15')]['id']));var _0x4bb568={'session':_0x2d1d10,'queryInput':{'text':{'text':_0x6ff02d['message'][_0xbce9('0xc')],'languageCode':_0x46063f[0x3]||'en'}}};return _0x569594['detectIntent'](_0x4bb568)[_0xbce9('0xf')](function(_0x1bc3a0){if(_0x1bc3a0&&_0x1bc3a0[_0xbce9('0x29')]){_0x6ff02d[_0xbce9('0xc')]['dialogflowV2']=_0x1bc3a0;var _0x46d0d4=_0x1bc3a0[0x0];var _0x3ce9e0=_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x2b')]&&_0x46d0d4[_0xbce9('0x2a')]['diagnosticInfo'][_0xbce9('0x2c')]?_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x2b')]['fields']['end_conversation'][_0xbce9('0x2d')]:![];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x2e')]=_0x46d0d4[_0xbce9('0x2a')]['action'];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x2f')]=_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x30')];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x31')]=_0x46d0d4[_0xbce9('0x2a')]['diagnosticInfo']&&_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x2b')][_0xbce9('0x2c')]?_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x2b')][_0xbce9('0x2c')]['end_conversation']['boolValue']:![];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x32')]=_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x33')]['name'];_0x6ff02d['body']['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x46d0d4['queryResult'][_0xbce9('0x33')][_0xbce9('0x34')];_0x6ff02d[_0xbce9('0xc')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x46d0d4['queryResult'][_0xbce9('0x33')][_0xbce9('0x35')];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x36')]=_0x46d0d4[_0xbce9('0x2a')][_0xbce9('0x37')];_0x6ff02d[_0xbce9('0xc')][_0xbce9('0x38')]=_0x46d0d4['queryResult'][_0xbce9('0x39')];_0x6ff02d[_0xbce9('0xc')]['DIALOGFLOWV2_SCORE']=_0x46d0d4['queryResult'][_0xbce9('0x3a')];_0x6f3834[_0xbce9('0x3b')]='dialogflowV2';_0x6f3834[_0xbce9('0x3c')]=JSON['stringify'](_0x1bc3a0);var _0x5cd1e4=[];for(var _0x2f9953=0x0;_0x2f9953<_0x1bc3a0[_0xbce9('0x29')];_0x2f9953++){var _0x270743=_0x1bc3a0[_0x2f9953];if(_0x270743&&_0x270743[_0xbce9('0x2a')]&&_0x270743[_0xbce9('0x2a')][_0xbce9('0x3d')]){_0x5cd1e4[_0xbce9('0x3e')](createMessage(_0x51ad26,_0x3d96a0,_0x6f3834,_0x270743[_0xbce9('0x2a')]['fulfillmentText']));}}return Promise[_0xbce9('0x3f')](_0x5cd1e4)['then'](function(){if(_0x3ce9e0){_0x49e131[_0xbce9('0x18')]();}else{_0x49e131['stop']();}})['catch'](function(_0x5e7f45){logger['error'](_0xbce9('0x11'),_0x51ad26,JSON['stringify'](_0x5e7f45));_0x49e131['next']();});}})[_0xbce9('0x12')](function(_0x1b4786){logger[_0xbce9('0x23')](_0xbce9('0x11'),_0x51ad26,_0x1b4786[_0xbce9('0x40')]);_0x49e131[_0xbce9('0x18')]();});}}catch(_0x1ba1db){logger['error'](_0xbce9('0x11'),_0x51ad26,JSON[_0xbce9('0x13')](_0x1ba1db));_0x49e131[_0xbce9('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 42bccd9..76f6e99 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 _0xaea3=['number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','error','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','[%s][GOTOIF]\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string'];(function(_0x9dc3a1,_0x1fadd2){var _0x167e96=function(_0x1fa1c8){while(--_0x1fa1c8){_0x9dc3a1['push'](_0x9dc3a1['shift']());}};_0x167e96(++_0x1fadd2);}(_0xaea3,0xff));var _0x3aea=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaea3[_0x14add3];return _0x4a174f;};'use strict';var schema=require(_0x3aea('0x0'));var _=require('lodash');var htmlToText=require(_0x3aea('0x1'));var utils=require(_0x3aea('0x2'));var logger=require(_0x3aea('0x3'))(_0x3aea('0x4'));var gotoif=schema({'condition':{'type':_0x3aea('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x3aea('0x6'),'message':_0x3aea('0x7')},'priorityFalse':{'type':'number','message':_0x3aea('0x8')}});exports[_0x3aea('0x9')]=function(_0x5a6cd8,_0x27b76b){return function(_0x5d450b){try{var _0x2f21d8={'condition':htmlToText['fromString'](utils[_0x3aea('0xa')](_0x27b76b[0x0],this),{'wordwrap':![]})[_0x3aea('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x27b76b[0x1],'priorityFalse':_0x27b76b[0x2]};var _0x4d912e=gotoif['validate'](_0x2f21d8,{'typecast':!![]});if(_0x4d912e['length']){logger[_0x3aea('0xc')]('[%s][GOTOIF]\x20%s',_0x5a6cd8,_['map'](_0x4d912e,'message')[_0x3aea('0xd')](',\x20'));_0x5d450b[_0x3aea('0xe')]();}else{try{var _0x490dfa=eval('('+_0x2f21d8[_0x3aea('0xf')]+')');var _0x77a1d6=_0x490dfa?_0x2f21d8[_0x3aea('0x10')]:_0x2f21d8[_0x3aea('0x11')];logger[_0x3aea('0x12')](_0x3aea('0x13'),_0x5a6cd8,_0x2f21d8[_0x3aea('0xf')],_0x490dfa,_0x77a1d6||_0x3aea('0x14'));if(_0x77a1d6){var _0x110730=_[_0x3aea('0x15')](_0x5d450b[_0x3aea('0x16')](),{'p':_0x77a1d6});if(_0x110730>=0x0){logger[_0x3aea('0x12')](_0x3aea('0x17'),_0x5a6cd8,_0x77a1d6||_0x3aea('0x14'),_0x110730);_0x5d450b[_0x3aea('0x14')](_0x110730);}else{logger[_0x3aea('0x12')](_0x3aea('0x18'),_0x5a6cd8,_0x77a1d6||'next');_0x5d450b[_0x3aea('0xe')]();}}else{_0x5d450b[_0x3aea('0x14')]();}}catch(_0x28f5a6){logger[_0x3aea('0xc')](_0x3aea('0x19'),_0x5a6cd8,_0x28f5a6[_0x3aea('0x1a')]);_0x5d450b['stop']();}}}catch(_0x2e48bc){logger['error'](_0x3aea('0x1b'),_0x5a6cd8,JSON[_0x3aea('0x1c')](_0x2e48bc));_0x5d450b[_0x3aea('0xe')]();}};}; \ No newline at end of file +var _0xc6fb=['stop','priorityTrue','priorityFalse','next','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','lodash','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','consequence','fromString','replace','validate','error','[%s][GOTOIF]\x20%s','map','join'];(function(_0x3c31d1,_0x4d885e){var _0xe62b4=function(_0x206381){while(--_0x206381){_0x3c31d1['push'](_0x3c31d1['shift']());}};_0xe62b4(++_0x4d885e);}(_0xc6fb,0x136));var _0xbc6f=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0xc6fb[_0x2fa1c6];return _0x5f3257;};'use strict';var schema=require('validate');var _=require(_0xbc6f('0x0'));var htmlToText=require('html-to-text');var utils=require(_0xbc6f('0x1'));var logger=require(_0xbc6f('0x2'))(_0xbc6f('0x3'));var gotoif=schema({'condition':{'type':_0xbc6f('0x4'),'required':!![],'message':_0xbc6f('0x5')},'priorityTrue':{'type':_0xbc6f('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0xbc6f('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xbc6f('0x7')]=function(_0x285ea9,_0x349eb7){return function(_0x5b5aa8){try{var _0x1e8b8a={'condition':htmlToText[_0xbc6f('0x8')](utils['getMustacheRender'](_0x349eb7[0x0],this),{'wordwrap':![]})[_0xbc6f('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x349eb7[0x1],'priorityFalse':_0x349eb7[0x2]};var _0x4e91ba=gotoif[_0xbc6f('0xa')](_0x1e8b8a,{'typecast':!![]});if(_0x4e91ba['length']){logger[_0xbc6f('0xb')](_0xbc6f('0xc'),_0x285ea9,_[_0xbc6f('0xd')](_0x4e91ba,'message')[_0xbc6f('0xe')](',\x20'));_0x5b5aa8[_0xbc6f('0xf')]();}else{try{var _0x50bea2=eval('('+_0x1e8b8a['condition']+')');var _0x4843c0=_0x50bea2?_0x1e8b8a[_0xbc6f('0x10')]:_0x1e8b8a[_0xbc6f('0x11')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x285ea9,_0x1e8b8a['condition'],_0x50bea2,_0x4843c0||_0xbc6f('0x12'));if(_0x4843c0){var _0x5aa1d8=_[_0xbc6f('0x13')](_0x5b5aa8['rules'](),{'p':_0x4843c0});if(_0x5aa1d8>=0x0){logger[_0xbc6f('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x285ea9,_0x4843c0||_0xbc6f('0x12'),_0x5aa1d8);_0x5b5aa8[_0xbc6f('0x12')](_0x5aa1d8);}else{logger[_0xbc6f('0x14')](_0xbc6f('0x15'),_0x285ea9,_0x4843c0||_0xbc6f('0x12'));_0x5b5aa8['stop']();}}else{_0x5b5aa8['next']();}}catch(_0x1e643b){logger['error'](_0xbc6f('0x16'),_0x285ea9,_0x1e643b[_0xbc6f('0x17')]);_0x5b5aa8[_0xbc6f('0xf')]();}}}catch(_0x24f479){logger[_0xbc6f('0xb')](_0xbc6f('0xc'),_0x285ea9,JSON[_0xbc6f('0x18')](_0x24f479));_0x5b5aa8[_0xbc6f('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 23a1451..6d8d9ed 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 _0x438e=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','info','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','routing'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x438e,0x10d));var _0xe438=function(_0x5ebf44,_0x4e543e){_0x5ebf44=_0x5ebf44-0x0;var _0x2fef12=_0x438e[_0x5ebf44];return _0x2fef12;};'use strict';var schema=require(_0xe438('0x0'));var _=require(_0xe438('0x1'));var logger=require(_0xe438('0x2'))(_0xe438('0x3'));var gotop=schema({'priority':{'type':_0xe438('0x4'),'required':!![],'message':_0xe438('0x5')}});exports[_0xe438('0x6')]=function(_0x2a206c,_0x29544e){return function(_0x3535bb){try{var _0x567f81={'priority':_0x29544e[0x0]};var _0x43956a=gotop[_0xe438('0x0')](_0x567f81,{'typecast':!![]});if(_0x43956a[_0xe438('0x7')]){logger[_0xe438('0x8')](_0xe438('0x9'),_0x2a206c,_[_0xe438('0xa')](_0x43956a,_0xe438('0xb'))[_0xe438('0xc')](',\x20'));_0x3535bb['stop']();}else{logger[_0xe438('0xd')]('[%s][GOTOP]\x20priority\x20%s',_0x2a206c,_0x567f81['priority']);if(_0x567f81[_0xe438('0xe')]){var _0x41bcbd=_[_0xe438('0xf')](_0x3535bb['rules'](),{'p':_0x567f81[_0xe438('0xe')]});if(_0x41bcbd>=0x0){logger['info'](_0xe438('0x10'),_0x2a206c,_0x567f81['priority']||_0xe438('0x11'),_0x41bcbd);_0x3535bb[_0xe438('0x11')](_0x41bcbd);}else{logger[_0xe438('0xd')](_0xe438('0x12'),_0x2a206c,_0x567f81[_0xe438('0xe')]||'next');_0x3535bb[_0xe438('0x13')]();}}else{_0x3535bb[_0xe438('0x11')]();}}}catch(_0x51dc4c){logger[_0xe438('0x8')](_0xe438('0x9'),_0x2a206c,JSON[_0xe438('0x14')](_0x51dc4c));_0x3535bb[_0xe438('0x13')]();}};}; \ No newline at end of file +var _0x516c=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','join','stop','priority','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','../../../../config/logger','routing'];(function(_0x58f401,_0x1136c9){var _0x146e3d=function(_0x249501){while(--_0x249501){_0x58f401['push'](_0x58f401['shift']());}};_0x146e3d(++_0x1136c9);}(_0x516c,0x1d9));var _0xc516=function(_0x1899f0,_0x12d7e4){_0x1899f0=_0x1899f0-0x0;var _0x14e375=_0x516c[_0x1899f0];return _0x14e375;};'use strict';var schema=require(_0xc516('0x0'));var _=require('lodash');var logger=require(_0xc516('0x1'))(_0xc516('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xc516('0x3')}});exports[_0xc516('0x4')]=function(_0x3e03cf,_0x429a32){return function(_0x11e9ab){try{var _0x51036f={'priority':_0x429a32[0x0]};var _0x152b47=gotop[_0xc516('0x0')](_0x51036f,{'typecast':!![]});if(_0x152b47[_0xc516('0x5')]){logger[_0xc516('0x6')](_0xc516('0x7'),_0x3e03cf,_['map'](_0x152b47,'message')[_0xc516('0x8')](',\x20'));_0x11e9ab[_0xc516('0x9')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x3e03cf,_0x51036f['priority']);if(_0x51036f[_0xc516('0xa')]){var _0x357050=_['findIndex'](_0x11e9ab[_0xc516('0xb')](),{'p':_0x51036f[_0xc516('0xa')]});if(_0x357050>=0x0){logger[_0xc516('0xc')](_0xc516('0xd'),_0x3e03cf,_0x51036f['priority']||_0xc516('0xe'),_0x357050);_0x11e9ab[_0xc516('0xe')](_0x357050);}else{logger['info'](_0xc516('0xf'),_0x3e03cf,_0x51036f[_0xc516('0xa')]||'next');_0x11e9ab[_0xc516('0x9')]();}}else{_0x11e9ab['next']();}}}catch(_0xa845b4){logger[_0xc516('0x6')](_0xc516('0x7'),_0x3e03cf,JSON[_0xc516('0x10')](_0xa845b4));_0x11e9ab[_0xc516('0x9')]();}};}; \ 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 8c51b18..53d5df5 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 _0xa953=['AccountId','upperFirst','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','getMustacheRender','contact','channel','account'];(function(_0x272440,_0x2d9c92){var _0x28dc6b=function(_0x3952e6){while(--_0x3952e6){_0x272440['push'](_0x272440['shift']());}};_0x28dc6b(++_0x2d9c92);}(_0xa953,0x1d0));var _0x3a95=function(_0x297b8b,_0x10031d){_0x297b8b=_0x297b8b-0x0;var _0x4566e9=_0xa953[_0x297b8b];return _0x4566e9;};'use strict';var _=require(_0x3a95('0x0'));var utils=require(_0x3a95('0x1'));var logger=require(_0x3a95('0x2'))(_0x3a95('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3a95('0x4')),'mailMessage':require(_0x3a95('0x5')),'smsMessage':require(_0x3a95('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0xfd621a,_0x1ffe5f){return function(_0x29613f){try{var _0xb8a831={'body':utils[_0x3a95('0x7')](_0x1ffe5f[0x0],this),'ContactId':this[_0x3a95('0x8')]['id']};if(this[_0x3a95('0x9')]==='chat'){_0xb8a831['ChatWebsiteId']=this[_0x3a95('0xa')]['id'];}else{_0xb8a831[_['upperFirst'](this['channel'])+_0x3a95('0xb')]=this['account']['id'];}_0xb8a831[_[_0x3a95('0xc')](this[_0x3a95('0x9')])+'InteractionId']=this[_0x3a95('0xd')]['id'];if(rpc[this[_0x3a95('0x9')]+_0x3a95('0xe')]){return rpc[this['channel']+_0x3a95('0xe')][_0x3a95('0xf')](_0xb8a831)[_0x3a95('0x10')](function(_0x54e2a6){logger[_0x3a95('0x11')](_0x3a95('0x12'),_0xfd621a,_0xb8a831[_0x3a95('0x13')]);_0x29613f[_0x3a95('0x14')]();})[_0x3a95('0x15')](function(_0x5098c6){logger[_0x3a95('0x16')]('[%s][MESSAGE]\x20%s',_0xfd621a,JSON[_0x3a95('0x17')](_0x5098c6));_0x29613f['stop']();});}}catch(_0x40a01d){logger[_0x3a95('0x16')]('[%s][MESSAGE]\x20%s',_0xfd621a,JSON[_0x3a95('0x17')](_0x40a01d));_0x29613f[_0x3a95('0x18')]();}};}; \ No newline at end of file +var _0xd23d=['getMustacheRender','chat','ChatWebsiteId','account','upperFirst','channel','interaction','Message','create','then','info','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xd23d,0xa0));var _0xdd23=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xd23d[_0x3e6d5d];return _0x238923;};'use strict';var _=require(_0xdd23('0x0'));var utils=require(_0xdd23('0x1'));var logger=require(_0xdd23('0x2'))(_0xdd23('0x3'));var rpc={'chatMessage':require(_0xdd23('0x4')),'openchannelMessage':require(_0xdd23('0x5')),'mailMessage':require(_0xdd23('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xdd23('0x7')]=function(_0x23d246,_0x7232e8){return function(_0xa5bdac){try{var _0x5933e2={'body':utils[_0xdd23('0x8')](_0x7232e8[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xdd23('0x9')){_0x5933e2[_0xdd23('0xa')]=this[_0xdd23('0xb')]['id'];}else{_0x5933e2[_[_0xdd23('0xc')](this[_0xdd23('0xd')])+'AccountId']=this[_0xdd23('0xb')]['id'];}_0x5933e2[_[_0xdd23('0xc')](this[_0xdd23('0xd')])+'InteractionId']=this[_0xdd23('0xe')]['id'];if(rpc[this[_0xdd23('0xd')]+_0xdd23('0xf')]){return rpc[this[_0xdd23('0xd')]+_0xdd23('0xf')][_0xdd23('0x10')](_0x5933e2)[_0xdd23('0x11')](function(_0x1e4739){logger[_0xdd23('0x12')]('[%s][MESSAGE]\x20%s',_0x23d246,_0x5933e2['body']);_0xa5bdac[_0xdd23('0x13')]();})[_0xdd23('0x14')](function(_0x2f2869){logger['error'](_0xdd23('0x15'),_0x23d246,JSON[_0xdd23('0x16')](_0x2f2869));_0xa5bdac[_0xdd23('0x17')]();});}}catch(_0x3743cf){logger['error'](_0xdd23('0x15'),_0x23d246,JSON[_0xdd23('0x16')](_0x3743cf));_0xa5bdac[_0xdd23('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 2f7c168..372421e 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 _0x5655=['routing','consequence','[%s][NOOP]\x20%s','next','error','stringify','./utils','../../../../config/logger'];(function(_0x500dde,_0x23cdb8){var _0x3c2ca8=function(_0x5d2245){while(--_0x5d2245){_0x500dde['push'](_0x500dde['shift']());}};_0x3c2ca8(++_0x23cdb8);}(_0x5655,0x15e));var _0x5565=function(_0x369e78,_0x18dea1){_0x369e78=_0x369e78-0x0;var _0x4ad433=_0x5655[_0x369e78];return _0x4ad433;};'use strict';var utils=require(_0x5565('0x0'));var logger=require(_0x5565('0x1'))(_0x5565('0x2'));exports[_0x5565('0x3')]=function(_0x42be35,_0x243782){return function(_0x5b1b44){try{logger['info'](_0x5565('0x4'),_0x42be35,utils['getMustacheRender'](_0x243782[0x0],this));_0x5b1b44[_0x5565('0x5')]();}catch(_0x129c84){logger[_0x5565('0x6')](_0x5565('0x4'),_0x42be35,JSON[_0x5565('0x7')](_0x129c84));_0x5b1b44['stop']();}};}; \ No newline at end of file +var _0x3344=['../../../../config/logger','routing','consequence','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stop','./utils'];(function(_0x6d3ee6,_0x2e272b){var _0x12d0b2=function(_0x2ee988){while(--_0x2ee988){_0x6d3ee6['push'](_0x6d3ee6['shift']());}};_0x12d0b2(++_0x2e272b);}(_0x3344,0xdb));var _0x4334=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3344[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0x4334('0x0'));var logger=require(_0x4334('0x1'))(_0x4334('0x2'));exports[_0x4334('0x3')]=function(_0xd350b6,_0xe919e8){return function(_0x216c5a){try{logger[_0x4334('0x4')]('[%s][NOOP]\x20%s',_0xd350b6,utils[_0x4334('0x5')](_0xe919e8[0x0],this));_0x216c5a[_0x4334('0x6')]();}catch(_0x490744){logger[_0x4334('0x7')](_0x4334('0x8'),_0xd350b6,JSON['stringify'](_0x490744));_0x216c5a[_0x4334('0x9')]();}};}; \ 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 bcb1f52..e7599ca 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 _0x9a1c=['account','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','map','find','Queues','createQueue','atimeout','qtimeout','rules','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','routing','./strategy','redis','defaults','localhost','queue_id','queue','joinAt'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9a1c,0x1c6));var _0xc9a1=function(_0x44cee4,_0x301386){_0x44cee4=_0x44cee4-0x0;var _0x3062c9=_0x9a1c[_0x44cee4];return _0x3062c9;};'use strict';var schema=require(_0xc9a1('0x0'));var _=require(_0xc9a1('0x1'));var util=require(_0xc9a1('0x2'));var seqqueue=require(_0xc9a1('0x3'));var moment=require(_0xc9a1('0x4'));var Redis=require('ioredis');var config=require(_0xc9a1('0x5'));var logger=require('../../../../config/logger')(_0xc9a1('0x6'));var strategy=require(_0xc9a1('0x7'));config[_0xc9a1('0x8')]=_[_0xc9a1('0x9')](config['redis'],{'host':_0xc9a1('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc9a1('0x8')]));var attributes=['id',_0xc9a1('0xb'),'account',_0xc9a1('0xc'),'from',_0xc9a1('0xd')];function emit(_0x24d789,_0x10beed,_0x8e794f){io['to'](_0x24d789)['emit'](_0x10beed,_0x8e794f);}function emitChannelQueueInteraction(_0x6b745f,_0x44ad80,_0x151e10,_0x51c6aa,_0xe00bb8,_0x5b597e,_0x38c3cc,_0x23bdff){var _0x3e430c=_['clone'](_0x151e10);_0x3e430c['queue_id']=_0x23bdff;_0x3e430c[_0xc9a1('0xc')]=_0x44ad80;_0x3e430c[_0xc9a1('0xe')]=_0x51c6aa;_0x3e430c['id']=_0xe00bb8;if(_0x5b597e){_0x38c3cc[util[_0xc9a1('0xf')](_0xc9a1('0x10'),_0x6b745f)][_0xe00bb8]=_[_0xc9a1('0x11')](_0x3e430c,attributes);}else{delete _0x38c3cc[util['format'](_0xc9a1('0x10'),_0x6b745f)][_0xe00bb8];}emit(util[_0xc9a1('0xf')]('%s:queue:%s',_0x6b745f,_0x44ad80),util[_0xc9a1('0xf')](_0xc9a1('0x12'),_0x6b745f,_0x5b597e?'save':_0xc9a1('0x13')),_[_0xc9a1('0x11')](_0x3e430c,attributes));}var rpc={'openchannelQueueReport':require(_0xc9a1('0x14')),'mailQueueReport':require(_0xc9a1('0x15')),'chatQueueReport':require(_0xc9a1('0x16')),'smsQueueReport':require(_0xc9a1('0x17')),'faxQueueReport':require(_0xc9a1('0x18')),'whatsappQueueReport':require(_0xc9a1('0x19'))};var queue=schema({'name':{'type':_0xc9a1('0x1a'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xc9a1('0x1b'),'message':_0xc9a1('0x1c')}});function startRouting(_0x46c388,_0x56a9f5,_0x3460aa,_0x2a7e83){if(_0x46c388&&_0x56a9f5&&_0x3460aa){_0x56a9f5[_0xc9a1('0x1d')]+=0x1;var _0x518547={'uniqueid':_0x46c388,'from':_0x3460aa[_0xc9a1('0x1e')]?_0x3460aa[_0xc9a1('0x1e')]['from']:'','joinAt':moment()[_0xc9a1('0xf')](_0xc9a1('0x1f')),'ContactId':_0x3460aa[_0xc9a1('0x20')]?_0x3460aa[_0xc9a1('0x20')]['id']:null,'ListId':_0x3460aa[_0xc9a1('0x21')]?_0x3460aa['list']['id']:null};_0x518547[_[_0xc9a1('0x22')](_0x3460aa[_0xc9a1('0x23')])+_0xc9a1('0x24')]=_0x56a9f5['id']||null;_0x518547[_[_0xc9a1('0x22')](_0x3460aa[_0xc9a1('0x23')])+_0xc9a1('0x25')]=_0x3460aa[_0xc9a1('0x26')]?_0x3460aa[_0xc9a1('0x26')]['id']:null;_0x518547[_[_0xc9a1('0x22')](_0x3460aa[_0xc9a1('0x23')])+'MessageId']=_0x3460aa[_0xc9a1('0x27')]?_0x3460aa[_0xc9a1('0x27')]['id']:null;_0x518547[_[_0xc9a1('0x22')](_0x3460aa[_0xc9a1('0x23')])+(_0x3460aa[_0xc9a1('0x23')]!==_0xc9a1('0x28')?_0xc9a1('0x29'):_0xc9a1('0x2a'))]=_0x3460aa[_0xc9a1('0xe')]?_0x3460aa['account']['id']:null;logger[_0xc9a1('0x2b')](util['format'](_0xc9a1('0x2c'),_0x46c388,_0x56a9f5[_0xc9a1('0x2d')]));emitChannelQueueInteraction(_0x3460aa[_0xc9a1('0x23')],_0x56a9f5[_0xc9a1('0x2d')],_0x518547,_0x3460aa[_0xc9a1('0xe')][_0xc9a1('0x2d')],_0x3460aa[_0xc9a1('0x27')]['id'],!![],_0x2a7e83,_0x56a9f5['id']);if(rpc[_0x3460aa['channel']+'QueueReport']){return rpc[_0x3460aa['channel']+_0xc9a1('0x2e')][_0xc9a1('0x2f')](_0x518547)[_0xc9a1('0x30')](function(_0x49c774){logger[_0xc9a1('0x31')](_0xc9a1('0x32'));});}}}function stopRouting(_0x4be44e,_0x2590bd,_0x13b5bc,_0x1fea3e){if(_0x4be44e&&_0x2590bd){_0x2590bd[_0xc9a1('0x1d')]-=0x1;var _0xb087c={'leaveAt':moment()[_0xc9a1('0xf')](_0xc9a1('0x1f')),'acceptAt':moment()[_0xc9a1('0xf')](_0xc9a1('0x1f')),'reason':_0xc9a1('0x33')};logger[_0xc9a1('0x2b')](util[_0xc9a1('0xf')](_0xc9a1('0x34'),_0x4be44e,_0x2590bd[_0xc9a1('0x2d')]));emitChannelQueueInteraction(_0x13b5bc['channel'],_0x2590bd['name'],_0x13b5bc[_0xc9a1('0x1e')],_0x13b5bc['account'][_0xc9a1('0x2d')],_0x13b5bc[_0xc9a1('0x27')]['id'],![],_0x1fea3e,_0x2590bd['id']);if(rpc[_0x13b5bc[_0xc9a1('0x23')]+_0xc9a1('0x2e')]){return rpc[_0x13b5bc[_0xc9a1('0x23')]+_0xc9a1('0x2e')][_0xc9a1('0x35')](_0x4be44e,_0xb087c)[_0xc9a1('0x30')](function(_0x264f47){logger[_0xc9a1('0x31')](_0xc9a1('0x36'));});}}}function endRouting(_0x543cfb,_0x34ca2d,_0x27a2ab,_0x45d560){if(_0x543cfb&&_0x34ca2d){_0x34ca2d[_0xc9a1('0x1d')]-=0x1;var _0x57b807={'leaveAt':moment()[_0xc9a1('0xf')](_0xc9a1('0x1f')),'exitAt':moment()[_0xc9a1('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xc9a1('0x37')};logger[_0xc9a1('0x2b')](util['format'](_0xc9a1('0x38'),_0x543cfb,_0x34ca2d[_0xc9a1('0x2d')]));emitChannelQueueInteraction(_0x27a2ab['channel'],_0x34ca2d['name'],_0x27a2ab[_0xc9a1('0x1e')],_0x27a2ab[_0xc9a1('0xe')]['name'],_0x27a2ab[_0xc9a1('0x27')]['id'],![],_0x45d560);if(rpc[_0x27a2ab[_0xc9a1('0x23')]+_0xc9a1('0x2e')]){return rpc[_0x27a2ab[_0xc9a1('0x23')]+_0xc9a1('0x2e')][_0xc9a1('0x35')](_0x543cfb,_0x57b807)[_0xc9a1('0x30')](function(_0x4be893){logger['error'](_0xc9a1('0x36'));});}}}function handleFindQueue(_0x2587c2){return function(_0x2ac260){return _0x2ac260['name'][_0xc9a1('0x39')]()===_0x2587c2[_0xc9a1('0x39')]();};}exports[_0xc9a1('0x3a')]=function(_0x3fd372,_0x5a38b4,_0x37d136,_0x3bf900){return function(_0x521412){try{var _0x1546f3={'name':_0x5a38b4[0x0],'timeout':_0x5a38b4[0x1]};var _0x48fe0f=queue[_0xc9a1('0x0')](_0x1546f3,{'typecast':!![]});if(_0x48fe0f['length']){logger[_0xc9a1('0x31')]('[%s][QUEUE]\x20%s',_0x3fd372,_[_0xc9a1('0x3b')](_0x48fe0f,_0xc9a1('0x27'))['join'](',\x20'));_0x521412['stop']();}else{var _0x2647e5=_[_0xc9a1('0x3c')](_0x37d136[_0x3bf900[_0xc9a1('0x23')]+_0xc9a1('0x3d')],handleFindQueue(_0x1546f3[_0xc9a1('0x2d')]));if(_0x2647e5){startRouting(_0x3fd372,_0x2647e5,_0x3bf900,_0x37d136);var _0x463548=(_0x2647e5[_0xc9a1('0x37')]||0xa)*0x3e8;var _0x2ffb87=(_0x1546f3[_0xc9a1('0x37')]||0x14)*0x3e8;var _0x456261,_0x58d64d;if(_0x463548>_0x2ffb87){_0x2ffb87=_0x463548;}var _0x1e55a6=seqqueue[_0xc9a1('0x3e')](_0x463548);_0x1e55a6['id']=_0x3fd372;_0x1e55a6[_0xc9a1('0x3f')]=_0x463548;_0x1e55a6[_0xc9a1('0x40')]=_0x2ffb87;_0x1e55a6[_0xc9a1('0x23')]=_0x3bf900['channel'];_0x37d136[_0xc9a1('0x41')][_0x3fd372]['on']('end',function(){logger[_0xc9a1('0x2b')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x3fd372);stopRouting(_0x3fd372,_0x2647e5,_0x3bf900,_0x37d136);clearTimeout(_0x456261);_0x456261=undefined;_0x1e55a6['close'](!![]);if(_0x37d136[_0xc9a1('0x41')][_0x3fd372]){delete _0x37d136[_0xc9a1('0x41')][_0x3fd372];}_0x521412[_0xc9a1('0x42')]();});_0x37d136[_0xc9a1('0x41')][_0x3fd372]['on'](_0xc9a1('0x43'),function(){if(_0x37d136[_0xc9a1('0x41')][_0x3fd372]){delete _0x37d136[_0xc9a1('0x41')][_0x3fd372];}});_0x456261=setTimeout(function(){logger[_0xc9a1('0x2b')](_0xc9a1('0x44'),_0x3fd372);endRouting(_0x3fd372,_0x2647e5,_0x3bf900,_0x37d136);clearTimeout(_0x456261);_0x1e55a6[_0xc9a1('0x45')](!![]);_0x521412[_0xc9a1('0x46')]();},_0x2ffb87);switch(_0x2647e5[_0xc9a1('0x47')]){case'rrmemory':strategy[_0xc9a1('0x48')](_0x1e55a6,_0x2647e5,_0x37d136,_0x3bf900);break;default:strategy[_0xc9a1('0x49')](_0x1e55a6,_0x2647e5,_0x37d136,_0x3bf900);}}else{logger[_0xc9a1('0x31')](_0xc9a1('0x4a'),_0x3fd372,_0x1546f3[_0xc9a1('0x2d')]);_0x521412[_0xc9a1('0x42')]();}}}catch(_0x45c243){console[_0xc9a1('0x4b')](_0x45c243);logger['error'](_0xc9a1('0x4c'),_0x3fd372,_0x45c243[_0xc9a1('0x4d')]);_0x521412['stop']();}};}; \ No newline at end of file +var _0x0d35=['../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','find','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save'];(function(_0x1602af,_0x540e07){var _0x3c088e=function(_0x1be346){while(--_0x1be346){_0x1602af['push'](_0x1602af['shift']());}};_0x3c088e(++_0x540e07);}(_0x0d35,0x8a));var _0x50d3=function(_0x278783,_0x4fa832){_0x278783=_0x278783-0x0;var _0x89fb5b=_0x0d35[_0x278783];return _0x89fb5b;};'use strict';var schema=require(_0x50d3('0x0'));var _=require(_0x50d3('0x1'));var util=require(_0x50d3('0x2'));var seqqueue=require(_0x50d3('0x3'));var moment=require(_0x50d3('0x4'));var Redis=require(_0x50d3('0x5'));var config=require(_0x50d3('0x6'));var logger=require(_0x50d3('0x7'))(_0x50d3('0x8'));var strategy=require(_0x50d3('0x9'));config[_0x50d3('0xa')]=_['defaults'](config[_0x50d3('0xa')],{'host':_0x50d3('0xb'),'port':0x18eb});var io=require(_0x50d3('0xc'))(new Redis(config['redis']));var attributes=['id',_0x50d3('0xd'),_0x50d3('0xe'),_0x50d3('0xf'),_0x50d3('0x10'),_0x50d3('0x11')];function emit(_0xb5bd20,_0x4bc365,_0x5cd40e){io['to'](_0xb5bd20)[_0x50d3('0x12')](_0x4bc365,_0x5cd40e);}function emitChannelQueueInteraction(_0x4c7b13,_0x5e137f,_0xf51a73,_0x29f744,_0x1266db,_0x1c8677,_0x171557,_0x33b8ab){var _0x44d6db=_[_0x50d3('0x13')](_0xf51a73);_0x44d6db[_0x50d3('0xd')]=_0x33b8ab;_0x44d6db[_0x50d3('0xf')]=_0x5e137f;_0x44d6db[_0x50d3('0xe')]=_0x29f744;_0x44d6db['id']=_0x1266db;if(_0x1c8677){_0x171557[util['format'](_0x50d3('0x14'),_0x4c7b13)][_0x1266db]=_[_0x50d3('0x15')](_0x44d6db,attributes);}else{delete _0x171557[util['format']('%sQueuesWaitingInteractions',_0x4c7b13)][_0x1266db];}emit(util[_0x50d3('0x16')](_0x50d3('0x17'),_0x4c7b13,_0x5e137f),util['format'](_0x50d3('0x18'),_0x4c7b13,_0x1c8677?_0x50d3('0x19'):'remove'),_['pick'](_0x44d6db,attributes));}var rpc={'openchannelQueueReport':require(_0x50d3('0x1a')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x50d3('0x1b')),'smsQueueReport':require(_0x50d3('0x1c')),'faxQueueReport':require(_0x50d3('0x1d')),'whatsappQueueReport':require(_0x50d3('0x1e'))};var queue=schema({'name':{'type':_0x50d3('0x1f'),'required':!![],'message':_0x50d3('0x20')},'timeout':{'type':_0x50d3('0x21'),'message':_0x50d3('0x22')}});function startRouting(_0x529411,_0x2c2e64,_0xd8c50d,_0x108775){if(_0x529411&&_0x2c2e64&&_0xd8c50d){_0x2c2e64['waiting']+=0x1;var _0x54b129={'uniqueid':_0x529411,'from':_0xd8c50d['body']?_0xd8c50d['body'][_0x50d3('0x10')]:'','joinAt':moment()[_0x50d3('0x16')](_0x50d3('0x23')),'ContactId':_0xd8c50d[_0x50d3('0x24')]?_0xd8c50d[_0x50d3('0x24')]['id']:null,'ListId':_0xd8c50d['list']?_0xd8c50d[_0x50d3('0x25')]['id']:null};_0x54b129[_['upperFirst'](_0xd8c50d[_0x50d3('0x26')])+_0x50d3('0x27')]=_0x2c2e64['id']||null;_0x54b129[_[_0x50d3('0x28')](_0xd8c50d[_0x50d3('0x26')])+'InteractionId']=_0xd8c50d['interaction']?_0xd8c50d['interaction']['id']:null;_0x54b129[_[_0x50d3('0x28')](_0xd8c50d['channel'])+_0x50d3('0x29')]=_0xd8c50d[_0x50d3('0x2a')]?_0xd8c50d[_0x50d3('0x2a')]['id']:null;_0x54b129[_[_0x50d3('0x28')](_0xd8c50d[_0x50d3('0x26')])+(_0xd8c50d[_0x50d3('0x26')]!==_0x50d3('0x2b')?_0x50d3('0x2c'):_0x50d3('0x2d'))]=_0xd8c50d[_0x50d3('0xe')]?_0xd8c50d['account']['id']:null;logger[_0x50d3('0x2e')](util['format'](_0x50d3('0x2f'),_0x529411,_0x2c2e64[_0x50d3('0x30')]));emitChannelQueueInteraction(_0xd8c50d['channel'],_0x2c2e64[_0x50d3('0x30')],_0x54b129,_0xd8c50d[_0x50d3('0xe')][_0x50d3('0x30')],_0xd8c50d['message']['id'],!![],_0x108775,_0x2c2e64['id']);if(rpc[_0xd8c50d[_0x50d3('0x26')]+_0x50d3('0x31')]){return rpc[_0xd8c50d[_0x50d3('0x26')]+'QueueReport'][_0x50d3('0x32')](_0x54b129)[_0x50d3('0x33')](function(_0x222622){logger[_0x50d3('0x34')](_0x50d3('0x35'));});}}}function stopRouting(_0x4e966f,_0x2b222e,_0x5e17a2,_0x40a307){if(_0x4e966f&&_0x2b222e){_0x2b222e[_0x50d3('0x36')]-=0x1;var _0x43df15={'leaveAt':moment()[_0x50d3('0x16')](_0x50d3('0x23')),'acceptAt':moment()[_0x50d3('0x16')](_0x50d3('0x23')),'reason':'accepted'};logger[_0x50d3('0x2e')](util[_0x50d3('0x16')](_0x50d3('0x37'),_0x4e966f,_0x2b222e[_0x50d3('0x30')]));emitChannelQueueInteraction(_0x5e17a2[_0x50d3('0x26')],_0x2b222e[_0x50d3('0x30')],_0x5e17a2[_0x50d3('0x38')],_0x5e17a2[_0x50d3('0xe')][_0x50d3('0x30')],_0x5e17a2[_0x50d3('0x2a')]['id'],![],_0x40a307,_0x2b222e['id']);if(rpc[_0x5e17a2['channel']+_0x50d3('0x31')]){return rpc[_0x5e17a2['channel']+_0x50d3('0x31')][_0x50d3('0x39')](_0x4e966f,_0x43df15)[_0x50d3('0x33')](function(_0x4c2f72){logger['error'](_0x50d3('0x3a'));});}}}function endRouting(_0x2d98dc,_0x61bc62,_0x3d91de,_0x4d4840){if(_0x2d98dc&&_0x61bc62){_0x61bc62[_0x50d3('0x36')]-=0x1;var _0xbbb33f={'leaveAt':moment()['format'](_0x50d3('0x23')),'exitAt':moment()[_0x50d3('0x16')](_0x50d3('0x23')),'reason':_0x50d3('0x3b')};logger[_0x50d3('0x2e')](util[_0x50d3('0x16')](_0x50d3('0x3c'),_0x2d98dc,_0x61bc62[_0x50d3('0x30')]));emitChannelQueueInteraction(_0x3d91de[_0x50d3('0x26')],_0x61bc62['name'],_0x3d91de[_0x50d3('0x38')],_0x3d91de[_0x50d3('0xe')][_0x50d3('0x30')],_0x3d91de[_0x50d3('0x2a')]['id'],![],_0x4d4840);if(rpc[_0x3d91de[_0x50d3('0x26')]+_0x50d3('0x31')]){return rpc[_0x3d91de['channel']+_0x50d3('0x31')][_0x50d3('0x39')](_0x2d98dc,_0xbbb33f)[_0x50d3('0x33')](function(_0x946c11){logger[_0x50d3('0x34')](_0x50d3('0x3a'));});}}}function handleFindQueue(_0x1f6dd1){return function(_0x5b32f1){return _0x5b32f1['name'][_0x50d3('0x3d')]()===_0x1f6dd1[_0x50d3('0x3d')]();};}exports[_0x50d3('0x3e')]=function(_0x383f81,_0x17234a,_0x1100d8,_0x5cb255){return function(_0x59f052){try{var _0x3a8860={'name':_0x17234a[0x0],'timeout':_0x17234a[0x1]};var _0x282efd=queue[_0x50d3('0x0')](_0x3a8860,{'typecast':!![]});if(_0x282efd['length']){logger[_0x50d3('0x34')](_0x50d3('0x3f'),_0x383f81,_[_0x50d3('0x40')](_0x282efd,_0x50d3('0x2a'))['join'](',\x20'));_0x59f052[_0x50d3('0x41')]();}else{var _0x5cc045=_[_0x50d3('0x42')](_0x1100d8[_0x5cb255[_0x50d3('0x26')]+'Queues'],handleFindQueue(_0x3a8860[_0x50d3('0x30')]));if(_0x5cc045){startRouting(_0x383f81,_0x5cc045,_0x5cb255,_0x1100d8);var _0x1694b1=(_0x5cc045[_0x50d3('0x3b')]||0xa)*0x3e8;var _0x277787=(_0x3a8860[_0x50d3('0x3b')]||0x14)*0x3e8;var _0x133e86,_0x4b7a69;if(_0x1694b1>_0x277787){_0x277787=_0x1694b1;}var _0xc59c0b=seqqueue[_0x50d3('0x43')](_0x1694b1);_0xc59c0b['id']=_0x383f81;_0xc59c0b[_0x50d3('0x44')]=_0x1694b1;_0xc59c0b[_0x50d3('0x45')]=_0x277787;_0xc59c0b[_0x50d3('0x26')]=_0x5cb255['channel'];_0x1100d8[_0x50d3('0x46')][_0x383f81]['on'](_0x50d3('0x47'),function(){logger['info'](_0x50d3('0x48'),_0x383f81);stopRouting(_0x383f81,_0x5cc045,_0x5cb255,_0x1100d8);clearTimeout(_0x133e86);_0x133e86=undefined;_0xc59c0b[_0x50d3('0x49')](!![]);if(_0x1100d8[_0x50d3('0x46')][_0x383f81]){delete _0x1100d8[_0x50d3('0x46')][_0x383f81];}_0x59f052[_0x50d3('0x41')]();});_0x1100d8[_0x50d3('0x46')][_0x383f81]['on'](_0x50d3('0x4a'),function(){if(_0x1100d8[_0x50d3('0x46')][_0x383f81]){delete _0x1100d8[_0x50d3('0x46')][_0x383f81];}});_0x133e86=setTimeout(function(){logger[_0x50d3('0x2e')](_0x50d3('0x4b'),_0x383f81);endRouting(_0x383f81,_0x5cc045,_0x5cb255,_0x1100d8);clearTimeout(_0x133e86);_0xc59c0b[_0x50d3('0x49')](!![]);_0x59f052['next']();},_0x277787);switch(_0x5cc045[_0x50d3('0x4c')]){case _0x50d3('0x4d'):strategy[_0x50d3('0x4d')](_0xc59c0b,_0x5cc045,_0x1100d8,_0x5cb255);break;default:strategy[_0x50d3('0x4e')](_0xc59c0b,_0x5cc045,_0x1100d8,_0x5cb255);}}else{logger[_0x50d3('0x34')](_0x50d3('0x4f'),_0x383f81,_0x3a8860[_0x50d3('0x30')]);_0x59f052[_0x50d3('0x41')]();}}}catch(_0x111861){console[_0x50d3('0x50')](_0x111861);logger[_0x50d3('0x34')](_0x50d3('0x3f'),_0x383f81,_0x111861[_0x50d3('0x51')]);_0x59f052[_0x50d3('0x41')]();}};}; \ 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 8bc3f14..9e3b3ec 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 _0x2594=['showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','uuid','./util','routing','squeue','realtime','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busy','busyQueue'];(function(_0x2cde74,_0x55cf68){var _0x39ee49=function(_0x1e312e){while(--_0x1e312e){_0x2cde74['push'](_0x2cde74['shift']());}};_0x39ee49(++_0x55cf68);}(_0x2594,0x1dc));var _0x4259=function(_0x4aa7e5,_0x234bfb){_0x4aa7e5=_0x4aa7e5-0x0;var _0x3f3ecf=_0x2594[_0x4aa7e5];return _0x3f3ecf;};'use strict';var _=require('lodash');var uuid=require(_0x4259('0x0'));var util=require(_0x4259('0x1'));var logger=require('../../../../../config/logger')(_0x4259('0x2'));var Agent=function(_0x52aae9,_0x2bdc9e,_0x14faae,_0x2d3536){this['notificationId']=uuid['v4']();this[_0x4259('0x3')]=_0x52aae9;this['agent']=_0x2bdc9e;this[_0x4259('0x4')]=_0x14faae;this[_0x4259('0x2')]=_0x2d3536;this[_0x4259('0x3')]['push'](this[_0x4259('0x5')][_0x4259('0x6')](this),this[_0x4259('0x7')][_0x4259('0x6')](this));this['squeue']['on']('timeout',this[_0x4259('0x7')][_0x4259('0x6')](this));this['squeue']['on'](_0x4259('0x8'),this[_0x4259('0x9')][_0x4259('0x6')](this));};Agent[_0x4259('0xa')][_0x4259('0xb')]=function(){this[_0x4259('0x3')][_0x4259('0xb')](this[_0x4259('0x5')][_0x4259('0x6')](this),this['handleTimeout']['bind'](this));};Agent[_0x4259('0xa')][_0x4259('0x9')]=function(){this[_0x4259('0x7')](!![]);};Agent['prototype'][_0x4259('0x5')]=function(){logger[_0x4259('0xc')](_0x4259('0xd'),this[_0x4259('0x3')]['id'],this['agent']['id']);if(_[_0x4259('0xe')](this[_0x4259('0x4')][_0x4259('0xf')][this[_0x4259('0x10')]['id']])){logger['debug'](_0x4259('0x11'),this[_0x4259('0x3')]['id'],this[_0x4259('0x10')]['id']);setTimeout(this['push'][_0x4259('0x6')](this),0x3e8);}else{if(this[_0x4259('0x2')]['forcedOwnership']||util['isAgentAvailable'](this[_0x4259('0x3')]['id'],this[_0x4259('0x4')][_0x4259('0xf')][this[_0x4259('0x10')]['id']],this[_0x4259('0x3')]['channel'],![])){this[_0x4259('0x4')]['agents'][this[_0x4259('0x10')]['id']][_0x4259('0x12')]=!![];this[_0x4259('0x4')][_0x4259('0xf')][this[_0x4259('0x10')]['id']][_0x4259('0x13')]=undefined;util[_0x4259('0x14')](this[_0x4259('0x15')],this[_0x4259('0x3')]['id'],this['realtime'][_0x4259('0xf')][this[_0x4259('0x10')]['id']],null,this[_0x4259('0x2')]);util[_0x4259('0x16')](this[_0x4259('0x3')]['id'],this['realtime']['agents'][this[_0x4259('0x10')]['id']],_0x4259('0x17')+(this[_0x4259('0x2')]['forcedOwnership']?_0x4259('0x18'):''));}else{logger[_0x4259('0xc')](_0x4259('0x19'),this[_0x4259('0x3')]['id'],this[_0x4259('0x10')]['id']);setTimeout(this[_0x4259('0xb')][_0x4259('0x6')](this),0x3e8);}}};Agent['prototype'][_0x4259('0x7')]=function(_0x5a9ec8){if(_[_0x4259('0xe')](this[_0x4259('0x4')][_0x4259('0xf')][this[_0x4259('0x10')]['id']])){return logger['debug'](_0x4259('0x11'),this[_0x4259('0x3')]['id'],this[_0x4259('0x10')]['id']);}else{logger[_0x4259('0xc')](_0x4259('0x1a'),this['squeue']['id'],this[_0x4259('0x10')]['id']);util[_0x4259('0x1b')](this[_0x4259('0x15')],this['squeue']['id'],this['realtime'][_0x4259('0xf')][this[_0x4259('0x10')]['id']],null,this['routing']);this['realtime'][_0x4259('0xf')][this[_0x4259('0x10')]['id']][_0x4259('0x12')]=![];this[_0x4259('0x4')][_0x4259('0xf')][this[_0x4259('0x10')]['id']][_0x4259('0x13')]=undefined;util['writeLog'](this['squeue']['id'],this[_0x4259('0x4')][_0x4259('0xf')][this[_0x4259('0x10')]['id']],_0x5a9ec8?_0x4259('0x1c'):_0x4259('0x1d'));}if(!_0x5a9ec8){setTimeout(this[_0x4259('0xb')][_0x4259('0x6')](this),0x3e8);}};function agent(_0x3730e9,_0x588487,_0x77b47d,_0x233fe7){return new Agent(_0x3730e9,_0x588487,_0x77b47d,_0x233fe7);}module[_0x4259('0x1e')]=agent; \ No newline at end of file +var _0xe06a=['showNotification','writeLog',':FORCED','busyQueue','STOP','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy'];(function(_0x20d9ff,_0x1bcc4b){var _0x1f78aa=function(_0x4ab48e){while(--_0x4ab48e){_0x20d9ff['push'](_0x20d9ff['shift']());}};_0x1f78aa(++_0x1bcc4b);}(_0xe06a,0x66));var _0xae06=function(_0x5ed2d9,_0x13336b){_0x5ed2d9=_0x5ed2d9-0x0;var _0xfb189e=_0xe06a[_0x5ed2d9];return _0xfb189e;};'use strict';var _=require(_0xae06('0x0'));var uuid=require(_0xae06('0x1'));var util=require(_0xae06('0x2'));var logger=require(_0xae06('0x3'))('routing');var Agent=function(_0x347969,_0x28ae5e,_0x55385d,_0x23b58d){this[_0xae06('0x4')]=uuid['v4']();this[_0xae06('0x5')]=_0x347969;this['agent']=_0x28ae5e;this[_0xae06('0x6')]=_0x55385d;this[_0xae06('0x7')]=_0x23b58d;this[_0xae06('0x5')][_0xae06('0x8')](this[_0xae06('0x9')]['bind'](this),this[_0xae06('0xa')][_0xae06('0xb')](this));this[_0xae06('0x5')]['on'](_0xae06('0xc'),this['handleTimeout'][_0xae06('0xb')](this));this[_0xae06('0x5')]['on'](_0xae06('0xd'),this[_0xae06('0xe')][_0xae06('0xb')](this));};Agent[_0xae06('0xf')][_0xae06('0x8')]=function(){this['squeue'][_0xae06('0x8')](this['handleRun'][_0xae06('0xb')](this),this[_0xae06('0xa')][_0xae06('0xb')](this));};Agent['prototype'][_0xae06('0xe')]=function(){this[_0xae06('0xa')](!![]);};Agent[_0xae06('0xf')][_0xae06('0x9')]=function(){logger[_0xae06('0x10')](_0xae06('0x11'),this['squeue']['id'],this[_0xae06('0x12')]['id']);if(_[_0xae06('0x13')](this['realtime'][_0xae06('0x14')][this[_0xae06('0x12')]['id']])){logger['debug'](_0xae06('0x15'),this[_0xae06('0x5')]['id'],this[_0xae06('0x12')]['id']);setTimeout(this['push'][_0xae06('0xb')](this),0x3e8);}else{if(this[_0xae06('0x7')][_0xae06('0x16')]||util[_0xae06('0x17')](this[_0xae06('0x5')]['id'],this[_0xae06('0x6')][_0xae06('0x14')][this['agent']['id']],this['squeue'][_0xae06('0x18')],![])){this['realtime'][_0xae06('0x14')][this['agent']['id']][_0xae06('0x19')]=!![];this[_0xae06('0x6')][_0xae06('0x14')][this[_0xae06('0x12')]['id']]['busyQueue']=undefined;util[_0xae06('0x1a')](this[_0xae06('0x4')],this[_0xae06('0x5')]['id'],this[_0xae06('0x6')]['agents'][this[_0xae06('0x12')]['id']],null,this[_0xae06('0x7')]);util[_0xae06('0x1b')](this['squeue']['id'],this[_0xae06('0x6')]['agents'][this[_0xae06('0x12')]['id']],'RINGING'+(this['routing'][_0xae06('0x16')]?_0xae06('0x1c'):''));}else{logger[_0xae06('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xae06('0x5')]['id'],this[_0xae06('0x12')]['id']);setTimeout(this[_0xae06('0x8')]['bind'](this),0x3e8);}}};Agent[_0xae06('0xf')][_0xae06('0xa')]=function(_0x259913){if(_[_0xae06('0x13')](this[_0xae06('0x6')][_0xae06('0x14')][this[_0xae06('0x12')]['id']])){return logger['debug'](_0xae06('0x15'),this[_0xae06('0x5')]['id'],this['agent']['id']);}else{logger[_0xae06('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xae06('0x5')]['id'],this[_0xae06('0x12')]['id']);util['hideNotification'](this['notificationId'],this[_0xae06('0x5')]['id'],this[_0xae06('0x6')]['agents'][this[_0xae06('0x12')]['id']],null,this[_0xae06('0x7')]);this[_0xae06('0x6')]['agents'][this[_0xae06('0x12')]['id']][_0xae06('0x19')]=![];this[_0xae06('0x6')][_0xae06('0x14')][this[_0xae06('0x12')]['id']][_0xae06('0x1d')]=undefined;util['writeLog'](this[_0xae06('0x5')]['id'],this['realtime'][_0xae06('0x14')][this[_0xae06('0x12')]['id']],_0x259913?_0xae06('0x1e'):'TIMEOUT');}if(!_0x259913){setTimeout(this[_0xae06('0x8')][_0xae06('0xb')](this),0x3e8);}};function agent(_0x2191a9,_0x320791,_0x509a6d,_0x34120e){return new Agent(_0x2191a9,_0x320791,_0x509a6d,_0x34120e);}module[_0xae06('0x1f')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 2836ff3..39e1acb 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 _0x1da6=['prototype','isNil','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','agents','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained'];(function(_0xc81011,_0x2c8dee){var _0x429c78=function(_0xa0830){while(--_0xa0830){_0xc81011['push'](_0xc81011['shift']());}};_0x429c78(++_0x2c8dee);}(_0x1da6,0x7c));var _0x61da=function(_0x53f218,_0x27514c){_0x53f218=_0x53f218-0x0;var _0x21890a=_0x1da6[_0x53f218];return _0x21890a;};'use strict';var _=require(_0x61da('0x0'));var uuid=require(_0x61da('0x1'));var util=require(_0x61da('0x2'));var logger=require(_0x61da('0x3'))(_0x61da('0x4'));var Beepall=function(_0xbe2d90,_0x1cec74,_0x39754a,_0xf7a566){this[_0x61da('0x5')]=uuid['v4']();this[_0x61da('0x6')]=_0xbe2d90;this[_0x61da('0x7')]=_0x1cec74;this[_0x61da('0x8')]=_0x39754a;this[_0x61da('0x4')]=_0xf7a566;this[_0x61da('0x6')][_0x61da('0x9')](this[_0x61da('0xa')][_0x61da('0xb')](this),this[_0x61da('0xc')][_0x61da('0xb')](this));this['squeue']['on'](_0x61da('0xd'),this[_0x61da('0xc')][_0x61da('0xb')](this));this[_0x61da('0x6')]['on'](_0x61da('0xe'),this[_0x61da('0xf')][_0x61da('0xb')](this));};Beepall[_0x61da('0x10')][_0x61da('0x9')]=function(){this[_0x61da('0x6')][_0x61da('0x9')](this[_0x61da('0xa')][_0x61da('0xb')](this),this[_0x61da('0xc')][_0x61da('0xb')](this));};Beepall['prototype'][_0x61da('0xf')]=function(){this[_0x61da('0xc')](!![]);};Beepall[_0x61da('0x10')][_0x61da('0xa')]=function(){var _0x55eef1=!![];if(!_[_0x61da('0x11')](this['queue'])&&!_[_0x61da('0x11')](this[_0x61da('0x7')]['Agents'])&&this['queue'][_0x61da('0x12')][_0x61da('0x13')]>0x0){for(var _0x46d2c4=0x0,_0x16ab1e;_0x46d2c40x0){for(var _0x34d045=0x0,_0x1327dc;_0x34d0450x0&&_0x2898b5[_0x3e281e+'CurrentCapacity']>=_0x2898b5[_0x3e281e+_0x43e7('0x1c')]){writeLog(_0x4b386b,_0x2898b5,_0x3e281e['toUpperCase']()+_0x43e7('0x1e'));return![];}}return!![];};exports[_0x43e7('0x1f')]=function(_0x20888b,_0x405f85,_0x51f4d7,_0x52b7b3,_0x805b54){return sendNotification(!![],_0x20888b,_0x405f85,_0x51f4d7,_0x52b7b3,_0x805b54);};exports['hideNotification']=function(_0x2dd5f,_0x40dc8f,_0x3565cf,_0xb1fc63,_0x5087d7){return sendNotification(![],_0x2dd5f,_0x40dc8f,_0x3565cf,_0xb1fc63,_0x5087d7);};exports[_0x43e7('0x20')]=writeLog; \ No newline at end of file +var _0x5075=['I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','user:%s','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','name','emit','user:save','split','account','notificationShake','body','queue','msg','notificationTemplate'];(function(_0x427352,_0x1bce61){var _0x23e0e6=function(_0x2a42a9){while(--_0x2a42a9){_0x427352['push'](_0x427352['shift']());}};_0x23e0e6(++_0x1bce61);}(_0x5075,0x73));var _0x5507=function(_0x4fa66c,_0x51f9a3){_0x4fa66c=_0x4fa66c-0x0;var _0x9b192b=_0x5075[_0x4fa66c];return _0x9b192b;};'use strict';var _=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var utils=require(_0x5507('0x2'));var Redis=require(_0x5507('0x3'));var config=require(_0x5507('0x4'));var logger=require(_0x5507('0x5'))(_0x5507('0x6'));config['redis']=_[_0x5507('0x7')](config[_0x5507('0x8')],{'host':_0x5507('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function sendNotification(_0x2cd9ee,_0x773559,_0x4c2d6d,_0x42c232,_0x7cc84c,_0xbf4b50){io['to'](util['format']('user:%s',_0x42c232[_0x5507('0xa')]))[_0x5507('0xb')](_0x5507('0xc'),_0x42c232);var _0x36c9eb=_0xbf4b50||{};var _0x50d6f5=_0x4c2d6d[_0x5507('0xd')]('.');var _0x1a6792={'uniqueid':_0x773559,'channel':_0x50d6f5[0x0],'id':_0x50d6f5[0x1],'title':_0x50d6f5[0x0]+'\x20interaction','interactionId':_0x50d6f5[0x2],'queue':_0x7cc84c?_0x7cc84c[_0x5507('0xa')]:null,'sound':_0x36c9eb[_0x5507('0xe')]['notificationSound'],'shake':_0x36c9eb[_0x5507('0xe')][_0x5507('0xf')]};try{if(!_0x36c9eb[_0x5507('0x10')]){_0x36c9eb[_0x5507('0x10')]={};}if(_0x7cc84c){_0x36c9eb[_0x5507('0x10')][_0x5507('0x11')]=_0x7cc84c;}else if(_0x36c9eb['body'][_0x5507('0x11')]){delete _0x36c9eb[_0x5507('0x10')][_0x5507('0x11')];}_0x1a6792[_0x5507('0x12')]=utils['getMustacheRender'](_0x36c9eb[_0x5507('0xe')][_0x5507('0x13')],_0x36c9eb);}catch(_0x2dfd06){_0x1a6792[_0x5507('0x12')]=_0x5507('0x14');logger[_0x5507('0x15')](util[_0x5507('0x16')](_0x5507('0x17'),_0x773559,_0x2dfd06[_0x5507('0x18')]));}io['to'](util[_0x5507('0x16')](_0x5507('0x19'),_0x42c232[_0x5507('0xa')]))[_0x5507('0xb')](util['format'](_0x5507('0x1a'),_0x2cd9ee?_0x5507('0x1b'):_0x5507('0x1c')),_0x1a6792);}function writeLog(_0x193eda,_0x54f473,_0x1dc53e){return logger[_0x5507('0x1d')](util[_0x5507('0x16')](_0x5507('0x1e'),_0x193eda,_0x54f473[_0x5507('0xa')],_0x1dc53e));}exports[_0x5507('0x1f')]=function(_0x501a94,_0x475970,_0x105535,_0x1f6325){if(_0x475970[_0x5507('0x20')]){writeLog(_0x501a94,_0x475970,_0x5507('0x21'));return![];}if(!_0x475970[_0x5507('0x22')]){writeLog(_0x501a94,_0x475970,_0x5507('0x23'));return![];}if(_0x475970[_0x105535+_0x5507('0x24')]){writeLog(_0x501a94,_0x475970,_0x5507('0x25'));return![];}if(_0x1f6325&&_0x475970[_0x5507('0x26')](_0x105535+_0x5507('0x27'))&&_0x475970[_0x5507('0x26')](_0x105535+_0x5507('0x28'))){if(_0x475970[_0x105535+_0x5507('0x27')]>0x0&&_0x475970[_0x105535+_0x5507('0x28')]>=_0x475970[_0x105535+'Capacity']){writeLog(_0x501a94,_0x475970,_0x105535[_0x5507('0x29')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x5507('0x2a')]=function(_0x4ea271,_0xa66a01,_0x24668b,_0x4beb0a,_0x5cbb09){return sendNotification(!![],_0x4ea271,_0xa66a01,_0x24668b,_0x4beb0a,_0x5cbb09);};exports[_0x5507('0x2b')]=function(_0x1a18d0,_0x5912d4,_0x2521cb,_0x24574b,_0x85d383){return sendNotification(![],_0x1a18d0,_0x5912d4,_0x2521cb,_0x24574b,_0x85d383);};exports[_0x5507('0x2c')]=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 ca494d5..4affc97 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 _0x18ab=['exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','error','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','message','join','info','next','getMustacheRender'];(function(_0x45d9fe,_0xd8baa4){var _0x55a029=function(_0x5c5100){while(--_0x5c5100){_0x45d9fe['push'](_0x45d9fe['shift']());}};_0x55a029(++_0xd8baa4);}(_0x18ab,0xd2));var _0xb18a=function(_0x234250,_0x129c35){_0x234250=_0x234250-0x0;var _0x3919d8=_0x18ab[_0x234250];return _0x3919d8;};'use strict';var schema=require(_0xb18a('0x0'));var sh=require(_0xb18a('0x1'));var _=require(_0xb18a('0x2'));var utils=require(_0xb18a('0x3'));var logger=require(_0xb18a('0x4'))(_0xb18a('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0xb18a('0x6')}});exports[_0xb18a('0x7')]=function(_0x260f23,_0x3d1990){return function(_0x48fe50){try{var _0x1e5da1={'command':_0x3d1990[0x0]};var _0x4cccff=system[_0xb18a('0x0')](_0x1e5da1,{'typecast':!![]});if(_0x4cccff[_0xb18a('0x8')]){logger['error'](_0xb18a('0x9'),_0x260f23,_['map'](_0x4cccff,_0xb18a('0xa'))[_0xb18a('0xb')](',\x20'));logger[_0xb18a('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x260f23);_0x48fe50[_0xb18a('0xd')]();}else{var _0x2b3ccc=this;var _0x4a6e05=utils[_0xb18a('0xe')](_0x3d1990[0x0],this);logger[_0xb18a('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x260f23,_0x4a6e05);sh[_0xb18a('0xf')](_[_0xb18a('0x10')](_0x4a6e05),function(_0x132090,_0x9170fc){logger[_0xb18a('0xc')](_0xb18a('0x11'),_0x260f23,_0x132090);if(_0x132090==0x0){var _0x5da8a6=_0x9170fc[_0xb18a('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3d1990[0x1])||_[_0xb18a('0x13')](_0x3d1990[0x1])){logger['info'](_0xb18a('0x14'),_0x260f23);_0x2b3ccc[_0xb18a('0x15')][_0x3d1990[0x1]]=_0x5da8a6;}else{logger[_0xb18a('0xc')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x260f23,_0x3d1990[0x1],_0x5da8a6);_0x2b3ccc[_0xb18a('0x15')][_0x3d1990[0x1]]=_0x5da8a6;}}_0x48fe50[_0xb18a('0xd')]();});}}catch(_0x33c7e7){logger[_0xb18a('0x16')](_0xb18a('0x9'),_0x260f23,_[_0xb18a('0x17')](_0x33c7e7)?JSON['stringify'](_0x33c7e7):_0x33c7e7);logger['info'](_0xb18a('0x18'),_0x260f23);_0x48fe50[_0xb18a('0xd')]();}};}; \ No newline at end of file +var _0x0810=['getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x0810,0x95));var _0x0081=function(_0x491411,_0x941b5a){_0x491411=_0x491411-0x0;var _0x4672eb=_0x0810[_0x491411];return _0x4672eb;};'use strict';var schema=require(_0x0081('0x0'));var sh=require(_0x0081('0x1'));var _=require(_0x0081('0x2'));var utils=require(_0x0081('0x3'));var logger=require(_0x0081('0x4'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x0081('0x5')}});exports['consequence']=function(_0x5c73ba,_0x14db28){return function(_0x5cd314){try{var _0x30c217={'command':_0x14db28[0x0]};var _0x5e90a5=system['validate'](_0x30c217,{'typecast':!![]});if(_0x5e90a5['length']){logger[_0x0081('0x6')]('[%s][SYSTEM]\x20%s',_0x5c73ba,_['map'](_0x5e90a5,_0x0081('0x7'))['join'](',\x20'));logger[_0x0081('0x8')](_0x0081('0x9'),_0x5c73ba);_0x5cd314[_0x0081('0xa')]();}else{var _0x3d8088=this;var _0x5a1251=utils[_0x0081('0xb')](_0x14db28[0x0],this);logger['info'](_0x0081('0xc'),_0x5c73ba,_0x5a1251);sh[_0x0081('0xd')](_['trim'](_0x5a1251),function(_0x59e210,_0x3c3ac9){logger[_0x0081('0x8')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x5c73ba,_0x59e210);if(_0x59e210==0x0){var _0x17806f=_0x3c3ac9[_0x0081('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x0081('0xf')](_0x14db28[0x1])||_[_0x0081('0x10')](_0x14db28[0x1])){logger[_0x0081('0x8')]('[%s][SYSTEM]\x20no\x20variable',_0x5c73ba);_0x3d8088[_0x0081('0x11')][_0x14db28[0x1]]=_0x17806f;}else{logger[_0x0081('0x8')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5c73ba,_0x14db28[0x1],_0x17806f);_0x3d8088[_0x0081('0x11')][_0x14db28[0x1]]=_0x17806f;}}_0x5cd314[_0x0081('0xa')]();});}}catch(_0x21de2d){logger[_0x0081('0x6')](_0x0081('0x12'),_0x5c73ba,_[_0x0081('0x13')](_0x21de2d)?JSON['stringify'](_0x21de2d):_0x21de2d);logger['info'](_0x0081('0x9'),_0x5c73ba);_0x5cd314[_0x0081('0xa')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 66eeb6c..e2303cb 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 _0x26d6=['interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','map','message','info','next','channel','Interaction','addTags'];(function(_0x173369,_0x7c0699){var _0x357fc1=function(_0x1d743c){while(--_0x1d743c){_0x173369['push'](_0x173369['shift']());}};_0x357fc1(++_0x7c0699);}(_0x26d6,0x10b));var _0x626d=function(_0xc2b4c8,_0x756a49){_0xc2b4c8=_0xc2b4c8-0x0;var _0x402443=_0x26d6[_0xc2b4c8];return _0x402443;};'use strict';var schema=require(_0x626d('0x0'));var _=require(_0x626d('0x1'));var rpc={'chatInteraction':require(_0x626d('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x626d('0x3')),'mailInteraction':require(_0x626d('0x4')),'faxInteraction':require(_0x626d('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x626d('0x6'))(_0x626d('0x7'));var tag=schema({'tag':{'type':_0x626d('0x8'),'required':!![],'message':_0x626d('0x9')}});exports['consequence']=function(_0x25ec57,_0x5b28f9,_0x5649cf,_0x4aa9f3){return function(_0x1729b4){try{var _0x240563={'tag':_0x5b28f9[0x0]};var _0xe2135d=tag['validate'](_0x240563,{'typecast':!![]});if(_0xe2135d['length']){logger[_0x626d('0xa')](_0x626d('0xb'),_0x25ec57,_[_0x626d('0xc')](_0xe2135d,_0x626d('0xd'))['join'](',\x20'));logger[_0x626d('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x25ec57);_0x1729b4[_0x626d('0xf')]();}else{var _0x499b60={'ids':[_0x5b28f9[0x0]]};if(rpc[_0x4aa9f3[_0x626d('0x10')]+_0x626d('0x11')]){rpc[_0x4aa9f3[_0x626d('0x10')]+'Interaction'][_0x626d('0x12')](_0x4aa9f3[_0x626d('0x13')]['id'],_0x499b60)[_0x626d('0x14')](function(_0x1b5bc0){logger[_0x626d('0xe')](_0x626d('0x15'),_0x25ec57,_0x5b28f9[0x1],_0x4aa9f3['channel'],_0x4aa9f3[_0x626d('0x13')]['id']);})[_0x626d('0x16')](function(_0x135b5b){logger[_0x626d('0xa')](_0x626d('0xb'),_0x25ec57,JSON['stringify'](_0x135b5b));logger['info'](_0x626d('0x17'),_0x25ec57);})[_0x626d('0x18')](function(){_0x1729b4['next']();});}}}catch(_0x1a93fd){logger['error'](_0x626d('0xb'),_0x25ec57,_[_0x626d('0x19')](_0x1a93fd)?JSON['stringify'](_0x1a93fd):_0x1a93fd);logger[_0x626d('0xe')](_0x626d('0x17'),_0x25ec57);_0x1729b4['next']();}};}; \ No newline at end of file +var _0x133a=['catch','stringify','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x27c7af,_0xf08b4c){var _0x5d1322=function(_0x4510f5){while(--_0x4510f5){_0x27c7af['push'](_0x27c7af['shift']());}};_0x5d1322(++_0xf08b4c);}(_0x133a,0x1b3));var _0xa133=function(_0x5431f6,_0x3a2549){_0x5431f6=_0x5431f6-0x0;var _0x187854=_0x133a[_0x5431f6];return _0x187854;};'use strict';var schema=require(_0xa133('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xa133('0x1')),'openchannelInteraction':require(_0xa133('0x2')),'smsInteraction':require(_0xa133('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xa133('0x4')),'whatsappInteraction':require(_0xa133('0x5'))};var logger=require('../../../../config/logger')(_0xa133('0x6'));var tag=schema({'tag':{'type':_0xa133('0x7'),'required':!![],'message':_0xa133('0x8')}});exports[_0xa133('0x9')]=function(_0xbe02bb,_0x5cabd5,_0x4f1572,_0x4bd758){return function(_0x5db1b3){try{var _0x13aff9={'tag':_0x5cabd5[0x0]};var _0x1698ee=tag['validate'](_0x13aff9,{'typecast':!![]});if(_0x1698ee[_0xa133('0xa')]){logger[_0xa133('0xb')](_0xa133('0xc'),_0xbe02bb,_[_0xa133('0xd')](_0x1698ee,'message')[_0xa133('0xe')](',\x20'));logger[_0xa133('0xf')](_0xa133('0x10'),_0xbe02bb);_0x5db1b3[_0xa133('0x11')]();}else{var _0x5745be={'ids':[_0x5cabd5[0x0]]};if(rpc[_0x4bd758[_0xa133('0x12')]+_0xa133('0x13')]){rpc[_0x4bd758['channel']+'Interaction'][_0xa133('0x14')](_0x4bd758[_0xa133('0x15')]['id'],_0x5745be)[_0xa133('0x16')](function(_0x151fa2){logger['info'](_0xa133('0x17'),_0xbe02bb,_0x5cabd5[0x1],_0x4bd758[_0xa133('0x12')],_0x4bd758['interaction']['id']);})[_0xa133('0x18')](function(_0x4887ce){logger[_0xa133('0xb')]('[%s][TAG]\x20%s',_0xbe02bb,JSON[_0xa133('0x19')](_0x4887ce));logger[_0xa133('0xf')](_0xa133('0x10'),_0xbe02bb);})['finally'](function(){_0x5db1b3['next']();});}}}catch(_0x46e4fe){logger['error'](_0xa133('0xc'),_0xbe02bb,_[_0xa133('0x1a')](_0x46e4fe)?JSON['stringify'](_0x46e4fe):_0x46e4fe);logger[_0xa133('0xf')](_0xa133('0x10'),_0xbe02bb);_0x5db1b3['next']();}};}; \ 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 6df8ae9..b5d74e3 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 _0x2c64=['result','Unable\x20to\x20login\x20with\x20TVox\x20application','info','stop','catch','error','[%s][TVOX]\x20%s','isObject','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','params','stringify','utf8','application/json-rpc','then'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x2c64,0x167));var _0x42c6=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0x2c64[_0x1e172a];return _0x96338b;};'use strict';var rp=require(_0x42c6('0x0'));var logger=require(_0x42c6('0x1'))(_0x42c6('0x2'));var _=require('lodash');var arr=[];exports[_0x42c6('0x3')]=function(_0x2e15e3,_0x3fdfa7){return function(_0x19bef7){var _0x11ab04=_0x3fdfa7[0xa];var _0x9b3e4e=_0x3fdfa7[0xb];var _0x4ced32=_0x3fdfa7[0xc];var _0x2951b0=_0x3fdfa7[0xd];var _0x4a8a33=_0x3fdfa7[0xe];var _0x27bbec=_0x3fdfa7[0xf][_0x42c6('0x4')](/\n/g,_0x42c6('0x5'));var _0x5e96fb=_0x3fdfa7[0x10][_0x42c6('0x4')](/\n/g,'\x20');if(!arr[_0x42c6('0x6')](_0x9b3e4e)){arr[_0x42c6('0x7')](_0x9b3e4e);var _0x5ced82=_0x3fdfa7[0x3];var _0x3882a3=_0x3fdfa7[0x4];var _0x5123b9=_0x3fdfa7[0x1];var _0x52869b=_0x3fdfa7[0x0];var _0x57536b={};_0x57536b[_0x42c6('0x8')]=_0x3fdfa7[0x8]+_0x42c6('0x9')+_0x4ced32+'|'+_0x11ab04+'|'+_0x2951b0+'|'+_0x9b3e4e+'|'+_0x4a8a33;_0x57536b[_0x42c6('0xa')]=_0x3fdfa7[0x7]+_0x42c6('0x9')+_0x4ced32+'|'+_0x11ab04+'|'+_0x2951b0+'|'+_0x9b3e4e+'|'+_0x4a8a33+'|'+_0x27bbec+'|'+_0x5e96fb;_0x57536b[_0x42c6('0xb')]=_0x3fdfa7[0x9];var _0x575191={};_0x575191[_0x42c6('0xc')]='2.0';_0x575191[_0x42c6('0xd')]='login';var _0x3329b2=[];_0x3329b2[_0x42c6('0x7')](_0x3fdfa7[0x2]);_0x3329b2[_0x42c6('0x7')](_0x3fdfa7[0x5]);_0x3329b2[_0x42c6('0x7')](_0x3fdfa7[0x6]);_0x575191[_0x42c6('0xe')]=_0x3329b2;_0x575191['id']=0x1;var _0x4a3b4d=JSON[_0x42c6('0xf')](_0x575191);var _0x13a04b={'encoding':_0x42c6('0x10'),'method':'POST','timeout':0x2710,'url':_0x5ced82,'headers':{'Content-Type':_0x42c6('0x11')},'body':_0x4a3b4d};return rp(_0x13a04b)[_0x42c6('0x12')](function(_0x57a99d){const _0x501d0e=JSON['parse'](_0x57a99d);if(!_0x501d0e[_0x42c6('0x13')]['logged']){throw new Error(_0x42c6('0x14'));}var _0x543de1=_0x9b3e4e;var _0x584d5='channelId='+_0x5123b9+'&serviceId='+_0x52869b+'&sessionId='+_0x543de1+'&data='+JSON[_0x42c6('0xf')](_0x57536b);var _0x439276=_0x3882a3+'?'+_0x584d5;return rp(_0x439276);})['then'](function(_0x192d53){logger[_0x42c6('0x15')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x2e15e3,_0x192d53);_0x19bef7[_0x42c6('0x16')]();})[_0x42c6('0x17')](function(_0x1aa8ed){logger[_0x42c6('0x18')](_0x42c6('0x19'),_0x2e15e3,_[_0x42c6('0x1a')](_0x1aa8ed)?JSON[_0x42c6('0xf')](_0x1aa8ed):_0x1aa8ed);_0x19bef7[_0x42c6('0x16')]();});}else{logger[_0x42c6('0x15')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x2e15e3);_0x19bef7['next']();}};}; \ No newline at end of file +var _0x63b9=['urlOnRing','title','jsonrpc','2.0','push','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','urlOnAnswer','?params='];(function(_0xd4b7e3,_0x36c198){var _0x14e1c2=function(_0x2bcc4b){while(--_0x2bcc4b){_0xd4b7e3['push'](_0xd4b7e3['shift']());}};_0x14e1c2(++_0x36c198);}(_0x63b9,0xc4));var _0x963b=function(_0x1092ba,_0x5869e0){_0x1092ba=_0x1092ba-0x0;var _0x410e1f=_0x63b9[_0x1092ba];return _0x410e1f;};'use strict';var rp=require(_0x963b('0x0'));var logger=require(_0x963b('0x1'))('routing');var _=require(_0x963b('0x2'));var arr=[];exports[_0x963b('0x3')]=function(_0x52c7df,_0x809ce7){return function(_0x3d741b){var _0x4f157a=_0x809ce7[0xa];var _0x11e224=_0x809ce7[0xb];var _0x218efb=_0x809ce7[0xc];var _0xdcb8d1=_0x809ce7[0xd];var _0x26c13f=_0x809ce7[0xe];var _0x2d1854=_0x809ce7[0xf][_0x963b('0x4')](/\n/g,_0x963b('0x5'));var _0x4f4bf5=_0x809ce7[0x10][_0x963b('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x11e224)){arr['push'](_0x11e224);var _0x1e8e7d=_0x809ce7[0x3];var _0x2ac05e=_0x809ce7[0x4];var _0x585fac=_0x809ce7[0x1];var _0x1a1a0c=_0x809ce7[0x0];var _0x2b5ca1={};_0x2b5ca1[_0x963b('0x6')]=_0x809ce7[0x8]+_0x963b('0x7')+_0x218efb+'|'+_0x4f157a+'|'+_0xdcb8d1+'|'+_0x11e224+'|'+_0x26c13f;_0x2b5ca1[_0x963b('0x8')]=_0x809ce7[0x7]+_0x963b('0x7')+_0x218efb+'|'+_0x4f157a+'|'+_0xdcb8d1+'|'+_0x11e224+'|'+_0x26c13f+'|'+_0x2d1854+'|'+_0x4f4bf5;_0x2b5ca1[_0x963b('0x9')]=_0x809ce7[0x9];var _0x35fb4a={};_0x35fb4a[_0x963b('0xa')]=_0x963b('0xb');_0x35fb4a['method']='login';var _0x8aece5=[];_0x8aece5[_0x963b('0xc')](_0x809ce7[0x2]);_0x8aece5[_0x963b('0xc')](_0x809ce7[0x5]);_0x8aece5[_0x963b('0xc')](_0x809ce7[0x6]);_0x35fb4a[_0x963b('0xd')]=_0x8aece5;_0x35fb4a['id']=0x1;var _0x26c64a=JSON[_0x963b('0xe')](_0x35fb4a);var _0x43df2e={'encoding':_0x963b('0xf'),'method':_0x963b('0x10'),'timeout':0x2710,'url':_0x1e8e7d,'headers':{'Content-Type':_0x963b('0x11')},'body':_0x26c64a};return rp(_0x43df2e)[_0x963b('0x12')](function(_0x7504ab){const _0x5121f3=JSON[_0x963b('0x13')](_0x7504ab);if(!_0x5121f3[_0x963b('0x14')][_0x963b('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x30cea0=_0x11e224;var _0x2a8c47=_0x963b('0x16')+_0x585fac+_0x963b('0x17')+_0x1a1a0c+_0x963b('0x18')+_0x30cea0+_0x963b('0x19')+JSON['stringify'](_0x2b5ca1);var _0x1a3ba6=_0x2ac05e+'?'+_0x2a8c47;return rp(_0x1a3ba6);})[_0x963b('0x12')](function(_0xb3310e){logger[_0x963b('0x1a')](_0x963b('0x1b'),_0x52c7df,_0xb3310e);_0x3d741b[_0x963b('0x1c')]();})[_0x963b('0x1d')](function(_0x44660b){logger[_0x963b('0x1e')]('[%s][TVOX]\x20%s',_0x52c7df,_[_0x963b('0x1f')](_0x44660b)?JSON[_0x963b('0xe')](_0x44660b):_0x44660b);_0x3d741b[_0x963b('0x1c')]();});}else{logger[_0x963b('0x1a')](_0x963b('0x20'),_0x52c7df);_0x3d741b[_0x963b('0x21')]();}};}; \ 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 1ffffbe..01f2c38 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(_0x1b39a2,_0x4a2a0c){var _0x1c62c1=function(_0x4e019f){while(--_0x4e019f){_0x1b39a2['push'](_0x1b39a2['shift']());}};_0x1c62c1(++_0x4a2a0c);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x4e0529,_0x38696d){var _0x394c29=function(_0x2b8253){while(--_0x2b8253){_0x4e0529['push'](_0x4e0529['shift']());}};_0x394c29(++_0x38696d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index a053dac..1f065f0 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 _0x6282=['loggedIn','name','mailQueues','available','waiting','openchannelQueues','paused','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','rules','channel','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','amazonlex','tag','TagId','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','matchPath','complete','info','stack','agent','agents','busyQueue','end','QueueReport','update','UserId','message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','find','chatQueues'];(function(_0x17fa50,_0x28e30c){var _0x2d9eb6=function(_0x2a20a1){while(--_0x2a20a1){_0x17fa50['push'](_0x17fa50['shift']());}};_0x2d9eb6(++_0x28e30c);}(_0x6282,0x76));var _0x2628=function(_0x41fc7f,_0x123a6d){_0x41fc7f=_0x41fc7f-0x0;var _0x5cabfe=_0x6282[_0x41fc7f];return _0x5cabfe;};'use strict';var _=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var fs=require('fs');var jayson=require(_0x2628('0x3'));var BPromise=require('bluebird');var utils=require('./applications/utils');var logger=require(_0x2628('0x4'))(_0x2628('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x2628('0x6')),'chatQueueReport':require(_0x2628('0x7')),'smsQueueReport':require(_0x2628('0x8')),'faxQueueReport':require(_0x2628('0x9')),'whatsappQueueReport':require(_0x2628('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0xb6b945,_0x144ae8,_0x2170a7){return util[_0x2628('0xb')](_0x2628('0xc'),_0xb6b945,_0x144ae8||0x0,_0x2170a7||0x0);}function getIntervals(_0x241628,_0x403569){var _0x1d12a5=[];if(!_[_0x2628('0xd')](_0x403569[_0x2628('0xe')])&&!_[_0x2628('0xd')](_0x241628[_0x403569[_0x2628('0xe')]])&&!_[_0x2628('0xd')](_0x241628[_0x403569[_0x2628('0xe')]][_0x2628('0xf')])){_0x1d12a5=_['map'](_0x241628[_0x403569['IntervalId']][_0x2628('0xf')],_0x2628('0x10'));}else if(!_[_0x2628('0xd')](_0x403569[_0x2628('0x10')])){_0x1d12a5=[_0x403569['interval']];}return _0x1d12a5;}exports['listen']=function(_0x1081a4){_0x1081a4[_0x2628('0x11')]={};return new BPromise(function(_0x4d2cfb,_0x2395fe){var _0x2f59ca={'Start':function(_0x513aee){var _0x645884=this;return new Promise(function(_0x16e67a,_0x457163){if(_0x513aee){try{var _0x4f418d=[];var _0x13a728=getId(_0x513aee[_0x2628('0x12')],_0x513aee['message']?_0x513aee[_0x2628('0x13')]['id']:0x0,_0x513aee['interaction']?_0x513aee[_0x2628('0x14')]['id']:0x0);if(_0x513aee[_0x2628('0x15')]&&_['isArray'](_0x513aee[_0x2628('0x15')])&&_0x513aee[_0x2628('0x15')]['length']){for(var _0x165824=0x0;_0x165824<_0x513aee['applications'][_0x2628('0x16')];_0x165824+=0x1){var _0x4976ce=_0x513aee['applications'][_0x165824];if(fs[_0x2628('0x17')](path[_0x2628('0x18')](__dirname,_0x2628('0x15'),_0x4976ce[_0x2628('0x19')]+_0x2628('0x1a')))){var _0x1911a2=[];switch(_0x4976ce[_0x2628('0x19')][_0x2628('0x1b')]()){case _0x2628('0x1c'):var _0x57a799=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');if(_0x513aee[_0x2628('0x12')]===_0x2628('0x1f')){_0x1911a2[_0x2628('0x20')](_0x57a799[0x0]);_0x1911a2['push'](_0x57a799[0x1]);_0x1911a2[_0x2628('0x20')](_0x57a799[_0x2628('0x21')](0x2,_0x57a799[_0x2628('0x16')])[_0x2628('0x18')](','));}else{_0x1911a2[_0x2628('0x20')](_0x57a799[0x0]);_0x1911a2['push'](_0x57a799['slice'](0x1,_0x57a799[_0x2628('0x16')])[_0x2628('0x18')](','));}break;case _0x2628('0x22'):var _0x41c18e=_0x4976ce[_0x2628('0x1d')]['split'](',');_0x1911a2[_0x2628('0x20')](_0x41c18e[0x0]);_0x1911a2[_0x2628('0x20')](_0x41c18e[0x1]);_0x1911a2[_0x2628('0x20')](_0x41c18e[_0x2628('0x21')](0x2,_0x41c18e[_0x2628('0x16')])[_0x2628('0x18')](','));break;case'dialogflowv2':var _0x541eef=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');_0x1911a2[_0x2628('0x20')](_0x541eef[0x0]);_0x1911a2[_0x2628('0x20')](_0x541eef[0x1]);_0x1911a2['push'](_0x541eef[0x2]);_0x1911a2[_0x2628('0x20')](_0x541eef[0x3]);_0x1911a2[_0x2628('0x20')](_0x541eef[_0x2628('0x21')](0x4,_0x541eef[_0x2628('0x16')])['join'](','));break;case _0x2628('0x23'):var _0x1dd96a=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');_0x1911a2['push'](_0x1dd96a[0x0]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[0x1]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[0x2]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[0x3]);_0x1911a2[_0x2628('0x20')](_0x1dd96a[_0x2628('0x21')](0x4,_0x1dd96a[_0x2628('0x16')])[_0x2628('0x18')](','));break;case _0x2628('0x13'):_0x1911a2[_0x2628('0x20')](_0x4976ce['appdata']);break;case _0x2628('0x24'):_0x1911a2[_0x2628('0x20')](_0x4976ce[_0x2628('0x25')]);_0x1911a2[_0x2628('0x20')](_0x4976ce[_0x2628('0x1d')]);break;case'tvox':var _0x4ba58c=utils[_0x2628('0x26')](_0x513aee[_0x2628('0x27')][_0x2628('0x28')],_0x513aee);var _0x572e2d=_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');_0x1911a2[_0x2628('0x20')](_0x572e2d[0x0]);_0x1911a2['push'](_0x572e2d[0x1]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x2]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x3]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x4]);_0x1911a2['push'](_0x572e2d[0x5]);_0x1911a2['push'](_0x572e2d[0x6]);_0x1911a2['push'](_0x572e2d[0x7]);_0x1911a2['push'](_0x572e2d[0x8]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0x9]);_0x1911a2[_0x2628('0x20')](_0x572e2d[0xa]);_0x1911a2[_0x2628('0x20')](_0x513aee['interaction']['id']);_0x1911a2[_0x2628('0x20')](_0x513aee[_0x2628('0x13')]['id']);_0x1911a2[_0x2628('0x20')](_0x4976ce['ChatWebsiteId']);_0x1911a2[_0x2628('0x20')](_0x513aee[_0x2628('0x14')][_0x2628('0x29')]);_0x1911a2[_0x2628('0x20')](_0x513aee[_0x2628('0x2a')][_0x2628('0x2a')]);_0x1911a2[_0x2628('0x20')](_0x4ba58c);break;default:_0x1911a2=_['isNil'](_0x4976ce[_0x2628('0x1d')])?[]:_0x4976ce[_0x2628('0x1d')][_0x2628('0x1e')](',');}var _0x3dd851={'id':util[_0x2628('0xb')](_0x2628('0x2b'),_0x13a728,_0x4976ce['id'],_0x4976ce['app']),'condition':require(_0x2628('0x2c'))['condition'](_0x13a728,getIntervals(_0x1081a4[_0x2628('0x2d')],_0x4976ce),_0x1081a4),'consequence':require(_0x2628('0x2e')+_0x4976ce[_0x2628('0x19')])[_0x2628('0x2f')](_0x13a728,_0x1911a2,_0x1081a4,_0x513aee),'p':_0x4976ce[_0x2628('0x30')]||0x0};logger['info'](_0x2628('0x31'),_0x3dd851['id'],'on\x20interval',getIntervals(_0x1081a4['intervals'],_0x4976ce)[_0x2628('0x18')](_0x2628('0x32')));_0x4f418d[_0x2628('0x20')](_0x3dd851);}else{logger[_0x2628('0x33')](_0x2628('0x34'),path['join'](__dirname,_0x2628('0x15'),_0x4976ce[_0x2628('0x19')]+_0x2628('0x1a')));}}_0x1081a4[_0x2628('0x11')][_0x13a728]=new RuleEngine(_0x4f418d);_0x1081a4[_0x2628('0x11')][_0x13a728]['execute'](_0x513aee,function(_0x4665e8){logger['info'](_0x2628('0x35'),JSON[_0x2628('0x36')](_0x4665e8[_0x2628('0x37')]));if(_0x1081a4[_0x2628('0x11')][_0x13a728]){_0x1081a4['rules'][_0x13a728]['emit'](_0x2628('0x38'));}});return _0x16e67a({'code':0xc8,'message':_0x513aee});}else{logger[_0x2628('0x39')]('No\x20applications\x20to\x20execute');return _0x16e67a({'code':0xc8,'message':_0x513aee});}}catch(_0x23726f){logger[_0x2628('0x33')](_0x23726f[_0x2628('0x3a')]);return _0x457163(_0x645884[_0x2628('0x33')](0x1f4,_0x23726f));}}return _0x457163('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2e363a){var _0x1b6822=this;return new Promise(function(_0x1a34ee,_0x29847f){if(_0x2e363a[_0x2628('0x3b')]&&_0x2e363a[_0x2628('0x3b')]['id']){if(_0x1081a4[_0x2628('0x3c')][_0x2e363a[_0x2628('0x3b')]['id']]){_0x1081a4['agents'][_0x2e363a[_0x2628('0x3b')]['id']]['busy']=![];_0x1081a4[_0x2628('0x3c')][_0x2e363a['agent']['id']][_0x2628('0x3d')]=undefined;}}if(_0x2e363a[_0x2628('0x13')]&&_0x2e363a[_0x2628('0x13')]['id']){try{var _0x2b8fb9=getId(_0x2e363a[_0x2628('0x12')],_0x2e363a['message']?_0x2e363a[_0x2628('0x13')]['id']:0x0,_0x2e363a['interaction']?_0x2e363a[_0x2628('0x14')]['id']:0x0);if(_0x1081a4[_0x2628('0x11')][_0x2b8fb9]){_0x1081a4[_0x2628('0x11')][_0x2b8fb9]['emit'](_0x2628('0x3e'));if(rpc[_0x2e363a[_0x2628('0x12')]+'QueueReport']){rpc[_0x2e363a[_0x2628('0x12')]+_0x2628('0x3f')][_0x2628('0x40')](_0x2b8fb9,{'UserId':_0x2e363a[_0x2628('0x13')][_0x2628('0x41')]})['catch'](function(){logger[_0x2628('0x33')]('error\x20update\x20queue\x20report');});}}return _0x1a34ee({'code':0xc8,'message':_0x2e363a});}catch(_0x307ab6){logger[_0x2628('0x33')](_0x307ab6[_0x2628('0x3a')]);return _0x29847f(_0x1b6822[_0x2628('0x33')](0x1f4,_0x307ab6));}}logger[_0x2628('0x33')](_0x2628('0x42'));return _0x29847f(_0x1b6822[_0x2628('0x33')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x7fc50){var _0x11a733=this;return new Promise(function(_0xdcf3ac,_0x403c78){if(_0x7fc50[_0x2628('0x3b')]&&_0x7fc50[_0x2628('0x3b')]['id']){try{if(_0x1081a4[_0x2628('0x3c')][_0x7fc50[_0x2628('0x3b')]['id']]){_0x1081a4[_0x2628('0x3c')][_0x7fc50['agent']['id']]['busy']=![];_0x1081a4[_0x2628('0x3c')][_0x7fc50[_0x2628('0x3b')]['id']][_0x2628('0x3d')]=undefined;}return _0xdcf3ac({'code':0xc8,'message':_0x7fc50});}catch(_0xc7abb4){logger[_0x2628('0x33')](_0xc7abb4['stack']);return _0x403c78(_0x11a733['error'](0x1f4,_0xc7abb4));}}logger[_0x2628('0x33')]('message\x20is\x20empty');return _0x403c78(_0x11a733[_0x2628('0x33')](0x1f4,_0x2628('0x42')));});},'AbandonInteraction':function(_0x45227a){var _0x313e45=this;return new Promise(function(_0x2a5872,_0x2e677){if(_0x45227a[_0x2628('0x12')]&&_0x45227a[_0x2628('0x14')]&&_0x45227a[_0x2628('0x14')]['id']){try{var _0x3a656d=getId(_0x45227a[_0x2628('0x12')],_0x45227a[_0x2628('0x13')]?_0x45227a[_0x2628('0x13')]['id']:0x0,_0x45227a[_0x2628('0x14')]?_0x45227a[_0x2628('0x14')]['id']:0x0);if(_0x1081a4[_0x2628('0x11')][_0x3a656d]){_0x1081a4[_0x2628('0x11')][_0x3a656d][_0x2628('0x43')](_0x2628('0x3e'));}return _0x2a5872({'code':0xc8,'message':_0x45227a});}catch(_0x2c5424){logger[_0x2628('0x33')](_0x2c5424[_0x2628('0x3a')]);return _0x2e677(_0x313e45['error'](0x1f4,_0x2c5424));}}logger[_0x2628('0x33')](_0x2628('0x42'));return _0x2e677(_0x313e45['error'](0x1f4,_0x2628('0x42')));});},'AgentCapacity':function(_0x382c0b){var _0x208707=this;return new Promise(function(_0x1bf368,_0x13187b){if(_0x1081a4[_0x2628('0x3c')][_0x2628('0x44')](_0x382c0b['id'])){for(var _0x167cd1 in _0x382c0b['capacity']){if(_0x382c0b[_0x2628('0x45')][_0x2628('0x44')](_0x167cd1)){if(_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']]['hasOwnProperty'](_0x167cd1+_0x2628('0x46'))){_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']][_0x167cd1+_0x2628('0x46')]=parseInt(_0x382c0b[_0x2628('0x45')][_0x167cd1],0xa);}}}_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']][_0x2628('0x47')]();return _0x1bf368({'code':0xc8,'message':_0x1081a4[_0x2628('0x3c')][_0x382c0b['id']]});}else{return _0x13187b(_0x208707['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x49d412){return new Promise(function(_0x28d22a){var _0x4be311=_['values'](_0x1081a4[_0x2628('0x3c')]);if(_0x49d412&&_0x49d412['id']){var _0x36bcaf=_[_0x2628('0x48')](_0x4be311,function(_0x570f37){return _0x570f37['id']===_0x49d412['id'];});_0x28d22a(_0x36bcaf);}else{_0x28d22a({'count':_0x4be311['length'],'rows':_0x4be311});}});},'ChatQueues':function(){return new Promise(function(_0x5af7e8){var _0x54f9c0=[];for(var _0x3a3477 in _0x1081a4[_0x2628('0x49')]){if(_0x1081a4[_0x2628('0x49')][_0x2628('0x44')](_0x3a3477)){var _0x2a4fc0=_0x1081a4['chatQueues'][_0x3a3477];var _0x597bb2={'id':_0x2a4fc0['id'],'available':_0x2a4fc0['available'],'loggedIn':_0x2a4fc0[_0x2628('0x4a')],'name':_0x2a4fc0[_0x2628('0x4b')],'paused':_0x2a4fc0['paused'],'waiting':_0x2a4fc0['waiting']};_0x54f9c0[_0x2628('0x20')](_0x597bb2);}}_0x5af7e8({'count':_0x54f9c0[_0x2628('0x16')],'rows':_0x54f9c0});});},'MailQueues':function(){return new Promise(function(_0x54869e){var _0x189c92=[];for(var _0x3a3a66 in _0x1081a4[_0x2628('0x4c')]){if(_0x1081a4['mailQueues']['hasOwnProperty'](_0x3a3a66)){var _0xdbd0ef=_0x1081a4[_0x2628('0x4c')][_0x3a3a66];var _0x58274b={'id':_0xdbd0ef['id'],'available':_0xdbd0ef[_0x2628('0x4d')],'loggedIn':_0xdbd0ef[_0x2628('0x4a')],'name':_0xdbd0ef[_0x2628('0x4b')],'paused':_0xdbd0ef['paused'],'waiting':_0xdbd0ef[_0x2628('0x4e')]};_0x189c92[_0x2628('0x20')](_0x58274b);}}_0x54869e({'count':_0x189c92['length'],'rows':_0x189c92});});},'OpenchannelQueues':function(){return new Promise(function(_0x22278f){var _0x93072a=[];for(var _0x219aeb in _0x1081a4[_0x2628('0x4f')]){if(_0x1081a4['openchannelQueues'][_0x2628('0x44')](_0x219aeb)){var _0xdfddbe=_0x1081a4[_0x2628('0x4f')][_0x219aeb];var _0x4a2190={'id':_0xdfddbe['id'],'available':_0xdfddbe['available'],'loggedIn':_0xdfddbe['loggedIn'],'name':_0xdfddbe[_0x2628('0x4b')],'paused':_0xdfddbe[_0x2628('0x50')],'waiting':_0xdfddbe[_0x2628('0x4e')]};_0x93072a[_0x2628('0x20')](_0x4a2190);}}_0x22278f({'count':_0x93072a['length'],'rows':_0x93072a});});},'SmsQueues':function(){return new Promise(function(_0x52d1ce){var _0x187f55=[];for(var _0x355444 in _0x1081a4['smsQueues']){if(_0x1081a4[_0x2628('0x51')][_0x2628('0x44')](_0x355444)){var _0x2b5053=_0x1081a4[_0x2628('0x51')][_0x355444];var _0x121435={'id':_0x2b5053['id'],'available':_0x2b5053[_0x2628('0x4d')],'loggedIn':_0x2b5053['loggedIn'],'name':_0x2b5053[_0x2628('0x4b')],'paused':_0x2b5053['paused'],'waiting':_0x2b5053[_0x2628('0x4e')]};_0x187f55['push'](_0x121435);}}_0x52d1ce({'count':_0x187f55[_0x2628('0x16')],'rows':_0x187f55});});},'FaxQueues':function(){return new Promise(function(_0x353412){var _0x24d571=[];for(var _0x1f6267 in _0x1081a4[_0x2628('0x52')]){if(_0x1081a4[_0x2628('0x52')][_0x2628('0x44')](_0x1f6267)){var _0xfa1f4=_0x1081a4[_0x2628('0x52')][_0x1f6267];var _0x12e835={'id':_0xfa1f4['id'],'available':_0xfa1f4[_0x2628('0x4d')],'loggedIn':_0xfa1f4[_0x2628('0x4a')],'name':_0xfa1f4[_0x2628('0x4b')],'paused':_0xfa1f4[_0x2628('0x50')],'waiting':_0xfa1f4[_0x2628('0x4e')]};_0x24d571['push'](_0x12e835);}}_0x353412({'count':_0x24d571[_0x2628('0x16')],'rows':_0x24d571});});},'WhatsappQueues':function(){return new Promise(function(_0x3170fb){var _0x443456=[];for(var _0xd41484 in _0x1081a4[_0x2628('0x53')]){if(_0x1081a4[_0x2628('0x53')][_0x2628('0x44')](_0xd41484)){var _0x3d52c6=_0x1081a4['whatsappQueues'][_0xd41484];var _0x29aacc={'id':_0x3d52c6['id'],'available':_0x3d52c6['available'],'loggedIn':_0x3d52c6[_0x2628('0x4a')],'name':_0x3d52c6['name'],'paused':_0x3d52c6[_0x2628('0x50')],'waiting':_0x3d52c6[_0x2628('0x4e')]};_0x443456[_0x2628('0x20')](_0x29aacc);}}_0x3170fb({'count':_0x443456[_0x2628('0x16')],'rows':_0x443456});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x211b28){var _0x57d96a=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x55')]);_0x211b28({'count':_0x57d96a[_0x2628('0x16')],'rows':_0x57d96a});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1c3e42){var _0x7caf20=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x56')]);_0x1c3e42({'count':_0x7caf20[_0x2628('0x16')],'rows':_0x7caf20});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2dfe66){var _0x14387e=_[_0x2628('0x54')](_0x1081a4['openchannelQueuesWaitingInteractions']);_0x2dfe66({'count':_0x14387e[_0x2628('0x16')],'rows':_0x14387e});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4a6902){var _0x118d26=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x57')]);_0x4a6902({'count':_0x118d26[_0x2628('0x16')],'rows':_0x118d26});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4b5de9){var _0x50032b=_[_0x2628('0x54')](_0x1081a4[_0x2628('0x58')]);_0x4b5de9({'count':_0x50032b['length'],'rows':_0x50032b});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2b33d){var _0x4796fe=_['values'](_0x1081a4[_0x2628('0x59')]);_0x2b33d({'count':_0x4796fe[_0x2628('0x16')],'rows':_0x4796fe});});}};var _0x47f297=jayson[_0x2628('0x5a')](_0x2f59ca)['http']();_0x47f297['on']('error',function(_0xc9e57c){logger[_0x2628('0x33')](JSON[_0x2628('0x36')](_0xc9e57c));return _0x2395fe(_0xc9e57c);});_0x47f297[_0x2628('0x5b')](0x232c,_0x2628('0x5c'),function(){console[_0x2628('0x5d')](_0x2628('0x5e'),0x232c);return _0x4d2cfb(_0x2628('0x5f')+0x232c);});});}; \ No newline at end of file +var _0x99e9=['%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','mail','push','slice','dialogflow','appdata','split','dialogflowv2','tag','TagId','tvox','account','ContactId','body','%s:%s:%s','condition','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','intervals','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','info','agent','agents','busy','interaction','end','QueueReport','update','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format'];(function(_0x5d664f,_0x481f6b){var _0x45c3fe=function(_0x413796){while(--_0x413796){_0x5d664f['push'](_0x5d664f['shift']());}};_0x45c3fe(++_0x481f6b);}(_0x99e9,0xb4));var _0x999e=function(_0x529059,_0x294a33){_0x529059=_0x529059-0x0;var _0x156bc2=_0x99e9[_0x529059];return _0x156bc2;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var fs=require('fs');var jayson=require(_0x999e('0x2'));var BPromise=require(_0x999e('0x3'));var utils=require('./applications/utils');var logger=require(_0x999e('0x4'))(_0x999e('0x5'));var rpc={'openchannelQueueReport':require(_0x999e('0x6')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x999e('0x7')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x999e('0x8')),'whatsappQueueReport':require(_0x999e('0x9'))};var RuleEngine=require(_0x999e('0xa'));function getId(_0x18f337,_0x5c1c17,_0x46aeae){return util[_0x999e('0xb')](_0x999e('0xc'),_0x18f337,_0x5c1c17||0x0,_0x46aeae||0x0);}function getIntervals(_0x46f780,_0x2c38cf){var _0x175042=[];if(!_[_0x999e('0xd')](_0x2c38cf[_0x999e('0xe')])&&!_[_0x999e('0xd')](_0x46f780[_0x2c38cf[_0x999e('0xe')]])&&!_[_0x999e('0xd')](_0x46f780[_0x2c38cf[_0x999e('0xe')]][_0x999e('0xf')])){_0x175042=_[_0x999e('0x10')](_0x46f780[_0x2c38cf[_0x999e('0xe')]][_0x999e('0xf')],_0x999e('0x11'));}else if(!_['isNil'](_0x2c38cf[_0x999e('0x11')])){_0x175042=[_0x2c38cf['interval']];}return _0x175042;}exports[_0x999e('0x12')]=function(_0x387924){_0x387924[_0x999e('0x13')]={};return new BPromise(function(_0x538a92,_0x28bdd1){var _0x4d1716={'Start':function(_0xa44e4c){var _0x539598=this;return new Promise(function(_0x549ad4,_0x1eee64){if(_0xa44e4c){try{var _0x22feac=[];var _0x2dd5f4=getId(_0xa44e4c[_0x999e('0x14')],_0xa44e4c[_0x999e('0x15')]?_0xa44e4c[_0x999e('0x15')]['id']:0x0,_0xa44e4c['interaction']?_0xa44e4c['interaction']['id']:0x0);if(_0xa44e4c['applications']&&_[_0x999e('0x16')](_0xa44e4c[_0x999e('0x17')])&&_0xa44e4c[_0x999e('0x17')][_0x999e('0x18')]){for(var _0x229673=0x0;_0x229673<_0xa44e4c[_0x999e('0x17')]['length'];_0x229673+=0x1){var _0x5d86d4=_0xa44e4c[_0x999e('0x17')][_0x229673];if(fs[_0x999e('0x19')](path[_0x999e('0x1a')](__dirname,'applications',_0x5d86d4[_0x999e('0x1b')]+_0x999e('0x1c')))){var _0x3b73f0=[];switch(_0x5d86d4[_0x999e('0x1b')][_0x999e('0x1d')]()){case _0x999e('0x1e'):var _0x427bcf=_0x5d86d4['appdata']['split'](',');if(_0xa44e4c[_0x999e('0x14')]===_0x999e('0x1f')){_0x3b73f0['push'](_0x427bcf[0x0]);_0x3b73f0[_0x999e('0x20')](_0x427bcf[0x1]);_0x3b73f0[_0x999e('0x20')](_0x427bcf[_0x999e('0x21')](0x2,_0x427bcf[_0x999e('0x18')])[_0x999e('0x1a')](','));}else{_0x3b73f0[_0x999e('0x20')](_0x427bcf[0x0]);_0x3b73f0['push'](_0x427bcf[_0x999e('0x21')](0x1,_0x427bcf[_0x999e('0x18')])[_0x999e('0x1a')](','));}break;case _0x999e('0x22'):var _0x1b7adb=_0x5d86d4[_0x999e('0x23')][_0x999e('0x24')](',');_0x3b73f0['push'](_0x1b7adb[0x0]);_0x3b73f0[_0x999e('0x20')](_0x1b7adb[0x1]);_0x3b73f0['push'](_0x1b7adb['slice'](0x2,_0x1b7adb[_0x999e('0x18')])[_0x999e('0x1a')](','));break;case _0x999e('0x25'):var _0x555ca0=_0x5d86d4[_0x999e('0x23')][_0x999e('0x24')](',');_0x3b73f0[_0x999e('0x20')](_0x555ca0[0x0]);_0x3b73f0[_0x999e('0x20')](_0x555ca0[0x1]);_0x3b73f0[_0x999e('0x20')](_0x555ca0[0x2]);_0x3b73f0[_0x999e('0x20')](_0x555ca0[0x3]);_0x3b73f0[_0x999e('0x20')](_0x555ca0[_0x999e('0x21')](0x4,_0x555ca0[_0x999e('0x18')])[_0x999e('0x1a')](','));break;case'amazonlex':var _0x1c8feb=_0x5d86d4[_0x999e('0x23')][_0x999e('0x24')](',');_0x3b73f0['push'](_0x1c8feb[0x0]);_0x3b73f0[_0x999e('0x20')](_0x1c8feb[0x1]);_0x3b73f0['push'](_0x1c8feb[0x2]);_0x3b73f0['push'](_0x1c8feb[0x3]);_0x3b73f0[_0x999e('0x20')](_0x1c8feb[_0x999e('0x21')](0x4,_0x1c8feb['length'])['join'](','));break;case _0x999e('0x15'):_0x3b73f0[_0x999e('0x20')](_0x5d86d4[_0x999e('0x23')]);break;case _0x999e('0x26'):_0x3b73f0['push'](_0x5d86d4[_0x999e('0x27')]);_0x3b73f0[_0x999e('0x20')](_0x5d86d4[_0x999e('0x23')]);break;case _0x999e('0x28'):var _0x4f861f=utils['getMustacheRender'](_0xa44e4c[_0x999e('0x29')]['notificationTemplate'],_0xa44e4c);var _0xd7f2a9=_0x5d86d4[_0x999e('0x23')][_0x999e('0x24')](',');_0x3b73f0[_0x999e('0x20')](_0xd7f2a9[0x0]);_0x3b73f0['push'](_0xd7f2a9[0x1]);_0x3b73f0[_0x999e('0x20')](_0xd7f2a9[0x2]);_0x3b73f0[_0x999e('0x20')](_0xd7f2a9[0x3]);_0x3b73f0['push'](_0xd7f2a9[0x4]);_0x3b73f0['push'](_0xd7f2a9[0x5]);_0x3b73f0[_0x999e('0x20')](_0xd7f2a9[0x6]);_0x3b73f0['push'](_0xd7f2a9[0x7]);_0x3b73f0[_0x999e('0x20')](_0xd7f2a9[0x8]);_0x3b73f0['push'](_0xd7f2a9[0x9]);_0x3b73f0['push'](_0xd7f2a9[0xa]);_0x3b73f0['push'](_0xa44e4c['interaction']['id']);_0x3b73f0[_0x999e('0x20')](_0xa44e4c['message']['id']);_0x3b73f0[_0x999e('0x20')](_0x5d86d4['ChatWebsiteId']);_0x3b73f0['push'](_0xa44e4c['interaction'][_0x999e('0x2a')]);_0x3b73f0[_0x999e('0x20')](_0xa44e4c[_0x999e('0x2b')][_0x999e('0x2b')]);_0x3b73f0[_0x999e('0x20')](_0x4f861f);break;default:_0x3b73f0=_[_0x999e('0xd')](_0x5d86d4[_0x999e('0x23')])?[]:_0x5d86d4[_0x999e('0x23')]['split'](',');}var _0x3ff20a={'id':util[_0x999e('0xb')](_0x999e('0x2c'),_0x2dd5f4,_0x5d86d4['id'],_0x5d86d4[_0x999e('0x1b')]),'condition':require('./interval')[_0x999e('0x2d')](_0x2dd5f4,getIntervals(_0x387924['intervals'],_0x5d86d4),_0x387924),'consequence':require(_0x999e('0x2e')+_0x5d86d4[_0x999e('0x1b')])[_0x999e('0x2f')](_0x2dd5f4,_0x3b73f0,_0x387924,_0xa44e4c),'p':_0x5d86d4[_0x999e('0x30')]||0x0};logger['info'](_0x999e('0x31'),_0x3ff20a['id'],_0x999e('0x32'),getIntervals(_0x387924[_0x999e('0x33')],_0x5d86d4)['join']('\x20|\x20'));_0x22feac[_0x999e('0x20')](_0x3ff20a);}else{logger[_0x999e('0x34')](_0x999e('0x35'),path[_0x999e('0x1a')](__dirname,_0x999e('0x17'),_0x5d86d4[_0x999e('0x1b')]+_0x999e('0x1c')));}}_0x387924[_0x999e('0x13')][_0x2dd5f4]=new RuleEngine(_0x22feac);_0x387924[_0x999e('0x13')][_0x2dd5f4][_0x999e('0x36')](_0xa44e4c,function(_0x55da0b){logger['info'](_0x999e('0x37'),JSON[_0x999e('0x38')](_0x55da0b[_0x999e('0x39')]));if(_0x387924[_0x999e('0x13')][_0x2dd5f4]){_0x387924[_0x999e('0x13')][_0x2dd5f4][_0x999e('0x3a')]('complete');}});return _0x549ad4({'code':0xc8,'message':_0xa44e4c});}else{logger[_0x999e('0x3b')]('No\x20applications\x20to\x20execute');return _0x549ad4({'code':0xc8,'message':_0xa44e4c});}}catch(_0x4caf56){logger[_0x999e('0x34')](_0x4caf56['stack']);return _0x1eee64(_0x539598['error'](0x1f4,_0x4caf56));}}return _0x1eee64('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4f904e){var _0xc89b1=this;return new Promise(function(_0x2841f7,_0x5e50f5){if(_0x4f904e[_0x999e('0x3c')]&&_0x4f904e[_0x999e('0x3c')]['id']){if(_0x387924[_0x999e('0x3d')][_0x4f904e['agent']['id']]){_0x387924['agents'][_0x4f904e[_0x999e('0x3c')]['id']][_0x999e('0x3e')]=![];_0x387924[_0x999e('0x3d')][_0x4f904e['agent']['id']]['busyQueue']=undefined;}}if(_0x4f904e['message']&&_0x4f904e['message']['id']){try{var _0x8f1afa=getId(_0x4f904e['channel'],_0x4f904e['message']?_0x4f904e[_0x999e('0x15')]['id']:0x0,_0x4f904e[_0x999e('0x3f')]?_0x4f904e['interaction']['id']:0x0);if(_0x387924[_0x999e('0x13')][_0x8f1afa]){_0x387924[_0x999e('0x13')][_0x8f1afa]['emit'](_0x999e('0x40'));if(rpc[_0x4f904e['channel']+_0x999e('0x41')]){rpc[_0x4f904e[_0x999e('0x14')]+'QueueReport'][_0x999e('0x42')](_0x8f1afa,{'UserId':_0x4f904e[_0x999e('0x15')]['UserId']})['catch'](function(){logger[_0x999e('0x34')]('error\x20update\x20queue\x20report');});}}return _0x2841f7({'code':0xc8,'message':_0x4f904e});}catch(_0x5ebc95){logger['error'](_0x5ebc95[_0x999e('0x43')]);return _0x5e50f5(_0xc89b1[_0x999e('0x34')](0x1f4,_0x5ebc95));}}logger[_0x999e('0x34')](_0x999e('0x44'));return _0x5e50f5(_0xc89b1[_0x999e('0x34')](0x1f4,_0x999e('0x44')));});},'RejectMessage':function(_0x5b2645){var _0x14f8de=this;return new Promise(function(_0x2317c5,_0x4f1347){if(_0x5b2645[_0x999e('0x3c')]&&_0x5b2645[_0x999e('0x3c')]['id']){try{if(_0x387924[_0x999e('0x3d')][_0x5b2645[_0x999e('0x3c')]['id']]){_0x387924[_0x999e('0x3d')][_0x5b2645[_0x999e('0x3c')]['id']][_0x999e('0x3e')]=![];_0x387924[_0x999e('0x3d')][_0x5b2645[_0x999e('0x3c')]['id']]['busyQueue']=undefined;}return _0x2317c5({'code':0xc8,'message':_0x5b2645});}catch(_0x9f3f7a){logger[_0x999e('0x34')](_0x9f3f7a[_0x999e('0x43')]);return _0x4f1347(_0x14f8de[_0x999e('0x34')](0x1f4,_0x9f3f7a));}}logger['error'](_0x999e('0x44'));return _0x4f1347(_0x14f8de[_0x999e('0x34')](0x1f4,_0x999e('0x44')));});},'AbandonInteraction':function(_0x291b73){var _0x3e475b=this;return new Promise(function(_0xdb368f,_0x3f5790){if(_0x291b73[_0x999e('0x14')]&&_0x291b73['interaction']&&_0x291b73['interaction']['id']){try{var _0xd118f9=getId(_0x291b73[_0x999e('0x14')],_0x291b73[_0x999e('0x15')]?_0x291b73[_0x999e('0x15')]['id']:0x0,_0x291b73[_0x999e('0x3f')]?_0x291b73[_0x999e('0x3f')]['id']:0x0);if(_0x387924[_0x999e('0x13')][_0xd118f9]){_0x387924['rules'][_0xd118f9]['emit'](_0x999e('0x40'));}return _0xdb368f({'code':0xc8,'message':_0x291b73});}catch(_0x55ae5){logger[_0x999e('0x34')](_0x55ae5[_0x999e('0x43')]);return _0x3f5790(_0x3e475b[_0x999e('0x34')](0x1f4,_0x55ae5));}}logger['error'](_0x999e('0x44'));return _0x3f5790(_0x3e475b[_0x999e('0x34')](0x1f4,_0x999e('0x44')));});},'AgentCapacity':function(_0x3c8ecf){var _0x502c9=this;return new Promise(function(_0x434e13,_0x2b4bbe){if(_0x387924['agents'][_0x999e('0x45')](_0x3c8ecf['id'])){for(var _0x521b7a in _0x3c8ecf[_0x999e('0x46')]){if(_0x3c8ecf[_0x999e('0x46')][_0x999e('0x45')](_0x521b7a)){if(_0x387924[_0x999e('0x3d')][_0x3c8ecf['id']][_0x999e('0x45')](_0x521b7a+_0x999e('0x47'))){_0x387924['agents'][_0x3c8ecf['id']][_0x521b7a+_0x999e('0x47')]=parseInt(_0x3c8ecf[_0x999e('0x46')][_0x521b7a],0xa);}}}_0x387924[_0x999e('0x3d')][_0x3c8ecf['id']][_0x999e('0x48')]();return _0x434e13({'code':0xc8,'message':_0x387924[_0x999e('0x3d')][_0x3c8ecf['id']]});}else{return _0x2b4bbe(_0x502c9[_0x999e('0x34')](0x1f4,_0x999e('0x49')));}});},'Agents':function(_0x3d398c){return new Promise(function(_0x455b0e){var _0x7f9dfe=_[_0x999e('0x4a')](_0x387924[_0x999e('0x3d')]);if(_0x3d398c&&_0x3d398c['id']){var _0x77a387=_[_0x999e('0x4b')](_0x7f9dfe,function(_0x26aaeb){return _0x26aaeb['id']===_0x3d398c['id'];});_0x455b0e(_0x77a387);}else{_0x455b0e({'count':_0x7f9dfe['length'],'rows':_0x7f9dfe});}});},'ChatQueues':function(){return new Promise(function(_0x425639){var _0x157c1f=[];for(var _0x296d59 in _0x387924[_0x999e('0x4c')]){if(_0x387924['chatQueues']['hasOwnProperty'](_0x296d59)){var _0x21c8be=_0x387924[_0x999e('0x4c')][_0x296d59];var _0x67267d={'id':_0x21c8be['id'],'available':_0x21c8be[_0x999e('0x4d')],'loggedIn':_0x21c8be[_0x999e('0x4e')],'name':_0x21c8be[_0x999e('0x4f')],'paused':_0x21c8be[_0x999e('0x50')],'waiting':_0x21c8be[_0x999e('0x51')]};_0x157c1f[_0x999e('0x20')](_0x67267d);}}_0x425639({'count':_0x157c1f['length'],'rows':_0x157c1f});});},'MailQueues':function(){return new Promise(function(_0xe137c1){var _0x47c693=[];for(var _0x184b3e in _0x387924[_0x999e('0x52')]){if(_0x387924['mailQueues'][_0x999e('0x45')](_0x184b3e)){var _0x175904=_0x387924[_0x999e('0x52')][_0x184b3e];var _0xcbe77a={'id':_0x175904['id'],'available':_0x175904[_0x999e('0x4d')],'loggedIn':_0x175904['loggedIn'],'name':_0x175904[_0x999e('0x4f')],'paused':_0x175904[_0x999e('0x50')],'waiting':_0x175904['waiting']};_0x47c693['push'](_0xcbe77a);}}_0xe137c1({'count':_0x47c693['length'],'rows':_0x47c693});});},'OpenchannelQueues':function(){return new Promise(function(_0x43ec04){var _0x3f37e8=[];for(var _0x3432fd in _0x387924[_0x999e('0x53')]){if(_0x387924[_0x999e('0x53')]['hasOwnProperty'](_0x3432fd)){var _0x492a5a=_0x387924['openchannelQueues'][_0x3432fd];var _0x49293d={'id':_0x492a5a['id'],'available':_0x492a5a['available'],'loggedIn':_0x492a5a['loggedIn'],'name':_0x492a5a[_0x999e('0x4f')],'paused':_0x492a5a['paused'],'waiting':_0x492a5a[_0x999e('0x51')]};_0x3f37e8[_0x999e('0x20')](_0x49293d);}}_0x43ec04({'count':_0x3f37e8[_0x999e('0x18')],'rows':_0x3f37e8});});},'SmsQueues':function(){return new Promise(function(_0x5b8a0d){var _0x3ca455=[];for(var _0x3c2bce in _0x387924[_0x999e('0x54')]){if(_0x387924[_0x999e('0x54')][_0x999e('0x45')](_0x3c2bce)){var _0x129c3c=_0x387924[_0x999e('0x54')][_0x3c2bce];var _0x525800={'id':_0x129c3c['id'],'available':_0x129c3c[_0x999e('0x4d')],'loggedIn':_0x129c3c[_0x999e('0x4e')],'name':_0x129c3c[_0x999e('0x4f')],'paused':_0x129c3c['paused'],'waiting':_0x129c3c[_0x999e('0x51')]};_0x3ca455[_0x999e('0x20')](_0x525800);}}_0x5b8a0d({'count':_0x3ca455['length'],'rows':_0x3ca455});});},'FaxQueues':function(){return new Promise(function(_0x2f893b){var _0x67c96d=[];for(var _0x3a404d in _0x387924[_0x999e('0x55')]){if(_0x387924[_0x999e('0x55')][_0x999e('0x45')](_0x3a404d)){var _0x42f36f=_0x387924[_0x999e('0x55')][_0x3a404d];var _0x127812={'id':_0x42f36f['id'],'available':_0x42f36f['available'],'loggedIn':_0x42f36f[_0x999e('0x4e')],'name':_0x42f36f[_0x999e('0x4f')],'paused':_0x42f36f[_0x999e('0x50')],'waiting':_0x42f36f['waiting']};_0x67c96d[_0x999e('0x20')](_0x127812);}}_0x2f893b({'count':_0x67c96d['length'],'rows':_0x67c96d});});},'WhatsappQueues':function(){return new Promise(function(_0x14f13a){var _0x115be6=[];for(var _0x3a7596 in _0x387924['whatsappQueues']){if(_0x387924[_0x999e('0x56')][_0x999e('0x45')](_0x3a7596)){var _0x1d6b40=_0x387924[_0x999e('0x56')][_0x3a7596];var _0x436bc5={'id':_0x1d6b40['id'],'available':_0x1d6b40[_0x999e('0x4d')],'loggedIn':_0x1d6b40['loggedIn'],'name':_0x1d6b40[_0x999e('0x4f')],'paused':_0x1d6b40['paused'],'waiting':_0x1d6b40[_0x999e('0x51')]};_0x115be6['push'](_0x436bc5);}}_0x14f13a({'count':_0x115be6['length'],'rows':_0x115be6});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3ef0c0){var _0x5d136c=_[_0x999e('0x4a')](_0x387924[_0x999e('0x57')]);_0x3ef0c0({'count':_0x5d136c['length'],'rows':_0x5d136c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x15c83f){var _0x2d064e=_['values'](_0x387924[_0x999e('0x58')]);_0x15c83f({'count':_0x2d064e[_0x999e('0x18')],'rows':_0x2d064e});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x17a764){var _0x224242=_[_0x999e('0x4a')](_0x387924[_0x999e('0x59')]);_0x17a764({'count':_0x224242[_0x999e('0x18')],'rows':_0x224242});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x25b243){var _0x5cdf6d=_['values'](_0x387924[_0x999e('0x5a')]);_0x25b243({'count':_0x5cdf6d[_0x999e('0x18')],'rows':_0x5cdf6d});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x33acf9){var _0x1fad9f=_[_0x999e('0x4a')](_0x387924[_0x999e('0x5b')]);_0x33acf9({'count':_0x1fad9f['length'],'rows':_0x1fad9f});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x368336){var _0x19cb19=_['values'](_0x387924[_0x999e('0x5c')]);_0x368336({'count':_0x19cb19[_0x999e('0x18')],'rows':_0x19cb19});});}};var _0x40d407=jayson['server'](_0x4d1716)[_0x999e('0x5d')]();_0x40d407['on'](_0x999e('0x34'),function(_0x328c2d){logger['error'](JSON[_0x999e('0x38')](_0x328c2d));return _0x28bdd1(_0x328c2d);});_0x40d407[_0x999e('0x12')](0x232c,_0x999e('0x5e'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x538a92(_0x999e('0x5f')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 1105fad..3b24f0b 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 _0xfeea=['util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','then','error','message','result','catch','rules','info','length','push','Command','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','stop'];(function(_0x48abc7,_0xae7adb){var _0x1ed9f5=function(_0x40983a){while(--_0x40983a){_0x48abc7['push'](_0x48abc7['shift']());}};_0x1ed9f5(++_0xae7adb);}(_0xfeea,0x100));var _0xafee=function(_0xcd5a3d,_0x3c5b33){_0xcd5a3d=_0xcd5a3d-0x0;var _0xd43207=_0xfeea[_0xcd5a3d];return _0xd43207;};'use strict';var util=require(_0xafee('0x0'));var BPromise=require(_0xafee('0x1'));var jayson=require(_0xafee('0x2'));var _=require('lodash');var logger=require(_0xafee('0x3'))(_0xafee('0x4'));var client=jayson[_0xafee('0x5')][_0xafee('0x6')]({'port':0x232a});function request(_0x34b341,_0x3c5eab){return new BPromise(function(_0x21b169,_0x5ecd58){return client[_0xafee('0x7')](_0x34b341,_0x3c5eab)[_0xafee('0x8')](function(_0x463dcd){if(_0x463dcd['error']){return _0x5ecd58(_0x463dcd[_0xafee('0x9')][_0xafee('0xa')]);}else{return _0x21b169(_0x463dcd[_0xafee('0xb')]);}})[_0xafee('0xc')](function(_0x574396){return _0x5ecd58(_0x574396);});});}exports['condition']=function(_0x40bcde,_0x30b76c,_0x4ca88d){return function(_0x354dca){if(_0x4ca88d['rules']&&!_0x4ca88d[_0xafee('0xd')][_0x40bcde]){logger[_0xafee('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x40bcde);return _0x354dca['stop']();}var _0x92a50c=[];for(var _0x2fc185=0x0;_0x2fc185<_0x30b76c[_0xafee('0xf')];_0x2fc185+=0x1){_0x92a50c[_0xafee('0x10')](request(_0xafee('0x11'),{'command':util[_0xafee('0x12')](_0xafee('0x13'),_0x30b76c[_0x2fc185])})[_0xafee('0x8')](function(_0x2368b6){return _0x2368b6&&_0x2368b6[_0xafee('0xa')]&&_0x2368b6[_0xafee('0xa')][_0xafee('0x14')](_0xafee('0x15'))>=0x0?!![]:![];})[_0xafee('0xc')](function(_0x443033){logger[_0xafee('0x9')](_0xafee('0x16'),_0x40bcde,_0x30b76c[_0x2fc185]);}));}BPromise[_0xafee('0x17')](_0x92a50c)[_0xafee('0x8')](function(_0x5e78be){var _0x45d3fc=_[_0xafee('0x18')](_0x5e78be);logger[_0xafee('0xe')](_0xafee('0x19'),_0x40bcde,_0x30b76c['join'](_0xafee('0x1a')),_0x45d3fc);_0x354dca[_0xafee('0x1b')](_0x45d3fc);})['catch'](function(_0xf7946b){console[_0xafee('0x1c')](_0xf7946b);logger[_0xafee('0x9')](_0xafee('0x19'),_0x40bcde,_0x30b76c[_0xafee('0x1d')](_0xafee('0x1a')),_0xf7946b[_0xafee('0x1e')]);_0x354dca[_0xafee('0x1f')]();});};}; \ No newline at end of file +var _0x29e3=['Command','iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','log','stack','util','bluebird','lodash','../../../config/logger','client','request','then','error','message','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push'];(function(_0x29279c,_0x570176){var _0x279b1f=function(_0xd36d1f){while(--_0xd36d1f){_0x29279c['push'](_0x29279c['shift']());}};_0x279b1f(++_0x570176);}(_0x29e3,0x124));var _0x329e=function(_0x32d25a,_0x559790){_0x32d25a=_0x32d25a-0x0;var _0x316a8d=_0x29e3[_0x32d25a];return _0x316a8d;};'use strict';var util=require(_0x329e('0x0'));var BPromise=require(_0x329e('0x1'));var jayson=require('jayson/promise');var _=require(_0x329e('0x2'));var logger=require(_0x329e('0x3'))('routing');var client=jayson[_0x329e('0x4')]['http']({'port':0x232a});function request(_0x13ead9,_0x1c5f70){return new BPromise(function(_0x11933f,_0x4e65a5){return client[_0x329e('0x5')](_0x13ead9,_0x1c5f70)[_0x329e('0x6')](function(_0x4cb561){if(_0x4cb561[_0x329e('0x7')]){return _0x4e65a5(_0x4cb561[_0x329e('0x7')][_0x329e('0x8')]);}else{return _0x11933f(_0x4cb561['result']);}})[_0x329e('0x9')](function(_0xa3497d){return _0x4e65a5(_0xa3497d);});});}exports[_0x329e('0xa')]=function(_0x39502d,_0x2e2282,_0x2b2147){return function(_0x344639){if(_0x2b2147[_0x329e('0xb')]&&!_0x2b2147[_0x329e('0xb')][_0x39502d]){logger['info'](_0x329e('0xc'),_0x39502d);return _0x344639[_0x329e('0xd')]();}var _0x1e2459=[];for(var _0x4508c6=0x0;_0x4508c6<_0x2e2282[_0x329e('0xe')];_0x4508c6+=0x1){_0x1e2459[_0x329e('0xf')](request(_0x329e('0x10'),{'command':util['format'](_0x329e('0x11'),_0x2e2282[_0x4508c6])})[_0x329e('0x6')](function(_0x2f7706){return _0x2f7706&&_0x2f7706[_0x329e('0x8')]&&_0x2f7706[_0x329e('0x8')][_0x329e('0x12')]('true')>=0x0?!![]:![];})[_0x329e('0x9')](function(_0x1173dd){logger[_0x329e('0x7')](_0x329e('0x13'),_0x39502d,_0x2e2282[_0x4508c6]);}));}BPromise[_0x329e('0x14')](_0x1e2459)['then'](function(_0x863b09){var _0x324ce3=_[_0x329e('0x15')](_0x863b09);logger[_0x329e('0x16')](_0x329e('0x17'),_0x39502d,_0x2e2282[_0x329e('0x18')](_0x329e('0x19')),_0x324ce3);_0x344639['when'](_0x324ce3);})[_0x329e('0x9')](function(_0x577cff){console[_0x329e('0x1a')](_0x577cff);logger['error'](_0x329e('0x17'),_0x39502d,_0x2e2282[_0x329e('0x18')](_0x329e('0x19')),_0x577cff[_0x329e('0x1b')]);_0x344639[_0x329e('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 3d68ea0..f56659b 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 _0x76dc=['origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','agent','complete','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','./utils','info','format','uniqueid','membername','interface','calleridnum','queue','getVoiceQueueByName','type','agentcomplete','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','now','lastevent','called','connectedlinenum','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','talktime','queuecallerabandon','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheremembername','isNil','agentcompleteAt','diffTime','agentconnectAt','[%s][agents][agentcomplete]','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid'];(function(_0xbc13e1,_0x14d88b){var _0xa87f5a=function(_0x11ea58){while(--_0x11ea58){_0xbc13e1['push'](_0xbc13e1['shift']());}};_0xa87f5a(++_0x14d88b);}(_0x76dc,0x1f2));var _0xc76d=function(_0x30b63a,_0x226768){_0x30b63a=_0x30b63a-0x0;var _0x58e99e=_0x76dc[_0x30b63a];return _0x58e99e;};'use strict';var _=require(_0xc76d('0x0'));var util=require(_0xc76d('0x1'));var utils=require(_0xc76d('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x26e85e,_0x49c651){utils[_0xc76d('0x3')](util[_0xc76d('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x26e85e[_0xc76d('0x5')],_0x26e85e['channel'],_0x26e85e['queue'],_0x26e85e[_0xc76d('0x6')],_0x26e85e[_0xc76d('0x7')],_0x26e85e[_0xc76d('0x8')],_0x26e85e['connectedlinenum'],_0x26e85e['lastevent']));if(_0x26e85e[_0xc76d('0x9')]){utils[_0xc76d('0xa')](_0x26e85e[_0xc76d('0x9')])['then'](function(_0x570197){if(_0x570197){_0x26e85e[_0xc76d('0xb')]=_0x570197[_0xc76d('0xb')];_0x26e85e['agentacw']=_0x26e85e[_0xc76d('0xc')]?_0x570197['acw']:![];_0x26e85e[_0xc76d('0xd')]=_0x26e85e[_0xc76d('0xe')]?_0x570197[_0xc76d('0xf')]:0x0;}utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);});}else{utils[_0xc76d('0x10')](_0xc76d('0x11'),_0x26e85e);}if(_0x49c651){delete transfers[_0x26e85e[_0xc76d('0x5')]];}else{delete agents[_0x26e85e[_0xc76d('0x12')]];}}exports[_0xc76d('0x13')]=function(_0x1a7b47){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x1a7b47);agents[_0x1a7b47[_0xc76d('0x12')]]=_0x1a7b47;agents[_0x1a7b47[_0xc76d('0x12')]]['agentcalledAt']=utils[_0xc76d('0x16')]();agents[_0x1a7b47[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x18');agents[_0x1a7b47['destuniqueid']][_0xc76d('0x19')]=null;agents[_0x1a7b47['destuniqueid']]['connectedlinename']=null;utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1a'),_0x1a7b47[_0xc76d('0x5')],agents[_0x1a7b47[_0xc76d('0x12')]]['membername'],_0x1a7b47[_0xc76d('0x12')]));}catch(_0x361f42){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x15'),_0x1a7b47['uniqueid']),_0x361f42);}};exports[_0xc76d('0x1c')]=function(_0x324db7){try{if(!_['isNil'](agents[_0x324db7[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x1d'),_0x324db7[_0xc76d('0x5')]),_0x324db7);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x1e'),_0x324db7[_0xc76d('0x5')],agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x6')],_0x324db7['destuniqueid']));agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x1c')]=!![];agents[_0x324db7['destuniqueid']][_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();agents[_0x324db7['destuniqueid']][_0xc76d('0x17')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x21')]=_0xc76d('0x20');agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x22')]=_0x324db7['ringtime']?parseInt(_0x324db7['ringtime'])/0x3e8:0x0;agents[_0x324db7[_0xc76d('0x12')]][_0xc76d('0x23')]=0x0;unanswered['push'](_0x324db7[_0xc76d('0x12')]);}}catch(_0x52a79a){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x1d'),_0x324db7['uniqueid']),_0x52a79a);}};exports[_0xc76d('0x24')]=function(_0x18a7fa){try{_['forIn'](agents,function(_0x3d4076,_0x1c68f3){if(_0x3d4076[_0xc76d('0x5')]==_0x18a7fa[_0xc76d('0x5')]&&!_['includes'](unanswered,_0x3d4076[_0xc76d('0x12')])){utils['debug'](util[_0xc76d('0x4')]('[%s][agents][queuecallerabandon]',_0x18a7fa[_0xc76d('0x5')]),_0x18a7fa);utils[_0xc76d('0x3')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x18a7fa['uniqueid'],_0x3d4076['membername'],_0x3d4076[_0xc76d('0x12')]));_0x3d4076[_0xc76d('0x1c')]=!![];_0x3d4076[_0xc76d('0x1f')]=utils[_0xc76d('0x16')]();_0x3d4076[_0xc76d('0x17')]='abandoned';_0x3d4076[_0xc76d('0x21')]='abandoned';_0x3d4076[_0xc76d('0x22')]=_0x18a7fa['holdtime'];_0x3d4076[_0xc76d('0x23')]=0x0;writeDB(_0x3d4076);}});}catch(_0x2332f5){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x25'),_0x18a7fa['uniqueid']),_0x2332f5);}};exports[_0xc76d('0x26')]=function(_0x371306){try{if(agents[_0x371306[_0xc76d('0x12')]]){utils['debug'](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x371306);utils['info'](util[_0xc76d('0x4')](_0xc76d('0x28'),_0x371306[_0xc76d('0x5')],agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x6')],_0x371306[_0xc76d('0x12')]));agents[_0x371306['destuniqueid']]['agentconnectAt']=utils[_0xc76d('0x16')]();agents[_0x371306['destuniqueid']][_0xc76d('0x19')]=_0x371306[_0xc76d('0x19')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x29')]=_0x371306['connectedlinename'];agents[_0x371306['destuniqueid']][_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];agents[_0x371306[_0xc76d('0x12')]][_0xc76d('0x17')]=_0xc76d('0x2b');_['forIn'](agents,function(_0x42404c,_0xb264b0){if(_0x42404c[_0xc76d('0x12')]!=_0x371306[_0xc76d('0x12')]&&_0x42404c[_0xc76d('0x5')]==_0x371306[_0xc76d('0x5')]){_0x42404c[_0xc76d('0x23')]=0x0;_0x42404c[_0xc76d('0x22')]=_0x371306[_0xc76d('0x2a')];_0x42404c[_0xc76d('0x1c')]=!![];_0x42404c['agentringnoanswerAt']=utils['now']();_0x42404c[_0xc76d('0x17')]=_0xc76d('0x2c');_0x42404c[_0xc76d('0x21')]=_0xc76d('0x2c');_0x42404c['answeredelsewheredestinationuniqueid']=_0x371306['destuniqueid'];_0x42404c[_0xc76d('0x2d')]=_0x371306[_0xc76d('0x6')];writeDB(_0x42404c);}});}}catch(_0x3e471e){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x27'),_0x371306[_0xc76d('0x5')]),_0x3e471e);}};exports[_0xc76d('0xc')]=function(_0x50e922){try{if(!_[_0xc76d('0x2e')](agents[_0x50e922[_0xc76d('0x12')]])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][agentcomplete]',_0x50e922['uniqueid']),_0x50e922);utils['info'](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x50e922['uniqueid'],agents[_0x50e922['destuniqueid']][_0xc76d('0x6')],_0x50e922[_0xc76d('0x12')]));agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0xc')]=!![];agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0x50e922[_0xc76d('0x12')]]['talktime']=utils[_0xc76d('0x30')](agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x2f')],agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x31')]);agents[_0x50e922[_0xc76d('0x12')]][_0xc76d('0x21')]=_0x50e922[_0xc76d('0x21')];agents[_0x50e922[_0xc76d('0x12')]]['lastevent']='complete';writeDB(agents[_0x50e922[_0xc76d('0x12')]]);}}catch(_0x170f47){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x32'),_0x50e922['uniqueid']),_0x170f47);}};exports[_0xc76d('0x33')]=function(_0x1ede13){try{if(!_['isNil'](agents[_0x1ede13['transfereruniqueid']])){utils[_0xc76d('0x14')](util[_0xc76d('0x4')]('[%s][agents][blindtransfer]',_0x1ede13[_0xc76d('0x5')]),_0x1ede13);utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x34'),_0x1ede13[_0xc76d('0x5')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x6')],agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x5')]));agents[_0x1ede13[_0xc76d('0x35')]]['transfer']=!![];agents[_0x1ede13[_0xc76d('0x35')]][_0xc76d('0x36')]=_0xc76d('0x37');agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x38')]=_0x1ede13[_0xc76d('0x39')];agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x3a')]=agents[_0x1ede13['transfereruniqueid']][_0xc76d('0x5')];}}catch(_0x12c972){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')](_0xc76d('0x3b'),_0x1ede13['uniqueid']),_0x12c972);}};exports['attendedtransfer']=function(_0x5bec6c){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x3c'),_0x5bec6c[_0xc76d('0x3d')]),_0x5bec6c);if(_0x5bec6c[_0xc76d('0x3d')]==_0x5bec6c[_0xc76d('0x3e')]){if(!_['isNil'](agents[_0x5bec6c[_0xc76d('0x3f')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x6')]));agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x41')]=!![];agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x36')]=_0xc76d('0x42');agents[_0x5bec6c['secondtransfereruniqueid']][_0xc76d('0x38')]=_0x5bec6c[_0xc76d('0x43')];agents[_0x5bec6c['secondtransfereruniqueid']]['transferuniqueid']=_0x5bec6c[_0xc76d('0x3d')];}if(_0x5bec6c['transfereeuniqueid']&&agents[_0x5bec6c[_0xc76d('0x44')]]){agents[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x45')]=0x1;transfers[_0x5bec6c[_0xc76d('0x44')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x44')]]);transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x8')];transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x47')]=agents[_0x5bec6c[_0xc76d('0x3f')]][_0xc76d('0x47')];transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x44')]][_0xc76d('0x31')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c['transfereeuniqueid']][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x44')]]['agententerreason']=0x2;}}else if(_0x5bec6c['secondtransfereruniqueid']==_0x5bec6c['secondtransfererlinkedid']){if(!_[_0xc76d('0x2e')](agents[_0x5bec6c[_0xc76d('0x3d')]])){utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x40'),_0x5bec6c[_0xc76d('0x3d')],agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x6')]));agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x41')]=!![];agents[_0x5bec6c['origtransfereruniqueid']]['transfertype']=_0xc76d('0x42');agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x38')]=_0x5bec6c['secondtransfererexten'];agents[_0x5bec6c[_0xc76d('0x3d')]]['transferuniqueid']=_0x5bec6c['secondtransfereruniqueid'];}if(_0x5bec6c['transfertargetuniqueid']&&agents[_0x5bec6c[_0xc76d('0x49')]]){agents[_0x5bec6c[_0xc76d('0x49')]]['agententerreason']=0x1;transfers[_0x5bec6c[_0xc76d('0x49')]]=_[_0xc76d('0x46')](agents[_0x5bec6c[_0xc76d('0x49')]]);transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x8')]=agents[_0x5bec6c[_0xc76d('0x3d')]][_0xc76d('0x8')];transfers[_0x5bec6c['transfertargetuniqueid']]['calleridname']=agents[_0x5bec6c['origtransfereruniqueid']][_0xc76d('0x47')];transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x48')]=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]]['agentconnectAt']=utils[_0xc76d('0x16')]();transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x22')]=0x0;transfers[_0x5bec6c[_0xc76d('0x49')]][_0xc76d('0x45')]=0x2;}}}catch(_0x2af760){utils[_0xc76d('0x1b')](util[_0xc76d('0x4')]('[%s][agents][attendedtransfer]',_0x5bec6c[_0xc76d('0x3d')]),_0x2af760);}};exports['hangup']=function(_0xa9f2e8){try{utils[_0xc76d('0x14')](util[_0xc76d('0x4')](_0xc76d('0x4a'),_0xa9f2e8['uniqueid']),_0xa9f2e8);if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8['uniqueid']]['reason']===_0xc76d('0x20')){if(_0xa9f2e8[_0xc76d('0x4b')]==='21'){agents[_0xa9f2e8['uniqueid']][_0xc76d('0x21')]=_0xc76d('0x4c');agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]=_0xc76d('0x4c');}utils['info'](util[_0xc76d('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]]['membername'],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8['uniqueid']][_0xc76d('0x17')]));writeDB(agents[_0xa9f2e8[_0xc76d('0x5')]]);var _0x277382=unanswered['indexOf'](_0xa9f2e8[_0xc76d('0x5')]);if(_0x277382>-0x1){unanswered['splice'](_0x277382,0x1);}}if(transfers[_0xa9f2e8['uniqueid']]){transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];transfers[_0xa9f2e8['uniqueid']][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=_0xc76d('0x4d');transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]=_0xc76d('0x4e');utils[_0xc76d('0x3')](util[_0xc76d('0x4')](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],transfers[_0xa9f2e8[_0xc76d('0x5')]]['membername'],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],transfers[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x17')]));writeDB(transfers[_0xa9f2e8[_0xc76d('0x5')]],!![]);}if(agents[_0xa9f2e8[_0xc76d('0x5')]]&&agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]){agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0xc')]=!![];agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')]=utils[_0xc76d('0x16')]();agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x23')]=utils[_0xc76d('0x30')](agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x2f')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x31')]);agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')]=agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x41')]?'transfer':_0xc76d('0x4d');agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']=_0xc76d('0x4e');utils[_0xc76d('0x3')](util['format'](_0xc76d('0x4f'),_0xa9f2e8[_0xc76d('0x5')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x6')],agents[_0xa9f2e8[_0xc76d('0x5')]][_0xc76d('0x21')],agents[_0xa9f2e8[_0xc76d('0x5')]]['lastevent']));writeDB(agents[_0xa9f2e8['uniqueid']]);}}catch(_0xe6a1dc){utils[_0xc76d('0x1b')](util['format'](_0xc76d('0x4a'),_0xa9f2e8[_0xc76d('0x5')]),_0xe6a1dc);}}; \ No newline at end of file +var _0xb9a7=['connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','[%s][agents][blindtransfer]','transfereruniqueid','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','ATTENDED','transfereeuniqueid','calleridname','agententerreason','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','format','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','talktime','queuecallerabandon','forIn','includes','agentringnoanswerAt','abandoned','holdtime','[%s][agents][queuecallerabandon]','agentconnect','agentconnectAt','connectedlinename'];(function(_0x2b817f,_0x31f43b){var _0x4d19f0=function(_0x114c34){while(--_0x114c34){_0x2b817f['push'](_0x2b817f['shift']());}};_0x4d19f0(++_0x31f43b);}(_0xb9a7,0x112));var _0x7b9a=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xb9a7[_0x35885a];return _0xe86249;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x563857,_0x5f1a52){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x2'),_0x563857[_0x7b9a('0x3')],_0x563857[_0x7b9a('0x4')],_0x563857[_0x7b9a('0x5')],_0x563857[_0x7b9a('0x6')],_0x563857[_0x7b9a('0x7')],_0x563857[_0x7b9a('0x8')],_0x563857[_0x7b9a('0x9')],_0x563857[_0x7b9a('0xa')]));if(_0x563857[_0x7b9a('0x5')]){utils['getVoiceQueueByName'](_0x563857[_0x7b9a('0x5')])[_0x7b9a('0xb')](function(_0x56a199){if(_0x56a199){_0x563857['type']=_0x56a199['type'];_0x563857[_0x7b9a('0xc')]=_0x563857[_0x7b9a('0xd')]?_0x56a199['acw']:![];_0x563857[_0x7b9a('0xe')]=_0x563857['agentacw']?_0x56a199[_0x7b9a('0xf')]:0x0;}utils['request'](_0x7b9a('0x10'),_0x563857);});}else{utils[_0x7b9a('0x11')](_0x7b9a('0x10'),_0x563857);}if(_0x5f1a52){delete transfers[_0x563857['uniqueid']];}else{delete agents[_0x563857[_0x7b9a('0x12')]];}}exports[_0x7b9a('0x13')]=function(_0x5e3875){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentcalled]',_0x5e3875[_0x7b9a('0x3')]),_0x5e3875);agents[_0x5e3875[_0x7b9a('0x12')]]=_0x5e3875;agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x18');agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinenum']=null;agents[_0x5e3875[_0x7b9a('0x12')]]['connectedlinename']=null;utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x19'),_0x5e3875[_0x7b9a('0x3')],agents[_0x5e3875[_0x7b9a('0x12')]][_0x7b9a('0x6')],_0x5e3875[_0x7b9a('0x12')]));}catch(_0x283cc3){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x1b'),_0x5e3875[_0x7b9a('0x3')]),_0x283cc3);}};exports[_0x7b9a('0x1c')]=function(_0x58aed7){try{if(!_[_0x7b9a('0x1d')](agents[_0x58aed7['destuniqueid']])){utils[_0x7b9a('0x14')](util['format'](_0x7b9a('0x1e'),_0x58aed7[_0x7b9a('0x3')]),_0x58aed7);utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x1f'),_0x58aed7[_0x7b9a('0x3')],agents[_0x58aed7['destuniqueid']][_0x7b9a('0x6')],_0x58aed7[_0x7b9a('0x12')]));agents[_0x58aed7[_0x7b9a('0x12')]][_0x7b9a('0x1c')]=!![];agents[_0x58aed7[_0x7b9a('0x12')]]['agentringnoanswerAt']=utils[_0x7b9a('0x17')]();agents[_0x58aed7[_0x7b9a('0x12')]]['lastevent']=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']][_0x7b9a('0x21')]=_0x7b9a('0x20');agents[_0x58aed7['destuniqueid']]['holdtime']=_0x58aed7[_0x7b9a('0x22')]?parseInt(_0x58aed7['ringtime'])/0x3e8:0x0;agents[_0x58aed7['destuniqueid']][_0x7b9a('0x23')]=0x0;unanswered['push'](_0x58aed7['destuniqueid']);}}catch(_0x3847b4){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x1e'),_0x58aed7['uniqueid']),_0x3847b4);}};exports[_0x7b9a('0x24')]=function(_0x2e6144){try{_[_0x7b9a('0x25')](agents,function(_0x5b64d7,_0x45ccf5){if(_0x5b64d7[_0x7b9a('0x3')]==_0x2e6144[_0x7b9a('0x3')]&&!_[_0x7b9a('0x26')](unanswered,_0x5b64d7[_0x7b9a('0x12')])){utils[_0x7b9a('0x14')](util['format']('[%s][agents][queuecallerabandon]',_0x2e6144[_0x7b9a('0x3')]),_0x2e6144);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2e6144[_0x7b9a('0x3')],_0x5b64d7[_0x7b9a('0x6')],_0x5b64d7['destuniqueid']));_0x5b64d7['agentringnoanswer']=!![];_0x5b64d7[_0x7b9a('0x27')]=utils[_0x7b9a('0x17')]();_0x5b64d7['lastevent']=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x21')]=_0x7b9a('0x28');_0x5b64d7[_0x7b9a('0x29')]=_0x2e6144[_0x7b9a('0x29')];_0x5b64d7['talktime']=0x0;writeDB(_0x5b64d7);}});}catch(_0x46bcd0){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x2a'),_0x2e6144[_0x7b9a('0x3')]),_0x46bcd0);}};exports[_0x7b9a('0x2b')]=function(_0x5f1da4){try{if(agents[_0x5f1da4['destuniqueid']]){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]',_0x5f1da4[_0x7b9a('0x3')]),_0x5f1da4);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x5f1da4[_0x7b9a('0x3')],agents[_0x5f1da4[_0x7b9a('0x12')]]['membername'],_0x5f1da4['destuniqueid']));agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2c')]=utils[_0x7b9a('0x17')]();agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x9')]=_0x5f1da4[_0x7b9a('0x9')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0x2d')]=_0x5f1da4['connectedlinename'];agents[_0x5f1da4[_0x7b9a('0x12')]]['holdtime']=_0x5f1da4[_0x7b9a('0x22')];agents[_0x5f1da4[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x2e');_[_0x7b9a('0x25')](agents,function(_0x89951b,_0x5e504f){if(_0x89951b[_0x7b9a('0x12')]!=_0x5f1da4[_0x7b9a('0x12')]&&_0x89951b[_0x7b9a('0x3')]==_0x5f1da4[_0x7b9a('0x3')]){_0x89951b['talktime']=0x0;_0x89951b[_0x7b9a('0x29')]=_0x5f1da4[_0x7b9a('0x22')];_0x89951b[_0x7b9a('0x1c')]=!![];_0x89951b[_0x7b9a('0x27')]=utils['now']();_0x89951b[_0x7b9a('0xa')]='answered_elsewhere';_0x89951b[_0x7b9a('0x21')]=_0x7b9a('0x2f');_0x89951b[_0x7b9a('0x30')]=_0x5f1da4[_0x7b9a('0x12')];_0x89951b[_0x7b9a('0x31')]=_0x5f1da4[_0x7b9a('0x6')];writeDB(_0x89951b);}});}}catch(_0x56e274){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x32'),_0x5f1da4['uniqueid']),_0x56e274);}};exports['agentcomplete']=function(_0x3724fe){try{if(!_[_0x7b9a('0x1d')](agents[_0x3724fe[_0x7b9a('0x12')]])){utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe['uniqueid']),_0x3724fe);utils['info'](util['format'](_0x7b9a('0x34'),_0x3724fe[_0x7b9a('0x3')],agents[_0x3724fe['destuniqueid']][_0x7b9a('0x6')],_0x3724fe[_0x7b9a('0x12')]));agents[_0x3724fe[_0x7b9a('0x12')]]['agentcomplete']=!![];agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt']=utils[_0x7b9a('0x17')]();agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](agents[_0x3724fe[_0x7b9a('0x12')]]['agentcompleteAt'],agents[_0x3724fe[_0x7b9a('0x12')]]['agentconnectAt']);agents[_0x3724fe[_0x7b9a('0x12')]]['reason']=_0x3724fe['reason'];agents[_0x3724fe[_0x7b9a('0x12')]][_0x7b9a('0xa')]=_0x7b9a('0x36');writeDB(agents[_0x3724fe[_0x7b9a('0x12')]]);}}catch(_0x1cbd5a){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')](_0x7b9a('0x33'),_0x3724fe[_0x7b9a('0x3')]),_0x1cbd5a);}};exports['blindtransfer']=function(_0x1d7957){try{if(!_[_0x7b9a('0x1d')](agents[_0x1d7957['transfereruniqueid']])){utils['debug'](util['format'](_0x7b9a('0x37'),_0x1d7957[_0x7b9a('0x3')]),_0x1d7957);utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1d7957[_0x7b9a('0x3')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x6')],agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')]));agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x39')]=!![];agents[_0x1d7957['transfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x3b');agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3c')]=_0x1d7957['extension'];agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3d')]=agents[_0x1d7957[_0x7b9a('0x38')]][_0x7b9a('0x3')];}}catch(_0x2b0db5){utils[_0x7b9a('0x1a')](util[_0x7b9a('0x15')]('[%s][agents][blindtransfer]',_0x1d7957['uniqueid']),_0x2b0db5);}};exports['attendedtransfer']=function(_0x12c5bf){try{utils[_0x7b9a('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf['origtransfereruniqueid']),_0x12c5bf);if(_0x12c5bf['origtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x3e')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf[_0x7b9a('0x3f')]])){utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x40'),_0x12c5bf[_0x7b9a('0x41')],agents[_0x12c5bf[_0x7b9a('0x3f')]]['membername']));agents[_0x12c5bf[_0x7b9a('0x3f')]]['transfer']=!![];agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x3c')]=_0x12c5bf['origtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x3f')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x41')];}if(_0x12c5bf[_0x7b9a('0x43')]&&agents[_0x12c5bf[_0x7b9a('0x43')]]){agents[_0x12c5bf['transfereeuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfereeuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x43')]]);transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x8')]=agents[_0x12c5bf['secondtransfereruniqueid']][_0x7b9a('0x8')];transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x44')]=agents[_0x12c5bf[_0x7b9a('0x3f')]][_0x7b9a('0x44')];transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x16')]=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x43')]]['agentconnectAt']=utils['now']();transfers[_0x12c5bf['transfereeuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x43')]][_0x7b9a('0x45')]=0x2;}}else if(_0x12c5bf['secondtransfereruniqueid']==_0x12c5bf[_0x7b9a('0x46')]){if(!_[_0x7b9a('0x1d')](agents[_0x12c5bf['origtransfereruniqueid']])){utils[_0x7b9a('0x1')](util['format'](_0x7b9a('0x40'),_0x12c5bf['origtransfereruniqueid'],agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x6')]));agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x39')]=!![];agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x3a')]=_0x7b9a('0x42');agents[_0x12c5bf[_0x7b9a('0x41')]][_0x7b9a('0x3c')]=_0x12c5bf['secondtransfererexten'];agents[_0x12c5bf[_0x7b9a('0x41')]]['transferuniqueid']=_0x12c5bf[_0x7b9a('0x3f')];}if(_0x12c5bf['transfertargetuniqueid']&&agents[_0x12c5bf[_0x7b9a('0x47')]]){agents[_0x12c5bf['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x12c5bf['transfertargetuniqueid']]=_['clone'](agents[_0x12c5bf[_0x7b9a('0x47')]]);transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x8')]=agents[_0x12c5bf[_0x7b9a('0x41')]]['calleridnum'];transfers[_0x12c5bf[_0x7b9a('0x47')]]['calleridname']=agents[_0x12c5bf['origtransfereruniqueid']][_0x7b9a('0x44')];transfers[_0x12c5bf['transfertargetuniqueid']]['agentcalledAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf[_0x7b9a('0x47')]]['agentconnectAt']=utils[_0x7b9a('0x17')]();transfers[_0x12c5bf['transfertargetuniqueid']][_0x7b9a('0x29')]=0x0;transfers[_0x12c5bf[_0x7b9a('0x47')]][_0x7b9a('0x45')]=0x2;}}}catch(_0x5118b3){utils['error'](util['format']('[%s][agents][attendedtransfer]',_0x12c5bf[_0x7b9a('0x41')]),_0x5118b3);}};exports[_0x7b9a('0x48')]=function(_0x3fd697){try{utils[_0x7b9a('0x14')](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3fd697);if(agents[_0x3fd697['uniqueid']]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]==='timeout'){if(_0x3fd697[_0x7b9a('0x4a')]==='21'){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='rejected';agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x4b');}utils['info'](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x21')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);var _0x2090ef=unanswered['indexOf'](_0x3fd697['uniqueid']);if(_0x2090ef>-0x1){unanswered[_0x7b9a('0x4c')](_0x2090ef,0x1);}}if(transfers[_0x3fd697[_0x7b9a('0x3')]]){transfers[_0x3fd697['uniqueid']][_0x7b9a('0xd')]=!![];transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')]=utils['now']();transfers[_0x3fd697['uniqueid']][_0x7b9a('0x23')]=utils[_0x7b9a('0x35')](transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],transfers[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]='agent';transfers[_0x3fd697['uniqueid']][_0x7b9a('0xa')]=_0x7b9a('0x36');utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3fd697[_0x7b9a('0x3')],transfers[_0x3fd697[_0x7b9a('0x3')]]['membername'],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],transfers[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]));writeDB(transfers[_0x3fd697[_0x7b9a('0x3')]],!![]);}if(agents[_0x3fd697[_0x7b9a('0x3')]]&&agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x2c')]){agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xd')]=!![];agents[_0x3fd697[_0x7b9a('0x3')]]['agentcompleteAt']=utils['now']();agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x23')]=utils['diffTime'](agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x4d')],agents[_0x3fd697['uniqueid']][_0x7b9a('0x2c')]);agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')]=agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x39')]?_0x7b9a('0x39'):_0x7b9a('0x4e');agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0xa')]='complete';utils[_0x7b9a('0x1')](util[_0x7b9a('0x15')](_0x7b9a('0x4f'),_0x3fd697[_0x7b9a('0x3')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x6')],agents[_0x3fd697[_0x7b9a('0x3')]][_0x7b9a('0x21')],agents[_0x3fd697['uniqueid']][_0x7b9a('0xa')]));writeDB(agents[_0x3fd697[_0x7b9a('0x3')]]);}}catch(_0x3022e0){utils['error'](util[_0x7b9a('0x15')](_0x7b9a('0x49'),_0x3fd697[_0x7b9a('0x3')]),_0x3022e0);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index bd4cd70..4eaeaf1 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 _0x6fad=['source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','application','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','context','exten','calleridnum','DOCUMENTATION','error','isNil','channelstate','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','[%s][calls][newstate]','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value'];(function(_0x4a9d48,_0x207610){var _0x566843=function(_0x8d3a15){while(--_0x8d3a15){_0x4a9d48['push'](_0x4a9d48['shift']());}};_0x566843(++_0x207610);}(_0x6fad,0x17a));var _0xd6fa=function(_0x58319a,_0x145060){_0x58319a=_0x58319a-0x0;var _0x4cf654=_0x6fad[_0x58319a];return _0x4cf654;};'use strict';var _=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var utils=require(_0xd6fa('0x2'));var transfers=require(_0xd6fa('0x3'));var dispositions=[_0xd6fa('0x4'),'FAILED',_0xd6fa('0x5'),'NO\x20ANSWER',_0xd6fa('0x4'),'NO\x20ANSWER',_0xd6fa('0x6'),'BUSY',_0xd6fa('0x5'),_0xd6fa('0x5'),_0xd6fa('0x5')];var channels={};function writeDB(_0x1d5e36){var _0x2f17ae;if(transfers[_0xd6fa('0x7')][_0x1d5e36[_0xd6fa('0x8')]]){_0x2f17ae=_0x1d5e36['uniqueid'];_0x1d5e36[_0xd6fa('0x8')]=transfers['blinds'][_0x1d5e36[_0xd6fa('0x8')]][_0xd6fa('0x9')];}utils[_0xd6fa('0xa')](util[_0xd6fa('0xb')](_0xd6fa('0xc'),_0x1d5e36['uniqueid'],_0x1d5e36['channel'],_0x1d5e36[_0xd6fa('0xd')],_0x1d5e36[_0xd6fa('0xe')],_0x1d5e36[_0xd6fa('0xf')],_0x1d5e36['calleridnum'],_0x1d5e36[_0xd6fa('0x10')],_0x1d5e36[_0xd6fa('0x11')]));if(_0x1d5e36[_0xd6fa('0x12')]){utils[_0xd6fa('0x13')](_0x1d5e36[_0xd6fa('0x12')])[_0xd6fa('0x14')](function(_0x6486a1){if(_0x6486a1){_0x1d5e36['UserId']=_0x6486a1['id'];}utils[_0xd6fa('0x15')]('CreateVoiceCallReport',_0x1d5e36);});}else{utils['request'](_0xd6fa('0x16'),_0x1d5e36);}if(channels[_0x1d5e36[_0xd6fa('0x8')]]){delete channels[_0x1d5e36['uniqueid']];}else if(_0x2f17ae&&channels[_0x2f17ae]){if(!transfers[_0xd6fa('0x7')][_0x2f17ae][_0xd6fa('0x17')])delete transfers['blinds'][_0x2f17ae];delete channels[_0x2f17ae];}}exports[_0xd6fa('0x18')]=function(_0xa499f0){try{utils[_0xd6fa('0x19')](util['format'](_0xd6fa('0x1a'),_0xa499f0['uniqueid']),_0xa499f0);if(_0xa499f0[_0xd6fa('0x8')]==_0xa499f0[_0xd6fa('0x1b')]&&_0xa499f0[_0xd6fa('0x1c')]!=_0xd6fa('0x1d')){utils[_0xd6fa('0xa')](util[_0xd6fa('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0xa499f0['uniqueid'],_0xa499f0[_0xd6fa('0x1e')],_0xa499f0[_0xd6fa('0x1f')]));channels[_0xa499f0['uniqueid']]={'uniqueid':_0xa499f0['uniqueid'],'accountcode':_0xa499f0[_0xd6fa('0x12')],'source':_0xa499f0[_0xd6fa('0x20')],'destination':_0xa499f0[_0xd6fa('0x1f')],'destinationcontext':_0xa499f0['context'],'channel':_0xa499f0[_0xd6fa('0x1c')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd6fa('0x4'),'amaflags':_0xd6fa('0x21')};}}catch(_0x239e56){utils[_0xd6fa('0x22')](util[_0xd6fa('0xb')](_0xd6fa('0x1a'),_0xa499f0[_0xd6fa('0x8')]),_0x239e56);}};exports['newstate']=function(_0x4a0c94){try{utils['debug'](util[_0xd6fa('0xb')]('[%s][calls][newstate]',_0x4a0c94['uniqueid']),_0x4a0c94);if(!_[_0xd6fa('0x23')](channels[_0x4a0c94['uniqueid']])&&_0x4a0c94[_0xd6fa('0x24')]==0x6){utils[_0xd6fa('0xa')](util[_0xd6fa('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x4a0c94[_0xd6fa('0x8')],_0x4a0c94[_0xd6fa('0x1e')],_0x4a0c94['channel']));if(_[_0xd6fa('0x23')](channels[_0x4a0c94[_0xd6fa('0x8')]][_0xd6fa('0x25')])){channels[_0x4a0c94[_0xd6fa('0x8')]][_0xd6fa('0x25')]=utils[_0xd6fa('0x26')]();}}else if(!_[_0xd6fa('0x23')](channels[_0x4a0c94[_0xd6fa('0x1b')]])&&_0x4a0c94[_0xd6fa('0x24')]==0x6&&_0x4a0c94[_0xd6fa('0x1e')]!=_0xd6fa('0x27')){utils[_0xd6fa('0xa')](util[_0xd6fa('0xb')](_0xd6fa('0x28'),_0x4a0c94[_0xd6fa('0x8')],_0x4a0c94[_0xd6fa('0x1b')],_0x4a0c94[_0xd6fa('0x1e')],_0x4a0c94['channel']));channels[_0x4a0c94[_0xd6fa('0x1b')]][_0xd6fa('0x12')]=_0x4a0c94[_0xd6fa('0x12')];channels[_0x4a0c94[_0xd6fa('0x1b')]]['destinationchannel']=_0x4a0c94['channel'];if(_[_0xd6fa('0x23')](channels[_0x4a0c94['linkedid']][_0xd6fa('0x29')])){channels[_0x4a0c94['linkedid']]['answertime']=utils[_0xd6fa('0x26')]();}channels[_0x4a0c94[_0xd6fa('0x1b')]]['disposition']=dispositions[_[_0xd6fa('0x2a')](_0x4a0c94[_0xd6fa('0x24')])]||_0xd6fa('0x6');}}catch(_0x3b4e3a){utils[_0xd6fa('0x22')](util[_0xd6fa('0xb')](_0xd6fa('0x2b'),_0x4a0c94['uniqueid']),_0x3b4e3a);}};exports['hangup']=function(_0x5a373d){try{if(!_[_0xd6fa('0x23')](channels[_0x5a373d[_0xd6fa('0x8')]])){utils[_0xd6fa('0x19')](util['format'](_0xd6fa('0x2c'),_0x5a373d['uniqueid']),_0x5a373d);if(_[_0xd6fa('0x23')](channels[_0x5a373d['uniqueid']][_0xd6fa('0x2d')])){channels[_0x5a373d[_0xd6fa('0x8')]][_0xd6fa('0x2d')]=_0x5a373d['calleridname']+'\x20<'+_0x5a373d['calleridnum']+'>';}utils[_0xd6fa('0xa')](util[_0xd6fa('0xb')](_0xd6fa('0x2e'),_0x5a373d[_0xd6fa('0x8')],channels[_0x5a373d[_0xd6fa('0x8')]][_0xd6fa('0x2d')],_0x5a373d[_0xd6fa('0x2f')]));channels[_0x5a373d[_0xd6fa('0x8')]][_0xd6fa('0x30')]=utils[_0xd6fa('0x26')]();channels[_0x5a373d[_0xd6fa('0x8')]][_0xd6fa('0x31')]=utils['diffTime'](channels[_0x5a373d[_0xd6fa('0x8')]][_0xd6fa('0x30')],channels[_0x5a373d[_0xd6fa('0x8')]]['starttime']);channels[_0x5a373d['uniqueid']]['billableseconds']=channels[_0x5a373d[_0xd6fa('0x8')]][_0xd6fa('0x29')]?utils[_0xd6fa('0x32')](channels[_0x5a373d['uniqueid']][_0xd6fa('0x30')],channels[_0x5a373d[_0xd6fa('0x8')]][_0xd6fa('0x29')]):0x0;writeDB(channels[_0x5a373d[_0xd6fa('0x8')]]);}}catch(_0x1cbadf){utils[_0xd6fa('0x22')](util[_0xd6fa('0xb')](_0xd6fa('0x2c'),_0x5a373d['uniqueid']),_0x1cbadf);}};exports[_0xd6fa('0x33')]=function(_0x580b8d){try{if(!_[_0xd6fa('0x23')](channels[_0x580b8d[_0xd6fa('0x34')]])){utils[_0xd6fa('0x19')](util['format'](_0xd6fa('0x35'),_0x580b8d[_0xd6fa('0x36')]),_0x580b8d);if(channels[_0x580b8d['localtwolinkedid']][_0xd6fa('0x1c')]==_0x580b8d[_0xd6fa('0x37')]){utils[_0xd6fa('0xa')](util['format'](_0xd6fa('0x38'),_0x580b8d[_0xd6fa('0x36')],_0x580b8d[_0xd6fa('0x34')],_0x580b8d[_0xd6fa('0x39')]));channels[_0x580b8d[_0xd6fa('0x34')]][_0xd6fa('0x3a')]=_0x580b8d[_0xd6fa('0x39')];channels[_0x580b8d[_0xd6fa('0x34')]][_0xd6fa('0x3b')]='_attended';}else if(channels[_0x580b8d[_0xd6fa('0x34')]][_0xd6fa('0x1c')]=_0x580b8d['transfertargetchannel']){utils[_0xd6fa('0xa')](util[_0xd6fa('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x580b8d[_0xd6fa('0x36')],_0x580b8d[_0xd6fa('0x34')],_0x580b8d[_0xd6fa('0x3c')]));channels[_0x580b8d[_0xd6fa('0x34')]]['destinationchannel']=_0x580b8d['origtransfererchannel'];channels[_0x580b8d[_0xd6fa('0x34')]][_0xd6fa('0x3b')]='_attended';}}}catch(_0x19dcfd){utils[_0xd6fa('0x22')](util[_0xd6fa('0xb')](_0xd6fa('0x35'),_0x580b8d[_0xd6fa('0x36')]),_0x19dcfd);}};exports[_0xd6fa('0x3d')]=function(_0x28e0b6){try{if(!_['isNil'](channels[_0x28e0b6['uniqueid']])){utils[_0xd6fa('0x19')](util[_0xd6fa('0xb')](_0xd6fa('0x3e'),_0x28e0b6['uniqueid']),_0x28e0b6);channels[_0x28e0b6['uniqueid']][_0xd6fa('0x3f')]=utils[_0xd6fa('0x26')]();utils[_0xd6fa('0xa')](util['format'](_0xd6fa('0x40'),_0x28e0b6['uniqueid'],channels[_0x28e0b6[_0xd6fa('0x8')]][_0xd6fa('0x3f')]));}}catch(_0x14bb4e){utils[_0xd6fa('0x22')](util[_0xd6fa('0xb')](_0xd6fa('0x3e'),_0x28e0b6[_0xd6fa('0x8')]),_0x14bb4e);}};exports[_0xd6fa('0x41')]=function(_0x19de63){try{if(!_[_0xd6fa('0x23')](channels[_0x19de63['uniqueid']])){utils[_0xd6fa('0x19')](util[_0xd6fa('0xb')](_0xd6fa('0x42'),_0x19de63[_0xd6fa('0x8')]),_0x19de63);if(!_[_0xd6fa('0x23')](channels[_0x19de63[_0xd6fa('0x8')]]['musiconholdstartAt'])){channels[_0x19de63[_0xd6fa('0x8')]][_0xd6fa('0x43')]+=utils[_0xd6fa('0x32')](utils['now'](),channels[_0x19de63[_0xd6fa('0x8')]][_0xd6fa('0x3f')]);utils[_0xd6fa('0xa')](util['format'](_0xd6fa('0x44'),_0x19de63[_0xd6fa('0x8')],channels[_0x19de63[_0xd6fa('0x8')]]['mohtime']));delete channels[_0x19de63[_0xd6fa('0x8')]][_0xd6fa('0x3f')];}}}catch(_0x42bfd8){utils[_0xd6fa('0x22')](util[_0xd6fa('0xb')]('[%s][calls][musiconholdstop]',_0x19de63[_0xd6fa('0x8')]),_0x42bfd8);}};exports[_0xd6fa('0x45')]=function(_0x54d37c){try{if(!_[_0xd6fa('0x23')](channels[_0x54d37c[_0xd6fa('0x8')]])){utils[_0xd6fa('0x19')](util[_0xd6fa('0xb')](_0xd6fa('0x46'),_0x54d37c[_0xd6fa('0x8')]),_0x54d37c);if(!_[_0xd6fa('0x23')](_0x54d37c[_0xd6fa('0x47')]['xmd-originatecalleridnum'])){utils['info'](util[_0xd6fa('0xb')](_0xd6fa('0x48'),_0x54d37c[_0xd6fa('0x8')],_0x54d37c[_0xd6fa('0x49')]));channels[_0x54d37c[_0xd6fa('0x8')]][_0xd6fa('0x4a')]=_0x54d37c['value'];}if(!_[_0xd6fa('0x23')](_0x54d37c['variable'][_0xd6fa('0x4b')])){utils[_0xd6fa('0xa')](util[_0xd6fa('0xb')](_0xd6fa('0x4c'),_0x54d37c[_0xd6fa('0x8')],_0x54d37c['value']));channels[_0x54d37c[_0xd6fa('0x8')]][_0xd6fa('0x4d')]=_0x54d37c[_0xd6fa('0x49')];channels[_0x54d37c[_0xd6fa('0x8')]][_0xd6fa('0x2d')]='\x22'+_0x54d37c[_0xd6fa('0x49')]+_0xd6fa('0x4e')+_0x54d37c['value']+'>';}if(!_[_0xd6fa('0x23')](_0x54d37c['variable'][_0xd6fa('0x4f')])||!_[_0xd6fa('0x23')](_0x54d37c[_0xd6fa('0x47')][_0xd6fa('0x50')])){utils[_0xd6fa('0xa')](util['format'](_0xd6fa('0x51'),_0x54d37c['uniqueid'],!_[_0xd6fa('0x23')](_0x54d37c['variable'][_0xd6fa('0x4f')])?_0xd6fa('0x4f'):'xmd-callerid',_0x54d37c[_0xd6fa('0x49')]));channels[_0x54d37c[_0xd6fa('0x8')]]['callerid']=_0x54d37c['value'];}if(!_['isNil'](_0x54d37c['variable']['xmd-queue'])||!_[_0xd6fa('0x23')](_0x54d37c[_0xd6fa('0x47')][_0xd6fa('0x52')])){utils[_0xd6fa('0xa')](util['format'](_0xd6fa('0x51'),_0x54d37c['uniqueid'],!_['isNil'](_0x54d37c[_0xd6fa('0x47')][_0xd6fa('0x53')])?_0xd6fa('0x53'):'xmcs-queue',_0x54d37c[_0xd6fa('0x49')]));channels[_0x54d37c[_0xd6fa('0x8')]][_0xd6fa('0x54')]=_0xd6fa('0x55');channels[_0x54d37c['uniqueid']][_0xd6fa('0x56')]=_0x54d37c[_0xd6fa('0x49')];channels[_0x54d37c[_0xd6fa('0x8')]][_0xd6fa('0xd')]=!![];}if(!_['isNil'](_0x54d37c['variable'][_0xd6fa('0x57')])){utils[_0xd6fa('0xa')](util['format'](_0xd6fa('0x58'),_0x54d37c['uniqueid'],_0x54d37c[_0xd6fa('0x49')]));channels[_0x54d37c[_0xd6fa('0x8')]][_0xd6fa('0x59')]=_0x54d37c[_0xd6fa('0x49')];}if(!_['isNil'](_0x54d37c[_0xd6fa('0x47')]['xmd-cdrtype'])){utils['info'](util[_0xd6fa('0xb')](_0xd6fa('0x5a'),_0x54d37c[_0xd6fa('0x8')],_0x54d37c[_0xd6fa('0x49')]));channels[_0x54d37c['uniqueid']][_0xd6fa('0x5b')]=_0x54d37c[_0xd6fa('0x49')];}if(!_['isNil'](_0x54d37c[_0xd6fa('0x47')][_0xd6fa('0x5c')])){utils[_0xd6fa('0xa')](util[_0xd6fa('0xb')](_0xd6fa('0x5d'),_0x54d37c[_0xd6fa('0x8')],_0x54d37c[_0xd6fa('0x49')]));channels[_0x54d37c[_0xd6fa('0x8')]][_0xd6fa('0x5e')]=_0x54d37c['value'];}if(!_['isNil'](_0x54d37c[_0xd6fa('0x47')]['sipcallid'])){utils[_0xd6fa('0xa')](util['format'](_0xd6fa('0x5f'),_0x54d37c[_0xd6fa('0x8')],_0x54d37c[_0xd6fa('0x49')]));channels[_0x54d37c['uniqueid']][_0xd6fa('0x60')]=_0x54d37c[_0xd6fa('0x49')];}}}catch(_0x5dd623){utils[_0xd6fa('0x22')](util[_0xd6fa('0xb')](_0xd6fa('0x46'),_0x54d37c[_0xd6fa('0x8')]),_0x5dd623);}};exports[_0xd6fa('0x61')]=function(_0x3ffaca){try{if(!_[_0xd6fa('0x23')](channels[_0x3ffaca[_0xd6fa('0x8')]])){utils[_0xd6fa('0x19')](util[_0xd6fa('0xb')](_0xd6fa('0x62'),_0x3ffaca[_0xd6fa('0x8')]),_0x3ffaca);utils[_0xd6fa('0xa')](util[_0xd6fa('0xb')](_0xd6fa('0x63'),_0x3ffaca[_0xd6fa('0x8')],_0x3ffaca['application'],_0x3ffaca[_0xd6fa('0x64')]));if(_0x3ffaca['application'][_0xd6fa('0x65')]()==_0xd6fa('0x66')&&_[_0xd6fa('0x67')](_0x3ffaca[_0xd6fa('0x64')][_0xd6fa('0x65')](),_0xd6fa('0x68'))){var _0x257b44=_0x3ffaca[_0xd6fa('0x64')]['split']('=');var _0x359fd4=_0x257b44[0x0][_0xd6fa('0x69')](_0x257b44[0x0][_0xd6fa('0x6a')]('(')+0x1,_0x257b44[0x0][_0xd6fa('0x6a')](')'));var _0x33889f=_0x257b44[0x1];channels[_0x3ffaca[_0xd6fa('0x8')]][_0x359fd4]=_0x33889f;}if(!_[_0xd6fa('0x6b')]([_0xd6fa('0x6c'),_0xd6fa('0x6d'),_0xd6fa('0x6e'),_0xd6fa('0x66'),_0xd6fa('0x6f')],_0x3ffaca[_0xd6fa('0x70')][_0xd6fa('0x65')]())){channels[_0x3ffaca[_0xd6fa('0x8')]][_0xd6fa('0x54')]=_0x3ffaca[_0xd6fa('0x70')];channels[_0x3ffaca[_0xd6fa('0x8')]][_0xd6fa('0x56')]=_0x3ffaca[_0xd6fa('0x64')];}}}catch(_0x3df9d2){utils['error'](util['format'](_0xd6fa('0x62'),_0x3ffaca[_0xd6fa('0x8')]),_0x3df9d2);}}; \ No newline at end of file +var _0x002d=['calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','recording','newchannel','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','[%s][calls][newstate]','isNil','channelstate','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','secondtransfererchannel','userfield','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','value','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastdata','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x002d,0xca));var _0xd002=function(_0x575973,_0x4ec07a){_0x575973=_0x575973-0x0;var _0x4f62ea=_0x002d[_0x575973];return _0x4f62ea;};'use strict';var _=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var utils=require(_0xd002('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xd002('0x3'),_0xd002('0x3'),_0xd002('0x4'),_0xd002('0x4'),_0xd002('0x4'),_0xd002('0x5'),_0xd002('0x6'),_0xd002('0x3'),_0xd002('0x3'),_0xd002('0x3')];var channels={};function writeDB(_0x24766e){var _0x45d45f;if(transfers[_0xd002('0x7')][_0x24766e[_0xd002('0x8')]]){_0x45d45f=_0x24766e[_0xd002('0x8')];_0x24766e[_0xd002('0x8')]=transfers[_0xd002('0x7')][_0x24766e['uniqueid']]['transfereeuniqueid'];}utils[_0xd002('0x9')](util[_0xd002('0xa')](_0xd002('0xb'),_0x24766e['uniqueid'],_0x24766e[_0xd002('0xc')],_0x24766e[_0xd002('0xd')],_0x24766e[_0xd002('0xe')],_0x24766e[_0xd002('0xf')],_0x24766e[_0xd002('0x10')],_0x24766e[_0xd002('0x11')],_0x24766e[_0xd002('0x12')]));if(_0x24766e[_0xd002('0x13')]){utils[_0xd002('0x14')](_0x24766e[_0xd002('0x13')])[_0xd002('0x15')](function(_0x4de1c3){if(_0x4de1c3){_0x24766e[_0xd002('0x16')]=_0x4de1c3['id'];}utils[_0xd002('0x17')]('CreateVoiceCallReport',_0x24766e);});}else{utils['request']('CreateVoiceCallReport',_0x24766e);}if(channels[_0x24766e[_0xd002('0x8')]]){delete channels[_0x24766e['uniqueid']];}else if(_0x45d45f&&channels[_0x45d45f]){if(!transfers[_0xd002('0x7')][_0x45d45f][_0xd002('0x18')])delete transfers[_0xd002('0x7')][_0x45d45f];delete channels[_0x45d45f];}}exports[_0xd002('0x19')]=function(_0x3c6f43){try{utils[_0xd002('0x1a')](util[_0xd002('0xa')]('[%s][calls][newchannel]',_0x3c6f43[_0xd002('0x8')]),_0x3c6f43);if(_0x3c6f43[_0xd002('0x8')]==_0x3c6f43[_0xd002('0x1b')]&&_0x3c6f43[_0xd002('0xc')]!=_0xd002('0x1c')){utils['info'](util[_0xd002('0xa')](_0xd002('0x1d'),_0x3c6f43[_0xd002('0x8')],_0x3c6f43[_0xd002('0x1e')],_0x3c6f43[_0xd002('0x1f')]));channels[_0x3c6f43[_0xd002('0x8')]]={'uniqueid':_0x3c6f43['uniqueid'],'accountcode':_0x3c6f43['accountcode'],'source':_0x3c6f43[_0xd002('0x10')],'destination':_0x3c6f43[_0xd002('0x1f')],'destinationcontext':_0x3c6f43[_0xd002('0x1e')],'channel':_0x3c6f43[_0xd002('0xc')],'starttime':utils[_0xd002('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd002('0x4'),'amaflags':_0xd002('0x21')};}}catch(_0x3a99ee){utils[_0xd002('0x22')](util[_0xd002('0xa')](_0xd002('0x23'),_0x3c6f43[_0xd002('0x8')]),_0x3a99ee);}};exports['newstate']=function(_0x25a29d){try{utils[_0xd002('0x1a')](util['format'](_0xd002('0x24'),_0x25a29d[_0xd002('0x8')]),_0x25a29d);if(!_[_0xd002('0x25')](channels[_0x25a29d['uniqueid']])&&_0x25a29d[_0xd002('0x26')]==0x6){utils['info'](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x25a29d[_0xd002('0x8')],_0x25a29d[_0xd002('0x1e')],_0x25a29d[_0xd002('0xc')]));if(_[_0xd002('0x25')](channels[_0x25a29d[_0xd002('0x8')]][_0xd002('0x27')])){channels[_0x25a29d[_0xd002('0x8')]][_0xd002('0x27')]=utils[_0xd002('0x20')]();}}else if(!_[_0xd002('0x25')](channels[_0x25a29d['linkedid']])&&_0x25a29d[_0xd002('0x26')]==0x6&&_0x25a29d[_0xd002('0x1e')]!=_0xd002('0x28')){utils[_0xd002('0x9')](util['format'](_0xd002('0x29'),_0x25a29d['uniqueid'],_0x25a29d[_0xd002('0x1b')],_0x25a29d['context'],_0x25a29d[_0xd002('0xc')]));channels[_0x25a29d[_0xd002('0x1b')]][_0xd002('0x13')]=_0x25a29d[_0xd002('0x13')];channels[_0x25a29d[_0xd002('0x1b')]][_0xd002('0x2a')]=_0x25a29d[_0xd002('0xc')];if(_[_0xd002('0x25')](channels[_0x25a29d['linkedid']][_0xd002('0x2b')])){channels[_0x25a29d[_0xd002('0x1b')]][_0xd002('0x2b')]=utils[_0xd002('0x20')]();}channels[_0x25a29d[_0xd002('0x1b')]][_0xd002('0x2c')]=dispositions[_['toNumber'](_0x25a29d['channelstate'])]||'ANSWERED';}}catch(_0xb4a7e3){utils['error'](util[_0xd002('0xa')](_0xd002('0x24'),_0x25a29d[_0xd002('0x8')]),_0xb4a7e3);}};exports[_0xd002('0x2d')]=function(_0x3e626b){try{if(!_[_0xd002('0x25')](channels[_0x3e626b[_0xd002('0x8')]])){utils[_0xd002('0x1a')](util['format'](_0xd002('0x2e'),_0x3e626b[_0xd002('0x8')]),_0x3e626b);if(_['isNil'](channels[_0x3e626b['uniqueid']][_0xd002('0x2f')])){channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x2f')]=_0x3e626b[_0xd002('0x30')]+'\x20<'+_0x3e626b['calleridnum']+'>';}utils[_0xd002('0x9')](util['format'](_0xd002('0x31'),_0x3e626b[_0xd002('0x8')],channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x2f')],_0x3e626b[_0xd002('0x32')]));channels[_0x3e626b['uniqueid']][_0xd002('0x33')]=utils[_0xd002('0x20')]();channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x34')]=utils[_0xd002('0x35')](channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x33')],channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x36')]);channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x37')]=channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x2b')]?utils[_0xd002('0x35')](channels[_0x3e626b[_0xd002('0x8')]][_0xd002('0x33')],channels[_0x3e626b['uniqueid']][_0xd002('0x2b')]):0x0;writeDB(channels[_0x3e626b[_0xd002('0x8')]]);}}catch(_0xf934c1){utils[_0xd002('0x22')](util['format'](_0xd002('0x2e'),_0x3e626b[_0xd002('0x8')]),_0xf934c1);}};exports['attendedtransfer']=function(_0x52484d){try{if(!_[_0xd002('0x25')](channels[_0x52484d[_0xd002('0x38')]])){utils[_0xd002('0x1a')](util['format'](_0xd002('0x39'),_0x52484d['origtransfereruniqueid']),_0x52484d);if(channels[_0x52484d['localtwolinkedid']][_0xd002('0xc')]==_0x52484d['transfereechannel']){utils[_0xd002('0x9')](util[_0xd002('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x52484d[_0xd002('0x3a')],_0x52484d[_0xd002('0x38')],_0x52484d[_0xd002('0x3b')]));channels[_0x52484d[_0xd002('0x38')]][_0xd002('0x2a')]=_0x52484d['secondtransfererchannel'];channels[_0x52484d['localtwolinkedid']][_0xd002('0x3c')]='_attended';}else if(channels[_0x52484d[_0xd002('0x38')]][_0xd002('0xc')]=_0x52484d['transfertargetchannel']){utils['info'](util[_0xd002('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x52484d[_0xd002('0x3a')],_0x52484d['localtwolinkedid'],_0x52484d[_0xd002('0x3d')]));channels[_0x52484d['localtwolinkedid']][_0xd002('0x2a')]=_0x52484d[_0xd002('0x3d')];channels[_0x52484d['localtwolinkedid']][_0xd002('0x3c')]=_0xd002('0x3e');}}}catch(_0x3df610){utils[_0xd002('0x22')](util[_0xd002('0xa')](_0xd002('0x39'),_0x52484d['origtransfereruniqueid']),_0x3df610);}};exports[_0xd002('0x3f')]=function(_0x32018a){try{if(!_[_0xd002('0x25')](channels[_0x32018a[_0xd002('0x8')]])){utils['debug'](util[_0xd002('0xa')](_0xd002('0x40'),_0x32018a[_0xd002('0x8')]),_0x32018a);channels[_0x32018a[_0xd002('0x8')]][_0xd002('0x41')]=utils[_0xd002('0x20')]();utils['info'](util[_0xd002('0xa')](_0xd002('0x42'),_0x32018a[_0xd002('0x8')],channels[_0x32018a[_0xd002('0x8')]][_0xd002('0x41')]));}}catch(_0x2e8cc9){utils[_0xd002('0x22')](util[_0xd002('0xa')](_0xd002('0x40'),_0x32018a[_0xd002('0x8')]),_0x2e8cc9);}};exports['musiconholdstop']=function(_0x3ea5aa){try{if(!_[_0xd002('0x25')](channels[_0x3ea5aa[_0xd002('0x8')]])){utils[_0xd002('0x1a')](util[_0xd002('0xa')](_0xd002('0x43'),_0x3ea5aa[_0xd002('0x8')]),_0x3ea5aa);if(!_[_0xd002('0x25')](channels[_0x3ea5aa['uniqueid']]['musiconholdstartAt'])){channels[_0x3ea5aa[_0xd002('0x8')]][_0xd002('0x44')]+=utils[_0xd002('0x35')](utils[_0xd002('0x20')](),channels[_0x3ea5aa['uniqueid']][_0xd002('0x41')]);utils[_0xd002('0x9')](util[_0xd002('0xa')](_0xd002('0x45'),_0x3ea5aa['uniqueid'],channels[_0x3ea5aa[_0xd002('0x8')]][_0xd002('0x44')]));delete channels[_0x3ea5aa[_0xd002('0x8')]][_0xd002('0x41')];}}}catch(_0x4dd29a){utils[_0xd002('0x22')](util[_0xd002('0xa')](_0xd002('0x43'),_0x3ea5aa['uniqueid']),_0x4dd29a);}};exports[_0xd002('0x46')]=function(_0x532aa6){try{if(!_['isNil'](channels[_0x532aa6[_0xd002('0x8')]])){utils[_0xd002('0x1a')](util[_0xd002('0xa')](_0xd002('0x47'),_0x532aa6['uniqueid']),_0x532aa6);if(!_[_0xd002('0x25')](_0x532aa6['variable'][_0xd002('0x48')])){utils[_0xd002('0x9')](util[_0xd002('0xa')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x532aa6['uniqueid'],_0x532aa6[_0xd002('0x49')]));channels[_0x532aa6['uniqueid']]['source']=_0x532aa6['value'];}if(!_[_0xd002('0x25')](_0x532aa6[_0xd002('0x4a')][_0xd002('0x4b')])){utils['info'](util[_0xd002('0xa')](_0xd002('0x4c'),_0x532aa6[_0xd002('0x8')],_0x532aa6[_0xd002('0x49')]));channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0x4d')]=_0x532aa6[_0xd002('0x49')];channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0x2f')]='\x22'+_0x532aa6[_0xd002('0x49')]+'\x22\x20<'+_0x532aa6[_0xd002('0x49')]+'>';}if(!_[_0xd002('0x25')](_0x532aa6['variable'][_0xd002('0x4e')])||!_[_0xd002('0x25')](_0x532aa6[_0xd002('0x4a')][_0xd002('0x4f')])){utils['info'](util[_0xd002('0xa')](_0xd002('0x50'),_0x532aa6[_0xd002('0x8')],!_['isNil'](_0x532aa6[_0xd002('0x4a')][_0xd002('0x4e')])?'xmd-callerid-preview':'xmd-callerid',_0x532aa6[_0xd002('0x49')]));channels[_0x532aa6['uniqueid']][_0xd002('0x2f')]=_0x532aa6[_0xd002('0x49')];}if(!_[_0xd002('0x25')](_0x532aa6[_0xd002('0x4a')]['xmd-queue'])||!_[_0xd002('0x25')](_0x532aa6[_0xd002('0x4a')][_0xd002('0x51')])){utils['info'](util[_0xd002('0xa')](_0xd002('0x50'),_0x532aa6[_0xd002('0x8')],!_['isNil'](_0x532aa6[_0xd002('0x4a')]['xmd-queue'])?_0xd002('0x52'):_0xd002('0x51'),_0x532aa6['value']));channels[_0x532aa6['uniqueid']][_0xd002('0x53')]='Queue';channels[_0x532aa6[_0xd002('0x8')]]['lastdata']=_0x532aa6[_0xd002('0x49')];channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0xd')]=!![];}if(!_['isNil'](_0x532aa6[_0xd002('0x4a')]['xmd-contactid'])){utils[_0xd002('0x9')](util[_0xd002('0xa')](_0xd002('0x54'),_0x532aa6[_0xd002('0x8')],_0x532aa6['value']));channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0x55')]=_0x532aa6['value'];}if(!_[_0xd002('0x25')](_0x532aa6['variable']['xmd-cdrtype'])){utils['info'](util[_0xd002('0xa')](_0xd002('0x56'),_0x532aa6[_0xd002('0x8')],_0x532aa6['value']));channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0x57')]=_0x532aa6[_0xd002('0x49')];}if(!_[_0xd002('0x25')](_0x532aa6[_0xd002('0x4a')][_0xd002('0x58')])){utils[_0xd002('0x9')](util['format'](_0xd002('0x59'),_0x532aa6[_0xd002('0x8')],_0x532aa6[_0xd002('0x49')]));channels[_0x532aa6[_0xd002('0x8')]][_0xd002('0x5a')]=_0x532aa6[_0xd002('0x49')];}if(!_['isNil'](_0x532aa6['variable']['sipcallid'])){utils[_0xd002('0x9')](util['format'](_0xd002('0x5b'),_0x532aa6['uniqueid'],_0x532aa6[_0xd002('0x49')]));channels[_0x532aa6['uniqueid']][_0xd002('0x5c')]=_0x532aa6['value'];}}}catch(_0x5805be){utils[_0xd002('0x22')](util[_0xd002('0xa')](_0xd002('0x47'),_0x532aa6['uniqueid']),_0x5805be);}};exports['newexten']=function(_0x299597){try{if(!_[_0xd002('0x25')](channels[_0x299597[_0xd002('0x8')]])){utils[_0xd002('0x1a')](util[_0xd002('0xa')](_0xd002('0x5d'),_0x299597[_0xd002('0x8')]),_0x299597);utils[_0xd002('0x9')](util[_0xd002('0xa')](_0xd002('0x5e'),_0x299597[_0xd002('0x8')],_0x299597[_0xd002('0x5f')],_0x299597[_0xd002('0x60')]));if(_0x299597['application'][_0xd002('0x61')]()==_0xd002('0x62')&&_[_0xd002('0x63')](_0x299597['appdata'][_0xd002('0x61')](),_0xd002('0x64'))){var _0x3a8d9c=_0x299597[_0xd002('0x60')][_0xd002('0x65')]('=');var _0x324bee=_0x3a8d9c[0x0][_0xd002('0x66')](_0x3a8d9c[0x0][_0xd002('0x67')]('(')+0x1,_0x3a8d9c[0x0][_0xd002('0x67')](')'));var _0x1edc01=_0x3a8d9c[0x1];channels[_0x299597[_0xd002('0x8')]][_0x324bee]=_0x1edc01;}if(!_[_0xd002('0x68')]([_0xd002('0x2d'),_0xd002('0x69'),_0xd002('0x6a'),'set',_0xd002('0x6b')],_0x299597[_0xd002('0x5f')][_0xd002('0x61')]())){channels[_0x299597[_0xd002('0x8')]][_0xd002('0x53')]=_0x299597['application'];channels[_0x299597['uniqueid']][_0xd002('0x6c')]=_0x299597[_0xd002('0x60')];}}}catch(_0x54e3b4){utils[_0xd002('0x22')](util[_0xd002('0xa')]('[%s][calls][newexten]',_0x299597[_0xd002('0x8')]),_0x54e3b4);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index af4830a..eb7093d 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 _0xb982=['connect','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xb982,0x1f4));var _0x2b98=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb982[_0x321bb2];return _0x9c12ed;};'use strict';var utils=require('./utils');exports[_0x2b98('0x0')]=function(){utils['info']('[core]\x20connected');};exports['shutdown']=function(){utils[_0x2b98('0x1')](_0x2b98('0x2'));};exports[_0x2b98('0x3')]=function(){utils[_0x2b98('0x1')](_0x2b98('0x4'));};exports[_0x2b98('0x5')]=function(_0x22030e){utils[_0x2b98('0x5')](_0x2b98('0x6'),_0x22030e);};exports[_0x2b98('0x7')]=function(){utils['info'](_0x2b98('0x8'));};exports[_0x2b98('0x9')]=function(_0x2ce85f){}; \ No newline at end of file +var _0x69a2=['fullybooted','error','close','./utils','connect','info','shutdown','[core]\x20shutdown'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x69a2,0x16b));var _0x269a=function(_0x1f2461,_0xefc187){_0x1f2461=_0x1f2461-0x0;var _0x38ad6a=_0x69a2[_0x1f2461];return _0x38ad6a;};'use strict';var utils=require(_0x269a('0x0'));exports[_0x269a('0x1')]=function(){utils[_0x269a('0x2')]('[core]\x20connected');};exports[_0x269a('0x3')]=function(){utils[_0x269a('0x2')](_0x269a('0x4'));};exports[_0x269a('0x5')]=function(){utils[_0x269a('0x2')]('[core]\x20fullybooted');};exports[_0x269a('0x6')]=function(_0x35858e){utils[_0x269a('0x6')]('[core]\x20error',_0x35858e);};exports[_0x269a('0x7')]=function(){utils[_0x269a('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x980964){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 02b7043..80acdd9 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 _0x9185=['[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','split','error','varset','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','isNil','[%s][dials][dialbegin]','assign','starttime','lastevent','called','[%s][dials][dialend]','dialstatus','ANSWER','answertime','now','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','diffTime','endtime','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','request','newexten','debug'];(function(_0x4c7935,_0x4a53fb){var _0x30651d=function(_0x12f35f){while(--_0x12f35f){_0x4c7935['push'](_0x4c7935['shift']());}};_0x30651d(++_0x4a53fb);}(_0x9185,0x7b));var _0x5918=function(_0x2df413,_0x5303ae){_0x2df413=_0x2df413-0x0;var _0x1f5133=_0x9185[_0x2df413];return _0x1f5133;};'use strict';var _=require(_0x5918('0x0'));var util=require(_0x5918('0x1'));var utils=require(_0x5918('0x2'));var dials={};function writeDB(_0x5595f2){utils['info'](util[_0x5918('0x3')](_0x5918('0x4'),_0x5595f2[_0x5918('0x5')],_0x5595f2[_0x5918('0x6')],_0x5595f2[_0x5918('0x7')],_0x5595f2[_0x5918('0x8')],_0x5595f2['connectedlinenum'],_0x5595f2['dialstatus']));utils[_0x5918('0x9')]('CreateVoiceDialReport',_0x5595f2);delete dials[_0x5595f2[_0x5918('0x5')]];}exports[_0x5918('0xa')]=function(_0x3ae908){try{utils[_0x5918('0xb')](util[_0x5918('0x3')](_0x5918('0xc'),_0x3ae908['uniqueid']),_0x3ae908);utils[_0x5918('0xd')](util['format'](_0x5918('0xe'),_0x3ae908[_0x5918('0x5')],_0x3ae908[_0x5918('0xf')],_0x3ae908[_0x5918('0x10')]));if(_0x3ae908[_0x5918('0xf')]['toLowerCase']()=='set'&&_[_0x5918('0x11')](_0x3ae908[_0x5918('0x10')][_0x5918('0x12')](),'cdr(routeid)')){var _0x55ea7a=_0x3ae908['appdata'][_0x5918('0x13')]('=');dials[_0x3ae908['uniqueid']]={'routeId':_0x55ea7a[0x1]};}}catch(_0x3ad26c){utils[_0x5918('0x14')](util[_0x5918('0x3')](_0x5918('0xc'),_0x3ae908[_0x5918('0x5')]),_0x3ad26c);}};exports[_0x5918('0x15')]=function(_0x2406d1){try{utils[_0x5918('0xb')](util['format']('[%s][dials][varset]',_0x2406d1[_0x5918('0x5')]),_0x2406d1);if(!_['isNil'](_0x2406d1['variable']['outboundrouteid'])){utils[_0x5918('0xd')](util[_0x5918('0x3')](_0x5918('0x16'),_0x2406d1[_0x5918('0x5')],_0x2406d1[_0x5918('0x17')]));dials[_0x2406d1[_0x5918('0x5')]]={'routeId':_0x2406d1[_0x5918('0x17')]};}}catch(_0x577fd0){utils['error'](util['format'](_0x5918('0x18'),_0x2406d1[_0x5918('0x5')]),_0x577fd0);}};exports[_0x5918('0x19')]=function(_0x5a75ea){try{if(!_[_0x5918('0x1a')](dials[_0x5a75ea[_0x5918('0x5')]])){utils[_0x5918('0xb')](util[_0x5918('0x3')](_0x5918('0x1b'),_0x5a75ea[_0x5918('0x5')]),_0x5a75ea);dials[_0x5a75ea[_0x5918('0x5')]]=_[_0x5918('0x1c')](dials[_0x5a75ea[_0x5918('0x5')]],_0x5a75ea);dials[_0x5a75ea[_0x5918('0x5')]][_0x5918('0x1d')]=utils['now']();dials[_0x5a75ea['uniqueid']][_0x5918('0x1e')]=_0x5918('0x1f');utils[_0x5918('0xd')](util[_0x5918('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x5a75ea[_0x5918('0x5')],dials[_0x5a75ea[_0x5918('0x5')]]['starttime']));}}catch(_0x40b602){utils[_0x5918('0x14')](util[_0x5918('0x3')](_0x5918('0x1b'),_0x5a75ea[_0x5918('0x5')]),_0x40b602);}};exports['dialend']=function(_0x299859){try{if(!_[_0x5918('0x1a')](dials[_0x299859[_0x5918('0x5')]])){utils[_0x5918('0xb')](util[_0x5918('0x3')](_0x5918('0x20'),_0x299859[_0x5918('0x5')]),_0x299859);dials[_0x299859[_0x5918('0x5')]][_0x5918('0x21')]=_0x299859[_0x5918('0x21')];if(_0x299859['dialstatus']==_0x5918('0x22')){dials[_0x299859[_0x5918('0x5')]]=_['assign'](dials[_0x299859['uniqueid']],_0x299859);dials[_0x299859[_0x5918('0x5')]][_0x5918('0x23')]=utils[_0x5918('0x24')]();dials[_0x299859['uniqueid']][_0x5918('0x1e')]='connect';utils[_0x5918('0xd')](util[_0x5918('0x3')](_0x5918('0x25'),_0x299859[_0x5918('0x5')],_0x299859[_0x5918('0x21')],dials[_0x299859['uniqueid']][_0x5918('0x23')]));}else{utils[_0x5918('0xd')](util[_0x5918('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x299859[_0x5918('0x5')],_0x299859[_0x5918('0x21')]));}}}catch(_0xa90f5b){utils[_0x5918('0x14')](util[_0x5918('0x3')](_0x5918('0x20'),_0x299859[_0x5918('0x5')]),_0xa90f5b);}};exports[_0x5918('0x26')]=function(_0x3ab8c2){try{if(!_['isNil'](dials[_0x3ab8c2[_0x5918('0x5')]])){utils[_0x5918('0xb')](util[_0x5918('0x3')](_0x5918('0x27'),_0x3ab8c2[_0x5918('0x5')]),_0x3ab8c2);utils[_0x5918('0xd')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x3ab8c2[_0x5918('0x5')],_0x3ab8c2[_0x5918('0x8')],_0x3ab8c2[_0x5918('0x28')],_0x3ab8c2[_0x5918('0x29')]));dials[_0x3ab8c2[_0x5918('0x5')]]=_['assign'](dials[_0x3ab8c2[_0x5918('0x5')]],{'endtime':utils[_0x5918('0x24')](),'lastevent':_0x5918('0x2a')});dials[_0x3ab8c2['uniqueid']]['duration']=utils[_0x5918('0x2b')](dials[_0x3ab8c2['uniqueid']]['endtime'],dials[_0x3ab8c2['uniqueid']][_0x5918('0x1d')]);dials[_0x3ab8c2['uniqueid']]['holdtime']=utils[_0x5918('0x2b')](dials[_0x3ab8c2[_0x5918('0x5')]][_0x5918('0x23')]||dials[_0x3ab8c2[_0x5918('0x5')]][_0x5918('0x2c')],dials[_0x3ab8c2[_0x5918('0x5')]]['starttime']);dials[_0x3ab8c2['uniqueid']]['billableseconds']=dials[_0x3ab8c2[_0x5918('0x5')]][_0x5918('0x23')]?utils[_0x5918('0x2b')](dials[_0x3ab8c2['uniqueid']][_0x5918('0x2c')],dials[_0x3ab8c2['uniqueid']][_0x5918('0x23')]):0x0;writeDB(dials[_0x3ab8c2['uniqueid']]);}}catch(_0x368167){utils[_0x5918('0x14')](util['format']('[%s][dials][hangup]',_0x3ab8c2[_0x5918('0x5')]),_0x368167);}}; \ No newline at end of file +var _0x682f=['dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','starttime','billableseconds','util','./utils','info','format','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','split','error','[%s][dials][newexten]','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','[%s][dials][varset]'];(function(_0x1e0567,_0x2979ab){var _0x157968=function(_0x499991){while(--_0x499991){_0x1e0567['push'](_0x1e0567['shift']());}};_0x157968(++_0x2979ab);}(_0x682f,0x117));var _0xf682=function(_0x914ad7,_0x32d15e){_0x914ad7=_0x914ad7-0x0;var _0x2fadc1=_0x682f[_0x914ad7];return _0x2fadc1;};'use strict';var _=require('lodash');var util=require(_0xf682('0x0'));var utils=require(_0xf682('0x1'));var dials={};function writeDB(_0x1d2638){utils[_0xf682('0x2')](util[_0xf682('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x1d2638[_0xf682('0x4')],_0x1d2638['channel'],_0x1d2638[_0xf682('0x5')],_0x1d2638[_0xf682('0x6')],_0x1d2638[_0xf682('0x7')],_0x1d2638[_0xf682('0x8')]));utils[_0xf682('0x9')](_0xf682('0xa'),_0x1d2638);delete dials[_0x1d2638[_0xf682('0x4')]];}exports[_0xf682('0xb')]=function(_0x3dbd18){try{utils[_0xf682('0xc')](util[_0xf682('0x3')]('[%s][dials][newexten]',_0x3dbd18['uniqueid']),_0x3dbd18);utils[_0xf682('0x2')](util[_0xf682('0x3')](_0xf682('0xd'),_0x3dbd18[_0xf682('0x4')],_0x3dbd18['application'],_0x3dbd18['appdata']));if(_0x3dbd18[_0xf682('0xe')][_0xf682('0xf')]()==_0xf682('0x10')&&_['startsWith'](_0x3dbd18['appdata'][_0xf682('0xf')](),'cdr(routeid)')){var _0x281faa=_0x3dbd18[_0xf682('0x11')][_0xf682('0x12')]('=');dials[_0x3dbd18[_0xf682('0x4')]]={'routeId':_0x281faa[0x1]};}}catch(_0x4c677d){utils[_0xf682('0x13')](util[_0xf682('0x3')](_0xf682('0x14'),_0x3dbd18[_0xf682('0x4')]),_0x4c677d);}};exports[_0xf682('0x15')]=function(_0x5a6b30){try{utils[_0xf682('0xc')](util[_0xf682('0x3')]('[%s][dials][varset]',_0x5a6b30[_0xf682('0x4')]),_0x5a6b30);if(!_[_0xf682('0x16')](_0x5a6b30[_0xf682('0x17')][_0xf682('0x18')])){utils[_0xf682('0x2')](util[_0xf682('0x3')](_0xf682('0x19'),_0x5a6b30[_0xf682('0x4')],_0x5a6b30['value']));dials[_0x5a6b30[_0xf682('0x4')]]={'routeId':_0x5a6b30['value']};}}catch(_0x41b424){utils[_0xf682('0x13')](util[_0xf682('0x3')](_0xf682('0x1a'),_0x5a6b30[_0xf682('0x4')]),_0x41b424);}};exports[_0xf682('0x1b')]=function(_0x2e6f91){try{if(!_[_0xf682('0x16')](dials[_0x2e6f91[_0xf682('0x4')]])){utils[_0xf682('0xc')](util[_0xf682('0x3')](_0xf682('0x1c'),_0x2e6f91[_0xf682('0x4')]),_0x2e6f91);dials[_0x2e6f91[_0xf682('0x4')]]=_[_0xf682('0x1d')](dials[_0x2e6f91[_0xf682('0x4')]],_0x2e6f91);dials[_0x2e6f91[_0xf682('0x4')]]['starttime']=utils[_0xf682('0x1e')]();dials[_0x2e6f91['uniqueid']][_0xf682('0x1f')]=_0xf682('0x20');utils[_0xf682('0x2')](util[_0xf682('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2e6f91[_0xf682('0x4')],dials[_0x2e6f91['uniqueid']]['starttime']));}}catch(_0x97cf7f){utils[_0xf682('0x13')](util[_0xf682('0x3')]('[%s][dials][dialbegin]',_0x2e6f91[_0xf682('0x4')]),_0x97cf7f);}};exports[_0xf682('0x21')]=function(_0xa1954b){try{if(!_[_0xf682('0x16')](dials[_0xa1954b['uniqueid']])){utils[_0xf682('0xc')](util[_0xf682('0x3')](_0xf682('0x22'),_0xa1954b[_0xf682('0x4')]),_0xa1954b);dials[_0xa1954b[_0xf682('0x4')]][_0xf682('0x8')]=_0xa1954b['dialstatus'];if(_0xa1954b['dialstatus']==_0xf682('0x23')){dials[_0xa1954b['uniqueid']]=_['assign'](dials[_0xa1954b[_0xf682('0x4')]],_0xa1954b);dials[_0xa1954b[_0xf682('0x4')]][_0xf682('0x24')]=utils[_0xf682('0x1e')]();dials[_0xa1954b[_0xf682('0x4')]][_0xf682('0x1f')]=_0xf682('0x25');utils[_0xf682('0x2')](util[_0xf682('0x3')](_0xf682('0x26'),_0xa1954b[_0xf682('0x4')],_0xa1954b[_0xf682('0x8')],dials[_0xa1954b[_0xf682('0x4')]][_0xf682('0x24')]));}else{utils[_0xf682('0x2')](util['format'](_0xf682('0x27'),_0xa1954b[_0xf682('0x4')],_0xa1954b[_0xf682('0x8')]));}}}catch(_0x43201e){utils[_0xf682('0x13')](util[_0xf682('0x3')](_0xf682('0x22'),_0xa1954b[_0xf682('0x4')]),_0x43201e);}};exports[_0xf682('0x28')]=function(_0x574f13){try{if(!_[_0xf682('0x16')](dials[_0x574f13[_0xf682('0x4')]])){utils['debug'](util[_0xf682('0x3')](_0xf682('0x29'),_0x574f13[_0xf682('0x4')]),_0x574f13);utils[_0xf682('0x2')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x574f13[_0xf682('0x4')],_0x574f13['calleridnum'],_0x574f13[_0xf682('0x2a')],_0x574f13[_0xf682('0x2b')]));dials[_0x574f13[_0xf682('0x4')]]=_[_0xf682('0x1d')](dials[_0x574f13[_0xf682('0x4')]],{'endtime':utils[_0xf682('0x1e')](),'lastevent':_0xf682('0x2c')});dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x2d')]=utils[_0xf682('0x2e')](dials[_0x574f13[_0xf682('0x4')]]['endtime'],dials[_0x574f13[_0xf682('0x4')]]['starttime']);dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x2f')]=utils[_0xf682('0x2e')](dials[_0x574f13[_0xf682('0x4')]]['answertime']||dials[_0x574f13['uniqueid']][_0xf682('0x30')],dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x31')]);dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x32')]=dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x24')]?utils['diffTime'](dials[_0x574f13[_0xf682('0x4')]][_0xf682('0x30')],dials[_0x574f13[_0xf682('0x4')]]['answertime']):0x0;writeDB(dials[_0x574f13[_0xf682('0x4')]]);}}catch(_0x4fa1ba){utils[_0xf682('0x13')](util['format']('[%s][dials][hangup]',_0x574f13[_0xf682('0x4')]),_0x4fa1ba);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 56e520d..b1d75da 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 _0x207e=['uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','xdr','disabled','env','production','port','asterisk','username','password','XDR\x20DISABLED','info','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','error','close','managerevent','devicestatechange','debug','device','format','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]'];(function(_0x4c9d22,_0x20e504){var _0x34841a=function(_0x3184c3){while(--_0x3184c3){_0x4c9d22['push'](_0x4c9d22['shift']());}};_0x34841a(++_0x20e504);}(_0x207e,0xeb));var _0xe207=function(_0x57f8fd,_0x288c04){_0x57f8fd=_0x57f8fd-0x0;var _0x4d0da8=_0x207e[_0x57f8fd];return _0x4d0da8;};var AsteriskManager=require('asterisk-manager');var config=require(_0xe207('0x0'));var utils=require('./utils');var util=require('util');var isXDREnabled=config[_0xe207('0x1')]&&config['xdr'][_0xe207('0x2')]?!config[_0xe207('0x1')][_0xe207('0x2')]:!![];var isProduction=config[_0xe207('0x3')]===_0xe207('0x4')||![];var isLocalAsterisk=config[_0xe207('0x1')]&&config[_0xe207('0x1')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xe207('0x5')],config['asterisk']['ip'],config[_0xe207('0x6')][_0xe207('0x7')],config[_0xe207('0x6')][_0xe207('0x8')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0xe207('0x9'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xe207('0xa')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xe207('0xb'));var calls=require(_0xe207('0xc'));var queues=require(_0xe207('0xd'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0xe207('0xe'));var transfers=require(_0xe207('0xf'));var core=require(_0xe207('0x10'));ami['on'](_0xe207('0x11'),core['connect']);ami['on'](_0xe207('0x12'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0xe207('0x13'),core[_0xe207('0x13')]);ami['on'](_0xe207('0x14'),core[_0xe207('0x14')]);ami['on'](_0xe207('0x15'),core[_0xe207('0x15')]);ami['on'](_0xe207('0x16'),function(_0x163d35){try{utils[_0xe207('0x17')](util['format']('[%s][index][devicestatechange]',_0x163d35[_0xe207('0x18')]),_0x163d35);members[_0xe207('0x16')](_0x163d35);}catch(_0x38d741){utils[_0xe207('0x13')](util[_0xe207('0x19')](_0xe207('0x1a'),_0x163d35[_0xe207('0x18')]),_0x38d741);}});ami['on'](_0xe207('0x1b'),function(_0x4058b7){try{utils[_0xe207('0x17')](util[_0xe207('0x19')](_0xe207('0x1c'),_0x4058b7[_0xe207('0x1d')]),_0x4058b7);agents[_0xe207('0x1b')](_0x4058b7);}catch(_0x4edab6){utils[_0xe207('0x13')](util[_0xe207('0x19')]('[%s][index][agentcalled]',_0x4058b7[_0xe207('0x1d')]),_0x4edab6);}});ami['on']('agentringnoanswer',function(_0x4b293d){try{utils['debug'](util['format'](_0xe207('0x1e'),_0x4b293d[_0xe207('0x1d')]),_0x4b293d);agents['agentringnoanswer'](_0x4b293d);}catch(_0x213d13){utils['error'](util[_0xe207('0x19')]('[%s][index][agentringnoanswer]',_0x4b293d[_0xe207('0x1d')]),_0x213d13);}});ami['on'](_0xe207('0x1f'),function(_0x11dfa7){try{utils['debug'](util['format'](_0xe207('0x20'),_0x11dfa7[_0xe207('0x1d')]),_0x11dfa7);agents[_0xe207('0x1f')](_0x11dfa7);queues[_0xe207('0x1f')](_0x11dfa7);}catch(_0x343c5e){utils[_0xe207('0x13')](util[_0xe207('0x19')](_0xe207('0x20'),_0x11dfa7[_0xe207('0x1d')]),_0x343c5e);}});ami['on'](_0xe207('0x21'),function(_0x4378ed){try{utils[_0xe207('0x17')](util['format'](_0xe207('0x22'),_0x4378ed[_0xe207('0x1d')]),_0x4378ed);agents[_0xe207('0x21')](_0x4378ed);queues['agentcomplete'](_0x4378ed);members['agentcomplete'](_0x4378ed);}catch(_0x5900e9){utils['error'](util[_0xe207('0x19')]('[%s][index][agentcomplete]',_0x4378ed[_0xe207('0x1d')]),_0x5900e9);}});ami['on'](_0xe207('0x23'),function(_0x1eb0db){try{utils[_0xe207('0x17')](util[_0xe207('0x19')]('[%s][index][queuecallerabandon]',_0x1eb0db[_0xe207('0x1d')]),_0x1eb0db);agents[_0xe207('0x23')](_0x1eb0db);queues[_0xe207('0x23')](_0x1eb0db);}catch(_0x5bfa0f){utils['error'](util[_0xe207('0x19')](_0xe207('0x24'),_0x1eb0db['uniqueid']),_0x5bfa0f);}});ami['on'](_0xe207('0x25'),function(_0x3f78db){try{utils[_0xe207('0x17')](util['format'](_0xe207('0x26'),_0x3f78db['uniqueid']),_0x3f78db);queues['queuecallerjoin'](_0x3f78db);recordings[_0xe207('0x25')](_0x3f78db);}catch(_0x18277e){utils[_0xe207('0x13')](util['format']('[%s][index][queuecallerjoin]',_0x3f78db[_0xe207('0x1d')]),_0x18277e);}});ami['on'](_0xe207('0x27'),function(_0x32d639){try{utils[_0xe207('0x17')](util['format'](_0xe207('0x28'),_0x32d639[_0xe207('0x1d')]),_0x32d639);queues[_0xe207('0x27')](_0x32d639);}catch(_0x54ee37){utils[_0xe207('0x13')](util[_0xe207('0x19')](_0xe207('0x28'),_0x32d639['uniqueid']),_0x54ee37);}});ami['on'](_0xe207('0x29'),function(_0x545f37){try{utils['debug'](util[_0xe207('0x19')](_0xe207('0x2a'),_0x545f37[_0xe207('0x1d')]),_0x545f37);queues[_0xe207('0x29')](_0x545f37);calls['musiconholdstart'](_0x545f37);}catch(_0x3b1bde){utils['error'](util['format'](_0xe207('0x2a'),_0x545f37[_0xe207('0x1d')]),_0x3b1bde);}});ami['on'](_0xe207('0x2b'),function(_0x3eaa34){try{utils[_0xe207('0x17')](util[_0xe207('0x19')](_0xe207('0x2c'),_0x3eaa34[_0xe207('0x1d')]),_0x3eaa34);queues[_0xe207('0x2b')](_0x3eaa34);calls[_0xe207('0x2b')](_0x3eaa34);}catch(_0x3d689e){utils[_0xe207('0x13')](util[_0xe207('0x19')]('[%s][index][musiconholdstop]',_0x3eaa34[_0xe207('0x1d')]),_0x3d689e);}});ami['on'](_0xe207('0x2d'),function(_0x168420){try{utils['debug'](util[_0xe207('0x19')](_0xe207('0x2e'),_0x168420[_0xe207('0x1d')]),_0x168420);calls[_0xe207('0x2d')](_0x168420);recordings[_0xe207('0x2d')](_0x168420);}catch(_0x3b0bfe){utils[_0xe207('0x13')](util[_0xe207('0x19')](_0xe207('0x2e'),_0x168420['uniqueid']),_0x3b0bfe);}});ami['on']('hangup',function(_0x2cec54){try{utils[_0xe207('0x17')](util[_0xe207('0x19')](_0xe207('0x2f'),_0x2cec54[_0xe207('0x1d')]),_0x2cec54);calls[_0xe207('0x30')](_0x2cec54);recordings[_0xe207('0x30')](_0x2cec54);dials['hangup'](_0x2cec54);agents[_0xe207('0x30')](_0x2cec54);queues[_0xe207('0x30')](_0x2cec54);}catch(_0x1b3b14){utils[_0xe207('0x13')](util[_0xe207('0x19')]('[%s][index][hangup]',_0x2cec54[_0xe207('0x1d')]),_0x1b3b14);}});ami['on'](_0xe207('0x31'),function(_0x210803){try{utils[_0xe207('0x17')](util[_0xe207('0x19')](_0xe207('0x32'),_0x210803[_0xe207('0x1d')]),_0x210803);members[_0xe207('0x31')](_0x210803);}catch(_0xb14986){utils[_0xe207('0x13')](util['format'](_0xe207('0x32'),_0x210803[_0xe207('0x1d')]),_0xb14986);}});ami['on'](_0xe207('0x33'),function(_0x103cba){try{utils['debug'](util[_0xe207('0x19')](_0xe207('0x34'),_0x103cba[_0xe207('0x1d')]),_0x103cba);queues[_0xe207('0x33')](_0x103cba);agents[_0xe207('0x33')](_0x103cba);transfers[_0xe207('0x33')](_0x103cba);recordings[_0xe207('0x33')](_0x103cba);}catch(_0x1119ef){utils[_0xe207('0x13')](util[_0xe207('0x19')]('[%s][index][blindtransfer]',_0x103cba[_0xe207('0x1d')]),_0x1119ef);}});ami['on'](_0xe207('0x35'),function(_0x4def8b){try{utils[_0xe207('0x17')](util[_0xe207('0x19')](_0xe207('0x36'),_0x4def8b['origtransfereruniqueid']),_0x4def8b);queues[_0xe207('0x35')](_0x4def8b);transfers[_0xe207('0x35')](_0x4def8b);agents[_0xe207('0x35')](_0x4def8b);calls[_0xe207('0x35')](_0x4def8b);}catch(_0x1647bc){utils[_0xe207('0x13')](util[_0xe207('0x19')](_0xe207('0x36'),_0x4def8b[_0xe207('0x37')]),_0x1647bc);}});ami['on'](_0xe207('0x38'),function(_0x4d1bbf){try{utils['debug'](util['format'](_0xe207('0x39'),_0x4d1bbf['uniqueid']),_0x4d1bbf);queues[_0xe207('0x38')](_0x4d1bbf);recordings[_0xe207('0x38')](_0x4d1bbf);calls[_0xe207('0x38')](_0x4d1bbf);dials[_0xe207('0x38')](_0x4d1bbf);}catch(_0x511f5c){utils['error'](util[_0xe207('0x19')](_0xe207('0x39'),_0x4d1bbf['uniqueid']),_0x511f5c);}});ami['on'](_0xe207('0x3a'),function(_0xad8148){try{utils[_0xe207('0x17')](util[_0xe207('0x19')](_0xe207('0x3b'),_0xad8148[_0xe207('0x1d')]),_0xad8148);calls[_0xe207('0x3a')](_0xad8148);recordings[_0xe207('0x3a')](_0xad8148);dials[_0xe207('0x3a')](_0xad8148);}catch(_0x326321){utils['error'](util[_0xe207('0x19')](_0xe207('0x3b'),_0xad8148[_0xe207('0x1d')]),_0x326321);}});ami['on'](_0xe207('0x3c'),function(_0x19068c){try{utils[_0xe207('0x17')](util[_0xe207('0x19')](_0xe207('0x3d'),_0x19068c[_0xe207('0x1d')]),_0x19068c);calls[_0xe207('0x3c')](_0x19068c);recordings['newchannel'](_0x19068c);}catch(_0x22772a){utils[_0xe207('0x13')](util[_0xe207('0x19')](_0xe207('0x3d'),_0x19068c['uniqueid']),_0x22772a);}});ami['on']('dialbegin',function(_0x368eab){try{utils['debug'](util[_0xe207('0x19')]('[%s][index][dialbegin]',_0x368eab[_0xe207('0x1d')]),_0x368eab);dials[_0xe207('0x3e')](_0x368eab);}catch(_0x35ce2d){utils['error'](util[_0xe207('0x19')](_0xe207('0x3f'),_0x368eab[_0xe207('0x1d')]),_0x35ce2d);}});ami['on'](_0xe207('0x40'),function(_0x2e44b6){try{utils[_0xe207('0x17')](util['format']('[%s][index][dialend]',_0x2e44b6[_0xe207('0x1d')]),_0x2e44b6);dials[_0xe207('0x40')](_0x2e44b6);}catch(_0x565819){utils[_0xe207('0x13')](util[_0xe207('0x19')](_0xe207('0x41'),_0x2e44b6[_0xe207('0x1d')]),_0x565819);}});} \ No newline at end of file +var _0x7426=['port','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','[%s][index][agentcalled]','uniqueid','agentcalled','[%s][index][agentringnoanswer]','agentringnoanswer','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','env','production','local'];(function(_0x41beef,_0x9b28d4){var _0x453bf1=function(_0xc36645){while(--_0xc36645){_0x41beef['push'](_0x41beef['shift']());}};_0x453bf1(++_0x9b28d4);}(_0x7426,0x118));var _0x6742=function(_0x500cd8,_0x1df0a5){_0x500cd8=_0x500cd8-0x0;var _0x2cc571=_0x7426[_0x500cd8];return _0x2cc571;};var AsteriskManager=require(_0x6742('0x0'));var config=require(_0x6742('0x1'));var utils=require(_0x6742('0x2'));var util=require('util');var isXDREnabled=config[_0x6742('0x3')]&&config[_0x6742('0x3')][_0x6742('0x4')]?!config['xdr'][_0x6742('0x4')]:!![];var isProduction=config[_0x6742('0x5')]===_0x6742('0x6')||![];var isLocalAsterisk=config[_0x6742('0x3')]&&config[_0x6742('0x3')][_0x6742('0x7')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x6742('0x8')],config[_0x6742('0x9')]['ip'],config[_0x6742('0x9')][_0x6742('0xa')],config['asterisk'][_0x6742('0xb')],!![]);ami[_0x6742('0xc')]();if(!isXDREnabled){utils[_0x6742('0xd')](_0x6742('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x6742('0xd')](_0x6742('0xf'));}else{var agents=require('./agents.controller');var calls=require(_0x6742('0x10'));var queues=require(_0x6742('0x11'));var recordings=require('./recordings.controller');var members=require(_0x6742('0x12'));var dials=require(_0x6742('0x13'));var transfers=require(_0x6742('0x14'));var core=require(_0x6742('0x15'));ami['on'](_0x6742('0x16'),core[_0x6742('0x16')]);ami['on'](_0x6742('0x17'),core['shutdown']);ami['on'](_0x6742('0x18'),core[_0x6742('0x18')]);ami['on'](_0x6742('0x19'),core['error']);ami['on'](_0x6742('0x1a'),core[_0x6742('0x1a')]);ami['on']('managerevent',core[_0x6742('0x1b')]);ami['on'](_0x6742('0x1c'),function(_0x5a0d8e){try{utils[_0x6742('0x1d')](util['format'](_0x6742('0x1e'),_0x5a0d8e[_0x6742('0x1f')]),_0x5a0d8e);members[_0x6742('0x1c')](_0x5a0d8e);}catch(_0x224892){utils[_0x6742('0x19')](util['format'](_0x6742('0x1e'),_0x5a0d8e[_0x6742('0x1f')]),_0x224892);}});ami['on']('agentcalled',function(_0x1e9583){try{utils['debug'](util[_0x6742('0x20')](_0x6742('0x21'),_0x1e9583[_0x6742('0x22')]),_0x1e9583);agents[_0x6742('0x23')](_0x1e9583);}catch(_0x1368c2){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x21'),_0x1e9583[_0x6742('0x22')]),_0x1368c2);}});ami['on']('agentringnoanswer',function(_0x54396f){try{utils['debug'](util[_0x6742('0x20')](_0x6742('0x24'),_0x54396f[_0x6742('0x22')]),_0x54396f);agents[_0x6742('0x25')](_0x54396f);}catch(_0x29fbc8){utils['error'](util[_0x6742('0x20')](_0x6742('0x24'),_0x54396f['uniqueid']),_0x29fbc8);}});ami['on']('agentconnect',function(_0x3ebdf9){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x26'),_0x3ebdf9[_0x6742('0x22')]),_0x3ebdf9);agents[_0x6742('0x27')](_0x3ebdf9);queues['agentconnect'](_0x3ebdf9);}catch(_0x5f0a69){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x26'),_0x3ebdf9[_0x6742('0x22')]),_0x5f0a69);}});ami['on'](_0x6742('0x28'),function(_0x5d2821){try{utils[_0x6742('0x1d')](util['format'](_0x6742('0x29'),_0x5d2821[_0x6742('0x22')]),_0x5d2821);agents[_0x6742('0x28')](_0x5d2821);queues[_0x6742('0x28')](_0x5d2821);members[_0x6742('0x28')](_0x5d2821);}catch(_0x3d93d0){utils[_0x6742('0x19')](util[_0x6742('0x20')]('[%s][index][agentcomplete]',_0x5d2821[_0x6742('0x22')]),_0x3d93d0);}});ami['on']('queuecallerabandon',function(_0x39b5b8){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')]('[%s][index][queuecallerabandon]',_0x39b5b8['uniqueid']),_0x39b5b8);agents[_0x6742('0x2a')](_0x39b5b8);queues[_0x6742('0x2a')](_0x39b5b8);}catch(_0x60f76f){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x2b'),_0x39b5b8[_0x6742('0x22')]),_0x60f76f);}});ami['on'](_0x6742('0x2c'),function(_0x49155d){try{utils['debug'](util[_0x6742('0x20')](_0x6742('0x2d'),_0x49155d[_0x6742('0x22')]),_0x49155d);queues['queuecallerjoin'](_0x49155d);recordings['queuecallerjoin'](_0x49155d);}catch(_0x675a6c){utils['error'](util['format'](_0x6742('0x2d'),_0x49155d[_0x6742('0x22')]),_0x675a6c);}});ami['on'](_0x6742('0x2e'),function(_0x21a440){try{utils[_0x6742('0x1d')](util['format'](_0x6742('0x2f'),_0x21a440[_0x6742('0x22')]),_0x21a440);queues[_0x6742('0x2e')](_0x21a440);}catch(_0x201d06){utils[_0x6742('0x19')](util['format'](_0x6742('0x2f'),_0x21a440[_0x6742('0x22')]),_0x201d06);}});ami['on'](_0x6742('0x30'),function(_0x26aac6){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x31'),_0x26aac6['uniqueid']),_0x26aac6);queues['musiconholdstart'](_0x26aac6);calls[_0x6742('0x30')](_0x26aac6);}catch(_0x22a832){utils[_0x6742('0x19')](util['format'](_0x6742('0x31'),_0x26aac6[_0x6742('0x22')]),_0x22a832);}});ami['on'](_0x6742('0x32'),function(_0x372c34){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')]('[%s][index][musiconholdstop]',_0x372c34[_0x6742('0x22')]),_0x372c34);queues['musiconholdstop'](_0x372c34);calls[_0x6742('0x32')](_0x372c34);}catch(_0x56011b){utils['error'](util[_0x6742('0x20')](_0x6742('0x33'),_0x372c34['uniqueid']),_0x56011b);}});ami['on'](_0x6742('0x34'),function(_0x319f71){try{utils['debug'](util[_0x6742('0x20')]('[%s][index][newstate]',_0x319f71[_0x6742('0x22')]),_0x319f71);calls[_0x6742('0x34')](_0x319f71);recordings[_0x6742('0x34')](_0x319f71);}catch(_0x1e169b){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x35'),_0x319f71[_0x6742('0x22')]),_0x1e169b);}});ami['on'](_0x6742('0x36'),function(_0x1b61ba){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x37'),_0x1b61ba[_0x6742('0x22')]),_0x1b61ba);calls[_0x6742('0x36')](_0x1b61ba);recordings['hangup'](_0x1b61ba);dials[_0x6742('0x36')](_0x1b61ba);agents[_0x6742('0x36')](_0x1b61ba);queues[_0x6742('0x36')](_0x1b61ba);}catch(_0x36cdc3){utils['error'](util[_0x6742('0x20')]('[%s][index][hangup]',_0x1b61ba[_0x6742('0x22')]),_0x36cdc3);}});ami['on'](_0x6742('0x38'),function(_0x41467f){try{utils[_0x6742('0x1d')](util['format'](_0x6742('0x39'),_0x41467f[_0x6742('0x22')]),_0x41467f);members[_0x6742('0x38')](_0x41467f);}catch(_0x30fe65){utils[_0x6742('0x19')](util['format'](_0x6742('0x39'),_0x41467f[_0x6742('0x22')]),_0x30fe65);}});ami['on'](_0x6742('0x3a'),function(_0x27b892){try{utils['debug'](util[_0x6742('0x20')](_0x6742('0x3b'),_0x27b892['uniqueid']),_0x27b892);queues[_0x6742('0x3a')](_0x27b892);agents[_0x6742('0x3a')](_0x27b892);transfers[_0x6742('0x3a')](_0x27b892);recordings[_0x6742('0x3a')](_0x27b892);}catch(_0x310d64){utils[_0x6742('0x19')](util['format'](_0x6742('0x3b'),_0x27b892[_0x6742('0x22')]),_0x310d64);}});ami['on']('attendedtransfer',function(_0x3b1c39){try{utils['debug'](util['format'](_0x6742('0x3c'),_0x3b1c39[_0x6742('0x3d')]),_0x3b1c39);queues[_0x6742('0x3e')](_0x3b1c39);transfers[_0x6742('0x3e')](_0x3b1c39);agents[_0x6742('0x3e')](_0x3b1c39);calls[_0x6742('0x3e')](_0x3b1c39);}catch(_0x6580cf){utils[_0x6742('0x19')](util[_0x6742('0x20')]('[%s][index][attendedtransfer]',_0x3b1c39[_0x6742('0x3d')]),_0x6580cf);}});ami['on'](_0x6742('0x3f'),function(_0x59546b){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x40'),_0x59546b['uniqueid']),_0x59546b);queues[_0x6742('0x3f')](_0x59546b);recordings[_0x6742('0x3f')](_0x59546b);calls[_0x6742('0x3f')](_0x59546b);dials[_0x6742('0x3f')](_0x59546b);}catch(_0x13566e){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x40'),_0x59546b[_0x6742('0x22')]),_0x13566e);}});ami['on']('newexten',function(_0x1116a4){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')]('[%s][index][newexten]',_0x1116a4['uniqueid']),_0x1116a4);calls[_0x6742('0x41')](_0x1116a4);recordings[_0x6742('0x41')](_0x1116a4);dials[_0x6742('0x41')](_0x1116a4);}catch(_0x3fdf34){utils[_0x6742('0x19')](util[_0x6742('0x20')]('[%s][index][newexten]',_0x1116a4[_0x6742('0x22')]),_0x3fdf34);}});ami['on'](_0x6742('0x42'),function(_0x282bdf){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x43'),_0x282bdf[_0x6742('0x22')]),_0x282bdf);calls[_0x6742('0x42')](_0x282bdf);recordings[_0x6742('0x42')](_0x282bdf);}catch(_0x54fa06){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x43'),_0x282bdf['uniqueid']),_0x54fa06);}});ami['on']('dialbegin',function(_0x54c164){try{utils['debug'](util[_0x6742('0x20')](_0x6742('0x44'),_0x54c164['uniqueid']),_0x54c164);dials[_0x6742('0x45')](_0x54c164);}catch(_0xda087b){utils[_0x6742('0x19')](util[_0x6742('0x20')](_0x6742('0x46'),_0x54c164['uniqueid']),_0xda087b);}});ami['on']('dialend',function(_0x10efa3){try{utils[_0x6742('0x1d')](util[_0x6742('0x20')](_0x6742('0x47'),_0x10efa3[_0x6742('0x22')]),_0x10efa3);dials['dialend'](_0x10efa3);}catch(_0x2e5cf3){utils['error'](util['format'](_0x6742('0x47'),_0x10efa3['uniqueid']),_0x2e5cf3);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index df49f99..aa2a8e5 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 _0x05bf=['info','state','voice','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','data1','type','destination','data3','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device'];(function(_0xab324c,_0x5b48ef){var _0x184480=function(_0x3391b7){while(--_0x3391b7){_0xab324c['push'](_0xab324c['shift']());}};_0x184480(++_0x5b48ef);}(_0x05bf,0x77));var _0xf05b=function(_0x2759bf,_0xbbf890){_0x2759bf=_0x2759bf-0x0;var _0x5d9d48=_0x05bf[_0x2759bf];return _0x5d9d48;};'use strict';var _=require(_0xf05b('0x0'));var util=require(_0xf05b('0x1'));var utils=require(_0xf05b('0x2'));var members={};var exclude=[_0xf05b('0x3'),_0xf05b('0x4')];function writeDB(_0x269b5e){utils['info'](util[_0xf05b('0x5')](_0xf05b('0x6'),_0x269b5e[_0xf05b('0x7')],_0x269b5e[_0xf05b('0x8')],_0x269b5e[_0xf05b('0x9')],_0x269b5e[_0xf05b('0xa')],_0x269b5e[_0xf05b('0xb')],_0x269b5e['type']));if(_0x269b5e[_0xf05b('0x8')]){utils['getUserByInterface'](_0x269b5e[_0xf05b('0x8')])['then'](function(_0x29e008){if(_0x29e008){_0x269b5e[_0xf05b('0xb')]=_0x29e008[_0xf05b('0xc')];_0x269b5e[_0xf05b('0xd')]=_0x29e008[_0xf05b('0xd')];utils[_0xf05b('0xe')](_0xf05b('0xf'),_0x269b5e);}else{utils[_0xf05b('0x10')](_0x269b5e[_0xf05b('0x8')][_0xf05b('0x11')]('/')[0x1])[_0xf05b('0x12')](function(_0x3a2965){if(_0x3a2965){_0x269b5e[_0xf05b('0xb')]=_0x3a2965[_0xf05b('0xc')];_0x269b5e[_0xf05b('0xd')]=_0x3a2965[_0xf05b('0xd')];utils[_0xf05b('0xe')](_0xf05b('0xf'),_0x269b5e);}});}})[_0xf05b('0x13')](function(_0xdc65c2){utils[_0xf05b('0x14')](util['format'](_0xf05b('0x15'),_0x269b5e[_0xf05b('0x7')]),_0xdc65c2);});}delete members[_0x269b5e[_0xf05b('0x8')]];}function startsWith(_0x33d254,_0x44ec07){return _[_0xf05b('0x16')](_0x33d254,function(_0xbccaf8){return _[_0xf05b('0x17')](_0x44ec07,_0xbccaf8);});}exports[_0xf05b('0x18')]=function(_0x31c1e2){try{utils[_0xf05b('0x19')](util['format'](_0xf05b('0x1a'),members[_0x31c1e2[_0xf05b('0x1b')]]?members[_0x31c1e2[_0xf05b('0x1b')]][_0xf05b('0x7')]:_0x31c1e2[_0xf05b('0x1b')]),_0x31c1e2);utils[_0xf05b('0x1c')](util['format']('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x31c1e2[_0xf05b('0x1b')]]?members[_0x31c1e2[_0xf05b('0x1b')]][_0xf05b('0x7')]:_0x31c1e2[_0xf05b('0x1b')],_0x31c1e2[_0xf05b('0x1d')],_0x31c1e2[_0xf05b('0x1b')]));switch(_0x31c1e2['state']){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x31c1e2['device'])){members[_0x31c1e2['device']]={'channel':_0xf05b('0x1e'),'interface':_0x31c1e2[_0xf05b('0x1b')],'type':'TALKING','enterAt':utils[_0xf05b('0x1f')](),'role':_0xf05b('0x20')};}break;case _0xf05b('0x21'):if(!_[_0xf05b('0x22')](members[_0x31c1e2['device']])){members[_0x31c1e2[_0xf05b('0x1b')]][_0xf05b('0x23')]=utils[_0xf05b('0x1f')]();members[_0x31c1e2['device']]['duration']=utils[_0xf05b('0x24')](members[_0x31c1e2[_0xf05b('0x1b')]][_0xf05b('0x23')],members[_0x31c1e2[_0xf05b('0x1b')]][_0xf05b('0x25')]);if(members[_0x31c1e2[_0xf05b('0x1b')]][_0xf05b('0x7')]){writeDB(members[_0x31c1e2[_0xf05b('0x1b')]]);}}break;default:break;}}catch(_0x5789df){utils[_0xf05b('0x14')](util[_0xf05b('0x5')](_0xf05b('0x1a'),members[_0x31c1e2[_0xf05b('0x1b')]]?members[_0x31c1e2['device']][_0xf05b('0x7')]:_0x31c1e2[_0xf05b('0x1b')]),_0x5789df);}};exports['agentcomplete']=function(_0x51ca1c){try{if(!_['isNil'](members[_0x51ca1c['interface']])){utils[_0xf05b('0x19')](util[_0xf05b('0x5')](_0xf05b('0x26'),_0x51ca1c[_0xf05b('0x7')]),_0x51ca1c);utils['info'](util[_0xf05b('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x51ca1c[_0xf05b('0x7')],_0x51ca1c['interface'],_0x51ca1c[_0xf05b('0x27')]));members[_0x51ca1c[_0xf05b('0x8')]]=_[_0xf05b('0x28')](members[_0x51ca1c[_0xf05b('0x8')]],{'data4':_0x51ca1c['queue'],'uniqueid':_0x51ca1c[_0xf05b('0x7')]});}}catch(_0x44a34a){utils[_0xf05b('0x14')](util[_0xf05b('0x5')]('[%s][members][agentcomplete]',_0x51ca1c[_0xf05b('0x7')]),_0x44a34a);}};exports[_0xf05b('0x29')]=function(_0x197ae6){try{utils[_0xf05b('0x19')](util['format'](_0xf05b('0x2a'),_0x197ae6[_0xf05b('0x7')]),_0x197ae6);if(_0x197ae6['channel']){var _0x5ab82a=_0x197ae6[_0xf05b('0x9')][_0xf05b('0x11')]('-')[0x0];if(!_[_0xf05b('0x22')](members[_0x5ab82a])){members[_0x5ab82a]=_[_0xf05b('0x28')](members[_0x5ab82a],{'data1':members[_0x5ab82a][_0xf05b('0x2b')]||_0x197ae6[_0xf05b('0x2c')],'data2':members[_0x5ab82a][_0xf05b('0xa')]||_0x197ae6['source'],'data3':members[_0x5ab82a]['data3']||_0x197ae6[_0xf05b('0x2d')],'uniqueid':members[_0x5ab82a]['uniqueid']||_0x197ae6[_0xf05b('0x7')]});utils[_0xf05b('0x1c')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x197ae6[_0xf05b('0x7')],members[_0x5ab82a]['data1'],members[_0x5ab82a][_0xf05b('0xa')],members[_0x5ab82a][_0xf05b('0x2e')]));if(members[_0x5ab82a][_0xf05b('0x23')]){writeDB(members[_0x5ab82a]);}}}if(_0x197ae6['destinationchannel']){var _0x2e3e7b=_0x197ae6[_0xf05b('0x2f')][_0xf05b('0x11')]('-')[0x0];if(!_[_0xf05b('0x22')](members[_0x2e3e7b])){members[_0x2e3e7b]=_[_0xf05b('0x28')](members[_0x2e3e7b],{'data1':members[_0x2e3e7b][_0xf05b('0x2b')]||_0x197ae6['type'],'data2':members[_0x2e3e7b][_0xf05b('0xa')]||_0x197ae6[_0xf05b('0x30')],'data3':members[_0x2e3e7b][_0xf05b('0x2e')]||_0x197ae6[_0xf05b('0x2d')],'uniqueid':members[_0x2e3e7b][_0xf05b('0x7')]||_0x197ae6[_0xf05b('0x7')]});utils[_0xf05b('0x1c')](util[_0xf05b('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x197ae6[_0xf05b('0x7')],members[_0x2e3e7b][_0xf05b('0x2b')],members[_0x2e3e7b]['data2'],members[_0x2e3e7b]['data3']));if(members[_0x2e3e7b]['exitAt']){writeDB(members[_0x2e3e7b]);}}}}catch(_0x4a5414){utils['error'](util['format'](_0xf05b('0x2a'),_0x197ae6[_0xf05b('0x7')]),_0x4a5414);}}; \ No newline at end of file +var _0xd5b6=['queue','[%s][members][agentcomplete]','[%s][members][cdr]','assign','data1','data2','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','destination','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','interface','channel','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','error','[%s][members][writeDB]','devicestatechange','[%s][members][devicestatechange]','device','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','agentcomplete','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s'];(function(_0x2f77ea,_0x195537){var _0x1aab38=function(_0x79ec33){while(--_0x79ec33){_0x2f77ea['push'](_0x2f77ea['shift']());}};_0x1aab38(++_0x195537);}(_0xd5b6,0x73));var _0x6d5b=function(_0x25a6dd,_0x3101b3){_0x25a6dd=_0x25a6dd-0x0;var _0xe62e7=_0xd5b6[_0x25a6dd];return _0xe62e7;};'use strict';var _=require(_0x6d5b('0x0'));var util=require(_0x6d5b('0x1'));var utils=require(_0x6d5b('0x2'));var members={};var exclude=[_0x6d5b('0x3'),_0x6d5b('0x4')];function writeDB(_0x3d9bc9){utils[_0x6d5b('0x5')](util[_0x6d5b('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x3d9bc9[_0x6d5b('0x7')],_0x3d9bc9[_0x6d5b('0x8')],_0x3d9bc9[_0x6d5b('0x9')],_0x3d9bc9['data2'],_0x3d9bc9[_0x6d5b('0xa')],_0x3d9bc9[_0x6d5b('0xb')]));if(_0x3d9bc9[_0x6d5b('0x8')]){utils[_0x6d5b('0xc')](_0x3d9bc9['interface'])['then'](function(_0x309bc9){if(_0x309bc9){_0x3d9bc9[_0x6d5b('0xa')]=_0x309bc9[_0x6d5b('0xd')];_0x3d9bc9[_0x6d5b('0xe')]=_0x309bc9[_0x6d5b('0xe')];utils[_0x6d5b('0xf')](_0x6d5b('0x10'),_0x3d9bc9);}else{utils[_0x6d5b('0x11')](_0x3d9bc9[_0x6d5b('0x8')][_0x6d5b('0x12')]('/')[0x1])[_0x6d5b('0x13')](function(_0x33113f){if(_0x33113f){_0x3d9bc9[_0x6d5b('0xa')]=_0x33113f[_0x6d5b('0xd')];_0x3d9bc9[_0x6d5b('0xe')]=_0x33113f[_0x6d5b('0xe')];utils[_0x6d5b('0xf')](_0x6d5b('0x10'),_0x3d9bc9);}});}})['catch'](function(_0x2be3ab){utils[_0x6d5b('0x14')](util[_0x6d5b('0x6')](_0x6d5b('0x15'),_0x3d9bc9[_0x6d5b('0x7')]),_0x2be3ab);});}delete members[_0x3d9bc9['interface']];}function startsWith(_0x3c8078,_0x1e6814){return _['some'](_0x3c8078,function(_0x2baf47){return _['startsWith'](_0x1e6814,_0x2baf47);});}exports[_0x6d5b('0x16')]=function(_0x4dfd99){try{utils['debug'](util['format'](_0x6d5b('0x17'),members[_0x4dfd99[_0x6d5b('0x18')]]?members[_0x4dfd99[_0x6d5b('0x18')]]['uniqueid']:_0x4dfd99[_0x6d5b('0x18')]),_0x4dfd99);utils[_0x6d5b('0x5')](util[_0x6d5b('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4dfd99[_0x6d5b('0x18')]]?members[_0x4dfd99['device']][_0x6d5b('0x7')]:_0x4dfd99[_0x6d5b('0x18')],_0x4dfd99[_0x6d5b('0x19')],_0x4dfd99['device']));switch(_0x4dfd99[_0x6d5b('0x19')]){case _0x6d5b('0x1a'):case _0x6d5b('0x1b'):if(!startsWith(exclude,_0x4dfd99[_0x6d5b('0x18')])){members[_0x4dfd99[_0x6d5b('0x18')]]={'channel':_0x6d5b('0x1c'),'interface':_0x4dfd99[_0x6d5b('0x18')],'type':_0x6d5b('0x1d'),'enterAt':utils[_0x6d5b('0x1e')](),'role':_0x6d5b('0x1f')};}break;case _0x6d5b('0x20'):if(!_[_0x6d5b('0x21')](members[_0x4dfd99[_0x6d5b('0x18')]])){members[_0x4dfd99[_0x6d5b('0x18')]]['exitAt']=utils[_0x6d5b('0x1e')]();members[_0x4dfd99['device']][_0x6d5b('0x22')]=utils[_0x6d5b('0x23')](members[_0x4dfd99[_0x6d5b('0x18')]][_0x6d5b('0x24')],members[_0x4dfd99[_0x6d5b('0x18')]][_0x6d5b('0x25')]);if(members[_0x4dfd99[_0x6d5b('0x18')]][_0x6d5b('0x7')]){writeDB(members[_0x4dfd99[_0x6d5b('0x18')]]);}}break;default:break;}}catch(_0x2076f1){utils[_0x6d5b('0x14')](util[_0x6d5b('0x6')](_0x6d5b('0x17'),members[_0x4dfd99['device']]?members[_0x4dfd99['device']]['uniqueid']:_0x4dfd99[_0x6d5b('0x18')]),_0x2076f1);}};exports[_0x6d5b('0x26')]=function(_0x2d0da5){try{if(!_['isNil'](members[_0x2d0da5[_0x6d5b('0x8')]])){utils[_0x6d5b('0x27')](util['format']('[%s][members][agentcomplete]',_0x2d0da5[_0x6d5b('0x7')]),_0x2d0da5);utils[_0x6d5b('0x5')](util[_0x6d5b('0x6')](_0x6d5b('0x28'),_0x2d0da5[_0x6d5b('0x7')],_0x2d0da5['interface'],_0x2d0da5['queue']));members[_0x2d0da5[_0x6d5b('0x8')]]=_['assign'](members[_0x2d0da5[_0x6d5b('0x8')]],{'data4':_0x2d0da5[_0x6d5b('0x29')],'uniqueid':_0x2d0da5[_0x6d5b('0x7')]});}}catch(_0x2185b4){utils[_0x6d5b('0x14')](util[_0x6d5b('0x6')](_0x6d5b('0x2a'),_0x2d0da5[_0x6d5b('0x7')]),_0x2185b4);}};exports['cdr']=function(_0x2cea5e){try{utils[_0x6d5b('0x27')](util[_0x6d5b('0x6')](_0x6d5b('0x2b'),_0x2cea5e[_0x6d5b('0x7')]),_0x2cea5e);if(_0x2cea5e[_0x6d5b('0x9')]){var _0x3e7d94=_0x2cea5e[_0x6d5b('0x9')]['split']('-')[0x0];if(!_[_0x6d5b('0x21')](members[_0x3e7d94])){members[_0x3e7d94]=_[_0x6d5b('0x2c')](members[_0x3e7d94],{'data1':members[_0x3e7d94][_0x6d5b('0x2d')]||_0x2cea5e[_0x6d5b('0xb')],'data2':members[_0x3e7d94][_0x6d5b('0x2e')]||_0x2cea5e[_0x6d5b('0x2f')],'data3':members[_0x3e7d94]['data3']||_0x2cea5e['destination'],'uniqueid':members[_0x3e7d94][_0x6d5b('0x7')]||_0x2cea5e[_0x6d5b('0x7')]});utils[_0x6d5b('0x5')](util[_0x6d5b('0x6')](_0x6d5b('0x30'),_0x2cea5e[_0x6d5b('0x7')],members[_0x3e7d94][_0x6d5b('0x2d')],members[_0x3e7d94][_0x6d5b('0x2e')],members[_0x3e7d94][_0x6d5b('0x31')]));if(members[_0x3e7d94][_0x6d5b('0x24')]){writeDB(members[_0x3e7d94]);}}}if(_0x2cea5e[_0x6d5b('0x32')]){var _0x55915a=_0x2cea5e['destinationchannel'][_0x6d5b('0x12')]('-')[0x0];if(!_[_0x6d5b('0x21')](members[_0x55915a])){members[_0x55915a]=_[_0x6d5b('0x2c')](members[_0x55915a],{'data1':members[_0x55915a][_0x6d5b('0x2d')]||_0x2cea5e['type'],'data2':members[_0x55915a][_0x6d5b('0x2e')]||_0x2cea5e[_0x6d5b('0x2f')],'data3':members[_0x55915a][_0x6d5b('0x31')]||_0x2cea5e[_0x6d5b('0x33')],'uniqueid':members[_0x55915a][_0x6d5b('0x7')]||_0x2cea5e[_0x6d5b('0x7')]});utils[_0x6d5b('0x5')](util[_0x6d5b('0x6')](_0x6d5b('0x30'),_0x2cea5e[_0x6d5b('0x7')],members[_0x55915a][_0x6d5b('0x2d')],members[_0x55915a][_0x6d5b('0x2e')],members[_0x55915a][_0x6d5b('0x31')]));if(members[_0x55915a]['exitAt']){writeDB(members[_0x55915a]);}}}}catch(_0x5ae3e4){utils[_0x6d5b('0x14')](util[_0x6d5b('0x6')](_0x6d5b('0x2b'),_0x2cea5e[_0x6d5b('0x7')]),_0x5ae3e4);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 5d2af3b..b9cc146 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 _0x5d74=['origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transferuniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','CONTINUE','queuecallerabandonAt','now','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','BLINDTRANSFER','[%s][queues][attendedtransfer]'];(function(_0x3bb5e2,_0x5f4621){var _0x1efc34=function(_0x45165d){while(--_0x45165d){_0x3bb5e2['push'](_0x3bb5e2['shift']());}};_0x1efc34(++_0x5f4621);}(_0x5d74,0x15c));var _0x45d7=function(_0x5db258,_0x3d8957){_0x5db258=_0x5db258-0x0;var _0x953b76=_0x5d74[_0x5db258];return _0x953b76;};'use strict';var _=require(_0x45d7('0x0'));var util=require('util');var utils=require(_0x45d7('0x1'));var queues={};function writeDB(_0x2f266b){utils[_0x45d7('0x2')](util['format'](_0x45d7('0x3'),_0x2f266b[_0x45d7('0x4')],_0x2f266b[_0x45d7('0x5')],_0x2f266b[_0x45d7('0x6')],_0x2f266b[_0x45d7('0x7')],_0x2f266b['calleridnum'],_0x2f266b[_0x45d7('0x8')],_0x2f266b[_0x45d7('0x9')]));if(_0x2f266b['queue']){utils[_0x45d7('0xa')](_0x2f266b[_0x45d7('0x6')])[_0x45d7('0xb')](function(_0x3317b1){if(_0x3317b1){_0x2f266b[_0x45d7('0xc')]=_0x3317b1['type'];}utils[_0x45d7('0xd')](_0x45d7('0xe'),_0x2f266b);});}else{utils['request']('CreateVoiceQueueReport',_0x2f266b);}if(_0x2f266b[_0x45d7('0xf')]){delete queues[_0x2f266b[_0x45d7('0xf')]];}else{delete queues[_0x2f266b[_0x45d7('0x4')]];}}exports[_0x45d7('0x10')]=function(_0x3331d7){try{utils[_0x45d7('0x11')](util['format'](_0x45d7('0x12'),_0x3331d7[_0x45d7('0x4')]),_0x3331d7);utils[_0x45d7('0x2')](util[_0x45d7('0x13')](_0x45d7('0x14'),_0x3331d7[_0x45d7('0x4')],_0x3331d7[_0x45d7('0x6')],_0x3331d7[_0x45d7('0x15')]));queues[_0x3331d7[_0x45d7('0x4')]]=_['assign'](_0x3331d7,{'originalposition':_0x3331d7[_0x45d7('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x55974f){utils[_0x45d7('0x16')](util['format'](_0x45d7('0x12'),_0x3331d7[_0x45d7('0x4')]),_0x55974f);}};exports[_0x45d7('0x17')]=function(_0x10e96a){try{if(!_[_0x45d7('0x18')](queues[_0x10e96a[_0x45d7('0x4')]])){utils[_0x45d7('0x11')](util['format'](_0x45d7('0x19'),_0x10e96a[_0x45d7('0x4')]),_0x10e96a);if(queues[_0x10e96a['uniqueid']][_0x45d7('0x1a')]){if(!queues[_0x10e96a['uniqueid']][_0x45d7('0x1b')]&&!queues[_0x10e96a['uniqueid']][_0x45d7('0x1c')]){queues[_0x10e96a[_0x45d7('0x4')]][_0x45d7('0x1d')]=!![];queues[_0x10e96a[_0x45d7('0x4')]]['queuecallercompleteAt']=utils['now']();queues[_0x10e96a[_0x45d7('0x4')]][_0x45d7('0x9')]='COMPLETEDBYAGENT';}utils[_0x45d7('0x2')](util[_0x45d7('0x13')](_0x45d7('0x1e'),_0x10e96a[_0x45d7('0x4')],queues[_0x10e96a[_0x45d7('0x4')]]['name'],queues[_0x10e96a[_0x45d7('0x4')]][_0x45d7('0x9')]));writeDB(queues[_0x10e96a['uniqueid']]);}else if(queues[_0x10e96a[_0x45d7('0x4')]][_0x45d7('0xf')]){utils[_0x45d7('0x2')](util[_0x45d7('0x13')](_0x45d7('0x1f'),_0x10e96a[_0x45d7('0x4')],queues[_0x10e96a[_0x45d7('0x4')]][_0x45d7('0x20')],queues[_0x10e96a['uniqueid']][_0x45d7('0xf')]));queues[queues[_0x10e96a[_0x45d7('0x4')]][_0x45d7('0xf')]]=queues[_0x10e96a['uniqueid']];queues[queues[_0x10e96a[_0x45d7('0x4')]][_0x45d7('0xf')]][_0x45d7('0x21')]=0x2;delete queues[_0x10e96a[_0x45d7('0x4')]];}}}catch(_0x199247){utils['error'](util['format']('[%s][queues][hangup]',_0x10e96a[_0x45d7('0x4')]),_0x199247);}};exports[_0x45d7('0x22')]=function(_0x346f44){try{utils[_0x45d7('0x11')](util[_0x45d7('0x13')](_0x45d7('0x23'),_0x346f44[_0x45d7('0x4')]),_0x346f44);if(!_['isNil'](_0x346f44[_0x45d7('0x24')][_0x45d7('0x25')])&&_0x346f44['value']['toUpperCase']()!==_0x45d7('0x26')){if(!_[_0x45d7('0x18')](queues[_0x346f44[_0x45d7('0x4')]])){queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x1b')]=![];queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x27')]=null;queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x1c')]=!![];queues[_0x346f44[_0x45d7('0x4')]]['queuecallerexitAt']=utils[_0x45d7('0x28')]();queues[_0x346f44['uniqueid']][_0x45d7('0x9')]=_0x346f44[_0x45d7('0x29')][_0x45d7('0x2a')]();utils[_0x45d7('0x2')](util[_0x45d7('0x13')](_0x45d7('0x2b'),_0x346f44['uniqueid'],queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x20')],_0x346f44['value'],queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x9')]));writeDB(queues[_0x346f44[_0x45d7('0x4')]]);}}else if(!_[_0x45d7('0x18')](_0x346f44[_0x45d7('0x24')][_0x45d7('0x2c')])){if(!_[_0x45d7('0x18')](queues[_0x346f44['uniqueid']])&&!queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x1b')]){queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x1b')]=![];queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x27')]=null;queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x1c')]=!![];queues[_0x346f44['uniqueid']][_0x45d7('0x2d')]=utils[_0x45d7('0x28')]();queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x9')]=_0x45d7('0x2e');utils[_0x45d7('0x2')](util['format'](_0x45d7('0x2f'),_0x346f44['uniqueid'],queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x20')],_0x346f44[_0x45d7('0x29')],queues[_0x346f44[_0x45d7('0x4')]][_0x45d7('0x9')]));}}}catch(_0x1596ce){utils[_0x45d7('0x16')](util[_0x45d7('0x13')]('[%s][queues][varset]',_0x346f44[_0x45d7('0x4')]),_0x1596ce);}};exports[_0x45d7('0x1b')]=function(_0x1680f1){try{if(!_[_0x45d7('0x18')](queues[_0x1680f1[_0x45d7('0x4')]])){utils[_0x45d7('0x11')](util['format'](_0x45d7('0x30'),_0x1680f1[_0x45d7('0x4')]),_0x1680f1);queues[_0x1680f1[_0x45d7('0x4')]]['queuecallerexit']=![];queues[_0x1680f1[_0x45d7('0x4')]][_0x45d7('0x2d')]=null;queues[_0x1680f1[_0x45d7('0x4')]][_0x45d7('0x1b')]=!![];queues[_0x1680f1[_0x45d7('0x4')]][_0x45d7('0x27')]=utils['now']();queues[_0x1680f1[_0x45d7('0x4')]][_0x45d7('0x9')]='ABANDONED';utils[_0x45d7('0x2')](util['format'](_0x45d7('0x31'),_0x1680f1[_0x45d7('0x4')],queues[_0x1680f1[_0x45d7('0x4')]]['name'],queues[_0x1680f1[_0x45d7('0x4')]][_0x45d7('0x9')]));}}catch(_0x46852c){utils[_0x45d7('0x16')](util[_0x45d7('0x13')](_0x45d7('0x30'),_0x1680f1[_0x45d7('0x4')]),_0x46852c);}};exports['queuecallerleave']=function(_0xa31de0){try{if(!_[_0x45d7('0x18')](queues[_0xa31de0[_0x45d7('0x4')]])){utils['debug'](util[_0x45d7('0x13')](_0x45d7('0x32'),_0xa31de0[_0x45d7('0x4')]),_0xa31de0);utils[_0x45d7('0x2')](util['format'](_0x45d7('0x33'),_0xa31de0[_0x45d7('0x4')],queues[_0xa31de0[_0x45d7('0x4')]][_0x45d7('0x20')],_0xa31de0[_0x45d7('0x34')],_0xa31de0['connectedlinename']));queues[_0xa31de0['uniqueid']]['queuecallerleave']=!![];queues[_0xa31de0['uniqueid']][_0x45d7('0x1a')]=utils[_0x45d7('0x28')]();queues[_0xa31de0['uniqueid']]['holdtime']=utils[_0x45d7('0x35')](queues[_0xa31de0[_0x45d7('0x4')]][_0x45d7('0x1a')],queues[_0xa31de0[_0x45d7('0x4')]][_0x45d7('0x36')]);queues[_0xa31de0[_0x45d7('0x4')]][_0x45d7('0x15')]=_0xa31de0[_0x45d7('0x15')];queues[_0xa31de0[_0x45d7('0x4')]][_0x45d7('0x37')]=_0xa31de0[_0x45d7('0x37')];queues[_0xa31de0[_0x45d7('0x4')]][_0x45d7('0x34')]=_0xa31de0[_0x45d7('0x34')];queues[_0xa31de0[_0x45d7('0x4')]][_0x45d7('0x38')]=_0xa31de0['connectedlinename'];}}catch(_0x33cce4){utils[_0x45d7('0x16')](util[_0x45d7('0x13')](_0x45d7('0x32'),_0xa31de0[_0x45d7('0x4')]),_0x33cce4);}};exports[_0x45d7('0x39')]=function(_0x27d9a4){try{if(!_['isNil'](queues[_0x27d9a4['uniqueid']])){utils[_0x45d7('0x11')](util['format'](_0x45d7('0x3a'),_0x27d9a4[_0x45d7('0x4')]),_0x27d9a4);utils[_0x45d7('0x2')](util[_0x45d7('0x13')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x27d9a4[_0x45d7('0x4')],queues[_0x27d9a4[_0x45d7('0x4')]][_0x45d7('0x20')],_0x27d9a4['membername'],_0x27d9a4[_0x45d7('0x3b')]));queues[_0x27d9a4['uniqueid']]['queuecallerabandon']=![];queues[_0x27d9a4[_0x45d7('0x4')]][_0x45d7('0x1b')]=![];queues[_0x27d9a4[_0x45d7('0x4')]]['queuecallerabandonAt']=null;queues[_0x27d9a4['uniqueid']]['queuecallerexit']=![];queues[_0x27d9a4[_0x45d7('0x4')]][_0x45d7('0x9')]=null;queues[_0x27d9a4[_0x45d7('0x4')]][_0x45d7('0x2d')]=null;queues[_0x27d9a4[_0x45d7('0x4')]]['assigned']=!![];queues[_0x27d9a4[_0x45d7('0x4')]][_0x45d7('0x8')]=_0x27d9a4[_0x45d7('0x3b')];queues[_0x27d9a4[_0x45d7('0x4')]][_0x45d7('0x7')]=_0x27d9a4[_0x45d7('0x3c')];}}catch(_0x4dfb6b){utils[_0x45d7('0x16')](util[_0x45d7('0x13')]('[%s][queues][agentconnect]',_0x27d9a4['uniqueid']),_0x4dfb6b);}};exports[_0x45d7('0x3d')]=function(_0x487320){try{if(!_['isNil'](queues[_0x487320[_0x45d7('0x4')]])){if(queues[_0x487320['uniqueid']][_0x45d7('0x1a')]){utils[_0x45d7('0x11')](util['format'](_0x45d7('0x3e'),_0x487320[_0x45d7('0x4')]),_0x487320);queues[_0x487320[_0x45d7('0x4')]][_0x45d7('0x1b')]=![];queues[_0x487320['uniqueid']]['queuecallerabandon']=![];queues[_0x487320['uniqueid']][_0x45d7('0x27')]=null;queues[_0x487320[_0x45d7('0x4')]][_0x45d7('0x1c')]=![];queues[_0x487320[_0x45d7('0x4')]]['queuecallerexitAt']=null;queues[_0x487320[_0x45d7('0x4')]][_0x45d7('0x3f')]=!![];queues[_0x487320[_0x45d7('0x4')]][_0x45d7('0x7')]=_0x487320[_0x45d7('0x3c')];queues[_0x487320['uniqueid']][_0x45d7('0x1d')]=!![];queues[_0x487320[_0x45d7('0x4')]][_0x45d7('0x40')]=utils[_0x45d7('0x28')]();if(_0x487320['reason']==_0x45d7('0x41')){if(!queues[_0x487320[_0x45d7('0x4')]][_0x45d7('0x41')]){queues[_0x487320[_0x45d7('0x4')]]['queuecallerexitreason']=_0x45d7('0x42');}}else{queues[_0x487320['uniqueid']][_0x45d7('0x9')]='COMPLETEDBY'+_0x487320[_0x45d7('0x43')][_0x45d7('0x2a')]();}utils[_0x45d7('0x2')](util['format'](_0x45d7('0x44'),_0x487320['uniqueid'],queues[_0x487320[_0x45d7('0x4')]][_0x45d7('0x20')],_0x487320[_0x45d7('0x3c')],queues[_0x487320[_0x45d7('0x4')]][_0x45d7('0x9')]));writeDB(queues[_0x487320[_0x45d7('0x4')]]);}}}catch(_0x1e0c52){utils['error'](util['format'](_0x45d7('0x3e'),_0x487320[_0x45d7('0x4')]),_0x1e0c52);}};exports[_0x45d7('0x45')]=function(_0x16be5e){try{if(!_[_0x45d7('0x18')](queues[_0x16be5e['transfereeuniqueid']])){utils[_0x45d7('0x11')](util[_0x45d7('0x13')](_0x45d7('0x46'),_0x16be5e[_0x45d7('0x4')]),_0x16be5e);queues[_0x16be5e['transfereeuniqueid']]['transfer']=!![];queues[_0x16be5e[_0x45d7('0x47')]]['transfertype']=_0x45d7('0x48');queues[_0x16be5e['transfereeuniqueid']][_0x45d7('0x49')]=_0x16be5e['extension'];queues[_0x16be5e[_0x45d7('0x47')]]['transferuniqueid']=_0x16be5e[_0x45d7('0x47')];queues[_0x16be5e[_0x45d7('0x47')]][_0x45d7('0x9')]=_0x45d7('0x4a');utils[_0x45d7('0x2')](util[_0x45d7('0x13')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x16be5e[_0x45d7('0x4')],queues[_0x16be5e['transfereeuniqueid']][_0x45d7('0x20')],_0x16be5e[_0x45d7('0x47')],_0x16be5e['extension']));}}catch(_0x1b933b){utils[_0x45d7('0x16')](util[_0x45d7('0x13')](_0x45d7('0x46'),_0x16be5e['uniqueid']),_0x1b933b);}};exports['attendedtransfer']=function(_0x109a8e){try{utils[_0x45d7('0x11')](util[_0x45d7('0x13')](_0x45d7('0x4b'),_0x109a8e['origtransfereruniqueid']),_0x109a8e);if(_0x109a8e[_0x45d7('0x4c')]==_0x109a8e[_0x45d7('0x4d')]){if(!_['isNil'](queues[_0x109a8e[_0x45d7('0x4e')]])){utils[_0x45d7('0x2')](util[_0x45d7('0x13')](_0x45d7('0x4f'),_0x109a8e['origtransfereruniqueid'],queues[_0x109a8e[_0x45d7('0x4e')]]['name'],_0x109a8e['origtransfererexten']));queues[_0x109a8e[_0x45d7('0x4e')]]['transfer']=!![];queues[_0x109a8e[_0x45d7('0x4e')]][_0x45d7('0x50')]='ATTENDED';queues[_0x109a8e[_0x45d7('0x4e')]][_0x45d7('0x49')]=_0x109a8e[_0x45d7('0x51')];queues[_0x109a8e[_0x45d7('0x4e')]]['transferuniqueid']=_0x109a8e[_0x45d7('0x4c')];queues[_0x109a8e[_0x45d7('0x4e')]][_0x45d7('0x9')]=_0x45d7('0x52');}if(!_[_0x45d7('0x18')](queues[_0x109a8e[_0x45d7('0x4d')]])){if(_0x109a8e[_0x45d7('0x53')]&&queues[_0x109a8e[_0x45d7('0x53')]]){queues[_0x109a8e[_0x45d7('0x53')]]['queuecallerenterreason']=0x1;queues[_0x109a8e[_0x45d7('0x47')]]=_[_0x45d7('0x54')](queues[_0x109a8e[_0x45d7('0x53')]]);queues[_0x109a8e[_0x45d7('0x47')]][_0x45d7('0xf')]=_0x109a8e[_0x45d7('0x55')];queues[_0x109a8e[_0x45d7('0x47')]][_0x45d7('0x21')]=0x2;queues[_0x109a8e['transfereeuniqueid']][_0x45d7('0x56')]=queues[_0x109a8e[_0x45d7('0x4e')]][_0x45d7('0x56')];queues[_0x109a8e[_0x45d7('0x47')]][_0x45d7('0x57')]=queues[_0x109a8e[_0x45d7('0x4e')]]['calleridname'];queues[_0x109a8e['transfereeuniqueid']][_0x45d7('0x36')]=utils[_0x45d7('0x28')]();queues[_0x109a8e[_0x45d7('0x47')]][_0x45d7('0x1a')]=utils[_0x45d7('0x28')]();queues[_0x109a8e[_0x45d7('0x47')]][_0x45d7('0x58')]=0x0;queues[_0x109a8e[_0x45d7('0x47')]][_0x45d7('0x59')]=0x0;utils['info'](util['format'](_0x45d7('0x5a'),_0x109a8e[_0x45d7('0x4c')],queues[_0x109a8e[_0x45d7('0x47')]]['name'],queues[_0x109a8e[_0x45d7('0x47')]][_0x45d7('0x56')],queues[_0x109a8e[_0x45d7('0x47')]][_0x45d7('0x57')]));}else{utils[_0x45d7('0x2')](util[_0x45d7('0x13')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x109a8e[_0x45d7('0x4c')],queues[_0x109a8e[_0x45d7('0x4d')]][_0x45d7('0x20')],_0x109a8e[_0x45d7('0x4e')]));queues[_0x109a8e[_0x45d7('0x4d')]][_0x45d7('0xf')]=_0x109a8e[_0x45d7('0x4e')];}}}else if(_0x109a8e[_0x45d7('0x5b')]==_0x109a8e['secondtransfererlinkedid']){if(!_[_0x45d7('0x18')](queues[_0x109a8e[_0x45d7('0x4d')]])){utils[_0x45d7('0x2')](util[_0x45d7('0x13')](_0x45d7('0x5c'),_0x109a8e[_0x45d7('0x4c')],queues[_0x109a8e[_0x45d7('0x4d')]][_0x45d7('0x20')],_0x109a8e[_0x45d7('0x5b')],_0x109a8e[_0x45d7('0x5d')]));queues[_0x109a8e['origtransfererlinkedid']][_0x45d7('0x41')]=!![];queues[_0x109a8e[_0x45d7('0x4d')]][_0x45d7('0x50')]=_0x45d7('0x5e');queues[_0x109a8e[_0x45d7('0x4d')]][_0x45d7('0x49')]=_0x109a8e[_0x45d7('0x5d')];queues[_0x109a8e[_0x45d7('0x4d')]][_0x45d7('0x5f')]=_0x109a8e['secondtransfereruniqueid'];queues[_0x109a8e[_0x45d7('0x4d')]][_0x45d7('0x9')]=_0x45d7('0x52');}if(!_[_0x45d7('0x18')](queues[_0x109a8e[_0x45d7('0x4e')]])){if(_0x109a8e[_0x45d7('0x60')]&&queues[_0x109a8e[_0x45d7('0x60')]]){queues[_0x109a8e[_0x45d7('0x60')]][_0x45d7('0x21')]=0x1;queues[_0x109a8e[_0x45d7('0x55')]]=_[_0x45d7('0x54')](queues[_0x109a8e[_0x45d7('0x60')]]);queues[_0x109a8e[_0x45d7('0x55')]]['transfereduniqueid']=_0x109a8e[_0x45d7('0x55')];queues[_0x109a8e['transfertargetuniqueid']][_0x45d7('0x21')]=0x2;queues[_0x109a8e[_0x45d7('0x55')]][_0x45d7('0x56')]=queues[_0x109a8e[_0x45d7('0x4d')]][_0x45d7('0x56')];queues[_0x109a8e[_0x45d7('0x55')]][_0x45d7('0x57')]=queues[_0x109a8e['origtransfererlinkedid']][_0x45d7('0x57')];queues[_0x109a8e[_0x45d7('0x55')]]['queuecallerjoinAt']=utils['now']();queues[_0x109a8e[_0x45d7('0x55')]]['queuecallerleaveAt']=utils[_0x45d7('0x28')]();queues[_0x109a8e['transfertargetuniqueid']][_0x45d7('0x58')]=0x0;queues[_0x109a8e[_0x45d7('0x55')]][_0x45d7('0x59')]=0x0;utils[_0x45d7('0x2')](util[_0x45d7('0x13')](_0x45d7('0x61'),_0x109a8e[_0x45d7('0x4c')],queues[_0x109a8e[_0x45d7('0x55')]][_0x45d7('0x20')],queues[_0x109a8e['transfertargetuniqueid']][_0x45d7('0xf')],queues[_0x109a8e[_0x45d7('0x55')]][_0x45d7('0x56')],queues[_0x109a8e[_0x45d7('0x55')]][_0x45d7('0x57')]));}else{utils['info'](util[_0x45d7('0x13')](_0x45d7('0x62'),_0x109a8e[_0x45d7('0x4c')],queues[_0x109a8e[_0x45d7('0x4e')]][_0x45d7('0x20')],_0x109a8e[_0x45d7('0x4d')]));queues[_0x109a8e[_0x45d7('0x4e')]][_0x45d7('0xf')]=_0x109a8e[_0x45d7('0x4d')];}}}}catch(_0x2d3f9f){utils[_0x45d7('0x16')](util[_0x45d7('0x13')]('[%s][queues][attendedtransfer]',_0x109a8e[_0x45d7('0x4c')]),_0x2d3f9f);}};exports[_0x45d7('0x63')]=function(_0xe6e648){try{if(!_['isNil'](queues[_0xe6e648[_0x45d7('0x4')]])){utils[_0x45d7('0x11')](util[_0x45d7('0x13')](_0x45d7('0x64'),_0xe6e648[_0x45d7('0x4')]),_0xe6e648);queues[_0xe6e648[_0x45d7('0x4')]][_0x45d7('0x65')]=utils['now']();utils['info'](util[_0x45d7('0x13')](_0x45d7('0x66'),_0xe6e648[_0x45d7('0x4')],queues[_0xe6e648[_0x45d7('0x4')]][_0x45d7('0x20')],queues[_0xe6e648[_0x45d7('0x4')]]['musiconholdstartAt']));}}catch(_0x1d8265){utils[_0x45d7('0x16')](util[_0x45d7('0x13')](_0x45d7('0x64'),_0xe6e648[_0x45d7('0x4')]),_0x1d8265);}};exports[_0x45d7('0x67')]=function(_0x28aa3a){try{if(!_[_0x45d7('0x18')](queues[_0x28aa3a[_0x45d7('0x4')]])){if(!_[_0x45d7('0x18')](queues[_0x28aa3a[_0x45d7('0x4')]][_0x45d7('0x65')])){utils[_0x45d7('0x11')](util[_0x45d7('0x13')](_0x45d7('0x68'),_0x28aa3a[_0x45d7('0x4')]),_0x28aa3a);queues[_0x28aa3a[_0x45d7('0x4')]][_0x45d7('0x59')]+=utils['diffTime'](utils['now'](),queues[_0x28aa3a['uniqueid']][_0x45d7('0x65')]);utils[_0x45d7('0x2')](util['format'](_0x45d7('0x69'),_0x28aa3a[_0x45d7('0x4')],queues[_0x28aa3a[_0x45d7('0x4')]]['name'],queues[_0x28aa3a['uniqueid']][_0x45d7('0x59')]));delete queues[_0x28aa3a[_0x45d7('0x4')]][_0x45d7('0x65')];}}}catch(_0x9a26e5){utils[_0x45d7('0x16')](util[_0x45d7('0x13')](_0x45d7('0x68'),_0x28aa3a[_0x45d7('0x4')]),_0x9a26e5);}}; \ No newline at end of file +var _0x498b=['[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','queuecallerexitAt','ABANDONED','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transferexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','lastAssignedTo','calleridnum','accountcode','then','type','request','CreateVoiceQueueReport','queuecallerjoin','format','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','queue','position','assign','now','error','[%s][queues][queuecallerjoin]','[%s][queues][hangup]','queuecallerleaveAt','queuecallercompleteAt','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','debug','[%s][queues][varset]','isNil','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexit','value'];(function(_0x5ccb27,_0x4102d6){var _0x50c39b=function(_0xf080a){while(--_0xf080a){_0x5ccb27['push'](_0x5ccb27['shift']());}};_0x50c39b(++_0x4102d6);}(_0x498b,0x1ce));var _0xb498=function(_0x47c4c2,_0x9c857){_0x47c4c2=_0x47c4c2-0x0;var _0x5d908=_0x498b[_0x47c4c2];return _0x5d908;};'use strict';var _=require(_0xb498('0x0'));var util=require('util');var utils=require(_0xb498('0x1'));var queues={};function writeDB(_0x4d034b){utils['info'](util['format'](_0xb498('0x2'),_0x4d034b[_0xb498('0x3')],_0x4d034b['channel'],_0x4d034b['queue'],_0x4d034b[_0xb498('0x4')],_0x4d034b[_0xb498('0x5')],_0x4d034b[_0xb498('0x6')],_0x4d034b['queuecallerexitreason']));if(_0x4d034b['queue']){utils['getVoiceQueueByName'](_0x4d034b['queue'])[_0xb498('0x7')](function(_0x4fbffd){if(_0x4fbffd){_0x4d034b[_0xb498('0x8')]=_0x4fbffd[_0xb498('0x8')];}utils[_0xb498('0x9')](_0xb498('0xa'),_0x4d034b);});}else{utils[_0xb498('0x9')](_0xb498('0xa'),_0x4d034b);}if(_0x4d034b['transfereduniqueid']){delete queues[_0x4d034b['transfereduniqueid']];}else{delete queues[_0x4d034b[_0xb498('0x3')]];}}exports[_0xb498('0xb')]=function(_0x4f7408){try{utils['debug'](util[_0xb498('0xc')]('[%s][queues][queuecallerjoin]',_0x4f7408[_0xb498('0x3')]),_0x4f7408);utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0xe'),_0x4f7408[_0xb498('0x3')],_0x4f7408[_0xb498('0xf')],_0x4f7408[_0xb498('0x10')]));queues[_0x4f7408[_0xb498('0x3')]]=_[_0xb498('0x11')](_0x4f7408,{'originalposition':_0x4f7408[_0xb498('0x10')],'queuecallerjoinAt':utils[_0xb498('0x12')](),'mohtime':0x0});}catch(_0x2faa27){utils[_0xb498('0x13')](util[_0xb498('0xc')](_0xb498('0x14'),_0x4f7408[_0xb498('0x3')]),_0x2faa27);}};exports['hangup']=function(_0x1a5bc3){try{if(!_['isNil'](queues[_0x1a5bc3[_0xb498('0x3')]])){utils['debug'](util[_0xb498('0xc')](_0xb498('0x15'),_0x1a5bc3[_0xb498('0x3')]),_0x1a5bc3);if(queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x16')]){if(!queues[_0x1a5bc3[_0xb498('0x3')]]['queuecallerabandon']&&!queues[_0x1a5bc3['uniqueid']]['queuecallerexit']){queues[_0x1a5bc3['uniqueid']]['queuecallercomplete']=!![];queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x17')]=utils[_0xb498('0x12')]();queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x18')]=_0xb498('0x19');}utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x1a'),_0x1a5bc3[_0xb498('0x3')],queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x1b')],queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x18')]));writeDB(queues[_0x1a5bc3['uniqueid']]);}else if(queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x1c')]){utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x1d'),_0x1a5bc3['uniqueid'],queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x1b')],queues[_0x1a5bc3['uniqueid']][_0xb498('0x1c')]));queues[queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x1c')]]=queues[_0x1a5bc3[_0xb498('0x3')]];queues[queues[_0x1a5bc3[_0xb498('0x3')]][_0xb498('0x1c')]][_0xb498('0x1e')]=0x2;delete queues[_0x1a5bc3['uniqueid']];}}}catch(_0x16eb4){utils['error'](util[_0xb498('0xc')]('[%s][queues][hangup]',_0x1a5bc3[_0xb498('0x3')]),_0x16eb4);}};exports[_0xb498('0x1f')]=function(_0x109577){try{utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x21'),_0x109577[_0xb498('0x3')]),_0x109577);if(!_[_0xb498('0x22')](_0x109577[_0xb498('0x23')][_0xb498('0x24')])&&_0x109577['value'][_0xb498('0x25')]()!==_0xb498('0x26')){if(!_[_0xb498('0x22')](queues[_0x109577[_0xb498('0x3')]])){queues[_0x109577[_0xb498('0x3')]][_0xb498('0x27')]=![];queues[_0x109577[_0xb498('0x3')]][_0xb498('0x28')]=null;queues[_0x109577['uniqueid']][_0xb498('0x29')]=!![];queues[_0x109577[_0xb498('0x3')]]['queuecallerexitAt']=utils[_0xb498('0x12')]();queues[_0x109577[_0xb498('0x3')]][_0xb498('0x18')]=_0x109577[_0xb498('0x2a')][_0xb498('0x25')]();utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x2b'),_0x109577[_0xb498('0x3')],queues[_0x109577['uniqueid']][_0xb498('0x1b')],_0x109577[_0xb498('0x2a')],queues[_0x109577[_0xb498('0x3')]][_0xb498('0x18')]));writeDB(queues[_0x109577[_0xb498('0x3')]]);}}else if(!_['isNil'](_0x109577[_0xb498('0x23')][_0xb498('0x2c')])){if(!_[_0xb498('0x22')](queues[_0x109577['uniqueid']])&&!queues[_0x109577[_0xb498('0x3')]][_0xb498('0x27')]){queues[_0x109577[_0xb498('0x3')]][_0xb498('0x27')]=![];queues[_0x109577[_0xb498('0x3')]]['queuecallerabandonAt']=null;queues[_0x109577[_0xb498('0x3')]][_0xb498('0x29')]=!![];queues[_0x109577['uniqueid']]['queuecallerexitAt']=utils[_0xb498('0x12')]();queues[_0x109577['uniqueid']]['queuecallerexitreason']=_0xb498('0x2d');utils['info'](util['format'](_0xb498('0x2e'),_0x109577[_0xb498('0x3')],queues[_0x109577[_0xb498('0x3')]][_0xb498('0x1b')],_0x109577[_0xb498('0x2a')],queues[_0x109577[_0xb498('0x3')]][_0xb498('0x18')]));}}}catch(_0x296455){utils[_0xb498('0x13')](util[_0xb498('0xc')](_0xb498('0x21'),_0x109577[_0xb498('0x3')]),_0x296455);}};exports['queuecallerabandon']=function(_0x56368b){try{if(!_['isNil'](queues[_0x56368b[_0xb498('0x3')]])){utils['debug'](util[_0xb498('0xc')]('[%s][queues][queuecallerabandon]',_0x56368b[_0xb498('0x3')]),_0x56368b);queues[_0x56368b[_0xb498('0x3')]][_0xb498('0x29')]=![];queues[_0x56368b['uniqueid']][_0xb498('0x2f')]=null;queues[_0x56368b[_0xb498('0x3')]][_0xb498('0x27')]=!![];queues[_0x56368b['uniqueid']][_0xb498('0x28')]=utils[_0xb498('0x12')]();queues[_0x56368b[_0xb498('0x3')]][_0xb498('0x18')]=_0xb498('0x30');utils['info'](util[_0xb498('0xc')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x56368b[_0xb498('0x3')],queues[_0x56368b[_0xb498('0x3')]]['name'],queues[_0x56368b['uniqueid']][_0xb498('0x18')]));}}catch(_0x34d173){utils['error'](util[_0xb498('0xc')](_0xb498('0x31'),_0x56368b[_0xb498('0x3')]),_0x34d173);}};exports['queuecallerleave']=function(_0x17f7e0){try{if(!_[_0xb498('0x22')](queues[_0x17f7e0['uniqueid']])){utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x32'),_0x17f7e0[_0xb498('0x3')]),_0x17f7e0);utils['info'](util['format']('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x17f7e0[_0xb498('0x3')],queues[_0x17f7e0[_0xb498('0x3')]][_0xb498('0x1b')],_0x17f7e0[_0xb498('0x33')],_0x17f7e0[_0xb498('0x34')]));queues[_0x17f7e0[_0xb498('0x3')]]['queuecallerleave']=!![];queues[_0x17f7e0[_0xb498('0x3')]]['queuecallerleaveAt']=utils[_0xb498('0x12')]();queues[_0x17f7e0[_0xb498('0x3')]][_0xb498('0x35')]=utils[_0xb498('0x36')](queues[_0x17f7e0[_0xb498('0x3')]][_0xb498('0x16')],queues[_0x17f7e0['uniqueid']][_0xb498('0x37')]);queues[_0x17f7e0[_0xb498('0x3')]][_0xb498('0x10')]=_0x17f7e0['position'];queues[_0x17f7e0[_0xb498('0x3')]][_0xb498('0x38')]=_0x17f7e0['count'];queues[_0x17f7e0[_0xb498('0x3')]]['connectedlinenum']=_0x17f7e0['connectedlinenum'];queues[_0x17f7e0['uniqueid']][_0xb498('0x34')]=_0x17f7e0[_0xb498('0x34')];}}catch(_0x2c9b54){utils[_0xb498('0x13')](util[_0xb498('0xc')]('[%s][queues][queuecallerleave]',_0x17f7e0[_0xb498('0x3')]),_0x2c9b54);}};exports['agentconnect']=function(_0x2139d8){try{if(!_[_0xb498('0x22')](queues[_0x2139d8[_0xb498('0x3')]])){utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x39'),_0x2139d8[_0xb498('0x3')]),_0x2139d8);utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x3a'),_0x2139d8[_0xb498('0x3')],queues[_0x2139d8[_0xb498('0x3')]][_0xb498('0x1b')],_0x2139d8['membername'],_0x2139d8['destaccountcode']));queues[_0x2139d8[_0xb498('0x3')]][_0xb498('0x27')]=![];queues[_0x2139d8['uniqueid']][_0xb498('0x27')]=![];queues[_0x2139d8[_0xb498('0x3')]][_0xb498('0x28')]=null;queues[_0x2139d8[_0xb498('0x3')]][_0xb498('0x29')]=![];queues[_0x2139d8[_0xb498('0x3')]]['queuecallerexitreason']=null;queues[_0x2139d8['uniqueid']][_0xb498('0x2f')]=null;queues[_0x2139d8[_0xb498('0x3')]]['assigned']=!![];queues[_0x2139d8[_0xb498('0x3')]][_0xb498('0x6')]=_0x2139d8['destaccountcode'];queues[_0x2139d8[_0xb498('0x3')]]['lastAssignedTo']=_0x2139d8[_0xb498('0x3b')];}}catch(_0x326e0b){utils[_0xb498('0x13')](util[_0xb498('0xc')](_0xb498('0x39'),_0x2139d8[_0xb498('0x3')]),_0x326e0b);}};exports[_0xb498('0x3c')]=function(_0x40e30f){try{if(!_[_0xb498('0x22')](queues[_0x40e30f[_0xb498('0x3')]])){if(queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x16')]){utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x3d'),_0x40e30f[_0xb498('0x3')]),_0x40e30f);queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x27')]=![];queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x27')]=![];queues[_0x40e30f['uniqueid']][_0xb498('0x28')]=null;queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x29')]=![];queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x2f')]=null;queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x3e')]=!![];queues[_0x40e30f['uniqueid']][_0xb498('0x4')]=_0x40e30f[_0xb498('0x3b')];queues[_0x40e30f[_0xb498('0x3')]]['queuecallercomplete']=!![];queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x17')]=utils[_0xb498('0x12')]();if(_0x40e30f[_0xb498('0x3f')]==_0xb498('0x40')){if(!queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x40')]){queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x18')]=_0xb498('0x41');}}else{queues[_0x40e30f[_0xb498('0x3')]][_0xb498('0x18')]=_0xb498('0x42')+_0x40e30f[_0xb498('0x3f')]['toUpperCase']();}utils[_0xb498('0xd')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x40e30f['uniqueid'],queues[_0x40e30f[_0xb498('0x3')]]['name'],_0x40e30f[_0xb498('0x3b')],queues[_0x40e30f['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x40e30f[_0xb498('0x3')]]);}}}catch(_0x465e61){utils['error'](util[_0xb498('0xc')](_0xb498('0x3d'),_0x40e30f['uniqueid']),_0x465e61);}};exports[_0xb498('0x43')]=function(_0x328358){try{if(!_[_0xb498('0x22')](queues[_0x328358[_0xb498('0x44')]])){utils['debug'](util[_0xb498('0xc')](_0xb498('0x45'),_0x328358[_0xb498('0x3')]),_0x328358);queues[_0x328358[_0xb498('0x44')]][_0xb498('0x40')]=!![];queues[_0x328358['transfereeuniqueid']][_0xb498('0x46')]=_0xb498('0x47');queues[_0x328358[_0xb498('0x44')]]['transferexten']=_0x328358[_0xb498('0x48')];queues[_0x328358[_0xb498('0x44')]]['transferuniqueid']=_0x328358[_0xb498('0x44')];queues[_0x328358[_0xb498('0x44')]][_0xb498('0x18')]='BLINDTRANSFER';utils[_0xb498('0xd')](util['format'](_0xb498('0x49'),_0x328358[_0xb498('0x3')],queues[_0x328358[_0xb498('0x44')]][_0xb498('0x1b')],_0x328358[_0xb498('0x44')],_0x328358['extension']));}}catch(_0x482d87){utils[_0xb498('0x13')](util[_0xb498('0xc')](_0xb498('0x45'),_0x328358[_0xb498('0x3')]),_0x482d87);}};exports['attendedtransfer']=function(_0x27513f){try{utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x4a'),_0x27513f[_0xb498('0x4b')]),_0x27513f);if(_0x27513f[_0xb498('0x4b')]==_0x27513f[_0xb498('0x4c')]){if(!_[_0xb498('0x22')](queues[_0x27513f[_0xb498('0x4d')]])){utils[_0xb498('0xd')](util[_0xb498('0xc')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x27513f[_0xb498('0x4b')],queues[_0x27513f['secondtransfererlinkedid']]['name'],_0x27513f[_0xb498('0x4e')]));queues[_0x27513f[_0xb498('0x4d')]]['transfer']=!![];queues[_0x27513f[_0xb498('0x4d')]][_0xb498('0x46')]=_0xb498('0x4f');queues[_0x27513f['secondtransfererlinkedid']][_0xb498('0x50')]=_0x27513f[_0xb498('0x4e')];queues[_0x27513f[_0xb498('0x4d')]][_0xb498('0x51')]=_0x27513f['origtransfereruniqueid'];queues[_0x27513f[_0xb498('0x4d')]]['queuecallerexitreason']=_0xb498('0x52');}if(!_['isNil'](queues[_0x27513f[_0xb498('0x4c')]])){if(_0x27513f[_0xb498('0x53')]&&queues[_0x27513f[_0xb498('0x53')]]){queues[_0x27513f[_0xb498('0x53')]][_0xb498('0x1e')]=0x1;queues[_0x27513f[_0xb498('0x44')]]=_[_0xb498('0x54')](queues[_0x27513f[_0xb498('0x53')]]);queues[_0x27513f['transfereeuniqueid']]['transfereduniqueid']=_0x27513f[_0xb498('0x55')];queues[_0x27513f[_0xb498('0x44')]]['queuecallerenterreason']=0x2;queues[_0x27513f[_0xb498('0x44')]]['calleridnum']=queues[_0x27513f[_0xb498('0x4d')]]['calleridnum'];queues[_0x27513f[_0xb498('0x44')]]['calleridname']=queues[_0x27513f[_0xb498('0x4d')]]['calleridname'];queues[_0x27513f[_0xb498('0x44')]][_0xb498('0x37')]=utils[_0xb498('0x12')]();queues[_0x27513f[_0xb498('0x44')]][_0xb498('0x16')]=utils[_0xb498('0x12')]();queues[_0x27513f['transfereeuniqueid']]['holdtime']=0x0;queues[_0x27513f[_0xb498('0x44')]][_0xb498('0x56')]=0x0;utils[_0xb498('0xd')](util['format'](_0xb498('0x57'),_0x27513f[_0xb498('0x4b')],queues[_0x27513f[_0xb498('0x44')]][_0xb498('0x1b')],queues[_0x27513f[_0xb498('0x44')]][_0xb498('0x5')],queues[_0x27513f['transfereeuniqueid']][_0xb498('0x58')]));}else{utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x59'),_0x27513f[_0xb498('0x4b')],queues[_0x27513f['origtransfererlinkedid']][_0xb498('0x1b')],_0x27513f[_0xb498('0x4d')]));queues[_0x27513f[_0xb498('0x4c')]]['transfereduniqueid']=_0x27513f[_0xb498('0x4d')];}}}else if(_0x27513f['secondtransfereruniqueid']==_0x27513f[_0xb498('0x4d')]){if(!_['isNil'](queues[_0x27513f[_0xb498('0x4c')]])){utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x5a'),_0x27513f[_0xb498('0x4b')],queues[_0x27513f[_0xb498('0x4c')]][_0xb498('0x1b')],_0x27513f[_0xb498('0x5b')],_0x27513f[_0xb498('0x5c')]));queues[_0x27513f[_0xb498('0x4c')]][_0xb498('0x40')]=!![];queues[_0x27513f['origtransfererlinkedid']][_0xb498('0x46')]=_0xb498('0x4f');queues[_0x27513f['origtransfererlinkedid']][_0xb498('0x50')]=_0x27513f[_0xb498('0x5c')];queues[_0x27513f[_0xb498('0x4c')]][_0xb498('0x51')]=_0x27513f[_0xb498('0x5b')];queues[_0x27513f[_0xb498('0x4c')]][_0xb498('0x18')]=_0xb498('0x52');}if(!_['isNil'](queues[_0x27513f['secondtransfererlinkedid']])){if(_0x27513f[_0xb498('0x5d')]&&queues[_0x27513f['transfertargetlinkedid']]){queues[_0x27513f[_0xb498('0x5d')]][_0xb498('0x1e')]=0x1;queues[_0x27513f[_0xb498('0x55')]]=_[_0xb498('0x54')](queues[_0x27513f['transfertargetlinkedid']]);queues[_0x27513f['transfertargetuniqueid']][_0xb498('0x1c')]=_0x27513f[_0xb498('0x55')];queues[_0x27513f['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x27513f[_0xb498('0x55')]]['calleridnum']=queues[_0x27513f[_0xb498('0x4c')]]['calleridnum'];queues[_0x27513f[_0xb498('0x55')]]['calleridname']=queues[_0x27513f['origtransfererlinkedid']][_0xb498('0x58')];queues[_0x27513f['transfertargetuniqueid']][_0xb498('0x37')]=utils[_0xb498('0x12')]();queues[_0x27513f[_0xb498('0x55')]]['queuecallerleaveAt']=utils[_0xb498('0x12')]();queues[_0x27513f[_0xb498('0x55')]]['holdtime']=0x0;queues[_0x27513f['transfertargetuniqueid']][_0xb498('0x56')]=0x0;utils['info'](util[_0xb498('0xc')](_0xb498('0x5e'),_0x27513f[_0xb498('0x4b')],queues[_0x27513f['transfertargetuniqueid']][_0xb498('0x1b')],queues[_0x27513f['transfertargetuniqueid']][_0xb498('0x1c')],queues[_0x27513f[_0xb498('0x55')]][_0xb498('0x5')],queues[_0x27513f[_0xb498('0x55')]]['calleridname']));}else{utils['info'](util[_0xb498('0xc')](_0xb498('0x59'),_0x27513f[_0xb498('0x4b')],queues[_0x27513f[_0xb498('0x4d')]][_0xb498('0x1b')],_0x27513f[_0xb498('0x4c')]));queues[_0x27513f['secondtransfererlinkedid']][_0xb498('0x1c')]=_0x27513f[_0xb498('0x4c')];}}}}catch(_0x39fe64){utils['error'](util[_0xb498('0xc')](_0xb498('0x4a'),_0x27513f[_0xb498('0x4b')]),_0x39fe64);}};exports[_0xb498('0x5f')]=function(_0x568ecd){try{if(!_[_0xb498('0x22')](queues[_0x568ecd[_0xb498('0x3')]])){utils[_0xb498('0x20')](util[_0xb498('0xc')]('[%s][queues][musiconholdstart]',_0x568ecd[_0xb498('0x3')]),_0x568ecd);queues[_0x568ecd[_0xb498('0x3')]][_0xb498('0x60')]=utils[_0xb498('0x12')]();utils['info'](util['format'](_0xb498('0x61'),_0x568ecd[_0xb498('0x3')],queues[_0x568ecd['uniqueid']][_0xb498('0x1b')],queues[_0x568ecd['uniqueid']]['musiconholdstartAt']));}}catch(_0x53f4ed){utils[_0xb498('0x13')](util['format']('[%s][queues][musiconholdstart]',_0x568ecd[_0xb498('0x3')]),_0x53f4ed);}};exports[_0xb498('0x62')]=function(_0x197f7e){try{if(!_[_0xb498('0x22')](queues[_0x197f7e[_0xb498('0x3')]])){if(!_[_0xb498('0x22')](queues[_0x197f7e[_0xb498('0x3')]][_0xb498('0x60')])){utils[_0xb498('0x20')](util[_0xb498('0xc')](_0xb498('0x63'),_0x197f7e[_0xb498('0x3')]),_0x197f7e);queues[_0x197f7e[_0xb498('0x3')]][_0xb498('0x56')]+=utils[_0xb498('0x36')](utils[_0xb498('0x12')](),queues[_0x197f7e['uniqueid']][_0xb498('0x60')]);utils[_0xb498('0xd')](util[_0xb498('0xc')](_0xb498('0x64'),_0x197f7e[_0xb498('0x3')],queues[_0x197f7e[_0xb498('0x3')]][_0xb498('0x1b')],queues[_0x197f7e[_0xb498('0x3')]]['mohtime']));delete queues[_0x197f7e['uniqueid']][_0xb498('0x60')];}}}catch(_0x309c44){utils[_0xb498('0x13')](util[_0xb498('0xc')](_0xb498('0x63'),_0x197f7e[_0xb498('0x3')]),_0x309c44);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 559702f..be18ad1 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 _0x3e3a=['newchannel','debug','linkedid','context','exten','error','[%s][recordings][newchannel]','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','./utils','./transfers.controller','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording'];(function(_0x187c8a,_0x5006e2){var _0x1ce995=function(_0x3a99f9){while(--_0x3a99f9){_0x187c8a['push'](_0x187c8a['shift']());}};_0x1ce995(++_0x5006e2);}(_0x3e3a,0x85));var _0xa3e3=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3e3a[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xa3e3('0x0'));var util=require(_0xa3e3('0x1'));var utils=require(_0xa3e3('0x2'));var transfers=require(_0xa3e3('0x3'));var recordings={};function writeDB(_0x412e6b){var _0x1513d8;utils[_0xa3e3('0x4')](util[_0xa3e3('0x5')]('[%s][recordings][writeDB]',_0x412e6b[_0xa3e3('0x6')]));if(transfers[_0xa3e3('0x7')][_0x412e6b[_0xa3e3('0x6')]]){_0x1513d8=_0x412e6b[_0xa3e3('0x6')];_0x412e6b[_0xa3e3('0x6')]=transfers['blinds'][_0x412e6b[_0xa3e3('0x6')]][_0xa3e3('0x8')];}if(_0x412e6b[_0xa3e3('0x9')]){utils[_0xa3e3('0xa')](_0x412e6b[_0xa3e3('0x9')])[_0xa3e3('0xb')](function(_0x35fc95){if(_0x35fc95){_0x412e6b[_0xa3e3('0xc')]=_0x35fc95[_0xa3e3('0xd')];_0x412e6b[_0xa3e3('0xe')]=_0x35fc95['id'];}utils[_0xa3e3('0xf')]('CreateVoiceRecording',_0x412e6b);});}else{utils['request'](_0xa3e3('0x10'),_0x412e6b);}if(_0x1513d8)delete transfers[_0xa3e3('0x7')][_0x1513d8];}exports[_0xa3e3('0x11')]=function(_0x54de63){try{utils[_0xa3e3('0x12')](util[_0xa3e3('0x5')]('[%s][recordings][newchannel]',_0x54de63[_0xa3e3('0x6')]),_0x54de63);if(_0x54de63[_0xa3e3('0x6')]==_0x54de63[_0xa3e3('0x13')]){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x54de63[_0xa3e3('0x6')],_0x54de63[_0xa3e3('0x14')],_0x54de63[_0xa3e3('0x15')]));recordings[_0x54de63[_0xa3e3('0x6')]]={'uniqueid':_0x54de63[_0xa3e3('0x6')],'accountcode':_0x54de63['accountcode'],'exten':_0x54de63[_0xa3e3('0x15')],'context':_0x54de63[_0xa3e3('0x14')],'channel':_0x54de63['channel'],'monitors':[]};}}catch(_0x2f3004){utils[_0xa3e3('0x16')](util[_0xa3e3('0x5')](_0xa3e3('0x17'),_0x54de63[_0xa3e3('0x6')]),_0x2f3004);}};exports[_0xa3e3('0x18')]=function(_0x59d2f3){try{utils[_0xa3e3('0x12')](util[_0xa3e3('0x5')]('[%s][recordings][newstate]',_0x59d2f3[_0xa3e3('0x6')]),_0x59d2f3);if(!_[_0xa3e3('0x19')](recordings[_0x59d2f3['uniqueid']])&&_0x59d2f3[_0xa3e3('0x1a')]==0x6){utils[_0xa3e3('0x4')](util['format'](_0xa3e3('0x1b'),_0x59d2f3[_0xa3e3('0x6')],_0x59d2f3[_0xa3e3('0x14')],_0x59d2f3[_0xa3e3('0x1c')]));}else if(!_[_0xa3e3('0x19')](recordings[_0x59d2f3[_0xa3e3('0x13')]])&&_0x59d2f3[_0xa3e3('0x1a')]==0x6&&_0x59d2f3['context']!=_0xa3e3('0x1d')){utils[_0xa3e3('0x4')](util[_0xa3e3('0x5')](_0xa3e3('0x1e'),_0x59d2f3[_0xa3e3('0x6')],_0x59d2f3['linkedid'],_0x59d2f3[_0xa3e3('0x14')],_0x59d2f3['channel']));recordings[_0x59d2f3['linkedid']]['accountcode']=_0x59d2f3[_0xa3e3('0x9')];}}catch(_0x2723b8){utils[_0xa3e3('0x16')](util[_0xa3e3('0x5')](_0xa3e3('0x1f'),_0x59d2f3['uniqueid']),_0x2723b8);}};exports[_0xa3e3('0x20')]=function(_0x2bd12e){try{if(!_['isNil'](_0x2bd12e[_0xa3e3('0x21')])&&!_[_0xa3e3('0x19')](_0x2bd12e[_0xa3e3('0x21')]['mixmonitor_filename'])){utils['debug'](util[_0xa3e3('0x5')](_0xa3e3('0x22'),_0x2bd12e[_0xa3e3('0x6')]),_0x2bd12e);utils['info'](util[_0xa3e3('0x5')](_0xa3e3('0x23'),_0x2bd12e[_0xa3e3('0x6')],_0x2bd12e[_0xa3e3('0x21')],_0x2bd12e[_0xa3e3('0x24')]));if(_[_0xa3e3('0x25')](_0x2bd12e[_0xa3e3('0x24')],'.wav49')){_0x2bd12e[_0xa3e3('0x24')]=_0x2bd12e[_0xa3e3('0x24')][_0xa3e3('0x26')]('.wav49','.WAV');}if(recordings[_0x2bd12e[_0xa3e3('0x13')]]){var _0x49d699=_['find'](recordings[_0x2bd12e[_0xa3e3('0x13')]]['monitors'],{'value':_0x2bd12e['value']});if(_[_0xa3e3('0x19')](_0x49d699)){recordings[_0x2bd12e['linkedid']][_0xa3e3('0x27')][_0xa3e3('0x28')]({'value':_0x2bd12e[_0xa3e3('0x24')]});}}}}catch(_0x31ad07){utils[_0xa3e3('0x16')](util['format'](_0xa3e3('0x22'),_0x2bd12e['uniqueid']),_0x31ad07);}};exports['hangup']=function(_0x168476){try{if(!_['isNil'](recordings[_0x168476['uniqueid']])){utils[_0xa3e3('0x12')](util[_0xa3e3('0x5')](_0xa3e3('0x29'),_0x168476['uniqueid']),_0x168476);utils['info'](util[_0xa3e3('0x5')](_0xa3e3('0x2a'),_0x168476[_0xa3e3('0x6')],_0x168476[_0xa3e3('0x2b')],_0x168476['calleridname'],_0x168476[_0xa3e3('0x2c')]));recordings[_0x168476['uniqueid']]['calleridnum']=_0x168476[_0xa3e3('0x2b')];recordings[_0x168476[_0xa3e3('0x6')]]['calleridname']=_0x168476[_0xa3e3('0x2d')];recordings[_0x168476[_0xa3e3('0x6')]]['connectedlinenum']=_0x168476[_0xa3e3('0x2e')];recordings[_0x168476['uniqueid']][_0xa3e3('0x2f')]=_0x168476[_0xa3e3('0x2f')];if(recordings[_0x168476['uniqueid']][_0xa3e3('0x30')]==_0xa3e3('0x31')&&recordings[_0x168476[_0xa3e3('0x6')]]['accountcode']){recordings[_0x168476[_0xa3e3('0x6')]][_0xa3e3('0x2e')]=recordings[_0x168476[_0xa3e3('0x6')]]['accountcode'];recordings[_0x168476['uniqueid']][_0xa3e3('0x2f')]='';}recordings[_0x168476[_0xa3e3('0x6')]][_0xa3e3('0x27')][_0xa3e3('0x32')](function(_0x1a0398){var _0x368df7=_[_0xa3e3('0x33')](recordings[_0x168476[_0xa3e3('0x6')]]);_0x368df7[_0xa3e3('0x24')]=_0x1a0398[_0xa3e3('0x24')];writeDB(_0x368df7);});delete recordings[_0x168476['uniqueid']];}}catch(_0xa4aeed){utils[_0xa3e3('0x16')](util['format']('[%s][recordings][hangup]',_0x168476[_0xa3e3('0x6')]),_0xa4aeed);}};exports[_0xa3e3('0x34')]=function(_0x24094c){try{if(!_[_0xa3e3('0x19')](recordings[_0x24094c[_0xa3e3('0x6')]])){utils['debug'](util['format']('[%s][recordings][newexten]',_0x24094c[_0xa3e3('0x6')]),_0x24094c);utils[_0xa3e3('0x4')](util[_0xa3e3('0x5')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x24094c[_0xa3e3('0x6')],_0x24094c[_0xa3e3('0x35')],_0x24094c['appdata']));if(_0x24094c['application'][_0xa3e3('0x36')]()==_0xa3e3('0x37')&&_[_0xa3e3('0x38')](_0x24094c[_0xa3e3('0x39')][_0xa3e3('0x36')](),'cdr')){var _0x12d4de=_0x24094c[_0xa3e3('0x39')][_0xa3e3('0x3a')]('=');var _0x21d1d2=_0x12d4de[0x0][_0xa3e3('0x3b')](_0x12d4de[0x0][_0xa3e3('0x3c')]('(')+0x1,_0x12d4de[0x0]['lastIndexOf'](')'));var _0x10a474=_0x12d4de[0x1];recordings[_0x24094c[_0xa3e3('0x6')]][_0x21d1d2]=_0x10a474;}}}catch(_0x31142f){utils['error'](util['format'](_0xa3e3('0x3d'),_0x24094c[_0xa3e3('0x6')]),_0x31142f);}};exports[_0xa3e3('0x3e')]=function(_0x27ecc1){try{if(!_[_0xa3e3('0x19')](recordings[_0x27ecc1['uniqueid']])){utils[_0xa3e3('0x12')](util[_0xa3e3('0x5')]('[%s][recordings][queuecallerjoin]',_0x27ecc1[_0xa3e3('0x6')]),_0x27ecc1);utils['info'](util['format'](_0xa3e3('0x3f'),_0x27ecc1[_0xa3e3('0x6')],_0x27ecc1[_0xa3e3('0x40')]));recordings[_0x27ecc1[_0xa3e3('0x6')]]['queue']=_0x27ecc1[_0xa3e3('0x40')];}}catch(_0x3e2d9a){utils[_0xa3e3('0x16')](util[_0xa3e3('0x5')](_0xa3e3('0x41'),_0x27ecc1[_0xa3e3('0x6')]),_0x3e2d9a);}};exports[_0xa3e3('0x42')]=function(_0x1d5d71){try{utils[_0xa3e3('0x12')](util[_0xa3e3('0x5')](_0xa3e3('0x43'),_0x1d5d71[_0xa3e3('0x6')]),_0x1d5d71);utils[_0xa3e3('0x4')](util[_0xa3e3('0x5')](_0xa3e3('0x44'),_0x1d5d71[_0xa3e3('0x6')],_0x1d5d71[_0xa3e3('0x45')],_0x1d5d71[_0xa3e3('0x46')],_0x1d5d71[_0xa3e3('0x47')],_0x1d5d71[_0xa3e3('0x48')]));if(recordings[_0x1d5d71[_0xa3e3('0x49')]]&&transfers[_0xa3e3('0x7')][_0x1d5d71[_0xa3e3('0x49')]]){transfers['blinds'][_0x1d5d71[_0xa3e3('0x49')]][_0xa3e3('0x4a')]=!![];}}catch(_0x15bdc8){utils['error'](util[_0xa3e3('0x5')](_0xa3e3('0x43'),_0x1d5d71[_0xa3e3('0x6')]),_0x15bdc8);}}; \ No newline at end of file +var _0x75d9=['split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','transfereruniqueid','lodash','./utils','./transfers.controller','format','[%s][recordings][writeDB]','uniqueid','blinds','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','context','exten','error','newstate','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith'];(function(_0x4391e2,_0x4f999e){var _0x28418a=function(_0x524f0c){while(--_0x524f0c){_0x4391e2['push'](_0x4391e2['shift']());}};_0x28418a(++_0x4f999e);}(_0x75d9,0xa1));var _0x975d=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0x75d9[_0x366e99];return _0x180bbe;};'use strict';var _=require(_0x975d('0x0'));var util=require('util');var utils=require(_0x975d('0x1'));var transfers=require(_0x975d('0x2'));var recordings={};function writeDB(_0x3b0b9b){var _0x523d3e;utils['info'](util[_0x975d('0x3')](_0x975d('0x4'),_0x3b0b9b[_0x975d('0x5')]));if(transfers['blinds'][_0x3b0b9b['uniqueid']]){_0x523d3e=_0x3b0b9b['uniqueid'];_0x3b0b9b[_0x975d('0x5')]=transfers[_0x975d('0x6')][_0x3b0b9b[_0x975d('0x5')]]['transfereeuniqueid'];}if(_0x3b0b9b[_0x975d('0x7')]){utils[_0x975d('0x8')](_0x3b0b9b['accountcode'])[_0x975d('0x9')](function(_0x3a0bdc){if(_0x3a0bdc){_0x3b0b9b[_0x975d('0xa')]=_0x3a0bdc[_0x975d('0xb')];_0x3b0b9b[_0x975d('0xc')]=_0x3a0bdc['id'];}utils[_0x975d('0xd')](_0x975d('0xe'),_0x3b0b9b);});}else{utils[_0x975d('0xd')](_0x975d('0xe'),_0x3b0b9b);}if(_0x523d3e)delete transfers[_0x975d('0x6')][_0x523d3e];}exports[_0x975d('0xf')]=function(_0x1e63c9){try{utils[_0x975d('0x10')](util[_0x975d('0x3')](_0x975d('0x11'),_0x1e63c9['uniqueid']),_0x1e63c9);if(_0x1e63c9[_0x975d('0x5')]==_0x1e63c9[_0x975d('0x12')]){utils[_0x975d('0x13')](util[_0x975d('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x1e63c9[_0x975d('0x5')],_0x1e63c9[_0x975d('0x14')],_0x1e63c9[_0x975d('0x15')]));recordings[_0x1e63c9['uniqueid']]={'uniqueid':_0x1e63c9['uniqueid'],'accountcode':_0x1e63c9[_0x975d('0x7')],'exten':_0x1e63c9[_0x975d('0x15')],'context':_0x1e63c9[_0x975d('0x14')],'channel':_0x1e63c9['channel'],'monitors':[]};}}catch(_0x262abb){utils[_0x975d('0x16')](util[_0x975d('0x3')]('[%s][recordings][newchannel]',_0x1e63c9[_0x975d('0x5')]),_0x262abb);}};exports[_0x975d('0x17')]=function(_0x16f3cd){try{utils['debug'](util[_0x975d('0x3')]('[%s][recordings][newstate]',_0x16f3cd[_0x975d('0x5')]),_0x16f3cd);if(!_['isNil'](recordings[_0x16f3cd['uniqueid']])&&_0x16f3cd[_0x975d('0x18')]==0x6){utils[_0x975d('0x13')](util[_0x975d('0x3')](_0x975d('0x19'),_0x16f3cd[_0x975d('0x5')],_0x16f3cd[_0x975d('0x14')],_0x16f3cd[_0x975d('0x1a')]));}else if(!_['isNil'](recordings[_0x16f3cd[_0x975d('0x12')]])&&_0x16f3cd['channelstate']==0x6&&_0x16f3cd[_0x975d('0x14')]!=_0x975d('0x1b')){utils[_0x975d('0x13')](util[_0x975d('0x3')](_0x975d('0x1c'),_0x16f3cd[_0x975d('0x5')],_0x16f3cd[_0x975d('0x12')],_0x16f3cd[_0x975d('0x14')],_0x16f3cd[_0x975d('0x1a')]));recordings[_0x16f3cd['linkedid']]['accountcode']=_0x16f3cd[_0x975d('0x7')];}}catch(_0xfe80fd){utils[_0x975d('0x16')](util['format'](_0x975d('0x1d'),_0x16f3cd['uniqueid']),_0xfe80fd);}};exports[_0x975d('0x1e')]=function(_0x22389c){try{if(!_[_0x975d('0x1f')](_0x22389c[_0x975d('0x20')])&&!_['isNil'](_0x22389c[_0x975d('0x20')][_0x975d('0x21')])){utils[_0x975d('0x10')](util[_0x975d('0x3')]('[%s][recordings][varset]',_0x22389c[_0x975d('0x5')]),_0x22389c);utils[_0x975d('0x13')](util[_0x975d('0x3')](_0x975d('0x22'),_0x22389c[_0x975d('0x5')],_0x22389c['variable'],_0x22389c[_0x975d('0x23')]));if(_[_0x975d('0x24')](_0x22389c[_0x975d('0x23')],_0x975d('0x25'))){_0x22389c[_0x975d('0x23')]=_0x22389c[_0x975d('0x23')][_0x975d('0x26')](_0x975d('0x25'),_0x975d('0x27'));}if(recordings[_0x22389c[_0x975d('0x12')]]){var _0x1a28a6=_[_0x975d('0x28')](recordings[_0x22389c['linkedid']][_0x975d('0x29')],{'value':_0x22389c[_0x975d('0x23')]});if(_[_0x975d('0x1f')](_0x1a28a6)){recordings[_0x22389c['linkedid']]['monitors'][_0x975d('0x2a')]({'value':_0x22389c[_0x975d('0x23')]});}}}}catch(_0x39d3d3){utils[_0x975d('0x16')](util['format'](_0x975d('0x2b'),_0x22389c[_0x975d('0x5')]),_0x39d3d3);}};exports['hangup']=function(_0x5e9ca3){try{if(!_[_0x975d('0x1f')](recordings[_0x5e9ca3[_0x975d('0x5')]])){utils[_0x975d('0x10')](util['format'](_0x975d('0x2c'),_0x5e9ca3[_0x975d('0x5')]),_0x5e9ca3);utils[_0x975d('0x13')](util[_0x975d('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x5e9ca3[_0x975d('0x5')],_0x5e9ca3[_0x975d('0x2d')],_0x5e9ca3[_0x975d('0x2e')],_0x5e9ca3[_0x975d('0x2f')]));recordings[_0x5e9ca3['uniqueid']][_0x975d('0x2d')]=_0x5e9ca3[_0x975d('0x2d')];recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x2e')]=_0x5e9ca3[_0x975d('0x2e')];recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x30')]=_0x5e9ca3[_0x975d('0x30')];recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x31')]=_0x5e9ca3[_0x975d('0x31')];if(recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x32')]==_0x975d('0x33')&&recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x7')]){recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x30')]=recordings[_0x5e9ca3[_0x975d('0x5')]][_0x975d('0x7')];recordings[_0x5e9ca3[_0x975d('0x5')]]['connectedlinename']='';}recordings[_0x5e9ca3[_0x975d('0x5')]]['monitors'][_0x975d('0x34')](function(_0x14473e){var _0xd84bcb=_[_0x975d('0x35')](recordings[_0x5e9ca3[_0x975d('0x5')]]);_0xd84bcb['value']=_0x14473e[_0x975d('0x23')];writeDB(_0xd84bcb);});delete recordings[_0x5e9ca3[_0x975d('0x5')]];}}catch(_0x413de2){utils[_0x975d('0x16')](util[_0x975d('0x3')](_0x975d('0x2c'),_0x5e9ca3[_0x975d('0x5')]),_0x413de2);}};exports[_0x975d('0x36')]=function(_0xcdf9d8){try{if(!_[_0x975d('0x1f')](recordings[_0xcdf9d8[_0x975d('0x5')]])){utils[_0x975d('0x10')](util['format'](_0x975d('0x37'),_0xcdf9d8[_0x975d('0x5')]),_0xcdf9d8);utils['info'](util[_0x975d('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0xcdf9d8['uniqueid'],_0xcdf9d8[_0x975d('0x38')],_0xcdf9d8[_0x975d('0x39')]));if(_0xcdf9d8[_0x975d('0x38')][_0x975d('0x3a')]()==_0x975d('0x3b')&&_[_0x975d('0x3c')](_0xcdf9d8[_0x975d('0x39')][_0x975d('0x3a')](),'cdr')){var _0x5f53f2=_0xcdf9d8['appdata'][_0x975d('0x3d')]('=');var _0x533ca7=_0x5f53f2[0x0][_0x975d('0x3e')](_0x5f53f2[0x0]['lastIndexOf']('(')+0x1,_0x5f53f2[0x0][_0x975d('0x3f')](')'));var _0x15c6f6=_0x5f53f2[0x1];recordings[_0xcdf9d8['uniqueid']][_0x533ca7]=_0x15c6f6;}}}catch(_0x452c3e){utils['error'](util[_0x975d('0x3')](_0x975d('0x37'),_0xcdf9d8[_0x975d('0x5')]),_0x452c3e);}};exports['queuecallerjoin']=function(_0x5cc6d0){try{if(!_[_0x975d('0x1f')](recordings[_0x5cc6d0[_0x975d('0x5')]])){utils[_0x975d('0x10')](util[_0x975d('0x3')](_0x975d('0x40'),_0x5cc6d0[_0x975d('0x5')]),_0x5cc6d0);utils[_0x975d('0x13')](util[_0x975d('0x3')](_0x975d('0x41'),_0x5cc6d0[_0x975d('0x5')],_0x5cc6d0[_0x975d('0x42')]));recordings[_0x5cc6d0[_0x975d('0x5')]]['queue']=_0x5cc6d0[_0x975d('0x42')];}}catch(_0x38f61b){utils[_0x975d('0x16')](util[_0x975d('0x3')](_0x975d('0x40'),_0x5cc6d0['uniqueid']),_0x38f61b);}};exports[_0x975d('0x43')]=function(_0x261435){try{utils['debug'](util['format'](_0x975d('0x44'),_0x261435[_0x975d('0x5')]),_0x261435);utils[_0x975d('0x13')](util['format'](_0x975d('0x45'),_0x261435[_0x975d('0x5')],_0x261435[_0x975d('0x46')],_0x261435[_0x975d('0x47')],_0x261435['transfereecalleridnum'],_0x261435[_0x975d('0x48')]));if(recordings[_0x261435[_0x975d('0x49')]]&&transfers[_0x975d('0x6')][_0x261435[_0x975d('0x49')]]){transfers[_0x975d('0x6')][_0x261435[_0x975d('0x49')]]['recording']=!![];}}catch(_0x1c5a3e){utils['error'](util['format'](_0x975d('0x44'),_0x261435[_0x975d('0x5')]),_0x1c5a3e);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index a9d39c2..45f41f4 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 _0x55ce=['attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error'];(function(_0x4d9403,_0x33c5f0){var _0x5eef11=function(_0x50bb5c){while(--_0x50bb5c){_0x4d9403['push'](_0x4d9403['shift']());}};_0x5eef11(++_0x33c5f0);}(_0x55ce,0x104));var _0xe55c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x55ce[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe55c('0x0'));var util=require(_0xe55c('0x1'));var utils=require(_0xe55c('0x2'));function writeDB(_0x4855c1){utils[_0xe55c('0x3')](util[_0xe55c('0x4')](_0xe55c('0x5'),_0x4855c1[_0xe55c('0x6')]===_0xe55c('0x7')?_0x4855c1['origtransfereruniqueid']:_0x4855c1[_0xe55c('0x8')],_0x4855c1[_0xe55c('0x6')]));utils[_0xe55c('0x9')](_0xe55c('0xa'),_0x4855c1);}exports[_0xe55c('0xb')]={};exports[_0xe55c('0xc')]=function(_0x3031b9){try{utils[_0xe55c('0xd')](util[_0xe55c('0x4')](_0xe55c('0xe'),_0x3031b9[_0xe55c('0x8')]),_0x3031b9);utils[_0xe55c('0x3')](util[_0xe55c('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3031b9['uniqueid'],_0x3031b9[_0xe55c('0xf')],_0x3031b9[_0xe55c('0x10')],_0x3031b9[_0xe55c('0x11')],_0x3031b9[_0xe55c('0x12')]));_0x3031b9[_0xe55c('0x6')]=_0xe55c('0x13');exports['blinds'][_0x3031b9[_0xe55c('0x14')]]=_0x3031b9;writeDB(_0x3031b9);}catch(_0x4b88c9){utils[_0xe55c('0x15')](util['format'](_0xe55c('0xe'),_0x3031b9['uniqueid']),_0x4b88c9);}};exports[_0xe55c('0x16')]=function(_0x2dfb0f){try{utils[_0xe55c('0xd')](util[_0xe55c('0x4')](_0xe55c('0x17'),_0x2dfb0f[_0xe55c('0x18')]),_0x2dfb0f);utils[_0xe55c('0x3')](util[_0xe55c('0x4')](_0xe55c('0x19'),_0x2dfb0f[_0xe55c('0x18')],_0x2dfb0f[_0xe55c('0x1a')],_0x2dfb0f[_0xe55c('0x1b')],_0x2dfb0f[_0xe55c('0x1c')],_0x2dfb0f[_0xe55c('0x1d')]));_0x2dfb0f=_[_0xe55c('0x1e')](_0x2dfb0f,{'transfererchannel':_0x2dfb0f[_0xe55c('0x1f')],'transferercalleridnum':_0x2dfb0f[_0xe55c('0x1a')],'transferercalleridname':_0x2dfb0f[_0xe55c('0x1b')],'transfererconnectedlinenum':_0x2dfb0f[_0xe55c('0x20')],'transfererconnectedlinename':_0x2dfb0f[_0xe55c('0x21')],'transfereraccountcode':_0x2dfb0f[_0xe55c('0x22')],'transferercontext':_0x2dfb0f[_0xe55c('0x23')],'transfererexten':_0x2dfb0f[_0xe55c('0x24')],'transfererlinkedid':_0x2dfb0f['origtransfererlinkedid'],'context':_0x2dfb0f[_0xe55c('0x25')],'extension':_0x2dfb0f[_0xe55c('0x26')],'type':_0xe55c('0x7')});if(_[_0xe55c('0x27')](_0x2dfb0f[_0xe55c('0x28')])){_0x2dfb0f=_['assign'](_0x2dfb0f,{'transfereechannel':_0x2dfb0f[_0xe55c('0x29')],'transfereecalleridnum':_0x2dfb0f[_0xe55c('0x1c')],'transfereecalleridname':_0x2dfb0f[_0xe55c('0x1d')],'transfereeconnectedlinenum':_0x2dfb0f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2dfb0f[_0xe55c('0x2a')],'transfereeaccountcode':_0x2dfb0f[_0xe55c('0x2b')],'transfereecontext':_0x2dfb0f[_0xe55c('0x2c')],'transfereeexten':_0x2dfb0f[_0xe55c('0x2d')],'transfereelinkedid':_0x2dfb0f[_0xe55c('0x2e')]});}writeDB(_0x2dfb0f);}catch(_0x5f3cda){utils[_0xe55c('0x15')](util[_0xe55c('0x4')](_0xe55c('0x17'),_0x2dfb0f[_0xe55c('0x18')]),_0x5f3cda);}}; \ No newline at end of file +var _0x7889=['[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x473fd1,_0x5d61fc){var _0x142dfd=function(_0x12b7a1){while(--_0x12b7a1){_0x473fd1['push'](_0x473fd1['shift']());}};_0x142dfd(++_0x5d61fc);}(_0x7889,0xd8));var _0x9788=function(_0x8674ad,_0x4bac00){_0x8674ad=_0x8674ad-0x0;var _0xae0a35=_0x7889[_0x8674ad];return _0xae0a35;};'use strict';var _=require(_0x9788('0x0'));var util=require(_0x9788('0x1'));var utils=require(_0x9788('0x2'));function writeDB(_0xb62e20){utils[_0x9788('0x3')](util[_0x9788('0x4')](_0x9788('0x5'),_0xb62e20[_0x9788('0x6')]==='attended'?_0xb62e20[_0x9788('0x7')]:_0xb62e20[_0x9788('0x8')],_0xb62e20[_0x9788('0x6')]));utils[_0x9788('0x9')](_0x9788('0xa'),_0xb62e20);}exports[_0x9788('0xb')]={};exports['blindtransfer']=function(_0x35981c){try{utils[_0x9788('0xc')](util['format'](_0x9788('0xd'),_0x35981c['uniqueid']),_0x35981c);utils[_0x9788('0x3')](util['format'](_0x9788('0xe'),_0x35981c[_0x9788('0x8')],_0x35981c[_0x9788('0xf')],_0x35981c[_0x9788('0x10')],_0x35981c[_0x9788('0x11')],_0x35981c[_0x9788('0x12')]));_0x35981c['type']=_0x9788('0x13');exports[_0x9788('0xb')][_0x35981c[_0x9788('0x14')]]=_0x35981c;writeDB(_0x35981c);}catch(_0x4c17e2){utils[_0x9788('0x15')](util[_0x9788('0x4')](_0x9788('0xd'),_0x35981c[_0x9788('0x8')]),_0x4c17e2);}};exports['attendedtransfer']=function(_0x574720){try{utils['debug'](util[_0x9788('0x4')]('[%s][transfers][attendedtransfer]',_0x574720[_0x9788('0x7')]),_0x574720);utils['info'](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x574720[_0x9788('0x7')],_0x574720['origtransferercalleridnum'],_0x574720[_0x9788('0x16')],_0x574720[_0x9788('0x17')],_0x574720[_0x9788('0x18')]));_0x574720=_[_0x9788('0x19')](_0x574720,{'transfererchannel':_0x574720[_0x9788('0x1a')],'transferercalleridnum':_0x574720['origtransferercalleridnum'],'transferercalleridname':_0x574720['origtransferercalleridname'],'transfererconnectedlinenum':_0x574720[_0x9788('0x1b')],'transfererconnectedlinename':_0x574720[_0x9788('0x1c')],'transfereraccountcode':_0x574720['origtransfereraccountcode'],'transferercontext':_0x574720[_0x9788('0x1d')],'transfererexten':_0x574720[_0x9788('0x1e')],'transfererlinkedid':_0x574720[_0x9788('0x1f')],'context':_0x574720[_0x9788('0x20')],'extension':_0x574720[_0x9788('0x21')],'type':_0x9788('0x22')});if(_[_0x9788('0x23')](_0x574720[_0x9788('0x24')])){_0x574720=_[_0x9788('0x19')](_0x574720,{'transfereechannel':_0x574720[_0x9788('0x25')],'transfereecalleridnum':_0x574720[_0x9788('0x17')],'transfereecalleridname':_0x574720[_0x9788('0x18')],'transfereeconnectedlinenum':_0x574720[_0x9788('0x26')],'transfereeconnectedlinename':_0x574720[_0x9788('0x27')],'transfereeaccountcode':_0x574720[_0x9788('0x28')],'transfereecontext':_0x574720[_0x9788('0x29')],'transfereeexten':_0x574720['transfertargetexten'],'transfereelinkedid':_0x574720['transfertargetlinkedid']});}writeDB(_0x574720);}catch(_0x15294f){utils[_0x9788('0x15')](util['format'](_0x9788('0x2a'),_0x574720[_0x9788('0x7')]),_0x15294f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 0097af1..3d1f9ce 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 _0x908e=['inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','[utils][getUser]\x20where:%s','length','result','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','seconds','format','subtractTime','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','client','http','../../config/logger','xdr'];(function(_0x181dfe,_0xf84557){var _0x40c38f=function(_0x3aa818){while(--_0x3aa818){_0x181dfe['push'](_0x181dfe['shift']());}};_0x40c38f(++_0xf84557);}(_0x908e,0x182));var _0xe908=function(_0x4cd1eb,_0x323043){_0x4cd1eb=_0x4cd1eb-0x0;var _0x3e1c1d=_0x908e[_0x4cd1eb];return _0x3e1c1d;};'use strict';var BPromise=require(_0xe908('0x0'));var jayson=require(_0xe908('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0xe908('0x2')][_0xe908('0x3')]({'port':0x2329});var logger=require(_0xe908('0x4'))(_0xe908('0x5'));exports['info']=function(_0x46a00d,_0x4c8a70){logger['info'](_0x46a00d,_0x4c8a70?util[_0xe908('0x6')](_0x4c8a70,{'showHidden':![],'depth':null}):'');};exports[_0xe908('0x7')]=function(_0x2df114,_0x1f6cd2){logger[_0xe908('0x7')](_0x2df114,_0x1f6cd2?util[_0xe908('0x6')](_0x1f6cd2,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x126ce5,_0x4794c5){logger[_0xe908('0x8')](_0x126ce5,_0x4794c5?util[_0xe908('0x6')](_0x4794c5,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4c0846,_0x22c5cc){return client[_0xe908('0x9')](_0x4c0846,{'body':_0x22c5cc})[_0xe908('0xa')](function(_0x5a61d0){logger[_0xe908('0x7')](_0xe908('0xb'),_0x4c0846,_0x5a61d0?util[_0xe908('0x6')](_0x5a61d0,{'showHidden':![],'depth':null}):'');})[_0xe908('0xc')](function(_0x54347e){logger['error'](_0xe908('0xb'),_0x4c0846,_0x54347e?util['inspect'](_0x54347e,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3ac3ff){return client[_0xe908('0x9')](_0xe908('0xd'),{'options':{'raw':!![],'attributes':['id',_0xe908('0xe'),_0xe908('0xf'),'interface'],'where':_0x3ac3ff,'limit':0x1}})[_0xe908('0xa')](function(_0x34343c){logger[_0xe908('0x7')](_0xe908('0x10'),JSON['stringify'](_0x3ac3ff),_0x34343c?util['inspect'](_0x34343c,{'showHidden':![],'depth':null}):'');return _0x34343c['result'][_0xe908('0x11')]?_0x34343c[_0xe908('0x12')][0x0]:null;});}exports[_0xe908('0x13')]=function(_0x424240){return new BPromise(function(_0x5134e4,_0x1e0032){if(_0x424240){return getUser({'internal':_0x424240})[_0xe908('0xa')](function(_0x457c57){logger[_0xe908('0x14')](_0xe908('0x15'),_0x424240,_0x457c57?'found':_0xe908('0x16'));return _0x5134e4(_0x457c57);})['catch'](function(_0x3c0e63){logger[_0xe908('0x8')](_0xe908('0x17'),_0x3c0e63?util[_0xe908('0x6')](_0x3c0e63,{'showHidden':![],'depth':null}):'');return _0x5134e4(null);});}return _0x5134e4(null);});};exports[_0xe908('0x18')]=function(_0x59bca6){return new BPromise(function(_0xa1d7b9,_0x163263){if(_0x59bca6){return getUser({'interface':_0x59bca6})[_0xe908('0xa')](function(_0x376184){logger[_0xe908('0x14')](_0xe908('0x19'),_0x59bca6,_0x376184?_0xe908('0x1a'):_0xe908('0x16'));return _0xa1d7b9(_0x376184);})[_0xe908('0xc')](function(_0x537e56){logger['error'](_0xe908('0x1b'),_0x537e56?util[_0xe908('0x6')](_0x537e56,{'showHidden':![],'depth':null}):'');return _0xa1d7b9(null);});}return _0xa1d7b9(null);});};exports[_0xe908('0x1c')]=function(_0x583894){return new BPromise(function(_0x541d81,_0x1c61c1){if(_0x583894){return getUser({'name':_0x583894})['then'](function(_0x3ff92e){logger[_0xe908('0x14')](_0xe908('0x1d'),_0x583894,_0x3ff92e?_0xe908('0x1a'):_0xe908('0x16'));return _0x541d81(_0x3ff92e);})['catch'](function(_0x154d4a){logger[_0xe908('0x8')](_0xe908('0x1e'),_0x154d4a?util[_0xe908('0x6')](_0x154d4a,{'showHidden':![],'depth':null}):'');return _0x541d81(null);});}return _0x541d81(null);});};exports[_0xe908('0x1f')]=function(_0x579510){return new BPromise(function(_0x378aca,_0x3eb5b7){if(_0x579510){return client[_0xe908('0x9')](_0xe908('0x20'),{'options':{'raw':!![],'attributes':['id',_0xe908('0xf'),_0xe908('0x21'),_0xe908('0x22'),_0xe908('0x23')],'where':{'name':_0x579510},'limit':0x1}})['then'](function(_0xda590f){logger[_0xe908('0x7')](_0xe908('0x24'),_0x579510,_0xda590f?util[_0xe908('0x6')](_0xda590f,{'showHidden':![],'depth':null}):'');logger[_0xe908('0x14')](_0xe908('0x25'),_0x579510,_0xda590f?_0xe908('0x1a'):_0xe908('0x16'));return _0x378aca(_0xda590f[_0xe908('0x12')]['length']?_0xda590f[_0xe908('0x12')][0x0]:null);})['catch'](function(_0x361db3){logger[_0xe908('0x8')]('[utils][getVoiceQueueByName]',_0x361db3?util[_0xe908('0x6')](_0x361db3,{'showHidden':![],'depth':null}):'');return _0x378aca(null);});}return _0x378aca(null);});};exports['addTime']=function(_0x4b4315,_0x459a85){return moment(_0x4b4315)[_0xe908('0x26')](_0x459a85,_0xe908('0x27'))[_0xe908('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xe908('0x29')]=function(_0x4c468d,_0x43904f){return moment(_0x4c468d)['subtract'](_0x43904f,_0xe908('0x27'))['format'](_0xe908('0x2a'));};exports[_0xe908('0x2b')]=function(_0x232714,_0x3ddeb0){return moment(_0x232714)[_0xe908('0x2c')](moment(_0x3ddeb0),_0xe908('0x27'));};exports[_0xe908('0x2d')]=function(_0x13d403,_0x4c6211){return parseInt(_0x13d403,0xa)+parseInt(_0x4c6211,0xa);};exports[_0xe908('0x2e')]=function(){return moment()[_0xe908('0x28')](_0xe908('0x2a'));};exports[_0xe908('0x2f')]=function(_0x11b5af,_0x3450f4){if(_0x3450f4){return moment(_0x11b5af)[_0xe908('0x2f')](_0x3450f4);}return!![];};exports[_0xe908('0x30')]=function(_0x858f52,_0x184a9d){if(_0x184a9d){return moment(_0x858f52)[_0xe908('0x30')](_0x184a9d);}else if(_0x858f52){return!![];}return![];}; \ No newline at end of file +var _0x65e8=['then','[utils][request]\x20name:%s','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','name','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime','isAfter','isBefore','bluebird','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request'];(function(_0x43366d,_0x18cb56){var _0x52c4d8=function(_0x2a17f3){while(--_0x2a17f3){_0x43366d['push'](_0x43366d['shift']());}};_0x52c4d8(++_0x18cb56);}(_0x65e8,0x1d4));var _0x865e=function(_0x2adeda,_0x252d4c){_0x2adeda=_0x2adeda-0x0;var _0x3dc50e=_0x65e8[_0x2adeda];return _0x3dc50e;};'use strict';var BPromise=require(_0x865e('0x0'));var jayson=require('jayson/promise');var moment=require(_0x865e('0x1'));var util=require(_0x865e('0x2'));var client=jayson[_0x865e('0x3')][_0x865e('0x4')]({'port':0x2329});var logger=require(_0x865e('0x5'))(_0x865e('0x6'));exports[_0x865e('0x7')]=function(_0x2c65f9,_0x36b05a){logger[_0x865e('0x7')](_0x2c65f9,_0x36b05a?util[_0x865e('0x8')](_0x36b05a,{'showHidden':![],'depth':null}):'');};exports[_0x865e('0x9')]=function(_0x53dfc8,_0x5c420d){logger['debug'](_0x53dfc8,_0x5c420d?util['inspect'](_0x5c420d,{'showHidden':![],'depth':null}):'');};exports[_0x865e('0xa')]=function(_0x525c1e,_0x43f218){logger[_0x865e('0xa')](_0x525c1e,_0x43f218?util[_0x865e('0x8')](_0x43f218,{'showHidden':![],'depth':null}):'');};exports[_0x865e('0xb')]=function(_0x27c6d3,_0x4adb20){return client[_0x865e('0xb')](_0x27c6d3,{'body':_0x4adb20})[_0x865e('0xc')](function(_0x1b0fae){logger['debug'](_0x865e('0xd'),_0x27c6d3,_0x1b0fae?util[_0x865e('0x8')](_0x1b0fae,{'showHidden':![],'depth':null}):'');})['catch'](function(_0xd85c05){logger[_0x865e('0xa')](_0x865e('0xd'),_0x27c6d3,_0xd85c05?util[_0x865e('0x8')](_0xd85c05,{'showHidden':![],'depth':null}):'');});};function getUser(_0x196e20){return client['request'](_0x865e('0xe'),{'options':{'raw':!![],'attributes':['id',_0x865e('0xf'),'name',_0x865e('0x10')],'where':_0x196e20,'limit':0x1}})[_0x865e('0xc')](function(_0x339d8e){logger['debug'](_0x865e('0x11'),JSON[_0x865e('0x12')](_0x196e20),_0x339d8e?util[_0x865e('0x8')](_0x339d8e,{'showHidden':![],'depth':null}):'');return _0x339d8e[_0x865e('0x13')][_0x865e('0x14')]?_0x339d8e[_0x865e('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x55c9b9){return new BPromise(function(_0x369f58,_0x1f5d81){if(_0x55c9b9){return getUser({'internal':_0x55c9b9})[_0x865e('0xc')](function(_0x1a6dfb){logger[_0x865e('0x7')](_0x865e('0x15'),_0x55c9b9,_0x1a6dfb?'found':_0x865e('0x16'));return _0x369f58(_0x1a6dfb);})[_0x865e('0x17')](function(_0x4bed01){logger[_0x865e('0xa')](_0x865e('0x18'),_0x4bed01?util[_0x865e('0x8')](_0x4bed01,{'showHidden':![],'depth':null}):'');return _0x369f58(null);});}return _0x369f58(null);});};exports[_0x865e('0x19')]=function(_0x4ff417){return new BPromise(function(_0x388dc5,_0x20a963){if(_0x4ff417){return getUser({'interface':_0x4ff417})[_0x865e('0xc')](function(_0x500a52){logger[_0x865e('0x7')](_0x865e('0x1a'),_0x4ff417,_0x500a52?_0x865e('0x1b'):_0x865e('0x16'));return _0x388dc5(_0x500a52);})[_0x865e('0x17')](function(_0xfbbcf1){logger[_0x865e('0xa')](_0x865e('0x1c'),_0xfbbcf1?util[_0x865e('0x8')](_0xfbbcf1,{'showHidden':![],'depth':null}):'');return _0x388dc5(null);});}return _0x388dc5(null);});};exports[_0x865e('0x1d')]=function(_0x4ce460){return new BPromise(function(_0x28e228,_0x2d7c8c){if(_0x4ce460){return getUser({'name':_0x4ce460})[_0x865e('0xc')](function(_0x2029a2){logger[_0x865e('0x7')](_0x865e('0x1e'),_0x4ce460,_0x2029a2?'found':_0x865e('0x16'));return _0x28e228(_0x2029a2);})[_0x865e('0x17')](function(_0x39af4d){logger[_0x865e('0xa')](_0x865e('0x1f'),_0x39af4d?util[_0x865e('0x8')](_0x39af4d,{'showHidden':![],'depth':null}):'');return _0x28e228(null);});}return _0x28e228(null);});};exports['getVoiceQueueByName']=function(_0x2acdf6){return new BPromise(function(_0x65a27b,_0x7ec001){if(_0x2acdf6){return client[_0x865e('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x865e('0x20'),_0x865e('0x21'),'acw','acwTimeout'],'where':{'name':_0x2acdf6},'limit':0x1}})[_0x865e('0xc')](function(_0xac5c22){logger[_0x865e('0x9')](_0x865e('0x22'),_0x2acdf6,_0xac5c22?util[_0x865e('0x8')](_0xac5c22,{'showHidden':![],'depth':null}):'');logger[_0x865e('0x7')](_0x865e('0x23'),_0x2acdf6,_0xac5c22?_0x865e('0x1b'):_0x865e('0x16'));return _0x65a27b(_0xac5c22['result']['length']?_0xac5c22[_0x865e('0x13')][0x0]:null);})['catch'](function(_0x2c4633){logger['error'](_0x865e('0x24'),_0x2c4633?util[_0x865e('0x8')](_0x2c4633,{'showHidden':![],'depth':null}):'');return _0x65a27b(null);});}return _0x65a27b(null);});};exports[_0x865e('0x25')]=function(_0x535849,_0x28fd51){return moment(_0x535849)[_0x865e('0x26')](_0x28fd51,_0x865e('0x27'))[_0x865e('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x865e('0x29')]=function(_0x5c9cb5,_0x1875c5){return moment(_0x5c9cb5)[_0x865e('0x2a')](_0x1875c5,_0x865e('0x27'))[_0x865e('0x28')](_0x865e('0x2b'));};exports['diffTime']=function(_0x2b5423,_0x22114a){return moment(_0x2b5423)[_0x865e('0x2c')](moment(_0x22114a),'seconds');};exports[_0x865e('0x2d')]=function(_0x139b0c,_0x43fb6f){return parseInt(_0x139b0c,0xa)+parseInt(_0x43fb6f,0xa);};exports['now']=function(){return moment()[_0x865e('0x28')](_0x865e('0x2b'));};exports['isAfter']=function(_0x208fba,_0x4ae224){if(_0x4ae224){return moment(_0x208fba)[_0x865e('0x2e')](_0x4ae224);}return!![];};exports['isBefore']=function(_0x16a120,_0x1be187){if(_0x1be187){return moment(_0x16a120)[_0x865e('0x2f')](_0x1be187);}else if(_0x16a120){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 ccb4af3..48324b8 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 _0x11dd=['remoteAddress','url','statusCode','role','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)','method','responseTime','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','join','client','name','ensureDir','then','catch','log','user','no-user','data','timestamp','error','api','set','client-side-logger','use','logger','body','format','headers','x-forwarded-for','connection'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x11dd,0x6f));var _0xd11d=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x11dd[_0x349367];return _0x14179b;};var fs=require(_0xd11d('0x0'));var _=require(_0xd11d('0x1'));var ewinston=require(_0xd11d('0x2'));var path=require(_0xd11d('0x3'));var util=require(_0xd11d('0x4'));var fileLogger=require(_0xd11d('0x5'))['fileLogger'];var safeTemplate=require(_0xd11d('0x6'))[_0xd11d('0x7')];var maskSensitiveData=require(_0xd11d('0x8'))[_0xd11d('0x9')];function ClientSideLogger(){function _0x127f3f(_0x1683bc){var _0x5ae99f=path['join'](_0xd11d('0xa'),'log','xcally');var _0x16f9d0=path[_0xd11d('0xb')](_0xd11d('0xc'),_0x1683bc['role']+'-'+_0x1683bc[_0xd11d('0xd')]);return fs[_0xd11d('0xe')](path['join'](_0x5ae99f,_0x16f9d0))[_0xd11d('0xf')](function(){var _0x1e8c64=fileLogger('client',path[_0xd11d('0xb')](_0x5ae99f,_0x16f9d0));return _0x1e8c64;})[_0xd11d('0x10')](function(_0x297d6d){throw _0x297d6d;});}this[_0xd11d('0x11')]=function(_0x2cebad,_0x5362ea,_0x279846,_0x2be1af){return _0x127f3f(_0x2cebad[_0xd11d('0x12')])[_0xd11d('0xf')](function(_0x57c3a8){var _0x4e355f=_0x57c3a8[_0x5362ea];return _0x4e355f;})[_0xd11d('0xf')](function(_0x3b2a90){var _0x2b55b4=_0x2cebad['user']?_0x2cebad[_0xd11d('0x12')]['id']:_0xd11d('0x13');var _0x2887a5=_0x2be1af[_0xd11d('0x14')];var _0x11cf78=_0x2be1af[_0xd11d('0x15')];var _0x2ab8e4=new Date(Number(_0x11cf78));return _0x3b2a90(_0x2b55b4,_0x2ab8e4,_0x279846,_0x2887a5);})['catch'](function(_0x3bdf8a){fileLogger('client')[_0xd11d('0x16')](_0x3bdf8a);});};}function setupLoggers(_0x1cc3a6){return new Promise(function(_0x7f3a1d){var _0x28e6e8=new ClientSideLogger();var _0x3ca12d=fileLogger(_0xd11d('0x17'));var _0x4e39da=fileLogger('auth');_0x1cc3a6[_0xd11d('0x18')](_0xd11d('0x19'),_0x28e6e8);_0x1cc3a6[_0xd11d('0x1a')](ewinston[_0xd11d('0x1b')]({'winstonInstance':_0x3ca12d,'meta':![],'statusLevels':!![],'msg':function(_0x4369c9,_0x556d41){var _0x25f5b7='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_['isEmpty'](_0x4369c9[_0xd11d('0x1c')])){_0x25f5b7+='\x20body=%s';var _0x52a92d=_0x4369c9[_0xd11d('0x1c')];maskSensitiveData(_0x52a92d);}return safeTemplate(util[_0xd11d('0x1d')](_0x25f5b7,_0x4369c9['method'],_0x4369c9[_0xd11d('0x1e')][_0xd11d('0x1f')]?_0x4369c9[_0xd11d('0x1e')][_0xd11d('0x1f')]:_0x4369c9[_0xd11d('0x20')][_0xd11d('0x21')]||_0x4369c9['ip'],_0x4369c9[_0xd11d('0x22')],_0x556d41[_0xd11d('0x23')],_0x556d41['responseTime'],_0x4369c9['user']?_0x4369c9[_0xd11d('0x12')]['id']:null,_0x4369c9[_0xd11d('0x12')]?_0x4369c9[_0xd11d('0x12')][_0xd11d('0xd')]:null,_0x4369c9[_0xd11d('0x12')]?_0x4369c9[_0xd11d('0x12')][_0xd11d('0x24')]:null,_0x52a92d?util[_0xd11d('0x25')](_0x52a92d,![],null):''));}}));_0x1cc3a6[_0xd11d('0x1a')](ewinston[_0xd11d('0x1b')]({'winstonInstance':_0x4e39da,'meta':![],'statusLevels':!![],'msg':function(_0xaf8770,_0x1446fa){var _0x464cd8=_0xd11d('0x26');if(_0xaf8770['body']&&_0xaf8770[_0xd11d('0x1c')][_0xd11d('0x27')]&&_0xaf8770[_0xd11d('0x1c')][_0xd11d('0x28')]){_0x464cd8=_0xd11d('0x29');}return util[_0xd11d('0x1d')](_0x464cd8,_0xaf8770[_0xd11d('0x2a')],_0xaf8770[_0xd11d('0x1e')]['x-forwarded-for']?_0xaf8770[_0xd11d('0x1e')][_0xd11d('0x1f')]:_0xaf8770['connection'][_0xd11d('0x21')]||_0xaf8770['ip'],_0xaf8770['url'],_0x1446fa[_0xd11d('0x23')],_0x1446fa[_0xd11d('0x2b')],_0xaf8770[_0xd11d('0x12')]?_0xaf8770[_0xd11d('0x12')]['id']:null,_0xaf8770[_0xd11d('0x12')]?_0xaf8770[_0xd11d('0x12')]['name']:null,_0xaf8770[_0xd11d('0x12')]?_0xaf8770[_0xd11d('0x12')]['role']:null,_0xaf8770[_0xd11d('0x1c')]&&_0xaf8770['body'][_0xd11d('0x27')]?_0xaf8770[_0xd11d('0x1c')][_0xd11d('0x27')]:_0xd11d('0x2c'),_0xaf8770['body']&&_0xaf8770[_0xd11d('0x1c')][_0xd11d('0x28')]?_0xaf8770[_0xd11d('0x1c')][_0xd11d('0x28')]:'',_0xaf8770[_0xd11d('0x1c')]&&_0xaf8770[_0xd11d('0x1c')]['agent_name']?_0xaf8770[_0xd11d('0x1c')][_0xd11d('0x2d')]:'');},'ignoreRoute':function(_0x19f138){var _0x40a4ee=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x40a4ee[_0xd11d('0x2e')](_0x19f138['url']);}}));return _0x7f3a1d();});}exports[_0xd11d('0x2f')]=setupLoggers; \ No newline at end of file +var _0x3bf6=['xcally','client','role','name','ensureDir','then','catch','user','data','error','client-side-logger','use','logger','isEmpty','\x20body=%s','body','x-forwarded-for','headers','connection','remoteAddress','statusCode','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','url','device','other','agent_name','test','setupLoggers','fs-extra','lodash','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log'];(function(_0x113bef,_0x82b4a5){var _0x3b6d82=function(_0xc0df02){while(--_0xc0df02){_0x113bef['push'](_0x113bef['shift']());}};_0x3b6d82(++_0x82b4a5);}(_0x3bf6,0x107));var _0x63bf=function(_0x5c78f2,_0x1430d7){_0x5c78f2=_0x5c78f2-0x0;var _0x5760f2=_0x3bf6[_0x5c78f2];return _0x5760f2;};var fs=require(_0x63bf('0x0'));var _=require(_0x63bf('0x1'));var ewinston=require('express-winston');var path=require(_0x63bf('0x2'));var util=require(_0x63bf('0x3'));var fileLogger=require(_0x63bf('0x4'))[_0x63bf('0x5')];var safeTemplate=require(_0x63bf('0x6'))[_0x63bf('0x7')];var maskSensitiveData=require(_0x63bf('0x8'))[_0x63bf('0x9')];function ClientSideLogger(){function _0x4c4df9(_0x216bd4){var _0x6ad37e=path[_0x63bf('0xa')](_0x63bf('0xb'),_0x63bf('0xc'),_0x63bf('0xd'));var _0x516e3e=path[_0x63bf('0xa')](_0x63bf('0xe'),_0x216bd4[_0x63bf('0xf')]+'-'+_0x216bd4[_0x63bf('0x10')]);return fs[_0x63bf('0x11')](path[_0x63bf('0xa')](_0x6ad37e,_0x516e3e))[_0x63bf('0x12')](function(){var _0x3820e9=fileLogger(_0x63bf('0xe'),path[_0x63bf('0xa')](_0x6ad37e,_0x516e3e));return _0x3820e9;})[_0x63bf('0x13')](function(_0x3f03d9){throw _0x3f03d9;});}this[_0x63bf('0xc')]=function(_0x25d2ea,_0xfd946c,_0x17f47f,_0x531791){return _0x4c4df9(_0x25d2ea[_0x63bf('0x14')])['then'](function(_0x22f1c8){var _0x238cfd=_0x22f1c8[_0xfd946c];return _0x238cfd;})[_0x63bf('0x12')](function(_0x1b8e4f){var _0x52d771=_0x25d2ea[_0x63bf('0x14')]?_0x25d2ea['user']['id']:'no-user';var _0x180a94=_0x531791[_0x63bf('0x15')];var _0x3a5625=_0x531791['timestamp'];var _0x34c7b9=new Date(Number(_0x3a5625));return _0x1b8e4f(_0x52d771,_0x34c7b9,_0x17f47f,_0x180a94);})[_0x63bf('0x13')](function(_0x4b6529){fileLogger(_0x63bf('0xe'))[_0x63bf('0x16')](_0x4b6529);});};}function setupLoggers(_0x257b04){return new Promise(function(_0x4e2a2e){var _0xaac42b=new ClientSideLogger();var _0x447e71=fileLogger('api');var _0x59b3b5=fileLogger('auth');_0x257b04['set'](_0x63bf('0x17'),_0xaac42b);_0x257b04[_0x63bf('0x18')](ewinston[_0x63bf('0x19')]({'winstonInstance':_0x447e71,'meta':![],'statusLevels':!![],'msg':function(_0x1b09d9,_0x4e9564){var _0x470d2e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x63bf('0x1a')](_0x1b09d9['body'])){_0x470d2e+=_0x63bf('0x1b');var _0x505f95=_0x1b09d9[_0x63bf('0x1c')];maskSensitiveData(_0x505f95);}return safeTemplate(util['format'](_0x470d2e,_0x1b09d9['method'],_0x1b09d9['headers'][_0x63bf('0x1d')]?_0x1b09d9[_0x63bf('0x1e')][_0x63bf('0x1d')]:_0x1b09d9[_0x63bf('0x1f')][_0x63bf('0x20')]||_0x1b09d9['ip'],_0x1b09d9['url'],_0x4e9564[_0x63bf('0x21')],_0x4e9564[_0x63bf('0x22')],_0x1b09d9[_0x63bf('0x14')]?_0x1b09d9[_0x63bf('0x14')]['id']:null,_0x1b09d9[_0x63bf('0x14')]?_0x1b09d9['user']['name']:null,_0x1b09d9[_0x63bf('0x14')]?_0x1b09d9['user'][_0x63bf('0xf')]:null,_0x505f95?util['inspect'](_0x505f95,![],null):''));}}));_0x257b04[_0x63bf('0x18')](ewinston[_0x63bf('0x19')]({'winstonInstance':_0x59b3b5,'meta':![],'statusLevels':!![],'msg':function(_0xff6cfe,_0x159a3c){var _0x4c8146=_0x63bf('0x23');if(_0xff6cfe[_0x63bf('0x1c')]&&_0xff6cfe[_0x63bf('0x1c')]['device']&&_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x24')]){_0x4c8146=_0x63bf('0x25');}return util[_0x63bf('0x26')](_0x4c8146,_0xff6cfe[_0x63bf('0x27')],_0xff6cfe[_0x63bf('0x1e')][_0x63bf('0x1d')]?_0xff6cfe[_0x63bf('0x1e')][_0x63bf('0x1d')]:_0xff6cfe[_0x63bf('0x1f')][_0x63bf('0x20')]||_0xff6cfe['ip'],_0xff6cfe[_0x63bf('0x28')],_0x159a3c[_0x63bf('0x21')],_0x159a3c['responseTime'],_0xff6cfe[_0x63bf('0x14')]?_0xff6cfe[_0x63bf('0x14')]['id']:null,_0xff6cfe['user']?_0xff6cfe[_0x63bf('0x14')][_0x63bf('0x10')]:null,_0xff6cfe[_0x63bf('0x14')]?_0xff6cfe[_0x63bf('0x14')]['role']:null,_0xff6cfe[_0x63bf('0x1c')]&&_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x29')]?_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x29')]:_0x63bf('0x2a'),_0xff6cfe[_0x63bf('0x1c')]&&_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x24')]?_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x24')]:'',_0xff6cfe['body']&&_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x2b')]?_0xff6cfe[_0x63bf('0x1c')][_0x63bf('0x2b')]:'');},'ignoreRoute':function(_0x56464e){var _0x40f8b3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x40f8b3[_0x63bf('0x2c')](_0x56464e[_0x63bf('0x28')]);}}));return _0x4e2a2e();});}exports[_0x63bf('0x2d')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index b125d32..684dffd 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e91=['path','moment','winston','../config/environment','debugLevel','info','redBG\x20white','bold\x20yellow','white','bold\x20white','bold\x20green','bold\x20magenta','bold\x20cyan','addColors','join','format','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','Logger','transports','File','%s-%s','error','Console','warn','fileLogger'];(function(_0x1889d2,_0x340dfc){var _0x43d542=function(_0xca5572){while(--_0xca5572){_0x1889d2['push'](_0x1889d2['shift']());}};_0x43d542(++_0x340dfc);}(_0x5e91,0x15e));var _0x15e9=function(_0xeb4c8b,_0x1dc497){_0xeb4c8b=_0xeb4c8b-0x0;var _0x90b0d0=_0x5e91[_0xeb4c8b];return _0x90b0d0;};'use strict';var path=require(_0x15e9('0x0'));var util=require('util');var moment=require(_0x15e9('0x1'));var winston=require(_0x15e9('0x2'));var config=require(_0x15e9('0x3'));var debugLevel=config[_0x15e9('0x4')]?config[_0x15e9('0x4')]['toLowerCase']():_0x15e9('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':_0x15e9('0x6'),'error':'red','warn':_0x15e9('0x7'),'info':_0x15e9('0x8'),'print':_0x15e9('0x9'),'success':_0x15e9('0xa'),'http':'gray','verbose':_0x15e9('0xb'),'debug':'bold\x20blue','silly':_0x15e9('0xc')};winston[_0x15e9('0xd')](XC_LOG_COLORS);function getLogFileName(_0x39268c,_0x3341c3,_0x2de412){var _0x3a16f3=_0x39268c||'/var/log/xcally';return path[_0x15e9('0xe')](_0x3a16f3,util[_0x15e9('0xf')]('%s-%s.log',_0x3341c3,_0x2de412));}function formatter(_0x3c5b0f,_0x243777){_0x243777[_0x15e9('0x10')]=_0x243777[_0x15e9('0x10')]['replace'](/@@{/g,_0x15e9('0x11'))[_0x15e9('0x12')](/}@@/g,_0x15e9('0x13'))[_0x15e9('0x12')](/@{/g,'{{')[_0x15e9('0x12')](/}@/g,'}}');return util[_0x15e9('0xf')](_0x15e9('0x14'),moment()[_0x15e9('0xf')](_0x15e9('0x15')),_0x243777['level']['toUpperCase'](),_0x3c5b0f,_0x243777['message']);}function fileFormat(_0x15fa32,_0xed0848){_0xed0848[_0x15e9('0x10')]=_0xed0848[_0x15e9('0x10')][_0x15e9('0x12')](/@@{/g,_0x15e9('0x11'))[_0x15e9('0x12')](/}@@/g,_0x15e9('0x13'))[_0x15e9('0x12')](/@{/g,'{{')[_0x15e9('0x12')](/}@/g,'}}');var _0x4b7d47=_0xed0848[_0x15e9('0x16')]&&Object['keys'](_0xed0848['meta'])[_0x15e9('0x17')]?'\x0a\x09'+JSON[_0x15e9('0x18')](_0xed0848[_0x15e9('0x16')]):'';return util[_0x15e9('0xf')](_0x15e9('0x19'),moment()[_0x15e9('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),_0xed0848[_0x15e9('0x1a')]['toUpperCase'](),_0x15fa32,_0xed0848[_0x15e9('0x10')],_0x4b7d47);}function consoleLogger(){var _0x665c72=new winston[(_0x15e9('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x15e9('0x1c'))]['Console']({'level':'warn','json':![],'formatter':function(_0x158155){return formatter('',_0x158155);}})]});return _0x665c72;}function fileLogger(_0x44263,_0xbbdd08){var _0x140cef=new winston[(_0x15e9('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x15e9('0x1d'))]({'name':util[_0x15e9('0xf')](_0x15e9('0x1e'),_0x44263,_0x15e9('0x1f')),'filename':getLogFileName(_0xbbdd08,_0x44263,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x322d7e){return fileFormat(_0x44263,_0x322d7e);}}),new winston[(_0x15e9('0x1c'))][(_0x15e9('0x1d'))]({'name':util['format']('%s-%s',_0x44263,debugLevel),'filename':getLogFileName(_0xbbdd08,_0x44263,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x46f734){return fileFormat(_0x44263,_0x46f734);}}),new winston[(_0x15e9('0x1c'))][(_0x15e9('0x20'))]({'level':_0x15e9('0x21'),'json':![],'formatter':function(_0x2b934c){return fileFormat(_0x44263,_0x2b934c);}})]});return _0x140cef;}exports['consoleLogger']=consoleLogger;exports[_0x15e9('0x22')]=fileLogger; \ No newline at end of file +var _0x3bc6=['message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','format','level','toUpperCase','meta','keys','length','stringify','YYYY-MM-DD\x20HH:mm:ss','Logger','Console','warn','File','%s-%s','error','transports','consoleLogger','fileLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x3bc6,0x190));var _0x63bc=function(_0x55b347,_0x2011dc){_0x55b347=_0x55b347-0x0;var _0x572b9f=_0x3bc6[_0x55b347];return _0x572b9f;};'use strict';var path=require(_0x63bc('0x0'));var util=require(_0x63bc('0x1'));var moment=require('moment');var winston=require(_0x63bc('0x2'));var config=require(_0x63bc('0x3'));var debugLevel=config[_0x63bc('0x4')]?config[_0x63bc('0x4')][_0x63bc('0x5')]():_0x63bc('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':_0x63bc('0x7'),'error':_0x63bc('0x8'),'warn':_0x63bc('0x9'),'info':_0x63bc('0xa'),'print':_0x63bc('0xb'),'success':_0x63bc('0xc'),'http':_0x63bc('0xd'),'verbose':_0x63bc('0xe'),'debug':'bold\x20blue','silly':_0x63bc('0xf')};winston[_0x63bc('0x10')](XC_LOG_COLORS);function getLogFileName(_0x264f20,_0x298b34,_0x59bebc){var _0x1572c7=_0x264f20||_0x63bc('0x11');return path[_0x63bc('0x12')](_0x1572c7,util['format'](_0x63bc('0x13'),_0x298b34,_0x59bebc));}function formatter(_0x4634f9,_0x4dfa08){_0x4dfa08['message']=_0x4dfa08[_0x63bc('0x14')][_0x63bc('0x15')](/@@{/g,_0x63bc('0x16'))[_0x63bc('0x15')](/}@@/g,_0x63bc('0x17'))[_0x63bc('0x15')](/@{/g,'{{')[_0x63bc('0x15')](/}@/g,'}}');return util['format'](_0x63bc('0x18'),moment()[_0x63bc('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4dfa08[_0x63bc('0x1a')][_0x63bc('0x1b')](),_0x4634f9,_0x4dfa08[_0x63bc('0x14')]);}function fileFormat(_0x37355a,_0x17657e){_0x17657e[_0x63bc('0x14')]=_0x17657e[_0x63bc('0x14')]['replace'](/@@{/g,'{{{')[_0x63bc('0x15')](/}@@/g,_0x63bc('0x17'))[_0x63bc('0x15')](/@{/g,'{{')[_0x63bc('0x15')](/}@/g,'}}');var _0x3ce467=_0x17657e[_0x63bc('0x1c')]&&Object[_0x63bc('0x1d')](_0x17657e[_0x63bc('0x1c')])[_0x63bc('0x1e')]?'\x0a\x09'+JSON[_0x63bc('0x1f')](_0x17657e['meta']):'';return util[_0x63bc('0x19')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x63bc('0x19')](_0x63bc('0x20')),_0x17657e[_0x63bc('0x1a')][_0x63bc('0x1b')](),_0x37355a,_0x17657e['message'],_0x3ce467);}function consoleLogger(){var _0x133fbf=new winston[(_0x63bc('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x63bc('0x22'))]({'level':_0x63bc('0x23'),'json':![],'formatter':function(_0x4ae178){return formatter('',_0x4ae178);}})]});return _0x133fbf;}function fileLogger(_0x58cf4a,_0x59ea0f){var _0x13a08c=new winston[(_0x63bc('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x63bc('0x24'))]({'name':util[_0x63bc('0x19')](_0x63bc('0x25'),_0x58cf4a,'error'),'filename':getLogFileName(_0x59ea0f,_0x58cf4a,_0x63bc('0x26')),'level':_0x63bc('0x26'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1874b0){return fileFormat(_0x58cf4a,_0x1874b0);}}),new winston[(_0x63bc('0x27'))][(_0x63bc('0x24'))]({'name':util[_0x63bc('0x19')](_0x63bc('0x25'),_0x58cf4a,debugLevel),'filename':getLogFileName(_0x59ea0f,_0x58cf4a,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xf67929){return fileFormat(_0x58cf4a,_0xf67929);}}),new winston[(_0x63bc('0x27'))][(_0x63bc('0x22'))]({'level':'warn','json':![],'formatter':function(_0x552ff0){return fileFormat(_0x58cf4a,_0x552ff0);}})]});return _0x13a08c;}exports[_0x63bc('0x28')]=consoleLogger;exports[_0x63bc('0x29')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 41e204b..ce6fb45 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 _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(_0x2f7b4f,_0x138eef){var _0x332b6b=function(_0x5d0364){while(--_0x5d0364){_0x2f7b4f['push'](_0x2f7b4f['shift']());}};_0x332b6b(++_0x138eef);}(_0xda2d,0x102));var _0xdda2=function(_0x38b6e8,_0x389246){_0x38b6e8=_0x38b6e8-0x0;var _0x45d71d=_0xda2d[_0x38b6e8];return _0x45d71d;};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 +var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x3cf4d3,_0x48065e){var _0x4e547b=function(_0x28f85a){while(--_0x28f85a){_0x3cf4d3['push'](_0x3cf4d3['shift']());}};_0x4e547b(++_0x48065e);}(_0x0295,0x1f0));var _0x5029=function(_0x35d294,_0x3a9b4){_0x35d294=_0x35d294-0x0;var _0xb9ae9a=_0x0295[_0x35d294];return _0xb9ae9a;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index fc69109..65d3732 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 _0x8e3f=['reduce','exports','safeTemplate','lodash','{\x20{\x20','string','isArray','map','isPlainObject','keys'];(function(_0xafcc0e,_0x3792a7){var _0x3b4144=function(_0x20f136){while(--_0x20f136){_0xafcc0e['push'](_0xafcc0e['shift']());}};_0x3b4144(++_0x3792a7);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e3f[_0x40a045];return _0x1a687c;};var _=require(_0xf8e3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x42db69){return _0x42db69==='{{'?_0xf8e3('0x1'):'\x20}\x20}';}function safeTemplate(_0x3f3440){var _0x292de5=_0x3f3440;if(typeof _0x3f3440===_0xf8e3('0x2')){_0x292de5=_0x3f3440['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xf8e3('0x3')](_0x3f3440)){_0x292de5=_0x3f3440[_0xf8e3('0x4')](function(_0x4dab56){return safeTemplate(_0x4dab56);});}else if(_[_0xf8e3('0x5')](_0x3f3440)){_0x292de5=Object[_0xf8e3('0x6')](_0x3f3440)[_0xf8e3('0x7')](function(_0x1ee9f3,_0x4e9e57){_0x1ee9f3[_0x4e9e57]=safeTemplate(_0x3f3440[_0x4e9e57]);return _0x1ee9f3;},{});}return _0x292de5;}module[_0xf8e3('0x8')][_0xf8e3('0x9')]=safeTemplate; \ No newline at end of file +var _0x93e9=['string','map','isPlainObject','keys','reduce','exports','lodash','{\x20{\x20','\x20}\x20}'];(function(_0x474c77,_0xc38c39){var _0x5706ab=function(_0x3a4335){while(--_0x3a4335){_0x474c77['push'](_0x474c77['shift']());}};_0x5706ab(++_0xc38c39);}(_0x93e9,0xcc));var _0x993e=function(_0x1d8d83,_0x5c58da){_0x1d8d83=_0x1d8d83-0x0;var _0x13a3a5=_0x93e9[_0x1d8d83];return _0x13a3a5;};var _=require(_0x993e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xcf3bfd){return _0xcf3bfd==='{{'?_0x993e('0x1'):_0x993e('0x2');}function safeTemplate(_0x43b7b0){var _0x2a63eb=_0x43b7b0;if(typeof _0x43b7b0===_0x993e('0x3')){_0x2a63eb=_0x43b7b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x43b7b0)){_0x2a63eb=_0x43b7b0[_0x993e('0x4')](function(_0x255045){return safeTemplate(_0x255045);});}else if(_[_0x993e('0x5')](_0x43b7b0)){_0x2a63eb=Object[_0x993e('0x6')](_0x43b7b0)[_0x993e('0x7')](function(_0x2366d9,_0x12ac94){_0x2366d9[_0x12ac94]=safeTemplate(_0x43b7b0[_0x12ac94]);return _0x2366d9;},{});}return _0x2a63eb;}module[_0x993e('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file